<?xml version="1.0" encoding="utf-8"?>
<posts>
  <row Id="1" PostTypeId="1" AcceptedAnswerId="18" CreationDate="2018-03-12T17:00:45.567" Score="69" ViewCount="4538" Body="&lt;p&gt;I know that a &lt;a href=&quot;https://en.wikipedia.org/wiki/Turing_machine&quot; rel=&quot;noreferrer&quot;&gt;Turing machine&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt; can theoretically simulate &quot;anything&quot;, but I don't know whether it could simulate something as fundamentally different as a quantum-based computer.  Are there any attempts to do this, or has anybody proved it possible/not possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've googled around, but I'm not an expert on this topic, so I'm not sure where to look. I've found the Wikipedia article on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Turing_machine&quot; rel=&quot;noreferrer&quot;&gt;quantum Turing machine&lt;/a&gt;, but I'm not certain how exactly it differs from a classical TM. I also found the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0701108&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Deutsch's Universal Quantum Turing Machine&lt;/em&gt;&lt;/a&gt;, by&#xA;W. Fouché et al., but it is rather difficult to understand for me.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&#xA;1. In case it is not clear, by Turing machine I mean the theoretical concept, not a physical machine (i.e. an implementation of the theoretical concept).&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user7" LastEditorUserId="55" LastEditDate="2020-09-23T12:18:21.673" LastActivityDate="2020-09-23T12:18:21.673" Title="Can a Turing machine simulate a quantum computer?" Tags="&lt;simulation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="14" ContentLicense="CC BY-SA 3.0" />
  <row Id="3" PostTypeId="1" AcceptedAnswerId="86" CreationDate="2018-03-12T17:12:07.927" Score="44" ViewCount="2492" Body="&lt;p&gt;Quantum computers are known to be able to crack &lt;a href=&quot;https://en.wikipedia.org/wiki/Time_complexity#Polynomial_time&quot; rel=&quot;noreferrer&quot;&gt;in polynomial time&lt;/a&gt; a broad range of cryptographic algorithms which were previously thought to be solvable only by resources increasing exponentially with the bit size of the key. An example for that is &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, as far I know, not all problems fall into this category. On &lt;a href=&quot;https://physics.aps.org/synopsis-for/10.1103/PhysRevA.94.012320&quot; rel=&quot;noreferrer&quot;&gt;Making Hard Problems for Quantum Computers&lt;/a&gt;, we can read&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Researchers have developed a computer algorithm that doesn’t solve problems but instead creates them for the purpose of evaluating quantum computers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can we still expect &lt;strong&gt;a new cryptographic algorithm which will be hard to crack using even a quantum computer&lt;/strong&gt;?&#xA;&lt;em&gt;For clarity: the question refers to specifically to the design of new algorithms&lt;/em&gt;. &lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="1847" LastEditDate="2018-04-10T05:24:10.430" LastActivityDate="2019-02-13T15:40:18.627" Title="Is it possible for an encryption method to exist which is impossible to crack, even using quantum computers?" Tags="&lt;complexity-theory&gt;&lt;cryptography&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="4" PostTypeId="1" AcceptedAnswerId="84" CreationDate="2018-03-12T17:16:15.717" Score="14" ViewCount="1584" Body="&lt;p&gt;Quantum gates are represented by matrices, which represent the transformations applied to qubits (states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have some quantum gate which operates on $2$ qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does the quantum gate &lt;em&gt;affect&lt;/em&gt; (not necessarily change it) the result of measuring the state of the qubits (as the measurement result is affected greatly by the probabilities of each possible state)? More specifically, is it possible to know, in advance, how the probabilities of each state change due to the quantum gate?&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="26" LastEditDate="2018-12-23T12:05:19.717" LastActivityDate="2018-12-23T12:05:19.717" Title="How do the probabilities of each state change after a transformation of a quantum gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="5" PostTypeId="2" ParentId="1" CreationDate="2018-03-12T17:18:12.873" Score="9" Body="&lt;p&gt;To simulate the collapse of the wave function you'd need a source of randomness. So you'd need a &lt;a href=&quot;https://en.wikipedia.org/wiki/Probabilistic_Turing_machine&quot; rel=&quot;noreferrer&quot;&gt;probabilistic Turing machine&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="29" LastActivityDate="2018-03-12T17:18:12.873" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="6" PostTypeId="1" AcceptedAnswerId="48" CreationDate="2018-03-12T17:21:02.420" Score="9" ViewCount="230" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The minimum size of a computer that could simulate the universe would&#xA;  be the universe itself.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is quite a pretty big theory in classical computing and physics because to contain the information of the whole universe, you require a minimum information storage space that is of the size of the universe itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, quantum computing computes and stores data in parallel to other data and thus while being efficient is actually more compact. We are talking ideal systems, so cooling mechanisms don't count as part of the computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Then, could such a system simulate the whole universe?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I thought of a solution that I don't know how to actually prove. My logic is mostly based on the many worlds interpretation of quantum mechanics and that a quantum computer actually uses different universes to compute in parallel, thus increasing memory space and speed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any inputs will be gladly received and are highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14" LastEditorUserId="55" LastEditDate="2019-11-07T11:10:46.663" LastActivityDate="2019-11-07T11:10:46.663" Title="Simulating a system inside a system" Tags="&lt;simulation&gt;&lt;memory-space&gt;&lt;interpretations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7" PostTypeId="1" AcceptedAnswerId="89" CreationDate="2018-03-12T17:21:33.720" Score="17" ViewCount="498" Body="&lt;p&gt;Recent researches indicate that quantum algorithms are able to solve typical cryptology problems much faster than classic algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have any quantum algorithms &lt;strong&gt;for encryption&lt;/strong&gt; been developed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm aware about &lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;noreferrer&quot;&gt;BB84&lt;/a&gt;, but it only seems to be a partial solution for solving the networking.&lt;/p&gt;&#xA;" OwnerUserId="31" LastEditorUserId="31" LastEditDate="2018-03-12T17:36:51.233" LastActivityDate="2019-12-29T16:36:17.213" Title="How is quantum cryptography different from cryptography used nowadays?" Tags="&lt;cryptography&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="8" PostTypeId="1" AcceptedAnswerId="10" CreationDate="2018-03-12T17:22:39.400" Score="11" ViewCount="184" Body="&lt;ol&gt;&#xA;&lt;li&gt;The enthusiast-level, inaccurate knowledge about quantum computers is that they can solve many exponentially solvable problems in polynomial time.&lt;/li&gt;&#xA;&lt;li&gt;The enthusiast-level, inaccurate knowledge about &lt;a href=&quot;https://en.wikipedia.org/wiki/Chaos_theory&quot; rel=&quot;noreferrer&quot;&gt;chaotic systems&lt;/a&gt; is that being highly sensitive to initial conditions, their prediction and control is very hard above a - typically, not enough - accuracy.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Today, one of the most famous practical usage of chaotic systems is the problem of modeling the weather of the Earth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting (1) and (2) together, I think using quantum computers, we may have a significant (polynomial to exponential) step to handle them. Is it correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we have any essential advantage to handle chaos even more than this?&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="26" LastEditDate="2018-12-13T19:35:06.327" LastActivityDate="2018-12-13T19:35:06.327" Title="Does quantum computing have an essential advantage in analyzing/controlling chaotic systems?" Tags="&lt;applications&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="10" PostTypeId="2" ParentId="8" CreationDate="2018-03-12T17:30:10.817" Score="4" Body="&lt;p&gt;Not always. Some problems are non-deterministic (their solution). Apart from that, some problems are, as you say, so sensitive to changes in initial conditions, that most solutions are too localized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there are cases where quantum computers can provide insightful results, that might shed light on different approaches to solutions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another point to consider is the use of Numerical methods in chaotic systems. Some methods are more optimal than others, at the cost of accuracy. With quantum computers, computation time decreases by a lot (acc. to theory), which may allow more accurate calculations, leading to a better understanding of the more difficult chaotic systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify: Quantum computers might not be able to give an analytical solution (even to problems that &lt;em&gt;might&lt;/em&gt; have such solutions), but a more accurate approximation can often lead to a new understanding of the problem, which is a way to handle problems.&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="13" LastEditDate="2018-03-12T17:36:42.897" LastActivityDate="2018-03-12T17:36:42.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="11" PostTypeId="2" ParentId="8" CreationDate="2018-03-12T17:31:24.650" Score="5" Body="&lt;p&gt;No.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chaos (as described in chaotic systems) is deterministic, and the evolution of such a system can be calculated using classical deterministic equations. The problem is the strong divergence of the different trajectories that even small differences in initial values can lead to large differences in the final values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computing does not help in this situation.&lt;/p&gt;&#xA;" OwnerUserId="18" LastActivityDate="2018-03-12T17:31:24.650" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="12" PostTypeId="1" AcceptedAnswerId="24" CreationDate="2018-03-12T17:36:27.727" Score="69" ViewCount="8253" Body="&lt;p&gt;Is there any way to emulate a quantum computer in my normal computer, so that I will be able to test and try quantum programming languages (such as &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-qr-intro?view=qsharp-preview&quot; rel=&quot;noreferrer&quot;&gt;Q#&lt;/a&gt;)? I mean something that I can really test my hypothesis and gets the most accurate results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I'm not really looking for simulating a quantum computer, but I'm not sure if its possible to efficiently emulate one on a normal non-quantum based PC.&lt;/p&gt;&#xA;" OwnerUserId="40" LastEditorUserId="26" LastEditDate="2019-03-12T09:12:36.277" LastActivityDate="2019-11-07T19:07:42.120" Title="Are there emulators for quantum computers?" Tags="&lt;emulation&gt;" AnswerCount="7" CommentCount="3" FavoriteCount="18" ContentLicense="CC BY-SA 3.0" />
  <row Id="13" PostTypeId="2" ParentId="3" CreationDate="2018-03-12T17:40:28.427" Score="20" Body="&lt;p&gt;I suppose there is a type of encryption that is not crackable using quantum computers: a &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;noreferrer&quot;&gt;one-time pad&lt;/a&gt; such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher&quot; rel=&quot;noreferrer&quot;&gt;Vigenère cipher&lt;/a&gt;. This is a cipher with a keypad that has at least the length of the encoded string and will be used only once. This cipher is impossible to crack even with a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will explain why:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume our plaintext is &lt;code&gt;ABCD&lt;/code&gt;. The corresponding key could be &lt;code&gt;1234&lt;/code&gt;. If you encode it then you get &lt;code&gt;XYZW&lt;/code&gt;. Now you can use &lt;code&gt;1234&lt;/code&gt; to get &lt;code&gt;ABCD&lt;/code&gt; or &lt;code&gt;4678&lt;/code&gt; to get &lt;code&gt;EFGH&lt;/code&gt; what might be a valid sentence too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the problem is that nobody can decide whether you meant &lt;code&gt;ABCD&lt;/code&gt; or &lt;code&gt;EFGH&lt;/code&gt; without knowing your key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only reason this kind of encryption can be cracked is that the users are lazy and use a key twice. And then you can try to crack it. Other problems are, as @peterh stated that one-time-pads require a secret channel to be shared&lt;/p&gt;&#xA;" OwnerUserId="11" LastEditorUserId="253" LastEditDate="2018-04-02T08:42:35.387" LastActivityDate="2018-04-02T08:42:35.387" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="14" PostTypeId="2" ParentId="3" CreationDate="2018-03-12T17:45:21.307" Score="18" Body="&lt;p&gt;Yes, there are a lot of proposals for &lt;a href=&quot;https://en.wikipedia.org/wiki/Post-quantum_cryptography&quot; rel=&quot;noreferrer&quot;&gt;Post-quantum cryptographical&lt;/a&gt; algorithms that provide the cryptographic primitives that we are used to (including asymmetric encryption with private and public keys).&lt;/p&gt;&#xA;" OwnerUserId="18" LastEditorUserId="18" LastEditDate="2018-03-12T18:11:13.767" LastActivityDate="2018-03-12T18:11:13.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="17" PostTypeId="2" ParentId="7" CreationDate="2018-03-12T17:50:46.827" Score="3" Body="&lt;p&gt;There is a cryptographic primitive that is only realisable with quantum computation: A &lt;a href=&quot;https://eprint.iacr.org/2013/606.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;revocable timelock&lt;/a&gt;. The base idea is to set up a problem that needs a certain time to be solved on a quantum computer, but the quantum computation can be cancelled in a &lt;em&gt;provable&lt;/em&gt; way.&lt;/p&gt;&#xA;" OwnerUserId="18" LastActivityDate="2018-03-12T17:50:46.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="18" PostTypeId="2" ParentId="1" CreationDate="2018-03-12T17:59:39.560" Score="44" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;Yes&lt;/em&gt;&lt;/strong&gt;, a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;quantum computer&lt;/a&gt; could be simulated by a &lt;a href=&quot;https://en.wikipedia.org/wiki/Turing_machine&quot; rel=&quot;noreferrer&quot;&gt;Turing machine&lt;/a&gt;, though this shouldn't be taken to imply that real-world quantum computers couldn't enjoy &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_supremacy&quot; rel=&quot;noreferrer&quot;&gt;quantum advantage&lt;/a&gt;, i.e. a significant implementation advantage over real-world classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a rule-of-thumb, if a human could manually describe or imagine how something ought to operate, that imagining can be implemented on a Turing machine.  Quantum computers fall into this category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At current, a big motivation for quantum computing is that &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;noreferrer&quot;&gt;qubits&lt;/a&gt; can exist in &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Qubit_states&quot; rel=&quot;noreferrer&quot;&gt;superpositions&lt;/a&gt;,$$&#xA;\left| \psi \right&amp;gt; = \alpha \left| 0 \right&amp;gt; + \beta \left| 1 \right&amp;gt;, \tag{1}&#xA;$$essentially allowing for massively parallel computation.  Then there's &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;quantum annealing&lt;/a&gt; and other little tricks that are basically &lt;a href=&quot;https://en.wikipedia.org/wiki/Analog_computer&quot; rel=&quot;noreferrer&quot;&gt;analog computing&lt;/a&gt; tactics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, those benefits are about efficiency.  In some cases, that efficiency is beyond astronomical, enabling stuff that wouldn't have been practical on classical hardware.  This causes quantum computing to have major applications in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_cryptography&quot; rel=&quot;noreferrer&quot;&gt;cryptography&lt;/a&gt; and such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, quantum computing isn't currently motivated by a desire for things that we fundamentally couldn't do before.  If a quantum computer can perform an operation, then a classical Turing machine could perform a simulation of a quantum computer performing that operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Randomness isn't a problem.  I guess two big reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Randomness can be more precisely captured by using &lt;a href=&quot;https://en.wikipedia.org/wiki/Distribution_(mathematics)#Operations_on_distributions&quot; rel=&quot;noreferrer&quot;&gt;distribution math&lt;/a&gt; anyway.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Randomness isn't a real &quot;&lt;em&gt;thing&lt;/em&gt;&quot; to begin with; it's merely ignorance.  And we can always produce ignorance.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15" LastEditorUserId="15" LastEditDate="2018-04-29T21:10:40.053" LastActivityDate="2018-04-29T21:10:40.053" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="20" PostTypeId="1" AcceptedAnswerId="1449" CreationDate="2018-03-12T18:02:31.377" Score="8" ViewCount="449" Body="&lt;p&gt;Quantum computing can be used to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;efficiently simulate&lt;/a&gt; quantum many-body systems.&#xA;Solving such a problem is classically hard because its complexity grows exponentially with the problem size (roughly with the degree of freedoms), which is an inherent consequence of the Schroedinger-equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My intuitive understanding of this fact is that using quantum computers, we can essentially simulate the quantum many-body system, thus making the theoretical calculation essentially an experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about the reverse problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, consider the situation in which&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we have a description of a quantum many-body system, i.e. we know a formalized set of requirements whose behavior it should follow,&lt;/li&gt;&#xA;&lt;li&gt;and we are trying to find the actual system for this description?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In a practical example, we have the required properties of a chemical compound. The goal is to find a chemical formula which fulfills the requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks for me a harder task as to calculate the physical properties of a known compound (which is, in essence, &quot;only&quot; a solution of the Schroedinger-equation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, such a description of a practical problem in human language would be this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I want a room temperature superconductor.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And the output would be:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The formula is: ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;Extension:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;We have the dynamics, or some type of behavior of the system. In the case of chemical compounds, it could be, for example, excitation spectrum or superconductivity transition temperature. The important thing is that we have here a different direction: not from a given QM system do we want to calculate the behavior (= Schroedinger equation), but we have a wanted behavior (now: superconductivity transition temperature), we have a nearly-infinite set of possible compounds, and we are looking for the compound which fulfills the selection criteria (&lt;span class=&quot;math-container&quot;&gt;$T_c \geq 300K$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="26" LastEditDate="2019-05-14T14:18:31.593" LastActivityDate="2019-05-14T14:18:31.593" Title="Can we synthesize quantum many body systems with quantum computers quickly in the general case?" Tags="&lt;simulation&gt;&lt;many-body-systems&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="21" PostTypeId="1" AcceptedAnswerId="178" CreationDate="2018-03-12T18:04:22.563" Score="-3" ViewCount="537" Body="&lt;p&gt;Quantum entanglement is 2 atoms that are paired together and when you stop one from spinning the other also stops with the same spin. Can you use these pairs to have faster-than-light (FTL) communication between 2 computers?&lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorUserId="26" LastEditDate="2019-05-14T14:58:35.790" LastActivityDate="2019-05-14T14:58:35.790" Title="Quantum entanglement for faster-than-light (FTL) network communication?" Tags="&lt;entanglement&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="22" PostTypeId="2" ParentId="4" CreationDate="2018-03-12T18:06:32.387" Score="4" Body="&lt;p&gt;Yes, it is possible. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum gates&lt;/a&gt; are designed such that given input states are transformed to well defined output states with computable probabilities. The transformation does not constitute a &lt;em&gt;measurement&lt;/em&gt; in the sense of quantum mechanics, this means that we can have entangled states in the output of a quantum gate and use these states for further computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that the input states are no longer accessible after being transformed by a quantum gate. If you want to get them back, you have to apply an inverse gate.&lt;/p&gt;&#xA;" OwnerUserId="18" LastEditorUserId="18" LastEditDate="2018-03-12T18:09:51.643" LastActivityDate="2018-03-12T18:09:51.643" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="23" PostTypeId="1" AcceptedAnswerId="25" CreationDate="2018-03-12T18:12:22.420" Score="32" ViewCount="1938" Body="&lt;p&gt;Similar to the question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1/could-a-turing-machine-simulate-a-quantum-computer&quot;&gt;Could a Turing Machine simulate a quantum computer?&lt;/a&gt;: given a 'classical' algorithm, is it always possible to formulate an equivalent algorithm which can be performed on a quantum computer? If yes, is there some kind of procedure we can follow for this? The resulting algorithm will probably not take full advantage of the possibilities of quantum computing, it's more of a theoretical question.&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="55" LastEditDate="2020-09-23T12:19:47.563" LastActivityDate="2021-02-01T11:26:58.410" Title="Can a quantum computer simulate a normal computer?" Tags="&lt;simulation&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="24" PostTypeId="2" ParentId="12" CreationDate="2018-03-12T18:12:25.120" Score="40" Body="&lt;p&gt;Yes, it's possible (but slow). There are a couple of existing (this is only a partial list) emulators:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://thegreves.com/david/QDD/qdd.html&quot; rel=&quot;noreferrer&quot;&gt;QDD: A Quantum Computer Emulation Library&lt;/a&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;QDD is a C++ library which provides a relatively intuitive set of quantum computing constructs within the context of the C++ programming environment. QDD is unique in that the its emulation of quantum computing is based upon a Binary Decision Diagram (BDD) representation of the quantum state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://jquantum.sourceforge.net/&quot; rel=&quot;noreferrer&quot;&gt;jQuantum&lt;/a&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;jQuantum is a program which simulates a quantum computer. You can design quantum circuits with it and let them run. The current state of the quantum register is illustrated. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.compphys.org/QCE/&quot; rel=&quot;noreferrer&quot;&gt;QCE&lt;/a&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;QCE is a software tool that emulates various hardware designs of Quantum Computers. QCE simulates the physical processes that govern the operation of a hardware quantum processor, strictly according to the laws of quantum mechanics. QCE also provides an environment to debug and execute quantum algorithms under realistic experimental conditions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;(In addition, Q# only works with MS's &lt;a href=&quot;https://www.microsoft.com/en-us/quantum/development-kit&quot; rel=&quot;noreferrer&quot;&gt;QDK&lt;/a&gt;, thanks @Pavel)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The downside to all of these is simple: they still run on binary (non-quantum) circuits.  To the best of my knowledge, there's no easily accessible quantum &lt;em&gt;computer&lt;/em&gt; to use for running these things. And since it takes multiple binary bits to express a single qubit, the amount of computational power needed to simulate a quantum program gets large very quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll quote a paper on the subject (&lt;a href=&quot;https://www.doc.ic.ac.uk/teaching/distinguished-projects/2010/s.allcock.pdf&quot; rel=&quot;noreferrer&quot;&gt;J. Allcock, 2010&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Our evaluation shows that our implementations are very accurate, but at the same time we use a significant amount of additional memory in order to achieve this. Reducing our aims for accuracy would allow us to decrease representation size, and therefore emulate more qubits with the same amount of memory.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;p 89, section 5.1&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As our implementations get more accurate, they also get slower.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL;DR: it's possible, and some emulators exist, but none are very efficient for large amounts of qubits.&lt;/p&gt;&#xA;" OwnerDisplayName="user7" LastEditorDisplayName="user7" LastEditDate="2018-03-12T19:27:02.733" LastActivityDate="2018-03-12T19:27:02.733" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="25" PostTypeId="2" ParentId="23" CreationDate="2018-03-12T18:21:34.100" Score="27" Body="&lt;p&gt;Yes, it can do so in a rather trivial way: Use only reversible classical logical gates to simulate computations using boolean logic (for instance, using Toffoli to simulate NAND gates), use only the standard basis states &lt;span class=&quot;math-container&quot;&gt;$\lvert 0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert 1\rangle$&lt;/span&gt; as input, and only perform standard basis state measurements at the output. In this way you can simulate  exactly the same calculations as the classical computer does, on a gate-by-gate basis.&lt;/p&gt;&#xA;" OwnerUserId="18" LastEditorUserId="9482" LastEditDate="2021-02-01T11:26:58.410" LastActivityDate="2021-02-01T11:26:58.410" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="27" PostTypeId="2" ParentId="12" CreationDate="2018-03-12T18:25:08.263" Score="14" Body="&lt;p&gt;If you're specifically looking at Q#, then it's super easy to use with an emulator -- in fact, it's not possible to have Q# but not have the emulator, they're bundled together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get started, first you need to download .NET Core from &lt;a href=&quot;https://www.microsoft.com/net/learn/get-started/&quot; rel=&quot;noreferrer&quot;&gt;Microsoft's website&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you download Microsoft's Quantum Development Kit through &lt;code&gt;dotnet new -i &quot;Microsoft.Quantum.ProjectTemplates::0.2-*&quot;&lt;/code&gt; or Microsoft's website, it downloads both the language and Microsoft's own emulator together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating a new Q# project (&lt;code&gt;dotnet new console -lang Q#&lt;/code&gt;) will automatically configure it to use the emulator, so when you type in some Q# and run the project it &quot;just works&quot;.&lt;/p&gt;&#xA;" OwnerUserId="70" LastActivityDate="2018-03-12T18:25:08.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="30" PostTypeId="2" ParentId="12" CreationDate="2018-03-12T18:56:11.537" Score="27" Body="&lt;p&gt;Yes, it is possible to simulate a quantum computer on a normal one – But you most likely have to sacrifice efficiency.&lt;/p&gt;&#xA;&lt;p&gt;The dimension of the state space rises exponentially with the number of qubits (&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits), so the linear algebra you will be dealing with won't be too light – You'll encounter very large matrices and the algorithm you use (regardless of how efficient it is) will likely become &lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_growth&quot; rel=&quot;noreferrer&quot;&gt;exponentially-scaling&lt;/a&gt; pretty fast. However, emulating a QC on a normal machine is definitely possible.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Resources&lt;/h3&gt;&#xA;&lt;p&gt;You may be interested in Q# as other answers noted. Some more emulators:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.quantumplayground.net/#/home&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing Playground&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Quantum Computing Playground is a browser-based WebGL Chrome Experiment. It features a GPU-accelerated quantum computer with a simple IDE interface, and its own scripting language with debugging and 3D quantum state visualization features. Quantum Computing Playground can efficiently simulate quantum registers up to 22 qubits, run Grover's and Shor's algorithms, and has a variety of quantum gates built into the scripting language itself.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://quantum-studio.net/&quot; rel=&quot;noreferrer&quot;&gt;QX Simulator&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The QX Simulator is a universal quantum computer simulator developped at QuTech by Nader Khammassi. The QX allows quantum algorithm designers to simulate the execution of their quantum circuits on a quantum computer. The simulator defines a low-level quantum assembly language namely Quantum Code which allows the users to describe their circuits in a simple textual source code file. The source code file is then used as the input of the simulator which executes its content.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/vsoftco/qpp&quot; rel=&quot;noreferrer&quot;&gt;Quantum++&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Quantum++ is a modern C++11 general purpose quantum computing library, composed solely of template header files. Quantum++ is written in standard C++11 and has very low external dependencies, using only the Eigen 3 linear algebra header-only template library and, if available, the OpenMP multi-processing library.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://tph.tuwien.ac.at/%7Eoemer/qcl.html&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computer Language&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Despite many common concepts with classical computer science, quantum computing is still widely considered as a special discipline within the broad field of theoretical physics. [...] QCL (Quantum Computation Language) tries to fill this gap: QCL is a high level, architecture independent programming language for quantum computers, with a syntax derived from classical procedural languages like C or Pascal. This allows for the complete implementation and simulation of quantum algorithms (including classical components) in one consistent formalism.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More relevant emulators can be found on &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;noreferrer&quot;&gt;Quantiki&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="35" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-03-12T21:22:26.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="31" PostTypeId="5" CreationDate="2018-03-12T18:58:42.597" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computers&lt;/a&gt; are devices which, exploiting intrinsically quantum mechanical phenomena, are believed to be able to perform certain operations more efficiently.&#xA;While the basic unit of information that is manipulated by classical computers is the &lt;em&gt;bit&lt;/em&gt;, quantum computers manipulate &lt;em&gt;quantum states&lt;/em&gt;, often in the form two-level quantum systems typically referred to as &lt;em&gt;qubits&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Several models for quantum computation have been proposed and are actively researched.&#xA;Being the field of quantum computation still not yet fully mature, no computational model is indisputably superior to the others.&#xA;Arguably the most known one is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit model&lt;/a&gt;.&#xA;Among the others, there are measurement-based quantum computation, quantum annealing, and continuous variable quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In gate-based quantum computation, gates are represented by matrices, and include types such as the Pauli X (also termed &quot;NOT&quot;), Y, and Z (pronounced &quot;zed&quot;) gates, which are single-qubit gates, multiple-qubit gates like the controlled-NOT or CNOT gate and Toffoli gate, and others. The set of single-qubit gates plus the CNOT gate forms a set of universal gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum computer's entire state can be represented by a single vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\psi\rangle = \alpha|0...0\rangle + \beta|0...1\rangle + .... \zeta|1...1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\alpha$ through $\zeta$ (and there can be more beyond this) represent the amplitudes of the state, and determine the probability of a particular state resulting upon collapse of the wavefunction upon measurement. Each of the items between the $|\,\rangle$ represents a particular possible state that can occur upon measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When measurement occurs, the qubits become normal, classical bits, which is part of what makes writing algorithms for quantum computers so difficult. The advantage in a quantum computer lies in the fact that the whole system can be, and in fact must be, represented by a single vector. This means that all the qubits share information, and further, any one gate, even if a single-qubit gate, has repercussions on the whole system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many different physical realizations of the quantum computer. There are optical quantum computers, which use photons as qubits, and things like Fabry-Perot cavities, mirrors, beamsplitters, phase shifters, and so forth for gates. There are superconducting quantum computers, which use Josephson Junctions. There are ion-trap quantum computers, which use ions for qubits and hold those still with strong magnetic fields, and then manipulate the state of the ions with lasers. A list of realizations can be found &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#External_links&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; under &quot;Quantum Computer Science&quot; and &quot;Physical Implementations&quot;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Resources/Notes&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Nielsen and Chuang's &lt;em&gt;Quantum Computing and Quantum Information&lt;/em&gt; is the standard textbook for the field.&lt;/li&gt;&#xA;&lt;li&gt;Michael Nielsen has a series of videos on YouTube called &lt;a href=&quot;https://www.youtube.com/playlist?list=PL1826E60FD05B44E4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing for the Determined&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It is recommended that you have a base understanding of linear algebra in particular if you wish to learn this subject. Some understanding of quantum mechanics and computer science will be highly useful and something you will at minimum have to learn upon the way.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="91" LastEditorUserId="55" LastEditDate="2018-03-29T19:15:22.427" LastActivityDate="2018-03-29T19:15:22.427" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="32" PostTypeId="4" CreationDate="2018-03-12T18:58:42.597" Score="0" Body="For questions about physical implementations of a quantum algorithm or other quantum information protocol. DO NOT use for questions about simulation or emulation of quantum computers, or cloud-based quantum computing services like the IBM Q Experience. " OwnerDisplayName="user7" LastEditorUserId="55" LastEditDate="2021-05-19T08:21:57.350" LastActivityDate="2021-05-19T08:21:57.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="33" PostTypeId="5" CreationDate="2018-03-12T19:00:02.607" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-12T19:00:02.607" LastActivityDate="2018-03-12T19:00:02.607" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="34" PostTypeId="4" CreationDate="2018-03-12T19:00:02.607" Score="0" Body="For questions about simulating either quantum computers or simulating things on quantum computers. " OwnerDisplayName="user7" LastEditorUserId="3" LastEditDate="2018-03-13T19:29:48.787" LastActivityDate="2018-03-13T19:29:48.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="35" PostTypeId="5" CreationDate="2018-03-12T19:01:10.427" Score="0" Body="&lt;p&gt;Quantum cryptography is the science of exploiting quantum mechanical properties to perform cryptographic tasks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_cryptography&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-14T19:08:41.890" LastActivityDate="2018-03-14T19:08:41.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="36" PostTypeId="4" CreationDate="2018-03-12T19:01:10.427" Score="0" Body="For questions about cryptography as it relates directly to quantum computing. Not for general cryptographic methods. " OwnerDisplayName="user7" LastEditorUserId="26" LastEditDate="2018-03-14T19:08:49.750" LastActivityDate="2018-03-14T19:08:49.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="37" PostTypeId="5" CreationDate="2018-03-12T19:02:34.337" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-12T19:02:34.337" LastActivityDate="2018-03-12T19:02:34.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="38" PostTypeId="4" CreationDate="2018-03-12T19:02:34.337" Score="0" Body="Emulation is the practice of exactly replicating the function of something.  Use this tag for when you are emulating a quantum computer or things on one. Use [simulation] if an exact replica isn't essential." OwnerDisplayName="user7" LastEditorDisplayName="user7" LastEditDate="2018-03-12T19:52:42.760" LastActivityDate="2018-03-12T19:52:42.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="39" PostTypeId="1" AcceptedAnswerId="51" CreationDate="2018-03-12T19:10:23.483" Score="23" ViewCount="1133" Body="&lt;p&gt;At a very basic level, reading or measuring a qubit forces it to be in one state or the other, so the operation of a quantum computer to gain a result collapses the state into one of many possibilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as the state of each qubit is probabilistic, surely this means the result can actually be any of those possibilities, with varying likelihood. If I re-run the programme - should I expect to see different results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I be sure I have the &quot;best&quot; result? What provides that confidence? I assume it cannot be the interim measurements as described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4/67&quot;&gt;this question&lt;/a&gt; as they do not collapse the output.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="26" LastEditDate="2019-05-16T06:36:53.897" LastActivityDate="2019-05-16T11:45:07.213" Title="What level of &quot;confidence&quot; of the result from a quantum computer is possible?" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="41" PostTypeId="1" AcceptedAnswerId="62" CreationDate="2018-03-12T19:53:58.863" Score="18" ViewCount="767" Body="&lt;p&gt;Is a dilution refrigerator the only way to cool superconducting qubits down to 10 millikelvin? If not, what other methods are there, and why is dilution refrigeration the primary method?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-05-14T14:05:46.733" LastActivityDate="2019-05-14T14:05:46.733" Title="What cryogenic systems are suitable for superconducting qubits?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;&lt;dilution-refrigerator&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="42" PostTypeId="5" CreationDate="2018-03-12T19:55:01.877" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-12T19:55:01.877" LastActivityDate="2018-03-12T19:55:01.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="43" PostTypeId="4" CreationDate="2018-03-12T19:55:01.877" Score="0" Body="For questions about the physical implementation of a quantum computer. Use with tags for whatever realization you are thinking of." OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-03-13T13:16:26.390" LastActivityDate="2018-03-13T13:16:26.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="44" PostTypeId="5" CreationDate="2018-03-12T19:56:32.707" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-12T19:56:32.707" LastActivityDate="2018-03-12T19:56:32.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="45" PostTypeId="4" CreationDate="2018-03-12T19:56:32.707" Score="0" Body="For questions involving the device used to cool things (especially qubits) down to very low temperatures (millikelvin)." OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-03-13T13:16:46.457" LastActivityDate="2018-03-13T13:16:46.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="46" PostTypeId="5" CreationDate="2018-03-12T19:58:17.810" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-12T19:58:17.810" LastActivityDate="2018-03-12T19:58:17.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="47" PostTypeId="4" CreationDate="2018-03-12T19:58:17.810" Score="0" Body="For questions involving the realization of quantum computing which uses superconducting qubits.. This tag can be used either for the theory behind the realization or the physical implementation of the realization (in which case, consider using the [tag:construction] tag)." OwnerUserId="91" LastEditorUserId="3" LastEditDate="2018-03-13T13:21:48.290" LastActivityDate="2018-03-13T13:21:48.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="48" PostTypeId="2" ParentId="6" CreationDate="2018-03-12T20:07:31.787" Score="5" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;tl;dr&lt;/em&gt;-&lt;/strong&gt;  Quantum computers can't really help us to simulate the whole universe as the universe is likely vastly more complex than even quantum mechanics can capture, plus we can't even begin to guess how big it is or many other basic fundamental features.  In short, simulating the whole universe is beyond sci-fi.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;We can't really simulate the entire universe, in large part because we have no idea what the universe is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, at current, we have a vague picture of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Observable_universe&quot; rel=&quot;noreferrer&quot;&gt;observable universe&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/File:Observable_Universe_with_Measurements_01.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/9/98/Observable_Universe_with_Measurements_01.png&quot; alt=&quot;Observable universe&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And we've got the &lt;a href=&quot;https://en.wikipedia.org/wiki/The_standard_model&quot; rel=&quot;noreferrer&quot;&gt;Standard Model&lt;/a&gt; that describes our current best guess at describing much of what we can see.  But, beyond that, we don't know much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examples of stuff we don't know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the observable universe a significant part of the larger universe?  Or is it unimaginably small compared to the whole?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a lot of &lt;a href=&quot;https://en.wikipedia.org/wiki/Weakly_interacting_massive_particles&quot; rel=&quot;noreferrer&quot;&gt;weakly-interacting&lt;/a&gt; stuff out there, e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Dark_matter&quot; rel=&quot;noreferrer&quot;&gt;dark matter&lt;/a&gt;, that might compose what'd kinda be like a parallel world?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose dark matter is real (which many physicists currently believe).  Then, what if something weakly interacts with dark matter, but only with normal matter indirectly through affecting dark matter?  And what if that's a recursive relationship - do we even know a non-trivial portion of what exists within the domain of the observable universe?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What exists &lt;a href=&quot;https://en.wikipedia.org/wiki/There%27s_Plenty_of_Room_at_the_Bottom&quot; rel=&quot;noreferrer&quot;&gt;at the bottom&lt;/a&gt;?  We really don't know much beneath the &lt;a href=&quot;https://en.wikipedia.org/wiki/Planck_length&quot; rel=&quot;noreferrer&quot;&gt;Planck scale&lt;/a&gt;; it could be the case that what seem to be fundamental particles to us are actually unimaginably large universes themselves!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Extra-dimensions, what's-in-black-holes, string theory, etc., etc..&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Basically, we know essentially nothing about the larger universe other than that we're part of it.  Given this unimaginable ignorance, merely having quantum computers won't really help us simulate the whole thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, what quantum computers &lt;em&gt;can&lt;/em&gt; do is help us simulate quantum systems of comparable size as well as a bunch of other interesting problems.  Presumably we'll gain a better understanding of the possibilities as time goes on.&lt;/p&gt;&#xA;" OwnerUserId="15" LastActivityDate="2018-03-12T20:07:31.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="49" PostTypeId="1" AcceptedAnswerId="52" CreationDate="2018-03-12T20:19:27.003" Score="7" ViewCount="418" Body="&lt;p&gt;I don't have any specific task or algorithm in mind, so depending on how they were tested – Is there any research which shows just how the &lt;a href=&quot;https://en.wikipedia.org/wiki/D-Wave_Two&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave Two&lt;/a&gt; computer was faster (in terms of computation performance) than its predecessor (D-Wave One)? &lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="26" LastEditDate="2018-03-26T16:01:45.120" LastActivityDate="2018-03-26T16:01:45.120" Title="How much faster is “D-Wave Two” compared to its predecessor?" Tags="&lt;physical-realization&gt;&lt;performance&gt;&lt;annealing&gt;&lt;d-wave&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="50" PostTypeId="1" AcceptedAnswerId="66" CreationDate="2018-03-12T20:25:01.510" Score="2" ViewCount="1162" Body="&lt;p&gt;This &lt;a href=&quot;https://www.cs.auckland.ac.nz/research/groups/CDMTCS/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CDMTCS&lt;/a&gt; Report 514, 2017 entitled &quot;&lt;a href=&quot;https://arxiv.org/abs/1712.01356&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Road to Quantum Computational Supremacy&lt;/a&gt;&quot; states (in Section 6) that the amount of memory needed to simulate random quantum circuits on classical computers increases rapidly with the number of qubits of the circuit. A circuit on 48 qubits would require a huge amount of memory to be stored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How much is it exactly? And how can you calculate it?&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="1847" LastEditDate="2018-04-16T10:05:20.317" LastActivityDate="2020-04-21T21:14:53.303" Title="How much memory is required to simulate a 48-qubit circuit?" Tags="&lt;simulation&gt;&lt;classical-computing&gt;&lt;memory-space&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="51" PostTypeId="2" ParentId="39" CreationDate="2018-03-12T20:26:20.733" Score="14" Body="&lt;p&gt;The majority of useful/relatively efficient algorithms&lt;sup&gt;1&lt;/sup&gt; for quantum computers belong to the &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;'bounded-error quantum polynomial time' (BQP)&lt;/a&gt; complexity class. By this definition, you want the 'failure rate' of any quantum algorithm to be $\leq\frac{1}{3}$, or $\mathbb{P}\left(\text{success}\right) \geq \frac{2}{3}$, although the result may still be within some small error. A non-probabilistic algorithm (that can run in polynomial time) will still be in this complexity class, with the only difference being that it &lt;em&gt;always&lt;/em&gt; returns the correct result&lt;sup&gt;2&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as you can run an algorithm an arbitrary number of times, this is equivalent to having a success probability of at least $\frac{1}{2} + n^{-c}$ for an input of length $n$ and any positive constant $c$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the 'correct' result is the one that appears at least two thirds of the time, unless you want a 'one-shot' computation such as if you want to generate random numbers, or if you want to do something such as benchmark the quantum chip, where the statistics matter and are part of the 'result'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from these (or other algorithms that don't have a single 'correct result'), if you find an algorithm with a success rate below a half, it is no longer 'bounded error' and it may not be possible for the user to know the correct result - there may simply be a wrong answer with a higher probability of occurring than the correct one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you may see a different result each time you run a calculation. The confidence in the result is provided by: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The quantum algorithm itself ensuring that the correct result happens with high probability and; &lt;/li&gt;&#xA;&lt;li&gt;Repeating the algorithm a number of times in order to find the most probable result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Here, algorithms that can be computed in polynomial time to give a solution with 'high probability', although for the purposes of this answer, the time complexity is of lesser importance&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 Well, idealistically, at least&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-13T00:19:51.817" LastActivityDate="2018-03-13T00:19:51.817" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="52" PostTypeId="2" ParentId="49" CreationDate="2018-03-12T20:30:29.887" Score="11" Body="&lt;p&gt;As Troyer and Lidar saw no speed increase with the D-Wave 1 compared to classical computers, the D-Wave 2 &lt;a href=&quot;https://en.wikipedia.org/wiki/D-Wave_Systems#cite_note-44&quot; rel=&quot;noreferrer&quot;&gt;benchmark figure reported in 2013&lt;/a&gt; of 3600 times as fast as CPLEX (the best algorithm on a conventional machine) suggests the D-Wave 2 is 3600 times as fast as the D-Wave 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the results are in a pretty restricted set of parameters, so this may not be relevant for other parameters. (as an example, the benchmark figures for the D-Wave 2000Q only take constant factor performance gains into account)&lt;/li&gt;&#xA;&lt;li&gt;the configuration of the CPLEX may not compare directly to the classical computers used to benchmark the D-Wave 1 &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="67" LastActivityDate="2018-03-12T20:30:29.887" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="53" PostTypeId="1" AcceptedAnswerId="111" CreationDate="2018-03-12T20:32:49.977" Score="15" ViewCount="316" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Recently I came upon a research article entitled &lt;a href=&quot;https://arxiv.org/pdf/1110.1381.pdf&quot; rel=&quot;noreferrer&quot;&gt;Experimental Demonstration of Blind Quantum Computing&lt;/a&gt;. Within this research article, the scientists claimed that - through the proper choice of a generic structure - a data engineer can hide the information about how the data was calculated.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If a scientist were to use a BQC &lt;em&gt;(Blind Quantum Computation)&lt;/em&gt; protocol to calculate private measurements, what types of variables would they have to use to formulate a generic structure for the blind quantum state?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Thoughts&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I would like to understand what types of variables could go into the generic structure in order to help keep the data calculations hidden from the server. If you select certain known generic variables, I do not understand why the selection of other known generic variables would prevent the data calculations from being hidden.&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="26" LastEditDate="2019-05-14T14:02:26.740" LastActivityDate="2019-05-14T14:02:26.740" Title="Blind quantum computing — generic structure variable selection" Tags="&lt;cryptography&gt;&lt;blind-quantum-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="55" PostTypeId="5" CreationDate="2018-03-12T20:53:04.173" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-12T20:53:04.173" LastActivityDate="2018-03-12T20:53:04.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="56" PostTypeId="4" CreationDate="2018-03-12T20:53:04.173" Score="0" Body="BQC or Blind Quantum Computing is a term used when referring to a computation technique that prevents the servers from knowing how the task is being performed." OwnerUserId="82" LastEditorUserId="82" LastEditDate="2018-03-13T13:16:55.600" LastActivityDate="2018-03-13T13:16:55.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="57" PostTypeId="2" ParentId="4" CreationDate="2018-03-12T21:31:00.257" Score="3" Body="&lt;p&gt;As you said, the probabilities of measurements are obtained from the state. And the gates operate unitarily on the states. Consider the POVM element $\Pi$, a state $\rho$ and a gate $U$. Then the probability for the outcome associated with $\Pi$ is $p=\mathrm{tr} (\Pi \rho)$, and the probability after the gate is $p'=\mathrm{tr}(\Pi U \rho U^\dagger)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want to stress that it is impossible to know the probability of the outcome after the gate only from the probability of it before the gate. You need to consider the probability amplitudes (the quantum states)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me make another remark: You are talking about two qubits, so the state after the gate might be entangled. In this case it will not be possible to have &quot;individual&quot; probability distributions for each qubit for all measurements in the sense that the joint probability distribution will not factor into the two marginal distributions.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2018-03-12T21:31:00.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="59" PostTypeId="2" ParentId="12" CreationDate="2018-03-12T23:21:05.300" Score="24" Body="&lt;p&gt;Yes, it is possible to simulate quantum computations on a classical computer. But the cost of simulations grows exponentially with qubit count and/or circuit depth and/or particular operation counts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For trying ideas quickly, my simulator &lt;a href=&quot;http://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;Quirk&lt;/a&gt; is great. It's an &lt;a href=&quot;https://github.com/Strilanc/Quirk&quot; rel=&quot;noreferrer&quot;&gt;open-source&lt;/a&gt; drag-and-drop quantum circuit simulator that runs in your web browser. You can access a live version at &lt;a href=&quot;http://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;algassert.com/quirk&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a screenshot of Quirk's example Grover circuit, which is instrumented with intermediate state displays to track the &quot;hidden&quot; state becoming more likely:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DkSMI.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DkSMI.png&quot; alt=&quot;Screenshot of Quirk&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-03-14T03:48:19.327" LastActivityDate="2018-03-14T03:48:19.327" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="60" PostTypeId="2" ParentId="39" CreationDate="2018-03-13T00:35:00.087" Score="9" Body="&lt;p&gt;Elaborating somewhat on &lt;code&gt;Mithrandir24601&lt;/code&gt;'s response &amp;mdash;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The feature you're worried about, that a quantum computer might produce a different answer on the next run of the computation, is also a feature of randomised computation. It is good in some ways to be able to obtain a single answer repeatably, but in the end it is enough to be able to obtain a correct answer with high enough confidence. Just as with a randomised algorithm, what is important is that you can be sure of the chances of getting the correct answer in any given run of the computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, your quantum computer might give you the correct answer to a YES&amp;nbsp;/&amp;nbsp;NO question two times out of every three. This might seem like a poor performance, but what this means is that if you run it many times, you can simply take the majority answer and be &lt;em&gt;very&lt;/em&gt; confident that the majority rule gives you the correct answer. (The same is true for normal randomised computation as well.) The way that the confidence increases with the number of rune, means that so long as any one run gives an answer which has significantly more than &lt;em&gt;just a 50% chance&lt;/em&gt; of being correct, you can make your confidence as high as you like just by doing a modest number of repeated runs (though more runs are required, the closer the chances of a correct answer in any one run are to 50%).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theoretical terms, we give the name &lt;strong&gt;BQP&lt;/strong&gt; to the collection of problems which are solvable in $\mathrm{poly}(n)$ computational steps by a quantum computer, for input sizes which can be specified by an $n$-bit string, where the answer is correct with probability at least 2/3; by the argument above, the exact same set of problems is given if you demand that the answer be correct with probability 999/1000, or (1&amp;nbsp;&amp;minus;&amp;nbsp;1e-8).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For problems which have more elaborate answers than YES&amp;nbsp;/&amp;nbsp;NO questions, we can't necessarily assume that the same answer will be produced more than once so that we can take a majority vote. (If you are using a quantum computer to sample from an exponential number of outcomes, it is possible that there are some smaller but still exponentially many quantity of answers which are correct and useful!) Suppose that you are trying to solve an optimisation problem: it might not be easy to verify that you have found the optimal solution, or a nearly-optimal solution &amp;mdash; or that the answer that you've gotten is even the best that the quantum computer can do (what if the next run gives you a better answer by chance?). In this case, what is important is to determine what you know about the problem, whether there is an independent way to verify a solution (is your problem in &lt;strong&gt;NP&lt;/strong&gt;, meaning that you can in principle efficiently check any answer you're given?), and what quality of solution you would be happy with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, this is all true for randomised algorithms as well &amp;mdash; the difference being that we expect quantum computers to be able to solve problems that a randomised computer alone could not easily solve.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-03-13T10:00:49.930" LastActivityDate="2018-03-13T10:00:49.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="61" PostTypeId="1" AcceptedAnswerId="67" CreationDate="2018-03-13T00:50:59.097" Score="11" ViewCount="701" Body="&lt;p&gt;I'm researching SPDC's efficacy for use in an optical quantum computing model and I've been trying to figure out exactly what state the photons are in when they come out (as represented by a vector, for example), if I'm using type 1 SPDC and I'm looking at the polarization of the photons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please provide any references used =)&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="104" LastEditDate="2018-03-16T15:49:47.903" LastActivityDate="2018-03-16T15:49:47.903" Title="State produced by spontaneous parametric down-conversion (SPDC)" Tags="&lt;physical-qubit&gt;&lt;optical-quantum-computing&gt;&lt;spdc&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="62" PostTypeId="2" ParentId="41" CreationDate="2018-03-13T04:09:42.057" Score="19" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is a dilution refrigerator the only way to cool superconducting qubits down to 10 millikelvin?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's another type of refrigerator that can get to 10 mK: the &lt;a href=&quot;https://www.cryogenicsociety.org/resources/defining_cryogenics/adiabatic_demagnetization_refrigeration/&quot; rel=&quot;noreferrer&quot;&gt;adiabatic demagnetization refrigerator&lt;/a&gt; (ADR).$^{[a]}$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;why is dilution refrigeration the primary method?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To understand that, let's talk about one of the main limitations of the ADR.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How an ADR works&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;An ADR usually gets to about 3K with a helium compressor.&#xA;That compressor can run all the time, so the refrigerator can sit at 3K indefinitely.&#xA;To get down to mK temperatures, the ADR works like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Raise the magnetic field surrounding a solid with nuclear spins. This aligns the spins.&lt;/li&gt;&#xA;&lt;li&gt;Slowly turn the field off. This allows the spins to randomize their direction, which absorbs entropy from the surroundings and lowers the temperature.&lt;/li&gt;&#xA;&lt;li&gt;Once the field is back to zero, we've sucked enough heat out of the surroundings to bring them to mK temperatures.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;ADR limitations&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is all great and it really works, but it's a &quot;one-shot&quot; process.&#xA;Once the field is down to zero, you can't go any lower.&#xA;Heat from the surroundings, such as the room temperature outer parts of the refrigerator, leak heat into the part you're trying to keep cold, and since we've already lowered the magnetic field to zero, we can't do anything to remove that heat.&#xA;Therefore, after cooling the ADR, it starts to warm up (hopefully slowly enough to run your experiment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's typical for an ADR to stay below 100mK for maybe twelve hours, although that number depends a lot on how many wires you have running to the cold part of the ADR.&#xA;After the temperature rises above what you want, you have to raise the magnetic field again and slowly lower it to re-cool.&#xA;Raising and lowering the field takes a while and heats up the refrigerator, and that big magnetic field is often incompatible with superconducting qubit experiments, so you can't run experiments while you're in that stage of the process.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;ADR vs. dilution refrigerator&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The dilution refrigerator, on the other hand, runs continuously, so you have as long as you need to run your experiment.&#xA;That's a pretty big reason that they're in common use.&#xA;Note, however, that other refrigerators aside from the ADR &lt;em&gt;are&lt;/em&gt; used in many superconducting qubit labs for tasks where the benefits of a dilution refrigerator aren't needed and the shorter cold time of an ADR is ok.&#xA;For example, ADR's are common for experiments with superconducting resonators, which are used to test the quality of materials that may later be used for a qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$[a]$: Apologies for not finding a better link. Edits on that are welcome.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2018-03-13T04:09:42.057" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="63" PostTypeId="1" CreationDate="2018-03-13T06:40:05.623" Score="7" ViewCount="273" Body="&lt;p&gt;In this &lt;a href=&quot;https://arxiv.org/abs/1409.3093&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; and this &lt;a href=&quot;https://arxiv.org/abs/1211.0417&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, the &quot;Noise Stability of Qubits&quot; (the stability of qubits to external noise) has been discussed. In the first one, Gil Kalai states that it is difficult to create a quantum computer since the noise produced in creating a few qubits is enough to reach the threshold for corrupting the entire system of qubits. What can be done to reduce the noise and increase stability of the qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: To clarify the doubts mentioned in  the comments, I want to add that IBM, Rigetti and some other companies have already started manufacturing Quantum Computers with 4-6 qubits. How have they overcome or what are they working on to face this problem of noise sensitivity?&lt;/p&gt;&#xA;" OwnerUserId="137" LastEditorUserId="26" LastEditDate="2018-12-13T19:36:28.907" LastActivityDate="2018-12-13T19:36:28.907" Title="How to make qubits more stable towards noise?" Tags="&lt;physical-qubit&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2018-03-14T13:27:12.590" ContentLicense="CC BY-SA 3.0" />
  <row Id="64" PostTypeId="1" AcceptedAnswerId="4848" CreationDate="2018-03-13T07:06:51.700" Score="16" ViewCount="1327" Body="&lt;p&gt;According to &lt;a href=&quot;https://www.alibabacloud.com/press-room/alibaba-cloud-and-cas-launch-one-of-the-worlds-most&quot; rel=&quot;noreferrer&quot;&gt;this press announcement&lt;/a&gt; from March 1st 2018, the Alibaba Cloud offers access to an 11 qubit quantum computer via their cloud services. Quote:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Alibaba Cloud, [...] and Chinese Academy of Sciences (CAS) [...] have launched the superconducting quantum computing cloud, featuring a quantum processor with 11 quantum bits (qubits) of power. [...]&lt;/p&gt;&#xA;&lt;p&gt;Users can now access the superconducting quantum computing cloud through Alibaba Cloud’s quantum computing cloud platform to efficiently run and test custom built quantum codes and download the results.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;However, I have been unable to find any mention of this service anywhere else on their site than in the press announcement. No documentation. No mention in the &amp;quot;Products&amp;quot; overview. Nothing. Does anyone know, how to get started here?&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-12-03T11:26:55.217" Title="How to get started with the Alibaba Cloud Quantum Computing Service?" Tags="&lt;alibaba-cloud&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="65" PostTypeId="1" AcceptedAnswerId="68" CreationDate="2018-03-13T07:12:53.293" Score="24" ViewCount="958" Body="&lt;p&gt;The term &quot;quantum supremacy&quot; - to my understanding - means that one can create and run algorithms to solve problems on quantum computers that can't be solved in realistic times on binary computers. However, that is a rather vague definition - what would count as &quot;realistic time&quot; in this context? Does it have to be the same algorithm or just the same problem? Not being able to simulate quantum computers of certain sizes surely can't be the best measure.&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="26" LastEditDate="2018-03-27T09:57:30.017" LastActivityDate="2018-03-27T09:57:30.017" Title="When will we know that quantum supremacy has been reached?" Tags="&lt;speedup&gt;&lt;quantum-advantage&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="66" PostTypeId="2" ParentId="50" CreationDate="2018-03-13T07:28:54.323" Score="3" Body="&lt;p&gt;This doesn't exactly answer your question, but it may aid you in understanding the problem and possibly the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In their paper &lt;em&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1710.05867&quot; rel=&quot;nofollow noreferrer&quot;&gt;Breaking the 49-Qubit Barrier in the Simulation of Quantum Circuits&lt;/a&gt;&quot;&lt;/em&gt; (arXiv:1710.05867), the authors describe simulating a 49-qubit and a 56-qubit quantum computer. According to the paper, they required 4.5 Terrabytes of RAM for the 49-qubit simulation; this did however depend on the exact algorithm they ran. That said, also according to this paper with competing simulation methods they would have been at about 8 Petabytes of RAM for that simulation.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2018-03-13T07:28:54.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="67" PostTypeId="2" ParentId="61" CreationDate="2018-03-13T09:24:34.043" Score="10" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First of all, I'll use $\lvert H\rangle$ as a horizontally polarised state and $\lvert V\rangle$ as a vertically polarised state&lt;sup&gt;1&lt;/sup&gt;. There are three modes of light involved in the system: pump (p), taken to be a coherent light source (a laser); as well as signal and idler (s/i), the two generated photons&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hamiltonian for SPDC is given by $H = \hbar g\left(a^{\dagger}_sa^{\dagger}_ia_p + a^{\dagger}_pa_ia_s\right)$, where g is a coupling constant dependent on the $\chi^{\left(2\right)}$ nonlinearity of the crystal and $a\left(a^{\dagger}\right)$ is the annihilation (creation) operator. That is, there is a possibility of a pump photon getting annihilated and generating two photons&lt;sup&gt;2&lt;/sup&gt; as well as a possibility of the reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase matching conditions for frequencies, $\omega_p = \omega_s + \omega_i$ and wave vectors, $\mathbf{k}_p = \mathbf{k}_s + \mathbf{k}_i$ must also be satisfied.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Type 1 SPDC&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is where the two generated (s and i) photons have parallel polarisations, perpendicular to the polarisation of the pump, which can only be used to perform SPDC when the pump is polarised along the extraordinary axis of the crystal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that defining the extraordinary axis as the vertical (horizontal) direction and inputting coherent light along that axis will generate pairs of photons in the state $\lvert HH\rangle\, \left(\lvert VV\rangle\right)$. This is not of much use, so to generate an entangled pair of photons, two crystals are placed next to each other, with extraordinary axes in orthogonal directions. The coherent source is then input with a polarisation of $45^\circ$ to this, such that if the first crystal has an extraordinary axis along the vertical (horizontal) direction, there is a probability of generating photons in the state $\lvert HH\rangle\, \left(\lvert VV\rangle\right)$ as before from the first crystal, as well as a probability of generating photons in the state $\lvert VV\rangle\, \left(\lvert HH\rangle\right)$ from the second crystal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as the light from the pump is travelling through a material, it will also acquire a phase in the first crystal, such that the final state is $$\lvert\psi\rangle = \frac{1}{\sqrt{2}}\left(\lvert HH\rangle + e^{i\phi}\lvert VV\rangle\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the phase matching conditions, the emitted photon pairs will be emitted at opposite points on a cone, as shown below in Figure 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4i63J.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4i63J.jpg&quot; alt=&quot;Type 1 SPDC&quot;&gt;&lt;/a&gt;Figure 1: A laser beam is input into two type 1 SPDC crystals, with orthogonal extraordinary axes. This results in a probability of emitting a pair of entangled photons at opposite points on a cone. Image taken from Wikipedia.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 This can be mapped to qubit states using e.g. $\lvert H\rangle = \lvert 0\rangle$ and $\lvert V\rangle = \lvert 1\rangle$&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 called signal and idler for historical reasons&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://iopscience.iop.org/article/10.1143/JJAP.46.7175/meta&quot; rel=&quot;noreferrer&quot;&gt;Keiichi Edamatsu 2007 Jpn. J. Appl. Phys. 46 7175&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.60.R773&quot; rel=&quot;noreferrer&quot;&gt;Kwiat, P.G., Waks, E., White, A.G., Appelbaum, I. and Eberhard, P.H., 1999.  Physical Review A, 60(2)&lt;/a&gt; - and the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9810003v3&quot; rel=&quot;noreferrer&quot;&gt;arXiv version&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-03-13T09:24:34.043" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="68" PostTypeId="2" ParentId="65" CreationDate="2018-03-13T09:27:09.100" Score="17" Body="&lt;p&gt;The term &lt;code&gt;quantum supremacy&lt;/code&gt; &lt;em&gt;doesn't necessarily&lt;/em&gt; mean that one can run &lt;code&gt;algorithms&lt;/code&gt;, as such, on a quantum computer that are impractical to run on a classical computer. It just means that a quantum computer can do &lt;em&gt;something&lt;/em&gt; that a classical computer will find difficult to simulate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might ask (and rightly so) what I might possibly mean by talking about something done by a quantum computer which is not an &lt;code&gt;algorithm&lt;/code&gt;. What I mean by this is that we can have a quantum computer perform a process which&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;does not necessarily have very well-understood behaviour &amp;mdash; in particular, there are very few things we can prove about that process;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;in particular, that process does not 'solve' any problem of practical interest &amp;mdash; the answer to the computation doesn't necessarily answer a question that you are interested in.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;When I say that the process doesn't necessarily have well-understood behaviour, this does not mean that we don't know what the computer is doing: we will have a good description of the operations that it does. But we won't necessarily have an acute understanding of the &lt;em&gt;cumulative effect on the state of the system&lt;/em&gt; of those operations. (The very promise of quantum computation was originally proposed because &lt;em&gt;quantum mechanical systems are difficult to simulate&lt;/em&gt;, which meant that it might be able to simulate other systems which are difficult to simulate.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You might ask what the point is of having a quantum computer do something which is difficult to simulate if the only reason is &lt;em&gt;only&lt;/em&gt; that it is difficult to simulate. The reason of this is: it demonstrates a proof of principle. Suppose that you can build quantum systems with 35 qubits, with 40 qubits, with 45 qubits, 50 qubits, and so forth &amp;mdash; each built according to the same engineering principles, each of them simulatable in practise, and each &lt;strong&gt;behaving the way that the simulation predicts&lt;/strong&gt; (up to good tolerances), but where each simulation is much more resource-intensive than the last. Then once you have a system on 55 or 60 qubits that you can't simulate with the world's largest supercomputer, you could argue that you have an architecture that builds reliable quantum computers (based on the sizes you can simulate), and which can be used to build quantum computers large enough that no known simulation technique can predict their behaviour (and where perhaps no such technique is even possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This stage in itself is not necessarily &lt;em&gt;useful&lt;/em&gt; for anything, but it is a necessary condition to being able to solve interesting problems on a quantum computer more quickly than you can on a classical computer. The fact that you can't necessarily solve 'interesting' problems at this stage is one reason why people are sometimes dissatisfied with the term 'supremacy'. (There are other reasons to do with political connotations, which are justified in my opinion but off-topic here.) Call it &quot;quantum ascendancy&quot;, if you prefer &amp;mdash; meaning that it marks a point at which quantum technologies are definitely becoming significant in power, while not yet in any danger of replacing the mobile phone in your pocket,  desktop computers, or even necessarily industrial supercomputers &amp;mdash; but it is a point of interest in the developmental curve of any quantum computational technology.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;But the bottom line is that, yes, &quot;quantum supremacy&quot; is &lt;strong&gt;precisely&lt;/strong&gt; about &quot;not being able to simulate quantum computers of certain sizes&quot;, or at least not being able to simulate certain specific processes that you can have them perform, and this benchmark depends not only on quantum technology but on the best available classical technology and the best available classical techniques. It is a blurry boundary which, if we are being serious about things, we will only be confident that we have passed a year or two after the fact. But it is an important boundary to cross.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="58" LastEditDate="2018-03-14T15:51:08.523" LastActivityDate="2018-03-14T15:51:08.523" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="69" PostTypeId="1" AcceptedAnswerId="94" CreationDate="2018-03-13T10:05:43.737" Score="16" ViewCount="554" Body="&lt;p&gt;The strengthened version of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis&quot; rel=&quot;noreferrer&quot;&gt;Church-Turing thesis&lt;/a&gt; states that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Any algorithmic process can be simulated efficiently using a Turing machine.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, on page 5 (chapter 1), the book &lt;em&gt;Quantum Computation and Quantum Information: 10th Anniversary Edition By Michael A. Nielsen, Isaac L. Chuang&lt;/em&gt; goes on to say that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One class of challenge to the the strong Church Turing thesis comes&#xA;  from the field of &lt;em&gt;analog computation&lt;/em&gt;. In the years since Turing,&#xA;  many different teams of researchers have noticed that certain types of&#xA;  analog computers can efficiently solve problems believed to have no&#xA;  efficient solution on a Turing machine. At the first glance these&#xA;  analog computers appear to violate the strong form of the&#xA;  Church-Turing thesis. Unfortunately for analog computation it turns&#xA;  out that when realistic assumptions about the presence of &lt;strong&gt;noise&lt;/strong&gt; in&#xA;  analog computers are made, their power disappears in all known&#xA;  instances; they cannot efficiently solve problems which are not&#xA;  solvable on a Turing machine. This lesson – that the effects of&#xA;  realistic &lt;strong&gt;noise&lt;/strong&gt; must be taken into account in evaluating the&#xA;  efficiency of a computational model – was one of the great early&#xA;  challenges of quantum computation and quantum information, a challenge&#xA;  successfully met by the development of a theory of quantum&#xA;  error-correcting codes and fault-tolerant quantum computation. Thus,&#xA;  unlike analog computation, quantum computation can in principle&#xA;  tolerate a finite amount of &lt;strong&gt;noise&lt;/strong&gt; and still retain its computational&#xA;  advantages.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What exactly is meant by noise in this context? Do they mean &lt;a href=&quot;https://en.wikipedia.org/wiki/Johnson%E2%80%93Nyquist_noise&quot; rel=&quot;noreferrer&quot;&gt;thermal noise&lt;/a&gt;? It's strange that the  authors did not define or clarify what they mean by &lt;em&gt;noise&lt;/em&gt; in the previous pages of the textbook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if they were referring to &lt;em&gt;noise&lt;/em&gt; in a more generalized setting. Like, even if we get rid of the conventional &lt;em&gt;noise&lt;/em&gt; - like industrial &lt;em&gt;noise&lt;/em&gt;, vibrational &lt;em&gt;noise&lt;/em&gt;, thermal &lt;em&gt;noise&lt;/em&gt; (or reduce them to negligible levels), &lt;em&gt;noise&lt;/em&gt; could still refer to the uncertainties in amplitude, phase, etc, which arise due to the underlying quantum mechanical nature of the system.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-16T15:35:57.370" LastActivityDate="2019-12-25T06:37:03.300" Title="What exactly is meant by &quot;noise&quot; in the following context?" Tags="&lt;noise&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="70" PostTypeId="1" AcceptedAnswerId="71" CreationDate="2018-03-13T10:12:45.070" Score="17" ViewCount="2153" Body="&lt;p&gt;A quantum computer can efficiently solve problems lying in the complexity class &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;BQP&lt;/a&gt;. I have seen a claim the one can (potentially, because we don't know whether BQP is a proper subset or equal to PP) increase the efficiency of a quantum computer by applying &lt;em&gt;postselection&lt;/em&gt; and that the class of efficiently solvable problems becomes now postBQP = &lt;a href=&quot;https://en.wikipedia.org/wiki/PP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;PP&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does &lt;em&gt;postselection&lt;/em&gt; mean here?&lt;/p&gt;&#xA;" OwnerUserId="18" LastActivityDate="2018-04-11T09:48:56.377" Title="What is postselection in quantum computing?" Tags="&lt;complexity-theory&gt;&lt;postselection&gt;&lt;bqp&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="71" PostTypeId="2" ParentId="70" CreationDate="2018-03-13T10:45:13.640" Score="20" Body="&lt;p&gt;&quot;Postselection&quot; refers to the process of conditioning on the outcome of a measurement on some other qubit. (This is something that you can think of for classical probability distributions and statistical analysis as well: it is not a concept special to quantum computation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Postselection has featured quite often (up to this point) in quantum mechanics experiments, because &amp;mdash; for experiments on very small systems, involving not very many particles &amp;mdash; it is a relatively easy way to simulate having good quantum control or feedforward. However, it is not a practical way of realising computation, because you have to condition on an outcome of one or more measurements which may occur with &lt;em&gt;very low&lt;/em&gt; probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually 'selecting' a measurement outcome is nothing you can do easily in quantum mechanics &amp;mdash; what one actually does is throw away any outcome which does not allow you to do what you want to do. If the outcome which you are trying to select has probability $0 &amp;lt; p &amp;lt; 1$, you will have to try an expected number $1/p$ times before you manage to obtain the outcome you are trying to select. If $p = 1/2^n$ for some large integer $n$, you may be waiting a very long time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result that postselection 'increases' (as you say) the power of bounded-error quantum computation from &lt;strong&gt;BQP&lt;/strong&gt; to &lt;strong&gt;PP&lt;/strong&gt; is a well-liked result in the theory of quantum computation, not because it is &lt;em&gt;practical&lt;/em&gt;, but because it is a simple and crisp result of a sort which is rare in computational complexity, and is useful for informing intuitions about quantum computation &amp;mdash; it has led onward to ideas of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/65/124&quot;&gt;&quot;quantum supremacy&quot; experiments&lt;/a&gt;, for example. But it is not something which you should think of as an operation which is freely available to quantum computers as a practical technique, unless you can show that the outcomes which you are trying to postselect are few enough and of high-enough probability (or, as with measurement-based computation, that you can simulate the 'desirable' outcome by a suitable adaptation of your procedure if you obtain one of the 'undesirable' outcomes).&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-03-13T11:38:10.027" LastActivityDate="2018-03-13T11:38:10.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="72" PostTypeId="5" CreationDate="2018-03-13T10:57:08.753" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:03:10.660" LastActivityDate="2019-01-01T10:03:10.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="73" PostTypeId="4" CreationDate="2018-03-13T10:57:08.753" Score="0" Body="For questions related to spontaneous parametric down conversion. SPDC, parametric fluorescence or parametric scattering is a nonlinear instant optical process that converts one photon of higher energy (namely, a pump photon), into a pair of photons (namely, a signal photon, and an idler photon) of lower energy, in accordance with the law of conservation of energy and law of conservation of momentum. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:03:10.660" LastActivityDate="2019-01-01T10:03:10.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="74" PostTypeId="1" CreationDate="2018-03-13T11:07:05.207" Score="49" ViewCount="2830" Body="&lt;p&gt;It seems that quantum computing is often taken to mean the quantum circuit method of computation, where a register of qubits is acted on by a circuit of quantum gates and measured at the output (and possibly at some intermediate steps). Quantum annealing at least seems to be an altogether different method to computing with quantum resources&lt;sup&gt;1&lt;/sup&gt;, as it does not involve quantum gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What different models of quantum computation are there? What makes them different?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I am not asking what different physical implementations qubits have, I mean the description of different ideas of how to compute outputs from inputs&lt;sup&gt;2&lt;/sup&gt; using quantum resources.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&#xA;1. Anything that is inherently non-classical, like entanglement and coherence.&lt;br&gt;&#xA;2. A process which transforms the inputs (such as qubits) to outputs (results of the computation).&#xA;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="26" LastEditDate="2019-05-15T14:56:50.757" LastActivityDate="2019-05-15T14:56:50.757" Title="What are the models of quantum computation?" Tags="&lt;models&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="25" ContentLicense="CC BY-SA 4.0" />
  <row Id="75" PostTypeId="1" CreationDate="2018-03-13T13:24:24.397" Score="20" ViewCount="612" Body="&lt;p&gt;Which quantum error correction code currently holds the record in terms of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;noreferrer&quot;&gt;highest threshold for fault-tolerance&lt;/a&gt;? I know that the &lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;noreferrer&quot;&gt;surface code&lt;/a&gt; is pretty good ($\approx10^{-2}$?), but finding exact numbers is difficult. I also read about some &lt;a href=&quot;https://arxiv.org/abs/1409.4880&quot; rel=&quot;noreferrer&quot;&gt;generalizations of the surface code to 3D clusters&lt;/a&gt; (topological quantum error correction). I guess the main motivation for this research was to increase the threshold for calculations of arbitrary length. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Which quantum error correction code has the highest threshold (as proven at the time of writing this)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to judge this value it would be nice to know what threshold is theoretically achievable. So if you know of (non-trivial) upper bounds on thresholds for arbitrary quantum error correction codes that would be nice.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="26" LastEditDate="2018-05-07T13:21:29.163" LastActivityDate="2018-05-07T13:21:29.163" Title="Which quantum error correction code has the highest threshold (as proven at the time of writing this)?" Tags="&lt;error-correction&gt;&lt;noise&gt;&lt;fault-tolerance&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="76" PostTypeId="5" CreationDate="2018-03-13T13:38:17.170" Score="0" Body="&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubit&lt;/a&gt; (quantum binary digit) is the quantum analogue of the classical bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, it is a two-level system and some example physical systems that can be used as a qubit include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the ground and first excited state of an atom, or other equivalent system&lt;/li&gt;&#xA;&lt;li&gt;polarisation of a photon&lt;/li&gt;&#xA;&lt;li&gt;two spatial or temporal modes of a photon&lt;/li&gt;&#xA;&lt;li&gt;spin of an electron/atom/&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_dot&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum dot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;charge or (direction of) current of a system&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Squeezed_coherent_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;squeezed light&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Mathematically, a qubit lives on a 2-dimensional Hilbert space. The 'computational basis' is denoted by the states $$\left|0\right&amp;gt; = \begin{pmatrix}1 \\\ 0 \end{pmatrix} \quad \text{and}\quad\left|1\right&amp;gt;=\begin{pmatrix}0 \\\ 1\end{pmatrix},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that any single qubit state can be written as $\left|\psi\right&amp;gt; = \alpha\left|0\right&amp;gt;+\beta\left|1\right&amp;gt;$ (known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;superposition&lt;/a&gt;), with the constraint that $\lvert\alpha\rvert^2+\lvert\beta\rvert^2=1$. Taking out a global phase allows these to be written as $\alpha=\cos\frac{\theta}{2}$ and $\beta=e^{i\phi}\sin\frac{\theta}{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entangling&lt;/a&gt; $n$ qubits allows for creation of larger states living in a $2^n$-dimensional Hilbert space. For more information, see also the &lt;a href=&quot;/questions/tagged/quantum-entanglement&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;quantum-entanglement&amp;#39;&quot; rel=&quot;tag&quot;&gt;quantum-entanglement&lt;/a&gt; tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Higher dimensional versions of the qubit, known as the &lt;a href=&quot;/questions/tagged/qutrit&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;qutrit&amp;#39;&quot; rel=&quot;tag&quot;&gt;qutrit&lt;/a&gt; and &lt;a href=&quot;/questions/tagged/qudit&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;qudit&amp;#39;&quot; rel=&quot;tag&quot;&gt;qudit&lt;/a&gt; also exist, although are less widely used.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="23" LastEditDate="2018-06-15T19:16:08.397" LastActivityDate="2018-06-15T19:16:08.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="77" PostTypeId="4" CreationDate="2018-03-13T13:38:17.170" Score="0" Body="For questions related to physical realizations of quantum bits i.e. quantum systems living in a 2-dimensional Hilbert space." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T12:04:32.920" LastActivityDate="2018-12-23T12:04:32.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="80" PostTypeId="2" ParentId="65" CreationDate="2018-03-13T13:45:31.797" Score="7" Body="&lt;p&gt;The term &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_supremacy&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;quantum supremacy&lt;/em&gt;&lt;/a&gt;, as introduced by Preskill in 2012 (&lt;a href=&quot;https://arxiv.org/pdf/1203.5813.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1203.5813&lt;/a&gt;), can be defined by the following sentence:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We therefore hope to hasten the onset of the era of quantum supremacy, when we&#xA;  will be able to perform tasks with controlled quantum systems going beyond what&#xA;  can be achieved with ordinary digital computers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Or, as wikipedia rephrases it, &lt;em&gt;quantum supremacy is the potential ability of quantum computing devices to solve problems that classical computers practically cannot&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that this is &lt;em&gt;not&lt;/em&gt; a precise definition in the mathematical sense. What you can make precise statements on is how the complexity of a given problem scales with the dimension of the input (say, the number of qubits to be simulated, if one is dealing with a simulation problem).&#xA;Then, if it turns out that quantum mechanics allows solving the same problem more efficiently (and, crucially, you are able to prove it), then there is room for a quantum device to demonstrate (or rather, provide evidence towards) &lt;em&gt;quantum supremacy&lt;/em&gt; (or &lt;em&gt;quantum advantage&lt;/em&gt;, or however you prefer to call it, see for example the discussion in the comments &lt;a href=&quot;https://scirate.com/arxiv/1705.06768&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So, in light of the above, &lt;strong&gt;&lt;em&gt;when exactly can one claim to have reached the quantum supremacy regime&lt;/em&gt;&lt;/strong&gt;? At the end of the day, there is no single &lt;em&gt;magic number&lt;/em&gt; that brings you from the &quot;classically simulatable regime&quot; to the &quot;quantum supremacy regime&quot;, and this is more of a continuous transition, in which one gathers more and more evidence towards the statements that quantum mechanics can do better than classical physics (and, in the process, provide evidence against the Extended Church-Turing thesis).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the one hand, there are regimes which obviously fall into the &quot;quantum supremacy regime&quot;. This is when you manage to solve a problem with a quantum device that you just &lt;em&gt;cannot&lt;/em&gt; solve with a classical device. For example, if you manage to factorize a huge number that would take the age of the universe to compute with any classical device (and assuming someone managed to &lt;em&gt;prove&lt;/em&gt; that Factoring is indeed classical hard, which is far from a given), then it seems hard to refute that quantum mechanics does indeed allow to solve some problems more efficiently than classical devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the above is not a good way to think of quantum supremacy, mostly because one of the main points of quantum supremacy is as an intermediate step before being able to solve practical problems with quantum computers. Indeed, in the quest for quantum supremacy, one relaxes the requirement of trying to solve &lt;em&gt;useful&lt;/em&gt; problems and just tries to attack the principle that at least for &lt;em&gt;some&lt;/em&gt; tasks, quantum mechanics does indeed provide advantages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you do this and ask for the &lt;em&gt;simplest possible device that can demonstrate quantum supremacy&lt;/em&gt;, things start to get tricky. You want to find the threshold above which quantum devices are &lt;em&gt;better&lt;/em&gt; than classical ones, but this amounts to &lt;em&gt;compare two radically different kinds of devices, running radically different kinds of algorithms&lt;/em&gt;.&#xA;There is no easy (known?) way to do this.&#xA;For example, do you take into account how expensive it was to build the two different devices? And what about comparing a general purpose classical device with a special purpose quantum one? Is that fair?&#xA;What about &lt;em&gt;validating&lt;/em&gt; the output of the quantum device, is that required? Also, how strict do you require your complexity results to be?&#xA;A proposed reasonable list of criteria for a quantum supremacy experiment, as given by Harrow and Montanaro (&lt;a href=&quot;https://www.nature.com/articles/nature23458&quot; rel=&quot;nofollow noreferrer&quot;&gt;nature23458&lt;/a&gt;, paywalled), is$^1$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A well-defined computational problem.&lt;/li&gt;&#xA;&lt;li&gt;A quantum algorithm solving the problem which can run on a near-term hardware capable of dealing with noise and imperfections.&lt;/li&gt;&#xA;&lt;li&gt;A number of computational resources (time/space) allowed to any classical competitor.&lt;/li&gt;&#xA;&lt;li&gt;A small number of well-justified complexity-theoretic assumptions.&lt;/li&gt;&#xA;&lt;li&gt;a verification method that can efficiently distinguish between the performances of the quantum algorithm from any classical competitor using the allowed resources.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To better understand the issue one may have a look at the discussions around D-Wave's claims in 2005 of a &quot;$10^8$ speedup&quot; with their device (which holds only when using appropriate comparisons).&#xA;See for example discussions on &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=2555&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Scott Aaronson's blog post&lt;/a&gt; and references therein (and, of course, the original paper by Denchev et al. (&lt;a href=&quot;https://arxiv.org/abs/1512.02206&quot; rel=&quot;nofollow noreferrer&quot;&gt;1512.02206&lt;/a&gt;)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also regarding the exact thresholds separating the &quot;classical&quot; from the &quot;quantum supremacy&quot; regime, one may have a look at the discussions around the number of photons required to claim quantum supremacy in a boson sampling experiment. &#xA;The reported number was initially around 20 and 30 (&lt;a href=&quot;https://arxiv.org/abs/1011.3245&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson 2010&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1203.5813&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill 2012&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1505.03708&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bentivegna et al. 2015&lt;/a&gt;, among others), then briefly went as low as seven (&lt;a href=&quot;https://arxiv.org/abs/1610.02279&quot; rel=&quot;nofollow noreferrer&quot;&gt;Latmiral et al. 2016&lt;/a&gt;), and then up again as high as ~50 (&lt;a href=&quot;https://arxiv.org/abs/1705.00686&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neville et al. 2017&lt;/a&gt;, and you may have a look at the brief discussion of this result &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=3248&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;em&gt;many&lt;/em&gt; other similar examples that I didn't mention here. For example there is the whole discussion around quantum advantage via IQP circuits, or the number of qubits that are necessary before one cannot simulate classically a device (&lt;a href=&quot;https://arxiv.org/abs/1709.06678&quot; rel=&quot;nofollow noreferrer&quot;&gt;Neill et al. 2017&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1710.05867&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pednault et al. 2017&lt;/a&gt;, and &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=3512&quot; rel=&quot;nofollow noreferrer&quot;&gt;some&lt;/a&gt; &lt;a href=&quot;https://www.nature.com/news/race-for-quantum-supremacy-hits-theoretical-quagmire-1.22993&quot; rel=&quot;nofollow noreferrer&quot;&gt;other&lt;/a&gt; discussions on these results).&#xA;Another nice review I didn't include above is this &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0018-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lund et al. 2017&lt;/a&gt; paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) I'm using here the rephrasing of the criteria as given in Calude and Calude (&lt;a href=&quot;https://arxiv.org/pdf/1712.01356.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1712.01356&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="58" LastEditDate="2018-03-14T09:51:25.767" LastActivityDate="2018-03-14T09:51:25.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="82" PostTypeId="2" ParentId="69" CreationDate="2018-03-13T14:47:00.733" Score="2" Body="&lt;p&gt;Asking the author to clarify would give you the exact answer you are looking for. However, based upon the context provided I believe this may be related to the problem &lt;strong&gt;quantum noise spectroscopy&lt;/strong&gt; attempts to solve.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Noise&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;According to a team of Dartmouth researchers led by Professor Lorenza Viola, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These quantum properties are essential for quantum computing, but they are easily lost through decoherence, when quantum systems are subject to &quot;noise&quot; in an external environment.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The quantum properties she is referring too are quantum system properties such as the ability to be in a superposition of two different states simultaneously as stated in the same &lt;a href=&quot;https://www.sciencedaily.com/releases/2016/04/160418130648.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My Conclusion&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Therefore, based upon both the context provided in the question and the context provided by the team of Dartmouth researchers, I would conclude that the &lt;em&gt;noise&lt;/em&gt; the book refers to is &lt;em&gt;environmental noise&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="82" LastActivityDate="2018-03-13T14:47:00.733" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="84" PostTypeId="2" ParentId="4" CreationDate="2018-03-13T15:29:44.657" Score="7" Body="&lt;h2&gt;Case I: The 2 qubits are not entangled.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You can write the states of the two qubits (say $\mathrm{A}$ and $\mathrm{B}$) as $|\psi_\mathrm{A}\rangle=a|0\rangle+b|1\rangle$ and $|\psi_\mathrm{B}\rangle = c|0\rangle+d|1\rangle$ where $a,b,c,d\in\Bbb{C}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The individual qubits reside in two dimensional complex vector spaces $\Bbb{C}^2$ (over a $\Bbb{C}$ field). But the state of the system is a &lt;em&gt;vector&lt;/em&gt; (or &lt;em&gt;point&lt;/em&gt;) residing in a four dimensional complex vector space $\Bbb{C}^4$(over a $\Bbb {C}$ field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state of the system can be written as a tensor product $|\psi_\mathrm{A}\rangle\otimes|\psi_\mathrm{B}\rangle$ i.e. $ac|00\rangle+ad|01\rangle+bc|10\rangle+bd|11\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally, $|ac|^2+|ad|^2+|bc|^2+|bd|^2=1$ since the state vector has to be normalized. The reason as to why the square of the amplitude of a basis state gives the probability of that basis state occurring when measured in the corresponding basis lies in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;noreferrer&quot;&gt;Born's rule&lt;/a&gt; of quantum mechanics (some physicists consider it to be a basic postulate of quantum mechanics). Now, probability of $|0\rangle$ occuring when the first qubit is measured is $|ac|^2+|ad|^2$. Similarly, probability of $|1\rangle$ occuring when the first qubit is measured is $|bc|^2+|bd|^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what happens if we apply a quantum gate without performing any measurement on the previous state of the system? Quantum gates are unitary gates. Their action can be written as action of an unitary operator $U$ on the initial state of the system i.e. $ac|00\rangle+ad|01\rangle+bc|10\rangle+bd|11\rangle$ to produce a new state $A|00\rangle+B|01\rangle+C|10\rangle+D|11\rangle$ (where $A,B,C,D\in\Bbb{C}$). The magnitude of this new state vector: $|A|^2+|B|^2+|C|^2+|D|^2$ again equates to $1$, since the applied gate was &lt;em&gt;unitary&lt;/em&gt;. When the first qubit is measured, probability of $|0\rangle$ occurring is $|A|^2+|B|^2$ and similarly you can find it for occurrence of $|1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if we did perform a measurement, before the action of the unitary gate the result would be different. For example of you had measured the first qubit and it turned out to be in $|0\rangle$ state the intermediate state of the system would have &lt;em&gt;collapsed&lt;/em&gt; to $\frac{ac|00\rangle + ad|01\rangle}{\sqrt{(ac)^2+(ad)^2}}$ (according to the Copenhagen interpretation). So you can understand that applying the same quantum gate on &lt;em&gt;this&lt;/em&gt; state would have given a different final result.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Case II: The 2 qubits are entangled.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In case the state of the system is something like $\frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle$ , you cannot represent it as a tensor product of states of two individual qubits (try!). There are plenty more such examples. The qubits are said to entangled in such a case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the basic logic still remains same. The probability of $|0\rangle$ occuring when the first qubit is measured is $|1/\sqrt{2}|^2=\frac{1}{2}$ and $|1\rangle$ occuring is $\frac{1}{2}$ too. Similarly you can find out the probabilities for measurement of the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again if you apply a unitary quantum gate on this state, you'd end up with something like $A|00\rangle+B|01\rangle+C|10\rangle+D|11\rangle$, as before. I hope you can now yourself find out the probabilities of the different possibilities when the first and second qubits are measured.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note: Normally the basis states of the 2-qubit sytem $|00\rangle,|01\rangle,|10\rangle,|11\rangle$ are considered as the four $4\times 1$ column vectors like $\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}$, $\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}$, etc. by mapping the four basis vectors to the standard basis of $\Bbb{R}^4$. And, the unitary transformations $U$ can be written as $4\times 4$ matrices which satisfy the property $UU^{\dagger}=U^{\dagger}U=I$.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-13T16:51:25.723" LastActivityDate="2018-03-13T16:51:25.723" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="85" PostTypeId="2" ParentId="69" CreationDate="2018-03-13T15:57:07.180" Score="11" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Unfortunately for analog computation it turns out that when realistic assumptions about the presence of noise in analog computers are made, their power disappears in all known instances; they cannot efficiently solve problems which are not solvable on a Turing machine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;Noise&lt;/em&gt;&quot; appears to be used in the general sense of non-idealities in a signal:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Signal_processing&quot; rel=&quot;noreferrer&quot;&gt;signal processing&lt;/a&gt;, noise is a general term for unwanted (and, in general, unknown) modifications that a &lt;a href=&quot;https://en.wikipedia.org/wiki/Signal_(signal_processing)&quot; rel=&quot;noreferrer&quot;&gt;signal&lt;/a&gt; may suffer during capture, storage, transmission, processing, or conversion.&lt;sup&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Noise_(signal_processing)#cite_note-1&quot; rel=&quot;noreferrer&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Sometimes the word is also used to mean signals that are random (unpredictable) and carry no useful information; even if they are not interfering with other signals or may have been introduced intentionally, as in &lt;a href=&quot;https://en.wikipedia.org/wiki/Comfort_noise&quot; rel=&quot;noreferrer&quot;&gt;comfort noise&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;-&lt;a href=&quot;https://en.wikipedia.org/wiki/Noise_(signal_processing)&quot; rel=&quot;noreferrer&quot;&gt;&quot;Noise (signal processing)&quot;&lt;/a&gt;, Wikipedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For an example of what they're talking about, let's consider a simple circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\require{enclose}&#xA;\def\place#1#2#3{\smash{\rlap{\hskip{#1pt}\raise{#2pt}{#3}}}}&#xA;%&#xA;\bbox[10pt]{\enclose{box}{\phantom{\Rule{250pt}{75pt}{0pt}}}}&#xA;%&#xA;\place{-275}{70}{\enclose{box}{\bbox[5pt,lightblue]{&#xA;\begin{array}{c}&#xA;\text{resistor} \\&#xA;\text{set resistance:}~R&#xA;\end{array}&#xA;}}}&#xA;%&#xA;\place{-270}{0}{&#xA;\enclose{box}{\bbox[5pt,lightblue]{&#xA;\begin{array}{c}&#xA;\text{power source} \\&#xA;\text{set voltage:}~V&#xA;\end{array}&#xA;}}}&#xA;%&#xA;\place{-55}{30}{&#xA;\enclose{box}{\bbox[5pt,lightblue]{&#xA;\begin{array}{c}&#xA;\text{current meter} \\&#xA;\text{measured current:}~I&#xA;\end{array}&#xA;}}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we can select both $V$ and $R$ and we know &lt;a href=&quot;https://en.wikipedia.org/wiki/Ohm%27s_Laws&quot; rel=&quot;noreferrer&quot;&gt;Ohm's law&lt;/a&gt;, $I=\frac{V}{R}$, we can use this circuit to divide numbers for us:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Select some division problem to perform, $\frac{a}{b}=?$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the voltage source to $V=a~\mathrm{V}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Set the resistor to $R=b~\mathrm{\Omega}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure $I=?~\mathrm{A}$ to get the result!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a simple analog computer that can divide numbers without need for us to perform the math in some other manner, e.g. digital logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what's really cool about this?  If we're naive, we might believe that it can do &lt;a href=&quot;https://en.wikipedia.org/wiki/Real_computation&quot; rel=&quot;noreferrer&quot;&gt;real computation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Computability_theory&quot; rel=&quot;noreferrer&quot;&gt;computability theory&lt;/a&gt;, the theory of real computation deals with hypothetical computing machines using infinite-precision real numbers. They are given this name because they operate on the set of &lt;a href=&quot;https://en.wikipedia.org/wiki/Real_number&quot; rel=&quot;noreferrer&quot;&gt;real numbers&lt;/a&gt;. Within this theory, it is possible to prove interesting statements such as &quot;The complement of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Mandelbrot_set&quot; rel=&quot;noreferrer&quot;&gt;Mandelbrot set&lt;/a&gt; is only partially decidable.&quot;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;These hypothetical computing machines can be viewed as idealised &lt;a href=&quot;https://en.wikipedia.org/wiki/Analog_computer&quot; rel=&quot;noreferrer&quot;&gt;analog computers&lt;/a&gt; which operate on real numbers, whereas &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_computer&quot; rel=&quot;noreferrer&quot;&gt;digital computers&lt;/a&gt; are limited to &lt;a href=&quot;https://en.wikipedia.org/wiki/Computable_numbers&quot; rel=&quot;noreferrer&quot;&gt;computable numbers&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;-&lt;a href=&quot;https://en.wikipedia.org/wiki/Real_computation&quot; rel=&quot;noreferrer&quot;&gt;&quot;Real computation&quot;&lt;/a&gt;, Wikipedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The thing's that Ohm's law uses real-number values, $\left\{V,I,R\right\}{\in}\mathbb{R}$.  If we believe that these values actually have infinite precision, then we can perform multiplication or division with infinite precision in finite time; this is a feat that a Turing machine can't perform with finite-time operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, back to the original quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unfortunately for analog computation it turns out that when realistic assumptions about the presence of noise in analog computers are made, their power disappears in all known instances; they cannot efficiently solve problems which are not solvable on a Turing machine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They're basically saying that, whenever someone's come up with a scheme like this, the non-idealities of the situation (noise in the signals, design, etc.) tend to derail the idealistic expectations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quoted excerpt seems to use this as a jumping-off point to discuss how quantum computers aren't as limited by this problem as classical analog computers often seem to have been.&lt;/p&gt;&#xA;" OwnerUserId="15" LastEditorUserId="15" LastEditDate="2018-03-15T10:39:05.103" LastActivityDate="2018-03-15T10:39:05.103" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="86" PostTypeId="2" ParentId="3" CreationDate="2018-03-13T16:17:03.143" Score="27" Body="&lt;p&gt;The title of your question asks for techniques that are impossible to break, to which the &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;noreferrer&quot;&gt;One Time Pad&lt;/a&gt; (OTP) is the correct answer, as pointed out in the other answers. The OTP is information-theoretically secure, which means that an adversaries computational abilities are inapplicable when it comes to finding the message.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, despite being perfectly secure &lt;em&gt;in theory&lt;/em&gt;, the OTP is of limited use in modern cryptography. It is extremely difficult &lt;a href=&quot;https://crypto.stackexchange.com/questions/15652/one-time-pad-why-is-it-useless-in-practice&quot;&gt;to use successfully &lt;em&gt;in practice&lt;/em&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important question really is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can we still expect a new cryptographic algorithm which will be hard to crack using even a quantum computer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Asymmetric Cryptography&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Asymmetric cryptography includes Public-Key Encryption (PKE), Digital Signatures, and Key Agreement schemes. These techniques are vital to solve the problems of key distribution and key management. Key distribution and key management are non-negligible problems, they are largely what prevent the OTP from being usable in practice. The internet as we know it today would not function without the ability to create a secured communications channel from an insecure communications channel, which is one of the features that asymmetric algorithms offer.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Shor's algorithm&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt; is useful for solving the problems of integer factorization and discrete logarithms. These two problems are what provide the basis for security of widely used schemes such as &lt;a href=&quot;https://en.wikipedia.org/wiki/RSA_(cryptosystem)&quot; rel=&quot;noreferrer&quot;&gt;RSA&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange&quot; rel=&quot;noreferrer&quot;&gt;Diffie-Hellman&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;NIST is &lt;a href=&quot;https://csrc.nist.gov/projects/post-quantum-cryptography/round-1-submissions&quot; rel=&quot;noreferrer&quot;&gt;currently evaluating submissions for Post-Quantum algorithms&lt;/a&gt; - algorithms that are based on problems that are believed to be resistant to quantum computers. These problems include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice-based_cryptography&quot; rel=&quot;noreferrer&quot;&gt;Lattice based problems&lt;/a&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice_problems#Shortest_vector_problem_(SVP)&quot; rel=&quot;noreferrer&quot;&gt;Shortest vector problem&lt;/a&gt; (SVP)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice_problems#Shortest_vector_problem_(SVP)&quot; rel=&quot;noreferrer&quot;&gt;Closest vector problem&lt;/a&gt; (CVP)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Multivariate_cryptography&quot; rel=&quot;noreferrer&quot;&gt;Multivariate equations&lt;/a&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Multivariate polynomial equations&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://hkumath.hku.hk/~ghan/WAM/Joachim.pdf&quot; rel=&quot;noreferrer&quot;&gt;Code based schemes&lt;/a&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Based on the hardness of decoding linear codes &lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Supersingular_Isogeny_Key_Exchange&quot; rel=&quot;noreferrer&quot;&gt;Supersingular Isogeny Diffie-Hellman&lt;/a&gt; (SIDH)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It should be noted that classical algorithms for solving the above problems may &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lenstra%E2%80%93Lenstra%E2%80%93Lov%C3%A1sz_lattice_basis_reduction_algorithm&quot; rel=&quot;noreferrer&quot;&gt;exist&lt;/a&gt;&lt;/em&gt;, it's just that the runtime/accuracy of these algorithms is prohibitive for solving large instances in practice. These problems don't appear to be solvable when given the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;noreferrer&quot;&gt;ability to solve the problem of order finding&lt;/a&gt;, which is what the quantum part of Shor's algorithm does.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Symmetric Cryptography&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://twistedoakstudios.com/blog/Post2644_grovers-quantum-search-algorithm&quot; rel=&quot;noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt; provides a quadratic speedup when searching through an unsorted list. This is effectively the problem brute-forcing a symmetric encryption key. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working around Grover's algorithm is relatively easy compared to working around Shor's algorithm: &lt;a href=&quot;https://crypto.stackexchange.com/a/23/29554&quot;&gt;Simply double the size of your symmetric key&lt;/a&gt;. A 256-bit key offers 128-bits of resistance against brute force to an adversary that uses Grover's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm is also &lt;a href=&quot;https://dsprenkels.com/files/grover.pdf&quot; rel=&quot;noreferrer&quot;&gt;usable against hash functions&lt;/a&gt;. The solution again is simple: Double the size of your hash output (and capacity if you are using a hash based on a &lt;a href=&quot;https://keccak.team/sponge_duplex.html&quot; rel=&quot;noreferrer&quot;&gt;sponge construction&lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2018-06-19T16:48:13.740" LastActivityDate="2018-06-19T16:48:13.740" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="89" PostTypeId="2" ParentId="7" CreationDate="2018-03-13T16:57:18.047" Score="11" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_cryptography&quot; rel=&quot;noreferrer&quot;&gt;Quantum cryptography&lt;/a&gt; relies on elaborate physical machinery to execute cryptographic protocols whose security rests upon axioms of quantum mechanics (theoretically, anyways).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quote the wikipedia entry on the BB84 protocol:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The security of the protocol comes from encoding the information in non-orthogonal states. Quantum indeterminacy means that these states cannot in general be measured without disturbing the original state (see No cloning theorem).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is a good &lt;a href=&quot;https://crypto.stackexchange.com/q/51311/29554&quot;&gt;question&lt;/a&gt; and &lt;a href=&quot;https://crypto.stackexchange.com/a/51314/29554&quot;&gt;answers&lt;/a&gt; about &quot;What makes Quantum Cryptography secure?&quot; on crypto.stackexchange. They are verbose, so I will refrain from copying the content here.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Differences between Quantum Cryptography and Modern Cryptography&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Quantum cryptography requires specialized machinery in order to execute a run of the protocol. This is a non-negligible disadvantage compared to modern cryptography. If you want to use Quantum Cryptography, you'll need to pay one of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution#Commercial&quot; rel=&quot;noreferrer&quot;&gt;commercial entities that offers the service&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Modern cryptography uses mathematical algorithms implemented in software, which can be performed by any old computer with sufficient resources (which are almost all computers in this day and age). The outputs of the algorithms can be transmitted via an arbitrary communications medium. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you see a green padlock next to the URL in your web browser, it means your connection to this very site is being secured by modern cryptography - which is effectively being done for free, as far as you were concerned.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Note&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/prCTD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/prCTD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum cryptography is often thought to be unconditionally unbreakable due to the laws of the universe. This sounds too good to be true, and it unfortunately is. There is nothing to stop someone from waiting for you to receive your message, then to &lt;a href=&quot;https://en.wikipedia.org/wiki/Rubber-hose_cryptanalysis&quot; rel=&quot;noreferrer&quot;&gt;threaten you until you reveal what the message was&lt;/a&gt;. There is also the issue of an adversaries ability to tamper with the hardware. For a rather scathing but in-depth review of these points, see the &lt;a href=&quot;https://blog.cr.yp.to/20160516-quantum.html&quot; rel=&quot;noreferrer&quot;&gt;blog post at cr.yp.to&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, as with all &lt;a href=&quot;http://www.ams.org/notices/200708/tx070800972p.pdf&quot; rel=&quot;noreferrer&quot;&gt;provably&lt;/a&gt; &lt;a href=&quot;https://eprint.iacr.org/2004/152.pdf&quot; rel=&quot;noreferrer&quot;&gt;secure&lt;/a&gt; &lt;a href=&quot;https://eprint.iacr.org/2006/229.pdf&quot; rel=&quot;noreferrer&quot;&gt;cryptographic techniques&lt;/a&gt;, these guarantees are only provided within the framework of assumptions that the proofs rest upon. An adversary who finds a hole in these assumptions can circumvent the theoretical guarantees that the algorithms offer. That's not to say that QC is totally worthless and overtly non-functional, but that &quot;provable security&quot;, as always, needs to be understood to rest on certain sets of assumptions that could be violated in practice.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="162" LastEditDate="2018-03-15T19:15:03.470" LastActivityDate="2018-03-15T19:15:03.470" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="91" PostTypeId="1" AcceptedAnswerId="104" CreationDate="2018-03-13T17:21:04.793" Score="38" ViewCount="23491" Body="&lt;p&gt;Quantum algorithms frequently use bra-ket notation in their description. What do all of these brackets and vertical lines mean? For example: $|ψ⟩=α|0⟩+β|1⟩$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this is arguably a question about mathematics, this type of notation appears to be used frequently when dealing with quantum computation specifically. I'm not sure I have ever seen it used in any other contexts. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Edit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;By the last part, I mean that it is possible to denote vectors and inner products using standard notation for linear algebra, and some other fields that use these objects and operators do so without the use of bra-ket notation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads me to conclude that there is some difference/reason why bra-ket is especially handy for denoting quantum algorithms. It is not an assertion of fact, I meant it as an observation. &quot;I'm not sure I have seen it used elsewhere&quot; is not the same statement as &quot;It is not used in any other contexts&quot;.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="58" LastEditDate="2018-03-14T14:48:29.070" LastActivityDate="2020-06-01T12:26:16.660" Title="How does bra-ket notation work?" Tags="&lt;notation&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="92" PostTypeId="2" ParentId="91" CreationDate="2018-03-13T17:38:40.387" Score="23" Body="&lt;p&gt;You could think of $|0\rangle$ and $|1\rangle$ as two orthonormal basis states (represented by &quot;ket&quot;s) of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;noreferrer&quot;&gt;quantum bit&lt;/a&gt; which resides in a two  dimensional complex vector space. The lines and brackets you see is basically  the &lt;em&gt;bra-ket notation&lt;/em&gt; a.k.a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;noreferrer&quot;&gt;Dirac notation&lt;/a&gt; which is commonly used in quantum mechanics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example $|0\rangle$ could represent the spin-down state of an electron while $|1\rangle$ could represent the spin-up state. But actually the electron can be in a linear superposition of those two states i.e. $|\psi\rangle_{\text{electron}} = a|0\rangle + b|1\rangle$ (this is usually normalized like $\frac{a|0\rangle + b|1\rangle}{\sqrt{|a|^2+|b|^2}}$) where $a,b\in \Bbb{C}$.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-14T08:17:25.440" LastActivityDate="2018-03-14T08:17:25.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="93" PostTypeId="2" ParentId="61" CreationDate="2018-03-13T19:07:30.017" Score="9" Body="&lt;p&gt;The existing answer does a good job at describing the state that comes from a SPDC configuration at &lt;em&gt;low&lt;/em&gt; conversion efficiency, but it's also worth noting that the single-photon behaviour is not all there is to the process. Thus, in particular, if your conversion efficiency (or you detection time / efficiency / SNR) is good enough that you can detect (and &lt;a href=&quot;https://arxiv.org/abs/1305.6627&quot; rel=&quot;noreferrer&quot;&gt;discriminate&lt;/a&gt;) the emission of multiple photons in the same mode, then those two-photon events &lt;em&gt;also&lt;/em&gt; share quantum correlations between the two modes, as do all higher orders of the photon-statistics distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be more specific (and ignoring all the polarization, momentum, and phase-matching problems already alluded to by Mithrandir), the light that comes out of a Type II SPDC source in the signal and idler ports is in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Squeezed_coherent_state#Two-mode_squeezed_states&quot; rel=&quot;noreferrer&quot;&gt;two-mode squeezed state&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA; |{\text{TMSV}}\rangle &amp;amp; =S_{2}(\zeta )|0\rangle =\exp(\zeta ^{*}{\hat {a}}{\hat {b}}-\zeta {\hat {a}}^{\dagger }{\hat {b}}^{\dagger })|0\rangle &#xA;\\&amp;amp;  ={\frac {1}{\cosh r}}\sum _{n=0}^{\infty }(\tanh r)^{n}|nn\rangle &#xA;\\ &amp;amp; \approx \operatorname{sech}(r)\left[|00\rangle + \tanh(r)|11\rangle + \tanh^2(r)|22\rangle + \tanh^3(r) |33\rangle  +  \cdots \right],&#xA;\end{align}&#xA;i.e. just as a detection of a single photon on the signal port is completely (and coherently) correlated with a single photon on the idler port, so too does the observation of a two-photon signal state imply that the idler's mode has been collapsed onto a two-photon state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, the folks running SPDC setups as single-photon sources run them in a regime where $\tanh(r)$ is small (so most of the time you get vacuum, except when you do get a click on the signal that guarantees a single photon's presence in the idler mode) in order to eliminate the contribution of the higher-order photon-statistics channels, but they're still there, they can be important, and if you don't control appropriately for them then they might overwhelm the single-photon component of your signal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also say that the details change from configuration to configuration (so e.g. Type I SPDC only produces single-mode squeezed vacua, if I understand correctly) but the higher-order terms will generally always occur.&lt;/p&gt;&#xA;" OwnerUserId="176" LastActivityDate="2018-03-13T19:07:30.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="94" PostTypeId="2" ParentId="69" CreationDate="2018-03-14T00:21:51.643" Score="13" Body="&lt;p&gt;As an addition to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/85/23&quot;&gt;Nat's answer&lt;/a&gt;, it's worth mentioning that 'noise' is a specific concept&lt;sup&gt;1&lt;/sup&gt; in quantum computing. This answer will use &lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph219/chap3_15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill's lecture notes&lt;/a&gt; as a basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence, noise is indeed considered to be something that could be described as 'thermal noise', although it should be noted that it is an &lt;em&gt;interaction&lt;/em&gt; with a thermal environment &lt;em&gt;causing&lt;/em&gt; noise, as opposed to noise in and of itself. Approximations are made that means this noise can be described using quantum channels, which is what &lt;em&gt;Nielsen &amp;amp; Chuang&lt;/em&gt; seem to be referring to, as they discuss this in chapter 8.3 of that very textbook. The most common types of noise described in this manner are: depolarising, dephasing and amplitude damping, which will be very briefly explained below.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;In a bit more detail&lt;sup&gt;2&lt;/sup&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Start with a system with Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_S$&lt;/span&gt;, coupled to a (thermal) bath with Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the density matrix of the system and 'course grain' it into chunks of &lt;span class=&quot;math-container&quot;&gt;$\rho\left(t + n\,\delta t\right)$&lt;/span&gt;. Make the assumption that the interaction is Markovian, that is, the environment 'forgets' much quicker than the coarse graining time and that whatever you're trying to observe occurs over a time much longer than the coarse graining time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Express the density matrix at &lt;span class=&quot;math-container&quot;&gt;$t+\delta t$&lt;/span&gt; as a channel acting on the density matrix at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\rho\left(t + \delta t\right) = \varepsilon_{\delta t}\left(\rho\left(t\right)\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expand this to first order in &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; to get &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\delta t} = \mathrm{I} + \delta t\,\mathcal{L}$&lt;/span&gt;. As a channel, it must be completely positive and trace preserving, so &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\delta t}\left(\rho\left(t\right)\right) = \sum_aM_a\rho\left(t\right)M_a^\dagger$&lt;/span&gt; and satisfies &lt;span class=&quot;math-container&quot;&gt;$\sum_aM_a^\dagger M_a = \mathrm{I}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives a non-unitary quantum channel described by the &lt;em&gt;Lindblad Master equation&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$$\dot\rho = -i\left[H, \rho\right] + \sum_{a&amp;gt;0} \gamma_a\left(L_a\rho L_a^\dagger - \frac{1}{2}\lbrace L^\dagger_aL_a, \rho\rbrace\right),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\gamma_a$&lt;/span&gt;'s are always positive for Markovian evolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can also be written as &lt;span class=&quot;math-container&quot;&gt;$H_{\mathrm{eff}} = H - \frac{i}{2}\sum_a\gamma_aL_a^{\dagger}L_a$&lt;/span&gt;, with an additional term, such that the evolution can be written as &lt;span class=&quot;math-container&quot;&gt;$$\dot\rho = -i\left[H_{\text{eff}}, \rho\right] + \sum_{a&amp;gt;0} \gamma_aL_a\rho L_a^\dagger.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This now looks equivalent to the Kraus operator representation of a channel, with Kraus operators &lt;span class=&quot;math-container&quot;&gt;$K_a \propto L_a$&lt;/span&gt; (as well as an additional Kraus operator to satisfy &lt;span class=&quot;math-container&quot;&gt;$\left[H_{\text{eff}}, \rho\right]$&lt;/span&gt;). Any non-trivial Lindbladian can then be described as noise, although in reality, it is an approximation of evolution of an open system.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Some common types of noise&lt;sup&gt;3&lt;/sup&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Trying out various different forms of &lt;span class=&quot;math-container&quot;&gt;$L_a$&lt;/span&gt; gives different behaviours&#xA;of the system, which give different possible noises, of which there are a few common ones (in the single qubit case, anyway):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dephasing&lt;/strong&gt;: Causes the system to decohere - this gets rid/reduces the entanglement (i.e. coherence) of the system, necessarily making it more mixed, unless already maximally mixed&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon\left(\rho\right) = \left(1-\frac{p}{2}\right)\rho + \frac{1}{2}\sigma_z\rho\sigma_z$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Depolarising&lt;/strong&gt;: Upon measuring, either a bit flip (&lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;), phase flip (&lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;), or both bit and phase (&lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt;) will have occurred with some probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon\left(\rho\right) = \left(1-p\right)\rho + \frac{p}{3}\left(\sigma_x\rho\sigma_x + \sigma_y\rho\sigma_y + \sigma_z\rho\sigma_z\right)$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amplitude Damping&lt;/strong&gt;: Represents the system decaying from &lt;span class=&quot;math-container&quot;&gt;$\lvert 1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\lvert 0\rangle$&lt;/span&gt;, such as when an atom emits a photon. Leads to a simple version of the coherence times &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; (decay of &lt;span class=&quot;math-container&quot;&gt;$\lvert 1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\lvert 0\rangle$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; (decay of the off-diagonal terms). Described by the Kraus operators &lt;span class=&quot;math-container&quot;&gt;$$M_0 = \begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-p}\end{pmatrix} \text{ and } M_1 = \begin{pmatrix}0 &amp;amp; \sqrt{p} \\ 0 &amp;amp; 0\end{pmatrix},$$&lt;/span&gt; giving &lt;span class=&quot;math-container&quot;&gt;$$\varepsilon\left(\rho\right) = M_0\rho M_0^\dagger + M_1\rho M_1^\dagger$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Or rather, several very broad concepts resulting from the same fundamental idea&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 I wouldn't go around calling this rigorous or anything&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;3 Within this context, naturally&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="26" LastEditDate="2019-12-25T06:37:03.300" LastActivityDate="2019-12-25T06:37:03.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="95" PostTypeId="5" CreationDate="2018-03-14T01:17:24.723" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Noise is a general term for unwanted modifications that a signal may suffer during capture, storage, transmission, processing, or conversion. [1]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the context of Quantum Computing, noise can be a number of different things, although generally either arises as a result of an interaction with an environment, also sometimes referred to as a &lt;em&gt;bath&lt;/em&gt;, or as a result of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Heisenberg%27s_uncertainty_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heisenberg uncertainty principle&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Representing noise&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shot noise&lt;/strong&gt;: Is Poissonian noise that arises from a process such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tunnelling&quot; rel=&quot;nofollow noreferrer&quot;&gt;tunnelling&lt;/a&gt; electrons or fluctuations in the number of photons as a result of the uncertainty principle. Using e.g. squeezed light states can give &lt;em&gt;sub-poissonian&lt;/em&gt; statistics (where the variance is less than that of Poissonian statistics with the same mean), often referred to as &lt;em&gt;below the shot noise limit&lt;/em&gt;. Similarly, can also have &lt;em&gt;super-Poissonian&lt;/em&gt; statistics.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Markovian noise&lt;/strong&gt;: Where the environment is unable to 'remember' what has happened in the past. Often a good approximation. Leads to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lindbladian&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Lindblad Master equation&lt;/em&gt;&lt;/a&gt;, also known as the &lt;em&gt;Lindbladian&lt;/em&gt;. Can either be described in a 'coarse grained' manner (useful for simulations) or a more continuous manner.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kraus operators&lt;/strong&gt;: Described using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;quantum channel&lt;/em&gt;&lt;/a&gt; where (usually) a single operation of the Kraus operators is performed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Non-Markovian noise&lt;/strong&gt;: A more realistic noise model than Markovian; the assumption that the environment forgets the past is forgotten. As a result, the environment can act not entirely dissimilarly to some form of memory. Can lead to phenomena such as &lt;em&gt;entanglement revival&lt;/em&gt; and other effects where noise that arises from Markovian noise is reversed to a certain extent.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Common types of noise on qubits&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dephasing&lt;/strong&gt;: Causes the system to &lt;em&gt;decohere&lt;/em&gt; - this gets rid of/reduces the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement&lt;/a&gt; (i.e. coherence) of the system, necessarily making it more &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state#Mixed_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;mixed&lt;/a&gt;, unless already maximally mixed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Depolarising&lt;/strong&gt;: Upon measuring, either a &lt;em&gt;bit flip&lt;/em&gt; ($\sigma_x$), &lt;em&gt;phase flip&lt;/em&gt; ($\sigma_z$), or both bit and phase flip ($\sigma_y$) will have occurred with some probability.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amplitude Damping&lt;/strong&gt;: Represents the system decaying from one state to a different state, such as when an atom emits a photon. Leads to a simple version of &lt;a href=&quot;https://en.wikipedia.org/wiki/Atomic_coherence&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;coherence times&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Measuring noise&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Fidelity&lt;/strong&gt;&lt;/a&gt;: Measures how much two quantum states overlap. Often used to characterise quantum processors by comparing the final output state with the ideal result. Is a number between $0$ and $1$.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Other distance measures&lt;/strong&gt;: Other measures, such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;1-norm/trace distance&lt;/a&gt; also exist, which measure the difference between two states.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One of the biggest challenges currently facing quantum computing is that of reducing (by a myriad of experimental techniques) and mitigating (by &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;quantum error correction&lt;/em&gt;&lt;/a&gt;) the amount of noise on a system.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;References and further reading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Wikipedia page on &lt;a href=&quot;https://en.wikipedia.org/wiki/Noise_(signal_processing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Noise (signal processing)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nielsen, M.A. and Chuang, I.L., 2010. Quantum computation and quantum information. Cambridge university press.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-15T14:03:21.903" LastActivityDate="2018-03-15T14:03:21.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="96" PostTypeId="4" CreationDate="2018-03-14T01:17:24.723" Score="0" Body="For questions about different types of noise a quantum computer (or qubits) may experience; how this affects the outcome of the computation; how to reduce a specific type of noise on a specific implementation of quantum computer; or how to simulate noise." OwnerUserId="23" LastEditorUserId="26" LastEditDate="2019-01-01T09:32:50.777" LastActivityDate="2019-01-01T09:32:50.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="97" PostTypeId="1" CreationDate="2018-03-14T01:32:52.570" Score="22" ViewCount="1212" Body="&lt;p&gt;Why do you need error correction? My understanding is that error correction removes errors from noise, but noise should average itself out. To make clear what I'm asking, why can't you, instead of involving error correction, simply run the operations, say, a hundred times, and pick the average/most common answer?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2018-05-07T13:21:14.293" LastActivityDate="2019-01-08T18:22:36.157" Title="Is error correction necessary?" Tags="&lt;error-correction&gt;&lt;noise&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="98" PostTypeId="2" ParentId="97" CreationDate="2018-03-14T02:27:21.323" Score="19" Body="&lt;p&gt;That doesn't scale well. After a moderately long calculation you're basically left with the maximally mixed state or whatever fixed point your noise has. To scale to arbitrary long calculations you need to correct errors before they become too big.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some short calculation for the intuition given above. Consider the simple white noise model (depolarizing noise),&#xA;$$\rho'(\varepsilon)= (1-\varepsilon)\rho + \varepsilon \frac{\mathbb{I}}{\operatorname{tr} \mathbb{I}},$$&#xA;where $\rho$ is the ideal state (&lt;a href=&quot;https://quantumcomputing.meta.stackexchange.com/q/54/104&quot;&gt;standard notation&lt;/a&gt; applies). If you concatenate $n$ such noisy processes, the new noise parameter is $\varepsilon'=1-(1-\varepsilon)^n$, which increases exponentially in the number of gates (or other error sources). If you repeat the experiment $m$-times and assume that the standard error scales as $\frac{1}{\sqrt{m}}$ you see that the number of runs $m$ would be exponentially in the length of your calculation!&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2018-03-15T12:15:30.760" LastActivityDate="2018-03-15T12:15:30.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="99" PostTypeId="2" ParentId="91" CreationDate="2018-03-14T04:47:21.553" Score="19" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What do all of these brackets and vertical lines mean?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The notation $\left \lvert v \right \rangle$ means &lt;em&gt;exactly&lt;/em&gt; the same thing as $\vec{v}$ or $\textbf{v}$, i.e. it denotes a vector whose name is &quot;v&quot;.&#xA;That's it.&#xA;There is no further mystery or magic, at all.&#xA;The symbol $\left \lvert \psi \right \rangle$ denotes a vector called &quot;psi&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbol $\left \lvert \cdot \right \rangle$ is called a &quot;ket&quot;, but it could just as well (and in my opinion should) be called a &quot;vector&quot; with absolutely no loss of meaning at all.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;While this is arguably a question about mathematics, this type of notation appears to be used frequently when dealing with quantum computation specifically.&#xA;  I'm not sure I have ever seen it used in any other contexts.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The notation was invented by a physicist (&lt;a href=&quot;https://en.wikipedia.org/wiki/Paul_Dirac&quot; rel=&quot;noreferrer&quot;&gt;Paul Dirac&lt;/a&gt;) and is called &quot;Dirac notation&quot; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;noreferrer&quot;&gt;&quot;bra-ket notation&quot;&lt;/a&gt;.&#xA;As far as I know, Dirac probably invented it while studying quantum mechanics, and so historically the notation has &lt;em&gt;mostly&lt;/em&gt; been used to denote the vectors that show up in quantum mechanics, i.e. quantum states.&#xA;Bra-ket notation is the standard in &lt;em&gt;any&lt;/em&gt; quantum mechanics context, not just quantum computation.&#xA;For example, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation&quot; rel=&quot;noreferrer&quot;&gt;Schrodinger equation&lt;/a&gt;, which has to do with dynamics in quantum systems and predates quantum computation by decades, is written using bra-ket notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the notation is pretty convenient in other linear algebra contexts and is used outside of quantum mechanics.&lt;/p&gt;&#xA;" OwnerUserId="32" LastActivityDate="2018-03-14T04:47:21.553" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="100" PostTypeId="2" ParentId="97" CreationDate="2018-03-14T09:31:40.683" Score="8" Body="&lt;p&gt;Now, adding to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/98/26&quot;&gt;M. Stern's answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The primary reason as to why error correction is needed for quantum computers, is because qubits have a &lt;strong&gt;continuum of states&lt;/strong&gt; (I'm considering qubit-based quantum computers only, at the moment, for sake of simplicity). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum computers, unlike classical computers each bit doesn't exist in only two possible states. For instance a likely source of error is over-rotation: $\alpha|0\rangle+\beta|1\rangle$ might be supposed to become $\alpha|0\rangle + \beta e^{i\phi}|1\rangle$ but actually becomes $\alpha|0\rangle+\beta e^{i(\phi+\delta)}|1\rangle$. The actual state is close to the correct state but still wrong. If we don't do something about this the small errors will build up over the course of time and eventually become a big error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, quantum states are very delicate, and any interaction with the environment can cause &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_decoherence&quot; rel=&quot;noreferrer&quot;&gt;decoherence&lt;/a&gt; and collapse of a state like $\alpha|0\rangle+\beta|1\rangle$ to $|0\rangle$ with probability $|\alpha|^2$ or $|1\rangle$ with probability $|\beta|^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a classical computer if say a bit's value is being replicated n-times as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$0 \to 00000...\text{n times}$$ and $$1 \to 11111...\text{n times}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case after the step something like $0001000100$ is produced it can be corrected by the classical computer to give $0000000000$ because majority of the bits were $0's$ and most probably the intended aim of the initial operation was replicating the $0$-bit $10$ times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, for qubits such a error correction method won't work, because first of all duplicating qubits directly is not possible due to the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;noreferrer&quot;&gt;No-Cloning theorem&lt;/a&gt;. And secondly, even if you could replicate $|\psi\rangle = \alpha |0\rangle +\beta |1\rangle$ 10-times it's highly probably that you'd end up with something like $(\alpha|0\rangle + \beta |1\rangle)\otimes (\alpha e^{i\epsilon}|0\rangle + \beta e^{i\epsilon'}|1\rangle)\otimes (\alpha e^{i\epsilon_2}|0\rangle + \beta e^{i\epsilon_2'}|1\rangle)\otimes ...$ i.e. with errors in the phases, where all the qubits would be in different states (due to the errors). That is, the situation is no-longer binary. A quantum computer, unlike a classical computer can no longer say that: &quot;Since majority of the bits are in $0$-state let me convert the rest to $0$ !&quot;, to correct any error which occurred during the operation. That's because all the $10$ states of the $10$ different qubits might be different from each other, after the so-called &quot;replication&quot; operation. The number of such possible errors will keep increasing rapidly as more and more operations are performed on a system of qubits. M. Stern has indeed used the right terminology in their answer to your question i.e. &quot;that doesn't &lt;strong&gt;scale well&lt;/strong&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you need a &lt;em&gt;different breed&lt;/em&gt; of error correcting techniques to deal with errors occurring during the operation of a quantum computer, which can deal not only with bit flip errors but also phase shift errors. Also, it has to be resistant against unintentional decoherence. One thing to keep in mind is that most quantum gates will not be &quot;perfect&quot;, even though with right number of &quot;universal quantum gates&quot; you can get &lt;em&gt;arbitrarily close&lt;/em&gt; to building &lt;em&gt;any&lt;/em&gt; quantum gate which performs (in theory) an unitary transformation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Niel de Beaudrap &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/101/26&quot;&gt;mentions&lt;/a&gt; that there are clever ways to apply classical error correction techniques in ways such that they can correct many of the errors which occur during quantum operations, which is indeed correct, and is exactly what current day quantum error correcting codes do. I'd like to add the following from &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, as it might give some clarity about how quantum error correcting codes deal with the problem described above: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Classical error correcting codes use a &lt;em&gt;syndrome measurement&lt;/em&gt; to&#xA;  diagnose which error corrupts an encoded state. We then reverse an&#xA;  error by applying a corrective operation based on the &lt;em&gt;syndrome&lt;/em&gt;.&#xA;  Quantum error correction also employs syndrome measurements. We&#xA;  perform a multi-qubit measurement that does not disturb the quantum&#xA;  information in the encoded state but retrieves information about the&#xA;  error. A syndrome measurement can determine whether a qubit has been&#xA;  corrupted, and if so, which one. What is more, the outcome of this&#xA;  operation (the syndrome) tells us not only which physical qubit was&#xA;  affected, but also, in which of several possible ways it was affected.&#xA;  The latter is counter-intuitive at first sight: Since noise is&#xA;  arbitrary, how can the effect of noise be one of only few distinct&#xA;  possibilities? In most codes, the effect is either a bit flip, or a&#xA;  sign (of the phase) flip, or both (corresponding to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;noreferrer&quot;&gt;Pauli matrices&lt;/a&gt;&#xA;  X, Z, and Y). The reason is that the measurement of the syndrome has&#xA;  the projective effect of a quantum measurement. So even if the error&#xA;  due to the noise was arbitrary, it can be expressed as a superposition&#xA;  of basis operations—the error basis (which is here given by the Pauli&#xA;  matrices and the identity). The syndrome measurement &quot;forces&quot; the&#xA;  qubit to &quot;decide&quot; for a certain specific &quot;Pauli error&quot; to &quot;have&#xA;  happened&quot;, and the syndrome tells us which, so that we can let the&#xA;  same Pauli operator act again on the corrupted qubit to revert the&#xA;  effect of the error.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The syndrome measurement tells us as much as possible about the error&#xA;  that has happened, but nothing at all about the value that is stored&#xA;  in the logical qubit—as otherwise the measurement would destroy any&#xA;  quantum superposition of this logical qubit with other qubits in the&#xA;  quantum computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: I haven't given any example of actual quantum error correcting techniques. There are plenty of good textbooks out there which discuss this topic. However, I hope this answer will give the readers a basic idea of why we need error correcting codes in quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Recommended Further Readings:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0904.2557&quot; rel=&quot;noreferrer&quot;&gt;An Introduction to Quantum Error Correction and&#xA;Fault-Tolerant Quantum Computation - Daniel Gottesman&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.52.R2493&quot; rel=&quot;noreferrer&quot;&gt;Scheme for reducing decoherence in quantum computer memory - Peter Shor&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Recommended Video Lecture:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=hV5FTsyKE8A&quot; rel=&quot;noreferrer&quot;&gt;Mini Crash Course: Quantum Error Correction by Ben Reichardt, University of Southern California&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-15T12:51:11.100" LastActivityDate="2018-03-15T12:51:11.100" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="101" PostTypeId="2" ParentId="97" CreationDate="2018-03-14T10:22:23.340" Score="12" Body="&lt;p&gt;If the error rate were low enough, you &lt;em&gt;could&lt;/em&gt; run a computation a hundred times and take the most common answer. For instance, this would work if the error rate were low enough that the expected number of errors per computation was something very small &amp;mdash; which means that how well this strategy works would depend on how long and complicated a computation you would like to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the error rate or the length of your computation become sufficiently high, you can no longer have any confidence that the most likely outcome is that there were zero errors: at a certain point it becomes more likely that you have one, or two, or more errors, than that you have zero. In this case, there is nothing to prevent the majority of the cases from giving you an incorrect answer. What then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These issues are not special to quantum computation: they also apply to classical computation &amp;mdash; it just happens that almost all of our technology is at a sufficiently advanced state of maturity that these issues do not concern us in practise; that there may be a greater chance of your computer being struck by a meteorite mid-computation (or it running out of battery power, or you deciding to switch it off) than of there being a hardware error. What is (temporarily) special about quantum computation is that the technology is not yet mature enough for us to be so relaxed about the possibility of error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In those times when classical computation &lt;em&gt;has&lt;/em&gt; been at a stage when error correction was both practical and necessary, we were able to make use of certain mathematical techniques &amp;mdash; error correction &amp;mdash; which made it possible to suppress the effective error rate, and in principle to make it as low as we liked. The same techniques surprisingly can be used for quantum error correction &amp;mdash; with a little bit of extension, to accommodate the difference between quantum and classical information. At first, before the mid-1990s, it was thought that quantum error correction was impossible because of the continuity of the space of quantum states. But as it turns out, by applying classical error correction techniques in the right way to the different ways a qubit could be measured (usually described as &quot;bit&quot; and &quot;phase&quot;), you can in principle suppress many kinds of noise on quantum systems as well. These techniques are not special to qubits, either: the same idea can be used for quantum systems of any finite dimension (though for models such as adiabatic computation, it may then get in the way of actually performing the computation you wish to perform).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the time I'm writing this, individual qubits are so difficult to build and to marshall that people are hoping to get away with doing proof-of-principle computations without any error correction at all. That's fine, but it will limit how long their computations can be until the number of accumulated errors is large enough that the computation stops being meaningful. There are two solutions: to get better at suppressing noise, or to apply error correction. Both are good ideas, but it is possible that error correction is easier to perform in the medium- and long-term than suppressing sources of noise.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-03-14T10:27:25.670" LastActivityDate="2018-03-14T10:27:25.670" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="104" PostTypeId="2" ParentId="91" CreationDate="2018-03-14T11:01:52.777" Score="25" Body="&lt;p&gt;As already explained by others, a &lt;em&gt;ket&lt;/em&gt; $\left|\psi\right&amp;gt;$ is just a vector. A &lt;em&gt;bra&lt;/em&gt; $\left&amp;lt;\psi\right|$ is the Hermitian conjugate of the vector. You can multiply a vector with a number in the usual way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now comes the fun part: You can write the scalar product of two vectors $\left|\psi\right&amp;gt;$ and $\left|\phi\right&amp;gt;$ as $\left&amp;lt;\phi\middle|\psi\right&amp;gt;$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can apply an operator to the vector (in finite dimensions this is just a matrix multiplication) $X\left|\psi\right&amp;gt;$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all, the notation is very handy and intuitive. For more information, see the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; or a textbook on Quantum Mechanics.&lt;/p&gt;&#xA;" OwnerUserId="18" LastEditorUserId="15" LastEditDate="2018-03-14T13:37:40.833" LastActivityDate="2018-03-14T13:37:40.833" CommentCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="105" PostTypeId="1" AcceptedAnswerId="110" CreationDate="2018-03-14T14:58:46.433" Score="14" ViewCount="1234" Body="&lt;p&gt;Online descriptions of quantum computers often discuss how they must be kept near absolute zero $\left(0~\mathrm{K}~\text{or}~-273.15~{\left. {}^{\circ}\mathrm{C} \right.}\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why must quantum computers operate under such extreme temperature conditions?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the need for extremely low temperatures the same for all quantum computers, or does it vary by architecture?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What happens if they overheat?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;Sources : &lt;a href=&quot;https://www.youtube.com/watch?v=7jT5rbE69ho&quot; rel=&quot;noreferrer&quot;&gt;Youtube&lt;/a&gt;, &lt;a href=&quot;https://www.dwavesys.com/tutorials/background-reading-series/introduction-d-wave-quantum-hardware&quot; rel=&quot;noreferrer&quot;&gt;D-Wave&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="253" LastEditDate="2018-03-26T15:44:46.110" LastActivityDate="2018-04-18T06:32:25.713" Title="Why must quantum computers be kept near absolute zero?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;experiment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="106" PostTypeId="5" CreationDate="2018-03-14T15:55:05.567" Score="0" Body="&lt;p&gt;In computer science, the computational complexity, or simply complexity of an algorithm is the amount of resources required for running it. The computational complexity of a problem is the minimum of the complexities of all possible algorithms for this problem (including the unknown algorithms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum complexity theory is a part of computational complexity theory in theoretical computer science. It studies complexity classes defined using quantum computers and quantum information which are computational models based on quantum mechanics. It studies the hardness of problems in relation to these complexity classes, and the relationship between quantum complexity classes and classical (i.e., non-quantum) complexity classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Computational_complexity_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Computational_complexity_theory&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_complexity_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_complexity_theory&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-14T19:09:03.000" LastActivityDate="2018-03-14T19:09:03.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="107" PostTypeId="4" CreationDate="2018-03-14T15:55:05.567" Score="0" Body="For questions related to complexity of quantum algorithms. For questions on the relative perfomance wrt. to classical computers, (also) use the [quantum-speedup] tag." OwnerUserId="26" LastEditorUserId="253" LastEditDate="2018-03-24T22:45:05.337" LastActivityDate="2018-03-24T22:45:05.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="108" PostTypeId="5" CreationDate="2018-03-14T15:56:14.313" Score="0" Body="&lt;p&gt;Quantum error correction (QEC) is used in quantum computing to protect quantum information from errors due to decoherence and other quantum noise. Quantum error correction is essential if one is to achieve fault-tolerant quantum computation that can deal not only with noise on stored quantum information, but also with faulty quantum gates, faulty quantum preparation, and faulty measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_error_correction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-14T19:08:20.123" LastActivityDate="2018-03-14T19:08:20.123" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="109" PostTypeId="4" CreationDate="2018-03-14T15:56:14.313" Score="0" Body="For questions related to quantum error correction" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-14T19:08:14.493" LastActivityDate="2018-03-14T19:08:14.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="110" PostTypeId="2" ParentId="105" CreationDate="2018-03-14T17:03:27.697" Score="15" Body="&lt;p&gt;Well, first, not all systems must be kept near absolute zero. It depends on the realization of your quantum computer. For example, optical quantum computers do not need to be kept near absolute zero, but superconducting quantum computers do. So, that answers your second question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your first question, superconducting quantum computers (for example) must be kept at low temperatures so that the thermal environment cannot induce fluctuations in the qubits' energies. Such fluctuations would be noise/errors in the qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(See Blue's question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/117/why-do-optical-quantum-computers-not-have-to-be-kept-near-absolute-zero-while-su&quot;&gt;Why do optical quantum computers not have to be kept near absolute zero while superconducting quantum computers do?&lt;/a&gt; and Daniel Sank's answer for some follow up information.)&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-03-15T06:06:13.020" LastActivityDate="2018-03-15T06:06:13.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="111" PostTypeId="2" ParentId="53" CreationDate="2018-03-14T19:50:00.123" Score="7" Body="&lt;p&gt;It looks like you're asking about this part of the paper:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Therefore, a quantum computation is hidden as long as these measurements are successfully hidden. In order to achieve this, the BQC protocol exploits special resources called &lt;em&gt;blind cluster states&lt;/em&gt; that must be chosen carefully to be a generic structure that reveals nothing about the underlying computation (see Figure 1).&lt;/p&gt;&#xA;&lt;p&gt;-&lt;a href=&quot;https://arxiv.org/pdf/1110.1381.pdf&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Experimental Demonstration of Blind Quantum Computing&amp;quot;&lt;/a&gt; (2011)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That last part, about how they want a &lt;strong&gt;&amp;quot;&lt;em&gt;generic structure that reveals nothing about the underlying computation&lt;/em&gt;&amp;quot;&lt;/strong&gt; might make a reader wonder about how a computer's structure could leak information about its computations.&lt;/p&gt;&#xA;&lt;p&gt;As a simple example of structure leaking information about a cypto scheme, suppose that Bob asks Sally question to which we assume that Sally'll respond &lt;code&gt;yes&lt;/code&gt; or &lt;code&gt;no&lt;/code&gt;.  Sally directly encrypts her response using their shared &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;noreferrer&quot;&gt;one-time pad (OTP)&lt;/a&gt;, resulting in the ciphertext &lt;code&gt;rk4&lt;/code&gt;.  Despite the OTP scheme having perfect secrecy in general, it's clear that Sally responded &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this case, the computer was structured to leak information about the length of a message given that message, which was especially disastrous in this contrived example.  In general, structure can leak information about the computation.  Avoiding such leaks would be necessary for a blind-computation server like the one the paper intends to discuss.&lt;/p&gt;&#xA;&lt;p&gt;Generally speaking, attacks that operate like this are called &lt;a href=&quot;https://en.wikipedia.org/wiki/Side-channel_attack&quot; rel=&quot;noreferrer&quot;&gt;side-channel attacks&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the case of this paper (disclaiming that I just skimmed it quickly), it looks like they're basically talking about creating a generic computational structure that doesn't leak information through its structural traits.  For example, if the structure behaved differently in any way based on a secret aspect of the message, then it may leak secret information to the server when the server observes its own computational behavior.&lt;/p&gt;&#xA;&lt;p&gt;The paper appears to be trying to point out that the computational unit needs to be designed to avoid such information leaks.&lt;/p&gt;&#xA;&lt;p&gt;Later in the paper, they discuss stuff about &lt;a href=&quot;https://en.wikipedia.org/wiki/Blinding_(cryptography)&quot; rel=&quot;noreferrer&quot;&gt;blinding&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Cryptography&quot; rel=&quot;noreferrer&quot;&gt;cryptography&lt;/a&gt;, &lt;strong&gt;blinding&lt;/strong&gt; is a technique by which an agent can provide a service to (i.e., compute a &lt;a href=&quot;https://en.wikipedia.org/wiki/Function_(mathematics)&quot; rel=&quot;noreferrer&quot;&gt;function&lt;/a&gt; for) a client in an encoded form without knowing either the real input or the real output. Blinding techniques also have applications to preventing &lt;a href=&quot;https://en.wikipedia.org/wiki/Side-channel_attack&quot; rel=&quot;noreferrer&quot;&gt;side-channel attacks&lt;/a&gt; on encryption devices.&lt;/p&gt;&#xA;&lt;p&gt;-&lt;a href=&quot;https://en.wikipedia.org/wiki/Blinding_(cryptography)&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Blinding (cryptography)&amp;quot;&lt;/a&gt;, Wikipedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And, really, blinding's what this paper's all about: figuring out a way to have a server do work for clients without the clients revealing their secrets to the server.&lt;/p&gt;&#xA;&lt;p&gt;One way to enable blind computation is for the client to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Homomorphic_encryption&quot; rel=&quot;noreferrer&quot;&gt;homomorphic encryption&lt;/a&gt; on its job request before sending it to the server:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Homomorphic encryption&lt;/strong&gt; is a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Encryption&quot; rel=&quot;noreferrer&quot;&gt;encryption&lt;/a&gt; that allows &lt;a href=&quot;https://en.wikipedia.org/wiki/Computation&quot; rel=&quot;noreferrer&quot;&gt;computation&lt;/a&gt; on &lt;a href=&quot;https://en.wikipedia.org/wiki/Ciphertext&quot; rel=&quot;noreferrer&quot;&gt;ciphertexts&lt;/a&gt;, generating an encrypted result which, when decrypted, matches the result of the operations as if they had been performed on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Plaintext&quot; rel=&quot;noreferrer&quot;&gt;plaintext&lt;/a&gt;. The purpose of homomorphic encryption is to allow computation on encrypted data.&lt;/p&gt;&#xA;&lt;p&gt;-&lt;a href=&quot;https://en.wikipedia.org/wiki/Homomorphic_encryption&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Homomorphic encryption&amp;quot;&lt;/a&gt;, Wikipedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-03-16T13:42:50.563" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="112" PostTypeId="1" AcceptedAnswerId="116" CreationDate="2018-03-14T19:59:21.727" Score="17" ViewCount="7999" Body="&lt;p&gt;As I understand it, the main difference between quantum and non-quantum computers is that quantum computers use qubits while non-quantum computers use (classical) bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference between qubits and classical bits?&lt;/p&gt;&#xA;" OwnerUserId="11" LastEditorUserId="26" LastEditDate="2018-03-16T15:33:41.427" LastActivityDate="2018-08-31T15:59:55.370" Title="What is the difference between a qubit and classical bit?" Tags="&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="113" PostTypeId="5" CreationDate="2018-03-14T20:14:01.497" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-14T20:14:01.497" LastActivityDate="2018-03-14T20:14:01.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="114" PostTypeId="4" CreationDate="2018-03-14T20:14:01.497" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-14T20:14:01.497" LastActivityDate="2018-03-14T20:14:01.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="115" PostTypeId="1" AcceptedAnswerId="1502" CreationDate="2018-03-14T20:48:23.707" Score="18" ViewCount="831" Body="&lt;p&gt;The crucial role of &lt;a href=&quot;https://en.wikipedia.org/wiki/Random-access_memory&quot; rel=&quot;noreferrer&quot;&gt;random access memories&lt;/a&gt; (RAMs) in the context of classical computation makes it natural to wonder how one can generalise such a concept to the quantum domain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arguably the most notable (and first?) work proposing an efficient QRAM architecture is &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;noreferrer&quot;&gt;Giovannetti et al. 2007&lt;/a&gt;. &#xA;In this work it was shown that their &quot;bucket brigate&quot; approach allows access to the content of the memory with $\mathcal O(\log N)$ operations, where $N$ is the number of memory slots. This is an exponential improvement with respect to alternative approaches, which require $\mathcal O(N^{\alpha})$ operations.&#xA;Implementing this architecture is however highly nontrivial from an experimental point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the above the only known way to implement a QRAM? Or have there been other theoretical works in this direction? If so, how do they compare (pros and cons) with the Giovannetti et al. proposal?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2018-03-16T15:34:41.867" LastActivityDate="2019-05-15T14:58:21.083" Title="What protocols have been proposed to implement quantum RAMs?" Tags="&lt;quantum-memory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="116" PostTypeId="2" ParentId="112" CreationDate="2018-03-14T21:25:56.837" Score="15" Body="&lt;p&gt;A bit is a binary unit of information used in classical computation. It can take two possible values, typically taken to be $0$ or $1$. Bits can be implemented with devices or physical systems that can be in two possible states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compare and contrast bits with qubits, let's introduce a vector notation for bits as follows: a bit is represented by a column vector of two elements $(\alpha,\beta)^T$, where $\alpha$ stands for $0$ and $\beta$ for $1$. Now the bit $0$ is represented by the vector $(1,0)^T$ and the bit $1$ by $(0,1)^T$. Just like before, there are only two possible values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this kind of representation is redundant for classical bits, it is now easy to introduce qubits: a qubit is simply any $(\alpha,\beta)^T$ where the complex number elements satisfy the normalization condition $|\alpha|^2+|\beta|^2=1$. The normalization condition is necessary to interpret $|\alpha|^2$ and $|\beta|^2$ as probabilities for measurement outcomes, as will be seen. Some call qubit the unit of quantum information. Qubits can be implemented as the (pure) states of quantum devices or quantum systems that can be in two possible states, that will form the so called computational basis, and additionally in a coherent superposition of these. Here the quantumness is necessary to have qubits other than the classical $(1,0)^T$ and $(0,1)^T$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual operations that are carried out on qubits during a quantum computation are quantum gates and measurements. A (single qubit) quantum gate takes as input a qubit and gives as output a qubit that is a linear transformation of the input qubit. When using the above vector notation for qubits, gates should then be represented by matrices that preserve the normalization condition; such matrices are called unitary matrices. Classical gates may be represented by matrices that keep bits as bits, but notice that matrices representing quantum gates do not in general satisfy this requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A measurement on a bit is understood to be a classical one. By this I mean that an &lt;em&gt;a priori&lt;/em&gt; unknown value of bit can in principle be correctly found out with certainty. This is not the case for qubits: measuring a generic qubit $(\alpha,\beta)^T$ in the computational basis $[ (1,0)^T,(0,1)^T]$ will result in $(1,0)^T$ with probability $|\alpha|^2$ and in $(0,1)^T$ with probability $|\beta|^2$. In other words, while qubits can be in states other than computational basis states before measurement, measuring can still have only two possible outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1541/144&quot;&gt;There is not much one can do with a single bit or qubit&lt;/a&gt;. The full computational power of either comes from using many, which leads to the final difference between them that will be covered here: multiple qubits can be entangled. Informally speaking, entanglement is a form of correlation much stronger than classical systems can have. Together, superposition and entanglement allow one to design algorithms realized with qubits that cannot be done with bits. Of greatest interest are algorithms that allow the completion of a task with reduced computational complexity when compared to best known classical algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before concluding, it should be mentioned that a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1/can-a-turing-machine-simulate-a-quantum-computer&quot;&gt;qubit can be simulated with bits&lt;/a&gt; (and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/23/can-a-quantum-computer-simulate-a-normal-computer&quot;&gt;vice versa&lt;/a&gt;), but the number of bits required grows rapidly with the number of qubits. Consequently, without reliable quantum computers quantum algorithms are of theoretical interest only.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2018-04-01T10:11:08.240" LastActivityDate="2018-04-01T10:11:08.240" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="117" PostTypeId="1" AcceptedAnswerId="119" CreationDate="2018-03-14T21:54:25.037" Score="20" ViewCount="2328" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;This is a follow-up question to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/110/26&quot;&gt;@heather's answer&lt;/a&gt; to the question : &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/105/why-must-quantum-computers-be-kept-near-absolute-zero&quot;&gt;Why must quantum computers be kept near absolute zero?&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I know:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Superconducting quantum computing&lt;/strong&gt;: It is an implementation of a quantum computer in a superconducting electronic circuit. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optical quantum computing&lt;/strong&gt;: It uses photons as information carriers, and linear optical elements to process quantum information, and uses photon detectors and quantum memories to detect and store quantum information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Superconducting_quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;Next, this is what Wikipedia goes on to say about superconducting quantum computing&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Classical computation models rely on physical implementations&#xA;  consistent with the laws of classical mechanics. It is known, however,&#xA;  that the classical description is only accurate for specific cases,&#xA;  while the more general description of nature is given by the quantum&#xA;  mechanics. Quantum computation studies the application of quantum&#xA;  phenomena, that are beyond the scope of classical approximation, for&#xA;  information processing and communication. Various models of quantum&#xA;  computation exist, however the most popular models incorporate the&#xA;  concepts of qubits and quantum gates. A qubit is a generalization of a&#xA;  bit - a system with two possible states, that can be in a quantum&#xA;  superposition of both. A quantum gate is a generalization of a logic&#xA;  gate: it describes the transformation that one or more qubits will&#xA;  experience after the gate is applied on them, given their initial&#xA;  state. The physical implementation of qubits and gates is difficult,&#xA;  for the same reasons that quantum phenomena are hard to observe in&#xA;  everyday life. &lt;strong&gt;One approach is to implement the quantum computers in&#xA;  superconductors, where the quantum effects become macroscopic, though&#xA;  at a price of extremely low operation temperatures.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This does make some sense! However, I was looking for why optical quantum computers don't need &quot;extremely low temperatures&quot; unlike superconducting quantum computers. Don't they suffer from the same problem i.e. aren't the quantum phenomena in optical quantum computers &lt;em&gt;difficult to observe&lt;/em&gt; just as for superconducting quantum computers? Are the quantum effects already macroscopic at room temperatures, in such computers? Why so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was going through the &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_optical_quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;description of Linear optical quantum computing on Wikipedia&lt;/a&gt;, but found no reference to &quot;temperature&quot; as such. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-06-21T17:18:16.233" Title="Why do optical quantum computers not have to be kept near absolute zero while superconducting quantum computers do?" Tags="&lt;physical-realization&gt;&lt;optical-quantum-computing&gt;&lt;architecture&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="118" PostTypeId="2" ParentId="117" CreationDate="2018-03-14T22:11:22.460" Score="7" Body="&lt;p&gt;Because light, at the right frequencies, interacts weakly with matter.&#xA;In the quantum regime, this translates to single photons being largely free of the noise and decoherence that is the main obstacle with other QC architectures.&#xA;The surrounding temperature doesn't disturb the quantum state of a photon as much as it does when the quantum information is carried by matter (atoms, ions, electrons, superconducting circuits etc.).&#xA;For example, reliable transmission of photonic qubits (more precisely, a QKD protocol) between China and Austria, using a low-orbit satellite as link, was recently demonstrated (see e.g. &lt;a href=&quot;https://physics.aps.org/articles/v11/7&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, light also interacts &lt;em&gt;extremely&lt;/em&gt; weakly (as in, it basically doesn't) with other light.&#xA;Different photons not interacting with each other is what makes optical quantum computation somewhat tricky.&#xA;For example, basic elements like two-qubit gates, when the qubits are carried by different photons, require some form of nonlinearity, which is generally harder to implement experimentally.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-11-19T15:40:29.333" LastActivityDate="2018-11-19T15:40:29.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="119" PostTypeId="2" ParentId="117" CreationDate="2018-03-14T22:42:21.837" Score="30" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I was looking for why optical quantum computers don't need &quot;extremely low temperatures&quot; unlike superconducting quantum computers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Superconducting qubits usually work in the frequency range 4 GHz to 10 GHz.&#xA;The energy associated with a transition frequency &lt;span class=&quot;math-container&quot;&gt;$f_{10}$&lt;/span&gt; in quantum mechanics is &lt;span class=&quot;math-container&quot;&gt;$E_{10} = h f_{10}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is Planck's constant.&#xA;Comparing the qubit transition energy to the thermal energy &lt;span class=&quot;math-container&quot;&gt;$E_\text{thermal} = k_b T$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$k_b$&lt;/span&gt; is Boltzmann's constant), we see that the qubit energy is above the thermal energy when&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f_{10} &amp;gt; k_b T / h \, .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking up Boltzmann's and Planck's constants, we find&#xA;&lt;span class=&quot;math-container&quot;&gt;$$h/k_b = 0.048 \, \text{K / GHz} \, .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f_{10} &amp;gt; 1 \, \text{GHz} \, \,\frac{T}{0.048 \, \text{K}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for the highest frequency superconducting qubit at 10 GHz, we need &lt;span class=&quot;math-container&quot;&gt;$T &amp;lt; 0.48 \, \text{K}$&lt;/span&gt; in order for there to be a low probability that the qubit is randomly excited or de-excited due to thermal interactions.&#xA;This is why superconducting qubits are usually operated in dilution refrigerators at ~15 milliKelvin.&#xA;Of course, we also need the temperature to be low enough to get the metals superconducting, but for aluminum that happens at 1 K so actually the constraint we already talked about is more important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, suppose the two states of the optical qubit &lt;span class=&quot;math-container&quot;&gt;$\left \lvert 0 \right \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left \lvert 1 \right \rangle$&lt;/span&gt; the presence and absence of an optical photon.&#xA;An optical photon has a frequency of around &lt;span class=&quot;math-container&quot;&gt;$10^{14}$&lt;/span&gt; Hz, which corresponds to a temperature of 14,309 Kelvin.&#xA;Therefore, there's an extremely low probability of the thermal environment changing the qubit state by creating or removing a photon.&#xA;This is why optical light is sort of intrinsically quantum mechanical in nature.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Don't they suffer from the same problem i.e. aren't the quantum phenomena in optical quantum computers difficult to observe just as for superconducting quantum computers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, the difficulties between superconducting quantum computers and optical quantum computers are &lt;em&gt;different&lt;/em&gt;.&#xA;Optical photons essentially don't interact with each other.&#xA;To get an effective interaction between two photons, you have to either put them through a nonlinear crystal, or do some kind of photodetection measurement.&#xA;The challenge with nonlinear crystals is that they're very inefficient; only a very small fraction of photons that go in actually undergo the nonlinear process that causes interaction.&#xA;The challenge with photodetection is that it's hard to build a photodetector that has high detection efficiency and low dark counts&lt;span class=&quot;math-container&quot;&gt;$^{[a]}$&lt;/span&gt;.&#xA;In fact, the best photo-detectors actually need to be operated in cryogenic environments anyway, so some optical quantum computing architectures need cryogenic refrigeration despite the fact that the qubits themselves have very high frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. This answer could be expanded quite a bit. If someone has a particular aspect they'd like to know more about, please leave a comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[a]$&lt;/span&gt;: Dark counts means the times a photodetector thinks it saw a photon even though there really wasn't one. In other words, isn't the rate that the detector counts photons when its in the dark.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="32" LastEditDate="2019-06-21T17:18:16.233" LastActivityDate="2019-06-21T17:18:16.233" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="120" PostTypeId="1" CreationDate="2018-03-14T23:47:44.023" Score="5" ViewCount="88" Body="&lt;p&gt;I work as a theorist with my current research interests in &quot;quantum contextuality&quot;. For those perusing the question, this is essentially a generalization of non-locality where we can show a quantum system does not admit a hidden-variable model. So in some sense, it's impossible to look at the problem classically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further background, contextuality can often be formulated as a resource for quantum computation-- which is the reason why we're interested in it. Our talking points to people are that contextuality is the right way of characterizing what's essentially quantum about a system (many would debate us on that, but that's perhaps for another thread). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I've found so far is a proposed experiment for testing contextuality:&#xA;&lt;a href=&quot;https://arxiv.org/pdf/1512.05370.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cabello-2016-Experiment&lt;/a&gt; and a description of the implications of a successful contextuality experiment:&#xA;&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1751-8113/47/42/424031/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Winter-2014-Implications&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most experimentalists tend to focus on entanglement (understandably; it's a lot easier to measure and more concrete to think about) - but are there any experimental groups currently working on contextuality experiments? &lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="26" LastEditDate="2019-02-01T22:25:48.983" LastActivityDate="2019-06-16T05:43:19.287" Title="Are there any experimental groups currently measuring quantum contextuality?" Tags="&lt;measurement&gt;&lt;research&gt;&lt;non-locality&gt;&lt;contextuality&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="121" PostTypeId="1" AcceptedAnswerId="123" CreationDate="2018-03-15T00:02:12.367" Score="22" ViewCount="1623" Body="&lt;p&gt;This is a question I was inspired to ask based on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/74/what-are-the-methods-of-quantum-computation&quot;&gt;this question&lt;/a&gt;, which notes that quantum annealing is an entirely different model for computation than the usual circuit model. I've heard this before, and it's my understanding that the gate-model does not apply to quantum-annealing, but I've never quite understood why that is, or how to parse the computations that an annealer can do. As I understand from several talks (some by D-wave themselves!) the fact that the annealers are confined to a specific Hamiltonian plays into it. &lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="26" LastEditDate="2018-12-23T11:43:19.200" LastActivityDate="2018-12-23T11:43:19.200" Title="Why can't quantum annealing be described by a gate model?" Tags="&lt;d-wave&gt;&lt;models&gt;&lt;annealing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="122" PostTypeId="2" ParentId="121" CreationDate="2018-03-15T00:18:52.247" Score="16" Body="&lt;p&gt;Annealing's more of an analog tactic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gist is that you have some weird function that you want to optimize.  So, you bounce around it.  At first, the &quot;&lt;em&gt;temperature&lt;/em&gt;&quot; is very high, such that the selected point can bounce around a lot.  Then as the algorithm &quot;&lt;em&gt;cools&lt;/em&gt;&quot;, the temperature goes down, and the bouncing becomes less aggressive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, it settles down to a local optima which, ideally, is favorably like the global optima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an animation for &lt;a href=&quot;https://en.wikipedia.org/wiki/Simulated_annealing&quot; rel=&quot;noreferrer&quot;&gt;simulated annealing&lt;/a&gt; (non-quantum):&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/File:Hill_Climbing_with_Simulated_Annealing.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/d/d5/Hill_Climbing_with_Simulated_Annealing.gif&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, it's pretty much the same concept for &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;quantum annealing&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/File:Quant-annl.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/1/12/Quant-annl.jpg&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By contrast, gate-logic is far more digital than analog.  It's concerned with qubits and logical operations rather than merely finding a result after chaotic bouncing-around.&lt;/p&gt;&#xA;" OwnerUserId="15" LastEditorUserId="15" LastEditDate="2018-03-15T00:24:34.193" LastActivityDate="2018-03-15T00:24:34.193" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="123" PostTypeId="2" ParentId="121" CreationDate="2018-03-15T01:10:23.243" Score="18" Body="&lt;p&gt;A Quantum Annealer, such as a D-Wave machine is a physical representation of the Ising model and as such has a 'problem' Hamiltonian of the form $$H_P = \sum_{J=1}^nh_j\sigma_j^z + \sum_{i, j}J_{ij}\sigma_i^z\sigma_j^z.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, the problem to be solved is mapped to the above Hamiltonian. The system starts with the Hamiltonian $H_I = \sum_{J=1}^nh'_j\sigma_j^x$ and the annealing parameter, $s$ is used to map the initial Hamiltonian $H_I$ to the problem Hamiltonian $H_P$ using $H\left(s\right) = \left(1-s\right)H_I + sH_P$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this is an anneal, the process is done slowly enough to stay near the ground state of the system while the Hamiltonian is varied to that of the problem, using tunnelling to stay near the ground state as described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/122/23&quot;&gt;Nat's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, why can't this be used to describe a gate model QC? The above is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimization&quot; rel=&quot;noreferrer&quot;&gt;Quadratic unconstrained binary optimization (QUBO)&lt;/a&gt; problem, which is NP-hard... Indeed, &lt;a href=&quot;https://www.frontiersin.org/articles/10.3389/fphy.2014.00005/full&quot; rel=&quot;noreferrer&quot;&gt;here's an article mapping a number of NP problems to the Ising model&lt;/a&gt;. Any problem in NP can be mapped to any NP-hard problem in polynomial time and integer factorisation is indeed an NP problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, the temperature is non-zero, so it's not going to be in the ground state throughout the anneal and as a result, the solution is still only an approximate one. Or, in different terms, the probability of failure is greater than a half (it's nowhere near having a decent probability of success compared with what a universal QC considers 'decent' - judging from graphs I've seen, the probability of success for the current machine is around $0.2\%$ and this will only get worse with increasing size), and the anneal algorithm is not bounded error. At all. As such, there's no way of knowing whether or not you've got the correct solution with something such as integer factorisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it (in principle) does is get very close to the exact result, very quickly, but this doesn't help for anything where the exact result is required as going from 'nearly correct' to 'correct' is still an extremely difficult (i.e. presumably still NP in general, when the original problem is in NP) problem in this case, as the parameters that are/give a 'nearly correct' solution aren't necessarily going to be distributed anywhere near the parameters that are/give the correct solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit for clarification: what this means is that a quantum annealer (QA) still takes exponential time (albeit potentially a faster exponential time) to solve NP problems such as integer factorisation, where a universal QC gives an exponential speed up and can solve the same problem in poly time. This is what implies a QA cannot simulate a universal QC in poly time (otherwise it could solve problems in poly time that it can't). As pointed out in the comments, this is &lt;em&gt;not&lt;/em&gt; the same as saying that a QA cannot give the same speedup in other problems, such as database search.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-15T13:43:28.800" LastActivityDate="2018-03-15T13:43:28.800" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="124" PostTypeId="2" ParentId="91" CreationDate="2018-03-15T02:20:46.153" Score="14" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;This leads me to conclude that there is some difference/reason why bra-ket is especially handy for denoting quantum algorithms.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's already an accepted answer and an answer that explains 'ket', 'bra' and the scalar product notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll try add a bit more to the highlighted entry. What makes it a useful/handy notation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing that bra-ket notation is really used a lot for is to denote very simply the eigenvectors of a (usually Hermitian) operator associated with an eigenvalue. Suppose we have an eigenvalue equation $A(v)=\lambda v$, this can be denoted as $A\left|\lambda\right\rangle=\lambda \left|\lambda\right\rangle$, and probably some extra label $k$ if there is some degeneracy $A\left|\lambda,k\right\rangle=\lambda \left|\lambda,k\right\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see this employed all over quantum mechanics, momentum eigenstates tend to be labelled as $\left|\vec{k}\right\rangle$ or $\left|\vec{p}\right\rangle$ depending on units, or with multiple particle states $\left|\vec{p}_1,\vec{p}_2,\vec{p}_3\ldots\right\rangle$; occupation number representation for bose and fermi system many body systems $\left|n_1,n_2,\ldots\right\rangle$; a spin half particle taking the eigenstates usually of the $S_z$ operator, written sometimes as $\left|+\right\rangle$ and $\left|-\right\rangle$ or $\left|\uparrow\,\right\rangle$ and $\left|\downarrow\,\right\rangle$, etc as shorthand for $\left|\pm \hbar/2\right\rangle$; spherical harmonics as eigenfunctions of the $L^2$ and $L_z$ functions are conveniently written as $\left|l,m\right\rangle$ with $l=0,1,2,\ldots$ and $m=-l,-l+1,\ldots,l-1,l.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So convenience of notation is one thing, but there's also a kind of 'lego' feeling to algebraic manipulations with dirac notation, take for instance the $S_x$ spin half operator in dirac notation as &#xA;$S_x=\frac{\hbar}{2}(\left|\uparrow\right\rangle\left\langle\downarrow\right|+\left|\downarrow\right\rangle\left\langle\uparrow\right|)$, acting on a state like $\left|\uparrow\right\rangle$ one simply does&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$S_x\left|\uparrow\right\rangle=\frac{\hbar}{2}\left(\left|\uparrow\rangle\langle\downarrow\right|+\left|\downarrow\rangle\langle\uparrow\right|\right)\left|\uparrow\right\rangle=\frac{\hbar}{2}\left|\uparrow\rangle\langle\downarrow\mid\uparrow\right\rangle+\frac{\hbar}{2}\left|\downarrow\rangle\langle\uparrow\mid\uparrow\right\rangle=\frac{\hbar}{2}\left|\downarrow\right\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;since $\left\langle\uparrow\mid\uparrow\right\rangle=1$ and $\left\langle\downarrow\mid\uparrow\right\rangle=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What makes it handy for quantum algorithms?&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we have a suitable two level system for a qubit; this forms a two dimensional complex vector space $V$ say whose basis is denoted as $\left|0\right\rangle$ and $\left|1\right\rangle$. When we consider say $n$ qubits of this form, the states of the system live in a bigger space the tensor product space, $V^{\otimes n}$. Dirac notation can be rather handy here, the basis states will be labelled by strings of ones and zeros and one usually denotes a state e.g. $\left|1\right\rangle\otimes\left|0\right\rangle\otimes\left|0\right\rangle\otimes\left|1\right\rangle\equiv\left|1001\right\rangle$, and say we have a bit flip operator $X_i$ which interchanges $1\leftrightarrow 0$ on the $i$'th bit, this can act rather simply on the above strings e.g. $X_3\left|1001\right\rangle=\left|1011\right\rangle$, and taking a sum of operators or acting on a superposition of states works just as simply.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Slight caution:&lt;/em&gt; a state written as $\left|a,b\right\rangle$ doesn't always mean $\left|a\right\rangle\otimes\left|b\right\rangle$, for instance when you have two identical fermions with wave functions say $\phi_{k_1}(\vec{r}_1)$ and $\phi_{k_2}(\vec{r}_2)$, with labels indexing some basis set, then one might write the slater determinant state of the fermions $$\frac{1}{\sqrt{2}}\left(\phi_{k_1}(\vec{r}_1)\phi_{k_2}(\vec{r}_2)-\phi_{k_1}(\vec{r}_2)\phi_{k_2}(\vec{r}_1)\right)$$ in a shorthand as $\left|\phi_{k_1},\phi_{k_2}\right\rangle$ or even $\left|k_1,k_2\right\rangle\neq \left|k_1\right\rangle\otimes \left|k_2\right\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="197" LastEditorUserId="23" LastEditDate="2018-03-15T11:09:31.183" LastActivityDate="2018-03-15T11:09:31.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="125" PostTypeId="2" ParentId="91" CreationDate="2018-03-15T02:21:16.520" Score="15" Body="&lt;p&gt;The &lt;strong&gt;ket&lt;/strong&gt; notation $|\psi\rangle$ means a &lt;strong&gt;vector&lt;/strong&gt; in whatever vector space we're working in, such as the space of all complex linear combinations of the eight 3-bit strings $000$, $001$, $010$, &lt;em&gt;etc.&lt;/em&gt;, as we might use to represent the states of a quantum computer.  Unadorned $\psi$ means exactly the same thing—the $|\psi\rangle$ ket notation is useful partly to emphasize that, for example, $|010\rangle$ is an element of the vector space of interest, and partly for its cuteness in combination with the &lt;em&gt;bra&lt;/em&gt; notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;bra&lt;/strong&gt; notation $\langle\psi|$ means the &lt;strong&gt;dual vector&lt;/strong&gt; or &lt;strong&gt;covector&lt;/strong&gt;—a &lt;strong&gt;linear functional&lt;/strong&gt;, or linear map from vectors to scalars, whose value at a vector $|\phi\rangle$ is the &lt;strong&gt;inner product&lt;/strong&gt; of $\psi$ with $\phi$, cutely written $\langle\psi|\phi\rangle$.  Here we assume the existence of an inner product, which is not a given in arbitrary vector spaces, but in quantum physics we usually work in &lt;strong&gt;Hilbert spaces&lt;/strong&gt; which by definition have an inner product.  The dual of a vector is sometimes also called its &lt;strong&gt;(Hermitian) transpose&lt;/strong&gt;, because in matrix representation, a vector corresponds to a column and a covector corresponds to a row, and when you multiply $\mathrm{row} \times \mathrm{column}$ you get a scalar.  (The Hermitian part means in addition to transposing the matrix, we take the complex conjugate of its entries—which is really just further transposing the matrix representation $\scriptstyle\begin{bmatrix}a&amp;amp;b\\-b&amp;amp;a\end{bmatrix}$ of the complex number $a + b i$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When written the other way, $|\psi\rangle\langle\phi|$, you get the &lt;strong&gt;outer product&lt;/strong&gt; of $\psi$ with $\phi$, defined to be the linear transformation of the vector space to itself given by $|\theta\rangle \mapsto (\langle\phi|\theta\rangle) |\psi\rangle$.  That is, given a vector $\theta$, it scales the vector $\psi$ by the scalar given by the inner product $\langle\phi|\theta\rangle$.  Since the operations in question are associative, we can remove the parentheses and unambiguously write $$(|\psi\rangle\langle\phi|)|\theta\rangle = |\psi\rangle\langle\phi|\theta\rangle = \langle\phi|\theta\rangle|\psi\rangle = (\langle\phi|\theta\rangle)|\psi\rangle.$$  The operations involved are &lt;em&gt;not&lt;/em&gt; commutative in general, however: reversing the order yields the complex conjugate$\langle\psi|\phi\rangle = \langle\phi|\psi\rangle^*$, replacing $a + b i$ by $a - b i$.  There may be other transformations of the spaces involved thrown in the mix too, like $\langle\psi|A|\phi\rangle$, which can be read equivalently as the precomposition of the linear functional $\langle\psi|$ by the linear transformation $A$, applied to the vector $|\phi\rangle$, or as the evaluation of the linear functional $\langle\psi|$ at the vector obtained by transforming $|\phi\rangle$ by the linear transformation $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notation is used mainly in quantum physics; mathematicians tend to just write $\psi$ where physicists might write $|\psi\rangle$; $\psi^*$ for the covector $\langle\psi|$; either $\langle\psi,\phi\rangle$ or $\psi^*\phi$ for the inner product; and $\psi^*A\phi$ for what physicists would notate by $\langle\psi|A|\phi\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="238" LastActivityDate="2018-03-15T02:21:16.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="126" PostTypeId="1" CreationDate="2018-03-15T06:17:50.517" Score="18" ViewCount="283" Body="&lt;p&gt;My understanding is that there seems to be some confidence that quantum annealing will provide a speedup for problems like the traveling salesman, due to the efficiency provided by, ex, quantum tunneling. Do we know, however, around how much of a speedup is provided?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2018-03-15T14:02:45.297" LastActivityDate="2018-03-15T14:02:45.297" Title="Level of advantage provided by annealing for traveling salesman" Tags="&lt;annealing&gt;&lt;speedup&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="127" PostTypeId="5" CreationDate="2018-03-15T07:35:18.557" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T07:35:18.557" LastActivityDate="2018-03-15T07:35:18.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="128" PostTypeId="4" CreationDate="2018-03-15T07:35:18.557" Score="0" Body="For questions related to building of quantum computers and discussion of the hardware aspects." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:47:23.603" LastActivityDate="2019-01-01T08:47:23.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="129" PostTypeId="2" ParentId="126" CreationDate="2018-03-15T10:23:16.513" Score="15" Body="&lt;p&gt;First, let me note that quantum annealing, or more precisely the adiabatic quantum computation model is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405098&quot; rel=&quot;noreferrer&quot;&gt;polynomially equivalent to the conventional gate-based quantum computation model&lt;/a&gt;. Second, the general &lt;a href=&quot;https://en.wikipedia.org/wiki/Travelling_salesman_problem&quot; rel=&quot;noreferrer&quot;&gt;traveling salesman problem is NP complete&lt;/a&gt;. Third, it is generally believed that the with gate-based quantum computation one &lt;a href=&quot;http://www.cs.virginia.edu/~robins/The_Limits_of_Quantum_Computers.pdf&quot; rel=&quot;noreferrer&quot;&gt;cannot solve in polinomial time NP complete problems&lt;/a&gt;.&#xA;All this means that it is regarded highly unlikely that with quantum annealing one could solve in polynomial time the general traveling salesman problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Despite that it is believed that the general problem can be only solved in exponential time also with quantum annealing, there could still be some speed up, for instance, a polynomial speed-up. Not too much is known about this for the general case. However, there is a very nice recent work that shows that &lt;a href=&quot;https://arxiv.org/abs/1612.06203&quot; rel=&quot;noreferrer&quot;&gt;there are bounded-error quantum algorithms which provide a quadratic quantum speedup&lt;/a&gt; when the degree of each vertex (in the travailing salesman problem) is at most 3.&lt;/p&gt;&#xA;" OwnerUserId="86" LastEditorUserId="86" LastEditDate="2018-03-15T10:44:15.777" LastActivityDate="2018-03-15T10:44:15.777" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="130" PostTypeId="2" ParentId="64" CreationDate="2018-03-15T10:49:05.593" Score="2" Body="&lt;p&gt;The website where you could access this 11-qubit quantum computer via a cloud service is not public yet. When it becomes public, the, of course, it will be posted here.&lt;/p&gt;&#xA;" OwnerUserId="86" LastEditorUserId="86" LastEditDate="2018-03-15T10:55:22.270" LastActivityDate="2018-03-15T10:55:22.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="131" PostTypeId="1" AcceptedAnswerId="132" CreationDate="2018-03-15T10:58:34.123" Score="16" ViewCount="1615" Body="&lt;p&gt;Quantum gates are said to be unitary and reversible. However, classical gates can be irreversible, like the logical AND and logical OR gates. Then, how is it possible to model irreversible classical AND and OR gates using quantum gates?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-15T15:06:33.667" LastActivityDate="2018-03-15T15:06:33.667" Title="If quantum gates are reversible how can they possibly perform irreversible classical AND and OR operations?" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="132" PostTypeId="2" ParentId="131" CreationDate="2018-03-15T10:58:34.123" Score="17" Body="&lt;p&gt;Let's say we have a function $f$ which maps $n$ bits to $m$ bits (where $m&amp;lt;n$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$f: \{0,1\}^{n} \to \{0,1\}^{m}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could of course design a classical circuit to perform this operation. Let's call it $C_f$. It takes in as input $n$-bits. Let's say it takes as input $X$ and it outputs $f(X)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we would like to do the same thing using a quantum circuit. Let's call it $U_f$, which takes as input $|X\rangle$ and outputs $|f(X)\rangle$. Now remember that since quantum mechanics is linear the input qubits could of course be in a superposition of all the $n$-bit strings. So the input could be in some state $\sum_{X\in\{0,1\}^{n}}\alpha_X|X\rangle$. By linearity the output is going to be $\sum_{X\in\{0,1\}^{n}}\alpha_X|f(X)\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evolution in quantum mechanics is &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitarity_(physics)&quot; rel=&quot;noreferrer&quot;&gt;unitary&lt;/a&gt;. And because it is unitary, it is reversible. This essentially means that if you apply a quantum gate $U$ on an input state $|x\rangle$ and get an ouput state $U|x\rangle$, you can always apply an inverse gate $U^{\dagger}$ to get back to the state $|x\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hSnaX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hSnaX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice, carefully in the above picture that the number of input lines (i.e. six) is exactly same as the number of output lines at each step. This is because of the unitarity of the operations. Compare this to classical operations like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Logical_conjunction&quot; rel=&quot;noreferrer&quot;&gt;logical AND&lt;/a&gt; where $0\wedge1$ gives a single bit output $0$. You can't reconstruct the initial bits $0$ and $1$ from the output, since even $0\wedge 0$ and $1\wedge0$ would have mapped to the same output $0$. But, consider the classical NOT gate. If the input is $0$ it ouputs $1$, while if the input is $1$ it outputs $0$. Since this mapping is one-one, it can be easily implemented as a reversible unitary gate,  namely, &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_gate#Pauli-X_gate_(=_NOT_gate)&quot; rel=&quot;noreferrer&quot;&gt;the Pauli-X gate&lt;/a&gt;. However, for implementing a classical AND or a classical OR gate we need to think a bit more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fredkin_gate&quot; rel=&quot;noreferrer&quot;&gt;CSWAP gate&lt;/a&gt;. Here's a rough diagram showing the scheme:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4t7ko.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4t7ko.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the SWAP gate depending on the control bit, we the other two may or may not get swapped. Notice that there are three input lines and three output lines. So, it can be modeled as a unitary quantum gate. Now, if $z=0$: If $x=0$, output  is $0$, while if $x=1$, output is $y$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CJNuJ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CJNuJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you notice, if $x=0$, we are outputting $\bar{x}\wedge y$ while if $x=1$ we are outputting $x\wedge y$. So we could successfully generate the output $x\wedge y$ which we wanted although we ended up with some &quot;junk&quot; outputs $\bar{x}\wedge y$ and $x$. An interesting fact is that the inverse of the CSWAP gate is the CSWAP gate itself (check!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's all! Remember that all classical gates can be constructed with the &lt;a href=&quot;https://en.wikipedia.org/wiki/NAND_gate&quot; rel=&quot;noreferrer&quot;&gt;NAND gate&lt;/a&gt;, which can of course be constructed an AND and a NOT gate. We effectively modelled the classical NOT and the classical AND gate using reversible quantum gates. Just to be on the safe side we can also add the qauntum &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate&quot; rel=&quot;noreferrer&quot;&gt;CNOT gate&lt;/a&gt; to our list, because using CNOT we can copy bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the basic message is that using the quantum CSWAP, CNOT and the NOT gates we can replicate &lt;em&gt;any&lt;/em&gt; classical gate. BTW, there's a clever trick to get rid of the &quot;junk&quot; bits which are produced when quantum gates are used, but that's another story. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: It's very important to get rid of the &quot;junk&quot; bits or else they can cause computational errors!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Reference &amp;amp; Image Credits: &lt;a href=&quot;https://www.edx.org/course/quantum-mechanics-quantum-computation-uc-berkeleyx-cs-191x&quot; rel=&quot;noreferrer&quot;&gt;Quantum Mechanics and Quantum Computation MOOC&lt;/a&gt; offered by UC Berkeley on edX.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-15T10:58:34.123" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="133" PostTypeId="1" AcceptedAnswerId="134" CreationDate="2018-03-15T13:27:54.457" Score="16" ViewCount="323" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum annealing&lt;/a&gt; is an optimization protocol that, thanks to quantum tunneling, allows in given circumstances to maximize/minimize a given function more efficiently than classical optimization algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A crucial point of quantum annealing is the adiabaticity of the algorithm, which is required for the state to stay in the ground state of the time-dependent Hamiltonian.&#xA;This is however also a problem, as it means that find a solution can require very long times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How long do these times have to be for a given Hamiltonian?&#xA;More precisely, given a problem Hamiltonian $\mathcal H$ of which we want to find the ground state, are there results saying how long would it take a quantum annealer to reach the solution?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-04-02T19:20:48.823" LastActivityDate="2018-04-02T19:20:48.823" Title="How long does quantum annealing take to find the solution to a given problem?" Tags="&lt;speedup&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="134" PostTypeId="2" ParentId="133" CreationDate="2018-03-15T13:38:01.490" Score="14" Body="&lt;p&gt;The time to solution (tts) is highly dependent on the Hamiltonian of the problem one would like to solve. The D-Wave uses a spin-glass-like Hamiltonian which can be in the NP-Complete complexity class. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to having to run the annealing process multiple times, tts measures are typically quantified by how long it takes to find the ground state some percent of the time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1711.01368&quot; rel=&quot;noreferrer&quot;&gt;Here's a paper&lt;/a&gt; by some colleagues that explains tts (see especially equation 3). &lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="91" LastEditDate="2018-03-15T14:46:23.343" LastActivityDate="2018-03-15T14:46:23.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="135" PostTypeId="1" AcceptedAnswerId="1218" CreationDate="2018-03-15T13:58:19.720" Score="30" ViewCount="1097" Body="&lt;p&gt;It is generally believed and claimed that quantum computers can outperform classical devices in at least some tasks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the most commonly cited examples of a problem in which quantum computers would outperform classical devices is $\text{Factoring}$, but then again, it is also not known whether $\text{Factoring}$ is also efficiently solvable with a classical computer (that is, whether $\text{Factoring}\in \text{P}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other commonly cited problems in which quantum computers are known to provide an advantage, such as database search, the speedup is only polynomial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there known instances of problems in which it can be shown (either proved or proved under strong computational complexity assumptions) that quantum computers would provide an exponential advantage?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2019-05-15T13:58:01.587" LastActivityDate="2019-05-15T13:58:01.587" Title="Are there problems in which quantum computers are known to provide an exponential advantage?" Tags="&lt;complexity-theory&gt;&lt;speedup&gt;&lt;quantum-advantage&gt;" AnswerCount="4" CommentCount="7" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="136" PostTypeId="1" CreationDate="2018-03-15T15:02:47.357" Score="28" ViewCount="3177" Body="&lt;p&gt;All quantum operations must be unitary to allow reversibility, but what about measurement? Measurement can be represented as a matrix, and that matrix is applied to qubits, so that seems equivalent to the operation of a quantum gate. That's definitively not reversible. Are there any situations where non-unitary gates might be allowed?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-01-01T09:02:39.300" LastActivityDate="2019-05-15T14:06:22.627" Title="If all quantum gates must be unitary, what about measurement?" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;&lt;unitarity&gt;&lt;quantum-operation&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="137" PostTypeId="1" AcceptedAnswerId="139" CreationDate="2018-03-15T15:12:04.687" Score="11" ViewCount="261" Body="&lt;p&gt;Are there any encryption suites that can be cracked by usual computers or super computers, but not quantum computers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's possible, what assumptions will it depend on? (Factorizing big numbers, $a^b\pmod d$ $a^c\pmod d$ $a^{bc}\pmod d$ etc...)&lt;/p&gt;&#xA;" OwnerUserId="248" LastEditorUserId="253" LastEditDate="2018-04-02T08:23:41.800" LastActivityDate="2018-04-02T08:23:41.800" Title="Are there any encryption suites which can be cracked by classical computers but not quantum computers?" Tags="&lt;speedup&gt;&lt;complexity-theory&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="138" PostTypeId="2" ParentId="135" CreationDate="2018-03-15T16:21:44.340" Score="12" Body="&lt;p&gt;Not sure if this is strictly what you're looking for; and I don't know that I'd qualify this as &quot;exponential&quot; (I'm also not a computer scientist so my ability to do algorithm analysis is more or less nonexistent...), but a recent result by Bravyi et. al presented a class of '2D Hidden Linear Function problems' that provably use fewer resources on a quantum parallel device. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper is on the arxiv &lt;a href=&quot;https://arxiv.org/abs/1704.00690&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, but here's a quick summary. The quantum advantage is in the depth of the parallel circuit, so the number of threads one can split the problem into under bounded fan-in. The problem is given a $N\times N$ matrix $A$ and an input vector $b$, one can define a quadratic form $q$ and a special subspace for that form. The &quot;hidden linear function problem&quot;'s goal is to find a linearization for that quadratic function on a special subspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A classical probablistic circuit is constrained to ~$\log{N}$ depth, if you want your computation to succeed with probability $&amp;gt;7/8$ (you probably want it to succeed with at least this probability). A quantum circuit can do it with constant depth, so that's a big improvement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof essentially amounts to a specific graph state being difficult for a classical circuit to simulate, this sub-result was &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0603032&quot; rel=&quot;noreferrer&quot;&gt;proven slightly earlier&lt;/a&gt;. Then the rest of the paper shows that the greater class of problems contains this difficult problem. &lt;/p&gt;&#xA;" OwnerUserId="236" LastActivityDate="2018-03-15T16:21:44.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="139" PostTypeId="2" ParentId="137" CreationDate="2018-03-15T16:41:03.480" Score="13" Body="&lt;p&gt;This is not a very enlightening concept, because most interesting quantum algorithms, such as Shor's algorithm, involve some classical computations as well.  While &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/25/238&quot; title=&quot;jknappen, Answer to ‘Can a quantum computer simulate a normal computer?’, quantumcomputing.stackexchange.com, 2018-03-13.&quot;&gt;you can always shoehorn a classical computation into a quantum computer&lt;/a&gt;, it would be at unnecessarily exorbitant cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't yet know, of course, exactly what problems will be hard to solve even if given a quantum computer—the &lt;a href=&quot;https://nist.gov/pqcrypto&quot; rel=&quot;noreferrer&quot; title=&quot;United States National Institute of Standards and Technology: Post-Quantum Cryptography.&quot;&gt;NIST PQCRYPTO&lt;/a&gt; competition is in progress right now to study that question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, even then, it likely won't be &lt;em&gt;answered definitively&lt;/em&gt; any more than we can answer definitively what cryptography we can't break with classical computers: nobody has found a realistically efficient classical algorithm for factoring a product $n$ of uniform random 1024-bit primes whose totient $\phi(n)$ is coprime with 3, nor has anyone found a realistically efficient classical algorithm for computing cube roots modulo $n$, nor has anyone even ascertained whether factoring is harder than computing cube roots (though certainly it's not &lt;em&gt;easier&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At best, we can say that a lot of smart people have been well-funded to think very hard about it, and we can choose parameter sizes that thwart the best attacks they have come up with.  The outcome of the NIST PQCRYPTO competition will be the same, with any luck—unless someone clever thinks of ways to break every single one of the dozens of candidates.&lt;/p&gt;&#xA;" OwnerUserId="238" LastActivityDate="2018-03-15T16:41:03.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="140" PostTypeId="2" ParentId="136" CreationDate="2018-03-15T17:26:49.327" Score="14" Body="&lt;h2&gt;Short Answer&lt;/h2&gt;&#xA;&lt;p&gt;Quantum operations &lt;em&gt;do not&lt;/em&gt; need to be unitary.&#xA;In fact, many quantum algorithms and protocols make use of non-unitarity.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Long Answer&lt;/h2&gt;&#xA;&lt;p&gt;Measurements are arguably the most obvious example of non-unitary transitions being a fundamental component of algorithms (in the sense that a &amp;quot;measurement&amp;quot; is equivalent to sampling from the probability distribution obtained after the decoherence operation &lt;span class=&quot;math-container&quot;&gt;$\sum_k c_k\lvert k\rangle\mapsto\sum_k |c_k|^2\lvert k\rangle\langle k\rvert$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;More generally, any quantum algorithm that involves probabilistic steps requires non-unitary operations. A notable example that comes to mind is HHL09's algorithm to solve linear systems of equations (see &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;0811.3171&lt;/a&gt;).&#xA;A crucial step in this algorithm is the mapping &lt;span class=&quot;math-container&quot;&gt;$|\lambda_j\rangle\mapsto C\lambda_j^{-1}|\lambda_j\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\lambda_j\rangle$&lt;/span&gt; are eigenvectors of some operator. This mapping is necessarily probabilistic and therefore non-unitary.&lt;/p&gt;&#xA;&lt;p&gt;Any algorithm or protocol that makes use of (classical) feed-forward is also making use of non-unitary operations. This is the whole of &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;one-way quantum computation&lt;/a&gt; protocols (which, as the name suggests, require non-reversible operations).&lt;/p&gt;&#xA;&lt;p&gt;The most notable schemes for optical quantum computation with single photons also require measurements and sometimes post-selection to entangle the states of different photons.&#xA;For example, the &lt;a href=&quot;https://en.wikipedia.org/wiki/KLM_protocol&quot; rel=&quot;noreferrer&quot;&gt;KLM protocol&lt;/a&gt; produces probabilistic gates, which are therefore at least partly non-reversible.&#xA;A nice review on the topic is &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0512071.pdf&quot; rel=&quot;noreferrer&quot;&gt;quant-ph/0512071&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Less intuitive examples are provided by dissipation-induced quantum state engineering (e.g. &lt;a href=&quot;https://arxiv.org/pdf/1402.0529.pdf&quot; rel=&quot;noreferrer&quot;&gt;1402.0529&lt;/a&gt; or &lt;a href=&quot;https://www.nature.com/articles/srep10656.pdf&quot; rel=&quot;noreferrer&quot;&gt;srep10656&lt;/a&gt;).&#xA;In these protocols, one uses an open map dissipative dynamic, and engineers the interaction of the state with the environment in such a way that that the long-time stationary state of the system is the desired one.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-11T23:17:18.603" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="141" PostTypeId="2" ParentId="136" CreationDate="2018-03-15T18:59:23.027" Score="12" Body="&lt;p&gt;At risk of going off-topic from quantum computing and into physics, I'll answer what I think is a relevant subquestion of this topic, and use it to inform the discussion of unitary gates in quantum computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question here is: Why do we want unitarity in quantum gates? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The less specific answer is as above, it gives us 'reversibility', or as physicists often talk about it, a type of symmetry for the system. I'm taking a course in quantum mechanics right now, and the way unitary gates cropped up in that course was motivated by the desire to have physical transformations $\hat{U}$: that act as symmetries. This imposed two conditions on the transformation $\hat{U}$: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The transformations should act linearly on the state (this is what gives us a matrix representation).&lt;/li&gt;&#xA;&lt;li&gt;The transformations should preserve probability, or more specifically &lt;em&gt;inner product&lt;/em&gt;. This means that if we define:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;$$|\psi '\rangle = U |\psi\rangle, |\phi'\rangle = U |\phi\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preservation of inner product means that $\langle \phi | | \psi \rangle= \langle \phi' | | \psi'\rangle$. From this second specification, unitarity can be derived (for full details see Dr. van Raamsdonk's notes &lt;a href=&quot;http://www.phas.ubc.ca/~mav/Phys402/lecture5.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this answers the question of why operations that keep things &quot;reversible&quot; have to be unitary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question of why measurement itself is not unitary is more related to quantum computation. A measurement is a projection on to a basis; in essence, it must &quot;answer&quot; with one or more basis states as the state itself. It also leaves the state in a way that is consistent with the &quot;answer&quot; to the measurement, and &lt;em&gt;not&lt;/em&gt; consistent with the underlying probabilities that the state began with. So the operation satisfies specification 1. of our transformation $U$, but definitively does not satisfy specification 2. Not all matrices are created equal!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To round things back to quantum computation, the fact that measurements are destructive and projective (ie. we can only reconstruct the superposition through repeated measurements of identical states, and every measurement only gives us a 0/1 answer), is part of what makes the separation between quantum computing and regular computing subtle (and part of why it's difficult to pin that down). One might assume quantum computing is more powerful because of the mere size of the Hilbert space, with all those state superpositions available to us. But our ability to extract that information is heavily limited. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I understand it this shows that for information storage purposes, a qubit is only as good as a regular bit, and no better. But we can be clever in quantum computation with the way that information is traded around, because of the underlying linear-algebraic structure. &lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="236" LastEditDate="2018-03-15T20:40:23.053" LastActivityDate="2018-03-15T20:40:23.053" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="142" PostTypeId="1" AcceptedAnswerId="145" CreationDate="2018-03-15T19:10:27.307" Score="16" ViewCount="1085" Body="&lt;p&gt;Post-quantum cryptography like &lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice-based_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;lattice-based cryptography&lt;/a&gt; is designed to be secure even if quantum computers are available. It resembles currently employed encryptions, but is based on problems which are most likely not efficiently solvable by a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously research on quantum key distribution (QKD) continues. &lt;strong&gt;But what exactly are advantages of quantum key distribution over post-quantum cryptography?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The development of a new technology like QKD can have great side effects, and maybe QKD will be more cost-efficient or faster in the very long term, but I doubt that this is the main reason.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="26" LastEditDate="2019-05-08T10:22:43.093" LastActivityDate="2019-05-08T10:22:43.093" Title="Advantage of quantum key distribution over post-quantum cryptography" Tags="&lt;cryptography&gt;&lt;key-distribution&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="143" PostTypeId="2" ParentId="136" CreationDate="2018-03-15T19:28:36.153" Score="21" Body="&lt;p&gt;Unitary operations are only a special case of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_operation&quot; rel=&quot;noreferrer&quot;&gt;quantum operations&lt;/a&gt;, which are linear, completely positive maps (&quot;channels&quot;) that map density operators to density operators. This becomes obvious in the Kraus-representation of the channel, $$\Phi(\rho)=\sum_{i=1}^n K_i \rho K_i^\dagger,$$ where the so-called Kraus operators $K_i$ fulfill $\sum_{i=1}^n K_i^\dagger K_i\leq \mathbb{I}$ (&lt;a href=&quot;https://quantumcomputing.meta.stackexchange.com/q/54/104&quot;&gt;notation&lt;/a&gt;). Often one considers only trace-preserving quantum operations, for which equality in the previous inequality holds. If additionally there is only one Kraus operator (so $n=1$), then we see that the quantum operation is unitary.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;em&gt;quantum gates&lt;/em&gt; are unitary, because they are implemented via the action of a Hamiltonian for a specific time, which gives a unitary time evolution according to the Schrödinger equation.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2018-03-15T19:28:36.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="144" PostTypeId="2" ParentId="142" CreationDate="2018-03-15T19:43:15.777" Score="17" Body="&lt;p&gt;Quantum key distribution requires that you wholesale replace your entire communications infrastructure built out of 5 EUR ethernet cables and 0.50 EUR CPUs by multimillion-euro dedicated fiber links and specialized computers that actually just do classical secret-key cryptography anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plus you have to authenticate the shared secret keys you negotiate with quantum key distribution, which you will probably do using classical public-key cryptography unless you're rich enough to afford couriers with suitcases handcuffed to their wrists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://crypto.stackexchange.com/a/51314/29554&quot; title=&quot;François Grieu, Answer to ‘What makes Quantum Cryptography secure?’, crypto.stackexchange.com, 2017-09-05.&quot;&gt;More details from François Grieu on crypto.se about what makes quantum cryptography secure.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The crux of the technical difference—costs and deployability and politics and class divisions aside—is that the physical protocol of a QKD system is intended to be designed so that it need not leave a physical trace that future mathematical breakthroughs could enable to retroactively recover the shared secret negotiated over these dedicated fiber links.  In contrast, with classical cryptography, public-key key agreements over the internet, where an eavesdropper records every bit over the wire, could in principle be broken by future mathematical breakthroughs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in both cases, the peers use the shared secret they negotiated, whether with quantum key distribution or with classical public-key key agreement, as a secret key for classical secret-key cryptography, which could in principle be broken by future mathematical breakthroughs.  (But very smart well-funded people haven't made those breakthroughs after trying for decades.)  And &lt;a href=&quot;https://cr.yp.to/papers.html#holographic&quot; rel=&quot;noreferrer&quot; title=&quot;Daniel J. Bernstein, ‘Is the security of quantum cryptography guaranteed by the laws of physics?’, manuscript, 2016-03-26.&quot;&gt;this doesn't mean that &lt;em&gt;practical implementations&lt;/em&gt; of QKD won't leave physical traces either&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that said, QKD is quantum, so it is sexy and makes a good sell to rich governments and banks, who have multimillion-euro discretionary funds for useless toys like QKD.  The physics is also pretty cool for nerds to play with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M. Stern calls to mind another advantage of QKD: It operates at the &lt;em&gt;link layer&lt;/em&gt;, negotiating a secret key shared by the two endpoints of a fiber link—which might be one legitimate user and the MITM who spliced into that fiber link with a rogue QKD device.  If, in the era of quantum supremacy, we &lt;em&gt;replaced&lt;/em&gt; all the world's classical public-key key agreement by QKD, then where applications currently negotiate secret keys with their &lt;em&gt;peer&lt;/em&gt; across the internet for &lt;em&gt;end-to-end&lt;/em&gt; authenticated encryption over &lt;a href=&quot;https://en.wikipedia.org/wiki/IP_over_Avian_Carriers&quot; rel=&quot;noreferrer&quot; title=&quot;Wikipedia: IP over Avian Carriers.  Retrieved 2018-03-16.&quot;&gt;any routable medium&lt;/a&gt;, they would instead have to negotiate secret keys with their &lt;em&gt;ISP&lt;/em&gt;, who would negotiate secrets with their upstream ISP, and so on, for &lt;em&gt;hop-by-hop&lt;/em&gt; authenticated encryption.  This would be a boon for the good guys in major world governments trying to (retroactively) monitor user communications to root out terrorists and activists and journalists and other inconvenient elements of society, because the ISPs would then necessarily have the secret keys ready to turn over to the police.&lt;/p&gt;&#xA;" OwnerUserId="238" LastEditorUserId="238" LastEditDate="2018-03-17T02:27:02.867" LastActivityDate="2018-03-17T02:27:02.867" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="145" PostTypeId="2" ParentId="142" CreationDate="2018-03-15T20:41:01.900" Score="11" Body="&lt;p&gt;If it is proven that a given &lt;a href=&quot;https://en.wikipedia.org/wiki/Public-key_cryptosystem&quot; rel=&quot;noreferrer&quot;&gt;asymmetric encryption protocol&lt;/a&gt; relies on a problem which cannot be solved efficiently even by a quantum computer, then quantum cryptography becomes largely irrelevant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is that, as of today, no one was able to do this.&#xA;Indeed, such a result would be a serious breakthrough, as it would prove the existence of $\text{NP}$ problems which are not efficiently solvable on a quantum computer&#xA;(while this is generally believed to be the case, it is still unknown whether there are problems in $\text{NP}\!\setminus\!\text{BQP}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, all classical asymmetric encryption protocols are safe under the assumption that a given problem is hard to solve, but in no case, to my knowledge, it has been proven (in the computational complexity sense) that that problem is indeed exponentially hard to solve with a quantum computer (and for many not even that the problem is not efficiently solvable with a &lt;em&gt;classical&lt;/em&gt; computer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is nicely explained by Bernstein in his review of post-quantum cryptography (&lt;a href=&quot;http://www.pqcrypto.org/www.springer.com/cda/content/document/cda_downloaddocument/9783540887010-c1.pdf&quot; rel=&quot;noreferrer&quot;&gt;Link&lt;/a&gt;).&#xA;Quoting from the first section in the above, where he just talked about a number of classical encryption protocols:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a better attack on these systems? Perhaps. This is a familiar&#xA;  risk in cryptography. This is why the community invests huge amounts&#xA;  of time and energy in cryptanalysis. Sometimes cryptanalysts find a&#xA;  devastating attack, demonstrating that a system is useless for&#xA;  cryptography; for example, every usable choice of parameters for the&#xA;  Merkle–Hellman knapsack public-key encryption system is easily&#xA;  breakable. Sometimes cryptanalysts find attacks that are not so&#xA;  devastating but that force larger key sizes. Sometimes cryptanalysts&#xA;  study systems for years without finding any improved attacks, and the&#xA;  cryptographic community begins to build confidence that the best&#xA;  possible attack has been found—or at least that real-world attackers&#xA;  will not be able to come up with anything better.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the security of QKD does, &lt;em&gt;ideally&lt;/em&gt;, not rely on conjectures (or, as it is often put, QKD protocols provide in principle &lt;em&gt;information-theoretic security&lt;/em&gt;). If the two parties share a secure key, then the communication channel is unconditionally secure, and QKD provides an unconditionally secure way for them to exchange such a key (of course, still under the assumption of quantum mechanics being right). &#xA;In Section 4 of the above-mentioned review, the author presents a direct (if possibly somewhat biased) comparison of QKD vs Post-Quantum cryptography.&#xA;It is important to note that of course &quot;unconditional security&quot; is here to be meant in the information-theoretic sense, while in the real world &lt;a href=&quot;https://xkcd.com/538/&quot; rel=&quot;noreferrer&quot;&gt;there may be more important security aspects to consider&lt;/a&gt;.&#xA;It is also to be noted that the real-world security and practicality of QKD is not believed to be factual by some (see e.g. Bernstein &lt;a href=&quot;https://cr.yp.to/papers.html#holographic&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and the related discussion on QKD on &lt;a href=&quot;https://crypto.stackexchange.com/q/51311/57005&quot;&gt;crypto.SE&lt;/a&gt;), and that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Information-theoretic_security&quot; rel=&quot;noreferrer&quot;&gt;information-theoretic&lt;/a&gt; security of QKD protocols is only true if they are properly followed, which in particular means that the shared key has to be used as a &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;noreferrer&quot;&gt;one-time pad&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, in reality, also many QKD protocols may be broken. The reason is that experimental imperfection of specific implementations can be exploited to break the protocol (see e.g. &lt;a href=&quot;https://arxiv.org/abs/1505.05303&quot; rel=&quot;noreferrer&quot;&gt;1505.05303&lt;/a&gt;, and pag.6 of &lt;a href=&quot;https://www.nature.com/articles/npjqi201625&quot; rel=&quot;noreferrer&quot;&gt;npjqi201625&lt;/a&gt;).&#xA;It is still possible to ensure the security against such attacks using device-independent QKD protocols, whose security relies on Bell's inequalities violations and can be proven to not depend on the implementation details.&#xA;The catch is that these protocols are even harder to implement than regular QKD.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-17T00:51:19.637" LastActivityDate="2018-03-17T00:51:19.637" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="146" PostTypeId="5" CreationDate="2018-03-15T20:42:19.687" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:42:19.687" LastActivityDate="2018-03-15T20:42:19.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="147" PostTypeId="4" CreationDate="2018-03-15T20:42:19.687" Score="0" Body="It is a metaheuristic for finding the global minimum of a given objective function over a given set of candidate solutions (candidate states), by a process using quantum fluctuations. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:13:56.793" LastActivityDate="2018-12-13T21:13:56.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="148" PostTypeId="5" CreationDate="2018-03-15T20:44:28.597" Score="0" Body="&lt;p&gt;An ideal quantum gate can be described by a unitary matrix. That is, any (ideal) gate acting on $n$ qubits can be described as an element of (the matrix representation of) $\mathrm U\left(2^n\right)$. For a gate acting on $n$, $d$-dimensional, qudits this becomes $\mathrm U\left(d^n\right)$. The result of a gate $U$ acting on state $\left|\psi\right&amp;gt;$ is $U\left|\psi\right&amp;gt;$. When the state is being described by a density matrix $\rho$, this becomes $U\rho U^\dagger$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gates are usually denoted with respect to the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1410/23&quot;&gt;computational basis&lt;/a&gt; and any basis change on the state also has to be applied to the matrix representing the gate.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Gates can act on single, two or more qubits (or qudits). Some common examples are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Single qubit gates:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hadamard: $$H = \frac{1}{\sqrt{2}}\begin{pmatrix}1 &amp;amp; 1 \\\ 1 &amp;amp; -1\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;li&gt;Pauli gates: $$X = \begin{pmatrix}0 &amp;amp; 1 \\\ 1 &amp;amp; 0\end{pmatrix},\quad Y = \begin{pmatrix}0 &amp;amp; -i \\\ i &amp;amp; 0\end{pmatrix},\quad Z = \begin{pmatrix}1 &amp;amp; 0 \\\ 0 &amp;amp; -1\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;li&gt;$\sqrt{\text{NOT}} = \sqrt X$: $$\sqrt X = \frac 12\begin{pmatrix}1+i &amp;amp; 1-i \\\ 1-i &amp;amp; 1+i\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;li&gt;Phase: $$R_\phi = \begin{pmatrix}1 &amp;amp; 0 \\\ 0 &amp;amp; e^{i\phi}\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Two qubit gates:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Controlled gates: $$\text{CNOT} = \begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\\ 0&amp;amp;1&amp;amp;0&amp;amp;0 \\\ 0&amp;amp;0&amp;amp;0&amp;amp;1 \\\ 0&amp;amp;0&amp;amp;1&amp;amp;0\end{pmatrix},\quad CU = \begin{pmatrix}I_2 &amp;amp; 0 \\\ 0 &amp;amp; U\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;li&gt;SWAP: $$\text{SWAP} = \begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\\ 0&amp;amp;0&amp;amp;1&amp;amp;0 \\\ 0&amp;amp;1&amp;amp;0&amp;amp;0 \\\ 0&amp;amp;0&amp;amp;0&amp;amp;1\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Multiple qubit gates/transformations:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Toffoli/CCNOT: $$\text{CCNOT} = \begin{pmatrix}I_6 &amp;amp; 0 \\\ 0 &amp;amp; X\end{pmatrix}$$&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Fourier Transform (QFT)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;(multiple qubit) Hadamard/Discrete Fourier Transform: This is defined by the recursive relation $H^{\otimes n} = H\otimes H^{\otimes \left(n-1\right)}$, where $H = H^{\otimes 1}$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, currently, gates aren't perfect and an actual implementation of a gate can't recreate the exact, ideal gate. To quantify how 'close' an implemented gate is to the ideal one, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205035&quot; rel=&quot;nofollow noreferrer&quot;&gt;gate fidelity&lt;/a&gt; is often used.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="23" LastEditDate="2018-08-11T16:07:56.667" LastActivityDate="2018-08-11T16:07:56.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="149" PostTypeId="4" CreationDate="2018-03-15T20:44:28.597" Score="0" Body="For questions regarding usage, performance, implementation, application or theory related to quantum gates." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:40:55.447" LastActivityDate="2019-01-01T08:40:55.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="150" PostTypeId="5" CreationDate="2018-03-15T20:45:31.920" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:45:31.920" LastActivityDate="2018-03-15T20:45:31.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="151" PostTypeId="4" CreationDate="2018-03-15T20:45:31.920" Score="0" Body="For questions about the meaning and usage of vocabulary specific to quantum computing or quantum information." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:58:50.113" LastActivityDate="2019-01-01T08:58:50.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="152" PostTypeId="5" CreationDate="2018-03-15T20:46:38.577" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:46:38.577" LastActivityDate="2018-03-15T20:46:38.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="153" PostTypeId="4" CreationDate="2018-03-15T20:46:38.577" Score="0" Body="For questions about the ability of quantum computing to solve problems that classical computers (practically) cannot" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-17T00:19:15.333" LastActivityDate="2018-03-17T00:19:15.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="154" PostTypeId="5" CreationDate="2018-03-15T20:48:59.893" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:48:59.893" LastActivityDate="2018-03-15T20:48:59.893" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="155" PostTypeId="4" CreationDate="2018-03-15T20:48:59.893" Score="0" Body="For questions related to the unitarity (unitary evolution) of quantum systems, as applicable to quantum computing or quantum information." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:37:59.967" LastActivityDate="2019-01-01T09:37:59.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="156" PostTypeId="5" CreationDate="2018-03-15T20:51:04.030" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:51:04.030" LastActivityDate="2018-03-15T20:51:04.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="157" PostTypeId="4" CreationDate="2018-03-15T20:51:04.030" Score="0" Body="A quantum computing company, based in Burnaby, British Columbia, Canada, mostly known for their quantum annealing computers. An early rendition of these, D-Wave One, was the first commercially available quantum computer. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:55:30.510" LastActivityDate="2019-01-01T08:55:30.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="158" PostTypeId="5" CreationDate="2018-03-15T20:52:47.930" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:52:47.930" LastActivityDate="2018-03-15T20:52:47.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="159" PostTypeId="4" CreationDate="2018-03-15T20:52:47.930" Score="0" Body="For questions about the specific realization of quantum computing that uses photons as qubits. Examples of gates include the Fabry-Perot cavity or linear optical components like beamsplitters. Questions with this tag can ask about both theory and practice, as long as it relates to this specific realization." OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-03-25T17:19:26.063" LastActivityDate="2018-03-25T17:19:26.063" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="160" PostTypeId="5" CreationDate="2018-03-15T20:54:01.030" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-15T20:54:01.030" LastActivityDate="2018-03-15T20:54:01.030" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="161" PostTypeId="4" CreationDate="2018-03-15T20:54:01.030" Score="0" Body="For questions about the superconducting realization of quantum computers. Questions can be about both the implementation of this realization or the theory behind this realization. If you are asking about a specific aspect of superconducting quantum computers, please also tag with that (i.e., if you are also asking about the Josephson junction, tag with that)." OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-01-01T09:31:56.177" LastActivityDate="2019-01-01T09:31:56.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="162" PostTypeId="1" CreationDate="2018-03-16T01:10:30.233" Score="17" ViewCount="712" Body="&lt;p&gt;Often, when comparing two density matrices, $\rho$ and $\sigma$ (such as when $\rho$ is an experimental implementation of an ideal $\sigma$), the closeness of these two states is given by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;noreferrer&quot;&gt;quantum state fidelity&lt;/a&gt; $$F = tr\left(\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right),$$ with infidelity defined as $1-F$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, when comparing how close an implementation of a gate is with an ideal version, the fidelity becomes $$F\left( U, \tilde U\right) = \int\left[tr\left(\sqrt{\sqrt{U\left|\psi\rangle\langle\psi\right|U^\dagger}\tilde U\left|\psi\rangle\langle\psi\right|\tilde U^\dagger\sqrt{U\left|\psi\rangle\langle\psi\right|U^\dagger}}\right)\right]^2\,d\psi,$$ where $d\psi$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Haar_measure&quot; rel=&quot;noreferrer&quot;&gt;Haar measure&lt;/a&gt; over pure states. Unsurprisingly, this can get relatively unpleasant to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's define a matrix $M = \rho - \sigma$ in the case of density matrices, or $M = U - \tilde U$ when working with gates. Then, the Schatten norms&lt;sup&gt;1&lt;/sup&gt;, such as $\| M\|_1 = tr\left(\sqrt{M^\dagger M}\right)$, $\| M\|_2^2 = tr\left(M^\dagger M\right)$, or other norms, such as the &lt;a href=&quot;https://arxiv.org/abs/1004.4110v1&quot; rel=&quot;noreferrer&quot;&gt;diamond norm&lt;/a&gt; can be computed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These norms are often easier to compute&lt;sup&gt;2&lt;/sup&gt; than the above Fidelity. What makes matters worse is that in &lt;a href=&quot;https://arxiv.org/abs/0707.0963&quot; rel=&quot;noreferrer&quot;&gt;randomised benchmarking&lt;/a&gt; calculations, &lt;a href=&quot;https://arxiv.org/abs/1702.01853&quot; rel=&quot;noreferrer&quot;&gt;infidelity doesn't even appear to be a great measure&lt;/a&gt;, yet is the number that's used every time that I've seen when looking at benchmarking values for quantum processors.&lt;sup&gt;3&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;strong&gt;Why is (in)fidelity the go-to value for calculating gate errors in quantum processors (using randomised benchmarking), when it doesn't seem to have a helpful meaning and other methods, such as Schatten norms, are easier to calculate on a classical computer?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 The Schatten p-norm of $M$ is $\| M\|_p^p = tr\left(\sqrt{M^\dagger M}^p\right)$ &lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 i.e. plug in a noise model on a (classical) computer and simulate&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;3 Such as &lt;a href=&quot;https://github.com/QISKit/ibmqx-backend-information/blob/master/backends/ibmqx5/README.md&quot; rel=&quot;noreferrer&quot;&gt;IBM's QMX5&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="55" LastEditDate="2020-09-10T11:47:33.857" LastActivityDate="2020-09-10T11:47:33.857" Title="Purpose of using Fidelity in Randomised Benchmarking" Tags="&lt;fidelity&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="163" PostTypeId="1" AcceptedAnswerId="169" CreationDate="2018-03-16T05:43:16.650" Score="13" ViewCount="6423" Body="&lt;p&gt;If one wants to start building a quantum computer from scratch inside simulations (like how people get to build a classical computer from scratch in the &lt;a href=&quot;http://nand2tetris.org/&quot; rel=&quot;noreferrer&quot;&gt;Nand2Tetris course&lt;/a&gt;), is it possible? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes, what would be some possible approaches?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what will be the limits of such a simulated machine, given a specific amount of classical computing power? For instance, if we were to pick your average desktop/laptop, what will be the limit? If we take a supercomputer (like Titan) then what would be the limit?&lt;/p&gt;&#xA;" OwnerUserId="261" LastEditorUserId="26" LastEditDate="2018-12-13T19:36:45.840" LastActivityDate="2018-12-13T19:36:45.840" Title="Building a quantum computer in simulation" Tags="&lt;simulation&gt;&lt;performance&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="164" PostTypeId="5" CreationDate="2018-03-16T05:44:46.157" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-16T05:44:46.157" LastActivityDate="2018-03-16T05:44:46.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="165" PostTypeId="4" CreationDate="2018-03-16T05:44:46.157" Score="0" Body="For questions regarding faster than light communication or information transfer as relevant to quantum computing or quantum information" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-17T00:19:32.683" LastActivityDate="2018-03-17T00:19:32.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="166" PostTypeId="5" CreationDate="2018-03-16T05:48:24.920" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-16T05:48:24.920" LastActivityDate="2018-03-16T05:48:24.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="167" PostTypeId="4" CreationDate="2018-03-16T05:48:24.920" Score="0" Body="For questions related to measurement and its effects as relevant to quantum computation and quantum information. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:48:38.867" LastActivityDate="2019-01-01T08:48:38.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="168" PostTypeId="2" ParentId="163" CreationDate="2018-03-16T06:22:29.440" Score="5" Body="&lt;p&gt;Well, I'm working on a simulator of a quantum computer currently. The basic idea of quantum computing, of course, is gates represented by matrices applied to qubits represented by vectors. Using Python's numpy package, this isn't that hard to program in the most basic sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, one might expand upon, of course, the interface. One might also consider trying to make it a simulator of a nonideal quantum computer, that is, taking into account decoherence times and error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, you get into heavily uncharted territory. How do you construct the instruction set for a quantum computer? Who knows. You'll have to figure out. You'll also have to figure out your version of assembly, and even your version of higher level programming languages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, limitations of a classical computer in this? Well, this is a really complicated question (and worth asking separately, imho) but here's a quick summary:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we don't know if quantum computers are actually better than classical computers; the algorithms for classical computers could just not be good enough yet (quantum supremacy)&lt;/li&gt;&#xA;&lt;li&gt;let's say, as seems decently likely, that quantum computers &lt;em&gt;are&lt;/em&gt; better than classical computers. that improvement will depend heavily on the problem - quantum computers might see, for example, a much higher speed improvement in finding prime factorizations than in checking email. (see also &lt;a href=&quot;https://physics.stackexchange.com/questions/29307/simulate-a-quantum-computer-on-a-normal-one&quot;&gt;this&lt;/a&gt; P.SE q/a.)&lt;/li&gt;&#xA;&lt;li&gt;to provide some sort of numerical value, if we consider the current fastest algorithm for classical prime factorization finding, i.e., the general number sieve, we have an O-time of $O\Big(e^{\sqrt{\frac{64}{9}}(\log N)^{\frac 13}(\log\log N)^{\frac 23}}\Big)$ which is clearly rather gross. Shor's algorithm, on the other hand, works in  $O((\log N)^2(\log \log N)(\log \log \log N))$ which is obviously a lot faster.&lt;/li&gt;&#xA;&lt;li&gt;I can run a bunch of qubits on my computer as long as I keep them in the $|0\rangle$ or $|1\rangle$ states - i.e., effectively classical. So in some senses, your question is again, kind of ill-defined.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-16T06:22:29.440" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="169" PostTypeId="2" ParentId="163" CreationDate="2018-03-16T06:31:55.180" Score="6" Body="&lt;p&gt;The first part of your question seems like a duplicate of an existing QC SE post: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12/are-there-emulators-for-quantum-computers&quot;&gt;Are there emulators for quantum computers?&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not completely sure what you mean by &lt;strong&gt;&lt;em&gt;building&lt;/strong&gt; a quantum computer &lt;strong&gt;from scratch&lt;/strong&gt; inside simulations&lt;/em&gt;. However, yes, you can make software simulations of a quantum computer using your average laptop/desktop. The exact &quot;limit&quot; will depend on the computer specifications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since a quantum computer does not violate the &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis&quot; rel=&quot;noreferrer&quot;&gt;Church-Turing thesis&lt;/a&gt;, in theory it is definitely possible to simulate a quantum computer using an &lt;em&gt;ideal&lt;/em&gt; Turing machine. The obvious approach to simulate such a system requires exponential time on a classical computer and the space complexity is an exponential function of the number of quantum bits simulated. Say, you simulate a $n$-bit quantum computer, you'd need to store about $2^{n}$ bits of information in your classical computer at every instant. Moreover, implementation of quantum gates will again take a huge amount of resources in terms of time and space complexity. An implementation of a quantum gate operating on $n$-qubits would have to store about $4^{n}$ (because you can represent all quantum gate operations as a matrix of size $2^{n}\times2^{n}$) bits of information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can sort of estimate the &quot;limit&quot; depending on the specifications of the classical computer. For example if the (accessible) memory size of your classical computer is around $1$ TB I'd expect you can simulate a $\log_4(8\times 10^{12})\approx 21$ bit quantum computer (to be on the safe side let's say $20$). However, keep in mind that classical computers would take much larger time to &lt;em&gt;access&lt;/em&gt; all the individual bits of information, compared to an actual quantum computer (depending on the hardware of the quantum computer). So it's going to be &lt;em&gt;slower&lt;/em&gt; than an actual quantum computer! Some other limitations are that after each action of a $n$-qubit gate you need to keep track of which output qubits are entangled, which is a &lt;a href=&quot;https://stackoverflow.com/a/23327816/8605708&quot;&gt;NP-hard&lt;/a&gt; problem. Also, &lt;em&gt;measurement&lt;/em&gt; cannnot be accurately simulated on a classical computer, because classically there is no &lt;em&gt;truly random&lt;/em&gt; number generator. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-16T07:37:06.100" LastActivityDate="2018-03-16T07:37:06.100" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="170" PostTypeId="2" ParentId="163" CreationDate="2018-03-16T11:18:43.683" Score="5" Body="&lt;p&gt;I feel like this answer mostly rests on an underlying misunderstanding of what it means to &quot;simulate&quot; something.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, to &quot;simulate&quot; a complex system means to reproduce certain features of such system with a platform that is easier to control (often, but not always, a classical computer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the question of whether &quot;one can simulate a quantum computer in a classical computer&quot; is somewhat ill-posed.&#xA;If you mean that you want to replicate every possible aspect of a &quot;quantum computer&quot;, then that is never going to happen, just like you are never going to be able to simulate every aspect of any classical system (unless you use the same identical system of course).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, you certainly &lt;em&gt;can&lt;/em&gt; simulate many aspects of a complex device like a &quot;quantum computer&quot;. For example, one may want to simulate the evolution of a state within a quantum circuit.&#xA;Indeed, this can be exceedingly easy to do! For example, if you have python on your computer, just run the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;identity_2d = np.diag([1, 1])&#xA;pauliX_gate = np.array([[0, 1], [1, 0]])&#xA;hadamard_gate = np.array([[1, 1], [1, -1]]) / np.sqrt(2)&#xA;&#xA;cnot_gate = np.kron(identity_2d, pauliX_gate)&#xA;H1_gate = np.kron(hadamard_gate, identity_2d)&#xA;&#xA;awesome_entangling_gate = np.dot(cnot_gate, H1_gate)&#xA;&#xA;initial_state = np.array([1, 0, 0, 0])&#xA;final_state = np.dot(awesome_entangling_gate, initial_state)&#xA;print(final_state)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Congratulation, you just &quot;simulated&quot; the evolution of a separable two-qubit state into a Bell state!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you try to do the same with, say, 40 qubits and a nontrivial gate, you are not going to be able to pull it off this easily.&#xA;The naive reason is that to even just store the state of an $n$-qubit (non sparse) state you need to specify  ~$2^n$ complex numbers, and this start taking a lot of memory very quickly.&#xA;I say &quot;naive&quot; here because in many cases there may be tricks that allow you to avoid this problem$^{(1)}$.&#xA;This is why many people work on trying to find clever tricks to simulate quantum circuits (and other types of quantum systems) with classical computers, and why this is far from trivial to do$^{(2)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other answers already touched on various aspects of this hardness, and the answers to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/12/55&quot;&gt;this other question&lt;/a&gt; already mention many available platforms to simulate/emulate various aspects of quantum algorithms, so I will not go there.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt;&#xA;An interesting example of this is the problem of simulating a &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;noreferrer&quot;&gt;boson sampling device&lt;/a&gt; (this is not a quantum algorithm in the sense of a state evolving through a series of gates, but it is nonetheless an example of a nontrivial quantum device). BosonSampling is a &lt;em&gt;sampling problem&lt;/em&gt;, in which one is tasked with the problem of &lt;em&gt;sampling&lt;/em&gt; from a specific probability distribution, and this has been shown (under likely assumptions) to be impossible to do efficiently with a classical device. Although it was never shown to be a fundamental aspect of this hardness, a certainly nontrivial issue associated with simulating a boson sampling device was that of having to compute an exponentially large number of probabilities from which to sample. However, it was recently shown that indeed one does not need to compute the whole set of probabilities to sample from them (&lt;a href=&quot;https://arxiv.org/abs/1705.00686&quot; rel=&quot;noreferrer&quot;&gt;1705.00686&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/1706.01260.pdf&quot; rel=&quot;noreferrer&quot;&gt;1706.01260&lt;/a&gt;).&#xA;This is not far in principle from simulating the evolution of a lot of qubits in a quantum circuit without having to store the whole state of the system at any given point.&#xA;Regarding more directly quantum circuits, examples of recent breakthrough in simulation capabilities are &lt;a href=&quot;https://arxiv.org/abs/1704.01127&quot; rel=&quot;noreferrer&quot;&gt;1704.01127&lt;/a&gt; &#xA;and &lt;a href=&quot;https://arxiv.org/abs/1710.05867&quot; rel=&quot;noreferrer&quot;&gt;1710.05867&lt;/a&gt; (also a super-recent one, not yet published, is &lt;a href=&quot;https://arxiv.org/abs/1802.06952&quot; rel=&quot;noreferrer&quot;&gt;1802.06952&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(2)&lt;/strong&gt;&#xA;In fact, it has been shown (or rather, strong evidence has been provided for the fact) that it is not possible to efficiently simulate most quantum circuits, see &lt;a href=&quot;https://arxiv.org/abs/1504.07999&quot; rel=&quot;noreferrer&quot;&gt;1504.07999&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-30T11:35:20.970" LastActivityDate="2018-03-30T11:35:20.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="171" PostTypeId="1" AcceptedAnswerId="172" CreationDate="2018-03-16T17:35:59.370" Score="44" ViewCount="6119" Body="&lt;p&gt;I'm admittedly a novice in this field, but I have read that, while the D-wave (one) is an interesting device, there is some skepticism regarding it being 1) useful and 2) actually a 'quantum computer'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Scott Aaronson has expressed multiple times that he is skeptical about whether the 'quantum' parts in the D-wave are actually useful: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It remains true, as I’ve reiterated here for years, that we have no direct evidence that quantum coherence is playing a role in the observed speedup, or indeed that entanglement between qubits is ever present in the system.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Exerpt from &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=954&quot; rel=&quot;noreferrer&quot;&gt;this blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the relevant &lt;a href=&quot;https://en.wikipedia.org/wiki/D-Wave_Systems#Controversy&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia section&lt;/a&gt; on skepticism against the D-wave is a mess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I ask: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I know that D-wave claims to use some sort of quantum annealing. Is there (dis)proof of the D-wave actually using quantum annealing (with effect) in its computations? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Has it been conclusively shown that the D-wave is (in)effective? If not, is there a clear overview of the work to attempt this?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-03-26T15:38:48.193" LastActivityDate="2019-05-13T15:59:01.720" Title="Is there proof that the D-wave (one) is a quantum computer and is effective?" Tags="&lt;performance&gt;&lt;annealing&gt;&lt;d-wave&gt;&lt;classical-computing&gt;&lt;experiment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="172" PostTypeId="2" ParentId="171" CreationDate="2018-03-16T18:54:03.090" Score="28" Body="&lt;p&gt;There is still a search for problems where the D-Wave shows improvement over classical algorithms. One might recall media splashes where the D-Wave solved some instances &lt;span class=&quot;math-container&quot;&gt;$10^8$&lt;/span&gt; times faster than a classical algorithms but forgot to mention that the problem can be solved in polynomial time using minimum weight perfect matching. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denchev showing &lt;span class=&quot;math-container&quot;&gt;$10^8$&lt;/span&gt; speedup&#xA;&lt;a href=&quot;https://arxiv.org/abs/1512.02206&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1512.02206&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mandra using MWPM&#xA;&lt;a href=&quot;https://arxiv.org/abs/1703.00622&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1703.00622&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is some evidence that there are indeed some quantum effects used by the D-Wave. Notably a study by Katzgraber et al. that compares the D-Wave with simulated annealing and the effects of reducing barrier thickness in the energy landscape (to make tunneling more probable). In Fig. 5 of the following paper the barrier thickness is reduced and the D-Wave shows improvement on the class of problems while Simulated Annealing shows no improvement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1505.01545&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1505.01545&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Full disclosure: Katzgraber was my PhD advisor so I am most familiar with his work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, there have been a few papers on the topic of the D-Wave being a simple thermal annealer with no quantum effects, notably the papers by Smolin although they are a bit dated now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1305.4904&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1305.4904&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1401.7087&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1401.7087&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More recently Albash et al. discussed the finite temperature as a reason for quantum annealers not functioning competitively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1703.03871&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1703.03871&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="26" LastEditDate="2019-05-13T15:59:01.720" LastActivityDate="2019-05-13T15:59:01.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="173" PostTypeId="5" CreationDate="2018-03-16T19:23:40.217" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-16T19:23:40.217" LastActivityDate="2018-03-16T19:23:40.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="174" PostTypeId="4" CreationDate="2018-03-16T19:23:40.217" Score="0" Body="For questions about the performance of quantum computers and quantum computer emulators." OwnerUserId="11" LastEditorUserId="11" LastEditDate="2018-03-17T00:19:36.850" LastActivityDate="2018-03-17T00:19:36.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="175" PostTypeId="1" AcceptedAnswerId="176" CreationDate="2018-03-17T02:26:32.157" Score="32" ViewCount="3831" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Grover's search algorithm&lt;/a&gt; provides a provable quadratic speed-up for unsorted database search.&#xA;The algorithm is usually expressed by the following quantum circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/a/ae/Grovers_algorithm.svg&quot;/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most representations, a crucial part of the protocol is the &quot;oracle gate&quot; &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt;, which &quot;magically&quot; performs the operation &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\mapsto(-1)^{f(x)}|x\rangle$&lt;/span&gt;.&#xA;It is however often left unsaid how difficult realizing such a gate would actually be.&#xA;Indeed, it could seem like this use of an &quot;oracle&quot; is just a way to sweep the difficulties under the carpet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we know whether such an oracular operation is indeed realizable?&#xA;And if so, what is its complexity (for example in terms of complexity of gate decomposition)?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="1937" LastEditDate="2019-03-07T11:15:39.800" LastActivityDate="2019-11-18T19:07:50.137" Title="How is the oracle in Grover's search algorithm implemented?" Tags="&lt;complexity-theory&gt;&lt;circuit-construction&gt;&lt;algorithm&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="176" PostTypeId="2" ParentId="175" CreationDate="2018-03-17T02:45:21.413" Score="23" Body="&lt;p&gt;The function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is simply an arbitrary boolean function of a bit string: &lt;span class=&quot;math-container&quot;&gt;$f\colon \{0,1\}^n \to \{0,1\}$&lt;/span&gt;.  For applications to breaking cryptography, such as &lt;a href=&quot;https://eprint.iacr.org/2017/811&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Scott Fluhrer, ‘Reassessing Grover&amp;#39;s Algorithm’, IACR Cryptology ePrint Archive: Report 2017/811, 2017-08-27.&quot;&gt;[1]&lt;/a&gt;, &lt;a href=&quot;https://cr.yp.to/papers.html#grovernfs&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Daniel J. Bernstein, Jean-François Biasse, and Michele Mosca, ‘A low-resource quantum factoring algorithm’, in Tanja Lange and Tsuyoshi Takagi, _eds._, _Proceedings of Post-quantum cryptography—8th international workshop, PQCrypto 2017_, Utrecht, the Netherlands, June 26–28, 2017, Springer LNCS 10346, pp. 330–346.&quot;&gt;[2]&lt;/a&gt;, or &lt;a href=&quot;https://blog.cr.yp.to/20171017-collisions.html&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Daniel J. Bernstein, ‘Quantum algorithms to find collisions’, cr.yp.to blog, 2017-10-17.&quot;&gt;[3]&lt;/a&gt;, this is not actually a ‘database lookup’, which would necessitate storing the entire database as a quantum circuit somehow, but rather a function such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;  x \mapsto \begin{cases}&#xA;    1, &amp;amp; \text{if $\operatorname{SHA-256}(x) = y$;} \\&#xA;    0, &amp;amp; \text{otherwise,}&#xA;  \end{cases}&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for fixed &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, which has no structure we can exploit for a classical search, unlike, say, the function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;  x \mapsto \begin{cases}&#xA;    1, &amp;amp; \text{if $2^x \equiv y \pmod{2^{2048} - 1942289}$}, \\&#xA;    0, &amp;amp; \text{otherwise},&#xA;  \end{cases}&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has &lt;a href=&quot;https://crypto.stackexchange.com/a/1389/49826&quot; title=&quot;Samuel Neves, Answer to ‘Are safe primes p = 2k ± s with s small less recommandable than others as a discrete log modulus?’, crypto.stackexchange.com, 2011-12-01.&quot;&gt;structure that can be exploited&lt;/a&gt; to invert it faster even on a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question of the particular &lt;em&gt;cost&lt;/em&gt; can't be answered in general because &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be any circuit—it's just a matter of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/25/238&quot; title=&quot;jknappen, Answer to ‘Can a quantum computer simulate a normal computer?’, quantumcomputing.stackexchange.com, 2018-03-12.&quot;&gt;making a quantum circuit out of a classical circuit&lt;/a&gt;.  But usually, as in the example above, the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is very cheap to evaluate on a classical computer, so it shouldn't pose a particularly onerous burden on a quantum computer for which everything else about Grover's algorithm is within your budget.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only general cost on top of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is an extra conditional NOT gate &lt;span class=&quot;math-container&quot;&gt;$$C\colon \left|a\right&amp;gt; \left|b\right&amp;gt; \to \left|a\right&amp;gt; \left|a \oplus b\right&amp;gt;$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is xor, and an extra ancillary qubit for it.  In particular, if we have a circuit &lt;span class=&quot;math-container&quot;&gt;$$F\colon \left|x\right&amp;gt; \left|a\right&amp;gt; \lvert\text{junk}\rangle \mapsto \left|x\right&amp;gt; \left|a \oplus f(x)\right&amp;gt; \lvert\text{junk}'\rangle$$&lt;/span&gt; built out of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and the circuit for &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, then if we apply it to &lt;span class=&quot;math-container&quot;&gt;$\left|x\right&amp;gt;$&lt;/span&gt; together with an ancillary qubit initially in the state &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt; = H\left|1\right&amp;gt; = (1/\sqrt{2})(\left|0\right&amp;gt; - \left|1\right&amp;gt;)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a Hadamard gate, then we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;  F\left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}\rangle&#xA;   &amp;amp;= \frac{1}{\sqrt{2}}\bigl(&#xA;        F\left|x\right&amp;gt; \left|0\right&amp;gt; \lvert\text{junk}\rangle&#xA;        - F\left|x\right&amp;gt; \left|1\right&amp;gt; \lvert\text{junk}\rangle&#xA;      \bigr) \\&#xA;   &amp;amp;= \frac{1}{\sqrt{2}}\bigl(&#xA;        \left|x\right&amp;gt; \left|f(x)\right&amp;gt; \lvert\text{junk}'\rangle&#xA;        - \left|x\right&amp;gt; \left|1 \oplus f(x)\right&amp;gt; \lvert\text{junk}'\rangle&#xA;      \bigr).&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$1 \oplus f(x) = 1$&lt;/span&gt;, so by simplifying we obtain &lt;span class=&quot;math-container&quot;&gt;$$F\left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}\rangle = \left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}'\rangle,$$&lt;/span&gt; whereas if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$1 \oplus f(x) = 0$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$$F\left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}\rangle = -\left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}'\rangle,$$&lt;/span&gt; and thus in general &lt;span class=&quot;math-container&quot;&gt;$$F\left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}\rangle = (-1)^{f(x)} \left|x\right&amp;gt; \left|-\right&amp;gt; \lvert\text{junk}'\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="238" LastEditorUserId="238" LastEditDate="2019-11-18T19:07:50.137" LastActivityDate="2019-11-18T19:07:50.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="177" PostTypeId="1" AcceptedAnswerId="179" CreationDate="2018-03-17T06:30:57.343" Score="12" ViewCount="647" Body="&lt;p&gt;I'm writing with respect to &lt;a href=&quot;https://www.youtube.com/watch?v=APJwgjl_cUQ&quot; rel=&quot;noreferrer&quot;&gt;part I&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=__4qlnCnSDk&quot; rel=&quot;noreferrer&quot;&gt;part II&lt;/a&gt; of the Fourier sampling video lectures by Professor Umesh Vazirani.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In part I they start with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In the Hadamard Transform:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wxqaw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wxqaw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|0...0\rangle \to \sum_{\{0,1\}^n}\frac{1}{2^{n/2}}|x\rangle$$&#xA;$$|u\rangle =|u_1...u_n\rangle \to \sum_{\{0,1\}^n}\frac{(-1)^{u.x}}{2^{n/2}}|x\rangle \quad \text{(where $u.x=u_1x_1+u_2x_2+...+u_nx_n$)}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Fourier Sampling:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\psi\rangle=\sum_{\{0,1\}}^{n}\alpha_x|x\rangle \to \sum_{x}\hat{\alpha_x}|x\rangle=|\hat{\psi}\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $|\hat{\psi}\rangle$ is measured we see $x$ with probability $|\hat{\alpha_x}|^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In part II:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Parity Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We are given a function $f:\{0,1\}^n\to\{0,1\}$ as a black box. We&#xA;  know that $f(x)=u.x$ (i.e. $u_1x_1+u_2x_2+...+u_nx_n (\text{mod 2})$) for some hidden $u\in\{0,1\}^{n}$. How do we&#xA;  figure out $u$ with as few queries to $f$ as possible?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wymTY.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wymTY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They say that we need to follow a two step procedure for figuring out $u$ in minimum possible number of steps.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Set up a superposition $\frac{1}{2^{n/2}}\sum_{x}(-1)^{f(x)}|x\rangle$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fourier sample to obtain $u$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is where I got lost. I don't understand what exactly they mean by &quot;set up a superposition...&quot;. &lt;strong&gt;Why&lt;/strong&gt; should we do it? And how does Fourier sampling (as described) help to determine $u$ ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They further build a quantum gate like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zZWSw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zZWSw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even this doesn't make sense to me. They're performing Hadamard transforms on a set of n-qubits having state $|0\rangle$ and then bit flip and again Hadamard transform. So we get back to where we were initially. How does an extra $|-\rangle$ state input help by outputting $- \oplus f(0...0)$? I'm not even sure what operation $\oplus$ stand for, here.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="9482" LastEditDate="2020-04-13T16:32:03.703" LastActivityDate="2021-01-26T15:40:08.153" Title="How does Fourier sampling actually work (and solve the parity problem)?" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;&lt;fourier-sampling&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="178" PostTypeId="2" ParentId="21" CreationDate="2018-03-17T09:24:24.417" Score="7" Body="&lt;p&gt;As this is one of the first examples in Nielsen &amp;amp; Chuang, I'll go ahead and type out their explanation here for anyone else that is interested in entanglement for faster than light communication. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is an abridged version of Nielsen &amp;amp; Chuang section 1.3.7 entitled 'Example: quantum teleportation'&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum teleportation is a technique for moving quantum states around,&#xA;  even in the absence of a quantum communications channel linking the&#xA;  sender of the quantum state to the recipient. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Here’s how quantum teleportation works. Alice and Bob met long ago but&#xA;  now live far apart. While together they generated an EPR pair, each&#xA;  taking one qubit of the EPR pair (also known as Bell states) when they&#xA;  separated. Many years later, Bob is in hiding, and Alice’s mission,&#xA;  should she choose to accept it, is to deliver a qubit &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi&#xA; \rangle$&lt;/span&gt; to Bob. She does not know the state of the qubit, and&#xA;  moreover can only send classical information to Bob. Should Alice&#xA;  accept the mission?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Intuitively, things look pretty bad for Alice. She doesn’t know the&#xA;  state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; of the qubit she has to send to Bob, and&#xA;  the laws of quantum mechanics prevent her from determining the state&#xA;  when she only has a single copy of &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; in her&#xA;  possession. What’s worse, even if she did know the state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi&#xA; \rangle$&lt;/span&gt;, describing it precisely takes an infinite amount of&#xA;  classical information since &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; takes values in a&#xA;  continuous space. So even if she did know &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt;, it&#xA;  would take forever for Alice to describe the state to Bob. It’s not&#xA;  looking good for Alice. Fortunately for Alice, quantum teleportation&#xA;  is a way of utilizing the entangled EPR pair in order to send &lt;span class=&quot;math-container&quot;&gt;$\lvert&#xA; \psi \rangle$&lt;/span&gt; to Bob, with only a small overhead of classical&#xA;  communication.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In outline, the steps of the solution are as follows: Alice interacts&#xA;  the qubit &lt;span class=&quot;math-container&quot;&gt;$\lvert&#xA; \psi \rangle$&lt;/span&gt; with her half of the EPR pair, and then measures the two&#xA;  qubits in her possession, obtaining one of four possible classical&#xA;  results, 00, 01, 10, and 11. She sends this information to Bob.&#xA;  Depending on Alice’s classical message, Bob performs one of four&#xA;  operations on his half of the EPR pair. Amazingly, by doing this he&#xA;  can recover the original state &lt;span class=&quot;math-container&quot;&gt;$\lvert&#xA; \psi \rangle$&lt;/span&gt;!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Skipping some of the details...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;First, doesn’t teleportation allow one to transmit quantum states faster than light? This would be rather peculiar because the theory of relativity implies that faster than light information transfer could be used to send information backward in time. Fortunately, quantum teleportation does not enable faster than light communication, because to complete the teleportation Alice must transmit her measurement result to Bob over a classical communications channel. The classical channel is limited by the speed of light, so it follows that quantum teleportation cannot be accomplished faster than the speed of light, resolving the apparent paradox.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="54" LastEditorUserId="26" LastEditDate="2019-05-14T14:56:29.240" LastActivityDate="2019-05-14T14:56:29.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="179" PostTypeId="2" ParentId="177" CreationDate="2018-03-17T11:15:08.020" Score="7" Body="&lt;p&gt;Starting from the beginning (a very good place to start, after all), the state &lt;span class=&quot;math-container&quot;&gt;$\left| 0\right\rangle^{\otimes n}\left| -\right\rangle$&lt;/span&gt; is input into &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}\otimes I$&lt;/span&gt; (here, called the 'Fourier sample'). This generates the state &lt;span class=&quot;math-container&quot;&gt;$$\left(\sum_{x=\{0,1\}^n}\frac{1}{2^{n/2}}|x\rangle\right)\left|-\right\rangle = \frac{1}{2^{n/2}}\left(\left|0\right\rangle + \left|1\right\rangle\right)^{\otimes n}\left|-\right\rangle.$$&lt;/span&gt; Now, we apply the operation &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; (in this case, the &lt;em&gt;bit oracle&lt;/em&gt;) to give &lt;span class=&quot;math-container&quot;&gt;$$U_f\left(\sum_{x=\{0,1\}^n}\frac{1}{2^{n/2}}|x\rangle\right)\left|-\right\rangle = \sum_{x=\{0,1\}^n}\frac{1}{2^{n/2}}|x\rangle\left|-\oplus f\left(x\right)\right\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first point to note is that &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; &lt;strong&gt;is the classical XOR operation&lt;/strong&gt;. What this gives is actually the &lt;em&gt;phase oracle&lt;/em&gt;, so that we get &lt;span class=&quot;math-container&quot;&gt;$$\left(\sum_{x=\{0,1\}^n}\frac{1}{2^{n/2}}\left(-1\right)^{f\left(x\right)}\left|x\right\rangle\right)\left|-\right\rangle.$$&lt;/span&gt; This is because &lt;span class=&quot;math-container&quot;&gt;$U_f\left|x\right\rangle\left(\left|0\right\rangle - \left|1\right\rangle\right) = \left|x\right\rangle\left|f\left(x\right)\right\rangle - \left|x\right\rangle\left|1\oplus f\left(x\right)\right\rangle = \left(-1\right)^{f\left(x\right)}\left|x\right\rangle\left(\left|0\right\rangle - \left|1\right\rangle\right)$&lt;/span&gt;. This is the 'set up a superposition...' point - all this means is to &lt;strong&gt;perform the operations required to set the qubits in the above state, which is a superposition of all possible states (with phase factors, in this case)&lt;/strong&gt;. In this case, this is just Hadamard, followed by a phase oracle.&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is just a classical bit string: &lt;span class=&quot;math-container&quot;&gt;$x = \prod_ix_i$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$$H\left|x_i\right\rangle = \frac{1}{\sqrt{2}}\left(\left|0\right\rangle + \left(-1\right)^{x_i}\left|1\right\rangle\right) = \frac{1}{\sqrt{2}}\sum_{y=\left\lbrace0, 1\right\rbrace}\left(-1\right)^{x_i.y}\left|y\right\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This gives the property &lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}\left| x\right\rangle = \frac{1}{2^{n/2}}\sum_{y\in\left\lbrace0, 1\right\rbrace^n}\left(-1\right)^{x.y}\left|y\right\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This gives the final state as &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^n}\left(\sum_{x, y=\{0,1\}^n}\left(-1\right)^{f\left(x\right) \oplus x.y}\left|y\right\rangle\right)\left|-\right\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$f\left(x\right) = u.x = x.u$&lt;/span&gt;, giving &lt;span class=&quot;math-container&quot;&gt;$\left(-1\right)^{f\left(x\right) \oplus x.y} = \left(-1\right)^{x.\left(u\oplus y\right)}$&lt;/span&gt;. Summing over the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; terms gives that &lt;span class=&quot;math-container&quot;&gt;$\sum_x\left(-1\right)^{x.\left(u\oplus y\right)} = 0,\, \forall\, u\oplus y \neq 0$&lt;/span&gt;. This means that we're left with the term for &lt;span class=&quot;math-container&quot;&gt;$u\oplus y = 0$&lt;/span&gt;, which means that &lt;span class=&quot;math-container&quot;&gt;$u=y$&lt;/span&gt;, giving the output as &lt;span class=&quot;math-container&quot;&gt;$\left|u\right\rangle\left|-\right\rangle$&lt;/span&gt;, which is measured to obtain &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As for &lt;strong&gt;&lt;em&gt;why&lt;/em&gt; we want to set up a superposition&lt;/strong&gt;: This is where the power of quantum computing comes into play - In less mathematical terms, applying the Hadamard transformation is performing a rotation on the qubit states to get into the state &lt;span class=&quot;math-container&quot;&gt;$\left|+\right\rangle^{\otimes n}$&lt;/span&gt;. You then rotate each qubit in this superposition state using an operation equivalent to XOR (in this new basis), so that when performing the Hadamard transformation again, you're now just rotating back onto the state &lt;span class=&quot;math-container&quot;&gt;$\left|u\right\rangle$&lt;/span&gt;. Another way of looking at this is to consider it as a reflection or inversion that achieves the same result.&lt;/p&gt;&#xA;&lt;p&gt;The point is that, using superposition, we can do this to all the qubits at the same time, instead of having to individually check each qubit as in the classical case.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="13500" LastEditDate="2020-10-14T11:19:45.897" LastActivityDate="2020-10-14T11:19:45.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="180" PostTypeId="1" CreationDate="2018-03-17T11:19:10.620" Score="8" ViewCount="142" Body="&lt;p&gt;How much of a role does the type of hardware used to implement the building blocks (like qubits, the circuits, the communication channels,quantum RAM etc.) have to play when designing the architecture for a full scale quantum computer?   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My own thoughts on the matter: Architecture should not depend on the way the hardware is realised. Because if it did, then every time someone came up with a novel design for the hardware, it would require rethinking the architecture - not a bad idea if you are looking to improve your architecture but that rethinking should be born out of a desire to improve the computer in general and not simply accommodate some new RAM implementation.&lt;/p&gt;&#xA;" OwnerUserId="261" LastEditorUserId="26" LastEditDate="2019-05-15T14:29:41.240" LastActivityDate="2019-05-15T14:29:41.240" Title="Dependency of architecture on hardware" Tags="&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="181" PostTypeId="2" ParentId="162" CreationDate="2018-03-17T13:00:27.177" Score="6" Body="&lt;p&gt;Nielsen and Chuang in their book &quot;Quantum Computation and Quantum Information&quot; have section (Chapter 9) on distance measures for quantum information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surprisingly they say in Section 9.3 &quot; How well does a quantum channel preserve information?&quot; that when comparing fidelity to the trace norm:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Using the properties of the trace distance established in the last section it is not difficult, for the most part, to give a parallel development based upon the trace distance. However, it turns out that the fidelity is an easier tool to calculate with, and for that reason we restrict ourselves to considerations based upon the fidelity.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I imagine this is in part why fidelity is used. It seems it's fairly useful as a static measure of distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There also seems to be relatively straightforward extensions of fidelity to ensembles of states&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F =\sum_j p_jF(\rho_j,\mathcal{E}(\rho_j))^2,$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_j$ the probability of preparing the system in states $\rho_j$, and $\mathcal{E}$ the particular noisy channel of interest, $0\leq F\leq 1$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also an extension to entanglement fidelity, to measure how well a channel preserves entanglement. Given a state $Q$ assumed to be entangled to the external world in some way, and a purification of the state (fictitious system $R$), such that $RQ$ is pure. The state is subjected to dynamics in the channel $\mathcal{E}$. The primes indicate the state after the application of quantum operation. $\mathcal{I}_R$ is the identity map on system $R$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(\rho,\mathcal{E}) ≡ F(RQ,R′Q′)^2= ⟨RQ| \left(\mathcal{I}_R \otimes \mathcal{E}\right)\left(|RQ⟩⟨RQ|\right) |RQ⟩$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's some formulas derived to simplify computations of fidelity and entanglement fidelity also given in the chapter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One of the attractive properties of the entanglement fidelity is that there is a very simple formula which enables it to be calculated exactly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;$$F(\rho,\mathcal{E})=\sum_i\operatorname{tr}|(\rho E_i)|^2 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the 'operation elements' $E_i$ satisfy a completeness relation. Maybe someone else can comment on more practical implementations, but this is what I've gathered from reading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1: Re M.Stern&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's the same reference Nielsen and Chuang. They comment on that by saying &quot;You may wonder why the fidelity appearing on the right hand side of the definition is squared. There are two answers to this question, one simple, and one complex. The simple answer is that including this square term makes the ensemble fidelity more naturally related to the entanglement fidelity, as defined below. The more complex answer is that quantum information is, at present, in a state of infancy and it is not entirely clear what the ‘correct’ definitions for notions such as information preservation are! Nevertheless, as we shall see in Chapter 12, the ensemble average fidelity and the entanglement fidelity give rise to a rich theory of quantum information, which leads us to believe that these measures are on the right track, even though a complete theory of quantum information has not yet been developed.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your second question as to why not look at the fidelity of $\bar{\rho}$, there's a nice point mentioned in &quot;Distinguishability measures between ensembles of quantum states&quot; which I think is in PhysRevA but there's an arXiv version &lt;a href=&quot;https://arxiv.org/pdf/0812.3832.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point they mention on pg 4, is suppose you have two ensembles $rho$ and $\sigma$ which happen to have the same ensemble average density matrix, $\bar{\rho}=\bar{\sigma}$, then the fidelity $F(\bar{\rho},\bar{\sigma})$ can't &#xA;distinguish between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2: Re Mithrandir24601&lt;/strong&gt;&#xA;So one definition for gate fidelity is motivated by thinking what's the worst-case behaviour of a channel $\mathcal{E}$, for a given input state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F_{min}=\min_{|\psi\rangle}F(|\psi\rangle\langle\psi|,\mathcal{E}(|\psi\rangle\langle\psi|))\equiv\min_{|\psi\rangle}F(|\psi\rangle,\mathcal{E}(|\psi\rangle\langle\psi|))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to concavity in both arguments you can restrict to pure states in this minimising, the equivalence in the second part is just notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In defining how well a gate is implemented one can look as well at a worst case implementation of a unitary gate $U$ by a channel $\mathcal{E}$  by defining&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$F(U,\mathcal{E})=\min_{|\psi\rangle}F(U|\psi\rangle,\mathcal{E}(|\psi\rangle\langle\psi|))$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the formula you've given and the paper you've linked, they integrate over $\psi$, with an appropriate measure$^*$. This makes me think this should be regarded instead as an average fidelity $\bar{F}(U,\tilde{U})$, which you can imagine might be more useful in practical experiments, especially if you're repeating the experiment. It's probably unlikely to achieve the exact minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's an arXiv version of a paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0205035.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; by Michael Nielsen where he talks about average gate fidelity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only extra difference between fidelity for a gate and average fidelity of a gate mentioned vs the formula you initially provided, is the square of the trace: $[\operatorname{trace}]^2$ you have. As in &lt;strong&gt;Update 1&lt;/strong&gt; some people prefer to use $F^2$ as the fidelity rather than $F$, as it can supposedly be connected more readily to entanglement fidelity. I do need to read a bit more about that to comment properly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;($\,^*$) &lt;em&gt;Aside&lt;/em&gt;: I think calling it a 'Haar measure' might be misleading, I've seen in it in papers as well. As far as I know, the space of pure states is usually topologically $\Bbb{CP}^n$, for an $n$-dimensional hilbert space. Apparently the measure they use is inherited from the haar measure on $U(n)$ by a quotient or so I've read here: &lt;a href=&quot;https://physics.stackexchange.com/a/98869/41998&quot;&gt;https://physics.stackexchange.com/a/98869/41998&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="197" LastEditorUserId="197" LastEditDate="2018-03-26T11:34:41.037" LastActivityDate="2018-03-26T11:34:41.037" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="182" PostTypeId="2" ParentId="136" CreationDate="2018-03-17T13:22:42.823" Score="4" Body="&lt;p&gt;I'll add a small bit complementing the other answers, just about the idea of measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measurement is usually taken as a postulate of quantum mechanics. There's usually some preceding postulates about hilbert spaces, but following that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Every measurable physical quantity $A$ is described by an operator $\hat{A}$ acting on a Hilbert space $\mathcal{H}$. This operator is called an observable, and it's eigenvalues are the possibly outcomes of a measurement.&lt;/li&gt;&#xA;&lt;li&gt;If a measurement is made of the observable $A$, in the state of the system $\psi$, and the outcome is $a_n$, then the state of the system immediately after measurement is $$\frac{\hat{P}_n|\psi\rangle}{\|\hat{P}_n|\psi\rangle\|},$$ where $\hat{P}_n$ is the projector onto the eigen-subspace of the eigenvalue $a_n$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Normally the projection operators themselves should satisfy $\hat{P}^\dagger=\hat{P}$ and $\hat{P}^2=\hat{P}$, which means they themselves are observables by the above postulates, and their eigenvalues $1$ or $0$. Supposing we take one of the $\hat{P}_n$ above, we can interpret the $1,0$ eigenvalues as a binary yes/no answer to whether the observable quantity $a_n$ is available as an outcome of measurement of the state $|\psi\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="197" LastActivityDate="2018-03-17T13:22:42.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1182" PostTypeId="1" AcceptedAnswerId="1203" CreationDate="2018-03-17T14:03:05.840" Score="15" ViewCount="628" Body="&lt;p&gt;Since access to quantum devices capable of quantum computing is still extremely limited, it is of interest to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/163/building-a-quantum-computer-in-simulation&quot;&gt;simulate quantum computations on a classical computer&lt;/a&gt;. Representing the state of $n$ qubits as a vector takes $2^n$ elements, which greatly restricts the number of qubits one can consider in such simulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can one use a representation&lt;sup&gt;1&lt;/sup&gt; that is more compact, in the sense that it uses less memory and/or computational power than the simple vector representation? How does it work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While easy to implement, it is clear that the vector representation is wasteful for states that exhibit sparsity and/or redundancy in their vector representation. For a concrete example, consider the 3-qubit state $(1/\sqrt{3}, 1/\sqrt{3},0,0,0,-1/\sqrt{3}, 0,0)^T$. It has $2^3$ elements but they only assume $3$ possible values, with most of the elements being $0$. Of course, to be useful in simulating a quantum computation we would also need to consider how to represent gates and the action of gates on qubits, and including something about these would be welcome, but I would be happy to hear just about qubits too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&#xA;1. Notice that I am asking about the representations, not software, libraries or articles that might utilize/present such representations. If you present and explain a representation you are very welcome to mention where it is already used though. &#xA;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="26" LastEditDate="2018-12-23T12:08:46.047" LastActivityDate="2018-12-23T12:08:46.047" Title="How to compactly represent multiple qubit states?" Tags="&lt;quantum-state&gt;&lt;simulation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1183" PostTypeId="2" ParentId="1182" CreationDate="2018-03-17T15:06:27.663" Score="9" Body="&lt;p&gt;$\newcommand{\ket}[1]{\left|#1\right&amp;gt;}$I'm not sure using sparsity is a good approach here: even single-qubit gates could easily turn a sparse state into a dense one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can use the stabilizer formalism if you only use &lt;a href=&quot;https://en.wikipedia.org/wiki/Gottesman%E2%80%93Knill_theorem&quot; rel=&quot;noreferrer&quot;&gt;Clifford gates&lt;/a&gt;. Here is a short recap (&lt;a href=&quot;https://quantumcomputing.meta.stackexchange.com/q/54/104&quot;&gt;notation&lt;/a&gt;):&lt;br&gt;&#xA;The single-qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_group&quot; rel=&quot;noreferrer&quot;&gt;Pauli group&lt;/a&gt; is $G_1=\langle X, Y, Z\rangle$, i.e. all possible products of Pauli matrices (including $\mathbb{I}$). The Pauli group of several qubits is the tensor product space of $G_1$, $G_n=G_1^{\otimes n}$. The stabilizer of a state $\ket{\psi}$ is the subgroup of the Pauli group of all operators that stabilize $\ket{\psi}$, which means $s \ket{\psi} = \ket{\psi}$. It is important to note that this only works for specific (but important) states. I will give an example below. The restriction to elements of the Pauli group is not necessary but common. The stabilizer is generated by operators $s_1$, $s_2$, ... $s_n$. The stabilizer uniquely defines the state and is an efficient description: instead of $2^n-1$ complex numbers we can use $4n^2$ bits ($G_1$ has 16 elements). When we apply a gate $U$, the stabilizer generators update according to $s_i \to U^\dagger s_i U$. A gate that maps Pauli operators to Pauli operators is called Clifford gates. So these are the gates that will not &quot;mess up&quot; our description of the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph states are an important example for the stabilizer formalism described above. Consider an (undirected) mathematical graph, which consists of $n$ vertices $V$ and edges $E\subset V\times V$. Each vertex corresponds to one qubit. Let us denote the graph by $G=(V,E)$. A graph state is produced from the state $\ket{+}^{\otimes n}$, where $\ket{+}=\frac{1}{\sqrt{2}} (\ket{0}+\ket{1})$ by applying a controlled-phase gate $C_Z$ for each pair of vertices which are connected. The stabilizer is generated by $$s_v= X_v \prod_{\substack{w\in V\\ (v,w)\in E}} Z_w.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example start with the two-qubit state $\ket{\phi}=\ket{+}\otimes \ket{+}$. The stabilizer is $\langle X\otimes \mathbb{I}, \mathbb{I}\otimes X \rangle$. Now apply the $C_Z$ gate to obtain $\langle X \otimes Z, Z \otimes X \rangle$. (The state is $\ket{\phi'}=\frac{1}{2}(1,1,1,-1)^T$, which is local unitary equivalent to a Bell state)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stabilizer formalism also plays an important role in quantum error correction.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2018-03-19T13:34:21.730" LastActivityDate="2018-03-19T13:34:21.730" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1184" PostTypeId="2" ParentId="180" CreationDate="2018-03-17T18:31:27.890" Score="5" Body="&lt;p&gt;It's a not-so-ideal-world and in short, &lt;strong&gt;architecture of quantum computers depends A LOT on the &quot;hardware&quot; used&lt;/strong&gt;. There are currently several &quot;models&quot; for physical implementation of quantum computers and all of them require considerably distinct architecture. For example superconducting quantum computers have to be kept at close to absolute zero temperature. In trapped ion quantum computers there are lasers applied to induce coupling between the qubit states. For optical quantum computers you need  linear optical elements (including beam splitters, phase shifters, and mirrors) to process quantum information, and photon detectors and quantum memories to detect and store quantum information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a list of the common architectures, as stated on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Developments&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Superconducting quantum computing (qubit implemented by the state of small superconducting circuits (Josephson junctions))&lt;/li&gt;&#xA;  &lt;li&gt;Trapped ion quantum computer (qubit implemented by the internal state of trapped ions)&lt;/li&gt;&#xA;  &lt;li&gt;Optical lattices (qubit implemented by internal states of neutral atoms trapped in an optical lattice)&lt;/li&gt;&#xA;  &lt;li&gt;Quantum dot computer, spin-based (e.g. the Loss-DiVincenzo quantum computer) (qubit given by the spin states of trapped electrons)&lt;/li&gt;&#xA;  &lt;li&gt;Quantum dot computer, spatial-based (qubit given by electron position in double quantum dot)&lt;/li&gt;&#xA;  &lt;li&gt;Nuclear magnetic resonance on molecules in solution (liquid-state NMR) (qubit provided by nuclear spins within the dissolved molecule)&lt;/li&gt;&#xA;  &lt;li&gt;Solid-state NMR Kane quantum computers (qubit realized by the nuclear spin state of phosphorus donors in silicon)&lt;/li&gt;&#xA;  &lt;li&gt;Electrons-on-helium quantum computers (qubit is the electron spin)&lt;/li&gt;&#xA;  &lt;li&gt;Cavity quantum electrodynamics (CQED) (qubit provided by the internal state of trapped atoms coupled to high-finesse cavities)&lt;/li&gt;&#xA;  &lt;li&gt;Molecular magnet (qubit given by spin states)&lt;/li&gt;&#xA;  &lt;li&gt;Fullerene-based ESR quantum computer (qubit based on the electronic spin of atoms or molecules encased in fullerenes)&lt;/li&gt;&#xA;  &lt;li&gt;Linear optical quantum computer (qubits realized by processing states of different modes of light through linear elements e.g.&#xA;  mirrors, beam splitters and phase shifters)&lt;/li&gt;&#xA;  &lt;li&gt;Diamond-based quantum computer (qubit realized by electronic or nuclear spin of nitrogen-vacancy centers in diamond)&lt;/li&gt;&#xA;  &lt;li&gt;Bose–Einstein condensate-based quantum computer&lt;/li&gt;&#xA;  &lt;li&gt;Transistor-based quantum computer – string quantum computers with entrainment of positive holes using an electrostatic trap&lt;/li&gt;&#xA;  &lt;li&gt;Rare-earth-metal-ion-doped inorganic crystal based quantum computers(qubit realized by the internal electronic state of dopants&#xA;  in optical fibers)&lt;/li&gt;&#xA;  &lt;li&gt;Metallic-like carbon nanospheres based quantum computers.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-17T19:19:57.677" LastActivityDate="2018-03-17T19:19:57.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1185" PostTypeId="1" AcceptedAnswerId="1186" CreationDate="2018-03-18T02:05:19.633" Score="26" ViewCount="1086" Body="&lt;p&gt;Most reversible quantum algorithms use standard gates like Toffoli&amp;nbsp;gate (CCNOT) or Fredkin&amp;nbsp;gate (CSWAP). Since some operations require a constant $\left|0\right&amp;gt;$ as input and the number of inputs and outputs is equal, &lt;em&gt;garbage qubits&lt;/em&gt; (or &lt;em&gt;junk qubits&lt;/em&gt;) appear in the course of the computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, a principal circuit like $\left|x\right&amp;gt;\mapsto\left|f(x)\right&amp;gt;$ actually becomes $\left|x\right&amp;gt;\left|0\right&amp;gt;\mapsto\left|f(x)\right&amp;gt;\left|g\right&amp;gt;$,&lt;br&gt;&#xA;where $\left|g\right&amp;gt;$ stands for the garbage qubit(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Circuits that preserve the original value ends up with $\left|x\right&amp;gt;\left|0\right&amp;gt;\left|0\right&amp;gt;\mapsto\left|x\right&amp;gt;\left|f(x)\right&amp;gt;\left|g\right&amp;gt;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that garbage qubits are inevitable if we want the circuit to stay reversible, but many sources${}^1$ claim that it is important to eliminate them. &lt;strong&gt;Why is it so?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;${}^1$ Due to requests for sources, see for example &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9802065.pdf&quot; rel=&quot;noreferrer&quot;&gt;this arXiv paper&lt;/a&gt;, pg 8, which says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, each of these simple operations contains a number of additional, auxiliary qubits, which serve to store the intermediate results, but are not relevant at the end. In order not to waste any unneccesary [sic] space, it is therefore important to reset these qubits to 0 so that we are able to re–use them &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or &lt;a href=&quot;https://arxiv.org/abs/1608.01228&quot; rel=&quot;noreferrer&quot;&gt;this arXiv paper&lt;/a&gt; which says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The removal of garbage qubits and ancilla qubits are essential in designing an efficient quantum circuit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or the many other sources - a &lt;a href=&quot;https://www.google.com/search?q=important+to+get+rid+of+garbage+qubits&amp;amp;rlz=1CAACAJ_enUS746US747&amp;amp;oq=important+to+get+rid+of+garbage+qubits&amp;amp;aqs=chrome..69i57j0l5.4714j0j7&amp;amp;sourceid=chrome&amp;amp;ie=UTF-8&quot; rel=&quot;noreferrer&quot;&gt;google search&lt;/a&gt; produces many hits.&lt;/p&gt;&#xA;" OwnerUserId="31" LastEditorUserId="26" LastEditDate="2018-12-23T14:20:01.843" LastActivityDate="2020-01-01T19:21:34.640" Title="Why is it important to eliminate the garbage qubits?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="1186" PostTypeId="2" ParentId="1185" CreationDate="2018-03-18T05:22:32.687" Score="25" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_interference#Quantum_interference&quot; rel=&quot;noreferrer&quot;&gt;Quantum interference&lt;/a&gt; is the heart and soul of quantum computation. Whenever you have junk qubits they're going to prevent interference. This is actually a very simple but very important point. Let's say we have a function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}\to\{0,1\}$&lt;/span&gt; which maps a single bit to a single bit. Say &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is a very simple function, like &lt;span class=&quot;math-container&quot;&gt;$f(x)=x$&lt;/span&gt;. Let's say we had a circuit &lt;span class=&quot;math-container&quot;&gt;$C_f$&lt;/span&gt; which inputs &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and outputs &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. Now, of course, this was a reversible circuit, and could be implemented using a unitary transformation &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\to|x\rangle$&lt;/span&gt;. Now, we could feed in &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt; and the output would also be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;. Let us now apply &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_transform&quot; rel=&quot;noreferrer&quot;&gt;Hadamard transform&lt;/a&gt; gate and measure what we get. If you apply the Hadamard transform to this state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;, you get the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, and you see &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. In this case there was no junk created in the intermediate steps, while converting the classical circuit to a quantum circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, let's say we created some junk in an intermediate step when using a circuit like this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3gwhz.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3gwhz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this circuit, if we start off in the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|0\rangle = \left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle \right)|0\rangle$&lt;/span&gt;, after the first step we get &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle$&lt;/span&gt;. If we apply the Hadamard transform to the first qubit, we end up with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}|00\rangle + \frac{1}{2}|01\rangle + \frac{1}{2}|10\rangle - \frac{1}{2}|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we make a measurement on the first qubit we get &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;, unlike in the previous case where we could see &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;! The only difference between the two cases was the creation of a junk bit in an intermediate step, which was not gotten rid of, thus leading to a difference in the final result of the computation (since the junk qubit got entangled with the other qubit). We will see a different interference pattern than in the previous case when the Hadamard transform is applied. This is exactly why we don't like to keep junk around when we are doing quantum computation: it prevents interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; Professor Umesh Vazirani's &lt;a href=&quot;https://www.youtube.com/watch?v=S-SmDlcvpmw&quot; rel=&quot;noreferrer&quot;&gt;lecture&lt;/a&gt; on EdX.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2020-01-01T19:21:34.640" LastActivityDate="2020-01-01T19:21:34.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1187" PostTypeId="2" ParentId="171" CreationDate="2018-03-18T09:22:08.220" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Is there proof that the D-wave (one) is a quantum computer and is effective?&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;D-Wave Video - Offers an explanation of: &quot;How do we know ...&quot;: &lt;a href=&quot;https://youtu.be/kq9VqR0ZGNc&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/kq9VqR0ZGNc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One analogy you might make with the D-Wave One, an &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_theorem#Diabatic_vs._adiabatic_processes&quot; rel=&quot;nofollow noreferrer&quot;&gt;adiabatic&lt;/a&gt; ('analog') computer, is to the &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/South-pointing_chariot#Geometrical_properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;south-pointing chariot&lt;/a&gt;&quot; or the &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Antikythera_mechanism&quot; rel=&quot;nofollow noreferrer&quot;&gt;Antikythera mechanism&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lengthy explanation is offered in this Ars Technica (Wired) article: &quot;&lt;a href=&quot;https://arstechnica.com/science/2016/06/going-digital-may-make-analog-quantum-computer-scaleable/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Going digital may make analog quantum computer scaleable&lt;/a&gt;&quot;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;... They &lt;strong&gt;pretty much&lt;/strong&gt; all fall into &lt;strong&gt;two&lt;/strong&gt; categories. In most labs, researchers work on what could be called a &lt;strong&gt;digital quantum computer&lt;/strong&gt;, which has the quantum equivalent of logic gates, and qubits are based on well-defined and well-understood quantum states. The other camp works on &lt;strong&gt;analog&lt;/strong&gt; devices called &lt;strong&gt;adiabatic quantum computers&lt;/strong&gt;. In these devices, qubits do not perform discrete operations, but continuously evolve from some easily understood initial state to a final state that provides the answer to some problem&quot; (end quote), or &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum annealing&lt;/a&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;Adiabatic quantum computers are inherently analog devices: each qubit is driven by how strongly it is coupled to every other qubit. Computation is performed by continuously adjusting these couplings between some starting and final value. Tiny errors in the coupling—due to environmental effects, for instance—tend to build up and throw off the final value.&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;Digital quantum computing, which uses logic operations and quantum gates, offers the possibility of error correction. By encoding information in multiple qubits, you can detect and correct errors. Unfortunately, digital qubits are delicate things compared to those used in adiabatic quantum computers, and the ability to ...&quot;. (Go read the article if you don't want a condensed version).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;What about a hybrid approach? That's the question asked by a international group of researchers in a recently-published paper in Nature. They’ve tested a system where the computation is performed by qubits that were operating as an adiabatic quantum computer, but with connections between the adiabatic qubits is controlled via a digital network of qubits. This allows the benefits of scale and flexibility that you get from adiabatic quantum computing, while also making the connections less susceptible to noise.&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, yes. It is a computer and uses quantum methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adiabatic quantum computation&lt;/a&gt; (AQC) is a form of quantum computing which relies on the adiabatic theorem to do calculations&lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_theorem#Diabatic_vs._adiabatic_processes&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; and is closely related to, and may be regarded as a subclass of, quantum annealing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another analogy, probably as &lt;em&gt;unfair&lt;/em&gt; as the last, is that AQC is a &lt;a href=&quot;https://en.wiktionary.org/wiki/one-trick-ponyism#English&quot; rel=&quot;nofollow noreferrer&quot;&gt;one-trick-ponyism&lt;/a&gt;. It's limited in what it can do, but it does it quickly and well.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;So, I ask:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I know that D-wave claims to use some sort of quantum annealing. Is there (dis)proof of the D-wave actually using quantum annealing (with effect) in its computations?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Has it been conclusively shown that the D-wave is (in)effective? If not, is there a clear overview of the work to attempt this?&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is  proof that  it is  effective when used correctly for doing what it was designed to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1802.10091&quot; rel=&quot;nofollow noreferrer&quot;&gt;Blockchain platform with proof-of-work based on analog Hamiltonian optimisers&lt;/a&gt;&quot; by Kirill P. Kalinin, Natalia G. Berloff, 27 Feb 2018.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;University of Cambridge, &quot;&lt;a href=&quot;http://www.damtp.cam.ac.uk/user/ngb23/polgraph.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polariton Graph Simulator (Optimizer): an analog Hamiltonian simulaton&lt;/a&gt;&quot;, Natalia Berloff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://www.spiedigitallibrary.org/conference-proceedings-of-spie/9648/964816/Performance-of-quantum-annealing-hardware/10.1117/12.2202661.short&quot; rel=&quot;nofollow noreferrer&quot;&gt;Performance of quantum annealing hardware&lt;/a&gt;&quot; by Damian S. Steiger; Bettina Heim, 22 October 2015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There exists important backers and some skeptics of D-Wave.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Address concerns expressed in comments - Update: 19 March 2018:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an article from  Nature.com entitled: &quot;&lt;a href=&quot;https://www.nature.com/articles/srep36847&quot; rel=&quot;nofollow noreferrer&quot;&gt;Triode for Magnetic Flux Quanta&lt;/a&gt;&quot; which explain the use of &lt;a href=&quot;https://en.wikipedia.org/wiki/Abrikosov_vortex&quot; rel=&quot;nofollow noreferrer&quot;&gt;Abrikosov vortices&lt;/a&gt; to hold quantized information bits, further clarified (or not) in the article: &quot;&lt;a href=&quot;https://www.nature.com/articles/ncomms9628&quot; rel=&quot;nofollow noreferrer&quot;&gt;Single Abrikosov vortices as quantized information bits&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An &lt;strong&gt;oversimplified&lt;/strong&gt; analogy is that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum qubits&lt;/a&gt; are (not at all) like &lt;a href=&quot;https://en.wikipedia.org/wiki/Magnetic-core_memory&quot; rel=&quot;nofollow noreferrer&quot;&gt;magnetic core memory&lt;/a&gt;, the difference is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A single magnetic core holds a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bit&quot; rel=&quot;nofollow noreferrer&quot;&gt;binary digit&lt;/a&gt;, a bit, (like a fraction of a letter in a book, so you would use 8 bits to represent more than just a letter but all of the &lt;a href=&quot;https://en.wikipedia.org/wiki/ASCII&quot; rel=&quot;nofollow noreferrer&quot;&gt;ASCII&lt;/a&gt; Alphabet, letters digits and control codes). A bit would have to be in one state or the other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A qubit, by utilizing quantum mechanics, allows the qubit to be in a superposition of both states at the same time, a property that is fundamental to quantum computing. A qbit can be in one state, the other, or both; think of it as &lt;a href=&quot;https://en.wikipedia.org/wiki/Ternary_numeral_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;trinary&lt;/a&gt; on steroids, because qubits can perform two calculations simultaneously (and that's why they are both comparable and incomparable, a superposition of both states; a new way if thinking).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Look at this image of a magnetic memory and a quantum processor - quite different from an x86 processor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E7fRe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E7fRe.jpg&quot; alt=&quot;Which is which?&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple explanation of the relevance and degree of proof is offered in this video by D-Wave called: &quot;D-Wave Lab Tour Part 3 (of 3) - The D-Wave Processor&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=AGByZoYUlU0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=AGByZoYUlU0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2018-04-03T16:02:14.413" LastActivityDate="2018-04-03T16:02:14.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1188" PostTypeId="5" CreationDate="2018-03-18T14:36:55.763" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-18T14:36:55.763" LastActivityDate="2018-03-18T14:36:55.763" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1189" PostTypeId="4" CreationDate="2018-03-18T14:36:55.763" Score="0" Body="For questions about security aspects relevant to quantum computing." OwnerUserId="11" LastEditorUserId="26" LastEditDate="2018-04-15T15:03:53.160" LastActivityDate="2018-04-15T15:03:53.160" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1190" PostTypeId="5" CreationDate="2018-03-18T14:39:21.350" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-18T14:39:21.350" LastActivityDate="2018-03-18T14:39:21.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1191" PostTypeId="4" CreationDate="2018-03-18T14:39:21.350" Score="0" Body="For questions asking about applications of quantum computers to solve practical problems." OwnerUserId="11" LastEditorUserId="26" LastEditDate="2019-01-01T09:40:03.700" LastActivityDate="2019-01-01T09:40:03.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1192" PostTypeId="1" AcceptedAnswerId="1199" CreationDate="2018-03-18T21:53:20.003" Score="15" ViewCount="725" Body="&lt;p&gt;Daniel Sank mentioned in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/171/is-there-proof-that-the-d-wave-one-is-a-quantum-computer-and-is-effective/172?noredirect=1#comment426_172&quot;&gt;a comment&lt;/a&gt;, responding to (my) opinion that the &lt;em&gt;constant&lt;/em&gt; speed-up of $10^8$ on a problem admitting a polynomial time algorithm is meager, that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Complexity theory is way too obsessed with infinite size scaling limits. What matters in real life is how fast you get the answer to your problem. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In Computer Science, it is common to ignore constants in algorithms, and all in all, this has turned out to work rather well. (I mean, there &lt;em&gt;are&lt;/em&gt; good and &lt;em&gt;practical&lt;/em&gt; algorithms. I hope you will grant me (theoretical) algorithms researchers have had a rather large hand in this!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I do understand that this is a slightly different situation as now we are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Not comparing two algorithms running on the same computer, but two (slightly) different algorithms on two &lt;em&gt;very different&lt;/em&gt; computers.&lt;/li&gt;&#xA;&lt;li&gt;We now are working with &lt;em&gt;quantum&lt;/em&gt; computers, for which perhaps traditional perfomance measurements may be insufficient.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In particular, the methods of algorithm analysis are merely &lt;em&gt;methods&lt;/em&gt;. I think radically new computing methods calls for a critical review of our current performance evaluation methods!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When comparing the performance of algorithms on a quantum computer versus algorithms on a classical computer, is the practice of 'ignoring' constants a good practice?&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2018-03-29T18:12:47.570" LastActivityDate="2019-01-19T21:57:50.217" Title="Is the common Computer Science usage of 'ignoring constants' useful when comparing classical computing with quantum computing?" Tags="&lt;algorithm&gt;&lt;performance&gt;&lt;classical-computing&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1193" PostTypeId="5" CreationDate="2018-03-18T22:18:31.000" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-18T22:18:31.000" LastActivityDate="2018-03-18T22:18:31.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1194" PostTypeId="4" CreationDate="2018-03-18T22:18:31.000" Score="0" Body="For questions about the relation between quantum computing and classical computing, such as their relative performance." OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-01-01T08:52:47.680" LastActivityDate="2019-01-01T08:52:47.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1195" PostTypeId="1" AcceptedAnswerId="1211" CreationDate="2018-03-19T02:39:58.017" Score="12" ViewCount="490" Body="&lt;p&gt;Presently, how much information can a quantum computer store, in how many qubits? What restrictions are there and how does it vary across realizations (efficiency of data storage, ease of reading and writing, etc)?&lt;/p&gt;&#xA;" OwnerUserId="92" LastEditorUserId="26" LastEditDate="2018-12-13T19:37:06.997" LastActivityDate="2018-12-13T19:37:06.997" Title="State of the art in quantum memory" Tags="&lt;quantum-memory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1196" PostTypeId="1" AcceptedAnswerId="1242" CreationDate="2018-03-19T05:50:31.297" Score="16" ViewCount="347" Body="&lt;p&gt;I'm interested in the model of quantum computation by magic state injection, that is where we have access to the Clifford gates, a cheap supply of ancilla qubits in the computational basis, and a few expensive-to-distill &lt;em&gt;magic states&lt;/em&gt; (usually those that implement S, T gates). I've found that the best scaling is logarithmic in the accuracy $\varepsilon$, specifically $O(\log^{1.6}(1/\varepsilon)$ is what a &lt;a href=&quot;https://arxiv.org/pdf/1209.2426.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2012 paper offers&lt;/a&gt; to get the accuracy we need in the $S,T$ states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this enough to calculate most of the problems we're interested in? Are there any problems that specifically resist QCSI (Quantum Computation by State Injection) because of high overhead, but are more solvable in other models of computation?&lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="26" LastEditDate="2018-12-14T06:04:32.627" LastActivityDate="2018-12-14T06:04:32.627" Title="How does magic state distillation overhead scale compare to quantum advantages?" Tags="&lt;error-correction&gt;&lt;speedup&gt;&lt;state-distillation&gt;&lt;state-injection-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1197" PostTypeId="5" CreationDate="2018-03-19T10:11:25.630" Score="0" Body="&lt;p&gt;As per the paper &lt;a href=&quot;https://arxiv.org/abs/1401.2910&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Defining and detecting quantum speedup&lt;/em&gt;&lt;/a&gt;, the definition of quantum speedup has a few variants:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Device dependent definition&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Denoting the time for a specific implementation of an algorithm on a classical device to solve a problem of size $N$ as $C\left(N\right)$ and the time for a specific implementation of an algorithm on a quantum device as $Q\left(N\right)$, the first definition of quantum speedup is $$S\left(N\right) = \frac{C\left(N\right)}{Q\left(N\right)}$$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Device independent definitions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Here, independent of devices, a classical algorithm is compared with a quantum algorithm and speedup is the same ratio as for 1. comparing the quantum algorithm, taking time $Q\left(N\right)$, with the classical algorithm, taking time $C\left(N\right)$.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Provable quantum speedup&lt;/strong&gt;:&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;there exists a proof that no classical algorithm can outperform a given quantum algorithm&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Strong quantum speedup&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;using the performance of the best classical algorithm ... whether  such  an  algorithm  is  known  or  not&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum speedup&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;comparing to the&#xA;  best available&#xA;  classical algorithm instead of the best possible classical&#xA;  algorithm&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Potential quantum speedup&lt;/strong&gt;:&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;compared to a specific classical algorithm or a set of classical algorithms&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Limited  quantum speedup&lt;/strong&gt;:&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;comparing specifically with classical algorithms that “correspond” to the quantum algorithm in the sense that they implement the same  algorithmic  approach,  but  on  classical  hardware.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;e.g. comparing &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum annealing&lt;/a&gt; with &lt;a href=&quot;https://en.wikipedia.org/wiki/Simulated_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;simulated annealing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-19T14:06:09.000" LastActivityDate="2018-03-19T14:06:09.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1198" PostTypeId="4" CreationDate="2018-03-19T10:11:25.630" Score="0" Body="For questions about either: comparing the performance of a quantum algorithm with a classical algorithm (or set of classical algorithms) independent of devices; or  the ratio of time to solution of a quantum device running a specific algorithm to a classical device running a specific algorithm." OwnerUserId="23" LastEditorUserId="26" LastEditDate="2019-01-01T08:49:29.310" LastActivityDate="2019-01-01T08:49:29.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1199" PostTypeId="2" ParentId="1192" CreationDate="2018-03-19T11:35:37.937" Score="10" Body="&lt;p&gt;The common Computer Science usage of 'ignoring constants' is only useful where the differences in performance of various kinds of hardware architecture or software can be ignored with a little bit of massaging. But even in classical computation, it is important to be aware of the impact of architecture (caching behaviour, hard disk usage) if you want to solve difficult problems, or large problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The practise of ignoring constants isn't a practise which is motivated (in the sense of being continually affirmed) from an implementation point of view. It is driven mostly by an interest in an approach to the study of algorithms which is well-behaved under composition and admits simple characterisations, in a manner close to pure mathematics. The speed-up theorems for Turing Machines meant that any sensible definition couldn't attempt to pin down the complexity of problems too precisely in order to arrive at a sensible theory; and besides, in the struggle to find good algorithms for difficult problems, the constant factors weren't the mathematically interesting part...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This more abstract approach to the study of algorithms was and is largely fruitful. But now we are confronted with a situation where we have two models of computation, where &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One is in an advanced state of technological maturity (classical computation); and&lt;/li&gt;&#xA;&lt;li&gt;One is in a very immature state, but is attempting to realise a theoretical model which can lead to significant asymptotic improvements (quantum computation).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In this case, we can ask whether it even makes sense to consider the asymptotic benefit, &lt;em&gt;with or without&lt;/em&gt; careful accounting of the constant factors. Because of the extra effort which may be required to perform scalable quantum computing, not only scalar factors but &lt;em&gt;polynomial&lt;/em&gt; &quot;speedups&quot; in theoretical performance may be washed out once all of the overhead in realising a quantum algorithm is taken into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In these early days, there may also be significant differences in performance to different approaches to quantum architecture.&#xA;This could make the choice of architecture as important (if not more important) to how well an algorithm performs than asymptotic analysis &amp;mdash; just as it would matter a lot to you whether you do your conventional computation on a von Neumann machine or a highly distributed network with significant latencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actually important thing for practical computation is &amp;mdash; and has always been &amp;mdash; not just algorithms, but &lt;em&gt;implementations of algorithms&lt;/em&gt;: an algorithm realised in a certain way, on a certain architecture. The common practise of asymptotic analysis which ignores constant factors allows us to pay attention to the systematic, mathematical reasons for differences in the performance of algorithms, and is practically motivated on those occasions when the architectural differences are not so large as to dominate the practical performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to quantum technologies, we are not in that happy situation where we can safely gloss over constant factors in any practical context. But perhaps one day we will be able to do so. This is the long game of quantum information technologies &amp;mdash; until now, nearly the only game that academic computer scientists have ever played, as far as quantum information technology is concerned. Anticipating that day when quantum technology finds its footing, it will be good for us to continue pursuing asymptotic analysis, as &lt;em&gt;one line of investigation&lt;/em&gt; in the performance of quantum algorithms.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-03-27T17:10:38.717" LastActivityDate="2018-03-27T17:10:38.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1200" PostTypeId="2" ParentId="1192" CreationDate="2018-03-19T11:53:58.923" Score="5" Body="&lt;p&gt;First, there are no scaling analyses of quantum devices like we have for algorithms on CMOS hardware. So talking about $O\left(f\left[N\right]\right)$ is flawed. Second, given the lack of theoretical backing, we have to do scaling analyses with experiments. However, the currently accessible problem sizes ($N$) are rather limited. As such, we do not even know if we are in the asymptotic limit (&quot;the true behavior of the device&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, neglecting prefactors (i.e. constant factors) might be premature. Purists will argue that only an improvement in the scaling (&quot;change in slope&quot;) is true speedup. I agree, however, if your quantum device scales as well as the best classical algorithms yet has a $10^{10}$ prefactor, I would call it useful for applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the current state of the art is D-Wave scaling as good as the best algorithms, but with only a $\approx300$ factor advantage over code run on a &lt;em&gt;single&lt;/em&gt; core. Moreover, this is a synthetic benchmark problem and not an application of interest. Far from disruptive... See &lt;a href=&quot;https://arxiv.org/abs/1711.01368&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1711.01368&lt;/a&gt; for more information.&lt;/p&gt;&#xA;" OwnerDisplayName="user306" LastEditorUserId="23" LastEditDate="2018-03-19T14:54:12.853" LastActivityDate="2018-03-19T14:54:12.853" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1202" PostTypeId="2" ParentId="180" CreationDate="2018-03-19T12:17:14.957" Score="4" Body="&lt;p&gt;At the current state of the art, quite a bit.&#xA;As pointed out by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1184/55&quot;&gt;the other answer&lt;/a&gt;, different architectures implement qubits in different physical substrates, which results in radically different techniques to generate, evolve, interact and measure the qubits.&#xA;Moreover, different operations are easier in some architectures than in others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get something more similar to how we usually program classical computers one needs some kind of &lt;em&gt;compilation pipeline&lt;/em&gt;, mapping a given computation, expressed in an abstract high-level language, down to the specific hardware details of a given architecture.&#xA;This is still a work in progress, but there are people working in this direction. A relevant work that comes to mind is &lt;a href=&quot;https://arxiv.org/abs/1604.01401.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1604.01401&lt;/a&gt;. Here is the pipeline proposed in this paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6kV3L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6kV3L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, having software suites implementing such a pipeline would allow to write abstract code and have automatically compiled down to work on, say, superconducting chips as well as optical or ion-trap quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, there are so many things to still work out (first of all how to actually make scalable quantum computers) that it is hard to say how such scheme will work.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-03-19T12:17:14.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1203" PostTypeId="2" ParentId="1182" CreationDate="2018-03-19T13:08:47.433" Score="8" Body="&lt;p&gt;There are many possible ways to compactly represent a state, the usefulness of which strongly depend on the context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, it is important to notice that it is not possible to have a procedure that can map any state into a more efficient representation of the same state (for the same reason why it is obviously not possible to faithfully compress any 2-bit string as a 1-bit string, with a mapping that does not depend on the string).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as soon as you start making some assumptions, you can find more efficient ways to represent a state in a given context.&#xA;There is a multitude of possible ways to do this, so I'll just mention a few that come to mind:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Already the standard vector representation of a ket state can be thought of as a &quot;compressed representation&quot;, that works under the assumption of the state being &lt;em&gt;pure&lt;/em&gt;. Indeed, you need $4^n-1$ real degrees of freedom to represent an arbitrary (generally mixed) $n$-qubit state, but only $2^{n+1}-2$ to represent a pure one.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you assume a state $\rho$ to be &lt;em&gt;almost&lt;/em&gt; pure, that is, such that $\rho$ is sparse in some representation (equivalently, $\rho$ is low rank), then again the state can be efficiently characterised. For a $d$-dimensional system (so $d=2^n$ for an $n$-qubit system), instead of using ~$d^2$ parameters, you can have a faithful representation using only $\mathcal O(r d \log^2 d)$, where $r$ is the sparsity of the state (see &lt;a href=&quot;https://arxiv.org/abs/0909.3304&quot; rel=&quot;nofollow noreferrer&quot;&gt;0909.3304&lt;/a&gt; and the works that came after that).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are only interested in a limited number $|S|$ of expectation values, you can find a compressed representation of an $n$-qubit state of size $\mathcal O(n\log(n)\log(|S|))$. Note that this amounts to an &lt;em&gt;exponential reduction&lt;/em&gt;.  This was shown (I think) in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0402095&quot; rel=&quot;nofollow noreferrer&quot;&gt;quant-ph/0402095&lt;/a&gt;, but the introduction given in &lt;a href=&quot;https://arxiv.org/pdf/1801.05721.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1801.05721&lt;/a&gt; may be more accessible for a physicist (as well as presenting improvements in the optimisation method).&#xA;See references in this last paper for a number of similar results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you know that the entanglement of the state is limited (in a sense that can be precisely defined), then again efficient representations can be found, in terms of tensor networks (an introduction is found e.g. in &lt;a href=&quot;https://arxiv.org/abs/1708.00006&quot; rel=&quot;nofollow noreferrer&quot;&gt;1708.00006&lt;/a&gt;). More recently, it was also shown that ground states of some notable Hamiltonians can be represented using &lt;a href=&quot;https://arxiv.org/abs/1606.02318&quot; rel=&quot;nofollow noreferrer&quot;&gt;machine-learning-inspired ansatze&lt;/a&gt; ( (&lt;a href=&quot;https://arxiv.org/abs/1606.02318&quot; rel=&quot;nofollow noreferrer&quot;&gt;1606.02318&lt;/a&gt; and many following works). This was also recently shown/claimed to be equivalent to a specific Tensor Network representation however (&lt;a href=&quot;https://arxiv.org/abs/1710.04045&quot; rel=&quot;nofollow noreferrer&quot;&gt;1710.04045&lt;/a&gt;) so I'm not sure whether it should go to a category of its own.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that in all of the above you can more efficiently represent a given state, but to then simulate the &lt;em&gt;evolution&lt;/em&gt; of the system you generally need do go back to the original inefficient representation.&#xA;If you want to efficiently represent the &lt;em&gt;dynamics&lt;/em&gt; of a state through a given evolution, you again need assumptions on the evolution for this to be possible.&#xA;The only result that comes to mind on this regard is the classical (as in enstablished, not as in &quot;non quantum&quot;) &lt;a href=&quot;https://en.wikipedia.org/wiki/Gottesman%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman-Knill theorem&lt;/a&gt;, which allows to efficiently simulate any Clifford quantum circuit.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-04-05T09:15:38.153" LastActivityDate="2018-04-05T09:15:38.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1206" PostTypeId="1" CreationDate="2018-03-19T16:31:15.507" Score="25" ViewCount="1955" Body="&lt;p&gt;To represent a quantum computer's state, all the qubits contribute to one state vector (this is one of the major differences between quantum and classical computing as I understand it). My understanding is that it's possible to measure only one qubit out of a system of multiple qubits. How does measuring that one qubit affect the whole system (specifically, how does it affect the state vector)?&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-09-01T03:38:18.393" Title="How does measurement of one qubit affect the others?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1207" PostTypeId="2" ParentId="1206" CreationDate="2018-03-19T17:02:13.503" Score="17" Body="&lt;p&gt;There are a lot of different ways of looking at qubits, and the state vector formalism is just one of them. In a general linear-algebraic sense a measurement is projection onto a basis. Here I will provide insight with an example from the Pauli observable point of view, that is the usual circuit model of QC. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, it's of interest which basis the state vector is being provided in-- every measurement operator comes with a set of eigenstates, and whatever measurements you look at (eg. $X,Y,Z, XX, XZ$, etc.) determine the basis that might be best for you to write the state vector in. The easiest way to answer your question is if you know which basis is of interest to you, and more importantly, &lt;em&gt;whether it commutes with the measurement you just made&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for simplicity's sake, let's say you start with two coupled qubits in an arbitrary state written in the $Z$-basis for both qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$| \psi \rangle = a | 0_{Z} \rangle \otimes | 0_{Z} \rangle +b | 0_{Z} \rangle \otimes | 1_{Z} \rangle + c | 1_{Z} \rangle \otimes | 0_{Z} \rangle  + d | 1_{Z} \rangle \otimes | 1_{Z} \rangle $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest possible measurements you could make would be $Z_{1}$, that is the $Z$ operator on the first qubit, followed by $Z_{2}$, the $Z$ operator on the second qubit. What does measurement do? It projects the state into one of the eigenstates. You can think of this as eliminating all possible answers that are inconsistent with the one we just measured. For instance, say we measure $Z_{1}$ and obtain the outcome $1$, then the resulting state we would have would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$| \psi \rangle = \frac{1}{\sqrt{|c|^{2} +|d|^{2}}} \left(c | 1_{Z} \rangle \otimes | 0_{Z} \rangle  + d | 1_{Z} \rangle \otimes | 1_{Z} \rangle \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the coefficient out front is just for renormalization. So our probability of measuring $Z_{2}=0$ is $\frac{1}{|c|^{2} +|d|^{2}} |c^{2}|$. Note this is different from the probability we had in the initial state, which was $|a|^{2}+|c|^{2}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the next measurement you make does not commute with the previous one, however. This is trickier because you have to implement a change of basis on the state vector in order to understand the probabilities. With Pauli measurements, though, it tends to be easy since the eigenbases relate in a nice way, that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$| 0_{Z} \rangle = \frac{1}{\sqrt{2}} (|0_{X}\rangle + |1_{X} \rangle )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$| 1_{Z} \rangle = \frac{1}{\sqrt{2}} (|0_{X}\rangle - |1_{X} \rangle )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to check your understanding: What is the probability of measuring $X= +1$ after the $Z_{1}=1$ measurement above? What is the probability if we have not made the $Z_{1}$ measurement? Then a more complicated question is to look at product operators that act on both qubits at once, for instance, how does a measurement of $Z_{1}Z_{2}=+1$ affect the initial state? Here $Z_{1}Z_{2}$ measures the product of the two operators. &lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="104" LastEditDate="2018-03-20T15:57:08.703" LastActivityDate="2018-03-20T15:57:08.703" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1208" PostTypeId="1" CreationDate="2018-03-19T18:06:32.863" Score="25" ViewCount="1253" Body="&lt;p&gt;A lot of people believe that quantum computers can prove to be a pivotal step in creating new machine learning and AI algorithms that can give a huge boost to the field. There have even been studies that our brain may be a quantum computer, but so far there is no consensus among the researchers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that I am completely new to the field, I wanted to know if there has been some research done in the application of quantum computers in AI that, theoretically speaking, may perform better at some task or converge faster than modern deep learning algorithms.&lt;/p&gt;&#xA;" OwnerUserId="320" LastEditorUserId="55" LastEditDate="2020-09-01T22:26:59.073" LastActivityDate="2020-09-01T22:26:59.073" Title="Is there any potential application of quantum computers in machine learning or AI?" Tags="&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;artificial-intelligence&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="1209" PostTypeId="2" ParentId="1208" CreationDate="2018-03-19T18:34:24.690" Score="6" Body="&lt;p&gt;There are arguments that our brains are quantum mechanical, and arguments against, so that's a hotly debated topic. Fisher at UCSB has some speculative thinking about how brains might still use quantum effects even though they aren't quantum mechanical in nature. While there's no direct experimental evidence there are two references you might want to read:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1508.05929.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Cognition: The possibility of processing with nuclear spins in the brain&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.worldscientific.com/doi/pdf/10.1142/S0217979217430019&quot; rel=&quot;nofollow noreferrer&quot;&gt;Are we quantum computers, or merely clever robots?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, on the subject of using quantum computing and machine learning, Rigetti Computing has demonstrated a clustering algorithm using their prototype quantum chips (19 qubits). They published their findings in a white paper on arXiv.org here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1712.05771&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unsupervised Machine Learning on a Hybrid Quantum Computer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So there's clearly an opportunity to advance machine learning, and eventually, AI using quantum computing imho.&lt;/p&gt;&#xA;" OwnerUserId="274" LastEditorUserId="15" LastEditDate="2018-03-20T02:11:39.083" LastActivityDate="2018-03-20T02:11:39.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1210" PostTypeId="2" ParentId="75" CreationDate="2018-03-19T20:46:46.157" Score="4" Body="&lt;p&gt;I believe that the Centre for Engineered Quantum Systems, School of Physics, The University of Sydney and the Center for Theoretical Physics, Massachusetts Institute of Technology use of a tensor network decoder of Bravyi, Suchara and Vargo (BSV), to achieve the highest error correction threshold to date. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In their whitepaper from last December, &lt;a href=&quot;https://arxiv.org/pdf/1708.08474.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Ultrahigh Error Threshold for Surface Codes with Biased Noise&quot;&lt;/a&gt;, the use of a tensor network decoder resulted in pure $Z$ noise of $p_c=43.7\left(1\right)\%$, which is a fourfold increase over the previous optimal surface code threshold for pure $Z$ noise of $10.9\%$. The $10.9\%$ number comes from S. Bravyi, M. Suchara, and A. Vargo, &lt;a href=&quot;https://arxiv.org/abs/1405.4883&quot; rel=&quot;nofollow noreferrer&quot;&gt;“Efficient algorithms for maximum likelihood decoding in the surface code”&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="274" LastEditorUserId="15" LastEditDate="2018-03-22T00:07:31.533" LastActivityDate="2018-03-22T00:07:31.533" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1211" PostTypeId="2" ParentId="1195" CreationDate="2018-03-19T22:10:09.547" Score="6" Body="&lt;p&gt;Unfortunately the state of the technology regarding memories is not as developed as you seem to expect. When we talk about a memory, we think of a device that can store information for an infinite amount of time (for all practical purposes). So before we can think about the size of the memory in a quantum computer, we should look at whether a single quantum memory has been built. There is a lot of progress in this direction, but to my knowledge the &lt;a href=&quot;https://www.nature.com/articles/nature14025&quot; rel=&quot;noreferrer&quot;&gt;currently best &quot;memory&quot;&lt;/a&gt; achieved a coherence time of about 6 hours (which is amazing, but still not what we are used from classical computers). Although the fidelity of the retrieved state is in the high nineties, the success probability for storage and readout is very low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also work on using error correction codes to built a memory, but those approaches do not give better results so far.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2018-03-19T22:10:09.547" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1212" PostTypeId="2" ParentId="1206" CreationDate="2018-03-19T22:41:47.840" Score="8" Body="&lt;p&gt;Suppose that, prior to measurement, your $n$-qubit system is in some state $\lvert \psi \rangle \in \mathcal H_2^{\otimes n}$, where $\mathcal H_2 \cong \mathbb C^2$ is the Hilbert space of a single qubit. Write&#xA;$$ \lvert \psi \rangle = \sum_{x \in \{0,1\}^n} u_x \lvert x \rangle $$&#xA;for some coefficients $u_x \in \mathbb C$ such that $\sum_x \lvert u_x \rvert^2 = 1$.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are measuring the first qubit in the standard basis, define&#xA;$$\begin{aligned} \lvert \varphi_0 \rangle &amp;amp;= \!\!\!\!\!\sum_{x' \in \{0,1\}^{n-1}}\!\!\!\!\!\! u_{0x'} \,\lvert0\rangle \lvert x' \rangle,  \\  \lvert \varphi_1 \rangle &amp;amp;= \!\!\!\!\!\sum_{x' \in \{0,1\}^{n-1}}\!\!\!\!\!\! u_{1x'} \,\lvert1\rangle \lvert x' \rangle,\end{aligned}$$ and let $\lvert \psi_0 \rangle = \lvert \varphi_0 \rangle \big/\! \sqrt{\langle \varphi_0 \vert \varphi_0 \rangle}\,$ and $\,\lvert \psi_1 \rangle = \lvert \varphi_1 \rangle \big/\! \sqrt{\langle \varphi_1 \vert \varphi_1 \rangle}\,$. It is not too difficult to show that, if you measure the first qubit and obtain the state $\lvert 0 \rangle$, the state of the entire system &quot;collapses&quot; to $\lvert \psi_0 \rangle$, and if you obtain $\lvert 1 \rangle$ what you obtain is $\lvert \psi_1 \rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is broadly analogous to the idea of conditional probability distributions: you might think of $\lvert \psi_0 \rangle$ as the state of the system conditioned on the first qubit being $\lvert 0 \rangle$, and $\lvert \psi_1 \rangle$ as the state of the system conditioned on the first qubit being $\lvert 1 \rangle$ (except of course that the story is a bit more complicated, on account of the fact that the first qubit is not &quot;secretly&quot; in either the state $0$ or $1$).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The above is not strongly dependent on measuring the first qubit: we can define $\lvert \varphi_0 \rangle$ and $\lvert \varphi_1 \rangle$ in terms of fixing any particular bit in the bit string $x$ to either $0$ or $1$, summing over only those components which are consistent with either the choice $0$ or $1$, and proceeding as above.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The above is also not strongly dependent on measuring in the standard basis, as Emily indicates. If we wish to consider measuring the first qubit in the basis $\lvert \alpha \rangle, \lvert \beta  \rangle$, where $\lvert \alpha \rangle = \alpha_0 \lvert 0 \rangle + \alpha_1 \lvert 1 \rangle$ and $\lvert \beta \rangle = \beta_0 \lvert 0 \rangle + \beta_1 \lvert 1 \rangle$, we define&#xA;$$\begin{aligned} \lvert \varphi_0 \rangle &amp;amp;= \Bigl(\lvert \alpha \rangle\!\langle \alpha \lvert \otimes I^{\otimes n-1}\Bigr)\lvert \psi\rangle =  \!\!\!\!\!\sum_{x' \in \{0,1\}^{n-1}}\!\!\!\!\!\! \bigl(\alpha_0^\ast u_{0x'} + \alpha_1^\ast u_{1x'}\bigr) \,\lvert\alpha\rangle \lvert x' \rangle\,,  \\  \lvert \varphi_1 \rangle &amp;amp;= \Bigl(\lvert \beta\rangle\!\langle \beta \lvert \otimes I^{\otimes n-1}\Bigr)\lvert \psi\rangle =  \!\!\!\!\!\sum_{x' \in \{0,1\}^{n-1}}\!\!\!\!\!\! \bigl(\beta_0^\ast u_{0x'} + \beta_1^\ast u_{1x'}\bigr) \,\lvert\beta\rangle \lvert x' \rangle\,, \end{aligned}$$&#xA;and then proceeding as above.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-03-20T14:23:13.823" LastActivityDate="2018-03-20T14:23:13.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1213" PostTypeId="1" AcceptedAnswerId="1220" CreationDate="2018-03-19T23:00:47.297" Score="14" ViewCount="246" Body="&lt;p&gt;I understand that there is a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;noreferrer&quot;&gt;constructive proof&lt;/a&gt; that arbitrary gates can be approximated by a finite universal gate set, which is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Solovay%E2%80%93Kitaev_theorem&quot; rel=&quot;noreferrer&quot;&gt;Solovay–Kitaev Theorem&lt;/a&gt;.&lt;br&gt;&#xA;However, the approximation introduces an error, which would spread and accumulate in a long computation. This would presumably scale badly with the length of the calculation? Possibly one might apply the approximation algorithm to the complete circuit as a whole, not to a single gate. But how does this scale with the length of the computation (i.e. how does the approximation scale with the dimension of the gates)? How does the gate approximation relate to gate synthesis? Because I could imagine that this affects the final length of the computation?&lt;br&gt;&#xA;Even more disturbing to me: What happens if the length of the calculation is not known at the time when the gate sequence is compiled?&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="26" LastEditDate="2019-01-01T08:40:19.957" LastActivityDate="2019-01-01T08:40:19.957" Title="How does approximating gates via universal gates scale with the length of the computation?" Tags="&lt;gate-synthesis&gt;&lt;universal-gates&gt;&lt;fault-tolerance&gt;&lt;noise&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1214" PostTypeId="5" CreationDate="2018-03-20T00:08:00.113" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-20T00:08:00.113" LastActivityDate="2018-03-20T00:08:00.113" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1215" PostTypeId="4" CreationDate="2018-03-20T00:08:00.113" Score="0" Body="For questions about finding (short) gate sequences to implement a specific unitary operation, for example decomposing a complicated multi-qubit gate into a sequence of basic gates. It might apply to optimizing circuits with respect to length or depth or finding gate sequences to implement an algorithm. " OwnerUserId="104" LastEditorUserId="3" LastEditDate="2018-03-20T16:04:50.717" LastActivityDate="2018-03-20T16:04:50.717" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1216" PostTypeId="5" CreationDate="2018-03-20T00:12:57.353" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-20T00:12:57.353" LastActivityDate="2018-03-20T00:12:57.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1217" PostTypeId="4" CreationDate="2018-03-20T00:12:57.353" Score="0" Body="For questions about achieving (almost) perfect logical operations with imperfect gates. The tag also applies to questions about the amount of tolerable noise in a quantum circuit, as well as designing circuits to prevent errors from spreading." OwnerUserId="104" LastEditorUserId="26" LastEditDate="2019-01-01T09:32:28.860" LastActivityDate="2019-01-01T09:32:28.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1218" PostTypeId="2" ParentId="135" CreationDate="2018-03-20T01:54:13.660" Score="9" Body="&lt;p&gt;Suppose a function $f\colon {\mathbb F_2}^n \to {\mathbb F_2}^n$ has the following curious property: There exists $s \in \{0,1\}^n$ such that $f(x) = f(y)$ if and only if $x + y = s$.  If $s = 0$ is the only solution, this means $f$ is 1-to-1; otherwise there is a nonzero $s$ such that $f(x) = f(x + s)$ for all $x$, which, because $2 = 0$, means $f$ is 2-to-1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the cost to any prescribed probability of success, on a classical or quantum computer, of distinguishing a uniform random 1-to-1 function from a uniform random 2-to-1 function satisfying this property, if each option (1-to-1 or 2-to-1) has equal probability?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I.e.,&lt;/em&gt; I secretly flip a coin fairly; if I get heads I hand you a black box (classical or quantum, resp.) circuit for a uniform random 1-to-1 function $f$, whereas if I get tails I hand you a black box circuit for a uniform random 2-to-1 function $f$.  How much do you have to pay to get a prescribed probability of success $p$ of telling whether I got heads or tails?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the scenario of &lt;a href=&quot;https://en.wikipedia.org/wiki/Simon&amp;#39;s_problem&quot; rel=&quot;noreferrer&quot; title=&quot;Wikipedia: Simon&amp;#39;s problem.  Retrieved 2018-03-19.&quot;&gt;Simon's algorithm&lt;/a&gt;.  It has esoteric applications in &lt;a href=&quot;https://eprint.iacr.org/2017/767&quot; rel=&quot;noreferrer&quot; title=&quot;Xavier Bonnetain, ‘Quantum Key-Recovery on full AEZ’, IACR Cryptology ePrint Archive: Report 2017/767, 2017-08-08.&quot;&gt;nonsensical cryptanalysis&lt;/a&gt;,&lt;sup&gt;*&lt;/sup&gt; and it was an early instrument in studying the complexity classes BQP and BPP and an early inspiration for Shor's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simon presented a &lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.51.5477&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot; title=&quot;Daniel R. Simon, ‘On the Power of Quantum Computation’, in Proceedings of the 35th Annual Symposium on Foundations of Computer Science 1996, pp. 116–123.&quot;&gt;quantum algorithm&lt;/a&gt; (§3.1, p. 7) that costs $O(n + |f|)$ qubits and expected $O(n \cdot T_f(n) + G(n))$ time for probability near 1 of success, where $T_f(n)$ is the time to compute a &lt;em&gt;superposition&lt;/em&gt; of values of $f$ on an input of size $n$ and where $G(n)$ is the time to solve an $n \times n$ system of linear equations in $\mathbb F_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simon further sketched a &lt;a href=&quot;http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.51.5477&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot; title=&quot;Daniel R. Simon, ‘On the Power of Quantum Computation’, in Proceedings of the 35th Annual Symposium on Foundations of Computer Science 1996, pp. 116–123.&quot;&gt;proof&lt;/a&gt; (Theorem 3.1, p. 9) that a classical algorithm evaluating $f$ at no more than $2^{n/4}$ distinct &lt;em&gt;discrete&lt;/em&gt; values cannot guess the coin with advantage better than $2^{-n/2}$ over a uniform random guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some sense, this answers your question positively: A quantum computation requiring a &lt;em&gt;linear&lt;/em&gt; number of evaluations of random function on a &lt;em&gt;quantum superposition&lt;/em&gt; of inputs can attain much better success probability than a classical computation requiring an &lt;em&gt;exponential&lt;/em&gt; number of evaluations of a random function on &lt;em&gt;discrete inputs&lt;/em&gt;, in the size of the inputs.  But in another sense it doesn't answer your question at all, because it could be that for &lt;em&gt;every particular&lt;/em&gt; function $f$ there is a faster way to compute the search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;noreferrer&quot; title=&quot;Wikipedia: Deutsch–Jozsa algorithm.  Retrieved 2018-03-19.&quot;&gt;Deutsch–Jozsa algorithm&lt;/a&gt; serves as a similar illustration for a slightly different artificial problem to study different complexity classes, P and EQP, figuring out the details of which is left as an exercise for the reader.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;sup&gt;*&lt;/sup&gt; Simon's is nonsensical for cryptanalysis because only an inconceivably confused idiot would feed their secret key into the adversary's quantum circuit to use on a quantum superposition of inputs, but for some reason it makes a splash every time someone publishes a new paper on using Simon's algorithm to break idiots' keys with imaginary hardware, which is how all these attacks work.  Exception: It is possible that this might break &lt;em&gt;white-box&lt;/em&gt; cryptography, but the security story for white-box cryptography even against classical adversaries is not promising.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="238" LastEditorUserId="238" LastEditDate="2018-04-07T04:54:48.500" LastActivityDate="2018-04-07T04:54:48.500" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1219" PostTypeId="2" ParentId="1182" CreationDate="2018-03-20T02:21:59.580" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can one use a representation that is more compact, in the sense that it uses less memory and/or computational power than the simple vector representation? How does it work?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Source: &quot;&lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-concepts-5-multiplequbits?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multiple Qubits&lt;/a&gt;&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;A single qubit can be trivially modeled, simulating a fifty-qubit quantum computation would arguably push the limits of existing supercomputers. Increasing the size of the computation by only one additional qubit doubles the memory required to store the state and roughly doubles the computational time. This rapid doubling of computational power is why a quantum computer with a relatively small number of qubits can far surpass the most powerful supercomputers of today, tomorrow and beyond for some computational tasks.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can't utilize a &lt;a href=&quot;https://en.wikipedia.org/wiki/Ponzi_scheme&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ponzi scheme&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/To_rob_Peter_to_pay_Paul&quot; rel=&quot;nofollow noreferrer&quot;&gt;rob Peter to pay Paul&lt;/a&gt;. Compression will save memory at the cost of computational complexity, or representation in a more flexible space (larger) would reduce computational complexity but at a cost of memory. Essentially what is needed is more capable hardware or smarter algorithms.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Here are some methods:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Compression of the volume of sets of quantum states of the Qubit's metric:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Fisher_information_metric&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fisher information metric&lt;/a&gt; can be used to map the volume of the qubit using an information geometry approach as discussed in &quot;&lt;a href=&quot;https://arxiv.org/abs/1802.08835&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Volume of Two-Qubit States by Information Geometry&lt;/a&gt;&quot;, &quot;&lt;a href=&quot;https://users.ece.cmu.edu/~yuejiec/papers/Fisher_ICASSP2013.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Analysis of Fisher Information and the Cramer-Rao Bound for Nonlinear Parameter Estimation After Compressed Sensing&lt;/a&gt;&quot;, and our &quot;&lt;a href=&quot;https://stats.stackexchange.com/questions/10578/intuitive-explanation-of-fisher-information-and-cramer-rao-bound&quot;&gt;Intuitive explanation of Fisher Information and Cramer-Rao bound&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Analogous to operand compression:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Computing depth-optimal decompositions of logical operations: &quot;&lt;a href=&quot;https://arxiv.org/abs/1206.0758&quot; rel=&quot;nofollow noreferrer&quot;&gt;A meet-in-the-middle algorithm for fast synthesis of depth-optimal quantum circuits&lt;/a&gt;&quot; or this Quora discussion on &quot;&lt;a href=&quot;https://www.quora.com/Are-trinary-AKA-ternary-qubits-things-that-exist-in-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Encoding the dimension of the particle&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Analogous to memory compression:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Qutrit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qutrit&lt;/a&gt; factorization using ternary arithmetic: &quot;&lt;a href=&quot;https://arxiv.org/abs/1605.02756&quot; rel=&quot;nofollow noreferrer&quot;&gt;Factoring with Qutrits: Shor's Algorithm on Ternary and Metaplectic Quantum Architectures&lt;/a&gt;&quot; and &quot;&lt;a href=&quot;https://arxiv.org/abs/1205.2390&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Ternary Circuit Synthesis Using Projection Operations&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Analogous to traditional optimization &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://www.researchgate.net/publication/224705154_A_Quantum_Algorithm_for_Finding_Minimum_Exclusive-Or_Expressions&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Algorithm for Finding Minimum Exclusive-Or Expressions&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Other:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Krull_dimension&quot; rel=&quot;nofollow noreferrer&quot;&gt;Krull Dimensions&lt;/a&gt; or axiomatisation and graph rewriting: &quot;&lt;a href=&quot;https://arxiv.org/abs/1801.07993&quot; rel=&quot;nofollow noreferrer&quot;&gt;Completeness of the ZX-calculus for Pure Qubit Clifford+T Quantum Mechanics&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By combining those techniques you ought to be able to squeeze the foot into the shoe. That would permit emulation of larger systems on conventional processors, just don't ask me to explain doctoral level work or write the code. :)&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2018-03-21T06:50:03.400" LastActivityDate="2018-03-21T06:50:03.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1220" PostTypeId="2" ParentId="1213" CreationDate="2018-03-20T02:26:57.057" Score="10" Body="&lt;p&gt;Throughout this answer, the norm of a matrix $A$, $\left\lVert A\right\rVert$ will be taken to be the spectral norm of $A$ (that is, the largest singular value of $A$). The &lt;strong&gt;solovay-Kitaev theorem&lt;/strong&gt; states that approximating a gate to within an error $\epsilon$ requires $$\mathcal O\left(\log^c\frac 1\epsilon\right)$$ gates, for $c&amp;lt;4$ in any fixed number of dimensions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first part:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the approximation introduces an error, which would spread and accumulate in a long computation&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, it can be shown by induction that errors accumulating through using one matrix to approximate another are subadditive (see e.g. &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/qa/&quot; rel=&quot;noreferrer&quot;&gt;Andrew Child's lecture notes&lt;/a&gt;). That is, for unitary matrices $U_i$ and $V_i$, $\left\lVert U_i - V_i\right\rVert &amp;lt; \epsilon\,\forall\, i \in \left\lbrace1, 2, \ldots, t\right \rbrace\implies \left\lVert U_t\ldots U_2U_1 - V_t\ldots V_2V_1\right\rVert \leq t\epsilon$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this means in terms of implementation is that, for an overall error no more than $\epsilon$ to be achieved, each gate needs to be approximated to within $\epsilon/t$, or&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;applying the approximation to the circuit as a whole&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is the same as applying the approximation to each individual gate, each with an individual error no more than that of the entire circuit divided by the number of gates that you're approximating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of gate synthesis, The algorithm is performed by taking products of the gate set $\Gamma$ to form a new gate set $\Gamma_0$ which forms an $\epsilon^2$ net for $\operatorname{SU}\left(d\right)$ (for any $A \in \operatorname{SU}\left(d\right),\, \exists U\in\Gamma_0\, s.t. \left\lVert A-U\right\rVert\leq\epsilon^2$). Starting from identity, a new unitary is recursively found from the new gate set in order to get a tighter net round the target unitary. Oddly enough, the time for a classical algorithm to perform this operation is also $\mathcal O\left(\mathit{poly} \log 1/\epsilon\right)$, which is sub-polynomial time. &lt;strong&gt;However&lt;/strong&gt;, as per &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0111031&quot; rel=&quot;noreferrer&quot;&gt;Harrow, Recht, Chuang&lt;/a&gt;, in $d$-dimensions, as a ball of radius $\epsilon$ around $\operatorname{SU}\left(d\right)$ has a volume $\propto \epsilon^{d^2-1}$, this scales exponentially in $d^2$ for a non-fixed number of dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does have an affect on the final computation time. However, as the scaling in both number of gates and classical computational complexity is sub-polynomial, this doesn't change the complexity class of any algorithm, at least for the commonly considered classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For $t$ gates, the overall (time and gate) complexity is then&lt;/strong&gt; $$\mathcal O\left(t\, \mathit{poly} \log \frac t\epsilon\right)$$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/78/23&quot;&gt;unitary circuit model&lt;/a&gt; without &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/79/23&quot;&gt;intermediary measurements&lt;/a&gt;, the number of gates to be implemented will always be known prior to the computation. However, it is feasible to assume this isn't the case when intermediary measurements are used, so when then number of gates that you want to approximate is unknown, this is saying that $t$ is unknown. and if you don't know what $t$ is, you obviously can't approximate each gate to an error $\epsilon/t$. &lt;strong&gt;If you know a bound on the number of gates&lt;/strong&gt; (say, $t_{\text{max}}$), then you could approximate each gate to within $\epsilon/t_{\text{max}}$ to get an overall error $\leq\epsilon$ and complexity $$\mathcal O\left(t\, \mathit{poly} \log \frac {t_{\text{max}}}{\epsilon}\right),$$ although &lt;strong&gt;if no upper bound on the number of gates is known&lt;/strong&gt;, then each gate would be approximated to some (smaller) $\epsilon'$, giving an overall error $\leq t'\epsilon$ for the resulting number of implemented gates (which is unknown at the start) $t'$, with an overall complexity of $$\mathcal O\left(t'\, \mathit{poly} \log \frac {1}{\epsilon'}\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the total error of this is still unbounded, so one simple&lt;sup&gt;1&lt;/sup&gt; way of keeping the error bounded would be to reduce the error each time by a factor of, say, $2$, so that the $n^{th}$ gate would be implemented with error $\epsilon/2^n$. The complexity would then be $$\mathcal O\left(\mathit{poly} \log \frac {2^n}{\epsilon'}\right) = \mathcal O\left(\mathit{poly}\, n\log \frac {1}{\epsilon'}\right),$$ giving an overall (now polynomial) complexity $$\mathcal O\left(\mathit{poly}\, t \log \frac {1}{\epsilon}\right),$$ although this does have the advantage of guaranteeing a bounded error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't &lt;em&gt;too&lt;/em&gt; bad, so I would hope that (when the number of gates is unknown) classical computers would be able to keep coming up with the correct gates at least as fast as a quantum processor would need them. If not currently, then hopefully once quantum processors become good enough that this actually becomes a problem!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Although, likely not the most efficient&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-20T10:25:34.290" LastActivityDate="2018-03-20T10:25:34.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1221" PostTypeId="1" AcceptedAnswerId="1223" CreationDate="2018-03-20T07:41:17.380" Score="14" ViewCount="472" Body="&lt;p&gt;One of the many thing that confuse me in the field of QC is what makes the measurement of a qubit in a quantum computer any different than just choosing at random (in a classical computer) (that's not my actual question)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have $n$ qubits, and my state is a vector of their amplitudes $(a_1,a_2,\dots,a_n)^\mathrm{T}$.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I pass that state through some gates and do all sorts of quantum operations (except for measurement), and then I measure the state. I'll only get one of the options (with varying probabilities). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So where's the difference between doing that, and generating a number randomly from some convoluted/complicated distribution? What makes quantum computations essentially different from randomized classical ones?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I hope I didn't misunderstand how states are represented. Confused about that, as well...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13" LastEditorUserId="15" LastEditDate="2018-03-20T08:55:56.113" LastActivityDate="2018-03-21T01:54:32.123" Title="What makes quantum computations different from randomized classical computations?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1222" PostTypeId="1" CreationDate="2018-03-20T07:52:06.983" Score="8" ViewCount="635" Body="&lt;p&gt;The title says most of it: What are the implications of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bremermann%27s_limit&quot; rel=&quot;noreferrer&quot;&gt;Bremermann's limit&lt;/a&gt; for quantum computing?&#xA;The Wikipedia page says that the limit applies to any self-contained system, but in the last few lines they also claim that &quot;access to quantum memory enables computational algorithms that require arbitrarily small amount of energy/time per one elementary computation step&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These statements seem contradictory (unless requiring arbitrarily small amount of energy/time also requires the amount of mass going to infinity). So how does the Bremermann's limit actually affect quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="346" LastEditorUserId="26" LastEditDate="2018-12-14T05:57:57.583" LastActivityDate="2019-04-17T23:42:44.423" Title="What are the implications of Bremermann's limit for quantum computing?" Tags="&lt;speedup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1223" PostTypeId="2" ParentId="1221" CreationDate="2018-03-20T14:25:07.830" Score="13" Body="&lt;p&gt;The question is, how did you get to your final state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magic is in the gate operations that transformed your initial state to your final state.  If we knew the final state to begin with, we wouldn't need a quantum computer - we'd have the answer already and could, as you suggest, simply sample from the corresponding probability distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike Monte Carlo methods that take a sample from some probability distribution and change it to a sample from some other distribution, the quantum computer is taking an initial state vector and transforming it to another state vector via gate operations.  The key difference is that quantum states undergo &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_interference#Quantum_interference&quot; rel=&quot;noreferrer&quot;&gt;coherent interference&lt;/a&gt;, which means that the vector amplitudes add as complex numbers.  Wrong answers add destructively (and have low probability), while right answers add constructively (and have high probability).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The end result, if all goes well, is a final quantum state that yields the right answer with high probability upon measurement, but it took all those gate operations to get there in the first place.&lt;/p&gt;&#xA;" OwnerUserId="356" LastEditorUserId="15" LastEditDate="2018-03-21T01:08:46.320" LastActivityDate="2018-03-21T01:08:46.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1224" PostTypeId="2" ParentId="1192" CreationDate="2018-03-20T15:46:21.140" Score="1" Body="&lt;p&gt;While other answers provide good points, I feel that I still disagree a bit. So, I will share my own thoughts on this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, I think featuring the constant 'as is' is a wasted opportunity at best. Perhaps it is the best we are able to get for now, but it is far from ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But first, I think a brief excursion is nessecary.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;When do we have an effective algorithm?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;When Daniel Sank asked me what I would do if there was an algorithm for factoring prime numbers with a $10^6$ factor speedup on a test set of serious instances, I first replied that I doubt this would be due to algorithmic improvements, but other factors (either the machine or the implementation). But I think I have a different response now. Let me give you a trivial algorithm that can factor very large numbers within milliseconds and is nevertheless &lt;em&gt;very ineffective&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a set $P$ of (pretty big) primes.&lt;/li&gt;&#xA;&lt;li&gt;Compute $P^2$, the set of all composites with exactly two factors from $P$. For each composite, store which pair of primes is used to construct it.&lt;/li&gt;&#xA;&lt;li&gt;Now, when given an instance from $P^2$, simply look at the factorization in our table and report it. Otherwise, report 'error'&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I hope it is obvious that this algorithm is rubbish, as it works only correctly when our input is in $P^2$. However, can we see this when given the algorithm as a black box &lt;em&gt;and&lt;/em&gt; &quot;by coincide&quot; only test with inputs from $P$? Sure, we can try to test a lot of examples, but it is very easy to make $P$ very big without the algorithm being ineffective on inputs from $P^2$ (perhaps we want to use a hash-map or something). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it isn't unreasonable that our rubbish algorithm might be coincidentally seem to have 'miraculous' speedups. Now, of course there are many experiment design techniques that can mitigate the risk, but perhaps more clever 'fast' algorithms that still fail in many, but not enough examples can trick us! (also note that I'm assuming no researcher is &lt;em&gt;malicious&lt;/em&gt;, which makes matters even worse!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I would now reply: &quot;Wake me up when there is a better performance metric&quot;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How can we do better, then?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If we can afford to test our 'black box' algorithm to on all cases, we cannot be fooled by the above. However, this is impossible for practical situations. (This &lt;em&gt;can&lt;/em&gt; be done in theoretical models!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we &lt;em&gt;can&lt;/em&gt; instead do is to create a statistical &lt;em&gt;hypothesis&lt;/em&gt; for some &lt;em&gt;parameterized&lt;/em&gt; running time (usually for the input size) to test this, perhaps adapt our hypothesis and test again, until we get a hypothesis we like and rejecting the null seems reasonable. (Note that there are likely other factors involved I'm ignoring. I'm practically a mathematician. Experiment design is not something within my expertise)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage of statistically testing on a parameterization (e.g. is our algorithm $O(n^3)$? ) is that the model is more &lt;em&gt;general&lt;/em&gt; and hence it is harder to be 'cheated' like in the previous section. It is not impossible, but at least the statistical claims on whether this is reasonable can be justified.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;So, what to do with the constants?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I think &lt;em&gt;only&lt;/em&gt; stating &quot;$10^9$ speedup, wow!&quot; is a bad way of dealing this case. But I also think completely disregarding this result is bad as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it is most useful to regard the curious constant as an &lt;em&gt;anomaly&lt;/em&gt;, i.e. it is a claim that in itself warrants further investigation. I think that creating hypotheses based on more general models than simply 'our algorithm takes X time' is a good tool to do this. So, while I don't think we can simply take over CS conventions here, completely disregarding the 'disdain' for constants is a bad idea as well.&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-03-20T15:46:21.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1225" PostTypeId="1" AcceptedAnswerId="1331" CreationDate="2018-03-20T18:46:10.267" Score="8" ViewCount="212" Body="&lt;p&gt;This &lt;a href=&quot;https://www.ibm.com/blogs/research/2017/10/quantum-computing-barrier/&quot; rel=&quot;nofollow noreferrer&quot;&gt;new algorithm&lt;/a&gt; for QC calculation was introduced recently (2017 4Q) by IBM/ Pednault et al. to great fanfare. The paper seems more couched in the language of physics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any basic overview/analyses of this by computer scientists about the general &quot;design pattern&quot; utilized, vs the prior algorithmic techniques for the problem, or can someone provide one? What about the complexity analysis of the techniques?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1710.05867&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Breaking the 49-Qubit Barrier in the Simulation of Quantum Circuits&quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="26" LastEditDate="2019-01-31T14:49:46.723" LastActivityDate="2019-01-31T14:49:46.723" Title="New algorithm for faster QC simulation by IBM" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;simulation&gt;&lt;speedup&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1226" PostTypeId="1" CreationDate="2018-03-21T00:20:54.037" Score="12" ViewCount="436" Body="&lt;p&gt;Which technological path seems most promising to produce a quantum processor with a greater &lt;a href=&quot;https://dal.objectstorage.open.softlayer.com/v1/AUTH_039c3bf6e6e54d76b8e66152e2f87877/community-documents/quatnum-volumehp08co1vbo0cc8fr.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum volume&lt;/a&gt; (preferring fewer errors per qubit over more qubits), than &lt;a href=&quot;https://en.wikipedia.org/wiki/Majorana_fermion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana fermions&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The preferred format for the answer would be similar to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Group ABC's method DEF has demonstrated better QV than using MF; as proven independently in paper G on page x, paper H on page y, and paper I on page z&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On &lt;a href=&quot;https://www.nature.com/articles/nphys4110&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana fermions&lt;/a&gt; Landry Bretheau &lt;a href=&quot;https://news.mit.edu/2017/superconductors-graphene-exotic-electronic-states-quantum-computing-0505&quot; rel=&quot;nofollow noreferrer&quot;&gt;says&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These particles could be the elementary brick of topological quantum computers, with very strong protection against errors. Our work is an initial step in this direction.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Example of an insufficient (but interesting) answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In their paper &quot;&lt;a href=&quot;https://arxiv.org/abs/1405.4052&quot; rel=&quot;nofollow noreferrer&quot;&gt;Robust quantum metrological schemes based on protection of quantum Fisher information&lt;/a&gt;&quot;, Xiao-Ming Lu, Sixia Yu, and C.H. Oh construct a family of $2t+1$ qubits metrological schemes being immune to $t$-qubit errors after the signal sensing. In comparison at least five qubits are required for correcting arbitrary 1-qubit errors in standard quantum error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Note: This theory of robust metrological schemes preserves the quantum Fisher information instead of the quantum states themselves against noise. That results in a good effective volume &lt;strong&gt;if&lt;/strong&gt; they can construct a device utilizing their techniques and show that it &lt;strong&gt;scales&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While that might seem like one promising answer it's a single link (without multiple concurring sources) and there's no device built to show scalability. A low qubit device that's error free and unscalable &lt;strong&gt;or&lt;/strong&gt; a device with many error-prone qubits has a low volume (and thus is &quot;Not An Answer&quot;).]&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Additional references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Paper explaining &lt;a href=&quot;https://ibm.biz/BdiaQe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Volume&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ekkrL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ekkrL.jpg&quot; alt=&quot;Qubits vs. Error Rate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After doing some research it looks like Graphene sandwiched between superconductors to produce Majorana fermions is the leading edge - is there something better? [&quot;better&quot; means currently possible,  not theoretically possible or ridiculously expensive]. The graphic illustrates that over a hundred qubits with less 0.0001 error rate is wonderful,  lesser answers are acceptable.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="26" LastEditDate="2019-05-15T15:08:34.327" LastActivityDate="2019-05-15T15:08:34.327" Title="What is the leading edge technology for creating a quantum computer with the fewest errors?" Tags="&lt;error-correction&gt;&lt;architecture&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1227" PostTypeId="2" ParentId="1221" CreationDate="2018-03-21T01:42:04.873" Score="4" Body="&lt;p&gt;You're right - if we had a bunch of linear probabilities and just kept combining them in a big superposition, we may as well just do randomized classical computation, which'd basically be describable in terms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bayesian_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bayesian mechanics&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\hspace{3cm}$&lt;a href=&quot;https://en.wikipedia.org/wiki/File:Bayes_theorem_drugs_example_tree.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/8/88/Bayes_theorem_drugs_example_tree.svg&quot; alt=&quot;&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since classical systems can already operate like this, that'd be disinteresting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick's in that &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum gates&lt;/a&gt; can be non-linear, i.e. they can work in a non-Bayesian way.  Then we can construct systems in which &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_interference#Quantum_interference&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubits interfere&lt;/a&gt; in ways that favor desirable outcomes over undesirable outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good example might be &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Then ${\displaystyle \omega ^{ry}} \omega ^{ry}$ is a unit vector in the complex plane $( {\displaystyle \omega } \omega$  is a root of unity and $r$ and $y$ are integers), and the coefficient of ${\displaystyle Q^{-1}\left|y,z\right\rangle } Q^{-1}\left|y,z\right\rangle$  in the final state is$${\displaystyle \sum _{x:\,f(x)=z}\omega ^{xy}=\sum _{b}\omega ^{(x_{0}+rb)y}=\omega ^{x_{0}y}\sum _{b}\omega ^{rby}.}$$&#xA;  Each term in this sum represents a different path to the same result, and quantum &lt;a href=&quot;https://en.wikipedia.org/wiki/Interference_(wave_propagation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;interference&lt;/a&gt; occurs – constructive when the unit vectors ${\displaystyle \omega ^{ryb}} \omega ^{ryb}$ point in nearly the same direction in the complex plane, which requires that ${\displaystyle \omega ^{ry}} \omega ^{ry}$ point along the &lt;a href=&quot;https://en.wikipedia.org/wiki/Positive_real_axis&quot; rel=&quot;nofollow noreferrer&quot;&gt;positive real axis&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;-&lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Shor's algorithm&quot;&lt;/a&gt;, Wikipedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then, the very next step after that starts with &lt;strong&gt;&quot;&lt;em&gt;Perform a measurement.&lt;/em&gt;&quot;&lt;/strong&gt;.  This is, they tweaked the odds in favor of the outcome that they wanted, now they're measuring it to see what that was.&lt;/p&gt;&#xA;" OwnerUserId="15" LastEditorUserId="15" LastEditDate="2018-03-21T01:54:32.123" LastActivityDate="2018-03-21T01:54:32.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1228" PostTypeId="1" CreationDate="2018-03-21T02:15:23.523" Score="0" ViewCount="880" Body="&lt;p&gt;Seth Lloyd, a professor of mechanical engineering and physics at MIT, &lt;a href=&quot;https://arxiv.org/abs/1312.4455&quot; rel=&quot;nofollow noreferrer&quot;&gt;published a paper&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Programming_the_Universe&quot; rel=&quot;nofollow noreferrer&quot;&gt;a book&lt;/a&gt; in which he shows that the universe can be &#xA;regarded as a giant quantum computer. According to him, all observed phenomena are consistent with the model in which the universe is indistinguishable from a quantum computer, e.g., a quantum cellular automaton.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He considers the following two statements to be true:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The universe allows quantum computation.&lt;/li&gt;&#xA;&lt;li&gt;A quantum computer efficiently simulates the dynamics of the universe.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To conclude with:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Finally, we can quantize question three: (Q3) ‘Is the universe a quantum&#xA;  cellular automaton?’ While we cannot unequivocally answer this question&#xA;  in the affirmative, we note that the proofs that show that a quantum computer&#xA;  can simulate any local quantum system efficiently immediately imply&#xA;  that any homogeneous, local quantum dynamics, such as that given by the&#xA;  standard model and (presumably) by quantum gravity, can be directly reproduced&#xA;  by a quantum cellular automaton. Indeed, lattice gauge theories,&#xA;  in Hamiltonian form, map directly onto quantum cellular automata. Accordingly,&#xA;  all current physical observations are consistent with the theory that&#xA;  the universe is indeed a quantum cellular automaton.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does this theory hold up?&lt;/p&gt;&#xA;" OwnerUserId="395" LastEditorUserId="26" LastEditDate="2019-05-07T15:50:53.493" LastActivityDate="2019-05-07T15:50:53.493" Title="Is the universe indistinguishable from a giant quantum computer?" Tags="&lt;simulation&gt;&lt;automata-theory&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ClosedDate="2018-03-26T15:26:50.937" ContentLicense="CC BY-SA 3.0" />
  <row Id="1229" PostTypeId="2" ParentId="1228" CreationDate="2018-03-21T02:30:42.533" Score="10" Body="&lt;p&gt;I guess that he's right enough for the moment; quantum mechanics is part of our best theory of the universe, which by definition means that we think the universe works like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's pretty circular though.  When we have some model of the universe, what that literally means is that we think that the universe is operating according to that model.  Currently that's a quantum model.  Still, who cares?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper attempts to address that question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The immediate question is ‘So what?’ Does the fact that the universe is observationally indistinguishable from a giant quantum computer tell us anything new or interesting about its behavior? The answer to this question is a resounding ‘Yes!’ In particular, the quantum computational model of the universe answers a question that has plagued human beings ever since they first began to wonder about the origins of the universe, namely, Why is the universe so ordered and yet so complex [1]?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, I guess that he's saying that quantum mechanics helps us to model more about the universe than prior models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seems like a pretty trivial point.  It's weird that someone wrote a paper about it.&lt;/p&gt;&#xA;" OwnerUserId="15" LastActivityDate="2018-03-21T02:30:42.533" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1231" PostTypeId="2" ParentId="1222" CreationDate="2018-03-21T05:20:45.070" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;What are the implications of Bremermann's limit for quantum computing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;From the Wikipedia page you referenced:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;A computer with the mass of the entire Earth operating at the Bremermann's limit could perform approximately &lt;span class=&quot;math-container&quot;&gt;$10^{75}$&lt;/span&gt; mathematical computations per second.&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Next you say:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Wikipedia page says that the limit applies to any self-contained system, but in the last few lines they also claim ... statements seem contradictory.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The whole paragraph is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;The limit&lt;/strong&gt; has been further analysed in later literature &lt;strong&gt;as the maximum rate at which a system&lt;/strong&gt; with energy spread &lt;span class=&quot;math-container&quot;&gt;$ \Delta E $&lt;/span&gt; &lt;strong&gt;can evolve into an orthogonal and hence distinguishable state&lt;/strong&gt; to another, &lt;span class=&quot;math-container&quot;&gt;$ \Delta t = \pi \hbar / 2 \Delta E$&lt;/span&gt;. In particular, Margolus and Levitin has shown that a quantum system with average energy &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; takes &lt;strong&gt;at least&lt;/strong&gt; time &lt;span class=&quot;math-container&quot;&gt;$ \Delta t = \pi \hbar / 2 E $&lt;/span&gt; to &lt;strong&gt;evolve into an orthogonal state&lt;/strong&gt;. However, &lt;strong&gt;it has been shown&lt;/strong&gt; that &lt;strong&gt;access to quantum memory&lt;/strong&gt; &lt;em&gt;&lt;strong&gt;enables&lt;/strong&gt;&lt;/em&gt; &lt;strong&gt;computational algorithms that require arbitrarily small amount of energy/time&lt;/strong&gt; per one elementary computation step.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The paper referenced, &amp;quot;&lt;a href=&quot;https://arxiv.org/pdf/1701.05550.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Computing with a single qubit faster than the computation quantum speed limit&lt;/a&gt;&amp;quot;, seems to explain it fairly clearly:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Page 1: &amp;quot;Introduction. &lt;strong&gt;The quantum phase space of a qubit is a sphere (Fig. 1)&lt;/strong&gt;. One can discretize this space into any number of states and then apply field pulses to switch between the chosen states in an arbitrary order. In this sense, a qubit comprises the whole universe of choices for computation. For example, a qubit can work as finite automata when different unitary gates act on this qubit depending on arriving digital words. &lt;strong&gt;However, different states of a qubit are generally not distinguishable by measurements&lt;/strong&gt;. So, if the final quantum state encodes the result of computation, &lt;strong&gt;we cannot generally extract this information because we cannot distinguish this state by a measurement from other non-orthogonal possibilities reliably&lt;/strong&gt;. For such reasons, qubits &lt;strong&gt;are believed to&lt;/strong&gt; provide computational advantage over classical memory &lt;strong&gt;only when&lt;/strong&gt; they are used to create purely quantum correlations, i.e., entanglement or quantum discord.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Quantum mechanically, &lt;strong&gt;distinguishable states must be represented by orthogonal vectors that produce definitely different measurement outcomes&lt;/strong&gt;. However, &lt;strong&gt;the switching time between two orthogonal quantum states is restricted from&lt;/strong&gt; below by a fundamental computation speed limit T = h/(4∆E), where ∆E is characteristic energy of &lt;strong&gt;the control field coupling to the memory&lt;/strong&gt; that is needed to update one bit of information. So, &lt;strong&gt;restrictions on strength of control fields automatically restrict the speed of classical computation&lt;/strong&gt; that saves information in physically distinguishable states. While the existence of this &lt;em&gt;computation quantum speed limit&lt;/em&gt; is a mathematically proved fact, I will show an explicit elementary example that demonstrates possibility of solving a computational problem faster than the lowest time bound that is imposed by this limit on classical computation hardware. &lt;strong&gt;Access to the quantum memory makes this possible because it allows information processing using nonorthogonal quantum states.&lt;/strong&gt; So, there is &lt;strong&gt;no more direct linear relation&lt;/strong&gt; between the minimal time and the number of elementary logic operations required to implement an algorithm &lt;strong&gt;at given energy constraints&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y9idL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y9idL.jpg&quot; alt=&quot;Qubit's quantum phase space&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;FIG. 1. Up to overall phases that do not influence measurement outcomes, states of a qubit correspond to points on the 2D sphere. This phase space can be discretized to create a register of states (green circles) for computation. However, &lt;strong&gt;only opposite points on this sphere&lt;/strong&gt;, such as the poles marked by |0and |1, &lt;strong&gt;are distinguishable by measurements&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;[Note: You &lt;em&gt;might&lt;/em&gt; barely get by just skimming just the &lt;strong&gt;bold&lt;/strong&gt; text, I suggest you read the whole paper for a better understanding.]&lt;/p&gt;&#xA;&lt;p&gt;Hopefully that is clear, if you have a comment I can make an edit.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-04-17T23:42:44.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1232" PostTypeId="2" ParentId="49" CreationDate="2018-03-21T06:21:15.117" Score="7" Body="&lt;p&gt;As far as I know the closest answer to your question for applications is given in the recent (still unpublished) work presented at the &lt;a href=&quot;http://meetings.aps.org/Meeting/MAR18/Session/S28.6&quot; rel=&quot;noreferrer&quot;&gt;March meeting&lt;/a&gt; by Bibek Pokharel, where he compares graph 3-coloring instances on D-Wave Two, D-Wave 2X and D-Wave 2000Q, all other things staying reasonably equal. &#xA;The short answer is that all the performance increase is essentially due to the possibility to run single anneals at shorter anneal-time. (e.g. 1$\mu$s instead of 5$\mu$s gives indeed about 5X of performance increase, in terms of time-to-solution (TTS) metric. With respect to 20$\mu$s of D-Wave Two the scaling is different).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can also spoil that from D-Wave Two and D-Wave 2000Q on &lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.5.031040&quot; rel=&quot;noreferrer&quot;&gt;Sherrington-Kirkpatrick instances&lt;/a&gt; we observed no substantial improvement as well. Results will be published soon in collaborations with Stanford.&lt;/p&gt;&#xA;" OwnerUserId="410" LastActivityDate="2018-03-21T06:21:15.117" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1233" PostTypeId="2" ParentId="75" CreationDate="2018-03-21T06:43:53.443" Score="7" Body="&lt;p&gt;As far as I’m aware, the surface code is still regarded as the best. With an assumption of all elements failing with equal probability (and doing so in a certain way) it has a &lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;noreferrer&quot;&gt;threshold of around 1%&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the paper you linked to doesn’t have a 3D surface code. It is the decoding problem that is 3D, due to tracking changes to the 2D lattice over time. As I think you suspected, this is the required procedure when try to keep the stored information coherent for as long as possible. Check out &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0110143&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; for an earlier reference in some of these things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exact threshold numbers mean you need a specific error model, as you know. And for that you need a decoder, which ideally adapts to the specifics of the error model while remaining fast enough to keep up. Your definition of what is fast enough for the task at hand will have a big effect on what the threshold is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get upper bounds for a specific code and specific noise model, we can sometimes map the model to one of statistical mechanics. The threshold then corresponds to the point of a phase transition. See &lt;a href=&quot;https://arxiv.org/abs/1406.5974&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; paper for an example of how to do this, and the references therein for others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other than the threshold, another important factor is how easy it is to do quantum computation on the stored information. The surface code is quite bad at this, which is a major reason that people still consider other codes, despite the great advantages of the surface codes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The surface code can only do the X, Z and H gates very simply, but they aren’t enough. The Color code can also manage the S gate without too much trouble, but that still just restricts us to the Clifford gates. Expensive techniques like magic state distillation will still be needed for both cases to get additional operations, as required for universality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some codes don’t have this restriction. They can let you do a full universal gate set in a straightforward and fault-tolerant way. Unfortunately, they pay for this by being much less realistic to build. &lt;a href=&quot;http://www.physics.usyd.edu.au/quantum/Coogee2016/Presentations/Kubica.pdf&quot; rel=&quot;noreferrer&quot;&gt;These slides&lt;/a&gt; might point you in the right directions for more resources on this matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s also worth noting that even within the family of surface codes there are variations to explore. The stabilizers can be changed to an &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.90.016803&quot; rel=&quot;noreferrer&quot;&gt;alternating&lt;/a&gt; pattern, or a &lt;a href=&quot;https://arxiv.org/abs/1708.08474&quot; rel=&quot;noreferrer&quot;&gt;YYYY&lt;/a&gt; stabilizer can used, to better deal with certain noise types. More drastically, we could even make &lt;a href=&quot;https://arxiv.org/abs/1609.07774&quot; rel=&quot;noreferrer&quot;&gt;quite big changes to the nature of the stabilizers&lt;/a&gt;. There are also the boundary conditions, which are what distinguishes a planar code from a toric code, etc. These and other details give us lots to optimize over.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-21T19:04:41.577" LastActivityDate="2018-03-21T19:04:41.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1234" PostTypeId="2" ParentId="1226" CreationDate="2018-03-21T08:45:51.630" Score="11" Body="&lt;p&gt;That is indeed the most important question at the moment!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/devices&quot; rel=&quot;noreferrer&quot;&gt;Superconducting qubits&lt;/a&gt; currently have the biggest devices. But will they continue to scale? Will short coherence times make it too hard for error correction to keep up?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physicsworld.com/a/ion-trap-quantum-computer-is-programmable-and-reconfigurable/&quot; rel=&quot;noreferrer&quot;&gt;Trapped ions&lt;/a&gt; are not far behind. But they have their own &lt;a href=&quot;http://science.sciencemag.org/content/339/6124/1164&quot; rel=&quot;noreferrer&quot;&gt;scalability issues&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1204.5917&quot; rel=&quot;noreferrer&quot;&gt;Spin qubits&lt;/a&gt; should be great for scaling once they get going. They are still down in the &lt;a href=&quot;https://arxiv.org/abs/1708.04214&quot; rel=&quot;noreferrer&quot;&gt;few qubits&lt;/a&gt; at the moment, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Majoranas also are suspected to have some nice properties. But I’d have to see a single qubit before I declare them to be the leading edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Photonics are also a viable strategy. In fact, &lt;a href=&quot;http://cnotmz.appspot.com/&quot; rel=&quot;noreferrer&quot;&gt;the first cloud based quantum device&lt;/a&gt; was photonic. A few startups are also based around photonic based approaches, such as the one described &lt;a href=&quot;https://arxiv.org/abs/1607.08535&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-21T19:00:39.913" LastActivityDate="2018-03-21T19:00:39.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1235" PostTypeId="1" AcceptedAnswerId="1241" CreationDate="2018-03-21T10:00:08.307" Score="23" ViewCount="5966" Body="&lt;p&gt;As I understand it, the field of quantum mechanics was started in the early 20th century when Max Planck solved the black-body radiation problem. But I don't know when the idea of computers using quantum effects spread out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the earliest source that proposes the idea of quantum computers using qubits?&lt;/p&gt;&#xA;" OwnerUserId="11" LastEditorUserId="55" LastEditDate="2019-10-24T09:38:21.910" LastActivityDate="2019-10-27T10:24:25.197" Title="Who first proposed the idea of quantum computing using qubits?" Tags="&lt;history&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1236" PostTypeId="1" AcceptedAnswerId="1240" CreationDate="2018-03-21T10:14:14.440" Score="6" ViewCount="1637" Body="&lt;p&gt;Reading into &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate#Constructing_the_Bell_State_&amp;#39;&amp;quot;%60UNIQ--postMath-00000039-QINU%60&amp;quot;&amp;#39;&quot; rel=&quot;nofollow noreferrer&quot;&gt;CNOT gate&lt;/a&gt; I understand that, mathematically, such a gate entangles the control qubit and the target. (the resulting state is $\frac{1}{\sqrt 2}(|00\rangle+|11\rangle)$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, looking at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate#Operation&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;truth table&quot;&lt;/a&gt; of the gate, it seems as though the result is not entangled: If I measure the target after passing the gate, the state of the control can still be either option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something, or did I misunderstand the truth table?&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="26" LastEditDate="2018-12-23T12:09:39.393" LastActivityDate="2019-05-15T16:45:37.693" Title="How does evolving a two-qubit state through a CNOT gate entangle them?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1237" PostTypeId="2" ParentId="1235" CreationDate="2018-03-21T10:28:28.877" Score="8" Body="&lt;p&gt;Around 1960-1973 the idea was beginning to form, but the field really started spreading in the 1980s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the biggest pioneers was Richard P. Feynman. &lt;strong&gt;He proposed a model of a quantum computer in his &lt;a href=&quot;https://en.wikipedia.org/wiki/There%27s_Plenty_of_Room_at_the_Bottom&quot; rel=&quot;noreferrer&quot;&gt;talk&lt;/a&gt;&lt;/strong&gt;. From that talk, many other scientists pushed the field further (Toffoli created one of the first quantum gates; Shor, at Bell Labs, created one of the first quantum algorithms etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field has been changing and evolving rapidly throughout 1980-2000, and keeps evolving. But the initial &quot;spark&quot; was made by Richard Feynman. I don't know if he thought of qubits, but his main interest in quantum computing was for simulating quantum physics and systems.&lt;/p&gt;&#xA;" OwnerUserId="13" LastActivityDate="2018-03-21T10:28:28.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1238" PostTypeId="5" CreationDate="2018-03-21T10:48:45.727" Score="0" Body="&lt;p&gt;History in the sense of quantum computing (or any scientific field) is a collection of milestones the field has made and contributions that have been made in the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a quickly evolving field, and especially one involving quantum mechanics, understanding the history of the field is needed to fully comprehend how the field came to be as it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A timeline of quantum computing can be found &lt;a href=&quot;https://en.wikipedia.org/wiki/Timeline_of_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="13" LastEditDate="2018-03-21T17:28:24.013" LastActivityDate="2018-03-21T17:28:24.013" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1239" PostTypeId="4" CreationDate="2018-03-21T10:48:45.727" Score="0" Body="Questions related to the history of quantum computers and quantum computing. Use this tag to ask questions about they history of an aspect of quantum computing (such as some concept or paradigm)." OwnerUserId="13" LastEditorUserId="26" LastEditDate="2019-01-01T09:44:06.377" LastActivityDate="2019-01-01T09:44:06.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1240" PostTypeId="2" ParentId="1236" CreationDate="2018-03-21T11:06:38.387" Score="13" Body="&lt;p&gt;You are correct that none of the states in the truth table are entangled. Not all states become entangled when acted on by the CNOT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entangled state in your question would result if the control qubit was in state $|+\rangle=\frac{1}{\sqrt 2}(|0\rangle+|1\rangle)$), and the target was in state $|0\rangle$. The two qubits would then be in a superposition of $|00\rangle$ and $|10\rangle$. Apply the truth table to each of these independently, and you should see that the CNOT produces the superposition of $|00\rangle$ and $|11\rangle$ that you gave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the truth table on that page is not the only one we could write. It favours a certain interpretation of the CNOT, which is that the CNOT performs an X (the quantum version of a NOT) on the target qubit when the control is in state $|1\rangle$. An equivalent interpretation is to say that the CNOT performs a Z on the control if the target is in state $|-\rangle$ (which shows that the &lt;em&gt;control&lt;/em&gt; and &lt;em&gt;target&lt;/em&gt; labels are quite arbitrary). We can also interpret the CNOT as an operation that swaps the expectation values of certain Pauli operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CNOT is all of these things at once. To try and explain this (and other things), I made a &lt;a href=&quot;https://github.com/decodoku/Quantum_Programming_Tutorial/blob/master/README.md&quot; rel=&quot;noreferrer&quot;&gt;tutorial for quantum programming&lt;/a&gt;. Perhaps it will be of some use to you.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-21T12:16:33.483" LastActivityDate="2018-03-21T12:16:33.483" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1241" PostTypeId="2" ParentId="1235" CreationDate="2018-03-21T11:32:54.517" Score="22" Body="&lt;p&gt;According to Wikipedia of &lt;a href=&quot;https://en.wikipedia.org/wiki/Timeline_of_quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;Timeline of quantum computing&lt;/a&gt;, here are the main events:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1960&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Stephen_Wiesner&quot; rel=&quot;noreferrer&quot;&gt;Stephen Wiesner&lt;/a&gt; invents &lt;a href=&quot;https://en.wikipedia.org/wiki/Conjugate_coding&quot; rel=&quot;noreferrer&quot;&gt;conjugate coding&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;1968&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum computer with spins as quantum bits was also formulated for use as a quantum spacetime in 1968.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;Finkelstein, David (1968). &quot;Space-Time Structure in High Energy Interactions&quot;. In Gudehus, T.; Kaiser, G. Fundamental Interactions at High Energy. New York: Gordon &amp;amp; Breach.&lt;/sup&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;1973 &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Alexander_Holevo&quot; rel=&quot;noreferrer&quot;&gt;Alexander Holevo&lt;/a&gt; publishes a paper showing that n qubits cannot carry more than n classical bits of information (see: &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;noreferrer&quot;&gt;&quot;Holevo's theorem&quot;&lt;/a&gt;/&quot;Holevo's bound&quot;).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Charles_H._Bennett_(computer_scientist)&quot; rel=&quot;noreferrer&quot;&gt;Charles H. Bennett&lt;/a&gt; shows that computation can be done reversibly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;1976&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Polish mathematical physicist &lt;a href=&quot;https://en.wikipedia.org/wiki/Roman_Stanis%C5%82aw_Ingarden&quot; rel=&quot;noreferrer&quot;&gt;Roman Stanisław Ingarden&lt;/a&gt; publishes a seminal paper entitled &quot;Quantum Information Theory&quot; in Reports on Mathematical Physics, vol. 10, 43–72, 1976.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;1980&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Paul Benioff described quantum mechanical Hamiltonian models of computers&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Yuri_I._Manin&quot; rel=&quot;noreferrer&quot;&gt;Yuri Manin&lt;/a&gt; proposed an idea of quantum computing&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;1981&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Richard Feynman in his talk [...], observed that it appeared to be impossible in general to simulate an evolution of a quantum system on a classical computer in an efficient way. He proposed a basic model for a quantum computer that would be capable of such simulations&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;1982&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Paul Benioff proposes the first recognisable theoretical framework for a quantum computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So in general, the field of quantum computing was initiated by the work of &lt;a href=&quot;https://de.wikipedia.org/wiki/Paul_Benioff&quot; rel=&quot;noreferrer&quot;&gt;Paul Benioff&lt;/a&gt; &lt;sup&gt;&lt;a href=&quot;https://doi.org/10.1007%2FBF01011339&quot; rel=&quot;noreferrer&quot;&gt;study&lt;/a&gt;&lt;/sup&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Yuri_Manin&quot; rel=&quot;noreferrer&quot;&gt;Yuri Manin&lt;/a&gt; in 1980, &lt;a href=&quot;https://en.wikipedia.org/wiki/Richard_Feynman&quot; rel=&quot;noreferrer&quot;&gt;Richard Feynman&lt;/a&gt; in 1982 &lt;sup&gt;&lt;a href=&quot;https://doi.org/10.1007%2FBF02650179&quot; rel=&quot;noreferrer&quot;&gt;study&lt;/a&gt;&lt;/sup&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/David_Deutsch&quot; rel=&quot;noreferrer&quot;&gt;David Deutsch&lt;/a&gt; in 1985. Source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;Quantum computing at Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2018-03-21T11:39:53.257" LastActivityDate="2018-03-21T11:39:53.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1242" PostTypeId="2" ParentId="1196" CreationDate="2018-03-21T12:02:56.767" Score="6" Body="&lt;p&gt;In the context of scalable quantum computing, the polylog scaling needed for magic state distillation should not be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, it is not the only polylog scaling we need to contend with. Using the $S$ and $T$ gates to approximate a general single qubit rotation can have a similar cost when using the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;noreferrer&quot;&gt;Solvay-Kitaev algorithm&lt;/a&gt; (though this is no longer state-of-the-art). The cost of error correction is also similar to that of MSD. In fact, it has been shown &lt;a href=&quot;https://arxiv.org/abs/1605.07197&quot; rel=&quot;noreferrer&quot;&gt;&quot;that magic state factories have space-time costs that scale as a constant factor of surface code costs&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within a scalable and fault-tolerant quantum computer, I see no reason to think that MSD will have a problematic overhead. We may find other methods that are better, such as ways to implement complex error correcting codes that allow transversal non-Clifford gates. But those will not be so great at error correction, and so have higher overheads for that. This could easily remove any benefits. &lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-03-21T12:02:56.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1244" PostTypeId="1" CreationDate="2018-03-21T12:14:12.267" Score="11" ViewCount="576" Body="&lt;p&gt;While there are many interesting questions that a computer can solve with barely any data (such as factorization, which requires &quot;only&quot; a single integer), most real-world applications, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Machine_learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;machine learning&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Artificial_intelligence&quot; rel=&quot;nofollow noreferrer&quot;&gt;AI&lt;/a&gt;, will require large amounts of data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can quantum computers handle this massive stream of data, in theory or in practice? Is it a good idea to store the data in a &quot;quantum memory&quot;, or is it better to store it in a &quot;classical memory&quot;? &lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2018-12-13T19:38:26.337" LastActivityDate="2019-05-15T14:47:37.300" Title="Can quantum computers handle 'big' data?" Tags="&lt;quantum-memory&gt;&lt;memory-space&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1245" PostTypeId="5" CreationDate="2018-03-21T12:59:17.557" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-21T12:59:17.557" LastActivityDate="2018-03-21T12:59:17.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1246" PostTypeId="4" CreationDate="2018-03-21T12:59:17.557" Score="0" Body="For questions on theoretical models of quantum computations. Such models may be realistically 'build' in real machines, but not necessarily." OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-03-21T17:28:53.010" LastActivityDate="2018-03-21T17:28:53.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1247" PostTypeId="1" AcceptedAnswerId="1251" CreationDate="2018-03-21T13:37:14.543" Score="8" ViewCount="654" Body="&lt;p&gt;I've got the following quantum code using &lt;a href=&quot;https://github.com/QISKit/qiskit-sdk-py&quot; rel=&quot;noreferrer&quot;&gt;QISKit&lt;/a&gt; (based on &lt;a href=&quot;https://github.com/QISKit/qiskit-sdk-py/blob/master/examples/python/hello_quantum.py&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;hello_quantum.py&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sys, os&#xA;from qiskit import QuantumProgram, QISKitError, RegisterSizeError&#xA;&#xA;# Create a QuantumProgram object instance.&#xA;Q_program = QuantumProgram()&#xA;try:&#xA;    import Qconfig&#xA;    Q_program.set_api(Qconfig.APItoken, Qconfig.config[&quot;url&quot;])&#xA;except:&#xA;    offline = True&#xA;    print(&quot;WARNING: There's no connection with IBMQuantumExperience servers.&quot;);&#xA;print(&quot;The backends available for use are: {}\n&quot;.format(&quot;,&quot;.join(Q_program.available_backends())))&#xA;backend = 'ibmqx5'&#xA;try:&#xA;    # Create a Quantum Register called &quot;qr&quot; with 2 qubits.&#xA;    qr = Q_program.create_quantum_register(&quot;qr&quot;, 2)&#xA;    # Create a Classical Register called &quot;cr&quot; with 2 bits.&#xA;    cr = Q_program.create_classical_register(&quot;cr&quot;, 2)&#xA;    # Create a Quantum Circuit called &quot;qc&quot;. involving the Quantum Register &quot;qr&quot;&#xA;    # and the Classical Register &quot;cr&quot;.&#xA;    qc = Q_program.create_circuit(&quot;bell&quot;, [qr], [cr])&#xA;&#xA;    # Add the H gate in the Qubit 0, putting this qubit in superposition.&#xA;    qc.h(qr[0])&#xA;    # Add the CX gate on control qubit 0 and target qubit 1, putting &#xA;    # the qubits in a Bell state&#xA;    qc.cx(qr[0], qr[1])&#xA;&#xA;    # Add a Measure gate to see the state.&#xA;    qc.measure(qr, cr)&#xA;&#xA;    # Compile and execute the Quantum Program.&#xA;    result = Q_program.execute([&quot;bell&quot;], backend=backend, shots=1024, seed=1)&#xA;&#xA;    # Show the results.&#xA;    print(result)&#xA;    print(result.get_data(&quot;bell&quot;))&#xA;&#xA;except QISKitError as ex:&#xA;    print('There was an error in the circuit!. Error = {}'.format(ex))&#xA;except RegisterSizeError as ex:&#xA;    print('Error in the number of registers!. Error = {}'.format(ex))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I set my &lt;code&gt;APItoken&lt;/code&gt; in &lt;code&gt;Qconfig.py&lt;/code&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;APItoken = 'XXX'&#xA;config = {&#xA;    'url': 'https://quantumexperience.ng.bluemix.net/api',&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the code fails with the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The backends available for use are: ibmqx2,ibmqx5,ibmqx4,ibmqx_hpc_qasm_simulator,ibmqx_qasm_simulator,local_qasm_simulator,local_clifford_simulator,local_qiskit_simulator,local_unitary_simulator&#xA;&#xA;ERROR&#xA;There was an error in the circuit!. Error = 'QISkit Time Out'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tested both &lt;code&gt;ibmqx4&lt;/code&gt; and &lt;code&gt;ibmqx5&lt;/code&gt;, the same issue. I can see that they're active at &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/devices&quot; rel=&quot;noreferrer&quot;&gt;/qx/devices&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does it mean? Does it mean the IBM Q server is down, or the program is too big to execute? Or there is something else going on? In other words, what should I do to run a simple Hello Quantum program on IBM quantum server?&lt;/p&gt;&#xA;" OwnerUserId="99" LastEditorUserId="26" LastEditDate="2019-03-12T09:24:49.887" LastActivityDate="2019-03-12T09:24:49.887" Title="There was an error in the circuit!. Error = 'QISkit Time Out'" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1248" PostTypeId="5" CreationDate="2018-03-21T13:38:56.667" Score="0" Body="&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum algorithm&lt;/a&gt; is a procedure or set of instructions that can be performed on a theoretical model of a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/tags/quantum-computer/info&quot;&gt;quantum computer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, a quantum algorithm solves some problem and utilises the properties of quantum physics, such as entanglement, to do so. Often, a quantum algorithm will have a better time/query complexity than a classical algorithm solving the same problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An algorithm can be written as a program in a quantum programming language, which can then be implemented on a large enough quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Some famous algorithms include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Josza algorithm&lt;/a&gt;: The first algorithm to exponentially fast than the classical equivalent, showing the potential of quantum computing. Given an oracle that implements a function that takes an n-bit input and returns a single-bit output and is known to be either balanced (returning '1' as often as '0' over all inputs) or constant (the output is the same regardless of input), the Deutsch-Josza algorithm can deterministically find if the function is constant or balanced in a single step.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Simon%27s_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon's algorithm&lt;/a&gt;: Given an oracle that implements a function (returning the same number of output bits as input bits) with the property that &lt;span class=&quot;math-container&quot;&gt;$f\left(x\right)=f\left(x\oplus s\right)\forall x\in\left\lbrace0, 1\right\rbrace^n$&lt;/span&gt;, for some unknown &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, Simon's algorithm finds &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathcal O\left(n\right)$&lt;/span&gt; queries, in comparison with the best possible algorithm requiring &lt;span class=&quot;math-container&quot;&gt;$\Omega\left(2^{n/2}\right)$&lt;/span&gt; queries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;: Solves the problem of integer factorisation sub-exponentially faster than the current best known classical algorithm (the general number field sieve). As current classical encryption methods rely on the computational difficulty in performing integer factorisation, a large enough fault tolerant universal quantum computer would break current encryption methods.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt;: This finds the input value to an oracle returning a particular output for that input in a time quadratically faster than a classical computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A list of all the currently discovered quantum algorithms can be found at the &lt;a href=&quot;https://math.nist.gov/quantum/zoo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum complexity zoo&lt;/a&gt;, which also contains links to several reviews on algorithms. Aside from Nielsen and Chuang's &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; textbook, these are lecture notes by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.umd.edu/~amchilds/qa/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andrew Child&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph229/#lecture&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Preskill&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Michael Loceff's *A Course in Quantum Computing (for the Community College) - &lt;a href=&quot;https://www.fgamedia.org/faculty/loceff/cs_courses/cs_83a/Intro_to_QC_Vol_1_Loceff.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;pdf link&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;as well as review articles by:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/0808.0369&quot; rel=&quot;nofollow noreferrer&quot;&gt;Michele Mosca&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/0812.0380&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andrew Childs and Wim van Dam&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1206.6126&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wim van Dam and Yoshitaka Sasaki&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cacm.acm.org/magazines/2010/2/69352-recent-progress-in-quantum-algorithms/fulltext&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dave Bacon and Wim van Dam&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1511.04206&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ashley Montanaro&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="45" LastEditorUserId="45" LastEditDate="2018-11-09T21:11:24.687" LastActivityDate="2018-11-09T21:11:24.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1249" PostTypeId="4" CreationDate="2018-03-21T13:38:56.667" Score="0" Body="For questions about quantum algorithms, that is, sequences of quantum gates, operations, and measurements, whose purpose which achieve some goal. Standard examples are Shor's and Grover's algorithms." OwnerUserId="253" LastEditorUserId="55" LastEditDate="2021-05-12T09:49:17.473" LastActivityDate="2021-05-12T09:49:17.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1250" PostTypeId="2" ParentId="1247" CreationDate="2018-03-21T14:45:44.227" Score="3" Body="&lt;p&gt;As per &lt;a href=&quot;https://github.com/QISKit/qiskit-sdk-py/issues/354&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub post&lt;/a&gt;, I had to increase the timeout for &lt;code&gt;Q_program.execute()&lt;/code&gt;, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = Q_program.execute([&quot;bell&quot;], backend=backend, shots=1024, seed=1, timeout=600)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason is probably, that the queues are busy, so we need to tell QISKit to wait up to 10 minutes. This instruction is basically blocking the rest of the script and wait till the job is executed on the actual backend server and the results are returned.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To list details of the jobs which has been submitted, the following code can be used as proposed by &lt;a href=&quot;https://github.com/QISKit/qiskit-sdk-py/issues/354#issuecomment-374962526&quot; rel=&quot;nofollow noreferrer&quot;&gt;@ajavadia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumProgram&#xA;import Qconfig&#xA;&#xA;qp = QuantumProgram()&#xA;qp.set_api(Qconfig.APItoken, Qconfig.config['url'])&#xA;&#xA;# Download details of all the jobs you've ever submitted (the default limit is 50).&#xA;my_jobs = qp.get_api().get_jobs(limit=999)&#xA;&#xA;# Filter down to get a list of completed jobs.&#xA;done_jobs = [j for j in my_jobs if j['status']=='COMPLETED']&#xA;&#xA;# Print the results for all of your completed jobs.&#xA;for j in done_jobs:&#xA;    for q in j['qasms']:&#xA;        print(q['qasm'])&#xA;        print(q['result'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="99" LastEditorUserId="99" LastEditDate="2018-03-21T14:52:14.930" LastActivityDate="2018-03-21T14:52:14.930" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1251" PostTypeId="2" ParentId="1247" CreationDate="2018-03-21T17:18:51.900" Score="6" Body="&lt;p&gt;Your job timed out, probably because of the queue being too long for the job to complete in the time allowed by default for &lt;code&gt;.execute()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you already know that, of course, because you have already written &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1251/409&quot;&gt;an excellent answer of your own&lt;/a&gt;. Nevertheless, I have some insights to add from battle hardened experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I usually use &lt;a href=&quot;https://github.com/decodoku/Misc_QISKit_Things/blob/master/Status.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this notebook&lt;/a&gt; to check on how busy a device is, and if it is active. Then I typically run jobs in the following way.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    noResults = True&#xA;    while noResults:&#xA;        try: # try to run, and wait if it fails&#xA;            executedJob = engine.execute([&quot;script&quot;], backend=backend, shots=shots, max_credits = 5, wait=30, timeout=600)&#xA;            resultsVeryRaw = executedJob.get_counts(&quot;script&quot;)&#xA;            if ('status' not in resultsVeryRaw.keys()):&#xA;                noResults = False&#xA;            else:&#xA;                print(resultsVeryRaw)&#xA;                print(&quot;This is not data, so we'll wait and try again&quot;)&#xA;                time.sleep(300)&#xA;        except:&#xA;            print(&quot;Job failed. We'll wait and try again&quot;)&#xA;            time.sleep(600)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This uses &lt;code&gt;try&lt;/code&gt; to manage any exceptions that might result. The program will just wait and try again rather than crash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we get to the point of successfully using &lt;code&gt;.get_counts&lt;/code&gt;, the program then checks to see if it actually contains results. Or rather, it checks that the &lt;code&gt;'status'&lt;/code&gt; key is not present, for it is the harbinger of doom. If there is not proper results, the program again waits and tries again.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-21T18:14:06.007" LastActivityDate="2018-03-21T18:14:06.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1252" PostTypeId="2" ParentId="1236" CreationDate="2018-03-21T18:02:38.053" Score="4" Body="&lt;p&gt;I'll try to give a slightly different perspective on the same things covered by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1240/55&quot;&gt;the other answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;table of truth&quot; characterises a gate by telling you how each basis state evolves through the gate.&#xA;Note that this requires choosing an input &lt;em&gt;and&lt;/em&gt; and output bases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the prototypical example of the CNOT gate, one chooses the computational basis both for input and output states, and it turns out that all the elements of the computational basis evolve into other elements of the computational basis.&#xA;In other words, an element of the computational basis, passing through a CNOT gate, ends up in a specific output basis state (as opposed to a &lt;em&gt;superposition&lt;/em&gt; of basis states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What might be confusing in this &quot;table of truth&quot; way to describe a gate, is that it can be used only with some choices of input and output bases.&#xA;For example, you cannot give a &quot;table of truth&quot; description of the CNOT gate using the &lt;span class=&quot;math-container&quot;&gt;$\{|L\rangle, |R\rangle\}$&lt;/span&gt; basis, because, as you can check, &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}|L, L\rangle = \frac{1}{2}(|L, L\rangle + i |L, R\rangle + |R, L\rangle -i|R, R\rangle)$&lt;/span&gt;.&#xA;Indeed, the &quot;table of truth representation&quot; is only useful in some circumstances, for example when one wants to highlight that a gate might be a &quot;quantum generalisation&quot; of a specific classical gate, like it's the case for the CNOT gate.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-05-15T16:45:37.693" LastActivityDate="2019-05-15T16:45:37.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1253" PostTypeId="5" CreationDate="2018-03-21T19:05:11.547" Score="0" Body="&lt;p&gt;For a system with a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt;, the state of that system can be written as &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;_A = \sum_j\alpha_j\left|\phi_j\right&amp;gt;_A$&lt;/span&gt;, for a basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|\phi_j\right&amp;gt;_A\right\rbrace$&lt;/span&gt; with coefficients &lt;span class=&quot;math-container&quot;&gt;$\alpha_j$&lt;/span&gt;. Similarly, for a system with a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;, the state of that system can be written as &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;_B = \sum_j\beta_j\left|\phi_j\right&amp;gt;_B$&lt;/span&gt;, for a basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|\phi_j\right&amp;gt;_B\right\rbrace$&lt;/span&gt; with coefficients &lt;span class=&quot;math-container&quot;&gt;$\beta_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For two systems with Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;, forming an overall Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H=H_A\otimes H_B$&lt;/span&gt;, the state can then be written as &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \sum_{j, k}c_{jk}\left|\phi_j\right&amp;gt;_A\otimes\left|\phi_k\right&amp;gt;_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When there exists any states &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;_B$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \left|\psi\right&amp;gt;_A\otimes\left|\psi\right&amp;gt;_B$&lt;/span&gt;, the state can be described as being a &lt;em&gt;separable&lt;/em&gt; or &lt;em&gt;product&lt;/em&gt; state. Otherwise, the state is said to be &lt;em&gt;entangled&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;An example of an entangled state is &lt;span class=&quot;math-container&quot;&gt;$$\left|\psi\right&amp;gt; = \frac{1}{\sqrt{2}}\left(\left|0\right&amp;gt;_A\otimes\left|0\right&amp;gt;_B \pm \left|1\right&amp;gt;_A\otimes\left|1\right&amp;gt;_B\right),$$&lt;/span&gt; often denoted as &lt;span class=&quot;math-container&quot;&gt;$$\left|\psi\right&amp;gt; = \frac{1}{\sqrt{2}}\left(\left|00\right&amp;gt;\pm\left|11\right&amp;gt;\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When system A is measured (usually by someone known as Alice), this &lt;em&gt;collapses&lt;/em&gt; system B into the appropriate state, so that when system B is measured (by someone called Bob), the outcomes are &lt;em&gt;correlated&lt;/em&gt;. In this example, If Alice measures in the same basis as written here and the system is found to be in state &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;, Bob's system will also be in state &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; immediately after Alice's measurement. Similarly if Alice's system is found to be in state &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;, Bob's system will also be found to be in state &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="23" LastEditDate="2018-11-04T19:18:43.593" LastActivityDate="2018-11-04T19:18:43.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1254" PostTypeId="4" CreationDate="2018-03-21T19:05:11.547" Score="0" Body="For questions about the principle and application of quantum entanglement. It is a physical phenomenon which occurs when pairs or groups of particles are generated, interact, or share spatial proximity in ways such that the quantum state of each particle cannot be described independently of the state of the other(s), even when the particles are separated by a large distance—instead, a quantum state must be described for the system as a whole. (Wikipedia)" OwnerUserId="11" LastEditorUserId="26" LastEditDate="2019-01-01T08:44:44.070" LastActivityDate="2019-01-01T08:44:44.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1255" PostTypeId="1" AcceptedAnswerId="1260" CreationDate="2018-03-21T23:09:07.573" Score="15" ViewCount="859" Body="&lt;p&gt;In the last years, there has been a spur of demonstrations of devices able to perform proof of principle, small-scale, non-fault-tolerant quantum computation (or Noisy Intermediate-Scale Quantum technologies, how &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;noreferrer&quot;&gt;they have been referred to&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this I'm mostly referring to the superconducting and ion trap devices demonstrated by groups such as Google, Microsoft, Rigetti Computing, Blatt's group (and probably others that I'm forgetting now).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These devices, as well as the ones that will follow them, are often radically different from each other (in terms of architecture, gates that are easier/harder to implement, number of qubit, connectivity between the qubits, coherence and gate times, generation and readout capabilities, gate fidelities, to name the most obvious factors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, it is very common in press releases and non-technical news to just say &quot;the new X device has Y more qubits than the one before, therefore it is so much more powerful&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the number of qubits really such an important factor to assess these devices? Or should we instead use different metrics? More generally, are there &quot;simple&quot; metrics that can be used to qualitatively, but meaningfully, compare different devices? &lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2019-01-01T10:16:00.950" LastActivityDate="2019-01-01T10:16:00.950" Title="How should different quantum computing devices be compared?" Tags="&lt;architecture&gt;&lt;technical-standards&gt;&lt;nisq&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1256" PostTypeId="2" ParentId="1255" CreationDate="2018-03-21T23:51:03.770" Score="14" Body="&lt;p&gt;This is a greatly debated topic, and I'm not sure there is an answer to your question at the current time. However, the &lt;a href=&quot;https://www.ieee.org/index.html&quot; rel=&quot;noreferrer&quot;&gt;IEEE&lt;/a&gt; (Institute of Electrical and Electronics Engineers) has proposed PAR 7131 - &lt;a href=&quot;https://standards.ieee.org/develop/project/7131.html&quot; rel=&quot;noreferrer&quot;&gt;Standard for Quantum Computing Performance Metrics &amp;amp; Performance Benchmarking&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The purpose of this project is to provide a standardized set of&#xA;  performance metrics and a standardized methodology of benchmarking the&#xA;  speed/performance of various types of quantum computing hardware and&#xA;  software as well as comparing these performance metrics to identical&#xA;  metrics in classical computers such that users of this document may&#xA;  determine the speed of a quantum computer for a specific application&#xA;  can easily, and reliably, compare computer performance.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Full disclosure I am the current Chair of the Quantum Computing Standards Workgroup and the reason this PAR was originally proposed was because of a lack of documentation/standards on testing the various quantum computing architectures against classical architectures and each other. The factors you sighted above &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;number of qubit, connectivity between the qubits, coherence and gate&#xA;  times, generation and readout capabilities, gate fidelities&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;are all included as are several other factors. As importantly we've also been working on a way to standardize solvers; an often overlooked component in benchmarking. Non-optimized solvers all too often benefit a quantum machine when comparing quantum architectures to classical architectures. That is, the solver running on the quantum architecture is always optimized where the solver running on the classical architecture is not. This creates an inherent bias in favor of the quantum architecture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in participating in the development of this standard please let me know, the more people involved from both the quantum and classical sides of the argument the better imho. In the meantime the PAR will start work shortly, and will be coordinating their efforts with other standards organizations so that a single common standard with no bias can emerge to help address performance and benchmarking in the future. &lt;/p&gt;&#xA;" OwnerUserId="274" LastEditorUserId="52" LastEditDate="2018-03-22T16:44:43.943" LastActivityDate="2018-03-22T16:44:43.943" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1257" PostTypeId="2" ParentId="1255" CreationDate="2018-03-22T00:05:45.893" Score="7" Body="&lt;p&gt;IBM is promoting their &lt;a href=&quot;https://www.research.ibm.com/ibm-q/resources/quantum-volume.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum volume&lt;/a&gt; (see also &lt;a href=&quot;https://pdfs.semanticscholar.org/650c/3fa2a231cd77cf3d882e1659ee14175c01d5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;) idea to quantify the power of a gate model machine with a single number. Before IBM, there was an attempt from Rigetti to define a &lt;a href=&quot;http://willzeng.com/shared/functional_architecture_final_ICRC.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;total quantum factor&lt;/a&gt;.&#xA;Unclear if it captures what we want in terms of usefulness of devices for applications. Things such as quantum volume are be designed with supremacy experiments in mind, it seems to me. I am leaning to think that a metric should be really application specific. For sampling, this work suggested to use &lt;a href=&quot;https://arxiv.org/abs/1801.07686&quot; rel=&quot;nofollow noreferrer&quot;&gt;the qBAS score&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum annealing and similar analog approaches, it seems the community is agreeing on &lt;a href=&quot;https://arxiv.org/abs/1401.2910&quot; rel=&quot;nofollow noreferrer&quot;&gt;time-to-solution&lt;/a&gt; and variants; once again quite application specifics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The community is working on defining metrics, and I expect in 2018 to see actual runs of the same problem on different devices (empirical comparison).&lt;/p&gt;&#xA;" OwnerUserId="410" LastEditorUserId="410" LastEditDate="2018-03-23T01:54:26.350" LastActivityDate="2018-03-23T01:54:26.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1258" PostTypeId="2" ParentId="1255" CreationDate="2018-03-22T00:39:38.400" Score="9" Body="&lt;p&gt;While number of qubits should be &lt;em&gt;part of&lt;/em&gt; such a metric, as you say, it's far from everything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, comparing two different completely different devices (e.g. superconducting and linear optics) is not the most straightforward task&lt;sup&gt;1&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Factors&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Asking about coherence and gate times is equivalent to asking about fidelity and gate times&lt;sup&gt;1&lt;/sup&gt;. Gates being harder or easier to implement just affects the fidelity again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initialisation rate, qubit/entanglement generation and readout capabilities (etc.) are going to affect overall fidelities as well as something akin to 'how frequently (on average) can we perform a computation (while getting a high-enough fidelity result, for some idea of 'high-enough fidelity')'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of architecture, the more macro-architecture (e.g. qRAM) will have its own standards and benchmarks, such as readout time, 'is readout on demand?' and of course, fidelity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more microarchitecture can be described under the same notions of connectivity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another, often ignored, metric is the power/resources used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, this may have narrowed this list down &lt;em&gt;slightly&lt;/em&gt;, but it's still a list that involves a fair amount of comparison. Comparing different devices that use the same method isn't even that straightforward as (at current levels of technology), the processors with higher numbers of qubits often have lower fidelities&lt;sup&gt;2&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Quantum volume&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Thankfully, a few people at IBM have taken the above (except for power used and the architecture) and defined something a bit more useful than 'number of qubits' and called it &lt;a href=&quot;https://www.semanticscholar.org/paper/Quantum-Volume-Bishop-Bravyi/650c3fa2a231cd77cf3d882e1659ee14175c01d5&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;quantum volume&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;. In this, for a random pair of $2$ qubits, they first define an effective error rate, $\epsilon_{eff}$, by considering what gate errors would be required in an otherwise perfect system to give the same error as the device. This may require the use of SWAP for low connectivity and Solovay-Kitaev-esque methods for low numbers of implementable gates. This is countered by using teleportation if the system has &quot;fast measurements and feedback&quot; and any other appropriate method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a total number of qubits $n$ and maximising over the number of 'active qubits', $n'$, the quantum volume is $$V_Q = \max_{n'\leq n}\min\left[n', \frac{1}{\epsilon_{eff}\left(n'\right)}\right]^2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, we want to move beyond the point of science and into engineering. For that we need a standard&lt;sup&gt;3&lt;/sup&gt;. This is currently being planned, as detailed in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1256/23&quot;&gt;Whurley's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as any comparison between such lists isn't going to be straightforward, there's always the more subjective way, such as &lt;a href=&quot;https://medium.com/@decodoku/how-good-are-todays-quantum-computers-really-896488e0b701&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;&lt;em&gt;Quantum Awesomeness&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;, where the enjoyment of the game depends on how good the processor is&lt;sup&gt;4&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 In this particular case, one example is that as photons don't decohere, so this has to be adapted to asking about the length of time or number of gates before the realised state is no longer a good approximation to the ideal state, which is just asking for the fidelity, or fidelity and gate times&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 I've tried this much at least and even this isn't exactly the most fun task&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;3 The first, unlike in &lt;a href=&quot;https://xkcd.com/927/&quot; rel=&quot;noreferrer&quot;&gt;XKCD 927&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;4 The author's opinion is that, while an awesome idea and helpful for getting an idea of how good a processor is, saying that one processor is better than another at such a game is a bit &lt;em&gt;too&lt;/em&gt; subjective to tell if one processor is &lt;em&gt;actually&lt;/em&gt; better than another&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-22T00:44:52.090" LastActivityDate="2018-03-22T00:44:52.090" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1259" PostTypeId="2" ParentId="1244" CreationDate="2018-03-22T08:02:28.817" Score="4" Body="&lt;p&gt;It's not so much a matter of big data, but that of saving data. Quantum storage is still (much like the rest of the field) in its infancy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Take what I write with a grain of salt. It's likely to change rapidly.)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few theories on how quantum computers might be able to hold &quot;memory&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of these is using nuclear spin. E.g. using long-lived nuclei in a quantum state. Converting an electron qubit (a qubit represented by an electron) to a nuclear qubit is &lt;a href=&quot;https://arxiv.org/abs/0803.2021&quot; rel=&quot;nofollow noreferrer&quot;&gt;possible&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Why nuclear qubit/spin?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A nucleus's coherence time - the time for which its phase is constant (when considering its wave function) - is longer than that of an electron. The &lt;a href=&quot;https://arxiv.org/abs/0803.2021&quot; rel=&quot;nofollow noreferrer&quot;&gt;linked article&lt;/a&gt; (same one as before) details how one can increase the coherence time of a nuclear spin (to some extent). The matter is being researched, but there is some indication that nuclear qubits can be a form of quantum storage.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;What makes it difficult&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The quantum state needs to remain, well, quantum. Additionally, if you entangle two of your &quot;storage&quot; qubits, you are likely to lose data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to no-cloning, one cannot simply &quot;copy&quot; a qubit (whose state is unknown), which is one of the reasons quantum storage is difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &quot;big&quot; data, it's just a matter of how much memory you have.&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="26" LastEditDate="2019-05-15T14:47:37.300" LastActivityDate="2019-05-15T14:47:37.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1260" PostTypeId="2" ParentId="1255" CreationDate="2018-03-22T10:09:08.527" Score="5" Body="&lt;p&gt;I think the answer depends on why you are comparing them. Things like the quantum volume, are perhaps better suited to defining progress in the development of devices rather than fully informing end users.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you are buying a new laptop, you probably use more than just a single number when comparing them. The same should be true for quantum processors. There are many different aspects to a device: number of qubits, connectivity, all the different types of noise, time for measurement (and so whether feedback from measurement results is feasible), gate operation times, etc. All these need to be combined to tell you the one thing you actually need to know: can it run the program that you want to run? That is, I think, always going to be the most pertinent comparison. But it is also the trickiest.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-03-22T10:09:08.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1262" PostTypeId="1" CreationDate="2018-03-22T11:54:59.120" Score="13" ViewCount="472" Body="&lt;p&gt;When expressing computations in terms of a quantum circuit, one makes use of &lt;em&gt;gates&lt;/em&gt;, that is, (typically) unitary evolutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some sense, these are rather mysterious objects, in that they perform &quot;magic&quot; discrete operations on the states.&#xA;They are essentially black boxes, whose inner workings are not often dealt with while studying quantum algorithms.&#xA;However, that is not how quantum mechanics works: states evolve in a continuous fashion following Schrödinger's equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, when talking about quantum gates and operations, one neglects the &lt;em&gt;dynamic&lt;/em&gt; (that is, the Hamiltonian) realising said evolution, which is how the gates are actually implemented in experimental architectures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One method is to decompose the gate in terms of elementary (in a given experimental architecture) ones. Is this the only way? What about such &quot;elementary&quot; gates? How are the dynamics implementing those typically found?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2018-12-23T14:17:14.563" LastActivityDate="2018-12-23T14:17:14.563" Title="How are quantum gates realised, in terms of the dynamic?" Tags="&lt;quantum-gate&gt;&lt;architecture&gt;&lt;physical-realization&gt;&lt;hamiltonian-simulation&gt;&lt;dynamics&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1263" PostTypeId="1" AcceptedAnswerId="1264" CreationDate="2018-03-22T12:19:53.040" Score="3" ViewCount="711" Body="&lt;p&gt;The most down-voted question at the moment is about using entanglement for faster-than-light communication. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Much like how the word “laser” replaced “magic” in the vernacular not too long ago, what are some things that people outside the field think quantum computers, qubits, entanglement, tunneling, or superposition do that people might need to be educated about? Or what are some popular myths about these things should be dispelled?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One question I’m asked frequently is the reason for the difference in the number of qubits between the D Wave and IBM QX. D Wave has more so it must be better. So in this case, people need to be educated on the different implementations of quantum devices. &lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="26" LastEditDate="2018-12-23T12:10:16.707" LastActivityDate="2018-12-23T12:10:16.707" Title="What are some popular myths or common misconceptions about quantum computing?" Tags="&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2018-03-22T15:04:15.387" ContentLicense="CC BY-SA 3.0" />
  <row Id="1264" PostTypeId="2" ParentId="1263" CreationDate="2018-03-22T12:50:39.920" Score="11" Body="&lt;p&gt;&lt;strong&gt;1. Quantum computers are powerful because they act in many universes at once&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an oversimplification based on the MWI at best. I don't think it has any pedagogical value. It needs to stop being repeated. Every journalist I talk to asks whether it is a good thing to write. I always say no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. Quantum computers/physics is weird and random&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone not swept up in the parallel universes seems to think that quantum computers are just some weird random thing. As before, there is a kernel of truth, but it is not a good explanation. Quantum algorithms are all about managing the certainty in the system, moving it through the state space to turn a certain input into an (ideally) certain output. The randomness is there, but I don't think it should be the focus of an understanding of quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seems to be an idea that quantum physics is just a strange random thing. And so quantum computers are just computers with weird randomness going on. From what I've seen, anyone who doesn't get swept up in the whole 'computing in many&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. Quantum physics does not follow logic&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The popular talk of how strange and weird quantum physics is makes it seem quite illogical. This is pretty bad from the perspective of quantum computing, since computers are build on logic. How can a programmer be expected to make the move o quantum if they think that quantum programming is illogical? If the quantum world seems like a mystical realm understood only through arcane knowledge, it will be hard to engage people outside of the field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though quantum physics doesn't follow the logic of local hidden variables and non-contextuality, it of course has its own logic. The fun of quantum computing is learning how to embrace and use effects that are not possible in classical variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think we should be championing the message that quantum computers are full of logic and certainty, and that these are what we harness to do computation. Too much talk of random and strange effects should be avoided. As should the whole multiple universe thing.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-03-22T12:50:39.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1265" PostTypeId="1" AcceptedAnswerId="1273" CreationDate="2018-03-22T14:26:11.617" Score="11" ViewCount="6705" Body="&lt;p&gt;Recently, I've read about 'quantum bogosort' on some wiki. The basic idea is, that like bogosort, we just shuffle our array and hope it gets sorted 'by accident' and retry on failure. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The difference is that now, we have '&lt;em&gt;magic&lt;/em&gt; quantum', so we can simply try all permutations at once in 'parallel universes' and 'destroy all bad universes' where the sort is bad. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, obviously, this doesn't work. Quantum is physics, not magic. The main problems are &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;'Parallel universes' is merely an &lt;em&gt;interpretation&lt;/em&gt; of quantum effects, not something that quantum computing exploits. I mean, we could use hard numbers here, interpretation will only confuse matters here, I think.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;'Destroying all bad universes' is a bit like qubit error correction, a very hard problem in quantum computing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bogo sort remains stupid. If we can speed-up sorting via quantum, why not base it on a &lt;em&gt;good sorting algorithm&lt;/em&gt;? (But we need randomness, my neighbour protests! Yes, but can't you think of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quicksort&quot; rel=&quot;nofollow noreferrer&quot;&gt;a better classical algorithm that relies on randomness&lt;/a&gt;?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;While this algorithm is mostly a joke, it could be an 'educational joke', like the 'classical' bogosort as the difference between best case, worst case and average case complexity for randomized algorithms is easy and very clear here. (for the record, best case is &lt;span class=&quot;math-container&quot;&gt;$\Theta(n)$&lt;/span&gt;, we are very lucky but still must check that our answer is correct by scanning the array, expected time is simply &lt;em&gt;awful&lt;/em&gt; (IIRC, proportional to the number of permutations, so &lt;span class=&quot;math-container&quot;&gt;$O(n!)$&lt;/span&gt;) and worst case is we never finish)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what can we learn from 'quantum bogosort'? In particular, are there real quantum algorithms that are similar or is this a theoretical or practical impossibility?&#xA;Furthermore, has there been research into 'quantum sorting algorithms'? If not, why?&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-05-15T15:16:35.113" LastActivityDate="2021-01-03T14:51:41.333" Title="What can we learn from 'quantum bogosort'?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;speedup&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1266" PostTypeId="5" CreationDate="2018-03-22T14:29:57.423" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-22T14:29:57.423" LastActivityDate="2018-03-22T14:29:57.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1267" PostTypeId="4" CreationDate="2018-03-22T14:29:57.423" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-22T14:29:57.423" LastActivityDate="2018-03-22T14:29:57.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1268" PostTypeId="2" ParentId="1208" CreationDate="2018-03-22T21:07:54.307" Score="14" Body="&lt;p&gt;I will only answer to the part of the question regarding how quantum mechanics can be useful to analyse classical data with machine-learning-like techniques.&#xA;There are also works related to &quot;quantum AI&quot;, but that is a much more speculative (and less defined) kind of thing, which I do not want to go into.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;em&gt;can quantum computers be used to speed-up data analysis via machine learning algorithms&lt;/em&gt;? Quoting &lt;a href=&quot;https://www.scottaaronson.com/papers/qml.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aaronson's &lt;em&gt;Read the fine print&lt;/em&gt;&lt;/a&gt; paper, &lt;em&gt;that’s a simple question with a complicated answer&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should first of all be noted that trying to answer this kind of question is a big part of what the research area of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_machine_learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Machine Learning&lt;/a&gt; is about (the terms &lt;em&gt;quantum-enhanced machine learning&lt;/em&gt; and &lt;em&gt;quantum assisted machine learning&lt;/em&gt; are also often used to refer to this merger of QM and ML, to distinguish it from the use of ML to help solve problems in QM, which is an entirely different subject).&#xA;As you can see from the Wikipedia page, there are many things going on in the field, and it would be pointless to try and give a comprehensive list of relevant papers here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quoting from &lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schuld et al. 2014&lt;/a&gt;, the idea behind &lt;em&gt;Quantum-Assisted Machine Learning&lt;/em&gt; (QAML) is the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Since the volume of globally stored data is growing by around 20%&#xA;  every year (currently ranging in the order of several hundred exabytes&#xA;  [1]), the pressure to find innovative approaches to machine learning&#xA;  is rising. A promising idea that is currently investigated by academia&#xA;  as well as in the research labs of leading IT companies exploits the&#xA;  potential of quantum computing in order to optimise classical machine&#xA;  learning algorithms.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Going back to your question, a first seemingly positive answer was provided by &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harrow et al. 2009&lt;/a&gt;, which gave an efficient quantum algorithm to invert linear system of equations (under a number of conditions over the system), working when the data is stored in quantum states. Being this a fundamental linear algebra operation, the discovery led to many proposed quantum algorithms to solve machine learning problems by some of the same authors (&lt;a href=&quot;https://arxiv.org/abs/1307.0401&quot; rel=&quot;nofollow noreferrer&quot;&gt;1307.0401&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;nofollow noreferrer&quot;&gt;1307.0411&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1307.0471&quot; rel=&quot;nofollow noreferrer&quot;&gt;1307.0471&lt;/a&gt;), as well as by many others.&#xA;There are now many reviews that you can have a look at to get more comprehensive lists of references, like &lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;nofollow noreferrer&quot;&gt;1409.3097&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1512.02900&quot; rel=&quot;nofollow noreferrer&quot;&gt;1512.02900&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1611.09347&quot; rel=&quot;nofollow noreferrer&quot;&gt;1611.09347&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1707.08561&quot; rel=&quot;nofollow noreferrer&quot;&gt;1707.08561&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1708.09757&quot; rel=&quot;nofollow noreferrer&quot;&gt;1708.09757&lt;/a&gt;, &lt;a href=&quot;https://www.sciencedirect.com/science/book/9780128009536&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peter Wittek's book&lt;/a&gt;, and likely more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is far from established how this would work in practice. Some of the reasons are well explained in Aaronson's paper: &lt;a href=&quot;https://www.scottaaronson.com/papers/qml.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Read the fine print&lt;/em&gt;&lt;/a&gt; (see also published version: &lt;a href=&quot;https://www.nature.com/articles/nphys3272&quot; rel=&quot;nofollow noreferrer&quot;&gt;nphys3272&lt;/a&gt;).&#xA;Very roughly speaking, the problem is that quantum algorithms generally handle &quot;data&quot; as stored in quantum states, often encoding vectors into the amplitudes of the state.&#xA;This is, for example, the case for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;QFT&lt;/a&gt;, and it is still the case for &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL09&lt;/a&gt; and derived works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The big problem (or one of the big problems) with this is that it is far from obvious how you can efficiently load the &quot;big&quot; classical data into this quantum state for processing. The typical answer to this is &quot;we just have to use a &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;qRAM&lt;/a&gt;&quot;, but that also comes with many caveats, as this process needs to be very fast to maintain the exponential speed-up that we now can be achieved once the data is in quantum form.&#xA;Again, further details can be found in &lt;a href=&quot;https://www.nature.com/articles/nphys3272&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson's paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-04-27T11:57:42.580" LastActivityDate="2020-04-27T11:57:42.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1269" PostTypeId="1" AcceptedAnswerId="1279" CreationDate="2018-03-22T21:35:42.920" Score="8" ViewCount="710" Body="&lt;p&gt;So, @AndrewO mentioned recently that he has had 'encounters' with people wondering why D-Wave has &lt;em&gt;a lot more qubits than IBM&lt;/em&gt;. Of course, this comparison is faulty, since the IBM and D-Wave's machine may both exploit quantum effects to a certain degree, IBM's machine matches the thing the TCS people call a 'Quantum computer' a bit more than D-Waves's alleged quantum annealer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you explain to a novice why IBM is still reaching important milesstones, even though the D-Wave has &lt;em&gt;a lot more 'qubits'&lt;/em&gt;. I understand that an easy answer is, 'well, you're comparing apples and pears', but that is merely relying on your possible authority and simply doesn't explain anything! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can you explain that those devices are different, how can you dispell the myth that the number of qubits is not the only metric to judge quantum devices? (preferably to a layman, but assuming basic (undergrad?) physics knowledge is ok, if needed)&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-01-31T17:53:58.480" LastActivityDate="2019-02-02T21:05:10.383" Title="How to explain in layman’s terms the significance of the difference of qubits of the D-Wave and IBM QX?" Tags="&lt;physical-realization&gt;&lt;d-wave&gt;&lt;performance&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1270" PostTypeId="2" ParentId="12" CreationDate="2018-03-23T04:10:24.303" Score="3" Body="&lt;p&gt;Yes. If you build it yourself, find a 3rd party computer with the same specs as the BullSequana M9600 series, or come up with &lt;a href=&quot;http://www.computerweekly.com/news/450421977/Atos-targets-universities-and-research-centres-with-quantum-computing-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;€100K+&lt;/a&gt; and buy a system from Atos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice the similarity between the BullSequana M9600 series and the &lt;a href=&quot;https://atos.net/en/insights-and-innovation/atos-quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;Atos QLM&lt;/a&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/S1qt6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S1qt6.png&quot; alt=&quot;Atis QLM vs. M9600&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same box (and probably internal components) with different software (but you wanted to use your own, Q#). Atos claims: &quot;The highest-performing quantum simulator in the world&quot;. I'm not sure about that but the specs for the 30 qubit version are reachable, just two Intel CPUs and 1TB of memory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://atos.net/wp-content/uploads/2017/07/atos-quantum-learning-machine.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Atos QLM .PDF Brochure&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there &lt;strong&gt;any way&lt;/strong&gt; to emulate a quantum computer in my &lt;strong&gt;normal&lt;/strong&gt; computer, so that I will be able to &lt;strong&gt;test&lt;/strong&gt; and &lt;strong&gt;try&lt;/strong&gt; quantum programming languages (such as Q#)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you use only 256GB of memory and 1-24TB of Swap Drive it will be &lt;strong&gt;slow&lt;/strong&gt; but it &lt;em&gt;will&lt;/em&gt; work.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I mean something that I can really test my hypothesis on and get &lt;strong&gt;the most accurate results&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quote from the  Brochure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The Atos Quantum Learning Machine &lt;strong&gt;computes the exact execution&lt;/strong&gt; of a quantum program, with double digit precision. It &lt;strong&gt;simulates the laws of physics&lt;/strong&gt;, which are at the very heart of quantum computing. This is very different to existing quantum processors, which suffer from quantum noise, quantum decoherence, and manufacturing biases, as well as performance bottlenecks. Simulation on the Atos Quantum Learning Machine enables developers to focus on their applications and algorithms, without having to wait for quantum machines to be available&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They claim high accuracy, since it's a simulator it's not subject to  noise - nor will it be as fast, or as expensive. In theory you could add some memory,  drives, and software to your computer ...&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-03-23T04:10:24.303" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1271" PostTypeId="1" AcceptedAnswerId="1286" CreationDate="2018-03-23T04:54:39.233" Score="6" ViewCount="227" Body="&lt;p&gt;We've seen people use computers to design computers, AI to write computer programs, robots teach themselves, and even robots build themselves. I understand that conventional computers can be used to emulate quantum computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1ZDzZ.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ZDzZ.gif&quot; alt=&quot;Emika Robotic Arm builds it&amp;#39;s co-workers.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Robotic arm builds more robotic arms.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; Will quantum computers be &lt;strong&gt;inherently able&lt;/strong&gt; to design &lt;strong&gt;better&lt;/strong&gt; quantum computers (which presumably robots could then build) or is that task better suited to Deep Learning / AI and conventional computers (with human intervention)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps another way to ask the question, though I'm fairly certain that this won't make it clearer: &quot;Do conventional computers limit us to quantum  Darwinism while quantum computers might enable universal Darwinism &lt;strong&gt;with respect to&lt;/strong&gt; the evolution of quantum computer design?&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oversimplified (&lt;strong&gt;not&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;the&lt;/em&gt;&lt;/strong&gt; &lt;strong&gt;question&lt;/strong&gt;): Could they understand (design) themselves better than classical computers, Deep Learning / AI, or mankind - IE: they do not suffer from what Zurek calls “pointer states”.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2018-03-25T15:00:40.070" LastActivityDate="2018-03-25T15:00:40.070" Title="Can quantum computers design quantum computers autonomously better than other methods?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;quantum-turing-machine&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1272" PostTypeId="2" ParentId="1262" CreationDate="2018-03-23T06:23:55.710" Score="6" Body="&lt;p&gt;Generally speaking, a realization of a quantum gate involves coherent manipulation of a two-level system (but this is nothing new to you, maybe). For example, you can use two long-lived electronic states in a trapped atom (neutral or ionized in vacuo) and use an applied electric field to implement single-qubit operations (see trapped ions or optical lattices, for example). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, there are solid-state solutions like superconducting qubits or silicon-defect qubits which are addressed by radio-frequency electronics. You can use microwave-addressed nuclear spin sublevels, or nitrogen vacancy cells in diamond. The commonality is that the manipulation and coupling of the qubits is via applied light fields, and there are a range of methods you can use to tune the level spacing in these systems to enable single-spin addressing or manipulate lifetimes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The translation from the implementation to Hamiltonian is obviously dependent on your choice of system, but eventually it all boils back down to Pauli matrices in the end. The light field provides off-diagonal elements in your single-qubit operations, whereas two-qubit operations are trickier and techniques are very implementation-dependent.&lt;/p&gt;&#xA;" OwnerUserId="484" LastActivityDate="2018-03-23T06:23:55.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1273" PostTypeId="2" ParentId="1265" CreationDate="2018-03-23T09:05:19.030" Score="8" Body="&lt;h1&gt;DISCLAIMER: The quantum-bogosort is a joke-algorithm&lt;/h1&gt;&#xA;&lt;p&gt;&lt;strong&gt;Let me just state the algorithm in brief:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Step 1: Using a quantum randomization algorithm, randomize the list/array, such that there is no way of knowing what order the list is in until it is observed. This will divide the universe into &lt;span class=&quot;math-container&quot;&gt;$O(N!)$&lt;/span&gt; universes; however, the division has no cost, as it happens constantly anyway.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Step 2: Check if the list is sorted. If not, destroy the universe (neglecting the actual physical possibility).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now, all remaining universes contain lists/arrays which are sorted.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Worst Case Complexity&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(we only consider those universes which can observe that the list is sorted)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Average/Best Case Complexity&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One of the major problems with this algorithm is the huge possibility magnification of errors as Nick Johnson mentions &lt;a href=&quot;https://stackoverflow.com/questions/2609857/are-there-any-worse-sorting-algorithms-than-bogosort-a-k-a-monkey-sort#comment9410415_2610433&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;This algorithm has a much bigger problem, however. Assume that one in 10 billion times you will mistakenly conclude a list is sorted when it's not. There are 20! ways to sort a 20 element list. After the sort, the remaining universes will be the one in which the list was sorted correctly, and the 2.4 million universes in which the algorithm mistakenly concluded the list was sorted correctly. So what you have here is an algorithm for massively magnifying the error rate of a piece of machinery.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;'Parallel universes' is a highly &lt;em&gt;simplified interpretation of quantum&#xA;effects&lt;/em&gt;, not something that Quantum Computing exploits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Not really sure what you mean by &amp;quot;highly simplified interpretation of quantum effects&amp;quot;. The sources (&lt;a href=&quot;http://wiki.c2.com/?QuantumBogoSort&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://www.reddit.com/r/programming/comments/thtx/my_new_favorite_sorting_algorithm/ctkml/&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;) I found on the internet regarding the quantum bogosort &lt;strong&gt;do not&lt;/strong&gt; explicitly mention that they're using the alternative interpretation of QM i.e. the &lt;a href=&quot;https://en.wikipedia.org/wiki/Many-worlds_interpretation&quot; rel=&quot;noreferrer&quot;&gt;Everett's interpretation&lt;/a&gt; which you might be thinking about. In fact I'm not even sure how to glue together the Everett's interpretation and quantum-bogosort (using post-selection, as some people commented). Anyhow, just as a note: in mainstream cosmology, it is widely believed that more than one universe exists and there are even classifications for them, called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiverse#Max_Tegmark%27s_four_levels&quot; rel=&quot;noreferrer&quot;&gt;Max Tegmark's four levels&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiverse#Brian_Greene%27s_nine_types&quot; rel=&quot;noreferrer&quot;&gt;Brian Greene's nine types&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiverse#Cyclic_theories&quot; rel=&quot;noreferrer&quot;&gt;Cyclic theories&lt;/a&gt;. Read the Wiki article on &lt;a href=&quot;https://en.wikipedia.org/wiki/Multiverse&quot; rel=&quot;noreferrer&quot;&gt;Multiverse&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;'Destroying all bad universes' is a bit like qubit error correction, a&#xA;very hard problem in Quantum Computing.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Sure, it is in fact much harder, and we don't expect to &lt;em&gt;destroy&lt;/em&gt; universes literally. The quantum bogosort is just a theoretical concept, with no practical applications (which I know of).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Bogo sort remains stupid. If we can speed-up sorting via quantum, why&#xA;not base it on a good sorting algorithm? (But we need randomness, my&#xA;neighbour protests! Yes, but can't you think of a better classical&#xA;algorithm that relies on randomness?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes, it does remain &lt;em&gt;stupid&lt;/em&gt;. It does seem to have started out as an &amp;quot;educational joke&amp;quot; as you said. I did try to find the origin of this sort, or relevant academic papers, but couldn't find any. However, even the classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Bogosort&quot; rel=&quot;noreferrer&quot;&gt;bogosort&lt;/a&gt; is stupid in the sense that is widely held as one of the most inefficient sorting algorithms. Still it has been researched on, purely out of educational interest.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In particular, are there real quantum algorithms that are similar or&#xA;is this a theoretical or practical impossibility?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;None that I know of. Such algorithms are indeed theoretical possibilities, but definitely not practical (at least, not yet).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Furthermore, has there been research into 'quantum sorting&#xA;algorithms'? If not, why?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There indeed has been research into &amp;quot;quantum sorting&amp;quot;. But the problem with such sorting algorithms is any comparison-based quantum sorting algorithm would take at least &lt;span class=&quot;math-container&quot;&gt;$\Omega (N\log N)$&lt;/span&gt; steps, which is already achievable by classical algorithms. Thus, for this task, quantum computers are no better than classical ones. However, in space-bounded sorts, quantum algorithms outperform their classical counterparts. &lt;a href=&quot;https://dl.acm.org/citation.cfm?doid=780542.780553&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; and &lt;a href=&quot;https://link.springer.com/chapter/10.1007%2F3-540-48224-5_29&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; are two relevant papers.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-03-23T19:18:35.450" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1274" PostTypeId="2" ParentId="1271" CreationDate="2018-03-23T09:26:07.817" Score="4" Body="&lt;p&gt;We don't yet know if quantum computers are actually better than classical computers, as @heather mentions &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/168/26&quot;&gt;here&lt;/a&gt;. As for now there are just some theoretical algorithms which we know of, specifically for quantum-computers, which have much better time complexities than equivalent classical algorithms. For example - &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;prime factorization&lt;/a&gt; and &lt;a href=&quot;http://ieeexplore.ieee.org/document/365700/&quot; rel=&quot;nofollow noreferrer&quot;&gt;discrete logarithms&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wiki also says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Besides factorization and discrete logarithms, quantum algorithms&#xA;  offering a more than polynomial speedup over the best known classical&#xA;  algorithm have been found for several problems, including the&#xA;  simulation of quantum physical processes from chemistry and solid&#xA;  state physics, the approximation of Jones polynomials, and solving&#xA;  Pell's equation. No mathematical proof has been found that shows that&#xA;  an equally fast classical algorithm cannot be discovered, although&#xA;  this is considered unlikely. For some problems, quantum computers&#xA;  offer a polynomial speedup. The most well-known example of this is&#xA;  quantum database search, which can be solved by Grover's algorithm&#xA;  using quadratically fewer queries to the database than are required by&#xA;  classical algorithms. In this case the advantage is provable. Several&#xA;  other examples of provable quantum speedups for query problems have&#xA;  subsequently been discovered, such as for finding collisions in&#xA;  two-to-one functions and evaluating NAND trees.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Whether you can use these speedups to &lt;em&gt;design&lt;/em&gt; better quantum computers, depends. I can imagine that you could of course simulate a quantum computer using another quantum computer, which could help in making new designs or rather testing-before-building. But I don't think polynomial speedups, faster prime factorizations, etc. will directly help in designing a quantum computer, unless you actually make use of it somehow. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;P.S: This is a very short and perhaps incomplete answer, I know. I just wanted to give the OP a basic idea. I'd request others to write alternate answers to this question. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-23T09:26:07.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1276" PostTypeId="1" CreationDate="2018-03-23T10:28:15.810" Score="16" ViewCount="2665" Body="&lt;p&gt;As a result of an excellent answer to my question on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1265/253&quot;&gt;quantum bogosort&lt;/a&gt;, I was wondering what is the current state of the art in quantum algorithms for sorting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be precise, &lt;em&gt;sorting&lt;/em&gt; is here defined as the following problem: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given an array &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; of integers (feel free to choose your representation of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, but be clear about this, I think this already is non-trivial!) of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, we wish to transform this array into the array &lt;span class=&quot;math-container&quot;&gt;$A_s$&lt;/span&gt; such that the arrays 'are reshufflings of each other's and &lt;span class=&quot;math-container&quot;&gt;$A_s$&lt;/span&gt; is sorted, i.e. &lt;span class=&quot;math-container&quot;&gt;$A_s[i]\leq A_s[j]$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i\leq j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is known about this? Are there complexity bounds or conjectures for certain models? Are there &lt;em&gt;practical&lt;/em&gt; algorithms? Can we &lt;em&gt;beat&lt;/em&gt; classical sorting (even the &lt;em&gt;bucket&lt;/em&gt; or &lt;em&gt;radix&lt;/em&gt; sort &lt;em&gt;at their own game&lt;/em&gt;? (i.e. in the cases where they work well?))&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-05-15T15:14:21.267" LastActivityDate="2021-01-14T11:49:26.600" Title="What is the current state of the art in quantum sorting algorithms?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;speedup&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1277" PostTypeId="5" CreationDate="2018-03-23T10:43:27.927" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-23T10:43:27.927" LastActivityDate="2018-03-23T10:43:27.927" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1278" PostTypeId="4" CreationDate="2018-03-23T10:43:27.927" Score="0" Body="For questions on either 1. Using quantum computing to speed-up artificial intelligence and/or 2. Using artificial intelligence to solve problems in quantum computing. If your question is only on artificial intelligence, do not post here, but on another site on the network, either Computer Science SE or Artificial Intelligence SE or even Statistics (Cross Validated) SE." OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-01-01T10:04:15.983" LastActivityDate="2019-01-01T10:04:15.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1279" PostTypeId="2" ParentId="1269" CreationDate="2018-03-23T10:59:53.233" Score="8" Body="&lt;p&gt;In the classical case, there is a pretty big difference between digital computers and analogue ones. The methodology and hardware is very much distinct (in all cases I know of, at least).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The divide is still there in the quantum case, but it doesn't run quite as deep. The hardware can be similar, but requirements on how it behaves and how to manipulate it are different. This means that both circuit model quantum computers and quantum annealers can both measure device size using the same metric, the number of qubits, but it is measuring very different and completely non-equivalent things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, it is like comparing the length of a slide rule to that of a smartphone, and using that to make statements about their computational power.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-03-23T10:59:53.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1280" PostTypeId="1" AcceptedAnswerId="1281" CreationDate="2018-03-23T11:12:37.637" Score="20" ViewCount="6988" Body="&lt;p&gt;Quantum gates seem to be like black boxes. Although we know what kind of operation they will perform, we don't know if it's actually possible to implement in reality (or, do we?). In classical computers, we use AND, NOT, OR, XOR, NAND, NOR, etc which are mostly implemented using semiconductor devices like diodes and transistors. Are there similar experimental implementations of quantum gates? Is there any &quot;universal gate&quot; in quantum computing (like the NAND gate is universal in classical computing)? &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T14:16:00.927" LastActivityDate="2021-02-27T08:23:52.937" Title="How are quantum gates implemented in reality?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1281" PostTypeId="2" ParentId="1280" CreationDate="2018-03-23T11:12:37.637" Score="22" Body="&lt;p&gt;One can replicate any quantum gate or at least get arbitrarily close using sufficient number of CNOT, H, X, Z and &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; rotation gates. That is because they form a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;noreferrer&quot;&gt;universal set&lt;/a&gt; of quantum gates (refer to: &lt;em&gt;M. Nielsen and I. Chuang, Quantum Computation and Quantum Information, Cambridge University Press, 2016, page 189&lt;/em&gt;). Be careful here. Clearly, we cannot implement any arbitrary quantum gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with infinite precision. Instead, given &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;, we implement &lt;span class=&quot;math-container&quot;&gt;$U_{\epsilon}$&lt;/span&gt;, which is &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-close to &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (refer to: &lt;a href=&quot;https://www.edx.org/course/quantum-mechanics-quantum-computation-uc-berkeleyx-cs-191x&quot; rel=&quot;noreferrer&quot;&gt;Quantum Mechanics and Quantum Computation MOOC offered by UC Berkely on EdX&lt;/a&gt;). This imperfection of quantum gates is one of the main reasons we need &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;noreferrer&quot;&gt;error correction codes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There have been attempts to implement those basic gates. I'm adding some of the recent research works related to these attempts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;CNOT: &lt;a href=&quot;https://arxiv.org/abs/1803.04105&quot; rel=&quot;noreferrer&quot;&gt;Construction of controlled-NOT gate based on microwave-activated phase (MAP) gate in two transmon system&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1803.02844&quot; rel=&quot;noreferrer&quot;&gt;Rydberg atoms based mesoscopic &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}^{\text{N}}$&lt;/span&gt; gate using STIRAP&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hadamard (H): &lt;a href=&quot;http://ieeexplore.ieee.org/document/5612120/&quot; rel=&quot;noreferrer&quot;&gt;An approach to realize a quantum Hadamard gate through optical implementation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Phase flip (Z): &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.73.012323&quot; rel=&quot;noreferrer&quot;&gt;One-step implementation of a multiqubit controlled-phase-flip gate&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://arxiv.org/abs/0803.1017&quot; rel=&quot;noreferrer&quot;&gt;Realizing quantum controlled phase-flip gate through quantum dot in silicon slow-light photonic crystal waveguide&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bit Flip (X): &lt;a href=&quot;http://naturalspublishing.com/Article.asp?ArtcID=13584&quot; rel=&quot;noreferrer&quot;&gt;Chiral Spin Flipping Gate Implemented in IBM Quantum Experience&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; rotation: &lt;a href=&quot;https://arxiv.org/abs/1206.1598&quot; rel=&quot;noreferrer&quot;&gt;Qudit versions of the qubit &quot;pi-over-eight&quot; gate&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As Wikipedia mentions, another set of universal quantum gates consists of the Ising gate and the phase-shift gate. These are the set of gates natively available in some trapped-ion quantum computers (&lt;a href=&quot;https://www.nature.com/articles/nature18648&quot; rel=&quot;noreferrer&quot;&gt;Demonstration of a small programmable quantum computer with atomic qubits&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T14:16:57.917" LastActivityDate="2018-12-23T14:16:57.917" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1282" PostTypeId="5" CreationDate="2018-03-23T16:07:20.413" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-23T16:07:20.413" LastActivityDate="2018-03-23T16:07:20.413" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1283" PostTypeId="4" CreationDate="2018-03-23T16:07:20.413" Score="0" Body="For questions about the theory and practical construction of dedicated quantum memory which is analogous to the memory in a normal computer, but consists of 'quantum state' (e.g. (partially) from qubits)." OwnerUserId="82" LastEditorUserId="26" LastEditDate="2019-01-01T09:37:35.580" LastActivityDate="2019-01-01T09:37:35.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1284" PostTypeId="2" ParentId="97" CreationDate="2018-03-23T19:53:28.333" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Why do you need error correction? My understanding is that error correction removes errors from noise, but noise should average itself out.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you built a house or a road and noise was a variance, a difference,  with respect to straightness, to direction, it's not solely / simply: &amp;quot;How would it look&amp;quot;, but &amp;quot;How would it be?&amp;quot; - a superposition of both  efficiency and correctness.&lt;/p&gt;&#xA;&lt;p&gt;If two people calculated the circumference of a golf ball given a diameter each would get a similar answer, subject to the accuracy of their calculations; if each used &lt;em&gt;several&lt;/em&gt; places of decimal it would be 'good enough'.&lt;/p&gt;&#xA;&lt;p&gt;If two people were provided with identical equipment and ingredients, and given the same recipe for a cake, should we expect identical results?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To make clear what I'm asking, why can't you, instead of involving error correction, simply run the operations, say, a hundred times, and pick the average/most common answer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You're spoiling the weighing, tapping your finger on the scale.&lt;/p&gt;&#xA;&lt;p&gt;If you're at a loud concert and try to communicate with the person next to you do they understand you the first time, everytime?&lt;/p&gt;&#xA;&lt;p&gt;If you tell a story or spread a rumor, (and some people communicate  verbatim, some add their own spin, and others forget parts), when it gets back to you does it average itself out and become essentially (but not identically) the same thing you said? - unlikely.&lt;/p&gt;&#xA;&lt;p&gt;It like crinkling up a piece of paper and then flattening it out.&lt;/p&gt;&#xA;&lt;p&gt;All those analogies were intended to offer simplicity over exactness, you can reread them a few times, average it out, and have the exact answer, or not. ;)&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A more technical explanation of why quantum error correction is difficult but neccessary is explained on Wikipedia's webpage: &amp;quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction&lt;/a&gt;&amp;quot;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Quantum error correction (QEC) is used in quantum computing to protect quantum information from errors due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Decoherence&quot; rel=&quot;nofollow noreferrer&quot;&gt;decoherence&lt;/a&gt; and other &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum noise&lt;/a&gt;. Quantum error correction is essential if one is to achieve fault-tolerant quantum computation that can deal not only with noise on stored quantum information, but also with faulty quantum gates, faulty quantum preparation, and faulty measurements.&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;error correction&lt;/a&gt; employs &lt;a href=&quot;https://en.wikipedia.org/wiki/Redundancy_(information_theory)&quot; rel=&quot;nofollow noreferrer&quot;&gt;redundancy&lt;/a&gt;. &amp;quot; ...&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Copying quantum information is not possible due to the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no-cloning theorem&lt;/a&gt;. This theorem seems to present an obstacle to formulating a theory of quantum error correction. But it is possible to spread the information of one qubit onto a highly entangled state of several (physical) qubits. &lt;a href=&quot;https://en.wikipedia.org/wiki/Peter_Shor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peter Shor&lt;/a&gt; first discovered this method of formulating a quantum error correcting code by storing the information of one qubit onto a highly entangled state of nine qubits. A quantum error correcting code protects quantum information against errors of a limited form.&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="278" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-01-07T22:35:42.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1285" PostTypeId="1" AcceptedAnswerId="1287" CreationDate="2018-03-23T19:56:19.330" Score="13" ViewCount="674" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1281/26&quot;&gt;this&lt;/a&gt; answer I mentioned that the CNOT, H, X, Z and $\pi/8$ gates form a universal set of gates, which given in sufficient number of gates can get arbitrarily close to replicating any unitary quantum gate (I came to know about this fact from Professor Umesh Vazirani's EdX lectures). But, is there any mathematical justification for this? There should be! I tried searching for relevant papers but couldn't find much.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="2293" LastEditDate="2018-05-08T19:54:27.807" LastActivityDate="2018-05-08T20:46:44.197" Title="What is the mathematical justification for the &quot;universality&quot; of the universal set of quantum gates (CNOT, H, Z, X and π/8)?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1286" PostTypeId="2" ParentId="1271" CreationDate="2018-03-23T20:05:15.397" Score="6" Body="&lt;h2&gt;Sort of, quite possibly, if by degrees&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This is a speculative, but plausible, answer&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, &lt;strong&gt;how do qubits interact and states evolve with time?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description of how individual qubits evolve (i.e. a single qubit gate operation) is given by some Hamiltonian&lt;sup&gt;1&lt;/sup&gt;. Multiple, non-interacting qubits (that are exactly the same) therefore evolve using multiples of that same Hamiltonian. However, as soon as you include some form of interaction, simulating the exact evolution of a large number of interacting qubits quickly becomes intractable (which is exactly why quantum computers should be useful, in theory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;strong&gt;how are quantum processors &lt;em&gt;designed?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Designing the microarchitecture of a processor (such as the connectivity, layout of the chip etc.) is one thing, but engineering sizes of qubits, waveguides etc. requires going on a computer and running detailed simulations a lot of the time. If there was a way to simulate large Hamiltonians for a long time, it's reasonable to assume that this would help improve knowledge of how the qubits interact with each other and the environment, such as in a more detailed version of &lt;a href=&quot;https://arxiv.org/abs/0804.2377v1&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and extensions thereof, as well as generally being able to look at how multiple qubits interact at once. This would in turn allow for improved design of the &lt;em&gt;details&lt;/em&gt; of chip, which would lead to effects such as reduction of decoherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;strong&gt;what are quantum computers good at?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned above, quantum computers are potentially useful because of what makes them hard to simulate - a quantum computer &lt;em&gt;is&lt;/em&gt; a system that quickly becomes intractable it simulate with increasing numbers of qubits. However, something that quantum computers offer a speedup of is... &lt;a href=&quot;https://arxiv.org/abs/1005.1318v3&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Hamiltonian simulation&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, by iteratively running a quantum Hamiltonian simulation, using a classical computer to (tell the quantum computer to) vary certain parameters, it's not unreasonable to assume that a quantum computer could help for optimising certain aspects of the chip to e.g. reduce decoherence times, improve fidelities etc. In turn offering &lt;em&gt;better&lt;/em&gt; simulations and allowing for yet more qubits, which potentially offers better simulations and the continual improvement would (hopefully) begin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for whether it &lt;em&gt;does&lt;/em&gt;, or if classically simulating a few qubits and extrapolating from this would give a just-as-good design is something that only time will tell.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Having said that, in linear optical quantum computers (at least), unitaries are implemented &lt;em&gt;directly&lt;/em&gt; using physical components such as beam splitters and phase shifters directly describing the unitary, as opposed to, say, superconducting, where applying microwaves is described in terms of a Hamiltonian, which is then used to &lt;em&gt;give&lt;/em&gt; a unitary. OK, all this is maybe simplifying a bit, but that gets the gist across. What &lt;em&gt;does&lt;/em&gt; matter is that, in linear optical quantum computers, &lt;em&gt;generating&lt;/em&gt; the photons on say, a ring resonator, is described by a Hamiltonian&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-03-23T20:05:15.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1287" PostTypeId="2" ParentId="1285" CreationDate="2018-03-23T22:45:46.993" Score="11" Body="&lt;p&gt;The answer you mention references Michael Nielsen and Isaac Chuang's book, &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; (Cambridge University Press), which does contain a proof of the universality of these gates.  (In my 2000 edition, this can be found on p. 194.)  The key insight is that the $T$ gate (or $\pi/8$ gate), together with the $H$ gate, generates two different rotations on the Bloch sphere with angles that are &lt;em&gt;irrational&lt;/em&gt; multiples of $2\pi$.  This allows combinations of $T$ and $H$ gates to densely fill the surface of the Bloch sphere and thereby approximate any one-qubit unitary operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That this can be done &lt;em&gt;efficiently&lt;/em&gt; is shown by the &lt;em&gt;Solovay-Kitaev&lt;/em&gt; theorem.  Here, &quot;efficiently&quot; means polynomial in $\log(1/\epsilon)$, where $\epsilon$ is the desired accuracy.  This is also proven in Nielsen and Chuang's book (Appendix 3 in the 2000 edition).  An explicit construction can be found in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0505030&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Combining CNOT gates allows one to approximate arbitrary multi-qubit unitaries, as shown by Barenco &lt;em&gt;et al.&lt;/em&gt; in Phys. Rev. A &lt;strong&gt;52&lt;/strong&gt; 3457 (1995).  (A preprint of this paper can be found at &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9503016&lt;/a&gt;.)  This is also discussed in Nielsen and Chuang (p. 191 in the 2000 edition).&lt;/p&gt;&#xA;" OwnerUserId="356" LastEditorUserId="124" LastEditDate="2018-03-25T20:16:47.497" LastActivityDate="2018-03-25T20:16:47.497" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1289" PostTypeId="1" AcceptedAnswerId="1324" CreationDate="2018-03-24T05:37:07.873" Score="33" ViewCount="6169" Body="&lt;p&gt;On reading &lt;a href=&quot;https://www.reddit.com/r/askscience/comments/1oqxfr/how_do_computers_do_math/&quot; rel=&quot;noreferrer&quot;&gt;this Reddit thread&lt;/a&gt; I realized that even after a couple months of learning about quantum computing I've absolutely no clue about how a quantum computer actually works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the question more precise, let's say we have a superconducting qubit based 5-qubit quantum computer (like the  5-qubit IBM Quantum Computer). I type in $2+3$ using a keyboard onto a monitor (say in a basic calculator app the quantum computer might have). After that it should return me $5$. But is going on at the hardware level? Are some sort of electrical signals corresponding to the inputs $2$,$3$ and $+$ going to the processing unit of the computer? Does that somehow &quot;initialize&quot; the Cooper pair electrons? What happens to the Cooper pair electron qubits after that (guess they'd be worked on by some &lt;em&gt;quantum-gates&lt;/em&gt;, which are in turn again &lt;em&gt;black boxes&lt;/em&gt;)? How does it finally return me the output $5$ ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am surprised as to how little I could come up with about the &lt;em&gt;basic&lt;/em&gt; working of a quantum computer by searching on the net.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T12:10:31.663" LastActivityDate="2018-12-23T12:10:31.663" Title="How does a quantum computer do basic math at the hardware level?" Tags="&lt;architecture&gt;&lt;physical-realization&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="28" ContentLicense="CC BY-SA 3.0" />
  <row Id="1291" PostTypeId="2" ParentId="1228" CreationDate="2018-03-24T18:22:05.333" Score="1" Body="&lt;p&gt;If by &quot;giant quantum computer&quot; you mean something that can be simulated very efficiently by a tensor product of sufficiently many qubits, then I think the answer is no. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we work with finite dimensional systems, it's very clear how to account for the joint description of two subsystems: we simply take the tensor product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want an infinite-dimensional space with continuously many degrees of freedom, then we have to do something more subtle. We'll call this the &quot;commuting operator&quot; model. To every open subset of space we attach an algebra observables corresponding to the local measurements on that part of space. Instead of requiring that the Hilbert space of the universe is the tensor product of all the local hilbert spaces, we just ask that if two regions of space don't intersect, then their algebras of observables commute. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's known that the commuting operator model gives rise to correlations between spacelike separated parties that do not arise in the tensor product model. See this paper by William Slofstra &lt;a href=&quot;https://arxiv.org/abs/1606.03140&quot; rel=&quot;nofollow noreferrer&quot;&gt;on the arXiv&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't know whether there is an experiment that could tell us that our universe is capable of generating correlations in the commuting operator model. See &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=2820&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post by Scott Aaronson&lt;/a&gt;, which describes Slofstra's result and some of its implications.&lt;/p&gt;&#xA;" OwnerUserId="483" LastEditorUserId="483" LastEditDate="2018-03-24T23:30:56.970" LastActivityDate="2018-03-24T23:30:56.970" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1292" PostTypeId="1" AcceptedAnswerId="1316" CreationDate="2018-03-24T20:08:35.513" Score="10" ViewCount="308" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1235/who-invented-quantum-computing&quot;&gt;my previous question&lt;/a&gt; I asked who invented a quantum computer using qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a follow-up to this question I want to ask who built the first quantum computer using at least two qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During my research I have discovered that in 1998, Jonathan A. Jones and Michele Mosca &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801027&quot; rel=&quot;noreferrer&quot;&gt;developed a quantum computer using two qubits&lt;/a&gt; specifically to solve &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Deutsch's problem&lt;/a&gt;. Have there been other working quantum computers before to solve other problems or general attempts not specifically bound to one problem?&lt;/p&gt;&#xA;" OwnerUserId="11" LastEditorUserId="26" LastEditDate="2018-03-26T16:00:31.197" LastActivityDate="2018-03-26T16:00:31.197" Title="Who built the first quantum computer using at least two qubits?" Tags="&lt;physical-realization&gt;&lt;models&gt;&lt;experiment&gt;&lt;history&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1293" PostTypeId="5" CreationDate="2018-03-24T22:39:59.963" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-24T22:39:59.963" LastActivityDate="2018-03-24T22:39:59.963" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1294" PostTypeId="4" CreationDate="2018-03-24T22:39:59.963" Score="0" Body="Q# is a domain-specific programming language used to express quantum algorithms. This tag should be used for questions related to creating/programming quantum algorithms using the 'Q#' language. If the question is unrelated to, or arising from some non-quantum aspect of Q#, it might be better to ask on StackOverflow. If appropriate, also use the [programming] tag. " OwnerUserId="253" LastEditorUserId="8757" LastEditDate="2020-07-08T05:53:39.100" LastActivityDate="2020-07-08T05:53:39.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1295" PostTypeId="5" CreationDate="2018-03-24T22:50:42.300" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-24T22:50:42.300" LastActivityDate="2018-03-24T22:50:42.300" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1296" PostTypeId="4" CreationDate="2018-03-24T22:50:42.300" Score="0" Body="Use this tag for questions about IBM's Quantum Service - Circuit Composer &amp; Quantum Lab. DO NOT use this for questions about general Qiskit issues. " OwnerUserId="253" LastEditorUserId="55" LastEditDate="2021-05-12T09:50:43.757" LastActivityDate="2021-05-12T09:50:43.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1297" PostTypeId="5" CreationDate="2018-03-24T22:52:05.383" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-24T22:52:05.383" LastActivityDate="2018-03-24T22:52:05.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1298" PostTypeId="4" CreationDate="2018-03-24T22:52:05.383" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-24T22:52:05.383" LastActivityDate="2018-03-24T22:52:05.383" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1299" PostTypeId="5" CreationDate="2018-03-24T22:53:35.937" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-24T22:53:35.937" LastActivityDate="2018-03-24T22:53:35.937" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1300" PostTypeId="4" CreationDate="2018-03-24T22:53:35.937" Score="0" Body="On memory as a resource for computation (similar to time). This can refer to performance in theoretical models, or the practical construction of such memory and related concerns. Use the appropriate tags to further specify if needed." OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-03-25T00:03:16.233" LastActivityDate="2018-03-25T00:03:16.233" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1301" PostTypeId="2" ParentId="20" CreationDate="2018-03-24T23:16:16.757" Score="4" Body="&lt;p&gt;It seems that most ways of formalizing your question would lead to a problem that's QMA-hard, and therefore we shouldn't hope for an efficient quantum algorithm to solve it. (The relationship between BQP and QMA is similar to the relationship between P and NP: it would be very surprising if there were efficient quantum algorithms for QMA-complete problems.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The canonical &lt;a href=&quot;https://en.wikipedia.org/wiki/QMA&quot; rel=&quot;nofollow noreferrer&quot;&gt;QMA-complete&lt;/a&gt; problem is the &quot;local hamiltonian&quot; problem. Roughly speaking, the input to the problem is a description of the hamiltonian for a physical system acting on qubits, and the problem is to decide whether the ground state of the system has small energy. If your system of specifying constraints includes local hamiltonians as a special case, then your problem is intractable.&lt;/p&gt;&#xA;" OwnerUserId="483" LastEditorUserId="483" LastEditDate="2018-03-24T23:59:36.953" LastActivityDate="2018-03-24T23:59:36.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1302" PostTypeId="1" AcceptedAnswerId="1306" CreationDate="2018-03-24T23:57:37.393" Score="14" ViewCount="1159" Body="&lt;p&gt;In classical binary computers, real numbers are often represented using the &lt;a href=&quot;https://en.wikipedia.org/wiki/IEEE_754&quot; rel=&quot;noreferrer&quot;&gt;IEEE 754 standard&lt;/a&gt;. With quantum computers you can of course do this as well - and for measurements this (or a similar standard) will probably be necessary since the result of any measurement is binary. But could real numbers be modeled more easily and / or more precisely within the qubits using different methods before the measurement happens? If so, are there any use cases where this is actually useful, seeing that (I'm assuming) any additional precision will be lost when measurements are performed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, I'm not (necessarily) looking for existing standards, just for ideas or suggestions on how to represent those numbers. If there's any research into it, that would be useful too of course.&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="26" LastEditDate="2018-12-23T12:10:49.710" LastActivityDate="2018-12-23T12:10:49.710" Title="Representation of real numbers in quantum computers" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;technical-standards&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1303" PostTypeId="1" AcceptedAnswerId="1304" CreationDate="2018-03-25T01:02:30.473" Score="7" ViewCount="95" Body="&lt;p&gt;Quantum Computing (QC) pioneer Vazirani has graciously long provided some nice videos on an intro to QC. E.g. in &lt;a href=&quot;https://www.youtube.com/watch?v=xzG6c96PsLs&quot; rel=&quot;noreferrer&quot;&gt;&quot;2 qubit gates + tensor product&quot;&lt;/a&gt; (2014) he introduces the tensor product w.r.t. QC gates. I was generally able to follow this video but think there was one subtle point glossed over and I would like an expert to expand on it. We were discussing the tensor product in a QC meetup and the question came up if its commutative. As Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;noreferrer&quot;&gt;states&lt;/a&gt;, the tensor product is not commutative. But when combining two qubits in a gate operation, Vazirani however does not mention whether order makes any difference. In his diagrams, there is total visual symmetry across the 2 qubits. Or maybe the tensor product is commutative over unitary matrices which QC is limited to? Can someone sort out/ unpack some of these ideas?&lt;/p&gt;&#xA;" OwnerUserId="377" LastEditorUserId="2224" LastEditDate="2019-06-11T01:44:34.047" LastActivityDate="2019-06-11T01:44:34.047" Title="Symmetry of tensor product w.r.t. Vazirani 2-qubit video" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1304" PostTypeId="2" ParentId="1303" CreationDate="2018-03-25T03:44:04.247" Score="6" Body="&lt;p&gt;The tensor product is not commutative, i.e. in the computational basis, $$X\otimes Z=\left(&#xA;\begin{array}{cccc}&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{array}&#xA;\right)$$ while $$Z\otimes X=\left(&#xA;\begin{array}{cccc}&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;\end{array}&#xA;\right).$$&#xA;The two-qubit CNOT gate depicted in the video is not symmetric w.r.t. the two qubits (one is control, the other is target). However, the ordering of the subsystems (e.g. the qubits) is arbitrary and you can understand $X_A \otimes Z_B = Z_B \otimes X_A$, where the indices denote the subsystem. It happens quite frequently that people change the order of the subsystems to whatever order is convenient at that moment.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2018-03-25T13:22:36.253" LastActivityDate="2018-03-25T13:22:36.253" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1305" PostTypeId="2" ParentId="1303" CreationDate="2018-03-25T05:10:42.870" Score="4" Body="&lt;p&gt;I'll add a bit to the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1304/26&quot;&gt;other answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;State of a two qubit system is written as $|\psi_1\rangle\otimes|\psi_2\rangle$ where $|\psi_1\rangle$ is the state vector of the &lt;strong&gt;first qubit&lt;/strong&gt;  and $|\psi_2\rangle$ is the state vector of the &lt;strong&gt;second qubit&lt;/strong&gt; (it is upto you to decide which one will be called &quot;first&quot; and which one will be called &quot;second&quot;). The order is important, as the first member of the product is always considered to be the state of the first qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\psi_{\text{state}}\rangle=|\psi_1\rangle\otimes|\psi_2\rangle=|\psi_1\psi_2\rangle\quad (\text{Tensor Product})$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, after choosing the initial convention of the order (i.e. &quot;first&quot; and &quot;second&quot; qubit) if you're changing ordering of the subsystems, as M.Stein says, you have to mention that explicitly. You can't just suddenly write it as $|\psi_2\rangle\otimes|\psi_1\rangle$. Also, another reason why you can't change order directly is because Tensor product is not-commutative, as M.Stein already mentioned with a nice example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A tensor product of that form can be also written as $a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$ (where $a,b,c,d\in \Bbb{C}$). Keep in mind that even here, the first entry $\alpha$ in $|\alpha\beta\rangle$ (where $\alpha,\beta\in\{0,1\}$) is the state of the first qubit. For example when you're measuring the first qubit in the $|0\rangle,|1\rangle$ basis you'll end up with either the state $\frac{a|00\rangle+b|01\rangle}{\sqrt{|a|^2+|b|^2}}$ or the state $\frac{c|10\rangle+d|11\rangle}{\sqrt{|c|^2+|d|^2}}$. Notice that, in these two possible results, the first result explicitly implies that the first qubit turns out to be $0$ in that case, while the second possible result implies that the first qubit turns out to be $1$ in that particular case. As you can see, maintaining that order of tensor product is important, to keep track of the actual changes to the qubit system during quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-25T05:10:42.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1306" PostTypeId="2" ParentId="1302" CreationDate="2018-03-25T05:41:21.520" Score="9" Body="&lt;p&gt;There have been efforts to implement construct &quot;floating point&quot; representation of &lt;strong&gt;small rotations&lt;/strong&gt; of qubit states, such as: &lt;a href=&quot;https://arxiv.org/abs/1305.5528&quot; rel=&quot;noreferrer&quot;&gt;Floating Point Representations in Quantum Circuit Synthesis&lt;/a&gt;. But there doesn't seem to be any international standard like the one you mentioned i.e. IEEE 754. &lt;a href=&quot;https://standards.ieee.org/develop/project/7130.html&quot; rel=&quot;noreferrer&quot;&gt;IEEE 7130 - Standard for Quantum Computing Definitions&lt;/a&gt; is an ongoing project. Anyhow, representation of floating point will automatically be dependent on the precision you want. If you want to follow the path in the first paper I linked (i.e. using qubit rotations) I can already imagine the possibility of errors during such rotation operations and you'd have to deal with them accordingly.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-25T05:41:21.520" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1308" PostTypeId="2" ParentId="1302" CreationDate="2018-03-25T12:13:07.087" Score="1" Body="&lt;p&gt;I am afraid that while interesting work is being done here, it should be clear that the quantum computer architecture is very much non-standardised and hence this is all subject to change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The IEEE 754 standard describes how to implement a feature that decades of engineering and research have shown to be useful and hence machines are to be expected to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, scientists and engineers are still figuring out how to best create an 'universal' quantum computer. They have some ideas on how to do this, as Blue mentions. However, there is no 'one true idea' on which engineers can base standards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps it would even turn out complex numbers are easier to represent on a quantum computer and we have a standard for complex number data-types, instead!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, while work is being done here, an IEEE standard seems very much in the far future.&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-03-25T12:13:07.087" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1309" PostTypeId="5" CreationDate="2018-03-25T12:14:47.600" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T12:14:47.600" LastActivityDate="2018-03-25T12:14:47.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1310" PostTypeId="4" CreationDate="2018-03-25T12:14:47.600" Score="0" Body="For questions on the manipulation and creation of 'qubits' and the state they represent. These actions may be either from theory or practice, use other tags to indicate this." OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-03-25T21:09:10.993" LastActivityDate="2018-03-25T21:09:10.993" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1311" PostTypeId="5" CreationDate="2018-03-25T12:44:56.940" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T12:44:56.940" LastActivityDate="2018-03-25T12:44:56.940" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1312" PostTypeId="4" CreationDate="2018-03-25T12:44:56.940" Score="0" Body="For questions about the practice and current state of standardization of quantum computers and their models. Do be sure these standards would be significantly different due to the nature of quantum computation before asking." OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-03-25T21:13:04.347" LastActivityDate="2018-03-25T21:13:04.347" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1313" PostTypeId="5" CreationDate="2018-03-25T12:57:12.610" Score="0" Body="&lt;h2&gt;What are tensors?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A tensors is an $\left(n, m\right)$-order structure that generalizes scalars and vectors to higher orders and can be represented by a number, array, matrix, or higher order generalisations thereof. In physics, tensors with a 3- or 4- dimensions are common, but higher dimensions are sometimes used. For a formal definition, consult the standard sources, e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What about their product?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;An elementary tensor is defined as being non-zero and completely factorisable. Here, the rank of a tensor is the minimum number of elementary tensors that sum to that tensor, meaning that an elementary tensor is 'rank 1'. As such, impure tensors (having a rank greater than 1) are not factorisable, so are hard to represent and hence complicate matters. However, there is a lot of mathematics done on these structures that is ready for Physics to use.  A good resource is again &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Why do the quantum physicists care?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Well, one common example of tensors in physics is the stress tensor. But tensors pop up in quantum computation in the definition of quantum gates and other places. As quantum states are vectors, they are tensors, so larger pure states are described using tensor products of the smaller states. When entangled, sums of these states are used, giving a rank greater than 1.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;I still don't understand what tensors are. Help?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Personally, as someone with a mathematics background, I don't understand the physicists when they talk tensors. However, I can understand the mathematicians. So, perhaps you can try to get someone different to explain. That can help.&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="23" LastEditDate="2018-03-26T16:38:24.877" LastActivityDate="2018-03-26T16:38:24.877" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1314" PostTypeId="4" CreationDate="2018-03-25T12:57:12.610" Score="0" Body="A tensor is an abstract object generalising a scalar or vector and can be represented by a number, a 1D array, 2D matrix or higher order generalisations thereof. A tensor product is a product defined on these tensors yielding other tensors or a method to define or represent tensors. If appropriate, also use the [mathematics] tag. " OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-01-01T09:23:12.680" LastActivityDate="2019-01-01T09:23:12.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1315" PostTypeId="2" ParentId="1276" CreationDate="2018-03-25T13:04:44.540" Score="8" Body="&lt;p&gt;For comparison-based sorting (and search) bounds seem to fit the ones of classical computers: $\Omega(N\log N)$ for sorting and $\Omega(\log N)$ for search, as shown by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102078&quot; rel=&quot;noreferrer&quot;&gt;Hoyer et al.&lt;/a&gt; A couple of quantum sorting algorithms are listed in 'Related work' section of &lt;a href=&quot;http://ieeexplore.ieee.org/document/7494107/&quot; rel=&quot;noreferrer&quot;&gt;&quot;Quantum sort algorithm based on entanglement qubits {00, 11}&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="505" LastActivityDate="2018-03-25T13:04:44.540" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1316" PostTypeId="2" ParentId="1292" CreationDate="2018-03-25T13:24:04.950" Score="8" Body="&lt;p&gt;What is a qubit? And what is a quantum computer? Any claim about about which is first will depend on our definitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One suggestion might be the &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.49.91&quot; rel=&quot;noreferrer&quot;&gt;1981 experiment by Aspect, Grangier and Roger&lt;/a&gt; to demonstrate a violation of Bell’s inequality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My arguments for this are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It uses a physical degree of freedom (photon polarization) which has since been considered for qubits.&lt;/li&gt;&#xA;&lt;li&gt;It performs a task (Bell’s inequality violation) that has since been used in quantum information theoretic tasks (like cryptography).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So though the authors would have had no concept of their setup being a two qubit quantum computer at the time, I’d say that it was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some other early two qubit systems, see references 7, 8 and 9 in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9709025.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; (which has arguably the first 3 qubit system).&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-03-25T13:24:04.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1317" PostTypeId="5" CreationDate="2018-03-25T14:38:49.657" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T14:38:49.657" LastActivityDate="2018-03-25T14:38:49.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1318" PostTypeId="4" CreationDate="2018-03-25T14:38:49.657" Score="0" Body="For questions about using the circuit-model of quantum computing, versus, for example, the quantum annealing model or the measurement-based model. Questions which are using the circuit-model but are not specifically asking about it probably should not have this tag." OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-03-25T17:23:14.593" LastActivityDate="2018-03-25T17:23:14.593" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1319" PostTypeId="5" CreationDate="2018-03-25T14:40:07.460" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T14:40:07.460" LastActivityDate="2018-03-25T14:40:07.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1320" PostTypeId="4" CreationDate="2018-03-25T14:40:07.460" Score="0" Body="For questions about how quantum computing could improve or affect machine learning i.e. quantum machine learning. Questions about classical machine learning belong on another site, such as Stack Overflow, Cross Validated or Artificial Intelligence SE. " OwnerUserId="91" LastEditorUserId="26" LastEditDate="2018-12-14T06:33:55.043" LastActivityDate="2018-12-14T06:33:55.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1321" PostTypeId="5" CreationDate="2018-03-25T14:43:36.400" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T14:43:36.400" LastActivityDate="2018-03-25T14:43:36.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1322" PostTypeId="4" CreationDate="2018-03-25T14:43:36.400" Score="0" Body="For questions about the quantum complexity class referring to problems that can be solved by a quantum computer in polynomial time (the quantum equivalent of the classical complexity class P). You may also wish to tag with [complexity-theory]." OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-01-01T09:47:21.237" LastActivityDate="2019-01-01T09:47:21.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1323" PostTypeId="1" AcceptedAnswerId="1572" CreationDate="2018-03-25T16:29:37.420" Score="18" ViewCount="328" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Recently I was reading the article &lt;em&gt;&lt;a href=&quot;https://arxiv.org/abs/1604.01383&quot; rel=&quot;noreferrer&quot;&gt;&quot;Quantum Bitcoin: An Anonymous and Distributed Currency Secured by the No-Cloning Theorem of Quantum Mechanics&quot;&lt;/a&gt;&lt;/em&gt; which demonstrates how a quantum bitcoin could function. The article's conclusion states that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;quantum bitcoins are atomic and there is currently no way to subdivide quantum bitcoin into smaller denominations, or merge them into larger ones.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As there is currently no way to subdivide or merge quantum bitcoins, you can not make change in a transaction. However, I could not understand why subdivision of a quantum bitcoin is not possible.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Why can you not subdivide a quantum bitcoin?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Definitions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A quantum bitcoin - like a regular bitcoin - is a currency with no central authority. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea behind the implementation of a quantum bitcoin is the no-cloning theorem. The no-cloning theorem demonstrates how it is impossible to copy the arbitrary quantum state $ \left| \varphi \right&amp;gt; $.&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="2927" LastEditDate="2018-08-25T05:11:57.550" LastActivityDate="2018-08-25T05:11:57.550" Title="Quantum Bitcoin Subdivision" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;cryptocurrency&gt;&lt;quantum-money&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1324" PostTypeId="2" ParentId="1289" CreationDate="2018-03-25T17:09:29.653" Score="31" Body="&lt;p&gt;Firstly, a &lt;em&gt;classical&lt;/em&gt; computer does basic maths at the hardware level in the arithmetic and logic unit (ALU). The logic gates take low and high input voltages and uses &lt;a href=&quot;https://en.wikipedia.org/wiki/CMOS&quot; rel=&quot;noreferrer&quot;&gt;CMOS&lt;/a&gt; to implement logic gates allowing for individual gates to be performed and built up to perform larger, more complicated operations. In this sense, typing on a keyboard is sending electrical signals, which eventually ends up in a command (in the form of more electrical signals) being sent to the ALU, the correct operations being performed and more signals sent back, which gets converted to display pixels in the shape of a number on your screen.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What about a quantum computer?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are two possible ways that quantum processors get used: by themselves, or in conjunction with a classical processor. However, most (including your example of superconducting) quantum processors don't actually use electrical signals, although this is still how your mouse, keyboard and monitor etc. transmit and receive information. So, there needs to be a way to convert the electric signal to whatever signal the quantum processor uses (which I'll get on to later), as well as some way of telling the processor what you want to do. Both these issues can be solved at once by classical pre- and post- processing, such as in IBM's &lt;a href=&quot;https://developer.ibm.com/code/open/projects/qiskit/&quot; rel=&quot;noreferrer&quot;&gt;QISKit&lt;/a&gt;. Microsoft is taking a bit more of a top-down approach in &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-qr-intro?view=qsharp-preview&quot; rel=&quot;noreferrer&quot;&gt;Q#&lt;/a&gt;, where programs for a quantum processor is written more like a 'classical' program, as opposed to a script, then compiled and potentially &lt;em&gt;optimised&lt;/em&gt; for the hardware. That is, if you've got a function, it can perform classical operations, as well as make calls to the quantum processor to perform any required quantum operations. This leads me to the first point:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If you're going to ask a computer with access to a quantum processor to calculate something such as $2+3$, one very valid solution would be to just compute it on the classical processor as per usual.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OK, let's say that you're forcing the classical processor to use the quantum processor, which in this case is one of IBM's superconducting chips, using &lt;em&gt;transmon&lt;/em&gt; qubits, let's say, the &lt;a href=&quot;https://github.com/QISKit/ibmqx-backend-information/blob/master/backends/ibmqx4/README.md&quot; rel=&quot;noreferrer&quot;&gt;IBM QX4&lt;/a&gt;. This is too small to have error correction, so let's ignore that. There are three parts to using a circuit model processor: initialisation, unitary evolution and measurement, which are explained in more detail below. Before that, &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What is a transmon?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Take a superconducting loop to allow for &lt;a href=&quot;https://en.wikipedia.org/wiki/Cooper_pair&quot; rel=&quot;noreferrer&quot;&gt;Cooper pairs&lt;/a&gt; and add one or two &lt;a href=&quot;https://en.wikipedia.org/wiki/Josephson_effect&quot; rel=&quot;noreferrer&quot;&gt;Josephson junctions&lt;/a&gt; to give a Cooper pair box island in the region between the two Josephson junctions with Josephson coupling energy $E_J = I_c\Phi_0/2\pi$, where the &lt;em&gt;magnetic flux quantum&lt;/em&gt; $\Phi_0 = h/2e$ and $I_c$ is the critical current of the junction. Applying a voltage $V_g$ to this box gives a 'gate capacitance' $C_g$ and makes this a &lt;em&gt;charge qubit&lt;/em&gt;. For the Coulomb energy of a single Cooper pair $E_C = \left(2e\right)^2/2C$, where $C$ is the sum of the total capacitance of the island. The Hamiltonian of such a system is given by $$H = E_C\left(n - n_g\right)^2 - E_J\cos\phi,$$ where $n$ is the number of Cooper pairs, $\phi$ is the phase change across the junction and $n_g = C_gV_g/2e$.  When performing unitary operations, only the two lowest states of the system are considered, $\left|n\right\rangle = \left|0\right\rangle$ and $\left|n\right\rangle = \left|1\right\rangle$ with respective energies $E_0 =\hbar\omega_0$ and $E_1 = \hbar\omega_1$ and qubit frequency $\omega = \omega_1-\omega_0$, describing the computational basis of a qubit. A typical charge qubit could have $E_C = 5E_J$. Adding a large shunting capacitance and increasing the gate capacitance switches this ratio, so that $E_J\gg E_C$ and we have a &lt;em&gt;transmon&lt;/em&gt;. This has the advantage of longer coherence times, at a cost of reduced anharmonicity (where energy levels beyond the first two are closer together, potentially causing leakage).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Finally&lt;/em&gt;, we get to the main question:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How do we initialise, evolve and measure a transmon?&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Single qubit unitary evolution:&lt;/strong&gt; Applying a microwave pulse $\mathcal E\left(t\right) = \mathcal E_x\left(t\right)\cos\left(\omega_dt\right) + \mathcal E_y\left(t\right)\sin\left(\omega_dt\right)$ for $0&amp;lt;t&amp;lt;t_g$ of frequency $\omega_d$ and making the &lt;a href=&quot;https://en.wikipedia.org/wiki/Rotating_wave_approximation&quot; rel=&quot;noreferrer&quot;&gt;rotating wave approximation&lt;/a&gt; gives the Hamiltonian of the qubit states (in the ideal case) as $$H =\hbar \begin{pmatrix}\omega_1-\omega_d &amp;amp;&amp;amp; \frac 12\mathcal E_x\left(t\right) - \frac i2\mathcal E_y\left(t\right)\\ \frac 12\mathcal E_x\left(t\right) + \frac i2\mathcal E_y\left(t\right) &amp;amp;&amp;amp; \omega_2-2\omega_d\end{pmatrix}$$ However, due to lower anharmonicity, the microwave pulses have to be shaped to reduce leakage to higher energy levels in a process known as &lt;a href=&quot;https://arxiv.org/abs/0901.0534v3&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Derivative Removal by Adiabatic Gate (DRAG)&lt;/em&gt;&lt;/a&gt;. By varying the pulse, different Hamiltonians can be achieved, which, depending on the time of the pulse can be used to implement different unitary operations on a single qubit.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Measurement/readout:&lt;/strong&gt; A microwave resonator, with resonance frequency $\omega_r$, can be coupled to the transmon using a capacitor. This interaction causes (decaying) Rabi oscillations to occur in the transmon-resonator system. When the coupling strength of cavity and qubit, $g \ll \omega-\omega_r$, this is known as the &lt;em&gt;dispersive regime&lt;/em&gt;. In this regime, the transmittance spectrum of the cavity is shifted by $\pm g^2/\left(\omega-\omega_r\right)$ depending on the state of the qubit, so applying a microwave pulse and analysing the transmittance and reflectance (by computer) can then be used to measure the qubit.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Multiple qubit unitary evolution:&lt;/strong&gt; This idea of coupling a qubit to a microwave resonator can be extended by coupling the resonator to another qubit. As in the single qubit gate case, timings of the coupling as well as microwave pulses can be used allow the first qubit to couple to the cavity, which is then coupled to the second qubit and perform certain 2-qubit gates. Higher energy levels can also be used to make certain gates easier to implement due to interactions between higher levels caused by the cavity. One such example is shown &lt;a href=&quot;https://arxiv.org/abs/0903.2030v2&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, where the cavity causes an interaction between the states of $\left|2\right&amp;gt;\left|0\right&amp;gt;$ and $\left|1\right&amp;gt;\left|1\right&amp;gt;$. An avoided crossing between these states means that a 2-qubit phase gate can be implemented, although in general 2-qubit gates are implemented less well (have a lower fidelity) than single qubit ones.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Initialisation:&lt;/strong&gt; Readout, potentially followed by a single qubit Pauli $X$ gate (on each qubit measured to be in state $\left|1\right\rangle$) to ensure that all qubits start in state $\left|0\right\rangle$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Adding 2 and 3 is now a 'simple' matter of initialising the qubits, performing the gates equivalent to a classical reversible adder and measuring the result, all implemented automatically. The measurement result is then returned by a classical computer as per usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;As a bonus&lt;/strong&gt;, it seems a little pointless to go through all that in order to implement gates that could be done on a classical computer anyway, so it turns out that it's possible to approximately implement a &lt;a href=&quot;https://arxiv.org/abs/1611.07851&quot; rel=&quot;noreferrer&quot;&gt;quantum adder&lt;/a&gt;, which adds two quantum (as opposed to classical) states, with some error, on one of IBM's processors.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-26T16:00:33.510" LastActivityDate="2018-03-26T16:00:33.510" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1325" PostTypeId="5" CreationDate="2018-03-25T17:35:51.153" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T17:35:51.153" LastActivityDate="2018-03-25T17:35:51.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1326" PostTypeId="4" CreationDate="2018-03-25T17:35:51.153" Score="0" Body="A cryptocurrency (or crypto currency) is a digital asset designed to work as a medium of exchange that uses cryptography to secure its transactions, to control the creation of additional units, and to verify the transfer of assets. (Wikipedia) Please be sure that the system under consideration depends crucially on quantum computing." OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-01-01T09:45:02.777" LastActivityDate="2019-01-01T09:45:02.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1327" PostTypeId="1" CreationDate="2018-03-25T17:45:24.167" Score="12" ViewCount="175" Body="&lt;p&gt;Consider a classical computer, one making, say, a calculation involving a large amount of data. Would quantum memory allow it to store that information (in the short term) more efficiently, or better handle that quantity of data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thought would be it isn't possible, due to the advantage of quantum information storage being in the superpositions, and the data from a classical computer being very much &lt;em&gt;not&lt;/em&gt; in a superposition, but I'd like to see if this is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, citations for further reading would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-25T18:23:26.927" Title="Quantum memory assisting classical memory" Tags="&lt;quantum-memory&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1328" PostTypeId="1" CreationDate="2018-03-25T17:49:50.387" Score="7" ViewCount="243" Body="&lt;p&gt;As mentioned in an earlier question of mine, I am interested in using type one spontaneous down conversion (SPDC) in optical quantum computing. However, SPDC is a somewhat low probability occurrence - most of the photons pass straight through the crystals unentangled. What methods, if any, are there to improve the probability of down conversion occurring, and therefore entanglement between photons?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2018-03-27T09:59:41.300" LastActivityDate="2018-04-04T18:26:40.737" Title="Improving probability of spontaneous parametric down conversion" Tags="&lt;optical-quantum-computing&gt;&lt;experiment&gt;&lt;spdc&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1329" PostTypeId="2" ParentId="1328" CreationDate="2018-03-25T17:58:40.973" Score="2" Body="&lt;p&gt;Here's some relevant work in &lt;a href=&quot;https://arxiv.org/abs/1001.4182&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimizing type-I polarization-entangled photons-Radhika Rangarajan, Michael Goggin, Paul Kwiat&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Abstract:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Optical quantum information processing needs ultra-bright sources of&#xA;  entangled photons, especially from synchronizable femtosecond lasers&#xA;  and low-cost cw-diode lasers. Decoherence due to timing information&#xA;  and spatial mode-dependent phase has traditionally limited the&#xA;  brightness of such sources. We report on a variety of methods to&#xA;  optimize type-I polarization-entangled sources - the combined use of&#xA;  different compensation techniques to engineer high-fidelity pulsed and&#xA;  cw-diode laser-pumped sources, as well as the first production of&#xA;  polarization-entanglement directly from the highly nonlinear biaxial&#xA;  crystal BiB3O6 (BiBO). Using spatial compensation, we show more than a&#xA;  400-fold improvement in the phase flatness, which otherwise limits&#xA;  efficient collection of entangled photons from BiBO, and report the&#xA;  highest fidelity to date (99%) of any ultrafast&#xA;  polarization-entanglement source. Our numerical code, available on our&#xA;  website, can design optimal compensation crystals and simulate&#xA;  entanglement from a variety of type-I phasematched nonlinear crystals.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Apart from that I'd like to mention another interesting development in methods to entangle photons efficiently: An alternative to spontaneous parametric down conversion (SPDC) is&#xA;two-photon emission from electrically driven semiconductors. According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Spontaneous_parametric_down-conversion#Alternatives&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The newly observed effect of two-photon emission from electrically&#xA;  driven semiconductors has been proposed as a basis for more efficient&#xA;  sources of entangled photon pairs. Other than SPDC-generated&#xA;  photon pairs, the photons of a semiconductor-emitted pair usually are&#xA;  not identical but have different energies. Until recently, within&#xA;  the constraints of quantum uncertainty, the pair of emitted photons&#xA;  were assumed to be co-located: they are born from the same location.&#xA;  However, a new nonlocalized mechanism for the production of correlated&#xA;  photon pairs in SPDC has highlighted that occasionally the individual&#xA;  photons that constitute the pair can be emitted from spatially&#xA;  separated points.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Relevant paper: &lt;a href=&quot;https://www.nature.com/articles/nphoton.2008.28&quot; rel=&quot;nofollow noreferrer&quot;&gt;Observation of two-photon emission from semiconductors - Alex Hayat, Pavel Ginzburg &amp;amp; Meir Orenstein&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the abstract it is &quot;&lt;em&gt;three orders of magnitude more efficient than the existing down-conversion schemes&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-03-25T18:47:11.223" LastActivityDate="2018-03-25T18:47:11.223" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1330" PostTypeId="2" ParentId="1327" CreationDate="2018-03-25T18:23:26.927" Score="11" Body="&lt;h2&gt;In summary, no.&lt;/h2&gt;&#xA;&lt;p&gt;If you think about it, this makes sense. When measuring a quantum system with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, you get &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of information. the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; figure exists only when the system is in superposition, which a classical computer cannot access.&lt;/p&gt;&#xA;&lt;p&gt;The specific theorem in question here is &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;noreferrer&quot;&gt;Holevo's theorem&lt;/a&gt;. To quote Wikipedia:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In essence, the Holevo bound proves that given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, although they can &amp;quot;carry&amp;quot; a larger amount of (classical) information (thanks to quantum superposition), the amount of classical information that can be retrieved, i.e. accessed, can be only up to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical (non-quantum encoded) bits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://physics.stackexchange.com/questions/358628/will-quantum-computing-provide-any-advantage-for-storing-large-amounts-of-data&quot;&gt;this physics question and answer(s)&lt;/a&gt; as well. (Thanks to glS for linking to this in the comments.)&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-03-25T18:23:26.927" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1331" PostTypeId="2" ParentId="1225" CreationDate="2018-03-25T19:12:10.960" Score="5" Body="&lt;p&gt;From a computer science perspective, the calculation of quantum-state amplitudes can be related to group-by aggregation queries in relational database systems, and the techniques we developed to reorganize calculations can be related to algebraic manipulations that are performed by database query optimizers. The general “design pattern” is thus analogous: convert quantum circuits into graph-based algebraic representations that can be readily manipulated and then use those representations to generate optimized execution plans for their simulation. A complexity analysis could then be approached from this perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I included a simple example in a reply to a question posted on the IBM Q Experience Forum: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/community/question?questionId=625bb74685836730de3e36a61f78277f&quot; rel=&quot;noreferrer&quot;&gt;Equations for Bristle Brush Example&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="522" LastActivityDate="2018-03-25T19:12:10.960" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1332" PostTypeId="5" CreationDate="2018-03-25T23:09:54.967" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T23:09:54.967" LastActivityDate="2018-03-25T23:09:54.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1333" PostTypeId="4" CreationDate="2018-03-25T23:09:54.967" Score="0" Body="For questions about the quantum analogue of the universal Turing machine; i.e., for questions about the theoretical construct that is the universal quantum computer. This tag is not for questions about the normal Turing machine; those would usually fit better on Computer Science SE." OwnerUserId="91" LastEditorUserId="23" LastEditDate="2020-09-23T11:46:29.493" LastActivityDate="2020-09-23T11:46:29.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1334" PostTypeId="5" CreationDate="2018-03-25T23:11:37.393" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-25T23:11:37.393" LastActivityDate="2018-03-25T23:11:37.393" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1335" PostTypeId="4" CreationDate="2018-03-25T23:11:37.393" Score="0" Body="For questions about the set of quantum gates that form a set of gates from which another gate can be produced; this set is analogous the classical set of universal gates (either a NOR gate or a NAND gate can produce any other gate). This tag, however, is not to be used for the classical set of universal gates; those questions are probably more appropriate on Computer Science SE." OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-01-01T09:28:39.133" LastActivityDate="2019-01-01T09:28:39.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1336" PostTypeId="2" ParentId="1292" CreationDate="2018-03-25T23:25:33.680" Score="6" Body="&lt;p&gt;It's difficult to define the point where an experimental setup is a quantum computer. But the crucial feature of a quantum computer is that it's able to perform a quantum computation. The first experimental realization of an algorithm was indeed &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801027&quot; rel=&quot;noreferrer&quot;&gt;Jones' and Mosca's implementation&lt;/a&gt; of the Deutsch algorithm in 1998 using an NMR setup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course previous experiments showed components that could be used in a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is quite reasonable to demand that a quantum computer is able to perform arbitrary arithmetics, whether programmable or by minor adjustments to the setup. By this definition we don't have a quantum computer, yet. This is related to the &lt;a href=&quot;https://en.wikipedia.org/wiki/DiVincenzo%27s_criteria&quot; rel=&quot;noreferrer&quot;&gt;DiVincenzo Criteria&lt;/a&gt; for Quantum Computers.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2018-03-25T23:50:47.003" LastActivityDate="2018-03-25T23:50:47.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1337" PostTypeId="2" ParentId="1276" CreationDate="2018-03-26T01:08:53.800" Score="5" Body="&lt;p&gt;There is a newer result from Robert Beals, Stephen Brierley, Oliver Gray, Aram Harrow, Samuel Kutin, Noah Linden, Dan Shepherd, Mark Stather. They present on Table 2 of &lt;a href=&quot;https://arxiv.org/abs/1207.2307&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient Distributed Quantum Computing&lt;/a&gt; the results for bubble sort and insertion sort, it is mainly for &quot;network sorting&quot; but they gave more references about sorting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick and very briefly description of the paper can be:&#xA;We can say that the paper show how to solve several problems such as access the quantum memory without the loss of superposition (and they give the cost for it). Also, the paper presents the problem of sorting a network doing it quantumly (one of the problems is the reversibility of operations). I like the paper because it raises several problems and the authors gave the solution for some of the problems. I think that it is hard to try to summarize, I really recommend to read.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that I have helped.&lt;/p&gt;&#xA;" OwnerUserId="534" LastEditorUserId="534" LastEditDate="2018-03-26T11:01:59.027" LastActivityDate="2018-03-26T11:01:59.027" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1338" PostTypeId="2" ParentId="12" CreationDate="2018-03-26T01:13:54.233" Score="3" Body="&lt;p&gt;I think a nice &quot;overview&quot; about the subject can be found at: &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantiki&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have a list of quantum computer simulators in several languages, some of the simulators have been cited here before. However, they keep a list that they update to inform (or try to inform) of the project's status. There are some &quot;libraries&quot; such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Haskell&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://hackage.haskell.org/package/qchas&quot; rel=&quot;nofollow noreferrer&quot;&gt;qchas&lt;/a&gt; (qchas: A library for implementing Quantum Algorithms) - A library useful for implementing Quantum Algorithms. It contains definitions of Quantum Gates, Qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Python&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/artiste-qb-net/qubiter&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubiter&lt;/a&gt; : The Qubiter project aims to provide eventually a full suite of tools, written mostly in Python, for designing and simulating quantum circuits on classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Javascript&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/garrison/jsqis&quot; rel=&quot;nofollow noreferrer&quot;&gt;jsqis&lt;/a&gt; : &#xA;jsqis, at its core, is a quantum computer simulator written in Javascript. It allows initialization of quantum registers and their manipulation by means of quantum gates.&lt;/p&gt;&#xA;" OwnerUserId="534" LastEditorUserId="82" LastEditDate="2018-03-26T02:55:21.647" LastActivityDate="2018-03-26T02:55:21.647" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1339" PostTypeId="1" AcceptedAnswerId="1643" CreationDate="2018-03-26T02:22:40.907" Score="7" ViewCount="256" Body="&lt;p&gt;Q1: I've tried to find out if &lt;a href=&quot;https://en.wikipedia.org/wiki/Barkhausen_effect#Barkhausen_noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;Barkhausen noise&lt;/a&gt; affects the &lt;a href=&quot;https://en.wikipedia.org/wiki/Measurement_in_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurement&lt;/a&gt; of spin-wave excitations in magnetic particle material based qubits.&lt;/p&gt;&#xA;&lt;p&gt;I prefer implementations such as those described in &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0009432&quot; rel=&quot;nofollow noreferrer&quot;&gt;Magnetic qubits as hardware for quantum computers&lt;/a&gt;&amp;quot;, rather than a true hybrid system such as described in &amp;quot;&lt;a href=&quot;http://science.sciencemag.org/content/349/6246/405&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coherent coupling between a ferromagnetic magnon and a superconducting qubit&lt;/a&gt;&amp;quot; &lt;strong&gt;or&lt;/strong&gt; &amp;quot;&lt;a href=&quot;http://advances.sciencemag.org/content/3/7/e1603150.full&quot; rel=&quot;nofollow noreferrer&quot;&gt;Resolving quanta of collective spin excitations in a millimeter-sized ferromagnet&lt;/a&gt;&amp;quot;; which relies on the coherent coupling between a single-magnon excitation in a millimeter-sized ferromagnetic sphere and a superconducting qubit.&lt;/p&gt;&#xA;&lt;p&gt;I'm asking about the situation where the magnetic particle is the qubit and not simply part of a magnon-qubit coupling scheme.&lt;/p&gt;&#xA;&lt;p&gt;Q2: Is Barkhausen noise a factor that is not considered relevant?&lt;/p&gt;&#xA;&lt;p&gt;After several hours of research the closest search I could find, for a paper of quantum computing hardware, Mesoscale and Nanoscale Physics, and Barkhausen noise, was this paper: &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1603.06858v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Theory of Spin Noise Spectroscopy: A Review&lt;/a&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;&lt;strong&gt;Barkhausen noise&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Studies of fluctuations in magnetic systems take roots in the work of Heinrich Barkhausen who proved already in 1919 that the magnetic hysteresis curve is not continuous, but is made up of small random steps caused when the magnetic domains move under an applied magnetic field. This noise can be characterized by placing a coil of a conducting wire near the sample. The motion of ferromagnetic domain walls produces changes in the magnetization that induces noisy electrical signals in the coil. Studies of Barkhausen noise have been used in practice as a nondemolition tool to characterize the distribution of elastic stresses and the microstructure of magnetic samples&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It would seem that Barkhausen noise can affect even very small magnetic particles subjected to an external magnetizing field, as might be encountered during measurement, but nowhere (it would seem) is there research on it's effect on quantum noise of the system.&lt;/p&gt;&#xA;&lt;p&gt;It appears to be a difficult or unanswered question.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;An answer was offered stating:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Barkhausen effect has to do with domain wall motion. The magnetic qubit discussed in the first reference is based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Nanometre&quot; rel=&quot;nofollow noreferrer&quot;&gt;nm&lt;/a&gt; sized magnetic particle, which we can assume to be &lt;a href=&quot;https://en.wikipedia.org/wiki/Single_domain_(magnetic)&quot; rel=&quot;nofollow noreferrer&quot;&gt;single domain&lt;/a&gt;, and therefore would not exhibit Barkhausen noise. This &lt;a href=&quot;https://dspace.mit.edu/bitstream/handle/1721.1/5030/RLE-TR-016-14261877.pdf?sequence=1&amp;amp;origin=publicationDetail&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper by Kittel&lt;/a&gt; [Theory of the Structure of Ferromagnetic Domains - 1946] discusses domains in magnetic particles.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There are different limits stated as to &lt;a href=&quot;https://en.wikipedia.org/wiki/Single_domain_(magnetic)#Limits_on_the_single-domain_size&quot; rel=&quot;nofollow noreferrer&quot;&gt;what constitutes a single-domain magnetic particle&lt;/a&gt;, I've found upper limits ranging from 30-100 nm, with lower limits somewhat more consistent around 10 nm.&lt;/p&gt;&#xA;&lt;p&gt;While it's not precisely stated what the exact size of the particles are in that paper, and we might assume others using similar methods could utilize particles of a different size, let's assume for the sake of &lt;strong&gt;that one answer only&lt;/strong&gt; that the particles in question are single domain.&lt;/p&gt;&#xA;&lt;p&gt;There are five main mechanisms due to which magnetic Barkhausen emissions occur [Jiles (1988)]:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Discontinuous, irreversible domain wall motion&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Discontinuous rotation of magnetic moments within a domain&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Appearance and disappearance of domain walls (Bloch or Neel). Domain&#xA;walls are narrow transition regions between magnetic domains. They&#xA;only differ in the plane of rotation of magnetization. For Bloch&#xA;walls the magnetization rotates through the plane of the domain wall&#xA;whereas for Neel walls the magnetization rotates within the plane of&#xA;the domain wall.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inversion of magnetization in single-domain particles&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Displacement of Bloch or Neel lines in two 180&lt;span class=&quot;math-container&quot;&gt;$°$&lt;/span&gt; walls with&#xA;oppositely directed magnetizations&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;There are a number of papers on the measurement of Barkhausen noise in single-domain magnetic particles:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&amp;quot;&lt;a href=&quot;https://www.researchgate.net/publication/224070409_Detection_of_the_magnetization_reversal_of_individual_interacting_single-domain_particles_within_Co-Cr_columnar_thin-films&quot; rel=&quot;nofollow noreferrer&quot;&gt;Detection of the magnetization reversal of individual interacting single-domain particles within Co-Cr columnar thin-films&lt;/a&gt;&amp;quot; - 1988&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;The fundamental Barkhausen noise generated by the magnetization reversal of individual particles within a particulate magnetic medium has been observed using the anomalous Hall effect (AHE) as a sensitive magnetization probe. This is the first time the reversal of individual interacting single or nearly single domain particles has been detected. The jumps correspond to magnetic switching volumes of ~3×10&lt;span class=&quot;math-container&quot;&gt;$^{-15}$&lt;/span&gt; cm&lt;span class=&quot;math-container&quot;&gt;$^3$&lt;/span&gt; with moments around 10&lt;span class=&quot;math-container&quot;&gt;$^{-12}$&lt;/span&gt; emu.&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&amp;quot;&lt;a href=&quot;https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/JB088iB08p06505&quot; rel=&quot;nofollow noreferrer&quot;&gt;The dependence of magnetic domain structure upon magnetization state with emphasis upon nucleation as a mechanism for pseudo‐single‐domain behavior&lt;/a&gt;&amp;quot; - 1983&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;These observations thereby demonstrate that nucleation becomes increasingly more dominant as the particles become smaller, a manifestation of the random distribution of active nucleation sites. Nucleation may therefore account for much of the magnitude and grain size dependence of hysteresis parameters in the PSD range as well as resulting in a gradual transition between multidomain and PSD behavior. Fine particles completely controlled by nucleation during hysteresis behave in a strikingly parallel manner to classical single domains and are therefore quite appropriately described as being pseudo‐single‐domain.&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1401.4326v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Statistical Physics of Pure Barkhausen Noise&lt;/a&gt;&amp;quot; - 2014&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;That paper goes as far as to state:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;We will show that here Barkhausen Noise has nothing to do with the movement of domain walls nor with Self Organized Criticality nor with fractal domains nor with thermodynamic criteria.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="278" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-08T21:12:58.903" Title="Does Barkhausen noise affect the measurement of magnetic particle based qubits?" Tags="&lt;physical-qubit&gt;&lt;architecture&gt;&lt;noise&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1340" PostTypeId="2" ParentId="1339" CreationDate="2018-03-26T05:59:50.943" Score="1" Body="&lt;p&gt;The Barkhausen effect has to do with domain wall motion. The magnetic qubit discussed in the first reference is based on nm sized magnetic particle, which we can assume to be single domain, and therefore would not exhibit Barkhausen noise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://dspace.mit.edu/bitstream/handle/1721.1/5030/RLE-TR-016-14261877.pdf?sequence=1&amp;amp;origin=publicationDetail&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; by Kittel discusses domains in magnetic particles. &lt;/p&gt;&#xA;" OwnerUserId="127" LastEditorUserId="127" LastEditDate="2018-03-26T16:43:35.787" LastActivityDate="2018-03-26T16:43:35.787" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1341" PostTypeId="1" CreationDate="2018-03-26T10:49:31.487" Score="6" ViewCount="1367" Body="&lt;p&gt;What does one mean by saying that classical bits perform operations at the scale of $2n$ and quantum computers perform operations at the scale of $2^n$? In both cases, $n$ = Number of bits/qubits. &lt;/p&gt;&#xA;" OwnerUserId="543" LastEditorUserId="26" LastEditDate="2018-12-23T12:11:47.667" LastActivityDate="2018-12-23T12:11:47.667" Title="Why do classical bits perform calculations at a scale that expands linearly and qubits at exponential scale in the number of (qu)bits?" Tags="&lt;speedup&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1342" PostTypeId="2" ParentId="1341" CreationDate="2018-03-26T11:16:19.733" Score="3" Body="&lt;p&gt;The reason is because of the superposition. It allows you to perform operations and won the speed up. For example, if you have a just one qubit you will have the following because of the superposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha_0\lvert0\rangle + \alpha_1\lvert1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that you have already $2$ basis for one qubit. If you have two qubits you will have $4$ basis for your system and go on. I will put the $2$ qubit but as a combination of tensor product of the previous basis and we will have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\lvert0\rangle ⊗ \lvert0\rangle, \lvert0\rangle ⊗ \lvert1\rangle, \lvert1\rangle ⊗ \lvert0\rangle, \lvert1\rangle ⊗ \lvert1\rangle$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply the tensor product of it, you will end up with a $4$ basis system for $2$ qubits ($2^2$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for a introduction material I think that the &lt;a href=&quot;https://homepages.cwi.nl/~rdewolf/qcnotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture Notes&lt;/a&gt; from Ronald de Wolf is a good start. It is possible to get directly from his website and it is for free. He gave a better explanation about this on section 1.3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that I have helped you. &lt;/p&gt;&#xA;" OwnerUserId="534" LastEditorUserId="26" LastEditDate="2018-03-26T14:45:19.363" LastActivityDate="2018-03-26T14:45:19.363" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1343" PostTypeId="2" ParentId="1341" CreationDate="2018-03-26T12:33:09.170" Score="7" Body="&lt;p&gt;I'm not sure it really is true to make such a claim, even though it is one that is often seen. Even so, this statement is common because it does point towards a difference between classical computers and quantum ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical computation is essentially a process that takes a single input bit string and keeps transforming it until you get a single output bit string. You can think of the whole process as only ever having one bit string in the computer at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same is true for quantum computers, except that you need to replace 'bit string' with 'state of many qubits'. So how do bit strings compare with multi qubit states? To find out, we can look at how classical computers can simulate quantum ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to represent states of $n$ qubits in a classical computer is to think of them as superpositions of all possible $n$-bit strings. Then you can have a big array, which stores the corresponding amplitude for every $n$-bit string. Since there are $2^n$ $n$-bit strings, this will take an exponentially large amount of memory. This is often not the most efficient method of representing quantum states, but there are cases when it is no worse than any other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we need to simulate any possible process for $n$ qubits with bits, we know that it will incur this kind of overhead. If we use this to draw a comparison between qubits and bits, we could say that an exponentially large number of qubits are required to match the power of $n$ bits. But the same would not be true for all possible computational tasks.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-03-26T12:33:09.170" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1344" PostTypeId="1" AcceptedAnswerId="1354" CreationDate="2018-03-26T15:37:09.230" Score="14" ViewCount="2223" Body="&lt;p&gt;Suppose we have a circuit decomposition of a unitary $U$ using some universal gate set (for example CNOT-gates and single qubit unitaries). Is there a direct way to write down the circuit of the corresponding controlled unitary $C_U$ using the same universal gate set?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example take $U=i Y = H X H X$, as a circuit:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xGUVS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xGUVS.png&quot; alt=&quot;circuit for U&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can replace the $X$ gates by $C_X$ (CNOT) gates to obtain $C_U$:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UPq7u.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UPq7u.png&quot; alt=&quot;circuit for CU&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works because if the control qubit is in state $|0\rangle$ the action on the target is $H^2=\mathbb{I}$, while for $|1\rangle$ it applies the circuit for $U$. For different $U$, in particular if it acts on several qubits, coming up with such a circuit might be cumbersome. Is there a recipe to obtain the circuit of $C_U$ given that you know how to build $U$?&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="55" LastEditDate="2019-04-10T12:17:58.603" LastActivityDate="2019-04-10T12:17:58.603" Title="Given a decomposition for a unitary $U$, how do you decompose the corresponding controlled unitary gate $C(U)$?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;universal-gates&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1345" PostTypeId="5" CreationDate="2018-03-26T15:47:12.237" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-26T15:47:12.237" LastActivityDate="2018-03-26T15:47:12.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1346" PostTypeId="4" CreationDate="2018-03-26T15:47:12.237" Score="0" Body="For questions related to experiments with actual quantum computing devices and how to interpret their results. Also appropriate if the question can only be reasonable answered with an experiment (or experiment design)." OwnerUserId="253" LastEditorUserId="26" LastEditDate="2019-01-01T08:54:34.520" LastActivityDate="2019-01-01T08:54:34.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1347" PostTypeId="2" ParentId="74" CreationDate="2018-03-26T15:50:23.407" Score="18" Body="&lt;h3&gt;Measurement-based quantum computation (MBQC)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is a way to perform quantum computation, using intermediary measurements as a way of &lt;em&gt;driving&lt;/em&gt; the computation rather than just extracting the answers. It is a special case of &quot;quantum circuits with intermediary measurements&quot;, and so is no more powerful. However, when it was introduced, it up-ended many people's intuitions of the role of unitary transformations in quantum computation. In this model one has constraints such as the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;One prepares, or is given, a very large entangled state &amp;mdash; one which can be described (or prepared) by having some set of qubits all initially prepared in the state $\lvert + \rangle$, and then some sequence of controlled-Z operations $\mathrm{CZ} = \mathrm{diag}(+1,+1,+1,-1)$, performed on pairs of qubits according to the edge-relations of a graph (commonly, a rectangular grid or hexagonal lattice).&lt;/li&gt;&#xA;&lt;li&gt;Perform a sequence of measurements on these qubits &amp;mdash; some perhaps in the standard basis, but the majority not in the standard basis, but instead measuring observables such as $M_{\mathrm{XY}}(\theta) = \cos(\theta) X - \sin(\theta) Y$ for various angles $\theta$. Each measurement yields an outcome $+1$ or $-1$ (often labelled '0' or '1' respectively), and the choice of angle is allowed to depend in a simple way on the outcomes of previous measurements (in a way computed by a classical control system).&lt;/li&gt;&#xA;&lt;li&gt;The answer to the computation may be computed from the classical outcomes $\pm 1$ of the measurements.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As with the unitary circuit model, there are variations one can consider for this model. However, the core concept is adaptive single-qubit measurements performed on a large entangled state, or a state which has been subjected to a sequence of commuting and possibly entangling operations which are either performed all at once or in stages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This model of computation is usually considered as being useful primarily as a way to simulate unitary circuits. Because it is often seen as a means to simulate a better-liked and simpler model of computation, it is not considered theoretically very interesting anymore to most people. However:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It is important among other things as a motivating concept behind the class &lt;strong&gt;IQP&lt;/strong&gt;, which is one means of demonstrating that a quantum computer is difficult to simulate, and Blind Quantum Computing, which is one way to try to solve problems in secure computation using quantum resources.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no reason why measurement-based computations should be essentially limited to simulating unitary quantum circuits: it seems to me (and a handful of other theorists in the minority) that MQBC could provide a way of describing interesting computational primitives. While MBQC is just a special case of circuits with intermediary measurements, and can therefore be simulated by unitary circuits with only polynomial overhead, this is not to say that unitary circuits would necessarily be a very &lt;em&gt;fruitful&lt;/em&gt; way of describing anything that one could do in principle in a measurement-based computation (just as there exists imperative and functional programming languages in classical computation which sit a little ill-at-ease with one another).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The question remains whether MBQC will suggest any way of thinking about building algorithms which is not as easily presented in terms of unitary circuits &amp;mdash; but there can be no question of a computational advantage or disadvantage over unitary circuits, except one of specific resources and suitability for some architecture.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="253" LastEditDate="2018-03-29T11:01:42.117" LastActivityDate="2018-03-29T11:01:42.117" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1348" PostTypeId="2" ParentId="74" CreationDate="2018-03-26T15:51:25.113" Score="12" Body="&lt;h3&gt;The Unitary Circuit Model&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is the best well-known model of quantum computation. In this model one has constraints such as the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a set of qubits initialised to a pure state, which we denote $\lvert 0 \rangle$;&lt;/li&gt;&#xA;&lt;li&gt;a sequence of unitary transformations which one performs on them, which may depend on a classical bit-string $x\in \{0,1\}^n$;&lt;/li&gt;&#xA;&lt;li&gt;one or more measurements in the standard basis performed at the very end of the computation, yielding a classical output string $y \in \{0,1\}^k$. (We do not require $k = n$: for instance, for YES / NO problems, one often takes $k = 1$ no matter the size of $n$.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Minor details may change (for instance, the set of unitaries one may perform; whether one allows preparation in other pure states such as $\lvert 1 \rangle$, $\lvert +\rangle$, $\lvert -\rangle$; whether measurements must be in the standard basis or can also be in some other basis), but these do not make any essential difference.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="253" LastEditDate="2018-03-29T11:03:04.987" LastActivityDate="2018-03-29T11:03:04.987" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1349" PostTypeId="2" ParentId="74" CreationDate="2018-03-26T15:54:40.103" Score="26" Body="&lt;h3&gt;The adiabatic model&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This model of quantum computation is motivated by ideas in quantum many-body theory, and differs substantially both from the circuit model (in that it is a continuous-time model) and from continuous-time quantum walks (in that it has a time-dependent evolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adiabatic computation usually takes the following form.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start with some set of qubits, all in some simple state such as $\lvert + \rangle$. Call the initial global state $\lvert \psi_0 \rangle$.&lt;/li&gt;&#xA;&lt;li&gt;Subject these qubits to an interaction Hamiltonian $H_0$ for which $\lvert \psi_0 \rangle$ is the unique ground state (the state with the lowest energy). For instance, given $\lvert \psi_0 \rangle = \lvert + \rangle^{\otimes n}$, we may choose $H_0 = - \sum_{k} \sigma^{(x)}_k$.&lt;/li&gt;&#xA;&lt;li&gt;Choose a final Hamiltonian $H_1$, which has a unique ground state which encodes the answer to a problem you are interested in. For instance, if you want to solve a constraint satisfaction problem, you could define a Hamiltonian $H_1 = \sum_{c} h_c$, where the sum is taken over the constraints $c$ of the classical problem, and where each $h_c$ is an operator which imposes an energy penalty (a positive energy contribution) to any standard basis state representing a classical assignment which does not satisfy the constraint $c$.&lt;/li&gt;&#xA;&lt;li&gt;Define a time interval $T \geqslant 0$ and a time-varying Hamiltonian $H(t)$ such that $H(0) = H_0$ and $H(T) = H_1$. A common but not necessary choice is to simply take a linear interpolation $H(t) = \tfrac{t}{T} H_1 + (1 - \tfrac{t}{T})H_0$.&lt;/li&gt;&#xA;&lt;li&gt;For times $t = 0$ up to $t = T$, allow the system to evolve under the continuously varying Hamiltonian $H(t)$, and measure the qubits at the output to obtain an outcome $y \in \{0,1\}^n$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The basis of the adiabatic model is the &lt;em&gt;adiabatic theorem&lt;/em&gt;, of which there are several versions. The version by Ambainis and Regev [&amp;thinsp;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0411152&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/0411152&lt;/a&gt;&amp;thinsp;] (a more rigorous example) implies that if there is always an &quot;energy gap&quot; of at least $\lambda &amp;gt; 0$ between the ground state of $H(t)$ and its first excited state for all $0 \leqslant t \leqslant T$, and the operator-norms of the first and second derivatives of $H$ are small enough (that is, $H(t)$ does not vary too quickly or abruptly), then you can make the probability of getting the output you want as large as you like just by running the computation slowly enough. Furthermore, you can reduce the probability of error by any constant factor just by slowing down the whole computation by a polynomially-related factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Despite being very different in presentation from the unitary circuit model, it has been shown that this model is polynomial-time equivalent to the unitary circuit model [&amp;thinsp;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405098&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/0405098&lt;/a&gt;&amp;thinsp;]. The advantage of the adiabatic algorithm is that it provides a different approach to constructing quantum algorithms which is more amenable to optimisation problems. One disadvantage is that it is not clear how to protect it against noise, or to tell how its performance degrades under imperfect control. Another problem is that, even without any imperfections in the system, determining how slowly to run the algorithm to get a reliable answer is a difficult problem &amp;mdash; it depends on the energy gap, and it isn't easy in general to tell what the energy gap is for a static Hamiltonian $H$, let alone a time-varying one $H(t)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, this is a model of both theoretical and practical interest, and has the distinction of being the most different from the unitary circuit model of essentially any that exists.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="253" LastEditDate="2018-03-29T11:01:57.110" LastActivityDate="2018-03-29T11:01:57.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1350" PostTypeId="2" ParentId="74" CreationDate="2018-03-26T15:56:31.213" Score="11" Body="&lt;h3&gt;Discrete-time quantum walk&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;A &quot;discrete-time quantum walk&quot; is a quantum variation on a random walk, in which there is a 'walker' (or multiple 'walkers') which takes small steps in a graph (e.g. a chain of nodes, or a rectangular grid). The difference is that where a random walker takes a step in a randomly determined direction, a quantum walker takes a step in a direction determined by a quantum &quot;coin&quot; register, which at each step is &quot;flipped&quot; by a unitary transformation rather than changed by re-sampling a random variable. See &#xA;[&amp;thinsp;&lt;a href=&quot;http://arxiv.org/abs/quant-ph/0012090&quot; rel=&quot;noreferrer&quot; title=&quot;Quantum Walks On Graphs. Dorit Aharonov, Andris Ambainis, Julia Kempe, Umesh Vazirani.&quot;&gt;arXiv:quant-ph/0012090&lt;/a&gt;&amp;thinsp;] for an early reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of simplicity, I will describe a quantum walk on a cycle of size $2^n$; though one must change some of the details to consider quantum walks on more general graphs. In this model of computation, one typically does the following.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare a &quot;position&quot; register on $n$ qubits in some state such as $\lvert 00\cdots 0\rangle$, and a &quot;coin&quot; register (with standard basis states which we denote by $\lvert +1 \rangle$ and $\lvert -1 \rangle$) in some initial state which may be a superposition of the two standard basis states.&lt;/li&gt;&#xA;&lt;li&gt;Perform a coherent controlled-unitary transformation, which adds 1 to the value of the position register (modulo $2^n$) if the coin is in the state $\lvert +1 \rangle$, and subtracts 1 to the value of the position register (modulo $2^n$) if the coin is in the state $\lvert -1 \rangle$.&lt;/li&gt;&#xA;&lt;li&gt;Perform a fixed unitary transformation $C$ to the coin register. This plays the role of a &quot;coin flip&quot; to determine the direction of the next step. We then return to step 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The main difference between this and a random walk is that the different possible &quot;trajectories&quot; of the walker are being performed coherently in superposition, so that they can destructively interfere. This leads to a walker behaviour which is more like ballistic motion than diffusion. Indeed, an early presentation of a model such as this was made by Feynmann, as a way to simulate the Dirac equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This model also often is described in terms of looking for or locating 'marked' elements in the graph, in which case one performs another step (to compute whether the node the walker is at is marked, and then to measure the outcome of that computation) before returning to Step&amp;nbsp;2. Other variations of this sort are reasonable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To perform a quantum walk on a more general graph, one must replace the &quot;position&quot; register with one which can express all of the nodes of the graph, and the &quot;coin&quot; register with one which can express the edges incident to a vertex. The &quot;coin operator&quot; then must also be replaced with one which allows the walker to perform an interesting superposition of different trajectories. (What counts as 'interesting' depends on what your motivation is: physicists often consider ways in which changing the coin operator changes the evolution of the probability density, not for computational purposes but as a way of probing at basic physics using quantum walks as a reasonable toy model of particle movement.) A good framework for generalising quantum walks to more general graphs is the Szegedy formulation [&amp;thinsp;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0401053&quot; rel=&quot;noreferrer&quot; title=&quot;Spectra of Quantized Walks and a √(δε) rule. Mario Szegedy.&quot;&gt;arXiv:quant-ph/0401053&lt;/a&gt;&amp;thinsp;] of discrete-time quantum walks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This model of computation is strictly speaking a special case of the unitary circuit model, but is motivated with very specific physical intuitions, which has led to some algorithmic insights (see e.g.&amp;nbsp;[&amp;thinsp;&lt;a href=&quot;https://arxiv.org/abs/1302.3143&quot; rel=&quot;noreferrer&quot; title=&quot;Quantum Walks and Electric Networks. Aleksandr&amp;#39;s Belovs.&quot;&gt;arXiv:1302.3143&lt;/a&gt;&amp;thinsp;]) for polynomial-time speedups in bounded-error quantum algorithms. This model is also a close relative of the continuous-time quantum walk as a model of computation. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="253" LastEditDate="2018-03-29T11:03:47.783" LastActivityDate="2018-03-29T11:03:47.783" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1351" PostTypeId="2" ParentId="74" CreationDate="2018-03-26T15:59:37.053" Score="10" Body="&lt;h3&gt;Quantum circuits with intermediary measurements&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is a slight variation on &quot;unitary circuits&quot;, in which one allows measurements in the &lt;em&gt;middle&lt;/em&gt; of the algorithm as well as the end, and where one also allows future operations to depend on the outcomes of those measurements. It represents a realistic picture of a quantum processor which interacts with a classical control device, which among other things is the interface between the quantum processor and a human user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intermediary measurement is practically necessary to perform error correction, and so this is in principle a more realistic picture of quantum computation than the unitary circuit model. but it is not uncommon for theorists of a certain type to strongly prefer measurements to be left until the end (using the principle of deferred measurement to simulate any 'intermediary' measurements). So, this may be a significant distinction to make when &lt;em&gt;talking&lt;/em&gt; about quantum algorithms &amp;mdash; but this does not lead to a theoretical increase in the computational power of a quantum algorithm.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="253" LastEditDate="2018-03-29T11:02:50.717" LastActivityDate="2018-03-29T11:02:50.717" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1352" PostTypeId="2" ParentId="1344" CreationDate="2018-03-26T16:37:02.747" Score="6" Body="&lt;p&gt;Although this might not answer your question completely, I think it might provide some direction of thinking. Here are two important facts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Any unitary $2^{n}\times 2^{n}$ matrix $M$, can be realized on a quantum computer with $n$-quantum bits by a &lt;strong&gt;finite&lt;/strong&gt; sequence of controlled-not and single qubit gates&lt;sup&gt;1&lt;/sup&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose $U$ is a unitary $2\times 2$ matrix satisfying $\text{tr } U \neq 0$, $\text{tr} (UX) \neq 0$, and $\text{det } U \neq 1$. Then &lt;strong&gt;six&lt;/strong&gt; elementary gates are necessary and sufficient to implement a controlled $U$-gate&lt;sup&gt;2&lt;/sup&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It should be possible to extend the second case to the general $n\times n$ case, given the first point, although I haven't found any paper which does that explicitly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;1 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;noreferrer&quot;&gt;Elementary gates for quantum computation-A. Barenco (Oxford), C. H. Bennett (IBM), R. Cleve (Calgary), D. P. DiVincenzo (IBM), N. Margolus (MIT), P. Shor (AT&amp;amp;T), T. Sleator (NYU), J. Smolin (UCLA), H. Weinfurter (Innsbruck)&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0207157&quot; rel=&quot;noreferrer&quot;&gt;Optimal Realizations of Controlled Unitary Gates - Guang Song, Andreas Klappenecker (Texas A&amp;amp;M University)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-26T16:37:02.747" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1353" PostTypeId="1" AcceptedAnswerId="1611" CreationDate="2018-03-26T16:41:12.750" Score="7" ViewCount="465" Body="&lt;p&gt;I'm wondering whether even if we cannot create a fast quantum computer, simulating quantum algorithms can be a reasonable method for classical algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, I'd like to see any results of classical algorithms that have been sped up by using a quantum simulation as a subroutine. Second, the next logical step would be to 'cut out the middleman' and see if we can remove the simulator. Perhaps this can even be done semi-automatically!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, is there any result or research on this? Suggestions are welcome.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To be clear, I'm asking whether there exists any problem such that running a simulation of a quantum computer, on a classical computer, can offer any improvement (time or memory) over (trying to) solve the same problem on a classical computer without running any sort of simulation of a quantum computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, I am wondering how one then would attempt to adapt this algorithm such that all 'useless' parts of the quantum algorithm and the simulation are removed, hopefully improving the method even further.&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-05T13:06:30.927" LastActivityDate="2018-04-05T14:00:28.597" Title="Can classical algorithms be improved by using quantum simulation as an intermediary step?" Tags="&lt;speedup&gt;&lt;algorithm&gt;&lt;performance&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="19" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1354" PostTypeId="2" ParentId="1344" CreationDate="2018-03-26T19:20:56.803" Score="16" Body="&lt;p&gt;The question may not be entirely well-defined, in the sense that to ask for a way to compute $C(U)$ from a decomposition of $U$ you need to specify the set of gates that you are willing to use.&#xA;Indeed, it is a known result that any $n$-qubit gate can be exactly decomposed using $\text{CNOT}$ and single-qubit operations, so that a naive answer to the question would be: just decompose $C(U)$ using single-qubit and $\text{CNOT}$s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A different interpretation of the question is the following: given $U$, can I compute $C(U)$ using a set of single-qubit operations and $\text{CNOT}$s &lt;em&gt;not on the control qubit&lt;/em&gt;, and $\text{CNOT}$s with the control being the first qubit?&#xA;This can be done generalising a result found in chapter four of &lt;a href=&quot;https://dl.acm.org/citation.cfm?id=1972505&quot; rel=&quot;noreferrer&quot;&gt;Nielsen &amp;amp; Chuang&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $U$ be a single-qubit gate.&#xA;It can then be proved that $U$ can always be written as $U = e^{i\alpha} AXBXC$, where $X$ is the Pauli X gate, and $A, B$ and $C$ are single-qubit operations such that $ABC=I$ (see N&amp;amp;C for a proof).&#xA;It follows that&#xA;$$C(U)=\Phi_1(\alpha)A_2C(X)B_2C(X) C_2,$$&#xA;where $\Phi_1(\alpha)\equiv\begin{pmatrix}1&amp;amp;0\\0&amp;amp;e^{i\alpha}\end{pmatrix}\otimes I$ is a phase gate applied to the first qubit, and $A_2, B_2, C_2$ are $A, B, C$ applied to the second qubit.&#xA;This is immediate once you realise that, if that first qubit is $|0\rangle$, then $C(X)$ becomes an identity, and on the second qubit you have the operations $ABC$, which give the identity. On the other hand, if the first qubit is $|1\rangle$, then on the second rail you have $AXBXC$, which (together with the phase) equals $U$ by definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above decomposition can be used to find a naive way to compute $C(U)$ for a general $n$-qubit unitary gate.&#xA;The main observation is that if $U=A_1 A_2\cdots A_m$ for any set of gates $\{A_1,..,A_m\}$, then&#xA;$$C(U)=C(A_1)C(A_2)\cdots C(A_m).$$&#xA;But we also know that any $n$-qubit $U$ can be decomposed in terms of CNOTs and single-qubit operations.&#xA;It follows that $C(U)$ is a sequence of CCNOT and $C(V)$ operations, where CCNOT is here an $X$ gate applied to some qubit conditioned to two other qubits being $|1\rangle$, and $V$ is a single-qubit operation on some qubit.&#xA;But again, any CCNOT operation (also called &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;noreferrer&quot;&gt;Toffoli&lt;/a&gt;), can be decomposed as shown in Figure 4.9 in N&amp;amp;C, and the $C(V)$ are decomposed as shown in the first part of the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method allows decomposing a general $n$-qubit unitary gate $U$ using only $\text{CNOT}$ and single-qubit gates.&#xA;You may then go further and generalise this to find a decomposition for the case of multiple control qubits.&#xA;For this you only now need a way to decompose the Toffoli gates, which is again found in Figure 4.9 of N&amp;amp;C.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-26T19:34:03.297" LastActivityDate="2018-03-26T19:34:03.297" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1355" PostTypeId="2" ParentId="1353" CreationDate="2018-03-27T01:42:02.197" Score="1" Body="&lt;p&gt;The question here seems to be: &quot;can a classical computer be more efficient by simulating a quantum computer?&quot; and &quot;what research has been done on this?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it's important, first, to point out that no one is 100% sure that a quantum computer is even actually better than a classical computer, whether or not we have the fastest possible algorithms for a classical or quantum computer for really any particular problem, and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found an &lt;a href=&quot;https://spectrum.ieee.org/tech-talk/computing/hardware/ibms-quantum-leap-simulates-56qubit-machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; from October 2017 that details an experiment IBM did simulating a 56 qubit quantum computer on a supercomputer. Here's what the study author said:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For instance, whereas a perfect 56-qubit quantum computer can perform the experiments &quot;in 100 microseconds or less, we took two days, so a factor of a billion times slower&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(See &lt;a href=&quot;http://lanl.arxiv.org/pdf/1710.05867v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;their paper on arXiv&lt;/a&gt; for more information.) I also found a paper submitted to arXiv in February of 2018 which simulates a 64 qubit quantum computer, building on the work of IBM. They also estimate a 72 qubit circuit could be simulated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What seems to be prevalent in all of this, though, is that these simulations are for help in comparison to quantum computing results and times, and none of them claim to show quantum computing &quot;useless&quot; or &quot;replicable&quot;. So, my final answer would be &lt;strong&gt;no&lt;/strong&gt;, this is not a thing. &lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-27T01:42:02.197" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1356" PostTypeId="1" CreationDate="2018-03-27T17:09:15.597" Score="16" ViewCount="515" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum error correction&lt;/a&gt; is a fundamental aspect of quantum computation, without which large-scale quantum computations are practically unfeasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One aspect of fault-tolerant quantum computing that is often mentioned is that each error-correction protocol has associated an &lt;em&gt;error rate threshold&lt;/em&gt;.&#xA;Basically, for a given computation to be protectable against errors via a given protocol, the error rate of the gates must be below a certain threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if the error rates of single gates are not low enough, then it is not possible to apply error-correction protocols to make the computation more reliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this? Why is it not possible to reduce error rates that are not already very low to begin with?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2018-12-23T14:14:41.567" LastActivityDate="2018-12-23T14:14:41.567" Title="Why do error correction protocols only work when the error rates are already significantly low to begin with?" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="5" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1358" PostTypeId="2" ParentId="1356" CreationDate="2018-03-27T18:35:20.277" Score="2" Body="&lt;p&gt;To me there seem to be two parts of this question (one more related to the title, one more related to the question itself):  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) To which amount of noise are error correction codes effective?&lt;br&gt;&#xA; 2) With which amount of imperfection in gates can we implement fault-tolerant quantum computations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me firs stress the difference: quantum error correction codes can be used in many different scenarios, for example to correct for losses in transmissions. Here the amount of noise mostly depends on the length of the optical fibre and not on the imperfection of the gates. However if we want to implement fault-tolerant quantum computation, the gates are the main source of noise.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;On 1)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Error correction works for large error rates (smaller than $1/2$). Take for example the simple 3 qubit repetition code. The logical error rate is just the probability for the majority vote to be wrong (the orange line is $f(p)=p$ for comparison):  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PfHyd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PfHyd.png&quot; alt=&quot;plot physical vs logical error rate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So whenever the physical error rate $p$ is below $1/2$, the logical error rate is smaller than $p$. Note however, that is particularly effective for small $p$, because the code changes the rate from $\mathcal{O}(p)$ to a $\mathcal{O}(p^2)$ behaviour.  &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;On 2)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;We want to perfrom arbitrarily long quantum computations with a quantum computer. However, the quantum gates are not perfect. In order to cope with the errors introduced by the gates, we use quantum error correction codes. This means that one logical qubit is encoded into many physical qubits. This redundancy allows to correct for a certain amount of errors on the physical qubits, such that the information stored in the logical qubit remains intact. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9605011&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bigger codes allow for longer calculations to still be accurate&lt;/a&gt;. However, larger codes involve more gates (for example more syndrome measurements) and these gates introduce noise. You see there is some trade-off here, and which code is optimal is not obvious.&lt;br&gt;&#xA;If the noise introduced by each gate is below some threshold (the fault-tolerance or accuracy threshold), then it is possible to increase the code size to allow for arbitrarily long calculations. This threshold depends on the code we started with (usually it is iteratively concatenated with itself). There are several ways to estimate this value. Often it is done by numerical simulation: Introduce random errors and check whether the calculation still worked. This method typically gives threshold values which are too high. There are also some analytical proofs in the literature, for example &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0610063&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one by Aliferis and Cross&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2018-03-28T23:25:23.883" LastActivityDate="2018-03-28T23:25:23.883" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1359" PostTypeId="1" AcceptedAnswerId="1361" CreationDate="2018-03-27T20:34:12.867" Score="27" ViewCount="1460" Body="&lt;p&gt;The standard popular-news account of quantum computing is that a quantum computer (QC) would work by splitting into exponentially many noninteracting parallel copies of itself in different universes and having each one attempt to verify a different certificate, then at the end of the calculation, the single copy that found a valid certificate &quot;announces&quot; its solution and the other branches magically vanish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;People who know anything about theoretical quantum computation know that this story is absolute nonsense, and that the rough idea described above more closely corresponds to a &lt;a href=&quot;https://en.wikipedia.org/wiki/Non-deterministic_Turing_machine&quot; rel=&quot;noreferrer&quot;&gt;nondeterministic Turing machine&lt;/a&gt; (NTM) than to a quantum computer. Moreover, the compexity class of problems efficiently solvable by NTMs is &lt;strong&gt;NP&lt;/strong&gt; and by QCs is &lt;strong&gt;BQP&lt;/strong&gt;, and these classes are not believed to be equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;People trying to correct the popular presentation rightfully point out that the simplistic &quot;many-worlds&quot; narrative greatly overstates the power of QCs, which are not believed to be able to solve (say) &lt;strong&gt;NP&lt;/strong&gt;-complete problems. They focus on the misrepresentation of the measurement process: in quantum mechanics, which outcome you measure is determined by the Born rule, and in most situations the probability of measuring an incorrect answer completely swamps the probability of measuring the right one. (And in some cases, such as black-box search, we can &lt;em&gt;prove&lt;/em&gt; that no clever quantum circuit can beat the Born rule and deliver an exponential speedup.) If we &lt;em&gt;could&lt;/em&gt; magically &quot;decide what to measure&quot;, then we would be able to efficiently solve all problems in the complexity class &lt;strong&gt;PostBQP&lt;/strong&gt;, which is believed to be much large than &lt;strong&gt;BQP&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I've never seen anyone explicitly point out that there is &lt;em&gt;another&lt;/em&gt; way in which the popular characterization is wrong, which goes in the other direction. &lt;strong&gt;BQP&lt;/strong&gt; is believed to be not a strict subset of &lt;strong&gt;NP&lt;/strong&gt;, but instead incomparable to it. There exist problems like &lt;a href=&quot;https://www.scottaaronson.com/papers/bqpph.pdf&quot; rel=&quot;noreferrer&quot;&gt;Fourier checking&lt;/a&gt; which are believed to not only lie outside of &lt;strong&gt;NP&lt;/strong&gt;, but in fact outside of the entire polynomial hierarchy &lt;strong&gt;PH&lt;/strong&gt;. So with respect to problems like these, the popular narrative actually &lt;em&gt;under&lt;/em&gt;states rather than overstates the power of QCs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My naive intuition is that if we &lt;em&gt;could&lt;/em&gt; &quot;choose what to measure&quot;, then the popular narrative would be more or less correct, which would imply that these super-quantum-computers would be able to efficiently solve exactly the class &lt;strong&gt;NP&lt;/strong&gt;. But we believe that this is wrong; in fact &lt;a href=&quot;https://www.scottaaronson.com/papers/pp.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;PostBQP=PP&lt;/strong&gt;&lt;/a&gt;, which we believe to be a strict superset of &lt;strong&gt;NP&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any intuition for what's going on behind the scenes that allows a quantum computer to be (in some respects) more powerful than a nondeterministic Turing machine? Presumably this &quot;inherently quantum&quot; power, when combined with postselection (which &lt;a href=&quot;https://en.wikipedia.org/wiki/Non-deterministic_Turing_machine#Resolution_of_multiple_rules&quot; rel=&quot;noreferrer&quot;&gt;in a sense&lt;/a&gt; NTMs already have) is what makes a super-QC so much more powerful than a NTM. (Note that I'm looking for some intuition that directly contrasts NTMs and QCs with postselection, without &quot;passing through&quot; the classical complexity class &lt;strong&gt;PP&lt;/strong&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="1847" LastEditDate="2018-04-27T16:51:08.520" LastActivityDate="2018-04-27T16:51:08.520" Title="Why is a quantum computer in some ways more powerful than a nondeterministic Turing machine?" Tags="&lt;speedup&gt;&lt;complexity-theory&gt;&lt;bqp&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1360" PostTypeId="1" AcceptedAnswerId="1382" CreationDate="2018-03-27T21:49:18.280" Score="4" ViewCount="99" Body="&lt;p&gt;There are different theoretical models for quantum computing like the circuit model or the model of adiabatic quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Between which of these models exist polynomial-time reductions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this question does not aim to cover physical implementations of quantum computers which are already discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1255/how-should-different-quantum-computing-devices-be-compared&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="673" LastEditorUserId="104" LastEditDate="2018-03-28T12:25:17.290" LastActivityDate="2018-03-28T12:25:17.290" Title="Which theoretical models for quantum computing are polynomial-time equivalent?" Tags="&lt;models&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2018-04-02T08:55:43.670" ContentLicense="CC BY-SA 3.0" />
  <row Id="1361" PostTypeId="2" ParentId="1359" CreationDate="2018-03-27T21:51:55.380" Score="16" Body="&lt;p&gt;From a pseudo-foundational standpoint, the reason why &lt;strong&gt;BQP&lt;/strong&gt; is a &lt;em&gt;differently powerful&lt;/em&gt; (to coin a phrase) class than &lt;strong&gt;NP&lt;/strong&gt;, is that quantum computers can be considered as making use of destructive interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many different complexity classes can be described in terms of (more or less complicated properties of) the number of accepting branches of an NTM. Given an NTM in 'normal form', meaning that the set of computational branches are a complete binary tree  (or something similar to it) of some polynomial depth, we may consider classes of languages defined by making the following distinctions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is the number of accepting branches zero, or non-zero? (A characterisation of &lt;strong&gt;NP&lt;/strong&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;Is the number of accepting branches less than the maximum, or exactly equal to the maximum? (A characterisation of &lt;strong&gt;coNP&lt;/strong&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;Is the number of accepting branches at most one-third, or at least two-thirds, of the total? (A characterisation of &lt;strong&gt;BPP&lt;/strong&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;Is the number of accepting branches less than one-half, or at least one-half, of the total? (A characterisation of &lt;strong&gt;PP&lt;/strong&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;Is the number of accepting branches different from exactly half, or equal to exactly half, of the total? (A characterisation of a class called &lt;strong&gt;C&lt;sub&gt;=&lt;/sub&gt;P&lt;/strong&gt;.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are called &lt;em&gt;counting classes&lt;/em&gt;, because in effect they are defined in terms of the count of accepting branches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpreting the branches of an NTM as randomly generated, they are questions about the probability of acceptance (even if these properties are not efficiently testable with any statistical confidence). A different approach to describing complexity classes is to consider instead the &lt;em&gt;gap&lt;/em&gt; between the number of accepting branches and the number of rejecting branches of an NTM. If counting the cumulation of NTM computational branches corresponds to probabilities, one could suggest that canceling accepting branches against rejecting branches models the cancellation of computational 'paths' (as in sum-over-paths) in quantum computation &amp;mdash; that is, as modeling destructive interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best known upper bounds for &lt;strong&gt;BQP&lt;/strong&gt;, namely &lt;strong&gt;AWPP&lt;/strong&gt; and &lt;strong&gt;PP&lt;/strong&gt;, are readily definable in terms of 'acceptance gaps' in this way. The class &lt;strong&gt;NP&lt;/strong&gt;, however, does not have such an obvious characterisation. Furthermore, many of the classes which one obtains from definitions in terms of acceptance gaps appear to be more powerful than &lt;strong&gt;NP&lt;/strong&gt;. One could take this to indicate that 'nondeterministic destructive interference' is a potentially more powerful computational resource than mere nondeterminism; so that even if quantum computers do not take full advantage of this computational resource, it may nevertheless resist easy containment in classes such as &lt;strong&gt;NP&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-03-27T21:51:55.380" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1363" PostTypeId="2" ParentId="1359" CreationDate="2018-03-28T05:45:33.183" Score="-1" Body="&lt;p&gt;&lt;em&gt;This answer was 'migrated' from when this question was asked on &lt;a href=&quot;https://cs.stackexchange.com&quot;&gt;Computer Science&lt;/a&gt; (Author remains the same)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Well, one main reason is that there aren't any quantum algorithms that solve NP-hard problems in polynomial time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another is that adiabetic quantum annealing (as in the Dwave) can only barely beat the classical quantum annealing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, most researchers think P$\neq$NP. A lot believe P$=$BQP. However, P$\neq$PostBQP. Is PostBQP$\neq$NP now contradictionay? No. We only know that P$=$NP is a weaker statement than (not nessecarily implying more!) PostBQP$=$P! So, why all the fuss about a question harder than P vs. NP!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for why to believe P$=$BQP, some believe any improvement will not be asymptotic or merely a constant, as in differing implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, there are some reasons to believe PostBQP$\neq$NP. But this is all speculation and likely remains speculation for a while. You can believe whatever you want, for now, at least.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There exist problems like Fourier checking which are believed to not only lie outside of NP, but in fact outside of the entire polynomial hierarchy. So with respect to problems like these, the popular narrative actually understates rather than overstates the power of QCs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As for this, I haven't seen a result that states a quantum computer can solve this &lt;em&gt;efficiently&lt;/em&gt;! Also, that the machine can solve weird problems fast (simulating itself in $O(n)$, for example) isn't more surprising that a waterfall simulating itself in $O(n)$ (n being the number of simulation steps)&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-03-28T05:45:33.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1364" PostTypeId="1" CreationDate="2018-03-28T05:59:41.467" Score="5" ViewCount="97" Body="&lt;p&gt;The main reason to start with Post Quantum Crypto (PQC) &lt;em&gt;right now&lt;/em&gt; is because creating strong crypto, good implementation and accepted standards takes very long. Right now, most PQC is in the 'crypto' stage or starting to enter 'implementation' stage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering whether, given recent advances in constructing quantum computers, the PQC initiative will be 'fast enough'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, I'd like to know if PQC resistant against breaking factoring is widely deployed in practice before...:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Government agencies can efficiently factor using Shor's algorithm&lt;/li&gt;&#xA;&lt;li&gt;Serious hackers and medium sized companies can factor using Shor.&lt;/li&gt;&#xA;&lt;li&gt;Script kiddies can run Shor's algorithm&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To clarify, I am looking for literature or analyses based on history about deployment speed of cryptographical defenses and compare this with current analysis on the predicted power of quantum computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, when will a good lattice based cryptosystem have a 'mainstream' implementation? &lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-03-28T09:41:58.860" LastActivityDate="2018-03-28T09:41:58.860" Title="Will post quantum crypto come soon enough?" Tags="&lt;cryptography&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2018-03-28T08:49:08.427" ContentLicense="CC BY-SA 3.0" />
  <row Id="1365" PostTypeId="1" AcceptedAnswerId="1373" CreationDate="2018-03-28T06:05:23.490" Score="22" ViewCount="18902" Body="&lt;p&gt;As per my limited understanding, a &lt;em&gt;pure&lt;/em&gt; state is the quantum state where we have &lt;strong&gt;exact information&lt;/strong&gt; about the quantum system. And the &lt;em&gt;mixed&lt;/em&gt; state is the &lt;strong&gt;combination of probabilities of the information&lt;/strong&gt; about the quantum state of the quantum system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is mentioned that different distributions of &lt;em&gt;pure&lt;/em&gt; states can generate equivalent &lt;em&gt;mixed&lt;/em&gt; states. So how a &lt;strong&gt;combination of exact information&lt;/strong&gt; can result in the &lt;strong&gt;combination of probabilities&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="769" LastEditorUserId="26" LastEditDate="2018-03-29T18:07:33.753" LastActivityDate="2021-01-14T05:29:03.900" Title="What's the difference between a pure and mixed quantum state?" Tags="&lt;quantum-state&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="11" ContentLicense="CC BY-SA 3.0" />
  <row Id="1366" PostTypeId="1" AcceptedAnswerId="1370" CreationDate="2018-03-28T06:19:29.607" Score="11" ViewCount="1634" Body="&lt;p&gt;We have been reading about quantum computers being developed and tested in labs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also, we have quantum simulator programs that use limited virtual qubits (&lt;em&gt;up to 30-40 qubits if cloud-based&lt;/em&gt;).&#xA;And we have also started learning new quantum computing languages like &lt;strong&gt;Q#&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But do we really have actual commercial quantum computers ready with physical qubits?&lt;/p&gt;&#xA;" OwnerUserId="769" LastEditorUserId="2687" LastEditDate="2019-03-13T14:09:14.263" LastActivityDate="2019-03-13T14:09:14.263" Title="Do real commercial quantum computers exist?" Tags="&lt;physical-realization&gt;&lt;simulation&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1367" PostTypeId="1" AcceptedAnswerId="1372" CreationDate="2018-03-28T06:32:28.333" Score="48" ViewCount="2233" Body="&lt;p&gt;I come from a non-physics background and I am very much interested in pursuing Quantum Computing - especially how to program them. Any guidance on how to get started will be very helpful.&lt;/p&gt;&#xA;" OwnerUserId="769" LastEditorUserId="26" LastEditDate="2018-12-13T19:39:44.847" LastActivityDate="2019-10-29T11:22:13.923" Title="Programming quantum computers for non-physics majors" Tags="&lt;resource-request&gt;&lt;programming&gt;" AnswerCount="6" CommentCount="3" FavoriteCount="23" ContentLicense="CC BY-SA 3.0" />
  <row Id="1368" PostTypeId="2" ParentId="1366" CreationDate="2018-03-28T06:33:19.677" Score="4" Body="&lt;p&gt;Ready for useful large scale applications? No.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However there do exist machines such as IBM's Quantum Experience with real physical qubits on a chip as well as Google announcing this month a new machine with 72 qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave likes to tag itself as the first commercially available quantum computer however determining if it is indeed quantum seems to have been left as an exercise to the user. The D-Wave is available for commercial applications for a hefty price if you'd like to purchase a machine.&lt;/p&gt;&#xA;" OwnerUserId="54" LastActivityDate="2018-03-28T06:33:19.677" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1369" PostTypeId="2" ParentId="1366" CreationDate="2018-03-28T06:33:36.743" Score="1" Body="&lt;p&gt;From an &lt;a href=&quot;https://techcrunch.com/2017/11/10/ibm-passes-major-milestone-with-20-and-50-qubit-quantum-computers-as-a-service/&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; I read a while ago, it seems like IBM has a 20-qbit quantum computing as a service (QCAAS as I'd like to call it).&lt;/p&gt;&#xA;&lt;p&gt;They officially call it IBM Q: &lt;a href=&quot;https://www.research.ibm.com/ibm-q/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.research.ibm.com/ibm-q/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's an excerpt from the linked article (Nov 10, 2017):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;IBM makes 20 qubit quantum computing machine available as a cloud service&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;IBM has been offering quantum computing as a cloud service&#xA;since last year when it came out with a 5 qubit version of the&#xA;advanced computers.&lt;/p&gt;&#xA;&lt;p&gt;Today, the company announced that it’s releasing&#xA;20-qubit quantum computers, quite a leap in just 18 months.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="780" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-03-29T01:50:12.767" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1370" PostTypeId="2" ParentId="1366" CreationDate="2018-03-28T06:34:10.983" Score="10" Body="&lt;p&gt;That depends on your definitions of &quot;commercial&quot; and of &quot;quantum computer&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The company &lt;a href=&quot;https://www.dwavesys.com/home&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave Systems&lt;/a&gt; has been offering what they call quantum computers commercially since 2011. Many things seem to point towards those being adiabatic quantum computers (though people disagree on this). That doesn't quite fit the kind of quantum computers that are becoming popular right now though. You can check &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/171/is-there-proof-that-the-d-wave-one-is-a-quantum-computer-and-is-effective&quot;&gt;this question&lt;/a&gt; and its answers for more information on that discussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Companies such as IBM in the other hand are offering access to circuit model quantum computers (with physical qubits). IBM specifically does this in the &lt;a href=&quot;https://www.research.ibm.com/ibm-q/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q&lt;/a&gt; project via their website and a &lt;a href=&quot;https://github.com/QISKit/qiskit-sdk-py&quot; rel=&quot;nofollow noreferrer&quot;&gt;programming interface&lt;/a&gt;. They cooperate with commercial companies to explore possibilities in the quantum computing field. (A similar offer is available from Rigetti Computing via their &lt;a href=&quot;https://rigetti.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rigetti Forrest&lt;/a&gt; project.) That's not what most people would call &quot;commercial quantum computers&quot; though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the answer truly is: It depends.&lt;/p&gt;&#xA;" OwnerUserId="138" LastEditorUserId="138" LastEditDate="2018-07-05T09:04:26.997" LastActivityDate="2018-07-05T09:04:26.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1372" PostTypeId="2" ParentId="1367" CreationDate="2018-03-28T06:49:06.140" Score="24" Body="&lt;p&gt;You could start with an introduction to quantum computers such as &lt;a href=&quot;https://youtu.be/Y8cU5-55wvc&quot; rel=&quot;noreferrer&quot;&gt;this one from Voxxed Days Vienna 2018&lt;/a&gt; - it's intended for people with a programming background but little to no prior knowledge in quantum mechanics. After that you can check out the guides in the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/experience&quot; rel=&quot;noreferrer&quot;&gt;IBM Quantum Experience&lt;/a&gt; or those for the &lt;a href=&quot;https://www.microsoft.com/en-us/quantum/development-kit&quot; rel=&quot;noreferrer&quot;&gt;Microsoft Quantum Development Kit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to that, there are loads of videos on YouTube, for example, that can help you understand the topic more deeply.&lt;/p&gt;&#xA;" OwnerUserId="138" LastActivityDate="2018-03-28T06:49:06.140" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1373" PostTypeId="2" ParentId="1365" CreationDate="2018-03-28T06:58:41.283" Score="16" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;A pure state is the quantum state where we have exact information about the quantum system. And the mixed state is the combination of probabilities of the information about the quantum state ... different distributions of pure states can generate equivalent mixed states. I did not understand how a combination of exact information can result in the combination of probabilities.&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On a Bloch sphere, pure states are represented by a point on the surface of the sphere, whereas mixed states are represented by an interior point. The completely mixed state of a single qubit ${{\frac {1}{2}}I_{2}\,}$ is represented by the center of the sphere, by symmetry. The purity of a state can be visualized as the degree in which it is close to the surface of the sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum mechanics, the state of a quantum system is represented by a state vector (or ket) $| \psi \rangle$. A quantum system with a state vector $| \psi \rangle$ is called a pure state. However, it is also possible for a system to be in a statistical ensemble of different state vectors: For example, there may be a 50% probability that the state vector is $| \psi_1 \rangle$ and a 50% chance that the state vector is $| \psi_2 \rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This system would be in a mixed state. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;noreferrer&quot;&gt;density matrix&lt;/a&gt; is especially useful for mixed states, because any state, pure or mixed, can be characterized by a single density matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix#Mathematical_description&quot; rel=&quot;noreferrer&quot;&gt;Mathematical description&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state vector $|\psi \rangle$ of a pure state completely determines the statistical behavior of a measurement. For concreteness, take an observable quantity, and let A be the associated observable operator that has a representation on the Hilbert space ${\mathcal {H}}$ of the quantum system. For any real-valued, analytical function $F$ defined on the real numbers, suppose that $F(A)$ is the result of applying $F$ to the outcome of a measurement. The expectation value of $F(A)$ is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\langle \psi | F(A) | \psi \rangle\, .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a mixed state prepared by statistically combining two different pure states $| \psi \rangle$ and $| \phi\rangle$, with the associated probabilities $p$ and $1 − p$, respectively. The associated probabilities mean that the preparation process for the quantum system ends in the state $|\psi \rangle$ with probability $p$ and in the state $|\phi\rangle$ with probability $1 − p$.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="26" LastEditDate="2018-03-28T10:17:30.493" LastActivityDate="2018-03-28T10:17:30.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1374" PostTypeId="1" AcceptedAnswerId="1381" CreationDate="2018-03-28T07:30:39.697" Score="10" ViewCount="610" Body="&lt;p&gt;I've stumbled myself upon &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_decoherence&quot; rel=&quot;noreferrer&quot;&gt;this article&lt;/a&gt; on Wikipedia, which says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Decoherence can be viewed as the &lt;strong&gt;loss of information from a system into the environment&lt;/strong&gt; (often modeled as a heat bath), since every system is loosely coupled with the energetic state of its surroundings.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&amp;lt;...&amp;gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Decoherence represents a challenge for the practical realization of quantum computers, since such machines are expected to rely heavily on the undisturbed evolution of quantum coherences. Simply put, they require that coherent states be preserved and that &lt;strong&gt;decoherence is managed&lt;/strong&gt;, in order to actually perform quantum computation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;em&gt;(emphasis mine)&lt;/em&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;p&gt;So I am wondering how can this &lt;code&gt;loss of information&lt;/code&gt; be managed? Does this mean that it should be prevented completely, or is it necessary for quantum computing to actually allow some information loss in order to compute?&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-17T22:29:18.980" Title="How can quantum decoherence be managed?" Tags="&lt;quantum-information&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1375" PostTypeId="2" ParentId="1367" CreationDate="2018-03-28T07:33:46.463" Score="17" Body="&lt;p&gt;I think that quantum programmers won’t necessarily need to know about quantum physics and linear algebra. These are certainly things that will help broaden a quantum programmers knowledge, but they should not be regarded as prerequisites.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even so, most resources to help a budding quantum programmer start with an assumption of linear algebra. The ones that don’t mostly focus on QISKit, the SDK for IBM’s quantum device (and some of them were written by me).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest program you can come up with is a “Hello World”. How do you do that for quantum computers? My proposal is a &lt;a href=&quot;https://medium.com/qiskitters/making-a-quantum-computer-smile-cee86a6fc1de&quot; rel=&quot;noreferrer&quot;&gt;superposition of emoticons&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you’ve moved beyond “Hello World” in quantum programming, you’ll want to do something more complex. Often people make simple games. So let’s do that with a quantum computer. I made &lt;a href=&quot;https://medium.com/qiskitters/how-to-program-a-quantum-computer-982a9329ed02&quot; rel=&quot;noreferrer&quot;&gt;Battleships&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will find these and many more examples of quantum programming at the &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial&quot; rel=&quot;noreferrer&quot;&gt;QISKit tutorial&lt;/a&gt;. I think that is probably the best place for new quantum programmers to see what can be done, and how to do it.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-28T09:36:03.610" LastActivityDate="2018-03-28T09:36:03.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1376" PostTypeId="1" CreationDate="2018-03-28T08:15:48.983" Score="7" ViewCount="366" Body="&lt;p&gt;Reading &lt;a href=&quot;https://hackernoon.com/how-i-cornered-the-bitcoin-mining-market-using-a-quantum-computer-9e5dceba9f92&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; entertaining piece of a QC enthusiast mining bitcoins with a Quantum Computer (although efficiently mining bitcoins with the current state of QCs is far-fetched, it is quite possible to be done in the next few years), I wonder how exactly will technologies already using Blockchain adapt to the change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they currently being worked upon? &lt;strong&gt;How would post-quantum cryptography integrate with existing tech secured using today's cryptography algorithms?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="747" LastEditorUserId="26" LastEditDate="2018-03-28T09:39:02.270" LastActivityDate="2018-03-28T15:35:52.467" Title="How would Blockchain technologies change to survive a post-quantum world?" Tags="&lt;cryptography&gt;&lt;cryptocurrency&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ClosedDate="2018-03-28T15:31:39.580" ContentLicense="CC BY-SA 3.0" />
  <row Id="1377" PostTypeId="2" ParentId="1374" CreationDate="2018-03-28T08:19:01.273" Score="0" Body="&lt;p&gt;Yes, currently the loss of information is being managed by means of &lt;em&gt;quantum error correction&lt;/em&gt; protocols. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally, &lt;em&gt;quantum decoherence&lt;/em&gt; and eventual loss of information &lt;em&gt;should be prevented&lt;/em&gt;. However, in real-world scenarios, it is hard to completely isolate quantum systems from their environment.&lt;/p&gt;&#xA;" OwnerUserId="812" LastEditorUserId="26" LastEditDate="2019-05-17T22:29:18.980" LastActivityDate="2019-05-17T22:29:18.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1379" PostTypeId="2" ParentId="1365" CreationDate="2018-03-28T10:11:26.650" Score="4" Body="&lt;p&gt;&lt;strong&gt;Pure state:&lt;/strong&gt; Systems whose state is unequivocally defined by A state vector in other words, &lt;em&gt;single state vector&lt;/em&gt;. &lt;s&gt;And this has the complete information about the system.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Mixed state:&lt;/strong&gt; System whose state cannot be defined unequivocally by &lt;em&gt;single state vector&lt;/em&gt;. It only has limited or no knowledge about the state of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality, we often deal with ensemble of systems and we repeat the experiment. In such, cases it might be difficult to prepare the system exactly the same way to any particular initial state. Under such scenario, mixed state come in handy.  &lt;/p&gt;&#xA;" OwnerUserId="812" LastEditorUserId="812" LastEditDate="2018-03-28T16:33:05.323" LastActivityDate="2018-03-28T16:33:05.323" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1380" PostTypeId="2" ParentId="1366" CreationDate="2018-03-28T10:46:11.190" Score="0" Body="&lt;p&gt;Commercially, no. But it is something that companies such as Intel have been working on. In-fact, Intel recently announced its new &lt;a href=&quot;https://www.youtube.com/watch?v=nE819PPCA5o&quot; rel=&quot;nofollow noreferrer&quot;&gt;49-qubit quantum chip &amp;amp; neuromorphic chip&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="872" LastActivityDate="2018-03-28T10:46:11.190" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1381" PostTypeId="2" ParentId="1374" CreationDate="2018-03-28T11:19:22.200" Score="6" Body="&lt;p&gt;The quantum circuit model describes a quantum computer as a closed quantum system and assumes that there is a system which executes the circuit but is completely isolated from the rest of the universe. In the real world, however, there are no known mechanisms for truly isolating a quantum system from its environment. Real quantum systems are open quantum systems. Open quantum systems couple to their environment and destroy the quantum information in the system through &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_decoherence&quot; rel=&quot;noreferrer&quot;&gt;decoherence&lt;/a&gt;. When examining the simple evolution of a single quantum system this system-environment coupling appears to cause errors on the quantum system’s evolution (which wouldn't be &lt;em&gt;unitary&lt;/em&gt; in this case). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A coin has two states, and makes a good bit but a poor qubit because it cannot remain in superposition of &lt;code&gt;head&lt;/code&gt; and &lt;code&gt;tail&lt;/code&gt; for very long as it is a classical object. A single nuclear spin can be a very good qubit, because superposition of being aligned with or against an external magnetic field can last for a long time, even days. But it can be difficult to build a quantum computer from nuclear spins because their coupling is so small that it is hard to measure the orientation of a single nuclei. The observation that the constraints are opposing in general: a quantum computer has to be well isolated in order to retain its quantum properties, but at the same time its qubits have to be accessible so that they can be manipulated to perform computation and read out the results. A realistic implementation must strike a balance between these constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step towards solving the decoherence problem was taken in 1995 when&#xA;Shor and Steane independently discovered a quantum analogue of classical&#xA;error correcting codes. Shor discovered that by encoding quantum information,&#xA;this information could become more resistant to interaction with its environment. Following this discovery a rigorous theory of quantum error correction was developed. Many different &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;noreferrer&quot;&gt;quantum error correcting codes&lt;/a&gt; were discovered and this further led to a theory of fault-tolerant quantum computation. Fully fault-tolerant quantum computation describes methods for dealing with system-environment coupling as well as dealing with faulty control of the quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of particular significance was the discovery of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;noreferrer&quot;&gt;threshold theorem&lt;/a&gt; for fault-tolerant quantum computation. The threshold theorem states that if the decoherence interactions are of a certain form and are weaker than the controlling interactions by a certain ratio, quantum computation to any desired precision can be achieved. The threshold theorem for fault-tolerance thus declares a final solution to the question of whether there are theoretical limits to the construction of robust quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0305025&quot; rel=&quot;noreferrer&quot;&gt;Decoherence, Control, and Symmetry in Quantum Computers - D. Bacon&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-28T11:19:22.200" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1382" PostTypeId="2" ParentId="1360" CreationDate="2018-03-28T11:36:25.067" Score="3" Body="&lt;p&gt;A non-exhaustive list of theoretical models of quantum computation are provided as answers to another question: &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/74/what-are-the-methods-of-quantum-computation&quot;&gt;What are the methods of quantum computation?&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to which models are polynomial-time equivalent &amp;mdash; the following is an incomplete list of models which are provably universal for polynomial-time quantum computation, assuming perfect control:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The unitary circuit model is polynomial-time equivalent to adiabatic quantum computation [&lt;a href=&quot;http://arXiv.org/abs/quant-ph/0405098&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0405098&lt;/a&gt;];&lt;/li&gt;&#xA;&lt;li&gt;The unitary circuit model is polynomial-time equivalent to quantum circuits with intermediate measurements (by the principle of deferred measurement);&lt;/li&gt;&#xA;&lt;li&gt;The one-way measurement-based model is polynomial-time equivalent to unitary circuits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-03-28T11:36:25.067" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1383" PostTypeId="1" AcceptedAnswerId="1406" CreationDate="2018-03-28T11:49:43.077" Score="21" ViewCount="3242" Body="&lt;p&gt;One of the common claims about quantum computers is their ability to &quot;break&quot; conventional cryptography. This is because conventional cryptography is based on prime factors, something which is computationally expensive for conventional computers to calculate, but which is a supposedly trivial problem for a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What property of quantum computers makes them so capable of this task&lt;/strong&gt; where conventional computers fail and &lt;strong&gt;how are qubits applied to the problem of calculating prime factors?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="842" LastEditorUserId="26" LastEditDate="2018-12-23T12:12:13.657" LastActivityDate="2018-12-23T12:12:13.657" Title="What makes quantum computers so good at computing prime factors?" Tags="&lt;speedup&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1385" PostTypeId="1" AcceptedAnswerId="1386" CreationDate="2018-03-28T12:22:51.887" Score="30" ViewCount="7633" Body="&lt;p&gt;This &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=208&quot; rel=&quot;noreferrer&quot;&gt;blogpost by Scott Aaronson&lt;/a&gt; is a very useful and simple explanation of &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering if there is such an explanation for the second most famous quantum algorithm: &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt; to search an &lt;em&gt;unordered&lt;/em&gt; database of size $O(n)$ in $O(\sqrt{n})$ time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, I'd like to see some understandable intuition for the initially surprising result of the running time!&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="609" LastEditDate="2018-03-28T13:05:05.933" LastActivityDate="2020-09-30T16:44:49.417" Title="Is there a layman's explanation for why Grover's algorithm works?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;grovers-algorithm&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="1386" PostTypeId="2" ParentId="1385" CreationDate="2018-03-28T13:22:25.650" Score="26" Body="&lt;p&gt;There is a good explanation by Craig Gidney &lt;a href=&quot;http://twistedoakstudios.com/blog/Post2644_grovers-quantum-search-algorithm&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; (he also has other great content, including a circuit simulator, on &lt;a href=&quot;http://algassert.com/&quot; rel=&quot;noreferrer&quot;&gt;his blog&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, Grover's algorithm applies when you have a function which returns &lt;code&gt;True&lt;/code&gt; for one of its possible inputs, and &lt;code&gt;False&lt;/code&gt; for all the others. The job of the algorithm is to find the one that returns &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this we express the inputs as bit strings, and encode these using the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states of a string of qubits. So the bit string &lt;code&gt;0011&lt;/code&gt; would be encoded in the four qubit state &lt;span class=&quot;math-container&quot;&gt;$|0011\rangle$&lt;/span&gt;, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also need to be able to implement the function using quantum gates. Specifically, we need to find a sequence of gates that will implement a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U | a \rangle = - | a \rangle, \,\,\,\,\,\,\,\,\,\,\,\,\, U | b \rangle = | b \rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the bit string for which the function would return &lt;code&gt;True&lt;/code&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is any for which it would return &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we start with a superposition of all possible bit strings, which is pretty easy to do by just Hadamarding everything, all inputs start off with the same amplitude of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the length of the bit strings we are searching over, and therefore the number of qubits we are using). But if we then apply the oracle &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, the amplitude of the state we are looking for will change to &lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{\sqrt{2^n}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not any easily observable difference, so we need to amplify it. To do this we use the &lt;em&gt;Grover Diffusion Operator&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;. The effect of this operator is essentially to look at how each amplitude is different from the mean amplitude, and then invert this difference. So if a certain amplitude was a certain amount larger than the mean amplitude, it will become that same amount less than the mean, and vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, if you have a superposition of bit strings &lt;span class=&quot;math-container&quot;&gt;$b_j$&lt;/span&gt;, the diffusion operator has the effect&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$D: \,\,\,\, \sum_j \alpha_j \, | b_j \rangle \,\,\,\,\,\, \mapsto \,\,\,\,\,\, \sum_j (2\mu \, - \,  \alpha_j) \, | b_j \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mu = \sum_j \alpha_j$&lt;/span&gt; is the mean amplitude. So any amplitude &lt;span class=&quot;math-container&quot;&gt;$\mu + \delta$&lt;/span&gt; gets turned into &lt;span class=&quot;math-container&quot;&gt;$\mu - \delta$&lt;/span&gt;. To see why it has this effect, and how to implement it, see &lt;a href=&quot;https://people.eecs.berkeley.edu/~vazirani/f04quantum/notes/lec10/lec11.pdf&quot; rel=&quot;noreferrer&quot;&gt;these lecture notes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the amplitudes will be a tiny bit larger than the mean (due to the effect of the single &lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{\sqrt{2^n}}$&lt;/span&gt;), so they will become a tiny bit less than the mean through this operation. Not a big change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state we are looking for will be affected more strongly. Its amplitude is a lot less than the mean, and so will become a lot greater the mean after the diffusion operator is applied. The end effect of the diffusion operator is therefore to cause an interference effect on the states which skims an amplitude of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}$&lt;/span&gt; from all the wrong answers and adds it to the right one. By repeating this process, we can quickly get to the point where our solution stands out from the crowd so much that we can identify it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this all goes to show that all the work is done by the diffusion operator. Searching is just an application that we can connect to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See the answers to other questions for details on how the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/175/how-is-the-oracle-in-grovers-search-algorithm-implemented&quot;&gt;functions&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1613/how-does-the-grover-diffusion-operator-work-and-why-is-it-optimal&quot;&gt;diffusion operator&lt;/a&gt; are implemented.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="8158" LastEditDate="2019-08-01T16:59:36.387" LastActivityDate="2019-08-01T16:59:36.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1387" PostTypeId="2" ParentId="1367" CreationDate="2018-03-28T14:19:27.073" Score="6" Body="&lt;p&gt;It's not necessary to fully understand Quantum Mechanics to understand the theory behind QC. I'm a math BSc/programmer and I read about the topic and also did the &lt;a href=&quot;https://www.edx.org/course/quantum-mechanics-quantum-computation-uc-berkeleyx-cs-191x&quot; rel=&quot;nofollow noreferrer&quot;&gt;old edX QC course&lt;/a&gt; (unfortunately it's not available, but there are others). I think I can say that I understand the gist of QC, but I know next to nothing about Quantum Mechanics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key part is that Quantum Computing uses mostly linear algebra, which is based on math that is commonly taught at engineering/computer science undergraduate studies. Contrast this to &lt;em&gt;real&lt;/em&gt; Quantum Mechanics that uses infinite-dimensional spaces (or functional analysis, if you'd like). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you feel comfortable with these undergraduate math topics you can check out Susskind's &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0465062903&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Mechanics: Theoretical Minimum&lt;/a&gt; - it isn't actually about 'real' quantum mechanics, it's mostly stuff that is useful for QC. BTW the whole Theoretical Minimum book series is aimed at people who know some math (like computer scientists, or engineering majors), and would like to know more about physics. There are also lots of courses online, for example, there are new courses on edX, but I didn't do any of them, so I can't recommend one.&lt;/p&gt;&#xA;" OwnerUserId="949" LastEditorUserId="26" LastEditDate="2019-10-15T04:33:36.177" LastActivityDate="2019-10-15T04:33:36.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1388" PostTypeId="2" ParentId="135" CreationDate="2018-03-28T14:31:35.300" Score="6" Body="&lt;p&gt;The complexity class of decision problems efficiently solvable on a classical computer is called &lt;strong&gt;BPP&lt;/strong&gt; (or &lt;strong&gt;P&lt;/strong&gt;, if you don't allow randomness, but these are suspected to be equal anyway). The class of problems efficiently solvable on a quantum computer is called &lt;strong&gt;BQP&lt;/strong&gt;. If a problem exists for which a quantum computer provides an exponential speedup, then this would imply that &lt;strong&gt;BPP&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt; &lt;strong&gt;BQP&lt;/strong&gt;. However, the &lt;strong&gt;BQP&lt;/strong&gt; versus &lt;strong&gt;BPP&lt;/strong&gt; question is a major open question in theoretical computer science, so no such problem has been proven to exist (and if you find one, you'll definitely win all kinds of awards).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, as the other answer mentions, there are black-box (&quot;oracle&quot;) problems relative to which we know that &lt;span class=&quot;math-container&quot;&gt;$\textbf{BPP}^O \neq \textbf{BQP}^O$&lt;/span&gt;, like &lt;a href=&quot;https://en.wikipedia.org/wiki/Simon&amp;#39;s_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon's algorithm&lt;/a&gt;. This provides evidence, though not a proof, that &lt;strong&gt;BPP&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt; &lt;strong&gt;BQP&lt;/strong&gt; in the real world.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2018-12-24T22:51:48.427" LastActivityDate="2018-12-24T22:51:48.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1389" PostTypeId="2" ParentId="3" CreationDate="2018-03-28T14:40:16.780" Score="5" Body="&lt;p&gt;To follow up on Ella Rose's answer: most practical encryption schemes used today (e.g. Diffie-Hellman, RSA, elliptic curve, lattice-based) are centered around the difficulty of solving the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hidden_subgroup_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;hidden subgroup problem&lt;/a&gt; (HSP). However, the first three are centered around the HSP for &lt;em&gt;abelian&lt;/em&gt; groups. The HSP for abelian groups can be efficiently solved by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum Fourier transform&lt;/a&gt;, which is implemented e.g. by Shor's algorithm. They are therefore vulnerable to attack by a quantum computer. Most lattice-based methods, on the other hand, revolve around the HSP for &lt;em&gt;dihedral&lt;/em&gt; groups, which are nonabelian. Quantum computers are not believed to be able to efficiently solve the nonabelian HSP, so these algorithms should be able to implement post-quantum cryptography.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2018-03-28T22:10:07.490" LastActivityDate="2018-03-28T22:10:07.490" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1390" PostTypeId="1" AcceptedAnswerId="1395" CreationDate="2018-03-28T14:50:42.507" Score="11" ViewCount="1740" Body="&lt;p&gt;In regular computers, bits may be physically represented using a wide variety of two-state devices, such as polarity of magnetization of a certain area of a ferromagnetic film or two levels of electric charge in a capacitor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But qubits have a property that they can be in a superposition of both states at the same time. I've seen &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1182/&quot;&gt;this question&lt;/a&gt;'s answers, which explain how can a qubit be represented, or modeled using a regular computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I want to know what can be used (and is used by companies like D-Wave) to represent a qubit in a real physical quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="26" LastEditDate="2018-12-13T19:40:13.973" LastActivityDate="2018-12-13T19:40:13.973" Title="What is the physical representation of a qubit?" Tags="&lt;physical-qubit&gt;&lt;architecture&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1391" PostTypeId="2" ParentId="1376" CreationDate="2018-03-28T15:10:13.583" Score="6" Body="&lt;p&gt;Bitcoin uses elliptic-curve cryptography to sign transactions, which can easily be broken by Shor's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't actually read the article because it looked kind of dumb, but I gathered that the author proposed using Grover's algorithm to speed up the mining process by looking for hashes more efficiently. If you had a functioning quantum computer, then I think it would be more efficient to forget about mining and instead just transfer people's bitcoins directly into your own account. A useful quantum computer would completely destroy the entire Bitcoin fundamental model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that other cryptocurrencies, like Cardano, are already designed to be secure against quantum attacks, to prevent this issue.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2018-03-28T15:35:52.467" LastActivityDate="2018-03-28T15:35:52.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1392" PostTypeId="2" ParentId="1383" CreationDate="2018-03-28T15:28:01.007" Score="2" Body="&lt;p&gt;First of all, factoring can be done on a quantum computer (with usage of 'unitary' quantum gates) by means of &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An explanation that doesn't require advanced mathematics nor any advanced knowledge of physics is this &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=208&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog post by Scott Aaronson&lt;/a&gt;, titled &quot;Shor, I'll do it.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A brief summary of his ideas is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we represent our quantum gates/qubits with clocks (using the 'complex numbers as arrows (i.e. elements of $\mathbb{R}^2$ with weird multiplication), representation') &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we note that a CS researcher has very irregular sleeping periods. To find this strange period, we use the clocks. Then, we note that this period finding can be used to factor integers (using a similar construction as in the randomized Pollard -$\rho$ algorithm)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, our strange quantum clocks can help us factor efficiently!&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-03-28T15:28:01.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1393" PostTypeId="5" CreationDate="2018-03-28T15:37:24.750" Score="0" Body="&lt;h2&gt;What is the goal of post quantum crypto?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In short, post quantum crypto is the research initiative to get new cryptographic primitives to replace all implementations for such primitives to are expected to be broken by attacks based on efficient quantum algorithms. First, we'd like to know what needs to be replaced.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Which methods are likely compromised?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;At least all methods that are based on the hardness of &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Factoring (e.g. RSA); or&lt;/li&gt;&#xA;&lt;li&gt;Discrete logarithm (e.g. some forms of Diffie-Helmann); or&lt;/li&gt;&#xA;&lt;li&gt;Problems on Elliptic curves (elliptic curve cryptography).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All problems above are expected to be hard for classical computers, but can be solved efficiently by a practical implementation of Shor's algorithm. Unfortunately, all these problems already cover most of the mainstream crypto.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although Grover's algorithm for unordered search also has implications for security, the only change useful and nessecary is to double the bit size of the keys (i.e, we square the actual size of the key-space, as Grover can search a space of size $n$ in $O(\sqrt{n})$). As this has no further implications, this isn't the focus of post quantum crypto.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Which methods might survive the quantum age?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Currently, among the methods that might be &quot;quantum-resistant&quot; are the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hash-based methods (usually for signatures)&lt;/li&gt;&#xA;&lt;li&gt;Code-based methods: A very broad field based on results from coding theory. Has many different cryptographic applications&lt;/li&gt;&#xA;&lt;li&gt;Lattice-based methods: These again have broad applications and are based on problems on discrete lattices, such as lattice base reduction.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://pqcrypto.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pqcrypto.org/&lt;/a&gt; to learn more about the current state of post quantum crypto&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-05T14:07:08.947" LastActivityDate="2018-04-05T14:07:08.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1394" PostTypeId="4" CreationDate="2018-03-28T15:37:24.750" Score="0" Body="For questions about encryption methods that are hard/impossible to crack even when using quantum computers. Be certain that your question concerns quantum computation as an essential component! Otherwise, it would be better to ask on either Cryptography or Information Security" OwnerUserId="11" LastEditorUserId="11" LastEditDate="2018-03-28T16:01:19.220" LastActivityDate="2018-03-28T16:01:19.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1395" PostTypeId="2" ParentId="1390" CreationDate="2018-03-28T15:38:41.493" Score="14" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Developments&quot; rel=&quot;noreferrer&quot;&gt;This section&lt;/a&gt; on Wikipedia collects the most important ongoing attempts to physically implement qubits.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For physically implementing a quantum computer, many different&#xA;  candidates are being pursued, among them (distinguished by the&#xA;  physical system used to realize the qubits):&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;Superconducting quantum computing (qubit implemented by the state of small superconducting circuits (Josephson junctions))&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Trapped ion quantum computer (qubit implemented by the internal state of trapped ions)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Optical lattices (qubit implemented by internal states of neutral atoms trapped in an optical lattice)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Quantum dot computer, spin-based (e.g. the Loss-DiVincenzo quantum computer) (qubit given by the spin states of trapped electrons)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Quantum dot computer, spatial-based (qubit given by electron position in double quantum dot)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Nuclear magnetic resonance on molecules in solution (liquid-state NMR) (qubit provided by nuclear spins within the dissolved molecule)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Solid-state NMR Kane quantum computers (qubit realized by the nuclear spin state of phosphorus donors in silicon)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Electrons-on-helium quantum computers (qubit is the electron spin)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Cavity quantum electrodynamics (CQED) (qubit provided by the internal state of  trapped atoms coupled to high-finesse cavities)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Molecular magnet (qubit given by spin states)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Fullerene-based ESR quantum computer (qubit based on the electronic spin of atoms or molecules encased in fullerenes)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Linear optical quantum computer (qubits realized by processing states of different modes of light through linear elements e.g.&#xA;  mirrors, beam splitters and phase shifters)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Diamond-based quantum computer (qubit realized by electronic or nuclear spin of nitrogen-vacancy centers in diamond)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Bose–Einstein condensate-based quantum computer&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Transistor-based quantum computer – string quantum computers with entrainment of positive holes using an electrostatic trap&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Rare-earth-metal-ion-doped inorganic crystal based quantum computers (qubit realized by the internal electronic state of dopants in optical&#xA;  fibers)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Metallic-like carbon nanospheres based quantum computers&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;The large number of candidates demonstrates that the topic, in spite&#xA;  of rapid progress, is still in its infancy. There is also a vast&#xA;  amount of flexibility.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-08T14:20:05.467" LastActivityDate="2018-04-08T14:20:05.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1399" PostTypeId="5" CreationDate="2018-03-28T16:55:59.620" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-28T16:55:59.620" LastActivityDate="2018-03-28T16:55:59.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1400" PostTypeId="4" CreationDate="2018-03-28T16:55:59.620" Score="0" Body="For questions that involve a request for resources to learn anything related to quantum computing or quantum information." OwnerUserId="1005" LastEditorUserId="26" LastEditDate="2019-01-01T08:46:21.020" LastActivityDate="2019-01-01T08:46:21.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1402" PostTypeId="2" ParentId="1383" CreationDate="2018-03-28T18:41:39.327" Score="4" Body="&lt;p&gt;What makes quantum computers good at factoring large numbers is their ability to solve the period finding problem (and a mathematical fact that relates finding prime factors to period finding). That's basically Shor's algorithm in a nutshell. Yet it only begs the question what makes quantum computers good at period finding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the core of period finding is the ability to calculate a function's value over its entire domain (that is, for every conceivable input). This is called quantum parallelism. This in itself is not good enough, but together with interference (the ability to combine results from quantum parallelism in a certain way), it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose this answer might be a bit of a cliff hanger: How does one use these abilities to actually factor? Find the answer to that at &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia on Shor's algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-03-28T19:33:39.923" LastActivityDate="2018-03-28T19:33:39.923" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1403" PostTypeId="2" ParentId="1385" CreationDate="2018-03-28T18:45:10.373" Score="3" Body="&lt;p&gt;The simple explanation for how (and hence why) Grover's algorithm works is that a quantum gate can only reshuffle (or otherwise distribute) probability amplitudes. Using an initial state with equal probability amplitudes for all states of the computational basis, one starts with an amplitude of $1/\sqrt{N}$. This much can be &quot;added&quot; to the desired (solution) state in each iteration, such that after $\sqrt{N}$ iterations one arrives at a probability amplitude of $1$ meaning the desired state has been distilled.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T18:45:10.373" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1404" PostTypeId="1" AcceptedAnswerId="1407" CreationDate="2018-03-28T19:04:30.763" Score="15" ViewCount="2885" Body="&lt;p&gt;Deep Learning (multiple layers of artificial neural networks used in supervised and unsupervised machine learning tasks) is an incredibly powerful tool for many of the most difficult machine learning tasks: image recognition, video recognition, speech recognition, etc.  Given that it is currently one of the most powerful machine learning algorithms, and Quantum Computing is generally regarded as a game changer for certain very difficult computation tasks, I'm wondering if there has been any movement on combining the two.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Could a deep learning algorithm run on a quantum computer?  &lt;/li&gt;&#xA;&lt;li&gt;Does it make sense to try?   &lt;/li&gt;&#xA;&lt;li&gt;Are there other quantum algorithms that would make deep learning irrelevant?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1044" LastEditorUserId="55" LastEditDate="2020-09-01T22:28:06.383" LastActivityDate="2020-09-01T22:28:06.383" Title="Will deep learning neural networks run on quantum computers?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;neural-network&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1405" PostTypeId="2" ParentId="1367" CreationDate="2018-03-28T19:10:42.050" Score="5" Body="&lt;p&gt;Quantum computers are programmed by (evolving programming languages representing) so-called quantum circuits. These are a sequence of quantum gates plus the information on which quantum bits (qubits) they act.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing you really need to know about quantum gates is that they represent rotations (in a higher dimensional space, so-called Hilbert space). Hence they are reversible: Quantum computers are programmed with reversible logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do quantum gates rotate? It is the hyperspheres on whose surface qubit states live. Each state of the computational basis (&lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt; for a 2-qubit system in the usual Dirac notation) gets a complex number as a coefficient or as a so-called probability amplitude. The basis vectors are orthogonal and span the state's Hilbert space, the probability amplitudes can be seen as coordinates in it. This is the picture in which quantum gates effect rotations. You will find that physicists often use a different picture, the Bloch sphere, for single qubit systems, in which quantum gates also cause rotations (but sometimes by a larger angle or by one that is omitted in that picture altogether).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All conventional logic can be implemented by a quantum computer by first expressing it in reversible logic (which may require ancilla bits). The classical NOT gate corresponds to the X quantum gate, but unlike the classical case where the only 1-bit reversible gates are the identity and the NOT gate, a quantum computer has four corresponding gates (X, Y, Z according to rotations on the Bloch sphere, plus the identity). Further, you can have rotations that rotate only by a fraction of how far these gates rotate; a few particularly interesting ones have special names and abbreviations such as the Hadamard gate or H gate that creates the equal superposition of all states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, early quantum software engineers will probably have to know a bit about the quantum computer hardware they will be using: Due to the arbitrarily and continuously choosable angle of a quantum gate's effective rotation, there is a sort-of analog element to quantum computers that necessarily creates errors (and physical quantum computers have even more error sources than just that). There's a way to deal with it, quantum error correction that discretizes errors and corrects the most likely discretizations of them to achieve (ideally) arbitrarily complex computations with bound errors. But optimization will likely mean that one quantum computer with one choice of quantum error correction will be more apt at the certain quantum gate or even algorithms than others, in ways that are a bit more subtle than just looking up a speed factor.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="7429" LastEditDate="2019-06-20T07:07:50.833" LastActivityDate="2019-06-20T07:07:50.833" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1406" PostTypeId="2" ParentId="1383" CreationDate="2018-03-28T19:11:26.583" Score="15" Body="&lt;h2&gt;The short answer&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;$\newcommand{\modN}[1]{#1\,\operatorname{mod}\,N}\newcommand{\on}[1]{\operatorname{#1}}$Quantum Computers are able to run subroutines of an algorithm for factoring, exponentially faster than any known classical counterpart. This doesn't mean classical computers CAN'T do it fast too, we just don't know as of today a way for classical algorithms to run as efficient as quantum algorithms&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The long answer&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Quantum Computers are good at Discrete Fourier Transforms.&#xA;There's a lot at play here that isn't captured by just &quot;&lt;em&gt;it's parallel&lt;/em&gt;&quot; or &quot;&lt;em&gt;it's quick&lt;/em&gt;&quot;, so let's get into the blood of the beast.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;factoring problem&lt;/em&gt; is the following: Given a number $N = pq$ where $p,q$ are primes, how do you recover $p$ and $q$? One approach is to note the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I look at a number $\modN{x}$, then either $x$ shares a common factor with $N$, or it doesn't. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $x$ shares a common factor, and isn't a multiple of $N$ itself, then we can easily ask for what the common factors of $x$ and $N$ are (through the Euclidean algorithm for greatest common factors). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a not so obvious fact: the set of all $x$ that don't share a common factor with $N$ forms a multiplicative group $\on{mod} N$. What does that mean? You can look at the definition of a group in Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/Group_(mathematics)&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. Let the group operation be multiplication to fill in the details, but all we really care about here is the following consequence of that theory which is: the sequence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \modN{x^0}, \quad\modN{x^1}, \quad\modN{x^2}, ... $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;is periodic, when $x,N$ don't share common factors (try $x = 2$, $N = 5$) to see it first hand as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\newcommand{\mod}[1]{#1\,\operatorname{mod}\,5}&#xA;\mod1 = 1,\quad&#xA;\mod4 = 4,\quad&#xA;\mod8 = 3,\quad&#xA;\mod{16} = 1.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now how many natural numbers $x$ less than $N$ don't share any common factors with $N$? That is answered by &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_totient_function&quot; rel=&quot;noreferrer&quot;&gt;Euler's totient function&lt;/a&gt;, it's $(p-1)(q-1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, tapping on the subject of group theory, the length of the repeating chains &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \modN{x^0}, \quad\modN{x^1}, \quad\modN{x^2}, ... $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;divides that number $(p-1)(q-1)$. So if you know the period of sequences of powers of $x \mod N$ then you can start to put together a guess for what $(p-1)(q-1)$ is. Moreover, If you know what $(p-1)(q-1)$ is, and what $pq$ is (that's N don't forget!), then you have 2 equations with 2 unknowns, which can be solved through elementary algebra to separate $p,q$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where do quantum computers come in? The period finding. There's an operation called a Fourier transform, which takes a function $g$ written as a sum of periodic functions $a_1 e_1 + a_2 e_2 ... $ where $a_i$ are numbers, $e_i$ are periodic functions with period $p_i$ and maps it to a new function $\hat{f}$ such that $ \hat{f}(p_i) = a_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Fourier transform&lt;/a&gt; is usually introduced as an integral, but when you want to just apply it to an array of data (the I&lt;sup&gt;th&lt;/sup&gt; element of the array is $f(I)$) you can use this tool called a &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#The_unitary_DFT&quot; rel=&quot;noreferrer&quot;&gt;Discrete Fourier Transform&lt;/a&gt; which amounts to multiplying your &quot;array&quot; as if it were a vector, by a very big unitary matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Emphasis on the word unitary: it's a really arbitrary property described &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. But the key takeaway is the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the world of physics, all operators obey the same general mathematical principle: &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitarity_(physics)&quot; rel=&quot;noreferrer&quot;&gt;unitarity&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that means it's not unreasonable to replicate that DFT matrix operation as a quantum operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here is where it gets deep an $n$ Qubit Array can represent $2^n$ possible array elements (consult anywhere online for an explanation of that or drop a comment). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And similarly an $n$ Qubit quantum operator can act on that entire $2^n$ quantum space, and produce an answer that we can interpret.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;this Wikipedia article&lt;/a&gt; for more detail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we can do this Fourier transform on an exponentially large data set, using only $n$ Qubits, then we can find the period very quickly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we can find the period very quickly we can rapidly assemble an estimate for $(p-1)(q-1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we can do that fast then given our knowledge of $N=pq$ we can take a stab at checking $p,q$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's whats going on here, at a very high level.&lt;/p&gt;&#xA;" OwnerUserId="1034" LastEditorUserId="45" LastEditDate="2018-04-05T14:04:52.387" LastActivityDate="2018-04-05T14:04:52.387" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1407" PostTypeId="2" ParentId="1404" CreationDate="2018-03-28T19:21:42.297" Score="8" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, all classical algorithms can be run on quantum computers, moreover any classical algorithm involving searching can get a $\sqrt{\text{original time}}$ boost by the use of grovers algorithm. An example that comes to mind is treating the fine tuning of neural network parameters as a &quot;search for coefficients&quot; problem.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the fact there are clear computational gains in some processes: yes. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Not that I know of. But someone with more expertise can chime in here if they want. The one thing that comes to mind: often we may use Deep Learning and other forms of Artificial Intelligence to study problems of chemistry, and physics because simulation is expensive or impractical. In this domain, Quantum Computers will likely slaughter their classical ancestors given their ability to natively simulate quantum systems (like those in Nuclear Chemistry) in effectively real time or faster. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Last I spoke with him, Mario Szegedy was interested in precisely this, there are probably a lot of other researchers too working on it right now.&lt;/p&gt;&#xA;" OwnerUserId="1034" LastEditorUserId="1034" LastEditDate="2018-03-28T19:30:44.737" LastActivityDate="2018-03-28T19:30:44.737" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1408" PostTypeId="2" ParentId="1356" CreationDate="2018-03-28T19:22:07.573" Score="2" Body="&lt;p&gt;You need a surprisingly large number of quantum gates to implement a quantum error correcting code in a fault-tolerant manner. One part of the reason is that there are many errors to detect since a code that can correct all single qubit errors already requires 5 qubits and each error can be of three kinds (corresponding to unintentional X, Y, Z gates). Hence to even just correct any single qubit error, you already need logic to distinguish between these 15 errors plus the no-error situation: $XIIII$, $YIIII$, $ZIIII$, $IXIII$, $IYIII$, $IZIII$, $IIXII$, $IIYII$, $IIZII$, $IIIXI$, $IIIYI$, $IIIZI$, $IIIIX$, $IIIIY$, $IIIIZ$, $IIIII$ where $X$, $Y$, $Z$ are the possible single qubit errors and $I$ (identity) denotes the no-error-for-this-qubit situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main part of the reason is, however, that you cannot use straight-forward error detection circuitry: Every CNOT (or every other nontrivial 2 or more qubit gate) forwards errors in one qubit to another qubit which would be disastrous for the most trivial case of a single qubit error correcting code and still very bad for more sophisticated codes. Hence a fault-tolerant (useful) implementation of needs even more effort than one might naively think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With many gates per error correcting step, you can only permit a very low error rate per step. Here yet another problem arises: Since you may have coherent errors, you must be ready for the worst case that an error $\epsilon$ propagates not as $N \epsilon$ after N single qubit gates but as $N^2 \epsilon$. This value must remain sufficiently low such that you overall gain after correcting some (but not all) errors, for example single qubit errors only.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example for a coherent error is an implementation of a gate $G$ that does, to first order, not simply $G$ but $G + \sqrt{\epsilon} X$ which you might call an error of $\epsilon$ because that is the probability corresponding to the probability amplitude $\sqrt{\epsilon}$ and hence the probability that a measurement directly after the gate reveals that it acted as the error $X$. After $N$ applications of this gate, again to first order, you have actually applied $G^N + N \sqrt{\epsilon} G^N X$ (if G and X commute, otherwise a more complicated construct that has $N$ distinct terms proportional to $\sqrt{\epsilon}$). Hence you would, if measuring then, find an error probability of $N^2 \epsilon$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incoherent errors are more benign. Yet if one must give a single value as an error threshold, then one cannot choose to only assume benign errors!&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-03-29T09:16:53.693" LastActivityDate="2018-03-29T09:16:53.693" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1409" PostTypeId="2" ParentId="1341" CreationDate="2018-03-28T19:28:00.683" Score="0" Body="&lt;p&gt;By saying that a quantum computer using $n$ qubits does (up to) $2^n$ computations in parallel, one tries to explain quantum parallelism: If you represent the state of the $n$ qubits using probability amplitudes for each state in the computational basis, there are $2^n$ such probability amplitudes that a classical computer would have to update per quantum gate it is to simulate, whilst a quantum computer does this automatically (but with potentially less benefit since not all these numbers can be independently measured).&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T19:28:00.683" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1410" PostTypeId="1" AcceptedAnswerId="1418" CreationDate="2018-03-28T19:32:31.093" Score="27" ViewCount="7606" Body="&lt;p&gt;What is meant by the term &quot;computational basis&quot; in the context of quantum computing and quantum algorithms?&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="55" LastEditDate="2019-11-13T11:24:35.627" LastActivityDate="2019-11-13T11:24:35.627" Title="What is meant by the term &quot;computational basis&quot;?" Tags="&lt;quantum-state&gt;&lt;terminology&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="1411" PostTypeId="2" ParentId="1410" CreationDate="2018-03-28T19:32:31.093" Score="2" Body="&lt;p&gt;A quantum state is a vector in a high-dimensional vector space (the Hilbert space). There is one basis that comes natural to any quantum algorithm (or quantum computer) that is based on qubits: The states that correspond to the binary numbers are special, they are the so-called computational basis states.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T19:32:31.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1412" PostTypeId="2" ParentId="136" CreationDate="2018-03-28T19:38:37.110" Score="2" Body="&lt;p&gt;Measurements are unitary operations, too, you just don't see it: A measurement is equivalent to some complicated (quantum) operation that acts not just on the system but also on its environment. If one were to model everything as a quantum system (including the environment), one would have unitary operations all the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, usually there is little point in this because we usually don't know the exact action on the environment and typically don't care. If we consider only the system, then the result is the well-known collapse of the wave function, which is indeed a non-unitary operation.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T19:38:37.110" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1413" PostTypeId="1" AcceptedAnswerId="1431" CreationDate="2018-03-28T19:39:49.517" Score="8" ViewCount="5013" Body="&lt;p&gt;I would like to play with a quantum circuit &lt;code&gt;local_qasm_simulator&lt;/code&gt; in QISKit, but I do not want to implement a separate quantum circuit that would prepare an initial state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way I do it now is by falling back to NumPy. Specifically, first, I extract matrix &lt;code&gt;u&lt;/code&gt; from a quantum program &lt;code&gt;qp&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cname = 'circuit name'&#xA;results = qp.execute(cname, backend='local_unitary_simulator', shots=1)&#xA;data = results.get_data(cname)&#xA;u = data['unitary']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, I explicitly create the state I need (e.g., $|\psi\rangle = \frac{1}{2}(|00\rangle + |01\rangle + |10\rangle - |11\rangle)$):&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;num_qubits = 2&#xA;psi = np.ones(2**num_qubits) / 2.0&#xA;psi[3] = -psi[3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, I apply &lt;code&gt;u&lt;/code&gt; to &lt;code&gt;psi&lt;/code&gt; with NumPy:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u @ psi&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The advantage of this approach is that I can explicitly obtain the state $U |\psi\rangle$. However, I cannot use &lt;code&gt;local_qasm_simulator&lt;/code&gt; and the &lt;code&gt;measure()&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how could I prepare an arbitrary state, and supply it to a circuit, and run a &lt;code&gt;local_qasm_simulator&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="528" LastEditorUserId="26" LastEditDate="2019-03-12T09:26:42.953" LastActivityDate="2020-07-21T15:55:18.507" Title="How to create an arbitrary state in QISKit for a local_qasm_simulator?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1414" PostTypeId="2" ParentId="1365" CreationDate="2018-03-28T19:46:50.480" Score="6" Body="&lt;p&gt;A pure state is what one would naturally call a state of a system. Now imagine you have a qubit in a certain state, say the equal superposition of both its computational basis states, which is $\frac{\sqrt{2}}{2} \left( \left|0\right&amp;gt; + \left|1\right&amp;gt; \right)$. Then measure it in the computational basis. What state do you get as a result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you read the measurement result, you know which state you have. But if you discard that result, then you don't know which state the system is in (either it is in $\left|0\right&amp;gt;$ or in $\left|1\right&amp;gt;$). This is different from the superposition you had before (which was a pure state): It is a mixed state.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T19:46:50.480" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1415" PostTypeId="2" ParentId="1356" CreationDate="2018-03-28T19:57:29.923" Score="4" Body="&lt;p&gt;We want to compare an output state with some ideal state, so normally, fidelity, $F\left(\left|\psi\right&amp;gt;, \rho\right)$ is used as this is a good way to tell how well the possible measurement outcomes of $\rho$ compare with the possible measurement outcomes of $\left|\psi\right&amp;gt;$, where $\left|\psi\right&amp;gt;$ is the ideal output state and $\rho$ is the achieved (potentially mixed) state after some noise process. As we're comparing states, this is $$F\left(\left|\psi\right&amp;gt;, \rho\right) = \sqrt{\left&amp;lt;\psi\right|\rho\left|\psi\right&amp;gt;}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Describing both the noise and error correction processes using Kraus operators, where $\mathcal N$ is the noise channel with Kraus operators $N_i$ and $\mathcal E$ is the error correction channel with Kraus operators $E_j$, the state after noise is $$\rho' = \mathcal N\left(\left|\psi\rangle\langle\psi\right|\right) = \sum_iN_i\left|\psi\rangle\langle\psi\right|N_i^\dagger$$ and the state after both noise and error correction is $$\rho = \mathcal E\circ\mathcal N\left(\left|\psi\rangle\langle\psi\right|\right) = \sum_{i, j}E_jN_i\left|\psi\rangle\langle\psi\right|N_i^\dagger E_j^\dagger.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fidelity of this is given by \begin{align}F\left(\left|\psi\right&amp;gt;, \rho\right) &amp;amp;= \sqrt{\left&amp;lt;\psi\right|\rho\left|\psi\right&amp;gt;} \\ &amp;amp;= \sqrt{\sum_{i, j}\left&amp;lt;\psi\right|E_jN_i\left|\psi\rangle\langle\psi\right|N_i^\dagger E_j^\dagger\left|\psi\right&amp;gt;} \\&amp;amp;= \sqrt{\sum_{i, j}\left&amp;lt;\psi\right|E_jN_i\left|\psi\rangle\langle\psi\right|E_jN_i\left|\psi\right&amp;gt;^*} \\ &amp;amp;= \sqrt{\sum_{i, j}\lvert\left&amp;lt;\psi\right|E_jN_i\left|\psi\right\rangle\rvert^2}.\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the error correction protocol to be of any use, we want the fidelity after error correction to be larger than the fidelity after noise, but before error correction, so that the error corrected state is less distinguishable from the non-corrected state. That is, we want $$F\left(\left|\psi\right&amp;gt;, \rho\right) &amp;gt; F\left(\left|\psi\right&amp;gt;, \rho'\right).$$ This gives $$\sqrt{\sum_{i, j}\lvert\left&amp;lt;\psi\right|E_jN_i\left|\psi\right\rangle\rvert^2} &amp;gt; \sqrt{\sum_i\lvert\left&amp;lt;\psi\right|N_i\left|\psi\right\rangle\rvert^2}.$$ As fidelity is positive, this can be rewritten as $$\sum_{i, j}\lvert\left&amp;lt;\psi\right|E_jN_i\left|\psi\right\rangle\rvert^2 &amp;gt; \sum_i\lvert\left&amp;lt;\psi\right|N_i\left|\psi\right\rangle\rvert^2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Splitting $\mathcal N$ into the correctable part,$\mathcal N_c$ , for which $\mathcal E\circ\mathcal N_c\left(\left|\psi\rangle\langle\psi\right|\right) = \left|\psi\rangle\langle\psi\right|$ and the non-correctable part, $\mathcal N_{nc}$, for which $\mathcal E\circ\mathcal N_{nc}\left(\left|\psi\rangle\langle\psi\right|\right) = \sigma$. Denoting the probability of the error being correctable as $\mathbb P_c$ and non-correctable (i.e. too many errors have occurred to reconstruct the ideal state) as $\mathbb P_{nc}$ gives $$\sum_{i, j}\lvert\left&amp;lt;\psi\right|E_jN_i\left|\psi\right\rangle\rvert^2 = \mathbb P_c + \mathbb P_{nc}\left&amp;lt;\psi\vert\sigma\vert\psi\right&amp;gt; \geq \mathbb P_c,$$ where equality will be assumed by assuming $\left&amp;lt;\psi\vert\sigma\vert\psi\right&amp;gt; = 0$. That is a false 'correction' will project onto an orthogonal outcome to the correct one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $n$ qubits, with an (equal) probability of error on each qubit as $p$ (&lt;strong&gt;note&lt;/strong&gt;: this is &lt;em&gt;not&lt;/em&gt; the same as the noise parameter, which would have to be used to calculate the probability of an error), the probability of having a correctable error (assuming that the $n$ qubits have been used to encode $k$ qubits, allowing for errors on up to $t$ qubits, determined by the Singleton bound $n-k\geq 4t$) is \begin{align} \mathbb P_c &amp;amp;=\sum_j^t {n\choose j}p^j\left(1-p\right)^{n-j}\\ &amp;amp;= \left(1-p\right)^n + np\left(1-p\right)^{n-1} + \frac 12n\left(n-1\right)p^2\left(1-p\right)^{n-2} + \mathcal O\left(p^3\right) \\ &amp;amp;= 1 - {n\choose{t+1}}p^{t+1} +  \mathcal O\left(p^{t + 2}\right)\end{align}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise channels can also be written as $N_i = \sum_j\alpha_{i, j}P_j$ for a basis $P_j$, which can be used to define a &lt;em&gt;process matrix&lt;/em&gt; $\chi_{j, k} = \sum_i\alpha_{i, j}\alpha^*_{i, k}$. This gives $$\sum_i\lvert\left&amp;lt;\psi\right|N_i\left|\psi\right\rangle\rvert^2 = \sum_{j, k}\chi_{j, k}\left&amp;lt;\psi\right|P_j\left|\psi\right\rangle\left&amp;lt;\psi\right|P_k\left|\psi\right\rangle\geq\chi_{0, ,0},$$ where $\chi_{0, 0} = \left(1-p\right)^n$ is the probability of &lt;em&gt;no&lt;/em&gt; error occurring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives that the error correction has been successfully in mitigating (at least some of) the noise when $$1 - {n\choose{t+1}}p^{t+1} \gtrapprox\left(1-p\right)^n.$$ While this is only valid for $\rho \ll 1$ and as a weaker bound has been used, potentially giving inaccurate results of when the error correction has been successful, this displays that error correction is good for small error probabilities as $p$ grows faster than $p^{t+1}$ when $p$ is small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as $p$ gets slightly larger, $p^{t+1}$ grows faster than $p$ and, depending on prefactors, which depends on the size of the code and number of qubits to correct, will cause the error correction to &lt;em&gt;incorrectly&lt;/em&gt; 'correct' the errors that have occurred and it starts failing as an error correction code. In the case of $n=5$, giving $t=1$, this happens at $p\approx 0.29$, although this is very much just an estimate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit from comments:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As $\mathbb P_c + \mathbb P_{nc} = 1$, this gives $$\sum_{i, j}\lvert\left&amp;lt;\psi\right|E_jN_i\left|\psi\right\rangle\rvert^2 = \left&amp;lt;\psi\vert\sigma\vert\psi\right&amp;gt; + \mathbb P_c\left(1-\left&amp;lt;\psi\vert\sigma\vert\psi\right&amp;gt;\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plugging this in as above further gives $$1-\left(1-\left&amp;lt;\psi\vert\sigma\vert\psi\right&amp;gt;\right){n\choose{t+1}}p^{t+1} \gtrapprox\left(1-p\right)^n,$$ which is the same behaviour as before, only with a different constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also shows that, although error correction can increase the fidelity, it can't increase the fidelity to $1$, especially as there will be errors (e.g. gate errors from not being able to perfectly implement any gate in reality) arising from implementing the error correction. As any reasonably deep circuit requires, by definition, a reasonable number of gates, the fidelity after each gate is going to be less than the fidelity of the previous gate (on average) and the error correction protocol is going to be less effective. There will then be a cut-off number of gates at which point the error correction protocol will &lt;em&gt;decrease&lt;/em&gt; the fidelity and the errors will continually compound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows, to a rough approximation, that error correction, or merely reducing the error rates, &lt;strong&gt;is not enough for fault tolerant computation&lt;/strong&gt;, unless errors are extremely low, depending on the circuit depth.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-03-31T19:27:38.967" LastActivityDate="2018-03-31T19:27:38.967" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1416" PostTypeId="1" AcceptedAnswerId="1421" CreationDate="2018-03-28T20:12:03.880" Score="9" ViewCount="519" Body="&lt;p&gt;On the Wikipedia page for Shor's algorithm, it is stated that Shor's algorithm is not currently feasible to use to factor RSA-sized numbers, because a quantum computer has not been built with enough qubits due to things such as quantum noise. How do modern quantum computers prevent interference with computations from this noise? Can they prevent it at all?&lt;/p&gt;&#xA;" OwnerUserId="983" LastEditorUserId="26" LastEditDate="2019-05-17T22:20:07.080" LastActivityDate="2019-05-17T22:20:07.080" Title="How do quantum computers prevent &quot;quantum noise&quot;?" Tags="&lt;algorithm&gt;&lt;architecture&gt;&lt;shors-algorithm&gt;&lt;noise&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1417" PostTypeId="2" ParentId="1416" CreationDate="2018-03-28T20:50:17.257" Score="8" Body="&lt;p&gt;The answer to noise (and any source of error, really) in quantum computations is &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;noreferrer&quot;&gt;quantum error correction&lt;/a&gt;: You choose an encoding such that discretized errors correspond not only to invalid encodings but also uniquely determine what kind of error must have occured. This is not possible for all errors but with reasonable error models (such as single qubit errors are much more likely than two qubit errors which are much more likely than three qubit errors, etc.) it can be shown that, if your noise and other error sources are below a certain threshold, you can enable arbitrarily large and long computations.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T20:50:17.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1418" PostTypeId="2" ParentId="1410" CreationDate="2018-03-28T21:12:32.017" Score="8" Body="&lt;p&gt;When we have just one qubit, there's nothing particularly special about the computational basis; it's just nice to have a canonical basis. In practice you could think that first you implement a gate $Z$ with $Z^2 = I$ and $Z\neq I$, and then you say that the computational basis is the eigenbasis of this gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when we talk about multi-qubit systems, the computational basis &lt;em&gt;is&lt;/em&gt; meaningful. It comes from picking a basis for each qubit, and then taking the basis which is the tensor product of all these bases. Picking the same basis for each qubit is nice just to keep everything uniform, and calling them $0$ and $1$ is a nice notational choice. What's really important is that our basis states are product states across our qubits: the computational basis states can be prepared by initializing our qubits separately and then bringing them together. This isn't true for arbitrary states! For example, the cat state $\frac1{\sqrt2}\left(|0^n\rangle + |1^n\rangle\right)$ requires a log-depth circuit in order to prepare it from a product state.&lt;/p&gt;&#xA;" OwnerUserId="483" LastActivityDate="2018-03-28T21:12:32.017" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1419" PostTypeId="1" AcceptedAnswerId="1430" CreationDate="2018-03-28T21:19:07.080" Score="9" ViewCount="829" Body="&lt;p&gt;Grover's algorithm is often described as a way to &lt;em&gt;search a database&lt;/em&gt; in $O(\sqrt{N})$ time. For using it we need an oracle gate that represents some function $f$ such that $f^{-1}(1)$ is the answer. But how do you actually make such a “&lt;em&gt;database oracle&lt;/em&gt;”?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have an array of numbers $a$ that contains $w$ exactly once and I need to find $w$'s index. On a classical computer, I would load the array into memory and iterate through it until I find $w$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if $a = [3, 2, 0, 1, 2, 3]$ and $w = 0$, I expect to get 2 as the answer (or 3 in 1-indexing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I represent this array in a quantum computer and make a gate that returns $a_x$ for some $x$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, do you need to have the entirety of the “database” within quantum memory (assuming there are some ways to access classical registers from quantum gates)?&lt;/p&gt;&#xA;" OwnerUserId="580" LastEditorUserId="55" LastEditDate="2018-03-28T23:19:28.960" LastActivityDate="2021-02-09T19:10:10.777" Title="Does the oracle in Grover's algorithm need to contain information about the entirety of the database?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1420" PostTypeId="2" ParentId="1419" CreationDate="2018-03-28T21:22:59.710" Score="1" Body="&lt;p&gt;You would build a function $f$ such that $f(x)$ first accesses the $x$-th item of your array and then compares it to $w$. An actual implementation might access the array encoded in extra (parameter) input qubits as if they were bits.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-28T21:22:59.710" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1421" PostTypeId="2" ParentId="1416" CreationDate="2018-03-28T21:26:18.617" Score="6" Body="&lt;p&gt;&lt;strong&gt;How do we prevent quantum noise in a quantum computer?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, technically the answer is (at least for most systems): we use ridiculously low temperatures (much colder than space), we shield everything (or at least as much as possible) out, that might introduce any noise (radio waves, such as phone signals or light, magnetic fields, ...), we do everything to remove particles on our chips, that might interact with our system and we are super careful, that the connections (i.e. cables, optical fibres and such) to the environment (control and readout lines) carry as little noise as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that will not be enough to run a relevant Shor. To understand what else we can do, let's understand:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is Quantum noise?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noise is present in all systems - so also your classical computer. In classical computers however this can manifest in only one way: a bit that should be in one state (say 1) turns out to be in the other (say 0) instead. This is pretty easy to correct for: we just run the computation in parallel a few times and check every now and again if one of them is off and correct the error (assuming the majority to be right)*. So we, of course try to prevent noise, but more importantly, we correct for it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum noise turns out to be much more complicated. How so? Well generally the state of a quantum bit (qubit) can be described as a point on a sphere (commonly called bloch sphere). Noise can now move this point somewhere along the sphere (or in fact make the sphere smaller). But we can still apply the same error correcting we used for the classical computer right? No! The tricky part about quantum computing is, that we only get to chose to points on the sphere and get to know to which one it was closer to*. Also we &lt;em&gt;project&lt;/em&gt; the state of the qubit into that value - so the value actually becomes the value we measured, no matter what it was before. Crazy, right? Well that's &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum mechanics&lt;/a&gt; for ya. So we cannot simply compare the computations while running it as before, because that would destroy our computation!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum error correction to the rescue?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, it turns out &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum error correction&lt;/a&gt; is actually possible through a few tricks (which are kind of hard to explain here - so just for feelings sake: we measure in a slightly different way instead, allowing us to just measure weather two qubits are the same in some respect or not. Again, if we do measure that they are the same we have &lt;em&gt;projected&lt;/em&gt; them into being the same, if not we can correct. The important phrase being &lt;em&gt;in some respect&lt;/em&gt;, so we have to do this for several types of errors that can happen and afterwards try to puzzle out what actually happened to the qubit). For it to work however, we need a quantum computer that already has very little noise to begin with (see also &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1356/why-do-error-correction-protocols-only-work-when-the-error-rates-are-already-sig&quot;&gt;Why do error correction protocols only work when the error rates are already significantly low to begin with?&lt;/a&gt;&quot;), can &lt;em&gt;talk&lt;/em&gt; (are coupled) to each other and we generally have sufficient control over. Right now, nobody is close to fulfilling all these requirements sufficiently at once (separately on different system they have all been achieved).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;*Well that's not exactly how it works, but roughly.&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2018-03-29T08:37:04.787" LastActivityDate="2018-03-29T08:37:04.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1422" PostTypeId="5" CreationDate="2018-03-28T21:29:12.323" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-28T21:29:12.323" LastActivityDate="2018-03-28T21:29:12.323" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1423" PostTypeId="4" CreationDate="2018-03-28T21:29:12.323" Score="0" Body="Grover's search algorithm is an algorithm that can perform a search in the order of square root of the input size. This is a provable speed up over the best classical algorithm, which requires a time of order N to perform a search." OwnerUserId="23" LastEditorUserId="26" LastEditDate="2019-01-01T08:53:28.327" LastActivityDate="2019-01-01T08:53:28.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1424" PostTypeId="2" ParentId="1356" CreationDate="2018-03-28T21:41:34.270" Score="4" Body="&lt;p&gt;There is a good mathematical answer already, so I'll try and provide an easy-to-understand one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum error correction (QEC) is a (group of) rather complex algorithm(s), that requires a lot of actions (gates) on and between qubits. In QEC, you pretty much connect two qubits to a third helper-qubit (ancilla) and transfer the information if the other two are equal (in some specific regard) into that third qubit. Then you read that information out of the ancialla. If it tells you, that they are not equal, you act on that information (apply a correction). So how can that go wrong if our qubits and gates are not perfect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QEC can make the information stored in your qubits decay.&lt;/strong&gt; Each of these gates can decay the information stored in them, if they are not executed perfectly. So if just executing the QEC destroys more information than it recovers on average, it's useless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You think you found an error, but you didn't.&lt;/strong&gt; If the comparison (execution of gates) or the readout of the information (ancilla) is imperfect, you might obtain wrong information and thus apply &quot;wrong corrections&quot; (read: introduce errors). Also if the information in the ancillas decays (or is changed by noise) before you can read it out, you will also get wrong readout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of every QEC is obviously to introduce less errors than it corrects for, so you need to minimize the aforementioned effects. If you do all the math, you find pretty strict requirements on your qubits, gates and readouts (depending on the exact QEC algorithm you chose).&lt;/p&gt;&#xA;" OwnerUserId="689" LastEditorUserId="689" LastEditDate="2018-05-25T14:17:09.730" LastActivityDate="2018-05-25T14:17:09.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1425" PostTypeId="2" ParentId="1410" CreationDate="2018-03-28T21:46:16.700" Score="8" Body="&lt;p&gt;No, the computational basis &lt;em&gt;does not&lt;/em&gt; have any special meaning, it is just the basis that is &quot;most natural&quot; in a given context, and is conventionally denoted with $|0\rangle$ and $|1\rangle$ in the case of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give a few examples:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the qubits are encoded into the polarization of single photons, the computational basis is typically the basis formed by the horizontal and vertical polarization states of the photon.&lt;/li&gt;&#xA;&lt;li&gt;If the qubits are encoded into the spins of something like ions, atoms or electrons, then the &quot;computational basis&quot; is typically assumed to be the basis of the eigenstates of the $S_z$, that is, the spin angular momentum the vertical direction (of course, what &quot;vertical&quot; means also depends on the context).&lt;/li&gt;&#xA;&lt;li&gt;If a qubit is encoded into the presence or absence of a photon in a given mode, then the &quot;computational basis&quot; is, well, the occupational state of that mode.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I could go on.&#xA;One also often speaks of &quot;computational basis&quot; for higher-dimensional states (qudits), in which case the same applies: a basis is called &quot;computational&quot; when it's the most &quot;natural&quot; in a given context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a purely theoretical point of view, the &quot;computational basis&quot; is nothing but &lt;em&gt;some basis&lt;/em&gt; that is usually denoted with $\{|0\rangle, |1\rangle,...\}$, to distinguish it from some other basis having some relation with it.&#xA;It is fundamental to understand that from a purely theoretical point of view, all bases are equivalent to each other, and they only acquire meaning when one decides that a given basis represents a specific set of states of some physical system.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-03-28T21:46:16.700" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1426" PostTypeId="1" CreationDate="2018-03-28T22:32:44.897" Score="14" ViewCount="428" Body="&lt;p&gt;My understanding is that the magnetic fields needed to hold the ions in place in ion trap quantum computers are very complex, and for that reason, currently, only 1-D computers are possible, therefore reducing the ease of communication between qubits. There does seem to be a proposition for a 2-d system using a Paul trap &lt;a href=&quot;https://arxiv.org/pdf/1408.6659.pdf&quot; rel=&quot;noreferrer&quot;&gt;in this preprint&lt;/a&gt; but I can't seem to find if this has actually been tested.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the scalability of ion trap quantum computers depend upon this alone (whether or not the ions can be arranged in configurations other than a straight line) or are other factors entailed? If the former, what progress has been made? If the latter, what are the other factors?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="1847" LastEditDate="2018-04-19T06:20:43.913" LastActivityDate="2018-04-19T06:20:43.913" Title="Scalability of ion trap quantum computers" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;experiment&gt;&lt;ion-trap-quantum-computing&gt;&lt;scalability&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1428" PostTypeId="1" AcceptedAnswerId="1432" CreationDate="2018-03-28T23:25:26.580" Score="15" ViewCount="3841" Body="&lt;p&gt;Google recently announced the &lt;em&gt;Bristlecone&lt;/em&gt; 72 qubit quantum computer.&#xA;However, D-Wave already announced quantum computers featuring more than $2000$ qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is Google's new device newsworthy then? Is it better than D-Wave's machine in some respects? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="1086" LastEditorUserId="26" LastEditDate="2018-03-29T04:44:13.713" LastActivityDate="2018-04-05T05:47:08.257" Title="Is Google's 72 qubit device better than D-Wave's machines, which feature more than 2000 qubits?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;performance&gt;&lt;d-wave&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ClosedDate="2018-03-31T11:53:29.730" ContentLicense="CC BY-SA 3.0" />
  <row Id="1429" PostTypeId="1" AcceptedAnswerId="1480" CreationDate="2018-03-28T23:26:41.120" Score="17" ViewCount="997" Body="&lt;p&gt;I've heard the term &lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;Topological Quantum Computer&lt;/a&gt; a few times now and know that it is equivalent to quantum computers using circuits with respect to some polynomial-time reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is totally unclear to me how such a quantum computer differs from others, how it works, and what its strengths are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: how is a &lt;em&gt;topological quantum computer&lt;/em&gt; different than other models, such as gate-based quantum computers and what are the specific use cases for that it is better suited than other models?&lt;/p&gt;&#xA;" OwnerUserId="673" LastEditorUserId="26" LastEditDate="2019-05-01T14:52:39.890" LastActivityDate="2019-05-17T22:15:41.673" Title="How does topological quantum computing differ from other models of quantum computing?" Tags="&lt;models&gt;&lt;topological-quantum-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1430" PostTypeId="2" ParentId="1419" CreationDate="2018-03-28T23:43:48.213" Score="6" Body="&lt;p&gt;$\newcommand{\xtarget}{\boldsymbol{x}_{\operatorname{target}}}\newcommand{\bs}[1]{{\boldsymbol #1}}\newcommand{\on}[1]{{\operatorname{#1}}}$No, it does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;&lt;em&gt;oracle&lt;/em&gt;&quot; in Grover's algorithm is a function that, given any element $\boldsymbol x_k$, checks whether $\boldsymbol x_k$ is the element we are looking for, say $\xtarget$.&#xA;To do this, &lt;em&gt;the oracle does not need any knowledge of all the other elements $x_j$ that are in the database&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may help to consider a more concrete example.&#xA;Say you have a database of $20000$ four-digit phone numbers, with $\boldsymbol x_k$ denoting the $k$-th element in this database.&#xA;You are interested in knowing what position in the database corresponds to the element $1234$.&#xA;Let us assume that the element 10000 of the database is the only such element, that is, $\bs x_{10000}=1234$ and $\bs x_k\neq 1234$ for all $k\neq10000$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the classical case, being the database unsorted, there is no better way than going through every single element in the database, checking each one against the target $1234$.&#xA;To do this, you only require to have an algorithm that, given $\bs x_k$, returns $\on{yes}$ if $\bs x_k=1234$ and $\on{no}$ otherwise.&#xA;An equivalent way to state this problem is to say that we want an algorithm which, given a list of pairs $\{(k,\bs x_k)\}_{k=1}^{20000}$, returns the pair such that $\bs x_k$ is what we want.&#xA;Thus, in our case, we want an algorithm which given $\{(k,\bs x_k)\}_{k=1}^{20000}$ returns $(10000,\bs x_{10000}=1234)$.&#xA;Note that this means that the function checking each pair &lt;em&gt;only checks for features of a part of the state&lt;/em&gt;, namely, the $\bs x_k$ part.&#xA;Indeed, if this was not the case, the whole thing would be pointless because we wouldn't be recovering any information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last framing of the problem is the one that one should keep in mind while thinking about Grover's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the quantum case, &lt;em&gt;the pairs&lt;/em&gt; $(k, \bs x_k)$ become the quantum states $|\psi_k\rangle$ (or just $|k\rangle$ how they are usually denoted), and the oracular function &lt;em&gt;only checks that part of the information stored in $|\psi_k\rangle$ matches the target&lt;/em&gt;.&#xA;The output of the procedure is the state $|\psi_{10000}\rangle$.&#xA;Now, &lt;em&gt;part of this state we already know&lt;/em&gt;, because it was hardcoded in the oracle: we know that the second part of the information encoded in $|\psi_{10000}\rangle$ is $1234$, because that is what we were looking for in the first place, and is the information that was encoded into the oracle itself.&#xA;&lt;em&gt;However&lt;/em&gt;, the state $|\psi_{10000}\rangle$ &lt;em&gt;also carries additional information&lt;/em&gt;, namely the position in the database: $10000$.&#xA;&lt;strong&gt;&lt;em&gt;This information was not used to build the oracle&lt;/em&gt;&lt;/strong&gt;, and is the information that we gain by running the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, note that the oracle knows nothing about the content of the full database. It only implements coherently a function that checks &lt;em&gt;a single state&lt;/em&gt; $|\psi_k\rangle$ against its target.&#xA;However, the fact that this gate works coherently means that one can input to this &lt;em&gt;checker&lt;/em&gt; function a superposition of many (possibly all of the) elements of the database, and obtain an output which contains some &lt;em&gt;global information&lt;/em&gt; about all the elements in the database.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-04-26T17:53:45.153" LastActivityDate="2018-04-26T17:53:45.153" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1431" PostTypeId="2" ParentId="1413" CreationDate="2018-03-29T00:44:39.327" Score="9" Body="&lt;p&gt;I think you can use the &lt;code&gt;initialize&lt;/code&gt; function as detailed at the section &amp;quot;Arbitrary Initialization&amp;quot; at &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/circuits/3_summary_of_quantum_operations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As an example, this tutorial explicitly shows how to initialize the three qubit state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{i}{\sqrt{16}} | 000 \rangle + \frac{1}{\sqrt{8}} | 001 \rangle +  \frac{1+i}{\sqrt{16}} | 010 \rangle + \frac{1+2i}{\sqrt{8}} | 101 \rangle + \frac{1}{\sqrt{16}} | 110 \rangle .$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is done using the following lines of QISKit code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;desired_vector = [&#xA;    1 / math.sqrt(16) * complex(0, 1),&#xA;    1 / math.sqrt(8) * complex(1, 0),&#xA;    1 / math.sqrt(16) * complex(1, 1),&#xA;    0,&#xA;    0,&#xA;    1 / math.sqrt(8) * complex(1, 2),&#xA;    1 / math.sqrt(16) * complex(1, 0),&#xA;    0]&#xA;initialize_circuit_3q = Q_program.create_circuit('initialize_circuit_3q', [qr], [cr])&#xA;initialize_circuit_3q.initialize(&amp;quot;init&amp;quot;, desired_vector, [qr[0],qr[1],qr[2]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1092" LastEditorUserId="10388" LastEditDate="2020-07-21T15:55:18.507" LastActivityDate="2020-07-21T15:55:18.507" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1432" PostTypeId="2" ParentId="1428" CreationDate="2018-03-29T00:52:56.110" Score="13" Body="&lt;p&gt;&lt;strong&gt;Short explanation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave implements &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;quantum annealing&lt;/a&gt;, while Google has &lt;a href=&quot;https://arxiv.org/abs/1511.03316&quot; rel=&quot;noreferrer&quot;&gt;digitized adiabatic quantum computation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Lengthy Explanation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave advertises their line of quantum computers as having thousands of qubits, though these systems are designed specifically for quadratic unconstrained binary optimization. More information &lt;a href=&quot;https://www.dwavesys.com/tutorials/background-reading-series/introduction-d-wave-quantum-hardware#h2-3&quot; rel=&quot;noreferrer&quot;&gt;about D-Wave's manufacturing&lt;/a&gt; process. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is &lt;a href=&quot;https://www.dwavesys.com/quantum-computing&quot; rel=&quot;noreferrer&quot;&gt;D-Wave's claim&lt;/a&gt; that: &quot;It is best suited to tackling complex optimization problems that exist across many domains such as&quot;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Optimization &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Machine learning &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampling / Monte Carlo&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pattern recognition and anomaly detection &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Cyber security &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Image analysis &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Financial analysis &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Software / hardware verification and validation &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bioinformatics / cancer research&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;D-Wave's &lt;a href=&quot;https://www.dwavesys.com/tutorials/background-reading-series/introduction-d-wave-quantum-hardware#h2-4&quot; rel=&quot;noreferrer&quot;&gt;QPU&lt;/a&gt; uses &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;quantum annealing&lt;/a&gt; (QA), a metaheuristic for finding the global minimum of a given objective function over a given set of candidate solutions (candidate states), by a process using quantum fluctuations. Quantum annealing is used mainly for problems where the search space is discrete (combinatorial optimization problems) with many local minima; such as finding the ground state of a spin glass.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing#Implementations&quot; rel=&quot;noreferrer&quot;&gt;D-Wave's architecture differs from traditional quantum computers&lt;/a&gt;. It is not known to be polynomially equivalent to a universal quantum computer and, in particular, cannot execute Shor's algorithm because Shor's Algorithm is not a hillclimbing process. Shor's Algorithm requires a universal quantum computer. D-wave claims only to do quantum annealing.[citation needed]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/srep11168&quot; rel=&quot;noreferrer&quot;&gt;Experimental quantum annealing: case study involving the graph isomorphism problem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41598-018-22763-2&quot; rel=&quot;noreferrer&quot;&gt;Defects in Quantum Computers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://research.googleblog.com/2018/03/a-preview-of-bristlecone-googles-new.html&quot; rel=&quot;noreferrer&quot;&gt;Google's claim is&lt;/a&gt;: &quot;The goal of the Google Quantum AI lab is to build a quantum computer that can be used to solve real-world problems. Our strategy is to explore near-term applications using systems that are forward compatible to a large-scale universal error-corrected quantum computer using linear array technology&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://www.nature.com/articles/nature14270&quot; rel=&quot;noreferrer&quot;&gt;State preservation by repetitive error detection in a superconducting quantum circuit&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://www.nature.com/articles/nature17658&quot; rel=&quot;noreferrer&quot;&gt;Digitized adiabatic quantum computing with a superconducting circuit&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Inaccurate layperson' explanation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Graphic Card has more Cores than a CPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GPUs are optimized for taking huge batches of data and performing the same operation over and over very quickly, unlike PC microprocessors, which tend to skip all over the place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Architecturally, the CPU is composed of just few cores with lots of cache memory that can handle a few software threads at a time. In contrast, a GPU is composed of hundreds of cores that can handle thousands of threads simultaneously. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Technical, but not overly complicated, layperson's explanation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is Google's new device newsworthy then? Is it better than D-Wave's machine in some respects? If so, how?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are &quot;Annealing QPUs&quot; and &quot;Universal QPUs&quot; as explained above, an incomplete list is offered on Wikipedia's page: &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;noreferrer&quot;&gt;List of Quantum Processors&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;quantum annealing&lt;/a&gt;, the strength of transverse field determines the quantum-mechanical probability to change the amplitudes of all states in parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of annealing a purely mathematical objective function, one may consider the variables in the problem to be classical degrees of freedom, and the cost functions to be the potential energy function (classical Hamiltonian). Moreover, it may be able to do this without the tight error controls needed to harness the quantum entanglement used in more traditional quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That makes it easier to provide more qubits, but the kinds of problems they are able to solve is more limited than the qubits provided in a universal QPU.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general the ground state of a Hamiltonian can be used to encode a wider variety of problems than NP (know QMA-complete problems), and so decision to focus on NP optimization problems has led to restrictions which prevent the device from being used for general purpose quantum computing (even if noise was not an issue). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an interesting subtlety as regards noise: If you add noise to the adiabatic algorithm, it degrades gracefully into one of the best classical algorithms for the same problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adiabatic model can encode universal quantum computation, however the limitations of DWave's implementation means that specific machine cannot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://research.googleblog.com/2018/03/a-preview-of-bristlecone-googles-new.html?m=1&quot; rel=&quot;noreferrer&quot;&gt;Google's universal QPU&lt;/a&gt; can solve a wider range of problems than D-Wave's QPU (in it's current implementation) if they can solve their decoherence problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Google's Bristlecone caution is warranted. Bristlecone is a scaled up version of a 9-qubit Google design that has failed to yield acceptable error rates for a commercially viable quantum system. In real-world settings, quantum processors must have a two-qubit error rate of less than 0.5 percent. According to Google, its best result has been a 0.6 percent error rate using its much smaller 9-qubit hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The commercial success of quantum computing will require more than high qubit numbers. It will depend on quality qubits with low error rates and long-lasting circuit connectivity in a system with the ability to outperform classic computers in complex problem solving, i.e., “quantum supremacy”. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google will use it's record number of more useful qubits to correct the error rate of those error prone qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More qubits are needed to solve bigger problems and longer living (coherent) qubits to are needed to hold the information long enough for the quantum algorithm to run. IBM describes the problem as: &quot;Quantum Volume: preferring fewer errors per qubit over more qubits&quot;, see also: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1226/what-is-the-leading-edge-technology-for-creating-a-quantum-computer-with-the-few&quot;&gt;What is the leading edge technology for creating a quantum computer with the fewest errors?&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google plans to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Toric_code&quot; rel=&quot;noreferrer&quot;&gt;Surface Codes&lt;/a&gt; to resolve this problem, for more info and a comparison to spin glass models see: &quot;&lt;a href=&quot;https://arxiv.org/abs/1504.01444&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computation with Topological Codes: from qubit to topological fault-tolerance&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IBM has a video titled: &quot;&lt;a href=&quot;https://www.youtube.com/watch?v=S52rxZG-zi0&quot; rel=&quot;noreferrer&quot;&gt;A Beginner’s Guide to Quantum Computing&lt;/a&gt;&quot; which explains quantum computing for laypersons in under 20 minutes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.microsoft.com/en-us/research/group/microsoft-quantum-santa-barbara-station-q/&quot; rel=&quot;noreferrer&quot;&gt;Microsoft&lt;/a&gt; intends to take the wind from everyone's sails with the integration of Q# (Q sharp) into Visual Studio and some information about their Majorana fermion based qubits, and a great reduction in the error rate, in the months to come. See: &quot;&lt;a href=&quot;https://arxiv.org/abs/1712.02353&quot; rel=&quot;noreferrer&quot;&gt;Majorana-based fermionic quantum computation&lt;/a&gt;&quot;. The will enable a system that uses less than 25% as many better qubits to accomplish the same amount of work as Google's qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The website &quot;The Next Platform&quot; describes the current situation as: &quot;&lt;a href=&quot;https://www.nextplatform.com/2018/01/10/quantum-computing-enters-2018-like-1968/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing Enters 2018 Like it's 1968&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2018-04-05T05:47:08.257" LastActivityDate="2018-04-05T05:47:08.257" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1435" PostTypeId="2" ParentId="1428" CreationDate="2018-03-29T02:46:41.343" Score="12" Body="&lt;p&gt;There are two points I'd make here.&lt;/p&gt;&#xA;&lt;h3&gt;D-Wave's computer and Google's computer are fundamentally different.&lt;/h3&gt;&#xA;&lt;p&gt;D-Wave's computer is a quantum annealer. Imagine a landscape with some grassy hills. If you put a ball at the top of the hill, it will roll to a local minima, or even the minimum - in this case, a valley. Similarly, a quantum annealer has the qubits as the ball and a polynomial as the landscape. It has the advantage that effects like quantum tunneling help make the process more efficient.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, Google's computer is gate based. Much like a digital classical computer, it has qubits and gates that are then applied to those qubits. This means that they are optimized, in some senses, for different types of problems. It's like comparing apples and oranges - not totally equivalent.&lt;/p&gt;&#xA;&lt;h3&gt;Just because you have a lot of qubits doesn't mean they are good qubits.&lt;/h3&gt;&#xA;&lt;p&gt;A lot of the controversy surrounding D-Wave has been because it has been called into question whether or not D-Wave's qubits actually exhibit quantum effects. (It hasn't really helped that D-Wave has...overhyped their successes a bit along the way.) You can have a ton of qubits, but if they aren't actually coherent for a long enough length of time, it's not really useful.&lt;/p&gt;&#xA;&lt;p&gt;Google's qubits are definitely coherent for a reasonable period of time. We don't 100% know about D-Wave's.&lt;/p&gt;&#xA;&lt;h3&gt;Tl;dr: both are different in how they work and in their problems.&lt;/h3&gt;&#xA;&lt;p&gt;Both are notable in their own ways.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-03-29T02:46:41.343" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1436" PostTypeId="2" ParentId="1410" CreationDate="2018-03-29T03:35:47.207" Score="11" Body="&lt;p&gt;Quantum computing deals (mostly) with finite-dimensional quantum systems called &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;noreferrer&quot;&gt;qubits&lt;/a&gt;. If you know basic quantum mechanics then you know that the Hilbert space of a qubit is $\mathbb{C}^2$, i.e., the two-dimensional complex Hilbert space over $\mathbb{C}$ (for the more technical people, the Hilbert space is actually $\mathbb{C}P^1$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, to describe the vectors (or physically, the quantum state of the qubit) in this two-dimensional Hilbert space  we need at least two basis elements. If you think of the state of the qubit as a column vector, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${{\bigl [}{\begin{smallmatrix}a\\b\end{smallmatrix}}{\bigr ]}},$$ then you would need to specify what $a,b$ are to specify the state of the qubit. Note that what $a,b$ are depends on what the basis of the system is $-$ there can be two different looking column vectors (in different bases) that represent the same state $|\psi\rangle$ of the qubit. In any case, we need some basis to work with and this is where the &quot;computational basis&quot; comes into play. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computational basis is simply the two basis states composed by (any of) the two &lt;em&gt;distinct&lt;/em&gt; quantum states that the qubit can be in physically. However, just like in linear algebra, which two (&lt;em&gt;linearly independent&lt;/em&gt;) states you choose is kinda arbitrary (I say kinda because in some physical situations there is a natural choice of the basis; see &lt;a href=&quot;https://en.wikipedia.org/wiki/Einselection&quot; rel=&quot;noreferrer&quot; title=&quot;einselection&quot;&gt;Einselection&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you have an electron in a magnetic field (pointing in the z-axis say), then the states of the spin pointing upwards and downwards in the z-axis are a typical choice for the computational basis $-$ this is clearly not the only choice, since the z-axis can point in any arbitrary direction. These two states, the $|\uparrow\rangle$ and $|\downarrow\rangle$ pointing states of the spin of the electron are the eigenstates of the $\sigma_z$ (Pauli-z) operator and are usually called the &quot;computational basis&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2018-03-29T03:35:47.207" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1437" PostTypeId="1" AcceptedAnswerId="1443" CreationDate="2018-03-29T04:49:20.043" Score="9" ViewCount="470" Body="&lt;p&gt;I've been browsing &lt;a href=&quot;https://www.dwavesys.com/d-wave-two-system&quot; rel=&quot;noreferrer&quot;&gt;The D-Wave 2000Q site&lt;/a&gt; when I bumped into this aspect of their quantum computers:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A Unique Processor Environment&lt;/p&gt;&#xA;&lt;p&gt;Shielded to 50,000× less than Earth’s magnetic field&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Why is that relevant? What would happen if it would be much less than 50.000x?&lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-02T15:18:53.230" Title="Is it important for a quantum computer to be shielded by the magnetic field?" Tags="&lt;physical-realization&gt;&lt;d-wave&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1438" PostTypeId="2" ParentId="1437" CreationDate="2018-03-29T05:00:46.437" Score="3" Body="&lt;p&gt;It is relevant to reduce the quantum noise in the system. If the shield strength is more than 50,000x, better the quantum computing system is shielded from the earth's magnetic field and thus better quantum noise reduction.&lt;s&gt;, at least, theoretically.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;&lt;em&gt;Superposition&lt;/em&gt; is the heart of quantum computing. Superposition state is susceptible to fluctuating external magnetic fields, thermal fluctuations, radiowave etc., The quantum processor should be in an space where the magnetic field is uniform and stable to avoid quantum noise introduced by the above mentioned factors. Thus, isolating the quantum computing system from its disturbing environment is mandatory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Achieving a ideal quantum noise free environment is still a daunting task. However, progress made thus far has brought us to experimental realizations of quantum computers. Shielding more than 50,000x earth's magnetic field would reduce the quantum noise induced by earth's magnetic field.&lt;/p&gt;&#xA;" OwnerUserId="812" LastEditorUserId="812" LastEditDate="2018-03-29T05:33:37.027" LastActivityDate="2018-03-29T05:33:37.027" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1439" PostTypeId="1" AcceptedAnswerId="1456" CreationDate="2018-03-29T05:32:43.053" Score="6" ViewCount="221" Body="&lt;p&gt;Quantum computers have shown a new way to compute old problems. D-Wave  has a quantum annealer, and &lt;a href=&quot;https://en.wikipedia.org/wiki/D-Wave_Two&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; describes the D-Wave quantum computer and its use of quantum annealing properties. Hardware wise, how does D-Wave achieve quantum annealing? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be many ways to achieve quantum annealing. D-Wave, being first on the market with quantum annealing hardware, therefore is open to more scrutiny (is their hardware open to such scrutiny?) Does D-Wave use a specific type of annealing at the atomic level (there could be one of many ways to achieve quantum annealing), or (in other words) are there many ways to achieve quantum annealing? &lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="26" LastEditDate="2019-05-17T22:11:33.370" LastActivityDate="2019-05-17T22:11:33.370" Title="Hardware wise, how does D-Wave achieve quantum annealing?" Tags="&lt;architecture&gt;&lt;d-wave&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1440" PostTypeId="1" AcceptedAnswerId="1442" CreationDate="2018-03-29T06:51:03.897" Score="17" ViewCount="1199" Body="&lt;p&gt;After reading the &quot;&lt;a href=&quot;http://www.bris.ac.uk/news/2011/8109.html&quot; rel=&quot;noreferrer&quot;&gt;first programmable quantum photonic chip&lt;/a&gt;&quot;. I was wondering just what software for a computer that uses quantum entanglement would be like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any example of code for specific quantum programming? Like pseudocode or high-level language? Specifically, what's the shortest program that can be used to create a Bell state $$\left|\psi\right&amp;gt; = \frac{1}{\sqrt 2} \left(\left|00\right&amp;gt; + \left|11\right&amp;gt; \right)$$ starting from a state initialised to $\left|\psi_0\right&amp;gt; = \left|00\right&amp;gt;$ using both a simulation and one of IBM's &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/experience&quot; rel=&quot;noreferrer&quot;&gt;Quantum Experience&lt;/a&gt; processors, such as the &lt;a href=&quot;https://github.com/QISKit/ibmqx-backend-information/blob/master/backends/ibmqx4/README.md&quot; rel=&quot;noreferrer&quot;&gt;ibmqx4&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making the conceptual jump from traditional programming to entanglement isn't that easy.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I've found C's &lt;a href=&quot;http://www.libquantum.de/&quot; rel=&quot;noreferrer&quot;&gt;libquantum&lt;/a&gt; too.&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="23" LastEditDate="2018-03-29T09:02:04.127" LastActivityDate="2019-05-17T22:08:43.717" Title="What would a very simple quantum program look like?" Tags="&lt;simulation&gt;&lt;ibm-q-experience&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1441" PostTypeId="1" AcceptedAnswerId="1591" CreationDate="2018-03-29T07:16:45.100" Score="11" ViewCount="690" Body="&lt;p&gt;In his celebrated paper &quot;&lt;a href=&quot;https://www.researchgate.net/publication/234782642_Conjugate_Coding&quot; rel=&quot;noreferrer&quot;&gt;Conjugate Coding&lt;/a&gt;&quot; (written around 1970), Stephen Wiesner proposed a scheme for quantum money that is unconditionally impossible to counterfeit, assuming that the issuing bank has access to a giant table of random numbers and that banknotes can be brought back to the bank for verification. In Wiesner's scheme, each banknote consists of a classical &quot;serial number&quot; $s$, together with a quantum money state $|\psi_s\rangle$ consisting of $n$ unentangled qubits, each one either&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|0\rangle,\ |1\rangle,\ |+\rangle=(|0\rangle+|1\rangle)/\sqrt{2},\ \text{or}\ |-\rangle=(|0\rangle-|1\rangle)/\sqrt{2}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bank remembers a classical description of $|\psi_s\rangle$ for every $s$.  And therefore, when $|\psi_s\rangle$ is brought back to the bank for verification, the bank can measure each qubit of $|\psi_s\rangle$ in the correct basis (either $\{|0\rangle,|1\rangle\}$ or $\{|+\rangle,|-\rangle\}$), and check that it gets the correct outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, because of the uncertainty relation (or alternatively, the No-Cloning Theorem), it's &quot;intuitively obvious&quot; that, if a counterfeiter who &lt;i&gt;doesn't&lt;/i&gt; know the correct bases tries to copy $|\psi_s\rangle$, then the probability that &lt;i&gt;both&lt;/i&gt; of the counterfeiter's output states pass the bank's verification test can be at most $c^n$, for some constant $c&amp;lt;1$.  Furthermore, this should be true regardless of what strategy the counterfeiter uses, consistent with quantum mechanics (e.g., even if the counterfeiter uses fancy entangled measurements on $|\psi_s\rangle$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, while writing a paper about other quantum money schemes, my coauthor and I realized that we'd never seen a rigorous proof of the above claim anywhere or an explicit upper bound on $c$: neither in Wiesner's original paper nor in any later one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;i&gt;has&lt;/i&gt; such a proof (with an upper bound on $c$) been published?  If not, then can one derive such a proof in a more-or-less straightforward way from (say) approximate versions of the No-Cloning Theorem, or results about the security of the BB84 quantum key distribution scheme?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should maybe clarify that I'm looking for more than just a reduction from the security of BB84.  Rather, I'm looking for an &lt;i&gt;explicit upper bound&lt;/i&gt; on the probability of successful counterfeiting (i.e., on $c$)---and ideally, also some understanding of what the optimal counterfeiting strategy looks like.  I.e., does the optimal strategy simply measure each qubit of $|\psi_s\rangle$ independently, say on the basis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\{ \cos(\pi/8)|0\rangle+\sin(\pi/8)|1\rangle, \sin(\pi/8)|0\rangle-\cos(\pi/8)|1\rangle \}?$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there an entangled counterfeiting strategy that does better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, the best counterfeiting strategies that I know are (a) the strategy above, and (b) the strategy that simply measures each qubit in the $\{|0\rangle,|1\rangle\}$ basis and &quot;hopes for the best.&quot;  Interestingly, &lt;i&gt;both&lt;/i&gt; of these strategies turn out to achieve a success probability of $(5/8)$&lt;sup&gt;$n$&lt;/sup&gt;.  So, my conjecture of the moment is that $(5/8)$&lt;sup&gt;$n$&lt;/sup&gt; might be the right answer.  In any case, the fact that $5/8$ is a &lt;i&gt;lower&lt;/i&gt; bound on c rules out any security argument for Wiesner's scheme that's &quot;too&quot; simple (for example, any argument to the effect that there's nothing nontrivial that a counterfeiter can do, and therefore the right answer is $c=1/2$).&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="26" LastEditDate="2019-05-17T21:57:53.180" LastActivityDate="2019-05-17T21:57:53.180" Title="Rigorous security proof for Wiesner's quantum money" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;cryptography&gt;&lt;cryptocurrency&gt;&lt;quantum-money&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1442" PostTypeId="2" ParentId="1440" CreationDate="2018-03-29T07:27:41.910" Score="13" Body="&lt;p&gt;Assuming you are considering a gate-based quantum computer, the most easy way to produce an entagled state is to produce one of the Bell states. The following circuit shows the Bell state $\left| \Phi^+ \right&amp;gt;$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GQxa8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GQxa8.png&quot; alt=&quot;Bellstate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By examining $\left| \psi_0 \right&amp;gt;$, $\left| \psi_1 \right&amp;gt;$ and $\left| \psi_2 \right&amp;gt;$ we can determine the entagled state after application of all gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1. $\left| \psi_0 \right&amp;gt;$:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not much happens here since no gates were applied at this point. The state of the whole system is therefore just the tensorproduct of the single states which we write like this:&#xA;$$&#xA;\left| \psi_0 \right&amp;gt; = \left | 0 0 \right &amp;gt; &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2. $\left| \psi_1 \right&amp;gt;$:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard-Gate applies on the first qubit which results in the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left| \psi_1 \right&amp;gt; =(H \otimes I)\left | 0 0 \right &amp;gt; = H\left | 0  \right &amp;gt; \otimes \left | 0 \right &amp;gt; = \frac{1}{\sqrt 2}  \left (\left | 0  \right &amp;gt; + \left | 1 \right &amp;gt; \right ) \left | 0 \right &amp;gt; = \frac{1}{\sqrt 2} \left (\left | 0 0 \right &amp;gt;  + \left | 1 0 \right &amp;gt;  \right )&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3. $\left| \psi_2 \right&amp;gt;$:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a CNOT gate is applied and flips the second qubit but only where the first one has the value 1. The result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left| \psi_2 \right&amp;gt; = \frac{1}{\sqrt 2} \left (\left | 0 0 \right &amp;gt;  + \left | 1 1 \right &amp;gt;  \right )&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last state $\left| \psi_2 \right&amp;gt;$ is an entagled state and usually the most natural way to come up with such a situation. Bell states occure in a lot of interesting quantum algorithms such as super dense coding or teleportation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the approach above might not seem like programming to you in a usual sense, applying gates to states is basically how programming a gate-based quantum computer works. There exists abstraction layers that allow you to perform high-level programming but translate the commands to the application of gates. The &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/qasm&quot; rel=&quot;noreferrer&quot;&gt;IBM Quantum Experience&lt;/a&gt; interface provides such features.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a language like Microsoft's Q# the above example could look similar to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation BellTest () : ()&#xA;{&#xA;    body&#xA;    {&#xA;        // Use two qubits&#xA;        using (qubits = Qubit[2])&#xA;        {&#xA;            Set (One, qubits[0]);&#xA;            Set (Zero, qubits[1]);&#xA;&#xA;            // Apply Hadamard gate to the first qubit&#xA;            H(qubits[0]);&#xA;&#xA;            // Apply CNOT gate&#xA;            CNOT(qubits[0],qubits[1]);&#xA;         }&#xA;     }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A more detailed version (including measurement) can be found here: &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-WriteAQuantumProgram?view=qsharp-preview&amp;amp;tabs=tabid-vs2017&quot; rel=&quot;noreferrer&quot;&gt;Microsoft: Writing a Quantum Program&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="673" LastEditorUserId="673" LastEditDate="2018-03-29T07:42:07.423" LastActivityDate="2018-03-29T07:42:07.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1443" PostTypeId="2" ParentId="1437" CreationDate="2018-03-29T07:36:25.467" Score="7" Body="&lt;p&gt;The DWave machine relies heavily on single-flux-quantum &lt;a href=&quot;https://arxiv.org/pdf/0907.3757.pdf&quot; rel=&quot;noreferrer&quot;&gt;digital control&lt;/a&gt; for setting up qubit and coupler operating points, and for carrying out the annealing protocol. Any stray magnetic flux, if present while the chip is cooled through its superconducting transition, will be &lt;a href=&quot;https://arxiv.org/pdf/1701.03837.pdf&quot; rel=&quot;noreferrer&quot;&gt;trapped&lt;/a&gt; inside the circuit and can cause it to fail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can calculate how much shielding you need by requiring the magnetic field inside the shield to be smaller than a &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Magnetic_flux_quantum&quot; rel=&quot;noreferrer&quot;&gt;flux quantum&lt;/a&gt; over the area of the chip. $B = \frac{\Phi_0}{A}$, where $\Phi_0 \sim 2 \cdot 10^{-15} ~ \text{Wb}$ is the flux quantum and $A$ is the area. If the area of the DWave chip is $(2 ~ \text{cm})^2$ (guessing) then $B \sim 5 ~ \text{pT}$. Earth’s field is about $0.25 ~ \mu \text{T}$ so you really want $\times 5 \cdot 10^6$ attenuation of the field. Shielding of 50,000 means that you will have on average about 100 flux quanta that can trap in the chip. Typically people add &lt;a href=&quot;https://www.researchgate.net/profile/Vladimir_Talanov/publication/282639553_Reproducible_Operating_Margins_on_a_72800-Device_Digital_Superconducting_Chip/links/57ae08c908ae0101f1727750.pdf&quot; rel=&quot;noreferrer&quot;&gt;trapping sites&lt;/a&gt; on the chip to sequester the remaining flux in safe areas. &lt;/p&gt;&#xA;" OwnerUserId="127" LastEditorUserId="580" LastEditDate="2018-03-29T20:18:07.207" LastActivityDate="2018-03-29T20:18:07.207" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1444" PostTypeId="2" ParentId="1440" CreationDate="2018-03-29T07:48:02.680" Score="15" Body="&lt;p&gt;One way of writing quantum programs is with QISKit. This can be used to run the programs on IBM's devices. The &lt;a href=&quot;https://www.qiskit.org/&quot; rel=&quot;noreferrer&quot;&gt;QISKit website&lt;/a&gt; suggests the following code snippet to get you going, which is an entangled circuit as you want. It is also the same process as in the answer by datell. I'll comment on it line-by-line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# import and initialize the method used to store quantum programs&#xA;from qiskit import QuantumProgram&#xA;qp = QuantumProgram()&#xA;# initialize a quantum register of two qubits&#xA;qr = qp.create_quantum_register('qr',2) &#xA;# and a classical register of two bits&#xA;cr = qp.create_classical_register('cr',2) &#xA;# create a circuit with them which we call 'Bell'&#xA;qc = qp.create_circuit('Bell',[qr],[cr]) &#xA;# apply a Hadamard to the first qubit&#xA;qc.h(qr[0]) &#xA;# apply a controlled not with the first qubit as control&#xA;qc.cx(qr[0], qr[1]) &#xA;# measure the first qubit and store its result on the first bit&#xA;qc.measure(qr[0], cr[0]) &#xA;# the same for the second qubit and bit&#xA;qc.measure(qr[1], cr[1]) &#xA;# run the circuit&#xA;result = qp.execute('Bell') &#xA;# extract the results&#xA;print(result.get_counts('Bell')) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the 'execute' command here only specifies the program to run. All other settings, such as the device you want to use, the number of times you want to repeat it to get statistics, etc are set to their default values. To run on &lt;em&gt;ibmqx4&lt;/em&gt; for 1024 shots, you can instead use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;results = qp.execute(['Bell'], backend='ibmqx4', shots=1024)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-29T09:08:34.100" LastActivityDate="2018-03-29T09:08:34.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1445" PostTypeId="2" ParentId="1426" CreationDate="2018-03-29T08:00:35.337" Score="8" Body="&lt;p&gt;Ion trap quantum computers hold ions in empty space using electric not magnetic fields. That is impossible using static fields (&lt;a href=&quot;https://en.wikipedia.org/wiki/Earnshaw%27s_theorem&quot; rel=&quot;noreferrer&quot;&gt;Earnshaw's theorem&lt;/a&gt;) so an alternating field is used. The effect is that charged particles such as ions seek a field minimum; this type of ion trap is also called a quadrupole trap because the simplest (lowest order) field having a minimum in space is a quadrupole field. It is simple to arrange fields that confine ions either to a point or to a line and ion trap quantumcomputers use the latter. Yet this does not scale because computations involve motional modes of the ions which become harder to distinguish when there are more ions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two approaches to make this approach scalable: Couple strings of ions either using light (photons) or by shuttling ions from one to another such linear ion trap section. Using photons is particularly difficult and far from currently workable for a quantum computer that meets an error correction threshold, so let's focus on shuttling ions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically true quadrupole traps cannot be built to have intersections but that hasn't stopped physicists from making them anyways. The trick is that, although one cannot arrange to have a quadrupole field at the center of the intersection, one can still have confinement. And by slightly driving ions into the confining (alternating) field using a static field, one can get sufficiently strong confinement. It has even been shown that such shuttling across an intersection is possible without significantly heating the ion (changing its motional state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With such intersections, ion traps are scalable.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-29T08:00:35.337" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1446" PostTypeId="2" ParentId="175" CreationDate="2018-03-29T08:19:37.717" Score="4" Body="&lt;p&gt;Well, Grover's original paper, &quot;Quantum mechanics helps in searching for a needle in a haystack&quot; clearly states, it &lt;strong&gt;assumes&lt;/strong&gt; that C(S) can be evaluated in a constant time. Grover's search is not concerned about the implementability, but the polynomial reduction in what's called a query complexity (how many times you consult the oracle, like a classical database)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, the concept of &lt;em&gt;oracle&lt;/em&gt; in computing was proposed by &lt;a href=&quot;https://en.wikipedia.org/wiki/Alan_Turing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Alan Turing&lt;/a&gt; to describe constructs for which a description on a UTM might not be realizable (Wikipedia). It &lt;strong&gt;is&lt;/strong&gt; in some sense magical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But of course, coming back to your question, how do we then actually make the circuit for Grover search (or any oracular) algorithm? Do we need to know the answer in advance to search the result? Well, in some sense you need to. That is exactly what clever improvements on Grover search tries to work on, such that, we need not know the exact answer in advance, but some properties of it. Let me illustrate with an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the pattern recognition problem using Grover's search, if I have 4 patterns on 2 qubits (00, 01, 10, 11) and I want to mark and amplify 11, the diagonal of my oracle unitary should be like (1,1,1,-1) to take care of the pi phase shift for the solution. So, for this simple implementation, for construction the unitary, you need to know the full answer in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A clever improvement of pattern completion if given in the paper &quot;Quantum pattern matching&quot; by Mateas and Omar. In essence, it constructs as many fixed oracles as there are alphabets in the set. So for our binary string, there will be an oracle which marks out all 1s, and another that marks out all 0s. The oracles are invoked conditionally based on what I want to search. If I want to search 11, I call oracle 1 on the LSqubit, and oracle 1 again on the MSqubit. By the first oracle, I would amplify the states (01, 11), i.e. states with LSQ as 1, and in the 2nd call, it would amplify (10, 11). So as you see, 11 is the only state that gets amplified twice, ending in a higher measurement probability. Though the compiled quantum circuit would change based on what my input search pattern is, a high-level description of the quantum algorithm remains the same. You can think of the oracles as function calls based on a switch case of the alphabet set invoked for each character in the search string.&lt;/p&gt;&#xA;" OwnerUserId="1153" LastEditorUserId="55" LastEditDate="2018-03-29T11:38:57.710" LastActivityDate="2018-03-29T11:38:57.710" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1447" PostTypeId="2" ParentId="1440" CreationDate="2018-03-29T08:59:30.063" Score="6" Body="&lt;p&gt;The simplest quantum program I can think of is a (1-bit) true random number generator. As a quantum circuit, it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HrUqf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HrUqf.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You first prepare a qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt;, then apply a Hadamard gate to produce the superposition &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{2}}{2} ( \left| 0 \right&amp;gt; + \left| 1 \right&amp;gt; )$&lt;/span&gt; which you then measure in the computational basis. The measurement's result is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, each with a probability of 50%.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="26" LastEditDate="2019-05-17T22:08:43.717" LastActivityDate="2019-05-17T22:08:43.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1448" PostTypeId="1" CreationDate="2018-03-29T09:27:19.713" Score="2" ViewCount="45" Body="&lt;p&gt;Consider an implementation of the Born-Jordan quantization or an arbitrary Cohen class time-frequency analysis algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any numerical differences between classical and quantum solutions? Would our visualizations of the data output change in any way? (Or perhaps, would we have to change the way we visualize the data?)&lt;/p&gt;&#xA;" OwnerUserId="1165" LastEditorUserId="55" LastEditDate="2018-03-29T12:25:39.417" LastActivityDate="2018-03-29T12:25:39.417" Title="Are there numerical differences between classical and quantum solutions of problems such as the Born-Jordan quantization?" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2018-03-29T19:14:54.537" ContentLicense="CC BY-SA 3.0" />
  <row Id="1449" PostTypeId="2" ParentId="20" CreationDate="2018-03-29T09:35:52.860" Score="4" Body="&lt;p&gt;Excellent question! You are asking if we can, given a property we want in a quantum system (for example superconductivity in a chemical compound), efficiently find one example of such a compound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, it is perhaps not yet a completely settled question if we can calculate such properties in the forward direction efficiently: Given a compound, does it superconduct? It is efficiently possible to simulate the temporal evolution from a given initial state and also to calculate its energy. There are several ideas that suggest it is also efficiently possible to calculate the interesting states (either the ground state or thermal states) and I believe this is possible but I want to emphasize that some details of these are still debated or not yet investigated academically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming we can efficiently calculate if a given compound fulfills your desires, one could start an exhaustive search over a number $N$ of compounds. Such a search can be accelerated by Grover's algorithm; even for the less straight-forward case that we have here, that an unknown number of solutions exist, this is possible in a number of compound-property calculations that scales with $\sqrt{N}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence you have a quantum speedup, likely exponential in the calculation of the desired properties of one chemical compound, and subexponential in the search among compounds.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-03-29T10:58:16.330" LastActivityDate="2018-03-29T10:58:16.330" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1451" PostTypeId="1" AcceptedAnswerId="1483" CreationDate="2018-03-29T10:43:05.193" Score="32" ViewCount="3293" Body="&lt;p&gt;I would like to know how a job for a D-Wave device is written in code and submitted to the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the answer it would be best to see a specific example of this for a simple problem. I guess that the &quot;Hello World&quot; of a &lt;a href=&quot;https://en.wikipedia.org/wiki/D-Wave_Systems&quot; rel=&quot;noreferrer&quot;&gt;D-Wave device&lt;/a&gt; would be something like finding the ground states of a &lt;a href=&quot;https://www.triplespark.net/sim/isingmag/&quot; rel=&quot;noreferrer&quot;&gt;simple 2D Ising model&lt;/a&gt;, since this is the kind of problem directly realized by the hardware. So perhaps this would be a nice example to see. But if those with expertise thing an alternative example would be suitable, I'd be happy to see an alternative.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-29T12:43:39.983" LastActivityDate="2019-05-13T21:18:16.670" Title="How do you write a simple program for a D-Wave device?" Tags="&lt;d-wave&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="13" ContentLicense="CC BY-SA 3.0" />
  <row Id="1452" PostTypeId="2" ParentId="4" CreationDate="2018-03-29T10:43:33.000" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How does the quantum gate &lt;em&gt;affect&lt;/em&gt; (not necessarily change it) the&#xA;  result of measuring the state of the qubits (as the measurement result&#xA;  is affected greatly by the probabilities of each possible state)? More&#xA;  specifically, is it possible to know, in advance, how the&#xA;  probabilities of each state change due to the quantum gate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let's try to approach this with an example and some geometry. Consider a single qubit, whose Hilbert space is $\mathbb{C}^2$, i.e., the two-dimensional complex Hilbert space over $\mathbb{C}$ (for the more technical people, the Hilbert space is actually $\mathbb{C}P^1$). It turns out that $\mathbb{C}P^1 \cong S^2$, the unit sphere, also known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;. This translates into the fact that all states of a qubit can be represented (&lt;em&gt;uniquely&lt;/em&gt;) on the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cPken.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cPken.png&quot; alt=&quot;Quantum states on the Bloch sphere&quot;&gt;&lt;/a&gt;&#xA;Source: Wikipedia&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state of a qubit can be represented on the Bloch sphere as ${\displaystyle |\psi \rangle =\cos \left({\frac {\theta }{2}}\right)|0\rangle \,+\,e^{i\phi }\sin \left({\frac {\theta }{2}}\right)|1\rangle}$, where $0 \leq \theta \leq \pi$ and $0 \leq \phi &amp;lt; 2 \pi$. Here, $|0\rangle = {{\bigl [}{\begin{smallmatrix}1\\0\end{smallmatrix}}{\bigr ]}}$ and $|1\rangle = {{\bigl [}{\begin{smallmatrix}0\\1\end{smallmatrix}}{\bigr ]}}$ are the two basis states (represented in the figure at the north and south pole respectively). So the states of the qubit are nothing but column vectors, which are identified with (unique) points on the sphere.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are quantum gates?&#xA;These are unitary operators, $U$ s.t., $U U^\dagger = U^\dagger U = \mathbb{I}$. Gates on a single qubit are elements of $SU(2)$. Consider a simple gate like $Y$ (which stands for the Pauli matrix $\sigma_y :=  Y = \begin{bmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{bmatrix}$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does this gate act on a qubit and &lt;em&gt;affect&lt;/em&gt; the measurement outcomes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you begin with a qubit in the state $|0\rangle$, i.e., at the north pole on the Bloch sphere. You apply a unitary of the form $U = e^{-i \gamma Y}$ where $\gamma \in \mathbb{R}$. Using properties of the Pauli matrix, we get $U = e^{-i \gamma Y} = cos(\gamma) \mathbb{I} -i sin(\gamma) Y$. The action of this operator is to rotate the state by an angle $2 \gamma$ along the y-axis and therefore if we choose $\gamma = \pi/2$, the qubit $|0\rangle \rightarrow U|0\rangle = |1\rangle$. That is to say, given we know what unitary we are applying to our state, we completely know the way in which our initial state will transform and hence we know how the measurement probabilities would change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if we were to make a measurement in the $\{|0\rangle, |1\rangle\}$ basis, initially, one would get the state $|0\rangle$ with probability 1; after applying the unitary, one would get the state $|1\rangle$ with probability 1.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2018-03-29T10:43:33.000" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1453" PostTypeId="2" ParentId="135" CreationDate="2018-03-29T12:28:00.970" Score="3" Body="&lt;p&gt;Whilst I cannot supply a formal proof, the simulation of (the temporal evolution) of a quantum system is believed to be such a case: There is no known better way to do this on a classical computer than in exponential time but a quantum computer can trivially do it in polynomial time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea of such a quantum simulator (see also &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia article&lt;/a&gt;) is in fact how quantum computers got first proposed.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-03-29T12:36:24.870" LastActivityDate="2018-03-29T12:36:24.870" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1454" PostTypeId="2" ParentId="1451" CreationDate="2018-03-29T12:33:44.610" Score="9" Body="&lt;p&gt;The title and question body seem to ask two different questions. In the title you ask &quot;How do you write a simple program for a D-Wave device?&quot;, while in the question body you ask how to find the ground states of a simple 2D Ising model using the underlying hardware of the D-Wave device, and what the corresponding code would be (which is a more specific question).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will answer the former, since it is the more general question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the &lt;a href=&quot;https://www.dwavesys.com/software&quot; rel=&quot;noreferrer&quot;&gt;D-Wave Software page&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The D-Wave 2000Q system provides a standard Internet API (based on&#xA;  RESTful services), with client libraries available for C/C++, Python,&#xA;  and MATLAB. This interface allows users to access the system either as&#xA;  a cloud resource over a network, or integrated into their&#xA;  high-performance computing (HPC) environments and data centers. Access&#xA;  is also available through D-Wave’s hosted cloud service. Using D-Wave’s development tools and client libraries, developers can create&#xA;  algorithms and applications within their existing environments using&#xA;  industry-standard tools. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;While users can submit problems to the system in a number of different&#xA;  ways, ultimately a problem represents a set of values that correspond&#xA;  to the weights of the qubits and the strength of the couplers. The&#xA;  system takes these values along with other user-specified parameters&#xA;  and sends a single quantum machine instruction (QMI) to the QPU.&#xA;  Problem solutions correspond to the optimal configuration of qubits&#xA;  found; that is, the lowest points in the energy landscape. These&#xA;  values are returned to the user program over the network.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Because quantum computers are probabilistic rather than deterministic,&#xA;  multiple values can be returned, providing not only the best solution&#xA;  found, but also other very good alternatives from which to choose.&#xA;  Users can specify the number of solutions they want the system to&#xA;  return.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Users can submit problems to the D-Wave quantum computer in several ways:&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Using a program in C, C++, Python, or MATLAB to create and execute QMIs&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Using a D-Wave tool such as:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;QSage&lt;/strong&gt;, a translator designed for optimization problems&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;ToQ&lt;/strong&gt;, a high level language translator used for constraint &#xA;  satisfaction &#xA;  problems and designed to let users “speak” in the language of their &#xA;  problem domain&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;qbsolv&lt;/strong&gt;, an open-source, hybrid partitioning optimization solver for &#xA;  problems that are larger than will fit natively on the QPU. Qbsolv can&lt;br&gt;&#xA;  be downloaded &lt;a href=&quot;https://github.com/dwavesystems/qbsolv&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;dw&lt;/strong&gt;, which executes QMIs created via a text editor&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;By directly programming the system via QMIs&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://www.dwavesys.com/sites/default/files/Map%20Coloring%20WP2.pdf&quot; rel=&quot;noreferrer&quot;&gt;Download this white paper&lt;/a&gt; to learn more about the programming model for a D-Wave system&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-03-29T12:33:44.610" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1455" PostTypeId="2" ParentId="1451" CreationDate="2018-03-29T12:56:10.520" Score="5" Body="&lt;p&gt;The inputs to the D-Wave are a list of interactions and more recently the annealing time of the qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you mentioned the Ising problem is one of the easiest with &lt;span class=&quot;math-container&quot;&gt;$J_{ij} = 1$&lt;/span&gt; in the problem Hamiltonian however it's not very interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend the appendices in &lt;a href=&quot;https://arxiv.org/abs/1505.01545&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for a concise description of how the D-Wave hardware operates. (Full disclosure: I'm a coauthor.)&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="26" LastEditDate="2019-05-13T21:18:16.670" LastActivityDate="2019-05-13T21:18:16.670" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1456" PostTypeId="2" ParentId="1439" CreationDate="2018-03-29T13:10:48.397" Score="3" Body="&lt;p&gt;Quantum annealing as defined by Chakrabarti 1981 and later implemented by Kadowaki and Nishimori 1998 uses a varying transverse magnetic field to facilitate tunneling through the energy landscape of an optimization problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system is prepared in the ground state of a Hamiltonian and then the transverse field is applied and slowly reduced (adiabatically) while the problem Hamiltonian is simultaneously 'turned on'. If this is done correctly, the system will remain in the ground state throughout the process and you'll have turned off the initial Hamiltonian and turned on the problem Hamiltonian with the system in the ground state (solution). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The temperature of the machine does not change (which is a common misconception), only the transverse magnetic field does. &lt;/p&gt;&#xA;" OwnerUserId="54" LastActivityDate="2018-03-29T13:10:48.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1457" PostTypeId="1" CreationDate="2018-03-29T13:53:17.543" Score="11" ViewCount="205" Body="&lt;p&gt;Trapped ion quantum computers are among the most promising approaches to achieve large-scale quantum computation.&#xA;The general idea is to encode the qubits into the electronic states of each ion, and then control the ions via electromagnetic forces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, I often see that experimental realisation of trapped ion systems use ${}^{40}\!\operatorname{Ca}^+$ ions (see e.g. &lt;a href=&quot;https://arxiv.org/abs/1803.10238&quot; rel=&quot;noreferrer&quot;&gt;1803.10238&lt;/a&gt;).&#xA;Is this always the case? If not, what other kinds of ions are or can be used to build these kinds of trapped ion systems?&#xA;What are the main characteristics that the ions must have to be conveniently used to build trapped ion devices?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2018-03-29T18:08:41.953" LastActivityDate="2018-03-30T14:22:42.520" Title="What kinds of ions do trapped ion quantum computers use?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;experiment&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1458" PostTypeId="2" ParentId="1457" CreationDate="2018-03-29T14:42:01.807" Score="9" Body="&lt;p&gt;$\require{\mhchem}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are almost too many ion species to list that have been used in ion trap based quantum computing or related experiments. The usual choice is one that is, when singly ionized, hydrogen-like which has convenient consequences for their laser spectroscopy: Then a strong, typically $20$ MHz wide transition lies in the UV or blue end of the laser-accessible spectrum (rather than in the vacuum-UV as it would for ions that need higher than single ionization to become hydrogen-like). Also, the spectrum remains relatively simple (if it is hydrogen-like) meaning there are a limited number of other states that may need their own laser as a repumper laser. It can be advantageous to have one optical meta-stable state that needs a repumper laser because that can be used in measurements and state preparations (or, atypically, to represent one qubit state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you typically (but not always) want an ion that has a hyperfine structure because that allows you to use hyperfine states with only a few $\mathrm{GHz}$ energy spacing as qubit states. These states are advantageous because they have century-long decay times, meaning you have practically no decoherence simply from their spontaneous decay (but you do have decoherence from magnetic fields, to which well-chosen states have, however, no linear and only a quadratic dependence).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also convenient to have a low mass ion because that allows you to build an ion trap with higher motional frequencies (the ion is more strongly confined if its charge-to-mass ratio is high). High motional frequencies imply less (anomalous) heating inside the ion trap and the possibility of faster $2$-qubit gate speeds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the most popular ion species is $\ce{^{171}Yb^+}$ because you have all required lasers in a spectral region (IR and visible) where you can build them with relative simplicity and there is a convenient meta-stable state of about $1\ \mathrm{Hz}$ width (and one with about $1\ \mathrm{nHz}$ width that is irrelevant), and it has a particularly simple hyperfine structure due to its nuclear spin of $1/2$. $\ce{Ca^+}$ is almost as good: If you can live without having a hyperfine structure, $\ce{^{40}Ca^+}$ has equally simple laser requirements and a relatively low mass whilst by tuning your lasers for $\ce{^{43}Ca^+}$ you gain a hyperfine structure at the expense of it being a fairly complicated one due to the nuclear spin of $7/2$. Some groups pursue $\ce{^9Be^+}$ which is cool for being so light and for only needing lasers at essentially the same wavelength, albeit a difficult one ($313\ \mathrm{nm}$). Many other ions have been used experimentally, including $\ce{Sr^+}$, $\require{\mhchem}\ce{Hg^+}$ and a good depiction of the important properties can be found at &lt;a href=&quot;http://iontrap.umd.edu/resources-2/periodic-table/&quot; rel=&quot;noreferrer&quot;&gt;Chris Monroe's &quot;Ion Periodic Table&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-03-30T14:22:42.520" LastActivityDate="2018-03-30T14:22:42.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1459" PostTypeId="2" ParentId="1185" CreationDate="2018-03-29T14:59:26.797" Score="6" Body="&lt;p&gt;If you want to use a quantum circuit as a subroutine (such as an oracle) to a quantum algorithm that makes use of interference, you must allow interference by a process known as uncomputing your ancillary (or, in your words, garbage) qubits. Uncomputing is always possible: Since your gates are reversible, you can just apply their inverse. That is, after the step you mentioned, $\left|x\right&amp;gt;\left|0\right&amp;gt;\left|0\right&amp;gt;\mapsto\left|x\right&amp;gt;\left|f(x)\right&amp;gt;\left|g\right&amp;gt;$, you perform another computation (or uncomputation) that leads to $\left|x\right&amp;gt;\left|f(x)\right&amp;gt;\left|0\right&amp;gt;$.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-29T14:59:26.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1460" PostTypeId="2" ParentId="136" CreationDate="2018-03-29T16:44:14.823" Score="7" Body="&lt;p&gt;There are several misconceptions here, most of them originate from exposure to only the &lt;em&gt;pure&lt;/em&gt; state formalism of quantum mechanics, so let's address them one by one:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;blockquote&gt;&#xA;  &lt;p&gt;All quantum operations must be unitary to allow reversibility, but&#xA;  what about measurement?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is false. In general, the states of a quantum system are not just vectors in a Hilbert space $\mathcal{H}$ but &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;noreferrer&quot;&gt;density matrices&lt;/a&gt; $-$ unit-trace, positive semidefinite operators acting on the Hilbert space $\mathcal{H}$ i.e., $\rho: \mathcal{H} \rightarrow \mathcal{H}$, $Tr(\rho) = 1$, and $\rho \geq 0$ (Note that the pure state vectors are not vectors in the Hilbert space but &lt;strong&gt;rays in a complex projective space&lt;/strong&gt;; for a qubit this amounts to the Hilbert space being $\mathbb{C}P^1$ and not $\mathbb{C}^2$). Density matrices are used to describe a statistical ensemble of quantum states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The density matrix is called &lt;strong&gt;pure&lt;/strong&gt; if $\rho^2 = \rho$ and &lt;strong&gt;mixed&lt;/strong&gt; if $\rho^2 &amp;lt; \rho$. Once we are dealing with a pure state density matrix (that is, there's no statistical uncertainty involved), since $\rho^2 = \rho$, the density matrix is actually a &lt;a href=&quot;https://en.wikipedia.org/wiki/Projection_(linear_algebra)&quot; rel=&quot;noreferrer&quot;&gt;projection operator&lt;/a&gt; and one can find a $|\psi\rangle \in \mathcal{H}$ such that $\rho = |\psi\rangle \langle\psi|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most general quantum operation is a CP-map (completely positive map), i.e., $\Phi: L(\mathcal{H}) \rightarrow L(\mathcal{H})$ such that $$\Phi(\rho) = \sum_i K_i \rho K_i^\dagger; \sum_i K_i^\dagger K_i \leq \mathbb{I}$$ (if $\sum_i K_i^\dagger K_i = \mathbb{I}$ then these are called CPTP (completely positive and &lt;strong&gt;trace-preserving&lt;/strong&gt;) map or a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;noreferrer&quot;&gt;quantum channel&lt;/a&gt;) where the $\{K_i\}$ are called &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_operation#Kraus_operators&quot; rel=&quot;noreferrer&quot;&gt;Kraus operators&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, coming to the OP's claim that all quantum operations are unitary to allow reversibility -- this is just not true. The unitarity of time evolution operator ($e^{-iHt/\hbar}$) in quantum mechanics (for closed system quantum evolution) is simply a consequence of the Schrödinger equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when we consider density matrices, the most general evolution is a CP-map (or CPTP for a closed system to preserve the trace and hence the probability).&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there any situations where non-unitary gates might be allowed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Yes. An important example that comes to mind is open quantum systems where Kraus operators (which are not unitary) are the &quot;gates&quot; with which the system evolves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if there is only a single Kraus operator then, $\sum_i K_i^\dagger K_i = \mathbb{I}$. But there's only one $i$, therefore, we have, $K^\dagger K = \mathbb{I}$ or, $K$ is unitary. So the system evolves as $\rho \rightarrow U \rho U^\dagger$ (which is the standard evolution that you may have seen before). However, in general, there are several Kraus operators and therefore the evolution is non-unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to the final point:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;blockquote&gt;&#xA;  &lt;p&gt;Measurement can be represented as a matrix, and that matrix is applied to qubits, so that seems equivalent to the operation of a quantum gate. That's definitively not reversible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In standard quantum mechanics (with wavefunctions etc.), the system's evolution is composed of two parts $-$ a &lt;em&gt;smooth&lt;/em&gt; unitary evolution under the system's Hamiltonian and then a &lt;em&gt;sudden&lt;/em&gt; quantum jump when a measurement is made $-$ also known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;noreferrer&quot;&gt;wavefunction collapse&lt;/a&gt;. Wavefunction collapses are described as some projection operator say $|\phi\rangle \langle\phi|$ acting on the quantum state $|\psi\rangle$ and the $|\langle\phi|\psi\rangle|^2$ gives us the probability of finding the system in the state $|\phi\rangle$ after the measurement. Since the measurement operator is after all a projector (or as the OP suggests, a matrix), shouldn't it be linear and physically similar to the unitary evolution (also happening via a matrix). This is an interesting question and in my opinion, difficult to answer physically. However, I can shed some light on this mathematically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we are working in the modern formalism, then measurements are given by &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;noreferrer&quot;&gt;POVM elements&lt;/a&gt;; Hermitian positive semidefinite operators, $\{M_{i}\}$ on a Hilbert space $\mathcal{H}$ that sum to the identity operator (on the Hilbert space) $\sum _{{i=1}}^{n}M_{i}=\mathbb{I}$. Therefore, a measurement takes the form $$ \rho \rightarrow \frac{E_i \rho E_i^\dagger}{\text{Tr}(E_i \rho E_i^\dagger)}, \text{ where } M_i = E_i^\dagger E_i.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\text{Tr}(E_i \rho E_i^\dagger) =: p_i$ is the probability of the measurement outcome being $M_i$ and is used to &lt;em&gt;renormalize&lt;/em&gt; the state to unit trace. Note that the numerator, $\rho \rightarrow E_i \rho E_i^\dagger$ is a linear operation, but the probabilistic dependence on $p_i$ is what brings in the &lt;em&gt;non-linearity&lt;/em&gt; or &lt;em&gt;irreversibility&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1: You might also be interested &lt;a href=&quot;https://en.wikipedia.org/wiki/Stinespring_factorization_theorem&quot; rel=&quot;noreferrer&quot;&gt;Stinespring dilation theorem&lt;/a&gt; which gives you an isomorphism between a CPTP map and a unitary operation on a larger Hilbert space followed by partial tracing the (tensored) Hilbert space (see &lt;a href=&quot;https://www.quantiki.org/wiki/church-larger-hilbert-space#Stinespring&amp;#39;s_dilation_theorem&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1110.6815&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2018-03-30T21:31:32.220" LastActivityDate="2018-03-30T21:31:32.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1461" PostTypeId="1" AcceptedAnswerId="1476" CreationDate="2018-03-29T16:54:30.243" Score="18" ViewCount="3431" Body="&lt;p&gt;My understanding so far is: a pure state is a basic state of a system, and a mixed state represents uncertainty about the system, i.e. the system is in one of a set of states with some (classical) probability. However, superpositions seem to be a kind of mix of states as well, so how do they fit into this picture?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider a fair coin flip. You can represent it as a mixed state of “heads” $\left|0\right&amp;gt;$ and “tails” $\left|1\right&amp;gt;$: $$ \rho_1 = \sum_j \frac{1}{2} \left|\psi_j\right&amp;gt; \left&amp;lt;\psi_j\right| = \frac{1}{2} \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we can also use the superposition of “heads” and “tails”: specific state $\psi = \frac{1}{\sqrt{2}}\left( \left|0\right&amp;gt; + \left|1\right&amp;gt; \right)$ with density&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \rho_2 = \left|\psi\right&amp;gt; \left&amp;lt;\psi\right| = \frac{1}{2} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; 1 \end{pmatrix} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we measure in the computational basis, we will get the same result. What is the difference between a superposed and a mixed state?&lt;/p&gt;&#xA;" OwnerUserId="580" LastEditorUserId="580" LastEditDate="2018-03-29T22:16:51.247" LastActivityDate="2019-05-06T01:31:12.967" Title="What is the difference between superpositions and mixed states?" Tags="&lt;superposition&gt;&lt;quantum-state&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1462" PostTypeId="1" AcceptedAnswerId="1501" CreationDate="2018-03-29T16:59:39.067" Score="7" ViewCount="511" Body="&lt;p&gt;A string of $n$ qutrits  has a state-space spanned by the $3^n$ different states $\lvert x \rangle $ for strings $x \in \{0,1,2\}^n$ (or $x \in  \{-1,0,+1\}^n$, equivalently), while $n $ qubits can only represent $2^n$ computational basis states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to   &lt;a href=&quot;https://en.wikipedia.org/wiki/Qutrit&quot; rel=&quot;noreferrer&quot;&gt;the Wikipedia article on qutrits&lt;/a&gt;, &quot;qutrits ... are more robust to decoherence under certain environmental interactions&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the increase of possible simultaneous states represented, result in robustness to decoherence?&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="26" LastEditDate="2018-05-07T13:39:05.200" LastActivityDate="2018-05-07T13:39:05.200" Title="Are qutrits more robust to decoherence?" Tags="&lt;decoherence&gt;&lt;qudit&gt;&lt;qutrit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1464" PostTypeId="2" ParentId="1461" CreationDate="2018-03-29T17:20:20.283" Score="11" Body="&lt;p&gt;The short answer is that there is more to quantum information than &quot;uncertainty&quot;. This is because there is more than one way to measure a state; and &lt;em&gt;that&lt;/em&gt; is because there is more than one basis in which, in principle, you can store and retrieve information. Superpositions allow you to express information in a different basis than the computational basis &amp;mdash; but &lt;strong&gt;mixtures&lt;/strong&gt; describe the presence of a probabilistic element, no matter which basis you use to look at the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The longer answer is as follows &amp;mdash;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measurement as you have described it is specifically measurement in the computational basis. This is often described just as &quot;measurement&quot; for the sake of brevity, and large subsets of the community think in terms of this being the primary way to measure things. But in many physical systems, it is possible to &lt;em&gt;choose a measurement basis&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A vector space over $\mathbb C$ has more than one basis (even more than one orthonormal basis), and on a mathematical level there isn't much that makes one basis more special than another, aside from what is convenient for the mathematician to think about. The same is true in quantum mechanics: unless you specify some specific dynamics, there is no basis which is more special than the others. That means that the computational basis&#xA;$$ \lvert 0 \rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \qquad \lvert 1 \rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$$&#xA;is not fundamentally different physically from another basis such as&#xA;$$ \lvert + \rangle = \tfrac{1}{\sqrt 2}\begin{bmatrix} 1 \\ 1 \end{bmatrix}, \qquad \lvert - \rangle = \tfrac{1}{\sqrt 2}\begin{bmatrix} 1 \\ -1 \end{bmatrix},$$&#xA;which is also an orthonormal basis. That means that there should be a way to &quot;measure&quot; a state $\lvert \psi \rangle \in \mathbb C^2$ in such a way that the probabilities of the outcomes depend on projections onto these states $\lvert + \rangle$ and $\lvert - \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some physical systems, the way one performs this measurement is to literally take the same apparatus and tilt it so that it is aligned with the X axis instead of the Z axis. Mathematically, the way we do this is to consider the projectors&#xA;$$ \Pi_+ = \lvert + \rangle\!\langle + \rvert = \tfrac{1}{2}\begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; 1 \end{bmatrix}, \qquad \Pi_- =  \lvert - \rangle\!\langle - \rvert = \tfrac{1}{2}\begin{bmatrix} 1 &amp;amp; -1 \\ -1 &amp;amp; 1 \end{bmatrix}$$&#xA;and then to ask what the projections $\lvert \varphi_+ \rangle := \Pi_+ \lvert \psi \rangle$ and $\lvert \varphi_- \rangle := \Pi_- \lvert \psi \rangle$. The norm-squared of $\lvert \varphi_\pm \rangle$ determines the probability of &quot;measuring $\lvert + \rangle$&quot; and of &quot;measuring $\lvert - \rangle$&quot;; and normalising $\lvert \varphi_+ \rangle$ or $\lvert \varphi_- \rangle$ to have a norm of 1 yields the post-measurement state. (For a state on a single qubit, this will just be $\lvert + \rangle$ or $\lvert - \rangle$. More interesting post-measurement states may result if we consider multi-qubit states, and consider the projector $\Pi_+$ or $\Pi_-$ acting on one of many qubits.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For density operators, one takes the state $\rho$ which you want to perform a measurement on, and consider $\rho_+ := \Pi_+ \rho \Pi_+$ and $\rho_- := \Pi_- \rho \Pi_-$. These operators may be sub-normalised in the same way that the states $\lvert \varphi_\pm \rangle$ might be, in the sense that they may have trace less than 1. The value of the trace of $\rho_\pm$ is the probability of obtaining the outcome $\lvert + \rangle$ or $\lvert - \rangle$ of the measurement; to renormalise, simply scale the projected operator to have trace 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider your state $\rho_2$ above. If you measure it with respect to the $\lvert \pm \rangle$ basis, what you will find is that $\rho_2 = \rho_{2,+} := \Pi_+ \rho_2 \Pi_+$. This means that projecting the operator with $\Pi_+$ does change the state, and that the probability of obtaining the outcome $\lvert + \rangle$ to the measurement is 1. If you do this instead with $\rho_1$, you will find a 50/50 chance of obtaining either $\lvert + \rangle$ or $\lvert - \rangle$. So the state $\rho_1$ is a mixed state, while $\rho_2 $ is not --- the difference being that $\rho_2$ has a definite outcome in a &lt;em&gt;different&lt;/em&gt; measurement basis than the standard basis. You might say that $\rho_2$ stores a &lt;em&gt;definite&lt;/em&gt; piece of information, albeit in a different basis than the computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, a mixed state is one whose largest eigenvalue is less than 1, meaning that there is no basis in which you can measure it to get a definite outcome. Superpositions allow you to express information in a different basis than the computational basis; mixtures represent a degree of randomness about the state of the system you're considering, regardless of how you measure that system.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-03-29T17:20:20.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1467" PostTypeId="2" ParentId="1404" CreationDate="2018-03-29T18:27:14.720" Score="14" Body="&lt;p&gt;This is very much an open question, but yes, there is a considerable amount of work that is being done on this front.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Some clarifications&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It is, first of all, to be noted that there are two major ways to merge machine learning (and deep learning in particular) with quantum mechanics/quantum computing:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;1) ML $\to$ QM&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Apply classical machine learning techniques to tackle problems arising in the context of quantum mechanics/quantum information/quantum computation&lt;/em&gt;&lt;/strong&gt;.&#xA;This area is growing too fast for me to even attempt a decent list of references, so I will just link to a couple of the most recent works in this direction: in &lt;a href=&quot;https://arxiv.org/abs/1803.04114&quot; rel=&quot;noreferrer&quot;&gt;1803.04114&lt;/a&gt; the authors used a machine learning approach to find circuits to compute the overlap between two states (there are a number of other works in this same direction), and in &lt;a href=&quot;https://arxiv.org/abs/1803.05193&quot; rel=&quot;noreferrer&quot;&gt;1803.05193&lt;/a&gt; the authors studied how deep neural networks can be used to find quantum control correction schemes.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;2) QM $\to$ ML&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Study of quantum algorithms to analyze big data&lt;/em&gt;&lt;/strong&gt;, which often amounts to look for &quot;&lt;em&gt;quantum generalizations&lt;/em&gt;&quot; of classical machine learning algorithms. You can have a look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1268/55&quot;&gt;this other answer of mine&lt;/a&gt; to get some basic references about this topic.&#xA;More specifically for the case of &lt;em&gt;deep learning&lt;/em&gt;, in &lt;a href=&quot;https://arxiv.org/abs/1412.3489&quot; rel=&quot;noreferrer&quot;&gt;1412.3489&lt;/a&gt; (aptly named &lt;em&gt;Quantum Deep Learning&lt;/em&gt;) the authors propose a method (effectively, a quantum algorithm) to generally speed-up the training of deep, &lt;a href=&quot;https://en.wikipedia.org/wiki/Restricted_Boltzmann_machine&quot; rel=&quot;noreferrer&quot;&gt;restricted Boltzmann machines&lt;/a&gt;.&#xA;Another relevant reference here is &lt;a href=&quot;https://arxiv.org/abs/1712.05304&quot; rel=&quot;noreferrer&quot;&gt;1712.05304&lt;/a&gt;, in which the authors develop a low-depth quantum algorithm to train quantum Boltzmann machines.&#xA;See &lt;a href=&quot;https://arxiv.org/abs/1708.09757&quot; rel=&quot;noreferrer&quot;&gt;1708.09757&lt;/a&gt;, as well as the references in the linked answer, to find many more works on this. Note that the speed-up that is claimed in these works can vary wildly, from exponential speed-ups to polynomial ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes the speed-up comes from the use of quantum algorithms to solve particular linear algebraic problems (see e.g. Table 1 in (&lt;a href=&quot;https://arxiv.org/pdf/1707.08561&quot; rel=&quot;noreferrer&quot;&gt;1707.08561&lt;/a&gt;), sometimes it comes from what basically amounts to the use of (variations of) Grover's search, and sometimes from other things (but mostly these two).&#xA;Quoting from Dunjko and Briegel &lt;a href=&quot;https://arxiv.org/abs/1709.02779&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The ideas for quantum-enhancements for ML can roughly be classified&#xA;  into two groups: a) approaches which rely on Grover’s search and&#xA;  amplitude amplification to obtain up-to-quadratic speed-ups, and, b)&#xA;  approaches which encode relevant information into quantum amplitudes,&#xA;  and which have a potential for even exponential improvements. The&#xA;  second group of approaches forms perhaps the most developed research&#xA;  line in quantum ML, and collects a plethora quantum tools – most&#xA;  notably quantum linear algebra, utilized in quantum ML proposals.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h1&gt;More direct answer to the three questions&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Having said the above, let me more directly answer the three points you raised:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Could a deep learning algorithm run on a quantum computer?&lt;/em&gt; Most definitely yes: if you can run something on a classical computer you can do it on quantum computers. However, the question one should be asking is rather &lt;em&gt;can a quantum (deep) machine learning algorithm be more efficient than the classical counterparts&lt;/em&gt;? The answer to &lt;em&gt;this&lt;/em&gt; question is trickier. &lt;em&gt;Possibly yes&lt;/em&gt;, there are many proposals in this direction, but it is too soon to say what will or will not work.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Does it make sense to try?&lt;/em&gt; Yes!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Are there other quantum algorithms that would make deep learning irrelevant?&lt;/em&gt; This strongly depends on what you mean by &quot;&lt;em&gt;irrelevant&lt;/em&gt;&quot;. I mean, for what is known at the moment, there may very well be &lt;em&gt;classical&lt;/em&gt; algorithms that will make deep learning &quot;irrelevant&quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-09-19T20:09:21.753" LastActivityDate="2018-09-19T20:09:21.753" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1468" PostTypeId="1" AcceptedAnswerId="1469" CreationDate="2018-03-29T18:38:00.123" Score="3" ViewCount="584" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A qubit is a two-state quantum system [...]&lt;/p&gt;&#xA;&lt;p&gt;There are two possible&#xA;outcomes for the measurement of a qubit — usually &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, like a bit.&#xA;The difference is that whereas the state of a bit is either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;,&#xA;the state of a qubit can also be a superposition of both.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Is it true that quantum computing must be based on qubits, limiting it to only a two-state quantum system? Is it physically possible to build a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-state quantum-system (where &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;2$&lt;/span&gt;)?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sub&gt;This is 'repost' of a (&amp;quot;legitimate&amp;quot;) question was deleted by the OP, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1465/why-does-quantum-computing-is-limited-to-a-superposition-of-only-two-states&quot;&gt;here&lt;/a&gt;. I decided to repost it along with the answer which I started writing.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-11-17T14:03:05.233" Title="Is quantum computing limited to a superposition of only two states?" Tags="&lt;qudit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1469" PostTypeId="2" ParentId="1468" CreationDate="2018-03-29T18:38:00.123" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is quantum computing limited to a superposition of only two&#xA;  states?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In theory, it is not. Keep in mind that a qubit is a quantum analogue of the classical &quot;bit&quot; which has only two states &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. In principle, there is no limit to the dimension of the state space of a quantum system. There could even be an &quot;infinite&quot; dimensional separable Hilbert space (in short, separable means denumerable/countable with a one-one onto mapping to the natural numbers). &lt;a href=&quot;https://physics.stackexchange.com/questions/60608/nonseparable-hilbert-space&quot;&gt;For non-separable Hilbert spaces there are some complications involved.&lt;/a&gt;&#xA;In the context of quantum information systems with a state-space dimension greater than &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; are called &quot;&lt;a href=&quot;https://spectrum.ieee.org/tech-talk/computing/hardware/qudits-the-real-future-of-quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;qudits&lt;/a&gt;&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes, there has been ongoing work to make physical implementations of higher dimensional quantum systems, like qutrits (with trapped ions), as mentioned by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/54/andrew-o&quot;&gt;@Andrew O&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1466/26&quot;&gt;on their currently deleted answer&lt;/a&gt; (only users having the privilege to view deleted posts can see it at present).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relevant paper: &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.062313&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qutrit quantum computer with trapped ions - A. B. Klimov, R. Guzmán, J. C. Retamal, and C. Saavedra&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;@glS mentions &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1468/is-quantum-computing-limited-to-a-superposition-of-only-two-states?noredirect=1#comment994_1469&quot;&gt;here&lt;/a&gt; that in some cases making higher-dimensional quantum systems can, in fact, be easier, which is an interesting fact I did not know earlier. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the context of photonics, for example, it is relatively easy to&#xA;  generate states in high-dimensional Hilbert spaces, for example&#xA;  exploiting the orbital angular momentum of single photons. See for&#xA;  example &lt;a href=&quot;https://arxiv.org/abs/1607.05114&quot; rel=&quot;nofollow noreferrer&quot;&gt;1607.05114&lt;/a&gt; and the many&#xA;  references therein, or &lt;a href=&quot;https://arxiv.org/abs/1207.2376&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fickler&#xA;  2012&lt;/a&gt;, in which they experimentally&#xA;  demonstrate entanglement of states living in 600-dimensional Hilbert&#xA;  spaces.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;@glS also mentions in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1468/is-quantum-computing-limited-to-a-superposition-of-only-two-states?noredirect=1#comment999_1469&quot;&gt;following comment&lt;/a&gt; that &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is also to be noted that the matter of non-separability is&#xA;  absolutely a non-issue for practical implementation of whatever&#xA;  protocol, and also that &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-variable_quantum_information&quot; rel=&quot;nofollow noreferrer&quot;&gt;continuous variable quantum computation&lt;/a&gt; is a&#xA;  big subject in quantum computing &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-17T14:03:05.233" LastActivityDate="2019-11-17T14:03:05.233" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1471" PostTypeId="1" AcceptedAnswerId="1482" CreationDate="2018-03-29T19:15:12.063" Score="9" ViewCount="494" Body="&lt;p&gt;This recent press release claiming that &lt;a href=&quot;https://www.tue.nl/en/university/news-and-press/news/01-01-1970-improved-measurements-bring-final-proof-of-majorana-particles-closer-than-ever/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Improved measurements bring final proof of Majorana particles closer than ever&lt;/a&gt;, which summarizes the results of a recent paper in Nature simply entitled &quot;&lt;a href=&quot;https://www.nature.com/articles/nature26142&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantized Majorana conductance&lt;/a&gt;&quot; claims that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thanks to their unique physical characteristics, Majorana particles are much more stable than most other qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why would this be the case (in theory, at least). Is the approach to qubits with Majorana particles considered to be valid, or are they surrounded by skepticism?&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2018-12-23T12:14:14.270" LastActivityDate="2018-12-23T12:14:14.270" Title="How could Majorana particles be used to improve quantum computers?" Tags="&lt;error-correction&gt;&lt;majorana-particle&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1472" PostTypeId="1" AcceptedAnswerId="1475" CreationDate="2018-03-29T19:22:49.070" Score="10" ViewCount="8070" Body="&lt;p&gt;The terms &lt;a href=&quot;http://www.mcclatchydc.com/news/nation-world/national/national-security/article179971861.html&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing Race&lt;/a&gt; and &lt;a href=&quot;https://www.wsj.com/podcasts/the-global-race-for-quantum-computing-supremacy/B32A35C3-751D-4079-98CF-703E2E9BAB35.html&quot; rel=&quot;noreferrer&quot;&gt;Global Quantum Computing Race&lt;/a&gt; have been used in the press and research communities lately in an effort to describe countries making investments into a &quot;battle&quot; to create the first universal quantum computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What countries are leading this &quot;Global Quantum Computing Race&quot;?&lt;/p&gt;&#xA;" OwnerUserId="1280" LastEditorUserId="274" LastEditDate="2018-03-29T20:47:59.697" LastActivityDate="2018-12-18T09:56:16.687" Title="What countries are leading this &quot;Global Quantum Computing Race&quot;?" Tags="&lt;physical-realization&gt;&lt;quantum-advantage&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1473" PostTypeId="2" ParentId="1471" CreationDate="2018-03-29T19:27:28.393" Score="5" Body="&lt;p&gt;I heard an interesting analogy that shed some light on the situation for me, so I'll share it here. Majorana fermions are topologically based; let's look at what topology sort of &quot;means&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Topology looks at the bigger picture. If you have a balloon, no matter how much you blow it up, take air out, or tie it up in knots (if you're a balloon artist), it still doesn't have holes in it. To have holes would make it fundamentally different. You can stretch and shrink and twist a sphere all you want, but it's never going to turn into a donut. If you take a donut, though, you can twist that into all sorts of things with holes - but you can never make something without holes, like a sphere, or with two or more holes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example of topology looking at the bigger picture. Take a balloon (again) and zoom in on its surface. Even though the balloon is curved when you zoom out, when you're zoomed in, it looks like a 2-d Euclidean plane. If you zoom in on a circle, it looks like a 1-d Euclidean plane. The little twists and turns don't matter in topology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's bring this back towards Majorana fermions. Let's picture a system where we're registering if the electron goes all the way around a tree or not. It doesn't matter whether the electron has a really squiggly nutty path or a just a simple circular path - it still goes around. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The noise introduced in these systems might make the electron's path squiggly or it might not, but it doesn't actually &lt;em&gt;matter&lt;/em&gt;. It still goes around. That's where the advantage in Majorana fermions lies - the noise doesn't affect it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously this isn't rigorous; I'll try to add more that sheds light on that as I have time.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-03-29T19:27:28.393" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1474" PostTypeId="1" AcceptedAnswerId="1524" CreationDate="2018-03-29T19:39:56.853" Score="70" ViewCount="30308" Body="&lt;p&gt;From this question, I gathered that the main quantum computing programming languages are &lt;a href=&quot;https://www.microsoft.com/en-us/quantum/development-kit&quot; rel=&quot;noreferrer&quot;&gt;Q#&lt;/a&gt; and &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/experience&quot; rel=&quot;noreferrer&quot;&gt;QISKit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other programming languages are available for programming quantum computers? Are there certain benefits to choosing particular ones?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I am looking for programming languages, not emulators. Emulators simulate things. Programming languages are a method of writing instructions (either for real objects or for emulators). There may be a single language that works for multiple emulators and vice versa.&lt;/p&gt;&#xA;" OwnerUserId="1289" LastEditorUserId="26" LastEditDate="2018-03-29T21:46:14.157" LastActivityDate="2020-06-16T23:37:01.413" Title="What programming languages are available for quantum computers?" Tags="&lt;programming&gt;" AnswerCount="6" CommentCount="4" FavoriteCount="40" ContentLicense="CC BY-SA 3.0" />
  <row Id="1475" PostTypeId="2" ParentId="1472" CreationDate="2018-03-29T19:56:15.037" Score="15" Body="&lt;p&gt;There are several countries that are actively participating in the &quot;Quantum Race&quot;, most of which are making significant investments. The estimated annual spending on non-classified quantum-technology research in 2015 broke down like this: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;United States (360 €m)&lt;/li&gt;&#xA;&lt;li&gt;China (220 €m)&lt;/li&gt;&#xA;&lt;li&gt;Germany (120 €m)&lt;/li&gt;&#xA;&lt;li&gt;Britain (105 €m)&lt;/li&gt;&#xA;&lt;li&gt;Canada (100 €m)&lt;/li&gt;&#xA;&lt;li&gt;Australia (75 €m)&lt;/li&gt;&#xA;&lt;li&gt;Switzerland (67 €m)&lt;/li&gt;&#xA;&lt;li&gt;Japan (63€m)&lt;/li&gt;&#xA;&lt;li&gt;France (52 €m)&lt;/li&gt;&#xA;&lt;li&gt;Singapore (44 €m)&lt;/li&gt;&#xA;&lt;li&gt;Italy (36 €m)&lt;/li&gt;&#xA;&lt;li&gt;Austria (35 €m)&lt;/li&gt;&#xA;&lt;li&gt;Russia (30 €m)&lt;/li&gt;&#xA;&lt;li&gt;Netherlands (27 €m)&lt;/li&gt;&#xA;&lt;li&gt;Spain (25 €m)&lt;/li&gt;&#xA;&lt;li&gt;Denmark (22 €m)&lt;/li&gt;&#xA;&lt;li&gt;Sweden (15 €m)&lt;/li&gt;&#xA;&lt;li&gt;South Korea (13 €m)&lt;/li&gt;&#xA;&lt;li&gt;Finland (12 €m)&lt;/li&gt;&#xA;&lt;li&gt;Poland (12 €m)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you chart that out, it looks something like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lzKJY.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lzKJY.jpg&quot; alt=&quot;Global Quantum Spending in 2015&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see the European Union invested a combined 550 €m. It's also interesting to see how this investment correlates to patent applications from each of these countries: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RX6z7.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RX6z7.jpg&quot; alt=&quot;Patent Applications Per Country (2015)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since 2015 the interest from countries in quantum computing has grown significantly. The worldwide investment has now broken 2,000 €m. The biggest increase has been seen in China's spending which encompasses quantum computing but includes quantum information systems as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several examples of countries investing in quantum computing in the past year that might be of particular interest. These include:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;China&lt;/strong&gt; - In 2017 China announced that it was set to open a National Laboratory for Quantum Information Sciences by 2020. This included a 92-Acre, $10 Billion quantum research center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Japan&lt;/strong&gt; - In 2017 in a joint, state-sponsored research project with Japan’s National Institute of Informatics and the University of Tokyo produced the machine, Nippon Telegraph and Telephone (NTT) shared a prototype quantum computer for public use over the internet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sweden&lt;/strong&gt; - In 2017 Sweden invested 1 billion Swedish Krona (roughly $118 million or 100m €) into a research initiative with the goal of developing a &quot;robust quantum computer&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the United States has been seen as not investing enough into quantum computing and over the summer academia and industry testified before the U.S. House Subcommittees on Research &amp;amp; Technology and Energy in an effort to spur investment into this space. Most notably Dr. Christopher Monroe was quoted as saying that &lt;em&gt;&quot;U.S. leadership in quantum technology will be critical to our national security, and will open new doors for private industry and academia while ensuring America’s role as a global technology leader in the 21st century.”&lt;/em&gt;  &lt;/p&gt;&#xA;" OwnerUserId="274" LastEditorUserId="274" LastEditDate="2018-03-29T20:33:30.183" LastActivityDate="2018-03-29T20:33:30.183" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1476" PostTypeId="2" ParentId="1461" CreationDate="2018-03-29T20:03:59.833" Score="12" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;No&lt;/em&gt;&lt;/strong&gt;, a &lt;em&gt;superposition&lt;/em&gt; of two different states is a completely different beast than a &lt;em&gt;mixture&lt;/em&gt; of the same states.&#xA;While it may appear from your example that $\rho_1$ and $\rho_2$ produce the same measurement outcomes (and that is indeed the case), &lt;a href=&quot;https://physics.stackexchange.com/a/376384/58382&quot;&gt;as soon as you measure in a different basis they will give measurably different results&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;superposition&quot; like $\newcommand{\up}{|\!\!\uparrow\rangle}\newcommand{\down}{|\!\!\downarrow\rangle}|\psi\rangle=\frac{1}{\sqrt2}(\up+\down)$ is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state#Pure_states&quot; rel=&quot;noreferrer&quot;&gt;pure state&lt;/a&gt;. This means that it is a completely characterised state.&#xA;In other words, there is no amount of information that, added to its description, could make it &quot;less undetermined&quot;.&#xA;Note that &lt;em&gt;every pure state&lt;/em&gt; can be written as superposition of other pure states.&#xA;Writing a given state $|\psi\rangle$ as a superposition of other states is literally the same thing as writing a vector $\boldsymbol v$ in terms of some basis: you can always change the basis and find a different representation of $\boldsymbol v$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in direct contrast to a &lt;em&gt;mixed state&lt;/em&gt; like $\rho_1$ in your question.&#xA;In the case of $\rho_1$, the probabilistic nature of the outcomes &lt;em&gt;depends on our ignorance about the state itself&lt;/em&gt;. This means that, in principle, it is possible to acquire some additional information that will tell us whether $\rho_2$ is indeed in the state $\up$ or in the state $\down$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A mixed state cannot, in general, be written as a pure state.&#xA;This should be clear from the above physical intuition: mixed states represent &lt;em&gt;our ignorance&lt;/em&gt; about a physical state, while &lt;em&gt;pure states&lt;/em&gt; are completely defined states, which just so happen to still give probabilistic outcomes due to the way quantum mechanics work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, there is a simple criterion to tell whether a given (generally mixed) state $\rho$ can be written as $|\psi\rangle\langle\psi|$ for some (pure) state $|\psi\rangle$: computing its &lt;a href=&quot;https://en.wikipedia.org/wiki/Purity_(quantum_mechanics)&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;purity&lt;/em&gt;&lt;/a&gt;.&#xA;The purity of a state $\rho$ is defined as $\operatorname{Tr} \,(\rho^2)$, and it is a standard result that the purity of state is $1$ &lt;em&gt;if and only if&lt;/em&gt; the state is pure (and lesser than $1$ otherwise).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-29T21:02:15.857" LastActivityDate="2018-03-29T21:02:15.857" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1477" PostTypeId="2" ParentId="1462" CreationDate="2018-03-29T20:22:14.157" Score="6" Body="&lt;p&gt;The statement in Wikipedia is very generic, and only cites &lt;a href=&quot;https://journals.aps.org/prb/abstract/10.1103/PhysRevB.70.014435&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; as a reference.&#xA;Quoting from the abstract of the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We demonstrate that decoherence of many-spin systems can drastically&#xA;  differ from decoherence of single spin systems. The difference&#xA;  originates at the most basic level, being determined by parity of the&#xA;  central system, i.e., by whether the system comprises even or odd&#xA;  number of spin-1/2 entities. Therefore, it is very likely that similar&#xA;  distinction between the central spin systems of even and odd parity is&#xA;  important in many other situations. Our consideration clarifies the&#xA;  physical origin of the unusual two-step decoherence found previously&#xA;  in the two-spin systems&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As can be understood from the above excerpt, the paper is referring to a very specific situation, and it is by no means substantiating a broad claim such as &quot;qutrits are more robust to decoherence&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, to say &quot;system X is more robust to decoherence under certain environmental interactions&quot; is generic enough to be always true, as one can always find a kind of &quot;environmental interaction&quot; in which the system X is more stable than the system Y.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-03-29T20:22:14.157" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1478" PostTypeId="1" AcceptedAnswerId="1479" CreationDate="2018-03-29T20:26:16.033" Score="10" ViewCount="130" Body="&lt;p&gt;I was wondering if there is a source (online or review article) which tabulates recent algorithms, and their complexities, used in simulating various physical systems. Something along the lines of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Physical System 1&lt;/strong&gt;: Quantum Field Theory (scattering)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;: Polynomial in number of particles, energy, and precision&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;: &lt;a href=&quot;https://arxiv.org/abs/1111.3633&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithms for Quantum Field Theories (Jordan, Lee &amp;amp; Preskill, 2011)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Physical System 2&lt;/strong&gt;: Atomic Energy levels&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so on.&lt;/p&gt;&#xA;" OwnerUserId="1287" LastEditorUserId="26" LastEditDate="2019-05-17T21:44:58.573" LastActivityDate="2019-05-17T21:44:58.573" Title="Is there any source which tabulates quantum computing algorithms for simulating physical systems?" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1479" PostTypeId="2" ParentId="1478" CreationDate="2018-03-29T20:27:26.160" Score="9" Body="&lt;p&gt;I believe what you're after is &lt;a href=&quot;https://math.nist.gov/quantum/zoo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;NIST's Quantum Zoo&lt;/a&gt;, a comprehensive catalog of quantum algorithms maintained by Stephen Jordan. Its sections include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Algebraic and Number Theoretic Algorithms (14 items)&lt;/li&gt;&#xA;&lt;li&gt;Oracular Algorithms (34 items)&lt;/li&gt;&#xA;&lt;li&gt;Approximation and Simulation Algorithms (12 items)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and for each algorithm it includes its speedup, a description and relevant references. The third category would be the answer to the present question.&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="1847" LastEditDate="2018-04-19T06:20:25.307" LastActivityDate="2018-04-19T06:20:25.307" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1480" PostTypeId="2" ParentId="1429" CreationDate="2018-03-29T20:36:42.060" Score="17" Body="&lt;p&gt;The idea of topological quantum computing was introduced by Kitaev in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9707021&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. The basic idea is to build a quantum computer using the properties of exotic types of particles, known as anyons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two main properties of anyons that would make them great for this purpose. One is what happens when you use them to create composite particles, a process we call &lt;em&gt;fusion&lt;/em&gt;. Let's take the so called Ising anyons (also known as Majoranas) as an example. If you bring two of these particles together, it is could be that they will annihilate. But it could also be that they become a fermion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some cases where you will know which will happen. If the Ising anyons just pair created from the vacuum, you know that they'll go back to the vacuum when combined. If you just split a fermion into two Ising anyons, they'll go back to being that fermion. But if two Ising anyons meet for the first time, the result of their combination will be completely random. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All these possibilities must be kept track of somehow. That is done by means of a Hilbert space, known as the fusion space. But the nature of a many-anyon Hilbert space is very different to that of many spin qubits, or superconducting qubits, etc. The fusion space doesn't describe any internal degrees of freedom of the particles themselves. You can prod and poke the anyons all you like, you won't learn anything about the state within this space. It only describes how the anyons relate to each other by fusion. So keep the anyons far apart, and decoherence will find it very hard to break into this Hilbert space and disturb any state you have stored there. This makes it a perfect place to store qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other useful property of anyons is braiding. This describes what happens when you move them around each other. Even if they don't come close to each other in any way, these trajectories can affect the results of fusion. For example, if two Ising anyons were destined to annihilate, but another Ising anyon passes between them before they fuse, they will turn into a fermion instead. Even if there was half the universe between them all when it passed by, somehow they still know. This allows us to perform gates on the qubits stored in the fusion space. The effect of these gates only depends on the topology of the paths that the anyons take around each other, rather than any small details. So they too are less prone to errors than gates performed on other types of qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These properties give topological quantum computing a built in protection that is similar to quantum error correction. Like QEC, information is spread out so that it cannot be easily disturbed by local errors. Like QEC, local errors leave a trace (like moving anyons a little, or creating a new pair of anyons from the vacuum). By detecting this, you can easily clean up. So qubits built from anyons could have much less noise than ones built from other physical systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The big problem is that anyons don't exist. Their properties are mathematically inconsistent in any universe with three or more spatial dimensions, like the one we happen to live in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fortunately, we can try to trick them into existing. Certain materials, for example, have localized excitations that behave as is they were particles. These are known as &lt;em&gt;quasiparticles&lt;/em&gt;. With a 2D material in a sufficiently exotic phase of matter, these quasiparticles can behave as anyons. Kitaev's original paper proposed some toy models of such materials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, quantum error correcting codes based on 2D lattices can also play host to anyons. In the well known &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0110143&quot; rel=&quot;noreferrer&quot;&gt;surface code&lt;/a&gt;, errors cause pairs of anyons to be created from the vacuum. To correct the errors you must find the pairs and reannihilate them. Though these anyons are too simple to have a fusion space, we can create &lt;a href=&quot;https://arxiv.org/abs/1609.04673&quot; rel=&quot;noreferrer&quot;&gt;defects in the codes&lt;/a&gt; that can also be moved around like particles. These are sufficient to store qubits, and basic gates can be performed by braiding the defects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superconducting nanowires can also be created with so-called Majorana zero modes at the end points. Braiding these is not so easy: wires are inherently 1D objects, which doesn't give a lot of room for movement. But it can nevertheless be done by creating certain junctions. And when it is done, we find that they behave like Ising anyons (or at least, so theory predicts). Because of this, there is a big push at the moment to provide strong experimental evidence that these can indeed be used as qubits, and that they can be braided to perform gates. &lt;a href=&quot;https://www.nature.com/articles/nature26142&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is a paper on the issue that is hot off the press.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;After that broad intro, I should get on with answering your actual question. Topological quantum computation concerns any implementation of quantum computation that, at a high level, can be interpreted in terms of anyons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This includes the use of the surface code, which is currently regarded as the most mainstream method for how a fault-tolerant circuit model based quantum computer can be built. So for this case, the answer to &quot;How do Topological Quantum Computers differ from others models of quantum computation?&quot; is that it doesn't differ at all. It is the same thing!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Topological quantum computation also includes Majoranas, which is the route that Microsoft are betting on. Essentially this will just use pairs of Majoranas as qubits, and braiding for basic gates. The difference between this superconducting qubits is little more than that between superconducting qubits and trapped ion qubits: it is just details of the hardware implementation. The hope is that Majorana qubits will be significantly less noisy, but that remains to be seen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Topological quantum computation also includes much more abstract models of computing. If we figure out a way to realize Fibonacci anyons, for example we'll have a fusion space that cannot be so easily carved up into qubits. Finding the best ways to turn our programs into the braiding of anyons becomes a lot harder (see &lt;a href=&quot;https://arxiv.org/abs/1310.4150&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;, as an example). This is the kind of topological quantum computer that would be most different to standard methods. But if anyons can really be realized with very low noise, as promised, it would be well worth the small overheads required to use Fibonacci anyons to simulate the standard gate based approach.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-30T09:44:28.947" LastActivityDate="2018-03-30T09:44:28.947" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1481" PostTypeId="2" ParentId="1474" CreationDate="2018-03-29T20:38:15.770" Score="31" Body="&lt;p&gt;Gate model hardware vendors have built out their own low level languages: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rigetti: &lt;a href=&quot;https://arxiv.org/pdf/1608.03355.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quil&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;IBM: &lt;a href=&quot;https://github.com/QISKit/openqasm&quot; rel=&quot;noreferrer&quot;&gt;QASM&lt;/a&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These have higher level python sdk's available: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rigetti: &lt;a href=&quot;http://pyquil.readthedocs.io/en/latest/&quot; rel=&quot;noreferrer&quot;&gt;Pyquil&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;IBM: &lt;a href=&quot;https://github.com/QISKit/qiskit-sdk-py&quot; rel=&quot;noreferrer&quot;&gt;Qiskit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Rigetti is also wrapping their language in a higher level library for calling pre-built applications called &lt;a href=&quot;http://grove-docs.readthedocs.io/en/latest/&quot; rel=&quot;noreferrer&quot;&gt;Grove&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Microsoft has developed &lt;a href=&quot;https://www.microsoft.com/en-us/quantum/development-kit&quot; rel=&quot;noreferrer&quot;&gt;Q#&lt;/a&gt; to run against their existing simulator, and eventually their physical hardware. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the languages above are vendor specific the main benefit is that you can run quantum programs on their computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outside of the vendor specific languages is &lt;a href=&quot;https://www.cs.princeton.edu/research/techreps/TR-934-12&quot; rel=&quot;noreferrer&quot;&gt;Scaffold&lt;/a&gt; which is being developed by Princeton researchers. This language is interesting as it includes a &lt;a href=&quot;https://github.com/epiqc/ScaffCC&quot; rel=&quot;noreferrer&quot;&gt;toolchain&lt;/a&gt; for analyzing the programs to determine costs, performance potential, and scalability potential. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;a href=&quot;https://projectq.ch/&quot; rel=&quot;noreferrer&quot;&gt;Project Q&lt;/a&gt; is another framework that allows you to develop programs utilizing Python which can run on an included simulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oak Ridge National Labs has started work on a project called &lt;a href=&quot;https://github.com/ORNL-QCI/xacc&quot; rel=&quot;noreferrer&quot;&gt;XACC&lt;/a&gt; which is intended to abstract vendor specific code to allow users access to the various hardware platforms without duplicating code in each vendor specific language.  &lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="39" LastEditDate="2018-04-02T20:50:14.177" LastActivityDate="2018-04-02T20:50:14.177" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1482" PostTypeId="2" ParentId="1471" CreationDate="2018-03-29T20:54:26.297" Score="9" Body="&lt;p&gt;Majoranas are &lt;a href=&quot;https://en.wikipedia.org/wiki/Anyon&quot; rel=&quot;nofollow noreferrer&quot;&gt;anyons&lt;/a&gt; (a type of quasiparticles wich behave differently from fermions and bosons), and so are related to the idea of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1429/how-do-topological-quantum-computers-differ-from-others-models-of-quantum-comput&quot;&gt;topological quantum computation&lt;/a&gt;. This means that a good implementation should have properties that help deal with noise built in. Their main problem is that it is difficult to prepare physical systems which behave as Majorana particles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way of building Majoranas is with superconducting nanowires. This is the kind that the press release and paper are referring to. Will these actually work well? We shall see. Will they be better than other qubits? We shall see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of building Majoranas is by performing code deformation in &lt;a href=&quot;https://en.wikipedia.org/wiki/Toric_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;surface codes&lt;/a&gt; (a well studied family of quantum error correction codes). Examples can be found in this paper  (of which I am an author): &lt;a href=&quot;https://arxiv.org/abs/1609.04673&quot; rel=&quot;nofollow noreferrer&quot;&gt;Poking holes and cutting corners to achieve Clifford gates with the surface code&lt;/a&gt;. These will probably work pretty well. They won't have much in the way of advantages over more mainstream methods though, because using defects in surface codes &lt;em&gt;is&lt;/em&gt; the most mainstream method (whether they are Majoranas or not).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other ways we could trick Majoranas into existing. But as far as I know, none are being actively pursued.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="1847" LastEditDate="2018-04-13T09:19:13.100" LastActivityDate="2018-04-13T09:19:13.100" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1483" PostTypeId="2" ParentId="1451" CreationDate="2018-03-29T23:09:12.510" Score="26" Body="&lt;p&gt;The 'Hello World' equivalent in the D-Wave world is the 2D checkerboard example. In this example, you are given the following square graph with 4 nodes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&lt;img src=&quot;https://image.ibb.co/juv4en/2d_checkerboard.png&quot; alt=&quot;square_graph&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's define that we colour vertex $\sigma_{i}$ black if $\sigma_{i} = -1$ and white if $\sigma_{i} = +1$. The goal is to create a checkerboard pattern with the four vertices in the graph. There is various ways of defining&#xA;$h$ and $J$ to achieve this result. First of all, there are two possible solutions to this problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&lt;img src=&quot;https://image.ibb.co/fh1AKn/2d_checkerboard_solutions.png&quot; alt=&quot;checkerboard_solutions&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The D-Wave quantum annealer minimizes the Ising Hamiltonian that we define and&#xA;it is important to understand the effect of the different coupler settings. Consider for example the $J_{0,1}$ coupler:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we set it to $J_{0,1}=-1$, the Hamiltonian is minimized if both qubits take the same value. We say &lt;em&gt;negative couplers correlate&lt;/em&gt;. Whereas if we set it to $J_{0,1}=+1$, the Hamiltonian is minimized if the two qubits take opposite values. Thus, &lt;em&gt;positive couplers anti-correlate&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the checkerboard example, we want to anti-correlate each pair of neighbouring qubits which gives rise to the following Hamiltonian:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H = \sigma_{0}\sigma_{1} + \sigma_{0}\sigma_{2} + \sigma_{1}\sigma_{3} + \sigma_{2}\sigma_{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the sake of demonstration, we also add a bias term on the $0$-th qubit such that we only get solution #1. This solution requires $\sigma_{0}=-1$ and we therefore set its bias $h_{0}=1$. The final Hamiltonian is now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H = \sigma_{0} + \sigma_{0}\sigma_{1} + \sigma_{0}\sigma_{2} + \sigma_{1}\sigma_{3} + \sigma_{2}\sigma_{3}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's code it up!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: You DO NEED access to D-Wave's Cloud Service for anything to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, make sure you have the &lt;code&gt;dwave_sapi2&lt;/code&gt; (&lt;a href=&quot;https://cloud.dwavesys.com/qubist/downloads/&quot; rel=&quot;noreferrer&quot;&gt;https://cloud.dwavesys.com/qubist/downloads/&lt;/a&gt;) Python package installed. Everything is going to be Python 2.7 since D-Wave currently doesn't support any higher Python version. That being said, let's import the essentials:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from dwave_sapi2.core import solve_ising&#xA;from dwave_sapi2.embedding import find_embedding, embed_problem, unembed_answer&#xA;from dwave_sapi2.util import get_hardware_adjacency&#xA;from dwave_sapi2.remote import RemoteConnection&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to connect to the D-Wave Solver API you will need a valid API token for their SAPI solver, the SAPI URL and you need to decide which quantum processor you want to use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DWAVE_SAPI_URL = 'https://cloud.dwavesys.com/sapi'&#xA;DWAVE_TOKEN = [your D-Wave API token]&#xA;DWAVE_SOLVER = 'DW_2000Q_VFYC_1'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I recommend using the D-Wave 2000Q Virtual Full Yield Chimera (VFYC) which is a fully functional chip without any dead qubits! Here's the Chimera chip layout:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://preview.ibb.co/iO2szn/vfyc_dwave.png&quot; alt=&quot;dwave_chimera&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point I am splitting the tutorial into two distinct pieces. In the first section, we are manually embedding the problem onto the Chimera hardware graph and in the second section we are using D-Wave's embedding heuristics to find a hardware embedding.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Manual embedding&lt;/h1&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The unit cell in the top left corner on the D-Wave 2000Q chip layout above looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://image.ibb.co/bzkvKn/physical_qubits.png&quot; alt=&quot;physical_qubits&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, that not all couplers are visualized in this image. As you can see, there is no coupler between qubit $0$ and qubit $1$ which we would need to directly implement our square graph above. That's why we are now redefining $0\rightarrow0$, $1\rightarrow4$, $2\rightarrow7$ and $3\rightarrow3$. We then go on and define $h$ as a list and $J$ as a dictionary:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = {(0,4): 1, (4,3): 1, (3,7): 1, (7,0): 1}&#xA;h = [-1,0,0,0,0,0,0,0,0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;$h$ has 8 entries since we use qubits 0 to 7. We now establish connection to the Solver API and request the D-Wave 2000Q VFYC solver:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;connection = RemoteConnection(DWAVE_SAPI_URL, DWAVE_TOKEN)&#xA;solver = connection.get_solver(DWAVE_SOLVER)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, we can define the number of readouts and choose &lt;code&gt;answer_mode&lt;/code&gt; to be &quot;histogram&quot; which already sorts the results by the number of occurrences for us. We are now ready to solve the Ising instance with the D-Wave quantum annealer:    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;params = {&quot;answer_mode&quot;: 'histogram', &quot;num_reads&quot;: 10000}&#xA;results = solve_ising(solver, h, J, **params)&#xA;print results&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You should get the following result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;  'timing': {&#xA;    'total_real_time': 1655206,&#xA;    'anneal_time_per_run': 20,&#xA;    'post_processing_overhead_time': 13588,&#xA;    'qpu_sampling_time': 1640000,&#xA;    'readout_time_per_run': 123,&#xA;    'qpu_delay_time_per_sample': 21,&#xA;    'qpu_anneal_time_per_sample': 20,&#xA;    'total_post_processing_time': 97081,&#xA;    'qpu_programming_time': 8748,&#xA;    'run_time_chip': 1640000,&#xA;    'qpu_access_time': 1655206,&#xA;    'qpu_readout_time_per_sample': 123&#xA;  },&#xA;  'energies': [-5.0],&#xA;  'num_occurrences': [10000],&#xA;  'solutions': [&#xA;      [1, 3, 3, 1, -1, 3, 3, -1, {&#xA;          lots of 3 's that I am omitting}]]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see we got the correct ground state energy (&lt;code&gt;energies&lt;/code&gt;) of $-5.0$. The solution string is full of $3$'s which is the default outcome for unused/unmeasured qubits and if we apply the reverse transformations - $0\rightarrow0$, $4\rightarrow1$, $7\rightarrow2$ and $3\rightarrow3$ - we get the correct solution string $[1, -1, -1, 1]$. Done!&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Heuristic embedding&lt;/h1&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you start creating larger and larger Ising instances you will not be able to perform manual embedding. So let's suppose we can't manually embed our 2D checkerboard example. $J$ and $h$ then remain unchanged from our initial definitions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = {(0,1): 1, (0,2): 1, (1,3): 1, (2,3): 1}&#xA;h = [-1,0,0,0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We again establish the remote connection and get the D-Wave 2000Q VFYC solver instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;connection = RemoteConnection(DWAVE_SAPI_URL, DWAVE_TOKEN)&#xA;solver = connection.get_solver(DWAVE_SOLVER)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In order to find an embedding of our problem, we need to first get the adjacency matrix of the current hardware graph:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;adjacency = get_hardware_adjacency(solver)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now let's try to find an embedding of our problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;embedding = find_embedding(J.keys(), adjacency)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you are dealing with large Ising instances you might want to search for embeddings in multiple threads (parallelized over multiple CPUs) and then select the embedding with the smallest chain length! A &lt;em&gt;chain&lt;/em&gt; is when multiple qubits are forced to act as a single qubit in order to increase the degree of connectivity. However, the longer the chain the more likely that it breaks. And broken chains give bad results!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are now ready to embed our problem onto the graph:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[h, j0, jc, embeddings] = embed_problem(h, J, embedding, adjacency)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;j0&lt;/code&gt; contains the original couplings that we defined and &lt;code&gt;jc&lt;/code&gt; contains the couplings that enforce the integrity of the chains (they correlate the qubits within the chains). Thus, we need to combine them again into one big $J$ dictionary:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;J = j0.copy()&#xA;J.update(jc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, we're ready to solve the embedded problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;params = {&quot;answer_mode&quot;: 'histogram', &quot;num_reads&quot;: 10000}&#xA;raw_results = solve_ising(solver, h, J, **params)&#xA;&#xA;print 'Lowest energy found: {}'.format(raw_results['energies'])&#xA;print 'Number of occurences: {}'.format(raw_results['num_occurrences'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;raw_results&lt;/code&gt; will not make sense to us unless we unembed the problem. In case, some chains broke we are fixing them through a majority vote as defined by the optional argument &lt;code&gt;broken_chains&lt;/code&gt;:    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;unembedded_results = unembed_answer(raw_results['solutions'],&#xA;                                    embedding, broken_chains='vote')&#xA;&#xA;print 'Solution string: {}'.format(unembedded_results)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you run this, you should get the correct result in all readouts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Lowest energy found: [-5.0]&#xA;Number of occurences: [10000]&#xA;Solution string: [[1, -1, -1, 1]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this answered your question and I highly recommend checking out all the additional parameters that you can pass to the &lt;code&gt;solve_ising&lt;/code&gt; function to improve the quality of your solutions such as &lt;code&gt;num_spin_reversal_transforms&lt;/code&gt; or &lt;code&gt;postprocess&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1234" LastEditorUserId="27" LastEditDate="2018-05-19T10:35:07.823" LastActivityDate="2018-05-19T10:35:07.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1484" PostTypeId="2" ParentId="1474" CreationDate="2018-03-30T03:55:37.417" Score="6" Body="&lt;p&gt;Or even look at &lt;a href=&quot;https://www.mathstat.dal.ca/~selinger/quipper/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quipper&lt;/a&gt;, a functional Quantum programming language. With monadic semantics, built in functionality for reversible quantum computation, hierarchical circuit support, and more! &#xA;Used in actual practice too – for an &lt;a href=&quot;https://arxiv.org/abs/1611.05484&quot; rel=&quot;nofollow noreferrer&quot;&gt;algorithm to compute the solution of the Dirac equation&lt;/a&gt; by LaFlamme. &lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="45" LastEditDate="2018-04-04T11:27:00.380" LastActivityDate="2018-04-04T11:27:00.380" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1485" PostTypeId="1" AcceptedAnswerId="1535" CreationDate="2018-03-30T04:12:01.383" Score="8" ViewCount="659" Body="&lt;p&gt;One of the biggest drawbacks of Bayesian learning against deep learning is runtime: applying Bayes' theorem requires knowledge on how the data is distributed, and this usually requires either expensive integrals or some sampling mechanism (with the corresponding drawbacks).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since at the end of the day is all about distribution propagations, and this is (as far as I understand) the nature of quantum computing, is there a way to perform these efficiently? If yes, what limitations do apply?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; (&lt;em&gt;directly related links&lt;/em&gt;): &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1622&quot;&gt;What is the argument that practical quantum computers cannot be built?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1432&quot;&gt;Is Google's 72 qubit device better than D-Wave's machines, which feature more than 2000 qubits?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="26" LastEditDate="2019-05-17T21:43:30.067" LastActivityDate="2019-05-17T21:43:30.067" Title="Can quantum computing speed up Bayesian learning?" Tags="&lt;machine-learning&gt;&lt;bayesian-learning&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1486" PostTypeId="1" AcceptedAnswerId="1499" CreationDate="2018-03-30T04:18:50.047" Score="13" ViewCount="1922" Body="&lt;p&gt;Quantum algorithms scale faster than classical ones (at least for &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;nofollow noreferrer&quot;&gt;certain problem clases&lt;/a&gt;), meaning quantum computers would require a much smaller number of logical operations for inputs above a given size.&lt;/p&gt;&#xA;&lt;p&gt;However, it is not so commonly discussed how quantum computers compare to regular computers (a normal PC today) in terms of power consumption per logical operation. (Has this not been talked about much, because the main focus of quantum computers is how fast they can compute data?)&lt;/p&gt;&#xA;&lt;p&gt;Can someone explain why quantum computing would be more or less power-efficient than classical computing, per logical operation?&lt;/p&gt;&#xA;" OwnerUserId="1348" LastEditorUserId="-1" LastEditDate="2021-02-07T17:47:41.537" LastActivityDate="2021-02-07T17:47:41.537" Title="How power-efficient are quantum computers?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;performance&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1487" PostTypeId="1" AcceptedAnswerId="1498" CreationDate="2018-03-30T04:46:38.663" Score="3" ViewCount="172" Body="&lt;p&gt;&lt;a href=&quot;https://physicstoday.scitation.org/action/showDoPubSecure?doi=10.1063%2FPT.6.1.20180328a&amp;amp;format=full&quot; rel=&quot;nofollow noreferrer&quot;&gt;This divulgation article&lt;/a&gt; by Prof. Brukner talks about the possibility of creating a situation where&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;A causing B&quot; and &quot;B causing A&quot; which we call a &lt;strong&gt;quantum switch&lt;/strong&gt;. Such a setup is similar to some predator–prey relationships, in which predator numbers influence prey numbers, yet prey numbers also influence predator numbers. Following &lt;a href=&quot;https://www.nature.com/articles/ncomms2076&quot; rel=&quot;nofollow noreferrer&quot;&gt;work&lt;/a&gt; that Ognyan Oreshkov, Fabio Costa, and I published in 2012, we now know that the quantum switch is just one example of an indefinite causal structure, in which it is not defined whether event A is a cause or an effect of event B, or whether the two are independent.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/julZN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/julZN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The work link leads to a paper that explains with great detail how to achieve that, and it also includes some applications, like to &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.86.040301&quot; rel=&quot;nofollow noreferrer&quot;&gt;prove that two no-signalling channels that are not perfectly distinguishable in any ordinary quantum circuit can become perfectly distinguishable through the quantum superposition of circuits with different causal structures&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a regular programmer without a background in quantum computing and don't quite understand the implications of such articles. What I get, and find very exciting is the possibility of having such expanded causality models as a tool. &lt;strong&gt;My question is: how/where could quantum switch fit in the classical computing landscape?&lt;/strong&gt; Be it low-level hardware design or the (surely upcoming) &lt;code&gt;else-then-if&lt;/code&gt; software pattern &lt;/p&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="1346" LastEditDate="2018-03-30T05:18:06.393" LastActivityDate="2018-03-30T13:08:35.817" Title="What impact would have introducing the quantum switch effect in classical computing?" Tags="&lt;classical-computing&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1488" PostTypeId="1" AcceptedAnswerId="1511" CreationDate="2018-03-30T04:48:01.183" Score="8" ViewCount="199" Body="&lt;p&gt;I've heard that quantum computers pose a major threat to 1024 bit and possibly even 2048 bit RSA public-private key cryptography. In the future however, bigger size keys will probably become at risk at one point or another, as newer, faster quantum computers are created, for lots of (if not, all) algorithms. How can I reliably know if a key size, or even an algorithm itself is secure and safe to use at the current time? Is there a reliable resource/website that calculates which key sizes are currently at risk, based on how fast the newest quantum computers are? Or possibly, will new algorithms be created which try to prevent quantum computers from being able to crack them easily? The goal here is to keep the UX positive by not making a product slow due to encryption, but slower apps are worth it to guarantee a safe transfer of data.&lt;/p&gt;&#xA;" OwnerUserId="1348" LastActivityDate="2018-04-15T12:45:51.220" Title="How can we reliably know if a key size is still safe to use as new quantum computers are created?" Tags="&lt;cryptography&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1489" PostTypeId="1" AcceptedAnswerId="1506" CreationDate="2018-03-30T05:14:41.020" Score="8" ViewCount="293" Body="&lt;p&gt;In words of &lt;a href=&quot;https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Curry–Howard correspondence is the observation that two families of seemingly unrelated formalisms—namely, the proof systems on one hand, and the models of computation on the other—are in fact the same kind of mathematical objects [...] &lt;em&gt;a proof is a program, and the formula it proves is the type for the program&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Further, under &lt;a href=&quot;https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence#General_formulation&quot; rel=&quot;noreferrer&quot;&gt;General Formulation&lt;/a&gt;, it provides the following table and the statement that bears my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/d0XKD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/d0XKD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In its more general formulation, the Curry–Howard correspondence is a correspondence between formal proof calculi and type systems for models of computation. In particular, it splits into two correspondences. One at the level of formulas and types that is independent of which particular proof system or model of computation is considered, and one at the level of proofs and programs which, this time, &lt;strong&gt;is specific to the particular choice of proof system and model of computation considered&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is quantum computing in this hindsight equivalent to classical computing, or is it a different &quot;model of computation&quot; (i.e. does it have a different set of elements in the &lt;em&gt;Programming side&lt;/em&gt;)?  Would it still correspond to the exact same &lt;em&gt;Logic side&lt;/em&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="1346" LastEditDate="2018-03-30T15:29:19.633" LastActivityDate="2018-03-30T15:29:19.633" Title="How does the Curry-Howard correspondence apply to quantum programs?" Tags="&lt;classical-computing&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1490" PostTypeId="1" AcceptedAnswerId="1497" CreationDate="2018-03-30T05:36:52.240" Score="10" ViewCount="2195" Body="&lt;p&gt;I'm a total beginner, I've been brought here by the &lt;a href=&quot;https://stackoverflow.blog/2018/03/27/quantum-computing-site-launches-with-the-help-of-strangeworks/?cb=1&quot;&gt;featured stackoverflow blog post&lt;/a&gt; so I started studying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Watching this youtube video (&lt;a href=&quot;https://youtu.be/JRIPV0dPAd4?t=3m58s&quot; rel=&quot;noreferrer&quot;&gt;A Beginner’s Guide To Quantum Computing (3:58&lt;/a&gt;), I saw this slide where it talks about superposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ckamO.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ckamO.png&quot; alt=&quot;Quantum superposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first I thought that, besides qubits, which can be in a superposition of 0s and 1s, there's also a qsphere, which can be in a superposition of 5 zeros and 5 ones, when in fact it's &lt;em&gt;just&lt;/em&gt; 5 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when we say a qsphere, it's known to be 5 qubits? &lt;/p&gt;&#xA;" OwnerUserId="1115" LastEditorUserId="26" LastEditDate="2018-12-23T12:15:05.687" LastActivityDate="2018-12-23T12:15:05.687" Title="Is qsphere an actual term representing 5 qubits?" Tags="&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1491" PostTypeId="5" CreationDate="2018-03-30T06:03:26.720" Score="0" Body="&lt;p&gt;A &lt;strong&gt;qutrit&lt;/strong&gt; is a unit of quantum information that exists as a superposition of three orthogonal quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;qutrit&lt;/strong&gt; is analogous to the classical &lt;em&gt;trit&lt;/em&gt;, just as the &lt;a href=&quot;/questions/tagged/qubit&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;qubit&amp;#39;&quot; rel=&quot;tag&quot;&gt;qubit&lt;/a&gt;, a quantum particle of two possible states, is analogous to the classical &lt;em&gt;bit&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;(source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Qutrit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;)&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="609" LastEditDate="2018-03-30T06:52:11.180" LastActivityDate="2018-03-30T06:52:11.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1492" PostTypeId="4" CreationDate="2018-03-30T06:03:26.720" Score="0" Body="For questions related to quantum trits i.e. three-level (dimensional) quantum mechanical systems. They are higher dimensional analogues of qubits (aka quantum bits), which are two-level (dimensional) quantum mechanical systems. " OwnerUserId="609" LastEditorUserId="26" LastEditDate="2018-07-05T09:05:51.457" LastActivityDate="2018-07-05T09:05:51.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1494" PostTypeId="5" CreationDate="2018-03-30T06:07:35.130" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-30T06:07:35.130" LastActivityDate="2018-03-30T06:07:35.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1495" PostTypeId="4" CreationDate="2018-03-30T06:07:35.130" Score="0" Body="Quantum decoherence is the loss of quantum coherence. As long as there exists a definite phase relation between different states, the system is said to be coherent. This coherence is a fundamental property of quantum mechanics and is necessary for the functioning of quantum computers. (Wikipedia)" OwnerUserId="609" LastEditorUserId="26" LastEditDate="2019-01-01T09:28:08.900" LastActivityDate="2019-01-01T09:28:08.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1496" PostTypeId="2" ParentId="1490" CreationDate="2018-03-30T06:25:38.280" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is qsphere an actual term representing 5 qubits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If it is, it is not widely used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I claim this because I looked around in &lt;a href=&quot;https://arxiv.org/find/all/1/all:+qsphere/0/1/0/all/0/1&quot; rel=&quot;noreferrer&quot;&gt;arXiv&lt;/a&gt;, a repository of electronic preprints of research articles, and found nothing. There are many other units of quantum information than just qubit though. All of the following appear at least occasionally in the relevant literature.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Qubit has a computational basis of two states and can be implemented by a two-level quantum system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Qutrit has a computational basis of three states.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Ququart is a (rare) term used by some, and it has a basis of four.&lt;/li&gt;&#xA;&lt;li&gt;Qudit is a common term. It is the $d$-dimensional generalization of a qubit. Often $d$ is left unspecified and these are used when comparing the effect of using different values of it.&lt;/li&gt;&#xA;&lt;li&gt;Qumode is again a bit less often used term in continuous-variable quantum computing, where now, informally speaking, the basis has infinitely many elements.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="144" LastActivityDate="2018-03-30T06:25:38.280" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1497" PostTypeId="2" ParentId="1490" CreationDate="2018-03-30T07:27:30.733" Score="12" Body="&lt;p&gt;The qsphere is a way of representing multi-qubit states. So it could be used for 5 qubit states, but it could also be used for any other number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could also be used for just one qubit. But in this case it is important to note that the single qubit qsphere is &lt;strong&gt;not&lt;/strong&gt; the same as the &lt;em&gt;Bloch sphere&lt;/em&gt;, which is our standard way of representing single qubit states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, the qsphere is essentially a more visually appealing version of a histogram. It was &lt;a href=&quot;https://www.qiskit.org/ibmqx-user-guides/full-user-guide/001-The_IBM_Quantum_Experience/006-The_Results.html&quot; rel=&quot;noreferrer&quot;&gt;introduced by IBM&lt;/a&gt; as a visualization for the Quantum Experience, but doesn't seem to be used so much by them any more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To construct the qsphere of a state, you have to think of the histogram you'd get if you measure in the $|0 \rangle,|1 \rangle$ basis. For example, suppose I have a 4 qubit state that would give me the results&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'0000':0.5, '0101':0.25, '0011:'0.125, '0111':0.125}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here the bit string &lt;code&gt;0000&lt;/code&gt; comes out with probability $0.5$, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the qsphere, this would be represented by four points: one for each of these non-zero probabilities. The latitude of the points depends on the number of &lt;code&gt;0&lt;/code&gt;s and &lt;code&gt;1&lt;/code&gt;s in the bit string. Our result that has all &lt;code&gt;0&lt;/code&gt;s would be at the north pole. Our &lt;code&gt;0111&lt;/code&gt;, with mostly &lt;code&gt;1&lt;/code&gt;s, would be near the south pole. The two results &lt;code&gt;0101&lt;/code&gt; and &lt;code&gt;0011&lt;/code&gt; that we have in our example would be at the equator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability is represented by the strength of the line. The two with probability of only $0.125$ would have quite faint lines. The one with probability $0.5$ would have a much thicker line. Those with $0.25$ would be somewhere in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, we have represented all aspects of the histogram, but have not included any phase information that the state might also have. This can be encoded using the colour of the points. The sphere then has all the information on the multi-qubit state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see why it is not the nicest visualization there is, imagine performing a Hadamard gate. This transforms latitude and longitude information into colour, and vice-versa. Despite being a simple gate, it would have a very complex effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then again, what visualization of many qubits doesn't have its weaknesses? If it was easy to visualize them, it would be easy to simulate them. And then we'd have no need to build quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="609" LastEditDate="2018-03-30T08:53:09.390" LastActivityDate="2018-03-30T08:53:09.390" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1498" PostTypeId="2" ParentId="1487" CreationDate="2018-03-30T08:16:59.953" Score="3" Body="&lt;p&gt;The answer depends on what exactly you mean by &quot;&lt;em&gt;fit&lt;/em&gt;&quot;, but, generally speaking, there do not seem to be direct applications of indefinite causal structures for classical computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the interest of techniques like the quantum switch$^\dagger$ (aside from the purely fundamental aspects) is that they provide methods to create non-classical correlations, and more generally encoding quantum information (e.g. qubits) into &quot;causal&quot; degrees of freedoms, as nicely shown in Figure 1 &lt;a href=&quot;http://advances.sciencemag.org/content/advances/3/3/e1602589.full.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, one could imagine a quantum computer in which the qubits are encoded into (a)causal structures.&#xA;However, apart from the notable impracticality of storing and maintaining many qubits encoded in such a way, it is also not known how one could apply operations between them.&#xA;Interestingly, in at least some limited form, this is possible, as recently demonstrated in &lt;a href=&quot;https://arxiv.org/abs/1712.06884&quot; rel=&quot;nofollow noreferrer&quot;&gt;1712.06884&lt;/a&gt;, where two different such qubits were entangled, and the associated Bell violations observed.&#xA;It is not known if or how one could scale such experiments to more qubits.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;$^\dagger$ It is worth mentioning that there have also been at least two (to my knowledge) experimental demonstrations of indefinite causal orders: &lt;a href=&quot;https://arxiv.org/abs/1608.01683&quot; rel=&quot;nofollow noreferrer&quot;&gt;1608.01683&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1712.06884&quot; rel=&quot;nofollow noreferrer&quot;&gt;1712.06884&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-30T13:08:35.817" LastActivityDate="2018-03-30T13:08:35.817" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1499" PostTypeId="2" ParentId="1486" CreationDate="2018-03-30T08:42:55.620" Score="9" Body="&lt;p&gt;As usual, it is too soon to make comparisons like this.&#xA;The power consumption of a device will depend &lt;em&gt;strongly&lt;/em&gt; on the architecture it uses, for one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;em&gt;in principle&lt;/em&gt;, there is no reason to suspect that quantum computers would consume more energy than classical devices performing the same operations.&#xA;Indeed, one would expect the opposite, the fundamental reason being that quantum computers work (mostly) via &lt;em&gt;unitary&lt;/em&gt; operations.&#xA;A &lt;em&gt;unitary&lt;/em&gt; operation is a &lt;em&gt;reversible&lt;/em&gt; operation, or, in other words, an operation during which &lt;em&gt;no information is lost to the environment&lt;/em&gt;.&#xA;Such an operation is basically &quot;perfectly&quot; energy efficient (for one, it wouldn't produce heat).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;em&gt;in principle&lt;/em&gt;, the elementary operations performed in a quantum algorithm which uses unitary operations &lt;em&gt;can&lt;/em&gt; be ideally energy efficient.&#xA;This is in direct contrast with what you have with classical devices, in which the elementary operations are non-reversible, and therefore necessarily &quot;waste&quot; some amount of information for every operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said this, there are a million caveats to be taken into account.&#xA;For example, quantum computers in the real world will have to deal with decoherence, so that the operations are not really unitary. This implies that error-correction protocols are necessary to take this into account, and one should then go and track what is the added energy consumption of this whole process.&#xA;Also, while unitary operations are energy efficient, in practice when one acquires the result of the measurement, measurements have to be performed, and these are non-reversible operations which typically destroy information. After each such measurement, one will need to generate the information carriers again. Also, many quantum computing protocols rely on repeated measurements &lt;em&gt;during&lt;/em&gt; the computation.&#xA;One could go on and on, as this is very much uncharted territory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One recent work that discusses in some measure the power consumption problem is &lt;a href=&quot;https://arxiv.org/abs/1610.02365&quot; rel=&quot;nofollow noreferrer&quot;&gt;1610.02365&lt;/a&gt;, in which the authors present a method for (classical machine learning) information processing using photonic chips.&#xA;One claim of the authors is that photonic chips allow to perform operations in an extremely energy efficient way, exploiting the natural evolution of coherent light.&#xA;&lt;em&gt;They do not demonstrate any form quantum computation&lt;/em&gt;, but their energy efficiency reasonings would not change much when using the same device for &lt;em&gt;quantum&lt;/em&gt; information processing.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-05T20:16:34.537" LastActivityDate="2019-06-05T20:16:34.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1500" PostTypeId="1" AcceptedAnswerId="1503" CreationDate="2018-03-30T09:01:15.557" Score="3" ViewCount="196" Body="&lt;p&gt;On the &lt;a href=&quot;https://www.dwavesys.com/d-wave-two-system&quot; rel=&quot;noreferrer&quot;&gt;D-Wave 2000Q website&lt;/a&gt;, it is stated that the processor environment is kept &quot;in a high vacuum: pressure is 10 billion times lower than atmospheric pressure&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why the pressure has to be such low? What would happen to the computer if the pressure increases?&lt;/p&gt;&#xA;" OwnerUserId="609" LastEditorUserId="26" LastEditDate="2018-03-30T10:00:09.517" LastActivityDate="2018-11-19T13:03:57.387" Title="Why D-Wave 2000Q requires such a low pressure?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;d-wave&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1501" PostTypeId="2" ParentId="1462" CreationDate="2018-03-30T09:13:30.350" Score="6" Body="&lt;p&gt;To simplify things a bit, let's take a single qubit and a single qutrit for comparison.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the amplitude damping channel (giving e.g. emission of a photon) for a qubit is $\mathcal E\left(\rho\right) = E_0\rho E_0^\dagger + E_1\rho E_1^\dagger$, where $$E_0 = \begin{pmatrix}1 &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp;\sqrt{1-\gamma}\end{pmatrix}, \quad E_1 = \begin{pmatrix} 0 &amp;amp;&amp;amp; \sqrt \gamma \\ 0 &amp;amp;&amp;amp;0\end{pmatrix},$$ with $E_0$ being required for normalisation. This can also be written as $E_0 = \left|0\rangle\langle 0\right| + \sqrt{1-\gamma}\left|1\rangle\langle 1\right|$ and $E_1 = \sqrt{\gamma}\left|0\rangle\langle 1\right|$. When $\gamma = 1$, the amplitude damping channel gives the state $$\rho = \begin{pmatrix} 1 &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp; 0\end{pmatrix} = \left|0\rangle\langle 0\right|$$ with certainty. However, this only applies at $0$ temperature, so to represent what happens at &lt;em&gt;finite&lt;/em&gt; temperature, the &lt;em&gt;generalised amplitude damping&lt;/em&gt; channel needs to be used. This has $\mathcal E\left(\rho\right) = \sum_kE_k\rho E_k^\dagger$, where $$E_0 = \sqrt p\begin{pmatrix}1 &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp;\sqrt{1-\gamma}\end{pmatrix}, \quad E_1 = \sqrt p\begin{pmatrix} 0 &amp;amp;&amp;amp; \sqrt \gamma \\ 0 &amp;amp;&amp;amp;0\end{pmatrix},$$ $$E_2 = \sqrt{1-p}\begin{pmatrix}\sqrt{1-\gamma} &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp;1\end{pmatrix}, \quad E_3 = \sqrt{1-p}\begin{pmatrix} 0 &amp;amp;&amp;amp; 0 \\ \sqrt \gamma &amp;amp;&amp;amp;0\end{pmatrix}.$$ Each of these can be split into four sections - an element in the upper left (bottom right) corner causes the amplitude of the upper left (bottom right) corner to decrease (here, this is really just a normalisation factor) while having a single element in a matrix, which is in the top right (bottom left) causes loss (gain) from the bottom right (top left) to the top left (bottom right) element of the density matrix. Now when $\gamma = 1$, this gives the state $$\rho = \begin{pmatrix}p &amp;amp;&amp;amp; 0\\ 0 &amp;amp;&amp;amp; 1-p\end{pmatrix} = p\left|0\rangle\langle 0\right| + \left(1-p\right)\left|1\rangle\langle 1\right|.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows that after a long time, the loss and gain cancel (i.e. no more loss or gain occurs), although this state is not very useful for computation, so lets try extending this a bit and adding another qubit. Lets go a bit further than that and take a pair of coupled spin-half fermions (such as a pair of electrons). This gives 4 states - the singlet state $S = \frac{1}{\sqrt 2}\left(\left|\uparrow\downarrow\right&amp;gt; - \left|\downarrow\uparrow\right&amp;gt;\right)$. It also gives a &lt;em&gt;subspace&lt;/em&gt; of triplet states $T = \left\lbrace \left|\uparrow\uparrow\right&amp;gt;, \frac{1}{\sqrt 2}\left(\left|\uparrow\downarrow\right&amp;gt; + \left|\downarrow\uparrow\right&amp;gt;\right), \left|\downarrow\downarrow\right&amp;gt;\right\rbrace = \left\lbrace T_0, T_1, T_2\right\rbrace$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Describing this as a qudit with $d=4$ and using an equivalent 'qudit generalised amplitude damping channel' gives a few possible interaction as in the qubit case:   &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;loss from the triplet subspace to the singlet state&lt;/li&gt;&#xA;&lt;li&gt;gain from the singlet state to the triplet subspace&lt;/li&gt;&#xA;&lt;li&gt;amplitude damping within the triplet subspace.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;By itself, this still doesn't help very much, so lets place this pair of spin-half particles in the centre of a larger system (a 'spin bath', here used as the environment, mediating the interaction) and allow it to interact. As the states in the triplet subspace are symmetric and it is in the centre of a bath, the probability rate of amplitude damping on the first qubit will, on average, equal the rate of amplitude damping on the second qubit. This means that, instead of having a single qudit amplitude damping channel, there are two copies of the same generalised amplitude damping channel, which reduces the number of possible interactions. In the limit of long time and taking $p=1/2$ (this is just setting the system to a certain non-zero temperature), these are, ignoring normalisation: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;gain on the $\left|\downarrow\downarrow\right&amp;gt; = T_2$ state: $$T_2\rightarrow T_2' \propto T_2 + \beta T_1 + \beta^2T_0$$&lt;/li&gt;&#xA;&lt;li&gt;loss on the $\left|\uparrow\uparrow\right&amp;gt; = T_0$ state: $$T_0\rightarrow T_0' \propto T_0 + \beta T_1 + \beta^2T_2$$&lt;/li&gt;&#xA;&lt;li&gt;gain and loss on the $\frac{1}{\sqrt 2}\left(\left|\uparrow\downarrow\right&amp;gt;\pm  \left|\downarrow\uparrow\right&amp;gt;\right)$ states ($S$ and $T_1$ states): $$T_1\rightarrow T_1' \propto \left(1+\beta^2\right)T_1 + \beta \left(T_0+T_2\right)$$ $$S\rightarrow S' \propto\left(1-\beta^2\right) S.$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This shows that &lt;em&gt;oscillations&lt;/em&gt; in the triplet subspace occur &lt;em&gt;instead of decay&lt;/em&gt;, meaning that the &lt;strong&gt;triplet subspace is a &lt;em&gt;decoherence free subsystem&lt;/em&gt; and can be used as a qutrit&lt;/strong&gt;. In reality, interactions are more complicated and there will be other types of noise, so there will still be some decoherence, but the reasoning is still the same in that pairing two spin-half particles allows for the triplet state to be used as a decoherence free subsystem (or at least have less decoherence than a qubit) to mitigate the effects of some types of noise.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-03-30T09:13:30.350" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1502" PostTypeId="2" ParentId="115" CreationDate="2018-03-30T09:42:57.463" Score="10" Body="&lt;p&gt;A good summary on the current state of QRAM (as of 2017) can be found in &lt;a href=&quot;http://rspa.royalsocietypublishing.org/content/474/2209/20170551&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, and a comparison of it with classical methods can be found in &lt;a href=&quot;http://pirsa.org/displayFlash.php?id=16080019&quot; rel=&quot;nofollow noreferrer&quot;&gt;this talk&lt;/a&gt;. The Giovannetti type &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.100.160501&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;bucket brigade&quot; QRAM&lt;/a&gt; still seems to be the best that is known, although modifications exist. There are serious caveats to the use of any such QRAM, and no alternative that avoids these has yet been proposed (other than using massively parallelized classical computers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;bucket brigade&quot; QRAM encodes in superposition &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional vectors into &lt;span class=&quot;math-container&quot;&gt;$\log(Nd)$&lt;/span&gt; qubits using &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log(Nd))$&lt;/span&gt; time. An alternative scheme with polynomial time reduction was proposed in &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.86.010306&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. In either case, the number of physical resources used is is exponential with the number of qubits. This could cause problems that limit the implementation and/or usefulness of the scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue depends on how many components need to be active at once. Ideally, the number of active components needs only be linear with the number of qubits in the memory. However, actual implementations are usually far from ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1367-2630/17/12/123010/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt;, for example, looks at the effects of noise, and concludes that the need for error correction could remove any advantages of the small number of active components. The severity of this potential problem depends on what algorithm is being used by the quantum computer, and so how many times the QRAM must be queried. For a polynomial number of queries, full fault-tolerance could be avoided. But for superpolynomial queries, such as for Grover's search, full-tolerance seems to be needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as comparing to other possibilities goes, it has been argued that the exponential number of resources for the QRAM should be compared to a classical parallel architecture with an exponential number of processors. The quantum algorithm does not look so great with this comparison. As explained &lt;a href=&quot;http://pirsa.org/displayFlash.php?id=16080019&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, some algorithms for which we expect a quantum speedup are actually slower when this parallelism is taken into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though not as general in scope, another proposal for putting classical data into superpositions was also proposed &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208112&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and so deserves a mention.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2019-05-15T14:58:21.083" LastActivityDate="2019-05-15T14:58:21.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1503" PostTypeId="2" ParentId="1500" CreationDate="2018-03-30T09:50:02.863" Score="7" Body="&lt;p&gt;Pressure implies the presence of stray atoms flying around messing things up. The use of a vacuum is required to prevent this, as one of the ways of keeping the device well isolated from unwanted effects. I think that they are just intending the &quot;10 billion times lower than atmospheric pressure&quot; statement to demonstrate how good their vacuum is.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-30T12:10:27.273" LastActivityDate="2018-03-30T12:10:27.273" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1504" PostTypeId="2" ParentId="1488" CreationDate="2018-03-30T09:51:34.647" Score="3" Body="&lt;p&gt;Given that you mention large key sizes (1024 bit and up), you are talking about asymmetric cryptography. Other (symmetric) cryptographic schemes are safe by simply doubling their key size (e.g. going from 128 to 256 bits) because that compensates for the theoretical advantage of Grover's algorithm for an exhaustive search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asymmetric cryptography can be divided into currently used, practical schemes (essentially RSA and ECC) and postquantum cryptography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Shor's algorithm scales (in runtime) as $O(n^3)$, once a certain key size of RSA or ECC is unsafe, even doubling its size will only mean an 8-fold increase in the computational difficulty to calculate the new private key with a quantum computer: Once you conclude that RSA and ECC keys are no longer safe due to quantum computers, going to longer key lengths will not gain much. New algorithms (&quot;postquantum cryptography&quot;) are being designed that are believed to be safe against attacks using quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Postquantum cryptography already takes quantum computers as attack vectors into account. They typically require huge key sizes, though (such as more than 10 kbits).&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-04-14T15:58:08.860" LastActivityDate="2018-04-14T15:58:08.860" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1505" PostTypeId="2" ParentId="1468" CreationDate="2018-03-30T10:27:29.263" Score="1" Body="&lt;p&gt;Even if you assume that your quantum computer will be based on qubits, it can operate with an arbitrarily large number of states (if it has enough qubits): The combination of two qubits allow it to calculate with a total of four states, that of three qubits with eight states, etc.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-30T10:27:29.263" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1506" PostTypeId="2" ParentId="1489" CreationDate="2018-03-30T10:35:42.030" Score="4" Body="&lt;p&gt;Quantum computing doesn't change the Curry-Howard isomorphism, for the following reasons:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum computers can simulate Turing machines and vice versa. These devices can be faster at certain tasks, but the computable languages remain the same. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is, a priori, no reason we cannot apply the model of the Turing machine of Lambda calculus to quantum computers, &lt;em&gt;even if they can compute different, mutually exclusive languages&lt;/em&gt;!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For practical purposes, I very much doubt quantum computing will be of use in automated theorem proving or proof assistance (by computers).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, as for your question, yes in the context of Curry-Howard, we can consider a quantum computer and a classical machine equivalent, as it is likely we wish to model both with the Lambda calculus for the purpose of the isomorphism.&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-03-30T10:35:42.030" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1508" PostTypeId="1" AcceptedAnswerId="1592" CreationDate="2018-03-30T11:30:38.670" Score="15" ViewCount="596" Body="&lt;p&gt;Let, for a Quantum Turing machine (QTM), the state set be $Q$, and the alphabet of symbols be $\sum=\{0,1\}$, which appear at the tape head. Then, as per my understanding, at any given time while the QTM is calculating, the qubit that appears at its head will hold an arbitrary vector $V_\sum = a|1\rangle+b|0\rangle$. Also, if $|q_0\rangle , |q_1\rangle, ... \in Q$, then the state vector at that instance will also be an arbitrary vector $V_q=b_0|q_0\rangle + b_1 |q_1\rangle+ ...$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, after the instruction cycle is complete, the vectors $V_\sum$ and $V_q$ will decide whether the QTM will move left or right along the Qubit tape. My question is- since Hilbert space formed by $Q \otimes \sum$ is an uncountable infinite set and $\{\text{Left,Right}\}$ is a discrete set, the mapping between them will be difficult to create.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how is the decision to move left or right made? Does the QTM move both left and right at the same time, meaning that the set $\{\text{Left,Right}\}$ also forms a different Hilbert space, and hence the motion of the QTM becomes something like $a|\text{Left}\rangle+b|\text{Right}\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, just like a Classical Turing machine, the QTM moves either left or right, but not both at the same time?&lt;/p&gt;&#xA;" OwnerUserId="1355" LastEditorUserId="26" LastEditDate="2018-12-13T19:41:32.967" LastActivityDate="2018-12-13T19:41:32.967" Title="In a Quantum Turing Machine, how is the decision to move along the memory tape made?" Tags="&lt;classical-computing&gt;&lt;models&gt;&lt;quantum-turing-machine&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1509" PostTypeId="1" CreationDate="2018-03-30T11:45:20.377" Score="7" ViewCount="206" Body="&lt;p&gt;In the context of quantum control theory, it is common to see references to both &lt;em&gt;quantum control&lt;/em&gt; and &lt;em&gt;quantum optimal control&lt;/em&gt; (e.g. &lt;a href=&quot;https://arxiv.org/abs/0910.2350&quot; rel=&quot;noreferrer&quot;&gt;0910.2350&lt;/a&gt; or the &lt;a href=&quot;http://qutip.org/docs/latest/guide/guide-control.html&quot; rel=&quot;noreferrer&quot;&gt;guide on qutip quantrum control functions&lt;/a&gt;).&#xA;Sometimes it seems like the two terms are used interchangeably, while sometimes they are treated as different things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, from the above link, it seems that &lt;em&gt;quantum optimal control&lt;/em&gt; is (unsurprisingly) a special kind of &lt;em&gt;quantum control&lt;/em&gt;.&#xA;It is however not too clear what the exact difference is between the two.&#xA;For example, are both approaches used to tackle the same classes of problems? Is the only difference in quantum optimal control theory looking for &lt;em&gt;optimal&lt;/em&gt; solutions, while &lt;em&gt;quantum control&lt;/em&gt; techniques have less strict requirements?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-30T11:52:31.807" LastActivityDate="2018-03-30T11:52:31.807" Title="What is the difference between quantum control and quantum optimal control?" Tags="&lt;quantum-gate&gt;&lt;quantum-control&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1511" PostTypeId="2" ParentId="1488" CreationDate="2018-03-30T12:45:37.980" Score="7" Body="&lt;p&gt;We (i.e. the current state of research) just don't know, but we can guess. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We &lt;em&gt;guess&lt;/em&gt; that there may be a problem if Post Quantum Crypto (PQC) lags behind, as &lt;em&gt;Shor's algorithm&lt;/em&gt; can solve the factoring problem efficiently (thereby breaking RSA public key crypto) or for &lt;em&gt;Grover's algorithm&lt;/em&gt; to force a doubling of the number of bits for &lt;em&gt;all keys&lt;/em&gt;, as it can search a keyspace of $n$ bits in $O(2^{n/2})$ time (proportional to the square root of the size of the space of all possible keys), instead of expected $O(2^n)$ for the classical brute force algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, PQC tries to create cryptography based on methods for which we &lt;em&gt;currently think&lt;/em&gt; that quantum computing offers little advantage, such as lattice based or coding based crypto. But we can't know this for certain, just as we don't know whether there are &lt;em&gt;classical&lt;/em&gt; algorithms that break current 'commercial grade' crypto.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for RSA, increasing the key size simply doesn't work, as Shor can factor in time of a rather low order polynomial to crack the key. In other words, a key big enough for Shor to fail, is a key big enough such that any normal en/decryption operations are impossible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we really need replacements. Fortunately, I think that PQC started on time and that we will get a good replacement for RSA (and others!) when the truly powerful machines capable of running Shor and Grover effectively arrive.&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-15T11:08:47.643" LastActivityDate="2018-04-15T11:08:47.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1512" PostTypeId="5" CreationDate="2018-03-30T13:39:20.780" Score="0" Body="&lt;p&gt;As stated by Jarosław Adam Miszczak in his book &quot;&lt;em&gt;&lt;a href=&quot;https://books.google.com/books?id=rZFhAQAAQBAJ&amp;amp;printsec=frontcover&quot; rel=&quot;nofollow noreferrer&quot;&gt;High-level Structures in Quantum Computing&lt;/a&gt;&lt;/em&gt;&quot;,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum programming is the process of assembling sequences of instructions, called quantum programs, that are capable of running on a quantum computer. Quantum programming languages help express quantum algorithms using high-level constructs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum programming languages with tags on this site include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;/questions/tagged/qiskit&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;qiskit&amp;#39;&quot; rel=&quot;tag&quot;&gt;qiskit&lt;/a&gt; and &lt;a href=&quot;/questions/tagged/qasm&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;qasm&amp;#39;&quot; rel=&quot;tag&quot;&gt;qasm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;/questions/tagged/q%23&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;q#&amp;#39;&quot; rel=&quot;tag&quot;&gt;q#&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;/questions/tagged/cirq&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;cirq&amp;#39;&quot; rel=&quot;tag&quot;&gt;cirq&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Forest and &lt;a href=&quot;/questions/tagged/pyquil&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;pyquil&amp;#39;&quot; rel=&quot;tag&quot;&gt;pyquil&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;More tags will hopefully be added in the future and creating tags on other quantum programming languages for appropriate questions is also encouraged.&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="23" LastEditDate="2019-05-24T14:56:13.240" LastActivityDate="2019-05-24T14:56:13.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1513" PostTypeId="4" CreationDate="2018-03-30T13:39:20.780" Score="0" Body="For questions about writing code to be executed on a quantum computer, or to more generally simulate some aspect of it. For questions about a specific programming language, please also include a more specific tag." OwnerUserId="82" LastEditorUserId="55" LastEditDate="2021-04-13T06:55:56.397" LastActivityDate="2021-04-13T06:55:56.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1514" PostTypeId="1" CreationDate="2018-03-30T13:40:07.423" Score="9" ViewCount="252" Body="&lt;p&gt;With the integer factorisation problem, Shor's algorithm is known to provide a substantial (exponential?) speedup compared to classical algorithms. Are there similar results regarding more basic maths, such as evaluating transcendental functions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I want to calculate $\sin2$, $\ln{5}$ or $\cosh10$. In the classical world, I might use an expansion like the Taylor series or some iterative algorithm. Are there quantum algorithms that can be faster than what a classical computer can do, be it asymptotically better, fewer iterations to the same precision, or faster by wall clock time?&lt;/p&gt;&#xA;" OwnerUserId="580" LastEditorUserId="580" LastEditDate="2018-03-30T21:43:07.883" LastActivityDate="2018-03-30T21:43:07.883" Title="Does quantum computing provide any speedup in evaluation of transcendental functions?" Tags="&lt;algorithm&gt;&lt;speedup&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1515" PostTypeId="1" AcceptedAnswerId="1516" CreationDate="2018-03-30T14:12:09.133" Score="6" ViewCount="176" Body="&lt;p&gt;Do the latest D-Wave machines use compounds of &lt;span class=&quot;math-container&quot;&gt;$\require{\mhchem}\ce{^{3}He}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ce{^{4}He}$&lt;/span&gt; for cooling? If not, how does D-Wave approach cooling its plates low enough to achieve superconductivity? What compounds does DWave use for the plates in their fridge, and at what temperature do its plates reach superconductivity?&lt;/p&gt;&#xA;" OwnerUserId="1437" LastEditorUserId="26" LastEditDate="2019-05-17T21:32:39.280" LastActivityDate="2019-05-17T21:32:39.280" Title="Do the latest D-Wave computers use Helium compounds for cooling?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;d-wave&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1516" PostTypeId="2" ParentId="1515" CreationDate="2018-03-30T14:28:22.083" Score="6" Body="&lt;p&gt;Yes, they use $\require{\mhchem}\ce{^3He}$ and $\ce{^4He}$. No, they do not use compounds of these but instead a solution of these two (at the operating temperature) liquid nobel gases. The details can be found in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dilution_refrigerator&quot; rel=&quot;noreferrer&quot;&gt;wikipedia article on dilution refrigerators&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-03-30T14:28:22.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1517" PostTypeId="1" AcceptedAnswerId="1518" CreationDate="2018-03-30T14:29:03.303" Score="4" ViewCount="1363" Body="&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/ncomms2076&quot; rel=&quot;nofollow noreferrer&quot;&gt;This article&lt;/a&gt; talks about correlation and causality in quantum mechanics. In the abstract, under &lt;em&gt;Framework for local quantum mechanics&lt;/em&gt;, it says (emphasis mine):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The most studied, almost epitomical, quantum correlations are the &lt;strong&gt;non-signalling&lt;/strong&gt; ones, such as those obtained when Alice and Bob perform measurements on two entangled systems. &lt;strong&gt;Signalling&lt;/strong&gt; quantum correlations exist as well, such as those arising when Alice operates on a system that is subsequently sent through a &lt;strong&gt;quantum channel&lt;/strong&gt; to Bob who operates on it after that.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically, what is the difference between signalling and non-signalling, and what role does the channel play on that?&lt;/p&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="10480" LastEditDate="2021-04-16T20:44:19.157" LastActivityDate="2021-04-16T20:44:19.157" Title="What is the difference between signaling and non-signaling quantum correlations, and what is a signaling channel?" Tags="&lt;quantum-operation&gt;&lt;terminology&gt;&lt;correlations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1518" PostTypeId="2" ParentId="1517" CreationDate="2018-03-30T14:55:19.153" Score="6" Body="&lt;p&gt;Basically, it means that the correlations could be used to send a message. Or simply that Bob’s measurement outcomes can reveal some details of Alice’s actions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is impossible when Alice and Bob each hold one qubit of a Bell pair. Despite the entanglement present, as well as &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Quantum_contextuality&quot; rel=&quot;nofollow noreferrer&quot;&gt;contextuality&lt;/a&gt;, signaling in this case would result faster than light communication. And that’s not allowed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if Alice does something to a qubit and then gives it to Bob, signaling is certainly allowed. Alice could simply encode bit values as $|0\rangle$ and $|1\rangle$, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process of handing over the qubit is referred to as the ‘quantum channel’. This could be done by physically sending it, using a technique such as teleportation to transfer the state, or just Alice shouting ‘Hey Bob, this qubit is yours now’ across the lab. Often channels come with the application of noise, because nothing in life in perfect. But sometimes they are just a concept we invoke in our stories about Alice and Bob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that non-signaling correlations usually mean that some source correlated a couple of qubits, and then sent one to Alice and the other to Bob. There is then no causal link between what Alice does to hers, and what measurement results Bob gets from his. This is the reason for the lack of signaling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Signaling correlations, however, usually mean that Alice was the source of the qubit that was sent to Bob. So there is a causal relation: Alice directly affects what state Bob gets, and can use this to send information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how we would usually want to describe things but this paper would not want to use such language. This is because it is probing situations where the causal order can be indefinite. It therefore tries to identify these different kinds of correlations in a more general way, and also see if there is anything else.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-03-30T18:53:02.927" LastActivityDate="2018-03-30T18:53:02.927" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1519" PostTypeId="1" CreationDate="2018-03-30T15:27:57.613" Score="12" ViewCount="174" Body="&lt;p&gt;In Wikipedia we can read that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the Curry–Howard correspondence is a correspondence between formal proof calculi and type systems for models of computation. In particular, it splits into two correspondences. One at the level of formulas and types that is independent of which particular proof system or model of computation is considered, and one at the level of proofs and programs which, this time, is &lt;strong&gt;specific to the particular choice of proof system and model of computation considered&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1489/1346&quot;&gt;this other related question&lt;/a&gt; I asked about the relation between the C-H correspondence &lt;strong&gt;as it was conceived&lt;/strong&gt; and quantum computing. Here the questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does this theory have to be updated to embrace quantum-specific phenomena like extended causality?&lt;/li&gt;&#xA;&lt;li&gt;If yes, what are the changes made?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="2645" LastEditDate="2018-12-18T19:39:54.097" LastActivityDate="2018-12-18T19:39:54.097" Title="Does the Curry-Howard correspondence have a quantum-specific type system?" Tags="&lt;programming&gt;&lt;models&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1520" PostTypeId="2" ParentId="1514" CreationDate="2018-03-30T18:04:33.287" Score="6" Body="&lt;p&gt;The only thing I can think of is the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0606229&quot; rel=&quot;noreferrer&quot;&gt;algorithm&lt;/a&gt; for finding matrix powers which has superpolynomial speed up. It's from &lt;a href=&quot;https://math.nist.gov/quantum/zoo/&quot; rel=&quot;noreferrer&quot;&gt;this list&lt;/a&gt; of quantum algorithms (it seems to be a bit outdated though).&lt;/p&gt;&#xA;" OwnerUserId="1472" LastActivityDate="2018-03-30T18:04:33.287" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1522" PostTypeId="1" AcceptedAnswerId="1530" CreationDate="2018-03-30T23:12:48.783" Score="16" ViewCount="800" Body="&lt;p&gt;I've mostly worked with superconducting quantum computers I am not really familiar with the experimental details of photonic quantum computers that use photons to create continuous-variable cluster states such as the one that the Canadian startup &lt;a href=&quot;https://www.xanadu.ai&quot; rel=&quot;noreferrer&quot;&gt;Xanadu&lt;/a&gt; is building. How are gate operations implemented in these types of quantum computers? And what is the universal quantum gate set in this case?&lt;/p&gt;&#xA;" OwnerUserId="1234" LastEditorUserId="26" LastEditDate="2018-03-31T04:57:41.847" LastActivityDate="2018-03-31T17:27:04.257" Title="How are gates implemented in a continuous-variable quantum computer?" Tags="&lt;architecture&gt;&lt;quantum-gate&gt;&lt;universal-gates&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1524" PostTypeId="2" ParentId="1474" CreationDate="2018-03-31T06:47:59.563" Score="47" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia list of Quantum Computer programming languages&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This answer is not a copy of that webpage, it's more updated and with verified links. In some cases the author's paper or website link is added.)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming#Quantum_instruction_sets&quot; rel=&quot;noreferrer&quot;&gt;Quantum instruction sets&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quil_(instruction_set_architecture)&quot; rel=&quot;noreferrer&quot;&gt;Quil&lt;/a&gt; - An instruction set architecture for quantum computing that first introduced a shared quantum/classical memory model. See also &lt;a href=&quot;https://github.com/rigetticomputing/pyquil/blob/master/README.md&quot; rel=&quot;noreferrer&quot;&gt;PyQuil&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/OpenQASM&quot; rel=&quot;noreferrer&quot;&gt;OpenQASM&lt;/a&gt; - The intermediate representation introduced by IBM for use with their &lt;a href=&quot;https://en.wikipedia.org/wiki/IBM_Quantum_Experience&quot; rel=&quot;noreferrer&quot;&gt;Quantum Experience&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming#Quantum_programming_languages&quot; rel=&quot;noreferrer&quot;&gt;Quantum programming languages&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Imperative languages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computation_language&quot; rel=&quot;noreferrer&quot;&gt;QCL&lt;/a&gt;&lt;/strong&gt; - One of the first implemented quantum programming languages.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum pseudocode&lt;/strong&gt; - [Not actually a language, but a nice way to represent quantum algorithms and operations.] E. H. Knill. &quot;Conventions for Quantum Pseudocode&quot;, unpublished, LANL report LAUR-96-2724 (PDF Source &lt;a href=&quot;https://pdfs.semanticscholar.org/60d1/e63ca31555ec7013c5eb9a8a63788398fd14.pdf&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://digital.library.unt.edu/ark:/67531/metadc687305/&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;), Search at &lt;a href=&quot;http://search.arxiv.org:8081/?query=%22Conventions%20for%20Quantum%20Pseudocode%22&amp;amp;qid=1522470379946swap_nCnN_-1580011369&amp;amp;byDate=1&quot; rel=&quot;noreferrer&quot;&gt;arXiv&lt;/a&gt; for all papers referencing Knill's paper.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Q|SI&gt;&lt;/strong&gt; - Original paper in &lt;a href=&quot;http://engine.scichina.com/publisher/scp/journal/SSI/47/10/10.1360/N112017-00095?slug=full%20text&quot; rel=&quot;noreferrer&quot;&gt;Chinese&lt;/a&gt; with English abstract. English version at arXiv: &quot;&lt;a href=&quot;https://arxiv.org/abs/1710.09500&quot; rel=&quot;noreferrer&quot;&gt;Q|SI&gt;: A Quantum Programming Environment&lt;/a&gt;&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming#Q_language&quot; rel=&quot;noreferrer&quot;&gt;Q language&lt;/a&gt;&lt;/strong&gt; - &lt;a href=&quot;https://web.archive.org/web/20090620011647/http://sra.itc.it/people/serafini/qlang/&quot; rel=&quot;noreferrer&quot;&gt;Software for the Q language&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;qGCL&lt;/strong&gt; - &quot;&lt;a href=&quot;https://arxiv.org/abs/1402.5172&quot; rel=&quot;noreferrer&quot;&gt;Alternation in Quantum Programming: From Superposition of Data to Superposition of Programs&lt;/a&gt;&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/lanl/qmasm&quot; rel=&quot;noreferrer&quot;&gt;QMASM&lt;/a&gt;&lt;/strong&gt; - Specific to D-Wave systems. &lt;a href=&quot;https://github.com/lanl/qmasm/wiki&quot; rel=&quot;noreferrer&quot;&gt;QMASM Documentation&lt;/a&gt;. Author Scott Pakin's &lt;a href=&quot;https://ccsweb.lanl.gov/~pakin/software/&quot; rel=&quot;noreferrer&quot;&gt;edif2qmasm and QMASM&lt;/a&gt; webpage at LANL.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Functional languages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;QFC and QPL&lt;/strong&gt; - &lt;a href=&quot;https://www.mscs.dal.ca/~selinger/papers.html&quot; rel=&quot;noreferrer&quot;&gt;Author's website&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;QML&lt;/strong&gt; - Main site: &lt;a href=&quot;http://sneezy.cs.nott.ac.uk/QML/&quot; rel=&quot;noreferrer&quot;&gt;http://sneezy.cs.nott.ac.uk/QML/&lt;/a&gt; (not responding, a month later), &lt;a href=&quot;https://web.archive.org/web/20070926230222/http://sneezy.cs.nott.ac.uk/QML/&quot; rel=&quot;noreferrer&quot;&gt;Archive.Org copy of sneezy.cs.nott.ac.uk&lt;/a&gt;, author's PhD thesis: &quot;&lt;a href=&quot;http://eprints.nottingham.ac.uk/10250/1/thesis.pdf&quot; rel=&quot;noreferrer&quot;&gt;A functional quantum programming language&lt;/a&gt;&quot; (PDF).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://stationq.github.io/Liquid/&quot; rel=&quot;noreferrer&quot;&gt;LIQUi|&gt;&lt;/a&gt;&lt;/strong&gt; - Extension to F# (F Sharp).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum lambda calculi&lt;/strong&gt; - Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming#Quantum_lambda_calculi&quot; rel=&quot;noreferrer&quot;&gt;lists a few versions&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://www.mathstat.dal.ca/~selinger/quipper/&quot; rel=&quot;noreferrer&quot;&gt;Quipper&lt;/a&gt;&lt;/strong&gt; - A Haskell based scalable functional programming language for quantum computing. See also &lt;a href=&quot;https://arxiv.org/abs/1706.02630&quot; rel=&quot;noreferrer&quot;&gt;Proto-Quipper&lt;/a&gt;. A Talk by Peter Selinger (FSCD 2018) titled &quot;&lt;a href=&quot;http://drops.dagstuhl.de/opus/volltexte/2018/9173/&quot; rel=&quot;noreferrer&quot;&gt;Challenges in Quantum Programming Languages&lt;/a&gt;&quot; (&lt;a href=&quot;http://drops.dagstuhl.de/opus/volltexte/2018/9173/pdf/LIPIcs-FSCD-2018-3.pdf&quot; rel=&quot;noreferrer&quot;&gt;.PDF&lt;/a&gt;) discusses these languages.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Multi-Paradigm languages&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-qr-intro?view=qsharp-preview&quot; rel=&quot;noreferrer&quot;&gt;Q# (Q Sharp)&lt;/a&gt;&lt;/strong&gt; - A domain-specific programming language used for expressing quantum algorithms. It was initially released to the public by Microsoft as part of the Quantum Development Kit. Also available are Microsoft &lt;a href=&quot;https://cloudblogs.microsoft.com/quantum/2018/07/23/learn-at-your-own-pace-with-microsoft-quantum-katas/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Katas&lt;/a&gt;, a series of self-paced tutorials aimed at teaching elements of quantum computing and Q# programming at the same time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/XanaduAI/strawberryfields/blob/master/README.rst&quot; rel=&quot;noreferrer&quot;&gt;Strawberry Fields&lt;/a&gt; (from &lt;a href=&quot;https://www.xanadu.ai/tag/quantum-computing/&quot; rel=&quot;noreferrer&quot;&gt;XanduAI&lt;/a&gt;) is a full-stack Python library for designing, simulating, and optimizing continuous variable quantum optical circuits.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The website &lt;a href=&quot;https://quantumcomputingreport.com/resources/tools/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing Report has a Tools webpage&lt;/a&gt; listing over a dozen links, some new and some repeating the above list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also QuanTiki's webpage: &quot;&lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;noreferrer&quot;&gt;List of QC simulators&lt;/a&gt;&quot;, for a huge list of simulators and programming languages based on: C/C++, CaML, OCaml, F#, along with GUI based, Java, JavaScript, Julia, Maple, Mathematica, Maxima, Matlab/Octave, .NET, Perl/PHP, Python, Scheme/Haskell/LISP/ML and other online services providing calculators, compilers, simulators, and toolkits, etc.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there certain benefits to choosing particular ones?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you plan on using a particular quantum computer then one would hope that the programming language developed by the manufacturer is both best suited for that particular machine and well supported.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choosing a language with a larger following means that there are more Forums available and hopefully more bug fixes and support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, that leaves some great niche products to struggle to gain a user base. Trying to find one language that is both powerful/expressive and supported across various platforms is the trick, the answer is an opinion ATM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An evaluation of four software platforms: Forest (pyQuil), QISKit, ProjectQ, and the Quantum Developer Kit is offered by Ryan LaRose in &quot;&lt;a href=&quot;https://arxiv.org/abs/1807.02500&quot; rel=&quot;noreferrer&quot;&gt;Overview and Comparison of Gate Level Quantum Software Platforms&lt;/a&gt;&quot; (6 Jul 2018).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Updates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google's Cirq and OpenFermion-Cirq: &quot;&lt;a href=&quot;https://ai.googleblog.com/2018/07/announcing-cirq-open-source-framework.html&quot; rel=&quot;noreferrer&quot;&gt;Google's AI Blog - Announcing Cirq: An Open Source Framework for NISQ Algorithms&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave's &lt;a href=&quot;https://www.nextplatform.com/2018/10/04/full-qubit-and-tooling-access-a-game-changer-for-quantum-development/&quot; rel=&quot;noreferrer&quot;&gt;Leap and Ocean SDK&lt;/a&gt; allows access to a &lt;a href=&quot;https://www.dwavesys.com/d-wave-two-system&quot; rel=&quot;noreferrer&quot;&gt;D-Wave 2000Q™ System&lt;/a&gt; in a cloud environment with access to a 2000+ qubit quantum annealing machine to test and run workloads for free, assuming the core algorithms used go into the open source pool. Apply to login at D-Wave's &lt;a href=&quot;https://cloud.dwavesys.com/leap/login/?next=/leap/&quot; rel=&quot;noreferrer&quot;&gt;Leap In&lt;/a&gt; webpage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rigetti Computing's &lt;a href=&quot;https://www.rigetti.com/qcs&quot; rel=&quot;noreferrer&quot;&gt;Quantum Cloud Service&lt;/a&gt; (QCS) offers a Quantum Machine Image, a virtualized programming, and execution environment that is pre-configured with Forest 2.0, to access up to 16 qubits of a 128 qubit computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stay tuned for information on Fujitsu's &lt;a href=&quot;http://www.fujitsu.com/global/about/resources/news/press-releases/2016/1020-02.html&quot; rel=&quot;noreferrer&quot;&gt;Digital Annealer&lt;/a&gt;, an architecture capable of performing computations some 10,000 times faster than a conventional computer. &lt;strong&gt;If&lt;/strong&gt; they eventually provide a development environment that is cross-compatible with &lt;em&gt;true&lt;/em&gt; quantum computers these two paragraphs will remain in this answer, otherwise I will remove them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While their silicon chip is not quantum in nature Fujitsu has partnered with &lt;a href=&quot;https://1qbit.com/&quot; rel=&quot;noreferrer&quot;&gt;1Qbit&lt;/a&gt; to develop what is described as a &quot;&lt;a href=&quot;https://1qbit.com/news/fujitsu-1qbit-quantum-inspired-ai-cloud-service/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Inspired AI Cloud Service&lt;/a&gt;&quot;, whether their &lt;a href=&quot;http://www.fujitsu.com/global/digitalannealer/&quot; rel=&quot;noreferrer&quot;&gt;Digital Annealer&lt;/a&gt; quacks like a duck (anneals like a D-Wave, &lt;strong&gt;and&lt;/strong&gt; uses compatible code) remains to be seen. Visit here to access the &lt;a href=&quot;http://www.fujitsu.com/global/digitalannealer/services/&quot; rel=&quot;noreferrer&quot;&gt;Fujitsu Digital Annealer Technical Service&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;University of Pennsylvania's &lt;a href=&quot;http://www.cis.upenn.edu/~rrand/&quot; rel=&quot;noreferrer&quot;&gt;QWIRE&lt;/a&gt; (&lt;em&gt;choir&lt;/em&gt;) is a quantum circuit language and formal verification tool, it has a &lt;a href=&quot;https://github.com/inQWIRE/QWIRE&quot; rel=&quot;noreferrer&quot;&gt;GitHub webpage&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A review of: Cirq, Cliffords.jl, dimod, dwave-system, FermiLib, Forest (pyQuil &amp;amp; Grove), OpenFermion, ProjectQ, PyZX, QGL.jl, Qbsolv, Qiskit Terra and Aqua, Qiskit Tutorials, and Qiskit.js, Qrack, Quantum Fog, Quantum++, Qubiter, Quirk, reference-qvm, ScaffCC, Strawberry Fields, XACC, and finally XACC VQE is offered in the paper: &quot;&lt;a href=&quot;https://arxiv.org/abs/1812.09167&quot; rel=&quot;noreferrer&quot;&gt;Open source software in quantum computing&lt;/a&gt;&quot; (Dec 21 2018), by Mark Fingerhuth, Tomáš Babej, and Peter Wittek.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will return to this answer from time to time to make updates, without excessive &lt;a href=&quot;https://www.webopedia.com/TERM/T/thread_bump.html&quot; rel=&quot;noreferrer&quot;&gt;bumping&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="7429" LastEditDate="2019-06-20T00:19:36.293" LastActivityDate="2019-06-20T00:19:36.293" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="1525" PostTypeId="5" CreationDate="2018-03-31T08:26:30.023" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-03-31T08:26:30.023" LastActivityDate="2018-03-31T08:26:30.023" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1526" PostTypeId="4" CreationDate="2018-03-31T08:26:30.023" Score="0" Body="For questions mainly related to qudits, the unit of quantum information in d-level quantum systems." OwnerUserId="1005" LastEditorUserId="1005" LastEditDate="2018-04-10T20:27:36.837" LastActivityDate="2018-04-10T20:27:36.837" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1527" PostTypeId="1" AcceptedAnswerId="1528" CreationDate="2018-03-31T13:47:03.780" Score="10" ViewCount="264" Body="&lt;p&gt;The circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rM5Cb.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rM5Cb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be translated to the following code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation Teleport(msg, there) {&#xA;    let register = AllocateRegister();&#xA;    let here = register;&#xA;    H(here);&#xA;    CNOT(here, there);&#xA;    CNOT(msg, here);&#xA;    H(msg);&#xA;    // Measure out the entanglement.&#xA;    if (M(msg) == One)  { Z(there); }&#xA;    if (M(here) == One) { X(there); }&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do the if-statements come about?  Why are double-lines used after measurements?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2018-03-31T14:26:34.173" LastActivityDate="2018-03-31T14:26:34.173" Title="What do double wires mean in quantum circuits, and how do they relate to if statements?" Tags="&lt;circuit-construction&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1528" PostTypeId="2" ParentId="1527" CreationDate="2018-03-31T13:56:58.460" Score="13" Body="&lt;p&gt;The double lines are one common convention for classical bits in quantum circuit diagrams. In this case, they represent the bits arising from the measurements of the qubits &lt;code&gt;msg&lt;/code&gt; and &lt;code&gt;here&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controlled operations involving the classical bits are just operations which are performed &lt;em&gt;if&lt;/em&gt; those classical bits happen to have the value 1, which is what the &lt;code&gt;if&lt;/code&gt; statements are for in the pseudocode. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-03-31T14:10:37.630" LastActivityDate="2018-03-31T14:10:37.630" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1529" PostTypeId="1" AcceptedAnswerId="1537" CreationDate="2018-03-31T16:20:43.957" Score="19" ViewCount="3453" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Transmon&quot; rel=&quot;noreferrer&quot;&gt;Transmon&lt;/a&gt; and Xmon qubits are two types of superconducting &lt;a href=&quot;https://en.wikipedia.org/wiki/Charge_qubit&quot; rel=&quot;noreferrer&quot;&gt;charge qubits&lt;/a&gt; that seem to be often used in superconducting quantum devices.&#xA;However, I wasn't able to easily find direct comparisons between them.&#xA;The Xmon architecture seems (&lt;a href=&quot;https://arxiv.org/abs/1304.2322&quot; rel=&quot;noreferrer&quot;&gt;1304.2322&lt;/a&gt;) to have been introduced by Martinis' group, as an alternative to the transmon qubit, so I would expect the former architecture to be better in at least some respects.&#xA;On the other hand, it also seems (&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0703002&quot; rel=&quot;noreferrer&quot;&gt;cond-mat/0703002&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/0712.3581&quot; rel=&quot;noreferrer&quot;&gt;0712.3581&lt;/a&gt; seem to be the relevant references) that the devices from IBM use transmon qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the main differences between the two, from a practical point of view (in other words, when and why does one prefer one over the other)? &lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-03-31T16:43:07.160" LastActivityDate="2019-07-09T07:03:03.870" Title="What is the difference between transmon and Xmon qubits?" Tags="&lt;physical-qubit&gt;&lt;architecture&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1530" PostTypeId="2" ParentId="1522" CreationDate="2018-03-31T17:27:04.257" Score="9" Body="&lt;p&gt;Taking an $n$-mode simple harmonic oscillator (SHO) in a (Fock) space $\mathcal F = \bigotimes_k\mathcal H_k$, where $\mathcal H_k$ is the Hilbert space of a SHO on mode $k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives &lt;a href=&quot;https://en.wikipedia.org/wiki/Creation_and_annihilation_operators&quot; rel=&quot;noreferrer&quot;&gt;the usual&lt;/a&gt; annihilation operator $a_k$, which act on a number state as $a_k\left|n\right&amp;gt; = \sqrt n\left|n-1\right&amp;gt;$ for $n\geq 1$ and $a_k\left|0\right&amp;gt; = 0$ and the creation operator on mode $k$ as $a_k^\dagger$, acting on a number state as $a_k^\dagger\left|n\right&amp;gt; = \sqrt{n+1}\left|n+1\right&amp;gt;$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hamiltonian of the SHO is $H = \omega\left(a_k^\dagger a_k+\frac 12\right)$ (in units where $\hbar = 1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then define the quadratures $$X_k = \frac{1}{\sqrt 2}\left(a_k + a_k^\dagger\right)$$ $$P_k = -\frac{i}{\sqrt 2}\left(a_k - a_k^\dagger\right)$$ which are observables. At this point there are various operations (Hamiltonians) that can be performed. The effect of such an operation on the quadratures can be found by using the time evolution of an operator $A$ as $\dot A = i\left[H, A\right]$. Applying these for time $t$ gives: $$X:P\mapsto P-t$$ $$P:X\mapsto X+t$$  $$\frac 12\left(X^2 + P^2\right): X\mapsto \cos t X - \sin t P,\, P\mapsto \cos t P + \sin t X,$$ which is just the Hamiltonian of a SHO with $\omega = 1$ and gives a phase shift. $$\pm S = \pm\frac 12\left(XP+PX\right): X\mapsto e^{\pm t}X,\, P\mapsto e^{\mp t}P,$$ which is known as the squeezing operator, where $+S\,\left(-S\right)$ squeezes $P\,\left(X\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Hamiltonian of the form $aX+bP+c$ can be built by applying $X$ and $P$. Adding $S$ and $H$ allows for any quadratic Hamiltonian to be built. Further adding the (nonlinear) Kerr Hamiltonian $$\left(X^2 + P^2\right)^2$$ allows for &lt;em&gt;any&lt;/em&gt; polynomial Hamiltonian to be created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, including the beamsplitter operation (on two modes $j$ and $k$) $$\pm B_{jk} = \pm\left(P_jX_k - X_jP_k\right): A_j\mapsto \cos tA_j + \sin tA_k,\, A_k\mapsto \cos tA_k - \sin tA_j$$ for $A_j = X_j, P_j$ and $A_k = X_k, P_k$, which acts as a beamsplitter on the two modes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The above operations form the universal gate-set for continuous variable quantum computing.&lt;/strong&gt; More details can be found in e.g. &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9810082.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To implement these unitaries:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying these operations is generally hinted at in the name:&#xA;Coupling a current is acting as the displacement operator $D\left(\alpha\left(t\right)\right)$ where, for an electric field $\varepsilon$ and current $j$, $\alpha\left(t\right) = i\int_{t_0}^t\int j\left(r, t'\right)\cdot\varepsilon e^{-i\left(k\cdot r - w_kt'\right)} dr\, dt'$. The displacement operator shifts $X$ by the real part of $\alpha$ and $P$ by the imaginary part of $\alpha$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A phase shift can be applied by simply letting the system evolve by itself, as the system is a harmonic oscillator. It can also be performed by using a physical phase shifter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Squeezing is the hard bit and is something that needs to experimentally be improved. Such methods can be found in e.g. &lt;a href=&quot;https://arxiv.org/abs/1401.4118&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://www.osapublishing.org/optica/abstract.cfm?uri=optica-3-4-362&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; is one experiment using a limited amount of squeezed light. One possible way of squeezing is using a Kerr $\left(\chi^{\left(3\right)}\right)$ nonlinearity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This same nonlinearity also allows for the Kerr Hamiltonian to be implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Beamsplitter operation is, unsurprisingly, performed using a beamsplitter.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-03-31T17:27:04.257" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1531" PostTypeId="1" AcceptedAnswerId="1600" CreationDate="2018-03-31T18:19:41.093" Score="9" ViewCount="437" Body="&lt;p&gt;Using quantum control techniques it is possible to control quantum systems in a wide range of different scenarios (e.g. &lt;a href=&quot;https://arxiv.org/abs/0910.2350&quot; rel=&quot;nofollow noreferrer&quot;&gt;0910.2350&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1406.5260&quot; rel=&quot;nofollow noreferrer&quot;&gt;1406.5260&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, it was shown that using these techniques it is possible to implement gates like the (quantum) Toffoli gate (&lt;a href=&quot;https://arxiv.org/abs/1501.04676&quot; rel=&quot;nofollow noreferrer&quot;&gt;1501.04676&lt;/a&gt;) with good fidelities.&#xA;More precisely, they show that given the Toffoli gate $\newcommand{\on}[1]{\operatorname{#1}}\mathcal{U}_{\on{Toff}}$, defined as the C-CNOT gate&#xA;$$&#xA;\newcommand{\ketbra}[2]{\lvert#1\rangle\langle#2\rvert}&#xA;\newcommand{\ket}[1]{\lvert#1\rangle}&#xA;\newcommand{\bra}[1]{\langle#1\rvert}&#xA;\mathcal{U}_{\on{Toff}}\equiv \ket{0}_1\!\bra{0}\otimes \on{CNOT}&#xA;    + \ket{1}_1\!\bra{1}\otimes I,&#xA;$$&#xA;and a time-dependent Hamiltonian $H(t)$ containing a specific set of interactions, one can find a set of (time-dependent) parameters of $H(t)$ such that&#xA;$$&#xA;\mathcal T \exp\left(-i \int_0^\Theta H(\tau)d\tau\right) \simeq \mathcal U_{\on{Toff}}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there known results on the universality of such an approach?&#xA;In other words, do the tools provided by quantum control theory allow to say when, given set of constraints on the allowed Hamiltonian parameters, a given target gate can be realized? &lt;strong&gt;(1)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, the problem is the following: fix a target gate $\mathcal U$ acting over a set of qubits (or more generally qudits), and a parametrised Hamiltonian of the form $H(t)=\sum_k c_k(t) \sigma_k$, where $\{\sigma_k\}_k$ is a fixed set of (Hermitian) operators, and $c_k(t)$ are time-dependent parameters to be determined.&#xA;Is there a way to tell whether there are coefficients $\{c_k(t)\}_k$ such that&#xA;$$&#xA;\mathcal T\exp\left(-i\int_0^{\Theta} H(\tau)d\tau\right) \stackrel{?}{=} \mathcal U.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt; Note that I here talk of &lt;em&gt;quantum control&lt;/em&gt; only because that is the term used in the paper. If this is not the most suitable term to use to refer to this kind of problems please let me know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, note also that the problem solved in the paper is slightly different than the one I stated here. In particular, the Hamiltonian they consider actually acts in the space of three &lt;em&gt;four&lt;/em&gt;-dimensional qudits, and the Toffoli is only implemented as an effective dynamics in the lower levels of each ququart.&#xA;I'm also ok with results of this sort of course.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-04-03T11:08:42.073" LastActivityDate="2018-04-23T11:10:01.127" Title="Does quantum control allow to implement any gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-control&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1532" PostTypeId="2" ParentId="1208" CreationDate="2018-04-01T03:31:13.443" Score="5" Body="&lt;p&gt;Much of the work done so far with quantum computers has been focused on solving combinatorial optimization problems. Both D-Wave style Quantum Annealers and the more recent Gate Model machines from Rigetti, IBM, and Google have been solving combinatorial optimization problems. &lt;strong&gt;One promising approach to connecting machine learning and quantum computing involves finding optimization problems within standard machine learning tasks.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the recent Rigetti paper&#xA;&lt;a href=&quot;https://arxiv.org/abs/1712.05771&quot; rel=&quot;noreferrer&quot;&gt;Unsupervised Machine Learning on a Hybrid Quantum Computer&#xA;&lt;/a&gt; essentially recasts the unsupervised machine learning problem of clustering data into two groups, also known as 2-means clustering, into the combinatorial optimization problem of MaxCut. The folks at Rigetti then solve the MaxCut problem with the Quantum Approximate Optimization Algorithm (QAOA).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect to see more of this style of work in the future, especially given the natural connections between optimization and machine learning.&lt;/p&gt;&#xA;" OwnerUserId="1658" LastActivityDate="2018-04-01T03:31:13.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1533" PostTypeId="2" ParentId="1437" CreationDate="2018-04-01T03:49:31.920" Score="3" Body="&lt;p&gt;Flux Noise can be a major source of dephasing for superconducting qubits. If you look at the history of the field this makes complete sense. The ideas behind Superconducting Qubits can be traced to the &lt;a href=&quot;https://en.wikipedia.org/wiki/SQUID&quot; rel=&quot;nofollow noreferrer&quot;&gt;SQUID&lt;/a&gt;, which itself was designed to be a very accurate magnetometer. So in general superconducting qubits tend to be quite sensitive to magnetic fields. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One challenge is to balance this senstivity to magnetic noise with the need to manipulate the qubits. Addressing this challenge is the subject of the Rigetti paper on the &lt;a href=&quot;https://journals.aps.org/prapplied/abstract/10.1103/PhysRevApplied.8.024004&quot; rel=&quot;nofollow noreferrer&quot;&gt;Charge- and Flux-Insensitive Tunable Superconducting Qubit&#xA;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1658" LastEditorUserId="1658" LastEditDate="2018-04-02T15:18:53.230" LastActivityDate="2018-04-02T15:18:53.230" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1534" PostTypeId="1" AcceptedAnswerId="1539" CreationDate="2018-04-01T03:53:27.287" Score="9" ViewCount="1646" Body="&lt;p&gt;Edward Farhi's paper on the &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;noreferrer&quot;&gt;Quantum Approximate Optimization Algorithm&lt;/a&gt;&#xA;introduces a way for gate model quantum computers to solve combinatorial optimization algorithms. However, D-Wave style quantum annealers have focused on combinatorial optimization algorithms for some time now. What is gained by using QAOA on a gate model quantum computer instead of using a Quantum Annealer?&lt;/p&gt;&#xA;" OwnerUserId="1658" LastEditorUserId="55" LastEditDate="2019-09-28T19:12:29.537" LastActivityDate="2019-09-28T19:12:29.537" Title="What is the difference between QAOA and Quantum Annealing?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;annealing&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1535" PostTypeId="2" ParentId="1485" CreationDate="2018-04-01T03:56:41.350" Score="4" Body="&lt;p&gt;Gaussian Processes are a key component of the model-building procedure at the core of Bayesian Optimization. Therefore speeding up the training of Gaussian processes directly enhances Bayesian Optimization. The recent paper by Zhao et. al on &lt;a href=&quot;https://arxiv.org/abs/1803.10520&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithms for training Gaussian Processes&#xA;&lt;/a&gt; does exactly this.&lt;/p&gt;&#xA;" OwnerUserId="1658" LastActivityDate="2018-04-01T03:56:41.350" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1536" PostTypeId="1" CreationDate="2018-04-01T04:26:16.580" Score="4" ViewCount="237" Body="&lt;p&gt;Given the theoretical infinite quantum states that a qbit can be expressed as is there any practical limit to the processing density in any given quantum processor as compared to the absolute limits imparted in a binary system such as our current binary processors ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this I mean with current binary processors each gate can only have one of two states, and yet in quantum theory it appears as though every single gate can have an infinite number of states, what sort of practical limit, if any would we see in quantum processing, and given this infinite state capability wouldn't we then be in the position that largely every single quantum processor could be expressed as a single qbit with every qbit in effect acting as its own quantum processor with infinite states stand alone from other parallel qbits?&lt;/p&gt;&#xA;" OwnerUserId="1663" LastEditorUserId="26" LastEditDate="2018-12-23T14:12:58.313" LastActivityDate="2018-12-23T14:12:58.313" Title="Processing density capabilities in a quantum processor" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1537" PostTypeId="2" ParentId="1529" CreationDate="2018-04-01T04:34:06.057" Score="14" Body="&lt;p&gt;The transmon is a Josephson junction and capacitor in parallel.&#xA;Originally, transmons were differential circuits, i.e. two transmons on the same chip were not galvanically connected in any way.&#xA;In other words, transmons didn't share a ground reference.&#xA;Furthermore, in the early days, transmons were almost always embedded into the middle of a harmonic resonator.&#xA;The resonator, often referred to as a &quot;bus resonator&quot;, was used to couple multiple qubits together, i.e. qubits embedded in the same resonator could couple to each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important differences with the xmon were that&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The xmon was grounded. Each xmon on a chip connects to a common ground plane with a nominally fixed voltage.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The xmon was &lt;em&gt;not&lt;/em&gt; embedded into a resonator. Instead of coupling through a resonator, each xmon couples through a direct capacitance to each of its neighbors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Nowadays, several research groups build qubits without the bus resonator and call them &quot;transmons&quot;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Much more could be written. If someone leaves a comment asking for more details on any particular aspect of the difference between transmon and xmon, I will write more.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;History of the name&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Rob Schoelkopf told me the story of where the name &quot;transmon&quot; came from while we were at the Les Houches summer school on &quot;Quantum Machines&quot;.&#xA;The charge qubit suffered from low frequency noisey charge fluctuations that lead to dephasing.&#xA;To get around the problem, Professor Schoelkopf thought to shunt the junction with a bit of transmission line.&#xA;The line would be a short circuit at dc, allowing low frequency charge to equalize, but it would be a high impedance at the qubit's resonance frequency allowing the resonance to remain.&#xA;The combination of a &lt;strong&gt;trans&lt;/strong&gt;mission line with the junction plas&lt;strong&gt;mon&lt;/strong&gt; mode lead to the name &quot;transmon&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, it turned out that a capacitor was simpler than a transmission line and served a purpose equivalent to the transmission line, so the qubit wound up being a capacitor in parallel with the junction.&#xA;However, the name &quot;transmon&quot; had already stuck (or maybe &quot;capmon&quot; just didn't sound as good).&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="32" LastEditDate="2018-09-08T06:21:41.593" LastActivityDate="2018-09-08T06:21:41.593" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1538" PostTypeId="2" ParentId="1536" CreationDate="2018-04-01T05:01:55.680" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;By this I mean with current binary processors each gate can only have&#xA;  one of two states, and yet in quantum theory &lt;strong&gt;it appears as though&#xA;  every single gate can have an infinite number of states&lt;/strong&gt;, what sort&#xA;  of practical limit, if any would we see in quantum processing, and&#xA;  given this infinite state capability wouldn't we then be in the&#xA;  position that largely every single quantum processor could be&#xA;  expressed as a single qbit with every qbit in effect acting as its own&#xA;  quantum processor with infinite states stand alone from other parallel&#xA;  qbits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, it is not the gates which have an infinite number of states. It is the qubits themselves. I see lot of fundamental misconceptions in the question. &#xA;A qubit stays a linear superposition of two basis states, like $a|0\rangle + b |1\rangle$ (where $a,b$ are complex numbers). Also note that $a|0\rangle+b|1\rangle$ is an element of a 2-dimensional complex vector space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, yes they can exist in an infinite number of superposition states, however when &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Measurement_in_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;measured&lt;/a&gt;&quot; in the $|0\rangle,|1\rangle$ basis, you get either the state $|0\rangle$ (with probability $|a|^2$) or the state $|1\rangle$ (with probability $|b|^2$). Hence, the information of a qubit's initial superposition state gets lost during measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, consider a 2-qubit system. Unlike in a 1-qubit system, its state lies in a 4-dimensional complex vector space (i.e. $\Bbb{C}^2\times\Bbb{C}^2$), and the superposition state looks something like $c|00\rangle+d|01\rangle+e|10\rangle+f|11\rangle$ (where $c,d,e,f\in\Bbb{C}$). Firstly a 4-dimensional complex vector space is &quot;larger&quot; than a 2-dimensional one, so it cannot be replicated by a single qubit. Also, note that now there are 4 possible basis states to which the system's state can &lt;a href=&quot;https://en.wikipedia.org/wiki/Copenhagen_interpretation&quot; rel=&quot;nofollow noreferrer&quot;&gt;collapse to&lt;/a&gt; upon measuring the first and second qubits in the appropriate basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the answer is an emphatic &lt;strong&gt;no&lt;/strong&gt; for your question &quot;given this infinite state capability wouldn't we then be in the position that largely every single quantum processor could be expressed as a single qbit with every qbit in effect acting as its own quantum processor with infinite states stand alone from other parallel qbits?&quot;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-04-01T05:01:55.680" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1539" PostTypeId="2" ParentId="1534" CreationDate="2018-04-01T05:17:44.837" Score="3" Body="&lt;p&gt;One of the advantages, as stated in the paper you linked, is that with QAOA you can increase the precision arbitrarily, whereas QA will only find the solution with probability 1 as $T \to \infty$ which is impractical. In addition if $T$ is too long you're likely to not find the solution as the probability is not monotonic. I believe an example of this can be found in a fair-sampling paper by Matsuda et al. Figure 4 shows that for large $\tau$, using quantum annealing on a 5-qubit system, you only likely to find 2 of the 3 possible states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0808.0365v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;[arXiv:0808.0365v3] Ground-state statistics from annealing algorithms: Quantum vs classical approaches&lt;/a&gt; - Matsuda et al. &lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2018-04-01T15:32:37.367" LastActivityDate="2018-04-01T15:32:37.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1541" PostTypeId="2" ParentId="1536" CreationDate="2018-04-01T09:19:46.420" Score="4" Body="&lt;p&gt;The fact that a qubit has infinite allowed states can seem as though we could fit more than a bit inside it. However, no matter how fancy our proposed encoding, &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's bound&lt;/a&gt; shows us that we can never get more than a bit out. This is one effect that provides a bottleneck for how much density we can fit in a quantum processor.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;given this infinite state capability wouldn't we then be in the position that largely every single quantum processor could be expressed as a single qbit with every qbit in effect acting as its own quantum processor&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Suppose $B$ is some bit string of arbitrary length. We want to use this as input for some program $P$ to get the corresponding output bit string $P(B)$. It is true that we could associate $B$ with some state within the Bloch sphere, and then associate $P(B)$ with some other state. Then we could construct a unitary $U_P$ which rotates between them to reproduce the effect of the program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simple example, we could use $| B \rangle = | 0 \rangle$, $| P(B) \rangle = | 1 \rangle$, and $U_P = Y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we ignore the Holevo bound for a moment, it might seem as if we've reproduced an arbitrarily large computation within a single qubit. But remember that programs aren't designed for only a single input, but for many possible inputs. And they must be able to guide each to their corresponding output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's take another possible input $B'$ and its corresponding output $P(B')$, and find some states within the Bloch sphere to encode them. Now our $U_P$ must simultaneously have the effect&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U_P | B \rangle = | P(B) \rangle$$&#xA;$$U_P | B' \rangle = | P(B') \rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could do this perhaps with $| B' \rangle = | + \rangle$, $| P(B') \rangle = | - \rangle$, and still use $U_P = Y$ as before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what if we add another output? What states will we use? Will $Y$ still be a good choice to implement the program? Should we change the states we've chosen already to fit the new inputs and outputs in?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more possible inputs we add, the more of these constraints we get. Hopefully it is clear that it would become increasingly difficult to make it all work. For many programs, it would be impossible.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's also ignore this for a second, and suppose that a large problem that we want to solve &lt;em&gt;could&lt;/em&gt; be squeezed into a single qubit. We are very good at simulating single qubits with standard computers. Even if numerical accuracy starts to cause problems, we can just add some more bits to make everything right again. So if we can do everything efficiently with a single qubit, we could also do it efficiently with a classical computer. Either that, or the 'compilation' process is so hard that all our computational complexity is moved to that task instead. In either case, there is no heavy lifting that we would actually need the qubit for.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So though a single qubit contains a lot of possible states, it is nevertheless too simple to outperform a classical computer. We can't get enough information out, its state space is not big enough to guide large computations from input to output, and it can be classically simulated. Many qubits are needed to overcome all of these issues.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-01T09:19:46.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1542" PostTypeId="1" CreationDate="2018-04-01T09:53:46.993" Score="11" ViewCount="521" Body="&lt;p&gt;I want to understand what quantum entanglement is and what role does it play in quantum error correction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;:&#xA;As per the suggestions of @JamesWootton and @NielDeBeaudrap, I have asked a separate question for the classical analogy &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1554/1678&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1678" LastEditorUserId="55" LastEditDate="2019-09-12T11:50:44.797" LastActivityDate="2019-09-29T15:33:34.030" Title="What is quantum entanglement, and what role does it play in quantum error correction?" Tags="&lt;entanglement&gt;&lt;error-correction&gt;" AnswerCount="5" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1543" PostTypeId="2" ParentId="1542" CreationDate="2018-04-01T10:11:42.990" Score="4" Body="&lt;p&gt;There is no classical equivalent to entanglement. Entanglement is perhaps best understood using Dirac (bra-ket) notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each qubit can be in the (ket) state $\left|0\right&amp;gt;$ or in the state $\left|1\right&amp;gt;$ or in a superposition $\alpha\left|0\right&amp;gt; + \beta \left|1\right&amp;gt;$ where $\alpha$ and $\beta$ are complex numbers that fulfill $|\alpha|^2 + |\beta|^2 = 1$. If you have two qubits, the basis states of the 2-qubit system are $\left|0\right&amp;gt; \otimes \left|0\right&amp;gt;$, $\left|0\right&amp;gt; \otimes \left|1\right&amp;gt;$, $\left|1\right&amp;gt; \otimes \left|0\right&amp;gt;$, and $\left|1\right&amp;gt; \otimes \left|1\right&amp;gt;$. To simplify the notation, physicists often write these as $\left|00\right&amp;gt;$, $\left|01\right&amp;gt;$, $\left|10\right&amp;gt;$, and $\left|11\right&amp;gt;$. So being in state $\left|01\right&amp;gt;$ means that the first qubit is in state $\left|0\right&amp;gt;$ and the second qubit is in state $\left|1\right&amp;gt;$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a superposition of the kind $\alpha \left|01\right&amp;gt; + \beta \left|10\right&amp;gt;$. This means that the first qubit is in state $\left|0\right&amp;gt;$ with probability $|\alpha|^2$ and in state $\left|1\right&amp;gt;$ otherwise, whilst the second qubit is always in the opposite state that the first one is in: The two particles are entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is unimportant that in this example, the entangled qubits happen to be in opposite states: They might as well be in the same state and still be entangled. What matters is that their states are not independent from each other. This has caused major headaches for physicists because it means that qubits (or the particles carrying them) cannot simultaneously have strictly local properties and be governed by a concept called realism (reflect their states as intrinsic property). Einstein famously called the resulting paradox (if you still assume locaility and realism) &quot;spooky action at a distance.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement does not play a special role in quantum error correction: Error correction must work for every state in the computational basis (which does not have entanglement). Then it automatically works also for superpositions of these states (which may be entangled states).&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-01T10:11:42.990" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1544" PostTypeId="2" ParentId="1542" CreationDate="2018-04-01T11:01:42.660" Score="5" Body="&lt;p&gt;Entanglement is a natural part of quantum information and quantum computation. If it isn't present --- if you try to do things in such a way that entanglement does not arise --- then you get no benefit from quantum computation. And if a quantum computer is doing something interesting, it will produce a lot of entanglement, at least as a side-effect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this does not mean that entanglement is &quot;what makes quantum computers go&quot;. Entanglement is like the spinning gears of a machine: nothing happens if they aren't turning, but that doesn't mean that having those gears spin quickly is enough to make the machine do what you want. (Entanglement &lt;em&gt;is&lt;/em&gt; a primitive resource in this way for &lt;em&gt;communication&lt;/em&gt;, but not for computation as far as anyone has seen.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is as true for quantum error correction as it is for computation. Like all forms of error correction, quantum error correction works by distributing information around a larger system, in particular in the correlations of certain measurable pieces of information. Entanglement is just the usual way in which quantum systems become correlated, so it should come as no surprise that a good quantum error correction code then involves a lot of entanglement. But that doesn't mean that trying to &quot;pump your system full of entanglement&quot;, like some sort of helium balloon, is something which is useful or meaningful to do to protect quantum information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While quantum error correction is sometimes described vaguely in terms of entanglement,  more important is how it involves parity checks using different 'observables'. The most important tool for describing this is the stabiliser formalism. The stabiliser formalism can be used to describe some states with large amounts of entanglement, but more importantly it allows you to reason about multi-qubit properties (&quot;observables&quot;) fairly easily. From that perspective, one can come to understand that quantum error correction is much more closely related to low-energy many-body physics of spin-Hamiltonians, than just entanglement in general. &lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-01T11:01:42.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1545" PostTypeId="2" ParentId="1542" CreationDate="2018-04-01T11:15:33.637" Score="6" Body="&lt;p&gt;Classical correlations between variables occur when the variables &lt;em&gt;appear&lt;/em&gt; random, but whose values are found to systematically agree (or disagree) in some way. However, there will always be someone (or something) that 'knows' exactly what the variables are doing in any given case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement between variables is the same, except for the last part. The randomness is truly random. Random outcomes are completely undecided until the time of measurement. But somehow the variables, though they may be separated by galaxies, still know to agree.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So what does this mean for error correction? Let's start by thinking about error correction for a simple &lt;em&gt;bit&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When storing a classical bit, the kinds of errors you need to worry about are things like bit flips and erasures. So something might make your &lt;code&gt;0&lt;/code&gt; become a &lt;code&gt;1&lt;/code&gt;, or vice-versa. Or your bit might wander off somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To protect the information, we can ensure that our &lt;em&gt;logical bits&lt;/em&gt; (the actual information we want to store) are not just concentrated on single &lt;em&gt;physical bits&lt;/em&gt;. Instead, we spread it out. So we could use a simple repetition encoding, for example, where we copy our information across many physical bits. This lets us still get our information out, even if some of the physical bits have failed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the basic job of error correction: we spread our information out, to make it hard for errors to mess it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For qubits, there are more kinds of error to worry about. For example, you may know that qubits can be in superposition states, and that measurements change these. Unwanted measurements are therefore another source of noise, caused by the environment interacting with (and so in some sense 'looking at' our qubits). This type of noise is known as decoherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does this affect things? Suppose we use the repetition encoding with qubits. So we replace the $|0\rangle$  in our desired logical qubit state with $|000...000\rangle$, repeated across many physical qubits, and replace the $|1\rangle$ with $|111...111\rangle$. This again protects against bit flips and erasures, but it makes it even easier for stray measurements. Now the environment measure whether we have $|0\rangle$ or $|1\rangle$ by looking at any of many qubits. This will make the effect of decoherence much stronger, which is not what we wanted at all!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix this, we need to make it hard for decoherence to disturb our logical qubit information, just as we made it hard for bit flips and erasures. To to this, we have to make it harder to measure our logical qubit. Not too hard that we can't do it whenever we want to, of course, but too hard for environment to do easily. This means ensuring that measuring a single physical qubit should tell us nothing about the logical qubit. In fact, we must make it so that a whole bunch of qubits need to be measured and their results compared to extract any information about the qubit. In some sense, it is a form of encryption. You need enough pieces of the puzzle to have any idea what the picture is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could try to do this classically. Information could be spread out in complex correlations among many bits. By looking at enough of the bits and analyzing the correlations, we can we extract some information about the logical bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this would not be the only way to get this information. As I mentioned before, classically there is always that someone or something that already knows everything. It doesn't matter whether it is a person, or just the patterns in the air caused when the encryption was carried out. Either way, the information exists outside of our encoding, and this is essentially an environment that knows everything. Its very existence means that decoherence has occurred to an irreparable degree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that's why we need entanglement. With it, we can hide the information away using correlations in the true and unknowable random outcomes of quantum variables.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-01T11:15:33.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1546" PostTypeId="2" ParentId="1508" CreationDate="2018-04-01T11:53:39.637" Score="4" Body="&lt;p&gt;The quantum Turing machine &lt;em&gt;can&lt;/em&gt; move into a superposition of moving left and right. This is different from the classical Turing machine which can only move either left or right.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-01T11:53:39.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1547" PostTypeId="2" ParentId="1531" CreationDate="2018-04-01T12:17:05.650" Score="5" Body="&lt;p&gt;Quantum control does not necessarily allow implementing just any gate. Imagine your control of the system is a time-dependent energy. That corresponds to the Hamiltonian $\hat{H}(t) = c(t) \hat{Z}$. Then you can only ever rotate about one axis of the Bloch sphere and your only choice is how fast to rotate when. This is obviously insufficient to even generate arbitrary single-qubit gates because then you would need to be able to effect rotations about any (arbitrary) axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot answer the second part of your question, about known results for the universality. Note, however, that I picked a very special case to illustrate that simple quantum control is not enough. Imagine I had picked the Hamiltonian $\hat{H}(t) = c(t) \hat{X} + \frac{E_0}{2} \hat{Z}$. This is a constant rotation about one axis (due to an energy difference $E_0$ between the two states of the single qubit involved) plus a rotation you completely control about an orthogonal axis. Since you can produce arbitrary rotation with a suitable combination of such rotations, this is universal (for a single qubit system). This is my attempt at illustrating that not having universal control if you have any control could be seen as a special case rather than the rule.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-01T12:17:05.650" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1548" PostTypeId="1" AcceptedAnswerId="1555" CreationDate="2018-04-01T12:22:37.357" Score="8" ViewCount="450" Body="&lt;p&gt;Is there an intuitive explanation why the surface code fares so much better than older quantum error correction codes in terms of its high error threshold, with thresholds of up to a few percent rather than some ppm? If so, what is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am particularly interested in having it clarified if such a comparison is a fair (apples to apples) comparison. I understand that the results for older quantum error correction are usually analytic results whilst those for surface codes tend to be numeric. Could it be that the analytic solutions indeed take into account the worst possible (coherent) errors whilst numerical solutions perhaps do not capture the worst possible errors because they can only explore a subset of all possible errors?&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-04-01T12:30:04.637" LastActivityDate="2018-04-01T16:14:34.093" Title="Why does the surface (quantum error correction) code have such a high threshold for errors?" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1549" PostTypeId="1" AcceptedAnswerId="1551" CreationDate="2018-04-01T12:27:24.017" Score="13" ViewCount="660" Body="&lt;p&gt;I know that qubits are represented by quantum particles (for example photons) and that their state is given by one property (for example spin).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about the &lt;strong&gt;quantum memory&lt;/strong&gt;: how are the qubits stored in a quantum computer. I suppose we require a kind of black box for Heisenberg's uncertainty principle to work. If I understand this correctly this principle is relevant for the superposition of the qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this kind of &lt;em&gt;black box&lt;/em&gt; implemented in real quantum computers?&lt;/p&gt;&#xA;" OwnerUserId="11" LastEditorUserId="1847" LastEditDate="2018-04-24T15:28:44.817" LastActivityDate="2018-04-24T15:28:44.817" Title="How to store qubits while preserving Heisenberg's uncertainty principle?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;architecture&gt;&lt;decoherence&gt;&lt;quantum-memory&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1550" PostTypeId="2" ParentId="1548" CreationDate="2018-04-01T12:27:32.263" Score="4" Body="&lt;p&gt;The surface error correction code always uses eigenstates of just a few stabilizers. By changing operators rather than states, it never needs to apply any state correction to the quantum states (but only to the classically controlled operators or measurements). Hence it is very simple, only repeatedly measuring syndromes. Since the syndromes do not even need actual computations (one only ever measures $\hat{Z}$ and $\hat{X}$), there is very little opportunity for errors to accumulate. Hence the error threshold is high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot answer if published error thresholds are an apple-to-apple comparison to those published for more traditional quantum error correction schemes.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-01T12:27:32.263" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1551" PostTypeId="2" ParentId="1549" CreationDate="2018-04-01T12:36:49.397" Score="11" Body="&lt;p&gt;What you call a &lt;em&gt;black box&lt;/em&gt; is simply isolating the quantum system that stores (or represents) your qubits from the environment. This can be done in several ways depending on your physical realization. For example, in an ion trap based quantum computer, one uses states of a single ion to represent a qubit, and isolates that from the environment by levitating it in empty space (using an ion trap) and by shielding it from the kind of laser radiation or other light sources that affects the chosen states.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-01T12:36:49.397" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1552" PostTypeId="1" CreationDate="2018-04-01T12:38:55.040" Score="5" ViewCount="564" Body="&lt;p&gt;The &lt;a href=&quot;https://math.nist.gov/quantum/zoo/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithm Zoo&lt;/a&gt; includes a host of algorithms for which Quantum Computing offers speedups (exponential, polynomial, etc). However, those speedups are based on &lt;strong&gt;asymptotic computational complexity&lt;/strong&gt; (Big-O complexity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a realistic implementation on a quantum computer (or even a simulator), the algorithm might require other add-ons to get a satisfiable result. For e.g., for multiple quantum state tomography trials, or probabilistic cloning.&#xA;I am not considering an ideal quantum computer, thus, overheads of physical to logical qubit mapping for Quantum Error Correction; overheads of nearest neighbour mapping; or experimental environmental errors are not considered. I am only considering the effect of projective measurement and no-cloning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I compare a quantum algorithm taking into account such factors? The overheads might be polynomial, linear, or even constant, so asymptotically it will outperform the corresponding classical algorithm. But, asymptotically means, for a large enough problem size. I am interested in determining if that cross-over point (&lt;strong&gt;quantum supremacy problem size&lt;/strong&gt;) is realistic for my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific algorithm I am currently working with is an improvement of Grover's search as proposed by &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9807027.pdf&quot; rel=&quot;noreferrer&quot;&gt;Biham et. al&lt;/a&gt;, where the initial amplitude distribution is not uniform, and there are multiple solutions.&lt;/p&gt;&#xA;" OwnerUserId="1153" LastActivityDate="2018-04-01T13:14:32.417" Title="How to compare a quantum algorithm with its classical version?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ClosedDate="2018-04-02T08:04:37.560" ContentLicense="CC BY-SA 3.0" />
  <row Id="1553" PostTypeId="2" ParentId="1552" CreationDate="2018-04-01T13:14:32.417" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am only considering the effect of projective measurement and no-cloning.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Consider that a (long) realistical quantum computation would have to involve quantum error correction which only works if the errors are rather limited: Your projective measurement will be rather close (to within 1% or so) to not incorporating errors other than quantum projection noise. This is usually irrelevant because a typical algorithm will not require you to do state tomography but instead distill a binary result into the qubits to be measured in the end. If it would involve state tomography, the (asymptotic) overhead would enter the big-O notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is indeed some overhead from the no-cloning theorem: The (quantum part of the) result of e.g. Shor's algorithm must be read more than once to form the greatest common denominator. Such an overhead obviously depends on the algorithm; in the case of Shor's algorithm, it is small (typically 2 to 3, in detail depending if you are willing to take care of small factors classically, as is simple). A similarly (but not quite as) small overhead occurs if you want to generalize Grover's algorithm to the case where an unknown number of solutions exist.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-01T13:14:32.417" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1554" PostTypeId="1" CreationDate="2018-04-01T14:34:13.610" Score="4" ViewCount="138" Body="&lt;p&gt;I want to know if there is any classical analogy for understanding quantum entanglement.&lt;/p&gt;&#xA;" OwnerUserId="1678" LastActivityDate="2018-04-01T14:34:13.610" Title="Is there any classical analogy for quantum entanglement?" Tags="&lt;entanglement&gt;" AnswerCount="0" CommentCount="6" ClosedDate="2018-04-01T16:48:48.327" ContentLicense="CC BY-SA 3.0" />
  <row Id="1555" PostTypeId="2" ParentId="1548" CreationDate="2018-04-01T16:08:41.540" Score="6" Body="&lt;p&gt;Thresholds are often calculated by treating $X$ and $Z$ errors as occurring with the same probability. Any code that corrects one more effectively than the other will then be at a disadvantage: whichever it corrects least effectively will be the bottleneck that determines the threshold. The surface code avoids this by treating these errors in an identical way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fault-tolerance thresholds, the fidelity of stabilizer measurements is also taken into account. This includes errors that occur in the required entangling gates. Stabilizers that act on more qubits, and so require more entangling gates, will have less reliable measurements. But the surface code has essentially all stabilizers the same size: they all act on four qubits. And that size is relatively low. They are also quasilocal, so there is no error overhead in shunting qubits around to be measured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The combination of these effects means that it competes well in terms of threshold, and should be moderately easy to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's true that analytic results are always worse, because they aim to establish lower bounds rather than exact values. They came more from the era when it was important to determine whether fault-tolerant quantum computation was actually possible, even in principle. Just finding a non-zero threshold was a big deal. Now we focus more on things that can be done on real devices, and how they might perform, and seek thresholds as high as we can for practical reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The surface code nevertheless wins in a typical apples-to-apples comparison of numerically calculated thresholds (I'll update with a reference when I find one). But it should ne noted that the choice of noise model can be used to change the goal posts in the favour of your favourite code.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-01T16:14:34.093" LastActivityDate="2018-04-01T16:14:34.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1558" PostTypeId="1" AcceptedAnswerId="1559" CreationDate="2018-04-01T21:25:07.217" Score="6" ViewCount="52" Body="&lt;p&gt;You can make a natural correspondence between a quantum state vector and a classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Probability_vector&quot; rel=&quot;noreferrer&quot;&gt;probability vector&lt;/a&gt;, and between a quantum unitary operator and a classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Stochastic_matrix&quot; rel=&quot;noreferrer&quot;&gt;stochastic matrix&lt;/a&gt;. There is also a correspondence between the quantum annealing algorithm and the classical simulated annealing algorithm. I am wondering whether it is possible to write down simulated annealing in the language of probability vectors and stochastic matrices, and then see what additional power is obtained by changing to the quantum counterparts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, I would like to bridge the language gaps between probabilistic algorithms and quantum algorithms, and I am wondering whether recasting probabilistic algorithms in terms of probability vectors and stochastic matrices has been tried before.&lt;/p&gt;&#xA;" OwnerUserId="1658" LastActivityDate="2018-04-03T06:25:06.460" Title="Assessing speed-up via Quantum-Stochastic correspondence" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;annealing&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1559" PostTypeId="2" ParentId="1558" CreationDate="2018-04-01T23:59:23.467" Score="6" Body="&lt;p&gt;Yes. This has been done by Morita and Nishimori in their 2008 publication, &quot;Mathematical Foundations of Quantum Annealing.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0806.1859&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0806.1859&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Section 5 they derive the convergence conditions from path integral Monte Carlo and Green function Monte Carlo methods. To quote;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In Sec. 5 we have derived the convergence condition of QA implemented by Quantum Monte Carlo simulations of path-integral and Green function methods. These approaches bear important practical significance because only stochastic methods allow us to treat practical large-size problems on the classical computer. A highly non-trivial result in this section is that the convergence condition for the stochastic methods is essentially the same power-law decrease of the transverse-field term as in the Schrödinger dynamics of Sec. 2. This is surprising since the Monte Carlo (stochastic) dynamics is completely different from the Schrödinger dynamics. Something deep may lie behind this coincidence and it should be an interesting target of future studies.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="54" LastEditorUserId="26" LastEditDate="2018-04-03T06:25:06.460" LastActivityDate="2018-04-03T06:25:06.460" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1560" PostTypeId="1" AcceptedAnswerId="1564" CreationDate="2018-04-02T00:44:12.713" Score="9" ViewCount="451" Body="&lt;p&gt;It is well-known that by utilizing quantum parallelism we can calculate a function $f(x)$ for many different values of $x$ simultaneously. However, some clever manipulations is needed to extract the information of each value, i.e. with Deutsch's algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the reverse case: can we use quantum parallelism to calculate &lt;em&gt;many functions&lt;/em&gt; (say $f(x),g(x),\dots$) simultaneously for a single value $x_0$?&lt;/p&gt;&#xA;" OwnerUserId="1341" LastActivityDate="2018-04-02T22:38:36.237" Title="Can we use quantum parallelism to calculate many functions at once?" Tags="&lt;algorithm&gt;&lt;speedup&gt;" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1562" PostTypeId="2" ParentId="1560" CreationDate="2018-04-02T08:46:45.883" Score="2" Body="&lt;p&gt;Yes, one can. The trick is to define (and implement) a new function $f_\mathrm{all}(y,x)$ that evaluates to $f(x)$ if $y=0$, to $g(x)$ if $y=1$, etc. Then one prepares the qubits representing $y$ in the desired superposition and set $x$ to $x_0$.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-02T08:46:45.883" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1563" PostTypeId="2" ParentId="1560" CreationDate="2018-04-02T08:56:41.897" Score="5" Body="&lt;p&gt;The functions $f,g,\ldots $ that you want to evaluate in different computational branches must, in order to be computable at all, be specifiable in some way (e.g. a sequence of classical logic gates). And the &lt;em&gt;set&lt;/em&gt; $\{ f_1, f_2 , \ldots \}$ of the functions you wish to compute ought itself to be computable: for a given $t $, you must be able to compute a specification of how $f_t $ is to be computed on its argument. In effect: you must have a means of describing the functions $f_t $ as stored programs. (These are all necessary, even before we consider quantum computation, for the question of &quot;computing one/all of the functions $f_1, f_2, \ldots $ on an input $x_0$&quot; to be meaningful.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have a way of specifying functions as stored programs, you're basically done: a program is essentially another kind of input, which you can prepare in superposition, and e.g. evaluate on a fixed input, or a superposition of inputs, by computing the functions from their specifications in each branch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To gain a comptational advantage from doing so is a different matter, and will have to involve some specific structure in the functions $f_t $ that you can take advantage of,  but simply to &quot;evaluate in superposition&quot; is easily done if you have enough information for the question to be sensible. &lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-02T08:56:41.897" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1564" PostTypeId="2" ParentId="1560" CreationDate="2018-04-02T09:34:45.497" Score="5" Body="&lt;p&gt;The exact answer depends on the exact kind of superposition you want. The answers by pyramids and Niel both give you something like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A\sum_{t=1}^n |\,\,f_t (x)\,\,\rangle \otimes |F_t\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I've followed Niel in labelling the different functions $f_1$, $f_2$, etc, with $n$ as the total number of functions you want to superpose. Also I've used $F_t$ to denotes some description of the function $f_t$ as a stored program. The $A$ is just whatever number needs to be there for the state to be normalized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is not simply a superposition of the $f_t(x)$. It is entangled with the stored program. If you were to trace out the stored program, you'd just have a mixture of the $f_t(x)$. This means that the stored program could constitute 'garbage', which prevents interference effects that you might be counting on. Or it might not. It depends on how this superposition will be used in your computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want rid of the garbage, things get more tricky. For example, suppose what you want is a unitary $U$ that has the effect&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U : \,\,\, | x \rangle \otimes |0\rangle^{\otimes N} \rightarrow A \sum_{t=1}^n |\,\,f_t (x)\,\,\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all possible inputs $x$ (which I am assuming are bit strings written in the computational basis). Note that I've also included some blank qubits on the input side, in case the functions have longer outputs than inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this we can very quickly find a condition that the functions must satisfy: since the input states form an orthogonal set, so must the outputs. This will put a significant restriction on the kinds of functions that can be combined in this way.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-02T09:40:29.180" LastActivityDate="2018-04-02T09:40:29.180" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1565" PostTypeId="2" ParentId="1560" CreationDate="2018-04-02T09:37:54.337" Score="3" Body="&lt;h2&gt;Yes (depending on what &quot;calculate many functions at once&quot; means)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Describing the circuit that gives the function $f$ as $U_f$ and the circuit giving $g$ as $U_g$, there are a few ways to go about doing this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Starting with the qubit registers in $\left|00x\right&amp;gt;$, Prepare a state $\alpha\left|01\right&amp;gt;+\beta\left|10\right&amp;gt;$ on the first two registers. This can be done by applying a unitary&lt;sup&gt;1&lt;/sup&gt; on the first register to put that register in the state $\alpha\left|0\right&amp;gt; + \beta\left|1\right&amp;gt;$ before applying CNOT, then $I\otimes X$. Then, apply $CU_f$ from the first register to the third and $CU_g$ from the second to the third.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.1. This gives that the third register is now in the state $\left(\alpha U_f + \beta U_g\right)\left|x\right&amp;gt;$, when the initial operations (up to $I\otimes X$) on the first two registers are reversed. However, owing to the general difficulties of implementing arbitrary controlled-unitary operations (as well as using extra qubits unnecessarily) it would probably be easier to implement this directly by dialling up the unitary $\alpha U_f + \beta U_g$. Note that this is neither implementing $f$ nor $g$, but a new, different function $f+g$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.2. Not reversing the initial operations on the first two registers puts the third in some entangled state of $f$ and $g$, which is discussed in other answers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Starting with the state $\left|xx\right&amp;gt;$ and applying $U_f$ to the first register and $U_g$ to the second. This is the closest to classical parallelism, where both functions are applied independently to copies of the same state. Aside from requiring twice the number of qubits, the issue here is that, due to no-cloning, in order to copy $\left|x\right&amp;gt;$, it either has to be known, or be a classical state (i.e. not involve superpositions in the computational basis). &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511088v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Approximate cloning&lt;/a&gt; could also be used.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Start with the state $\left|0x\right&amp;gt;$, as well as a classical register. Apply a unitary&lt;sup&gt;1&lt;/sup&gt; to put the first register in the superposition $\alpha\left|0\right&amp;gt;+\beta\left|1\right&amp;gt;$. Now, &lt;em&gt;measure&lt;/em&gt; this register (putting the result in the classical register) and apply the &lt;em&gt;classical&lt;/em&gt; operation &lt;code&gt;IF RESULT = 0 U_f ELSE U_g&lt;/code&gt;. While this may seem less powerful than either of the above operations, this is in some sense, equivalent to the quantum channel $\mathcal E\left(\rho\right) = \lvert\alpha\rvert^2U_f\rho U_f^\dagger + \lvert\beta\rvert^2U_g\rho U_g^\dagger$. Such methods can be used to make random unitaries, which have applications in e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;boson sampling&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/0707.0963&quot; rel=&quot;nofollow noreferrer&quot;&gt;randomised benchmarking&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 given by $$\begin{pmatrix}\alpha &amp;amp;&amp;amp;-\beta^* \\ \beta &amp;amp;&amp;amp; \alpha^*\end{pmatrix}$$&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-02T10:09:33.963" LastActivityDate="2018-04-02T10:09:33.963" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1568" PostTypeId="1" AcceptedAnswerId="1569" CreationDate="2018-04-02T14:39:19.600" Score="14" ViewCount="662" Body="&lt;p&gt;Quantum computers are efficiently able to simulate any other quantum system. Hence there must be some sort of equivalent of a (possibly simulated) quantum eraser setup. I would like to see such an equivalent drawn as a quantum circuit, ideally in the variant of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Delayed_choice_quantum_eraser&quot; rel=&quot;noreferrer&quot;&gt;delayed choice quantum eraser&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One (quantum) experimental realization of a quantum eraser is this: You create a double slit interference experiment where you obtain which-way information by &quot;doubling&quot; photons in front of each slit using &lt;a href=&quot;https://en.wikipedia.org/wiki/Spontaneous_parametric_down-conversion&quot; rel=&quot;noreferrer&quot;&gt;spontaneous parametric down conversion&lt;/a&gt; (the physics of which are not important for my argument, the point being that we have a new photon we can measure to obtain which-way information). The interference pattern naturally disappears, unless we build a quantum eraser: If the two &quot;doubled&quot; photons carrying the which-way information are superimposed via a 50-50 beamsplitter in such a manner that the which-way information can no longer be measured, the interference pattern reappears. Curiously, this is experimentally the case even if this superimposing happens after the interference pattern is recorded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to be unable to find a convincing equivalence for the interference pattern and for the quantum eraser in simple qubit gates. But I would love to make the thought (and ideally, the real) experiment on a quantum computer, too. What program (quantum circuit) would I need to run on a quantum computer to do that?&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="26" LastEditDate="2018-12-14T06:10:16.250" LastActivityDate="2020-11-13T21:36:14.107" Title="What is the quantum circuit equivalent of a (delayed choice) quantum eraser?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1569" PostTypeId="2" ParentId="1568" CreationDate="2018-04-02T19:44:15.497" Score="10" Body="&lt;p&gt;I will try to translate the Kim &lt;em&gt;et. al.&lt;/em&gt; experiment from an optics description into a quantum information description. Here is the experimental setup as you find it in &lt;a href=&quot;https://en.wikipedia.org/wiki/Delayed_choice_quantum_eraser&quot; rel=&quot;noreferrer&quot;&gt;the linked wikipedia article&lt;/a&gt;:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HRgmw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HRgmw.png&quot; alt=&quot;the experiment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We associate the blue path with $|0\rangle$ and the red with $|1\rangle$. The double slit can be described by a Hadamard gate. The BBO corresponds to a CNOT-gate. The state after the BBO is $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$. There is a phase $\varphi$ depending on the position $x$ of detector $D_0$, which corresponds to a phase gate $R_\varphi=\operatorname{diag}(1,e^{i\varphi})$. Finally superposing the beams on $D_0$ corresponds to another Hadamard gate and the measurement of $D_0$ can be seen to project onto $|0\rangle$. The complete circuit looks like this:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qIQro.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qIQro.png&quot; alt=&quot;The quantum circuit&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state before the measurement is:&#xA;$$\frac{1}{2}(|00\rangle+|10\rangle + e^{i\varphi}|01\rangle - e^{i\varphi}|11\rangle)=\frac{1}{2}(((1+e^{i\varphi})|0\rangle+(1-e^{i\varphi})|1\rangle)|+\rangle + ((1-e^{i\varphi})|0\rangle +(1+e^{i\varphi})|1\rangle)|-\rangle)$$&lt;br&gt;&#xA;Let's look at the probability to measure the first photon in $D_0$ ($|0\rangle\langle 0|$).&lt;br&gt;&#xA;If we measure the second in z-basis ($D_3$ and $D_4$), the probability for a click in $D_0$ is $\frac{1}{2}$ (the post-measurement state is $|\pm\rangle$). This is independent of the phase: no interference here. For the x-basis ($D_1$ and $D_2$) the probability for a click at $D_0$ is $\frac{1}{2}(1\mp \cos \varphi)$, so here we see the interference. Whether we see interference or not depends on the basis choice on the second system, which can be delayed. Of course we need to know the outcome, so faster than light communication is not possible with this setup.  &lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2018-04-02T21:46:58.673" LastActivityDate="2018-04-02T21:46:58.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1570" PostTypeId="1" AcceptedAnswerId="1573" CreationDate="2018-04-02T21:14:13.097" Score="10" ViewCount="526" Body="&lt;p&gt;I am aware that IBM, Rigetti, and Google have built some small-scale devices. Which of them are available for access by an undergraduate student? For how long? With how many qubits?&lt;/p&gt;&#xA;" OwnerUserId="1658" LastEditorUserId="26" LastEditDate="2019-05-14T06:28:37.833" LastActivityDate="2019-05-14T06:33:00.330" Title="What real quantum computers are available for students to use?" Tags="&lt;resource-request&gt;&lt;physical-realization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1571" PostTypeId="2" ParentId="1570" CreationDate="2018-04-02T22:27:01.177" Score="7" Body="&lt;p&gt;An undergrad can create an account with the IBM quantum experience. Users have some points that they can use to run simulations of their design on a real quantum computer. You can use five qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unaware of any way for someone to use Google's quantum computer unless you get a job with them. Rigetti has a device, but what people use online is a simulator of a quantum computer, meant to assist with writing quantum algorithms, that runs up to 36 qubits. It uses a language called Quil.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are multiple simulators available. IBM has one as a part of its IBM quantum experience, there is Quirk, and there are multiple &quot;programming&quot; languages like QCL, most of which are available on GitHub or with the creation of an account, so definitely open to an undergrad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize: if you don't have a quantum computer of your own and wish to try out a circuit on a real quantum computer, your options seem to be limited to IBM's quantum experience, which has five qubits.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-05-14T06:33:00.330" LastActivityDate="2019-05-14T06:33:00.330" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1572" PostTypeId="2" ParentId="1323" CreationDate="2018-04-03T04:13:08.670" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Why can you not subdivide a quantum bitcoin?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Anyone can create a Cryptocurrency, &lt;strong&gt;how it works&lt;/strong&gt; is &lt;strong&gt;up to them&lt;/strong&gt;, how well it is received is up to the public, generally &lt;a href=&quot;https://masterthecrypto.com/guide-how-to-value-a-cryptocurrency/&quot; rel=&quot;noreferrer&quot;&gt;it is decided by&lt;/a&gt;: Utility, Scarcity, Perceived Value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As of today a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bitcoin&quot; rel=&quot;noreferrer&quot;&gt;Bitcoin&lt;/a&gt; is worth USD 7,073.54, A Bitcoin is 10$^8$ Satoshis which are 0.00000001 Bitcoins, so a Satoshi is worth: 7,073.54 * 0.00000001 = 7.07354 × 10$^{-5}$ USD or 0.00707354 pennies. In total there can be 21 million bitcoin units (2.1 quadrillion Satoshis). The creators of Bitcoin chose that it would be divided into Satoshis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Jogenfors' paper, which you cited, he decided that the Quantum Bitcoin protocol (not to be confused with the &lt;a href=&quot;https://qubitcoin.cc/&quot; rel=&quot;noreferrer&quot;&gt;Qubitcoin&lt;/a&gt; (Q2C) a CPU and GPU based Cryptocurrency) will use the no-cloning theorem of quantum mechanics to construct quantum shards and two blockchains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;answer to your question is&lt;/strong&gt;, according to section 4.4 - Preventing the Reuse Attack:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;With Bitcoin the blockchain records all transactions and a miner therefore&#xA;relinquishes control over the mined bitcoin as soon as it is handed over to a recipient. In Quantum Bitcoin, however, there is no record of who owns what, so there is no way to distinguish between the real and counterfeit quantum bitcoin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We prevent the reuse attack by adding a secondary stage to the minting algorithm, where data is also appended to a new ledger $\mathcal{L^′}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum shard miners create and sell the quantum shards on a marketplace, another miner (called a quantum bitcoin miner) purchases $m$ quantum shards ${(s, ρi, σi)}1≤i≤m$ on the marketplace that, for all $1 ≤ i ≤ m$, fulfill the following conditions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;$\mathsf{Verify}\mathcal{_M} ((s, ρi, σi))$ accepts&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The timestamp $T$ of the quantum shard in the Quantum Shard ledger $\mathcal{L}$ fulfills $t − T ≤ T_{max}$, where $t$ is the current time&quot;. See section &quot;A.2 The Reuse Attack&quot; for further proof.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Shards have a lifetime of $T_{max}$&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While a shard is designed to have a short lifetime the Quantum Bitcoin is designed to have a great longevity (&lt;strong&gt;as long as it is intact, undivided&lt;/strong&gt;), see section &quot;A.3 Quantum Bitcoin Longevity&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;strong&gt;Theorem 4 (Quantum Bitcoin Longevity)&lt;/strong&gt; The number of times a quantum bitcoin can be verified and reconstructed is exponentially large in $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt; Corollary 1 shows that the completeness error $\varepsilon$ of $\mathcal{Q}$ is exponentially small in $n$. When verifying a genuine quantum bitcoin \$, the verifier performs the measurement $\mathsf{Verify}\mathcal{_Q}$(\$) on the underlying quantum states $ρ$, which yields the outcome “Pass” with probability $1 − \varepsilon$. Then lemma 2 shows that we can recover the underlying quantum states $\widetilde{p}_{i}$ of \$ so that $ \Vert \widetilde{p}_{i} − p_i \Vert _{tr} \le \sqrt\varepsilon$. As $\varepsilon$ is exponentially small in $n$, the trace distance becomes exponentially small in $n$ as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each time such a quantum bitcoin is verified and reconstructed, the trace distance between the “before” and “after” is exponentially small in $n$. Given &lt;strong&gt;any threshold after which&lt;/strong&gt; we consider the quantum bitcoin “worn out”, the number of verifications it survives before passing this threshold is exponential in $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theorem 4 shows that a quantum bitcoin \$ can be verified and re-used many times before the quantum state is lost (&lt;strong&gt;assuming the absence of noise and decoherence&lt;/strong&gt;). This is of course analogous to traditional, physical banknotes and coins which are expected to last for a large enough number of transactions before wearing out.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, much like paper money, you need the whole bill (blockchain) undivided. Of course, that doesn't prevent you from exchanging one Quantum Bitcoin for however many Bitcoins and then offering Bitcoins (or fiat) as change.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-04-03T04:13:08.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1573" PostTypeId="2" ParentId="1570" CreationDate="2018-04-03T08:56:15.130" Score="13" Body="&lt;p&gt;The first cloud device was made available back in 2013. It is a &lt;a href=&quot;http://www.bristol.ac.uk/physics/research/quantum/engagement/qcloud/&quot; rel=&quot;noreferrer&quot;&gt;photonic chip&lt;/a&gt; at the University of Bristol. Though it is an example of something we could build quantum computers from, it is quite different from the usual 'circuit model' architecture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then 2016 brought some devices from IBM. There are 5 qubit processors anyone can use with the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx&quot; rel=&quot;noreferrer&quot;&gt;Quantum Experience GUI&lt;/a&gt; or using a the &lt;a href=&quot;https://www.qiskit.org/&quot; rel=&quot;noreferrer&quot;&gt;QISKit SDK&lt;/a&gt;. There's also a 16 qubit device that you can use only with QISKit. Larger devices also exist, but they are not publically available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then came Rigetti's &lt;a href=&quot;http://pyquil.readthedocs.io/en/stable/qpu_overview.html&quot; rel=&quot;noreferrer&quot;&gt;19 qubit QPU&lt;/a&gt; at the end of last year, which can be used via &lt;a href=&quot;http://pyquil.readthedocs.io/en/stable/overview.html&quot; rel=&quot;noreferrer&quot;&gt;pyQuil&lt;/a&gt;. You have to apply for an appointment to get access for a few hours, but I see no reason why anyone with a serious interest would not have it granted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, Alibaba and the Chinese Academy of Sciences have teamed up to put an &lt;a href=&quot;http://quantumcomputer.ac.cn/index.html&quot; rel=&quot;noreferrer&quot;&gt;11 qubit device&lt;/a&gt; on the cloud. The interface is via a GUI, and is quite similar to IBM's Quantum Experience.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-03T08:56:15.130" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1575" PostTypeId="5" CreationDate="2018-04-03T09:40:56.517" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-03T09:40:56.517" LastActivityDate="2018-04-03T09:40:56.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1576" PostTypeId="4" CreationDate="2018-04-03T09:40:56.517" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-03T09:40:56.517" LastActivityDate="2018-04-03T09:40:56.517" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1577" PostTypeId="1" AcceptedAnswerId="1578" CreationDate="2018-04-03T13:23:59.997" Score="18" ViewCount="2703" Body="&lt;p&gt;From what I understood, there seems to be a difference between quantum annealing and adiabatic quantum computation models but the only thing I found on this subject implies some strange results (see below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following: what is exactly the difference/relation between quantum annealing and adiabatic quantum computation? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The observations that leads to a &quot;strange&quot; result:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, adiabatic quantum computation is depicted as &quot;a subclass of quantum annealing&quot;.&lt;/li&gt;&#xA;&lt;li&gt;On the other hand we know that:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Adiabatic quantum computation is equivalent to quantum circuit model (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0405098.pdf&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/0405098v2&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;DWave computers use quantum annealing.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So by using the 3 facts above, DWave quantum computers should be universal quantum computers. But from what I know, DWave computers are restricted to a very specific kind of problem so they cannot be universal (DWave's engineers confirm this &lt;a href=&quot;https://youtu.be/zvfkXjzzYOo?t=283&quot; rel=&quot;noreferrer&quot;&gt;in this video&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side question, what is the problem with the reasoning above?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-04-17T13:31:45.323" LastActivityDate="2020-06-20T20:42:42.507" Title="What is the difference between quantum annealing and adiabatic quantum computation models?" Tags="&lt;annealing&gt;&lt;models&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1578" PostTypeId="2" ParentId="1577" CreationDate="2018-04-03T14:29:38.580" Score="8" Body="&lt;p&gt;Vinci and Lidar have a nice explanation in their introduction of non-stoquastic Hamiltonians in quantum annealing (which is necessary to a quantum annealing device to simulate gate model computation).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1701.07494&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1701.07494&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It is well known that the solution of computational problems can be encoded into the ground state of a time-dependent quantum Hamiltonian. This approach is known as adiabatic quantum computation (AQC), and is universal for quantum computing (for a review of AQC see  arXiv:1611.04471). Quantum annealing (QA) is a framework that incorporates algorithms and hardware designed to solve computational problems via quantum evolution towards the ground states of final Hamiltonians that encode classical optimization problems, without necessarily insisting on universality or adiabaticity.&lt;/p&gt;&#xA;&lt;p&gt;QA thus inhabits a regime that is intermediate between the idealized assumptions of universal AQC and unavoidable experimental compromises. Perhaps the most significant of these compromises has been the design of stoquastic quantum annealers. A Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is stoquastic with respect to a given basis if &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; has only real nonpositive offdiagonal matrix elements in that basis, which means that its ground state can be expressed as a classical probability distribution. Typically, one chooses the computational basis, i.e., the basis in which the final Hamiltonian is diagonal. The computational power of stoquastic Hamiltonians has been carefully scrutinized, and is suspected to be limited in the ground-state AQC setting. E.g., it is unlikely that ground-state stoquastic AQC is universal. Moreover, under various assumptions ground-state stoquastic AQC can be efficiently simulated by classical algorithms such as quantum Monte Carlo, though certain exceptions are known.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="54" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-03T14:29:38.580" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1579" PostTypeId="2" ParentId="1441" CreationDate="2018-04-03T17:25:00.800" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;I'm looking for an explicit upper bound on the probability of successful counterfeiting ...&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In &quot;&lt;a href=&quot;https://arxiv.org/abs/1404.1507v4&quot; rel=&quot;noreferrer&quot;&gt;An adaptive attack on Wiesner's quantum money&lt;/a&gt;&quot;, by Aharon Brodutch, Daniel Nagaj, Or Sattath, and Dominique Unruh, last revised on 10 May 2016, the authors claim a success rate of: &quot;~100%&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper makes these claims:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Main results.&lt;/strong&gt; We show that &lt;strong&gt;in a strict testing variant&lt;/strong&gt; of Wiesner's scheme (that is, if only valid money is returned to the owner), given a single valid quantum money state $(s,\left|\$_s\right&amp;gt;)$, a counterfeiter can efficiently create as many copies of $\left|\$_s\right&amp;gt;$ as he wishes (hence, the &lt;strong&gt;scheme is insecure&lt;/strong&gt;). He can rely on the quantum Zeno effect for protection – if he disturbs the quantum money state only slightly, the bill is likely to be projected back to the original state after a test. Interestingly, this allows a counterfeiter to distinguish the four different qubit states with an &lt;strong&gt;arbitrarily small probability&lt;/strong&gt; of being caught.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;...&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In this paper, we have focused on Wiesner's money in a noiseless environment. That is, the bank rejects the money if even a single qubit is measured incorrectly. In &lt;strong&gt;a more realistic setting&lt;/strong&gt;, we have to deal with noise, and &lt;strong&gt;the bank would want to tolerate a limited amount of errors&lt;/strong&gt; in the quantum state [PYJ+12], say 10%.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also see: &quot;&lt;a href=&quot;https://arxiv.org/abs/1604.01383&quot; rel=&quot;noreferrer&quot;&gt;Quantum Bitcoin: An Anonymous and Distributed Currency Secured by the No-Cloning Theorem of Quantum Mechanics&lt;/a&gt;&quot;, by Jonathan Jogenfors, 5 Apr 2016, where he discusses Wiesner's scheme and proposes one of his own.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-04-03T17:25:00.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1580" PostTypeId="1" AcceptedAnswerId="1582" CreationDate="2018-04-03T18:40:26.300" Score="7" ViewCount="796" Body="&lt;p&gt;There are many different ways to build quantum computers, such as superconducting qubits, quantum dots, and ion traps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I would like to understand is why some universities and research organizations have chosen to study trapped ion quantum computers.&#xA;I understand that it is better in some respects, but what are the fundamental differences?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qma4P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qma4P.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Source: &lt;a href=&quot;https://youtu.be/90U_SmKyfGI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Youtube video&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Domain of Science&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Dominic Walliman&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="245" LastEditorUserId="26" LastEditDate="2018-12-14T05:30:15.800" LastActivityDate="2018-12-14T05:30:15.800" Title="What are the fundamental differences between trapped ion quantum computers and other architectures?" Tags="&lt;architecture&gt;&lt;universal-gates&gt;&lt;models&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1581" PostTypeId="1" AcceptedAnswerId="1587" CreationDate="2018-04-03T22:02:33.580" Score="14" ViewCount="765" Body="&lt;p&gt;The typically used gate set for quantum computation is composed of the single qubits Cliffords (Paulis, H and S) and the controlled-NOT and/or controlled-Z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To go beyond Clifford we like to have full single qubit rotations. But if we are being minimal, we just go for T (the fourth root of Z).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This particular form of the gate set pops up everything. Such as IBM’s Quantum Experiment p, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why these gates, exactly? For example, H does the job of mapping between X and Z. S similarly does the job of mapping between Y and X, but a factor of $-1$ also gets introduced. Why don’t we use a Hadamard-like unitary $(X+Y)/\sqrt{2}$ instead of S? Or why don’t we use the square root of Y instead of H? It would be equivalent mathematically, of course, but it would just seem a bit more consistent as a convention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And why is our go-to non-Clifford gate the fourth root of Z? Why not the fourth root of X or Y?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What historical conventions led to this particular choice of gate set?&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-12-23T14:10:44.500" LastActivityDate="2018-12-23T14:10:44.500" Title="Why do we use the standard gate set that we do?" Tags="&lt;quantum-gate&gt;&lt;history&gt;&lt;technical-standards&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1582" PostTypeId="2" ParentId="1580" CreationDate="2018-04-04T00:53:26.050" Score="7" Body="&lt;p&gt;&lt;em&gt;Disclosure: while I am not an experimental physicist, I am part of the &lt;a href=&quot;https://nqit.ox.ac.uk&quot; rel=&quot;noreferrer&quot;&gt;NQIT project&lt;/a&gt;, which is aiming to develop quantum hardware which is suitable to realise scalable quantum computers. The architecture that we're investing most heavily in is optically linked ion traps.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ions represent some of the physically best understood systems to experimental and theoretical physics, and the idea of performing quantum computation with ion traps is a very old one, as far as proposed implementations go. The main features of ion traps as a potential approach to realising quantum computation are &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;They can give rise to very stable qubits, with life times on the order of a minute or more; and&lt;/li&gt;&#xA;&lt;li&gt;For well-chosen ion species, the electron state transitions are very well understood, in principle allowing for very high precision gates.&lt;/li&gt;&#xA;&lt;li&gt;Furthermore, these features can be realised without the need for heavy cryogenics.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See for instance [&lt;a href=&quot;https://arxiv.org/pdf/0805.2450.pdf&quot; rel=&quot;noreferrer&quot;&gt;arXiv:0805.2450&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1606.08409&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1606.08409&lt;/a&gt;]. To be sure, there are obstacles to using ion traps as a basis for quantum technologies. Most importantly, you need to solve the problem of cross-talk between the ions due to collective motional excitation, either through clever quantum control or through isolation of groups of ions. If the latter, you have to find a way to regroup collections of ions in a very large trap architecture, or find a way for ions in different traps to communicate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scaling problems for ion traps are not easy problems. However, significant obstacles exist for all quantum architectures; while well-resourced multinational corporations have placed their bets elsewhere, it seems to me far too early to reliably predict which platform will solve their scaling problems first. To my knowledge, none of the approaches have managed to get to the point where the only problem left is engineering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you could solve the scaling problems for ion traps, you would likely realise computers through the unitary circuit model, the measurement-based model, or some closely related model to these, according to how you negotiated the scaling problem. Of course, this is how one might describe computation at the lowest level, i.e. to realise error correction. At higher levels, tradition would exert a significant amount of pressure to use the primitive operations to realise fault-tolerant unitary circuit model operations, unless some other computational model was somehow compelling enough to displace it for the scalable error-corrected system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case &amp;mdash; it is not really meaningful at this stage to call ion traps in general a &quot;non-universal model&quot;, as your diagram suggests, just because some groups have aimed for quantity before versatility. This would be similar to pigeon-holing transistors as a non-universal computational platform in the 1950s, just because they were used to make radios before they were used to make computers. Even if (as the linked YouTube video suggests) the ion trap groups on the U.S. eastern seaboard are aiming first for many ions and then attempting to master versatile quantum control,  other groups such as the one at Oxford are taking the opposite approach of controlling very few qubits very well, then attempting to approach the problem of scaling up. Both are possible trajectories towards solving the difficult problem of designing scalable quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-04T00:53:26.050" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1584" PostTypeId="1" AcceptedAnswerId="1594" CreationDate="2018-04-04T06:17:09.467" Score="33" ViewCount="3161" Body="&lt;p&gt;Is there a general statement about what kinds of problems can be solved more efficiently using quantum computers (quantum gate model only)? Do the problems for which an algorithm is known today have a common property?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as i understand quantum computing helps with the hidden subgroup problem (Shor); Grover's algorithm helps speedup search problems. I have read that quantum algorithms can provide speed-up if you look for a 'global property' of  a function (Grover/Deutsch).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there a more concise and correct statement about where quantum computing can help? &lt;/li&gt;&#xA;&lt;li&gt;Is it possible to give an explanation why quantum physics can help there (preferably something deeper that 'interference can be exploited')? And why it possibly will not help for other problems (e.g. for NP-complete problems)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are there relevant papers that discuss just that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had asked this question before over on &lt;a href=&quot;https://cstheory.stackexchange.com/questions/38118/general-statement-what-kinds-of-problems-can-be-solved-more-efficiently&quot;&gt;cstheory.stackexchange.com&lt;/a&gt; but it may be more suitable here.&lt;/p&gt;&#xA;" OwnerUserId="1185" LastEditorUserId="26" LastEditDate="2018-12-13T19:42:32.217" LastActivityDate="2018-12-13T19:42:32.217" Title="Is there any general statement about what kinds of problems can be solved more efficiently using a quantum computer?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;complexity-theory&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="1585" PostTypeId="2" ParentId="1584" CreationDate="2018-04-04T07:29:37.973" Score="14" Body="&lt;p&gt;&lt;strong&gt;TL;DR: No, we do not have any &lt;em&gt;precise&lt;/em&gt; &quot;general&quot; statement about exactly which type of problems quantum computers can &lt;em&gt;solve&lt;/em&gt;, in complexity theory terms. However, we do have a rough idea.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Wikipedia's sub-article on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Relation_to_computational_complexity_theory&quot; rel=&quot;noreferrer&quot;&gt;Relation to to computational complexity theory&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The class of problems that can be efficiently solved by quantum&#xA;  computers is called &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;BQP&lt;/a&gt;&lt;/strong&gt;, for &quot;bounded error, quantum, polynomial&#xA;  time&quot;. Quantum computers only run &lt;a href=&quot;https://en.wikipedia.org/wiki/Randomized_algorithm&quot; rel=&quot;noreferrer&quot;&gt;probabilistic algorithms&lt;/a&gt;, so &lt;strong&gt;BQP&lt;/strong&gt; on&#xA;  quantum computers is the counterpart of &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/BPP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;BPP&lt;/a&gt;&lt;/strong&gt; (&quot;bounded error,&#xA;  probabilistic, polynomial time&quot;) on classical computers. &lt;strong&gt;It is defined&#xA;  as the set of problems solvable with a polynomial-time algorithm,&#xA;  whose probability of error is bounded away from one half&lt;/strong&gt;. A&#xA;  quantum computer is said to &quot;solve&quot; a problem if, for every instance,&#xA;  its answer will be right with high probability. If that solution runs&#xA;  in polynomial time, then that problem is in BQP.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;BQP is contained in the complexity class &lt;a href=&quot;https://en.wikipedia.org/wiki/Sharp-P&quot; rel=&quot;noreferrer&quot;&gt;#P&lt;/a&gt; (or more precisely in the&#xA;  associated class of decision problems P&lt;sup&gt;#P&lt;/sup&gt;), which is a subclass of&#xA;  &lt;a href=&quot;https://en.wikipedia.org/wiki/PSPACE&quot; rel=&quot;noreferrer&quot;&gt;PSPACE&lt;/a&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;BQP is suspected to be disjoint from NP-complete and a strict superset&#xA;  of P, but that is not known. Both integer factorization and discrete&#xA;  log are in BQP. Both of these problems are&#xA;  &lt;a href=&quot;https://en.wikipedia.org/wiki/NP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;NP&lt;/a&gt; problems suspected&#xA;  to be outside BPP, and hence outside P. Both are suspected to not be&#xA;  NP-complete. There is a common misconception that quantum computers&#xA;  can solve NP-complete problems in polynomial time. That is not known&#xA;  to be true, and is generally suspected to be false.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The capacity of a quantum computer to accelerate classical algorithms&#xA;  has rigid limits—upper bounds of quantum computation's complexity. The&#xA;  overwhelming part of classical calculations cannot be accelerated on a&#xA;  quantum computer. A similar fact takes place for particular&#xA;  computational tasks, like the search problem, for which Grover's&#xA;  algorithm is optimal.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Bohmian Mechanics is a non-local hidden variable interpretation of&#xA;  quantum mechanics. It has been shown that a non-local hidden variable&#xA;  quantum computer could implement a search of an N-item database at&#xA;  most in ${\displaystyle O({\sqrt[{3}]{N}})}$ steps. This is slightly&#xA;  faster than the $\displaystyle O({\sqrt  {N}})$ steps taken by&#xA;  Grover's algorithm. Neither search method will allow quantum computers&#xA;  to solve NP-Complete problems in polynomial time.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Although quantum computers may be faster than classical computers for&#xA;  some problem types, those described above can't solve any problem that&#xA;  classical computers can't already solve.&lt;/strong&gt; A Turing machine can simulate&#xA;  these quantum computers, so such a quantum computer could never solve&#xA;  an undecidable problem like the halting problem. The existence of&#xA;  &quot;standard&quot; quantum computers does not disprove the Church–Turing&#xA;  thesis. It has been speculated that theories of quantum gravity, such&#xA;  as M-theory or loop quantum gravity, may allow even faster computers&#xA;  to be built. Currently, defining computation in such theories is an&#xA;  open problem due to the problem of time, i.e., there currently exists&#xA;  no obvious way to describe what it means for an observer to submit&#xA;  input to a computer and later receive output.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As for &lt;em&gt;why&lt;/em&gt; quantum computers can &lt;em&gt;efficiently&lt;/em&gt; solve BQP problems:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;The number of qubits in the computer is allowed to be a polynomial&#xA;  function of the instance size. For example, algorithms are known for&#xA;  factoring an $n$-bit integer using just over $2n$ qubits (Shor's&#xA;  algorithm).&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Usually, computation on a quantum computer ends with a measurement.&#xA;  This leads to a collapse of quantum state to one of the basis states.&#xA;  It can be said that the quantum state is measured to be in the correct&#xA;  state with high probability.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Interestingly, if we theoretically allow post-selection (which doesn't have any scalable practical implementation), we get the complexity class &lt;a href=&quot;https://en.wikipedia.org/wiki/PostBQP&quot; rel=&quot;noreferrer&quot;&gt;post-BQP&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In computational complexity theory, PostBQP is a complexity class&#xA;  consisting of all of the computational problems solvable in polynomial&#xA;  time on a quantum Turing machine with postselection and bounded error&#xA;  (in the sense that the algorithm is correct at least 2/3 of the time&#xA;  on all inputs). However, Postselection is not considered to be a&#xA;  feature that a realistic computer (even a quantum one) would possess,&#xA;  but nevertheless postselecting machines are interesting from a&#xA;  theoretical perspective.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'd like to add what &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1584/is-there-any-general-statement-about-what-kinds-of-problems-can-be-solved-more-e#comment1262_1585&quot;&gt;@Discrete lizard&lt;/a&gt; mentioned in the comments section. You have not explicitly defined what you mean by &quot;can help&quot;, however, the rule of thumb in complexity theory is that if a quantum computer &quot;can help&quot; in terms of solving in polynomial time (with an error bound) iff the class of problem it can solve lies in BQP but not in P &lt;em&gt;or&lt;/em&gt; BPP. The general relation between the complexity classes we discussed above is &lt;strong&gt;suspected&lt;/strong&gt; to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\text{P $\subseteq$ BPP $\subseteq$ BQP $\subseteq$ PSPACE}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y2yXMm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y2yXMm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, P=PSPACE, is &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science&quot; rel=&quot;noreferrer&quot;&gt;an open problem in Computer Science&lt;/a&gt;. Also, the &lt;a href=&quot;https://en.wikipedia.org/wiki/P_versus_NP_problem&quot; rel=&quot;noreferrer&quot;&gt;relationship between P and NP&lt;/a&gt; is not known yet.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-04T08:31:08.383" LastActivityDate="2018-04-04T08:31:08.383" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1586" PostTypeId="2" ParentId="1584" CreationDate="2018-04-04T07:39:24.650" Score="9" Body="&lt;p&gt;There is no such general statement and it is unlikely there will be one soon. I will explain why this is the case. For a partial answer to your question, looking at the problems in the two complexity classes BQP and PostBQP might help.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The complexity classes that come closest to the problems that can be solved efficiently by quantum computers of the quantum gate model are &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;BQP&lt;/a&gt;; and&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/PostBQP&quot; rel=&quot;noreferrer&quot;&gt;PostBQP&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;BQP consists of the problems that can be solved in polynomial time on a quantum circuit. Most important quantum algorithms, such as Shor's algorithm, solve problems in BQP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PostBQP consists of the problems that can be solved in polynomial time on a quantum circuit that can additionally perform postselection. This is a lot more powerful, as PostBQP$=$&lt;a href=&quot;https://en.wikipedia.org/wiki/PP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;PP&lt;/a&gt;, a class that contains PP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there currently are no methods to &lt;em&gt;practically&lt;/em&gt; implement postselection, so PostBQP is more of theoretical interest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between P, NP and BQP is currently unknown; and an open problem on the order of P vs. NP. As a general statement about what kinds of problems can be solved more efficiently using quantum computers &lt;em&gt;must&lt;/em&gt; answer the BQP vs. P question (if BQP=P, then apparently quantum computers aren't more efficient (to complexity theorists, at least) )&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-04T07:55:43.660" LastActivityDate="2018-04-04T07:55:43.660" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1587" PostTypeId="2" ParentId="1581" CreationDate="2018-04-04T09:23:45.920" Score="12" Body="&lt;p&gt;Anyone who has written a paper, and asked themselves whether they could improve the notation, or present the analysis a bit differently to make it more elegant, is familiar with the fact that choices of notation, description, and analysis can be an accident &amp;mdash; chosen without deep motivations. There's nothing wrong with it, it just doesn't have a strong justification to be a particular way. In large communities of people more concerned (possibly with reason) with getting things done rather than presenting the cleanest possible picture, this is going to happen all the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that the ultimate answer to this question is going to be along these lines: it is mostly a historical accident. I doubt that there are any &lt;em&gt;deeply considered&lt;/em&gt; reasons for the gate-sets being as they are, any more than there are deeply considered reasons why we talk about the Bell state $\lvert \Phi^+ \rangle = ( \lvert 00 \rangle + \lvert 11 \rangle ) \big/ \sqrt 2$ somewhat more often than the state $\lvert \Psi^- \rangle = ( \lvert 01 \rangle - \lvert 10 \rangle ) \big/ \sqrt 2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we can still consider how the accident came about, and whether there is something we can learn about systematic ways of thinking which might have led us there. I expect that the reasons ultimately come from the cultural priorities of computer scientists, with both deep and superficial biases playing a role in how we describe things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A digression on Bell states&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'll bear with me, I'd like to dwell on the example of the two Bell states $\lvert \Phi^+ \rangle$ and $\lvert \Psi^- \rangle$ as an  indicative example of how an ultimately arbitrary convention can come about by accident, in part because of biases which do not have deep mathematical roots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One obvious reason for preferring $\lvert \Phi^+ \rangle$ over $\lvert \Psi^- \rangle$ is that the former is more obviously symmetric.&#xA;As we add the two components for $\lvert \Phi^+ \rangle$, there is no clear need to defend why we write it as we do. In contrast, we could just as easily define $\lvert \Psi^- \rangle = (\lvert 10 \rangle - \lvert 01 \rangle) \big/ \sqrt 2$ with the opposite sign, which is no better or worse motivated than the choice $\lvert \Psi^- \rangle = (\lvert 01 \rangle - \lvert 10 \rangle) \big/ \sqrt 2$. This makes it feel as though we are making more arbitrary choices when defining $\lvert \Psi^- \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even the choice of basis is somewhat flexible in the case of $\lvert \Phi^+ \rangle$: we can write $\lvert \Phi^+ \rangle := (\lvert ++ \rangle + \lvert -- \rangle)\big/\sqrt 2$ and obtain the same state. But things start going a little worse if you start considering the eigenstates $\lvert \pm i \rangle := (\lvert 0 \rangle \pm i \lvert 1 \rangle)\big/\sqrt 2$ of the $Y$ operator: we have $\lvert \Phi^+ \rangle = (\lvert +i \rangle\lvert -i \rangle + \lvert -i \rangle \lvert +i \rangle)\big/\sqrt 2$. This still looks pretty symmetric, but it becomes clear that our choice of basis plays a non-trivial role in how we define $\lvert \Phi^+ \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The joke is on us. The reason why $\lvert \Phi^+ \rangle$ seems &quot;more symmetric&quot; than $\lvert \Psi^- \rangle$ is because $\lvert \Psi^- \rangle$ is literally the least symmetric two-qubit state, and this makes it &lt;em&gt;better&lt;/em&gt; motivated than $\lvert \Phi^+\rangle$ instead of less motivated. The $\lvert \Psi^- \rangle$ state is the unique &lt;em&gt;antisymmetric&lt;/em&gt; state: the unique state which is the $-1$ eigenvector of the SWAP operation, and therefore implicated in the controlled-SWAP test for qubit state distinguishability, among other things.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We can describe $\lvert \Psi^- \rangle$ up to a global phase as $(\lvert \alpha \rangle \lvert \alpha^\perp \rangle - \lvert \alpha^\perp \rangle \lvert \alpha \rangle)\big/\sqrt 2$ for literally any single-qubit state $\lvert \alpha \rangle$ and orthogonal state $\lvert \alpha^\perp \rangle$, meaning that the properties which make it interesting are independent of the choice of basis.&lt;/li&gt;&#xA;&lt;li&gt;Even the global phase which you use to write the state $\lvert \alpha^\perp \rangle$ doesn't affect the definition of $\lvert \Psi^-\rangle$ up to more than a global phase. The same isn't true of $\vert \Phi^+\rangle$: as an exercise for the reader, if $\lvert 1' \rangle = i \lvert 1 \rangle$, then what is $(\lvert 00 \rangle + \lvert 1' 1' \rangle)\big/\sqrt 2$?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Meanwhile, $\lvert \Phi^+ \rangle$ is just one maximally entangled state in the three-dimensional symmetric subspace on two qubits &amp;mdash; the subspace of $+1$ eigenvectors of the SWAP operation &amp;mdash; and therefore no more distinguished in principle than, say,  $\lvert \Phi^- \rangle \propto \lvert 00 \rangle - \lvert 11 \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After learning a thing or two about the Bell states, it becomes clear that our interest in $\lvert \Phi^+ \rangle$ in particular is motivated only by a superficial symmetry of notation, and not any truly meaningful mathematical properties. It is certainly a more arbitrary choice than $\lvert \Psi^- \rangle$. The only obvious motivation for preferring $\lvert \Phi^+ \rangle$ are sociological reasons having to do with avoiding minus signs and imaginary units. And the only justifiable reason I can think of for that are cultural: specifically, in order to better accomodate students or computer scientists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Who ordered CNOT?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You ask why we don't talk more about $(X + Y)\big/\sqrt 2$. To me the more interesting question that you also ask: we do we talk so much about $H = (X + Z)\big/\sqrt 2$, when $\sqrt Y$ does many of the same things? I have seen talks given by experimental optical physicists to students, who even describe performing $\sqrt Y$ on a standard basis state &lt;em&gt;as&lt;/em&gt; performing a Hadamard gate: but it was a $\sqrt Y$ gate that was actually more natural for him. The operator $\sqrt Y$ is also more directly related to the Pauli operators, obviously. A serious physicist might consider it curious that we dwell so much on the Hadamard instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there is a bigger elephant in the room &amp;mdash; when we talk about CNOT, &lt;em&gt;why&lt;/em&gt; are we talking about CNOT, instead of another entangling gate $\mathrm{CZ} = \mathrm{diag}(+1,+1,+1,-1)$ which is symmetric on its tensor factors, or better yet $U = \exp(-i \pi (Z \otimes Z)/2)$ which is more closely related to the natural dynamics of many physical systems? Not to mention a unitary such as $U' = \exp(-i \pi (X \otimes X)/2)$ or other such variants.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason, of course, is that we are explicitly interested in computation rather than physics per se. We care about CNOT because how it transforms the standard basis (a basis which is preferred not for mathematical or physical reasons, but for &lt;em&gt;human-centered&lt;/em&gt; reasons).&#xA;The gate $U$ above is slightly mysterious from the point of a computer scientist: it is not obvious on the surface of it what it is &lt;em&gt;for&lt;/em&gt;, and worse, it is full of icky complex coefficients. And the gate $U'$ is even worse. By contrast, CNOT is a permutation operator, full of 1s and 0s, permuting the standard basis in a way which is obviously relevant to the computer scientist. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I'm making a bit of fun here, in the end &lt;em&gt;this is what we're studying quantum computation for&lt;/em&gt;. The physicist can have deeper insights into the ecology of the elementary operations, but what the computer scientist cares about at the end of the day is how primitive things can be composed into comprehensible procedures involving classical data. And that means not caring too much about symmetry on the lower logical levels, so long as they can get what they want out of those lower levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We talk about CNOT because it is the gate that we want to spend time thinking about. From a physical perspective gates such as $U$ and $U'$ as above are in many cases the operations we would think about for &lt;em&gt;realising&lt;/em&gt; CNOT, but the CNOT is the thing that we care about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Deep, and not so deep, reasons to prefer the Hadamard gate&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect that the priorities of computer scientists motivate a lot of our conventions, such as why we talk about $(X + Z)\big/\sqrt 2$, instead of $\sqrt Y \propto (\mathbb 1 - i Y)\big/\sqrt 2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard operation is already slightly scary to computer scientists who are not already acquainted with quantum information theory. (The way it is used sounds like non-determinism, and it even uses irrational numbers!) But once a computer scientist gets past the initial revulsion, the Hadamard gate does have properties that they can like: at least it only involves real coefficients, it is self-inverse, and you can even describe the eigenbasis of $H$ with just real coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way in which the Hadamard often arises is in describing toggling between the standard basis $\lvert 0 \rangle, \lvert 1 \rangle$ and 'the' conjugate basis $\lvert + \rangle, \lvert - \rangle$ (that is to say, the eigenbasis of the $X$ operator, as opposed to the $Y$ operator) &amp;mdash; the so-called 'bit' and the 'phase' bases, which are two conjugate bases that you can express using only real coefficients. Of course, $\sqrt Y$ also transforms between these bases, but also introduces a non-trivial transformation if you perform it twice.&#xA;If you want to think of &quot;toggling between two different bases in which you might store information&quot;, the Hadamard gate is better. But &amp;mdash; this can only be defensible if you think it is important specifically to have &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a gate $H$ transforming between the standard basis and the very specific basis of $\lvert + \rangle, \lvert - \rangle$;&lt;/li&gt;&#xA;&lt;li&gt;if you care specifically about $H$ having order $2$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You might protest and say that it is very natural to consider toggling between the 'bit' and 'phase' bases. But where did we get this notion of two specific bases for 'bit' and 'phase', anyway? The only reason why we single out $\lvert + \rangle, \lvert - \rangle$ as 'the' phase basis, as opposed for instance to $\lvert +i \rangle, \lvert -i \rangle$, is because it can be expressed with only real coefficients in the standard basis. As for preferring an operator with order $2$, to mesh with the notion of toggling, this seems to indicate a particular preference for considering things by 'flips' rather than reversible changes of basis. These priorities smack of the interests of computer science.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike the case between $\lvert \Phi^+ \rangle$ versus $\lvert \Psi^- \rangle$, the computer scientist does have one really good &lt;em&gt;high-level&lt;/em&gt; argument for preferring $H$ over $\sqrt Y$: the Hadamard gate is the unitary representation of the boolean Fourier transform (that is, it is the quantum Fourier transform on qubits). This is not very important from a physical perspective, but it is very helpful from a computational perspective, and a very large fraction of theoretical results in quantum computation and communication ultimately rest on this observation. But the boolean Fourier transform already bakes in the asymmetries of computer science, in pre-supposing the importance of the standard basis and in using only real coefficients: an operator such as $(X + Y)\big/\sqrt 2$ would never be considered on these grounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Diagonal argument&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're a computer scientist, once you have Hadamard and CNOT, all that's left is to get those pesky complex phases sorted as an afterthought. These phases are extremely important, of course. But just the way we talk about relative phases reveals a discomfort with the idea. Even describing the standard basis as the 'bit' basis, for storing information, puts a strong emphasis that whatever 'phase' is, it's not the usual way that you would consider storing information. Phases of all sorts are something to be dealt with &lt;em&gt;after&lt;/em&gt; the 'real' business of dealing with magnitudes of amplitudes; &lt;em&gt;after&lt;/em&gt; confronting the fact that one can store information in more than one basis. We barely talk at all about even purely imaginary relative phases if we can help it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can cope with relative phases pretty easily using diagonal operators. These have the advantage of being sparse (with respect to the standard basis...) and of &lt;em&gt;only&lt;/em&gt; affecting the relative phase, which is after all the detail which we're trying to address at this stage. Hence $T \propto \sqrt[4]Z$. And once you've done that, why do more? Sure, we could as easily consider arbitrary $X$ rotations (and because of Euler decomposition, we do play some lip-service to these operations) and arbitrary $Y$ rotations, which would motivate $\sqrt[4]X$ and $\sqrt[4]Y$. But these don't actually add anything of interest for the computer scientist, who considers the job done already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And not a moment too soon &amp;mdash; because computer scientists don't really care about precisely what the primitive operations being used are as soon as they can justify move on to something higher-level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think there is likely to be any very interesting physically-motivated reason why we use a particular gate-set. But it is certainly possible to explore the &lt;em&gt;psychologically-motivated&lt;/em&gt; reasons why we do. The above is a speculation in this direction, informed by long experience.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-04-04T17:39:15.527" LastActivityDate="2018-04-04T17:39:15.527" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1588" PostTypeId="1" AcceptedAnswerId="1589" CreationDate="2018-04-04T10:49:17.640" Score="14" ViewCount="1349" Body="&lt;p&gt;Consider the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1348/144&quot;&gt;unitary circuit&lt;/a&gt; model of quantum computation. If we need to generate entanglement between the input qubits with the circuit, it must have multi-qubit gates such as CNOT, as &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.53.2046&quot; rel=&quot;noreferrer&quot;&gt;entanglement cannot increase under local operations and classical communication&lt;/a&gt;. Consequently, we can say that quantum computing with multi-qubit gates is inherently different from quantum computing with just local gates. But what about measurements?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does including simultaneous measurements of multiple qubits make a difference in quantum computing or can we perhaps emulate this with local measurements with some overhead? &lt;strong&gt;EDIT:&lt;/strong&gt; &lt;em&gt;by &quot;emulate with local measurements&quot;, I mean have the same effect with local measurements + any unitary gates.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please notice that I am not merely asking how measuring one qubit changes the others, which has already been &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1206/how-does-measurement-of-one-qubit-affect-the-others&quot;&gt;asked and answered&lt;/a&gt;, or if such measurements are possible. I am interested to know whether including such measurements could bring something new to the table.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="26" LastEditDate="2018-12-23T12:17:42.403" LastActivityDate="2018-12-23T12:17:42.403" Title="Do multi-qubit measurements make a difference in quantum circuits?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1589" PostTypeId="2" ParentId="1588" CreationDate="2018-04-04T11:09:31.463" Score="13" Body="&lt;p&gt;Entangling measurements are powerful. In fact, they are so powerful that universal quantum computation can be performed by sequences of entangling measurements only (i.e., without extra need for unitary gates or special input state preparations):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Nielsen showed that universal quantum computation is possible given a quantum memory and the ability to perform projective measurements on up to 4-qubits [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0108020&quot; rel=&quot;noreferrer&quot;&gt;quant-ph/0310189&lt;/a&gt;].&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The above result was extended to 3-qubit measurements by Fenner and Zhang [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0111077&quot; rel=&quot;noreferrer&quot;&gt;quant-ph/0111077&lt;/a&gt;].&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Later on, Leung gave an improved method that requires only 2-qubit measurements, which are also both sufficient and necessary [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0310189&quot; rel=&quot;noreferrer&quot;&gt;quant-ph/0111122&lt;/a&gt;].&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The idea there is to combine sequences of measurements to drive the computation. This is quite similar to Raussendorf-Briegel's model of measurement based quantum computation (MBQC) (aka the &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;one way quantum computer&lt;/a&gt;), but in standard MBQC you also restrict your measurements to be non-entangling (i.e., they must act on single qubits) and you start with an entangled resource state as input (canonically, a cluster state&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.86.5188&quot; rel=&quot;noreferrer&quot;&gt; [Phys. Rev. Lett. 86, 5188&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301052&quot; rel=&quot;noreferrer&quot;&gt;quant-ph/0301052]&lt;/a&gt;). In the afore-mentioned protocols by Nielsen, Fenner-Zhang, Leung you are allowed to do entangling measurements but you do not rely on any other additional resource (i.e., no gates, no special inputs such as cluster states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In short, the difference between entangling and local measurements is analogous to the difference between entangling and local gates.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;PS: As discussed in other answers you can simulate entangling measurements with entangling gates (such as CNOTS and local measurements). Viceversa, the above results show you can trade entangling gates for entangling measurements. If your all of your resources are local you cannot use them to simulate entangling ones though. In particular, you cannot simulate entangling measurements with local gates and inputs.&lt;/p&gt;&#xA;" OwnerUserId="1779" LastEditorUserId="1779" LastEditDate="2018-04-05T06:24:32.673" LastActivityDate="2018-04-05T06:24:32.673" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1591" PostTypeId="2" ParentId="1441" CreationDate="2018-04-04T13:30:19.310" Score="15" Body="&lt;p&gt;Abel Molina, Thomas Vidick, and I proved that the correct answer is $c=3/4$ in this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A. Molina, T. Vidick, and J. Watrous. Optimal counterfeiting attacks&#xA;  and generalizations for Wiesner's quantum money. Proceedings of the&#xA;  7th Conference on Theory of Quantum Computation, Communication, and&#xA;  Cryptography, volume 7582 of Lecture Notes in Computer Science, pages&#xA;  45–64, 2013. (See also arXiv: 1202.4010.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This assumes the counterfeiter uses what we call a &quot;simple counterfeiting attack,&quot; which means a one-shot attempt to transform one copy of a money state into two. (I interpret your question to be about such attacks.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The attack of Brodutch, Nagaj, Sattath, and Unruh that @Rob referred to (and which is a fantastic result in my opinion) requires the counterfeiter to interact repeatedly with the bank and assumes the bank will provide the counterfeiter with the same money state after each verification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper describes the optimal channel, which is not an entanglement breaking (i.e., measure and prepare) channel. It's an example of a cloner, and explicitly it looks like this:&#xA;$$&#xA;\Phi(\rho) = A_0 \rho A_0^{\dagger} + A_1 \rho A_1^{\dagger}&#xA;$$&#xA;where&#xA;$$&#xA;A_0 = \frac{1}{\sqrt{12}}&#xA;\begin{pmatrix}&#xA;3 &amp;amp; 0\\&#xA;0 &amp;amp; 1\\&#xA;0 &amp;amp; 1\\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\quad\text{and}\quad&#xA;A_1 = \frac{1}{\sqrt{12}}&#xA;\begin{pmatrix}&#xA;0 &amp;amp; 1\\&#xA;1 &amp;amp; 0\\&#xA;1 &amp;amp; 0\\&#xA;0 &amp;amp; 3&#xA;\end{pmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For different sets of money states and figures of merit, you may end up with different optimal values and cloners. For example, if the money states also include $| 0\rangle \pm i |1\rangle$, then the Bužek-Hillery cloner is optimal and the correct value of $c$ drops to 2/3.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-04-04T13:30:19.310" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1592" PostTypeId="2" ParentId="1508" CreationDate="2018-04-04T14:43:33.397" Score="7" Body="&lt;p&gt;If we have a QTM with state set $Q$ and a tape alphabet $\Sigma = \{0,1\}$, we cannot say that the qubit being scanned by the tape head &quot;holds&quot; a vector $a|0\rangle + b|1\rangle$ or that the (internal) state is a vector with basis states corresponding to $Q$. The qubits on the tape can be correlated with one another and with the internal state, as well as with the tape head position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an analogy, we would not describe a probabilistic Turing machine's global state by independently specifying a distribution for the internal state and for each of the tape squares. Rather, we have to describe everything together so as to properly represent correlations among the different parts of the machine. For example, the bits stored in two distant tape squares might be perfectly correlated, both 0 with probability 1/2 and both 1 with probability 1/2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in the quantum case, and assuming we're talking about pure states of quantum Turing machines with unitary evolutions (as opposed to a more general model based on mixed states), the global state is represented by a vector whose entries are indexed by configurations (i.e., classical descriptions of the internal state, the location of the tape head, and the contents of every tape square) of the Turing machine. It should be noted that we generally assume that there is a special blank symbol in the tape alphabet (which could be 0 if we want our tape squares to store qubits) and that we start computations with at most finitely many squares being non-blank, so that the set of all reachable configurations is countable. This means that the state will be represented by a unit vector in a separable Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, and perhaps this is the actual answer to the question interpreted literally, the movement of the tape head is determined by the transition function, which will assign an &quot;amplitude&quot; to each possible action (new state, new symbol, and tape head movement) for every classical pair $(q,\sigma)$ representing the current state and currently scanned symbol. Nothing forces the tape head to move deterministically -- a nonzero amplitude could be assigned to two or more actions that include tape head movements to both the left and right -- so it is possible for a QTM tape head to move both left and right in superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you can imagine a QTM with $Q = \{0,1\}$ and $\Sigma = \{0,1\}$ (and we'll take 0 to be the blank symbol). We start in state 0 scanning a square that stores 1, and all other squares store 0. I won't explicitly write down the transition function, but will just describe the behavior in words. On each move, the contents of the scanned tape square is interpreted as a control bit for a Hadamard operation on the internal state. After the controlled-Hadamard is performed, the head moves left if the (new) state is 0 and moves right if the (new) state is 1. (In this example we never actually change the contents of the tape.) After one step, the QTM will be in an equally weighted superposition between being in state 0 with the tape head scanning square -1, and being in state 1 with the tape head scanning square +1. On all subsequent moves the controlled-Hadamard does nothing because every square aside from square 0 contains the 0 symbol. The tape head will therefore continue to move simultaneously both left and right, like a particle travelling to the left and to the right in superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted to, you could of course define a variant of the quantum Turing machine model for which the tape head location and movement is deterministic, and this would not ruin the computational universality of the model, but the &quot;classic&quot; definition of quantum Turing machines does not impose this restriction.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-04-04T14:43:33.397" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1593" PostTypeId="2" ParentId="1328" CreationDate="2018-04-04T18:26:40.737" Score="4" Body="&lt;p&gt;Your question asks two questions that are less-related than you might hope.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;, how do we increase the probability of down-conversion &lt;em&gt;occuring&lt;/em&gt;?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is fundamentally a question about material properties: the chance per unit length of down-conversion occurring is proportional to $\chi^{(2)}$; if our material of choice doesn't have good phase-matching conditions then we can &quot;cheat&quot; and use quasiphasematching at a hit of ~$2/\pi$.  As it happens, PPLN is just about as good as you're going to do, at least to within an order of magnitude.  A very long device, say with a waveguide, lets you get more unit lengths; things still scale linearly, so to get much higher conversion you'd need a much longer device, which brings its own problems (such as absorption). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is setting aside other options, such as spontaneous four-wave mixing and true single photon sources.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt;, you ask &quot;...and therefore entanglement between photons?&quot;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;em&gt;does not&lt;/em&gt; immediately follow from the first problem (increasing conversion from pump to daughter photons).   Depending on what kind of entanglement one is interested in, it's not at all the case that making more photons per (pulse/unit time) increases the entanglement of those photons.  Generally speaking, SPDC sources for (discrete-variable) optical quantum computing are limited by the multi-fold emission rate, not by the pump power; this literally cannot be avoided by an SPDC scheme.  If you're looking at achievable squeezing for CV experiments that's another kettle of fish that I'm not an expert in; my understanding is that the limits in total squeezing at present are not due to limited $\chi^{(2)}$, but other noise.  (I may be mistaken on this count.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, this leads to people trying to make &lt;em&gt;un&lt;/em&gt;entangled photons pairs and heralding one of them to try and simulate a &quot;true&quot; single photon source; a multiplexing scheme using space, delay lines, or a memory can then be used to put your known-good photon in the mode of interest.  Once you have a device that can spit out a photon in a particular mode in a pure state, you're good to go.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, you're interested in large amounts of time-frequency entanglement, that too is not set by the conversion efficiency, but by the phase-matching conditions in the crystal: the opposite problem from the papers posted by glS.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To conclude&lt;/strong&gt;, while there are reasons to want to increase conversion efficiency (for one thing it seems awfully wasteful to have conversion efficiencies as low as we do), it's not immediately obvious that doing so is a rate-limiting step in most experiments at present.  It's unfortunately also not at all clear how to do so in a more than marginal way; leading to people working on related problems such as increasing heralding efficiency and purity of the single-photon states instead.  &lt;/p&gt;&#xA;" OwnerUserId="1807" LastActivityDate="2018-04-04T18:26:40.737" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1594" PostTypeId="2" ParentId="1584" CreationDate="2018-04-04T18:53:50.707" Score="23" Body="&lt;p&gt;&lt;strong&gt;On computational helpfulness in general&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without perhaps realising it, you are asking a version of one of the most difficult questions you can possibly ask about theoretical computer science. You can ask the same question about classical computers, only instead of asking whether adding 'quantumness' is helpful, you can ask:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Is there a concise statement about where &lt;em&gt;randomised&lt;/em&gt; algorithms can help?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible to say something very vague here &amp;mdash; if you think that solutions are plentiful (or that the number of solutions to some &lt;em&gt;sub-problem&lt;/em&gt; are plentiful) but that it might be difficult to systematically construct one, then it's helpful to be able to make choices at random in order to get past the problem of systematic construction. But beware, sometimes the reason &lt;em&gt;why&lt;/em&gt; you know that there are plentiful solutions to a sub-problem is because there is a proof using &lt;em&gt;the probabilistic method&lt;/em&gt;. When this is the case, you know that the number of solutions is plentiful by reduction to what is in effect a helpful randomised algorithm!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you have another way of justifying the fact that the number of solutions is plentiful for those cases, there is no simple description of when a randomised algorithm can help. And if you have high enough demands of 'helpfulness' (a super-polynomial advantage), then what you are asking is whether $\mathsf P \ne \mathsf{BPP}$, which is an unsolved problem in complexity theory.  &lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Is there a concise statement about where &lt;em&gt;parallelised&lt;/em&gt; algorithms can help?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here things may be slightly better. If a problem looks as though it can be broken down into many independent sub-problems, then it can be parallelised &amp;mdash; though this is a vague, &quot;you'll know it when you see it&quot; sort of criterion. The main question is, &lt;em&gt;will&lt;/em&gt; you know it when you see it? Would you have guessed that testing feasibility of systems of linear equations over the rationals is not only parallelisable, but could be solved using $O(\log^2 n)$-depth circuits [c.f.&amp;nbsp;&lt;a href=&quot;https://link.springer.com/content/pdf/10.1007%2Fs000370050023.pdf&quot; rel=&quot;noreferrer&quot;&gt;Comput. Complex.&amp;nbsp;&lt;strong&gt;8&lt;/strong&gt; (pp.&amp;thinsp;99--126), 1999&lt;/a&gt;]?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way in which people try to paint a big-picture intuition for this is to approach the question from the opposite direction, and say when it is known that a parallelised algorithm &lt;em&gt;won't&lt;/em&gt; help. Specifically, it won't help if the problem has an inherently sequential aspect to it. But this is circular, because 'sequential' just means that the structure that you can see for the problem is one which is not parallelised. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, there is no simple, comprehensive description of when a parallelised algorithm can help. And if you have high enough demands of 'helpfulness' (a poly-logarithmic upper bound on the amount of time, assuming polynomial parallelisation), then what you are asking is whether &lt;a href=&quot;https://en.wikipedia.org/wiki/NC_(complexity)#Open_problem:_Is_NC_proper?&quot; rel=&quot;noreferrer&quot;&gt;$\mathsf P \ne \mathsf{NC}$&lt;/a&gt;, which is again an unsolved problem in complexity theory.  &lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The prospects for &quot;concise and correct descriptions of when [X] is helpful&quot; are not looking too great by this point. Though you might protest that we're being too strict here: on the grounds of demanding more than a polynomial advantage, we couldn't even claim that non-deterministic Turing machines were 'helpful' (which is clearly absurd). We shouldn't demand such a high bar &amp;mdash; in the absence of techniques to efficiently solve satisfiability, we should at least accept that &lt;em&gt;if&lt;/em&gt; we somehow could obtain a non-deterministic Turing machine, we would indeed find it &lt;em&gt;very very helpful&lt;/em&gt;. But this is different from being able to characterise &lt;em&gt;precisely which problems&lt;/em&gt; we would find it helpful for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On the helpfulness of quantum computers&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking a step back, is there &lt;em&gt;anything&lt;/em&gt; we can say about where quantum computers are helpful?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can say this: a quantum computer can only do something interesting if it is taking advantage of the structure of a problem, which is unavailable to a classical computer. (This is hinted at by the remarks about a &quot;global property&quot; of a problem, as you mention). But we can say more than this: problems solved by quantum computers in the unitary circuit model will instantiate some features of that problem &lt;em&gt;as unitary operators&lt;/em&gt;. The features of the problem which are unavailable to classical computers will be all those which do not have a (provably) statistically significant relationship to the standard basis.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the case of Shor's algorithm, this property is the eigenvalues of a permutation operator which is defined in terms of multiplication over a ring.&lt;/li&gt;&#xA;&lt;li&gt;In the case of Grover's algorithm, this property is whether the reflection about the set of marked states, commutes with the reflection about the uniform superposition &amp;mdash; this determines whether the Grover iterator has any eigenvalues which are not $\pm 1$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is not especially surprising to see that in both cases, the information relates to eigenvalues and eigenvectors. This is an&#xA;   excellent example of a property of an operator which need not have&#xA;   any meaningful relationship to the standard basis. But there is no particular reason why the information has to be an eigenvalue. All that is needed is to be able to describe a unitary operator, encoding some relevant feature of the problem which is not obvious from inspection of the standard basis, but &lt;em&gt;is&lt;/em&gt; accessible in some other easily described way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, all this says is that a quantum computer is useful when you can find a quantum algorithm to solve a problem. But at least it's a broad outline of a strategy for finding quantum algorithms, which is no worse than the broad outlines of strategies I've described above for randomised or parallelised algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Remarks on when a quantum computer is 'helpful'&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As other people have noted here, &quot;where quantum computing can help&quot; depends on what you mean by 'help'.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Shor's algorithm is often trotted out in such discussions, and once in a while people will point out that we don't know that factorisation &lt;em&gt;isn't&lt;/em&gt; solvable in polynomial-time. So do we actually know that &quot;quantum computing would be helpful for factorising numbers&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside from the difficulty in realising quantum computers, I think&#xA;here the reasonable answer is 'yes'; not because we know that you can't factorise efficiently using conventional computers, but because &lt;em&gt;we don't know how&lt;/em&gt; you would do it using conventional computers. If quantum computers help you to do something that you have no better approach to doing, it seems to me that this is 'helping'.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You mention Grover's algorithm, which yields a well-known square-root speedup over brute-force search.&#xA;This is only a polynomial speedup, and a speedup over a naive classical algorithm &amp;mdash; we have better classical algorithms than brute-force search, even for &lt;strong&gt;NP&lt;/strong&gt;-compelete problems. For instance, in the case of 3-SAT instances with a single satisfying assignment, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_satisfiability_problem#Algorithms_for_solving_SAT&quot; rel=&quot;noreferrer&quot;&gt;PPSZ algorithm&lt;/a&gt; has a runtime of $O(2^{0.386\,n})$, which outperforms Grover's original algorithm. So is Grover's algorithm 'helpful'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps Grover's algorithm &lt;em&gt;as such&lt;/em&gt; is not especially helpful. However, it may be helpful if you use it to elaborate more clever classical strategies beyond brute-force search: using &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;noreferrer&quot;&gt;amplitude amplification&lt;/a&gt;, the natural generalisation of Grover's algorithm to more general settings, we can improve on the performance of many non-trivial algorithms for SAT (see e.g. [ACM SIGACT News&amp;nbsp;&lt;strong&gt;36&lt;/strong&gt; (pp.103--108), 2005 &amp;mdash; &lt;a href=&quot;https://digitalcommons.utep.edu/cgi/viewcontent.cgi?article=1256&amp;amp;context=cs_techrep&quot; rel=&quot;noreferrer&quot;&gt;free PDF link&lt;/a&gt;]; hat tip to Martin Schwarz who pointed me to this reference in the comments).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with Grover's algorithm, amplitude amplification only yields polynomial speed-ups: but speaking practically, even a polynomial speedup may be interesting if it isn't washed out by the overhead associated with protecting quantum information from noise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-04-05T08:43:47.650" LastActivityDate="2018-04-05T08:43:47.650" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1595" PostTypeId="1" AcceptedAnswerId="1596" CreationDate="2018-04-04T19:18:22.410" Score="24" ViewCount="1450" Body="&lt;p&gt;Many people are interested in the subject of quantum annealing, as an application of quantum technologies, not least because of D-WAVE's work on the subject. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia article on quantum annealing&lt;/a&gt; implies that if one performs the 'annealing' slowly enough, one realises (a specific form of) adiabatic quantum computation. Quantum annealing seems to differ mostly in that it does not seem to presuppose doing evolution in the adiabatic regime &amp;mdash; it allows for the possibility of diabatic transitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, there seems to be more intuition at play with quantum annealing than just &quot;adiabatic computation done hastily&quot;. It seems that one specifically chooses an initial Hamiltonian consisting of a transverse field, and that this is specifically meant to allow for tunnelling effects in the energy landscape (as described in the standard basis, one presumes). This is said to be analogous to (possibly even to formally generalise?) the temperature in classical simulated annealing. This raises the question of whether quantum annealing pre-supposes features such as specifically an initial transverse field, linear interpolation between Hamiltonians, and so forth; and whether these conditions may be fixed in order to be able to make precise comparisons with classical annealing.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a more-or-less formal notion of what quantum annealing consists of, which would allow one to point to something and say &quot;this is quantum annealing&quot; or &quot;this is not precisely quantum annealing because [it involves some additional feature or lacks some essential feature]&quot;?&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alternatively: can quantum annealing be described in reference to some canonical&#xA;framework &amp;mdash; possibly in reference to one of the originating&#xA;papers, such as &lt;a href=&quot;https://journals.aps.org/pre/abstract/10.1103/PhysRevE.58.5355&quot; rel=&quot;noreferrer&quot;&gt;Phys. Rev.&amp;nbsp;E&amp;nbsp;58 (5355),&#xA;1998&lt;/a&gt;&#xA;[&lt;a href=&quot;http://www.stat.phys.titech.ac.jp/~nishimori/papers/98PRE5355.pdf&quot; rel=&quot;noreferrer&quot;&gt;freely available PDF&#xA;here&lt;/a&gt;]&#xA;&amp;mdash; together with some typical variations which are accepted as&#xA;also being examples of quantum annealing?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there at least a description which is precise enough that we can say that quantum annealing properly generalises classical simulated annealing, not by &quot;working better in practise&quot;, or &quot;working better under conditions X, Y, and Z&quot;, but in the specific sense in that any classical simulated annealing procedure can be efficiently simulated or provably surpassed by a noiseless quantum annealing procedure (just as unitary circuits can simulate randomised algorithms)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-04-05T09:35:33.340" LastActivityDate="2019-05-13T21:34:14.800" Title="What precisely is quantum annealing?" Tags="&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1596" PostTypeId="2" ParentId="1595" CreationDate="2018-04-04T20:20:21.457" Score="9" Body="&lt;p&gt;I'll do my best to address your three points.&lt;/p&gt;&#xA;&lt;p&gt;My previous answer to an earlier question about the difference between quantum annealing and adiabatic quantum computation can be found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1578/54&quot;&gt;here&lt;/a&gt;. I'm in agreement with Lidar that quantum annealing can't be defined without considerations of algorithms and hardware.&lt;/p&gt;&#xA;&lt;p&gt;That being said, the canonical framework for quantum annealing and the inspiration for the D-Wave is the work by Farhi et al. (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0001106&quot; rel=&quot;nofollow noreferrer&quot;&gt;quant-ph/0001106&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Finally, I'm not sure one can generalize classical simulated annealing using quantum annealing, again without discussing hardware. Here's a thorough comparison: &lt;a href=&quot;https://arxiv.org/abs/1304.4595&quot; rel=&quot;nofollow noreferrer&quot;&gt;1304.4595&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Addressing comments:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(1) I saw your previous answer, but don't get the point you make here. It's fine for QA not to be universal, and not to have a provable performance to solve a problem, and for these to be motivated by hardware constraints; but surely quantum annealing is something independent of specific hardware or instances, or else it doesn't make sense to give it a name.&lt;/p&gt;&#xA;&lt;p&gt;(2) You're linking the AQC paper, together with the excerpt by Vinci and Lidar, strongly suggests that QA is just adiabatic-ish evolution in the not-necessarily-adiabatic regime. Is that essentially correct? Is this true regardless of what the initial and final Hamiltonians are, or what path you trace through Hamiltonian-space, or the parameterisation with respect to time? If there are any extra constraints beyond &amp;quot;possibly somewhat rushed adiabatic-ish computation&amp;quot;, what are those constraints, and why are they considered important to the model?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;(1+2) Similar to AQC, QA reduces the transverse magnetic field of a Hamiltonian, however, the process is no longer adiabatic and dependent on the qubits and noise levels of the machine. The initial Hamiltonians are called gauges in D-Wave's vernacular and can be simple or complicated as long as you know the ground state. As for the 'parameterization with respect to time,' I think you mean the annealing schedule and as stated above this is restricted hardware constraints.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(3) I also don't see why hardware is necessary to describe the comparison with classical simulated annealing. Feel free to assume that you have perfect hardware with arbitrary connectivity: define quantum annealing as you imagine a mathematician might define annealing, free of niggling details; and consider particular realisations of quantum annealing as attempts to approximate the conditions of that pure model, but involving the compromises an engineer is forced to make on account of having to deal with the real world. Is it not possible to make a comparison?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;The only relation classical simulated annealing has with quantum annealing is they both have annealing in the name.&lt;/strong&gt;&#xA;The Hamiltonians and process are fundamentally different.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\rm{classical}} = \sum_{i,j} J_{ij} s_i s_j$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\rm{quantum}} = A(t) \sum_{i,j} J_{ij} \sigma_i^z \sigma_j^z + B(t) \sum_i \sigma_i^x$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, if you would like to compare simulated quantum annealing with quantum annealing, Troyer's group at ETH are the pros when it comes to simulated quantum annealing. I highly recommend these slides largely based on the Boxio et al. paper I linked above.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.isi.edu/sites/default/files/top_level/events/aqc2014/day2-talk5-Troyer.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Performance of simulated annealing, simulated quantum annealing and D-Wave on hard spin glass instances — Troyer (PDF)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(4) Your remark about the initial Hamiltonian is useful and suggests something very general lurking in the background. Perhaps arbitrary (but efficiently computable, monotone, and first differentiable) schedules are also acceptable in principle, with limitations only arising from architectural constraints, and of course also the aim to obtain a useful outcome?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'm not sure what you're asking. Are arbitrary schedules useful? I'm not familiar with work on arbitrary annealing schedules. In principle, the field should go from high to low, slow enough to avoid a Landau-Zener transition and fast enough to maintain the quantum effects of qubits.&lt;/p&gt;&#xA;&lt;p&gt;Related; The latest iteration of the D-Wave can anneal individual qubits at different rates but I'm not aware of any D-Wave unaffiliated studies where this has been implemented.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dwavesys.com/sites/default/files/14-1002A_B_tr_Boosting_integer_factorization_via_quantum_annealing_offsets.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;DWave — Boosting integer factoring perfomance via quantum annealing offsets (PDF)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(5) Perhaps there is less of a difference between the Hamiltonians in QA and CSA than you suggest. &lt;span class=&quot;math-container&quot;&gt;$H_{cl}$&lt;/span&gt; is clearly obtained from &lt;span class=&quot;math-container&quot;&gt;$H_{qm}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$A(t)=1,B(t)=0$&lt;/span&gt; if you impose a restriction to standard basis states (which may be benign if &lt;span class=&quot;math-container&quot;&gt;$H_{qm}$&lt;/span&gt; is non-degenerate and diagonal). There's clearly a difference in 'transitions', where QA seems to rely on suggestive intuitions of tunnelling/quasiadiabaticity, but perhaps this can be (or already has been?) made precise by a theoretical comparison of QA to a quantum walk. Is there no work in this direction?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A(t)=1,B(t)=0$&lt;/span&gt; With this schedule you're no longer annealing anything. The machine is just sitting there at a finite temperature so the only transitions you'll get are thermal ones. This can be slightly useful as shown by Nishimura et al. The following publication talks about the uses of a non-vanishing transverse field.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1605.03303&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1605.03303&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1708.00236&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1708.00236&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Regarding the relation of quantum annealing with quantum walks. It's possible to treat quantum annealing in this way as shown by Chancellor.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1606.06800&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1606.06800&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(6) One respect in which I suppose the hardware may play an important role --- but which you have not explicitly mentioned yet --- is the role of dissipation to a bath, which I now vaguely remember being relevant to DWAVE. Quoting from Boixo et al.: &amp;quot;Unlike adiabatic quantum computing [...] quantum annealing is a positive temperature method involving an open quantum system coupled to a thermal bath.&amp;quot; Clearly, what bath coupling one expects in a given system is hardware dependent; but is there no notion of what bath couplings are reasonable to consider for hypothetical annealers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I don't know enough about the hardware aspects to answer this, but if I had to guess, the lower temperature the better to avoid all the noise-related problems.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You say &amp;quot;In principle the field should go from high to low, slow enough to avoid a Landau-Zener transition and fast enough to maintain the quantum effects of qubits.&amp;quot; This is the helpful thing to do, but you usually don't know just how slow that can or should be, do you?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This would be the coherence time of the qubits. The D-Wave annealing schedules are on the order of microseconds with T2 for superconducting qubits being around 100 microseconds. If I had to give a definitive definition of annealing schedule it would be 'an evolution of the transverse field within a length of time less than the decoherence time of the qubit implementation.' This allows for different starting strengths, pauses, and readouts of field strengths. It need not be monotonic.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I thought maybe dissipation to a bath was sometimes considered helpful to how quantum annealers work, when operating in the non-adiabatic regime (as it often will be when working on NP-hard problems, because we're interested in obtaining answers to problems despite the eigenvalue gap possibly being very small). Is dissipation not potentially helpful then?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I consulted with S. Mandra and while he pointed me to a few papers by P. Love and M. Amin, which show that certain baths can speedup quantum annealing and thermalization can help find the ground state faster.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0609332&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:cond-mat/0609332&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I think that maybe if we can get the confusion about the annealing schedules, and whether or not it the transition has to be along a liner interpolation between two Hamiltonians (as opposed to a more complicated trajectory), ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B(t)$&lt;/span&gt; don't necessarily have to be linear or even monotonic. In a recent presentation D-Wave showed the advantages of pausing the annealing schedule and backwards anneals.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dwavesys.com/sites/default/files/mwj_dwave_qubits2018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;DWave — Future Hardware Directions of Quantum Annealing (PDF)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Feel free to condense these responses however you'd like. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-13T21:34:14.800" CommentCount="22" ContentLicense="CC BY-SA 4.0" />
  <row Id="1598" PostTypeId="1" AcceptedAnswerId="1617" CreationDate="2018-04-05T01:34:23.260" Score="11" ViewCount="230" Body="&lt;p&gt;As the name already suggests, this question is a follow-up of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1584/1346&quot;&gt;this other&lt;/a&gt;. I was delighted with the quality of the answers, but I felt it would be immensely interesting if insights regarding optimization and approximation techniques were added, but might fall off-topic, hence this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Blue's answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the rule of thumb in complexity theory is that if a quantum computer &quot;can help&quot; in terms of solving in polynomial time (with an error bound) iff the class of problem it can solve lies in BQP but not in P or BPP&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How does this apply to approximation classes? Is there any specific topological, numerical, etc property of quantum computing that can be leveraged?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As an example of what could I be asking (but definitely not restricted to that!), take the &lt;a href=&quot;https://en.wikipedia.org/wiki/Christofides_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Christofides algorithm&lt;/a&gt;: it exploits specific geometrical properties of the graph that it optimizes on (symmetry, triangle inequality): the salesman travels on a feasible world. But salesmen have also huge mass, and we can know their position and momentum at the same time with great precision. Maybe a quantum model could work as well for other kind of metrics with more relaxed restrictions, like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence#Relation_to_metrics&quot; rel=&quot;nofollow noreferrer&quot;&gt;K-L divergence&lt;/a&gt;? In that case solving it would still be NP complete, but the optimization would apply for a broader topology. This example is maybe a long shot, but I hope you get what I mean. I don't really know if it makes sense at all, but the answer could also address it in that case :)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;RELATED:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/126/1346&quot;&gt;Level of advantage provided by annealing for traveling salesman&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="26" LastEditDate="2018-12-14T06:09:02.293" LastActivityDate="2018-12-14T06:09:02.293" Title="Is there any general statement about what kinds of problems can be approximated more efficiently using a quantum computer?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1599" PostTypeId="2" ParentId="1588" CreationDate="2018-04-05T05:31:04.843" Score="4" Body="&lt;p&gt;While multi-qubit measurements can be incredibly powerful, as already described elsewhere, they do not give you anything new compared to unitary operations and local measurements. Think of a projective measurement for example, with projectors $P_m$. If you write down the observable $O=\sum_m P_m$, then there will be a unitary $U$ that diagonalises $O$. So, measuring $O$ is equivalent to implementing the unitary $U$ with a normal quantum circuit (including multi-qubit gates), and then performing local measurements in the standard basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, this gives you some insight about multi-qubit measurements. Any unitary circuit followed by projective measurements could be wrapped up as a single multi-qubit measurement by inverting the above process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar construction can be applied to more general measurements, but you have to extend the unitary operation to include some ancilla qubits. This is sometimes referred to as “the church of the larger Hilbert space”. There's a proof that unitaries + projective measurements are equivalent to generalised measurements in section 2.2.8 of Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-05T06:23:08.683" LastActivityDate="2018-04-05T06:23:08.683" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1600" PostTypeId="2" ParentId="1531" CreationDate="2018-04-05T06:39:29.357" Score="5" Body="&lt;p&gt;There is the concept of controllability of a quantum system, i.e. do the given set of controls permit you to create any state or unitary? Usually this is computed by looking at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_algebra&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lie Algebra&lt;/a&gt; of the system, and can be quite messy; you need to take the individual Hamiltonian terms that you can control, and calculate all their commutators to arbitrary orders. If you can take linear combinations of those and make any arbitrary Hamiltonian, then your full Hilbert space is controllable; you can make any unitary you want, and any quantum state is said to be reachable from any other. See &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.63.063410&quot; rel=&quot;nofollow noreferrer&quot;&gt;Complete controllability of quantum systems (PRA 2001)&lt;/a&gt; for an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One important point to emphasise, however, is that this tells you nothing about efficiency, i.e. how long it takes you to reach a given state (as a function of the system size). There is an explicit construction that you can make based on the above decomposition in terms of commutators, but the time required scales exponentially in the order of the commutator required. Numerical techniques of control theory are methods that attempt to find the required control fields (as a function of time) in a more efficient manner, but (to my knowledge) rarely give you any guarantees. So, if you have fixed $\Theta$ and bounded $c_k(t)$, the controllability concept may not be sufficient.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1847" LastEditDate="2018-04-23T11:10:01.127" LastActivityDate="2018-04-23T11:10:01.127" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1602" PostTypeId="1" AcceptedAnswerId="1673" CreationDate="2018-04-05T07:54:31.160" Score="3" ViewCount="411" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1506.03815&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical Simulation of Quantum Error Correction in a Fibonacci Anyon Code&lt;/a&gt;, the authors state on page 2 in section I. Background, A. Topological model:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We consider a system supporting nonabelian &lt;strong&gt;Fibonacci anyon&lt;/strong&gt; excitations, denoted by &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;. Two such anyons can have total charge that is either &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$ \mathbb I$&lt;/span&gt; (vacuum), or any superposition of these, and so the fusion space in this case is 2-dimensional. We can represent basis states for this space using diagrams of definite total charge for the Wilson loops, and arbitrary states as linear combinations of these diagrams:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rR2hj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rR2hj.png&quot; alt=&quot;Definite total charge for the Wilson loops.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; anyons of type &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, the dimension of the fusion space grows asymptotically as &lt;span class=&quot;math-container&quot;&gt;$\varphi^n$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{1+\sqrt 5}{2}$&lt;/span&gt; is the &lt;strong&gt;golden ratio&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Observables associated with non-intersecting loops commute, and so a &lt;strong&gt;basis for the space&lt;/strong&gt; can be built from a maximal set of disjoint, nested loops.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Finally, in &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1104.5550&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coherence Frame, Entanglement Conservation, and Einselection&lt;/a&gt;&amp;quot; the authors state on page 3:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Preferred basis problem. From the method of CF, we discuss the preferred basis problem (PBP), which has been studied via the einselection approach [7, 8]. We will show, yet, the method of einselection is incomplete.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;This method is described via the Stern-Gerlach experiment, as shown in the Fig. 1 of Ref. &lt;a href=&quot;https://en.wikipedia.org/wiki/Four-valued_logic&quot; rel=&quot;nofollow noreferrer&quot;&gt;7&lt;/a&gt;. The system is represented by the spin states (up and down) along some directions. One atom is put near one channel to serve&#xA;as the apparatus to interact with the spin, causing entanglement. In this measurement, the PBP means that there is no physical difference between states&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We also demonstrated that the &lt;strong&gt;preferred basis&lt;/strong&gt; problem &lt;strong&gt;can be resolved more naturally&lt;/strong&gt; by the method of &lt;strong&gt;coherence frame&lt;/strong&gt; than the &lt;strong&gt;einselection method&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Are there different bases for each part of the model. &lt;strong&gt;Is there a preferred basis&lt;/strong&gt; for a &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Variations_of_the_qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qudit&lt;/a&gt; or does it depend upon the underlying technology used to implement the qudits. How is the basis integral to the control and measurement?&lt;/p&gt;&#xA;&lt;p&gt;&lt;sub&gt;Note: This may be related to, but is not a duplicate of: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1410/what-is-the-computational-basis&quot;&gt;What is meant by the term &amp;quot;computational basis&amp;quot;?&lt;/a&gt;, nor is one of the answers currently offered there an answer to this question.&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sup&gt;Initially, efforts where made to address some comments but this only succeeded in making the question longer and less clear, I've stripped it down but the edits can be reviewed by the curious in the edit history.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="10480" LastEditDate="2021-02-10T06:58:50.653" LastActivityDate="2021-02-10T06:58:50.653" Title="What is the most economical and preferred basis for the qudit?" Tags="&lt;architecture&gt;&lt;qudit&gt;&lt;topological-quantum-computing&gt;&lt;performance&gt;&lt;anyons&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1604" PostTypeId="2" ParentId="1602" CreationDate="2018-04-05T11:40:28.613" Score="4" Body="&lt;p&gt;You may be confusing two uses of the word &quot;base&quot;. One definition of &quot;base&quot; has to do with how many digits are used to represent a number. For example, base two uses the digits 0 and 1, and the number five is written as 101 in base two. But in quantum mechanics there is another use of the word &quot;base&quot; which has to do with &lt;strong&gt;basis vectors&lt;/strong&gt; for a vector space. This is almost entirely unrelated to the &quot;base&quot; of a number system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that once you start talking about qubits versus qudits there is further confusion. Perhaps you could try thinking of a qubit as a two dimensional space, and the &lt;strong&gt;basis within&lt;/strong&gt; that space as giving a preferred &quot;direction&quot;, or coordinate axes. Similarly, a qutrit is a three dimensional space, etc. (This is a geometric intuition that might help you get started with thinking about quantum states, it needs some more work before it is precise.)&lt;/p&gt;&#xA;" OwnerUserId="263" LastActivityDate="2018-04-05T11:40:28.613" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1605" PostTypeId="5" CreationDate="2018-04-05T12:08:49.453" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-05T12:08:49.453" LastActivityDate="2018-04-05T12:08:49.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1606" PostTypeId="4" CreationDate="2018-04-05T12:08:49.453" Score="0" Body="For questions about the usage of, origin of or reasons for specific notation used in the context of quantum computing." OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-05T13:30:16.217" LastActivityDate="2018-04-05T13:30:16.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1607" PostTypeId="5" CreationDate="2018-04-05T12:49:37.600" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-05T12:49:37.600" LastActivityDate="2018-04-05T12:49:37.600" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1608" PostTypeId="4" CreationDate="2018-04-05T12:49:37.600" Score="0" Body="NOTE: We are currently in the middle of removing this tag, so please don't use it! For questions about the quantum analogues of concepts in information theory, please use the information-theory tag." OwnerUserId="253" LastEditorUserId="23" LastEditDate="2020-09-10T15:35:12.533" LastActivityDate="2020-09-10T15:35:12.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1609" PostTypeId="1" AcceptedAnswerId="1610" CreationDate="2018-04-05T13:04:02.313" Score="9" ViewCount="118" Body="&lt;p&gt;In the last decades, the field of &lt;em&gt;parameterised algorithms&lt;/em&gt;, with &lt;a href=&quot;https://en.wikipedia.org/wiki/Parameterized_complexity#FPT&quot; rel=&quot;noreferrer&quot;&gt;fixed parameter tractibility&lt;/a&gt; (FPT) as its main tool has been provided new methods to analyse old algorithms and design techniques for new algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea of parameterised algorithms is that we 'pick' another parameter of our input other than the size (such as treewidth) and design algorithms that are efficient under the assumption that the chosen parameter is a (small) constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if the analysis and design of quantum algorithms can benefit from this approach. Has this been done, or are there good reasons why this is likely ineffective or ignored so far? &lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="23" LastEditDate="2018-04-05T16:25:02.440" LastActivityDate="2018-04-05T16:25:02.440" Title="Can the analysis or design of quantum algorithms benefit from parameterised algorithmics?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1610" PostTypeId="2" ParentId="1609" CreationDate="2018-04-05T13:52:04.270" Score="5" Body="&lt;p&gt;Indeed, there are already parameterised quantum algorithms. I describe just two examples, one fairly famous and one fairly recent:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL subroutine for producing quantum states representing solutions to systems of equations&lt;/a&gt; and related algorithms depend on the sparseness of the matrix, but also the condition number &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; of the matrix, in the system of equations. The condition number in particular plays a prominent role in many analyses of this problem — the results are typically &lt;span class=&quot;math-container&quot;&gt;$O(\mathrm{poly}(\kappa) \log(N))$&lt;/span&gt; algorithms for matrices of size at most &lt;span class=&quot;math-container&quot;&gt;$N \times N$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;While it doesn't seem as though there is much scope for interesting&#xA;development on the dependency on &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt;, bear in mind that it is probably more informative to consider the &lt;em&gt;logarithm&lt;/em&gt; of the condition number as the more natural feature of the input. (It is easy to efficiently express matrices with exponentially large condition number.) If we write &lt;span class=&quot;math-container&quot;&gt;$\lambda = \log(\kappa)$&lt;/span&gt;, suddenly that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(\kappa) = 2^{O(\lambda)}$&lt;/span&gt; dependency seems more important. And there are other ways in which &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; seems the relevant thing to consider from a complexity-theoretic standpoint fixed-parameter complexity — for instance, if a quantum algorithm could be found with only &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(\lambda)$&lt;/span&gt; dependency, it would imply that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP = PSPACE}$&lt;/span&gt;. If we consider this to be unlikely in the same way that we consider &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P = NP}$&lt;/span&gt; to be unlikely, it seems that fixed-parameter tractability in terms of &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; fits in the same spirit as fixed-parameter tractability of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete problems.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There are also &lt;a href=&quot;https://arxiv.org/abs/1609.05537&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum algorithms for semidefinite programming&lt;/a&gt;, with complexity parameterised by the dimension of the input matrix, the row-sparsity of the input matrix, the number of constraints, and bounds on the size of primal and dual solutions.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As quantum computers will initially be much more expensive and less available than classical computers, and have a slower clock speed to boot, it makes a great deal of sense to look for parameterised quantum algorithms: ones which will prove effective for problems of interest, under conditions of interest, allowing us to pinpoint use-cases where quantum computers can be particularly effective.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-05T13:52:04.270" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1611" PostTypeId="2" ParentId="1353" CreationDate="2018-04-05T14:00:28.597" Score="3" Body="&lt;p&gt;I will attempt to address the following question only.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm asking whether the method of 'running' quantum algorithms on a 'quantum computer' 'simulated' on a classical computer would be able to outperform normal classical algorithms (preferably for problems that not obviously involve quantum simulation)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The closest thing to this that I am aware of are heuristic methods that employ &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;natural computing&lt;/a&gt;, in particular the ones that take inspiration from quantum physics for the development of novel problem-solving techniques. These are known as &lt;strong&gt;quantum inspired algorithms&lt;/strong&gt;. Please notice that: &lt;em&gt;i)&lt;/em&gt; I do not claim that such methods could be rigorously shown to be superior to conventional algorithms, but it seems that they can be at least competitive; &lt;em&gt;ii)&lt;/em&gt; the algorithms may or may not actually simulate a quantum computer, the faithfulness to the original source of inspiration varies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will briefly outline the framework of a particular type of a quantum-inspired evolutionary algorithm (QIEA). A more complete treatment may be found in chapter 24 of the book &quot;Natural computing algorithms&quot; by Anthony Brabazon et al [1]. Concrete examples can be found for example in arXiv. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic ingredients of a conventional &lt;a href=&quot;https://en.wikipedia.org/wiki/Evolutionary_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;evolutionary algorithm&lt;/a&gt; (EA) are a population of individuals $P(t)$, an update rule for the population, and a fitness function $f$. Here, each individual in $P(t)$ represents a possible solution to some problem, and $f$ quantifies how good the solution is. After initialization, for each step $t$ one evaluates $f$ on every individual in $P(t)$, records best ones and updates $P(t)$. This is iterated until a stopping criterion is reached, and the best found individual(s) are returned. In the simplest case, the update rule could be just random variation of individuals, but it can also be more complicated and engineered to introduce selection pressure towards better values of $f$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a QIEA, solutions are represented by bit strings of a fixed length, say, $m$. A quantum population $Q(t)$ is used, where each quantum individual consists of $m$ qubits. At each $t$, classical population $P(t)$ is determined from $Q(t)$ by &quot;measuring&quot; the qubits. $P(t)$ is ranked by $f$ and best results are recorded. $Q(t)$ is updated by acting on each qubit with a local gate, and iteration is continued. Often for $Q(0)$, all qubits are set to balanced superposition $(1/\sqrt{2},1/\sqrt{2})^T$, making each particular solution equally likely in the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the quantum individuals remain essentially in a product state of $m$ qubits, there is no entanglement involved at any point, making QIEA not very quantum. On the other hand, we can effectively simulate the evolution of $Q(t)$ and make as many measurements as we want without needing extra qubits. The claimed advantage is over conventional EAs, based on supposedly needing fewer individuals or being better at maintaining diversity as the population evolves, as even a fixed $Q(t)$ can lead to many $P(t)$. All in all, QIEA by its design is meant to be run only as a simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final remark, suppose that we wish to make QIEA more quantum without making it intractable. Can we? Perhaps. Consider the update rule of QIEA as a quantum circuit. It is rather boring, with a qubit register of size $m$ and a local gate acting once on each qubit. One could try to introduce some tractable quantumness to QIEA by taking the update circuit to be some Clifford quantum circuit, mentioned and outlined for example &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1203/144&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1183/144&quot;&gt;here&lt;/a&gt;. I do not know if this could offer any benefits at all, and as far as I know, this hasn't been tried.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] S. M. Anthony Brabazon, Michael O’Neill, Natural Computing Algorithms. Springer-Verlag Berlin&#xA;Heidelberg, 2015.&lt;/p&gt;&#xA;" OwnerUserId="144" LastActivityDate="2018-04-05T14:00:28.597" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1612" PostTypeId="1" CreationDate="2018-04-05T17:11:12.980" Score="7" ViewCount="120" Body="&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Empirical_algorithmics&quot; rel=&quot;noreferrer&quot;&gt;Empirical Algorithmics&lt;/a&gt;, researchers aim to understand the performance of algorithms through analyzing their empirical performance. This is quite common in machine learning and optimization. Right now, we would like to know something about the relative performance of quantum algorithms and their classical counterparts based on preliminary data from quantum computer emulators. My concern is that we might see encouraging empirical data that shows quantum computers with better scaling using simulators up to about 35 qubits, but then this advantage will disappear in the future once we have more data. What are the best practices for analyzing relative performance of classical and quantum algorithms in a robust way that gives insight about scaling? Or is this simply not yet possible? &lt;/p&gt;&#xA;" OwnerUserId="1658" LastEditorUserId="1658" LastEditDate="2018-04-05T23:46:29.407" LastActivityDate="2018-04-05T23:46:29.407" Title="Empirical Algorithmics for Near-Term Quantum Computing" Tags="&lt;speedup&gt;&lt;complexity-theory&gt;&lt;classical-computing&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1613" PostTypeId="1" AcceptedAnswerId="1619" CreationDate="2018-04-05T17:36:59.923" Score="19" ViewCount="3530" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1386/253&quot;&gt;this answer&lt;/a&gt;, Grover's algorithm is explained. The explanation indicates that the algorithm relies heavily on the &lt;em&gt;Grover Diffusion Operator&lt;/em&gt;, but does not give details on the inner workings of this operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Briefly, the Grover Diffusion Operator creates an 'inversion about the mean' to iteratively make the tiny differences in earlier steps large enough to be  measurable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The questions are now:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How does the Grover diffusion operator achieve this?&lt;/li&gt;&#xA;&lt;li&gt;Why is the resulting $O(\sqrt{n})$ in total time to search an unordered database optimal?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-06T15:27:23.217" LastActivityDate="2018-04-06T15:27:23.217" Title="How does the Grover diffusion operator work and why is it optimal?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1614" PostTypeId="2" ParentId="1613" CreationDate="2018-04-05T18:56:36.610" Score="4" Body="&lt;p&gt;One way of defining the diffusion operator is&lt;sup&gt;1&lt;/sup&gt; $D = -H^{\otimes n}U_0H^{\otimes n}$, where $U_0$ is the &lt;em&gt;phase oracle&lt;/em&gt; $$U_0\left|0^{\otimes n}\right&amp;gt; = -\left|0^{\otimes n}\right&amp;gt;,\,U_0\left|x\right&amp;gt; = \left|x\right&amp;gt;\,\text{for} \left|x\right&amp;gt;\neq\left|0^{\otimes n}\right&amp;gt;.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows that $U_0$ can also be written as $U_0 = I-2\left|0^{\otimes n}\rangle\langle0^{\otimes n}\right|$, giving $$D= 2\left|+\rangle\langle+\right| - I,$$ where $\left|+\right&amp;gt; = 2^{-n/2}\left(\left|0\right&amp;gt; + \left|1\right&amp;gt;\right)^{\otimes n}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing a state $\left|\psi\right&amp;gt; = \alpha\left|+\right&amp;gt; + \beta\left|+^\perp\right&amp;gt;$ where $\left|+^\perp\right&amp;gt;$ is orthogonal to $\left|+\right&amp;gt;$ (i.e. $\left&amp;lt;+^\perp\mid+\right&amp;gt; =0)$ gives that $D\left|\psi\right&amp;gt; = \alpha\left|+\right&amp;gt; - \beta\left|+^\perp\right&amp;gt;$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives&lt;sup&gt;2&lt;/sup&gt; that &lt;strong&gt;the diffusion operator is a reflection about $\left|+\right&amp;gt;$&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the other part of Grover's algorithm is &lt;em&gt;also&lt;/em&gt; a reflection, these combine to rotate the current state closer to the 'searched-for' value $x_0$. This angle decreases linearly with the number of rotations (until it overshoots the searched-for value), giving that the probability of correctly measuring the correct value increases quadratically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9701001&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bennet et. al.&lt;/a&gt; showed that this is optimal. By taking a classical solution to an NP-problem, Grover's algorithm can be used to quadratically speed this up. However, taking a language $\mathcal L_A = \left\lbrace y:\exists x\, A\left(x\right) = y\right\rbrace$ for a length preserving function $A$ (here, an oracle), any bounded-error oracle based quantum turing machine cannot accept this language in a time $T\left(n\right)=\mathcal o\left(2^{n/2}\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is achieved by taking a set of oracles where $\left|1\right&amp;gt;^{\otimes n}$ has no inverse (so is not contained in the language). However, this is contained in some new language $\mathcal L_{A_y}$ by definition. The difference in probabilities of a machine accepting $\mathcal L_A$ and a different machine accepting $\mathcal L_{A_y}$ in time $T\left(n\right)$ is then less than $1/3$ and so neither language is accepted and Grover's algorithm is indeed asymptotically optimal.&lt;sup&gt;3&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9711070v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zalka&lt;/a&gt; later showed that Grover's algorithm is &lt;em&gt;exactly&lt;/em&gt; optimal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 In Grover's algorithm, minus signs can be moved round, so where the minus sign is, is somewhat arbitrary and doesn't necessarily have to be in the definition of the diffusion operator&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 alternatively, defining the diffusion operator &lt;em&gt;without&lt;/em&gt; the minus sign gives a reflection about $\left|+^\perp\right&amp;gt;$&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;3 Defining the machine using the oracle $A$ as $M^A$ and the machine using oracle $A_y$ as $M^{A_y}$, this is a due to the fact that there is a set $S$ of bit strings, where the states of $M^A$ and $M^{A_y}$ at a time $t$ are $\epsilon$-close&lt;sup&gt;4&lt;/sup&gt;, with a cardinality $&amp;lt;2T^2/\epsilon^2$. Each oracle where $M^A$ correctly decides if $\left|1\right&amp;gt;^{\otimes n}$ is in $\mathcal L_A$ can be mapped to $2^n - \text{Card}\left(S\right)$ oracles where $M^A$ &lt;em&gt;fails&lt;/em&gt; to correctly decide if $\left|1\right&amp;gt;^{\otimes n}$ is in that oracle's language. However, it must give one of the other $2^n-1$ potential answers and so if $T\left(n\right)=\mathcal o\left(2^{n/2}\right)$, the machine is unable to determine membership of $\mathcal L_A$.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;4 Using the Euclidean distance, twice the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace distance&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-05T22:28:48.290" LastActivityDate="2018-04-05T22:28:48.290" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1617" PostTypeId="2" ParentId="1598" CreationDate="2018-04-06T00:10:07.927" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Approximate Optimization Algorithm&lt;/a&gt; is a good place to start for analyzing the relative performance of quantum algorithms on approximation problems. One result so far is that at p=1 QAOA can theoretically achieve an approximation ratio of 0.624 for MaxCut on 3-regular graphs. This result was obtained using brute force enumeration of the different possible cases. This is not a technique is which easily generalizable, so relatively little is known about the performance of QAOA on other problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it currently stands QAOA uses very little structure in the combinatorial optimization problem and operates more along the lines of a direct search method. One possible consequence is that QAOA would be best used for problems where there is minimal structure. In this case there is nothing that classical algorithms could use to accelerate the search process.&lt;/p&gt;&#xA;" OwnerUserId="1658" LastEditorUserId="1658" LastEditDate="2018-04-06T20:24:39.440" LastActivityDate="2018-04-06T20:24:39.440" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1619" PostTypeId="2" ParentId="1613" CreationDate="2018-04-06T07:28:12.270" Score="7" Body="&lt;p&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\braket}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}\newcommand{\proj}[1]{\left|#1\right&amp;gt;\left&amp;lt;#1\right|}$&#xA;Since the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1386/253&quot;&gt;original question&lt;/a&gt; was about a layman's description, I offer a slightly different solution which is perhaps easier to understand (background dependent), based on a continuous time evolution. (I make no pretense that it is suitable for a layman, however.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start from an initial state which is a uniform superposition of all states,&#xA;$$&#xA;\ket{\psi}=\frac{1}{\sqrt{2^n}}\sum_{y\in\{0,1\}^n}\ket{y}&#xA;$$&#xA;and we are aiming to find a state $\ket{x}$ that can be recognised as the correct answer (assuming there is exactly one such state, although this can be generalised). To do this, we evolve in time under the action of a Hamiltonian&#xA;$$&#xA;H=\proj{x}+\proj{\psi}.&#xA;$$&#xA;The really beautiful feature of Grover's search is that at this point, we can reduce the maths to a subspace of just two states $\{\ket{x},\ket{\psi}\}$, rather than requiring all $2^n$.  It's easier to describe if we make an orthonormal basis from these states, $\{\ket{x},\ket{\psi^\perp}\}$ where&#xA;$$&#xA;\ket{\psi^{\perp}}=\frac{1}{\sqrt{2^n-1}}\sum_{y\in\{0,1\}^n:y\neq x}\ket{y}.&#xA;$$&#xA;Using this basis, the time evolution $e^{-iHt}\ket{\psi}$ can be written as&#xA;$$&#xA;e^{-it\left(\mathbb{I}+2^{-n}Z+\frac{\sqrt{2^n-1}}{2^{n}}X\right)}\cdot\left(\begin{array}{c}\frac{1}{\sqrt{2^n}} \\ \sqrt{1-\frac{1}{2^n}} \end{array}\right),&#xA;$$&#xA;where $X$ and $Z$ are the standard Pauli matrices. This can be rewritten as&#xA;$$&#xA;e^{-it}\left(\mathbb{I}\cos\left(\frac{t}{2^{n/2}}\right)-i\frac{1}{2^{n/2}}\sin\left(\frac{t}{2^{n/2}}\right)\left(Z+X\sqrt{2^n-1}\right)\right)\left(\begin{array}{c}\frac{1}{\sqrt{2^n}} \\ \sqrt{1-\frac{1}{2^n}} \end{array}\right).&#xA;$$&#xA;So, if we evolve for a time $t=\frac{\pi}{2}2^{n/2}$, and ignoring global phases, the final state is&#xA;$$&#xA;\frac{1}{2^{n/2}}\left(Z+X\sqrt{2^n-1}\right)\left(\begin{array}{c}\frac{1}{\sqrt{2^n}} \\ \sqrt{1-\frac{1}{2^n}} \end{array}\right)=\left(\begin{array}{c}\frac{1}{2^n} \\ -\frac{\sqrt{2^n-1}}{2^n} \end{array}\right)+\left(\begin{array}{c} 1-\frac{1}{2^n} \\ \frac{\sqrt{2^n-1}}{2^n}\end{array}\right)=\left(\begin{array}{c} 1 \\ 0 \end{array}\right).&#xA;$$&#xA;In other words, with probability 1, we get the state $\ket{x}$ that we were searching for. The usual circuit-based description of Grover's search is really just this continuous time evolution broken into discrete steps, with the slight disadvantage that you usually can't get exactly probability 1 for your outcome, just very close to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat is the following: you could redefine $\tilde H=5H$, and evolve using $\tilde H$ and the evolution time would be 5 times shorter. If you wanted to be really radical, replace the 5 with $2^{n/2}$, and Grover's search runs in constant time! But you're not allowed to do this arbitrarily. Any given experiment would have a fixed maximum coupling strength (i.e. a fixed multiplier). So, different experiments have different running times, but their scaling is the same, $2^{n/2}$. It's just like saying that the gate cost in the circuit model is constant, rather than assuming that if we use a circuit of depth $k$ each gate can be made to run in time $1/k$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimality proof essentially involves showing that if you made detection of one possible marked state $\ket{x}$ any quicker, it would make detection of a different marked state, $\ket{y}$, slower. Since the algorithm should work equally well whichever state is marked, this solution is the best one.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-06T07:28:12.270" CommentCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1620" PostTypeId="1" AcceptedAnswerId="7094" CreationDate="2018-04-06T09:01:35.267" Score="22" ViewCount="1048" Body="&lt;p&gt;Lieb-Robinson bounds describe how effects are propagated through a system due to a local Hamiltonian. They are often described in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left|[A,B(t)]\right|\leq Ce^{vt-l},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are operators that are separated by a distance &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; on a lattice where the Hamiltonian has local (e.g. nearest neighbour) interactions on that lattice, bounded by some strength &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;. The &lt;a href=&quot;http://www.mathphys.org/AZschool/material/AZ09-nachtergaele-sims.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;proofs&lt;/a&gt; of the Lieb Robinson bound typically show the existence of a velocity &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; (that depends on &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;). This is often really useful for bounding properties in these systems. For example, there were some really nice results &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.97.050401&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; regarding how long it takes to generate a GHZ state using a nearest-neighbour Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem that I've had is that the proofs are sufficiently generic that it is difficult to get a tight value on what the velocity actually &lt;em&gt;is&lt;/em&gt; for any given system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be specific, imagine a one dimensional chain of qubits coupled by a Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{n=1}^N\frac{B_n}{2}Z_n+\sum_{n=1}^{N-1}\frac{J_n}{2}(X_nX_{n+1}+Y_nY_{n+1}), \tag{1}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$J_n\leq J$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$X_n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_n$&lt;/span&gt; represent a Pauli operator being applied to a given qubit &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; everywhere else. &lt;strong&gt;Can you give a good (i.e. as tight as possible) upper bound for the Lieb-Robinson velocity &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; for the system in Eq. (1)?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question can be asked under two different assumptions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;span class=&quot;math-container&quot;&gt;$J_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_n$&lt;/span&gt; are all fixed in time&lt;/li&gt;&#xA;&lt;li&gt;The &lt;span class=&quot;math-container&quot;&gt;$J_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_n$&lt;/span&gt; are allowed to vary in time.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The former is a stronger assumption which may make proofs easier, while the latter is usually included in the statement of Lieb-Robinson bounds.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Motivation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Quantum computation, and more generally quantum information, comes down to making interesting quantum states. Through works such as &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.97.050401&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, we see that information takes a certain amount of time to propagate from one place to another in a quantum system undergoing evolution due to a Hamiltonian such as in Eq. (1), and that quantum states, such as GHZ states, or states with a topological order, take a certain amount of time to produce. What the result currently shows is a scaling relation, e.g. the time required is &lt;span class=&quot;math-container&quot;&gt;$\Omega(N)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's say I come up with a scheme that does information transfer, or produces a GHZ state etc. in a way that scales linearly in &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. How good is that scheme actually? If I have an explicit velocity, I can see how closely matched the scaling coefficient is in my scheme compared to the lower bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I think that one day what I want to see is a protocol implemented in the lab, then I very much care about optimising these scaling coefficients, not just the broad scaling functionality, because the faster I can implement a protocol, the less chance there is for noise to come along and mess everything up.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Further Information&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}\newcommand{\proj}[1]{\left|#1\right&amp;gt;\left&amp;lt;#1\right|}$&lt;/span&gt;There are some nice features of this Hamiltonian which I assume make calculation easier. In particular, the Hamiltonian has a subspace structure based on the number of 1s in the standard basis (it is said to be excitation preserving) and, even better, the Jordan-Wigner transformation shows that all the properties of higher excitation subspaces can be derived from the 1-excitation subspace. This essentially means we only have to do the maths on an &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; instead of the full &lt;span class=&quot;math-container&quot;&gt;$2^N\times 2^N$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;h=\sum_{n=1}^NB_n\proj{n}+\sum_{n=1}^{N-1}J_n(\ket{n}\bra{n+1}+\ket{n+1}\bra{n}).&#xA;$$&lt;/span&gt;&#xA;There is some evidence that the Lieb-Robinson velocity is &lt;span class=&quot;math-container&quot;&gt;$v=2J$&lt;/span&gt;, such as &lt;a href=&quot;http://link.aps.org/doi/10.1103/PhysRevA.82.022318&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://file:///C:/Users/Alastair/Zotero/storage/QVRSWC5P/PhysRevA.85.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but these all use a close to uniformly coupled chain, which has a group velocity &lt;span class=&quot;math-container&quot;&gt;$2J$&lt;/span&gt; (and I assume the group velocity is closely connected to the Lieb-Robinson velocity). It doesn't prove that all possible choices of coupling strength have a velocity that is so bounded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can add a bit further to the motivation. Consider the time evolution of a single excitation starting at one end of the chain, &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;, and what its amplitude is for arriving at the other end of the chain &lt;span class=&quot;math-container&quot;&gt;$\ket{N}$&lt;/span&gt;, a short time &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; later. To first order in &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt;, this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bra{N}e^{-ih\delta t}\ket{1}=\frac{\delta t^{N-1}}{(N-1)!}\prod_{n=1}^{N-1}J_n+O(\delta t^{N}).&#xA;$$&lt;/span&gt;&#xA;You can see the exponential functionality that you would expect being outside the 'light cone' defined by a Lieb-Robinson system, but more importantly, if you wanted to maximise that amplitude, you'd set all the &lt;span class=&quot;math-container&quot;&gt;$J_n=J$&lt;/span&gt;. So, at short times, the uniformly coupled system leads to the most rapid transfer. Trying to push this further, you can ask, as a bit of a fudge, when can &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{t^{N-1}}{(N-1)!}\prod_{n=1}^{N-1}J_n\sim 1&#xA;$$&lt;/span&gt;&#xA;Taking the large &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; limit, and using Stirling's formula on the factorial leads to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{etJ}{N-1}\sim 1,&#xA;$$&lt;/span&gt;&#xA;which suggests a maximum velocity of about &lt;span class=&quot;math-container&quot;&gt;$eJ$&lt;/span&gt;. Close, but hardly rigorous (as the higher order terms are non-negligible)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}\newcommand{\proj}[1]{\left|#1\right&amp;gt;\left&amp;lt;#1\right|}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-06T07:58:27.777" LastActivityDate="2019-08-25T05:24:40.847" Title="Explicit Lieb-Robinson Velocity Bounds" Tags="&lt;simulation&gt;&lt;performance&gt;&lt;many-body-systems&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="1621" PostTypeId="1" AcceptedAnswerId="1623" CreationDate="2018-04-06T13:40:02.570" Score="21" ViewCount="2152" Body="&lt;p&gt;I see many papers (e.g. &lt;a href=&quot;https://arxiv.org/pdf/1307.0401.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum principal component analysis&lt;/a&gt;) in which the existence of qRAM is necessary. What's the actual purpose of qRAM in quantum algorithms?&lt;/p&gt;&#xA;" OwnerUserId="1850" LastEditorUserId="26" LastEditDate="2018-12-13T19:42:56.547" LastActivityDate="2018-12-13T19:42:56.547" Title="What is the purpose of a quantum RAM in quantum algorithms?" Tags="&lt;quantum-memory&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1622" PostTypeId="1" AcceptedAnswerId="1627" CreationDate="2018-04-06T16:35:16.583" Score="23" ViewCount="2041" Body="&lt;p&gt;&lt;a href=&quot;https://cs.stackexchange.com/a/90292/71105&quot;&gt;An answer to another question&lt;/a&gt; mentions that  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are &lt;a href=&quot;https://www.math.ucdavis.edu/~deloera/TEACHING/VIDEOS/Kalai-Lectures/hkD.pdf&quot; rel=&quot;noreferrer&quot;&gt;arguments&lt;/a&gt; that suggests that such machines [&quot;quantum Turing machines&quot;] cannot even be built...  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure I fully understand the problem, so perhaps I'm not asking the right question, but here's what I could gather.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The slides are &lt;a href=&quot;https://www.youtube.com/watch?v=YSpphjNm33g&quot; rel=&quot;noreferrer&quot;&gt;presented in a lecture (from 2013)&lt;/a&gt; by Professor Gil Kalai (Hebrew University of Jerusalem and Yale University). I watched most of the lecture, and it seems his claim is that there is a barrier to creating fault-tolerant quantum computers (FTCQ), and this barrier probably lies around creating logical qubits from physical components. (timestamp 26:20): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7vIPj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7vIPj.png&quot; alt=&quot;barrier between physical and logical qubits&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like the reason for such a barrier is due to the problem of noise and error-correction. And even though current research takes into account noise, it doesn't do so in the right manner (this is the part I don't understand).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know many people (e.g., Scott Aaronson) are skeptical of this claim of impossibility, but I'm just trying to better understand the argument: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the reason for suggesting that practical quantum computers cannot be built&lt;/strong&gt; (as presented by Professor Gil Kalai, and has anything changed since 2013)?  &lt;/p&gt;&#xA;" OwnerUserId="1869" LastActivityDate="2019-05-18T06:25:07.193" Title="What is the argument that practical quantum computers cannot be built?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1623" PostTypeId="2" ParentId="1621" CreationDate="2018-04-06T17:33:25.527" Score="9" Body="&lt;p&gt;This is discussed in chapter 5 of &lt;a href=&quot;http://rspa.royalsocietypublishing.org/content/474/2209/20170551#sec-6&quot; rel=&quot;noreferrer&quot;&gt;Ciliberto &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The purpose of most &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_machine_learning#Quantum-enhanced_machine_learning&quot; rel=&quot;noreferrer&quot;&gt;quantum(-enhanced) machine learning algorithms&lt;/a&gt; is to speed-up the processing of &lt;em&gt;classical&lt;/em&gt; data over what is possible with &lt;em&gt;classical&lt;/em&gt; machine learning algorithms.&#xA;In other words, the context is that you have a set of classical vectors $\{\boldsymbol x_k\}_k$, and you want to compute some function $\boldsymbol f(\boldsymbol x_k)$ of this data (which may then be used as an estimator of some property, or as a function characterising a classifier to be used for new data points, or something else).&#xA;Most quantum machine learning algorithms tell you that, provided you are able to efficiently perform the mapping &#xA;$$\{\boldsymbol x_k\}_k\mapsto\lvert \{\boldsymbol x_k\}\rangle= N\sum_{kj} x_{kj}\lvert k,j\rangle,$$&#xA;then it is sometimes possible to compute $\boldsymbol f(\{\boldsymbol x_k\})$ more efficiently.&#xA;It is, however, highly nontrivial how to perform such mapping &lt;em&gt;efficiently&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To maintain the potential exponential speed-ups of the quantum algorithms, this conversion needs to be efficient. If this is not the case, then one ends up in a situation in which the quantum algorithm can solve the problem very efficiently, but only after a lengthy preprocessing of the data has been performed, therefore killing the whole point of using the quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where QRAMs come into play. &#xA;A QRAM is a device that can (theoretically) encode $N$ $d$-dimensional classical vectors into (the amplitudes of) a quantum state of $\log(Nd)$ qubits, in time $\mathcal O(\log(Nd))$.&#xA;As discussed in &lt;a href=&quot;http://rspa.royalsocietypublishing.org/content/474/2209/20170551#sec-6&quot; rel=&quot;noreferrer&quot;&gt;Ciliberto &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt;, as well as in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1502/55&quot;&gt;this related answer&lt;/a&gt;, the actual feasibility of QRAMs is still not entirely clear, and many caveats remain.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-06-11T14:06:08.470" LastActivityDate="2018-06-11T14:06:08.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1625" PostTypeId="2" ParentId="1622" CreationDate="2018-04-06T20:56:40.533" Score="3" Body="&lt;p&gt;I can’t comment on the specifics of his arguments, because I don’t claim to understand them fully. But in general, we have to wonder whether quantum mechanics will continue to be valid for many qubit systems and states that are deep within the Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Physics is all about observing nature, building theories, confirming the theories, and then finding where they break down. Then the cycle begins again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have never had quantum systems as clean, well-controlled and large as current quantum processors. Devices capable of pulling off ‘supremacy’ are even further beyond our current experimental experience. So it is valid to wonder if this unprobed corner of QM might be where it all breaks down. Perhaps new ‘post-quantum’ effects will appear, that effectively act as uncorrectable forms of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, most of us don’t think it will. And we hope it won’t, or there will be no quantum computers. Nevertheless, we must be open to the possibility we are wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the minority who think quantum computing will fail should be open to the idea that they are wrong, too. Hopefully, they won’t turn out to be the new brand of ‘Bell violation deniers’.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-07-13T14:42:34.190" LastActivityDate="2018-07-13T14:42:34.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1626" PostTypeId="2" ParentId="1622" CreationDate="2018-04-06T22:53:08.397" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Q: &quot;What is the reason for suggesting that practical quantum computers cannot be built (&lt;strong&gt;as presented by Professor Gil Kalai&lt;/strong&gt;, and has anything changed since 2013)?&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In an interview titled &quot;&lt;a href=&quot;https://rjlipton.wordpress.com/2012/01/30/perpetual-motion-of-the-21st-century/&quot; rel=&quot;noreferrer&quot;&gt;Perpetual Motion of The 21st Century?&lt;/a&gt;&quot; Prof. Kalai states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;For quantum systems there are special obstacles, such as the inability to make exact copies of quantum states in general. Nevertheless, much of the theory of error-correction has been carried over, and the famous threshold theorem shows that fault-tolerant quantum computation (FTQC) is possible if certain conditions are met. The most-emphasized condition sets a threshold for the absolute rate of error, one still orders of magnitude more stringent than what current technology achieves but approachable. One issue raised here, however, is whether the errors have sufficient independence for these schemes to work or correlations limited to what they can handle.&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In an earlier paper of his titled &quot;&lt;a href=&quot;https://arxiv.org/abs/0904.3265&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computers: Noise Propagation and Adversarial Noise Models&lt;/a&gt;&quot; he states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Page 2:&lt;/strong&gt; &quot;The feasibility of computationally superior quantum computers is one of the most fascinating scientific problems of our time. The main concern regarding quantum-computer feasibility is that quantum systems are inherently noisy. The theory of quantum error correction and fault-tolerant quantum computation (FTQC) provides strong support for the possibility of building quantum computers. In this paper we will discuss adversarial noise models that may fail quantum computation. This paper presents a critique of quantum error correction and skepticism on the feasibility of quantum computers.&quot;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Page 19:&lt;/strong&gt; &quot;The main issue is therefore to understand and describe the fresh (or infinitesimal) noise operations. The adversarial models we consider here should be regarded as models for fresh noise. But the behavior of accumulative errors in quantum circuits that allow error propagation is sort of a “role model” for our models of fresh noise.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The common picture of FTQC asserts:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Fault tolerance will work if we are able to reduce the fresh gate/qubit&#xA;  errors to below a certain threshold. In this case error propagation will be suppressed.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;What we propose is:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Fault tolerance will not work because the overall error will behave like accumulated errors for standard error propagation (for circuits that allow error propagation), although not necessarily because of error propagation.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;Therefore, for an appropriate modeling of noisy quantum computers the fresh errors should behave like accumulated errors for standard error propagation (for circuits that allow error propagation).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(As a result, in the end we will not be able to avoid error propagation.)&quot;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Page 23:&lt;/strong&gt; &quot;Conjecture B: In any noisy quantum computer in a highly entangled state there will be a strong effect of error synchronization. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We should informally explain already at this point why these conjectures, if true, are damaging. We start with Conjecture B. The states of quantum computers that apply error-correcting codes needed for FTQC are highly entangled (by any formal definition of “high entanglement”). Conjecture B&#xA;  will imply that at every computer cycle there will be a small but substantial probability that the number of faulty qubits will be much larger than the threshold. This is in contrast to standard assumptions that the probability of the number of faulty qubits being much larger than the threshold decreases exponentially with the number of qubits. Having a small but substantial probability of a large number of qubits to be faulty is enough to fail the quantum error correction codes.&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See also his paper: &quot;&lt;a href=&quot;https://arxiv.org/abs/1106.0485&quot; rel=&quot;noreferrer&quot;&gt;How Quantum Computers Fail: Quantum Codes, Correlations in Physical Systems, and Noise Accumulation&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many people disagee, and much has changed, see this Wikipedia page: &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;noreferrer&quot;&gt;Quantum Threshold Theorem&lt;/a&gt;&quot;, or this paper &quot;&lt;a href=&quot;https://arxiv.org/abs/1403.5426&quot; rel=&quot;noreferrer&quot;&gt;Experimental Quantum Computations on a Topologically Encoded Qubit&lt;/a&gt;&quot;, there's even this paper on quantum metrology where the authors claim that: &quot;Making use of coherence and entanglement as metrological quantum resources allows to improve the measurement precision from the shot-noise or quantum limit to the Heisenberg limit.&quot; in their paper: &quot;&lt;a href=&quot;https://arxiv.org/abs/1711.06172v2&quot; rel=&quot;noreferrer&quot;&gt;Quantum metrology with a transmon qutrit&lt;/a&gt;&quot; by utilizing additional dimensions.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-04-06T22:53:08.397" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1627" PostTypeId="2" ParentId="1622" CreationDate="2018-04-06T22:59:19.870" Score="9" Body="&lt;p&gt;If your intent is to understand Gil Kalai's arguments, I recommend the following blog post of his: &lt;a href=&quot;https://gilkalai.wordpress.com/2018/02/08/my-argument-against-quantum-computers-an-interview-with-katia-moskvitch-on-quanta-magazine/&quot; rel=&quot;noreferrer&quot;&gt;My Argument Against Quantum Computers: An Interview with Katia Moskvitch on Quanta Magazine&lt;/a&gt; (and the links therein).&lt;/p&gt;&#xA;&lt;p&gt;For good measure, I'd also throw in &lt;a href=&quot;https://rjlipton.wordpress.com/2012/01/30/perpetual-motion-of-the-21st-century/&quot; rel=&quot;noreferrer&quot;&gt;Perpetual Motion of The 21st Century?&lt;/a&gt; (especially the comments). You can also see the highlights in &lt;a href=&quot;https://gilkalai.wordpress.com/2013/03/16/my-quantum-debate-with-aram-harrow-timeline-non-technical-highlights-and-flashbacks-i/&quot; rel=&quot;noreferrer&quot;&gt;My Quantum Debate with Aram Harrow: Timeline, Non-technical Highlights, and Flashbacks I&lt;/a&gt; and &lt;a href=&quot;https://gilkalai.wordpress.com/2013/03/19/my-quantum-debate-with-aram-ii/&quot; rel=&quot;noreferrer&quot;&gt;My Quantum Debate with Aram II&lt;/a&gt;. Finally, if you haven't already, see Scott Aaronson's &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=902&quot; rel=&quot;noreferrer&quot;&gt;Whether or not God plays dice, I do&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;First, a brief summary of Kalai's view from his &lt;a href=&quot;http://dx.doi.org/10.1090/noti1380&quot; rel=&quot;noreferrer&quot;&gt;Notices article&lt;/a&gt; (see also &lt;a href=&quot;https://gilkalai.wordpress.com/2016/04/22/the-quantum-computer-puzzle-notices-of-the-ams/&quot; rel=&quot;noreferrer&quot;&gt;The Quantum Computer Puzzle @ Notices of the AMS&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Understanding quantum computers in the presence of noise requires consideration of behavior at different scales. In the small scale, standard models of noise from the mid-90s are suitable, and quantum evolutions and states described by them manifest a very low-level computational power. This small-scale behavior has far-reaching consequences for the behavior of noisy quantum systems at larger scales. On the one hand, it does not allow reaching the starting points for quantum fault tolerance and quantum supremacy, making them both impossible at all scales. On the other hand, it leads to novel implicit ways for modeling noise at larger scales and to various predictions on the behavior of noisy quantum systems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Second, a &lt;a href=&quot;https://gilkalai.wordpress.com/2017/10/16/if-quantum-computers-are-not-possible-why-are-classical-computers-possible/&quot; rel=&quot;noreferrer&quot;&gt;recent argument&lt;/a&gt; for why he thinks classical error correction is possible but quantum error correction is not.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Unlike the repetition/majority mechanism which is supported by very primitive computational power, creating a quantum error correcting code and the easier task of demonstrating quantum supremacy are not likely to be achieved by devices which are very low-level in terms of computational complexity.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;(In the above mentioned conversation with Aram Harrow, it is &lt;a href=&quot;https://rjlipton.wordpress.com/2012/02/06/flying-machines-of-the-21st-century/&quot; rel=&quot;noreferrer&quot;&gt;pointed out&lt;/a&gt; that if one were to take Kalai's initial arguments directly, then even classical error correction would not possible.)&lt;/p&gt;&#xA;&lt;p&gt;In the post, Kalai goes on to argue that a primitive quantum computer would not be able to do error correction.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Q: But why can’t you simply create good enough qubits to allow universal quantum circuits with 50 qubits?&lt;/p&gt;&#xA;&lt;p&gt;A: This will allow very primitive devices (in terms of the asymptotic behavior of computational complexity) to perform superior computation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Kalai also gave a lecture (&lt;a href=&quot;https://youtu.be/L5gSZsezhoQ&quot; rel=&quot;noreferrer&quot;&gt;YouTube&lt;/a&gt;) on why topological quantum computing would not work.&lt;/p&gt;&#xA;" OwnerUserId="1813" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-18T06:25:07.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1628" PostTypeId="2" ParentId="1486" CreationDate="2018-04-07T06:29:48.643" Score="6" Body="&lt;p&gt;The answer to the first question (why is energy efficiency in quantum vs classical not discussed as often as speed?) is: in part because the problem is less univocal and in part because the answer is less flattering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to the second question (are quantum computers more or less energetically efficient?) will change with time, since it depends on technological developments of the different architectures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the present time, quantum computing is obviously less energetically efficient. A minimal classical computer can be designed to be extremely cheap, also in terms of energy (e.g. 1.5 W (average when idle) to 6.7 W (maximum under stress) for a &lt;a href=&quot;https://en.wikipedia.org/wiki/Raspberry_Pi&quot; rel=&quot;noreferrer&quot;&gt;Raspberry Pi&lt;/a&gt; ). In contrast, today to build and operate a minimal quantum computer is an engineering feat with staggering energy cost, even if the number of qubits is well below 100 and the maximum number of operations is orders of magnitude below what is achieved in a fraction of a second by a minimal classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the future, one can either speculate or take into account the fundamentals. Let us avoid speculation and stick to the fundamentals: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is no absolute fundamental physical reason for quantum computers to be more or less energy efficient than classical ones.&lt;/li&gt;&#xA;&lt;li&gt;Energy efficiency will always depend on the architecture, and thus on available technological solutions.&lt;/li&gt;&#xA;&lt;li&gt;To evaluate energy consumption, it will always be important to distinguish between the idle consumption and the cost of operation. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To elaborate on the latter point, present devices, both in commercial and academic settings, are bulky. Not ENIAC-sized, but larger-than-a-large-fridge-sized. Furthermore, to be controlled they require an auxiliary classical computer. The size-per-qubit is expected to get better, the need for an auxiliary classical computer is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But besides direct electrical power, there are often further physical requirements which cost energy, and which are fundamentally needed to keep the device in the desired quantum regime. For example, popular architectures today include different solid-state devices that need to be kept at temperatures of the order of a few Kelvin or lower. These temperatures are achieved with the help of liquid Helium, which is energetically very costly to liquify (cryogenic gases and electricity are among the main costs in Electronic Paramagnetic Resonance laboratories such as &lt;a href=&quot;https://nationalmaglab.org/user-facilities/emr&quot; rel=&quot;noreferrer&quot;&gt;the Electron Magnetic Resonance Facility (EMR) at the MagLab&lt;/a&gt;, or, closer to my experience, in the pulsed Electron Paramagnetic Resonance section at the &lt;a href=&quot;http://icmol.es/equipment.php&quot; rel=&quot;noreferrer&quot;&gt;ICMol&lt;/a&gt;). I have no experience with ion/atom traps, which are also popular architectures, so while they require mantaining a high-quality vacuum, for al I know it may be that these are more energy efficient.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-07T08:07:53.357" LastActivityDate="2018-04-07T08:07:53.357" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1629" PostTypeId="1" AcceptedAnswerId="1641" CreationDate="2018-04-07T09:50:58.210" Score="17" ViewCount="1699" Body="&lt;p&gt;In order to represent the single qubit $|\psi\rangle$ we use an unitary vector in a $\mathbb{C}^2$ Hilbert space whose (one of the) orthonormal base is $(|0\rangle, |1\rangle)$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can draw $|\psi\rangle$ using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;noreferrer&quot;&gt;Bloch ball&lt;/a&gt;. However, I found this notation quite confusing, because orthogonal vectors are spatially antiparallel (&lt;a href=&quot;https://physics.stackexchange.com/questions/204090/understanding-the-bloch-sphere&quot;&gt;brief explanation in this Physics Stackexchange question&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U9pdD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U9pdD.png&quot; alt=&quot;Block sphere&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any different graphical representation for a single qubit?&lt;/p&gt;&#xA;" OwnerUserId="1874" LastActivityDate="2018-08-07T21:11:53.030" Title="Alternative to Bloch sphere to represent a single qubit" Tags="&lt;quantum-state&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1630" PostTypeId="2" ParentId="1629" CreationDate="2018-04-07T10:27:17.920" Score="1" Body="&lt;p&gt;The Bloch sphere historically came about to describe spins where up and down can actually be viewed as being (anti)parallel rather than (mathematically) orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can naturally (and perhaps more naturally!) depict a qubit's state in a way that orthogonal states are indeed orthogonal. Then a pure 1-qubit state occupies a point on the surface of a 4-dimensional sphere.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-07T10:27:17.920" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1631" PostTypeId="1" AcceptedAnswerId="1632" CreationDate="2018-04-07T10:41:55.107" Score="16" ViewCount="6276" Body="&lt;p&gt;I have done some sort of online research on qubits and the factors making them infamous i.e allowing qubits to hold 1 and 0 at the same time and another is that qubits can be entangled somehow so that they can have related data in them no matter how far they are (even at opposite sides of the galaxies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While reading about this on Wikipedia I have seen some equation which is still difficult for me to comprehend. Here's the &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Entanglement&quot; rel=&quot;noreferrer&quot;&gt;link to Wikipedia&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How are they entangled in the first place?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do they relate their data?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1875" LastEditorUserId="55" LastEditDate="2018-04-07T16:30:39.740" LastActivityDate="2019-11-20T21:51:05.373" Title="What does it mean for two qubits to be entangled?" Tags="&lt;physical-qubit&gt;&lt;entanglement&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1632" PostTypeId="2" ParentId="1631" CreationDate="2018-04-07T11:51:35.390" Score="17" Body="&lt;p&gt;For a simple example suppose you have two qubits in definite states $|0\rangle$ and $|0\rangle$. The combined state of the system is $|0\rangle\otimes |0\rangle$ or $|00\rangle$ in shorthand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if we apply the following operators to the qubits (image is cut from &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding&quot; rel=&quot;noreferrer&quot;&gt;superdense coding&lt;/a&gt; wiki page), the resulting state is an entangled state, one of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;noreferrer&quot;&gt;bell states&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xV4Lq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xV4Lq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First in the image we have the hadamard gate acting on the first qubit, which in a longer form is $H\otimes I$ so that it is the identity operator on the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hadamard matrix looks like &#xA;$$H=\frac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix}$$ where the basis is ordered $\{|0\rangle,|1\rangle\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So after the hadamard operator acts the state is now&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$(H\otimes I)(|0\rangle\otimes|0\rangle)=H|0\rangle\otimes I |0\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\otimes (|0\rangle)=\frac{1}{\sqrt{2}}(|00\rangle+|10\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next part of the circuit is a controlled not gate, which only acts on the second qubit if the first qubit is a $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can represent $CNOT$ as $|0\rangle\langle0|\otimes I+|1\rangle\langle1|\otimes X$, where $|0\rangle\langle0|$ is a projection operator onto the bit $0$, or in matrix form $\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{pmatrix}$. Similarly $|1\rangle\langle1|$ is $\begin{pmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $X$ operator is the bit flip operator represented as $\begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall the $CNOT$ matrix is $\begin{pmatrix} 1 &amp;amp; 0 &amp;amp;0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp;0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp;0 &amp;amp; 1 \\0 &amp;amp; 0 &amp;amp;1 &amp;amp; 0 \\\end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we apply the $CNOT$ we can either use matrix multiplication by writing our state as a vector $\begin{pmatrix}\frac{1}{\sqrt{2}} \\ 0 \\ \frac{1}{\sqrt{2}} \\0 \end{pmatrix}$, or we can just use the tensor product form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$CNOT (\frac{1}{\sqrt{2}}(|00\rangle+|10\rangle))=\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see that for the first part of the state $|00\rangle$ the first bit is $0$, so the second bit is left alone; the second part of the state $|10\rangle$ the first bit is $1$, so the second bit is flipped from $0$ to $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our final state is $$\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$$ which is one of the four Bell states which are maximally entangled states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see what it means for them to be entangled, notice that if you were to measure the state of the first qubit say, if you found out that it was a $0$ it immediately tells you the second qubit also has to be a $0$, because thats our only possibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compare to this state for instance:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle+|11\rangle).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure that the first qubit is a zero, then the state collapses to $\frac{1}{\sqrt{2}}(|00\rangle+|01\rangle)$, where there is still a 50-50 chance the second qubit is a $0$ or a $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this gives an idea how states can be entangled. If you want to know a particular example, like entangling photons or electrons etc, then you would have to look into how certain gates can be implemented, but still you might write the mathematics the same way, the $0$ and $1$ might represent different things in different physical situations.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update 1: Mini Guide to QM/QC/Dirac notation&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually there's a standard computational (ortho-normal) basis for a single qubit which is $\{|0\rangle,|1\rangle\}$, say $\mathcal{H}=\operatorname{span}\{|0\rangle,|1\rangle\}$ is the vector space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this ordering of the basis we can identify $|0\rangle$ with $\begin{pmatrix} 1\\ 0 \end{pmatrix}$ and $|1\rangle$ with $\begin{pmatrix} 0\\ 1 \end{pmatrix}$. Any single qubit operator then can be written in matrix form using this basis. E.g. a bit flip operator $X$ (after pauli-$\sigma_x$) which should take $|0\rangle\mapsto |1\rangle$ and $|1\rangle \mapsto |0\rangle$, can be written as $\begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix}$, the first column of the matrix is the image of the first basis vector and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have multiple say $n$-qubits they should belong to the space $\mathcal{H}^{\otimes n}:=\overbrace{\mathcal{H}\otimes\mathcal{H}\otimes\cdots\otimes \mathcal{H}}^{n-times}$. A basis for this space is labelled by strings of zeros and ones, e.g. $|0\rangle\otimes|1\rangle\otimes |1\rangle\otimes\ldots \otimes|0\rangle$, which is usually abbreviated for simplicity as $|011\ldots0\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example for two qubits, the basis for $\mathcal{H}^{\otimes 2}=\mathcal{H}\otimes \mathcal{H}$, is $\{|0\rangle\otimes|0\rangle,|0\rangle\otimes|1\rangle,|1\rangle\otimes|0\rangle,|1\rangle\otimes|1\rangle\}$ or in the shorthand $\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's different ways to order this basis in order to use matrices, but one natural one is to order the strings as if they are numbers in binary so as above. For example for $3$ qubits you could order the basis as $$\{|000\rangle,|001\rangle,|010\rangle,|011\rangle,|100\rangle,|101\rangle,|110\rangle,|111\rangle\}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why this can be useful is that it corresponds with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;noreferrer&quot;&gt;Kronecker product&lt;/a&gt; for the matrices of the operators. For instance, first looking at the basis vectors: &#xA;$$|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}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|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}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and similarly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|1\rangle\otimes |0\rangle=\begin{pmatrix} 0\\ 0\\1\\0 \end{pmatrix},\quad |1\rangle\otimes |1\rangle=\begin{pmatrix} 0\\ 0\\0\\1 \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an operator e.g. $X_1X_2:=X\otimes X$ which acts on two qubits and we order the basis as above we can take the kronecker product of the matrices to find the matrix in this basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X_1X_2=X\otimes X=\begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix}\otimes \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} = \begin{pmatrix} 0\cdot\begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} &amp;amp; 1\cdot\begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix}\\ 1\cdot\begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} &amp;amp; 0\cdot \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} \end{pmatrix}=\begin{pmatrix} 0 &amp;amp;0&amp;amp;0&amp;amp;1\\ 0 &amp;amp;0&amp;amp;1&amp;amp;0\\0 &amp;amp;1&amp;amp;0&amp;amp;0\\1 &amp;amp;0&amp;amp;0&amp;amp;0\\  \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at the example of $CNOT$ above given as $|0\rangle\langle0|\otimes I+|1\rangle\langle1|\otimes X$.$^*$ This can be computed in matrix form as $\begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 0 \end{pmatrix}\otimes \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix}+\begin{pmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix}\otimes\begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix}$, which you can check is the $CNOT$ matrix above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's worthwhile getting used to using the shorthands and the tensor products rather than converting everything to matrix representation since the computational space grows as $2^n$ for $n$-qubits, which means for three cubits you have $8\times 8$ matrices, $4$-qubits you have $16\times 16$ matrices and it quickly becomes less than practical to convert to matrix form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aside$^*$: There are a few common ways to use dirac notation, to represent vectors like $|0\rangle$; dual vectors e.g. $\langle 0|$, inner product $\langle 0|1\rangle$ between the vectors $|0\rangle$ and $|1\rangle$; operators on the space like $X=|0\rangle\langle1|+|1\rangle\langle0|$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An operator like $P_0=|0\rangle\langle0|$ is a projection operator is a (orthogonal) projection operator because it satisfies $P^2=P$ and $P^\dagger=P$.&lt;/p&gt;&#xA;" OwnerUserId="197" LastEditorUserId="197" LastEditDate="2018-04-07T19:30:32.730" LastActivityDate="2018-04-07T19:30:32.730" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1633" PostTypeId="2" ParentId="1629" CreationDate="2018-04-07T13:18:01.977" Score="6" Body="&lt;p&gt;Adding to what &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1630/26&quot;&gt;@pyramids conveyed in their answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A qubit's state is generally written as $\alpha|0\rangle + \beta|1\rangle$, where $\alpha, \beta \in \Bbb{C}$, and $|\alpha|^2+|\beta|^2=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\Bbb{C}^2(\Bbb{R})$ is a four-dimensional vector space, over the field of real numbers. Since &lt;a href=&quot;https://math.stackexchange.com/a/2170600/400242&quot;&gt;any $n$-dimensional real vector space is isomorphic to $\Bbb{R}^n(\Bbb{R})$&lt;/a&gt;, you can represent any qubit's state as a point in a $4$-dimensional real space, too, whose basis vectors you can consider to be $(1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)$. In such a case a qubit's state would be represented as $a(1,0,0,0)+b(0,1,0,0)+c(0,0,1,0)+d(0,0,0,1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, $\alpha = a + i b$ (where $a,b\in \Bbb{R}$) and $\beta = c + id$ (where $c,d\in \Bbb{R}$). You need the condition $|a+ib|^2+|c+id|^2=1\implies a^2+b^2+c^2+d^2=1$ to be satisfied, which implies the state of the qubit would be a point on a &lt;a href=&quot;https://en.wikipedia.org/wiki/N-sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;3-sphere&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you know, it is difficult to efficiently represent a $4$-dimensional space on a $2$-dimensional surface like a paper, or your screen. Hence, you don't see that representation used often. &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt; is pretty much the &lt;strong&gt;most efficient representation&lt;/strong&gt; out there (for a single qubit), since it &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;reduces one degree of freedom&lt;/a&gt; (of the complex numbers $\alpha,\beta$ each of which have two degrees of freedom) due to the fact that a qubit's state is usually normalized to a magnitude of $1$ i.e. $|\alpha|^2+|\beta|^2=1$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, using the &lt;a href=&quot;https://en.wikipedia.org/wiki/3-sphere#Hopf_coordinates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hopf&#xA;  coordinates&lt;/a&gt;&#xA;  let's say:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\alpha = e^{i\psi}\cos(\theta/2)$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\beta = e^{i(\psi+\phi)}\sin(\theta/2)$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Here, $\theta$ can run from $0$ to $\pi$ whereas, $\psi$ and&#xA;  $\phi+\psi$ can take values between $0$ to $\pi$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;In case you're wondering why $\theta/2$ is being used instead of $\theta$ have a look at the answers on &lt;a href=&quot;https://physics.stackexchange.com/questions/174562/why-is-theta-over-2-used-for-a-bloch-sphere-instead-of-theta&quot;&gt;this&lt;/a&gt; excellent thread on Physics Stack Exchange.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Okay, even now you notice three degrees of freedom $\psi,\phi,\theta$, whereas in a unit radii sphere, you only have two angles which you can change to get the different states of a qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that $\phi$ is basically the &quot;relative phase&quot; between $\alpha$ and $\beta$. On the other hand $\psi$ does not contribute to the &quot;relative phase&quot; of $\alpha,\beta$. Also, neither $\phi$ nor $\psi$ contribute to the magnitude of $\alpha,\beta$ (since $|e^{i\varphi}|=1$ for any angle $\varphi$). Since $\psi$ contributes neither to &quot;relative phase&quot; nor to the &quot;magnitudes&quot; of $\alpha,\beta$ it is said to have &lt;strong&gt;no physically observable consequences&lt;/strong&gt; and we can &lt;em&gt;arbitrarily choose&lt;/em&gt; $\alpha$ to be real by eliminating the factor of $e^{i\psi}$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thus we end up with:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\alpha = \cos(\theta/2)$$ and $$\beta=e^{i\phi}\sin(\theta/2)$$&#xA;  Where $\theta$ can run from $0$ to $\pi$, and $\phi$ can run from $0$ to $2\pi$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This practical simplification allows you to represent a qubit's state using just $2$ degrees of freedom on $3$-dimensional spherical surface having unit radius, which again can again efficiently be &quot;drawn&quot; on a $2$-dimensional surface, as shown in the following image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uUcQH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uUcQH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Mathematically, it is not possible to reduce the degrees of freedom any further, and so, I'd say there is no other &quot;more efficient&quot; geometrical representation of a single qubit than the Bloch sphere.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia:Bloch_Sphere&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-08T05:52:01.640" LastActivityDate="2018-04-08T05:52:01.640" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1634" PostTypeId="1" AcceptedAnswerId="1647" CreationDate="2018-04-07T17:51:30.817" Score="10" ViewCount="287" Body="&lt;p&gt;This question is based on a scenario that is partly hypothetical and partly based on the experimental features of molecule-based quantum devices, which often present a quantum evolution and have some potential to be scalable, but are generally extremely challenging to characterize in detail (a relevant but not unique example is a series of works related to this &lt;a href=&quot;http://science.sciencemag.org/content/344/6188/1135&quot; rel=&quot;noreferrer&quot;&gt;electrical control of nuclear spin qubits in single molecules&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The scenario: Let us say we have a variety of black boxes, each of which is are able to process information. We don't control the quantum evolution of the boxes; in the language of the quantum circuit model, we do not control the sequence of quantum gates. We know each black box is hardwired to a different algorithm, or, more realistically, to a different time-dependent Hamiltonian, including some incoherent evolution. We don't know the details of each black box. In particular, we don't know whether &lt;strong&gt;their quantum dynamics are coherent enough to produce a useful implementation of a quantum algorithm&lt;/strong&gt; (let us herein call this &quot;&lt;em&gt;quantumness&lt;/em&gt;&quot;; the lower bound for this would be &quot;it's distinguishable from a classical map&quot;). To work with our black boxes towards this goal, &lt;strong&gt;we only know how to feed them classical inputs and obtain classical outputs&lt;/strong&gt;. Let us here distinguish between two sub-scenarios:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We cannot perform entanglement ourselves: we employ product states as&#xA;inputs, and single qubit measurements on the outputs. However, we can choose the basis of our input preparation and of our measurements (at minimum, between two orthogonal bases).&lt;/li&gt;&#xA;&lt;li&gt;As above, but we cannot choose the bases and have to worked on some fixed, &quot;natural&quot; base.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The goal: to check, for a given black box, the &lt;em&gt;quantumness&lt;/em&gt; of its dynamics. At least, for 2 or 3 qubits, as a proof-of-concept, and ideally also for larger input sizes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question: in this scenario, is there a series of correlation tests, in the style of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell&amp;#39;s_theorem#Bell_inequalities&quot; rel=&quot;noreferrer&quot;&gt;Bell's inequalities&lt;/a&gt;, which can achieve this goal?&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-08T13:47:39.213" LastActivityDate="2018-04-09T06:50:56.757" Title="Can one interrogate black boxes for quantum coherence?" Tags="&lt;algorithm&gt;&lt;architecture&gt;&lt;experiment&gt;&lt;decoherence&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1635" PostTypeId="1" CreationDate="2018-04-07T18:07:42.913" Score="7" ViewCount="347" Body="&lt;p&gt;This question is a follow-up on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1485/1346&quot;&gt;this one&lt;/a&gt;, with the hope of getting more specific clues, and was motivated by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1432/1346&quot;&gt;this answer&lt;/a&gt; by user Rob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also please note this posts that handle the topic of QA in much more detail:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1596&quot;&gt;https://quantumcomputing.stackexchange.com/a/1596&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4228&quot;&gt;https://quantumcomputing.stackexchange.com/a/4228&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://www.dwavesys.com/quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave Systems&lt;/a&gt;' webpage, we can read a description of how an annealing QPU like their &lt;em&gt;2000Q&lt;/em&gt; flagship is able perform optimization on a given distribution by regarding many paths simultaneously, which makes the optimization process more robust against local minima and such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, they claim that &quot;it is best suited to tackling complex optimization problems that exist across many domains&quot;, and they cite (among others), &lt;strong&gt;optimization&lt;/strong&gt;, &lt;strong&gt;machine learning&lt;/strong&gt; and &lt;strong&gt;sampling / Monte Carlo&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, we see that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum annealing (QA) is a metaheuristic for finding the global minimum of a given objective function over a given set of candidate solutions [...]. Quantum annealing starts from a quantum-mechanical superposition of all possible states (candidate states) with equal weights. Then the system evolves [...] The transverse field is finally switched off, and the system is expected to have reached the ground state. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;At this point, we see that both explanations (with different detail levels) &lt;strong&gt;address the question of how annealing can help non-convex optimization (&lt;a href=&quot;https://arxiv.org/abs/1412.0233&quot; rel=&quot;nofollow noreferrer&quot;&gt;among other things&lt;/a&gt;)&lt;/strong&gt;. And that isn't even specifically related to quantum computing since &lt;a href=&quot;https://en.wikipedia.org/wiki/Simulated_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;simulated annealing&lt;/a&gt; stands on its own. But it is D-Wave claiming their hardware can help to perform sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe the connection is obvious and I'm missing it, but I think sampling is a distinct enough task from optimization to require its own explanation. The specific questions that I have are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Given some data following a possibly unknown distribution, how can the D-Wave be used to perform sampling on it? What are the constraints?&lt;/li&gt;&#xA;&lt;li&gt;To what extent is it advantageous against other SoTA classical sampling algorithms like, say, &lt;a href=&quot;https://en.wikipedia.org/wiki/Gibbs_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gibbs&lt;/a&gt;?&lt;/li&gt;&#xA;&lt;li&gt;Are the possible advantages specific to annealing QPUs, to any QPUs or a general property of simulated annealing?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="1346" LastEditDate="2019-04-06T01:48:01.993" LastActivityDate="2019-04-06T01:48:01.993" Title="How can a D-Wave style Annealing QPU help sampling?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;bayesian-learning&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1636" PostTypeId="2" ParentId="1629" CreationDate="2018-04-07T22:11:10.687" Score="1" Body="&lt;p&gt;(Firstly, the &quot;reputation points&quot; requirement is stupid - this remark should be a comment on the previous post.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A single qubit in a pure state has 2 real degrees of freedom, not 3, when you quotient out both magnitude and phase (i.e., complex normalization). So, most reasonable two-dimensional surfaces could be used (e.g., the 2-sphere or anything topologically equivalent).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding a &lt;em&gt;useful&lt;/em&gt; representation is another story. The Bloch sphere has a natural extension to mixed states (which have 3 degrees of freedom), whereas this does not appear to be the case otherwise..&lt;/p&gt;&#xA;" OwnerUserId="1885" LastEditorUserId="1837" LastEditDate="2018-05-22T10:58:26.647" LastActivityDate="2018-05-22T10:58:26.647" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1637" PostTypeId="2" ParentId="1635" CreationDate="2018-04-08T00:34:26.797" Score="1" Body="&lt;p&gt;This answer reflects my understanding of what D-wave have to say about this, in the 2013 whitepaper they link to: &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/Map%20Coloring%20WP2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Programming With D-Wave: Map Coloring Problem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To back up the question, we find once again the claim: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;superposition&quot; states [...] give a quantum computer the ability to quickly solve certain classes of complex problems such as optimization, machine learning and sampling problems. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And the explanation for the optimization problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The processor considers all the possibilities simultaneously to determine the lowest energy required to form those relationships. &#xA;  Because a quantum computer is probabilistic rather than deterministic, the computer returns many very good answers in a &#xA;  short amount of time -  10,000 answers in one second.  This gives the user not only the optimal solution or a single answer,&lt;br&gt;&#xA;  but also other alternatives to choose from.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then, the statement that the QPU naturally returns samples:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the D-Wave quantum computer has no registers or memory locations, a natural question arises: how do we learn anything from having executed a quantum machine instruction? The answer is that &lt;strong&gt;we are given samples from a distribution, as a side effect of executing the QMI&lt;/strong&gt; (quantum machine instruction).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;But how? First, they explain what is the interface for such QMIs:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;The D-Wave system has many qubits [...]. &lt;strong&gt;The programming model does not allow the programmer to directly set the value of these qubits&lt;/strong&gt;&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead, the state of the $q_i$ qbits can be influenced by setting a weight $a$ for each qbit, and a weight $b_{ij}$ (called &lt;em&gt;coupler&lt;/em&gt;) for each connection between any 2 qbits. The qbits are linearly combined into an &quot;objective function that &lt;strong&gt;will define the distribution from which our samples will be selected&lt;/strong&gt;&quot;: $O(a,b;q) = \sum_{i=1}^N{a_i q_i} + \sum_{&amp;lt;i,j&amp;gt;}b_{ij} q_i q_j$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;&lt;strong&gt;Each QMI consists of exactly the $a$ and $b_{ij}$ values&lt;/strong&gt; that appear in the [...] objective function&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And then they describe the protocol for such QMIs:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As a programmer, &lt;strong&gt;it is our job is to encode the various possible solutions to an optimization problem in the qubit variables&lt;/strong&gt; $q_i$. Then we translate the constraints in our optimization problem into values of the weights $a_i$ and strengths $b_{ij}$ such that when the objective is minimized the qubits will satisfy the constraints.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In this context,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;&lt;em&gt;Each sample is simply the collection of $q_i$ values for the entire set of qubits which enter into our problem&lt;/em&gt;&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&quot;&lt;em&gt;The distribution is an equal weighting across all the samples that give the minimum (or slightly above in practice) value of our objective function&lt;/em&gt;&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So as far as I understood, three things are known to the programmer in beforehand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The set of constraints (weights and couplers)&lt;/li&gt;&#xA;&lt;li&gt;The distribution's domain (encoding of the qbits)&lt;/li&gt;&#xA;&lt;li&gt;The fact that the distribution is a linear mixture model&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Then, running the program &lt;em&gt;once&lt;/em&gt; will return a distribution which is by itself an average of all the possible optimal samples in the domain that satisfy the constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now I will try to answer my questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Given some data following a possibly unknown distribution, how can the D-Wave be used to perform sampling on it? What are the constraints?&lt;/strong&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I will start with the constraints:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The distribution has to be representable as a linear mixture model of qbit distributions.&lt;/li&gt;&#xA;&lt;li&gt;The hardware has to be capable of encoding the whole domain of the distribution&lt;/li&gt;&#xA;&lt;li&gt;The programmer has to be able to express the desired distribution as a combination of sets of constraints within the mixture model. Therefore the distribution has to be &lt;em&gt;implicitly&lt;/em&gt; known, but not &lt;em&gt;explicitly&lt;/em&gt;: this suits in fact very well machine learning and data-driven workflows.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Given this assumptions, it should be possible to extract the probability density function by running the program once per constraint set, and performing the pertinent combination. &lt;em&gt;Note that the linearity of the mixture model is somehow a limitation, but also has its &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;advantages&lt;/a&gt; regarding such combinations&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;strong&gt;To what extent is it advantageous against other SoTA classical sampling algorithms like, say, Gibbs?&lt;/strong&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The advantage comes from the speedup that &quot;superimposed&quot; states give by enabling a single program's output to collapse multiple samples. But there is one big caveat: the output returns all the &lt;strong&gt;minimum&lt;/strong&gt; states for the given constraint. This means that the speedup depends on the programmer's ability of encoding the constraints in a way that collapse as many outputs as possible. Without getting into big-O, this doesn't seem trivial at all to me.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Are the possible advantages specific to annealing QPUs, to any QPUs or a general property of simulated annealing?&lt;/strong&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know about other QPUs (help very welcome), but regarding Wikipedia's &lt;a href=&quot;https://en.wikipedia.org/wiki/Simulated_annealing#Pseudocode&quot; rel=&quot;nofollow noreferrer&quot;&gt;pseudocode for simulated annealing&lt;/a&gt; we see that the output is a single sample. So, given the big caveat discussed before, this is already the worst-case scenario for a D-Wave sampler.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;POSSIBLE APPLICATION EXAMPLES:&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1803.10520&quot; rel=&quot;nofollow noreferrer&quot;&gt;This related paper&lt;/a&gt; (linked by user &lt;code&gt;hopefully coherent&lt;/code&gt;) presents an algorithm that could be a candidate for this case: At the end of page 2, &#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;We address the first term in (1) by describing a quantum procedure to efficiently sample the eigenvalues of an $n\times n$ Hermitian matrix $A$ uniformly at random&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It would be very interesting to see if/how the constraints for eigenvalues can be encoded as the above discussed QMIs.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Insert here some example for the encoding of some data-driven setup like &quot;given this $N$-dimensional dataset, find the projection or embedding that minimizes some non-convex objective&quot; into such QMIs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="1346" LastEditDate="2018-04-09T00:12:29.043" LastActivityDate="2018-04-09T00:12:29.043" CommentCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1638" PostTypeId="2" ParentId="1631" CreationDate="2018-04-08T08:55:21.140" Score="5" Body="&lt;p&gt;Although the linked wikipedia article is trying to use entanglement as a distinguishing feature from classical physics, I think one can start to get some understanding about entanglement by looking at classical stuff, where our intuition works a little better...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine you have a random number generator that, each time, spits out a number 0,1,2 or 3. Usually you'd make these equally probability, but we can assign any probability to each outcome that we want. For example, let's give 1 and 2 each with probability 1/2, and never give 0 or 3. So, each time the random number generator picks something, it gives 1 or 2, and you don't know in advance what it's going to be. Now, let's write these numbers in binary, 1 as 01 and 2 as 10. Then, we give each bit to a different person, say Alice and Bob. Now, when the random number generator picks a value, either 01 or 10, Alice has one part, and Bob has the other. So, Alice can look at her bit, and whatever value she gets, she knows that Bob has the opposite value. We say these bits are perfectly anti-correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement works much the same way. For example, you might have a quantum state $$\left|\psi\right\rangle=\frac{1}{\sqrt{2}}\left(\left|01\right\rangle-\left|10\right\rangle\right)$$&#xA;where Alice holds one qubit of $\left|\psi\right\rangle$, and Bob holds the other. Whatever single-qubit projective measurement Alice chooses to make, she'll get an answer 0 or 1. If Bob makes the same measurement on his qubit, he always gets the opposite answer. This includes measuring in the Z-basis, which reproduces the classical case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference comes from the fact that this holds true for every possible measurement basis, and for that to be the case, the measurement outcome must be unpredictable, and that's where it differs from the classical case (you may like to read up about Bell tests, specifically the &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;noreferrer&quot;&gt;CHSH test&lt;/a&gt;). In the classical random number example I described at the start, once the random number generator has picked something, there's no reason why it can't be copied. Somebody else would be able to know what answer both Alice and Bob would get. However, in the quantum version, the answers that Alice and Bob get do not exist is advance, and therefore nobody else can know them. If somebody did know them, the two answers would not be perfectly anti-correlated. This is the basis of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution#E91_protocol:_Artur_Ekert_(1991)&quot; rel=&quot;noreferrer&quot;&gt;Quantum Key Distribution&lt;/a&gt; as it basically describes being able to detect the presence of an eavesdropper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something further that may help in trying to understand entanglement: mathematically, it’s no different to superposition, it’s just that, at some point, you separate the superposed parts over a great distance, and the fact that that is in some sense difficult to do means that making the separation provides you with a resource that you can do interesting things with. Really, entanglement is the resource of what one might call ‘distributed superposition’.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-08T10:18:35.997" LastActivityDate="2018-04-08T10:18:35.997" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1639" PostTypeId="2" ParentId="1634" CreationDate="2018-04-08T10:50:02.473" Score="4" Body="&lt;p&gt;Why not input one half of a maximally entangled state as the input to the black box (so that half has the same dimension as the input dimension)? Then you could &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.88.217901&quot; rel=&quot;nofollow noreferrer&quot;&gt;test your favourite measure&lt;/a&gt;, such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Purity_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;purity&lt;/a&gt;, of the full output state. If the oracle corresponds to a unitary evolution, the purity is 1. The less coherent the smaller the purity. Incidentally, the output state describes the map that the black box implements, via the &lt;a href=&quot;https://en.wikipedia.org/wiki/Channel-state_duality&quot; rel=&quot;nofollow noreferrer&quot;&gt;Choi-Jamiołkowski isomorphism&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-08T12:02:39.677" LastActivityDate="2018-04-08T12:02:39.677" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1640" PostTypeId="2" ParentId="1634" CreationDate="2018-04-08T12:19:27.233" Score="2" Body="&lt;p&gt;I'm not exactly sure what you mean by &lt;em&gt;quantumness&lt;/em&gt; of your black box. So maybe there are some more sophisticated approaches (similar to the other answer you could use an entanglement witness to show that your black box is not entanglement breaking). However, in general you could perform &lt;strong&gt;quantum process tomography&lt;/strong&gt; (see e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9611013&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9611013&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2018-04-08T12:19:27.233" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1641" PostTypeId="2" ParentId="1629" CreationDate="2018-04-08T19:44:46.173" Score="5" Body="&lt;p&gt;In the link included in your question, about another question written by user098876, &amp;quot;Understanding the Bloch sphere&amp;quot;, Daniel makes a helpful comment:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Drawing points on the sphere to represent the state of a quantum two-level system does not mean that you should think of those points as real vectors in 3D space. – DanielSank Sep 3 '15 at 20:17&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Oversimplified explanation: It's a two-side plane (or two planes) projected on a sphere.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;I found this notation quite confusing, because orthogonal vectors are spatially antiparallel (&lt;a href=&quot;https://physics.stackexchange.com/questions/204090/understanding-the-bloch-sphere&quot;&gt;brief explanation in this Physics Stackexchange question&lt;/a&gt;). Do you know any different graphical representation for a single qubit?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There are a number of efforts underway to provide a more general representation that extends from qubits to qudits. This explanation and representation using a &lt;a href=&quot;https://phys.org/news/2016-12-method-majorana-fermions.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana&lt;/a&gt; sphere isn't so &lt;em&gt;different&lt;/em&gt;, it's still a sphere, but perhaps it's less confusing:&lt;/p&gt;&#xA;&lt;p&gt;For qubits on a Majorana sphere see: &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/0910.0630&quot; rel=&quot;nofollow noreferrer&quot;&gt;N-qubit states as points on the Bloch sphere&lt;/a&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Abstract. We show how the Majorana representation can be used to express the pure states of an N-qubit system ... In conclusion, the Majorana representation is useful when spin-&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; particles are studied, while the alternative representation is preferable when the states of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit system are discussed. Besides helping to visualize &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit states and the way they transform in rotations and other operations, the latter representation may also help to identify some special &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit states, like the Majorana representation did in the context of spinor Bose-Einstein condensates.&amp;quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;See: &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1703.06102&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana representation, qutrit Hilbert space and NMR implementation of qutrit gates&lt;/a&gt;&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;Page 1:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;The Bloch sphere provides a representation of the quantum states of a single qubit onto &lt;span class=&quot;math-container&quot;&gt;$\mathcal S^2$&lt;/span&gt; (a unit sphere in three real dimensions), with pure states mapped onto the surface and the mixed states lying in the interior. This geometrical representation is useful in providing a visualization of quantum states and their transformations, particularly in the case of NMR-based quantum computation, where the spin-&lt;s&gt;&lt;s&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;&lt;/s&gt;&lt;/s&gt; magnetization and its transformation through NMR rf pulses is visualized on the Bloch sphere. There have been several proposals for the geometrical representation for higher-level quantum systems however, extensions of a Bloch sphere-like picture to higher spins is not straightforward. A geometrical representation was proposed by Majorana in which, a pure state of a spin ‘&lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;’ is represented by ‘2&lt;span class=&quot;math-container&quot;&gt;$_s$&lt;/span&gt;’ points on the surface of a unit sphere, called the Majorana sphere.&lt;/p&gt;&#xA;&lt;p&gt;The Majorana representation for spin−&lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; systems has found widespread applications such as determining geometric phase of spins, representing &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; spinors by &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; points, geometrical representation of multi-qubit entangled states, statistics of chaotic quantum dynamical systems and characterizing polarized light. A single qutrit (three-level quantum system) is of particular importance in qudit-based (&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-level quantum system) quantum computing schemes. &lt;strong&gt;A qutrit is the smallest system that exhibits inherent quantum features such as contextuality, which has been conjectured to be a resource for quantum computing&lt;/strong&gt;. NMR qudit quantum computing can be performed by using nuclei with spin s &amp;gt; &lt;s&gt;&lt;s&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;&lt;/s&gt;&lt;/s&gt; or can be modeled by two or more coupled spin-&lt;s&gt;&lt;s&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;&lt;/s&gt;&lt;/s&gt; nuclei. In this work we use the Majorana sphere description of a single qutrit, where states of a qutrit are represented by a pair of points on a unit sphere, to provide insights into the qutrit state space.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Page 5:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;The magnitude of the magnetization vector &lt;span class=&quot;math-container&quot;&gt;$\vert-$&lt;/span&gt;&lt;s&gt;&lt;s&gt;&lt;span class=&quot;math-container&quot;&gt;$\vec{M}$&lt;/span&gt;&lt;/s&gt;&lt;/s&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert$&lt;/span&gt; in a pure ensemble of a single qutrit can assume values in the range &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;. On the contrary, the pure ensemble of a qubit always possesses &lt;a href=&quot;https://www.mathsisfun.com/algebra/vector-unit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;unit magnitude&lt;/a&gt; of the magnetization vector associated with it&lt;/strong&gt;. The geometrical picture of the single qutrit magnetization vector is provided by the Majorana representation. The value &lt;span class=&quot;math-container&quot;&gt;$\vert-$&lt;/span&gt;&lt;s&gt;&lt;s&gt;&lt;span class=&quot;math-container&quot;&gt;$\vec{M}$&lt;/span&gt;&lt;/s&gt;&lt;/s&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert$&lt;/span&gt; depends upon the length of the bisector &lt;span class=&quot;math-container&quot;&gt;$OO'$&lt;/span&gt; and lies along the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis and is rotationally invariant. Thus corresponding to a given value of the length of the bisector, one can assume concentric spheres with continuously varying radii, whose surfaces are the surfaces of constant magnetization. The radii of these spheres are equal to &lt;span class=&quot;math-container&quot;&gt;$\vert-$&lt;/span&gt;&lt;s&gt;&lt;s&gt;&lt;span class=&quot;math-container&quot;&gt;$\vec{M}$&lt;/span&gt;&lt;/s&gt;&lt;/s&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert$&lt;/span&gt;, that vary in the range &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Page 10:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;CONCLUDING REMARKS&lt;/p&gt;&#xA;&lt;p&gt;A geometrical representation of a qutrit is described in this work, wherein qutrit states are represented by two points on a unit sphere as per the Majorana representation. A parameterization of single-qutrit states was obtained to generate arbitrary states from a one-parameter family of canonical states via the action of &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; transformations. The spin-&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; magnetization vector was represented on the Majorana sphere and states were identified as ‘pointing’ or ‘non-pointing’ depending on the zero or non-zero value of the spin magnetization. The transformations generated by the action of &lt;span class=&quot;math-container&quot;&gt;$SU(3)$&lt;/span&gt; generators were also integrated into the Majorana geometrical picture. Unlike qubits, the decomposition of single-qutrit quantum gates in terms of radio-frequency pulses is not straightforward and the Majorana sphere representation provides a way to geometrically describe these gates. Close observations of the dynamics of points representing a qutrit on the Majorana sphere under the action of various quantum gates were used to obtain the rf pulse decompositions and basic single-qutrit gates were experimentally implemented using NMR.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5a7HX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5a7HX.jpg&quot; alt=&quot;Majorana Sphere - Dogra, Dorai, and Arvind&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;FIG. 1. A qutrit on the Majorana sphere is represented by two points &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt;, connected with the center of the sphere by lines shown in red and blue respectively. &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi_1$&lt;/span&gt; are the polar and azimuthal angles corresponding to point &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\theta_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi_2$&lt;/span&gt; are the angles for point &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt;). (a) Roots of the Majorana polynomial are shown in the plane &lt;span class=&quot;math-container&quot;&gt;$z = 0$&lt;/span&gt; by points &lt;span class=&quot;math-container&quot;&gt;$P'_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P'_2$&lt;/span&gt;, whose stereographic projection give rise to the Majorana representation. Three examples are shown corresponding to the Majorana representation of single-qutrit basis vectors &lt;span class=&quot;math-container&quot;&gt;$(b)\;\vert+1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(c)\;\vert0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(d)\;\vert-1\rangle$&lt;/span&gt;. One of the points is shown as a solid (red) circle, while the other point is represented by an empty (blue) circle.&lt;/p&gt;&#xA;&lt;p&gt;See: &amp;quot;&lt;a href=&quot;http://www.reed.edu/physics/faculty/wheeler/documents/Quantum%20Mechanics/Miscellaneous%20Essays/Angular%20Momentum,%20Spin/D2.%20Majorana.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana Representation of Higher Spin States&lt;/a&gt;&amp;quot; (.PDF) by &lt;a href=&quot;http://www.reed.edu/physics/faculty/wheeler/documents/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wheeler&lt;/a&gt; (Website) or &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1707.08465&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wigner tomography of multispin quantum states&lt;/a&gt;&amp;quot;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What does it look like using Tomography - &amp;quot;In this paper, we theoretically develop a tomography scheme for spherical functions of arbitrary multispin quantum states. We study experimental schemes to reconstruct the generalized Wigner representation of a given density operator (representing mixed or pure quantum states).&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Compare that to the complexity of the Bloch sphere depicted in: &amp;quot;&lt;a href=&quot;https://www.researchgate.net/publication/255994952_Bloch-sphere_representation_of_three-vertex_geometric_phases&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch-sphere representation of three-vertex geometric phases&lt;/a&gt;&amp;quot;. The shape is the same it's all how you visualize the projection used.&lt;/p&gt;&#xA;&lt;p&gt;Here's a less busy image:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uZkH3.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uZkH3.jpg&quot; alt=&quot;Bloch sphere&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Think of the Bloch sphere cut in half by a very large sheet of paper. At the edge of the paper (infinity) any point on the top of the sheet draws a line to (infinity) the top of the ball (the bottom of the ball for the underside of the sheet). Points nearest the center of the paper (mixed states) draw lines to the center of the sphere. That represents the distance up to infinity on a tiny ball, a qubit/qudit is finite so the &lt;em&gt;paper&lt;/em&gt; is not so big.&lt;/p&gt;&#xA;&lt;p&gt;Now draw points on the 2D paper, draw lines from the paper to the ball, remove the paper, and look at or through the clear ball to see the other endpoint of the line.&lt;/p&gt;&#xA;&lt;p&gt;A much more accurate and difficult explanation is offered in the links above.&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-09T14:12:12.490" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1642" PostTypeId="1" AcceptedAnswerId="1683" CreationDate="2018-04-08T20:53:56.737" Score="5" ViewCount="204" Body="&lt;p&gt;&lt;strong&gt;Chemistry background&lt;/strong&gt;: In magnetic molecules, it is sometimes the case that one can adjust the time-independent Hamiltonian by chemical design. This means there is freedom to adjust parameters in the time-independent Hamiltonian during the design phase, but when the device is prepared these parameters cannot be adjusted further. An example would be molecules containing magnetic ions with a well-defined spin anisotropy and which communicate with each other via dipolar interactions: if it is chemically possible to position the spins in 3D space and to orient their magnetization axes, one has a certain control over the final form of the time-independent Hamiltonian. (For a state-of-the-art example, see &lt;a href=&quot;https://www.nature.com/articles/ncomms11377&quot; rel=&quot;nofollow noreferrer&quot;&gt;A modular design of molecular qubits to implement universal quantum gates&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Operational problem&lt;/strong&gt;: In a given experimental setup aiming to implement quantum computing, there will be a collection of physical operations (described by a time-dependent Hamiltonian) which in principle allow for arbitrary quantum logical operations.  In practice, the number of physical operations needed to implement a certain quantum algorithm (or even an elementary logical quantum gate) also depends on the details of the time-independent Hamiltonian. (See for example &lt;a href=&quot;https://arxiv.org/pdf/cond-mat/0703501.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spin qubits with electrically gated polyoxometalate molecules&lt;/a&gt;, where sqrt(SWAP) is spontaneously &quot;implemented&quot; by a simple waiting time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Goal + question&lt;/strong&gt;: Whenever one aims for a certain quantum logical manipulation (such as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Fourier Transform&lt;/a&gt;), it seems obvious that there will be some time-independent Hamiltonians that will require a smaller number of physical operations than others. Our goal would be to find design criteria; &lt;strong&gt;to find the parameters that we can adjust by chemical design that makes the number of operations small&lt;/strong&gt;, not in a particular case but &lt;strong&gt;for a typical collection of quantum transformations&lt;/strong&gt;. In the form of a question: is there a reasonable set of quantum logical operations that could be used in this context to benchmark the typical efficiency of time-dependent spin Hamiltonians?&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2018-12-23T14:06:42.117" LastActivityDate="2018-12-23T14:06:42.117" Title="What set of quantum logical operations can one use to benchmark spin Hamiltonians?" Tags="&lt;architecture&gt;&lt;error-correction&gt;&lt;fault-tolerance&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1643" PostTypeId="2" ParentId="1339" CreationDate="2018-04-08T21:12:58.903" Score="1" Body="&lt;p&gt;The first paper you mention, by Tejada et al, does not actually refer to conventional nanoparticles as such, but rather to single molecule magnets. This other paper by Loss, &lt;a href=&quot;https://www.nature.com/articles/35071024&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computing in molecular magnets&lt;/a&gt;, is about the same systems but perhaps more clear in quantum computing terms, since it gives more details on the underlying Hamiltonian and gives a suggestion for a quantum algorithm. Magnetic molecules do present decoherence (see for example &lt;a href=&quot;https://www.nature.com/articles/nature10314&quot; rel=&quot;nofollow noreferrer&quot;&gt;Decoherence in crystals of quantum molecular magnets&lt;/a&gt;), but their mechanisms are different from those of magnetic nanoparticles, at least in the details, meaning Barkhausen noise is not be a sufficient description for those. In any case, you may want to check the supporting information of this latter reference by Stamp et al, since it includes methodological details on how to estimate the different decoherent sources.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-08T21:12:58.903" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1646" PostTypeId="2" ParentId="1549" CreationDate="2018-04-09T05:31:21.510" Score="3" Body="&lt;p&gt;Your question revolves implicitly around the concept of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_decoherence&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum decoherence&lt;/a&gt; and how to protect real-world implementations of qubits from it for a long time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an incredibly general problem, and at the same time, the details are wildly dependent on the technology used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to it, you can check chapter 5 : &quot;Noise and decoherence&quot; of &lt;a href=&quot;http://www.langtoninfo.com/web_content/9780521113694_frontmatter.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Theory and Design of Quantum Coherent Structures&lt;/a&gt;. Also, for illustration on the current state-of-the-art of different approaches, you can check this Europen project on &lt;a href=&quot;https://cordis.europa.eu/result/rcn/199908_en.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Engineering electronic quantum coherence and correlations in hybrid nanostructures&lt;/a&gt;, or this other European project (&lt;em&gt;disclaimer: this is my own approach&lt;/em&gt;) on &lt;a href=&quot;https://www.uv.es/gaita/pdf/ERC_CoG_2014_B2_20-05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Chemical Approach to Molecular Spin Qubits&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Since the problem of storage of quantum information is vital, some general strategies have been developed. In a nutshell: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction&lt;/a&gt; (also, for a slightly outdated pedagogical review see &lt;a href=&quot;https://arxiv.org/abs/0905.2794&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction for Beginners&lt;/a&gt;) which is a huge field by itself and which is based precisely on admitting the failure in building a sufficient protection to qubits and therefore the necessity for an active intervention to protect quantum information from degrading. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Different approaches to hybrid quantum devices exist, where the information is processed in qubits that interact strongly and quickly with each other and our external stimuli (and also with noise sources) and subsequently stored in qubits that interact very weakly and slowly with every stimulus (desirable or not). Again, this family of approaches is too much dependent on the technological details to make general statements.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="58" LastEditDate="2018-04-11T07:11:40.420" LastActivityDate="2018-04-11T07:11:40.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1647" PostTypeId="2" ParentId="1634" CreationDate="2018-04-09T06:50:56.757" Score="2" Body="&lt;p&gt;Let's assume that your black box processes classical inputs (i.e. a bit string) to classical outputs in a deterministic way, i.e. it defines a function $f:x\mapsto y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can only prepare and measure separable states in that basis, all you can determine is what that function $f$ is. Assuming that all the outputs are different, it could have been computed either by a reversible classical computation or a quantum computation, and you wouldn't be able to tell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's assume you can prepare product states and measure in two different bases, $X$ and $Z$ for the sake of argument. One thing that you could do (which may be hopelessly inefficient for all I know, but it's somewhere to start) is first determine the function $f(x)$ using the $Z$ basis. Then, for any pair of bit string $x_1$ and $x_2$ that differ in only one position, prepare the state $(\left|x_1\right\rangle\pm\left|x_2\right\rangle)/\sqrt{2}$. This is a product state, using the $Z$ basis on all but one site. Let's assume that the outputs $y_1=f(x_1)$ and $y_2f(x_2)$ differ on $k&amp;gt;0$ sites. (If $k=0$, the evolution wasn't coherent anyway.) For the bits where $y_1$ and $y_2$ are supposed to be equal, just measure them in the $Z$ basis to make sure you get what you expect to get. On the remaining $k$ sites, if the black box is coherent, you receive a GHZ state of $k$ qubits,&#xA;$$&#xA;\frac{1}{\sqrt{2}}(\left|y_1\right\rangle\pm\left|y_2\right\rangle).&#xA;$$&#xA;If it were completely incoherent, you'd get a rank two mixed state&#xA;$$&#xA;\frac{1}{2}\left(\left|y_1\right\rangle\left\langle y_1\right|+\left|y_2\right\rangle\left\langle y_2\right|\right).&#xA;$$&#xA;If $k=1$, you can distinguish these directly by measuring that qubit in the $X$ basis (repeating a few times to get statistics). For $k&amp;gt;1$ you have a few options. Either you can peform a Bell test ($k=2$) or equivalent for GHZ states (such as all versus nothing proofs), or apply an entanglement witness (there are some based on single-qubit observables). Alternatively, measure every qubit in the $X$ basis and record the outcomes. In the case of the entangled state, the last outcome should be entirely predictable based on the previous outcomes. For the mixed state, the answer will be completely unpredictable. If you want to make a more quantitative statement, you could use something like an entropy, $H(X|Y)$ where $X$ is the random variable describing the output of the last measurement, and $Y$ is the random variable describing the outcome of all the previous measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible issue is that by testing only inputs with a single site prepared in the $X$ basis, there are a lot of options you're not testing, so I don't know whether testing all of these coherences is enough, or whether one ought to start analysing what happens if you prepare pairs of sites in the $X$ basis, and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, while this tells you something about how coherent the implementation of the black box is, whether or not that coherence contributes to the speed of operation of the black box is a completely different matter (for example, that's the sort of thing people want to know about with transport processes in photosynthetic bacteria, or even something like D-Wave).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-09T06:50:56.757" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1648" PostTypeId="1" CreationDate="2018-04-09T07:15:14.043" Score="19" ViewCount="1768" Body="&lt;p&gt;Now that we know of bio/molecular tools that allow living organisms to deal with quantum computations e.g. the fancy proteins that allow birds to handle quantum coherence (e.g. &lt;a href=&quot;http://www.pnas.org/content/early/2016/03/30/1600341113&quot; rel=&quot;noreferrer&quot;&gt;The quantum needle of the avian magnetic compass&lt;/a&gt; or &lt;a href=&quot;http://www.cell.com/current-biology/fulltext/S0960-9822(17)31605-6&quot; rel=&quot;noreferrer&quot;&gt;Double-Cone Localization and Seasonal Expression Pattern Suggest a Role in Magnetoreception for European Robin Cryptochrome 4&lt;/a&gt;) I wonder:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Are these tools already solving problems you (quantum computing researchers) have?&lt;/li&gt;&#xA;&lt;li&gt;Is there any specific issue these tools 'must' be solving somehow that you are struggling with at your labs?&lt;/li&gt;&#xA;&lt;li&gt;Could we use them (although this will imply a paradigm shift towards biotechnology)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1847" LastEditDate="2018-04-22T16:59:45.310" LastActivityDate="2021-03-16T09:52:06.390" Title="Is Quantum Biocomputing ahead of us?" Tags="&lt;architecture&gt;&lt;solid-state&gt;&lt;biocomputing&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="10" ContentLicense="CC BY-SA 3.0" />
  <row Id="1650" PostTypeId="5" CreationDate="2018-04-09T15:50:10.437" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-09T15:50:10.437" LastActivityDate="2018-04-09T15:50:10.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1651" PostTypeId="4" CreationDate="2018-04-09T15:50:10.437" Score="0" Body="Quantum superposition is a fundamental principle of quantum mechanics. It states that, much like waves in classical physics, any two (or more) quantum states can be added together (&quot;superposed&quot;) and the result will be another valid quantum state; and conversely, that every quantum state can be represented as a sum of two or more other distinct states. Mathematically, it refers to a property of solutions to the Schrödinger equation. (Wikipedia)" OwnerUserId="11" LastEditorUserId="26" LastEditDate="2019-01-01T09:36:30.170" LastActivityDate="2019-01-01T09:36:30.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1652" PostTypeId="5" CreationDate="2018-04-09T15:53:55.137" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-09T15:53:55.137" LastActivityDate="2018-04-09T15:53:55.137" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1653" PostTypeId="4" CreationDate="2018-04-09T15:53:55.137" Score="0" Body="For questions concerning how to improve quantum computers on different aspects like performance, efficiency or fault-tolerance." OwnerUserId="11" LastEditorUserId="26" LastEditDate="2019-01-01T09:33:50.613" LastActivityDate="2019-01-01T09:33:50.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1654" PostTypeId="1" AcceptedAnswerId="1656" CreationDate="2018-04-09T18:37:41.830" Score="38" ViewCount="8426" Body="&lt;p&gt;This can be seen as the software complement to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1289/how-does-a-quantum-computer-do-basic-math-at-the-hardware-level&quot;&gt;How does a quantum computer do basic math at the hardware level?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question was asked by a member of the audience at the &lt;a href=&quot;http://benasque.org/2017ice4/&quot; rel=&quot;noreferrer&quot;&gt;4th network of the Spanish Network on Quantum Information and Quantum Technologies&lt;/a&gt;. The context the person gave was: &quot;&lt;em&gt;I'm a materials scientist. You are introducing advanced sophisticated theoretical concepts, but I have trouble picturing the practical operation of a quantum computer for a simple task. If I was using diodes, transistors etc I could easily figure out myself the classical operations I need to run to add 1+1. How would you do that, in detail, on a quantum computer?&lt;/em&gt; &quot;.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2018-12-23T14:04:27.660" LastActivityDate="2019-03-23T13:37:39.397" Title="How do I add 1+1 using a quantum computer?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;physical-realization&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="1655" PostTypeId="2" ParentId="1654" CreationDate="2018-04-09T20:16:37.313" Score="5" Body="&lt;p&gt;A new method for computing sums on a quantum computer is introduced. This technique uses the quantum Fourier transform and reduces the number of qubits necessary for addition by removing the need for temporary carry bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://cds.cern.ch/record/450434/files/0008033.pdf&quot; rel=&quot;noreferrer&quot;&gt;PDF link for 'addition on a quantum computer'&lt;/a&gt;, written by Thomas G. Draper, written September 1, 1998, revised: June 15, 2000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize the above link, addition is performed according to the following circuit diagram (taken from page 6):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H0S8T.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H0S8T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quote the paper (again, page 6):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The quantum addition is performed using a sequence of conditional rotations&#xA;  which are mutually commutative. The structure is very similar to the quantum&#xA;  Fourier transform, but the rotations are conditioned on $n$ external bits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1875" LastEditorUserId="91" LastEditDate="2018-04-14T20:16:39.237" LastActivityDate="2018-04-14T20:16:39.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1656" PostTypeId="2" ParentId="1654" CreationDate="2018-04-09T20:34:30.567" Score="25" Body="&lt;p&gt;As per the linked question, the simplest solution is just to &lt;strong&gt;get the classical processor to perform such operations if possible&lt;/strong&gt;. Of course, that may not be possible, so we want to create an &lt;em&gt;adder&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two types of single bit adder - the &lt;em&gt;half-adder&lt;/em&gt; and the &lt;em&gt;full adder&lt;/em&gt;. The half-adder takes the inputs $A$ and $B$ and outputs the 'sum' (XOR operation) $S = A\oplus B$ and the 'carry' (AND operation) $C = A\cdot B$. A full adder also has the 'carry in' $C_{in}$ input and the 'carry out' output $C_{out}$, replacing $C$. This returns $S=A\oplus B\oplus C_{in}$ and $C_{out} = C_{in}\cdot\left(A+B\right) + A\cdot B$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Quantum version of the half-adder&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Looking at the CNOT gate on qubit register $A$ controlling register $B$: \begin{align*}\text{CNOT}_{A\rightarrow B}\left|0\right&amp;gt;_A\left|0\right&amp;gt;_B &amp;amp;= \left|0\right&amp;gt;_A\left|0\right&amp;gt;_B \\ \text{CNOT}_{A\rightarrow B}\left|0\right&amp;gt;_A\left|1\right&amp;gt;_B &amp;amp;= \left|0\right&amp;gt;_A\left|1\right&amp;gt;_B \\\text{CNOT}_{A\rightarrow B}\left|1\right&amp;gt;_A\left|0\right&amp;gt;_B &amp;amp;= \left|1\right&amp;gt;_A\left|1\right&amp;gt;_B \\\text{CNOT}_{A\rightarrow B}\left|1\right&amp;gt;_A\left|1\right&amp;gt;_B &amp;amp;= \left|1\right&amp;gt;_A\left|0\right&amp;gt;_B, \\&#xA;\end{align*} which immediately gives the output of the $B$ register as $A\oplus B = S$. However, we have yet to compute the carry and the state of the $B$ register has changed so we also need to perform the AND operation. This can be done using the 3-qubit Toffoli (controlled-CNOT/CCNOT) gate. This can be done using registers $A$ and $B$ as control registers and initialising the third register $\left(C\right)$ in state $\left|0\right&amp;gt;$, giving the output of the third register as $A\cdot B = C$. Implementing Toffoli on registers $A$ and $B$ controlling register $C$ followed by CNOT with $A$ controlling $B$ gives the output of register $B$ as the sum and the output of register $C$ as the carry. A quantum circuit diagram of the half-adder is shown in figure 1.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p1TU8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p1TU8.png&quot; alt=&quot;Circuit diagram of a half-adder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 1: Circuit Diagram of a half-adder, consisting of Toffoli followed by CNOT. Input bits are $A$ and $B$, giving the sum $S$ with carry out $C$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Quantum version of the full adder&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Shown in figure 2, a simple way of doing this for single bits is by using $4$ qubit registers, here labelled $A$, $B$, $C_{in}$ and $1$, where $1$ starts in state $\left|0\right&amp;gt;$, so the initial state is $\left|A\right&amp;gt;\left|B\right&amp;gt;\left|C_{in}\right&amp;gt;\left|0\right&amp;gt;$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply Toffoli using $A$ and $B$ to control $1$: $\left|A\right&amp;gt;\left|B\right&amp;gt;\left|C_{in}\right&amp;gt;\left|A\cdot B\right&amp;gt;$&lt;/li&gt;&#xA;&lt;li&gt;CNOT with $A$ controlling $B$: $\left|A\right&amp;gt;\left|A\oplus B\right&amp;gt;\left|C_{in}\right&amp;gt;\left|A\cdot B\right&amp;gt;$&lt;/li&gt;&#xA;&lt;li&gt;Toffoli with $B$ and $C_{in}$ controlling $1$: $\left|A\right&amp;gt;\left|A\oplus B\right&amp;gt;\left|C_{in}\right&amp;gt;\left|A\cdot B\oplus\left(A\oplus B\right)\cdot C_{in} = C_{out}\right&amp;gt;$&lt;/li&gt;&#xA;&lt;li&gt;CNOT with $B$ controlling $C_{in}$: $\left|A\right&amp;gt;\left|A\oplus B\right&amp;gt;\left|A\oplus B\oplus C_{in} = S\right&amp;gt;\left|C_{out}\right&amp;gt;$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A final step to get back the inputs $A$ and $B$ is to apply a CNOT with register $A$ controlling register $B$, giving the final output state as $$\left|\psi_{out}\right&amp;gt; = \left|A\right&amp;gt;\left|B\right&amp;gt;\left|S\right&amp;gt;\left|C_{out}\right&amp;gt;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives the output of register $C_{in}$ as the sum and the output of register $2$ as carry out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zHwlR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zHwlR.png&quot; alt=&quot;Quantum version of the full adder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 2: Circuit diagram of a full adder. Input bits are $A$ and $B$ along with a carry in $C_{in}$, giving the sum $S$ with carry out $C_{out}$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Quantum version of the ripple carry adder&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A simple extension of the full adder is a ripple carry adder, named as it 'ripples' the carry out to become the carry in of the next adder in a series of adders, allowing for arbitrarily-sized (if slow) sums. A quantum version of such an adder can be found e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0410184v1&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Actual implementation of a half-adder&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For many systems, implementing a Toffoli gate is far from as simple as implementing a single qubit (or even two qubit) gate. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1661/23&quot;&gt;This answer&lt;/a&gt; gives a way of decomposing Toffoli into multiple smaller gates. However, in real systems, such as &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx&quot; rel=&quot;noreferrer&quot;&gt;IBMQX&lt;/a&gt;, there can also be issues on which qubits can be used as targets. As such, a real life implementation on &lt;a href=&quot;https://github.com/QISKit/ibmqx-backend-information/blob/master/backends/ibmqx2/README.md&quot; rel=&quot;noreferrer&quot;&gt;IBMQX2&lt;/a&gt; looks like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/6Dekg.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Dekg.png&quot; alt=&quot;Single qubit half-adder on IBMQX2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 3: Implementation of a half-adder on IBMQX2. In addition to decomposing the Toffoli gate into multiple smaller gates, additional gates are required as not all qubit registers can be used as targets. Registers q[0] and q[1] are added to get the sum in q[1] and the carry in q[2]. In this case, the result q[2]q[1] should be 10. Running this on the processor gave the correct result with a probability of 42.8% (although it was still the most likely outcome).&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-14T14:37:33.730" LastActivityDate="2018-04-14T14:37:33.730" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1657" PostTypeId="1" AcceptedAnswerId="1659" CreationDate="2018-04-10T00:46:03.353" Score="17" ViewCount="2069" Body="&lt;p&gt;The term &quot;&lt;em&gt;&lt;a href=&quot;https://www.quantiki.org/wiki/church-larger-hilbert-space&quot; rel=&quot;noreferrer&quot;&gt;Church of the Higher Hilbert Space&lt;/a&gt;&lt;/em&gt;&quot; is used in quantum information frequently when analysing quantum channels and quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this term mean (or, alternately, what does the term &quot;Going to To the Church of the Higher Hilbert Space&quot; mean)?&lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="26" LastEditDate="2019-01-01T09:05:35.643" LastActivityDate="2019-01-01T09:05:35.643" Title="Significance of The Church of the Higher Hilbert space" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1658" PostTypeId="2" ParentId="1657" CreationDate="2018-04-10T01:35:45.070" Score="8" Body="&lt;p&gt;&quot;Church of the higher hilbert space&quot; is a term coined by John Smolin. According to &lt;a href=&quot;https://www.quantiki.org/wiki/church-larger-hilbert-space&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantiki&lt;/a&gt; it is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;for the dilation constructions of channels and states, which [...] provide a neat characterization of the set of permissible quantum operations&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and to quote &lt;a href=&quot;https://en.wikipedia.org/wiki/John_A._Smolin&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;, it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;describe[s] the habit of regarding every mixed state of a quantum system as a pure entangled state of a larger system, and every irreversible evolution as a reversible (unitary) evolution of a larger system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://physics.stackexchange.com/questions/35648/if-i-go-to-the-church-of-the-greater-hilbert-space-can-i-have-unitary-collapse?utm_medium=organic&amp;amp;utm_source=google_rich_qa&amp;amp;utm_campaign=google_rich_qa&quot;&gt;this Physics.SE answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-04-12T00:10:53.753" LastActivityDate="2018-04-12T00:10:53.753" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1659" PostTypeId="2" ParentId="1657" CreationDate="2018-04-10T06:02:30.410" Score="22" Body="&lt;p&gt;The church of the larger (or higher, or greater) Hilbert space is just a trick that some people like (myself included) for rewriting some operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most general operations that you can write down for a system are described by completely positive maps, while we like describing things with unitaries, which you can always do by moving from the original Hilbert space to a larger one (i.e. adding more qubits). Similarly, for measurements, you can turn general measurements into projective measurements by increasing the size of the Hilbert space. Also, mixed states can be described as pure states of a larger system.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Consider the map that takes a qubit and with probability $1-p$ does nothing, and with probability, $p$ applies the bit-flip operation $X$:&#xA;$$&#xA;|\psi\rangle\langle\psi|\mapsto (1-p)|\psi\rangle\langle\psi|+pX|\psi\rangle\langle\psi|X&#xA;$$&#xA;This is not unitary, but you can describe it as a unitary on two qubits (i.e. by moving from a Hilbert space dimension 2 to Hilbert space dimension 4). This works by introducing an extra qubit in the state $\sqrt{1-p}|0\rangle+\sqrt{p}|1\rangle$ and performing a controlled-not controlled by the new qubit and targeting the original one.&#xA;$$&#xA;|\psi\rangle(\sqrt{1-p}|0\rangle+\sqrt{p}|1\rangle)\mapsto|\Psi\rangle=\sqrt{1-p}|\psi\rangle|0\rangle+\sqrt{p}\left(X|\psi\rangle\right)|1\rangle.&#xA;$$&#xA;To get back the action of the system on just the original qubit, you trace out the new qubit:&#xA;$$&#xA;\rho={\rm Tr}_2\left(|\Psi\rangle\langle\Psi|\right)= (1-p)|\psi\rangle\langle\psi|+pX|\psi\rangle\langle\psi|X.&#xA;$$&#xA;In other words, you just ignore the existence of the new qubit after you’ve implemented the unitary! Note that as well as demonstrating the church of the larger Hilbert space for operations, this also demonstrates it for states - the mixed state $\rho$ can be made into the pure state $|\Psi\rangle$ by increasing the size of the Hilbert space.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-11T07:24:43.767" LastActivityDate="2018-04-11T07:24:43.767" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1660" PostTypeId="1" CreationDate="2018-04-10T13:33:34.807" Score="7" ViewCount="204" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;&quot;Quantum magic won't be enough&quot;&lt;/em&gt; (Bennett et al. 1997)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If you throw away the problem structure, and just consider the space of $2^n$ possible solutions, then even a quantum computer needs about $\sqrt{2^n}$ steps to find the correct one (using Grover's algorithm)&#xA;  If a quantum polynomial time algorithm for an $\text{NP}$-complete problem is ever found, it &lt;b&gt;must&lt;/b&gt; exploit the problem structure in some way.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(...)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I've some (basic) questions that no one seems to have asked so far on this site (maybe because they are basic). Suppose someone finds a bounded error quantum polynomial time algorithm for $\text{SAT}$ (or any other $\text{NP}$-complete problem), thus placing $\text{SAT}$ in $\text{BQP}$, and implying $\text{NP} \subseteq \text{BQP}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Questions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Which would be the theoretical consequences of such a discovery? How would the overall picture of complexity classes be affected? Which classes would become equal to which others?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;a href=&quot;https://cstheory.stackexchange.com/questions/6154/consequences-of-sat-in-bqp&quot;&gt;Source&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="1847" LastEditDate="2018-04-27T16:50:58.827" LastActivityDate="2018-04-27T16:50:58.827" Title="Consequences of SAT ∈ BQP" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;bqp&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1661" PostTypeId="2" ParentId="1654" CreationDate="2018-04-10T13:36:03.373" Score="6" Body="&lt;p&gt;``&lt;em&gt;If I was using diodes, transistors etc I could easily figure out myself the classical operations I need to run to add 1+1. How would you do that, in detail, on a quantum computer?&lt;/em&gt;''&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Impressive! I suspect that most people cannot easily figure out themselves how to combine diodes and transistors to implement a classical two-bit adde (though I do not doubt this material scientist can probably do it). ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretically, the way you implement a classical adder is pretty similar in a classical and quantum computer: you can do that in both cases by implementing a &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;noreferrer&quot;&gt;Toffoli gate&lt;/a&gt;! (See @Mithrandir24601's answer.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the material scientist probably wants to understand how to implement such an gate (or an equivalence sequence of other quantum gates) on a physical device. There are probably an infinite ways to do that using different quantum technologies, but here are two direct realizations of this gate using trapped ions and superconducting qubits:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Realization of the Quantum Toffoli Gate with Trapped Ions, T. Monz, K. Kim, W. Hänsel, M. Riebe, A. S. Villar, P. Schindler, M. Chwalla, M. Hennrich, and R. Blatt, &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.102.040501&quot; rel=&quot;noreferrer&quot;&gt;Phys. Rev. Lett. 102&lt;/a&gt;, 040501, &lt;a href=&quot;https://arxiv.org/abs/0804.0082&quot; rel=&quot;noreferrer&quot;&gt;arXiv:0804.0082&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Implementation of a Toffoli gate with superconducting circuits&#xA;A. Fedorov, L. Steffen, M. Baur, M. P. da Silva &amp;amp; A. Wallraff&#xA;&lt;a href=&quot;https://www.nature.com/articles/nature10713&quot; rel=&quot;noreferrer&quot;&gt;Nature 481&lt;/a&gt;, 170–172, &lt;a href=&quot;https://arxiv.org/abs/1108.3966&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1108.3966&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can also decompose the Toffoli gate as a sequence of single-qubit and CNOT gates. &#xA;&lt;a href=&quot;https://media.nature.com/lw926/nature-assets/srep/2016/160802/srep30600/images/srep30600-f5.jpg&quot; rel=&quot;noreferrer&quot;&gt;https://media.nature.com/lw926/nature-assets/srep/2016/160802/srep30600/images/srep30600-f5.jpg&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/6FIMq.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6FIMq.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;You can read about how to implement these with photonics, cavity-QED and trapped ions in &lt;a href=&quot;http://www.michaelnielsen.org/qcqi/&quot; rel=&quot;noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1779" LastActivityDate="2018-04-10T13:36:03.373" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1663" PostTypeId="1" AcceptedAnswerId="1668" CreationDate="2018-04-10T16:16:02.317" Score="3" ViewCount="2598" Body="&lt;h2&gt;Context&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Lately, I have been reading a scholarly paper entitled &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9809016&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Introduction to Quantum Computing for Non-Physicists&lt;/a&gt; which discusses the &lt;a href=&quot;https://en.wikipedia.org/wiki/EPR_paradox&quot; rel=&quot;nofollow noreferrer&quot;&gt;EPR Paradox&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9809016&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; states that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Einstein, Podolsky and Rosen proposed a gedanken experiment that uses entangled particles in a manner that seemed to violate fundamental principles of relativity.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It concludes that the paradox is resolved as the symmetry shown by changing observers indicates that they cannot use their EPR pair to communicate faster than the speed of light. However, the paper fails to adequately explain what an EPR pair is used for and does not even define the term. The best definition I could find is referenced to in the Wikipedia article, &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell state&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An EPR pair is a pair of qubits (or quantum bits) that are in a Bell state together.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This definition doesn't provide much detail beyond the basics of what an EPR pair is.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;The Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How are EPR Pairs used in quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="82" LastEditorUserId="1847" LastEditDate="2018-04-18T18:37:02.110" LastActivityDate="2018-04-18T18:37:02.110" Title="How are EPR Pairs used in quantum computing?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;quantum-state&gt;&lt;correlations&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1664" PostTypeId="1" AcceptedAnswerId="1666" CreationDate="2018-04-10T16:34:37.553" Score="6" ViewCount="296" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;&amp;quot;Quantum magic won't be enough&amp;quot;&lt;/em&gt; (Bennett et al. 1997)&lt;/p&gt;&#xA;&lt;p&gt;If you throw away the problem structure, and just consider the space of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible solutions, then even a quantum computer needs about &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2^n}$&lt;/span&gt; steps to find the correct one (using Grover's algorithm)&#xA;If a quantum polynomial time algorithm for a &lt;span class=&quot;math-container&quot;&gt;$\text{NP}$&lt;/span&gt;-complete problem is ever found, it &lt;b&gt;must&lt;/b&gt; exploit the problem structure in some way.&#xA;I've some (basic) questions that no one seems to have asked so far on this site (maybe because they are basic). Suppose someone finds a bounded error quantum polynomial time algorithm for &lt;span class=&quot;math-container&quot;&gt;$\text{SAT}$&lt;/span&gt; (or any other &lt;span class=&quot;math-container&quot;&gt;$\text{NP}$&lt;/span&gt;-complete problem), thus placing &lt;span class=&quot;math-container&quot;&gt;$\text{SAT}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\text{BQP}$&lt;/span&gt;, and implying &lt;span class=&quot;math-container&quot;&gt;$\text{NP} \subseteq \text{BQP}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Questions&lt;/h2&gt;&#xA;&lt;p&gt;The possibility (or not) to exploit the problem structure in a general enough (i.e. specific-instance independent) manner seems to be the very core of the &lt;span class=&quot;math-container&quot;&gt;$\text{P = NP}$&lt;/span&gt; question. Now if a bounded error polynomial-time quantum algorithm for &lt;span class=&quot;math-container&quot;&gt;$\text{SAT}$&lt;/span&gt; is found, and it &lt;em&gt;must&lt;/em&gt; exploit the problem structure, wouldn't its structure-exploitation-strategy be usable also in the classical scenario? Is there any evidence indicating that such a structure-exploitation may be possible for quantum computers, while remaining impossible for classical ones?&lt;/p&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://books.google.ch/books?id=Ul1RDwAAQBAJ&amp;amp;pg=PT112&amp;amp;lpg=PT112&amp;amp;dq=SAT%E2%88%88BQP&amp;amp;source=bl&amp;amp;ots=I4FvjLMbxm&amp;amp;sig=HLPf5gMqJjTtpHwBnkxJ1oRQWVI&amp;amp;hl=fr&amp;amp;sa=X&amp;amp;ved=0ahUKEwjky7rK7K_aAhXJC8AKHYkJDr0Q6AEIOzAC#v=onepage&amp;amp;q=SAT%E2%88%88BQP&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;Sources&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1660/consequences-of-textsat-in-textbqp&quot;&gt;Related&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-10T18:12:59.743" Title="Quantum Algorithm SAT structure" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1665" PostTypeId="2" ParentId="1289" CreationDate="2018-04-10T17:54:36.817" Score="19" Body="&lt;p&gt;Here is my process for doing arithmetic on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1: Find a classical circuit that does the thing you're interested in.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example, a full adder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5sRyc.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5sRyc.png&quot; alt=&quot;classical full adder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2: Convert each classical gate into a reversible gate.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have your output bits present from the start, and initialize them with CNOTs, CCNOTs, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VUqY6.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VUqY6.png&quot; alt=&quot;semi-reversible full adder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3: Use temporary outputs.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were doing this addition to e.g. control whether a Grover oracle phases by -1 or not, now is the time to apply a Z gate to your output qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4: Get rid of intermediate values by doing exactly the opposite of what you did to compute them.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may or may not include getting rid of the output bits, depending on how the circuit fits into your overall algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6HfGR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6HfGR.png&quot; alt=&quot;semi-reversible full adder 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 5: (Sometimes) for each output bit you keep, get rid of an input bit.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I don't mean &quot;drop them on the floor&quot;, I mean apply operations that cause them to become 0 for sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you compute &lt;code&gt;c+=a&lt;/code&gt;, leaving behind a copy of the original value of &lt;code&gt;c&lt;/code&gt; tends to be bad. It destroys coherence. So you must look at your adder circuit (or whatever), and think hard about if there's a way to use your output bits to get rid of your input bits. For example, after computing &lt;code&gt;c+a&lt;/code&gt; you could do a temporary out-of-place subtraction into a register r, xor r into the register storing the unwanted copy of &lt;code&gt;c&lt;/code&gt;, then revert the temporary subtraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(A notable exception to &quot;if you keep your output, don't keep so much of your input&quot; is Shor's algorithm. Shor's algorithm decoheres its input &lt;em&gt;on purpose&lt;/em&gt;, but in a very particular way that helps with period finding.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 6: Be efficient&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In step 5 I said you could uncompute the input of an inplace addition by doing an out of place addition followed by a temporary out-of-place subtraction. This is a bit silly. The overall adding process is going to span 4n qubits (n to hold &lt;code&gt;a&lt;/code&gt;, n to hold &lt;code&gt;c&lt;/code&gt;, n to hold &lt;code&gt;c+a&lt;/code&gt;, n to hold &lt;code&gt;(c+a)-a&lt;/code&gt;). If you are more clever, &lt;a href=&quot;https://dl.acm.org/citation.cfm?id=2011672&quot; rel=&quot;noreferrer&quot;&gt;you can fit everything into &lt;code&gt;2n&lt;/code&gt; qubits&lt;/a&gt; or (slightly easier) &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0410184&quot; rel=&quot;noreferrer&quot;&gt;into &lt;code&gt;2n+1&lt;/code&gt; qubits&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZcZqL.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZcZqL.png&quot; alt=&quot;cuccaro adder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-04-10T18:03:32.747" LastActivityDate="2018-04-10T18:03:32.747" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1666" PostTypeId="2" ParentId="1664" CreationDate="2018-04-10T18:12:59.743" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;wouldn't its structure-exploitation-strategy be usable also in the classical scenario?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessarily. For example, Shor's algorithm exploits the structure of factoring in a way that classical computers can't. Specifically, Shor's algorithm looks for periods in the multiplicative subgroup of N-1 in a way that requires a quantum Fourier transform to be efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes quantum algorithms do translate back into the classical domain. For example, you can use phase estimation to apply fractional QFTs in an efficient way. &lt;a href=&quot;http://algassert.com/post/1710&quot; rel=&quot;nofollow noreferrer&quot;&gt;Translate this circuit directly into its classical equivalent, and you get an O(N log(N)) algorithm for fractional FFTs&lt;/a&gt;. But there's certainly no guarantees that what works well in the quantum context will work well in the classical context.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-04-10T18:12:59.743" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1667" PostTypeId="1" AcceptedAnswerId="1672" CreationDate="2018-04-10T18:24:33.557" Score="6" ViewCount="847" Body="&lt;blockquote&gt;&#xA;&lt;ol start=&quot;9&quot;&gt;&#xA;&lt;li&gt;Show that the average value of the observable &lt;span class=&quot;math-container&quot;&gt;$X_1Z_2$&lt;/span&gt; in a two-qubit system measured in the state &lt;span class=&quot;math-container&quot;&gt;$(|00\rangle + |11\rangle)/\sqrt{2}$&lt;/span&gt; is zero.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How would we approach this question? I understand that &lt;span class=&quot;math-container&quot;&gt;$X_1$&lt;/span&gt; means &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; acting on the first qubit, and &lt;span class=&quot;math-container&quot;&gt;$Z_2$&lt;/span&gt; means &lt;span class=&quot;math-container&quot;&gt;$\sigma_3$&lt;/span&gt; acting on the second qubit. I also know that the average value is given by &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi\vert M\vert \psi\right&amp;gt;$&lt;/span&gt; (the inner product of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M \psi$&lt;/span&gt;). I know how to solve similar problems for a single qubit system, however what confuses me here is what is the vector representation of the states &lt;span class=&quot;math-container&quot;&gt;$\left| 00\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| 11\right&amp;gt;$&lt;/span&gt; and how is this related to the vector representation of &lt;span class=&quot;math-container&quot;&gt;$\left| 0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| 1\right&amp;gt;$&lt;/span&gt;? Also, what is the matrix form of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; in this case? Is it the tensor product of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; applied to the first qubit and &lt;span class=&quot;math-container&quot;&gt;$\sigma_3$&lt;/span&gt; applied to the second qubit?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.physics.ohio-state.edu/%7Estroud/p880k20ps2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source of the question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1919" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-09-05T10:54:28.677" Title="How to compute the average value $\langle X_1 Z_2\rangle$ for a two-qubit system?" Tags="&lt;quantum-state&gt;&lt;notation&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1668" PostTypeId="2" ParentId="1663" CreationDate="2018-04-10T20:18:16.233" Score="4" Body="&lt;p&gt;&lt;strong&gt;EPR pairs are&lt;/strong&gt; a particular case of &lt;strong&gt;entangled pairs of qubits&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Wikipedia: &quot;&lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum entanglement&lt;/a&gt; is a physical phenomenon which occurs when pairs or groups of particles are generated or interact in ways such that the quantum state of each particle cannot be described independently of the state of the other.&lt;/em&gt;&quot; More to the point regarding your question, &lt;strong&gt;entanglement is a crucially important resource for quantum computing&lt;/strong&gt;, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Bennett&amp;#39;s_laws&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bennet's laws&lt;/a&gt; on the inequivalences between bits, qubits and &lt;strong&gt;ebits&lt;/strong&gt; (or entanglement bits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Elementary cases of use of EPR pairs in quantum computing would be &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superdense coding&lt;/a&gt;, and upon those pieces people have built more sophisticated applications. For the gory details of the original proposal for quantum teleportation, please check Bennet's &lt;a href=&quot;https://researcher.watson.ibm.com/researcher/files/us-bennetc/BBCJPW.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen Channels&lt;/a&gt; (Phys.Rev.Lett., 1993, 70, 1895-1899).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more sophisticated application, please check this answer on &lt;a href=&quot;https://physics.stackexchange.com/questions/270032/whats-the-intuition-behind-the-choi-jamiolkowski-isomorphism&quot;&gt;the intuition behind the Choi-Jamiolkowski isomorphism&lt;/a&gt;, which also heavily relies on maximally entangled qubit pairs. In turn, the application of this isomorphism was suggested to me, here, a couple of days ago, as an answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1634/can-one-interrogate-black-boxes-for-quantum-coherence&quot;&gt;how to obtain information on what quantum logic a quantum black box is implementing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-10T20:25:42.807" LastActivityDate="2018-04-10T20:25:42.807" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1669" PostTypeId="2" ParentId="1648" CreationDate="2018-04-10T22:48:09.040" Score="9" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Is Quantum Biocomputing ahead of us?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There has been some work done on &lt;a href=&quot;https://en.wikipedia.org/wiki/Biological_computing&quot; rel=&quot;noreferrer&quot;&gt;biocomputing&lt;/a&gt;, &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;quantum computing&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Spin_chemistry&quot; rel=&quot;noreferrer&quot;&gt;spin chemistry&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Magnetochemistry&quot; rel=&quot;noreferrer&quot;&gt;magnetochemical&lt;/a&gt; reactions.&lt;/p&gt;&#xA;&lt;p&gt;Correlated radical pairs — pairs of transient radicals created simultaneously, such that the 2 electron spins, one on each radical, are correlated — on photoactive magnetoreceptive proteins such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Cryptochrome#Magnetoreception&quot; rel=&quot;noreferrer&quot;&gt;Cryptochromes&lt;/a&gt; does not constitute quantum computation.&lt;/p&gt;&#xA;&lt;p&gt;See: &amp;quot;&lt;a href=&quot;http://jeb.biologists.org/content/207/7/1193&quot; rel=&quot;noreferrer&quot;&gt;Light-dependent magnetoreception in birds: analysis of the behaviour under red light after pre-exposure to red light&lt;/a&gt;&amp;quot; by W. Wiltschko, Gesson, Noll, and R. Wiltschko in the Journal of Experimental Biology, 2004.&lt;/p&gt;&#xA;&lt;p&gt;See the article &amp;quot;&lt;a href=&quot;http://quantbiolab.com/research/vision-based-animal-magnetoreception&quot; rel=&quot;noreferrer&quot;&gt;Vision-based animal magnetoreception&lt;/a&gt;&amp;quot; at the QuantBioLab website, Quantum Biology and Computational Physics research group, University of Southern Denmark (SDU):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H5O5j.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H5O5j.jpg&quot; alt=&quot;Forward reaction MFeffect&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 6. Shown here is a semi-classical description of the magnetic field effect on the radical pairs between FADH and tryptophan in cryptochrome. The unpaired electron spins (S&lt;span class=&quot;math-container&quot;&gt;$_1$&lt;/span&gt; and S&lt;span class=&quot;math-container&quot;&gt;$_2$&lt;/span&gt;) precess about a local magnetic field produced by the addition of the external magnetic field &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; with contributions I&lt;span class=&quot;math-container&quot;&gt;$_1$&lt;/span&gt; and I&lt;span class=&quot;math-container&quot;&gt;$_2$&lt;/span&gt; from the nuclear spins on the two radicals. The spin precession continuously alters the relative spin orientation, causing the singlet (anti-parallel) to triplet (parallel) interconversion which underlies the magnetic field effect. Electron back-transfer from a tryptophan to FADH quenches cryptochrome's active state. However, this back-transfer can only take place when the electron spins are in the singlet state, and this spin-dependence allows the external magnetic field, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, to affect cryptochrome activation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TQTmV.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TQTmV.jpg&quot; alt=&quot;Retina Components&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 7. Schematic illustration of a bird's eye and its important components. The retina (a) converts images from the eye's optical system into electrical signals sent along the ganglion cells forming the optic nerve to the brain. (b) An enlarged retina segment is shown schematically. (c) The retina consists of several cell layers. The primary signals arising in the rod and cone outer segments are passed to the horizontal, the bipolar, the amacrine, and the ganglion cells. (d) The primary phototransduction signal is generated in the receptor protein rhodopsin shown schematically at a much reduced density. The rhodopsin containing membranes form disks with a thickness of ~20 nm, being ~15–20 nm apart from each other. The putatively magnetic-field-sensitive protein cryptochrome may be localized in a specifically oriented fashion between the disks of the outer segment of the photoreceptor cell, as schematically shown in panel d or the cryptochromes (e) may be attached to the oriented, quasi-cylindrical membrane of the inner segment of the photoreceptor cell (f).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;In mathematical terms, the vision-based compass in birds is characterized by a filter function, which models the magnetic field-mediated visual signal modulation recorded on the bird's retina (see Fig. 8).&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KROxn.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KROxn.jpg&quot; alt=&quot;Filer Function&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Figure 8. Panoramic view at Frankfurt am Main, Germany. The image shows the landscape perspective recorded from a bird flight altitude of 200 m above ground with the cardinal directions indicated. The visual field is modified through the magnetic filter function; the patterns are shown for a bird looking at eight cardinal directions (N, NE, E, SE, S, SW, W, and NW). The geomagnetic field inclination angle is 66°, being a characteristic value for the region.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A bio&lt;a href=&quot;https://en.wikipedia.org/wiki/Mechanical_computer&quot; rel=&quot;noreferrer&quot;&gt;mechanical computer&lt;/a&gt; has been created. &lt;a href=&quot;http://bio4comp.org/&quot; rel=&quot;noreferrer&quot;&gt;Bio4Comp&lt;/a&gt;, an EU-funded research project, have created biomolecular machines each only a few billionths of a meter (nanometers) in size. The actin-myosin and microtubule-kinesin motility systems can solve problems by moving through a nanofabricated network of channels designed to represent a mathematical algorithm; an approach we termed “network-based biocomputation”. Whenever the biomolecules reach a junction in the network, they either add a number to the sum they are calculating or leave it out. That way, each biomolecule acts as a tiny computer with processor and memory. While an individual biomolecule is much slower than a current computer, they are self-assembling so that they can be used in large numbers, quickly adding up their computing power. An example of how this works is shown in the video on their website.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0UiCq.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0UiCq.jpg&quot; alt=&quot;WP4 SEM channels (full with scalebar corrected)&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Are these tools already solving problems you (quantum computing researchers) have?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any specific issue these tools 'must' be solving somehow that you are struggling with at your labs?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Could we use them (although this will imply a paradigm shift towards biotechnology)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&amp;quot;The first step in solving mathematical problems with network-based biocomputation is to encode the problem into network format so that molecular motors exploring the network can solve the problem. We have already found network encodings for several NP-complete problems, which are particularly hard to solve with electronic computers. For example, &lt;strong&gt;we have encoded subset sum, exact cover, boolean satisfiability and travelling salesman&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Within the Bio4Comp project, we will focus on optimizing these encodings so that they can be efficiently solved with biological agents and be more readily scaled up. Analogous to optimized computer algorithms, optimized networks can greatly reduce the computing power (and thus the number of motor proteins) required for finding the correct solution.&amp;quot; - Source: &lt;a href=&quot;http://bio4comp.org/research.html&quot; rel=&quot;noreferrer&quot;&gt;Bio4Comp Research&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Another interesting paper which supports my answer that radical pairs don't constitute a quantum computer, but is merely a quantum biochemical reaction demonstrating spin chemistry, is &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1011.5495&quot; rel=&quot;noreferrer&quot;&gt;Quantum probe and design for a chemical compass with magnetic nanostructures&lt;/a&gt;&amp;quot; by Jianming Cai (2018).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Introduction.&lt;/strong&gt; — Recently, there has been increasing interest in quantum biology namely investigating quantum effects in chemical and biological systems, e.g., light harvesting system, avian compass and olfactory sense. The main motivation is to understand how quantum coherence (entanglement) may be exploited for the accomplishment of biological functions. As a key step towards this goal, it is desirable to find tools that can detect quantum effects under ambient conditions. The ultimate goal of practical interest in studying quantum biology is to learn from nature and design highly efficient devices that can mimic biological systems in order to complete important tasks, e.g. collecting solar energy and detecting weak magnetic field.&lt;/p&gt;&#xA;&lt;p&gt;As an example of quantum biology, the radical pair mechanism is an intriguing hypothesis to explain the ability of some species to respond to weak magnetic fields, e.g. birds, fruit flies, and plants. A magnetochemical compass could find applications in remote magnetometry, in a magnetic mapping of microscopic or topographically complex materials, and in imaging through scattering media. It was demonstrated that a synthetic donor-bridge-acceptor compass composed of a linked carotenoid (C), porphyrin (P), and fullerene (F) can work at low temperature (193 K). It is surprising that such a triad molecule is the only known example that has been experimentally demonstrated to be sensitive to the geomagnetic field (yet not at room temperature). It is currently not known how one might construct a biomimetic or synthetic chemical compass that functions at ambient temperature.&lt;/p&gt;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Summary.&lt;/strong&gt; — We have demonstrated that a gradient field can lead to a significant enhancement of the performance of a chemical compass. The gradient field also provides us with a powerful tool to investigate &lt;strong&gt;quantum dynamics of radical pair reactions in spin chemistry&lt;/strong&gt;. In particular, it can distinguish whether the initial &lt;strong&gt;radical pair state is in the entangled singlet state or in the classically correlated state, even in the scenarios where such a goal could not be achieved before&lt;/strong&gt;. These phenomena persist upon addition of partial orientational averaging and addition of realistic magnetic noise. The effects predicted there may be detectable in a hybrid system compass composed of magnetic nanoparticles and radical pairs in an oriented liquid crystalline host. Our work offers a simple method to design/simulate a biologically inspired weak magnetic field sensor based on the radical pair mechanism with a high sensitivity that may work at room temperature.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="278" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-11T11:02:39.970" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1670" PostTypeId="2" ParentId="1667" CreationDate="2018-04-11T02:37:18.283" Score="1" Body="&lt;p&gt;Notationally, $|00\rangle = |0\rangle \otimes |0\rangle$. A basic property of tensor products is that inner products split like so: $$(\langle 0|_A \otimes \langle 0|_B) O_A\otimes O_B (|0\rangle_A \otimes |0\rangle_B) = \langle0|O_A|0\rangle \cdot \langle0|O_B|0\rangle.$$&lt;/p&gt;&#xA;" OwnerUserId="483" LastActivityDate="2018-04-11T02:37:18.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1671" PostTypeId="2" ParentId="1648" CreationDate="2018-04-11T04:18:32.137" Score="3" Body="&lt;p&gt;Much has been written about &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_biology&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Biology&lt;/a&gt;. A somewhat old -and yet, solid- take is that of Phillip Ball, &lt;a href=&quot;https://www.philipball.co.uk/images/stories/docs/pdf/474272.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The dawn of Quantum Biology&lt;/a&gt; (Nature 2011, 474, 271-274). For now, let's not review that and instead focus on your questions.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On the first question:&lt;/strong&gt;(&lt;em&gt;is it solving our problems?&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A system (or process) described by &lt;strong&gt;Quantum Biology is non-trivially quantum-mechanic&lt;/strong&gt;, and therefore interesting, but to the best of my knowledge it is also &lt;strong&gt;not multi-qubit&lt;/strong&gt;, so not really what quantum computing is about. In particular: currently known quantum biological processes do not present scalability, and neither do they present quantum logical gates (or not in the way we understand them at least), much less so quantum algorithms. So, as an answer, that's mainly a no: these tools are not solving our problems.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On the second question:&lt;/strong&gt;(&lt;em&gt;is it solving a specific issue we're struggling with?&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reliable quantum coherence on the solid state, in complex structured systems and at high temperature&lt;/strong&gt; is something we all would like to see solved, and, at least to some point, this is what Quantum Biology is about. So, as far as the current understanding of the field goes, this is indeed a specific issue that people in labs are working on and which seems solved in Biology (since molecules are complex nanostructures). Whenever we are able in our labs to reliably achieve quantum coherence in the solid state, in complex structured systems and at high temperature, we will jump much closer to usefulness and cheapness. So, as an answer, that is a yes.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On the third question:&lt;/strong&gt;(&lt;em&gt;could we use biomolecules as quantum hardware?&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are not in the main league yet, to say the least. Even as an optimistic speculation, I'd say that they &lt;strong&gt;will not be competing with the big players&lt;/strong&gt; any time soon, but I do believe that, as research advances past &lt;a href=&quot;https://en.wikipedia.org/wiki/DNA_origami&quot; rel=&quot;nofollow noreferrer&quot;&gt;DNA origami&lt;/a&gt; (and related strategies) in Molecular Biology and Synthetic Biology, at some point &lt;strong&gt;biomolecular qubits will play a role within the subset of molecular spin qubits&lt;/strong&gt;. In particular, the keys to relevance would be to combine the (seemingly proven) coherence in unusual conditions (warm, wet), with the unmatched ability of biomolecules for extremely complex self-organisation into functional structures. Since (coherent, organized) molecular spin qubits are my field of research, let me link to a couple of relevant papers. First, a first reaction on the first magnetic molecule that was competitive in terms of coherence with regular solid-state candidates, and thus how&#xA;&lt;a href=&quot;https://pubs.acs.org/doi/full/10.1021/acscentsci.5b00384&quot; rel=&quot;nofollow noreferrer&quot;&gt;magnetic molecules are back in the race toward the quantum computer&lt;/a&gt;. And also, this proposal (disclosure: I'm an author) on the arXiv on why and how one could use &lt;a href=&quot;https://arxiv.org/pdf/1708.09440.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;peptides as versatile scaffolds for quantum computing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-21T09:38:03.360" LastActivityDate="2018-04-21T09:38:03.360" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1672" PostTypeId="2" ParentId="1667" CreationDate="2018-04-11T06:43:50.143" Score="11" Body="&lt;p&gt;I suggest two different ways of trying to solve this, which will give you experience of different bits of the formulation of Quantum Information Theory. I'll give examples that are closely related to the question you asked, but are not what you asked so that you still get the value of answering the question yourself.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Long-hand Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Represent the kets as vectors, the Pauli matrices as matrices, explicitly perform the tensor products, and multiply everything out. So, we represent&#xA;$$&#xA;|0\rangle\equiv\left(\begin{array}{c} 1 \\ 0 \end{array}\right)\qquad|1\rangle\equiv\left(\begin{array}{c} 0 \\ 1 \end{array}\right)&#xA;$$&#xA;To calculate the tensor product, such as $|01\rangle$, we do&#xA;$$&#xA;|01\rangle=|0\rangle\otimes|1\rangle\equiv\left(\begin{array}{c}1\times\left(\begin{array}{c} 0 \\ 1 \end{array}\right)\\ 0\times \left(\begin{array}{c} 0 \\ 1 \end{array}\right) \end{array}\right)=\left(\begin{array}{c} 0 \\ 1 \\ 0 \\ 0 \end{array}\right)&#xA;$$&#xA;Remember that $\langle 01|$ is just the Hermitian conjugate of this,&#xA;$$&#xA;\langle 01|=\left(\begin{array}{cccc} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{array}\right)&#xA;$$&#xA;Then you do something similar for the operators. For example, $$X_1X_2=\sigma_1\otimes\sigma_1=\left(\begin{array}{cc} 0\times \left(\begin{array}{cc} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{array}\right) &amp;amp; 1\times \left(\begin{array}{cc} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{array}\right) \\ 1\times \left(\begin{array}{cc} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{array}\right) &amp;amp; 0\times \left(\begin{array}{cc} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{array}\right) \end{array}\right)=\left(\begin{array}{cccc} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{array}\right).&#xA;$$&#xA;Once you have all of this, you simply multiply it out:&#xA;$$&#xA;\langle 01|X_1X_2|01\rangle=\left(\begin{array}{cccc} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{array}\right)\left(\begin{array}{cccc} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{array}\right)\left(\begin{array}{c} 0 \\ 1 \\ 0 \\ 0 \end{array}\right)=0.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Shorter Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;(With experience, this method lets you perform this calculation just by looking at it! Of course, when giving an answer, I don't recommend that; you should always justify your answer.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember to think of each term $|01\rangle$ as $|0\rangle\otimes|1\rangle$. So, when you also write $X_1X_2=\sigma_1\otimes\sigma_1$, you see that&#xA;$$&#xA;(\sigma_1\otimes\sigma_1)|0\rangle\otimes|1\rangle=(\sigma_1|0\rangle)\otimes(\sigma_1|1\rangle)&#xA;$$&#xA;i.e. when everything is just tensor products, individual terms match up. Now, hopefully you know the action of $\sigma_1$ and $\sigma_3$ on the basis states:&#xA;$$&#xA;\sigma_1|0\rangle=|1\rangle\qquad \sigma_1|1\rangle=|0\rangle \qquad \sigma_3|0\rangle=|0\rangle \qquad \sigma_3|1\rangle=-|1\rangle&#xA;$$&#xA;Thus,&#xA;$$&#xA;(\sigma_1|0\rangle)\otimes(\sigma_1|1\rangle)=|1\rangle\otimes |0\rangle=|10\rangle&#xA;$$&#xA;One can then easily observe that a state such as $(|01\rangle+|10\rangle)/\sqrt{2}$ is acted on by $X_1X_2$ to give&#xA;$$&#xA;X_1X_2(|01\rangle+|10\rangle)/\sqrt{2}=(|01\rangle+|10\rangle)/\sqrt{2},\tag{1}&#xA;$$&#xA;the same state. So it is clear that the inner product of the state with itself is 1:&#xA;$$&#xA;(\langle 01|+\langle 10|)X_1X_2(|01\rangle+|10\rangle)/2=1.&#xA;$$&#xA;On the other hand, had the outcome in Eq. (1) been a different one of the four Bell states, because we know the Bell states form an orthonormal basis, the expectation value would be 0.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-11T06:43:50.143" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1673" PostTypeId="2" ParentId="1602" CreationDate="2018-04-11T08:48:57.407" Score="3" Body="&lt;p&gt;The preferred basis problem is essentially something from the many worlds interpretation: If we are to interpret a superposition as representing many universes, what basis should we choose? Since this comes from the foundations of QM, this aspect of your question is perhaps better suited to the physics stack exchange.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a preferred basis for a qudit or does it depend upon the&#xA;  underlying technology used to implement the qudits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For qudits (and qubits) the only distinction between bases is in the physical implementation. At the abstract mathematical level, all are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This not only means that you are free to choose your computational basis. You also have some freedom in how to generalize the Pauli matrices. For a $d$ level qudit, for example, you could choose to label your basis states with the elements of a group with order $d$. Your can then define generalizations of Pauli $X$ that implement the group multiplication, and generalization of $Z$ that depend on the representations. See &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9707021&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for some examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you choose to do this might depend on the physics of the qudits (perhaps the interactions naturally implement such operations) or it might depend on what you want to do with the qudits (such as create exotic topological error correcting codes). But other than concerns like these, nothing is forcing you to make any particular decisions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually we choose the basis that is easiest for us to measure. Superconducting qubits/qudits for examples are made from the lowest $d$ levels of an anharmonic oscillator. These energy eigenstates are what we typically measure, and that is the reason they are used as the computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Fibonacci anyons, we have to deal with a Hilbert space that isn’t really built for being carved into qubits. Typically we take a subspace for which measurements aren’t too convoluted. But then we also need to worry about braiding leaking the state out of the subspace. This gives us a whole bunch of practical concerns to think about when choosing our basis. But nevertheless, it is only these practical concerns that lead to a preferred choice, and different authors may very well choose different conventions.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-11T08:48:57.407" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1674" PostTypeId="1" AcceptedAnswerId="1682" CreationDate="2018-04-11T09:30:04.060" Score="10" ViewCount="432" Body="&lt;p&gt;The D-Wave system, as I understand it, allows us to program Ising models and to find their ground states. In this form, it is not universal for quantum computation: it can not simulate a circuit model quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the simplest thing that could be done to make it universal? What are the reasons why such a thing has not been implemented?&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="1837" LastEditDate="2018-04-11T11:39:28.510" LastActivityDate="2018-09-30T23:42:07.273" Title="What would be the simplest addition that would make the D-Wave architecture universal?" Tags="&lt;d-wave&gt;&lt;circuit-construction&gt;&lt;universal-gates&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1675" PostTypeId="2" ParentId="70" CreationDate="2018-04-11T09:48:56.377" Score="8" Body="&lt;p&gt;As the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/71/1837&quot;&gt;other answer&lt;/a&gt; conveyed (and to which I am just trying to provide some clarification), post-selection is about just looking at a subset of possible measurement outcomes. To my mind, this falls into two different cases, as below. Yes, they are different aspects of the same thing, but they are used very differently by two different communities.&lt;/p&gt;&#xA;&lt;h2&gt;Experimental Post-selection&lt;/h2&gt;&#xA;&lt;p&gt;You do some experiments, but you only gather data when certain conditions are fulfilled. Generally it's used to compensate for heralded experimental imperfections (i.e. something is triggered that tells us we've had a undesired result before proceeding with another part of the experiment). For example, you might be using a pair of photons as information or entanglement carriers, but sometimes those photons get lost on the way. If you only do things when both photons are detected, you are post-selecting on their successful arrival.&lt;/p&gt;&#xA;&lt;h2&gt;Theoretical Post-selection&lt;/h2&gt;&#xA;&lt;p&gt;This is a thought experiment of &amp;quot;&lt;em&gt;how much more powerful could my computer be if I could choose the outcomes of measurements?&lt;/em&gt;&amp;quot; and is not a practical proposition.&lt;/p&gt;&#xA;&lt;p&gt;As a simple example, think about quantum teleportation. In the normal scenario, Alice and Bob share a Bell pair, and Alice has a qubit in an unknown state that she wants to teleport to Bob. She performs a Bell measurement on her two qubits, and sends her measurement outcome to Bob. If Bob is far away from Alice, the information on the measurement result takes a finite time to get there, and it's after that time that he can be thought of as having received the qubit (because he has to compensate for effects of the different results on the qubit he holds).&lt;/p&gt;&#xA;&lt;p&gt;However, if Alice can post-select on the measurement result as always being one particular result, and Bob knows that she's going to select that one, then Alice doesn't need to send the measurement result to Bob. He can use the qubit he holds immediately. Even stronger, he can use it before Alice has made the measurement, secure in the knowledge that she will! So, not only are you achieving faster-than-light communication, you're actually communicating backwards in time! You can start to imagine how immensely powerful that could be for a computer (compute for an arbitrarily long time and then send the answer back in time to the moment the question was asked).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-11T09:48:56.377" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1676" PostTypeId="2" ParentId="1663" CreationDate="2018-04-11T09:51:00.620" Score="3" Body="&lt;p&gt;If you were to try and imagine the simplest form of correlation, you might think of two bits that were randomly either both $0$, or both $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bell states are just this, but quantum. We have bits instead of qubits, and the randomness is due to superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since they are most conceptually simple form of entanglement, and the easiest to describe using information theoretic language, they are our first choice for anything entanglement related. If you need to explain non-locality, do it with a Bell pair. If you want to teleport something, it’s simplest both mathematically and practically if you use a Bell pair. If you want to measure how much entanglement you have why not see how many Bell pairs you could turn it into?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, we use four canonical forms of the Bell pairs. They represent all the ways that we can choose to have correlations or anticorrelations between the $|0\rangle / |1\rangle$ states of the computational basis and the $|+\rangle / |-\rangle$ states of the $X$ basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These four states form a complete basis for two qubits. So any states, entangled or not, can be expressed as a superposition of Bell states. This can sometimes make our maths easier, which is another reason we like to use them.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-11T09:51:00.620" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1677" PostTypeId="1" CreationDate="2018-04-11T10:12:04.333" Score="7" ViewCount="309" Body="&lt;p&gt;We usually talk about the power of a quantum computer by examining the separation between sets of gates that we know we can efficiently simulate on a classical computer (i.e. problems in the class BPP), and universal gate sets which, by definition, can implement any quantum algorithm, including BQP-complete algorithms. So, assuming a separation between &lt;a href=&quot;https://en.wikipedia.org/wiki/BPP_%28complexity%29&quot; rel=&quot;noreferrer&quot;&gt;BPP&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;BQP&lt;/a&gt;, there is a separation in the power of the algorithms that can be implemented with these gate sets, and the separation between these gate sets can be as simple as the availability of one gate (two classic examples are the Clifford gates + the $\pi/8$ phase gate, and Toffoli+Hadamard). In effect, you need a universal gate set in order to gain a computational speed-up. However, this is specifically about algorithms with polynomial running times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are the requirements that distinguish the power of a quantum computer which is intended solely to provide a polynomial speed-up on a problem outside BPP?&lt;/strong&gt; For example, a device built solely for the purpose of implementing a Grover's search. Presumably the D-Wave machines fall into this category.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, I require a speed-up that changes the scaling relation. If there's a classical algorithm that requires time $O(2^n)$, then obviously there are many different ways of physically implementing it which have different running times, but all will be $O(2^n)$. I'm interested in identifying what it is in a quantum computer that permits a &lt;em&gt;better&lt;/em&gt; scaling (but not a reduction to polynomial time running).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asked another way: think about the D-wave machine (although I am not aiming to be limited to just talking about this case), which we believe is doing something coherent, and for a given problem size, seems to be quite speedy, but we don't know how it scales. Can we know &lt;em&gt;a priori&lt;/em&gt;, from details of its architecture, that it at least has the potential to provide a speed-up over classical? If it were universal for quantum computation, then it certainly would have that potential, but universality probably isn't necessary in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of what I'm struggling to get my head around, even in terms of defining the question properly, is that we don't have to have a universal gate set because it doesn't necessarily matter if the gate set can be efficiently simulated on a classical computer, just so long as the overhead in performing the simulation is similar or worse than the speedup itself.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1847" LastEditDate="2018-04-27T08:32:34.907" LastActivityDate="2018-05-16T00:56:35.650" Title="Requirements for Achieving a Quantum Speedup" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;d-wave&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1678" PostTypeId="1" AcceptedAnswerId="1681" CreationDate="2018-04-11T10:30:55.527" Score="9" ViewCount="479" Body="&lt;p&gt;I'm looking for a quantum algorithm which I can use to demonstrate the syntax of different quantum-languages. My question is similar to &lt;a href=&quot;https://physics.stackexchange.com/questions/3390/can-anybody-provide-a-simple-example-of-a-quantum-computer-algorithm&quot;&gt;this&lt;/a&gt;, however, for me, &quot;good&quot; means:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What it does could be described in 1-2 paragraphs, and should be easy to understand.&lt;/li&gt;&#xA;&lt;li&gt;Should use more elements of the &quot;quantum-programming-world&quot; (I mean that the algorithm should use some classical constants, measurements, conditions, qregisters, operators etc., as many as possible).&lt;/li&gt;&#xA;&lt;li&gt;The algorithm should be small (at most 15-25 pseudocode-lines long).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Useful algorithms are often too long/hard, but &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Deutsch's algorithm&lt;/a&gt; doesn't use that many elements. Can someone suggest me a good-for-demo algorithm?&lt;/p&gt;&#xA;" OwnerUserId="1930" LastEditorUserId="1847" LastEditDate="2018-04-27T16:50:53.323" LastActivityDate="2018-08-07T21:13:32.310" Title="A sample quantum algorithm, useful for demonstrating languages" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1679" PostTypeId="1" CreationDate="2018-04-11T10:37:54.783" Score="15" ViewCount="527" Body="&lt;p&gt;As per Wikipedia, &lt;a href=&quot;https://en.wikipedia.org/wiki/Blockchain&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;blockchains&lt;/em&gt;&lt;/a&gt; are a way to maintain &quot;a continuously growing list of records, called blocks, which are linked and secured using cryptography [... and] inherently resistant to modification of the data.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blockchains are in current practical use, for example in the cryptocurrency &lt;a href=&quot;https://en.wikipedia.org/wiki/Cryptocurrency&quot; rel=&quot;noreferrer&quot;&gt;bitcoin&lt;/a&gt;. These implementations must make use of some particular approach to cryptography, which will involve assumptions intended to underwrite their security.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are the current implementations of blockchain resistant to attacks using quantum computation?&lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="124" LastEditDate="2018-05-17T10:23:39.947" LastActivityDate="2019-01-22T07:15:23.217" Title="Does quantum computing threaten blockchain?" Tags="&lt;cryptography&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1680" PostTypeId="1" AcceptedAnswerId="1697" CreationDate="2018-04-11T11:02:45.863" Score="10" ViewCount="409" Body="&lt;p&gt;I wish to learn more about computational complexity classes in the context of quantum computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The medium is not so important; it could be a book, online lecture notes or the like. What matters the most are the contents. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The material should cover the basics of quantum computational complexity classes and discuss the similarities, differences and relationships between them and perhaps also with classical computational complexity classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would prefer a rigorous treatment over an intuitive one. The author's style doesn't matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for prerequisites, I know next to nothing about the topic, so maybe more self-contained material would be better. That being said, I probably would not read a 1000 page book unless it was phenomenally good, anything in the range of 1-500 pages might work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for availability, I would of course prefer material that is not behind a paywall of some sort and can be found online, but this is not a strict requirement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you recommend? &lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="144" LastEditDate="2018-04-12T10:19:42.853" LastActivityDate="2018-04-13T10:19:41.260" Title="Good introductory material on quantum computational complexity classes" Tags="&lt;complexity-theory&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1681" PostTypeId="2" ParentId="1678" CreationDate="2018-04-11T13:03:35.010" Score="3" Body="&lt;p&gt;I suggest looking at eigenvalue/eigenvector estimating protocols. There's a lot of flexibility to make the problem as easy or as hard as you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by picking two parameters, $n$ and $k$. You want to design an $n$-qubit unitary, $U$ that has eigenvalues of the form $e^{-2\pi iq/2^k}$ for integers $q$. Make sure that at least one of those eigenvalues is unique, and call it $\omega$. Also make sure that a simple product state, say $|0\rangle^{\otimes n}$, has non-zero overlap with the eigenvector of eigenvalue $\omega$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The aim would be to implement a phase estimation algorithm on this, being told the value $k$, and being tasked with outputting a vector $|\psi\rangle$ that is the eigenvector corresponding to eigenvalue $\omega$. In general this will comprise a circuit of $n+k$ qubits (unless you need ancillas to implement controlled-$U$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;set up two registers, one of $k$ qubits, and the other of $n$ qubits. (&lt;strong&gt;use of quantum registers&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;every qubit is initialized in the state $|0\rangle$. (&lt;strong&gt;initialisation of quantum registers&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;apply a Hadamard to each qubit in the first register (&lt;strong&gt;single-qubit gates&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;from qubit $r$ in the first register, apply controlled-$U^{2^{r}}$, targeting the second register (&lt;strong&gt;multi-qubit controlled gates&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;apply the inverse Fourier transform on the first register, and measure every qubit of the first register in the standard basis. These can be combined, implementing the &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.76.3228&quot; rel=&quot;nofollow noreferrer&quot;&gt;semi-classical Fourier transform&lt;/a&gt;. (&lt;strong&gt;measurement&lt;/strong&gt; and &lt;strong&gt;feed-forward of classical data&lt;/strong&gt;)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;for the correct measurement result, the second register is in the desired state $|\psi\rangle$.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For simplicity, you could pick $n=2$, $k=1$, so you need a $4\times 4$ unitary matrix with eigenvalues $\pm 1$. I'd use something like $$(U_1\otimes U_2)C(U_1^\dagger\otimes U_2^\dagger),$$&#xA;where $C$ denotes the controlled-NOT. There is just one eigenvector with eigenvalue -1, which is $|\psi\rangle=(U_1\otimes U_2)|1\rangle\otimes(|0\rangle-|1\rangle)/\sqrt{2}$, and you can mess about with the choices of $U_1$ and $U_2$ to explore the implementation of $U$ using decomposition in terms of a universal gate set (I'd probably set this as a preliminary problem). Then, controlled-$U$ is easily implemented just by replacing the controlled-NOT with a controlled-controlled-NOT (Toffoli) gate. Finally, the inverse Fourier transform is just a Hadamard gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For something a little more complex, put $k=3$, and replace $C$ with the square-root of swap gate,&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; \frac{i}{\sqrt{2}} &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{i}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;$$&#xA;with $\omega=e^{\pm i\pi/4}$ and $|\psi\rangle=(U_1\otimes U_2)(|01\rangle\pm|10\rangle)/\sqrt{2}$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-12T07:11:15.467" LastActivityDate="2018-04-12T07:11:15.467" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1682" PostTypeId="2" ParentId="1674" CreationDate="2018-04-11T14:49:04.643" Score="5" Body="&lt;p&gt;XX couplers are necessary to make an quantum annealing universal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0704.1287&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/0704.1287&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for fabricating them, I’m not too familiar with the hardware issues. Perhaps someone else can comment on that. &lt;/p&gt;&#xA;" OwnerUserId="54" LastActivityDate="2018-04-11T14:49:04.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1683" PostTypeId="2" ParentId="1642" CreationDate="2018-04-11T15:21:13.240" Score="2" Body="&lt;p&gt;The answer arguably depends on the problem you wish to solve with your computation. More specifically, are you wanting to optimize near-term applications in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1885/what-is-meant-by-noisy-intermediate-scale-quantum-nisq-technology&quot;&gt;NISQ&lt;/a&gt; era, or are you wanting to build a fully scalable, fault-tolerant and universe quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the latter, you need to think about error correction. Pretty much everything that will happen in a fault-tolerant quantum computer will be part of error correction. So whether we want to run Shor's algorithm or simulate a quantum system, we nevertheless mostly need to optimize for error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Typically, error correcting codes require Clifford gates. For the surface codes, CNOTs (both ways around), and preparation and measurement in the $Z$ and $X$ basis are usually used. But your exact choice of code, and how to implement that code, will affect the precise details of the gate set. But it will typically be a subset of the multi qubit Clifford group, made using single and two qubit generators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for fault-tolerant QC, the best option is to figure out good ways to implement the Clifford group.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="1847" LastEditDate="2018-04-23T11:26:58.473" LastActivityDate="2018-04-23T11:26:58.473" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1684" PostTypeId="2" ParentId="1529" CreationDate="2018-04-12T06:05:08.093" Score="5" Body="&lt;p&gt;In one sense, the &lt;em&gt;Xmon qubit is a transmon qubit&lt;/em&gt;, in that they both operate in the $E_J&amp;gt;&amp;gt;E_c$ regime of the CPB Hamiltonian and take advantage of the exponentially suppressed charge noise vs. polynomial decrease in anharmonicity effect discussed in (Koch, 2007). You could work out the dynamics of a superconducting qubit-resonator system without ever knowing whether the equations were describing an Xmon or a transmon, so functionally its hard to differentiate the Xmon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, there are a lot of important design differences introduced in the Xmon: The qubit is grounded (mentioned above), the qubit is no longer embedded in the resonator, its conveniently tunable, the lifetime is enhanced (although the &lt;a href=&quot;https://github.com/QISKit/ibmqx-backend-information/tree/master/backends/ibmqx3&quot; rel=&quot;noreferrer&quot;&gt;ibmqx3&lt;/a&gt; chip that IBM uses for its quantum experience has qubits with $T_1\approx40 \space \mu s$ which matches the original Xmon lifetime). Also, the Xmon's shape is a great match for a surface code architecture that requires a tight-packed grid of qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically, there are a lot of other transmon designs that offer some of the same benefits of the Xmon. So &quot;transmon vs. Xmon&quot; isn't the general question to ask; just go with the design that's got the best lifetimes and maybe tunability.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2018-04-12T06:05:08.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1685" PostTypeId="2" ParentId="1678" CreationDate="2018-04-12T13:35:21.007" Score="3" Body="&lt;p&gt;Sounds like you want a quantum &quot;Hello World&quot;. The most straightforward quantum version of this would just be to write a binary encoded version of the text &lt;code&gt;Hello World&lt;/code&gt; in a register of qubits. But this would require ~100 qubits, and be longer than your upper limit for code length.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's write a shorter peice of text. Let's write &lt;code&gt;;)&lt;/code&gt;, we need a bit string of length 16. Specifically, using ASCII encoding&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;)  =  00111011 00101001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using QISKit, you'd do this using the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumProgram&#xA;import Qconfig&#xA;&#xA;qp = QuantumProgram()&#xA;qp.set_api(Qconfig.APItoken, Qconfig.config[&quot;url&quot;]) # set the APIToken and API url&#xA;&#xA;# set up registers and program&#xA;qr = qp.create_quantum_register('qr', 16)&#xA;cr = qp.create_classical_register('cr', 16)&#xA;qc = qp.create_circuit('smiley_writer', [qr], [cr])&#xA;&#xA;# rightmost eight (qu)bits have ')' = 00101001&#xA;qc.x(qr[0])&#xA;qc.x(qr[3])&#xA;qc.x(qr[5])&#xA;&#xA;# second eight (qu)bits have 00111011&#xA;# these differ only on the rightmost two bits&#xA;qc.x(qr[9])&#xA;qc.x(qr[8])&#xA;qc.x(qr[11])&#xA;qc.x(qr[12])&#xA;qc.x(qr[13])&#xA;&#xA;# measure&#xA;for j in range(16):&#xA;    qc.measure(qr[j], cr[j])&#xA;&#xA;# run and get results&#xA;results = qp.execute([&quot;smiley_writer&quot;], backend='ibmqx5', shots=1024)&#xA;stats = results.get_counts(&quot;smiley_writer&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Of course, this isn't very quantum. So you could do a superposition of two different emoticons instead. The easiest example is to superpose ;) with 8), since the bit strings for these differ only on qubits 8 and 9.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;;)  =  00111011 00101001&#xA;8)  =  00111000 00101001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can simply replace the lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(qr[9])&#xA;qc.x(qr[8])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from the above with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.h(qr[9]) # create superposition on 9&#xA;qc.cx(qr[9],qr[8]) # spread it to 8 with a cnot&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The Hadamard creates a superposition of &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;, and the cnot makes it into a superposition of &lt;code&gt;00&lt;/code&gt; and &lt;code&gt;11&lt;/code&gt; on two qubits. This is the only required superposition for &lt;code&gt;;)&lt;/code&gt; and &lt;code&gt;8)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to see an actual implementation of this, it can be found on the &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial/blob/master/hello_world/quantum_emoticon.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit tutorial&lt;/a&gt; (full disclosure: it was written by me).&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-21T15:29:54.370" LastActivityDate="2018-04-21T15:29:54.370" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1686" PostTypeId="2" ParentId="1680" CreationDate="2018-04-12T17:03:45.557" Score="4" Body="&lt;p&gt;I can recommend the &lt;a href=&quot;http://homepages.cwi.nl/~rdewolf/qcnotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture notes&lt;/a&gt; of Ronald de Wolf, used for a semester course taught by him on Quantum Computing in the context of the Dutch 'Mastermath' program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chapter 10 &quot;Quantum Complexity Theory&quot;, covers the 'classical' complexity classes briefly, but gives enough background to talk about the 'quantum' complexity classes and compare them with the classical. It doesn't cover everything, but refers to other material for further reading.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chapter 12 &quot;Quantum Communication Complexity&quot; is also relevant and is more technical, mainly since to the theory of communication complexity has interesting applications within quantum computation.&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-04-12T17:03:45.557" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1687" PostTypeId="1" AcceptedAnswerId="1688" CreationDate="2018-04-12T19:23:47.013" Score="13" ViewCount="894" Body="&lt;p&gt;I am pretty intrigued by the record time that a qubit has survived.&lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="26" LastEditDate="2018-12-23T12:19:10.303" LastActivityDate="2018-12-23T12:19:10.303" Title="What is the longest time a qubit has survived with 0.9999 fidelity?" Tags="&lt;physical-qubit&gt;&lt;experiment&gt;&lt;fidelity&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1688" PostTypeId="2" ParentId="1687" CreationDate="2018-04-12T21:11:28.283" Score="11" Body="&lt;p&gt;Well, for the longest coherence time ever, I'm finding this Science from 2013 entitled &lt;a href=&quot;http://science.sciencemag.org/content/342/6160/830&quot; rel=&quot;noreferrer&quot;&gt;Room-Temperature Quantum Bit Storage Exceeding 39 Minutes Using Ionized Donors in Silicon-28&lt;/a&gt;, which indicates qubits that lasted for over 39 minutes; these, however, only had an 81% fidelity rate. (This is for qubits used in computation, not memory storage. For memory storage, see M. Stern's link.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you're looking for qubits with a high fidelity rate. In that case, I found a Nature Nanotechnology from 2014 entitled &lt;a href=&quot;https://www.nature.com/articles/nnano.2014.211.epdf?referrer_access_token=eAPRpCk-XWOowPey97ATOdRgN0jAjWel9jnR3ZoTv0MSiU3zyoWmVaZbUhBS9Y2y0Ydzrooe7TM7a2pPhbGI0gUh3iiDzDUwEOCB1W-Ol1olQL-WtemqfKxyGGHJlpm_iydV0dIwcLUfrijSMynofUUA2I4DPvmBnExrFpi006xfteNV_dc5xzqmPH4MpLzEqtP-NFjPfWaIDlAPto5Ihs0w55NEK75U6G3PTxxAlkU%3D&amp;amp;tracking_referrer=www.abc.net.au&quot; rel=&quot;noreferrer&quot;&gt;Storing quantum information for 30 seconds&#xA;in a nanoelectronic device&lt;/a&gt;(&lt;a href=&quot;https://arxiv.org/abs/1402.7140&quot; rel=&quot;noreferrer&quot;&gt;alternate link to arXiv&lt;/a&gt;) which was coherent for 30 seconds - but had a greater than 99.99% fidelity rate, which is exactly what you're looking for. Most other papers I'm finding with a 99.99% fidelity rate or greater measure their coherence times in nano or microseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will keep looking.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="1847" LastEditDate="2018-04-13T09:19:41.703" LastActivityDate="2018-04-13T09:19:41.703" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1689" PostTypeId="2" ParentId="1367" CreationDate="2018-04-12T21:26:05.753" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/rigetticomputing/pyquil/&quot; rel=&quot;noreferrer&quot;&gt;pyQuil&lt;/a&gt; is an open source quantum programming library in Python. The documentation includes a hands on introduction to quantum computing where you learn by programming. It doesn't assume any physics background.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some links to the main topics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://pyquil.readthedocs.io/en/latest/intro.html&quot; rel=&quot;noreferrer&quot;&gt;Intro to quantum computing with pyQuil&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1608.03355&quot; rel=&quot;noreferrer&quot;&gt;Whitepaper&lt;/a&gt; on the underlying Quil instruction set (assumes only linear algebra and complex numbers)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://pyquil.readthedocs.io/en/latest/noise.html&quot; rel=&quot;noreferrer&quot;&gt;Understanding noise and errors in quantum processors&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://grove-docs.readthedocs.io/en/latest/&quot; rel=&quot;noreferrer&quot;&gt;Examples of algorithms&lt;/a&gt; implemented using pyQuil. These are in another open source library called grove.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="299" LastActivityDate="2018-04-12T21:26:05.753" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1690" PostTypeId="1" AcceptedAnswerId="1693" CreationDate="2018-04-13T04:40:30.140" Score="4" ViewCount="47" Body="&lt;p&gt;On 1993, Seth Lloyd published in Science a proposal for &lt;a href=&quot;http://science.sciencemag.org/content/261/5128/1569&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Potentially Realizable Quantum Computer&lt;/a&gt;. In a nutshell, this consists in a long chain of weakly coupled qubits which are operated with (almost) no need for the operator to differentially address the different memory positions (i.e. no spatial addressing is required), and at the same time it does not require every qubit to present a different energy. Instead, all qubits are equivalent, with the exceptions of&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the two extremes of the chain are distinguishable from the bulk (and this feature is used to introduce new information) and&lt;/li&gt;&#xA;&lt;li&gt;a qubit is sensitive to its immediate neighbours, so at any given time you effect the same simultaneous operation on all qubits with certain  surroundings, while leaving those with differing ones unperturbed (this feature allows operating in a manner of cellular automata)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is: &lt;strong&gt;have few-qubit versions of Lloyd's proposal been proposed, or implemented?&lt;/strong&gt; (If yes: under what architecture(s), and if not, what would be required to do it?)&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2018-12-13T19:43:22.370" LastActivityDate="2018-12-13T19:43:22.370" Title="Any few-qubit versions of Lloyd's &quot;weakly-coupled-array&quot; quantum computing?" Tags="&lt;architecture&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1691" PostTypeId="2" ParentId="1674" CreationDate="2018-04-13T05:31:12.180" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What would be the simplest thing that could be done to make it universal?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See US Patent &lt;a href=&quot;https://patents.google.com/patent/US9162881&quot; rel=&quot;nofollow noreferrer&quot;&gt;US9162881B2&lt;/a&gt; &quot;Physical realizations of a universal adiabatic quantum computer&quot; &lt;strong&gt;or&lt;/strong&gt; US Application &lt;a href=&quot;https://patents.google.com/patent/US20150111754&quot; rel=&quot;nofollow noreferrer&quot;&gt;US20150111754A1&lt;/a&gt; &quot;Universal adiabatic quantum computing with superconducting qubits&quot; which is quoted here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Definition: Basis&lt;/strong&gt; Throughout this specification and the appended claims, the terms “basis” and “bases” are used to denote a set or sets, respectively, of linearly independent vectors that may be combined to completely describe a given vector space. For example, the basis of standard spatial Cartesian coordinates comprises three vectors, the x-axis, the y-axis, and the z-axis. Those of skill in mathematical physics will appreciate that bases may be defined for operator spaces, such as those used to describe Hamiltonians.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Definition: Effective Qubit&lt;/strong&gt; Throughout this specification and the appended claims, the terms “effective qubit” and “effective qubits” are used to denote a quantum system that may be represented as a two-level system. Those of skill in the relevant art will appreciate that two specific levels may be isolated from a multi-level quantum system and used as an effective qubit. Furthermore, the terms “effective qubit” and “effective qubits” are used to denote a quantum system comprising any number of devices that may be used to represent a single two-level system. For example, a plurality of individual qubits may be coupled together in such a way that the entire set, or a portion thereof, of coupled qubits represents a single two-level system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[0061]&#xA;A Universal Quantum Computer (UQC) is a quantum computer which is capable of efficiently simulating any other quantum computer. In some embodiments, a Universal Adiabatic Quantum Computer (UAQC) would be able to simulate any quantum computer via adiabatic quantum computation and/or via quantum annealing. In some embodiments, a UAQC would be able to simulate a physical quantum system via adiabatic quantum computation and/or via quantum annealing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0062]&#xA;It has been established that local lattice spin Hamiltonians can be used for universal adiabatic quantum computation. However, the 2-local model Hamiltonians used are general and hence do not limit the types of interactions required between spins to be known interactions that can be realized in a quantum processor. The 2-local Ising model with 1-local transverse field has been realized using different of technologies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0063]&#xA;This quantum spin model is thought unlikely to be universal for adiabatic quantum computation. See discussion in S. Bravyi et al., 2006 arXiv:quant-ph/0606140v4 or Quant. Inf. Comp. 8, 0361(2008). However, it has been shown that &lt;strong&gt;adiabatic quantum computation can be rendered universal&lt;/strong&gt; and belongs to the Quantum Merlin Arthur complexity class, a quantum analog of the NP complexity class, &lt;strong&gt;by having tunable 2-local diagonal and off-diagonal couplings in addition to tunable 1-local diagonal and off-diagonal biases&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0064]&#xA;Diagonal and off-diagonal terms can be defined with reference to the computational basis. The state of a qubit can be one of two basis states or a linear superposition of the two basis states. The two states form a computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;strong&gt;Note: Refer to the Patent for complete details.&lt;/strong&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What are the reasons why such a thing has not been implemented?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Definition: Universal Adiabatic Quantum Computation&lt;/strong&gt; The concept of “universality” is understood in computer science to describe the scope or range of function of a computing system. A “universal computer” is generally considered to represent a computing system that can emulate any other computing system or, in other terms, a computing system that can be used for the same purposes as any other computing system. For the purposes of the present systems, methods and apparatus, the term “universal adiabatic quantum computer” is intended to describe an adiabatic quantum computing system that can simulate any unitary evolution.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From: &quot;&lt;a href=&quot;https://arxiv.org/abs/1610.02208&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Processing with Superconducting Circuits: a Review&lt;/a&gt;&quot; by G. Wendin (8 Oct 2017), on page 77:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The D-Wave Systems machines are built top-down - scaling up is based on flux qubits and circuits with short coherence time. The technology is based on classical Nb RSFQ circuits combined with Nb rf-SQUID qubits, and forms the basis of the current D-Wave processors. &lt;strong&gt;The architecture is based on a cross-bar network of communication buses allowing (limited) coupling&lt;/strong&gt; of distant qubits. The qubits are operated by varying the dc-bias, changing the qubit energies and qubit qubit couplings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, the coherence and entanglement properties have to be investigated by performing various types of experiments on the machines and their components: Physics experiments on the hardware, and ”benchmarking” of the performance by running a range of QA schemes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the last three years, the topic has rapidly evolved, and by now a certain common understanding and consensus has been reached. Based on the discussion in some recent papers, the situation can be summed up in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• The behaviour of the D-Wave machines is consistent with quantum annealing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• No scaling advantage (quantum speedup) has so far been seen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• QA is efficient in quickly finding good solutions as long as barriers are narrow, but ultimately gets stuck once broad barriers are encountered&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• The Google D-Wave 2X results showing million-times speedup are for native instances that perfectly fit the hardware graph of the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• For generic problems that do not map well onto the hardware of a QA, performance will suffer significantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Even more efficient classical optimisation algorithms exist for these problems, which outperform the current D-Wave 2X device for most problem instances. However, the race is on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• With improved engineering, especially faster annealing and readout, the time to perform a quantum annealing run can be reduced by a factor 100x over the current generation QA devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• However, misspecification of the cost function due to calibration inaccuracies is a challenge that may hamper the performance of analogue QA devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Another challenge is the embedding of problems into the native hardware&#xA;architecture with limited connectivity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• There is the open question of quantum speedup in analogue QA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• QA error correction has been demonstrated and may pave a path toward large scale noise-protected AQO devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Typically, classically computationally hard problems also seem to be hard problems for QA devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• Improved machine calibration, noise reduction, optimisation of the QA schedule, larger system sizes and tailored spin-glass problems may be needed for demonstrating quantum speedup. However what is hard may not be easy to judge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;• It remains to see what the newest D-Wave 2000Q system can do with 2000 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;&lt;strong&gt;Note: Refer to the paper for complete details.&lt;/strong&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Patent is somewhat more cryptic in it's explanation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simulated coupling described in FIG. 9 and FIG. 10 allows multiple types of coupling to be realized by fewer actual coupler types. This can provide greater versatility in a quantum processor where the architecture is best-suited for specific types of couplers. For instance, a superconducting quantum processor that, for whatever reason, is best-suited to implement only ZZ-couplers and XX-couplers may incorporate simulated coupling through mediator qubits to realize the effects of simulated XZ and ZX coupling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those of skill in the art will appreciate that, for the purposes of realizing the qubit-coupling architectures taught in the present systems, methods and apparatus, the various embodiments of XX-, ZZ-, XZ-, and ZX-couplers described herein represent non-limiting examples of coupling devices. All of the coupling devices described in the present systems, methods and apparatus may be modified to accommodate the requirements of the specific system in which they are being implemented, or to provide a specific functionality that is advantageous in a particular application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The present systems, methods and apparatus describe the physical realization of universal adiabatic quantum computation by the implementation of at least two different coupling mechanisms in one processor architecture. Each coupling mechanism provides coupling between a first and a second basis (for example, coupling between X and X, X and Z, or Z and Z), thereby defining a “coupled basis” (for example, XX, XZ, or ZZ). &lt;strong&gt;In accordance with the present systems, methods and apparatus, qubit-coupling architectures that each include at least two different coupled bases, where at least two different coupled bases do not commute, are used to realize the Hamiltonians for universal adiabatic quantum computation. For example, the various embodiments described herein teach that universal adiabatic quantum computation may be physically realized by the simultaneous application of off-diagonal couplers in a qubit-coupling architectures&lt;/strong&gt;. Those of skill in the art will appreciate that this concept may extend to couplers that include the Y-basis, such as XY-, YX-, YY-, ZY-, and YZ-couplers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This specification and the appended claims describe physical implementations of realizable Hamiltonians for universal adiabatic quantum computers by demonstrating universal qubit-coupling architectures. There is a common element to the embodiments of universal coupling schemes described herein, and that is the implementation of at least two different sets of coupling devices between qubits, where the respective bases coupled by the two different sets of coupling devices do not commute. Those of skill in the art will appreciate that such non-commuting couplers may be realized in a variety of different embodiments and implementations and all such embodiments cannot practically be disclosed in this specification. Thus, only two physical embodiments, the XX-ZZ coupling architecture and the XZ-ZX coupling architecture, are detailed herein with the recognition that anyone of skill in the relevant art will acknowledge the extension to any quantum processor architecture implementing non-commuting couplers. Furthermore, those of skill in the art will appreciate that &lt;strong&gt;ertain quantum algorithms or hardware constraints may impose minimum requirements on the number of effective qubits in the quantum processor and/or the number of couplers&lt;/strong&gt;. The present systems, methods and apparatus describe the use of XX and ZZ couplers to simulate XZ and ZX couplers, as well as the use of XZ and ZX couplers to simulate XX and ZZ couplers, thereby proving that a pair of non-commuting couplers in a quantum processor may be used to simulate other coupler schemes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[&lt;strong&gt;My comment&lt;/strong&gt;: Basically, there's only so much room; and improvments are planned.]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Application it's slightly less cryptic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[0129] Readout is likely more challenging in AQC than in GMQC. Within the latter paradigm, all qubits are isolated at the end of a computation. Consequently, one can independently read each qubit in a GMQC processor. In contrast, AQC terminates with the target Hamiltonian being asserted. When the Hamiltonian contains off-diagonal elements, read out for AQC can present a challenge. &lt;strong&gt;If the readout process requires the qubit register wavefunction to collapse, then that state will no longer be an eigenstate of the target Hamiltonian. Therefore, it is desirable to devise a method to simultaneously project the states of all qubits in an AQC processor in the presence of finite biases and couplings&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-04-13T05:31:12.180" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1693" PostTypeId="2" ParentId="1690" CreationDate="2018-04-13T07:25:33.377" Score="3" Body="&lt;p&gt;This sort of architecture has certainly been studied &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.93.220502&quot; rel=&quot;nofollow noreferrer&quot;&gt;more&lt;/a&gt;, often under the banner of &quot;Global Control&quot;, significantly reducing some of the &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.88.017904&quot; rel=&quot;nofollow noreferrer&quot;&gt;requirements&lt;/a&gt; (in particular, only requiring an ABABAB... repeating structure instead of ABCABC...). I am not aware of any of these ideas having been implemented. I assume this is partly because there are large overheads in the length of time required to implement something, which makes it more difficult to fit inside the decoherence time of a system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was involved in some studies at some point, detailing how you can make larger versions &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308113&quot; rel=&quot;nofollow noreferrer&quot;&gt;fault tolerant&lt;/a&gt;, but also suggesting implementations in optical lattices (&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1367-2630/6/1/126/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.73.022310&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). These were at least partly motivated by this &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.051603&quot; rel=&quot;nofollow noreferrer&quot;&gt;experimental paper&lt;/a&gt;. At a similar time, &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.70.012306&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zoller&lt;/a&gt; was also looking at this idea.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-13T07:25:33.377" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1694" PostTypeId="2" ParentId="20" CreationDate="2018-04-13T07:43:38.933" Score="3" Body="&lt;p&gt;Short answer for the superconducting -&gt; formula example: no, we will not be able to do that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Longer answer (and more optimistic)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We need a one-to-one correspondence between the Hamiltonian of the system we can control in the actual experiment and the theoretical one, in terms of system size (degrees of freedom that we care about) and in terms of parameters.&lt;/li&gt;&#xA;&lt;li&gt;As you describe, we are currently in the situation where we would like to know how a theoretical system evolves (the solution to a known set of equations with a known set of parameters). We map the theoretical system on the experimental one, measure and effectively know the solution to the theoretical equations.&lt;/li&gt;&#xA;&lt;li&gt;The reverse would be: we know the evolution we want to obtain (the theoretical system) and we want to find the experimental system that fits. We would then do an iterative optimization process: controllably change parameters in the experimental system, measure, quantify the fidelity of the final quantum state or of the whole quantum process, and systematically tweak the parameters to optimize this. I do think this is totally doable: it's simply an extension of the forward process It's almost the same experiment, only performed more times.&lt;/li&gt;&#xA;&lt;li&gt;Why we can't apply this to the superconducting -&gt; formula case? First, because of the size requirement: if we want to relate an emerging property to the details of its composition, we probably would need an all-atomic model. Second, because we cannot continuously control the experimental variables in chemical compounds with quantum accuracy.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-13T07:43:38.933" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1696" PostTypeId="1" AcceptedAnswerId="1698" CreationDate="2018-04-13T09:14:15.857" Score="6" ViewCount="304" Body="&lt;p&gt;Capacitors, Inductors and Resistors are well-known circuit components. Since the proposal of Leon Chua in 1971, the Memristor joined them as a fundamental component.&#xA;I am wondering whether these elements would be somehow imitated by the means of quantum technologies and what would be the requirements to achieve them.&lt;/p&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="26" LastEditDate="2018-12-13T19:43:45.093" LastActivityDate="2018-12-13T19:43:45.093" Title="Do the 'fundamental circuit elements' have a correspondence in quantum technologies?" Tags="&lt;technologies&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1697" PostTypeId="2" ParentId="1680" CreationDate="2018-04-13T10:19:41.260" Score="9" Body="&lt;p&gt;I think John Watrous' survey is a great place to start (Professor Watrous recommended it to me a long long time ago and I have been hooked ever since!):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J. Watrous. Quantum computational complexity. Encyclopedia of Complexity and System Science, Springer, 2009. arXiv:&lt;a href=&quot;https://arxiv.org/abs/0804.3401&quot; rel=&quot;noreferrer&quot;&gt;0804.3401 [quant-ph]&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To the best of my knowledge, it has the highest complexity classes to page ratio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also really like Scott Aaronson's 2016 Barbados Lecture Notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;S. Aaronson (with A. Bouland and L. Schaeffer). The Complexity of Quantum States and Transformations: From Quantum Money to Black Holes. ECCC &lt;a href=&quot;https://eccc.weizmann.ac.il/report/2016/109/&quot; rel=&quot;noreferrer&quot;&gt;TR16-109&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1813" LastActivityDate="2018-04-13T10:19:41.260" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1698" PostTypeId="2" ParentId="1696" CreationDate="2018-04-13T12:41:53.450" Score="5" Body="&lt;p&gt;When you ask,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am wondering whether these elements would be somehow imitated by the means of quantum technologies &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;there are different levels on which you can interpret this question. You might mean to ask whether people will realise quantum capacitors, inductors, or resistors, or you might mean to ask whether people will realise components which, in quantum computers, fulfil the same functional roles as capacitors, inductors, or resistors in order to realise digital information processing &amp;mdash; as opposed, for instance to analogue computers to model differential systems of equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It must be remembered that quantum technologies are at an early phase, where this is no single way which we can be confident will form the basis of a scalable quantum computer. But we can consider whether there are any cases where there may be interesting analogues.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Many quantum technologies do not represent anything like an electrical circuit, as such. &lt;a href=&quot;https://physics.aps.org/articles/v7/119&quot; rel=&quot;noreferrer&quot;&gt;Ion traps&lt;/a&gt; store bits of information on individual ions, which are moved in a limited and carefully controlled way. There is no natural notion of electrical conduction, resistors, or capacitors in this setting. &lt;a href=&quot;https://physics.stackexchange.com/a/252038/4976&quot;&gt;Quantum dots&lt;/a&gt; are even less like electrical circuits, in that the locations of the physical systems storing the data are fixed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Flux_qubit&quot; rel=&quot;noreferrer&quot;&gt;Flux qubits&lt;/a&gt;, on the other hand, explicitly include circuits which carry a current (albeit a very small one). The resistance in such circuits is effectively zero, as they are superconducting; but they do involve &lt;a href=&quot;https://en.wikipedia.org/wiki/Josephson_effect&quot; rel=&quot;noreferrer&quot;&gt;Josephson junctions&lt;/a&gt;, which are often considered a non-linear type of inductor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is different from whether or not there is anything in a given platform which is &lt;em&gt;doing the same job&lt;/em&gt; as a resistor, capacitor, or inductor: which may be substantially different on the level of physics, but which are somehow performing a similar role in mediating how a system performs information processing. However, there is a big difference between the way that classical semiconductor electronics realises information processing &amp;mdash; with physical gates, which transform information-carrying input signals to produce output signals &amp;mdash; and the way every current quantum technology realises information processing, which is to perform &lt;em&gt;controlled changes of the dynamics of systems&lt;/em&gt; prepared in some input state, to realise an output state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The one possible exception are photonic quantum systems, in which the information is carried in light signals rather than in the states of more-or-less static pieces of matter. Perhaps you might argue that an optical memory is analogous to a capacitor somehow, or that a wave plate is analogous to an inductor, but these don't seem to be meaningful functional analogues for how an optical system might be used to perform quantum information processing.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary: there is no single answer to your question, because of the different things you might mean by it and because there is no single  platform to refer to in order to provide a definitive answer. But most of the platforms don't have anything which represents these basic electrical components, or which play the same role. Quantum technologies are simply expected to operate differently than classical computing technology.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-13T12:41:53.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1699" PostTypeId="2" ParentId="1367" CreationDate="2018-04-13T14:50:05.847" Score="4" Body="&lt;p&gt;If you want to go beyond learning how to write quantum circuits in the various quantum programming frameworks such as &lt;a href=&quot;https://www.microsoft.com/en-us/quantum/development-kit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q#&lt;/a&gt;, &lt;a href=&quot;https://github.com/rigetticomputing/pyquil&quot; rel=&quot;nofollow noreferrer&quot;&gt;pyQuil&lt;/a&gt; and &lt;a href=&quot;https://github.com/qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit&lt;/a&gt;, I highly recommend &lt;a href=&quot;https://arxiv.org/pdf/1804.03719.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this recent paper&lt;/a&gt; with the title &lt;em&gt;Quantum Algorithm Implementations for Beginners&lt;/em&gt; from the Los Alamos National Laboratory. It's a great resource for understanding how to compile and implement various quantum algorithms as well as their oracles and specific subroutines as quantum circuits with the IBM Q Experience. I'd recommend you to implement them in any of the aforementioned programming frameworks and learn the nitty-gritty details as you go.&lt;/p&gt;&#xA;" OwnerUserId="1234" LastActivityDate="2018-04-13T14:50:05.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1700" PostTypeId="1" CreationDate="2018-04-13T16:14:55.530" Score="9" ViewCount="162" Body="&lt;p&gt;&lt;strong&gt;The context&lt;/strong&gt;: We are in the solid state. After a photon absortion by a system with a singlet ground state, the system undergoes the spin-conserving fission of one spin singlet exciton into two spin triplet excitons (for context, see &lt;a href=&quot;https://www.nature.com/articles/ncomms15953&quot; rel=&quot;noreferrer&quot;&gt;The entangled triplet pair state in acene and heteroacene materials&lt;/a&gt;). These spin triplet pair propagates in the solid, still entangled. The quantum-computing-related goal of all this operation would be to transfer the entanglement of the two flying qubits to two positions that are fixed in space and are also well protected from decoherence (low-energy excitations of nuclear spins in a paramagnetic ion, for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem at hand&lt;/strong&gt; (1), and the question: What would be the requirements to favour said quantum information transfer between the flying qubits and the stationary qubits?&#xA;(I know flying vs stationary qubit scenarios have been explored, but I have no experience in that field).&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-19T14:52:39.243" LastActivityDate="2018-04-19T14:52:39.243" Title="Entanglement transfer of spin-entangled triplet-pair states between flying qubits and stationary qubits" Tags="&lt;architecture&gt;&lt;entanglement&gt;&lt;quantum-memory&gt;&lt;solid-state&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1701" PostTypeId="1" CreationDate="2018-04-13T16:17:00.647" Score="9" ViewCount="204" Body="&lt;p&gt;&lt;strong&gt;The context&lt;/strong&gt;: We are in the solid state. After a photon absortion by a system with a singlet ground state, the system undergoes the spin-conserving fission of one spin singlet exciton into two spin triplet excitons (for context, see &lt;a href=&quot;https://www.nature.com/articles/ncomms15953&quot; rel=&quot;noreferrer&quot;&gt;The entangled triplet pair state in acene and heteroacene materials&lt;/a&gt;). These spin triplet pair propagates in the solid, still entangled. The quantum-computing-related goal of all this operation would be to transfer the entanglement of the two flying qubits to two positions that are fixed in space and are also well protected from decoherence (low-energy excitations of nuclear spins in a paramagnetic ion, for example).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The problem at hand&lt;/strong&gt; (2), and the question: Eventually, the entanglement between the two triplets is lost, and moreover inevitably the triplets find a way to relax back to the singlet ground state, emitting energy in form of photons. I would like to calculate how these processes are affected by vibrations. I assume the independent relaxation of each of the two triplets can be calculated mostly considering local vibrations, e.g. following a procedure similar to the one we employed here (&lt;a href=&quot;https://pubs.acs.org/doi/abs/10.1021/acs.jpclett.7b00479&quot; rel=&quot;noreferrer&quot;&gt;Determining key local vibrations in the relaxation of molecular spin qubits and single-molecule magnets&lt;/a&gt;). Would the calculation of the loss of entanglement be necessarily related to delocalized vibrational modes that simultaneously involve the local environment of both triplets?&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-20T06:58:47.930" LastActivityDate="2018-04-28T09:02:02.400" Title="Decoherence of spin-entangled triplet-pair states in the solid state: local vs delocalized vibrations" Tags="&lt;architecture&gt;&lt;entanglement&gt;&lt;decoherence&gt;&lt;solid-state&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1703" PostTypeId="2" ParentId="1696" CreationDate="2018-04-14T14:08:41.957" Score="2" Body="&lt;p&gt;These elements do not necessarily have a correspondence in quantum computers, just as they do not necessarily occur in classical computers (an electronic computer might use some of them, but a mechanical or photonic computer does not necessarily have any equivalent of them).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What has an equivalence are the fundamental gates that form a classical computer. For example, there are only two classical single-bit gates, the direct connection and the NOT gate. A quantum computer has single qubit rotation gates (for example $X$, $Y$, $Z$, $H$, $T$) of which $X$ is a direct equivalent.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-14T14:08:41.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1704" PostTypeId="2" ParentId="1678" CreationDate="2018-04-14T14:22:58.270" Score="1" Body="&lt;p&gt;I would propose the (perfect) 1-bit random number generator. It is almost trivially easy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You start with a single qubit in the usual initial state $\left|0\right&amp;gt;$. Then you apply the Hadamard gate $H$ which produces the equal superposition of $\left|0\right&amp;gt;$ and $\left|1\right&amp;gt;$. Finally, you measure this qubit to get either 0 or 1, each with 50% probability.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-14T14:22:58.270" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1705" PostTypeId="2" ParentId="1677" CreationDate="2018-04-14T14:31:07.003" Score="-2" Body="&lt;p&gt;I am not sure if the answer to this question, in the sense of not just necessary but also sufficient conditions, is actually known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, simply using handwaving arguments, you can identify a few actual requirements (necessary conditions):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialization. Without initializing your system, the result will be arbitrary. In fact, you might include all of the five &lt;a href=&quot;https://en.wikipedia.org/wiki/DiVincenzo%27s_criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;DiVincenzo criteria&lt;/a&gt; for quantum computing in the first place.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Superpositions&lt;/strong&gt; or quantum parallelism. Without superposition, you cannot process &quot;more&quot; information than possible classically.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interference&lt;/strong&gt;. Without interference, you cannot make use of the &quot;extra&quot; information gained from superposition.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measurement. Without measurement, you cannot get a (classical) result from the computation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-14T14:31:07.003" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1706" PostTypeId="2" ParentId="1696" CreationDate="2018-04-14T16:19:48.497" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am wondering whether these elements would be somehow imitated by the means of quantum technologies and what would be the requirements to achieve them&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think we would want to achieve quantum equivalents of resistors, capacitors, inductors etc (at least as of now). There are two parts to any circuit: 1) Logical implementation 2) Physical implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need the 'bits' represented as voltages/currents/spins to implement the logic, for which we have the quantum equivalent of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when you physically implement a circuit, the concepts of resistance, capacitance etc comes into picture because of the sheer nature of the materials that we are trying to implement the circuit with. There are resistances, capacitances which act as noise in a circuit due to the wires, etc and also resistors and capacitors which we add to the circuit to vary the above said voltages/currents (for eg, a transistor is a variable resistor).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This analogy applies to quantum circuitry when you are implementing qubits. It boils down to the fact that after you have achieved the required logical implementation, in which form do you need your output? Based on this you may need to apply resistances and capacitances to the circuitry to change the voltages/currents.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the future if we need to change the qubits in such a way as it somehow mimics the classical resistive action, then we will need a technique to achieve a mechanism which performs the resistive action on qubits (I don't even comprehend what such action would even be for a qubit), then that technique will be called as a quantum resistor. Until then we will resort to classical resistors and capacitors to manipulate the classical signals, after the qubits have done their job.&lt;/p&gt;&#xA;" OwnerUserId="419" LastActivityDate="2018-04-14T16:19:48.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1707" PostTypeId="5" CreationDate="2018-04-15T00:16:57.453" Score="0" Body="&lt;p&gt;There are a number of different distance measures used in quantum computing:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fidelity&lt;/a&gt;: For two states (density matrices $\rho$ and $\sigma$) the &lt;em&gt;fidelity&lt;/em&gt; is defined as either $$F = \text{Tr}\sqrt{\sqrt \rho\sigma\sqrt\rho}\quad\text{ or }\quad F' = F^2$$ and measures how close the two states are. when $F=1$, the two states are equal. When comparing two quantum channels, $\rho$ and $\sigma$ get replaced by $\mathcal E\left(\rho\right)$ and $\mathcal E'\left(\rho\right)$ (for some different $\rho$). The maximum, minimum and average fidelities can then be considered, where the maximum and minimum are taken over states and the average is uses the 'Haar measure over pure states' $d\psi$, which is the integral $$\int F\left(\mathcal E\left(\left|\psi\rangle\langle\psi\right|\right), \mathcal E'\left(\left|\psi\rangle\langle\psi\right|\right)\right) d\psi,$$ where $\left|\psi\rangle\langle\psi\right|$ is a pure state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Fidelity can then be used to define the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bures_metric#Bures_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bures distance&lt;/a&gt;, $D_B = \sqrt{2\left(1-F\right)}$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Defining $M = \rho-\sigma$ when comparing states or $M = \mathcal E\left(\rho\right) - \mathcal E'\left(\rho\right)$ when comparing channels gives:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Schatten_norm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schatten norm&lt;/a&gt;: $$\lVert M\rVert_p = \left[\text{Tr}\left(\sqrt{M^\dagger M}^p\right)\right]^{1/p}.$$ Commonly used values of $p$ are $1$ (trace norm), $2$ (Frobenius norm) and $\infty$ (infinity norm).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The trace &lt;em&gt;distance&lt;/em&gt; is half the trace norm.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Operator_norm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Operator norm&lt;/a&gt;: $$\lVert M\rVert_p = \sup_\psi\frac{\lVert M\left|\psi\right&amp;gt;\rVert_p}{\lVert\left|\psi\right&amp;gt;\rVert_p},$$ where, for a state $\left|\phi\right&amp;gt;$, the vector $p$-norm is $\lVert\left|\phi\right&amp;gt;\rVert_p = \left(\sum_{i=1}^n\lvert\left|\phi\right&amp;gt;_i\rvert^p\right)^{1/p}$ where $\left|\phi\right&amp;gt;_i$ is the $i^{th}$ element of $\phi$. A common case is $p=2$, known as the $L_2$ or &lt;em&gt;Euclidean&lt;/em&gt; norm, which is the maximum singular value of $M$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For a channel $\mathcal E:\mathcal H\rightarrow \mathcal H$ for a Hilbert space $\mathcal H$, defining a density matrix $\rho \in \mathcal H\otimes\mathcal K$, for an 'ancillary' Hilbert space $\mathcal K$ with $\dim\mathcal K\geq\dim\mathcal H$:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Diamond norm: $$\lVert\mathcal E - \mathcal E'\rVert_\Diamond = \sup_\rho\left\lVert\left(\mathcal E\otimes \mathcal I_{\mathcal K}\right)\rho - \left(\mathcal E'\otimes \mathcal I_{\mathcal K}\right)\rho\right\rVert_1$$ where the trace norm is used and $\mathcal I_{\mathcal K}$ is the identity operator on $\mathcal K$. Methods of calculating the diamond norm can be found in e.g. &lt;a href=&quot;https://arxiv.org/abs/1004.4110v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper by Benenti and Strini&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-15T00:16:57.453" LastActivityDate="2018-04-15T00:16:57.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1708" PostTypeId="4" CreationDate="2018-04-15T00:16:57.453" Score="0" Body="A distance measure can be used to find how 'far apart' two different quantum states or channels are. This tag is for general questions about different distance measures or when comparing different states or channels. For a specific measure, consider also using a specific tag for that measure." OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-15T00:16:57.453" LastActivityDate="2018-04-15T00:16:57.453" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1709" PostTypeId="2" ParentId="1429" CreationDate="2018-04-15T04:12:00.540" Score="2" Body="&lt;p&gt;Another approach to topological quantum computing could be that of topological insulators, and the use of the 1/2 integer quantum Hall effect. These insulators have the potential to be less error-prone. Topological insulators are both insulators, and conductors, at the same time, and being less error-prone, have the potential to provide a robust, quantum computing environment. Such topological insulator devices could be used in a topological quantum computer, by being a connector in between a classical system, and a quantum computer (&lt;a href=&quot;https://spectrum.ieee.org/nanoclast/semiconductors/materials/toplogical-insulators-take-step-closer-to-computing-uses&quot; rel=&quot;nofollow noreferrer&quot;&gt; IEEE Reference &lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="26" LastEditDate="2019-05-17T22:15:41.673" LastActivityDate="2019-05-17T22:15:41.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1710" PostTypeId="1" AcceptedAnswerId="1718" CreationDate="2018-04-15T06:45:54.140" Score="7" ViewCount="1490" Body="&lt;p&gt;&lt;strong&gt;Problem Statement:&lt;/strong&gt; We are given a $2-1$ function $f:\{0,1\}^{n}\to\{0,1\}^{n}$ such that: there is a secret string $s\in\{0,1\}^{n}$ such that: $f(x)=f(x\oplus s)$. Challenge: find $s$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Simon's algorithm&lt;/strong&gt; says:&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;Set up a random superposition $$\frac{1}{\sqrt{2}}|r\rangle + \frac{1}{\sqrt{2}}|r\oplus s\rangle$$&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Fourier sample to get a random $y$: $$y.s=0\ (\text{mod 2})$$&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Repeat steps $n-1$ times to generate $n-1$ linear equations in $s$.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;Solve for $s$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand steps (1) and (2). &lt;em&gt;Why&lt;/em&gt; and &lt;em&gt;how&lt;/em&gt; exactly do we set up the random superposition? How does it help? Also, in step (2), what does the dot operator (in $y.s$) stand for? Bit-wise multiplication?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-01T07:10:01.507" LastActivityDate="2018-05-01T07:10:01.507" Title="How exactly does Simon's algorithm solve the Simon's problem?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1711" PostTypeId="5" CreationDate="2018-04-15T06:54:15.173" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T06:54:15.173" LastActivityDate="2018-04-15T06:54:15.173" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1712" PostTypeId="4" CreationDate="2018-04-15T06:54:15.173" Score="0" Body="For questions regarding complexity analysis of quantum algorithms and comparisons with complexities of classical algorithms." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:49:53.727" LastActivityDate="2019-01-01T08:49:53.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1713" PostTypeId="5" CreationDate="2018-04-15T06:58:07.093" Score="0" Body="&lt;p&gt;For a quantum system in a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_S$&lt;/span&gt;, in a basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace \textbf{e}_j = \left|e_j\right&amp;gt;\right\rbrace$&lt;/span&gt; (using &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bra-ket notation&lt;/a&gt;, so the dual of &lt;span class=&quot;math-container&quot;&gt;$\left|e_j\right&amp;gt;$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt; e_j\right| = \left|e_j\right&amp;gt;^\dagger$&lt;/span&gt;), the state of a closed/isolated system (i.e. a 'pure state') can be written as &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \sum_j\alpha_j\left|e_j\right&amp;gt;$&lt;/span&gt;, with normalisation condition &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi|\psi\right&amp;gt; = 1$&lt;/span&gt;. Common bases for a qubit include the 'computational' basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace \left|0\right&amp;gt;, \left|1\right&amp;gt;\right\rbrace$&lt;/span&gt;, the X-basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace \left|+\right&amp;gt;, \left|-\right&amp;gt;\right\rbrace$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\left|\pm\right&amp;gt; = \frac{1}{\sqrt{2}}\left(\left|0\right&amp;gt;\pm\left|1\right&amp;gt;\right)$&lt;/span&gt; and the Y-basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace \frac{1}{\sqrt{2}}\left(\left|0\right&amp;gt;+i\left|1\right&amp;gt;\right), \frac{1}{\sqrt{2}}\left(\left|0\right&amp;gt;-i\left|1\right&amp;gt;\right)\right\rbrace$&lt;/span&gt;. Upon measurement, the probability of obtaining the result &lt;span class=&quot;math-container&quot;&gt;$\left|e_k\right&amp;gt;$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_k = \left|\left&amp;lt; e_k |\psi\right&amp;gt;\right|^2 = \left&amp;lt;\psi|P_k|\psi\right&amp;gt;$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P_k = \left| e_k\rangle\langle e_k\right|$&lt;/span&gt; is the 'projector' onto state &lt;span class=&quot;math-container&quot;&gt;$\left| e_k\right&amp;gt;$&lt;/span&gt;. More generally, for an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, the expectation value is &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt; A\right&amp;gt; = \left&amp;lt;\psi|A|\psi\right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the system is instead open/mixed, the system is described by a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_{j, k}c_{j, k}\left| e_k\rangle\langle e_j\right|$&lt;/span&gt; and the expectation of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$tr\left(\rho A\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="23" LastEditDate="2019-07-06T20:12:34.573" LastActivityDate="2019-07-06T20:12:34.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1714" PostTypeId="4" CreationDate="2018-04-15T06:58:07.093" Score="0" Body="Quantum systems can mathematically be described by their 'quantum state'. When the system is closed/isolated, the state is 'pure' and can be written as a sum (i.e. 'superposition') of basis vectors. When the system is a subsystem of an open system, the state is instead usually 'mixed' and cannot be written as a pure state, so has to be written as a density matrix. Consider using the density-matrix tag when relevant" OwnerUserId="26" LastEditorUserId="23" LastEditDate="2019-07-06T19:32:38.473" LastActivityDate="2019-07-06T19:32:38.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1715" PostTypeId="1" AcceptedAnswerId="1720" CreationDate="2018-04-15T09:37:38.783" Score="6" ViewCount="285" Body="&lt;p&gt;In my constant thrill to know more about Quantum Computing I wanna know what is this relation. Additionally: Can one use squeezed light to effect multi-qubit operations on single photon qubits, or are these completely independent approaches? &lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="26" LastEditDate="2018-12-23T14:04:09.693" LastActivityDate="2018-12-23T14:04:09.693" Title="What is the relation between single photon qubits and squeezed light qubits?" Tags="&lt;architecture&gt;&lt;physical-qubit&gt;&lt;optical-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1716" PostTypeId="1" CreationDate="2018-04-15T09:47:10.927" Score="7" ViewCount="178" Body="&lt;p&gt;In his &lt;a href=&quot;http://homepages.cwi.nl/~rdewolf/oratie-final.pdf&quot; rel=&quot;noreferrer&quot;&gt;inaugural lecture&lt;/a&gt;, Ronald de Wolf states&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;People are working with quantum objects, but trying to make them behave as classical as possible. (...) Instead of suppressing them to make systems behave as classically as possible, why not try to&#xA;  benefit from them?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While he goes on to state that looking at fully exploiting the quantum effects is more interesting, I do wonder if and how the 'naturally occurring' quantum effects on extremely small transistors could be used to get better classical (or perhaps some classical/quantum hybrid) computation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the design of those transistors needs to use quantum mechanics, but not necessarily quantum information or quantum computation theory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has there been any promising research or results in this direction? Or are the good reasons why this wouldn't work?&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2018-12-13T19:44:07.210" LastActivityDate="2018-12-13T19:44:07.210" Title="Can the theory of quantum computation assist in the miniaturization of transistors?" Tags="&lt;classical-computing&gt;&lt;research&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1717" PostTypeId="1" CreationDate="2018-04-15T10:50:59.103" Score="6" ViewCount="174" Body="&lt;p&gt;Pairs of entangled qubits (or Bell pairs, or EPR pairs) are a fundamental resource for quantum computing, in the sense that any computational platform that cannot generate entanglement will also be unable to provide a computational advantage.[1] In two recent questions, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1701/decoherence-of-spin-entangled-triplet-pair-states-in-the-solid-state-local-vs-d&quot;&gt;Decoherence of spin-entangled triplet-pair states in the solid state: local vs delocalized vibrations&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1700/entanglement-transfer-of-spin-entangled-triplet-pair-states-between-flying-qubit&quot;&gt;Entanglement transfer of spin-entangled triplet-pair states between flying qubits and stationary qubits&lt;/a&gt;, I asked about a physical scenario with the goal of &lt;strong&gt;generating entangled qubits pairs in the solid state&lt;/strong&gt;. I know of this result of 2013, &lt;a href=&quot;https://arxiv.org/abs/1212.6136&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heralded entanglement between solid-state qubits separated by 3 meters&lt;/a&gt;, which used photons and NV-centers in diamond, so this can be achieved in practice. Hoewever, I am not up-to-date on what is currently the best option. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: &lt;strong&gt;What is the current technological status for the generation of entangled qubit pairs in the solid state?&lt;/strong&gt; In particular, which options are currently fastest and/or most reliable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;[1] Thanks to Niel de Beaudrap who pointed that out in a comment.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-15T17:51:41.703" LastActivityDate="2018-04-16T14:57:33.863" Title="What are the current solutions to generate entangled qubits in the solid state?" Tags="&lt;architecture&gt;&lt;entanglement&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1718" PostTypeId="2" ParentId="1710" CreationDate="2018-04-15T11:03:42.410" Score="7" Body="&lt;p&gt;$$&#xA;\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}\newcommand{\proj}[1]{\left|#1\right\rangle\left\langle#1\right|}&#xA;$$&#xA;Much of the functionality here is the same as the Bernstien-Vazirani algorithm, if that helps. The following is more or less copy and pasted from some lecture notes I prepared at some point. It explains it in a slightly different way to the direction you're coming at it from, but hopefully gets you going in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit is, in principle, the same as for the Bernstein-Vazirani Algorithm, except that since the output of the function evaluation is $n$ bits, the second register, which is used for the reversible function evaluation, is also $n$ bits,&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kuLFN.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kuLFN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;This function evaluation is represented by the controlled-controlled...-controlled-U gate, acting as $\ket{x}\ket{y}\mapsto\ket{x}\ket{y\oplus f(x)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with the first set of Hadamards producing an equally weighted superposition of all strings of $n$ bits,&#xA;$$&#xA;\ket{0}\ket{0}\rightarrow\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}\ket{x}\ket{0}.&#xA;$$&#xA;This is followed by the function evaluation,&#xA;$$&#xA;\rightarrow\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}\ket{x}\ket{f(x)}.&#xA;$$&#xA;At this point, you &lt;em&gt;could&lt;/em&gt; measure the second register. This will return a random value of $f(r)$, so that the overall state of the system is in&#xA;$$&#xA;\frac{1}{\sqrt{2}}(\ket{r}+\ket{r\oplus s})\ket{f(r)}.&#xA;$$&#xA;So, the point is that you don't have to actively prepare different values of $r$; they will be selected for you by the measurement. We'll have to make a bit of an argument later on about how likely it is that we get new information each time we make such a measurement, but it'll all work out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I don't usually think about performing the measurement at this point; it's unnecessary (but would allow you to avoid the density matrix formalism in the following calculation). Instead, calculate the action of the final set of Hadamards, yielding the final output state&#xA;$$&#xA;\frac{1}{2^n}\sum_{x,z}(-1)^{x\cdot z}\ket{z}\ket{f(x)}.&#xA;$$&#xA;Here,&#xA;$$&#xA;x\cdot z= x_1z_1\oplus x_2z_2\oplus x_3z_3 \oplus\ldots \oplus x_nz_n,&#xA;$$&#xA;where $x_k$ is the $k^{th}$ bit of $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we collect unique values of $f(x)$,&#xA;$$&#xA;\frac{1}{2^n}\sum_{z,f(x)}\left((-1)^{x\cdot z}+(-1)^{(x\oplus s)\cdot z}\right)\ket{z}\ket{f(x)}.&#xA;$$&#xA;One can therefore verify that the output of the algorithm is&#xA;$$&#xA;\frac{1}{2^{n-1}}\sum_{z: s\cdot z=0}(-1)^{x\cdot z}\ket{z}\sum_{f(x)}\ket{f(x)}.&#xA;$$&#xA;The state of the first register clearly contains the information about $s$, but we need to extract it. Measuring the second register is not necessary (we could do it, but it doesn't help). Instead, let's trace out the second register, so we get&#xA;$$&#xA;\rho=\frac{1}{2^{2n-2}}\sum_{z: s\cdot z=0}\sum_{y: s\cdot y=0}\sum_x(-1)^{x\cdot(y\oplus z)}\ket{y}\bra{z}.&#xA;$$&#xA;By performing the sum over $x$, we are left with&#xA;$$&#xA;\rho=\frac{1}{2^{n-1}}\sum_{s\cdot z=0}\proj{z}.&#xA;$$&#xA;Measurement of the first register yields a binary string $z$ where $s\cdot z=0$. If we had $n-1$ such examples which are linearly independent, we would be able to determine $s$. This requires repeated application of the algorithm to find enough strings (this is the 'Fourier Sampling' part).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We must now justify that a linear number of applications is sufficient to find enough strings with high probability. In the absolute worst case, when we have found $n-2$ vectors, we must find the one remaining bit of information when there are still $2^{n-1}$ strings $s\cdot z=0$ to sample. These must constitute $1-2^{n-2}/2^{n-1}=\frac12$ of the space. Hence, the average number of trials to find one of these vectors is given by&#xA;$$&#xA;\frac{1}{2}\sum_{n=0}^\infty\frac{n+1}{2^n},&#xA;$$&#xA;which is readily evaluated using the following identities,&#xA;\begin{eqnarray}&#xA;\sum_{n=0}^\infty r^n&amp;amp;=&amp;amp;\frac{1}{1-r}	\nonumber\\&#xA;\frac{d}{dr}r\sum_{n=0}^\infty r^n&amp;amp;=&amp;amp;\sum_{n=0}^\infty (n+1)r^n.	\nonumber&#xA;\end{eqnarray}&#xA;On average, we always find another linearly independent vector by making $2$ samples, i.e. within $2n$ steps, we have a high probability of determining $s$. It is this final part of the argument, requiring some classical post-processing that differentiates Simon's algorithm from the Bernstein-Vazirani algorithm. Essentially, the difference comes from not knowing the eigenvectors of $U$ in advance. If we did, we could prepare the second register in a fixed state. Instead, it is prepared in a superposition of different eigenstates (which coincides with a nice state to prepare) and we have to rely on a certain amount of randomness to sample the elements we need.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-15T11:03:42.410" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1719" PostTypeId="2" ParentId="1488" CreationDate="2018-04-15T12:45:51.220" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there a reliable resource/website that calculates which key sizes are currently at risk, based on how fast the newest quantum computers are?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As other answers have conveyed, if a given algorithm is susceptible to attack by quantum computers, it's not really a question of going to a larger key length; it wouldn't take much technological advancement to bring that larger key length under threat (and you never really know what the current state of the art is). We've seen from the history of classical computers (e.g. Moore's Law) that once you pass some basic threshold, exponential improvements are possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What other answers haven't mentioned is timeliness. Yes, you could ask &quot;based on our current state of technology, is a particular algorithm &amp;amp; key length combination secure?&quot;, but that is only an instantaneous security. Sometimes that's good enough. If you want to agree a clandestine meeting with someone tomorrow, and so long as nobody finds out about it until after the fact, that's fine, you can use any algorithm that gave a yes answer to the question. However, what if that information is to remain secret for longer? Perhaps you're emailing someone the identity of an under-cover agent they are to meet. It's not good enough that the identity of that individual is protected now, but it must also be protected going into the future. Any data like that, you essentially have to assume that if it has been encrypted with an algorithm that is potentially susceptible to attack by a quantum computer, it will be read at some point, and is therefore compromised. Actually, if you're super-paranoid, you should assume this about all crypto algorithms anyway because even if the theory says they're perfectly secure, their practical implementation may be faulty and susceptible to cracking.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Or possibly, will new algorithms be created which try to prevent quantum computers from being able to crack them easily?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To replace these potentially breakable systems, you need new methods, which generally come under the banner of post-quantum crypto. Some of these exist already, but there are varying levels of confidence about how well they will actually hold up to attack. Much like with factoring numbers on a classical computer, where the difficulty was essentially based on &quot;lots of people have tried, and nobody's succeeded in doing it efficiently, so we guess it isn't possible&quot;, the argument is similar, but not so many people have tried, and not for so long, as to have a huge weight of confidence yet, although the aim is to back it up with a bit more rigour from CS, making connections to complexity classes, and particularly the assumption P$\neq$NP.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-15T12:45:51.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1720" PostTypeId="2" ParentId="1715" CreationDate="2018-04-15T13:09:23.203" Score="5" Body="&lt;p&gt;By photon qubits, I'm assuming that you meant single-photon qubit systems. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can one use squeezed light to effect multi-qubit operations on photon qubits, or are these completely independent approaches?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are two protocols in quantum communication namely, discrete-varibale (dv) and continuous variable (cv). Squeezed light qubits are a part of cv quantum communication protocols because continuous-variable entanglement can be efficiently produced using squeezed light. Whereas single-photon qubits are part of the dv protocols. So to answer your question, they are both different approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main difference between these protocols is explained in this review paper &quot;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0410100.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum information with continuous variables&lt;/a&gt;&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A valuable feature of quantum optical implementations based upon continuous variables, related to their high efficiency, is their 'unconditionalness'. Quantum resources such as entangled states emerge from the nonlinear optical interaction of a laser with a crystal  in an unconditional fashion. This 'unconditionalness' is hard to obtain in dv qubit-based implementations based on single-photon states.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To expand on the answer, &lt;a href=&quot;http://www.qi.aei-hannover.de/information-press/what-is-squeezed-light&quot; rel=&quot;noreferrer&quot;&gt;Splitting squeezed light on beam splitter results in two output beams in an entangled state&lt;/a&gt;. The quality of this entanglement produced leads to imperfect communication, where the degree of imperfection depends on the amount of squeezing of the laser light involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in a realistic quantum key distribution scenario, the cv states accumulate noise and emerge at the receiver as contaminated versions of the sender’s input states. The dv quantum information encoded in single-photon states is reliably conveyed for each photon that is not absorbed during transmission.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that this cleared your question.&lt;/p&gt;&#xA;" OwnerUserId="419" LastActivityDate="2018-04-15T13:09:23.203" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1721" PostTypeId="5" CreationDate="2018-04-15T13:46:46.433" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:46:46.433" LastActivityDate="2018-04-15T13:46:46.433" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1722" PostTypeId="4" CreationDate="2018-04-15T13:46:46.433" Score="0" Body="&quot;Quantum advantage&quot; or &quot;quantum supremacy&quot; is the potential ability of quantum computing devices to solve problems that classical computers practically cannot." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-10-20T17:27:13.527" LastActivityDate="2019-10-20T17:27:13.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1723" PostTypeId="5" CreationDate="2018-04-15T13:48:02.170" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:48:02.170" LastActivityDate="2018-04-15T13:48:02.170" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1724" PostTypeId="4" CreationDate="2018-04-15T13:48:02.170" Score="0" Body="Trapped ion quantum computing is one proposed approach to a large-scale quantum computing. Ions, or charged atomic particles, can be confined and suspended in free space using electromagnetic fields. Qubits are stored in stable electronic states of each ion, and quantum information can be transferred through the collective quantized motion of the ions in a shared trap (interacting through the Coulomb force)." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:06:40.983" LastActivityDate="2018-04-15T14:06:40.983" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1725" PostTypeId="5" CreationDate="2018-04-15T13:49:55.657" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:49:55.657" LastActivityDate="2018-04-15T13:49:55.657" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1726" PostTypeId="4" CreationDate="2018-04-15T13:49:55.657" Score="0" Body="Qiskit is an open source SDK for working with quantum computers at the level of pulses, circuits and application modules. If appropriate, also use the [programming] tag. " OwnerUserId="26" LastEditorUserId="1859" LastEditDate="2021-05-10T10:25:39.377" LastActivityDate="2021-05-10T10:25:39.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1727" PostTypeId="5" CreationDate="2018-04-15T13:52:22.077" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:52:22.077" LastActivityDate="2018-04-15T13:52:22.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1728" PostTypeId="4" CreationDate="2018-04-15T13:52:22.077" Score="0" Body="For questions related to microscopic systems made of a large number of interacting particles as relevant to quantum computing, or simulation of such systems using a quantum computer." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:10:00.980" LastActivityDate="2018-04-15T14:10:00.980" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1729" PostTypeId="5" CreationDate="2018-04-15T13:54:36.870" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:54:36.870" LastActivityDate="2018-04-15T13:54:36.870" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1730" PostTypeId="4" CreationDate="2018-04-15T13:54:36.870" Score="0" Body="Bayesian learning is a method of statistical inference in which Bayes' theorem is used to update the probability for a hypothesis as more evidence or information becomes available. Use this tag for questions regarding bayesian learning using quantum computers and/or quantum algorithms." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:06:50.903" LastActivityDate="2018-04-15T14:06:50.903" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1731" PostTypeId="5" CreationDate="2018-04-15T13:57:09.247" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:57:09.247" LastActivityDate="2018-04-15T13:57:09.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1732" PostTypeId="4" CreationDate="2018-04-15T13:57:09.247" Score="0" Body="In its simplest terms, quantum control is essentially the design of Hamiltonians to reach a desired final state of a quantum system from a specified initial state in a certain time duration.&#xD;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T16:00:45.237" LastActivityDate="2018-04-15T16:00:45.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1733" PostTypeId="5" CreationDate="2018-04-15T13:57:49.833" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:57:49.833" LastActivityDate="2018-04-15T13:57:49.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1734" PostTypeId="4" CreationDate="2018-04-15T13:57:49.833" Score="0" Body="In quantum information theory, a quantum channel is a communication channel which can transmit quantum information, as well as classical information. An example of quantum information is the state of a qubit. An example of classical information is a text document transmitted over the Internet. More formally, quantum channels are completely positive (CP) trace-preserving maps between spaces of operators. If appropriate, also use the [quantum-operation] tag." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:21:55.337" LastActivityDate="2019-01-01T09:21:55.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1735" PostTypeId="5" CreationDate="2018-04-15T13:59:16.093" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T13:59:16.093" LastActivityDate="2018-04-15T13:59:16.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1736" PostTypeId="4" CreationDate="2018-04-15T13:59:16.093" Score="0" Body="For questions related to usage of quantum computers for biological computing and/or their comparison with biological computers. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:09:45.220" LastActivityDate="2018-04-15T14:09:45.220" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1737" PostTypeId="5" CreationDate="2018-04-15T14:00:07.267" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:00:07.267" LastActivityDate="2018-04-15T14:00:07.267" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1738" PostTypeId="4" CreationDate="2018-04-15T14:00:07.267" Score="0" Body="Adiabatic quantum computation (AQC) is a form of quantum computing which relies on the adiabatic theorem to do calculations and is closely related to and may be regarded as a subclass of, quantum annealing. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:29:22.180" LastActivityDate="2019-01-01T09:29:22.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1739" PostTypeId="5" CreationDate="2018-04-15T14:01:07.827" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:01:07.827" LastActivityDate="2018-04-15T14:01:07.827" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1740" PostTypeId="4" CreationDate="2018-04-15T14:01:07.827" Score="0" Body="For questions regarding approximating results using quantum computers and/or quantum algorithms." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:07:34.850" LastActivityDate="2018-04-15T14:07:34.850" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1741" PostTypeId="5" CreationDate="2018-04-15T14:01:44.353" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:01:44.353" LastActivityDate="2018-04-15T14:01:44.353" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1742" PostTypeId="4" CreationDate="2018-04-15T14:01:44.353" Score="0" Body="Quantum cryptography is the science of exploiting quantum mechanical properties to perform cryptographic tasks." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:07:20.687" LastActivityDate="2018-04-15T14:07:20.687" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1743" PostTypeId="5" CreationDate="2018-04-15T14:04:06.787" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:04:06.787" LastActivityDate="2018-04-15T14:04:06.787" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1744" PostTypeId="4" CreationDate="2018-04-15T14:04:06.787" Score="0" Body="For questions regarding solving physics problems using quantum computers or applications of quantum computing in physics." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:08:50.477" LastActivityDate="2018-04-15T14:08:50.477" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1745" PostTypeId="5" CreationDate="2018-04-15T14:06:30.060" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:06:30.060" LastActivityDate="2018-04-15T14:06:30.060" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1746" PostTypeId="4" CreationDate="2018-04-15T14:06:30.060" Score="0" Body="For questions regarding the famous Simon's algorithm which solves Simon's problem exponentially faster than any deterministic or probabilistic classical algorithm, requiring exponentially less computational power than the best classical probabilistic algorithm." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:07:14.707" LastActivityDate="2018-04-15T14:07:14.707" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1747" PostTypeId="5" CreationDate="2018-04-15T14:07:35.463" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:07:35.463" LastActivityDate="2018-04-15T14:07:35.463" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1748" PostTypeId="4" CreationDate="2018-04-15T14:07:35.463" Score="0" Body="In Bell test experiments, the term quantum correlation has come to mean the expectation value of the product of the outcomes on the two sides. In other words, the expected change in physical characteristics as one quantum system passes through an interaction site. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:09:09.820" LastActivityDate="2018-04-15T14:09:09.820" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1749" PostTypeId="5" CreationDate="2018-04-15T14:08:37.793" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:08:37.793" LastActivityDate="2018-04-15T14:08:37.793" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1750" PostTypeId="4" CreationDate="2018-04-15T14:08:37.793" Score="0" Body="Continuous-variable quantum computing is a type of quantum computing that makes use of physical observables, like the strength of an electromagnetic field, whose numerical values belong to continuous intervals." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:09:04.497" LastActivityDate="2018-04-15T14:09:04.497" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1751" PostTypeId="5" CreationDate="2018-04-15T14:09:14.637" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:09:14.637" LastActivityDate="2018-04-15T14:09:14.637" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1752" PostTypeId="4" CreationDate="2018-04-15T14:09:14.637" Score="0" Body="Quantum error correction (QEC) is a collection of techniques to protect quantum information from decoherence and other quantum noise, to realise fault-tolerant quantum computation. Quantum error correction is expected to be essential for practical quantum computation in the face of noise on stored quantum information, faulty quantum gates, faulty state preparations, and faulty measurements. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:47:04.513" LastActivityDate="2019-01-01T08:47:04.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1753" PostTypeId="5" CreationDate="2018-04-15T14:09:56.007" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:09:56.007" LastActivityDate="2018-04-15T14:09:56.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1754" PostTypeId="4" CreationDate="2018-04-15T14:09:56.007" Score="0" Body="In quantum mechanics, the quantum eraser experiment is an interferometer experiment that demonstrates several fundamental aspects of quantum mechanics, including quantum entanglement and complementarity" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T14:10:12.007" LastActivityDate="2018-04-15T14:10:12.007" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1755" PostTypeId="5" CreationDate="2018-04-15T14:10:51.823" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:10:51.823" LastActivityDate="2018-04-15T14:10:51.823" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1756" PostTypeId="4" CreationDate="2018-04-15T14:10:51.823" Score="0" Body="For questions regarding usage of Majorana particles for quantum computation. A Majorana fermion, also referred to as a Majorana particle, is a fermion that is its own antiparticle. They were hypothesized by Ettore Majorana in 1937. The term is sometimes used in opposition to a Dirac fermion, which describes fermions that are not their own antiparticles." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:03:20.817" LastActivityDate="2018-04-15T15:03:20.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1757" PostTypeId="5" CreationDate="2018-04-15T14:12:35.847" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:12:35.847" LastActivityDate="2018-04-15T14:12:35.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1758" PostTypeId="4" CreationDate="2018-04-15T14:12:35.847" Score="0" Body="For questions regarding quantum computing on the Alibaba Cloud. Alibaba Cloud, a subsidiary of Alibaba Group, is a global cloud computing company headquartered in Hangzhou. Alibaba Cloud provides a suite of cloud computing services that covers elastic computing, object storage, relational database, big data analysis, and artificial intelligence in fifteen geographical regions around the globe. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:03:28.890" LastActivityDate="2018-04-15T15:03:28.890" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1759" PostTypeId="5" CreationDate="2018-04-15T14:15:12.760" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:15:12.760" LastActivityDate="2018-04-15T14:15:12.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1760" PostTypeId="4" CreationDate="2018-04-15T14:15:12.760" Score="0" Body="For questions regarding quantum computation by State Injection" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:05:23.930" LastActivityDate="2018-04-15T15:05:23.930" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1761" PostTypeId="5" CreationDate="2018-04-15T14:16:03.020" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:16:03.020" LastActivityDate="2018-04-15T14:16:03.020" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1762" PostTypeId="4" CreationDate="2018-04-15T14:16:03.020" Score="0" Body="Entanglement distillation is the transformation of N copies of an arbitrary entangled state into some number of approximately pure Bell pairs, using only local operations and classical communication (LOCC). (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:05:33.570" LastActivityDate="2019-01-01T10:05:33.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1763" PostTypeId="5" CreationDate="2018-04-15T14:17:31.800" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:17:31.800" LastActivityDate="2018-04-15T14:17:31.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1764" PostTypeId="4" CreationDate="2018-04-15T14:17:31.800" Score="0" Body="The randomized benchmarking method yields estimates of the computationally relevant errors without relying on accurate state preparation and measurement. Since it involves long sequences of randomly chosen gates, it also verifies that error behavior is stable when used in long computations. (arXiv:0707.0963)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:43:23.193" LastActivityDate="2019-01-01T09:43:23.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1765" PostTypeId="5" CreationDate="2018-04-15T14:18:36.227" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:18:36.227" LastActivityDate="2018-04-15T14:18:36.227" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1766" PostTypeId="4" CreationDate="2018-04-15T14:18:36.227" Score="0" Body="In quantum information theory, fidelity is a measure of the &quot;closeness&quot; of two quantum states. It expresses the probability that one state will pass a test to identify as the other. The fidelity is not a metric on the space of density matrices, but it can be used to define the Bures metric on this space. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:54:39.520" LastActivityDate="2019-01-01T09:54:39.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1767" PostTypeId="5" CreationDate="2018-04-15T14:19:08.320" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:19:08.320" LastActivityDate="2018-04-15T14:19:08.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1768" PostTypeId="4" CreationDate="2018-04-15T14:19:08.320" Score="0" Body="Bremermann's limit, named after Hans-Joachim Bremermann, is the maximum computational speed of a self-contained system in the material universe. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:03:59.457" LastActivityDate="2018-04-15T15:03:59.457" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1769" PostTypeId="5" CreationDate="2018-04-15T14:20:19.163" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:20:19.163" LastActivityDate="2018-04-15T14:20:19.163" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1770" PostTypeId="4" CreationDate="2018-04-15T14:20:19.163" Score="0" Body="For questions regarding scalability as relevant to quantum computation. Scalability is the capability of a system, network, or process to handle a growing amount of work, or its potential to be enlarged to accommodate that growth." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:05:09.443" LastActivityDate="2018-04-15T15:05:09.443" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1771" PostTypeId="5" CreationDate="2018-04-15T14:21:14.670" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:21:14.670" LastActivityDate="2018-04-15T14:21:14.670" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1772" PostTypeId="4" CreationDate="2018-04-15T14:21:14.670" Score="0" Body="For questions regarding quantum Fourier sampling. It's a method of efficiently approximating the distribution, sampled after a quantum Fourier transform over a system of qubits. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:04:49.977" LastActivityDate="2018-04-15T15:04:49.977" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1773" PostTypeId="5" CreationDate="2018-04-15T14:24:02.417" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:24:02.417" LastActivityDate="2018-04-15T14:24:02.417" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1774" PostTypeId="4" CreationDate="2018-04-15T14:24:02.417" Score="0" Body="Use this tag for questions about possible applications of quantum computing in improving neural network models and/or quantum neural networks.  Artificial neural networks (ANNs) or connectionist systems are computing systems vaguely inspired by the biological neural networks that constitute animal brains. Such systems &quot;learn&quot; (i.e. progressively improve performance on) tasks by considering examples, generally without task-specific programming (Wikipedia). " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:23:39.963" LastActivityDate="2018-07-15T13:23:39.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1775" PostTypeId="5" CreationDate="2018-04-15T14:24:32.450" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:24:32.450" LastActivityDate="2018-04-15T14:24:32.450" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1776" PostTypeId="4" CreationDate="2018-04-15T14:24:32.450" Score="0" Body="Deep learning (also known as deep structured learning or hierarchical learning) is part of a broader family of machine learning methods based on learning data representations, as opposed to task-specific algorithms. Learning can be supervised, semi-supervised or unsupervised." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:05:18.077" LastActivityDate="2018-04-15T15:05:18.077" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1777" PostTypeId="5" CreationDate="2018-04-15T14:25:04.120" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:25:04.120" LastActivityDate="2018-04-15T14:25:04.120" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1778" PostTypeId="4" CreationDate="2018-04-15T14:25:04.120" Score="0" Body="Topological quantum computing is a theoretical quantum computing model that employs two-dimensional quasiparticles called anyons, whose world lines pass around one another to form braids in a three-dimensional spacetime (i.e., one temporal plus two spatial dimensions)." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:05:05.337" LastActivityDate="2018-04-15T15:05:05.337" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1779" PostTypeId="5" CreationDate="2018-04-15T14:25:57.800" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:25:57.800" LastActivityDate="2018-04-15T14:25:57.800" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1780" PostTypeId="4" CreationDate="2018-04-15T14:25:57.800" Score="0" Body="For questions regarding representation of classical data in quantum computers" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-04-15T15:04:29.797" LastActivityDate="2018-04-15T15:04:29.797" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1781" PostTypeId="5" CreationDate="2018-04-15T14:27:15.817" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:27:15.817" LastActivityDate="2018-04-15T14:27:15.817" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1782" PostTypeId="4" CreationDate="2018-04-15T14:27:15.817" Score="0" Body="Shor's algorithm, named after American mathematician Peter Shor, is a quantum algorithm for integer factorization, formulated in 1994. Informally, it solves the following problem: given an integer N, find its prime factors." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2018-07-05T16:12:08.963" LastActivityDate="2018-07-05T16:12:08.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1783" PostTypeId="5" CreationDate="2018-04-15T14:39:26.953" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T14:39:26.953" LastActivityDate="2018-04-15T14:39:26.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1784" PostTypeId="4" CreationDate="2018-04-15T14:39:26.953" Score="0" Body="In quantum computing theory post-selection refers to giving a quantum computer the power to choose the outcomes of certain measurements, which greatly increases its computational power. In this case the, perhaps exponentially many, extra runs required to obtain the output are ignored. &#xD;&#xA;The important point is that an interference pattern is not produced immediately. (https://physics.stackexchange.com/a/38938)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:01:20.823" LastActivityDate="2019-01-01T10:01:20.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1785" PostTypeId="5" CreationDate="2018-04-15T15:07:21.500" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T15:07:21.500" LastActivityDate="2018-04-15T15:07:21.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1786" PostTypeId="4" CreationDate="2018-04-15T15:07:21.500" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-15T15:07:21.500" LastActivityDate="2018-04-15T15:07:21.500" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1788" PostTypeId="2" ParentId="1426" CreationDate="2018-04-15T18:52:38.237" Score="6" Body="&lt;p&gt;While I’m not an experimentalist, and have not studied these systems in any great depth, my (crude) understanding is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ion traps you (more or less) have to trap the ions in lines. However, this isn’t a limitation in terms of the ease of communication because what you’re probably thinking about is when a linear system has nearest neighbour interactions, I.e. each qubit can only interact with its immediate neighbours. In ion traps, this isn’t really true because you can access a common vibrating mode of all the ions in order to make arbitrary pairs interact directly. So actually, that’s really good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that number of qubits that you can store. The more atoms you put in the trap, the closer together their energy levels are, and the harder they become to individually address in order to control them and implement gates. This tends to limit the number of qubits you have in a single trapping area. To get around this (and with the added bonus of parallelism, necessary for error correction), people want to make multiple distinct trapping regions interact, either with flying qubits, or by shuttling the atoms between different trapping regions. This second approach seems to be very much in progress. &lt;a href=&quot;https://deepblue.lib.umich.edu/bitstream/handle/2027.42/62880/nature00784.pdf%3Bsequence=1&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; is the theory proposal, but I have certainly seen papers that have demonstrated the &lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1367-2630/12/3/033031/meta&quot; rel=&quot;noreferrer&quot;&gt;basic components&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-15T18:52:38.237" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1789" PostTypeId="1" AcceptedAnswerId="1791" CreationDate="2018-04-15T22:16:34.560" Score="7" ViewCount="642" Body="&lt;p&gt;I´ve solved the Exercise 7.1.1 (Bernstein–Vazirani problem) of the book &quot;An introduction to quantum computing&quot; (Mosca et altri). The problem is the following: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Show how to find $a \in Z_2^n$ given one application of a black box that maps $|x\rangle|b\rangle \to |x\rangle |b \oplus x · a\rangle$ for some $b\in \{0, 1\}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I´d say we can do it like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First i go from $|0|0\rangle \to \sum_{i \in \{0,1\}^n}|i\rangle| + \rangle$ using QFT and Hadamard&lt;/li&gt;&#xA;&lt;li&gt;Then I apply the oracle: &#xA;$$ \sum_{i \in \{0,1\}^n}(-1)^{(i,a)} |i\rangle| + \rangle $$&lt;/li&gt;&#xA;&lt;li&gt;Then I read the pase with an Hadamard (since we are in $Z_2^n$ our QFT is an Hadamard)&#xA;$$ |a\rangle |+ \rangle $$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think is correct. Do you agree?&lt;/p&gt;&#xA;" OwnerUserId="1644" LastActivityDate="2018-04-16T12:48:34.713" Title="Bernstein–Vazirani problem in book as exercise" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1790" PostTypeId="2" ParentId="1426" CreationDate="2018-04-16T04:23:33.707" Score="7" Body="&lt;p&gt;You may want to check out this Schaetz et al, Reports on Progress in Physics of 2012 &quot;&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/0034-4885/75/2/024401/meta&quot; rel=&quot;noreferrer&quot;&gt;Experimental quantum simulations of many-body physics with trapped ions&lt;/a&gt;&quot; (&lt;a href=&quot;https://pdfs.semanticscholar.org/7297/c133331f43b1d4be00388cdb4e424a4668b4.pdf&quot; rel=&quot;noreferrer&quot;&gt;alternate link in semanticscholar&lt;/a&gt;). In sum: &lt;strong&gt;yes, the arrangement of the ions is one key limitation to scalability, but no, configurations are not currently limited to a single line of atoms&lt;/strong&gt;. On that paper, check Figure 3 for experimental fluorescence images of laser-cooled ions in a common confining potential of a linear RF trap, including a single ion, a single line, a zig-zag chain and a three-dimensional construct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Figure 3 in the paper above by Schaetz et al: &quot;&lt;em&gt;Structural phase transitions can be induced between one-, two- and three-dimensional crystals, for example by reducing the ratio of radial to axial trapping frequencies.&lt;/em&gt;&quot; I am sure more recent review papers should exist, but this is the first one I found that was satisfactory. Admittedly, current results are more about direct simulation rather than universal computation, e.g. from figure 13 in the same paper: &quot;&lt;em&gt;Changing the experimental parameters non-adiabatically during a structural phase transition from a linear chain of ions to a zigzag structure, the order within the crystal breaks up in domains, framed by topologically protected defects that are suited to simulate solitons.&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the same topic, and also from 2012, another paper worth checking out would be &lt;a href=&quot;https://arxiv.org/abs/1204.5789&quot; rel=&quot;noreferrer&quot;&gt;Engineered two-dimensional Ising interactions in a trapped-ion quantum simulator with hundreds of spins (arXiv version)&lt;/a&gt; (&lt;a href=&quot;http://www.nature.com/articles/nature10981&quot; rel=&quot;noreferrer&quot;&gt;Nature version&lt;/a&gt;. You have the experimental picture as Figure 1; it is a Penning trap in this case rather than a Paul trap. Indeed, it is not universal quantum computing but rather the specialized application of quantum simulation, but still it is undeniably experimental progress towards &lt;em&gt;holding ions in place in a 2-D trap&lt;/em&gt; and thus advancing towards scalability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am myself no expert in traps, but this is what I got on scalability in a recent (2017) conference:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Experimentalists play around with the potentials and achieve interesting combinations, with central zones that are quasi-crystalline (chains, ladders, ribbons etc) and exotic tips (e.g. ribbons or ladders that finish in a single atom). &lt;/li&gt;&#xA;&lt;li&gt;The majority of the popular ions have a configuration of the type [noble-gas]$s^1$ (like Ca$^+$), preferredly with no nuclear spin but this is for convenience and simplicity. Accessing hyperfine states and/or a more complex spin level structure (like Yb$^+$=[Xe]f$^{14}$s$^2$) opens the door to a richer Hilbert space per ion.&lt;/li&gt;&#xA;&lt;li&gt;Collective vibrations are used as the basis of interqubit communication. As in the previous point, the breathing mode is uniquely stable and thus convenient to use, but other vibrations are also accessible and would allow more interesting interqubit communication schemes. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-19T05:37:50.093" LastActivityDate="2018-04-19T05:37:50.093" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1791" PostTypeId="2" ParentId="1789" CreationDate="2018-04-16T07:01:48.590" Score="7" Body="&lt;p&gt;This is not correct: you need to use the state $|-\rangle=(|0\rangle-|1\rangle)/\sqrt{2}$ instead of $|+\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important thing is that you've missed showing how the black box map that you've stated gives the oracle output that you've stated. To see this, apply the map on&#xA;$$&#xA;|x\rangle|+\rangle\mapsto|x\rangle(|0\oplus x\cdot a\rangle+|1\oplus x\cdot a\rangle)/\sqrt{2}=|x\rangle(|0\rangle+|1\rangle)/\sqrt{2}.&#xA;$$&#xA;When the $|+\rangle$ state is there, you get no phase. Meanwhile, with the $|-\rangle$ state,&#xA;$$&#xA;|x\rangle|-\rangle\mapsto|x\rangle(|0\oplus x\cdot a\rangle-|1\oplus x\cdot a\rangle)/\sqrt{2}=\left\{\begin{array}{cc} |x\rangle(|0\rangle-|1\rangle)/\sqrt{2} &amp;amp; x\cdot a=0 \\ |x\rangle(|1\rangle-|0\rangle)/\sqrt{2} &amp;amp; x\cdot a=1\end{array}\right..&#xA;$$&#xA;This can simply be written as $(-1)^{x\cdot a}|x\rangle|-\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-16T12:48:34.713" LastActivityDate="2018-04-16T12:48:34.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1792" PostTypeId="1" AcceptedAnswerId="1827" CreationDate="2018-04-16T09:25:48.237" Score="13" ViewCount="1122" Body="&lt;p&gt;I read that a qubit can be encoded in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Fock_state&quot; rel=&quot;noreferrer&quot;&gt;Fock state&lt;/a&gt;, such as the presence or absence of a photon. How do you perform single qubit rotations on Fock states? &lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="26" LastEditDate="2018-12-23T12:20:17.253" LastActivityDate="2018-12-23T12:20:17.253" Title="How do you rotate a Fock state qubit?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1793" PostTypeId="2" ParentId="1792" CreationDate="2018-04-16T10:28:55.760" Score="7" Body="&lt;p&gt;The short answer is that you can't. There's something called a &quot;particle number superselection rule&quot; which postulates that you can't create a superposition of different numbers of particles. So, if you prepare a Fock state, you can perform phase gates, and bit flips, but you cannot perform arbitrary rotations that create superpositions of different particle number.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The longer answer is that sometimes you can make superpositions, if you have the right reference frame available. There's a good discussion of this stuff &lt;a href=&quot;https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.79.555&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. This is the reason why states such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Coherent_states&quot; rel=&quot;noreferrer&quot;&gt;coherent states&lt;/a&gt;, which are a superposition of different numbers of photons, can be created (and they get used for quantum computation, but that's an entirely different question). But I believe that this can't work with small photon numbers (e.g. the presence or absence of a single photon). The only thing you can do in that context is create a superposition of a single photon being in one of two places.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-16T10:28:55.760" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1794" PostTypeId="1" AcceptedAnswerId="1795" CreationDate="2018-04-16T10:56:52.610" Score="14" ViewCount="1344" Body="&lt;p&gt;In a lecture, recorded on &lt;a href=&quot;https://www.youtube.com/watch?v=L5gSZsezhoQ&quot; rel=&quot;noreferrer&quot;&gt;Youtube&lt;/a&gt;, Gil Kalai presents a 'deduction' for why topological quantum computers will not work. The interesting part is that he claims this is a stronger argument than the argument against fault tolerant computing in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand his argument correctly, he states that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A (hypothetical) quantum computer &lt;em&gt;without quantum error correction&lt;/em&gt; can simulate the system of anyons representing the qubit in a topological quantum computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Therefore, any quantum computer based on these anyons must have at least as much noise as a quantum computer without quantum error correction. As we know that our noisy quantum computer is insufficient for universal quantum computation, topological quantum computers based on anyons cannot provide universal quantum computation either.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I think step 2 is sound, but I have some doubts on step 1 and why it implies 2. In particular:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why can a quantum computer without error correction simulate the system of anyons?&lt;/li&gt;&#xA;&lt;li&gt;If it can simulate the system of anyons, is it possible that it can only do so with low probability and hence cannot simulate the topological quantum computer with the same fault tolerance as the system of anyons?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="253" LastEditorUserId="26" LastEditDate="2018-12-13T19:45:11.687" LastActivityDate="2018-12-13T19:45:11.687" Title="Is Gil Kalai's argument against topological quantum computers sound?" Tags="&lt;error-correction&gt;&lt;topological-quantum-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 3.0" />
  <row Id="1795" PostTypeId="2" ParentId="1794" CreationDate="2018-04-16T11:48:35.727" Score="11" Body="&lt;p&gt;A topological quantum computer could be made by using an exotic phase of matter in which anyons arise as localized effects (such as quasiparticles or defects). In this case, errors typically cost energy, and so the probability is suppressed for small temperatures (though it will never be zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A topological quantum computer could also be made (or one could also say &lt;em&gt;simulated&lt;/em&gt;) by a standard gate model quantum computer, such as one based on qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In either case, we are using a noisy medium to engineer a system of anyons. And so we will get a noisy system of anyons. The effects of the noise will cause our anyons to wander around, as well as causing pair creations of additional anyons, etc. If these effects are not accounted for, it will cause errors in any topological quantum computation that we intend to do. So in this sense, his arguments are correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important point to note, therefore, is that we must not fail to account for the errors. We must look at the system, keep track of where all anyons are, try to identify which ones we are using, and identify how to clear away the ones that have been created in error. This means that we must do error correction within the topological quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The promise of TQC is mainly that there should be ways to engineer topological phases that will have &lt;em&gt;less&lt;/em&gt; noise. They should therefore require &lt;em&gt;less&lt;/em&gt; error correction. But they will definitely need some.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a gate model quantum computer &lt;em&gt;simulating&lt;/em&gt; a topological quantum computer, the benefits are that topological error correction is quite straightforward and has high thresholds. The surface codes are examples of this. But we don't usually think of this as a gate model QC simulating a topological QC. We just think of it as a good example of a quantum error correcting code.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-16T12:07:22.070" LastActivityDate="2018-04-16T12:07:22.070" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1796" PostTypeId="1" AcceptedAnswerId="1814" CreationDate="2018-04-16T13:18:45.773" Score="8" ViewCount="396" Body="&lt;p&gt;Since the original experimental contribution using the  &lt;a href=&quot;https://www.nature.com/articles/414883a&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's factoring algorithm&lt;/a&gt; to factorize the integer 15 some experiments have been performed in order to calculate the largest factorized number. But most of the experiments are particularly designed for a specific number (&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) and not a general approach which could be used for any &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;N$&lt;/span&gt; integer. &lt;a href=&quot;https://phys.org/news/2014-11-largest-factored-quantum-device.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering which is, at the moment, the largest number that has been experimentally factorized in a general procedure by a quantum algorithm.&lt;/p&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="26" LastEditDate="2018-11-25T15:23:17.567" LastActivityDate="2018-11-25T15:23:17.567" Title="Which is the highest number factorized by QC in a non-specific experiment?" Tags="&lt;algorithm&gt;&lt;experiment&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="1797" PostTypeId="2" ParentId="1717" CreationDate="2018-04-16T14:16:41.577" Score="3" Body="&lt;p&gt;&lt;strong&gt;Superconducting qubits&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several possible approaches. In the most popular scheme the qubits are always coupled, but off resonant and thus the energy conservation prevents the exchange of excitation. With external magnetic flux the qubits can be tuned temporarily into a resonance. The qubits will pick up a phase, which will depend on the state of the other qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For first works see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303002&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strauch2003&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/0903.2030&quot; rel=&quot;nofollow noreferrer&quot;&gt;DiCarlo2009&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These days cPhase gates are done routinely &amp;lt; 300 ns and fidelity &gt;99%. &lt;a href=&quot;https://arxiv.org/abs/1511.03316&quot; rel=&quot;nofollow noreferrer&quot;&gt;Barends2016&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1502.06778&quot; rel=&quot;nofollow noreferrer&quot;&gt;Salathe2015&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1604.03076&quot; rel=&quot;nofollow noreferrer&quot;&gt;McKay2016&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As superconducting qubits work in microwave regime and are thus operated at cryogenic temperature it is not straight forward to do a two qubit gate between distant qubits. A gate between qubits on different chips in the same cryostat has been demonstrated (eg. &lt;a href=&quot;https://arxiv.org/abs/1712.08593&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kurpiers2017a&lt;/a&gt;), but in order to conduct a gate between different cryostats either a microwave-to-optical and optical-to-microwave converter is needed or alternatively a low loss cryogenic microwave link needs to be built.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum dots&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are different degrees of freedom in multi-quantum-dot systems which can be used as a qubti. Thus there are different exact mechanisms. Typically either direct exchange interaction or tunable perturbation of a non-computational state is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Single-quantum-dot spin qubits: &lt;a href=&quot;https://arxiv.org/abs/1708.04214&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watson2018&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Double-quantum-dot spin qubits: &lt;a href=&quot;https://www.nature.com/articles/s41534-016-0003-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nichol2017&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Between a spin and a photon: &lt;a href=&quot;https://arxiv.org/abs/1710.03265&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mi2018&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1989" LastEditorUserId="1989" LastEditDate="2018-04-16T14:57:33.863" LastActivityDate="2018-04-16T14:57:33.863" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1799" PostTypeId="1" AcceptedAnswerId="1800" CreationDate="2018-04-16T21:26:17.250" Score="9" ViewCount="440" Body="&lt;p&gt;I understand the notation for classical error correcting codes. E.g., &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Hamming(7,4)&quot; rel=&quot;noreferrer&quot;&gt;Hamming(7,4)&lt;/a&gt;&quot; stands for a Hamming code that uses 7 bits to encode blocks of 4 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does the notation for quantum error correcting codes mean? E.g., there is &lt;a href=&quot;https://arxiv.org/abs/1705.08957&quot; rel=&quot;noreferrer&quot;&gt;a paper&lt;/a&gt; that deals with a [[4,2,2]]-code. What are these three numbers? What do double brackets stand for?&lt;/p&gt;&#xA;" OwnerUserId="528" LastEditorUserId="26" LastEditDate="2018-05-07T13:19:20.393" LastActivityDate="2018-05-07T13:19:20.393" Title="What does quantum error correction code notation stand for?" Tags="&lt;notation&gt;&lt;error-correction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1800" PostTypeId="2" ParentId="1799" CreationDate="2018-04-16T23:04:09.650" Score="6" Body="&lt;p&gt;An $[\![n,k,d]\!]$ code is a quantum error correction code which encodes $ k$ qubits in an $ n$-qubit state, in such a way that any operation which maps some encoded state to another encoded state must act on at least $d$ qubits. (So, for example, any encoded state which has been subjected to an error consisting of at most $\lfloor (d-1)/2 \rfloor $ Pauli operations can in principle be recovered perfectly).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This notation generalises the notation $ [n,k,d]$ for classical error correction codes, in which $ k$-bit &quot;plaintext&quot; strings are encoded in $n$-bit &quot;codeword&quot; strings, in such a way that at least $d $ bits must be flipped to transform between any two codewords representing different plaintexts. (In this context and in the quantum case, $ d $ is referred to as the &lt;em&gt;code distance&lt;/em&gt;.) The double-brackets are used simply to denote that the code being referred to is a quantum error correction code rather than a classical code. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-04-17T08:21:54.377" LastActivityDate="2018-04-17T08:21:54.377" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1801" PostTypeId="2" ParentId="1799" CreationDate="2018-04-16T23:51:38.320" Score="4" Body="&lt;p&gt;Taking an $\left[\left[n, k, d\right]\right]$ code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classical equivalent to this is an $\left[n, k, d\right]$ code, which is a code referring to the number of bits, $n$, encoding $k$ bits. The third number, $d$, is the minimum Hamming distance taken between any two codewords. This is equal to the minimum Hamming weight (i.e. number of non-zero bits) of non-zero codewords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the classical case, &lt;strong&gt;in the quantum case&lt;/strong&gt;, the first two numbers are referring to the numbers of qubits, $n$, that encode $k$ qubits. $d$ is still used to refer to distance, but the definition of &lt;em&gt;distance&lt;/em&gt; has to be changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;weight&lt;/em&gt;, $t$, of a Pauli operator $E_a$, is the number of qubits that a (single-qubit) Pauli operator $\left(X, Y \text{ or } Z\right)$ acts on. As an example, arbitrarily taking $E_1 = X\otimes I\otimes I\otimes Z\otimes I$, $E_1$ has a weight $t=2$. The distance is then the minimum weight that the overlap of a Pauli operator (in the space of possible errors) acting on a codeword, with a &lt;em&gt;different&lt;/em&gt; codeword is non-zero, or the minimum weight such that $\left&amp;lt;j\vert E_a\vert i\right&amp;gt;\neq C_a\delta_{ji}$ for some (real) $C_a$ for all codewords $i$ and $j$. That is, the distance is the minimum number of errors that can occur on a codeword that causes it to be mapped to a different codeword.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more details, see e.g. Chapter 7 of &lt;a href=&quot;http://www.theory.caltech.edu/%7Epreskill/ph219/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill's quantum computation notes&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-04-16T23:51:38.320" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1802" PostTypeId="1" AcceptedAnswerId="1811" CreationDate="2018-04-17T01:17:41.923" Score="11" ViewCount="233" Body="&lt;p&gt;I want to simulate large stabilizer circuits (H/S/CNOT/MEASURE/feedforward) with a small number of T gates mixed in. How can I do this in a way that scales exponentially only in the number of T gates? Are there existing implementations?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="27" LastEditDate="2019-07-18T17:55:54.080" LastActivityDate="2019-07-18T17:55:54.080" Title="Simulating Clifford + few-T circuits" Tags="&lt;circuit-construction&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1803" PostTypeId="1" AcceptedAnswerId="1805" CreationDate="2018-04-17T02:37:03.897" Score="26" ViewCount="6868" Body="&lt;p&gt;Plain and simple. Does &lt;a href=&quot;https://en.wikipedia.org/wiki/Moore&amp;#39;s_law&quot; rel=&quot;noreferrer&quot;&gt;Moore's law&lt;/a&gt; apply to quantum computing, or is it similar but with the numbers adjusted (ex. triples every 2 years). Also, if Moore's law doesn't apply, why do qubits change it?&lt;/p&gt;&#xA;" OwnerUserId="1348" LastEditorUserId="26" LastEditDate="2018-12-13T19:45:42.137" LastActivityDate="2019-05-01T09:30:35.747" Title="Does Moore's law apply to quantum computing?" Tags="&lt;classical-computing&gt;&lt;history&gt;&lt;scalability&gt;" AnswerCount="5" CommentCount="3" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1804" PostTypeId="2" ParentId="1803" CreationDate="2018-04-17T06:22:28.217" Score="6" Body="&lt;p&gt;The first thing to understand about Moore’s law is that it is not a law in the absolute sense, mathematically provable, or even postulated (like a law of physics). Really, it was just a rule of thumb that said the number of transistors in a processor would double every x years. This can be seen in the way that the value x has changed over time. Originally, it was x=1, then it became x=2, then what it was applied to (processor speed) changed. It has proved to be a useful rule of thumb, partly because it was the rule of thumb that was used to set targets for new generations of processor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, there is absolutely no reason why Moore’s law should apply to quantum computers, but it would not be unreasonable to guess that, past some basic threshold, qubit numbers will double every y years. For most implementations of quantum computation, we don’t yet have enough data points to start extrapolating an estimate for the value y. Some might argue that it’s not even clear yet whether we’re in the “vacuum tube” or “transistor” era of quantum computing (Moore’s law didn’t start until the transistor era).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We might start to try and extrapolate for some systems. For example, D-wave has a history of doubling its processor sizes. This started as y=1, and currently has about y=2. Of course, this is not a universal quantum computing device. The next best thing we might look at is the IBM quantum processor. In a year, the computer available on the IBM quantum experience went from 5 qubits to 16, although I don’t think it’s reasonable to extrapolate based on this.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-17T06:22:28.217" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1805" PostTypeId="2" ParentId="1803" CreationDate="2018-04-17T06:24:32.837" Score="23" Body="&lt;p&gt;If you take as definition &quot;&lt;em&gt;the number of transistors in a dense integrated circuit doubles about every two years&lt;/em&gt;&quot;, it definitely does not apply: as answered here in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1696/do-the-fundamental-circuit-elements-have-a-correspondence-in-quantum-technolog&quot;&gt;Do the 'fundamental circuit elements' have a correspondence in quantum technologies?&lt;/a&gt; there exist no transistors-as-fundamental-components (nor do exist fundamental-parallel-to-transistors) in a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take a more general definition &quot;&lt;em&gt;chip performance doubles aproximately every 18 months&lt;/em&gt;&quot;, the question makes more sense, and the answer is still that &lt;strong&gt;it does not apply&lt;/strong&gt;, mainly because Moore's law is not one of fundamental Physics. Rather, in the early stages, it was an observation of a stablished industry. Later, as pointed out in a comment,[1] it has been described as functioning as an &quot;&lt;em&gt;evolving target&lt;/em&gt;&quot; and as a &quot;&lt;em&gt;self-fulfilling prophecy&lt;/em&gt;&quot; for that same industry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key is that &lt;strong&gt;we do not have a stablished industry producing quantum computers.&lt;/strong&gt; We are not in the quantum equivalent from 1965. Arguably we will move faster, but in many aspects we are rather in the XVII-XVIII centuries. For a perspective, check this &lt;a href=&quot;https://en.wikipedia.org/wiki/Timeline_of_computing_hardware_before_1950&quot; rel=&quot;noreferrer&quot;&gt;timeline of computing hardware before 1950&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more productive answer, there are a few fundamental differences and a few possible parallels between classical and quantum hardware, in the context of Moore's law:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For many architectures, in a certain sense we already work with the smallest possible component. While we might develop ion traps (of a fixed size) fitting more ions, but we cannot develop smaller ions: they are of atomic size.&lt;/li&gt;&#xA;&lt;li&gt;Even when we are able to come up with tricks, such as &lt;a href=&quot;https://arxiv.org/abs/1610.03994&quot; rel=&quot;noreferrer&quot;&gt;Three addressable spin qubits in a molecular single-ion magnet&lt;/a&gt;, they are still fundamentally limited by quantum mechanics. We need control over 8 energy levels to control 3 qubits ($2^n$), which is doable, but not scalable.&lt;/li&gt;&#xA;&lt;li&gt;Precisely because the scalability issue is one of the hardest problem we have with quantum computers -not just having a larger number of qubits, buy also being able to entangle them- it's dangerous to extrapolate from current progress. See for illustration the history of &lt;a href=&quot;https://en.wikipedia.org/wiki/Nuclear_magnetic_resonance_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;NMR quantum computers&lt;/a&gt;, which stalled after a very early string of successes. In theory, increasing the number of qubits in the device was trivial. In practice, every time you want to be able to control 1 more qubit you need to double the resolution of your machine, which becomes very unfeasible very quickly.&lt;/li&gt;&#xA;&lt;li&gt;If and when there exists an industry that relies on an evolving technology which is able to produce some kind of integrated quantum chips, then yes, at that point we will be able to draw a real parallel to Moore's law. For a taste of how far we are from that point, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2017/are-there-any-estimates-on-how-complexity-of-quantum-engineering-scales-with-siz&quot;&gt;Are there any estimates on how complexity of quantum engineering scales with size?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;em&gt;Thanks to Sebastian Mach for that insight and &lt;a href=&quot;https://en.wikipedia.org/wiki/Moore&amp;#39;s_law#As_an_evolving_target_for_industry&quot; rel=&quot;noreferrer&quot;&gt;wikipedia link&lt;/a&gt;. For more details on that see &lt;a href=&quot;https://books.google.es/books?id=1khslZ-jbgEC&amp;amp;pg=PA206&amp;amp;redir_esc=y#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;Getting New Technologies Together: Studies in Making Sociotechnical Order&#xA;edited by Cornelis Disco, Barend van der Meulen, p. 206&lt;/a&gt; and &lt;a href=&quot;https://www.theinquirer.net/inquirer/news/1014782/gordon-moore-aloha-moore-law&quot; rel=&quot;noreferrer&quot;&gt;Gordon Moore says aloha to Moore's Law&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-05-10T18:54:03.470" LastActivityDate="2018-05-10T18:54:03.470" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="1806" PostTypeId="1" AcceptedAnswerId="1810" CreationDate="2018-04-17T07:44:02.087" Score="30" ViewCount="4587" Body="&lt;p&gt;Quantum state teleportation is the quantum information protocol where a qubit is transferred between two parties using an initial shared entangled state, Bell measurement, classical communication and local rotation. Apparently, there is also something called quantum gate teleportation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is quantum gate teleportation and what is it used for?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am particularly interested in possible applications in simulating quantum circuits.&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="55" LastEditDate="2020-09-10T11:47:02.903" LastActivityDate="2020-09-10T11:47:02.903" Title="What is quantum gate teleportation?" Tags="&lt;quantum-gate&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="17" ContentLicense="CC BY-SA 3.0" />
  <row Id="1807" PostTypeId="1" AcceptedAnswerId="1816" CreationDate="2018-04-17T08:15:49.980" Score="8" ViewCount="321" Body="&lt;p&gt;I read that a qubit can be encoded in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Polarization_%28waves%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;polarization state&lt;/a&gt; (horizontal or vertical polarization of a photon). How do you perform two-qubit operations on a polarization qubit?&lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="26" LastEditDate="2018-12-13T19:45:53.790" LastActivityDate="2018-12-13T19:45:53.790" Title="How do you apply a CNOT on polarization qubits?" Tags="&lt;quantum-gate&gt;&lt;physical-qubit&gt;&lt;optical-quantum-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1808" PostTypeId="1" CreationDate="2018-04-04T18:57:56.557" Score="8" ViewCount="307" Body="&lt;p&gt;For an integer, $N$, to be factorised, with $a$ (uniformly) chosen at random between $1$ and $N$, with $r$ the order of $a\mod N$ (that is, the smallest $r$ with $a^r\equiv 1\mod N$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is that in Shor's algorithm we have to discard the scenario in which $a^{r/2} =-1 \mod N$? Also, why shouldn't we discard the scenario when $a^{r/2} = 1 \mod N$?&lt;/p&gt;&#xA;" OwnerUserId="5410" OwnerDisplayName="user2508039" LastEditorUserId="23" LastEditDate="2018-04-17T09:40:18.167" LastActivityDate="2019-03-04T21:30:28.183" Title="Shor's algorithm caveats when $a^{r/2} =-1 \mod N$" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1809" PostTypeId="2" ParentId="1806" CreationDate="2018-04-17T08:35:51.683" Score="10" Body="&lt;p&gt;Gate teleportation is in principle a method that allows the creation of different gates from an available set of gates, by teleporting qubits through entangled states. An example of the use of this method, is the creation of the T gate from a Clifford set of gates in order to make the set universal. The construction in this particular case is done with the use of special T ancillae. The standard reference can be found in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9908010&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9908010&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simulating quantum circuits you can use the gate teleportation to move gates around the circuit with the use of ancillae qubit (number of ancillae depended on the number of gates).&lt;/p&gt;&#xA;" OwnerUserId="2000" LastEditorUserId="26" LastEditDate="2019-05-13T21:20:29.030" LastActivityDate="2019-05-13T21:20:29.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1810" PostTypeId="2" ParentId="1806" CreationDate="2018-04-17T08:52:23.860" Score="27" Body="&lt;p&gt;Quantum gate teleportation is the act of being able to apply a quantum gate on the unknown state while it is being teleported. This is one of the ways in which &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;measurement-based computation&lt;/a&gt; can be described using graph states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, teleportation works by having an unknown quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; held by Alice, and two qubits in the Bell state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=(|00\rangle+|11\rangle)/\sqrt{2}$&lt;/span&gt; shared between Alice and Bob. Alice performs a Bell state measurement, getting one of 4 possible answers and Bob holds on his qubit, depending on the measurement result of Alice, one of the 4 states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle,X|\psi\rangle,Z|\psi\rangle,ZX|\psi\rangle.$&lt;/span&gt; So, once Bob learns what result Alice got, he can compensate by applying the appropriate Paulis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be a 1-qubit unitary. Assume Alice and Bob share &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{I}\otimes U)|\Psi\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. If they repeat the teleportation protocol, Bob now has one of &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle,UX|\psi\rangle,UZ|\psi\rangle,UZX|\psi\rangle$&lt;/span&gt;, which we can rewrite as &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle,(UXU^\dagger)U|\psi\rangle,(UZU^\dagger)U|\psi\rangle,(UZXU^\dagger)U|\psi\rangle.$&lt;/span&gt; The compensations that Bob has to make for a given measurement result are given by the bracketed terms. Often, these are no worse than the compensations you would have to make for normal teleportation (i.e. just the Pauli rotations). For example, if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the Hadamard rotation, then the corrections are just &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{I},Z,X,XZ)$&lt;/span&gt; respectively. So, you can apply the Hadamard during teleportation just be changing the state that you teleport through (There is a strong connection here to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Channel-state_duality&quot; rel=&quot;noreferrer&quot;&gt;Choi-Jamiołkowski isomorphism&lt;/a&gt;). You can do the same for Pauli gates, and the phase gate &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z}=S$&lt;/span&gt;. Moreover, if you repeat this protocol to build up a more complicated computation, it is often sufficient to keep a record of what these corrections are, and to apply them later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you don't only need the Pauli gates (as is the case for &lt;span class=&quot;math-container&quot;&gt;$T=\sqrt{S}$&lt;/span&gt;), the compensations may be easier than implementing the gate directly. This is the basis of the construction of the fault-tolerant T gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, you can do something similar to apply a controlled-NOT between a pair of qubits as well. This time, the state you need is &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle_{A_1B_1}|\Psi\rangle_{A_1B_1}$&lt;/span&gt;, and a controlled-NOT applied between &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;. This time, there are 16 possible compensating rotations, but all of them are just about how Pauli operations propagate through the action of a controlled-NOT and, again, that just gives Pauli operations out.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-08T06:07:39.677" LastActivityDate="2018-11-08T06:07:39.677" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1811" PostTypeId="2" ParentId="1802" CreationDate="2018-04-17T08:53:49.653" Score="8" Body="&lt;p&gt;Taking your comment to Kiro to its logical conclusion, the answer is 'yes'. The basic idea is to decompose the T&amp;nbsp;gate 'magic' state $\tfrac{1}{\sqrt 2}\bigl(\lvert 0 \rangle + \mathrm{e}^{i \pi / 4} \lvert 1 \rangle \bigr)$ as a linear combination of stabiliser states. (If you do this for several magic states, this produces an exponentially large linear combination.) Representing the T-gate states involved as density operators, together with any other stabiliser states introduced as inputs or as auxiliary work-space, we can use this expansion to compute the probability of any particular Pauli measurement outcome, such as a&amp;nbsp;standard basis measurement on a single qubit, after performing a stabiliser circuit and gate teleportations of the T&amp;nbsp;gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea behind this can be improved by noting that there is more than one way to expand the T-gate state as a linear combination &amp;mdash; particularly if you consider decompositions of &lt;em&gt;several&lt;/em&gt; T-gate states at once, rather than expanding each T-gate state independently, and if furthermore you are happy with an approximate simulation rather than an exact one (see e.g.&amp;nbsp;[&lt;a href=&quot;https://arxiv.org/abs/1601.07601&quot; rel=&quot;noreferrer&quot;&gt;Bravyi+Gossett 2016&lt;/a&gt;] and [&lt;a href=&quot;https://arxiv.org/abs/1609.07488&quot; rel=&quot;noreferrer&quot;&gt;Campbell+Howard 2017&lt;/a&gt;]).&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-17T08:53:49.653" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1812" PostTypeId="2" ParentId="1808" CreationDate="2018-04-17T09:07:36.533" Score="2" Body="&lt;p&gt;There is no scenario of $a^{r/2}\equiv 1\text{ mod }N$ because you have already assumed that $r$ is the smallest value such that $a^r\equiv1\text{ mod }N$, and $r/2$ is smaller than $r$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you why you have to discount $a^{r/2}\equiv -1\text{ mod }N$, the point is that you've found something that satisfies $(a^r-1)=kN$ for some integer $k$. This factors as $(a^{r/2}-1)(a^{r/2}+1)=kN$  if $r$ is even. Either, one of the terms $(a^{r/2}\pm 1)$ is divisible by $N$, or each contains different factors of $N$. We want them to contain different factors so that we can computer $\text{gcd}(a^{r/2}\pm1,N)$ to find a factor. So, we specifically want that $a^{r/2}\pm 1\neq 0 \text{ mod }N$. One case has been eliminated as stated above by requiring $r$ to be as small as possible. The other we have to explicitly discount.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-17T18:02:01.293" LastActivityDate="2018-04-17T18:02:01.293" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1813" PostTypeId="2" ParentId="1808" CreationDate="2018-04-17T09:25:00.190" Score="2" Body="&lt;p&gt;The requirement that $a^r\equiv 1\mod N$ is equivalent  to requiring that $a^r - 1\equiv 0\mod N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want a number, $b$, such that the greatest common denominator of $b$ and $N$ is a proper factor of $N$ (i.e. is a factor $\neq 1, N$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also have that $a^r-1 = \left(a^{r/2}-1\right)\left(a^{r/2}+1\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we take $b = a^{r/2}-1$. We know that $r$ is the &lt;em&gt;smallest&lt;/em&gt; number such that $a^r = 1\mod N$, showing that $a^{r/2}\neq 1\mod N$ and so $\gcd\left(a^{r/2}-1, N\right)\neq N$ (as otherwise, $N$ would divide $b$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By &lt;a href=&quot;https://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bézout's identity&lt;/a&gt;, if $\gcd\left(a^{r/2}-1, N\right)=1, \exists\, x_1, x_2\in\mathbb Z \text{ s.t. } \left(a^{r/2}-1\right)x_1+Nx_2 = 1$, or $\left(a^r-1\right)x_1+N\left(a^{r/2}+1\right)x_2 = a^{r/2}+1$. As $N$ divides $a^r-1$, this gives that $N$ divides $a^{r/2}+1$, or $a^{r/2} = -1\mod N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives that the requirement $a^{r/2}\neq -1\mod N$ (alongside the constraint on $r$) is enough to determine that the greatest common denominator of $a^{r/2} - 1$ and $N$ is a proper factor of $N$.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-17T10:27:49.283" LastActivityDate="2018-04-17T10:27:49.283" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1814" PostTypeId="2" ParentId="1796" CreationDate="2018-04-17T09:25:54.283" Score="5" Body="&lt;p&gt;The answer is $N = 200\,099$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shor's algorithm is not the only way to factorize integers. In fact, it is also possible to factorize integers with an optimization approach. This approach even allows for integers with more than two prime-factors to be composed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this paper from D-Wave, &lt;a href=&quot;https://arxiv.org/pdf/1604.05796.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Prime factorization using quantum annealing and&#xA;computational algebraic geometry&lt;/a&gt;, in which the explain their approach and show the results of factoring multiple composite numbers, among which $N=200\,099$. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="1847" LastEditDate="2018-04-17T17:01:41.293" LastActivityDate="2018-04-17T17:01:41.293" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1815" PostTypeId="1" AcceptedAnswerId="1821" CreationDate="2018-04-17T09:27:11.620" Score="11" ViewCount="308" Body="&lt;p&gt;Let us assume that we have quantum and classical computers such that, experimentally, each elementary logical operation of mathematical factorization is equally time-costing in classical and in quantum factorization:&#xA;Which is the lowest integer value for which the quantum proceeding is faster than the classical one?&lt;/p&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="26" LastEditDate="2018-12-13T19:46:04.100" LastActivityDate="2018-12-13T19:46:04.100" Title="What is the minimum integer value to make quantum factorization to be worthwhile?" Tags="&lt;algorithm&gt;&lt;speedup&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1816" PostTypeId="2" ParentId="1807" CreationDate="2018-04-17T12:08:19.987" Score="7" Body="&lt;p&gt;A standard reference for linear optical quantum computing is Kok et al. 2009 (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0512071&quot; rel=&quot;nofollow noreferrer&quot;&gt;quant-ph/0512071&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one qubit is encoded in the polarization degree of freedom of a single photon, and the second qubit in the &lt;em&gt;path&lt;/em&gt; degree of freedom of &lt;em&gt;the same&lt;/em&gt; photon, then a CNOT gate is trivially implemented by a &lt;em&gt;polarizing beamsplitter&lt;/em&gt;.&#xA;This is a kind of beamsplitter that only changes the path of the photon if its polarization is in some polarization state (say, $|V\rangle$), and leaves the photon in its path otherwise.&#xA;This is therefore effectively a CNOT gate where the control qubit is the polarization and the target qubit is the path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you cannot use the same idea to implement a gate between more than two qubits.&#xA;Generally speaking, as long as you are working on degrees of freedom of a single photon (position, time/frequency, polarization, orbital angular momentum), it is still &quot;easily&quot; doable to implement transformations between them,&#xA;but this is a limited approach because it is not really scalable to cram too much information into a single photon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very different story is the use of polarization qubits of many different photons.&#xA;The main problem with this is that photons &lt;em&gt;do not&lt;/em&gt; naturally interact with each other, so that two-qubit gates between such qubits are nontrivial.&#xA;Indeed, it is easy to show that with linear optics alone it is &lt;em&gt;impossible&lt;/em&gt; to implement arbitrary two-qubit gates in a deterministic way.&#xA;For example, consider the case where one has two single photons, each one in a different spatial mode, and both in the initial polarization state $|H\rangle$.&#xA;Using the standard second quantization notation, the set of transformations that can be implemented between these two photons within linear optics are given by&#xA;$$a_H^\dagger b_H^\dagger \to\left(\sum_{k=H,V}\alpha_k c_k^\dagger +\beta_k d_k^\dagger\right)\left(\sum_{k=H,V}\gamma_k c_k^\dagger +\delta_k d_k^\dagger\right),$$&#xA;where $\alpha_k,\beta_k,\gamma_k,\delta_k$ are parameters characterising the linear transformation that is being implemented, $a_H^\dagger,b_H^\dagger$ are the creation operators of the input photons in the spatial modes $a$ and $b$ with polarization $H$, and $c$ and $d$ denote the two output modes of the photons.&#xA;It can be seen that, for example, no set of values of $\alpha_k,\beta_k,\gamma_k,\delta_k$ can implement the transformation &#xA;$$a_H^\dagger b_H^\dagger\to c_H^\dagger d_V^\dagger + c_V^\dagger d_H^\dagger,$$&#xA;meaning that it is not possible to generate deterministically, within linear optics, to transform $|00\rangle$ into the Bell state $|01\rangle+|10\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the above tells us is that linear optics quantum computing with single photons &lt;em&gt;requires&lt;/em&gt; some kind of nonlinearity.&#xA;One, therefore, needs to either use nonlinear elements such as Kerr media, or exploit the nonlinearity induced by the measurement process. Unfortunately, it is very hard to find materials implementing strong enough Kerr interactions (I don't think there is, to date, any viable known way to do this, but I may stand corrected).&#xA;On the other hand, linear optical quantum computation using measurements is possible via the &lt;a href=&quot;https://en.wikipedia.org/wiki/KLM_protocol&quot; rel=&quot;nofollow noreferrer&quot;&gt;Knill, Laflamme, and Milburn (KLM) protocol&lt;/a&gt;.&#xA;This protocol exploits photon bunching, gate teleportation, and projective measurements to obtain effective interactions between different polarization qubits.&#xA;I will not go into the details of how this works here, as this may be worth a question of its own, but the circuit to implement a CZ gate using the KLM protocol can be found in Fig. 10 of Kok et al. 2009.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-04-17T14:48:39.297" LastActivityDate="2018-04-17T14:48:39.297" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1817" PostTypeId="1" AcceptedAnswerId="1820" CreationDate="2018-04-17T13:42:56.093" Score="9" ViewCount="993" Body="&lt;p&gt;When it comes to error correction, we take our stabilizers to be members of the Pauli group. Why is the Pauli group used for this and not, say, the group of all unitary matrices?&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="26" LastEditDate="2018-05-07T13:19:09.810" LastActivityDate="2018-05-07T13:19:09.810" Title="Why is the Pauli group used for stabilizers?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1818" PostTypeId="2" ParentId="1803" CreationDate="2018-04-17T14:32:03.010" Score="8" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;tl;dr&lt;/em&gt;-&lt;/strong&gt; Moore's law won't necessarily apply to the quantum computing industry.  A deciding factor may be if the manufacturing processes can be iteratively improved to exponentially increase something analogous to transistor count or roughly proportional to performance.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Background:  Moore's law and why it worked&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;It's important to note that Moore's law was about the numbers of transistors in high-density integrated circuits, &lt;em&gt;not&lt;/em&gt; the performance or speed of electronics despite common approximate restatements of Moore's law.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Moore's law&lt;/strong&gt; is the observation that the number of &lt;a href=&quot;https://en.wikipedia.org/wiki/Transistor&quot; rel=&quot;noreferrer&quot;&gt;transistors&lt;/a&gt; in a dense &lt;a href=&quot;https://en.wikipedia.org/wiki/Integrated_circuit&quot; rel=&quot;noreferrer&quot;&gt;integrated circuit&lt;/a&gt; doubles about every two years.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&amp;ndash;&lt;a href=&quot;https://en.wikipedia.org/wiki/Moore%27s_law&quot; rel=&quot;noreferrer&quot;&gt;&quot;Moore's law&quot;&lt;/a&gt;, Wikipedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Underlying Moore's law was the simple fact that, for a given integrated circuit size, the number of transistors we could cram into it was roughly proportional to the volume of an individual transistor,$$&#xA;n_{\text{transistors}}~{\approx}~\frac{V_{\text{integrated circuit}}}{V_{\text{transistor}}}.&#xA;$$So, Moore's law was sorta like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The volume of a transistor halved about every two years.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then the question becomes, why were transistors able to shrink so rapidly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was largely because transistors are basically made of microscopically fabricated wires in an integrated circuit, and as manufacturing technology progressed, we were able to make smaller-and-smaller wires:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;ensp;&amp;ensp;&amp;ensp;&amp;ensp;&amp;ensp;&lt;a href=&quot;https://en.wikipedia.org/wiki/File:Comparison_semiconductor_process_nodes.svg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/c/c7/Comparison_semiconductor_process_nodes.svg&quot; width=&quot;550&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process of making crazy-small wires in an integrated circuit took a lot of research know-how, so folks in industry basically set out to iteratively improve their fabrication processes at such a rate to maintain Moore's law.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Moore's law is now basically over.  Our fabrication processes are nearing the atomic scale such that the physics of the situation are changing, so we can't just keep shrinking further.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Can Moore's law work for quantum components?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;As noted above, Moore's law is basically ending now.  Computers will likely pick up speed due to other advances, but we aren't really planning to make sub-atomic transistors at this time.  So despite industry's strong desire to maintain it, it seems unlikely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume similar behavior in a future quantum-computing industry, then we might assume that something like Moore's law might arise if industry finds itself in a similar position, where it can iteratively improve the components' manufacturing process to exponentially increase their count (or some similar metric).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this time, it's unclear what basic industrial metric quantum computer manufacturers might iteratively improve over the course of decades to recreate a trend like Moore's law, largely because it's unclear what sort of quantum computing architectural technologies might find widespread deployment like modern integrated circuits have.&lt;/p&gt;&#xA;" OwnerUserId="15" LastActivityDate="2018-04-17T14:32:03.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1819" PostTypeId="2" ParentId="1817" CreationDate="2018-04-17T15:58:35.250" Score="4" Body="&lt;p&gt;Any operator from the Pauli group has two eigenspaces of equal size. So we known that by adding stabilizer generator from this group, we reduce the size of the stabilizer space by half. This means that the stabilizer space would fit one less logical qubit. This makes it easy to know when we have enough stabilizers: to store $k$ logical qubits in $n$ physical qubits, we just need $n-k$ independent stabilizer generators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the Pauli group is made up of Hermitian operators. Since the point of a stabilizer is to be measured, it is useful for them to be Hermitian, since they can be directly interpreted as observables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the the operators that map between stabilizer states (mutual eigenstates of stabilizer operators) will themselves be elements of the Pauli group. This is related to the point raised in your comment: Pauli group elements form a complete basis to describe multi-qubit operation. So once we measure the stabilizers, and the noise is effectively reduced to a mapping between stabilizer states, it is pretty much as if the noise just applied a bunch of simple Paulis. Correction can be then done by a simple Pauli frame rotation. This doesn't even require us to directly apply any gate to the code. We can just say &quot;It looks like a $\sigma_x$ hit this qubit, so from now on I'll interpret its $|0\rangle$ as $|1\rangle$, and vice-versa&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Paulis aren't required, but they have nice properties. So that's why they are the focus&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-17T18:12:14.527" LastActivityDate="2018-04-17T18:12:14.527" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1820" PostTypeId="2" ParentId="1817" CreationDate="2018-04-17T16:13:33.520" Score="8" Body="&lt;p&gt;There are some fairly simple reasons &amp;mdash; beyond the merely historical &amp;mdash; to use Pauli matrices instead of arbitrary unitary matrices. These reasons may not uniquely single out the Pauli group of operators, but they do significantly limit the scope of what is productive to consider.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A stabiliser operator $S$, first and foremost, must have a +1 eigenvalue; otherwise there isn't any state $\lvert \psi \rangle$ which it 'stabilises', in the sense that $S \lvert \psi \rangle = \lvert \psi \rangle$. So we must restrict ourselves to sets of operators which have +1 eigenvalues.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Secondly, we must consider how the stabiliser operators may be used operationally. If we know that there is a symmetry of the system that should hold, but we don't have any way to determine whether or not that symmetry holds in practise (that is, whether some error has occurred), then we're out of luck. What we would like to be able to do then is to be able to perform phase estimation to test whether or not the eigenvalue of a given state $\lvert \psi \rangle$ with respect to some allegedly-stabilising operator $S$ is in fact +1, to determine whether $\lvert \psi \rangle$ deviates from the properties that hold of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This motivates considering operators $S$ which, yes, are unitary, but&#xA;also where the eigenvalues differ significantly from one another, in&#xA;order for phase estimation to easily distinguish a state with significant error from one with insignificant error. This motivates considering a set of $n$-qubit operators which have at most $1/\mathrm{poly}(n)$ eigenvalues.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Part of the whole problem is that we would like to detect and correct for operations which may be involved in complicated quantum transformations. If the phase estimation involved in eigenvalue estimation of a stabilising operator $S$ is itself complicated, we're not helping the situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be good is for each of the stabilising operators $S$ we consider to have very simple structure: for instance, we may be especially interested in the case that they are tensor products of 1- or 2-qubit operations. It seems sensible to approach the subject by considering each operator $S$ to be a tensor product of single qubit operations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In order to consider tensor product operations on $k \leqslant n$ qubits, which have at most $1/\mathrm{poly}(k)$ distinct eigenvalues, including +1 &amp;mdash; and without imposing awkward constraints on which single-qubit operators act on which qubits &amp;mdash; we are more or less forces to consider single-qubit unitary operators whose eigenvalues range within some finite set $E \subseteq \mathbb C$ (independent of $k$ or $n$) which includes +1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We may reduce this to the case $E = \{+1,-1\}$ by observing that estimating the eigenvalues of a tensor product operator $S = S_1 \otimes S_2 \otimes \cdots \otimes S_k$, where each $S_j$ has one +1 eigenvalue and one eigenvalue which is not +1, is the same as doing an artificially shortened version of eigenvalue estimation for an operator $P_j$ which has eigenvalues $\pm 1$. Furthermore, in order to consider several operators $S$ which manage to have a useful common +1 eigenspace, it helps for each operator S to have as large a +1 eigenspace as possible; then it helps for it to be as easy as possible for the eigenvalues of each $S_j$ to multiply to +1. This again motivates the case for the eigenvalues of $S_j$ to be $\pm 1$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Nothing forces us to consider the &lt;em&gt;group&lt;/em&gt; of operators generated by such a set, but the products of our stabiliser operators will also be stabiliser operators, and we have enough constraints on our operators that we can at least reasonably contemplate the group generated by our stabiliser operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have operators $S = S_1 \otimes \cdots \otimes S_n$ and $S' =&#xA;    S'_1 \otimes \cdots \otimes S'_n$ whose tensor factors are all&#xA;either $\mathbb 1$ or non-trivial reflections on single-qubit&#xA;states; their products $S_j S'_j$ will be rotations by an angle&#xA;$\theta$ determined by the angles between the eigenbases of $S_j$&#xA;and $S'_j$. If we want to obtain a nice clean theory, we might want&#xA;these products of stabiliser operators to themselves be easy to&#xA;measure: this motivates having $S_j S'_j$ to be proportional to an operator with eigenvalues $\pm 1$ (actually $S_j S'_j$ will have eigenvalues $\pm i$), in which case $S_j$ and $S'_j$ anticommute.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thus, the above combination of theoretical and practical constraints suffice to yield something which is isomorphic to the Pauli group. Furthermore, as the Pauli operators have a theory which is fairly easily understood, it has led to a fruitful theory of quantum error correction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fair question would be which of the above moves were more arbitrary than the others.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It would not astonish me if there was a productive theory of error correction in which the constraints were tensor product operators, whose tensor factors had eigenvalues $\pm 1$, but where the possible operators &lt;em&gt;did not necessarily&lt;/em&gt; anticommute (step&amp;nbsp;5 above).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More sophisticated (and more difficult) would be a powerful and&#xA;useful theory of error correction in which the stabilising operators&#xA;which one measures included operators which are not tensor product&#xA;operators (step&amp;nbsp;3 &amp;mdash; which would motivate not worrying too&#xA;much about having group structure in the group of stabilisers which&#xA;you intend to measure).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From a purely mathematical perspective, there is nothing obvious to &lt;em&gt;prevent&lt;/em&gt; or &lt;em&gt;discourage&lt;/em&gt; such a line of investigation &amp;mdash; aside, of course from the fact that it is likely to be hard and also likely to be unnecessary &amp;mdash; and in this sense, it would be perfectly fine to consider theories of quantum error correction extending well beyond the Pauli group.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-17T16:13:33.520" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1821" PostTypeId="2" ParentId="1815" CreationDate="2018-04-17T18:38:42.757" Score="8" Body="&lt;p&gt;The quantum part of Shor's algorithm is, essentially, a single modular exponentiation done under superposition followed by a Fourier transform and then a measurement. The modular exponentiation is by far the most expensive part.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Let us assume that [...] each elementary logical operation of mathematical factorization is equally time-costing in classical and in quantum factorization&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If we assume that the modular exponentiation takes exactly as long on a quantum computer as it would on a classical computer, then the transition where the quantum computation became better would happen at a very low number. Computing modular exponentiations is very fast, classically, because you can use repeated squaring. I would wildly estimate the crossover to happen even before you even get to 30 bit numbers (numbers over a billion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But quantum computers are not going to do math nearly as fast as classical computers&lt;/strong&gt;. For example, on my laptop, I can do a 1000-bit modular exponentiation in python in a fraction of a second. But on foreseeable quantum computers, it would take hours or days. The issue is the massive (&lt;em&gt;massive&lt;/em&gt;) difference in the cost of an AND gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a classical machine, performing an AND is so inconsequential that we don't even really think about it when programming. It's way more likely for you to think in terms of counting 64-bit additions than in terms of counting AND gates, when determining the cost of your algorithm. But on an error corrected quantum computer, performing an AND (usually temporarily, via a Toffoli) tends to be expensive. For example, you can do it by distilling four high-quality $|T\rangle$ states. I won't go into the numbers... suffice it to say that on early error corrected machines you would be very happy to get a million T states per second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So suppose we get a million T states per second, and we want to convert this into a rate of 64-bit additions to compare with the classical machine. A 64-bit addition requires 64 AND gates, each requiring 4 T gates. 1 million divided by 4 divided by 64 gives... about 4KHz. For contrast a classical machine will easily do a billion additions per second. &lt;em&gt;Quantum adders are a million times slower than classical adders&lt;/em&gt; (again, wildly estimating, and keep in mind this number should improve over time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another factor worth considering is the differing costs of quantum and classical computers. If you have a hundred million dollars, and you're choosing between one quantum computer and a thousand classical computers, that factor of 1000 has to be accounted for. In this sense, we could say quantum adders are a &lt;em&gt;billion&lt;/em&gt; times less efficient than classical adders (in FLOPS/$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A constant factor penalty of &lt;em&gt;a billion&lt;/em&gt; is normally an immediate deal breaker. And for quantum algorithms with a mere quadratic advantage (like Grover), I contend that it is in fact a deal breaker. But Shor's algorithm gets exponentially better relative to the classical strategy as you increase the number of bits in the number to factor. How many bits before we eat away that &quot;measly&quot; 10^9 constant with our exponential growth in advantage?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider that &lt;a href=&quot;https://en.wikipedia.org/wiki/RSA-200#RSA-640&quot; rel=&quot;noreferrer&quot;&gt;RSA-640 was factored&lt;/a&gt; in 2005 using ~33 CPU years. A quantum computer should be able to do that number in under a day. If you have a thousand classical computers working on the problem, they'd finish in about two weeks. So it seems like quantum is winning by 640 bits, but only by an order of magnitude or three. So maybe the cutoff would occur somewhere around 500 bits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, I know this is not a hard and fast answer. But hopefully I've conveyed some sense of the quantities I would think about when comparing classical and quantum. Really no one knows the constant factors involved yet, so I'd be surprised if anyone could give you a proper estimate better than &quot;somewhere in the hundreds of bits&quot;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-04-17T20:49:16.637" LastActivityDate="2018-04-17T20:49:16.637" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1822" PostTypeId="1" AcceptedAnswerId="1828" CreationDate="2018-04-17T18:44:52.797" Score="12" ViewCount="1624" Body="&lt;p&gt;I keep reading (e.g. Nielsen and Chuang, 2010; pg. 456 and 465) the following three phases; &quot;code space&quot;, &quot;code word&quot; and &quot;stabilizer code&quot; - but am having a difficult time finding definitions of them and more importantly how they differ from one another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is therefore; how are these three terms defined and how are they related?&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="26" LastEditDate="2019-01-07T15:30:36.453" LastActivityDate="2019-01-07T15:30:36.453" Title="What is the difference between &quot;code space&quot;, &quot;code word&quot; and &quot;stabilizer code&quot;?" Tags="&lt;error-correction&gt;&lt;terminology&gt;&lt;stabilizer-code&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1823" PostTypeId="2" ParentId="1822" CreationDate="2018-04-17T19:07:54.510" Score="5" Body="&lt;p&gt;A code word (for a quantum code) is a quantum state that is typically associated with a state in the logical basis. So, you’ll have some state $|\psi_0\rangle$ that corresponds to the 0 state of the qubit to be encoded (you don’t have to use qubits, but you probably are), and you’ll have another that’s $|\psi_1\rangle$ that corresponds to the 1 state of the qubit to be encoded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code space is the space spanned by the code words, i.e. the entire space $\alpha|\psi_0\rangle+\beta|\psi_1\rangle$ for all possible $\alpha$ and $\beta$ (normalised).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stabilizer code is one possible formalism for telling you how to work out the code words and therefore the code space. For an [[n,k,d]] code, you are given n-k stabilizer operators $S$ ($S^2=\mathbb{I}$) that mutually commute, and act on n qubits. Any state $|\psi\rangle$ in the code space satisfies $S|\psi\rangle=|\psi\rangle$. You will further have operators $Z_m$ and $X_m$ for $m=1,\ldots k$ that all commute with the stabilizers $S$ but pairwise anticommute, $\{Z_m,X_m\}=0$, for matching subscripts. These define the Logical Pauli operators for the code, and the code words are therefore the states that satisfy $Z_m|\psi\rangle=\pm|\psi\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-17T19:15:22.333" LastActivityDate="2018-04-17T19:15:22.333" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1824" PostTypeId="2" ParentId="1822" CreationDate="2018-04-17T19:10:44.123" Score="5" Body="&lt;p&gt;In a quantum error correcting code, you store a number of &lt;em&gt;logical&lt;/em&gt; qubits, $k$, in a state of many physical qubits, $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A code word is a state of the physical qubits that is associated with a specific logical state. So, for example, however you store the $|0\rangle$ state for one of your logical qubits is a code word.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code space is the Hilbert space spanned by all possible code words. For a stabilizer code, this term is synonymous with the stabilizer space. Any state within this code space is a code word&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stabilizer code is a quantum error correcting code described by the stabilizer formalism. The stabilizer space is defined as the mutual $+1$ eigenspace of $n-k$ mutually commuting and independent tensor products of Pauli operators.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-18T05:36:11.957" LastActivityDate="2018-04-18T05:36:11.957" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1825" PostTypeId="1" AcceptedAnswerId="1831" CreationDate="2018-04-17T19:39:44.590" Score="4" ViewCount="387" Body="&lt;p&gt;I'm currently busy learning about the basics of quantum information theory. Does anyone know how the measurement described in the wiki link &lt;a href=&quot;https://en.wikipedia.org/wiki/LOCC&quot; rel=&quot;nofollow noreferrer&quot;&gt;LOCC&lt;/a&gt; is a measurement on the product space $\mathbb{C}^2 \otimes \mathbb{C}^n$ as stated? &lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2020-07-27T12:28:51.890" LastActivityDate="2020-07-27T12:28:51.890" Title="Local operations and classical communication (LOCC) on quantum system" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;locc-operation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1826" PostTypeId="1" AcceptedAnswerId="4060" CreationDate="2018-04-16T11:17:08.780" Score="12" ViewCount="544" Body="&lt;p&gt;In Cabello's paper &lt;em&gt;Quantum key distribution without alternative measurements&lt;/em&gt;, the author said &quot;the number of useful random bits shared by Alice and Bob by transmitted qubit, before checking for eavesdropping, is 0.5 bits by transmitted qubit, both in BB84 and B92 (and 0.25 in E91)&quot; (see &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9911025.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, page 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In E91 protocol, Alice and Bob each chooses independently and randomly from three measurement bases, so there are 9 situations and only 2 of them can yeild correct bits. Does that mean the efficiency of E91 is $\frac 2 9$ ? Why does the useful random bits is 0.25 bits by transmitted qubits in E91? &lt;/p&gt;&#xA;" OwnerUserId="2047" OwnerDisplayName="Shireen" LastEditorUserId="26" LastEditDate="2019-05-08T10:21:10.170" LastActivityDate="2019-05-08T10:21:10.170" Title="Why is the efficiency of Ekert 91 Protocol 25%?" Tags="&lt;key-distribution&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1827" PostTypeId="2" ParentId="1792" CreationDate="2018-04-17T20:40:41.790" Score="3" Body="&lt;p&gt;Superpositions in Fock space--and rotations in Fock space--are absolutely ubiquitous. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It is important to note that &lt;em&gt;all&lt;/em&gt; classical states of the electromagnetic field are superpositions of many different photon-number eigenstates.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The entire discipline of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_field_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum field theory&lt;/a&gt; (approximately) concerns which rotations within certain physically-motivated Fock spaces are allowed, and with what amplitudes they actually occur.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The experimental paradigms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Circuit_quantum_electrodynamics&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Cavity_quantum_electrodynamics&quot; rel=&quot;nofollow noreferrer&quot;&gt;cavity QED&lt;/a&gt;--which validate exquisitely the predictions of that now 70-year-old theory--explicitly deals with operations on photon number states (in particular &quot;the presence or absence of a single photon&quot; as DaftWullie put it), and are cornerstones of atomic, molecular and optical physics. Circuit QED is the essential theory underpinning superconducting flux qubits, which devices have been shown to display coherent quantum effects beyond any reasonable or unreasonable doubt. &lt;a href=&quot;https://en.wikipedia.org/wiki/Serge_Haroche&quot; rel=&quot;nofollow noreferrer&quot;&gt;Serge Haroche&lt;/a&gt; was awarded the 2012 Nobel Prize in physics for his work on cavity QED, in which he went on happily creating, controlling and measuring superpositions of small numbers of microwave photons. Lots of experimentalists do this every day.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It has long been suggested that a single harmonic mode be used to represent one or more qubits in a practical quantum computer, in which logical states are encoded as superpositions of states of different occupation number. For a few ideas on how to do this as well a few reasons why it might not be the best idea, see Nielsen and Chuang, section 7.2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There's no shortage of literature on ways to perform these kinds of operations. In fact, a nontrivial fraction of modern physics is concerned with exactly that. I can't imagine where or how you would get the opposite idea.&lt;/p&gt;&#xA;" OwnerUserId="2034" LastEditorUserId="2034" LastEditDate="2018-04-17T20:46:08.857" LastActivityDate="2018-04-17T20:46:08.857" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1828" PostTypeId="2" ParentId="1822" CreationDate="2018-04-17T23:12:29.187" Score="10" Body="&lt;p&gt;&lt;strong&gt;Code spaces and code-words&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum error correcting code is often identified with the code-space (Nielsen &amp;amp; Chuang certainly seem to do so). The &lt;em&gt;code space&lt;/em&gt; $\mathcal C$ of e.g.&amp;nbsp;an $n$-qubit quantum error correction code is a vector subspace $\mathcal C \subseteq \mathcal H_2^{\otimes n}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;code word&lt;/em&gt; (terminology which was borrowed from the classical theory of error correction) is a state $\lvert \psi \rangle \in \mathcal C$ for some code-space: that is, it is a state which encodes some data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum error correction codes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, we demand some non-trivial properties to hold of a quantum error correction code, such as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;That $\mathop{\mathrm{dim}} \mathcal C \geqslant 2$, so that there is a non-zero amount of information being encoded;&lt;/li&gt;&#xA;&lt;li&gt;That there are a set $\mathcal E = \{ E_1, E_2, \ldots \}$ of at least two operators including the operator $E_1 = \mathbb 1$, such&#xA;that &amp;mdash; if $P$ is the orthogonal projector onto $\mathcal C$ &amp;mdash; we have $$P E_j E_k P = \alpha_{j,k} P$$&#xA;for some scalars $\alpha_{j,k}$ (known as the &lt;em&gt;Knill&amp;ndash;Laflamme conditions&lt;/em&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This determines some set of error operators against which you can in principle protect a state $\lvert \psi \rangle \in \mathcal C$, in that if the Knill&amp;ndash;Laflamme conditions hold of a set of operators $\mathcal E$, and some operator $E \in \mathcal E$ acts on your state, it is possible in principle to detect the fact that $E$ has occurred (as opposed to some other operator in $\mathcal E$) and undo the error, without disrupting the data stored in the original state $\lvert \psi \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;quantum error correction code&lt;/em&gt; is a code-space $\mathcal C$, &lt;em&gt;together with&lt;/em&gt; a set of error operators $\mathcal E$ which satisfy the Knill&amp;ndash;Laflamme conditions &amp;mdash; that is, a quantum error correcting code must specify which errors it is meant to protect against.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why it is common to identify quantum error correcting codes with their code-spaces&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot determine a unique set $\mathcal E$ of operators which satisfy the Knill&amp;ndash;Laflamme conditions from the code-space $\mathcal C$ alone. However, it is most common to consider which &lt;em&gt;low-weight&lt;/em&gt; operators (ones which act only on a small number of qubits) can be simultaneosuly corrected by a code, and to an extent this &lt;em&gt;can&lt;/em&gt; be derived from the code-space alone. The &lt;em&gt;code distance&lt;/em&gt; of a code space $\mathcal C$ is the smallest number of qubits that you have to act on, to transform one &quot;code-word&quot; $\lvert \psi \rangle \in \mathcal C$ into a distinct codeword $\lvert \psi' \rangle \in \mathcal C$. If we then describe a code-space as being a $[\![n,k,d]\!]$ code, this then says that $\mathcal C \subseteq \mathcal H_2^{\otimes n}$ has dimension $2^k$, and that the set $\mathcal E$ that we consider is the set of all Pauli operators with weight at most  $\lfloor (d{-}1)/2 \rfloor$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases, describing a code as an $[\![n,k,d]\!]$ code is enough. For instance, the 5-qubit code is a $[\![5,1,3]\!]$ code, and it is possible to show that five qubits cannot encode a single qubit in such a way that &lt;em&gt;any other errors&lt;/em&gt; can be corrected in addition to all of the single-qubit errors.&#xA;However, the same is not true of the Steane $[\![7,1,3]\!]$ code, which can protect against any single-qubit Pauli error as well as &lt;em&gt;some&lt;/em&gt; (but not all) two-qubit Pauli errors. Which two-qubit Pauli errors you &lt;em&gt;should&lt;/em&gt; protect against depends on what your error model is; and if your noise is symmetric and independently distributed, it won't matter very much what you choose (so that you will likely make the conventional choice of any single $X$ error together with any single $Z$ error). It is however a &lt;em&gt;choice&lt;/em&gt;, and one which will guide how you protect your data against noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Stabiliser codes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stabiliser code is a quantum error correction code determined by a set $\mathscr  S$ of &lt;em&gt;stabiliser generators&lt;/em&gt;, which are Pauli operators which commute with one another, and which define a code-space $\mathcal C$ by the intersection of their +1-eigenspaces. (It is often useful to consider the &lt;em&gt;stabiliser group&lt;/em&gt; $\mathcal G$ formed by products of $P \in \mathscr S$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Almost all quantum error correction codes that people consider in practise are stabiliser codes. This is one reason why you may have problems distinguishing the two terms. However, we do not require that a quantum error correction code  be a stabiliser code &amp;mdash; just as in principle we do not require a classical error correction code to be a linear code. Stabiliser codes just happen to be an extremely successful way of describing quantum error correcting codes, just as linear error correcting codes are an extremely successful way of describing classical error correcting codes. And indeed, stabiliser codes can be regarded as a natural &lt;em&gt;generalisation&lt;/em&gt; of the theory of classical linear codes to quantum error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As people are often interested just in low-weight operators which are less than half the code distance, the set of stabilisers is often all people say about an stabiliser correction code. However, to specify the set of errors $\mathcal E$ against which the code can protect, it is necessary also to specify a relationship $\sigma$ between Pauli product operators $E$ and  subsets $S \subseteq \mathscr S$, such that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$E$ anticommutes with $P \in \mathscr S$ if and only if $P \in S$ for $\sigma(E,S)$;&lt;/li&gt;&#xA;&lt;li&gt;If $E, E'$ both satisfy $\sigma(E,S)$ and $\sigma(E',S)$, then $E E' \in \mathcal G = \langle \mathscr S \rangle$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This defines a set $$\mathcal E = \bigl\{ E  \mathbin{\big\vert}&#xA;   \exists S \subseteq \mathscr S: \sigma(E,S) \bigr\}$$ of errors&#xA;   against which the code can protect.&#xA;The subsets $S \subseteq \mathscr S$ are called &lt;em&gt;error syndromes&lt;/em&gt;, and the relation which I've called $\sigma$ here (which you don't usually see given an explicit name) associates syndromes to one or more errors which 'cause' that syndrome, and whose effects on the code are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Syndromes' represent information that can actually be obtained about an error by 'coherent measurement' &amp;mdash; that is, by measuring operators $P \in \mathscr S$ as observables (a process which is usually simulated by eigenvalue estimation). An error $E$ 'causes' a syndrome $S \subseteq \mathscr S$ if, for any code-word $\lvert \psi \rangle \in \mathcal C$, the state $E \lvert \psi \rangle$ is in the $-1$ eigenspace of all operators $P \in S$, and in the $+1$-eigenspace of all other operators in $\mathscr S$. (This property is directly related to the anticommutation of $E$ with all of the elements of $S \subseteq \mathscr S$, and only those elements.)  &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-06-02T06:21:11.300" LastActivityDate="2018-06-02T06:21:11.300" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1829" PostTypeId="2" ParentId="1716" CreationDate="2018-04-18T00:37:59.780" Score="4" Body="&lt;p&gt;It may or may not be &lt;em&gt;exactly&lt;/em&gt; what you're looking for, but there is research done on &lt;a href=&quot;https://arxiv.org/abs/1602.06004&quot; rel=&quot;nofollow noreferrer&quot;&gt;coherent charge oscillations in a silicon field-effect transistor&lt;/a&gt; (paper by Gonzalez-Zalba et. al. at Hitatchi labs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above paper, they coherently control a double quantum dot in a silicon-on-insulator nanowire CMOS transistor, with a $T_2$ coherence time of $\approx 100$ ps. While this is a small coherence time, as already existing CMOS technology was used, putting this (or something similar) on a classical chip would be relatively easy. Although it's probably not going to perform any advanced quantum computations in the near future, it arguably demonstrates some potential for a limited classical/quantum hybrid chip. Regardless, this is a clear example of a field-effect transistor having the potential to be used for quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same labs also created a &lt;a href=&quot;https://arxiv.org/abs/1008.2844&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spin Hall effect transistor&lt;/a&gt;, where they use spin-orbit coupling to manipulate spin to implement an AND gate. While spin-orbit coupling is a quantum mechanical process (that doesn't particularly involve quantum information or computing), manipulating spin is something that's required in various different types of quantum computer and so, I wouldn't be all that surprised if talking about such processes in terms of quantum computing/information were possible to some extent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overall&lt;/strong&gt;, while you may or may not count the above as definitive evidence of what you want, they are at least small steps in that direction&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-04-18T00:37:59.780" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1830" PostTypeId="2" ParentId="105" CreationDate="2018-04-18T06:32:25.713" Score="3" Body="&lt;p&gt;To understand this question (and its possible answers) properly, we need to discuss a couple of concepts related to &lt;strong&gt;temperature&lt;/strong&gt; and its relation to quantum states. Since I think the question makes more sense in the &lt;strong&gt;solid state&lt;/strong&gt;, this answer will assume that's what we're talking about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For starters, I find it useful to think about &lt;a href=&quot;https://en.wikipedia.org/wiki/Boltzmann_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boltzmann's distribution&lt;/a&gt;: a probability distribution that gives the probability $p_i$ that a system will be in a certain state $i$ as a function of that state’s energy ${\varepsilon}_i$ and the temperature $T$ of the system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p_i={\frac{e^{- {\varepsilon}_i / k T}}{\sum_{j=1}^{M}{e^{- {\varepsilon}_j / k T}}}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $k$ is Boltzmann's constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a system that is in &lt;strong&gt;equilibrium&lt;/strong&gt;, as defined by statistical mechanics, the population of the different quantum states is governed by this equation (the system will be in a &lt;em&gt;thermal&lt;/em&gt; state). If we think of a single quantum system rather than a collection or &quot;&lt;em&gt;ensemble&lt;/em&gt;&quot;, this distribution of populations would correspond to a series of weights in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;mixed state&lt;/a&gt;.&#xA;In any case, &lt;strong&gt;these are not the conditions one needs for quantum computing&lt;/strong&gt;, where at any given time we want to have a good control the wavefunction. However, note that these probabilities have an exponential dependence on ${\varepsilon}_i$. This will be important further down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, we need to consider &lt;a href=&quot;https://en.wikipedia.org/wiki/Phonon&quot; rel=&quot;nofollow noreferrer&quot;&gt;phonons&lt;/a&gt;, the collective excitations in periodic, elastic arrangements of atoms or molecules in condensed matter. These are often the carriers of energy to and from our qubits into the part of the solid where we do not have an exquisite quantum control and thich therefore is thermalized: the so-called &lt;em&gt;thermal bath&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why must quantum computers operate under such extreme temperature conditions?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We can never fully control the quantum state of a solid chunk of matter. At the same time, &lt;strong&gt;we do need full control over the quantum state of our quantum computer&lt;/strong&gt;, meaning &lt;em&gt;the subset of quantum states where our information resides&lt;/em&gt;. These will live in pure states (including quantum superpositions), surrounded by a disordered -thermalized- environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think about the Boltzmann distribution described above, and about the exponential term. In practice, its equation means that we can assume  $p_i=0$ when the relation between temperature and the energy of the states we're interested in (which often means the states corresponding to our qubits) is such that ${\varepsilon}_i&amp;lt;&amp;lt;kT$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kinetics are often hard to model, but you know that &lt;strong&gt;inevitably your system will tend to thermalize&lt;/strong&gt;. So, you need to keep your quantum computer, for as long as possible, in a state such that the only excitations that occur are those corresponding to the quantum states and quantum operations that are part of your computation. If the temperature of the solid where the quantum system is residing is low, you only need to worry about your qubits uncontrollably relaxing to a lower-energy state (which is bad enough). If the temperature is high, you also need to worry about your qubits being uncontrollably excited to higher-energy states. Inevitably, this also includes states that are outside your computational basis, meaning states that, for your qubit state, are neither $|0&amp;gt;$ nor $|1&amp;gt;$, nor any complex combination thereof: harder-to-correct errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you now think about the phonons, recall that they are excitations, which cost energy, and thus are more abundant at high temperature. With rising temperatures, there is a rising number of available phonons, and they will present rising energies, sometimes allowing for interaction with different kinds of excitations (accelerating the kinetics toward thermalization): eventually, those that are detrimental to our quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the need for extremely low temperatures the same for all quantum computers, or does it vary by architecture?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It does vary, and dramatically so. Within the solid state, it depends on the energies of the states that constitute our qubits. Outside the solid state, as pointed out above and in a follow-up question (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/117/why-do-optical-quantum-computers-not-have-to-be-kept-near-absolute-zero-while-su&quot;&gt;Why do optical quantum computers not have to be kept near absolute zero while superconducting quantum computers do?&lt;/a&gt;), it's a whole another story.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What happens if they overheat?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See above. In a nutshell: you lose your quantum information faster.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-18T06:32:25.713" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1831" PostTypeId="2" ParentId="1825" CreationDate="2018-04-18T07:29:23.660" Score="4" Body="&lt;p&gt;I assume the question refers to how LOCC is used to distinguish the two states&#xA;$$&#xA;(|00\rangle+|11\rangle)/\sqrt{2}\qquad(|01\rangle+|10\rangle)/\sqrt{2}&#xA;$$&#xA;when Alice and Bob each hold one qubit, and are separated by a great distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many different measurement operators that could achieve the same task. If Alice just held both qubits herself, she could simply implement a measurement in the Bell basis, described by measurement operators&#xA;$$&#xA;M_0=\frac12(|00\rangle+|11\rangle)(\langle00|+\langle11|)\qquad M_1=\frac12(|00\rangle-|11\rangle)(\langle00|-\langle11|)\qquad M_2=\frac12(|01\rangle+|10\rangle)(\langle01|+\langle10|)\qquad M_3=\frac12(|01\rangle-|10\rangle)(\langle01|-\langle10|)&#xA;$$&#xA;However, these measurements don't have a tensor product structure, and so cannot be implemented by LOCC. The results $M_0$ and $M_2$ distinguish the two states given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative, Alice and Bob do as described at the original link; both make $Z$ basis measurements. So, their measurement operators are described by&#xA;$$&#xA;M_0'=|0\rangle\langle0|\otimes |0\rangle\langle0|\qquad &#xA;M_1'=|0\rangle\langle0|\otimes |1\rangle\langle1|\qquad &#xA;M_2'=|1\rangle\langle1|\otimes |0\rangle\langle0|\qquad &#xA;M_3'=|1\rangle\langle1|\otimes |1\rangle\langle1|&#xA;$$&#xA;If they get either answers $M_0'$ or $M_3'$, they had the first state, while if they get $M_1'$ or $M_2'$ they had the second state. Note that while Alice and Bob each act locally, on their qubit (as you can tell from the tensor product structure), they only know which overall result they got by comparing their measurement results, which requires classical communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a brief comment about the dimension of the Hilbert space. I have specifically talked about two qubits, $\mathbb{C}^2\otimes\mathbb{C}^2$. The first set of measurement operators, $\{M_k\}$, cannot be described under this tensor product structure; they are operators on $\mathbb{C}^4$, while the $\{M_k'\}$ operators can be described under $\mathbb{C}^2\otimes\mathbb{C}^2$. As for why the original source was talking about $\mathbb{C}^2\otimes\mathbb{C}^n$, for that specific example it seemed to be an unnecessary complication. Yes, you can always restrict to a qubit inside a larger Hilbert space, but there's no reason not to just take $n=2$ as far as I can see.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-18T07:29:23.660" CommentCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1832" PostTypeId="1" AcceptedAnswerId="1834" CreationDate="2018-04-18T11:22:54.807" Score="10" ViewCount="742" Body="&lt;p&gt;The complexity class &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;BQP&lt;/a&gt; (bounded-error quantum polynomial time) seems to be defined only considering the time factor. Is this always meaningful? Do algorithms exist where computational time scales polynomially with the input size but other resources such as memory scale exponentially?&lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="23" LastEditDate="2018-04-18T11:56:34.303" LastActivityDate="2018-04-18T11:58:13.493" Title="Is BQP only about time? Is this meaningful?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;bqp&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1833" PostTypeId="2" ParentId="1832" CreationDate="2018-04-18T11:35:07.250" Score="5" Body="&lt;p&gt;Not for memory, at least, as every memory access requires $O(1)$ 'time'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the term time complexity, 'time' is a bit misleading, as we &lt;em&gt;actually&lt;/em&gt; count the number of elementary operations required to perform an algorithm. Under the additional assumption that these operations can be performed in '$O(1)$ time', we can say that our algorithm has a 'time complexity'. But what we are actually mean is that we have a 'operation complexity' which we express in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it is clearer that counting elementary operations is a fundamental and important measure of the number of resources required by an algorithm, as we can always decide how many resources each elementary operation requires.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While in the definition of BQP and for quantum algorithms we consider &lt;em&gt;circuit complexity&lt;/em&gt; instead of 'operation complexity', circuit complexity can again defined in terms of operations on Turing machines, so the same reasoning applies.&lt;/p&gt;&#xA;" OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-18T11:58:13.493" LastActivityDate="2018-04-18T11:58:13.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1834" PostTypeId="2" ParentId="1832" CreationDate="2018-04-18T11:41:59.833" Score="11" Body="&lt;p&gt;&lt;strong&gt;BQP&lt;/strong&gt; is defined considering &lt;em&gt;circuit size&lt;/em&gt;, which is to say the total number of gates. This means that it incorporates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Number of qubits &amp;mdash; because we can ignore any qubits which are not acted on by a gate. This will be polynomially bounded relative to the input size, and often a modest polynomial (e.g.&amp;nbsp;Shor's algorithm only involves a number of qubits which is a constant factor times the input size).&lt;/li&gt;&#xA;&lt;li&gt;Circuit depth (or 'time') &amp;mdash; because the longest the computation could take is if we perform one gate after another, without performing any operations in parallel.&lt;/li&gt;&#xA;&lt;li&gt;Communication with control systems &amp;mdash; because the gates being performed are taken from some finite gate set, and even if we allow intermediate measurements, the amount of communication required to indicate the result of the measurement and the amount of computation required to determine what is done next is usually a constant for each operation.&lt;/li&gt;&#xA;&lt;li&gt;Interactions between quantum systems &amp;mdash; even if we consider an architecture which does not have all-to-all interactions or anything close to it, we can simulate having that connectivity by performing explicit SWAP operations, which can themselves be decomposed into a constant number of two-qubit operations. This might give us a noticeable polynomial overhead which impacts how practical an algorithm is for a given architecture, but it does not hide an exponential amount of work. &lt;/li&gt;&#xA;&lt;li&gt;Energy &amp;mdash; again because the circuits are decomposed into a finite gate-set, there is no obvious way to obtain an apparent speed-up by &quot;doing the gates faster&quot; or by hiding work in an exotic interaction, if our bound is in terms of the number of operations performed from a fairly basic set of operations. This consideration is more important in adiabatic quantum computing: we can't try to avoid small gaps just by amplifying the entire energy landscape as much as we like &amp;mdash; meaning that we must take longer to do the computation instead, corresponding in the circuit picture to a circuit with more gates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In effect, counting the number of gates from a constant-sized set captures many things which you might worry about as practical resources: it leaves very little space to hide anything which is secretly very expensive.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-18T11:41:59.833" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1835" PostTypeId="2" ParentId="1815" CreationDate="2018-04-18T14:42:56.847" Score="6" Body="&lt;p&gt;As I mentioned in the comments, a very precise answer will likely depend on a lot of technical choices which are somewhat arbitrary. It is likely to be more important to obtain an order-of-magnitude estimate, and to account for as much as possible in making it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer is intended not as a definitive answer, but as a step in the right direction by reference to the existing literature (though admittedly over a decade old by now), specifically:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Van&amp;nbsp;Meter, Itoh, and Ladd.&#xA;&lt;em&gt;Architecture-Dependent Execution Time of Shor's Algorithm&lt;/em&gt;. Proc.&amp;nbsp;Mesoscopic Superconductivity&amp;nbsp;+ Spintronics 2006; [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0507023&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0507023&lt;/a&gt;]&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Van Meter, Itoh, and Ladd attempt to compare the performance of Shor's algorithm with available computing technology performing the Number Field Sieve (the best known classical algorithm for factorisation). I have not had the time to plumb through the details of the paper &amp;mdash; a superior answer could likely be obtained by doing so &amp;mdash; but Figure&amp;nbsp;1 of that article allows us to make a reasonable numerical estimation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zt7uF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zt7uF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the steep curves represent the computing time of classical computing networks. The curve labeled 'NFS, 104 PCs, 2003' seems to indicate computations (and the projected computing time) of one hundred and four personal computers circa 2003, as reported by RSA Security Inc. in 2004 [&lt;a href=&quot;http://www.rsasecurity.com/rsalabs/node.asp?id=2096]&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.rsasecurity.com/rsalabs/node.asp?id=2096]&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will carry out a Fermi calculation. Let us assume that the curve corresponds to a computation on 104 essentially identical computers, and let us presume that $n$ computers carrying out number field sieve can carry out $n \cdot v$ computations per second of Number Field Sieve, where $v$ is the number of operations per second which a single computer can carry out. A quick web search suggests the speed of a good commercially available PC circa 2003 was about 2GHz. Assuming that the computers were performing one logical operation per clock cycle, the classical computation in 2003 was effectively operating at about $2 \times 10^{11}$ operations per second. A hypothetical benchmarking of Shor's algorithm would have to be made against a quantum computer performing at a comparable clock speed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the lowest curve for quantum algorithms represents a clock-rate of $10^9$, so the point at which a hypothetical realisation of Shor's algorithm would surpass this performance is not on the graph shown. However, there is some interesting information which is shown.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Despite a operations-per-second advantage of a factor of 200 or more, the plot does indicate when this 200GHz classical NFS implementation is surpassed by a 1GHz quantum computer performing Shor's algorithm (at about 200 digit numbers) and by a 1MHz quantum computer (at about 330 digit numbers).&lt;/li&gt;&#xA;&lt;li&gt;We also have a curve projecting the performance &quot;in 2018&quot;, representing 1000 times the classical computation power: the intercepts with the 1GHz and 1MHz quantum computers are at 350 bit numbers and 530 bit numbers.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The increase in the crossing points against quantum computations, from the computation in 2003 to the projected one in 2018, representing a clock-speed boost of 1000, is a factor of about 5/3. From this we can estimate that the computational advantage to the size of numbers that can be quickly solved by a classical computer, due to a speed increase of a factor of 200, is roughly 7/6. Then we can estimate that the crossing point of a single 1GHz classical computer performing NFS, with a 1GHz quantum computer performing Shor's algorithm, is at about 170 bit numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom line &amp;mdash; a precise answer will depend on many technical assumptions which can change the precise result significantly, so it is better to seek a rough estimate. But this question has been researched at least once before, and making some number of assumptions and extrapolations on performance based on classical performance in 2003, it seems that Shor's algorithms will outperform the best known classical algorithm on an operation-by-operation basis for numbers around 170 bits.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="119" LastEditDate="2018-04-18T19:49:58.667" LastActivityDate="2018-04-18T19:49:58.667" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1836" PostTypeId="1" AcceptedAnswerId="1837" CreationDate="2018-04-18T16:22:20.833" Score="7" ViewCount="299" Body="&lt;p&gt;The following question is related to this one: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1404/will-deep-learning-neural-networks-run-on-quantum-computers&quot;&gt;Will deep learning neural networks run on quantum computers?&lt;/a&gt;. I found it complementary and necessary because the previous answers are not completely related with my concerns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Primarily, my question is related to hardware-based neural networks. As proposed by &lt;a href=&quot;https://www.nature.com/articles/nature14441&quot; rel=&quot;noreferrer&quot;&gt;Precioso et al. in 'Training and operation of an integrated neuromorphic network based on metal-oxide memristors'&lt;/a&gt; the use of solid-state or even molecular memristors can be a hardware proposal to implement efficient and non-volatile neural networks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the question is: Is there a quantum logic operation which can be used to improve the algorithms present in neural networks? Can quantum logic add any possible strategy in order to increase the efficiency of such networks?&lt;/p&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="26" LastEditDate="2018-12-13T19:46:13.230" LastActivityDate="2018-12-13T19:46:13.230" Title="Can quantum computing provide advantages related to Hardware-Neural Networks?" Tags="&lt;algorithm&gt;&lt;architecture&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1837" PostTypeId="2" ParentId="1836" CreationDate="2018-04-18T17:18:17.603" Score="6" Body="&lt;p&gt;Again, this is still an open question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two lines of work that come to mind when you talk of &quot;hardware-based neural networks&quot; which try/claim to use photonics as a mean to speed-up processing, and make direct reference to speeding up machine learning tasks. &#xA;Shen et al. 2016 (&lt;a href=&quot;https://arxiv.org/abs/1610.02365&quot; rel=&quot;nofollow noreferrer&quot;&gt;1610.02365&lt;/a&gt;) propose a method to implement &quot;fully-optical neural networks&quot; which they claim to provide advantages in terms of computational speed and power efficiency.&#xA;A similar in principle (but not in method) idea is the one pursued by the &lt;a href=&quot;http://www.lighton.io/our-technology&quot; rel=&quot;nofollow noreferrer&quot;&gt;LightOn&lt;/a&gt; startup (see the papers referenced in their website). Very roughly speaking, the idea is here to exploit the natural dynamics of complex media, and therefore the natural dynamics of scattered light, to again get better processing speed and power consumption performances (note that I'm just stating the claims made in the papers here, as the details and validity of performances and advantages can be hard to judge in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note that, in both cases, only classical light is used&lt;/em&gt;&lt;/strong&gt;. In other words, there is arguably nothing &quot;quantum&quot; about these works, so you may not consider them totally relevant here. &#xA;However, both platforms could naturally be used (and have been used for different experiments) with single photons, and therefore can be used for processing of quantum information.&#xA;However, building a &quot;quantum neural network&quot; is &lt;em&gt;not&lt;/em&gt; just a matter of building a neural network-like evolution for a quantum system, as that would likely provide no advantage at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Talking instead of &quot;&lt;em&gt;quantum logic operation which can be used to improve the algorithms present in neural networks&lt;/em&gt;&quot;, this is the idea behind a good chunk of research being done on quantum (assisted) machine learning, some references for which can be found in the question you linked as well as in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1268/55&quot;&gt;this other one&lt;/a&gt;.&#xA;A notable example is &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL09&lt;/a&gt;, which provides a way to speed-up the problem of inverting a linear system, which is an important part of many machine-learning algorithms.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-04-18T21:02:57.660" LastActivityDate="2018-04-18T21:02:57.660" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1839" PostTypeId="2" ParentId="1716" CreationDate="2018-04-19T10:18:09.857" Score="3" Body="&lt;p&gt;In order to benefit from the use of quantum objects to perform classical computation, one possibility is proposed by &lt;a href=&quot;https://en.wikipedia.org/wiki/Spintronics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spintronics&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the discovery of the giant magnetorresistence by Fert et al. (in &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.61.2472&quot; rel=&quot;nofollow noreferrer&quot;&gt;Giant Magnetoresistance of (001)Fe/(001)Cr Magnetic Superlattices&lt;/a&gt;) a new field has been developed in which the spin has been used instead of the classical charge. This new electronics relies on the use of the quantum properties of the spin to to encode information, an approach that permits the manipulation (write/read) of information using lower energies compared to those involved in conventional electronics. Spintronics proposes new materials to the data storage and data processing industries but also aims at offering novel possibilities to quantum technologies. &lt;a href=&quot;http://science.sciencemag.org/content/294/5546/1488.full&quot; rel=&quot;nofollow noreferrer&quot;&gt;See: Spintronics, A Spin-Based Electronics Vision for the Future.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Molecular spintronics, developed in the past decade,deals with the possibility of transferring the spintronic properties displayed by the purely inorganic compounds to systems made out of discrete molecules. Motivated by the fact that organic molecules are mostly formed by light atoms, which bear weak spin−orbit coupling and present low-contact nuclear hyperfine interaction, molecular spintronics hold promises for enhanced quantum coherence and the preservation of the spin during the operation time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding classical/quantum hybrid  computation, recently the group of W. Wernsdorfer et al have reported the fist quantum algorithm implemented in a single-molecule device by means of spintronics in &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.119.187702&quot; rel=&quot;nofollow noreferrer&quot;&gt;Operating Quantum States in Single Magnetic Molecules: Implementation of Grover’s Quantum Algorithm.&lt;/a&gt; I am not aware that any advance in this approach has been performed by the inorganic (non-molecular) counterpart in Spintronics.&lt;/p&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="1955" LastEditDate="2018-04-19T10:42:00.423" LastActivityDate="2018-04-19T10:42:00.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1840" PostTypeId="1" AcceptedAnswerId="1848" CreationDate="2018-04-19T11:06:14.907" Score="8" ViewCount="380" Body="&lt;p&gt;Considering two entangled flying qubits, as far as I know, there is no physical limit for separating them without losing quantum information.&lt;/p&gt;&#xA;&lt;p&gt;See: &lt;a href=&quot;https://physics.stackexchange.com/questions/170454/is-there-any-theoretical-limit-to-the-distance-at-which-particles-can-remain-ent&quot;&gt;Is there any theoretical limit to the distance at which particles can remain entangled?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the actual record in such distance using photons?  I have found a previous record in 143 km (&lt;a href=&quot;https://phys.org/news/2012-09-km-physicists-quantum-teleportation-distance.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Physicists break quantum teleportation distance&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What about using solid-state based qubits?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can this suppose a limitation when constructing a solid-state quantum computer?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-12-13T21:00:20.700" Title="What is the maximum separation between two entangled qubits that has been achieved experimentally?" Tags="&lt;entanglement&gt;&lt;decoherence&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1841" PostTypeId="1" AcceptedAnswerId="1843" CreationDate="2018-04-19T13:36:02.280" Score="10" ViewCount="645" Body="&lt;p&gt;Suppose I transform a state as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I start with the state $\lvert 0\rangle \otimes \lvert0\rangle \otimes \lvert0\rangle \otimes \lvert 0 \rangle$.&lt;/li&gt;&#xA;&lt;li&gt;I entangle the 1st and 2nd qubits (with an H gate and C-NOT).&lt;/li&gt;&#xA;&lt;li&gt;I then then entangle the 3rd and 4th qubits the same way.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If I try to apply H gate and C-NOT to the 2nd and 3rd qubits afterwords, will the whole system become entangled? What happens to the 1st and 4th qubits in that case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://physics.stackexchange.com/questions/400699/what-happens-if-two-separate-entangled-qubits-are-passed-through-a-cnot-gate&quot;&gt;Cross-posted from Physics.SE&lt;/a&gt;) &lt;/p&gt;&#xA;" OwnerUserId="2060" LastEditorUserId="26" LastEditDate="2018-12-23T12:27:01.293" LastActivityDate="2018-12-23T12:27:01.293" Title="What happens if two separately entangled qubits are passed through a C-NOT gate?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1842" PostTypeId="1" AcceptedAnswerId="1849" CreationDate="2018-04-19T13:53:43.727" Score="5" ViewCount="94" Body="&lt;p&gt;I've read the &quot;&lt;em&gt;trend&lt;/em&gt;&quot; article entitled &lt;a href=&quot;https://physics.aps.org/articles/v2/34&quot; rel=&quot;nofollow noreferrer&quot;&gt;Is a room-temperature, solid-state quantum computer mere fantasy?&lt;/a&gt; from almost 10 years ago, and was wondering if things have really changed: What is the current consensus on the viability of a room-temperature solid-state quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="26" LastEditDate="2018-12-14T05:29:56.677" LastActivityDate="2018-12-14T05:29:56.677" Title="What is the most optimistic perspective of room-temperature solid-state QC?" Tags="&lt;architecture&gt;&lt;solid-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1843" PostTypeId="2" ParentId="1841" CreationDate="2018-04-19T14:01:53.557" Score="11" Body="&lt;p&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}&#xA;%&#xA;$So, first you're entangling qubits 1 and 2, and qubits 3 and 4, so overall you have the quantum state&#xA;$$&#xA;\left(\ket{00}+\ket{11}\right)\otimes\left(\ket{00}+\ket{11}\right)/2&#xA;$$&#xA;Then you apply a Hadamard on qubit 2,&#xA;$$&#xA;(\ket{0}(\ket{0}+\ket{1})+\ket{1}(\ket{0}-\ket{1}))\otimes(\ket{00}+\ket{11})/(2\sqrt{2})&#xA;$$&#xA;before applying a controlled-NOT from qubit 2 (control) to qubit 3 (target), right? This gives you&#xA;$$&#xA;(\ket{0}\otimes(\ket{0}\otimes(\ket{00}+\ket{11})+\ket{1}\otimes(\ket{10}+\ket{01}))+\ket{1}\otimes(\ket{0}\otimes(\ket{00}+\ket{11})-\ket{1}\otimes(\ket{10}+\ket{01})))/(2\sqrt{2})&#xA;$$&#xA;Let's rearrange this slightly as&#xA;$$&#xA;\ket{\Psi}=((\ket{0}-\ket{1})\ket{1}(\ket{10}+\ket{01})+(\ket{0}+\ket{1})\ket{0}(\ket{00}+\ket{11}))/(2\sqrt{2})&#xA;$$&#xA;Note that we need the full state of the whole system. You cannot really talk about the states of qubits 1 and 4 separately due to the entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question of &quot;is it still entangled&quot; is straightforwardly &quot;yes&quot;, but that is a actually a triviality of a much more complex issue. It is entangled in the sense that it is not a product state $\ket{\psi_1}\otimes\ket{\psi_2}\otimes\ket{\psi_3}\otimes\ket{\psi_4}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One simple way to see that this state is entangled is to pick a bipartition, i.e. a split of the qubits into two parties. For instance, let's take qubit 1 as one party (A), and all the others as party B. If we work out the reduced state of party A, a product state (unentangled) would have to give a pure state. Meanwhile, if the reduced state is not pure, i.e. has a rank greater than 1, the state is definitely entangled. For example, in this case&#xA;$$&#xA;\rho_A=\text{Tr}(\ket{\Psi}\bra{\Psi})=\frac{\mathbb{I}}{2},&#xA;$$&#xA;has rank 2. Actually, it doesn't matter what you did between qubits 2 and 3, as $\rho_A$ is independent of that unitary; it cannot remove the entanglement created with qubit 1 (just possibly spread it between qubits 2 and 3). The fact that you have to look at different bipartitions to see which qubits are entangled with which already starts to indicate some of the complexity. For pure states, it is sufficient to look at each of the bipartitions of 1 qubit with the rest. If each of these reduced density matrices is rank 1, your whole state is separable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related to your question, you might like to look up issues of &quot;monogamy of entanglement&quot; -- the more entangled qubit 1 is with qubit 2, the less entangled qubit 1 is with qubit 3 (for example), and that can be quantified in a number of different ways. Equally, you can ask questions about &quot;what sort of entanglement is there?&quot;. One approach is to look at what types of entanglement can be converted into different types (often termed &quot;SLOCC equivalence classes&quot;). For example, with 3 qubits, people make the distinction between W-state entanglement, which looks like $\ket{001}+\ket{010}+\ket{100}$ and GHZ-entanglement that looks like $\ket{000}+\ket{111}$, as well as bipartite entanglement between different pairs of qubits, and a separable state on the other. It gets really messy for 4 qubits!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-19T15:22:15.577" LastActivityDate="2018-04-19T15:22:15.577" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1844" PostTypeId="2" ParentId="1840" CreationDate="2018-04-19T15:14:29.357" Score="5" Body="&lt;p&gt;I believe the current record is held by the Jian-Wei Pan group in China, who are able to generate entanglement via a satellite. The journal article is &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.119.200501&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, while there's plenty of media coverage that is a bit more accessible, e.g. &lt;a href=&quot;https://www.newscientist.com/article/2134843-chinese-satellite-beats-distance-record-for-quantum-entanglement/&quot; rel=&quot;noreferrer&quot;&gt;New Scientist&lt;/a&gt;. This claims a distance of &lt;strong&gt;1203km&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-19T15:14:29.357" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1845" PostTypeId="1" AcceptedAnswerId="1846" CreationDate="2018-04-19T16:50:05.380" Score="7" ViewCount="315" Body="&lt;p&gt;Consider the 9 qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction#The_Shor_code&quot; rel=&quot;noreferrer&quot;&gt;Shor code&lt;/a&gt;. This can detect and correct arbitrary single qubit errors, but if there are 2 or more single qubit errors before a correction round, the correction will fail. (In the sense that it won't reproduce the original logical state.) Hence the probability of failure of the Shor code is the probability of there being 2 or more single qubit errors. If we assume that single qubit errors occur independently with probability $p$, then we can calculate this probability as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(\mathrm{failure}) = 1 - \left[(1-p)^{9} + 9p(1-p)^{8}\right].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can write this probability as a series in $p$ as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P(\mathrm{failure}) = \sum_{m=2}^{9} (-1)^{m} (m-1) \binom{9}{m} p^{m}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about the intuition for the coefficients of each term in this sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\binom{9}{m} p^{m}$ part seems natural. We can interpret it as the probability that $m$ single qubit errors occur multiplied by the number of groups of $m$ qubits these errors could act on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; What I am confused by is the $(-1)^{m} (m-1)$ part of the coefficient. Why should some of the higher order terms lead to a &lt;em&gt;suppression&lt;/em&gt; of the failure probability, and why should the weighting of these terms beyond the binomial coefficient increase with order? Is there some intuition for these coefficients?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note 1:&lt;/strong&gt; I realise that the $m=2$ case is the most important, since we typically assume $p \ll 1$. Indeed, most treatments truncate the series at $m=2$, where $(-1)^{m} (m-1) = 1$, so even if the higher-order terms do have an effect, that effect should be fairly negligible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note 2:&lt;/strong&gt; Though I have specified the Shor code for concreteness, this behaviour is not specific to the Shor code. For example, if we restrict ourselves to bit-flip errors, then the failure probability of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction#The_bit_flip_code&quot; rel=&quot;noreferrer&quot;&gt;bit-flip code&lt;/a&gt; will exhibit similar coefficients.&lt;/p&gt;&#xA;" OwnerUserId="2061" LastEditorUserId="26" LastEditDate="2018-05-07T13:18:27.270" LastActivityDate="2018-05-07T13:18:27.270" Title="Intuition for Shor code failure probability" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1846" PostTypeId="2" ParentId="1845" CreationDate="2018-04-19T19:12:42.477" Score="4" Body="&lt;p&gt;When given set of Pauli errors acts on a stabilizer code, they will either be corrected, or the attempt at correction will lead to a logical error. There will be no more complicated cases, such as a superposition of the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes calculation of the failure probability rather straightforward (though not necessarily practical for large codes). You just take the probability of every uncorrectable set of errors, and sum them up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though this is a simple sum of positive terms, there are ways it could be written with the occasional minus sign. For example, you could sum the probabilities for all correctable sets of errors, and then subtract that from $1$. Such subtractions do not imply a suppression of the failure probability. They just show that you previous terms overestimated the failure probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Minus signs most often come because the probability for a lack of error on a qubit can be written as $1-p$. If we expand out products in which this is a factor, we will get negative terms. But that is simply because we chose to write the expression as a polynomial in the single probability $p$, rather than using both $p$ and $1-p$ for their respective events.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what is happening in your case. The factor $p^m$ is an overestimate for the probability of errors on $m$ qubits, because it doesn’t account for what the other qubits are doing, and the corresponding contributions to the total probability. Hence some subtractions also need to be made.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-19T19:12:42.477" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1847" PostTypeId="2" ParentId="75" CreationDate="2018-04-19T19:44:43.293" Score="2" Body="&lt;p&gt;In the dim and distant past (I.e. I don’t remember the details any more), I tried to calculate an upper bound on a fault tolerant threshold. I suspect the assumptions that I made to get there wouldn’t apply to every possible scenario, but I came up with an &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.77.052319&quot; rel=&quot;nofollow noreferrer&quot;&gt;answer&lt;/a&gt; of 5.3% (&lt;a href=&quot;https://arxiv.org/abs/0705.4360&quot; rel=&quot;nofollow noreferrer&quot;&gt;non-paywall version&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea was roughly to make use of a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9604024&quot; rel=&quot;nofollow noreferrer&quot;&gt;well-known connection&lt;/a&gt; between error correction codes and distillation of multiple noisy Bell states into a single, less noisy Bell state. In essence, if you have multiple noisy Bell states, one strategy for making a single high quality Bell state is to teleport the codewords of an error correction code through them. It's a two-way relationship; if you come up with a better distillation strategy, that defines a better error correcting code and vice-versa. So, I wondered what would happen if you allowed a concatenated scheme of distillation of noisy Bell pairs, but allowed some errors to occur when applying the various operations. This would map directly to fault tolerance via concatenated error correcting codes. But the different perspective allowed me to estimate a threshold beyond which the noise accumulation would simply be too high, and thus the error correction scheme would fail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different works have made different assumptions. For example, &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.71.042328&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; restricts to specific gate sets, and derives an upper bound to the fault-tolerant threshold of 15% in a specific case (but then the question arises as to why you wouldn't pick the scheme with the highest upper bound, rather than the lowest!).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-04T19:39:05.400" LastActivityDate="2018-05-04T19:39:05.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1848" PostTypeId="2" ParentId="1840" CreationDate="2018-04-20T04:26:54.810" Score="4" Body="&lt;p&gt;Photons travel fast, and there's often the option to transfer their entanglement to solid state. Of course, the advantage of transferring entanglement to a solid state qubit is that one is able to operate with it (one- and two-qubit gates, for example) with ease and efficiency, whereas it is very hard to effect two-qubit quantum gates on photons themselves, for more on that see the answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1807/how-do-you-apply-a-cnot-on-polarization-qubits&quot;&gt;How do you apply a CNOT on polarization qubits?&lt;/a&gt; So, let us divide the answer into optical-solid-state hybrid approaches, purely optical approaches and purely solid-state approaches:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The optical-solid-state hybrid approach results in records such as this one from 2012: &lt;a href=&quot;https://arxiv.org/abs/1212.6136&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heralded entanglement between solid-state qubits separated by 3 meters&lt;/a&gt;. For the solid-state part they employed &lt;a href=&quot;https://en.wikipedia.org/wiki/Nitrogen-vacancy_center&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nitrogen-Vacancy centers&lt;/a&gt;, which are diamond defects with remarkable quantum coherence, even at high temperature (although this particular experiment is performed at low temperature). In this case, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum fidelity&lt;/a&gt; of the final entangled state is well above the classical limit of 0.5 but at the same time well below 0.9, meaning it's enough to demonstrate quantum effects, but not great in a practical sense. Apparently, imperfect  photon  indistinguishability is the main limitation to fidelity in this experiment, followed by errors  in  the  microwave  pulses that are used to rotate the readout bases of the two solid-state qubits. As a more recent update on where things could be headed towards with the hybrid approach, there's this &lt;a href=&quot;https://arxiv.org/pdf/1712.00854.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Demonstration  of  Entanglement  Purification  and  Swapping Protocol to Design Quantum Repeater in IBM Quantum Computer&lt;/a&gt;. As far as I read it, it's not a complete demonstration, since it does not actually implement the photon-solid transfer but rather &quot;&lt;em&gt;design a quantum circuit which could in principle equivalently perform the main operations of a quantum repeater&lt;/em&gt;&quot;. For a perspective on the whole field of combining quantum communications with quantum computing, see Nature Photonic's &lt;a href=&quot;https://www.nature.com/articles/s41566-017-0032-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Towards a global quantum network&lt;/a&gt;(&lt;a href=&quot;https://arxiv.org/pdf/1710.11585.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;The purely optical record, as reported in his answer by @DaftWullie, is claimed by the Jian-Wei Pan group in China, who report entanglement over 1203 km via a satellite (&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.119.200501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Satellite-to-Ground Entanglement-Based Quantum Key Distribution&lt;/a&gt;). Because of the nature of photons, this is more useful for purely quantum communication purposes rather than for actual quantum computing.&lt;/li&gt;&#xA;&lt;li&gt;On the purely solid-state approach, I found this letter to Nature Nanotechnology of 2012, &lt;a href=&quot;https://www.nature.com/articles/nnano.2012.28&quot; rel=&quot;nofollow noreferrer&quot;&gt;Electrical control of a solid-state flying qubit&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/pdf/1709.08873.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version&lt;/a&gt;) Yamamoto and coworkers reported the transport and manipulation of qubits over distances of 6 microns within 40 ps, in an Aharonov-Bohm rings (based on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Aharonov%E2%80%93Bohm_effect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aharonov–Bohm_effect&lt;/a&gt;), connected to two-channel wires that have a tunable tunnel coupling between channels. They claim to be the first &quot;&lt;em&gt;demonstrations of scalable ‘flying qubit’ architectures—systems in which it is possible to perform quantum operations on qubits while they are being coherently transferred—in solid-state systems&quot;&lt;/em&gt;. According to Yamamoto et al., &quot;&lt;em&gt;These architectures allow for control over qubit separation and for non-local entanglement, which makes them more amenable to integration and scaling than static qubit approaches.&lt;/em&gt;&quot; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All that being said, probably the best practical answer to the question, at least for now, is currently working quantum computers: since it is claimed that &lt;a href=&quot;https://arxiv.org/abs/1801.03782&quot; rel=&quot;nofollow noreferrer&quot;&gt;16-qubit IBM universal quantum computer can be fully entangled&lt;/a&gt;, it seems that &lt;strong&gt;the maximum distance of entanglement in solid-state devices will not be a practical limitation for quantum computing&lt;/strong&gt; (even without employing flying qubits). I suspect that scaling and protecting that entanglement, however, will not be trivial.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-20T04:26:54.810" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1849" PostTypeId="2" ParentId="1842" CreationDate="2018-04-21T02:44:47.083" Score="2" Body="&lt;p&gt;Articles on technology from 10 years ago are often outdated, to some extent the same can be said of last year's information. Occasionally something will stand for decades, or fall into decline only to be revisited later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most optimistic perspective is: someone is working on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some more recent articles on room temperature QC:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://www.beilstein-journals.org/bjnano/articles/9/100&quot; rel=&quot;nofollow noreferrer&quot;&gt;Room-temperature single-photon emitters in titanium dioxide optical defects&lt;/a&gt;&quot; by Chung, Leung, To, Djurišić and Tomljenovic-Hanic (04 Apr 2018).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1712.07293&quot; rel=&quot;nofollow noreferrer&quot;&gt;Room temperature high-fidelity non-adiabatic holonomic quantum computation on solid-state spins in Nitrogen-Vacancy centers&lt;/a&gt;&quot; by Yan, Chen, and Lu (20 Dec 2017).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1612.08567&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scalable quantum computation based on quantum actuated nuclear-spin decoherence-free qubits&lt;/a&gt;&quot;, by Rong, Dong, Geng, Shi, Li, Duan, and Du (27 Dec 2016).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1407.0180&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coherent control of single spins in silicon carbide at room temperature&lt;/a&gt;&quot; by Widmann, Lee, Rendler, and 15 others (31 Oct 2014).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lots of people are working on the idea, how soon it becomes available remains to be seen. Use of solid-state could be on the way out ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://phys.org/news/2018-03-transistor-closer.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Practical spin wave transistor one step closer&lt;/a&gt;&quot; physics.Org article, March 1, 2018, and University of Groningen &quot;&lt;a href=&quot;https://www.rug.nl/research/portal/publications/magnon-spintronics-in-noncollinear-magnetic-insulatormetal-heterostructures(6ec15eb7-2d85-4c48-b953-ac23aff19e07).html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Magnon spintronics in non-collinear magnetic insulator/metal heterostructures&lt;/a&gt;&quot; (Feb 2017).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wFzZm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wFzZm.png&quot; alt=&quot;Magnon Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-04-21T02:44:47.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1850" PostTypeId="1" CreationDate="2018-04-21T06:05:36.383" Score="7" ViewCount="470" Body="&lt;p&gt;It is &lt;a href=&quot;https://www.nationalreview.com/2018/02/quantum-computing-blockchain-technology-threat/&quot; rel=&quot;noreferrer&quot;&gt;popularly stated&lt;/a&gt; that quantum computing could destroy and disrupt blockchain technology completely. How is quantum computing a threat to blockchain technology?&lt;/p&gt;&#xA;" OwnerUserId="2074" LastEditorUserId="26" LastEditDate="2018-12-13T19:47:41.687" LastActivityDate="2018-12-13T19:47:41.687" Title="Quantum computing and blockchain technology" Tags="&lt;cryptography&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1851" PostTypeId="1" AcceptedAnswerId="1853" CreationDate="2018-04-21T09:14:33.290" Score="6" ViewCount="118" Body="&lt;p&gt;QMA(Quantum Merlin Arthur), is the quantum analog of NP, and QMA(k) is the class with $k$ verifiers. These are important classes when studying Quantum Complexity theory. QMA(k) is QMA with $k$ unentangled provers($k$ Merlins), or BQP verfiers. These classes enable us to formally study the complexity of Entanglement. For instance the class QMA(2) could help us to study the separability of quantum states, and resources required for telling whether these states are separable or far from separable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A natural question arises - What are the upper bounds for these classes (QMA, QMA(k))- do these classes have nontrivial upper bounds(could they have upper bounds such as PSPACE?&lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="429" LastEditDate="2018-04-21T09:51:00.063" LastActivityDate="2018-04-21T09:51:00.063" Title="Upper Bounds for QMA Quantum Merlin Arthur, and QMA(k)" Tags="&lt;entanglement&gt;&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1852" PostTypeId="2" ParentId="1850" CreationDate="2018-04-21T09:31:41.077" Score="4" Body="&lt;p&gt;My crude understanding of blockchain (derived mainly from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Blockchain&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt;) is that it gets its security from two sources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Individual communications are performed using a public key cryptography scheme&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Information is stored in a decentralised manner across many different computers, meaning that there are many different copies of the same information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The level of security provided by these two items differs, I suspect. Public key cryptography has an exponential form of security against classical attacks: it's based on a mathematical problem, and you add one bit to the problem size, and the difficulty (roughly) doubles. It's really easy to add a few bits, and put the problem completely out of anybody's reach. Meanwhile, for the decentralised part, I imagine that adding one extra computer to the network doesn't significantly increase the resources required to monitor all the communications; for a network of $N$ nodes, there are only $\binom{N}{2}$ communication links to monitor (a polynomial in $N$, not exponential). So, while adding a few more computers to the network might make monitoring a daunting task for an individual, state-level interference is unlikely to be eliminated. Thus, the security is heavily dependent upon the security of the public key cryptosystem being used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is that quantum computers will be good at breaking existing public key cryptography systems such as RSA. RSA, for example, is secured by the assumption that it is difficult to find the prime factors of a large number (the person who is allowed to decript a message proves that they can by giving the factors of a particular number). To the best of our knowledge, this is true for classical computers, but Shor's algorithm makes this an easy task for a quantum computer. This means that, in principle, individual communications can be read an manipulated by a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Researchers are working on replacement public key cryptography systems that will be resiliant to attack by a quantum computer (called post-quantum cryptography) but these are not yet in place. &lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-21T09:51:57.807" LastActivityDate="2018-04-21T09:51:57.807" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1853" PostTypeId="2" ParentId="1851" CreationDate="2018-04-21T09:38:08.770" Score="2" Body="&lt;p&gt;You probably want to check out the &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo&quot; rel=&quot;nofollow noreferrer&quot;&gt;complexity zoo&lt;/a&gt; for known results. For example, the listing on &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:Q#qma2&quot; rel=&quot;nofollow noreferrer&quot;&gt;QMA(2)&lt;/a&gt; states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It was shown in &lt;a href=&quot;http://arxiv.org/0804.0802&quot; rel=&quot;nofollow noreferrer&quot;&gt;ABD+08&lt;/a&gt; that a conjecture they call the Strong Amplification Conjecture implies that QMA(2) is contained in PSPACE.&lt;/p&gt;&#xA;&lt;p&gt;It was shown in &lt;a href=&quot;https://arxiv.org/abs/1001.0017&quot; rel=&quot;nofollow noreferrer&quot;&gt;HM13&lt;/a&gt; that QMA(k) = QMA(2) for k &amp;gt;= 2. However we still do not know if QMA(2) = QMA. The best known upper bound is NEXP.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-21T09:38:08.770" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1854" PostTypeId="1" CreationDate="2018-04-21T10:26:07.993" Score="17" ViewCount="316" Body="&lt;p&gt;This question is related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1716/can-the-theory-of-quantum-computation-assist-in-the-miniaturization-of-transisto&quot;&gt;Can the theory of quantum computation assist in the miniaturization of transistors?&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1648/is-quantum-biocomputing-ahead-of-us&quot;&gt;Is Quantum Biocomputing ahead of us?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About 10 years ago, several papers discussed the &lt;a href=&quot;https://aip.scitation.org/doi/10.1063/1.3002335&quot; rel=&quot;noreferrer&quot;&gt;environment-assisted quantum walks in photosynthetic energy transfer&lt;/a&gt; (Mohseni, Rebentrost, Lloyd, Aspuru-Guzik, The Journal of Chemical Physics, 2008) and the &lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1367-2630/10/11/113019/meta&quot; rel=&quot;noreferrer&quot;&gt;dephasing-assisted transport: quantum networks and biomolecules&lt;/a&gt; (Plenio, Huelga, New Journal of Physics 2008). One major idea there seems to be that the &quot;environment&quot; (quantum decoherence) assists or &lt;em&gt;optimizes&lt;/em&gt; the transport of a signal that is also fundamentally quantum coherent in nature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: beyond the theoretical interpretation of processes happening in natural systems, have physical processes of this kind already been explored in artificial systems, either as quantum computation (perhaps as quantum-enhanced mixed classical-quantum transistors) or in a quantum simulator? Or, if this has not happened yet, could one in principle do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit after obtaining an answer: Note the lax sense of&lt;/em&gt; optimize &lt;em&gt;above. In a biological rather than mathematical context,&lt;/em&gt; optimization &lt;em&gt;needs not be absolute but can refer to any significant improvement, like enzimes have been&lt;/em&gt; optimized &lt;em&gt;via evolution to increase the speed of reactions&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="141" LastEditDate="2018-08-07T03:45:10.363" LastActivityDate="2018-11-25T13:17:22.457" Title="Quantum simulation of environment-assisted quantum walks in photosynthetic energy transfer" Tags="&lt;architecture&gt;&lt;experiment&gt;&lt;decoherence&gt;&lt;quantum-walks&gt;&lt;biology&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="1855" PostTypeId="1" AcceptedAnswerId="1856" CreationDate="2018-04-21T11:24:29.037" Score="12" ViewCount="4412" Body="&lt;p&gt;I am getting confused about the meaning of the term &quot;ancilla&quot; qubit. It's use seems to vary a lot in different situations. I have read (in numerous places) that an ancilla is a constant input - but in nearly all of the algorithms I know (Simion's, Grover's, Deutsch etc) all the qubits are of constant input and therefore would be considered ancilla. Given that this does not seem to be the case - what is the general meaning of an &quot;ancilla&quot; qubit in quantum computers?&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="26" LastEditDate="2018-12-23T12:26:35.230" LastActivityDate="2018-12-23T12:26:35.230" Title="What counts as an &quot;ancilla&quot; qubit?" Tags="&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1856" PostTypeId="2" ParentId="1855" CreationDate="2018-04-21T11:58:51.950" Score="7" Body="&lt;p&gt;The general meaning of &lt;em&gt;ancilla&lt;/em&gt; in &lt;a href=&quot;https://en.wikipedia.org/wiki/Ancilla_bit&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancilla qubit&lt;/a&gt; is &lt;em&gt;auxiliary&lt;/em&gt;. In particular, when people write about &quot;constant input&quot; what they mean is that, for a given algorithm -which has a purpose, such as finding the prime factors of an input number, or &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1289/how-does-a-quantum-computer-do-basic-math-at-the-hardware-level-&quot;&gt;effecting a simple arithmetic operation between two input numbers&lt;/a&gt; the value of the &lt;em&gt;ancilla&lt;/em&gt; qubits will be independent of the value of the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably your confusion arises because some algorithms study a function, employing a constant input, rather than study an input, using a constant function. Maybe in these cases the term &lt;em&gt;ancilla&lt;/em&gt; qubit makes less sense, since, as you point out, all input qubits are constant and act as &lt;em&gt;ancillae&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-04-22T06:17:33.763" LastActivityDate="2018-04-22T06:17:33.763" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1857" PostTypeId="2" ParentId="1855" CreationDate="2018-04-21T11:59:03.060" Score="9" Body="&lt;p&gt;When translating a classical circuit into a quantum circuit, you often need to introduce extra qubits simply because quantum computers only implement reversible logic. Such extra qubits are ancilla (or ancillary qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to spot which qubits are ancilla is to look for those qubits that typically need to be &quot;uncomputed&quot; when using the quantum circuit as a quantum oracle in another quantum algorithm.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-04-21T11:59:03.060" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1858" PostTypeId="1" AcceptedAnswerId="1866" CreationDate="2018-04-21T14:08:23.203" Score="7" ViewCount="189" Body="&lt;p&gt;On p490 of Nielsen and Chuang, 2010 the authors say that the preparation of the 'cat' state ($|000\ldots 0\rangle+|111\ldots 1\rangle$) is not Fault Tolerant.  Below is my mock up of the diagram they draw for the preparation ($H$ and $C$-not-not *) and one part of the verification (the next two C-nots):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dWIlm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dWIlm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They then explain that this is not fault tolerant because a $Z$ error in the 'extra qubit' (i.e. that at the bottom of the diagram) propagates into two Z-errors in the ancilla qubits (the top three).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They they go onto say that this will not affect the Encoded data (I have not shown this in my diagram). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of things that confuse me here. Firstly I cannot see how we get two $Z$-errors on the axillary qubits, Secondly even if we did get two $Z$-errors, surely this is a good thing as it will take our cat state back to the cat state? More the the crux of the issue - I cannot see what criterion they are using for fault tolerance here (I know what it means in the general case - i.e. unrecoverable error with probability no greater then $Cp^2$)  and how there example violates it - Please can someone explain this to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;*Not technical name - I couldn't find what it was actually called.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="2015" LastEditDate="2018-04-22T09:20:46.607" LastActivityDate="2018-04-22T09:20:46.607" Title="Why or how is 'cat' state preparation via a C-not-not operation not fault tolerant?" Tags="&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1859" PostTypeId="2" ParentId="1858" CreationDate="2018-04-21T16:19:32.197" Score="5" Body="&lt;p&gt;First a matter of terminology. I don't have my copy of Nielsen &amp;amp; Chuang to hand, but I would have thought that the bottom, extra qubit, is the one that is the ancilla. I am also not entirely convinced that the errors you're talking about can be correct. You seem to be talking about $Z$ errors, but giving results that correspond to $X$ errors. (If a $Z$-gate happens on the ancilla, it makes no difference, up to a global phase, because that qubit is always in a basis state and, as you state, 2 $Z$-errors on your original state give back the original state, so no harm done.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the ancilla qubit is doing here is comparing qubits 2 and 3; if they are in the same state (as they should be), you get a 0 answer. If they are in a different state, you get a 1 answer. Thus, if you get a 1 answer, you know something has gone wrong on one of your 3 main qubits, and needs correction. Let's say you've already tested to see that qubits 1 and 2 are the same, and they are. So, having found that qubits 2 and 3 are different, it must be that qubit 3 has the error (assuming the error occurred on one of the main qubits). So, you apply a bit-flip gate to qubit 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, let me show you what &lt;em&gt;could&lt;/em&gt; go wrong. Here, $X$ represents a bit-flip error.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/n7B48.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n7B48.png&quot; alt=&quot;EC circuit with error&quot;&gt;&lt;/a&gt;&#xA;This is the full syndrome circuit, where $|\psi\rangle$ is the cat state you produced before (also called a GHZ state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, qubit 3 has the error, but you detect it on qubit 1. So, you correct it on qubit 1, and thus your state has 2 errors in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this have to do with fault-tolerance? Proofs of fault-tolerance are usually based around the idea of tracking the errors in each error correcting code (of which there are many, one for each logical qubit that you want). You can prove that provided each logical gate that you apply (preceded and followed by a round of error correction) only causes single errors on each logical qubit, then there is a threshold error probability below which these errors can be corrected away through the use of concatenated error correcting codes. So, the point is that the structure we've just talked about doesn't obey this. There is a place where a single error actually causes 2 errors on the error correcting code. Thus, the usual argument for fault tolerance does not apply. (Technically, this does not show that there aren't other arguments that could be made, it's just that the standard route doesn't work.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-21T16:19:32.197" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1860" PostTypeId="1" AcceptedAnswerId="1865" CreationDate="2018-04-21T20:07:52.027" Score="12" ViewCount="1841" Body="&lt;p&gt;I understand that a qudit is a quantum $d$-state system. If $d=4$, is this exactly the same as a two-qubit system, which also presents $4$ quantum states? The Hilbert space is the same, right? Are there any theoretical or practical differences?&lt;/p&gt;&#xA;" OwnerUserId="1931" LastEditorUserId="26" LastEditDate="2018-12-23T12:26:08.200" LastActivityDate="2018-12-23T12:26:08.200" Title="What is the difference between a qudit system with d=4 and a two-qubit system?" Tags="&lt;qudit&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1861" PostTypeId="1" AcceptedAnswerId="1862" CreationDate="2018-04-21T20:29:23.433" Score="7" ViewCount="287" Body="&lt;p&gt;I have no background in quantum physics, and no understanding of most formulas used in this context. I'm not looking for an in depth answer, i'd just like to vaguely understand the concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way i heard it, a superposition is [real/a neccessary assumption/a concept not even wrong/whatever] and will end as soon as the object in superposition is observed. I always took that &quot;observed&quot; part to mean &quot;interacted with in a way that allows to make a decision on the state&quot; and i further supposed there was no cheating a la &quot;oh but i entangled A and B and now i just observed A, so B will be alright&quot; and suchlike . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now we have quantum computation, which seems to rely on the superpositions of objects somehow covering a whole lot of bases at once and then [something something] which produces an answer - my question is about the i/o process: How can i input something so a superposition is achieved that encompasses the information i input, without automatically destroying the relevant superposition? How can i be sure my input was put in without looking? how can i look without destroying the very thing i wanted?&lt;/p&gt;&#xA;" OwnerUserId="2080" LastEditorUserId="55" LastEditDate="2018-05-07T10:57:15.550" LastActivityDate="2018-05-07T10:57:15.550" Title="Is it true that observing a quantum state will end the superposition of states? How can I not observe?" Tags="&lt;noise&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1862" PostTypeId="2" ParentId="1861" CreationDate="2018-04-21T21:26:24.077" Score="5" Body="&lt;p&gt;I'm going to go for an intuitive answer here, as requested. Let's s go in steps:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your input is (often?) classical, so up to that point we're good.&lt;/li&gt;&#xA;&lt;li&gt;Then you start doing quantum operations and achieve, for example, quantum superpositions between different states. Here you're right, you cannot look to check if you're doing OK, and that indeed is a problem, or rather the origin for different problems. For more on that you could give a try to the tags &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/quantum-entanglement&quot;&gt;quantum entanglement&lt;/a&gt; (what you want, often), &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/quantum-decoherence&quot;&gt;quantum decoherence&lt;/a&gt; (what happens in the way) and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/quantum-error-correction&quot;&gt;quantum error correction&lt;/a&gt; (ways to fix the situation without observing, or to observe just-enough but not-in-a-destructive-way).&lt;/li&gt;&#xA;&lt;li&gt;The last point, quantum error correction, is indeed a &lt;em&gt;trick&lt;/em&gt; that is allowed. Here the key is observing, not the values of the qubits, but rather the relation between these values. With enough redundance and smart schemes, one can deduce what went wrong and where, and fix it without observing the values that are involved in the calculation. (Hopefully the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction#The_bit_flip_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;3-qubit bit flip code&lt;/a&gt; can be understood without understanding quantum mechanics, since C-not operations have basic truth tables?) In this way we sacrifice part of the quantum information while preserving the part that we care about.&lt;/li&gt;&#xA;&lt;li&gt;In the end we also get a classical output. We lose a lot, but that's just how reality works. You can always repeat the calculation to extract information gradually, aim for &lt;em&gt;quantum state tomography&lt;/em&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Finally, since others said it better than I could, consider this quotations (emphases mine).&lt;/p&gt;&#xA;&lt;p&gt;First, by &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec14.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aaronson,  &amp;quot;PHYS771 Lecture 14: Skepticism of Quantum Computing&amp;quot;&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Q: OK, so you have the Threshold Theorem, but then you have to do some error correction, right? Your computation becomes longer, right?&lt;/p&gt;&#xA;&lt;p&gt;Scott: Yeah, but by a factor of polylog(n). This isn't challenging the Church-Turing Thesis, but yeah, that's true.&lt;/p&gt;&#xA;&lt;p&gt;Q: I'm not sure if you'd have to perform another error correction as you proceed.&lt;/p&gt;&#xA;&lt;p&gt;Scott: &lt;strong&gt;The entire content of the Threshold Theorem is that you're correcting errors faster than they're created&lt;/strong&gt;. That's the whole point, and the whole non-trivial thing that the theorem shows. That's the problem it solves.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And secondly, the abstract from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9712048&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9712048 &amp;quot;Fault-tolerant quantum computation&amp;quot; by John Preskill&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The discovery of quantum error correction has greatly improved the long-term prospects for quantum computing technology. Encoded quantum information can be protected from errors that arise due to uncontrolled interactions with the environment, or due to imperfect implementations of quantum logical operations. &lt;strong&gt;Recovery from errors can work effectively even if occasional mistakes occur during the recovery procedure.&lt;/strong&gt; Furthermore, encoded quantum information can be processed without serious propagation of errors. &lt;strong&gt;In principle, an arbitrarily long quantum computation can be performed reliably, provided that the average probability of error per gate is less than a certain critical value, the accuracy threshold.&lt;/strong&gt; It may be possible to incorporate intrinsic fault tolerance into the design of quantum computing hardware, perhaps by invoking topological Aharonov-Bohm interactions to process quantum information.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-04-22T05:23:02.253" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1863" PostTypeId="2" ParentId="1850" CreationDate="2018-04-22T01:37:04.493" Score="4" Body="&lt;p&gt;This answer assumes that you do not have a technical background in cryptography or quantum physics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most current implementations of the blockchain rely on two math concepts: (1) Public key encryption. (2) Hash keys.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computers can break the public key encryption part, through a famous method known as Shor's algorithm (For technical details: see page 8 of: &lt;a href=&quot;https://arxiv.org/pdf/1710.10377.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1710.10377.pdf&lt;/a&gt;).  This is a powerful threat.  But since the digital security of the modern world is built on public key encryption, this would be a broader problem (as opposed to a blockchain specific one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computers can also break the hash key component, through a method known as Grover search. But this part is relatively resistant to the attack (For technical details: see page 4 of the above link).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other ways to build a blockchain to protect against the above attack:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some would be based on math ideas.  This is known as post-quantum blockchains.  Since quantum computers have already shown to break math-based cryptography systems and researchers are working on new algorithms of this future computer (see: &lt;a href=&quot;https://www.nature.com/news/first-quantum-computers-need-smart-software-1.22590&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/news/first-quantum-computers-need-smart-software-1.22590&lt;/a&gt;), it casts a doubt on the long-term durability of such a cryptographic system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A research group based a blockchain on a cryptographic system that uses quantum physics (For technical details see: &lt;a href=&quot;https://arxiv.org/abs/1705.09258&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1705.09258&lt;/a&gt;); this uses the properties of quantum particles as opposed to math ideas.  It's known as quantum cryptography and it is resistant to attacks from a quantum computer.  The weakness in that blockchain system is that it makes technical assumptions that may not be viable in the real world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another research group made the blockchain itself into a quantum system (For technical details, see: &lt;a href=&quot;https://arxiv.org/abs/1804.05979&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.05979&lt;/a&gt;).  This uses a property of quantum particles known as entanglement in time. The weakness is that the research only presents a conceptual design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, quantum computers pose a threat to the current implementations of the blockchain; future implementations may not suffer.  Furthermore, it would be incorrect to single out just blockchains for such a threat; quantum computers pose a threat to other systems protected by current digital security methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="2084" LastActivityDate="2018-04-22T01:37:04.493" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1864" PostTypeId="2" ParentId="1860" CreationDate="2018-04-22T03:30:06.123" Score="7" Body="&lt;p&gt;Yes the Hilbert space is the same, but you have to choose the isomorphism $\phi : \; \; (\mathbb{C}^2)^{\otimes 2} \simeq \mathbb{C}^4$. But the different setup will mean some unitaries that will be easy to implement in one setup will be hard in the other. For example, as 2 qubits gates something like $\sigma_z \otimes 1$ will be easy. But if you write that as a 4 by 4 unitary through that isomorphism $\phi$ instead that might not be as easy to implement. You should say both the Hilbert space and the easy operations that you wish to write your program in terms of.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-04-22T03:30:06.123" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1865" PostTypeId="2" ParentId="1860" CreationDate="2018-04-22T07:46:59.517" Score="10" Body="&lt;p&gt;For qubits, we usually base all of our operators on the Pauli matrices. Our basic gate set consists of the Pauli matrices themselves, Clifford gates like $H$ and $S$ that map between Pauli matrices, controlled operations like the CNOT that implement a Pauli on one qubit depending on the Pauli eigenstate of another, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any larger $d$-dimensional quantum system, we have to find the basic set of operators that will play the same role.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach is the generalize the Pauli matrices. We choose a group whose order is $d$, and define operators based in that group. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9707021&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; is my go-to text on how to do this, though it is actually focused more on generalizing stabilizer codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could also look to the spin operators for inspiration. The Pauli matrices describe a spin-$1/2$ system. So for higher dimensional systems, we could look at the operators for higher spin. They don’t have the same sort of nice properties, though. So this doesn’t seem to be a popular approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, the Hilbert space is the same and universal QC based on them is the same thing. The only difference is our basic gate set. So the numbers of gates required for a given task may have a difference in terms of constants and coefficients. And the maths might be nicer for one than the other. But the complexity will be the same.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-22T15:59:54.320" LastActivityDate="2018-04-22T15:59:54.320" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1866" PostTypeId="2" ParentId="1858" CreationDate="2018-04-22T08:42:50.523" Score="5" Body="&lt;p&gt;First of all, the two conditions for fault tolerant measurements are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A single error gives no more than one error per block of qubits&lt;/li&gt;&#xA;&lt;li&gt;The measurement result needs to be correct with probability $1-\mathcal O\left(p^2\right)$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The preparation step creates the state $\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;+\left|111\right&amp;gt;\right)$ (the three qubit 'cat state', also known as the three qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;GHZ state&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'ancilla verification' step is then applying two CNOTs on extra qubits (starting in the state $\left|0\right&amp;gt;$) to check the parities $Z_iZ_j$ to see if a bit flip has occurred.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, assuming no errors, checking $Z_2Z_3$:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The state after preparation, before verification is $\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;+\left|111\right&amp;gt;\right)\left|0\right&amp;gt;$&lt;/li&gt;&#xA;&lt;li&gt;After the first CNOT on the extra qubit: $\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;\left|0\right&amp;gt;+\left|111\right&amp;gt;\left|1\right&amp;gt;\right)$&lt;/li&gt;&#xA;&lt;li&gt;After the second CNOT: $\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;+\left|111\right&amp;gt;\right)\left|0\right&amp;gt;$&lt;/li&gt;&#xA;&lt;li&gt;The extra qubit is now measured and returns $0$, showing no bit flip has occurred. There is a possibility, with probability $\mathcal O\left(p^2\right)$ of two bit flips occurring, where the probability of a single error is $p$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Instead of the above, let's have a $Z$ error after the first CNOT. The state after this error (and before the second CNOT) is $\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;\left|0\right&amp;gt;-\left|111\right&amp;gt;\left|1\right&amp;gt;\right)$. Applying the second CNOT then gives $\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;-\left|111\right&amp;gt;\right)\left|0\right&amp;gt;$, which is the same as before, only now with a $Z$ error on the second ancilla qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A controlled-$M$ operation on the encoded data (in the state $\left|\psi\right&amp;gt; = \alpha\left|0_L\right&amp;gt; + \beta\left|1_L\right&amp;gt;$), putting the system in the state $\frac{1}{\sqrt{2}}I_1Z_2I_3\left(\left|000\right&amp;gt;\left|\psi\right&amp;gt;+\left|111\right&amp;gt;M\left|\psi\right&amp;gt;\right) = \frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;\left|\psi\right&amp;gt;-\left|111\right&amp;gt;M\left|\psi\right&amp;gt;\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The decoding operation (C-NOT-NOT, followed by $H_1$ on the ancilla qubits) is then performed. The decoding C-NOT-NOT gives the state $$\frac{1}{\sqrt{2}}\left(\left|000\right&amp;gt;\left|\psi\right&amp;gt;-\left|100\right&amp;gt;M\left|\psi\right&amp;gt;\right) = \frac{1}{\sqrt{2}}Z_1Z_2I_3\left(\left|000\right&amp;gt;\left|\psi\right&amp;gt;+\left|100\right&amp;gt;M\left|\psi\right&amp;gt;\right)$$ and the $Z$ error is now on the &lt;em&gt;first&lt;/em&gt; qubit, directly affecting the measurement result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it isn't necessarily clear that this is the case, it can be shown that $Z$ errors propagate 'backwards' through CNOT gates by starting with the state $\left|++\right&amp;gt; = \frac{1}{2}\left(\left|0\right&amp;gt;+\left|1\right&amp;gt;\right)\left(\left|0\right&amp;gt;+\left|1\right&amp;gt;\right)$ and applying a CNOT to return the same state. However, a $Z$ error on the second qubit returns the state $\left|--\right&amp;gt; = ZZ\left|++\right&amp;gt;$, showing the $Z$ error has propagated backwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;em&gt;this&lt;/em&gt; sense, a single &lt;em&gt;uncorrectable&lt;/em&gt; $Z$ error on an extra qubit eventually ends up causing $Z$ errors on multiple ancilla qubits (at a point where multiple $Z$ errors don't cancel) before the measurement and so, this part of the procedure is &lt;em&gt;not&lt;/em&gt; fault tolerant as an error on multiple qubits happens with probability $p$ and the probability of a successful measurement outcome is $1-p$, so the whole process has to be repeated multiple times to achieve a better measurement outcome.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-04-22T09:09:30.267" LastActivityDate="2018-04-22T09:09:30.267" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1867" PostTypeId="1" AcceptedAnswerId="1927" CreationDate="2018-04-22T09:14:27.913" Score="7" ViewCount="138" Body="&lt;p&gt;This question is inspired by &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1860/what-is-the-difference-between-a-qudit-system-with-d-4-and-a-two-qubit-system&quot;&gt;What is the difference between a qudit system with d=4 and a two-qubit system?&lt;/a&gt;&quot;, as an experimental follow-up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider for illustration these two particular cases:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1711.07216.pdf&quot; rel=&quot;noreferrer&quot;&gt;Molecular Spin Qudits for Quantum Algorithms&lt;/a&gt;, where in one important example a single d=4 qudit arises from a nuclear spin quadruplet I=3/2&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.nature.com/articles/ncomms11377&quot; rel=&quot;noreferrer&quot;&gt;A modular design of molecular qubits to implement universal quantum gates&lt;/a&gt;, where in one important example a two-qubit system arises from an electronic spin quadruplet S=3/2 (which in turn arises from a ferromagnetic coupling between two ideal electronic spin doublets)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In general I'm referring to experimental cases where in practice there is an always-on-but-sometimes-weak coupling between two two-state systems, producing a ground quadruplet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: in experiments such as these, are 2·qubit and d=4 qudit (a) strictly distinguishable beasts, or (b) theoretical idealizations which are more or less adequate depending on practical considerations? &lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="2224" LastEditDate="2019-06-11T01:44:06.500" LastActivityDate="2019-06-11T01:44:06.500" Title="In qubit/qudit terms, where is the experimental limit between S=3/2 and 2·S=1/2?" Tags="&lt;experiment&gt;&lt;terminology&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1868" PostTypeId="2" ParentId="1716" CreationDate="2018-04-22T15:03:14.547" Score="1" Body="&lt;p&gt;Miniaturizing switching or transistor technology needs to go hand in hand with quantum (transport and computing) theory.&#xA;I think that many challenging aspects (like for instance isotopically purifying silicon and donor implementation for &lt;a href=&quot;http://scholar.google.fr/scholar_url?url=http://docs.lib.purdue.edu/cgi/viewcontent.cgi%3Farticle%3D1853%26context%3Dnanopub&amp;amp;hl=de&amp;amp;sa=X&amp;amp;scisig=AAGBfm2QTZisLMSAiX5NRLQwYIbxoY5BZA&amp;amp;nossl=1&amp;amp;oi=scholarr&amp;amp;ved=0ahUKEwjHuYmaj87aAhXJOBQKHbf1CKkQgAMIMCgAMAA&quot; rel=&quot;nofollow noreferrer&quot;&gt;single atom transistors&lt;/a&gt;) are classical material science problems.&#xA;There is a recent review article on the strategies to develop beyond current CMOS transistor technology:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://www.nature.com/articles/s41567-018-0101-4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Beyond CMOS computing with spin and polarization&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, there is a lot of research on building qubits transistor-like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://www.nature.com/articles/ncomms13575&quot; rel=&quot;nofollow noreferrer&quot;&gt;A CMOS spin qubit&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a comment on recent advances in silicon quantum technology which is important for  quantum computing applications (&lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1708/1708.03530.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;CNOT gate&lt;/a&gt;, &lt;a href=&quot;https://qutech.nl/wp-content/uploads/2016/01/science.aar4054.full_.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;strong coupling&lt;/a&gt;) from this year 2018:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://science.sciencemag.org/content/359/6374/393&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toward a silicon-based quantum computer&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2094" LastActivityDate="2018-04-22T15:03:14.547" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1869" PostTypeId="1" CreationDate="2018-04-22T15:26:58.737" Score="4" ViewCount="180" Body="&lt;p&gt;$\newcommand{\qr}[1]{|#1\rangle}$Question.  Can you check whether this is correct?  Also, given the analysis below, what is the domain of and co-domain of $f(\qr{x})$?  I think it is $V^4 \to W^4 : f$ because &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\qr{00} = \qr{0}\otimes\qr{0} = \left[\begin{matrix}1\\0\\0\\0\end{matrix}\right].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analysis.  Let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\qr{x} = a_{00}\qr{00} + a_{01}\qr{01} + a_{10}\qr{10} + a_{11}\qr{11}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and let $U_f$ implement some constant or balanced function $f(x)$. Then I claim the following holds given the linear function nature of $U_f$.&#xA;\begin{align*}&#xA;  f(\qr{x}) &amp;amp;= U_f\qr{x}\\&#xA;  &amp;amp;= U_f(a_{00}\qr{00} + a_{01}\qr{01} + a_{10}\qr{10} + a_{11}\qr{11})\\&#xA;  &amp;amp;= U_f(a_{00}\qr{00}) + U_f(a_{01}\qr{01}) + U_f(a_{10}\qr{10}) + U_f(a_{11}\qr{11})\\&#xA;  &amp;amp;= a_{00}U_f(\qr{00}) + a_{01}U_f(\qr{01}) + a_{10}U_f(\qr{10}) + a_{11}U_f(\qr{11}),&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if $f$ is constant --- with $f(\qr{x}) = \qr{00}$ for all $\qr{x}$ ---, then we would have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  f(\qr{x}) &amp;amp;= a_{00}U_f(\qr{00}) + a_{01}U_f(\qr{01}) + a_{10}U_f(\qr{10}) + a_{11}U_f(\qr{11})\\&#xA;  &amp;amp;= a_{00}\qr{00} + a_{01}\qr{00} + a_{10}\qr{00} + a_{11}\qr{00}\\&#xA;  &amp;amp;= (a_{00} + a_{01} + a_{10} + a_{11})\qr{00}.&#xA;\end{align*}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, on the other hand, $f$ is balanced then with probability $1/2$, we have&#xA;\begin{align*}&#xA;  f(\qr{x}) &amp;amp;= a_{00}U_f(\qr{00}) + a_{01}U_f(\qr{01}) + a_{10}U_f(\qr{10}) + a_{11}U_f(\qr{11})\\&#xA;  &amp;amp;= (a_{00} + a_{01} + a_{10} + a_{11})\qr{00}&#xA;\end{align*}&#xA;and with probability $1/2$ as well&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align*}&#xA;  f(\qr{x}) &amp;amp;= a_{00}U_f(\qr{00}) + a_{01}U_f(\qr{01}) + a_{10}U_f(\qr{10}) + a_{11}U_f(\qr{11})\\&#xA;  &amp;amp;= (a_{00} + a_{01} + a_{10} + a_{11})\qr{11}.&#xA;\end{align*}&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2018-12-23T13:59:31.973" LastActivityDate="2018-12-23T13:59:31.973" Title="What can I deduce about $f(x)$ if $f$ is balanced or constant?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1870" PostTypeId="1" CreationDate="2018-04-22T15:43:42.417" Score="14" ViewCount="3987" Body="&lt;p&gt;In the Wikipedia article about &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state#Bell_state_correlations&quot; rel=&quot;noreferrer&quot;&gt;Bell states&lt;/a&gt; it is written:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Independent measurements made on two qubits that are entangled in Bell states positively correlate perfectly, if each qubit is measured in the &lt;em&gt;relevant basis&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does it even mean to perform a measurement in a certain basis? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can answer by using the example of the Bell states of the Wikipedia article.&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="55" LastEditDate="2021-02-14T18:51:41.407" LastActivityDate="2021-02-14T18:51:41.407" Title="What does &quot;measurement in a certain basis&quot; mean?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;terminology&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 3.0" />
  <row Id="1871" PostTypeId="2" ParentId="1870" CreationDate="2018-04-22T16:12:11.267" Score="6" Body="&lt;p&gt;Qubits are essentially quantum objects from which you can extract a bit. But there are different ways that this can be done, and the answer you get depends on the measurement you choose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you qubit is an electron spin, the measurement basis corresponds to measuring spin in a particular direction. We use that picture more generally in the form of the Bloch sphere. Measurement in this case corresponds to taking pair of opposing points on the sphere and making the qubit choose between then. Each possible pair of opposing points is referred to as a different measurement basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often with qubits, practical reasons in implementation mean that we can only actually measure in a single basis, known as the $Z$ or computational basis. To simulate the others we can precede our measurement with a certain single qubit rotation. The rotation we choose determines the basis we end up measuring in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given Bell state, and for a given measurement basis on one of the qubits, there exists a measurement basis for the second with with results will be perfectly correlated. This seems to be what the article is getting at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Bell states, measuring both qubits in the $Z$ basis will either end up with perfect correlation or perfect anti correlation, depending on which Bell state it is. If you get an anti correlation, you can change basis on one qubit by applying an $X$ rotation before the measurement. This new basis will get perfect correlations with the $Z$ basis measurement results for the other qubit.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-22T16:54:03.307" LastActivityDate="2018-04-22T16:54:03.307" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1872" PostTypeId="2" ParentId="1870" CreationDate="2018-04-22T16:37:27.460" Score="6" Body="&lt;p&gt;If you think of a electronic spin $S=1/2$, imagine measuring it on the z-axis to obtain $S_z=+1/2$ (or $S_z=-1/2$). This (the z projection of the spin magnetic moment) is a possible basis for the measurement. Or you could measure the spin on the x-axis, and they you will obtain $S_x=+1/2$ (or $S_x=-1/2$). This is a different basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurements on Bell pairs will correlate with each other when measured on non-orthogonal basis (if you measure one particle on z and the other on x, the results will be perfectly uncorrelated; if you measure both on z or both on x, the results will be perfectly correlated).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other examples of measurement bases would be polarization with photons: vertical vs horizontal is the linear polarization basis, whereas clockwise vs anticlockwise is the circular polarization basis.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-22T16:37:27.460" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1873" PostTypeId="5" CreationDate="2018-04-22T17:15:29.917" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-22T17:15:29.917" LastActivityDate="2018-04-22T17:15:29.917" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1874" PostTypeId="4" CreationDate="2018-04-22T17:15:29.917" Score="0" Body="For questions regarding design, development or theory of solid-state devices as relevant to quantum computers. May also be used for questions regarding solid state physics or chemistry, if they are relevant to quantum computing. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-03T07:26:18.707" LastActivityDate="2018-05-03T07:26:18.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1875" PostTypeId="1" AcceptedAnswerId="1876" CreationDate="2018-04-22T17:24:34.220" Score="15" ViewCount="745" Body="&lt;p&gt;I am currently reading &quot;Quantum Computation and Quantum Information&quot; by Nielsen and Chuang. In the section about Quantum Simulation, they give an illustrative example (section 4.7.3), which I don't quite understand:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we have the Hamiltonian &#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ H = Z_1 ⊗ Z_2 ⊗ \cdots ⊗ Z_n,\tag{4.113}$$&lt;/span&gt;&#xA;  which acts on an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$e^{-iH\Delta t}$&lt;/span&gt;, for arbitrary values of &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt;. A circuit doing precisely this, for &lt;span class=&quot;math-container&quot;&gt;$n = 3$&lt;/span&gt;, 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 &lt;em&gt;classical&lt;/em&gt; manner: the phase shift applied to the system is &lt;span class=&quot;math-container&quot;&gt;$e^{-i\Delta t}$&lt;/span&gt; if the &lt;em&gt;parity&lt;/em&gt; of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in the computational basis is even; otherwise, the phase shift should be &lt;span class=&quot;math-container&quot;&gt;$e^{i\Delta t}$&lt;/span&gt;. Thus, simple simulation of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OwE2r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OwE2r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;  Furthermore, extending the same procedure allows us to simulate more complicated extended Hamiltonians. Specifically, we can efficiently simulate any Hamiltonian of the form &lt;span class=&quot;math-container&quot;&gt;$$H = \bigotimes_{k=1}^n\sigma_{c\left(k\right)}^k,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\sigma_{c(k)}^k$&lt;/span&gt; is a Pauli matrix (or the identity) acting on the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;th qubit, with &lt;span class=&quot;math-container&quot;&gt;$c(k) \in \{0, 1, 2, 3\}$&lt;/span&gt; specifying one of &lt;span class=&quot;math-container&quot;&gt;$\{I, X, Y, Z\}$&lt;/span&gt;. The qubits upon which the identity operation is performed can be disregarded, and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; terms can be transformed by single qubit gates to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operations. This leaves us with Hamiltonian of the form of (4.113), which is simulated as described above.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can we obtain gate &lt;span class=&quot;math-container&quot;&gt;$e^{-i\Delta t Z}$&lt;/span&gt; from elementary gates (for example from Toffoli gates)?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="23" LastEditDate="2019-07-04T10:59:14.220" LastActivityDate="2019-07-04T10:59:14.220" Title="Obtaining gate $e^{-i\Delta t Z}$ from elementary gates" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1876" PostTypeId="2" ParentId="1875" CreationDate="2018-04-22T17:42:27.720" Score="9" Body="&lt;p&gt;One way order to perform Z rotations by arbitrary angles is to approximate them with a sequence of Hadamard and T gates. If you need the approximation to have maximum error $\epsilon$, there are known constructions that do this using roughly $3 \lg \frac{1}{\epsilon}$ T gates. See &lt;a href=&quot;https://arxiv.org/abs/1403.2975&quot; rel=&quot;noreferrer&quot;&gt;&quot;Optimal ancilla-free Clifford+T approximation of z-rotations&quot; by Ross et al&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best published way to approximate arbitrary Z rotations, &lt;a href=&quot;https://arxiv.org/abs/1404.5320&quot; rel=&quot;noreferrer&quot;&gt;repeat-until-success circuits&lt;/a&gt;, takes a slightly more complicated approach but achieves an average of roughly $9 + 1.2 \lg \frac{1}{\epsilon}$ T gates.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-04-22T17:42:27.720" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1877" PostTypeId="1" AcceptedAnswerId="1879" CreationDate="2018-04-22T18:06:45.973" Score="7" ViewCount="1461" Body="&lt;p&gt;I am currently reading &quot;Quantum Computation and Quantum Information&quot; by Nielsen and Chuang. In the section about Quantum Simulation, they give an illustrative example (section 4.7.3), which I don't quite understand:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we have the Hamiltonian &#xA;  $$ H = Z_1 ⊗ Z_2 ⊗ \cdots ⊗ Z_n, \tag{4.113}$$&#xA;  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 &lt;em&gt;classical&lt;/em&gt; manner: the phase shift applied to the system is $e^{-i\Delta t}$ if the &lt;em&gt;parity&lt;/em&gt; 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).&lt;a href=&quot;https://i.stack.imgur.com/OwE2r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OwE2r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;  Furthermore, extending the same procedure allows us to ismulate more complicated extended Hamiltonians. Speciffically, we can efficiently simulate any Hamiltonian of the form $$H = \bigotimes_{k=1}^n\sigma_{c\left(k\right)}^k,$$ where $\sigma_{c(k)}^k$ is a Pauli matrix (or the identity) acting on the $k$th qubit, with $c(k) \in \{0, 1, 2, 3\}$ specifying one of $\{I, X, Y, Z\}$. The qubits upon which the identity operation is performed can be disregarded, and $X$ or $Y$ terms can be transformed by single qubit gates to $Z$ operations. This leaves us with Hamiltonian of the form of (4.113), which is simulated as described above.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What do we mean by the &lt;em&gt;parity&lt;/em&gt; of the qubits here? Is it the number of qubits in the state $\lvert 1 \rangle$, and can it be even or odd?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="55" LastEditDate="2018-04-23T08:09:18.023" LastActivityDate="2018-04-23T08:09:18.023" Title="What do we mean by parity of qubits?" Tags="&lt;simulation&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1878" PostTypeId="2" ParentId="1877" CreationDate="2018-04-22T20:29:52.420" Score="0" Body="&lt;p&gt;Yes. This is just checked on the computational basis of all n-bit strings and you can see it does the right thing there. It is acting by $(e^{\pm i \Delta t})$ for the respective parities of basis vectors so it is the circuit you wanted by checking on the basis.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-04-22T20:29:52.420" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1879" PostTypeId="2" ParentId="1877" CreationDate="2018-04-22T20:32:02.493" Score="5" Body="&lt;p&gt;In the computational $\left(Z\right)$ basis, the parity of a (classical) bit string is $0$ if the number of $1$s in the string is even (i.e. 'even parity'), or $1$ if the number of $1$s in the string is odd (i.e. 'odd parity').&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parity can be measured by applying CNOT gates from each qubit that you want to measure (the control qubits) to an ancilla qubit (the target, initially in state $\left|0\right&amp;gt;$). Measuring the parity of a (classical) input state $\left|x_1x_2\ldots x_n\right&amp;gt;$, gives the output of the ancilla as $\left|\bigoplus_{k=1}^nx_k\right&amp;gt;$, which is $\left|0\right&amp;gt;$ for even parity and $\left|1\right&amp;gt;$ for odd parity, as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same process can be applied to quantum input states. As an example, calculating the parity of $\frac {1}{\sqrt{2}}\left(\left|00\right&amp;gt;+\left|11\right&amp;gt;\right)$, applying the CNOT gates gives the state of the overall system (including ancilla) as $\frac {1}{\sqrt{2}}\left(\left|00\right&amp;gt;+\left|11\right&amp;gt;\right)\left|0\right&amp;gt;$, which returns $0$, showing the input qubits have even parity. The converse of this is taking the input state as $\frac {1}{\sqrt{2}}\left(\left|01\right&amp;gt;+\left|10\right&amp;gt;\right)$, which gives the total state, after CNOTs, as $\frac {1}{\sqrt{2}}\left(\left|01\right&amp;gt;+\left|10\right&amp;gt;\right)\left|1\right&amp;gt;$, showing the input state has odd parity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows that the parity of a quantum state is analogous to the parity of a classical state.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-04-22T20:32:02.493" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1880" PostTypeId="1" CreationDate="2018-04-23T05:54:38.400" Score="5" ViewCount="102" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nitrogen-vacancy_center&quot; rel=&quot;noreferrer&quot;&gt;Nitrogen-Vacancy centers&lt;/a&gt; (NVs) have astonishing quantum properties, which make them interesting as potential hardware both for quantum computing in particular and for quantum technologies in general. In part this results from the center being protected by the diamond structure, which is at the same time very rigid and practically free from nuclear spins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, their properties change in unpractical ways with their proximity to the surface:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The closer they are to the surface, the better they interact with whatever is just beyond the surface. This is very important for quantum metrology but also in general for input/output in a quantum computing context, see for example &lt;a href=&quot;http://advances.sciencemag.org/content/3/8/e1701116&quot; rel=&quot;noreferrer&quot;&gt;A molecular quantum spin network controlled by a single qubit&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/1703.08248&quot; rel=&quot;noreferrer&quot;&gt;arXiv version&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;However, the closer the are to the surface, the more they are affected by all kinds of noise also just beyond the surface. This results from the fact that while the bulk is perfect diamond the surface is full of defects/impurities/rubbish.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is practical and is about &lt;strong&gt;cleaning and/or chemically modifying the diamond surface in order to passivate it&lt;/strong&gt;: up to which point has this been experimentally demonstrated? What is the current state of the art, how much can quantum coherence on NV centers be improved by a detailed control of the diamond surface?&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="55" LastEditDate="2020-09-04T09:31:02.770" LastActivityDate="2020-09-04T09:31:02.770" Title="Passive improving of nanodiamond surfaces for NV centers?" Tags="&lt;architecture&gt;&lt;experiment&gt;&lt;decoherence&gt;&lt;solid-state&gt;&lt;nv-centers&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1881" PostTypeId="1" CreationDate="2018-04-23T07:40:11.190" Score="8" ViewCount="173" Body="&lt;p&gt;In Kaye, Laflamme and Mosca (2007) pg106 they write the following (in the context of Simon's algorithm):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...where $S=\{\mathbf{0},\mathbf{s}\}$ is a $2$-dimensional vector space spanned by $\mathbf{s}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;this is not the only place I have seen this vector space referred to as &quot;2-dimensional&quot;. But surely the fact that it is only spanned by one vector, $\mathbf{s}$, means (by definition) that it is only &quot;1-dimensional&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I missing something here or is the use of the term &quot;dimension&quot; different in this area?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More Context&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned above the context is Simon's Algorithm. I.e. there exists a oracle $f:\{0,1\}^n\rightarrow \{0,1\}^n$ such that $f(x)=f(y)$ if and only if $x=y\oplus \mathbf{s}$ where $\mathbf{s}\in \{0,1\}^n$ and $\oplus$ is addition in $\Bbb{Z}_2^n$ (i.e. bit-wise). The aim of the algorithm is to find $\mathbf{s}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying a relevant circuit the output is a uniform distribution of $\mathbf{z}\in \{0,1\}^n$ such that $\mathbf{z}\cdot\mathbf{s}=z_1s_1+z_2s_2\cdots+ z_ns_n=0$. The statement I have quoted above is refering to the fact that since $\mathbf{0}$ and $\mathbf{s}$ are are solution to this problem you only need $n-1$  linearly independent vectors $\mathbf{z}$ to find $\mathbf{s}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term is also used in the same context at the end of Pg 4 of this &lt;a href=&quot;https://courses.cs.washington.edu/courses/cse599d/06wi/lecturenotes8.pdf&quot; rel=&quot;noreferrer&quot;&gt;pdf&lt;/a&gt; (&lt;a href=&quot;https://web.archive.org/web/20180420040038/https://courses.cs.washington.edu/courses/cse599d/06wi/lecturenotes8.pdf&quot; rel=&quot;noreferrer&quot;&gt;Wayback Machine version&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="124" LastEditDate="2018-09-07T15:11:01.937" LastActivityDate="2018-09-07T15:11:01.937" Title="Use of the term &quot;dimension&quot; in this description of Simon's algorithm?" Tags="&lt;terminology&gt;&lt;simons-algorithm&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1882" PostTypeId="2" ParentId="1869" CreationDate="2018-04-23T08:17:58.013" Score="2" Body="&lt;p&gt;$f$ being balanced does not mean that it gives one output with probability $0.5$ and the other output with probability $0.5$.&#xA;Instead, it means that half of the inputs are sent to one output and the other half to a different output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know what you are referring to in the notes you link, but $f$ is there defined as $f:\{0,1\}^n\mapsto\{0,1\}$, and if it is balanced then it will act for example as&#xA;$f(00)=f(01)=0$, $f(10)=f(11)=1$.&#xA;This is totally different from what you wrote, as you will get something like&#xA;$$|x\rangle\mapsto|f(x)\rangle=(a_{00}+a_{01})|0\rangle+(a_{10}+a_{11})|1\rangle.$$&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-04-23T08:17:58.013" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1883" PostTypeId="2" ParentId="1861" CreationDate="2018-04-23T08:36:12.950" Score="1" Body="&lt;p&gt;The whole point is that you do &lt;em&gt;not&lt;/em&gt; want, nor need, to &quot;&lt;em&gt;look&lt;/em&gt;&quot; how the computation is going.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can ensure that the input is what it should be by a variety of means. The simplest case being that you may simply trust that your apparatus, which you previously characterized very well, will produce what you ask it to produce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, you will know whether the input will evolve into a superposition of different states simply because you generally know what the evolution of the system looks like. Again, because you know what your computer is going to do: you built it for that purpose.&#xA;You will know that (for example) a specific sequence of entangling gates will be performed on the input, so that the state will evolve into a given superposition of states in the computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The crucial point here is that &lt;em&gt;you do not, and cannot, look at the state during the computation&lt;/em&gt;.&#xA;In other words, you have to think of the whole quantum algorithm/circuit as a black box: you built it so you (more or less) trust what it does, but after that you can just put an input and look at the resulting output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the output does indeed destroy the coherence of the state (that is, roughly speaking, its being in a superposition of different states), but this is not a problem because quantum algorithms are designed in such a way that the measurements performed on the output give the answer to the problem.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-04-23T08:36:12.950" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1884" PostTypeId="2" ParentId="1860" CreationDate="2018-04-23T08:44:37.240" Score="1" Body="&lt;p&gt;The only difference between a &quot;&lt;em&gt;pair of qubits&lt;/em&gt;&quot; and a single &quot;&lt;em&gt;four-dimensional qudit&lt;/em&gt;&quot; is that when you say you have &quot;&lt;em&gt;two qubits&lt;/em&gt;&quot; you are implicitly making some assumptions on the kind of operations you can perform on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, it only makes sense to talk of two qubits if they can be treated as two different systems, or, in other words, if it is possible to act locally on them. Similarly, the kinds of operations that one can assume to be able to perform on two qubits are different than those on qudits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a practical point of view, the difference is that one tends to consider different operations as &quot;easily available&quot; when talking of sets of qubits rather than (sets of) qudits.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-09-11T10:02:40.787" LastActivityDate="2018-09-11T10:02:40.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1885" PostTypeId="1" AcceptedAnswerId="1888" CreationDate="2018-04-23T10:17:42.513" Score="46" ViewCount="10986" Body="&lt;p&gt;Preskill introduced recently this term, see for example &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing in the NISQ era and beyond (arXiv)&lt;/a&gt;. I think the term (and the concept behind it) is of sufficient importance that it deserves to be explained here in a pedagogical manner. Probably it actually merits more than one question, but the first one needs to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are Noisy Intermediate-Scale Quantum (NISQ) technologies?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2019-01-01T10:15:14.287" LastActivityDate="2020-02-11T14:47:45.477" Title="What is meant by &quot;Noisy Intermediate-Scale Quantum&quot; (NISQ) technology?" Tags="&lt;terminology&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="15" ContentLicense="CC BY-SA 3.0" />
  <row Id="1886" PostTypeId="2" ParentId="1870" CreationDate="2018-04-23T11:20:20.010" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does it even mean to perform a measurement in a certain basis?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is very close to a measurement of a certain observable. In quantum mechanics, when we talk about measuring an observable, we usually are primarily interested in an eigenvalue as an outcome of the measurement. In quantum information, we don't care about the eigenvalues; we are solely interested in a state after the measurement, and this state can be interpreted as an eigenvector of an observable being measured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, for any &quot;measurement in a certain basis&quot; there exists many observables that correspond to the same measurement (not all of them have physical meaning); all these observables have the same eigenvectors (which form the measurement basis) but may differ in eigenvalues. Eigenvalues don't matter provided they are different, so the measurement distinguishes between the eigenvectors (measurement basis states).&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2018-04-23T11:20:20.010" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1887" PostTypeId="1" AcceptedAnswerId="1936" CreationDate="2018-04-23T13:05:09.393" Score="5" ViewCount="133" Body="&lt;p&gt;My question is a continuation from the previous question:&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1648/is-quantum-biocomputing-ahead-of-us&quot;&gt;Is Quantum Biocomputing ahead of us?&lt;/a&gt;. Considering that there exist many biological processes with a quantum nature present (Photosynthesis, Electron transport chain, etc). And, since this biological quantum processes are quite optimal in terms of efficiency and yield:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if these could be mimicked by engineers/scientists to improve the actual possibilities in quantum computation. Let me explain a bit deeper my question: Nature is extremely efficient. Especially intracellular processes are well optimized in both time and space this, with their high yield, can be studied in order to check the properties/structural features that contribute to such efficiency. Please note that I am not suggesting or asking about the possibility of using directly biological molecules or processes but to try to extract what makes them ultra-efficient and used such knowledge in the design of particular architectures.&#xA;My question is related to this, is that an actual field of research? are we now dealing with the 'natural quantum processes imitation'?&lt;/p&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="26" LastEditDate="2018-12-13T19:48:01.197" LastActivityDate="2018-12-13T19:48:01.197" Title="Can biological quantum processes be used to guide optimized quantum algorithms?" Tags="&lt;algorithm&gt;&lt;biology&gt;&lt;biocomputing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1888" PostTypeId="2" ParentId="1885" CreationDate="2018-04-23T13:05:18.190" Score="41" Body="&lt;p&gt;When we talk about quantum computers, we usually mean fault-tolerant devices. These will be able to run Shor's algorithm for factoring, as well as all the other algorithms that have been developed over the years. But the power comes at a cost: to solve a factoring problem that is not feasible for a classical computer, we will require &lt;a href=&quot;https://arxiv.org/abs/1605.07197&quot; rel=&quot;noreferrer&quot;&gt;millions of qubits&lt;/a&gt;. This overhead is required for error correction, since most algorithms we know are extremely sensitive to noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even so, programs run on devices beyond 50 qubits in size quickly become extremely difficult to simulate on classical computers. This opens the possibility that devices of this sort of size might be used to perform the first demonstration of a quantum computer doing something that is infeasible for a classical one. It will likely be a highly abstract task, and not useful for any practical purpose, but it will nevertheless be a proof-of-principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once this is done, we'll be in a strange era. We'll know that devices can do things that classical computers can't, but they won't be big enough to provide fault-tolerant implementations of the algorithms we know about. Preskill coined the term '&lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;noreferrer&quot;&gt;Noisy Intermediate-Scale Quantum&lt;/a&gt;' to describe this era. Noisy because we don't have enough qubits to spare for error correction, and so we'll need to directly use the imperfect qubits at the physical layer. And 'Intermediate-Scale' because of their small (but not too small) qubit number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what applications might devices in NISQ era have? And how will we design the quantum software to implement them? These are questions that are far from being fully answered, and will likely require quite different techniques than those for fault-tolerant quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-08-16T08:11:59.490" LastActivityDate="2019-08-16T08:11:59.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1889" PostTypeId="1" CreationDate="2018-04-23T14:22:21.420" Score="7" ViewCount="336" Body="&lt;p&gt;The representation of bits in different technological areas: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Normal digital bits are mere abstractions of the underlying electric current through wires. Different standards, like CMOS or TTL, assign different thresholds to such signals: &quot;if the voltage goes above this level, then the bit is 1; if it goes below this level, then the bit is 0; discard in any other case&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In genetics, we usually consider a signal as a 1 if it is &quot;enough&quot; to trigger the target response; 0 otherwise. In this scenario, the thresholding is qualitative. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From the point of view of quantum information, qubits also abstractions, but in practice measurements will need standards to be comparable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: From the point of view of quantum engineering, is there any standard technique/method to identify their value e.g. based on &lt;strong&gt;&lt;a href=&quot;https://www.nature.com/articles/lsa2016144&quot; rel=&quot;noreferrer&quot;&gt;detection thresholds&lt;/a&gt;&lt;/strong&gt; or fidelity verification like &lt;a href=&quot;https://www.nature.com/articles/35057215&quot; rel=&quot;noreferrer&quot;&gt;Bell inequalities violation&lt;/a&gt;? Are there units for that hidden signals?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The best possible answer would probably contain specific details for different architectures (e.g. superconductors vs photons) or contexts (e.g. quantum computing vs quantum communications).&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1894" LastEditorUserId="1847" LastEditDate="2018-04-27T16:51:03.783" LastActivityDate="2018-07-13T15:34:33.587" Title="Are there measuring standards (and units) for the identification of qubits?" Tags="&lt;physical-qubit&gt;&lt;quantum-state&gt;&lt;technical-standards&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1890" PostTypeId="1" AcceptedAnswerId="1891" CreationDate="2018-04-23T14:33:21.520" Score="10" ViewCount="1364" Body="&lt;p&gt;In general, a qubit is mathematically represented as a quantum state of the form $\lvert \psi\rangle = \alpha \lvert 0\rangle + \beta \lvert 1\rangle$, using the  basis $\{ \lvert 0\rangle,  \lvert 1\rangle \}$. It seems to me that a qubit is just a term used in quantum computing and information to denote a quantum state (i.e. a vector) of a system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any fundamental difference between a qubit and a quantum state? What's more to a qubit than the quantum state it represents?&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="1847" LastEditDate="2018-04-24T07:34:22.280" LastActivityDate="2018-04-24T07:34:22.280" Title="What is the difference between a qubit and a quantum state?" Tags="&lt;physical-qubit&gt;&lt;terminology&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1891" PostTypeId="2" ParentId="1890" CreationDate="2018-04-23T15:07:36.033" Score="13" Body="&lt;p&gt;There are a few things to distinguish here, which are often conflated by experts because we're using these terms quickly and informally to convey intuitions rather than in the way that would be most transparent to novices.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A &quot;qubit&quot; can refer to a small system, which &lt;em&gt;has&lt;/em&gt; a quantum mechanical state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The states of a quantum mechanical system form a vector space. Most&#xA;of these states can only be distinguished from each other only&#xA;imperfectly, in that there is a chance of mistaking one state for the&#xA;other, no matter how cleverly you try to distinguish them. One may then ask the question, of a set of states, whether they are all perfectly distinguishable from one another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;qubit&quot; is an example of a quantum mechanical system, for which the largest number of perfectly distinguishable states is two. (There are many different sets of perfectly distinguishable states; but each such set contains only two elements.) These may be&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the polarisation of a photon ($\lvert \mathrm H \rangle$ versus $\lvert \mathrm V \rangle$, or $\lvert \circlearrowleft \rangle$ versus $\lvert \circlearrowright \rangle$);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;or the spin of an electron ($\lvert \uparrow \rangle$ versus $\lvert&#xA;   \downarrow \rangle$, or $\lvert \rightarrow \rangle$ versus $\lvert&#xA;   \leftarrow \rangle$);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;or two energy levels $\lvert E_1 \rangle$ and $\lvert E_2 \rangle$ of an electron in an ion, which may occupy many different energy levels but which is being controlled in such a way that the electron stays within the subspace defined by these energy levels when it isn't being acted on.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Common to these systems is that one can describe their states in terms of two states, which we might label as $\lvert 0 \rangle$ and $\lvert 1 \rangle$, and consider the other states of the system (which are vectors in the vector space spanned by $\lvert 0 \rangle$ and $\lvert 1 \rangle$) using linear combinations taking the form $\alpha \lvert 0 \rangle + \beta \lvert 1 \rangle$, where $\lvert \alpha \rvert^2 + \lvert \beta \rvert^2 = 1$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A &quot;qubit&quot; can also refer to the quantum mechanical state &lt;em&gt;of&lt;/em&gt; a physical system of the sort we've described above. That is, we may call  some state of the form $\alpha \lvert 0 \rangle + \beta \lvert 1 \rangle$ &quot;a qubit&quot;. In this case we are not considering what physical system is storing that state; we are interested only in the form of the state.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;A qubit&quot; can also refer to &lt;em&gt;an amount of information&lt;/em&gt; which is equivalent to a state such as $\alpha \lvert 0 \rangle + \beta \lvert 1 \rangle$. For instance, if we know two states $\lvert \psi_0 \rangle$ and $\lvert \psi_1 \rangle$ of some complicated quantum system, and we have some physical system whose state $\lvert \Psi \rangle$ is in some superposition $\alpha \lvert \psi_0 \rangle + \beta \lvert \psi_1 \rangle$, then it doesn't matter how complicated the system is or whether either of the states $\lvert \psi_j \rangle$ have any entanglement: the amount of information expressed by the possible values of $\lvert \Psi \rangle$ is one qubit, because with a clever enough noiseless procedure, you could reversibly encode that complicated quantum state into the state of a (physical system) qubit. Similarly, you can have a very large quantum system which encodes $n$ qubits of information, if you could reversibly encode the state of that complicated system as the state of $n$ qubits.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This may seem confusing, but it's no different from what we do all the time with classical computation.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If in a C-like language I write &lt;code&gt;int x = 5;&lt;/code&gt; you probably understand that &lt;code&gt;x&lt;/code&gt; is an integer (an integer &lt;em&gt;variable&lt;/em&gt; that is), which stores an integer &lt;code&gt;5&lt;/code&gt; (an integer &lt;em&gt;value&lt;/em&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I then write &lt;code&gt;x = 7;&lt;/code&gt; I don't mean that &lt;code&gt;x&lt;/code&gt; is an integer which is equal to both &lt;code&gt;5&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt;, but rather that &lt;code&gt;x&lt;/code&gt; is a container of sorts and that what we are doing is changing what it contains.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;And so forth &amp;mdash; these ways in which we use the term 'qubit' are just the same as how we use the term 'bit', only it so happens that we use the term for quantum states instead of for values, and for small physical systems rather than variables or registers. (Or rather: the quantum states &lt;em&gt;are&lt;/em&gt; the values in quantum computation, and the small physical systems &lt;em&gt;are&lt;/em&gt; the variables / registers.)&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-23T15:07:36.033" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1892" PostTypeId="2" ParentId="1860" CreationDate="2018-04-23T18:02:30.083" Score="2" Body="&lt;p&gt;There is also a difference if you consider experiments or implementations. To make a physical qubit, I need to use a two-level quantum system. Qudits than require a more complicated quantum system, e.g., with four levels for a d=4 qudit. The engineering justification for using the more complicated system would be that you than require fewer of the four-level systems.&lt;/p&gt;&#xA;" OwnerUserId="2139" LastActivityDate="2018-04-23T18:02:30.083" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1894" PostTypeId="1" AcceptedAnswerId="1897" CreationDate="2018-04-23T20:07:53.377" Score="4" ViewCount="186" Body="&lt;p&gt;Let me start the question with two examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I am reading Nielsen &amp;amp; Chuang section &quot;8.3.3 Bit flip and phase flip channels&quot;. There is a description of a quantum operation&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\rho \to \mathcal{E}(\rho) = P_0 \rho P_0 + P_1 \rho P_1$, where $P_0 = |0 \rangle \langle 0|$, $P_1 = |1 \rangle \langle 1|$, which corresponds to a measurement of the qubit in the $|0 \rangle$, $|1 \rangle$ basis, with &lt;em&gt;the result of the measurement unknown.&lt;/em&gt; [Italics is mine - A.P.]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Second, in the edX course &quot;&lt;a href=&quot;https://www.edx.org/course/quantum-information-science-i-part-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Science I, Part 3&lt;/a&gt;&quot; there is a question that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After quantum measurement &amp;lt;...&gt;, &lt;em&gt;if the measurement result is known,&lt;/em&gt; &amp;lt;...&gt;. [Italics is mine - A.P.]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, I do not understand what does that mean for a result of a measurement to be known/unknown? Moreover, how could that knowledge or an absense of knowledge further affect the quantum system once the measurement is performed? Would anything change in the examples if we replace &quot;known&quot; with &quot;unknown&quot; and vice versa? Is there a mathematical formalism for the &quot;is known/unknown&quot; expression?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe, the source of my confusion comes from the Schrödinger's cat paradox solution. My understanding is that the cat is strictly alive or dead once the &quot;measurement&quot; by a detector happens, regardless of whether we know the fact (i.e., result of the &quot;measurement&quot;) or not. That is a knowledge of an experimenter, and it has no relation to the &quot;measurement&quot;.&lt;/p&gt;&#xA;" OwnerUserId="528" LastEditorUserId="2175" LastEditDate="2018-04-24T07:44:32.007" LastActivityDate="2018-04-24T07:44:32.007" Title="What does it mean for a result of a measurement to be known/unknown?" Tags="&lt;terminology&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1895" PostTypeId="1" AcceptedAnswerId="1902" CreationDate="2018-04-23T20:55:01.630" Score="7" ViewCount="508" Body="&lt;p&gt;Suppose we have two states of a system where I tell you that there is a probability $p_1$ of being in state $1$, and probability $p_2$ of being in state $2$. The total state can be written as a vector in $L^1$ normed space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p=\begin{pmatrix}p_1 \\ p_2 \end{pmatrix}, ||p||=p_1+p_2=1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we define a transition matrix for a Markov process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$T=\begin{pmatrix}t_{11}&amp;amp;t_{12} \\ t_{21}&amp;amp;t_{22}\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the next state would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p'=Tp=\begin{pmatrix}t_{11}p_1+t_{12}p_2 \\ t_{21}p_1+t_{22}p_2\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my understanding of density matrices and quantum mechanics is that it should contain classical probability theory in addition to strictly quantum phenomena.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical probabilities in the density matrix formalism are mapped as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p=\begin{pmatrix}p_1 \\ p_2 \end{pmatrix} \rightarrow \rho=\begin{pmatrix}p_1&amp;amp;0 \\ 0&amp;amp;p_2 \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I want to obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$p'=\begin{pmatrix}t_{11}p_1+t_{12}p_2 \\ t_{21}p_1+t_{22}p_2\end{pmatrix} \rightarrow \rho'=\begin{pmatrix}t_{11}p_1+t_{12}p_2&amp;amp;0 \\ 0&amp;amp;t_{21}p_1+t_{22}p_2\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My attempt:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define an operator $U$ such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rho'=U\rho U^\dagger$$&#xA;$$\implies \begin{pmatrix}t_{11}p_1+t_{12}p_2&amp;amp;0 \\ 0&amp;amp;t_{21}p_1+t_{22}p_2\end{pmatrix}=\begin{pmatrix}u_{11}&amp;amp;u_{12} \\ u_{21}&amp;amp;u_{22}\end{pmatrix}\begin{pmatrix}p_1&amp;amp;0 \\ 0&amp;amp;p_2\end{pmatrix}\begin{pmatrix}u_{11}^*&amp;amp;u_{21}^* \\ u_{12}^*&amp;amp;u_{22}^*\end{pmatrix}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$=\begin{pmatrix}|u_{11}|^2p_1+|u_{12}|^2p_2&amp;amp;u_{11}u_{21}^*p_1+u_{12}u_{22}^*p_2 \\ &#xA;u_{21}u_{11}^*p_1+u_{12}^*u_{22}p_2 &amp;amp; |u_{21}|^2p_1+|u_{22}|^2p_2  \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evidently, $|u_{ij}|^2=t_{ij}$, but the off diagonal terms aren't easily made zero, (I've wrestled with the algebra and applied all the proper normalizations of probability theory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be the correct way to apply a Markov process in the density matrix formalism? It seems really basic and something that this formalism should be able to naturally handle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Repost of : &lt;a href=&quot;https://physics.stackexchange.com/questions/401665/markov-chain-expressed-in-density-matrix-formalism?noredirect=1#comment900292_401665&quot;&gt;repost&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2160" LastEditorUserId="26" LastEditDate="2018-12-23T12:24:45.803" LastActivityDate="2018-12-23T12:24:45.803" Title="Markov Chain expressed in Density Matrix formalism" Tags="&lt;entanglement&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1896" PostTypeId="2" ParentId="1895" CreationDate="2018-04-23T22:09:30.097" Score="5" Body="&lt;p&gt;The most general quantum evolution is a completely positive (CP) map:&#xA;$$&#xA;\rho\mapsto \mathcal E(\rho) = \sum_i M_i\rho M_i^\dagger \ .&#xA;$$&#xA;Here, &#xA;$$&#xA;M_1=\left(\begin{matrix}\sqrt{t_{11}}&amp;amp;0\\0&amp;amp;0\end{matrix}\right)\,, \&#xA;M_2=\left(\begin{matrix}0&amp;amp;0\\\sqrt{t_{21}}&amp;amp;0\end{matrix}\right)\quad&#xA;$$&#xA;$$&#xA;M_3=\left(\begin{matrix}0&amp;amp;\sqrt{t_{12}}\\0&amp;amp;0&#xA;\end{matrix}\right)\,,\ &#xA;M_4=\left(\begin{matrix}0&amp;amp;0\\0&amp;amp;\sqrt{t_{22}}&#xA;\end{matrix}\right)\ .&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-04-24T11:48:27.167" LastActivityDate="2018-04-24T11:48:27.167" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1897" PostTypeId="2" ParentId="1894" CreationDate="2018-04-24T01:33:13.593" Score="4" Body="&lt;p&gt;Forget about quantum mechanics for a second and consider two people predicting a coin flip. Alice flips a coin, covers it with her hand, and asks Bob to predict the result. Alice knows the coin is heads, but Bob is unsure if it is heads or tails. They will describe the state of the coin using different probability distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same situation can apply to quantum systems. Alice may know the state of the system, while Bob is unsure. When this happens, they each will describe the situation using a different &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;density matrix&lt;/a&gt;: &lt;em&gt;the matrix formalism that is used to describe a quantum system in a mixed state, meaning a statistical ensemble of several quantum states&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(On the other hand, if they describe the same system using different &lt;em&gt;superpositions&lt;/em&gt;, that's bad. At least one of them is objectively wrong. Similarly, if Alice says a die roll was definitely 100% five, and Bob says the die roll was definitely 100% six, at least one of them is dead wrong.)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;how could that knowledge or an absense of knowledge further affect the quantum system once the measurement is performed?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It doesn't affect the system, it determines your ability to accurately describe the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose I have a qubit in the state $\frac{3}{5} |0\rangle + \frac{4}{5}|1\rangle$. I measure the state. I tell you all this, but don't tell you what the measurement outcome was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're asked to predict the state of the system, the best you can do is bet 36% odds on $|0\rangle$ and 64% odds on $|1\rangle$. And a succinct way to describe your knowledge about the system is the density matrix $0.36 |0\rangle \langle 0| + 0.64 |1\rangle \langle 1| = \begin{bmatrix} 0.36 &amp;amp; 0 \\ 0 &amp;amp; 0.64\end{bmatrix}$. By contrast, I know the measurement result. It happens to have been $|1\rangle$. So the density matrix describing &lt;em&gt;my&lt;/em&gt; knowledge is $|1\rangle \langle 1| = \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Would anything change in the examples if we replace &quot;known&quot; with &quot;unknown&quot; and vice versa?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you perform the same operations to multiple systems in the state $|\psi\rangle$, their outputs will be identically distributed regardless of which ones you knew started in the state $|\psi\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, your ability to do useful tasks with a quantum system often depends on knowing what state that system is in. In that sense it does matter if you know the state or not. For example, it's pretty hard to do magic state distillation if you keep forgetting whether or not you already did the distillation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Is there a mathematical formalism for the &quot;is known/unknown&quot; expression?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. Density matrices.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-04-24T04:04:20.187" LastActivityDate="2018-04-24T04:04:20.187" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1898" PostTypeId="2" ParentId="1894" CreationDate="2018-04-24T04:39:15.040" Score="2" Body="&lt;p&gt;Suppose you have a qubit in a state $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$. For simplicity let us assume $\alpha$ and $\beta$ are real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, the state can be described by density matrix&#xA;$$\rho=|\psi\rangle\langle\psi|=\begin{pmatrix}&#xA;\alpha^2 &amp;amp; \alpha\beta \\&#xA;\alpha\beta &amp;amp; \beta^2&#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we measure the qubit in the standard basis but don't look an the measurement outcome, the qubit's state after measurement is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rho_{out}=\begin{pmatrix}&#xA;\alpha^2 &amp;amp; 0 \\&#xA;0 &amp;amp; \beta^2&#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(measurement killed off-diagonal terms, and now it is a mixed state)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we looked at the outcome of the measurement and found that the outcome is $|0\rangle$ state, then the qubit's state after measurement is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rho_{out,0}=\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relation between $\rho_{out}$ and $\rho_{out,i}$ is the same as relation between unconditional and conditional probabilities studied in probability theory,&#xA;$$\rho_{out}=\alpha^2 \rho_{out,0}+\beta^2 \rho_{out,1}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as explained in Craig's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the cat - yes, the cat is strictly dead or alive after the box is opened (cat is measured), but we don't know it before we looked into the box. This is purely classical situation, well known in probability theory.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-04-24T07:30:00.773" LastActivityDate="2018-04-24T07:30:00.773" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1899" PostTypeId="1" CreationDate="2018-04-24T05:47:24.780" Score="9" ViewCount="277" Body="&lt;p&gt;Predicting the energy of molecules to high accuracy during the course of a chemical reaction, which in turn allows us to predict reaction rates, equilibrium geometries, transition states among others is a Quantum Chemical problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum Computing could help Quantum Chemistry by solving the Schrodinger equation for large systems. An example of a problem that is intractable but has applications to Quantum Chemistry is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hartree%E2%80%93Fock_method&quot; rel=&quot;noreferrer&quot;&gt;Hartree-Fock method&lt;/a&gt;, a  method to approximate the wave function and energy of a quantum many-body system (in stationary state). This problem is known to be &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-completeness&quot; rel=&quot;noreferrer&quot;&gt;NP-complete&lt;/a&gt; (see &lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.4903453&quot; rel=&quot;noreferrer&quot;&gt;On the NP-completeness of the Hartree-Fock method for translationally invariant systems&lt;/a&gt;). Other examples of Quantum Computation to Quantum chemistry are 2-local-Hamiltonians (QMA-complete), Fermionic Local Hamiltonian (QMA-hard). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum Computing could give yes/no answers to questions to specific problems such as showing certain molecules have dipole moment. Also, NMR, Trapped Ions, and Superconducting qubits could be used to to simulate such chemical systems too. Noise being, a factor approaches such as &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;noreferrer&quot;&gt; NISQ &lt;/a&gt; could play a part in simulating quantum chemical systems. What Quantum Computing approaches have been successful to solving Quantum chemistry problems such as predicting reaction rates, transition rates (or even show promise)? &lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="429" LastEditDate="2018-04-24T22:11:09.190" LastActivityDate="2018-05-02T05:53:49.913" Title="Quantum Chemistry and Quantum Computing" Tags="&lt;algorithm&gt;&lt;qma&gt;&lt;chemistry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1900" PostTypeId="2" ParentId="1881" CreationDate="2018-04-24T06:29:23.793" Score="2" Body="&lt;p&gt;In order to represent a '$\mathbf 0$' state as a vector in a Hilbert space, the '$\mathbf 0$' vector must in fact be non-zero. Thus, the label '$\mathbf 0$' is &lt;em&gt;just a label&lt;/em&gt; for some designated vector (of norm 1) in our computational basis. This is obviously an abuse of notation, but it is a fairly common one. The more usual (and less confusing) notation would be $\left|0\right&amp;gt;$. This notation is even used on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki page about qubits&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building this up from the ground: we have $n$ 2-dimensional vector spaces $V_i$, and we designate basis elements $\left| 0_i \right&amp;gt;$ and $\left| 1_i \right&amp;gt;$ in these vector spaces. Both these elements have norm 1. We then form the $2^n$ dimensional vector space $V = \bigotimes_{i=1}^n V_i$. We can designate a computational basis $\left| b_1 b_2 \ldots b_n \right&amp;gt;$ with $b_1,\ldots,b_n \in \{0,1\}$ for $V$. Within $V$ there are two vectors of interest: $\mathbf 0 = \left|00\ldots0\right&amp;gt;$ and $\mathbf s = \left| s_1 s_2 \ldots s_n \right&amp;gt;$, with $s_1, \ldots, s_n$ the bits of $s$. The vector space $S = \mathbf{\text{span}} \{\mathbf 0, \mathbf s\} \subset V$ is trivially 2-dimensional.&lt;/p&gt;&#xA;" OwnerUserId="2182" LastEditorUserId="2182" LastEditDate="2018-04-24T06:35:55.513" LastActivityDate="2018-04-24T06:35:55.513" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1901" PostTypeId="2" ParentId="1895" CreationDate="2018-04-24T07:58:48.970" Score="2" Body="&lt;p&gt;As mentioned by Norbert Schuch, the most general quantum operation (i.e. preserving quantum mechanical interpretation) is completely positive and trace-preserving map (CPTP). You can find more on this subject in the field of open quantum systems (these maps carry information on the interaction with the environment) - see the book: H-P. Breuer, F. Petruccione &quot;&lt;a href=&quot;http://isfr-quantum.ir/KhabarFile/Breuer.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The theory of Open quantum systems&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One reason why it's not easy (only in special cases) to express your stochastic process as unitary transformation is that the transition matrix needs not be invertible (and if it is, it is not necessarily stochastic matrix), while unitaries are always invertible and describe the legitimate quantum transformation. &lt;/p&gt;&#xA;" OwnerUserId="563" LastEditorUserId="1847" LastEditDate="2018-04-24T10:40:39.657" LastActivityDate="2018-04-24T10:40:39.657" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1902" PostTypeId="2" ParentId="1895" CreationDate="2018-04-24T08:29:59.207" Score="4" Body="&lt;p&gt;The easiest way to get rid of off diagonal elements is to measure. You could then apply some post-measurement unitaries which depend on the result, as well as some classical randomness. Clearly you need more than just a unitary to apply such a process. Instead you'll need a more general CP map, as mentioned by the other answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am going to assume that $t_{11}+t_{12}=t_{21}+t_{22}=1$ in what follows, so that the Markov process is also trace preserving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you measure in the $\{|1\rangle, |2\rangle\}$ basis, but don't look at the result. The state is then described by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P_1 \, \rho \, P_1 + P_2 \, \rho \, P_2.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's consider a different process. Suppose you applied a random process that flipped the states with probability $t_{xy}$, and did nothing with probability $t_{xx}$. The state is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;t_{xx} \, \rho  + t_{xy} \, X  \,\rho \, X&#xA;$$&#xA;where here I use $X$ to denote the unitary that performs the flip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want is the process that combines the two. First measure, and then apply the random flip with probabilities that depend on the results. The map you need is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;t_{11} \, P_1 \rho P_1 + t_{12} \, X  P_1 \, \rho P_1 \, X \,+ t_{22} \, P_2 \rho P_2  + t_{21} \, X  \, P_2 \rho P_2 \, X \, .&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be expressed as as the CPTP map&#xA;$$&#xA;\rho\mapsto \mathcal E(\rho) = \sum_i M_i\rho M_i^\dagger \ .&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $M_{11} = \sqrt{t_{11}} P_1$, $M_{12} = \sqrt{t_{12}} X P_1$, $M_{22} = \sqrt{t_{22}} P_2$ and $M_{21} = \sqrt{t_{21}} X P_2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this expression is not unique. The interpretation of how to do it is not unique either. Measurements are not necessarily required, but it can never be as simple as just a unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see why, note that your Markov process changes the value of $\rm{tr}(\rho^2)$. This cannot be done by a single qubit unitary, because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ (U \rho U^{\dagger})^2 = U \rho U^{\dagger} U \rho U^{\dagger} = U \rho^2 U^{\dagger},$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the trace is unitary invariant. A process that changes this value requires either measurement, or interaction with an external system.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-04-24T14:30:55.063" LastActivityDate="2018-04-24T14:30:55.063" CommentCount="4" ContentLicense="CC BY-SA 3.0" />
  <row Id="1903" PostTypeId="2" ParentId="1860" CreationDate="2018-04-24T09:15:59.253" Score="5" Body="&lt;p&gt;A fundamental difference between the two kinds of systems is that a two-qubit system can actually be in an entangled state. On the other hand, a single d=4 dimensional system does not possess entanglement, since entanglement is always defined with respect to more than one party. Consequently, for the purposes of quantum protocols that exploit entanglement as a resource, a two-qubit system and a single 4-dimensional quantum system are very different. &lt;/p&gt;&#xA;" OwnerUserId="2186" LastEditorUserId="2186" LastEditDate="2018-04-25T12:33:00.680" LastActivityDate="2018-04-25T12:33:00.680" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1904" PostTypeId="2" ParentId="1889" CreationDate="2018-04-24T10:20:46.423" Score="3" Body="&lt;p&gt;It seems to me that, from the point of view of quantum engineering, we are a few years away from being at the point of fixing standards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standards are a good way to ensure the reproducibility of the behaviour of a piece of information technology, and the interoperability of the functionality of multiple pieces of information technology. It is clear that at some point we will require such standards. The question is: how would one begin to formulate those standards?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Before we ensure the reproducibility of a piece of quantum technology, we should build a piece of quantum technology whose behaviour &lt;em&gt;we want&lt;/em&gt; to reproduce, rather than immediately set out to improve upon. With perhaps one exception, I expect that almost everyone in the quantum technologies game are more interested in bettering their own designs &amp;mdash; possibly involving significant revisions to any design parameters which could play the role of standards &amp;mdash; rather than setting down parameters which they expect that everyone will be happy to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conceivably D-WAVE is at this stage &amp;mdash; obviously they would also like&#xA;to improve upon their existing technology (as for instance do&#xA;conventional chip manufacturers), but my understanding is that they are in the business of making $\,N&amp;gt;1\,$ computers of a given model whose behaviour is intended to achieve a certain, well, 'standard'. Whatever the computational power of their machines, it seems that they are in the business of engineering complex systems with multiple components, and doing so in a reproducible manner. So it seems very likely that they have standards for their qubits: but it is not clear that anyone apart from them will be interested in conforming to those standards (rather than building more versatile quantum computers for instance), or to what extent D-WAVE's standards are publicly available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another incipient exception is in the field of optics, where the inclination is very strong to use the existing materials technology of fibre optic cables: while there is no formal standard likely exists, a practical standard of using wavelengths of light which have very low attenuation in modern-day optical fibre is one that could be comfortably predicted to continue for the foreseeable future.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given this situation for individual approaches to quantum technologies, the question of interoperation is even more premature. No-one knows what their equipment is going to be interoperating &lt;em&gt;with&lt;/em&gt; &amp;mdash; again, with the probable exception of fibre-optic cable, and perhaps the mains frequency of your electrical grid if this is somehow important to take into account.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But ask the question again in five or ten years (more likely ten), and you may get a more interesting answer.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-04-24T10:20:46.423" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1905" PostTypeId="1" AcceptedAnswerId="1906" CreationDate="2018-04-24T11:54:45.100" Score="8" ViewCount="119" Body="&lt;p&gt;I have heard about Quantum chemistry as one of the main applications of quantum computers. However, I have not found concrete related articles with circuit-implementations for these applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have articles on simulating molecules (such as for instance hydrogen or helium) with a circuit implementation to run it? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="2293" LastEditDate="2018-05-02T09:10:10.730" LastActivityDate="2018-05-02T09:10:10.730" Title="Quantum chemistry: references" Tags="&lt;resource-request&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1906" PostTypeId="2" ParentId="1905" CreationDate="2018-04-24T12:30:51.750" Score="5" Body="&lt;p&gt;Have you read &lt;a href=&quot;https://www.nature.com/articles/nchem.483&quot; rel=&quot;noreferrer&quot;&gt;Towards quantum chemistry on a quantum computer&lt;/a&gt; (Nature Chemistry 2010, or here in the &lt;a href=&quot;https://arxiv.org/pdf/0905.0887&quot; rel=&quot;noreferrer&quot;&gt;arXiv version&lt;/a&gt;)? They present &quot;&lt;em&gt;a photonic implementation for the smallest problem: obtaining the energies of H$_2$ (the hydrogen molecule) in a minimal basis&lt;/em&gt;&quot;. In the figure S1 of the Supporting information there is an equivalence of the operations they implement in circuit notation. &lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-24T12:30:51.750" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1907" PostTypeId="2" ParentId="1899" CreationDate="2018-04-24T12:43:10.953" Score="1" Body="&lt;p&gt;You may be referring to works like &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.107.020501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulation of Chemical Isomerization Reaction Dynamics on a NMR Quantum Simulator&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/pdf/1105.4228&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'd say that in general the prediction of reaction rates or transition rates will be much more difficult compared with this 3-qubit job. Note a large amount of chemistry happens either in solution or in the solid state. Only few-particle phenomena (maybe reactions among simple molecules in atmospherical chemistry or astrochemistry), which are also the cheapest to calculate also with conventional means, can be simulated with few qubits. As soon as one aspires to embed the reaction in an environment, the complexity of a realistic simulation explodes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree that if we are able to find particular cases of Noisy Intermediate-Scale Quantum systems in which, by chance of by design, the noise is a reasonable approximation to the real (thermal?) effect of the environment in the chemical reaction under study could indeed give us at least exciting results, maybe even useful.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-24T12:43:10.953" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1908" PostTypeId="2" ParentId="1542" CreationDate="2018-04-24T16:00:53.090" Score="4" Body="&lt;p&gt;For a certain class of codes called &lt;em&gt;pure&lt;/em&gt;, the &lt;strong&gt;presence of entanglement is a necessary and sufficient requirement&lt;/strong&gt; for quantum error correction, i.e. to correct all errors affecting up to a certain number of subsystems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall the Knill-Laflamme conditions for a quantum error correcting code  to be able to &lt;em&gt;detect&lt;/em&gt; a certain set of errors &lt;span class=&quot;math-container&quot;&gt;$\{E_\alpha\}$&lt;/span&gt;: pick any orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|i_\mathcal{Q}\rangle$&lt;/span&gt; that spans the code-space. Then the error &lt;span class=&quot;math-container&quot;&gt;$E_\alpha$&lt;/span&gt; can be &lt;em&gt;detected&lt;/em&gt; if and only if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\langle i_\mathcal{Q} | E_\alpha | j_\mathcal{Q} \rangle = \delta_{ij} C(E_\alpha). \quad\quad\quad (1)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$C(E_\alpha)$&lt;/span&gt; is a constant that only depends on the specific error &lt;span class=&quot;math-container&quot;&gt;$E_\alpha$&lt;/span&gt;, but not on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. (This means that the error &lt;span class=&quot;math-container&quot;&gt;$E_\alpha$&lt;/span&gt; affects all states in the code subspace in the same way). In the case of &lt;span class=&quot;math-container&quot;&gt;$C(E_\alpha) \propto \operatorname{tr}(E_\alpha)$&lt;/span&gt;, the code if called &lt;em&gt;pure&lt;/em&gt;. Many stabilizer codes considered are of this form, not however Kitaev's toric code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume an error-model where we are only interested in on how many subsystems our errors act. If our code can &lt;em&gt;detect&lt;/em&gt; all errors &lt;span class=&quot;math-container&quot;&gt;$E_\alpha$&lt;/span&gt; that act on at most &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt; subsystems nontrivially, the code is said to have &lt;em&gt;distance&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. As a consequence, any combination of errors that affect up to &lt;span class=&quot;math-container&quot;&gt;$\lfloor(d-1)/2\rfloor$&lt;/span&gt; subsystems can be &lt;em&gt;corrected&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What follows is that for pure codes of distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, every vector lying in the code subspace must be &lt;em&gt;maximally entangled&lt;/em&gt; across  any bipartition whose smaller subsystem has at most size &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt;: &#xA;to see this, note that for every error &lt;span class=&quot;math-container&quot;&gt;$E_\alpha \neq \mathbb{1}$&lt;/span&gt; and vector &lt;span class=&quot;math-container&quot;&gt;$|v_\mathcal{Q} \rangle$&lt;/span&gt; in the subspace (our ONB was chosen arbitrary), one has that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; \langle E \rangle = \operatorname{tr}(E |v_\mathcal{Q} \rangle\langle v_\mathcal{Q}|) = \langle v_\mathcal{Q} |E_\alpha|v_\mathcal{Q} \rangle = \operatorname{tr}(E) = 0.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus all observables on at most &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt; parties are vanishing, and all reduced density matrices on &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt; parties must be maximally mixed. This implies that &lt;span class=&quot;math-container&quot;&gt;$|v_\mathcal{Q}\rangle$&lt;/span&gt; is maximally entangled for any choice of &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt; parties vs. the rest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addendum (for the sufficiency):&#xA;As an equivalent definition to Eq. (1): All errors &lt;span class=&quot;math-container&quot;&gt;$E_\alpha$&lt;/span&gt; acting on less than &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; places can be &lt;em&gt;detected&lt;/em&gt;, if and only if for all &lt;span class=&quot;math-container&quot;&gt;$|v\rangle, |w\rangle$&lt;/span&gt; in the code subspace following condition holds,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; \langle v| E_\alpha | v\rangle = \langle w | E_\alpha| w\rangle.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of pure codes, above expression vanishes. It follows that if one has a subspace where every state is maximally entangled for all bipartitions of (d-1) parties vs. the rest, then it is a pure code of distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;tl;dr: For a large distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, a pure code consists of highly entangled states. It is a necessary and sufficient requirement for the  existence of the code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addendum: we looked into this question further, details can be found in the paper &lt;a href=&quot;https://arxiv.org/abs/1907.07733&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Codes of Maximal Distance and Highly Entangled Subspaces&lt;/a&gt;. There is a trade-off: the more errors a quantum code can correct, the more entangled must every vector in the code space be. This makes sense, because if the information where not distributed amongst many particles, the environment - by reading a few qubits - could recover the message in the code space. This would then necessarily destroy the coded message, due to the no-cloning theorem. Thus a high distance needs high entanglement.&lt;/p&gt;&#xA;" OwnerUserId="2192" LastEditorUserId="2192" LastEditDate="2019-09-11T18:35:47.423" LastActivityDate="2019-09-11T18:35:47.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1909" PostTypeId="1" CreationDate="2018-04-24T16:35:06.120" Score="5" ViewCount="562" Body="&lt;p&gt;The following $2\times 2$ matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;P = &#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;represents a quantum gate because it's a unitary matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we multiply $P$ by the quantum state $\lvert \psi\rangle = \alpha \lvert 0\rangle + \beta \lvert 1\rangle$, we obtain ${\lvert \psi\rangle}_P = \alpha e^{i\theta} \lvert 0 \rangle  + \beta  e^{i\phi} \lvert 1\rangle $, which can be derived as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;{\lvert \psi\rangle}_P&#xA;&amp;amp;=&#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;\alpha \lvert 0\rangle + \beta \lvert 1\rangle &#xA;\\&#xA;&amp;amp;=&#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;\alpha \lvert 0\rangle + &#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;\beta \lvert 1\rangle &#xA;\\&#xA;&amp;amp;=&#xA;\alpha &#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;\begin{bmatrix} 1 \\ 0 \end{bmatrix} + &#xA;\beta &#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;\begin{bmatrix} 0 \\ 1 \end{bmatrix} &#xA;\\&#xA;&amp;amp;=&#xA;\alpha &#xA;\begin{bmatrix} e^{i\theta} \\ 0 \end{bmatrix} + &#xA;\beta &#xA;\begin{bmatrix} 0 \\ e^{i\phi} \end{bmatrix}&#xA;\\&#xA;&amp;amp;=&#xA;\alpha &#xA;e^{i\theta}&#xA;\begin{bmatrix} 1 \\ 0 \end{bmatrix} + &#xA;\beta &#xA;e^{i\phi} &#xA;\begin{bmatrix} 0 \\ 1 \end{bmatrix}&#xA;\\&#xA;&amp;amp;=&#xA;\alpha e^{i\theta} \lvert 0 \rangle  + \beta  e^{i\phi} \lvert 1\rangle &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we tried to measure ${\lvert \psi\rangle}_P$, we would obtain the computational basis state $\lvert 0 \rangle$ with probability $|\alpha|^2$ and the computational basis state $\lvert 1 \rangle$ with probability $|\beta |^2$. So, there's no difference between measuring ${\lvert \psi\rangle}_P$ or $\lvert \psi\rangle$, in terms of probabilities of obtaining one rather than the other computational basis state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason to obtain same probabilities is because $e^{i\theta}$ and $e^{i\phi}$ are phase vectors, so they do not affect the probabilities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$e^{i\theta}$ and $e^{i\phi}$ represent complex numbers, as vectors, in the complex plane. This can be easily visualized from the following picture&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://i.stack.imgur.com/3UulI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3UulI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what's the intuitive meaning of multiplying the &quot;vectors&quot; $e^{i\phi}$ by a computational basis state? In general, what is a phase and a phase vector in this context and how does it affect the mathematics and the basis vectors? What's the relation between $\lvert \psi\rangle$ and ${\lvert \psi\rangle}_P$?&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="26" LastEditDate="2019-01-21T15:49:59.973" LastActivityDate="2019-01-21T15:49:59.973" Title="What exactly is a phase vector?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1910" PostTypeId="2" ParentId="1909" CreationDate="2018-04-24T17:12:28.643" Score="2" Body="&lt;p&gt;There are a few different things that you may be confusing.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why are objects of the form $e^{i\phi}$ actually called vectors in this context?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A complex number can always be expressed as a vector in $\mathbb R^2$, because $\mathbb C$ is nothing but $\mathbb R^2$ with a particular product defined between its elements. Note that this has nothing to do with quantum mechanics or physics, it is just how complex numbers are defined.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;in general what is a phase (in the context of quantum mechanics)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can think of a phase as a number that characterises how different modes interfere with each other. While as you noted adding a phase doesn't change the output probabilities in a fixed basis, it &lt;em&gt;does&lt;/em&gt; change the output probabilities as soon as you measure in a different basis.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the relation between $|\psi\rangle$ and $|\psi\rangle_P$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They are just two different states. As noted above, while the probabilities of measuring $|0\rangle$ or $|1\rangle$ are the same for these states, as soon as you measure in a different basis you will see that they behave differently.&#xA;For example, you can easily verify that $|\psi\rangle$ and $|\psi\rangle_P$ correspond to different probabilities of measuring the outcome $|+\rangle\equiv\frac{1}{\sqrt2}(|0\rangle+|1\rangle)$.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-04-24T17:12:28.643" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1911" PostTypeId="1" AcceptedAnswerId="1912" CreationDate="2018-04-24T18:07:35.513" Score="3" ViewCount="278" Body="&lt;p&gt;I know that a density operator is separable if it can be written in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \rho =\sum_k a_k \rho^A_k \otimes \rho^B_k\tag{1}$$&#xA;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$a_k \ge 0,\quad \sum_k a_k=1\tag{2}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is will any set of $\rho_k^A \otimes \rho_k^B$ work? I.e. I am asking if the following statement is true (if so how do we prove it and if not - why not):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A density matrix $\rho$ is separable if and only if when written as the sum of &quot;factorized&quot; states $\rho_K^A \otimes \rho_k^B$ (independent of which factorized states are used) the relations (1) and (2) hold.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is clearly a stronger statement then saying it &lt;em&gt;can be&lt;/em&gt; written as (1) and (2) - and if true leads to a quick way to test entanglement.&lt;/p&gt;&#xA;" OwnerUserId="2015" LastActivityDate="2018-04-24T21:22:13.340" Title="Density operators and separable states" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1912" PostTypeId="2" ParentId="1911" CreationDate="2018-04-24T20:04:16.967" Score="4" Body="&lt;p&gt;The correct definition is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$\rho$ is separable if and only if there exist $\rho_i^A\ge0$, $\rho_i^B\ge0$, and $p_i\ge0$ such that &#xA;  $$\rho = \sum_i p_i \rho_i^A\otimes \rho_i^B\ .$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All other properties (that the $\rho_i^\bullet$ have trace 1 and the $p_i$ sum to $1$) follow automatically.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-04-24T20:04:16.967" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1913" PostTypeId="2" ParentId="1911" CreationDate="2018-04-24T20:27:35.860" Score="1" Body="&lt;p&gt;There are fixed sets that you can use, but the question is how large that set is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your possible set of states is infinitely large (every possible pure state of 1 qubit), you can always do it, of course. But, worse, it has to be this large. Imagine you have a finite set $\{\rho^A_i\}$ and you want to describe a pure single-qubit state $|\psi\rangle\langle\psi|$ that is not one of the $\rho^A_i$. Clearly, there is no choice of $\{p_i\}$ such that $\sum_ip_i\rho^A_i=|\psi\rangle\langle\psi|$ because you must sum at least two terms, and hence will have a state with at least rank 2, while the pure state has rank 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to visualise this is with the Bloch sphere. Imagine a sphere. Every possible pure state corresponds to a point on the surface. The set $\{\rho^A_i\}$ form a set of points on, or in, the sphere. The set of possible states that you can make via the term $\sum_ip_i\rho^A_i$ is given by the convex hull of the points. You can't reconstruct the surface of the sphere from a convex hull (the shape has flat sides!) unless you have infinitely many points.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-24T21:22:13.340" LastActivityDate="2018-04-24T21:22:13.340" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1914" PostTypeId="1" AcceptedAnswerId="1919" CreationDate="2018-04-25T03:53:41.470" Score="5" ViewCount="1237" Body="&lt;p&gt;Whenever I learn about quantum computing and qubits, it always talks about the superposition principle and that the qubits can be in both states 0 and 1 simultaneously, thus claiming that quantum computers have processing capability way more than modern conventional computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here is what I don't understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can a superposition of 0 and 1 represent any discrete information at all?&lt;/li&gt;&#xA;&lt;li&gt;What about the logic gates? &lt;/li&gt;&#xA;&lt;li&gt;How can a discrete decision be taken by leveraging this superposition principle?&lt;/li&gt;&#xA;&lt;li&gt;Combination of 0 and 1 is basically important for computing. How can this third state of qubits be leveraged to give a boost in computing?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2201" LastEditorUserId="26" LastEditDate="2018-12-23T12:24:31.037" LastActivityDate="2018-12-23T12:24:31.037" Title="How does using a superposition of 0 and 1 improve the processing capabilities of a quantum computer compared to classical computers?" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="3" ClosedDate="2018-04-25T18:32:00.133" ContentLicense="CC BY-SA 4.0" />
  <row Id="1915" PostTypeId="2" ParentId="1914" CreationDate="2018-04-25T04:53:03.663" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How can a superposition of 0 and 1 represent any discrete information at all?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any algorithm, classical or quantum, inputs 0's and 1's and outputs 0's and 1's. For a quantum algorithm 0 is $|0\rangle$ and 1 is $|1\rangle$. Quantum algorithms use superpositions $|\psi\rangle = \alpha|0\rangle+\beta|1\rangle$ on intermediate computation steps only.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What about the logic gates?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum computers use a different set of gates because they are built on different physics. For example, all quantum gates are reversible, while for example classical AND gate is not reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formally, a quantum gate is a unitary transformation applied to one or several qubits.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can a discrete decision be taken by leveraging this superposition principle?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&quot;Discrete decision&quot; (whatever it means) is based on the output of a quantum algorithm which is nothing more than a bunch of zeros and ones, same as with &#xA;classical algorithm.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Combination of 0 and 1 is basically important for computing. How can this third state of qubits be leveraged to give a boost in computing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Actually quantum algorithms use not only single-qubit superposition states $|\psi\rangle = \alpha|0\rangle+\beta|1\rangle$ but also multi-qubit entangled states. Anyway, quantum algorithms have additional &quot;degrees of freedom&quot; that are unavailable to classical algorithms and indeed can leverage these degrees of freedom &quot;to give a boost in computing&quot;. I doubt it is possible to explain how quantum algorithms do it without learning quantum algorithms themselves.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="26" LastEditDate="2018-05-09T04:37:24.943" LastActivityDate="2018-05-09T04:37:24.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1916" PostTypeId="2" ParentId="1803" CreationDate="2018-04-25T06:13:25.380" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Plain and simple. Does Moore's law apply to quantum computing, or is it similar but with the numbers adjusted (ex. triples every 2 years). Also, if Moore's law doesn't apply, why do qubits change it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A great question, with great answers; still, I will try my hand at it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, most quantum computers do not have qubits created in silicon; even the few that do are not created by utilizing &lt;a href=&quot;https://en.wikipedia.org/wiki/Computational_lithography&quot; rel=&quot;nofollow noreferrer&quot;&gt;computational lithography&lt;/a&gt;. Quantum computing is in it's earliest days, it can't be compared directly to a mature technology of an entirely different kind.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Information to support that short answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question was asked at physics.SE: &quot;&lt;a href=&quot;https://physics.stackexchange.com/questions/372161/reasonable-to-expect-moores-law-for-quantum-computing&quot;&gt;Reasonable to expect Moore's law for quantum computing?&lt;/a&gt;&quot;, receiving one answer; not particularly well received (400 views in 144 days, and 1 UpVote).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is termed &lt;a href=&quot;https://en.wikipedia.org/wiki/D-Wave_Systems#History&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rose&lt;/a&gt;'s Law, by some; after the CTO of D-Wave Systems. See this article: &quot;&lt;a href=&quot;https://www.fanaticalfuturist.com/2016/08/quantum-computing-roses-law-is-moores-law-on-steroids/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computing Rose’s Law is Moore’s Law on steroids&lt;/a&gt;&quot; or the Flickr page of the Managing Director of the investment firm Draper Fisher Jurvetson, Steve Jurvetson: &quot;&lt;a href=&quot;https://www.flickr.com/photos/jurvetson/8054771535/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rose’s Law for Quantum Computers&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1Itei.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Itei.jpg&quot; alt=&quot;Rose&amp;#39;s Law&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The chart runs a bit ahead of itself, and it applies to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum annealing&lt;/a&gt; computers, it's not exactly comparable to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Quantum_supremacy&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal quantum computing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason Moore's Law is not exactly comparable is because it refers to transistors and an entirely different manufacturing process, you're comparing a manufacturing process that was established at the time with one where the computer is in it's earliest days and is essentially hand built.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia's webpage describes &lt;a href=&quot;https://en.wikipedia.org/wiki/Moore%27s_law&quot; rel=&quot;nofollow noreferrer&quot;&gt;Moore's Law&lt;/a&gt; this way:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. The observation is named after Gordon Moore, the co-founder of Fairchild Semiconductor and Intel, whose 1965 paper described a doubling every year in the number of components per integrated circuit, and projected this rate of growth would continue for at least another decade. In 1975, looking forward to the next decade, he revised the forecast to doubling every two years. The period is often quoted as 18 months because of Intel executive David House, who predicted that chip performance would double every 18 months (being a combination of the effect of more transistors and the transistors being faster).&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.intel.com/pressroom/kits/events/moores_law_40th/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gordon E. Moore&lt;/a&gt;'s graphic from 1965 looked like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wZFYe.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wZFYe.jpg&quot; alt=&quot;Original Moore&amp;#39;s Law&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article by Max Roser and Hannah Ritchie (2018) - &quot;&lt;a href=&quot;https://ourworldindata.org/technological-progress&quot; rel=&quot;nofollow noreferrer&quot;&gt;Technological Progress&lt;/a&gt;&quot;, published online at OurWorldInData.org, explains how exponential equations have been used to describe everything from Moore's Law, computational power (both operations per second and clock speed * cores * threads), the progress of human flight or even human genome DNA sequencing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moore's law is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Observation&quot; rel=&quot;nofollow noreferrer&quot;&gt;observation&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Forecasting&quot; rel=&quot;nofollow noreferrer&quot;&gt;projection&lt;/a&gt; of an historical trend and not a &lt;a href=&quot;https://en.wikipedia.org/wiki/Physical_law&quot; rel=&quot;nofollow noreferrer&quot;&gt;physical&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_law&quot; rel=&quot;nofollow noreferrer&quot;&gt;natural law&lt;/a&gt;. Although the rate held steady from 1975 until around 2012, the rate was faster during the first decade. A nostalgic look at the early days of personal computing is given in this Ars Technica feature: &quot;&lt;a href=&quot;https://arstechnica.com/gadgets/2015/06/from-laptops-that-needed-leg-braces-to-laplets-engineering-mastery/&quot; rel=&quot;nofollow noreferrer&quot;&gt;The creation of the modern laptop: An in-depth look at lithium-ion batteries, industrial design, Moore's law, and more&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this Communications of the ACM, Vol. 60 No. 1 article: &quot;&lt;a href=&quot;https://webcache.googleusercontent.com/search?q=cache:JDSZ4GENpGgJ:https://cacm.acm.org/magazines/2017/1/211094-exponential-laws-of-computing-growth/fulltext%20&amp;amp;cd=1&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=ca&quot; rel=&quot;nofollow noreferrer&quot;&gt;Exponential Laws of Computing Growth&lt;/a&gt;&quot; the authors, Denning and Lewis, explain: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The three kinds of exponential growth, as noted—doubling of components, speeds, and technology adoptions—have all been lumped under the heading of Moore's Law. Because the original Moore's Law applies only to components on chips, not to systems or families of technologies, other phenomena must be at work. We will use the term &quot;Moore's Law&quot; for the component-doubling rule Moore proposed and &quot;exponential growth&quot; for all the other performance measures that plot as straight lines on log paper. What drives the exponential growth effect? Can we continue to expect exponential growth in the computational power of our technologies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exponential growth depends on three levels of adoption in the computing ecosystem (see the table here). The chip level is the domain of Moore's Law, as noted. However, the faster chips cannot realize their potential unless the host computer system supports the faster speeds and unless application workloads provide sufficient parallel computational work to keep the chips busy. And the faster systems cannot reach their potential without rapid adoption by the user community. The improvement process at all three levels must be exponential; otherwise, the system or community level would be a bottleneck, and we would not observe the effects often described as Moore's Law.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With supporting mathematical models, we will show what enables exponential doubling at each level. Information technology may be unique in being able to sustain exponential growth at all three levels. We will conclude that Moore's Law and exponential doubling have scientific bases. Moreover, the exponential doubling process is likely to continue across multiple technologies for decades to come.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Self-Fulfillment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The continuing achievement signified by Moore's Law is critically important to the digital economy. Economist Richard G. Anderson said, &quot;Numerous studies have traced the cause of the productivity acceleration to technological innovations in the production of semiconductors that sharply reduced the prices of such components and of the products that contain them (as well as expanding the capabilities of such products).&quot;1 Robert Colwell, Director of DARPA's Microsystems Technology Office, echoes the same conclusion, which is why DARPA has invested in overcoming technology bottlenecks in post-Moore's-Law technologies.5 If and when Moore's Law ends, that end's impact on the economy will be profound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is no wonder then that the standard explanation of the law is economic; it became a self-fulfilling prophesy of all chip companies to push the technology to meet the expected exponential growth and sustain their markets. A self-fulfilling prophecy is a prediction that causes itself to become true. For most of the past 50-plus years of computing, designers have emphasized performance. Faster is better. To achieve greater speed, chip architects increased component density by adding more registers, higher-level functions, cache memory, and multiple cores to the same chip area and the same power dissipation. Moore's Law became a design objective.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moore's Law had a lot of help, shaping the future and maintaining the growth was an objective of those whom stood to profit; not entirely constrained by technological limitations. If consumers wanted something sometimes it was provided and other times a &lt;em&gt;better&lt;/em&gt; idea was offered; what was popular (clock speed) sold at a premium and what, at one time, was not well understood (more cores and threads) was promoted as the way forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moore's Law was well received, evolving into many things, like Kurzweil's &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Accelerating_change#Kurzweil&amp;#39;s_The_Law_of_Accelerating_Returns&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Law of Accelerating Returns&lt;/a&gt;&quot;. Here's an updated version of Moore’s Law (based on Kurzweil’s graph):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vayBP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vayBP.png&quot; alt=&quot;Kurzweil&amp;#39;s Law&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another fact-based chart is provided by &lt;a href=&quot;https://www.top500.org/statistics/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Top500.Org&lt;/a&gt;'s chart of the exponential growth of SuperComputer power:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4biM4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4biM4.png&quot; alt=&quot;Top 500 SuperComputers&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Missouri University of Science and Technology's article: &quot;&lt;a href=&quot;http://scholarsmine.mst.edu/bio_inftec_facwork/130/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Forecasting Consumer Adoption of Technological Innovation: Choosing the Appropriate Diffusion Models for New Products and Services before Launch&lt;/a&gt;&quot; explains that the Bass Model (a modification of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Logistic_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;logistic curve&lt;/a&gt;) is a sound method to predict future growth (based upon past statistics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logistic curve features a slow start, great mid-term progress, followed by an eventual slowdown; often replaced by something new.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mszUr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mszUr.png&quot; alt=&quot;Logistic Curve&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On forecasting models the authors had this to say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;strong&gt;MODELS&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Box and Cox and Generalized Bass models were the best models when it came to curve-fitting while the Simple Logistic model did the poorest. &lt;strong&gt;However, the results of the research showed that a curve-fitting advantage did not translate into a forecasting advantage when creating a forecast for an innovation without a market history&lt;/strong&gt;. The popularity of the Bass model derives from two unique factors. As this research has reinforced, the Bass model is very robust. In addition, the Bass model’s two coefficients have a theoretical foundation. The Bass model variants created for this research deliberately violated the assumption of a constant $m$. This resulted in a model (Bv) that outperformed any of the others in the radical low-priced innovation context. Unfortunately, there was just one innovation in this context – additional research is recommended to test the viability of this variation with more datasets in various contexts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Simple Logistic model is one of the oldest diffusion models known. It is a very basic model, but it clearly outperformed the other models in the context of really new low-priced innovations. The Gompertz model it is not recommended for forecasting the diffusion of really new or radical innovations before the launch of an innovation. However, the Gompertz model may be very well suited for forecasts generated well after the launch of an innovation. While not the focus of this research, it was observed that the diffusion of the Projection Television innovation follows a perfect Gompertz curve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Flexible Logistic Box and Cox model has a problem where the c variable tends to run to infinity in some scenarios. This was addressed by capping the upper limit of $c$ to 100,000. Despite (or because of) this fix, the &#xA;authors must admit to being skeptical as to how well the Box and Cox model would do in comparison to the other models. As it turned out, the Box and Cox was second only to the Bass model in terms of robustness. The Box and Cox was also the best model in the context of radical high-priced innovations.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Moore's position as a co-founder of Intel helped ensure that he could help his prediction to come true and keep it on track.&lt;/strong&gt; Quantum computing is too near it's genesis to be pushed forward by simply pouring money on it, with so many paths to creating a successful quantum computing device money needs to be apportioned wisely to make the most gains from the many branches that research has taken.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1712.03773&quot; rel=&quot;nofollow noreferrer&quot;&gt;The European Quantum Technologies Roadmap&lt;/a&gt;&quot; (11 Dec 2017) lists some of the challenges, following the introduction:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum computer based on the unitary evolution of a modest number of robust logical qubits (N&gt;100) operating on a computational state space with 2$^N$ basis states would outperform conventional computers for a number of well identified tasks. A viable implementation of a quantum computer has to meet a set of requirements known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/DiVincenzo%27s_criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;DiVincenzo criteria&lt;/a&gt;: That is, a quantum computer operates on &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) an easily extendable set of well characterized qubits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) whose coherence times are long enough for allowing coherent operation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) and whose initial state can be set&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4). The qubits of the system can be operated on logically with a universal set of gates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(5) and the final state can be measured&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(6). To allow for communication, stationary qubits can be converted into mobile ones&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(7) and transmitted faithfully.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also understood that it is essential for the operation of any quantum computer to correct for errors that are inevitable and much more likely than in classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today quantum processors are implemented using a range of physical systems. Quantum processors operating on registers of such qubits have so far been able to demonstrate many elementary instances of quantum algorithms and protocols. The development into a fully featured large quantum computer faces a scalability challenge which comprises of integrating a large number of qubits and correcting quantum errors. Different fault-tolerant architectures are proposed to address these challenges. The steadily growing efforts of academic labs, startups and large companies are a clear sign that large scale quantum computation is considered a challenging but potentially rewarding goal.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are too many paths to choose, and determine the best way forward, to either plot a model for growth (like Moore's Law) nor should so straight a line be expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With D-Wave's computer each doubling of qubits represents a doubling of computation power, for the subset of problems it is suited for, for universal quantum computers each single additional qubit represents a doubling of power; unfortunately each single qubit needs to be represented by multiple qubits, to permit error correction and maintain coherence. Some technologies used to implement qubits allow fewer or single qubits to be used as they are not error prone and have longer coherence and greater fidelity. Speed of control is also an important consideration when choosing which technology to implement and while it will affect the plot of the curve it's out of the scope of the answer offered here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further reading: &quot;&lt;a href=&quot;https://arxiv.org/abs/1801.07497&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coherent control of single electrons: a review of current progress&lt;/a&gt;&quot; (1 Feb 2018), &quot;&lt;a href=&quot;https://arxiv.org/abs/1707.00581&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hyperfine-assisted fast electric control of dopant nuclear spins in semiconductors&lt;/a&gt;&quot; (30 Mar 2018), &quot;&lt;a href=&quot;https://arxiv.org/abs/1708.01454&quot; rel=&quot;nofollow noreferrer&quot;&gt;A &gt;99.9%-fidelity quantum-dot spin qubit with coherence limited by charge noise&lt;/a&gt;&quot; (4 Aug 2017).&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="278" LastEditDate="2018-05-12T23:26:39.113" LastActivityDate="2018-05-12T23:26:39.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1917" PostTypeId="1" CreationDate="2018-04-25T07:57:56.000" Score="11" ViewCount="80" Body="&lt;p&gt;This question is related (and complementary) to &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1880/passive-improving-of-nanodiamond-surfaces-for-nv-centers&quot;&gt;Passive improving of nanodiamond surfaces for NV centers?&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nitrogen-vacancy_center&quot; rel=&quot;noreferrer&quot;&gt;Nitrogen-Vacancy centers&lt;/a&gt; (NVs) have astonishing quantum properties, which make them interesting as potential hardware both for quantum computing in particular and for quantum technologies in general. In part this results from the center being protected by the diamond structure, which is at the same time very rigid and practically free from nuclear spins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, their surfaces tend to be far from controlled. Neither in &lt;em&gt;chemical&lt;/em&gt; terms (composition, structure) not in terms of what it contributes to the &lt;em&gt;physical properties of the bulk&lt;/em&gt;. For example, in experiments of diamond levitation using lasers, at high powers of irradiation, the diamonds typically get noticeably lighter (and thus oscillate further in their potential wells) as they suddenly (and uncontrolledly lose the external rubbish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming closer to the question: in these same experiments, even though diamonds are essentially transparent to the lasers employed for the levitation, eventually at high laser power and low pressure diamonds overheat and essentially &lt;em&gt;evaporate&lt;/em&gt;. Since these conditions are useful to fix the diamonds in place and reduce noise, this is a problem for the control of NV centers as qubits for quantum computing purposes. One reason for the poor thermal dissipation in diamonds -which in absence of gas that can carry convection necessarily happens via black body radiation- is the fact that the phonon spectrum of diamond is essentially empty: covalent bonds are too strong, everything is fix in its place, and there is nothing available that can vibrate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, since heat release is often governed by surface properties, what is the current status of efforts to alter diamond surface with the goal of obtaining &lt;strong&gt;spectrally selective thermal emittance properties&lt;/strong&gt;, meaning emitting preferentially at energies below the evaporation of the diamond starts?&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="55" LastEditDate="2020-09-04T09:31:09.237" LastActivityDate="2020-09-04T09:31:09.237" Title="Active improving of nanodiamond surfaces for NV centers?" Tags="&lt;architecture&gt;&lt;experiment&gt;&lt;solid-state&gt;&lt;nv-centers&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1918" PostTypeId="1" AcceptedAnswerId="1923" CreationDate="2018-04-25T10:44:11.683" Score="16" ViewCount="902" Body="&lt;p&gt;An answer to &#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1478/is-there-any-source-which-tabulates-quantum-computing-algorithms-for-simulating&quot;&gt;Is there any source which tabulates quantum computing algorithms for simulating physical systems?&lt;/a&gt; mentions the &lt;a href=&quot;https://math.nist.gov/quantum/zoo/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithm Zoo&lt;/a&gt;, a list of quantum algorithms. Several answers to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1367/programming-quantum-computers-for-non-physics-majors&quot;&gt;Programming quantum computers for non-physics majors&lt;/a&gt; include links to different kinds of development kits. Likewise, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1474/what-programming-languages-are-available-for-quantum-computers&quot;&gt;What programming languages are available for quantum computers?&lt;/a&gt; gathers a couple of good attempts at listing those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The present question is related to the above, and yet it's not answered by the above resources.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does a complete list of open quantum software projects exist?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideal answers would be: if it exists, the link to said list, and if it doesn't, a (well-formatted) as-exhaustive-as-possible compilation of open quantum software projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1973/are-there-any-quantum-software-startups&quot;&gt;Are there any quantum software startups?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-05-03T04:47:56.550" LastActivityDate="2019-04-12T21:13:56.143" Title="Does a complete list of open quantum software projects exist?" Tags="&lt;resource-request&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="1919" PostTypeId="2" ParentId="1914" CreationDate="2018-04-25T10:49:09.753" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How can a superposition of 0 and 1 represent any discrete information at all?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The inputs to a quantum computer are always the same as the inputs to a classical computer; a definite sequence of 0s and 1s. This superposition thing is something that happens in the middle of the computation, and what you're quantum algorithm tries to do is make sure that your output is also a definite sequence of 0s and 1s. So, you're not using the superposition to represent any information in the sense of an input or an output.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What about the logic gates?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In many ways, logic gates work just the same as in the classical case. For example, there are many gates which, given an input string of 0s and 1s output a different string of 0s and 1s. Examples include the not gate, controlled-not and Toffoli (controlled-controlled-not). For a quantum state, if you have it written out as a superposition of different strings of 0s and 1s, these gates act on each of these strings just as they would in the classical case. In this sense, you can do everything that a classical computer can (the Toffoli gate, in particular, is said to be 'universal' for classical reversible computation, i.e. arbitrary combinations have the full power of classical computation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, quantum computation has &lt;em&gt;more&lt;/em&gt; logic gates. It has gates which can create and recombine superpositions, and gates which can change the complex argument on the coefficients of the superposition (the $\alpha$ and $\beta$ in a statement $\alpha|0\rangle+\beta|1\rangle$).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can a discrete decision be taken by leveraging this superposition principle?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The trick, as mentioned above, is to make sure that there is a definite output, i.e.e that there is no (or almost no) superposition when the information is read out at the end. Where this superposition becomes useful is it gives these extra gates, over and above the classical stuff, some room to work. Without specifying exactly how they do it, you can easily imagine how having access to an additional set of abilities can sometimes be combined in new ways to give faster computations.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Combination of 0 and 1 is basically important for computing. How can this third state of qubits be leveraged to give a boost in computing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The insight about how it works is to emphasise first that the superposition of a qubit is not only one extra state. It is an infinite number of them, because instead of either being a 0 or a 1, it can be &lt;em&gt;any&lt;/em&gt; state $\alpha|0\rangle+\beta|1\rangle$ that satisfies the constraint $|\alpha|^2+|\beta|^2$. What's more, when you combine $N$ qubits together, you can get superpositions across all $2^N$ different sequences of 0s and 1s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how is this useful? So far, we only know that it's useful for a limited set of problems, and these problems often require knowledge of some global property of a function, i.e. I don't just want to evaluate some function $f(x)$ for a specific value of $x$, but I want to know some relation between many different values of $f(x)$. The superposition can simultaneously evaluate all the different values of $f(x)$, and then it just needs a bit of magic to work out if it's possible to recombine these superpositions in order to get out the answer we're interested in. The point is that this opens up a completely new possibility for the way an algorithm could work.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-05-09T04:35:23.177" LastActivityDate="2018-05-09T04:35:23.177" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1920" PostTypeId="1" CreationDate="2018-04-25T11:32:49.613" Score="10" ViewCount="1079" Body="&lt;p&gt;In superdense coding, two qubits are prepared by Eve in an entangled state; one of them is sent to Alice and the other is sent to Bob. Alice is the one who wants to send (to Bob) two classical bits of information. Depending on what pair of classical bits Alice wants to send (i.e. one of $00$, $01$, $10$ and $11$), Alice applies a certain quantum operation or gate to her qubit, and sends the result to Bob, which then applies other operations to retrieve the &quot;classical message&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't seem to me that superdense coding provides any advantage over classical communication techniques. Two qubits (the one sent to Alice and the one sent to Bob by Eve) and bits (the two sent to Bob by Alice) are sent, two qubits (one is received by Alice and the other by Bob) and bits (the two sent by Alice to Bob) are received. Furthermore, I read that if someone has access to the qubit sent to Bob, then the communication seems not to be secure (anyway). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the real advantages of superdense coding compared to just sending two bits of information from Alice to Bob?&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="55" LastEditDate="2021-02-22T15:59:44.580" LastActivityDate="2021-02-22T15:59:44.580" Title="What are the real advantages of superdense coding?" Tags="&lt;quantum-advantage&gt;&lt;superdense-coding&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1921" PostTypeId="2" ParentId="1920" CreationDate="2018-04-25T11:40:32.067" Score="9" Body="&lt;p&gt;TL;DR: While two qubits must be transmitted in total, in the instant where two bits are to be communicated, only one qubit has to be sent. The information being sent is masked, but it is not truly secure.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;There are two distinct phases to a superdense coding protocol. In phase 1,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob prepare a Bell state $(|00\rangle+|11\rangle)/\sqrt{2}$. This is a two-qubit state and Alice holds one qubit, and Bob the other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob travel off to distant locations, each taking their qubit. We assume that there are no errors; the quantum state does not change over time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This has all happened in advance, long before Alice knows what message she wants to send to Bob. The second phase occurs later, when Alice decides what two bit message she wants to send to Bob.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Depending on the message she wishes to send (she has 4 possible options), Alice applies either $\mathbb{I},X, Z$ or $Y$ on her qubit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice sends her qubit to Bob.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When Bob receives Alice's qubit, he brings the two qubits together and measures in the Bell basis. Each of the four different possible measurement outcomes correspond to one of the 4 messages Alice had to choose from.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, overall, you are correct that two qubits have to be sent. However, one of these qubits can be provided to Bob in advance, long before the communication, and before the content of the message was decided. Thus, in the instant when you want to send two bits of information (phase 2), you only have to send one qubit (the one that Alice has). Its like if you know you have lots of deadlines all due on the same day. You don't leave doing each of those jobs until absolutely the last minute, even if there are some last minute adjustments that you have to make on each. You work on things in advance so that, when that last minute information is available, you have to do the minimum possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the idea behind superdense coding, and it illustrates one of the principles of quantum information: you can provide some resource at an earlier time, independent of what is going to be done later and that resource can be consumed to achieve a more efficient result in the instant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in security, then for the protocol as described above, an eavesdropper can only get access to the qubit that Alice sends to Bob. In that case, the eavesdropper cannot tell what information Alice was sending to Bob (the density matrix of that qubit is $\mathbb{I}/2$ no matter what Alice did to it to encode the message). However, the eavesdropper can scramble the message by applying a Pauli operation on that qubit. The eavesdropper won't know what message Bob will receive (because it will be a combination of what Alice and the eavesdropper did), but Bob won't receive what Alice intended.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is the case that Alice prepares both qubits and sends them to Bob (just at different times), so that an eavesdropper could intercept thefirst qubit as well, then the protocol is completely insecure as the eavesdropper can just replace Bob. There is no authentication of the receiver.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What does it mean to &quot;prepare a quantum state&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every quantum state of a particular dimension, $d$ has an associated quantum state. This quantum state can be described mathematically as a $d$-dimensional complex vector. As theorists, when we say &quot;prepare a quantum state&quot;, we mean that we specify a vector that we want that quantum system to be in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, how is this done? You first measure your quantum system to find out what state it's in already, and perform a unitary operation to convert it from what it is to what you want it to be.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-26T11:03:32.327" LastActivityDate="2018-04-26T11:03:32.327" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1923" PostTypeId="2" ParentId="1918" CreationDate="2018-04-25T15:21:55.737" Score="14" Body="&lt;p&gt;There is a really long list of quantum software projects on &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;noreferrer&quot;&gt;Quantiki&lt;/a&gt;. It's mostly about quantum simulators, quantum compilers and QC programming environments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you inspired me to start a curated list of open-source quantum software projects on GitHub &lt;a href=&quot;https://github.com/markf94/os_quantum_software&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. It should not be exclusive to the aforementioned categories but list ANY (reasonable) open-source quantum software project out there. I will be doing my best to add as many projects as I can, but it would be great if some of you would contribute!&lt;/p&gt;&#xA;" OwnerUserId="1234" LastEditorUserId="1234" LastEditDate="2018-04-25T16:52:32.153" LastActivityDate="2018-04-25T16:52:32.153" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1924" PostTypeId="1" CreationDate="2018-04-25T15:27:01.150" Score="5" ViewCount="130" Body="&lt;p&gt;My question is somehow related with a previous one: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1842/what-is-the-most-optimistic-perspective-of-room-temperature-solid-state-qc&quot;&gt;What is the most optimistic perspective of room-temperature solid-state QC?&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Regarding solid-state qubits, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the highest temperature at which the simplest quantum logic operation has been performed?  Let's say: initialization, arbitrary rotation and measuring, repeated to have enough statistics in order to verify a good fidelity. In which solid-state system has this happened?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1955" LastEditorUserId="26" LastEditDate="2018-12-13T19:48:20.487" LastActivityDate="2018-12-13T19:48:20.487" Title="Which temperature has been the highest to achieve a quantum logic operation?" Tags="&lt;solid-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1925" PostTypeId="2" ParentId="1920" CreationDate="2018-04-25T16:18:18.120" Score="4" Body="&lt;p&gt;Superdense coding can be used to smooth out network utilization by &quot;&lt;a href=&quot;http://algassert.com/quantum/2014/05/03/Storing-Bandwidth-with-Superdense-Coding.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;storing bandwidth&lt;/a&gt;&quot;. During low utilization, top up the traffic with EPR halves. During high utilization, burn the EPR halves to double the available capacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superdense coding can turn a two-way quantum channel with bandwidth B (in both directions) &lt;a href=&quot;http://algassert.com/quantum/2015/01/17/Superdense-Coding-on-the-Fly-and-in-Reverse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;into a one-way classical channel with bandwidth 2B&lt;/a&gt;. Just use the reverse direction to send EPR halves, which you then use to fuel superdense coding in the forward direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superdense coding can convert high-latency bandwidth into low-latency bandwidth. For example, if you have two quantum channels with bandwidth B but one of them has a latency of 1 second instead of 10 milliseconds, you can deliver EPR halves over the high latency channel and use them to fuel the actual data being superdense coded over the low latency channel. (Picture a truck showing up with a box of EPR halves, so that your internet goes faster.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Caveat: all of these assume that a quantum channel is less than twice as expensive as a classical channel, which may not ever be true financially speaking.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-04-25T16:18:18.120" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1926" PostTypeId="1" AcceptedAnswerId="1972" CreationDate="2018-04-25T16:31:31.260" Score="12" ViewCount="817" Body="&lt;p&gt;I am from a computer science background and I find it difficult to decide on the resources I should focus on while learning quantum computing, since there is so much to read/watch. My ultimate goal is to make a programming language acting as an interface between quantum computers and the person similar to 1972 when C was made. As a realistic intermediate stage, I would like to get to the point of writing programs on IBM's QISKit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For that, I would need a schematic study guide in order to acquire the necessary background in Physics and the related fields required to dive into the field of quantum computing. Does this already exist: &lt;strong&gt;an ordered list of indispensable concepts and abilities to master, which if possible also mentions adequate material to acquire each of them&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume a high school level physics knowledge. Provide a study guide i.e. from beginner to expert kind of guide. Try to list video/book resources that one should follow in a chronological order so as to become an expert in the field of quantum computing to the level I can write my own quantum computing language (assuming already have other CS skills to write the language).&lt;/p&gt;&#xA;" OwnerUserId="2209" LastEditorUserId="26" LastEditDate="2018-05-01T17:37:25.613" LastActivityDate="2018-05-13T18:40:35.547" Title="Does a study guide exist that starts from a &quot;purely CS background&quot; and advances towards &quot;making a new quantum programming language&quot;?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="9" ContentLicense="CC BY-SA 3.0" />
  <row Id="1927" PostTypeId="2" ParentId="1867" CreationDate="2018-04-26T01:24:07.957" Score="2" Body="&lt;p&gt;For theoretical purposes, I would say that describing two qubits either as exactly that, two qubits ($\mathbb{C}^2\otimes\mathbb{C}^2$), or as a single $d=4$ spin, ($\mathbb{C}^4$) are essentially equivalent, assuming you have universal control over the whole Hilbert space, because it means you can do whatever you want. The distinction is usually most applicable when you separate the two qubits over some distance, and cannot easily implement a key gate in the universal set (i.e. the two-qubit interaction). But here, you're explicitly stating that that interaction is present. So, the theory claims it makes no difference; you can always do anything you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I expect that in practice (although I'm not an experimentalist), the difference comes down to the error mechanisms, which will be different between what you might actually describe as 3 different settings: two qubits $\mathbb{C}^2\otimes\mathbb{C}^2$, a single spin $\mathbb{C}^4$, or the Hilbert space structure implied by the two-qubit interaction you mentioned, $\mathbb{C}\oplus\mathbb{C}^3$. The energy levels in each case are quite different, which will affect the relaxation properties, and presumably more general interactions with the environment as well.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-26T01:24:07.957" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1929" PostTypeId="1" CreationDate="2018-04-26T09:23:24.410" Score="4" ViewCount="191" Body="&lt;p&gt;In quantum computation, a common operation performed between two quantum states is the tensor product, which allows us to create a new and higher-dimensional state from two lower-dimensional states. The tensor product is usually denoted by the symbol $\otimes$. So, if $\lvert \psi\rangle = \alpha \lvert 0\rangle + \beta \lvert 1\rangle \in \mathbb{C}^n$ and $\lvert \phi\rangle = \gamma \lvert 0\rangle + \delta \lvert 1\rangle \in \mathbb{C}^n$ are the states of two qubits, then $\lvert \psi\rangle \otimes \lvert \phi\rangle \in \mathbb{C}^{n^2}$ is their tensor product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have just come across the notation $\lvert \mathbf{x}, 0\rangle$ while reading &lt;a href=&quot;http://pages.cs.wisc.edu/~dieter/Courses/2010f-CS880/Scribes/04/lecture04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;section $1$ of this paper&lt;/a&gt;. What does it mean? I understood $\mathbf{x}$ is a (classical) bit string of length $n$ (and I think this the reason it's in bold).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of the fact that the tensor product of two vectors $\lvert \psi\rangle$ and $\lvert \phi\rangle$ can be shortened as follows $\lvert \psi\rangle \lvert \phi\rangle$. So, I don't think $\lvert \mathbf{x}, 0\rangle$ is also a shorthand for $\lvert \mathbf{x} \rangle \otimes\lvert 0\rangle$. &lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="26" LastEditDate="2018-12-23T12:23:46.057" LastActivityDate="2018-12-23T12:23:46.057" Title="What do we mean by the notation $\lvert \mathbf{x}, 0\rangle$?" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1930" PostTypeId="2" ParentId="1929" CreationDate="2018-04-26T09:43:22.060" Score="5" Body="&lt;p&gt;Yes, $|\mathbf{x},0\rangle$ is a shorthand for $|\mathbf x\rangle\otimes |0\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $|\mathbf x\rangle$ itself, with $\mathbf x = x_1x_2\dots x_N$ a bit string, is just a shorthand for&#xA;$$&#xA;|\mathbf x\rangle \equiv |x_1\rangle \otimes &#xA;|x_2\rangle \otimes\cdots&#xA;|x_N\rangle\ .&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-04-26T11:20:45.437" LastActivityDate="2018-04-26T11:20:45.437" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1931" PostTypeId="1" AcceptedAnswerId="1932" CreationDate="2018-04-26T12:10:43.443" Score="3" ViewCount="173" Body="&lt;p&gt;I recently read hand-written notes about the &quot;secret mask&quot; or &quot;secret string&quot; algorithm (which I can't share here) with the following notation $\lvert \underline{x} \rangle$, i.e. a letter with a line under it. What could it mean? &lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="72" LastEditDate="2018-04-26T15:34:43.350" LastActivityDate="2018-04-26T15:34:43.350" Title="What does the notation $\lvert \underline{x} \rangle$ mean?" Tags="&lt;notation&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1932" PostTypeId="2" ParentId="1931" CreationDate="2018-04-26T12:59:20.353" Score="3" Body="&lt;p&gt;It probably means that you take $x$ to be a binary string, $x\in\{0,1\}^n$ where you're talking about a system of $n$ qubits. The underline probably isn't necessary (it's hard to tell without more context), but just conveys that you &lt;em&gt;could&lt;/em&gt; think of it as a vector, i.e. if $x=011010$, you could think of it as a vector $\underline{x}=(0,1,1,0,1,0)$. You don't always have to, it depends what you're going to do with it. Generally you only have to think about $x$ as a binary string. However, there are certain operations where it might help to think about it as a vector. For instance, the Hadamard transform can be written has&#xA;$$&#xA;H^{\otimes n}=\frac{1}{\sqrt{2^n}}\sum_{x,z\in\{0,1\}^n}(-1)^{x\cdot z}|x\rangle\langle z|,&#xA;$$&#xA;where you calculate $x\cdot z$ using the usual inner product for vectors. So, it can help to draw attention to the fact that you're using them like that by underlining them. Whether or not you do that largely depends on mood! For example, you can see that I haven't chosen to do it.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-26T13:10:53.577" LastActivityDate="2018-04-26T13:10:53.577" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1934" PostTypeId="5" CreationDate="2018-04-26T15:14:06.107" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-26T15:14:06.107" LastActivityDate="2018-04-26T15:14:06.107" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1935" PostTypeId="4" CreationDate="2018-04-26T15:14:06.107" Score="0" Body="For question about Quantum Merlin Arthur (QMA), a computational complexity class. QMA is the 'quantum analogue' of NP, that is QMA is to BQP as NP is to P." OwnerUserId="253" LastEditorUserId="253" LastEditDate="2018-04-26T19:17:18.913" LastActivityDate="2018-04-26T19:17:18.913" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1936" PostTypeId="2" ParentId="1887" CreationDate="2018-04-26T17:00:54.023" Score="3" Body="&lt;p&gt;To answer your question, if there is an actual field of research, &lt;a href=&quot;https://arxiv.org/abs/1503.02515&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Biology (QIB)&lt;/a&gt; seems to fit what you are looking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once &lt;a href=&quot;https://link.springer.com/article/10.1007%2Fs10701-015-9929-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;a textbook has been written&lt;/a&gt; on a subject I think it is fair to classify it as a valid research field. Also you may consider &lt;a href=&quot;http://rsta.royalsocietypublishing.org/content/356/1743/1869&quot; rel=&quot;nofollow noreferrer&quot;&gt;the controversial Penrose–Hameroff ‘Orch OR‘ model&lt;/a&gt; to fall into this category, and maybe even the no less controversial research on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_cognition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Cognition&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you seem to be most interested in learning from biology for QIS which is what &lt;a href=&quot;https://www.oxfordmartin.ox.ac.uk/research/programmes/quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Oxford Martin Programme on Bio-Inspired Quantum Technologies&lt;/a&gt; is investigating. &lt;strong&gt;A word of caution though&lt;/strong&gt;, if you look at &lt;a href=&quot;https://www.oxfordmartin.ox.ac.uk/research/programmes/quantum/publications&quot; rel=&quot;nofollow noreferrer&quot;&gt;their publications&lt;/a&gt; they appear to be mostly &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_biology&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Biology&lt;/a&gt;. To my knowledge no actual Quantum Information processing has been experimentally demonstrated to take place in biological systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And while there is no doubt that engineering and technology can often been inspired, and improved upon, by mimicking biology, I don't think this hypothesis is necessarily a foregone conclusion when it comes to quantum computing or quantum technologies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take photosynthesis for example. It is an incredibly well working process, arguably the most important life sustaining one on earth, but as you can tell from the color of leafs it only uses a small part of the sun light's spectrum. That is why &lt;a href=&quot;https://en.wikipedia.org/wiki/Photosynthetic_efficiency&quot; rel=&quot;nofollow noreferrer&quot;&gt;it is not very efficient&lt;/a&gt;. It only converts 3%-6% of the incoming light to energy that can be used by the plant. The best solar cells are pushing beyond 40% efficiency. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So while these research fields are widely exciting, I don't see Quantum Biocomputing to happen anytime soon.&lt;/p&gt;&#xA;" OwnerUserId="1375" LastEditorUserId="1375" LastEditDate="2018-04-26T17:06:03.803" LastActivityDate="2018-04-26T17:06:03.803" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1937" PostTypeId="1" AcceptedAnswerId="1941" CreationDate="2018-04-27T08:10:17.447" Score="22" ViewCount="1397" Body="&lt;p&gt;I've read in many sources and books on &lt;em&gt;adiabatic quantum computation&lt;/em&gt; (AQC) that it is crucial for the &lt;em&gt;initial Hamiltonian&lt;/em&gt; $\hat{H}_i$ to not commute with the &lt;em&gt;final Hamiltonian&lt;/em&gt; $\hat{H}_f$, i.e. $\left[\hat{H}_i,\hat{H}_f\right]\neq 0$. But I've never seen an argument to why it's so important. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume a linear time dependence the Hamiltonian of the AQC is&#xA;$$&#xA;\hat{H}\left(t\right)~=~\left(1-\frac{t}{\tau}\right)\hat{H}_i+\frac{t}{\tau}\hat{H}_f, &#xA;\qquad \left(0\leq t\leq \tau \right)&#xA;$$&#xA;where $\tau$ is the adiabatic time scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my &lt;strong&gt;question&lt;/strong&gt; is: Why is it crucial that the initial Hamiltonian does not commute with the final Hamiltonian?&lt;/p&gt;&#xA;" OwnerUserId="2136" LastEditorUserId="23" LastEditDate="2018-04-27T10:59:05.970" LastActivityDate="2018-07-02T07:13:26.463" Title="Why is it crucial that the initial Hamiltonian does not commute with the final Hamiltonian in adiabatic quantum computation?" Tags="&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 3.0" />
  <row Id="1938" PostTypeId="2" ParentId="1937" CreationDate="2018-04-27T08:30:22.697" Score="3" Body="&lt;p&gt;In the context of Ising optimizers having an initial Hamiltonian that commutes with the problem Hamiltonian means it is essentially products of $\sigma^Z$ operators, which means that its eigenstates are classical bitstrings. Hence the groundstate at the beginning ($t$=0) will be classical as well, not a superposition of all possible bitstrings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, even going beyond the strict boundaries of AQC (e.g. open-system quantum annealing, QAOA etc.) if the driving Hamiltonian commutes then it cannot induce transitions between the eigenstates of the problem Hamiltonian but only change the phase of the amplitudes in the wavefunction; and you want a driver which is able to induce spin-flips in order to explore the search space.&lt;/p&gt;&#xA;" OwnerUserId="410" LastActivityDate="2018-04-27T08:30:22.697" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1939" PostTypeId="1" AcceptedAnswerId="1960" CreationDate="2018-04-27T09:58:07.370" Score="8" ViewCount="1257" Body="&lt;p&gt;On page 157 of Kaye, Laflamme and Mosca they write that in Grover's algorithm we need to apply Grover's iterate a total of:&#xA;$$\Big\lfloor \frac{\pi}{4} \sqrt{N}\Big\rfloor$$&#xA;(They actually wrote $\Big\lfloor \frac{\pi}{4} \frac{1}{\sqrt{N}}\Big\rfloor$ but I assume the above is what is intended.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why the floor? Would it not be better to go to the nearest integer - since if e.g. $ \frac{\pi}{4} \sqrt{N}=5.9999$ it would seem a bit silly to do $5$ rather then $6$ iterations. &lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="55" LastEditDate="2019-08-19T10:32:20.957" LastActivityDate="2019-08-19T10:32:20.957" Title="In Grover's Algorithm, why does the optimal number of iterations involve a floor?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1940" PostTypeId="1" AcceptedAnswerId="1964" CreationDate="2018-04-27T10:01:11.743" Score="16" ViewCount="279" Body="&lt;p&gt;On the surface, quantum algorithms have little to do with classical computing and P vs NP in particular: Solving problems from NP with quantum computers tells us nothing about the relations of these classical complexity classes&lt;sup&gt;1&lt;/sup&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the 'alternative description' of the classical complexity class PP as the class PostBQP presented in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412187&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; is, as far as I'm aware, considered as an important result &lt;em&gt;for&lt;/em&gt; 'classical complexity', &lt;em&gt;by&lt;/em&gt; 'quantum complexity'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, Scott Aaronson, the author of the paper, writes at the end of the abstract:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This illustrates that quantum computing can yield new and simpler proofs of major results about classical computation. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hence, my question is: are there results from the field of quantum complexity that 'simplify' the P vs NP problem, similar to the quantum description of PP? If there are no such results, is there a good reason to not expect these results, despite the 'success' for PP?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;1: Take the answer to this question, for example: &lt;a href=&quot;https://cs.stackexchange.com/questions/73864/&quot;&gt;Would the P vs. NP problem become trivial as a result of the development of universal quantum computers?&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="253" LastActivityDate="2018-05-23T10:19:21.220" Title="Are there results from quantum algorithms or complexity that lead to advances on the P vs NP problem?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1941" PostTypeId="2" ParentId="1937" CreationDate="2018-04-27T11:26:02.603" Score="13" Body="&lt;p&gt;In adiabatic QC, you encode your problem in a Hamiltonian such that your result can be extracted from the ground state. Preparing that ground state is hard to do directly, so you instead prepare the ground state of an 'easy' Hamiltonian, and then slowly interpolate between the two. If you go slow enough, the state of your system will stay in the ground state. At the end of your process, you'll have the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This works according to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_theorem&quot; rel=&quot;noreferrer&quot;&gt;Adiabatic theorem&lt;/a&gt;. For the theorem to hold, there must be an energy gap between the ground state and the first excited state. The smaller the gap becomes, the slower you need to interpolate to prevent mixing between the ground state and first excited states. If the gap closes, such mixing cannot be prevent, and you can't go slow enough. The procedure fails at that point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the initial and final Hamiltonian commute, it means they have the same energy eigenstates. So they agree on which states get assigned energy, and only disagree on the energies they get. Interpolating between the two Hamiltonians just changes the energies. The final ground state would therefore have been an excited state at the beginning, and the original ground state becomes excited at the end. At some point, when passing by each other, the energies of these states will be be equal, and so the gap between them closes. This is sufficient to see that the energy gap must close at some point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having non-commuting Hamiltonians is therefore a necessary condition of keeping the gap open, and hence for AQC.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-04-27T11:26:02.603" CommentCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1942" PostTypeId="2" ParentId="1937" CreationDate="2018-04-27T11:27:49.733" Score="5" Body="&lt;p&gt;If two matrices (in this case, Hamiltonians) commute, they have the same eigenvectors. So, if you prepare a ground state of the first Hamiltonian, then that will (roughly speaking) remain an eigenstate throughout the whole adiabatic evolution, and so you get out just what you put in. There's no value to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to be a little more strict, then it could be that your initial Hamiltonian has a degeneracy which is lifted by the second Hamiltonian, and you might be hoping to cause the system to evolve into the unique ground state. Note, however, that the degeneracy is lifted the instant there's a non-zero amount of the second Hamiltonian. Whatever effect it can have is an instantaneous one. I believe that you don't get a proper adiabatic evolution. Instead, you have to write your initial state as a superposition of the new eigenstates, and these start to evolve over time, but you never increase the overlap of your state with the target state (the ground state).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-04-27T11:27:49.733" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1944" PostTypeId="2" ParentId="1939" CreationDate="2018-04-27T17:19:15.173" Score="3" Body="&lt;p&gt;Using floor is logical as a general recommendation to build a Grover's algorithm circuit, because it means that we need less gates compared with ceiling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm is probabilistic; the probability of obtaining correct result grows until we reach about $\pi/4\sqrt{N}$ iterations, and starts decreasing after that number. For large $N$ the probability of obtaining correct result is very close to $1$ if the number of iterations is close to $\pi/4\sqrt{N}$; exact number of iterations does not matter given it is close to $\pi/4\sqrt{N}$.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-05-06T15:51:20.227" LastActivityDate="2018-05-06T15:51:20.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1945" PostTypeId="1" AcceptedAnswerId="1954" CreationDate="2018-04-27T17:53:00.170" Score="5" ViewCount="93" Body="&lt;p&gt;Suppose we have a quantum system $Q$ with an initial state $\rho^{(Q)}$. The measurement process will involve two additional quantum systems: an apparatus system $A$ and an environment system $E$. We suppose that the system $Q$ is initially prepared in the state $\rho_{k}^{(Q)}$ with a priori probability $p_k$. The state of the apparatus $A$ and environment $E$ is $\rho_{0}^{(AE)}$, independent of the preparation of $Q$. The initial state of the entire system given the $k$th preparation for $Q$ is $$\rho_{k}^{(AEQ)} = \rho_{0}^{(AE)} \otimes \rho_{k}^{(Q)}.$$ Averaging over the possible preparations, we obtain $$\rho^{(AEQ)} = \sum_{k} p_{k} \rho_{k}^{(AEQ)}. $$  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum information theory, the accessible information of a quantum system is given by $$\chi := S(\rho) - \sum_{j}P_{j}S(\rho_{j}),$$ where $S$ is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_entropy&quot; rel=&quot;noreferrer&quot;&gt;von Neumann entropy&lt;/a&gt; of the quantum state. How can we show that if $\rho_{0}^{(AE)}$ is independent of the preparation $k$, that $$\chi^{(AEQ)} = \chi^{(Q)}?$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="10480" LastEditDate="2021-04-16T20:37:45.180" LastActivityDate="2021-04-16T20:37:45.180" Title="Accessible information of system vs system, apparatus and environment" Tags="&lt;measurement&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1946" PostTypeId="5" CreationDate="2018-04-27T19:54:43.910" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-27T19:54:43.910" LastActivityDate="2018-04-27T19:54:43.910" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1947" PostTypeId="4" CreationDate="2018-04-27T19:54:43.910" Score="0" Body="For questions regarding applications of quantum computing and quantum information theory in quantum chemistry or applications of chemistry in quantum computing architecture." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T14:07:52.023" LastActivityDate="2018-12-23T14:07:52.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1948" PostTypeId="5" CreationDate="2018-04-27T19:55:42.847" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-04-27T19:55:42.847" LastActivityDate="2018-04-27T19:55:42.847" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1949" PostTypeId="4" CreationDate="2018-04-27T19:55:42.847" Score="0" Body="Superdense coding is quantum communication protocol that transmits 2 classical bits of information by sending 1 qubit, provided sender and receiver pre-shared entangled pair of qubits." OwnerUserId="26" LastEditorUserId="2105" LastEditDate="2020-01-09T23:47:08.303" LastActivityDate="2020-01-09T23:47:08.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1952" PostTypeId="1" AcceptedAnswerId="1957" CreationDate="2018-04-28T04:26:08.697" Score="9" ViewCount="1011" Body="&lt;p&gt;Quantum Annealing, (related questions &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1595/what-precisely-is-quantum-annealing&quot;&gt;Quantum Annealing&lt;/a&gt;, or &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1937/why-is-it-crucial-that-the-initial-hamiltonian-does-not-commute-with-the-final-h&quot;&gt;hamiltonian related&lt;/a&gt;) is the process used in D-Waves' Quantum Annealer, in which the energy landscapes are explored, for different solutions, and by tuning a suitable Hamiltonian, zero in to a possible optimal solution to a problem. The process of Quantum Annealing reduces &quot;transverse magnetic fields&quot; in the Hamiltonian, in addition to other quantum effects like quantum tunnelling, entanglement, and superposition, which in turn all play a part in zeroing to a &quot;valley&quot; of a quantum mechanical wave function, where the &quot;most likely&quot; solution lies.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process of Reverse Annealing, very briefly, is to use classical methods such as Simulated Annealing, to find a solution, and hone into a valley using Quantum Annealing. If the Hamiltonian used by the Quantum Annealer is already in  a &quot;valley&quot;, as it is being passed a solution in the first place -Does the D-Wave machine reach another &quot;valley&quot;( a better solution?) using the Hamiltonian passed to it, in the first place? &lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="26" LastEditDate="2018-05-04T13:23:11.800" LastActivityDate="2018-06-13T09:42:50.000" Title="What precisely is Reverse Annealing?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1953" PostTypeId="2" ParentId="1701" CreationDate="2018-04-28T09:02:02.400" Score="1" Body="&lt;p&gt;Let me go for a &lt;em&gt;self-learner&lt;/em&gt; experience. After some reading, my short answer to my own question&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would the calculation of the loss of entanglement be necessarily related to delocalized vibrational modes that simultaneously involve the local environment of both triplets?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is: &lt;strong&gt;probably yes, but not &lt;em&gt;necessarily/primarily&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A longer answer follows. With a previous familiarity with decoherence but non-familiarity with disentanglement, this paper was extremely helpful: &lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1361-648X/aab98d/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entanglement loss in molecular quantum-dot qubits due to interaction with the environment&lt;/a&gt; (Enrique P Blair et al, 2018, J. Phys.: Condens. Matter, 30, 195602). The physical scenario is not identical, but allows for a few key insights:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Like coherence, &lt;strong&gt;entanglement is maintained by default&lt;/strong&gt;, not by a process, which is to say: we only need to look for processes explicitly destroying it. This is whay one gets better numbers for entangled photons compared with solid state qubits, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1840/what-is-the-maximum-separation-between-two-entangled-qubits-that-has-been-achiev&quot;&gt;What is the maximum separation between two entangled qubits that has been achieved experimentally?&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;From the above point (and from the paper above), let us first consider the case where two qubits are far enough to avoid interaction among each other, and also to avoid interaction with a common environment. &lt;strong&gt;For thus isolated qubits just by accounting for decoherence we will fully account for disentanglement&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Entanglement is exclusivity: entanglement between two parties is gradually lost as these parties entangle more and more with other parties. So, with entanglement between two qubits -as with coherence of one qubit- the primary focus of our attention should be how does the qubit interact with its environment. In the case under consideration: with the spin bath and the phonon bath. &lt;strong&gt;The same processes that destroy coherence will destroy entanglement, essentially at the same rate&lt;/strong&gt;. For details, calculate fidelities and/or entanglement witnesses.&lt;/li&gt;&#xA;&lt;li&gt;If the two qubits are not perfectly isolated from each other, there is an interaction between them, which can be direct or via a common environment. In that case, the two qubits can experience a collective evolution which, beyond affecting their individual coherence, also alters their entanglement. This is what the question is asking, and here the answer would be a conditional yes. &lt;strong&gt;Collective vibrational modes affecting both qubits need to be considered, since they promote a collective evolution that can either create or destroy entanglement&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-28T09:02:02.400" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1954" PostTypeId="2" ParentId="1945" CreationDate="2018-04-28T09:25:33.367" Score="6" Body="&lt;p&gt;For density matrices $\rho_A$ and $\rho_B$ having eigenvalues $\lambda^{\left(A\right)}$ and $\lambda^{\left(B\right)}$, \begin{align}S\left(\rho_A\otimes\rho_B\right) &amp;amp;= -\rho_A\otimes\rho_B\ln\left(\rho_A\otimes\rho_B\right)\\&#xA;&amp;amp;= -\sum_{j, k}\lambda^{\left(A\right)}_j\lambda^{\left(B\right)}_k\ln\left(\lambda^{\left(A\right)}_j\lambda^{\left(B\right)}_k\right)\\&#xA;&amp;amp;= -\sum_{j, k}\left[\lambda^{\left(A\right)}_j\lambda^{\left(B\right)}_k\ln\left(\lambda^{\left(A\right)}_j\right) + \lambda^{\left(A\right)}_j\lambda^{\left(B\right)}_k\ln\left(\lambda^{\left(B\right)}_k\right)\right]\\&#xA;&amp;amp;= -\sum_j\lambda^{\left(A\right)}_j\ln\left(\lambda^{\left(A\right)}_j\right)\sum_k\lambda^{\left(B\right)}_k - \sum_j\lambda^{\left(A\right)}_j\sum_k\lambda^{\left(B\right)}_k\ln\left(\lambda^{\left(B\right)}_k\right)\\&#xA;&amp;amp;= -\sum_j\lambda^{\left(A\right)}_j\ln\left(\lambda^{\left(A\right)}_j\right) - \sum_k\lambda^{\left(B\right)}_k\ln\left(\lambda^{\left(B\right)}_k\right)\\&#xA;&amp;amp;= S\left(\rho_A\right) + S\left(\rho_B\right).&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\chi^{\left(AEQ\right)} &amp;amp;= S\left(\rho^{\left(AEQ\right)}\right) - \sum_jp_jS\left(\rho_j^{\left(AEQ\right)}\right)\\&#xA;&amp;amp;=S\left(\rho^{\left(AE\right)}\right) + S\left(\rho^{\left(Q\right)}\right) - \sum_jp_j\left(S\left(\rho^{\left(AE\right)}\right) + S\left(\rho_j^{\left(Q\right)}\right)\right)\\&#xA;&amp;amp;= S\left(\rho^{\left(AE\right)}\right) + S\left(\rho^{\left(Q\right)}\right) - \sum_jp_jS\left(\rho^{\left(AE\right)}\right) -\sum_jp_jS\left(\rho_j^{\left(Q\right)}\right).&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As $\sum_jp_j = 1$, it follows that $$\chi^{\left(AEQ\right)} = S\left(\rho^{\left(Q\right)}\right)-\sum_jp_jS\left(\rho_j^{\left(Q\right)}\right) = \chi^{\left(Q\right)}$$&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-04-28T09:25:33.367" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1955" PostTypeId="1" AcceptedAnswerId="1970" CreationDate="2018-04-28T09:40:25.543" Score="9" ViewCount="315" Body="&lt;p&gt;I am trying to build a quantum computation library as my university project. I am still learning all the aspects of the Quantum Computing field. I know there are efficient libraries already for quantum emulation. I just want to make my own, which will help me to grasp some of the core concepts of Quantum Computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that $n$ qubits can be stored with a $2^n$ element complex array. Also, a $n$ qubit gate is a $2^n \times 2^n$ 2D array. So, the following are my doubts (mostly related to entanglement):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When do I need to find the tensor product of gates (like $I \otimes H \otimes I$, for a $3$ qubit system)? Is it always necessary to compute the tensor product of order $2^n \times 2^n$, even if the qubits are not entangled?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With only a $2^n$ element array (which I store the coefficients), can I actually somehow calculate which qubits are entangled? Or do I need to make another data structure to store the entanglement information of my $n$ qubits (about which qubits are entangled)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is my 2nd question actually relevant? Do I need to keep track of the entanglement information at all? I mean, I don't know whether multiplying gates with coefficients is enough  (even if the system is entangled). Maybe it is relevant at the time of measurement only.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2060" LastEditorUserId="253" LastEditDate="2018-05-01T12:54:36.133" LastActivityDate="2018-05-03T06:07:52.143" Title="How to keep track of entanglements when emulating quantum computation?" Tags="&lt;entanglement&gt;&lt;tensor-product&gt;&lt;emulation&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1956" PostTypeId="2" ParentId="1" CreationDate="2018-04-29T16:17:28.470" Score="6" Body="&lt;p&gt;To complete what others have said: as far as we know &lt;strong&gt;a (classical) Turing machine cannot truly simulate quantum correlations&lt;/strong&gt;. This is explicitly claimed in section &lt;em&gt;Properties of the universal quantum computer&lt;/em&gt; by the seminal paper by David Deutsch &lt;a href=&quot;https://web.archive.org/web/20081123183419/http://www.ceid.upatras.gr/tech_news/papers/quantum_theory.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum theory, the Church-Turing principle and the universal quantum computer&lt;/a&gt; (Proceedings of the Royal Society of London A&#xA;400, pp. 97-117 (1985)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Details will depend on the implementation or on your exact definitions for Turing machine, of quantum computer, and especially of &lt;em&gt;simulate&lt;/em&gt; (if you are generous enough with what &lt;em&gt;simulates&lt;/em&gt; mean, anything can simulate anything). Generally speaking, it is possible to design a quantum computer which, when repeatedly operated by starting from the exact same starting state (or input bits), in every operation generates random output bits which present certain quantum correlations with each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I know, a Turing machine cannot do that.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-04-29T16:17:28.470" CommentCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1957" PostTypeId="2" ParentId="1952" CreationDate="2018-04-29T19:47:32.247" Score="4" Body="&lt;p&gt;Until recently, D-Wave's quantum annealing devices always started from a uniform superposition over all $N$ qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$H_{initial} = |+\rangle_0 \otimes |+\rangle_1 ... \otimes |+\rangle_N$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $|+\rangle_i = \frac{1}{\sqrt{2}} (|0\rangle_i + |1\rangle_i)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's suppose you already ran a few anneals with this setup and one of the low-energy results looks like a relatively good solution (some local optima) to your optimization problem. Until the very recent introduction of the &lt;em&gt;reverse annealing&lt;/em&gt; feature, it was impossible to use this solution as input for the next anneal in order to explore the local space around that solution for bitstrings with even lower energy. Hence, &lt;em&gt;reverse annealing&lt;/em&gt; allows us to initialize the quantum annealer with a known (classical) solution and search the state space around this local optima.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When exploring complicated (rugged) energy landscapes of optimization problems you need to balance the global &lt;em&gt;exploration&lt;/em&gt; of the state space with the &lt;em&gt;exploitation&lt;/em&gt; of local optima. In traditional (D-Wave) quantum annealing, we start with a high transverse field which then gets gradually decreased as you described in your question. D-Wave's quantum annealer was thereby performing a global search (due to a lot of quantum tunneling) at the beginning of the annealing schedule when the transverse field is strong. As the transverse field gets weaker, the search gets more and more local. In contrast, &lt;em&gt;reverse annealing&lt;/em&gt; starts with a classical solution defined by the user, then gradually increases the transverse field (backward annealing) to then decrease the transverse field again (forward annealing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This introduces the new parameter &lt;em&gt;reversal distance&lt;/em&gt; which determines how far you want to anneal backward (how strong the transverse field should become). D-Wave published the following two plots in this &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/14-1018A-A_Reverse_Quantum_Annealing_for_Local_Refinement_of_Solutions.pdf&quot; rel=&quot;noreferrer&quot;&gt;D-Wave Whitepaper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fydS0.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fydS0.png&quot; alt=&quot;reversal distance plots&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the left plot you can see that reversal distance is a very important new hyperparameter since its value determines the probability of obtaining a new ground state (blue region). If the reversal distance is too low, you will get the &lt;em&gt;same&lt;/em&gt; state you started with (red region) which would be useless. And of course if you reverse anneal for too long you essentially perform traditional quantum annealing and loose the information that you started with. Remember that too much transverse field means that we are performing global search again!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The right plot shows essentially the same thing by plotting &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamming_distance&quot; rel=&quot;noreferrer&quot;&gt;Hamming distance&lt;/a&gt; against reversal distance and the probability of obtaining a new ground state. For your problem at hand, you want to find that sweet spot (maxima of the red curve). For large reversal distances we again see that we get solution strings that are far from our initial state in terms of Hamming distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All in all, &lt;em&gt;reverse annealing&lt;/em&gt; is pretty new stuff and to the best of my knowledge there are no published papers about its effectiveness. In their &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/14-1018A-A_Reverse_Quantum_Annealing_for_Local_Refinement_of_Solutions.pdf&quot; rel=&quot;noreferrer&quot;&gt;Whitepaper&lt;/a&gt;, D-Wave claims the generation of 'new global optima up to&#xA;150 times faster than forward quantum annealing'.&lt;/p&gt;&#xA;" OwnerUserId="1234" LastActivityDate="2018-04-29T19:47:32.247" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1958" PostTypeId="1" CreationDate="2018-04-30T04:17:42.940" Score="10" ViewCount="352" Body="&lt;p&gt;I have heard various talks at my institution from experimentalists (who all happened to be working on superconducting qubits) that the textbook idea of true &quot;Projective&quot; measurement is not what happens in real-life experiments. Each time I asked them to elaborate, and they say that &quot;weak&quot; measurements are what happen in reality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that by &quot;projective&quot; measurements they mean a measurement on a quantum state like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$P\vert\psi\rangle=P(a\vert\uparrow\rangle+ b\vert\downarrow\rangle)=\vert\uparrow\rangle \,\mathrm{or}\, \vert\downarrow\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, a measurement which fully collapses the qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I take the experimentalist's statement that real measurements are more like strong &quot;weak&quot;-measurements, then I run into Busch's theorem, which says roughly that you only get as much information as how strongly you measure. In other words, I can't get around not doing a full projective measurement, I need to do so to get the state information&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I have two main questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is it thought that projective measurements cannot be performed experimentally? What happens instead?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the appropriate framework to think about experimental measurement in quantum computing systems that is actually realistic? Both a qualitative and quantitative picture would be appreciated.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2260" LastEditorUserId="2260" LastEditDate="2018-04-30T05:51:00.153" LastActivityDate="2018-11-04T14:21:35.557" Title="Are true Projective Measurements possible experimentally?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1959" PostTypeId="2" ParentId="1924" CreationDate="2018-04-30T06:16:26.210" Score="1" Body="&lt;p&gt;I think your reference has the answer: nitrogen vacancy centers in diamond, where you can do one qubit gates at room temperature. In fact, even higher temperatures are possible, but you will have to play a tradeoff between fidelity and temperature at some point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, NV centers are not scalable, and I don't think more than 2 qubits will ever be really possible due to the physical problems with interacting immobile NV centers which are randomly distributed. &lt;/p&gt;&#xA;" OwnerUserId="2260" LastEditorUserId="2260" LastEditDate="2018-04-30T06:33:12.720" LastActivityDate="2018-04-30T06:33:12.720" CommentCount="3" ContentLicense="CC BY-SA 3.0" />
  <row Id="1960" PostTypeId="2" ParentId="1939" CreationDate="2018-04-30T09:36:09.417" Score="11" Body="&lt;p&gt;Applying the Grover iterate a total number of $\lfloor \frac{\pi}{4}\sqrt{N}\rfloor$ times is the best choice if we want to maximize the success probability of Grover's algorithm. This is to some extent explained in Kaye, Laflamme and Mosca (KLM), but let me elaborate on the most important details here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $n$ be a natural number, $N = 2^n$, and suppose that we have a function $f : \{0,1\}^n \to \{0,1\}$. Suppose that we can evaluate this function $f$ by a &lt;em&gt;quantum phase oracle&lt;/em&gt; $U_f$ (this is the same operator $U_f$ as described by KLM in equation 8.1.5 on page 155), with the property that for all $i \in \{0,1\}^n$:&#xA;$$U_f : |i\rangle \mapsto (-1)^{f(i)}|i\rangle$$&#xA;Now, we define $G = f^{-1}(\{1\})$ and $B = f^{-1}(\{0\})$. Hence, $G \subseteq \{0,1\}^n$ is the set of all $n$-bit strings that will evaluate to $1$ if we use them as input in $f$. Another way of saying this is $i \in G \Leftrightarrow f(i) = 1$. For the purpose of this question, let's assume that $|G| = 1$, hence there is exactly one $i \in \{0,1\}^n$ such that $f(i) = 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, we proceed with defining the &lt;em&gt;good&lt;/em&gt; and &lt;em&gt;bad&lt;/em&gt; states, as follows (these are defined by KLM in equation 8.1.3 on page 155):&#xA;$$|\psi_{good}\rangle = \frac{1}{\sqrt{|G|}}\sum_{i \in G}|i\rangle \qquad \text{and} \qquad |\psi_{bad}\rangle = \frac{1}{\sqrt{|B|}}\sum_{i \in B}|i\rangle$$&#xA;Moreover, we define:&#xA;$$|\psi_{uniform}\rangle = \frac{1}{\sqrt{N}}\sum_{i \in \{0,1\}^n}|i\rangle = \sin\theta |\psi_{good}\rangle + \cos\theta |\psi_{bad}\rangle$$&#xA;where $\theta = \arcsin(\sqrt{|G|/N}) = \arcsin(1/\sqrt{N})$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's now devise an intuitive visualization of Grover's algorithm. To that end, consider all the quantum states that can be written as $\alpha|\psi_{good}\rangle + \beta|\psi_{bad}\rangle$ with $|\alpha|^2 + |\beta|^2 = 1$, and let's display them in the following picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qiQPk.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qiQPk.png&quot; alt=&quot;Visualization of Grover&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can use the visualization above to understand what Grover's iterate actually does. Grover's iterate does nothing but rotate any state in the circle above over an angle $2\theta$ counterclockwise. Hence, by applying Grover's iterate multiple times, we can rotate states over angles that are multiples of $2\theta$. How this works can be found in KLM, specifically we see the rotation over an angle of $2\theta$ appear in the last equation on page 160.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose that we start with the state $|\psi_{uniform}\rangle$. After  applying $k$ iterations of Grover's iterate, we obtain the state $|\psi_k\rangle$. From the picture, using the intuitive interpretation of Grover's iterate, we can easily see that the angle between $|\psi_k\rangle$ and $|\psi_{bad}\rangle$ is $(2k+1)\theta$. Hence, we find:&#xA;$$|\psi_k\rangle = \sin((2k+1)\theta)|\psi_{good}\rangle + \cos((2k+1)\theta)|\psi_{bad}\rangle$$&#xA;As we want to maximize the success probability, we want our state to be as close to $|\psi_{good}\rangle$ as possible. Hence, we want $(2k+1)\theta$ to be as close to $\frac{\pi}{2}$ as possible. Solving this equation, we obtain:&#xA;$$(2k+1)\theta = \frac{\pi}{2} \Leftrightarrow k = \frac{\pi}{4\theta} - \frac12$$&#xA;Recall that $\theta = \arcsin(1/\sqrt{N})$. By making the assumption that $N$ is big, and using the approximation $\arcsin(x) \approx x$ when $|x| \ll 1$, we obtain that our ideal choice for $k$ would be:&#xA;$$k \approx \frac{\pi}{4}\sqrt{N} - \frac12$$&#xA;But we can only apply Grover's iterate an integer number of times, say $k^*$, so we must find the integer $k^*$ that matches $k$ as closely as possible. Hence, we round the quantity on the RHS to obtain (using the notation explained in the box on page 163 of KLM):&#xA;$$k^* = \left[\frac{\pi}{4}\sqrt{N} - \frac12\right] = \left\lfloor \frac{\pi}{4}\sqrt{N}\right\rfloor$$&#xA;as $[x-\frac12] = \lfloor x\rfloor$ for all real $x$. If we trace back where this $\frac12$ comes from, we can see that it originates from the fact that we already start at an elevated angle of $\theta$ in the circle, even before we apply any of the Grover iterates. The floor, hence, is a deep consequence of the fact that the total angle of rotation doesn't have to be all of $\frac{\pi}{2}$, but rather $\frac{\pi}{2} - \theta$.&lt;/p&gt;&#xA;" OwnerUserId="24" LastEditorUserId="24" LastEditDate="2018-04-30T09:44:12.783" LastActivityDate="2018-04-30T09:44:12.783" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1961" PostTypeId="1" AcceptedAnswerId="1962" CreationDate="2018-04-30T11:49:30.383" Score="6" ViewCount="174" Body="&lt;p&gt;According to (&lt;a href=&quot;https://books.google.es/books?id=6hBq7Un57R0C&amp;amp;printsec=frontcover#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Macchiavello, Palma, Zeilinger, 2001; pg82&lt;/a&gt;) a lower bound of the encoding Hilbert space of a &lt;em&gt;non degenerate code&lt;/em&gt; is given by the quantum version of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamming_bound&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamming bound&lt;/a&gt;:&#xA;$$2^k \sum_{i=0}^t 3^i \begin{pmatrix} n \\ i\end{pmatrix}\le 2^n$$&#xA;where we are looking at a $[n,k,2t+1]$ code. Does such a bound exist for a degenerate code? and why is it different (if it indeed is)?&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="26" LastEditDate="2018-05-07T13:17:13.163" LastActivityDate="2018-05-07T13:17:13.163" Title="Lower bound for Degenerate Codes?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 3.0" />
  <row Id="1962" PostTypeId="2" ParentId="1961" CreationDate="2018-04-30T15:40:34.207" Score="7" Body="&lt;p&gt;This bound works by counting the number of orthogonal states that must be available. If you're encoding into $n$ qubits, you can't require more than $2^n$ orthogonal states, because that's all that's available. This is the right hand side of the bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to encode $k$ logical qubits in a distance $2t+1$ code, then each of the $2^k$ basis states of those logical qubits must encode to something different. Moreover, you need to be able to correct for up to $t$ errors of type $X$, $Y$ or $Z$. If we require each of these to map to a different orthogonal state, then there are $3n$ possible 1-qubit errors, $3^2\binom{n}{2}$ 2-qubit errors (choice of one of 3 Paulis for each error, and a pair of locations for them to happen at), and so on. So, this gives the stated bound, known as the Quantum Hamming bound (also Gilbert-Varshamov). However, an essential feature of the derivation is the assumption that each error is mapped onto a different orthogonal state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The very definition of a degenerate code is that multiple errors can be mapped onto the same state. As a trivial example, consider the effect of a single-qubit $Z$ error on any one of the qubits of the GHZ state&#xA;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle^{\otimes n}+|1\rangle^{\otimes n}).&#xA;$$&#xA;No matter where that error happens, the resultant state is the same, but that's fine: I don't need to be able to identify which of the $n$ qubits the error happened on to fix it. Once I know the error has happened, I can apply a $Z$ gate on any of the qubits that I choose in order to fix it. (I don't claim that this example enables you to detect that error.) So, &lt;strong&gt;the Quantum Hamming bound does not apply to degenerate codes&lt;/strong&gt;. Indeed, there are known examples where the bound is beaten, e.g.  &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.57.830&quot; rel=&quot;noreferrer&quot;&gt;D. P. DiVincenzo, P. W. Shor, and J. A. Smolin, Phys. Rev. A 57, 830 (1998)&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706061&quot; rel=&quot;noreferrer&quot;&gt;free version&lt;/a&gt;), although there are surprisingly few.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only replacement that I know of is the Quantum Singleton Bound, $n-k\geq 4t$. The Quantum Hamming bound, in practice, appears to give very good estimates of what can be achieved, but is not absolute when it comes to degenerate codes.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-04-30T18:09:01.873" LastActivityDate="2018-04-30T18:09:01.873" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1963" PostTypeId="2" ParentId="1958" CreationDate="2018-04-30T16:56:19.457" Score="8" Body="&lt;p&gt;Let's step back from QC for a moment and think about a textbook example: the projector onto position, $|x\rangle$.  This projective measurement is obviously unphysical, as the eigenstates of $|x\rangle$ are themselves unphysical due to the uncertainty principle.  The real measurement of position, then, is one with some uncertainty.  One can treat this either as a weak measurement of position, or as a projective measurement onto a non-orthonormal basis (a strong POVM), where the various basis elements have some support on multiple values of $x$: say pixels on a detector.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back into QC, most systems' measurements are pretty close to projective, or are 'strong' measurements at the least.  In some systems, like ion traps, the readout can be thought of as a series of weak measurements that collectively form a strong one.  A photon counter, on the other hand, is very close to a projective measurement with some odd projectors due to finite efficiency--no click corresponds to a projector onto $|0\rangle + (1-e)^n|n\rangle$, for instance.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, that projector doesn't leave behind the state listed above, because the apparatus also absorbs the photon.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up, thinking of things as POVMs (Positive operator-valued measures) is probably the most-right intuition, where you can think of the outcomes of the POVM mostly as non-orthonormal projectors.  Non-projective POVMs also exist, but are less common in practice in systems I've thought about.&lt;/p&gt;&#xA;" OwnerUserId="1807" LastEditorUserId="1807" LastEditDate="2018-04-30T20:37:53.083" LastActivityDate="2018-04-30T20:37:53.083" CommentCount="7" ContentLicense="CC BY-SA 3.0" />
  <row Id="1964" PostTypeId="2" ParentId="1940" CreationDate="2018-04-30T17:27:07.010" Score="10" Body="&lt;p&gt;I don't think there are clear reasons for a 'yes' or a 'no' answer. However, I can provide a reason why &lt;strong&gt;PP&lt;/strong&gt; was much more likely to admit such a characterisation than &lt;strong&gt;NP&lt;/strong&gt; was, and to give some intuitions for why &lt;strong&gt;NP&lt;/strong&gt; might never have a &lt;em&gt;simple&lt;/em&gt; characterisation in terms of modification of the quantum computational model.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Counting complexity&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The classes &lt;strong&gt;NP&lt;/strong&gt; and &lt;strong&gt;PP&lt;/strong&gt; can both be characterised in terms of the number of accepting branches of a non-deterministic Turing machine, which we can describe in a more down-to-earth way in terms of the possible outcomes of a randomised computation which uses uniformly random bits. We can then &lt;em&gt;describe&lt;/em&gt; these two classes as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;L&lt;/em&gt;&amp;nbsp;&amp;in;&amp;nbsp;&lt;strong&gt;NP&lt;/strong&gt; if there is a polynomial-time randomised algorithm which outputs a single bit &lt;em&gt;&amp;alpha;&lt;/em&gt;&amp;nbsp;&amp;in;&amp;nbsp;{0,1}, such that &lt;em&gt;x&lt;/em&gt;&amp;nbsp;&amp;in;&amp;nbsp;&lt;em&gt;L&lt;/em&gt; if and only if &lt;strong&gt;Pr&lt;/strong&gt;[&amp;nbsp;&lt;em&gt;&amp;alpha;&lt;/em&gt;&amp;thinsp;=&amp;thinsp;1&amp;nbsp;|&amp;nbsp;&lt;em&gt;x&lt;/em&gt;&amp;nbsp;] is non-zero (though this probability may be tiny), as opposed to zero.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;L&lt;/em&gt;&amp;nbsp;&amp;in;&amp;nbsp;&lt;strong&gt;PP&lt;/strong&gt; if there is a polynomial-time randomised algorithm which outputs a single bit &lt;em&gt;&amp;alpha;&lt;/em&gt;&amp;nbsp;&amp;in;&amp;nbsp;{0,1}, such that &lt;em&gt;x&lt;/em&gt;&amp;nbsp;&amp;in;&amp;nbsp;&lt;em&gt;L&lt;/em&gt; if and only if &lt;strong&gt;Pr&lt;/strong&gt;[&amp;nbsp;&lt;em&gt;&amp;alpha;&lt;/em&gt;&amp;thinsp;=&amp;thinsp;1&amp;nbsp;|&amp;nbsp;&lt;em&gt;x&lt;/em&gt;&amp;nbsp;] is greater than 0.5 (though possibly only by the tiniest amount), as opposed to being equal to or less than 0.5 (&lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;by a tiny amount).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One way of seeing why these classes can't be practically solved using this probabilistic description, is that it may take exponentially many repeats to be confident of a probability estimate for &lt;strong&gt;Pr&lt;/strong&gt;[&amp;nbsp;&lt;em&gt;&amp;alpha;&lt;/em&gt;&amp;thinsp;=&amp;thinsp;1&amp;nbsp;|&amp;nbsp;&lt;em&gt;x&lt;/em&gt;&amp;nbsp;] because of the tininess of the differences in the probabilities involved.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Gap complexity and quantum complexity&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let us describe the outcomes '0' and '1' in the above computation as 'reject' and 'accept'; and let us call a randomised branch which gives a reject/accept result, a &lt;em&gt;rejecting&lt;/em&gt; or &lt;em&gt;accepting&lt;/em&gt; branch. Because every branch of the randomised computation which is not accepting is therefore rejecting, &lt;strong&gt;PP&lt;/strong&gt; can also be defined in terms of the difference between the number of accepting and rejecting computational paths &amp;mdash; a quantity which we may call the &lt;em&gt;acceptance gap&lt;/em&gt;: specifically, whether the acceptance gap is positive, or less than or equal to zero. With a little more work, we can obtain an equivalent characterisation for &lt;strong&gt;PP&lt;/strong&gt;, in terms of whether the acceptance gap is greater than some threshold, or less than some threshold, which may be zero or any other efficiently computable function of the input &lt;em&gt;x&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This in turn can be used to characterise languages in &lt;strong&gt;PP&lt;/strong&gt; in terms of quantum computation. From the description of &lt;strong&gt;PP&lt;/strong&gt; in terms of randomised computations having acceptance probabilities (possibly slightly) greater than 0.5, or at most 0.5, all problems in &lt;strong&gt;PP&lt;/strong&gt; admit a polynomial-time quantum algorithm which has the same distinction in acceptance probabilities; and by modelling quantum computations as a sum over computational paths, and simulating these paths using rejecting branches for paths of negative weight and accepting branches of paths of positive weight, we can also show that such a quantum algorithm making a (statistically weak) distinction describes a problem in &lt;strong&gt;PP&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is not obvious that we can do the same thing for &lt;strong&gt;NP&lt;/strong&gt;. There is no natural way to describe &lt;strong&gt;NP&lt;/strong&gt; in terms of acceptance gaps, and the obvious guess for how you might try to fit it into the quantum computational model &amp;mdash; by asking whether the probability of measuring an outcome '1' is zero, or non-zero &amp;mdash; instead gives you a class called &lt;strong&gt;coC&lt;sub&gt;=&lt;/sub&gt;P&lt;/strong&gt;, which is not known to equal &lt;strong&gt;NP&lt;/strong&gt;, and very roughly could be described as being about as powerful as &lt;strong&gt;PP&lt;/strong&gt; rather than close to &lt;strong&gt;NP&lt;/strong&gt; in power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, someday one might somehow find a characterisation of &lt;strong&gt;NP&lt;/strong&gt; in terms of acceptance gaps, or one might find new ways of relating quantum computation to counting complexity, but I'm not sure anyone has any convincing ideas of how this might come about.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Summary&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The prospects for getting insights into the &lt;strong&gt;P&lt;/strong&gt; versus &lt;strong&gt;NP&lt;/strong&gt; problem itself, via quantum computation, are not promising &amp;mdash; though it isn't impossible.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-23T10:19:21.220" LastActivityDate="2018-05-23T10:19:21.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1965" PostTypeId="1" AcceptedAnswerId="1981" CreationDate="2018-04-30T22:44:39.170" Score="6" ViewCount="218" Body="&lt;p&gt;I am trying to understand the HHL algorithm for solving linear systems of equations (Harrow, Hassidim, Lloyd; presented in &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0811.3171&lt;/a&gt; and explained on page 17 of &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1804.03719&lt;/a&gt;). By reading some papers, I think I got rough idea but there are many things I still do not understand. Let me ask some.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When applying Quantum Phase Estimation, in page 49 of &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;the same article&lt;/a&gt;, it says &quot;Prepare $n$ register qubits in $|0\rangle^{\bigotimes n}$ state with the vector $|b\rangle$&quot;, so that, by applying QPE to $|b\rangle |0\rangle^{\bigotimes n}$, we can get&#xA;$\sum_j \beta_j |u_j\rangle |\lambda_j\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And $|\lambda_j\rangle$ is the $j^{th}$ eigenvalue of matrix $A$ and $0 &amp;lt; \lambda_j &amp;lt; 1$, and $\left|u_j\right&amp;gt;$ is the corresponding eigenvector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also understand $|\lambda_j\rangle$ is the binary representation for fraction of $j^{th}$ eigenvalue of $A$. (i.e. $\left|01\right&amp;gt;$ for $\left|\lambda\right&amp;gt;=1/4$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1: How to decide $n$, how many qubits to prepare? I assume it is related to the precision of expressing the eigenvalue, but not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2: What to do if $\lambda_j$ of $A$ is $≤ 0$ or $≥ 1$?&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="23" LastEditDate="2018-05-01T08:24:58.853" LastActivityDate="2018-05-02T07:29:48.947" Title="HHL algorithm, how to decide n qubits to prepare for expressing eigenvalue of A?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1966" PostTypeId="1" CreationDate="2018-05-01T06:51:41.983" Score="6" ViewCount="99" Body="&lt;p&gt;At the beginning of a quantum computational process we generally want to start in a perfectly known initial state, and evolve from there. This cannot be done perfectly, for fundamental reasons, but I strongly suspect there has to be a practical limit below which you are in a garbage-in-garbage-out situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My full question is not on this input fidelity threshold per se (although feel free to provide that too), but rather on &lt;strong&gt;the factors to consider and minimum set(s) of requirements one needs to prepare a good-enough initial state&lt;/strong&gt; (maybe Di-Vincenzo-list style, but preferrably with some example numbers). Presumably the perfect answer has different sections, for example depending on whether one employs thermal initialization or algorithmic cooling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a little more context, this question is related with certain aspects of previous ones:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1889/are-there-measuring-standards-and-units-for-the-identification-of-qubits&quot;&gt;Are there measuring standards (and units) for the identification of qubits?&lt;/a&gt; (what could this kind of prospective standards say about initialization in different platforms?)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1958/are-true-projective-measurements-possible-experimentally&quot;&gt;Are true Projective Measurements possible experimentally?&lt;/a&gt; (perfect projective measurements plus sufficiently coherent operations -including quantum error correction- would make good-enough initialization, but how do we deal with imperfect projective measurements?)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1861/is-it-true-that-observing-a-quantum-state-will-end-the-superposition-of-states/&quot;&gt;Is it true that observing a quantum state will end the superposition of states, and how not to observe?&lt;/a&gt; (&quot;&lt;em&gt;How can i be sure my input was put in without looking?&lt;/em&gt;&quot;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-05-01T06:51:41.983" Title="Threshold and practical requirements for initial state preparation?" Tags="&lt;quantum-state&gt;&lt;noise&gt;&lt;technical-standards&gt;&lt;initialization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1967" PostTypeId="1" AcceptedAnswerId="1982" CreationDate="2018-05-01T12:34:54.377" Score="10" ViewCount="694" Body="&lt;p&gt;On the &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia page for Grover's algorithm&lt;/a&gt;, it is mentioned that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;Grover's algorithm can also be used for estimating the mean and median of a set of numbers&quot;&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I only knew how it can be used to search a database. But not sure how to implement that technique to estimate the mean and median of a set of numbers. Moreover, there's no citation (as far as I noticed) on that page which explains the technique.  &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-01T20:21:55.750" LastActivityDate="2018-05-02T10:02:07.387" Title="How is Grover's algorithm used to estimate the mean and median of a set of numbers?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 3.0" />
  <row Id="1968" PostTypeId="5" CreationDate="2018-05-01T12:56:55.537" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-01T12:56:55.537" LastActivityDate="2018-05-01T12:56:55.537" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1969" PostTypeId="4" CreationDate="2018-05-01T12:56:55.537" Score="0" Body="A stabilizer quantum error-correcting code appends ancilla qubits to qubits that we want to protect. A unitary encoding circuit rotates the global state into a subspace of a larger Hilbert space. This highly entangled, encoded state corrects for local noisy errors.&#xD;&#xA;&#xD;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-01T21:53:52.287" LastActivityDate="2018-05-01T21:53:52.287" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1970" PostTypeId="2" ParentId="1955" CreationDate="2018-05-01T15:59:13.590" Score="5" Body="&lt;p&gt;It is certainly sufficient to always calculate the full $2^n\times 2^n$ unitary matrix, and then apply it to the $2^n$-entry state vector. If that's what you choose to do, that's &lt;em&gt;all&lt;/em&gt; you have to do as all the entanglement information is contained in that vector. A quick and easy way to see if a particular qubit is entangled is to take the partial trace of your (pure) state vector over all other qubits. If the resulting matrix is rank 1, that qubit is in a separable state, otherwise it's entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume the point of your question is really &quot;How can this huge computational cost be avoided?&quot;. In general, it can't - if you're making use of the full power of the quantum computer, you will always need the $2^n$-entry state vector. However, there are various tricks that reduce the computational cost, such as delaying the need for such a large state vector by keeping track of the entanglement.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Efficiency Improvements&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The biggest saving that you can make compared to the naive implementation above is to avoid the $2^n\times 2^n$ unitary matrices. For example, if you are only using 1- or 2-qubit gates, simply using the sparsity of matrices means you only need $O(2^n)$ storage instead of $O(2^{2n})$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then there are other tactics that you can employ. For example, imagine you want to apply the two-qubit unitary gate $U$ on qubits $i$ and $j$. You can take sets of 4 elements from your state vector ($|x\rangle_{1,2,\ldots n\setminus i,j}|y\rangle_{i,j}$ for fixed $x\in\{0,1\}^{n-2}$ by taking all different $y\in\{0,1\}^2$) and just applying the $4\times 4$ unitary $U$ on that 4-element vector. Repeating this for every $x$ will return $U$ enacted on the original state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine there are other strategies one could come up with. The one that suggested itself from the original question was entanglement tracking. This gives memory and speed improvements at the start of a computation, but ultimately ends up being equivalent because (presumably) everything in the quantum computer will end up entangled.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Entanglement Tracking&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let's assume that your computation consists of &lt;em&gt;only&lt;/em&gt; unitary evolution and measurement on the set of $n$ qubits, i.e. there is no decoherence, probabilistic maps etc. Let's further assume that you start from a fully separable state such as $|0\rangle^{\otimes n}$. At this point, every qubit is separable, and it is sufficient to keep $n$ different registers, each conveying the state of a separable qubit. If your first gate is just a single-qubit operation $U$ on qubit $i$, then you just update the state stored on qubit $i$ as $|\psi_i\rangle\mapsto U|\psi_i\rangle$, and you don't have to touch anything else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to do a two-qubit gate $V$ between qubits $i$ and $j$, say, then you have to combine the states at both sites. So, you replace two registers each of dimension 2 with one register of dimension 4, containing state $V|\psi_i\rangle|\psi_j\rangle$. The problem is that you now can't split this state up again, so you have to keep those two qubits in a register forever after. Of course, if you ever have a 1-qubit gate $U$ to apply on qubit $i$, you'll now have to apply $|\psi_{i,j}\rangle\mapsto U\otimes\mathbb{I}|\psi_{i,j}\rangle$. Then, the next time you want a 2-qubit gate between, say, $j$ and $k$, you'll have to combine the spaces for $(i,j)$ and $k$. Those spaces will keep growing, but if a gate is localised on just one space, you only have to apply it there (using $\mathbb{I}$ operators to pad it on the rest of the qubits), and you don't have to do anything to the other spaces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're doing things like this, you will not have (at least for the first few steps of your algorithm) a single $2^n$ element register. You'll have to have a bunch of different registers, and keep track of which qubits are described by which register in a separate array. Each time you combine the spaces of some qubits, you'll update that extra array.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's some very crude pseudo-code that may help to convey my meaning:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#initialise variables&#xA;entangled_blocks={{1},{2},{3},...,{n}}&#xA;quantum_states={{1,0},{1,0},...,{1,0}}&#xA;&#xA;#apply action of each gate&#xA;for each gate&#xA;   for each gate_target&#xA;       target_block=entangled_blocks entry containing gate_target&#xA;   next gate_target&#xA;   if all target_blocks equal then&#xA;      apply gate on target_block (pad with identity on other qubits)&#xA;   else&#xA;      new_entangled_block=union(target_blocks)&#xA;      new_state_vec=tensor_product(quantum_states for each target block)&#xA;      apply gate on new_state_vec (pad with identity on other qubits)&#xA;      replace all target_blocks in entangled_blocks with new_entangled_block&#xA;      replace all quantum_states(all target blocks) with new_state_vec&#xA;   end if&#xA;next gate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Other Options&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;(By no means exhaustive)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may be interested to read about Matrix Product States which are a nice way of encapsulating the information about not-too entangled states, and that may provide an alternative route for you, depending on exactly what it is that you're trying to achieve.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-03T06:07:52.143" LastActivityDate="2018-05-03T06:07:52.143" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="1972" PostTypeId="2" ParentId="1926" CreationDate="2018-05-01T17:27:28.730" Score="11" Body="&lt;p&gt;I don't think there is a &lt;em&gt;single&lt;/em&gt; golden resource which can you provide you all the necessary knowledge. But I could suggest a pathway (or &lt;em&gt;schematic study guide&lt;/em&gt; in your words):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your aim is to create a &lt;em&gt;new&lt;/em&gt; quantum programming language I'd rather say you should thoroughly learn an existing quantum programming language first along with the basic concepts of quantum computing, both from the physics side and the computer science side (maybe even the Mathematics side!).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Microsoft has their quantum programming language named &lt;strong&gt;Q#&lt;/strong&gt; (which is a part of their &lt;strong&gt;Quantum Development Kit&lt;/strong&gt;). The complete documentation-cum-guide is on their website: &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum&quot; rel=&quot;noreferrer&quot;&gt;https://docs.microsoft.com/en-us/quantum&lt;/a&gt;. If you are from the CS side, I hope you already have &lt;em&gt;some&lt;/em&gt; knowledge of vectors, matrices and linear algebra in general. If so, you can directly start reading the guide article-by-article. Initially, they start with a brief revision of matrices, vectors, etc. followed by a brief introduction to qubits. That much is sufficient for at least getting started with writing a basic quantum program, with minimal understanding of the physics behind it. By the way, if your linear algebra concepts are weak, you could always try &lt;strong&gt;Khan Academy&lt;/strong&gt;'s lectures on the same.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next, you'd want to learn at least some basics of quantum mechanics. I personally love &lt;a href=&quot;https://www.youtube.com/playlist?list=PL2jykFOD1AWap0r8WOuZ-08BFgMyx-5RT&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Professor Vazirani's lectures&lt;/strong&gt;&lt;/a&gt;, which are now on Youtube. In about 60 ten minute lectures he covers all the necessary basics of quantum mechanics and quantum computation algorithms. After this, you'd be in good shape to pick up new algorithms on your own.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As a third step, I'd suggest picking up &quot;&lt;strong&gt;Quantum Computation and Quantum Information by Isaac Chuang and Michael Nielsen&lt;/strong&gt;&quot; and also &quot;&lt;strong&gt;Quantum Computing for Computer Scientists by Mirco A. Mannucci and Noson S. Yanofsky&lt;/strong&gt;&quot; for covering the important topics which you missed out. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;That should be enough for you to get a solid grounding to start writing your own quantum programming language. You may also look into tutorials for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming&quot; rel=&quot;noreferrer&quot;&gt;other common quantum computing languages&lt;/a&gt; to get an idea of how to write quantum programs and design quantum programming languages.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-01T17:32:56.943" LastActivityDate="2018-05-01T17:32:56.943" CommentCount="0" ContentLicense="CC BY-SA 3.0" />
  <row Id="1973" PostTypeId="1" AcceptedAnswerId="1980" CreationDate="2018-05-01T19:27:39.140" Score="11" ViewCount="680" Body="&lt;p&gt;I am aware of the quantum hardware startup &lt;a href=&quot;https://www.rigetti.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rigetti&lt;/a&gt; and I wonder if there are any quantum startups that build software on top of current quantum computer hardware for commercial applications?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1918/does-a-complete-list-of-open-quantum-software-projects-exist&quot;&gt;Does a complete list of open quantum software projects exist?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2287" LastEditorUserId="26" LastEditDate="2018-12-13T19:48:35.230" LastActivityDate="2019-03-03T15:23:39.357" Title="Are there any quantum software startups?" Tags="&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1974" PostTypeId="1" AcceptedAnswerId="1989" CreationDate="2018-05-01T21:06:11.837" Score="2" ViewCount="306" Body="&lt;p&gt;I just came across this (apparently) entropy-reversing &lt;a href=&quot;https://www.youtube.com/watch?v=LrmK9kDc5SM&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt;. It is in fact nothing more than a computer-generated animation: first rendering the physical simulation of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bean_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;bean machine&lt;/a&gt; (often seen in statistical mechanics educational experiments) using color-neutral balls and then assigning color by their destination bin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fGLub.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fGLub.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find this amusing from a computational perspective, and hence my questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If it was possible to achieve the portrayed effect physically, a &lt;em&gt;spontaneous&lt;/em&gt; sorting based on pairwise interactions between the objects, what would be the computational implications of such effect?&lt;/li&gt;&#xA;&lt;li&gt;Are there any quantum algorithms described/implemented that achieve some kind of &lt;em&gt;spontaneous&lt;/em&gt; sorting based on interference between the objects to be sorted? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1346" LastEditorUserId="1847" LastEditDate="2018-05-03T07:25:49.093" LastActivityDate="2018-05-03T09:19:26.153" Title="What is the relation between this CGI device and a quantum sorting algorithm?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="1975" PostTypeId="2" ParentId="1973" CreationDate="2018-05-01T21:26:52.170" Score="7" Body="&lt;p&gt;Rigetti is not just a hardware company. It also builds quite a bit of software -- check out &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.rigetti.com/index.php/forest&quot; rel=&quot;noreferrer&quot;&gt;Forest&lt;/a&gt;, which gives access to both a simulator and a quantum computer via the cloud&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/rigetticomputing/pyquil&quot; rel=&quot;noreferrer&quot;&gt;PyQuil&lt;/a&gt;, a Python library for programming quantum computers&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/rigetticomputing/grove&quot; rel=&quot;noreferrer&quot;&gt;Grove&lt;/a&gt;, a Python library of quantum algorithmic primitives&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/rigetticomputing/forestopenfermion&quot; rel=&quot;noreferrer&quot;&gt;Forest OpenFermion&lt;/a&gt;, a library to interface &lt;a href=&quot;https://github.com/quantumlib/OpenFermion&quot; rel=&quot;noreferrer&quot;&gt;OpenFermion&lt;/a&gt; with Forest&lt;/li&gt;&#xA;&lt;li&gt;Many more projects on &lt;a href=&quot;https://github.com/rigetticomputing&quot; rel=&quot;noreferrer&quot;&gt;Github&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; I work at Rigetti&lt;/p&gt;&#xA;" OwnerUserId="2129" LastEditorUserId="2129" LastEditDate="2018-05-03T03:30:39.680" LastActivityDate="2018-05-03T03:30:39.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1976" PostTypeId="1" AcceptedAnswerId="1977" CreationDate="2018-05-01T21:55:31.737" Score="7" ViewCount="256" Body="&lt;p&gt;I read the basic introductory information about qubits on Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are two possible outcomes for the measurement of a qubit—usually&#xA;  0 and 1, like a bit. The difference is that whereas the state of a bit&#xA;  is either 0 or 1, the state of a qubit can also be a superposition of&#xA;  both. [&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information_(book)&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The state of a three-qubit quantum computer is similarly described by&#xA;  an eight-dimensional vector&#xA;  $(a_{0},a_{1},a_{2},a_{3},a_{4},a_{5},a_{6},a_{7})$ (or a one&#xA;  dimensional vector with each vector node holding the amplitude and the&#xA;  state as the bit string of qubits). [&lt;a href=&quot;http://science.sciencemag.org/content/270/5234/255&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hence does it mean that qubit using superdense coding can achieve a double capacity with the possible number of combinations of $2^{2^n}$?&lt;/p&gt;&#xA;" OwnerUserId="2290" LastEditorUserId="26" LastEditDate="2018-12-23T12:23:33.367" LastActivityDate="2018-12-23T12:23:33.367" Title="Does superdense coding allow to double the information capacity of a set of qubits?" Tags="&lt;quantum-state&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="1977" PostTypeId="2" ParentId="1976" CreationDate="2018-05-02T04:42:01.587" Score="7" Body="&lt;p&gt;The short answer is no: we don't &lt;em&gt;double the capacity&lt;/em&gt;. It turns out it's not that quite simple. There is no general mathematical expression that gives you the storage (or processing power) of a number of qubits in terms of bits. Bits, qubits and ebits work in qualitatively different ways, which in some contexts allows to draw an advantage.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing to an answer to your question are the so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/Bennett&amp;#39;s_laws&quot; rel=&quot;noreferrer&quot;&gt;Bennett's laws&lt;/a&gt;, four inequalities comparing the practical information contents of classical bits, quantum bits (or qubits) and entanglement bits (or ebits), reproduced here from wikipedia. The ⩾ signs are to be taken as &quot;&lt;em&gt;can do the job of&lt;/em&gt;&quot;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 qubit ⩾ 1 bit (classical),&lt;/li&gt;&#xA;&lt;li&gt;1 qubit ⩾  1 ebit (entanglement bit),&lt;/li&gt;&#xA;&lt;li&gt;1 ebit + 1 qubit ⩾  2 bits (via superdense coding),&lt;/li&gt;&#xA;&lt;li&gt;1 ebit + 2 bits ⩾  1 qubit (via quantum teleportation),&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On the particular aspect of superdense coding, I refer you to the question &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1920/what-are-the-real-advantages-of-superdense-coding&quot;&gt;What are the real advantages of superdense coding?&lt;/a&gt;&quot; and its answers.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-05-02T06:18:58.810" LastActivityDate="2018-05-02T06:18:58.810" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1979" PostTypeId="2" ParentId="1899" CreationDate="2018-05-02T05:53:49.913" Score="1" Body="&lt;p&gt;No quantum computing approach has ever been successful for predicting a reaction rate or transition state that a classical computer could not already do. There are many quantum algorithms for solving the FCI problem with a polynomial number of quantum-computer gates, so there are many algorithms that show promise for building the high-accuracy potential energy surfaces to study the reactions you describe.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-02T05:53:49.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1980" PostTypeId="2" ParentId="1973" CreationDate="2018-05-02T07:04:06.317" Score="8" Body="&lt;p&gt;There are lots of startups, many of which have no hardware efforts. Here is a selection, distinguished only by the fact that I have heard of them at least once.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://artiste-qb.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;artiste.qb&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cambridgequantum.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cambridge Quantum Computing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://horizonquantum.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horizon&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://q-ctrl.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q-Ctrl&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://quantumbenchmark.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Benchmark&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.qxbranch.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q&lt;span class=&quot;math-container&quot;&gt;$^x$&lt;/span&gt; Branch&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://strangeworks.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strangeworks&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://zapatacomputing.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zapata&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are also &lt;a href=&quot;https://www.qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit&lt;/a&gt; and &lt;a href=&quot;https://projectq.ch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ProjectQ&lt;/a&gt;. Though not startups, they also deserve a mention as important quantum software projects.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2019-03-03T15:23:39.357" LastActivityDate="2019-03-03T15:23:39.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1981" PostTypeId="2" ParentId="1965" CreationDate="2018-05-02T07:29:48.947" Score="2" Body="&lt;p&gt;The number $n$ decides the size of the register to be used for phase estimation, which in turn determines the accuracy. If you knew your eigenvalues (for a unitary) were a subset of the ${2^n}^{th}$ roots of unity, $e^{2\pi i m/2^n}$, then using $n$ bits is guaranteed to give you the exact answer. Assuming you don't have exactly this guarantee, then you can think of the phase estimation as returning the best $n$-bit approximation of those values, i.e. $\phi/(2\pi)$, where the eigenvalue is $e^{i\phi}$, would be approximated to within $1/2^{n+1}$ (with caveats about the probability of this happening, which we can lower-bound by $4/\pi^2$, and can improve further by using a slightly larger $n$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If memory serves, what you want to do to prepare $A$ is two things (I'm leaving out the connection between implementing a non-unitary $A$ and the unitaries required for phase estimation, since you didn't ask):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Add enough $\mathbb{I}$ so that $A^{(1)}=A^{(0)}+B\mathbb{I}$ is non-negative (i.e. all $\lambda_i\geq 0$)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Rescale to $A=\epsilon A^{(1)}$ so that the maximum eigenvalue is less than 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These operations don't change the eigenvectors, and change the eigenvalues by known amounts that you can compensate for later, $\lambda_i=\epsilon(\lambda_i^{(0)}+B)$. You might worry that this rescaling requires you to know the very information that you're trying to calculate. However, it's easy to make at least some crude estimates of the limits of the spectrum via, for example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Gershgorin_circle_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gershgorin's Circle Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, you could probably get away with just a rescaling (and no $\mathbb{I}$) if you ensure all eigenvalues are in the range $-1/2$ to $1/2$, due to the periodicity of the Quantum Fourier Transfer, but making use of it gives you the maximum opportunity to spread all the eigenvalues out as much as possible, and hence to get as accurate an estimate on them as possible.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-02T07:29:48.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1982" PostTypeId="2" ParentId="1967" CreationDate="2018-05-02T09:43:28.677" Score="9" Body="&lt;p&gt;The idea for estimating the mean is roughly as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For any $f(x)$ that gives outputs in the reals, define a rescaled $F(x)$ that gives outputs in the range 0 to 1. We aim to estimate the mean of $F(x)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Define a unitary $U_a$ whose operation is $$U_a:|0\rangle|0\rangle\mapsto\frac{1}{2^{n/2}}\sum_x|x\rangle(\sqrt{1-F(x)}|0\rangle+\sqrt{F(x)}|1\rangle).$$ It is important to note that this unitary is easily implemented. You start with a Hadamard transform on the first register, perform a computation of $f(x)$ on an ancilla register, use this to implement a controlled-rotation of the second register, and then uncompute the ancilla register.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Define the unitary $G=U_a (\mathbb{I}-2|0\rangle\langle 0|\otimes |0\rangle\langle 0|)U_a^\dagger \mathbb{I}\otimes Z$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Starting from a state $U_a|0\rangle|0\rangle$, use $G$ much like you would use the Grover iterator to estimate the number of solutions to a search problem.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The main bulk of this algorithm is amplitude amplification, as described &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005055&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. The main idea is that you can define two states&#xA;$$&#xA;|\psi\rangle=\frac{1}{\sqrt{\sum_x F(x)}}\sum_x\sqrt{F(x)}|x\rangle|1\rangle \qquad |\psi^\perp\rangle=\frac{1}{\sqrt{\sum_x 1-F(x)}}\sum_x\sqrt{1-F(x)}|x\rangle|0\rangle,&#xA;$$&#xA;and this defines a subspace for the evolution. The initial state is $U_a|0\rangle|0\rangle=(\sqrt{\sum_x F(x)}|\psi\rangle+\sqrt{\sum_x 1-F(x)}|\psi^\perp\rangle)2^{-n/2}$. The amplitude of the $|\psi\rangle$ term clearly contains the information about the mean of $F(x)$, if we could just estimate it. You could just repeatedly prepare this state and measure the probability of getting a $|1\rangle$ on the second register, but Grover's search gives you a quadratic improvement. If you compare to the way Grover's is usually set up, the amplitude of this $|\psi\rangle$ which you can 'mark' (in this case by applying $\mathbb{I}\otimes Z$) would be $\sqrt{\frac{m}{2^n}}$ where $m$ is the number of solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, this is interesting to compare to the &quot;power of one clean qubit&quot;, also known as DQC1. There, if you apply $U_a$ to $\frac{\mathbb{I}}{2^n}\otimes|0\rangle\langle 0|$, the probability of getting the 1 answer is just the same as the non-accelerated version, and gives you an estimate of the mean.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the median, it can &lt;a href=&quot;https://arxiv.org/abs/1106.4267&quot; rel=&quot;noreferrer&quot;&gt;apparently&lt;/a&gt; be defined as the value $z$ that minimises&#xA;$$&#xA;\sum_x|f(x)-f(z)|.&#xA;$$&#xA;There are two steps here. The first is to realise that the function we're trying to minimise over is basically just a mean. Then the second step is to use a &lt;a href=&quot;http://xxx.lanl.gov/abs/quant-ph/9607014&quot; rel=&quot;noreferrer&quot;&gt;minimisation algorithm&lt;/a&gt; which can also be accelerated by a Grover search. The idea here is to use a Grover's search, and mark all items for which the function evaluation gives a value less than some threshold $T$. You can estimate the number of inputs $x$ that give $f(x)\leq T$, then repeat for a different $T$ until you localise the minimum value sufficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, I am skipping over some details of precise running times, error estimates etc.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-02T10:02:07.387" LastActivityDate="2018-05-02T10:02:07.387" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="1985" PostTypeId="2" ParentId="1687" CreationDate="2018-05-03T00:08:12.210" Score="4" Body="&lt;p&gt;&lt;strong&gt;Answer:&lt;/strong&gt; Fidelity of 0.9999 at 1.08 seconds in 2013: &lt;a href=&quot;http://science.sciencemag.org/content/342/6160/830.full?ijkey=uhZaDNPnwgTdA&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;Science 2013&quot;&gt;http://science.sciencemag.org/content/342/6160/830.full?ijkey=uhZaDNPnwgTdA&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More details&lt;/strong&gt;: The $T_2$ was 180 minutes, or 3 hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What about the 81% that Heather mentioned?&lt;/strong&gt;: The fidelity of 81% that Heather quotes, was actually referring to something else. In the same paper they wanted to show that they could change the temperature of the sample while still maintaining the spins in a coherent superposition. The sample was increased in temperature from 4.2K to 300K gradually over 6 minutes, held there for 2 minutes, then reduced back to 4.2K gradually over 4 minutes. After doing all that, the spins had impressively maintained a fidelity of 81% with respect to the starting state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that 12 minute experiment where they wanted to show that they can maintain coherence even when majorly disturbing the thermal equilibrium of the sample, was far less than the 3 hours $T_2$ they measured in an experiment where the coherence survived for 300 minutes (5 hours) with temperature kept constant at 1.2K.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What about the 2014 paper with 0.9999 fidelity?&lt;/strong&gt;: This comes from Figure S2c in the Supplement, which is only up to 0.0002 seconds. If you want to get the fidelity at 30 seconds, or at 180 minutes, look at the $T_2$ times in Fig S1 of the supplement, and you will see that all of these are orders of magnitude smaller than what it was in the 2013 paper. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors admit this 3 times: &lt;br&gt;&#xA;1) &quot;Despite the record coherence times discussed above, our results do not match those obtained in bulk ensembles[6–8]&quot; Reference 8 is the 2013 paper. &lt;br&gt;&#xA;2) &quot;This currently represents the record coherence for any &lt;em&gt;single&lt;/em&gt; qubit in the solid state.&quot; Note they say &quot;single&quot; qubit and &quot;solid state&quot;. &lt;br&gt;&#xA;3) &quot;which reach here a new record for solid-state single qubits with $T_2$ &gt; 30 s in the $^{31}$P$^+$spin&quot; Note the 30s is a T2!! This is much smaller than the $T_2$ = 180 minutes mentioned above.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-03T23:27:01.880" LastActivityDate="2018-05-03T23:27:01.880" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="1986" PostTypeId="5" CreationDate="2018-05-03T07:19:37.283" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-03T07:19:37.283" LastActivityDate="2018-05-03T07:19:37.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1987" PostTypeId="4" CreationDate="2018-05-03T07:19:37.283" Score="0" Body="For questions regarding the initial state of a system for quantum computation and their preparation." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:08:08.637" LastActivityDate="2019-01-01T10:08:08.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1988" PostTypeId="1" AcceptedAnswerId="1994" CreationDate="2018-05-03T09:10:56.473" Score="18" ViewCount="1125" Body="&lt;p&gt;I recently noticed that Oxford's computer science department has started offering &lt;a href=&quot;https://www.cs.ox.ac.uk/teaching/courses/cqm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;a grad course&lt;/a&gt; on &lt;a href=&quot;https://en.wikipedia.org/wiki/Categorical_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;categorical quantum mechanics&lt;/a&gt;. Apparently they say that it is relevant for the study of quantum foundations and quantum information, and that it uses paradigms from category theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How exactly does it help in the study of quantum information?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Has this formulation actually produced any new results or predictions apart from what our general formulation of quantum mechanics has already done? If so, what are those?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-02-14T18:51:28.677" LastActivityDate="2021-02-14T18:51:28.677" Title="What is the use of categorical quantum mechanics?" Tags="&lt;foundations&gt;&lt;category-theory&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="1989" PostTypeId="2" ParentId="1974" CreationDate="2018-05-03T09:19:26.153" Score="2" Body="&lt;p&gt;We could assign integers from $1$ to $k$ for each colour. This then becomes an &lt;a href=&quot;https://en.wikipedia.org/wiki/Integer_sorting&quot; rel=&quot;nofollow noreferrer&quot;&gt;integer sort&lt;/a&gt; of $n$ balls over a range of integers $r$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm no expert on such sorting algorithms, but it seems that they can be done with a &lt;a href=&quot;https://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;worst case time complexity&lt;/a&gt; of $O(n+r)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the interacting bean machine to beat this, it would need to be faster to pass $n$ balls through a board of width $r$ (and I'll assume height $r$ too). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we pass the balls through one-by-one, the falling process would presumably take $O(r)$ time in each case. So for the $n$ balls, that makes $O(nr)$ time, which is much too slow. They also wouldn't get any opportunity to interact, unless the falling was a quantum process with interference effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we pass many balls through at once, the time taken for the process will depend on the dynamics of the balls, which depends on how they interact. If the interaction were to simulate a known sorting algorithm, the falling time would reflect that algorithm's time complexity. If the interaction does not simulate a known sorting algorithm, it could be used to define a new algorithm. The nature of the interaction (classical or quantum) would determine the kind of computer that we could run that algorithm on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in answer to your first question, we would need to know how the spontaneous sorting occurs to know how it compares to known algorithms.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-03T09:19:26.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1990" PostTypeId="5" CreationDate="2018-05-03T09:47:14.123" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-03T09:47:14.123" LastActivityDate="2018-05-03T09:47:14.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1991" PostTypeId="4" CreationDate="2018-05-03T09:47:14.123" Score="0" Body="Categorical quantum mechanics is the study of quantum foundations and quantum information using paradigms from higher mathematics, notably monoidal category theory and string diagrams." OwnerUserId="26" LastEditorUserId="124" LastEditDate="2018-07-13T10:33:46.453" LastActivityDate="2018-07-13T10:33:46.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1992" PostTypeId="2" ParentId="1926" CreationDate="2018-05-03T11:18:10.910" Score="6" Body="&lt;p&gt;I’d suggest you reflect upon whether goal of &quot;making a new quantum programming language&quot; is suitable at this point in the development of quantum computation. It is not the most common approach, since mostly we are still at the stage of thinking in terms of what is essentially machine language. When we create algorithms, the level at which this is done is similar to expressing classical algorithms in terms of logic gates (such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Binary_multiplier&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; for multiplication). The quantum SDKs, like QISKit are essentially ways of creating jobs to be sent to quantum hardware or simulators. This includes tools for performing simulations, optimizing for run time or noise levels, etc. They aren't really languages in the high-level sense we are used to for classical computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an introduction to what is going on at this level of the quantum stack, &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/0999063502&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q is for Quantum&lt;/a&gt; by Terry Rudolph might be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your intermediate goal of writing programs with QISKit, I'd recommend the &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit tutorial&lt;/a&gt;. It has many worked examples of implementing short quantum programs. There is also a &lt;a href=&quot;https://medium.com/qiskitters&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit publication on Medium&lt;/a&gt; in which some of the things in the tutorial are explained in more detail. There is also a &lt;a href=&quot;https://github.com/decodoku/Quantum_Programming_Tutorial&quot; rel=&quot;nofollow noreferrer&quot;&gt;gamified tutorial to QISKit&lt;/a&gt;, which might be useful as a warm-up for the full QISKit tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Full dislosure: I have contributed to all the things mentioned in the final paragraph.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-05-13T18:40:35.547" LastActivityDate="2018-05-13T18:40:35.547" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="1993" PostTypeId="2" ParentId="1973" CreationDate="2018-05-03T11:44:54.047" Score="4" Body="&lt;p&gt;Apart from the ones &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1980/26&quot;&gt;James Wotton mentioned&lt;/a&gt;, recently &lt;a href=&quot;https://www.ibm.com/blogs/research/2018/04/ibm-startups-accelerate-quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM collaborated with a few top quantum computing software startups&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;Zapata Computing&lt;/strong&gt; – Based in Cambridge, MA, Zapata Computing is a quantum software, applications and services company developing&#xA;  algorithms for chemistry, machine learning, security, and error&#xA;  correction.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;Strangeworks&lt;/strong&gt; (our site's sponsor!) – Based in Austin, TX and founded by William Hurley, Strangeworks is a quantum computing&#xA;  software company designing and delivering tools for software&#xA;  developers and systems management for IT Administrators and CIOs.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;QC Ware&lt;/strong&gt; – Based in Palo Alto, CA, QC Ware develops hardware-agnostic enterprise software solutions running on quantum&#xA;  computers. QC Ware’s investors include Airbus Ventures, DE Shaw&#xA;  Ventures and Alchemist, and it has relationships with NASA and other&#xA;  government agencies. QC Ware won a NSF grant, and its customers&#xA;  include Fortune 500 industrial and technology companies.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;&lt;strong&gt;1QBit&lt;/strong&gt; – Headquartered in Vancouver, Canada, 1QBit builds quantum and quantum-inspired software designed to solve the world’s&#xA;  most demanding computational challenges. The company’s&#xA;  hardware-agnostic platforms and services are designed to enable the&#xA;  development of applications which scale alongside the advances in both&#xA;  classical and quantum computers. 1QBit is backed by Fujitsu Limited,&#xA;  CME Ventures, Accenture, Allianz and The Royal Bank of Scotland.  &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;Apart from these, the list also includes &lt;strong&gt;Cambridge Quantum Computing&lt;/strong&gt;,&#xA;  &lt;strong&gt;QxBranch&lt;/strong&gt; and &lt;strong&gt;Quantum Benchmark&lt;/strong&gt;. But James already mentioned them! :-)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As of now, it seems USA is leading in the number of quantum computing startups. I'd like to hear from others about startups in this area, in the other countries, too. And well, congratulations to &lt;a href=&quot;https://strangeworks.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strangeworks&lt;/a&gt;! They have been doing great.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-05-03T11:44:54.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1994" PostTypeId="2" ParentId="1988" CreationDate="2018-05-03T11:45:52.027" Score="15" Body="&lt;p&gt;This answer is the opinion of someone who is essentially an outsider to &quot;CQM&quot; (= Categorical Quantum Mechanics), but a broadly sympathetic outsider. It should be interpreted as such.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The motivations of CQM&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The motivations of Categorical quantum mechanics are not computation as such, but &lt;em&gt;logic&lt;/em&gt;; and not quantum dynamics as such, but &lt;em&gt;foundations of physics&lt;/em&gt;. The symptoms of this can be seen in what it describes as its achievements and points of reference, for instance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Its results about &quot;completeness&quot; should be interpreted in the same sense as it would in &lt;a href=&quot;https://en.wikipedia.org/wiki/G%C3%B6del%27s_completeness_theorem&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;G&amp;ouml;del's Completeness Theorem&lt;/em&gt;&lt;/a&gt; [sic]: that a set of axioms can perfectly capture a model, which in this case is the model of transformations on a set of qubits expressed in terms of transformations of degrees of freedom expressed in terms of the Z and X eigenbases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Occasional comparisons to things like &quot;&lt;strong&gt;Rel&lt;/strong&gt;&quot; (that is: the category of relations, which from a computational point of view is more closely allied to non-deterministic Turing machines than quantum computers) illustrate the fact that they are aware of quantum information theory as being part of a larger landscape of computational theories, where the distinctions between these theories may lead to a robust top-down intuition about what distinguishes quantum theory from other possible dynamical theories of information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus CQM is very much more in a tradition of &lt;a href=&quot;https://perimeterinstitute.ca/conferences/foundations-quantum-mechanics&quot; rel=&quot;noreferrer&quot;&gt;foundations of physics&lt;/a&gt; and &lt;a href=&quot;https://blog.computationalcomplexity.org/2003/03/theory-and-theory-b.html&quot; rel=&quot;noreferrer&quot;&gt;the Theory B branch of computer science&lt;/a&gt;. So if it does not seem to have developed a lot of &quot;applications&quot; as such, you should not be surprised, because the development of applications is not its primary motivation. (And of course, so far only a very small subset of people in the field are ever really exposed to it.)&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Why CQM might seem a bit obscure&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The difference in motivation of CQM to the rest of the field, also reveals itself in the approach which is taken to analysis, in which linear algebra over $\mathbb C$ takes very much a background role.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Linear algebra over $\mathbb C$ is certainly still present in the background, essentially as the target model for CQM. But the usual approach to quantum mechanics in terms of linear algebra over $\mathbb C$ it is seen as potentially obscuring &quot;what is actually going on&quot;. And to give the proponents of CQM their due, they have a good argument here: the usual presentation of quantum information theory, starting from vectors over $\mathbb C$ and unitary transformations, working through density operators and CPTP maps, requires a non-trivial amount of work to develop an intuition of what it is for and in what ways it differs (&lt;em&gt;and in what ways it does not differ&lt;/em&gt;) from probability theory. It is certainly possible to get that intuition by the usual complex-linear-algebraic approach, but the proponents of CQM would claim that the usual approach is not likely to be the most effective approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CQM attempts to put the intuitive meaning front-and-centre, in a mathematically rigorous way. This obligates them to talk about such apparently obscure things as &quot;dagger commutative Frobenius algebras&quot;. Of course, such terminology means little to nothing to almost anyone else in the field &amp;mdash; but then this is not much different from how quantum information theorists come across to other computer scientists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just the starting point of the potential confusion for an outsider &amp;mdash; as those pursuing CQM are in effect mathematicians/logicians with top-down motivations, there is not one single thread of research in CQM, and there is not a sharp boundary between work on CQM and work in higher category theory. This is analogous to the lack of sharp boundary between computational complexity expressed in terms of quantum circuits, quantum communication complexity, query complexity, and the classical version of these topics, along with Fourier analysis and other relevant mathematical tools. Without a clear frame of reference, it can sometimes be a bit confusing as to where CQM begins and ends, but it has in principle as well-defined a notion of scope as any other topic in quantum information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wonder why people might like to investigate CQM rather than a more mainstream question in quantum information theory, we should first acknowledge that there are other lines of research in quantum information theory which are not exactly directed towards meaningful impact on anyone else. If we are happy for people to do research into such things as approaches to quantum computation involving physical phenomena which no-one has yet exhibited in the lab [&lt;a href=&quot;https://arxiv.org/pdf/1701.05052.pdf&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1701.05052&lt;/a&gt;] or approaches to error correction on closed &lt;em&gt;d&lt;/em&gt;-dimensional manifolds for&#xA;   &lt;em&gt;d&lt;/em&gt;&gt;2 [&lt;a href=&quot;https://arxiv.org/pdf/1503.02065.pdf&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1503.02065&lt;/a&gt;], we should be equally happy to admit other lines of investigation which is somewhat divorced from the mainstream. The justification in each case is the same: that while the arc of theory is long, it bends towards application, and things which are investigated for purely theoretical reasons have a way of yielding practical fruits.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The use of CQM&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;On that note: one view of the purpose of paying attention to foundations is to get the sort of insight necessary to solve problems more easily. Does CQM provide that insight?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that it is only very recently that the proponents of CQM have seriously considered the question of whether the insights it provides, allow one to obtain new results in subjects which are more in the mainstream of quantum information theory. This is again because the main motivation are the foundations, but recent work has started to develop on the theme of payoffs in the wider field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are at least two results which I can point to, which represent ways in which the CQM community has developed results which I would judge to be broadly relevant to the interests of the quantum information community, and in which the results are entirely new:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Novel techniques for constructing unitary error bases and Hadamard matrices (e.g. [&lt;a href=&quot;https://arxiv.org/abs/1504.02715&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1504.02715&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1609.07775&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1609.07775&lt;/a&gt;]. These appeared to be of enough interest to the quantum information community that these results were presented as talks in QIP 2016 and 2017 respectively.&lt;/li&gt;&#xA;&lt;li&gt;A well-thought out and clear definition of a &lt;a href=&quot;https://arxiv.org/pdf/1801.09705.pdf&quot; rel=&quot;noreferrer&quot;&gt;quantum graph&lt;/a&gt;, which recovers the definition of a &lt;em&gt;noncommutative graph&lt;/em&gt; from [&lt;a href=&quot;https://arxiv.org/pdf/1002.2514.pdf&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1002.2514&lt;/a&gt;] in such a way that makes the relationship to 'classical' graphs clear, allows them to connect to higher algebra, and obtain (Corollary&amp;nbsp;5.6) a result on the asymptotic density of pairs of graphs for which there is a quantum advantage in pseudo-telepathy games.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As one should expect of abstract mathematical techniques with foundational motivations, there are also payoffs for areas of computer science which are adjacent to quantum information theory:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Some recent techniques for solving problems in counting complexity regarding  the Holant, which are inspired by quantum computation [&lt;a href=&quot;https://arxiv.org/abs/1702.00767&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1702.00767&lt;/a&gt;], are more specifically inspired by a particular line of investigation into CQM which involved the distinction between GHZ states and W states.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Finally, something which is not yet a result, but which seems a promising direction of research and which in principle does not require category theory to pursue:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;One of the main products of CQM is the ZX-calculus, which one might describe as a tensor-notation which is similar to circuit notation, but which also comes equipped with a formal system for transforming equivalent diagrams to one another. There is a line of investigation into using this as a practical tool for circuit simplification, and for realising unitary circuits in particular architectures. This is based in part on the fact that ZX diagrams are a notation which allows you to reason about tensors beyond just unitary circuits, and which is therefore  more flexible in principle.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Should everyone start using CQM immediately?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Probably not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with many things which have been devised for heterodox academic reasons, it is not necessarily the best tool for every question which one might want to ask. &#xA;If you want to run numerical simulations, chances are you use C or Python as your programming language rather than SML. However, on that same note, just as &lt;a href=&quot;https://fsharp.org&quot; rel=&quot;noreferrer&quot;&gt;programming languages developed in earnest by major software firms&lt;/a&gt; may in time be informed by ideas which were first developed in such a heterodox academic context, so too might some of the ideas and priorities of CQM eventually filter out to the broader community, making it less an isolated line of investigation than it may seem today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also subjects for which CQM does not (yet) seem to provide a useful way of approaching, such as distance measures between different states or operations. But every mathematical tool has it's limits: I expect that I won't be using quantum channel theory any time soon to consider how to simplify unitary circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will be problems for which CQM sheds some insight, and may provide a convenient means for analysis. A few examples of such topics are provided above, and it is reasonable to suppose that more areas of application will become evident with time. For those topics where CQM is useful, one can choose whether to take the time to learn how to use the useful tool; apart from that, it's up to you whether or not you are curious enough. In this respect, it is like every other potential mathematical technique in quantum information theory.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Summary&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If there don't seem to be many novel applications of CQM yet, it's because there aren't &amp;mdash; because this isn't the main motivation of CQM, nor have many people studied it.&lt;/li&gt;&#xA;&lt;li&gt;Its main motivations are along the lines of foundations of computer science and of physics.&lt;/li&gt;&#xA;&lt;li&gt;Applications of the tools of CQM to mainstream quantum information theory do exist, and you can expect to see more as time goes on.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-04T10:38:04.570" LastActivityDate="2018-05-04T10:38:04.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="1995" PostTypeId="5" CreationDate="2018-05-03T13:04:42.250" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-03T13:04:42.250" LastActivityDate="2018-05-03T13:04:42.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1996" PostTypeId="4" CreationDate="2018-05-03T13:04:42.250" Score="0" Body="For questions relating to Hermitian operators specifically in their role of measurement observables (as opposed to continuous time quantum state evolution), and more generally questions relating to the relationship of Hermitian operators to unitary changes of basis." OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-03T20:43:22.640" LastActivityDate="2018-05-03T20:43:22.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1997" PostTypeId="5" CreationDate="2018-05-03T13:12:47.760" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-03T13:12:47.760" LastActivityDate="2018-05-03T13:12:47.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1998" PostTypeId="4" CreationDate="2018-05-03T13:12:47.760" Score="0" Body="Relating to special cases of quantum information theory which considers dynamics or properties of the system which are characterised by commuting operators, such as commuting Hamiltonians, IQP, commuting measurement observables, or mathematical aspects of the stabiliser formalism." OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-03T20:43:29.333" LastActivityDate="2018-05-03T20:43:29.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="1999" PostTypeId="1" CreationDate="2018-05-03T19:38:39.930" Score="17" ViewCount="1221" Body="&lt;p&gt;It is a well known result that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Discrete Fourier Transform (DFT)&lt;/a&gt; of $N=2^n$ numbers has complexity $\mathcal O(n2^n)$ with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;best known algorithm&lt;/a&gt;, while performing the Fourier transform of the amplitudes of a quantum state, with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;classical QFT algorithm&lt;/a&gt;, only requires $\mathcal O(n^2)$ elementary gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any known reason why this is the case? By this I mean whether there are known characteristics of the DFT that make it possible to implement an efficient &quot;quantum version&quot; of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, a DFT over $N$-dimensional vectors can be thought of as the linear operation&#xA;$$\vec y=\operatorname{DFT} \vec x, \qquad \text{DFT}_{jk}\equiv \frac{1}{\sqrt N}\exp\left(\frac{2\pi i}{N}jk\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;quantum version&quot; of this problem is the task of, given a quantum state $|\boldsymbol x\rangle\equiv\sum_{k=1}^N x_k|k\rangle$, obtaining the output state $|\boldsymbol y\rangle\equiv\sum_{k=1}^N y_k |k\rangle$ such that&#xA;$$|\boldsymbol y\rangle=\operatorname{DFT}|\boldsymbol x\rangle=\operatorname{QFT}|\boldsymbol x\rangle.$$&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A first simplification seems to come from the fact that, due to the linearity of QM, we can focus on the basis states $|j\rangle, \,\,j=1,...,N$, with the evolution of general vectors $|\boldsymbol x\rangle$ then coming for free.&lt;/li&gt;&#xA;&lt;li&gt;If $N=2^n$, one can express $|j\rangle$ in base two, having $|j\rangle=|j_1,...,j_n\rangle$.&lt;/li&gt;&#xA;&lt;li&gt;In the standard QFT algorithm one then exploits the fact that the transformation can be written as&#xA;$$|j_1,...,j_n\rangle\to2^{-n/2}\bigotimes_{l=1}^n\big[|0\rangle+\exp(2\pi i (0.j_{n-l+1}\cdots j_{n}))|1\rangle\big],$$&#xA;which can then be implemented as a quantum circuit of the form&#xA;$$\operatorname{QFT}|j_1,...,j_n\rangle=\Big(\prod_{k=1}^n \mathcal U_k\Big)|j_1,...,j_n\rangle,$$&#xA;where $\mathcal U_k$ is implemented with $\mathcal O(n)$ elementary gates.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Suppose we have now some unitary transformation $A$, and we want to find a circuit implementing efficiently the equivalent quantum transformation&#xA;$$|\boldsymbol y\rangle=A|\boldsymbol x\rangle.$$&#xA;The first two tricks mentioned above can always be applied, but it is then nontrivial when and how the other point can be used to obtain efficiency results like we have for the QFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there known criteria for this to be true? Or in other words, is it possible to precisely pin down what are the characteristics of the DFT that make it possible to efficiently implement the associated quantum transformation?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="26" LastEditDate="2018-05-03T20:06:56.210" LastActivityDate="2018-08-07T21:32:04.953" Title="Why can the Discrete Fourier Transform be implemented efficiently as a quantum circuit?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2000" PostTypeId="5" CreationDate="2018-05-03T20:25:04.053" Score="0" Body="&lt;p&gt;The quantum Fourier transform on an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,...,|N-1\rangle$&lt;/span&gt; is defined to be a linear operator with the following action on the basis states,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|j\rangle \longrightarrow \frac{1}{\sqrt{N}}\sum^{N-1}_{k=0}e^{2\pi ijk/N}|k\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Equivalently, the action on an arbitrary state may be written&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum^{N-1}_{j=0} x_j |j\rangle \longrightarrow \sum^{N-1}_{k=0} y_k|k\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the amplitudes &lt;span class=&quot;math-container&quot;&gt;$y_k$&lt;/span&gt; are the discrete Fourier transform of the amplitudes &lt;span class=&quot;math-container&quot;&gt;$x_j$&lt;/span&gt;. The QFT is a unitary transformation, and thus can be implemented as the dynamics for a quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-19T09:05:27.090" LastActivityDate="2021-05-19T09:05:27.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2001" PostTypeId="4" CreationDate="2018-05-03T20:25:04.053" Score="0" Body="Quantum Fourier Transform (QFT) is a linear transformation on quantum bits and is the quantum analogue of the discrete Fourier transform. The quantum Fourier transform is a part of many quantum algorithms, notably Shor's algorithm for factoring and computing the discrete logarithm, the quantum phase estimation algorithm for estimating the eigenvalues of a unitary operator, and algorithms for the hidden subgroup problem. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:30:07.140" LastActivityDate="2019-01-01T09:30:07.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2002" PostTypeId="2" ParentId="1999" CreationDate="2018-05-04T10:17:25.167" Score="13" Body="&lt;h2&gt;Introduction to the Classical Discrete Fourier transform:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The DFT transforms a sequence of $N$ complex numbers $\{\mathbf{x}_n\}:=x_0,x_1,x_2,...,x_{N-1}$ into another sequence of complex numbers $\{\mathbf{X}_k\}:=X_0,X_1,X_2,...$ which is defined by $$X_k=\sum_{n=0}^{N-1}x_n.e^{\pm\frac{2\pi i k n}{N}}$$ We might multiply by suitable normalization constants as necessary. Moreover, whether we take the plus or minus sign in the formula depends on the convention we choose.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Suppose, it's given that $N=4$ and $\mathbf{x}=\begin{pmatrix} 1 \\ 2-i \\ -i \\ -1+2i \end{pmatrix}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to find the column vector $\mathbf{X}$. The general method is already shown on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Example&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia page&lt;/a&gt;. But we will develop a matrix notation for the same. $\mathbf{X}$ can be easily obtained by pre multiplying $\mathbf{x}$ by the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$M=\frac{1}{\sqrt{N}}\begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; w &amp;amp; w^{ 2 } &amp;amp; w^{ 3 } \\ 1 &amp;amp; w^ 2 &amp;amp; w^4 &amp;amp; w^6 \\ 1 &amp;amp; w^3 &amp;amp; w^6 &amp;amp; w^9 \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $w$ is $e^{\frac{-2\pi i}{N}}$. Each element of the matrix is basically $w^{ij}$. $\frac{1}{\sqrt{N}}$ is simply a normalization constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, $\mathbf{X}$ turns out to be: $\frac{1}{2}\begin{pmatrix} 2 \\ -2-2i \\ -2i \\ 4+4i \end{pmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, sit back for a while and notice a few important properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All the columns of the matrix $M$ are orthogonal to each other. &lt;/li&gt;&#xA;&lt;li&gt;All the columns of $M$ have magnitude $1$. &lt;/li&gt;&#xA;&lt;li&gt;If you post multiply $M$ with a column vector having lots of zeroes (large spread) you'll end up with a column vector with only a few zeroes (narrow spread). The converse also holds true. (Check!)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It can be very simply noticed that the classical DFT has a time complexity $\mathcal O(N^2)$. That is because for obtaining every row of $\mathbf{X}$, $N$ operations need to be performed. And there are $N$ rows in $\mathbf{X}$.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;The Fast fourier transform:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now, let us look at the Fast fourier transform. The fast Fourier transform uses the symmetry of the Fourier transform to reduce the computation time. Simply put, we rewrite the Fourier transform of size $N$ as two Fourier transforms of size $N/2$ - the odd and the even terms. We then repeat this over and over again to exponentially reduce the time. To see how this works in detail, we turn to the matrix of the Fourier transform. While we go through this, it might be helpful to have $\text{DFT}_8$ in front of you to take a look at. Note that the exponents have been written modulo $8$, since $w^8 = 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1Td1t.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Td1t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how row $j$ is very similar to row $j + 4$. Also, notice how column $j$&#xA;is very similar to column $j + 4$. Motivated by this, we are going to split the&#xA;Fourier transform up into its even and odd columns.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BdYkS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BdYkS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first frame, we have represented the whole Fourier transform matrix&#xA;by describing the $j$th row and $k$th column: $w^{jk}$. In the next frame, we separate the odd and even columns, and similarly separate the vector that is to be transformed. You should convince yourself that the first equality really is&#xA;an equality. In the third frame, we add a little symmetry by noticing that&#xA;$w^{j+N/2} = −w^j$ (since $w^{n/2} = −1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that both the odd side and even side contain the term $w^{2jk}$. But&#xA;if $w$ is the primitive Nth root of unity, then $w^2$ is the primitive $N/2$ nd root of unity. Therefore, the matrices whose $j$, $k$th entry is $w^{2jk}$ are really just $\text{DFT}_{(N/2)}$! Now we can write $\text{DFT}_N$ in a new way:&#xA;Now suppose we are calculating the Fourier transform of the function $f(x)$.&#xA;We can write the above manipulations as an equation that computes the jth&#xA;term $\hat{f}(j)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3Zn5o.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Zn5o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: QFT in the image just stands for DFT in this context. Also, M refers to what we are calling N.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This turns our calculation of $\text{DFT}_N$ into two applications of $\text{DFT}_{(N/2)}$. We&#xA;can turn this into four applications of $\text{DFT}_{(N/4)}$, and so forth. As long as $N = 2n$ for some $n$, we can break down our calculation of $\text{DFT}_N$ into $N$&#xA;calculations of $\text{DFT}_1 = 1$. This greatly simplifies our calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of the Fast fourier transform the time complexity reduces to $\mathcal{O}(N\log(N))$ (try proving this yourself). This is a huge improvement over the classical DFT and pretty much the state-of-the-art algorithm used in modern day music systems like your iPod!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;The Quantum Fourier transform with quantum gates:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The strength of the FFT is that we are able to use the symmetry of the&#xA;discrete Fourier transform to our advantage. The circuit application of QFT&#xA;uses the same principle, but because of the power of superposition QFT is&#xA;even faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The QFT is motivated by the FFT so we will follow the same steps, but&#xA;because this is a quantum algorithm the implementation of the steps will be&#xA;different. That is, we first take the Fourier transform of the odd and even&#xA;parts, then multiply the odd terms by the phase $w^{j}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a quantum algorithm, the first step is fairly simple. The odd and even&#xA;terms are together in superposition: the odd terms are those whose least&#xA;significant bit is $1$, and the even with $0$. Therefore, we can apply $\text{QFT}_{(N/2)}$ to both the odd and even terms together. We do this by applying we will simply apply $\text{QFT}_{(N/2)}$ to the $n-1$ most significant bits, and recombine the odd and even appropriately by applying the Hadamard to the least significant bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to carry out the phase multiplication, we need to multiply each odd&#xA;term $j$ by the phase $w^{j}$ . But remember, an odd number in binary ends with a $1$ while an even ends with a $0$. Thus we can use the controlled phase shift, where the least significant bit is the control, to multiply only the odd terms by the phase without doing anything to the even terms. Recall that the controlled phase shift is similar to the CNOT gate in that it only applies a phase to the target if the control bit is one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4MbDF.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4MbDF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note:  In the image M refers to what we are calling N.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase associated with each controlled phase shift should be equal to&#xA;$w^{j}$ where $j$ is associated to the $k$-th bit by $j = 2k$.&#xA;Thus, apply the controlled phase shift to each of the first $n − 1$ qubits,&#xA;with the least significant bit as the control. With the controlled phase shift&#xA;and the Hadamard transform, $\text{QFT}_N$ has been reduced to $\text{QFT}_{(N/2)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5L5TU.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5L5TU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note:  In the image, M refers to what we are calling N.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets construct $\text{QFT}_3$. Following the algorithm, we will turn $\text{QFT}_3$ into $\text{QFT}_2$&#xA;and a few quantum gates. Then continuing on this way we turn $\text{QFT}_2$ into&#xA;$\text{QFT}_1$ (which is just a Hadamard gate) and another few gates. Controlled&#xA;phase gates will be represented by $R_\phi$. Then run through another iteration to get rid of $\text{QFT}_2$. You should now be able to visualize the circuit for $\text{QFT}$ on more qubits easily. Furthermore, you can see that the number of gates necessary to carry out $\text{QFT}_N$ it takes is exactly $$\sum_{i=1}^{\log(N)} i=\log(N)(\log(N)+1)/2 = \mathcal{O}(\log^2 N)$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Sources:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Discrete_Fourier_transform&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.edx.org/course/quantum-mechanics-quantum-computation-uc-berkeleyx-cs-191x&quot; rel=&quot;noreferrer&quot;&gt;Quantum Mechanics and Quantum Computation MOOC (UC BerkeleyX)&lt;/a&gt; - &lt;a href=&quot;https://courses.edx.org/c4x/BerkeleyX/CS191x/asset/chap5.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture Notes : Chapter 5&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;P.S: This answer is in its preliminary version. As @DaftWillie mentions in the comments, it doesn't go much into &quot;&lt;em&gt;any insight that might give some guidance with regards to other possible algorithms&lt;/em&gt;&quot;. I encourage alternate answers to the original question. I personally need to do a bit of reading and resource-digging so that I can answer that aspect of the question.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-09T11:52:30.520" LastActivityDate="2018-05-09T11:52:30.520" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2003" PostTypeId="2" ParentId="1999" CreationDate="2018-05-04T10:40:11.740" Score="8" Body="&lt;p&gt;This is deviating a little from the original question, but I hope gives a little more insight that could be relevant to other problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One might ask &quot;What is it about order finding that lends itself to efficient implementation on a quantum computer?&quot;. Order Finding is the main component of factoring algorithms, and includes the Fourier transform as part of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting thing is that you can put things like order finding, and Simon's problem, in a general context called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hidden_subgroup_problem&quot; rel=&quot;noreferrer&quot;&gt;&quot;Hidden Subgroup Problem&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take a group $G$, with elements indexed by $g$, and a group operation '$\oplus$'. We are given an oracle that evaluates the function $f(g)$, and we are assured that there is a subgroup, $K$, of $G$ with elements $k$ such that for all $g\in G$ and $k\in K$, $f(g)=f(g\oplus k)$. It is our task to uncover the generators of the subgroup $K$. For example, in the case of Simon's problem, the group $G$ is all $n$-bit numbers, and the subgroup $K$ is a pair of elements $\{0,s\}$. The group operation is bitwise addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Efficient solutions (that scale as a polynomial of $\log|G|$) exist if the group $G$ is Abelian, i.e. if the operation $\oplus$ is commutative, making use of the Fourier Transform over the relevant group. There are well-established links between the group structure (e.g. $\{0,1\}^n,\oplus$) and the problem that can be solved efficiently (e.g. Simon's problem). For example, if we could solve the Hidden Subgroup Problem for the symmetric group, it would help with the solution of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Graph_isomorphism&quot; rel=&quot;noreferrer&quot;&gt;graph isomorphism problem&lt;/a&gt;. In this particular case, how to perform the Fourier Transform is known, although this in itself is not sufficient for creating an algorithm, in part because there is some additional post-processing that is required. For example, in the case of Simon's Problem, we required multiple runs to find enough linearly independent vectors to determine $s$. In the case of factoring, we were required to run a continued fractions algorithm on the output. So, there's still some classical post-processing that has to be done efficiently, even once the appropriate Fourier transform can be implemented.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Some more details&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In principle, the Hidden Subgroup Problem for Abelian groups is solved as follows. We start with two registers, $|0\rangle|0\rangle$, and prepare the first in a uniform superposition of all group elements,&#xA;$$&#xA;\frac{1}{\sqrt{|G|}}\sum_{g\in G}|g\rangle|0\rangle,&#xA;$$&#xA;and perform the function evaluation&#xA;$$&#xA;\frac{1}{\sqrt{|G|}}\sum_g|g\rangle|f(g)\rangle=\frac{1}{\sqrt{|G|}}\sum_{g\in K^\perp}\sum_{k\in K}|g\oplus k\rangle|f(g)\rangle,&#xA;$$&#xA;where $K^\perp$ is defined such that by taking each element and combining with the members of $K$ yields the whole group $G$ (i.e. each member of $K^\perp$ creates a different coset, yielding distinct values of $f(g)$), and is known as the orthogonal subgroup. Tracing over the second register,&#xA;$$&#xA;\frac{1}{|K|}\sum_{g\in K^\perp}\sum_{k,k'\in K}|g\oplus k\rangle\langle g\oplus k'|.&#xA;$$&#xA;Now we perform the Fourier Transform over the group $G$, giving the output state&#xA;$$&#xA;\frac{|K|}{|G|}\sum_{g\in K^\perp}|g\rangle\langle g|.&#xA;$$&#xA;Each of the vectors $|g\in K^\perp\rangle$ has a probability of $|K|/|G|$ of being found, and all others have 0 probability. Once the generators of $K^\perp$ have been determined, we can figure out the generators of $K$ via some linear algebra.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-04T10:40:11.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2004" PostTypeId="1" AcceptedAnswerId="2005" CreationDate="2018-05-04T10:49:03.160" Score="16" ViewCount="1998" Body="&lt;p&gt;Grover's Search algorithm is usually talked about in terms of finding a marked entry in an unsorted database. This is a natural formalism that lets it be applied directly to searching for solutions to NP problems (where a good solution is easily recognised).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1967/1837&quot;&gt;interested to learn&lt;/a&gt; about other applications of Grover's search to finding the minimum, mean and median of a set of numbers. That leaves me wondering if there are any other less-obvious applications of Grover's search (or applications of its generalisations such as amplitude amplification) which are already known? Any brief insight about how this is done would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-09-10T07:37:39.440" LastActivityDate="2021-01-07T10:11:32.690" Title="What applications does Grover's Search Algorithm have?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2005" PostTypeId="2" ParentId="2004" CreationDate="2018-05-04T10:57:27.897" Score="8" Body="&lt;p&gt;Apart from the ones you mentioned, another application of (a modified) Grover's algorithm which I'm aware of is solving the &lt;a href=&quot;https://en.wikipedia.org/wiki/Collision_problem&quot; rel=&quot;noreferrer&quot;&gt;Collision problem in complexity theory, quantum computing and computational mathematics&lt;/a&gt;. It's also called the &lt;a href=&quot;https://en.wikipedia.org/wiki/BHT_algorithm&quot; rel=&quot;noreferrer&quot;&gt;BHT algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The collision problem most often refers to the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412143&quot; rel=&quot;noreferrer&quot;&gt;2-to-1&#xA;  version&lt;/a&gt; which was described by Scott Aaronson in his PhD thesis. Given that $n$ is&#xA;  even and a function $f:\{1,...,n\}\to\{1,...,n\}$ we know beforehand&#xA;  that either $f$ is 1-to-1 or 2-to-1. We are only allowed to make&#xA;  queries about the value of $f(i)$ for any $i\in\{1,2,...,n\}$. The&#xA;  problem then asks how many queries we need to make to determine with&#xA;  certainty whether $f$ is 1-to-1 or 2-to-1.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Solving the 2-to-1 version deterministically requires $n/2+1$ queries,&#xA;  and in general distinguishing r-to-1 functions from 1-to-1 functions&#xA;  requires $n/r+1$ queries.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Deterministic classical solution&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This is a straightforward application of the pigeonhole principle: if&#xA;  a function is r-to-1, then after $n/r+1$ queries we are guaranteed to&#xA;  have found a collision.  If a function is 1-to-1, then no collision&#xA;  exists. If we are unlucky then $n/r$ queries could return distinct&#xA;  answers. So $n/r+1$ queries are necessary.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Randomized classical solution&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;If we allow randomness, the problem is easier. By the birthday&#xA;  paradox, if we choose (distinct) queries at random, then with high&#xA;  probability we find a collision in any fixed 2-to-1 function after&#xA;  $\Theta(\sqrt{n})$ queries.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Quantum BHT solution&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Intuitively, the algorithm combines the square root speedup from the&#xA;  &lt;a href=&quot;https://en.wikipedia.org/wiki/Birthday_attack&quot; rel=&quot;noreferrer&quot;&gt;birthday paradox&lt;/a&gt;&#xA;  using (classical) randomness with the square root speedup from&#xA;  Grover's (quantum) algorithm. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;First, $n^{1/3}$ inputs to $f$ are selected at random and $f$ is&#xA;  queried at all of them. If there is a collision among these inputs,&#xA;  then we return the colliding pair of inputs. Otherwise, all these&#xA;  inputs map to distinct values by $f$. Then Grover's algorithm is used&#xA;  to find a new input to $f$ that collides. Since there are only&#xA;  $n^{2/3}$ such inputs to $f$, Grover's algorithm can find one (if it&#xA;  exists) by making only&#xA;  $\mathcal{O}(\sqrt{n^{2/3}})=\mathcal{O}(n^{1/3})$ queries to $f$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sources:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Collision_problem&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Collision_problem&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/BHT_algorithm&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/BHT_algorithm&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9705002&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithm for the Collision Problem - Gilles Brassard, Peter Hoyer, Alain Tapp&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-04T14:34:08.177" LastActivityDate="2018-05-04T14:34:08.177" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2006" PostTypeId="2" ParentId="1999" CreationDate="2018-05-04T16:09:26.203" Score="10" Body="&lt;p&gt;One possible answer as to why we can realise the QFT efficiently is down to the structure of its coefficients. To be precise, we can represent it easily as a &lt;a href=&quot;https://arxiv.org/abs/0801.2461&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;quadratic form expansion&lt;/em&gt;&lt;/a&gt;, which is a sum over paths which have phases  given by a quadratic function:&#xA;$$&#xA;   F_{2^n}&#xA;   =&#xA;   \frac{1}{\sqrt{2^n}}&#xA;     \sum_{k,x \in \{0,1\}^n}&#xA;       \exp\bigl(i Q(k,x)\bigr) \; \lvert k \rangle\!\langle x \rvert,&#xA;$$&#xA;where $Q(z) = \sum_{1 \leqslant j \leqslant k \leqslant 2n} \theta_{j,k} z_j z_k$ is a quadratic form defined on $2n$-bit strings. The quantum Fourier transform in particular involves a quadratic form whose angles are given by&#xA;$$&#xA;  \theta_{j,k}&#xA;  =&#xA;  \begin{cases}&#xA;    \pi\big/2^{2n-j-k},&#xA;       &amp;amp; \text{if $1 \leqslant j \leqslant n &amp;lt; k \leqslant 2n-j+1$}&#xA;\\&#xA;0, &amp;amp; \text{otherwise}.&#xA;\end{cases} $$&#xA;The structure of these angles has an important feature, which allows the QFT to be easily realised as a unitary circuit:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is a function $f: \{1,2,\ldots,n\} \to \{n{+}1,n{+}2,\ldots,2n\}$ such that $\theta_{j,k} = \pi$ for each $1 \leqslant j \leqslant n$ (where $f(j) = 2n-j+1$ in the case of the QFT);&lt;/li&gt;&#xA;&lt;li&gt;For any $1 \leqslant h,j \leqslant n$ for which $\theta_{h,\,f(j)} \ne 0$, we have $\theta_{j,\,f(h)} = 0$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We may think of the indices of $z = (k,x) \in \{0,1\}^{2n}$ as input and output wires of a quantum circuit, where our task is to show what the circuit in the middle is which shows how the inputs connect to the outputs. The function $f$ above allows us to see the association of output wires to input wires, that in each case there is a Hadamard gate which connects the two ends together, and that apart from the Hadamards (and SWAP gates which accounts for the reversal of in the order of the indices between $(1,2,\ldots,n)$ and $(f(1), f(2), \ldots, f(n))$), all of the other operations are two-qubit controlled-phase gates for relative phases of $\exp(i \theta_{j,k})$. The second condition on $f$ serves to ensure that these controlled-phase gates can be given a well-defined time ordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are more general conditions which one could describe for when a quadratic form expansion gives rise to a realisable circuit, along similar lines. The above describes one of the simplest cases, in which there are no indices in the sum except for those for the standard basis of the input and output states (in which case the coefficients of the associated unitary all have the same magnitude).&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-05T10:32:30.810" LastActivityDate="2018-05-05T10:32:30.810" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2007" PostTypeId="1" CreationDate="2018-05-04T17:45:18.863" Score="5" ViewCount="1141" Body="&lt;p&gt;There have been a couple of simulations already made and I recently saw this high performance, hardware accelerated quantum computer simulator &lt;a href=&quot;https://qcgpu.github.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QCGPU&lt;/a&gt; and started to wonder about how to simulate quantum computing in VR. I would like to look at demonstrating the theory behind it. As a teaching experience. Then afterwards simulating the algorithms that could run on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation is that VR doesn't have similar limitations we have in the physical world. Essentially it will graphically illustrate the quantum physics behind this computer and to show Mesoscopic physics at work. The VR will illustrate experiments of quantum physics and theory behind this computer but it will also illustrate speed and algorithm execution. For example, this is like showing the mainframe generation how a 7'th Gen CPU would function. From hardware to software, theoretically. It would simulate how algorithms would work on this machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superposition and entanglement would be the main focus. For instance to show entanglement the player would interact with a photon, electron , molecule, or laser (polarization) .The distance between electrons can be scaled to show qubits that are separated by incredible distances interacting with each other instantaneously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to build such a research environment for enthusiast and professionals to refer to with authenticity?  &lt;/p&gt;&#xA;" OwnerUserId="2215" LastEditorUserId="26" LastEditDate="2018-12-13T19:48:48.943" LastActivityDate="2018-12-13T19:48:48.943" Title="Is it possible to simulate a quantum computer in Virtual Reality? If yes, how?" Tags="&lt;simulation&gt;&lt;models&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2008" PostTypeId="2" ParentId="2007" CreationDate="2018-05-04T19:58:20.927" Score="7" Body="&lt;p&gt;Virtual reality in a classical computer is just a fancy front-end on top of a classical simulation. A classical computer can simulate all of the quantum physics happening inside a quantum computer, including all the phenomena referred to in the question, but only for a limited number of qubits.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://arxiv.org/abs/1704.01127&quot; rel=&quot;noreferrer&quot;&gt;45-qubit circuit was simulated&lt;/a&gt; using 0.5PB of RAM in 2017.&lt;br&gt;&#xA;A &lt;a href=&quot;https://arxiv.org/pdf/1710.05867.pdf&quot; rel=&quot;noreferrer&quot;&gt;49-qubit circuit was simulated&lt;/a&gt; using 3TB of RAM in 2017.&lt;br&gt;&#xA;A &lt;a href=&quot;https://arxiv.org/pdf/1802.06952.pdf&quot; rel=&quot;noreferrer&quot;&gt;64-qubit circuit was simulated&lt;/a&gt; using 8TB of RAM in 2018.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These were universal random circuits. If you allow the circuit to be non-random, as in the case of most &lt;em&gt;specific&lt;/em&gt; quantum algorithms, you can simulate more qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Bravyi ad Gosset showed that &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.116.250501&quot; rel=&quot;noreferrer&quot;&gt;circuits dominated by Clifford gates can be simulated in polynomial time with respect to the number of $T$ gates on a classical computer&lt;/a&gt;. Here is the &lt;a href=&quot;https://arxiv.org/abs/1601.07601&quot; rel=&quot;noreferrer&quot;&gt;arXiv&lt;/a&gt; link if you don't have access to PRL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to simulate a real physical system (for example for your VR demonstration for students) you need to also model decoherence, but a Lindblad master equation can approximate this with the same amount of RAM as the above &quot;exact&quot; simulations for closed systems. If you want to simulate the decoherence without a Markovian approxiation, there are programs on GitHub such as &lt;a href=&quot;https://github.com/ndattani/FeynDyn&quot; rel=&quot;noreferrer&quot;&gt;FeynDyn (Feynman Dynamics)&lt;/a&gt;. In my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1984/2293&quot;&gt;answer&lt;/a&gt; to a recent question here, I simulated 3 qubits in the presence of non-Markovian decoherence in 62 seconds, and the authors of FeynDyn claim they can simulate up to 16 qubits with non-Markovian decoherence.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-06T19:33:17.090" LastActivityDate="2018-05-06T19:33:17.090" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2009" PostTypeId="1" AcceptedAnswerId="2010" CreationDate="2018-05-05T19:02:59.153" Score="5" ViewCount="212" Body="&lt;p&gt;My understanding of Shor's algorithm is that you have to carry out the following steps if you are trying to factor $N$:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Chose a random number less than $N$. Let's call it $a$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the period of $a^x \ \text{mod} \ N$. Let's call the period $r$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One of the factors is the GCD of $a^{r/2}+1$ and $N$. The other is the GCD of $a^{r/2}-1$ and $N$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However this does not work in some cases such as if $N=35$ and $a=10$. You should be getting $5$ and $7$ as the prime factors of $35$, but this is not the case. The period of $10^x \ \text{mod} \ 35$ is $6$. The GCD of $10^{6/2}+1$, $1001$ and $35$ is $7$, which is one of the factors. But the GCD of $10^{6/2}-1$, $999$ and $35$ is $1$, which is not what you should be getting. Why doesn't Shor's algorithm work in this case?&lt;/p&gt;&#xA;" OwnerUserId="699" LastEditorUserId="699" LastEditDate="2018-05-05T21:08:01.443" LastActivityDate="2018-05-05T22:39:58.833" Title="Confusion about random sampling of integers in Shor's algorithm" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2010" PostTypeId="2" ParentId="2009" CreationDate="2018-05-05T19:35:35.217" Score="5" Body="&lt;p&gt;You skipped a step in the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First check if $N$ is even. $35$ is not even.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next determine if $N=a^b$ for $a \geq 1$ and $b \geq 2$. It's not.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Randomly choose $x$ in the range $1$ to $N-1$. If $\text{gcd}(x,N) &amp;gt; 1$ then return the factor $\text{gcd}(x,N)$. This is what you missed. $\text{gcd}(10,35) = 5$ There's no reason to perform order finding if you choose $x = 10$. $x$ should be co-prime to $N$ in order to continue.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For completeness: &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the order $r$ of $x\bmod N$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $r$ is even and $x^{r/2} \neq -1 \pmod N$ then compute the $\text{gcd}(x^{r/2} -1,N)$ to see if one of these is a non-trivial factor. Otherwise, the algorithm fails. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The reason the algorithm could fail is because you don't have enough qubits to perform the order-finding part to enough precision. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These steps came from Section 5.3.2 of Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="23" LastEditDate="2018-05-05T22:39:58.833" LastActivityDate="2018-05-05T22:39:58.833" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2011" PostTypeId="2" ParentId="2007" CreationDate="2018-05-06T08:36:13.107" Score="5" Body="&lt;p&gt;Virtual reality is just a pretty front-end on top of a computer program. So, anything the computer program can do can be given a VR interface. As I see it, what is really being asked for is nice, yet 'authentic' ways of visualising quantum mechanics. One thing that immediately springs to mind is a book I read as an undergraduate, &lt;a href=&quot;https://www.amazon.co.uk/Mr-Tompkins-Paperback-Comprising-Wonderland/dp/0521093554/ref=sr_1_2?ie=UTF8&amp;amp;qid=1525613851&amp;amp;sr=8-2&amp;amp;keywords=mr%20tompkins%20in%20paperback&quot; rel=&quot;noreferrer&quot;&gt;Mr. Tompkins in Paperback&lt;/a&gt;. &lt;a href=&quot;https://www.amazon.co.uk/Alice-Quantumland-Allegory-Quantum-Physics/dp/0387914951&quot; rel=&quot;noreferrer&quot;&gt;Alice in Quantumland&lt;/a&gt; may also provide inspiration, I haven't read it. Then there's the &lt;a href=&quot;http://iqim.caltech.edu/outreach/#qcraft&quot; rel=&quot;noreferrer&quot;&gt;minecraft mod&lt;/a&gt; (which I haven't played).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard trick for doing the maths would essentially be to solve the Schrodinger equation but make the value of $\hbar$ much larger. That way, you should be able to get diffraction effects and similar at a macroscopic scale. This is a trick which probably works quite well for continuous systems (e.g. where you measure position), but I don't think it helps so much where you're talking about discrete systems (e.g. a qubit). In fact, there are probably some more fundamental questions you have to answer first, like 'What does an electron look like?' Is it really a nice little ball that you can pick up and play with, or is it something more diffuse and wavy? How do you represent its spin? (I don't think an arrow pointing in some direction is very authentic.) Part of the problem you rapidly get into here is that by looking at a quantum object, you're measuring it, and therefore changing it, and often making it so that it can't do the cool quantum trick you want it to do. So, I think you generally have to make some compromises to authenticity somewhere in order to create a representation that hopefully facilitates some sort of understanding.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-06T13:54:34.750" LastActivityDate="2018-05-06T13:54:34.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2012" PostTypeId="1" CreationDate="2018-05-07T05:30:05.307" Score="7" ViewCount="98" Body="&lt;p&gt;Within &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Stabilizer_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;stabilizer codes&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Toric_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;toric codes&lt;/a&gt;/&lt;em&gt;surface codes&lt;/em&gt; are very tempting, mainly for their high error threshold. For more background please check up, in our Physics sister (aunt?) site: &lt;a href=&quot;https://physics.stackexchange.com/questions/169176/quantum-error-correction-surface-code-vs-color-code&quot;&gt;Quantum Error Correction: Surface code vs. color code&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, these codes require fairly specific measurements in specific bases, which I find hard to translate in practice, especially into my language of interest which is spin states in a solid-state few-spin collection. To see my motivation, here is a not-quite successful attept from a few years ago, using a more naïve QEC scheme: &quot;&lt;a href=&quot;https://arxiv.org/abs/1404.6912&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction with magnetic molecules&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I am designing a realistic (molecular/supramolecular) network of 7 spins 1/2 (or something almost equivalent, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1867/is-qubit-qudit-terms-where-is-the-experimental-limit-between-an-s-3-2-and-2-s-1&quot;&gt;Is qubit/qudit terms, where is the experimental limit between an S=3/2 and 2&amp;#183;S=1/2?&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;a necessary first: what are the operations/measurements that I need to be able to do? here assume I'm able to do &lt;a href=&quot;https://en.wikipedia.org/wiki/Pulsed_electron_paramagnetic_resonance&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pulsed electron paramagnetic resonance&lt;/a&gt; to address every transition coherently&lt;/li&gt;&#xA;&lt;li&gt;and, as a consequence, what is a good coupling scheme between my spins so that the required number of physical operations is reasonable?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Related: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2098/how-does-the-size-of-a-toric-code-torus-affect-its-ability-to-protect-qubits&quot;&gt;How does the size of a toric code torus affect its ability to protect qubits?&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1847" LastEditDate="2018-05-19T05:19:25.927" LastActivityDate="2018-05-19T09:12:21.783" Title="Translation of color/toric code to a small network of solid-state spins" Tags="&lt;architecture&gt;&lt;experiment&gt;&lt;solid-state&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2013" PostTypeId="1" CreationDate="2018-05-07T15:19:40.753" Score="12" ViewCount="248" Body="&lt;p&gt;Recently, I heard that there can be transfer of &lt;em&gt;rational&lt;/em&gt; classical bits (for example 1.5 cbits) from one party to another via quantum teleportation. In the &lt;a href=&quot;https://courses.physics.illinois.edu/phys596/fa2011/StudentWork/team10_final.pdf&quot; rel=&quot;noreferrer&quot;&gt;Standard Teleportation Protocol&lt;/a&gt;, 2 classical bits and 1 maximally entangled shared resource state is required for perfect teleportation of the unknown state. But I do not understand how $1.x$ bits can be sent over in the classical channel.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is that possible? If yes, could you give a brief explanation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It'd be helpful if you could point me to some papers in which perfect teleportation is possible using fractional bits (and possibly extra quantum resources).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some people might be wondering as to how this may be relevant to quantum computing. D. Gottesman and I.L. Chuang &lt;a href=&quot;https://www.nature.com/articles/46503&quot; rel=&quot;noreferrer&quot;&gt;suggested&lt;/a&gt; that quantum teleportation will play an important role as a primitive subroutine in quantum computation. G. Brassard, S.L. Braunstein and R. Cleve &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0167278998000438&quot; rel=&quot;noreferrer&quot;&gt;showed&lt;/a&gt; that quantum teleportation can be understood as quantum computation.&lt;/p&gt;&#xA;" OwnerUserId="506" LastEditorUserId="55" LastEditDate="2021-02-20T16:24:59.227" LastActivityDate="2021-02-20T16:24:59.227" Title="Using a fractional number of classical bits within quantum teleportation" Tags="&lt;entanglement&gt;&lt;resource-request&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2014" PostTypeId="2" ParentId="2013" CreationDate="2018-05-07T16:21:55.910" Score="8" Body="&lt;p&gt;I don't know for sure how you would achieve fewer than two bits of classical communication for a teleportation, but here's one way that you could have a non-integer number: if you teleport a qudit with dimension $d$ that is not a power of two. For each teleportation protocol, you'd have to send two dits of information, which you could represent in bits using $\lceil 2\log_2(d)\rceil$ bits. If you then repeat the protocol many times, you could combine the classical messages that you're sending and reduce it to $2\log_2(d)$ per teleportation protocol on average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible route towards fewer than two bits of classical communication (if that's what you're after) is to use a combination of imperfect teleportation and non-universal teleportation (where we have some prior knowledge of what the state to be teleported could be). If your resource state is $\alpha|00\rangle+\sqrt{1-\alpha^2}|11\rangle$, then the probability of getting each measurement result in the teleportation protocol depends on the value of $\alpha$: teleporting a state $(\cos\frac{\theta}{2}|0\rangle+\sin\frac{\theta}{2}e^{i\phi}|1\rangle)$ gives the probailities of the four different Bell measurements,&#xA;$$&#xA;|B_{xy}\rangle=\frac{1}{\sqrt{2}}\left(|0x\rangle+(-1)^y|1\bar x\rangle\right)&#xA;$$&#xA;as&#xA;$$&#xA;p_{xy}=\frac{1}{4}(1+(-1)^x(2\alpha^2-1)\cos\theta),&#xA;$$&#xA;where $x$ and $y$ are single bits. Using the input distribution for the unknown quantum state, we can calculate the average value of $\sin\theta$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For universal teleportation (where the input state could be any state), one has $\int_0^{\pi}\cos\theta\sin\theta d\theta=0$. In this case, the probabilities are all equal, and the best we can do is just to send the measurement result as two bits, $xy$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine the case where $(2\alpha^2-1)\langle\cos\theta\rangle=\frac12$. Then, the probabilities are $(\frac38,\frac38,\frac18,\frac18)$. One can compress this information using, for example, Huffman encoding: $\{00,01,10,11\}\mapsto\{0,10,110,111\}$. This has an expected message length $\frac{15}{8}$. Thus, if you repeat this protocol many times, on average you send 1.875 bits per teleportation. This, of course, is just an example. Any value $(2\alpha^2-1)\langle\cos\theta\rangle&amp;gt;\frac13$ gives compression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trade-off is that unless $|\alpha|^2=|\beta|^2=\frac12$ (where you don't get any compression), the teleportation is imperfect.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-08T06:38:45.800" LastActivityDate="2018-05-08T06:38:45.800" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2015" PostTypeId="2" ParentId="1285" CreationDate="2018-05-08T20:46:44.197" Score="2" Body="&lt;p&gt;You do not even need $Z$ and $X$. &lt;br&gt;&#xA;$\rm{CNOT}$, $H$, and $T=\pi/8$ are enough. &lt;br&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) $H$ and $T$ are enough to make any possible unitary transformation on one qubit. &lt;br&gt;&#xA;2) Adding $\rm{CNOT}$, you can synthesize a general unitary transformation to within any error $\epsilon&amp;gt;0$ using only $\mathcal{O}(\log^2(1/\epsilon))$ gates..&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish for the error to be $\epsilon=0$ and you are only willing to add the phase gate $\pi/2$, &lt;a href=&quot;https://arxiv.org/pdf/1212.0506.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;it is still possible&lt;/a&gt;, if and only if the elements of the unitary you want to make are of the form: $\frac{a+ib}{2^n} + \frac{c+id}{2^{n+1/2}}$, where all variables are integers. Remarkably, at most 1 auxiliary qubit is required for this exact synthesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another universal gate set is $\{{\rm{CCNOT}},H\}$, and in fact there's a single gate that's uniersal: the 3-qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch gate&lt;/a&gt; ${D(\theta)}$.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-08T20:46:44.197" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2016" PostTypeId="2" ParentId="2007" CreationDate="2018-05-09T15:52:57.200" Score="4" Body="&lt;p&gt;As others have said, VR is just a way of visualizing an output from a computer. If the computer producing the output is classical, it will struggle to visualize a universal set of gates on a many qubit system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even so, there are ways to visualize systems of few qubits with a classical computer (though not with VR). The &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt; is the well known example for a single qubit. There are also a couple of games that have visualizations for few qubits:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.meqanic.com/app/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Meqanic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://medium.com/qiskitters/visualizing-bits-and-qubits-9af287047b28&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hello Quantum&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I’m sure there are others too. I’ll add them as I think of them, or as people point them out in the comments&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding VR specifically, the only project I know of is &lt;a href=&quot;http://libbyheaney.co.uk/quantum-breathing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Breathing&lt;/a&gt;. So you might want to check that out.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-09T15:52:57.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2017" PostTypeId="1" AcceptedAnswerId="2019" CreationDate="2018-05-09T16:56:13.163" Score="14" ViewCount="691" Body="&lt;p&gt;It seems to me that an extremely relevant question for the prospects of quantum computing would be how the engineering complexity of quantum systems scales with size. Meaning, it's easier to build $n$ $1$-qubit computers than one $n$-qubit computer. In my mind, this is roughly analogous to the fact that it's easier to analytically solve $n$ $1$-body problems than one $n$-body problem, since entanglement is the primary motivating factor behind quantum computing in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following: It seems that we should really care about how the 'difficulty' of building and controlling an $n$-body quantum system grows with $n$. Fix a gate architecture, or even an algorithm--is there a difficulty in principle arising from the fact that an $n$-qubit computer &lt;em&gt;is&lt;/em&gt; a quantum many-body problem? And that mathematically speaking, our understanding of how quantum phenomena scale up into classical phenomena is quite poor? Here difficulty could be defined in any number of ways, and the question we would care about, roughly is, is controlling a $1000$-qubit machine (that is, preserving the coherence of its wavefunctions) 'merely' $100$x harder than controlling a $10$-qubit machine, or $100^2$, or $100!$ or $100^{100}$? Do we have any reasons for believing that it is more or less the former, and not the latter?&lt;/p&gt;&#xA;" OwnerUserId="1254" LastEditorUserId="26" LastEditDate="2018-12-13T19:49:41.737" LastActivityDate="2018-12-13T19:49:41.737" Title="Are there any estimates on how complexity of quantum engineering scales with size?" Tags="&lt;architecture&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2018" PostTypeId="2" ParentId="2017" CreationDate="2018-05-09T18:33:13.820" Score="4" Body="&lt;h1&gt;Circuit Complexity&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I think the first issue is to really understand what is meant by 'controlling' a quantum system. For this, it might help to start thinking about the classical case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many different $n$-bit input, 1-bit output classical computations are there? For each of the $2^n$ possible inputs, there are $2$ different possible outputs. Thus, there are $2^{2^n}$ different possible functions that you could be asked to build, if what you're talking about in terms of controllability is &quot;build any of the possible functions&quot;. You might then go on to ask &quot;what fraction of these functions can I create by using no more than $2^n/n$ two-bit gates?&quot; (you could presumably generalise this to $k$-bit gates to get a relative complexity argument between two circuit sizes). There's a detailed calculation you can perform to get a good bound on this number, showing that it's small. This is something called Shannon's Theorem (but what isn't?), but there's at least an intuitive explanation: it requires a bit string of $2^n$ bits to specify which possible computation you're wanting to perform. This information must be incompressible, as there's no 'space' to be saved. But, if you could create all of these functions using shorter circuits, then describing that circuit would be a way of compressing the data. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equivalent statement in quantum computing is &quot;build any $n$-qubit unitary to within some accuracy, $\epsilon$&quot;. But the classical answer is already horrific, even before we have to take into account the precision issues of specifying an arbitrary unitary. The point is that with both classical and quantum computations, we focus very specifically on the algorithms that we can implement 'easily', for some definition of 'easily', which is usually that the algorithms that we want to implement scale as some polynomial of the input size (with the possible exception of things like Grover's algorithm). So really the answer to the question depends on the algorithms you wish to run on the computer. If the algorithm scales as $O(n^2)$, then appropriately controlling an 1000-qubit machine is kind of 10000 times harder than controlling a 10-qubit machine, in the sense that you need to protect it from decoherence for that much longer, implement that many more gates etc.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Decoherence&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Following up on the comments, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let's consider a specific algorithm or a specific kind of circuit. My question could be restated--is there any indication, theoretical or practical, of how the (engineering) problem of &lt;em&gt;preventing decoherence&lt;/em&gt; scales as we scale the number of these circuits? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This divides into two regimes. For small scale quantum devices, before error correction, you might say we're in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1888/1837&quot;&gt;NISQ regime&lt;/a&gt;. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2019/1837&quot;&gt;This answer&lt;/a&gt; is probably most relevant to that regime. However, as your device gets larger, there will be diminishing returns; it gets harder and harder to accomplish the engineering task just to add a few more qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At that point, you have to transition to using error correction and, indeed, fault-tolerance (which is just a form of error correction which is capable of tolerating errors in the gates that implement the correction). Specifically, fault-tolerance says that there exists a threshold error probability $p$ such that, if you can perform every gate with an error probability $\leq p$, you can define some logical qubits (made up of multiple physical qubits) such that the result of any computation or arbitrary length can be accomplished with arbitrary precision. Whatever your physical hardware, by the time you've left the NISQ regime, you've done a lot of work eliminating decoherence as much as possible, and made sure you're as far below the $p$ threshold as possible. Current estimates place $p$ somewhere around the $1\%$ mark. The question becomes &quot;what are the overheads for these fault-tolerant processes&quot;. The precise details are scheme dependent, and much work continues into how to minimise these costs. The scaling argument, however, says that for each logical qubit, you require $O(-\log\epsilon)$ physical qubits to achieve an overall accuracy of $\epsilon$. There is also a time cost; most of your time is spent performing error correction rather than the logical gates. Again, this is an $O(-\log\epsilon)$ scale factor. For specific numbers, you might be interested in the sorts of calculations that Andrew Steane has performed: see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412165&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (although the numbers could probably be improved a bit now). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is really quite compelling is to see how the coefficients in these relations change as your gate error gets closer and closer to the error correcting threshold. I can't seem to lay my hands on a suitable calculation (I'm sure Andrew Steane did one at some point. Possibly it was a talk I went to.), but they blow up really badly, so you want to be operating with a decent margin below the threshold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, there are a few assumptions that have to be made about your architecture before these considerations are relevant. For example, there has to be sufficient parallelism; you have to be able to act on different parts of the computer simultaneously. If you only do one thing at a time, errors will always build up too quickly. You also want to be able to scale up your manufacturing process without things getting any worse. It seems that, for example, superconducting qubits will be quite good for this. Their performance mainly depends on how accurately you can make different parts of the circuit. You get it right for one, and you can &quot;just&quot; repeat many times to make many qubits.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-10T08:16:15.163" LastActivityDate="2018-05-10T08:16:15.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2019" PostTypeId="2" ParentId="2017" CreationDate="2018-05-09T20:53:23.247" Score="9" Body="&lt;p&gt;This is a question that I have been thinking about for more than 10 years. &#xA;In 2008 I was a student, and I told my quantum computing professor that I wanted to study the &quot;physical complexity&quot; of performing quantum algorithms for which the &quot;computational complexity&quot; was known to benefit from quantum computation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example Grover search requires $\mathcal{O}(\sqrt{n})$ quantum gates as opposed to $\mathcal{O}(n)$ classical gates, but what if the cost of controlling quantum gates scales as $n^4$ while for classical gates it's only $n$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;He instantly replied: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Surely your idea of physical complexity will be implementation&#xA;  dependent&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That turned out to be true. The &quot;physical complexity&quot; of manipulating $n$ qubits with NMR is much worse than it is for superconducting qubits, but we do not have a formula for the physical difficulty with respect to $n$ for either case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;These are the steps you'd need to take:&lt;/strong&gt; &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Come up with an accurate decoherence model for your quantum computer. This will be different for a spin qubit in a GaAs quantum dot, vs a spin qubit in a diamond NV centre, for example. &lt;br&gt;&#xA; &lt;strong&gt;2.&lt;/strong&gt; Accurately calculate the dynamics of the qubits in the presence of decoherence.&lt;br&gt;&#xA; &lt;strong&gt;3.&lt;/strong&gt; Plot $F$ vs $n$, where $F$ is the fidelity of the $n$ decohered qubits compared to the outcome you'd get without decoherence.&lt;br&gt;&#xA; &lt;strong&gt;4.&lt;/strong&gt; This can give you an indication of the error rate (but different algorithms will have different fidelity requirements). &lt;br&gt;&#xA; &lt;strong&gt;5.&lt;/strong&gt; Choose an error correcting code. This will tell you how many physical qubits you need for each logical qubit, for an error rate $E$.&lt;br&gt;&#xA; &lt;strong&gt;6.&lt;/strong&gt; Now you can plot cost (in terms of number of auxiliary qubits needed) of &quot;engineering&quot; the quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now you can see why you had to come here to ask the question and the answer wasn't in any textbook:&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt; depends on the type of implementation (NMR, Photonics, SQUIDS, etc.) &lt;br&gt;&#xA;&lt;strong&gt;Step 2&lt;/strong&gt; is very hard. Decoherence-free dynamics has been simulated without physical approximations for &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2007/is-it-possible-to-simulate-a-quantum-computer-in-virtual-reality-if-yes-how&quot;&gt;64 qubits&lt;/a&gt;, but non-Markovian, non-perturbative dynamics with decoherence is presently limited to &lt;a href=&quot;https://github.com/ndattani/FeynDyn&quot; rel=&quot;noreferrer&quot;&gt;16 qubits&lt;/a&gt;.&lt;br&gt;&#xA;&lt;strong&gt;Step 4&lt;/strong&gt; depends on the algorithm. So there is no &quot;universal scaling&quot; of physical complexity, even if working with a particular type of implementation (like NMR, Photonics, SQUIDs, etc.)&lt;br&gt;&#xA;&lt;strong&gt;Step 5&lt;/strong&gt; depends on the choice of error correcting code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, to answer your two questions specifically:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is controlling a 1000-qubit machine (that is, preserving the&#xA;  coherence of its wavefunctions) 'merely' $100$x harder than&#xA;  controlling a $10$-qubit machine, or $100^2$, or $100!$ or&#xA;  $100^{100}$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It depends on your choice in &lt;strong&gt;Step 1&lt;/strong&gt;, and no one has been able to go all the way through &lt;strong&gt;Step 1 to Step 3&lt;/strong&gt; yet to get a precise formula for the physical complexity with respect to the number of qubits, even for a specific algorithm. So this is still an open question, limited by the difficulty of simulating open quantum system dynamics.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Do we have any reasons for believing that it is more or less the&#xA;  former, and not the latter?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The best reason is that this is our experience when we play with IBM's 5-qubit, 16-qubit and 50-qubit quantum computers. The error rates are not going up by $n!$ or $n^{100}$. How does the energy it takes to &lt;strong&gt;&lt;em&gt;make&lt;/em&gt;&lt;/strong&gt; the 5-qubit, 16-qubit and 50-qubit quantum computer, and how does &lt;strong&gt;&lt;em&gt;that&lt;/em&gt;&lt;/strong&gt; scale with $n$? This &quot;engineering complexity&quot; is even more implementation-dependent (think NMR vs SQUIDs) of an open question, albeit an interesting one. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-05-09T22:14:39.013" LastActivityDate="2018-05-09T22:14:39.013" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2020" PostTypeId="1" AcceptedAnswerId="2021" CreationDate="2018-05-09T22:24:01.733" Score="10" ViewCount="193" Body="&lt;p&gt;There is a number of emerging quantum technologies, among which we find the category of photon-based quantum technologies, including quantum key distribution or quantum random number generators. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is: what is the &lt;strong&gt;short-term viability of photon-based quantum computation and simulation, compared with other photon-based quantum technologies&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2018-12-13T19:49:57.187" LastActivityDate="2018-12-13T19:49:57.187" Title="What is the status of quantum computing compared with other (photonic) quantum technologies?" Tags="&lt;technologies&gt;&lt;optical-quantum-computing&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2021" PostTypeId="2" ParentId="2020" CreationDate="2018-05-09T22:24:01.733" Score="6" Body="&lt;p&gt;According to &lt;a href=&quot;https://goochandhousego.com/wp-content/uploads/2018/05/GH-Market-Report-UK-Market-for-Quantum-Enabling-Photon-Sources-2018-2022-Report.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this UK-oriented report by Gooch and Housego&lt;/a&gt; dated May 8, 2018, quantum computing is only one of several main key applications expected to have a market impact:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Clock technology/timing (e.g. bridging between the optical frequencies typical of atomic clocks and electrical/microwave&#xA;  frequencies typical of timing signals within telecommunication&#xA;  networks and computer systems)&lt;/li&gt;&#xA;  &lt;li&gt;LIDAR&lt;/li&gt;&#xA;  &lt;li&gt;Magnetometry and gravimetry&lt;/li&gt;&#xA;  &lt;li&gt;Medical imaging&lt;/li&gt;&#xA;  &lt;li&gt;Microscopy, imaging and calibration&lt;/li&gt;&#xA;  &lt;li&gt;Navigation&lt;/li&gt;&#xA;  &lt;li&gt;Non-QKD communications&lt;/li&gt;&#xA;  &lt;li&gt;QKD/quantum cryptography/secure communications&lt;/li&gt;&#xA;  &lt;li&gt;QRNG –quantum random number generator&lt;/li&gt;&#xA;  &lt;li&gt;Quantum computing and simulation&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To put the validity of this report into perspective, one needs to take into account that this study is an estimate of UK's demand (rather than global demand). Within this limitation, one can see that quantum computation and simulation is expected to be a relatively minor player within photon-based quantum technologies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In bulk number of devices (demand volume), &lt;strong&gt;quantum random number generators&lt;/strong&gt; are expected to dominate absolutely. The linked report explicitly mentions: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;It will be incorporated into every device that requires encryption, which will drive the growth in sales volume&lt;/em&gt;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In demand value, &lt;strong&gt;QKD/quantum cryptography/secure communications&lt;/strong&gt; are expected to be a major player among quantum technologies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other applications, while minor, are considered solid, for example, &lt;strong&gt;gravimetry&lt;/strong&gt;, about which it is stated that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Commercialisation is forecast for the beginning of 2019 when gravimeters will be used for geo-surveying such as bedrock analysis,&#xA;  detection of underground features and site surveying&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Imaging, navigation or non-QKD communications&lt;/strong&gt; are similarly appreciated as photon-based quantum technologies that are about to hit a small but realistic market.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In comparison, the report also asserts that : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Experts &lt;strong&gt;do not&lt;/strong&gt; believe that a quantum computer will be developed within the next 5 years&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Companies in sectors such as finance and banking and telecoms are adopting a ‘watch and wait’ approach, monitoring developments in&#xA;  academia, investing in know-how and awareness and purchasing small&#xA;  numbers of systems so that they will be ready when the technology&#xA;  reaches commercialisation&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2018-05-11T13:39:09.303" LastActivityDate="2018-05-11T13:39:09.303" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2022" PostTypeId="2" ParentId="2017" CreationDate="2018-05-09T22:29:49.667" Score="3" Body="&lt;p&gt;One way to think about quantum systems, which is qubits with error correction, and an encoded algorithm built in, or even in the general case where we program an algorithm is to ensure the fidelity of a qubit. So, for a system of $m$ qubits, we could could use proper error correction - for a given system of qubits, whether they are ion trap, superconducting, or any other scheme, and say the &quot;fidelity&quot; of a system given all these parameters is $n$ qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in a sense, the &quot;fidelity&quot; could give an estimate, how error prone the processor is.  If you used the quantum computer to compute say chemical reaction dynamics, or any other problem, that could use superposition to achieve quantum speedup (or even &quot;quantum supremacy&quot; eventually) you could be impacted by decoherence, or even  how quickly you achieve a superposition, could play a part in error free operation.  &quot;Fidelity&quot; could give an error estimation, whether we use 1 qubit, or say 200 qubits. You could even &quot;engineer&quot; a Hamiltonian, to give high fidelity qubits, in the adiabatic case, where leakage errors, take place. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in practice, error rates of 99.5%+ are highly desirable, to facilitate efficient error correction. Error rates could be of the type of reading electron spins between qubits to accuracy. In such a case, error rates, of 99.5%, or 99.8%(five or six sigma type confidence) would require less overheads(error correction) when scaling the system. &lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="429" LastEditDate="2018-05-09T23:21:40.713" LastActivityDate="2018-05-09T23:21:40.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2023" PostTypeId="5" CreationDate="2018-05-09T22:36:09.530" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-09T22:36:09.530" LastActivityDate="2018-05-09T22:36:09.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2024" PostTypeId="4" CreationDate="2018-05-09T22:36:09.530" Score="0" Body="For questions about quantum technologies that act as enabling technologies for quantum computing. Also for for questions comparing the challenges faced and opportunities created by different quantum technologies with those corresponding to quantum computing." OwnerUserId="1847" LastEditorUserId="26" LastEditDate="2019-01-01T09:42:24.637" LastActivityDate="2019-01-01T09:42:24.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2025" PostTypeId="2" ParentId="53" CreationDate="2018-05-09T23:52:33.253" Score="7" Body="&lt;p&gt;As one of the authors of the paper, and of the original theory papers on which that experimental realisation is based, perhaps I can attempt to answer. The BQC protocol used in that paper is based on a model of computations where measurements are made on a specially chosen entangled state (this is known as measurement-based quantum computation or MBQC, and was introduced in 2003 by Raussendorf and Briegel (&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.68.022312&quot; rel=&quot;nofollow noreferrer&quot;&gt;PRA&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0301052.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv&lt;/a&gt;). In MBQC the resource state is called a graph state, because a circuit to construct the graph state can be associated with a graph: for every vertex prepare a qubit in $|+\rangle$, and then perform a CZ gate between every pair of qubits for which the corresponding vertices share an edge in the graph. It turns out that you can implement an arbitrary quantum computation by first preparing a suitable graph state, and then by measuring out each qubit in turn, with measurement bases determined based on the target computation and on previous measurement outcomes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the BQC protocol does is to effectively implement an MBQC in a way that hides measurement bases from Bob. The reason we mention a need for a generic structure is because the protocol does not hide the graph. Now, it turns out that you can actually choose a generic graph which can implement any quantum computation which can be expressed as a quantum circuit of a given depth and breadth if the measurement bases are chosen appropriately. Using such a graph ensures that only circuit depth and breadth are leaked, and not the details of the computation. Furthermore, the computation can always be randomly padded to ensure that only an upper bound on depth and breadth are leaked. This is the minimum possible leakage, since ultimately Bob knows how much memory his device has (~circuit breadth) and how long it ran (~circuit depth), and so it is impossible to avoid leaking such upper bounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information you may wish to take a look at the following review paper, and references contained therein:&#xA;&lt;a href=&quot;https://www.nature.com/articles/s41534-017-0025-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Private quantum computation: an introduction to blind quantum computing and related protocols&lt;/a&gt;, J.F. Fitzsimons, &lt;em&gt;npj Quantum Information&lt;/em&gt; 2017.&lt;/p&gt;&#xA;" OwnerUserId="2353" LastEditorUserId="409" LastEditDate="2018-05-10T10:37:43.227" LastActivityDate="2018-05-10T10:37:43.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2027" PostTypeId="2" ParentId="2013" CreationDate="2018-05-11T10:11:25.823" Score="5" Body="&lt;p&gt;I recently found a &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0305085v4.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; by Subhash Kak that introduces teleportation protocols that require lesser classical communication cost (with more quantum resource). I thought it'd be better to write a separate answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kak discusses three protocols; two of them use 1 cbit and the last one requires 1.5 cbits. But the first two protocols are in a &lt;em&gt;different&lt;/em&gt; setting, i.e the entangled particles are initially in Alice's lab (and a few local operations are performed), then one of the entangled particle is transferred to Bob's lab; this is unlike the &lt;a href=&quot;https://www.researchgate.net/publication/13237765_Teleporting_an_unknown_quantum_state_via_dual_classical_and_Einstein-Podolsky-Rosen_channels&quot; rel=&quot;noreferrer&quot;&gt;Standard&lt;/a&gt; setting where the entangled particles are pre-shared between Alice and Bob before the protocol is even started. Interested people can go through those protocols that use only 1 cbit. I'll &lt;em&gt;try&lt;/em&gt; to explain the last protocol that uses only &lt;strong&gt;1.5&lt;/strong&gt; cbits (fractional cbits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are four particles, namely, $X, Y, Z$ and $U$. $X$ is the unkown particle (or state) that has to be teleported from Alice's lab to Bob's lab. $X, Y$ and $Z$ are with Alice, and $U$ is with Bob. Let $X$ be represented as $\alpha|0\rangle + \beta|1\rangle$, such that $|\alpha|^2+|\beta|^2=1$. The three particles $Y, Z$ and $U$ are in the pure entangled state $|000\rangle+|111\rangle$ (leaving the normalization constants for now).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the initial state of the whole system is:&#xA;$$&#xA;\alpha|0000\rangle + \beta|1000\rangle + \alpha|0111\rangle + \beta|1111\rangle&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Apply chained XOR transformations on $X, Y$ and $Z$ (i) XOR the states of $X$ and $Y$ (ii) XOR the states of $Y$ and $Z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $XOR$ unitary is given by:&#xA;$$&#xA;XOR =&#xA;\left[{\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}}\right].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the state transformations are the following:&#xA;$$&#xA;|00\rangle \rightarrow |00\rangle \\&#xA;|01\rangle \rightarrow |01\rangle \\&#xA;|10\rangle \rightarrow |11\rangle \\&#xA;|11\rangle \rightarrow |10\rangle \\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Step 1, the state of the whole system is:&#xA;$$&#xA;\alpha|0000\rangle + \beta|1110\rangle + \alpha|0101\rangle + \beta|1011\rangle&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Apply Hadamard tranform on the state of $X$.&#xA;$$&#xA;\alpha(|0000\rangle + |1000\rangle) + \beta(|0110\rangle - |1110\rangle) + \alpha(|0101\rangle + |1101\rangle) + \beta(|0011\rangle - |1011\rangle)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Alice measures the state of $X$ and $Y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On simplifying the above representation, we get&#xA;$$&#xA;|00\rangle(\alpha|00\rangle + \beta|11\rangle) + |01\rangle(\alpha|01\rangle + \beta|10\rangle) + |10\rangle(\alpha|00\rangle - \beta|11\rangle) + |11\rangle(\alpha|01\rangle - \beta|10\rangle).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Depending on Alice's measurement outcome, appropiate unitaries are applied on $Z$ (by Alice) and $U$ (by Bob).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(a) If Alice gets $|00\rangle$, then both Alice and Bob do nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(b) If Alice gets $|10\rangle$, then Alice applies $\left[{\begin{array}{cc}1 &amp;amp; 0 \\0 &amp;amp; -1 \end{array}}\right]$ and Bob does nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(c) If Alice gets $|01\rangle$, then Alice does nothing and Bob applies $\left[{\begin{array}{cc}0 &amp;amp; 1 \\1 &amp;amp; 0 \end{array}}\right]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(d) If Alice gets $|11\rangle$, then Alice applies $\left[{\begin{array}{cc}1 &amp;amp; 0 \\0 &amp;amp; -1 \end{array}}\right]$ and Bob applies $\left[{\begin{array}{cc}0 &amp;amp; 1 \\1 &amp;amp; 0 \end{array}}\right]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, $\left[{\begin{array}{cc}1 &amp;amp; 0 \\0 &amp;amp; 1 \end{array}}\right]$, $\left[{\begin{array}{cc}1 &amp;amp; 0 \\0 &amp;amp; -1 \end{array}}\right]$, $\left[{\begin{array}{cc}0 &amp;amp; 1 \\1 &amp;amp; 0 \end{array}}\right]$ and $\left[{\begin{array}{cc}0 &amp;amp; 1 \\-1 &amp;amp; 0 \end{array}}\right]$ can be appropiately used to alter the combined state of $Z$ and $U$ so that it becomes $\alpha|00\rangle + \beta|11\rangle$. &lt;strong&gt;Note&lt;/strong&gt; that if Alice gets $|01\rangle$ or $|11\rangle$, then Bob &lt;em&gt;has&lt;/em&gt; to apply some unitary so that the combined state of $Z$ and $U$ is $\alpha|00\rangle + \beta|11\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;: Apply Hadamard transform on the state of $Z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying the unitaries, the combined state of $Z$ and $U$ is $\alpha|00\rangle + \beta|11\rangle$ (as mentioned above). So, after Step 5, the combined state of $Z$ and $U$ is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\alpha|00\rangle + \alpha|10\rangle + \beta|01\rangle - \beta|11\rangle \\&#xA;= |0\rangle(\alpha|0\rangle + \beta|1\rangle) + |1\rangle(\alpha|0\rangle - \beta|1\rangle).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;: Alice measures the state of $Z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on her measurement, she transmits &lt;em&gt;one&lt;/em&gt; classical bit of information to Bob so that he can use an appropriate unitary to obtain the unkown state!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Discussion&lt;/strong&gt;: So, how does the protocol require $1.5$ bits of clasiical communication? Cleary, Step 6 uses 1 cbit, and in Step 4, it is easy notice that for two outcomes (namely, $|10\rangle$ or $|00\rangle$), Bob need &lt;em&gt;not&lt;/em&gt; apply any unitary. Bob has to apply some unitary (specified prior to the protocool; say $\left[{\begin{array}{cc}0 &amp;amp; 1 \\1 &amp;amp; 0 \end{array}}\right]$) if Alice gets the other two outcomes, and in those scenarios, Alice sends one cbit indicating that the unitary is to be used by Bob. So, it is &lt;strong&gt;mentioned&lt;/strong&gt; that this has a &lt;em&gt;computational burden&lt;/em&gt; of 0.5 cbits (because 50% of the time, Bob need not apply any unitary). Hence, the whole protocol &lt;em&gt;requires&lt;/em&gt; only 1.5 cbits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, Alice must send that 1 cbit whether or not she gets those outcomes, right? Alice and Bob &lt;em&gt;cannot&lt;/em&gt; agree on a particular time (after the protocol) when Alice sends that 1 cbit, and if Bob doesn't get that classical bit by that time, then he knows that he need not apply any unitary. These time dependent protcols are, in general, not allowed due to relativistic consequences (otherwise, you can even make the Standard protocol to use time for indicating information and reduce the classical communication cost to 1 cbit; for example, at $t_1$, send one cbit or at $t_2$, send one cbit). So, Alice must send that cbit everytime, right? In that case, the protcol requires 2 cbits (one in Step 4 and another in Step 6). I thought it'd be good if there was a discussion on this particular part.&lt;/p&gt;&#xA;" OwnerUserId="506" LastActivityDate="2018-05-11T10:11:25.823" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2028" PostTypeId="1" CreationDate="2018-05-11T14:47:33.197" Score="15" ViewCount="1084" Body="&lt;p&gt;When a qubit is measured, there is a ‘collapse of the wave-function’ as a result is randomly chosen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the qubit is entangled with others, this collapse will also effect them. And the way it affects them depends on the way we chose to measure our qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this it seems as though things we do on one qubit have instantaneous effects on another. Is this the case, or is the apparent effect more like a &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Bayesian_inference&quot; rel=&quot;noreferrer&quot;&gt;Bayesian update&lt;/a&gt; of our knowledge about the qubits?&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-05-17T13:43:34.103" LastActivityDate="2018-05-17T13:43:34.103" Title="Is it true to say that one qubit in an entangled state can instantaneously affect all others?" Tags="&lt;entanglement&gt;&lt;quantum-state&gt;&lt;bayesian-learning&gt;&lt;non-locality&gt;&lt;contextuality&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2029" PostTypeId="2" ParentId="2028" CreationDate="2018-05-11T14:55:34.207" Score="7" Body="&lt;p&gt;It is certainly true that, within the mathematical description of qubits, operations on one qubit can require the whole description to be updated. This therefore affects the description of every qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those who take a 'epistemic' view of this mathematical description might say that we are just updating our knowledge about the other qubits, and that it doesn't affect the qubits themselves. Those who take an 'ontic' view, however, regard the wave function described by the mathematics of quantum mechanics as being a physical property of the qubits. So they would certainly conclude that the the operation on one qubit instantly affected the others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the ontic view is more prevalent these days, among those who have opinions on these things. Though most take the 'Shut up and calculate' option and don't think about them too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another interesting issue is the fact that instantaneous effects cause problems for relativity. Different observers in different reference frames can disagree on the time ordering of events. So one observer might see one qubit being used to affect a second, whereas another observer might see the same events and conclude that the second qubit is affecting the first. Entanglement avoids direct confrontation with relativity by making sure that the affect cannot be used to send any information instantaneously. But nevertheless, they don't play very well together. So that's why we can be hesitant to state that very strongly that entanglement allows instantaneous effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process of teleportation is, I think, a good one to argue that entanglement does indeed allow qubits to instantly affect each other, as well as showing how it compromises with relativity. It is a process by which the state of a qubit is instantaneously sent from one qubit to another, using entanglement. But the state being sent also gets 'scrambled' during the process. This means that it is impossible for the receiving end to even confirm that the qubit has been sent, never mind see what its state is. However, the transmitter can send a message to the receiver with instructions on how to unscramble the qubit. Once this is done, the receivers can confirm that the teleportation did indeed send the state of the qubit. So there was indeed an instantaneous effect, but non-instantaneous effects (sending the unscrambling information) were also needed to reveal the effect and make it useful.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-11T14:55:34.207" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2030" PostTypeId="1" AcceptedAnswerId="2039" CreationDate="2018-05-11T15:17:18.643" Score="20" ViewCount="3924" Body="&lt;p&gt;I have been trying to get a basic idea of what anyons are for the past couple of days. However, the online articles (including Wikipedia) seem unusually vague and impenetrable as far as explaining topological quantum computing and anyons goes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;Wiki page&lt;/a&gt; on &lt;em&gt;Topological quantum computer&lt;/em&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A topological quantum computer is a theoretical quantum computer that&#xA;  employs two-dimensional quasiparticles called &lt;strong&gt;anyons&lt;/strong&gt;, whose world&#xA;  lines pass around one another to &lt;strong&gt;form braids&lt;/strong&gt; in a three-dimensional&#xA;  spacetime (i.e., &lt;strong&gt;one temporal plus two spatial dimensions&lt;/strong&gt;). These braids &#xA;  &lt;strong&gt;form the logic gates&lt;/strong&gt; that make up the computer. The advantage of a&#xA;  quantum computer based on &lt;strong&gt;quantum braids&lt;/strong&gt; over using trapped quantum&#xA;  particles is that the former is much more stable. Small, cumulative&#xA;  perturbations can cause quantum states to decohere and introduce&#xA;  errors in the computation, but such small perturbations do not change&#xA;  the braids' topological properties.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This sounded interesting. So, on seeing this definition I tried to look up what &lt;a href=&quot;https://en.wikipedia.org/wiki/Anyon&quot; rel=&quot;noreferrer&quot;&gt;anyons&lt;/a&gt; are: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In physics, an anyon is a type of &lt;strong&gt;quasiparticle&lt;/strong&gt; that occurs only in&#xA;  &lt;strong&gt;two-dimensional systems&lt;/strong&gt;, with properties much less restricted than&#xA;  fermions and bosons. In general, the operation of exchanging two&#xA;  identical particles may cause a &lt;strong&gt;global phase shift&lt;/strong&gt; but cannot affect&#xA;  observables.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Okay, I do have &lt;em&gt;some&lt;/em&gt; idea about what &lt;strong&gt;quasiparticles&lt;/strong&gt; are. For example, as an electron travels through a semiconductor, its motion is disturbed in a complex way by its interactions with all of the other electrons and nuclei; however, it approximately behaves like an electron with a different mass (effective mass) travelling unperturbed through free space. This &quot;electron&quot; with a different mass is called an &quot;electron quasiparticle&quot;. So I tend to assume that a quasiparticle, in general, is an approximation for the complex particle or wave phenomenon that may occur in matter, which would be difficult to mathematically deal with otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I could not follow what they were saying after that. I do know that bosons are particles which follow the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bose%E2%80%93Einstein_statistics&quot; rel=&quot;noreferrer&quot;&gt;Bose-Einstein statistics&lt;/a&gt; and fermions follow the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fermi%E2%80%93Dirac_statistics&quot; rel=&quot;noreferrer&quot;&gt;Fermi-Dirac statistics&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;However, what do they mean by &quot;much less restricted than fermions and bosons&quot;? Do &quot;anyons&quot; follow a different kind of statistical distribution than what bosons or fermions follow? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the next line, they say that exchanging two identical particles may cause a global phase shift but cannot affect the observables. What is meant by &lt;strong&gt;global phase shift&lt;/strong&gt; in this context? Moreover, &lt;em&gt;which&lt;/em&gt; &lt;strong&gt;observables&lt;/strong&gt; are they actually talking about here? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How are these quasiparticles i.e. anyons actually relevant to quantum computing? I keep hearing vague things likes &quot;&lt;em&gt;The world-lines of anyons form braids/knots in 3-dimensions (2 spatial and 1 temporal). These knots help form stable forms of matter, which aren't easily susceptible to decoherence&lt;/em&gt;&quot;. I think that &lt;a href=&quot;https://www.youtube.com/watch?v=GJHhnr9R_ZM&quot; rel=&quot;noreferrer&quot;&gt;this Ted-Ed video&lt;/a&gt; gives &lt;em&gt;some&lt;/em&gt; idea, but it seems to deal with restricting &lt;em&gt;electrons&lt;/em&gt; (rather than &quot;anyons&quot;) to move on a certain closed path inside a material.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would be glad if someone could help me to &lt;em&gt;connect the dots&lt;/em&gt; and understand the &lt;em&gt;meaning&lt;/em&gt; and &lt;em&gt;significance&lt;/em&gt; of &quot;anyons&quot; at an intuitive level. I think a &lt;em&gt;layman-level&lt;/em&gt; explanation would be more helpful for me, initially, rather than a full-blown mathematical explanation. However, I do know basic undergraduate level quantum mechanics, so you may use that in your explanation. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-11T19:06:07.347" LastActivityDate="2018-05-15T10:11:43.293" Title="What exactly are anyons and how are they relevant to topological quantum computing?" Tags="&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2031" PostTypeId="5" CreationDate="2018-05-11T15:22:17.167" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-11T15:22:17.167" LastActivityDate="2018-05-11T15:22:17.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2032" PostTypeId="4" CreationDate="2018-05-11T15:22:17.167" Score="0" Body="For questions about anyons as relevant to quantum computing. An anyon is a type of quasiparticle that occurs only in two-dimensional systems, with properties much less restricted than fermions and bosons. In general, the operation of exchanging two identical particles may cause a global phase shift but cannot affect observables. Anyons are generally classified as abelian or non-abelian (Wikipedia). They are necessary for topological quantum computing. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:53:09.920" LastActivityDate="2019-01-01T09:53:09.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2033" PostTypeId="2" ParentId="2028" CreationDate="2018-05-11T15:26:15.570" Score="9" Body="&lt;p&gt;If Alice and Bob have an entangled pair of qubits and Alice locally measures her qubit, it does not affect local state of the Bob's qubit in any way. Mathematically, if Alice measures but does not look at the measurement outcome, density matrix of the Bob's qubit does not change. The sole fact of Alice's measurement does not affect the Bob's qubit in any way. If Alice measures and knows the measurement outcome, then Alice has more information about the Bob's qubit than Bob, but this is pure classical situation described by conditional probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the Alice's measurement can only instantly affect Alice's information about the Bob's qubit, and no more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above said does not explain the &quot;spooky action at distance&quot;, we know the satisfying explanation does not exist. Still we can argue about entanglement and measurements avoiding paradoxes and contradictions, and so the answer to the question in the title:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;No, it is not true&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-05-11T15:52:58.750" LastActivityDate="2018-05-11T15:52:58.750" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2034" PostTypeId="2" ParentId="2030" CreationDate="2018-05-12T02:15:47.410" Score="11" Body="&lt;p&gt;You are right, it does look like the Wikipedia page needs work, so I will have to update it. But for now I will answer all five questions:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; What do they mean by &quot;much less restricted than fermions and bosons? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The exchange of two fermions or bosons is &lt;strong&gt;&lt;em&gt;restricted&lt;/em&gt;&lt;/strong&gt; by:&#xA;$|\psi_1\psi_2\rangle = \pm|\psi_2\psi_1\rangle$.&lt;br&gt;&#xA;The &quot;$+$&quot; corresponds to bosons and the &quot;$-$&quot; corresponds to fermions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For anyons we have the much &lt;strong&gt;&lt;em&gt;less restricted&lt;/em&gt;&lt;/strong&gt;: $|\psi_1\psi_2\rangle = e^{i\theta}|\psi_2\psi_1\rangle$. &lt;br&gt;&#xA;Notice that when $\theta=0$ we have bosons, and when $\theta=\pi$ we have fermions (by &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;noreferrer&quot;&gt;Euler's formula&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; Do &quot;anyons&quot; follow a different kind of statistical distribution than what bosons or fermions follow?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Anyons can obey statistics ranging continuously between Fermi-Dirac statistics and Bose-Einstein statistics, because $\theta$ can be $0$ (bosons), $\pi$ (fermions), or anything in between. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; Exchanging two identical particles may cause a global phase shift but cannot affect the observables. What is meant by global phase shift in this context? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That line from Wikipedia needs to be improved. The &quot;global phase shift&quot; is the $e^{i\theta}$ in the above formula. So it is &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; specific to anyons, since there is a global phase change of $-1$  when we exchange fermions as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What the Wikipedia article &lt;strong&gt;&lt;em&gt;should&lt;/em&gt;&lt;/strong&gt; have said was that when you exchange two identical particles &lt;strong&gt;&lt;em&gt;twice&lt;/em&gt;&lt;/strong&gt; you still get a global phase shift, which is not true for bosons and fermions. Here the first and second arrows indicate the first and second times we exchange particles 1 and 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bosons: $|\psi_1\psi_2\rangle \rightarrow |\psi_2\psi_1\rangle \rightarrow |\psi_1\psi_2\rangle$ (no global phase)&lt;br&gt;&#xA;Fermions: $|\psi_1\psi_2\rangle \rightarrow -|\psi_2\psi_1\rangle \rightarrow -(-|\psi_1\psi_2\rangle)=|\psi_1\psi_2\rangle$ (no global phase)&lt;br&gt;&#xA;Anyons: $|\psi_1\psi_2\rangle \rightarrow e^{i\theta}|\psi_2\psi_1\rangle \rightarrow e^{i\theta}(e^{i\theta})=e^{i2\theta}|\psi_1\psi_2\rangle$ (global phase of $e^{i2\theta}$)&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; Moreover, which observables are they actually talking about here? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;An observable is anything that can be observed in an experiment. For example, the position of the particle, $x$. When measuring the position of the particle, the probability of finding the particle at position $x$ is given by $\langle \psi|\hat{x}|\psi\rangle $. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that this is unaffected by a global phase, because we have:&lt;br&gt;&#xA;$| \psi\rangle=e^{i\theta}|\phi\rangle$&lt;br&gt;&#xA;$\langle \psi|=e^{-i\theta}\langle\phi|$&lt;br&gt;&#xA;$\langle\psi|\hat{x}|\psi\rangle = \langle\phi|\hat{x}|\phi\rangle $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So two states $|\phi\rangle$ and $|\psi\rangle$, which differ by a phase of $e^{i\theta}$, as in this case, have the &lt;strong&gt;&lt;em&gt;same&lt;/em&gt;&lt;/strong&gt; observations in experiment.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;5)&lt;/strong&gt; How are these quasiparticles i.e. anyons actually relevant to quantum computing? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are many proposals for building a quantum computer, for example:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;(i)&lt;/strong&gt; NMR quantum computers make use of fermions (such as the spin of a proton).&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;(ii)&lt;/strong&gt; Photonic quantum computers make use of bosons (photons are bosons) &lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;(iii)&lt;/strong&gt; Topological quantum computers are a proposed type of quantum computer which would make use of anyons.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;An advantage of (iii) over (i) is that fidelities should be much greater. The advantage over (ii) is that it should be easier to get the qubits to interact. The disadvantage over both (i) and (ii) is that experiments involving anyons are comparatively rather new. NMR has been around since 1938 and lasers (photonics) have been around since 1960, but experiments with anyons began in the 1980s and are still far away from reaching the maturity of spin science or laser science, not to say that it will never happen in the future.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;I think a layman-level explanation would be more helpful for me, initially, rather than a full-blown mathematical explanation.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A layman definition without mathematics is going to be very difficult because what distinguishes anyons from bosons and anyons is that the exchange of anyons introduces a factor of $e^{i\theta}$ to the wavefunction, which is a mathematical explanation. If I had to explain anyons to someone who knows what a wavefunction is but nothing else, I would say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;When two particles are switched, the wavefunction of the overall system stays the same for bosons, picks up a negative sign for fermions, and can pick up any factor of the form $e^{i\theta}$ for anyons.&quot;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-12T03:31:21.883" LastActivityDate="2018-05-12T03:31:21.883" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="2035" PostTypeId="1" CreationDate="2018-05-12T17:34:38.400" Score="4" ViewCount="66" Body="&lt;p&gt;&lt;strong&gt;CTs / ZEFOZs&lt;/strong&gt;: Energy level structures that include &lt;a href=&quot;https://en.wikipedia.org/wiki/Avoided_crossing&quot; rel=&quot;nofollow noreferrer&quot;&gt;avoided crossings&lt;/a&gt; at accessible energies tend to be resilient to noise and therefore present high coherence times, at least in the case of spin qubits and magnetic noise: as the at first order effect of the magnetic field on the qubit energy vanishes, so does effectively most magnetic noise. Different people call these Atomic Clock Transitions (CTs or ACTs) or Zero First-Order-Zeeman (ZEFOZ) shift, but it's essentially the same phenomenon. This is experimentally expressed as high spin-spin $T_2$ relaxation times, even in presence of relatively high sources of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in a quantum computing scenario, what we want is typically not a qubit surviving for long periods of inactivity (high $T_2$) but rather to obtain a high fidelity after a series of quantum gates, which can in general be rather complicated and involve entanglement with other qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;: Do CTs / ZEFOZs with their high relaxation times generally also translate into a high fidelity after a complicated series of quantum gates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For context, the examples I have in mind are solid-state, mainly these two:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.uv.es/gaita/16Nature.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enhancing coherence in molecular spin qubits via atomic clock transitions&lt;/a&gt; (Shiddiq et al, doi: 10.1038/nature16984)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1201.4610.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reducing decoherence in optical and spin transitions in rare-earth-ion doped materials&lt;/a&gt; (McAuslan et al, doi: 10.1103/PhysRevA.85.032339)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As well as this more refined variation, with electric field:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.nature.com/articles/s41467-017-00378-x&quot; rel=&quot;nofollow noreferrer&quot;&gt;Silicon quantum processor with robust long-distance qubit couplings&lt;/a&gt; (Tosi et al, doi:10.1038/s41467-017-00378-x)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="2293" LastEditDate="2018-05-12T20:46:50.420" LastActivityDate="2018-05-13T05:23:33.643" Title="Do avoided crossings / CTs /ZEFOZs optimize quantum fidelity in practice?" Tags="&lt;physical-qubit&gt;&lt;noise&gt;&lt;solid-state&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2036" PostTypeId="1" AcceptedAnswerId="2038" CreationDate="2018-05-12T21:57:48.573" Score="16" ViewCount="2002" Body="&lt;p&gt;Given that the global phases of states cannot be physically discerned, why is it that quantum circuits are phrased in terms of unitaries and not special unitaries? One answer I got was that it is just for convenience but I'm still unsure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A related question is this: are there any differences in the physical implementation of a unitary $U$ (mathematical matrix) and $ V: =e^{i\alpha}U$, say in terms of some elementary gates? Suppose there isn't (which is my understanding). Then the physical implementation of $c\text{-}U$ and $c\text{-}V$ should be the same (just add controls to the elementary gates). But then I get into the contradiction that $c\text{-}U$ and $c\text{-}V$ of these two unitaries may not be equivalent up to phase (as mathematical matrices), so it seems plausible they correspond to different physical implementations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have I done wrong in my reasoning here, because it suggests now that $U$ and $V$ must be implemented differently even though they are equivalent up to phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another related question (in fact the origin of my confusion, I'd be extra grateful for an answer to this one): it seems that one can use a quantum circuit to estimate both the modulus and phase of the complex overlap $\langle\psi|U|\psi\rangle$ (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0203016&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0203016&lt;/a&gt;). But doesn't this imply again that $U$ and $e^{i\alpha}U$ are measurably different? &lt;/p&gt;&#xA;" OwnerUserId="2375" LastEditorUserId="26" LastEditDate="2018-05-13T08:41:44.637" LastActivityDate="2018-05-14T15:24:10.033" Title="Why are quantum gates unitary and not special unitary?" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2037" PostTypeId="2" ParentId="2035" CreationDate="2018-05-13T05:23:33.643" Score="1" Body="&lt;p&gt;&lt;em&gt;The best I have it's this generic answer, which I put here for clarity, hoping for improvements/corrections or even to be superseded by something better:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the limiting factor for fidelity in a given architecture+algorithm are the single-qubit gates, or the two-qubit gates, or the measurement, and if this limiting factor is not optimized in a ZEFOZ point, then effectively quantum fidelity will not be optimal in the ZEFOZ point.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-05-13T05:23:33.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2038" PostTypeId="2" ParentId="2036" CreationDate="2018-05-13T05:23:52.050" Score="12" Body="&lt;p&gt;Even if you only limit yourself to special-unitary operations, states will still accumulate global phase. For example, $Z = \begin{bmatrix} i &amp;amp; 0 \\ 0 &amp;amp; -i \end{bmatrix}$ is special-unitary but $Z \cdot |0\rangle = i |0\rangle \neq |0\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If states are going to accumulate unobservable global phase &lt;em&gt;anyways&lt;/em&gt;, what benefit do we get out of limiting ourselves to special unitary operations?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;are there any differences in the physical implementation of a unitary $U$ (mathematical matrix) and $V :=e^{i\alpha}U$, say in terms of some elementary gates?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As long you're not doing anything that could make the global phases relevant, they can have the same implementation. But if you're going to do something like, uh-&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;add controls to the elementary gates&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yeah, like that. If you do stuff like that, then you can't ignore global phases. Controls turn global phases into relative phases. If you want to completely ignore global phase, you can't have a black box &quot;add a control&quot; operation modifier.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-05-13T05:23:52.050" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2039" PostTypeId="2" ParentId="2030" CreationDate="2018-05-13T09:44:02.567" Score="15" Body="&lt;p&gt;The first thing to do is to think topologically: make sure you understand why a coffee cup is the same thing topologically as a donut.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine we swap two identical particles, and do it again, so that we are back where we started. Apply this topological thinking to the paths taken by the particles: it is the same as doing nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I show a picture of this, where one particle is dragged around another particle. Topologically, the path taken can be deformed back to the &quot;do nothing&quot; path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oxoUi.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oxoUi.png&quot; alt=&quot;particle monodromy&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The square root of this operation is a swap:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pqWfC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pqWfC.png&quot; alt=&quot;particle swap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the square root of 1 is either +1 or -1, a swap affects the state by multiplying by either +1 (for bosons) or -1 (for fermions.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand anyons, we are going to do the same analysis, but with one less dimension. So now a particle winding around another particle is not topologically the same as the &quot;do nothing&quot; operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lJ7JB.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lJ7JB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need the extra third dimension to untangle the path of the anyon, and since we can't do this topologically, the state of the system could be modified by such a process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Things get more interesting as we add particles. With three anyons, the paths taken can get tangled, or &lt;em&gt;braided&lt;/em&gt; in arbitrary ways. To see how this works it helps to use three dimensions: two space dimensions and one time dimension. Here is an example of three anyons wandering around and then returning back where they started:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ifCYr.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ifCYr.png&quot; alt=&quot;three anyons braid&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long before physicists started to think about anyons, the mathematicians already worked out how these braiding processes combine to form new braids or undo braids. These are known as &quot;braid groups&quot; in work that dates back to Emil Artin in 1947.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like the distinction between Bosons and Fermions above, different anyon systems will behave differently when you do these braid operations. One example of anyon, known as the Fibonacci anyon, are able to approximate &lt;em&gt;any&lt;/em&gt; quantum operation just by doing these kinds of braids. And so theoretically we could use these to build a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote an introductory paper on anyons, which is where I got these pictures from: &lt;a href=&quot;https://arxiv.org/abs/1610.05384&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1610.05384&lt;/a&gt;. There's more mathematics there, as well as a description of a close cousin of anyon theory known as a &quot;modular functor&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another good reference, with more Fibonacci anyon goodness: &lt;a href=&quot;https://arxiv.org/abs/1802.06176&quot; rel=&quot;noreferrer&quot;&gt;Introduction to topological quantum computation with non-Abelian anyons&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: I see that I didn't say anything about the observables. &#xA;The &lt;em&gt;observables&lt;/em&gt; of the system measure the total anyon content within a region. In terms of anyon paths we can think of this as bringing all the anyons in some region together and &quot;fusing&quot; them into one anyon, which may be the &quot;no anyon&quot; aka vacuum state. For a system supporting Fibonacci anyons there will only ever be two outcomes for such a measurement: fibonacci anyon or vacuum. Another example is the toric code where there are four anyon outcomes.&lt;/p&gt;&#xA;" OwnerUserId="263" LastEditorUserId="263" LastEditDate="2018-05-15T10:11:43.293" LastActivityDate="2018-05-15T10:11:43.293" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2040" PostTypeId="2" ParentId="2036" CreationDate="2018-05-13T13:33:07.543" Score="10" Body="&lt;p&gt;The fact that quantum gates are unitary, is rooted in  the fact that the evolution of (closed) quantum systems is by the Schr&amp;ouml;diner equation. For a time interval in which we are trying to realise a particular unitary transformation at a constant rate, we use the time-independent Schr&amp;ouml;dinger equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \tfrac{\mathrm d}{\mathrm dt} \lvert \psi(t) \rangle = \tfrac {1}{i\hbar}H \lvert \psi(t) \rangle, $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $H$ is the Hamiltonian of the system: a Hermitian matrix, whose eigenvalues describe energy eigenvalues. In particular, the eigenvalues of $H $ are real. The solution to this equation is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \lvert \psi(t) \rangle = \exp\bigl(-i H t/\hbar\bigr) \lvert \psi(0) \rangle $$&#xA;where $U = \exp(-iHt/\hbar)$ is the matrix which you obtain by taking the eigenvectors of $H$, and replacing their eigenvalues $E$ with $\mathrm{e}^{iEt/\hbar}$. Thus, from a matrix with real eigenvalues, we get a matrix whose eigenvalues are complex numbers with unit norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would it take for this evolution to specifically be a special unitary matrix? A special unitary matrix is one whose determinant is precisely $1$; that is, whose eigenvalues all multiply to $1$. This corresponds to the restriction that the eigenvalues of $H$ all sum to zero. Furthermore, because the eigenvalues of $H$ are energy levels, &lt;em&gt;whether&lt;/em&gt; the sum of its eigenvalues is equal to zero depends on how you have decided to fix what your zero energy point is &amp;mdash; which is in effect a subjective choice of reference frame. (In particular, if you decide to adopt the convention that all of your energy levels are non-negative, this implies that no interesting system will ever have the property of the energy eigenvalues summing to zero.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, gates are unitary rather than special unitary, because the determinant of a gate does not correspond to physically meaningful properties &amp;mdash; in the explicit sense that the gate arises from the physics, and the conditions which correspond to the determinant of the gate being 1 is a condition of one's own reference frame and not the physical dynamics.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-13T14:38:23.253" LastActivityDate="2018-05-13T14:38:23.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2041" PostTypeId="1" AcceptedAnswerId="2042" CreationDate="2018-05-13T14:09:15.530" Score="10" ViewCount="578" Body="&lt;p&gt;Question: Given a unitary matrix acting on $n$ qubits, can we find the shortest sequence of Clifford + T gates that correspond to that unitary?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For background on the question, two important references:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1206.5236&quot; rel=&quot;noreferrer&quot;&gt;Fast and efficient exact synthesis of single qubit unitaries generated by Clifford and T gates&lt;/a&gt;  by Kliuchnikov, Maslov, and Mosca &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1212.0506&quot; rel=&quot;noreferrer&quot;&gt;Exact synthesis of multiqubit Clifford+T circuits&lt;/a&gt; by Giles and Selinger.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1860" LastEditorUserId="1860" LastEditDate="2018-05-13T15:07:37.240" LastActivityDate="2018-08-07T21:07:33.170" Title="Shortest sequence of universal quantum gates that correspond to a given unitary" Tags="&lt;circuit-construction&gt;&lt;universal-gates&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2042" PostTypeId="2" ParentId="2041" CreationDate="2018-05-13T15:12:46.007" Score="10" Body="&lt;p&gt;Getting an optimal decomposition is definitely an open problem. (And, of course, the decomposition is intractable, $\exp(n)$ gates for large $n$.)  A &quot;simpler&quot; question you might ask first is what is the shortest sequence of cnots and single qubit rotations by any angle, (what IBM, Rigetti, and soon Google currently offer, this universal basis of gates can be expressed in terms of your basis of Cliffords and t-gates). This &quot;simpler&quot; question is also open and has a non-unique answer. A related question is what is an exact optimal decomposition of gates from a universal basis to go from ground state to a given final state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming you are referring to exact decompositions. If you want approximate decompositions, there are different methods for that, such as the Trotter-Suzuki decomposition, or approximating an exact decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;quantum csd compiler&quot; in Qubiter does a non-optimized decomposition of any n qubit unitary into cnots and single qubit rots using the famous csd (Cosine-Sine Decomposition) subroutine from LAPACK. Some enterprising person could try to find optimizations for Qubiter's quantum compiler. You can use Qubiter's compiler, for example (I wrote a paper on this), to let your classical computer re-discover Coppersmith's quantum Fourier Transform decomposition!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/artiste-qb-net/qubiter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qubiter&lt;/a&gt; is open source and available at github (full disclosure - I wrote it).&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="91" LastEditDate="2018-08-07T21:07:33.170" LastActivityDate="2018-08-07T21:07:33.170" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2043" PostTypeId="1" AcceptedAnswerId="2044" CreationDate="2018-05-13T15:17:10.763" Score="5" ViewCount="218" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Consider the state $|X\rangle = \sqrt{0.9} |00\rangle + \sqrt{0.1} |11\rangle$, shared between Alice and Bob, who are located far apart.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice brings in an ancilla qubit at her location (left-most qubit in the kets): $|X\rangle = \sqrt{0.9} |000\rangle + \sqrt{0.1} |011\rangle$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now Alice performs a CNOT gate with the control being her entangled qubit, and the target being the ancilla: $|X\rangle = \sqrt{0.9} |000\rangle + \sqrt{0.1} |111\rangle$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then Alice measures the ancilla in the basis $\{\sqrt{0.1} |0\rangle + \sqrt{0.9} |1\rangle  ,   \sqrt{0.9} |0\rangle - \sqrt{0.1} |1\rangle\}$. Supposing the measurement outcome is $+1$, i.e., the ancilla collapsed to the state $\sqrt{0.1} |0\rangle + \sqrt{0.9} |1\rangle$ , the remaining state of the initial $2$ qubits will be $|X\rangle = \sqrt{0.1 \times 0.9} |00\rangle + \sqrt{0.9 \times 0.1} |11\rangle$, which is the maximally entangled state up to a normalization factor.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We started from a state that was not maximally entangled, and we were able to boost the entanglement by doing a local measurement and post-selecting on the outcome. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is entanglement distillation using post-selection as I have described above feasible?&lt;/p&gt;&#xA;" OwnerUserId="1860" LastEditorUserId="26" LastEditDate="2018-05-13T16:16:44.533" LastActivityDate="2018-05-13T17:27:28.033" Title="Entanglement distillation by local operations and post-selection using one entanglement pair" Tags="&lt;entanglement&gt;&lt;state-distillation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2044" PostTypeId="2" ParentId="2043" CreationDate="2018-05-13T17:27:28.033" Score="3" Body="&lt;p&gt;There are two different contexts where the term &quot;entanglement distillation&quot; is used, and are largely incomparable, even if they are conceptually extremely close (and I'm sure you'll be able to find papers that blur these boundaries).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first, Alice and Bob share a &lt;strong&gt;known&lt;/strong&gt; quantum state which is (usually) a &lt;strong&gt;pure&lt;/strong&gt; state. They use this to make a maximally entangled state with some probability. You can see this, for example, in section 12.5.1 of Nielsen &amp;amp; Chuang (&quot;Transforming bi-partite pure state entanglement&quot;). The protocol described in the question is the standard protocol in this context, except that the measurements are often expressed as POVMs instead of projective measurements in a larger Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second, one has many copies of a mixed state that one wishes to to make more entangled. This situation may be referred to as &quot;purification&quot; because one of the aims is, essentially, to make the state as pure as possible. The use of the mixed state, as usual, may describe part of an entangled system, or may describe some lack of knowledge/stochastic preparation procedure etc. In essence, there is some lack of knowledge about what you have, and variation between the copies, and it is this extra complication that necessitates multiple copies. See, for example, section 12.5.3 of Nielsen &amp;amp; Chuang (&quot;Entanglement distillation and quantum error-correction&quot;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-13T17:27:28.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2045" PostTypeId="2" ParentId="2036" CreationDate="2018-05-14T06:03:49.063" Score="5" Body="&lt;p&gt;When writing gates for, for example, a quantum circuit diagram, you &lt;em&gt;could&lt;/em&gt; always write them using the convention of having determinant one (from the special unitary group), but it's just a convention. It makes no physical difference to the circuit that you implement. As said &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2040/1837&quot;&gt;elsewhere&lt;/a&gt;, whether what you naturally produce corresponds directly to the special unitary is really a choice of convention, and where you define your 0 energy to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the issue when you start implementing controlled-$U$, there is an interesting comparison to be made. Let's say we define $V=e^{i\alpha}$. How can we implement controlled-$V$ in terms of controlled-$U$? You apply controlled-$U$ and then, on the control qubit, you apply the phase gate $\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\alpha} \end{array}\right)$. There are two things to observe here. First, the difference is on the control qubit rather than the target qubit. The target qubit, where you're implementing the $U$, doesn't really care about the difference in phase. It's the control-qubit that's hit by the phase gate. The second is that I didn't write the phase gate as a special unitary. Of course, I could have written it as $\left(\begin{array}{cc} e^{-i\alpha/2} &amp;amp; 0 \\ 0 &amp;amp; e^{i\alpha/2}\end{array}\right)$ but I didn't because the way that I chose to write it was notationally more convenient - less writing for me, and hopefully more immediately obvious to you why it works.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-14T06:03:49.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2046" PostTypeId="2" ParentId="2041" CreationDate="2018-05-14T07:46:04.290" Score="4" Body="&lt;p&gt;Suppose that an exact synthesis was possible for your provided unitary (the number of theoretic restriction on the entries) and so the algorithms described in the question gave you a sequence of Clifford+T gates that implemented that unitary. As stated in the Giles-Selinger paper, you get a sequence that is very far from optimal. So at this point you have reduced to the word problem in the group generated by the Clifford+T gate set. Some groups have algorithms to shorten a given word while still representing the same element of the group into a normal form that is the shortest within that class. Others do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details to illustrate the principle: Let us say there are $2$ qubits. Denote $S_1$ etc for the generator that does the phase gate on qubit $1$, $CNOT_{12}$ for $1$ being the control etc. Each one of these is treated as a letter. The algorithm will spit out some word in these generators. The group is the group with these generators and many relations like $S_i^4=1$ and $X_i Y_j = Y_j X_i$ when $i \neq j$ among many other relations. So this defines some finitely generated group. Because we have a word from the provided algorithms but has not been optimized, the task is to provide a convenient shortest possible normal form in the word problem for this group. So if given the word $S_1 S_1 S_2 S_1 S_1$ one could use the relation $S_1 S_2 = S_2 S_1$ twice and the $S_1^4=1$ relation once to get $S_2$ as a shorter word that represents the same group element. For a given group presentation, one would like an algorithm that takes an arbitrary word and reduces it. In general this is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer for below: Forthcoming project/Haskell implementation joint w/ Jon Aytac.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know about the solvability of the word problem for the Clifford+T gate set, but one can do something simpler with only the involutions (call them $r_i$) in that set and only the relations of the form $(r_i r_j)^{m_{ij}}=1$. That is a Coxeter group related to the Clifford+T gate set, but with an efficiently solvable word problem. So one may take the result of the Giles-Selinger algorithm and potentially shorten it using only these very simple relations (after looking at segments with only those involution letters). In fact any algorithm that takes a given unitary and approximates or exactly synthesizes it into Clifford+T can be fed into this procedure to potentially shorten it slightly.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2018-05-15T04:40:50.097" LastActivityDate="2018-05-15T04:40:50.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2047" PostTypeId="1" AcceptedAnswerId="2048" CreationDate="2018-05-14T08:18:45.467" Score="7" ViewCount="513" Body="&lt;p&gt;I understand that there are two ways to think about 'general quantum operators'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Way 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can think of them as trace-preserving completely positive operators. These can be written in the form &#xA;$$\rho'=\sum_k A_k \rho A_k^\dagger \tag{1}$$&#xA;where $A_k$ are called Kraus operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Way 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As given in (An Introduction to Quantum Computing by Kaye, Laflamme and Mosca, 2010; pg59) we have a&#xA;$$\rho'=\mathrm{Tr}_B\left\{ U(\rho \otimes \left| 00\ldots 0\right&amp;gt;\left&amp;lt;00\ldots 0 \right|) U^\dagger  \right\} \tag{2}$$&#xA;where $U$ i s a unitary matrix and the ancilla $\left|00 \ldots 0\right&amp;gt;$ has at most size $N^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exercise 3.5.7 (in Kaye, Laflamme and Mosca, 2010; pg60) gets you to prove that  operators defined in (2) are completely positive and trace preserving (i.e. can be written as (1)). My question is the natural inverse of this; can we show that any completely positive, trace preserving map can be written as (2)? I.e. are (1) and (2) equivalent definitions of a 'general quantum operator'?&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="55" LastEditDate="2019-05-14T17:15:20.660" LastActivityDate="2019-11-18T13:52:49.363" Title="Is the Kraus representation of a quantum channel equivalent to a unitary evolution in an enlarged space?" Tags="&lt;quantum-gate&gt;&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2048" PostTypeId="2" ParentId="2047" CreationDate="2018-05-14T08:59:39.093" Score="10" Body="&lt;p&gt;This question is posed, and answered positively, in Nielsen &amp;amp; Chuang in a subsection of chapter 8 entitled &quot;System-environment models for and operator-sum representation&quot;. In my version, it can be found on page 365.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine $|\psi\rangle$ is an arbitrary pure state on the space upon which you wish to enact the operators. Let $|e_0\rangle$ be some fixed state on another quantum system (with dimension equal to at least the number of Krauss operators, and labelled 'B'). Then you can define a unitary by its action on the space of states spanned by $|\psi\rangle$:&#xA;$$&#xA;U|\psi\rangle|e_0\rangle=\sum_k(A_k|\psi\rangle)|e_k\rangle,&#xA;$$&#xA;where the $|e_k\rangle$ are an orthonormal basis. To check that this corresponds to a valid unitary, we just have to test it for different input states and ensure that the initial overlap is preserved:&#xA;$$&#xA;\langle\psi|\phi\rangle\langle e_0|e_0\rangle=\langle\psi|\langle e_0|U^\dagger U|\phi\rangle|e_0\rangle=\langle\psi|\sum_kA_k^\dagger A_k|\phi\rangle,&#xA;$$&#xA;which is true thanks to the completeness relation of the Krauss operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, one just has to check that this unitary does indeed implement the claimed map:&#xA;$$&#xA;\text{Tr}_B\left(U|\psi\rangle\langle \psi|\otimes|e_0\rangle\langle e_0|U^\dagger\right)=\sum_kA_k|\psi\rangle\langle\psi|A_k^\dagger.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-14T08:59:39.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2049" PostTypeId="1" CreationDate="2018-05-14T10:19:31.483" Score="6" ViewCount="446" Body="&lt;p&gt;The feature of quantum error correcting codes called &lt;em&gt;degeneracy&lt;/em&gt; is that they can sometimes be used to correct more errors than they can uniquely identify. It seems that codes exhibiting such characteristic are able to overcome the performance of quantum error correction codes that are nondegenerate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if there exists some kind of measure, or classification method in order to determine how degenerate is a quantum code, and so if there has been any study trying to determine the error correction abilities of quantum codes depending on the degeneracy of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from that, it would be interesting to give reference or some intuition about how to construct good degenerate codes, or just reference about the current state of the art of those issues.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2018-05-29T22:52:09.813" LastActivityDate="2018-05-29T22:52:09.813" Title="Degeneracy of Quantum Error Correction Codes" Tags="&lt;error-correction&gt;&lt;quantum-information&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2050" PostTypeId="2" ParentId="2049" CreationDate="2018-05-14T13:10:19.080" Score="3" Body="&lt;p&gt;I don't have a complete answer, but perhaps others can improve on this starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are probably 3 things to ask about the code:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How degenerate is it?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How hard is it to perform the classical post-processing of the error syndrome in order to determine which corrections to make?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What are its error correcting/fault-tolerant thresholds?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I suppose a simple enough measure of degeneracy is the extent to which the Quantum Hamming Bound is surpassed. For an $[[N,k,d]]$ code, a non-degenerate code must satisfy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$2^{N-k}\geq\sum_{n=0}^{\lfloor d/2\rfloor}3^n\binom{N}{n}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the amount by which that bound is violated suggests something interesting about how densely the information is packed. Of course, that's no use if your mega-degenerate code cannot actually correct for any errors. Similarly, if your code is in principle awesome, but it takes too long to actually work out what the correction is, your code isn't really any use in practice because errors will continue to accumulate as you try to work out what corrections to do.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-05-14T16:13:23.890" LastActivityDate="2018-05-14T16:13:23.890" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2051" PostTypeId="1" AcceptedAnswerId="2052" CreationDate="2018-05-14T13:19:53.713" Score="7" ViewCount="135" Body="&lt;p&gt;I submitted a job in the 0.5.0 version of QISKit using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(qc, 'ibmqx5', shots=shots)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just submits the job, and does not wait for a result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then immediately tested whether the job was still running using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(job.running)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gave the result &lt;code&gt;False&lt;/code&gt;. However, when I requested the result using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job.result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This still took a while to get the result, suggesting that the job actually was still running after all. What is going on here?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-14T13:25:37.837" Title="Why does job.running in QISKit output False, even if the job is still running?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2052" PostTypeId="2" ParentId="2051" CreationDate="2018-05-14T13:19:53.713" Score="4" Body="&lt;p&gt;There are three stages that the job goes through, as you'll see if you also print the status using &lt;code&gt;print(job.status)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is an initialization stage. This returns &lt;code&gt;False&lt;/code&gt; for &lt;code&gt;job.running&lt;/code&gt;, because it hasn't started running yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then your job actually will run, and so give &lt;code&gt;True&lt;/code&gt; for &lt;code&gt;job.running&lt;/code&gt;. Finally it will have finished running, and so &lt;code&gt;job.running&lt;/code&gt; goes back to &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So don't use &lt;code&gt;job.running&lt;/code&gt; to test whether a result is ready.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-05-14T13:25:37.837" LastActivityDate="2018-05-14T13:25:37.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2053" PostTypeId="2" ParentId="2036" CreationDate="2018-05-14T15:24:10.033" Score="0" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;Plain and simple answer:&lt;/em&gt;&lt;/strong&gt; In the absence of decoherence, state vectors evolve according to $|\psi(t)\rangle = e^{-iHt}|\psi(0)\rangle$ for a Hamiltonian $H$. This is what a &quot;gate&quot; is doing. Hamiltonians have to be Hermitian, so this transformation is unitary. Hamiltonians do not have to have eigenvalues that sum to 0, so the transformation does not have to be special unitary. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-14T15:24:10.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2054" PostTypeId="1" CreationDate="2018-05-14T18:37:53.887" Score="16" ViewCount="433" Body="&lt;p&gt;In a comment on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2034/26&quot;&gt;my answer&lt;/a&gt; to the question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2030/what-exactly-are-anyons-and-how-are-they-relevant-to-topological-quantum-computi&quot;&gt;What exactly are anyons and how are they relevant to topological quantum computing?&lt;/a&gt; I was asked to give specific examples of occurrence of anyons in nature. I've spent 3 days searching, but every article refers to either &amp;quot;proposed experiments&amp;quot; or &amp;quot;nearly definitive evidence&amp;quot;.&lt;/p&gt;&#xA;&lt;h2&gt;&lt;strong&gt;Abelian anyons&lt;/strong&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;Fractional charges have been measured directly since 1995, but in my search, all articles pointing to evidence of &lt;em&gt;&lt;strong&gt;fractional statistics&lt;/strong&gt;&lt;/em&gt; or an exchange factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}\ne\pm1$&lt;/span&gt;, point to this nearly 7-year old &lt;a href=&quot;https://arxiv.org/abs/1112.3400&quot; rel=&quot;nofollow noreferrer&quot;&gt;pre-print&lt;/a&gt;, where they say in the abstract that they &amp;quot;confirm&amp;quot; detecting the theoretically predicted phase of &lt;span class=&quot;math-container&quot;&gt;$\theta =2\pi/3$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\nu=7/3$&lt;/span&gt; state of a quantum Hall system. However, the paper seems to have never passed a journal's peer review. There is no link to a journal DOI on arXiv. On Google Scholar I clicked &amp;quot;see all 5 versions&amp;quot;, but all 5 were arXiv versions. I then suspected the article's name might have changed at the time of publication so went hunting for it on the authors' websites. The last author has Princeton University's Department of Electrical Engineering listed as affiliation, but does not show up on that department's list of people (after clicking on &amp;quot;People&amp;quot;, I clicked on &amp;quot;Faculty&amp;quot;, &amp;quot;Technical&amp;quot;, &amp;quot;Graduate Students&amp;quot;, &amp;quot;Administrative&amp;quot;, and &amp;quot;Research Staff&amp;quot; but nothing showed up). The same happened for the second-last author! The third-last author does have a lab website with a publication list, but nothing like this paper appears in the &amp;quot;Selected Publications out of more than 800&amp;quot; page.  The fourth-last author is at a different university, but his website's publication list is given as a link to his arXiv page (still no published version visible). The 5th last, 6th last, and 7th last authors have an affiliation of James Franck Institute and Department of Physics at the University of Chicago, but none of their three names shows up on either website's People pages. One of the authors also has affiliation at a university in Taiwan, and her website there lists publications co-authored with some of the people from the pre-print in question, but never anything with a similar title or with a similar enough author list. Interestingly, even her automatically generated but manually adjustable Google Scholar page does not have even the arXiv version but does have earlier papers (with completely different titles and no mention of anyons) with some of the co-authors. That covers all authors. No correspondence emails were made available.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Is this &lt;a href=&quot;https://arxiv.org/abs/1112.3400&quot; rel=&quot;nofollow noreferrer&quot;&gt;pre-print&lt;/a&gt; the only claim of confirming an exchange factor &lt;span class=&quot;math-container&quot;&gt;$\ne\pm1$&lt;/span&gt; ?&lt;br&gt;&#xA;&lt;strong&gt;2.&lt;/strong&gt; If yes, what is wrong with their claimed confirmation of this? (It appears to have not passed any journal's peer review, and it also appears that an author has even taken down the arXiv version from her Google Scholar page).&lt;/p&gt;&#xA;&lt;h2&gt;&lt;strong&gt;Non-abelian anyons&lt;/strong&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;I found &lt;a href=&quot;https://en.wikipedia.org/wiki/Anyon#Non-abelian_anyons&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; this quote: &amp;quot;Experimental evidence of non-abelian anyons, although not yet conclusive and currently contested &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.115.126807&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;sup&gt;[12]&lt;/sup&gt;&lt;/a&gt; was presented in October 2013 &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.111.186401&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;sup&gt;[13]&lt;/sup&gt;&lt;/a&gt;.&amp;quot; The abstract of [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.115.126807&quot; rel=&quot;nofollow noreferrer&quot;&gt;12&lt;/a&gt;] says that the experiment in [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.111.186401&quot; rel=&quot;nofollow noreferrer&quot;&gt;13&lt;/a&gt;] is inconsistent with a plausible model and that the authors of [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.111.186401&quot; rel=&quot;nofollow noreferrer&quot;&gt;13&lt;/a&gt;] may have measured &amp;quot;Coulomb effects&amp;quot; rather than non-Abelian braiding. Interestingly the author list of [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.111.186401&quot; rel=&quot;nofollow noreferrer&quot;&gt;13&lt;/a&gt;] overlaps with the pre-print mentioned in the Abelian section of this question, though that pre-print was from 2 years earlier and said in the abstract &amp;quot;Our results provide compelling support for the existence of non-Abelian anyons&amp;quot; which is a much weaker statement than what they say in the same abstract for the Abelian case: &amp;quot;We confirm the Abelian anyonic braiding statistics in the &lt;span class=&quot;math-container&quot;&gt;$\nu=7/3$&lt;/span&gt; FQH state through detection of the predicted statistical phase angle of &lt;span class=&quot;math-container&quot;&gt;$2\pi/3$&lt;/span&gt;, consistent with a change of the anyonic particle number by one.&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-07-20T22:27:28.907" LastActivityDate="2020-07-20T22:27:28.907" Title="What is the status of confirming the existence of anyons?" Tags="&lt;experiment&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2055" PostTypeId="2" ParentId="2054" CreationDate="2018-05-14T20:50:34.587" Score="6" Body="&lt;p&gt;It depends what you mean by the 'existence' of anyons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way is to engineer a Hamiltonian which leads to quasiparticles (or other defects) that have anyonic statistics. This will require the Hamiltonian to be implemented, the system to be cooled to sufficiently near the ground state, the anyons to be manipulated, etc. So there's a lot to be done, and I don’t think that the development of the systems required has a lot of other applications. So it suffers from being both hard to do, and quite a niche.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, someone else will give you the answers you want on this kind of approach. However, I thought it is important to note that there is another way to get anyons. This is to not bother with the Hamiltonian. Instead, the eigenstates can be prepared and manipulated directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, you aren’t getting any topological protection from the Hamiltonian. Instead, measurements are constantly made of what eigenstate you are in, in order to detect and help you mitigate the unwanted effects of errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most realistic examples of this approach will be ones for which these operations can be easily performed on a quantum computer. All the development and progress towards building qubits and their gates can then be directly used in the search for anyons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyons are systems that can be easily implemented with qubits or qubits are typically a specific form of quantum error correcting code. Specifically, they are stabilizer codes for which the states of the stabilizer space are topologically ordered, and syndrome measurements correspond to measuring whether anyons are present at each point throughout the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Th simplest example is the surface code. The basic quasiparticles of this are Abelian anyon. There have been experiments that create and manipulate these anyons to demonstrate their braiding behaviour. &lt;a href=&quot;https://arxiv.org/abs/0710.0895&quot; rel=&quot;noreferrer&quot;&gt;The first example&lt;/a&gt; was done over a decade ago in photonics systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The surface code can also host defects which behave as Majorana modes, and therefore non-Abelian anyons. I implemented a very minimal example of their braiding in &lt;a href=&quot;https://arxiv.org/abs/1609.07774&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As quantum processors get larger, cleaner and more sophisticated, there will be a lot more of this kind of study. I would think that the majority of the anyons that we will see and use will be realized in this manner, rather than with an implementation of the Hamiltonian.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-05-15T06:02:14.450" LastActivityDate="2018-05-15T06:02:14.450" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2056" PostTypeId="1" AcceptedAnswerId="11472" CreationDate="2018-05-15T02:06:58.443" Score="11" ViewCount="260" Body="&lt;p&gt;The recent McClean et al. paper &lt;a href=&quot;https://arxiv.org/pdf/1803.11173.pdf&quot; rel=&quot;noreferrer&quot;&gt;Barren plateaus in quantum neural network training landscapes&lt;/a&gt; shows that for a wide class of reasonable parameterized quantum circuits, the probability that the gradient along any reasonable direction is non-zero to some fixed precision is exponentially small as a function of the number of qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to affect &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1885/what-is-meant-by-noisy-intermediate-scale-quantum-nisq-technology&quot;&gt;Noisy Intermediate-Scale Quantum (NISQ)&lt;/a&gt; programs (as proposed by e.g. &lt;a href=&quot;https://arxiv.org/pdf/1801.00862.pdf&quot; rel=&quot;noreferrer&quot;&gt;John Preskill&lt;/a&gt;) since they involve hybrid quantum-classical algorithms, ie training a parameterized quantum circuit with a classical optimization loop.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zRKZR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zRKZR.png&quot; alt=&quot;Fig 1 from the paper&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;: How do you avoid getting stranded on those barren plateaus? Concretely, how would one go about building one's Ansatz Haar states to avoid getting stuck in those plateaus? The paper proposes but does not elaborate:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;One approach to avoid these landscapes in the quantum setting is to&#xA;  use structured initial guesses, such as those adopted in quantum&#xA;  simulation&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2387" LastEditorUserId="26" LastEditDate="2019-01-01T10:15:29.130" LastActivityDate="2020-04-09T10:36:31.093" Title="Devising &quot;structured initial guesses&quot; for random parametrized quantum circuits to avoid getting stuck in a flat plateau" Tags="&lt;optimization&gt;&lt;neural-network&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2057" PostTypeId="1" CreationDate="2018-05-15T04:25:47.303" Score="7" ViewCount="183" Body="&lt;p&gt;I am currently trying to implement a boosting algorithm akin to &lt;a href=&quot;https://en.wikipedia.org/wiki/Xgboost&quot; rel=&quot;noreferrer&quot;&gt;XGBoost&lt;/a&gt; with a quantum device. The reason is that I want to make use of a quantum device to train weak classifiers. However, as far as I know, the current quantum device can only be used for binary variables including both input variables and outputs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use all binary variables to implement the additive training as it does in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Xgboost&quot; rel=&quot;noreferrer&quot;&gt;XGBoost&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt; &lt;a href=&quot;https://github.com/dmlc/xgboost&quot; rel=&quot;noreferrer&quot;&gt;XGBoost GitHub Project&lt;/a&gt; &lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="2354" LastEditorUserId="26" LastEditDate="2018-05-15T06:26:23.907" LastActivityDate="2021-03-03T21:04:30.453" Title="Gradient boosting akin to XGBoost using a quantum device" Tags="&lt;algorithm&gt;&lt;annealing&gt;&lt;programming&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2058" PostTypeId="1" CreationDate="2018-05-15T07:33:05.183" Score="13" ViewCount="585" Body="&lt;p&gt;In the comments to a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2047/two-notions-of-general-quantum-operators&quot;&gt;question&lt;/a&gt; I asked recently, there is a discussion between &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/2293/user1271772&quot;&gt;user1271772&lt;/a&gt; and myself on positive operators. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that for a positive trace-preserving operator $\Lambda$ (e.g. the partial transpose) if acting on a mixed state $\rho$ then although $\Lambda(\rho)$ is a valid density matrix it mucks up the density matrix of the system it is entangled to - hence this is not a valid operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This and user1271772's comments, however, got me thinking. $\Lambda$ acting on a state which is not part of a larger system does indeed give a valid density matrix and there is no associated entangled system to muck it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, therefore: Is such an operation allowed (i.e. the action of a positive map on a state which is not part of a larger system). If not, why not? And if so, is it true that any positive map can be extended to a completely positive map (perhaps nontrivially)?&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="10480" LastEditDate="2021-03-26T04:43:17.473" LastActivityDate="2021-03-26T04:43:17.473" Title="Is acting with a positive map on a state not part of a larger system allowed?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;partial-transpose&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2059" PostTypeId="1" CreationDate="2018-05-15T08:13:51.020" Score="10" ViewCount="412" Body="&lt;p&gt;Long-range entanglement is characterized by topological order (some kinds of global entanglement properties), and the &quot;modern&quot; definition of topological order is &lt;em&gt;the ground state of the system cannot be prepared by a constant-depth circuit from a product state&lt;/em&gt;, instead of ground states dependency and boundary excitations in traditional. Essentially, a quantum state which can be prepared by a constant-depth circuit is called &lt;em&gt;trivial state&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, quantum states with long-range entanglement are &quot;robust&quot;. One of the most famous corollaries of quantum PCP conjecture which proposed by Matt Hastings is the &lt;em&gt;No Low-energy Trivial States&lt;/em&gt; conjecture, and the weaker case proved by Eldar and Harrow two years ago (i.e. NLETS theorem: &lt;a href=&quot;https://arxiv.org/abs/1510.02082&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1510.02082&lt;/a&gt;). Intuitively, the probability of a series of the random errors are exactly some log-depth quantum circuit are very small, so it makes sense that the entanglement here is &quot;robust&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that this phenomenon is some kinds of similar to topological quantum computation. Topological quantum computation is robust for any local error since the quantum gate here is implemented by braiding operators which is connected to some global topological properties. However, it needs to point that &lt;strong&gt;&quot;robust entanglement&quot; in the NLTS conjecture setting only involved the amount of entanglement, so the quantum state itself maybe changed&lt;/strong&gt; -- it does not deduce a quantum error-correction code from non-trivial states automatically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Definitely, long-range entanglement is related to homological quantum error-correction codes, such as the Toric code (it seems that it is related to abelian anyons). However, my question is that are there some connections between long-range entanglement (or &quot;robust entanglement&quot; in the NLTS conjecture setting) and topological quantum computation? &#xA;Perhaps there exists some conditions regarding when the correspondent Hamiltonian can deduce a quantum error-correction code. &lt;/p&gt;&#xA;" OwnerUserId="1777" LastEditorUserId="1777" LastEditDate="2018-05-22T21:36:55.580" LastActivityDate="2018-05-22T21:36:55.580" Title="Are there connections between long-range entanglement and topological quantum computation?" Tags="&lt;entanglement&gt;&lt;topological-quantum-computing&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2060" PostTypeId="1" CreationDate="2018-05-15T08:16:16.503" Score="10" ViewCount="276" Body="&lt;p&gt;The quantum Hamming bound for a non-degenerate $[[N,k,d]]$ quantum error correction code is defined as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;2^{N-k}\geq\sum_{n=0}^{\lfloor d/2\rfloor}3^n\begin{pmatrix}N \\ n\end{pmatrix}.&#xA;\end{equation}&#xA;However, there is no proof stating that degenerate codes should obey such bound. I wonder if there exists any example of a degenerate code violating the quantum Hamming bound, or if there have been some advances in proving similar bounds for degenerate codes.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-02-22T15:59:55.533" LastActivityDate="2021-02-22T15:59:55.533" Title="Violation of the Quantum Hamming bound" Tags="&lt;error-correction&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2061" PostTypeId="2" ParentId="2059" CreationDate="2018-05-15T09:29:13.220" Score="7" Body="&lt;p&gt;There were two simultaneous PRLs published by &lt;a href=&quot;https://arxiv.org/abs/hep-th/0510092&quot; rel=&quot;noreferrer&quot;&gt;Kitaev &amp;amp; Preskill&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/cond-mat/0510613&quot; rel=&quot;noreferrer&quot;&gt;Levin &amp;amp; Wen&lt;/a&gt; that I think answer your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These use the &lt;a href=&quot;https://arxiv.org/abs/0808.3773&quot; rel=&quot;noreferrer&quot;&gt;area law&lt;/a&gt; of entanglement seen by states that can be expressed as ground states of a Hamiltonian with only local interactions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, suppose you have a 2D system of interacting particles in a pure state. You then single out some region, and calculate the von Neumann entropy of the reduced density matrix for that region. This will essentially be a measure of how entangled the region is with its complement. The area law tells us that this entropy, $S$, should obey&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$S = \alpha L - \gamma + \ldots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $L$ is the length of the perimeter of the region. The first term accounts for the fact that correlations in these systems are typically short range, and so the entanglement is mostly composed of correlations between particles on each side of the boundary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\gamma$ term is unaffected by the size or shape of the region, and so represents a contribution of global and topological effects. Whether this is non-zero, and what the value is, tells you about the topologically ordered nature of your entangled system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The $\ldots$ term just represents contributions that decay as the region increases, and so can be ignored as $L\rightarrow \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two papers, and ones based upon them, then find ways to isolate and calculate $\gamma$ for different entangled states. The value is shown to depend on the anyon model for which these entangled states represent the vacuum.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-15T09:29:13.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2062" PostTypeId="1" AcceptedAnswerId="2063" CreationDate="2018-05-15T10:12:46.183" Score="5" ViewCount="999" Body="&lt;p&gt;To use certain things in QISKIt, such as acessing the real quantum processors, it seems that there is a file 'Qconfig.py'. That needs to be set up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do this?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-02-15T14:58:49.043" Title="What is Qconfig in QISKit and how do I set it up?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2063" PostTypeId="2" ParentId="2062" CreationDate="2018-05-15T10:12:46.183" Score="5" Body="&lt;p&gt;To get access to the real devices and remote simulators, you need to have an account with the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/&quot; rel=&quot;noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt;. Once you do, you can get your API key from the account page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the API key, you can set up a Qconfig file. Let's assume that you want to run things from the &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial&quot; rel=&quot;noreferrer&quot;&gt;QISKit tutorial&lt;/a&gt;. The Qconfig file can then be set up by editing the file located &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial/blob/master/Qconfig.py.template&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You just need to replace the line&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;APItoken = None&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;APItoken = &quot;randomstringoflettersandnumbersyoucopiedfromthewebsite&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the stuff within the quotation marks should be your actual API token.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also need to rename the file from 'Qconfig.py.template' to just &lt;code&gt;Qconfig.py&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you need to import the information from this file in your programs. This will depend on where you program sits in your computer relative to the Qconfig file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the &lt;code&gt;.py&lt;/code&gt; or &lt;code&gt;.ipynb&lt;/code&gt; file containing your program is sitting in the same directory as 'Qconfig.py', you can import with just&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import Qconfig&#xA;qx_config = {&#xA;    &quot;APItoken&quot;: Qconfig.APItoken,&#xA;    &quot;url&quot;: Qconfig.config['url']}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;except Exception as e:&#xA;    print(e)&#xA;    qx_config = {&#xA;        &quot;APItoken&quot;:&quot;YOUR_TOKEN_HERE&quot;,&#xA;        &quot;url&quot;:&quot;&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/api&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/api&lt;/a&gt;&quot;}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then register your connection to the API with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;register(qx_config['APItoken'], qx_config['url'])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your &lt;code&gt;.py&lt;/code&gt; or &lt;code&gt;.ipynb&lt;/code&gt; is one directory level down, such as for &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial/tree/master/hello_world&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; you'll need to have the lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sys&#xA;sys.path.append(&quot;../&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;before you try to import. This tells the program to look for the Qconfig file in the directory above instead.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-15T10:12:46.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2064" PostTypeId="2" ParentId="2058" CreationDate="2018-05-15T10:49:44.393" Score="7" Body="&lt;p&gt;Any map which is not Completely Positive, Trace Preserving (CPTP), is not possible as an &quot;allowed operation&quot; (a more-or-less complete account of how some system transforms) in quantum mechanics, regardless of what states it is meant to act upon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constraint of maps being CPTP comes from the physics itself. Physical transformations on closed systems are unitary, as a result of the Schr&amp;ouml;dinger equation. If we allow for the possibility to introduce auxiliary systems, or to ignore/lose auxiliary systems, we obtain a more general CPTP map,  expressed in terms of a Stinespring dilation. Beyond this, we must consider maps which may occur only with a significant probability of failure (as with postselection). This is perhaps one way of describing an &quot;extension&quot; for non-CPTP maps to CPTP maps &amp;mdash; engineering it so that it can be described as a provocative thing with some probability, and something uninteresting with possibly greater probability; or at least a mixture of a non-CPTP map with something else to yield a total evolution which is CPTP &amp;mdash; but whether it is useful to do so in general is not clear to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a higher level &amp;mdash; while &lt;em&gt;we&lt;/em&gt; may consider entanglement a strange phenomenon, and in some way special to quantum mechanics, the laws of quantum mechanics themselves make no distinctions between entangled states and product states. There is no sense in which quantum mechanics is delicate or sensitive to the mere presence of nonlocal correlations (which are correlations in things which &lt;em&gt;we&lt;/em&gt; are concerned with), which would render impossible some transformation on entangled states merely because it might produce an embarrassing result. Either a process is impossible &amp;mdash; and in particular not possible on product states &amp;mdash; or it is possible, and any embarrassment about the outcome for entangled states is our own, on account of the difficulty in understanding what has happened. What is special about entanglement is the way it challenges our classically-motivated preconceptions, not how entangled states themselves evolve in time. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-05-17T09:20:46.440" LastActivityDate="2018-05-17T09:20:46.440" CommentCount="26" ContentLicense="CC BY-SA 4.0" />
  <row Id="2065" PostTypeId="2" ParentId="2060" CreationDate="2018-05-15T15:14:51.043" Score="5" Body="&lt;p&gt;You may be interested in the answers to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1961/1837&quot;&gt;this question&lt;/a&gt;. One example of a degenerate code beating the quantum Hamming bound is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706061&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I also have a numerical example of a small violation in my own work, &lt;a href=&quot;https://arxiv.org/abs/1208.4924&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. In Figure two, you will see a zoomed in section. Essentially, the black line is the quantum Hamming bound (that may not be entirely obvious from what is written!), and the grey line is an approximation of what can be achieved with something related to the Toric code. There will be other examples as well!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There appear to be a number of results about classes of degenerate codes that do not violate the quantum Hamming bound (e.g. &lt;a href=&quot;https://arxiv.org/abs/0812.2674&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/0711.4603&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). I haven't read them, so don't know how useful they are, but the abstracts suggest that they provide a nice counter-point, conveying the rarity of good degenerate codes.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-15T16:30:37.967" LastActivityDate="2018-05-15T16:30:37.967" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2066" PostTypeId="2" ParentId="2058" CreationDate="2018-05-15T19:01:26.523" Score="-3" Body="&lt;p&gt;&lt;strong&gt;No law of physics states that we must be able to evolve a sub-system of the universe on its own.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There would be no way to definitively test such a law. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The density matrix of the universe must have a trace of 1 and be positive semi-definite, by the mathematical definition of probabilities&lt;sup&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/pdf/0811.2068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/strong&gt;&lt;/sup&gt;. Any change in the universe must&lt;sup&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/pdf/0811.2068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/strong&gt;&lt;/sup&gt; preserve this, for mathematical reasons and due to definitions. If $\rm{Tr}(\rho_{\rm{universe}})\lt1$, you just haven't included the whole universe in $\rho_{\rm{universe}}$. If it's more than 1, or if $\rho_{\rm{universe}}&amp;lt;0$, what you have is not actually a density matrix, by the definition of probability&lt;sup&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/pdf/0811.2068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/strong&gt;&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the map: $\rho_{\rm{universe}}(0)\rightarrow\rho_{\rm{universe}}(t)$ must&lt;sup&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/pdf/0811.2068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/strong&gt;&lt;/sup&gt; be positive and trace-preserving. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convenience, we like to &lt;strong&gt;&lt;em&gt;model&lt;/em&gt;&lt;/strong&gt; sub-regions of the universe, and introduce complete positivity for that. But one day an experiment might come along that we find impossible to explain&lt;sup&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/sup&gt;, perhaps because we have chosen to model the universe in a way that's not compatible with how the universe actually works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume gravity doesn't exist, and we can magically compute anything we want, we believe that evolving $\rho_{\rm{universe}}$ using the right &lt;strong&gt;positive&lt;/strong&gt; trace-preserving map, then doing a partial trace over all parts of the universe not of concern, will give accurate predictions. &#xA;Introducing the notion of modeling &lt;strong&gt;only&lt;/strong&gt; a sub-system of  $\rho_{\rm{universe}}$, using a CPT map, is also something we believe will work, but we might bet &lt;strong&gt;&lt;em&gt;slightly&lt;/em&gt;&lt;/strong&gt; less on this, because we've added the &lt;em&gt;assumption&lt;/em&gt; that &lt;strong&gt;&lt;em&gt;sub-systems&lt;/em&gt;&lt;/strong&gt; evolve this way, not just the universe as a whole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt;&#xA;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/pdf/0811.2068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&lt;/strong&gt;: Even this is debatable because the relationship between a wavefunction or density matrix and probabilities comes from a postulate of quantum mechanics called the Born rule, which until fewer than 10 years ago was never tested at all, and still has only been confirmed to be true within an $\epsilon$, and for a particular system: If Born's rule isn't true, Eq. 6 of &lt;a href=&quot;https://arxiv.org/pdf/0811.2068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; would not be zero. To test if Born's rule is true for a &lt;em&gt;particular&lt;/em&gt; system (in this case, photons coming from some particular source), you would have to do an infinite number of instances, of all 7 of these experiments, or come up with a different way to test Born's rule (and I don't know of any). In 2009 we published this saying that Born's rule was true (for this system) to within an $\epsilon$ that was smaller than the experimental uncertainty, so we only know Born's rule is true for this system, and to within a precision limited by the experiment.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2&lt;/strong&gt;: This is actually already the case, but let's pretend that gravity does not exist and that quantum mechanics (QED+QFD+QCD) is correct, and we still find it impossible to explain something, despite having (somehow) magical computer power to compute anything we want instantly.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-15T23:57:22.280" LastActivityDate="2018-05-15T23:57:22.280" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2068" PostTypeId="1" AcceptedAnswerId="2069" CreationDate="2018-05-16T01:45:04.353" Score="8" ViewCount="267" Body="&lt;p&gt;I am aware that of the difference of Adiabatic Quantum Computing (AQC) and Quantum Annealing (QA) as explained &lt;a href=&quot;https://cstheory.stackexchange.com/questions/17703/quantum-annealing-vs-adiabatic-quantum-computation&quot;&gt;here&lt;/a&gt;. However, another term which came up in some papers was &lt;strong&gt;Adiabatic Quantum Optimization (AQO)&lt;/strong&gt;. Where does AQO fit in among AQC and QA?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that it is another name for QA and is restricted to solving the Ising model, just like D-Wave's QA? I would think AQO is more general than QA where QA is a form of AQO where its Hamiltonian can be any algebraic function of spin variables without restrictions on the interaction, unlike the Ising model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone mind clarifying this? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2398" LastEditorUserId="26" LastEditDate="2018-12-13T19:50:30.920" LastActivityDate="2018-12-13T19:50:30.920" Title="Adiabatic Quantum Computing vs Adiabatic Quantum Optimization vs Quantum Annealing" Tags="&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2069" PostTypeId="2" ParentId="2068" CreationDate="2018-05-16T04:29:35.527" Score="5" Body="&lt;p&gt;I'm very happy my answer from 3 years ago to that question is still helping people!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to your new question is found here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vtdgj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vtdgj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that there is &lt;strong&gt;&lt;em&gt;another&lt;/em&gt;&lt;/strong&gt; term here which is &quot;Quantum Adiabatic Algorithm&quot; or QAA. In fact those QAA papers from 2000 and 2001 papers call it &quot;Quantum Adiabatic Evolution Algorithm&quot; or QAEA, and &quot;Quantum Computation by Adiabatic Evolution&quot; or QCAE.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I think we should agree on just using the terms AQC and Quantum Annealing to describe the two things in my answer to the question you provided the link to. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-17T01:03:33.473" LastActivityDate="2018-05-17T01:03:33.473" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2070" PostTypeId="1" CreationDate="2018-05-16T17:42:16.183" Score="4" ViewCount="618" Body="&lt;p&gt;A lot of the tutorials on BB84 protocol talks about these two measurement bases, 'Rectilinear' or 'Vertical-Horizontal' and 'Diagonal'. I understand that it is possible to create a physical device that would be able to measure a qubit in both vertical and horizontal direction, or in other words, in 'Rectilinear' basis, but what would be the matrix representation of it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we can use $\lvert 0 \rangle \langle 0 \lvert$ to measure a qubit in the $\lvert 0 \rangle$ basis and $\lvert 1 \rangle \langle 1 \lvert$ to measure in the $\lvert 1 \rangle$ basis. &#xA;But what would be the combined measurement basis which we could call 'rectilinear' or 'vertical-horizontal'?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2018-12-23T12:28:30.910" LastActivityDate="2018-12-23T12:28:30.910" Title="'Rectilinear' and 'Diagonal' Basis in BB84 Protocol" Tags="&lt;measurement&gt;&lt;cryptography&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2071" PostTypeId="2" ParentId="2070" CreationDate="2018-05-16T20:38:02.503" Score="3" Body="&lt;p&gt;For the diagonal basis, the measurement operators are the $|0\rangle\langle 0|$ and $|1\rangle\langle 1|$, as stated in the question. For the other basis, any mutually unbiased basis will do, but people usually go for the two operators $(|0\rangle+|1\rangle)(\langle 0|+\langle 1|)/2$ and $(|0\rangle-|1\rangle)(\langle 0|-\langle 1|)/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The labels of which basis you call what are fairly arbitrary, but I think that the rectilinear basis is usually the one that corresponds with horizontal/vertical polarisation and is labelled 0/1. The diagonal basis is then the other one.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-16T20:57:29.150" LastActivityDate="2018-05-16T20:57:29.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2072" PostTypeId="2" ParentId="2070" CreationDate="2018-05-16T21:34:50.070" Score="6" Body="&lt;p&gt;Talking about bases such as $\left|0\rangle\langle0\right|$ and $\left|1\rangle\langle1\right|$ (or the equivalent vector notation $\left|0\right&amp;gt;$ and $\left|1\right&amp;gt;$, which I'll use in this answer) at the same time as 'horizontal' and 'vertical' are, to a fair extent (pardon the pun) orthogonal concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;, there are 3 different orthonormal bases - we generally consider $\left|0\right\rangle$ and $\left|1\right\rangle$; $\frac{1}{\sqrt 2}\left(\left|0\right\rangle+\left|1\right\rangle\right)$ and $\frac{1}{\sqrt 2}\left(\left|0\right\rangle-\left|1\right\rangle\right)$; $\frac{1}{\sqrt 2}\left(\left|0\right\rangle+i\left|1\right\rangle\right)$ and $\frac{1}{\sqrt 2}\left(\left|0\right\rangle-i\left|1\right\rangle\right)$. I'll refer to these as the 'quantum information bases' as this is the notation generally used in quantum information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That looks a bit of a mess, so we can also write this as $\left|\uparrow_z\right\rangle$, $\left|\downarrow_z\right\rangle$; $\left|\uparrow_x\right\rangle$, $\left|\downarrow_x\right\rangle$; $\left|\uparrow_y\right\rangle$, $\left|\downarrow_y\right\rangle$, where the different bases are now labelled as $x, y$ and $z$. In terms of spin-half particles, this has a natural definition of up/down spin in each of those directions. However, there is freedom in choosing which direction (in the lab) these axes are in (unless otherwise constrained).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Photons (used in the BB84 protocol) aren't spin-half particles (they have a spin of one), but nevertheless have similarities to this - the 'axes' are the possible directions of the polarisation of a photon, only instead of labelling these as $x, y$ and $z$, they're labelled as horizontal/vertical, diagonal/antidiagonal and left-/right-circular, or in vector notation, this is shortened to $\left|H\right&amp;gt;$, $\left|V\right&amp;gt;$; $\left|D\right&amp;gt;$, $\left|A\right&amp;gt;$; $\left|L\right&amp;gt;$ and $\left|R\right&amp;gt;$. These can then be mapped on to the 'quantum information' bases above, although which basis gets labelled as $\left|0\right&amp;gt;$ and $\left|1\right&amp;gt;$ is somewhat arbitrary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the BB84 protocol (and indeed, frequently used in other applications), the rectilinear (vertical/horizontal) basis is the one labelled using $\left|0\right&amp;gt;$ and $\left|1\right&amp;gt;$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is: $$\left|H\right&amp;gt;=\left|0\right&amp;gt;$$ &#xA;$$\left|V\right&amp;gt;=\left|1\right&amp;gt;$$&#xA;$$\left|D\right&amp;gt;=\frac{1}{\sqrt 2}\left(\left|H\right\rangle+\left|V\right\rangle\right)=\frac{1}{\sqrt 2}\left(\left|0\right\rangle+\left|1\right\rangle\right)$$&#xA;$$\left|A\right&amp;gt;=\frac{1}{\sqrt 2}\left(\left|H\right\rangle-\left|V\right\rangle\right)=\frac{1}{\sqrt 2}\left(\left|0\right\rangle-\left|1\right\rangle\right)$$&#xA;$$\left|R\right&amp;gt;=\frac{1}{\sqrt 2}\left(\left|H\right\rangle+i\left|V\right\rangle\right)=\frac{1}{\sqrt 2}\left(\left|0\right\rangle+i\left|1\right\rangle\right)$$&#xA;$$\left|L\right&amp;gt;=\frac{1}{\sqrt 2}\left(\left|H\right\rangle-i\left|V\right\rangle\right)=\frac{1}{\sqrt 2}\left(\left|0\right\rangle-i\left|1\right\rangle\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to measure in any of these bases, use the 'projectors' of that basis. That is, &lt;strong&gt;if you want to measure in the rectilinear basis&lt;/strong&gt;, the projectors are $\left|H\rangle\langle H\right|$ and $\left|V\rangle\langle V\right|$. Similarly, in the diagonal basis, $\left|D\rangle\langle D\right|$ and $\left|A\rangle\langle A\right|$; and in the circularly polarised basis, $\left|L\rangle\langle L\right|$ and $\left|R\rangle\langle R\right|$&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-05-16T21:34:50.070" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2073" PostTypeId="1" CreationDate="2018-05-17T00:23:41.620" Score="5" ViewCount="261" Body="&lt;p&gt;If we only assume that the wavefunction of the universe evolves according to $e^{-iHt}$, is there any proof that all subsystems of the universe (partial traces over parts of the universe) must evolve according to a completely positive, trace-preserving (CPTP) map?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a perfectly valid quantum map that is &lt;em&gt;not&lt;/em&gt; completely positive is given in the paragraph containing &lt;strong&gt;Eq. 6&lt;/strong&gt; of the paper: &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0375960105005748#!&quot; rel=&quot;nofollow noreferrer&quot;&gt;Who's afraid of not completely positive maps?&lt;/a&gt;. This was possible because they made the system and its environment entangled at the time $t=0$. So my question is whether such a proof exists for the case where there is no initial entanglement. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-12-31T23:33:28.057" LastActivityDate="2018-12-31T23:33:28.057" Title="Only assuming the universe evolves according to a positive trace-preserving map, is there a proof that all subsystem evolution must be CPTP?" Tags="&lt;density-matrix&gt;&lt;decoherence&gt;&lt;dynamics&gt;&lt;open-quantum-systems&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2074" PostTypeId="1" CreationDate="2018-05-17T03:52:58.673" Score="16" ViewCount="688" Body="&lt;p&gt;Many papers assert that Hamiltonian simulation is BQP-complete&#xA;(e.g., &#xA;&lt;a href=&quot;https://arxiv.org/abs/1501.01715&quot; rel=&quot;noreferrer&quot;&gt;Hamiltonian simulation with nearly optimal dependence on all parameters&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1610.06546&quot; rel=&quot;noreferrer&quot;&gt;Hamiltonian Simulation by Qubitization&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to see that Hamiltonian simulation is BQP-hard because any quantum algorithm can be reduced to Hamiltonian simulation, but how is Hamiltonian simulation in BQP? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e., what precisely is the Hamiltonian simulation &lt;em&gt;decision problem&lt;/em&gt; in BQP and under what conditions on the Hamiltonian? &lt;/p&gt;&#xA;" OwnerUserId="1885" LastEditorUserId="55" LastEditDate="2020-09-04T11:48:19.237" LastActivityDate="2020-09-04T11:48:19.237" Title="What are examples of Hamiltonian simulation problems that are BQP-complete?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;simulation&gt;&lt;bqp&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2075" PostTypeId="5" CreationDate="2018-05-17T05:34:20.280" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-17T05:34:20.280" LastActivityDate="2018-05-17T05:34:20.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2076" PostTypeId="4" CreationDate="2018-05-17T05:34:20.280" Score="0" Body="For questions about the effect of a quantum system's environment on the system of interest." OwnerUserId="26" LastEditorUserId="2293" LastEditDate="2018-07-06T01:08:01.780" LastActivityDate="2018-07-06T01:08:01.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2077" PostTypeId="5" CreationDate="2018-05-17T05:35:11.047" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-17T05:35:11.047" LastActivityDate="2018-05-17T05:35:11.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2078" PostTypeId="4" CreationDate="2018-05-17T05:35:11.047" Score="0" Body="For questions about how a quantum state (wavefunction, density matrix, Wigner distribution, etc.) changes with respect to time. Also for questions about how to calculate quantum dynamics." OwnerUserId="26" LastEditorUserId="2293" LastEditDate="2018-07-06T01:07:55.653" LastActivityDate="2018-07-06T01:07:55.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2079" PostTypeId="5" CreationDate="2018-05-17T05:35:47.633" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-17T05:35:47.633" LastActivityDate="2018-05-17T05:35:47.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2080" PostTypeId="4" CreationDate="2018-05-17T05:35:47.633" Score="0" Body="A density matrix is a matrix that can be used to describe a quantum system in a mixed state, a statistical ensemble of several quantum states. This should be contrasted with a single state vector that describes a quantum system in a pure state." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-11-04T10:12:39.680" LastActivityDate="2020-11-04T10:12:39.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2081" PostTypeId="2" ParentId="2074" CreationDate="2018-05-17T06:43:34.610" Score="15" Body="&lt;p&gt;There are plenty of different variants, particularly with regards to the conditions on the Hamiltonian. It's a bit of a game, for example, to try and find the simplest possible class of Hamiltonians for which simulation is still BQP-complete.&lt;/p&gt;&#xA;&lt;p&gt;The statement will roughly be along the lines of: let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be a (normalised) product state, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be a Hamiltonian from some particular class (e.g. consisting only of nearest-neighbour couplings on a one-dimensional lattice), &lt;span class=&quot;math-container&quot;&gt;$\hat O$&lt;/span&gt; an observable comprising a tensor product of one-body operators such that &lt;span class=&quot;math-container&quot;&gt;$\|\hat O\|\leq 1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; be a time. Given the promise that &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|e^{iHt}\hat O e^{-iHt}|\psi\rangle$&lt;/span&gt; is either greater than &lt;span class=&quot;math-container&quot;&gt;$\frac12+a$&lt;/span&gt; or less than &lt;span class=&quot;math-container&quot;&gt;$\frac12-a$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; (e.g. &lt;span class=&quot;math-container&quot;&gt;$a=\frac16$&lt;/span&gt;), decide which is the case.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h1&gt;Further Details&lt;/h1&gt;&#xA;&lt;h2&gt;Hamiltonian Simulation is BQP-hard&lt;/h2&gt;&#xA;&lt;p&gt;The basic construction (originally due to Feynman, here tweaked a bit) basically shows how you can design a Hamiltonian that implements any quantum computation, including any BQP-complete computation. The observable you would measure is just &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on a particular output qubit, the two measurement outcomes corresponding to 'yes' and 'no'.&lt;/p&gt;&#xA;&lt;p&gt;The simplest sort of Hamiltonian you might think of is to consider a computation of &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; sequential unitaries &lt;span class=&quot;math-container&quot;&gt;$U_n$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; qubits, starting from a state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes M}$&lt;/span&gt;. Then you can introduce an extra &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits, and specify the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\frac{2}{N}\sum_{n=1}^{N-1}\sqrt{n(N-n)}\left(|10\rangle\langle 01|_{n,n+1}\otimes U+|01\rangle\langle 10|_{n,n+1}\otimes U^\dagger\right).&#xA;$$&lt;/span&gt;&#xA;If you prepare your initial state as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|0\rangle^{\otimes(N-1)}|0\rangle^{\otimes M}$&lt;/span&gt; then after a time &lt;span class=&quot;math-container&quot;&gt;$N\pi/4$&lt;/span&gt;, it will be in a state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes (N-1)}|1\rangle|\Phi\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\Phi\rangle$&lt;/span&gt; is the output of the desired computation. The funny coupling strengths that I've used here, the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{n(N-n)}$&lt;/span&gt; are chosen specifically to give deterministic evolution, and are related to the concept of &lt;a href=&quot;https://arxiv.org/abs/0903.4274&quot; rel=&quot;nofollow noreferrer&quot;&gt;perfect state transfer&lt;/a&gt;. Usually you'll see results stated with equal couplings, but probabilistic evolution.&lt;/p&gt;&#xA;&lt;p&gt;To see how this works, you define a set of states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_n\rangle=|0\rangle^{\otimes(n-1)}|1\rangle|0\rangle^{\otimes{N-n}}\otimes\left(U_{n-1}U_{n-2}\ldots U_1|0\rangle^{\otimes M}\right).&#xA;$$&lt;/span&gt;&#xA;The action of the Hamiltonian is then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|\psi_n\rangle=\frac2N\sqrt{(n-1)(N+1-n)}|\psi_{n-1}\rangle+\frac2N\sqrt{n(N-n)}|\psi_{n+1}\rangle,&#xA;$$&lt;/span&gt;&#xA;which proves that the evolution is restricted to an &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; subspace which is represented by a tridiagonal matrix (which is the specific thing studied in perfect state transfer).&lt;/p&gt;&#xA;&lt;p&gt;Of course, this Hamiltonian doesn't have any particularly nice properties - it is highly non-local, for example. There are many tricks that can be played to simplify the Hamiltonian to being, for example, one-dimensional. It can even be translationally invariant if you want, at the cost of having to prepare a more complex initial product state (at that point, the computation is no longer encoded in the Hamiltonian, which is universal, but is encoded in the input state). See &lt;a href=&quot;https://arxiv.org/abs/0704.3432&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, for example.&lt;/p&gt;&#xA;&lt;h2&gt;Hamiltonians can be simulated with a universal quantum computer&lt;/h2&gt;&#xA;&lt;p&gt;The evolution of any Hamiltonian which is local on some lattice, acting on an initial product state, for a time that is no more than polynomial in the system size, can be simulated by a quantum computer, and any efficiently implementable measurement can be applied to estimate an observable. In this sense, you can see that Hamiltonian simulation is no harder than a quantum computation, the counter-point to the previous statement that quantum computation is no harder than Hamiltonian simulation.&lt;/p&gt;&#xA;&lt;p&gt;There are many ways to do this (and there have been some recent papers that show significant improvements in error scaling for certain classes of Hamiltonian). Hre's quite a simple one. Take the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; that you want to simulate. Split it up into different parts, &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt;, each of which commutes. For example, on a nearest-neighbour Hamiltonian on some graph, you don't need more pieces than the maximum degree of the graph. You then Trotterize the evolution, writing the approximation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iHt}\approx \left(e^{-iH_1\delta t}e^{-iH_2\delta t}\ldots e^{-iH_n\delta t}\right)^{t/\delta t}&#xA;$$&lt;/span&gt;&#xA;So, you just have to construct a circuit that implements terms like &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_1\delta t}$&lt;/span&gt;, which is composed of commuting terms &lt;span class=&quot;math-container&quot;&gt;$H_1=\sum_nh_n$&lt;/span&gt;, each of which acts only on a small number of qubits.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iH_1\delta t}=\prod_{n}e^{-ih_n\delta t}&#xA;$$&lt;/span&gt;&#xA;Since this is just a unitary on a small number of terms, a universal quantum computer can implement it.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="2927" LastEditDate="2020-09-03T22:30:49.420" LastActivityDate="2020-09-03T22:30:49.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2082" PostTypeId="1" AcceptedAnswerId="2084" CreationDate="2018-05-17T11:22:41.280" Score="24" ViewCount="2350" Body="&lt;p&gt;I am a computer science student and am currently searching for resources from where I can learn about quantum computers, quantum computing models, their working principles, their gates and some simple quantum algorithms.&lt;/p&gt;&#xA;" OwnerUserId="2405" LastEditorUserId="26" LastEditDate="2018-12-13T19:50:43.977" LastActivityDate="2019-02-16T00:58:30.717" Title="Are there any organised resources available from where I can begin my quantum computing studies?" Tags="&lt;resource-request&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="21" ContentLicense="CC BY-SA 4.0" />
  <row Id="2083" PostTypeId="2" ParentId="2082" CreationDate="2018-05-17T11:43:37.850" Score="8" Body="&lt;p&gt;The book &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information_(book)&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Quantum computation and quantum information&lt;/em&gt;&lt;/a&gt; by Nielsen and Chuang is a good read in order to introduce yourself to the world of quantum computation. The book assumes minimal prior experience with quantum mechanics and with computer science, aiming instead to be a self-contained introduction to the relevant features of both, so it is really a nice starting point for anyone who wishes to introduce himself to world of quantum information science.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="15" LastEditDate="2018-05-17T21:00:32.377" LastActivityDate="2018-05-17T21:00:32.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2084" PostTypeId="2" ParentId="2082" CreationDate="2018-05-17T12:37:39.753" Score="14" Body="&lt;p&gt;A curated list of resources can be found &lt;a href=&quot;https://github.com/desireevl/awesome-quantum-computing&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of the link above one day going dead, I should pick out some highlights. Though this will be entirely subjective&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=introduction&quot; rel=&quot;noreferrer&quot;&gt;IBM Q Experience user guide&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial&quot; rel=&quot;noreferrer&quot;&gt;Tutorial for QISKit SDK&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.theory.caltech.edu/%7Epreskill/ph219/index.html#lecture&quot; rel=&quot;noreferrer&quot;&gt;Preskill's lecture notes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ocw.mit.edu/courses/media-arts-and-sciences/mas-865j-quantum-information-science-spring-2006/lecture-notes/&quot; rel=&quot;noreferrer&quot;&gt;Open course by MIT&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.futurelearn.com/courses/intro-to-quantum-computing&quot; rel=&quot;noreferrer&quot;&gt;Open course by Keio University&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-17T12:37:39.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2085" PostTypeId="5" CreationDate="2018-05-17T13:31:57.343" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-17T13:31:57.343" LastActivityDate="2018-05-17T13:31:57.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2086" PostTypeId="4" CreationDate="2018-05-17T13:31:57.343" Score="0" Body="For questions related to completely positive (CP) trace-preserving (TP) maps between spaces of operators" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-17T21:18:04.707" LastActivityDate="2018-05-17T21:18:04.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2087" PostTypeId="5" CreationDate="2018-05-17T13:47:43.657" Score="0" Body="&lt;p&gt;The phenomenon by which measurements made at a microscopic level can contradict a collection of notions known as &quot;local realism&quot; that are regarded as intuitively true in classical mechanics. Some observations about the correlations among multiple parties, while correctly predicted by quantum mechanics, can be proved to be impossible to achieve via local hidden variable theories.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="55" LastEditDate="2019-02-25T10:47:57.763" LastActivityDate="2019-02-25T10:47:57.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2088" PostTypeId="4" CreationDate="2018-05-17T13:47:43.657" Score="0" Body="For questions about the phenomena related to correlations among distant observers. For example, this tag should be used for questions about Bell or CHSH inequalities, or for questions about quantum steering." OwnerUserId="-1" LastEditorUserId="55" LastEditDate="2021-04-21T13:27:28.883" LastActivityDate="2021-04-21T13:27:28.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2089" PostTypeId="5" CreationDate="2018-05-17T13:48:15.120" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-17T13:48:15.120" LastActivityDate="2018-05-17T13:48:15.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2090" PostTypeId="4" CreationDate="2018-05-17T13:48:15.120" Score="0" Body="For questions related to contextuality (a foundational concept in quantum mechanics) as relevant to quantum computing and/or quantum information. Contextuality means that in any theory that attempts to explain quantum mechanics deterministically, the measurement result of a quantum observable depends on the specific experimental setup being used to measure that observable, in particular, the commuting observables being measured with it. (Wikipedia)" OwnerUserId="-1" LastEditorUserId="26" LastEditDate="2019-01-01T10:09:08.523" LastActivityDate="2019-01-01T10:09:08.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2091" PostTypeId="2" ParentId="2082" CreationDate="2018-05-17T14:36:37.103" Score="3" Body="&lt;p&gt;It really depends on where your brain is at. In particular, how much mathematics you have under your belt. Much of what you will need to understand is contained within linear algebra (over the complex numbers.) Zooming in more: it's all in the tensor product. Most explanations I see of how tensoring works are brutally difficult to understand as a novice. In fact, the case can be made that the whole field of quantum computing has been held back by our understanding of tensor products and ability to work with them (calculate.) In this vein, I would highly recommend the recent book by Coecke and Kissinger &quot;Picturing Quantum Processes.&quot; Although perhaps you would like to struggle with a more traditional text first, in order to more appreciate the diagrammatic approach.&lt;/p&gt;&#xA;" OwnerUserId="263" LastActivityDate="2018-05-17T14:36:37.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2093" PostTypeId="2" ParentId="1679" CreationDate="2018-05-17T19:10:51.340" Score="2" Body="&lt;p&gt;That Wikipedia article you mention says &quot;Blockchain security methods include the use of public-key cryptography.&quot; The most widely used pubic-key cryptography methods are RSA and some elliptic curve methods. Quantum computers are a threat to both RSA and elliptic curve methods because they rely on it being difficult to factor large number or to calculate difficult discrete logarithms, and Peter Shor showed in 1994 that a quantum computer can perform both these tasks with exponentially fewer arithmetic operations than a classical computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If it is possible to build a big enough quantum computer, most if not all blockchain implementations will be at threat because of relying on public-key cryptography implementations which are not safe against quantum computing.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-17T19:10:51.340" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2094" PostTypeId="2" ParentId="1679" CreationDate="2018-05-17T20:38:09.603" Score="7" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Are the current implementations of blockchain resistant to attacks using quantum computation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Quick answers:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Resistant against near-term technology?  Sure.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Reliably secure in the long term?  Probably not.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Will this pose a major problem?  Very likely not.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is this risk unique to blockchains?  Nope.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Because even if quantum computers would become a major threat to current implementations, the community could just elect to do a &lt;a href=&quot;https://www.investopedia.com/terms/h/hard-fork.asp&quot; rel=&quot;noreferrer&quot;&gt;hard fork&lt;/a&gt; to &lt;a href=&quot;https://en.wikipedia.org/wiki/Post-quantum_cryptography&quot; rel=&quot;noreferrer&quot;&gt;post-quantum cryptography&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Not to say that blockchain technology developers and researchers don't need to worry about working on this issue, though I'd imagine that the average user needn't be concerned with this particular threat.&lt;/p&gt;&#xA;&lt;p&gt;Also worth noting that other financial institutions, including banks, would be prone to a similar risk in some weird hypothetical world in which people inexplicably elected against upgrading their crypto.  For example, hackers could use quantum computers to crack a financial institution's &lt;a href=&quot;https://en.wikipedia.org/wiki/Public_key_certificate&quot; rel=&quot;noreferrer&quot;&gt;TLS/SSL certificate&lt;/a&gt;, allowing them to &lt;a href=&quot;https://en.wikipedia.org/wiki/Man-in-the-middle_attack&quot; rel=&quot;noreferrer&quot;&gt;man-in-the-middle attack&lt;/a&gt; (random &lt;a href=&quot;https://ieeexplore.ieee.org/document/7163047/&quot; rel=&quot;noreferrer&quot;&gt;2015 paper&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h1&gt;Long answer&lt;/h1&gt;&#xA;&lt;p&gt;Here's a 2017 paper that projects that Bitcoin could potentially become vulnerable by 2027, using generous assumptions:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The key cryptographic protocols used to secure the internet and financial transactions of today are all susceptible to attack by the development of a sufficiently large quantum computer. One particular area at risk are cryptocurrencies, a market currently worth over 150 billion USD. We investigate the risk of Bitcoin, and other cryptocurrencies, to attacks by quantum computers. We find that the proof-of-work used by Bitcoin is relatively resistant to substantial speedup by quantum computers in the next 10 years, mainly because specialized ASIC miners are extremely fast compared to the estimated clock speed of near-term quantum computers. On the other hand, the elliptic curve signature scheme used by Bitcoin is much more at risk, and could be completely broken by a quantum computer as early as 2027, by the most optimistic estimates. We analyze an alternative proof-of-work called Momentum, based on finding collisions in a hash function, that is even more resistant to speedup by a quantum computer. We also review the available post-quantum signature schemes to see which one would best meet the security and efficiency requirements of blockchain applications.&lt;/p&gt;&#xA;&lt;p&gt;–&lt;a href=&quot;https://arxiv.org/abs/1710.10377&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Quantum attacks on Bitcoin, and how to protect against them&amp;quot;&lt;/a&gt; (2017-10-28)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That said, I'm not too sure how relevant a concern this might be in practice as it seems like that the situation'll change before that point.  Even if Bitcoin's still around and going strong by the time it could be attacked, various mitigation techniques might go into effect.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.bitcoin.it/wiki/Weaknesses&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Weakness&amp;quot;&lt;/a&gt; article on Bitcoin's wiki doesn't even mention quantum stuff, though their article on &lt;a href=&quot;https://en.bitcoin.it/wiki/Myths#Quantum_computers_would_break_Bitcoin.27s_security&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Myths&amp;quot; does&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;h3&gt;Quantum computers would break Bitcoin's security&lt;/h3&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;While ECDSA is indeed not secure under quantum computing, quantum computers don't yet exist and probably won't for a while. The DWAVE system often written about in the press is, even if all their claims are true, not a quantum computer of a kind that could be used for cryptography. Bitcoin's security, when used properly with a new address on each transaction, depends on more than just ECDSA: Cryptographic hashes are much stronger than ECDSA under QC.&lt;/p&gt;&#xA;&lt;p&gt;Bitcoin's security was designed to be upgraded in a forward compatible way and could be &lt;a href=&quot;https://en.wikipedia.org/wiki/Post-quantum_cryptography&quot; rel=&quot;noreferrer&quot;&gt;upgraded&lt;/a&gt; if this were considered an imminent threat (cf. Aggarwal et al. 2017, &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1710.10377&quot; rel=&quot;noreferrer&quot;&gt;Quantum attacks on Bitcoin, and how to protect against them&lt;/a&gt;&amp;quot;).&lt;/p&gt;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computer#Potential&quot; rel=&quot;noreferrer&quot;&gt;implications of quantum computers on public key cryptography.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;risk&lt;/em&gt; of quantum computers is also there for financial institutions, like banks, because they heavily rely on cryptography when doing transactions.&lt;/p&gt;&#xA;&lt;p&gt;–&lt;a href=&quot;https://en.bitcoin.it/wiki/Myths#Quantum_computers_would_break_Bitcoin.27s_security&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Myths&amp;quot;&lt;/a&gt;, bitcoinwiki&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Regarding the point about updating mentioned above, it's that while Bitcoin and other blockchains do tend to require standard algorithms that may be foreseeably attacked by quantum computers, before that's an issue, they can basically just do a &lt;strong&gt;&lt;em&gt;hard fork&lt;/em&gt;&lt;/strong&gt;, which is basically an update that everyone in the network migrates to, enabling stuff like algorithm changes.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;What is 'Hard Fork'&lt;/strong&gt;&lt;br/&gt;A hard fork (or sometimes hardfork), as it relates to blockchain technology, is a radical change to the protocol that makes previously invalid blocks/transactions valid (or vice-versa). This requires all nodes or users to upgrade to the latest version of the protocol software. Put differently, a hard fork is a permanent divergence from the previous version of the blockchain, and nodes running previous versions will no longer be accepted by the newest version. This essentially creates a fork in the blockchain: one path follows the new, upgraded blockchain, and the other path continues along the old path. Generally, after a short period of time, those on the old chain will realize that their version of the blockchain is outdated or irrelevant and quickly upgrade to the latest version.&lt;/p&gt;&#xA;&lt;p&gt;–&lt;a href=&quot;https://www.investopedia.com/terms/h/hard-fork.asp&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;Hard Fork&amp;quot;&lt;/a&gt;, Investopedia&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Of course, pushing a hard fork requires getting much of the community to accept it, though since pretty much all members of a cryptocurrency network wouldn't want to get hacked/scammed/etc., a hard fork pushed to avert a foreseeable risk of attack by quantum computers would almost certainly be uncontroversial.&lt;/p&gt;&#xA;" OwnerUserId="15" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-05-17T20:53:21.080" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="2095" PostTypeId="1" CreationDate="2018-05-18T05:15:35.113" Score="8" ViewCount="140" Body="&lt;p&gt;In a simple form, &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell&amp;#39;s_theorem&quot; rel=&quot;noreferrer&quot;&gt;Bell's theorem&lt;/a&gt; states that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;No physical theory of local hidden variables can ever reproduce all of the predictions of quantum mechanics.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Bell developed a series of inequalities to provide specific experimental examples to distinguish between the predictions of any theory relying on &lt;em&gt;local hidden variables&lt;/em&gt; and those of &lt;em&gt;quantum mechanics&lt;/em&gt;. As such, &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_test_experiments&quot; rel=&quot;noreferrer&quot;&gt;Bell test inequality experiments&lt;/a&gt; are of fundamental interest in quantum mechanics. However, if one wants to do things properly, one realizes that there are &lt;a href=&quot;https://en.wikipedia.org/wiki/Loopholes_in_Bell_test_experiments&quot; rel=&quot;noreferrer&quot;&gt;a number of loopholes that affects, &lt;em&gt;in different degrees&lt;/em&gt;, all experiments trying to perform Bell tests&lt;/a&gt;.[1] Experiments trying to close these loopholes tend to be unique rather than routine. One of the results of having general-purpose quantum computers, or networks thereof, would be the ability to routinely perform sophisticated quantum experiments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: &lt;strong&gt;What requirements would have to fulfill a general-purpose quantum computer (network) to be able to implement Bell tests that are &lt;em&gt;at least as loophole-free&lt;/em&gt; as the best realization that has been done so far&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For clarity: ideally the best answer will take a quantum computing approach and contain close-to-engineering details, or at least close-to-architecture. For example, writing the experiment as a simple quantum circuit, one of the current architectures can be chosen and from that one would make some realistic order-of-magnitude estimates to the required times of the different quantum gates / measurements and of the required physical distance between the different qubits.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] As commented by @kludg, it has been argued that &quot;&lt;em&gt;..no experiment, as ideal as it is, can be said to be totally loophole-free.&lt;/em&gt;&quot;, see &lt;a href=&quot;https://physics.aps.org/articles/v8/123&quot; rel=&quot;noreferrer&quot;&gt;Viewpoint: Closing the Door on Einstein and Bohr’s Quantum Debate&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="55" LastEditDate="2021-04-10T08:29:47.040" LastActivityDate="2021-04-10T08:29:47.040" Title="How would a Quantum Computer (network) perform loophole-free Bell tests?" Tags="&lt;architecture&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2096" PostTypeId="2" ParentId="2095" CreationDate="2018-05-18T06:58:44.783" Score="6" Body="&lt;p&gt;When people talk about a loophole free Bell test, what they really mean is that the two loopholes that most concern the majority of people are closed simultaneously: the measurement loophole and the locality loophole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us briefly review the protocol:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A Bell state $(|00\rangle+|11\rangle)/\sqrt{2}$ is produced, and two parties, Alice and Bob, each take one qubit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob must be separated by a distance $d$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob each pick a random bit value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If Alice's random bit value, $x$, is 0, she measures her qubit in the $Z$ basis. If it's 1, she measures in the $X$ basis. Her measurement outcome is a bit, recorded in the variable $A_x$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If Bob's random bit value is $y\in\{0,1\}$, he measures in the basis $(Z+(-1)^yX)/\sqrt{2}$. His measurement outcome is a bit, recorded in the variable $B_y$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob repeat this many times, and evaluate the expected value of $$S=A_0(B_0+B_1)+A_1(B_0-B_1).$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Closing the locality loophole requires that the two parties that are taking part are separated by a distance $d$ such that the time between Alice's measurement basis being chosen, and Bob's answer being given is less than $d/c$, where $c$ is the speed of light (so that there is no way an adversary choosing Bob's answer can know Alice's measurement basis). It also requires, symmetrically, that Alice's answer is given no later than a time $d/c$ after Bob's measurement choice is made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Closing the measurement loophole requires the use of detectors that have a sufficiently high accuracy (otherwise, an adversary obeying a Local Hidden Variable model could replace your detectors with better detectors, and use the margin of error to throw away results that would betray the presence of eavesdropping/manipulation). The precise value of this threshold depends on your precise formulation of the Bell test. The commonly quoted value is a detector efficiency of about $83\%$ for the CHSH test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, there have been experiments that have closed both these loopholes simultaneously. See &lt;a href=&quot;https://www.nature.com/articles/nature15759&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, for example. Their results are good enough that they can quantify the likelihood of there being a local hidden variable model that describes their results ($P=0.039$). Ultimately, if you want to do better, you either need devices that perform better than theirs, or to perform more runs of the experiment. That is, perhaps, now the main experimental challenge; to improve the speed of such devices so that it doesn't take 18 days to generate 245 trials! These experiments also claim to remove the freedom of choice loophole, wherein one worries that the random number generators that are used for choosing the measurement bases of Alice and Bob are also governed by the same local hidden variable model, instead of generating perfect randomness that is uncorrelated with the rest of the experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of a quantum computing architecture for implementing this, that is not a particularly natural issue: for a quantum computer, one wants to be able to create as much connection and interaction between the qubits as possible, which is rather the opposite of needing to separate them over great distances. I suppose the sort of context which is starting to generate the right scenario are the designs for scalable ion trap quantum computers, where there are multiple separated traps, each of which only interacts occasionally. If each of these were far enough apart, you could think of a loophole-free Bell test. I believe the measurement efficiencies in these scenarios are high enough. The question then is, how far apart do these different locations have to be to close the locality loop hole? I haven't done any sort of calculation based on real data, but I think the answer is of the order of kilometers, i.e. completely unreasonable for a single computer. For me, those would be separate computers, working very hard to cooperatively compute using the minimum of shared resources (i.e. entanglement).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-18T07:30:03.737" LastActivityDate="2018-05-18T07:30:03.737" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2097" PostTypeId="1" AcceptedAnswerId="2099" CreationDate="2018-05-18T19:46:48.373" Score="11" ViewCount="522" Body="&lt;p&gt;Schrödinger wrote a letter to Einstein after the 1935 EPR paper, and in that letter Schrödinger used the German word &quot;Verschränkung&quot; which translates into &quot;entanglement&quot;, but when was the word first used in English?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Schrödinger's 1935 paper written in English, called &lt;a href=&quot;https://www.cambridge.org/core/journals/mathematical-proceedings-of-the-cambridge-philosophical-society/article/discussion-of-probability-relations-between-separated-systems/C1C71E1AA5BA56EBE6588AAACB9A222D&quot; rel=&quot;noreferrer&quot;&gt;Discussion of Probability Relations between Separated Systems&lt;/a&gt;, says (according to Wikipedia) &quot;I would not call [entanglement] one but rather the characteristic trait of quantum mechanics, the one that enforces its entire departure from classical lines of thought&quot; which means the concept was there but it whatever word he used for it was not entanglement (hence the square brackets). Unfortunately I do not have access to the full paper.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-18T20:24:42.280" LastActivityDate="2021-01-24T22:58:28.950" Title="When was the first use of the word Entanglement?" Tags="&lt;entanglement&gt;&lt;terminology&gt;&lt;history&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2098" PostTypeId="1" CreationDate="2018-05-18T20:16:22.253" Score="9" ViewCount="246" Body="&lt;p&gt;The Toric code Hamiltonian is:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{x,y}\left( \prod_{i\in p(x,y)} Z_{ixy} + \prod_{i\in v(x,y)} X_{ixy}   \right),$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the $v$ and $p$ are defined according to this picture (courtesy of James Wooton's contribution to Wikipedia):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4Ydj9m.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4Ydj9m.png&quot; alt=&quot;Toric Code Lattice courtesy of James Wooton from Wikipedia&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment we have an infinite 2D lattice:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$x\rightarrow \pm \infty$ &lt;br&gt;&#xA;$y\rightarrow \pm \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if we set periodic boundary conditions such that (and feel free to edit the question if I am incorrect about this):&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$p(x+10,y)=p(x,y)$&lt;br&gt;&#xA;$v(x,y+10)=v(x,y)$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We get the follownig torus (image courtesy of James Wooton's contribution to Wikipedia) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pFM3Nm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pFM3Nm.png&quot; alt=&quot;Toric Code Torus courtesy of James Wooton from Wikipedia&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now in my periodic boundary conditions, I chose to add $+10$ but could have added some other number instead. How does this &quot;size of the torus&quot; affect the function of the toric code?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="10480" LastEditDate="2021-02-10T07:07:57.187" LastActivityDate="2021-02-10T21:34:10.030" Title="How does the size of a toric code torus affect its ability to protect qubits?" Tags="&lt;error-correction&gt;&lt;architecture&gt;&lt;fault-tolerance&gt;&lt;topological-quantum-computing&gt;&lt;toric-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2099" PostTypeId="2" ParentId="2097" CreationDate="2018-05-18T23:28:05.820" Score="7" Body="&lt;p&gt;I managed to get access to the paper mentioned in the question. Schrödinger  in 1935 (the same year the original EPR paper was published) wrote in English: &quot;By the interaction the two representatives (or $\psi$-functions) have become entangled.&quot; This was in the abstract.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He also wrote later in the paper: &quot;What constitutes the entanglement is that $\psi$ is not a product of a function of x and a function of y.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He also used the term &quot;disentanglement&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the use of the term as found by searching: quantum entanglement&lt;br&gt;&#xA;in Google Scholar indicates that the term was merely doubling every 10 years until roughly 1990 when it went up by a factor of 5 in a 10-year period, followed by further factor of 6 in the next 10-year period:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TGjW9.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TGjW9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Data was collected just now:&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1900-1940: 63 results &lt;br&gt;&#xA;1900-1950: 93 results &lt;br&gt;&#xA;1900-1960: 146 results &lt;br&gt;&#xA;1900-1970: 313 results &lt;br&gt;&#xA;1900-1980: 718 results &lt;br&gt;&#xA;1900-1990: 1700 results &lt;br&gt;&#xA;1900-2000: 9380 results &lt;br&gt;&#xA;1900-2010: 61700 results &lt;br&gt;&#xA;1900-2020: 151000 results &lt;br&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-18T23:28:05.820" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2100" PostTypeId="1" CreationDate="2018-05-19T02:02:13.063" Score="7" ViewCount="229" Body="&lt;p&gt;For example, has anyone seen something like:&lt;br&gt;&#xA;&quot;quqrit&quot; for a 4-level system&lt;sup&gt;[1]&lt;/sup&gt;, or&lt;br&gt;&#xA;&quot;qupit&quot; for a 5-level system&lt;sup&gt;[2]&lt;/sup&gt; ?&lt;br&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; From &quot;quad&quot; or &quot;quart&quot; since &quot;tetra&quot; would be qutrit, which is already a 3-level system.&lt;br&gt;&#xA;&lt;sup&gt;2&lt;/sup&gt; From &quot;penta&quot; since &quot;quint&quot; would interfere with quqrit for 4-level system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that we could call a quqrit a &quot;spin-3/2 particle&quot; which would be overloading the meaning of spin, but I wonder if these terms have ever been used. I have searched &quot;quqrit&quot; and &quot;qupit&quot; on Google but what if it's not called &quot;quqrit&quot; but something else? Also, perhaps no one had the bravery to publish something with these words written down but have been used orally at conferences. Surprisingly, after asking this question I found &lt;em&gt;one&lt;/em&gt; &lt;a href=&quot;https://arxiv.org/abs/1202.0052&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; using the term &quot;qupit&quot; but the word only appears in the title and nowhere else, so it's not clear what their definition of qupit is!&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-19T02:08:07.750" LastActivityDate="2018-06-07T07:32:45.983" Title="Do any specific types of qudits other than qubits and qutrits have a name?" Tags="&lt;terminology&gt;&lt;qudit&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2101" PostTypeId="2" ParentId="2100" CreationDate="2018-05-19T04:39:11.730" Score="3" Body="&lt;p&gt;After a lot of searching, it appears that the word &quot;quqrit&quot; has indeed been used in one (but I found only one!) &lt;a href=&quot;https://www.researchgate.net/profile/Mozammel_Khan/publication/254019812_Minimized_reversiblequantum_synthesis_of_non-reversible_quinary_logic_function/links/54bf3e5d0cf2f6bf4e04e019/Minimized-reversible-quantum-synthesis-of-non-reversible-quinary-logic-function.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; from 2011, and indeed it was used to describe a 4-level system. But the word &quot;quqit&quot; is used to describe 4-level systems in two papers &lt;a href=&quot;https://www.researchgate.net/publication/235542053_Bell_states_in_a_resonant_quantum_waveguide_network?_sg=m3rWoIRIuDoqe4l3MBPBbd1dM4oGLrKBKuuzYGrgcAe-N-10Th3hpLbG5X_gIyvBPdcwcjCZgQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;&lt;a href=&quot;http://order.ph.utexas.edu/PhysRevA_70_052330.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt; dating back to 2004. This time there's four different authors in total, but two of them are on both papers so no independent groups using this term (as far as I have found). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for higher-order qudits beyond $d=5$, it appears to be an open question.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-19T04:47:38.697" LastActivityDate="2018-05-19T04:47:38.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2102" PostTypeId="2" ParentId="2100" CreationDate="2018-05-19T05:46:12.440" Score="6" Body="&lt;p&gt;There is no standard name for a qudit for $d&amp;gt;3$. The community has mostly settled on the term qudit (but you will still find qunit or quNit, for example, using $n$ or $N$ instead of $d$ in some older papers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will find the odd paper where an individual author will pick a name for the $d=4$ case. I’ve certainly seen ququad and &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.81.052317&quot; rel=&quot;nofollow noreferrer&quot;&gt;ququart&lt;/a&gt;. But I think mostly people just use qudit, and specify $d$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other term that you'll see (thanks to Niel de Beaudrap for pointing it out) is qupit, a quantum system where the Hilbert space dimension is an odd prime, $p$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="23" LastEditDate="2018-06-07T07:32:45.983" LastActivityDate="2018-06-07T07:32:45.983" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2103" PostTypeId="2" ParentId="2098" CreationDate="2018-05-19T06:23:38.910" Score="6" Body="&lt;p&gt;The Toric code is an error correcting code. The distance of the code (I.e. the number of local operations required to convert one logical state into an orthogonal one) is equal to $N$, where the Toric code is defined on an $N\times N$ grid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the places that the performance of the Toric code really wins out is that although it is only distance $N$, the vast majority of sets of $N$ single qubit errors can be corrected, and it is only once you get $O(N^2)$ errors that you get killed. That means that as $N\rightarrow\infty$, those $O(N)$ terms vanish, and you get a finite per-qubit error rate as a threshold for error correction. For finite $N$, the error correcting threshold will be lower.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-19T06:23:38.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2104" PostTypeId="2" ParentId="2012" CreationDate="2018-05-19T07:49:20.730" Score="2" Body="&lt;p&gt;I don't know the translation into physics, but the circuit you want for the most basic demonstration is the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dQbYK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dQbYK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Here, $|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$, and the gates are controlled-not gates and controlled-phase gates. The state $|\psi\rangle$ can be any input state initially. The first time the circuit is run prepares the $|\psi\rangle$ qubits in a 4-qubit Toric code (up to some corrections depending on what measurement results you got). Repeat the measurements again, and you get a round of error correction. In effect, what the first qubit is doing is measuring the expectation value of the observable $XXXX$ on the Toric code qubits, while the second qubit measures the $ZZZZ$ observable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to remember that Jiannis Pachos (and coauthors) explicitly described the smallest Toric code implementation possible (which I guess was this version), but I can't seem to find the paper. I had assumed that JamesWooton would have jumped in by now to tell you where that paper is. It must be commented, however, that such a small size of Toric Code is completely hopeless for error correcting properties; you cannot even correct for single-qubit errors!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-19T09:12:21.783" LastActivityDate="2018-05-19T09:12:21.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2105" PostTypeId="1" AcceptedAnswerId="2124" CreationDate="2018-05-19T10:26:28.080" Score="7" ViewCount="66" Body="&lt;p&gt;When applying each of the six degree of freedom rotations (or certain combinations of them) in an SO(4) using quantum gates, the results I expected are produced. For example, the following circuit in Craig Gidney's Quirk tool demonstrates rotations in three degrees of freedom, along with some displays of the resulting matrices expressed as percentages:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pz8Ew.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pz8Ew.png&quot; alt=&quot;Rotating three degrees of freedom in an SO(4) with expected results&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when applying some combinations of rotations, such as the following, results I didn't expect are produced in the final matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VArq8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VArq8.png&quot; alt=&quot;Rotating four degrees of freedom in an SO(4) with expected results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In contrast, the results I am expecting are the following:&#xA;$$&#xA;\begin{bmatrix}&#xA;    .73 &amp;amp; .07 &amp;amp; .13 &amp;amp; .07 \\&#xA;    .00 &amp;amp; .73 &amp;amp; .15 &amp;amp; .13 \\&#xA;    .13 &amp;amp; .07 &amp;amp; .73 &amp;amp; .07 \\&#xA;    .15 &amp;amp; .13 &amp;amp; .00 &amp;amp; .73&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For convenience, here is a &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22X%22%5D%2C%5B%22Y%5E%C2%BC%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C%22X%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%5D%2C%5B%22%E2%97%A6%22%2C%22Y%5E%C2%BC%22%5D%2C%5B%22X%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Y%5E%C2%BC%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Y%5E%C2%BC%22%2C%22%E2%97%A6%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22Y%5E%C2%BC%22%5D%2C%5B%22X%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22X%22%5D%2C%5B%22Y%5E%C2%BC%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22X%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~1rvi%22%2C%22name%22%3A%22disp%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance2%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22~o6fc%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;link to the Quirk circuit with all six degree of freedom rotations&lt;/a&gt;, albeit with an unexpected final result. The results I expect are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix}&#xA;    .62 &amp;amp; .01 &amp;amp; .08 &amp;amp; .29 \\&#xA;    .11 &amp;amp; .80 &amp;amp; .01 &amp;amp; .08 \\&#xA;    .13 &amp;amp; .07 &amp;amp; .80 &amp;amp; .01 \\&#xA;    .15 &amp;amp; .13 &amp;amp; .11 &amp;amp; .62&#xA;\end{bmatrix}&#xA;$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know enough about using ancilla bits and uncomputation techniques to apply them to this, but I suspect that it might explain part of the unexpected results. Any advice would be greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="2421" LastEditorUserId="26" LastEditDate="2018-12-23T13:52:44.760" LastActivityDate="2018-12-23T13:52:44.760" Title="How to avoid error when applying certain combinations of degree of freedom rotations using a quantum circuit?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2106" PostTypeId="1" AcceptedAnswerId="2107" CreationDate="2018-05-19T14:16:46.973" Score="29" ViewCount="8208" Body="&lt;p&gt;I am studying Quantum Computing and Information. I have crossed with the 'Surface Code' phrase but I can't find a brief explanation of what it is and how it works. Hopefully you guys can help me with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: If you like you can use some complicated math, I am familiar with quantum mechanics to some extent.&lt;/p&gt;&#xA;" OwnerUserId="2422" LastEditorUserId="26" LastEditDate="2018-12-13T19:50:54.267" LastActivityDate="2019-08-28T08:59:15.577" Title="What is 'Surface Code'? (Quantum Error Correction)" Tags="&lt;error-correction&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="20" ContentLicense="CC BY-SA 4.0" />
  <row Id="2107" PostTypeId="2" ParentId="2106" CreationDate="2018-05-19T18:13:31.267" Score="14" Body="&lt;p&gt;The surface codes are a family of quantum error correcting codes defined on a 2D lattice of qubits. Each code within this family has stabilizers that are defined equivalently in the bulk, but differ from one another in their boundary conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The members of the surface code family are sometimes also described by more specific names: The &lt;a href=&quot;https://en.wikipedia.org/wiki/Toric_code&quot; rel=&quot;noreferrer&quot;&gt;toric code&lt;/a&gt; is a surface code with periodic boundary conditions, the planar code is one defined on a plane, etc. The term ‘surface code’ is sometimes also used interchangeably with ‘planar code’, since this is the most realistic example of the surface code family.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The surface codes are currently a large research area, so I’ll just point you towards some good entry points (in addition to the Wikipedia article linked to above).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0110143&quot; rel=&quot;noreferrer&quot;&gt;Topological quantum memory (paper)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;noreferrer&quot;&gt;Surface codes: Towards practical large-scale quantum computation (paper)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://decodoku.blogspot.ch/2016/02/5-story-so-far_57.html&quot; rel=&quot;noreferrer&quot;&gt;My blog series introducing surface codes&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The surface codes can also be generalized to qudits. For more on that, see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9707021&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="-1" LastEditDate="2019-08-28T08:59:15.577" LastActivityDate="2019-08-28T08:59:15.577" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2108" PostTypeId="1" AcceptedAnswerId="2122" CreationDate="2018-05-19T18:56:31.730" Score="8" ViewCount="811" Body="&lt;p&gt;I am trying to run some code using &lt;code&gt;qiskit&lt;/code&gt;, but I get the error message, that I have run out of necessary &lt;code&gt;Experiment Units&lt;/code&gt;. I tried to remove pending jobs using the API with the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for job in api.get_jobs():&#xA;    if job[&quot;status&quot;] == &quot;RUNNING&quot;:&#xA;    api.cancel_job(id_job=job[&quot;id&quot;], hub=None, group=None, project=None,&#xA;        access_token=None, user_id=None)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it didn't work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I even going in the right direction or is there some other way to retrieve these used &lt;code&gt;Experiment Units&lt;/code&gt;? I have read, that they normally are given back just after the execution of program is finished or after 24 hours (depending on which one ends earlier), but I am waiting now for over than two days and nothing happens.&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="409" LastEditDate="2018-05-19T22:47:43.870" LastActivityDate="2018-05-21T07:34:13.137" Title="How to delete pending jobs on IBM Quantum Computer to retrieve units?" Tags="&lt;ibm-q-experience&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2109" PostTypeId="1" CreationDate="2018-05-20T07:48:47.487" Score="6" ViewCount="118" Body="&lt;p&gt;I have some practical difficulties with projective measurements, so I'd welcome inspiration from others. This is beyond the question &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1958/are-true-projective-measurements-possible-experimentally&quot;&gt;Are true Projective Measurements possible experimentally?&lt;/a&gt;&quot; in that I'm not aiming for perfection but for something practical. In particular, I care about the case where we want to keep computing after a measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us say we try to effect an upwards transition between two energy levels, by illuminating the sample with the appropriate wavelength. The transition is only possible if the initial state is occupied, since the final state is outside of out computational basis. For this to be a projective measurement rather than an unitary operation in a larger basis, we need to irreversibly detect this, say by a radiative spontaneous relaxation of this &quot;final&quot; state of the transition to a third energy level. If we were subsequently able to go back to the original level (coherently and rapidly), then I assume we'd have a messy work-around for an ideal projective measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is: can this be done, or is this scheme fundamentally flawed? If it can be done, please illustrate with examples where this works.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="1837" LastEditDate="2018-09-21T07:42:05.147" LastActivityDate="2018-09-21T07:42:05.147" Title="Projective measurements: aftermath and restoration" Tags="&lt;measurement&gt;&lt;initialization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2110" PostTypeId="1" AcceptedAnswerId="2113" CreationDate="2018-05-20T11:41:37.023" Score="23" ViewCount="2119" Body="&lt;p&gt;Grover's algorithm is used, among other things, to search an item &lt;span class=&quot;math-container&quot;&gt;$\mathbf{y}$&lt;/span&gt; in an unordered list of items &lt;span class=&quot;math-container&quot;&gt;$[\mathbf{x}_0, \mathbf{x}_1, ..., \mathbf{x}_{n-1}]$&lt;/span&gt; of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Even though there are &lt;a href=&quot;https://quantumcomputing.stackexchange.com/search?q=grover%27s%20algorithm&quot;&gt;plenty of questions&lt;/a&gt; here regarding this topic, I still miss the point.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Searching in a list, the classical way&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Normally, I would design a search function this way&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{search}([\mathbf{x}_0, \mathbf{x}_1, ..., \mathbf{x}_{n-1}], \mathbf{y}) = i \in \mathbb{N} \quad \text{such that } \mathbf{x}_i = \mathbf{y} $$&lt;/span&gt;&#xA;So I give the list and the wanted item as inputs, and I receive the position of the item in the list as output. I think I have understood that the information about &lt;span class=&quot;math-container&quot;&gt;$\mathbf{y}$&lt;/span&gt; is embedded in the algorithm through the oracle gate &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;, so our function becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{search}_\mathbf{y}([\mathbf{x}_1, \mathbf{x}_2, ..., \mathbf{x}_n] ) = i \in \mathbb{N} \quad \text{such that } \mathbf{x}_i = \mathbf{y} $$&lt;/span&gt;&#xA;Let's make a practical example. Consider searching the ace of spades &lt;span class=&quot;math-container&quot;&gt;$1\spadesuit$&lt;/span&gt; in a sequence of 8 cards from a &lt;a href=&quot;https://en.wikipedia.org/wiki/Standard_52-card_deck&quot; rel=&quot;noreferrer&quot;&gt;standard 52-card deck&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AUQIl.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AUQIl.png&quot; alt=&quot;shuffled deck&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The list of length &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$[&#xA;    \mathbf{x}_0 = J\clubsuit,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_1 = 10\diamondsuit,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_2 = 4\heartsuit,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_3 = Q\clubsuit,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_4 = 3\spadesuit,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_5 = 1\spadesuit,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_6 = 6\spadesuit, $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$&#xA;    \mathbf{x}_7 = 6\clubsuit]$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The wanted element is &lt;span class=&quot;math-container&quot;&gt;$\mathbf{x}_5$&lt;/span&gt;. I should obtain &lt;span class=&quot;math-container&quot;&gt;$\mathrm{search}_{\spadesuit}(cards) = 5$&lt;/span&gt;. Each card can be encoded with &lt;span class=&quot;math-container&quot;&gt;$\lceil{\log_2 52}\rceil = 6$&lt;/span&gt;bits, the list has &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; elements so we need &lt;span class=&quot;math-container&quot;&gt;$6\times 8 = 48$&lt;/span&gt; bits to encode the list. In this case, the oracle &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; will implement the function:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(\mathbf{x}) = \begin{cases} 1, &amp;amp; \mathbf{x} = 1\spadesuit \\ 0, &amp;amp; \text{otherwise} \end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the input of Grover's algorithm is not a state of &lt;span class=&quot;math-container&quot;&gt;$48$&lt;/span&gt;qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(NB: Image of shuffled deck is taken from &lt;a href=&quot;https://www.random.org/playing-cards/&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Grover and its oracle&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Several sources (eg. &lt;a href=&quot;https://qudev.phys.ethz.ch/content/QSIT16/talks/Grover_QSIT.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; - graphically explained) say that the input of the algorithm is different: the input is a state taken from the search space &lt;span class=&quot;math-container&quot;&gt;$S = \{ 0, 1, 2, ..., N \} = \{0, 1, 2, ..., 7 \} $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of elements of the list. Each number corresponds to the position of an element in the list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{search}_{\spadesuit}(\cdot)$&lt;/span&gt; is now a &lt;span class=&quot;math-container&quot;&gt;$\lceil \log_2 8 \rceil = 3$&lt;/span&gt;qubit vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, which must be a superposition of all the items in the search space &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|0_{3\text{qubits}}\rangle = |000\rangle$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$J\clubsuit$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|1_{3\text{qubits}}\rangle = |001\rangle$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$10\diamondsuit$&lt;/span&gt;; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|2_{3\text{qubits}}\rangle = |010\rangle$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$4\heartsuit$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|5_{3\text{qubits}}\rangle = |101\rangle$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$1\spadesuit$&lt;/span&gt; which is the wanted element;&lt;/li&gt;&#xA;&lt;li&gt;and so on...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In this case we have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{search}_{\spadesuit}(|\psi\rangle) = |5_{3\text{qubits}}\rangle$$&lt;/span&gt;&#xA;But in this case, our oracle would have to implement the function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(|\psi\rangle) = \begin{cases} 1, &amp;amp; |\psi\rangle = |5_{3\text{qubits}}\rangle \\ 0, &amp;amp; \text{otherwise} \end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building the oracle requires us to know that &lt;span class=&quot;math-container&quot;&gt;$\spadesuit$&lt;/span&gt; is at position 5. What's the point to execute the algorithm if we have already searched for the element in order to build the oracle?&lt;/p&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="55" LastEditDate="2021-05-03T11:28:49.763" LastActivityDate="2021-05-03T11:57:50.777" Title="What's the point of Grover's algorithm if we have to search the list of elements to build the oracle?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="5" CommentCount="3" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="2111" PostTypeId="1" AcceptedAnswerId="2112" CreationDate="2018-05-20T13:51:24.533" Score="20" ViewCount="3652" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt; is expected to enable us to &lt;a href=&quot;https://en.wikipedia.org/wiki/Integer_factorization&quot; rel=&quot;noreferrer&quot;&gt;factor integers&lt;/a&gt; far larger than could be feasibly done on modern classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At current, only smaller integers have been factored.  For example, &lt;a href=&quot;https://physicsworld.com/a/shors-algorithm-is-implemented-using-five-trapped-ions/&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; discusses factorizing $15=5{\times}3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is in this sense the state-of-art in research? Is there any recent paper in which it says some bigger numbers have been factorized?&lt;/p&gt;&#xA;" OwnerUserId="2426" LastEditorUserId="26" LastEditDate="2018-12-13T19:51:19.627" LastActivityDate="2018-12-17T10:23:06.293" Title="What integers have been factored with Shor's algorithm?" Tags="&lt;shors-algorithm&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2112" PostTypeId="2" ParentId="2111" CreationDate="2018-05-20T14:19:25.103" Score="16" Body="&lt;p&gt;The prime factorization of 21 (7x3) seems to be the largest done to date with Shor's algorithm; it was done in 2012 as detailed in &lt;a href=&quot;http://www.nature.com/nphoton/journal/vaop/ncurrent/full/nphoton.2012.259.html&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. It should be noted, however, that much larger numbers, such as 56,153 in 2014, have been factored using a minimization algorithm, as detailed &lt;a href=&quot;https://phys.org/news/2014-11-largest-factored-quantum-device.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. For a convenient reference, see Table 5 of &lt;a href=&quot;https://arxiv.org/abs/1411.6758&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{array}{c}&#xA;  \textbf{Table 5:}~\text{Quantum factorization records} \\ \hline&#xA;  \small{&#xA;  \begin{array}{cccccc}&#xA;    \text{Number} &amp;amp; \text{# of factors} &amp;amp; \begin{array}{c}\text{# of qubits} \\ \text{needed} \end{array} &amp;amp; \text{Algorithm} &amp;amp; \begin{array}{c}\text{Year} \\ \text{implemented} \end{array} &amp;amp; \begin{array}{c}\text{Implemented} \\ \text{without prior} \\ \text{knowledge of} \\ \text{solution} \end{array} \\ \hline&#xA;  15    &amp;amp; 2 &amp;amp; 8 &amp;amp; \text{Shor} &amp;amp; 2001~\left[2\right] &amp;amp; \chi \\&#xA;        &amp;amp; 2 &amp;amp; 8 &amp;amp; \text{Shor} &amp;amp; 2007~\left[3\right] &amp;amp; \chi \\&#xA;        &amp;amp; 2 &amp;amp; 8 &amp;amp; \text{Shor} &amp;amp; 2007~\left[3\right] &amp;amp; \chi \\&#xA;        &amp;amp; 2 &amp;amp; 8 &amp;amp; \text{Shor} &amp;amp; 2009~\left[5\right] &amp;amp; \chi \\&#xA;        &amp;amp; 2 &amp;amp; 8 &amp;amp; \text{Shor} &amp;amp; 2012~\left[6\right] &amp;amp; \chi \\&#xA;   21   &amp;amp; 2 &amp;amp; 10 &amp;amp; \text{Shor} &amp;amp; 2012~\left[7\right] &amp;amp; \chi \\&#xA;   143  &amp;amp; 2 &amp;amp; 4 &amp;amp; \text{minimization} &amp;amp; 2012~\left[1\right] &amp;amp; \checkmark \\&#xA;   56153  &amp;amp; 2 &amp;amp; 4 &amp;amp; \text{minimization} &amp;amp; 2012~\left[1\right] &amp;amp; \checkmark \\ \hline&#xA;    291311  &amp;amp; 2 &amp;amp; 6 &amp;amp; \text{minimization} &amp;amp; \text{not yet} &amp;amp; \checkmark \\&#xA;    175  &amp;amp; 3 &amp;amp; 3 &amp;amp; \text{minimization} &amp;amp; \text{not yet} &amp;amp; \checkmark&#xA;  \end{array}}&#xA;\end{array}_{\Large{.}}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="2293" LastEditDate="2018-05-20T22:07:27.237" LastActivityDate="2018-05-20T22:07:27.237" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2113" PostTypeId="2" ParentId="2110" CreationDate="2018-05-20T15:35:22.060" Score="14" Body="&lt;p&gt;If you have 8 items in the list (like in your card's example), then the input of the oracle is 3 (qu)bits. Number of cards in the deck (52) is irrelevant, you need 3 bits only to encode 8 cards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think that 3 bits encode the position in the list of the card you are searching; then you don't know the position, but the oracle knows. So if you are searching the ace of spades, then the oracle knows that the ace of spades is the 6th card (or 5th counting from zero) and implements the function&#xA;$$&#xA;f(\mathbf{x}) = \begin{cases} 1, &amp;amp; \text{if x = 5, or binary '101'} \\ 0, &amp;amp; \text{otherwise} \end{cases}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: It is better to think about the Grover's algorithm differently: you have an oracle implementing a boolean function which outputs $1$ for a single combination of input bits, otherwise outputs zero, and your task is to find the combination. The problem has the same complexity as searching in an unsorted list or database, that is why the Grover's algorithm is usually described as searching in an unsorted database. But applying the algorithm to a real-world database search indeed raises questions that are beyond the algorithm itself. Grover's algorithm is just searching for what the oracle knows.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-05-20T16:34:46.827" LastActivityDate="2018-05-20T16:34:46.827" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2114" PostTypeId="1" AcceptedAnswerId="2116" CreationDate="2018-05-20T17:02:31.187" Score="8" ViewCount="328" Body="&lt;p&gt;$\newcommand{\Ket}[1]{\left|#1\right&amp;gt;}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that in general quantum black box algorithms (such as the ones which play a part in Simon's &amp;amp; Deutsch's algorithm) implement a quantum circuit to compute some function $f\left(x\right)$ in such a way that the input is fed with trailing zero qubits, and the result is the input followed by the output, e.g:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Ket{x}\Ket{0} \rightarrow \Ket{x}\Ket{f(x)}\,.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, since basically one can write the above more explicitly as:$$&#xA;\Ket{x}\otimes\Ket{0} \rightarrow \Ket{x}\otimes\Ket{f(x)}&#xA;\,,$$whether it is possible, in case $\Ket{x}$ is not a pure state but a superposition, to get an output which &quot;mixes&quot; inputs with the wrong outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify what I mean I'll give an example:&#xA;Suppose our input is the one qubit superposition: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\Ket{x} = \frac{\Ket{0}+\Ket{1}}{\sqrt{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will the result of the black-box circuit be the following tensor product:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left\lbrack\frac{\Ket{0}+\Ket{1}}{\sqrt{2}}\right\rbrack&#xA;\otimes&#xA;\left\lbrack\frac{\Ket{f(0)}+\Ket{f(1)}}{\sqrt{2}}\right\rbrack&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Which I find confusing and unlikely)&#xA;Or, the other option which seems to be more natural:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\Ket{0}\Ket{f(0)}+\Ket{1}\Ket{f(1)}}{\sqrt{2}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Or perhaps both are wrong? :))&lt;/p&gt;&#xA;" OwnerUserId="2428" LastEditorUserId="15" LastEditDate="2018-05-20T20:17:41.743" LastActivityDate="2018-05-20T20:17:41.743" Title="Clarification needed regarding quantum &quot;black-box&quot; circuits" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2115" PostTypeId="2" ParentId="2114" CreationDate="2018-05-20T17:50:48.007" Score="4" Body="&lt;p&gt;Nice question. &#xA;Your second example is correct. I will show this by using Equation 2 from &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product#Properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(A + B)\otimes C = A\otimes C + B\otimes C$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)\otimes|f(x)\rangle = \frac{|0\rangle\otimes|f(x)\rangle}{\sqrt{2}}+\frac{|1\rangle\otimes|f(x)\rangle}{\sqrt{2}} = \frac{|0\rangle\otimes|f(0)\rangle}{\sqrt{2}}+\frac{|1\rangle\otimes|f(1)\rangle}{\sqrt{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this being done, for example, in the first line of Page 6 in these &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; of Prof. John Watrous.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-20T17:58:46.907" LastActivityDate="2018-05-20T17:58:46.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2116" PostTypeId="2" ParentId="2114" CreationDate="2018-05-20T18:30:09.033" Score="4" Body="&lt;p&gt;It is always good to start from considering an example. Suppose you have CNOT gate; then&#xA;\begin{align}&#xA;\Ket{0}\Ket{0} \rightarrow \Ket{0}\Ket{0}\\&#xA;\Ket{1}\Ket{0} \rightarrow \Ket{1}\Ket{1}&#xA;\end{align}&#xA;By linearity&#xA;\begin{align}&#xA;\frac{1}{\sqrt{2}}(\Ket{0}\Ket{0} + \Ket{1}\Ket{0}) \rightarrow \frac{1}{\sqrt{2}}(\Ket{0}\Ket{0}+ \Ket{1}\Ket{1})&#xA;\end{align}&#xA;or&#xA;\begin{align}&#xA;\frac{1}{\sqrt{2}}(\Ket{0} + \Ket{1})\Ket{0} \rightarrow \frac{1}{\sqrt{2}}(\Ket{0}\Ket{0}+ \Ket{1}\Ket{1})&#xA;\end{align}&#xA;So your first guess is wrong, but the second guess seems to be true, and it is not hard to convince yourself that it is indeed true.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2018-05-20T18:30:09.033" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2118" PostTypeId="2" ParentId="1796" CreationDate="2018-05-20T20:23:51.553" Score="1" Body="&lt;p&gt;&lt;strong&gt;For Shor's algorthm&lt;/strong&gt;:&#xA;Every experiment has been designed for the specific number being factored. The largest number factored without cheating &lt;a href=&quot;http://science.sciencemag.org/content/351/6277/1068&quot; rel=&quot;nofollow noreferrer&quot;&gt;was 15&lt;/a&gt; which is the smallest non-trivial semi-prime on which to apply Shor's algorithm.  Major changes would be needed in the experiment (including in the number of qubits) in order to factor 21, for example. IBM's 50-qubit machine can implement Shor's algorithm on larger numbers, but the noise is so bad that you will only get the correct factors if you're very lucky, and that's why it hasn't been done yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For the annealing algorithm&lt;/strong&gt;: &lt;a href=&quot;https://arxiv.org/abs/1804.02733&quot; rel=&quot;nofollow noreferrer&quot;&gt;376289 has been factored&lt;/a&gt; with D-Wave's 2048-qubit annealer, and this is &lt;em&gt;not&lt;/em&gt; a specific experiment but a general algorithm on an easily programmable machine, but we do not know how this will scale. A very crude upper limit to the number of qubits needed to factor RSA-230 is &lt;a href=&quot;https://arxiv.org/pdf/1706.08061.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;5.5 billion qubits&lt;/a&gt; (but this can be brought down significantly by better compilers), while Shor's algorithm &lt;a href=&quot;https://arxiv.org/pdf/1706.07884.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;can do it with 381 qubits&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-20T20:23:51.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2119" PostTypeId="2" ParentId="2111" CreationDate="2018-05-20T21:43:08.620" Score="6" Body="&lt;p&gt;&lt;strong&gt;For Shor's algorthm&lt;/strong&gt;:&#xA;&lt;a href=&quot;http://science.sciencemag.org/content/351/6277/1068&quot; rel=&quot;noreferrer&quot;&gt;State of the art is still 15&lt;/a&gt;. In order to &quot;factor&quot; 21 in the paper Heather mentions, they had to use the fact that $21=7\times 3$  to choose their base $a$. This was explained in 2013 in the paper &lt;a href=&quot;https://arxiv.org/abs/1301.7007&quot; rel=&quot;noreferrer&quot;&gt;Pretending to factor numbers on a quantum computer&lt;/a&gt;, later published by Nature with a slightly &lt;a href=&quot;https://www.nature.com/articles/nature12290&quot; rel=&quot;noreferrer&quot;&gt;friendlier title&lt;/a&gt;. The quantum computer did not factor 21, but it verified that the factors 7 and 3 are indeed correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For the annealing algorithm&lt;/strong&gt;: &lt;a href=&quot;https://arxiv.org/abs/1804.02733&quot; rel=&quot;noreferrer&quot;&gt;State of the art is 376289&lt;/a&gt;. But we do not know how this will scale. A very crude upper limit to the number of qubits needed to factor RSA-230 is &lt;a href=&quot;https://arxiv.org/pdf/1706.08061.pdf&quot; rel=&quot;noreferrer&quot;&gt;5.5 billion qubits&lt;/a&gt; (but this can be brought down significantly by better compilers), while Shor's algorithm &lt;a href=&quot;https://arxiv.org/pdf/1706.07884.pdf&quot; rel=&quot;noreferrer&quot;&gt;can do it with 381 qubits&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-20T21:43:08.620" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2120" PostTypeId="2" ParentId="2111" CreationDate="2018-05-20T23:59:02.027" Score="5" Body="&lt;p&gt;The size of the number factored is not a good measure for the complexity of the factorization problem, and correspondingly the power of a quantum algorithm. The relevant measure should rather be the periodicity of the resulting function which appears in the algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is discussed in &lt;a href=&quot;https://arxiv.org/abs/1301.7007&quot; rel=&quot;noreferrer&quot;&gt;J. Smolin, G. Smith, A. Vargo: Pretending to factor large numbers on a quantum computer&lt;/a&gt;, &lt;a href=&quot;https://dx.doi.org/10.1038/nature12290&quot; rel=&quot;noreferrer&quot;&gt;Nature 499, 163-165 (2013)&lt;/a&gt;.  In particular, the authors also give an example of a number with 20000 binary digits which can be factored with a two-qubit quantum computer, with exactly the same implementation that had been used previously to factor other numbers.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that the &quot;manual simplifications&quot; which the authors perform to arrive at this quantum algorithm is something which has also been done e.g. for the original experiment factoring 15.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-05-20T23:59:02.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2121" PostTypeId="2" ParentId="2110" CreationDate="2018-05-21T07:09:38.107" Score="5" Body="&lt;p&gt;While it is perhaps easiest for us to think about the function of the oracle as already having computed all these values, that's not what it's doing. In the case you described, the oracle has 8 possible inputs (i.e. encoded in 3 (qu)bits), and the oracle does all the computation that you need &lt;em&gt;on the fly&lt;/em&gt;. So, the moment you try to evaluate the oracle for some value $x$, the oracle looks up (in this instance) the card that the value of $x$ corresponds to, and then checks if that card is the marked card. The idea being that each time you call the oracle, it goes through that process once. Overall, you evaluate the function a number of times that's equal to the number of times you call the oracle. The aim of any search algorithm is to call that oracle as few times as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case this sounds a little circular (given an input $x$, find which card that corresponds to), remember that your look-up table for what $x$ corresponds to what card can be &lt;em&gt;ordered&lt;/em&gt; which is a different, simpler, much faster search question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key differences in your example compared to a more realistic usage scenario are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The search space is usually massive. There's no realistic prospect of precomputing all values. Indeed, that is exactly what we're trying to avoid.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Usually, we don't actually say 'find the ace of spades'. Instead, there's an $f(x)$ that is non-trivial to evaluate to test if $x$ is the 'marked' item or not. The fact that the oracle can take quite a long time to evaluate, even for a single entry, is what makes the oracle the costly part to implement (and all other gates are given for free) and why you need to minimise the number of calls.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, really, the way a classical search would work on your problem is: pick an $x$ at random. Evaluate $y=f(x)$. If $y=1$, return $x$, otherwise repeat. While the &lt;em&gt;net&lt;/em&gt; effect of $f(x)$ is 'is the input $x_0$, the marked entry?', that is not the &lt;em&gt;actual&lt;/em&gt; calculation that it does.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-21T07:09:38.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2122" PostTypeId="2" ParentId="2108" CreationDate="2018-05-21T07:25:19.890" Score="6" Body="&lt;p&gt;Cancel Job is only available for the IBM Q Network, not for IBM Q Experience: &lt;a href=&quot;https://github.com/QISKit/qiskit-api-py/blob/master/IBMQuantumExperience/IBMQuantumExperience.py#L795&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/QISKit/qiskit-api-py/blob/master/IBMQuantumExperience/IBMQuantumExperience.py#L795&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the next weeks, we hope that it is available for IBM Q Experience too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding to the credits... we are analyzing the problem. We have refilled your credits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have any other issue, please post in qiskit (&lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;noreferrer&quot;&gt;https://qiskit.org/&lt;/a&gt;) slack public channel :).&lt;/p&gt;&#xA;" OwnerUserId="2436" LastEditorUserId="2436" LastEditDate="2018-05-21T07:34:13.137" LastActivityDate="2018-05-21T07:34:13.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2123" PostTypeId="2" ParentId="2106" CreationDate="2018-05-21T08:26:43.287" Score="18" Body="&lt;p&gt;The terminology of 'surface code' is a little bit variable. It might refer to a whole class of things, variants of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Toric_code&quot; rel=&quot;noreferrer&quot;&gt;Toric code&lt;/a&gt; on different lattices, or it might refer to the Planar code, the specific variant on a square lattice with open boundary conditions.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;The Toric Code&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I'll summarise some of the basic properties of the Toric code. Imagine a square lattice with periodic boundary conditions, i.e. the top edge is joined to the bottom edge, and the left edge is joined to the right edge. If you try this with a sheet of paper, you'll find you get a doughnut shape, or torus. On this lattice, we place a qubit on each edge of a square.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wdBRf.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wdBRf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Stabilizers&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Next, we define a whole bunch of operators. For every square on the lattice (comprising 4 qubits in the middle of each edge), we write&#xA;$$&#xA;B_p=XXXX,&#xA;$$&#xA;acting a Pauli-$X$ rotation on each of the 4 qubits. The label $p$ refers to 'plaquette', and is just an index so we can later count over the whole set of plaquettes. On every vertex of the lattice (surrounded by 4 qubits), we define&#xA;$$&#xA;A_s=ZZZZ.&#xA;$$&#xA;$s$ refers to the star shape and again, will let us sum over all such terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We observe that all of these terms mutually commute. It's trivial for $[A_s,A_{s'}]=[B_p,B_{p'}]=0$ because Pauli operators commute with themselves and $\mathbb{I}$. More care is required with $[A_s,B_p]=0$, bot note that these two terms either have 0 or 2 sites in common, and pairs of different Pauli operators commute, $[XX,ZZ]=0$.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Codespace&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Since all these operators commute, we can define a simultaneous eigenstate of them all, a state $|\psi\rangle$ such that&#xA;$$&#xA;\forall s:A_s|\psi\rangle=|\psi\rangle\qquad\forall p:B_p|\psi\rangle=|\psi\rangle.&#xA;$$&#xA;This defines the codespace of the code. We should determine how large it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an $N\times N$ lattice, there are $N^2$ qubits, so the Hilbert space dimension is $2^{N^2}$. There are $N^2$ terms $A_s$ or $B_p$, which we collectively refer to as stabilizers. Each has eigenvalues $\pm 1$ (to see, just note that $A_s^2=B_p^2=\mathbb{I}$) in equal number, and when we combine them, each halves the dimension of the Hilbert space, i.e. we would &lt;em&gt;think&lt;/em&gt; that this uniquely defines a state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, however, observe that $\prod_sA_s=\prod_pB_p=\mathbb{I}$: each qubit is included in two stars and two plaquettes. This means that one of the $A_s$ and one of the $B_p$ is linearly dependent on all the others, and does not further reduce the size of the Hilbert space. In other words, the stabilizer relations define a Hilbert space of dimension 4; the code can encode two qubits.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Logical Operators&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How do we encode a quantum state in the Toric code? We need to know the logical operators: $X_{1,L}$, $Z_{1,L}$, $X_{2,L}$ and $Z_{2,L}$. All four must commute with all the stabilizers, and be linearly independent from them, and must generate the algebra of two qubits. Commutation of operators on the two different logical qubits:&#xA;$$&#xA;[X_{1,L},X_{2,L}]=0\quad [X_{1,L},Z_{2,L}]=0 \quad [Z_{1,L},Z_{2,L}]=0\quad [Z_{1,L},X_{2,L}]=0&#xA;$$&#xA;and anti-commutation of the two on each qubit:&#xA;$$&#xA;\{X_{1,L},Z_{1,L}\}=0\qquad\{X_{2,L},Z_{2,L}\}=0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a couple of different conventions for how to label the different operators. I'll go with my favourite (which is probably the less popular):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a horizontal line on the lattice. On every qubit, apply $Z$. This is $Z_{1,L}$. In fact, &lt;em&gt;any&lt;/em&gt; horizontal line is just as good.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a vertical line on the lattice. On every qubit, apply $Z$. This is $X_{2,L}$ (the other convention would label it as $Z_{2,L}$)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a horizontal strip of qubits, each of which is in the middle of a vertical edge. On every qubit, apply $X$. This is $Z_{2,L}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a vertical strip of qubits, each of which is in the middle of a horizontal edge. On every qubit, apply $X$. This is $X_{1,L}$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You'll see that the operators that are supposed to anti-commute meet at exactly one site, with an $X$ and a $Z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, we define the logical basis states of the code by&#xA;$$&#xA;|\psi_{x,y}\rangle: Z_{1,L}|\psi_{x,y}\rangle=(-1)^x|\psi_{x,y}\rangle,\qquad Z_{2,L}|\psi_{x,y}\rangle=(-1)^y|\psi_{x,y}\rangle&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distance of the code is $N$ because the shortest sequence of single-qubit operators that converts between two logical states constitutes $N$ Pauli operators on a loop around the torus.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Error Detection and Correction&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Once you have a code, with some qubits stored in the codespace, you want to keep it there. To achieve this, we need error correction. Each round of error correction comprises measuring the value of every stabilizer. Each $A_s$ and $B_p$ gives an answer $\pm 1$. This is your error syndrome. It is then up to you, depending on what error model you think applies to your system, to determine where you think the errors have occurred, and try to fix them. There's a lot of work going on into fast decoders that can perform this classical computation as efficiently as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One crucial feature of the Toric code is that you do not have to identify exactly where an error has occurred to perfectly correct it; the code is &lt;em&gt;degenerate&lt;/em&gt;. The only relevant thing is that you get rid of the errors without implementing a logical gate. For example, the green line in the figure is one of the basic errors in the system, called an anyone pair. If the sequence of $X$ rotations depicted had been enacted, than the stabilizers on the two squares with the green blobs in would have given a $-1$ answer, while all others give $+1$. To correct for this, we could apply $X$ along exactly the path where the errors happened, although our error syndrome certainly doesn't give us the path information. There are many other paths of $X$ errors that would give the same syndrome. We can implement &lt;em&gt;any&lt;/em&gt; of these, and there are two options. Either, the overall sequence of $X$ rotations forms a trivial path, or one that loops around the torus in at least on direction. If it's a trivial path (i.e. one that forms a closed path that does not loop around the torus), then we have successfully corrected the error. This is at the heart of the &lt;em&gt;topological&lt;/em&gt; nature of the code; many paths are equivalent, and it all comes down to whether or not these loops around the torus have been completed.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Error Correcting Threshold&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;While the distance of the code is $N$, it is not the case that every combination of $N$ errors causes a logical error. Indeed, the vast majority of $N$ errors can be corrected. It is only once the errors become of much higher density that error correction fails. There are &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0110143&quot; rel=&quot;noreferrer&quot;&gt;interesting proofs&lt;/a&gt; that make connections to phase transitions or the random bond Ising model, that are very good at pinning down when that is. For example, if you take an error model where $X$ and $Z$ errors occur independently at random on each qubit with probability $p$, the threshold is about $p=0.11$, i.e. $11\%$. It also has a finite fault-tolerant threshold (where you allow for faulty measurements and corrections with some per-qubit error rate)&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;The Planar Code&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Details are largerly identical to the Toric code, except that the boundary conditions of the lattice are open instead of periodic. This mens that, at the edges, the stabilizers get defined slightly differently. In this case, there is only one logical qubit in the code instead of two.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-21T08:26:43.287" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2124" PostTypeId="2" ParentId="2105" CreationDate="2018-05-21T09:40:28.593" Score="3" Body="&lt;p&gt;Since you haven't told us &lt;em&gt;how&lt;/em&gt; you've tried to do the calculation, I don't know where you're making the mistake. (I'm also unfamiliar with Quirk, which seems to be using an unusual ordering of basis elements in the output matrix. If anything looks inconsistent in the following answer, try swapping the middle two rows/columns, and adding a transpose!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first important thing is to not use the percentage values in the transition matrices. These correspond to probabilities, but to do any further work, we need to know about &lt;em&gt;probability amplitudes&lt;/em&gt;. So, the unitary output of your first sequence of gates is&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; \frac{\sqrt{2+\sqrt{2}}}{2} &amp;amp; \frac{1}{4} \left(-2+\sqrt{2}\right) &amp;amp; 0 &amp;amp; -\frac{i}{2 \sqrt{2}} \\&#xA; 0 &amp;amp; \frac{1}{4} \left(2+\sqrt{2}\right) &amp;amp; -\frac{1}{2} i \sqrt{2-\sqrt{2}} &amp;amp; -\frac{i}{2 \sqrt{2}} \\&#xA; 0 &amp;amp; -\frac{i}{2 \sqrt{2}} &amp;amp; \frac{\sqrt{2+\sqrt{2}}}{2} &amp;amp; \frac{1}{4} \left(-2+\sqrt{2}\right) \\&#xA; -\frac{1}{2} i \sqrt{2-\sqrt{2}} &amp;amp; -\frac{i}{2 \sqrt{2}} &amp;amp; 0 &amp;amp; \frac{1}{4} \left(2+\sqrt{2}\right) \\&#xA;\end{array}&#xA;\right)&#xA;$$&#xA;Now we can apply the final sequence of gates; an $X$ on qubit 1, a controlled-$Y^{1/4}$ and another $X$ on qubit 1. You get the output unitary&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; \frac{1}{4} \left(2+\sqrt{2}\right) &amp;amp; -\frac{1}{2} \sqrt{1-\frac{1}{\sqrt{2}}} &amp;amp; -\frac{i}{2 \sqrt{2}} &amp;amp;&#xA;   -\frac{1}{2} i \sqrt{\frac{1}{2} \left(2-\sqrt{2}\right)} \\&#xA; 0 &amp;amp; \frac{1}{4} \left(2+\sqrt{2}\right) &amp;amp; -\frac{1}{2} i \sqrt{2-\sqrt{2}} &amp;amp; -\frac{i}{2 \sqrt{2}} \\&#xA; -\frac{i}{2 \sqrt{2}} &amp;amp; -\frac{1}{2} i \sqrt{\frac{1}{2} \left(2-\sqrt{2}\right)} &amp;amp; \frac{1}{4} \left(2+\sqrt{2}\right)&#xA;   &amp;amp; -\frac{1}{2} \sqrt{1-\frac{1}{\sqrt{2}}} \\&#xA; -\frac{1}{2} i \sqrt{2-\sqrt{2}} &amp;amp; -\frac{i}{2 \sqrt{2}} &amp;amp; 0 &amp;amp; \frac{1}{4} \left(2+\sqrt{2}\right) \\&#xA;\end{array}&#xA;\right)&#xA;$$&#xA;The mod-square of each element is then&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; \frac{1}{16} \left(2+\sqrt{2}\right)^2 &amp;amp; \frac{1}{8} \left(2-\sqrt{2}\right) &amp;amp; \frac{1}{8} &amp;amp; \frac{1}{8}&#xA;   \left(2-\sqrt{2}\right) \\&#xA; 0 &amp;amp; \frac{1}{16} \left(2+\sqrt{2}\right)^2 &amp;amp; \frac{1}{4} \left(2-\sqrt{2}\right) &amp;amp; \frac{1}{8} \\&#xA; \frac{1}{8} &amp;amp; \frac{1}{8} \left(2-\sqrt{2}\right) &amp;amp; \frac{1}{16} \left(2+\sqrt{2}\right)^2 &amp;amp; \frac{1}{8}&#xA;   \left(2-\sqrt{2}\right) \\&#xA; \frac{1}{4} \left(2-\sqrt{2}\right) &amp;amp; \frac{1}{8} &amp;amp; 0 &amp;amp; \frac{1}{16} \left(2+\sqrt{2}\right)^2 \\&#xA;\end{array}&#xA;\right).&#xA;$$&#xA;Numerically, these are the same as given in the question:&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 0.729 &amp;amp; 0.0732 &amp;amp; 0.125 &amp;amp; 0.0732 \\&#xA; 0 &amp;amp; 0.729 &amp;amp; 0.146 &amp;amp; 0.125 \\&#xA; 0.125 &amp;amp; 0.0732 &amp;amp; 0.729 &amp;amp; 0.0732 \\&#xA; 0.146 &amp;amp; 0.125 &amp;amp; 0 &amp;amp; 0.729 \\&#xA;\end{array}&#xA;\right)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-21T09:40:28.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2125" PostTypeId="2" ParentId="1999" CreationDate="2018-05-21T17:39:22.773" Score="3" Body="&lt;p&gt;One of many possible constructions that gives some insight into this question, at least to me, is as follows. Using the CSD (cosine-sine decomposition), you can expand any unitary operator into a product of efficient gates V that fit nicely into a binary tree pattern. In the case of the QFT, that binary tree collapses to a single branch of the tree, all the V not in the branch are 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ref:&#xA;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0411097&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Fast Fourier Transform Viewed as a Special Case of Recursive Application of Cosine-Sine Decomposition, by myself&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="91" LastEditDate="2018-08-07T21:32:04.953" LastActivityDate="2018-08-07T21:32:04.953" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2126" PostTypeId="1" CreationDate="2018-05-21T23:05:07.483" Score="9" ViewCount="355" Body="&lt;p&gt;One deals with the notion of superposition when studying Shor's algorithm, but how about entanglement? Where exactly does it appear in this particular circuit? I assume it is not yet present in the initial state $\left|0\right&amp;gt;\left|0\right&amp;gt;$, but how about in further process, after applying Hadamard gates, the controlled-U gates and the inverse Fourier transform? I understand that the first and second register have to be entangled, otherwise the final measurement on one of them wouldn't collapse the other one, which gives us the period (well, kind of, we need to use continuous fractions to infer it).&lt;/p&gt;&#xA;" OwnerUserId="1889" LastEditorUserId="1889" LastEditDate="2018-05-22T10:52:26.960" LastActivityDate="2018-05-22T10:52:26.960" Title="Entanglement in Shor's algorithm" Tags="&lt;entanglement&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2127" PostTypeId="2" ParentId="2126" CreationDate="2018-05-21T23:56:52.823" Score="3" Body="&lt;p&gt;Your question contains the answer, as you mention the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Controlled_(cX_cY_cZ)_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;controlled-U&lt;/a&gt; gate which is an entangling gate. You will see in the page I linked, that the action of c-U on $|+\rangle|0\rangle$ for example can turn the state into one which cannot be written as a product:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|+\rangle|0\rangle = \left( \frac{|0\rangle+|1\rangle}{\sqrt{2}} \right)\otimes |0\rangle =  \left( \frac{|00\rangle+|10\rangle}{\sqrt{2}} \right)= \left( \frac{|00\rangle+|1\rangle U|&#xA;0\rangle}{\sqrt{2}} \right) = \left( \frac{|00\rangle+|1\rangle \left(u_{00}|0\rangle + u_{10}|1\rangle\right)}{\sqrt{2}} \right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the last step, I used the definition of $U$ from the linked &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Controlled_(cX_cY_cZ)_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;controlled-U&lt;/a&gt; description:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pYsk1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pYsk1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example where this gate is entangling is where $u_{00}$ = 0 and $u_{10}=1$, which is just the $\rm{CNOT}$ gate. In that case we get $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$ which is the Bell state and is maximally entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also be interested in this article on: &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0412140.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Entanglement and it's role in Shor's algorithm&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-05-22T00:04:11.563" LastActivityDate="2018-05-22T00:04:11.563" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2128" PostTypeId="1" CreationDate="2018-05-22T10:14:21.380" Score="8" ViewCount="507" Body="&lt;p&gt;The so-called &lt;em&gt;depolarizing channel&lt;/em&gt; is the channel model that is mostly used when constructing quantum error correction codes. The action of such channel over a quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho\rightarrow(1-p_x-p_y-p_z)\rho+p_xX\rho X+p_yY\rho Y+p_zZ\rho Z$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was wondering which other channel models are considered in quantum communications, and how the construction of error correction codes is affected by considering such other channels.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2020-08-19T10:15:29.967" LastActivityDate="2020-08-19T10:15:29.967" Title="What quantum channels are considered in quantum communication, and how does this choice affect the construction of error correction codes?" Tags="&lt;error-correction&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2129" PostTypeId="1" AcceptedAnswerId="2131" CreationDate="2018-05-22T16:22:56.337" Score="21" ViewCount="1239" Body="&lt;p&gt;Is entanglement &lt;a href=&quot;https://en.wikipedia.org/wiki/Transitive_relation&quot; rel=&quot;noreferrer&quot;&gt;transitive&lt;/a&gt;, in a mathematical sense?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;More concretely, my question is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider 3 qubits $q_1, q_2$ and $q_3$. Assume that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$q_1$ and $q_2$ are entangled, and that&lt;/li&gt;&#xA;&lt;li&gt;$q_2$ and $q_3$ are entangled&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, &lt;strong&gt;are $q_1$ and $q_3$ entangled&lt;/strong&gt;? If so, why? If not, is there a concrete counterexample?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;On my notion of entanglement: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;qubits $q_1$ and $q_2$ are entangled, if after tracing out $q_3$, the qbits $q_1$ and $q_2$ are entangled (tracing out $q_3$ corresponds to measuring $q_3$ and discarding the result).&lt;/li&gt;&#xA;&lt;li&gt;qubits $q_2$ and $q_3$ are entangled, if after tracing out $q_1$, the qbits $q_2$ and $q_3$ are entangled.&lt;/li&gt;&#xA;&lt;li&gt;qubits $q_1$ and $q_3$ are entangled, if after tracing out $q_2$, the qbits $q_1$ and $q_3$ are entangled.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Feel free to use any other reasonable notion of entanglement (not necessarily the one above), as long as you clearly state that notion.&lt;/p&gt;&#xA;" OwnerUserId="2444" LastEditorUserId="26" LastEditDate="2018-12-23T12:28:46.520" LastActivityDate="2018-12-23T12:28:46.520" Title="Is entanglement transitive?" Tags="&lt;entanglement&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2130" PostTypeId="2" ParentId="2129" CreationDate="2018-05-22T18:00:17.200" Score="5" Body="&lt;p&gt;I read the following in &lt;a href=&quot;https://arxiv.org/pdf/0812.3322.pdf&quot; rel=&quot;noreferrer&quot;&gt;Freudenthal triple classication of three-qubit entanglement&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Dür et al. (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005115&quot; rel=&quot;noreferrer&quot;&gt;Three qubits can be entangled in two inequivalent ways&lt;/a&gt;) used simple arguments concerning the conservation of ranks of reduced density matriceshere are only six three-qubit equivalence classes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Null (The trivial zero entanglement orbit corresponding to vanishing states)&lt;/li&gt;&#xA;&lt;li&gt;Separable (Another zero entanglement orbit for completely factorisable product states)&lt;/li&gt;&#xA;&lt;li&gt;Biseparable (Three classes of bipartite entanglement: A-BC, B-AC, C-AB)&lt;/li&gt;&#xA;&lt;li&gt;W (Three-way entangled states that do not maximally&#xA;violate  Bell-type  inequalities) and&lt;/li&gt;&#xA;&lt;li&gt;GHZ (maximally  violate Bell-type inequalities)&quot; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;which as I understand it the answer to your question is &lt;strong&gt;yes&lt;/strong&gt;: if A and B are entangled and B and C are entangled you necessarily are in one of the three-way entangled states so A and C are also entangled. &lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-05-22T18:00:17.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2131" PostTypeId="2" ParentId="2129" CreationDate="2018-05-22T18:02:15.803" Score="11" Body="&lt;p&gt;TL;DR: It depends on how you choose to measure entanglement on a pair of qubits. If you trace out the extra qubits, then &quot;No&quot;. If you measure the qubits (with the freedom to choose the optimal measurement basis), then &quot;Yes&quot;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let $|\Psi\rangle$ be a pure quantum state of 3 qubits, labelled A, B and C. We will say that A and B are entangled if $\rho_{AB}=\text{Tr}_C(|\Psi\rangle\langle\Psi|)$ is not positive under the action of the partial transpose map. This is a necessary and sufficient condition for detecting entanglement in a two-qubit system. The partial trace formalism is equivalent to measuring qubit C in an arbitrary basis and discarding the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a class of counter-examples that show that entanglement &lt;strong&gt;is not transitive&lt;/strong&gt;, of the form&#xA;$$&#xA;|\Psi\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|1\phi\phi\rangle),&#xA;$$&#xA;provided $|\phi\rangle\neq |0\rangle,|1\rangle$. If you trace out qubit $B$ or qubit $C$, you'll get the same density matrix both times:&#xA;$$&#xA;\rho_{AC}=\rho_{AB}=\frac12\left(|00\rangle\langle 00|+|1\phi\rangle\langle 1\phi|+|00\rangle\langle 1\phi|\langle\phi|0\rangle+|1\phi\rangle\langle 00|\langle0|\phi\rangle\right)&#xA;$$&#xA;You can take the partial transpose of this (taking it on the first system is the cleanest):&#xA;$$&#xA;\rho^{PT}=\frac12\left(|00\rangle\langle 00|+|1\phi\rangle\langle 1\phi|+|10\rangle\langle 0\phi|\langle\phi|0\rangle+|0\phi\rangle\langle 10|\langle0|\phi\rangle\right)&#xA;$$&#xA;Now take the determinant (which is equal to the product of the eigenvalues). You get&#xA;$$&#xA;\text{det}(\rho^{PT})=-\frac{1}{16}|\langle 0|\phi\rangle|^2(1-|\langle 0|\phi\rangle|^2)^2,&#xA;$$&#xA;which is negative, so there must be a negative eigenvalue. Thus, $(AB)$ and $(AC)$ are entangled pairs. Meanwhile&#xA;$$&#xA;\rho_{BC}=\frac12(|00\rangle\langle 00|+|\phi\phi\rangle\langle\phi\phi |).&#xA;$$&#xA;Since this is a valid density matrix, it is non-negative. However, the partial transpose is just equal to itself. So, there are no negative eigenvalues and $(BC)$ is not entangled.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Localizable Entanglement&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;One might, instead, talk about the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0411123&quot; rel=&quot;noreferrer&quot;&gt;localizable entanglement&lt;/a&gt;. Before further clarification, this is what I thought the OP was referring to. In this case, instead of tracing out a qubit, one can measure it in a basis of your choice, and calculate the results separately for each measurement outcome. (There is later some averaging process, but that will be irrelevant to us here.) In this case, my response is specifically about pure states, not mixed states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key here is that there are different classes of entangled state. For 3 qubits, there are 6 different types of pure state:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a fully separable state&lt;/li&gt;&#xA;&lt;li&gt;3 types where there is an entangled state between two parties, and a separable state on the third&lt;/li&gt;&#xA;&lt;li&gt;a W-state&lt;/li&gt;&#xA;&lt;li&gt;a GHZ state&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any type of quantum state can be converted into one of the standard representatives of each class just by local measurements and classical communication between the parties. Note that the conditions of $(q_1,q_2)$ and $(q_2,q_3)$ being entangled remove the first 4 cases, so we only have to consider the last 2 cases, W-state and GHZ-state. Both representatives are symmetric under exchange of the particles:&#xA;$$&#xA;|W\rangle=\frac{1}{\sqrt{3}}(|001\rangle+|010\rangle+|100\rangle)\qquad |GHZ\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle)&#xA;$$&#xA;(i.e. if I swap qubits A and B, I still have the same state).&#xA;So, these representatives must have the required transitivity properties: If A and B are entangled, then B and C are entangled, as are A and C. In particular, Both of these representatives can be measured in the X basis in order to localize the entanglement. Thus, any pure state that you're given must be such that you can include the measurement to convert it into the standard representative into the measurement for localizing the entanglement, and you're done! &lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-24T04:00:06.790" LastActivityDate="2018-05-24T04:00:06.790" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2132" PostTypeId="2" ParentId="2129" CreationDate="2018-05-22T18:07:14.737" Score="6" Body="&lt;p&gt;This isn't an answer, but instead just some background facts that are important to know about in order to avoid &quot;not even wrong&quot; territory on these types of questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Entanglement&quot; is not all-or-nothing. Just saying &quot;q1 is entangled with q2 and q2 is entangled with q3&quot; is not enough information to determine the answer to questions like &quot;if I measure q3, will q1 still be entangled with q2?&quot;. Entanglement gets &lt;em&gt;complicated&lt;/em&gt; when dealing with larger systems. You really need to know the specific state, and the measurement, and whether you are permitted to condition on the result of the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may be the case that q1,q2,q3 are entangled as a group but if you trace out any one of the qubits then the density matrix of the remaining two describes a mere classically correlated state. (E.g. this happens with GHZ states.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be aware of the &lt;a href=&quot;https://www.quantiki.org/wiki/monogamy-entanglement&quot; rel=&quot;noreferrer&quot;&gt;monogamy of entanglement&lt;/a&gt;. Past a certain threshold, increasing the strength of the entanglement between q1 and q2 must decrease the strength of entanglement between q1 and q3 (and equivalently q2 and q3).&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-05-22T18:09:31.550" LastActivityDate="2018-05-22T18:09:31.550" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2135" PostTypeId="1" AcceptedAnswerId="2136" CreationDate="2018-05-23T15:42:16.220" Score="9" ViewCount="471" Body="&lt;p&gt;Consider the measurement of the syndrome for the standard 3-qubit code to correct bit flips:&#xA;$$&#xA;\def\place#1#2#3{\smash{\rlap{\hskip{#1px}\raise{#2px}{#3}}}}&#xA;\def\hline#1#2#3{\place{#1}{#2}{\rule{#3px}{1px}}}&#xA;\def\vline#1#2#3{\place{#1}{#2}{\rule{1px}{#3px}}}&#xA;%&#xA;\hline{30}{30}{210}&#xA;\hline{30}{60}{210}&#xA;\hline{30}{150}{210}&#xA;\hline{30}{180}{210}&#xA;\hline{30}{210}{210}&#xA;%&#xA;\vline{60}{60}{150}&#xA;\vline{90}{60}{120}&#xA;\vline{120}{30}{150}&#xA;\vline{150}{30}{120}&#xA;%&#xA;\place{46}{51}{\huge{\oplus}}&#xA;\place{76}{51}{\huge{\oplus}}&#xA;\place{106}{21}{\huge{\oplus}}&#xA;\place{136}{21}{\huge{\oplus}}&#xA;%&#xA;\place{30}{205}{\llap{Z_1}}&#xA;\place{30}{175}{\llap{Z_2}}&#xA;\place{30}{145}{\llap{Z_3}}&#xA;%&#xA;\place{241}{41}{\left. \rule{0px}{22.5px} \right\} M}&#xA;%&#xA;\phantom{\rule{280px}{225px}}_{\Large{.}}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $M$ is a measurement in the computational basis. This circuit measures $Z_1Z_2$ and $Z_2Z_3$ of the encoded block (i.e. the top three). My question is why measure these using ancilla qubits - why not just measure the 3 encoded qubits directly? Such a setup would mean you would not have to use c-not gates which from what I have heard are hard to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note I have only given this 3-qubit code as an example I am interested in general syndrome measurements on general codes).&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="1847" LastEditDate="2018-06-15T08:00:55.017" LastActivityDate="2018-06-15T08:00:55.017" Title="Why do we use ancilla qubits for error syndrome measurements?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2136" PostTypeId="2" ParentId="2135" CreationDate="2018-05-23T15:52:51.157" Score="7" Body="&lt;p&gt;The key point of quantum error correction is precisely &lt;strong&gt;to correct the errors without collapsing the qubits&lt;/strong&gt;, right? If we measure the encoded qubits we project the qubits to $\left|0\right&amp;gt;$ or $\left|1\right&amp;gt;$ and lose all the information in the coefficients $\alpha \left|0\right&amp;gt; + \beta \left|1\right&amp;gt;$. By measuring ancilla qubits we can know what has happened to the qubits without actually knowing the values of the qubits: this enables us to correct errors in a non-destructive way, and carry on with our quantum operation.&lt;/p&gt;&#xA;" OwnerUserId="1847" LastEditorUserId="15" LastEditDate="2018-05-24T08:43:30.087" LastActivityDate="2018-05-24T08:43:30.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2137" PostTypeId="2" ParentId="2097" CreationDate="2018-05-23T17:59:02.893" Score="3" Body="&lt;p&gt;This is a soft answer, offered b/c I'm interested in the etymologies of terms we use in math and science.  For what it's worth:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;entanglement (n.)&lt;/strong&gt;&#xA;   1630s, &quot;that which entangles,&quot; from entangle + -ment. From 1680s as &quot;act of entangling.&quot; Foreign entanglements does not appear as such in Washington's Farewell Address (1796), though he warns against them. The phrase is found in William Coxe's 1798 memoirs of Sir Robert Walpole.&#xA;  &lt;br&gt;&lt;sub&gt;SOURCE: &lt;a href=&quot;https://www.etymonline.com/word/entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Online Etymological Dictionary&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;from:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;tangle (n.)&lt;/strong&gt;&#xA;  1610s, &quot;a tangled condition, a snarl of threads,&quot; from tangle (v.). &lt;br&gt;&lt;sub&gt;SOURCE: &lt;a href=&quot;https://www.etymonline.com/word/tangle?ref=etymonline_crossreference&quot; rel=&quot;nofollow noreferrer&quot;&gt;Online Etymological Dictionary&lt;/a&gt;&lt;/sub&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I make this connection because the idea of determinacy and strings/threads goes back to at least the ancient Greek &lt;a href=&quot;https://en.wikipedia.org/wiki/Moirai&quot; rel=&quot;nofollow noreferrer&quot;&gt;Moirai&lt;/a&gt; (the Fates).&lt;/p&gt;&#xA;" OwnerUserId="2447" LastEditorUserId="2293" LastEditDate="2018-05-24T04:38:52.077" LastActivityDate="2018-05-24T04:38:52.077" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2138" PostTypeId="2" ParentId="2135" CreationDate="2018-05-24T04:09:52.527" Score="6" Body="&lt;p&gt;When you say &quot;why not just measure the 3 encoded qubits directly&quot;, are you thinking that you could measure $Z_1$, $Z_2$ and $Z_3$, and that, from there, you can calculate the values $Z_1Z_2$ and $Z_2Z_3$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is sort of true: if your only goal is to obtain the observables $Z_1Z_2$ and $Z_2Z_3$, you &lt;em&gt;could&lt;/em&gt; do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that is not your end goal, which is, instead, to preserve the information encoded in the logical state. The only way you can do this is to learn nothing about the state that is encoded. Effectively, measuring in this way gives you too much information: it gives you 3 bits of information (1 bit from each measurement that you perform) when you only need 2 bits. Where does this extra bit come from? It is one bit of information about the state that you have encoded. In other words, you have measured the encoded state, destroying any superposition that you are specifically trying to use the error correcting code to protect.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-24T04:09:52.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2139" PostTypeId="2" ParentId="2097" CreationDate="2018-05-24T04:22:48.923" Score="4" Body="&lt;p&gt;According to Matthias Christandl (who did some research on this to resolve a bet with Artur Ekert), while the term &quot;entanglement&quot; was first used in 1935, as already relayed in other answers, the &lt;em&gt;concept&lt;/em&gt; was discussed by Schrodinger in 1932. This &lt;a href=&quot;http://www.math.ku.dk/english/research/gamp/qit/files/entangled.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;set of slides&lt;/a&gt; (slides 3-8 in particular) from a talk reproduce part of a document that details this. The full image is also on the front of his &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0604183&quot; rel=&quot;nofollow noreferrer&quot;&gt;thesis&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-24T04:22:48.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2140" PostTypeId="1" AcceptedAnswerId="2141" CreationDate="2018-05-24T07:57:15.943" Score="5" ViewCount="174" Body="&lt;p&gt;In this &lt;a href=&quot;http://faculty.cs.tamu.edu/klappi/csce640-f14/simon2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;pdf&lt;/a&gt; for the Simon's algorithm we need &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; independent &lt;span class=&quot;math-container&quot;&gt;$\mathbf y$&lt;/span&gt; such that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathbf y \cdot \mathbf s=0$$&lt;/span&gt;&#xA;to find &lt;span class=&quot;math-container&quot;&gt;$\mathbf s$&lt;/span&gt;. On page 6 of the pdf the author writes that the probability of getting &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; independent values of &lt;span class=&quot;math-container&quot;&gt;$\mathbf y$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; attempts is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{\text{ind}}=(1-1/N(\mathbf s))(1-2/N(\mathbf s))\cdots (1-2^{n-1}/N(\mathbf s))\tag{1}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N(\mathbf s)=2^{n-1}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\mathbf s \ne 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\mathbf s=0$&lt;/span&gt;. Clearly then &lt;span class=&quot;math-container&quot;&gt;$P_{\text{ind}}=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\mathbf{s}\ne 0$&lt;/span&gt; - which I believe to be wrong.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, therefore: Is formula (1) wrong and if so what is the correct version. If it is not wrong how do we interpret &#xA;&lt;span class=&quot;math-container&quot;&gt;$P_{\text{ind}}=0$&lt;/span&gt; .&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="26" LastEditDate="2019-10-24T13:23:12.493" LastActivityDate="2019-10-24T13:23:12.493" Title="Simon's Algorithm Probability of Independence" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2141" PostTypeId="2" ParentId="2140" CreationDate="2018-05-24T08:26:57.930" Score="4" Body="&lt;p&gt;At first glance, the formula looks lightly wrong: the last term in the should only be $(1-2^{n-2}/N(s))$, giving&#xA;$$&#xA;P_{ind}=\prod_{k=1}^{n-1}\left(1-\frac{2^{k-1}}{N(s)}\right)&#xA;$$&#xA;overall. Thus every term is a half, or larger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My reasoning is as follows: you perform a measurement and get a random outcome. The first time you do this, it can be any outcome except the all 0 string. This happens with probability $1-1/N(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second time, you want any string except the all zeros, or the answer you got last time, $y_1$. Thus, the term $1-2/N(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third time, you want any string except the all zeros, $y_1$, $y_2$ or $y_1\oplus y_2$. Thus, the term $1-4/N(s)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have $k-1$ linearly independent strings $y_1$ to $y_{k-1}$ and you're trying top find the $k^{th}$, there are $2^{k-1}$ answers you don't want to get: the $2^{k-1}$ answers that are linearly dependent on the strings you already have (note that this counting includes the all zeros string). You keep going until the last term, $k=n-1$ because you're trying to find $n-1$ linearly independent cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, this is not the way that I would ever make the argument. Who cares about the probability of needing &lt;em&gt;exactly&lt;/em&gt; $n-1$ calls? You can just keep repeating as many times as you need to in order to find $n-1$ linearly independent strings. Since we've already argued that the worst-case probability of finding a new linearly independent string is 1/2, this means that, on average, no more than $2(n-1)$ trials would be required (and actually somewhat less, because early on you're far more likely to get a hit). You could also apply a Chernoff bound to prove that the probability of needing significantly more runs than that is vanishingly small. OK, that's essentially where the solution gets to, it just feels a little excessive (to me).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-25T07:00:28.307" LastActivityDate="2018-05-25T07:00:28.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2142" PostTypeId="2" ParentId="1356" CreationDate="2018-05-24T15:37:21.293" Score="6" Body="&lt;h2&gt;Classical Version&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Think about a simple strategy of classical error correction. You've got a single bit that you want to encode,&#xA;$$&#xA;0\mapsto 00000\qquad 1\mapsto 11111&#xA;$$&#xA;I've chosen to encode it into 5 bits, but any odd number would do (the more the better). Now, let's assume some bit-flip errors have occurred, so what we have is&#xA;$$&#xA;01010.&#xA;$$&#xA;Was this originally the encoded 0 or 1? If we assume that the probability of error per bit, $p$, is less than a half, then we expect that fewer than half the bits have errors. So, we look at the number of 0s and the number of 1s. Whichever there's more of is the one that we assume is the one we started with. This is called a majority vote. There's some probability that we're wrong, but the more bits we encoded into, the smaller this probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if we know that $p&amp;gt;\frac12$, we can still do the correction. You'd just be implementing a minority vote! The point, however, is that you have to do completely the opposite operation. There's a sharp threshold here that shows, at the very least, that you need to know which regime you're working in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For fault-tolerance, things get messier: the $01010$ string that you got might not be what the state &lt;em&gt;actually&lt;/em&gt; is. It might be something different, still with some errors that you have to correct, but the measurements you've made in reading the bits are also slightly faulty. Crudely, you might imagine this turns the sharp transition into an ambiguous region where you don't really know what to do. Still, if error probabilities are low enough, or high enough, you can correct, you just need to know which is the case.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Quantum Version&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In general, things get worse in the quantum regime because you have to deal with two types of errors: bit flip errors ($X$) and phase flip errors ($Z$), and that tends to make the ambiguous region bigger. I won't go further into details here. However, there's a cute argument in the quantum regime that may be illuminating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine you have the state of a single logical qubit stored in a quantum error correcting code $|\psi\rangle$ across $N$ physical qubits. It doesn't matter what that code is, this is a completely general argument. Now imagine there's so much noise that it destroys the quantum state on $\lceil N/2\rceil$ qubits (&quot;so much noise&quot; actually means that errors happen with 50:50 probability, not close to 100% which, as we've already said, can be corrected). It is impossible to correct for that error. How do I know that? Imagine I had a completely noiseless version, and I keep $\lfloor N/2\rfloor$ qubits and give the remaining qubits to you. We each introduce enough blank qubits so that we've got $N$ qubits in total, and we run error correction on them.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7BYZL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7BYZL.png&quot; alt=&quot;cloning demonstration&quot;&gt;&lt;/a&gt;&#xA;If it were possible to perform that error correction, the outcome would be that both of us would have the original state $|\psi\rangle$. We would have cloned the logical qubit! But cloning is impossible, so the error correction must have been impossible.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-26T04:26:46.040" LastActivityDate="2018-05-26T04:26:46.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2143" PostTypeId="1" AcceptedAnswerId="2144" CreationDate="2018-05-25T10:42:39.130" Score="11" ViewCount="2125" Body="&lt;p&gt;I want to be able to applied controlled versions of the $R_y$ gate (rotation around the Y axis) for real devices on the IBM Q Experience. Can this be done? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-12-23T13:51:52.120" LastActivityDate="2018-12-23T13:51:52.120" Title="How can a controlled-Ry be made from CNOTs and rotations?" Tags="&lt;gate-synthesis&gt;&lt;ibm-q-experience&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2144" PostTypeId="2" ParentId="2143" CreationDate="2018-05-25T10:42:39.130" Score="6" Body="&lt;p&gt;You can make controlled $R_y$ gates from cnots and $R_y$ rotations, so they can be  be done on any pair of qubits that allows a cnot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two examples of controlled-Ys are shown in the image below. They are on the same circuit, one after the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/byHKu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/byHKu.png&quot; alt=&quot;Two versions of a controlled-Y&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first has qubit 1 as control and qubit 0 as target, which is easy because the cnots can be directly implemented in the right direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second example, qubit 0 is control and qubit 1 is target. This is achieved by using four H gates for each cnot to effectively turn it around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This second example can also be optimized further. There are two adjacent H gates on the top line that can be canceled. And since H anticommutes with Y, $H\,u3(\theta,0,0)\,H$ can always be replaced with $u3(-\theta,0,0)$. (Thanks to @DaftWullie for pointing these out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aD4eB.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aD4eB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The single qubit gates used are $u3(\theta,0,0)$, which are $R_y(\theta)$ rotations. The angles used are pi/2 and -pi/2 in this case. These cancel when the control is $|0\rangle$. This gives the expected effect of the controlled-Y acting trivially in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the control is $|1\rangle$, the cnots perform an X either side of the $u3(-\pi/2,0,0)$, which has the effect &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$X \, u3(\theta,0,0) \, X = u3(-\theta,0,0)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that the $u3(-\pi/2,0,0)$ flips to $u3(\pi/2,0,0)$. The end effect on the control is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ u3(\pi/2,0,0) \, u3(\pi/2,0,0) \, = u\, 3(\pi,0,0) \, = \, Y$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a $Y$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more general controlled $R_y$ rotation means that you want to do a fraction of a $Y$. So just reduce both angles by the corresponding fraction.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-05-25T11:40:54.707" LastActivityDate="2018-05-25T11:40:54.707" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2145" PostTypeId="1" AcceptedAnswerId="2146" CreationDate="2018-05-25T14:20:59.853" Score="10" ViewCount="534" Body="&lt;p&gt;I am a bit confused about the necessity of an oracle qubit in Grover's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, does it depend on how you implement your oracle whether you need an oracle qubit or not? Or, it there any reason for an oracle qubit? (such as, there exist some problems that cannot be solved without an oracle qubit, or it's easier to think about the problem with an oracle qubit, or it's a convention, etc)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many resources introduce Grover's algorithm with an oracle qubit, but I found there are some cases that you do not need an oracle qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here are two implementations of Grover's algorithm in IBM Q simulator. One is using an oracle qubit, and the other is not. In both cases, I would like to find |11&gt; from a space of |00&gt;, |01&gt;, |10&gt;, and |11&gt;. In both cases, oracle successfully flips |11&gt; to -|11&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;・With an oracle qubit (&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/share/code/5b0814cf77cc86003feebfcb/execution/5b0814d09568dc003aedae8c&quot; rel=&quot;noreferrer&quot;&gt;Link to IBM Q simulator&lt;/a&gt;)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LpbFo.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LpbFo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;・Without an oracle qubit (&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/share/code/5b06c997835cd50036457e16/execution/5b06c997835cd50036457e17&quot; rel=&quot;noreferrer&quot;&gt;Link to IBM Q simulator&lt;/a&gt;)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wm8jy.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wm8jy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="55" LastEditDate="2019-03-28T19:43:55.193" LastActivityDate="2019-03-28T19:43:55.193" Title="Why is an oracle qubit necessary in Grover's algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2146" PostTypeId="2" ParentId="2145" CreationDate="2018-05-25T14:46:03.420" Score="5" Body="&lt;p&gt;From the perspective of defining the quantum circuit, the oracle qubit is not strictly necessary. For example, in Grover's search, you might normally define the action of the oracle as&#xA;$$&#xA;U|x\rangle|y\rangle=|x\rangle|y\oplus f(x)\rangle,&#xA;$$&#xA;where $f(x)$ returns 1 if $x$ is the marked item. However, we always use this in a particular way, inputting $(|0\rangle-|1\rangle)/\sqrt{2}$ on the oracle qubit. This has the net effect of just implementing a phase on the marked item. In other words, it is entirely equivalent to the implementation of a new unitary&#xA;$$&#xA;\tilde U|x\rangle=(-1)^{f(x)}|x\rangle&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, where it makes a difference is the practical reality. Searching for an item, we will actually need some sort of circuit that recognises the marked item, based on the input of $x$. At that point, it's far easier to think about outputting the answer onto the oracle bit, rather than somehow directly building the unitary that gives the phase without using the oracle qubit. Indeed, I suspect if I asked you to design a generic version $\tilde U$, you'd come up with $U$ with the extra qubit as the solution.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-25T14:46:03.420" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2147" PostTypeId="1" AcceptedAnswerId="2148" CreationDate="2018-05-25T17:48:26.070" Score="10" ViewCount="267" Body="&lt;p&gt;Suppose I have a classical-classical-quantum channel &lt;span class=&quot;math-container&quot;&gt;$W : \mathcal{X}\times\mathcal{Y} \rightarrow \mathcal{D}(\mathcal{H})$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X},\mathcal{Y}$&lt;/span&gt; are finite sets and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}(\mathcal{H})$&lt;/span&gt; is the set of density matrices on finite dimensional, complex Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$p_x$&lt;/span&gt; is the uniform distribution on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_y$&lt;/span&gt; is the uniform distribution on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;. Further, define for distributions &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;, the Holevo information &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\chi(p_1, p_2,  W) := H\left(\sum_{x,y}p_1(x)p_2(y)W(x,y)\right) - \sum_{x,y}p_1(x)p_2(y)H(W(x,y))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the von Neumann entropy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to show, for&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ p_1 := \sup_{p}\left\{ \chi(p, p_y, W)\right\}, p_2 := \sup_{p}\left\{ \chi(p_x, p, W)\right\}$$&lt;/span&gt;&#xA;that,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\chi(p_1, p_2, W) \geq \chi(p_1, p_y, W) \text{ and } \chi(p_1, p_2, W)\geq \chi(p_x, p_2, W).$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I'm not yet convinced that the statement is true in the first place. I haven't made much progress in proving this, but it seems like some sort of triangle inequality could verify the claim.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any suggestions regarding if the statement should hold and tips on how to prove it.&lt;/p&gt;&#xA;" OwnerUserId="509" LastEditorUserId="55" LastEditDate="2021-02-20T16:25:39.407" LastActivityDate="2021-02-20T16:25:39.407" Title="Proof of an Holevo information inequality" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2148" PostTypeId="2" ParentId="2147" CreationDate="2018-05-25T19:00:11.627" Score="11" Body="&lt;p&gt;It appears that the statement is not true in general. Suppose $X = Y = \{0,1\}$, $\mathcal{H}$ is the Hilbert space corresponding to a single qubit, and $W$ is defined as&#xA;\begin{align}&#xA;W(0,0) &amp;amp; = | 0 \rangle \langle 0 |,\\&#xA;W(0,1) &amp;amp; = | 1 \rangle \langle 1 |,\\&#xA;W(1,0) &amp;amp; = | 1 \rangle \langle 1 |,\\&#xA;W(1,1) &amp;amp; = \frac{1}{2} | 0 \rangle \langle 0 | + \frac{1}{2} | 1 \rangle \langle 1 |.&#xA;\end{align}&#xA;If $p_y$ is the uniform distribution, the optimal choice for $p_1$ is $p_1(0) = 1$ and $p_1(1) = 0$, which gives $\chi(p_1,p_y,W) = 1$, which is the maximum possible value. (I assume you mean to define $p_1$ and $p_2$ as the argmax of those expressions, not the supremum.) Likewise, if $p_x$ is uniform, $p_2(0) = 1$ and $p_2(1) = 0$ is optimal, and the value is the same. However, $\chi(p_1,p_2,W) = 0$, so the inequality does not hold.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-05-25T19:00:11.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2149" PostTypeId="1" CreationDate="2018-05-25T20:59:54.013" Score="10" ViewCount="579" Body="&lt;p&gt;I am confused about what to input to Oracle in Grover's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't we need to input what we are looking for and where to find what we are looking for to Oracle, in addition to the superpositioned quantum states? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, assume we have a list of people's names {&quot;Alice&quot;, &quot;Bob&quot;, &quot;Corey&quot;, &quot;Dio&quot;}, and we want to find if &quot;Dio&quot; is on the list. Then, Oracle should take $1/2(|00\rangle + |01\rangle + |10\rangle + |11\rangle)$ as an input and output $1/2(|00\rangle + |01\rangle + |10\rangle - |11\rangle)$. I kind of understand that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But don't we also need to input the word &quot;Dio&quot; and the list {&quot;Alice&quot;, &quot;Bob&quot;, &quot;Corey&quot;, &quot;Dio&quot;} to Oracle? Otherwise, how can Oracle return output? Is it not explicitly mentioned since Oracle is a black box and we do not have to think about how to implement it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding about Oracle is,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Oracle has the ability to recognize if the word &quot;Dio&quot; is in the list.&lt;/li&gt;&#xA;&lt;li&gt;To do so, Oracle takes the superpositioned quantum states as an input, where each quantum state represents the index of the list.&lt;/li&gt;&#xA;&lt;li&gt;So, input $|00\rangle$ to Oracle means, check if the word &quot;Dio&quot; is in the index 0 of the list and return $-|00\rangle$ if yes and return $|00\rangle$ otherwise.&lt;/li&gt;&#xA;&lt;li&gt;In our case, Oracle returns $1/2(|00\rangle + |01\rangle + |10\rangle - |11\rangle)$.&lt;/li&gt;&#xA;&lt;li&gt;But what about the list and the word?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="55" LastEditDate="2019-08-16T18:57:24.673" LastActivityDate="2021-02-09T19:19:34.353" Title="Grover's algorithm: what to input to Oracle?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2150" PostTypeId="2" ParentId="2149" CreationDate="2018-05-25T22:42:52.350" Score="5" Body="&lt;p&gt;Although popular explanations of Grover's algorithm talk about searching over a list, in actuality you use it to search over possible inputs 0..N-1 to a function. The cost of the algorithm is $O(\sqrt{N} \cdot F)$ where $N$ is the number of inputs you want to search over and $F$ is the cost of evaluating the function. If you want that function to search over a list, you must hardcode the list into the function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hard coding the function to use a list of $N$ items is usually a very bad idea, because it tends to cause $F$ to equal $O(N)$. Which would make the total cost of Grover's algorithm $O(\sqrt{N} \cdot F) = O(\sqrt{N} \cdot N) = O(N^{1.5})$. Which sort of defeats the whole purpose, since $N^{1.5} &amp;gt; N$.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-05-25T22:42:52.350" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2151" PostTypeId="1" AcceptedAnswerId="2152" CreationDate="2018-05-26T23:24:51.823" Score="30" ViewCount="3129" Body="&lt;p&gt;In the past few days, I have been trying to collect material (mostly research papers) related to Quantum machine learning and its applications, for a summer project. Here are a few which I found interesting (from a superficial reading):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1712.05771&quot; rel=&quot;noreferrer&quot;&gt;Unsupervised Machine Learning on a Hybrid Quantum Computer (J.S. Otterbach et al., 2017)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithms for supervised and unsupervised machine learning (Lloyd, Mohseni &amp;amp; Rebentrost, 2013)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1709.08725&quot; rel=&quot;noreferrer&quot;&gt;A Machine Learning Framework to Forecast Wave Conditions (James, Zhang &amp;amp; O'Donncha 2017)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1711.11240&quot; rel=&quot;noreferrer&quot;&gt;Quantum Neuron: an elementary building block for machine learning on quantum computers (Cao, Guerreschi &amp;amp; Aspuru-Guzik, 2017)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1710.07405&quot; rel=&quot;noreferrer&quot;&gt;Quantum machine learning for quantum anomaly detection (Liu &amp;amp; Rebentrost, 2017)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, coming from the more &lt;em&gt;physics-y&lt;/em&gt; end of the spectrum, I don't have much &#xA;background knowledge in this area and am finding most of the specialized materials impenetrable. &lt;strong&gt;Ciliberto et al.&lt;/strong&gt;'s paper: &lt;a href=&quot;https://arxiv.org/abs/1707.08561&quot; rel=&quot;noreferrer&quot;&gt;Quantum machine learning: a classical perspective&lt;/a&gt; somewhat helped me to grasp some of the basic concepts. I'm looking for similar but &lt;strong&gt;more elaborate&lt;/strong&gt; introductory material. It would be very helpful if you could recommend textbooks, video lectures, etc. which provide a good introduction to the field of quantum machine learning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information_(book)&quot; rel=&quot;noreferrer&quot;&gt;Nielsen and Chuang's textbook&lt;/a&gt; is a great introduction to the quantum computing and quantum algorithms in general and goes quite far in terms of introductory material (although it begins at a very basic level and covers all the necessary portions of quantum mechanics and linear algebra and even the basics of computational complexity!). Is there anything similar for quantum machine learning? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S:&lt;/strong&gt; I do realize that quantum machine learning is a vast area. In case there is any confusion, I would like to point out that I'm mainly looking for textbooks/introductory papers/lectures which cover the details of the quantum analogues of classical machine learning algorithms.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-09-01T22:27:47.383" LastActivityDate="2020-09-01T22:27:47.383" Title="Introductory material for quantum machine learning" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="34" ContentLicense="CC BY-SA 4.0" />
  <row Id="2152" PostTypeId="2" ParentId="2151" CreationDate="2018-05-26T23:48:47.040" Score="21" Body="&lt;p&gt;The Nielsen and Chuang of Quantum Machine Learning is this extensive review called &quot;&lt;a href=&quot;https://www.nature.com/articles/nature23474&quot; rel=&quot;noreferrer&quot;&gt;Quantum Machine Learning&lt;/a&gt;&quot; published in Nature in 2017. The arXiv version is &lt;a href=&quot;https://arxiv.org/abs/1611.09347&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and has been updated as recently as 10 May 2018.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="1847" LastEditDate="2018-05-27T05:32:32.433" LastActivityDate="2018-05-27T05:32:32.433" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2154" PostTypeId="1" CreationDate="2018-05-27T05:18:24.697" Score="7" ViewCount="114" Body="&lt;p&gt;Could anyone point to some references examining Bell inequality violations at large distances please?&lt;/p&gt;&#xA;&lt;p&gt;I see many times, in pop science articles and research literature alike, that the quantum information of the entangled state is transmitted instantaneously to all components of the state. Strictly speaking, we must say that this is a theoretical prediction and provide an lower bound on the speed of information transfer from an experiment, right?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="55" LastEditDate="2021-02-22T15:59:20.750" LastActivityDate="2021-02-22T15:59:20.750" Title="References examining Bell inequality violations at large distances" Tags="&lt;entanglement&gt;&lt;bell-experiment&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2155" PostTypeId="1" CreationDate="2018-05-27T05:41:03.770" Score="7" ViewCount="399" Body="&lt;p&gt;If I have the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate acting on a qubit and the &lt;span class=&quot;math-container&quot;&gt;$\lambda_6$&lt;/span&gt; gate acting on a qutrit, where &lt;span class=&quot;math-container&quot;&gt;$\lambda_6$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Gell-Mann_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gell-Mann matrix&lt;/a&gt;, the system is subjected to the Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda_6X=&#xA;\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In case anyone doubts this matrix, it can be generated with the following script (MATLAB/octave):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;lambda6=[0 0 0; 0 0 1; 0 1 0];&#xA;X=      [0 1; 1 0 ];&#xA;kron(lambda6,X)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However consider the alternative Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{2}Z\lambda_1 + \frac{1}{2}\lambda_1 - \frac{1}{\sqrt{3}}X\lambda_8+\frac{1}{3}X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;This is the exact same Hamiltonian!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The following script proves it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;lambda1=[0 1 0;1 0 0;0 0 0];&#xA;lambda8=[1 0 0;0 1 0;0 0 -2]/sqrt(3);&#xA;Z=      [1 0; 0 -1 ];&#xA;round(-0.5*kron(Z,lambda1)+0.5*kron(eye(2),lambda1)-(1/sqrt(3))*kron(X,lambda8)+(1/3)*kron(X,eye(3)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &amp;quot;round&amp;quot; in the last line of code can be removed, but the format will be uglier because some of the 0's end up being around &lt;span class=&quot;math-container&quot;&gt;$10^{-16}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I thought the Pauli decomposition for two qubits is unique, why would the Pauli-GellMann decomposition of a qubit-qutrit be non-unique, and how would the decomposition &lt;span class=&quot;math-container&quot;&gt;$\lambda_6X$&lt;/span&gt; from the above 6x6 matrix be obtained?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-04-01T22:34:49.873" LastActivityDate="2021-04-01T22:34:49.873" Title="Why is the decomposition of a qubit-qutrit Hamiltonian in terms of Pauli and Gell-Mann matrices not unique?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;qutrit&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2156" PostTypeId="1" CreationDate="2018-05-27T06:20:31.160" Score="5" ViewCount="45" Body="&lt;p&gt;Far from my expertise, but sheer curiosity. I've read that &lt;a href=&quot;https://en.wikipedia.org/wiki/PostBQP&quot; rel=&quot;noreferrer&quot;&gt;PostBQP&lt;/a&gt; (&quot;&lt;em&gt;a complexity class consisting of all of the computational problems solvable in polynomial time on a quantum Turing machine &lt;strong&gt;with postselection&lt;/strong&gt; and bounded error&lt;/em&gt;&quot;) is very powerful.  Still, I don't understand the practical sense of assuming you can &lt;em&gt;decide&lt;/em&gt; the value an output qubit takes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question: Have post-selection quantum computing experiments been implemented (or is it possible that they will be implemented)? &#xA;(And, if the answer is yes: how does post-selection take place in a way that practically enhances your computing power?)&lt;/p&gt;&#xA;" OwnerUserId="1847" LastActivityDate="2018-05-27T06:20:31.160" Title="Is PostBQP experimentally relevant?" Tags="&lt;experiment&gt;&lt;complexity-theory&gt;&lt;postbqp&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2018-05-27T08:57:25.093" ContentLicense="CC BY-SA 4.0" />
  <row Id="2157" PostTypeId="2" ParentId="2155" CreationDate="2018-05-27T09:00:13.540" Score="4" Body="&lt;p&gt;This looks essentially similar to the property of non-commutativity of the Kronecker product: $X\otimes \lambda_6\neq \lambda_6\otimes X$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$X\otimes\lambda_6 = \begin{pmatrix}0&amp;amp;1 \\1&amp;amp;0\end{pmatrix}\otimes \begin{pmatrix}0&amp;amp;0&amp;amp;0 \\0&amp;amp;0&amp;amp;1 \\0&amp;amp;1&amp;amp;0\end{pmatrix} = &#xA;\begin{pmatrix}0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&#xA;\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unsurprisingly, you can't decompose $-\frac{1}{2}Z\lambda_1 + \frac{1}{2}I_2\lambda_1 - \frac{1}{\sqrt{3}}X\lambda_8+\frac{1}{3}XI_3 = \lambda_6X$ into $X\lambda_6$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as both matrices are square, they are 'permutation similar', so that $X\otimes \lambda_6=P^T\left(\lambda_6\otimes X\right)P$ for some &lt;a href=&quot;https://en.wikipedia.org/wiki/Permutation_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;permutation matrix&lt;/a&gt; $P$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, to answer part 1, for a given permutation/ordering, the decomposition is unique, but when the ordering is changed, the matrix/Hamiltonian undergoes a rotation $\left(P^T = P^{-1}\right)$, which also changes the decomposition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It becomes clear what can be used to decompose a matrix of this form by splitting it into sub-matrices: by writing $$X\lambda_6 = \begin{pmatrix}A&amp;amp;B\\C&amp;amp;D\end{pmatrix},$$ where each sub-matrix $A, B, C$ and $D$ is a $3\times 3$ matrix, it becomes clear that $A=D=0$ and $B=C=\lambda_6$, which verifies $$X\lambda_6 = \begin{pmatrix}0&amp;amp;\lambda_6\\\lambda_6&amp;amp;0\end{pmatrix} = X\otimes \lambda_6$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing the rotation/permuting and applying the same idea gives $$M=\begin{pmatrix}0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&#xA;\end{pmatrix} = \begin{pmatrix}A&amp;amp;B\\C&amp;amp;D\end{pmatrix},$$ which gives that $$A=0,\quad B=C=\begin{pmatrix}0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix},\quad D=\begin{pmatrix}0&amp;amp;1&amp;amp;0\\1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix}=\lambda_1$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It follows that $B=C=\frac{1}{3}I_3-\frac{1}{\sqrt{3}}\lambda_8$, giving $$M=\begin{pmatrix}0&amp;amp;\frac{1}{3}I_3-\frac{1}{\sqrt{3}}\lambda_8\\\frac{1}{3}I_3-\frac{1}{\sqrt{3}}\lambda_8&amp;amp;\lambda_1\end{pmatrix}=\frac{1}{2}\left(I-Z\right)\otimes\lambda_1 + X\otimes\left(\frac{1}{3}I_3-\frac{1}{\sqrt{3}}\lambda_8\right).$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the order of the decomposition: $$M=\begin{pmatrix}A&amp;amp;&amp;amp;B&amp;amp;&amp;amp;C\\D&amp;amp;&amp;amp;E&amp;amp;&amp;amp;F\\G&amp;amp;&amp;amp;H&amp;amp;&amp;amp;J\end{pmatrix},$$ which gives $A=B=C=D=E=G=J=0$ and $F=H=X$, in turn giving $$M=\begin{pmatrix}0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;X\\0&amp;amp;&amp;amp;X&amp;amp;&amp;amp;0\end{pmatrix}=\lambda_6\otimes X$$&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-05-28T23:16:08.140" LastActivityDate="2018-05-28T23:16:08.140" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2158" PostTypeId="2" ParentId="2154" CreationDate="2018-05-27T11:11:35.373" Score="3" Body="&lt;p&gt;The largest scale Bell test done thus far is the &quot;&lt;a href=&quot;https://physics.aps.org/synopsis-for/10.1103/PhysRevLett.118.060401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cosmic Bell Test&lt;/a&gt;&quot; of 2017. It ruled out hidden variables within a distance of 600 light years from Earth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 16 significant Bell test experiments performed between 1972 and 2018 are listed &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_test_experiments#Notable_experiments&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; with references to the original papers.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-27T11:11:35.373" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2159" PostTypeId="1" AcceptedAnswerId="2160" CreationDate="2018-05-27T11:21:23.923" Score="7" ViewCount="183" Body="&lt;p&gt;The Pauli group, $P_n$, is given by&#xA;$$P_n=\{ \pm 1, \pm i\}\otimes \{ I,\sigma_x,\sigma_y,\sigma_z\}^{\otimes n}$$&#xA;Abelian subgroups of this which do not contain the element $(-1)*I$ correspond to a stabilizer group. If there are $r$ generators of one such subgroup, $\mathcal{G}$, then the $+1$ eigenstate has $2^{n-r}$ basis elements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then leads to the natural question of whether we have that $r\le n$ and how can it be proved (either way)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess a (valid?) proof would be along the lines of that if $r \gt n$ we would have a bias of fractional dimension - this is not allowed so $r\lt n$. But if one exists I would prefer a proof considering only the group properties and not the space which it acts on.&lt;/p&gt;&#xA;" OwnerUserId="2015" LastActivityDate="2018-05-27T14:25:41.233" Title="Maximum number of Stabilizer Generators?" Tags="&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2160" PostTypeId="2" ParentId="2159" CreationDate="2018-05-27T14:25:41.233" Score="3" Body="&lt;p&gt;Consider a subgroup $G $ of the Pauli group with at least one operator that acts non-trivially on some qubit.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Given any qubit $j $, for which the group contains an operator $S_j $ which acts on $j $ non-trivially, there is a Clifford group operator $C_j $ such that $C_j S_j C_j^\dagger =Z_j $, acting on qubit $j $ alone. (Why?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If $G_j = \{ C_j S C_j^\dagger \,\vert\, S \in G \}$ and $G $ is abelian, then $G_j = \langle Z_j \rangle \oplus G'_j$, where $G'_j $ does not act on qubit $j $. (Why?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;By induction, we can transform any abelian subgroup on $n $ qubits to a group with at most $n+1$ generators, where up to $n $ of them act on a single qubit with a $Z $ operator. (And what then would the remaining one be?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From this, we can prove that a stabiliser group on $n $ qubits has at most $n $ generators; and with only a little more work, we can show that a stabiliser group with $r $ generators stabilises a subspace of dimension $2^{n-r} $.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-05-27T14:25:41.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2161" PostTypeId="1" AcceptedAnswerId="2183" CreationDate="2018-05-27T14:57:49.413" Score="12" ViewCount="669" Body="&lt;p&gt;According to &lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;noreferrer&quot;&gt;An introduction to quantum machine learning (Schuld, Sinayskiy &amp;amp; Petruccione, 2014)&lt;/a&gt;, Seth Lloyd et al. say in their paper: &lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithms for supervised and unsupervised machine learning&lt;/a&gt; that classical information can be encoded into the norm of a quantum state $\langle x|x \rangle = |\vec{x}|^{-1}\vec{x}$. I'm not sure I understand their notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a simple example. Say I want to store this array: $V = \{3,2,1,2,3,3,5,4\}$ of size $2^{3}$ in the state of an $3$-qubit quantum  system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can represent the state of an $3$-qubit system as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = a_1|000\rangle + a_2|001\rangle + a_3|010\rangle + a_4|011\rangle + a_5|100\rangle + a_6|101\rangle + a_7|110\rangle + a_8|111\rangle$ (using standard basis) where $a_i\in \Bbb C \ \forall \ 1 \leq i\leq 8$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could represent $V$ as a vector $\vec{V} = 3 \hat{x}_1 + 2 \hat{x}_2 +... + 4 \hat{x}_8$ where $\{\hat{x}_1,\hat{x}_2,...,\hat{x}_8\}$ forms an orthonormal basis in $\Bbb R^{8}$, and write the standard Euclidean norm for it as $|\vec{V}|=\sqrt{3^2+2^2+...+4^2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this, I'm confused as to how I'd get the coefficients $a_1,a_2,..,a_8$. Should I just assign $3$ to $a_1$, $2$ to $a_2$ and so on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;But, then again&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider the vector $N=2^{n}$ dimensional complex vector $\vec{v}$&#xA;  with components $\{v_i=|v_i|e^{i\phi_i}\}$. Assume that&#xA;  $\{|v_i|,\phi_i\}$ are stored as floating point numbers in quantum&#xA;  random access memory. Constructing the $\log_2 N$ qubit quantum state&#xA;  $|v\rangle = |\vec{v}|^{-1/2}\vec{v}$ then takes $\mathcal{O}(\log_2&#xA; N)$ steps as long as the sub-norms are also given in the qRAM in which&#xA;  case any state can be constructed in $\mathcal{O}(\log N)$ steps.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Firstly&lt;/strong&gt;, I don't understand their notion of a $2^n$ dimensional &lt;em&gt;complex&lt;/em&gt; vector. If each of the components of their classical data array has two floating point numbers, wouldn't encoding that into a $n$-qubit quantum state be equivalent to storing a $2\times 2^{n}$ size classical array in a $n$-qubit system? Yes, I do know that $a_1,a_2,..,a_{2^n}$ are complex numbers having both magnitude and direction, and hence can store $2\times 2^{n}$ amount of classical information. But they don't mention anywhere how they will convert classical data (say in form of a $2\times 2^{n}$ array) into that form. Moreover, there seems to be a restriction that phase of a complex number $a_i$ can only range from $-\pi$ to $+\pi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Secondly&lt;/strong&gt;, let us assume that the initial data array we wanted to store in our quantum system was actually $V=\{\{3,\phi_1\},\{2,\phi_2\},...,\{4,\phi_8\}\}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they define $|v\rangle$ as $|\vec{v}|^{-1/2}\vec{v}$ then $|V\rangle$ in our example would look something like $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(|3e^{i\phi_1}||000\rangle + |2e^{i\phi_2}||001\rangle + ... + |4e^{i\phi_8}||111\rangle)$. But then we're losing all the information about the phases $\phi_i$, isn't it? So what was the use of starting with a &lt;em&gt;complex&lt;/em&gt; vector (having both a phase and magnitude) in the first place, when we're losing that information when converting to $|V\rangle$ anyway? Or are we writing supposed to consider $|V\rangle$ as $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(3e^{i\phi_1}|000\rangle + 2e^{i\phi_2}|001\rangle + ... + 4e^{i\phi_8}|111\rangle)$?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be really helpful if someone could explain where I am going wrong using some concrete examples regarding storage of classical data in an $n$-qubit system. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-02-20T16:25:10.603" LastActivityDate="2021-02-20T16:25:10.603" Title="Embedding classical information into norm of a quantum state" Tags="&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2162" PostTypeId="5" CreationDate="2018-05-27T15:20:26.307" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-27T15:20:26.307" LastActivityDate="2018-05-27T15:20:26.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2163" PostTypeId="4" CreationDate="2018-05-27T15:20:26.307" Score="0" Body="Use this tag for questions about the computational complexity class PostBQP (bounded-error quantum polynomial time with postselection). The PostBQP class encompasses computational problems which can be solved in polynomial time in a (bounded error) quantum Turing machine with the ability to condition on postselection. &quot;Bounded error&quot; implies that the algorithm is correct at least 2/3 of the time on all inputs." OwnerUserId="26" LastEditorUserId="23" LastEditDate="2018-05-27T16:26:14.907" LastActivityDate="2018-05-27T16:26:14.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2164" PostTypeId="5" CreationDate="2018-05-27T15:25:33.230" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-05-27T15:25:33.230" LastActivityDate="2018-05-27T15:25:33.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2165" PostTypeId="4" CreationDate="2018-05-27T15:25:33.230" Score="0" Body="Use this tag for questions related to the representation of classical data in quantum systems, and application of quantum algorithms and other quantum computing techniques aimed at improving or providing alternatives to classical data science in general. Do not use this tag for classical data science questions. Those belong to Data Science SE or Stack Overflow." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-27T16:29:16.967" LastActivityDate="2018-05-27T16:29:16.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2166" PostTypeId="1" AcceptedAnswerId="2219" CreationDate="2018-05-27T15:35:53.370" Score="12" ViewCount="1092" Body="&lt;p&gt;I am getting confused about Grover's algorithm and it's connection to complexity classes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Grover's algorithm finds and element $k$ in a database of $N=2^n$ (such that $f(k)=1$) of elements with $$\sim \sqrt{N}=2^{n/2}$$&#xA;calls to the oracle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have the following problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Problem: Find a $k$ in the database such that $f(k)=1$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now I am aware that this is not a desision problem and thus our normal definitions of complexity class $\text{P}$, $\text{NP}$ etc don't really apply. But I am curious to know how we would define the complexity class in such a case - and weather it is done with respect to $N$ or $n$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore the Grover's algorithm can be used as a subroutine. I have read in several places that the Grover's algorithm does not change the complexity class a problem - is there a heuristic way to see this.&lt;/p&gt;&#xA;" OwnerUserId="2015" LastEditorUserId="1837" LastEditDate="2018-05-28T14:07:45.670" LastActivityDate="2018-06-02T06:07:11.803" Title="Grover's Algorithm and its relation to complexity classes?" Tags="&lt;complexity-theory&gt;&lt;grovers-algorithm&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2167" PostTypeId="2" ParentId="2166" CreationDate="2018-05-27T16:20:40.533" Score="-1" Body="&lt;p&gt;Forget about database. Grover's algorithm solves &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_satisfiability_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boolean Satisfiability Problem&lt;/a&gt;, namely:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;You have a boolean circuit with $n$ inputs and a single output. The circuit outputs $1$ for a single configuration of input bits, otherwise is outputs $0$. Find the configuration of input bits.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is known to be NP-complete.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2018-05-27T16:20:40.533" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2170" PostTypeId="2" ParentId="2154" CreationDate="2018-05-28T08:25:29.327" Score="5" Body="&lt;p&gt;I think there is a conceptual thing going on here that needs clarifying (I'll leave the experimental links to others). I presume the question is predicated on the idea that, well, measurements are made within a certain time of each other, which is compared to the distance between the places where the measurements are being made. The concern is that this only gives a bound: if information is transmitted, it happens faster than some velocity which we have now bounded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what one ought to do is consider what special relativity tells you: if two events are space-like separated, there is no notion of temporal ordering. Different observers, travelling at different velocities, can see the events happening in different orders (or simultaneously). So, all you need to know is that the measurement events are space-like separated (i.e. the distance between the events is larger than speed of light $\times$ time between events), and that is enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, there's a terminology issue. Bell tests do not talk about the transmission of &lt;em&gt;information&lt;/em&gt;, but the presence of &lt;em&gt;correlation&lt;/em&gt;. The term information would suggest that one party can choose some information to communicate to another party. This cannot happen faster than the speed of light. But the &quot;random decision&quot; made when a measurement is made on an entangled state is somehow resolved everywhere simultaneously, but does not communicate any information.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-28T08:25:29.327" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2171" PostTypeId="2" ParentId="1648" CreationDate="2018-05-28T13:39:58.597" Score="3" Body="&lt;p&gt;There has been a great deal of scientific debate over evidence of quantum effects in biology due to the difficulties of reproducing scientific evidence. Some have found evidence of quantum coherence while others have argued this is not the case. &lt;a href=&quot;https://physicsworld.com/a/is-photosynthesis-quantum-ish/&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Ball, 2018).&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most recent research study (in Nature Chemistry, &lt;a href=&quot;https://www.nature.com/articles/s41557-018-0060-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;May 2018&lt;/a&gt;) found evidence of a specific oscillating signal indicating superpositioning. The scientists found quantum effects that lasted precisely as expected based on theory and proved that these belong to energy superimposed on two molecules simultaneously. This resulted in the conclusion that biological systems exhibit the same quantum effects as non-biological systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These effects have been observed in the Fenna-Matthews-Olsen reaction centre of the bacteria - Chlorobium Tepidum (Borroso-Flores, 2017).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Research evidences the dimensions and time scales of the photosynthetic energy transfer processes puts them close to the quantum/classical border. There are various explanations for this, but they seem to indicate energetically noisy quantum/classical limit is ideal for excitation energy transfer control. &lt;a href=&quot;https://www.cell.com/trends/plant-science/fulltext/S1360-1385(18)30049-9&quot; rel=&quot;nofollow noreferrer&quot;&gt;Keren 2018.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum Biology as Biological Semiconductors&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Such dynamics in biology rely on spin chemistry (radical pairs), and&#xA;  it is has been recognised that “Certain organic semiconductors (OLEDs)&#xA;  exhibit magnetoelectroluminescence or magnetoconductance, the&#xA;  mechanism of which shares essentially identical physics with radical&#xA;  pairs in biology”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt; &lt;a href=&quot;https://phys.org/news/2016-06-radical-pair-analysis-hurdle-theory.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PJ Hore (2016).&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The terms 'spin singlets' and 'triplets' are used in spintronics (in investigating semiconductors) and the term radical pairs (including spin singlets or triplets) are used to discuss spin chemistry in biology. But all the terms are describing the same phenomena (just in different disciplinary realms). Recently there has been interdisciplinary calls for the integration of spin chemistry and spintronics in recognition of this J Matysik (2017).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Biological semiconductors that have already identified by scientists include melanin and peptides, and peptides are now being explored as scaffolds for quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UltriaFast Electron Transfer, and Storing Electronic Spin Information in a Nuclear Spin&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;During photosynthesis, plants use electronic coherence for ultrafast&#xA;  energy and electron transfer and have selected specific vibrations to&#xA;  sustain those coherences. In this way photosynthetic energy transfer&#xA;  and charge separation have achieved their amazing efficiency. At the&#xA;  same time these same interactions are used to photoprotect the system&#xA;  against unwanted byproducts of light harvesting and charge separation&#xA;  at high light intensities&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Rienk van Grondelle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In charge separation in photosynthetic reaction centres, triplet states can react with molecular oxygen generating destructive singlet oxygen. The triplet product yield in bacteria and plants is observed to be reduced by weak magnetic fields.  It has been suggested that this effect is due to solid-state photochemically induced dynamic nuclear polarization (photo-CIDNP), which is an efficient method of creating non-equilibrium polarization of nuclear spins by using chemical reactions, which have radical pairs as intermediates (Adriana Marais 2015).  Within biology such as mechanism could increase resistance to oxidative stress.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been noted there seems to be a link between the conditions of occurrence of photo-CIDNP in reaction centres and the conditions of the unsurpassed efficient light-induced electron transfer in reaction centres. J Matysik 2009, &lt;a href=&quot;https://www.nwo.nl/en/research-and-results/research-projects/i/69/8769.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;I F Cespedes-Camacho and J Matysik 2014.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A CIDNP effect has been observed in the Fenna-Matthews-Olsen reaction centre &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0005272807000035&quot; rel=&quot;nofollow noreferrer&quot;&gt;(Roy et al 2006).&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A CIDNP effect has also been observed in flavin adenine dinucleotide (FAD) (&lt;a href=&quot;https://pubs.acs.org/doi/abs/10.1021/ja00200a021?journalCode=jacsat&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stob 1989)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FAD is implicated in quantum effects theorised in cryptochrome and other biological redox reactions. The widely accept theory is that during response to magnetic fields, the photo-excitation of the non-covalently bound flavin adenine dinucleotide (FAD) cofactor in Cryptochrome leads to the formation of radical pairs via sequential electron transfers along the “tryptophan-triad”, a chain of three conserved tryptophan residues within the protein. This process reduces the photo-excited singlet state of the FAD to the anion radical,&#xA;In the same way that photo-CIDNP MAS NMR has provided detailed insights into photosynthetic electron transport in reaction centres, it is anticipated in a variety of applications in mechanistic studies of other photoactive proteins. It may be possible to characterize the photoinduced electron transfer process in cryptochrome Xiao-Jie (2016).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;'until now, no CIDNP phenomenon has been observed in spintronics ,&#xA;  although the possibility of obtaining such effects has been&#xA;  mentioned “If nuclear spin resonance is found to have an impact on the&#xA;  spin-dependent electron transport due to the hyperfine interaction,&#xA;  ultimately the opposite process may become possible: storing&#xA;  electronic spin information in the nuclear spin.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt; &lt;a href=&quot;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5530719/&quot; rel=&quot;nofollow noreferrer&quot;&gt;J Matysik (2017).&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2498" LastActivityDate="2018-05-28T13:39:58.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2172" PostTypeId="1" CreationDate="2018-05-28T16:16:56.387" Score="6" ViewCount="310" Body="&lt;p&gt;The image is taken from this &lt;a href=&quot;http://www.cse.wustl.edu/~jain/cse571-07/ftp/quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cu3w1.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cu3w1.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Here Alice is using random bases to encode 0 or 1. After the process is completed, Bob has similarly polarized photons as Alice. These polarization can be any of the $\lvert 0 \rangle , \lvert 1 \rangle, \lvert + \rangle$ or $\lvert - \rangle$. However, how would Bob know what Alice meant for which two of these bases? Meaning, Alice might choose ${\lvert 0 \rangle, \lvert + \rangle}$ to encode a &lt;strong&gt;0&lt;/strong&gt; and ${\lvert 1 \rangle, \lvert - \rangle}$ to encode a &lt;strong&gt;1&lt;/strong&gt; or vice versa. How do they determine which polarization encodes which bits?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2018-12-23T13:47:57.560" LastActivityDate="2018-12-23T13:47:57.560" Title="BB84 Protocol Alice Choice to Bob" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2173" PostTypeId="2" ParentId="2172" CreationDate="2018-05-28T18:18:27.407" Score="4" Body="&lt;p&gt;That’s the public discussion stage: Alice and Bob can both announce which basis they chose for each round. &lt;em&gt;If&lt;/em&gt; they happened to pick the same basis on a given round, they know that (in a perfect world) their answers were the same, so they can translate them into a 0/1 value that nobody else knows. That translation is arbitrary, and they’ve probably agreed it in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The natural way to do this is to associate an operator with each measurement basis, e.g. X or Z (the Pauli matrices). The measurement answers are then e.g. $(\mathbb{I}+(-1)^xX)/2$ where x is a bit value which we use as the translation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-28T18:24:51.113" LastActivityDate="2018-05-28T18:24:51.113" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2174" PostTypeId="1" CreationDate="2018-05-28T18:47:43.467" Score="4" ViewCount="444" Body="&lt;p&gt;I recently asked &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2166/grovers-algorithm-and-its-relation-to-complexity-classes&quot;&gt;this question&lt;/a&gt; on Grover's algorithm, and I am still fairly confused about the whole thing. Consider the following snippet from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1664/quantum-algorithm-sat-structure&quot;&gt;post&lt;/a&gt; (written by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/58/didix13&quot;&gt;DIDIx13&lt;/a&gt;) which for convenience I will reproduce here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you throw away the problem structure, and just consider the space of $2^n$ possible solutions, then even a quantum computer needs about $\sqrt{2^n}$ steps to find the correct one (using Grover's algorithm)&#xA;  If a quantum polynomial time algorithm for a $\text{NP}$-complete problem is ever found, it &lt;b&gt;must&lt;/b&gt; exploit the problem structure in some way. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first line emphasis one place where I am confused: Grover's algorithm finds a solution amongst $2^n$ solutions to a problem - this is not a decisions problem alone and as mentioned in my question linked above means we cannot assign it a complexity class. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said Grover's algorithm can be used to solve decision problems (there seems to be a lot of talk on related questions about &quot;SAT&quot;) - but I have yet seen a &lt;strong&gt;simple&lt;/strong&gt; example of such an application. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus my question is: Does there exist a simple example of Grover's algorithm solving a decision problem? (even better if you can provide one where the classical search is in $NP$ and another in $P$)&lt;/p&gt;&#xA;" OwnerUserId="2015" LastActivityDate="2018-06-02T06:53:58.683" Title="Example of Grover's Algorithm applied to a decision problem?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2175" PostTypeId="2" ParentId="2174" CreationDate="2018-05-28T19:48:33.730" Score="3" Body="&lt;p&gt;Take the problem of &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_satisfiability_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;3-SAT&lt;/a&gt;. There is some $f(x)$ which gives outputs 0 or 1. We generally think of the case where the outputs 1 are rare, and hard to find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PROBLEM: Determine if there is an $x$ that satisfies $f(x)=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3-SAT has a certain structure to the way the variables are evaluated based on conjunctive normal form, but that's not so important right now).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem is known to be NP-complete: as much as we believe NP and P are distinct, we believe this problem cannot be solved efficiently. But Grover's does help us because it gives us a square root speed-up; it searches for the items where the answer is 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if you're asking for a specific example of an $f(x)$, but one of the issues is that this complexity classification is about scaling: you need a family of functions for different sized inputs. 3-SAT is one such class. Perhaps my answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2185/1837&quot;&gt;here&lt;/a&gt; supplies the sorts of examples you were after?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-02T06:53:58.683" LastActivityDate="2018-06-02T06:53:58.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2176" PostTypeId="1" CreationDate="2018-05-28T20:45:15.527" Score="5" ViewCount="114" Body="&lt;p&gt;In the paper &quot;Demonstration of two-qubit algorithms with a superconducting quantum processor&quot; (L. DiCarlo et al., Nature 460, 240 (2009), &lt;a href=&quot;https://arxiv.org/pdf/0903.2030.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv&lt;/a&gt;) they demonstrate how to realize conditional phase gates with superconducting qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, they use the $|{1,1}\rangle \leftrightarrow |0, 2\rangle$ to create a conditional phase gate. I quote &quot;his  method  of  realizing  a&#xA;C-Phase gate by adiabatically using the avoided crossing between&#xA;computational and non-computational states is generally applicable&#xA;to qubit implementations with finite anharmonicity, such as trans-&#xA;mons or phase qubits&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how this technique works, especially why it is a controlled gate. &lt;/p&gt;&#xA;" OwnerUserId="1853" LastEditorUserId="1847" LastEditDate="2018-05-29T02:33:21.577" LastActivityDate="2018-05-29T10:52:16.797" Title="Conditional Phase Gate Superconducting Qubits" Tags="&lt;quantum-gate&gt;&lt;experiment&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2177" PostTypeId="1" CreationDate="2018-05-28T20:50:23.917" Score="23" ViewCount="6618" Body="&lt;p&gt;I want to create a Toffoli gate controlled by n qubits, and implement it in QISKit. Can this be done? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="26" LastEditDate="2019-03-12T09:30:49.260" LastActivityDate="2019-09-19T21:02:38.467" Title="How can I implement an n-bit Toffoli gate?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="20" ContentLicense="CC BY-SA 4.0" />
  <row Id="2178" PostTypeId="2" ParentId="2177" CreationDate="2018-05-28T21:00:35.463" Score="24" Body="&lt;p&gt;A simple way to do this is illustrated in Figure 4.10 of Nielsen &amp;amp; Chuang.&#xA; &lt;a href=&quot;https://i.stack.imgur.com/lAB2Um.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lAB2Um.png&quot; alt=&quot;n-&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where U can be any single-qubit rotation (in this case, an X gate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This circuit works like this:&#xA;We want to apply U to the target qubit only if the AND of all control qubits is 1. A normal Toffoli gives us the AND of 2 qubits. So by chaining a few Toffolis, we can get c1.c2.c3.c4.c5, with the catch that some &quot;work&quot; (or ancilla) qubits have been introduced to store intermediate results. After applying the final CU, we get the final result in target. Now we can clean up the intermediate work qubits by undoing their computations, returning them to the |0&gt; state.&#xA;This model of reversible computation is known as the &quot;compute-copy-uncompute&quot; method, and was first &lt;a href=&quot;http://www.cs.princeton.edu/courses/archive/fall04/cos576/papers/bennett73.html&quot; rel=&quot;noreferrer&quot;&gt;proposed by Charlie Bennett in 1973&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the QISKit code to construct the circuit and visualize it:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, QuantumCircuit&#xA;&#xA;n = 5  # must be &amp;gt;= 2&#xA;&#xA;ctrl = QuantumRegister(n, 'ctrl')&#xA;anc = QuantumRegister(n-1, 'anc')&#xA;tgt = QuantumRegister(1, 'tgt')&#xA;&#xA;circ = QuantumCircuit(ctrl, anc, tgt)&#xA;&#xA;# compute&#xA;circ.ccx(ctrl[0], ctrl[1], anc[0])&#xA;for i in range(2, n):&#xA;    circ.ccx(ctrl[i], anc[i-2], anc[i-1])&#xA;&#xA;# copy&#xA;circ.cx(anc[n-2], tgt[0])&#xA;&#xA;# uncompute&#xA;for i in range(n-1, 1, -1):&#xA;    circ.ccx(ctrl[i], anc[i-2], anc[i-1])&#xA;circ.ccx(ctrl[0], ctrl[1], anc[0])    &#xA;&#xA;from qiskit.tools.visualization import circuit_drawer&#xA;circuit_drawer(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yields:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hiOhV.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hiOhV.png&quot; alt=&quot;qiskit generated circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2018-05-28T21:00:35.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2181" PostTypeId="2" ParentId="2176" CreationDate="2018-05-29T10:52:16.797" Score="3" Body="&lt;p&gt;Each of the two spins, $q\in\{L,R\}$, has a bunch of energy levels $\{|n\rangle_q\}$, each at energy $\omega_{n}^q$. In other words, the basic Hamiltonian of the spins is:&#xA;$$&#xA;H=\sum_{n=0}^{N}\omega_{n}^L|n\rangle\langle n|_L+\omega_{n}^R|n\rangle\langle n|_R&#xA;$$&#xA;Written like this, the two spins are not interacting, so we won't get a two-qubit gatewithout doing something extra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We we're talking about a qubit, we specifically focus on populating just the $|0\rangle$ and $|1\rangle$ levels of each spin. Nothing else is ever populated (hopefully). Under the Hamiltonian $H$, as basis element $|x\rangle$ for $x\in\{0,1\}^2$ acquires a phase&#xA;$$&#xA;e^{-i(\omega^L_{x_L}+\omega^R_{x_R})t}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to this basic Hamiltonian of the spins, there is a cavity, containing photons that interact with both spins. This is what will mediate the two-qubit interaction. In effect, by manipulating the interaction parameters, we can change the energy level of the $|1\rangle_L|1\rangle_R$ state independently of the $|10\rangle$ and $|01\rangle$ states. Thus, in principle, one creates a different phase pno all 4 basis states, and these can be combined to give a controlled-phase gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, how this works is that most of the time you want to be sat in a region of parameter space where there is no two-qubit interaction going on. At particular moments of a computation, you need to turn this interaction on. This is achieved by adiabatically varying the cavity parameters. By doing this, the populations of the qubits in the different basis states don't change, but you move to a regime where the energy levels are different, and generating the phases you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll notice I haven't mentioned the $|0,2\rangle$ level yet. In some ways this is irrelevant; everything I've said is (a sufficiently good approximation to) true. The issue is that usually, when you change the parameters, you don't get the independent control of the different energies. The place to go looking, if you want to find such independent control, is in the region of an '&lt;a href=&quot;https://en.wikipedia.org/wiki/Avoided_crossing&quot; rel=&quot;nofollow noreferrer&quot;&gt;avoided crossing&lt;/a&gt;', where the usual linear variation of energy with parameters would suggest that two energy levels should be the same (e.g. the $|11\rangle$ and $|02\rangle$ levels). The avoided crossing means that the energy takes on a quadratic form near the (not) crossing point, and it's that non-linearity that you're making use of. It also defines important constraints on the adiabatic evolution: since you do not want to populate the $|02\rangle$ level, you have to move slowly with respect to the energy gap between $|11\rangle$ and $|02\rangle$, which is comparatively small, and therefore the evolution time is quite slow.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-29T10:52:16.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2182" PostTypeId="1" AcceptedAnswerId="2184" CreationDate="2018-05-29T14:59:11.487" Score="5" ViewCount="159" Body="&lt;p&gt;I know there are some &quot;quantum versions&quot; of hand-writing recognition algorithms which have been proposed using quantum neural networks. Example: &lt;a href=&quot;https://link.springer.com/article/10.1007/s100320050034&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Recognition of handwritten numerals by Quantum Neural Network with fuzzy features&quot; (J Zhou, 1999)&lt;/a&gt;. Also, recently by Rebentrost et al.: &quot;&lt;a href=&quot;https://arxiv.org/abs/1710.03599&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Hopfield Neural Network&lt;/a&gt;&quot; presents an application of their method as a genetic sequence recognizer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some other proposed applications of quantum neural networks whose given solutions &lt;strong&gt;provide considerable improvement&lt;/strong&gt; over the corresponding classical version of the neural network in terms of accuracy? Also, have any of those proposed solutions been programmed/simulated?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Please note&lt;/strong&gt; that I'm looking for research papers which specifically demonstrate some applications of quantum neural networks and which provide a significant improvement over the corresponding classical neural networks.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-05-31T23:22:28.060" LastActivityDate="2018-05-31T23:22:28.060" Title="What are some of the interesting problems whose solutions have been proposed using quantum neural networks?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;machine-learning&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="10" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2183" PostTypeId="2" ParentId="2161" CreationDate="2018-05-29T15:19:55.330" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't understand their notion of a $2^n$ dimensional &lt;em&gt;complex&lt;/em&gt;&#xA;  vector. If each of the components of their classical data array has&#xA;  two floating point numbers, wouldn't encoding that into a $n$-qubit&#xA;  quantum state be equivalent to storing a $2\times 2^{n}$ size&#xA;  classical array in a $n$-qubit system?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are absolutely correct that a $2\times 2^n$ classical array of nubers is stored in an n-qubit system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But they are absolutely right that the vector's dimension is $2^n$. This is because the vector has $2^n$ rows, where each entry has 2 classical numbers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also store the same vector in a $2\times 2^n$ array: $2^n$ rows are filled in with the real parts and $2^n$ rows by the imaginary parts, but this vector would &lt;strong&gt;&lt;em&gt;not evolve according to the Schrödinger equation&lt;/em&gt;&lt;/strong&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps resolve this part of the question.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But they don't mention anywhere how they will convert classical data (say in form of a $2\times 2^{n}$ array) into that form.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are right. &lt;strong&gt;Just as Peter Shor never mentioned anywhere how his qubits for factoring will be prepared.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is up to the experimentalists, and it is &lt;em&gt;implementation-dependent&lt;/em&gt;. This means that for NMR qubits you'd convert the classical data into qubits differently from superconducting qubits, or ion-trap qubits, or  quantum dot qubits, etc. Therefore I do not blame Shor, or any of the 6 authors of the 2 papers you mentioned (who are all theorists by the way), for not explaining how the qubits will be prepared. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;let us assume that the initial data array we wanted to store in our quantum system was actually $V=\{\{3,\phi_1\},\{2,\phi_2\},...,\{4,\phi_8\}\}$. If they define $|v\rangle$ as $|\vec{v}|^{-1/2}\vec{v}$ then $|V\rangle$ in our example would look something like $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(|3e^{i\phi_1}||000\rangle + |2e^{i\phi_2}||001\rangle + ... + |4e^{i\phi_8}||111\rangle)$. But&#xA;  then we're losing all the information about the phases $\phi_i$, isn't&#xA;  it? So what was the use of starting with a &lt;em&gt;complex&lt;/em&gt; vector (having&#xA;  both a phase and magnitude) in the first place, when we're losing that&#xA;  information when converting to $|V\rangle$ anyway?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You had it earlier in your question! &quot;Consider the vector $N=2^{n}$ dimensional complex vector $\vec{v}$ with components $\{v_i=|v_i|e^{i\phi_i}\}$.&quot; Therefore the vector is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;|\vec{v}|^{-1/2}&#xA;\begin{pmatrix}|v_{1}|e^{i\phi_{1}}\\&#xA;|v_{2}|e^{i\phi_{2}}\\&#xA;\vdots\\&#xA;|v_{2^{n}}|e^{i\phi_{2^{n}}}&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice:&lt;br&gt;&#xA;1) There's $2^n$ entries, not $2 \times 2^n$ &lt;br&gt;&#xA;2) There is NO norm around the phases, so this is why you have lost all information about the phases, because you put extra norm symbols where they shouldn't be :) &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Or are we writing supposed to consider $|V\rangle$ as&#xA;  $(\sqrt{3^2+2^2+...+4^2})^{-1/2}(3e^{i\phi_1}|000\rangle +&#xA; 2e^{i\phi_2}|001\rangle + ... + 4e^{i\phi_8}|111\rangle)$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Closer! The correct answer is the vector I wrote above, which can be written like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\vec{v}|^{-1/2}\left( e^{i \phi_1} |00 \cdots 00\rangle + e^{i \phi_2} |00 \cdots 01\rangle + \cdots + e^{i \phi_{N}} |1\cdots 1\rangle\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;For your specific example&lt;/em&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA; \frac{3e^{i\phi_1}|000\rangle + 2e^{i\phi_8}|001\rangle + \cdots + 4e^{i\phi_8}|111\rangle}{\sqrt{77}}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The purpose of all of this is so that the sum of the squares of the coefficients is 1, which in my equation is true because the numberator is:&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{equation}&#xA;\sqrt{3^2 + 2^2 + 1^2 + 2^2 + 3^2 + 3^2 + 5 ^2+ 4^2} = \sqrt{77}&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that clears it up!&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-05-29T18:02:10.733" LastActivityDate="2018-05-29T18:02:10.733" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2184" PostTypeId="2" ParentId="2182" CreationDate="2018-05-29T17:19:39.740" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What are some other proposed applications of quantum neural networks?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Absolutely any application of classical neural networks can be an application of quantum neural networks. There's a lot of examples beyond the two you listed. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also, have any of those proposed solutions been programmed/simulated?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, for example Ed Farhi of MIT and Hartmut Neven of Google teamed up on a paper where an application was &lt;a href=&quot;https://arxiv.org/pdf/1802.06002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;distinguishing digits using QNNs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-05-29T17:19:39.740" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2185" PostTypeId="2" ParentId="2166" CreationDate="2018-05-29T18:34:29.710" Score="2" Body="&lt;p&gt;All counting is done in terms of $n$, the number of bits required to describe the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We define the class of problems $\text{NP}$ in the following way (or, this is one way to do it):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $f(x)$ be a function that accepts an input $x\in\{0,1\}^n$ and returns a single bit value 0 or 1. The task is that you have to find whether a given value of $x$ returns a 1. However, there is further structure to the problem: if $f(x)=1$, you are guaranteed that there exists a proof $p_x$ (of size $m\sim\text{poly}(n)$) such that a function $g(x,p_x)=1$ only if $f(x)=1$, and the function $g(x,p_x)$ is efficiently computable (i.e. it has a running time of $\text{poly}(n)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give a few examples (perhaps these are what you were asking for &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2174/1837&quot;&gt;here&lt;/a&gt;?):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Parity: $f(x)$ answers the question 'is $x$ odd?'. This is so trivial (just take the least significant bit of $x$) that $f(x)$ is efficiently computed directly, and therefore a proof is unnecessary, $g(x,p_x)=f(x)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Composite numbers: $f(x)$ answers the question 'is the decimal representation of $x$ a composite number?'. One possible proof in the yes direction (you only have to prove that direction) is to give a pair of factors. e.g. $x=72$, $p_x=(8,9)$. Then $g(x,p)$ simply involves multiplying together the factors and checking they are equal to $x$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Graph isomorphism: Given two graphs $G_1$ and $G_2$ (here $x$ contains the description of both graphs), $f(x)$ answers the question 'are the two graphs isomorphic?'. The proof $p_x$ is a permutation: a statement of how the vertices in $G_1$ map to those of $G_2$. The function $g(x,p_x)$ verifies that $p_x$ is a valid permutation, permutes the vertices of $G_1$ using the specified permutation, and verifies that the adjacency matrix is the same as that of $G_2$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Minesweeper_(video_game)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Minesweeper&lt;/a&gt;: The old favourite game built into windows (and others) can be expressed like this. Imagine a minesweeper board that is partially uncovered, so some cells are unknown, and some cells have been uncovered to reveal how many mines are in the neighbouring cells. This is all built into the variable $x$. $f(x)$ asks the question 'is there a valid assignment of mines on the uncovered region?'. The proof, $p_x$ is simply one such assignment of mines. This is easily verified using $g(x,p_x)$ which simply ensures consistency with every known constraint.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All of these problems are in $\text{NP}$ because they fit the definition of an efficiently verifiable solution. Some of them are known to be in $\text{P}$ as well: we've already stated that odd testing is in $\text{P}$. Composite numbers also is, because it is efficient to check if a number is prime using &lt;a href=&quot;https://en.wikipedia.org/wiki/AKS_primality_test&quot; rel=&quot;nofollow noreferrer&quot;&gt;AKS primality testing&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph isomorphism and minesweeper are not known to be in $\text{P}$. Indeed, minesweeper &lt;a href=&quot;http://web.mat.bham.ac.uk/R.W.Kaye/minesw/ordmsw.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;is known&lt;/a&gt; to be $\text{NP}$-complete, i.e. if it can be solved efficiently, every problem in $\text{NP}$ is in $\text{P}$. Many people suspect that $\text{P}\neq\text{NP}$, and hence Minesweeper would have instances which take longer than polynomial time to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible way to solve an $\text{NP}$ problem is, for a fixed $x$, simply to test all possible proofs $p_x$ up to a maximum length $m=\text{poly}(n)$, and see if there's a satisfying solution, i.e. to search for a solution $g(x,p_x)=1$. Obviously, that takes time $O(2^m\text{poly}(m))$, as there are exponentially many items to search, each requiring a polynomial time to compute. This can be improved by implementing Grover's search: we just search for a solution $g(x,p_x)=1$ (i.e. the valid $p_x$ becomes the marked item), and this takes a time $O(2^{m/2}\text{poly}(m))$. This is massively faster, but does not change the assessment of whether the running time is polynomial or something worse; it has not become a polynomial time algorithm. For example, graph isomorphism would have to search over all possible permutations. Minesweeper would have to search over all possible assignments of mines on uncovered squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, some of the time, additional structure in the problem permits different solutions that do not require the searching of all possible proofs. There, Grover's search is of less, or even no, use to us, but it might be that we can come up with a polynomial time algorithm in another way. For example, the case of composite testing: classically, finding the factors of a number appears to be hard: we can't do much better than testing all possible factors, so making use of that form of proof doesn't help much, but, as already mentioned, the question can be resolved efficiently via another route, AKS primality testing.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-05-30T08:14:21.767" LastActivityDate="2018-05-30T08:14:21.767" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2186" PostTypeId="2" ParentId="2155" CreationDate="2018-05-29T19:12:14.460" Score="5" Body="&lt;p&gt;You get two decompositions for your matrix (let's call it $A$) because you are using two different operatorial bases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first case you are considering the matrix as acting in a space of dimension $3\times 2$, that is, using the operatorial basis $\{\lambda_i\sigma_j\}_{ij}\equiv\{\lambda_i\otimes\sigma_j\}_{ij}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, you are computing the coefficients $c_{ij}=\operatorname{tr}((\lambda_i\otimes \sigma_j) A)$,&#xA;finding $c_{61}$ to be the only not vanishing term.&#xA;This decomposition will be unique, because&#xA;$\operatorname{tr}\big[ (\lambda_i\sigma_j)(\lambda_k\sigma_l) \big]=N_{ij} \delta_{ik}\delta_{jl}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the second decomposition is obtained thinking of $A$ as a matrix in a space of dimensions $2\times 3$, that is, by decomposing it using the operatorial basis $\{\sigma_i\lambda_j\}_{ij}\equiv\{\sigma_i\otimes\lambda_j\}_{ij}$.&#xA;This gives you new coefficients&#xA;$d_{ij}\equiv\operatorname{tr}((\sigma_i \otimes\lambda_j) A)$, which do not have to be (and indeed are not) the same as the $c_{ij}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no paradox because $\{\sigma_i\otimes\lambda_j\}_{ij}$ and $\{\lambda_i\otimes\sigma_j\}_{ij}$ are two entirely different operatorial bases for a space of dimension $6$.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-08-09T08:51:52.183" LastActivityDate="2018-08-09T08:51:52.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2187" PostTypeId="2" ParentId="2166" CreationDate="2018-05-29T22:08:29.140" Score="2" Body="&lt;p&gt;Complexity classes are generally defined with regard to the size of the input. The relevant sizes here are $n$ (the number of qubits on which you let Grover's algorithm operate) and a number you haven't mentioned yet, call it $m$, of bits needed to describe the subroutine generally referred to as the oracle. Typically, the oracle will be efficiently implemented in a way that scales polynomially in $n$, which is the case, for example, if you encode a typical boolean satisfiability problem in the oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, you do not get a gain in complexity class using Grover's algorithm: It takes exponentially many quantum operations, typically $m*2^{n/2}$, to solve a problem we could brute-force in exponentially many steps, typically $m*2^{n-1}$, on a classical computer anyways. This means that problems known (e.g. EXPTIME) or suspected (e.g. NP) to take exponential runtime will still require exponential runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, physicists like to appeal to the notion that this is still an exponential speed-up with no known (or indeed readily conceivable) classical equivalent. This is most apparent in the database example where the oracle function is a database lookup and Grover's algorithm can cause one to need many fewer lookups than there are data in the database. In this sense, there is still a significant advantage, although it is completely lost in the complexity class picture.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-05-29T22:08:29.140" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2188" PostTypeId="1" AcceptedAnswerId="2189" CreationDate="2018-05-30T10:03:51.980" Score="5" ViewCount="95" Body="&lt;p&gt;I was working on the Grover's algorithm and the most common example is for a unitary distribution in a quantum database, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \frac{1}{2}|00\rangle + \frac{1}{2}|01\rangle + \frac{1}{2}|10\rangle + \frac{1}{2}|11\rangle.$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to obtain arbitrary distribution (the above one is achieved by applying $H^{\otimes n}$ gates), e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \frac{1}{3}|00\rangle + \frac{1}{4}|01\rangle + \sqrt{\frac{83}{144}}|10\rangle + \frac{1}{2}|11\rangle$&#xA;? Does the structure of Grover's algorithm differ in such a case?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastActivityDate="2018-05-30T10:52:10.287" Title="How to obtain arbitrary distribution in quantum database" Tags="&lt;grovers-algorithm&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2189" PostTypeId="2" ParentId="2188" CreationDate="2018-05-30T10:52:10.287" Score="4" Body="&lt;p&gt;According to this &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9807027.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A significant conclusion from this solution is that generically the generalized algorithm also has $O(\sqrt{N/r})$ running time&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where 'r' is the number of marked states. By &lt;strong&gt;generalized&lt;/strong&gt;, the authors meant a distribution with arbitrary complex amplitudes. So it seems to answer your question. That the modified initialization would still perform in the same way as the original one. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2018-05-30T10:52:10.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2190" PostTypeId="1" AcceptedAnswerId="2191" CreationDate="2018-05-30T14:58:46.317" Score="9" ViewCount="1526" Body="&lt;p&gt;I trying to do some tests in the IBM Q5 computer of IBM quantm experience for some simple error correction protocols, but as I can see, some operations between the qubits are not allowed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, it is not possible to perform a CNOT operation with the fourth qubit or when selecting one for as the target qubit for the operation, it does not allow to use any of the other qubits as control qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been thinking about the fact that maybe it is because of the physical implementation of such computer, but as I do not know much about the construction of quantum computers I do not know if that might be the cause. So I am wondering if that is actually the issue, or otherwise why those operations are not allowed.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-12-14T05:40:55.457" LastActivityDate="2018-12-14T05:40:55.457" Title="Allowed CNOT gates for IBM Q 5 quantum computer" Tags="&lt;error-correction&gt;&lt;physical-realization&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2191" PostTypeId="2" ParentId="2190" CreationDate="2018-05-30T15:12:22.757" Score="8" Body="&lt;p&gt;Yes, the physical implementation is the constraint. If you look at the image of the processor you'll notice the connections between qubits. This gives you an idea of how you can perform two qubit gates between particular qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the documentation on the Tenerife backend. In the section titled Two Qubit gates at the bottom you can read the details. Also the directions of the gates are also detailed in a log file there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/QISKit/qiskit-backend-information/tree/master/backends/tenerife/V1&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/QISKit/qiskit-backend-information/tree/master/backends/tenerife/V1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YCzgN.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YCzgN.png&quot; alt=&quot;Image taken from Tenerife documention&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2018-05-30T15:17:50.727" LastActivityDate="2018-05-30T15:17:50.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2192" PostTypeId="1" AcceptedAnswerId="2193" CreationDate="2018-05-30T15:29:35.763" Score="6" ViewCount="151" Body="&lt;p&gt;I am thinking about the following question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Assuming that we have some given state $\rho$ and we perform a&#xA;  measurement with $k$ outcomes on this state. Then we can describe the&#xA;  measurement in outcomes as eigenvalues of the measurable, i.e., the&#xA;  Hermitian operator that I denote by $D$, with probabilities&#xA;  $\mathrm{Tr}[D_i\rho]$, where $D_i$ are the projectors in the $i^{th}$&#xA;  eigenspace of $D$, i.e. for the eigendecomposition $D = \sum_i&#xA; \lambda_i s_i s_i^T = \sum_i \lambda_i D_i$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was wondering if my assumption is true. If the number of (distinguishable?) outcomes for any Hermitian operator is given by $k$ i.e. then we have only $k$ non-zero eigenvalues and hence $D$ must be of rank $\leq k$?&lt;/p&gt;&#xA;" OwnerUserId="2054" LastEditorUserId="2054" LastEditDate="2018-05-31T16:55:07.497" LastActivityDate="2018-05-31T16:55:07.497" Title="Rank of a measurement" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2193" PostTypeId="2" ParentId="2192" CreationDate="2018-05-30T15:46:40.723" Score="3" Body="&lt;p&gt;You are implicitly making a specific assumption here: that the $\{D_i\}$ are rank 1 projectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If&lt;/em&gt; your $\{D_i\}$ are rank-1 projectors, i.e. taking the form $D_i=s_is_i^T$, then because there is a completeness relation for measurement operators,&#xA;$$&#xA;\sum_iD_i=\mathbb{I},&#xA;$$&#xA;then you must have a number of outcomes equal to the dimension of the Hilbert space you're measuring. Call that $k$. Now, if you define $D=\sum_i\lambda_iD_i$ where the $\lambda_i$ are distinct, then $D$ must have rank either $k$ or $k-1$: if one of the $\lambda_i$ is 0, then the number of non-zero values (which is equivalent to the rank) is $k-1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, strictly, the $D_i$ could be projectors, but not have rank 1 (in fact, they don't even have to be projectors, but we won't go there...), but instead a rank $r_i=\text{Tr}(D_i)$. In this case, either $D$ is full rank (which we'll still call $k$) or, if a particular $\lambda_j=0$, then it has rank $k-r_j$, because that's the number of non-zero eigenvalues $D$ has. Here, the number of distinguishable outcomes is potentially much smaller than the rank of $D$. All you really know is that $\text{rk}(D)\geq |\{D_i\}|-1$ (i.e. the number of measurement operators minus 1, in case one of the eigenvalues is 0). But that could be a very loose bound in some circumstances (and the bound is the opposite way round to what you were asking).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, the answer is that the number of distinguishable measurement outcomes is &lt;em&gt;not&lt;/em&gt; equal to the rank of the measurement operator.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-30T15:46:40.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2194" PostTypeId="2" ParentId="2190" CreationDate="2018-05-30T16:55:59.673" Score="6" Body="&lt;p&gt;The five qubit IBM devices have a ‘bow tie’ architecture, which mean that it is only possible to interact certain pairs of qubits. These are shown in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2191/409&quot;&gt;answer of Andrew O&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interaction that can be performed between these pairs of qubits is a CNOT with a particular direction. However, it is possible to implement others indirectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, to perform a CNOT with q0 as control and q1 as target, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h q[0];&#xA;h q[1];&#xA;cx q[1], q[0];&#xA;h q[1];&#xA;h q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above can be added in the QASM editor. Or you could do the same with the GUI: it is a CNOT with Hadamads before and after on both qubits. The Hadamards effectively reverse the CNOT direction.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-05-30T16:55:59.673" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2195" PostTypeId="1" CreationDate="2018-05-31T02:58:10.137" Score="8" ViewCount="1901" Body="&lt;p&gt;I have followed the installation steps, regarding QISKit working environment. For circuit visualization, I've installed latex as in addition to poppler to convert from PDF to images. Afterwards, I followed the example given &lt;a href=&quot;https://nbviewer.jupyter.org/github/QISKit/qiskit-tutorial/blob/master/reference/tools/getting_started.ipynb&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote the code and after running, the program run but I didn't get the circuit visualization. I don't know what is the problem, even I have not received any error messages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So any ideas?&lt;/p&gt;&#xA;" OwnerUserId="2519" LastEditorUserId="26" LastEditDate="2019-03-12T09:29:32.370" LastActivityDate="2019-03-12T09:29:32.370" Title="Visualization of Quantum Circuits when using IBM QISKit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2196" PostTypeId="1" AcceptedAnswerId="2197" CreationDate="2018-05-31T14:36:20.190" Score="4" ViewCount="816" Body="&lt;p&gt;I am currently going through Nielsen's QC bible and having still some foundational / conceptual problems with the matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CYOCq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CYOCq.png&quot; alt=&quot;Nielsen Quantum Computing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to retrieve this $8 {\times} 8$ matrix describing the QFT of 3 qubits via Kronecker product in various attempts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hadamard transform can be decomposed into $H \otimes 1 \otimes 1$, and the others are fundamentally kronecker products of the 4x4 matrices of S resp. T with the 2x2 identity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whats wrong with my approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T\text{=}\left(&#xA;\begin{array}{cccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{\frac{\pi  i}{4}} &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{\frac{\pi  i}{4}} \\&#xA;\end{array}&#xA;\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is derived from $R_k = \left(&#xA;\begin{array}{cc}&#xA; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; e^{2 i \pi /2^k} \\&#xA;\end{array}&#xA;\right)$, being $S$ for $k=1$ and $T$ for $k=2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controlled T-operation can be represented in computational basis as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{2 \pi i / 2^k } \\&#xA;\end{array}&#xA;\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 3: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In mathematica, one faulty calculation of mine is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\text{SWAP}\text{=}\left(&#xA;\begin{array}{cccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SWAP*KroneckerProduct[IdentityMatrix[2], IdentityMatrix[2], H]&lt;em&gt;KroneckerProduct[IdentityMatrix[2], S]&lt;/em&gt;&#xA;  KroneckerProduct[ IdentityMatrix[2], H, IdentityMatrix[2]] * T &lt;em&gt;KroneckerProduct[S, IdentityMatrix[2]]&lt;/em&gt;&#xA;  KroneckerProduct[H, IdentityMatrix[2], &#xA;   IdentityMatrix[2]] // MatrixForm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left(&#xA;\begin{array}{cccccccc}&#xA; \frac{1}{2 \sqrt{2}} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; -\frac{1}{2 \sqrt{2}} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{e^{\frac{i \pi }{2}}}{2 \sqrt{2}} &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -\frac{e^{\frac{i \pi }{2}} i^2}{2 \sqrt{2}} \\&#xA;\end{array}&#xA;\right)$&lt;/p&gt;&#xA;" OwnerUserId="2522" LastEditorUserId="2522" LastEditDate="2018-05-31T15:22:28.863" LastActivityDate="2018-05-31T15:39:09.520" Title="Example of Quantum Fourier Computation for three qubits" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2197" PostTypeId="2" ParentId="2196" CreationDate="2018-05-31T15:39:09.520" Score="3" Body="&lt;p&gt;The tensor products for the individual gates are all being calculated correctly, and the matrices are being multiplied in the correct order. In this case, it turns out that it is a Mathematica programming error, using the * operator for element-by-element multiplication of matrices rather than matrix multiplication. The first clue was that the overall output was not even unitary, even though the individual gates seemed to be correct.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-05-31T15:39:09.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2198" PostTypeId="1" AcceptedAnswerId="2204" CreationDate="2018-05-31T16:18:59.457" Score="9" ViewCount="171" Body="&lt;p&gt;I'm relatively new to quantum computing and my goal is to learn how to implement algorithms that I read in papers. While I have found many circuit snippets I have yet to find a repository of examples on GitHub or other places where I would go to find machine learning code.  Does an analogous quantum computing repository exist?&lt;/p&gt;&#xA;" OwnerUserId="418" LastActivityDate="2018-06-11T07:59:00.120" Title="Where can I find example circuits to learn from?" Tags="&lt;models&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2199" PostTypeId="2" ParentId="2128" CreationDate="2018-05-31T16:33:40.633" Score="6" Body="&lt;p&gt;First let me mention a minor point concerning terminology. The type of channel you are suggesting is often called a &lt;em&gt;Pauli channel&lt;/em&gt;; the term &lt;em&gt;depolarizing channel&lt;/em&gt; usually refers to the case where $p_x = p_y = p_z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, it is not really correct to say that Pauli channels are the channel model considered for quantum error correction. Standard quantum error correcting codes can protect against &lt;em&gt;arbitrary&lt;/em&gt; errors (represented by any quantum channel you might choose) so long as the errors do not affect too many qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, let us consider an arbitrary single-qubit error, represented by a channel $\Phi$ mapping one qubit to one qubit. Such a channel can be expressed in Kraus form as&#xA;$$&#xA;\Phi(\rho) = A_1 \rho A_1^{\dagger} + \cdots + A_m \rho A_m^{\dagger}&#xA;$$&#xA;for some choice of Kraus operators $A_1,\ldots,A_m$. (For a qubit channel we can always take $m = 4$ if we want.) You could, for instance, choose these operators so that $\Phi(\rho) = |0\rangle \langle 0|$ for every qubit state $\rho$, you could make the error unitary, or whatever else you choose. The choice can even be adversarial, selected after you know how the code works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of the Kraus operators $A_k$ can be expressed as a linear combination of Pauli operators, because the Pauli operators form a basis for the space of 2 by 2 complex matrices:&#xA;$$&#xA;A_k = a_k I + b_k X + c_k Y + d_k Z.&#xA;$$&#xA;If you now expand out the Kraus representation of $\Phi$ above, you will obtain a messy expression where $\Phi(\rho)$ looks like a linear combination of operators of the form $P_i \rho P_j$ where $i,j\in\{1,2,3,4\}$ and $P_1 = I$, $P_2 = X$, $P_3 = Y$, and $P_4 = Z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine that you have a quantum error correcting code that protects against an $X$, $Y$, or $Z$ error on one qubit. The usual way this works is that some extra qubits in the 0 state are tacked on to the encoded data and a unitary operation is performed that reversibly computes into these extra qubits a syndrome describing which error occurred, if any, and which qubit was affected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposing that the arbitrary error $\Phi$ happened on the first qubit for simplicity, after the syndrome computation you will end up with a state that looks like a linear combination of terms like this:&#xA;$$&#xA;P_i |\psi\rangle \langle \psi| P_j \otimes |P_i\: \text{syndrome}\rangle\langle P_j\:\text{syndrome}|.&#xA;$$&#xA;The assumption here is that $|\psi\rangle$ represents the encoded data without any noise, $P_i$ and $P_j$ act on the first qubit, and that &quot;$P_i$ syndrome&quot; and &quot;$P_j$ syndrome&quot; refer to the standard basis states that indicate that these errors have occurred on the first qubit. (The situation is similar for the error affecting any other qubit; I'm just trying to keep the notation simple by assuming the error happened to the first qubit.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the key is that you &lt;em&gt;measure&lt;/em&gt; the syndrome to see what error occurred, and all of the cross terms disappear because of the measurement. You are left with a probabilistic mixture of states that look like&#xA;$$&#xA;P_i |\psi\rangle \langle \psi| P_i \otimes |P_i\: \text{syndrome}\rangle\langle P_i\:\text{syndrome}|.&#xA;$$&#xA;The error is corrected and the original state is recovered. In effect, by measuring the syndrome, you &quot;project&quot; or &quot;collapse&quot; the error to something that looks like a Pauli channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all described (somewhat briefly) in Section 10.2 of Nielsen and Chuang.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-05-31T16:33:40.633" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2200" PostTypeId="1" CreationDate="2018-05-31T22:35:40.077" Score="11" ViewCount="1688" Body="&lt;p&gt;I am trying to get used to IBM Q by implementing three qubits Grover's algorithm but having difficulty to implement the oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you show how to do that or suggest some good resources to get used to IBM Q circuit programming?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do is to mark one arbitrary state by flipping its sign as the oracle supposed to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$1/\sqrt8(|000\rangle+|001\rangle+|010\rangle+|011\rangle+|100\rangle+|101\rangle+|110\rangle+|111\rangle)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I want to mark $|111\rangle$ by flipping its sign to $-|111\rangle$. I somehow understand that CCZ gate would solve the problem but we do not have CCZ gate in IBM Q. The combination of some gates will act the same as CCZ but I am not sure how to do that yet. And I am also struggling for the other cases not only for $|111\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two qubits case is simple enough for me to implement, but three qubits care is still confusing to me.&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="55" LastEditDate="2018-06-03T16:27:33.193" LastActivityDate="2021-05-25T06:05:45.377" Title="Implementation of the oracle of Grover's algorithm on IBM Q using three qubits" Tags="&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;&lt;gate-synthesis&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2201" PostTypeId="1" AcceptedAnswerId="2202" CreationDate="2018-05-31T23:23:13.067" Score="7" ViewCount="116" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://link.springer.com/article/10.1007%2Fs11128-017-1692-x&quot; rel=&quot;noreferrer&quot;&gt;A quantum-implementable neural network model (Chen, Wang &amp;amp; Charbon, 2017)&lt;/a&gt;, on page 18 they mention that &quot;There are 784 qurons in the input layer, where each quron is comprised of ten qubits.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That seems like a misprint to me. After reading the first few pages I was under the impression that they were trying to use $10$ qubits to replicate the $784$ classical neurons in the input layer. Since $2^{10}=1024&amp;gt;784$, such that each sub-state's coefficient's square is proportional to the activity of a neuron. Say the square of the coefficient of $|0000000010\rangle$ could be proportional to the activation of the $2$-nd classical neuron (considering all the $784$ neurons were labelled fom $0$ to $783$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if what they wrote is true: &quot;There are 784 qurons in the input layer&quot; it would mean there are $7840$ qubits in the input layer, then I'm not sure how they managed to implement their model experimentally. As of now we can properly simulate only ~$50$ qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, they managed to give an error rate for $&amp;gt;7840$ qubits (see Page 21: &quot;Proposed two-layer QPNN, ten hidden qurons, five select qurons - 2.38&quot;). No idea how's they managed to get that value. Could someone please explain?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T12:28:59.183" LastActivityDate="2018-12-23T12:28:59.183" Title="How did the authors manage to simulate and get the error estimate for a neural network with greater than 7840 qubits?" Tags="&lt;neural-network&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2202" PostTypeId="2" ParentId="2201" CreationDate="2018-06-01T01:32:50.143" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;As of now we can properly simulate only ~50 qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You are talking about a full quantum simulation of a vector containing $2^{50}$ elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum neural networks and quantum annealing, we usually only need something close to the ground state (optimal value) rather than the absolute global minimum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is another example &lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.94.022337&quot; rel=&quot;nofollow noreferrer&quot;&gt;from 2017&lt;/a&gt; where 1000 qubits are simulated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rIYrQm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rIYrQm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example &lt;a href=&quot;https://arxiv.org/pdf/1512.02206.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;from 2015&lt;/a&gt; where 1000 qubits are simulated (it says bits rather than qubits, but they are the qubits of the D-Wave device):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bm1wEm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bm1wEm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-01T01:32:50.143" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2203" PostTypeId="1" AcceptedAnswerId="2206" CreationDate="2018-06-01T08:01:24.223" Score="8" ViewCount="410" Body="&lt;p&gt;Recently I found out the &lt;em&gt;Applications of Quantum Computing Professional Certificate Program&lt;/em&gt; that MITxPRO is offering for people interested in quantum computing. I saw that it is consisted of four courses that can be done independently or as a whole program. &lt;a href=&quot;https://mitxpro.mit.edu/courses/course-v1:MITxPRO+QCx4+2T2018/about&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; is the link for the course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am especially interested in just the last one of such four courses, but I do not know if it would be necessary to take the other ones so that I could do such course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why I was wondering if someone here has started this course, and so if there is someone, if he could give an insight about which is the level required for taking such courses, the time required in order to complete the homework and his opinion about the course in general. Also it would be interesting to hear if you think that taking all courses should be necessary (although I am aware of the fact that just one of the courses has been given, so this would be a subjective opininon).&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-12-13T19:51:42.587" LastActivityDate="2020-01-03T04:07:30.877" Title="Reference on MITxPRO Applications of Quantum Computing Professional Certificate Program" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2204" PostTypeId="2" ParentId="2198" CreationDate="2018-06-01T14:10:42.663" Score="9" Body="&lt;p&gt;I know this is not what you are asking but this paper: &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;noreferrer&quot;&gt;&#xA;Quantum Algorithm Implementations for Beginners&lt;/a&gt; explains the implementation of some machine learning algorithms. Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="2100" LastActivityDate="2018-06-01T14:10:42.663" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2205" PostTypeId="2" ParentId="2200" CreationDate="2018-06-01T15:27:23.923" Score="4" Body="&lt;p&gt;I am answering my question. After some google search, I found &lt;a href=&quot;https://www.researchgate.net/figure/282611947_Fig-1-a-Schematic-circuit-of-a-half-adder-where-a-and-b-represent-inputs-and-sum-and&quot; rel=&quot;nofollow noreferrer&quot;&gt;this image&lt;/a&gt; showing CCZ gate by CNOT, T dagger, and T gate. I tried this on IBM Q and it worked. I want to explore why it works but that's another story.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For someone who is interested, here is my quantum circuit of Grover's algorithm finding |111&gt; with one iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eF896.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eF896.png&quot; alt=&quot;Grover&amp;#39;s algorithm finding |111&amp;gt; with one iteration&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2100" LastActivityDate="2018-06-01T15:27:23.923" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2206" PostTypeId="2" ParentId="2203" CreationDate="2018-06-01T15:39:24.450" Score="8" Body="&lt;p&gt;I signed up for this series because I was interested in the 2nd and 3rd courses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a lot of students from different backgrounds so I think that limits the depth of what the instructors can cover. The introductory course was too easy in terms of content, however useful in the form of industry perspectives and getting to know 'who is doing what' in hardware. My fear is that the remaining courses will be a bit too simple/general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bulk of the time is spent watching videos. I set the speed to 1.25x or else it's just a bit too slow for me. You could complete the entire course in a weekend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking all the courses is absolutely not necessary but you do get a nice certificate at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oct 31, 2018 Update&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've finished all 4 courses and have to say the 2nd, 3rd, and 4th courses were great. They went into a reasonable amount of depth in the topics. I'd recommend the series to anyone starting out. If you're already familiar with the basics then maybe skip the first course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jan 2, 2020 Update&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I received a few upvotes on this answer recently, I thought I would add a bit more information. The 4 course certificate program has since been split into two two-course programs. Quantum Computing Fundamentals and Quantum Computing Realities. My comments above still stand. Skip the fundamentals course if you're already familiar with the basics.&lt;/p&gt;&#xA;" OwnerUserId="54" LastEditorUserId="54" LastEditDate="2020-01-02T17:39:05.533" LastActivityDate="2020-01-02T17:39:05.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2207" PostTypeId="1" AcceptedAnswerId="2208" CreationDate="2018-06-01T17:06:43.663" Score="4" ViewCount="115" Body="&lt;p&gt;I am going through Nielsen and Chuang and am finding the chapter on error-correction particularly confusing. At the moment I am stuck on exercise 10.12 which states&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Show that the fidelity between the state $|0 \rangle$ and $\varepsilon(|0\rangle\langle0|)$ is $\sqrt{1-2p\backslash3}$, and use this to argue that the minimum fidelity for the depolarizing channel is $\sqrt{1-2p\backslash3}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand $\varepsilon$ is a quantum operation and could be whatever we want as long as it fits the definition, do I assume $\varepsilon$ is the depolarizing channel or is there some general operation I don't know about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2528" LastEditorUserId="55" LastEditDate="2020-07-26T18:11:20.800" LastActivityDate="2020-07-26T18:11:20.800" Title="How to find the fidelity between two state when one is an operator?" Tags="&lt;error-correction&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2208" PostTypeId="2" ParentId="2207" CreationDate="2018-06-01T17:45:44.700" Score="2" Body="&lt;p&gt;The channel $\mathcal{E}$ is explicitly defined in the preceding paragraph as being the depolarising channel. Thus, all you need to calculate is&#xA;$$&#xA;F=\sqrt{\langle 0|\mathcal{E}(|0\rangle\langle 0|)|0\rangle}.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-01T17:45:44.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2209" PostTypeId="1" AcceptedAnswerId="2214" CreationDate="2018-06-01T20:25:26.947" Score="7" ViewCount="382" Body="&lt;p&gt;I am interested in a quantum algorithm that has the following characteristics:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;output = 2n bits OR 2 sets of n bits (e.g. 2 x 3 bits)&lt;/li&gt;&#xA;&lt;li&gt;the number of 1-bits in the first set of n-bits must be equal to the number of 1-bits in the second set. E.g. correct output =  &lt;code&gt;0,0,0, 0,0,0&lt;/code&gt; (both 3-bit sets have zero 1-bits); &lt;code&gt;1,0,0, 0,1,0&lt;/code&gt; (both 3-bit sets have one 1-bit); &lt;code&gt;1,1,0, 0,1,1&lt;/code&gt; (both 3-bit sets have two 1-bit)&lt;/li&gt;&#xA;&lt;li&gt;Each time the quantum algorithm runs it must randomly return one of the possible solutions.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any idea how I can best implement such an algorithm on a quantum computer ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI I have tried the following algorithm (where n = 2 ) but it missed the 2 answers 0110 and 1001:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bR70C.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bR70C.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2529" LastActivityDate="2018-06-04T09:15:44.350" Title="How to create a quantum algorithm that produces 2 n-bit sequences with equal number of 1-bits?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2210" PostTypeId="1" AcceptedAnswerId="2221" CreationDate="2018-06-01T20:40:29.040" Score="4" ViewCount="374" Body="&lt;p&gt;I work on a &lt;a href=&quot;https://www.edx.org/course/quantum-information-science-ii-part-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Science II: Quantum states, noise and error correction&lt;/a&gt; MOOC by Prof. Aram Harrow, and I do not understand which property of tensor products is used in one of the transitions in the videos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider an isometry $V: A \to B \otimes E$ ($E$ is a subspace to be thrown away at the end).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's fix and orthonormal basis $\{ |e\rangle \}$ in $E$ and partially expand the isometry $V$ as $V = \sum_e V_e \otimes |e\rangle$, where each $V_e$ is a linear operator from $A$ to $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Stinespring form of a quantum operation is a partial trace applied after an isometry: $N(\rho) = \mathrm{tr}_E [V \rho V^\dagger]$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we expand that with our representation of $V$, we get&#xA;$$&#xA;N(\rho) = \mathrm{tr}_E \left[&#xA;\sum_{e_1} \sum_{e_2}&#xA;\left( V_{e_1} \otimes |e_1\rangle \right)&#xA;\rho &#xA;\left( V_{e_2}^\dagger \otimes \langle e_2| \right)&#xA;\right].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how to get from here to the next step&#xA;$$&#xA;N(\rho) = \mathrm{tr}_E \left[&#xA;\sum_{e_1} \sum_{e_2}&#xA;(V_{e_1} \rho V_{e_2}^\dagger) \otimes |e_1 \rangle \langle e_2|&#xA;\right]?&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(BTW, eventually, we end up with the Kraus operator decomposition of a channel: $N(\rho) = \sum_e V_e \rho V_e^\dagger$.)&lt;/p&gt;&#xA;" OwnerUserId="528" LastEditorUserId="55" LastEditDate="2021-02-19T18:33:23.013" LastActivityDate="2021-02-19T18:33:23.013" Title="Tensor product properties used to obtain Kraus operator decomposition of a channel" Tags="&lt;quantum-operation&gt;&lt;tensor-product&gt;&lt;partial-trace&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2211" PostTypeId="1" AcceptedAnswerId="2213" CreationDate="2018-06-01T20:54:15.730" Score="12" ViewCount="546" Body="&lt;p&gt;I am confused about how to understand the $Z$ gate in a Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering the matrix $Z = \begin{pmatrix} &#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1 &#xA;\end{pmatrix}$ it is understandable that $Z|0\rangle = |0\rangle$ and $Z|1\rangle = -|1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is explained &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=beginners-guide&amp;amp;page=005-Single-Qubit_Gates~2F006-Summary_of_quantum_gates&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; that $Z$ gate is $\pi$ rotation around the $Z$ axis. Then, how should I understand $Z|1\rangle = -|1\rangle$? Since $|1\rangle$ is the south pole, I feel it is natural to think that $\pi$ rotation around the $Z$ axis does not do anything.&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="26" LastEditDate="2018-06-02T17:56:31.650" LastActivityDate="2018-06-03T06:03:45.017" Title="How to think about the Z gate in a Bloch sphere?" Tags="&lt;quantum-gate&gt;&lt;bloch-sphere&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2212" PostTypeId="1" CreationDate="2018-06-01T21:53:42.130" Score="3" ViewCount="126" Body="&lt;h1&gt;Puzzle&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I have the following puzzle for which I would like to create a quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are 2 players that need to complete 3 tasks as fast as possible.&lt;/li&gt;&#xA;&lt;li&gt;There are 3 different types of tasks ( &lt;code&gt;A, B, C&lt;/code&gt; )&lt;/li&gt;&#xA;&lt;li&gt;There are 3 different types of tools (&lt;code&gt;a, b, c&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Each player will only get 2 tools (they might get the same tool twice)&lt;/li&gt;&#xA;&lt;li&gt;Tool a will make that the player can finish task &lt;code&gt;A&lt;/code&gt; 10 minutes faster than without tool &lt;code&gt;a&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Tool &lt;code&gt;b&lt;/code&gt; will make that the player can finish task &lt;code&gt;B&lt;/code&gt; 10 minutes faster than without tool &lt;code&gt;b&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Tool &lt;code&gt;c&lt;/code&gt; will make that the player can finish task &lt;code&gt;C&lt;/code&gt; 10 minutes faster than without tool &lt;code&gt;c&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The output of the quantum algorithm must be  (a) a random combination of the 3 tasks (the same task might appear multiple times) and (b) a random assignment of 2 tools to each of the 2 players but it should also remain a fair competition (in other words one player will not gain more time in total thanks to the set of tools he got).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So a possible outcome of the quantum algorithm: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tasks &lt;code&gt;A, A, C&lt;/code&gt;  (note that same task can appear multiple times) and &lt;/li&gt;&#xA;&lt;li&gt;Player one gets tools &lt;code&gt;a,b&lt;/code&gt; &lt;/li&gt;&#xA;&lt;li&gt;Player two gets tools &lt;code&gt;a,a&lt;/code&gt; (although he gets 2 &lt;code&gt;a&lt;/code&gt; tools - he can only use one tool at a time - so the 2nd &lt;code&gt;a&lt;/code&gt; tool would not give any benefits)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, in this case, both players will equally benefit  (= 20 minutes) thanks to tool &lt;code&gt;a&lt;/code&gt; and the 2 tasks &lt;code&gt;A, A&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how would you implement such a problem in a &lt;strong&gt;quantum algorithm&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Generalized Puzzle&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Of course this puzzle can be further generalized as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;each player has to complete &lt;code&gt;n&lt;/code&gt; tasks (and not 3)&lt;/li&gt;&#xA;&lt;li&gt;instead of 3 different types of tasks (&lt;code&gt;A, B, C&lt;/code&gt;) and 3 corresponding different types of tools (&lt;code&gt;a, b, c&lt;/code&gt;), there are &lt;code&gt;t&lt;/code&gt; different types of tasks with corresponding tools giving them a 10 minute performance benefit.&lt;/li&gt;&#xA;&lt;li&gt;each player gets &lt;code&gt;k&lt;/code&gt; tools instead of 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I don't need an answer on this generalized puzzle !  I am more than happy to get an answer on the simple puzzle.&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-04T07:31:38.573" LastActivityDate="2018-06-04T07:31:38.573" Title="Algorithm to allocate tasks and tools fairly to 2 players" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="10" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2213" PostTypeId="2" ParentId="2211" CreationDate="2018-06-01T22:31:25.070" Score="7" Body="&lt;p&gt;The way to think about the Bloch sphere is in terms of the density matrix for the state. $Z$ acting on either $|0\rangle\langle 0|$ or $|1\rangle\langle 1|$ does nothing, as is true for any diagonal density matrix. To see the effect of the rotation, you need to look at how any non-diagonal density matrix is changed by $Z$, such as $|+\rangle\langle +|$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-01T22:31:25.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2214" PostTypeId="2" ParentId="2209" CreationDate="2018-06-01T22:49:32.400" Score="1" Body="&lt;p&gt;There are probably better ways than this, but here’s one you could try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start as you have done, with Hadamards on every qubit of the first register, then controlled nots between matching pairs of qubits across the two registers. This creates a uniform superposition of terms $|x\rangle|x\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you need to somehow perform a random permutation on the second register. Introduce $\binom{n}2$ ancillary qubits. Apply Hadamard on each, and use each qubit to control the application of a swap between a different pair of qubits on the second register. Then forget about the ancillary qubits, and just measure the first two registers. (I’m guessing this gives you a sufficiently random permutation.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-02T09:52:03.173" LastActivityDate="2018-06-02T09:52:03.173" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2215" PostTypeId="2" ParentId="2211" CreationDate="2018-06-01T22:52:10.667" Score="2" Body="&lt;p&gt;As per &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, we can write any pure state as $$|\psi\rangle = \cos\left( \frac{\theta}{2} \right) |0 \rangle + e^{i \phi}  \sin\left( \frac{\theta}{2} \right) |1 \rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\theta$ and $\phi$ are the angles on the Bloch sphere:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/6/6b/Bloch_sphere.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/Bloch_sphere.svg/237px-Bloch_sphere.svg.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Almost any point on the surface (i.e. pure state) has a unique representation in terms of the angles, except for the poles. Just like on the Earth the South Pole has no well-defined longitude (any longitude works the same), for the $|1 \rangle$ state any phase $\phi$ means the same thing. The “latitude” $\theta$ is here $\pi$, let's plug that into the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|1\rangle = \cos\left( \frac{\pi}{2} \right) |0 \rangle + e^{i \phi}  \sin\left( \frac{\pi}{2} \right) |1 \rangle = $$&#xA;$$ = 0 + e^{i \phi} |1 \rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are familiar with Euler's identity, you will probably recognise $e^{i \phi}$ as a rotation in the complex plane. In particular, since $Z$ is a rotation for $\phi = \pi$, we get the famous $e^{i \pi} = -1$, finally arriving at $|1 \rangle = - |1 \rangle$.&lt;/p&gt;&#xA;" OwnerUserId="580" LastActivityDate="2018-06-01T22:52:10.667" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2217" PostTypeId="2" ParentId="2211" CreationDate="2018-06-02T01:03:18.030" Score="10" Body="&lt;p&gt;$|1\rangle$ and $-|1\rangle$ are assigned to the same point on the Bloch sphere because they are equal &lt;em&gt;up to global phase&lt;/em&gt;. Algebraically: $|1\rangle \equiv -|1\rangle$ where $\equiv$ means &quot;equal up to global phase&quot;. Meaning there is some $\theta$ such that $-|1\rangle = e^{i \theta} |1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing that is confusing you is that, despite the fact that $|0\rangle \equiv Z |0\rangle$ and $|1\rangle \equiv Z |1\rangle$, this is not true for linear combinations of the two. For example, $Z |+\rangle \not\equiv Z |+\rangle$ even though $|+\rangle = \frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-06-03T06:03:45.017" LastActivityDate="2018-06-03T06:03:45.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2219" PostTypeId="2" ParentId="2166" CreationDate="2018-06-02T06:07:11.803" Score="6" Body="&lt;h2&gt;Summary&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is a theory of complexity of search problems (also known as relation problems). This theory includes classes called &lt;a href=&quot;https://en.wikipedia.org/wiki/FP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;FP&lt;/strong&gt;&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/FNP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;FNP&lt;/strong&gt;&lt;/a&gt;, and &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:F#fbqp&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;FBQP&lt;/strong&gt;&lt;/a&gt; which are effectively about solving search problems with different sorts of resources.&lt;/li&gt;&#xA;&lt;li&gt;From search problems, you can also define decision problems, which allows you to relate search problems to the usual classes &lt;strong&gt;P&lt;/strong&gt;, &lt;strong&gt;NP&lt;/strong&gt;, and &lt;strong&gt;BQP&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Whether you consider the search version of the decision version of the problem, the way that you consider the input to the Unstructured Search problem will determine what upper bounds you can put on its complexity.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;The complexity of relation problems&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;As you note, Grover's problem solves a &lt;em&gt;search&lt;/em&gt; problem, which in the complexity literature is sometimes also known as a &lt;em&gt;relation&lt;/em&gt; problem. That is, it is a problem of the following sort:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;The structure of a general search problem.&lt;/em&gt;&lt;br&gt; Given an input $x$ and a binary relation $R$, find a $y$ such that $R(x,y)$ holds.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The complexity classes &lt;a href=&quot;https://en.wikipedia.org/wiki/FP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;FP&lt;/strong&gt;&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/FNP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;FNP&lt;/strong&gt;&lt;/a&gt; are defined in terms of such problems, where in particular one is interested in the case where $y$ has length at most a polynomial function of the length of $x$, and where the relation $R(x,y)$ can itself be computed in an amount of time bounded by some polynomial in the length of $(x,y)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular: the example of the 'database search' problem for which Grover's Search is usually applied can be described as follows.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Unstructured Search.&lt;/strong&gt; &lt;br&gt;&#xA;  Given an input oracle $\mathcal O: \mathcal H_2^{\otimes m+1} \!\to \mathcal H_2^{\otimes m+1}$ such that $\mathcal O \lvert a \rangle \lvert b \rangle = \lvert a \rangle \lvert b \oplus f(a) \rangle$ for some function $f: \{0,1\}^m \to \{0,1\}$, find a $y$ such that $\mathcal O&#xA; \lvert y \rangle \lvert 0 \rangle = \lvert y \rangle \lvert 1&#xA; \rangle$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here, the oracle itself is the input to the problem: it plays the role of $x$, and the relation which we are computing is&#xA;$$ R(\mathcal O,y) \;\;\equiv\;\; \Bigl[\mathcal O&#xA; \lvert y \rangle \lvert 0 \rangle = \lvert y \rangle \lvert 1&#xA; \rangle\Bigr] \;\;\equiv\;\; \Bigl[ f(y) = 1 \Bigr].$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that, instead of an oracle, we are provided with a specific input $x$ which describes how the function $f$ is to be computed, we can then consider which complexity class this problem belongs to. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2187/124&quot;&gt;As &lt;code&gt;pyramids&lt;/code&gt; indicates&lt;/a&gt;, the appropriate complexity class we obtain depends on how the input is provided.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose that the input function is provided as an database (as the problem is sometimes described), where each entry to the database has some length $\ell$. If $n$ is the length of the string $x$ used to describe &lt;em&gt;the entire database&lt;/em&gt;, then the database has $N = n\big/\ell$ entries. It is then possible to exhaustively search the entire database by querying each of the $N$ entries in sequence, and stop if we find an entry $y$ such that $f(y) = 1$. Supposing that each query to the database takes something like $O(\log N) \subseteq O(\log n)$ time, this procedure halts in time $O(N \log N) \subseteq O(n \log n)$, so that the problem is in &lt;strong&gt;FP&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that the database-lookup can be done in coherent superposition, Grover's algorithm allows this problem is in &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:F#fbqp&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;FBQP&lt;/strong&gt;&lt;/a&gt;. However, as &lt;strong&gt;FP&lt;/strong&gt;&amp;nbsp;&amp;subseteq;&amp;nbsp;&lt;strong&gt;FBQP&lt;/strong&gt;, the classical exhaustive search also proves that this problem is in &lt;strong&gt;FBQP&lt;/strong&gt;. All that we obtain (up to log factors) is a quadratic speed-up due to a savings in the number of database queries.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose that the input function is described succinctly, by a polynomial-time algorithm that takes a specification $x \in \{0,1\}^n$ and an argument $y \in \{0,1\}^m$ and computes $\mathcal O : \mathcal H_2^{m+1} \!\to \mathcal H_2^{m+1}\!$ on a standard basis state $\lvert y \rangle\lvert b \rangle$, where $m$ may be much larger than $\Omega(\log n)$. An example would be where $x$ specifies the CNF form of some boolean function $f: \{0,1\}^m \to \{0,1\}$ for $m \in O(n)$, in which case we may efficiently evaluate $f(y)$ on an input $y \in \{0,1\}^m$ and thereby efficiently evaluate $\mathcal O$ on standard basis states. This puts the problem in &lt;strong&gt;FNP&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a procedure to evaluate $f(y)$ from $(x,y)$ in time $O(p(n))$ for $n = \lvert x \rvert$, Grover's algorithm solves the problem of Unstructured Search for $\mathcal O$ in time $O(p(n) \sqrt{2^m})$ $\subseteq O(p(n) \sqrt{2^n})$. This is not polynomial in $n$, and so does not suffice to put this problem in &lt;strong&gt;FBQP&lt;/strong&gt;: we only obtain a quadratic speedup &amp;mdash; though this is still a potentially huge savings of computation time, assuming that the advantage provided by Grover's algorithm is not lost to the overhead required for fault-tolerant quantum computation.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In both cases, the complexity is determined in terms of the length $n$ of the string $x$ *which specifies how to compute the oracle $\mathcal O$. In the case that $x$ represents a look-up table, we have $N = n\big/\ell$, in which case the performance as a function of $N$ is similar to the performance as a function of $n$; but in the case that $x$ succinctly specifies $\mathcal O$, and $N \in O(2^{n/2})$, the big-picture message that Grover's solves the problem in $O(\sqrt N)$ queries obscures the finer-grained message that this algorithm is still exponential-time for a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Decision complexity from relation problems&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There is a straightforward way to get decision problems from relation problems, which is well-known from the theory of &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-completeness&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;NP&lt;/strong&gt;-complete&lt;/a&gt; problems: to turn the search problem to a question of the existence of a valid solution.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;The decision version of a general search problem.&lt;/em&gt;&lt;br&gt; Given an input $x$ and an binary relation $R$, determine whether $\exists y: R(x,y)$ holds.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The complexity class &lt;a href=&quot;https://en.wikipedia.org/wiki/NP_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;NP&lt;/strong&gt;&lt;/a&gt; can essentially be defined in terms of such problems, when the relationship $R$ is efficiently computable: the most famous &lt;strong&gt;NP&lt;/strong&gt;-complete problems (CNF-SAT, HAMCYCLE, 3-COLOURING) are about the mere existence of a valid solution to an efficiently verifiable relationship problem. This switch from producing solutions to simply asserting the existence of solutions is also what allows us to describe versions of integer factorisation which are in &lt;strong&gt;BQP&lt;/strong&gt; (by asking whether &lt;em&gt;there exist&lt;/em&gt; non-trivial factors, rather than asking &lt;em&gt;for the values&lt;/em&gt; of non-trivial factors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Unstructured Search, again which complexity class best describes the problem depends on how the input is structured. Determining &lt;em&gt;whether there exists&lt;/em&gt; a solution to a relationship problem may be reduced to &lt;em&gt;finding and verifying&lt;/em&gt; a solution to that problem. Thus in the case that the input is a string $x$ specifying the oracle as a look-up table, the problem of unstructured search is in &lt;strong&gt;P&lt;/strong&gt;; and more generally if $x$ specifies an efficient means of evaluating the oracle, the problem is in &lt;strong&gt;NP&lt;/strong&gt;. It is also possible that there is a way of determining &lt;em&gt;whether there exists&lt;/em&gt; a solution to Unstructured Search which does so without actually finding a solution, though it is not clear in general how to do so in a way which would provide an advantage over actually finding a solution.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Oracle complexity&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have conspicuously been shifting from talking about the oracle $\mathcal O$, to ways that an input $x$ can be used to specify (and evaluate) the oracle $\mathcal O$. But of course, the main way in which we consider Grover's algorithm is as an oracle result in which evaluating the oracle takes a single time-step and requires no speficiation. How do we consider the complexity of the problem in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, we are dealing with a &lt;em&gt;relativised&lt;/em&gt; model of computation, in which evaluating this one specific oracle $\mathcal O$ (which, remember, is the input to the problem) is a primitive operation. This oracle is defined on all input sizes: to consider the problem for searching on strings of length $n$, you must specify that you are considering how the oracle $\mathcal O$ acts on inputs of length $n$, which again would be done by considering the length of a boolean string $x$ taken as input. In this case, the way in which we would present the problem might be as follows.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Unstructured Search relative to Oracle $\mathcal O$.&lt;/strong&gt; &lt;br&gt; Given an input $x = 11\cdots 1$ of length $n$, &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;find a $y \in \{0,1\}^n$ (relation problem) or&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;determine whether there exists a $y \in \{0,1\}^n$ (decision problem)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;such that $\mathcal O \lvert y \rangle \lvert 0 \rangle = \lvert y \rangle \lvert 1 \rangle$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This problem is in $\mathsf{NP}^{\mathcal O}$ (for the decision problem) or $\mathsf{FNP}^{\mathcal O}$ (for the relation problem), depending on which version of the problem you wish to consider. Because Grover's algorithm is not a polynomial-time algorithm, this problem is not known to be in $\mathsf{BQP}^{\mathcal O}$ or $\mathsf{FBQP}^{\mathcal O}$. In fact, we can say something stronger, as we will soon see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why I brushed over the actual, oracle-based description of Unstructured Search was in order to touch on your point of complexity, and in particular to touch on the question of &lt;em&gt;input size&lt;/em&gt;. The complexity of problems are largely governed by how the inputs are specified: as a succinct specification (in the case of how a function is specified in CNF-SAT), as an explicit specification (in the case of a look-up table for a function), or even as an integer specified in unary, i.e. as the length of a string of 1s as above (as in &quot;Unstructured Search relative to Oracle $\mathcal O$&quot; above).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see from the latter case, if we treat the input only as an oracle, the situation looks a bit un-intuitive, and it certainly makes it impossible to talk about the ways that the &quot;database&quot; can be realised. But one virtue of considering the relativised version of the problem, with an actual oracle, is that we can prove things which otherwise we have no idea how to prove. If we could prove that the decision version of the succinct unstructured search problem was in &lt;strong&gt;BQP&lt;/strong&gt;, then we would stand to realise an enormous breakthrough in practical computation; and if we could prove that the decision problem was not actually in &lt;strong&gt;BQP&lt;/strong&gt;, then we would have shown that &lt;strong&gt;P &amp;ne; PSPACE&lt;/strong&gt;, which would be an enormous breakthrough in computational complexity. We don't know how to do either. But for the relativised problem, we can show that there are oracles $\mathcal O$ for which the decision version of &quot;Unstructured Search relative to $\mathcal O$&quot; is in $\mathsf{NP}^{\mathcal O}$ but not in $\mathsf{BQP}^{\mathcal O}$. This allows us to show that while quantum computing is potentially powerful, there are reasons to expect that &lt;strong&gt;BQP&lt;/strong&gt; probably doesn't contain &lt;strong&gt;NP&lt;/strong&gt;, and that the relation version of Unstructured Search in particular is unlikely to be contained in &lt;strong&gt;FBQP&lt;/strong&gt; without imposing strong constraints on how the input is represented.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-06-02T06:07:11.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2221" PostTypeId="2" ParentId="2210" CreationDate="2018-06-02T17:36:45.990" Score="3" Body="&lt;p&gt;As pointed out in a comment, what you wrote as $\rho$ should more precisely be written as $\rho\otimes\mathbb 1$ (although the Kraus operator decomposition can be obtained similarly with any initial ancilla state, in which case you have $\rho\otimes|\phi\rangle\!\langle\phi|$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;algebraic properties of tensor product spaces&lt;/a&gt; then tell you that&#xA;$$(A\otimes B)(C\otimes D)=(AC)\otimes(BD),$$&#xA;from which you immediately get your result.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="528" LastEditDate="2018-06-10T21:14:38.180" LastActivityDate="2018-06-10T21:14:38.180" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2222" PostTypeId="1" CreationDate="2018-06-03T12:42:06.163" Score="14" ViewCount="577" Body="&lt;p&gt;I am interested in a quantum algorithm that gets as input an n-bit sequence and that produces as output a reshuffled (permuted) version of this n-bit sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. if the input is 0,0,1,1 (so n=4 in this case) then the possible answers are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0,0,1,1&lt;/li&gt;&#xA;&lt;li&gt;0,1,0,1&lt;/li&gt;&#xA;&lt;li&gt;0,1,1,0&lt;/li&gt;&#xA;&lt;li&gt;1,0,0,1&lt;/li&gt;&#xA;&lt;li&gt;1,0,1,0&lt;/li&gt;&#xA;&lt;li&gt;1,1,0,0&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that only one output should be generated which is randomly chosen among all possible valid outputs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this best be implemented in a &lt;strong&gt;quantum algorithm&lt;/strong&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution for this is already proposed as part of one of the answers for &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2209/how-to-create-a-quantum-algorithm-that-produces-2-n-bit-sequences-with-equal-num&quot;&gt;How to create a quantum algorithm that produces 2 n-bit sequences with equal number of 1-bits?&lt;/a&gt;.  But the problem with this solution is that this requires about $\binom{n}2$ help qubits which becomes rapidly huge if n is big.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Please, do not provide a classical algorithm without any explanation of how the steps of the classical algorithm can be mapped to a universal quantum computer.&lt;/li&gt;&#xA;&lt;li&gt;for me there are 2 good ways to interpret &lt;em&gt;&quot;randomly chosen among all possible good outputs&quot;&lt;/em&gt;:  (1) each possible good output has equal chance of being chosen. (2) every possible good output has a chance &gt; 0 of being chosen.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-05T11:20:08.193" LastActivityDate="2018-06-06T21:28:39.913" Title="How to permute (reshuffle) an n-bit input?" Tags="&lt;algorithm&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2223" PostTypeId="1" AcceptedAnswerId="2224" CreationDate="2018-06-03T14:47:45.380" Score="7" ViewCount="175" Body="&lt;p&gt;During the classical pre-processing stage of Simon's algorithm, we repeat the quantum operations $n-1$ times to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{alignat}{7}&#xA;y_{1} \cdot s &amp;amp; \phantom{\vdots} =~ &amp;amp;&amp;amp; 0 \\ y_{2} \cdot s &amp;amp; \phantom{\vdots}=~ &amp;amp;&amp;amp; 0 \\ &amp;amp; \phantom{=} \vdots \\ y_{n-1} \cdot s &amp;amp; \phantom{\vdots}=~ &amp;amp;&amp;amp; 0 ~,&#xA;\end{alignat}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $s$ is the period while $y_{i}$ are the linearly independent measurement outcomes of the quantum process. But, shouldn't we be requiring $n$ equations to get the value of $s$ as it is an unknown with $n$ variables? I wonder if this is because a system of $n$ equations will admit only the trivial solution of all $0$s. Is there a mathematical reasoning to elucidate this? How exactly would we uniquely solve for $n$ variables with $n-1$ equations?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="15" LastEditDate="2018-06-04T00:04:00.997" LastActivityDate="2018-06-04T00:04:00.997" Title="Simon's algorithm: Number of equations" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2224" PostTypeId="2" ParentId="2223" CreationDate="2018-06-03T18:18:36.747" Score="5" Body="&lt;p&gt;Imagine for a moment that $y_1,\ldots,y_{n-1}$ are linearly independent vectors in $\mathbb{R}^n$. There would then be a one-dimension subspace of vectors $s$ satisfying the $n-1$ equations you listed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The situation is the same here, except that the field of real numbers is replaced by the finite field $\mathbb{F}_2$ with elements 0 and 1. The same linear algebra as in the real number case works in this case, and we again obtain a one-dimensional subspace of possible solutions $s$. This time, however, because there are only two elements of $\mathbb{F}_2$, this one-dimensional subspace includes only two elements: the all-zero vector and some nonzero vector $s$. Naturally we disregard the all-zero vector and take the nonzero vector $s$ as our solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that if you did add another equation, $y_n\cdot s = 0$ for some $y_n$, then $y_n$ would have to be a linear combination of $y_1,\ldots,y_{n-1}$, for otherwise the only solution would be $s = (0,\ldots,0)$. So, you would not obtain any additional information about $s$ by adding an additional equation.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-06-03T18:18:36.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2225" PostTypeId="1" CreationDate="2018-06-04T01:53:47.593" Score="7" ViewCount="412" Body="&lt;p&gt;This is probably just a misunderstanding on my part, but everything I've seen on what quantum computers do thus far seems to suggest that the actual process of reading the entangled qubits would be equivalent to reading the value of a plate opposing a subdivided plate in a plate capacitor while the setting of initial qubits would be the equivalent of assigning a voltage to each subdivided plate.  E.g. in this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HparW.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HparW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You would be able to read the voltage on the red plate after setting independent voltages from a known range representing 0 at the low and 1 at the high on the 4 separate subdivisions of the opposing plate, then rounding off at some particular voltage to get a zero or one out of it for those 4 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this wrong?  If so, how does it differ from actual quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="2538" LastEditorUserId="26" LastEditDate="2018-12-23T12:29:31.083" LastActivityDate="2018-12-23T12:29:31.083" Title="What's the difference between a set of qubits and a capacitor with a subdivided plate?" Tags="&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2226" PostTypeId="2" ParentId="2225" CreationDate="2018-06-04T03:40:23.367" Score="5" Body="&lt;p&gt;Your capacitors cannot be in the state $\frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)$, but qubits can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say $|0\rangle$ is 0$\,$V and $|1\rangle$ is 1$\,$V.&lt;br&gt;&#xA;If you have 2 bits we can have $|00\rangle$,$|01\rangle$,$|10\rangle$,$|11\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the state: $\frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)$, is in a superposition of two of these cases. The bit values can be (0,0) &lt;strong&gt;&lt;em&gt;or&lt;/em&gt;&lt;/strong&gt; (1,1). Either case is equally possible, until a measurement is made (think Schrödinger's cat: you don't know if it's alive or dead until you open the box).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-08T01:31:24.907" LastActivityDate="2018-07-08T01:31:24.907" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2227" PostTypeId="1" CreationDate="2018-06-04T05:46:40.623" Score="6" ViewCount="171" Body="&lt;p&gt;I have been reading the paper &lt;a href=&quot;https://link.springer.com/article/10.1007%2Fs11128-017-1692-x&quot; rel=&quot;nofollow noreferrer&quot;&gt;A quantum-implementable neural network model (Chen et al., 2017)&lt;/a&gt; for a few days now, but failed to understand how exactly their algorithm offers a speedup over the classical neural network models.&lt;/p&gt;&#xA;&lt;p&gt;In particular I'm confused about what they mean by and what they are trying to do with quantum multiplexers. They haven't even defined it properly.&lt;/p&gt;&#xA;&lt;p&gt;Here's the relevant paragraph:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;One of the most interesting points of QPNN is that we can use quantum parallelism to combine several basic networks at the same time. To achieve this purpose, only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are needed in a control layer to perform the following quantum multiplexer as shown in Fig. &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left( \begin{array}{ccc} U_1 \\ &amp;amp; \ddots \\ &amp;amp;&amp;amp; U_{2^n} \end{array} \right) \tag{13}$$&lt;/span&gt;&#xA;&lt;br/&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o5wqX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o5wqX.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; represents the dynamics of the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th basic network. Moreover &lt;span class=&quot;math-container&quot;&gt;$2^{n}$&lt;/span&gt; different quantum gates &lt;span class=&quot;math-container&quot;&gt;$\left\{P^{(i)}|i=1, \dots ,2^{n}\right\}$&lt;/span&gt; can also be applied on the output layer of each &lt;strong&gt;basic network&lt;/strong&gt; respectively.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What does &lt;span class=&quot;math-container&quot;&gt;$i^{\text{th}}$&lt;/span&gt; &lt;strong&gt;basic network&lt;/strong&gt; mean in this context?&lt;/li&gt;&#xA;&lt;li&gt;What is quantum multiplexer and how exactly is it helping in this context? What is meant by the matrix shown in &lt;span class=&quot;math-container&quot;&gt;$(13)$&lt;/span&gt;?  (I read a few papers on quantum multiplexers which say that they are basically used to transfer information contained by several qubits as information in a qudit. But no idea how that is relevant &lt;em&gt;here&lt;/em&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;What do they mean by &amp;quot;we can use quantum&#xA;parallelism to combine several basic networks at the same time&amp;quot;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-07-13T14:44:00.237" Title="What do &quot;$i$-th basic network&quot;, &quot;quantum multiplexers&quot; and &quot;quantum parallelism&quot; mean in this context? How are they beneficial?" Tags="&lt;machine-learning&gt;&lt;neural-network&gt;&lt;multiplexer&gt;&lt;quantum-parallelism&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2228" PostTypeId="1" AcceptedAnswerId="2235" CreationDate="2018-06-04T06:48:49.567" Score="9" ViewCount="2338" Body="&lt;p&gt;I would like to simulate a quantum algorithm where one of the steps is &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Square_root_of_Swap_gate_(%E2%88%9AS)&quot; rel=&quot;noreferrer&quot;&gt;&quot;Square root of Swap gate&quot;&lt;/a&gt; between 2 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I implement this step using the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/editor&quot; rel=&quot;noreferrer&quot;&gt;IBM composer&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="26" LastEditDate="2018-12-23T13:45:25.643" LastActivityDate="2020-02-06T22:02:33.840" Title="How to implement the &quot;Square root of Swap gate&quot; on the IBM Q (composer)?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2229" PostTypeId="2" ParentId="2209" CreationDate="2018-06-04T06:50:14.190" Score="0" Body="&lt;p&gt;I know we already have an answer here, but going back to the problem specification, there's a much simpler way to achieve this if the only thing that's important is the output, comprising a binary string. All the protocol actually has to do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Select an $n$-bit string, $x\in\{0,1\}^n$ at random. If you don't want to trust classical randomness, use $n$ qubits, starting in $|0\rangle$, with Hadamard acting on them, and measure in the computational basis. In fact, just use 1 qubit, and repeat the same thing $n$ times with it.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let $w_x$ be the Hamming weight of $x$ (i.e. the number of 1s). Select a random $y\in\{0,1\}^n$ such that $w_y=w_x$. There are several ways you might do this, but, for example, use $m=\lceil\log_2\binom{n}{w_x}\rceil$ bits. Generate an answer $z\in\{0,1\}^m$ uniformly at random (i.e. $p_z=1/2^m$). $\binom{n}{w_x}$ of these strings $z$ can be mapped onto a suitable $y$. If a given answer cannot, just keep choosing a random $z$ until it can. On average, you won't need more than 2 gos.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Give the answer $x,y$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-04T09:15:44.350" LastActivityDate="2018-06-04T09:15:44.350" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2230" PostTypeId="1" AcceptedAnswerId="5123" CreationDate="2018-06-04T09:13:08.030" Score="11" ViewCount="1140" Body="&lt;p&gt;In order to rotate about an axis of the Bloch sphere we ususally use pulses e.g. in trapped ion quantum computing or superconducting qubits. Let's say we have rotation around the x-axis. What do I have to change in order to be able to rotate around the y-axis or the z-axis? I assume it has something to do with the phase but I could not find a good reference for how this works.&lt;/p&gt;&#xA;" OwnerUserId="1853" LastEditorUserId="26" LastEditDate="2018-12-23T13:44:47.710" LastActivityDate="2019-01-06T14:27:35.453" Title="Rotating about the y- or z-axis of the Bloch sphere" Tags="&lt;quantum-gate&gt;&lt;experiment&gt;&lt;superconducting-quantum-computing&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2232" PostTypeId="2" ParentId="2222" CreationDate="2018-06-04T12:45:25.967" Score="0" Body="&lt;p&gt;A quantum computer can do classical computations. &#xA;The optimal algorithm would be to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pick any bit (the fastest one you can get access to). &lt;/li&gt;&#xA;&lt;li&gt;Find a bit that has the opposite value (if in step 1 you got a 0, find a 1)&lt;/li&gt;&#xA;&lt;li&gt;Switch them (0 becomes 1 and 1 becomes 0).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Step 2 involves searching through an $N$ bit string which using classical operations takes $\mathcal{O}(N)$ operations, but if you can get the $n^{\textrm{th}}$ bit value by evaluating a function, you may be able to use Grover's quantum algorithm to find the opposite bit with $\mathcal{O}\left(\sqrt{N}\right)$ operations.  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-04T12:45:25.967" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2233" PostTypeId="2" ParentId="2222" CreationDate="2018-06-04T14:54:28.543" Score="5" Body="&lt;p&gt;It could be done with $\lceil\log n\rceil$ additional qubits along these lines:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;Transform the additional qubits so that they encode a number&#xA;  $k\in\{0,\ldots,n-1\}$ chosen uniformly at random.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Cyclically shift the input qubits $k$ times.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Let the last of the original input qubits be fixed as an output and recurse on the remaining $n-1$ of them.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a classical algorithm, but you can run it on a quantum computer of course, as Norbert has suggested in a comment. (The aspect of the question that is adamant about the algorithm being quantum is still not clear to me, so if running a classical algorithm such as the one I have suggested on a quantum computer is not sufficient, it would be helpful for the question to be clarified.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that because the question asks for a random output, the algorithm is going to have to generate entropy at some point, presumably through measurements or performing other non-unitary operations on qubits (such as initializing them). In the algorithm above, it is the first step that generates entropy: regardless of the state of the additional qubits before the operation in step 1 is performed, they should have the state&#xA;$$&#xA;\frac{1}{n} \sum_{k = 0}^{n-1} \lvert k \rangle \langle k \rvert&#xA;$$&#xA;after step 1 is performed (with $k$ encoded in binary, let's say).&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-06-04T14:54:28.543" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2234" PostTypeId="2" ParentId="2228" CreationDate="2018-06-04T16:49:54.507" Score="0" Body="&lt;p&gt;Every 2-qubit gate has a &quot;Paulinomial decomposition&quot; which means it can be written as a polynomial of Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the gate you want:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;\sqrt{ \mbox{SWAP} } = &#xA;\begin{bmatrix} &#xA;1  &amp;amp;  0  &amp;amp;  0  &amp;amp;  0  \\&#xA;0  &amp;amp;  \frac{1}{{2}} (1+i)  &amp;amp;  \frac{1}{{2}} (1-i)  &amp;amp;  0  \\&#xA;0  &amp;amp;  \frac{1}{{2}} (1-i)  &amp;amp;  \frac{1}{{2}} (1+i)  &amp;amp;  0  \\&#xA;0  &amp;amp;  0  &amp;amp;  0  &amp;amp;  1 \\&#xA;\end{bmatrix} = \frac{1-i}{4}\left(X_1X_2+Y_1Y_2+Z_1Z_2\right) +\frac{3+i}{2}I,&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $X_i$ is an $X$ gate applied to the $i^\textrm{th}$ qubit.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-04T16:59:17.920" LastActivityDate="2018-06-04T16:59:17.920" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="2235" PostTypeId="2" ParentId="2228" CreationDate="2018-06-04T22:42:34.260" Score="10" Body="&lt;p&gt;Here is &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%5E-%C2%BD%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A6%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%5D%2C%5B%22Z%5E-%C2%BC%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;a SQRT(SWAP) construction&lt;/a&gt; which only requires CNOTs in one direction, Hadamards, S gates (&lt;span class=&quot;math-container&quot;&gt;$Z^{\frac{1}{2}}$&lt;/span&gt;), S dagger gates (&lt;span class=&quot;math-container&quot;&gt;$Z^{-\frac{1}{2}}$&lt;/span&gt;), T gates (&lt;span class=&quot;math-container&quot;&gt;$Z^{\frac{1}{4}}$&lt;/span&gt;) and T dagger gates (&lt;span class=&quot;math-container&quot;&gt;$Z^{-\frac{1}{4}}$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oIKp0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oIKp0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to encode it directly into the composer.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="-1" LastEditDate="2020-02-06T22:02:33.840" LastActivityDate="2020-02-06T22:02:33.840" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="2236" PostTypeId="2" ParentId="2228" CreationDate="2018-06-04T23:22:16.143" Score="3" Body="&lt;p&gt;What you want to do is a rotation on the subspace spanned by $|01\rangle$ and $|10\rangle$ which rotates it by $\sqrt{X}$.  To this end, you can first do a CNOT, which maps this subspace to $\{|01\rangle,|11\rangle\}$.  Now you need to do the $\sqrt{X}$ rotation on the first qubit, conditioned on the second qubit being one.  Implementing controlled-$U$ gates using CNOTs is a standard construction, which can be found in a range of places, see e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9503016&lt;/a&gt;. Depending how you do this step, you might have to fix the &quot;global&quot; phase of the 1st qubit (given the 2nd is $|1\rangle$).  Finally, you need to undo the CNOT.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-06-04T23:22:16.143" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2237" PostTypeId="2" ParentId="2225" CreationDate="2018-06-05T09:46:35.167" Score="2" Body="&lt;p&gt;It looks like you are asking about the possibility of encoding the mathematics of quantum states &amp;amp; measurement into some kind of analog device. And yes, I think this is possible. This reminds me of how people study &lt;a href=&quot;https://en.wikipedia.org/wiki/Analog_models_of_gravity&quot; rel=&quot;nofollow noreferrer&quot;&gt;analog models of gravity&lt;/a&gt;. The one problem I can see with this is that it will not scale very well as you increase the number of entangled quantum systems. Eg. for every extra qubit added to a system you &lt;em&gt;double&lt;/em&gt; the number of dimensions. So for 10 qubits you would need a capacitor plate with 1024 subdivisions, and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, what you are proposing is to simulate a quantum system with an analog computer. We already do this with digital computers, but it just doesn't scale.&lt;/p&gt;&#xA;" OwnerUserId="263" LastActivityDate="2018-06-05T09:46:35.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2238" PostTypeId="1" AcceptedAnswerId="2241" CreationDate="2018-06-05T09:59:30.530" Score="8" ViewCount="510" Body="&lt;p&gt;I am learning how to program the IBM Q Experience quantum computers in order to learn more about how does it work and in order to perform some experiments in it. By doing so I was wondering what are the most advanced things that have been done in such computers that actually are an advance for quantum technologies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specfically, I am interested in what have been done in quantum error correction code implementation and testing in those, and if some papers about those implementations and techniques used are available.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-12-13T19:51:55.860" LastActivityDate="2018-12-13T19:51:55.860" Title="Practical Implementations of QECCs in IBM Q Experience" Tags="&lt;error-correction&gt;&lt;resource-request&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2239" PostTypeId="2" ParentId="2222" CreationDate="2018-06-05T11:57:34.807" Score="3" Body="&lt;p&gt;Note: this answer assumes you want the permutation to be &lt;em&gt;coherent&lt;/em&gt;, i.e. you want $\frac{1}{\sqrt{3}} ( |001\rangle + |010\rangle + |100\rangle)$ instead of a 1/3 chance of $001$, a 1/3 chance of $010$, and a 1/3 chance of $100$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be careful how you specify this task, because it could very easily be impossible due to reversibility constraints. For example, for the input $|001\rangle$ you want to output the GHZ state $\left| {3 \atop 1} \right\rangle = \frac{1}{\sqrt{3}} (|001\rangle + |010\rangle + |100\rangle)$. But if you also want to output the GHZ state for the input $|010\rangle$ and $|100\rangle$, that won't work. You can't send multiple input states to the same output state (without decoherence). As long as you say &quot;I only care about sorted-ascending inputs like 0000111 but not 1110000 or 0010110; you can do whatever you want with those&quot;, this will be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One trick to producing a quantum permutation of a sorted input is to first prepare a &quot;permutation state&quot; by applying a sorting network to a list of seed values each in a uniform superposition. The sorting network will output qubits holding the sorted seeds, but also qubits holding the sorting network comparisons. The permutation state is just the comparison qubits. To apply it to your input, you simply run the input through the sorting network in reverse. Note that there are some tricky details here; see the paper &quot;&lt;a href=&quot;https://arxiv.org/abs/1711.10460&quot; rel=&quot;nofollow noreferrer&quot;&gt;Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians&lt;/a&gt;&quot;. You would have to generalize this technique to work on inputs with repeated values, instead of only unique values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also want to look into &quot;&lt;a href=&quot;https://arxiv.org/abs/1410.3941&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum compression&lt;/a&gt;&quot;, which is very closely tied to the $\left| {n \atop k} \right\rangle$ states (uniform superpositions of all $n$-bit states with $k$ bits set) that you want to produce. The main difference is that you would run the quantum compression circuit in reverse, and it expects a number encoding &quot;how many ones are there?&quot; instead of &quot;give me a state with the correct number of ones&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess what I'm saying is that producing these kinds of states is more complicated than you might have expected. I think the reason it is complicated is because the magnitude of the amplitudes in your outputs depend on the computational basis state of your input. For example, for $|0001\rangle$ you want an output which is a superposition of four classical states, so you have a prefactor of $\frac{1}{\sqrt{4}}$ hidden inside $\left| {4 \atop 1} \right\rangle$. But for $|0011\rangle$ the desired output has six classical states and so $\left| {4 \atop 2} \right\rangle$ hides a prefactor of $\frac{1}{\sqrt{6}}$.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-06-05T12:17:39.020" LastActivityDate="2018-06-05T12:17:39.020" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2240" PostTypeId="2" ParentId="2238" CreationDate="2018-06-05T12:12:11.340" Score="2" Body="&lt;p&gt;You might find the paper &lt;a href=&quot;https://arxiv.org/abs/1708.02297&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Automated Error Correction in IBM Quantum Computer and Explicit Generalization&quot; (2017)&lt;/a&gt; by Panigrahi et al. relevant. As for &quot;&lt;em&gt;what are the most advanced things that have been done in such computers that actually are an advance for quantum technologies&lt;/em&gt;&quot;,  if you search a bit on &lt;a href=&quot;https://arxiv.org/search/?searchtype=author&amp;amp;query=Panigrahi%2C+P+K&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv&lt;/a&gt; you'll find quite a few relevant papers published by them. One such recent example which I personally had found quite interesting is: &quot;&lt;a href=&quot;https://arxiv.org/abs/1806.00781&quot; rel=&quot;nofollow noreferrer&quot;&gt;Application of quantum scrambling in Rydberg atom on IBM quantum computer&quot; (2018)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Disclosure&lt;/strong&gt;: I'm currently an undergraduate member of Prof. Panigrahi's group.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-05T12:29:49.077" LastActivityDate="2018-06-05T12:29:49.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2241" PostTypeId="2" ParentId="2238" CreationDate="2018-06-05T13:13:32.973" Score="4" Body="&lt;p&gt;The publicly available IBM devices don't yet have the connectivity to realize quantum error correcting codes that both detect and correct a full set of quantum errors. But we can certainly do proof-of-principle experiments on the tools and techniques required. Here are the experiments I know of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error correction experiments done (or doable) on a 5 qubit device:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1410.6419&quot; rel=&quot;nofollow noreferrer&quot;&gt;Detecting arbitrary quantum errors via stabilizer measurements on a sublattice of the surface code&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1705.08957&quot; rel=&quot;nofollow noreferrer&quot;&gt;Is error detection helpful on IBM 5Q chips?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1705.09259&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental demonstration of fault-tolerant state preparation with superconducting qubits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1709.01866&quot; rel=&quot;nofollow noreferrer&quot;&gt;Protecting quantum memories using coherent parity check codes&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error correction experiments on the 16 qubit device.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1709.00990&quot; rel=&quot;nofollow noreferrer&quot;&gt;A repetition code of 15 qubits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;Disclosure: The last one is mine.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-05T13:13:32.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2242" PostTypeId="1" CreationDate="2018-06-05T14:22:02.553" Score="11" ViewCount="1520" Body="&lt;p&gt;I was wondering if there is a way to compose a program with multiple quantum circuits without having the register reinitialized at $0$ for each circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I would like run a second quantum circuit after running the first one, as in this example: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qp = QuantumProgram()&#xA;qr = qp.create_quantum_register('qr',2)&#xA;cr = qp.create_classical_register('cr',2)&#xA;&#xA;qc1 = qp.create_circuit('B1',[qr],[cr])&#xA;qc1.x(qr)&#xA;&#xA;qc1.measure(qr[0], cr[0])&#xA;qc1.measure(qr[1], cr[1])&#xA;&#xA;qc2 = qp.create_circuit('B2', [qr], [cr])&#xA;qc2.x(qr)&#xA;qc2.measure(qr[0], cr[0])&#xA;qc2.measure(qr[1], cr[1])&#xA;&#xA;#qp.add_circuit('B1', qc1)&#xA;#qp.add_circuit('B2', qc2)&#xA;&#xA;pprint(qp.get_qasms())&#xA;&#xA;result = qp.execute()&#xA;&#xA;print(result.get_counts('B1'))&#xA;print(result.get_counts('B2'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, what I get is the same result for the two runs (i.e. a count of &lt;code&gt;11&lt;/code&gt; for the &lt;code&gt;B1&lt;/code&gt; and &lt;code&gt;B2&lt;/code&gt; instead of &lt;code&gt;11&lt;/code&gt; and &lt;code&gt;00&lt;/code&gt; for the second, as if &lt;code&gt;B2&lt;/code&gt; is run on a completely new state initialized on &lt;code&gt;00&lt;/code&gt; after &lt;code&gt;B1&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1644" LastEditorUserId="26" LastEditDate="2019-03-12T09:31:16.500" LastActivityDate="2019-03-12T09:31:16.500" Title="Composing multiple quantum circuits in single quantum program in QISKit" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2243" PostTypeId="2" ParentId="2242" CreationDate="2018-06-05T17:49:18.653" Score="0" Body="&lt;p&gt;Once you do a measurement, the wavefunction of the quantum state/register collapses and it loses its quantum nature. It doesn't make sense to apply another circuit on it. &lt;/p&gt;&#xA;" OwnerUserId="2527" LastActivityDate="2018-06-05T17:49:18.653" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2244" PostTypeId="1" CreationDate="2018-06-05T21:39:37.367" Score="17" ViewCount="591" Body="&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;noreferrer&quot;&gt;boson sampling&lt;/a&gt;, if we start with 1 photon in each of the first $M$ modes of an interferometer, the probability of detecting 1 photon in each output mode is: $|\textrm{Perm}(A)|^2$, where the columns and rows of $A$ are the first $M$ columns of the interferometer's unitary matrix $U$, and all of its rows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This makes it look like for any unitary $U$, we can construct the appropriate interferometer, construct the matrix $A$, and calculate the absolute value of the permanent of $A$ by taking the square root of the probability of detecting one photon in each mode (which we get from the boson sampling experiment). &lt;strong&gt;&lt;em&gt;Is this true, or is there some catch?&lt;/em&gt;&lt;/strong&gt; People have told me that you can't actually get information about a permanent from boson sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what happens to the rest of the columns of $U$: How exactly is it that the experimental outcome only depends on the first $M$ columns of $U$ and all of its rows, but not at all on the other columns of $U$? &lt;strong&gt;&lt;em&gt;Those columns of $U$ do  not affect the outcome of the experiment in the first $M$ modes at all?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="55" LastEditDate="2020-09-10T11:47:16.943" LastActivityDate="2020-09-10T11:47:16.943" Title="Is it possible to &quot;calculate&quot; the absolute value of a permanent using Boson Sampling?" Tags="&lt;classical-computing&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;&lt;boson-sampling&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2245" PostTypeId="2" ParentId="2244" CreationDate="2018-06-06T05:18:04.480" Score="8" Body="&lt;p&gt;It appears to be true, up to a point. As I read Scott Aaronson's &lt;a href=&quot;https://arxiv.org/abs/1011.3245?context=cs&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt;, it says that if you start with 1 photon in each of the first $M$ modes of an interferometer, and find the probability $P_S$ that a set $s_i$ photons is output in each mode $i\in\{1,\ldots, N\}$ where $\sum_is_i=M$, is&#xA;$$&#xA;P_s=\frac{|\text{Per(A)}|^2}{s_1!s_2!\ldots s_M!}.&#xA;$$&#xA;So, indeed, if you take a particular instance where $s_i=0$ or 1 for every possible output, then, yes the probability is equal to the permanent of $A$, where $A$ is the first $M$ columns of $U$ and a specific subset of $M$ rows specified by the locations $s_i=1$. So, this is not quite as specified in the question: it is not all rows, but only some subset, so that $A$ is a square matrix, corresponding to the bits that the experiment &quot;sees&quot;, i.e. the input rows and output rows. The photons never populate anything else, and so are blind to the other elements of the unitary matrix $U$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be fairly obvious. Let's say I have some $3\times 3$ matrix $V$. If I start in some basis state $|0\rangle$ and find its product, $V|0\rangle$, then knowing that tells me very little about the outputs $V|1\rangle$ and $V|2\rangle$, aside from what can be said from the knowledge that $V$ is unitary, and hence columns and rows are orthonormal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue that one must be careful of is the accuracy: you run this once and all you get is a single sample according to the probability distribution $P_s$. You run this a few times, and you start to build up information about the different probabilities. You run this enough times, and you can get an arbitrarily accurate answer, but how many is enough? There are two different ways that you can measure the error in an estimate of a value $p$. You can demand either an additive error $p\pm\epsilon$ or a multiplicative error, $p(1\pm\epsilon)$. Since we expect that a typical probability will be exponentially small in $n+m$, the multiplicative error demands far greater accuracy, which cannot be achieved efficiently via sampling. On the other hand, the additive error approximation can be achieved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While a multiplicative error is what people &lt;em&gt;usually&lt;/em&gt; want to calculate, the additive error can also be an interesting entity. For example, in the evaluation of the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;noreferrer&quot;&gt;Jones polynomial&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aaronson points us back further in time for where this connection between Boson sampling and the Permanent was first made:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It has been known since work by &lt;a href=&quot;https://link.springer.com/article/10.1007/BF02781659&quot; rel=&quot;noreferrer&quot;&gt;Caianiello&lt;/a&gt; in 1953 (if not earlier) that the amplitudes for $n$-boson processes can be written as the permanents of $n\times n$ matrices.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Instead, their main contribution&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;is to prove a connection between the ability of classical computers to solve the approximate&#xA;  BosonSampling problem and their ability to approximate the permanent&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;i.e. to understand the approximation problem associated with, e.g. finite sampling, and to describe the computational complexity consequences associated: that we believe such a thing is hard to evaluate classically.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-07T06:54:08.290" LastActivityDate="2018-06-07T06:54:08.290" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2246" PostTypeId="2" ParentId="2244" CreationDate="2018-06-06T10:56:51.540" Score="6" Body="&lt;p&gt;You cannot &lt;em&gt;efficiently&lt;/em&gt; recover the absolute values of the amplitudes, but if you allow for arbitrary many samples, then you can estimate them to whatever degree of accuracy you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, if the input state is a single photon in each of the first $n$ modes, and one is willing to draw an arbitrary number of samples from the output, then it is in principle possible to estimate the permanent of $A$ to whatever degree of accuracy one likes, by counting the fraction of the times the $n$ input photons come out in the first $n$ different output ports.&#xA;It is to be noted though that this does not really have much to do with BosonSampling, as the hardness result holds in the regime of the number of modes much larger than the number of photons, and it's about the efficiency of the sampling.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;BosonSampling&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I'll try a very brief introduction to what boson sampling is, but it should be noted that I cannot possibly do a better job at this than Aaronson himself, so it's probably a good idea to have a look at the related blog posts of his (e.g. &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=473&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog/?p=473&lt;/a&gt; and &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=1177&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog/?p=1177&lt;/a&gt;), and links therein.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BosonSampling is a &lt;em&gt;sampling&lt;/em&gt; problem. This can be a little bit confusing in that people are generally more used to think of problems having definite answers.&#xA;A sampling problem is different in that the solution to the problem is &lt;em&gt;a set of samples&lt;/em&gt; drawn from some probability distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the problem a boson sampler solves is that of &lt;em&gt;sampling&lt;/em&gt; from a specific probability distribution. More specifically, &lt;em&gt;sampling&lt;/em&gt; from the probability distribution of the possible outcome (many-boson) states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider as a simple example a case with 2 photons in 4 modes, and let's say we fix the input state to be $(1,1,0,0)\equiv|1,1,0,0\rangle$ (that is, a single photon in each of the two first two input modes).&#xA;Ignoring the output states with more than one photon in each mode, there are $\binom{4}{2}=6$ possible output two-photon states:&#xA;$(1,1,0,0), (1,0,1,0), (1,0,0,1), (0,1,1,0), (0,1,0,1)$ and $(0,0,1,1)$.&#xA;Let us denote for convenience with $o_i, i=1,.,6$ the $i$-th one (so, for example, $o_2=(1,0,1,0)$).&#xA;Then, a possible solution to BosonSampling could be the series of outcomes:&#xA;$$o_1, o_4, o_2, o_2, o_5.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make an analogy to a maybe more familiar case, it's like saying that we want to sample from a Gaussian probability distribution.&#xA;This means that we want to find a sequence of numbers which, if we draw enough of them and put them into a histogram, will produce something close to a Gaussian.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Computing permanents&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It turns out that the probability amplitude of a given input state $|\boldsymbol r\rangle$ to a given output state $|\boldsymbol s\rangle$ is (proportional to) the &lt;a href=&quot;https://en.wikipedia.org/wiki/Permanent_(mathematics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;permanent&lt;/a&gt; of a suitable matrix built out of the unitary matrix characterizing the (single-boson) evolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, if $\boldsymbol R$ denotes the &lt;em&gt;mode assignment list&lt;/em&gt;${}^{(1)}$ associated to $|\boldsymbol r\rangle$, $\boldsymbol S$ that of $|\boldsymbol s\rangle$, and $U$ is the unitary matrix describing the evolution, then the probability amplitude $\mathcal A(\boldsymbol r\to\boldsymbol s)$ of going from $|\boldsymbol r\rangle$ to $|\boldsymbol s\rangle$ is given by&#xA;$$\mathcal A(\boldsymbol r\to\boldsymbol s) =&#xA;\frac{1}{\sqrt{\boldsymbol r!\boldsymbol s!}} \operatorname{perm} U[\boldsymbol R|\boldsymbol S],&#xA;$$&#xA;with $U[\boldsymbol R|\boldsymbol S]$ denoting the matrix built by taking from $U$ the rows specified by $\boldsymbol R$ and the columns specified by $\boldsymbol S$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, considering the fixed input state $|\boldsymbol r_0\rangle$, the probability distribution of the possible outcomes is given by the probabilities&#xA;$$p_{\boldsymbol s} = \frac{1}{\boldsymbol r_0! \boldsymbol s!} \lvert&#xA;\operatorname{perm}U[\boldsymbol R|\boldsymbol S]&#xA;\rvert^2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;BosonSampling is the problem of drawing &quot;points&quot; according to this distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;This is not the same as computing the probabilities $p_s$&lt;/em&gt;&lt;/strong&gt;, or even computing the permanents themselves.&#xA;Indeed, &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling#The_complexity_of_the_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;computing the permanents of complex matrices is hard&lt;/a&gt;, and it is not expected even for quantum computers to be able to do it efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gist of the matter is that &lt;em&gt;sampling from a probability distribution&lt;/em&gt; is in general easier than &lt;em&gt;computing the distribution itself&lt;/em&gt;.&#xA;While a naive way to sample from a distribution is to compute the probabilities (if not already known) and use those to draw the points, there might be smarter ways to do it.&#xA;A boson sampler is something that is able to draw points according to a specific probability distribution, &lt;strong&gt;&lt;em&gt;even though the probabilities making up the distribution itself are not known&lt;/em&gt;&lt;/strong&gt; (or better said, not efficiently computable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, while it may look like the ability to efficiently &lt;em&gt;sample&lt;/em&gt; from a distribution should translate into the ability of efficiently estimating the underlying probabilities, this is not the case as soon as there are exponentially many possible outcomes.&#xA;This is indeed the case of boson sampling with uniformly random unitaries (that is, the original setting of BosonSampling), in which there are $\binom{m}{n}$ possible $n$-boson in $m$-modes output states (again, neglecting states with more than one boson in some mode). For $m\gg n$, this number increases exponentially with $n$.&#xA;This means that, in practice, you would need to draw an exponential number of samples to even have a decent chance of seeing a single outcome more than once, let alone estimate with any decent accuracy the probabilities themselves (it is important to note that this is not the core reason for the hardness though, as the exponential number of possible outcomes could be overcome with smarter methods).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some particular cases, it is possible to efficiently estimate the permanent of matrices using a boson sampling set-up. This will only be feasible if one of the submatrices has a large (i.e. not exponentially small) permanent associated with it, so that the input-output pair associated with it will happen frequently enough for an estimate to be feasible in polynomial time. This is a very atypical situation, and will not arise if you draw unitaries at random. For a trivial example, consider matrices that are very close to identity - the event in which all photons come out in the same modes they came in will correspond to a permanent which can be estimated experimentally. Besides only being feasible for some particular matrices, a careful analysis of the statistical error incurred in evaluating permanents in this way shows that this is not more efficient than known classical algorithms for approximating permanents (technically, within a small additive error) ${}^{(2)}$.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Columns involved&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Let $U$ be the unitary describing the one-boson evolution.&#xA;Then, basically by definition, the output amplitudes describing the evolution of a &lt;em&gt;single&lt;/em&gt; photon entering in the $k$-th mode are in the $k$-th column of $U$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The unitary describing the evolution of the &lt;em&gt;many-boson&lt;/em&gt; states, however, is not actually $U$, but a bigger unitary, often denoted by $\varphi_n(U)$, whose elements are computed from permanents of matrices built out of $U$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Informally speaking though, if the input state has photons in, say, the first $n$ modes, then naturally only the first $n$ columns of $U$ must be necessary (and sufficient) to describe the evolution, as the other columns will describe the evolution of photons entering in modes that we are not actually using.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(1) This is just another way to describe a many-boson state. Instead of characterizing the state as the list of &lt;em&gt;occupation numbers&lt;/em&gt; for each mode (that is, number of bosons in first mode, number in second, etc.), we characterize the states by naming the mode occupied by each boson.&#xA;So, for example, the state $(1, 0, 1, 0)$ can be equivalently written as $(1, 3)$, and these are two equivalent ways to say that there is one boson in the first and one boson in the third mode.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2): S. Aaronson and T. Hance. &quot;Generalizing and Derandomizing Gurvits's Approximation Algorithm for the Permanent&quot;. &lt;a href=&quot;https://eccc.weizmann.ac.il/report/2012/170/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://eccc.weizmann.ac.il/report/2012/170/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-08-16T09:03:56.637" LastActivityDate="2018-08-16T09:03:56.637" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2247" PostTypeId="2" ParentId="2004" CreationDate="2018-06-06T12:50:33.920" Score="4" Body="&lt;p&gt;Grover's algorithm is used extensively in quantum cryptography as well. It can be used to solve problems such as the Transcendental Logarithm Problem, Polynomial Root Finding Problem etc.&lt;/p&gt;&#xA;" OwnerUserId="2556" LastActivityDate="2018-06-06T12:50:33.920" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2248" PostTypeId="1" CreationDate="2018-06-06T13:08:27.133" Score="10" ViewCount="972" Body="&lt;p&gt;D-Wave makes use of a $(n,k=4)$-Chimera structured graph in their computers. Meaning a $n\times n$ grid of unit cells, with each unit cell consisting of a complete bipartite graph on $2k=8$ nodes ($4$ for each side), also called $K_{4,4}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why did D-Wave chose $k=4$? An argument given is that this non-planar structure allows for an embedding of many interesting problems. However, $K_{3,3}$ is also a non-planar graph. So why not choose $k=3$? Additionally, increasing $k$ seems to me as one of the easiest ways to increase the number of qubits your problem has. So why not use $k=5,6,\dots$? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="2293" LastEditDate="2018-06-06T23:41:54.180" LastActivityDate="2018-10-21T03:51:15.620" Title="Why did D-Wave choose the Chimera graph the way they did?" Tags="&lt;architecture&gt;&lt;d-wave&gt;&lt;chimera&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2250" PostTypeId="2" ParentId="2248" CreationDate="2018-06-06T17:43:10.373" Score="4" Body="&lt;p&gt;You are right that $K_{3,3}$ is non-planar, but as you said yourself, a larger $k$ is much better. If they could do $K_{1000,1000}$ that would be nice, because each qubit could be coupled to 1002 qubits (1000 within the $K_{1000,1000}$ and two to the neighboring cells). Instead D-Wave is limited to problems which can be embedded such that each qubit couples to at most 6 other qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason they don't have larger $k$ is for physical reasons. It is harder to couple a qubit to 1002 qubits than it is to couple it to 6 qubits. It is also harder to couple a qubit to 6 qubits vs 5 qubits, but they found that it was easy enough to go to $k=4$, so they were not limited to $K_{3,3}$.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-06T23:42:56.120" LastActivityDate="2018-06-06T23:42:56.120" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2251" PostTypeId="1" AcceptedAnswerId="2253" CreationDate="2018-06-06T19:10:05.423" Score="5" ViewCount="1751" Body="&lt;p&gt;How would you check if 2 qubits are orthogonal with respect to each other?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to know this to solve this problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You are given $2$ quantum bits:$$&#xA;\begin{align}&#xA;|u_1\rangle &amp;amp;= \cos\left(\frac{x}{2}\right) |0\rangle + \sin\left(\frac{x}{2}\right)e^{in} |1\rangle \tag{1}  \\[2.5px]&#xA;|u_2\rangle &amp;amp;= \cos\left(\frac{y}{2}\right) |0\rangle + \sin\left(\frac{y}{2}\right)e^{im} |1\rangle \tag{2}&#xA;\end{align}&#xA;$$where $m-n = \pi$ and $x+y=\pi$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:29:48.760" LastActivityDate="2018-12-23T12:29:48.760" Title="How to check if 2 quantum bits are orthogonal?" Tags="&lt;quantum-state&gt;" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2252" PostTypeId="2" ParentId="2251" CreationDate="2018-06-06T19:32:59.777" Score="3" Body="&lt;p&gt;In order to check if two qubits are orthogonal, you should check that the inner product between them equals zero. This can be written like&#xA;$\langle u_1|u_2\rangle=0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Knowing that $\langle 0|0\rangle=1$, $\langle 0|1\rangle=0$, $\langle 1|0\rangle=0$ and $\langle 1|1\rangle=1$ it should be easy to solve the problem by yourself.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-06-06T19:32:59.777" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2253" PostTypeId="2" ParentId="2251" CreationDate="2018-06-07T06:14:27.243" Score="4" Body="&lt;p&gt;Keep in mind that $|0\rangle$ and $|1\rangle$ are &lt;a href=&quot;https://en.wikipedia.org/wiki/Orthonormality&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthonormal&lt;/a&gt; basis vectors of a two-dimensional complex vector space (over the field of complex numbers). To check whether $|u_1\rangle$ and $|u_2\rangle$ are orthogonal you'll have to check whether the standard inner product $\langle u_1|u_2\rangle$ is $0$. Here $\langle u_1|$ refers to the bra vector corresponding to the ket vector $|u_1\rangle$. In matrix notation that would simply mean that $\langle u_1|$ is the complex conjugate transpose a.k.a Hermitian conjugate of $|u_1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|u_1\rangle = \cos(\frac{x}{2}) \begin{bmatrix} 1 \\ 0 \end{bmatrix} + (\sin(\frac{x}{2}))e^{in} \begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|u_2\rangle = \cos(\frac{y}{2}) \begin{bmatrix} 1 \\ 0 \end{bmatrix} + (\sin(\frac{y}{2}))e^{im} \begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you'll find $\langle u_1|$ to be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\cos(\frac{x}{2}) \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix} + (\sin(\frac{x}{2}))e^{-in} \begin{bmatrix} 0 &amp;amp; 1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, simply carry out the multiplication of the matrices $\langle u_1|$ and $ |u_2\rangle$. If it turns out to be $0$, they're orthogonal. Or else they're not orthogonal.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-06-07T06:14:27.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2254" PostTypeId="2" ParentId="2251" CreationDate="2018-06-07T07:08:53.297" Score="4" Body="&lt;p&gt;Instead of doing matrix calculation you can also map those qubits to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;.  A Bloch sphere is a unit 2-sphere, with antipodal points corresponding to a pair of mutually orthogonal state vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you can show that the 2 points are antipodal on a Bloch sphere, then you have proven that they are orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice thing is that your qubits are already expressed in a way that can easily be mapped on the bloch sphere (x, y, n and m correspond to the angles on the Bloch sphere).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So giving the angles it is easy to determine if they are antipodal as in that case the corresponding angles must differ with $\pi + n.2\pi$ where n is a positive or negative natural number (note that in case $\theta =0 + n\pi$ is a special case as in that case we should ignore angle $\psi$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the question it is already stated that the angles m and n differ with $\pi$ so we only need to look at the angles x and y and so we can conclude that only under the following condition will the above 2 qubits be orthogonal&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$y-x = { \pi + n (2 \pi)}$  where $n$ is a positive or negative natural number &lt;strong&gt;[1]&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As $x+y= \pi$ (see question) and &lt;strong&gt;[1]&lt;/strong&gt; : then only the following x and y combinations will give orthogonal qubits.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$2y = \pi +  \pi + n (2 \pi)$ which can be simplified as $y = n\pi$ where n is a positive or negative natural number and in that case $x=\pi - n\pi$  (e.g. when $y=0$ en $x=\pi$ we get 2 orthogonal qubits).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-07T08:10:51.813" LastActivityDate="2018-06-07T08:10:51.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2255" PostTypeId="1" AcceptedAnswerId="2256" CreationDate="2018-06-07T11:22:53.247" Score="15" ViewCount="1184" Body="&lt;p&gt;I'm currently reading Nielsen and Chuang's &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; and I'm not sure if I correctly understand this exercise (on page 57) :&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Exercise 1.2: Explain how a device which, upon input of one of two non-orthogonal quantum states &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;$&lt;/span&gt; correctly identified the state, could be used to build a device which cloned the states &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;$&lt;/span&gt;, in violation of the no-cloning theorem. Conversely, explain how a device for cloning could be used to distinguish non-orthogonal quantum states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The first part seems fairly straightforward to me : once the state has been identified as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, just prepare an identical state through whatever means we have available, effectively cloning the original state.&lt;/p&gt;&#xA;&lt;p&gt;For the converse, I've not been able to achieve better than this :&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Clone the state to be identified &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform a measurement on each of the copies in the basis &lt;span class=&quot;math-container&quot;&gt;$(|\psi\rangle, |\psi'\rangle)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; is a state orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If one of the measurements yields &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt;, then we know for certain that the original state is &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If all of the measurements yield &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, we can claim that the original state is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with a probability of error equal to : &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi|\phi\rangle|^{2n}$&lt;/span&gt;, which can be made arbitrarily small by increasing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;However, the way the exercise is worded makes me think that there must be some deterministic way of distinguishing between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; given a cloning machine. Is this indeed the case?&lt;/p&gt;&#xA;" OwnerUserId="2563" LastEditorUserId="2563" LastEditDate="2021-02-11T18:03:40.510" LastActivityDate="2021-02-11T18:03:40.510" Title="No-cloning theorem and distinguishing between two non-orthogonal quantum states" Tags="&lt;quantum-state&gt;&lt;no-cloning-theorem&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2256" PostTypeId="2" ParentId="2255" CreationDate="2018-06-07T11:42:51.893" Score="7" Body="&lt;p&gt;That's the way that I would initially go about answering the question.  There are, however, a few tweaks you could make.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Definitive Answer&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;As you point out, the annoying feature is that you can never be definitive about having the state  $|\psi\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a couple of ways that you might avoid that pitfall.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first option is to have two different measurement bases that you pick between. The first is as you specified. The second is the complementary view where you use $(|\phi\rangle,|\phi'\rangle)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second option is to introduce a POVM. (I don't have my copy of Nielsen and Chuang to hand, and don't remember if they've been introduced at this point.) POVMs can have more than 2 measurement operators, and are often quite good at saying &quot;the state was definitely not $|x\rangle$&quot;, so you could make one operator that says &quot;the state definitely was not $|\psi\rangle$&quot;, another that says &quot;definitely not $|\phi\rangle$&quot; and a third just for the sake of completeness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both options are variants on a theme, and technically you might still have to run both forever before you get a definitive answer, but the expected number of trials is finite.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Better Outcome Probabilities&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;You can actually pick a better measurement basis than the one you described so that you can come to a conclusion faster (but certainly does not give you a definitive answer). Try to think about the two states $|\psi\rangle$ and $|\phi\rangle$ on the Bloch sphere. You can always find a plane passing through both points and the centre of the sphere. On this plane, there is a circle, with two points corresponding to the two states. Draw lines joining these points to the centre. Next, construct a diameter of the circle which makes equal angles with the two lines you've just drawn. This would define the measurement basis that tells you absolutely nothing about which of the two states you have. But, if you construct the diameter that is perpendicular to that line, this is the one that, at least in a single shot, has the maximum probability of distinguishing between the two states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a picture. $|\Psi\rangle$ is one of the two basis states that you want for the measurement, and remember that the angle $\theta$ can be related to $|\langle\psi|\phi\rangle|$.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hTyeQ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hTyeQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be worth then calculating if you have $k$ copies of each state, whether a joint measurement constructed in this way can perform better than the individual measurement repeated $k$ times.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-07T11:53:35.610" LastActivityDate="2018-06-07T11:53:35.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2257" PostTypeId="2" ParentId="2251" CreationDate="2018-06-07T13:51:46.873" Score="6" Body="&lt;p&gt;The answers given so far assume that classical descriptions of the two qubits' states are given (e.g. x and y are provided in the problem's statement). Interestingly, even if the two states are unknown to you, the overlap of the two qubits' states can be evaluated with a simple quantum circuit, provided you have access to pairs of qubits in these states. The circuit is known as a SWAP test, and can be found in Fig. 1 of this reference &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102001&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;, where apparently it was first proposed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102001&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; Buhrman et al., &quot;Quantum fingerprinting&quot;. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102001&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0102001&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2558" LastActivityDate="2018-06-07T13:51:46.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2258" PostTypeId="1" AcceptedAnswerId="2259" CreationDate="2018-06-07T15:03:24.000" Score="12" ViewCount="4559" Body="&lt;p&gt;I would like to simulate the 4 &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;noreferrer&quot;&gt;&quot;Bell States&quot;&lt;/a&gt; on the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/editor&quot; rel=&quot;noreferrer&quot;&gt;IBM composer&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I best implement those 4 Bell states using the existing set of gates ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here below you see the definition of the 4 Bell states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zj9KFm.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zj9KFm.jpg&quot; alt=&quot;The 4 bell states&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first bell state can be easily implemented on the composer through a Hadamard gate and a CNOT gate as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WaV9Y.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WaV9Y.jpg&quot; alt=&quot;first Bell state&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but how can I implement the other 3 bell states ?&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="26" LastEditDate="2018-12-13T19:52:14.730" LastActivityDate="2021-05-28T19:03:05.160" Title="How to implement the 4 Bell states on the IBM Q (composer)?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2259" PostTypeId="2" ParentId="2258" CreationDate="2018-06-07T15:32:40.460" Score="7" Body="&lt;p&gt;Remember that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_(H)_gate&quot; rel=&quot;noreferrer&quot;&gt;Hadamard (&lt;strong&gt;H&lt;/strong&gt;) gate&lt;/a&gt; maps $|0\rangle$ to $\frac{|0\rangle+|1\rangle}{\sqrt{2}}$ and $|1\rangle$ to $\frac{|0\rangle-|1\rangle}{\sqrt{2}}$, while the &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate&quot; rel=&quot;noreferrer&quot;&gt;CNOT gate&lt;/a&gt; has the following conversion table:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n46Eg.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n46Eg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you can use the same circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/khkyU.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/khkyU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but begin in the states $|01\rangle$, $|10\rangle$ and $|11\rangle$ to get the other three Bell states (you can easily convert to these states from $|00\rangle$ using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Pauli-X_gate_(=_NOT_gate)&quot; rel=&quot;noreferrer&quot;&gt;Pauli-X gate&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NjrYpm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NjrYpm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;http://www-bcf.usc.edu/~tbrun/Course/lecture11.pdf&quot; rel=&quot;noreferrer&quot;&gt;Todd Brun's lecture notes, Part-11&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-07T16:06:59.920" LastActivityDate="2018-06-07T16:06:59.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2260" PostTypeId="2" ParentId="2258" CreationDate="2018-06-07T15:34:34.157" Score="10" Body="&lt;p&gt;One of the possible solutions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle = \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle = Z_1 |\Phi^+\rangle = Z_1 \cdot \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle = X_2 |\Phi^+\rangle = X_2 \cdot \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle = Z_1 |\Psi^+\rangle = Z_1 \cdot X_2 \cdot \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$Z_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt; act on the &lt;span class=&quot;math-container&quot;&gt;$i^\textrm{th}$&lt;/span&gt; qubit.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;&lt;strong&gt;So here is &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qnu9Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qnu9Q.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Here is &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w8nYA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w8nYA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;And here is &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SGnAU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SGnAU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Another solution is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle = \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle = X_1 \cdot \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle = X_2 \cdot \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle = Z_1 X_2\cdot \textrm{CNOT} \cdot  H_1  |00 \rangle$&lt;/span&gt;&lt;br&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-05-28T19:03:05.160" LastActivityDate="2021-05-28T19:03:05.160" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2261" PostTypeId="1" AcceptedAnswerId="2262" CreationDate="2018-06-07T18:45:24.193" Score="10" ViewCount="1237" Body="&lt;p&gt;I have just started to learn about quantum computing, and I know a little bit about qubits. What is a resource where I can learn a basic quantum algorithm and the concepts behind how it works?&lt;/p&gt;&#xA;" OwnerUserId="2566" LastEditorUserId="2293" LastEditDate="2018-06-12T15:34:32.030" LastActivityDate="2018-11-28T17:29:27.393" Title="Resources for quantum algorithm basics" Tags="&lt;algorithm&gt;&lt;physical-qubit&gt;&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2262" PostTypeId="2" ParentId="2261" CreationDate="2018-06-07T19:13:54.610" Score="7" Body="&lt;p&gt;Most textbooks and lecture courses start with solving the Deutsch problem using quantum computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parts 1 to 4 of John Watrous's lecture notes will describe the concepts, starting from basics. By the end of lecture 4, you will have learned how a quantum computer can solve the Deutsch problem with fewer operations than a classical computer would need:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/01.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture 1: Overview of quantum information&#xA;&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/02.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture 2: Overview of quantum information (continued)&#xA;&lt;/a&gt; &lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/03.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture 3: Superdense coding, quantum circuits, and partial measurements&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture 4: Quantum Teleportation; Deutsch’s Algorithm&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-07-13T14:54:27.753" LastActivityDate="2018-07-13T14:54:27.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2263" PostTypeId="1" AcceptedAnswerId="2264" CreationDate="2018-06-07T23:14:06.640" Score="30" ViewCount="11664" Body="&lt;p&gt;The Bell state $|\Phi^{+}\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle )$ is an entangled state. But why is that the case? How do I mathematically prove that?&lt;/p&gt;&#xA;" OwnerUserId="72" LastActivityDate="2018-12-23T14:54:51.597" Title="How do I show that a two-qubit state is an entangled state?" Tags="&lt;entanglement&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="2264" PostTypeId="2" ParentId="2263" CreationDate="2018-06-07T23:14:06.640" Score="31" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;hr&gt;&#xA;  &#xA;  &lt;p&gt;A two-qubit state $|\psi\rangle \in \mathbb{C}^4$ is an entangled state if and only if there &lt;strong&gt;not&lt;/strong&gt; exist two one-qubit states $|a\rangle = \alpha |0\rangle + \beta |1\rangle \in \mathbb{C}^2$ and $|b\rangle = \gamma |0\rangle + \lambda |1\rangle \in \mathbb{C}^2$ such that $|a\rangle \otimes |b\rangle = |\psi\rangle$, where $\otimes$ denotes the &lt;em&gt;tensor product&lt;/em&gt; and $\alpha, \beta, \gamma, \lambda \in \mathbb{C}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, to show that the Bell state $|\Phi^{+}\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle )$ is an entangled state, we simply have to show that there exist no two one-qubit states $|a\rangle$ and $|b\rangle$ such that $|\Phi^{+}\rangle = |a\rangle \otimes |b\rangle$. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;hr&gt;&#xA;  &#xA;  &lt;p&gt;Suppose that &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;\begin{align}&#xA;|\Phi^{+}\rangle &#xA;&amp;amp;= |a\rangle \otimes |b\rangle \\&#xA;&amp;amp;= \left( \alpha |0\rangle + \beta |1\rangle \right) \otimes \left( \gamma |0\rangle + \lambda |1\rangle \right)&#xA;\end{align}&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We can now simply apply the distributive property to obtain&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;\begin{align}&#xA;|\Phi^{+}\rangle &#xA;&amp;amp;= \cdots \\&#xA;&amp;amp;= \left( \alpha \gamma  |00\rangle +  \alpha \lambda |01\rangle + \beta \gamma |10\rangle + \beta \lambda |11\rangle \right)&#xA;\end{align}&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This must be equal to $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle )$, that is, we must find coefficients $\alpha$, $\beta$, $\gamma$ and $\lambda$, such that &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;\begin{align}&#xA;\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle ) &#xA;&amp;amp;= \left( \alpha \gamma  |00\rangle +  \alpha \lambda |01\rangle + \beta \gamma |10\rangle + \beta \lambda |11\rangle \right)&#xA;\end{align}&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Observe that, in the expression $\alpha \gamma  |00\rangle +  \alpha \lambda |01\rangle + \beta \gamma |10\rangle + \beta \lambda |11\rangle$, we want to keep both $|00\rangle$ and $|11\rangle$. Hence, $\alpha$ and $\gamma$, which are the coefficients of $|00\rangle$, cannot be zero; in other words, we must have $\alpha \neq 0$ and $\gamma \neq 0$. Similarly, $\beta$ and $\lambda$, which are the complex numbers multiplying $|11\rangle$ cannot be zero, i.e. $\beta \neq 0$ and $\lambda \neq 0$. So, all complex numbers $\alpha$, $\beta$, $\gamma$ and $\lambda$ must be different from zero.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;But, to obtain the Bell state $|\Phi^{+}\rangle$, we want to get rid of $|01\rangle$ and $|10\rangle$. So, one of the numbers (or both) multiplying $|01\rangle$ (and $|10\rangle$)  in the expression $\alpha \gamma  |00\rangle +  \alpha \lambda |01\rangle + \beta \gamma |10\rangle + \beta \lambda |11\rangle $, i.e. $\alpha$ and $\lambda$ (and, respectively, $\beta$ and $\gamma$), must be equal to zero. But we have just seen that $\alpha$, $\beta$, $\gamma$ and $\lambda$ must all be different from zero. So, we cannot find a combination of complex numbers  $\alpha$, $\beta$, $\gamma$ and $\lambda$ such that &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;\begin{align}&#xA;\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle ) &#xA;&amp;amp;= \left( \alpha \gamma  |00\rangle +  \alpha \lambda |01\rangle + \beta \gamma |10\rangle + \beta \lambda |11\rangle \right)&#xA;\end{align}&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In other words, we are not able to express $|\Phi^{+}\rangle$ as a tensor product of two one-qubit states. Therefore, $|\Phi^{+}\rangle$ is a entangled state. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We can perform a similar proof for other Bell states or, in general, if we want to prove that a state is entangled.&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="72" LastEditDate="2018-06-07T23:19:16.430" LastActivityDate="2018-06-07T23:19:16.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2265" PostTypeId="2" ParentId="2248" CreationDate="2018-06-08T01:07:57.253" Score="3" Body="&lt;p&gt;user1271772's answer is entirely correct. I was going to comment with additional information to help answer nippon's question, but I just created this account and apparently there's a reputation requirement before adding comments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave's superconducting flux qubits are niobium metal loops that form a &quot;hash symbol&quot; made of two flat layers that have been stretched out and laid parallel. One layer is 90-degrees rotated from the other. When you move charge (current) in a loop it produces a magnetic field perpendicular to the plane of the loop. When you move a magnetic field through a charge-carrying loop it induces motion in the charge (current). But the amount of induction is partly determined by the size of the overlapping area (not linearly, since perfect overlap doesn't mean perfect induction, and non-overlapping adjacent wires still do it) so you can't currently usefully overlap 1000x1000 because the influence on each neighbor would be small. Stacking more layers is hard for the same reason wireless charging only just started to not suck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The D-Wave uses Niobium loops interspersed with these amazing little quantum-permeable membrane slices called Josephson Junctions (that won their discoverer a Nobel before he went a little wacky) cooled to just above 0 kelvin, so they can hold a charge with zero resistance. Basic quantum computing hardware generally has to be robust to decoherence, which means it can't interact much with the outside environment (should be its own Hamiltonian). There's already a ton of control hardware and stuff that has to go into keeping it all stable. Every time they move the machine they have to recalibrate it (at least with the DW2) and a new random arrangement of like 90% of the qubits will work until it's calibrated again. So it's actually a harder problem than just fitting to a chimera graph. Needs to be a readily radiation-hardenable system of some kind, e.g. a neural network.&lt;/p&gt;&#xA;" OwnerUserId="2567" LastEditorUserId="2567" LastEditDate="2018-06-09T17:18:07.370" LastActivityDate="2018-06-09T17:18:07.370" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2266" PostTypeId="2" ParentId="2263" CreationDate="2018-06-08T05:18:39.287" Score="19" Body="&lt;p&gt;A two qudit &lt;em&gt;pure&lt;/em&gt; state is separable if and only if it can be written in the form &lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle=|\psi\rangle|\phi\rangle$$&lt;/span&gt; for arbitrary single qudit states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Otherwise, it is entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine if the pure state is entangled, one &lt;em&gt;could&lt;/em&gt; try a brute force method of attempting to find satisfying states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, as in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2264/1837&quot;&gt;this&lt;/a&gt; answer. This is inelegant, and hard work in the general case. A more straightforward way to prove whether this pure state is entangled is the calculate the reduced density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; for one of the qudits, i.e. by tracing out the other. The state is separable if and only if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has rank 1. Otherwise it is entangled. Mathematically, you can test the rank condition simply by evaluating &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)$&lt;/span&gt;. The original state is separable if and only if this value is 1. Otherwise the state is entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, imagine one has a pure separable state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=|\psi\rangle|\phi\rangle$&lt;/span&gt;. The reduced density matrix on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\text{Tr}_B(|\Psi\rangle\langle\Psi|)=|\psi\rangle\langle\psi|,&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho_A^2)=\text{Tr}(|\psi\rangle\langle\psi|\cdot |\psi\rangle\langle\psi|)=\text{Tr}(|\psi\rangle\langle\psi|)=1.&#xA;$$&lt;/span&gt;&#xA;Thus, we have a separable state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile, if we take &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\text{Tr}_B(|\Psi\rangle\langle\Psi|)=\frac12\left(|0\rangle\langle 0|+|1\rangle\langle 1|\right)=\frac12\mathbb{I}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho_A^2)=\frac14\text{Tr}(\mathbb{I}\cdot\mathbb{I})=\frac12&#xA;$$&lt;/span&gt;&#xA;Since this value is not 1, we have an entangled state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to know about detecting entanglement in mixed states (not pure states), this is less straightforward, but for two qubits there is a necessary and sufficient condition for separability: &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;noreferrer&quot;&gt;positivity under the partial transpose operation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1867" LastEditDate="2018-12-23T14:54:51.597" LastActivityDate="2018-12-23T14:54:51.597" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2267" PostTypeId="1" AcceptedAnswerId="2274" CreationDate="2018-06-08T09:03:47.183" Score="6" ViewCount="342" Body="&lt;p&gt;I am looking for an implementation using the quantum gates provided by the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/editor&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM composer&lt;/a&gt; of the following quantum function:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;input $2n$ qubits&lt;/li&gt;&#xA;&lt;li&gt;output $2n$ qubits wherein $50\%$ of the cases the state of the $2$ sets of $n$ qubits are swapped and in the other $50\%$ of the cases the state of the $2n$ qubits remain unchanged.  With swapped I mean that qubit $q[i]$ will get the state of qubit $q[n+i]$ and qubit $q[n+i]$ will get the state of $q[i]$.  Note also that all the qubits must be swapped or not.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;E.g. $n=3$: If input $|000111\rangle$ then output in 50% of the cases is  $|000111\rangle$ and in the other 50% of the cases is  $|111000\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have already a solution when $n=1$ in the following StackOverflow question: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2228/how-to-implement-the-square-root-of-swap-gate-on-the-ibm-q-composer&quot;&gt;How to implement the &quot;Square root of Swap gate&quot; on the IBM Q (composer)?&lt;/a&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;but how can we do that when $n&amp;gt;1$?&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="26" LastEditDate="2018-12-13T19:52:46.993" LastActivityDate="2018-12-13T19:52:46.993" Title="How to implement a Square root of Swap gate that swaps 2n-qubits on the IBM Q (composer)?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2268" PostTypeId="1" AcceptedAnswerId="2269" CreationDate="2018-06-08T10:15:20.497" Score="6" ViewCount="732" Body="&lt;p&gt;Let's say two qubits are both in $|+\rangle$ state. We need to find $a_1$, $a_2$, $a_3$, and $a_4$ in  $|\phi\rangle = a_1|00\rangle + a_2|01\rangle + a_3|10\rangle + a_4|11\rangle$, how do we find these amplitudes? How do we do it in general case, when each of the qubits are not necessarily in $|+\rangle$ state, but in some $|?\rangle$ state?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:30:35.187" LastActivityDate="2018-12-23T12:30:35.187" Title="How to calculate the state given by two qubits?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2269" PostTypeId="2" ParentId="2268" CreationDate="2018-06-08T10:21:58.023" Score="3" Body="&lt;p&gt;Start by writing out what the $|+\rangle$ state actually is:&#xA;$$&#xA;|+\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)&#xA;$$&#xA;So, two qubits in the state $|+\rangle$ are in the state&#xA;$$&#xA;|+\rangle|+\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\otimes \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)&#xA;$$&#xA;You then need to expand this out, making use of the distributivity of the tensor product, and match up with the specified form of $|\phi\rangle$. Since this sounds a bit like a homework problem, I'm not going to do that for you explicitly. (If you've tried something and got stuck, show us what you tried!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general case is absolutely equivalent, you just replace $|+\rangle|+\rangle$ with something like&#xA;$$&#xA;(b_0|0\rangle+b_1|1\rangle)\otimes (b_2|0\rangle+b_3|1\rangle)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-08T10:21:58.023" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2270" PostTypeId="1" AcceptedAnswerId="2271" CreationDate="2018-06-08T12:29:33.077" Score="14" ViewCount="6245" Body="&lt;p&gt;Let's say we have a circuit with $2$ Hadamard gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hbZaJ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hbZaJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take the $|00\rangle$ state as input. The vector representation of $|00\rangle$ state is $[1 \ 0 \ 0 \ 0]$, but this is the representation of $2$ qubits and H accepts just $1$ qubit, so should we apply the first &lt;strong&gt;H&lt;/strong&gt; gate to $[1 \ 0]$ and the second &lt;strong&gt;H&lt;/strong&gt; gate to $[0 \ 0]$? Or should we input $[1 \ 0]$ in each &lt;strong&gt;H&lt;/strong&gt; gate, because we are applying &lt;strong&gt;H&lt;/strong&gt; gates to just one qubit of state $|0\rangle$ each time?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:30:54.910" LastActivityDate="2018-12-23T12:30:54.910" Title="How to input 2 qubits in 2 Hadamard gates?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2271" PostTypeId="2" ParentId="2270" CreationDate="2018-06-08T12:40:54.223" Score="16" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Or should we input $[1 \ 0]$ in each H gate, because we are applying H&#xA;  gates to just qubit of state $|0\rangle$ each time?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, when you have a two-qubit state (say you label the two qubits as $A$ and $B$ respectively), you need to apply the two Hadamard gates separately on each qubit's state. The final state will be the tensor product of the two &quot;transformed&quot; single-qubit states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your input is $|0\rangle_A\otimes|0\rangle_B$, the output will simply be $$\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_B$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Alternative:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If the two input qubits are &lt;em&gt;entangled&lt;/em&gt;, the above method won't work since you won't be able to represent the input state as a tensor product of the states of the two qubits. So, I'm outlining a more general method here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When two gates are in parallel, like in your case, you can consider the &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;noreferrer&quot;&gt;tensor product&lt;/a&gt; of the two gates and apply &lt;em&gt;that&lt;/em&gt; on the 2-qubit state vector. You'll end up with the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\\ \end{bmatrix} \otimes \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\\ \end{bmatrix} = \frac{1}{2}\begin{bmatrix}1&amp;amp;1&amp;amp;1&amp;amp;1\\1&amp;amp;-1&amp;amp;1&amp;amp;-1\\1&amp;amp;1&amp;amp;-1&amp;amp;-1\\1&amp;amp;-1&amp;amp;-1&amp;amp;1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, on applying this matrix on the 2-qubit state $\begin{bmatrix}1\\0\\0\\0\end{bmatrix}$ you get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2}\begin{bmatrix}1&amp;amp;1&amp;amp;1&amp;amp;1\\1&amp;amp;-1&amp;amp;1&amp;amp;-1\\1&amp;amp;1&amp;amp;-1&amp;amp;-1\\1&amp;amp;-1&amp;amp;-1&amp;amp;1 \end{bmatrix} \begin{bmatrix}1\\0\\0\\0\end{bmatrix}=\begin{bmatrix}1/2\\1/2\\1/2\\1/2\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is equivalent to $$\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_B$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Justification&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;noreferrer&quot;&gt;Tensor product of linear maps&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The tensor product also operates on linear maps between vector spaces.&#xA;  Specifically, given two linear maps $S : V \to X$ and $T : W \to Y$&#xA;  between vector spaces, the tensor product of the two linear maps $S$&#xA;  and $T$ is a linear map $(S\otimes T)(v\otimes w) = S(v) \otimes T(w)$&#xA;  defined by $(S\otimes T)(v\otimes w) = S(v) \otimes T(w)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus, $$(\mathbf H|0\rangle_A) \otimes (\mathbf H|0\rangle_B) = (\mathbf H\otimes \mathbf H)(|0\rangle_A \otimes |0\rangle_B)$$&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-08T13:51:39.860" LastActivityDate="2018-06-08T13:51:39.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2272" PostTypeId="2" ParentId="2270" CreationDate="2018-06-08T12:46:27.070" Score="3" Body="&lt;p&gt;It's the second option. So, you would apply both Hardmard gates to the state $|0\rangle$, to obtain two $\frac{1}{\sqrt{2}} \left (|0\rangle + |1\rangle \right)$. Therefore, the final two-qubit state would be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\frac{1}{\sqrt{2}} \left (|0\rangle + |1\rangle \right) \otimes \frac{1}{\sqrt{2}} \left (|0\rangle + |1\rangle \right) &#xA;&amp;amp;= &#xA;\frac{1}{2} \left( |00\rangle + |01\rangle + |10\rangle + |11\rangle\right)&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can easily verify that this is a valid quantum state by checking the normalization condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\left| \frac{1}{2} \right|^2 + \left| \frac{1}{2} \right|^2 + \left| \frac{1}{2} \right|^2 + \left| \frac{1}{2} \right|^2&#xA;&amp;amp;=  \frac{1}{4} + \frac{1}{4} + \frac{1}{4} + \frac{1}{4} \\&#xA;&amp;amp;= 1&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, in this context, it's more intuitive if you use Dirac's bra-ket notation (i.e. use $|00 \rangle$ instead of the column vector $(1, 0, 0, 0)^T$).  Then, if you have to apply a gate to a subset of the qubits, you can proceed in an analogous way as I did above.&lt;/p&gt;&#xA;" OwnerUserId="72" LastActivityDate="2018-06-08T12:46:27.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2274" PostTypeId="2" ParentId="2267" CreationDate="2018-06-08T17:16:12.843" Score="3" Body="&lt;p&gt;A general trick for smoothing a big discrete operation into a continuous operation is to apply the phase estimation algorithm, then apply a phase gradient to the phase register, then uncompute the phase estimation. For example, see &lt;a href=&quot;http://algassert.com/post/1710&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post on computing the fractional fourier transform&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the swap operation has exactly two eigenvalues (+1 and -1), the phase estimation is extremely simple. It only requires a single phase estimation qubit. The &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22H%22%2C1%2C%22H%22%2C1%2C1%2C%22H%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22Density3%22%2C1%2C1%2C%22Density3%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22Swap%22%2C1%2C1%2C%22Swap%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22Swap%22%2C1%2C1%2C%22Swap%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C%22Swap%22%2C1%2C1%2C%22Swap%22%5D%2C%5B%22H%22%5D%2C%5B%22Z%5Et%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22Swap%22%2C1%2C1%2C%22Swap%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22Swap%22%2C1%2C1%2C%22Swap%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C%22Swap%22%2C1%2C1%2C%22Swap%22%5D%2C%5B%22H%22%5D%2C%5B1%2C%22Density3%22%2C1%2C1%2C%22Density3%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;resulting circuit&lt;/a&gt; looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fkufk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fkufk.png&quot; alt=&quot;Big sqrt swap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the top qubit should start and end in the 0 state. You can continuously vary how much swappery there is by varying the angle of the Z rotation in the middle.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-06-08T23:00:28.160" LastActivityDate="2018-06-08T23:00:28.160" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2275" PostTypeId="1" CreationDate="2018-06-09T10:00:22.750" Score="7" ViewCount="224" Body="&lt;p&gt;Suppose we have a qutrit with the state vector $|\psi\rangle = a_0|0\rangle + a_1|1\rangle + a_2|2\rangle$, and we want to project its state onto the subspace having the basis $\{|0\rangle,|2\rangle\}$, I know the projection operator would be written like: $1|0\rangle \langle0| + 0|1\rangle\langle 1| + 1|2\rangle\langle2|$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm having a few confusions here. Does $|0\rangle \langle 0|$ represent a tensor product between $[1 \ 0 \ 0]^{T}$ and $[1 \ 0 \ 0]$ ? Or is it just matrix multiplication? Also, I thought that we must always be able to write a projection operator in the form $|\phi\rangle \langle \phi|$ where $|\phi\rangle$ is a possible state of a qutrit. But how to represent $1|0\rangle \langle0| + 0|1\rangle\langle 1| + 1|2\rangle\langle2|$ in the form $|\phi\rangle \langle \phi|$?&lt;/p&gt;&#xA;" OwnerUserId="2582" LastEditorUserId="26" LastEditDate="2018-06-09T11:27:56.120" LastActivityDate="2018-06-12T06:52:33.563" Title="Confusion regarding projection operator" Tags="&lt;tensor-product&gt;&lt;qutrit&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2276" PostTypeId="1" AcceptedAnswerId="2277" CreationDate="2018-06-09T11:31:49.837" Score="7" ViewCount="719" Body="&lt;p&gt;Let's say we have the following quantum circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PE2iq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PE2iq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we input the state $|00\rangle$ . Both of the $H$ gates produce the output $1/\sqrt{2}$, but which one of the following $2$ vectors is the input of $\operatorname{CNOT}$ gate:&#xA;$1: [1/\sqrt{2}, \ 1/\sqrt{2}, \ 1/\sqrt{2}, \ 1/\sqrt{2}]$ or&#xA;$2: [1/2, \ 1/2, \ 1/2, \ 1/2]$?&#xA;Also, after applying a $2$ qubit gate (in this case $\operatorname{CNOT}$) how do we find out what to input in the following single qubit gates (in this case two $H$ gates)?&#xA;Note that I gave this example for simplicity, a general answer will also be accepted.&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:31:19.110" LastActivityDate="2018-12-23T12:31:19.110" Title="How to apply single and two qubit gates to 2 qubits multiple times?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2277" PostTypeId="2" ParentId="2276" CreationDate="2018-06-09T13:17:41.473" Score="4" Body="&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt; (application of two hadamard gates): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|0\rangle_A \otimes |0\rangle_B \to \left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_B$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is equivalent to the state vector: $\begin{bmatrix}1/2\\1/2\\1/2\\1/2\end{bmatrix}$, which will act as the input for your CNOT gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: (application of CNOT)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's remind ourselves what the CNOT gate does:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/id9mg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/id9mg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So clearly, &#xA;$$\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_B = \frac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle)$$ $$\to \frac{1}{2}(|00\rangle + |01\rangle + |11\rangle + |10\rangle) = \left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_B$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; (re-application of two Hadamard gates)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right)_B \to |0\rangle_A \otimes |0\rangle_B$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, we used that fact that the Hadamard gate maps the state $\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ to the state $|0\rangle$, for each qubit. You basically need to input the vector $\begin{bmatrix}1/\sqrt{2}\\1/\sqrt{2}\end{bmatrix}$ into the two Hadamard gates at the end. Find the state transformation on each qubit. From there you can construct the state vector for the final 2-qubit state. The final answer will be $\begin{bmatrix}1 \\ 0 \\ 0 \\ 0\end{bmatrix}$. Clearly, we end up with the same 2-qubit state which we started with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Exercise&lt;/strong&gt;: Carry out steps $2$ and $3$ using the matrix notation. Also, check &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2271/26&quot;&gt;this&lt;/a&gt; related answer.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-09T13:25:43.617" LastActivityDate="2018-06-09T13:25:43.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2278" PostTypeId="1" AcceptedAnswerId="2279" CreationDate="2018-06-09T13:27:41.053" Score="6" ViewCount="314" Body="&lt;p&gt;My idea was to apply $Z$ operator , which leads us back to the point where we started from, and also show that after applying the $Z$ operator just  we are not at the same point where we started (this is for showing that we are not rotating by a multiple of $360^{\circ}$). Is this the correct proof? What about the general case, where we want to find out through how many degrees a given operator rotates the points?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-06-09T13:54:59.127" LastActivityDate="2018-06-09T14:52:25.940" Title="How to prove that Z operator rotates points on Bloch sphere about Z axis through 180°?" Tags="&lt;quantum-gate&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2279" PostTypeId="2" ParentId="2278" CreationDate="2018-06-09T13:45:31.693" Score="6" Body="&lt;p&gt;The Pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate maps &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For Bloch sphere representation, state of a qubit is written like (look at my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1629/alternative-to-bloch-sphere-to-represent-a-single-qubit/1633#1633&quot;&gt;previous answer&lt;/a&gt; for a detailed explanation)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Apply the Pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on this and you get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi'\rangle = \cos(\theta/2)|0\rangle + (-1)e^{i\phi}\sin(\theta/2)|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\cos(\theta/2)|0\rangle + e^{i(\phi+\pi)}\sin(\theta/2)|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; changes by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;. We can call &lt;span class=&quot;math-container&quot;&gt;$\phi + \pi$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\phi'$&lt;/span&gt; now.&lt;/p&gt;&#xA;&lt;p&gt;Remind yourself what the Bloch sphere looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BBEUG.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BBEUG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Clearly, from the diagram, if the angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is changed by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, it will imply that the state of the qubit has been rotated about the Z-axis by &lt;span class=&quot;math-container&quot;&gt;$180$&lt;/span&gt; degrees.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-06-09T13:45:31.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2280" PostTypeId="2" ParentId="2275" CreationDate="2018-06-09T14:21:04.037" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Does $|0\rangle\langle0|$ represent a tensor product or is it just matrix multiplication?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can think of $|0\rangle\langle0|$ as tensor product of $|0\rangle$ and $\langle0|$, or equivalently as the matrix multiplication (more precisely, &lt;a href=&quot;https://math.stackexchange.com/a/203950/173147&quot;&gt;Kronecker product&lt;/a&gt;) of the vectors representing them.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Also, I thought that we must always be able to write a projection operator in the form |ϕ⟩⟨ϕ|&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not necessarily.&#xA;A projector will have that form if and only if it projects onto a one-dimensional space (that is, it projects onto a pure state).&#xA;More general projections, like the one you mention, do not have this feature, and that is totally fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, also the identity matrix is a (trivial) projection, and it certainly cannot be written as $|\psi\rangle\langle\psi|$ for any pure state $|\psi\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-06-09T14:21:04.037" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2281" PostTypeId="2" ParentId="2278" CreationDate="2018-06-09T14:52:25.940" Score="2" Body="&lt;p&gt;One can more generally show that $R_z(\theta)=e^{-i \theta Z/2}=\cos(\theta/2)-iZ\sin(\theta/2)$ rotates points on the Bloch sphere by an angle $\theta$ around the $z$-axis, &#xA;and note that $Z=i R_z(\pi)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let $|\psi\rangle$ be an arbitrary pure state. The coordinates of the point representing $|\psi(\theta)\rangle\equiv R_z(\theta)|\psi\rangle$ on the Bloch sphere are&#xA;$$x(\theta)=\langle\psi(\theta)|X|\psi(\theta)\rangle, \\ y(\psi)=\langle\psi(\theta)|Y|\psi(\theta)\rangle, \\&#xA;z(\psi)=\langle\psi(\theta)|Z|\psi(\theta)\rangle.$$&#xA;That this point follows a circular trajectory around the $z$-axis when $\theta$ goes from $0$ to $2\pi$,&#xA;can be seen by direct calculation as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;x(\theta) &amp;amp;=\langle\psi\rvert R_z(-\theta)\,X\,R_z(\theta)\lvert\psi\rangle =&#xA;\cos\theta\,x(0) + \sin\theta\,y(0), \\&#xA;y(\theta) &amp;amp;=\langle\psi\rvert R_z(-\theta)\,Y\,R_z(\theta)\lvert\psi\rangle =&#xA;-\sin\theta\,x(0) + \cos\theta\,y(0), \\&#xA;z(\theta) &amp;amp;= z(0).&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the same is true more generally for &lt;em&gt;mixed&lt;/em&gt; states: the point representing $\rho(\theta)\equiv R_z(\theta)\rho R_z(\theta)^\dagger$ in the Bloch sphere is&#xA;$$\newcommand{\Tr}{\operatorname{Tr}}&#xA;x(\theta)=\Tr(X\rho(\theta)), \\&#xA;y(\theta)=\Tr(Y\rho(\theta)), \\&#xA;z(\theta)=\Tr(Z\rho(\theta)),$$&#xA;and one can show by direct calculation that this point evolves similarly to the pure case.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-06-09T14:52:25.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2282" PostTypeId="1" AcceptedAnswerId="2285" CreationDate="2018-06-10T12:34:51.797" Score="37" ViewCount="6754" Body="&lt;p&gt;Is it because we don't know exactly how to create quantum computers (and how they must work), or do we know how to create it in theory, but don't have the tools to actually execute it in practice? Is it a mix of the above two? Any other reasons?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="55" LastEditDate="2020-09-10T11:46:29.153" LastActivityDate="2020-09-10T11:46:29.153" Title="Why is it harder to build quantum computers than classical computers?" Tags="&lt;physical-realization&gt;&lt;classical-computing&gt;" AnswerCount="7" CommentCount="6" FavoriteCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="2283" PostTypeId="1" CreationDate="2018-06-10T15:10:33.250" Score="7" ViewCount="87" Body="&lt;p&gt;During a description of &lt;strong&gt;zero-dimensional self-dual&lt;/strong&gt; $\text{GF}(4)$ &lt;strong&gt;quantum codes&lt;/strong&gt; in &lt;em&gt;&quot;On self-dual quantum codes, graphs, and Boolean functions&quot;&lt;/em&gt; by L.E. Danielsen, it states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A zero-dimensional stabilizer code with high distance represents a single quantum state which is robust to error, sometimes called a &lt;em&gt;stabilizer state&lt;/em&gt;. Codes of higher dimension can be constructed from zero-dimensional quantum codes...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question has two parts:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, I am confused by what is meant here by a &quot;single quantum state&quot;. To my understanding, the passage seems to confuse the encoded 0-dimensional qubit state (which is robust to Pauli error), i.e. a single &quot;qubit&quot; state, with the single &quot;stabilizer&quot; state which is represented by the generators of the code (which is not robust to error, as a single Hadamard on any qubit would be sufficient to take it to a completely different stabilizer state). Is this the case, or am I misunderstanding something here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, what form do these constructions take in practice? Is this simply achieved by not enforcing one of the stabilizer's generators, or are there other more general methods? Furthermore, if there are multiple construction methods, what are their advantages or disadvantages (both in the codes they create and/or the complexity of the construction)?&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-06-11T06:47:37.050" LastActivityDate="2018-06-11T08:45:34.513" Title="Zero-distance self-dual GF(4) quantum codes and constructing k &gt; 0 codes from them" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2284" PostTypeId="1" AcceptedAnswerId="2287" CreationDate="2018-06-10T16:39:21.193" Score="7" ViewCount="4093" Body="&lt;p&gt;I know that 2 qubits are entangled if it is impossible to represent their joint state as a tensor product. But when we are given a joint state, how can we tell if it is possible to represent it as a tensor product?&#xA;For example, I am asked to tell if the qubits are entangled for each of the following situations: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{align}&#xA;\left| 01 \right&amp;gt;\\&#xA;\frac 12(\left| 00  \right&amp;gt; + i\left| 01  \right&amp;gt; - i\left| 10  \right&amp;gt; +  i\left| 11  \right&amp;gt; )\\&#xA;\frac 12(\left| 00 \right&amp;gt; - \left| 11  \right&amp;gt;)\\&#xA;\frac 12(\left| 00  \right&amp;gt; + \left| 01  \right&amp;gt; +i\left| 10  \right&amp;gt; +  \left| 11  \right&amp;gt; )  \end{align}$$   &lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:31:39.020" LastActivityDate="2018-12-23T12:31:39.020" Title="How to check if 2 qubits are entangled?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ClosedDate="2018-06-10T19:23:27.910" ContentLicense="CC BY-SA 4.0" />
  <row Id="2285" PostTypeId="2" ParentId="2282" CreationDate="2018-06-10T17:11:54.527" Score="37" Body="&lt;p&gt;We know exactly, in theory, how to construct a quantum computer. But that is intrinsically more difficult than to construct a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a classical computer, you do not have to use a single particle to encode bits. Instead, you might say that anything less than a billion electrons is a 0 and anything more than that is a 1, and aim for, say, two billion of electrons to encode a 1 normally. That makes you inherently fault-tolerant: Even if there are hundreds of millions of electrons more or less than expected, you will still get the correct classification as a digital 0 or a 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a quantum computer, this trick is not possible due to the non-cloning theorem: You cannot trivially employ more than one particle to encode a qubit (quantum bit). Instead, you must make all your gates operate so well that they are not just accurate to the single particle level but even to a tiny fraction of how much they act on a single particle (to the so-called quantum-error correction threshold). This is much more challenging than to get gates accurate merely to within hundreds of millions of electrons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile we do have the tools to, just barely, make quantum computers with the required level of accuracy. But nobody has, as of yet, managed to make a big one meaning one that can accurately operate on the perhaps hundred of thousands of physical qubits needed to implement a hundred or so logical qubits to then be undeniably in the realm where the quantum computer beats classical computers at select problems (quantum supremacy).&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-06-10T19:00:35.420" LastActivityDate="2018-06-10T19:00:35.420" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2286" PostTypeId="2" ParentId="2284" CreationDate="2018-06-10T18:12:31.430" Score="3" Body="&lt;p&gt;It is done for a specific state (a Bell state) &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2263/how-do-i-show-that-a-two-qubit-state-is-an-entangled-state&quot;&gt;here&lt;/a&gt;, and the same procedure can be used for any other two-qubit state.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-13T14:47:24.620" LastActivityDate="2018-07-13T14:47:24.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2287" PostTypeId="2" ParentId="2284" CreationDate="2018-06-10T18:13:30.203" Score="3" Body="&lt;p&gt;If you are given a general 2-qubit state $a \mid 00 \rangle + b \mid 01 \rangle + c \mid 10 \rangle + d \mid 11 \rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is unentangled, then the coefficients are that of $(\alpha \mid 0 \rangle + \beta \mid 1 \rangle)(\gamma\mid 0 \rangle + \delta \mid 1 \rangle)$ for some $\alpha .. \delta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\alpha \gamma = a\\&#xA;\alpha \delta = b\\&#xA;\beta \gamma = c\\&#xA;\beta \delta = d&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You want to know if those 4 equations are solvable for a given $a,b,c,d$. This question becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;ad - bc = 0&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if $ad-bc=0$, then you can solve for $\alpha .. \delta$. You don't need to solve for them, you just need to need to know if it is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The generalization for qudits with potentially different values of $d_1$ and $d_2$ are the quadratic polynomials that cut out the &lt;a href=&quot;https://en.wikipedia.org/wiki/Segre_embedding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Segre embedding&lt;/a&gt; as a zero locus.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-06-10T18:13:30.203" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2288" PostTypeId="2" ParentId="2282" CreationDate="2018-06-10T22:04:44.807" Score="11" Body="&lt;p&gt;There's many reasons, both in theory and implementation, that make quantum computers much harder to build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest might be this: while it is easy to build machines that exhibit classical behaviour, demonstrations of quantum behaviour require really cold and really precisely controlled machines. The thermodynamic conditions of the quantum regime are just hard to access. When we finally do achieve a quantum system, it's hard to keep it isolated from the environment which seeks to decohere it and make it classical again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scalability is a big issue. The bigger our computer, the harder it is to keep quantum. The phenomena that promise to make quantum computers really powerful, like entanglement, require the qubits can interact with eachother in a controlled way. Architectures that allow this control are hard to engineer, and hard to scale. Nobody's agreed on a design!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @pyramids points out, the strategies we use to correct errors in classical machines usually involve cloning information, which is forbidden by quantum information theory. While we have some strategies to mitigate errors in clever quantum ways, they require that are qubits are already pretty noise-free and that we have lots of them. If we can't improve our engineering past some threshold, we can't employ these strategies - they make things worse!&lt;/p&gt;&#xA;" OwnerUserId="2591" LastActivityDate="2018-06-10T22:04:44.807" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2289" PostTypeId="1" CreationDate="2018-06-10T23:24:42.037" Score="5" ViewCount="90" Body="&lt;p&gt;I've accidentally written a procedure which appears to compute both outputs of a long-running function $f: \{0,1\} \to \{1...n\}$ using one run of $f$ plus $\mathcal{O}(n)$ time. I thought this couldn't be done. Where's the bug in my &quot;perpetuum mobile&quot;? If I'm wrong, what's the name of this technique?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialize with $\sum_ic_i|i\rangle_x$, with $c_0$ initially, say, $\sqrt½$, and the invariant $\sum_ic_i^2 = 1$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute $f(x)$, producing: $\sum_ic_i|i\rangle_x|f_i\rangle$ (1). We never evaluate $f$ again, and our goal is to extract these $f_i$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Produce:&#xA;$$&#xA;\sqrt½\sum_ic_i|i\rangle_x|f_i\rangle(|i^{|a|}\rangle_a|f_i\rangle_b+2^{-|a+b|/2}\sum_{rs}|r\rangle_a|s\rangle_b)&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure and discard the $a$ and $b$ registers, getting (1) with $c_0^2 \in \{1/(2+2^{|a|+|b|}), ½, 1-1/(2+2^{|a|+|b|})\}$, and in all probability we know which.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use amplitude amplification, where the good and bad subspaces are distinguished using the $x$ qubit, to get $c_0^2$ between ⅛ and ⅞.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Repeat the last 3 *s a bunch of times.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In all probability, we've measured $f_0$ and $f_1$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2592" LastEditorUserId="2592" LastEditDate="2018-06-11T12:51:16.463" LastActivityDate="2018-06-11T13:51:22.320" Title="How does this parallel computation scheme fail?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2290" PostTypeId="2" ParentId="2282" CreationDate="2018-06-11T03:59:31.360" Score="1" Body="&lt;p&gt;I have to disagree with the idea that the no-cloning theorem makes error correction with repetition codes difficult. Given that your inputs are provided in the computational basis (i.e. you inputs are not arbitrary superpositions, which is almost always the case, especially when you're solving a classical problem e.g.  Schor's algorithm), you can clone them with controlled-Not gates, run your computation in parallel on all the copies, and then correct errors. The only trick is to make sure you don't do a measurement during error-correction (except possibly of the syndrome), and to do this all you have to do is continue to make use quantum gates.&lt;/p&gt;&#xA;&lt;p&gt;Error correction for quantum computers is not much more difficult than for classical computers. Linearity takes can of most of the perceived difficulties.&lt;/p&gt;&#xA;&lt;p&gt;I'd also like to mention that there are much more efficient schemes for quantum error correction than repetition codes. And that you need two pauli-matrices to generate the rest, so you need two types of repetition codes if you're going to go for the inefficient, but conceptually simple repetition code route (one for bit-flips and one for phase flips).&lt;/p&gt;&#xA;&lt;p&gt;Quantum error correction shows that linear increase in the number of physical qubits per logical qubit improves the error rate exponentially, just as it does in the classical case.&lt;/p&gt;&#xA;&lt;p&gt;Still, we're nowhere near 100 physical qubits. This is the real problem. We need to be able to glue a lot more semi-accurate qubits together before any of this starts to matter.&lt;/p&gt;&#xA;" OwnerUserId="2595" LastEditorUserId="2595" LastEditDate="2020-09-08T20:00:36.983" LastActivityDate="2020-09-08T20:00:36.983" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2291" PostTypeId="2" ParentId="2289" CreationDate="2018-06-11T06:56:46.657" Score="1" Body="&lt;p&gt;There's quite a lot that doesn't make sense in your described protocol, at least to me! It would be a lot clearer in terms of bras and kets. Let me try to translate, and you can comment to try and get us one the same page...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Let $|x\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute $f(x)$, so you have $(|0\rangle|f(0)\rangle+|1\rangle|f(1)\rangle)/\sqrt{2}$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let $|m\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$, so that we have an overall state&#xA;$$&#xA;(|0\rangle_m|000\ldots 0\rangle_a|f(0)\rangle_b+|1\rangle_m|111\ldots 1\rangle_a|f(1)\rangle_b)/\sqrt{2}&#xA;$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure the $a$ and $b$ registers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;What I don't understand: you've defined $|x\rangle$ but never used it. You've initialised the registers $a$ and $b$, but overwritten them immediately (so why did you initialise them?). What amplitude is it that you think you want to amplify?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With 50:50 probability, you either get $|0\rangle_m|000\ldots 0\rangle_a|f(0)\rangle_b$ or $|1\rangle_m|111\ldots 1\rangle_a|f(1)\rangle_b$. So, to get both values, you repeat until you've got both values. That requires a few runs. At best it takes 2, but you'd be better off just evaluating $f(0)$ and $f(1)$ by using two runs.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Update after question revision:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are still issues with the description of the protocol: what is $d$, and how do you produce such a state with $d\neq0$? Surely you're better off just leaving $d=0$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, i think we're now getting to the point of main misunderstanding, which is counting the circuit complexity. Every time you produce the state&#xA;$$&#xA;|\Psi_f\rangle=\sqrt½\sum_ic_i|i\rangle_x|f(i)\rangle(|i^{|a|}\rangle_a|f(i)\rangle_b+d\sum_{rs}|r\rangle_a|s\rangle_b)&#xA;$$&#xA;you have to evaluate the function $f(x)$. If that is the costly function to evaluate, you have to count the number of repetitions. You say &quot;Repeat the last 3 *s a bunch of times.&quot;, so that costs you a bunch of function evaluations, while just evaluating $f(0)$ and $f(1)$ costs you exactly 2 function evaluations. Moreover, to get 2 answers out, you must repeat your procedure at least twice, so you can never even get lucky and beat the naive classical case sometimes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you want to be able to copy the state $|\Psi_f\rangle$, then for all different functions $f(x)$, those states must be orthogonal. However, consider two different functions: $f(0)=f(1)=0$ and $g(0)=0,g(1)=1$. We have that $\langle\Psi_f|\Psi_g\rangle\neq 0$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-11T09:28:25.580" LastActivityDate="2018-06-11T09:28:25.580" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2292" PostTypeId="1" AcceptedAnswerId="2374" CreationDate="2018-06-11T07:07:03.777" Score="12" ViewCount="420" Body="&lt;p&gt;There are many fairly standard quantum algorithms that can all be understood within a very similar framework, from Deutsch's algorithm Simon's problem, Grover's search, Shor's algorithm and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One algorithm that seems to be completely different is the algorithm for evaluating the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jones Polynomial&lt;/a&gt;. Moreover, it seems like this is a crucial algorithm to understand in the sense that it is a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0001108&quot; rel=&quot;nofollow noreferrer&quot;&gt;BQP-complete&lt;/a&gt; problem: it exhibits the full power of a quantum computer. Also, for a variant of the problem, it's &lt;a href=&quot;https://arxiv.org/abs/0707.2831&quot; rel=&quot;nofollow noreferrer&quot;&gt;DQC-1 complete&lt;/a&gt;, i.e. it exhibits the full power of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9802037&quot; rel=&quot;nofollow noreferrer&quot;&gt;one clean qubit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jones Polynomial algorithm&lt;/a&gt; paper presents the algorithm in a very different way to the other quantum algorithms. Is there a more similar/familiar way that I can understand the algorithm (specifically, the unitary $U$ in the DQC-1 variant, or just the whole circuit in the BQP-complete variant)?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-15T13:26:44.420" LastActivityDate="2018-06-17T23:52:35.393" Title="Jones Polynomial" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;bqp&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2293" PostTypeId="2" ParentId="2283" CreationDate="2018-06-11T08:27:48.367" Score="1" Body="&lt;p&gt;For the first part of the question, I think that with &quot;single quantum state&quot;, the author is referring to the encoded quantum state, which will be an state formed by $n$-qubits. Such state is called stabilizer state because the encoding operation takes the input state, in this case $|0\rangle^{\otimes n}$, and takes it to a state in the codespace defined by the stabilizers. This code space is defined to be the $+1$ simultaneous eigenspace of the stabilizer operators, and in general has dimension $2^k$, so as in this case $k=0$, the dimension of this codespace will be $1$. Consequently, the author is trying to state that such zero-dimensional stabilizer codes refer to the basis of such $1$ dimensional subspace, which will be just a single quantum state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the author says that such state is robust to errors because an stabilizer error correction code is being applied to the state, and so errors will be correctable. Obviously a Hadamard gate would change the encoded state, but I think that with robust, the author is trying to say that the state can be corrected after the appearance of Pauli errors, that is $\{X,Y,Z\}^{\otimes n}$ operators applied to the state. This robustness obviously comes from the fact that an error-correction code is being applied to the $n$-ancilla qubit input state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then this codes would be obtainded by finding such encoding operator that would take the input $n$-state to the $+1$ simultaneous eigenspace that the $n$ stabilizer generators define (Note that in general ${n-k}$ generators are needed and that here $k=0$). I don't know what do you exactly want to say with the frase &quot;enforcing one of the stabilizer's generators&quot;. To find out the encoder unitary, most of the times, combinations of so-called Clifford gates are used, there are differents methods and algorithms in literature that are useful for finding the exact combination.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2018-06-11T08:45:34.513" LastActivityDate="2018-06-11T08:45:34.513" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2294" PostTypeId="2" ParentId="2282" CreationDate="2018-06-11T08:33:23.620" Score="3" Body="&lt;p&gt;One important point is that quantum computers contain classical computers. So it must be at least as hard to build a quantum computer as it is a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a concrete illustration, it's worth thinking about universal gate sets. In classical computation, you can create any circuit you want via the combination of just a single type of gate. Often people talk about the NAND gate, but for the sake of this argument, it's easier to talk about the Toffoli gate (also known as the controlled-controlled-not gate). Every classical (reversible) circuit can be written in terms of a whole bunch of Toffolis. An arbitrary quantum computation can be written as a combination of two different types of gate: the Toffoli and the Hadamard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has immediate consequences. Obviously, if you're asking for two different things, one of which does not exist in classical physics, that must be harder than just making the one thing that does exist in classical physics. Moreover, making use of the Hadamard means that the sets of possible states you have to consider are no longer orthogonal, so you cannot simply look at the state and determine how to proceed. This is particularly relevant to the Toffoli, because it becomes harder to implement as a result: before, you could safely measure the different inputs and, dependent upon their values, do something to the output. But if the inputs are not orthogonal (or even if they are, but in an unknown basis!) you cannot risk measuring them because you will destroy the states, specifically, you destroy the superpositions that are the whole thing that's making quantum computation different from classical computation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-11T08:33:23.620" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2295" PostTypeId="1" AcceptedAnswerId="2325" CreationDate="2018-06-11T08:34:07.303" Score="8" ViewCount="108" Body="&lt;p&gt;In &lt;em&gt;On the classification of all self-dual additive codes over $\textrm{GF}(4)$ of length up to 12&lt;/em&gt; by Danielsen and Parker, they state: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Two self-dual additive codes over $\textrm{GF}(4)$, $C$ and $C^\prime$, are equivalent if and only if the codewords of $C$ can be mapped onto the codewords of $C^\prime$ by a map that preserves self-duality. Such a map must consist of a permutation of coordinates (columns of the generator matrix), followed by multiplication of coordinates by nonzero elements from $\textrm{GF}(4)$, followed by possible conjugation of coordinates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;with the previous definition &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Conjugation of $x \in \textrm{GF}(4)$ is defined by $\bar{x} = x^2$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am confused what &quot;conjugation of coordinates&quot; means in this context. To me &quot;coordinates&quot; would normally refers to the code matrix's columns, or equivalently the quantum code's qubits. However, here it seems to be referring to the alphabet of the code, or equivalently the Pauli operators of the code's stabilizer generators. If this is the case, what operation does &quot;conjugation of coordinates&quot; represent with respect to the code's stabilizer generators?&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-13T09:19:46.773" Title="What does &quot;conjugation of coordinates&quot; mean with respect to GF(4) (quantum) codes" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2296" PostTypeId="1" AcceptedAnswerId="2297" CreationDate="2018-06-11T10:28:40.287" Score="5" ViewCount="124" Body="&lt;p&gt;I came across with a problem that involves $2$ quantum trits in state $\left| 22 \right&amp;gt;.$ What is it's tensor product interpretation and a matrix interpretation?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:31:54.943" LastActivityDate="2018-12-23T12:31:54.943" Title="What is the $\left| 22\right&gt;$ state?" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2297" PostTypeId="2" ParentId="2296" CreationDate="2018-06-11T10:49:55.480" Score="5" Body="&lt;p&gt;It is worth emphasising that the stuff that you write inside a ket is completely arbitrary. It's just a label you're attaching to something, so it should have a proper definition somewhere. Now, usually, we're talking about quantum spins with a certain size of Hilbert space, say $d$. &lt;em&gt;Probably&lt;/em&gt; here you're talking $d\geq 3$, and perhaps specifically $d=3$. Then, one set of basis states is often written as $|i\rangle$ for $i=0,1,\ldots d-1$. You can choose to represent these as vectors $(0,0,\ldots,0,1,0,0,\ldots 0)$ where the 1 is the $i+1$th entry, and there are $d$ entries. So, I guess you're talking about&#xA;$$&#xA;|2\rangle\equiv\left(\begin{array}{c} 0 \\ 0 \\ 1 \end{array}\right)&#xA;$$&#xA;The tensor product $|2\rangle\otimes|2\rangle$ then has the standard meaning.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-11T10:49:55.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2298" PostTypeId="1" CreationDate="2018-06-11T11:18:19.460" Score="6" ViewCount="139" Body="&lt;p&gt;One of the main ideas introduced in Giovannetti &lt;em&gt;et al.&lt;/em&gt; 2007 &#xA;(&lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;noreferrer&quot;&gt;0708.1879&lt;/a&gt;) is the so-called &lt;em&gt;bucket-brigade&lt;/em&gt; (q)RAM architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors state (first paragraph, second column, first page, in v2) that this new (at the time) (q)RAM architecture &lt;em&gt;reduces the number of switches that must be thrown during a RAM call, quantum or classical, from $O(N^{1/d})$ to $O(\log N)$&lt;/em&gt;, where $N=2^n$ is the number of memory slots in the RAM and $d$ is the dimension of the lattice that, according to the authors, conventional RAM architectures use for memory retrieval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conventional architecture they have in mind essentially consists in retrieving the information using a tree structure, like the one they present in their Fig. 1 (here reproduced):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/foz0w.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/foz0w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They say that this scheme requires to throw $O(N)$ switches for each memory call, but I don't understand why is this the case.&#xA;From the above, it would seem that one just needs to throw $O(\log_2(N))$ &#xA;switches, one per bifurcation, to get from the top to the bottom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that in the quantum case, with this protocol, we would end up with a state correlated with all of the $N$ switches, but they seem to be stating that even in the classical case one needs to activate them all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, is the advantage of the bucket-brigade approach only in the higher error resilience in the quantum case, or would it also be classically advantageous, compared with the conventional approaches?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-06-11T11:35:02.850" LastActivityDate="2018-06-18T13:26:25.050" Title="Are bucket-brigate (q)RAM architectures also advantageous in the classical case?" Tags="&lt;quantum-memory&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2299" PostTypeId="1" AcceptedAnswerId="2300" CreationDate="2018-06-11T13:08:53.187" Score="19" ViewCount="3510" Body="&lt;p&gt;If a circuit takes more than one qubit as its input and has quantum gates which take different numbers of qubits as their input, how would we interpret this circuit as a matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a toy example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KQlv8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KQlv8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2019-05-13T19:50:13.183" LastActivityDate="2019-05-13T19:50:13.183" Title="How to interpret a quantum circuit as a matrix?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2300" PostTypeId="2" ParentId="2299" CreationDate="2018-06-11T13:37:10.290" Score="20" Body="&lt;h2&gt;Specific Circuit&lt;/h2&gt;&#xA;&lt;p&gt;The first gate is a Hadamard gate which is normally represented by &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, since we're only applying it to the first qubit, we use a kronecker product on it (this confused me so much when I was starting out - I had no idea how to scale gates; as you can imagine, it's rather important), so we do &lt;span class=&quot;math-container&quot;&gt;$H\otimes I$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the 2x2 identity matrix. This produces&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next we have a CNOT gate. This is normally represented by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the right size for two qubits, so we don't need to scale using kronecker products. We then have another hadamard gate, which scales the same was as the first. To find the overall matrix for the circuit, then, we multiply them all together:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{bmatrix}\begin{bmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0\end{bmatrix}\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}\begin{bmatrix}1&amp;amp;1&amp;amp;1&amp;amp;-1\\1&amp;amp;1&amp;amp;-1&amp;amp;1\\1&amp;amp;-1&amp;amp;1&amp;amp;1\\-1&amp;amp;1&amp;amp;1&amp;amp;1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(if python multiplied correctly =) We would then multiply this by our original qubit state, and get our result.&lt;/p&gt;&#xA;&lt;h2&gt;Generalization&lt;/h2&gt;&#xA;&lt;p&gt;So basically, you go through each gate one by one, take the base representation, and scale them appropriately using kronecker products with identity matrices. Then you multiply all the matrices together in the order they are applied. Be sure to do this such that if you wrote out the multiplication, the very first gate is on the far right; as arriopolis points out, this is a common mistake. Matrices are not commutative! If you don't know the base representation of a matrix, check first &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_gates&quot; rel=&quot;noreferrer&quot;&gt;wikipedia's article on quantum gates&lt;/a&gt; which has a lot.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-06-12T13:22:05.087" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2301" PostTypeId="2" ParentId="2289" CreationDate="2018-06-11T13:51:22.320" Score="0" Body="&lt;p&gt;Ampltiude amplification seems to require both that it is easy to judge between good and bad (which is easy enough if one goes by the $x$ qubit), and that it is easy to get to one's starting point, which in this case requires evaluating $f$.&lt;/p&gt;&#xA;" OwnerUserId="2592" LastActivityDate="2018-06-11T13:51:22.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2302" PostTypeId="1" AcceptedAnswerId="2304" CreationDate="2018-06-11T15:16:39.920" Score="7" ViewCount="2214" Body="&lt;p&gt;What does it mean to measure a qubit (or multiple qubits) in standard basis?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:32:44.687" LastActivityDate="2018-12-23T12:32:44.687" Title="Measuring in standard basis meaning" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2303" PostTypeId="2" ParentId="2302" CreationDate="2018-06-11T15:19:41.880" Score="6" Body="&lt;p&gt;You define the projectors&#xA;$$&#xA;P_0=|0\rangle\langle 0|=\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{array}\right)\qquad P_1=|1\rangle\langle 1|=\left(\begin{array}{cc} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right).&#xA;$$&#xA;For any state $|\psi\rangle$, the probability of getting answer $x$ is $p_x=\langle\psi|P_x|\psi\rangle$ and, after the measurement, the qubit is in the state $|x\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to measure multiple (say $n$) qubits in the standard basis, you can take arbitrary tensor products of the single-qubit terms,&#xA;$$&#xA;P_x=|x\rangle\langle x|=\bigotimes_{i=1}^nP_{x_i}&#xA;$$&#xA;for $x\in\{0,1\}^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where you have to be a little more careful is if you're measuring only a subset of qubits. Then, the probability is still $p_x=\langle\psi|P_x|\psi\rangle$, but the output state is $P_x|\psi\rangle/\sqrt{p_x}$, which could still be a superposition of multiple basis states (all those for which the measured qubits correspond to $x$).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-11T15:19:41.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2304" PostTypeId="2" ParentId="2302" CreationDate="2018-06-11T15:45:44.460" Score="8" Body="&lt;p&gt;A $1$-qubit system, in general, can be in a state $a|0\rangle+b|1\rangle$ where $|0\rangle$ and $|1\rangle$ are basis vectors of a two dimensional complex vector space. The &lt;strong&gt;standard basis&lt;/strong&gt; for measurement here is $\{|0\rangle,|1\rangle\}$. When you are measuring in this basis, with $\frac{|a|^2}{|a|^2+|b|^2}\times 100\%$ probability you will find that the state after measurement is $|0\rangle$ and with $\frac{|b|^2}{|a|^2+|b|^2}\times 100\%$ you'll find that the state after measurement is $|1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you could carry out the measurement in some other basis too, say $\{\frac{|0\rangle+|1\rangle}{\sqrt{2}},\frac{|0\rangle-|1\rangle}{\sqrt{2}}\}$, but that wouldn't be the &lt;strong&gt;standard basis&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Exercise&lt;/strong&gt;: Express $a|0\rangle+b|1\rangle$ in the form $c(\frac{|0\rangle+|1\rangle}{\sqrt{2}})+d(\frac{|0\rangle-|1\rangle}{\sqrt{2}})$&#xA;  where $a,b,c,d\in\Bbb C$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you measure in the basis the probability of ending in the state $\frac{|0\rangle+|1\rangle}{\sqrt{2}}$ after a measurement is $\frac{|c|^2}{|c|^2+|d|^2}\times 100\%$ and probability of ending in the state $\frac{|0\rangle-|1\rangle}{\sqrt{2}}$ is $\frac{|d|^2}{|c|^2+|d|^2}\times 100\%$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for a $2$-qubit system the standard basis would $\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$ and its general state can be expressed as $\alpha|00\rangle + \beta|01\rangle + \gamma|10\rangle + \delta|11\rangle$. When you measure this in the standard basis you can easily see that the probability of ending up in the state (say) $|00\rangle$ will be $\frac{|\alpha|^2}{|\alpha|^2+|\beta|^2+|\gamma|^2+|\delta|^2}\times 100\%$. Similarly you can deduce the probabilities for the other states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to extrapolate this same logic to general $n$-qubit states, now. Feel free to ask questions in the comments.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-11T16:06:29.290" LastActivityDate="2018-06-11T16:06:29.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2305" PostTypeId="2" ParentId="2292" CreationDate="2018-06-11T17:09:30.193" Score="3" Body="&lt;p&gt;You have mentioned five papers in the question, but one paper that remains unmentioned is the &lt;a href=&quot;https://arxiv.org/abs/0909.1550&quot; rel=&quot;nofollow noreferrer&quot;&gt;experimental implementation in 2009&lt;/a&gt;. Here you will find the actual circuit that was used to evaluate a Jones polynomial:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TgewZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TgewZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be the closest you will get to a &quot;more familiar&quot; presentation of the algorithm, as interest in the Jones polynomial and in DQC-1 have decayed a bit since 2009.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More details on this experiment can be found in Gina Passante's &lt;a href=&quot;https://uwspace.uwaterloo.ca/handle/10012/6594&quot; rel=&quot;nofollow noreferrer&quot;&gt;thesis&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-14T20:00:36.673" LastActivityDate="2018-06-14T20:00:36.673" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2306" PostTypeId="1" AcceptedAnswerId="2307" CreationDate="2018-06-11T20:18:39.413" Score="9" ViewCount="460" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1803.11173&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; the authors argue that the efforts of creating a scalable quantum neural network using a set of parameterized gates are deemed to fail for a large number of qubits. This is due to the fact that, due to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Levi%27s_lemma&quot; rel=&quot;nofollow noreferrer&quot;&gt;Levy's Lemma&lt;/a&gt;, the gradient of a function in high dimensional spaces is almost zero everywhere. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if this argument can be also applied to other hybrid quantum-classical optimization methods, like &lt;strong&gt;VQE&lt;/strong&gt; (Variational Quantum Eigensolver) or &lt;strong&gt;QAOA&lt;/strong&gt; (Quantum Approximate Optimization Algorithm). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think?&lt;/p&gt;&#xA;" OwnerUserId="1644" LastEditorUserId="55" LastEditDate="2020-08-01T11:37:12.887" LastActivityDate="2020-08-01T11:37:12.887" Title="Barren plateaus in quantum neural network training landscapes" Tags="&lt;speedup&gt;&lt;optimization&gt;&lt;qaoa&gt;&lt;neural-network&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2307" PostTypeId="2" ParentId="2306" CreationDate="2018-06-12T00:47:44.990" Score="4" Body="&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;: The paper references [&lt;a href=&quot;http://www.math.univ-toulouse.fr/~ledoux/Villani2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;37&lt;/a&gt;] for Levy's Lemma, but you will find no mention of &quot;Levy's Lemma&quot; in [37]. You will find it called &quot;Levy's Inequality&quot;, which is called Levy's Lemma in &lt;a href=&quot;http://www.mpmueller.net/seminar/talk7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, which is &lt;em&gt;not&lt;/em&gt; cited in the paper you mention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second&lt;/strong&gt;: There is an easy proof that this claim is false for VQE. In quantum chemistry we optimize the parameters of a wavefunction ansatz $|\Psi(\vec{p})\rangle$ in order to get the lowest (i.e. most accurate) energy. The energy is evaluated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;E_{\vec{p}} = \frac{\left\langle \Psi(\vec{p})\right|H\left|\Psi(\vec{p})\right\rangle}{\left\langle\Psi(\vec{p}) \right|\left.\Psi(\vec{p}) \right\rangle}. &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;VQE just means we use a quantum computer to evaluate this energy, and a classical computer to choose how to improve the parameters in $\vec{p}$ so that the energy will be lower in the next quantum iteration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So whether or not the &quot;gradient will be will be 0 almost everywhere when the number of parameters in $\vec{p}$ is large&quot; does not depend at all on whether we are using VQE (on a quantum computer) or just running a standard quantum chemistry program (like &lt;a href=&quot;https://en.wikipedia.org/wiki/Gaussian_(software)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian&lt;/a&gt;) on a classical computer. Quantum chemists typically variationally optimize the above energy with up to $10^{10}$ parameters in $\vec{p}$, and the only reason we don't go beyond that is because we run out of RAM, not because the energy landscape starts to become flat. In this paper you can see at the end of the abstract that they calculated the energy for a wavefunction with about &lt;a href=&quot;https://arxiv.org/pdf/1707.04346.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;$10^{12}$ parameters&lt;/a&gt;, where the parameters are coefficients of Slater determinants. It is generally known that the energy landscape is not so flat (like it would be if the gradient were 0 almost everywhere) even when there's a trillion parameters or even more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;: The application of Levy's Lemma is going to depend on the particular energy landscape that you have, which will depend on both  $H$ and your ansatz $|\Psi(\vec{p})\rangle$. In the case of their particular implementation of QNN's, they have found an application of Levy's Lemma to be appropriate. In the case of VQE, we have a counter-example to the claim that Levy's Lemma &quot;always&quot; applies. The counter example where Levy's Lemma does not apply is when $H$ is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Molecular_Hamiltonian&quot; rel=&quot;nofollow noreferrer&quot;&gt;molecular Hamiltonian&lt;/a&gt; and $|\Psi\rangle$ is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Configuration_interaction&quot; rel=&quot;nofollow noreferrer&quot;&gt;CI&lt;/a&gt; wavefunction.  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-12T00:47:44.990" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2308" PostTypeId="2" ParentId="2275" CreationDate="2018-06-12T06:52:33.563" Score="2" Body="&lt;p&gt;A projection operator $P$ has two key properties:&#xA;$$&#xA;P^\dagger=P\qquad P^2=P&#xA;$$&#xA;A particularly simple instance of a projection operator is a rank 1 projector, $P=|\phi\rangle\langle\phi|$, which you can easily see satisfies the two properties given that $|\phi\rangle$ is a normalised state, so $\langle\phi|\phi\rangle=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see what rank the projector is, simply evaluate $\text{rank}(P)=\text{Tr}(P)$. In your state example of $P=|0\rangle\langle 0|+|2\rangle\langle 2|$, you can see that the rank is 2, so it cannot be written as a rank 1 projector $|\phi\rangle\langle\phi|$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-12T06:52:33.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2309" PostTypeId="2" ParentId="2282" CreationDate="2018-06-12T07:57:06.303" Score="0" Body="&lt;h1&gt;Ultimate Black Box&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A quantum computer is by definition the ultimate black box. You feed in an input and you get a process, which produces an output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any attempt to open up the black box, will result in the process not happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any engineer would tell you that would hinder any design process. Even the smallest design flaw would takes months of trial and error to trace down.&lt;/p&gt;&#xA;" OwnerUserId="2622" LastActivityDate="2018-06-12T07:57:06.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2310" PostTypeId="1" AcceptedAnswerId="2314" CreationDate="2018-06-12T09:48:37.680" Score="20" ViewCount="4237" Body="&lt;p&gt;Given a $2$ qubit-system and thus $4$ possible measurements results in the basis $\{|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle\}$, how can I prepare the state, where:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;only $3$ of these $4$ measurement results are possible (say, $|00\rangle$, $|01\rangle$, $|10\rangle$)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;these measurements are equally likely? (like Bell state but for $3$ outcomes)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2624" LastEditorUserId="55" LastEditDate="2018-06-12T14:01:22.067" LastActivityDate="2020-03-27T15:24:36.033" Title="How can I build a circuit to generate an equal superposition of 3 outcomes for 2 qubits?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="5" CommentCount="5" FavoriteCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="2312" PostTypeId="2" ParentId="2310" CreationDate="2018-06-12T12:28:49.647" Score="10" Body="&lt;p&gt;I'll tell you how to create &lt;em&gt;any&lt;/em&gt; two qubit pure state you might ever be interested in. Hopefully you can use it to generate the state you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using a single qubit rotation followed by a cnot, it is possible to create states of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \alpha \, |0\rangle \otimes |0\rangle + \beta \, |1\rangle \otimes |1\rangle .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you can apply an arbitrary unitary, $U$, to the first qubit. This rotates the $|0\rangle$ and $|1\rangle$ states to new states that we'll call $|a_0\rangle$ and $|a_1\rangle$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$U |0\rangle = |a_0\rangle, \,\,\, U |1\rangle = |a_1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our entangled state is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha \, |a_0\rangle \otimes |0\rangle + \beta \, |a_1\rangle \otimes |1\rangle .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can similarly apply a unitary to the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$V |0\rangle = |b_0\rangle, \,\,\, V |1\rangle = |b_1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives us the state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha \, |a_0\rangle \otimes |b_0\rangle + \beta \, |a_1\rangle \otimes |b_1\rangle .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the Schmidt decomposition, it is possible to express any pure state of two qubits in the form above. This means that any pure state of two qubits, including the one you want, can be created by this procedure. You just need to find the right rotation around the x axis, and the right unitaries $U$ and $V$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find these, you first need to get the reduced density matrix for each of your two qubits. The eigenstates for the density matrix of your first qubit will be your $|a_0\rangle$ and $|a_1\rangle$. The eigenstates for the second qubit will be $|b_0\rangle$ and $|b_1\rangle$. You'll also find that $|a_0\rangle$ and $|b_0\rangle$ will have the same eigenvalue, which is $\alpha^2$. The coefficient $\beta$ can be similarly derived from the eigenvalues of $|a_1\rangle$ and $|b_1\rangle$.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-12T12:28:49.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2313" PostTypeId="2" ParentId="2310" CreationDate="2018-06-12T12:30:27.517" Score="12" Body="&lt;p&gt;Here is how you might go about &lt;em&gt;designing&lt;/em&gt; such a circuit.$\def\ket#1{\lvert#1\rangle}$&#xA;Suppose that you would like to produce the state $\ket{\psi} = \tfrac{1}{\sqrt 3} \bigl( \ket{00} + \ket{01} + \ket{10} \bigr)$. Note the normalisation of ${\small 1}/\small \sqrt 3$, which is necessary for $\ket{\psi}$ to be a unit vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to consider a straightforward way to realise this state, we might want to think in terms of the first qubit being a control, which determines whether the second qubit should be in the state $\ket{+} = \tfrac{1}{\sqrt 2}\bigl(\ket{0}+\ket{1}\bigr)$, or in the state $\ket{0}$, by using some conditional operations. This motivates considering the decomposition&#xA;$$ \ket{\psi} \;=\; \tfrac{\sqrt 2}{\sqrt 3}\ket{0}\ket{+} \;+\; \tfrac{1}{\sqrt 3}\ket{1}\ket{0}.$$&#xA;Taking this view it makes sense to consider preparing $\ket{\psi}$ as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare two qubits in the state $\ket{00}$.&lt;/li&gt;&#xA;&lt;li&gt;Rotate the first qubit so that it is in the state $\tfrac{\sqrt 2}{\sqrt 3}\ket{0} + \tfrac{1}{\sqrt 3}\ket{1}$.&lt;/li&gt;&#xA;&lt;li&gt;Apply a coherently controlled operation on the two qubits which, when the first qubit is in the state $\ket{0}$, performs a Hadamard on the second qubit.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Which specific operations you would apply to realise these transformations &amp;mdash; &lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;which single-qubit transformation would be most suitable for step&amp;nbsp;2, and how you might decompose the two-qubit unitary in step&amp;nbsp;3 into CNOTs and Pauli rotations &amp;mdash; is a simple exercise. (Hint: use the fact that both $X$ and the Hadamard are self-inverse to find as simple a decomposition as possible in step&amp;nbsp;3.)&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-06-12T12:30:27.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2314" PostTypeId="2" ParentId="2310" CreationDate="2018-06-12T12:46:05.623" Score="11" Body="&lt;p&gt;Break the problem in parts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we have already sent $\mid 00 \rangle$ to $\frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle$. We can send that to $\frac{1}{\sqrt{3}} \mid 00 \rangle + (\frac{1}{2} (1+i))\frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle + (\frac{1}{2} (1-i))\frac{\sqrt{2}}{\sqrt{3}}\mid 10 \rangle$ by a $\sqrt{SWAP}$. That satisfies you're requirements with all probabilities $\frac{1}{3}$ but with different phases. If you want use phase shift gates on each to get the phases you want like if you want to make them all equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now how do we get from $\mid 00 \rangle$ to $\frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle$? If it was $\frac{1}{\sqrt{2}} \mid 00 \rangle + \frac{1}{\sqrt{2}}\mid 01 \rangle$, we could do a Hadamard on the second qubit. It is not a easy with this but we can still use a unitary only on the second qubit. That is done by a rotation operator purely on the second qubit by factoring as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$Id \otimes U : \; \mid 0 \rangle \otimes (\mid 0 \rangle) \to &#xA;\mid 0 \rangle \otimes (\frac{1}{\sqrt{3}} \mid 0 \rangle + \frac{\sqrt{2}}{\sqrt{3}} \mid 1 \rangle)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;U = \begin{pmatrix}&#xA;\frac{1}{\sqrt{3}} &amp;amp; \frac{\sqrt{2}}{\sqrt{3}} &amp;amp; \\&#xA;\frac{\sqrt{2}}{\sqrt{3}} &amp;amp; -\frac{1}{\sqrt{3}} &amp;amp; \\&#xA;\end{pmatrix}&#xA;$$ works. Decompose this into more basic gates if you need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In total we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mid 00 \rangle \to \frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle\\&#xA;\to \frac{1}{\sqrt{3}} \mid 00 \rangle + (\frac{1}{2} (1+i))\frac{\sqrt{2}}{\sqrt{3}}\mid 01 \rangle + (\frac{1}{2} (1-i))\frac{\sqrt{2}}{\sqrt{3}}\mid 10 \rangle\\&#xA;\to \frac{1}{\sqrt{3}} \mid 00 \rangle + \frac{e^{i \theta_1}}{\sqrt{3}}\mid 01 \rangle + \frac{e^{i \theta_2}}{\sqrt{3}}\mid 10 \rangle&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-06-12T12:46:05.623" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2315" PostTypeId="5" CreationDate="2018-06-12T19:02:10.137" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-06-12T19:02:10.137" LastActivityDate="2018-06-12T19:02:10.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2316" PostTypeId="4" CreationDate="2018-06-12T19:02:10.137" Score="0" Body="For questions about Pauli matrices in general or Pauli gates in particular, as relevant to quantum computing and/or quantum information theory. The Pauli matrices are a set of three 2 × 2 complex matrices which are Hermitian and unitary. The three Pauli gates are: Pauli-X gate, Pauli-Y gate &amp; Pauli-Z gate. X = {{0,1},{1,0}}; Y = {{0,-i},{i,0}}; Z = {{1,0},{0,-1}}." OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-07-15T13:27:06.120" LastActivityDate="2018-07-15T13:27:06.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2317" PostTypeId="1" CreationDate="2018-06-12T20:23:53.247" Score="8" ViewCount="98" Body="&lt;p&gt;In [1], the problem of simulating a Hamiltonian using repeated applications of a different set of Hamiltonians is discussed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, let $A$ and $B$ be a pair of Hermitian operators, and let $\mathcal L$ be the algebra generated from $A, B$ through repeated commutation $^{\mathbf{(\dagger)}}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author then asks (first paragraph of third page) what  is $\mathcal L$ for an arbitrary pair of observables $A$ and $B$, and argues that $\mathcal L$ is the space of all Hermitian matrices, unless (quoting from the paper) &lt;em&gt;both $e^{iA t}$ and $e^{iB t}$ lie in an $n$-dimensional unitary representation of some Lie group other than $U(n)$&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not too familiar with the theory of Lie algebras, so this statement is quite cryptic for me.&#xA;How can this be shown more explicitly?&#xA;Equivalently, is there a more direct way to show this fact?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;$(\dagger)$: More explicitly, this is the vector space spanned by $A, B, i[A,B], [A,[A,B]], ...$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Lloyd 1995, &lt;em&gt;Almost Any Quantum Logic Gate is Universal&lt;/em&gt;, &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.75.346&quot; rel=&quot;noreferrer&quot;&gt;Link to PRL&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-06-12T21:07:54.603" LastActivityDate="2018-06-13T05:17:06.980" Title="Why does (almost) every pair of Hamiltonians generate, through repeated commutation, the whole space of Hermitian matrices?" Tags="&lt;simulation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2318" PostTypeId="2" ParentId="2282" CreationDate="2018-06-12T20:30:27.347" Score="5" Body="&lt;p&gt;Simpler answer: All quantum computers are classical computers too, if you limit their gate set to only classical gates such as $X$, which is the NOT gate. Every time you build a quantum computer, you're also building a classical computer, so you can prove mathematically that building a quantum computer must be at least as hard as building a classical computer. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-12T20:30:27.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2319" PostTypeId="2" ParentId="2317" CreationDate="2018-06-12T20:58:43.877" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm not too familiar with the theory of Lie algebras, so this&#xA;  statement is quite cryptic for me. How can this be shown more&#xA;  explicitly? Equivalently, is there a more direct way to show this&#xA;  fact?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;At around the same time, David Deutsch &lt;em&gt;et al&lt;/em&gt;. proved the same thing in this paper: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9505018&quot; rel=&quot;nofollow noreferrer&quot;&gt;Universality in Quantum Computation (1995)&lt;/a&gt;, but without ever using the word &quot;algebra&quot; or &quot;Lie&quot; in the whole paper. The proof starts on page 3 and the main point is at Eq. 9, which is the same equation that appears in Seth Lloyd's paper, but here it is explained without reference to &quot;Lie algebras&quot;. Eq. 9 is an application of what in physics we often just call the &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_product_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trotter splitting&lt;/a&gt;&quot;. It was written down almost 100 years earlier by Sophus Lie, but you do not need to know anything about Lie Algebras or even vector spaces in order to apply the formula as done in Eq. 9.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-06-13T05:17:06.980" LastActivityDate="2018-06-13T05:17:06.980" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2320" PostTypeId="1" AcceptedAnswerId="2322" CreationDate="2018-06-12T21:10:13.010" Score="8" ViewCount="102" Body="&lt;p&gt;If this isn't known, would they theoretically be? I'm particularly interested in knowing whether a QC would be faster at evaluating the fitness function of the possible solutions than a classical machine &lt;/p&gt;&#xA;" OwnerUserId="2637" LastEditorUserId="26" LastEditDate="2018-06-13T05:39:39.603" LastActivityDate="2018-06-13T15:31:08.753" Title="Are Genetic Programming runtimes faster on QCs than on classical computers?" Tags="&lt;speedup&gt;&lt;applications&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2321" PostTypeId="1" CreationDate="2018-06-12T23:55:01.523" Score="9" ViewCount="187" Body="&lt;p&gt;As the title suggests, I want to know what the applicability of quantum network coding is, besides the EPR pair construction between distant pairs of 'Users-Targets'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can quantum network coding be used for computation?&lt;/p&gt;&#xA;" OwnerUserId="2422" LastEditorUserId="26" LastEditDate="2018-12-13T19:53:04.367" LastActivityDate="2018-12-13T19:53:04.367" Title="What is the applicability of quantum network coding?" Tags="&lt;entanglement&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2322" PostTypeId="2" ParentId="2320" CreationDate="2018-06-13T00:22:01.660" Score="3" Body="&lt;p&gt;There are &lt;a href=&quot;https://arxiv.org/abs/cs/0403003&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum algorithms for genetic programming&lt;/a&gt; which would theoretically have advantages over the corresponding classical genetic programming algorithms &lt;em&gt;but&lt;/em&gt; you would need a full-fledged quantum computer with more qubits than any quantum computer we currently have, in order to observe such an advantage.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-13T15:31:08.753" LastActivityDate="2018-06-13T15:31:08.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2323" PostTypeId="2" ParentId="2321" CreationDate="2018-06-13T06:46:45.823" Score="5" Body="&lt;p&gt;Network coding &amp;mdash; both classical network coding, and quantum network coding &amp;mdash; is an approach to distributing information by performing simple operations at nodes in a network, acting on input signals and transmitting the outputs to other nodes. To put it another way, network coding is an approach to distributing information using a communications network if we treat it as a logical circuit, albeit where the 'gates' performed at each node may be a bit more powerful than just AND, OR, CNOT, or the like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In principle, we can use the setting of network coding to perform non-trivial computations by an appropriate choice of operations (gates) at the nodes. Network coding does not usually allow the freedom to also choose the structure of the network itself (&lt;em&gt;i.e.&lt;/em&gt; the circuit topology), as this is usually given as an input parameter to a given network coding problem. But there will still be some range of computations which a given network can admit, not all of which will serve merely to distribute information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the particular case of quantum network coding, the detail that things are to be done in a distributed  (and presumably coherent) manner does add wrinkles to how you can manage to accomplish things. However, if we allow classical communication between nodes in the network as well &amp;mdash; either allowing classical messages to move both forward and backward within the coding network or in an all-to-all manner &amp;mdash; then you can perform coherent quantum network coding for the &lt;em&gt;k&lt;/em&gt;-pairs problem &#xA;&lt;strong&gt;[1]&lt;/strong&gt; or an arbitrary network coding problem &lt;strong&gt;[2]&lt;/strong&gt; respectively, provided that a classical network protocol exists for the same problem in the same network: and furthermore, the way this is done can be seen to essentially be &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1347/124&quot;&gt;Measurement Based Quantum Computation&lt;/a&gt; (MBQC), as Martin Roeteller and I showed &lt;strong&gt;[3]&lt;/strong&gt;. Conversely, it is fairly clear that for any MBQC procedure, there is a corresponding coding network topology which allows that procedure to be realised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It follows that, while the details are a bit pickier than in the classical case, quantum network coding can be viewed as a setting in which to do universal computation, specifically via MBQC, at least so long as auxiliary classical communication is allowed (with somewhat fewer constraints than on quantum communication).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[1]&lt;/strong&gt; &lt;em&gt;Constructing Quantum Network Coding Schemes from Classical Nonlinear Protocols&lt;/em&gt;. Kobayashi &lt;em&gt;et al.&lt;/em&gt; (2010). [&lt;a href=&quot;https://arxiv.org/abs/1012.4583&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1012.4583&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[2]&lt;/strong&gt; &lt;em&gt;General Scheme for Perfect Quantum Network Coding with Free Classical Communication&lt;/em&gt;. Kobayashi &lt;em&gt;et al.&lt;/em&gt; (2009). [&lt;a href=&quot;https://arxiv.org/abs/0908.1457&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0908.1457&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[3]&lt;/strong&gt; &lt;em&gt;Quantum linear network coding as one-way quantum computation.&lt;/em&gt; de&amp;nbsp;Beaudrap &amp;amp; Roetteler (2014). [&lt;a href=&quot;https://arxiv.org/abs/1403.3533&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1403.3533&lt;/a&gt;]&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-06-13T16:53:00.130" LastActivityDate="2018-06-13T16:53:00.130" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2324" PostTypeId="1" AcceptedAnswerId="2328" CreationDate="2018-06-13T08:57:25.770" Score="8" ViewCount="1199" Body="&lt;p&gt;I have some perplexity concerning the concept of phase estimation: by definition, given a unitary operator $U$ &lt;em&gt;and&lt;/em&gt; an eigenvector $|u\rangle$ with related eigenvalue $\text{exp}(2\pi i \phi)$, the phase estimation allows to find the value of $\phi$.&#xA;This would mean that I would be able to determine an eigenvalue of a certain matrix &lt;em&gt;given&lt;/em&gt; that I know already one of its eigenvectors? But isn't the fact that needing an eigenvector beforehand would quite reduce the usefulness of the phase estimation itself?&lt;/p&gt;&#xA;" OwnerUserId="2648" LastEditorUserId="26" LastEditDate="2018-06-13T09:59:37.100" LastActivityDate="2018-06-13T10:43:17.927" Title="What is the actual power of Quantum Phase Estimation?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;complexity-theory&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2325" PostTypeId="2" ParentId="2295" CreationDate="2018-06-13T09:19:46.773" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am confused what &quot;conjugation of coordinates&quot; means in this context.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/a/234871/510296&quot;&gt;Conjugating&lt;/a&gt; coordinates of $\mathcal C$ is equivalent to setting some diagonal elements of Γ to 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read &quot;&lt;a href=&quot;https://arxiv.org/abs/math/0504522&quot; rel=&quot;nofollow noreferrer&quot;&gt;Theorem 12, on page 8 and 9&lt;/a&gt;&quot; for an understanding of the usage, this is further explained on page 15 (last paragraph):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;As mentioned before, the set of self-dual linear codes over GF(4) is a subset of the self-dual additive codes of Type II. Note that &lt;strong&gt;conjugation of single coordinates does not preserve the linearity of a code&lt;/strong&gt;. It was shown by Van den Nest $^{[25]}$ that the code $\mathcal C$ generated by a matrix of the form Γ + $ωI$ can not be linear. However, &lt;strong&gt;if there is a linear code equivalent to $\mathcal C$, it can be found by conjugating some coordinates. Conjugating coordinates of $\mathcal C$ is equivalent to setting some diagonal elements of Γ to 1&lt;/strong&gt;. Let $A$ be a binary diagonal matrix such that Γ + $A$ + $ωI$ generates a linear code. Van den Nest $^{[25]}$ proved that $\mathcal C$ is equivalent to a linear code if and only if there exists such a matrix $A$ that satisfies Γ$^2$ + $A$Γ + Γ$A$ + Γ + $I$ = $0$. A similar result was found by Glynn et al. $^{[12]}$. Using this method, it is easy to check whether the LC orbit of a given graph corresponds to a linear code. However, self-dual linear codes over GF(4) have already been classified up to length 16, and we have not found a way to extend this result using the graph approach.&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;References:&#xA;[12] D. G. Glynn, T. A. Gulliver, J. G. Maks, M. K. Gupta, The geometry of additive quantum codes, submitted to Springer-Verlag, 2004.&lt;/code&gt; &lt;a href=&quot;https://www.researchgate.net/publication/230899738_The_geometry_of_additive_quantum_codes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Book&lt;/a&gt; &lt;code&gt;&#xA;[25] M. Van den Nest, Local Equivalence of Stabilizer States and Codes, Ph.D. thesis, K. U. Leuven, Leuven, Belgium, May 2005.&lt;/code&gt; &lt;a href=&quot;ftp://ftp.esat.kuleuven.be/pub/SISTA/ida/reports/05-99.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;.PDF&lt;/a&gt; (English starts on page 22)&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-06-13T09:19:46.773" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2326" PostTypeId="2" ParentId="1952" CreationDate="2018-06-13T09:42:50.000" Score="2" Body="&lt;p&gt;A couple papers are out there on algorithms which can be constructed using reverse annealing, &lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1367-2630/aa59c4/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://iopscience.iop.org/article/10.1088/1367-2630/aa59c4/meta&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1609.05875&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1609.05875&lt;/a&gt; (it is worth pointing out previous somewhat related closed system work: &lt;a href=&quot;https://link.springer.com/article/10.1007/s11128-010-0168-z&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://link.springer.com/article/10.1007/s11128-010-0168-z&lt;/a&gt;). As far as experimental results, I think the only ones publicly visible at the time of writing are the white paper given in the previous post. However, there will be some new work presented at AQC 2018 (&lt;a href=&quot;https://ti.arc.nasa.gov/events/aqc-18/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ti.arc.nasa.gov/events/aqc-18/&lt;/a&gt;) in late June and these talks are usually put online a few months after the conference.&lt;/p&gt;&#xA;" OwnerUserId="2649" LastActivityDate="2018-06-13T09:42:50.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2327" PostTypeId="2" ParentId="2324" CreationDate="2018-06-13T10:04:16.787" Score="6" Body="&lt;p&gt;Sometimes, you might know the eigenvector, and the computational question that you want to answer is what the eigenvalue is. For example, any function evaluation $f(x)$ defined by the action of a $U$&#xA;$$&#xA;U:|x\rangle|y\rangle\mapsto|x\rangle|y\oplus f(x)\rangle&#xA;$$for $x\in\{0,1\}^n$, $y\in\{0,1\}$ has well defined eigenvectors,&#xA;$$&#xA;|x\rangle(|0\rangle\pm|1\rangle)/\sqrt{2},&#xA;$$&#xA;but whether the eigenvalue is $\pm 1$ is absolutely vital: that is essentially the question being asked in things like Deutsch's algorithm, Deutsch-Jozsa, Simon's algorithm, Bernstein-Vazirani etc. It's also the way that the oracle for quantum search is often constructed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a slightly more generalised setting (that applies, for example, to Shor's algorithm), you might not need to find a specific eigenvalue, but a random choice from some subset will do. So it might be that there's a standard state (e.g. $|00\ldots 01\rangle$) that has support on all of the eigenvectors from which you want to pick an eigenvalue randomly, but you have no idea what the individual eigenvectors are, but you can run phase estimation with that input, and you'll be just fine.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-13T10:04:16.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2328" PostTypeId="2" ParentId="2324" CreationDate="2018-06-13T10:25:15.997" Score="7" Body="&lt;p&gt;If you don't supply a $|u\rangle$ as an input, there are two possible things you might want to get out:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The $\varphi$ for a randomly chosen (but unknown) eigenstate $|u\rangle$;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Both $\varphi$ and $|u\rangle$ for one or more eigenstates.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let's first look at 1. Since eigenstates form a complete basis, any input state you use can be interpreted as a superposition of the eigenstates of $U$. Due to the linearity of quantum mechanics, the algorithm would then run for all these states at once. Then at the end, when you measure the output, it will randomly collapse to a given instance. This means that you'll be given a $\varphi$ for a randomly chosen eigenstate, but you won't know which it is. The existing phase estimation algorithm therefore can supply us with the first possible application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second application is something we can't do with standard phase estimation, but let's consider it hypothetically. Any algorithm that could do this would be giving us an eigenstate $|u\rangle$ as part of the output. So if you want to actually know what $|u\rangle$ is, you'd have to do tomography on the output. Since tomography is inefficient, there would probably be better ways to go about doing this.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-06-13T10:43:17.927" LastActivityDate="2018-06-13T10:43:17.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2329" PostTypeId="1" AcceptedAnswerId="2331" CreationDate="2018-06-13T10:37:20.920" Score="8" ViewCount="162" Body="&lt;p&gt;If we start with a Hamiltonian $H(t_i)$, and with our qubits prepared in the ground state of this, and then slowly change this to a Hamiltonian $H(t_i)$, the final state of our qubits should be the ground state of the new Hamiltonian. This is due to the adiabatic theorem, and is the basis of quantum annealing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if it's not the ground state we want? Suppose we start with the first excited state of $H(t_i)$. Does the process give us the first excited state of $H(t_f)$? What about for other states?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-13T15:18:46.847" Title="Can quantum annealing find excited states?" Tags="&lt;algorithm&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2331" PostTypeId="2" ParentId="2329" CreationDate="2018-06-13T15:18:46.847" Score="4" Body="&lt;p&gt;&lt;strong&gt;In Practice:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum annealing almost always gives excited states in practice. To get the exact ground state at the end, you need the adiabatic passage to be &lt;strong&gt;perfect&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest thing to a perfect adiabatic passage is probably &lt;a href=&quot;https://arxiv.org/abs/1706.08061&quot; rel=&quot;nofollow noreferrer&quot;&gt;this recent paper&lt;/a&gt; where they get the ground state with 0.975 fidelity, but this is for 3 qubits with a very simple Hamiltonian (see Eq. 5).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in the D-Wave machine with 2000 qubits there's $2^{2000}-1$ excited states and much higher likelihood that many of them will be near the ground state. Almost every problem D-Wave has worked on recently seeks an approximate solution, not the absolute global minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In Theory:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if my annealer is &lt;strong&gt;perfect&lt;/strong&gt; and we &lt;em&gt;can&lt;/em&gt; stay in the true &lt;s&gt;ground&lt;/s&gt; initial state the whole time? Yes it should be possible to prove the adiabatic theorem for any &lt;em&gt;initial&lt;/em&gt; state, not just the &lt;em&gt;ground&lt;/em&gt; state, but how are you going to initialize the system in some particular excited state? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is indeed a technique for doing &quot;constrained&quot; annealing described &lt;a href=&quot;https://arxiv.org/pdf/1508.04212.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The idea is to use a driver Hamiltonian that commutes with the constraints (see the paragraph above Eq. 2)!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally you can adiabatically evolve along a particular symmetry sector. For example if the ground state of a molecular Hamiltonian is a singlet state, but you are only interested in a triplet (excited) state, as long as you start with a state that has triplet symmetry and your driver Hamiltonian conserves spin, you can prove a generalization of the &quot;basic&quot; adiabatic theorem that states that you will remain in the triplet state if you evolve slowly enough. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-13T15:18:46.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2332" PostTypeId="2" ParentId="2298" CreationDate="2018-06-13T18:29:51.953" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;They say that this scheme requires to throw $O(N)$ switches for each memory call, but I don't understand why is this the case.&#xA;  From the above, it would seem that one just needs to throw $O(\log_2(N))$ &#xA;  switches, one per bifurcation, to get from the top to the bottom.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It seems to me that $n= \log_2 N$ is the length of the address register: the number of times that you have to say left or right to reach a given node.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of 'switches' is the amount of hardware required to realize the full graph. For the classical case, this means transistors. From the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An electronic implementation requires placing one transistor in each&#xA;  of the two paths following each node in the graph. Each address bit&#xA;  controls all the transistors in one of the graph levels: it activates&#xA;  all the transistors in the left paths if it has value 0, or all the&#xA;  transistors in the right paths if it has value 1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The number of transistors required for the bottom level of the graph is $O(N)$. This then decreases exponentially as you go up the graph. So the total number is also $O(N)$. All are active, since each address bit activates all the transistors in a given level.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In other words, is the advantage of the bucket-brigade approach only in the higher error resilience in the quantum case, or would it also be classically advantageous, compared with the conventional approaches?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think that it would indeed work in classical RAM, but the hardware constraints didn't supply the 'evolutionary pressure' required for it to be develiped and implemented. The quantum need to hide from errors is the main motivation.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-13T18:29:51.953" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2333" PostTypeId="1" AcceptedAnswerId="2335" CreationDate="2018-06-14T01:59:39.580" Score="13" ViewCount="505" Body="&lt;p&gt;Tried asking &lt;a href=&quot;https://physics.stackexchange.com/questions/411518/generlization-of-quantum-xnor-gate&quot;&gt;here&lt;/a&gt; first, since a similar question had been asked on that site. Seems more relevant for this site however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is my current understanding that a quantum XOR gate is the CNOT gate. Is the quantum XNOR gate a CCNOT gate? &lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-07-10T23:34:17.363" LastActivityDate="2018-07-10T23:34:17.363" Title="Quantum XNOR Gate Construction" Tags="&lt;universal-gates&gt;&lt;gate-synthesis&gt;&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2334" PostTypeId="2" ParentId="2333" CreationDate="2018-06-14T03:25:12.173" Score="4" Body="&lt;p&gt;The quantum XNOR is not a CCNOT. CCNOT would take 3 bits as input, whereas XOR, XNOR, and CNOT take in only 2 bits or qubits as input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why we say the XOR can be thought of as a CNOT is explained &lt;a href=&quot;https://physics.stackexchange.com/questions/71949/quantum-xor-how-do-you-generalize-it&quot;&gt;here&lt;/a&gt;, and the same reasoning can be used to construct the (2 qubit) XNOR.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-14T13:50:46.347" LastActivityDate="2018-06-14T13:50:46.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2335" PostTypeId="2" ParentId="2333" CreationDate="2018-06-14T07:30:32.720" Score="8" Body="&lt;p&gt;Any classical one-bit function $f:x\mapsto y$ where $x\in\{0,1\}^n$ is an $n$-bit input and $y\in\{0,1\}$ is an $n$-bit output can be written as a reversible computation,&#xA;$$&#xA;f_r:(x,y)\mapsto (x,y\oplus f(x))&#xA;$$&#xA;(Note that any function of $m$ outputs can be written as just $m$ separate 1-bit functions.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum gate implementing this is basically just the quantum gate corresponding to the reversible function evaluation. If you simply write out the truth table of the function, each line corresponds to a row of the unitary matrix, and the output tells you which column entry contains a 1 (all other entries contain 0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of XNOR, we have the standard truth table, and the reversible function truth table&#xA;$$&#xA;\begin{array}{c|c}&#xA;x &amp;amp; f(x) \\&#xA;\hline&#xA;00 &amp;amp; 1 \\&#xA;01 &amp;amp; 0 \\&#xA;10 &amp;amp; 0 \\&#xA;11 &amp;amp; 1&#xA;\end{array}&#xA;\qquad&#xA;\begin{array}{c|c}&#xA;(x,y) &amp;amp; (x,y\oplus f(x)) \\&#xA;\hline&#xA;000 &amp;amp; 001 \\&#xA;001 &amp;amp; 000 \\&#xA;010 &amp;amp; 010 \\&#xA;011 &amp;amp; 011 \\&#xA;100 &amp;amp; 100 \\&#xA;101 &amp;amp; 101 \\&#xA;110 &amp;amp; 111 \\&#xA;111 &amp;amp; 110&#xA;\end{array}&#xA;$$&#xA;Thus, the unitary matrix is&#xA;$$&#xA;U=\left(\begin{array}{cccccccc}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{array}\right).&#xA;$$&#xA;This can easily be decomposed in terms of a couple of controlled-not gates and a bit flip or two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method that I just outlined gives you a very safe way of making the construction that works for any $f(x)$, but it does not perfectly reconstruct the correspondence between XOR and controlled-not. For that, we need to assume a little bit more about the properties of the function $f(x)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that we can decompose the input $x$ into $a,b$ such that $a\in\{0,1\}^{n-1}$ and $b\in \{0,1\}$ such that for all values of $a$, the values of $f(a,b)$ are distinct for each $b$. In this case, we can define the reversible function evaluation as $$f:(a,b)\mapsto(a,f(a,b)).$$ This means that we're using 1 fewer bits than the previous construction, but from here on the technique can be repeated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's go back to the truth table for XNOR.&#xA;$$&#xA;\begin{array}{c|c}&#xA;ab &amp;amp; f(a,b) \\&#xA;\hline&#xA;00 &amp;amp; 1 \\&#xA;01 &amp;amp; 0 \\&#xA;10 &amp;amp; 0 \\&#xA;11 &amp;amp; 1&#xA;\end{array}&#xA;$$&#xA;We can see that, for example, when we fix $a=0$, the two outputs are $1,0$, hence distinct. Similarly for fixing $a=1$. Thus, we can proceed with the reversible function construction&#xA;$$&#xA;\begin{array}{c|c}&#xA;ab &amp;amp; af(a,b) \\&#xA;\hline&#xA;00 &amp;amp; 01 \\&#xA;01 &amp;amp; 00 \\&#xA;10 &amp;amp; 10 \\&#xA;11 &amp;amp; 11&#xA;\end{array}&#xA;$$&#xA;and this gives us a unitary&#xA;$$&#xA;U=\left(\begin{array}{cccc}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)&#xA;$$&#xA;You can easily check that this is the same as $\text{cNOT}\cdot(\mathbb{1}\otimes X)$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-14T07:30:32.720" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2336" PostTypeId="1" AcceptedAnswerId="2337" CreationDate="2018-06-14T09:00:43.927" Score="9" ViewCount="2557" Body="&lt;p&gt;What conditions must a matrix hold to be considered a valid density matrix?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastActivityDate="2018-06-14T11:09:23.980" Title="How to check if a matrix is a valid density matrix?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2337" PostTypeId="2" ParentId="2336" CreationDate="2018-06-14T09:02:30.920" Score="10" Body="&lt;p&gt;If a matrix has unit trace and if it is positive semi-definite (and Hermitian) then it is a valid density matrix. More specifically check if the matrix is Hermitian; find the eigenvalues of the matrix , check if they are non-negative and add up to $1$.&lt;/p&gt;&#xA;" OwnerUserId="2663" LastEditorUserId="2663" LastEditDate="2018-06-14T09:32:44.373" LastActivityDate="2018-06-14T09:32:44.373" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2338" PostTypeId="1" AcceptedAnswerId="2339" CreationDate="2018-06-14T09:13:00.990" Score="7" ViewCount="1946" Body="&lt;p&gt;If we are given a state of a qubit, how do we construct its density matrix?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:32:51.823" LastActivityDate="2018-12-23T12:32:51.823" Title="How to find a density matrix of a qubit?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2339" PostTypeId="2" ParentId="2338" CreationDate="2018-06-14T09:14:48.063" Score="7" Body="&lt;p&gt;If you're given $|\psi\rangle$, just calculate $\rho=|\psi\rangle\langle\psi|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, $|\psi\rangle=\cos\theta|0\rangle+\sin\theta e^{i\phi}|1\rangle$, then $\langle\psi|=\cos\theta\langle 0|+\sin\theta e^{-i\phi}\langle 1|$. This means that&#xA;$$&#xA;\rho=\left(\begin{array}{c} \cos\theta\\ \sin\theta e^{i\phi}\end{array}\right)\cdot \left(\begin{array}{cc} \cos\theta &amp;amp;&amp;amp; \sin\theta e^{-i\phi}\end{array}\right)=\left(\begin{array}{cc}&#xA;\cos^2\theta &amp;amp; \cos\theta\sin\theta e^{-i\phi} \\ \cos\theta\sin\theta e^{i\phi} &amp;amp; \sin^2\theta&#xA;\end{array}\right).&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-14T09:14:48.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2340" PostTypeId="2" ParentId="2073" CreationDate="2018-06-14T09:57:09.610" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So my question is whether such a proof exists for the case where there is no initial entanglement.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer to this is no. As mentioned in the paper, if the subsystem is separable from the rest of the universe  then a global unitary evolution will act as a CPTP map on the subsystem. You can verify this explicitly by writing down an unentagled pure state, evolving it by a unitary and then tracing out one part. This calculation is done explicitly in Chapter 8 of Nielsen and Chuang.&lt;/p&gt;&#xA;" OwnerUserId="2663" LastActivityDate="2018-06-14T09:57:09.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2341" PostTypeId="2" ParentId="2336" CreationDate="2018-06-14T11:09:23.980" Score="5" Body="&lt;p&gt;Suppose someone has prepared your quantum system in one of an orthogonal set of states $\{|\psi_j\rangle\}$. You don't know which of these states they've prepared it in, but you do know that they prepared state $|\psi_j\rangle$ with probability $p_j$. Your system is then described by the density matrix,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\rho = \sum_j \, p_j \, |\psi_j\rangle \langle\psi_j|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some properties that will apply to any density matrix of this form. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Clearly it is diagonalizable, since it is explicitly written in terms of its eigenvalues $p_j$ and eigenstates $|\psi_j\rangle$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since the $|\psi_j\rangle \langle\psi_j|$ are Hermitian, and since probabilities are real numbers, the density matrix is Hermitian.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since probabilities are all either zero or positive, the density matrix is positive semidefinite.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since all probabilities must sum to 1, and the trace is a sum of eigenvalues, the density matrix must have a trace of 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are exactly the properties required of all density matrices. Hopefully this derivation of them gives a bit of understanding of why they are required.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-14T11:09:23.980" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2342" PostTypeId="1" CreationDate="2018-06-14T12:54:01.257" Score="10" ViewCount="237" Body="&lt;p&gt;As stated in the question, I have found in several papers (e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706062&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;http://www.ucw.cz/~robert/papers/andor-siamjc.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;) that in order to perform a quantum walk on a given tree it is necessary to add some nodes to the root $r$, say $r^{'}$ and $r^{&quot;}$. Why are they needed?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Farhi E., &quot;&lt;em&gt;Quantum computation and decision trees&lt;/em&gt;&quot;.&#xA;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706062&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9706062&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Ambainis A., &quot;&lt;em&gt;Any AND-OR formula of size N can be evaluated in time&lt;/em&gt; $N^{1/2+o(1)}$ &lt;em&gt;on a quantum computer&lt;/em&gt;&quot;. &lt;a href=&quot;http://www.ucw.cz/~robert/papers/andor-siamjc.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.ucw.cz/~robert/papers/andor-siamjc.pdf&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2648" LastEditorUserId="55" LastEditDate="2018-07-05T09:40:57.953" LastActivityDate="2021-03-29T23:57:08.367" Title="Quantum Walk: Why the need of adding &quot;tail&quot; nodes to the root?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2343" PostTypeId="1" AcceptedAnswerId="2345" CreationDate="2018-06-14T16:48:47.380" Score="21" ViewCount="2830" Body="&lt;p&gt;Quantum computing allows us to encrypt information in a different way compared to what we use today, but quantum computers are much more powerful than today's computers. So if we manage to build quantum computers (hence use quantum cryptography), will the so-called &quot;hackers&quot; have more or fewer chances of &quot;hacking&quot; into the systems? Or is it impossible to determine it?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-13T19:53:24.247" LastActivityDate="2020-06-30T19:24:38.763" Title="Is quantum cryptography safer than classical cryptography?" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2345" PostTypeId="2" ParentId="2343" CreationDate="2018-06-14T18:05:13.387" Score="18" Body="&lt;p&gt;If you are talking specifically about quantum key distribution (quantum cryptography being an umbrella term that could apply to lots of stuff), then once we have a quantum key distribution scheme, this is theoretically perfectly secure. Rather than computational security that much of current cryptography is based on, quantum key distribution is perfectly secure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, it is only perfectly secure subject to certain assumptions relating mainly to lab security. These same assumptions are essentially present in the classical case as well, just that because the quantum experiments are a lot more fiddly, it might be harder to be completely on top of all the possible attacks. Realistically, these are already the directions in which cryptography is attacked, rather than trying to brute force a crack. For example, exploits relying on a bad implementation of a protocol (rather than the protocol itself being flawed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What quantum crypto, or post quantum crypto, is aiming to do is sidestep the loss of computational security implied by a quantum computer. It will never avoid these implementation issues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a completely shameless plug, you might be interested in my &lt;a href=&quot;https://vimeo.com/quantummechanic/qkdintro&quot; rel=&quot;noreferrer&quot;&gt;introduction to quantum cryptography video&lt;/a&gt;. It talks a little about this computational vs perfect security question (although doesn't really talk about possible hacks of QKD).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-15T05:14:03.040" LastActivityDate="2018-06-15T05:14:03.040" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2346" PostTypeId="1" AcceptedAnswerId="2350" CreationDate="2018-06-14T18:17:04.917" Score="6" ViewCount="381" Body="&lt;p&gt;There is an excellent &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1654/how-do-i-add-11-using-a-quantum-computer/1656&quot;&gt;answer&lt;/a&gt; to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1654/how-do-i-add-11-using-a-quantum-computer/1656&quot;&gt;How do I add 1+1 using a quantum computer?&lt;/a&gt; that shows constructions of the half and full adders. In the answer, there is a source for the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0410184v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;QRCA&lt;/a&gt;. I have also looked at &lt;a href=&quot;https://pdfs.semanticscholar.org/presentation/4758/ba24724e378caad94ab1d083ab8392df9e48.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this presentation&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still left with these questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What does a truth table for a QRCA look like? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What would a unitary matrix for a QRCA be? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What would a circuit diagram for a QRCA look like? (There is an example of a 6-bit circuit in the arXiv paper)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-06-16T21:18:11.600" LastActivityDate="2018-06-16T21:18:11.600" Title="Quantum Ripple Carry Adder Construction" Tags="&lt;universal-gates&gt;&lt;gate-synthesis&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2347" PostTypeId="1" AcceptedAnswerId="2354" CreationDate="2018-06-14T18:55:38.513" Score="15" ViewCount="9570" Body="&lt;p&gt;What is the motivation behind density matrices? And, what is the difference between the density matrices of pure states and density matrices of mixed states?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;This is a self-answered sequel to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1365/whats-the-difference-between-a-pure-and-mixed-quantum-state&quot;&gt;What&amp;#39;s the difference between a pure and mixed quantum state?&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2338/how-to-find-a-density-matrix-of-a-qubit&quot;&gt;How to find a density matrix of a qubit?&lt;/a&gt; You're welcome to write alternate answers. &lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2020-12-23T16:08:51.490" Title="Density matrices for pure states and mixed states" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2348" PostTypeId="2" ParentId="2347" CreationDate="2018-06-14T18:55:38.513" Score="9" Body="&lt;h2&gt;The motivation behind density matrices&lt;sup&gt;[1]&lt;/sup&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;In quantum mechanics, the state of a quantum system is represented by a state vector, denoted &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (and pronounced &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;ket&lt;/em&gt;&lt;/a&gt;). A quantum system with a state vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is called a &lt;em&gt;pure state&lt;/em&gt;. However, it is also possible for a system to be in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Statistical_ensemble&quot; rel=&quot;nofollow noreferrer&quot;&gt;statistical ensemble&lt;/a&gt; of different state vectors. For example, there may be a &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability that the state vector is &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and a &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; chance that the state vector is &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;. This system would be in &lt;em&gt;mixed state&lt;/em&gt;. The density matrix is especially useful for mixed states, because any state, pure or mixed, can be characterized by a single density matrix.&#xA;A mixed state is different from a quantum superposition. The probabilities in a mixed state are classical probabilities (as in the probabilities one learns in classical probability theory/statistics), unlike the quantum probabilities in a quantum superposition. In fact, a quantum superposition of pure states is another pure state, for example, &lt;span class=&quot;math-container&quot;&gt;$\frac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; . In this case, the coefficients &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt {2}}$&lt;/span&gt; are not probabilities, but rather probability amplitudes.&lt;/p&gt;&#xA;&lt;h2&gt;&lt;strong&gt;Example: light polarization&lt;/strong&gt;&lt;/h2&gt;&#xA;&lt;p&gt;An example of pure and mixed states is light polarization. Photons can have two &lt;a href=&quot;https://en.wikipedia.org/wiki/Circular_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;helicities&lt;/a&gt;, corresponding to two orthogonal quantum states, &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; (right &lt;a href=&quot;https://en.wikipedia.org/wiki/Circular_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular polarization&lt;/a&gt;) and &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; (left &lt;a href=&quot;https://en.wikipedia.org/wiki/Circular_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular polarization&lt;/a&gt;). A photon can also be in a superposition state, such as &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle + |L\rangle}{\sqrt{2}}$&lt;/span&gt;(vertical polarization) or &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle - |L\rangle}{\sqrt{2}}$&lt;/span&gt;(horizontal polarization). More generally, it can be in any state &lt;span class=&quot;math-container&quot;&gt;$\alpha|R\rangle + \beta |L\rangle$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;) corresponding to &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Circular_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Elliptical_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;elliptical&lt;/a&gt; polarization. If we pass &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle + |L\rangle}{\sqrt{2}}$&lt;/span&gt; polarized light through a &lt;a href=&quot;https://en.wikipedia.org/wiki/Polarizer#Circular_polarizers&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular polarizer&lt;/a&gt; which allows either only &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; polarized light, or only &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; polarized light, the intensity would be reduced by half in both cases.  This may make it &lt;em&gt;seem&lt;/em&gt; like half of the photons are in state &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; and the other in state &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt;. But this is not correct: Both &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; are partly absorbed by a vertical &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_polarizer&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear polarizer&lt;/a&gt;, but the &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle+|L\rangle}{\sqrt 2}$&lt;/span&gt; light will pass through that polarizer with no absorption whatsoever.&lt;/p&gt;&#xA;&lt;p&gt;However, &lt;a href=&quot;https://en.wikipedia.org/wiki/Unpolarized_light&quot; rel=&quot;nofollow noreferrer&quot;&gt;unpolarized light&lt;/a&gt; such as the light from an &lt;a href=&quot;https://en.wikipedia.org/wiki/Incandescent_light_bulb&quot; rel=&quot;nofollow noreferrer&quot;&gt;incandescent light bulb&lt;/a&gt; is different from any state like &lt;span class=&quot;math-container&quot;&gt;$\alpha|R\rangle + \beta|L\rangle$&lt;/span&gt; (linear, circular or elliptical polarization). Unlike linearly or elliptically polarized light, it passes through the polarizer with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; intensity loss whatever the orientation of the polarizer; and unlike circularly polarized light, it cannot be made linearly polarized with any &lt;a href=&quot;https://en.wikipedia.org/wiki/Waveplate&quot; rel=&quot;nofollow noreferrer&quot;&gt;wave plate&lt;/a&gt; because randomly oriented polarization will emerge from a wave plate with random orientation. Indeed, unpolarized light cannot be described as &lt;em&gt;any&lt;/em&gt; state of the form &lt;span class=&quot;math-container&quot;&gt;$\alpha |R\rangle + \beta |L\rangle$&lt;/span&gt; in a definite sense. However, unpolarized light can be described with ensemble averages, e.g. that each photon is either &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability or &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability. The same behaviour would occur if each photon was either vertically polarized with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability or horizontally polarized with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, unpolarized light cannot be described by any pure state but can be described as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Statistical_ensemble_(mathematical_physics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;statistical ensemble&lt;/a&gt; of pure states in at least two ways (the ensemble of half left and half right circularly polarized, or the ensemble of half vertically and half horizontally linearly polarized). These two ensembles are completely indistinguishable experimentally, and therefore they are considered the same mixed state. One of the advantages of the density matrix is that there is just one density matrix for each mixed state, whereas there are many statistical ensembles of pure states for each mixed state. Nevertheless, the density matrix contains all the information necessary to calculate any measurable property of the mixed state.&lt;/p&gt;&#xA;&lt;p&gt;Where do mixed states come from? To answer that, consider how to generate unpolarized light. One way is to use a system in &lt;a href=&quot;https://en.wikipedia.org/wiki/Thermal_equilibrium&quot; rel=&quot;nofollow noreferrer&quot;&gt;thermal equilibrium&lt;/a&gt;, a statistical mixture of enormous numbers of &lt;a href=&quot;https://en.wikipedia.org/wiki/Microstate_(statistical_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;microstates&lt;/a&gt;, each with a certain probability (the &lt;a href=&quot;https://en.wikipedia.org/wiki/Boltzmann_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boltzmann factor&lt;/a&gt;), switching rapidly from one to the next due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Thermal_fluctuations&quot; rel=&quot;nofollow noreferrer&quot;&gt;thermal fluctuations&lt;/a&gt;. Thermal randomness explains why an &lt;a href=&quot;https://en.wikipedia.org/wiki/Incandescent_light_bulb&quot; rel=&quot;nofollow noreferrer&quot;&gt;incandescent light bulb&lt;/a&gt;, for example, emits unpolarized light. A second way to generate unpolarized light is to introduce uncertainty in the preparation of the system, for example, passing it through a &lt;a href=&quot;https://en.wikipedia.org/wiki/Birefringence&quot; rel=&quot;nofollow noreferrer&quot;&gt;birefringent crystal&lt;/a&gt; with a rough surface, so that slightly different parts of the beam acquire different polarizations. A third way to generate unpolarized light uses an EPR setup: A radioactive decay can emit two photons travelling in opposite directions, in the quantum state &lt;span class=&quot;math-container&quot;&gt;$\frac{|R,L\rangle + |L,R\rangle}{\sqrt{2}}$&lt;/span&gt;. The two photons together are in a pure state, but if you only look at one of the photons and ignore the other, the photon behaves just like unpolarized light.&lt;/p&gt;&#xA;&lt;p&gt;More generally, mixed states commonly arise from a statistical mixture of the starting state (such as in thermal equilibrium), from uncertainty in the preparation procedure (such as slightly different paths that a photon can travel), or from looking at a subsystem entangled with something else.&lt;/p&gt;&#xA;&lt;h2&gt;Obtaining the density matrix&lt;sup&gt;[2]&lt;/sup&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;As mentioned before, a system can be in a statistical ensemble of different state vectors. Say there is &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt; probability that the state vector is &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; probability that the state vector is &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; are the corresponding classical probabilities of each state being prepared.&lt;/p&gt;&#xA;&lt;p&gt;Say, now we want to find the &lt;a href=&quot;https://en.wikipedia.org/wiki/Expectation_value_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;expectation value&lt;/a&gt; of an operator &lt;span class=&quot;math-container&quot;&gt;$\hat{O}$&lt;/span&gt;. Using also the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_(linear_algebra)#Properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;cyclic invariance and linearity properties of the trace&lt;/a&gt;, we compute it as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \hat{O} \rangle = p_1\langle \psi_1 \lvert \hat{O} \lvert \psi_1 \rangle + p_2\langle \psi_2 \lvert \hat{O} \lvert \psi_2 \rangle = p_1Tr(\hat{O} \lvert \psi_1 \rangle \langle \psi_1 \lvert) + p_2Tr(\hat{O} \lvert \psi_2 \rangle \langle \psi_2 \lvert)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= Tr(\hat{O} (p_1 \lvert \psi_1 \rangle \langle \psi_1 \lvert) + p_2 \lvert \psi_2 \rangle \langle \psi_2 \lvert)) = Tr(\hat{O} \rho)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is what we call the density matrix. The density operator contains all the information needed to calculate an expectation value for the experiment.&lt;/p&gt;&#xA;&lt;p&gt;Thus, basically the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p_1 \lvert \psi_1 \rangle \langle \psi_1 \lvert + p_2 \lvert \psi_2 \rangle \langle \psi_2 \lvert$$&lt;/span&gt; in this case.&lt;/p&gt;&#xA;&lt;p&gt;You can obviously extrapolate this logic for when more than just two state vectors are possible for a system, with different probabilities.&lt;/p&gt;&#xA;&lt;h2&gt;Calculating the density matrix:&lt;/h2&gt;&#xA;&lt;p&gt;Let's take an example, as follows.&lt;/p&gt;&#xA;&lt;p&gt;[![enter image description here][1]][1]&lt;/p&gt;&#xA;&lt;p&gt;In the above image, the incandescent light bulb &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; emits completely random polarized photons &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; with mixed state density matrix.&lt;/p&gt;&#xA;&lt;p&gt;As mentioned before, an unpolarized light can be explained with an ensemble average i.e. say each photon is either &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$50%$&lt;/span&gt; probability for each. Another possible ensemble average is: each photon is either &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle+|L\rangle}{\sqrt 2}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle - |L\rangle}{\sqrt 2}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability for each. There are lots of other possibilities too. Try to come up with some yourself. The point to note is that the density matrix for all these possible ensembles will be exactly the same. And this is exactly the reason why density matrix decomposition into pure states is not unique. Let's check:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Case 1&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\text{mixed}} = 0.5 |R\rangle \langle R| + 0.5 |L\rangle \langle L|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|R\rangle, |L\rangle\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; can be denoted as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; can be denoted as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore 0.5 \left(\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix}\right) + 0.5 \left(\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 &amp;amp; 1 \end{bmatrix}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= 0.5 \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} + 0.5\begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} 0.5 &amp;amp; 0 \\ 0 &amp;amp; 0.5 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Case 2&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle + |L\rangle}{\sqrt 2}$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle - |L\rangle}{\sqrt 2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\text{mixed}} = 0.5 \left(\frac{|R\rangle + |L\rangle}{\sqrt 2}\right)\otimes \left(\frac{\langle R| + \langle L|}{\sqrt 2}\right) + 0.5 \left(\frac{|R\rangle - |L\rangle}{\sqrt 2}\right)\otimes \left(\frac{\langle R| - \langle L|}{\sqrt 2}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the basis &lt;span class=&quot;math-container&quot;&gt;$\{\frac{|R\rangle + |L\rangle}{\sqrt 2}, \frac{|R\rangle - |L\rangle}{\sqrt 2}\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle + |L\rangle}{\sqrt 2}$&lt;/span&gt; can be denoted as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{|R\rangle - |L\rangle}{\sqrt 2}$&lt;/span&gt; can be denoted as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore 0.5 \left(\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix}\right) + 0.5 \left(\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 &amp;amp; 1 \end{bmatrix}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= 0.5 \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} + 0.5\begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} 0.5 &amp;amp; 0 \\ 0 &amp;amp; 0.5 \end{bmatrix}$$&lt;/span&gt;&#xA;[1]: &lt;a href=&quot;https://i.stack.imgur.com/NwULz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://i.stack.imgur.com/NwULz.png&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we can clearly see that we get the same density matrices in both case 1 and case 2.&lt;/p&gt;&#xA;&lt;p&gt;However, after passing through the vertical plane polarizer (3), the remaining photons are all &lt;strong&gt;vertically polarized&lt;/strong&gt; (4) and have pure state density matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\text{pure}} = 1 \left(\frac{|R\rangle + |L\rangle}{\sqrt 2}\right)\otimes \left(\frac{\langle R| + \langle L|}{\sqrt 2}\right) + 0 \left(\frac{|R\rangle - |L\rangle}{\sqrt 2}\right)\otimes \left(\frac{\langle R| - \langle L|}{\sqrt 2}\right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the basis &lt;span class=&quot;math-container&quot;&gt;$\{\frac{|R\rangle + |L\rangle}{\sqrt 2}, \frac{|R\rangle - |L\rangle}{\sqrt 2}\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; can be denoted as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt; can be denoted as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore 1 \left(\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix}\right) + 0 \left(\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 &amp;amp; 1 \end{bmatrix}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= 1 \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} + 0\begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;The single qubit case:&lt;/h2&gt;&#xA;&lt;p&gt;If your system contains just a &lt;em&gt;single qubit&lt;/em&gt; and you're &lt;em&gt;know&lt;/em&gt; that its state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2$&lt;/span&gt;) then you are already sure that the 1-qubit system has the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;!&lt;/p&gt;&#xA;&lt;p&gt;In this case, the density matrix will simply be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\text{pure}} = 1|\psi\rangle \langle \psi|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you're using the orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{\alpha|0\rangle + \beta|1\rangle,\beta^*|0\rangle - \alpha^*|1\rangle\}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;the density matrix will simply be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is very similar to 'case 2' above, so I didn't show the calculations. You can ask questions in the comments if this portion seems unclear.&lt;/p&gt;&#xA;&lt;p&gt;However, you could also use the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt; basis as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1837/daftwullie&quot;&gt;@DaftWullie&lt;/a&gt; did in their &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2339/26&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the general case for a 1-qubit state, the density matrix, in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt; basis would be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = 1(\alpha |0\rangle + \beta |1\rangle) \otimes (\alpha^* \langle 0| + \beta^* \langle 1|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} \alpha \\ \beta \end{bmatrix} \otimes \begin{bmatrix} \alpha^* &amp;amp; \beta^* \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} \alpha\alpha^* &amp;amp; \alpha\beta^* \\ \beta\alpha^* &amp;amp; \beta\beta^* \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that this matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is idempotent i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho = \rho^2$&lt;/span&gt;. This is an important property of the density matrices of a pure state and helps us to distinguish them from density matrices of mixed states.&lt;/p&gt;&#xA;&lt;h2&gt;&lt;strong&gt;Obligatory exercises:&lt;/strong&gt;&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Show that density matrices of pure states can be diagonalized to the form &lt;span class=&quot;math-container&quot;&gt;$\text{diag}(1,0,0,...)$&lt;/span&gt;.&lt;br /&gt;&#xA;&lt;strong&gt;2.&lt;/strong&gt; Prove that density matrices of pure states are idempotent.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Sources &amp;amp; References&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;[1]&lt;/strong&gt;: &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Density_matrix&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;[2]&lt;/strong&gt;: &lt;a href=&quot;https://physics.stackexchange.com/a/158290&quot;&gt;https://physics.stackexchange.com/a/158290&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Image Credits&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;User &lt;a href=&quot;https://commons.wikimedia.org/wiki/User:Kaidor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kaidor&lt;/a&gt;&#xA;on &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Polarimeter_(Optical_rotation).svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikimedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-12-23T16:08:51.490" LastActivityDate="2020-12-23T16:08:51.490" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2349" PostTypeId="2" ParentId="2073" CreationDate="2018-06-14T19:43:07.113" Score="1" Body="&lt;p&gt;There are two possible answers. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's say the universe evolves from $t=0$ to $t_f$ then the unitary evolution $U$ from $0$ to $t_f$ induces a CP evolution on the subsystem. To see this, note that the composition of CP maps is CP. Now,  the reduced (system) evolution is $Tr_E U\rho_s\otimes\rho_E U^\dagger$ which is a composition of the map $\rho_s\rightarrow \rho_s\otimes\rho_E$ (which is CP), unitary evolution, and partial trace (again CP). So overall it is CP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See theorem 5.4 in &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CS766.Fall2011/05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Watrous's lecture notes&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this extends to multiple systems since each would just involve a different partial trace. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take the dynamics between $t_i&amp;gt;t_0$ and $t_f$, this might not be CP (or even linear!), which is why NCP maps (and similarly non-linear maps) can be physical. However, this is a slightly tricky subject since it is unclear how you would go about constructing the map. For example, different ways of doing process tomography could lead to different results. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1864" LastActivityDate="2018-06-14T19:43:07.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2350" PostTypeId="2" ParentId="2346" CreationDate="2018-06-14T22:27:24.210" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does a truth table for a QRCA look like?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You don't want to know. It will be a gigantic complicated table that provides no insight whatsoever. At the very least you need to use boolean algebra instead of a table, but even that will be cumbersome and will require many intermediate values that ultimately are just a less-visual way of describing an addition circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it helps, here is the set of equations for a simpler operation, an increment operation. The equations define how each output bit can be computed from the input bits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$o_0 = i_0 \oplus 1$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$o_1 = i_1 \oplus i_0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$o_2 = i_2 \oplus (i_0 \land i_1)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vdots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$o_n = i_n \oplus {\Large{\land}}_{k=0}^{n-1} i_k$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What would a unitary matrix for a QRCA be?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's a permutation matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a starting point, here is the permutation matrix corresponding to a 2-bit increment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Inc}_2 = \begin{bmatrix}&#xA;&amp;amp;&amp;amp;&amp;amp;1\\&#xA;1&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;1&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;1&amp;amp;\\&#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and a 3-bit increment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Inc}_3 = \begin{bmatrix}&#xA;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;1\\&#xA;1&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;1&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;1&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;1&amp;amp;&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;&amp;amp;1&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;1&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;&amp;amp;1&amp;amp;\\&#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect you see the pattern. Just start with an identity matrix and shift it down by 1 (with the bottom row wrapping around to the top). To add 2, instead of adding 1 (i.e. incrementing) you would just shift down by 2 instead of by 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In an addition circuit, the amount of shifting depends on the other input. So you end up with a series of sub-matrices with increasingly-shifted diagonals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Add}_2 = \begin{bmatrix}&#xA;\begin{bmatrix}&#xA;1&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;1&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;1&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;1\\&#xA;\end{bmatrix}&#xA;\\&amp;amp;&#xA;\begin{bmatrix}&#xA;&amp;amp;&amp;amp;&amp;amp;1\\&#xA;1&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;1&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;1&amp;amp;\\&#xA;\end{bmatrix}&#xA;\\&amp;amp;&amp;amp;&#xA;\begin{bmatrix}&#xA;&amp;amp;&amp;amp;1&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;1\\&#xA;1&amp;amp;&amp;amp;&amp;amp;\\&#xA;&amp;amp;1&amp;amp;&amp;amp;\\&#xA;\end{bmatrix}&#xA;\\&amp;amp;&amp;amp;&amp;amp;&#xA;\begin{bmatrix}&#xA;&amp;amp;1&amp;amp;&amp;amp;\\&#xA;&amp;amp;&amp;amp;1&amp;amp;\\&#xA;&amp;amp;&amp;amp;&amp;amp;1\\&#xA;1&amp;amp;&amp;amp;&amp;amp;\\&#xA;\end{bmatrix}&#xA;\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What would a circuit diagram for a QRCA look like?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are many possible constructions. &lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is one that works entirely inline:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iLBct.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iLBct.png&quot; alt=&quot;addition circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Counting5%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22Chance5%22%2C1%2C1%2C1%2C1%2C%22Chance5%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22%E2%80%A2%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Swap%22%2C1%2C1%2C1%2C%22Swap%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22Swap%22%2C1%2C1%2C%22Swap%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22Swap%22%2C1%2C%22Swap%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Swap%22%2C%22Swap%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Swap%22%2C%22Swap%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22Swap%22%2C1%2C%22Swap%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22Swap%22%2C1%2C1%2C%22Swap%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22Swap%22%2C1%2C1%2C1%2C%22Swap%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22%E2%80%A2%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22Chance5%22%2C1%2C1%2C1%2C1%2C%22Chance5%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;play with this construction in Quirk&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-06-14T22:27:24.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2351" PostTypeId="2" ParentId="2343" CreationDate="2018-06-14T22:48:26.933" Score="11" Body="&lt;p&gt;Most attacks &lt;em&gt;now&lt;/em&gt; on classical computers don't actually break the encryption, they trick the systems / communication protocols into using it in a weak way, or into exposing information via side channels or directly (via exploits like buffer overflows).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or they trick &lt;em&gt;humans&lt;/em&gt; into doing something (social engineering).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. currently you don't attack the crypto itself (because things like AES or RSA are &lt;em&gt;very&lt;/em&gt; well tested), you attack the system built around it and the people using it.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;All of these avenues of attack will sill be present when computers communicate via quantum encryption.  However, with quantum encryption theoretically giving perfect security instead of just computational security, tricking a system into weakening its encryption (by using weak keys or wrong keys or keys you already know) shouldn't be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly there will be weaknesses that systems need to avoid in quantum crypto, especially practical implementations that work over imperfect channels.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;TL:DR: When quantum computers can practically attack RSA and the world switches over to quantum crypto for communication without a pre-shared secret, we'll be back in the same situation we are now: the crypto itself is not the weakest link.&lt;/p&gt;&#xA;" OwnerUserId="2433" LastEditorUserId="2433" LastEditDate="2018-06-14T23:22:19.177" LastActivityDate="2018-06-14T23:22:19.177" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2352" PostTypeId="1" AcceptedAnswerId="2573" CreationDate="2018-06-15T01:30:20.270" Score="7" ViewCount="390" Body="&lt;p&gt;After getting help here with &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2333/quantum-xnor-gate-construction&quot;&gt;XNOR&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2346/quantum-ripple-carry-adder-construction&quot;&gt;RCA&lt;/a&gt; gates I decided to dive into XOR Swaps &amp;amp; XOR linked lists. I was able to find &lt;a href=&quot;http://algassert.com/post/1717&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; explanation for quantum XOR Swapping which seems sufficient for the time being. I am not able to find any information on &lt;em&gt;quantum XOR linked lists&lt;/em&gt; however (Google returns &quot;no results&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How would a quantum &lt;a href=&quot;https://wikipedia.org/wiki/XOR_linked_list&quot; rel=&quot;nofollow noreferrer&quot;&gt;XOR linked list&lt;/a&gt; be expressed?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-08-31T02:24:17.733" LastActivityDate="2018-08-31T02:24:17.733" Title="Quantum XOR Linked List Construction" Tags="&lt;universal-gates&gt;&lt;gate-synthesis&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2353" PostTypeId="1" AcceptedAnswerId="2356" CreationDate="2018-06-15T06:10:22.577" Score="5" ViewCount="169" Body="&lt;p&gt;I would like to implement a quantum program on the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/editor&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Composer&lt;/a&gt; with following characteristics:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The output is the observed value of 3 qubits&lt;/li&gt;&#xA;&lt;li&gt;Only one of the 3 qubits should be observed as $1$, the 2 others should be $0$&lt;/li&gt;&#xA;&lt;li&gt;The probability that a qubit is observed as $1$ is $1/3$&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So the 3 possible outputs of this circuit are: $|100\rangle$,$|010\rangle$,$|001\rangle$ (all 3 having equality probability of being outputted)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can we best implement such a circuit on the IBM Composer ?&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="26" LastEditDate="2018-12-13T19:53:41.773" LastActivityDate="2018-12-13T19:53:41.773" Title="How to implement a random selection of one of the 3 qubits on the IBM Q (composer)?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2354" PostTypeId="2" ParentId="2347" CreationDate="2018-06-15T07:13:25.923" Score="11" Body="&lt;h1&gt;Motivation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The motivation behind density matrices is to represent a lack of knowledge about the state of a given quantum system, encapsulating within a single description of this system all the possible outcomes of measurement results, given what we know about the system. The density matrix representation has the added advantage of getting rid of any issues associated with global phases because&#xA;$$&#xA;|\phi\rangle\langle\phi|=(e^{i\varphi}|\phi\rangle)(e^{-i\varphi}\langle\phi|).&#xA;$$&#xA;The lack of knowledge might arise in a variety of ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A subjective lack of knowledge - a referee prepares for you one of a set of states $\{|\phi_i\rangle\}$ with probability $p_i$, but you don't know which. Even if they know which $|\phi_j\rangle$ they prepared, since you do not, you have to describe it based upon what you know of the possible set of states and their corresponding probabilities, $\rho=\sum_ip_i|\phi_i\rangle\langle \phi_i|$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;An objective lack of knowledge - if the quantum system is part of a larger entangled state, it is impossible to describe the system as a pure state, but all possible outcomes of measurements are described by the density matrix obtained by $\rho=\text{Tr}_B(\rho_{AB})$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is interesting, however, that the objective lack of knowledge can become subjective - a second party can perform operations on the rest of the entangled state. They can know the measurement results etc. but if they don't pass those on, the person holding the original quantum system has no new knowledge, and so describes their system using the same density matrix as before, but it is now a subjective description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also important to note that choosing a particular way of representing the density matrix, for example, $\rho=\sum_ip_i|\phi_i\rangle\langle \phi_i|$, is a very subjective choice. It may be motivated by a particular preparation procedure, but mathematically, any description that gives the same matrix is equivalent. For example, on a single qubit, $\rho=\frac12\mathbb{I}$ is known as the maximally mixed state. Due to the completeness relation of a basis, this can be represented as a 50:50 mixture or two orthogonal states using &lt;em&gt;any&lt;/em&gt; 1-qubit basis.&#xA;$$&#xA;\frac12\mathbb{I}=\frac12|0\rangle\langle 0|+\frac12|1\rangle\langle 1|=\frac12|+\rangle\langle +|+\frac12|-\rangle\langle -|.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Pure and Mixed States&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The difference between the density matrix of a pure state and a mixed state is straightforward - the pure state is a special case which can be written in the form $\rho=|\psi\rangle\langle\psi |$, while a mixed state cannot be written in this form. Mathematically, this means that the density matrix of a pure state has rank 1, while a mixed state has rank greater than 1. The best way of calculating this is via $\text{Tr}(\rho^2)$: $\text{Tr}(\rho^2)=1$ implies a pure state, otherwise it's mixed. To see this, recall that $\text{Tr}(\rho)=1$, meaning that all the eigenvalues sum to 1. Also, $\rho$ is positive semi-definite, so all the eigenvalues are real and non-negative. So, if $\rho$ is rank 1, the eigenvalues are $(1,0,0,\ldots ,0)$, and their sum-square is clearly 1. The sum-square of any other set of non-negative numbers that sum to 1 must be less than 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pure state corresponds to perfect knowledge of the system, although the fun bit about quantum mechanics is that this does not imply full knowledge of the possible measurement outcomes. Mixed states represent some imperfect knowledge, whether that's knowledge of the preparation, or knowledge of a larger Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That the mixed state description is much richer can be seen from the Bloch sphere picture on a single qubit: the pure states are all those on the surface of the sphere, while the mixed states are all those contained within the volume. In terms of parameter counting, instead of two parameters, you need three, the extra one corresponding to the length of the Bloch vector.&#xA;$$&#xA;\rho=\frac{\mathbb{I}+r\underline{n}\cdot\underline{\sigma}}{2},&#xA;$$&#xA;where $\underline{n}$ is a 3-element unit vector, $\underline{\sigma}$ is a vector of the Pauli matrices, and $r=1$ for a pure state, and $0\leq r&amp;lt;1$ for a mixed state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-15T07:13:25.923" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2355" PostTypeId="1" AcceptedAnswerId="2360" CreationDate="2018-06-15T11:23:18.600" Score="8" ViewCount="558" Body="&lt;p&gt;I was wondering if something like this is possible in QISKit: let's say we have two registers containing target and ancilla qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_0$ -------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_1$-------------------- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vdots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_4$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_0$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_1$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vdots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_4$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These two registers are stored in one quantum register &lt;code&gt;qr&lt;/code&gt;. So to access $a_0$ we would type &lt;code&gt;qr[0]&lt;/code&gt;, to access $a_1$ - &lt;code&gt;qr[1]&lt;/code&gt;, ..., for $t_5$ - &lt;code&gt;qr[9]&lt;/code&gt;. We can pass this quantum register as an argument to some function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foo(qr, ...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I want to do is to interleave the ancilla and target qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_0$ -------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_0$-------------------- &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vdots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_i$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_i$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\vdots$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$a_4$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$t_4$ ------------------&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so to access $a_0$ I would type &lt;code&gt;qr[0]&lt;/code&gt;, for $t_1$ - &lt;code&gt;qr[1]&lt;/code&gt; and so on. Finally, I would like to pass such &lt;code&gt;changed&lt;/code&gt; quantum register &lt;code&gt;qr'&lt;/code&gt; again as an argument to some function&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foo(qr', ...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and in this function I would like to use these changed indices. Is this possible? Other solution I figured out was to pass array of indices for ancilla and target qubits, but I would like to avoid that. Another option would be to use &lt;code&gt;swap&lt;/code&gt; gates on these qubits&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="26" LastEditDate="2018-12-31T22:02:27.760" LastActivityDate="2018-12-31T22:02:27.760" Title="Changing indices of qubits in QISKit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2356" PostTypeId="2" ParentId="2353" CreationDate="2018-06-15T12:17:38.853" Score="4" Body="&lt;p&gt;The pure quantum state that satisfies your conditions  is the &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;W state&lt;/a&gt; in three qubits,&#xA;$$ \frac{1}{\sqrt{3}} \left(|001\rangle + |010\rangle  + |100\rangle \right) $$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look at this &lt;a href=&quot;https://physics.stackexchange.com/questions/311743/quantum-circuit-for-a-w-state&quot;&gt;answer&lt;/a&gt; for a high level circuit to construct this. The first gate in that circuit is a single  qubit gate that effects the transformation,&#xA;$$ |0 \rangle \rightarrow \frac{1}{\sqrt{3}} |1 \rangle +  \sqrt{\frac{2}{3}} | 0\rangle .$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This you can implement in the composer as a $U_3$ gate with an appropriate value of theta.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next you will need a controlled H gate between the first and second qubits, and a Toffoli gate. To implement them in the composer you can use the circuits given  &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/004-Quantum_Algorithms/061-Basic_Circuit_Identities_and_Larger_Circuits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&#xA;. The control gates in the &lt;a href=&quot;https://physics.stackexchange.com/questions/311743/quantum-circuit-for-a-w-state&quot;&gt;answer&lt;/a&gt; have the control qubits flipped (the controls are triggered by $0$ and not $1$ ). So you will need to sandwich your control qubits in the composer between $X$ gates to get the desired circuit. As you can see, constructing this from scratch in the composer is rather tedious.&lt;/p&gt;&#xA;" OwnerUserId="2663" LastEditorUserId="23" LastEditDate="2018-06-15T18:36:25.960" LastActivityDate="2018-06-15T18:36:25.960" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2357" PostTypeId="2" ParentId="2058" CreationDate="2018-06-15T12:39:07.157" Score="0" Body="&lt;p&gt;The situation of non-completely positive maps (or more generally non-linear maps)  is  controversial partly due to the precise definition of &lt;a href=&quot;https://arxiv.org/abs/1212.4387&quot; rel=&quot;nofollow noreferrer&quot;&gt;how you should construct the map&lt;/a&gt;. But it is easy to come up with an example of something that would seem to be NCP or even not linear. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Non linear map. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Consider a preparation device that can create a qubit in an arbitrary state $\rho$ (this device has 3 dials). Now let this device be constructed so that it also prepares a second state $\rho$ in the environment. I.e, you think you prepared a one qubit state $\rho$ but actually you prepared a two qubit state $\rho\otimes\rho$. The second qubit is the environment (which you cannot access), so if you perform tomography on your qubit, everything seems ok. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No imagine that you also have the following black box - it has (as far as you can tell) one input and two outputs. In reality (unknown to you) it has two inputs and two outputs and it simply spits out both the system qubit and the environement qubit. As far as you can tell, this black box is a cloning machine, violating linearity.  &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;NCP&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Similar to the idea above, but the preparation device prepares $\rho\otimes\rho^T$ (clearly this could be done in the lab). The black box will now be a one rail box (one qubit input one qubit output as far as the user is concerned), which swaps the system and environement. To you, it seems like a trasposition map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that both preparation devices are physical, but the way you construct the map might depend on how you use them. In the example above I assumed that a mixed state $\rho$ would only be constructed by using the three dials in the machine. In principle, I could try to construct a mixed state by flipping coins and preparing pure states with the right probability. Tomorgraphy would show that the processes are equivalent, but the environment would be different, and the map you would construct for the black boxes would be different. &lt;/p&gt;&#xA;" OwnerUserId="1864" LastActivityDate="2018-06-15T12:39:07.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2358" PostTypeId="1" AcceptedAnswerId="2361" CreationDate="2018-06-15T18:02:17.510" Score="20" ViewCount="512" Body="&lt;p&gt;It has been proven that adiabatic quantum computing is equivalent to &quot;standard&quot;, or gate-model quantum computing. Adiabatic computing, however, shows promises for optimisation problems, where the objective is to minimise (or maximise) a function which is in some way related to the problem – that is, finding the instance that minimises (or maximises) this function immediately solves the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it seems to me that Grover's algorithm can essentially do the same: by searching over the solution space, it will find one solution (possibly out of many solutions) that satisfies the oracle criterion, which in this case equates to the optimality condition, in time $O(\sqrt N)$, where $N$ is the size of the solution space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This algorithm has been shown to be optimal: as Bennett et al. (1997) put it, &quot;the class $\rm NP$ cannot be solved on a quantum Turing machine in time $o(2^{n/2})$&quot;. In my understanding, this means there is no way to construct any quantum algorithm that finds a solution by searching through the space faster than $O(\sqrt N)$, where $N$ scales with the problem size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is: while adiabatic quantum computing is often presented as being superior when it comes to optimisation problems, can it really be faster than $O(\sqrt N)$? If yes, this seems to contradict the optimality of Grover's algorithm, since any adiabatic algorithm can be simulated by a quantum circuit. If not, what is the point of developing adiabatic algorithms, if they are never going to be faster than something we can systematically construct with circuits? Or is there something wrong with my understanding?&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="26" LastEditDate="2018-12-13T19:54:03.653" LastActivityDate="2020-05-01T20:28:12.903" Title="Can adiabatic quantum computing be faster than Grover's algorithm?" Tags="&lt;grovers-algorithm&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2360" PostTypeId="2" ParentId="2355" CreationDate="2018-06-16T00:33:19.747" Score="5" Body="&lt;p&gt;The relationship between your indices can be captured by a map:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\{0: 0, 1: 2, 2: 4, 3: 6, 4: 8, 5: 1, 6: 3, 7: 5, 8: 7, 9: 9\}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then use this to specify where operations get applied to in a register. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a simple code in QISKit (generalizes to arbitrary register length):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import * &#xA;from qiskit.tools.visualization import *&#xA;&#xA;# build a register with k targets and k ancillas &#xA;k = 5&#xA;qr = QuantumRegister(2*k)&#xA;circ = QuantumCircuit(qr)&#xA;&#xA;# apply cx between ancillas and targets&#xA;for i in range(k):&#xA;    circ.cx(qr[i], qr[i+k])&#xA;&#xA;circuit_drawer(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mPrEbm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mPrEbm.png&quot; alt=&quot;original&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# specify the desired interleaving&#xA;# {0: 0, 1: 2, 2: 4, 3: 6, 4: 8, 5: 1, 6: 3, 7: 5, 8: 7, 9: 9}&#xA;new_qubit_map = {i: 2*i if i &amp;lt; k else 2*(i-k)+1 for i in range(len(qr))}&#xA;&#xA;# create the same circuit, but with the new interleaving&#xA;circ_2 = QuantumCircuit(qr)&#xA;for i in range(k):&#xA;    circ_2.cx(qr[new_qubit_map[i]], qr[new_qubit_map[i+k]])&#xA;&#xA;circuit_drawer(circ_2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hMtgDm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hMtgDm.png&quot; alt=&quot;interleaved&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="26" LastEditDate="2018-06-17T06:23:10.790" LastActivityDate="2018-06-17T06:23:10.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2361" PostTypeId="2" ParentId="2358" CreationDate="2018-06-16T00:52:06.510" Score="9" Body="&lt;p&gt;Good question. For unstructured search, adiabatic quantum computation indeed gives the exact same &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; speedup that the standard gate-based Grover's algorithm does, as proven in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0107015&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; important paper by Roland and Cerf. This agrees with the equivalence between adiabatic and gate-based quantum computation that you mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(One minor correction to your question: you're correct that in the setup for the oracle-search problem, you need to frame your search query as a yes/no question that the oracle can answer. But the question isn't actually taken to be &quot;does &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; extremize the function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;?&quot;, as you proposed. Instead, it's &quot;is &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; less than or equal to &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;?&quot; See slides 9 and 10 &lt;a href=&quot;https://courses.csail.mit.edu/6.006/spring11/lectures/lec25.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. That's because an oracle for the latter question is considered a more realistic model for a physical setup, where it's conceivable that one could directly compute or measure &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; for a given &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, but not &lt;span class=&quot;math-container&quot;&gt;$f(x) - f_\text{min}$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, there are two potential advantages to adiabatic QC, both of which are difficult to study theoretically. The first is practical: actually building large coherent quantum circuits is a whole lot harder that just drawing them in a journal article. Even though adiabatic QC doesn't have any &lt;em&gt;fundamental&lt;/em&gt; advantage over the traditional setup, it might be much easier to implement experimentally.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, the same huge caveat applies to AQC as to the standard Grover's algorithm: it only applies to &lt;em&gt;unstructured&lt;/em&gt; or &quot;black-box&quot; search, where we complete ignore any correlations between the answers that the oracle gives when fed in &quot;similar&quot; or &quot;related&quot; queries. Any actual search problem that we care about will by definition have some structure to it, although this structure may be far too complicated for us to analyze. For example, if we think of the function to be extremized as an energy landscape, it seems reasonable that the system can more easily tunnel between &quot;nearby&quot; local minima than between &quot;faraway&quot; ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to really rigorously compare the relative benefits of the adiabatic vs. gate-based setups in a real experiment, you'd need to &quot;overcome the relativization barrier&quot; and consider the structure of the specific function that you're trying to extremize, which is usually &lt;em&gt;really&lt;/em&gt; hard to do. This makes it very difficult to draw general conclusions about the two approach's relative advantages in the real world. It's also why it's so hard to prove unconditional complexity separations theoretically. For all we know, for real-world rather than oracle problems, quantum computers might be able to give exponential speedups - possibly even for NP-complete problems, which would imply that &lt;strong&gt;NP&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\subset$&lt;/span&gt; &lt;strong&gt;BQP&lt;/strong&gt;, although this is considered very unlikely.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-05-01T20:28:12.903" LastActivityDate="2020-05-01T20:28:12.903" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2363" PostTypeId="1" AcceptedAnswerId="2364" CreationDate="2018-06-16T09:45:44.200" Score="6" ViewCount="176" Body="&lt;p&gt;Moore's law states that computer power doubles in every 18 months (more formally: &quot;the number of transistors in a dense integrated circuit doubles about every two years.&quot;). Statistics suggest that this observation should be correct, but aren't quantum computers much more powerful than just double-powered classical computers? More interesting question is, is there even a way to improve the power of quantum computers?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-13T19:54:26.393" LastActivityDate="2021-03-03T02:52:03.217" Title="Will Moore's Law be no longer effective once quantum computers are created?" Tags="&lt;classical-computing&gt;&lt;experiment&gt;&lt;scalability&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ClosedDate="2018-06-17T17:05:54.210" ContentLicense="CC BY-SA 4.0" />
  <row Id="2364" PostTypeId="2" ParentId="2363" CreationDate="2018-06-16T17:31:36.700" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;but aren't quantum computers much more powerful than just&#xA;  double-powered classical computers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. A universal quantum computer with only 100 qubits (12.5 quantum bytes) can find the ground state of a matrix with $2^{200} = 10^{60}$ elements. Assuming Moore's Law could continue forever (which is not true due to physical limitations), it would take longer than the age of the universe (13.5 billion years) for the &quot;doubling of transistors every 18 months&quot; to bring classical computers to what a quantum computer with one quantum gigabyte can do, for certain problems. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;More interesting question is, is there even a way to improve the power of&#xA;  quantum computers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There have been proposals for exploiting certain types of phenomena that would lead to devices even more powerful than quantum computers, but in all cases quantum computers would be a special case of such devices (just like classical computers are a special case of quantum computers, they are quantum computers that just only use classical gates and inputs that are not in any superposition). It is hard enough to build a quantum computer, so building the more generalized devices would be even harder.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-07-14T18:31:26.323" LastActivityDate="2018-07-14T18:31:26.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2365" PostTypeId="2" ParentId="2358" CreationDate="2018-06-16T17:51:37.903" Score="3" Body="&lt;p&gt;Adiabatic quantum computation cannot do &lt;strong&gt;&lt;em&gt;anything&lt;/em&gt;&lt;/strong&gt; faster than circuit-based quantum computation from a computational complexity perspective. This is because there is a mathematical proof that circuit-based quantum computation can efficiently simulate adiabatic quantum computation [see section 5 of &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0001106.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;]. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;can it really be faster than $\mathcal{O}(\sqrt{N})$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer is no. This is because if AQC could do it in, say, $\mathcal{O}(\log{N})$, then circuit-based QC could also do it in $\mathcal{O}(\log{N})$ by the algorithm in section 5 of the paper I linked above. This would violate the optimality of $\mathcal{O}(\sqrt{N})$ for unstructured search.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-16T17:51:37.903" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="2366" PostTypeId="1" CreationDate="2018-06-16T21:50:42.390" Score="10" ViewCount="400" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1863/2645&quot;&gt;This answer&lt;/a&gt; cites &lt;a href=&quot;https://arxiv.org/abs/1804.05979&quot; rel=&quot;noreferrer&quot;&gt;a paper&lt;/a&gt;&lt;sup&gt;[$\dagger$]&lt;/sup&gt; which purposes a quantum blockchain using entanglement in time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The weakness is that the research only presents a conceptual design.&quot; - QComp2018&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How could a quantum blockchain which leverages time entanglement be realized?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Resources:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1705.09258&quot; rel=&quot;noreferrer&quot;&gt;Quantum Secured Blockchain&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/publication/299749136_Quantum_Bitcoin_An_Anonymous_and_Distributed_Currency_Secured_by_the_No-Cloning_Theorem_of_Quantum_Mechanics&quot; rel=&quot;noreferrer&quot;&gt;Quantum Bitcoin&lt;/a&gt;: An Anonymous and Distributed Currency Secured by the No-Cloning Theorem of Quantum Mechanics&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;[$\dagger$]: &lt;em&gt;Quantum Blockchain using entanglement in time&lt;/em&gt; Rajan &amp;amp; Visser (2018)&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-07-03T06:50:44.553" LastActivityDate="2018-11-17T22:41:34.550" Title="Time Entangled Quantum Blockchain" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;cryptocurrency&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2367" PostTypeId="2" ParentId="2363" CreationDate="2018-06-17T05:18:19.923" Score="1" Body="&lt;p&gt;The quantum equivalent of Moore's Law is Rose's Law which states that &quot;the number of qubits in a scalable quantum computing architecture should double every year.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The prediction was made by Geordie Rose of D-Wave circa 2003. See D-Wave's &lt;a href=&quot;https://www.dwavesys.com/tutorials/background-reading-series/introduction-d-wave-quantum-hardware#h2-9&quot; rel=&quot;nofollow noreferrer&quot;&gt;Future of Hardware&lt;/a&gt;, &lt;a href=&quot;http://www.33rdsquare.com/2012/10/roses-law-for-quantum-computers.html/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; or &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1916/2645&quot;&gt;this amazing answer&lt;/a&gt; for more info.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that a quantum computer can make $2^n$ computations per step where n is the number of qubits. With the number of qubits doubling every year this means the computational power of quantum computers will accelerate &lt;em&gt;very quickly&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-06-17T06:05:46.710" LastActivityDate="2018-06-17T06:05:46.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2368" PostTypeId="2" ParentId="2363" CreationDate="2018-06-17T05:52:09.527" Score="1" Body="&lt;p&gt;Moore's law is not a fundamental law of the nature. It is just a heuristic mentioned by Moore to show the growing importance of computer technology. You should never take it for granted and there is nothing wrong if the actual trend doesn't follow Moore's law.&lt;/p&gt;&#xA;&lt;p&gt;Secondly, Quantum computers give speed up in only certain kinds of computations. You cannot expect it to give exponential speed up for every classical algorithm. So it is inappropriate to compare a QC with a Classical computer. Classical computers are going to stay even after QC become commercially viable.&lt;/p&gt;&#xA;" OwnerUserId="2384" LastEditorUserId="2293" LastEditDate="2021-03-03T02:52:03.217" LastActivityDate="2021-03-03T02:52:03.217" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2370" PostTypeId="1" AcceptedAnswerId="2379" CreationDate="2018-06-17T16:47:27.217" Score="13" ViewCount="236" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The Toffoli gate is a 3-input, 3-output classical logic gate. It sends $(x, y, a)$ to $(x, y, a \oplus (x \cdot y))$. It is significant in that it is universal for reversible (classical) computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Popescu-Rohrlich box is the simplest example of a non-signaling correlation. It takes a pair of inputs $(x, y)$ and outputs $(a, b)$ satisfying $x \cdot y = a \oplus b$ such that $a$ and $b$ are both uniform random variables. It is universal for &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0506180&quot; rel=&quot;noreferrer&quot;&gt;a certain class of&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0701142&quot; rel=&quot;noreferrer&quot;&gt;but not all&lt;/a&gt;) non-signaling correlations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my eye, these two objects look extremely similar, especially if we augment the PR box by having it output $(x, y, a, b) = (x, y, a, a \oplus (x \cdot y))$. This 2-input, 4-output PR box &quot;is&quot; the 3-input, 3-output Toffoli gate but with the third input replaced by a random output. But I've been unable to locate any references that relate them.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;What is the relationship between the Toffoli gate and the Popescu-Rohrlich box? Is there something like a correspondence between reversible classical circuits and (a certain class of?) non-signaling correlations that maps one to the other?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Observations&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Specifying a non-signaling correlation requires not just a function but also an assignment of each input and output to a party that controls it. A PR box is no longer non-signaling if we allow Alice to enter both inputs and Bob to read both outputs. Or in our &quot;augmented&quot; PR-box, if Alice inputs $x$, she must also be the one who reads the copy of $x$. So it seems nontrivial to determine, for a general circuit (with some inputs possibly replaced by random outputs), all the ways inputs and outputs can be assigned to parties such that communication is not possible.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We can apply the above procedure any logic gate, including irreversible ones. For instance, we can take AND and replace one of the inputs by a random output, and get a function one input $x$ and a pair $(a, x \cdot a)$ where $a$ is a uniform random variable. However, $x \cdot a$ is $0$ conditioned on $x = 0$, so the only way this can be non-signaling is if Alice, who inputs $x$, receives $x \cdot a$. But this procedure can already be reproduced classically with a shared source of randomness. So I would expect that including irreversible gates does not expand the class of non-signaling correlations one can construct.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2547" LastEditorUserId="55" LastEditDate="2021-02-14T18:59:02.883" LastActivityDate="2021-02-14T18:59:02.883" Title="What is the relationship between the Toffoli gate and the Popescu-Rohrlich box?" Tags="&lt;non-locality&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2371" PostTypeId="1" AcceptedAnswerId="2535" CreationDate="2018-06-17T17:08:26.247" Score="8" ViewCount="257" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/C10k_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;C10k Problem&lt;/a&gt; is a classical computing problem whose name (C10k) is a numeronym for concurrently handling ten thousand connections.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How could a quantum network be constructed to handle 10,000 clients concurrently?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-06-25T09:20:28.490" LastActivityDate="2018-06-29T20:22:51.223" Title="How could a quantum network be constructed to handle 10,000 clients concurrently?" Tags="&lt;algorithm&gt;&lt;architecture&gt;&lt;many-body-systems&gt;&lt;quantum-networks&gt;&lt;communication&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2372" PostTypeId="1" CreationDate="2018-06-17T17:55:12.897" Score="15" ViewCount="2502" Body="&lt;p&gt;I'm fairly confused about how Grover's algorithm could be used in practice and I'd like to ask help on clarification through an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume an $N=8$ element database that contains colors Red, Orange, Yellow, Green, Cyan, Blue, Indigo and Violet, and not necessarily in this order. My goal is to find Red in the database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input for Grover's algorithm is $n = \log_2(N=8) = 3$ qubits, where the 3 qubits encode the indices of the dataset. My confusion comes here (might be confused about the premises so rather say confusion strikes here) that, as I understand, the oracle actually searches for one of the indices of the dataset (represented by the superposition of the 3 qubits), and furthermore, the oracle is &quot;hardcoded&quot; for which index it should look for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What do I get wrong here?&lt;/li&gt;&#xA;&lt;li&gt;If the oracle is really looking for one of the indices of the database, that would mean we know already which index we are looking for, so why searching?&lt;/li&gt;&#xA;&lt;li&gt;Given the above conditions with the colors, could someone point it out if it is possible with Grover's to look for Red in an unstructured dataset? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are implementations for Grover's algorithm with an oracle for $n=3$ searching for |111&gt;, e.g. (or see an R implementation of the same oracle below): &#xA;&lt;a href=&quot;https://i.stack.imgur.com/eF896.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eF896.png&quot; alt=&quot;Oracle for 111&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2205&quot;&gt;https://quantumcomputing.stackexchange.com/a/2205&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, my confusion is, given I do not know the position of $N$ elements in a dataset, the algorithm requires me to search for a string that encodes the position of $N$ elements. How do I know which position I should look for when the dataset is unstructured?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;R code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; #START&#xA; a = TensorProd(TensorProd(Hadamard(I2),Hadamard(I2)),Hadamard(I2))&#xA; # 1st CNOT&#xA; a1= CNOT3_12(a)&#xA; # 2nd composite&#xA; # I x I x T1Gate&#xA; b = TensorProd(TensorProd(I2,I2),T1Gate(I2)) &#xA; b1 = DotProduct(b,a1)&#xA; c = CNOT3_02(b1)&#xA; # 3rd composite&#xA; # I x I x TGate&#xA; d = TensorProd(TensorProd(I2,I2),TGate(I2))&#xA; d1 = DotProduct(d,c)&#xA; e = CNOT3_12(d1)&#xA; # 4th composite&#xA; # I x I x T1Gate&#xA; f = TensorProd(TensorProd(I2,I2),T1Gate(I2))&#xA; f1 = DotProduct(f,e)&#xA; g = CNOT3_02(f1)&#xA; #5th composite&#xA; # I x T x T&#xA; h = TensorProd(TensorProd(I2,TGate(I2)),TGate(I2))&#xA; h1 = DotProduct(h,g)&#xA; i = CNOT3_01(h1)&#xA; #6th composite&#xA; j = TensorProd(TensorProd(I2,T1Gate(I2)),I2)&#xA; j1 = DotProduct(j,i)&#xA; k = CNOT3_01(j1)&#xA; #7th composite&#xA; l = TensorProd(TensorProd(TGate(I2),I2),I2)&#xA; l1 = DotProduct(l,k)&#xA; #8th composite&#xA; n = TensorProd(TensorProd(Hadamard(I2),Hadamard(I2)),Hadamard(I2))&#xA; n1 = DotProduct(n,l1)&#xA; n2 = TensorProd(TensorProd(PauliX(I2),PauliX(I2)),PauliX(I2))&#xA; a = DotProduct(n2,n1)&#xA; #repeat the same from 2st not gate&#xA; a1= CNOT3_12(a)&#xA; # 2nd composite&#xA; # I x I x T1Gate&#xA; b = TensorProd(TensorProd(I2,I2),T1Gate(I2))&#xA; b1 = DotProduct(b,a1)&#xA; c = CNOT3_02(b1)&#xA; # 3rd composite&#xA; # I x I x TGate&#xA; d = TensorProd(TensorProd(I2,I2),TGate(I2))&#xA; d1 = DotProduct(d,c)&#xA; e = CNOT3_12(d1)&#xA; # 4th composite&#xA; # I x I x T1Gate&#xA; f = TensorProd(TensorProd(I2,I2),T1Gate(I2))&#xA; f1 = DotProduct(f,e)&#xA; g = CNOT3_02(f1)&#xA; #5th composite&#xA; # I x T x T&#xA; h = TensorProd(TensorProd(I2,TGate(I2)),TGate(I2))&#xA; h1 = DotProduct(h,g)&#xA; i = CNOT3_01(h1)&#xA; #6th composite&#xA; j = TensorProd(TensorProd(I2,T1Gate(I2)),I2)&#xA; j1 = DotProduct(j,i)&#xA; k = CNOT3_01(j1)&#xA; #7th composite&#xA; l = TensorProd(TensorProd(TGate(I2),I2),I2)&#xA; l1 = DotProduct(l,k)&#xA; #8th composite&#xA; n = TensorProd(TensorProd(PauliX(I2),PauliX(I2)),PauliX(I2))&#xA; n1 = DotProduct(n,l1)&#xA; n2 = TensorProd(TensorProd(Hadamard(I2),Hadamard(I2)),Hadamard(I2))&#xA; n3 = DotProduct(n2,n1)&#xA; result=measurement(n3)&#xA; plotMeasurement(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zJBT3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zJBT3.png&quot; alt=&quot;Image2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2698" LastActivityDate="2020-11-03T13:43:47.030" Title="Grover's algorithm: a real life example?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2373" PostTypeId="2" ParentId="2372" CreationDate="2018-06-17T20:06:47.840" Score="6" Body="&lt;p&gt;This is already partially discussed in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2110/55&quot;&gt;this related question&lt;/a&gt;, but I'll try here to address more specifically some of the issues you rise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, Grover's algorithm rests upon the assumption that one is able to perform a &lt;em&gt;querying&lt;/em&gt; operation of the form $$|i\rangle\mapsto(-1)^{f(x_i)}|i\rangle,$$ where $i$ is the index in the database, and $x_i$ whatever information the database attaches to $i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of $f(x_i)$ as &quot;&lt;em&gt;asking a question about $x_i$&lt;/em&gt;&quot;. For example, &quot;&lt;em&gt;is $x_i$ a prime number?&lt;/em&gt;&quot;, or &quot;&lt;em&gt;does $x_i$ have property $P$&lt;/em&gt;?&quot;, where $P$ could mean &quot;being red&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to note that $f$ could be asking a question which does not fully characterize $x_i$. This means that after I run the algorithm and retrieve $i$, and thus $x_i$ with it, I also gain knowledge which was not used to build the oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in many proof of principle implementations of Grover's algorithm, like the one you show, this is not the case.&#xA;Indeed, in these demonstrations the question that is being asked is &quot;trivial&quot;, in the sense that $x_i=i$, and the question is of the form &quot;&lt;em&gt;is $x_i$ equal to 3&lt;/em&gt;?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such a case, the algorithm is indeed not particularly useful in that the answer has to be hardcoded into the oracle, but this needs not be the case in general.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-24T10:41:41.260" LastActivityDate="2018-07-24T10:41:41.260" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2374" PostTypeId="2" ParentId="2292" CreationDate="2018-06-17T23:52:35.393" Score="6" Body="&lt;p&gt;This answer is more or less a summary of the Aharonov-Jones-Landau paper you linked to, but with everything not directly related to defining the algorithm removed. Hopefully this is useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Aharonov-Jones-Landau algorithm approximates the Jones polynomial of the plat closure of a braid $\sigma$ at a $k$th root of unity by realizing it as (some rescaling of) a matrix element of a certain unitary matrix $U_\sigma$, the image of $\sigma$ under a certain unitary representation of the braid group $B_{2n}$. Given an implementation of $U_\sigma$ as a quantum circuit, approximating its matrix elements is straightforward using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;noreferrer&quot;&gt;Hadamard test&lt;/a&gt;. The nontrivial part is approximating $U_\sigma$ as a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $\sigma$ is a braid on $2n$ strands with $m$ crossings, we can write $\sigma = \sigma_{a_1}^{\epsilon_1} \sigma_{a_2}^{\epsilon_2} \cdots \sigma_{a_m}^{\epsilon_m}$, where $a_1, a_2, \ldots, a_m \in \{1, 2, \ldots, 2n - 1\}$, $\epsilon_1, \epsilon_2, \ldots, \epsilon_m \in \{\pm 1\}$, and $\sigma_i$ is the generator of $B_{2n}$ that corresponds to crossing the $i$th strand over the $(i + 1)$st. It suffices to describe $U_{\sigma_i}$, since $U_\sigma = U_{\sigma_{a_1}}^{\epsilon_1} \cdots U_{\sigma_{a_m}}^{\epsilon_m}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To define $U_{\sigma_i}$, we first give a certain subset of the standard basis of $\mathbb{C}^{2^{2n}}$ on which $U_{\sigma_i}$ acts nontrivially. For $\psi = \lvert b_1 b_2 \cdots b_{2n} \rangle$, let $\ell_{i'}(\psi) = 1 + \sum_{j = 1}^{i'} (-1)^{1-b_j}$. Let's call $\psi$ &lt;em&gt;admissible&lt;/em&gt; if $1 \leq \ell_{i'}(\psi) \leq k - 1$ for all $i' \in \{1, 2, \ldots, 2n\}$. (This corresponds to $\psi$ describing a path of length $2n$ on the graph $G_k$ defined in the AJL paper.) Let $$\lambda_r = \begin{cases}\sin(\pi r / k) &amp;amp; \textrm{if $1 \leq r \leq k - 1$},\\ 0 &amp;amp; \textrm{otherwise.}\end{cases}$$ Let $A = ie^{-\pi i/2k}$ (this is mistyped in the AJL paper; also note that here and only here, $i = \sqrt{-1}$ is not the index $i$). Write $\psi = \lvert \psi_i b_i b_{i+1} \cdots\rangle$, where $\psi_i$ is the first $i - 1$ bits of $\psi$, and let $z_i = \ell_{i-1}(\psi_i)$. Then&#xA;$$&#xA;\begin{align}&#xA;U_{\sigma_i}(\lvert\psi_i 00 \cdots\rangle) &amp;amp; = A^{-1}\lvert\psi_i 00 \cdots\rangle\\&#xA;U_{\sigma_i}(\lvert\psi_i 01 \cdots \rangle) &amp;amp; = \left( A\frac{\lambda_{z_i-1}}{\lambda_{z_i}} + A^{-1}\right)\lvert\psi_i 01 \cdots\rangle + A\frac{\sqrt{\lambda_{z_i+1}\lambda_{z_i-1}}}{\lambda_{z_i}}\lvert\psi_i 10 \cdots\rangle\\&#xA;U_{\sigma_i}(\lvert\psi_i 10 \cdots \rangle) &amp;amp; = A\frac{\sqrt{\lambda_{z_i+1}\lambda_{z_i-1}}}{\lambda_{z_i}}\lvert\psi_i 01 \cdots\rangle + \left(A\frac{\lambda_{z_i+1}}{\lambda_{z_i}} + A^{-1}\right)\lvert\psi_i 10 \cdots\rangle\\&#xA;U_{\sigma_i}(\lvert\psi_i 11 \cdots\rangle) &amp;amp; = A^{-1}\lvert\psi_i 11 \cdots\rangle&#xA;\end{align}&#xA;$$&#xA;We define $U_{\sigma_i}(\psi) = \psi$ for non-admissible basis elements $\psi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We would now like to describe $U_{\sigma_i}$ as a quantum circuit with polynomially many (in $n$ and $k$) gates. Notice that while $U_{\sigma_i}$ only changes two qubits, it also depends on the first $i - 1$ qubits through the dependence on $z_i$ (and indeed, it depends on all qubits for the admissibility requirement). However, we can run a counter to calculate and store $z_i$ (and also determine admissibility of the input) in logarithmically many (in $k$) ancilla qubits, and therefore we can apply the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;noreferrer&quot;&gt;Solovay-Kitaev algorithm&lt;/a&gt; to get a good approximation to $U_{\sigma_i}$ using only polynomially many gates. (The paper appeals to Solovay-Kitaev twice: once for incrementing the counter at each step, and once for applying $U_{\sigma_i}$; I'm not sure if there is a more direct way to describe either of these as quantum circuits with standard gates. The paper also doesn't mention the need to check for admissibility here; I'm not sure if this is important, but certainly we at least need $1 \leq z_i \leq k - 1$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to recap:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start with a braid $\sigma \in B_{2n}$ with $m$ crossings.&lt;/li&gt;&#xA;&lt;li&gt;Write $\sigma = \sigma_{a_1}^{\epsilon_1} \sigma_{a_2}^{\epsilon_2} \cdots \sigma_{a_m}^{\epsilon_m}$.&lt;/li&gt;&#xA;&lt;li&gt;For each $i \in \{1, 2, \ldots, m\}$, apply the Solovay-Kitaev algorithm to get an approximation of the unitary matrix $U_{\sigma_{a_i}}$ (or its inverse if $\epsilon_i = -1$).&lt;/li&gt;&#xA;&lt;li&gt;Compose all of the approximations from step 3 to get a quantum circuit with polynomially many gates that approximates $U_{\sigma}$.&lt;/li&gt;&#xA;&lt;li&gt;Apply the real and imaginary Hadamard tests polynomially many times with the circuit from step 4 and the state $\lvert 1010 \cdots 10\rangle$.&lt;/li&gt;&#xA;&lt;li&gt;Average the results of step 5 and multiply by some scaling factor to get an approximation to the real and imaginary parts of the Jones polynomial of the plat closure of $\sigma$ evaluated at $e^{2\pi i/k}$.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2547" LastActivityDate="2018-06-17T23:52:35.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2375" PostTypeId="2" ParentId="2371" CreationDate="2018-06-18T00:53:27.893" Score="3" Body="&lt;p&gt;Enabling network sockets to handle 10k clients at the same time with over 1 gigabit per second Ethernet (the C10k problem), is different from making a quantum computer that can handle 10k qubits concurrently. Remember 10k bits is only 1.25kB which is not even enough to store a typical operating system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to consider each qubit as a &quot;client&quot; in some generalization of the C10k problem, then the answer to your question depends on whether or not you need a universal gate set to be applicable between each of the 10,000 qubit connections. If so, the largest quantum computers with a universal gate set are the 50-qubit machine by IBM and the 72-qubit machine by Google (which has been announced but not shown to the public yet). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention D-Wave, which makes non-universal quantum annealers. If each qubit is considered a &quot;client&quot;, it is true that the D-Wave 2000Q has 2048 qubits, but not all of them can be connected to any other qubit. &lt;a href=&quot;https://www.ibm.com/developerworks/community/blogs/jfp/resource/BLOGS_UPLOADED_IMAGES/chimera.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is the connectivity graph for a typical D-Wave machine. Notice that each qubit can only be connected to at most 6 other qubits. To get 10,000 qubits in this arrangement, you just need to create more of these &quot;unit cells&quot; of 8 qubits each. What's pictured here is the D-Wave One which has 16 units cells of 8 qubits each (8 x 16 = 128 total qubits). The D-Wave Two had 64 units cells of 8 qubits each (8 x 64 = 512 qubits). The D-Wave 2X had 132 unit cells (8 x 144 = 1152 total qubits), and the D-Wave 2000Q has 256 unit cells (8 x 256 = 2048 total qubits). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 10,000 qubits you just need 1250 units cells (8 x 1250 = 10,000). After that point D-Wave says that a re-design would need to be required, perhaps in the size of the unit cells, or in going from 2D to 3D, or in the physics itself.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-18T01:48:03.167" LastActivityDate="2018-06-18T01:48:03.167" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2376" PostTypeId="1" AcceptedAnswerId="2377" CreationDate="2018-06-18T06:17:25.763" Score="9" ViewCount="564" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1710.03599&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;&lt;sup&gt;[1]&lt;/sup&gt; paper, on page 2, they mention that they are generating the weighting matrix as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$W = \frac{1}{Md}[\sum_{m=1}^{m=M} \mathbf{x}^{(m)}\left(\mathbf{x}^{(m)}\right)^{T}] - \frac{\Bbb I_d}{d}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\mathbf{x}^{(m)}$'s are the $d$-dimensional training samples (i.e. $\mathbf{x} := \{x_1,x_2,...,x_d\}^{T}$ where $x_i \in \{1,-1\} \ \forall \ i\in \{1,2,...,d\}$) and there are $M$ training samples in total. This generation of weighting matrix using matrix multiplication followed by a sum over $M$ terms seems to be a costly operation in terms of time complexity i.e. I guess around $O(Md)$ (?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does there exist any quantum algorithm which can offer a substantial speed-up for generation of the weighting matrix? I think in the paper their main speedup comes from the quantum matrix inversion algorithm (which is mentioned later on the paper), but they don't seem to have taken into account this aspect of the weighting matrix generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: &lt;em&gt;A Quantum Hopfield Neural Network&lt;/em&gt; Lloyd et al. (2018)&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-06-18T10:02:13.760" Title="Is it possible to speed up the generation of the weighting matrix using a quantum algorithm?" Tags="&lt;algorithm&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2377" PostTypeId="2" ParentId="2376" CreationDate="2018-06-18T09:07:23.153" Score="5" Body="&lt;p&gt;Taking the density matrix $$\rho=W+\frac{I_d}{d}=\frac 1M \sum_{m=1}^M\left|x^{\left(m\right)}\rangle\langle x^{\left(m\right)}\right|,$$ many of the details are all contained in the following paragraph on page 2:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Crucial  for  quantum  adaptations  of  neural  networks is the classical-to-quantum  read-in  of  activation  patterns. In our setting, reading in an activation pattern $x$ amounts to preparing the quantum state $|x〉$. This could&#xA;  in principle be achieved using the developing techniques of quantum random access memory (qRAM) [33] or efficient quantum state preparation, for which restricted, oracle based, results exist [34]. In both cases, the computational  overhead is logarithmic in terms of $d$. One can alternatively adapt a fully quantum perspective and take the activation patterns $|x〉$ directly from a quantum device or as the output of a quantum channel. For the former, our preparation run time is efficient whenever the quantum device is composed of a number of gates scaling at most polynomially with the number of qubits. Instead, for the latter, we typically view the channel as some form of fixed system-environment interaction that does not require a computational overhead to implement.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The references in the above are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[33]: V. Giovannetti, S.  Lloyd, L.  Maccone, Quantum  random access memory, Physical Review Letters 100, 160501 (2008) [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.100.160501&quot; rel=&quot;nofollow noreferrer&quot;&gt;PRL link&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/0708.1879v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv link&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[34]: A. N. Soklakov, R. Schack, Efficient state preparation for a register of quantum bits, Physical Review A 73, 012307 (2006). [&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.73.012307&quot; rel=&quot;nofollow noreferrer&quot;&gt;PRA link&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0408045v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv link&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Without going into details of how, both of the above are indeed schemes for respectively, implementing an efficient qRAM; and efficient state preparation that recreate the state $\left|x\right&amp;gt;$ in time $\mathcal O\left(\log_2 d\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this only gets us so far: this can be used to create the state $\rho^{\left(m\right)} = \left|x^{\left(m\right)}\rangle\langle x^{\left(m\right)}\right|$, while we want a sum over all the possible $m$'s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Crucially, $\rho = \sum_m\rho^{\left(m\right)}/M$ is mixed, so cannot be represented by a single pure state, so the second of the above two references on recreating pure states doesn't apply and the first requires the state to already be in qRAM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, the authors make one of three possible assumptions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;They have a device that just so happens to give them the correct input state&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They either have the states $\rho^{\left(m\right)}$ in qRAM,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They are able to create those states at will, using the second of the above references. The mixed state is then created using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum channel&lt;/a&gt; (i.e. a completely positive, trace preserving (CPTP) map).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Forgetting about the first two of the above options for the moment (the first magically solves the problem anyway), the channel could either be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;an engineered system, in that it would be created for a specific instance in something akin to an analogue simulation. In other words you've got a physical channel that takes a physical length of time $t$ (as opposed to some time complexity). This is the &quot;fixed system-environment interaction that does not require a computational overhead to implement.&quot;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The channel is itself simulated. There are a few papers on this, such as Bény and Oreshkov's &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.84.022333&quot; rel=&quot;nofollow noreferrer&quot;&gt;Approximate simulation of quantum channels&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/1103.0649&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv link&lt;/a&gt; - this looks like a thorough paper, but I couldn't find any time complexity statements), Lu et. al.'s &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.95.042310&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental quantum channel simulation&lt;/a&gt; (no arXiv version seems to exist) and Wei, Xin and Long's arXiv preprint &lt;a href=&quot;https://arxiv.org/abs/1706.08080&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient universal quantum channel simulation in IBM's cloud quantum computer&lt;/a&gt;, which (for number of qubits $n=\lceil\log_2 d\rceil$) gives a time complexity of $\mathcal O\left(\left(8n^3+n+1\right)4^{2n}\right)$. Stinespring dilation can also be used, with a complexity of $\mathcal O\left(27n^34^{3n}\right)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now looking at option 2&lt;sup&gt;1&lt;/sup&gt;, one possible more efficient method would be to transfer the states from the address register to the data register in the usual method: for addresses in register $a$, $\sum_j\psi_j\left|j\right&amp;gt;_a$, transferring this to the data register gives the state in the data register $d$ as $\sum_j\psi_j\left|j\right&amp;gt;_a\left|D_j\right&amp;gt;_d$. It should be possible to simply decohere the address and data register to turn this into a mixed state, giving a small time overhead, although no extra computational complexity overhead, giving a much improved complexity of producing $\rho$, given a qRAM with the states $\left|x^{\left(m\right)}\right&amp;gt;$, of $\mathcal O\left(n\right)$. This is also the complexity of creating the states $\left|x^{\left(m\right)}\right&amp;gt;$ in the first place, giving a potential (much improved) complexity of producing $\rho$ of $\mathcal O\left(n\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 With thanks to @glS for pointing this possibility out in chat&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This density matrix is then fed into 'qHop' (quantum Hopfield), where it is used to simulate $e^{-iAt}$ for $$A=\begin{pmatrix}W-\gamma I_d &amp;amp;&amp;amp; P\\ P&amp;amp;&amp;amp; 0\end{pmatrix}$$ as per the &quot;&lt;strong&gt;Efficient Hamiltonian Simulation of A&lt;/strong&gt;&quot; subsection on page 8.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2018-06-18T10:02:13.760" LastActivityDate="2018-06-18T10:02:13.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2378" PostTypeId="2" ParentId="2372" CreationDate="2018-06-18T12:43:43.197" Score="5" Body="&lt;p&gt;One main assumption to be efficient within a usage of a database is that you can load with a superposition of addresses data from a RAM, also called QRAM (see &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0708.1879&lt;/a&gt;). Then assume you have one state for the address, one state for the value, and a load operation, which loads the  value of the corresponding address into the value register. So the load operation would do the step&#xA;$$|x\rangle_{\text{address}}|0\rangle_{\text{value}} \rightarrow |x\rangle_{\text{address}}|\textrm{load}(x)\oplus 0\rangle_{\text{value}} = |x\rangle_{\text{address}}|\textrm{load}(x)\rangle_{\text{value}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first step you apply the Hadamard gates on the address register and then apply the load operation on both registers. Then you will have a superposition of all values in the database an the value register. &#xA;$$H^{\otimes n}_{\text{address}} |0\rangle_{\text{address}}|\textrm0\rangle_{\text{value}}=\frac1{2^{n/2}}\sum_{x=0}^{2^n-1} |x\rangle_{\text{address}}|\textrm0\rangle_{\text{value}} $$&#xA;$$\text{apply load}\rightarrow&#xA;\frac1{2^{n/2}}\sum_{x=0}^{2^n-1} |x\rangle_{\text{address}}|\textrm{load}(x)\rangle_{\text{value}}$$&#xA;Then you apply the Grover algorithm on the value register with any oracle you want like looking a for a prime or a specific value. We know after $O(\sqrt{N})$ iterations the correct answer will be measured with high probability. Thus, the correct solution together with the register address $x^*$ of the correct solution will be very probable measured&#xA;$$|x^*\rangle_{\text{address}}|\textrm{load}(x^*)\rangle_{\text{value}}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe the main problem you have is with understanding the database not the Grover algorithm. You can see a more detailed explanation in chapter 6.5 Nielsen &amp;amp; Chuang for this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also think that the most useful application of the Grover algorithm is not the database application, but is its generalizations as amplitude amplification (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005055&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0005055&lt;/a&gt;) on any quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;I thought of the problem glS answered already a bit: If we can built an oracle, isn't the problem already solved? Because to construct the oracle, we need to know how the correct solution looks like. And if you would have no background in computer science, this question would be hard to answer by yourself. However, under assumptions most scientists believe (NP$\neq$P), this is exactly the case for a subset of NP-complete problems (the ones which do not have good approximation methods) . We can construct an oracle, which can check if a solution is correct in polynomial time, but to construct an oracle, which finds the correct solution seems to be not efficiently computable.&lt;/p&gt;&#xA;" OwnerUserId="2691" LastEditorUserId="2691" LastEditDate="2018-07-24T08:29:33.463" LastActivityDate="2018-07-24T08:29:33.463" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2379" PostTypeId="2" ParentId="2370" CreationDate="2018-06-18T13:00:08.743" Score="8" Body="&lt;p&gt;A natural way to relate Toffoli gates and PR boxes is to see them both as representations of the AND function of two binary inputs, but in different ways. The connection with the AND function is evident and clearly acknowledged by the question, but I would express it in a slightly different way:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The Toffoli gate is of course the natural way of representing AND as a reversible function. It follows the usual pattern of representing an arbitrary function $f:\{0,1\}^n\rightarrow\{0,1\}$ reversibly as $|x,a\rangle \mapsto |x,a\oplus f(x)\rangle$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The PR box can be seen as a distributed form of the AND function. The output of a PR box on input $(x,y)$ can be expressed as $(\text{AND}(x,y)\oplus a, a)$, or equivalently as $(a,\text{AND}(x,y)\oplus a)$, where $a\in\{0,1\}$ is a uniformly generated random bit. The output of the PR box is therefore either a perfectly correlated or perfectly anti-correlated pair of random bits, depending on whether the AND of the inputs is 0 or 1 respectively. This is interesting because Alice and Bob collectively know the output of the AND function (which they can obtain by computing the XOR of their output bits), while individually they have no information at all about this value.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The idea that the PR box effectively computes the AND function in this distributed way is a key idea in Wim van Dam's proof that communication complexity becomes trivial in the presence of PR boxes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Wim van Dam. &lt;a href=&quot;https://link.springer.com/article/10.1007/s11047-012-9353-6&quot; rel=&quot;noreferrer&quot;&gt;Implausible consequences of superstrong nonlocality.&lt;/a&gt;&#xA;  Natural Computing 12(1): 9-12, 2013.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-06-18T13:00:08.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2380" PostTypeId="2" ParentId="2298" CreationDate="2018-06-18T13:26:25.050" Score="2" Body="&lt;p&gt;An answer to this question seems to have been given by the same authors, in a different follow-up paper which I hadn't seen before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/0807.4994&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;, the authors write (emphasis mine):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A classical RAM that uses the bucket-brigade addressing schemes need&#xA;  only activate $O(n)$ transistors in the course of a memory call, in&#xA;  contrast with a conventional RAM that activates $O(2^n)$ transistors. As&#xA;  a result, a RAM that uses our design might operate with less&#xA;  dissipation and power consumption than a conventional RAM. &lt;strong&gt;Note,&#xA;  however, that energy costs in the memory addressing are not&#xA;  sufficiently high in current RAM chips to justify an immediate&#xA;  adoption of the bucket-brigade.&lt;/strong&gt; Other sources of inefficiencies and&#xA;  dissipations are currently predominant (mostly in the memory cells&#xA;  themselves). However, new promising memory cell technologies are being&#xA;  developed (e.g. the “memristor” cells [15]), which would drastically&#xA;  cut back cell dissipation, so that cutting back dissipation in the&#xA;  addressing may become important in the future.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It would therefore seem that, at least according to the authors, the bucket-brigade scheme would be also advantageous for classical architectures, in terms of energy consumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: Giovannetti, Lloyd, and Maccone. &quot;&lt;em&gt;Architectures for a quantum random access memory&lt;/em&gt;.&quot; Physical Review A 78.5 (2008): 052310.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-06-18T13:26:25.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2381" PostTypeId="1" CreationDate="2018-06-18T15:14:18.037" Score="17" ViewCount="1724" Body="&lt;p&gt;What is a &quot;qubit&quot;? Google tells me that it's another term for a &quot;quantum bit&quot;. What is a &quot;quantum bit&quot; &lt;em&gt;physically&lt;/em&gt;? How is it &quot;quantum&quot;? What purpose does it serve in quantum computing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I'd prefer an explanation that is easily understood by laypeople; terms specific to quantum computing should preferably be explained, in relatively simple terms.&lt;/p&gt;&#xA;" OwnerUserId="90" LastEditorUserId="26" LastEditDate="2018-12-13T19:54:17.010" LastActivityDate="2018-12-13T19:54:17.010" Title="What is a qubit?" Tags="&lt;physical-qubit&gt;" AnswerCount="6" CommentCount="8" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2382" PostTypeId="2" ParentId="2381" CreationDate="2018-06-18T17:12:35.817" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is a &quot;quantum bit&quot; physically? How is it &quot;quantum&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First let me give examples of classical bits:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In a CPU: low voltage = 0, high voltage = 1&lt;/li&gt;&#xA;&lt;li&gt;In a hard drive: North magnet = 0, South magnet = 1&lt;/li&gt;&#xA;&lt;li&gt;In a barcode on your library card: Thin bar = 0, Thick bar = 1&lt;/li&gt;&#xA;&lt;li&gt;In a DVD: Absence of a deep microscopic pit on the disk = 0, Presence = 1 &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In every case you can have something in between:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If &quot;low voltage&quot; is 0 mV, and &quot;high voltage&quot; is 1 mV, you can have a medium voltage of 0.5 mV&lt;/li&gt;&#xA;&lt;li&gt;You can have a magnet polarized in any direction, such as North-West&lt;/li&gt;&#xA;&lt;li&gt;You can have lines in a barcode that are of any width&lt;/li&gt;&#xA;&lt;li&gt;You can have pits of various depths on the surface of a DVD&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In quantum mechanics things can only exist in &quot;packages&quot; called &quot;quanta&quot;. The singular of &quot;quanta&quot;  is &lt;strong&gt;&quot;quantum&quot;&lt;/strong&gt;. This means for the barcode example, if the thin line was one &quot;quantum&quot;, the thick line can be two times the size of the thin line (two quanta), but it &lt;strong&gt;&lt;em&gt;cannot&lt;/em&gt;&lt;/strong&gt; be 1.5 times the thickness of the thin line. If you look at your library card you will notice that you &lt;strong&gt;&lt;em&gt;can&lt;/em&gt;&lt;/strong&gt; draw lines that are of thickness 1.5 times the size of the thin lines if you want to, which is one reason why barcode bits are not qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There do exist some things in which the laws of quantum mechanics do not permit anything between the 0 and the 1, some examples are below:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Spin_(physics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;spin of an electron&lt;/a&gt;: It's either up (0) or down (1), but cannot be in between.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Energy_level&quot; rel=&quot;nofollow noreferrer&quot;&gt;energy level&lt;/a&gt; of an electron: 1st level is 0, 2nd level is 1, there is no such thing as 1.5th level&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have given you two examples of what a qubit can be physically: spin of an electron, or energy level of an electron. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What purpose does it serve in quantum computing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The reason why the qubit examples I gave come in quanta are because they exist as solutions to something called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schrödinger Equation&lt;/a&gt;. Two solutions to the Schrödinger equation (the 0 solution, and the 1 solution) can exist at the same time. So we can have 0 and 1 at the same time. If we have two qubits, each can be in 0 and 1 at the same time, so collectively we can have 00, 01, 10, and 11 (4 states) at the same time. If we have 3 qubits, each of them can be in 0 and 1 at the same time, so we can have 000, 001, 010, 011, 100, 101, 110, 111 (8 states) at the same time. Notice that for $n$ qubits we can have $2^n$ states at the same time. That is one of the reasons why quantum computers are more powerful than classical computers.  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-15T00:37:50.467" LastActivityDate="2018-07-15T00:37:50.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2383" PostTypeId="2" ParentId="2381" CreationDate="2018-06-18T18:03:57.637" Score="3" Body="&lt;p&gt;A qubit (quantum bit) is a quantum system that can be fully described by (&quot;lives in&quot;) a 2-dimensional complex vector space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, much more than that is required to do computations. There needs to exist two orthogonal basis vectors in that vector space, call them $|0\rangle$ and $|1\rangle$, that are stable in the sense that you can set the system very precisely to $|0\rangle$ or to $|1\rangle$, and it will stay there for a long time. This is easier said than done because unless noise is reduced somehow, it will cause the state to drift gradually so that it contains a component along both the $|0\rangle$ and $|1\rangle$ dimensions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do computations, you must also be able to induce a &quot;complete&quot; set of operations acting on one or two qubits. When you are not inducing an operation, qubits should not interact with each other. Unless interaction with the environment is suppressed, qubits will interact with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A classical bit, by the way, is much simpler than a qubit. It's a system that can be described by a boolean variable&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="26" LastEditDate="2018-07-13T14:56:48.843" LastActivityDate="2018-07-13T14:56:48.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2385" PostTypeId="2" ParentId="2381" CreationDate="2018-06-19T01:16:18.860" Score="8" Body="&lt;p&gt;This is a good question and in my view gets at the heart of a qubit. Like &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2381/what-is-a-qubit#comment2794_2381&quot;&gt;the comment&lt;/a&gt; by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/26/blue&quot;&gt;@Blue&lt;/a&gt;, it's not that it can be an equal superposition as this is the same as a classical probability distribution. It is that it can have negative signs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take this example. Imagine you have a bit in the $0$ state and represent it as vector $\begin{bmatrix}1 \\0 \end{bmatrix}$ and then you apply a coin flipping operation which can be represented by a stochastic matrix $\begin{bmatrix}0.5 &amp;amp; 0.5 \\0.5 &amp;amp; 0.5 \end{bmatrix}$ this will make a classical mixture $\begin{bmatrix}0.5 \\0.5 \end{bmatrix}$. If you apply this twice it will still be a classical mixture $\begin{bmatrix}0.5 \\0.5 \end{bmatrix}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets go to the quantum case and start with a qubit in the $0$ state which again is represented by $\begin{bmatrix}1 \\0 \end{bmatrix}$. In quantum, operations are represented by a unitary matrix which has the property $U^\dagger U = I$. The simplest unitary to represent the action of a quantum coin flip is the Hadamard matrix $\begin{bmatrix}\sqrt{0.5} &amp;amp; \sqrt{0.5} \\\sqrt{0.5} &amp;amp; -\sqrt{0.5} \end{bmatrix}$ where the first column is defined so that after one operation it makes the state $|+\rangle =\begin{bmatrix}\sqrt{0.5}  \\\sqrt{0.5} \end{bmatrix}$, then the second column must be $\begin{bmatrix}\sqrt{0.5} &amp;amp; a \\\sqrt{0.5} &amp;amp; b \end{bmatrix}$ where $|a|^2 = 1/2$, $|b|^2 = 1/2$ and $ab^* = -1/2$. A solution to this is $a =\sqrt(0.5)$ and $b=-a$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now lets do the same experiment. Applying it once gives&#xA;$\begin{bmatrix}\sqrt{0.5}  \\\sqrt{0.5} \end{bmatrix}$ and if we measured (in the standard basis) we would get half the time 0 and the other 1 (recall in quantum &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born rule&lt;/a&gt; is  $P(i) = |\langle i|\psi\rangle|^2$ and why we need all the square roots). So it is like the above and has a random outcome. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets apply it twice. Now we would get $\begin{bmatrix} 0.5+0.5  \\0.5-0.5\end{bmatrix}$. The negative sign cancels the probability of observing the 1 outcome and a physicist we refer to this as interference. It is these negative numbers that we get in quantum states which cannot be explained by probability theory where the vectors must remain positive and real. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extending this to n qubits gives you a theory that has an exponential that we can't find efficient ways to simulate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not just my view. I have seen it shown in the talks by Scott Aaronson and I think its best to say quantum is like “Probability theory with Minus Signs” (this is a quote by Scott).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am attaching the slides I like to give for explaining quantum (if it is not standard to have slides in an answer I am happy to write the math out to get across the concepts)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rvoOJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rvoOJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="302" LastEditorUserId="302" LastEditDate="2018-06-24T19:16:45.143" LastActivityDate="2018-06-24T19:16:45.143" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="2386" PostTypeId="1" CreationDate="2018-06-19T03:28:50.520" Score="5" ViewCount="1795" Body="&lt;p&gt;I am looking to collaborate on open source simulation efforts.&lt;/p&gt;&#xA;" OwnerUserId="1697" LastActivityDate="2018-06-19T08:25:57.327" Title="What are some open sources projects on quantum computing?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="2" ClosedDate="2018-06-19T13:59:06.097" ContentLicense="CC BY-SA 4.0" />
  <row Id="2387" PostTypeId="2" ParentId="2386" CreationDate="2018-06-19T03:43:37.653" Score="3" Body="&lt;p&gt;There is in fact a &lt;a href=&quot;https://github.com/topics/quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum computing topic tag&lt;/a&gt; on github which comes up with a list of a whole bunch of projects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/QISKit/qiskit-core&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit&lt;/a&gt; is pretty well known; it's connected with IBM's quantum experience as well as the QASM language. It's a pure simulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another direction, there's projects like &lt;a href=&quot;https://github.com/quantumlib/OpenFermion&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenFermion&lt;/a&gt; which is for finding algorithms to simulate different problems in quantum chemistry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A fabulous little simulator that I prefer over IBM's is &lt;a href=&quot;https://github.com/Strilanc/Quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; which runs in your browser and is open source.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also start your own project like &lt;a href=&quot;https://github.com/physicsnerd/qc-sim&quot; rel=&quot;nofollow noreferrer&quot;&gt;I did&lt;/a&gt;, though I would not recommend becoming an open-source contributor to mine because I haven't updated my repository in a while and I'm pretty sure everything there is rather decisively out of date.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can provide some more criteria, I can recommend some more specific projects.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2018-06-19T04:17:41.033" LastActivityDate="2018-06-19T04:17:41.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2388" PostTypeId="1" AcceptedAnswerId="2395" CreationDate="2018-06-19T08:00:32.173" Score="12" ViewCount="1444" Body="&lt;p&gt;I have been trying to get my head around the famous(?) paper &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Quantum algorithm for linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/strong&gt;&lt;/a&gt; (more popularly known as the &lt;strong&gt;HHL09 algorithm&lt;/strong&gt; paper) for some time, now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;On the very first page, they say&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We sketch here the basic idea of our algorithm and then discuss it in&#xA;  more detail in the next section. Given a Hermitian $N\times N$ matrix&#xA;  $A$, and a unit vector $\vec{b}$, suppose we would like to find&#xA;  $\vec{x}$ satisfying $A\vec{x} = \vec{b}$. (We discuss later questions&#xA;  of efficiency as well as how the assumptions we have made about $A$&#xA;  and $\vec{b}$ can be relaxed.)  First, the algorithm represents&#xA;  $\vec{b}$ as a quantum state $|b\rangle = \sum_{i=1}^{N}b_i|i\rangle$.&#xA;  Next, we use techniques of Hamiltonian simulation [3, 4] to apply&#xA;  $e^{iAt}$ to $|b_i\rangle$ for a superposition of different times $t$.&#xA;  This ability to exponentiate $A$ translates, via the well-known&#xA;  technique of  phase-estimation [5–7] into the ability to decompose $|b\rangle$&#xA;  in the eigenbasis of $A$ and to find the corresponding eigenvalues&#xA;   $\lambda_j$ Informally, the state of the system after&#xA;  this stage is close to $\sum_{j=1}^{j=N} \beta_j&#xA; |u_j\rangle|\lambda_j\rangle$, where $u_j$ is the eigenvector basis of&#xA;  $A$ and $|b\rangle = \sum_{j=1}^{j=N} \beta_j|u_j\rangle$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So far so good. As described in &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/1107002176&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Nielsen &amp;amp; Chuang&lt;/strong&gt;&lt;/a&gt; in the chapter &quot;&lt;strong&gt;The quantum Fourier transform and its applications&lt;/strong&gt;&quot;, the phase estimation algorithm is used to estimate $\varphi$ in $e^{i2\pi \varphi}$ which is the eigenvalue corresponding to an eigenvector $|u\rangle$ of the unitary operator $U$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's the relevant portion from Nielsen &amp;amp; Chuang:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The phase estimation algorithm uses two registers. The first register&#xA;  contains $t$ qubits initially in the state $|0\rangle$. How we choose&#xA;   $t$ depends on two things: the number of digits of accuracy we wish to&#xA;  have in our estimate for $\varphi$, and with what probability we wish the&#xA;  phase estimation procedure to be successful. The dependence of $t$ on&#xA;  these quantities emerges naturally from the following analysis.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The second register begins in the state $|u\rangle$ and contains as&#xA;  many qubits as is necessary to store $|u\rangle$. Phase estimation is&#xA;  performed in two stages. First, we apply the circuit shown in Figure&#xA;  5.2. The circuit begins by applying a Hadamard transform to the first register, followed by application of controlled - $U$ operations on&#xA;  the second register, with $U$ raised to successive powers of two. The&#xA;  final state of the first register is easily seen to be:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\frac{1}{2^{t/2}}\left(|0\rangle+\text{exp}(2\pi i&#xA; 2^{t-1}\varphi)|1\rangle)(|0\rangle+\text{exp}(2\pi i&#xA; 2^{t-2}\varphi)|1\rangle)...(|0\rangle+\text{exp}(2\pi i&#xA; 2^{0}\varphi)|1\rangle\right)=&#xA; \frac{1}{2^{t/2}}\sum_{k=0}^{2^{t}-1}\text{exp}(2\pi i \varphi&#xA; k)|k\rangle$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qPhh0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qPhh0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The second stage of phase estimation is to apply the inverse quantum&#xA;  Fourier transform on the first register. This is obtained by reversing&#xA;  the circuit for the quantum Fourier transform in the previous section&#xA;  (Exercise 5.5) and can be done in $\Theta (t^2)$ steps. The third and&#xA;  final stage of phase estimation is to read out the state of the first&#xA;  register by doing a measurement in the computational basis. We will&#xA;  show that this provides a pretty good estimate of $\varphi$. An&#xA;  overall schematic of the algorithm is shown in Figure 5.3.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To sharpen our intuition as to why phase estimation works, suppose $\varphi$&#xA;  may be expressed exactly int bits, as $\varphi = 0.\varphi_1 ...&#xA; \varphi_t$. Then the state (5.20) resulting from the first stage of&#xA;  phase estimation may be rewritten&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\frac{1}{2^{t/2}}(|0\rangle + \exp(2\pi i&#xA; 0.\varphi_t|1\rangle)(|0\rangle + \exp(2\pi i 0.\varphi_{t-1}\varphi_t|1\rangle)...(|0\rangle + \exp(2\pi i 0.\varphi_1...\varphi_t|1\rangle)$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The second stage of phase estimation is to apply the inverse quantum&#xA;  Fourier transform. But comparing the previous equation with the&#xA;  product form for the Fourier transform, Equation (5.4), we see that&#xA;  the output state from the second stage is the product state&#xA;   $|\varphi_1 ...\varphi_t\rangle$. A measurement in the computational&#xA;  basis, therefore, gives us $\varphi$ exactly!&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9hDwn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9hDwn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Summarizing, the phase estimation algorithm allows one to estimate the&#xA;  phase $\varphi$ of an eigenvalue of a unitary operator $U$, given the&#xA;  corresponding eigenvector $|u\rangle$. An essential feature at the&#xA;  heart of this procedure is the ability of the inverse Fourier&#xA;  transform to perform the transformation&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$\frac{1}{2^{t/2}}\sum_{j = 0}^{2^t-1}\exp(2\pi i \varphi j)|j\rangle |u\rangle \to |\tilde \varphi \rangle |u\rangle$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let's proceed from here. I found a nice &lt;em&gt;circuit diagram&lt;/em&gt; for the &lt;strong&gt;HHL09 algorithm&lt;/strong&gt; &lt;a href=&quot;https://arxiv.org/abs/1612.02886v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;sup&gt;[$\dagger$]&lt;/sup&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nEmvl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nEmvl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Step 1 (Phase Estimation):&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In the first step of the &lt;strong&gt;HHL09 algorithm&lt;/strong&gt; the same concept (of the standard Quantum Phase Estimation algorithm as described in Nielsen and Chuang) is used. However, we must keep in mind that $A$ by itself isn't a unitary operator. However, if we assume that $A$ is Hermitian then the exponential $e^{iAt}$ is unitary (no worries, there's exists a workaround in case $A$ isn't Hermitian!).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, we can write $U=e^{iAt}$. There's another subtle point involved here. We &lt;em&gt;do not&lt;/em&gt; know the eigenvectors $|u_j\rangle$ of $U$ beforehand (but we &lt;em&gt;do know&lt;/em&gt; that for any unitary matrix of size $N\times N$ there exist $N$ orthonormal eigenvectors). Moreover, we need to remind ourselves that if the eigenvalues of $A$ are $\lambda_j$ then the eigenvalues of $e^{iAt}$ will be $e^{i \lambda_j t}$. If we compare this with the form of eigenvalues given in Nielsen and Chuang for $U$ i.e. if  $e^{2\pi i \varphi} \equiv e^{ i \lambda_j t}$, we'd find $\varphi = \frac{\lambda_j t}{2\pi}$. In this case, we begin in the state $|b\rangle$ (which can be written as a superposition of the eigenvectors of $U$ i.e. $\sum_{j=1}^{j=N}\beta_j|u_j\rangle$) rather than any particular eigenvector $|u_j\rangle$ of $U$, as far as the second register of qubits is concerned. If we had begun in the state $|u\rangle \otimes (|0\rangle)^{\otimes t}$ we would have ended up with $|u\rangle \otimes |\tilde\varphi\rangle$ i.e. $|u_j\rangle \otimes |\tilde{\frac{\lambda_j t}{2\pi}}\rangle$ (considering that $\lambda_j$ is the eigenvalue associated with the eigenvector $|u_j\rangle$ of $A$). Now, instead if we begin in the superposition of eigenvectors $\sum_{j=1}^{j=N}\beta_j|u_j\rangle$ we should end up with $\sum_{j=1}^{j=N}\beta_j|u_j\rangle\otimes |\tilde{\frac{\lambda_j t}{2\pi}}\rangle$. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Part 1&lt;/strong&gt;: In the &lt;strong&gt;HHL09 paper&lt;/strong&gt;, they wrote about the state of the system after this Phase Estimation step is $\sum_{j=1}^{j=N}\beta_j|u_j\rangle\otimes |\tilde\lambda_j\rangle$. However, from what I wrote above it seems to me that the state of the system should rather be $\sum_{j=1}^{j=N}\beta_j|u_j\rangle\otimes |\tilde{\frac{\lambda_j t}{2\pi}}\rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What am I missing here? Where did the factor of $\frac{t}{2\pi}$ vanish in their algorithm?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;strong&gt;Part 2&lt;/strong&gt; has been asked &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2390/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-1-number-of-qu&quot;&gt;here&lt;/a&gt; to make the individual questions more focused.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;I also have several confusions regarding Step 2 and Step 3 of the HHL09 algorithm too, but I decided to post them as separate question threads, as this one is becoming too long. I'll add the links to those question threads, on this post, once they are created.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[$\dagger$]: &lt;em&gt;Homomorphic Encryption Experiments on IBM's Cloud Quantum Computing Platform&lt;/em&gt; Huang et al. (2016)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T12:33:36.670" LastActivityDate="2018-12-23T12:33:36.670" Title="Quantum algorithm for linear systems of equations (HHL09): Step 1 - Confusion regarding the usage of phase estimation algorithm" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2389" PostTypeId="2" ParentId="2386" CreationDate="2018-06-19T08:25:57.327" Score="1" Body="&lt;p&gt;You can find some lists of open source quantum projects &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1918/does-a-complete-list-of-open-quantum-software-projects-exist&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’d also advise you to check out the &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit&lt;/a&gt; and &lt;a href=&quot;https://www.rigetti.com/community&quot; rel=&quot;nofollow noreferrer&quot;&gt;Forest&lt;/a&gt; Slack channels to find some potential ideas and collaborators.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-19T08:25:57.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2390" PostTypeId="1" CreationDate="2018-06-19T08:40:02.743" Score="8" ViewCount="498" Body="&lt;p&gt;This is a continuation of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2388/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-1-confusion-re&quot;&gt;Quantum algorithm for linear systems of equations (HHL09): Step 1 - Confusion regarding the usage of phase estimation algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Questions (contd.):&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Part 2:&lt;/strong&gt; I'm not exactly sure how many qubits will be needed for the &lt;strong&gt;Step 1&lt;/strong&gt; of the &lt;strong&gt;HHL09&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Nielsen and Chuang (section 5.2.1, 10th anniversary edition) they say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thus to successfully obtain $\varphi$ accurate to $n$-bits with&#xA;  probability of sucess at least $1-\epsilon$ we choose &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$t=n+\lceil { \log(2+\frac{1}{2\epsilon})\rceil}$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, say we want an accuracy of $90\%$ i.e. $1-\epsilon = 0.9 \implies \epsilon = 0.1$ and a precision of $3$-bits for $\frac{\lambda_j t}{2\pi}$ or $\lambda_j$ we'd need &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$t = 3 + \lceil { \log_2(2+\frac{1}{2 (0.1)})\rceil} = 3 + 3 = 6$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from that, since $|b\rangle$ can be represented as a sum of $N$ linearly independent eigenvectors of a $N\times N$ dimensional matrix $A$, we'd need minimum $\lceil{\log_2(N)\rceil}$ qubits to produce a vector space having at least $N$ - dimensions. So, we need $\lceil{\log_2(N)\rceil}$ for the second register. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for the first register we not only $\lceil{\log_2(N)\rceil}$ qubits &lt;em&gt;won't be sufficient&lt;/em&gt; to represent the $N$ eigenvalues $|\lambda_j\rangle$, that is because we'll need more bits for representing each $|\lambda_j\rangle$ precisely upto $n$-bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess we should again use the formula $$n+\lceil { \log(2+\frac{1}{2\epsilon})\rceil}$$ in this case. If we want each eigenvalue $|\lambda_i\rangle$ to be represented with a $3$-bit precision and $90\%$ accuracy  then we'd need $6\times \lceil{\log_2(N)\rceil}$ for the first register. Plus, one more qubit which is needed for the ancilla. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we should need a total of $(6+1)\lceil{\log_2(N)\rceil}+1$ qubits for &lt;strong&gt;Step 1&lt;/strong&gt; of the &lt;strong&gt;HHL09 algorithm&lt;/strong&gt;. That's quite a lot!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we want to solve a $2\times 2$ linear equation system such that $A$ is Hermitian that itself would require $7\lceil{\log_2(2)\rceil}+1 = 8$ qubits! In case $A$ is not Hermitian we'd need even more qubits. Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in &lt;a href=&quot;https://arxiv.org/abs/1710.03599&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&lt;sup&gt;[$\dagger\dagger$]&lt;/sup&gt; paper on page 6 they claim that they used the &lt;strong&gt;HHL09 algorithm&lt;/strong&gt; to estimate the pseudoinverse of $A$ which of size ~$200\times 200$. In that paper, $A$ is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A := \begin{pmatrix} W - \gamma \Bbb I_d &amp;amp; P \\ P &amp;amp; 0  \end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $P$,$W$ and $\Bbb I_d$ are all $d\times d$ matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SeU2e.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SeU2e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the H1N1 related simulated Lloyd et al. have claimed to have made, $d = 100$. And they further claim that they used the &lt;strong&gt;HHL09 algorithm&lt;/strong&gt; to estimate the pseudo-inverse of $A$ (which is of size $200\times 200$). That would need a minimum of $7\lceil{\log_2(200)\rceil}+1 = 7(8)+1 = 57$ qubits to simulate. I have no idea how they could possibly do that using the current quantum computers or quantum computer simulations. As far as I know, IBM Q Experience at present supports ~$15$ qubits (that too it isn't as versatile as their $5$-qubit version).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Am I missing something here? Does this Step 1 actually require a lesser number of qubits than what I have estimated?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[$\dagger\dagger$]: &lt;em&gt;A Quantum Hopfield Neural Network&lt;/em&gt; Lloyd et al. (2018)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T12:34:06.627" LastActivityDate="2018-12-23T12:34:06.627" Title="Quantum algorithm for linear systems of equations (HHL09): Step 1 - Number of qubits needed" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2391" PostTypeId="2" ParentId="2381" CreationDate="2018-06-19T09:00:33.777" Score="4" Body="&lt;p&gt;A qubit is a two-dimensional quantum system, and the quantum generalization of a bit. Like bits, qubits can be in the states &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;. In quantum notation, we write these as $|0\rangle$ and $|1\rangle$. They can also be in superposition states such as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |\psi_0 \rangle = \alpha |0\rangle + \beta |1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $\alpha$ and $\beta$ are complex numbers in general. But for this answer, I'll just assume they are normal real numbers. The name I've given this state, $|\psi_0 \rangle$, is just for convenience. It has no deeper meaning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extracting an output from a qubit is done by a process known as measurement. The most common measurement is what we call the $Z$ measurement. This means just asking the qubit whether it is &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt;. If it is in a superposition state, such as the one above, the output will be random. You'll get &lt;code&gt;0&lt;/code&gt; with probability $\alpha^2$ and &lt;code&gt;1&lt;/code&gt; with probability $\alpha^2$ (so clearly these numbers need to satisfy ($\alpha^2+\beta^2=1$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might make it seem that superpositions are just random number generators, but that isn't the case. For every $ \alpha |0\rangle + \beta |1\rangle$ , we can construct the following state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ |\psi_1 \rangle = \beta |0\rangle - \alpha |1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is as different to $|\psi_0\rangle$ as $|0\rangle$ is to $|1\rangle$. We call it a state that is &lt;em&gt;orthogonal&lt;/em&gt; to $|\psi_0\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this we can define an alternative measurement that looks at whether our qubit is $|\psi_0\rangle$ or $|\psi_1\rangle$. For this measurement, it is the $|\psi_0\rangle$ and $|\psi_1\rangle$ states that give us definite answers. For other states, such as $|0\rangle$ and $|1\rangle$, we'd get random outputs. This is because they can be thought of as superpositions of $|\psi_0\rangle$ and $|\psi_1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, trying to summarize a little, qubits are objects that we can use to store a bit. We usually do this in the states $|0\rangle$ and $|1 \rangle$, but in fact, we could choose to do it in any of the infinite possible pairs of orthogonal states. If we want to get the bit out again with certainty, we have to measure according to the encoding we used. Otherwise, there will always be a degree of randomness. For more detail on all this, you can check out a &lt;a href=&quot;https://medium.com/@decodoku/quantum-computation-with-the-simplest-maths-possible-c23ff6563964&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog post&lt;/a&gt; I once wrote.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To start getting interesting things happing, we need more than one qubit. Since $n$ bits can be made into $2^n$ different bit strings, there is an exponentially large number of orthogonal states that can be included in our superpositions of $n$ qubits. This is the space in which we can do all the tricks of quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as for how that works, I'll have to refer you to the rest of the questions and answers in this Stack Exchange.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-07-13T14:55:55.303" LastActivityDate="2018-07-13T14:55:55.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2392" PostTypeId="1" AcceptedAnswerId="2394" CreationDate="2018-06-19T10:58:31.203" Score="5" ViewCount="91" Body="&lt;p&gt;In a paper I am reading, it states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For open-loop coherent controllability a quantum system with Hamiltonian $H$ is open-loop controllable by a coherent controller if and only if the algebra $\mathcal{A}$ generated from $\{ H, H_i \}$ by commutation is the full algebra of Hermitian operators for the system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How would you produce an algebra from the set $\{ H, H_i \}$ using commutation? What is the basic idea in this regard?&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2021-04-23T12:50:20.070" LastActivityDate="2021-04-23T12:50:20.070" Title="How do you produce an algebra from a set $\{H, H_i\}$ via commutation?" Tags="&lt;mathematics&gt;&lt;quantum-control&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2393" PostTypeId="1" AcceptedAnswerId="2396" CreationDate="2018-06-19T11:03:29.097" Score="9" ViewCount="689" Body="&lt;p&gt;&lt;sup&gt;This is a sequel to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2388/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-1-confusion-re&quot;&gt;Quantum algorithm for linear systems of equations (HHL09): Step 1 - Confusion regarding the usage of phase estimation algorithm&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2390/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-1-number-of-qu&quot;&gt;Quantum algorithm for linear systems of equations (HHL09): Step 1 - Number of qubits needed&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the paper: &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Quantum algorithm for linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/strong&gt;&lt;/a&gt;, what's written up to the portion &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The next step is to decompose $|b\rangle$ in the eigenvector basis,&#xA;  using phase estimation [5–7]. Denote by $|u_j\rangle$ the eigenvectors&#xA;  of $A$ (or equivalently, of $e^{iAt}$), and by $\lambda_j$ the&#xA;  corresponding eigenvalues.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;on page $2$ makes &lt;em&gt;some&lt;/em&gt; sense to me (the confusions up till there have been addressed in the previous posts linked above). However, the next portion i.e. the $R(\lambda^{-1})$ rotation seems a bit cryptic.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let $$|\Psi_0\rangle := \sqrt{\frac{2}{T}}\sum_{\tau =0}^{T-1} \sin&#xA; \frac{\pi(\tau+\frac{1}{2})}{T}|\tau\rangle$$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;for some large $T$. The coefficients of $|\Psi_0\rangle$ are chosen&#xA;  (following [5-7]) to minimize a certain quadratic loss function which&#xA;  appears in our error analysis (see [13] for details).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Next, we apply the conditional Hamiltonian evolution $\sum_{\tau =&#xA; 0}^{T-1}|\tau\rangle \langle \tau|^{C}\otimes e^{iA\tau t_0/T}$ on&#xA;   $|\Psi_0\rangle^{C}\otimes |b\rangle$, where $t_0 =&#xA; \mathcal{O}(\kappa/\epsilon)$. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; What exactly is $|\Psi_0\rangle$? What do $T$ and $\tau$ stand for? I've no idea from where this gigantic expression $$\sqrt{\frac{2}{T}}\sum_{\tau =0}^{T-1} \sin&#xA;\frac{\pi(\tau+\frac{1}{2})}{T}|\tau\rangle$$ suddenly comes from and what its use is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt;  After the phase estimation step, the state of our system is &lt;em&gt;apparently&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\sum_{j=1}^{j=N}\beta_j|u_j\rangle\otimes |\tilde\lambda_j\rangle\right)\otimes |0\rangle_{\text{ancilla}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This surely &lt;strong&gt;cannot&lt;/strong&gt; be written as $$\left(\sum_{j=1}^{j=N}\beta_j|u_j\rangle\right)\otimes \left(\sum_{j=1}^{j=N}|\tilde\lambda_j\rangle\right)\otimes |0\rangle_{\text{ancilla}}$$ i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|b\rangle\otimes \left(\sum_{j=1}^{j=N}|\tilde\lambda_j\rangle\right)\otimes |0\rangle_{\text{ancilla}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it is clear that $|b\rangle$ is not available &lt;em&gt;separately&lt;/em&gt; in the second register. So I've no idea how they're preparing a state like  $|\Psi_0\rangle^{C}\otimes |b\rangle$ in the first place! Also, what does that $C$ in the superscript of $|\Psi_0\rangle^{C}$ denote?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Where does  this expression $\sum_{\tau =&#xA; 0}^{T-1}|\tau\rangle \langle \tau|^{C}\otimes e^{iA\tau t_0/T}$ suddenly appear from ? What's the use of simulating it? And what is $\kappa$ in $\mathcal{O}(\kappa/\epsilon)$ ?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T19:00:54.647" LastActivityDate="2018-07-05T19:00:54.647" Title="Quantum algorithm for linear systems of equations (HHL09): Step 2 - What is $|\Psi_0\rangle$?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2394" PostTypeId="2" ParentId="2392" CreationDate="2018-06-19T11:13:46.480" Score="3" Body="&lt;p&gt;In general, an algebra $\mathcal{A}$ generated from a set $\{H_1, H_2,..., H_n\}$ by commutation refers to the algebra whose generators are $H_1,H_2,...,H_n$, all their first-order commutators $C_{ij} = [H_i,H_j]$, and all their second-order commutators $C_{ijk} = [[H_i, H_j],H_k]$ and so on.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-06-19T11:13:46.480" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2395" PostTypeId="2" ParentId="2388" CreationDate="2018-06-19T11:33:48.223" Score="5" Body="&lt;p&gt;It depends on the papers but I saw 2 approaches:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In most of the papers I read about the HHL algorithm and its implementation, the Hamiltonian evolution time $t$ is taken such that this factor disappear, i.e. $t = t_0 = 2\pi$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The approximate eigenvalue is often written $\tilde \lambda$. In some paper this notation really means &quot;the approximation of the true eigenvalue $\lambda$&quot; and in other papers they seems to include $\frac{t}{2\pi}$ in this definition, i.e. &quot;$\tilde \lambda$ is the approximation of the value of $\frac{\lambda t}{2\pi}$&quot;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here are some links:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum linear systems algorithms: a primer (Dervovic, Herbster, Mountney, Severini, Usher &amp;amp; Wossnig, 2018)&lt;/a&gt;: a complete and very good article on HHL algorithm and some improvements that has been discovered. The paper is from the 22th of February, 2018. The value of $t$ you are interested in is first addressed in page 30, in the legend of Figure 5 and is fixed at $2\pi$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations (Cao, Daskin, Frankel &amp;amp; Kais, 2013)&lt;/a&gt; (take the v2 and not the v3): a detailed implementation of HHL algorithm for a fixed 4x4 matrix. If you plan to use the article let me warn you that there are some mistakes in it. I can provide you the ones I found if you are interested. The value for $t$ (which is denoted as $t_0$ in this paper) is fixed to $2\pi$ in the second page (at the start of the right column).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1302.4310&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental Quantum Computing to Solve Systems of Linear Equations (Cai,  Weedbrook, Su, Chen, Gu, Zhu, Li, Liu, Lu &amp;amp; Pan, 2013)&lt;/a&gt;: an implementation of HHL algorithm for a 2x2 matrix on an experimental setup. They fix $t = 2\pi$ in the legend of Figure 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1302.1946&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental realization of quantum algorithm for solving linear systems of equations (Pan, Cao, Yao, Li, Ju, Peng, Kais &amp;amp; Du, 2013)&lt;/a&gt;: implementation of HHL for a 2x2 matrix. The implementation is similar to the one given in the second point above, with the 4x4 matrix. They fix $t_0 = 2\pi$ in page 3, bullet point n°2. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-06-19T14:25:48.073" LastActivityDate="2018-06-19T14:25:48.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2396" PostTypeId="2" ParentId="2393" CreationDate="2018-06-19T13:38:06.450" Score="6" Body="&lt;h1&gt;1. Definitions&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Names and symbols used in this answer follow the ones defined in &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum linear systems algorithms: a primer (Dervovic, Herbster, Mountney, Severini, Usher &amp;amp; Wossnig, 2018)&lt;/a&gt;. A recall is done below.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;1.1 Register names&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Register names are defined in Figure 5. of &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum linear systems algorithms: a primer (Dervovic, Herbster, Mountney, Severini, Usher &amp;amp; Wossnig, 2018)&lt;/a&gt; (reproduced below):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$S$ (1 qubit) is the ancilla register used to check if the output is valid or not. &lt;/li&gt;&#xA;&lt;li&gt;$C$ ($n$ qubits) is the clock register, i.e. the register used to estimate the eigenvalues of the hamiltonian with quantum phase estimation (QPE).&lt;/li&gt;&#xA;&lt;li&gt;$I$ ($m$ qubits) is the register storing the right-hand side of the equation $Ax = b$. It stores $x$, the result of the equation, when $S$ is measured to be $\left|1\right&amp;gt;$ at the end of the algorithm.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rMzOI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rMzOI.png&quot; alt=&quot;HHL algorithm&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;2. About $\left|\Psi_0\right&amp;gt;$:&lt;/h1&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What exactly is $\left|\Psi_0\right&amp;gt;$?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\left|\Psi_0\right&amp;gt;$ is one possible initial state of the clock register $C$. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;What do $T$ and $\tau$ stand for?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T$ stands for a big positive integer. This $T$ should be as large as possible because the expression of $\left|\Psi_0\right&amp;gt;$ asymptotically minimise a given error for $T$ growing to infinity. In the expression of $\left|\Psi_0\right&amp;gt;$, $T$ will be $2^n$, the number of possible states for the quantum clock $C$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\tau$ is just the summation index&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why such a gigantic expression for $\left|\Psi_0\right&amp;gt;$?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2462/1386&quot;&gt;DaftWullie's post&lt;/a&gt; for a detailed explanation.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the citations in &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009 v3)&lt;/a&gt; we end up with:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The previous version of the same paper &lt;a href=&quot;https://arxiv.org/abs/0811.3171v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009 v2)&lt;/a&gt;. The authors revised the paper 2 times (there are 3 versions of the original HHL paper) and version n°3 does not include all the informations provided in the previous versions. In the V2 (section A.3. starting at page 17), the authors provide a detailed analysis of the error with this special initial state.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9808042v2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Quantum Clocks (Buzek, Derka, Massar, 1998)&lt;/a&gt; where the expression of $\left|\Psi_0\right&amp;gt;$ is given as $\left|\Psi_{opt}\right&amp;gt;$ in Equation 10. I don't have the knowledge to understand fully this part, but it seems like this expression is &quot;optimal&quot; in some sense.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h1&gt;3. Preparation of $\left|\Psi_0\right&amp;gt;$:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;As said in the previous part, $\left|\Psi_0\right&amp;gt;$ is an initial state. They do not prepare $\left|\Psi_0\right&amp;gt;$ after the phase estimation procedure. The sentence ordering is not really optimal in the paper. The phase estimation procedure they use in the paper is a little bit different from the &quot;classic&quot; phase estimation algorithm represented in the quantum circuit linked in part 1, and that is why they explain it in details. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their phase estimation algorithm is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare the $\left|\Psi_0\right&amp;gt;$ state in the register $C$.&lt;/li&gt;&#xA;&lt;li&gt;Apply the conditional Hamiltonian evolution to the registers $C$ and $I$ (which are in the state $\left|\Psi_0\right&amp;gt;\otimes \left|b\right&amp;gt;$).&lt;/li&gt;&#xA;&lt;li&gt;Apply the quantum Fourier transform to the resulting state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Finally, the $C$ in $\left| \Psi_0 \right&amp;gt;^C$ means that the state $\left| \Psi_0 \right&amp;gt;$ is stored in the register $C$. This is a short and convenient notation to keep track of the registers used.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;4. Hamiltonian simulation:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;First of all, $\kappa$ is the condition number (&lt;a href=&quot;https://en.wikipedia.org/wiki/Condition_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page on &quot;condition number&quot;&lt;/a&gt;) of the matrix $A$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\sum_{\tau = 0}^{T-1}|\tau\rangle \langle \tau|^{C}\otimes e^{iA\tau t_0/T}$ is the mathematical representation of a quantum gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part in the sum $|\tau\rangle \langle \tau|^{C}$ is a control part. It means that the operation will be controlled by the state of the first quantum register (the register $C$ as the exponent tells us).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part is the &quot;Hamiltonian simulation&quot; gate, i.e. a quantum gate that will apply the unitary matrix given by $e^{iA\tau t_0/T}$ to the second register (the register $I$ that is in the initial state $\left|b\right&amp;gt;$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole sum is the mathematical representation of the controlled-U operation in the quantum circuit of &quot;1. Definitions&quot;, with $U = e^{iA\tau t_0/T}$.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-06-27T06:21:14.917" LastActivityDate="2018-06-27T06:21:14.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2397" PostTypeId="1" AcceptedAnswerId="2398" CreationDate="2018-06-19T17:44:46.100" Score="10" ViewCount="2092" Body="&lt;p&gt;A CCCNOT gate is a four-bit reversible gate that flips its fourth bit if and only if the first three bits are all in the state $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I implement a CCCNOT gate using Toffoli gates? Assume that bits in the workspace start with a particular value, either 0 or 1, provided you return them to that value.&lt;/p&gt;&#xA;" OwnerUserId="2713" LastEditorUserId="26" LastEditDate="2018-12-13T19:55:05.637" LastActivityDate="2019-11-25T19:37:15.577" Title="Implementing a CCCNOT gate using only Toffoli gates" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2398" PostTypeId="2" ParentId="2397" CreationDate="2018-06-19T19:20:18.097" Score="9" Body="&lt;p&gt;I guess what you're looking for is the following circuit. Here, &lt;span class=&quot;math-container&quot;&gt;$b_1,b_2,b_3,b_4 \in \{0,1\}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is addition modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ELZCQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ELZCQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the fifth qubit is used as an &lt;em&gt;auxiliary&lt;/em&gt;, or &lt;em&gt;ancilla qubit&lt;/em&gt;. It starts at &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and ends in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; when the circuit is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me elaborate on how this circuit works. The idea is to first of all check whether the first two qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This can be done using a single Toffoli gate, and the result is stored in the auxiliary qubit. Now, the problem reduces to flipping qubit &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;, whenever qubits &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; and the auxiliary qubit are in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This can also be achieved using one application of a Toffoli gate, namely the middle one in the circuit shown above. Finally, the last Toffoli gate serves to &lt;em&gt;uncompute&lt;/em&gt; the temporary result that we stored in the auxiliary qubit, such that the state of this qubit returns to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; after the circuit is applied.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the comment section, the question arose whether it is possible to implement such a circuit using only Toffoli gates, without using auxiliary qubits. This question can be answered in the negative, as I will show here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to implement the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CCCNOT}$&lt;/span&gt;-gate, which acts on four qubits. We can define the following matrix (the matrix representation of the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-gate):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X = \begin{bmatrix}&#xA;0 &amp;amp; 1 \\ 1 &amp;amp; 0&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;Furthermore, we denote the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional identity matrix by &lt;span class=&quot;math-container&quot;&gt;$I_N$&lt;/span&gt;. Now, we observe that the matrix representation of the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CCCNOT}$&lt;/span&gt;-gate, acting on four qubits, is given by the following &lt;span class=&quot;math-container&quot;&gt;$16 \times 16$&lt;/span&gt; matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CCCNOT} = \begin{bmatrix}&#xA;I_{14} &amp;amp; 0 \\ 0 &amp;amp; X&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;Hence, we can determine its determinant:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\det(\mathrm{CCCNOT}) = -1$$&lt;/span&gt;&#xA;Now consider the matrix representation of the Toffoli gate, acting on the first three qubits of a &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-qubit system. Its matrix representation is written as (where we used the Kronecker product of matrices):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Toffoli} \otimes I_2 = \begin{bmatrix}&#xA;I_6 &amp;amp; 0 \\ 0 &amp;amp; X&#xA;\end{bmatrix} \otimes I_2 = \begin{bmatrix}&#xA;I_{12} &amp;amp; 0 \\ 0 &amp;amp; X \otimes I_2&#xA;\end{bmatrix} = \begin{bmatrix}&#xA;I_{12} &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; I_2 \\ 0 &amp;amp; I_2 &amp;amp; 0&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;Calculating its determinant yields:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\det(\mathrm{Toffoli} \otimes I_2) = 1$$&lt;/span&gt;&#xA;The Toffoli gates can also act on different qubits of course. Suppose we let the Toffoli gate act on the first, second and fourth qubit, where the fourth qubit is the target qubit. Then we obtain the new matrix representation from the one displayed above by swapping the columns corresponding to the states that differ only in the third and fourth qubit, i.e., &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|0010\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|0110\rangle$&lt;/span&gt;, etc. The important thing to note here, is that the number of swaps of columns is even, and hence that the determinant remains unchanged. As we can write every permutation of qubits as a sequence of consecutive permutations of just &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits (that is, &lt;span class=&quot;math-container&quot;&gt;$S_4$&lt;/span&gt; is generated by the transpositions in &lt;span class=&quot;math-container&quot;&gt;$S_4$&lt;/span&gt;), we find that for all Toffoli gates, applied to any combination of control and target qubits, its matrix representation has determinant &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final thing to note is that the determinant commutes with matrix multiplication, i.e., &lt;span class=&quot;math-container&quot;&gt;$\det(AB) = \det(A)\det(B)$&lt;/span&gt;, for any two matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; compatible with matrix multiplication. Hence, it now becomes apparent that applying multiple Toffoli gates in sequence never creates a circuit whose matrix representation has a determinant different from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, which in particular implies that the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CCCNOT}$&lt;/span&gt;-gate cannot be implemented using only Toffoli gates on &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious question, now, is what changes when we do allow an auxiliary qubit. We find the answer when we write out the action of the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CCCNOT}$&lt;/span&gt;-gate on a &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit system:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CCCNOT} \otimes I_2 = \begin{bmatrix}&#xA;I_{14} &amp;amp; 0 \\ 0 &amp;amp; X&#xA;\end{bmatrix} \otimes I_2 = \begin{bmatrix}&#xA;I_{28} &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; I_2 \\ 0 &amp;amp; I_2 &amp;amp; 0&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;If we calculate this determinant, we find:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\det(\mathrm{CCCNOT} \otimes I_2) = 1$$&lt;/span&gt;&#xA;Hence, the determinant of the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CCCNOT}$&lt;/span&gt;-gate acting on &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; qubits is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, instead of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. This is why the previous argument is not valid for &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; qubits, as we already knew because of the explicitly constructed circuit the OP asked for.&lt;/p&gt;&#xA;" OwnerUserId="24" LastEditorUserId="26" LastEditDate="2019-11-25T19:37:15.577" LastActivityDate="2019-11-25T19:37:15.577" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2399" PostTypeId="1" AcceptedAnswerId="2401" CreationDate="2018-06-19T21:14:31.540" Score="12" ViewCount="525" Body="&lt;p&gt;This question is very similar as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1584/is-there-any-general-statement-about-what-kinds-of-problems-can-be-solved-more-e&quot;&gt;Is there any general statement about what kinds of problems can be solved more efficiently using a quantum computer?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the answers provided to that questions mainly looked at it from a  &lt;em&gt;theoretical/mathematical&lt;/em&gt; point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this question, I am more interested in the &lt;em&gt;practical/engineering&lt;/em&gt; point of view.  So I would like to understand what kind of problems can be more efficiently solved by a quantum algorithm than you would currently be able to do with a classical algorithm.  So I am really assuming that you do not have all knowledge about all possible classical algorithms that could optimally solve the same problem!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware that the &lt;a href=&quot;https://math.nist.gov/quantum/zoo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum zoo&lt;/a&gt; expresses a whole collection of problems for which there exists a quantum algorithm that runs more efficiently than a classical algorithm but I fail to link these algorithms to &lt;em&gt;real-world problems&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that Shor's factoring algorithm is very important in the world of cryptography but I have deliberately excluded cryptography from the scope of this question as the world of cryptography is a very specific world which deserves his own questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In efficient quantum algorithms, I mean that there must at least be one step in the algorithm that must be translated to a quantum circuit on a n-qubit quantum computer.  So basically this quantum circuit is creating a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; x &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; matrix and its execution will give one of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possibilities with a certain possibility (so different runs might give different results - where the likely hood of each of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possibilities is determined by the constructed &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; x &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; Hermitian matrix.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think to answer my question there must be some aspect/characteristic of the real world problem that can be mapped to a &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; Hermitian matrix.&#xA;So what kind of aspects/characteristics of a real-world problem can be mapped to such a matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;em&gt;real-world problem&lt;/em&gt; I mean an actual problem that might be solved by a quantum algorithm, I don't mean a domain where there might be a potential use of the quantum algorithm.&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="26" LastEditDate="2019-01-27T08:09:02.463" LastActivityDate="2019-01-27T08:09:02.463" Title="What kind of real-world problems (excluding cryptography) can be solved efficiently by a quantum algorithm?" Tags="&lt;algorithm&gt;&lt;applications&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2400" PostTypeId="2" ParentId="2381" CreationDate="2018-06-19T22:53:53.417" Score="7" Body="&lt;p&gt;I'll probably be expanding this more (!) and adding pictures and links as I have time, but here's my first shot at this.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Mostly math-free explanation&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;A special coin&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Let's begin by thinking about normal bits. Imagine this normal bit is a coin, that we can flip to be heads or tails. We'll call heads equivalent to &quot;1&quot; and tails &quot;0&quot;. Now imagine instead of just flipping this coin, we can rotate it - 45${}^\circ$ above horizontal, 50$^\circ$ above horizontal, 10$^\circ$ below horizontal, whatever - these are all states. This opens up a huge new possibility of states - I could encode the whole works of Shakespeare into this one coin this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what's the catch? No such thing as a free lunch, as the saying goes. When I actually look at the coin, to see what state it's in, it becomes either heads or tails, based on probability - a good way to look at it is if it's closer to heads, it's more likely to become heads when looked at, and vice versa, though there's a chance the close-to-heads coin could become tails when looked at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, once I  look at this special coin, any information that was in it before can't be accessed again. If I look at my Shakespeare coin, I just get heads or tails, and when I look away, it still is whatever I saw when I looked at it - it doesn't magically revert to Shakespeare coin. I should note here that you might think, as Blue points out in the comments, that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given the huge advancement in modern day technology there's nothing stopping me from monitoring the exact orientation of a coin tossed in air as it falls. I don't necessarily need to &quot;look into it&quot; i.e. stop it and check whether it has fallen as &quot;heads&quot; or &quot;tails&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This &quot;monitoring&quot; counts as measurement. &lt;em&gt;There is no way to see the inbetween state of this coin.&lt;/em&gt; None, nada, zilch. This is a bit different from a normal coin, isn't it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So encoding all the works of Shakespeare in our coin is theoretically possible but we can never truly access that information, so not very useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nice little mathematical curiosity we've got here, but how could we actually do anything with this?&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The problem with classical mechanics&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Well, let's take a step back a minute here and switch to another tack. If I throw a ball to you and you catch it, we can basically model that ball's motion &lt;em&gt;exactly&lt;/em&gt; (given all parameters). We can analyze its trajectory with Newton's laws, figure out its movement through the air using fluid mechanics (&lt;a href=&quot;https://physics.stackexchange.com/questions/56496/what-is-the-mystery-of-turbulence&quot;&gt;unless there's turbulence&lt;/a&gt;), and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's set us up a little experiment. I've got a wall with two slits in it and another wall behind that wall. I set up one of those tennis-ball-thrower things in the front and let it start throwing tennis balls. In the meantime, I'm at the back wall marking where all our tennis balls end up. When I mark this, there are clear &quot;humps&quot; in the data right behind the two slits, as you might expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I switch our tennis-ball-thrower to something that shoots out really tiny particles. Maybe I've got a laser and we're looking where the photons look up. Maybe I've got an electron gun. Whatever, we're looking at where these sub-atomic particles end up again. This time, we don't get the two humps, we get an interference pattern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oI0yy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oI0yy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that look familiar to you at all? Imagine you drop two pebbles in a pond right next to each other. Look familiar now? The ripples in a pond &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_interference&quot; rel=&quot;nofollow noreferrer&quot;&gt;interfere&lt;/a&gt; with each other. There are spots where they cancel out and spots where they swell bigger, making beautiful patterns. Now, we're seeing an interference pattern shooting &lt;em&gt;particles&lt;/em&gt;. These particles must have wave-like behavior. So maybe we were wrong all along. (This is called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Double-slit_experiment&quot; rel=&quot;nofollow noreferrer&quot;&gt;double slit experiment&lt;/a&gt;.)Sorry, electrons are waves, not particles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Except...they're particles too. When you look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Cathode_ray&quot; rel=&quot;nofollow noreferrer&quot;&gt;cathode rays&lt;/a&gt; (streams of electrons in vacuum tubes), the behavior there clearly shows electrons are a particle. To quote wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Like a wave, cathode rays travel in straight lines, and produce a shadow when obstructed by objects. Ernest Rutherford demonstrated that rays could pass through thin metal foils, behavior expected of a particle. These conflicting properties caused disruptions when trying to classify it as a wave or particle [...] The debate was resolved when an electric field was used to deflect the rays by J. J. Thomson. This was evidence that the beams were composed of particles because scientists knew it was impossible to deflect electromagnetic waves with an electric field.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So...they're &lt;em&gt;both&lt;/em&gt;. Or rather, they're something completely different. That's one of several puzzles physicists saw at the beginning of the twentieth century. If you want to look at some of the others, look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Black-body_radiation&quot; rel=&quot;nofollow noreferrer&quot;&gt;blackbody radiation&lt;/a&gt; or the &lt;a href=&quot;https://en.wikipedia.org/wiki/Photoelectric_effect&quot; rel=&quot;nofollow noreferrer&quot;&gt;photoelectric effect&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;What fixed the problem - quantum mechanics&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;These problems lead us to realize that the laws that allow us to calculate the motion of that ball we're tossing back and forth just don't work on a really small scale. So a new set of laws were developed. These laws were called quantum mechanics after one of the major ideas behind them - the existence of fundamental packets of energy, called quanta. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is that I can't just give you .00000000000000000000000000 plus a bunch more zeroes 1 Joules of energy - there is a minimum possible amount of energy I can give you. It's like, in currency systems, I can give you a dollar or a penny, but (in American money, anyway) I can't give you a &quot;half-penny&quot;. Doesn't exist. Energy (and other values) can be like that in certain situations. (Not all situations, and this can occur in classical mechanics sometimes - see also &lt;a href=&quot;https://physics.stackexchange.com/questions/193133/quantization-vs-continuous-energy-levels/193164#193164&quot;&gt;this&lt;/a&gt;; thanks to Blue for pointing this out.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So anyway, we got this new set of laws, quantum mechanics. And the development of those laws is complete, though not completely correct (see quantum field theories, quantum gravity) but the history of their development is kind of interesting. There was this guy, Schrodinger, of cat-killing (&lt;a href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger&amp;#39;s_cat&quot; rel=&quot;nofollow noreferrer&quot;&gt;maybe?&lt;/a&gt;) fame, who came up with the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;wave equation&lt;/a&gt;&lt;/em&gt; formulation of quantum mechanics. And this was preferred by a lot of physicists preferred this, because it was sort of similar to the classical way of calculating things - integrals and hamiltonians and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another guy, Heisenberg, came up with another totally different way of calculating the state of a particle quantum-mechanically, which is called matrix mechanics. Yet another guy, Dirac, proved that the matrix mechanical and wave equation formulations were equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now, we must switch tacks again - what are matrices, and their friend vectors?&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Vectors and matrices - or, some hopefully painless linear algebra&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Vectors are, at their simplest, arrows. I mean, they're on a coordinate plane, and they're math-y, but they're arrows. (Or you could take the programmer view and call them lists of numbers.) They're quantities that have a magnitude and a direction. So once we have this idea of vectors...what might we use them for? Well, maybe I have an acceleration. I'm accelerating to the right at 1 m/s$^2$, for example. That could be represented by a vector. How long that arrow is represents how quickly I am accelerating, the arrow would be pointing right along the x-axis, and by convention, the arrow's tail would be situated at the origin. We notate a vector by writing something like [2, 3] which would notate a vector with its tail at the origin and its point at (2, 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have these vectors. What sorts of math can I do with them? How can I manipulate a vector? I can multiply vectors by a normal number, like 3 or 2 (these are called scalars), to stretch it, shrink it (if a fraction), or flip it (if negative). I can add or subtract vectors pretty easily - if I have a vector (2, 3) + (4, 2) that equals (6, 5). There's also stuff called dot products and cross products that we won't get into here - if interested in any of this, look up &lt;a href=&quot;https://www.youtube.com/watch?v=kjBOesZCoqc&amp;amp;list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab&quot; rel=&quot;nofollow noreferrer&quot;&gt;3blue1brown's linear algebra series&lt;/a&gt;, which is very accessible, actually teaches you how to &lt;em&gt;do&lt;/em&gt; it, and is a fabulous way to learn about this stuff. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's say I have one coordinate system, that my vector is in, and then I want to move that vector to a new coordinate system. I can use something called a matrix to do that. Basically we can define in our system two vectors, called $\hat{i}$ and $\hat{j}$, read i-hat and j-hat (we're doing all this in two dimensions in the real plane; you can have higher dimension vectors with complex numbers ($\sqrt{-1} = i$) as well but we're ignoring them for simplicity), which are vectors that are one unit in the x direction and one unit in the y direction - that is, (0, 1) and (1, 0). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we see where i-hat and j-hat end up in our new coordinate system. In the first column of our matrix, we write the new coordinates of i-hat and in the second column the new coordinates of j-hat. We can now multiply this matrix by any vector and get that vector in the new coordinate system. The reason this works is because you can rewrite vectors as what are called linear combinations. This means that we can rewrite say, (2, 3) as 2*(1, 0) + 3*(0, 1) - that is, 2*i-hat + 3*j-hat. When we use a matrix, we're effectively re-multiplying those scalars by the &quot;new&quot; i-hat and j-hat. Again, if interested, see 3blue1brown's videos. These matrices are used a lot in many fields, but this is where the name matrix mechanics comes from.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Tying it all together&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Now matrices can represent rotations of the coordinate plain, or stretching or shrinking the coordinate plane or a bunch of other things. But some of this behavior...sounds kind of familiar, doesn't it? Our little special coin sounds kind of like it. We have this rotation idea. What if we represent the horizontal state by i-hat, and the vertical by j-hat, and describe what the rotation of our coin is using linear combinations? That works, and makes our system much easier to describe. So our little coin can be described using linear algebra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What else can be described linear algebra and has weird probabilities and measurement? Quantum mechanics. (In particular, this idea of linear combinations becomes the idea called a superposition, which is where the whole idea, oversimplified to the point it's not really correct, of &quot;two states at the same time&quot; comes from.) So these special coins can be quantum mechanical objects. What sorts of things are quantum mechanical objects?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;photons&lt;/li&gt;&#xA;&lt;li&gt;superconductors&lt;/li&gt;&#xA;&lt;li&gt;electron energy states in an atom&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Anything, in other words, that has the discrete energy (quanta) behavior, but also can act like a wave - they can interfere with one another and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have these special quantum mechanical coins. What should we call them? They store an information state like bits...but they're quantum. They're qubits. And now what do we do? We manipulate the information stored in them with matrices (ahem, gates). We measure to get results. In short, we compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we know that we cannot encode infinite amounts of information in a qubit and still access it (see the notes on our &quot;shakespeare coin&quot;), so what then is the advantage of a qubit? It comes in the fact that those extra bits of information can affect all the other qubits (it's that superposition/linear combination idea again), which affects the probability, which then affects your answer - but it's very difficult to use, which is why there are so few quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The special coin versus the normal coin - or, what makes a qubit different?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;So...we have this qubit. But Blue brings up a great point.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how is a quantum state like $\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$ different from a coin which when tossed in the air has a 50−50 chance of turning out to be heads or tails. Why can't we say that a classical coin is a &quot;qubit&quot; or call a set of classical coins a system of qubits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are several differences - the way that measurement works (see the fourth paragraph), this whole superposition idea - but the defining difference (Mithrandir24601 pointed this out in chat, and I agree) is the violation of the Bell inequalities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take another tack. Back when quantum mechanics was being developed, there was a big debate. It started between Einstein and Bohr. When Schrodinger's wave theory was developed, it was clear that quantum mechanics would be a probabilistic theory. Bohr published a paper about this probabilistic worldview, which he concluded saying&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Here the whole problem of determinism comes up. From the standpoint of our quantum mechanics there is no quantity which in any individual case causally fixes the consequence of the collision; but also experimentally we have so far no reason to believe that there are some inner properties of the atom which conditions a definite outcome for the collision. Ought we to hope later to discover such properties ... and determine them in individual cases? Or ought we to believe that the agreement of theory and experiment—as to the impossibility of prescribing conditions for a causal evolution—is a pre-established harmony founded on the nonexistence of such conditions? I myself am inclined to give up determinism in the world of atoms. But that is a philosophical question for which physical arguments alone are not decisive.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The idea of determinism has been around for a while. Perhaps one of the more famous quotes on the subject is from Laplace, who said&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An intellect which at a certain moment would know all forces that set nature in motion, and all positions of all items of which nature is composed, if this intellect were also vast enough to submit these data to analysis, it would embrace in a single formula the movements of the greatest bodies of the universe and those of the tiniest atom; for such an intellect nothing would be uncertain and the future just like the past would be present before its eyes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The idea of determinism is that if you know all there is to know about a current state, and apply the physical laws we have, you can figure out (effectively) the future. However, quantum mechanics decimates this idea with probability. &quot;I myself am inclined to give up determinism in the world of atoms.&quot; This is a huge deal!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Albert Einstein's famous response: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum mechanics is very worthy of regard. But an inner voice tells me that this is not yet the right track. The theory yields much, but it hardly brings us closer to the Old One's secrets. I, in any case, am convinced that He does not play dice.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(Bohr's response was apparently &quot;Stop telling God what to do&quot;, but anyway.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a while, there was debate. Hidden variable theories came up, where it wasn't just probability - there was a way the particle &quot;knew&quot; what it was going to be when measured; it wasn't all up to chance. And then, there was the Bell inequality. To quote Wikipedia,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In its simplest form, Bell's theorem states&lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;No physical theory of local hidden variables can ever reproduce all of the predictions of quantum mechanics.&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And it provided a way to experimentally check this. It's true - it is pure probability. This is no classical behavior. It is all chance, chance that affects other chances through superposition, and then &quot;collapses&quot; to a single state upon measurement (if you follow the Copenhagen interpretation). So to summarize: firstly, measurement is fundamentally different in quantum mechanics, and secondly, that quantum mechanics is not deterministic. Both of these points mean that any quantum system, including a qubit, is going to be fundamentally different from any classical system.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;A small disclaimer&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7ze5C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ze5C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As xkcd wisely points out, any analogy is an approximation. This answer isn't formal at all, and there's a heck of a lot more to this stuff. I'm hoping to add to this answer with a slightly more formal (though still not completely formal) description, but please keep this in mind.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Resources&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Nielsen and Chuang, Quantum Computing and Quantum Information. The bible of quantum computing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;3blue1brown's linear algebra and calculus courses are great for the math.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Michael Nielsen (yeah, the guy who coauthored the textbook above) has a video series called Quantum Computing for the Determined. 10/10 would recommend.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;quirk is a great little simulator of a quantum computer that you can play around with.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I wrote some blog posts on this subject a while back (if you don't mind reading my writing, which isn't very good) that can be found &lt;a href=&quot;https://medium.com/universe-factory/taking-into-account-quantum-encryption-part-1-db86d1f1665a&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; which attempts to start from the basics and work on up.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2018-06-20T23:00:13.370" LastActivityDate="2018-06-20T23:00:13.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2401" PostTypeId="2" ParentId="2399" CreationDate="2018-06-20T05:05:37.820" Score="8" Body="&lt;p&gt;I won't be giving any &lt;em&gt;precise&lt;/em&gt; statements about which problems can be solved more efficiently using quantum algorithms (compared to &lt;em&gt;existing&lt;/em&gt; classical algorithms) but rather &lt;em&gt;some examples&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Discrete Fourier transform&lt;/strong&gt; (DFT) is used in pretty much all modern day music systems, for example in iPods. That algorithm single-handedly changed the world of digital music. See &lt;a href=&quot;https://gizmodo.com/digital-music-couldnt-exist-without-the-fourier-transfo-1699155287&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; for a summary. However, &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Quantum Fourier transform&lt;/strong&gt;&lt;/a&gt; can further improve upon the complexity of DFT i.e. from $\mathcal{O}(N\log(N))$ to $\mathcal{O}(\log^2 N)$. I've written an answer regarding this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2002/26&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Quantum algorithm for linear systems of equations&lt;/strong&gt;&lt;/a&gt; provides an exponential speedup over the classical methods like Gaussian elimination. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The quantum algorithm for linear systems of equations, designed by&#xA;  Aram Harrow, Avinatan Hassidim, and Seth Lloyd is a quantum algorithm&#xA;  formulated in 2009 for solving linear systems. The algorithm estimates&#xA;  the result of a scalar measurement on the solution vector to a given&#xA;  linear system of equations.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The algorithm is one of the main fundamental algorithms expected to&#xA;  provide a speedup over their classical counterparts, along with Shor's&#xA;  factoring algorithm, Grover's search algorithm and quantum simulation.&#xA;  Provided the linear system is a sparse and has a low condition number&#xA;  ${\displaystyle \kappa }$ , and that the user is interested in&#xA;  the result of a scalar measurement on the solution vector, instead of&#xA;  the values of the solution vector itself, then the algorithm has a&#xA;  runtime of $O(\log(N)\kappa ^{2})$, where ${\displaystyle N}$ is the&#xA;  number of variables in the linear system. This offers an exponential&#xA;  speedup over the fastest classical algorithm, which runs in&#xA;  ${\displaystyle O(N\kappa )}$or $O(N{\sqrt {\kappa }})$ for positive&#xA;  semidefinite matrices).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations#Hamiltonian_simulation&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Hamiltonian simulation&lt;/strong&gt;&lt;/a&gt;: &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One of the earliest – and most important – applications of a quantum&#xA;  computer is likely to be the simulation of quantum mechanical systems.&#xA;  There are quantum systems for which no efficient classical simulation&#xA;  is known, but which we can simulate on a universal quantum computer.&#xA;  What does it mean to “simulate” a physical system? According to the&#xA;  OED, simulation is “the technique of imitating the behaviour of some&#xA;  situation or process (whether economic, military, mechanical, etc.) by&#xA;  means of a suitably analogous situation or apparatus”. What we will&#xA;  take simulation to mean here is approximating the dynamics of a&#xA;  physical system. Rather than tailoring our simulator to simulate only&#xA;  one type of physical system (which is sometimes called analogue&#xA;  simulation), we seek a general simulation algorithm which can simulate&#xA;  many different types of system (sometimes called digital simulation)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For the details, check chapter 7 of the &lt;a href=&quot;https://people.maths.bris.ac.uk/~csxam/teaching/qc2018/lecturenotes.pdf&quot; rel=&quot;noreferrer&quot;&gt;lecture notes&lt;/a&gt; by Ashley Montaro.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm#Hybrid_Quantum/Classical_Algorithms&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Hybrid Quantum/Classical Algorithms&lt;/strong&gt;&lt;/a&gt;:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Hybrid Quantum/Classical Algorithms combine quantum state preparation&#xA;  and measurement with classical optimization. These algorithms&#xA;  generally aim to determine the ground state eigenvector and eigenvalue&#xA;  of a Hermitian Operator.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;QAOA&lt;/strong&gt;:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The quantum approximate optimization&#xA;  algorithm&lt;sup&gt;[1]&lt;/sup&gt; is a toy model of quantum&#xA;  annealing which can be used to solve problems in graph theory. The&#xA;  algorithm makes use of classical optimization of quantum operations to&#xA;  maximize an objective function.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Variational Quantum Eigensolver&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The VQE algorithm applies classical optimization to minimize the&#xA;  energy expectation of an ansatz state to find the ground state energy&#xA;  of a molecule &lt;sup&gt;[2]&lt;/sup&gt;. This can also be extended to find&#xA;  excited energies of molecules.&lt;sup&gt;[3]&lt;/sup&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can find many more such examples on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; itself. Apart from those, there are lots of recent algorithms which can be used in machine learning and data science. This answer will get a bit too long if I add the details of all those. However, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_machine_learning&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_neural_network&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and the references therein.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;noreferrer&quot;&gt;A Quantum Approximate Optimization Algorithm&lt;/a&gt; Farhi &lt;em&gt;et al.&lt;/em&gt; (2014)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2]: &lt;a href=&quot;https://arxiv.org/abs/1304.3061&quot; rel=&quot;noreferrer&quot;&gt;A variational eigenvalue solver on a quantum processor&lt;/a&gt;  Peruzzo &lt;em&gt;et al.&lt;/em&gt; (2013)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3]: &lt;a href=&quot;https://arxiv.org/abs/1805.08138&quot; rel=&quot;noreferrer&quot;&gt;Variational Quantum Computation of Excited States&lt;/a&gt; Brierley &lt;em&gt;et al.&lt;/em&gt; (2018)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-20T05:38:58.257" LastActivityDate="2018-06-20T05:38:58.257" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2402" PostTypeId="1" AcceptedAnswerId="2404" CreationDate="2018-06-20T09:32:50.140" Score="11" ViewCount="4604" Body="&lt;p&gt;I want to know what time complexity is considered efficient/inefficient for quantum computers. For this, I need to know how many operations a quantum computer can perform per second. Can anyone tell me how to calculate it and what factors it depends on (implementation details or number of qubits etc.)?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-07-03T18:23:50.960" LastActivityDate="2019-06-27T07:16:05.920" Title="How many operations can a quantum computer perform per second?" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;&lt;complexity-theory&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2403" PostTypeId="1" CreationDate="2018-06-20T09:50:18.070" Score="7" ViewCount="648" Body="&lt;p&gt;The governments, big companies (&lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;list of quantum processors&lt;/a&gt;) and smaller ones are in the competition of building bigger and bigger quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not unexpectedly the number of qubits of those quantum computers seem to double every year but those qubits are &lt;em&gt;noisy qubits&lt;/em&gt;.  What is a more meaningful metric is the number of error corrected qubits and some sources say that we need 100 noisy qubits to simulate one error corrected qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides the error corrected qubits there are other substantial hurdles that need to be passed to come to a universal quantum computer that can do something useful (see &lt;a href=&quot;http://algassert.com/post/1800&quot; rel=&quot;nofollow noreferrer&quot;&gt;Why Will Quantum Computers be Slow?&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read quotes like (source &lt;a href=&quot;https://www.wired.com/story/google-alibaba-spar-over-timeline-for-quantum-supremacy/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GOOGLE, ALIBABA SPAR OVER TIMELINE FOR 'QUANTUM SUPREMACY&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Intel CTO Mike Mayberry told WIRED this week that he sees broad&#xA;  commercialization of the technology as a 10-year project. &lt;a href=&quot;https://www.nextbigfuture.com/2018/03/in-five-years-quantum-computing-will-be-mainstream.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM has said&#xA;  it can be “mainstream” in five&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So when might we actually expect the first universal quantum computer that can do something useful outside the academic world ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;em&gt;useful&lt;/em&gt; I mean that brings real value (e.g. commercial application) and that cannot be done with same efficiency using existing classical computing algorithms/models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have deliberately mentioned &lt;em&gt;outside the academic world&lt;/em&gt; as obviously currently pure by their existence the current quantum computers are useful for the theoretical computer scientist, quantum physicist, quantum specialist, ...  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What currently interests me more is the usefulness of the outcome of this quantum algorithm for real world problems (e.g. cracking an actual key, designing a new molecule with specific characteristics, finding the optimal solution of an actual problem, recognizing real images, ....)&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-20T11:31:27.560" LastActivityDate="2018-06-21T22:09:26.377" Title="When can we expect the first (universal) quantum computer being able to do something useful outside the academic world?" Tags="&lt;physical-realization&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ClosedDate="2018-06-22T11:01:37.440" ContentLicense="CC BY-SA 4.0" />
  <row Id="2404" PostTypeId="2" ParentId="2402" CreationDate="2018-06-20T10:00:34.323" Score="18" Body="&lt;p&gt;Giving an estimate for a generic quantum chip is impossible as there is no standard implementation for the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, it is possible to estimate this number for specific quantum chip, with the information provided online. I found information on the IBM Q chips, so here is the answer for the &lt;a href=&quot;https://github.com/QISKit/qiskit-backend-information/tree/master/backends/tenerife/V1&quot; rel=&quot;noreferrer&quot;&gt;IBM Q 5 Tenerife chip&lt;/a&gt;. In the link you will find information on the chip, but nothing about timings. You need to access the &lt;a href=&quot;https://github.com/QISKit/qiskit-backend-information/blob/master/backends/tenerife/V1/version_log.md&quot; rel=&quot;noreferrer&quot;&gt;version log&lt;/a&gt; of the chip (via a link given on the &lt;a href=&quot;https://github.com/QISKit/qiskit-backend-information/tree/master/backends/tenerife/V1&quot; rel=&quot;noreferrer&quot;&gt;IBM Q 5 Tenerife chips&lt;/a&gt; page). In this version log, go to a &quot;Gate Specification&quot; section, you will have the following information (more explanation below):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A time for &quot;GD&quot;, which is 60ns in the link above.&lt;/li&gt;&#xA;&lt;li&gt;Multiple times for &quot;GF&quot; (let's take 200ns for the computations below).&lt;/li&gt;&#xA;&lt;li&gt;A &quot;buffer time&quot;, which is 10ns in the link above.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But what do &quot;GD&quot;, &quot;GF&quot; or &quot;buffer time&quot; represent? They are base &lt;strong&gt;physical&lt;/strong&gt; operations, i.e. the operations that will be performed on the physical qubit. These physical operation are then used to implement some base quantum gates. You can find the decomposition of the 4 base quantum gates of the IBM Q backends in terms of these physical operations on the &lt;a href=&quot;https://github.com/QISKit/qiskit-backend-information/tree/master/backends/tenerife/V1&quot; rel=&quot;noreferrer&quot;&gt;IBM Q 5 Tenerife chips&lt;/a&gt; page. I copied the illustration below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UMN6b.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UMN6b.png&quot; alt=&quot;Base operation decomposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along with &quot;GD&quot; and &quot;GF&quot;, there is a physical &quot;FC&quot; operation that does not appears in the timings. This is because this &quot;FC&quot; operation just &quot;changes the frame of the following pulses&quot; (citing Jay Gambeta from a conversation on the QISKit Slack), and so the &quot;FC&quot; operation has a cost (time of application) of 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;buffer time&quot; is just a pause time between each physical operation application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So finally we can compute the time needed to apply each base gate on this specific backend:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;U1&lt;/strong&gt;: 0ns&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;U2&lt;/strong&gt;: 70ns = 0ns + 60ns + 10ns (buffer) + 0ns &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;U3&lt;/strong&gt;: 140ns = 0ns + 60ns + 10ns (buffer) + 0ns + 60ns + 10ns (buffer) + 0ns&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CX&lt;/strong&gt;: 560ns = 0ns + 60ns + 10ns (buffer) + 200ns + 10ns (buffer) + 60ns + 10ns (buffer) + 200ns + 10ns (buffer)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;From these timings, you can deduce the number of operations per second that the ibmqx4 backend can perform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking 200ns per operation as a crude approximation of the mean timing for an operation, you end up with 5 000 000 operations per seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the data for other backends on the &lt;a href=&quot;https://github.com/QISKit/qiskit-backend-information&quot; rel=&quot;noreferrer&quot;&gt;qiskit-backend-information GitHub repository&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-06-27T07:16:05.920" LastActivityDate="2019-06-27T07:16:05.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2405" PostTypeId="2" ParentId="2402" CreationDate="2018-06-20T10:02:43.513" Score="11" Body="&lt;p&gt;There is an important difference between &lt;em&gt;physical&lt;/em&gt; operations and &lt;em&gt;logical&lt;/em&gt; operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Physical operations that will be slightly imperfect, performed on qubits that are also imperfect. The rate at which these can be performed depends on what physical system is being used to realize the qubits. For example, superconducting qubits can perform two qubit gates (the slowest ones) in a time on the order of 100 ns (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2402/how-many-operations-can-a-quantum-computer-perform-per-second/2404#2404&quot;&gt;Nelimee's answer&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By combining many physical qubits, and doing a process with lots of physical operations, we can build &lt;em&gt;logical qubits&lt;/em&gt;. By doing error correction, these qubits and the operations done upon them can be made arbitrarily accurate. These are the kind of operations that are required to implement quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are currently too many unknowns to give you a clock rate of logical operations. Especially since even proof-of-principle logical qubits have not yet been built (not with quantum error correction codes, at least). It depends on how imperfect the physical qubits and operations are, and so how much we need to do to clean everything up. It depends on what kind of error correcting code we use, which in turn depends on the instruction set of our quantum processors (i.e., which pairs of qubits can have a two qubit gate applied on them directly). And this depends on how much noise we are willing to have, because better architectures often come at the cost of noise. So there are a lot of interdependencies, and much to be resolved.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-06-20T10:08:19.067" LastActivityDate="2018-06-20T10:08:19.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2406" PostTypeId="1" AcceptedAnswerId="2421" CreationDate="2018-06-20T11:30:53.763" Score="7" ViewCount="323" Body="&lt;p&gt;For a Hilbert space $\mathcal{H}_A$, I have seen the phrase &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;density matrices acting on $\mathcal{H}_A$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;multiple times, e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel#Schr%C3%B6dinger_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear to me that if $\mathcal{H}_A$ has finite Hilbert dimension $n$, then this makes sense mathematically, because a density matrix $\rho$ can be written as $\rho \in \mathbb{C}^{n \times n}$ and elements $\phi$ of $\mathcal{H}_A$ can be written as $\phi \in \mathbb{C}^n$, so I can write down $\rho \phi \in \mathbb{C}^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is unclear what this means? The density matrix $\rho$ describes a (possibly mixed) state of a quantum system. But I can also interpret $\phi$ as a single state vector, describing a quantum system in a pure state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what does $\rho\phi$ refer to (where $\rho \in \mathbb{C}^{n \times n}$ is a density matrix, and $\phi \in \mathbb{C}^n$ is an element of $\mathcal{H}_A$)? Can I interpret it? How can a density matrix (i.e., the representation of a state) act on states (on single state vectors)? &lt;strong&gt;Why do we interpret density matrices (which represent states) as operators?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2444" LastEditorUserId="55" LastEditDate="2019-10-31T19:27:05.520" LastActivityDate="2019-10-31T19:27:05.520" Title="What does it mean for a density matrix to &quot;act on a Hilbert space $\mathcal{H}&quot;$?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2407" PostTypeId="1" AcceptedAnswerId="2426" CreationDate="2018-06-20T15:14:25.017" Score="9" ViewCount="330" Body="&lt;p&gt;Theorem 2 of [1] states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose $C$ is an additive self-orthogonal sub-code of $\textrm{GF}(4)^n$, containing $2^{n-k}$ vectors, such that there are no vectors of weight $&amp;lt;d$ in $C^\perp/C$. Then any eigenspace of $\phi^{-1}(C)$ is an additive quantum-error-correcting code with parameters $[[n, k, d]]$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;where here $\phi: \mathbb{Z}_2^{2n} \rightarrow \textrm{GF}(4)^n$ is the map between the binary representation of $n$-fold Pauli operators and their associated codeword, and $C$ is &lt;em&gt;self-orthogonal&lt;/em&gt; if $C \subseteq C^\perp$ where $C^\perp$ is the dual of $C$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tells us that each additive self-orthogonal $\textrm{GF}(4)^n$ classical code represents a $[[n, k, d]]$ quantum code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is whether the reverse is also true, that is: &lt;strong&gt;is every $[[n, k, d]]$ quantum code represented by an additive self-orthogonal $\textrm{GF}(4)^n$ classical code?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or equivalently: &lt;strong&gt;Are there any $[[n, k, d]]$ quantum codes that are not represented by an additive self-orthogonal $\textrm{GF}(4)^n$ classical code?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: Calderbank, A. Robert, et al. &quot;Quantum error correction via codes over GF (4).&quot; IEEE Transactions on Information Theory 44.4 (1998): 1369-1387.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-06-21T12:21:19.770" LastActivityDate="2019-09-21T18:06:03.733" Title="Are all $[[n, k, d]]$ quantum codes equivalent to additive self-orthogonal $GF(4)^n$ classical codes?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2408" PostTypeId="1" AcceptedAnswerId="2409" CreationDate="2018-06-20T23:08:14.950" Score="5" ViewCount="579" Body="&lt;p&gt;Reproduced from Exercise 2.1 of Nielsen &amp;amp; Chuang's &lt;em&gt;Quantum Computation and Quantum Information (10th Anniversary Edition)&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Show that &lt;span class=&quot;math-container&quot;&gt;$(1, −1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(1, 2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2, 1)$&lt;/span&gt; are linearly dependent.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="26" LastEditDate="2019-03-30T07:58:43.327" LastActivityDate="2019-03-30T07:58:43.327" Title="Nielsen &amp; Chuang Exercise 2.1 - &quot;Linear dependence: example&quot;" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2019-01-07T15:14:52.850" ContentLicense="CC BY-SA 4.0" />
  <row Id="2409" PostTypeId="2" ParentId="2408" CreationDate="2018-06-20T23:08:14.950" Score="5" Body="&lt;p&gt;A set of $n$ vectors $V = \{\vec{v}_1, \ldots, \vec{v}_n\}$ are linearly dependant if there exists a set of scalars $a_1, \ldots, a_n$ (which are not all zero) such that&#xA;$$&#xA;\sum_{i=1}^n a_i\vec{v_i} = \vec{0}&#xA;$$&#xA;where $\vec{0}$ is the all-zero vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing $V$ as a matrix with vectors as columns, this is equivalent to finding a solution to the matrix equation&#xA;$$&#xA;V\vec{a} = \vec{0}, \quad\textrm{where}\quad \vec{a} = \begin{pmatrix} a_1\\ \vdots \\ a_n \end{pmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case, we have&#xA;$$&#xA;V = \begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 2 \\&#xA;-1 &amp;amp; 2 &amp;amp; 1&#xA;\end{pmatrix},&#xA;$$&#xA;with a solution to $V\vec{a} = \vec{0}$ provided by &#xA;$$&#xA;\vec{a} = \begin{pmatrix} 1\\ 1 \\ -1 \end{pmatrix},&#xA;$$&#xA;hence showing linear dependance.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-20T23:08:14.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2410" PostTypeId="1" AcceptedAnswerId="2412" CreationDate="2018-06-21T02:59:10.223" Score="4" ViewCount="82" Body="&lt;p&gt;I have seen qubits, qutrits &amp;amp; entangled bits (e-bits) a decent amount. I have also seen qunits/qudits for n-th level qubits. What I am trying to wrap my head around is the differences between n-th level e-bits vs n-th level qunits. What are the similarities? Differences? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What generalizations exist about n-th level e-bits / qunits?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="55" LastEditDate="2019-12-13T13:24:33.650" LastActivityDate="2019-12-13T13:24:33.650" Title="What are the differences between &quot;$n$-th level e-bits&quot; and &quot;$n$-th level qunits&quot;?" Tags="&lt;entanglement&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2411" PostTypeId="2" ParentId="2406" CreationDate="2018-06-21T03:18:45.127" Score="0" Body="&lt;p&gt;By &quot;acting of $\mathcal{H}_A$&quot; I believe you mean &quot;acting on $\mathcal{H}_A$&quot;, which is what is written in the section you provided a link to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it means is &quot;acting on a state in $\mathcal{H}_A$&quot;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;I do not know what it means for a state to act on $\phi$.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You defined $\phi$ as a state. States do not act on states. Operators (such as $\rho$) act on states. The section you provided a link to, does not mention &quot;acting on a state $\phi$&quot; at any point.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-21T03:18:45.127" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2412" PostTypeId="2" ParentId="2410" CreationDate="2018-06-21T07:00:10.563" Score="2" Body="&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: Since you haven't stated the source from where you got those terms, I will mention the most &lt;em&gt;obvious&lt;/em&gt; definitions for those, which occur &lt;em&gt;to me&lt;/em&gt; - simply looking at the names.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;strong&gt;Qunit&lt;/strong&gt;&quot; refers to any quantum system whose state lies in a complex &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;vector space&lt;/a&gt; whose &lt;a href=&quot;https://en.wikipedia.org/wiki/Dimension_(vector_space)&quot; rel=&quot;nofollow noreferrer&quot;&gt;dimension&lt;/a&gt; is &lt;em&gt;any&lt;/em&gt; natural number $n$. Example of qunits are qubits, for which $n=2$ and qutrits for which $n=3$. Also check this for other less commonly used terms: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2100/do-any-specific-types-of-qudits-other-than-qubits-and-qutrits-have-a-name/2102&quot;&gt;Do any specific types of qudits other than qubits and qutrits have a name?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, remember that a system of two qu&lt;strong&gt;bits&lt;/strong&gt; will lie in a $2\times 2$-dimensional vector space i.e. $\Bbb C^2\times \Bbb C^2$. A system of three qubits will lie in a $2\times 2 \times 2$-dimensional vector space $\Bbb C^2\times \Bbb C^2\times \Bbb C^2$ and so on. By &quot;$n$-dimensional&quot; e-&lt;strong&gt;bits&lt;/strong&gt; they're referring to the dimension of the vector space again. As for the &quot;e-&lt;strong&gt;bit&lt;/strong&gt;&quot; part, that's simple. That is, the state of the system of qubits is basically not separable into individual qubit states lying in $\Bbb C^2$ each (i.e. the qubits are &lt;em&gt;entangled&lt;/em&gt;). Check out the answers in: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2263/how-do-i-show-that-a-two-qubit-state-is-an-entangled-state&quot;&gt;How do I show that a two-qubit state is an entangled state?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-06-21T07:00:10.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2413" PostTypeId="1" AcceptedAnswerId="2418" CreationDate="2018-06-21T08:03:09.517" Score="8" ViewCount="842" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2263/&quot;&gt;&quot;How do I show that a two-qubit state is an entangled state?&quot;&lt;/a&gt; includes &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2266/2645&quot;&gt;an answer&lt;/a&gt; which references the &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peres–Horodecki criterion&lt;/a&gt;. This works for $2\times 2$ and $2\times3$ dimensional cases; however, in higher dimensions, it is &quot;inconclusive.&quot; It is suggested to supplement with more advanced tests, such as those based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Entanglement_witness&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement witness&lt;/a&gt;. How would this be done? Are there alternative ways to go about this?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="15" LastEditDate="2018-06-21T12:02:02.683" LastActivityDate="2019-05-17T14:23:38.100" Title="How to show that an n-level system is entangled?" Tags="&lt;entanglement&gt;&lt;quantum-state&gt;&lt;qudit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2414" PostTypeId="1" CreationDate="2018-06-21T08:03:42.980" Score="20" ViewCount="520" Body="&lt;p&gt;It seems to be a widely held belief within the scientific community that it is possible to do &quot;universal, fault-tolerant&quot; quantum computation using optical means by following what is called  &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_optical_quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;linear optical quantum computing (LOQC)&lt;/a&gt;&quot; pioneered by KLM (Knill, Laflamme, Milburn). However, LOQC uses only modes of light that contain either zero or one photon, not more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuous modes of light contain, by definition, much more than one photon. The paper &lt;strong&gt;Probabilistic Fault-Tolerant Universal Quantum Computation and Sampling Problems in Continuous Variables&lt;/strong&gt; Douce &lt;em&gt;et al.&lt;/em&gt; (2018) &lt;a href=&quot;https://arxiv.org/abs/1806.06618&quot; rel=&quot;noreferrer&quot;&gt;[quant-ph arXiv:1806.06618v1]&lt;/a&gt; claims &quot;probabilistic universal fault-tolerant&quot; quantum computation can also be done using continuous modes of squeezed light. The paper goes even further and claims it is possible to demonstrate quantum supremacy using continuous modes.  In fact, the paper's abstract says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Furthermore, we show that this model can be adapted to yield sampling&#xA;  problems that cannot be simulated efficiently with a classical&#xA;  computer, unless the polynomial hierarchy collapses.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A quantum computing startup called &lt;a href=&quot;https://www.xanadu.ai/&quot; rel=&quot;noreferrer&quot;&gt;Xanadu&lt;/a&gt; that has some credibility because it has written several papers with Seth Lloyd, seems to be claiming that they too will ultimately be able to do quantum computation with continuous modes of light, and perform some tasks better than a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yet, what they are doing seems to me to be analog computing (is fault tolerant error correction possible for analog computing?). Also, they use squeezing and displacement operations. Such operations do not conserve energy (squeezing or displacing a mode can change its energy), so such operations seem to require exchanges of macroscopic amounts (not quantized amounts) of energy with an external environment, which probably can introduce a lot of noise into the qc. Furthermore, squeezing has only been achieved in the lab for limited small values, and a claim of universality might require arbitrary large squeezing as a resource.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question is, are these people being too optimistic or not? What kind of computing can be done realistically in the lab with continuous modes of light?&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="419" LastEditDate="2018-08-06T08:04:34.010" LastActivityDate="2018-08-06T08:04:34.010" Title="Is &quot;probabilitistic,universal, fault tolerant quantum computation&quot; possible with continuous values?" Tags="&lt;experiment&gt;&lt;optical-quantum-computing&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2415" PostTypeId="1" AcceptedAnswerId="2417" CreationDate="2018-06-21T08:15:44.593" Score="3" ViewCount="913" Body="&lt;p&gt;What is the difference between 3 qubits, 2 qutrits and a 6th level qunit? Are they equivalent? Why / why not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can 6 classical bits be super-densely coded into each?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-07-02T15:22:29.377" LastActivityDate="2018-07-02T15:22:29.377" Title="Difference between 3 qubits, 2 qutrits &amp; 1 six level qunit" Tags="&lt;entanglement&gt;&lt;qudit&gt;&lt;qutrit&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2416" PostTypeId="2" ParentId="2415" CreationDate="2018-06-21T08:38:13.027" Score="2" Body="&lt;p&gt;They are not equivalent. It can be seen by the fact that the system of $3$ qubits acts on a $8$ dimensional Hilbert space, the 2 qutrit system acts on a $9$ dimensional Hilbert space, and the 6 level qunit acts on a $6$ dimensional Hilbert space. Consequently, the nature of the states defined by each of the quantum systems is different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This dimension argument comes from the fact that a k-level n-qunit system acts on a state space of dimension $k^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the superdense-coding, I am aware that Bell pairs are used in order to obtain the desired coding, and as you do not consider such entangled qubits, I am not sure to answer such question.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-06-21T09:08:22.523" LastActivityDate="2018-06-21T09:08:22.523" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2417" PostTypeId="2" ParentId="2415" CreationDate="2018-06-21T09:15:59.690" Score="7" Body="&lt;p&gt;The Hilbert space dimension of $n$ qudits is $d^n$, where $d$ is the dimension of the qudit ($d=2$ for qubit, $d=3$ for qutrit, etc). So three qubits have an $8$ dimensional space, two qutrits have a $9$ dimensional space, and one $d=6$ qudit has a six dimensional space. As such, we cannot regard them as equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess you meant to compare situations with equal total Hilbert space dimension. Such as a comparing a pair of qubits with a $d=4$ system. In this case, there is mathematically no distinction. You could choose to relabel the basis states $|00\rangle$, $|01\rangle$, $|10\rangle$ and $|11\rangle$ as the qudit basis states $|0\rangle$, $|1\rangle$, $|2\rangle$ and $|3\rangle$. Then any qudit operations defined with the qudit basis could be equivalently defined with the qubits, and vice-versa. You could also use other mappings between basis states, this was just an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could also use a subspace of a larger space to simulate a smaller one. For example, suppose you want to simulate a spin-$1$ particle, which is a 3 level system. You could do this using a pair of qubits (a four level system) and identifying three basis states of the former with three of the latter (such as $|-1\rangle$, $|0\rangle$ and $|1\rangle$ with $|00\rangle$, $|01\rangle$ and $|10\rangle$, for example). As long as you implement your spin-$1$ operations correctly, you'll always avoid the $|11\rangle$ state, and your two qubits effectively become a qutrit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also be interested in my answer to the question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1602/what-is-the-most-economical-and-preferred-basis-for-the-qudit/1673#1673&quot;&gt;What is the most economical and preferred basis for the qudit?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-06-21T10:01:49.117" LastActivityDate="2018-06-21T10:01:49.117" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2418" PostTypeId="2" ParentId="2413" CreationDate="2018-06-21T09:33:30.957" Score="7" Body="&lt;p&gt;Determining whether a given state is entangled or not is NP hard. So if you include all possible types on entanglement, including mixed states and multipartite entanglement, there is never going to be an elegant solution. Techniques are therefore defined for specific cases, where the structure of the problem can be used to create an efficient solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if a state is bipartite and pure, you can simply take the reduced density matrix of one party and see if it is mixed. This could be done by computing the Von Neumann entropy to see if it is non-zero (this quantity provides a measure of entanglement in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach would work for any pure state of two particles, whatever their dimension. It can also be used to calculate entanglement for any bipartition. For example, if you had $n$ particles, you could take the first $m$ to be one party, and the remaining $n-m$ to be another, and use this technique to see if any entanglement exists between these groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other cases, the approach you take will depend on the kind of entanglement you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-21T09:33:30.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2419" PostTypeId="2" ParentId="2413" CreationDate="2018-06-21T09:37:03.623" Score="5" Body="&lt;p&gt;As suggested in your Wiki link, the way to  detect an entangled state is to find a hyperplane that separates it from the convex set of separable states. This hyperplane represents  what is called an entanglement witness. The PPT criterion that you mentioned is one such witness. Now to construct  entanglement witnesses for higher dimensional systems is not easy, but it can be done algorithmically by solving a hierarchy semi-definite programs (SDP)&lt;sup&gt;[1]&lt;/sup&gt;. This hierarchy is complete, as every entangled state will eventually be detected. But it is computationally inefficient if the entangled state is very close to the convex set of separable states. It is infact known that detecting entanglement is NP-hard&lt;sup&gt;[2]&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Doherty, Andrew C., Pablo A. Parrilo, and Federico M. Spedalieri. &quot;Complete family of separability criteria.&quot; Physical Review A69.2 (2004): 022308&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Gharibian, Sevag. &quot;Strong NP-hardness of the quantum separability problem.&quot; arXiv preprint arXiv:0810.4507 (2008).&lt;/p&gt;&#xA;" OwnerUserId="2663" LastEditorUserId="26" LastEditDate="2019-05-17T14:23:38.100" LastActivityDate="2019-05-17T14:23:38.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2420" PostTypeId="1" AcceptedAnswerId="2433" CreationDate="2018-06-21T09:58:57.613" Score="4" ViewCount="155" Body="&lt;p&gt;&lt;a href=&quot;https://www.wired.com/story/quantum-internet-is-13-years-away-wait-whats-quantum-internet&quot; rel=&quot;nofollow noreferrer&quot;&gt;This article&lt;/a&gt; from 2017 predicts the quantum internet by 2030. What are the biggest bottlenecks in the realization of a global quantum network (ie quantum internet)?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-06-21T18:19:52.887" LastActivityDate="2018-06-22T20:13:32.060" Title="How could a global quantum network be realized?" Tags="&lt;quantum-information&gt;&lt;quantum-networks&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2421" PostTypeId="2" ParentId="2406" CreationDate="2018-06-21T12:37:34.457" Score="10" Body="&lt;p&gt;It is common that one refers to a density matrix (or, equivalently, a density operator) $\rho$ as &lt;em&gt;acting on&lt;/em&gt; a particular space $\mathcal{H}$. This serves to establish the &quot;type&quot; of $\rho$ in computer science parlance. In particular, when there are multiple spaces under consideration, it may be helpful for a reader to know that $\rho$ corresponds specifically to whatever abstract physical system is described by the space $\mathcal{H}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Referring to $\rho$ as acting on a space $\mathcal{H}$ also makes perfect sense, as the question points out, because $\rho$ can be viewed as a linear map from $\mathcal{H}$ to itself. The properties of $\rho$ that relate to its action as a linear mapping of this form are important and say a lot about the state. For example, the eigenvalues of $\rho$ describe the randomness or uncertainty inherent to that state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this does not mean that if $\phi\in\mathcal{H}$ is a unit vector that describes a pure state, then $\rho\phi$ should have an interpretation. Such a vector might show up in a proof or calculation -- for example, the quantity $\langle \phi | \rho | \phi\rangle$, which is the inner product between $\phi$ and $\rho\phi$, is a commonly encountered quantity known as the &lt;em&gt;fidelity&lt;/em&gt; (or &lt;em&gt;squared fidelity&lt;/em&gt;) between the states represented by $\rho$ and $\phi$ -- but in my view the vector $\rho\phi$ is just a vector and does not have a natural or fundamental physical interpretation.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-06-21T12:37:34.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2422" PostTypeId="2" ParentId="2381" CreationDate="2018-06-21T12:59:23.247" Score="2" Body="&lt;p&gt;All we observe in quantum technologies (photons, atoms, etc) are bits (either a 0 or a 1). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the essence, no one really knows what a quantum bit is.  Some people say it's an object that is &quot;both&quot; 0 and 1; others say it's about things to do with parallel universes; but physicists don't know what it is, and have come up with interpretations that are not proven.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this &quot;confusion&quot; is due to two factors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) One can get remarkable tasks accomplished which cannot be explained by thinking of the quantum technology in terms of normal bits.  So there must be some extra element involved which we label &quot;quantum&quot; bit.  But here's the critical piece: this extra &quot;quantum&quot; element cannot be directly detected; all we observe are normal bits when we &quot;look&quot; at the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) One way to &quot;see&quot; this extra &quot;quantum&quot; stuff is through maths.  Hence a valid description of a qubit is mathematical, and every translation of that is an interpretation that has not yet been proven.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, no one knows what quantum bits are.  We know there's something more than bits in quantum technologies, which we label as &quot;quantum&quot; bit. And so far, the only valid (yet unsatisfying) description is mathematical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.  &lt;/p&gt;&#xA;" OwnerUserId="2084" LastActivityDate="2018-06-21T12:59:23.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2423" PostTypeId="1" AcceptedAnswerId="2424" CreationDate="2018-06-21T13:16:32.857" Score="3" ViewCount="979" Body="&lt;p&gt;Reproduced from Exercise 2.2 of Nielsen &amp;amp; Chuang's &lt;em&gt;Quantum Computation and Quantum Information (10th Anniversary Edition)&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is a vector space with basis vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a linear operator from &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$A|0\rangle = |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A|1\rangle = |0\rangle$&lt;/span&gt;. Give a matrix representation for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, with respect to the input basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt;, and the output basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt;. Find input and output bases which give rise to a different matrix representation of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="26" LastEditDate="2019-03-30T07:59:17.177" LastActivityDate="2019-03-30T07:59:17.177" Title="Nielsen &amp; Chuang Exercise 2.2 - “Matrix representations: example”" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ClosedDate="2019-01-07T15:14:10.337" ContentLicense="CC BY-SA 4.0" />
  <row Id="2424" PostTypeId="2" ParentId="2423" CreationDate="2018-06-21T13:16:32.857" Score="5" Body="&lt;p&gt;Immediately, we can see that&#xA;$$&#xA;A = |1\rangle\langle0| + |0\rangle\langle1|.&#xA;$$&#xA;If the input and out bases are $\{|0\rangle, |1\rangle\}$, then&#xA;$$&#xA;|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \quad\textrm{and}\quad \langle0| = \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix}, \quad \langle1| = \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix},&#xA;$$&#xA;so we can write the first equation as&#xA;$$&#xA;\begin{align}&#xA;A &amp;amp;= \begin{pmatrix} 1 \\ 0 \end{pmatrix} \otimes \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix}  + \begin{pmatrix} 0 \\ 1 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{pmatrix} + \begin{pmatrix} 0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{pmatrix}\\&#xA;&amp;amp;= \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}&#xA;\end{align}&#xA;$$&#xA;to solve the first question. Note that in this case, $A$ is the equal to the &lt;em&gt;bitflip&lt;/em&gt; or &lt;em&gt;Pauli $X$&lt;/em&gt; operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, for fun, let us choose to write $A$ in input basis $\{|+\rangle, |-\rangle\}$, where&#xA;$$&#xA;|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \quad\textrm{and}\quad |-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)&#xA;$$&#xA;and output basis $\{|L\rangle, |R\rangle\}$, where&#xA;$$&#xA;|L\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle) \quad\textrm{and}\quad |R\rangle = \frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle).&#xA;$$&#xA;Rewriting our original $\{|0\rangle, |1\rangle\}$ bases vectors in terms of the above bases, we find&#xA;$$&#xA;\begin{align}&#xA;|0\rangle &amp;amp;= \frac{1}{\sqrt{2}}(|+\rangle + |-\rangle) = \frac{1}{\sqrt{2}}(|L\rangle + |R\rangle) \quad \textrm{and}\\&#xA;|1\rangle &amp;amp;= \frac{1}{\sqrt{2}}(|+\rangle - |-\rangle) = \frac{i}{\sqrt{2}}(|R\rangle - |L\rangle),&#xA;\end{align}&#xA;$$&#xA;with $\langle0| = (|0\rangle)^\dagger$ and $\langle1| = (|1\rangle)^\dagger$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this we can rewrite $A$ as&#xA;$$&#xA;\begin{align}&#xA;A &amp;amp;= \frac{i}{2}(|R\rangle - |L\rangle)(\langle+| + \langle-|) + \frac{1}{2}(|L\rangle + |R\rangle)(\langle+| - \langle-|) \\&#xA;&amp;amp;= \frac{1}{2}\big[ (1+i)|R\rangle\langle+| + (1-i)|L\rangle\langle+| + (-1+i)|R\rangle\langle-| + (-1-i)|L\rangle\langle-|\big] \\&#xA;&amp;amp;= \frac{1+i}{2}(|R\rangle\langle+| - i|L\rangle\langle+| + i|R\rangle\langle-| - |L\rangle\langle-|)&#xA;\end{align}&#xA;$$&#xA;To get $A$ in the desired matrix form, we then set&#xA;$$&#xA;|L\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad |R\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \quad\textrm{and}\quad \langle+| = \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix}, \quad \langle-| = \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix},&#xA;$$&#xA;such that&#xA;$$&#xA;A = \frac{1+i}{2} \begin{pmatrix} -i &amp;amp; -1 \\ 1 &amp;amp; i \end{pmatrix}.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-21T13:16:32.857" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2425" PostTypeId="1" CreationDate="2018-06-21T13:46:38.737" Score="6" ViewCount="188" Body="&lt;p&gt;In Ref. [1] absolutely maximally entangled (AME) states are defined as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An $\textrm{AME}(n,d)$ state (absolutely maximally entangled state) of $n$ qudits of dimension $d$, $|\psi\rangle \in \mathbb{C}^{\otimes n}_d$, is a pure state for which every bipartition of the system into the sets $B$ and $A$,&#xA;  with $m = |B| \leq |A| = n − m$, is strictly maximally entangled such that &#xA;  $$&#xA;S(\rho_B) = m \log_2 d.&#xA;$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As the name would have you believe, &lt;strong&gt;does this mean that an $\textrm{AME}(n,d)$ state is maximally entangled across &lt;em&gt;all&lt;/em&gt; entanglement monotones (for fixed $n$ and $d$)&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: Helwig, Wolfram, et al. &lt;em&gt;&quot;Absolute maximal entanglement and quantum secret sharing.&quot;&lt;/em&gt; Physical Review A 86.5 (2012): 052335.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-25T15:38:18.587" Title="Are Absolutely Maximally Entangled states maximally entangled under all entanglement monotones?" Tags="&lt;entanglement&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2426" PostTypeId="2" ParentId="2407" CreationDate="2018-06-21T13:51:10.233" Score="2" Body="&lt;p&gt;The additive self-orthogonal constraint on the classical codes in order to create stabilizer quantum codes is needed due to the fact that the stabilizer generators must commute between them in order to create a valid code space. When creating quantum codes from classical codes, the commutation relationship for the stabilizers is equivalent to having a self-orthogonal classical code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, quantum codes can be constructed from non-self-orthogonal classical codes over &lt;span class=&quot;math-container&quot;&gt;$GF(4)^n$&lt;/span&gt; by means of entanglement-assistance. In this constructions, an arbitrary classical code is selected, and by adding some Bell pairs in the qubit system, commutation between the stabilizers is obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This entanglement-assisted paradigm for constructing QECCs from any classical code is presented in &lt;a href=&quot;https://arxiv.org/abs/1610.04013&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1610.04013&lt;/a&gt;, which is based on the paper &quot;Correcting Quantum Errors with Entanglement&quot; published in Science by Brun, Devetak and Hsieh.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2019-05-13T21:21:56.320" LastActivityDate="2019-05-13T21:21:56.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2427" PostTypeId="1" CreationDate="2018-06-21T14:31:58.267" Score="5" ViewCount="121" Body="&lt;p&gt;Quantum networks or quantum internet are terms that can be found when reading about quantum computation and information nowadys, but still I they are pretty vague concepts that are still in development.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering about the fact that this networks or internet would be pretty limited in communications between several computers as sending redundant information to several of them would be prohibited because of the no-cloning theorem. That would mean that only point-to-point communications could be done in quantum network. Moreover, once sent the information cannot be sent again as no copies of it are remaining, and so the communication could be done just once or the state should be created again by doing the same computations as before each time we want to send it. This sounds pretty inefficient coparing to the classical networks and internet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right about this thought or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-12-13T19:55:34.800" LastActivityDate="2018-12-13T19:55:34.800" Title="Does the no-cloning theorem impose limits on the capabilities of quantum networks?" Tags="&lt;quantum-networks&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2428" PostTypeId="2" ParentId="2427" CreationDate="2018-06-21T15:11:18.693" Score="4" Body="&lt;p&gt;Setting aside the practical problems in actually building such things, quantum computers/networks can do everything their classical counterparts do without any fundamental overhead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your reasoning seems to stem from a misunderstanding of the no-cloning theorem.&#xA;The no-cloning theorem says that you cannot reversibly clone unknown states &lt;em&gt;with a protocol that does not depend on the state being cloned&lt;/em&gt; (see e.g. &lt;a href=&quot;https://physics.stackexchange.com/q/248563/58382&quot;&gt;this question&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has nothing to do with the communication context that you mention. If I want to send you some classical information, I would do it in basically the same way as it is done in a &quot;classical&quot; network. If I want to send you a quantum state, &lt;em&gt;and I know what that state is&lt;/em&gt;, again there are no problems in &quot;cloning&quot; that state (I can just generate the same state many times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have an &lt;em&gt;unknown&lt;/em&gt; state and I want to send you many copies of it, then yes, the no-cloning theorem prevents me from doing so. However, it is not clear why should I want to do this for communication purposes.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-06-21T17:18:22.343" LastActivityDate="2018-06-21T17:18:22.343" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2429" PostTypeId="2" ParentId="2403" CreationDate="2018-06-21T17:24:13.170" Score="0" Body="&lt;p&gt;&lt;strong&gt;2023&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Source IBM Research &lt;a href=&quot;https://www.research.ibm.com/5-in-5/quantum-computing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.research.ibm.com/5-in-5/quantum-computing/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... Within five years, the industry will have discovered the first&#xA;  applications where a quantum computer (used alongside a classical&#xA;  computer) will offer a benefit to solving specific problems. ...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;[2] point [3] in answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2430/2529&quot;&gt;2028&lt;/a&gt; also supports to some extent this period.&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-21T22:09:26.377" LastActivityDate="2018-06-21T22:09:26.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2430" PostTypeId="2" ParentId="2403" CreationDate="2018-06-21T17:43:27.973" Score="0" Body="&lt;p&gt;&lt;strong&gt;2028&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Source Scientific American : &lt;a href=&quot;https://www.scientificamerican.com/article/how-close-are-we-really-to-building-a-quantum-computer/&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Close Are We—Really—to Building a Quantum Computer?&lt;/a&gt;(Intel’s head of quantum computing talks about the challenges of developing algorithms, software programs and other necessities for a technology that doesn’t yet exist)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The race is on to build the world’s first meaningful quantum&#xA;  computer—one that can deliver the technology’s long-promised ability&#xA;  to help scientists do things like develop miraculous new materials,&#xA;  encrypt data with near-perfect security and accurately predict how&#xA;  Earth’s climate will change. Such a machine is likely more than a&#xA;  decade away, but IBM, Microsoft, Google, Intel and other tech&#xA;  heavyweights breathlessly tout each tiny, incremental step along the&#xA;  way.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and a bit further down the same article:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;People think quantum computers are just around the corner, but history&#xA;  shows these advances take time. If 10 years from now we have a quantum&#xA;  computer that has a few thousand qubits, that would certainly change&#xA;  the world in the same way the first microprocessor did. We and others&#xA;  have been saying it’s 10 years away. Some are saying it’s just three&#xA;  years away, and I would argue that they don’t have an understanding of&#xA;  how complex the technology is.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;[2] Source : &lt;a href=&quot;https://futurism.com/when-will-quantum-computers-be-consumer-products/&quot; rel=&quot;nofollow noreferrer&quot;&gt;When Will Quantum Computers Be Consumer Products?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Andrew Dzurak, Professor in Nanoelectronics at University of New South&#xA;  Wales,  ... “I think that within ten years, there will be&#xA;  demonstrations of modelling of certain chemicals and drugs that&#xA;  couldn’t be done today but I don’t think there will be a convenient,&#xA;  routine [system] that [people] can use,” Dzurak said in the interview.&#xA;  “To move to that stage will take another decade further beyond that.”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;[3] &lt;a href=&quot;https://www.informationweek.com/why-quantum-computing-should-be-on-your-radar-now/a/d-id/1331946&quot; rel=&quot;nofollow noreferrer&quot;&gt;Why Quantum Computing Should Be on Your Radar Now&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This report could also be interpreted that the first useful thing could happen earlier than 2028 (e.g. in 2023)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;What to expect, when&lt;/strong&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There's a lot of confusion about the current state of quantum&#xA;  computing which industry research firms Boston Consulting Group (BCG)&#xA;  and Forrester are attempting to clarify.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In the Forrester report, Hopkins estimates that quantum computing is&#xA;  in the early stages of commercialization, a stage that will persist&#xA;  through 2025 to 2030. The growth stage will begin at the end of that&#xA;  period and continue through the end of the forecast period which is&#xA;  2050.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;BCG also reasons that the quantum computing market will advance in&#xA;  three distinct phases:&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;The first generation will be specific to applications that are quantum&#xA;  in nature, similar to what D-Wave is doing. &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;The second generation will unlock what report co-author and BCG senior partner Massimo Russo&#xA;  calls &quot;more interesting use cases.&quot; &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;In the third generation, quantum&#xA;  computers will have achieved the number of logical qubits required to&#xA;  achieve Quantum Supremacy. (Note: Quantum Supremacy and logical qubits&#xA;  versus physical qubits are important concepts addressed below.)&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-21T22:00:57.503" LastActivityDate="2018-06-21T22:00:57.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2431" PostTypeId="2" ParentId="2403" CreationDate="2018-06-21T21:35:34.417" Score="0" Body="&lt;p&gt;&lt;strong&gt;2033 or later&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] source &lt;a href=&quot;http://algassert.com/post/1800&quot; rel=&quot;nofollow noreferrer&quot;&gt;Why will quantum computers be slow?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This site mentions the following bottlenecks:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bottleneck #0: Qubit count&lt;/li&gt;&#xA;&lt;li&gt;Bottleneck #1: T count&lt;/li&gt;&#xA;&lt;li&gt;Bottleneck #2: Measurement depth&lt;/li&gt;&#xA;&lt;li&gt;Bottleneck #3: Spacetime volume&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Regarding the first bottleneck it says the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the qubit count doubles every year, it'll be 17 years before we get to 100%.&#xA;  That 17 year gap is daunting. 50 to 100 noisy qubits should be enough&#xA;  to do something hard, and 100 to 200 logical qubits should be enough&#xA;  to do something useful, but at the moment it's not known if there's&#xA;  much in between. If there really is nothing on the decade-long road&#xA;  from 100 noisy qubits to 100 error-corrected qubits,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The summary of the blog:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&#xA;  To run a quantum computation really fast, you need:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;1 Enough qubits to fit the computation in the first place. &#xA;  2 Then enough T factories to perform T gates as fast as the computation needs them.&#xA;  3 Then wider circuits that do measurements in parallel instead of&#xA;  serially. &#xA;  4 Then efficient strategies for routing qubits and packing braiding operations.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I like to imagine that each bottleneck will be&#xA;  the &quot;most relevant&quot; for about a decade. We'll naturally transition&#xA;  from one to the next because, funnily enough, every single one of&#xA;  these bottlenecks falls to adding more qubits....&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;[2] The points mentioned in answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2430/2529&quot;&gt;2028&lt;/a&gt; mainly give an indication when they expect it might happen.  They are not excluding it can be several years later.&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-06-21T22:08:37.647" LastActivityDate="2018-06-21T22:08:37.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2432" PostTypeId="1" AcceptedAnswerId="2451" CreationDate="2018-06-22T15:34:38.563" Score="11" ViewCount="2669" Body="&lt;p&gt;$T_2$ generally refers to the measurement of the coherence of the qubit with respect to its dephasing (that's a rotation through the $|0\rangle$  - $|1\rangle$ axis of the Bloch sphere for those of us visualizing). But sometime in the literature, it's called $T_2$ and other times it's referred to as $T_2^*$. The fact that it is never explained leads me to believe the distinction is very simple. What's the distinction between these two concepts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assert that this nomenclature is very common in the literature (at least regarding solid-state QC). Here is one example: &lt;a href=&quot;https://www.nature.com/articles/nmat2420&quot; rel=&quot;noreferrer&quot;&gt;Ultralong spin coherence time in isotopically engineered diamond.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My internet search for an explanation has come up dry. Please help.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="26" LastEditDate="2018-06-23T13:43:21.830" LastActivityDate="2018-06-24T20:04:57.440" Title="What's the Difference between T2 and T2*?" Tags="&lt;decoherence&gt;&lt;solid-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2433" PostTypeId="2" ParentId="2420" CreationDate="2018-06-22T20:13:32.060" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;What are the biggest bottlenecks in the realization of a global &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_network&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum network&lt;/a&gt; (ie quantum internet)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It would seem only complexity, getting everything working together, with high reliability, for a long enough period of time. The &lt;a href=&quot;https://en.wikipedia.org/wiki/OSI_model#Description_of_OSI_layers&quot; rel=&quot;nofollow noreferrer&quot;&gt;OSI description of network layers&lt;/a&gt; describes 7 layers, quantum networks will likely end up with more but we can already implement the OSI conventional model thus proving the viability and existence of quantum networking.&lt;/p&gt;&#xA;&lt;p&gt;The article mentions some concerns, which are being successfully worked on:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Transmission via fiber optics instead of satellite&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1401.6958&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum teleportation from a telecom-wavelength photon to a solid-state quantum memory&lt;/a&gt;&amp;quot; (27 Jan 2014), by Felix Bussieres, Christoph Clausen, Alexey Tiranov, &amp;amp; 11 others.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.unige.ch/gap/quantum/news:20180418-1451-characterization_of_the_hyperfine_properties_for_quantum_memory_application&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum memories&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.unige.ch/gap/quantum/research:quantum_memories_and_repeaters&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum repeaters&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Not mentioned in the article is the first level, the symbol layer, converting the qubit's state to something that can be transmitted and restored on the other end: the &lt;a href=&quot;http://www.iqst.org/research/focus-areas/light-matter-interface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;light-matter interface&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Complexity and cost won't be a problem for the first users, the delay (2030) would be due to commercialization and popularity for a sufficiently large group. The local network is operating today (&lt;a href=&quot;https://www.nature.com/articles/d41586-018-01835-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;scheduled opening 2020&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="278" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-06-22T20:13:32.060" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2434" PostTypeId="2" ParentId="2432" CreationDate="2018-06-23T09:29:04.747" Score="2" Body="&lt;p&gt;From Chapter 15 of NII's quantum information lecture series on &quot;Fundamentals of Noise processes&quot; (link &lt;a href=&quot;https://www.nii.ac.jp/qis/first-quantum/e/forStudents/lecture/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An applied DC field $H_0$ is not completely uniform in all space points. If many spin qubits are placed in such an inhomogeneous DC field, they have different Larmor frequencies. This leads to the dephasing effect if we compare the phase difference between different qubits. A time constant for this dephasing process is determined by the spatial (not temporal) inhomogeneous broadening of the DC field and distinguished from $T_2$ process. A new time constant is often referred to as $T_2^*$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, if I am understanding this correctly (and I am not an expert in this), then $T_2^*$ is the combined dephasing from the standard dephasing mechanism (described by $T_2$) and any inhomogeneities in the DC field. Presumably, the reason it is often not distinguished from $T_2$ in papers is that it is assumed that such inhomogeneities always exist and so $T^*_2$ is almost always the value being measured and the most relevant in practise.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-23T09:29:04.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2436" PostTypeId="5" CreationDate="2018-06-23T21:51:45.883" Score="0" Body="&lt;p&gt;The textbook &lt;a href=&quot;http://admin.cambridge.org/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computation and Quantum Information&lt;/a&gt; by Michael A. Nielsen and Isaac L. Chuang (referred to as 'Nielsen and Chuang' or more informally as 'Mike and Ike') was first published in 2000, with the current edition being the second, published in 2010.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-02-07T13:11:35.883" LastActivityDate="2019-02-07T13:11:35.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2437" PostTypeId="4" CreationDate="2018-06-23T21:51:45.883" Score="0" Body="For questions about exercises or passages from the popular quantum computing textbook *Quantum Computation and Quantum Information* by Michael Nielsen and Isaac Chuang. " OwnerUserId="91" LastEditorUserId="26" LastEditDate="2019-02-07T13:11:50.617" LastActivityDate="2019-02-07T13:11:50.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2438" PostTypeId="2" ParentId="2390" CreationDate="2018-06-24T05:25:46.603" Score="3" Body="&lt;p&gt;Calculation of the inverse of an &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrix can be done by applying HHL with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; different &lt;span class=&quot;math-container&quot;&gt;$\vec{b}_i$&lt;/span&gt; (specifically, HHL is applied &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times, once for each computational basis vector used as the &lt;span class=&quot;math-container&quot;&gt;$\vec{b}_i$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;In each case, phase estimation has to be done for an &lt;span class=&quot;math-container&quot;&gt;$N \times N$&lt;/span&gt; matrix.&lt;/p&gt;&#xA;&lt;p&gt;The number of qubits required for phase estimation is written on page 249 of the 10th anniversary edition of N&amp;amp;C:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;The quantum phase estimation procedure uses two registers. The first&#xA;register contains &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; qubits.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;The second register [...] contains as many qubits as is necessary&#xA;to store &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;&amp;quot;, where &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional vector.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So you are correct that we would need &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; qubits for the first register, and &lt;span class=&quot;math-container&quot;&gt;$\log N=8$&lt;/span&gt; qubits for the second register.&lt;/p&gt;&#xA;&lt;p&gt;This is 14 qubits in total to do the phase esitmation part of each HHL iteration involved in calculating the inverse of a matrix. 14 qubits is well within the capabilities of a laptop.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-06-24T05:25:46.603" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2439" PostTypeId="1" AcceptedAnswerId="2464" CreationDate="2018-06-24T07:08:52.883" Score="9" ViewCount="1433" Body="&lt;p&gt;&lt;sup&gt; This is a continuation of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2393/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-2-what-is-p&quot;&gt;Quantum algorithm for linear systems of equations (HHL09): Step 2 - What is $|\Psi_0\rangle$?&lt;/a&gt; &lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the paper: &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Quantum algorithm for linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/strong&gt;&lt;/a&gt;, the details of the actual implementation of the algorithm is not given. &lt;strong&gt;How&lt;/strong&gt; exactly the states $|\Psi_0\rangle$ and $|b\rangle$ are created, is sort of a &quot;&lt;strong&gt;black-box&lt;/strong&gt;&quot; (see pages 2-3). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\Psi_0\rangle = \sqrt{\frac{2}{T}}\sum_{\tau = 0}^{T-1}\sin \frac{\pi (\tau+\frac{1}{2})}{T}|\tau\rangle$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and $$|b\rangle = \sum_{1}^{N}b_i|i\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $|\Psi_0\rangle$ is the initial state of the clock register and $|b\rangle$ is the initial state of the Input register. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Say) &lt;strong&gt;I want to carry out their algorithm on the IBM $16$-qubit quantum computer.&lt;/strong&gt; And I want to solve a certain equation $\mathbf{Ax=b}$ where $\mathbf{A}$ is a $4\times 4$ Hermitian matrix with real entries and $\mathbf{b}$ is a $4\times 1$ column vector with real entries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{A} = \begin{bmatrix} 1 &amp;amp; 2 &amp;amp; 3 &amp;amp; 4 \\ 2 &amp;amp; 1 &amp;amp; 5 &amp;amp; 6 \\ 3 &amp;amp; 5 &amp;amp; 1 &amp;amp; 7 \\ 4 &amp;amp; 6 &amp;amp; 7 &amp;amp; 1 \end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{b}=\begin{bmatrix} 1 \\ 2 \\ 3 \\ 4 \end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the dimensions of $\mathbf{A}$ and $\mathbf{b}$, we should need $\lceil{\log_2 4\rceil}=2$ qubits for the input register and another $6$ qubits for the clock register assuming we want the eigenvalues to be represented with $90\%$ accuracy and up to $3$-bit precision for the eigenvalues (this has been discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2390/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-1-number-of-qu/2438?noredirect=1#comment2939_2438&quot;&gt;here&lt;/a&gt; previously). So total $2+6+1=9$ qubits will be needed for this purpose (the extra $1$ qubit is the ancilla).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Questions:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Using this information, is it &lt;strong&gt;possible&lt;/strong&gt; to create the initial states $|\Psi_0\rangle$ and $|b\rangle$ on the IBM $16$ qubit version?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you think $4\times 4$ is too large to be implemented on the IBM quantum computers you could even show an &lt;em&gt;example&lt;/em&gt; of initial state preparation for a $2\times 2$ Hermitian matrix $\mathbf{A}$ (or just give a reference to such an example). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I simply want to get a &lt;em&gt;general idea&lt;/em&gt; about whether this can be done (i.e. whether it is possible) on the IBM 16-qubit quantum computer, and for that which gates will be necessary. If not the IBM 16-qubit quantum computer, can the QISKit simulator used for recreating the initial state preparation of $|\Psi_0\rangle$ and $|b\rangle$ in the HHL algorithm? Is there any other better alternative to go about this?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T19:01:52.570" LastActivityDate="2018-07-06T09:30:16.743" Title="Quantum algorithm for linear systems of equations (HHL09): Step 2 - Preparation of the initial states $|\Psi_0\rangle$ and $|b\rangle$" Tags="&lt;algorithm&gt;&lt;ibm-q-experience&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2440" PostTypeId="1" AcceptedAnswerId="2442" CreationDate="2018-06-24T08:49:03.517" Score="6" ViewCount="391" Body="&lt;p&gt;As explained in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1909/what-exactly-is-a-phase-vector&quot;&gt;this answer&lt;/a&gt;, when we have different (relative) phases between two states, those two states will yield the same probabilities when measured in the same basis but different probabilities when measured in different bases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why would we need to do measurement in different bases?&lt;br&gt;&#xA;I'm asking from a quantum programming point of view. Why would I need to change the (relative) phase of two states when writing a program?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One constraint though: I don't understand how to read a Bloch sphere so the matrix and circuit formalisms are preferred.&lt;/p&gt;&#xA;" OwnerUserId="2417" LastEditorUserId="26" LastEditDate="2018-12-23T13:41:11.283" LastActivityDate="2018-12-23T13:41:11.283" Title="Use of change of phase gates" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2441" PostTypeId="2" ParentId="2440" CreationDate="2018-06-24T09:34:17.470" Score="1" Body="&lt;p&gt;The phase mentioned in that question and answer are of the form:&#xA;$$&#xA;P = &#xA;\begin{bmatrix} &#xA;e^{i\theta} &amp;amp; 0 \\ &#xA;0 &amp;amp; e^{i\phi}&#xA;\end{bmatrix}&#xA;$$&#xA;so, they are not global phases. However, two particular states, aka its eigenstates, are unaffected by this relative phase operator. Because, this operator is diagonal it means the basis we are currently using is their eigenstate.&lt;/p&gt;&#xA;" OwnerUserId="2023" LastActivityDate="2018-06-24T09:34:17.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2442" PostTypeId="2" ParentId="2440" CreationDate="2018-06-24T09:49:43.423" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;My question is why would we need to do measurement in different bases?&#xA;  I'm asking from a quantum programming point of view. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum programs are usually written to implement some quantum algorithm. Depending on the algorithm you &lt;em&gt;might&lt;/em&gt; need to change the basis of measurement at some point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state#Bell_state_measurement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell state measurement&lt;/a&gt; is useful in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation protocol&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-06-24T09:49:43.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2443" PostTypeId="1" CreationDate="2018-06-24T10:55:31.113" Score="5" ViewCount="681" Body="&lt;p&gt;I had asked this question earlier in the comment section of the post: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2381/what-is-a-qubit&quot;&gt;What is a qubit?&lt;/a&gt; but none of the answers there seem to address it at a satisfactory level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;question&lt;/strong&gt; basically is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How is a &lt;strong&gt;single qubit&lt;/strong&gt; in a Bell state&#xA;  $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ any &lt;strong&gt;different&lt;/strong&gt; from a&#xA;  classical coin spinning in the air (on being tossed)? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;one-word&lt;/strong&gt; answer for &lt;em&gt;difference between a system of &lt;strong&gt;2 qubits&lt;/strong&gt; and a system of &lt;strong&gt;2 classical coins&lt;/em&gt;&lt;/strong&gt; is &quot;&lt;strong&gt;entanglement&lt;/strong&gt;&quot;. For instance, you cannot have a system of two coins in the state $\frac{1}{\sqrt 2}|00\rangle+\frac{1}{\sqrt 2}|11\rangle$. The reason is simple: when two &quot;fair&quot; coins are spinning in air, there is always some &lt;strong&gt;finite probability&lt;/strong&gt; that the first coin lands heads-up while the second coin lands tails-up, and also the vice versa is true. In the combined Bell state $\frac{1}{\sqrt 2}|00\rangle+\frac{1}{\sqrt 2}|11\rangle$ that is not possible. If the first qubit turns out to be $|0\rangle$, the second qubit will necessarily be $|1\rangle$. Similarly, if the first qubit turns out to be $|1\rangle$, the second qubit will necessarily turn out to be $|1\rangle$. At, this point someone might point out that if we use $2$ &quot;&lt;strong&gt;biased&lt;/strong&gt;&quot; coins then it might be possible to recreate the combined Bell state. The answer is still &lt;strong&gt;no&lt;/strong&gt; (it's possible to mathematically prove it...try it yourself!). That's because the Bell state cannot be decomposed into a tensor product of two individual qubit states i.e. the two qubits are &lt;em&gt;entangled&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;While the reasoning for the &lt;strong&gt;2-qubit&lt;/strong&gt; case is understandable from there, I'm not sure what fundamental reason distinguishes a &lt;strong&gt;single qubit&lt;/strong&gt; from a &lt;strong&gt;single &quot;fair&quot; coin&lt;/strong&gt; spinning in the air. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2385/26&quot;&gt;answer by @Jay Gambetta&lt;/a&gt; somewhat gets at it (but is still not satisfactory):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This is a good question and in my view gets at the heart of a qubit.&#xA;  Like the comment by&#xA;  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/26/blue&quot;&gt;@blue&lt;/a&gt;,&#xA;  it's not that it can be an equal superposition as this is the same as&#xA;  a classical probability distribution. It is that it can have negative&#xA;  signs. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Take this example. Imagine you have a bit in the $0$ state and then&#xA;  you apply a coin flipping operation by some stochastic matrix&#xA;   $\begin{bmatrix}0.5 &amp;amp; 0.5 \\0.5 &amp;amp; 0.5 \end{bmatrix}$ this will make a&#xA;  classical mixture. If you apply this twice it will still be a&#xA;  classical mixture. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Now lets got to the quantum case and start with a qubit in the $0$&#xA;  state and apply a coin flipping operation by some unitary matrix&#xA;   $\begin{bmatrix}\sqrt{0.5} &amp;amp; \sqrt{0.5} \\\sqrt{0.5} &amp;amp; -\sqrt{0.5}&#xA; \end{bmatrix}$. This makes an equal superposition and you get random&#xA;  outcomes like above. Now applying this twice you get back the state&#xA;  you started with. The negative sign cancels due to interference which&#xA;  cannot be explained by probability theory. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Extending this to n qubits gives you a theory that has an exponential&#xA;  that we can't find efficient ways to simulate. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This is not just my view. I have seen it shown in talks of Scott&#xA;  Aaronson and I think its best to say quantum is like “Probability&#xA;  theory with Minus Signs” (this is a quote I seen Scott make).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not exactly sure &lt;strong&gt;how&lt;/strong&gt; they're getting the unitary matrix $\begin{bmatrix}\sqrt{0.5} &amp;amp; \sqrt{0.5} \\\sqrt{0.5} &amp;amp; -\sqrt{0.5} \end{bmatrix}$ and what the motivation behind that is. Also, they say: &quot;The negative sign cancels due to &lt;strong&gt;interference&lt;/strong&gt; which can not be explained by probability theory.&quot; The way they've used the word interference seems very vague to me. It would be useful if someone can elaborate on the logic used in that answer and explain &lt;strong&gt;what they actually mean by interference&lt;/strong&gt; and &lt;strong&gt;why exactly it cannot be explained by classical probability&lt;/strong&gt;. Is it some &lt;em&gt;extension&lt;/em&gt; of &lt;strong&gt;Bell's inequality&lt;/strong&gt; for &lt;strong&gt;1-qubit systems&lt;/strong&gt; (doesn't seem so based on my conversations with the folks in the main chat though)? &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-08T14:00:16.443" LastActivityDate="2018-07-13T15:03:10.593" Title="How is a single qubit fundamentally different from a classical coin spinning in the air?" Tags="&lt;physical-qubit&gt;&lt;quantum-state&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2444" PostTypeId="1" CreationDate="2018-06-24T14:31:19.543" Score="7" ViewCount="306" Body="&lt;p&gt;I mean are we certain that they will be able to provide us a huge improvements (in some tasks) compared to clasical computers?&lt;/p&gt;&#xA;" OwnerUserId="2754" LastEditorUserId="2293" LastEditDate="2020-09-24T14:07:34.813" LastActivityDate="2020-09-24T14:07:34.813" Title="Are we certain that quantum computers are more efficient than classical computers can be built?" Tags="&lt;physical-realization&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2445" PostTypeId="2" ParentId="2443" CreationDate="2018-06-24T15:25:12.490" Score="3" Body="&lt;p&gt;The analogy between qubits and coin flips is popular but can be misleading.  (See, for example, this video: &lt;a href=&quot;https://www.youtube.com/watch?v=lypnkNm0B4A&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=lypnkNm0B4A&lt;/a&gt;)  A coin spinning in the air and landing on the ground is not truly random, though we may describe it as such.  The key point is how you measure it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At any point in time the coin has a definite orientation, though it may be unknown to us.  Likewise, qubits have a definite state at any time, which we can describe by a point on the surface of a sphere (the so-called Bloch sphere).  Mathematically, a coin's orientation and a qubit's state are equivalent.  While in the air, the coin may undergo deterministic and reversible motion (e.g., spinning and falling).  Likewise, prior to measurement a qubit may undergo deterministic and reversible transformations (e.g., unitary gate operations on a quantum computer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measurement represents an irreversible process.  For a coin, it is a series of inelastic collisions with the ground, bouncing and spinning until it comes to rest.  If we are completely ignorant of the initial conditions of the coin, the two final orientations (heads or tails) will appear equally likely, but this is not always the case.  If I drop it oriented &quot;heads up&quot; from a short height, it will land flat with &quot;heads up&quot; with near certainty.  But suppose I was standing next to a large magnetic wall and did this.  The coin would hit edge-on and would likely land with either heads or tails showing, with equal probability.  One could imagine doing this experiment with various initial orientations of the coin and orientations of the magnetic wall (upright, flat, slanted, etc.).  You can imagine that the probability of getting heads or tails will be different, depending on the relative orientations of the coin and wall.  (In theory it's all completely deterministic, but in practice we never know the initial conditions &lt;em&gt;that&lt;/em&gt; precisely.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measurements of qubits are quite similar.  I can prepare a qubit in the state $\frac{1}{\sqrt{2}}[|0\rangle + |1\rangle]$, measure it in the 0/1 basis $\{|0\rangle, |1\rangle\}$, and get either $|0\rangle$ or $|1\rangle$ with equal probability.  If, however, I measure in the +/- basis $\{|+\rangle, |-\rangle\}$ (analogous to using a magnetic wall), I get $|+\rangle$ with near certainty.  (I say &quot;near certainty&quot; because, well, nothing in the real world is perfect.)  Here, $|\pm\rangle = \frac{1}{\sqrt{2}}[|0\rangle\pm|1\rangle$ are the +/- basis states.  For polarized photons, for example, this could be done used polarization filters rotated $45^\circ$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference between preparing the state $\frac{1}{\sqrt{2}}[|0\rangle + |1\rangle]$ and the state $\frac{1}{\sqrt{2}}[|0\rangle - |1\rangle]$ is the difference between preparing a vertically oriented coin with either heads or tails facing away from the wall.  (A good picture would really help here.)  We can tell which of the two states is prepared based on the outcome of a suitably chosen measurement, which in this case would be a +/- basis (or magnetic wall) measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jay Gambetta mentions a unitary matrix that is used to represent a Hadamard gate.  It corresponds to rotating a coin by $90^\circ$, so a coin that's initially heads up becomes vertically oriented with, say, heads facing away from the wall.  If the wall is magnetic and you release the coin, it will stick to it with heads up.  If, instead, you started with a coin that's tails up and applied the same rotation, it would be vertical with tails facing away from the wall.  If you release it (and the wall is still magnetic), you get tails.  On the other hand, if the wall is not magnetic and you drop it, it lands heads or tails with equal probability.  Using a &quot;floor&quot; measurement doesn't distinguish between the two vertical orientations, but using a &quot;wall&quot; measurement does.  It's not so much whether things are predictable or not, it's the type of measurement you do that distinguishes one quantum state (or coin orientation) from another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the whole of it.  The only remaining mystery is that the outcome of the coin measurement is considered to be, in theory, completely deterministic, while that of the qubit is considered to be, except in special cases, &quot;intrinsically random.&quot;  But that's another discussion...&lt;/p&gt;&#xA;" OwnerUserId="356" LastEditorUserId="356" LastEditDate="2018-06-24T16:56:16.897" LastActivityDate="2018-06-24T16:56:16.897" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2446" PostTypeId="1" AcceptedAnswerId="2479" CreationDate="2018-06-24T16:50:17.770" Score="3" ViewCount="100" Body="&lt;p&gt;I recently found out about &lt;a href=&quot;https://en.wikipedia.org/wiki/Shadowgraph&quot; rel=&quot;nofollow noreferrer&quot;&gt;shadowgraphy&lt;/a&gt; and was wondering if a technique like this could be used to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Visually show entanglement&lt;/li&gt;&#xA;&lt;li&gt;Suffice as a measure (e.g. continous partial trace)&lt;/li&gt;&#xA;&lt;li&gt;Most useful applications &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/0741-3335/58/6/065004/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Modeling ultrafast shadowgraphy in laser-plasma interaction experiments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.osapublishing.org/ao/abstract.cfm?uri=ao-48-22-4449&quot; rel=&quot;nofollow noreferrer&quot;&gt;Retroreflective shadowgraph technique for large-scale flow visualization&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/5499779/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital in-line holography with the Iterative Shadowgraphic Method&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.semanticscholar.org/paper/Quantum-algorithmic-information-theory-Svozil/4994981ca4971525d44053ed06b9516efcd61da6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithmic information theory&lt;/a&gt;: Appendices C &amp;amp; D&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Mach%E2%80%93Zehnder_interferometer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mach–Zehnder interferometer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-06-25T22:15:55.717" LastActivityDate="2018-06-26T19:45:46.920" Title="Realization of Quantum Shadowgraphy" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2447" PostTypeId="2" ParentId="2443" CreationDate="2018-06-24T17:55:37.567" Score="0" Body="&lt;p&gt;You have already mentioned the practical differences, such as qubit entanglement, and the negative signs (or more general &quot;phases&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fundamental reason for this is that allowed quantum states are solutions of the Schrödinger equation, which is a &lt;strong&gt;&lt;em&gt;linear differential equation&lt;/em&gt;&lt;/strong&gt;. The sum of solutions to a linear differential equation is &lt;strong&gt;always&lt;/strong&gt; also a solution to that differential equation [&lt;a href=&quot;https://math.stackexchange.com/questions/246643/why-is-a-linear-combination-of-solutions-also-a-solution&quot;&gt;1&lt;/a&gt;],[&lt;a href=&quot;https://math.stackexchange.com/questions/1626362/why-does-the-sum-of-two-linearly-independent-solutions-of-a-second-order-homogen&quot;&gt;2&lt;/a&gt;],[&lt;a href=&quot;https://math.stackexchange.com/questions/1353043/why-is-the-sum-of-two-independent-solutions-of-homogenous-2nd-order-odes-a-solut&quot;&gt;3&lt;/a&gt;]. Since &quot;solution&quot; to differential equation is synonymous with &quot;allowed quantum state&quot; or &quot;allowed wavefunction&quot;, &lt;strong&gt;any&lt;/strong&gt; sum of allowed states is also allowed (ie. superpositions like Bell states are allowed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the fundamental reason why quantum mechanical bits (qubits) can exist in superpositions. In fact, not just any sum, but any linear combination of states is an allowed state because the differential equation is linear. This means we can even add constants (phases of -1 or +1 or $e^{i\theta}$) and still have allowed states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bits that follow the rules of quantum physics, for example, the Schrödinger equation, can physically exist in superpositions and with phases, due to linearity (review &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;vector spaces&lt;/a&gt; if this is not clear). Classical physics does not give any mechanism for a system to be in more than one state at the same time.&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-07-13T15:03:10.593" LastActivityDate="2018-07-13T15:03:10.593" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2448" PostTypeId="2" ParentId="2444" CreationDate="2018-06-24T18:19:40.853" Score="4" Body="&lt;p&gt;The answer is no. We cannot be 100% certain.&lt;br&gt;&#xA;Just  like we don't have a proof that P $\ne$ NP, there is no proof that NP $\ne$ QMA, though we &lt;strong&gt;believe&lt;/strong&gt; both these inequalities to be true even without proof.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, we do not know how the &quot;engineering complexity&quot; scales, so even though Shor's algorithm has exponentially fewer operations to perform than the best known classical algorithm, it might be &lt;em&gt;double exponentially&lt;/em&gt; more difficult to implement it physically. See my answer to this question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2017/are-there-any-estimates-on-how-complexity-of-quantum-engineering-scales-with-siz/2019#2019&quot;&gt;Are there any estimates on how complexity of quantum engineering scales with size?&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible that there exists a proof  that NP $\ne$ QMA and that the engineering complexity scales linearly, meaning that quantum computers could &quot;provably&quot; have some advantage, but we just do not know of any such proof yet. Until we see a quantum computer give these &quot;huge improvements&quot; for a problem where it is provably better than the best classical algorithm, we have no way of being 100% certain that quantum computers will provide what you ask.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum &lt;strong&gt;&lt;em&gt;communication&lt;/em&gt;&lt;/strong&gt; though (not necessarily quantum computing), does have some provable benefits over present day classical communication devices, and one example is the BB84 protocol.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-24T18:19:40.853" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="2449" PostTypeId="1" AcceptedAnswerId="2450" CreationDate="2018-06-24T18:24:06.580" Score="4" ViewCount="202" Body="&lt;p&gt;When considering Shor's algorithm, we use ancilla qubits to effectively obtain the state&#xA;$$\sum_x \left|x,f(x)\right&amp;gt;$$&#xA;for the function $f(x) = a^x \mod N$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I have learned it, we then measure the ancilla qubits, to obtain, say $f(x) = b$ and get the state&#xA;$$\sum_{x\mid f(x) = b} \left|x,f(x)\right&amp;gt;.$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then applying a QFT will give the period. However, I think that the measurement of the ancilla qubits is not necessary, in order to be able to apply the QFT (or its inverse for that matter) and do a measurement to obtain the period. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that correct? Is it necessary to measure the ancilla qubits in Shor's algorithm?&lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2018-12-14T06:09:38.550" LastActivityDate="2018-12-14T06:09:38.550" Title="Measuring ancillas in Shor's algorithm" Tags="&lt;measurement&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2450" PostTypeId="2" ParentId="2449" CreationDate="2018-06-24T19:12:13.837" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is that correct? Is it [not] necessary to measure the ancilla qubits in Shor's algorithm?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct, it is not necessary to measure the ancillae.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is easily seen by appealing to the no-communication theorem. If measuring the ancillae could affect the success of the algorithm, you could communicate faster-than-light by starting the algorithm many times, giving the ancillae to Alice, sending her far away, have her encode a bit by measuring or not measuring the ancillae, then having Bob measure how often the factoring was succeeding to read out the bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to see that this works &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setR%22%2C%22arg%22%3A27%7D%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A8%7D%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22X%22%5D%2C%5B%22Density7%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22*BToAmodR5%22%5D%2C%5B%22Density7%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22QFT%E2%80%A07%22%5D%2C%5B%22Density7%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22Chance7%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;is by simulating it&lt;/a&gt;. From the results you can see that, as soon as the modular-exponentiation into the ancillae has happened, the density matrix of the input has been decohered in a very particular periodic way. And that the inverse QFT of this decohered density matrix has magnitude spikes at the correct places:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5g7B7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5g7B7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that this is all in place even though the ancillae were not measured. Measuring them changes none of the density matrices.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-06-24T19:58:38.243" LastActivityDate="2018-06-24T19:58:38.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2451" PostTypeId="2" ParentId="2432" CreationDate="2018-06-24T19:51:44.220" Score="9" Body="&lt;p&gt;The naming started in NMR and it has become the difference between the following two experiments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment one&lt;/strong&gt;: Prepare the qubit in a superposition state (apply a H gate) and vary the wait time and then measure in the superposition basis (apply another H gate). The decay time of this experiment is $T_2^*$. We commonly call this a Ramsey experiment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment two&lt;/strong&gt;:  Prepare the qubit in a superposition state and apply half the wait time and then apply a pi-pulse (X operator) and then the remainder of the wait time and measure in the superposition basis. The decay time of this experiment is $T_2$. We commonly call this a Hahn Echo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second experiment, the pi-pulse refocuses slow noise which depending on the system can be due to many reasons. There are higher order experiments that refocus the noise better and this is an active research area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this imagine the simplest case where the noise can be explained by a Hamiltonian $H = \Delta |1\rangle\langle 1|$ that is constant and unknown. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;strong&gt;first experiment&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1. Apply H makes $(|0\rangle+|1\rangle)/\sqrt(2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2. Wait makes $(|0\rangle+\exp(-i\Delta t)|1\rangle)/\sqrt{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3. Apply H $[(1+e^{-i\Delta t})|0\rangle+(1-e^{-i\Delta t})|1\rangle]/2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of getting outcome 0 is $1/2+\cos(\Delta t)/2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;strong&gt;second experiment&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1. Apply H gives $(|0\rangle+|1\rangle)/\sqrt(2)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2. Half Wait gives $(|0\rangle+\exp(-i\Delta t/2)|1\rangle)/\sqrt{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3. Apply X gives $(|1\rangle+\exp(-i\Delta t/2)|0\rangle)/\sqrt{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3. Half Wait gives $\exp(-i\Delta t/2)(|1\rangle+|0\rangle)/\sqrt{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 4. Apply H gives $\exp(-i\Delta t/2)|0\rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of getting outcome $0$ is always $1$ (there is no decay). So the $T_2$ of this experiment would be infinite. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the more general case $H = \Delta(t) |1\rangle\langle 1|$ the first experiment gives $\mathrm{Pr}(0) = 1/2+\langle\cos(\int_0^t \Delta(t))\rangle/2$ where we have averaged over different shots (runs of the experiment). I similar but different expression can be derived for the second experiment and I will leave as an exercise what happens but depending on the assumptions you are willing to make about the noise correlations you can simplify this expression in terms of the noise spectrum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to go check it out on a real experiment you can try the notebook &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial/blob/master/reference/qcvv/relaxation_and_decoherence.ipynb&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/QISKit/qiskit-tutorial/blob/master/reference/qcvv/relaxation_and_decoherence.ipynb&lt;/a&gt; but you need an account on the IBM Q experience. &lt;/p&gt;&#xA;" OwnerUserId="302" LastEditorUserId="26" LastEditDate="2018-06-24T20:04:57.440" LastActivityDate="2018-06-24T20:04:57.440" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2452" PostTypeId="2" ParentId="1808" CreationDate="2018-06-24T20:20:40.730" Score="2" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$a^{r/2} \equiv -1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$a^{r/2}$&lt;/span&gt; is a trivial square root of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; instead of an interesting square root. We &lt;em&gt;already knew&lt;/em&gt; that &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; is a square root of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. We need a square root we didn't already know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I give you a number &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$x^2 = 1 \pmod{N}$&lt;/span&gt;. You can rewrite this equation as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;x^2 &amp;amp;= 1 + k \cdot N&#xA;\\&#xA;x^2 - 1 &amp;amp;= k \cdot N&#xA;\\&#xA;(x+1)(x-1) &amp;amp;= k \cdot N&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key thing to realize is that &lt;em&gt;this equation is trivial when &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\pm 1 \bmod N$&lt;/span&gt;&lt;/em&gt;. If &lt;span class=&quot;math-container&quot;&gt;$x\equiv -1$&lt;/span&gt;, then the left hand side is &lt;span class=&quot;math-container&quot;&gt;$0 \bmod N$&lt;/span&gt; because the factor &lt;span class=&quot;math-container&quot;&gt;$(x+1)\equiv 0$&lt;/span&gt;. The same thing happens if &lt;span class=&quot;math-container&quot;&gt;$x \equiv +1$&lt;/span&gt;, but with the other factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order for both &lt;span class=&quot;math-container&quot;&gt;$(x+1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(x-1)$&lt;/span&gt; to be interesting (i.e. non-zero mod &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;), we need &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to be an &lt;em&gt;extra&lt;/em&gt; square root of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. A square root besides the obvious &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; answers. When that happens, it is impossible for the prime factors of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to all go into &lt;span class=&quot;math-container&quot;&gt;$(x+1)$&lt;/span&gt; or all go into &lt;span class=&quot;math-container&quot;&gt;$(x-1)$&lt;/span&gt;, and so &lt;span class=&quot;math-container&quot;&gt;$\gcd(x+1, N)$&lt;/span&gt; is guaranteed to give you a factor of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; instead of a multiple of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$N=221$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$x=103$&lt;/span&gt; is an extra square root of 1. And indeed, both &lt;span class=&quot;math-container&quot;&gt;$\gcd(x+1, N) = \gcd(104, 221) = 13$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\gcd(x-1, N) = \gcd(102, 221) = 17$&lt;/span&gt; are factors of &lt;span class=&quot;math-container&quot;&gt;$221$&lt;/span&gt;. Whereas if we had picked the boring square root &lt;span class=&quot;math-container&quot;&gt;$x=-1\equiv 220$&lt;/span&gt;, then neither &lt;span class=&quot;math-container&quot;&gt;$\gcd(x+1,N) = \gcd(221, 221) = 221$&lt;/span&gt; nor &lt;span class=&quot;math-container&quot;&gt;$\gcd(x-1,N) = \gcd(219,221) = 1$&lt;/span&gt; are factors of &lt;span class=&quot;math-container&quot;&gt;$221$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-03-04T21:30:28.183" LastActivityDate="2019-03-04T21:30:28.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2453" PostTypeId="2" ParentId="2195" CreationDate="2018-06-24T20:43:17.197" Score="2" Body="&lt;p&gt;You can find detailed instructions about what you need to install for your particular OS &lt;a href=&quot;https://github.com/QISKit/qiskit-tutorial/blob/master/INSTALL.md#5-visualizing-circuits&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. This visualization uses Latex, so you need to have a latex compiler installed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also make sure you have the latest version of Qiskit, as a Windows visualization bug was recently fixed. You can upgrade by doing: &#xA;&lt;code&gt;pip install -U qiskit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the next couple weeks, Qiskit will have another visualization method that runs purely in Python, hence no other software installations required.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2018-06-24T20:43:17.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2454" PostTypeId="1" AcceptedAnswerId="2455" CreationDate="2018-06-24T21:23:36.790" Score="7" ViewCount="430" Body="&lt;p&gt;I found it odd that the result of the action of identity gate (namely a $2\times2$ identity matrix) on a pure state $|0\rangle$ (namely the vector corresponding to the $2\times1$ matrix $\begin{bmatrix} 1\\0 \end{bmatrix}$) becomes a $2\times2$ matrix $\begin{bmatrix} 1+0\cdot i&amp;amp;0+0\cdot i\\0+0\cdot i&amp;amp;1+0\cdot i \end{bmatrix}=\begin{bmatrix} 1&amp;amp;0\\0&amp;amp;1 \end{bmatrix}$ as I found it &lt;a href=&quot;https://nbviewer.jupyter.org/github/QISKit/qiskit-tutorial/blob/master/reference/tools/quantum_gates_and_linear_algebra.ipynb#Identity-gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;HERE&lt;/a&gt; (QISKit tutorial page):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/W79pi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W79pi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when one lets for more precision, the result gets odd:    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cv2Kx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cv2Kx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this? The same thing happens for other gates listed on the page referenced above.&lt;/p&gt;&#xA;" OwnerUserId="2757" LastEditorUserId="2293" LastEditDate="2020-08-17T02:56:43.977" LastActivityDate="2020-08-17T02:56:43.977" Title="One-qubit gate results in QISKit" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2455" PostTypeId="2" ParentId="2454" CreationDate="2018-06-25T01:28:53.873" Score="3" Body="&lt;p&gt;In the first case you are not asking for the state but the unitary matrix representing the circuit. This is correct and just rounding error.   It looks like you are not using the latest version so I would update. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second case are you sure that you don’t have a previous circuit loaded in memory. In that notebook all examples have the same circuit name and it looks like this is a different gate.  If i had to guess it is the u2 example. If this is not the case you have found a bug and please submit an issue and we try to debug it.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also change the title as this is not a general quantum computing question to one qubit gates errors in qiskit or something like that. &lt;/p&gt;&#xA;" OwnerUserId="302" LastEditorUserId="302" LastEditDate="2018-06-25T02:22:56.967" LastActivityDate="2018-06-25T02:22:56.967" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2456" PostTypeId="1" AcceptedAnswerId="2459" CreationDate="2018-06-25T06:53:29.573" Score="3" ViewCount="215" Body="&lt;p&gt;I was not able to locate any visuals online. The visual I have in my head is a cube w/ bloch spheres as the eight vertices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also curious about a matrix representation, although I am not sure how feasible this is as a qubyte has $2^8$ (256) states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the best way to represent a qubyte?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-07-16T15:03:25.637" LastActivityDate="2018-07-16T15:03:25.637" Title="How to represent a qubyte?" Tags="&lt;entanglement&gt;&lt;qudit&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2457" PostTypeId="2" ParentId="2444" CreationDate="2018-06-25T07:12:18.163" Score="3" Body="&lt;p&gt;There is no absolute certainty. People introduce complexity classes: BPP for the set of problems that a classical computer (with access to a source of randomness) can solve in polynomial time, and BQP for the set of problems that a quantum computer can efficiently solve. We know that BQP contains BPP, but we do not know for certain that there are problems in BQP but not BPP. It is generally believed that there are some. &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt; for factoring large composite numbers is most typically hailed as a likely candidate, although the best candidate is the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;nofollow noreferrer&quot;&gt;algorithm for the Jones polynomial&lt;/a&gt; because this problem is known to be the hardest that is efficiently solvable by a quantum computer. But we don't &lt;em&gt;know&lt;/em&gt;. It may be that there is an efficient classical algorithm for this problem, and we just haven't been smart enough to find it yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we &lt;em&gt;do&lt;/em&gt; know is that with respect to certain oracles (i.e. black boxes that function in particular ways), quantum algorithms do outperform classical ones. You can think of this as &quot;if we program an algorithm in a particular way, how fast can it run?&quot;. The advantage of these oracle-based algorithms is that lower bounds can be proven, showing the minimum number of operations required. The classic example of this is &lt;a href=&quot;https://en.wikipedia.org/wiki/Simon%27s_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon's problem&lt;/a&gt;. Again, it doesn't mean that there can't be a better way of doing it classically via another route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other aspect that is implied by your question is whether a scalable universal quantum computer can actually be built. Until this is actually done, I don't think it can be proven, although it is generally believed that it will happen. There are, however, those who believe there are fundamental limitations that will prevent the construction of a suitable device. Gil Kalai, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1794/1837&quot;&gt;for example&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-25T07:12:18.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2458" PostTypeId="1" AcceptedAnswerId="2652" CreationDate="2018-06-25T07:13:55.123" Score="3" ViewCount="166" Body="&lt;p&gt;What quantum technologies and/or techniques (if any) could be used to evaluate the value of large numbers in the &lt;a href=&quot;https://googology.wikia.com/wiki/Introduction_to_the_fast-growing_hierarchy&quot; rel=&quot;nofollow noreferrer&quot;&gt;fast growing hierarchy&lt;/a&gt; such as &lt;a href=&quot;http://googology.wikia.com/wiki/TREE(3)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tree(3)&lt;/a&gt; or &lt;a href=&quot;http://googology.wikia.com/wiki/Subcubic_graph_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;SCG(13)&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-18T20:24:59.340" LastActivityDate="2018-12-18T20:24:59.340" Title="Quantum algorithm to evaluate numbers in fast growing hierarchy" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2459" PostTypeId="2" ParentId="2456" CreationDate="2018-06-25T07:19:44.070" Score="6" Body="&lt;p&gt;I don't think you'll find a good visual representation. The Bloch sphere for a qubit is a particularly unique coincidence because the number of parameters to represent an arbitrary mixed state is only 1 more than the number of parameters required to represent an arbitrary pure state, and so the pure states can be thought of as the surface to a mixed state's volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A cube with Bloch spheres at the vertices is a fair representation if all 8 qubits remain separable at all times. However, you will get in a mess trying to represent entanglement in that picture (you'll need superpositions of several different separable states). As you've said, an arbitrary pure state of a qubyte has $2^8$ states, requiring $2^{16}-2$ real parameters to describe. 8 (pure) Bloch states give you access to only 16 parameters. You're probably best sticking to a complex vector of $2^8$ elements (minus 2 real parameters for global phase and normalisation).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-25T07:19:44.070" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2460" PostTypeId="2" ParentId="2443" CreationDate="2018-06-25T07:47:28.560" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How is a single qubit in a Bell state $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ any different from a classical coin spinning in the air (on being tossed)?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For both of them, the probability of getting heads is 1/2&#xA;  and getting tails is also 1/2 (we can assume that heads$\equiv|1\rangle$ and tails$\equiv|0\rangle$ and that we are &quot;measuring&quot; in the heads-tails basis).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For &lt;em&gt;any&lt;/em&gt; 1-qubit state $|\psi\rangle$, if all you do is measure it in the computational basis, you will always be able to explain it in terms of a probability distribution p(heads)$=|\langle 0|\psi\rangle|^2$ and p(tails)$=|\langle 1|\psi\rangle|^2$. The key differences are in using different bases and/or performing unitary evolutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classic example is the Mach-Zehnder interferometer. Think of it this way: any 1-bit probabilistic operation is described by a $2\times 2$ stochastic matrix (i.e. all columns sum to 1). Call it $P$. It is easy enough to show that &lt;strong&gt;there is no $P$ such that $P^2=X$&lt;/strong&gt;, where $X$ is the Pauli matrix (in other words, a NOT gate). Thus, there is no probabilistic gate that can be considered the square-root of NOT. On the other hand, we can build such a device. A half-silvered mirror performs the square-root of not action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A half-silvered mirror has two inputs (labelled 0 and 1) and two outputs (also labelled 0 and 1). Each input is a photon coming in a different direction, and it is either reflected or transmitted. If you just look at one half-silvered mirror, then whatever input you give, the output is 50:50 reflected or transmitted. It seems just like the coin you're talking about. However, if you put two of them together, if you input 0, or always get the output 1, and vice versa. The only way to explain this is with probability amplitudes, and a transition matrix that looks like&#xA;$$&#xA;U=\frac{1}{\sqrt{2}}\left(\begin{array}{cc}&#xA;1 &amp;amp; i \\ i &amp;amp; 1&#xA;\end{array}\right).&#xA;$$&#xA;&lt;strong&gt;In quantum mechanics, the square-root of not gate exists.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-25T07:47:28.560" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="2461" PostTypeId="2" ParentId="2388" CreationDate="2018-06-25T09:04:08.840" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What am I missing here? Where did the factor of $\frac{t}{2\pi}$ vanish in their algorithm?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Remember that in Dirac notation, whatever you write inside the ket is an arbitrary label referring to something more abstract. So, it is true that you are finding the (approximate) eigenvector to $U$, which has eigenvalue $e^{-i\lambda t}$ and therefore what you're extracting is $\lambda t/(2\pi)$, but that is the same as the eigenvector of $A$ with eigenvalue $\lambda$, and it is that which is being referred to in the notation. But if you wanted to be really clear, you could write it as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;|approximate eigenvector of $U$ for which eigenvalue is $e^{-i\lambda t}$ and of $A$ for which eigenvalue if $\lambda\rangle$,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but perhaps instead of writing that out every time, we might just write $|\tilde\lambda\rangle$ for brevity!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-25T09:04:08.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2462" PostTypeId="2" ParentId="2393" CreationDate="2018-06-25T10:12:43.420" Score="4" Body="&lt;p&gt;$\newcommand{\bra}[1]{\left\langle#1\right|}\newcommand{\ket}[1]{\left|#1\right\rangle}\newcommand{\proj}[1]{|#1\rangle\langle#1|}\newcommand{\half}{\frac12}$In answer to your first question, I wrote myself some notes some time ago about my understanding of how it worked. The notation is probably a bit different (I've tried to bring it more into line, but it's easy to miss bits), but attempts to explain that choice of the state $|\Psi_0\rangle$. There also seem to be some factors of $\frac12$ floating around in places.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we first study phase estimation, we're usually thinking about it in respect to use in some particular algorithm, such as Shor's algorithm. This has a specific goal: getting the best $t$-bit approximation to the eigenvalue. You either do, or you don't, and the description of phase estimation is specifically tuned to give as high a success probability as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In HHL, we are trying to produce some state&#xA;$$&#xA;\ket{\phi}=\sum_j\frac{\beta_j}{\lambda_j}\ket{\lambda_j},&#xA;$$&#xA;where $\ket{b}=\sum_j\beta_j\ket{\lambda_j}$, making use of phase estimation. The accuracy of the approximation of this will depend far more critically on an accurate estimation of the eigenvalues that are close to 0 rather than those that are far from 0. An obvious step therefore, is to attempt to modify the phase estimation protocol so that rather than using `bins' of fixed width $2\pi/T$ for approximating the phases of $e^{-iAt}$ ($T=2^t$ and $t$ is number of qubits in phase estimation register), we might rather specify a set of $\phi_y$ for $y\in\{0,1\}^t$ to act as the centre of each bin so that we can have vastly increased accuracy close to 0 phase. More generally, you might specify a trade-off function for how tolerant you might be of errors as a function of the phase $\phi$. The precise nature of this function can then be tuned to a given application, and the particular figure of merit which you will use to determine success. In the case of Shor's algorithm, our figure of merit was simply this binning protocol -- we were successful if the answer was in the correct bin, and unsuccessful outside it. This is not going to be the case in HHL, whose success is more reasonably captured by a continuous measure such as the fidelity. So, for the general case, we shall designate a cost function $C(\phi,\phi')$ which specifies a penalty for answers $\phi'$ if the true phase is $\phi$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall that the standard phase estimation protocol worked by producing an input state that was the uniform superposition of all basis states $\ket{x}$ for $x\in\{0,1\}^t$. This state was used to control the sequential application of multiple controlled-$U$ gates, which are followed up by an inverse Fourier transform. Imagine we could replace the input state with some other state&#xA;$$&#xA;\ket{\Psi_0}=\sum_{x\in\{0,1\}^t}\alpha_x\ket{x},&#xA;$$&#xA;and then the rest of the protocol could work as before. For now, we will ignore the question of how hard it is to produce the new state $\ket{\Psi_0}$, as we are just trying to convey the basic concept. Starting from this state, the use of the controlled-$U$ gates (targeting an eigenvector of $U$ of eigenvalue $\phi$), produces the state&#xA;$$&#xA;\sum_{x\in\{0,1\}^t}\alpha_xe^{i\phi x}\ket{x}.&#xA;$$&#xA;Applying the inverse Fourier transform yields&#xA;$$&#xA;\frac{1}{\sqrt{T}}\sum_{x,y\in\{0,1\}^t}e^{ix\left(\phi-\frac{2\pi y}{M}\right)}\alpha_x\ket{y}.&#xA;$$&#xA;The probability of getting an answer $y$ (i.e. $\phi'=2\pi y/T$) is&#xA;$$&#xA;\frac{1}{T}\left|\sum_{x\in\{0,1\}^t}e^{ix\left(\phi-\frac{2\pi y}{T}\right)}\alpha_x\right|^2&#xA;$$&#xA;so the expected value of the cost function, assuming a random distribution of the $\phi$, is&#xA;$$&#xA;\bar C=\frac{1}{2\pi T}\int_0^{2\pi}d\phi\sum_{y\in\{0,1\}^t}\left|\sum_{x\in\{0,1\}^t}e^{ix\left(\phi-\frac{2\pi y}{T}\right)}\alpha_x\right|^2C(\phi,2\pi y/T),&#xA;$$&#xA;and our task is to select the amplitudes $\alpha_x$ that minimise this for any specific realisation of $C(\phi,\phi')$. If we make the simplifying assumption that $C(\phi,\phi')$ is only a function of $\phi-\phi'$, then we can make a change of variable in the integration to give&#xA;$$&#xA;\bar C=\frac{1}{2\pi}\int_0^{2\pi}d\phi\left|\sum_{x\in\{0,1\}^t}e^{ix\phi}\alpha_x\right|^2C(\phi),&#xA;$$&#xA;As we noted, the most useful measure is likely to be a fidelity measure. Consider we have a state $\ket{+}$ and we wish to implement the unitary $U_\phi=\proj{0}+e^{i\phi}\proj{1}$, but instead we implement $U_{\phi'}=\proj{0}+e^{i\phi'}\proj{1}$. The fidelity measures how well this achieves the desired task,&#xA;$$&#xA;F=\left|\bra{+}U_{\phi'}^\dagger U\ket{+}\right|^2=\cos^2\left(\frac{\phi-\phi'}{2}\right),&#xA;$$&#xA;so we take&#xA;$$&#xA;C(\phi-\phi')=\sin^2\left(\frac{\phi-\phi'}{2}\right),&#xA;$$&#xA;since in the ideal case $F=1$, so the error, which is what we want to minimise, can be taken as $1-F$.&#xA;This will certainly be the correct function for evaluating any $U^t$, but for the more general task of modifying the amplitudes, not just the phases, the effects of inaccuracies propagate through the protocol in a less trivial manner, so it is difficult to prove optimality, although the function $C(\phi-\phi')$ will already provide some improvement over the uniform superposition of states. Proceeding with this form, we have&#xA;$$&#xA;\bar C=\frac{1}{2\pi}\int_0^{2\pi}d\phi\left|\sum_{x\in\{0,1\}^t}e^{ix\phi}\alpha_x\right|^2\sin^2\left(\half\phi\right),&#xA;$$&#xA;The integral over $\phi$ can now be performed, so we want to minimise the function&#xA;$$&#xA;\half\sum_{x,y=0}^{T-1}\alpha_x\alpha_y^\star(\delta_{x,y}-\half\delta_{x,y-1}-\half\delta_{x,y+1}).&#xA;$$&#xA;This can be succinctly expressed as&#xA;$$&#xA;\min\bra{\Psi_0}H\ket{\Psi_0}&#xA;$$&#xA;where&#xA;$$&#xA;H=\half\sum_{x,y=0}^{T-1}(\delta_{x,y}-\half\delta_{x,y-1}-\half\delta_{x,y+1})\ket{x}\bra{y}.&#xA;$$&#xA;The optimal choice of $\ket{\Psi_0}$ is the minimum eigenvector of the matrix $H$,&#xA;$$&#xA;\alpha_x=\sqrt{\frac{2}{T+1}}\sin\left(\frac{(x+1)\pi}{T+1}\right),&#xA;$$&#xA;and $\bar C$ is the minimum eigenvalue&#xA;$$&#xA;\bar C=\half-\half\cos\left(\frac{\pi}{T+1}\right).&#xA;$$&#xA;Crucially, for large $T$, $\bar C$ scales as $1/T^2$ rather than the $1/T$ that we would have got from the uniform coupling choice $\alpha_x=1/\sqrt{T}$. This yields a significant benefit for the error analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get the same $|\Psi_0\rangle$ as reported in the HHL paper, I believe you have to add the terms $-\frac14\left(\ket{0}\bra{T-1}+\ket{T-1}\bra{0}\right)$ to the Hamiltonian. I have no justification for doing so, however, but this is probably my failing.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-27T06:24:21.060" LastActivityDate="2018-06-27T06:24:21.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2463" PostTypeId="2" ParentId="2440" CreationDate="2018-06-25T14:13:39.203" Score="3" Body="&lt;p&gt;Strictly, it's never necessary to measure in different bases, because any projective measurement can be decomposed as a unitary followed by a projective measurement in the computational basis. Conversely, there are times when algorithms are described as unitaries followed by measurements in the computational basis, and you might choose to move some of those unitaries into a description of the basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point I'm trying to make here is that the division between measurement and the rest of an algorithm is fairly arbitrary, so to get to the heart of your question, we really have to ask about the importance of relative phases inside a quantum algorithm. These are absolutely crucial, as these are what provide for the constructive and destructive interference that permit outcomes different from classical computation. Take a look at &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm#Deutsch&amp;#39;s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch's algorithm&lt;/a&gt; for the simplest, 1 qubit, example. This is usually described as -prepare $|0\rangle$ state, Hadamard, function evaluation, Hadamard, measure in computational basis- but you could describe it as -prepare $|+\rangle$ state, function evaluation,measure in $|\pm\rangle$ basis-. The function evaluation, the thing you really want to get at, is entirely encoded in the relative phase between the two states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give one extreme example, consider &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurement-based quantum computation&lt;/a&gt;. Here, we produce a standard quantum state, and the computation to be performed is entirely defined by the choice of single-qubit measurements that are performed.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-25T14:13:39.203" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2464" PostTypeId="2" ParentId="2439" CreationDate="2018-06-25T15:09:49.790" Score="3" Body="&lt;p&gt;It's not possible to create the initial states $\left| \Psi_0\right&amp;gt;$ and $\left|b\right&amp;gt;$ on the IBM 16 qubits version. On the other hand, it is possible to approximate them with an arbitrarily low error&lt;sup&gt;1&lt;/sup&gt; as the gates implemented by the IBM chips offer this possibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you ask for 2 different quantum states:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;$\left| b \right&amp;gt;$ is not restricted at all. The state $\left| b \right&amp;gt;$ is represented by a vector of $N$ complex numbers that can be anything (as long as the vector has unitary norm).&lt;/li&gt;&#xA;&lt;li&gt;$\left| \Psi_0 \right&amp;gt;$ can be seen as a special case of $\left| b \right&amp;gt;$, where the coefficients $b_i$ are more constrained. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With this analysis, any method that can be used for creating $\left|b\right&amp;gt;$ can also be used to create $\left| \Psi_0 \right&amp;gt;$. On the other hand, as $\left| \Psi_0 \right&amp;gt;$ is more constrained, we can hope that there exists more efficient algorithms to produce $\left| \Psi_0 \right&amp;gt;$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Useful for $\left|b\right&amp;gt;$ and $\left|\Psi_0\right&amp;gt;$&lt;/strong&gt;: Based on &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176v5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Synthesis of Quantum Logic Circuits (Shende, Bullock &amp;amp; Markov, 2006)&lt;/a&gt;, the QISKit Python SDK implements a generic method to initialize an arbitrary quantum state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Useful for $\left|\Psi_0\right&amp;gt;$&lt;/strong&gt;: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208112&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating superpositions that correspond to efficiently integrable probability distributions (Grover &amp;amp; Rudolph, 2002)&lt;/a&gt; presents quickly an algorithm to initialise a state whose amplitudes represents a probability distribution respecting some constraints. These constraints are respected for $\left|\Psi_0\right&amp;gt;$ according to &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for solving linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/a&gt;, last line of page 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the implementation on QISKit, here is a sample to initialise a given quantum state:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;&#xA;statevector_backend = qiskit.get_backend('local_statevector_simulator')&#xA;&#xA;###############################################################&#xA;# Make a quantum program for state initialization.&#xA;###############################################################&#xA;qubit_number = 5&#xA;Q_SPECS = {&#xA;    &quot;name&quot;: &quot;StatePreparation&quot;,&#xA;    &quot;circuits&quot;: [&#xA;        {&#xA;            &quot;name&quot;: &quot;initializerCirc&quot;,&#xA;            &quot;quantum_registers&quot;: [{&#xA;                &quot;name&quot;: &quot;qr&quot;,&#xA;                &quot;size&quot;: qubit_number&#xA;            }],&#xA;            &quot;classical_registers&quot;: [{&#xA;                &quot;name&quot;: &quot;cr&quot;,&#xA;                &quot;size&quot;: qubit_number&#xA;            }]},&#xA;    ],&#xA;}&#xA;Q_program = qiskit.QuantumProgram(specs=Q_SPECS)&#xA;&#xA;## State preparation&#xA;import numpy as np&#xA;from qiskit.extensions.quantum_initializer import _initializer&#xA;&#xA;def psi_0_coefficients(qubit_number: int):&#xA;    T = 2**qubit_number&#xA;    tau = np.arange(T)&#xA;    return np.sqrt(2 / T) * np.sin(np.pi * (tau + 1/2) / T)&#xA;&#xA;def get_coeffs(qubit_number: int):&#xA;    # Can be changed to anything, the initialize function will take&#xA;    # care of the initialisation.&#xA;    return np.ones((2**qubit_number,)) / np.sqrt(2**qubit_number)&#xA;    #return psi_0_coefficients(qubit_number)&#xA;&#xA;circuit_prep = Q_program.get_circuit(&quot;initializerCirc&quot;)&#xA;qr = Q_program.get_quantum_register(&quot;qr&quot;)&#xA;cr = Q_program.get_classical_register('cr')&#xA;coeffs = get_coeffs(qubit_number)&#xA;_initializer.initialize(circuit_prep, coeffs, [qr[i] for i in range(len(qr))])&#xA;&#xA;res = qiskit.execute(circuit_prep, statevector_backend).result()&#xA;statevector = res.get_statevector(&quot;initializerCirc&quot;)&#xA;print(statevector)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;Here &quot;error&quot; refers to the error between the ideal state and the approximation when dealing with a perfect quantum computer (i.e. no decoherence, no gate error).&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-06-26T08:17:42.790" LastActivityDate="2018-06-26T08:17:42.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2465" PostTypeId="2" ParentId="2425" CreationDate="2018-06-25T15:38:18.587" Score="3" Body="&lt;p&gt;There is no &lt;em&gt;a priori&lt;/em&gt; reason why an entanglement monotone should have this property. I think the particular issue is that, restricting to pure states, when you start to look at multiparticle states, you get inequivalent states. For example, for 3 qubits, the W state and GHZ state are inequivalent, and both are maximally entangled representatives for their SLOCC equivalence class (stochastic local operations and classical communication). There's no particular reason that an entanglement monotone should always favour GHZ (the AME(3,2)) over W-state. Indeed, they don't. Looking through the list of &lt;a href=&quot;https://en.wikipedia.org/wiki/Multipartite_entanglement#Multipartite_entanglement_measures_for_pure_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;common multipartite entanglement monotones&lt;/a&gt; on Wikipedia, the one that stands out to me is the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0007081&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schmidt Measure&lt;/a&gt;. It has value $\log_2(3)$ for a W state and one a value 1 for the GHZ state, so the AME is not maximally entangled by this measure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-25T15:38:18.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2466" PostTypeId="1" AcceptedAnswerId="2468" CreationDate="2018-06-26T01:54:44.063" Score="7" ViewCount="2311" Body="&lt;p&gt;&lt;strong&gt;How could a $\sqrt{SWAP}$ circuit be expressed in terms of CNOT gates &amp;amp; single qubit rotations?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RkZvk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RkZvk.png&quot; alt=&quot;CNOT &amp;amp; SQRT of SWAP&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CNOT &amp;amp; $\sqrt{SWAP}$ Gates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Any quantum circuit can be simulated to an arbitrary degree of accuracy using a combination of CNOT gates and single qubit rotations. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Controlled_NOT_gate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Both CNOT and $\sqrt{SWAP}$ are universal two-qubit gates and can be transformed into each other.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The questions are not identical, and are likely to attract different audiences. -DaftWullie &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can the difference be regarded as applied vs theoretic?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-23T13:39:11.947" LastActivityDate="2019-04-28T09:06:25.177" Title="Expressing &quot;Square root of Swap&quot; gate in terms of CNOT" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2468" PostTypeId="2" ParentId="2466" CreationDate="2018-06-26T06:59:32.620" Score="6" Body="&lt;p&gt;As pointed out by @Nelimee, this question is essentially answered in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2228/1837&quot;&gt;this question&lt;/a&gt;, even if that question seems more specific. However, for the sake of completeness... (Note that I make no claims about minimality of construction with respect to, for example, number of controlled-not gates.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start with a unitary matrix for the square root of SWAP:&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{1}{2}+\frac{i}{2} &amp;amp; \frac{1}{2}-\frac{i}{2} &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{1}{2}-\frac{i}{2} &amp;amp; \frac{1}{2}+\frac{i}{2} &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;$$&#xA;Note that if we pre- and post-multiply by a controlled NOT, controlled off qubit 2, this transforms into the form of a controlled-$U$ gate:&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \frac{1}{2}+\frac{i}{2} &amp;amp; \frac{1}{2}-\frac{i}{2} \\&#xA; 0 &amp;amp; 0 &amp;amp; \frac{1}{2}-\frac{i}{2} &amp;amp; \frac{1}{2}+\frac{i}{2} \\&#xA;\end{array}&#xA;\right)&#xA;$$&#xA;There are standard constructions for this controlled-$U$ gate. So, overall, we have a circuit that looks like&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wXWk3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wXWk3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;where $ABC=\mathbb{I}$ and $AXBXC=e^{i\pi/4}\sqrt{X}$. Again, there are standard routes towards finding $A$, $B$ and $C$. For instance, we can define $R_Y(\theta)$ to be a rotation about the $Y$ axis by an angle $\theta$, i.e. $R_Y(\theta)=e^{i\theta Y}$ (there may be a factor of $\frac12$ here compared to some definitions). Then, if&#xA;$$&#xA;A=R_Y(\theta)R_Z(\phi)\qquad B=R_Z(-2\phi)\qquad C=R_Z(\phi)R_Y(-\theta),&#xA;$$&#xA;then it's easy to verify that $ABC=\mathbb{I}$. Furthermore, $AXBXC=R_Y(\theta)R_Z(4\phi)R_Y(-\theta)$ since $XR_Z(\phi)X=R_Z(-\phi)$. You can think of this as $R_Z(4\phi)$ specifying the eigenvalues that we want, and the $R_Y(\theta)$ is changing the basis from the computational basis into something else. In the present case, we have $\theta=\pi/2$ and $4\phi=\pi/4$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one little thing that we haven't got right yet is a phase factor. Our $AXBXC$ is creating the correct rotation up to an overall phase of $e^{i\pi/4}$:&#xA;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; -\frac{i}{\sqrt{2}} \\&#xA; 0 &amp;amp; 0 &amp;amp; -\frac{i}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\end{array}&#xA;\right)&#xA;$$&#xA;The trick to get this right is to apply an $R_Z(\pi/8)$ on the first qubit and remove a global phase of $e^{i\pi/8}$. Thus, we have&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fsQ9U.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fsQ9U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-26T06:59:32.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2469" PostTypeId="1" CreationDate="2018-06-26T07:34:08.697" Score="8" ViewCount="260" Body="&lt;p&gt;Let there be a known a scheme (quantum circuit) of Controlled-G, where unitary gate G has G$^†$ such that G≠G$^†$ and GG$^†$=I (for example S and S$^†$, T and T$^†$, V and V$^†$, but not Pauli and H gates).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question for the experts is:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is correct that new scheme of Controlled-G$^†$ gate may be constructed from this known scheme of Controlled-G gate by reversing the order of used gates (U) and each U in this scheme changes to the corresponding U$^†$&#xA;(if U≠U$^†$ of course)?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, see below my OPENQASM-program (note that suffix 'dg' for gate name is used instead '$^†$'in OPENQASM), where it is used well-known scheme of Controlled-S gate and my scheme of Controlled-S$^†$ gate, constructed from this well-known scheme by the above method.&lt;br&gt;&#xA;So far I have only received successful results of applying this method and have not found any obvious contradictions with the &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.52.3457&quot; rel=&quot;noreferrer&quot;&gt;known theory&lt;/a&gt; &lt;sup&gt;[*]&lt;/sup&gt;, but suddenly I didn't take something into account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My program in OPENQASM for example:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;//Name of Experiment: Amy Matthew controlled-s and my controlled-sdg gates v7&#xA;OPENQASM 2.0; &#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q[3];&#xA;creg c[3];&#xA;gate cs a,b {&#xA;// a is control, b is target&#xA;// see https//uwspace.uwaterloo.ca/bitstream/handle/10012/7818/AmyMatthew.pdf&#xA;// fig.4.6b&#xA;cx b,a;&#xA;tdg a;&#xA;cx b,a;&#xA;t a;&#xA;t b;&#xA;}&#xA;gate csdg a,b {&#xA;// a is control, b is target&#xA;// my controlled-sdg (I hope that is reverse of controlled-s)&#xA;tdg b;&#xA;tdg a;&#xA;cx b,a;&#xA;t a;&#xA;cx b,a;&#xA;}&#xA;&#xA;h q[0];&#xA;cx q[0],q[1]&#xA;;&#xA;x q[2];&#xA;h q[2];&#xA;barrier q;&#xA;cs q[0],q[2];&#xA;cs q[1],q[2];&#xA;barrier q;&#xA;csdg q[0],q[2];&#xA;csdg q[1]&#xA;&#xA;,q[2];&#xA;&#xA;barrier q;&#xA;h q[2];&#xA;measure q -&amp;gt; c; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sH9if.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sH9if.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[*]: &lt;em&gt;Elementary gates for quantum computation&lt;/em&gt; Barenco &lt;em&gt;et al.&lt;/em&gt; (1995)&lt;/p&gt;&#xA;" OwnerUserId="2764" LastEditorUserId="26" LastEditDate="2018-12-23T13:38:40.810" LastActivityDate="2018-12-23T13:38:40.810" Title="Construct Controlled-$G^{\dagger}$ from known Controlled-$G$" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;&lt;qasm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2470" PostTypeId="2" ParentId="2469" CreationDate="2018-06-26T07:46:05.937" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How is correct that new scheme of Controlled-$G^\dagger$ gate may be constructed from this known scheme of Controlled-G gate by reversing the order of used gates ($U$) and each $U$ in this scheme changes to the corresponding $U^\dagger$ (if $U≠U^\dagger$ of course)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's 100% correct:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inverting a composed quantum gate is done with the algorithm you gave. You can check for example the &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/_compositegate.html#CompositeGate.inverse&quot; rel=&quot;nofollow noreferrer&quot;&gt;implementation of the &lt;code&gt;inverse()&lt;/code&gt; method in &lt;code&gt;qiskit.CompositeGate&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def inverse(self):&#xA;    &quot;&quot;&quot;Invert this gate.&quot;&quot;&quot;&#xA;    # self.data is a list of the quantum gates composing the CompositeGate.&#xA;    self.data = [gate.inverse() for gate in reversed(self.data)]&#xA;    self.inverse_flag = not self.inverse_flag&#xA;    return self&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Inverting a controlled-gate boils down to apply the controlled-[inverse of this gate].&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-06-26T07:46:05.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2471" PostTypeId="2" ParentId="2469" CreationDate="2018-06-26T08:27:09.110" Score="2" Body="&lt;p&gt;If I understand the question correctly, you're assuming that you have some gate $V$ that you've decomposed as $\prod_{i=1}^NU_i$ and you want to show that $V^\dagger$ is $\prod_{i=1}^NU_{N+1-i}^\dagger$ where the product is taken in the opposite order?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, you just need to show that $VV^\dagger=\mathbb{I}$ given that $U_iU_i^\dagger=\mathbb{I}$. You can do this directly using the stated decompositions above:&#xA;$$&#xA;VV^\dagger=(U_1U_n\ldots U_N)(U_N^\dagger\ldots U_2^\dagger U_1^\dagger)=U_1U_n\ldots U_{N-1}(U_NU_N^\dagger)U_{N-1}^\dagger\ldots U_2^\dagger U_1^\dagger&#xA;$$&#xA;and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This solution is completely general, and does not need to make any assumptions about the form of the original unitary $V$.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-26T09:00:16.507" LastActivityDate="2018-06-26T09:00:16.507" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2472" PostTypeId="2" ParentId="2466" CreationDate="2018-06-26T09:08:36.643" Score="4" Body="&lt;p&gt;I think that you want answers to explicitly use full cnots, rather than partial versions. But since you already have an answer for that, I'll contribute a different perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SWAP}$&lt;/span&gt; can be thought of as a cnot that has been conjugated by oppositely oriented cnots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{SWAP} = {\rm cx}(k,j) \,\, {\rm cx}(j,k) \,\, {\rm cx}(k,j) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\mathrm{SWAP}}$&lt;/span&gt;, we can instead use a square root of cnot conjugated by oppositely oriented cnots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sqrt{\mathrm{SWAP}} = {\rm cx}(k,j) \,\, \sqrt{{\rm cx}(j,k)} \,\, {\rm cx}(k,j) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To verify that this is indeed a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\mathrm{SWAP}}$&lt;/span&gt;, you can simply square it and verify that it ends up in the way we expect (using the fact that cnots square to identity).&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2019-04-28T09:06:25.177" LastActivityDate="2019-04-28T09:06:25.177" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2473" PostTypeId="1" AcceptedAnswerId="2474" CreationDate="2018-06-26T09:16:44.673" Score="3" ViewCount="441" Body="&lt;p&gt;Reproduced from Exercise 2.3 of Nielsen &amp;amp; Chuang's &lt;em&gt;Quantum Computation and Quantum Information (10th Anniversary Edition)&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a linear operator from vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to vector space &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is a linear operator from vector space &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; to vector space &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|v_i⟩$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|w_j⟩$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|x_k⟩$&lt;/span&gt; be bases for the vector spaces &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, respectively. Show that the matrix representation for the linear transformation &lt;span class=&quot;math-container&quot;&gt;$BA$&lt;/span&gt; is the matrix product of the matrix representations for &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, with respect to the appropriate bases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="26" LastEditDate="2019-03-30T08:00:31.900" LastActivityDate="2019-03-30T08:00:31.900" Title="Nielsen &amp; Chuang Exercise 2.3 - “Matrix representation for operator products”" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2019-01-07T15:12:32.100" ContentLicense="CC BY-SA 4.0" />
  <row Id="2474" PostTypeId="2" ParentId="2473" CreationDate="2018-06-26T10:28:02.057" Score="4" Body="&lt;p&gt;Consider the linear maps $A: V\to W$ and $B: W\to X$. The composition $BA$ is a linear map from $V$ to $X$. Now, how can $\mathcal{M}(BA)$ be computed from $\mathcal{M}(B)$ and $\mathcal{M}(A)$? $\mathcal{M}(A)$ is the $n\times p$ matrix representation of the linear map $A$ w.r.t the basis $\{v_1,...,v_p\}$ and $\{w_1,...,w_n\}$. $\mathcal{M}(B)$ is the $m\times n$ matrix representation of the linear map $B$ w.r.t the basis $\{w_1,...,w_n\}$ and $\{x_1,...,x_m\}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, $\mathcal{M}(A) = \begin{bmatrix}a_{11} &amp;amp; ... &amp;amp; a_{1p}\\... &amp;amp; ... &amp;amp; ...\\a_{n1} &amp;amp; ... &amp;amp;a_{np}\end{bmatrix}$ &amp;amp; $\mathcal{M}(B) = \begin{bmatrix}b_{11} &amp;amp; ... &amp;amp; b_{1n}\\... &amp;amp; ... &amp;amp; ...\\b_{m1} &amp;amp; ... &amp;amp;b_{mn}\end{bmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's see the action of the linear map $BA$ on a certain basis vector of $V$, say $v_k$ (as it is sufficient to just know the action of any linear transformation on the basis vectors, in order to determine the transformation):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\therefore BA(v_k)=B(\sum_{r=1}^{n} a_{r,k}w_r)$$&#xA;$$= \sum_{r=1}^{n}a_{r,k}Bw_r$$&#xA;$$= \sum_{r=1}^{n}a_{r,k}\sum_{j=1}^{m}b_{j,r}x_j$$&#xA;$$= \sum_{j=1}^{m}(\sum_{r=1}^{n}b_{j,r}a_{r,k})x_j$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, $\mathcal{M}(BA)$ is the $m\times p$ matrix whose entry in row $j$, column $k$ equals $\sum_{r=1}^{n}b_{j,r}a_{r,k}$. This is exactly equal to the $j,k$-th element of the matrix we get after multiplying $\mathcal{M}(B)$ and $\mathcal{M}(A)$. Hence, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;$$\mathcal{M}(BA)=\mathcal{M}(B)\mathcal{M}(A)$$&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: I've omitted the ket notation given in the original question, for ease of typing. By default, $|v_i\rangle = v_i,|w_j\rangle = w_j$ and $|x_k\rangle = x_k$ for indices $i,j,k$.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-26T11:18:58.797" LastActivityDate="2018-06-26T11:18:58.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2475" PostTypeId="1" CreationDate="2018-06-26T16:10:50.620" Score="5" ViewCount="1082" Body="&lt;p&gt;Suppose we have any matrix in $\mathrm U(2)$ and we need to construct a Controlled-$U$ operation with the $H,T,S$ gates. Then I am aware of the construction given in N&amp;amp;C of decomposing $U$ into $e^{ia}AXBXC$. My question is how to implement gates $A,B,C$ using the gates from library set $\left\lbrace H,T,S,X,Y,Z\right\rbrace$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, any sequence of the gates induces some phase to the matrix (while $A,B,C \in \mathrm{SU}(2)$), so how is that phase removed from the circuit?&lt;/p&gt;&#xA;" OwnerUserId="2770" LastEditorUserId="23" LastEditDate="2018-06-26T16:59:39.223" LastActivityDate="2020-08-05T13:45:41.773" Title="Controlled-U operation in IBMQ" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2476" PostTypeId="2" ParentId="2456" CreationDate="2018-06-26T16:43:23.640" Score="3" Body="&lt;p&gt;For a pure state of 8 qubits, the Hilbert space is $2^8$ dimensional. Dropping the normalization and phase information means you are left with the space $\mathbb{CP}^{2^8-1}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike a single qubit which give the Bloch sphere $\mathbb{CP}^{2^1-1}$, this is too big to draw directly. Instead one usually draws simpler spaces that capture the essential features. This is thanks to the fact that these spaces are &lt;a href=&quot;https://en.wikipedia.org/wiki/Toric_variety&quot; rel=&quot;nofollow noreferrer&quot;&gt;toric varieties&lt;/a&gt;. The example of how to draw $\mathbb{CP}^2$ as a triangle with tori above each point is given there. What this amounts to is remembering only the amplitudes first and then realizing that you forgot the phases and fixing that later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of drawing a line segment (a 1-cube) as you would for a single qubit, you would have to draw a $2^8-1$ simplex. Of course you can't do that, but you can project onto planes that you can draw several 2 dimensional pictures for. So this draws only certain linear combinations of probabilities for the $2^8$ basis states. Do several of these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of information is lost, because you couldn't draw the full $2^8-1$ complex dimensional ($2^{16}-2$ real dimensional) thing, but by throwing away information about phases and only taking certain linear combinations of probabilities, you get something you can visualize. Also you know what sort of structure you forgot along the way. Like when going from the point on the simplex back to the full complex projective space, you lost all the phases. You can draw those as points on the circle as usual, so you can recover the full information from those two diagrams.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to say that some of the qubits are separable from others, then you get $\mathbb{CP}^{2^n-1} \times \mathbb{CP}^{2^m-1}$ where $n+m=8$. This is also toric and so also has a polytope that replaces the $2^8-1$ simplex. If you want it fully separable this would be $\mathbb{CP}^{2^1-1} \times \cdots \mathbb{CP}^{2^1-1}$ 8 times. The polytope that replaces the $2^8-1$ simplex there is a product of 8 1-cubes as already mentioned. Again above this polytope are some phases you lost along the way, but those are easy to draw in an accompanying diagram.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-06-26T16:43:23.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2477" PostTypeId="1" AcceptedAnswerId="2478" CreationDate="2018-06-26T16:52:18.747" Score="9" ViewCount="1779" Body="&lt;p&gt;How to implement the phase shift gate in qiskit or ibmq?&#xA;Phase Shift Gate : $$\begin{pmatrix}e^{ia} &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp; e^{ia}\end{pmatrix} = e^{ia}I$$&lt;/p&gt;&#xA;" OwnerUserId="2771" LastEditorUserId="26" LastEditDate="2019-03-12T09:29:10.173" LastActivityDate="2019-07-02T12:22:34.417" Title="Phase-Shift Gate in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2478" PostTypeId="2" ParentId="2477" CreationDate="2018-06-26T17:05:56.987" Score="14" Body="&lt;p&gt;You can implement the phase shift gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_h(\theta) = \begin{pmatrix}e^{i\theta} &amp;amp; 0\\0 &amp;amp; e^{i\theta}\end{pmatrix}$$&lt;/span&gt;&#xA;with the &lt;code&gt;X&lt;/code&gt; and &lt;code&gt;u1&lt;/code&gt; gate from the IBM Q chips:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}&#xA;P_h(\theta) &amp;amp;= U_1(\theta)\ X\ U_1(\theta)\ X \\&#xA;&amp;amp;= \begin{pmatrix}1 &amp;amp; 0\\0 &amp;amp; e^{i\theta}\end{pmatrix} \begin{pmatrix}0 &amp;amp; 1\\1 &amp;amp; 0\end{pmatrix} \begin{pmatrix}1 &amp;amp; 0\\0 &amp;amp; e^{i\theta}\end{pmatrix} \begin{pmatrix}0 &amp;amp; 1\\1 &amp;amp; 0\end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix}0 &amp;amp; 1\\e^{i\theta} &amp;amp; 0\end{pmatrix}\begin{pmatrix}0 &amp;amp; 1\\e^{i\theta} &amp;amp; 0\end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix}e^{i\theta} &amp;amp; 0\\0 &amp;amp; e^{i\theta}\end{pmatrix}&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def Ph(quantum_circuit, theta, qubit):&#xA;    quantum_circuit.u1(theta, qubit)&#xA;    quantum_circuit.x(qubit)&#xA;    quantum_circuit.u1(theta, qubit)&#xA;    quantum_circuit.x(qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;implements the &lt;span class=&quot;math-container&quot;&gt;$P_h$&lt;/span&gt; gate on Qiskit.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-07-02T12:22:34.417" LastActivityDate="2019-07-02T12:22:34.417" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2479" PostTypeId="2" ParentId="2446" CreationDate="2018-06-26T19:45:46.920" Score="3" Body="&lt;p&gt;There is an analogue to shadowgraphy which shows up in quantum information, which is the phase-space representation of quantum states via the Wigner function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wigner function W(q,p) is a phase-space representation of quantum states of a single particle, which gives the quantum mechanical probability distributions for position measurements, momentum measurements, and in general for any quadrature observable (i.e. linear combinations of position and momentum). For a general introduction, check this link:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Wigner_quasiprobability_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Wigner_quasiprobability_distribution&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These marginal distributions can be interpreted as a shadow of the quantum state along a direction specified by which quadrature is measured. Interestingly, there are quantum states for which the Wigner function may be negative in some phase-space regions! This is an indication of non-classicality, as the multiple &quot;shadows&quot; fail to make sense together: each shadow is a sensible probability distribution, but the &quot;object&quot; that casts the shadows is a phase-space distribution without direct interpretation in terms of probabilities (as it can be negative in some regions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At least for some definitions of discrete Wigner functions (useful for describing states in finite-dimensional Hilbert spaces), this negativity has been linked to contextuality and advantage in quantum computation, as pointed out for example in these papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1201.1256&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1201.1256&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0710.5549&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0710.5549&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2558" LastActivityDate="2018-06-26T19:45:46.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2480" PostTypeId="2" ParentId="2475" CreationDate="2018-06-26T21:24:09.683" Score="2" Body="&lt;p&gt;In general, it is not possible to implement every single-qubit operation exactly. However, it is possible to construct a quantum circuit whose action is approximately equal to this single-qubit operation. This can be done in many different ways, but I'm not sure if it is known which one is most efficient. I do not know of any &lt;em&gt;efficient&lt;/em&gt; way to construct such a circuit, however, there is a pretty inefficient method that is well-known. I'll leave it to the OP to decide if it is efficient enough for his/her purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nielsen and Chuang explain one construction using just the $H$ and $T$ gates. This is done in chapter 4, especially in section 4.5.3. This section builds on earlier results of chapter 4, one of them being exercise 4.11. It is important to note that this exercise is wrong in some editions (have a look at the &lt;a href=&quot;http://www.michaelnielsen.org/qcqi/errata/errata/errata.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;errata&lt;/a&gt; if this is true for your edition). Another source that provides this construction is &lt;a href=&quot;https://bit.ly/2JVU8ro&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, section 4.3, where the $\pi/8$-gate is just a different notation for the $T$-gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The construction is difficult to present concisely in this answer. The main idea is to consider the following two gate sequences $HTHT$ and $THTH$. These two gate sequences can be visualized as rotations in the Bloch sphere, where the angle of rotation is an irrational multiple of $\pi$ for both of these gate sequences. Consecutive applications of these two rotations are enough to implement any rotation, and hence the gate sequences $HTHT$ and $THTH$ can be used to construct any single-qubit gate.&lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2018-06-26T21:24:09.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2481" PostTypeId="2" ParentId="2242" CreationDate="2018-06-27T02:33:58.860" Score="2" Body="&lt;p&gt;In Qiskit you can compose two circuits to make a bigger circuit. You can do this simply by using the &lt;code&gt;+&lt;/code&gt; operator on the circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is your program rewritten to illustrate this&#xA;(note: you need the latest version of Qiskit for this, upgrade with &lt;code&gt;pip install -U qiskit&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qr = QuantumRegister(2)&#xA;cr = ClassicalRegister(2)&#xA;qc1 = QuantumCircuit(qr, cr)&#xA;qc1.x(qr)&#xA;&#xA;qc2 = QuantumCircuit(qr, cr)&#xA;qc2.x(qr)&#xA;&#xA;qc3 = qc1 + qc2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see that qc3 is a concatenation of q1 and q2.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(qc3.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q0[2];&#xA;creg c0[2];&#xA;x q0[0];&#xA;x q0[1];&#xA;x q0[0];&#xA;x q0[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, you seem to want to probe the state twice: once where qc1 ends, and once when qc2 ends. You can do this in a simulator by inserting &lt;code&gt;snapshot&lt;/code&gt; commands. This will save the statevector at a given point in the circuit. It does not collapse the state.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.extensions.simulator import *&#xA;qc1.snapshot('0')    # save the snapshot in slot &quot;0&quot;&#xA;qc2.snapshot('1')    # save the snapshot in slot &quot;1&quot;&#xA;qc2.measure(qr, cr)  # measure to get final counts&#xA;&#xA;qc3 = qc1 + qc2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can now execute &lt;code&gt;qc3&lt;/code&gt; on a simulator. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(qc3, 'local_qasm_simulator')&#xA;result = job.result()&#xA;print(result.get_snapshot('0'))&#xA;print(result.get_snapshot('1'))&#xA;print(result.get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yields:&#xA;    [0.+0.j 0.+0.j 0.+0.j 1.+0.j]&#xA;    [1.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA;    {'00': 1024}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the state goes back to |00&gt; as expected.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2018-06-27T02:33:58.860" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2483" PostTypeId="1" AcceptedAnswerId="2550" CreationDate="2018-06-27T03:13:05.430" Score="6" ViewCount="864" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0404107&quot; rel=&quot;nofollow noreferrer&quot;&gt;Realization of a photonic CNOT gate sufficient for quantum computation&lt;/a&gt; FIG. 1 there is a &amp;quot;scheme to obtain a photonic realization of a CNOT gate with two independent qubits.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What components are needed to realize a photonic CNOT gate?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="55" LastEditDate="2020-10-24T14:44:16.523" LastActivityDate="2020-10-24T14:44:16.523" Title="What components are needed to realize a photonic CNOT gate?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;photonics&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2484" PostTypeId="2" ParentId="2483" CreationDate="2018-06-27T06:23:00.370" Score="2" Body="&lt;p&gt;The original question was asking with respect to a particular &lt;a href=&quot;http://quantumgame.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Game&lt;/a&gt;. This quantum game only contains the elements of &lt;em&gt;linear optics&lt;/em&gt;, not all optics, so it was basically asking how CNot can be realised with linear optical elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This cannot be done with 100% efficiency. However, there are schemes that allow it to work in a heralded way, i.e. it works sometimes, and you know if it's worked. One of the best known schemes is the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2550/1837&quot;&gt;KLM scheme&lt;/a&gt;, which has since been described in more detail in the other answer. However, the efficiency can be very low. The other problem is that when the scheme fails, what happens to the information you tried to compute on? Depending on the scheme, it could be destroyed. A good way around this is with measurement-based quantum computation, where you can &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0509209&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;grow&quot; a resource state first&lt;/a&gt;, and only once you've been successful do you actually compute with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One recent experiment is described &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0404107&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and their main optical circuit is reproduced below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fLT5v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fLT5v.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the linear optical elements are supplemented by the presence of an entangled pair of photons to enhance the success rate. I don't think the game currently has the capability of producing those: the typical way to get them is to introduce a non-linear crystal that splits a single photon into an entangled pair.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is that instead of using two photons with qubits encoded in the respective polarisations (as in the previous case), you can encode two qubits using a single photon by combining path information (two possible paths) and polarisation. Then a polarising beam splitter implements what you're after: there are two inputs, 0 and 1. If the input is one polarisation (say H), the input is transmitted, meaning that the output is the same as the input (so $\mathbb{I}$ is enacted on the path information). For the orthogonal polarisation (V), the input is reflected, so $X$ is enacted on the path information.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-02T06:39:00.593" LastActivityDate="2018-07-02T06:39:00.593" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2485" PostTypeId="2" ParentId="2475" CreationDate="2018-06-27T08:41:52.177" Score="2" Body="&lt;p&gt;You asked for a decomposition using the &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace H,T,S,X,Y,Z\right\rbrace$&lt;/span&gt;. I assume that's because you think that's all that IBMQ offers. However, it is also possible to do rotations around the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axes, which make things a lot easier.&lt;/p&gt;&#xA;&lt;p&gt;Any single qubit unitary matrix may be decomposed as a sequence of rotations around two, non-parallel axes. For example&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = e^{i\alpha}&#xA;\,\,&#xA;R_z(\beta)&#xA;\,\,&#xA;R_y(\gamma)&#xA;\,\,&#xA;R_z(\delta)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here the global phase &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is undetectable and usually can be ignored, but not in cases like adding control to a unitary gate.  The &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; are angles of rotation around the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis, and &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is the angle for the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; axis.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axes rotation is called &lt;code&gt;RZ&lt;/code&gt; and is implemented by &lt;code&gt;U1&lt;/code&gt; (they are differ by a global phase only) on the IBM Q Experience and in QISKit. It takes a single parameter as an argument, which is the angle of rotation expressed in radians.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; axis rotation can be done using &lt;code&gt;U3&lt;/code&gt;. This takes three arguments. The first of which is the angle in radians for the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; rotation, and the other two should be set to zero.&lt;/p&gt;&#xA;&lt;p&gt;So if you want to do a rotation with &lt;span class=&quot;math-container&quot;&gt;$\beta=0.1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\gamma=0.2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta=0.3$&lt;/span&gt;, for example, this could be done using the QASM editor of the IBM Q Experience with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;u1(0.3) q[0];&#xA;u3(0.2,0,0) q[0];&#xA;u1(0.1) q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It can also be done using the composer. You just need to tick the 'advanced' checkbox to see these gates.&lt;/p&gt;&#xA;&lt;p&gt;If the global phase is important for your purposes, then you can use &lt;code&gt;RZ&lt;/code&gt; gates instead &lt;code&gt;U1&lt;/code&gt; gates (on the assumption that when a Controlled-U will be constructed then the correct version of the &lt;code&gt;cRZ&lt;/code&gt; gate will be used in IBM Q):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;rz(0.3) q[0];&#xA;u3(0.2,0,0) q[0];&#xA;rz(0.1) q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let's pretend that the global phase is 0.4, then we can append the circuit e.g. like &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12638/12416&quot;&gt;this&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;x q[0];&#xA;u3(pi,0.4,pi+0.4) q[0];  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastEditorUserId="12416" LastEditDate="2020-08-05T13:45:41.773" LastActivityDate="2020-08-05T13:45:41.773" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2486" PostTypeId="1" AcceptedAnswerId="2497" CreationDate="2018-06-27T12:32:54.373" Score="11" ViewCount="1295" Body="&lt;p&gt;Maybe it is a naive question, but I cannot figure out how to actually exponentiate a matrix in a quantum circuit.&#xA;Assuming to have a generic square matrix &lt;em&gt;A&lt;/em&gt;, if I want to obtain its exponential, $e^{A}$, i can use the series&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$e^{A} \simeq I+ A+\frac{A^2}{2!}+\frac{A^3}{3!}+...$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To have its approximation. I do not get how to do the same using quantum gates then apply it for instance to perform an Hamiltonian simulation. Some help?&lt;/p&gt;&#xA;" OwnerUserId="2648" LastEditorUserId="26" LastEditDate="2018-12-23T13:35:05.083" LastActivityDate="2018-12-23T13:35:05.083" Title="How to implement a matrix exponential in a quantum circuit?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2487" PostTypeId="1" AcceptedAnswerId="2488" CreationDate="2018-06-27T12:40:32.250" Score="2" ViewCount="302" Body="&lt;p&gt;Reproduced from Exercise 2.4 of Nielsen &amp;amp; Chuang's &lt;em&gt;Quantum Computation and Quantum Information (10th Anniversary Edition)&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Show that the identity operator on a vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; has a matrix representation which is one along the diagonal and zero everywhere else, if the matrix representation is taken with respect to the same input and output bases. This matrix is known as the identity matrix.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="26" LastEditDate="2019-03-30T07:58:53.257" LastActivityDate="2019-03-30T07:58:53.257" Title="Nielsen &amp; Chuang Exercise 2.4 - “Matrix representation for identity”" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2019-01-07T15:10:50.953" ContentLicense="CC BY-SA 4.0" />
  <row Id="2488" PostTypeId="2" ParentId="2487" CreationDate="2018-06-27T15:04:26.587" Score="2" Body="&lt;p&gt;On a vector space $V = \textrm{span}(\{|v_1⟩, \ldots, |v_n⟩\})$, the identity operator $\mathcal{I}$ maps each vector to itself, such that &#xA;$$&#xA;\mathcal{I} = \sum_i |v_i⟩⟨v_i|.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $\{|v_1⟩, \ldots, |v_n⟩\}$ is chosen as the basis for the matrix representation, then we set&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;|v_1⟩ = \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix}, \quad |v_2⟩ = \begin{pmatrix} 0 \\ 1 \\ \vdots \\ 0 \end{pmatrix}, \quad \cdots \quad |v_n⟩ = \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 1 \end{pmatrix},&#xA;$$&lt;br&gt;&#xA;and $⟨v_1| = (|v_1⟩)^\dagger$ such that &#xA;$$&#xA;|v_1⟩⟨v_1| = \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \end{pmatrix} = \textrm{diag}(1,0,\ldots,0) , \quad\textrm{etc}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summing over all terms therefore produces the desired matrix&#xA;$$&#xA;\mathcal{I} = &#xA;\begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; \cdots &amp;amp; 0 \\ &#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 1 &#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-27T15:04:26.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2489" PostTypeId="1" AcceptedAnswerId="2495" CreationDate="2018-06-27T20:17:54.900" Score="6" ViewCount="424" Body="&lt;p&gt;&lt;a href=&quot;https://medium.com/@decodoku/understanding-quantum-computers-through-a-simple-puzzle-game-a290dde89fb2&quot; rel=&quot;noreferrer&quot;&gt;Using a simple puzzle game to benchmark quantum computers&lt;/a&gt; is the most clever approach I have seen so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author of the aforementioned article, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/409/james-wootton&quot;&gt;James&lt;/a&gt;, makes a nice analogy to buying a laptop (&quot;more than just a single number when comparing&quot;) in an answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1255/how-should-different-quantum-computing-devices-be-compared&quot;&gt;How should different quantum computing devices be compared?&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another answer by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/274/whurley&quot;&gt;whurley&lt;/a&gt; to the same question mentions the &lt;a href=&quot;https://standards.ieee.org/develop/project/7131.html&quot; rel=&quot;noreferrer&quot;&gt;IEEE Standard for Quantum Computing Performance Metrics &amp;amp; Performance Benchmarking&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/65/when-will-we-know-that-quantum-supremacy-has-been-reached&quot;&gt;When will we know that quantum supremacy has been reached?&lt;/a&gt; there is an answer by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/124/niel-de-beaudrap&quot;&gt;Niel&lt;/a&gt; which includes this snippet:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But the bottom line is that, yes, &quot;quantum supremacy&quot; is precisely about &quot;not being able to simulate quantum computers of certain sizes&quot;, or at least &lt;strong&gt;not being able to simulate certain specific processes that you can have them perform&lt;/strong&gt;, and &lt;strong&gt;&lt;em&gt;this benchmark&lt;/em&gt;&lt;/strong&gt; depends not only on quantum technology but on the best available classical technology and the best available classical techniques. It is a blurry boundary which, if we are being serious about things, we will only be confident that we have passed a year or two after the fact. But it is an important boundary to cross.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My question is bipartite:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What will be the &lt;strong&gt;primary metrics for quantum computers?&lt;/strong&gt; (Clasical examples include processor speed, RAM &amp;amp; hard drive space)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Best tools / strategies for benchmarking&lt;/strong&gt;  above metrics? (Existing or proposed)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-06-27T20:47:55.287" LastActivityDate="2018-06-28T07:36:10.777" Title="How to benchmark a quantum computer?" Tags="&lt;algorithm&gt;&lt;quantum-advantage&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2490" PostTypeId="1" AcceptedAnswerId="2494" CreationDate="2018-06-27T22:13:57.977" Score="4" ViewCount="126" Body="&lt;p&gt;On page 2 of the paper &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations (Cao &lt;em&gt;et al.&lt;/em&gt;,2012)&lt;/a&gt; there's this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DUzV6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DUzV6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It further says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After the inverse Fourier transform is executed on register $C$, we&#xA;  use its $|\lambda_j\rangle$ states stored in register $C$ &lt;strong&gt;as a&#xA;  control&lt;/strong&gt; for a Hamiltonian simulation $\exp(iH_0t_0)$ that is applied&#xA;  on register $M$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But then again:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We further establish the &lt;strong&gt;control relation&lt;/strong&gt; between Register $L$ and&#xA;  $\exp[-ip\left(\dfrac{\lambda_j}{2^m}\dfrac{1}{2^{l-k_l}}\right)t_0]$&#xA;  simulation that acts on register $M$. The values of the binary numbers&#xA;  stored in register $L$ are then able to determine the time parameter&#xA;  $t$ in overall Hamiltonian simulation $\exp(-iH_0t)$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From here, I'm a bit confused &lt;strong&gt;which register of qubits&lt;/strong&gt; is being used to control the Hamiltonian simulation $\exp(-iH_0t)$. Are both registers: $L$ and $C$ being used as &quot;control&quot;? How does control by multiple registers work? (I only know how control by a single register of qubits works, as of now)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T13:34:35.787" LastActivityDate="2018-12-23T13:34:35.787" Title="How are two different registers being used as &quot;control&quot;?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2491" PostTypeId="1" AcceptedAnswerId="17117" CreationDate="2018-06-27T23:10:34.733" Score="10" ViewCount="2354" Body="&lt;p&gt;I'm at the AQC conference at NASA and everybody seems to suddenly be talking about the &lt;a href=&quot;http://qserver.usc.edu/qec11/slides/Brooks_QEC11.pdf&quot; rel=&quot;noreferrer&quot;&gt;Bacon-Shor&lt;/a&gt; code but there is no Wikipedia page and the pdf that I gave a link to does not really explain what it is and how it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does it compare to the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1845/intuition-for-shor-code-failure-probability&quot;&gt;Shor code&lt;/a&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-04-16T16:05:33.037" Title="What is a Bacon-Shor code and what is its significance?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="4" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2492" PostTypeId="2" ParentId="2491" CreationDate="2018-06-27T23:50:58.107" Score="0" Body="&lt;p&gt;&lt;strong&gt;Shor Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can detect and correct arbitrary single qubit errors, but if there are 2 or more single qubit errors before a correction round, the correction will fail. -&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1845/intuition-for-shor-code-failure-probability&quot;&gt;Intuition for Shor code failure probability&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bacon-Shor Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Bacon-Shor codes, quantum subsystem codes which are well suited for applications to fault-tolerant quantum memory because the error syndrome can be extracted by performing two-qubit measurements. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0610088&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Bacon-Shor codes&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Contrarily to Shor's code, these stabilizers cannot identify the precise qubit on which a bit-flip occurs, they can only identify the column in which it occurs. - &lt;a href=&quot;https://books.google.com/books?id=XV9sAAAAQBAJ&amp;amp;pg=PA172&amp;amp;lpg=PA172&amp;amp;dq=difference+between+%22shor%27s+code%22+and+bacon-shor+code&amp;amp;source=bl&amp;amp;ots=zs1Mq6kjUW&amp;amp;sig=wdqFiz718SC_A_qi-fJ1ketyElM&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=0ahUKEwichMWl__TbAhXKsFQKHdMRAlgQ6AEIXzAH#v=onepage&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For the $[[n^2, 1, n]]$ Bacon-Shor code the qubits are laid out in&#xA;  a 2D n × n square array. It is also possible to work with asymmetric Bacon-Shor codes with qubits in a n × m array. - &lt;a href=&quot;https://arxiv.org/abs/1302.3428&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction for Quantum Memories pg. 34&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We have shown that for every generalized Shor code&#xA;  there is an subsystem code with the same parameters but&#xA;  which requires significantly fewer stabilizer measurements&#xA;  in order to perform quantum error correction. - &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0610088&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correcting Subsystem Codes From Two Classical Linear Codes&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Also, here is a video from Microsoft &lt;a href=&quot;https://www.youtube.com/watch?v=-bFz58qMogQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;Universal Fault-Tolerant Computing with Bacon-Shor Codes&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-06-28T01:28:50.007" LastActivityDate="2018-06-28T01:28:50.007" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2493" PostTypeId="2" ParentId="2491" CreationDate="2018-06-28T05:03:40.200" Score="1" Body="&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: This answer is based on what I deduced from a brief Googling session. I might make further additions/improvements as and when I will understand the details more thoroughly. Feel free to make suggestions in the comments.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;strong&gt;$9$-qubit Shor code&lt;/strong&gt; $[[9,1,3]]$ (qubits laid in a $3\times 3$ lattice) is the &lt;strong&gt;smallest member&lt;/strong&gt; in the family of &lt;strong&gt;$m^2$-qubit Bacon-Shor code(s)&lt;/strong&gt; $[[m^2,1,m]]$ (qubits laid in a $m\times m$ lattice). &lt;strong&gt;Shor's code&lt;/strong&gt;, as you know, can correct both Pauli &lt;strong&gt;sign flip&lt;/strong&gt; and Pauli &lt;strong&gt;bit-flip&lt;/strong&gt; errors in a single qubit. Moreover, to correct &lt;em&gt;any&lt;/em&gt; single-qubit error (with a high probability), it is sufficient to be able to correct against any single qubit Pauli error.&lt;sup&gt;[1]&lt;/sup&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PN3Mh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PN3Mh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;strong&gt;Bacon-Shor code(s)&lt;/strong&gt; is(/are) a &lt;em&gt;generalization&lt;/em&gt; of this concept to noise models where the qubit&lt;strong&gt;s&lt;/strong&gt; in a code block are subject to both &lt;strong&gt;bit-flip&lt;/strong&gt; errors with probability $p_X$ and &lt;strong&gt;dephasing&lt;/strong&gt; errors with probability $p_Z$. The noise is assumed to act independently on each qubit and the $X$ and $Z$ errors are uncorrelated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BDwUb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BDwUb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In (Napp and Preskill, 2013) the authors find that the optimally-sized Bacon-Shor code for equal $X$ and $Z$ errors rate $p$ is given by $m=\frac{\log 2}{4p}$ and for that optimal choice they can bound the logical $X$(or $Z$) error rate as $\tilde p(p) \lesssim \exp(\frac{-0.06}{p})$&lt;sup&gt;[2]&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible to work with &lt;strong&gt;asymmetric Bacon-Shor codes&lt;/strong&gt; with qubits in an $n \times m$ array. Asymmetric codes can have better performance when, say, $Z$ errors are more likely than $X$ errors&lt;sup&gt;[3]&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1302.3428&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction for Quantum Memories (Barbara M. Terhal, 2015)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1209.0794&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Bacon-Shor codes (Napp &amp;amp; Preskill, 2012)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1211.1400&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fault-tolerant quantum computation with asymmetric Bacon-Shor codes (Brooks &amp;amp; Preskill, 2013)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-06-28T05:25:39.277" LastActivityDate="2018-06-28T05:25:39.277" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2494" PostTypeId="2" ParentId="2490" CreationDate="2018-06-28T07:22:43.483" Score="2" Body="&lt;p&gt;You can see from the circuit diagram that in the third-last slice, both registers $L$ and $C$ are being used as controls. There's no problem with two registers being controls, after all, that's exactly what a Toffoli (controlled-controlled-NOT) gate does. It probably helps to explicitly write down what transformation they're talking about. I'll call it $U$. (I'm mostly extrapolating this from what you've written, rather than delving extensively into the paper or references.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before I do that, I just want to change notation slightly, because what I see there, I find slightly misleading. If the eigenvalues of $At_0$ are $\lambda_j$, then the states of the register $C$ might better be written as $k\in\{0,1\}^t$ (assuming $t$ qubits are being used) with $\lambda_jt_0=2\pi k/2^t$. You could say that $|\lambda_j\rangle$ is an appropriate label for the ket, but it makes me think of the eigenvector, rather than the binary representation of the (rescaled) eigenvalue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having done that, we have&#xA;$$&#xA;U=\sum_{k\in\{0,1\}^t}\sum_{s\in\{0,1\}^l}\sum_{p\in\{0,1\}^m}|k\rangle\langle k|_C\otimes|s\rangle\langle s|_L\otimes|p\rangle\langle p|_Me^{-i2\pi p k \frac{f(s)}{2^{t+m+l}}}&#xA;$$&#xA;where $f(s)$ is some function of $s$ that I haven't entirely understood yet - I'm finding the paper quite opaque on that point, although figure 6 probably helps a bit. I &lt;em&gt;think&lt;/em&gt; it's simply&#xA;$$&#xA;f(s)=\sum_{q=1}^l\frac{s_q}{2^{-q}}=s&#xA;$$&#xA;(where the final answer is $s$ represented as a decimal, rather than binary). To explain: we go through each bit value and controlled off its value, add a phase. So the value $s_q$ indicates whether the $q^{th}$ bit is controlling, and the contributed phase is $1/2^{-q}=2^q$. A product of phases means we look at the sum of the arguments. Where I'm using $q$, the paper uses $k_l$, I think, which is, I think, not supposed to be the $l^{th}$ bit of the $k$ index we're using on register $C$. $\sum_qs_q2^q$ is just the decimal representation of a binary string.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-06-28T08:04:12.663" LastActivityDate="2018-06-28T08:04:12.663" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2495" PostTypeId="2" ParentId="2489" CreationDate="2018-06-28T07:36:10.777" Score="1" Body="&lt;p&gt;This may not exactly answer your question (which I suspect is still very much an open question, and what you're likely to get as answers are opinions), but have you looked at &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0025-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;blind quantum computation&lt;/a&gt;? See &lt;a href=&quot;https://arxiv.org/abs/0810.5375&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for another perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way that we can describe that premise is to imagine some company claims to have developed a fabulous universal quantum computer. But it's so expensive, difficult to control etc. that only they can be trusted to run stuff on it, and it's not directly open for use by other people. How do you know it's really running as a quantum computer, and not just that, for example, they have some new classical algorithm that can simulate quantum computations better than we were expecting?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blind quantum computation achieves this by making the quantum computer perform a computation without knowing what that computation actually is! The company who owns the computer is left blind to what it's supposed to be doing, so their cheating strategies are severely curtailed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I assume that this method would not be applicable to the quantum supremacy scenario.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-28T07:36:10.777" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2496" PostTypeId="1" AcceptedAnswerId="2498" CreationDate="2018-06-28T09:08:57.430" Score="7" ViewCount="456" Body="&lt;p&gt;I would like to represent the state of a qubit on a Bloch sphere from the measurements made with Q#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.measure&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, it is possible to measure a qubit in the different Pauli bases (PauliX, PauliY, PauliZ). This returns &lt;code&gt;Zero&lt;/code&gt; if the +1 eigenvalue is observed, and &lt;code&gt;One&lt;/code&gt; if the −1 eigenvalue is observed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can repeat this several times to find the probabilities for each base. Unfortunately, from there, I don't know how to calculate the density matrix or the X, Y, Z coordinates needed to plot the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to find the density matrix or the X, Y, Z coordinates from these measurements? If yes, how ? &lt;/p&gt;&#xA;" OwnerUserId="2782" LastEditorUserId="2782" LastEditDate="2020-04-15T12:37:02.717" LastActivityDate="2020-04-15T12:37:02.717" Title="From Q# measurements to Bloch sphere" Tags="&lt;programming&gt;&lt;q#&gt;&lt;density-matrix&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2497" PostTypeId="2" ParentId="2486" CreationDate="2018-06-28T09:24:44.050" Score="8" Body="&lt;p&gt;Reformulating your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How to perform Hamiltonian Simulation for a generic square matrix $A$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quick answer&lt;/strong&gt;: it is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of Hamiltonian Simulation (HS) is to find a quantum circuit (i.e. a succession of gates) that acts like $U(t) = e^{-iAt}$ on a quantum state. Here $U(t)$ needs to be unitary (because of the properties of quantum gates) and so $e^{-iAt}$ needs also to be unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the HS algorithm is only applicable to matrices $A$ such that $e^{-iAt}$ is unitary. Every hermitian matrix satisfy this property, but not every &lt;code&gt;generic square matrix&lt;/code&gt; does. Depending on your problem, this limitation may or may not be an issue but you can't use HS if $e^{-iAt}$ is not unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example for the &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; (that use HS of $A$ as a subroutine) with a system $Ax=b$, if $e^{-iAt}$ is not unitary you can instead consider the problem&#xA;$$Cy = \begin{pmatrix} 0 &amp;amp; A \\ A^\dagger &amp;amp; 0 \end{pmatrix} \begin{pmatrix} 0 \\ x\end{pmatrix} = \begin{pmatrix}b \\ 0\end{pmatrix},$$ &#xA;solve it with HHL (which is now possible because the new matrix $C$ is hermitian) and recover $x$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the interesting question is now:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How to perform Hamiltonian Simulation for a given hermitian matrix $A$?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And the answer will depend on the properties of $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a huge research topic and there are plenty of things to say on it. I will not present every methods here as they are quite complicated and I did not understand all of them. Here is a list of papers/presentations that are related to HS and that may be interesting to start with HS:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.cs.umd.edu/~amchilds/talks/ibm13.pdf&quot; rel=&quot;noreferrer&quot;&gt;Simulating Hamiltonian dynamics on a small quantum computer&lt;/a&gt;: slides about HS. Even if it is a presentation, this is the most complete source I found on Hamiltonian Simulation. It presents quickly 3 different methods and cites interesting papers for each method.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.cs.umd.edu/~amchilds/qa/qa.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture Notes on Quantum Algorithms (Andrew M. Childs, 2017)&lt;/a&gt;: recent and rather complete. HS is discussed in chapter 25 (page 123).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1312.1414v2&quot; rel=&quot;noreferrer&quot;&gt;Exponential improvement in precision for simulating sparse Hamiltonians&lt;/a&gt;: presents in details one of the 3 methods presented in 1.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0508139.pdf&quot; rel=&quot;noreferrer&quot;&gt;Efficient quantum algorithms for simulating sparse Hamiltonians&lt;/a&gt;: presents in details another of the 3 methods presented in 1. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-06-28T09:24:44.050" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2498" PostTypeId="2" ParentId="2496" CreationDate="2018-06-28T11:40:24.460" Score="5" Body="&lt;p&gt;The problem you are describing (i.e. finding an approximation of some state given some number of identical copies of it and some set of measurements) is known as &lt;em&gt;quantum state tomography&lt;/em&gt; or &lt;em&gt;state tomography&lt;/em&gt; for short.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practise, the most efficient schemes for state tomography will depend on a specific experiment's setup and limitations, for which different protocols exist (see the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page&lt;/a&gt; for an overview). Because the efficiency scaling of state tomography is notoriously bad in general, finding optimal tomography schemes for particular scenarios is an active area of research.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, for the rest of this answer I will assume that efficiency scalings are not important for what you want to do and describe the general theory behind state tomography on a single qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be shown that any density matrix can be written out as a linear combination of Pauli matrices, such that&#xA;$$&#xA;\rho = \frac{1}{2}(I + x\sigma_x + y\sigma_y + z\sigma_z) = \frac{1}{2} (I + \vec{r} \cdot \vec{\sigma})&#xA;$$&#xA;where $\vec{\sigma} = (\sigma_x, \sigma_y, \sigma_z)$ and $\vec{r} = (x, y, z)$ is the so-called &lt;em&gt;Bloch vector&lt;/em&gt; representing the coordinates on the Bloch sphere you reference above. To find these, we observe that&#xA;$$&#xA;x = \textrm{Tr}(\rho \sigma_x) = \langle \sigma_x \rangle_\rho, \quad y = \textrm{Tr}(\rho \sigma_y) = \langle \sigma_y \rangle_\rho, \quad z = \textrm{Tr}(\rho \sigma_z) = \langle \sigma_z \rangle_\rho.&#xA;$$&#xA;and so each the amplitude of each component of the Bloch vector is given by the expectation value of it's associated Pauli operator on $\rho$. Recall that the expectation value $\langle A \rangle_\rho$ is given by the average over all eigenvalues returned by measurement of $A$ on $\rho$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to find the state's Bloch vector, just perform each Pauli measurements many times to find the respective expectation value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, to retrieve the matrix representation of $\rho$, simply recall that &#xA;$$&#xA;I = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix}, \quad &#xA;\sigma_x = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} \quad&#xA;\sigma_y = \begin{pmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{pmatrix} \quad&#xA;\sigma_z = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{pmatrix},&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\rho = \frac{1}{2} \begin{pmatrix} 1 + z &amp;amp; x - iy \\ x + iy &amp;amp; 1 - z \end{pmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Useful links and further reading:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://atom.physik.unibas.ch/fileadmin/user_upload/atom-physik-unibas-ch/Publications/People_Publications/Schmied2016a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum state tomography of a single qubit: comparison of methods&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://research.physics.illinois.edu/QI/Photonics/tomography-files/tomo_chapter_2004.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Quantum State Tomography&quot; chapter from &quot;Quantum State Estimation&quot; textbook&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Afterword&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By extending this protocol to two qubits we can flavour of why state tomography is not scalable in general. For two qubits $\rho_1$ and $\rho_2$ the combined state $\rho_{1,2} = \rho_1 \otimes \rho_2$ is given by&#xA;\begin{align}&#xA;\rho_{1,2} = \frac{1}{2} (I + \vec{r}_1 \cdot \vec{\sigma}_1) \otimes \frac{1}{2} (I + \vec{r}_2 \cdot \vec{\sigma}_2)&#xA;\end{align}&#xA;which is going to contain $4^2 = 16$ components, one for each $2$-fold Pauli operator. Clearly a strategy that requires $4^n$ different expectation values to be estimated to recover an $n$-qubit state is unfeasible for even small systems of qubits. So this is where the aforementioned research comes in.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-06-28T14:24:47.007" LastActivityDate="2018-06-28T14:24:47.007" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2499" PostTypeId="1" AcceptedAnswerId="2552" CreationDate="2018-06-28T14:11:42.940" Score="157" ViewCount="36313" Body="&lt;p&gt;I have a computer science degree. I work in IT, and have done so for many years. In that period &quot;classical&quot; computers have advanced by leaps and bounds. I now have a terabyte disk drive in my bedroom drawer amongst my socks, my phone has phenomenal processing power, and computers have revolutionized our lives. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as far as I know, quantum computing hasn't done anything. Moreover it looks like it's going to stay that way. Quantum computing has been around now for the thick end of forty years, and real computing has left it in the dust. See the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Timeline&quot; rel=&quot;noreferrer&quot;&gt;timeline&lt;/a&gt; on Wikipedia, and ask yourself &lt;em&gt;where's the parallel adder?&lt;/em&gt; Where's the equivalent of Atlas, or the MU5? I went to Manchester University, see the history on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Manchester_computers#MU5&quot; rel=&quot;noreferrer&quot;&gt;Manchester Computers&lt;/a&gt; article on Wikipedia. Quantum computers don't show similar progress. Au contraire, it looks like they haven't even got off the ground. You won't be buying one in PC World any time soon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will you ever be able to? Is it all hype and hot air? Is quantum computing just pie in the sky? Is it all just jam-tomorrow woo peddled by quantum quacks to a gullible public? If not, &lt;em&gt;why not?&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="1905" LastEditorUserId="26" LastEditDate="2018-12-14T05:47:18.787" LastActivityDate="2020-12-14T20:00:26.617" Title="Is quantum computing just pie in the sky?" Tags="&lt;classical-computing&gt;&lt;applications&gt;&lt;history&gt;" AnswerCount="13" CommentCount="2" FavoriteCount="76" ContentLicense="CC BY-SA 4.0" />
  <row Id="2500" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T14:57:06.110" Score="35" Body="&lt;p&gt;Classical computing has been around longer than quantum computing. The early days of classical computing is similar to what we are experiencing now with quantum computing.  The &lt;a href=&quot;https://en.wikipedia.org/wiki/Z3_(computer)&quot; rel=&quot;noreferrer&quot;&gt;Z3&lt;/a&gt; (First Turing complete electronic device) built in the 1940s was the size of a room and less powerful than your phone. This speaks to the phenomenal progress we have experienced in classical computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dawn of quantum computing on the other hand, did not start until the &lt;a href=&quot;https://en.wikipedia.org/wiki/Timeline_of_quantum_computing#1980s&quot; rel=&quot;noreferrer&quot;&gt;1980s&lt;/a&gt;. Shor's factoring algorithm; the discovery that jump-started the field was discovered in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Timeline_of_quantum_computing#1990s&quot; rel=&quot;noreferrer&quot;&gt;1990s&lt;/a&gt;. This was followed a few years later with the first experimental demonstration of a quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is evidence that quantum computers can work. There is a tremendous amount of progress on the experimental and theoretical aspects of this field every year and there is no reason to believe that it's going to stop. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;noreferrer&quot;&gt;Quantum threshold theorem&lt;/a&gt; states that large scale quantum computing is possible if the error rates for physical gates are below a certain threshold. We are approaching (some argue that we are already there) this threshold for small systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's good to be skeptical about the usefulness of quantum computation. In fact, it's encouraged! It's also natural to compare the progress of quantum computation with classical computation; forgetting that quantum computers are more difficult to build than classical computers.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2018-07-04T02:43:10.333" LastActivityDate="2018-07-04T02:43:10.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2501" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T14:59:34.523" Score="21" Body="&lt;p&gt;Early classical computers were built with existing technology. For example, vacuum tubes were invented around four decades before they were used to make Colossus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum computers, we need to invent the technology before we make the computer. And the technology is so beyond what had previous existed, that just this step has taken a few decades.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we pretty much have our quantum versions of vacuum tubes. So expect a Colossus in a decade or so.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-06-28T14:59:34.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2502" PostTypeId="2" ParentId="2496" CreationDate="2018-06-28T15:27:26.337" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2498/2782&quot;&gt;SLesslyTall's answer&lt;/a&gt; is correct and very well explained. Let me add a little explanation on the interpretation of the return value of the Q# measurement function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you measure many times a qubit with the state $|1\rangle$, here are the results you get :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Measurements in the Pauli $X$ basis : 50% of &lt;code&gt;Zero&lt;/code&gt; and 50% of &lt;code&gt;One&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measurements in the Pauli $Y$ basis : 50% of &lt;code&gt;Zero&lt;/code&gt; and 50% of &lt;code&gt;One&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measurements in the Pauli $Z$ basis : 0% of &lt;code&gt;Zero&lt;/code&gt; and 100% of &lt;code&gt;One&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As explained in the &lt;a href=&quot;https://docs.microsoft.com/fr-fr/qsharp/api/prelude/microsoft.quantum.primitive.measure?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, the function returns &lt;code&gt;Zero&lt;/code&gt; for the $+1$ eigenvalue and &lt;code&gt;One&lt;/code&gt; for the $-1$ eigenvalue. So to find $x$, $y$, $z$ you have to perform the following calculations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$x = 0.5 \cdot 1 + 0.5 \cdot (-1) = 0.5 - 0.5 = 0$&lt;/li&gt;&#xA;&lt;li&gt;$y = 0.5 \cdot 1 + 0.5 \cdot (-1) = 0.5 - 0.5 = 0$&lt;/li&gt;&#xA;&lt;li&gt;$z = 0 \cdot 1 + 1 \cdot (-1) = 0 - 1 = -1$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then to get the density matrix, you can use the formula given by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2498/2782&quot;&gt;SLesslyTall&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\rho = \frac{1}{2}\begin{pmatrix}1+z&amp;amp;x-iy\\x+iy&amp;amp;1-z\end{pmatrix} = \frac{1}{2}\begin{pmatrix}1+(-1)&amp;amp;0-i0\\0+i0&amp;amp;1-(-1)\end{pmatrix} = \frac{1}{2}\begin{pmatrix}0&amp;amp;0\\0&amp;amp;2\end{pmatrix} = \begin{pmatrix}0&amp;amp;0\\0&amp;amp;1\end{pmatrix}$&lt;/p&gt;&#xA;" OwnerUserId="2782" LastActivityDate="2018-06-28T15:27:26.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2503" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T16:46:44.810" Score="9" Body="&lt;p&gt;Why would you expect two different technologies to advance at the same rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply put, quantum computers can be immensely more powerful but are immensely harder to build than classical computers. The theory of their operation is more complicated and based on recent physics, there are greater theoretical pitfalls and obstacles that inhibit their scaling up in size, and their design requires much more sophisticated hardware which is harder to engineer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nearly every stage of development of a quantum computer is inanalogous to that of a classical computer. So a question for you; why compare them?&lt;/p&gt;&#xA;" OwnerUserId="2591" LastEditorUserId="2591" LastEditDate="2018-06-28T20:36:11.697" LastActivityDate="2018-06-28T20:36:11.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2504" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T16:52:20.277" Score="94" Body="&lt;p&gt;Your question is sort of &amp;quot;opinion-based&amp;quot;, but yet, there are a few important points to be made. &lt;strong&gt;Theoretically&lt;/strong&gt;, there's no &lt;em&gt;convincing&lt;/em&gt; argument (yet) as to why quantum computers aren't practically realizable. But, do check out: &lt;a href=&quot;http://www.ma.huji.ac.il/%7Ekalai/Qitamar.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Quantum Computers Fail: Quantum Codes, Correlations in Physical Systems, and Noise Accumulation - Gil Kalai&lt;/a&gt;, and the &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=902&quot; rel=&quot;nofollow noreferrer&quot;&gt;related blog post by Scott Aaronson&lt;/a&gt; where he provides some convincing arguments against Kalai's claims. Also, read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1795/26&quot;&gt;James Wotton's answer&lt;/a&gt; to the related QCSE post: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1794/is-gil-kalais-argument-against-topological-quantum-computers-sound&quot;&gt;Is Gil Kalai&amp;#39;s argument against topological quantum computers sound?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://mathoverflow.net&quot;&gt;Math Overflow&lt;/a&gt; has a great summary: &lt;a href=&quot;https://mathoverflow.net/questions/302492/on-mathematical-arguments-against-quantum-computing&quot;&gt;On Mathematical Arguments Against Quantum Computing&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, yes, of course, there are &lt;strong&gt;engineering problems&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Problems (adapted from &lt;a href=&quot;https://arxiv.org/abs/cs/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:cs/0602096&lt;/a&gt;):&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sensitivity to interaction with the environment:&lt;/strong&gt; Quantum computers are extremely sensitive to interaction with the surroundings since&#xA;any interaction (or measurement) leads to a collapse of the state function. This&#xA;phenomenon is called decoherence. It is extremely difficult to isolate a quantum system, especially an engineered one for a computation, without it getting entangled with the environment. The larger the number of qubits the harder is it to maintain the coherence.&lt;/p&gt;&#xA;&lt;p&gt;[Further reading: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Quantum_decoherence&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Quantum decoherence&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unreliable quantum gate actions:&lt;/strong&gt; Quantum computation on qubits is accomplished by operating upon them with an array of transformations that are implemented in principle using small gates. It is imperative that no phase errors be introduced in these transformations. But practical schemes are likely to introduce such errors. It is also possible that the quantum register is already entangled with the environment even before the beginning of the computation. Furthermore, uncertainty in initial phase&#xA;makes calibration by rotation operation inadequate. In addition, one must consider the relative lack of precision in the classical control that&#xA;implements the matrix transformations. This lack of precision cannot be completely compensated for by the quantum algorithm.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Errors and their correction:&lt;/strong&gt;  Classical error correction employs redundancy. The simplest way is to store the information multiple times, and — if these copies are later found to disagree — just take a majority vote; e.g. Suppose we copy a bit three times. Suppose further that a noisy error corrupts the three-bit state so that one bit is equal to zero but the other two are equal to one. If we assume that noisy errors are independent and occur with some probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, it is most likely that the error is a single-bit error and the transmitted message is three ones. It is possible that a double-bit error occurs and the transmitted message is equal to three zeros, but this outcome is less likely than the above outcome. Copying quantum information is not possible due to the no-cloning theorem. This theorem seems to present an obstacle to formulating a theory of quantum error correction. But it is possible to spread the information of one qubit onto a highly entangled state of several (physical) qubits. Peter Shor first discovered this method of formulating a quantum error correcting code by storing the information of one qubit onto a highly entangled state of nine qubits. However, quantum error correcting code(s) protect quantum information against errors of only some limited forms. Also, they are efficient only for errors in a small number of qubits. Moreover, the number of qubits needed to correct errors doesn't normally scale well with the number of qubits in which error actually occurs.&lt;/p&gt;&#xA;&lt;p&gt;[Further reading: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Quantum error correction&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Constraints on state preparation:&lt;/strong&gt; State preparation is the essential first step to be considered before the beginning of any quantum computation. In most schemes, the qubits need to be in a &lt;em&gt;particular&lt;/em&gt; superposition state for the quantum computation to proceed correctly. But creating arbitrary states precisely can be exponentially hard (in both time and resource (gate) complexity).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum information, uncertainty, and entropy of quantum gates:&lt;/strong&gt;&#xA;Classical information is easy to obtain by means of interaction with the system. On the other hand, the impossibility of cloning means that any specific unknown state cannot be determined. This means that unless the system has specifically been prepared, our ability to control it remains limited. The average information of a system is given by its entropy. The determination of entropy would depend on the statistics obeyed by the object.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;A requirement for low temperatures&lt;/strong&gt;: Several &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Developments&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum computing architectures&lt;/a&gt;&#xA;like &lt;a href=&quot;https://en.wikipedia.org/wiki/Superconducting_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;superconducting quantum computing&lt;/a&gt; require extremely low temperatures (close to absolute zero) for functioning.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Progress:&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Around a decade and a half, ago the &lt;strong&gt;decoherence time&lt;/strong&gt; for the so-called &amp;quot;quantum computers&amp;quot; were lesser than 1 nanosecond. Now, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nitrogen-vacancy_center&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Quantum Experience&lt;/a&gt; 16 qubit version which you can access online has a decoherence time ~100 μs (see: &lt;a href=&quot;https://arxiv.org/abs/1801.02363&quot; rel=&quot;nofollow noreferrer&quot;&gt;Demonstration of Envariance and Parity Learning on the IBM 16 Qubit Processor (Davide Ferrari &amp;amp; Michele Amoretti, 2018)&lt;/a&gt;). The decoherence time of 100 μs is sufficient to run simple quantum algorithms already! You can check it out yourself on the 5 qubit and 16 qubit quantum computers which have been made accessible online by IBM. I think Google has been able to achieve even better decoherence times with their superconducting chips (having an equivalent number of qubits).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There has been a lot of improvement in the area of &lt;strong&gt;quantum error correction&lt;/strong&gt; in the past decade (requiring a much lesser number of total qubits). See Quantum &lt;a href=&quot;https://arxiv.org/abs/1302.3428&quot; rel=&quot;nofollow noreferrer&quot;&gt;Error Correction for Quantum Memories (Terhal, 2015)&lt;/a&gt; for a brief review.&lt;/p&gt;&#xA;&lt;p&gt;Also, quoting: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction#Experimental_realization&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Quantum error correction - Experimental realization&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;There have been several experimental realizations of CSS-based codes.&#xA;The first demonstration was with NMR qubits. Subsequently,&#xA;demonstrations have been made with linear optics, trapped ions, and&#xA;superconducting (transmon) qubits. Other error-correcting codes have&#xA;also been implemented, such as one aimed at correcting for photon&#xA;loss, the dominant error source in photonic qubit schemes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Preparation of arbitrary quantum states&lt;/strong&gt; is still a major problem. But now at least we know the exact gate decomposition for any unitary evolution (&lt;a href=&quot;https://arxiv.org/abs/1003.5760&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum-state preparation with universal gate decompositions (Plesch &amp;amp; Brukner, 2011)&lt;/a&gt;), albeit the number of gates doesn't usually scale well with a number of qubits. There have been further improvements like in &lt;a href=&quot;https://arxiv.org/abs/1709.05279&quot; rel=&quot;nofollow noreferrer&quot;&gt;High-fidelity quantum state preparation using neighboring optimal control (Yuchen Peng &amp;amp; Frank Gaitan, 2017)&lt;/a&gt;. For some other recently developed high-precision methods of state preparation see &lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.4940696?journalCode=jmp&quot; rel=&quot;nofollow noreferrer&quot;&gt;The preparation of states in quantum mechanics (Fröhlich, 2016)&lt;/a&gt; and&#xA;&lt;a href=&quot;https://www.epj-conferences.org/articles/epjconf/abs/2017/31/epjconf_incape2017_01039/epjconf_incape2017_01039.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparation of quantum state (Ali et al.,2017)&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One of the main constraints we still have is &lt;strong&gt;number of qubits&lt;/strong&gt; (note that this issue is &lt;em&gt;intrinsically&lt;/em&gt; related to the difficulty of maintaining coherence for long periods of time c.f. &lt;a href=&quot;https://physics.stackexchange.com/questions/101560/schr%C3%B6dingers-cat-and-the-difficulty-of-macroscopic-superposition-state/267462&quot;&gt;Schrödinger's cat and the difficulty of macroscopic superposition state&lt;/a&gt; and the excellent answer therein). None of the present day quantum computers is sufficient to show any &lt;em&gt;considerable&lt;/em&gt; improvement in &amp;quot;capability&amp;quot; compared to classical computers. The largest number factorized by a quantum computer till date is 291311 (&lt;a href=&quot;https://arxiv.org/abs/1706.08061&quot; rel=&quot;nofollow noreferrer&quot;&gt;High-fidelity adiabatic quantum computation using the intrinsic Hamiltonian of a spin system: Application to the experimental factorization of 291311 (Li et al., 2017)&lt;/a&gt;). Brute-force factorization of 291311 takes at most ~270 divisions, each of which takes ~10 ns on modern CPUs. That's 3 us in total, implying that the factorization will be several orders of magnitude faster on your laptop. The practical improvement in time complexity won't be noticeable unless and until the number of qubits increases by &lt;em&gt;at least&lt;/em&gt; 10 times or so (I'm not considering the D-Wave machines which have over 1000 qubits, as they use a different mechanism known as quantum annealing which is effective only in a few narrow ranges of problems). But, arguably even the number of qubits is on a steady rise. Recently Google announced a 72 qubit machine (&#xA;&lt;a href=&quot;https://ai.googleblog.com/2018/03/a-preview-of-bristlecone-googles-new.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google AI blog: A Preview of Bristlecone, Google’s New Quantum Processor&lt;/a&gt;) and Intel announced a 49 qubit chip (&lt;a href=&quot;https://spectrum.ieee.org/tech-talk/computing/hardware/intels-49qubit-chip-aims-for-quantum-supremacy&quot; rel=&quot;nofollow noreferrer&quot;&gt;IEEE Spectrum:: CES 2018: Intel's 49-Qubit Chip Shoots for Quantum Supremacy&lt;/a&gt;). Compare that to the 2000s when we only used to have a single-digit number of qubits!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Several quantum computing architectures have been discovered in the past couple of decades, for which &lt;strong&gt;near-absolute-zero temperatures are not necessary&lt;/strong&gt;, for example, optical quantum computers, trapped-ion quantum computers, diamond-based quantum computers, etc. Cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/117/why-do-optical-quantum-computers-not-have-to-be-kept-near-absolute-zero-while-su&quot;&gt;Why do optical quantum computers not have to be kept near absolute zero while superconducting quantum computers do?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Conclusion:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Whether we will ever have efficient quantum computers which can visibly outperform classical computers in certain areas, is something which only time will say.&lt;/strong&gt; However, looking at the considerable progress we have been making, it probably wouldn't be too wrong to say that in a couple of decades we should have sufficiently powerful quantum computers. On the theoretical side though, we don't yet &lt;em&gt;know&lt;/em&gt; if classical algorithms (can) exist which will match quantum algorithms in terms of time complexity. See my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1585/26&quot;&gt;previous answer&lt;/a&gt; about this issue. &lt;strong&gt;From a completely theoretical perspective, it would also be &lt;em&gt;extremely&lt;/em&gt; interesting if someone can prove that all BQP problems lie in BPP or P!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I personally believe that in the coming decades we will be using a &lt;strong&gt;combination of quantum computing techniques and classical computing techniques&lt;/strong&gt; (i.e. either your PC will be having both classical hardware components as well as quantum hardware or quantum computing will be totally cloud-based and you'll only access online them from classical computers). Because remember that quantum computers are efficient only for a very narrow range of problems. It would be pretty resource-intensive and unwise to do an addition like 2+3 using a quantum computer (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1289/how-does-a-quantum-computer-do-basic-math-at-the-hardware-level&quot;&gt;How does a quantum computer do basic math at the hardware level?&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Now, coming to your point of whether &lt;strong&gt;national funds are unnecessarily being wasted on trying to build quantum computers&lt;/strong&gt;. My answer is &lt;strong&gt;NO&lt;/strong&gt;! Even if we fail to build legitimate and efficient quantum computers, we will still have gained &lt;strong&gt;a lot&lt;/strong&gt; in terms of &lt;strong&gt;engineering progress&lt;/strong&gt; and &lt;strong&gt;scientific progress&lt;/strong&gt;. Already research in photonics and superconductors has increased manyfold and we are beginning to understand a lot of physical phenomena better than ever before. Moreover, quantum information theory and quantum cryptography have led to the discovery of a few neat mathematical results and techniques which may be useful in a lot of other areas too (cf. &lt;a href=&quot;https://physics.stackexchange.com/questions/40834/mathematically-challenging-areas-in-quantum-information-theory-and-quantum-crypt/40848&quot;&gt;Physics SE: Mathematically challenging areas in Quantum information theory and quantum cryptography&lt;/a&gt;). We will also have understood a lot more about some of the &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science&quot; rel=&quot;nofollow noreferrer&quot;&gt;hardest problems in theoretical computer science&lt;/a&gt; by that time (even if we fail to build a &amp;quot;quantum computer&amp;quot;).&lt;/p&gt;&#xA;&lt;h2&gt;Sources and References:&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/cs/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;Difficulties in the Implementation of Quantum Computers (Ponnath, 2006)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Quantum computing&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Quantum error correction&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Addendum:&lt;/h2&gt;&#xA;&lt;p&gt;After a bit of searching, I found a very nice &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec14.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; which outlines almost all of Scott Aaronson's counter-arguments against the quantum computing skepticism. I &lt;strong&gt;very highly recommend&lt;/strong&gt; going through all the points given in there. It's actually &lt;strong&gt;part 14&lt;/strong&gt; of the &lt;a href=&quot;https://www.scottaaronson.com/democritus/default.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; put up by Aaronson on his website. They were used for the course PHYS771 at the University of Waterloo. The lectures notes are based on his popular textbook &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0521199565&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Since Democritus&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="2293" LastEditDate="2020-12-14T20:00:26.617" LastActivityDate="2020-12-14T20:00:26.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2505" PostTypeId="1" AcceptedAnswerId="2520" CreationDate="2018-06-28T18:20:31.200" Score="8" ViewCount="353" Body="&lt;p&gt;I'm just starting of on quantum computing, specifically following the IBM Q Experience documentation &lt;sup&gt;[1]&lt;/sup&gt;. In here, they are explaining the following experiment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T|+\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expected outcomes according to the document:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Phase angle: $\pi/4$ &lt;/li&gt;&#xA;&lt;li&gt;Gates: $T$&lt;/li&gt;&#xA;&lt;li&gt;Prob 0: 0.8535533  &lt;/li&gt;&#xA;&lt;li&gt;Prob 1: 0.1464466 &lt;/li&gt;&#xA;&lt;li&gt;X-length: 0.7071067&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm trying to deduce this with math. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T |+\rangle = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\pi/4}\end{bmatrix} {1\over\sqrt 2} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = {1\over\sqrt 2} \begin{bmatrix}1\\e^{i\pi/4}\end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I now need to split this out in $|0\rangle$ and $|1\rangle$ so that I get the quantum amplitudes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ = {1\over\sqrt 2} \begin{bmatrix}1\\0\end{bmatrix} + {1\over\sqrt 2} e^{i\pi/4} \begin{bmatrix}0 \\1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here things are falling apart, as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ P(0) = |{1\over\sqrt 2}|^2 = 0.5 $ &lt;br&gt;&#xA;$ P(1) = |{1\over\sqrt 2} e^{i\pi/4}|^2 = 0.5 $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question: &lt;strong&gt;How do I correctly calculate the probabilities and the X-length?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/002-The_Weird_and_Wonderful_World_of_the_Qubit/003-Introducing_qubit_phase.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q: User Guide / The Weird and Wonderful World of the Qubit / Introducing Qubit Phase&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="26" LastEditDate="2018-12-23T13:33:04.140" LastActivityDate="2018-12-23T13:33:04.140" Title="What are the P(0) and P(1) probabilities for the T transformation in quantum computing?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2506" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T18:48:09.817" Score="8" Body="&lt;p&gt;The sad truth for most of the people here is that John Duffield (the asker) is right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no proof that a quantum computer will ever be of any value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for the companies that have invested in quantum computing (IBM, Google, Intel, Microsoft, etc.), it is entirely worth it to try to build one, because if they are successful they will be able to solve some problems exponentially faster than classical computers, and if they are not successful no dent has been put in the billions of dollars they have available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The attempt to build useful quantum computers, which you can call a failure so far, has at least lead to advances in understanding superconductors, photonics, and even quantum theory itself. A lot of mathematics used for analyzing quantum mechanics, was developed in the context of quantum information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally, quantum computers might never be marketable, but quantum communication devices by Toshiba, HP, IBM, Mitsubishi, NEC and NTT are already on the market.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion: I agree with John Duffield that quantum computing may never be of any value. But quantum communication is already marketable, and a lot of new science, mathematics, and engineering (e.g. for superconductors) was developed for our failed (so far) attempts in making quantum computing a reality.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-02T06:45:08.407" LastActivityDate="2018-07-02T06:45:08.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2508" PostTypeId="1" CreationDate="2018-06-28T20:43:47.690" Score="3" ViewCount="178" Body="&lt;p&gt;Reproduced from Exercise 2.5 of Nielsen &amp;amp; Chuang’s Quantum Computation and Quantum Information (10th Anniversary Edition):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A function &lt;span class=&quot;math-container&quot;&gt;$(\cdot, \cdot)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$V × V$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is an inner product if it satisfies the requirements:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(1) &lt;span class=&quot;math-container&quot;&gt;$(\cdot, \cdot)$&lt;/span&gt; is linear in the second argument,&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(|v⟩,  \sum_iλ_i|w_i⟩\right) = \sum_i λ_i (|v⟩, |w_i⟩).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(2) &lt;span class=&quot;math-container&quot;&gt;$(|v⟩,|w⟩)=(|w⟩,|v⟩)^∗$&lt;/span&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(3) &lt;span class=&quot;math-container&quot;&gt;$(|v⟩, |v⟩) ≥ 0$&lt;/span&gt; with equality if and only if &lt;span class=&quot;math-container&quot;&gt;$|v⟩ = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, &lt;span class=&quot;math-container&quot;&gt;$C^n$&lt;/span&gt; has an inner product defined by&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;((y_1,...,y_n),(z_1,...,z_n)) ≡ \sum_i y_i^* z_i = \begin{bmatrix} y_1 &amp;amp; \ldots &amp;amp; y_n\end{bmatrix}\begin{bmatrix} z_1 \\ \vdots \\ z_n\end{bmatrix}.&#xA;$$&lt;/span&gt;&#xA;  &lt;strong&gt;Verify that &lt;span class=&quot;math-container&quot;&gt;$(·, ·)$&lt;/span&gt; just defined is an inner product on &lt;span class=&quot;math-container&quot;&gt;$C^n$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="26" LastEditDate="2019-03-30T07:59:38.623" LastActivityDate="2019-03-30T07:59:38.623" Title="Nielsen &amp; Chuang Exercise 2.5 - Inner products of complex vectors" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2018-07-01T16:44:01.850" ContentLicense="CC BY-SA 4.0" />
  <row Id="2509" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T22:32:26.360" Score="7" Body="&lt;p&gt;There are many technical challenges to developing a universal quantum computer consisting of with many qubits, as pointed out in the other answers. See also this &lt;a href=&quot;https://www.nature.com/articles/nature23460&quot; rel=&quot;noreferrer&quot;&gt;review article&lt;/a&gt;. However, there may be workaround ways to get certain nontrivial quantum computing results before we get to the first truly universal quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that classical computing devices existed a long time before the first universal computer was made. E.g. to numerically solve differential equations, you can construct an electric circuit consisting of capacitors, coils and resistors, such that the voltage between certain points will satisfy the same differential equation as the one you want to solve. This method was popular in astrophysics before the advent of digital computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of quantum computing, note that when Feynman came up with the idea of quantum computing, he argued on the basis of the difficulty of simulating quantum mechanical properties of certain physical systems using ordinary computers. He turned the argument around by noting that the system itself solves the mathematical problem that is hard to solve using ordinary computers. The quantum mechanical nature of the system makes that so, therefore one can consider if one can construct quantum mechanical devices that are able to tackle problems that are hard to solve using ordinary computers. &lt;/p&gt;&#xA;" OwnerUserId="2803" LastActivityDate="2018-06-28T22:32:26.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2510" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T22:37:35.140" Score="9" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;See the timeline on Wikipedia, and ask yourself where's the parallel adder? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It seems to me that your answer lies in your question.  Looking at the timeline on Wikipedia shows very slow progress from 1959 until about 2009.  It was mainly theoretical work until we went from &lt;a href=&quot;https://en.wikipedia.org/wiki/Zero_to_One&quot; rel=&quot;noreferrer&quot;&gt;zero to one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the only &lt;em&gt;9&lt;/em&gt; years since then, the pace of progress has been tremendous, going from 2 qubits to 72 and if you include dwave up to 2000 qubits.  And, there's one working in the cloud right now that we have access to.  Graph the progress of the last 60 years and I'm sure you'll see quite the knee in the curve you seem to desire and a rebuttal to your statement &lt;em&gt;But as far as I know, quantum computing hasn't done anything.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Where's the equivalent of Atlas, or the MU5?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is that the measure against which your question is based?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Will you ever be able to? Is it all hype and hot air? Is quantum computing just pie in the sky? Is it all just jam-tomorrow woo peddled by quantum quacks to a gullible public?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. No. No. No.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If not, why not? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Because, as your referenced timeline shows, people are making significant progress in the number and stability of qubits as well as in quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asking people to predict the future has always been fraught with failure which is why most of these sites don't allow 'opinion based' questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps more specific (non-opinion based) questions would better serve to answer your questions.&lt;/p&gt;&#xA;" OwnerUserId="2806" LastActivityDate="2018-06-28T22:37:35.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2511" PostTypeId="2" ParentId="2491" CreationDate="2018-06-28T22:37:38.963" Score="11" Body="&lt;p&gt;The key difference is that the Bacon-Shor code is a &lt;em&gt;subsystem&lt;/em&gt; code, while the Shor code is a &lt;em&gt;stabilizer&lt;/em&gt; code. They have the same &lt;em&gt;stabilizer operators&lt;/em&gt;, but the error correction procedure is different. The canonical reference for this construction is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0508131&quot; rel=&quot;noreferrer&quot;&gt;[Poulin]&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stabilizer codes rely on measuring eigenvalues of &lt;em&gt;commuting&lt;/em&gt; operators (the stabilizers). Because these operators commute, we can label subspaces of the state space by these eigenvalues. In particular, the joint +1 eigenspace is the &lt;em&gt;codespace&lt;/em&gt;. If any of our measurements result in a -1 eigenvalue, we know that the state has wandered out of the codespace and can (hopefully) do something to rectify this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With subsystem codes, we also measure eigenvalues of some operators, but this time they do &lt;em&gt;not&lt;/em&gt; form a commuting set of operators. These operators are called &lt;em&gt;gauge operators&lt;/em&gt;. They generate a group called the &lt;em&gt;gauge group&lt;/em&gt;. The trick to this construction is that the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Center_(group_theory)&quot; rel=&quot;noreferrer&quot;&gt;center&lt;/a&gt;&lt;/em&gt; of the gauge group is the stabilizer group. This is the group of operators generated by the gauge operators that commute with every element of the gauge group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How this works in practice:&lt;/strong&gt; suppose you have a stabilizer operator $s$ written as a product of gauge operators $\{g_i\}$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ s = \prod_i g_i. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we go ahead and measure each of the $g_i$. Each measurement gives a random eigenvalue $\lambda_i = \pm 1$ but the product of these $\lambda = \prod \lambda_i$ labels the eigenspace of $s$ that the state belongs to. Once we have all the eigenvalues of the stabilizers in this way we can (hopefully) do something to rectify the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;An example:&lt;/strong&gt; I find it helpful to think of the &quot;4-qubit Bacon-Shor code&quot;. This is an error &lt;em&gt;detecting&lt;/em&gt; subsystem code. The gauge operators are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\{XXII, IIXX, ZIZI, IZIZ\}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Think of these as operating on a $2\times 2$ lattice of qubits. These operators generate the stabilizers $XXXX$ and $ZZZZ.$ Once we measure $XXII$ and $IIXX$ we multiply the two eigenvalue measurements to find the eigenvalue of $XXXX$. These gauge operators are &quot;easier&quot; to measure, because they only involve two qubits, but the cost is that we mess up the state in other ways. These &quot;other ways&quot; are the &lt;em&gt;gauge qubits&lt;/em&gt;, and we don't care about these. The encoded qubits, or &lt;em&gt;logical&lt;/em&gt; qubits are the ones we are trying to preserve. The operators that act on the encoded qubits are the &lt;em&gt;logical operators&lt;/em&gt;. For this example these are $ZZII$ and $XIXI$. As an exercise I would recommend working out the corresponding eigenvectors (and eigenspaces) for all these operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Larger Bacon-Shor codes work similarly. For an $n\times n$ lattice of qubits, there are a bunch of 2-qubit gauge operators, arranged like &quot;dominoes&quot; on the lattice. The $X$ type gauge operators are horizontal dominoes, and the $Z$ type gauge operators are vertical dominoes. A vertical stack of $n$ of the $X$ type dominoes generates an $X$ type stabilzer on $n\times 2$ qubits. And so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevance to adiabatic quantum computing is that we can form a Hamiltonian from these operators, as the negative sum of the gauge operators. The groundspace of the Hamiltonian corresponds to the logical qubits of the gauge code, and excitations of the state correspond to errors. For the Bacon-Shor code, the gap of this Hamiltonian goes to zero as the size of the system grows. Therefore this Hamiltonian does not work to protect the encoded state (energetically.) This Hamiltonian is also known as the &lt;em&gt;&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0501708&quot; rel=&quot;noreferrer&quot;&gt;quantum compass model&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also wrote a paper about &lt;a href=&quot;https://arxiv.org/abs/1801.03243&quot; rel=&quot;noreferrer&quot;&gt;subsystem codes and Hamiltonians&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="263" LastEditorUserId="263" LastEditDate="2018-06-28T22:43:02.900" LastActivityDate="2018-06-28T22:43:02.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2512" PostTypeId="2" ParentId="2499" CreationDate="2018-06-28T23:02:36.697" Score="12" Body="&lt;p&gt;To answer part of the question, &quot;will I ever buy a quantum computer&quot;, etc. I think there is a fundamental misunderstanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computing isn't just classical computing but faster. A quantum computer solves certain kinds of problems in a short time that would take a classical super computer a thousand years. This isn't an exaggeration. But regular kinds of computing, adding numbers, moving bits for graphics, etc. Those will still just be classical computing things. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the technology could ever be miniaturized (I don't know), it might be something more like an MMU or a graphics card. An additional feature to your classical computer, not a replacement. In the same way a high end graphics card lets your computer do things that it would not be able to (in reasonable time) with the main CPU, a quantum computer would allow other sorts of operations that can't be done currently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend you at least scan maybe the first paragraph of the &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing#Principles_of_operation&quot; rel=&quot;noreferrer&quot;&gt;Principles of Operation&lt;/a&gt;&quot; page on the quantum computing Wikipedia page.&lt;/p&gt;&#xA;" OwnerUserId="2810" LastActivityDate="2018-06-28T23:02:36.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2513" PostTypeId="1" AcceptedAnswerId="2519" CreationDate="2018-06-29T00:37:30.167" Score="9" ViewCount="1665" Body="&lt;p&gt;I want to understand the relation between the following two ways of deriving a (unitary) matrix that  corresponds to the action of a gate on a single qubit:   &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; &lt;a href=&quot;https://nbviewer.jupyter.org/github/QISKit/qiskit-tutorial/blob/master/reference/tools/quantum_gates_and_linear_algebra.ipynb#Single-Qubit-Quantum-states&quot; rel=&quot;noreferrer&quot;&gt;HERE&lt;/a&gt;, in IBM's tutorial, they represent the general unitary matrix acting on a qubit as: &#xA;  $$&#xA;U = \begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -e^{i\lambda}\sin(\theta/2) \\&#xA;e^{i\phi}\sin(\theta/2) &amp;amp; e^{i\lambda+i\phi}\cos(\theta/2) &#xA;\end{pmatrix},&#xA;$$&#xA;  where $0\leq\theta\leq\pi$, $0\leq \phi&amp;lt;2\pi$, and $0\leq \lambda&amp;lt;2\pi$.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is derived algebraically using the definition of a unitary operator $U$ to be: $UU^{\dagger}=I$. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; &lt;a href=&quot;http://www.vcpc.univie.ac.at/~ian/hotlist/qc/talks/bloch-sphere-rotations.pdf&quot; rel=&quot;noreferrer&quot;&gt;HERE&lt;/a&gt; (pdf), similar to Kaye's book &lt;em&gt;An Introduction Quantum Computing&lt;/em&gt;, the same operator is calculated to be: &#xA;  $$U=e^{i\gamma}\,R_{\hat n}(\alpha).$$&#xA;  Here, $R_{\hat n}(\alpha)$ is the rotation matrix around an arbitrary unit vector (a vector on the Bloch sphere) as the axis of rotation for an angle $\alpha$. Also, $e^{i\gamma}$ gives the global phase factor to the formula(which is not observable after all). The matrix corresponding to this way of deriving $U$ is: $$e^{i\gamma}\cdot\begin{pmatrix} cos\frac{\alpha}{2}-i\,sin\frac{\alpha}{2}\,cos\frac{\theta}{2}&amp;amp;-i\,sin\frac{\alpha}{2}\,e^{-i\phi}\\ -i\,sin \frac{\alpha}{2}e^{i\phi}&amp;amp;cos\frac{\alpha}{2}+i\,sin\frac{\alpha}{2}\,cos\theta\end{pmatrix}.$$   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This derivation is clearer to me since it gives a picture of these gates in terms of rotating the qubits on the Bloch sphere, rather than just algebraic calculations as in 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; How do these angles correlate in 1 and 2? I was expecting these two matrix to be equal to each other up to a global phase factor.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: This correspondence seems instrumental to me for understanding the U-gates defined in the tutorial (IBM). &lt;/p&gt;&#xA;" OwnerUserId="2757" LastEditorUserId="55" LastEditDate="2021-05-18T08:00:09.480" LastActivityDate="2021-05-18T08:00:09.480" Title="What is the relation between these two forms of a single-qubit unitary operation?" Tags="&lt;quantum-gate&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2514" PostTypeId="1" AcceptedAnswerId="2517" CreationDate="2018-06-29T01:55:06.777" Score="9" ViewCount="258" Body="&lt;p&gt;Is there some definition or theorem about what a quantum computer can achieve from which post-quantum cryptographic schemes (eg lattice cryptography, but not quantum cryptography) can justify their security? I know the period finding function is capable of breaking RSA and discrete logs, but is it the only algorithm relevant to breaking encryption schemes? Can I say that if a scheme is not susceptible to the period finding function it is not susceptible to quantum computing? If not, is there some similar, alternative statement of the form &quot;if an encryption scheme cannot be broken by algorithm X, it cannot be broken by quantum computing&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, is it sufficient to prove that an encryption scheme can only be broken by trying all possible keys, and the best that quantum computing can do in this regard is square root search time with Grover's algorithm?&lt;/p&gt;&#xA;" OwnerUserId="2816" LastEditorUserId="26" LastEditDate="2018-07-01T08:20:10.313" LastActivityDate="2018-07-01T08:20:10.313" Title="How to justify post quantum encryption security?" Tags="&lt;cryptography&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2515" PostTypeId="2" ParentId="2514" CreationDate="2018-06-29T04:32:33.207" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there some definition or theorem about what a quantum computer can&#xA;  achieve from which post quantum cryptographic schemes (eg lattice&#xA;  cryptography, but not quantum cryptography) can justify their&#xA;  security?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. Just because your post-quantum cryptographic scheme works today, doesn't mean Peter Shor won't find a quantum algorithm to break it tomorrow.&quot;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I know the period finding function is capable of breaking RSA and discrete logs, but is it the only algorithm relevant to breaking encryption schemes? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. An example of another algorithm is Grover's algorithm, which is relevant to breaking cryptosystems based on the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2247/2293&quot;&gt;Transcendental Logarithm Problem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can I say that if a scheme is not susceptible to the period finding function it is not susceptible to quantum computing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. Schemes based on the Transcendental Logarithm Problem are not susceptible to period finding, but are susceptible to quantum enhanced speed-ups.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If not, is there some similar, alternative statement of the form &quot;if an encryption scheme cannot be broken by algorithm X, it cannot be broken by quantum computing&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. We do not know every single quantum algorithm in possible existence. Even if a scheme is resilient to period finding &lt;em&gt;and&lt;/em&gt; Grover's algorithm, it might be possible to use quantum computers to break it more efficiently than classical computers. We might just need to make Peter Shor interested enough to come up with a quantum enhanced decryption scheme for it.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it sufficient to prove that an encryption scheme can only be broken by trying all possible keys, and the best that quantum computing can do in this regard is square root search time with Grover's algorithm?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. Just because a classical computer cannot break your scheme except by trying all possible keys, doesn't mean a quantum computer cannot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a question that does have a &lt;strong&gt;yes&lt;/strong&gt; answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;What can we do to prove that an encryption scheme is safe against quantum computers?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answer: Prove that decrypting the code is a QMA complete or QMA hard problem. QMA hard problems are problems that are hard for quantum computers in the way that NP hard problems are hard for classical computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has inspired me to ask &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2516/what-classical-public-key-cryptography-protocols-exist-for-which-decryption-is-q&quot;&gt;this&lt;/a&gt; question, which I do not know the answer to!&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-29T05:01:56.230" LastActivityDate="2018-06-29T05:01:56.230" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2516" PostTypeId="1" CreationDate="2018-06-29T04:59:42.687" Score="6" ViewCount="156" Body="&lt;p&gt;Such a public key cryptosystem would be &quot;quantum safe&quot; in the sense that quantum computers cannot efficiently solve QMA hard problems.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-29T08:32:10.587" LastActivityDate="2018-11-04T17:17:37.167" Title="What classical public key cryptography protocols exist for which hacking is QMA complete or QMA hard?" Tags="&lt;complexity-theory&gt;&lt;classical-computing&gt;&lt;cryptography&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2517" PostTypeId="2" ParentId="2514" CreationDate="2018-06-29T06:48:02.613" Score="6" Body="&lt;p&gt;This is essentially the realm of computational complexity classes. For example, the class BQP may crudely described as the set of all problems that can be efficiently solved on a quantum computer. The difficulty with complexity classes is that it's hard to prove separations between many classes, i.e. the existence of problems which are in one class but not another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a sense, it is sufficient to be able to say &quot;if this quantum algorithm cannot break it, it is safe&quot;, you just have to use the right algorithm. You need a BQP-complete algorithm such as finding roots of the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;noreferrer&quot;&gt;Jones polynomial&lt;/a&gt; - any quantum algorithm can be cast as an instance of a BQP-complete algorithm. However, &lt;em&gt;how&lt;/em&gt; that algorithm might be used for the cracking is completely unclear and non-trivial. It's not enough to see that you can't directly brute force things. So, that approach is probably not so helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do we want from a post-quantum crypto scenario? We need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a function $y=f(x)$ that we can easily compute for the purposes of encryption.&lt;/li&gt;&#xA;&lt;li&gt;for which the inverse, $f^{-1}(y)$ cannot easily be computed on a quantum computer, i.e. the problem class is outside BQP.&lt;/li&gt;&#xA;&lt;li&gt;given some secret, $z$, there is a classically efficiently computable function $g(y,z)=x$, i.e. with the supplementary information, the function $f(x)$ can be inverted. This is so that the right person (who has the private key, $z$) can decrypt the message.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This last bullet is (essentially) the definition of the complexity class NP: the problems for which it may be hard to find a solution, but for which a solution is easily verified when given a proof (corresponding to the private key in our case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what we're after are problems in NP but not in BQP. Since we don't know if NP=BQP, we don't know that such things exist. However, there's a good route for looking at solutions: we consider NP-complete problems. These are the hardest instances of problems in NP, so if BQP$\neq$ NP (which is widely believed to be the case), NP-complete problems are certainly not in BQP. (If a problem is complete for a complexity class, it means that if you can solve it efficiently, you can solve all instances of the class efficiently.) So, this is kind of the guidance for where one might look for post-quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The additional subtlety that complicates matters, however, is roughly (I'm not an expert) that complexity classes talk about worst case complexity, i.e. for a given problem size, it's about how hard the hardest possible instance of the problem is. But there could be only one such problem instance, which would mean that if we fix the problem size (as is standard, e.g. you might talk about 1024 bit RSA; the 1024 bits is the problem size), there's only be one private key. If we know that, an eavesdropper can just use that private key to decrypt messages. So, we actually need that this computational complexity reasoning applies for a large proportion of possible inputs. This gets you into the world of average-case complexity where, as I understand it, it becomes much harder to make such statements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may help to make a comparison to RSA, a public key crypto-system, and ignoring the existence of quantum computers. It is based on the difficulty of factoring large composite numbers. This problem is not (believed to be) in P, so it is believed to be difficult for a hacker with a classical computer to get at the answer. Meanwhile, it is in NP because the solution is readily verified (if you're given one factor, you can easily check it's a factor). That means it can be decrypted using a classical computer by the rightful recipient.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-29T08:58:41.047" LastActivityDate="2018-06-29T08:58:41.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2518" PostTypeId="2" ParentId="2516" CreationDate="2018-06-29T06:54:56.763" Score="4" Body="&lt;p&gt;Please start by reading my answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2517/1837&quot;&gt;here&lt;/a&gt;. I believe you've mistaken the requirements for post-quantum crypto. If you use a scheme which is QMA-hard, then that means either your problem is QMA-complete (in which case, you can decrypt the message using a quantum computer, but not with a classical computer unless NP=QMA), or not (in which case you cannot decrypt efficiently even on a quantum computer). What you typically want for post-quantum crypto is something for which the decryption (by the holder of the private key) can be performed efficiently on a classical computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There may be schemes out there which are designed to be run with quantum computers performing the (allowed) decryption, but I'm not aware of any, and they are not the main focus of research at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I also described in the other answer, what you're more likely to be interested in is some form of typical case complexity. I suppose it's conceivable that cases with an NP-complete typical case complexity &lt;em&gt;could&lt;/em&gt; have worst-case complexity that's QMA-hard.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-29T07:24:45.697" LastActivityDate="2018-06-29T07:24:45.697" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2519" PostTypeId="2" ParentId="2513" CreationDate="2018-06-29T07:21:51.743" Score="2" Body="&lt;p&gt;Your second unitary isn't quite right, it's not even unitary! I think it should be:&#xA;$$e^{i\gamma}\cdot\begin{pmatrix} \cos\frac{\alpha}{2}-i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}&amp;amp;-i\,\sin\frac{\alpha}{2}\sin\frac{\theta}{2}\,e^{-i\phi}\\ -i\,\sin \frac{\alpha}{2}\sin\frac{\theta}{2}e^{i\phi}&amp;amp;\cos\frac{\alpha}{2}+i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}\end{pmatrix}.$$&lt;br&gt;&#xA;This may make is easier to find the correspondence. Let me put $\tilde\ $ over the entities from the first unitary in order to distinguish them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's define $\tan(\beta)=\tan\frac{\alpha}{2}\cos\frac{\theta}{2}$. This is the phase of the first matrix element, so&#xA;$$&#xA;\cos\frac{\alpha}{2}-i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}=e^{i\beta}\cos\frac{\tilde\theta}{2},&#xA;$$&#xA;where we're allowing equality between the two unitaries to be up to a global phase $e^{i(\gamma+\beta)}$. In other words,&#xA;$$&#xA;\cos^2\frac{\tilde\theta}{2}=\cos^2\frac{\alpha}{2}+\sin^2\frac{\alpha}{2}\cos^2\frac{\theta}{2}=\cos^2\frac{\alpha}{2}\sec^2\beta.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the off-diagonal entries, recall that a unitary matrix must have columns whose sum-mod-square must be 1. Thus, the off-diagonal entries must be $\sin\frac{\tilde\theta}{2}$ up to some phase which we have to fix. We need&#xA;$$&#xA;-\beta+\phi-\frac{\pi}{2}=\tilde\phi\qquad -\beta-\phi-\frac{\pi}{2}=\tilde\lambda+\pi,&#xA;$$&#xA;where I've incorporated the $i$ and $-1$ factors using phases $\pi/2$ and $\pi$. That perfectly fixes the relations between those two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we only have to get the bottom-right matrix element correct. Again, we've already got the weight correct by unitarity, it's just the phase that we need. This is $-2\beta$, which from adding together the above two relations gives $\tilde\phi+\tilde\lambda+2\pi\equiv\tilde\phi+\tilde\lambda$, exactly as required.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-29T07:21:51.743" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2520" PostTypeId="2" ParentId="2505" CreationDate="2018-06-29T07:35:00.587" Score="5" Body="&lt;p&gt;You are correct with your calculation that&#xA;$$&#xA;T\left(\begin{array}{c} 1 \\ 1 \end{array}\right)/\sqrt{2}=\left(\begin{array}{c} 1 \\ e^{i\pi/4} \end{array}\right)/\sqrt{2},&#xA;$$&#xA;and you are correct that if you want to calculate the probability of getting a &quot;0&quot;$\equiv\left(\begin{array}{c} 1 \\ 0 \end{array}\right)$ measurement result, you evaluate&#xA;$$&#xA;P(0)=\left|\left(\begin{array}{cc} 1 &amp;amp; 0 \end{array}\right)\cdot\left(\begin{array}{c} 1 \\ e^{i\pi/4} \end{array}\right)/\sqrt{2}\right|^2=\frac{1}{2},&#xA;$$&#xA;so you get both answers with probability 1/2. However, this is not what the referenced page is trying to calculate. It says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we start with a system initially in the |+⟩ (which is done using the Hadamard), then apply multiples of the T gate and measure in the x-basis...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The X-basis is not the question of 0 or 1 that you have already calculated. Instead, it's the probability of being in $|\pm\rangle=\frac{1}{\sqrt{2}}\left(\begin{array}{c} 1 \\ \pm 1\end{array}\right)$. I think the confusion has arisen because while people often refer to 0 and 1 as being the computational basis (as I have, and you have), when you're talking about measurements where there are two possible results, you can always label the outcomes as 0 and 1, no matter what basis was used. This is what they've done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So,&#xA;$$&#xA;P(+)=\left|\frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 &amp;amp; 1 \end{array}\right)\cdot\left(\begin{array}{c} 1 \\ e^{i\pi/4} \end{array}\right)/\sqrt{2}\right|^2=\frac{1}{4}|1+e^{i\pi/4}|^2&#xA;$$&#xA;Expanding this gives&#xA;$$&#xA;P(+)=\frac{1}{4}\left((1+\cos\frac{\pi}{4})^2+\sin^2\frac{\pi}{4}\right)=\frac{1}{4}\left((1+\frac{1}{\sqrt{2}})^2+\frac{1}{2}\right)=\frac{2+\sqrt{2}}{4}&#xA;$$&#xA;If you numerically evaluate this, you'll get the required result, 0.8535533. You could repeat the calculation for $P(-)$, or just use the fact that $P(+)+P(-)=1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The x-length, as they call it, is&#xA;$$&#xA;P(+)-P(-)=2P(+)-1=\frac{2+\sqrt{2}}{2}-1=\frac{1}{\sqrt{2}}.&#xA;$$&#xA;Again, that's exactly what's claimed.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-29T07:35:00.587" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2521" PostTypeId="1" CreationDate="2018-06-29T08:09:05.213" Score="8" ViewCount="441" Body="&lt;p&gt;I have been reading about the Quantum Channel Capacity and it seems to be an open problem to find such capacity in general. Quantum capacity is the highest rate at which quantum information can be communicated over many independent uses of a noisy quantum channel from a sender to a receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Known results on the field are the Hashing bound, which is a lower bound on such quantum capacity and which is given by the LSD (Lloyd-Shor-Devetak) theorem; or the HSW (Holevo-Schumacher-Westmoreland) theorem for classical capacity over quantum channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there have been any advances in what a general expression for the quantum capacity since the release of those theorems. A glimpse on the advance in such field is enough for me, or references to papers where such task is developed.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-03-08T11:13:16.707" LastActivityDate="2021-03-08T11:13:16.707" Title="Advances in Quantum Channel Capacity" Tags="&lt;quantum-operation&gt;&lt;communication&gt;&lt;channel-capacity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2522" PostTypeId="1" CreationDate="2018-06-29T08:50:13.583" Score="4" ViewCount="78" Body="&lt;p&gt;I know there are measures that can be taken to mitigate the effects of dephasing (I'm referring here to Dynamic Decoupling and the other ideas it led to). I find it surprising that there is no equivalent procedure to mitigate the effects of energy leakage. In principle, it seems like if you add energy to the system at the rate it leaves (due to interactions with the measurement equipment, etc) you could keep a qubit at the same energy level indefinitely. That is, $T_1 \to \infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that just have the qubit at the correct energy probably isn't enough to ensure that it is in a pure state, so I want to try to formulate this idea using the density matrix formalism and try to see if there is any clever way to add the energy in such a way to keep the qubit in an initial .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can't get started, so I'm asking for help. How would you model a system at constant energy, with energy leaving and entering at the same rate?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="26" LastEditDate="2018-11-28T06:07:44.207" LastActivityDate="2018-11-28T06:07:44.207" Title="Modeling energy relaxation effects with density matrix formalism" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2523" PostTypeId="2" ParentId="2522" CreationDate="2018-06-29T09:10:58.057" Score="1" Body="&lt;p&gt;I think the real question is &lt;em&gt;how&lt;/em&gt; are you putting the energy back in? Here's a natural suggestion:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take one qubit for simplicity. It was two energy levels, call them 0 and 1. 1 is at an energy $\omega$ higher than 0. So, the natural Hamiltonian is&#xA;$$&#xA;H_0=\omega|1\rangle\langle 1|&#xA;$$&#xA;If you want to talk about energy dissipation, you probably have to go to the Lindblad equation, with an amplitude damping term&#xA;$$&#xA;L=\gamma|0\rangle\langle 1|.&#xA;$$&#xA;However, you're probably going to add energy back in using a unitary process,&#xA;$$&#xA;H_1=\Omega(|0\rangle\langle 1|+|1\rangle\langle 0|).&#xA;$$&#xA;Thus, the overall evolution is&#xA;$$&#xA;\frac{d\rho}{dt}=-i[H_0+H_1,\rho]+L\rho L^\dagger-\frac12(L^\dagger L\rho+\rho L^\dagger L).&#xA;$$&#xA;Now, if you want to make sure there's a balance of energy in and energy out, you want to evaluate the expected energy of the state, $\text{Tr}(\rho H_0)$, and make sure that's a constant, i.e. that the time derivative is 0. I haven't tried to solve it (you were asking for a starting point) but I presume that to make it work, $\Omega$ will be a function of time and of the initial state. The other interesting thing to calculate will presumably be $\text{Tr}(\rho^2)$ (or perhaps its first derivative). This will map the increasing mixedness of the state $\rho$, which can never be compensated for by the unitary action of $H_1$ (which preserves mixedness).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-29T09:10:58.057" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2524" PostTypeId="1" CreationDate="2018-06-29T10:04:47.453" Score="5" ViewCount="131" Body="&lt;p&gt;I don't know much about physics so maybe the question is stupid, but I wonder how engineers detect that the state function did not collapse due to the environment while a calculation is performed? Theoretically, a measurement will break the system. Related is also the next question, how to detect that a calculation is finished? A measurement should also break the state function and thus break an ongoing calculation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one thinks further, how is it even possible to check whether the experimenter produced a certain quantum state? Maybe all the bits have a totally different state right from the start and you just know about that afterwards. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I seem to miss something because if this would be true, quantum computers would be in-practical. Is it like this: The experimenter takes a measurement periodically and hopes that the operation was successful?&lt;/p&gt;&#xA;" OwnerDisplayName="user2827" LastEditorUserId="26" LastEditDate="2018-06-29T11:01:28.690" LastActivityDate="2018-07-02T11:12:48.310" Title="How to check states?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2525" PostTypeId="1" AcceptedAnswerId="2546" CreationDate="2018-06-29T11:17:13.757" Score="9" ViewCount="144" Body="&lt;p&gt;Qudit graph states are $d$-dimension generalisations of qubit graph states such that each state is represented by a weighted graph $G$ (with no self-loops) such that each edge $(i, j)$ is assigned a weight $A_{i, j} = 0,\ldots,d-1$. &#xA;The graph state associated with $G$ is then given by&#xA;$$&#xA;|G⟩ = \prod_{i&amp;gt;j} \textrm{CZ}_{i,j}^{A_{i,j}} |+⟩^{\otimes n},&#xA;$$ &#xA;where $|+⟩ = F^\dagger|0⟩$ and $F$ is the Fourier gate&#xA;$$&#xA;F = \frac{1}{\sqrt{d}}\sum_{k=0}^{d-1} \omega^{kl}|k⟩⟨l|.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the literature on qudit graph states, there does not seem to be a consistency as to whether such states are defined only for $d$ prime or not.&#xA;For example, some sources only give the above definition for $d$ prime, such as&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.82.062315&quot; rel=&quot;noreferrer&quot;&gt;Quantum secret sharing with qudit graph states&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1306.2879.pdf&quot; rel=&quot;noreferrer&quot;&gt;Absolutely Maximally Entangled Qudit Graph States&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;whereas some do not specify any such restriction, such as&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.110.100403&quot; rel=&quot;noreferrer&quot;&gt;Greenberger-Horne-Zeilinger Paradoxes from Qudit Graph States&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.78.042303&quot; rel=&quot;noreferrer&quot;&gt;Quantum-error-correcting codes using qudit graph states&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So which is correct? &#xA;&lt;strong&gt;Are qudit graph states (well-)defined when the dimension is non-prime?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if so, &lt;strong&gt;are they uniquely defined?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-06-30T17:38:39.493" Title="Are qudit graph states well-defined for non-prime dimension?" Tags="&lt;qudit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2526" PostTypeId="1" CreationDate="2018-06-29T11:43:38.203" Score="5" ViewCount="249" Body="&lt;p&gt;I'm looking at &lt;a href=&quot;https://arxiv.org/pdf/1207.0511.pdf&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; paper and try to implement the Quantum adders they define myself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a number $b=b_{n-1}\dots b_1b_0$ and they want to add a constant number $a=a_{n-1}\dots a_1a_0$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They define&#xA;$$A_j = \Pi_{k=1}^{j+1} R_k^{a_{j+1-k}}, \quad R_k = \begin{pmatrix}1&amp;amp;0\\0&amp;amp;e^{i2\pi/2^k}\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result can be obtained by first applying a QFT on all qubits, then apply $A_j$ on qubit $j$ and then apply an inverse QFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I try to work this out for the simple case where $b=0$ and $a=1$, I end up with a quantum state &#xA;$$0.5\left|01\right&amp;gt; + (0.5+0.5i)\left|10\right&amp;gt; - 0.5i \left|11\right&amp;gt;.$$&#xA;Note in this case, $A_0 = Z$ and $A_1 = S$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an error in my calculation, or is the definition in the article not correct? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2019-05-13T08:57:21.063" LastActivityDate="2019-05-13T08:57:21.063" Title="Implementation of quantum adder" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2527" PostTypeId="2" ParentId="2524" CreationDate="2018-06-29T13:44:12.460" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;How engineers detect that the state function did not collapse due to the environment while a calculation is performed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can detect and correct errors during the calculation by using some &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction code&lt;/a&gt;. The idea behind these error correction codes is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You entangle the qubit you want to &amp;quot;protect&amp;quot; against errors with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; other qubits.&lt;/li&gt;&#xA;&lt;li&gt;You perform the operation that may introduce an error.&lt;/li&gt;&#xA;&lt;li&gt;You measure a &lt;strong&gt;general&lt;/strong&gt; property of the system.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I recommend you to read &lt;a href=&quot;https://arxiv.org/abs/0905.2794&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Error Correction for Beginners (Devitt, Nemoto &amp;amp; Munro, 2013)&lt;/a&gt; if you want more details on quantum error correction (and detection!).&lt;/p&gt;&#xA;&lt;p&gt;But you are right, a &lt;em&gt;dumb&lt;/em&gt; measurement will break the state function and thus break an ongoing calculation.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How to detect that a calculation is finished?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;From the comments you wrote, your question is based on &lt;a href=&quot;https://people.eecs.berkeley.edu/%7Echristos/classics/Deutsch_quantum_theory.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum theory, the Church-Turing principle and the universal quantum computer&lt;/a&gt; (page 7). In this paper, David Deutsch tries to formalise the Quantum Turing Machine (QTM).&lt;/p&gt;&#xA;&lt;p&gt;In the model of the QTM, a user does not have any mean to know if the computation is over or not but the machine does (because there is no more instruction, because the quantum state ended up in a trap state, etc.). In order to let the user know that he can retrieve the result of its calculations, the machine just flips a (classical) bit to 1. This bit and the quantum bits used for the computation are obviously not entangled (classical bits cannot be entangled) and so measuring the bit will not change the quantum system.&lt;/p&gt;&#xA;&lt;p&gt;In real-world models/implementations, this may be done by other means. For example with IBM's quantum chips, you know that your computation is finished when the results become available and IBM knows that the computation is over because they executed on the quantum chip all the quantum gates you asked them to execute.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How is it even possible to check whether the experimenter produced a certain quantum state?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can perform 2 different checks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantifying the reliability of the initial state: if the experimenter tell you that the initial state is &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;$&lt;/span&gt; you can run multiple experiments consisting in only a measurement of the initial state and count how many experiments gave wrong outcomes.&lt;/p&gt;&#xA;&lt;p&gt;This check consists in measurements and so may break the initial state, so you cannot check &lt;em&gt;just before your experiment&lt;/em&gt; that the initial state is good. You can only obtain numbers like &amp;quot;the initial state will be good in 90% of the experiments&amp;quot;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Checking just before your calculations that the initial state is good. As said in the previous point, this may break the initial state and I don't know any algorithm capable of doing that for an arbitrary initial state.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The 2 points above are not making any assumptions on the initial state. If you are using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum circuit model&lt;/a&gt; then you expect &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;^n$&lt;/span&gt; as initial state and this initial state can be checked and corrected before your calculations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Perform a destructive measurement on the qubits. Depending on the outcome of the measurement, each qubit is either in the state &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For all the qubits measured in the state &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;, apply an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to flip the qubit state to &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I think this is how IBM reset its qubits to the &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; state (but I don't have any links ensuring it).&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-07-02T11:12:48.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2528" PostTypeId="1" AcceptedAnswerId="2533" CreationDate="2018-06-29T14:15:00.067" Score="5" ViewCount="166" Body="&lt;p&gt;In $\mathbb{C^2}$, we generally take $+1$ and $-1$ as the standard eigenvalues, that's what Pauli-X, Pauli-Z measurements, etc will give us.&#xA;Is there a similar standard while measuring in the Bell basis and the computational basis in $\mathbb{C^2}\otimes\mathbb{C^2}$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the actual eigenvalues don't matter, as long as we are talking about the same resolution of identity, but I was just wondering if there was a convention.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2018-12-23T12:35:43.123" LastActivityDate="2018-12-23T12:35:43.123" Title="What are the standard eigenvalues in $\mathbb{C^2}\otimes\mathbb{C^2}$?" Tags="&lt;measurement&gt;&lt;mathematics&gt;&lt;technical-standards&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2529" PostTypeId="2" ParentId="2427" CreationDate="2018-06-29T15:19:38.633" Score="1" Body="&lt;p&gt;I have found this paper in which an insight about the question can be seen as the author states the difficulty of constructing the so-called &lt;em&gt;quantum repeaters&lt;/em&gt; for quantum networks due to the no-cloning theorem. However, the constructions are indeed possible. The aforementioned paper is can be found &lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=6246754&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The same author has a book called Quantum Networking where I consider that he will go further in explaining such difficulty and how to overcome it, but I do not have access to such text, so I am not sure if such explanation is given there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am giving this information as an answer so that other users interested in quantum networking can find information about the question that is being asked here.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-06-29T15:19:38.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2530" PostTypeId="1" AcceptedAnswerId="2532" CreationDate="2018-06-29T15:24:57.843" Score="6" ViewCount="1626" Body="&lt;p&gt;After taking some measure, how can a qunit be &quot;unmeasured&quot;? Is unmeasurement (ie reverse quantum computing) possible?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-07-01T02:03:53.217" Title="Reverse Quantum Computing: How to unmeasure a qunit" Tags="&lt;measurement&gt;&lt;qudit&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2531" PostTypeId="2" ParentId="2530" CreationDate="2018-06-29T15:30:01.533" Score="3" Body="&lt;p&gt;You can compute &lt;em&gt;by measuring&lt;/em&gt; - see cluster-based quantum computation - but the whole thing that makes measurement different in quantum mechanics is that it destroys the superposition. It can't be undone. Once you measure, the qudit isn't in a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle + ... +\gamma|n\rangle$&lt;/span&gt; but in a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |1\rangle$&lt;/span&gt; or what have you based upon probability. When you measure the qubit again soon after, it stays as either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The superposition is gone. We can't get it back (except by doing the same operations that lead our qubit to that point, in which case it'll be very similar) because we can't clone a qubit, so we can't figure out what &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are.&lt;/p&gt;&#xA;&lt;h2&gt;Tl;dr: No.&lt;/h2&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-06-29T15:30:01.533" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2532" PostTypeId="2" ParentId="2530" CreationDate="2018-06-29T15:40:33.657" Score="6" Body="&lt;p&gt;I am not really sure about what you mean by &quot;unmeasuring&quot; a qubit, but if you mean to recover the qubit that was measured by manipulating the post-measurement state then I am afraid that the answer is no. When a quantum state is measured, the supoerposition state of such is collpased to one of the possible outcomes of the measurement, and so the qubit is lost. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third postulate of quantum mechanics explains measurments in the quantum world, and such postulate says the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum measurements are described by a collection $\{M_m\}$ of &lt;em&gt;measurement operators&lt;/em&gt;. These are operators acting on the state space of the system being measured. The index $m$ referes to the measurement outcomes that may occur in the experiment. If the state of the quantum system is $|\psi\rangle$ immediately before the measurement, then the probability that result $m$ occurs is given by \begin{equation}&#xA;p(m)=\langle\psi|M_m^\dagger M_m|\psi\rangle,&#xA;\end{equation}&#xA;  and the state of the sytem after the measurement is &#xA;  \begin{equation}&#xA;\frac{M_m|\psi\rangle}{\sqrt{\langle\psi|M_m^\dagger M_m|\psi\rangle}}.&#xA;\end{equation}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the post-measurement state collapses into another state defined by the postulate 3, and the previous quantum state is lost irreversibly. See also this &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;noreferrer&quot;&gt;wikipedia&lt;/a&gt; entry for wave function collapse, where it explains the collapse of quantum states after measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, if the same measurment wants to be done, the quantum state must be prepared again before the measurement and so the xperiment can be repeated.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-06-29T15:40:33.657" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="2533" PostTypeId="2" ParentId="2528" CreationDate="2018-06-29T17:44:30.540" Score="3" Body="&lt;p&gt;There is no notion of &quot;standard eigenvalues&quot; for general matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some meaningful eigenvalues for 4x4 matrices are:&#xA;&lt;br&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;{-3/2, -1/2, 1/2, 3/2} which are the possible z-projections of a spin-3/2 particle&lt;/li&gt;&#xA;&lt;li&gt;Instead of eigenvalues of X and Z, use the eigenvalues of the Dirac matrices, which are 4x4 matrices that are related to Pauli matrices&lt;/li&gt;&#xA;&lt;li&gt;Instead of eigenvalues of X and Z, use the eigenvalues of the 4x4 generalization of the Gell-Mann matrices (which themselves are 3x3 generalizations of the 2x2 Pauli matrices).&lt;/li&gt;&#xA;&lt;li&gt;Finally, as Neil de Beaudrap has noted in the comment, {-1,1} can also be eigenvalues for 4x4 matrices, such as the SWAP gate.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-02T18:01:16.527" LastActivityDate="2018-07-02T18:01:16.527" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2535" PostTypeId="2" ParentId="2371" CreationDate="2018-06-29T20:16:44.163" Score="0" Body="&lt;p&gt;In the comments to my answer the OP has written:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the universal gate case you stated the largest systems are &amp;lt;100.&#xA;  How could it reach 10k?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well I have good news for you. Four days ago D-Wave announced at the AQC conference that they can now do YY coupling:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b4upM.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b4upM.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can see the superconducting circuit that gives you ZZ and YY coupling at the same time: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/C2j4K.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/C2j4K.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot show you more of their &quot;preview&quot; presentation, but expect for them to publish something very soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is YY coupling significant?&lt;/strong&gt; It is because in 2007, Jacob Biamonte and Peter Love from D-Wave &lt;a href=&quot;https://arxiv.org/abs/0704.1287&quot; rel=&quot;nofollow noreferrer&quot;&gt;proved&lt;/a&gt; that XX + ZZ is enough for universal quantum computation. XX and YY are equivalent up to a rotation, so they could easily have instead said that YY + ZZ is universal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that D-Wave has engineered a universal set of couplers, it should be possible to have a 10,000 qubit universal quantum computer when they extend to 1250 units cells (since 8 x 1250 = 10,000, see my first answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sorry that there's no literature references for this yet, but the picture tells the whole story, and I'm afraid that until D-Wave publishes something, this is the &quot;source&quot; for the information. &lt;a href=&quot;https://math.meta.stackexchange.com/questions/8212/citing-stackexchange-postings&quot;&gt;This&lt;/a&gt; is how you can cite this answer. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-06-29T20:22:51.223" LastActivityDate="2018-06-29T20:22:51.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2536" PostTypeId="1" CreationDate="2018-06-29T20:33:12.960" Score="9" ViewCount="1330" Body="&lt;p&gt;How is D-Wave's Pegasus architecture different from the Chimera architecture?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2019-01-07T14:55:46.150" LastActivityDate="2019-08-28T05:31:41.103" Title="What is D-Wave's &quot;Pegasus&quot; architecture?" Tags="&lt;architecture&gt;&lt;physical-realization&gt;&lt;d-wave&gt;&lt;chimera&gt;&lt;pegasus&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2537" PostTypeId="2" ParentId="2536" CreationDate="2018-06-29T20:34:22.713" Score="5" Body="&lt;p&gt;Pegasus is the first fundamental change in D-Wave's architecture since the D-Wave One.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The D-Wave Two, 2X, and 2000Q all used the &quot;Chimera&quot; architecture, which consisted of unit cells of $K_{4,4}$ graphs. The four generations of D-Wave machines just added more qubits by adding more and more unit cells that were the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Pegasus, the actual structure of the unit cells has fundamentally changed for the first time. Instead of the Chimera graph where each qubit can have at most 6 qubits, the Pegasus graph allows each qubit to couple to 15 other qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A machine has been made already with 680 Pegasus qubits (compare this to 2048 Chimera qubits in the D-Wave 2000Q).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The work was presented by Trevor Lanting of D-Wave, four days ago:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YGhJx.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YGhJx.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8uAqC.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8uAqC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-06-29T20:34:22.713" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2538" PostTypeId="2" ParentId="2526" CreationDate="2018-06-29T22:03:21.600" Score="2" Body="&lt;p&gt;I'm assuming an initial state of the form $|a\rangle|b\rangle = |1\rangle|0\rangle$ for your simple case.  You first perform a QFT on the right qubit, obtaining $|1\rangle(\frac{|0\rangle+|1\rangle}{\sqrt{2}})$.  Next, you apply $A_0 = R_1$ to the right qubit to obtain $|1\rangle(\frac{|0\rangle-|1\rangle}{\sqrt{2}})$.  Finally, you apply an IQFT to the right qubit and obtain $|1\rangle|1\rangle$, thereby demonstrating that $1+0=1$.  As @DaftWullie noted, all the action happens on the &quot;$b$&quot; qubit; the $a$ qubit (or cbit in this case) acts only as a control.&lt;/p&gt;&#xA;" OwnerUserId="356" LastActivityDate="2018-06-29T22:03:21.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2539" PostTypeId="2" ParentId="2530" CreationDate="2018-06-29T23:02:56.480" Score="2" Body="&lt;p&gt;Unitary operation is revesible, but measurement is a projection operation, which is not reveaible. Think about matrix inverse, projection matrix has lower rank and does not have inverse&lt;/p&gt;&#xA;" OwnerUserId="2854" LastActivityDate="2018-06-29T23:02:56.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2540" PostTypeId="1" AcceptedAnswerId="2542" CreationDate="2018-06-30T01:00:47.627" Score="13" ViewCount="2040" Body="&lt;p&gt;A universal set of gates are able to mimic the operation of any other gate type, given enough gates. For example, a universal set of quantum gates are the Hadamard (&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&amp;nbsp;), the &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; phase shift (&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;&amp;nbsp;), and the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; gate. How would one disprove or prove universality of a set of gates such as &lt;span class=&quot;math-container&quot;&gt;$\{H,T\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\{\mathrm{CNOT},T\}$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\{\mathrm{CNOT}, H\}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2713" LastEditorUserId="124" LastEditDate="2019-07-17T12:27:04.873" LastActivityDate="2019-07-17T12:27:04.873" Title="How to prove/disprove universality for a set of gates?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2541" PostTypeId="2" ParentId="2540" CreationDate="2018-06-30T01:19:45.857" Score="3" Body="&lt;p&gt;Nielsen and Chuang, pg 191 of the 10th anniversary edition:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We have just shown that an arbitrary unitary matrix on a $d$-dimensional Hilbert space may be written as a product of two-level unitary matrices. Now we show that single qubit and CNOT gates together can be used to implement an arbitrary two-level unitary operation on the state space of $n$ qubits. Combining these results we see that single qubit and CNOT gates can be used to implement an arbitrary unitary operation on $n$ qubits and therefore are universal for quantum computation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first sentence there is an accepted result, so you must simply show that the combination of your gate set can implement &quot;an arbitrary two-level unitary operation&quot;. To quote Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Technically, this is impossible since the number of possible quantum gates is uncountable, whereas the number of finite sequences from a finite set is countable. To solve this problem, we only require that any quantum operation can be approximated by a sequence of gates from this finite set. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://arxiv.org/abs/1610.00547&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-06-30T01:19:45.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2542" PostTypeId="2" ParentId="2540" CreationDate="2018-06-30T05:41:35.557" Score="9" Body="&lt;p&gt;Universality can be a very subtle thing which is quite tricky to prove. There are usually two options for proving it:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;show directly, using your chosen gates, how to construct any arbitrary unitary of arbitrary size (there’s no constraint on the size of the construction, just that it can be done) to arbitrary accuracy (on some non-trivial sub space of the full Hilbert space).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;show how your chosen set of gates can be used to recreate (to arbitrary accuracy) an existing universal set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Conversely, if you wish to disprove it, you show that the effect of your set of gates can always be simulated by an (assumed) lesser model of computation, usually classical computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few heuristics that you can use for guidance:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;you must have a multi-qubit gate in your set. If all you have are single-qubit gates, you can simulate each qubit independently on a classical computer. So, if we believe that quantum computers are more powerful than classical, single qubit gates alone are not universal for quantum computation. This rules out {H,T}.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;you must have a gate that creates superpositions. This rules out {CNOT, T}. Again, this is a classical computation with the addition of an irrelevant global phase.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Of course, these are not sufficient conditions: the set {H,S,CNOT} can be efficiently simulated as well (see Gottesman-Knill theorem). This must also be true of {H,CNOT} as they are a subset and so the operations that they can create is no more than those of the original set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the universal sets that I find most interesting is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301040&quot; rel=&quot;noreferrer&quot;&gt;{Toffoli,H}&lt;/a&gt;. It always feels surprising to me that this is enough (especially when you compare to the previous set). Note that it does not involve any complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible to get universality from a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0512058&quot; rel=&quot;noreferrer&quot;&gt;single two-qubit gate&lt;/a&gt; such as&#xA;$$&#xA;\left(\begin{array}{cccc} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}} \\ 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \end{array}\right)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-06-30T06:28:34.517" LastActivityDate="2018-06-30T06:28:34.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2543" PostTypeId="2" ParentId="2499" CreationDate="2018-06-30T10:58:44.880" Score="11" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: I've been working on the theory of quantum computers for about 15 years. I've seen nothing convincing to say that they won't work. Of course, the only real proof that they can work is to make one. It's happening now. However, what a quantum computer will do and why we want it does not match up with the public perception.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is quantum computing just pie in the sky? Is it all just jam-tomorrow woo peddled by quantum quacks to a gullible public?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As a &quot;quantum quack&quot; (thanks for that), of course I'm going to tell you it's all realistic. But the theory &lt;em&gt;is&lt;/em&gt; sound. So long as quantum mechanics is correct, the theory of quantum computation is correct, and there are efficient algorithms for quantum computers for which we don't know how to efficiently compute the solution on a classical computer. But I don't think anything that I write here can convince a skeptic. Either, you have to sit down and learn all the details yourself, or wait and see.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, quantum mechanics is only a theory which could be superseded at any time, but its predictions have already been applied to explain the world around us. Quantum computers are not pushing the theory into an untested regime where we might hope there are unexpected results (which is what physicists really hope for, because that's where you start to see hints at new physics). For example, quantum mechanics is already applied to condensed matter systems consisting of far more constituents than we're talking about qubits in a near-term quantum computer. It's just that we need an unprecedented level of control over them. A few people think they have arguments for why a quantum computer won't work, but I've not found anything particularly convincing in the arguments that I've read.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it all hype and hot air?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is a lot of hype surrounding quantum computers. I would say that this comes from two main sources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the popular representation of quantum computing in the mainstream media and popular culture (e.g. science fiction books). Ask anybody actively working on quantum computation, I think they will all agree it's poorly represented, giving the impression that it's a universal solution that will make everything run quicker, which is, at least for now, not the case. There has been some jam-tomorrow woo peddled to a gullible public, but that's more through a &quot;lost in translation&quot; attempt to over-simplify what's going on, mostly by non-specialist intermediaries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;researchers themselves. For the past 20(ish) years, people have been promising that quantum computing is just over the horizon, and its never quite materialized. It's quite reasonable that observers get sick of it at that point. However, my perspective from being within the field is that many people claiming to be working towards quantum computers haven't been. As funding bodies have got progressively more demanding with the &quot;why&quot; for research, and ensuring &quot;impact&quot;, quantum computing has become the go-to for many experimentalists, even if they aren't really interested in doing anything for a quantum computer. If there's been some way that they can twist what they're doing so that it sounds relevant to quantum computing, they've tended to do it. It doesn't mean that quantum computing can't be done, it just hasn't been as much of a focus as has been implied. Take, at a slightly different level, the explosion of quantum information theory. So few theorists within that have actively worked on the theory of quantum computers and how to make them work (that's not to say they've not been doing interesting things).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, we are now hitting a critical mass where there's suddenly a lot of research investment in making quantum computers, and associated technology, a reality, and things are starting to move. We seem to be just hitting the point, with devices of about 50 qubits, that we might be capable of achieving &quot;quantum supremacy&quot; - performing computations whose results we can't really verify on a classical computer. Part of the problem with achieving this has actually been the aforementioned rapid progress of classical computing. Given Moore's Law type of progress, yielding exponentially improving classical computational power, it's been a constantly shifting bar of what do we need to achieve to be convincing.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum computers don't show similar progress. Au contraire, it looks like they haven't even got off the ground.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The point is, it's hard to do, and it's taken a long time to get the basic technology right. This is a slightly imperfect comparison, but it's not too bad: think about the lithography processes that are used for making processors. Their development has been progressive, making smaller and smaller transistors, but progress has been slowing as it's got harder and harder to deal with, for one, the quantum effects that are getting in the way. Quantum computers, on the other hand, are essentially trying to step over that whole progressive improvement thing and jump straight to the ultimate, final, result: single atom transistors (kind of). Perhaps that gives some level of insight into what the experimentalists are trying to deal with?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You won't be buying one in PC World any time soon. Will you ever be able to?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's not clear that you'd even want to. At the moment, we expect quantum computers to be useful for certain, very specific tasks. In that case, we perhaps envisage a few powerful centralized quantum computers that do those specific jobs, and most people will keep going with classical computers. But, since you want to draw analogies with the development of classical computers, then (according to Wikipedia) it is in 1946 that Sir Charles Darwin (grandson of the famous naturalist), head of Britain's National Physical Laboratory, wrote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;it is very possible that ... one machine would suffice to solve all the problems that are demanded of it from the whole country&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(variants of this are attributed to people like Watson). This very clearly is not the case. The reality was that once computers became widely available, further uses were found for them. It &lt;em&gt;might&lt;/em&gt; be the same for quantum computers, I don't know. One of the other reasons that you wouldn't buy a quantum computer in a shop is its size. Well, the actual devices are usually tiny, but it's all the interfacing equipment and, especially, cooling that takes up all the space. As the technology improves, it'll be able to operate at progressively higher temperatures (look, for example, at the progress of high temperature superconductivity compared to the original temperatures that had to be achieved) which will reduce cooling requirements.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-06-30T10:58:44.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2544" PostTypeId="2" ParentId="2499" CreationDate="2018-06-30T11:27:49.613" Score="18" Body="&lt;p&gt;&lt;strong&gt;TL,DR:&lt;/strong&gt; Engineering and physics arguments have already been made. I add a historical perspective: I argue that the field of quantum computation is really only a bit more than two decades old and that it took us more than three decades to build something like the MU5.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Since you mention the timeline, let's have a closer look:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The beginnings&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First of all, the mere possibility of something like a quantum computer was voiced by Richard Feynman in the west (1959 or 1981 if you wish) and Yuri Manin in the east (1980). But that's just having an idea. No implementation starts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When did similar things happen with classical computing? Well, a very long time ago. Charles Babbage for instance already wanted to build computing machines in the early 19th century and he already had ideas. Pascal, Leibniz, they all had ideas. Babbage's &lt;a href=&quot;https://en.wikipedia.org/wiki/Analytical_Engine&quot; rel=&quot;nofollow noreferrer&quot;&gt;analytical machine&lt;/a&gt; of 1837 which was never built due to funding and engineering challenges (by the way, the precursor of the analytical machine &lt;a href=&quot;http://acarol.woz.org/difference_engine.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;was built with Lego&lt;/a&gt;) is definitely the most recent first idea that is already way ahead of what Feynman and Manin proposed for quantum computing, because it proposes a concrete implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The '70s don't see anything related to a quantum computer. Some codes are invented, some theoretical groundwork is done (how much information can be stored?), which is necessary for qc, but it's not really pursuing the idea of the quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Codes and communication-related ideas are to quantum computation what telephones and telegraph wires are to classical computing: an important precursor, but not a computer. As you know, Morse codes and telegraphs are technologies of the 19th century and more difficult codes for noisy channels were also studied. The mathematical groundwork (in terms of no-go-theorems and the like) was done in 1948 by Shannon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, it can be argued that punch card computing was developed in 1804 &lt;a href=&quot;https://en.wikipedia.org/wiki/Joseph_Marie_Jacquard&quot; rel=&quot;nofollow noreferrer&quot;&gt;for weaving&lt;/a&gt;, but I don't want to claim that this was really the beginning of the classical computation.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Universal (quantum) computers&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;So when did computation start? I'm going to argue that you need a number of things to get research for universal computing off the ground; before that, the number of people and money invested there will be limited.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You need the notion of a universal computer and a theoretical model of what to achieve.&lt;/li&gt;&#xA;&lt;li&gt;You need an architecture of how to implement a universal computer - on a theoretical level.&lt;/li&gt;&#xA;&lt;li&gt;You need a real-life system where you could implement it. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;When do we get those in quantum computation?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Deutsch describes the universal quantum computer in 1985 (33 years ago). &lt;/li&gt;&#xA;&lt;li&gt;Circuit models and gates are developed around the same time.&lt;/li&gt;&#xA;&lt;li&gt;The first complete model of how to put everything together was proposed by Cirac and Zoller in 1994 (merely 24 years ago).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All the other advances in quantum computation before or during that time were limited to cryptography, quantum systems in general or other general theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about classical computation?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We have Turing's work on &lt;a href=&quot;https://en.wikipedia.org/wiki/Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;Turing machines&lt;/a&gt; (1936) or &lt;a href=&quot;https://en.wikipedia.org/wiki/Lambda_calculus&quot; rel=&quot;nofollow noreferrer&quot;&gt;Church's work&lt;/a&gt; (same time frame).&lt;/li&gt;&#xA;&lt;li&gt;Modern architectures rely on &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_architecture&quot; rel=&quot;nofollow noreferrer&quot;&gt;von Neumann's model&lt;/a&gt; (1945); other architectures exist.&lt;/li&gt;&#xA;&lt;li&gt;As a model, the digital circuit model was designed in 1937 by Shannon.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, in 1994 we are in a comparable state to 1937:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There are a few people doing the theoretical groundwork, and the groundwork has now been done.&lt;/li&gt;&#xA;&lt;li&gt;There are a fair number of people doing engineering work on foundational issues not directly related but very helpful for building a (quantum) computer.&lt;/li&gt;&#xA;&lt;li&gt;And the field is generally not that big and well-funded.&lt;/li&gt;&#xA;&lt;li&gt;But: from that date, funding and people start pouring into the field.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;The field is taking off&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For classical computing, this is illustrated by the amount of different &quot;first computer systems&quot; in the Wikipedia timeline. There were several research groups at least in Germany, England, and the United States in several locations (e.g. Manchester and Bletchley Park in the UK, to name just a few). War-time money was diverted to computing because it was necessary for e.g. the development of the nuclear bomb (see accounts at Los Alamos).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum computation, see e.g. &lt;a href=&quot;https://www.nsf.gov/pubs/2000/nsf00101/nsf00101.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;this comment&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The field of QIS began an explosive growth in the early to mid-1990s as a consequence of several simultaneous stimuli: Peter Shor demonstrated that a quantum computer could factor very large numbers super-efficiently. The semiconductor industry realized that the improvement of computers according to Moore’s law would all too soon reach the quantum limit, requiring radical changes in technology. Developments in the physical sciences produced trapped atomic ions, advanced optical cavities, quantum dots, and many other advances that made it possible to contemplate the construction of workable quantum logic devices. Furthermore, the need for secure communications drove the investigations of quantum communication schemes that would be tamper proof.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;All in all, from the time, that the theoretical groundwork of modern computers had been laid to the time that the first computers are available (Zuse 1941, Manchester 1948, to name just two) it took about a decade. Similarly, it took about a decade for the first systems doing some sort of universally programmable calculation with quantum systems. Granted, their capabilities are lower than the first Manchester computers, but still.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Twenty years later, we are slowly seeing explosive growth in technology and a lot of firms get involved. We also see the advent of new technologies like the transistor (first discovered in 1947).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, 20 years after the beginning of quantum computation we see the serious entrance of private companies into the field, with Google, IBM, Intel, and many others. When I was at my first conference in 2012, their involvement was still academic, today, it is strategic. Similarly, we saw a proposition of a wealth of different quantum computing systems during the 2000s such as superconducting qubits, which form the basis of the most advanced chips from the three companies mentioned above. In 2012, nobody could claim to have a somewhat reliable system with more than a couple of physical qubits. Today, only six years later, IBM lets you play with their very reliable 16 qubits (5 if you really only want to play around) and Google claims to test a 72 qubit system as we speak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, we have still some way to go to have a reliable large-scale quantum computer with error-correction capabilities, and the computers we currently have are weaker than the classical computers we had in the '60s, but I (as others explain in other answers) believe this is due to the unique engineering challenges. &#xA;There is a small chance that it's due to physical limitations we have no idea about but if it is, given current progress, we should know in a couple of years at the latest.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What's my point here?&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I argued that the reason that we don't see an MU5 quantum computer yet is also due to the fact that the field is just not that old, yet, and hasn't really achieved that much attention until recently.&lt;/li&gt;&#xA;&lt;li&gt;I argue that from a present-day perspective, it seemed that classical computers became very good very quickly, but that this neglects decades of prior work where development and growth didn't seem as fast.&lt;/li&gt;&#xA;&lt;li&gt;I argue that if you believe (as almost everybody in the field does) that the initial engineering problems faced by quantum computers are harder than those faced by classical computers, then you see a very much comparable research and innovation trajectory to one of the classical computers. Of course, they are somewhat different, but the basic ideas of how it goes are similar.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1854" LastEditorUserId="7429" LastEditDate="2019-06-21T08:23:01.053" LastActivityDate="2019-06-21T08:23:01.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2546" PostTypeId="2" ParentId="2525" CreationDate="2018-06-30T13:43:46.380" Score="6" Body="&lt;p&gt;The definition you give for a graph state, and in particular the quantum Fourier transform $F$ and the controlled-$Z$ operator &amp;mdash; where we take $ Z $ to be the unitary generalisation of the Pauli $Z$ operator, satisfying $Z = F XF^\dagger$ for $X$ a shift-by-one permutation operation &amp;mdash; are all well-defined even in composite dimension. The Fourier transform is certainly an operation of interest for arbitrary definition; the controlled-$Z$ operation is still diagonal and unitary, and still has the relevant connections to $F$ as a tensor; there is nothing about the mathematical objects themselves which become troublesome in composite dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why you see so much emphasis on prime dimension is essentially that composite dimension qudits are inconvenient to analyse. The reasons for this arise from number theory: particularly in the fact that in composite dimension one must worry about zero divisors. Frankly, there aren't many in the field who think of themselves as number theorists, and very few researchers (either among the authors or the readers of articles) have much patience for number systems which are not fields such as the well-loved examples of $\mathbb C$, $\mathbb R$, $\mathbb Q$, and of course the integers modulo a prime $p$, $\mathbb Z_p$. For this reason, you will rarely see references to qudits of composite dimension anywhere in the field. Even when you do, the major concern of mathematical convenience will usually motivate some other restriction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum information theory may occasionally make use of number theory, and pure mathematics in general, but make no mistake: this field does not have much overlap with the priorities of pure mathematics. If a definition has been presented in a way that looks strangely restricted, it's reasonably likely that it's because it allows a result to be shown which would be much more challenging, or even just a little bit more awkward, to prove without that restriction &amp;mdash; and it is considered more important to publicise examples of striking-sounding results than to present reasonably complete mathematical theories.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-06-30T17:38:39.493" LastActivityDate="2018-06-30T17:38:39.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2549" PostTypeId="1" AcceptedAnswerId="2563" CreationDate="2018-06-30T16:27:09.507" Score="2" ViewCount="100" Body="&lt;p&gt;I have had a few ideas for circuits that I would like to get feedback on (do such things already exist, what utility they serve, etc). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how I might graphically render these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/956tM.jpg&quot; alt=&quot;circuit sketch&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here i is the input &amp;amp; o is the output. The slash directly to the right of the input is a 50/50 beam splitter. The remaining slashes are mirrors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a pulse were directed in, the output would first recieve 50% of the beam. The other half of the beam would pass through into the reflective chamber. Upon completion of the loop, the beam would again reach the splitter. Again, half the beam (25%) would pass to the output while the other half (25%) looped thru the circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This process could be run thru $n$ times until some desired outcome is reached.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this already exist? What is the utility (if any)?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-07-01T16:03:14.503" LastActivityDate="2018-07-02T05:47:52.317" Title="Photonic Circuit Idea (Does this already exist?)" Tags="&lt;circuit-construction&gt;&lt;photonics&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2550" PostTypeId="2" ParentId="2483" CreationDate="2018-06-30T18:25:55.773" Score="4" Body="&lt;p&gt;Contrary to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2484/23&quot;&gt;DaftWullie's answer&lt;/a&gt;, it &lt;em&gt;is&lt;/em&gt; possible to implement a CNOT gate in a photonic system with 100% efficiency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are caveats to this - it depends on what's used as the qubits (or, as this is a photonic system, potentially &lt;em&gt;qudits&lt;/em&gt;) in the system.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;KLM: A photon as a qubit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The first thing that most people think of in terms of photonic qubits is polarisation. In this case, postselection (/heralding) is generally required. This was theoretical shown to be possible by &lt;a href=&quot;https://www.nature.com/articles/35051009&quot; rel=&quot;nofollow noreferrer&quot;&gt;Knill, Laflamme and Milburn (KLM)&lt;/a&gt; in 2001. Within a couple of years, the first probabilistic photonic CNOT gate was shown by &lt;a href=&quot;https://www.nature.com/articles/nature02054&quot; rel=&quot;nofollow noreferrer&quot;&gt;O'Brien et. al.&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403062v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version&lt;/a&gt;) in an equivalent scheme, as shown in figure 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1NAD4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1NAD4.jpg&quot; alt=&quot;Probabilistic CNOT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 1: Circuit diagram of probabilistic 2-photon CNOT gate. Each photon (control and target) is encoded from polarisation to spatial modes. After postselecting on a single photon in $C_{\text{out}}$ and a single photon in $T_{\text{out}}$, when the control photon, $C$, is in spatial mode $C_0$, the identity operation is performed on the target photon, $T$, while when $C$ is in $C_1$, the NOT (X) operation is performed on $T$ which has a probability of success of 1/9. Uses beamsplitters. Image taken from Figure 1a of &lt;a href=&quot;https://www.nature.com/articles/nature02054&quot; rel=&quot;nofollow noreferrer&quot;&gt;O'Brien et. al.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One variation of this is to use a nonlinear phase shift to make a deterministic version of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the above may not sound overly great for the prospects of optical quantum computing, encoding a qubit as polarisation/2 spatial modes of a photon is far from the &lt;em&gt;only&lt;/em&gt; way to perform optical quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Reck: Many modes makes... Many dimensions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;One other such method was proposed before &lt;a href=&quot;https://www.nature.com/articles/35051009&quot; rel=&quot;nofollow noreferrer&quot;&gt;KLM&lt;/a&gt; by &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.73.58&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reck et. al.&lt;/a&gt; (shown in figure 2) and has since been improved upon by &lt;a href=&quot;https://www.osapublishing.org/optica/abstract.cfm?uri=optica-3-12-1460&quot; rel=&quot;nofollow noreferrer&quot;&gt;Clements et. al.&lt;/a&gt; In this a &lt;em&gt;single&lt;/em&gt; photon is encoded in some number, $d$, of spatial modes. This is equivalent to a $\log_2 d$ qubit system and can be used to implement any unitary. For a 2-qubit system, this is equivalent to having 4 spatial modes labelled $\left|00\right&amp;gt;, \left|01\right&amp;gt;, \left|10\right&amp;gt;$ and $\left|11\right&amp;gt;$ and a CNOT operation is equivalent to swapping the bottom 2 $\left(\left|10\right&amp;gt; \text{ and } \left|11\right&amp;gt;\right)$ modes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pmUZG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pmUZG.png&quot; alt=&quot;6-mode Reck scheme&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 2: Image of a 6-mode Reck scheme chip, which can be used to implement a deterministic 'CNOT' gate. Uses phase shifters and beam splitters to build up a unitary evolution over the modes of the system. Image taken from Figure 1 of &lt;a href=&quot;http://science.sciencemag.org/content/349/6249/711&quot; rel=&quot;nofollow noreferrer&quot;&gt;Carolan et. al.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, it's not quite that simple and, due to requiring an exponential number of modes, the Reck scheme isn't generally considered to be overly scalable.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;That leaves us with the (final) two options&lt;sup&gt;1&lt;/sup&gt;: &lt;em&gt;nonlinear&lt;/em&gt; optics (continuous variable) and measurement based quantum computing&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Continuous variable: Just keep squeezing&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;As detailed in my answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1530/23&quot;&gt;here&lt;/a&gt;, continuous variable QC also offers a universal gateset which can be used to make arbitrary unitaries, in theory at least. Unfortunately, as more squeezing is still required, an experimental realisation of this is yet to occur.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;And now for something completely different: Measurement based&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Another scheme that hasn't been experimentally achieved, yet shows potential, is measurement based QC. Instead of performing CNOT gates during unitary evolution that defines a circuit, the entangling operations occur as part of the state preparation of the system. As per &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.113.140403&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ewert and Loock&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/1403.4841&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version&lt;/a&gt;) the current idea of doing this involves generating small clusters of entangled photons, then entangling these into larger clusters using fusion gates, as shown in figure 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TEP0H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TEP0H.png&quot; alt=&quot;Fusion gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 3: Diagram of a 75% efficient fusion gate. Inputting the state $\left|\Upsilon_1\right&amp;gt; = \frac{1}{\sqrt 2}\left(\left|20\right&amp;gt; + \left|02\right&amp;gt;\right)$ allows for the detection of higher dimensional states. These can then be cascaded to detect larger and larger cluster states. The probabilistic measurement is equivalent to an entangling operation, similar to a CNOT gate. Image taken from Figure 1 of &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.113.140403&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ewert and Loock&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Although there are a number of variations of the different schemes used and work is constantly being done to improve upon them&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-06-30T18:25:55.773" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2552" PostTypeId="2" ParentId="2499" CreationDate="2018-06-30T19:11:42.623" Score="38" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is quantum computing just pie in the sky?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So far it is looking this way. We have been reaching for this pie aggressively over the last three decades but with not much success. we do have quantum computers now, but they are not the pie we wanted, which is a quantum computer that can actually solve a problem faster or with better energetic efficiency than a classical computer. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;You won't be buying one in PC World any time soon.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Will you ever be able to? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We cannot predict the future, but if I had to guess right now, I would say &quot;no&quot;. There is not yet any application for which quantum computing would be valuable enough. Instead we might have quantum computers at a small number of special institutes where very special calculations are done (like the supercomputer called Titan at Oak Ridge National Lab, or like a cyclotron particle accelerator where special experiments are done).  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it all hype and hot air? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Most of it is hype, unfortunately. &lt;br&gt;&#xA;But applications in quantum chemistry can indeed be game changing. Instead of doing physically laborious experiments on thousands of candidate molecules for a medicine or fertilizer, we can search for the best molecules on a computer. Molecules behave quantum mechanically, and simulating quantum mechanics is not efficient on classical computers, but is on quantum computers. Much of Google's investment in QC is for chemistry applications [&lt;a href=&quot;https://ai.googleblog.com/2016/07/towards-exact-quantum-description-of.html&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;].&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it all just jam-tomorrow woo peddled by quantum quacks to a gullible public? If not, why not?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Much of it is, unfortunately.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You were probably one of the more talented students in your class at Manchester University. You might have noticed that there was only a few of you and a larger number of mediocre and sub-mediocre students. There is a similar phenomenon at the professor level. Many professors don't find it easy or &quot;natural&quot; to write well-received grant proposals, but they need funding to keep their job, and to make sure their PhD students aren't starved of experiencing scientific conferences and having access to the software they need.&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a professor becomes:&lt;br&gt;&#xA; - desperate for funding, or &lt;br&gt; &#xA; - caught up with other problems in life, such as having to take care of a child with cancer, or&lt;br&gt;&#xA; - aware that they won't make huge scientific discoveries like some scientists did 100s of years ago,&lt;br&gt;&#xA;life becomes more about surviving, keeping a happy family, and doing what they &lt;strong&gt;&lt;em&gt;enjoy&lt;/em&gt;&lt;/strong&gt; rather than making a better world for their grandchildrens' grandschildren. As a professor, I can tell you that many of my colleagues are not as &quot;noble&quot; as the public often perceives scientists to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I know around 1000 people with funding to work in quantum computing, and not a single one seems to have ill intentions to fool a &quot;gullible public&quot; in some sinister way.&lt;/strong&gt; Most of us just apply for grants available through our universities or through our governments, and we don't intend to exaggerate the importance of our work any more than other scientists competing for the same money (we have to compete with molecular physicists pretending their work is important for fixing climate change just because the molecule they're working on is in our atmosphere, or biophysicists pretending their work might cure cancer just because they're working on a molecule that's prominent in the body). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of the &quot;hype&quot; around quantum computing comes from the media. Journalists have twisted the contents of my papers to make eye-catching headlines which will get more clicks on their ads, and their bosses give them pressure to do this or they'll lose their job to the other intern that doesn't care as much about being honest. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of the hype does come from scientists themselves, many who truly believe quantum computing will be revolutionary because their PhD supervisor didn't have a great education (remember that Manchester University is one of the best in the world, and &lt;strong&gt;&lt;em&gt;most&lt;/em&gt;&lt;/strong&gt; universities are not even close), or perhaps in rare cases there is hype from people desperate for funding, but not much for reasons other than these.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I do believe the public should invest a bit in quantum computing, as they do for lots of other areas of research which have no guaranteed positive outcome.&lt;/strong&gt; The hype is often exaggerated by journalists, ignorant scientists, or non-ignorant scientists who think they need it for survival.  There is also unfairly harsh criticism from journalists and funding agencies. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Nothing you said in your question is wrong.&lt;/em&gt;&lt;/strong&gt; &lt;br&gt;&#xA;I have just given some reasons for why they are correct.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-04-10T16:54:09.177" LastActivityDate="2020-04-10T16:54:09.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2553" PostTypeId="1" AcceptedAnswerId="2575" CreationDate="2018-06-30T19:36:29.877" Score="7" ViewCount="803" Body="&lt;p&gt;I have the following operation in my .qs files:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation myOp(qubits: Qubit[]) : () {&#xA;     // uses elements from the qubit array        &#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I send an array of qubits to this in the driver file?&#xA;The following did not work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Qubit[] qubits = new Qubit[2];&#xA;myOp.Run(sim, qubits);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Driver.cs(13,32): error CS1503: Argument 2: cannot convert from 'Microsoft.Quantum.Simulation.Core.Qubit[]' to 'Microsoft.Quantum.Simulation.Core.QArray&amp;lt;Microsoft.Quantum.Simulation.Core.Qubit&amp;gt;' [/home/tinkidinki/Quantum/Warmup_Contest/BellState/BellState.csproj]&#xA;&#xA;The build failed. Please fix the build errors and run again.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Also, as an aside: Would such a question be more suitable for this site, or for stack overflow?&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2019-03-12T09:04:25.933" LastActivityDate="2019-03-12T09:04:25.933" Title="How do you send an array of qubits to an operation in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2554" PostTypeId="1" AcceptedAnswerId="2571" CreationDate="2018-06-30T20:30:23.520" Score="6" ViewCount="197" Body="&lt;p&gt;If quantum computers advance to the point where they can defeat RSA, DSA, SHA (and really all existing classical public key encryption or and authentication) then it appears that it would be impossible to make secure transactions on the internet.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be impossible to maintain the security of user accounts for social media, amazon, eBay, online banking, etc.  It seems that the economic repercussions of this would be catastrophic on a global scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What measures can be taken against attacks on cryptosystems by quantum computers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At lest for now, I see a big problem with giving an answer that involves saying we could just use quantum encryption algorithms.  The main reason is that in order for the encryption to be effective the end users would have to be in possession of a quantum encrypt/decrypt device.  Not a problem for a bank or Amazon on their end, but a big problem for a guy trying to order a pizza on his smart phone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If end users were not actually in possession of a small quantum computer, and instead used a cloud based service to access a quantum device an attacker could just target the last segment of the transaction (between a cloud service and their device).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For end users to possess quantum crypto devices one would need to bring the cost down to a few hundred dollars max or the average person would not be able to afford it.  Right now most quantum systems are priced in the hundreds of thousands or millions of dollars range.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, all of the viable quantum systems I have seen run near absolute zero.  I don't know of anyone who makes a dilution refrigerator the size of a AA battery.  So you couldn't perform transactions on portable devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the only option then to classify all quantum crypto research until these problems can be solved?&lt;/p&gt;&#xA;" OwnerUserId="2866" LastEditorUserId="2866" LastEditDate="2018-07-01T13:58:38.467" LastActivityDate="2018-07-02T09:33:00.210" Title="What measures can be taken against attacks on cryptosystems by quantum computers other than just classifying research?" Tags="&lt;cryptography&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2555" PostTypeId="2" ParentId="2521" CreationDate="2018-06-30T20:44:09.847" Score="5" Body="&lt;p&gt;Let's recap a bit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In classical information theory, the analogous formula is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Noisy-channel_coding_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shannon noisy channel coding theorem&lt;/a&gt;. It's charming, because it is basically just a very simple optimization of the mutual information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum channel capacity is that it is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \lim\limits_{n\to\infty} \frac{1}{n}Q(T^{\otimes n}) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the quantum channel in question and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is the coherent information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's try to answer your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, we'd want a formula that doesn't depend on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; just like in the classical case. The problem is: It's known that such an expression cannot exist (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706061&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9706061&lt;/a&gt;). It gets worse: You could hope that there is a maximal &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; after which you at least know that the capacity is zero. But that's false (published recently: &lt;a href=&quot;https://www.nature.com/articles/ncomms7739&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unbounded number of channel uses may be required to detect quantum capacity (Cubitt &lt;em&gt;et al.&lt;/em&gt;, 2015)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, if you use two different channels, their capacity can both be zero while the capacity when used together is larger than zero (see &lt;a href=&quot;https://arxiv.org/abs/0807.4935&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0807.4935&lt;/a&gt;), which makes it even more difficult to imagine simple formulas for channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implies that the best we can hope for is formulas for particular channels or particular subclasses of channels. There are a few results scattered throughout the literature. For instance, the capacities of certain Gaussian bosonic channels are known (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0606132&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0606132&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, please note that the quantum capacity is only one of many capacities defined and it's not necessarily the most interesting one. A different capacity which is often discussed in the literature is the classical capacity of a quantum channel (i.e. how much classical information can I send over a quantum channel?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me point you to a recent review providing a lot of pointers to the literature: &lt;a href=&quot;https://arxiv.org/abs/1801.02019&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1801.02019&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1854" LastEditorUserId="26" LastEditDate="2019-05-13T15:26:27.733" LastActivityDate="2019-05-13T15:26:27.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2557" PostTypeId="2" ParentId="2554" CreationDate="2018-06-30T21:01:20.523" Score="-2" Body="&lt;p&gt;We can always make larger and larger keys in RSA. If a quantum computer can factor numbers up to RSA-4096, then use RSA-131072, or better yet, some elliptic curve key big enough to be safe against the next 10 years of quantum computing hardware. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or don't use public key cryptography but instead use standard passwords where the cost for a classical computer to break them is $M^n$ for $M$ characters and a password of length $n$, and the quantum computer's cost is at best $\mathcal{O}(M^{0.5n})$ which is not at all much better. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-02T05:42:02.463" LastActivityDate="2018-07-02T05:42:02.463" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2558" PostTypeId="1" AcceptedAnswerId="2560" CreationDate="2018-06-30T22:51:32.637" Score="4" ViewCount="416" Body="&lt;p&gt;From a 9×9 Hamiltonian lying 9D space, I choose a certain subspace of 4D for designing a two qubit gate. Now the original unitary time evolution operator also lies in 9D space and it's a 9×9 size matrix. For action of unitary time evolution operator on the two qubit gate made out of 4D subspace it is required to project the unitary time evolution operator in the 4D subspace. After reviewing literature, I came across an article doing same thing with the use of projection operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question- How to find the projection operator on the subspace?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I guess projection operator will be 4×4 matrix, so how will it act on the unitary time evolution operator which is a 9×9 matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.- I took the definition of projection operator from &quot;Quantum Computation and Quantum Information, Isaac Chuang and Michael Nielsen&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L2P4I.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L2P4I.jpg&quot; alt=&quot;Article&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2817" LastEditorUserId="26" LastEditDate="2018-12-23T13:31:03.070" LastActivityDate="2018-12-23T13:31:03.070" Title="Projection operator on Time evolution Operator" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2560" PostTypeId="2" ParentId="2558" CreationDate="2018-07-01T08:46:22.360" Score="2" Body="&lt;p&gt;A $9\times 9$ matrix $H$ can act on a $9$ dimensional state vector, say something like: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\Psi\rangle = a_0|0\rangle + a_1|1\rangle + .... + a_8|8\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, say you want to find the matrix which only acts on the subspace spanned by the basis $\{|0\rangle,|1\rangle\,|2\rangle,|3\rangle\}$, but has the same effect as the original $H$ matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find, $H|0\rangle$ and $H|1\rangle$ (where $|0\rangle = [1 \ 0 \ 0 \ 0 \ 0  \ 0 \ 0\ 0 \ 0 ]^{T}$, $|1\rangle = [0 \ 1 \ 0 \ 0 \ 0  \ 0 \ 0\ 0 \ 0 ]^{T}$, &#xA;$|2\rangle = [0 \ 0 \ 1 \ 0 \ 0  \ 0 \ 0\ 0 \ 0 ]^{T}$ and $|3\rangle = [0 \ 0 \ 0 \ 1 \ 0  \ 0 \ 0\ 0 \ 0 ]^{T}$)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then find the unique scalars $\alpha_{j,i}$ such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H|0\rangle = \alpha_{0,0}|0\rangle + \alpha_{1,0}|1\rangle + \alpha_{2,0}|2\rangle+ \alpha_{3,0}|3\rangle$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H|1\rangle = \alpha_{0,1}|0\rangle + \alpha_{1,1}|1\rangle + \alpha_{2,1}|2\rangle + \alpha_{3,1}|3\rangle$, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H|2\rangle =  \alpha_{0,2}|0\rangle + \alpha_{1,2}|1\rangle + \alpha_{2,2}|2\rangle + \alpha_{3,2}|3\rangle$ and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H|3\rangle = \alpha_{0,3}|0\rangle + \alpha_{1,3}|1\rangle + \alpha_{2,3}|2\rangle + \alpha_{3,3}|3\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your required $4\times 4$ matrix is $\begin{bmatrix}\alpha_{0,0} &amp;amp; \alpha_{0,1} &amp;amp; \alpha_{0,2} &amp;amp; \alpha_{0,3}\\\alpha_{1,0} &amp;amp; \alpha_{1,1} &amp;amp; \alpha_{1,2} &amp;amp; \alpha_{1,3} \\ \alpha_{2,0} &amp;amp; \alpha_{2,1} &amp;amp; \alpha_{2,2} &amp;amp; \alpha_{2,3} \\ \alpha_{3,0} &amp;amp; \alpha_{3,1} &amp;amp; \alpha_{3,2} &amp;amp; \alpha_{3,3}\end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me know if you're confused about any particular step.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-01T09:56:01.063" LastActivityDate="2018-07-01T09:56:01.063" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2561" PostTypeId="1" AcceptedAnswerId="2583" CreationDate="2018-07-01T13:05:29.973" Score="5" ViewCount="395" Body="&lt;p&gt;A beginner question after watching few videos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, &lt;code&gt;var=a&lt;/code&gt;; &lt;code&gt;var&lt;/code&gt; can be either of two values, &lt;code&gt;a&lt;/code&gt; or &lt;code&gt;b&lt;/code&gt;. Check what is the value of &lt;code&gt;var&lt;/code&gt;, using &lt;code&gt;Q#&lt;/code&gt;, &lt;code&gt;QISKit&lt;/code&gt; or similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help/idea? &lt;/p&gt;&#xA;" OwnerUserId="2884" LastEditorUserId="26" LastEditDate="2018-07-01T13:10:20.377" LastActivityDate="2020-06-22T13:38:34.700" Title="Checking value of variable using quantum approach" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2562" PostTypeId="1" AcceptedAnswerId="3798" CreationDate="2018-07-01T13:34:14.123" Score="9" ViewCount="191" Body="&lt;p&gt;This question is a follow-up to the previous QCSE question: &quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2525/are-qudit-graph-states-well-defined-for-non-prime-dimension&quot;&gt;Are qudit graph states well-defined for non-prime dimension?&lt;/a&gt;&quot;. From the question's answer, it appears that there is nothing wrong in &lt;em&gt;defining&lt;/em&gt; graph states using $d$-dimensional qudits, however, it seems that other definitional aspects of graph-states do not similarly extend to non-prime dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, for qubit graph states, one key aspect to their prevalence and use is the fact that: &lt;em&gt;any two graph states are local Clifford equivalent if and only if there is some sequence of local complementations that takes one graph to the other&lt;/em&gt; (for simple, undirected graphs). Needless to say, this is an incredibly useful tool in analyses of quantum error correction, entanglement and network architectures.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When considering $n$-qudit graph states, the equivalent graph is now weighted with adjacency matrix $A \in \mathbb{Z}_d^{n \times n}$, where $A_{ij}$ is the weight of edge $(i,j)$ (with $A_{ij}=0$ indicating no edge exists).&#xA;In the qudit case, &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0610267.pdf&quot; rel=&quot;noreferrer&quot;&gt;it was shown&lt;/a&gt; that LC equivalence can similarly be extended by the generalisation of local complementation ($\ast_a v$) and inclusion of an edge multiplication operation ($\circ_b v$), where:&#xA;\begin{align}&#xA;\ast_a v &amp;amp;: A_{ij} \mapsto A_{ij} + aA_{vi}A_{vj} \quad \forall\;\; i,j \in N_G(v), \;i \neq j \\&#xA;\circ_b v &amp;amp;: A_{vi} \mapsto bA_{vi} \quad\forall\;\; i \in N_G(v),&#xA;\end{align}&#xA;where $a, b = 1, \ldots, d-1$ and all arithmetic is performed modulo $p$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graphically, this is represented by the following operations (reproduced from &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0610267.pdf&quot; rel=&quot;noreferrer&quot;&gt;Ref. 2&lt;/a&gt;):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vHSj7.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vHSj7.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the graph state is defined on qudits of non-prime dimension, then we can see these operations (seem to) fail to represent LC-equivalence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, take the qudit state $|G\rangle$ depicted the graph $G$ in Fig. 1, defined for qudit dimension $d=4$, and let $x=y=z=2$, such that $A_{12}=A_{13}=A_{14}=2$.&#xA;In this case performing $\circ_2 1$ then $A_{1i} \mapsto 2 \times 2 = 4 \equiv 0 \bmod 4 \;\forall\; i$, and hence qudit $1$ is disentangled from all other qudits using only local operations.&#xA;Clearly this is wrong and occurs because of the problem of zero divisors as mentioned in the previous questions' &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2546/391&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: &lt;strong&gt;is there &lt;em&gt;any&lt;/em&gt; set of graph operations that properly represent local Clifford equivalence for qudit graph states of non-prime dimension?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I am primarily interested in operations that &lt;strong&gt;directly&lt;/strong&gt; apply to a state's representation as a single weighted graph, rather than possible decompositions into multiple prime-dimensional graph states, as suggested in Sec. 4.3 of &quot;&lt;a href=&quot;https://arxiv.org/pdf/1306.2879.pdf&quot; rel=&quot;noreferrer&quot;&gt;Absolutely Maximally Entangled Qudit Graph States&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-01T13:40:30.080" LastActivityDate="2018-07-19T11:21:45.217" Title="Does local Clifford equivalence have a direct graphical representation for qudit graph states of non-prime dimension?" Tags="&lt;entanglement&gt;&lt;qudit&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2563" PostTypeId="2" ParentId="2549" CreationDate="2018-07-01T16:39:25.523" Score="2" Body="&lt;p&gt;To answer your first, general question: Optical circuits are usually drawn with a selection of conventional symbols, a directory of which to draw them can be found &lt;a href=&quot;http://www.gwoptics.org/ComponentLibrary/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to that specific circuit, if a single photon was input, the output would produce a state in a decaying superposition of subsequent time bins. If you choose a temporal basis for your output photons $|t_k\rangle$, taking $|t_0\rangle$ as the time bin of your the first pass through the beamsplitter and $|t_1\rangle$ as the time bin of the next pass, etc, then the output state will be given by&#xA;$$&#xA;\sum_{k=0}^\infty \left(\frac{e^{-i\phi}}{\sqrt{2}}\right)^{k+1}|t_k\rangle,&#xA;$$&#xA;where $\phi$ is the phase shift imparted on each photon after a single pass of the loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you only care about the input and output photons, this can be more generally be represented by the &lt;a href=&quot;https://www.wikiwand.com/en/Bogoliubov_transformation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bogoliubov transformation&lt;/a&gt; on the optical mode operators&#xA;$$&#xA;a^\dagger_t \mapsto \sum_{k=0}^\infty \left(\frac{e^{-i\phi}}{\sqrt{2}}\right)^{k+1} b^\dagger_{t+k}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $a_t^\dagger$ and $b^\dagger_t$ are the creation operators for photons in time bin $t$ in the optical input and output modes respectively.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally, I haven't seen this sort of state before and don't know any particular use for it. However, there may be some use for it in some sort of strange loop-based architecture for linear optical quantum computing, although I would doubt it.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-02T05:47:52.317" LastActivityDate="2018-07-02T05:47:52.317" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2564" PostTypeId="1" CreationDate="2018-07-01T17:07:49.533" Score="6" ViewCount="122" Body="&lt;p&gt;&lt;sup&gt;This is a sequel to  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2490/how-are-two-different-registers-being-used-as-control&quot;&gt;How are two different registers being used as &amp;quot;control&amp;quot;?&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found the following quantum circuit given in Fig 5 (page 6) of the same paper i.e. &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations (Cao &lt;em&gt;et al.&lt;/em&gt;,2012)&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pUVWa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pUVWa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above circuit $R_{zz}(\theta)$ is $\left(\begin{matrix}e^{i\theta} &amp;amp; 0 \\ 0 &amp;amp; e^{i\theta}\end{matrix}\right)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2490/how-are-two-different-registers-being-used-as-control#comment3055_2494&quot;&gt;@DaftWullie mentions here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Frankly, I've no chance of getting there because there's an earlier&#xA;  step that I don't understand: &lt;strong&gt;the output on registers $L, M$ after Figure&#xA;  5. The circuit diagram and the claimed output don't match up (the claimed output being separable between the $L$ and $M$ registers, when&#xA;  qubit $l−1$ of register $L$ should be entangled with those of register M.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I understand that after the Walsh-Hadamard transforms the state of register $L$  is $$\frac{1}{\sqrt{2^l}}\sum_{s=0}^{2^l-1}|s\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and that of register $M$ is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{\sqrt{2^m}}\sum_{p=0}^{2^m-1}|p\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But after that, I'm not exactly sure how they're applying the $R_{zz}$ rotation gates to get to $$\sum_s\sum_p|p\rangle \exp(i p/2^m t_0)|s\rangle$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, are all the $R_{zz}$ gates acting on a single qubit i.e. the $l-1$th qubit in the register $L$? (Seems so from the diagram, but I'm not sure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, it would be very helpful if some can write down the steps for how're they're getting to $\sum_s\sum_p|p\rangle \exp(i p/2^m t_0)|s\rangle$ using the controlled rotation gates.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T13:30:12.033" LastActivityDate="2018-12-23T13:30:12.033" Title="How exactly is the stated composite state of the two registers being produced using the $R_{zz}$ controlled rotations?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="2565" PostTypeId="1" AcceptedAnswerId="2568" CreationDate="2018-07-01T19:47:46.293" Score="16" ViewCount="3345" Body="&lt;p&gt;I've probably read the chapter &lt;em&gt;The quantum Fourier transform and its applications&lt;/em&gt; from Nielsen and Chuang (10 th anniversary edition) a couple of times before and this took this thing for granted, but today, when I looked at it again, it doesn't seem obvious to me at all! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the circuit diagram for the Phase estimation algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7jgOV.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7jgOV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first register having $t$ qubits is supposedly the &quot;control register&quot;. If any of the qubit in the first register is in state $|1\rangle$ the corresponding controlled unitary gate &lt;strong&gt;gets applied to the second register&lt;/strong&gt;. If it is in a state $|0\rangle$ then it doesn't get applied to the &lt;strong&gt;second register&lt;/strong&gt;. If it is in a superposition of the two states $|0\rangle$ and $|1\rangle$ the action of the corresponding unitary on the second register can be determined by &quot;linearity&quot;. Notice, that all the gates are acting only on the second register and none on the first register. The first register is supposed to be only a &lt;strong&gt;control&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, they show that the final state of the &lt;strong&gt;first register&lt;/strong&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{2^{t/2}}\left(|0\rangle+\text{exp}(2\pi i&#xA; 2^{t-1}\varphi)|1\rangle)(|0\rangle+\text{exp}(2\pi i&#xA; 2^{t-2}\varphi)|1\rangle)...(|0\rangle+\text{exp}(2\pi i&#xA; 2^{0}\varphi)|1\rangle\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm surprised as to why we consider there to be a change in the state of the first register of qubits at all, after the action of the Hadamard gates. The final state of the first register should just have been &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\frac{|0\rangle+|1\rangle}{\sqrt 2}\right)^{\otimes t}$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;isn't it? I say this because the first register is supposed to be a control only. I don't understand how or why the state of the first register should change when acting as a control. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially thought that considering the exponential factors to be part of the first register qubit states was only a mathematical convenience, but then it didn't make sense. &lt;em&gt;State of a qubit or a system of qubits shouldn't depend upon what is mathematically convenient to us!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, could someone please explain &lt;strong&gt;why exactly the state of the first register of qubits changes, even when it simply acts as a &quot;control&quot; for the second register?&lt;/strong&gt; Is it just a mathematical convenience or is there something deeper? &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-07T08:07:16.193" LastActivityDate="2019-02-07T08:07:16.193" Title="Why does the &quot;Phase Kickback&quot; mechanism work in the Quantum phase estimation algorithm?" Tags="&lt;quantum-state&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="2566" PostTypeId="2" ParentId="2565" CreationDate="2018-07-02T05:19:38.267" Score="-1" Body="&lt;p&gt;Great question. &lt;br&gt;&#xA;I once asked this too, but it is not just a matter of mathematical convenience.&lt;br&gt;&#xA;The controlled-U is an &quot;entangling&quot; gate.&lt;br&gt; &#xA;Once there's entanglement, you cannot separate the state into &quot;first register&quot; and &quot;second register&quot;. &lt;br&gt;&#xA;Only think of these registers separately at the beginning, or when there's no entanglement. After there's entanglement, your best bet is to work through the mathematics (matrix multiplications) thoroughly, and you will indeed get the state given by Nielsen and Chuang. &lt;/p&gt;&#xA;" OwnerDisplayName="user2898" LastActivityDate="2018-07-02T05:19:38.267" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2568" PostTypeId="2" ParentId="2565" CreationDate="2018-07-02T06:31:32.183" Score="9" Body="&lt;p&gt;Imagine you have an eigenvector $|u\rangle$ of $U$. If you have a state such as $|1\rangle|u\rangle$ and you apply controlled-$U$ to it, you get out $e^{i\phi}|1\rangle|u\rangle$. The phase isn't attached to a specific register, it's just an overall multiplicative factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's use a superposition on the first register:&#xA;$$&#xA;(|0\rangle+|1\rangle)|u\rangle\mapsto |0\rangle|u\rangle+e^{i\phi}|1\rangle|u\rangle&#xA;$$ &#xA;You can rewrite this as&#xA;$$&#xA;(|0\rangle+e^{i\phi}|1\rangle)|u\rangle&#xA;$$&#xA;so it appears on the first register, even though it was sort-of created on the second register. (Of course that interpretation isn't entirely true because it was created by a two-qubit gate acting on both qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This step is at the heart of many quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why don't we write $|\Psi\rangle=|0\rangle|u\rangle+|1\rangle(e^{i\phi}|u\rangle)$ and just claim that it is not separable?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can't just claim it, but must show it mathematically. For example, we can take the partial trace over the second qubit,&#xA;$$&#xA;\text{Tr}_B(|\Psi\rangle\langle\Psi|_{AB})=\text{Tr}_B(|0\rangle\langle 0|\otimes |u\rangle\langle u|+|1\rangle\langle 0|\otimes e^{i\phi}|u\rangle\langle u|+|0\rangle\langle 1|\otimes |u\rangle\langle u|e^{-i\phi}+|1\rangle\langle 1|\otimes e^{i\phi}|u\rangle\langle u|e^{-i\phi})&#xA;$$&#xA;To take the partial trace, we pick a basis to sum over. For simplicity, let's pick $\{|u\rangle,|u^\perp\rangle\}$ where $\langle u|u^\perp\rangle=0$ and $\langle u|(e^{i\phi}|u\rangle=e^{i\phi}$. Then you get&#xA;$$&#xA;\text{Tr}_B(|\Psi\rangle\langle\Psi|_{AB})=|0\rangle\langle 0|+e^{i\phi}|1\rangle\langle 1|+e^{-i\phi}|0\rangle\langle 1|+|1\rangle\langle 1|&#xA;$$&#xA;This is rank 1 (and you can see the phase has appeared on the first register), so the state is not entangled. It is separable.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-02T07:36:17.823" LastActivityDate="2018-07-02T07:36:17.823" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2569" PostTypeId="2" ParentId="2524" CreationDate="2018-07-02T06:52:52.223" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how (do) engineers detect that the state function did not collapse due to the environment while a calculation is performed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In a sense, they don't. There's the possibility that you encode in an error correcting or error detecting code which permits the monitoring of errors. But really, before experimentalists want to run an algorithm, they've already done lots of tests on their system so they know how it works using a procedure called &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography#Quantum_process_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;process tomography&lt;/a&gt;. They've checked in great detail that each of their gates performs as they expect them to, so they already have a very accurate prediction of how much error there will be.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how to detect that a calculation is finished?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You don't need to detect that it has finished. The computation is made up of a definite set of quantum gates. All you do is apply each gate sequentially. You know when you've finished implementing them, so you know when to look at the answer.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how is it even possible to check whether the experimenter produced a certain quantum state? Maybe all the bits have a totally different state right from the start and you just know about that afterwards.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, you can make sure you've got the correct starting state because you can measure it (you always start in a product state that you can easily measure). The final result is just about making sure all the individual steps do exactly what they're supposed to do. Again, if you can't do them perfectly, error correction (and more generally, fault tolerance) can beused to keep you on track. It is true that you can't use measurements to determine the state and copy it many times, as you might think to do with classical computation, but there are still good error correcting techniques. But that's another whole question...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-02T06:52:52.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2570" PostTypeId="2" ParentId="1937" CreationDate="2018-07-02T07:13:26.463" Score="2" Body="&lt;p&gt;Let's start with a simple example where $H_i$ and $H_f$ commute because they are both diagonal:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_i=&#xA;\begin{pmatrix}1 &amp;amp; 0\\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_p=&#xA;\begin{pmatrix}-1 &amp;amp; 0\\&#xA;0 &amp;amp; -0.1&#xA;\end{pmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eigenvector with lowest eigenvalue (i.e. the ground state) of $H_i$ is $|1\rangle $ so we start in this state.&#xA;The ground state of $H_f$ is $|0\rangle$ so this is what we're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember the minimum runtime for the AQC to give the correct answer to within an error $\epsilon$:&lt;br&gt;&#xA;$\tau\ge \max_t\left(\frac{||H_i - H_f||^2}{\epsilon E_{\rm{gap}}(t)^3}\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is given and explained in Eq. 2 of &lt;a href=&quot;https://arxiv.org/pdf/1510.07420.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tanburn &lt;em&gt;et al.&lt;/em&gt; (2015)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let's say we want $\epsilon = 0.1$.&lt;/li&gt;&#xA;&lt;li&gt;Notice that $||H_i - H_f||^2 = 0.1 $ according Eq. 4 of the same paper.&lt;/li&gt;&#xA;&lt;li&gt;Notice that $\frac{||H_i - H_f||^2}{\epsilon}=1$ (I've chosen $\epsilon$ so that this would happen, but it doesn't matter).&lt;/li&gt;&#xA;&lt;li&gt;We now have $\tau \ge \max_t\left(\frac{1}{E_{\rm{gap}}(t)^3}\right)$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So what is the minimum gap between ground and first excited state (which gives the $\max_t$) ?&lt;br&gt;&#xA;When $t=20\tau/29$, the Hamiltonian is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H=\frac{9}{29}H_i + \frac{20}{29}H_p$&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H=\frac{9}{29}\begin{pmatrix}1 &amp;amp; 0\\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix} + \frac{20}{29}\begin{pmatrix}-1 &amp;amp; 0\\&#xA;0 &amp;amp; -0.1&#xA;\end{pmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;H=\begin{pmatrix}\frac{9}{29} &amp;amp; 0\\&#xA;0 &amp;amp; -\frac{9}{29}&#xA;\end{pmatrix}+\begin{pmatrix}-\frac{20}{29} &amp;amp; 0\\&#xA;0 &amp;amp; -\frac{2}{29}&#xA;\end{pmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$&#xA;H=\begin{pmatrix}\frac{-11}{29} &amp;amp; 0\\&#xA;0 &amp;amp; -\frac{11}{29}&#xA;\end{pmatrix}&#xA;$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when $t=\frac{20}{29}\tau$, we have $E_{\rm{gap}}=0$ and the &lt;strong&gt;&lt;em&gt;lower bound&lt;/em&gt;&lt;/strong&gt; on $\tau$ is essentially $\infty$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the adiabatic theorem still applies, but when it states that the Hamiltonian needs to change &quot;slowly enough&quot;, it turns out it needs to change &quot;infinitely slowly&quot;, which means you will not likely ever get the answer using AQC.  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-02T07:13:26.463" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2571" PostTypeId="2" ParentId="2554" CreationDate="2018-07-02T09:33:00.210" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;At least for now, I see a big problem with giving an answer that&#xA;  involves saying we could just use quantum encryption algorithms. The&#xA;  main reason is that in order for the encryption to be effective the&#xA;  end users would have to be in possession of a quantum encrypt/decrypt&#xA;  device. Not a problem for a bank or Amazon on their end, but a big&#xA;  problem for a guy trying to order a pizza on his smartphone.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not really.  Current day cryptosystems are mostly based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Integer_factorization&quot; rel=&quot;nofollow noreferrer&quot;&gt;integer factorization&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_logarithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;discrete logarithm&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://en.wikipedia.org/wiki/Elliptic-curve_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;elliptic curve cryptography&lt;/a&gt;. I'd like to point out to you: &lt;a href=&quot;https://en.wikipedia.org/wiki/Post-quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Post-quantum cryptography&lt;/a&gt;. There are already a few cryptography algorithms which are resistant to quantum computer attacks. And you don't need &lt;em&gt;necessarily&lt;/em&gt; &quot;quantum computers&quot; on the sender's or receiver's end for using such cryptography techniques.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cryptosystems which are quantum-resistant normally use problems which lie outside &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;nofollow noreferrer&quot;&gt;BQP&lt;/a&gt; rather than being &lt;a href=&quot;https://en.wikipedia.org/wiki/QMA#Problems_in_QMA&quot; rel=&quot;nofollow noreferrer&quot;&gt;QMA-hard&lt;/a&gt;. That implies, the owners of the private key (in this case the sender and receiver) can easily decrypt the message using a classical computer, whereas since the problem is QMA-hard without the private key, even using &quot;brute-force&quot;, it would be difficult for a quantum computer to hack. (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2518/26&quot;&gt;@DaftWullie's excellent answer&lt;/a&gt;) and his &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2516/what-classical-public-key-cryptography-protocols-exist-for-which-hacking-is-qma#comment3131_2518&quot;&gt;comment&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, in the normal classical case of RSA, the central function&#xA;  is factoring. The problem is (assumed to be) outside P making it hard&#xA;  for a classical computer to hack, but inside NP (NOT NP-hard) so that&#xA;  the rightful receiver can decrypt it on a classical computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To quote &lt;a href=&quot;https://en.wikipedia.org/wiki/Post-quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In contrast to the threat quantum computing poses to current&#xA;  public-key algorithms, most current &lt;strong&gt;symmetric cryptographic&#xA;  algorithms&lt;/strong&gt;, and &lt;strong&gt;hash functions&lt;/strong&gt; are considered to be relatively secure&#xA;  against attacks by quantum computers. While the &lt;strong&gt;quantum Grover's&#xA;  algorithm&lt;/strong&gt; does speed up attacks against &lt;strong&gt;symmetric ciphers&lt;/strong&gt;, doubling&#xA;  the key size can effectively block these attacks. &lt;strong&gt;Thus post-quantum&#xA;  symmetric cryptography does not need to differ significantly from&#xA;  current symmetric cryptography.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;By the way, I should point out that we're still quite a long way away from having actual quantum computers which can break current-day cryptosystems. The quantum computers of today aren't capable of even factorizing very large numbers. The largest number factorized by a quantum computer till date is $291311$&lt;sup&gt;[1]&lt;/sup&gt; (as far as I know). That's something even your hand PC can do in milliseconds and that is nowhere close to breaking a cryptosystem. Presumably, by the time we will have such quantum computers, cryptography will have already progressed by leaps and bounds (and we wouldn't have to worry about &quot;quantum attacks&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Moral of the story&lt;/strong&gt;: &lt;em&gt;Even in the future, your guy can still order pizzas using his &quot;classical&quot; smartphone without having to worry about hungry hackers stealing his pizzas using a quantum computer&lt;/em&gt;! ;)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1]: &lt;strong&gt;High-fidelity adiabatic quantum computation using the intrinsic Hamiltonian of a spin system: Application to the experimental factorization of 291311&lt;/strong&gt; Li &lt;em&gt;et al.&lt;/em&gt; (2017)&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-07-02T09:33:00.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2572" PostTypeId="2" ParentId="2565" CreationDate="2018-07-02T12:10:56.200" Score="15" Body="&lt;h2&gt;A first remark&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This same phenomenon of 'control' qubits changing states in some circumstances also occurs with controlled-NOT gates; in fact, this is the entire basis of eigenvalue estimation. So not only is it possible, it is an important fact about quantum computation that it is possible. It even has a name: a &quot;phase kick&quot;, in which the control qubits (or more generally, a control register) incurs relative phases as a result of acting through some operation on some target register.$\def\ket#1{\lvert#1\rangle}$&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The reason why this happens&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Why&lt;/em&gt; should this be the case? Basically it comes down to the fact that the standard basis is not actually as important as we sometimes describe it as being.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Short version.&lt;/strong&gt; &lt;em&gt;Only the standard basis states&lt;/em&gt; on the control qubits are unaffected. If the control qubit is in a state which is &lt;em&gt;not&lt;/em&gt; a standard basis state, it can in principle be changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Longer version &amp;mdash;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the Bloch sphere. It is, in the end, a sphere &amp;mdash; perfectly symmetric, with no one point being more special than any other, and no one &lt;em&gt;axis&lt;/em&gt; more special than any other. In particular, the standard basis is not particularly special.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CNOT operation is in principle a physical operation. To describe it, we often &lt;em&gt;express it in terms of how it affects the standard basis&lt;/em&gt;, using the vector representations&#xA;$$ \ket{00} \to {\scriptstyle \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}}\,,&#xA;\quad&#xA;\ket{01} \to {\scriptstyle \begin{bmatrix} 0 \\ 1  \\ 0 \\ 0 \end{bmatrix}}\,,&#xA;\quad&#xA;\ket{10} \to {\scriptstyle \begin{bmatrix} 0 \\ 0 \\ 1   \\ 0 \end{bmatrix}}\,,&#xA;\quad&#xA;\ket{11} \to {\scriptstyle \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1   \end{bmatrix}}$$&#xA;&amp;mdash; but this is just a representation. This leads to a specific representation of the CNOT transformation:&#xA;$$&#xA;\mathrm{CNOT}&#xA;\to&#xA;{\scriptstyle \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}}\,.$$&#xA;and for the sake of brevity we say that those column vectors &lt;em&gt;are&lt;/em&gt; the standard basis states on two qubits, and that this matrix &lt;em&gt;is&lt;/em&gt; a CNOT matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did you ever do an early university mathematics class, or read a textbook, where it started to emphasise the difference between a linear transformation and matrices &amp;mdash; where it was said, for example, that a matrix could &lt;em&gt;represent&lt;/em&gt; a linear transformation, but was not &lt;em&gt;the same as&lt;/em&gt; a linear transformation? The situation with CNOT in quantum computation is one example of how this distinction is meaningful. The CNOT is a transformation of a &lt;em&gt;physical system&lt;/em&gt;, not of column vectors; the standard basis states are just &lt;em&gt;one basis&lt;/em&gt; of a physical system, which we &lt;em&gt;conventionally represent&lt;/em&gt; by $\{0,1\}$ column vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if we were to choose to represent a different basis &amp;mdash; say, the X eigenbasis &amp;mdash; by $\{0,1\}$ column vectors, instead? Suppose that we wish to represent $$&#xA;\begin{aligned}&#xA;\ket{++} \to{}&amp;amp; [\, 1 \;\; 0 \;\; 0 \;\; 0 \,]^\dagger\,,&#xA;\\&#xA;\ket{+-} \to{}&amp;amp; [\, 0 \;\; 1 \;\; 0 \;\; 0 \,]^\dagger\,,&#xA;\\&#xA;\ket{-+} \to{}&amp;amp; [\, 0 \;\; 0 \;\; 1 \;\; 0 \,]^\dagger\,,&#xA;\\&#xA;\ket{--} \to{}&amp;amp; [\, 0 \;\; 0 \;\; 0 \;\; 1 \,]^\dagger \,.&#xA;\end{aligned}$$&#xA;This is a perfectly legitimate choice mathematically, and because it is only a notational choice, it doesn't affect the physics &amp;mdash; it only affects the way that we would write the physics. It is not uncommon in the literature to do analysis in a way equivalent to this (though it is rare to explicitly write a different convention for column vectors as I have done here). We would have to represent the standard basis vectors by:&#xA;$$ \ket{00} \to \tfrac{1}{2}\,{\scriptstyle \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix}}\,,&#xA;\quad&#xA;\ket{01} \to \tfrac{1}{2}\,{\scriptstyle \begin{bmatrix} 1 \\ -1  \\ 1 \\ -1 \end{bmatrix}}\,,&#xA;\quad&#xA;\ket{10} \to \tfrac{1}{2}\,{\scriptstyle \begin{bmatrix} 1 \\ 1 \\ -1   \\ -1 \end{bmatrix}}\,,&#xA;\quad&#xA;\ket{11} \to \tfrac{1}{2}\,{\scriptstyle \begin{bmatrix} 1 \\ -1 \\ -1 \\ 1   \end{bmatrix}}\,.$$&#xA;Again, we're using the column vectors on the right &lt;em&gt;only to represent&lt;/em&gt; the states on the left. But this change in representation will affect how we want to represent the CNOT gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A sharp-eyed reader may notice that the vectors which I have written on the right just above are the columns of the usual matrix representation of $H \otimes H$. There is a good reason for this: what this change of representation amounts to is a change of reference frame in which to describe the states of the two qubits. In order to describe $\ket{++} = [\, 1 \;\; 0 \;\; 0 \;\; 0 \,]^\dagger$, $\ket{+-} = [\, 0 \;\; 1 \;\; 0 \;\; 0 \,]^\dagger$, and so forth, we have changed our frame of reference for each qubit by a rotation which is the same as the usual matrix representation of the Hadamard operator &amp;mdash; because that same operator interchanges the $X$ and $Z$ observables, by conjugation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This same frame of reference will apply to how we represent the CNOT operation, so in this shifted representation, we would have&#xA;$$&#xA;\begin{aligned}&#xA;\mathrm{CNOT} \to \tfrac{1}{4}{}\,{\scriptstyle&#xA;\begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix}&#xA;\,\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}\,&#xA;\begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix}&#xA;}\,&#xA;=&#xA;\,{\scriptstyle&#xA;\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}}&#xA;\end{aligned}$$&#xA;which &amp;mdash; remembering that the columns now represent $X$ eigenstates &amp;mdash; means that the CNOT performs the transformation&#xA;$$ \begin{aligned}&#xA;\mathrm{CNOT}\,\ket{++} &amp;amp;= \ket{++} , \\&#xA;\mathrm{CNOT}\,\ket{+-} &amp;amp;= \ket{--}, \\&#xA;\mathrm{CNOT}\,\ket{-+} &amp;amp;= \ket{-+} , \\&#xA;\mathrm{CNOT}\,\ket{--} &amp;amp;= \ket{+-} .&#xA;\end{aligned} $$&#xA;Notice here that it is &lt;em&gt;only&lt;/em&gt; the first, 'control' qubits whose state changes; the target is left unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I could have shown this same fact a lot more quickly without all of this talk about changes in reference frame. In introductory courses in quantum computation in computer science, a similar phenomenon might be described without ever mentioning the words 'reference frame'. But I wanted to give you more than a mere calculation.  I wanted to draw attention to the fact that a CNOT is in principle not just a matrix; that the standard basis is not a special basis; and that when you strip these things away, it becomes clear that the operation realised by the CNOT clearly has the potential to affects the state of the control qubit, even if the CNOT is the only thing you are doing to your qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The very idea that there is  a 'control' qubit is one centered on the standard basis, and embeds a prejudice about the states of the qubits that  invites us to think of the operation as one-sided. But as a physicist, you should be deeply suspicious of one-sided operations. &lt;em&gt;For every action there is an equal and opposite reaction&lt;/em&gt;; and here the apparent one-sidedness of the CNOT on &lt;em&gt;standard basis states&lt;/em&gt; is belied by the fact that, for X eigenbasis states, it is the 'target' which unilaterally determines a possible change of state of the 'control'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You wondered whether there was something at play which was only a mathematical convenience, involving a choice of notation. In fact, there is: the way in which we write our states with an emphasis on the standard basis, which may lead you to develop a &lt;em&gt;non-mathematical intuition&lt;/em&gt; of the operation &lt;em&gt;only in terms&lt;/em&gt; of the standard basis. But change the representation, and that non-mathematical intuition goes away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thing which I have sketched for the effect of CNOT on X-eigenbasis states, is also going on in phase estimation, only with a different transformation than CNOT. The 'phase' stored in the 'target' qubit is kicked up to the 'control' qubit, because the target is in an eigenstate of an operation which is being coherently controlled by the first qubit. On the computer science side of quantum computation, it is one of the most celebrated phenomena in the field. It forces us to confront the fact that the standard basis is only special in that it is the one we prefer to describe our data with &amp;mdash; but not in how the physics itself behaves.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-07-02T12:30:42.240" LastActivityDate="2018-07-02T12:30:42.240" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2573" PostTypeId="2" ParentId="2352" CreationDate="2018-07-02T13:53:55.143" Score="7" Body="&lt;p&gt;&lt;em&gt;Caveat.&lt;/em&gt; I can't be absolutely certain that no-one has contemplated a quantum XOR list before &amp;mdash; but I can be pretty confident. On the theory side, the idea of data structures as granular as linked lists (of any description) is pretty low-level, and to my knowledge is not really the subject of research; and people working on architectures only dream of the day in which they might worry about how to store data structures in their machines. So it's likely that there is no pre-defined art on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before we consider &quot;quantum XOR linked lists&quot;, the main thing to consider is what a linked list &lt;em&gt;does&lt;/em&gt;. It is just a data structure which is used to maintain a list of data items, where the 'links' encode memory addresses for the next or previous item in the list. This idea is pretty generic (that's a compliment, not an insult): it can be applied to &lt;em&gt;any&lt;/em&gt; sort of data without modification. On the other hand, it is possible to contemplate ways to extend the addressing itself to the quantum regime: this is something which, at least in principle, you may want to do, for example if you are interested in superpositions of possible list values for some algorithm which relies on such a concept to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This motivates two concepts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Classically linked lists of quantum data values&lt;/strong&gt;, in which the data is quantum but the memory addresses are classical pointers to definite qubits or other quantum registers. This is the application of the notion of &quot;linked list of [X]&quot; to the case where 'X' happens to be quantum data. The data structure doesn't care that the data itself is quantum: the data structure is there to act as a box in which to order your data, and is completely agnostic as to what is to be done with that data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this sort of linked list, the way to get an XOR linked list is simple: you do the same thing as for XOR Linked lists of classical data. The fact that the data is quantum doesn't make any difference to the data structure in this case, so you use the very same techniques.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum-linked lists&lt;/strong&gt;, in which the data is quantum, and so are the encodings of the memory addresses. This is what you would do if you wanted to consider superposition of possible lists, including arbitrary variations in list-length. If you're wondering how you could possibly retrieve data from a superposition of memory addresses, it seems to me that the answer is the same as you would do with any&#xA;algorithm which queries a &quot;quantum database&quot; in superposition: you&#xA;require access to a qRAM, as a means to perform coherent queries of a data bank.&#xA;If the data stored at the address is &lt;em&gt;also&lt;/em&gt; quantum, you cannot clone it of course; but perhaps you can move that data (in a particular branch of the superposition) from the qRAM to your&#xA;active data qubits &amp;mdash; your 'cache', if you will &amp;mdash; in order to operate on it more&#xA;quickly. After you have performed the operations you intend to perform on that cached data, you might then swap it back to the qRAM.&#xA;In the meantime, the state of your working memory will be entangled with one or more registers of the qRAM, but there is nothing theoretically wrong with that, so long as you maintain the appropriate hygiene to keep from disrupting your data in ways that you do not intend. I have no specific suggestions for when you would actually want to do this, but as it is not an obviously ridiculous thing to want to do, I see no reason not to take this concept seriously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such a list, one should generally expect the pointer values of elements later in the list, to be entangled with pointer values earlier in the list.&#xA;You will have to be careful about how you store copies of memory addresses, as you compute them and (just as importantly!) &lt;strong&gt;uncompute&lt;/strong&gt; them, to traverse the quantum linked list.&#xA;The data structure might be represented almost as a decision tree, though there is likely some application of this data structure which would make the relative phases of the &lt;em&gt;pointer values&lt;/em&gt; important, and which would distinguish it from a decision tree. (These are features which one should generally expect of a data structure built from quantum registers for memory addresses.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is any reason at all to consider superpositions of memory addresses, then as soon as it becomes reasonable at all to realise data structures such as linked lists on quantum computers, an XOR-linked list seems a very sensible idea for a data structure. The savings in resources for the links would be a significant benefit for the foreseeable future, with only modest overhead in the additional cached data required to compute the addresses for the forward and backward links. The way one would realise these are &lt;em&gt;almost&lt;/em&gt; the same as for classical XOR-linked lists: the memory addresses are encoded as standard basis vectors, for which you may computer the XOR, and more generally you may take the superposition of the parities computed by XOR. The principle is essentially the same as for a more general quantum linked list; you just use a more elaborate encoding for the pointers. This may require a little bit more care to be taken to uncompute the links addresses as you traverse the list, but it seems likely that only a modest amount of additional work is required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The major constraint that I see for quantum-linked lists &amp;mdash; whether singly-, doubly-, or XOR-linked &amp;mdash; is the uncomputation of memory addresses as you traverse the list. Whether this ever poses a significant problem would probably depend on &lt;em&gt;how&lt;/em&gt; and &lt;em&gt;why&lt;/em&gt; you would want to traverse a quantum-linked list, which is to say, what you want to accomplish with it. However, it seems clear in principle that one can define such quantum-linked lists, and the way they would be implemented would be similar to a reversible implementation of classical linked lists, assuming that there is the appropriate architecture (such as qRAM in this case) to support the question of fetching data from addresses stored in superposition.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-07-02T13:53:55.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2574" PostTypeId="2" ParentId="2499" CreationDate="2018-07-02T15:50:16.033" Score="15" Body="&lt;p&gt;When you ask whether it is pie in the sky, that rather depends on what promises you think quantum technologies are trying to fulfil. And that depends on who the people are making those promises.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider why you are even aware of quantum computation, given that it hasn't yet managed to produce any devices (or to be more fair, &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/2000Q%20Systems%20in%20Lab%20website.jpeg&quot; rel=&quot;noreferrer&quot;&gt;not very many devices&lt;/a&gt;) which resemble muscular computer hardware. Where are you hearing about it from, whence the excitement? I'm willing to bet that even if you attend every academic talk about quantum computing that you can personally manage to, not very much of what you hear about quantum computing is coming from academics. Chances are you hear a lot about quantum computing from sources which are more interested in excitement than fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some corporate sources who are making more or less grandiose claims about what their quantum hardware can do, or will be able to do; and there have been for well over a decade. Meanwhile, there is a large community of people who have simply been trying to make careful progress and not spend too much of their energy making promises they can't deliver. Whom will you have heard more from?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But even granting those, the parties most responsible for excitement about quantum computation are certain kinds of magazines and special-interest websites, which as sources of information are like market-square waffle vendors: they trade very much on sweet vaporous aromas rather than something with substance and bite. &#xA;The attention-seeking advertising industry, rather than academia, are the main reason why there are such puffed-up expectations of quantum computation. They don't even care about quantum computation in principle: it is one of several magical incantations with which to amaze the crowd, to evoke dreams of pie in the sky, and in the meantime make money from some other company for the mere possibility that an ad was seen for half a second. &lt;em&gt;That&lt;/em&gt; industry is very much in the business of selling airborne pastry, both to their clients and to their audience.  But does that mean that the world is owed flying fig rolls by those who are actually working on quantum technologies? It's hard enough to accomplish the things which &lt;em&gt;we&lt;/em&gt; think might be possible to accomplish &amp;mdash; which are more modest, but still worthwhile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Among my academic peers (theoretical computer scientists and theoretical physicists), the blatant misinformation about quantum computation among the public is a source of significant frustration. Most of us believe that it will be possible to build a quantum computer, and most of those who do also believe that it will have significant economic impacts. But none of us expect that it would turn the world upside-down in five to ten years, nor have we been expecting that for any of the past fifteen years that it started to become fashionable to say that we would have massive quantum computers &quot;in five to ten years&quot;. I have always made it a point to say that I hope to see the impacts in my lifetime, and recent activity has made me hope to see it within twenty &amp;mdash; but even then you won't be going to the store to buy one, any more than you go down to the store to buy a Cray supercomputer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nor do any of us expect that it will allow you to easily solve the Travelling Salesman Problem, or the like. Being able to analyse problems in quantum chemistry and quantum materials is the original, and in the short term still the best, prospective application of quantum computation, and it may be revolutionary there; and perhaps in the longer term we can provide robust and significant improvements in practise for optimisation problems. (D-Wave claims they can already do this in practise with their machines: the jury is still out among academics whether this claim is justified.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The devil of it is, to explain what you can actually expect out of the theory and development of quantum computation, you have to somehow explain a little quantum mechanics. This Is Not An Easy Thing To Do, and as with anything complicated, there is little patience in the larger world for nuanced understanding, especially when &quot;alternative facts&quot; in the form of candy-flavoured 'yakawow' hype is striding mightily around in seven league boots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The truth &amp;mdash; about what quantum computation can do, and that it likely won't allow you to teleport across the world, nor solve world hunger or airline chaos at a stroke &amp;mdash; is boring. But making significant advances in chemistry and materials science is not. To say nothing of applications not yet developed: how easily can you extrapolate from gear-based computers to &lt;a href=&quot;https://en.wikipedia.org/wiki/Pascal%27s_calculator&quot; rel=&quot;noreferrer&quot;&gt;help reliably compute taxes&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Difference_engine&quot; rel=&quot;noreferrer&quot;&gt;compute logarithm-tables&lt;/a&gt; to &lt;a href=&quot;https://en.wikipedia.org/wiki/Aircraft_design_process#Computer-aided_design_of_aircraft&quot; rel=&quot;noreferrer&quot;&gt;designing aircraft&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The timeline of classical computing technology extends well before even the 19th century. We have some idea of how to try to re-tread this path with quantum technologies, and we have an idea of the sorts of dividends which may be possible if we do so. For that reason, we hope to reproduce the development to useful computing technology in a much, much faster amount of time than the 370-plus years from Pascal's adders to the modern day. But it's not going to be quite as fast as some people have been promising, particularly those people who are not actually responsible for delivering on those 'promises'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some remarks.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;Where's the parallel adder?&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We  don't have large devices which carry out addition by quantum computers, but we do have some people working on fast addition circuits in quantum computers &amp;mdash; some of what quantum computers will have to do would involve more conventional operations on data in superposition. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;Where's the equivalent of Atlas, or the MU5?&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;To be frank, we're still working on the first reliable quantum analogue of Pascal's adder. I'm hopeful that the approach of the &lt;a href=&quot;https://nqit.ox.ac.uk&quot; rel=&quot;noreferrer&quot;&gt;NQIT project&lt;/a&gt; (disclosure: I'm involved in it, but not as an experimentalist) of making small, high-quality modules which can exchange entanglement will be a route to rapid scaling via mass-production of the modules, in which case we might go from Pascal's adder, to the Collosus, to the Atlas, and beyond in a matter of a few years. But only time will tell.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;It looks like they haven't even got off the ground. You won't be buying one in PC World any time soon.&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;That is perfectly true. However, if you were ever told to expect otherwise, this is more likely to be the fault of PC World (or to be fair, PC World's competitors in the market for your subscription money as a tech enthusiast) than it is ours. Any responsible researcher would tell you that we're striving hard to make the first serious prototype devices. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;em&gt;Will you ever be able to [buy a quantum computer in PC World]?&lt;/em&gt;&quot; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Will you ever be able to buy a Cray in PC World? Would you want to? Maybe not. But your university may want to, and serious businesses may want to. Beyond that is wild speculation &amp;mdash; I don't see how a quantum computer would improve word-processing. But then again, I doubt that Babbage ever imagined that anything akin to his Difference Engine would be used to compose letters.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-07-02T16:07:40.120" LastActivityDate="2018-07-02T16:07:40.120" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2575" PostTypeId="2" ParentId="2553" CreationDate="2018-07-02T19:17:56.293" Score="5" Body="&lt;p&gt;In general, &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-techniques-5-workingwithqubits?view=qsharp-preview#allocating-qubits&quot; rel=&quot;noreferrer&quot;&gt;there are exactly two ways to allocate qubits in Q#&lt;/a&gt;: the &lt;code&gt;using&lt;/code&gt; statement, and the &lt;code&gt;borrowing&lt;/code&gt; statement.&#xA;Both can only be used from within Q#, and can't be directly used from within C#.&#xA;Thus, you'd likely want to make a new Q# operation to serve as the &quot;entry point&quot; from C#; this new operation would then be responsible for allocating qubits and passing them down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// MyOp.qs&#xA;operation EntryPoint() : () {&#xA;    body {&#xA;        using (register = Qubit[2]) {&#xA;            myOp(register);&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;&#xA;// Driver.cs&#xA;EntryPoint.Run().Wait();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2018-07-02T19:17:56.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2576" PostTypeId="2" ParentId="2553" CreationDate="2018-07-02T19:18:34.197" Score="3" Body="&lt;p&gt;All qubits must be allocated by the &lt;code&gt;Simulator&lt;/code&gt;, so you can't create an instance and pass it down to your Operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do you want to create the &lt;code&gt;Qubits&lt;/code&gt; on the driver? If anything, you should create an &quot;entry&quot; method on Q# that just allocates your qubits and then call your &lt;code&gt;operation&lt;/code&gt;, and call that from the Driver.&lt;/p&gt;&#xA;" OwnerUserId="2918" LastActivityDate="2018-07-02T19:18:34.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2577" PostTypeId="1" AcceptedAnswerId="2579" CreationDate="2018-07-02T19:26:24.927" Score="5" ViewCount="362" Body="&lt;p&gt;What exactly &lt;em&gt;is&lt;/em&gt; a logical (non-physical? error corrected?) qunit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can quantum systems be built exclusively w/ logical qunits?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-13T19:56:16.013" LastActivityDate="2018-12-13T19:56:16.013" Title="Computing with Logical Qunits" Tags="&lt;error-correction&gt;&lt;qudit&gt;&lt;emulation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2578" PostTypeId="1" CreationDate="2018-07-02T19:30:11.040" Score="-6" ViewCount="263" Body="&lt;p&gt;Does something &lt;em&gt;like&lt;/em&gt; Mohs' scale exist for quantum computing? (eg. classical = 0, hybrid = 5, pure quantum = 10)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Mohs' scale:&lt;/strong&gt; a scale of hardness used in classifying minerals. It runs from 1 to 10 using a series of reference minerals, and a position on the scale depends on the ability to scratch minerals rated lower.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The idea came from seeing &lt;a href=&quot;https://worldbuilding.stackexchange.com/questions/51028/knowledge-about-science-really-necessary-for-sci-fi/51030#51030&quot;&gt;this answer&lt;/a&gt; which mentions &quot;Mohs' scale of Sci-fi hardness.&quot;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2019-01-13T15:57:52.230" LastActivityDate="2019-01-13T15:57:52.230" Title="Scale for Quantum Computing" Tags="&lt;physical-realization&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2018-07-27T18:40:30.107" ContentLicense="CC BY-SA 4.0" />
  <row Id="2579" PostTypeId="2" ParentId="2577" CreationDate="2018-07-02T19:45:12.133" Score="5" Body="&lt;p&gt;A logical qubit is made out of many physical qubits (or qudits), simply selecting a particular two-dimensional subspace. So you can’t make it “exclusively” out of logical qubits because they sit on top of real physical qubits. In fact, if you're thinking about a terminology of &quot;virtual qubits&quot;, that is actually best thought of as a synonym for &quot;logical qubits&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember what should almost be the mantra of quantum computing: &quot;information is physical&quot;. Information doesn't exist unless it is recorded somewhere, so it must be recorded on something physical and the physical operations that can be performed on that information carrier determine the nature of the information theory. So if you want a logical qubit you'd better be using quantum information carriers at the physical level. It doesn't matter what quantum information carrier you use as your physical qubit, whether that's a spin or a photon, or any type of two-level system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no particular relation between the number of physical qubits and the number of logical qubits (so long as the size of the space for logical qubits $\leq$ size of space for physical qubits). You might, however, use the relation as some sort of measure of efficiency. For example, we often talk about error correcting codes as defining a logical qubit. They’re defined on multiple physical qubits and give you a smaller number of “useful” qubits. Most critically, when you start talking about fault-tolerance, you have two parameters: $p_c$, the critical error rate above which the fault tolerant scheme cannot achieve arbitrary accuracy, and $p_a&amp;lt;p_c$, the actual error rate that you can achieve. The variation of the number of physical qubits you require to achieve a single error corrected logical qubit as $p_a$ approaches $p_c$ tells you a lot about the feasibility of fault-tolerance and the accuracy we need to aim for to get good quality quantum computing on modestly sized quantum computer..&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-03T07:21:04.813" LastActivityDate="2018-07-03T07:21:04.813" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2580" PostTypeId="2" ParentId="2561" CreationDate="2018-07-02T20:01:14.357" Score="1" Body="&lt;p&gt;In Q# you use either the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/prelude/microsoft.quantum.primitive.m?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;M&lt;/code&gt;&lt;/a&gt; or the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/prelude/microsoft.quantum.primitive.measure?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Measure&lt;/code&gt;&lt;/a&gt; operations to measure a qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the measurement of the Qubit, you can use things like &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;for&lt;/code&gt; or other &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-qr-statements?view=qsharp-preview#control-flow&quot; rel=&quot;nofollow noreferrer&quot;&gt;control flow statements&lt;/a&gt; to control your program execution based on the variable values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that answer your question?&lt;/p&gt;&#xA;" OwnerUserId="2918" LastActivityDate="2018-07-02T20:01:14.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2581" PostTypeId="2" ParentId="2499" CreationDate="2018-07-02T20:22:37.987" Score="10" Body="&lt;p&gt;Like all good questions, the point is what you mean. As the CTO of a startup developing a quantum computer, I have to emphatically disagree with the proposition that quantum computing is just pie in the sky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then you assert &quot;You won't be buying one in PC World any time soon.&quot; This I not only agree with but would suggest that in the foreseeable future, you won't be able to, which is as close to &quot;never&quot; as you'll get me to assert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is that? To the first point, it is valid because there are no engineering reasons to prevent us from building a quantum computer and in fact there are no reasons that will continue to prevent us from building one for much longer. To the second point, it is because it is harder to build a quantum computer than it is to build a classical computer (you need special conditions such as extremely cold temperatures or a very good vacuum, and they are slower) yet there are only certain problems that quantum computers excel at. You don't need any laptops to do drug discovery by computation or breaking outdated crypto or to accelerate inverting some function (especially not if they come with wardrobe sized support equipment), but you need one or a few supercomputers to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why can I say there are no engineering issues that prevent (large, universal) quantum computers? Note that a single example would suffice, hence I choose the technology I know best, the one I am pursuing professionally. In ion trap based quantum computing, all the ingredients one needs have been demonstrated: There are high-fidelity, universal quantum gates. There are successful attempts to move ions (separate and recombine them from strings of ions, move them along paths, and through intersections of paths), with suitable performance. Plus initializing, measuring, etc. is possible at a fidelity comparable to gate operations. The only thing that prevents large, universal ion trap based quantum computers from being built are related to getting the scientists that made the individual contributions together with the right engineers, serious engineering indeed, and finance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm itching to even tell you just how one might go about getting the feat done soon, technically, but I fear I'd make our patent attorney (and my CEO and everyone else in the company) a bit mad. What it boils down to is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If quantum computing is indeed a pie in the sky, then looking back, people in the future will perceive it as just such a low hanging fruit as the first microcomputers.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-07-02T20:22:37.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2582" PostTypeId="2" ParentId="2578" CreationDate="2018-07-02T20:30:32.973" Score="2" Body="&lt;p&gt;We used Mohs' scale in Earth Science class to measure the hardness of rocks. If we could scratch it with our finger nail it meant the rock had a hardness of 2 or less. If not it had a hardness of 3 or more. Then if that rock could be scratched by another rock we would assign something greater and if it could scratch softer rocks we'd give it something less. Eventually we were able to come up with a self-consistent order of hardness for all rocks in the data set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not see why you are comparing this to quantum computers.&#xA;Why Mohs' scale and not the Richter scale or the Kinsey scale or the pH scale?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question: There is no such scale I know of for quantum, classical, hybrid computers. The reason why is probably the fact that those three (quantum, classical, hybrid) are the only things on the scale worth mentioning, so it is a ternary scale (1,2, or 3) not something more sophisticated like a 1-10. We therefore don't have to use numbers and can just use the names, which are more descriptive, self-explanatory, and therefore clear.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-02T22:06:32.787" LastActivityDate="2018-07-02T22:06:32.787" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2583" PostTypeId="2" ParentId="2561" CreationDate="2018-07-02T20:37:47.890" Score="3" Body="&lt;p&gt;You can check for state equality with the SWAP test.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102001&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum fingerprinting (Buhrman, Cleve, Watrous &amp;amp; de Wolf, 2001)&lt;/a&gt; seems to be the first paper to introduce the SWAP test.&lt;/p&gt;&#xA;&lt;p&gt;The idea behind this test is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Encode the 2 quantum states using quantum error correction codes to &amp;quot;increase the difference between them&amp;quot;.&lt;/li&gt;&#xA;&lt;li&gt;Test the 2 code words by using an ancilla register and the procedure below.&lt;/li&gt;&#xA;&lt;li&gt;Read the ancilla register. If it is &lt;span class=&quot;math-container&quot;&gt;$\left\vert 0 \right\rangle$&lt;/span&gt; then the 2 states are probably equal. Else, they are probably different.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W45h1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W45h1.png&quot; alt=&quot;SWAP test&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can repeat the procedure multiple times to ensure that the 2 states are equal up to a given probability.&lt;/p&gt;&#xA;&lt;p&gt;You can implement by yourself the test on QISKit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, execute&#xA;from qiskit import IBMQ, BasicAer&#xA;&#xA;q_simulator = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;register_size = 2&#xA;&#xA;qr_psi = QuantumRegister(register_size, 'psi')  #For state PSI&#xA;qr_phi = QuantumRegister(register_size, 'phi')  #For state PHI&#xA;qr_ancilla = QuantumRegister(1, 'ancilla')&#xA;cequal = ClassicalRegister(1, 'equal')&#xA;&#xA;circuit = QuantumCircuit()&#xA;&#xA;circuit.add_register(qr_psi)&#xA;circuit.add_register(qr_phi)&#xA;circuit.add_register(qr_ancilla)&#xA;circuit.add_register(cequal)&#xA;&#xA;&#xA;def cswap(circuit, ctrl, q1, q2) -&amp;gt; None:&#xA;    assert(len(q1) == len(q2), &amp;quot;The swapped register sizes should match&amp;quot;)&#xA;    for i in range(len(q1)):&#xA;        # Controlled swap&#xA;        circuit.ccx(ctrl, q1[i], q2[i])&#xA;        circuit.ccx(ctrl, q2[i], q1[i])&#xA;        circuit.ccx(ctrl, q1[i], q2[i])&#xA;&#xA;def equality_test(circuit, ancilla, q1, q2, classical_register) -&amp;gt; None:&#xA;    assert(len(q1) == len(q2), &amp;quot;The swapped register sizes should match&amp;quot;)&#xA;    circuit.h(ancilla[0])&#xA;    cswap(circuit, ancilla[0], q1, q2)&#xA;    circuit.h(ancilla[0])&#xA;    circuit.measure(ancilla[0], classical_register[0])&#xA;&#xA;## Initialisation&#xA;# We add Hadamard to all the registers - to create PSI&#xA;circuit.h(qr_psi)&#xA;# We add Hadamard to all the registers - to create PHI&#xA;# Modify the initialisation of either PHI or PSI and check the results.&#xA;circuit.x(qr_phi)&#xA;circuit.h(qr_phi)&#xA;&#xA;## SWAP test&#xA;equality_test(circuit, qr_ancilla, qr_psi, qr_phi, cequal)&#xA;&#xA;res_qasm = execute([circuit], q_simulator, shots=1024).result()&#xA;counts = res_qasm.get_counts()&#xA;&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can convince yourself that the method works with high probability by changing the initialisation step of the two registers and check the results when the 2 register match or don't match.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="9201" LastEditDate="2020-06-22T13:38:34.700" LastActivityDate="2020-06-22T13:38:34.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2584" PostTypeId="2" ParentId="2577" CreationDate="2018-07-02T21:10:25.507" Score="2" Body="&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Logical qubits are just an abstraction above physical qubits. A logical qubit is &lt;em&gt;something&lt;/em&gt; (see after for examples) that acts like a qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some examples&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A logical qubit can be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A single physical qubit. This is the case for most of (all?) the quantum chips currently available. In this case, the logical qubit has no advantage over the physical one (they are the same qubits).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiple qubits used for quantum error correction code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the user sees the logical qubit as a &lt;strong&gt;single&lt;/strong&gt; qubit and does not need to know the underlying error correction scheme because the logical qubit behaves &lt;strong&gt;like&lt;/strong&gt; a physical one. This case is quite interesting for quantum computing because we could &quot;hide&quot; the complexity of quantum error correction algorithm behind logical qubits. The user will only see one qubit with low error rates, but the physical setup will be composed of multiple qubits.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As of today, the term &quot;logical qubit&quot; is mostly used in quantum error correction but may be used in other fields in the future.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Side note&lt;/em&gt;: to answer your question in comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any sort of generalization as to how physical &amp;amp; logical qubits correlate? (eg. n logical qubits requires $n^2$ physical qubits) Although they tend to be made of physical qubits, can they be made of other things? (eg. how could they be made photonicly or could they be purely virtual)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is no generalisation on the number of physical qubits needed to encode one logical qubit. This is entirely dependant on the error correction algorithm used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A purely virtual qubit does not exists. Logical qubits are necessarily composed of physical qubits. Note that a &quot;qubit&quot; is already an abstraction: it abstract the physical representation used. As a logical qubit is defined in term of &quot;qubits&quot;, logical qubits are independant of the physical implementation of the underlying qubits.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-07-02T21:10:25.507" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2585" PostTypeId="2" ParentId="2578" CreationDate="2018-07-02T22:10:54.177" Score="2" Body="&lt;p&gt;This is not exactly like Mohs' hardness scale, but it's a series of 5 different definitions of quantum comptuers by Michele Mosca:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Definition 1:&lt;/strong&gt; Since the world is quantum, any computer is a quantum computer. Conventional computers are just weak quantum&#xA;  computers, since they don’t exploit intrinsically quantum effects,&#xA;  such as superposition and entanglement.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Definition 2:&lt;/strong&gt; A quantum computer is a computer that uses intrinsically quantum effects that cannot naturally be modeled by&#xA;  classical physics. Classical computers may be able to mathematically&#xA;  simulate instances of such computers, but they are not implementing&#xA;  the same kinds of quantum operations.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Definition 2’:&lt;/strong&gt; Definition 2, where there are strong tests or proofs of the quantum effects at play (e.g. by doing Bell tests).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Definition 3:&lt;/strong&gt; A quantum computer is a computer that uses intrinsically quantum effects to gain some advantage over the best&#xA;  known classical algorithms for some problem.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Definition 4:&lt;/strong&gt; A quantum computer is a computer that uses intrinsically quantum effects to gain an asymptotic speed-up over the&#xA;  best known classical algorithms for some problem. (The difference with&#xA;  definition 3 is that the advantage is a fundamental algorithmic one&#xA;  that grows for larger instances of the problem; versus advantages more&#xA;  closely tied to hardware or restricted to instances of some bounded&#xA;  size.)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Definition 5:&lt;/strong&gt; A quantum computer is a computer that is able to capture the full computational power of quantum mechanics, just as&#xA;  conventional computers are believed to capture the full computational&#xA;  power of classical physics. This means, e.g. that it could implement&#xA;  any quantum algorithm specified in any of the standard quantum&#xA;  computation models. It also means that the device is in principle&#xA;  scalable to large sizes so that larger instances of computational&#xA;  problems may be tackled.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://qz.com/194738/why-nobody-can-tell-whether-the-worlds-biggest-quantum-computer-is-a-quantum-computer/#footnote&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qz.com/194738/why-nobody-can-tell-whether-the-worlds-biggest-quantum-computer-is-a-quantum-computer/#footnote&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-02T22:10:54.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2586" PostTypeId="1" CreationDate="2018-07-03T00:41:59.707" Score="7" ViewCount="140" Body="&lt;p&gt;The traditional definition of a nonlocal game is restricted to having two players and one round (e.g., &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0404076&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;), but it is natural to consider a more general class of games that may have more than two players and more than one round of questions. While there has been a lot of work dealing with games with more than two players, I have found very little on multi-round games. For instance, there is &lt;a href=&quot;https://arxiv.org/abs/1801.04598&quot; rel=&quot;noreferrer&quot;&gt;a recent preprent of Crépeau and Yang&lt;/a&gt; that gives a definition of a multi-party, multi-round non-signaling distribution and seems to describe a multi-round game (although the paper is written in the language of commitment schemes rather than games, so I'm not entirely sure my interpretation is correct).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has there been any other work dealing with multi-round games? And is there a reason so much of the literature has focused on single-round games? Are multi-round games inherently &quot;no more interesting&quot; than single-round games from the perspective of understanding nonlocality?&lt;/p&gt;&#xA;" OwnerUserId="2547" LastActivityDate="2018-07-03T19:42:14.950" Title="Has anyone analyzed multi-round nonlocal games?" Tags="&lt;quantum-information&gt;&lt;non-locality&gt;&lt;games&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2587" PostTypeId="1" CreationDate="2018-07-03T01:54:26.753" Score="7" ViewCount="234" Body="&lt;p&gt;One of the novel features of Bitcoin and other cryptocurrencies is that coins can be irrefutably &quot;burned&quot; or destroyed, by creating a transaction to send the money to a junk burn address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking similarly about quantum money - from knots, or hidden subspaces, Wiesner's currency, BBBW, etc. - has an &quot;obvious&quot; way to be destroyed.  For example, given a legitimate Wiesner coin, by measuring in the &quot;wrong&quot; basis, the currency would be destroyed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's not clear how to irrefutably prove that the coin was destroyed.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, if I have a Wiesner coin, and I tell the world that I've burned it, is there a way that I can do it so that others will believe me?  Even if I'm the bank?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I first heard of this question in a fascinating and stimulating lecture by Or Sattath - &lt;a href=&quot;https://www.youtube.com/watch?v=Zd5tDyPXsIM&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=Zd5tDyPXsIM&lt;/a&gt; - at around 59:20.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Meowwzz suggests, clearly measuring a coin in a burn basis will burn it.  That burn basis can even be orthogonal to the valid basis, maximally destroying the coin, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option that comes to mind is for the bank to publish and broadcast, on a public classical channel, the &lt;strong&gt;correct&lt;/strong&gt; basis for a serial number $s$. Thus, the secret is released, enabling anyone to clone the coin at will, and effectively destroying the unclonability, and hence uniqueness and value, of the coin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such an option (on a classical channel) is viable for Wiesner's coin, and the Hidden Subspaces coin, but I don't think for the Quantum Knots coin - there's no secret to be released on the Knots coin.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, such an option can only be done by the bank or whoever knows the classical secret, whereas I think Meowzz's approach can be done by anyone, including the holder of the coin of interest.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-11-17T13:27:25.447" LastActivityDate="2018-11-17T13:27:25.447" Title="Can quantum money be reliably &quot;burned?&quot;" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;cryptocurrency&gt;&lt;quantum-money&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2588" PostTypeId="1" AcceptedAnswerId="2608" CreationDate="2018-07-03T02:47:41.783" Score="2" ViewCount="224" Body="&lt;p&gt;Google returns &quot;About 1 results&quot; for &lt;a href=&quot;https://www.google.com/search?q=%22quantum%20computing%20with%20sound%22&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing with Sound&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sole result links to &lt;a href=&quot;https://www.nextbigfuture.com/2012/08/physicists-have-designed-building.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;an article&lt;/a&gt; entitled &quot;Physicists have designed the building blocks of quantum computer that works using sound&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the abstract:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Sound can be just as quantum as light. But our toolbox for single quanta of sound, i.e. phonons, is currently insufficient. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Has anyone seen something like this before? &lt;em&gt;Sounds&lt;/em&gt; interesting to me &amp;amp; am curious to find out more about &quot;phononic quantum computing&quot; &amp;amp; what advantages / disadvantages it has to offer.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-13T19:56:29.497" LastActivityDate="2018-12-13T19:56:29.497" Title="Phononic Quantum Computing" Tags="&lt;algorithm&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2589" PostTypeId="1" AcceptedAnswerId="2602" CreationDate="2018-07-03T06:35:11.707" Score="4" ViewCount="850" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Negative energies and probabilities should not be considered as nonsense. They are well-defined concepts mathematically, like a negative of money.&quot; -&lt;a href=&quot;https://en.wikipedia.org/wiki/Negative_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;Paul Dirac&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The abstract from &lt;a href=&quot;https://www.nature.com/articles/srep46764&quot; rel=&quot;nofollow noreferrer&quot;&gt;Photon-phonon-photon transfer in optomechanics&lt;/a&gt; states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the Wigner function of the recovered state can have negative values at the origin, which is a manifest of nonclassicality of the quantum state&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I recently learned about the Wigner function from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2479/2645&quot;&gt;this answer&lt;/a&gt; to a question I had asked about quantum shadowgraphy in which &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/2558/ernesto-galv%C3%A3o&quot;&gt;Ernesto&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;there are quantum states for which the Wigner function may be negative in some phase-space regions! This is an indication of non-classicality&#xA;  ... this negativity has been linked to contextuality&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1641/2645&quot;&gt;an answer&lt;/a&gt; by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/278/rob&quot;&gt;Rob&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;experimental schemes to reconstruct the generalized Wigner representation of a given density operator (representing mixed or pure quantum states)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The abstract from &lt;a href=&quot;https://arxiv.org/abs/0710.5549&quot; rel=&quot;nofollow noreferrer&quot;&gt;Negativity and contextuality are equivalent notions of nonclassicality&lt;/a&gt; states&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We also demonstrate the impossibility of noncontextuality or nonnegativity in quantum theory&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is negative probability?&lt;/strong&gt; Non-classicality? (Non)contextuality? Quasiprobability? &lt;strike&gt;Arbitrary multispin quantum states?&lt;/strike&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="55" LastEditDate="2020-07-16T09:22:30.873" LastActivityDate="2020-07-16T09:22:30.873" Title="What does negative probability represent?" Tags="&lt;quantum-state&gt;&lt;photonics&gt;&lt;contextuality&gt;&lt;wigner-function&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2590" PostTypeId="2" ParentId="2587" CreationDate="2018-07-03T06:48:17.227" Score="2" Body="&lt;p&gt;If each coin is entangled w/ the &lt;a href=&quot;https://en.wikipedia.org/wiki/Blockchain&quot; rel=&quot;nofollow noreferrer&quot;&gt;ledger&lt;/a&gt;, burning a coin via measuring it in the 'burn' (or 'wrong') basis would create an update in the ledger which could then be verified by anyone who had access to the ledger. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See this paper: &lt;a href=&quot;https://arxiv.org/abs/1804.05979&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Blockchain using entanglement in time&#xA;&lt;/a&gt; for more info on one approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also posted a question about &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2366/2645&quot;&gt;time entangled blockchains&lt;/a&gt; which includes a couple links:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1705.09258&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Secured Blockchain&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/publication/299749136_Quantum_Bitcoin_An_Anonymous_and_Distributed_Currency_Secured_by_the_No-Cloning_Theorem_of_Quantum_Mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Bitcoin&lt;/a&gt;: An Anonymous and Distributed Currency Secured by the No-Cloning Theorem of Quantum Mechanics&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-07-03T07:17:20.323" LastActivityDate="2018-07-03T07:17:20.323" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2591" PostTypeId="2" ParentId="2586" CreationDate="2018-07-03T13:07:15.840" Score="4" Body="&lt;p&gt;It seems that using more rounds &lt;strong&gt;will not be such helpful&lt;/strong&gt; for us to get something more powerful from complexity perspectives. There are a few comments about the number of rounds and the number of players for $\mathsf{MIP}^*$ in &lt;a href=&quot;http://users.cms.caltech.edu/~vidick/ucsd_mip.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Thomas Vidick's lecture note&lt;/a&gt; regarding quantum mutli-prover interactive proofs. Note that the non-local games are $\mathsf{MIP^*}$ protocols. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If we allow an extra prover and &lt;strong&gt;quantum messages&lt;/strong&gt; (i.e. a $\mathsf{QMIP^*}$ protocol), then non-local games with polynomially many rounds can be parallelized to one round, which it proved by &lt;a href=&quot;https://arxiv.org/pdf/0711.3715.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kempe-Kobayashi-Matsumoto-Vidick&lt;/a&gt;. But as @John Watrous mentioned, we don't know how to do that for non-local games with classical messages, i.e. $\mathsf{MIP^*}$ protocol. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;More details see section 6.3.2 in &lt;a href=&quot;https://arxiv.org/abs/1610.01664&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous-Vidick's survey&lt;/a&gt; about quantum proofs, or the KKMV paper mentioned above. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;But we did not know something similar for the number of provers, even the following could be true $\mathsf{MIP^*}(2,\mathrm{poly}) \subsetneq \mathsf{MIP^*}(3,\mathrm{poly}) \subsetneq \cdots$, where $\mathsf{MIP^*}(r,k)$ denote $r$-round $k$-prover non-local games. Namely, we may get something more powerful by adding new provers. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1777" LastEditorUserId="1777" LastEditDate="2018-07-03T19:42:14.950" LastActivityDate="2018-07-03T19:42:14.950" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2592" PostTypeId="5" CreationDate="2018-07-03T18:31:34.737" Score="0" Body="&lt;p&gt;More information can be found in the following links:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Wikipedia page &quot;Quantum phase estimation algorithm&quot;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9708016&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithms Revisited (Cleve, Ekert, Macchiavello &amp;amp; Mosca, 1997)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QPE&lt;/strong&gt; or &lt;strong&gt;QPEA&lt;/strong&gt; are commonly used as abbreviations of the &lt;strong&gt;Q&lt;/strong&gt;uantum &lt;strong&gt;P&lt;/strong&gt;hase &lt;strong&gt;E&lt;/strong&gt;stimation (&lt;strong&gt;A&lt;/strong&gt;lgorithm).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="1386" LastEditDate="2018-07-09T13:32:48.927" LastActivityDate="2018-07-09T13:32:48.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2593" PostTypeId="4" CreationDate="2018-07-03T18:31:34.737" Score="0" Body="Refers to the quantum algorithm used to estimate the eigenvalue corresponding to an eigenvector of a unitary operator. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:47:51.763" LastActivityDate="2019-01-01T09:47:51.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2594" PostTypeId="1" AcceptedAnswerId="2596" CreationDate="2018-07-03T21:50:54.957" Score="7" ViewCount="3309" Body="&lt;p&gt;Mostly I'm confused over whether the common convention is to use +&lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; or -&lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; along the anti-diagonal of the middle &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2018-12-23T13:29:21.590" LastActivityDate="2018-12-23T13:29:21.590" Title="What is the matrix of the iSwap gate?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2595" PostTypeId="1" CreationDate="2018-07-03T22:06:36.817" Score="26" ViewCount="1154" Body="&lt;p&gt;The intuition I have for why quantum computing can perform better than classical computing is that the wavelike nature of wavefunctions allow you to interfere multiple states of information with a single operation, which theoretically could allow for exponential speedup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if it really is just constructive interference of complicated states, why not just perform this interference with classical waves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And on that matter, if the figure-of-merit is simply how few steps something can be calculated in, why not start with a complicated dynamical system that has the desired computation embedded in it. (ie, why not just create &quot;analog simulators&quot; for specific problems?) &lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="26" LastEditDate="2018-12-13T19:56:47.683" LastActivityDate="2019-02-05T21:50:49.010" Title="If quantum speed-up is due to the wave-like nature of quantum mechanics, why not just use regular waves?" Tags="&lt;classical-computing&gt;" AnswerCount="6" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2596" PostTypeId="2" ParentId="2594" CreationDate="2018-07-03T22:09:00.307" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Mostly I'm confused over whether the common convention is to use +i or&#xA;  -i along the anti-diagonal of the middle 2x2 block.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The former. There are two $+i$'s along the anti-diagonal of the middle $2\times 2$ block of the iSWAP gate. See page 95 &lt;a href=&quot;https://link.springer.com/chapter/10.1007%2F978-1-84628-887-6_2&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;&lt;sup&gt;[$\dagger$]&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v2vAP.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v2vAP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[$\dagger$]: &lt;em&gt;Explorations in Computer Science (Quantum Gates)&lt;/em&gt; - Colin P. Williams&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-03T22:17:09.180" LastActivityDate="2018-07-03T22:17:09.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2597" PostTypeId="1" CreationDate="2018-07-04T01:31:20.010" Score="11" ViewCount="298" Body="&lt;p&gt;I’m trying to grok quantum walks, and would like to create an example that walks a perfect binary tree to find the one and only marked leaf node. Is this possible? If so, suppose the depth of the tree is five. Would that require a circuit with five wires? Would it best be realized with a Discrete Time Quantum Walk, flipping a Hadamard Coin five times? Regardless of whether these questions are on the right track, and although I’ve read a lot of papers on the subject, I’m currently at a loss for how to implement what I’ve described. Any concrete pointers?&lt;/p&gt;&#xA;" OwnerUserId="2421" LastEditorUserId="55" LastEditDate="2018-07-04T22:30:30.960" LastActivityDate="2019-12-07T10:43:05.280" Title="Quantum walk with binary tree" Tags="&lt;algorithm&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2598" PostTypeId="2" ParentId="2595" CreationDate="2018-07-04T01:37:49.293" Score="1" Body="&lt;p&gt;&quot;why not just perform this interference with classical waves?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes this is one way we can simulate quantum computers on regular digital computers. We simulate the &quot;waves&quot; using floating point arithmetic. The problem is that it does not scale. Every qubit &lt;em&gt;doubles&lt;/em&gt; the number of dimensions. For 30 qubits you already need about 8 gigabytes of ram just to store the &quot;wave&quot; aka state vector. At around 40 qubits we run out of computers big enough to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar question was asked here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2225/whats-the-difference-between-a-set-of-qubits-and-a-capacitor-with-a-subdivided&quot;&gt;What&amp;#39;s the difference between a set of qubits and a capacitor with a subdivided plate?&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="263" LastEditorUserId="26" LastEditDate="2018-07-13T15:09:51.297" LastActivityDate="2018-07-13T15:09:51.297" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2601" PostTypeId="2" ParentId="2595" CreationDate="2018-07-04T05:29:38.170" Score="1" Body="&lt;p&gt;Regular waves can interfere, but cannot be entangled. &lt;br&gt;&#xA;An example of an entangled pair of qubits, that cannot happen with classical waves, is given in the first sentence of my answer to this question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2225/whats-the-difference-between-a-set-of-qubits-and-a-capacitor-with-a-subdivided/2226#2226&quot;&gt;What&amp;#39;s the difference between a set of qubits and a capacitor with a subdivided plate?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement is considered to be the crucial thing that gives quantum computers advantage over classical ones, since superposition alone can be simulated by a probabilistic classical computer (i.e. a classical computer plus a coin flipper).  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-13T15:10:26.933" LastActivityDate="2018-07-13T15:10:26.933" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2602" PostTypeId="2" ParentId="2589" CreationDate="2018-07-04T07:00:01.027" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is non-classicality?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if there's a universally accepted definition, but the way that I'd define it is: if all possible outcomes of experiments on a particular quantum system can be described by a probability distribution, then the system is classical. Otherwise, it is non-classical. In alternative terminology, for a classical system, people say that there's a (local) hidden variable model that explains the experimental outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A trivial example is a diagonal density matrix when measured in the computational basis. The diagonal elements just give the probabilities of the different outcomes, so the state is classical.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is negative probability?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is rather loose terminology. For a true probability distribution (in the discrete setting, a set $\{p_i\}$ such that $p_i\geq 0$ and $\sum_ip_i=1$) never contains negative probabilities by definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You only get &quot;negative probability&quot; in some quasi-probability distributions, and so it should probably be called &quot;negative quasi-probability&quot; to avoid misunderstandings. As stated in the question, this is one way of detecting non-classicality. That leads us to...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is quasi-probability?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(which may be what you're meaning by pseudoprobability). These are distributions that behave a lot like probabilities in many ways, but relax at least one of the constraints in the definition, usually the non-negativity of the elements. According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quasiprobability_distribution&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, any density matrix can be written as a diagonal matrix using an over-complete basis. Those diagonal elements then form a quasi-probability distribution - some of the elements can be negative.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is (non)-contextuality?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Contextuality is another test that can be used to prove the non-classicality of a quantum system. This is a substantial topic that I'm not inclined to address in answer to small part of a question. You probably want to start finding out about the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kochen%E2%80%93Specker_theorem&quot; rel=&quot;noreferrer&quot;&gt;Kochen-Specker Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is worth noting that Bell tests, such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;noreferrer&quot;&gt;CHSH test&lt;/a&gt;, can be considered as contextuality tests, they're just made a little simpler because they're supplemented with some extra information about non-locality between certain measurement operators, ensuring their commutation. So, with CHSH, you evaluate some expectation value $S$. If $|S|\leq 2$, the state is classical, while if $|S|&amp;gt;2$, it cannot be explained by a local hidden variable model; the state is non-classical.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-04T07:00:01.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2603" PostTypeId="1" CreationDate="2018-07-04T07:08:15.630" Score="14" ViewCount="570" Body="&lt;p&gt;Most of us on this site believe that quantum computing will work. However, let's play devil's advocate. Imagine that we suddenly hit some fundamental stumbling block that prevented further development towards a universal quantum computer. Perhaps we're limited to a NISQ device (Noisy, Intermediate Scale Quantum) of 50-200 qubits, for the sake of argument. The study of (experimental) quantum computing suddenly stops and no further progress is made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What good has already come out of the study of quantum computers?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this, I mean realisable quantum technologies, the most obvious candidate being Quantum Key Distribution, but also technical results that feed into other fields. Rather than simply a list of items, a brief description of each would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2019-01-02T17:52:26.617" LastActivityDate="2019-10-19T12:50:26.193" Title="What use has quantum computing been?" Tags="&lt;technologies&gt;&lt;applications&gt;&lt;nisq&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2604" PostTypeId="1" AcceptedAnswerId="2605" CreationDate="2018-07-04T09:01:53.217" Score="13" ViewCount="1143" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;noreferrer&quot;&gt;quantum phase estimation algorithm&lt;/a&gt; (QPE) computes an approximation of the eigenvalue associated to a given eigenvector of a quantum gate $U$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formally, let $\left|\psi\right&amp;gt;$ be an eigenvector of $U$, QPE allows us to find $\vert\tilde\theta\rangle$, the best $m$ bit approximation of $\lfloor2^m\theta\rfloor$ such that $\theta \in [0,1)$ and &#xA;$$U\vert\psi\rangle = e^{2\pi i \theta} \vert\psi\rangle.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;original paper&lt;/a&gt;) takes as input a matrix $A$ that satisfy $$e^{iAt} \text{ is unitary } $$ and a quantum state $\vert b \rangle$ and computes $\vert x \rangle$ that encodes the solution of the linear system $Ax = b$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;: Every hermitian matrix statisfy the condition on $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so, HHL algorithm uses the QPE on the quantum gate represented by $U = e^{iAt}$. Thanks to linear algebra results, we know that if $\left\{\lambda_j\right\}_j$ are the eigenvalues of $A$ then $\left\{e^{i\lambda_j t}\right\}_j$ are the eigenvalues of $U$. This result is also stated in &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;noreferrer&quot;&gt;Quantum linear systems algorithms: a primer (Dervovic, Herbster, Mountney, Severini, Usher &amp;amp; Wossnig, 2018)&lt;/a&gt; (page 29, between equations 68 and 69).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the help of QPE, the first step of HLL algorithm will try to estimate $\theta \in [0,1)$ such that $e^{i2\pi \theta} = e^{i\lambda_j t}$. This lead us to the equation&#xA;$$2\pi \theta = \lambda_j t + 2k\pi, \qquad k\in \mathbb{Z}, \ \theta \in [0,1)$$&#xA;i.e.&#xA;$$\theta = \frac{\lambda_j t}{2\pi} + k, \qquad k\in \mathbb{Z}, \ \theta \in [0,1)$$&#xA;By analysing a little the implications of the conditions $k\in \mathbb{Z}$ and $\theta \in [0,1)$, I ended up with the conclusion that if $\frac{\lambda_j t}{2\pi} \notin [0,1)$ (i.e. $k \neq 0$), the phase estimation algorithm fails to predict the right eigenvalue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as $A$ can be any hermitian matrix, we can choose freely its eigenvalues and particularly we could choose arbitrarily large eigenvalues for $A$ such that the QPE will fail ($\frac{\lambda_j t}{2\pi} \notin [0,1)$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations (Cao, Daskin, Frankel &amp;amp; Kais, 2012)&lt;/a&gt; they solve this problem by simulating $e^{\frac{iAt}{16}}$, knowing that the eigenvalues of $A$ are $\left\{ 1, 2, 4, 8 \right\}$. They &lt;strong&gt;normalised&lt;/strong&gt; the matrix (and its eigenvalues) to avoid the case where $\frac{\lambda_j t}{2\pi} \notin [0,1)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other side, it seems like parameter $t$ could be used to do this normalisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Do we &lt;strong&gt;need&lt;/strong&gt; to know a upper-bound of the eigenvalues of $A$ to normalise the matrix and be sure that the QPE part of the HHL algorithm will succeed? If not, how can we ensure that the QPE will succeed (i.e. $\frac{\lambda_j t}{2\pi} \in [0,1)$)?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="26" LastEditDate="2018-08-24T18:22:02.337" LastActivityDate="2018-08-24T18:24:45.557" Title="Quantum phase estimation and HHL algorithm - knowledge of eigenvalues required?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2605" PostTypeId="2" ParentId="2604" CreationDate="2018-07-04T09:36:13.563" Score="9" Body="&lt;p&gt;You should know a bound on the eigenvalues (both upper and lower). As you say, you can then normalise $A$ by rescaling $t$. Indeed, you should do this to get the most accurate estimate possible, spreading the values $\lambda t$ over the full $2\pi$ range. Bounding the eigenvalues is not typically a problem. For example, you're probably requiring your matrix $A$ to be sparse, so that there aren't too many non-zero matrix elements on each row. Indeed, the problem specification probably gives you a bound on the number $N$ of non-zero entries per row, and the maximum value of any entry $Q$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you could apply something like Gershgorin's circle theorem. This states that the maximum eigenvalue is upper bounded by&#xA;$$&#xA;\max_i a_{ii}+\sum_{j\neq i}|a_{ij}|\leq NQ,&#xA;$$&#xA;and the minimum is lower bounded by&#xA;$$&#xA;\min_ia_{ii}-\sum_{j\neq i}|a_{ij}|\geq -NQ.&#xA;$$&#xA;The $a_{ij}$ are the matrix elements of $A$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within the values of $N$, $Q$, if you're worrying that for a large matrix (say $n$ qubits), while the row sum might be easy to calculate (because there's not many entries), the max over all rows might take a long time (because there's $2^n$ rows), there will be a variety of ways to get good approximations to it (e.g. sampling, or using knowledge of the problem structure). Worst case, you can probably use &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2004/1837&quot;&gt;Grover's search&lt;/a&gt; to speed it up a bit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-08-24T18:24:45.557" LastActivityDate="2018-08-24T18:24:45.557" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2606" PostTypeId="2" ParentId="2594" CreationDate="2018-07-04T10:45:08.777" Score="5" Body="&lt;p&gt;Whether you use $+i$ or $-i$ is entirely up to you.  After all, your definition of $\pm i$ is merely a convention.  On the other hand, I think I've only ever seen it with $+i$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a more general footing, you can consider that iSWAP is the gate obtained by time-evolving with an XX interaction ($H=-\sigma_x\otimes\sigma_x - \sigma_y\otimes\sigma_y$), in which case it depends on which sign of $i$ in the Schrödinger equation and for the Hamiltonian you prefer.  (You get $+i$ if you evolve with $\exp[-iHt]$, $t=\pi/4$, and chose the minus sign in the Hamiltonian as above, i.e. a ferromagnet).&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-07-04T10:45:08.777" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2607" PostTypeId="1" AcceptedAnswerId="2673" CreationDate="2018-07-04T14:02:39.323" Score="9" ViewCount="1584" Body="&lt;p&gt;As a non-mathematician/software programmer I'm trying to grasp how QFT (Quantum Fourier Transformation) works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following this YouTube video: &lt;a href=&quot;https://www.youtube.com/watch?v=wUwZZaI5u0c&quot; rel=&quot;noreferrer&quot;&gt;https://www.youtube.com/watch?v=wUwZZaI5u0c&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this blogpost: &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=208&quot; rel=&quot;noreferrer&quot;&gt;https://www.scottaaronson.com/blog/?p=208&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got a basic understanding on how you can calculate/construct the period using interference. But while trying to explain this to a colleague I ran into a problem. I used the following examples, N=15, a=7, so the period I'll need to find is r=4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pattern is:&#xA;&lt;code&gt;7, 4, 13, 1, 7, 4, 13, 1, 7, 4, 13, 1 (etc)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I imagine the wheel (like in the YouTube video) or a clock (like the blogpost) I can see that the circle with 4 dots/clock with 4 hours creates a constructive pattern and the others do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what happens with a circle with 2 dots, or a clock with 2 hours, those will have get the same magnitude/constructive pattern as 4? It loops twice as fast, but other than that, same result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does the QFT cope with this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Bonus: Can you explain in laymans terms without too much complicated math?)&lt;/p&gt;&#xA;" OwnerUserId="2972" LastActivityDate="2018-07-08T23:54:10.947" Title="Simplified explanation of Shor/QFT transformation as thumbtack" Tags="&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="2608" PostTypeId="2" ParentId="2588" CreationDate="2018-07-04T15:42:44.080" Score="1" Body="&lt;p&gt;Yes other papers have studied phononic qubits after that one. I could just list them here, but I think it would be better for you to learn how to find such papers yourself, so here is how I found the papers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Find the paper on Google, then click the link I have highlighted in yellow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6IwmB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6IwmB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Out of the 39 papers that cited this one, I have listed some (but not all) of the relevant ones below:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.4919584&quot; rel=&quot;nofollow noreferrer&quot;&gt;Splash, pop, sizzle: Information processing with phononic computing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/prb/abstract/10.1103/PhysRevB.88.134511&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toward engineered quantum many-body phonon systems&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.4972568&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phonon-based scalable platform for chip-scale quantum computing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As for advantages and disadvantages, perhaps the only advantage would be robustness to decoherence, which is claimed in the paper you mentioned, but not yet backed up very much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are lots of disadvantages though:&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Phonons are quasi-particles, not fundamental particles. This gives phonons a similar disadvantage as anyons. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2054/what-is-the-status-of-confirming-the-existence-of-anyons&quot;&gt;We all know how hard it is to build a quantum computer with anyons&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;You almost never find one isolated phonon, you get a huge spectrum of phonons at the same time.&lt;/li&gt;&#xA;&lt;li&gt;The technology required for phononic qubits seems to have had its beginnings in 2012, whereas for NMR qubits it goes back to at least the 1940s and for superconducting qubits it goes back to at least the 1960s. Phononic qubits are far behind any other candidate for quantum computers, so there is lot of catching up to do.   &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-04T15:42:44.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2609" PostTypeId="1" AcceptedAnswerId="2610" CreationDate="2018-07-04T17:35:08.130" Score="4" ViewCount="317" Body="&lt;p&gt;I want to express the square root of NOT as a time-dependent unitary matrix such that each $n$ units of time, the square root of NOT is produced.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, I want to find a $U(t_0,t_1)$ such that $U(t_0,t_1) = \sqrt{\text{NOT}}$, if $t_1-t_0=n$ for some $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible solution is to express $\sqrt{\text{NOT}}$ as a product of rotation matrices, and then, parametrize the angles in a clever way to depend on the time. But I do not know how to express $\sqrt{\text{NOT}}$ as a product of rotation matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help?&lt;/p&gt;&#xA;" OwnerUserId="2978" LastEditorUserId="26" LastEditDate="2018-12-23T13:28:56.700" LastActivityDate="2018-12-23T13:28:56.700" Title="Square root of NOT as a time-dependent unitary matrix" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2610" PostTypeId="2" ParentId="2609" CreationDate="2018-07-04T18:20:47.607" Score="4" Body="&lt;p&gt;$$&#xA;\sqrt{NOT} = e^{(\frac{i \pi}{4} I_2 - \frac{i \pi}{4} \sigma_x)}\\&#xA;U(t) = e^{\frac{t-t_0}{t_1 - t_0} (\frac{i \pi}{4} I_2 - \frac{i \pi}{4} \sigma_x)}&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-07-04T18:20:47.607" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2611" PostTypeId="5" CreationDate="2018-07-05T08:02:35.083" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:02:35.083" LastActivityDate="2018-07-05T08:02:35.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2612" PostTypeId="4" CreationDate="2018-07-05T08:02:35.083" Score="0" Body="For questions related to D-Wave's Pegasus architecture. It has been the first fundamental change in D-Wave's architecture since D-Wave One. In Pegasus, the actual structure of the unit cells has fundamentally changed for the first time. Instead of the Chimera graph where each qubit can have at most 6 qubits, the Pegasus graph allows each qubit to couple to 15 other qubits. (Source: https://quantumcomputing.stackexchange.com/a/2537/26)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:02:35.083" LastActivityDate="2018-07-05T08:02:35.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2613" PostTypeId="2" ParentId="2595" CreationDate="2018-07-05T08:31:36.503" Score="4" Body="&lt;p&gt;I don't claim to have a full answer (yet! I hope to update this, as it's an interesting issue to try and explain well). But let me start with a few clarifying comments...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But if it really is just constructive interference of complicated states, why not just perform this interference with classical waves?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The glib answer is that it's not &lt;em&gt;just&lt;/em&gt; interference. I think what it really comes down to is that quantum mechanics uses different axioms of probability (probability amplitudes) to classical physics, and these are not reproduced in the wave scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When someone writes about &quot;waves&quot;, I naturally think about water waves, but that may not be the most helpful picture to have. Let's think instead about an ideal guitar string. On a string of length $L$ (pinned at both ends), this has wavefunctions&#xA;$$&#xA;y_n(x,t)=A_n\sin\left(\omega_nt\right)\cos\left(\frac{n\pi x}{L}\right).&#xA;$$&#xA;Let's define the concept of a w-bit (&quot;wave bit&quot;). We can limit ourselves to, say, 4 modes, on the string, so you can associate&#xA;$$&#xA;|00\rangle\equiv y_1 \qquad |01\rangle\equiv y_2\qquad |10\rangle\equiv y_3 \qquad |11\rangle\equiv y_4&#xA;$$&#xA;Now since we can prepare the initial shape of the string to be anything we want (subject to the boundary conditions), we can create any arbitrary superposition of those 4 states. So, the theory certainly includes things that look like superposition and entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, they are not superposition and entanglement as we understand them in quantum theory. A key feature of quantum theory is that it contains &lt;em&gt;indeterminism&lt;/em&gt; - that the results of some outcomes are inherently unpredictable. We don't start or end our computation from these points, but we must go through them somewhere during the computation$^*$. For example, experimental tests of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell's Theorem&lt;/a&gt; have proven that the world is not deterministic (and, so far, conforms to what quantum theory predicts). The wave-bit theory is entirely deterministic: I can look at the string of my guitar, whatever weird shape it might be in, and my looking at it does not change its shape. Moreover, I can even determine the values of the $\{A_n\}$ in a single shot, and therefore know what shape it will be in at all later times. This is very different to quantum theory, where there are different bases that can give me different information, but I can never access all of it (indeterminism).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$^*$ I don't have a complete proof of this. We know that &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2674/is-entanglement-necessary-for-quantum-computation&quot;&gt;entanglement is necessary for quantum computation&lt;/a&gt;, and that entanglement can demonstrate indeterminism, but that's not quite enough for a precise statement. Contextuality is a similar measure of indeterminism but for single qubits, and results along those lines have started to become available recently, see &lt;a href=&quot;https://arxiv.org/abs/1610.08529&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, for broad classes of computations.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another way to think about this might be to ask what computational operations we can perform with these waves? Presumably, even if you allow some non-linear interactions, the operations can be simulated by a classical computer (after all, classical gates include non-linearity). I assume that the $\{A_n\}$ function like classical probabilities, not probability amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be one way of seeing the difference (or at least heading in the right direction). There's a way of performing quantum computation classed measurement-based quantum computation. You prepare your system in some particular state (which, we've already agreed, we could do with our w-bits), and then you measure the different qubits. Your choice of measurement basis determines the computation. But we can't do that here because we don't have that choice of basis.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And on that matter, if the figure-of-merit is simply how few steps something can be calculated in, why not start with a complicated dynamical system that has the desired computation embedded in it. (ie, why not just create &quot;analog simulators&quot; for specific problems?) &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not the figure of merit. The figure of merit is really &quot;How long does it take to perform the computation&quot; and &quot;how does that time scale as the problem size changes?&quot;. If we choose to break everything down in terms of elementary gates, then the first question is essentially how many gates are there, and the second is how does the number of gates scale. But we don't have to break it down like that. There are plenty of &quot;analog quantum simulators&quot;. Feynman's original specification of a quantum computer was one such analogue simulator. It's just that the time feature manifests in a different way. There, you're talking about implementing a Hamiltonian evolution $H$ for a particular time $t_0$, $e^{iHt_0}$. Now, sure, you could implement $2H$, and replace $t_0$ with $t_0/2$, but practically, the coupling strengths in $H$ are limited, so there's a finite time that things take, and we can still demand how that scales with the problem size. Similarly, there's adiabatic quantum computation. There, the time required is determined by the energy gap between the ground and the first excited state. The smaller the gap, the longer your computation takes. We know that all 3 models are equivalent in the time they take (up to polynomial conversion factors, which are essentially irrelevant if you're talking about an exponential speed-up).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, analog quantum simulators are certainly a thing, and there are those of us who think they're a very sensible thing at least in the short-term. My research, for example, is very much about &quot;how do we design Hamiltonians $H$ so that their time evolution $e^{-iHt_0}$ creates the operations that we want?&quot;, aiming to do everything we can in a language that is &quot;natural&quot; for a given quantum system, rather than having to coerce it into performing a whole weird sequence of quantum gates.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-09T07:02:50.773" LastActivityDate="2018-07-09T07:02:50.773" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="2614" PostTypeId="5" CreationDate="2018-07-05T08:32:05.767" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:32:05.767" LastActivityDate="2018-07-05T08:32:05.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2615" PostTypeId="4" CreationDate="2018-07-05T08:32:05.767" Score="0" Body="For questions about the D-Wave Chimera architecture. The increase in qubit count for the D-Wave Two was accomplished by tiling qubit pattern of the D-Wave One. This pattern, named Chimera by D-Wave Systems, has limited connectivity such that a given qubit can only interact with at most six other qubits. (Wikipedia) Consider using the [dwave] tag with this." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-07T14:58:46.617" LastActivityDate="2019-01-07T14:58:46.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2616" PostTypeId="5" CreationDate="2018-07-05T08:33:27.080" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:33:27.080" LastActivityDate="2018-07-05T08:33:27.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2617" PostTypeId="4" CreationDate="2018-07-05T08:33:27.080" Score="0" Body="For questions related to the Bloch sphere. In quantum mechanics, the Bloch sphere is a geometrical representation of the pure state space of a two-level quantum mechanical system (qubit), named after the physicist Felix Bloch. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:38:28.063" LastActivityDate="2019-01-01T09:38:28.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2618" PostTypeId="5" CreationDate="2018-07-05T08:55:00.323" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:55:00.323" LastActivityDate="2018-07-05T08:55:00.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2619" PostTypeId="4" CreationDate="2018-07-05T08:55:00.323" Score="0" Body="For questions related to quantum multiplexer/demultiplexer circuits. In quantum communication, all of the system channels can be accommodated into a single channel in a larger Hilbert space. In the scheme, a single line combines the information of all the users, and, at the receiver, the original quantum channels are recovered. A multiplexer/demultiplexer circuit can perform this n qubits to qudit transformation. (arXiv:quant-ph/0701145)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:35:26.473" LastActivityDate="2019-01-01T10:35:26.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2620" PostTypeId="5" CreationDate="2018-07-05T08:56:36.803" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:56:36.803" LastActivityDate="2018-07-05T08:56:36.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2621" PostTypeId="4" CreationDate="2018-07-05T08:56:36.803" Score="0" Body="For questions related to Controlled quantum gates. Controlled gates act on 2 or more qubits, where one or more qubits act as a control for some operation. (from Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-05T08:56:36.803" LastActivityDate="2018-07-05T08:56:36.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2622" PostTypeId="1" AcceptedAnswerId="4551" CreationDate="2018-07-05T09:26:05.297" Score="9" ViewCount="692" Body="&lt;p&gt;&lt;sup&gt; This question is a continuation of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2604/quantum-phase-estimation-and-hhl-algorithm-knowledge-on-eigenvalues-required&quot;&gt;Quantum phase estimation and HHL algorithm - knowledge on eigenvalues required?&lt;/a&gt;. &lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the question linked above, I asked about the necessity for HHL to have information on the eigenspectrum of the matrix $A$ considered.&#xA;It came out that the HHL algorithm &lt;strong&gt;needs&lt;/strong&gt; a matrix with eigenvalues $\lambda_j \in [0,1)$ to work correctly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following this condition, given a matrix $A$, in order to apply the HHL algorithm we need to check one of the condition below:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The eigenvalues of the matrix are all within $[0,1)$.&lt;/li&gt;&#xA;&lt;li&gt;A pair $(L,M) \in \mathbb{R}^2$ that bound (from below for $L$ and from above for $M$) the eigenvalues $\lambda_j$ of the matrix $A$. These bounds can be then used to rescale the matrix $A$ such that condition 1. is validated.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First group of questions:&lt;/strong&gt; I read plenty of papers on HHL and none of them even mentioned this restriction. Why? Is this restriction known but considered weak (i.e. it's easy to have this kind of information)? Or the restriction was not known? Is there any research paper that mention this restriction?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's talk now about the complexity analysis of HHL. From &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;noreferrer&quot;&gt;Quantum linear systems algorithms: a primer (Dervovic, Herbster, Mountney, Severini, Usher &amp;amp; Wossnig, 2018)&lt;/a&gt;, the complexity of HHL (and several improvements) is written in the image below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QhuVC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhuVC.png&quot; alt=&quot;complexity of HHL&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complexity analysis does not take into account (at least I did not find it) the necessary knowledge on the eigenspectrum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case where the considered matrix has sufficiently good properties to estimate its eigenvalues analytically is uncommon (at least for real-world matrices) and is ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2605/1386&quot;&gt;this answer&lt;/a&gt;, @DaftWullie uses the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gershgorin_circle_theorem&quot; rel=&quot;noreferrer&quot;&gt;Gershgorin's circle theorem&lt;/a&gt; to estimate the upper and lower bounds of the eigenspectrum. The problem with this approach is that it takes $\mathcal{O}(N)$ operations ($\mathcal{O}(\sqrt{N})$ if amplitude amplification is applicable). This number of operation destroys the logarithmic complexity of HHL (and it's only advantage over classical algorithms in the same time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second group of questions:&lt;/strong&gt; Is there a better algorithm in term of complexity? If not, then why is the HHL algorithm still presented as an exponential improvement over classical algorithms?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-07-05T09:46:49.727" LastActivityDate="2018-10-27T06:04:49.787" Title="HHL algorithm -- why isn't the required knowledge on eigenspectrum a major drawback?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2623" PostTypeId="2" ParentId="1500" CreationDate="2018-07-05T09:33:21.663" Score="5" Body="&lt;p&gt;The device works at cryogenic temperatures, which is so cold that all the gasses would freeze on the experiment device. Moreover, before they do so, they would conduct heat from the walls of the chamber to the experiment device and make it hard to cool the device down. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, you need vacuum for being able to cool things down to a very low temperature, and once the device is cold, the presence of the cold elements even improves the vacuum, as the little rest gas you were unable to pump out before will freeze - effect known as cryopumping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/105/1989&quot;&gt;Why must quantum computers be kept near absolute zero?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1989" LastEditorUserId="1989" LastEditDate="2018-11-19T13:03:57.387" LastActivityDate="2018-11-19T13:03:57.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2624" PostTypeId="2" ParentId="117" CreationDate="2018-07-05T09:39:41.033" Score="2" Body="&lt;p&gt;DanielSank is correct, but I think the answer is actually even more subtle. If there was no loss there would also be no way the background radiation leaking into your quantum device. Even if it was initially thermally excited, one could actively reset the state of the qubits. Thus, in addition to thermal excitations of microwave qubits, the fundamental reason for them being cooled down to so low temperature is really the dielectric loss of the materials the quantum state lives in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Air imposes almost no loss to optical photons, but the electric circuits do attenuate the microwave frequency plasmons carrying the quantum information. So far the only way to get rid of these losses is to use superconductors, and, in addition, to go to cryogenic temperatuers much lower than the critical temperature of the superconductors, but &lt;strong&gt;there is no fundamental reasons for not being able to use higher temperatures in future, once materials with a lower loss become available&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1989" LastEditorUserId="1989" LastEditDate="2018-11-19T13:08:44.780" LastActivityDate="2018-11-19T13:08:44.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2625" PostTypeId="1" AcceptedAnswerId="2626" CreationDate="2018-07-05T10:27:56.043" Score="9" ViewCount="360" Body="&lt;p&gt;I read the Solovay-Kitaev algorithm for approximation of arbitrary single-qubit unitaries.  However, while implementing the algorithm, I got stuck with the basic approximation of depth 0 of the recursion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me on how to implement the basic approximation such that, given any $2 {\times} 2$ matrix in $\operatorname{SU}\left(2\right)$, it will return the sequence of gates from the set $\left\{H,T,S\right\}$ which approximate to about 0.00001 trace-norm distance of the arbitrary matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if I am using brute-force or kd trees, up to what gate length $l_0$ should I consider to obtain initial approximation of $0.00001$ for any arbitrary matrix in $\operatorname{SU}\left(2\right)$?&lt;/p&gt;&#xA;" OwnerUserId="2771" LastEditorUserId="26" LastEditDate="2018-07-07T16:38:48.530" LastActivityDate="2018-07-09T09:19:45.597" Title="Basic approximation in Solovay-Kitaev algorithm" Tags="&lt;algorithm&gt;&lt;gate-synthesis&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2626" PostTypeId="2" ParentId="2625" CreationDate="2018-07-05T11:32:16.923" Score="5" Body="&lt;p&gt;I don't pretend that this is optimal in the sense of minimal number of applications, but here's one method that comes from the universality proof...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The unitary that you want to implement can be parametrised by $U=\cos\gamma\mathbb{I}-i\sin\gamma\ \underline{m}\cdot\underline{\sigma}$ where $\underline\sigma$ is the vector of Pauli matrices $X$, $Y$, $Z$. If you don't know the values you can get them from e.g. $\cos\gamma=\text{Tr}(U)/2$, $\sin\gamma\ m_X=\text{Tr}(XU)/2$ and so on.&lt;/li&gt;&#xA;&lt;li&gt;You can implement two unitaries $HTHT=\cos\theta\mathbb{I}-i\sin\theta \underline{n}_1\cdot\underline{\sigma}=R_1(\theta)$ and $THTH=\cos\theta\mathbb{I}-i\sin\theta \underline{n}_2\cdot\underline{\sigma}=R_2(\theta)$. Make sure you know what $\theta$, $\underline{n}_1$ and $\underline{n}_2$ are.&lt;/li&gt;&#xA;&lt;li&gt;Your first goal is to work out how to express $U$, your target unitary, in the form $e^{i\alpha}R_1(\phi_1)R_2(\phi_2)R_1(\phi_3)$. Again, evaluate things like $\text{Tr}(U),\ \text{Tr}(\underline{n_1}\cdot\underline{\sigma} U)$, but using the new decomposition, and you'll have a set of 3 simultaneous equations to solve for 3 parameters. For example (you'll need to check these!),&#xA;$$&#xA;e^{i\alpha}\cos\gamma=\cos\phi_2\cos(\phi_1+\phi_3)-\sin\phi_2\sin(\phi_1+\phi_3)\underline{n}_1\cdot\underline{n}_2\\&#xA;e^{i\alpha}\sin\gamma \underline{m}\cdot\underline{n}_1=\cos\phi_2\sin(\phi_1+\phi_3)-\sin\phi_2\cos(\phi_1+\phi_3)\underline{n}_1\cdot\underline{n}_2&#xA;$$&lt;/li&gt;&#xA;&lt;li&gt;Now, you want to create a good approximation to the angle $\phi_i$, but you can only repeat sequences such as $HTHT$ an integer number of times, $q_i$. Thus we can create angles $q_i\theta$, but angles are only important modulo $2\pi$. Thus, for each $\phi_i$, find the smallest positive integer $q_i$ such that $|q_i\theta \text{ mod }2\pi-\phi_i|&amp;lt;\epsilon$ for some small parameter $\epsilon$. This means that by repeating $HTHT$ $q_3$ times, then $THTH$ $q_2$ times, then $HTHT$ $q_1$ times, you create each of the 3 rotations about the correct axis, to an angle that is within $\epsilon$ accuracy for each.&lt;/li&gt;&#xA;&lt;li&gt;You final task is to work out how the accuracy $\epsilon$ on each angle corresponds to an overall accuracy on the unitary If you think about a perturbative expansion of each term, the error is probably about $3\epsilon$. So, now you can work backwards to find $\epsilon$ and know what you need.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-09T09:19:45.597" LastActivityDate="2018-07-09T09:19:45.597" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2627" PostTypeId="1" CreationDate="2018-07-05T15:35:14.193" Score="4" ViewCount="697" Body="&lt;p&gt;I want to run a experiment like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Generate a bunch of random  12-character passwords like $``\texttt{&amp;lt;Bb\{Q,r2Qp8`}&quot;.$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Write an algorithm to randomly generate &amp;amp; compare value on quantum computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the value was found, return number of time it take to generate, let's say $6102111820800.$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The only available quantum computer I know of is IBM's quantum computing cloud service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to run this program on existing quantum computers?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If so, how fast would it be?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2994" LastEditorUserId="15" LastEditDate="2018-07-05T17:05:07.297" LastActivityDate="2018-07-08T03:23:36.117" Title="Is running a large random brute force on quantum computer possible at the moment?" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;&lt;speedup&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2628" PostTypeId="5" CreationDate="2018-07-05T15:58:58.620" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-05T15:58:58.620" LastActivityDate="2018-07-05T15:58:58.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2629" PostTypeId="4" CreationDate="2018-07-05T15:58:58.620" Score="0" Body="Quantum walks are the quantum mechanical counterpart of classical random walks. This tag should be used for any question related to quantum walk models." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-06T01:08:08.747" LastActivityDate="2018-07-06T01:08:08.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2630" PostTypeId="5" CreationDate="2018-07-05T16:00:50.893" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-05T16:00:50.893" LastActivityDate="2018-07-05T16:00:50.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2631" PostTypeId="4" CreationDate="2018-07-05T16:00:50.893" Score="0" Body="For questions related to the quantum algorithm for inverting linear systems of equations, developed by Harrow, Hassidim and Lloyd in 2009." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-05T23:21:55.347" LastActivityDate="2018-07-05T23:21:55.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2632" PostTypeId="2" ParentId="2607" CreationDate="2018-07-05T20:51:18.300" Score="2" Body="&lt;p&gt;In your example the pattern is made by a modular multiplication function or circuit f(x) = ax (mod N) This quantum circuit and pattern is also given in the IBM Q manual of the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=004-Quantum_Algorithms~2F110-Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GCB9l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GCB9l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in a loop with start input x = 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x=1 f(x) = 7 * 1 (mod 15)  = 7&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x=7  f(x) = 7 * 7 (mod 15) = 4 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;x=4                        =&gt; 13&lt;/p&gt;&#xA;&#xA;&lt;p&gt;x=13                       =&gt;1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pattern 1 7 4 13 1 is repeated every 4th time. &#xA;So the circuit is fixed for a given a and mod 15 and always returns r = 4. If you want r = 2, you need another multiplier function &lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1773" LastEditDate="2018-07-05T20:57:45.180" LastActivityDate="2018-07-05T20:57:45.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2633" PostTypeId="5" CreationDate="2018-07-05T23:18:41.417" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-05T23:18:41.417" LastActivityDate="2018-07-05T23:18:41.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2634" PostTypeId="4" CreationDate="2018-07-05T23:18:41.417" Score="0" Body="It is the branch of physics and engineering concerned with the properties and transmission of photons. Use this tag for those questions about photonics which are relevant to quantum computing." OwnerUserId="-1" LastEditorUserId="26" LastEditDate="2018-07-06T08:32:52.987" LastActivityDate="2018-07-06T08:32:52.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2635" PostTypeId="2" ParentId="2603" CreationDate="2018-07-06T04:57:26.777" Score="6" Body="&lt;p&gt;There are a lot of interesting applications that use similar technology. A lot of labs that work towards quantum computing also publish papers with these applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All-optical computation. Personally, I think this has more potential than quantum computing, as it has already been shown to be useful for quickly &lt;a href=&quot;https://www.nature.com/articles/nphoton.2017.93&quot; rel=&quot;nofollow noreferrer&quot;&gt;processing neural networks&lt;/a&gt; (and other algorithms involving matrix multiplication and nonlinear functions). These on-chip systems are made in the same labs (and same people) as &lt;a href=&quot;https://arxiv.org/pdf/1507.03406.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurement-based linear quantum computing&lt;/a&gt;. Designing systems capable of operating faster than semi-conductor clock speeds, lowering the minimum power-per operation using light, and increasing parallelization will probably get us very far without needing to change algorithmic architectures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1308.6253.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum simulation&lt;/a&gt;. Richard Feynman's original dream of &quot;quantum computers&quot; are now what are referred to as &quot;quantum analog simulators.&quot; Nature acts like nature. It can be hard to compute analytically or digitally how a Hydrogen atom behaves, but using a system with a similar Hamiltonian can &quot;do the math for you.&quot; Optical lattices (which are &lt;a href=&quot;https://www.nature.com/articles/nature24654&quot; rel=&quot;nofollow noreferrer&quot;&gt;sometimes&lt;/a&gt; used for &lt;a href=&quot;http://iontrap.umd.edu/wp-content/uploads/2012/12/s41467-017-01904-7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum computing of ions&lt;/a&gt;) can be used for these quantum simulators. It is very difficult to do calculations of molecules using fundamental physics and chemistry is full of heuristics to deal with these difficulties.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://research.physics.illinois.edu/QI/Photonics/tomography-files/tomo_chapter_2004.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum state reconstruction&lt;/a&gt;. A usually unmentioned open problem in quantum information and computing is how to reconstruct high qbit entangled states. Even if quantum computing doesn't work out, advances made in these open questions might be helpful in the future (for, for instance, key distribution protocols and information theory). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum Communication. &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Key distribution&lt;/a&gt; is probably the only working practical application created so far from quantum information. It allows information to be transferred safely without the possibility of eavesdroppers. High-fidelity photon gate operations (created for quantum computers) could allow for &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.81.052329&quot; rel=&quot;nofollow noreferrer&quot;&gt;efficient quantum repeaters&lt;/a&gt;, which could extend the maximum distance that can be traveled.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extra Fun Things. Personally, I think the most interesting thing is answering if the brain is a quantum computer. The possiblity of the brain being a quantum computer has been eye-rolled by many physicists for the last decade, dismissing the high temperatures the brain to destroy coherence, but highly reputable (and commendable) physicists have recently challenged this notion. One discussing how &lt;a href=&quot;https://arxiv.org/abs/1508.05929&quot; rel=&quot;nofollow noreferrer&quot;&gt;nuclear spins&lt;/a&gt; could be the mediator of quantum information, &lt;a href=&quot;https://arxiv.org/abs/1607.02969&quot; rel=&quot;nofollow noreferrer&quot;&gt;another&lt;/a&gt; discussing how experiments could be carried to investigate if axons are operating as waveguides.    &lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="55" LastEditDate="2018-07-15T16:26:38.963" LastActivityDate="2018-07-15T16:26:38.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2636" PostTypeId="2" ParentId="2627" CreationDate="2018-07-06T07:52:16.853" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I want to run a experiment like this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Generate a bunch of random 12-character passwords like &amp;quot;;Bb{Q,r2Qp8`&amp;quot; (&lt;em&gt;changed the first character because it interefed with the citation style&lt;/em&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Let's say your characters are encoded in &lt;a href=&quot;https://en.wikipedia.org/wiki/Extended_ASCII&quot; rel=&quot;nofollow noreferrer&quot;&gt;extended ASCII&lt;/a&gt;, i.e. they have a value between 0 and 255. You need 8 classical bits to represent one character. One could expect that you could encode this value on 3 qubits (&lt;span class=&quot;math-container&quot;&gt;$2^3$&lt;/span&gt;), but you need to do a compromise here:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have access to an external source of randomness, then you can use it to generate a random quantum state (by applying random gates to the initial quantum state for example). In this case, the amplitudes of the obtained quantum state &lt;em&gt;may&lt;/em&gt; represent your character (you still need to find how to represent a random character from complex non-integer numbers) and depending on the encoding you use you may need less than 8 qubits.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you don't have access to an external source of randomness or if you want your random numbers to be &amp;quot;perfect&amp;quot;, you can use quantum superposition and measurement to generate perfect random integers. This can be done by taking 8 qubits, applying the &lt;code&gt;H&lt;/code&gt; gate to the 8 qubits and measuring them in the computational basis. With this algorithm, you will have 8 qubits in the state &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle$&lt;/span&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\vert1\rangle$&lt;/span&gt; (i.e. a random number on 8 qubits). With this method, 1 character = 8 qubits.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Write an algorithm to randomly generate &amp;amp; compare value on quantum computer.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The generation can be done in the same way as above. For the comparison, it depends on the method you used for the generation and how you represent your characters:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As the characters are encoded in the amplitudes, you can use the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2561/checking-value-of-variable-using-quantum-approach/2583#2583&quot;&gt;SWAP test&lt;/a&gt; to check for closeness.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Here, the qubits are just classical bits so you could just measure them and check classically for equality.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;If the value was found, return number of time it take to generate, let's say 6102111820800.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Again, depending on what you want (but the bullet points here are not related to the methods above):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You could count the try-fails in a classical register, just by incrementing a classical counter at each fail. If you used the SWAP test, you can measure the ancillary qubits and update the counter.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you want to encode your counter in a quantum state, you need a circuit that will increment the value of a register. You can find a way to construct such a circuit &lt;a href=&quot;http://algassert.com/circuits/2015/06/12/Constructing-Large-Increment-Gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for example. Then, if you used the SWAP test you can either read the qubit and apply the increment operation or directly apply the increment operation controlled by the state of the ancillary qubit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The only available quantum computer I know of is IBM's quantum computing cloud service.&lt;/p&gt;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to run this program on existing quantum computers?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It depends on the method you take: the first method &lt;em&gt;may&lt;/em&gt; be able to run on an existing chips, but the second one would need at least &lt;span class=&quot;math-container&quot;&gt;$96 = 12*8$&lt;/span&gt; qubits to store the 12 characters, which is above the maximum number of qubits currently available.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;If so, how fast would it be?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It will be sloooooooooooow. The first method &lt;em&gt;may&lt;/em&gt; be able to use quantum superposition to speed-up the computations, but the second method uses quantum superposition only to generate random numbers, and then treat them classically.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-07-06T07:52:16.853" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2637" PostTypeId="5" CreationDate="2018-07-06T08:50:09.920" Score="0" Body="&lt;h2&gt;&lt;strong&gt;Quantum Parallelism&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Given that our quantum memory register differs from a classical one in that it can store a superposition of the base states of the register, one might wonder what this implies as to the efficiency of quantum computing. The study of quantum computing is relatively new, most give credit to Richard Feynman for being the first to suggest that there were tasks that a quantum computer could perform exponentially better than a classical computer. Feynman observed that a classical computer could not simulate a quantum mechanical system without suffering from exponential slowdown. At the same time, he hinted that perhaps by using a device whose behavior was inherently quantum in nature one could simulate such a system without this exponential slowdown. (Feynman)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Several quantum algorithms rely on something called quantum parallelism. Quantum parallelism arises from the ability of a quantum memory register to exist in a superposition of base states. A quantum memory register can exist in a superposition of states, each component of this superposition may be thought of as a single argument to a function. A function performed on the register in a superposition of states is thus performed on each of the components of the superposition, but this function is only applied one time. Since the number of possible states is $2^n$ where $n$ is the number of qubits in the quantum register, you can perform in one operation on a quantum computer what would take an exponential number of operations on a classical computer. This is fantastic, but the more superposed states that exist in your register, the smaller the probability that you will measure any particular one will become. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example suppose that you are using a quantum computer to calculate the function $\mathcal {F}(x) = 2x \pmod 7$, for $x$ integers between $0$ and $7$ inclusive. You could prepare a quantum register that was in an equally weighted superposition of the states $0 - 7$. Then you could perform the $2x \pmod 7$ operation once, and the register would contain the equally weighted superposition of $0,2,4,6,1,3,5,0$ states, these being the outputs of the function $2x \pmod 7$ for inputs $0 - 7$. When measuring the quantum register you would have a $2/8$ chance of measuring $0$, and a $1/8$ chance of measuring any of the other outputs. It would seem that this sort of parallelism is not useful, as the more we benefit from parallelism the less likely we are to measure a value of a function for a particular input. Some clever algorithms have been devised, most notably by Peter Shor and L. K. Grover which succeed in using quantum parallelism on a function where they are interested in some property of all the inputs, not just a particular one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href=&quot;https://quantum-algorithms.herokuapp.com/299/paper/node16.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-algorithms.herokuapp.com/299/paper/node16.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-06T08:50:09.920" LastActivityDate="2018-07-06T08:50:09.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2638" PostTypeId="4" CreationDate="2018-07-06T08:50:09.920" Score="0" Body="The idea that a quantum computer can simultaneously explore many possible solutions to a problem since quantum memory register can exist in a superposition of states, each component of this superposition may be thought of as a single argument to a function. A function performed on the register in a superposition of states is thus performed on each of the components of the superposition, but this function is only applied one time.  " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-06T08:50:09.920" LastActivityDate="2018-07-06T08:50:09.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2639" PostTypeId="5" CreationDate="2018-07-06T08:53:44.067" Score="0" Body="&lt;h2&gt;Boson Sampling&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Boson sampling constitutes a restricted model of non-universal quantum computation introduced by S. Aaronson and A. Arkhipov. It consists of sampling from the probability distribution of identical bosons scattered by a linear interferometer. Although the problem is well defined for any bosonic particles, its photonic version is currently considered as the most promising platform for a scalable implementation of a boson sampling device, which makes it a non-universal approach to linear optical quantum computing. Moreover, while not universal, the boson sampling scheme is strongly believed to implement a classically hard task using far fewer physical resources than a full linear-optical quantum computing setup. This makes it an outstanding candidate for demonstrating the power of quantum computation in the near term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read more on Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Boson_sampling&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-06T08:53:44.067" LastActivityDate="2018-07-06T08:53:44.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2640" PostTypeId="4" CreationDate="2018-07-06T08:53:44.067" Score="0" Body="Boson sampling constitutes a restricted model of non-universal quantum computation introduced by S. Aaronson and A. Arkhipov. It consists of sampling from the probability distribution of identical bosons scattered by a linear interferometer. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:29:44.603" LastActivityDate="2019-01-01T10:29:44.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2641" PostTypeId="5" CreationDate="2018-07-06T08:56:21.837" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-06T08:56:21.837" LastActivityDate="2018-07-06T08:56:21.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2642" PostTypeId="4" CreationDate="2018-07-06T08:56:21.837" Score="0" Body="The toric code is a topological quantum error correcting code, and an example of a stabilizer code defined on a two-dimensional spin-lattice. It is the simplest and most well studied of the quantum double models (first studied in the context of Z2 spin liquid in 1991). It is also the simplest example of topological order—Z2 topological order. The toric code can also be considered to be a Z2 lattice gauge theory in a particular limit. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:36:16.440" LastActivityDate="2019-01-01T10:36:16.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2643" PostTypeId="2" ParentId="2439" CreationDate="2018-07-06T09:30:16.743" Score="0" Body="&lt;p&gt;HHL algorithm with a 4 x 4 matrix A might be to large for the IBM computer. I tried a smaller toy version of the algorithm according with arXiv 1302.1210 link &lt;a href=&quot;https://arxiv.org/abs/1302.1210&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solving systems of linear equations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I explained a little bit about this circuit here at stackexchange:&#xA;&lt;a href=&quot;https://cs.stackexchange.com/questions/76525/could-a-quantum-computer-perform-linear-algebra-faster-than-a-classical-computer/77036#77036&quot;&gt;https://cs.stackexchange.com/questions/76525/could-a-quantum-computer-perform-linear-algebra-faster-than-a-classical-computer/77036#77036&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately it is only a 1 qubit input with A = 2 x 2 matrix, in the answer a link to the IBM circuit is given.&lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2018-07-06T09:30:16.743" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2644" PostTypeId="5" CreationDate="2018-07-06T11:21:51.703" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-06T11:21:51.703" LastActivityDate="2018-07-06T11:21:51.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2645" PostTypeId="4" CreationDate="2018-07-06T11:21:51.703" Score="0" Body="For questions related to the quantum phase estimation algorithm, which approximates the eigenvalue associated with a given eigenvector&#xD;&#xA;" OwnerUserId="1386" LastEditorUserId="23" LastEditDate="2018-07-06T12:04:00.387" LastActivityDate="2018-07-06T12:04:00.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2646" PostTypeId="5" CreationDate="2018-07-06T11:27:18.833" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-06T11:27:18.833" LastActivityDate="2018-07-06T11:27:18.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2647" PostTypeId="4" CreationDate="2018-07-06T11:27:18.833" Score="0" Body="Hamiltonian simulation is a class of algorithms that, given a Hermitian matrix A, output a quantum circuit implementing an approximation to the unitary exp[iAt]. " OwnerUserId="1386" LastEditorUserId="26" LastEditDate="2018-08-02T15:42:26.913" LastActivityDate="2018-08-02T15:42:26.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2648" PostTypeId="5" CreationDate="2018-07-06T11:38:24.577" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-06T11:38:24.577" LastActivityDate="2018-07-06T11:38:24.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2649" PostTypeId="4" CreationDate="2018-07-06T11:38:24.577" Score="0" Body="Ancillas or &quot;ancilla qubits&quot; are qubits used internally in a quantum circuit. They are only used during the computations and their input and output states should be fixed (the convention in the quantum circuit model is |0&gt;)" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-07-06T12:01:11.880" LastActivityDate="2018-07-06T12:01:11.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2650" PostTypeId="2" ParentId="2603" CreationDate="2018-07-06T11:54:29.567" Score="4" Body="&lt;p&gt;&lt;strong&gt;Perform and checking basic quantum-mechanic experiments&lt;/strong&gt;&#xA;Before the IBM and alibaba quantum cloud computers, you would need an expensive lab to do simple CHSH or GHZ experiments. Of course the qubits in the IBM computer are not loophole free but many institutes and also collegeschools could not have better experiment facilities purchased within their physics budget. So basic quantum mechanic experiments can be done very easily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum programming tools and experiments&lt;/strong&gt;&#xA;Furthermore basic research in programming quantum computer tools like compilers and mapping algorithms can now be tested on real machines &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has lead to 113 papers with real and tested quantum algorithms for the ibm computer alone and many more in general.&#xA;&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/community?channel=papers&quot; rel=&quot;nofollow noreferrer&quot;&gt;qc papers&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2018-07-06T11:54:29.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2651" PostTypeId="1" CreationDate="2018-07-06T14:31:41.693" Score="10" ViewCount="555" Body="&lt;p&gt;What are the prominent visualisations used to depict large, entangled states and in what context are they most commonly applied?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are their advantages and disadvantages?&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-06T14:44:12.950" LastActivityDate="2019-09-12T13:55:53.000" Title="What are the possible ways to visualise large, entangled states?" Tags="&lt;entanglement&gt;&lt;quantum-state&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2652" PostTypeId="2" ParentId="2458" CreationDate="2018-07-06T15:20:03.390" Score="5" Body="&lt;p&gt;The numbers you are describing are &lt;em&gt;very very large&lt;/em&gt;. To the point, it appears that they are numbers whose representation in decimal (or binary) are large enough that it there is little to no prospect of there being enough matter in the entire universe to store those numbers, in a place-value representation such as those. This being the case, no technology &amp;mdash; quantum or otherwise &amp;mdash; will be able to produce a representation (or anything which can be described as a conventional 'estimate') of those numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, it appears that these functions are faster growing than any provably total function (&lt;em&gt;e.g.&lt;/em&gt;,&amp;nbsp;faster than any function which we know to be computable even in exponential time) relative to some more-or-less sensible model of set theory. If you are interested in things which you can compute in a reasonable time-bound with quantum computers &amp;mdash; &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;in polynomial time, which can be simulated in at worst exponential time on a conventional computer &amp;mdash; it follows that on mathematical grounds as well as physical grounds, you should expect these functions not to be practically computable even on an idealised quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-07-06T15:20:03.390" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2653" PostTypeId="2" ParentId="2651" CreationDate="2018-07-06T16:52:31.677" Score="2" Body="&lt;p&gt;My personal view:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, large entangled states can be visualized using quantum bayesian networks. See&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0701201&quot; rel=&quot;nofollow noreferrer&quot;&gt;Factorization of Quantum Density Matrices According to Bayesian and Markov Networks, by Robert R. Tucci&lt;/a&gt; (obviously I am the author here)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/artiste-qb-net/quantum-fog&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python tools for analyzing both classical and quantum Bayesian Networks&lt;/a&gt; (Disclaimer: artiste-qb.net is my company)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Other people will probably advise using Tensor Networks instead of quantum Bayesian nets. This begs the question: How do Quantum Bayesian Networks and Tensor Networks compare? I have thought about that and gathered my thoughts in &lt;a href=&quot;https://qbnets.wordpress.com/2015/03/26/tensor-networks-versus-quantum-bayesian-networks-and-the-winner-is/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; blog post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First lines of blog post: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A question I am often asked is what is the difference between tensor&#xA;  networks and quantum Bayesian networks, and is there any advantage to&#xA;  using one over the other.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;When dealing with probabilities, I prefer quantum Bayesian networks&#xA;  because b nets are a more natural way of expressing probabilities (and&#xA;  probability amplitudes) whereas tensor nets can be used to denote many&#xA;  physical quantities other than probabilities so they are not tailor&#xA;  made for the job as b nets are. Let me explain in more detail for the&#xA;  technically inclined.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One can consider bipartite entanglement for the two sides of a partition, of a quantum bayesian network. One can write nice inequalities for such bipartite entanglements. See, for example, &lt;a href=&quot;https://arxiv.org/abs/1806.08415&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entanglement Polygon Inequality in Qubit Systems,&#xA;Xiao-Feng Qian, Miguel A. Alonso, Joseph H. Eberly&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can also try to define a measure of n-partite entanglement for n&gt;2, where n is the number of nodes of a quantum Bayesian net.&#xA;See, for example, &lt;a href=&quot;https://arxiv.org/abs/1011.5012&quot; rel=&quot;nofollow noreferrer&quot;&gt;Verifying Genuine High-Order Entanglement, Che-Ming Li, Kai Chen, Andreas Reingruber, Yueh-Nan Chen, Jian-Wei Pan&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="91" LastEditDate="2018-08-07T21:18:34.053" LastActivityDate="2018-08-07T21:18:34.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2654" PostTypeId="1" CreationDate="2018-07-07T09:43:07.033" Score="19" ViewCount="2848" Body="&lt;p&gt;In the recent Question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2499/is-quantum-computing-just-pie-in-the-sky&quot;&gt;&quot;Is Quantum Computing just Pie in the Sky&quot;&lt;/a&gt; there are many responses regarding the improvements in quantum capabilities, however all are focussed on the current 'digital' computing view of the world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Analog computers of old could simulate and compute many complex problems that fitted their operating modes that were not suitable for digital computing for many many years (and some are still 'difficult'). Before the wars (~I &amp;amp; II) everything was considered to be 'clockwork' with mechanical Turk brains. Have we fallen into the same 'everything digital' bandwagon trap that keeps recurring (there are no tags related to 'analog')?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What work has been done on the mapping of quantum phenomena to analog computing, and learning from that analogy? Or is it all a problem of folk having no real idea how to program the beasts.&lt;/p&gt;&#xA;" OwnerUserId="3021" LastEditorUserId="26" LastEditDate="2018-07-15T13:56:54.403" LastActivityDate="2019-11-20T21:51:39.467" Title="Are quantum computers just a variant on Analog computers of the 50's &amp; 60's that many have never seen nor used?" Tags="&lt;classical-computing&gt;&lt;programming&gt;&lt;adiabatic-model&gt;&lt;technologies&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2655" PostTypeId="1" CreationDate="2018-07-07T17:29:41.613" Score="6" ViewCount="124" Body="&lt;p&gt;Existing superconducting quantum computers need to be cooled near absolute zero.  For example, some of D-Wave's machines are cooled to about $20 \ \mathrm {mK}$.  Their design uses a dilution refrigerator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other cooling methods for superconducting quantum computers besides dilution refrigerators which are capable of achieving such low temperatures?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any specific commercial quantum computer designs or research projects using these other cooling methods?&lt;/p&gt;&#xA;" OwnerUserId="2866" LastEditorUserId="26" LastEditDate="2018-07-08T10:12:39.450" LastActivityDate="2018-11-15T19:23:15.843" Title="What methods exist for cooling superconducting quantum computers?" Tags="&lt;d-wave&gt;&lt;superconducting-quantum-computing&gt;&lt;dilution-refrigerator&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-01-04T20:11:48.860" ContentLicense="CC BY-SA 4.0" />
  <row Id="2656" PostTypeId="2" ParentId="2654" CreationDate="2018-07-08T01:44:09.800" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What work has been done on the mapping of quantum phenomena to analog computing, and learning from that analogy?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A starting place (with a lot of good references) to learn about analog quantum computing (also known as &quot;quantum analogue computing&quot; and &quot;continuous variable quantum computing&quot;) is &lt;a href=&quot;https://arxiv.org/abs/1001.2215&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Note that analog classical computing is not as powerful as analog quantum computing, for a reason similar to what I explained in my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2226/2293&quot;&gt;answer to this question&lt;/a&gt;: quantum computers (whether digital or analog) can take advantage of quantum entanglement.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Have we fallen into the same 'everything digital' bandwagon trap that keeps recurring (there are no tags related to 'analog')? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A lot of people unfortunately have, and this might be part of the reason why &quot;adiabatic quantum computing&quot; struggled to get the respect it deserved in its early years (and even now). Adiabatic quantum computing is a specific type of analog quantum computing which certainly does have a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/adiabatic-model&quot;&gt;tag&lt;/a&gt; on this Stack Exchange and a fair number of questions (but not enough, in my opinion). It has been proven that &quot;adiabatic quantum computing&quot;, which is completely analog and does not involve any &lt;em&gt;gates&lt;/em&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405098&quot; rel=&quot;nofollow noreferrer&quot;&gt;can do anything that a digital quantum computer can do&lt;/a&gt; with the same computational efficiency, so while it is true that many people in quantum computing have fallen into the 'everything digital' bandwagon trap, there are some people that appreciate analog quantum computing (for example adiabatic quantum computing).  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-13T15:12:45.560" LastActivityDate="2018-07-13T15:12:45.560" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2657" PostTypeId="2" ParentId="2627" CreationDate="2018-07-08T03:23:36.117" Score="1" Body="&lt;p&gt;From the question title, it sounds like you're interested in brute-force password cracking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a quantum algorithm for this that outperforms brute force, in principle. It's called &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover&amp;#39;s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt; and it was one of the earliest quantum algorithms to be discovered.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, to crack a password, you need as many qubits in your quantum computer as you'd need bits in a traditional computer to hash the passwords (actually more, since you have to hash them &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;reversibly&lt;/a&gt;, and that involves some overhead). This is orders of magnitude more qubits than any present-day quantum computer has, even for simple password hashing techniques. Also, the computation lasts for far longer than any present-day quantum computer can maintain the integrity of its qubits. And even if it worked, it's not very fast: testing $n$ passwords with Grover's algorithm takes about as long as testing $\sqrt{n}$ passwords by brute force.&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2018-07-08T03:23:36.117" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2658" PostTypeId="2" ParentId="2595" CreationDate="2018-07-08T03:50:31.753" Score="2" Body="&lt;p&gt;What makes quantum wave mechanics different from classical is that the wave is defined over a configuration space with a huge number of dimensions. In nonrelativistic undergraduate quantum mechanics (which is good enough for a theoretical discussion of quantum computing), a system of $n$ spinless point particles in 3D space is described by a wave in $\mathbb{R}^{3n}$, which for $n=2$ already has no analogue in classical mechanics. All quantum algorithms exploit this. It may be possible to exploit classical wave mechanics to improve certain calculations (analog computing), but not using quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The usual model of quantum computing uses qubits that can only be in two states ($\{0,1\}$), not a continuum of states ($\mathbb{R}^3$). The closest classical analogue to that is coupled pendulums, not continuous waves. But there's still an exponential difference between the classical and quantum cases: the classical system of n pendulums is described by $n$ positions and momenta (or $n$ complex numbers), while the quantum system is described by $2^n$ complex numbers (or $2^n$ abstract &quot;positions&quot; and &quot;momenta&quot;, but quantum physicists never talk that way).&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2018-07-08T03:50:31.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2659" PostTypeId="1" CreationDate="2018-07-08T06:08:14.047" Score="4" ViewCount="268" Body="&lt;p&gt;I'm trying to implement Majorana's &quot;stellar representation&quot; of a spin-$j$ system as $2j$ points on the $2$-sphere in python. Consulting papers including &lt;a href=&quot;https://arxiv.org/abs/1503.03446&quot; rel=&quot;nofollow noreferrer&quot;&gt;Extremal quantum states and their Majorana constellations (Bjork et al., 2015)&lt;/a&gt;, I convert a complex state vector (nominally indexed from -$j$ to $j$) to its corresponding polynomial with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def vector_to_polynomial(vector):&#xA;    components = vector.tolist()&#xA;    j = (len(components)-1.)/2.&#xA;    coeffs = []&#xA;    i = 0&#xA;    for m in numpy.arange(-1*j, j+1, 1):&#xA;        coeff = math.sqrt(math.factorial(2*j)/(math.factorial(j-m)*math.factorial(j+m)))*components[i]&#xA;        coeffs.append(coeff)&#xA;        i += 1&#xA;    return coeffs[::-1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use a polynomial solver to determine the roots, and stereographically project them to the $2$-sphere, taking into account when the degree of the polynomial is less than $2j$ by adjoining some poles (latter code not included).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def root_to_xyz(root):&#xA;    if root == float('inf'):&#xA;        return [0,0,1]&#xA;    x = root.real&#xA;    y = root.imag&#xA;    return [(2*x)/(1.+(x**2)+(y**2)),\&#xA;            (2*y)/(1.+(x**2)+(y**2)),\&#xA;            (-1.+(x**2)+(y**2))/(1.+(x**2)+(y**2))]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;See Wikipedia. Now QuTiP has an implementation of the Husimi Q function aka &lt;code&gt;qutip.spin_q_function(state, theta, phi)&lt;/code&gt;, evaluated at points on the sphere. The zeros of Husimi Q coincide with the Majorana stars. Comparing the results of the above with the QuTiP implementation, however, I find that they only match for integer spins, but not half-integer spins, aka for odd-dimensional systems, but not even dimensional systems. I've tried to code up a few other versions of the Majorana polynomial given in other papers, but the same problem seems to recur. Am I missing something more fundamental? Any advice is welcome!&lt;/p&gt;&#xA;" OwnerUserId="456" LastEditorUserId="26" LastEditDate="2018-07-08T09:39:58.000" LastActivityDate="2018-07-08T09:39:58.000" Title="Computing Majorana &quot;Stars&quot;" Tags="&lt;bloch-sphere&gt;&lt;majorana-particle&gt;&lt;qutip&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2660" PostTypeId="5" CreationDate="2018-07-08T09:44:59.777" Score="0" Body="&lt;p&gt;For more about QuTiP best place is &lt;a href=&quot;https://github.com/qutip/qutip/blob/master/README.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ref&lt;/a&gt;.&lt;br&gt;&#xA;&quot;The QuTiP library depends on the excellent Numpy, Scipy, and Cython numerical packages. It produces plots using the backends provided by matplotlib. QuTiP aims to provide user-friendly and efficient numerical simulations of a wide variety of quantum mechanical problems, including those with Hamiltonians and/or collapse operators with arbitrary time-dependence, commonly found in a wide range of physics applications. QuTiP is freely available for use and/or modification, and it can be used on all Unix-based platforms and on Windows. Being free of any licensing fees, QuTiP is ideal for exploring quantum mechanics in research as well as in the classroom.&quot;&#xA;This tag is not related to writing programs (or any related software like qiskit) which can be run on a quantum computer. In fact these programs would most probably be written in python.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="462" LastEditDate="2019-07-12T15:19:07.873" LastActivityDate="2019-07-12T15:19:07.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2661" PostTypeId="4" CreationDate="2018-07-08T09:44:59.777" Score="0" Body="For questions about code which makes some use of QuTiP (Quantum Toolbox in Python). It is an open-source software library for simulating the dynamics of closed and open quantum systems. Please don't use the programming tag unless you absolutely think it is related to your question. Basically, questions which involve calculating physical quantities, by doing numerical computations on a computer are suited for this tag." OwnerUserId="26" LastEditorUserId="462" LastEditDate="2019-07-12T15:19:53.227" LastActivityDate="2019-07-12T15:19:53.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2662" PostTypeId="2" ParentId="2654" CreationDate="2018-07-08T12:56:45.927" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are quantum computers just a variant on Analog computers of the 50's &amp;amp; 60's that many have never seen nor used?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, they are not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The digital vs analog factor is not the point here,&#xA;the difference between quantum and classical devices lies at a more fundamental level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum device cannot, in general, be simulated efficiently by a classical device, be it &quot;analog&quot; or &quot;digital&quot; (or at least, this is strongly believed to be the case). In this sense, quantum computers are really radically different from any variation of classical analog computers, or other forms of classical computing for that matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the most popularized architectures for quantum computing, those operating on sets of &quot;qubits&quot;, are the quantum counterparts of &lt;em&gt;digital&lt;/em&gt; classical computers. Analog devices also have their quantum counterparts (see for example &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-variable_quantum_information&quot; rel=&quot;nofollow noreferrer&quot;&gt;continuous-variable quantum information&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-07-08T12:56:45.927" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2663" PostTypeId="1" AcceptedAnswerId="2666" CreationDate="2018-07-08T14:55:51.033" Score="6" ViewCount="981" Body="&lt;p&gt;Many texts (especially meant for public consumption) discussing quantum mechanics tend to skim over exactly how entanglement is achieved. Even the Wikipedia article on quantum entanglement describes the phenomenon as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Quantum entanglement is a physical phenomenon which occurs when pairs or groups of particles are generated, interact, or share spatial proximity in ways such that the quantum state of each particle cannot be described independently of the state of the other(s)...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't explain how the process actually comes into being. How are these particles &quot;generated,&quot; &quot;interact,&quot; or &quot;share spatial-proximity&quot; such that we can claim that two particles are entangled? What is the process?&lt;/p&gt;&#xA;" OwnerUserId="3035" LastEditorUserId="26" LastEditDate="2018-12-14T05:27:27.920" LastActivityDate="2019-04-29T08:29:44.193" Title="How is entanglement achieved between two particles in quantum computing?" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2664" PostTypeId="1" AcceptedAnswerId="2668" CreationDate="2018-07-08T15:10:25.443" Score="3" ViewCount="180" Body="&lt;p&gt;Can someone show to me the steps to derive the joint state at the bottom of this image, please? &lt;a href=&quot;https://i.stack.imgur.com/PM5UB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PM5UB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to follow his explanation but I didn't get the same results…&#xA;This is taken from the lecture notes of Ronald de Wolf in case it may help&lt;/p&gt;&#xA;" OwnerUserId="3036" LastEditorUserId="26" LastEditDate="2019-10-28T09:07:26.500" LastActivityDate="2019-10-28T09:07:26.500" Title="How is the joint state of these qubits derived?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;tensor-product&gt;&lt;teleportation&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2665" PostTypeId="2" ParentId="2663" CreationDate="2018-07-08T15:18:29.340" Score="2" Body="&lt;p&gt;You can easily create an EPR pair by means of a circuit consisting of a Hadamard gate on the first qubit, followed by a CNOT gate, having two &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; states as an input. The calculations would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(H\otimes I)(|0\rangle\otimes|0\rangle)=H|0\rangle\otimes|0\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\otimes|0\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\otimes|0\rangle=\frac{1}{\sqrt{2}}(|0\rangle\otimes|0\rangle+|1\rangle\otimes|1\rangle)=\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)=|\Psi^+\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The ending state consequently is the EPR pair called &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt;, which is a classical example of an entangled pair.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2019-04-29T08:29:44.193" LastActivityDate="2019-04-29T08:29:44.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2666" PostTypeId="2" ParentId="2663" CreationDate="2018-07-08T15:27:14.087" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/2371/josu-etxezarreta-martinez&quot;&gt;Josu&lt;/a&gt; has given an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2665/26&quot;&gt;example&lt;/a&gt; of how using quantum gates you can get an entangled state. However, quantum gates are sort of &quot;black-boxes&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physical methods for creating entangled states and testing for entangled states are covered well on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;relevant Wikipedia page&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement#Methods_of_creating_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Methods of creating entanglement&lt;/a&gt;&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Entanglement is usually created by direct interactions between&#xA;  subatomic particles. These interactions can take numerous forms. One&#xA;  of the most commonly used methods is spontaneous parametric&#xA;  down-conversion to generate a pair of photons entangled in&#xA;  polarisation. Other methods include the use of a fiber coupler to&#xA;  confine and mix photons, photons emitted from decay cascade of the&#xA;  bi-exciton in a quantum dot, the use of the Hong–Ou–Mandel effect,&#xA;  etc., In the earliest tests of Bell's theorem, the entangled particles&#xA;  were generated using atomic cascades.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;It is also possible to create entanglement between quantum systems&#xA;  that never directly interacted, through the use of entanglement&#xA;  swapping. Two independently-prepared, identical particles may also be&#xA;  entangled if their wave functions merely spatially overlap, at least&#xA;  partially.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement#Testing_a_system_for_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Testing a system for entanglement:&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Systems which contain no entanglement are said to be separable. For $2$-Qubit and Qubit-Qutrit systems ($2 × 2$ and $2 × 3$ respectively) the simple Peres–Horodecki criterion provides both a necessary and a sufficient criterion for separability, and thus for detecting entanglement. However, for the general case, the criterion is merely a sufficient one for separability, as the problem becomes NP-hard. A numerical approach to the problem is suggested by Jon Magne Leinaas, Jan Myrheim and Eirik Ovrum in their paper &quot;Geometrical aspects of entanglement&quot;. Leinaas et al. offer a numerical approach, iteratively refining an estimated separable state towards the target state to be tested, and checking if the target state can indeed be reached. An implementation of the algorithm (including a built-in Peres-Horodecki criterion testing) is brought in the &quot;StateSeparator&quot; web-app.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In 2016 China launched the world’s first quantum communications satellite. The $100m Quantum Experiments at Space Scale (QUESS) mission was launched on Aug 16, 2016, from the Jiuquan Satellite Launch Center in northern China at 01:40 local time.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For the next two years, the craft – nicknamed &quot;Micius&quot; after the ancient Chinese philosopher – will demonstrate the feasibility of quantum communication between Earth and space, and test quantum entanglement over unprecedented distances.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In the June 16, 2017, issue of Science, Yin et al. report setting a new quantum entanglement distance record of $1203$ km, demonstrating the survival of a $2$-photon pair and a violation of a Bell inequality, reaching a CHSH valuation of $2.37 ± 0.09$, under strict Einstein locality conditions, from the Micius satellite to bases in Lijian, Yunnan and Delingha, Quinhai, increasing the efficiency of transmission over prior fiberoptic experiments by an order of magnitude.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You might also want to see: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2263/how-do-i-show-that-a-two-qubit-state-is-an-entangled-state&quot;&gt;How do I show that a two-qubit state is an entangled state?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2413/how-to-show-that-an-n-level-system-is-entangled/2419&quot;&gt;How to show that an n-level system is entangled?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-07-08T15:27:14.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2667" PostTypeId="1" AcceptedAnswerId="17325" CreationDate="2018-07-08T15:53:34.887" Score="25" ViewCount="8865" Body="&lt;p&gt;As we make inroads into Machine Learning, there seem to be plenty of respectable courses available online via Coursera, edX, etc. on the topic. As quantum computing is still in its infancy, not to mention, incredibly daunting, it is vital that easy to understand, introductory courses are made available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to find these courses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.edx.org/course/quantum-information-science-i&quot; rel=&quot;noreferrer&quot;&gt;Quantum Information Science I, Part 1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.coursera.org/learn/quantum-optics-single-photon&quot; rel=&quot;noreferrer&quot;&gt;Quantum Optics 1 : Single Photons&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I am not certain how relevant the second course might be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, this question may benefit from receiving answers in the near future as the topic steadily becomes mainstream.&lt;/p&gt;&#xA;" OwnerUserId="3035" LastEditorUserId="3035" LastEditDate="2018-07-08T16:49:35.583" LastActivityDate="2021-05-02T00:16:10.563" Title="Currently, what are the best structured courses available online on quantum computing?" Tags="&lt;resource-request&gt;" AnswerCount="9" CommentCount="2" FavoriteCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="2668" PostTypeId="2" ParentId="2664" CreationDate="2018-07-08T16:04:29.700" Score="2" Body="&lt;p&gt;Since this is a homework-type question, I'll just outline the method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You begin in the state $(\alpha_0|0\rangle + \alpha_1|1\rangle) \otimes \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be written as $(\alpha_0|0\rangle_{A1}) \otimes \frac{1}{\sqrt{2}}(|0\rangle_{A2}  |0\rangle_B + |1\rangle_{A2} |1\rangle_{B}) +  (\alpha_1|1\rangle_{A1}) \otimes \frac{1}{\sqrt{2}}(|0\rangle_{A2}  |0\rangle_B + |1\rangle_{A2} |1\rangle_{B})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply the CNOT to qubits $\text{A1}$ and $\text{A2}$. If $\text{A1}$ is in $|0\rangle$, $\text{A2}$ remains unchanged or else it flips. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get to the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$(\alpha_0|0\rangle_{A1}) \otimes \frac{1}{\sqrt{2}}(|0\rangle_{A2}  |0\rangle_B + |1\rangle_{A2} |1\rangle_{B}) +  (\alpha_1|1\rangle_{A1}) \otimes \frac{1}{\sqrt{2}}(|1\rangle_{A2}  |0\rangle_B + |0\rangle_{A2} |1\rangle_{B})$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then apply the Hadamard gate on $\text{A1}$. Remember that the Hadamard gate maps $|0\rangle_{A1}$ to $\frac{|0\rangle + |1\rangle}{\sqrt 2}$ and $|1\rangle_{A1}$ to $\frac{|0\rangle - |1\rangle}{\sqrt 2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You finally get to the state shown in the diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: $\text{A1}$ refers to Alice's first qubit. $\text{A2}$ refers to Alice's second qubit. $\text{B}$ refers to Bob's qubit. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-07-08T16:04:29.700" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2669" PostTypeId="2" ParentId="2667" CreationDate="2018-07-08T16:11:03.857" Score="21" Body="&lt;p&gt;I personally took the course &lt;a href=&quot;https://www.edx.org/course/quantum-mechanics-quantum-computation-uc-berkeleyx-cs-191x&quot; rel=&quot;noreferrer&quot;&gt;Quantum Mechanics and Quantum Computation on EdX (UC Berkeley) by Professor Vazirani&lt;/a&gt;. The course is now archived, however, you can still access the lectures &lt;a href=&quot;https://www.youtube.com/playlist?list=PL2jykFOD1AWap0r8WOuZ-08BFgMyx-5RT&quot; rel=&quot;noreferrer&quot;&gt;on YouTube&lt;/a&gt;. It covers the basics of quantum mechanics and gives a nice overview of some of the most popular quantum algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;About this course (from the course page):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum computation is a remarkable subject building on the great&#xA;  computational discovery that computers based on quantum mechanics are&#xA;  exponentially powerful. This course aims to make this cutting-edge&#xA;  material broadly accessible to undergraduate students, including&#xA;  computer science majors who do not have any prior exposure to quantum&#xA;  mechanics. The course starts with a simple introduction to the&#xA;  fundamental principles of quantum mechanics using the concepts of&#xA;  qubits (or quantum bits) and quantum gates. This treatment emphasizes&#xA;  the paradoxical nature of the subject, including entanglement,&#xA;  non-local correlations, the no-cloning theorem and quantum&#xA;  teleportation. The course covers the fundamentals of quantum&#xA;  algorithms, including the quantum fourier transform, period finding,&#xA;  Shor's quantum algorithm for factoring integers, as well as the&#xA;  prospects for quantum algorithms for NP-complete problems. It also&#xA;  discusses the basic ideas behind the experimental realization of&#xA;  quantum computers, including the prospects for adiabatic quantum&#xA;  optimization and the D-Wave controversy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-08T16:33:33.290" LastActivityDate="2018-07-08T16:33:33.290" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2670" PostTypeId="2" ParentId="2654" CreationDate="2018-07-08T17:47:28.290" Score="10" Body="&lt;p&gt;Here is a quick list of notable differences between analog and quantum computers:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Analog computers can't pass Bell tests.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The state space of an analog computer with N sliders is N dimensional. The state space of a quantum computer with N qubits is $2^N$ dimensional.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Error correct an analog computer and what you've got is a digital computer (i.e. not fundamentally analog anymore). Quantum computers are still quantum after being error corrected.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Analog computers aren't sensitive to decoherence errors. They don't break if you make accidental copies of the data. Quantum computations do break if that happens.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Analog computers can't (efficiently) run Shor's algorithm. Or Grover's algorithm. Or basically any other quantum algorithm.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-07-08T17:47:28.290" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2671" PostTypeId="1" AcceptedAnswerId="2672" CreationDate="2018-07-08T18:14:05.187" Score="7" ViewCount="794" Body="&lt;p&gt;I am learning to manipulate Qbits and recently I saw the teleportation algorithm. I read about it in two places: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation#Formal_presentation&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; and &lt;a href=&quot;https://homepages.cwi.nl/~rdewolf/qcnotes.pdf&quot; rel=&quot;noreferrer&quot;&gt;Lecture Notes from Ronald de Wolf&lt;/a&gt; (Page 7, &lt;strong&gt;1.5 Example: Quantum Teleportation&lt;/strong&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to understand how to operate with Qbits using linear algebra when an entanglement is present. In this case, we have 3 Qbits.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Qbit 1: in possession of Alice and is going to be teleported to Bob&lt;/li&gt;&#xA;&lt;li&gt;Qbit 2: in possession of Alice&lt;/li&gt;&#xA;&lt;li&gt;Qbit 3: in possession of Bob&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Qbit 2 and 3 are in Bell state: $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$. &#xA;The full state of three Qbits 1, 2, 3 is $(\alpha_0 |0\rangle+\alpha_1|1\rangle) \otimes \frac{1}{\sqrt2}(|00\rangle+|11\rangle)$. In an extended (more painful) notation it would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\alpha_0}{\sqrt2}|000\rangle + 0 \cdot |001\rangle + 0 \cdot|010\rangle+ \frac{\alpha_0}{\sqrt2}|011\rangle + $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{\alpha_1}{\sqrt2}|100\rangle + 0 \cdot|101\rangle + 0 \cdot|110\rangle+ \frac{\alpha_1}{\sqrt2}|111\rangle + $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'd like to apply a &lt;strong&gt;CNOT&lt;/strong&gt; gate (Controlled Not) to Qbits 1 and 2, and finally &lt;strong&gt;H&lt;/strong&gt; gate (Hadamard transform) to Qbit 1. I know how &lt;strong&gt;CNOT&lt;/strong&gt; operation affects Qbit 1 and 2, but it's not completely clear how does it affect Qbit 3. I'm wondering what is the $8 \times 8$ Matrix that is applied to the state (in extended notation) when is applied &lt;strong&gt;CNOT&lt;/strong&gt; on Qbit 1 and 2.&lt;/p&gt;&#xA;" OwnerUserId="3037" LastEditorUserId="26" LastEditDate="2018-12-13T21:00:37.163" LastActivityDate="2018-12-13T21:00:37.163" Title="When you act on a multi-qubit system with a 2-qubit gate, what happens to the third qubit?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2672" PostTypeId="2" ParentId="2671" CreationDate="2018-07-08T19:14:41.887" Score="7" Body="&lt;p&gt;Whenever you have a quantum gate (like a CNOT) acting on some qubits but not others, it is assumed that the other qubits are acted on with the identity operator. This is done using the &quot;Left Kronecker product&quot; or the &quot;tensor product&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the 8x8 matrix is made by applying CNOT to qubits 1 &amp;amp; 2 and the identity matrix to qubit 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{bmatrix}&#xA;    1       &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0       &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0       &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0       &amp;amp; 0  &amp;amp; 1 &amp;amp; 0&#xA;\end{bmatrix}\otimes &#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0\\ &#xA;0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;kron([1 0 0 0 ; 0 1 0 0 ; 0 0 0 1; 0 0 1 0],eye(2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in MATLAB or Octave, you get the following 8x8 matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AegMt.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AegMt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Explanation of the code: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&quot;kron&quot; means &quot;left Kronecker product&quot;&lt;/li&gt;&#xA;&lt;li&gt;The first argument to the &quot;kron&quot; function is the CNOT gate in matrix form&lt;/li&gt;&#xA;&lt;li&gt;The second argument is &quot;eye(2)&quot; which means 2x2 identity &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here is an example of how to do a &quot;left Kronecker product&quot; without MATLAB:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/502oZ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/502oZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-08T19:22:48.697" LastActivityDate="2018-07-08T19:22:48.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2673" PostTypeId="2" ParentId="2607" CreationDate="2018-07-08T23:54:10.947" Score="7" Body="&lt;p&gt;Let me attempt to give a rather unconventional answer to this question:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;As a non-mathematician/software programmer I'm trying to grasp&#xA;how QFT (Quantum Fourier Transformation) works.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Suppose that we have a quantum computer which is able to manipulate $n$ qubits. The &lt;em&gt;quantum state&lt;/em&gt; of such a quantum computer precisely describes the current state of this quantum computer. It is pretty well-known that we can express this quantum state as a vector of $2^n$ complex numbers. Let's try to visualize these complex numbers in a compact way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To that end, consider a horizontal line, on which $2^n$ points are depicted. They are labeled corresponding to their respective position on the line, i.e., the first point is labeled with $|0\rangle$, and the last points is labeled by $|2^n-1\rangle$. We can see this in the picture below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hQSOr.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hQSOr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, try to picture that at every point, depicted above, this line punctures a circle of radius $1$ right through the middle. That is, there are $2^n$ circles placed exactly at the points depicted above, and the line connects the middles of all these circles. I have tried to depict this in the image below, but my 3D drawing skills are not exactly top-notch, so you will have to excuse me for that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DksQu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DksQu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The nice thing of this picture above is that it can uniquely represent the state of any $n$-qubit quantum computer by marking exactly one point in all of the circles. More explicitly, any quantum state of a $n$-qubit quantum computer can be depicted in the above picture by drawing one cross ($\times$) in all of the circles. Conversely, any such drawing represents a quantum state, as long as the squares of the distances of the crosses to the center point sum to $1$. In other words, if we calculate all the distances of the marked points to the center points, then square these distances, and then add them all up, we require that the result equals $1$. An example state is shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hryjI.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hryjI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throughout the execution of a program, the state of the quantum computer is constantly changing, and as such, so is the visual representation. Hence, throughout the execution of a quantum program, the marked points (the $\times$s), are constantly moving around, within the boundaries of their respective circles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Within this framework, the Quantum Fourier Transform is just a very specific way to move the marked vertices around. We will make this explicit in the case of a $3$-qubit quantum computer, on which a $3$-qubit Quantum Fourier Transform is executed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To that end, suppose that we have the $3$-qubit system in the following state, i.e., where the cross is all the way at the edge in the $|0\rangle$ circle, and all the others are exactly at the center. It is an exercise for the OP to check that indeed the square of the distances of the marked points to the center points sum to $1$. We refer to this state as the $|0\rangle$ state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bm25S.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bm25S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is now what happens to the quantum state when we apply the Quantum Fourier Transform. It turns out that, when the Quantum Fourier Transform is applied to the state shown above, the resulting state of the quantum system becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Le8vr.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Le8vr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I added the red dashed line passing through all the marked points just for extra convenience. All the marked points are on the exact same location in the circles, namely precisely above the center point at a height of $1/\sqrt{8}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, we can have a look at the action of the Quantum Fourier Transform on other states. Consider for example the $|1\rangle$ state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Lv0AM.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lv0AM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we apply the Quantum Fourier Transform, the resulting state becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4t87o.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4t87o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that the resulting state becomes some kind of helix shape. Moreover, observe that if we were to add one extra circle to the right of the rightmost state, then the helix would complete exactly one revolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that the other states behave similarly under the Quantum Fourier Transform, but that the period of the helix changes. More precisely, if we start out with the state $|j\rangle$, then the number of revolutions that the Quantum Fourier Transform makes is $j$. I.e., if we consider the initial state $|3\rangle$, then we obtain the following image under the Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dc1H7.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dc1H7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, we can easily see that the helix completes $3$ full revolutions if we were to add one more circle on the right hand side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is important to note that we can also reverse the order of things. That is to say, if we have a quantum computer, whose state can be pictured as a helix, similar to the ones shown above, then we can obtain the period of this helix by implementing the &lt;em&gt;inverse&lt;/em&gt; Quantum Fourier Transform. In doing so, we essentially map the helix with $j$ revolutions to the state $|j\rangle$, which is the exact opposite direction from the mapping we considered before.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is this idea that is the crucial component in Shor's algortihm. The central idea is to take the sequence of numbers you describe:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;7, 4, 13, 1, 7, 4, 13, 1, 7, 4, 13, 1 (etc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and use these to create a helix whose period is equal to the period in this sequence. Next, we apply the inverse Quantum Fourier Transform to obtain the state $|4\rangle$, i.e., the period of this sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTE 1: There are a lot of details that I skipped over in the final paragraph. This answer already contains a lot of information, though, which I think needs to sink in before one can attempt to add these details to the picture. If anyone wants me to add these details, I might do so at a later stage.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;NOTE 2: The OP mentioned that he is not a mathematician. To the mathematicians out there, this visual representation is just an array of $2^n$ unit circles in the complex plane, where the marked points are the representation of the amplitudes as vectors in the complex plane.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2018-07-08T23:54:10.947" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2674" PostTypeId="1" AcceptedAnswerId="2675" CreationDate="2018-07-09T06:45:15.050" Score="13" ViewCount="555" Body="&lt;p&gt;Entanglement is often discussed as being one of the essential components that makes quantum different from classical. But is entanglement really necessary to achieve a speed-up in quantum computation?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-12-13T20:09:34.780" LastActivityDate="2018-12-13T20:26:13.487" Title="Is entanglement necessary for quantum computation?" Tags="&lt;entanglement&gt;&lt;speedup&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2675" PostTypeId="2" ParentId="2674" CreationDate="2018-07-09T06:45:15.050" Score="9" Body="&lt;p&gt;Short answer: yes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One has to be a little bit more careful setting up the question. Thinking about a circuit as being composed of state preparation, unitaries, and measurements, it is always in principle possible to &quot;hide&quot; anything we want, such as entangling operations, inside the measurement. So, let us be precise. We want to start from a separable state of many qubits, and the final measurements should consist of single-qubit measurements. Does the computation have to transition through an entangled state at some point in the computation?&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Pure states&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Let's make the one further assumption that the initial state is a pure (product) state. In that case, the system must go through an entangled state. If it didn't, it is easy to simulate the computation on a classical computer because all you have to do is hold $n$ single-qubit pure states in memory, and update them one at a time as the computation proceeds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can even ask how much entanglement is necessary. Again, there are many different ways that entanglement can be moved around at different times. A good model that provides a reasonably fair measure of the entanglement present is &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;measurement-based quantum computation&lt;/a&gt;. Here, we prepare some initial resource state, and it is single-qubit measurements that define the computation that happens. This lets us ask about the entanglement of the resource state. There has to be entanglement and, in some sense, it has to be at least &quot;two-dimensional&quot;, it cannot just be the entanglement generated between nearest neighbours of a system on a line&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504097&quot; rel=&quot;noreferrer&quot;&gt; [ref]&lt;/a&gt;. Moreover, one can show that most states of $n$ qubits are &lt;a href=&quot;https://arxiv.org/abs/0810.4331&quot; rel=&quot;noreferrer&quot;&gt;too entangled&lt;/a&gt; to permit computation in this way.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Mixed states&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The caveat in all that I've said so far is that we're talking about pure states. For example, we can easily simulate a non-entangling computation on pure product states. But what about mixed states? A mixed state is separable if it can be written in the form&#xA;$$&#xA;\rho=\sum_{i=1}^Np_i\rho^{(1)}_i\otimes\rho^{(2)}_i\otimes\ldots\otimes\rho^{(n)}_i.&#xA;$$&#xA;Importantly, there is no limit on the value $N$, the number of terms in the sum. If the number of terms in the sum is small, then by the previous argument, we can simulate the effects of a non-entangling circuit. But if the number of terms is large, then (to my knowledge) it remains an open question as to whether it can be classically simulated, or whether it can give enhanced computation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-09T06:45:15.050" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2676" PostTypeId="2" ParentId="2595" CreationDate="2018-07-09T06:46:24.143" Score="17" Body="&lt;p&gt;Your primary assertion that the mathematics of waves mimic that of quantum mechanics is the right one. In fact, many of the pioneers of QM used to refer to it as wave mechanics for this precise reason. Then it is natural to ask, &quot; Why can't we do quantum computing with waves ?&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The short answer is that quantum mechanics allows us to work with an exponentially large Hilbert space while spending only polynomial resources. That is, the state space of $n$ qubits is a $2^n$ dimensional Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One cannot construct an exponentially large Hilbert space from polynomially many classical resources. To see why this is the case let us look at two different kinds of wave mechanics based computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first way to build such a computer would be to take $n$ number of two-level classical systems. Each system then by itself could be represented by a 2D Hilbert space. For example, one could imagine $n$ guitar strings with only the first two harmonics excited. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This setup will not be able to mimic quantum computing because there is no entanglement. So any state of the system will be a product state and the combined system of $n$  guitar strings cannot be used to make a $2^n$ dimensional Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second way one could attempt to construct an exponentially large Hilbert space is to use a single guitar sting and to identify its first $2^n$ harmonics with the basis vectors of the Hilbert space. This is done in @DaftWullie 's answer. The problem with this approach is that the frequency of the highest harmonic one needs to excite to make this happen will scale as $O(2^n)$. And since the energy of a vibrating string scales quadratically with its frequency, we will need an exponential amount of energy to excite the string. So in the worst case, the energy cost of the computation can scale exponentially with the problem size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the key point here is that classical systems lack entanglement between physically separable parts. And without entanglement, we cannot construct exponentially large Hilbert spaces with polynomial overhead.&lt;/p&gt;&#xA;" OwnerUserId="2663" LastEditorUserId="26" LastEditDate="2018-08-10T20:06:33.773" LastActivityDate="2018-08-10T20:06:33.773" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2677" PostTypeId="2" ParentId="2595" CreationDate="2018-07-09T10:57:17.773" Score="5" Body="&lt;p&gt;I myself often describe the source of the power of quantum mechanics as being due to 'destructive interference', which is to say the wave-like nature of quantum mechanics. From a standpoint of computational complexity, it is clear that this is one of the most important and interesting features of quantum computation, as &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aronson (for example) notes&lt;/a&gt;. But when we describe it in this very brief way  &amp;mdash; that &quot;the power of quantum computation is in destructive interference / the wave-like nature of quantum mechanics&quot; &amp;mdash; it is important to notice that this sort of statement is a short-hand, and necessarily incomplete.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whenever you make a statement about &quot;the power&quot; or &quot;the advantage&quot; of something, it is important to bear in mind: &lt;em&gt;compared to what&lt;/em&gt;?&#xA;In this case, what we are comparing to is specifically probabilistic computing: and what we have in mind is not just that 'something' is acting like a wave, but specifically that &lt;em&gt;something which is otherwise like a probability&lt;/em&gt; is acting like a wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It must be said that probability itself, in the classical world, already does act a bit like a wave: specifically, it obeys a sort of Huygen's Principle (that you can understand the propagation of probabilities of things by summing over the contributions from individual initial conditions &amp;mdash; or in other words, by a &lt;em&gt;superposition principle&lt;/em&gt;). The difference, of course, is that probability is non-negative, and so can only accumulate, and its evolution will be essentially a form of diffusion.&#xA;Quantum computation manages to exhibit wave-like behaviour with probability-like amplitudes, which can be non-positive; and so it is possible to see destructive interference of these amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, because the things which are acting as waves are things like probabilities, the 'frequency space' in which the system evolves can be exponential in the number of particles you involve in the computation. This general sort of phenomenon is necessary if you want to get an advantage over conventional computation: if the frequency space scaled polynomially with the number of systems, and the evolution itself obeyed a wave equation, the obstacles to simulation with classical computers would be easier to overcome. If you wanted to consider how to achieve similar computational advantages with other kinds of waves, you have to ask yourself how you intend to squeeze in an exponential amount of distinguishable 'frequencies' or 'modes' into a bounded energy space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, on a practical note, there is a question of fault-tolerance. Another side-effect of the wave-like behaviour being exhibited by probability-like phenomena is that you can perform error correction by testing parities, or more generally, coarse-trainings of marginal distributions. Without this facility, quantum computation would essentially be limited to a form of analog computation, which is useful for some purposes but which is limited to the problem of sensitivity to noise. We do not yet have fault-tolerant quantum computation in built computer systems, but we know that it is possible in principle and we are aiming for it; whereas it is unclear how any similar thing could be achieved with water waves, for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2658/124&quot;&gt;Some&lt;/a&gt; of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2601/124&quot;&gt;the&lt;/a&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2598/124&quot;&gt;other&lt;/a&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2600/124&quot;&gt;answers&lt;/a&gt; touch on this same feature of quantum mechanics: 'wave-particle duality' is a way of expressing the fact that we have something probabilistic about the behaviour of individual particles which are are acting like waves, and remarks about scalability / the exponentially of the configuration space follow from this. But underlying these slightly higher-level descriptions is the fact that we have quantum amplitudes, behaving like elements of a multi-variate probability distribution, evolving linearly with time and accumulating but which can be negative as well as positive.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-02-05T21:50:49.010" LastActivityDate="2019-02-05T21:50:49.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2678" PostTypeId="5" CreationDate="2018-07-09T12:17:21.137" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-09T12:17:21.137" LastActivityDate="2018-07-09T12:17:21.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2679" PostTypeId="4" CreationDate="2018-07-09T12:17:21.137" Score="0" Body="For questions about the Solovay-Kitaev theorem (and algorithm), a proof that quantum computers can efficiently simulate any 1-qubit quantum gate using a restricted set of quantum gates, as well as the generalisation allowing for the efficient creation of gates with some arbitrarily number of dimensions." OwnerUserId="1386" LastEditorUserId="26" LastEditDate="2019-01-01T09:50:01.990" LastActivityDate="2019-01-01T09:50:01.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2680" PostTypeId="5" CreationDate="2018-07-09T13:05:36.720" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-09T13:05:36.720" LastActivityDate="2018-07-09T13:05:36.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2681" PostTypeId="4" CreationDate="2018-07-09T13:05:36.720" Score="0" Body="Graph-states are a class of quantum state that can be efficiently and uniquely represented by graphs. In the case of qubit graph states, each edge corresponds to a CZ operation applied between two qubits in the +1 X eigenstate. Graph states have a number of useful properties that make them useful objects for the analysis of large quantum systems and play a prominent role in the analysis of quantum computation and communication architectures and protocols." OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-09T17:05:48.737" LastActivityDate="2018-07-09T17:05:48.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2682" PostTypeId="1" AcceptedAnswerId="2684" CreationDate="2018-07-09T14:56:27.723" Score="4" ViewCount="639" Body="&lt;p&gt;All the references in this question refer to &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for solving linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question I have is about the step where they apply controlled-rotations to transfer the eigenvalue encoded in a quantum register to the amplitudes of a state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the quantum phase estimation, the state of the quantum registers is (see page 3):&#xA;$$&#xA;\sum_{j=1}^{N} \sum_{k=0}^{T-1} \alpha_{k|j}\beta_j \vert \tilde\lambda_k\rangle \vert u_j \rangle&#xA;$$&#xA;Then, the HHL algorithm consists in applying rotations controlled by $\vert\tilde\lambda_k\rangle$ to produce the state&#xA;$$&#xA;\sum_{j=1}^{N} \sum_{k=0}^{T-1} \alpha_{k|j}\beta_j \vert \tilde\lambda_k\rangle \vert u_j \rangle \left( \sqrt{1 - \frac{C^2}{\tilde\lambda_k^2}} \vert 0 \rangle + \frac{C}{\tilde\lambda_k}\vert 1 \rangle \right)&#xA;$$&#xA;where &quot;$C = O(1/\kappa)$&quot; (still page 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;: why do they introduce $C$? Isn't $C=1$ valid? &lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="55" LastEditDate="2020-08-01T11:35:41.047" LastActivityDate="2020-08-01T11:35:41.047" Title="HHL algorithm -- controlled-by-eigenvalues rotations" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2683" PostTypeId="1" AcceptedAnswerId="2685" CreationDate="2018-07-09T15:15:01.957" Score="6" ViewCount="350" Body="&lt;p&gt;&lt;em&gt;See edit at the end of the question&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;All the references in this question refer to &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithm for solving linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;HHL algorithm consists in an application of the quantum phase estimation algorithm (QPE), followed by rotations on an ancilla qubit controlled by the eigenvalues obtained as output of the QPE. The state of the quantum registers after the rotations is&#xA;$$&#xA;\sum_{j=1}^{N} \sum_{k=0}^{T-1} \alpha_{k|j}\beta_j \vert \tilde\lambda_k\rangle \vert u_j \rangle \left( \sqrt{1 - \frac{C^2}{\tilde\lambda_k^2}} \vert 0 \rangle + \frac{C}{\tilde\lambda_k}\vert 1 \rangle \right).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the algorithm just uncomputes the first register containing the eigenvalues ($\vert \tilde\lambda_k \rangle$) to give the state&#xA;$$&#xA;\sum_{j=1}^{N}\beta_j \vert u_j \rangle \left( \sqrt{1 - \frac{C^2}{\lambda_j^2}} \vert 0 \rangle + \frac{C}{\lambda_j}\vert 1 \rangle \right).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the notation used assumes that the QPE was perfect, i.e. the approximations were the exact values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next step of the algorithm is to measure the ancilla qubit (the right-most one in the sum above) and to select the output only when the ancilla qubit is measured to be $\vert 1 \rangle$. This process is also called &quot;post-selection&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state of the system after post-selecting (i.e. after ensuring that the measurement returned $\vert 1 \rangle$) is written&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\frac{1}{D}\sum_{j=1}^{N}\beta_j \frac{C}{\lambda_j} \vert u_j \rangle &#xA;$$&#xA;where $D$ is a normalisation constant (the exact expression can be found in the HHL paper, page 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;: Why is the $\frac{C}{\lambda_j}$ coefficient still in the expression? From what I understood, measuring &#xA;$$&#xA;\left( \sqrt{1 - \frac{C^2}{\lambda_j^2}} \vert 0 \rangle + \frac{C}{\lambda_j}\vert 1 \rangle \right)&#xA;$$&#xA;should output $\vert 0 \rangle$ or $\vert 1 \rangle$ and destroy the amplitudes in front of those states. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;EDIT: Specifying the question.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2686/1386&quot;&gt;@glS' answer&lt;/a&gt;, here is the updated question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the post-selection works like described by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2686/1386&quot;&gt;@glS' answer&lt;/a&gt; and not like above?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-07-09T20:27:22.907" LastActivityDate="2018-07-10T01:18:34.003" Title="HHL algorithm -- problem with the outcome of postselection" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;postselection&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2684" PostTypeId="2" ParentId="2682" CreationDate="2018-07-09T15:21:09.703" Score="5" Body="&lt;p&gt;If $\tilde{\lambda_{k}} &amp;lt; C$, the controlled rotation becomes non-physical since you have coeffecient greater than 1 on your $|1\rangle$ state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result $C &amp;lt; \lambda_{min}$ is a safer choice, and that is $O(1/\kappa)$ according to the 4th paragraph in the intro.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-07-09T15:28:32.633" LastActivityDate="2018-07-09T15:28:32.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2685" PostTypeId="2" ParentId="2683" CreationDate="2018-07-09T15:37:36.833" Score="4" Body="&lt;p&gt;Your intuition is correct for a single qubit, in that if I measure $$\alpha\vert 0 \rangle + \beta\vert 1 \rangle$$ I would get either $\vert 0 \rangle$ or $\vert 1 \rangle$. But since the qubits are in a large entangled state, the relevant information stored in the ratios of different probabilities is still held fixed, and the $\frac{C}{\lambda_j}$ factors are part of that overall coeffecient on each $\vert u_j \rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence, you can't think of the process as if you are measuring just &#xA;$$&#xA; \sqrt{1 - \frac{C^2}{\lambda_j^2}} \vert 0 \rangle + \frac{C}{\lambda_j}\vert 1 \rangle &#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because then you are ignoring the entanglement of the qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: To go into more detail. The distiction is between how the one renormalizes after a measurement. So in the beginning if you have a normalized state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha\vert a\rangle + \beta\vert b\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you measure it and get $\vert b \rangle$, you are essentially saying that &quot;My measurement returned b, so only states which are consistent with my measurement can exist&quot; and then normalizing the superposition of all of those states. But only $\vert b\rangle$ is consistent and as such you end up with it, and a prefactor of 1 out front. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However imagine an entagled state of the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\alpha_{00}\vert 00\rangle + \alpha_{01}\vert 01\rangle + \alpha_{10}\vert 10\rangle + \alpha_{11}\vert 11\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I measure the first qubit and get $\vert 0\rangle$, there are two states, $\vert 01\rangle$ and $\vert 00\rangle$ which are consistent, and so your state must be a superposition of those two. In this example that leads to a final state of &#xA;$$A\left(\alpha_{00}\vert 00\rangle + \alpha_{01}\vert 01\rangle\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where A is the overall factor to bring the normalization back to 1. The important thing to see is that the ratio between the two remaining probabilities remains constant at $\alpha_{00}/\alpha_{01}$. This ratio would, in the HHL example, be the factors containing different $\frac{C}{\lambda_j}$ values, and as such they must remain. Physically this correspond to the states which are &quot;still viable&quot; being unaltered relative to eachother, which those which have now been ruled out have their probability set to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of more natural language, imagine I give you 4 scenarios and their likelihoods. If I was to specify their relative probabilities, and then rule out 2 of them, it should be natural that the two which have not been ruled out would still have the same relative probability, as whatever extra information has been added was already assumed in order for those scenarios to have been true. &lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-07-10T01:18:34.003" LastActivityDate="2018-07-10T01:18:34.003" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2686" PostTypeId="2" ParentId="2683" CreationDate="2018-07-09T15:39:13.777" Score="3" Body="&lt;p&gt;You are half right, in that the $C$ factor is only kept there for (what I assume being) explanatory purposes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the $1/\lambda_j$ factors definitely stays there after postselection. One way to see this is that you can think of those factors as attached to the other registers, so that the state is equivalently written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left(\sum_j\beta_j\sqrt{1-\frac{C^2}{\lambda_j^2}} |u_j\rangle\right)|0\rangle +&#xA;\left(\sum_j\beta_j\frac{C}{\lambda_j} |u_j\rangle\right)|1\rangle.\tag1&#xA;$$&#xA;Keeping only the term on the right we get a normalised version of &#xA;$$\sum_j\beta_j\frac{C}{\lambda_j} |u_j\rangle|1\rangle.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an analogy, it's like having the state&#xA;$$(a|0\rangle+b|1\rangle)|0\rangle.$$&#xA;By your reasoning, postselecting on $|0\rangle$ (which here trivially happens with 100% probability) should lead to something like $|0\rangle+|1\rangle$, which is clearly not correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stated in yet another way, you are basically applying the measurement postulate wrong.&#xA;The state remaining after postselection is the sum of all states with ancilla in the state $|1\rangle$, which results in (1). The factors disappear only if you consider postselection over the ancilla alone, which neglects the fact that the ancilla is entangled with the other registers.&#xA;Mathematically, you can see it in the fact that the postselected state is the one obtained applying the projector $\mathbb 1\otimes |1\rangle\langle1|$, and renormalizing the result.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-09T20:28:22.957" LastActivityDate="2018-07-09T20:28:22.957" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2687" PostTypeId="2" ParentId="2667" CreationDate="2018-07-09T15:45:43.410" Score="8" Body="&lt;p&gt;If you are looking for reading material instead of videos, I read &lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph229/&quot; rel=&quot;noreferrer&quot;&gt;John Preskill's Lecture Notes&lt;/a&gt; in undergrad to learn more about the subject, and thought they were really informative and well developed. They were initially written in 1997, but have modern updates from 2015. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;From the website:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Course Description&lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;The theory of quantum information and quantum computation. Overview of classical information theory, compression of quantum information, transmission of quantum information through noisy channels, quantum entanglement, quantum cryptography. Overview of classical complexity theory, quantum complexity, efficient quantum algorithms, quantum error-correcting codes, fault-tolerant quantum computation, physical implementations of quantum computation.&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;  &#xA;  &lt;p&gt;Prerequisites&lt;/p&gt;&#xA;  &#xA;  &lt;blockquote&gt;&#xA;    &lt;p&gt;The course material should be of interest to physicists, mathematicians, computer scientists, and engineers, so we hope to make the course accessible to people with a variety of backgrounds.&lt;/p&gt;&#xA;    &#xA;    &lt;p&gt;Certainly it would be useful to have had a previous course on quantum mechanics, though this may not be essential. It would also be useful to know something about (classical) information theory,  (classical) coding theory,  and (classical) complexity theory, since a central goal of the course will be generalize these topics to apply to quantum information. But we will review this material when we get to it, so you don't need to worry if you haven't seen it before. In the discussion of quantum coding, we will use some rudimentary group theory.&lt;/p&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-09T15:45:43.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2688" PostTypeId="1" CreationDate="2018-07-09T22:03:05.570" Score="7" ViewCount="653" Body="&lt;p&gt;I am relatively new to quantum computing and I feel like I don't fully understand the power of quantum computing due to a lack of understanding of how amplitude amplification works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is confusing me is that the amplitude of the qubit is the square root of the probability and so in amplitude amplification, how is the amplitude of the &quot;correct answer&quot; changed to negative (before then being reflected across the average)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that it is a gate and the gate is a series of complex operations but at the same time I fail to understand physically how do the gates change the amplitude of the qubit. I am referencing this in response to the webpage: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/004-Quantum_Algorithms/070-Grover&amp;#39;s_Algorithm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience Documentation - Grover's algorithm&lt;/a&gt;. Any help is greatly appreciated. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="3061" LastEditorUserId="26" LastEditDate="2018-12-14T06:12:25.040" LastActivityDate="2019-09-25T10:09:44.537" Title="In amplitude amplification, how are the amplitudes of qubits changed?" Tags="&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2689" PostTypeId="2" ParentId="2688" CreationDate="2018-07-10T04:32:25.260" Score="2" Body="&lt;p&gt;EDIT: I completely misunderstood your question and thought that you were confused about what a negative amplitude means, and not about physical mechanisms. I'm leaving this up in case that actually was what you meant. whoops. For the implementation question, how a reflection is implemented physically depends on the qubit implementation you are using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the main confusion you're having is from thinking about the relationship between amplitudes and probabilities in the wrong direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say that the amplitudes are the square root of the probability, but a safer way of thinking, which might help in building intuition, is to say that the amplitude norm squared is the probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \vert A\vert^2 = P$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if this is inverted in its most general form, you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A = \sqrt{P} e^{i\theta}$$ for some $\theta$. This additional phase is where your confusion is coming from, as it allows for both negative amplitudes as you are encountering in your example, as well as in many other very important states like &#xA;$$H\vert 1 \rangle = \vert -\rangle = \frac{1}{\sqrt{2}}\vert 0\rangle - \frac{1}{\sqrt{2}}\vert 1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without this possibility for negative states, quantum mechanical phenomena like constructive and destructive interference of wave functions would be impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-07-10T15:14:47.850" LastActivityDate="2018-07-10T15:14:47.850" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2690" PostTypeId="1" AcceptedAnswerId="2702" CreationDate="2018-07-10T05:05:21.303" Score="4" ViewCount="271" Body="&lt;p&gt;In a recent question about &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2595/if-quantum-speed-up-is-due-to-the-wave-like-nature-of-quantum-mechanics-why-not&quot;&gt;quantum speed-up&lt;/a&gt; @DaftWullie &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2613/2645&quot;&gt;says&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;My research, for example, is very much about &amp;quot;how do we design Hamiltonians &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; so that their time evolution &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt_0}$&lt;/span&gt; creates the operations that we want?&amp;quot;, aiming to do everything we can in a language that is &amp;quot;natural&amp;quot; for a given quantum system, rather than having to coerce it into performing a whole weird sequence of quantum gates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This makes me think of &lt;a href=&quot;https://en.wikipedia.org/wiki/Chronon&quot; rel=&quot;nofollow noreferrer&quot;&gt;chronons&lt;/a&gt;, which are a &lt;a href=&quot;http://samvak.tripod.com/time.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;proposed&lt;/a&gt; quantum of time.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;There are physical limits that prevent the distinction of arbitrarily close successive states in the time evolution of a quantum system.&lt;/p&gt;&#xA;&lt;p&gt;If a discretization is to be introduced in the description of a quantum system, it cannot possess a universal value, since those limitations depend on the characteristics of the particular system under consideration. In other words, the value of the fundamental interval of time has to change a priori from system to system.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706059&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction of a Quantum of Time&lt;/a&gt; (&amp;quot;chronon&amp;quot;), and its Consequences for Quantum Mechanics&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is universal chrononic computing possible?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-12-13T19:57:36.680" Title="Chrononic Computing (Time Evolution Systems)" Tags="&lt;models&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2691" PostTypeId="1" AcceptedAnswerId="2709" CreationDate="2018-07-10T07:05:52.297" Score="6" ViewCount="175" Body="&lt;p&gt;It seems that quantum computers can be classified by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;type of quantum&lt;/a&gt; they operate on. Not entirely sure what category most common current systems fall into (eg. D-Wave, Google, IBM, Microsoft).  Photonic computing seems to be one of the more 'popular' alternative methods. Curious about other forms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Unconventional_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;unconventional&lt;/a&gt; quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quasiparticle#Examples_of_quasiparticles_and_collective_excitations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quasi&lt;/a&gt; interested in a few &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quasiparticles&quot; rel=&quot;nofollow noreferrer&quot;&gt;different cases&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Phonon - sound based&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Roton - vortex based&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Dropleton - quantum droplet&lt;a href=&quot;https://en.wikipedia.org/wiki/Dropleton&quot; rel=&quot;nofollow noreferrer&quot;&gt;*&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fracton - fractal analog of phonons&lt;a href=&quot;https://en.wikipedia.org/wiki/Fracton&quot; rel=&quot;nofollow noreferrer&quot;&gt;*&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Plasmon - plasma based&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also curious about &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2690/chrononic-computing-quantum-computing-w-chronons&quot;&gt;chronons&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_particle&quot; rel=&quot;nofollow noreferrer&quot;&gt;virtual particles&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Have significant breakthroughs in quantum computing been made using non-standard quanta?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-13T19:57:59.853" LastActivityDate="2018-12-13T19:57:59.853" Title="Breakthroughs in quantum computing using non-standard quanta" Tags="&lt;quantum-information&gt;&lt;experiment&gt;&lt;technologies&gt;&lt;anyons&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="1" ClosedDate="2018-07-16T18:41:08.907" ContentLicense="CC BY-SA 4.0" />
  <row Id="2692" PostTypeId="1" CreationDate="2018-07-10T08:19:05.793" Score="5" ViewCount="185" Body="&lt;p&gt;As in the title, I have a doubt regarding the implementation of a boolean formula used as an oracle for a quantum algorithm.&#xA;The problem is that so far I could reproduce the formula as a quantum circuit relatively easily and then solve the related SAT using Grover search. However, if for instance I have 8 variables, I would need more or less twice the number of qubits to reproduce the formula (8 for introducing the variables, the others as workspace to perform the logic operations). Even though Grover search allows a quadratic speed up, I feel that implementing the oracle in this classical way is still a big hindrance in terms of qubits needed, given the fact that they are limited to small amounts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to see if it is possible to encapsulate the 8 variables in 3 qubits so that using a Walsh-Hadamard transform I would have a superposition with $2^3=8$ possible states. 2 problems arise:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) How could i perform the logical operations needed to represent the boolean formula?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Given a single qubit, I can look at it as a variable and assign true and false values to the states $\left|1\right&amp;gt;$ and $\left|0\right&amp;gt;$ respectively; however, if I use multiple qubits and put all of them in a superposition, when assigning each state to a specific variable I can no longer see if they are true or false by looking at the output states! How could I decide a true/false output in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you guys think this is something feasible? I feel I am missing a key point in the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance $\left(x_1\cdot x_2\right)+\left(x_3\cdot x_1\cdot x_4\right)+\left(x_5\cdot x_6\right)$, where every variable $x_i \in \left\lbrace 0,1\right\rbrace$ and &quot; $\cdot$ &quot; stands for the logic AND operation and &quot;$+$&quot; for the logic OR. &lt;/p&gt;&#xA;" OwnerUserId="2648" LastEditorUserId="23" LastEditDate="2018-07-11T09:00:44.313" LastActivityDate="2018-07-11T09:00:44.313" Title="Compact encoding of Boolean formula as oracle" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;quantum-state&gt;&lt;speedup&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2693" PostTypeId="2" ParentId="2651" CreationDate="2018-07-10T09:59:33.603" Score="4" Body="&lt;p&gt;In &lt;a href=&quot;https://www.researchgate.net/publication/49751841_Verifying_Genuine_High-Order_Entanglement?_sg=EMjw2Jt54efwaihq3BCmAnkPUnwDg7x075lZmU-0x5tjFm1J9bXMWMx1CPI2ooEh6ir6OPcZrg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Verifying Genuine High-Order Entanglement&lt;/a&gt; the following graphs represent entangled qudits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AIypU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AIypU.png&quot; alt=&quot;10-qudit state&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/e3U1O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e3U1O.png&quot; alt=&quot;qudit graph states&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1641/2645&quot;&gt;an answer&lt;/a&gt; to 'Alternative to Bloch sphere to represent a single qubit' @Rob references &lt;a href=&quot;https://arxiv.org/abs/1703.06102&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana representation, qutrit Hilbert space and NMR implementation of qutrit gates&lt;/a&gt; which states&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The Majorana representation for spin−$s$ systems has found widespread applications such as determining geometric phase of spins, representing $N$ spinors by $N$ points, geometrical representation of multi-qubit entangled states, statistics of chaotic quantum dynamical systems and characterizing polarized light. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The paper also includes this style of representation for qudits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5a7HX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5a7HX.jpg&quot; alt=&quot;majorana representation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I recently asked about how to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2456/how-to-represent-a-qubyte&quot;&gt;visually represent a qubyte&lt;/a&gt;. In the comments of @DaftWullie's answer I proposed an 8-cube (&lt;a href=&quot;https://en.wikipedia.org/wiki/Hypercube#Graphs&quot; rel=&quot;nofollow noreferrer&quot;&gt;hypercube graph&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UivIl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UivIl.png&quot; alt=&quot;8-cube&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An n-cube can be projected inside a regular 2n-gonal polygon by a skew orthogonal projection&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This method seems to allow for the &lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/2/2f/13-cube.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;complexity&lt;/a&gt; of entanglement to be visualized in a scalable fashion.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-07-10T09:59:33.603" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2694" PostTypeId="2" ParentId="2654" CreationDate="2018-07-10T10:30:53.910" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Have we fallen into the same 'everything digital' bandwagon trap that keeps recurring?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;What I have noticed is more the 'everything binary' bandwagon trap; which reminds me of the &lt;a href=&quot;https://www.snopes.com/fact-check/grandmas-cooking-secret/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grandma's cooking secret&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Once upon a time, a mother was teaching her daughter the family recipe for making a whole baked ham. It was the very best ham anybody had ever had so they always followed that recipe carefully.&lt;/p&gt;&#xA;&lt;p&gt;They prepared the marinade, scored the skin, put in the cloves, and then came a step the daughter didn't understand.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Why do we cut off the ends of the ham?&amp;quot; she said. &amp;quot;Doesn't that make it dry out?&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;You know, I don't know,&amp;quot; said the mother. &amp;quot;That's just the way grandma taught me. We should call grandma and ask.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;So they called grandma and asked, &amp;quot;why do we cut off the ends of the ham? Is it to let the marinade in, or what?&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;No,&amp;quot; said Grandma. &amp;quot;To be honest, I cut the ends off because that's how my mother taught me. I added the marinade step later, because I was worried about the ham drying out. Let's call great grandma and ask her.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;So they called the assisted living facility where great grandma was living, and the old woman listend to their questions, and then said.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Oh, for land sakes! I cut off the ends because I didn't have a pan big enough for a whole ham!&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I was recently thinking about qubytes &amp;amp; wondering if they really needed to be defined as 8 qubits. An 8-level quantum system (qunit) would have an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2417/2645&quot;&gt;8 dimensional space&lt;/a&gt; &amp;amp; could in theory encode a byte (8 bits). Is this a better definition of a qubyte (quantum byte)?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Or is it all a problem of folk having no real idea how to program the beasts.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-07-10T10:30:53.910" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2696" PostTypeId="2" ParentId="2691" CreationDate="2018-07-10T15:20:21.293" Score="1" Body="&lt;p&gt;I'm not sure if you count adiabatic quantum computing as fringe, but there was a &lt;a href=&quot;https://arxiv.org/pdf/1806.03295.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; using 4 NMR qubits to implement a adiabatic analogue to HHL which allowed them to invert an 8x8 operator with 98.4% fidelity which got put on arXiv a couple weeks ago. I thought that was pretty neat.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-07-10T15:44:07.833" LastActivityDate="2018-07-10T15:44:07.833" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2697" PostTypeId="1" CreationDate="2018-07-10T15:42:37.447" Score="23" ViewCount="1948" Body="&lt;p&gt;&lt;sup&gt; Note on the vocabulary: the word &quot;hamiltonian&quot; is used in this question to speak about hermitian matrices.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The HHL algorithm seems to be an active subject of research in the field of quantum computing, mostly because it solve a very important problem which is finding the solution of a linear system of equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the original paper &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithm for solving linear systems of equations (Harrow, Hassidim &amp;amp; Lloyd, 2009)&lt;/a&gt; and some questions asked on this site&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2604/quantum-phase-estimation-and-hhl-algorithm-knowledge-on-eigenvalues-required&quot;&gt;Quantum phase estimation and HHL algorithm - knowledge on eigenvalues required?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2439/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-2-preparation&quot;&gt;Quantum algorithm for linear systems of equations (HHL09): Step 2 - Preparation of the initial states $\vert \Psi_0 \rangle$ and $\vert b \rangle$&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;the HHL algorithm is limited to some specific cases. Here is a summary (that may be incomplete!) of the characteristics of the HHL algorithm:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;HHL algorithm&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The HHL algorithm solves a linear system of equation&#xA;$$A \vert x \rangle = \vert b \rangle$$&#xA;with the following limitations:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Limitations on $A$:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$A$ needs to be Hermitian (and only Hermitian matrix works, see &lt;a href=&quot;https://chat.stackexchange.com/transcript/message/45511015#45511015&quot;&gt;this discussion in the chat&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;$A$'s eigenvalues needs to be in $[0,1)$ (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2604/quantum-phase-estimation-and-hhl-algorithm-knowledge-on-eigenvalues-required&quot;&gt;Quantum phase estimation and HHL algorithm - knowledge on eigenvalues required?&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;$e^{iAt}$ needs to be efficiently implementable. At the moment the only known matrices that satisfy this property are:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;local hamiltonians (see &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.654.7909&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot;&gt;Universal Quantum Simulators (Lloyd, 1996)&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;$s$-sparse hamiltonians (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301023v2&quot; rel=&quot;noreferrer&quot;&gt;Adiabatic Quantum State Generation and Statistical Zero Knowledge (Aharonov &amp;amp; Ta-Shma, 2003)&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Limitations on $\vert b \rangle$:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\vert b \rangle$ should be efficiently preparable. This is the case for:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Specific expressions of $\vert b \rangle$. For example the state $$\vert b \rangle = \bigotimes_{i=0}^{n} \left( \frac{\vert 0 \rangle + \vert 1 \rangle}{\sqrt{2}} \right)$$&#xA;is efficiently preparable.&lt;/li&gt;&#xA;&lt;li&gt;$\vert b \rangle$ representing the discretisation of an efficiently integrable probability distribution (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208112&quot; rel=&quot;noreferrer&quot;&gt;Creating superpositions that correspond to efficiently integrable probability distributions (Grover &amp;amp; Rudolph, 2002)&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;Limitations on $\vert x \rangle$ (output):&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\vert x \rangle$ cannot be recovered fully by measurement. The only information we can recover from $\vert x \rangle$ is a &quot;general information&quot; (&quot;expectation value&quot; is the term employed in the original HHL paper) such as $$\langle x\vert M\vert x \rangle$$&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; &#xA;Taking into account &lt;strong&gt;all&lt;/strong&gt; of these limitations and imagining we are in 2050 (or maybe in 2025, who knows?) with fault-tolerant large-scale quantum chips (i.e. we are not limited by the hardware), what real-world problems could HHL algorithm solve (including problems where HHL is only used as a subroutine)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of the paper &lt;a href=&quot;https://arxiv.org/abs/1505.06552&quot; rel=&quot;noreferrer&quot;&gt;Concrete resource analysis of the quantum linear system algorithm used to compute the electromagnetic scattering cross section of a 2D target (Scherer, Valiron, Mau, Alexander, van den Berg &amp;amp; Chapuran, 2016)&lt;/a&gt; and of the &lt;a href=&quot;https://www.mathstat.dal.ca/~selinger/quipper/doc/Algorithms-QLS-Main.html&quot; rel=&quot;noreferrer&quot;&gt;corresponding implementation&lt;/a&gt; in the &lt;a href=&quot;https://www.mathstat.dal.ca/~selinger/quipper/&quot; rel=&quot;noreferrer&quot;&gt;Quipper programming language&lt;/a&gt; and I am searching for other real-world examples where HHL would be applicable in practice. I do not require a published paper, not even an unpublished paper, I just want to have some examples of &lt;em&gt;real-world&lt;/em&gt; use-cases.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if I am interested in every use-case, I would prefer some examples where HHL is directly used, i.e. not used as a subroutine of an other algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am even more interested in examples of linear systems resulting of the discretisation of a differential operator that could be solved with HHL. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let me emphasise one more time &lt;strong&gt;I'm interested by every use-case (subroutines or not) you know about&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-07-13T13:38:46.667" LastActivityDate="2019-05-08T16:32:10.547" Title="What could be the possible future applications for HHL algorithm?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;applications&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2698" PostTypeId="1" CreationDate="2018-07-10T16:37:21.980" Score="5" ViewCount="159" Body="&lt;p&gt;In (&lt;a href=&quot;https://arxiv.org/abs/1307.0401&quot; rel=&quot;noreferrer&quot;&gt;Lloyd et al. 2013&lt;/a&gt;), the authors write (beginning of page 3) that the quantum matrix inversion techniques presented by some of the same authors in (&lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;Harrow et al. 2008&lt;/a&gt;) allow to efficiently implement $e^{-ig(\rho)}$ for any &lt;em&gt;simply computable&lt;/em&gt; function $g(x)$, using multiple copies of the density matrix $\rho$ &lt;em&gt;(see &lt;strong&gt;(1)&lt;/strong&gt; below for a bit more context)&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that (&lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;Harrow et al. 2008&lt;/a&gt;) presents a quantum algorithm to obtain a state $|x\rangle$ proportional to $A^{-1}|b\rangle$ for a given $A$ and $|b\rangle$, it doesn't seem obvious to me how this can be used to compute $e^{-ig(\rho)}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To which techniques exactly are the authors referring to? And how are they applied to get the stated result?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt; &#xA;More precisely, in the (&lt;a href=&quot;https://arxiv.org/abs/1307.0401&quot; rel=&quot;noreferrer&quot;&gt;Lloyd et al. 2013&lt;/a&gt;) paper, before making the statement that is the object of this question, the authors describe a method to construct $e^{-i\rho t}$, to accuracy $\epsilon$, using $n$ copies of $\rho$ with $n=O(t^2 \epsilon^{-1})$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, what is meant by &lt;em&gt;simply computable function&lt;/em&gt; does not seem to be explained in the paper.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-07-11T07:17:21.397" Title="Why does the quantum linear inversion algorithm allow to implement $e^{-ig(\rho)}$ efficiently using multiple copies of $\rho$?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2699" PostTypeId="2" ParentId="2553" CreationDate="2018-07-10T18:17:45.280" Score="0" Body="&lt;p&gt;Of course you can allocate qubits from C#! After all, Q# compiles to C#, so it's not possible for something to be doable &lt;em&gt;only&lt;/em&gt; from Q#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://tio.run/##tZLBTsMwDIbPzVNYYlK3Q5NtCIRgcBuI05jEDe2QpW4XrU3SxB0a0GcfbacBRyTEwVGc3/ZnR34Lm4OSBHfgvM29LHkVYDaL54v7@CDE8gweLAbQBmijA2Qai5QzZmSJwUmF8Py4YO8ssg69JG0NzA35/ZPVhoYjuIb2aOVobdN9f4nqoE0OQ4@5DoQebmFZrzW9TFfHyCgq9wv3pY9uureG9dYwFmW1UT2oD6u63NByjkVWJ2TDmkM7A0stGSQQ1pEotfI22IzExpYouKlzJNFOsZU5hm@ZV7U0VJc8xR0W1pVoiG81iTGf8snV@JJPLsbnifO40/gqyNoiiCqoznhaFJAkHjP0aFT7dYNhpk36rx0Ueg0fkHt0ELf8QTz6G1VJY83vWUmijavpxwYx1u3Uyc@5CodP&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's a small script I wrote that will show you the C# generated from a Q# file.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant bit is &lt;code&gt;Allocate.Apply&lt;/code&gt;, which allocates the qubits, and you can read the rest of the produced code to see where &lt;code&gt;Allocate&lt;/code&gt; comes from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that in mind, &lt;em&gt;should&lt;/em&gt; you be allocating qubits from C#? Well, no, probably not. It's annoyingly difficult, and it's best to leave the quantum stuff for a quantum language.&lt;/p&gt;&#xA;" OwnerUserId="70" LastEditorUserId="70" LastEditDate="2018-07-10T18:29:23.843" LastActivityDate="2018-07-10T18:29:23.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2701" PostTypeId="2" ParentId="2698" CreationDate="2018-07-11T07:12:04.267" Score="2" Body="&lt;p&gt;One way to go about this is using the Linear Combination of Unitaries (LCU) algorithm. The LCU algorithm simulates the action of any operator that can be written as a linear combination of simulatable unitary operators. A full treatment of this can be found in &lt;a href=&quot;https://uwspace.uwaterloo.ca/bitstream/handle/10012/8625/Kothari_Robin.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kothari's thesis&lt;/a&gt;. Using LCU algorithm, given the ability to apply $e^{i \rho t}$ to the state, the action of $f(\rho)$ on a state can be simulated. You do this by first writing $f(\rho)$ in Fourier space,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ f(\rho) =  \int^{+\infty}_{-\infty} dt~ \hat{f}(t) ~e^{i\rho t}.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can already see that this represents $f(\rho)$ as a sum of simulatable unitaries. But this is a continuous and infinite sum. For many functions this integral can be truncated and discretized to approximate $f(\rho)$ well. Kothari's thesis has some examples of such functions, including $A^{-1}$. See also &lt;a href=&quot;https://arxiv.org/pdf/1603.02940.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this work&lt;/a&gt;, that uses this technique to simulate the action of $e^{-\beta H}$ on a state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that this is the technique Llyod et.al has in their mind. But the LCU algorithm is a more recently developed technique that solves the problem. &lt;/p&gt;&#xA;" OwnerUserId="2663" LastEditorUserId="2663" LastEditDate="2018-07-11T07:17:21.397" LastActivityDate="2018-07-11T07:17:21.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2702" PostTypeId="2" ParentId="2690" CreationDate="2018-07-11T07:36:35.430" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is universal chrononic computing possible?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is no consensus that chronons even exist.&lt;br&gt;&#xA;See the first line of &lt;a href=&quot;https://en.wikipedia.org/wiki/Chronon&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However time (and space) is quantized in one of the most popular generalizations of quantum mechanics called &lt;a href=&quot;https://en.wikipedia.org/wiki/Loop_quantum_gravity&quot; rel=&quot;nofollow noreferrer&quot;&gt;loop quantum gravity&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;If&lt;/em&gt;&lt;/strong&gt; loop quantum gravity is an accurate description of the universe (which is not something we will be able to test for a very long time, until we can observe for example, Hawking radiation), then universal quantum computation with chronons would be possible as long as we can find a way to implement a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal set of gates&lt;/a&gt; such as {H,CNOT,R($\pi$/4)}. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is hard enough to implement a useful number of {H,CNOT,R($\pi$/4)} gates with ordinary quanta that we've been working with for a century (such as spin quanta or atomic energy level quanta or photon quanta), so don't be disappointed if you don't see universal chrononic quantum computers on the market during your lifetime. But it is possible, provided that quanta of time actually do exist, which would be true if loop quantum gravity were to be true.  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-07-14T18:21:27.927" LastActivityDate="2018-07-14T18:21:27.927" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="2703" PostTypeId="1" AcceptedAnswerId="2704" CreationDate="2018-07-11T08:12:01.023" Score="12" ViewCount="1272" Body="&lt;p&gt;The Pauli group for $n$-qubits is defined as $G_n=\{I,X,Y,Z \}^{\otimes n}$, that is as the group containing all the possible tensor products between $n$ Pauli matrices. It is clear that the Pauli matrices form a basis for the $2\times 2$ complex matrix vector spaces, that is $\mathbb{C}^{2\times 2}$. Apart from it, from the definition of the tensor product, it is known that the $n$-qubit Pauli group will form a basis for the tensor product space $(\mathbb{C}^{2\times 2})^{\otimes n}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering if the Pauli group in $n$-qubits forms a basis for the complex vector space where the elements of this tensor product space act, that is $\mathbb{C}^{2^n\times 2^n}$. Summarizing, the question would be, is $(\mathbb{C}^{2\times 2})^{\otimes n}=\mathbb{C}^{2^n\times 2^n}$ true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to prove it using arguments about the dimensions of both spaces, but I have not been able to get anything yet.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2018-07-11T08:18:49.273" LastActivityDate="2020-11-05T14:05:17.410" Title="Is the Pauli group for $n$-qubits a basis for $\mathbb{C}^{2^n\times 2^n}$?" Tags="&lt;error-correction&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2704" PostTypeId="2" ParentId="2703" CreationDate="2018-07-11T08:26:54.047" Score="8" Body="&lt;p&gt;Yes, the set of tensor products of all possible $n$ Pauli operators (including $I$)  forms an orthogonal basis for  the vector space of $2^n \times 2^n$ complex matrices. So see this first we notice that the space has a dimension of $4^n$  and we also have $4^n$ vectors ( the vectors are operators in this case). So we only need to show that they are linearly independent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can actually show something stronger. It can be easily seen that the members of the Pauli group are orthogonal under the Hilbert-Schmidt inner product. The H-S inner product of two matrices is defined as $Tr(AB^\dagger)$. We can easily verify from the definition that the Pauli group is a mutually orthogonal set under this inner product. We simply have to use the elementary property $Tr(C \otimes D) = Tr(C)Tr(D)$.    &lt;/p&gt;&#xA;" OwnerUserId="2663" LastActivityDate="2018-07-11T08:26:54.047" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2705" PostTypeId="2" ParentId="2692" CreationDate="2018-07-11T08:27:34.653" Score="1" Body="&lt;p&gt;Boolean variables can be represented by the matrix, $b=\frac{z+1}{2}$, where:&lt;br&gt;&#xA;$$&#xA;z=\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1 &#xA;\end{pmatrix}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the eigenvalues of $b$ are {0,1}, which is exactly what you want. This is explained on Pg. 1 of this &lt;a href=&quot;https://github.com/k-local-quadratization/review/blob/master/k-local-review.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;book on quantum mechanics and Boolean functions&lt;/a&gt; (see Eq. 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pg. 2 of the same book refers to this &lt;a href=&quot;https://arxiv.org/pdf/1508.04816.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; which explains the connection between Boolean variables and quantum operators in even more detail in Eqs 8-9. In the paper, Eq. 13 is an example of exactly the type of function you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for your example:&#xA;$x_1x_2+ x_3x_1x_4+x_5x_6$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have: $\frac{(z_1+1)(z_2+1)}{4} + \frac{(z_3+1)(z_1+1)(z_4+1)}{8} + \frac{(z_5+1)(z_6+1)}{4}$.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-11T08:27:34.653" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2706" PostTypeId="2" ParentId="2697" CreationDate="2018-07-11T09:15:25.463" Score="2" Body="&lt;p&gt;Rebentrost &lt;em&gt;et al.&lt;/em&gt; recently used the HHL09 algorithm in their &lt;a href=&quot;https://arxiv.org/abs/1710.03599&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Hopfield Neural Network (2018)&lt;/a&gt; paper, for optimization of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hopfield_network&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hopfield network's&lt;/a&gt; energy function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, if the Lagrangian (which is used to optimize the network energy &lt;span class=&quot;math-container&quot;&gt;$E = -\frac{1}{2}x^{T}Wx + \theta^Tx$&lt;/span&gt; given the constraint &lt;span class=&quot;math-container&quot;&gt;$Px - x^{\text{(inc)}} = 0$&lt;/span&gt;) is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{L} = -\frac{1}{2}x^{T}Wx + \theta^Tx - \lambda^T (Px - x^{\text{(inc)}}) + \frac{\gamma}{2}x^T x$$&lt;/span&gt; then the optimization equations &lt;span class=&quot;math-container&quot;&gt;$\frac{\partial \mathcal{L}}{\partial x} = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{\partial \mathcal{L}}{\partial \lambda} = 0$&lt;/span&gt; can be written in the form &lt;span class=&quot;math-container&quot;&gt;$A \mathbf{v} = \mathbf{w}$&lt;/span&gt;. Note that the &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; in the expression is the regularization parameter. We need to find &lt;span class=&quot;math-container&quot;&gt;$\mathbf{v}$&lt;/span&gt; which extremizes network energy subject to the constraint &lt;span class=&quot;math-container&quot;&gt;$Px = x^{(\text{inc})}$&lt;/span&gt; and thus, we need a matrix inversion technique. In the paper they've done exactly that and for the matrix inversion they utilized the HHL09 algorithm. See page 4 of the paper.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In short, I believe that once we have quantum computers with a sufficiently large number of qubits and decoherence time, the HHL algorithm is going to be one of the most useful subroutines for any quantum machine learning algorithm (since almost all machine learning and neural network algorithms involve some form of &quot;gradient descent&quot; or &quot;optimization&quot;).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-08T16:32:10.547" LastActivityDate="2019-05-08T16:32:10.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2707" PostTypeId="1" AcceptedAnswerId="2708" CreationDate="2018-07-11T11:04:36.873" Score="7" ViewCount="1686" Body="&lt;p&gt;I was reading the documentation for &lt;a href=&quot;https://qiskit.org/documentation/ja/_autodoc/qiskit.QuantumCircuit.html&quot; rel=&quot;noreferrer&quot;&gt;qiskit.QuantumCircuit&lt;/a&gt; and came across the functions &lt;code&gt;cu1(theta, ctl, tgt)&lt;/code&gt; and &lt;code&gt;cu3(theta, phi, lam, ctl, tgt)&lt;/code&gt;. Looking at the names they seem to be controlled rotations. &lt;code&gt;ctrl&lt;/code&gt; represents the controlled qubit and &lt;code&gt;tgt&lt;/code&gt; represents the target qubit. However, what are &lt;code&gt;theta&lt;/code&gt;, &lt;code&gt;lambda&lt;/code&gt; and &lt;code&gt;phi&lt;/code&gt;? They're rotations about which axes? Also, which rotation matrices are being used for &lt;code&gt;cu1&lt;/code&gt; and &lt;code&gt;cu3&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T13:26:55.640" LastActivityDate="2018-12-23T13:26:55.640" Title="What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2708" PostTypeId="2" ParentId="2707" CreationDate="2018-07-11T11:36:18.760" Score="9" Body="&lt;p&gt;From &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=002-The_Weird_and_Wonderful_World_of_the_Qubit~2F004-advanced_qubit_gates&quot; rel=&quot;noreferrer&quot;&gt;IBM Q Documentation&lt;/a&gt; (the link is hard to find) here is the definition of the generic gate:&#xA;$$&#xA;U(\theta, \phi, \lambda) = &#xA;\begin{pmatrix} &#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\&#xA;e^{i\phi} \sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right)&#xA;\end{pmatrix}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this gate, they define the following gates:&#xA;$$&#xA;\begin{split}&#xA;U_1(\lambda) &amp;amp;= U(0, 0, \lambda) = \begin{pmatrix}&#xA;1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\lambda}&#xA;\end{pmatrix} \\&#xA;U_2(\phi, \lambda) &amp;amp;= U\left(\frac{\pi}{2}, \psi, \lambda\right) = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; -e^{i\lambda} \\ e^{i\phi} &amp;amp; e^{i(\lambda+\phi)}&#xA;\end{pmatrix} \\&#xA;U_3(\theta, \phi, \lambda) &amp;amp;= U(\theta, \phi, \lambda) = \text{see above}&#xA;\end{split}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These gates are the basis (with &lt;code&gt;CX&lt;/code&gt;) of the IBM Q online backends (i.e. the real chips).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;cu1&lt;/code&gt; and &lt;code&gt;cu3&lt;/code&gt; are the controlled operations associated with the matrices above.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-07-11T11:36:18.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2709" PostTypeId="2" ParentId="2691" CreationDate="2018-07-11T12:41:00.260" Score="4" Body="&lt;p&gt;The only two quasi-particle quanta for which I know there to be active research in quantum computing are phonons and anyons.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Phonons:&lt;/strong&gt; That state-of-the-art is given my answer here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2588/phononic-quantum-computing/2608#2608&quot;&gt;Phononic Quantum Computing&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Anyons:&lt;/strong&gt; Synthesizing the first anyonic qubit is still an outstanding goal, but major milestones have been discussed &lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.6.031016&quot; rel=&quot;nofollow noreferrer&quot;&gt;very recently&lt;/a&gt;. This paper was the topic of an article with the very promising title &quot;&lt;a href=&quot;https://quantumfrontiers.com/2017/08/16/topological-qubits-arriving-in-2018/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Topological qubits arriving in 2018?&lt;/a&gt;&quot; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-07-14T18:24:17.217" LastActivityDate="2018-07-14T18:24:17.217" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2711" PostTypeId="1" CreationDate="2018-07-11T17:52:42.857" Score="5" ViewCount="458" Body="&lt;p&gt;I am wondering if there exists a common library or a set of modules for user-defining-quantum-gate for QISKit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it does, could you tell me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By referring to &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/community/question?questionId=5b3ba83d77993f003c6952dd&quot; rel=&quot;nofollow noreferrer&quot;&gt;Define Quantum Gates&lt;/a&gt; and &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/community/question?questionId=5ae975660f020500399ed22d&amp;amp;answerId=5ae975760f020500399ee66e&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to define user's quantum gates?&lt;/a&gt;, I have created 6 modules for IBM Q simulator such as CZ gate and CCZ gate (&lt;a href=&quot;https://github.com/bick-jp/ibmq/tree/master/grovers_algorithm/original_gate_test/original_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;uploaded here&lt;/a&gt;) since they were not built in &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/extensions/standard&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit standard gates&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, since the gates such as CZ gate and CCZ gate seems pretty common to use, I am wondering if anybody already opens their gates to the public.&lt;/p&gt;&#xA;" OwnerUserId="2100" LastEditorUserId="26" LastEditDate="2019-03-12T09:32:17.547" LastActivityDate="2019-03-12T09:32:17.547" Title="Is there a common set of modules for user-defining-quantum-gate for QISKit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2712" PostTypeId="1" AcceptedAnswerId="2721" CreationDate="2018-07-11T23:03:07.153" Score="5" ViewCount="184" Body="&lt;p&gt;Referring to Farhi, Gosset, Hassidim, Lutomirski, and Shor's &quot;Quantum Money from Knots,&quot; a &lt;em&gt;mint&lt;/em&gt; $\mathcal{M}$ generates a run of coins, including, say,  $(s,|\$\rangle)$, using a quantum computer to mint $|\$\rangle$ while publishing the public serial number $s$.  A &lt;em&gt;merchant&lt;/em&gt; $\mathcal{V}$  is able to verify that $|\$\rangle$ corresponds to $s$, and is a valid money state.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The merchant $\mathcal{V}$ is required to perform quantum operations on $|\$\rangle$ to make sure that $|\$\rangle$ corresponds to $s$ and is a valid money state.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But if the merchant $\mathcal{V}$ is capable of performing the verification, then would she not have all quantum capability to mint her own coin in the first place?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The barrier to entry to minting quantum coins does not seem that much different to verifying quantum coins. Thus, we have a situation wherein anyone with a quantum computer capable of verifying such quantum coins can mint their own coins.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, a question becomes, how would the market determine the value of a quantum coin, potentially from different merchants or minters?  Would the &quot;oldest&quot; quantum coin be valued more than newer coins?  Or would a coin with an interesting serial number $s$ be valued more?  Or the coin used in some famous transaction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would imagine a number of publicly available lists of serial numbers, one for each mint/verifier.  If I have a quantum computer, I would be motivated to mint my own coin and publish the serial number.  The market can decide that &quot;this coin from this mint is worth more than that coin from that mint,&quot; but how would the market decide? It seems interesting.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-12-10T00:06:26.760" LastActivityDate="2018-12-10T00:06:26.760" Title="Can a merchant who accepts a knot-based quantum coin mint her own knot-based coin?" Tags="&lt;cryptocurrency&gt;&lt;quantum-money&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2713" PostTypeId="2" ParentId="2711" CreationDate="2018-07-12T08:22:14.030" Score="1" Body="&lt;p&gt;For the moment, there is no publicly available repository of custom gates to my knowledge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want I have defined some for my own use. You can find the implementation &lt;a href=&quot;https://github.com/nelimee/quantum-tools/tree/master/gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &quot;gates&quot; implemented are more algorithms than gates.&lt;/li&gt;&#xA;&lt;li&gt;If you plan to re-use some of the gates, take a look at the license.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Be also aware of the fact that the gate hierarchy will probably change in a near future (see &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/316&quot; rel=&quot;nofollow noreferrer&quot;&gt;#316&lt;/a&gt;, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/476&quot; rel=&quot;nofollow noreferrer&quot;&gt;#476&lt;/a&gt;, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/591&quot; rel=&quot;nofollow noreferrer&quot;&gt;#591&lt;/a&gt;). Even if the changes should be backward compatible, we don't know how the &lt;code&gt;CompositeGate&lt;/code&gt; class will be changed at the moment.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-07-12T08:22:14.030" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2714" PostTypeId="1" AcceptedAnswerId="2715" CreationDate="2018-07-12T12:22:53.143" Score="7" ViewCount="108" Body="&lt;p&gt;Lets say we have a fully working quantum computer. I give it a problem to solve and measure how long it takes to solve it. I repeat the process. Would it take the exact same time to solve the same problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that a quantum computer's solution process could be seen as all the potential answers are already calculated but to get it out of an entangled state without changing the result, you would use Grover's algorithm that reduces the answer set. You then repeat Grover's algorithm to keep on reducing the answer set. Now you could repeat Grover's algorithm to get a single answer or just start up classical computing to test answers once the answer set is small enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This could possibly mean that the same problem could have a different answer set on first iteration of Grover's algorithm which could cascade on how many times it needs to run to get to a reasonably small answer set to test with classical computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I misunderstand something or is it reasonable that same problem could have varying calculation time on same hardware?&lt;/p&gt;&#xA;" OwnerUserId="3011" LastEditorUserId="3011" LastEditDate="2018-07-12T12:42:15.960" LastActivityDate="2018-07-13T07:43:20.910" Title="Does a fully working quantum computer solve a specific problem at varying speeds every time?" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2715" PostTypeId="2" ParentId="2714" CreationDate="2018-07-12T14:14:20.123" Score="5" Body="&lt;p&gt;It depends upon the algorithm that you're running as to whether it will always take the same length of time to run or not. Many of the well-known (often oracle-based) algorithms, such as Deutsch-Jozsa have fixed running times, i.e. they will always take the same time to run because it is exactly the same steps that have to be run every time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other algorithms (Simon's, Shor, HHL, Grover...) have some probability of failure, but a way of easily recognising a correct answer. So, if it fails, you just repeat. This means that there's a discrete set of running times, and an expected running time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I must emphasise that your understanding of how quantum algorithms work is not very accurate.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have read that a quantum computer's solution process could be seen as all the potential answers are already calculated but to get it out of an entangled state without changing the result, you would use Grover's algorithm that reduces the answer set.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Usually, you do not use Grover's algorithm, unless the specific thing you're doing is a quantum search (or a related &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2004/1837&quot;&gt;set of applications&lt;/a&gt;). Even Grover's is almost deterministic (if the number of solutions is known). As the size of the set you're searching over increases, the probability of failure tends to 0 so, to all intents and purposes, you run the algorithm exactly once and effectively have a deterministic running time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the first step of a quantum function can generally be thought of as calculating all possible answers in parallel, the secret sauce of quantum algorithms is very much the special tricks that can be leveraged to get a sensible answer out (for the very limited set of problems for which we know such tricks). But these depend extensively on the specific structure of the problem being solved. Grover's search is kind of the brute force option: if all you know about the problem structure is that you'll be able to recognise an answer when you get it, Grover's the one you want, but the point of quantum algorithms generally is to use further properties of the problem structure and get much greater speed-ups.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-13T07:43:20.910" LastActivityDate="2018-07-13T07:43:20.910" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2716" PostTypeId="1" AcceptedAnswerId="2720" CreationDate="2018-07-12T19:37:40.197" Score="6" ViewCount="862" Body="&lt;p&gt;For Shor's error correcting code, what is the intuition behind saying that the following circuit corrects the phase flip error? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize that the circuit is trying to compare phases of the three 3-qubit blocks, two at a time. But I don't understand how the Hadamards and CNOTs help in that task. It seems different from the general method followed for phase error correction with three qubits encoded in the Hadamard basis. It also seems to entangle the two ancillas at the end with the encoded 9 qubit code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CBT7u.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CBT7u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2018-07-12T20:03:17.120" LastActivityDate="2018-07-13T01:18:43.793" Title="Shor code: phase flip error" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2717" PostTypeId="1" AcceptedAnswerId="3917" CreationDate="2018-07-12T21:15:06.683" Score="7" ViewCount="588" Body="&lt;p&gt;In the &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/introduction.html&quot; rel=&quot;noreferrer&quot;&gt;introduction&lt;/a&gt; to continuous-variable quantum computing by Strawberry Fields (Xanadu), it lists the primary &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/introduction.html#cv-gates&quot; rel=&quot;noreferrer&quot;&gt;CV gates&lt;/a&gt; (rotation, displacement, squeezing, beamsplitter, cubic phase) along with their unitary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9FIam.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9FIam.png&quot; alt=&quot;cv gates w/ unitary&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are the matrix representations of these gates?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-08-01T22:27:52.640" Title="Matrix representation of continuous-variable gates" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;continuous-variable&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2718" PostTypeId="1" AcceptedAnswerId="2725" CreationDate="2018-07-12T21:32:29.900" Score="7" ViewCount="443" Body="&lt;h2&gt;Context:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;On the 5th page of the paper &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2012.668289&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum circuit design for solving linear systems of equations (Cao et al, 2012)&lt;/a&gt; there's this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RXIP6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RXIP6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9HAJ3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9HAJ3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vTUos.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vTUos.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Schematic:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A brief schematic of what's actually happening in the circuit is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rMzOI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rMzOI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Cao et al.'s circuit (in Figure 4) is specifically made for the matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$A = \frac{1}{4} \left(\begin{matrix} 15 &amp;amp; 9 &amp;amp; 5 &amp;amp; -3 \\ 9 &amp;amp; 15 &amp;amp; 3 &amp;amp; -5 \\ 5 &amp;amp; 3 &amp;amp; 15 &amp;amp; -9 \\ -3 &amp;amp; -5 &amp;amp; -9 &amp;amp; 15 \end{matrix}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whose eigenvalues are $\lambda_1 = 2^{1-1}=1,\lambda_2 = 2^{2-1}=2,\lambda_3 = 2^{3-1}=4$ and $\lambda_4 = 2^{4-1} = 8$ and corresponding eigenvectors are $|u_i\rangle = \frac{1}{2}\sum_{j=1}^{4}(-1)^{\delta_{ij}}|j\rangle^C$. In this case since there are $4$ qubits in the clock register, the $4$ eigenvalues can be represented as states of the clock register itself (no approximation involved) i.e. as $|0001\rangle$ (binary representation of $1$),  $|0010\rangle$ (binary representation of $2$), $|0100\rangle$ (binary representation of $4$) and $|1000\rangle$ (binary representation of $8$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the first Quantum phase estimation step, the circuit's (in Fig. 4) state is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|0\rangle_{\text{ancilla}} \otimes \sum_{j=1}^{j=4} \beta_j |\lambda_j\rangle |u_j\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything is fine till here. However, after this, to produce the state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{j=1}^{j=4} \beta_j |u_j\rangle_I |\lambda_j\rangle^C ((1-C^2/\lambda_j^2)^{1/2}|0\rangle + C/\lambda_j|1\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it seems necessary to get to the state $$\sum_{j=1}^{j=4} \beta_j |u_j\rangle_I |\frac{2^{3}}{\lambda_j}\rangle^C\otimes |0\rangle_{\text{ancilla}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, the following mappings seem necessary in the $R(\lambda^{-1})$ rotation step:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|0001\rangle \mapsto |1000\rangle, |0010\rangle \mapsto |0100\rangle, |0100\rangle \mapsto |0010\rangle \ \&amp;amp; \ |1000\rangle \mapsto |0001\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which implies that the middle two qubits in the clock register need to be swapped as well as the two end qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, in the circuit diagram they seem to be swapping the first and third qubit in the clock register! That doesn't seem reasonable to me. In the paper (Cao et al.) claim that the transformation they're doing using their SWAP gate is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\sum_{j=1}^{j=4} \beta_j |u_j\rangle_I |\lambda_j\rangle^C\otimes |0\rangle_{\text{ancilla}} \mapsto \sum_{j=1}^{j=4} \beta_j |u_j\rangle_I |\frac{2^{4}}{\lambda_j}\rangle^C\otimes |0\rangle_{\text{ancilla}}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to their &lt;em&gt;scheme&lt;/em&gt;, $|1000\rangle \to |0010\rangle$ (see the third page). This scheme doesn't make sense to me because the state $|0001\rangle$ (representing the eigenvalue $1$) would have to be transformed to $|2^4/1\rangle$. But the decimal representation of $16$ would be $|10000\rangle$ which is a 5-qubit state! However, our clock register has only $4$ qubits in total. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, basically I think that their SWAP gates are wrong. The SWAPs should actually have been applied between the middle qubits and the two end qubits. Could someone verify?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Supplementary question&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;This is not a compulsory part of the question. Answers addressing &lt;strong&gt;only&lt;/strong&gt; the previous question are also welcome. &lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1386/nelimee&quot;&gt;@Nelimee&lt;/a&gt; wrote a &lt;a href=&quot;https://github.com/nelimee/quantum-tools&quot; rel=&quot;nofollow noreferrer&quot;&gt;program&lt;/a&gt; (&lt;code&gt;4x4_system.py&lt;/code&gt; in &lt;code&gt;HHL&lt;/code&gt;) in QISKit to simulate the circuit (Figure 4) in Cao et al's paper. Strangely, his program works only if the SWAP gate is &lt;a href=&quot;https://github.com/nelimee/quantum-tools/blob/master/HHL/4x4_system.py#L149&quot; rel=&quot;nofollow noreferrer&quot;&gt;applied between the middle two qubits but not in between the two end qubits&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of his program is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;class 'numpy.ndarray'&amp;gt;&#xA;Exact solution: [-1  7 11 13]&#xA;Experimental solution: [-0.84245754+0.j  6.96035067+0.j 10.99804383+0.j 13.03406367+0.j]&#xA;Error in found solution: 0.16599956439346453&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That is, in his program only the mapping $|0100\rangle \mapsto |0010\rangle$ takes place in the clock register in the $R(\lambda^{-1})$ step. There's no mapping $|1000\rangle \mapsto |0001\rangle$ taking place. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just in case anyone figures out why this is happening please let me know in the comments (or in an answer). &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T16:34:49.327" LastActivityDate="2018-07-15T16:34:49.327" Title="SWAP gate(s) in the $R(\lambda^{-1})$ step of the HHL circuit for $4\times 4$ systems" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2719" PostTypeId="2" ParentId="2717" CreationDate="2018-07-13T00:11:05.580" Score="1" Body="&lt;p&gt;The link you gave says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The CV model is a natural fit for simulating bosonic systems (electromagnetic fields, harmonic oscillators, phonons, Bose-Einstein condensates, or optomechanical resonators) and for settings where continuous quantum operators – such as position &amp;amp; momentum – are present. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which means you can have many different different matrix representations for the CV gates. They then point out: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The most elementary CV system is the &lt;strong&gt;bosonic harmonic oscillator&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This means that for any values of the scalar (non-matrix) parameters $\alpha, \gamma, \phi, z, \theta, \gamma$, you can just calculate the formula they gave you, using the following matrix representations for the creation and annihilation operators for a &lt;strong&gt;bosonic harmonic oscillator&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QuFcg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QuFcg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number operator $\hat{n}$ is just $a^\dagger a$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that any matrix representation is basis-dependent, meaning that you can take these matrix representations and (for example) diagonalize them, and they would be a perfectly valid matrix representation in a new basis. However the matrices I gave you here are quite &quot;standard&quot; for quantum harmonic oscillators.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-16T01:13:58.667" LastActivityDate="2018-07-16T01:13:58.667" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="2720" PostTypeId="2" ParentId="2716" CreationDate="2018-07-13T01:18:43.793" Score="3" Body="&lt;p&gt;The circuit &lt;strong&gt;detects&lt;/strong&gt; an error, by producing a measurement outcome representing a syndrome that indicates which of three blocks of three qubits was affected by a phase error (or that indicates that no phase error occurred). Once you know this, you still have to correct the phase error if there was one, by applying a phase flip to any one of the three qubits in the affected block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The context here is that you've already corrected for a possible bit flip error, so that the input to the circuit is a state that resulted from at most one phase error being applied to a vector in the code space of Shor's 9 qubit code. Vectors in this code space look like&#xA;$$&#xA;\alpha |\phi_0\rangle |\phi_0\rangle |\phi_0\rangle +&#xA;\beta |\phi_1\rangle |\phi_1\rangle |\phi_1\rangle,&#xA;$$&#xA;where&#xA;$$&#xA;|\phi_0\rangle = \frac{|000\rangle + |111\rangle}{\sqrt{2}} \quad \text{and} \quad |\phi_1\rangle = \frac{|000\rangle - |111\rangle}{\sqrt{2}}.&#xA;$$&#xA;A phase error on the first block (i.e., qubit 1, 2, or 3), for instance, would result in the state&#xA;$$&#xA;\alpha |\phi_1\rangle |\phi_0\rangle |\phi_0\rangle +&#xA;\beta |\phi_0\rangle |\phi_1\rangle |\phi_1\rangle.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the reasoning behind the circuit is that applying Hadamard gates to each qubit of $|\phi_0\rangle$ gives a uniform superposition over even-parity strings, while applying Hadamard gates to each qubit of $|\phi_1\rangle$ gives a uniform superposition over odd-parity strings. Each set of three controlled-NOT gates will therefore induce a bit flip on one of the syndrome qubits when the three corresponding qubits are in the $|\phi_1\rangle$ state but not in the $|\phi_0\rangle$ state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in the example suggested above where a phase error touched qubit 1, 2, or 3, the first six controlled-NOT gates have the combined effect of flipping the second syndrome qubit, while the remaining controlled-NOT gates collectively do nothing. This results in the syndrome 01, which indicates a phase flip in block number 1 (i.e., the first three qubits). You can check that a phase error in a different block gives an appropriate outcome, and that if no phase errors occurred, the syndrome 00 is obtained, indicating no phase errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this does not entangle the syndrome qubits with the other qubits, so when you do all of the Hadamard gates again, you recover the original input state. Of course this assumes an input of the special form described above; if you put in an arbitrary state, you might very well end up with something entangled with the syndrome.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-07-13T01:18:43.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2721" PostTypeId="2" ParentId="2712" CreationDate="2018-07-13T01:46:51.180" Score="3" Body="&lt;p&gt;In complexity theory (quantum and classical) the distinction between construction and verification is very important, and the ability to verify certainly does not imply the ability to construct. For example, it is easy to verify that a satisfying assignment to a Boolean formula really is a satisfying assignment, but finding such an assignment given only the formula is a computationally hard problem (assuming $\text{P}\not=\text{NP}$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the situation with quantum money is a very different one, but there is a similar principle at work, and perhaps the Boolean formula example helps to invalidate any generic sort of intuition stating that having the capacity to verify something (in this case that a quantum money state corresponds to a particular serial number) automatically provides the capacity to construct the same thing (which in this case means constructing a money state with the given serial number).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of quantum money (of the sort that the paper you referred to considers), there are some important additional constraints. One is that it should actually &lt;strong&gt;not be difficult&lt;/strong&gt; for the mint to produce money. The key here is that the production of money will result in a random choice of $s$; neither the mint nor a would-be counterfeiter would be capable of first choosing $s$ and then creating the corresponding money state. The requirement is actually much stronger: even given one copy of the money state corresponding to serial number $s$, a counterfeiter should not be able to produce two or more states that are likely to pass independent verifications for that serial number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, anyone with a quantum computer would indeed be able to produce as much money as they want, but presumably nobody would care; people would only assign value to those money states whose serial numbers are authenticated in some way by the mint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addendum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning issues such as the market value of money states, over-minting, and so on, the only answer I can offer is that quantum money, as a concept in quantum information science, does not address these issues -- it simply provides a protocol whereby states can be efficiently produced and verified but not copied. Individuals and governments could choose to use a quantum money protocol as they choose, and in a situation in which this is done it is up to each participant to decide what value to assign to each state. In this regard, the issues do not seem to me to be specific to quantum money, but are shared by all forms of currency.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2018-07-13T11:41:38.217" LastActivityDate="2018-07-13T11:41:38.217" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2722" PostTypeId="1" AcceptedAnswerId="9279" CreationDate="2018-07-13T02:59:55.450" Score="8" ViewCount="304" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What level of trust in the bank is needed in &quot;Quantum Money from Hidden Subspaces&quot; of &lt;a href=&quot;https://arxiv.org/abs/1203.4740v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson and Christiano&lt;/a&gt;?  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The bank's mint works by first generating a uniformly random classical secret string $r$, and &lt;em&gt;then&lt;/em&gt; generating a banknote $\$_r=(S_r,\rho_r)$.  The authors state that the bank can generate many identical banknotes by simply reusing the secret $r$.  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;But after the currency is distributed, is $r$ needed, either by the bank or by the users, ever again?  If so, does the bank need to keep it safe and secure?  If not, should the bank &quot;forget&quot; or destroy the secret $r$ used in the mini-scheme, lest it fall into a forger's hand?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can the mint use $r$ to produce many coins with a specific serial number $S_r$, potentially targeting a specific holder of currency for devaluation?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can the users of the currency know how many coins are actively in circulation,  without having to trust the mint?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The authors of Hidden Subspaces note that in &quot;Quantum Money from Knots&quot; of &lt;a href=&quot;https://arxiv.org/abs/1004.5127&quot; rel=&quot;nofollow noreferrer&quot;&gt;Farhi, Gosset, Hassidim, Lutomirski, and Shor&lt;/a&gt;, &lt;em&gt;not even the mint&lt;/em&gt; is likely able to generate two identical banknotes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But I think that the inability of banks to copy their own currency is a&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;feature&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;not a&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;bug&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;of &quot;Quantum Money from Knots&quot;&lt;/strong&gt;, because the actions of the mint are public and known.  The total amount of currency is known; no secret $r$ is needed to be kept safe or destroyed; the mint can &quot;destroy&quot; a coin by removing it from the public list of serial numbers (Alexander polynomials,) but cannot target a coin for devaluation by minting many copies.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-10T14:47:50.073" LastActivityDate="2019-12-22T13:44:57.630" Title="Do we have to trust the bank in &quot;Quantum Money from Hidden Subspaces?&quot;" Tags="&lt;mathematics&gt;&lt;cryptography&gt;&lt;quantum-money&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2723" PostTypeId="2" ParentId="2712" CreationDate="2018-07-13T03:39:20.163" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How would the market determine the value of a quantum coin, potentially from different merchants or minters?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;tl;dr: by trading!&lt;/h2&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I am working on a startup that is addressing this problem&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I curated some thoughts on blockchain in an article entitled &lt;a href=&quot;https://medium.com/kloutcoin/tokenizing-global-otc-derivatives-8a0330dd29dc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tokenize Everything (&amp;amp; the Decentralized P2P Global Market)&lt;/a&gt; at the end of last year. A few relevant snippets include:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Decentralization&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The technological quantum leap here is not necessarily a new type of money. Rather, it is the ability to now achieve global consensus over a decentralized and distributed network without a trusted third party. This has many potential applications for various fields of endeavour.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A ‘decentralised funfair’ would actually be one where anyone can participate as a ‘fun provider’ (earning Funcoins for that service) and/or ‘fun beneficiary’ (giving out Funcoins to receive it), with the economics flowing directly between the two parties. The decentralised funfair would have no employees nor middlemen, only utilitarian participants; there would actually be no end to it, as long as the economic incentives on both sides remain attractive enough.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Liquidity&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Because such economies are decentralised, i.e. they have no central authority taking a toll, the most liquid tokens in any economy should in theory ultimately prevail and that would constitute the best outcome for its participants.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Imagine there are multiple funfairs where a fun provider or a fun beneficiary can participate: inevitably they would choose the one that provides the most attractive incentives (i.e. more fun, higher rewards). So ultimately there will only be one decentralised funfair left and its “fun token”, the most liquid one that delivers the most value to its participants&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Qlout&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The barrier to entry to minting quantum coins does not seem that much different to verifying quantum coins. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Precisely! Given a quantum computer (network), anyone could easily access it via 'the cloud' to mint &amp;amp;/or trade coins. Initially, only a few devices will be able to serve as nodes in the network. However, once advancements are made &amp;amp; quantum devices (QPUs) are commercially available, network size will increase accordingly (&amp;amp; allow for individuals to self host). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would the &quot;oldest&quot; quantum coin be valued more than newer coins? Or would a coin with an interesting serial number s be valued more? Or the coin used in some famous transaction?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;These are all really great ideas! Clearly (as is the case in all markets) individuals would assign value to different coins in different ways (utility, collectability, etc). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The concept of &lt;strong&gt;Qlout&lt;/strong&gt; is that each coin would be given a score based on an algorithm (secret sauce). This would only serve as a 'market score'; individuals would still be free to trade at any &lt;em&gt;agreeable&lt;/em&gt; rate.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-07-13T03:39:20.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2724" PostTypeId="1" AcceptedAnswerId="3833" CreationDate="2018-07-13T03:55:48.787" Score="7" ViewCount="407" Body="&lt;p&gt;I am new to Stack Exchange and am working on a quantum learning platform for minority youth groups (LGBTQ, low-income, at risk, etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the question below they are looking for courses on the subject, which I am also interested in, and do plan on checking those links out for ideas.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2151/introductory-material-for-quantum-machine-learning&quot;&gt;Introductory material for quantum machine learning&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What I am looking for are simple videos, articles, or even games, that cover basic quantum theory at an introductory level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some games I have looked into and played. &#xA;Hello Quantum! was fun and informative, though on my end there was still a lack of comprehension on how the quantum computer (or anything else &quot;quantum&quot;) would actually function and play out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My focus for the educational platform is more directed towards the software side of quantum computing. Is there anything &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1474/what-programming-languages-are-available-for-quantum-computers&quot;&gt;on software&lt;/a&gt; that gives a good introduction to the functions and uses a quantum computer will have? As well as what language would be best to program one? Also, would there be a way to program a quantum computer through a classical computer? And, is there a simple introduction to any of this already existing?&lt;/p&gt;&#xA;" OwnerUserId="3088" LastEditorUserId="26" LastEditDate="2019-12-03T16:08:23.537" LastActivityDate="2019-12-03T16:08:23.537" Title="What would be an informative introduction to quantum computing software?" Tags="&lt;resource-request&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2725" PostTypeId="2" ParentId="2718" CreationDate="2018-07-13T07:15:36.377" Score="3" Body="&lt;p&gt;I don't see the need for the swap gate either. Although I also don't think you need the set of swap gates that you're wanting. Remember that the standard implementation of the Fourier transform outputs the binary string $j\in\{0,1\}^4$ where the eigenvalues are of the form $2\pi j/16$ &lt;em&gt;but in reverse order&lt;/em&gt;, so the least significant bit is at the top, and the most significant bit is at the bottom. Thus, $|1000\rangle$ already corresponds to $j=1$, and so the rotation that you want is with an angle $8\pi/2^m$, and $|0100\rangle$ corresponds to $j=2$, requiring angle $4\pi/2^m$, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have to emphasise that what I see here is something of a fudge. It seems to be that the authors have very much built in the knowledge of the eigenvalues - not just that they're of the form $2\pi j/16$, but specifically that they are 1,2,4,8. It looks to me like, if one had a matrix that also contained a $j=4$ term, for example, that the inverse would not be correctly calculated because the angle of rotation actually created (LHS)&#xA;$$&#xA;\frac{8\pi}{2^m}+\frac{4\pi}{2^m}=\frac{12\pi}{2^m}\neq\frac{8\pi}{3\cdot 2^m}&#xA;$$&#xA;does not match the required angle for the inverse (RHS). Perhaps that was already clear to you, but it was not clear to me in trying to understand the circuit in order to answer your question!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of testing with QISKit, it's not something that I use myself. However, can I suggest trying a different $|b\rangle$ as input? It is &lt;em&gt;possible&lt;/em&gt; (perhaps not likely, however) that some of what's going on is masked slightly because the $|b\rangle$ chosen in the paper is an equally weighted superposition of the 4 eigenvectors. I'd want to chose something with different amplitudes for each eigenvector, just to be sure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-13T07:15:36.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2726" PostTypeId="2" ParentId="2724" CreationDate="2018-07-13T07:32:19.880" Score="9" Body="&lt;p&gt;Introductory Quantum Computation, which seems to be what you're asking for (rather than Quantum Theory more generically) is a bit of a tough ask. As you say, there are a few games around, such as &lt;a href=&quot;http://quantumgame.io/&quot; rel=&quot;noreferrer&quot;&gt;this one&lt;/a&gt;, but they don't really go far enough to explain quantum algorithms and the functioning of a quantum computer, because that really has to be backed up by quite a lot of maths and notation, which means that one is rapidly getting away from introductory material.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was actually trying to think at some point about how to make a good, accessible, video introduction to quantum computation, and have to admit to having stalled somewhat. What I did manage to produce was something reasonably introductory but about &lt;a href=&quot;https://vimeo.com/quantummechanic/qkdintro&quot; rel=&quot;noreferrer&quot;&gt;quantum cryptography&lt;/a&gt;, which I think is much more accessible than the computation side of things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You linked to a question about software. Things like QISKit have an &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=introduction&quot; rel=&quot;noreferrer&quot;&gt;extensive set of documentation&lt;/a&gt; that give a good introduction. The &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorial&quot; rel=&quot;noreferrer&quot;&gt;tutorials&lt;/a&gt; on github may also be of interest to you. Moreover, things like QISKit are precisely a way of programming a QC through a CC. You give a generic quantum circuit, and it is 'compiled' for a specific hardware implementation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-13T07:32:19.880" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="2727" PostTypeId="1" CreationDate="2018-07-13T08:04:52.623" Score="3" ViewCount="279" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The question whether surreal or hyperreal numbers (that both contain the reals, even if they have the same cardinality) could be useful to provide a more satisfactory theory of QM is maybe more interesting. -&lt;a href=&quot;https://physics.stackexchange.com/a/342021/198219&quot;&gt;yuggib&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I &lt;a href=&quot;https://mathoverflow.net/questions/300861/surreal-form-star-is-a-xor-cipher&quot;&gt;indirectly&lt;/a&gt; ended up on this stack, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2333/quantum-xnor-gate-construction&quot;&gt;much to my surprise&lt;/a&gt;. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2352/quantum-xor-linked-list-construction&quot;&gt;Little&lt;/a&gt; by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2466/expressing-square-root-of-swap-gate-in-terms-of-cnot&quot;&gt;little&lt;/a&gt; I have been working to piece the &lt;a href=&quot;https://math.stackexchange.com/questions/1199477/pseudo-surreal-numbers-are-analogous-to/2792351#2792351&quot;&gt;puzzle&lt;/a&gt; together. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been pondering this question for a while now, but was not able to formulate it so succinctly until I saw the above quote.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still don't feel able to properly convey my intuition around why this is a good approach..&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Abstract&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Star_(game_theory)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Star&lt;/a&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;is not zero, but neither positive nor negative, and is therefore said to be fuzzy and confused with (a fourth alternative that means neither &quot;less than&quot;, &quot;equal to&quot;, nor &quot;greater than&quot;) 0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Fuzzy_logic&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fuzzy logic&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;is a form of many-valued logic in which the truth values of variables may be any real number between 0 and 1. It is employed to handle the concept of partial truth, where the truth value may range between completely true and completely false. By contrast, in Boolean logic, the truth values of variables may only be the integer values 0 or 1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qubit&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;—usually taken to have the value “0” and “1”, like a bit. However, whereas the state of a bit can only be either 0 or 1, the general state of a qubit according to quantum mechanics can be a superposition of both.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Motivation&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;It is likely to be a fresh research question, and you the person one most interested in the entire world in finding an answer --- in which case it is most probably up to you (and your opportunity!) to obtain the answer first.&quot; -Niel&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While the motivation to wanting to make this work may not be apparent at first, a big piece of what I'm wanting to accomplish is creating a quantum algorithm based on surreal constructions for a quantum intelligence that can use game theory for computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have placed a &lt;a href=&quot;https://cstheory.stackexchange.com/questions/25943/implementation-of-surreal-numbers-for-games&quot;&gt;couple&lt;/a&gt; different &lt;a href=&quot;https://physics.stackexchange.com/questions/215532/renormalization-and-conway-surreal-numbers&quot;&gt;bounties&lt;/a&gt; in an attempt to push along this research.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How can surreal maths be used in quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-14T06:29:51.693" LastActivityDate="2018-12-14T06:29:51.693" Title="How can surreal maths be used in quantum computing?" Tags="&lt;mathematics&gt;" AnswerCount="1" CommentCount="21" FavoriteCount="2" ClosedDate="2018-07-16T18:38:29.690" ContentLicense="CC BY-SA 4.0" />
  <row Id="2728" PostTypeId="2" ParentId="1385" CreationDate="2018-07-13T08:53:19.913" Score="8" Body="&lt;p&gt;I find a graphical approach quite good for giving some insight without getting too technical. We need some inputs:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we can produce a state $|\psi\rangle$ with non-zero overlap with the 'marked' state $|x\rangle$: $\langle x|\psi\rangle\neq 0$.&lt;/li&gt;&#xA;&lt;li&gt;we can implement an operation $U_1=-(\mathbb{I}-2|\psi\rangle\langle\psi|)$&lt;/li&gt;&#xA;&lt;li&gt;we can implement an operation $U_2=\mathbb{I}-2|x\rangle\langle x|$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This last operation is the one that can mark our marked item with a -1 phase. We can also define a state $|\psi^\perp\rangle$ to be orthonormal to $|x\rangle$ such that the $\{|x\rangle,|\psi^\perp\rangle\}$ forms an orthonormal basis for the span of $\{|x\rangle,|\psi\rangle\}$. Both the operations that we have defined preserve this space: you start with some state in the span of $\{|x\rangle,|\psi^\perp\rangle\}$, and they return a state within the span. Moreover, both are unitary, so the length of the input vector is preserved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A vector of fixed length within a two-dimensional space can be visualised as the circumference of a circle. So, let's set up a circle with two orthogonal directions corresponding to $|\psi^\perp\rangle$ and $|x\rangle$.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/sGwD3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sGwD3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our initial state $|\psi\rangle$ will have small overlap with $|x\rangle$ and large overlap with $|\psi^\perp\rangle$. If it were the other way around, search would be easy: we'd just prepare $|\psi\rangle$, measure, and test the output using the marking unitary, repeating until we got the marked item. It wouldn't take long. Let's call the angle between $|\psi\rangle$ and $|\psi^\perp\rangle$ the angle $\theta$.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/u0OTk.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u0OTk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's take a moment to think about what our two unitary actions do. Both have a -1 eigenvalue, and all other eigenvalues +1. In our two-dimensional subspace, that reduces to a +1 eigenvalue and a -1 eigenvalue. Such an operation is a reflection in the axis defined by the +1 eigenvector. So, $U_1$ is a reflection in the $|\psi\rangle$ axis, while $U_2$ is a reflection in the $|\psi^\perp\rangle$ axis.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nE2ps.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nE2ps.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, take an arbitrary vector in this space, and apply $U_2$ followed by $U_1$. The net effect is that the vector is rotated by an angle $2\theta$ towards the $|x\rangle$ axis.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ofkHu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ofkHu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you start from $|\psi\rangle$, you can repeat this sufficiently many times, and get to within an angle $\theta$ of $|x\rangle$. Thus, when we measure that state, we get the value $x$ with high probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we need a little care to find the speed-up. Assume that the probability of finding $|x\rangle$ in $|\psi\rangle$ is $p\ll 1$. So, classically, we'd need $O(1/p)$ attempts to find it. In our quantum scenario, we have that $\sqrt{p}=\sin\theta\approx\theta$ (since $\theta$ is small), and we want a number of runs $r$ such that $\sin((2r+1)\theta)\approx 1$. So, $r\approx \frac{\pi}{2\theta}\approx \frac{\pi}{2\sqrt{p}}$. You can see the square-root speed-up right there.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-13T08:53:19.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2729" PostTypeId="1" AcceptedAnswerId="2732" CreationDate="2018-07-13T11:43:57.257" Score="16" ViewCount="3962" Body="&lt;p&gt;The most general definition of a quantum state I found is (rephrasing the definition from &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state#Pure_states&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum states are represented by a ray in a finite- or infinite-dimensional Hilbert space over the complex numbers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Moreover, we know that in order to have a useful representation we need to ensure that the vector representing the quantum state is a &lt;em&gt;unit vector&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the definition above, they don't precise the norm (or the scalar product) associated with the Hilbert space considered. At first glance I though that the norm was not really important, but I realised yesterday that the norm was &lt;em&gt;everywhere&lt;/em&gt; chosen to be the Euclidian norm (2-norm).&#xA;Even the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;noreferrer&quot;&gt;bra-ket&lt;/a&gt; notation seems to be made specifically for the euclidian norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; Why is the Euclidian norm used everywhere? Why not using an other norm? Does the Euclidian norm has useful properties that can be used in quantum mechanics that others don't?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="26" LastEditDate="2018-07-15T13:14:16.257" LastActivityDate="2018-07-15T13:14:16.257" Title="Quantum states are unit vectors... with respect to which norm?" Tags="&lt;quantum-state&gt;&lt;notation&gt;&lt;unitarity&gt;&lt;mathematics&gt;" AnswerCount="6" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="2730" PostTypeId="2" ParentId="2729" CreationDate="2018-07-13T12:07:49.743" Score="8" Body="&lt;p&gt;Some terminology seems a little bit jumbled here. Quantum states are represented (within a finite dimensional Hilbert space) by complex vectors of length 1, where length is measured by the Euclidean norm. They are not unitary, because unitary is a classification of a matrix, not a vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum states are changed/evolved according to some matrix. Given that quantum states have length 1, it turns out to be necessary and sufficient that the maps of pure states to pure states are described by unitary matrices. These are the only matrices that preserve the (Euclidean) norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is certainly a valid question &quot;could we use a different ($p$) norm  for our quantum states?&quot; If you then classify the operations that map normalised states to normalised states, they are incredibly limited. If $p\neq 2$, the only valid operations are permutation matrices (with different phases on each element). Physics would be a whole lot more boring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good way to get a feel for this is to try drawing a 2D set of axes. Draw on it the shapes corresponding to the set of points of length 1 under different $p$-norms. $p=2$ gives you the circle, $p=1$ gives you a diamond, and $p\rightarrow\infty$ gives a square. What operations can you do that map the shape onto itself? For the circle, it's any rotation. For anything else, it's just rotations by multiples of $\pi/2$. The following comes from Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SEEdJ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SEEdJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want more details, you might want to look &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0401062&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-13T14:42:14.350" LastActivityDate="2018-07-13T14:42:14.350" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="2731" PostTypeId="2" ParentId="2729" CreationDate="2018-07-13T12:20:29.400" Score="-1" Body="&lt;p&gt;The Euclidean norm on an $n$-dimensional space, as defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Norm_(mathematics)#Euclidean_norm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, is &lt;strong&gt;not&lt;/strong&gt; the only norm used for quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum state doesn't have to be defined on an n-dimensional Hilbert space, for example the quantum states for a 1D harmonic oscillator are functions $\psi_i(x)$ whose ortho-normality is defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int \psi_i(x)\psi_j^*(x)dx.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If $i=j$ we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\int |\psi(x)|^2dx = \int P(x)dx = 1,&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because the total probability must be 1.&lt;br&gt;&#xA;If $i\ne j$, we get 0, meaning that the functions are orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Euclidean norm, as defined in the link I gave, is more for quantum states on discrete variables where $n$ is some countable number. In the above case, $n$ (which is the number of possible values that $x$ can be) is uncountable, so the norm doesn't fit into the definition given for a Euclidean norm on an $n$-dimensional pace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could also apply a square root operator to the above norm, and still we'd have the required property that $\int P(x)dx=1$, and the Euclidean norm can then be thought of as a special case of this norm though, for the case where $x$ can only be chosen from some countable number of values. The reason why we use the above norm in quantum mechanics is because it guarantees that the probability function $P(x)$ integrates to 1, which is a mathematical law based on the &lt;em&gt;definition&lt;/em&gt; of probability. If you had some other norm which can guarantee that all laws of probability theory are satisfied, you would be able to use that norm too.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-13T12:54:13.593" LastActivityDate="2018-07-13T12:54:13.593" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="2732" PostTypeId="2" ParentId="2729" CreationDate="2018-07-13T13:10:14.310" Score="6" Body="&lt;p&gt;Born's rule states that $|\psi(x)|^2 = P(x)$ which is the probability of finding the quantum system in the state $|x\rangle$ after a measurement. We need the sum (or integral!) over all $x$ to be 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\sum_x P_x &amp;amp;= \sum_x |\psi_x|^2 = 1,\\&#xA;\int P(x)dx &amp;amp;= \int |\psi(x)|^2 dx= 1.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neither of these are valid norms because they are not &lt;a href=&quot;https://en.wikipedia.org/wiki/Norm_(mathematics)#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;homogenous&lt;/a&gt;.&#xA;You can make them homogenous simply by doing the square root:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\sqrt{\sum_x |\psi_x|^2} = 1,\\&#xA;\sqrt{\int |\psi(x)|^2dx} = 1.&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you may recognize this as the Euclidean norm and a generalization of the Euclidean norm to a non-discrete domain. We could also use a different norm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\sqrt{\sum_x \psi_x A \psi_x^*} = 1,\\&#xA;\sqrt{\int \psi(x)A\psi^*(x)} = 1,&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some positive definite matrix/function A.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;However&lt;/em&gt;&lt;/strong&gt; a $p$-norm with $p&amp;gt;2$ would not be as useful because for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;\sqrt[5]{\sum_x |\psi_x|^5} \\&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;does not have to be 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;In this way the Euclidean norm is special because 2 is the power in Born's rule, which is one of the postulates of quantum mechanics.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-14T07:38:36.727" LastActivityDate="2018-07-14T07:38:36.727" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="2733" PostTypeId="2" ParentId="2727" CreationDate="2018-07-13T14:39:47.357" Score="2" Body="&lt;p&gt;In quantum field theory there are Feynman path integrals that diverge and for this there is a concept of &quot;renormalization&quot;. At least &lt;a href=&quot;https://physics.stackexchange.com/questions/215532/renormalization-and-conway-surreal-numbers&quot;&gt;one approach to this uses surreal numbers&lt;/a&gt; but it is not very mainstream.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-13T14:50:04.847" LastActivityDate="2018-07-13T14:50:04.847" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="2734" PostTypeId="5" CreationDate="2018-07-13T15:56:40.077" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-13T15:56:40.077" LastActivityDate="2018-07-13T15:56:40.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2735" PostTypeId="4" CreationDate="2018-07-13T15:56:40.077" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-13T15:56:40.077" LastActivityDate="2018-07-13T15:56:40.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2736" PostTypeId="2" ParentId="2729" CreationDate="2018-07-13T17:01:46.920" Score="5" Body="&lt;p&gt;More mathematically, because $\mathbb{R}^n$ with an $L^p$ norm is a Hilbert space only for $p=2$.&lt;/p&gt;&#xA;" OwnerUserId="3097" LastActivityDate="2018-07-13T17:01:46.920" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="2737" PostTypeId="2" ParentId="2729" CreationDate="2018-07-13T18:53:51.197" Score="2" Body="&lt;p&gt;The other answers addressed why $p=2$ in terms of which $L^p$ space to use, but not the weighting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could put in a Hermitian positive definite matrix $M_{ij}$ so that that the inner product is $\sum x_i^* M_{ij} y_j$. But that doesn't gain you much. This is because you might as well change variables. For ease, consider the case when $M$ is diagonal. with the diagonal case that would be interpreting $M_{ii} \mid x_i \mid^2$ as a probability instead of $\mid x_i \mid^2$. $M_{ii}&amp;gt;0$ so why not just change variables to $\tilde{x}_i = \sqrt{M_{ii}} x_i$. You can think of this as $L^2$ functions on the space of $n$ points where each point is weighted by $M_{ii}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the continuous 1 variable case, yes you could use $L^2 (\mathbb{R} , w(x) dx)$ as well. $w(x)$ just reweights the lengths. That's still a perfectly good Hilbert space. But the problem is that translation $x \to x+a$ was supposed to be a symmetry and $w(x)$ breaks that. So might as well not use $w(x)$. For some purposes, that symmetry is not present, so you do have a $w(x) \neq 1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In some cases it is useful not to move to standard form. It shuffles around how you do some calculations. For example, if you're doing some numerics, then you can reduce your errors by this sort of reshuffling to avoid really small or large numbers that your machine finds difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A tricky thing is to make sure you keep track of when you changed your variables and when you didn't. You don't want to get confused between changing to the standard inner product doing some unitary and changing variables back vs trying to do that in one step. You are likely to drop factors of $\sqrt{M_{ii}}$ etc by mistake, so be careful.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-07-13T18:53:51.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2738" PostTypeId="2" ParentId="2667" CreationDate="2018-07-13T20:01:37.790" Score="7" Body="&lt;p&gt;Relatedly, there is also an &lt;a href=&quot;https://www.edx.org/course/quantum-cryptography-caltechx-delftx-qucryptox-0&quot; rel=&quot;noreferrer&quot;&gt;EdX course&lt;/a&gt; on quantum cryptography. The main instructors are Stephanie Wehner and Thomas Vidick, with guest lectures by Ronald Hanson, Nicolas Gisin and David Elkouss. Its description is the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How can you tell a secret when everyone is able to listen in? In this course, you will learn how to use quantum effects, such as quantum entanglement and uncertainty, to implement cryptographic tasks with levels of security that are impossible to achieve classically.&lt;/p&gt;&#xA;&lt;p&gt;This interdisciplinary course is an introduction to the exciting field of quantum cryptography, developed in collaboration between QuTech at Delft University of Technology and the California Institute of Technology. By the end of the course you will:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Be armed with a fundamental toolbox for understanding, designing and analyzing quantum protocols.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Understand quantum key distribution protocols.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Understand how untrusted quantum devices can be tested.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Be familiar with modern quantum cryptography – beyond quantum key distribution.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1825" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-07-13T23:31:04.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="2740" PostTypeId="1" CreationDate="2018-07-13T22:30:05.923" Score="10" ViewCount="156" Body="&lt;p&gt;For two-qubit states, represented by a &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; density matrix, the generic state is described by 15 real parameters. For ease of calculation, it can help to consider restricted families of states, such as the &quot;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;&quot;-states, where any matrix elements not on either the main diagonal or anti-diagonal are 0 (requiring 7 real parameters), or rebits, where the matrix elements are all real (requiring 9 real parameters).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any given density matrix of two qubits, it is easy to tell if it's entangled: we just test the partial transpose criterion, and the presence of negative eigenvalues. One might like to measure the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804024&quot; rel=&quot;nofollow noreferrer&quot;&gt;fraction of the space that is entangled&lt;/a&gt;, and for that, one must pick a particular measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability with respect to Hilbert-Schmidt measure that generic two-qubit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states are separable has been shown to be &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{5}$&lt;/span&gt; (&lt;a href=&quot;https://arxiv.org/abs/1408.3666v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1408.3666v2&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1501.02289v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1501.02289v2&lt;/a&gt;). Additionally, Lovas and Andai have demonstrated  that the corresponding probability for the two-rebit  density matrices is &lt;span class=&quot;math-container&quot;&gt;$\frac{29}{64}$&lt;/span&gt; (&lt;a href=&quot;https://arxiv.org/abs/1610.01410&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1610.01410&lt;/a&gt;).  Additionally, a strong body of various forms of evidence (though yet no formal proof) has been developed that the probabilities &#xA;for the arbitrary two-qubit  and (27-dimensional) two-``quater”[nionic]bit'' density matrices &#xA;are &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{26}{323}$&lt;/span&gt;, respectively (&lt;a href=&quot;https://arxiv.org/abs/1701.01973&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1701.01973&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, analogous results with respect to the important Bures (minimal monotone) measure are presently unknown.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now, in what manner, if any, might these known Hilbert-Schmidt results be employed to assist in the further estimation/determination of their Bures counterparts?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps useful in such an undertaking would be the procedures for the generation of random density matrices with respect to &#xA;Bures and Hilbert-Schmidt measure outlined in &lt;a href=&quot;https://arxiv.org/abs/0909.5094v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0909.5094v1&lt;/a&gt;. Further, Chapter 14 of &quot;Geometry of Quantum States&quot; of Bengtsson and Zyczkowski presents formulas for the two measures, among a wide literature of related analyses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems a particularly compelling conjecture that the two-qubit Bures separability probability assumes some yet unknown simple, elegant form (&lt;span class=&quot;math-container&quot;&gt;$\approx 0.073321$&lt;/span&gt;), as has been demonstrated do its counterparts, also based on fundamental quantum information-theoretic measures. A value of &lt;span class=&quot;math-container&quot;&gt;$\frac{11}{150} =\frac{11}{2 \cdots 3 \cdots 5^2}  \approx 0.07333...$&lt;/span&gt; is an interesting candidate in this matter.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="10480" LastEditDate="2021-04-29T20:49:02.407" LastActivityDate="2021-04-29T20:49:02.407" Title="Estimate/determine Bures separability probabilities making use of corresponding Hilbert-Schmidt probabilities" Tags="&lt;entanglement&gt;&lt;ppt-criterion&gt;&lt;metrics&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="2742" PostTypeId="2" ParentId="2729" CreationDate="2018-07-14T08:32:58.047" Score="4" Body="&lt;p&gt;An elegant argument can be derived by asking which theories can we build which are described by vectors $\vec v = (v_1,\dots,v_N)$, where the allowed transformations are linear maps $\vec v\to L\vec v$, probabilities are given by some norm, and probabilities must be preserved by those maps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that there are basically only three options: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deterministic theories.&lt;/strong&gt; Then we don't need those vectors, since we are always in one specific state, i.e. the vectors are $(0,1,0,0,0)$ and the like, and the $L$'s are only permutations.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Classical probabilistic theories.&lt;/strong&gt;  Here, we use the $1$-norm and stochastic maps. The $v_i$ are probabilities.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum mechanics.&lt;/strong&gt; Here, we use the $2$-norm and unitary transformations. The $v_i$ are amplitudes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These are the only possibilities. For other norms no interesting transformations exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a more detailed and nice explanation of this, Scott Aaronson's &quot;Quantum Computing since Democritus&quot; has &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a Lecture on this&lt;/a&gt;, as well as &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0401062&quot; rel=&quot;nofollow noreferrer&quot;&gt;a paper&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-07-14T09:04:00.450" LastActivityDate="2018-07-14T09:04:00.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3743" PostTypeId="1" CreationDate="2018-07-14T23:03:21.847" Score="5" ViewCount="393" Body="&lt;p&gt;Following &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2725/26&quot;&gt;@DaftWullie's answer&lt;/a&gt; I tried to simulate the circuit given in Fig. 4 of the paper (arXiv pre-print): &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum circuit design for solving linear systems of equations (Cao et al, 2012)&lt;/a&gt;, on &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The relevant circuit in the arXiv pre-print by Cao et al is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rj7HR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rj7HR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;Please note that (I think) the $e^{-iAt_0/2^s}$ (s.t. $1\leq s \leq 4$) gates in the circuit should actually be $e^{+iAt_0/2^s}$ gates instead. That's &lt;em&gt;probably&lt;/em&gt; a misprint in the paper.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You will find the equivalent Quirk simulated circuit &lt;a href=&quot;https://goo.gl/wu6jZW&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/strong&gt; The labellings of the gates (along with the matrix entries) can be seen from the dashboard by hovering over them. The matrix entries may also be obtained from the JSON code in the URL. You might want to use a &lt;a href=&quot;http://jsonviewer.stack.hu&quot; rel=&quot;nofollow noreferrer&quot;&gt;JSON formatter&lt;/a&gt; for that purpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rotation gates used in the paper are $R(8\pi/2^{r-1}),R(4\pi/2^{r-1}),R(2\pi/2^{r-1}),R(\pi/2^{r-1})$. On page 4 they mentioned that higher the value of $r$ they greater is the accuracy. So I took $r=7$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created the custom gates $R_y(8\pi/2^{r-1})$, $R_y(4\pi/2^{r-1})$, $R_y(2\pi/2^{r-1})$ &amp;amp; $R_y(\pi/2^{r-1})$, using the definition of the $R_y$ matrices as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$R_y(\theta) = \left(\begin{matrix}\cos(\theta/2) &amp;amp; \sin(\theta/2) \\ -\sin(\theta/2) &amp;amp; \cos(\theta/2) \end{matrix}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the output state of the &quot;input register&quot; should have been &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{-|00\rangle + 7|01\rangle + 11|10\rangle + 13|11\rangle}{\sqrt{340}}$$&#xA;i.e. $$-0.0542326|00\rangle + 0.379628|01\rangle + 0.596559|10\rangle + 0.705024|11\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm getting the output state of the input register as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$-(-0.05220|00\rangle+0.37913|01\rangle+0.59635|10\rangle+0.70562|11\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, there's a extraneous global phase of $-1$ in the final output. &lt;strong&gt;I'm not sure whether I have made a mistake in the implementation of the circuit OR whether the output of the circuit actually &lt;em&gt;supposed&lt;/em&gt; to be accompanied with the global phase.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3743/error-simulation-of-quantum-algorithm-for-linear-systems-of-equations-for-4#comment3726_3743&quot;&gt;@DaftWullie mentions&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If it's a global phase, what does it matter? Everything is always &quot;up&#xA;  to a global phase&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That sure is logical! However, I want to be sure that I'm not making any silly error in the implementation itself. I wonder that if there's actually &lt;em&gt;supposed&lt;/em&gt; to be a global phase of $-1$, why they didn't explicitly mention it in the paper? I find that a bit surprising. (Indeed, yes, I should perhaps directly contact the authors, but maybe someone here might be able to spot the silly mistake (on my part) quicker! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you have any questions about my simulation, please feel free to ask in the comments. I'll be happy to clarify. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T13:26:21.333" LastActivityDate="2018-12-23T13:26:21.333" Title="Error: Simulation of &quot;Quantum algorithm for linear systems of equations&quot; for $4\times 4$ systems on Quirk (without SWAP) - Global phase" Tags="&lt;circuit-construction&gt;&lt;simulation&gt;&lt;hhl-algorithm&gt;&lt;quirk&gt;" AnswerCount="0" CommentCount="12" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3745" PostTypeId="1" AcceptedAnswerId="3747" CreationDate="2018-07-15T06:15:47.523" Score="6" ViewCount="478" Body="&lt;p&gt;From what I have seen so far, there is a lot of linear algebra. Curious what other kinds of maths are used in QC &amp;amp; the specific fields in which they are most predominately invoked.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-14T06:29:38.603" LastActivityDate="2018-12-14T06:29:38.603" Title="What kind of mathematics is common in quantum computing?" Tags="&lt;mathematics&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="4" ClosedDate="2018-07-16T18:17:11.303" ContentLicense="CC BY-SA 4.0" />
  <row Id="3746" PostTypeId="1" CreationDate="2018-07-15T07:06:20.873" Score="6" ViewCount="179" Body="&lt;p&gt;For quantum error correction, the necessary and sufficient condition is given in standard texts as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\langle \phi| E^{\dagger}_{a} E_{b} |\psi \rangle = C_{ab} \langle \phi|\psi \rangle $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle$ and $|\phi\rangle$ are codewords. $E_{a}$ and $E_b$ are arbitrary errors that can occur.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My queries would be:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is $C_{ab}$ independent of the codewords and only dependant on the errors? Intuitively, I realize this is because otherwise, we gain some information about the codeword by detecting the error and run the risk of disturbing the superposition of the codeword. Is there a more formal mathematical explanation for the same?&lt;/li&gt;&#xA;&lt;li&gt;I realize that $C$ is a Hermitian matrix which can be diagonalized. What does it mean in terms of the codewords and the errors to diagonalize the matrix $C$?&lt;/li&gt;&#xA;&lt;li&gt;Why is it the case that the state $|\psi\rangle$ is always an eigenstate of $ E^{\dagger}_{a} E_{b}$ with $C_{ab}$ as an eigenvalue? It doesn't seem intuitive to me.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2018-07-15T09:22:49.413" LastActivityDate="2018-07-15T09:54:14.720" Title="Quantum error correction: necessary and sufficient condition" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3747" PostTypeId="2" ParentId="3745" CreationDate="2018-07-15T08:03:56.123" Score="7" Body="&lt;ul&gt;&#xA;&lt;li&gt;Calculus (e.g. $\int |\psi(x)|^2dx = 1$ ) &lt;/li&gt;&#xA;&lt;li&gt;Differential Equations (e.g. Schroedinger equation)&lt;/li&gt;&#xA;&lt;li&gt;Complex analysis&lt;/li&gt;&#xA;&lt;li&gt;Statistics/Probability theory&lt;/li&gt;&#xA;&lt;li&gt;Stochastics (especially in studying open quantum systems)&lt;/li&gt;&#xA;&lt;li&gt;Information theory &lt;/li&gt;&#xA;&lt;li&gt;Topology (e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;topological quantum computing&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Group theory (e.g. in stabilizer codes)&lt;/li&gt;&#xA;&lt;li&gt;Representation theory (e.g. in stabilizer codes)&lt;/li&gt;&#xA;&lt;li&gt;Graph theory (e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0509209&quot; rel=&quot;noreferrer&quot;&gt;graph state quantum computing&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Functional analysis (e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2729/quantum-states-are-unit-vectors-with-respect-to-which-norm&quot;&gt;Quantum states are unit vectors... with respect to which norm?&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Algebraic geometry (e.g. &lt;a href=&quot;https://www.nature.com/articles/srep43048&quot; rel=&quot;noreferrer&quot;&gt;for factoring numbers using quantum annealing&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Discrete optimization (e.g. &lt;a href=&quot;https://arxiv.org/abs/1411.6758&quot; rel=&quot;noreferrer&quot;&gt;for factoring numbers using quantum annealing&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1706.08061&quot; rel=&quot;noreferrer&quot;&gt;also&lt;/a&gt;.)&lt;/li&gt;&#xA;&lt;li&gt;Optimal control theory (here's a review on &lt;a href=&quot;https://arxiv.org/abs/0707.1883&quot; rel=&quot;noreferrer&quot;&gt;quantum optimal control theory&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Game theory (for quantum games)&lt;/li&gt;&#xA;&lt;li&gt;Boolean algebra (see this book on &lt;a href=&quot;https://github.com/k-local-quadratization/review/blob/master/k-local-review.pdf&quot; rel=&quot;noreferrer&quot;&gt;Boolean functions and quantum mechanics&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Coding theory (e.g. Quantum Error Correcting codes)&lt;/li&gt;&#xA;&lt;li&gt;Number theory (e.g. Shor's algorithm)&lt;/li&gt;&#xA;&lt;li&gt;Category theory (e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1988/what-is-the-use-of-categorical-quantum-mechanics&quot;&gt;What is the use of Categorical quantum mechanics?&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Differential geometry (for quantum information theorists working on quantum gravity)&lt;/li&gt;&#xA;&lt;li&gt;Formal Language Theory (in studying QC as a computation model)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Amazingly&lt;/strong&gt;, I've even seen &lt;a href=&quot;https://en.wikipedia.org/wiki/Fractional_calculus&quot; rel=&quot;noreferrer&quot;&gt;fractional calculus&lt;/a&gt; come up for sub-Ohmic baths (s=1/2 in &lt;a href=&quot;https://arxiv.org/pdf/1205.4651.pdf&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;)&#xA;&#xA;&lt;hr&gt;&lt;/li&gt;&#xA;&lt;li&gt;Basically any area of mathematics because we would like to make quantum algorithms to do things more efficiently, regardless of the mathematical field. For example &quot;semi-definite programming&quot; could be added to the list, because quantum algorithms for semi-definite programming is a very active current area of research. &#xA;&#xA;&lt;hr&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;sup&gt;A better question might be &quot;is there any area of mathematics for which you cannot see any possible connection to quantum computing?&quot;&lt;/sup&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-15T08:33:38.217" LastActivityDate="2018-07-15T08:33:38.217" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3748" PostTypeId="2" ParentId="3746" CreationDate="2018-07-15T09:54:14.720" Score="1" Body="&lt;p&gt;&lt;strong&gt;General Comment&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For errors to be correctable, they must not cause us to mistake one codeword for an orthogonal one. So if two codewords are orthogonal, and they are acted upon by correctable errors, the result will remain orthogonal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \langle \phi|\psi \rangle =0 \,\,\implies\,\, \langle \phi| E^{\dagger}_{a} E_{b} |\psi \rangle = 0 $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Answer to 1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By setting $|\phi \rangle = |\psi \rangle$, your condition gives us&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$C_{ab} = \langle \psi | E^{\dagger}_{a} E_{b} |\psi \rangle.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only case for which this would have no $ |\psi \rangle$ dependence is if $E^{\dagger}_{a} E_{b}=I$, which is clearly not an interesting case!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps your source assumes that a choice of an orthonormal basis for the codewords has been made, and then all else is basis dependent. Or perhaps I misunderstood the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Answer to 3&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if the errors are not unitary, the operator $E^{\dagger}_{a} E_{b}$ can be decomposed as a linear superposition of unitary operators. Since the condition in your question is linear, it therefore must be as true for non-unitary errors as for unitary errors.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-07-15T09:54:14.720" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3749" PostTypeId="5" CreationDate="2018-07-15T13:03:46.310" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:03:46.310" LastActivityDate="2018-07-15T13:03:46.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3750" PostTypeId="4" CreationDate="2018-07-15T13:03:46.310" Score="0" Body="For general questions about quantum theory (quantum mechanics and quantum field theories), as relevant to quantum computing and/or quantum information." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:03:46.310" LastActivityDate="2018-07-15T13:03:46.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3751" PostTypeId="5" CreationDate="2018-07-15T13:09:23.077" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:09:23.077" LastActivityDate="2018-07-15T13:09:23.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3752" PostTypeId="4" CreationDate="2018-07-15T13:09:23.077" Score="0" Body="Quantum foundations is the study of foundational questions related to Quantum mechanics and Quantum information theory. Some problems studied by researchers of quantum foundations are for instance the issue of the correct interpretation of quantum mechanics, the EPR paradox and the related area of quantum nonlocality and contextuality (Wikipedia). QUESTIONS RELATED TO INTERPRETATIONS OF QUANTUM THEORY SHOULD ALSO USE THIS TAG." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:09:23.077" LastActivityDate="2018-07-15T13:09:23.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3753" PostTypeId="5" CreationDate="2018-07-15T13:15:39.963" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:15:39.963" LastActivityDate="2018-07-15T13:15:39.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3754" PostTypeId="4" CreationDate="2018-07-15T13:15:39.963" Score="0" Body="Use this tag for questions about mathematics relevant to quantum computing and/or quantum information theory. DO NOT use this tag for general mathematics questions." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T14:33:04.593" LastActivityDate="2018-07-15T14:33:04.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3755" PostTypeId="5" CreationDate="2018-07-15T13:31:52.847" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:31:52.847" LastActivityDate="2018-07-15T13:31:52.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3756" PostTypeId="4" CreationDate="2018-07-15T13:31:52.847" Score="0" Body="For questions about matrix representations of quantum gates." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:31:52.847" LastActivityDate="2018-07-15T13:31:52.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3757" PostTypeId="5" CreationDate="2018-07-15T13:36:59.720" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:36:59.720" LastActivityDate="2018-07-15T13:36:59.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3758" PostTypeId="4" CreationDate="2018-07-15T13:36:59.720" Score="0" Body="Quantum communication is a generalization of quantum cryptography. It refers to protocols and techniques for transmission of an unknown quantum state (of a quantum system) from one place to another." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:36:59.720" LastActivityDate="2018-07-15T13:36:59.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3759" PostTypeId="5" CreationDate="2018-07-15T13:38:48.683" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:38:48.683" LastActivityDate="2018-07-15T13:38:48.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3760" PostTypeId="4" CreationDate="2018-07-15T13:38:48.683" Score="0" Body="A projection operator is one which when acts upon a quantum state (which is an element of a Hilbert space), &quot;projects&quot; it onto a subspace or onto another element of the same Hilbert space." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:44:25.753" LastActivityDate="2018-07-15T13:44:25.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3761" PostTypeId="5" CreationDate="2018-07-15T13:46:19.157" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:46:19.157" LastActivityDate="2018-07-15T13:46:19.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3762" PostTypeId="4" CreationDate="2018-07-15T13:46:19.157" Score="0" Body="Quirk is an open-source drag-and-drop quantum circuit simulator for exploring and understanding small quantum circuits. It was developed by Craig Gidney." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:46:19.157" LastActivityDate="2018-07-15T13:46:19.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3763" PostTypeId="5" CreationDate="2018-07-15T13:53:17.160" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-15T13:53:17.160" LastActivityDate="2018-07-15T13:53:17.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3764" PostTypeId="4" CreationDate="2018-07-15T13:53:17.160" Score="0" Body="For games or puzzles which utilize the principles of quantum mechanics. This includes (but is not limited to) non-local games, which are cooperative games of incomplete information, include strategies that make use of entanglement, outperforming all possible classical strategies. Non-local games were introduced by Cleve et.al in 2004. (arXiv:quant-ph/0404076)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-28T10:58:59.373" LastActivityDate="2019-01-28T10:58:59.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3765" PostTypeId="1" CreationDate="2018-07-15T19:51:49.450" Score="5" ViewCount="433" Body="&lt;p&gt;As a beginner, for exercise purpose, I’ve studied this two quantum circuits. They are equivalent, and for 2 qubits it’s easy to write the unitary transformation matrix.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/f9iYu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f9iYu.png&quot; alt=&quot;Cirquits and untary matrix&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking for another method I wrote what follows, but I’m not sure about notation and, particularly, the last passage.&#xA;So, I’m asking here if what I’ve written is admissible (maybe with some correction?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WRDBF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WRDBF.png&quot; alt=&quot;My solution&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other methods?&lt;/p&gt;&#xA;" OwnerUserId="2886" LastEditorUserId="124" LastEditDate="2018-07-15T22:33:34.147" LastActivityDate="2018-07-17T15:02:52.037" Title="Showing the equivalence of two simple {NOT, CNOT} circuits" Tags="&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3766" PostTypeId="2" ParentId="3765" CreationDate="2018-07-15T21:55:11.317" Score="2" Body="&lt;p&gt;You seem to have the basic idea. However, for a more formal way to approach the analysis, you might be interested in the following.$\def\ket#1{\lvert #1 \rangle}$&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The effect of the 'NOT' gate $X$ on standard basis states can be presented in terms of an explicit change to the bit value inside the Dirac notation, &lt;em&gt;e.g.&lt;/em&gt;:&#xA;$$ X \,\ket t = \ket{t \oplus 1}$$&#xA;where $a \oplus b$ is the parity (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;the sum modulo 2) of a pair of bits $a,b \in \{0,1\}$.&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the fact that $a \oplus b$ is the sum mod 2 of a pair of bits $a,b \in \{0,1\}$,we know that $\oplus$ is commutative and associative, so that in particular&#xA;$$ (a \oplus b) \oplus c = (a \oplus c) \oplus b.$$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Using this, we may then describe your left-hand circuit as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{align}&#xA;\ket{\psi_1} &amp;amp;= \ket{c} \otimes \ket{t} ;&#xA;\\[2ex]&#xA;\ket{\psi_2} &amp;amp;= X\ket{c} \otimes \ket{t}&#xA;\\&#xA;&amp;amp;= \ket{c {\,\oplus\;\!} 1} \otimes \ket{t} ;&#xA;\\[2ex]&#xA;\ket{\psi_3} &amp;amp;= \ket{c {\,\oplus\;\!} 1} \otimes \ket{(c {\,\oplus\;\!} 1) {\,\oplus\;\!} t}&#xA;\\&#xA;&amp;amp;= \ket{c {\,\oplus\;\!} 1} \otimes \ket{(c {\,\oplus\;\!} t) {\,\oplus\;\!} 1}&#xA;\\&#xA;&amp;amp;= X\ket{c} \otimes X\ket{c {\,\oplus\;\!} t} .&#xA;\end{align}$$&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-07-15T22:31:55.257" LastActivityDate="2018-07-15T22:31:55.257" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3767" PostTypeId="1" AcceptedAnswerId="3785" CreationDate="2018-07-16T00:39:56.460" Score="13" ViewCount="552" Body="&lt;p&gt;So far I have read a little bit about zx-calculus &amp;amp; &lt;a href=&quot;https://arxiv.org/abs/1702.00934&quot; rel=&quot;nofollow noreferrer&quot;&gt;y-calculus&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-642-36315-3_1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reversible Computation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The zx-calculus is a graphical language for describing quantum systems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The zx-calculus is an equational theory, based on rewriting the diagrams&#xA;which comprise its syntax. Re-writing can be automated by means of the &lt;a href=&quot;https://quantomatic.github.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantomatic&lt;/a&gt; software.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This method seems very interesting, however I am not able to find much introductory information on the subject. Any &lt;strong&gt;insight into the subject or additional resources&lt;/strong&gt; would be greatly appreciated.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Current Resources:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2012.13966&quot; rel=&quot;nofollow noreferrer&quot;&gt;ZX-calculus for the working quantum computer scientist&#xA;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1705.11151&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Complete Axiomatisation of the ZX-Calculus for Clifford+T Quantum Mechanics&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1804.05356&quot; rel=&quot;nofollow noreferrer&quot;&gt;ZX-Rules for 2-qubit Clifford+T Quantum Circuits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1702.00934&quot; rel=&quot;nofollow noreferrer&quot;&gt;Y-Calculus: A Language for Real Matrices Derived from the ZX-Calculus&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://link.springer.com/chapter/10.1007%2F978-3-642-36315-3_1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tutorial: Graphical Calculus for Quantum Circuits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1805.02175&quot; rel=&quot;nofollow noreferrer&quot;&gt;ZH: A Complete Graphical Calculus for Quantum Computations Involving Classical Non-linearity&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1111.6950&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tensor networks and graphical calculus for open quantum system&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantomatic.github.io/papers.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Papers from Quantomatic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.mscs.dal.ca/%7Eselinger/papers/graphical.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A survery of graphical languages for monoidal categories&lt;/a&gt; (PDF)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="9947" LastEditDate="2021-04-12T14:36:58.533" LastActivityDate="2021-04-12T14:36:58.533" Title="Graphical Calculus for Quantum Circuits" Tags="&lt;mathematics&gt;&lt;resource-request&gt;&lt;zx-calculus&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3768" PostTypeId="2" ParentId="3767" CreationDate="2018-07-16T01:41:35.290" Score="4" Body="&lt;p&gt;You already put Selinger's survey, so here are a couple more links.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0903.0340&quot; rel=&quot;nofollow noreferrer&quot;&gt;Baez and Stay&lt;/a&gt;: Baez and Stay is a survey article. It covers monoidal, braided, symmetric and dagger categories. For the example related to quantum computation focus on either Hilb or cobordism. The appropriate string diagrams for these are included along with the sections for those types of categories. It points the connections between logic and type theory as well, but you don't need those sections. However, it would be helpful. You could see Baez's other blog posts as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://qchu.wordpress.com/2012/11/05/introduction-to-string-diagrams/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiaochu Yuan's blog&lt;/a&gt;: Qiaochu's blog post is more introductory and brief. It focuses solely on the vector space example as to avoid prerequisites besides linear algebra. The later posts in that series cover other adjectives to add on such as braided, symmetric or dagger. See later in that series as well.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-05-20T20:03:15.343" LastActivityDate="2019-05-20T20:03:15.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3769" PostTypeId="2" ParentId="3765" CreationDate="2018-07-16T04:39:17.180" Score="0" Body="&lt;p&gt;You can also use the definition of XOR in the following way:&#xA;$c\oplus t = c'.t + c.t'$ (where the primes mean not)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\implies (c\oplus t)' = (c'.t + c.t')'$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using De Morgan's rule,&#xA;$(c'.t + c.t')' = (c+t').(c'+t) = c't'+ct$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which can be seen as being the same as $c'\oplus t$&lt;/p&gt;&#xA;" OwnerUserId="4107" LastEditorUserId="26" LastEditDate="2018-07-17T15:02:52.037" LastActivityDate="2018-07-17T15:02:52.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3770" PostTypeId="1" AcceptedAnswerId="3775" CreationDate="2018-07-16T04:55:38.013" Score="21" ViewCount="1993" Body="&lt;p&gt;I was searching for examples of quantum circuits to exercise with Q# programming and I stumbled on this circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eBhlJ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eBhlJ.png&quot; alt=&quot;Toffoli Gate as FANOUT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt; &lt;strong&gt;From&lt;/strong&gt;: &lt;a href=&quot;https://warwick.ac.uk/fac/sci/physics/research/cfsa/people/pastmembers/charemzam/pastprojects/mcharemza_quant_circ.pdf&quot; rel=&quot;noreferrer&quot;&gt;Examples of Quantum Circuit Diagrams&#xA;- Michal Charemza&lt;/a&gt; &lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During my introductory courses in quantum computation, we were taught that the cloning of a state is forbidden by the laws of QM, while in this case the first contol qubit is copied on the third, target, qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I quickly tried to simulate the circuit on Quirk, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22X%22],[%22X%5Et%22],[%22Density%22,%22X%22,%22Density%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22Density%22,%22Density%22,%22Density%22]]%7D&quot; rel=&quot;noreferrer&quot;&gt;something like this&lt;/a&gt;, that sort of confirms the cloning of the state in output on the first qubit. Measuring the qubit before the Toffoli gate shows that is in fact no real cloning, but instead a change on the first control qubit, and an equal output on the first and third qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By making simple math, it can be shown that the &quot;cloning&quot; happens only if the third qubit is in initial state 0, and that only if on the first qubit is not performed a &quot;spinning operation&quot; (as indicated on Quirk) on Y or X.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried writing a program in Q# that only confirmed which is aforesaid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I struggle in understanding how the first qubit is changed by this operation, and how something similar to a cloning is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="2601" LastEditorUserId="26" LastEditDate="2019-03-12T09:43:35.550" LastActivityDate="2021-04-16T22:02:16.783" Title="Toffoli gate as FANOUT" Tags="&lt;quantum-gate&gt;&lt;quirk&gt;&lt;cloning&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3771" PostTypeId="1" AcceptedAnswerId="3780" CreationDate="2018-07-16T05:23:44.857" Score="3" ViewCount="118" Body="&lt;p&gt;In &lt;a href=&quot;http://decodoku.blogspot.com/2016/07/quantum-computation-with-simplest-maths.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computation with the simplest maths possible&lt;/a&gt; there is a section titled &quot;&lt;strong&gt;Doing maths with a controlled-half NOT&lt;/strong&gt;&quot; which covers a reversible-(N)AND circuit with controlled-half NOTs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6IFRG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6IFRG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;What would the unitary matrix for a controlled-half NOT be?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How could a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2333/quantum-XNOR-gate-construction&quot;&gt;reversible-XNOR&lt;/a&gt; gate be constructed with controlled-half NOTs? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How would a half-adders, full adders &amp;amp; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2346/quantum-ripple-carry-adder-construction&quot;&gt;ripple carry adders&lt;/a&gt; be constructed from controlled-half NOTs?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-23T13:24:27.153" LastActivityDate="2018-12-23T13:24:27.153" Title="Doing maths with controlled-half NOTs" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3772" PostTypeId="1" AcceptedAnswerId="3781" CreationDate="2018-07-16T05:40:10.547" Score="6" ViewCount="185" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;A topological quantum computer is a theoretical quantum computer that employs two-dimensional quasiparticles called anyons. -&lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Are there other instances of topological quantum computing models that do not use anyons?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there alternative forms of anyons besides Fibonacci anyons?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-07-16T15:38:42.670" LastActivityDate="2018-07-16T15:38:42.670" Title="Anyon alternatives in topological quantum computing" Tags="&lt;models&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3773" PostTypeId="1" AcceptedAnswerId="4620" CreationDate="2018-07-16T06:00:49.633" Score="8" ViewCount="214" Body="&lt;p&gt;Does something like &lt;a href=&quot;http://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;Quirk&lt;/a&gt; exist for topological (eg. &lt;em&gt;braided&lt;/em&gt;) circuits? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, any ideas on how @&lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/119/craig-gidney&quot;&gt;CraigGidney&lt;/a&gt; is getting &lt;a href=&quot;http://algassert.com/post/1804&quot; rel=&quot;noreferrer&quot;&gt;these circuits&lt;/a&gt; (or something similar)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/81SAl.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/81SAl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-07-16T15:02:59.067" LastActivityDate="2018-11-05T00:20:12.657" Title="Topological Circuit Simulator" Tags="&lt;circuit-construction&gt;&lt;topological-quantum-computing&gt;&lt;quirk&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3774" PostTypeId="2" ParentId="3770" CreationDate="2018-07-16T06:05:38.670" Score="7" Body="&lt;p&gt;The answer is that the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no-cloning theorem&lt;/a&gt; states that you cannot clone an &lt;em&gt;&lt;strong&gt;arbitrary unknown state&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This circuit does not violate the no-cloning theorem, because let's look at what it does when the input is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;. The output at the third register still has to be a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore it's impossible for this circuit to clone an &lt;em&gt;&lt;strong&gt;arbitrary&lt;/strong&gt;&lt;/em&gt; state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, and one example of a state that it cannot clone is: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-04-16T22:02:16.783" LastActivityDate="2021-04-16T22:02:16.783" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3775" PostTypeId="2" ParentId="3770" CreationDate="2018-07-16T06:07:32.493" Score="15" Body="&lt;p&gt;To simplify the question consider CNOT gate instead of Toffoli gate; CNOT is also fanout because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;|0\rangle|0\rangle \rightarrow |0\rangle|0\rangle\\&#xA;|1\rangle|0\rangle \rightarrow |1\rangle|1\rangle&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it looks like cloning for any basis state $x\in\{0,1\}$&#xA;\begin{align}&#xA;|x\rangle|0\rangle \rightarrow |x\rangle|x\rangle&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but if you take a superposition $|\psi\rangle=\alpha|0\rangle + \beta|1\rangle$ then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;(\alpha|0\rangle+\beta|1\rangle)|0\rangle \rightarrow \alpha|0\rangle|0\rangle+ \beta|1\rangle|1\rangle&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so generally&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;|\psi\rangle|0\rangle\not\rightarrow|\psi\rangle|\psi\rangle&#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and fanout is not cloning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the question of how the first qubit is changed - it is now &lt;em&gt;entangled&lt;/em&gt; with the second qubit.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="26" LastEditDate="2018-07-17T15:01:10.090" LastActivityDate="2018-07-17T15:01:10.090" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3776" PostTypeId="2" ParentId="3772" CreationDate="2018-07-16T06:15:52.547" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there other instances of topological QC that do not use anyons?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The use of anyons is part of the definition of topological QC. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there alternative forms of anyons besides Fibonacci anyons?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are Fibonacci anyons and Ising anyons. An excellent reference is &lt;a href=&quot;https://arxiv.org/pdf/0810.1955.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Non-Abelian anyons: when Ising meets Fibonacci&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-16T06:15:52.547" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3777" PostTypeId="5" CreationDate="2018-07-16T06:26:22.250" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-16T06:26:22.250" LastActivityDate="2018-07-16T06:26:22.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3778" PostTypeId="4" CreationDate="2018-07-16T06:26:22.250" Score="0" Body="For questions about quantum networks. Quantum networks allow for the transmission of quantum information (qubits), between physically separated quantum processors. (Wikipedia)" OwnerUserId="-1" LastEditorUserId="26" LastEditDate="2018-10-22T08:38:27.133" LastActivityDate="2018-10-22T08:38:27.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3779" PostTypeId="2" ParentId="3765" CreationDate="2018-07-16T08:01:35.910" Score="1" Body="&lt;p&gt;The way that I like to do the maths is by using linearity to break things down, and be a bit more explicit. We don't have to keep general functional forms so long as we consider the action of the circuits on a basis of states. When one is using it with regards to a controlled-not, the most natural basis to use is to ensure you have the computational basis on the control qubit. For example, I can track what happens on the first circuit if I input either $|0\rangle$ or $|1\rangle$ on the first qubit.&#xA;$$&#xA;|0\rangle|t\rangle\rightarrow |1\rangle|t\rangle\rightarrow|1\rangle(X|t\rangle)\qquad |1\rangle|t\rangle\rightarrow |0\rangle|t\rangle\rightarrow|0\rangle|t\rangle&#xA;$$&#xA;Meanwhile, for the second circuit,&#xA;$$&#xA;|0\rangle|t\rangle\rightarrow |0\rangle|t\rangle\rightarrow|1\rangle(X|t\rangle)\qquad |1\rangle|t\rangle\rightarrow |1\rangle(X|t\rangle)\rightarrow|0\rangle|t\rangle&#xA;$$&#xA;Both circuits give the same outputs for a complete basis of states, so they must be the same unitaries.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-16T10:08:22.453" LastActivityDate="2018-07-16T10:08:22.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3780" PostTypeId="2" ParentId="3771" CreationDate="2018-07-16T08:17:25.230" Score="4" Body="&lt;p&gt;This is the gate that I would call controlled-square-root-of-not. Bit more of a mouthful, I know, but perhaps conveys more accurately what it's doing. The point is that it's a unitary $U$ such that $U^2$ is the controlled-not. There are probably a few ways of writing down such a thing, but, for example&#xA;$$&#xA;U=\left(\begin{array}{cccc} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; \frac{e^{i\pi/4}}{\sqrt{2}} &amp;amp; \frac{e^{-i\pi/4}}{\sqrt{2}} \\ 0 &amp;amp; 0 &amp;amp; \frac{e^{-i\pi/4}}{\sqrt{2}} &amp;amp; \frac{e^{i\pi/4}}{\sqrt{2}}&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a trivial answer to your other questions. Take the normal circuits for each of these things built out of (n)and gates, and substitute the reversible (n)and circuits in their place. Of course, there may be optimisations to improve things slightly...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-07-17T15:00:24.890" LastActivityDate="2018-07-17T15:00:24.890" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="3781" PostTypeId="2" ParentId="3772" CreationDate="2018-07-16T08:43:01.127" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there other instances of topological QC that do not use anyons?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, that's basically by definition. That said, there are different ways that one could use topological systems in order to achieve quantum computation. In the version you're talking about, you use these anyon pairs to define qubits, and braid them around each other to create quantum gates. Another option is more related to quantum memories: topological systems have a degenerate ground state that can be used to encode a qubit. But that qubit should be very robust against noise because it takes many many single-qubit errors (spanning the bulk of the system) to be misinterpreted as a logical operation. If you have many of these, you could use them as qubits in a quantum computer, but the challenge is actually getting them to do gates.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there alternative forms of anyons besides Fibonacci anyons?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's a huge variety, it's just that Fibonacci anyons are a universal non-Abelian type of anyon that's comparatively easy to explain, but one does not have to be restricted to them if you can prove the right properties in some other system. The other type that are commonly discussed are Ising anyons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, every quantum system with localisable excitations has anyons, but their properties vary wildly. For example, if you look at Kitaev's Toric code, there are two types of anyon present. The particle-anti-particle pairs are basically joined together either by a string of $X$ operators, or a string of $Z$ operators. You move them around by applying $X$s or $Z$s as appropriate. When you braid them past each other, there's a single site where an $X$ and a $Z$ coincide. Since these two operators anti-commute, that corresponds to acquiring a -1 phase. Thus, the braiding effectively implements a logical $Z$. But that's all it implements; it can't change the type of excitation that the system is in (hence, we say it has Abelian anyons). That makes the computations you can do with them extremely limited. Even if you can find non-Abelian anyons, they may be of a limited form which is not universal for quantum computation (you might get an equivalent of the Clifford gates, for example).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-16T08:43:01.127" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3782" PostTypeId="1" AcceptedAnswerId="3784" CreationDate="2018-07-16T16:17:48.657" Score="10" ViewCount="2437" Body="&lt;p&gt;I was trying to generate Greenberger-Horne-Zeilinger (GHZ) state for $N$ states using quantum computing, starting with $|000...000\rangle$ (N times) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proposed solution is to first apply Hadamard Transformation on the first qubit, and then start a loop of CNOT gates with the first qubit of all the others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to understand how I can perform CNOT($q_1,q_2$) if $q_1$ is a part of an entangled pair, like the Bell state $B_0$ which forms here after the Hadamard transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to write the code for it, but algebraically why is this method correct and how is it done? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="2951" LastEditorUserId="26" LastEditDate="2018-07-16T17:06:44.007" LastActivityDate="2018-07-16T19:13:35.597" Title="CNOT Gate on Entangled Qubits" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3783" PostTypeId="2" ParentId="3782" CreationDate="2018-07-16T17:17:19.740" Score="7" Body="&lt;p&gt;$$&#xA;\psi_1 = |0 0 0 \rangle\\&#xA;\psi_2 = (H \otimes I \otimes I) \psi_1 = \frac{1}{\sqrt{2}} (|0 \rangle + |1 \rangle) \otimes |0 0 \rangle\\&#xA;= \frac{1}{\sqrt{2}} ( |0 0 0 \rangle + |1 0 0 \rangle)\\&#xA;\psi_3 = (\operatorname{CNOT}_{12} \otimes I) \psi_2 = \frac{1}{\sqrt{2}} (|0 0 0 \rangle + |1 1 0 \rangle)\\&#xA;\psi_4 = (\operatorname{CNOT}_{13} \otimes I_{2}) \psi_3 = \frac{1}{\sqrt{2}} (|0 0 0 \rangle + |1 1 1 \rangle)\\&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\operatorname{CNOT}_{ij}$ is itself an operator on $2$ qubits giving a $4\times 4$ unitary matrix. You can apply it to any state in $\mathbb{C}^2 \otimes \mathbb{C}^2$ not just those of the form $q_i \otimes q_j$. Just write the coefficients in the computational basis where you know what to do in terms of the $\operatorname{CNOT}_{ij}$ of classical reversible computing. Then just follow your linearity nose.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2018-07-16T17:25:36.823" LastActivityDate="2018-07-16T17:25:36.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3784" PostTypeId="2" ParentId="3782" CreationDate="2018-07-16T17:18:40.883" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am unable to understand how I can perform CNOT($q_1,q_2$) if $q_1$&#xA;  is a part of an entangled pair, like the Bell state $B_0$ which forms&#xA;  here after the Hadamard transformation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The key is to notice what happens to the &lt;strong&gt;computational basis states&lt;/strong&gt; (or, for that matter, any other &lt;em&gt;complete&lt;/em&gt; set of basis states) upon applying the relevant quantum gate(s). Doesn't matter whether the state is entangled or separable. This method &lt;em&gt;always&lt;/em&gt; works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the $2$-qubit Bell state (of two qubits $A$ and $B$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\Psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\Psi\rangle$ is formed by an equal &lt;strong&gt;linear&lt;/strong&gt; superposition of the computational basis states $|00\rangle$ &amp;amp; $|11\rangle$ (which can be expressed as $|0\rangle_A\otimes|0\rangle_B$ and $|1\rangle_A\otimes|1\rangle_B$ respectively) and $|1\rangle_A\otimes |1\rangle_B$. We need not worry about the other two computational basis states: $|01\rangle$ and $|10\rangle$ as they are not part of the Bell state superposition $|\Psi\rangle$. A CNOT gate basically &lt;strong&gt;flips&lt;/strong&gt; (i.e. does either one of the two mappings $|0\rangle \mapsto |1\rangle$ or $|1\rangle\mapsto |0\rangle$) the state of the qubit $B$ &lt;strong&gt;in case&lt;/strong&gt; the qubit $A$ is in the state $|1\rangle$, or else it does nothing at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically CNOT will keep the computational basis state $|00\rangle$ as it is. However, it will convert the computational basis state $|11\rangle$ to $|10\rangle$. From the action of CNOT on $|00\rangle$ and $|11\rangle$, you can deduce the action of CNOT on the superposition state $|\Psi\rangle$ now: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\operatorname{CNOT}|\Psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention in the comments that you want one of the two qubits of the entangled state $|\Psi\rangle$ to act as &lt;strong&gt;control&lt;/strong&gt; (and the NOT operation will be applied on a different qubit, &lt;em&gt;say&lt;/em&gt; $C$, &lt;em&gt;depending upon the control&lt;/em&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case too, you can proceed in a similar way as above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Write down the &lt;strong&gt;$3$-qubit combined state&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\Psi\rangle\otimes |0\rangle_C = \frac{1}{\sqrt{2}}(|0\rangle_A\otimes |0\rangle_B + |1\rangle_A\otimes|1\rangle_B)\otimes |0\rangle_C$$ $$= \frac{1}{\sqrt{2}}(|0\rangle_A\otimes |0\rangle_B\otimes |0\rangle_C+ |1\rangle_A\otimes|1\rangle_B\otimes|0\rangle_C)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say $B$ is your &lt;strong&gt;control&lt;/strong&gt; qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once again we will simply check the action of the CNOT on the computational basis states (for a 3-qubit system) i.e. $|000\rangle$ &amp;amp; $|110\rangle$. In computational basis state $|000\rangle = |0\rangle_A\otimes|0\rangle_B|0\rangle_C$ notice that the state of the qubit $B$ is $|0\rangle$ and that of qubit $C$ is $|0\rangle$. Since qubit $B$ is in state $|0\rangle$, the state of qubit $C$ will &lt;strong&gt;not&lt;/strong&gt; be flipped. However, notice that in the computational basis state $|110\rangle = |1\rangle_A\otimes|1\rangle_B\otimes|0\rangle_C$ the qubit $B$ is in state $|1\rangle$ while qubit $C$ is in state $|0\rangle$. Since the qubit $B$ is in state $|1\rangle$, the state of the qubit $C$ will be flipped to $|1\rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, you end up with the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\frac{1}{\sqrt{2}}(|0\rangle_A\otimes|0\rangle_B\otimes|0\rangle_C + |1\rangle_A\otimes|1\rangle_B\otimes|1\rangle_C)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is &lt;em&gt;the&lt;/em&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Greenberger–Horne–Zeilinger state&lt;/a&gt; for your $3$ qubits!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-16T19:13:35.597" LastActivityDate="2018-07-16T19:13:35.597" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="3785" PostTypeId="2" ParentId="3767" CreationDate="2018-07-16T19:57:45.330" Score="13" Body="&lt;p&gt;The best possible textbook reference at the moment is&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Coecke and Kissinger. &lt;a href=&quot;http://www.cambridge.org/gb/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/picturing-quantum-processes-first-course-quantum-theory-and-diagrammatic-reasoning?format=HB&amp;amp;isbn=9781107104228&quot; rel=&quot;noreferrer&quot;&gt;Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning.&lt;/a&gt; Cambridge University Press, 2017.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is written by one of the two inventors of the ZX calculus (Bob Coecke), and one of the people who has contributed the most to the development of Quantomatic (Aleks Kissinger), and so would be the definitive introductory reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is now also a website, &lt;a href=&quot;http://zxcalculus.com/&quot; rel=&quot;noreferrer&quot;&gt;zxcalculus.com&lt;/a&gt;, with tutorials, links to resources, and exhibiting a Python-based tool called PyZX, which you may find helpful. This website is a coordinated effort by the main proponents and developers of the theory and applications of the ZX calculus, of which I am one. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="26" LastEditDate="2019-05-02T10:17:12.117" LastActivityDate="2019-05-02T10:17:12.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3786" PostTypeId="1" CreationDate="2018-07-17T04:45:38.733" Score="5" ViewCount="314" Body="&lt;p&gt;I am experimenting with some Qiskit ACQUA AI algorithms which require the following import statement:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from datasets import *&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, &lt;code&gt;import&lt;/code&gt; statement is throwing an error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ModuleNotFoundError&#xA;Traceback (most recent call last) in&#xA;from datasets import * &#xA;ModuleNotFoundError: No module named 'datasets'&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unable to determine the package that this import is from. Clearly, Qiskit ACQUA installation doesn't have to all required packages for the algorithm code to run. I asked the question at the IBM QE forum but the traffic on it is very low. I have not had the answer from anyone yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be most appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4120" LastEditorUserId="26" LastEditDate="2019-03-18T19:48:29.927" LastActivityDate="2019-05-29T18:34:59.843" Title="Quantum SVM Algorithm Error on import" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3787" PostTypeId="2" ParentId="2724" CreationDate="2018-07-17T05:03:25.917" Score="3" Body="&lt;p&gt;Just sharing my own experience here: I honestly felt much better after reading an introductory book on quantum physics, &lt;a href=&quot;https://www.barnesandnoble.com/w/idiots-guides-phd-marc-humphrey-marc/1119618196?ean=9781615643172&amp;amp;st=PLA&amp;amp;sid=BNB_DRS_New%20Core%20Shopping%20Top%20Margin%20EANs_00000000&amp;amp;2sid=Google_&amp;amp;sourceId=PLGoP213156&amp;amp;gclid=CjwKCAjwhLHaBRAGEiwAHCgG3nFBE1dtjSAODP2lRyqz_-kapzpoEaYJYx4s854FMiLty099rwyMPBoC2sMQAvD_BwE&quot; rel=&quot;nofollow noreferrer&quot;&gt;Idiot's Guide&lt;/a&gt;. The book is written by three wonderful professors. They have a whole unit dedicating to Quantum Computing where they explain the fundamentals so nicely. Once you feel comfortable with that, poke around with &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-writeaquantumprogram?view=qsharp-preview&amp;amp;tabs=tabid-vs2017&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft Code&lt;/a&gt; and subscribe to the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/experience&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM QuantumExpeirence&lt;/a&gt;. Installing &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; and playing with the code examples was essential for me. If you coming from a functional programming background, you can also try &lt;a href=&quot;https://www.mathstat.dal.ca/~selinger/quipper/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quipper&lt;/a&gt;: A quantum programming language that is written in Haskell. The field is so young and those who claim to know very much, they basically know very little. So, don't be afraid of asking questions. There are no wrong ones.&lt;/p&gt;&#xA;" OwnerUserId="4120" LastActivityDate="2018-07-17T05:03:25.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3788" PostTypeId="2" ParentId="2724" CreationDate="2018-07-17T11:26:27.500" Score="4" Body="&lt;p&gt;I find in &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; a very good tool to practice from basic concepts to more advanced subjects in the matter. It's pretty fast and intuitive, allowing to see in real time the effect of each modify applied to the circuit. The documentation I found is not so large, but, it's easy to understand. You can find an introduction to the tool &lt;a href=&quot;http://algassert.com/2016/05/22/quirk.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&#xA;On youtube you can find a lot of educational videos. I personally like a lot the TED talk of Leo Kouwenhoven (&lt;a href=&quot;https://www.youtube.com/watch?v=aUuaWVHhx-U&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&#xA;A &lt;a href=&quot;https://www.youtube.com/watch?v=g_IaVepNDT4&quot; rel=&quot;nofollow noreferrer&quot;&gt;similar video&lt;/a&gt; by Veritasium is a (qu)bit more detailed, while still very understandable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the game side, James Wootton programmed a handful of &lt;a href=&quot;https://medium.com/@decodoku/the-history-of-games-for-quantum-computers-a1de98859b5a&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum computer games&lt;/a&gt;, in the sense that they are games designed for quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="2601" LastActivityDate="2018-07-17T11:26:27.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3789" PostTypeId="1" CreationDate="2018-07-17T14:46:03.970" Score="3" ViewCount="43" Body="&lt;p&gt;So, I wanted to learn about quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What should I learn and where do I start?&lt;/p&gt;&#xA;" OwnerUserId="2316" LastEditorUserId="26" LastEditDate="2018-07-17T14:57:09.143" LastActivityDate="2018-07-17T14:57:09.143" Title="Are there sites that allow to learn about quantum computing?" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2018-07-17T15:03:17.183" ContentLicense="CC BY-SA 4.0" />
  <row Id="3790" PostTypeId="1" CreationDate="2018-07-17T21:55:46.683" Score="8" ViewCount="376" Body="&lt;p&gt;CNOT gates have been realized for states living in 2-dimensional spaces (qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about higher-dimensional (qudit) states? Can CNOT gates be defined in such case? In particular, is this possible for three-dimensional states, for example, using &lt;a href=&quot;https://en.wikipedia.org/wiki/Orbital_angular_momentum_of_light&quot; rel=&quot;nofollow noreferrer&quot;&gt;orbital angular momentum&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4131" LastEditorUserId="26" LastEditDate="2018-12-23T13:23:25.327" LastActivityDate="2018-12-23T13:23:25.327" Title="Is it possible to realize CNOT gate in 3 dimension?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3791" PostTypeId="2" ParentId="3790" CreationDate="2018-07-18T06:56:36.743" Score="2" Body="&lt;p&gt;A generalization of the $cX$ (called &quot;controlled $X$&quot; or &quot; controlled $\textrm{NOT}$&quot;)  gate is given as $c\tilde{X}$ in &lt;a href=&quot;https://arxiv.org/pdf/1304.4923.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. When the dimension of the Hilbert space is $d=2$, then $c\tilde{X}=cX=\textrm{CNOT}$, but $c\tilde{X}$ is also valid for $d&amp;gt;2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in &lt;a href=&quot;https://arxiv.org/pdf/1702.07299.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, $d&amp;gt;2$ gates are interpreted in the context of OAMs.   &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-07-18T09:20:41.687" LastActivityDate="2018-07-18T09:20:41.687" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3792" PostTypeId="2" ParentId="3790" CreationDate="2018-07-18T07:15:51.933" Score="4" Body="&lt;p&gt;There are multiple questions implicit in this question.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do you define an equivalent of the controlled-not for qutrits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are probably multiple ways that the gate can be generalised, but &lt;a href=&quot;https://arxiv.org/abs/1304.4923&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; defines it as &#xA;$$&#xA;|x\rangle|y\rangle\mapsto|x\rangle|-x-y\text{ mod }3\rangle&#xA;$$&#xA;I'm not sure why they use the - sign, and am instead going to take the definition&#xA;$$&#xA;|x\rangle|y\rangle\mapsto|x\rangle|x+y\text{ mod }3\rangle&#xA;$$&#xA;That means that we can write the unitary matrix as&#xA;$$&#xA;\left(\begin{array}{ccccccccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}\right).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible to realise this gate in 3 dimensions?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sure, why not? &lt;a href=&quot;https://arxiv.org/abs/1105.5485&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; talks defines things slightly differently, but one could construct the gate I've specified using their formalism, and they also discuss some ideas for physical implementation. &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.062313&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; may also be interesting.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Has this gate been realised?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not to my knowledge, but I can't pretend to know everything that has every been achieved experimentally. I would point out, however, that &lt;a href=&quot;https://arxiv.org/abs/1702.07299&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; is only doing single-qudit gates, not two-qudit gates. Judging by the fact that that paper was only last year, I'd guess the two qudit generalisation hasn't been done yet in that particular physical realisation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-18T07:15:51.933" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3793" PostTypeId="1" CreationDate="2018-07-18T08:13:17.877" Score="6" ViewCount="266" Body="&lt;p&gt;The square-root of not and square-root of swap gates are often singled out for discussion of gates displaying important properties relating to quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I define arbitrary (non-integer) powers of the square-root of NOT or square-root of SWAP?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I find their unitary matrices?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How might I implement these gates?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2018-12-23T13:23:06.290" LastActivityDate="2019-10-30T18:51:48.553" Title="Arbitrary powers of NOT and SWAP" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3794" PostTypeId="2" ParentId="3793" CreationDate="2018-07-18T08:13:17.877" Score="8" Body="&lt;p&gt;Let's start with some general theory. If you have a normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (of which unitaries are a subset), you can define any function of that matrix &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt;. For example, &lt;span class=&quot;math-container&quot;&gt;$A^{1/2}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$A^{\pi}$&lt;/span&gt;. The most natural way to do this is via the spectral decomposition: if &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_i\}$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the matrix that diagonalises &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UAU^\dagger=\sum_i\lambda_i|i\rangle\langle i|:=D,&#xA;$$&lt;/span&gt;&#xA;i.e. &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is a diagonal matrix with entries corresponding to the eigenvalues. Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(A)=U^\dagger\sum_if(\lambda_i)|i\rangle\langle i| U.&#xA;$$&lt;/span&gt;&#xA;You can see why this works if you think about &lt;span class=&quot;math-container&quot;&gt;$\sqrt{A}=U^\dagger\sqrt{D} U$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\sqrt{D}$&lt;/span&gt; is just the same as &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, but taking the square root on each of the diagonal entries), and we multiply it together:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{A}\cdot \sqrt{A}=U^\dagger\sqrt{D} UU^\dagger\sqrt{D} U=U^\dagger D U=A.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way, we can define arbitrary power of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. Effectively, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X^{q}=|+\rangle\langle +|+e^{i\pi q}|-\rangle\langle -|=\frac{1}{2}\left(\begin{array}{cc}&#xA;1+e^{i\pi q} &amp;amp; 1-e^{i\pi q} \\ 1-e^{i\pi q} &amp;amp; 1+ e^{i\pi q}&#xA;\end{array}\right)=e^{i\pi q/2}\left(\begin{array}{cc}&#xA;\cos\frac{\pi q}{2} &amp;amp; -i\sin\frac{\pi q}{2} \\ -i\sin\frac{\pi q}{2} &amp;amp; \cos \frac{\pi q}{2}&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several ways in which you might implement this gate. For example, as already mentioned &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2609/1837&quot;&gt;here&lt;/a&gt;, you can think of it as a continuous time operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i(\mathbb{I}-X)t}&#xA;$$&lt;/span&gt;&#xA;for any &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; that you want (&lt;span class=&quot;math-container&quot;&gt;$t=\pi q/2$&lt;/span&gt;). Another way, if you have arbitrary phase gates available, is just the sequence Hadamard - phase - hadamard, as the hadamards convert a z-rotation into an x-rotation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As yet, I haven't mentioned the power of swap. Think about the swap gate. Clearly, two eigenvectors (of eigenvalue 1) are &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. These are unchanged by taking arbitrary powers. The bit that's affected is a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt;. But when you look at just this subspace, the SWAP matrix is exactly the same as &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&#xA;So, knowing about &lt;span class=&quot;math-container&quot;&gt;$f(X)$&lt;/span&gt; immediately tells us about &lt;span class=&quot;math-container&quot;&gt;$f(\mathrm{SWAP})$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{SWAP}^q=\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\pi q/2}\cos\frac{\pi q}{2} &amp;amp; -ie^{i\pi q/2}\sin\frac{\pi q}{2} &amp;amp; \ \\&#xA;0 &amp;amp; -ie^{i\pi q/2}\sin\frac{\pi q}{2} &amp;amp; e^{i\pi q/2}\cos \frac{\pi q}{2} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a continuous-time implementation, then one can use&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{it(\mathbb{I}-Z\otimes Z -X\otimes X-Y\otimes Y)/2},&#xA;$$&lt;/span&gt;&#xA;because this Hamiltonian, when restricted to the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; subspace is just &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}-X$&lt;/span&gt;, as we required before. As for a quantum circuit, that has been partially addressed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2468/1837&quot;&gt;here&lt;/a&gt;. That answer effectively conveys how any &lt;span class=&quot;math-container&quot;&gt;$f(\mathrm{SWAP})$&lt;/span&gt; can be converted into a controlled-&lt;span class=&quot;math-container&quot;&gt;$f(X)$&lt;/span&gt; gate. One simply has to get the angle of rotation correct, and sufficient information is conveyed in that answer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2019-10-30T18:51:48.553" LastActivityDate="2019-10-30T18:51:48.553" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3796" PostTypeId="2" ParentId="3770" CreationDate="2018-07-18T16:14:36.003" Score="8" Body="&lt;p&gt;The no cloning theorem says that there is no circuit which creates &lt;em&gt;independent&lt;/em&gt; copies of all quantum states. Mathematically, no cloning states that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\forall C: \exists a,b: C \cdot \Big( (a|0\rangle + b|1\rangle)\otimes|0\rangle \Big) \neq (a|0\rangle + b|1\rangle) \otimes (a|0\rangle + b|1\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fanout circuits don't violate this theorem. They don't make indepedent copies. They make &lt;em&gt;entangled&lt;/em&gt; copies. Mathematically, they do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{FANOUT} \cdot \Big( (a|0\rangle + b|1\rangle) \otimes |0\rangle \Big) = a|00\rangle + b|11\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So everything is fine because $a|00\rangle + b|11\rangle$ is not the same thing as $(a|0\rangle + b|1\rangle) \otimes (a|0\rangle + b|1\rangle)$.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-07-18T16:14:36.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3798" PostTypeId="2" ParentId="2562" CreationDate="2018-07-19T09:42:33.180" Score="2" Body="&lt;p&gt;It is incorrect to use modulo arithmetic in this context. Instead finite field arithmetic should be applied. In $\textrm{GF}(4) = \{0, 1, x, x^2\}$ where $x^2 = x + 1$ and conjugation of $a$ is defined as $\bar{a} = a^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addition, multiplication and conjugation tables are then as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/68A2E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/68A2E.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this picture we have $0 \equiv 0$, $1 \equiv 1$, $2 \equiv x$, and $3 \equiv x^2$ such that $2 \times 2 = 3$ and so the apparent inconsistency does not occur.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-19T11:21:45.217" LastActivityDate="2018-07-19T11:21:45.217" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3799" PostTypeId="2" ParentId="2697" CreationDate="2018-07-19T11:46:36.680" Score="9" Body="&lt;p&gt;A couple years ago it was shown in &lt;a href=&quot;https://arxiv.org/pdf/1512.05903.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithms and the finite element method&lt;/a&gt; by Montanaro and Pallister that the HHL algorithm could be applied to the Finite Element Method (FEM) which is a &lt;em&gt;&quot;technique for efficiently finding numerical approximations to the solutions of boundary value problems (BVPs) for partial differential equations, based on discretizing the parameter space via a finite mesh&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They showed that within this context HHL could be used to achieve (perhaps at most) a polynomial speedup over the standard classical algorithm (the &quot;conjugate gradient method&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to real-world use-cases, they state that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;One example application is any dynamical problem involving $n$ bodies, which implies solving a PDE defined over a configuration space of dimension 2n. Also, there may be a significant advantage for problems in mathematical finance;&#xA;  for example, pricing multiasset options requires solving the Black-Scholes equation over a domain with dimension given by the number of assets&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This opens up a whole area of potential use-cases for HHL (assuming conditions on the sparsity of $A$ can be satisfied).&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-07-19T11:46:36.680" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3800" PostTypeId="1" CreationDate="2018-07-19T14:34:57.293" Score="12" ViewCount="1720" Body="&lt;p&gt;For each IBM quantum chip, one can write a dictionary mapping each control qubit j to a list of its physically allowed targets, assuming j is the control of a CNOT. For example, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ibmqx4_c_to_tars = {&#xA;    0: [],&#xA;    1: [0],&#xA;    2: [0, 1, 4],&#xA;    3: [2, 4],&#xA;    4: []}  # 6 edges&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for their ibmqx4 chip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be that dict for Google's 72 qubit Bristlecone chip. You can write the dict as a comprehension. Same question for Rigetti's 19 qubit chip.&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="1974" LastEditDate="2018-07-20T14:13:02.260" LastActivityDate="2018-07-20T21:22:40.170" Title="What are physically allowed CNOTs for Rigetti's 19 qubit chip and Google's 72 qubit BristleCone chip?" Tags="&lt;bristlecone&gt;&lt;rigetti&gt;&lt;cirq&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3802" PostTypeId="2" ParentId="3800" CreationDate="2018-07-19T14:54:24.550" Score="9" Body="&lt;p&gt;From the &lt;a href=&quot;https://ai.googleblog.com/2018/03/a-preview-of-bristlecone-googles-new.html&quot; rel=&quot;noreferrer&quot;&gt;original blog post&lt;/a&gt; presenting the Bristlecone quantum chip, here is the connectivity map of the chip:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SsQsx.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SsQsx.png&quot; alt=&quot;Bristlecone connectivity map&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each cross represent a qubit, with nearest-neighbour connectivity. If you number the qubits from left to right, top to bottom (just like how you read english), starting by $0$ then the connectivity map would be given by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;connectivity_map = {&#xA;    i : [i + offset&#xA;         for offset in (-6, -5, 5, 6) # values deduced by taking a qubit in the middle of&#xA;                                      # chip and computing the offsets between the choosen&#xA;                                      # qubit and it's 4 neighbours&#xA;         if ((0 &amp;lt;= i+offset &amp;lt; 72)             # the neighbour should be a valid qubit&#xA;             and ((i+offset) // 6 != i // 6)) # the neighbour should not be on the same line&#xA;    ]&#xA;    for i in range(72)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;: the expression above is completely unverified. It seems to work for the first qubits, it seems logical to me, but it's up to you to check that the map is 100% correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Warning 2&lt;/strong&gt;: Google's blog post does not talk about the orientation of the connections between qubits. The connectivity map given above assumes that the connections are bilateral. &lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-07-19T15:14:45.490" LastActivityDate="2018-07-19T15:14:45.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3804" PostTypeId="2" ParentId="3800" CreationDate="2018-07-19T17:55:10.540" Score="12" Body="&lt;p&gt;Bristlecone's native operation is the CZ, not CNOTs. However, you can transform between the two with Hadamard gates so this is sort of a trivial difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bristlecone can perform a CZ between any adjacent pair of qubits on a grid. You can see the grid by installing &lt;a href=&quot;https://github.com/quantumlib/cirq&quot; rel=&quot;noreferrer&quot;&gt;cirq&lt;/a&gt; and printing out the Bristlecone device:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ pip install cirq&#xA;$ python&#xA;&amp;gt;&amp;gt;&amp;gt; import cirq&#xA;&amp;gt;&amp;gt;&amp;gt; print(cirq.google.Bristlecone)&#xA;                                             (0, 5)────(0, 6)&#xA;                                             │         │&#xA;                                             │         │&#xA;                                    (1, 4)───(1, 5)────(1, 6)────(1, 7)&#xA;                                    │        │         │         │&#xA;                                    │        │         │         │&#xA;                           (2, 3)───(2, 4)───(2, 5)────(2, 6)────(2, 7)───(2, 8)&#xA;                           │        │        │         │         │        │&#xA;                           │        │        │         │         │        │&#xA;                  (3, 2)───(3, 3)───(3, 4)───(3, 5)────(3, 6)────(3, 7)───(3, 8)───(3, 9)&#xA;                  │        │        │        │         │         │        │        │&#xA;                  │        │        │        │         │         │        │        │&#xA;         (4, 1)───(4, 2)───(4, 3)───(4, 4)───(4, 5)────(4, 6)────(4, 7)───(4, 8)───(4, 9)───(4, 10)&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;(5, 0)───(5, 1)───(5, 2)───(5, 3)───(5, 4)───(5, 5)────(5, 6)────(5, 7)───(5, 8)───(5, 9)───(5, 10)───(5, 11)&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;         (6, 1)───(6, 2)───(6, 3)───(6, 4)───(6, 5)────(6, 6)────(6, 7)───(6, 8)───(6, 9)───(6, 10)&#xA;                  │        │        │        │         │         │        │        │&#xA;                  │        │        │        │         │         │        │        │&#xA;                  (7, 2)───(7, 3)───(7, 4)───(7, 5)────(7, 6)────(7, 7)───(7, 8)───(7, 9)&#xA;                           │        │        │         │         │        │&#xA;                           │        │        │         │         │        │&#xA;                           (8, 3)───(8, 4)───(8, 5)────(8, 6)────(8, 7)───(8, 8)&#xA;                                    │        │         │         │&#xA;                                    │        │         │         │&#xA;                                    (9, 4)───(9, 5)────(9, 6)────(9, 7)&#xA;                                             │         │&#xA;                                             │         │&#xA;                                             (10, 5)───(10, 6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is how you can get a set containing the allowed CZ operations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qubits = cirq.google.Bristlecone.qubits&#xA;allowed = {cirq.CZ(a, b)&#xA;           for a in qubits&#xA;           for b in qubits&#xA;           if a.is_adjacent(b)}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The set has 121 elements in it, and it's somewhat random whether you get CZ(x, y) or CZ(y, x) in the set, so I won't include a printout of the set here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An additional constraint to keep in mind is that you cannot perform two CZs next to each other at the same time. Cirq takes this into account when creating circuits targeted at Bristlecone. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;device = cirq.google.Bristlecone&#xA;a, b, c, d, e = device.col(6)[:5]&#xA;circuit = cirq.Circuit.from_ops(&#xA;    cirq.CZ(a, b),&#xA;    cirq.CZ(c, d),&#xA;    cirq.CZ(a, b),&#xA;    cirq.CZ(d, e),&#xA;    device=device)&#xA;print(circuit)&#xA;# (0, 6): ───@───────@───&#xA;#            │       │&#xA;# (1, 6): ───@───────@───&#xA;# &#xA;# (2, 6): ───────@───────&#xA;#                │&#xA;# (3, 6): ───────@───@───&#xA;#                    │&#xA;# (4, 6): ───────────@───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first two operations were staggered because they are adjacent CZs, but the second two weren't because they aren't.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-07-19T18:14:40.170" LastActivityDate="2018-07-19T18:14:40.170" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3806" PostTypeId="5" CreationDate="2018-07-19T18:22:36.097" Score="0" Body="&lt;p&gt;Cirq's github repository: &lt;a href=&quot;https://github.com/quantumlib/cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/cirq&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-07-19T19:51:52.257" LastActivityDate="2018-07-19T19:51:52.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3807" PostTypeId="4" CreationDate="2018-07-19T18:22:36.097" Score="0" Body="For questions about cirq, which is an open source python library for working with NISQ (Noisy Intermediate Scale Quantum) circuits." OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-07-19T19:51:41.327" LastActivityDate="2018-07-19T19:51:41.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3808" PostTypeId="1" CreationDate="2018-07-19T18:38:05.353" Score="2" ViewCount="87" Body="&lt;p&gt;I am thinking as quantum computing is just a new word in tech, so let to explore it by building it or a prototype based on it so I am just wanted help in setting up and initial steps which should I keep in mind. Please tell me about each implementation step.&lt;/p&gt;&#xA;" OwnerUserId="2566" LastEditorUserId="26" LastEditDate="2018-12-14T05:26:40.200" LastActivityDate="2018-12-14T05:26:40.200" Title="Is it possible to make our own quantum computer? If yes, what will it take?" Tags="&lt;architecture&gt;&lt;physical-realization&gt;" AnswerCount="0" CommentCount="7" ClosedDate="2018-07-19T21:31:37.100" ContentLicense="CC BY-SA 4.0" />
  <row Id="3809" PostTypeId="1" CreationDate="2018-07-19T19:03:33.407" Score="7" ViewCount="739" Body="&lt;p&gt;The QISKIT documentation doesn't explain what a TDG gate does and I can't find it anywhere else online. &lt;/p&gt;&#xA;" OwnerUserId="4150" LastEditorUserId="26" LastEditDate="2019-03-12T09:33:02.333" LastActivityDate="2019-03-12T09:33:02.333" Title="What is the purpose of the TDG gate in QISKit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3810" PostTypeId="2" ParentId="3809" CreationDate="2018-07-19T19:16:57.557" Score="8" Body="&lt;p&gt;According to the &lt;a href=&quot;https://qiskit.org/documentation/_autodoc/qiskit._compositegate.html#qiskit._compositegate.CompositeGate.tdg&quot; rel=&quot;noreferrer&quot;&gt;QISKit documentation&lt;/a&gt;, &lt;code&gt;tdg(q)&lt;/code&gt; applies the &lt;code&gt;Tdg&lt;/code&gt; gate to a qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$T$ is the basically the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Phase_shift_(%7F&amp;#39;%22%60UNIQ--postMath-0000002D-QINU%60%22&amp;#39;%7F)_gates&quot; rel=&quot;noreferrer&quot;&gt;$\pi/8$ phase shift gate&lt;/a&gt; whose matrix representation considering standard (computational) basis is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\begin{matrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\pi/4}\end{matrix}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Tdg&lt;/code&gt; is simply the &lt;a href=&quot;https://en.wikipedia.org/wiki/Conjugate_transpose&quot; rel=&quot;noreferrer&quot;&gt;conjugate transpose&lt;/a&gt; of the matrix $T$ i.e. $T^{\dagger}$, which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\left(\begin{matrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{-i\pi/4}\end{matrix}\right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the $T$ gate would map the &lt;a href=&quot;https://en.wikipedia.org/wiki/Basis_(linear_algebra)&quot; rel=&quot;noreferrer&quot;&gt;basis vectors&lt;/a&gt; (of a qubit) $|0\rangle$ to $|0\rangle$ itself and $|1\rangle$ to $e^{i\pi/4}|1\rangle$, whereas $T^{\dagger}$ would map $|0\rangle$ to $|0\rangle$ itself and $|1\rangle$ to $e^{-i\pi/4}|1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S:&lt;/strong&gt; In case you're wondering what &lt;code&gt;dg&lt;/code&gt; means in &lt;code&gt;tdg&lt;/code&gt;, it is simply an abbreviation for &quot;dagger&quot; i.e. in the sense of $T^{\dagger}$ (pronounced as $T$ - dagger).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-07-19T21:16:22.063" LastActivityDate="2018-07-19T21:16:22.063" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3811" PostTypeId="5" CreationDate="2018-07-19T19:34:08.000" Score="0" Body="&lt;p&gt;Cirq's github repository: &lt;a href=&quot;https://github.com/quantumlib/cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/cirq&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-07-19T21:32:06.307" LastActivityDate="2018-07-19T21:32:06.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3812" PostTypeId="4" CreationDate="2018-07-19T19:34:08.000" Score="0" Body="Cirq is an open source python library for working with NISQ (Noisy Intermediate Scale Quantum) circuits." OwnerUserId="119" LastEditorUserId="23" LastEditDate="2018-07-19T21:33:31.280" LastActivityDate="2018-07-19T21:33:31.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3813" PostTypeId="1" AcceptedAnswerId="3819" CreationDate="2018-07-19T21:21:46.463" Score="6" ViewCount="113" Body="&lt;p&gt;$\newcommand{\Q}{\mathbf{Q}}\newcommand{\S}{\mathbf{S}}\newcommand{\A}{{\mathcal A}}\newcommand{\H}{\mathcal H}$In the quantum amplitude amplification algorithm, as explained in Brassard et al. 2000 (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005055&quot; rel=&quot;nofollow noreferrer&quot;&gt;quant-ph/0005055&lt;/a&gt;), the unitary performing the amplification is defined as (using the notation found in pag 5 of the above paper):&#xA;$$\Q=-\A\S_0\A^{-1}\S_\chi,$$&#xA;where $\A$ is a unitary,&#xA;$\chi:\mathbb Z\to\{0,1\}$ is a Boolean function, and $\S_\chi$ and $\S_0$ are unitaries defined as&#xA;$$\S_\chi\equiv I-2\Pi_1,\quad \S_0\equiv I-|0\rangle\langle0|,$$&#xA;where $\Pi_i$ is the projector over the states $|x\rangle$ for which $\chi(x)=i$:&#xA;$$\Pi_i\equiv\Pi_{\chi(x)=i}\equiv\sum_{x:\,\chi(x)=i}|x\rangle\langle x|.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the state $|\Psi\rangle\equiv\A|0\rangle$, the authors define the states $|\Psi_i\rangle$, for $i=0,1$, as&#xA;$$|\Psi_i\rangle\equiv\Pi_i|\Psi\rangle=\Pi_i\A|0\rangle.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first lemma in the paper, at the end of page 5, states that&#xA;\begin{align}&#xA;\Q|\Psi_1\rangle&amp;amp;=(1-2a)|\Psi_1\rangle-2a|\Psi_0\rangle, \\&#xA;\Q|\Psi_0\rangle&amp;amp;=2(1-a)|\Psi_1\rangle+(1-2a)|\Psi_0\rangle,&#xA;\end{align}&#xA;where $a=\langle\Psi_1|\Psi_1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The action of $\Q$ over $|\Psi_i\rangle$ does not seem obvious. For example,&#xA;$$\Q|\Psi_0\rangle=-\A\S_0\A^{-1}\S_\chi|\Psi_0\rangle&#xA;=-\A\S_0\A^{-1}|\Psi_0\rangle,$$&#xA;but then already $\A^{-1}$ acts nontrivially on $|\Psi_0\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;How is $\Q|\Psi_i\rangle$ computed?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-24T16:41:45.240" LastActivityDate="2018-07-24T16:41:45.240" Title="Computing of the action of the amplification operator $\mathbf Q$ over $|\Psi_i\rangle$ in the quantum amplitude amplification algorithm" Tags="&lt;algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3814" PostTypeId="2" ParentId="2724" CreationDate="2018-07-19T22:32:17.517" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there anything on software that gives a good introduction to the functions and uses a quantum computer will have?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I gave a talk on quantum computing from a computer science perspective &lt;a href=&quot;https://www.youtube.com/watch?v=F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; which has been well-received. I cover the function of basic quantum logic gates, and go over the simplest problem where a quantum computer outperforms classical methods (the Deutsch Oracle problem). High school students have reportedly found it understandable.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As well as what language would be best to program one? Also, would there be a way to program a quantum computer through a classical computer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Microsoft's &lt;a href=&quot;https://www.microsoft.com/en-us/quantum/development-kit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Development Kit&lt;/a&gt; contains both a quantum language (Q#) and quantum computer simulator to run your quantum programs on your own classical computer.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-07-19T22:32:17.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3815" PostTypeId="1" AcceptedAnswerId="3817" CreationDate="2018-07-19T23:07:15.527" Score="9" ViewCount="543" Body="&lt;p&gt;I've created a simple circuit in Q-Kit to understand conditional gates and outputted states on each step:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dIari.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dIari.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In the beginning there is clear 00 state, which is the input&lt;/li&gt;&#xA;&lt;li&gt;The first qubit is passed through the Hadamard gate, it gets into superposition, 00 and 10 become equally possible&lt;/li&gt;&#xA;&lt;li&gt;The first qubit CNOTs the second one, probability of 00 is unchanged, but 10 and 11 are swapped&lt;/li&gt;&#xA;&lt;li&gt;The first qubit passes Hadamard again and &lt;strong&gt;probability of 00 is splited between 00 and 10, and 11 between 01 and 11&lt;/strong&gt; as if first qubit stepped into superposition from a fixed state&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Shouldn't the result be equally distributed 00 and 01? The first qubit passes Hadamard twice, which should put it into superposition and back to initial 0. The CNOT gate does not affect controller qubit, so its existence shouldn't affect first qubit at all, but in fact it makes it act like it wasn't in superposition any more. &lt;strong&gt;Does usage of qubit as a controller collapse its superposition?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="3068" LastEditorUserId="26" LastEditDate="2018-12-23T13:22:38.790" LastActivityDate="2018-12-23T13:22:38.790" Title="Does conditional gate collapse controller's superposition?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3816" PostTypeId="2" ParentId="1679" CreationDate="2018-07-20T00:15:05.593" Score="4" Body="&lt;p&gt;In addition to the security of the digital signatures used in cryptocurrencies, which, as mentioned, is susceptible to an attack with a quantum computer capable of executing Shor's algorithm, cryptocurrencies use other cryptographic primitives in the &quot;proof-of-work.&quot;  &lt;a href=&quot;https://arxiv.org/abs/1804.08118&quot; rel=&quot;nofollow noreferrer&quot;&gt;Or Sattath&lt;/a&gt; describes a weakness of Bitcoin's currently implemented proof-of-work.  Sattath proposes an easily-implementable countermeasure for this security flaw, but the &lt;em&gt;current implementation&lt;/em&gt; of Bitcoin has Sattath's weakness.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In more detail, a cryptocurrency with a blockchain employing Nakamoto-style consensus requires miners who perform a proof-of-work, in order to determine the consensus ledger.  In Bitcoin, the proof-of-work entails finding a partial preimage of a particular hash function - that is, at height $n$, miner $i$ generating her merkle root $R_i$ representing the ledger, and finding a nonce $c$ such that a cryptographic hash $H(B_{n-1}\Vert c\Vert R_i)=B_n\le d$ for target $d$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As has been noted, such a proof-of-work is weakened by a quantum computer capable of executing Grover's algorithm - by running amplitude amplification on all states that hash to less than the target, a quadratic speedup may be achieved, and the nonce $c$ may be found more easily. A naive way to improve security, then, is to reduce the target $d$ polynomially - that is, make the difficulty be quadratically harder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, a key requirement of such proofs-of-work is that they are &lt;strong&gt;progress-free&lt;/strong&gt;, meaning that after a miner has spent $t$ minutes working on finding a nonce $c$, then she would be no closer to finding the winning block than if she spent $t+1$ minutes.  The hope is that the race goes not the fastest, but to the ones with the most hash power.  This leads to a lack of correlation between the time separate miners find a block.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Grover's algorithm is famously &lt;em&gt;not&lt;/em&gt; progress-free.  That is, each iteration of Grover's algorithm quadratically improves a miners' chance of finding the block.  Or Sattath noted that this will likely lead to miners stopping their work immediately upon receiving a mined block, and hopefully winning a fork.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sattath states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose Alice devoted $2$ minutes of applying Grover’s algorithm, and now receives a new block, mined by Bob.  She could discard her computation, and start mining on top of Bob’s block, but that amounts to wasting $2$ minutes of computational resources.  Instead,  she could immediately stop Grover’s algorithm, and measure her quantum state. If she is lucky and her block is valid, and she also propagates her block to most other miners before Bob does, these other miners will mine on top of her block, and she, rather than Bob, will get the block reward.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sattath supposes that if enough miners are Grover-capable, then all miners will be motivated to measure for their block whenever someone announces a nonce.  This leads to forks that destroy the security of the blockchain.  &lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-07-20T02:01:48.350" LastActivityDate="2018-07-20T02:01:48.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3817" PostTypeId="2" ParentId="3815" CreationDate="2018-07-20T00:17:28.373" Score="5" Body="&lt;p&gt;$$&#xA;\begin{eqnarray*}&#xA;\mid 0 0 \rangle &amp;amp;\to&amp;amp; \frac{1}{\sqrt{2}} \mid 0 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 0 \rangle\\&#xA;&amp;amp;\to&amp;amp; \frac{1}{\sqrt{2}} \mid 0 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 1 \rangle\\&#xA;&amp;amp;\to&amp;amp; \frac{1}{\sqrt{4}} \mid 0 0 \rangle + \frac{1}{\sqrt{4}} \mid 1 1 \rangle + \frac{1}{\sqrt{4}} \mid 1 0 \rangle + \frac{1}{\sqrt{4}} \mid 0 1 \rangle&#xA;\end{eqnarray*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the second line was $(\frac{1}{\sqrt{2}} \mid 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 \rangle) \otimes v$, then applying the $H$ again would take it to $\mid 0 \rangle \otimes v$, but it is not. They are entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like you're thinking the first qubit is unaffected by the CNOT, so the last two should commute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{eqnarray*}&#xA;H_1 CNOT_{12} &amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1\\&#xA;0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0&#xA;\end{pmatrix}\\&#xA;CNOT_{12} H_1 &amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0&#xA;\end{pmatrix}\\&#xA;\end{eqnarray*}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is in a superposition, the entire time. There was no collapse. It's a nonobvious noncommutation. If you had $Id \otimes U$, that would be something literally not affecting the first qubit and it would commute with $H_1$. But CNOT is not of that form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of it this way at the beginning you have 2 qubits. After applying the first $H$ you still have 2 qubits. Then after the CNOT, they are entangled so you have 1 qudit with $d=4$ because they have been combined. Then the last $H$ leaves it with $d=4$. At each gate, you do a worst case scenario of the entanglement structure.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-07-20T00:17:28.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3818" PostTypeId="2" ParentId="3815" CreationDate="2018-07-20T00:18:01.037" Score="3" Body="&lt;p&gt;No, using a controlled gate doesn't measure the control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a sense, the idea that controlled gates would be implemented via measurement is exactly backwards. It's measurement that is implemented in terms of controlled gates, not vice versa. A measurement is just an interaction (i.e a controlled gate) between the computer and the environment that's intractable to undo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simpler analogy, consider the Z gate. The Z gate applies a -1 phase factor to the $|1\rangle$ state of a qubit. It sends $a|0\rangle + b|1\rangle$ to $a|0\rangle - b |1\rangle$. One could describe this effect in a conditional way: &lt;em&gt;if&lt;/em&gt; the qubit is in the $|1\rangle$ state, &lt;em&gt;then&lt;/em&gt; the Z gate phases the qubit by -1. But the &quot;if&quot; in that description does not mean that we had to measure the qubit and then decide whether or not to apply the -1 phase factor, it's just a slightly-misleading description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same idea applies to the CNOT. Yes, you can describe it in an if-then way. But you can also describe it as &quot;apply a -1 phase factor to the $|1\rangle \otimes |-\rangle$ state&quot;. And the latter description makes it clear that measurement is not necessary.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-07-20T00:18:01.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3819" PostTypeId="2" ParentId="3813" CreationDate="2018-07-20T06:20:53.420" Score="3" Body="&lt;p&gt;The trick here is to not calculate $\mathcal{A}^{-1}|\Psi\rangle$ at all, because it's insufficiently defined! Instead, look at&#xA;$$&#xA;\mathcal{A}(\mathbb{I}-2|0\rangle\langle 0|)\mathcal{A}^{-1}=\mathbb{I}-2\mathcal{A}|0\rangle\langle 0|\mathcal{A}^{-1}&#xA;$$&#xA;by the fact that $\mathcal{A}$ is unitary. Now, by definition,&#xA;$$&#xA;\mathcal{A}|0\rangle=|\Psi_0\rangle+|\Psi_1\rangle&#xA;$$&#xA;Thus, we have&#xA;$$&#xA;\mathcal{A}(\mathbb{I}-|0\rangle\langle 0|)\mathcal{A}^{-1}=\mathbb{I}-2(|\Psi_0\rangle+|\Psi_1\rangle)(\langle\Psi_0|+\langle\Psi_1|).&#xA;$$&#xA;Now you can calculate the effect of this on any input state. Just remember that the states $|\Psi_0\rangle$ and $|\Psi_1\rangle$ are not normalised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence,&#xA;\begin{align*}&#xA;Q|\Psi_0\rangle&amp;amp;=-\left(\mathbb{I}-2(|\Psi_0\rangle+|\Psi_1\rangle)(\langle\Psi_0|+\langle\Psi_1|)\right)|\Psi_0\rangle  \\&#xA;&amp;amp;=-\left(|\Psi_0\rangle-2(|\Psi_0\rangle+|\Psi_1\rangle)(1-a)\right) \\&#xA;&amp;amp;=2(1-a)|\Psi_1\rangle+(1-2a)|\Psi_0\rangle&#xA;\end{align*}&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-20T06:20:53.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3820" PostTypeId="2" ParentId="3815" CreationDate="2018-07-20T08:47:37.207" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;In the beginning there is clear 00 state, which is the input&lt;/li&gt;&#xA;  &lt;li&gt;The first qubit is passed through the Hadamard gate, it gets into superposition, 00 and 10 become equally possible&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;3&quot;&gt;&#xA;  &lt;li&gt;The first qubit CNOTs the second one, probability of 00 is unchanged, but 10 and 11 are swapped&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To be precise, 10 becomes 11.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;4&quot;&gt;&#xA;  &lt;li&gt;The first qubit passes Hadamard again and &lt;strong&gt;probability of 01 is splited between 01 and 11, and 11 between 01 and 11&lt;/strong&gt; as if first qubit stepped into superposition from a fixed state&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Incorrect. There is no &lt;strong&gt;01&lt;/strong&gt; here, only &lt;strong&gt;00&lt;/strong&gt; and &lt;strong&gt;11&lt;/strong&gt;, and after applying Hadamard to the first qubit you have superposition of 4 states: &lt;strong&gt;00&lt;/strong&gt;, &lt;strong&gt;10&lt;/strong&gt;, &lt;strong&gt;11&lt;/strong&gt; and &lt;strong&gt;01&lt;/strong&gt;,&#xA;$$\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)\rightarrow\frac{1}{2}(|00\rangle+|10\rangle+|01\rangle-|11\rangle)$$&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-07-20T09:08:02.227" LastActivityDate="2018-07-20T09:08:02.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3821" PostTypeId="1" AcceptedAnswerId="3829" CreationDate="2018-07-20T09:52:34.450" Score="6" ViewCount="283" Body="&lt;p&gt;I am looking for some good software to simulate quantum computing, visually if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know about quirk (&lt;a href=&quot;http://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;http://algassert.com/quirk&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and IBM Q Experience (&lt;a href=&quot;https://quantumexperience.ng.bluemix.net&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just saw this question ( &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3815/does-conditional-gate-collapse-controllers-superposition&quot;&gt;Does conditional gate collapse controller&amp;#39;s superposition?&lt;/a&gt; ) and the asker uses something that looks really neat : &lt;a href=&quot;https://i.stack.imgur.com/dIari.png&quot; rel=&quot;noreferrer&quot;&gt;https://i.stack.imgur.com/dIari.png&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does someone knows what this is?&#xA;And does someone knos other good software like these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!!&lt;/p&gt;&#xA;" OwnerUserId="4160" LastEditorUserId="4160" LastEditDate="2018-07-20T12:22:47.127" LastActivityDate="2018-07-24T06:37:45.890" Title="What are some good quantum computing simulator and visualiser?" Tags="&lt;simulation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ClosedDate="2018-07-24T13:56:57.603" ContentLicense="CC BY-SA 4.0" />
  <row Id="3823" PostTypeId="1" AcceptedAnswerId="3824" CreationDate="2018-07-20T12:05:30.820" Score="8" ViewCount="875" Body="&lt;p&gt;Following from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3743/error-simulation-of-quantum-algorithm-for-linear-systems-of-equations-for-4&quot;&gt;this question&lt;/a&gt;, I tried to look at the cited &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; in order to simulate and solve that same problem... without success. Mainly, I still fail to understand how the authors managed to simulate the Hamiltonian evolution through the circuit shown at the bottom of Fig.4. Even exponentiating classically the matrix I do not get values of the gates shown in the Quirk circuit that @Blue linked along his question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to look at the &lt;a href=&quot;https://arxiv.org/abs/1009.5625&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; in which the Group Leader Optimization algorithm is explained, but I still have troubles understanding how do they assign the rotation angles to the different gates.&lt;/p&gt;&#xA;" OwnerUserId="2648" LastEditorUserId="23" LastEditDate="2018-10-22T21:13:56.973" LastActivityDate="2018-10-22T21:13:56.973" Title="Practical implementation of Hamiltonian Evolution" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;hhl-algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3824" PostTypeId="2" ParentId="3823" CreationDate="2018-07-20T13:19:40.570" Score="6" Body="&lt;p&gt;I don't know why/how the authors of that paper do what they do. However, here's how I'd go about it for this special case (and it is a very special case):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write the Hamiltonian as a Pauli decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=15\mathbb{I}\otimes\mathbb{I}+9Z\otimes X+5X\otimes Z-3Y\otimes Y.&#xA;$$&lt;/span&gt;&#xA;&lt;strong&gt;Update:&lt;/strong&gt; It should be &lt;span class=&quot;math-container&quot;&gt;$+3Y\otimes Y$&lt;/span&gt;. But I don't want to redraw all my diagrams etc., so I'll leave the negative sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it is interesting to note that every one of these terms commutes. So, that means that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iA\theta}=e^{15i\theta}e^{9i\theta Z\otimes X}e^{5i\theta X\otimes Z}e^{-3i\theta Y\otimes Y}.&#xA;$$&lt;/span&gt;&#xA;You could work out how to simulate each of these steps individually, but let me make one further observation first: these commuting terms are the stabilizers of the 2-qubit cluster state. That may or may not mean anything to you, but it tells me that a smart thing to do is apply a controlled-phase gate.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CP\cdot A\cdot CP=15\mathbb{I}\otimes\mathbb{I}+9\mathbb{I}\otimes X+5X\otimes \mathbb{I}-3X\otimes X.&#xA;$$&lt;/span&gt;&#xA;(You may want to check the sign of the last term. I didn't compute it carefully.)&#xA;So, if we start and end our sequence with controlled-phase gates, then 2 of the terms are easy to get right: we rotate the first qubit about the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis by an angle &lt;span class=&quot;math-container&quot;&gt;$5\theta$&lt;/span&gt;, and the second qubit about the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis by an angle &lt;span class=&quot;math-container&quot;&gt;$9\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing we are left to get right is the &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt; rotation. If you think about the structure of &lt;span class=&quot;math-container&quot;&gt;$e^{-3i\theta X\otimes X}$&lt;/span&gt;, this is like an &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; rotation on the basis states &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|11\rangle\}$&lt;/span&gt;, and another one on &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt;. A controlled-not converts these bases into the single-qubit bases controlled off the target qubit. But since both implement the same controlled-rotation but controlled off opposite values, we can just remove the control. Thus, the overall circuit is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/YKwjo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YKwjo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;This simplifies slightly by combining the two controlled-gates at the end:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/f0g1A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f0g1A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Note that I have not included the global phase term here because that's not the sensible way to do it. When you make controlled-(&lt;span class=&quot;math-container&quot;&gt;$e^{iA\theta}$&lt;/span&gt;), you apply the &quot;global phase&quot; as a &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotation on the control qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-19T13:16:01.027" LastActivityDate="2018-10-19T13:16:01.027" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3826" PostTypeId="2" ParentId="3800" CreationDate="2018-07-20T16:27:30.640" Score="3" Body="&lt;p&gt;The current version of PyQuil provides an &quot;ISA&quot; object that houses the information that you want about Rigetti's quantun processors, but it isn't formatted as you request.  I'm a poor Python programmer, so you'll have to excuse my non-Pythonic-ness—but here's a snippet that will take a &lt;code&gt;device_name&lt;/code&gt; and reformat the pyQuil ISA into one of your dictionaries:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pyquil.api as p&#xA;&#xA;device_name = '19Q-Acorn'&#xA;&#xA;isa = p.get_devices(as_dict=True)[device_name].isa&#xA;d = {}&#xA;for qubit in isa.qubits:&#xA;    l = []&#xA;    for edge in isa.edges:&#xA;        if qubit.id is edge.targets[0]:&#xA;            l += [edge.targets[1]]&#xA;        if qubit.id is edge.targets[1]:&#xA;            l += [edge.targets[0]]&#xA;    if not qubit.dead:&#xA;        d[qubit.id] = l&#xA;&#xA;print(d)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As in Google's case, the native two-qubit gate typically available on a Rigetti quantum processor is a &lt;code&gt;CZ&lt;/code&gt;, which (1) is bidirectional(†) in the sense that &lt;code&gt;CZ q0 q1&lt;/code&gt; is the same as &lt;code&gt;CZ q1 q0&lt;/code&gt; and (2) is easily converted into either of your preferred &lt;code&gt;CNOT&lt;/code&gt;s by sandwiching the target with Hadamard gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;† - The physical implementation of a &lt;code&gt;CZ&lt;/code&gt; gate in a superconducting architecture &lt;em&gt;is&lt;/em&gt; handed, which is why you often see architectural descriptions include &lt;code&gt;CZ q0 q1&lt;/code&gt; but not &lt;code&gt;CZ q1 q0&lt;/code&gt;.  It's a shorthand for which qubit is participating in which half of the physical interaction, even if the result (ignoring noise effects) is the same with either ordering.&lt;/p&gt;&#xA;" OwnerUserId="1796" LastActivityDate="2018-07-20T16:27:30.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3828" PostTypeId="1" CreationDate="2018-07-20T18:28:00.140" Score="7" ViewCount="96" Body="&lt;p&gt;By &quot;faulty&quot;, I mean that you can have errors on the ancilla qubits, you can have faulty syndrome extraction, etc. &lt;/p&gt;&#xA;" OwnerUserId="108" LastEditorUserId="26" LastEditDate="2018-07-20T18:35:38.447" LastActivityDate="2018-07-23T15:11:32.863" Title="What are reliable references on analytical and/or numerical studies of threshold theorems under faulty quantum error correction?" Tags="&lt;error-correction&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3829" PostTypeId="2" ParentId="3821" CreationDate="2018-07-20T19:20:11.920" Score="3" Body="&lt;p&gt;I will tell you what my software Qubiter (&lt;a href=&quot;https://github.com/artiste-qb-net/qubiter&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub page&lt;/a&gt;) does. Others like IBM (QISKit &lt;a href=&quot;https://github.com/Qiskit/qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub page&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;website&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;), Google (Cirq &lt;a href=&quot;https://github.com/quantumlib/Cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub page&lt;/a&gt; and &lt;a href=&quot;https://cirq.readthedocs.io/en/latest/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;), Rigetti (PyQuil &lt;a href=&quot;https://github.com/rigetticomputing/pyQuil&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub page&lt;/a&gt; and &lt;a href=&quot;https://pyquil.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;) and Microsoft (Q# &lt;a href=&quot;https://github.com/Microsoft/Quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub page&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;) can describe what their own software does to help visualize the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qubiter automatically creates 2 files for the quantum circuit, a Qubiter qasm file and an ASCII picture file. This makes debugging easier (Qubiter can also draw fancy LaTex picture of circuit but that is slower so only optional) The ascii file and qasm file correspond line by line, so line 5 in each gives 2 representations, ascii and qasm, of the same gate. Note that it is common to draw pictures of quantum circuits with time pointing from left to right, but Qubiter draws them with time pointing downwards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for Teleportation, this is gif of the Qubiter qasm file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mEcwG.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mEcwG.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is a gif of the Qubiter ascii file:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xse46.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xse46.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The PRINT ALL statements print to screen the state vector of the qc at the time at which they appear.&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="1386" LastEditDate="2018-07-24T06:37:45.890" LastActivityDate="2018-07-24T06:37:45.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3830" PostTypeId="1" AcceptedAnswerId="3840" CreationDate="2018-07-21T15:57:50.173" Score="4" ViewCount="134" Body="&lt;p&gt;Reading about quantum topological error correction I’ve found some information, but I don’t have already clear the link with the topological concept (trivial and not trivial paths, how they are related with the error).&#xA;Can I have explanations or some link where conceptual meaning is explained?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="2886" LastEditorUserId="2645" LastEditDate="2018-07-23T10:26:36.400" LastActivityDate="2018-07-23T10:26:36.400" Title="topological error correction concepts" Tags="&lt;error-correction&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3832" PostTypeId="1" AcceptedAnswerId="3850" CreationDate="2018-07-21T19:20:13.640" Score="7" ViewCount="371" Body="&lt;p&gt;I found the following proof of BQP belonging to PP (the original document is &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/22.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). There is a part of the proof that I have trouble understanding. First, the structure is given below.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We try to simulate a polynomial-time generated quantum circuit&#xA;  (which encodes our problem) using a PP machine. We start with a&#xA;  universal set of gates. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;We have a Hadamard gate and a Toffoli gate. We also include a $i$-phase shift gate ($|0 \rangle$&#xA;  $\rightarrow |0 \rangle, |1 \rangle \rightarrow i|1 \rangle$). However,&#xA;  we simulate the action of this gate by considering an additional qubit&#xA;  and performing the following transformations:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$$|00 \rangle → |00 \rangle $$ $$|01 \rangle → |01 \rangle $$ &#xA;  $$|10\rangle→ |11 \rangle $$ $$|11 \rangle  →  −|10 \rangle $$&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The first qubit is viewed as the original qubit and the additional&#xA;  qubit acts as the &quot;real/imaginary part&quot;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;There is a register $B \leftarrow 0$ to store the phase. A register $Z$&#xA;  $\leftarrow 0^n$ stores the initial state of the machine. We simulate&#xA;  the circuit as follows:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\bullet$ If the gate is a Toffoli gate, simply modify $Z$&#xA;  accordingly.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\bullet$ If the gate is a Hadamard gate, flip a coin to determine the&#xA;  new state of the corresponding bit of $Z$. If the induced&#xA;  transformation was $1 \rightarrow 1$, toggle the sign bit.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\bullet$ If the gate is the two-qubit gate we used to replace the&#xA;  $i$-phase shift gate, modify $Z$ appropriately and toggle the sign bit&#xA;  if the transformation induced was $11 \rightarrow 10$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The steps above are repeated a second time, using variables $B'$ and&#xA;  $Z'$ in place of $B$ and $Z$. Finally, the following operations are&#xA;  performed:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\bullet$ If $Z = Z'$ and the first bit of $Z$ and $Z'$ is a $0$, then&#xA;  output $B ⊕ B'$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\bullet$ If $Z = Z'$ and the first bit of $Z$ and $Z'$ is a $1$, then&#xA;  output $\bar B ⊕ B'$.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;$\bullet$ If $Z \neq Z'$, then “give up”. This means: flip a fair coin&#xA;  and output $0$ or $1$ accordingly.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The claim is that the algorithm above simulates a BQP circuit on a PP machine faithfully as the probability the algorithm outputs $1$ minus the probability that the algorithm outputs $0$ is proportional to $\langle 1 | Q_x |1 \rangle - \langle 0 | Q_x |0 \rangle$ (where $Q_x$ is the quantum circuit for a given encoding $x$ from a polynomial-time generated uniform family of quantum circuits). I do not understand why the terms are proportional.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="26" LastEditDate="2019-03-04T10:15:47.453" LastActivityDate="2019-03-04T10:15:47.453" Title="Query regarding BQP belonging to PP" Tags="&lt;complexity-theory&gt;&lt;bqp&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3833" PostTypeId="2" ParentId="2724" CreationDate="2018-07-22T00:08:00.650" Score="4" Body="&lt;p&gt;I have not read it yet, however I don't imagine there is a better &lt;em&gt;introduction&lt;/em&gt; than &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/1492671185&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing for Babies&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/a3STU.jpg&quot; alt=&quot;quantum computing for babies&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-07-22T00:08:00.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3834" PostTypeId="2" ParentId="3828" CreationDate="2018-07-22T05:45:12.537" Score="2" Body="&lt;p&gt;This is the paper I found really convincing once I’d worked through it:&#xA;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504218&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0504218&lt;/a&gt;&#xA;This was really the start of rigorous threshold proofs, and is the starting point for a number of subsequent improvements.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-22T05:45:12.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3835" PostTypeId="1" AcceptedAnswerId="3839" CreationDate="2018-07-22T09:24:26.393" Score="6" ViewCount="776" Body="&lt;p&gt;Qubit and qumode are different forms of quantum computation. But most existing quantum computers/chips seems to be of discrete variables. I heard that a group chose qubit for a quantum optical frequency comb experiment relating to quantum computing because the environment noise of continuous variable is much higher. Is this a reason for preferring qubit to qumode at present (if people do prefer it)?&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="2293" LastEditDate="2018-07-22T21:33:40.003" LastActivityDate="2018-07-23T10:29:22.793" Title="Are qubits preferred over qumode, and if so, why?" Tags="&lt;physical-qubit&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3836" PostTypeId="2" ParentId="2505" CreationDate="2018-07-22T16:27:48.500" Score="0" Body="&lt;p&gt;The other answers were (almost?*) correct, and pointed me in the right direction for computing any probability for a measurement(especially the notion that I was measuring in the wrong basis), but I missed the definition. &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you are in state $|\psi\rangle$, and you want to know the probability of measuring outcome $|\phi\rangle$:&lt;br&gt;&#xA;$P=|\langle\psi|\phi\rangle|^2$ (&lt;a href=&quot;https://ocw.tudelft.nl/course-lectures/0-3-1-measuring-qubits-standard-basis/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ocw.tudelft.nl/course-lectures/0-3-1-measuring-qubits-standard-basis/&lt;/a&gt; @1:48)&lt;br&gt;&#xA;where $\langle\psi|$ is the complex conjugate transpose of the $|\psi\rangle$&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More, concrete, if we are in $T |+\rangle$ ($\equiv{1\over\sqrt 2} \begin{bmatrix}1\\e^{i\pi/4}\end{bmatrix}$), and want to know the probability of measuring $|+\rangle$ ($\equiv{1\over\sqrt 2}\begin{bmatrix} 1 \\ 1 \end{bmatrix})$, we calculate:&lt;br&gt;&#xA;$P=|{1\over\sqrt 2} \begin{bmatrix}1 &amp;amp; e^{-i\pi/4}\end{bmatrix}{1\over\sqrt 2}\begin{bmatrix} 1 \\ 1 \end{bmatrix}|^2$&lt;br&gt;&#xA;$P={1\over4}|1+e^{-i\pi/4}|^2 \approx 0.853553$ (or use Euler's formula for the exact outcome)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I hope I took the right complex conjugate. &lt;br&gt;&#xA;* I also have the $\psi$ and $\phi$ the other way around compared to DaftWullie his/her answer. &lt;/p&gt;&#xA;" OwnerUserId="2794" LastActivityDate="2018-07-22T16:27:48.500" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3837" PostTypeId="1" AcceptedAnswerId="3845" CreationDate="2018-07-22T17:20:36.160" Score="7" ViewCount="204" Body="&lt;p&gt;A lot of people claim that quantum provides exponential speedup whereas classical computers scale linearly. I have seen examples (such as Shor's algorithm and Simon's) that I believe, but the layman's explanation appears to boil down to &quot;quantum registers with n qubits are able to hold $2^n$ values.&quot; To me, this sounds a lot like having a SIMD (Single Instruction Multiple Data) CPU where I can load two times $2^n$ variables, and &lt;br&gt;&#xA;a) get the correct outcomes, and only these outcomes&lt;br&gt;&#xA;b) trace back which answer is to which questions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When trying to do this in quantum computing, I think this is definitely not the case. Let me try to evaluate this with an example: &lt;br&gt;&#xA;Say I have two 2-qubit registers , and I want to add two sets of values (2+1 and 1+2):&lt;br&gt;&#xA;$a|10\rangle + b|01\rangle$&lt;br&gt;&#xA;$a|01\rangle + b|10\rangle$&lt;br&gt;&#xA;where a denotes values in register a, and b denotes values in register b. Aka a and b are not scalars&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now look at the cubits, we see that all are once 0, and once 1. This implies a superposition of all qubits in our input. If we now were to do an addition on the two registers that both hold 2 qubits in superposition, and repeat this experiment sufficient enough times to create a probability distribution, I believe we would end up with a probability distribution for all outcomes as follows:&lt;br&gt;&#xA;$P(0) = 1/16 $&lt;br&gt;&#xA;$P(1) = 2/16 $&lt;br&gt;&#xA;$P(2) = 3/16 $&lt;br&gt;&#xA;$P(3) = 4/16 $&lt;br&gt;&#xA;$P(4) = 3/16 $&lt;br&gt;&#xA;$P(5) = 2/16 $&lt;br&gt;&#xA;$P(6) = 1/16 $&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at what we wanted to calculate, 2+1 and 1+2, we see that both our answers (two times the answer 3) are indeed present in the set of outcomes. However, &lt;br&gt;&#xA;a) there are a lot of other answers &lt;br&gt;&#xA;b) we can not trace which answer corresponds to 2+1, and which to 1+2&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my questions&lt;/strong&gt;:&lt;br&gt;&#xA;a) Is it correct that for the addition of two sets of randomly chosen variables, we are not guaranteed to see exponential scaling (unless we want to add all values 0 to 2^n with themselves)&lt;br&gt;&#xA;b) Is it correct that, when doing simple classical addition, we loose track of the mapping from input to output&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as a bonus, does the following hold:&lt;br&gt;&#xA;When performing the computation as above, the usability would be the same (or worse, as the mapping from input to output is lost) as a lookup table with the same number of input values, as when we have two registers in superposition, we will always receive the same output distribution&lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="26" LastEditDate="2018-07-22T20:27:37.677" LastActivityDate="2018-07-23T14:42:20.023" Title="Does &quot;quantum registers with $n$ qubits are able to hold $2^n$ values and therefore scale exponentially&quot; actually hold that straightforwardly?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3838" PostTypeId="2" ParentId="3837" CreationDate="2018-07-23T02:54:44.127" Score="1" Body="&lt;p&gt;I'm going to answer in two parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your example with addition, a quantum adder has been discussed in the question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1654/how-do-i-add-11-using-a-quantum-computer/1656#1656&quot;&gt;How do I add 1+1 using a quantum computer&lt;/a&gt;. They're a bit involved and I'm not sure if I exactly follow your line of thinking for your questions following your example, but hopefully that link explains a bit about how a quantum computer would handle addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to your more general question about quantum speedups, the important thing isn't that quantum computers can hold up to $2^n$ values in $n$ qubits, as that is also true in a classical computer. The important thing is that they can hold all these $2^n$ values &lt;em&gt;at once&lt;/em&gt;. A lot of quantum algorithms start by taking a register of $n$ qubits all in state $|0\rangle$ and applying a Hadamard transform to all bits. This leads to the register being in the state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\psi\rangle = \displaystyle\sum_{i=0}^{2^n-1}|i\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which can be fed into an algorithm and have it work on each piece simultaneously. If you look at &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/004-Quantum_Algorithms/070-Grover&amp;#39;s_Algorithm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this explanation of Grover's Algorithm&lt;/a&gt; you can see this at work. By plugging in this uniformly distributed $|\psi\rangle$ into a circuit which picks out a specific element, one can isolate that element without having to cycle through each of the possible $2^n$ values for $|i\rangle$ individually. Although Grover's algorithm isn't an exponential speedup, the same sort of structure holds for more complex algorithms as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully that helps!&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-07-23T03:03:52.507" LastActivityDate="2018-07-23T03:03:52.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3839" PostTypeId="2" ParentId="3835" CreationDate="2018-07-23T03:14:02.150" Score="4" Body="&lt;p&gt;Both models have their potential advantages and disadvantages. The CV model doesn't require energy intensive cooling systems. CV will also work better for continuous-valued problems. Nevertheless, since the model uses photons it brings various challenges to the table as well. Since both models (especially CV)  aren't developed, your question may not be the right one to ask right now. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested, I know that Xanadu is developing the CV model. They have some papers on CV algorithms and QML out right now. &lt;/p&gt;&#xA;" OwnerUserId="4181" LastEditorUserId="2293" LastEditDate="2018-07-23T10:29:22.793" LastActivityDate="2018-07-23T10:29:22.793" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3840" PostTypeId="2" ParentId="3830" CreationDate="2018-07-23T03:21:19.590" Score="4" Body="&lt;p&gt;This explanation of &lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;nofollow noreferrer&quot;&gt;Surface Codes&lt;/a&gt; has a lot of detail and starts from the basics. It should hopefully help out, as well as looking at some of the initial Toric Code papers by Alexei Kitaev.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of the term (hopefully someone more knowledgeable can chime in if I'm incorrect!) is that it's because the errors needed to create a logical error have to be non-local, and can be deviated. IE if you take the Toric code which exists on a torus, a logical operation is a loop of errors around the torus, which cannot be smoothly modified into a local error since the topology of the space prevents it.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="409" LastEditDate="2018-07-23T09:41:14.860" LastActivityDate="2018-07-23T09:41:14.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3841" PostTypeId="1" AcceptedAnswerId="3842" CreationDate="2018-07-23T04:01:33.140" Score="6" ViewCount="375" Body="&lt;p&gt;I'm just learning about quantum computer but some of it has been available for people to research &amp;amp; practice so I'd like to study it myself. The only kind of quantum computing I found so far is IBM cloud service and Q# quantum simulator but the sources and examples are limited, and I only found a bunch of display emoji &amp;amp; a card-guessing mini-game in quantum programming. Are there any main sources like GitHub but for quantum computing programming? &lt;/p&gt;&#xA;" OwnerUserId="4182" LastEditorUserId="26" LastEditDate="2019-05-10T17:57:44.893" LastActivityDate="2019-05-10T17:57:44.893" Title="Is there something like GitHub for quantum programming?" Tags="&lt;programming&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3842" PostTypeId="2" ParentId="3841" CreationDate="2018-07-23T04:09:59.037" Score="2" Body="&lt;p&gt;Are you looking for algorithms to look through, or programs for an actual quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the former the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt; user guide has good explanations of some of them, and other questions you can find on this Stack Exchange can get you to more algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for programs to be run on a quantum computer like IBM's cloud offerings, I'm not sure if there is a github specific to is, but looking into the &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorial&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; github would be a good place to start!&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-23T04:09:59.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3843" PostTypeId="2" ParentId="3841" CreationDate="2018-07-23T05:46:33.787" Score="6" Body="&lt;p&gt;For Q#, the largest GitHub repositories of algorithms written in Q# are the official &lt;a href=&quot;https://github.com/Microsoft/QuantumLibraries/&quot; rel=&quot;nofollow noreferrer&quot;&gt;libraries&lt;/a&gt; and &lt;a href=&quot;https://github.com/Microsoft/Quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;samples&lt;/a&gt; repos.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to start studying Q# by writing small quantum computing programs, there is &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas repo&lt;/a&gt;, it has less code and the code is simpler but it aims specifically to teach the basics.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-10T07:20:37.893" LastActivityDate="2019-05-10T07:20:37.893" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3844" PostTypeId="1" CreationDate="2018-07-23T07:13:07.000" Score="4" ViewCount="113" Body="&lt;p&gt;Say I have a quantum register containing 1 qubit. A qubit can hold either 0, 1 or both 0 and 1. In Dirac, one would write &lt;br&gt;&#xA;0: $|0\rangle=\begin{bmatrix}1\\0\end{bmatrix}$ &lt;br&gt;&lt;br&gt;&#xA;1: $|1\rangle=\begin{bmatrix}0\\1\end{bmatrix}$ &lt;br&gt;&lt;br&gt;&#xA;0 and 1: $|+\rangle={1\over\sqrt 2}\begin{bmatrix}1\\1\end{bmatrix}$ &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to extend our register to 2 qubits: &lt;br&gt;&#xA;0: $|00\rangle = |0\rangle \otimes |0\rangle = \begin{bmatrix}1\\0\end{bmatrix} \otimes \begin{bmatrix}1\\0\end{bmatrix} = \begin{bmatrix}1\\0\\0\\0\end{bmatrix}$ &lt;br&gt;&lt;br&gt;&#xA;1: $|01\rangle = |0\rangle \otimes |1\rangle = \begin{bmatrix}1\\0\end{bmatrix} \otimes \begin{bmatrix}0\\1\end{bmatrix} = \begin{bmatrix}0\\1\\0\\0\end{bmatrix}$ &lt;br&gt;&lt;br&gt;&#xA;0 and 1: $|0+\rangle = |0\rangle \otimes |+\rangle = \begin{bmatrix}1\\0\end{bmatrix} \otimes {1\over\sqrt 2}\begin{bmatrix}1\\1\end{bmatrix} = {1\over\sqrt 2}\begin{bmatrix}1\\1\\0\\0\end{bmatrix}$ &lt;br&gt;&lt;br&gt;&#xA;2: $|10\rangle = |1\rangle \otimes |0\rangle = \begin{bmatrix}0\\1\end{bmatrix} \otimes \begin{bmatrix}1\\0\end{bmatrix} = \begin{bmatrix}0\\0\\1\\0\end{bmatrix}$ &lt;br&gt;&lt;br&gt;&#xA;3: $|11\rangle = |1\rangle \otimes |1\rangle = \begin{bmatrix}0\\1\end{bmatrix} \otimes \begin{bmatrix}0\\1\end{bmatrix} = \begin{bmatrix}0\\0\\0\\1\end{bmatrix}$ &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if I would want to load the decimal values 1 and 2 in the quantum register, I have two ways of reasoning, of which one appears to be flawed: &lt;br&gt;&#xA;a)&lt;br&gt;&#xA;This is in line with the reasoning above for 1 qubit, section &quot;0 and 1&quot;: &lt;br&gt;&#xA;I want to add values $|01\rangle$ and $|10\rangle$. My first qubit is a 0 for the decimal value 1, and my first qubit is a 1 for the decimal value 2. This means my first qubit is both 0 and 1, and therefor $|+\rangle$. My second qubit is a 1 for decimal value 1, and a zero for decimal value 2, which also implies $|+\rangle$. Hence, I need to load &lt;br&gt;&#xA;$|++\rangle = &#xA;|+\rangle \otimes |+\rangle = &#xA;{1\over\sqrt 2}\begin{bmatrix}1\\1\end{bmatrix} \otimes {1\over\sqrt 2}\begin{bmatrix}1\\1\end{bmatrix} =&#xA;{1\over\sqrt 4}\begin{bmatrix}1\\1\\1\\1\end{bmatrix}$ &lt;br&gt;&#xA;Which provides me with 1 and 2, but also 0 and 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) &lt;br&gt;&#xA;$c ( |01\rangle + |10\rangle) = c( \begin{bmatrix}0\\1\\0\\0\end{bmatrix} + \begin{bmatrix}0\\0\\1\\0\end{bmatrix}) = c \begin{bmatrix}0\\1\\1\\0\end{bmatrix}$, where $c$ is likely ${1\over\sqrt 2}$&lt;br&gt;&#xA;Which provides me with 1 and 2 and only 1 and 2, and works out in mathematics, but fails in my current common sense. &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions:&lt;/strong&gt; Even though I see with math that b) holds and a) fails, can someone explain to me why this fails? Specifically, why is it that both individual qubits appear to be both 0 and 1, hence in superposition, but they are able to distinguish that as a total, only the decimal values 1 and 2 are present, and not 0,1,2 and 3 (which you would expect from 2 qubits in superposition).&lt;/p&gt;&#xA;" OwnerUserId="2794" LastActivityDate="2018-07-23T09:56:25.213" Title="Can a qubit register hold any subset of values, or only specific subsets?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3845" PostTypeId="2" ParentId="3837" CreationDate="2018-07-23T07:40:57.883" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Does “quantum registers with n&#xA;  qubits are able to hold $2^n$&#xA;  values and therefore scale exponentially” actually hold that straightforwardly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, it doesn't. That's the popularised explanation of where quantum computers get their speed-up, but it's far more nuanced than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate this, imagine you have a function $f:x\in\{0,1\}^n\mapsto y\in\{0,1\}^m$. Sure, in quantum you can produce the state&#xA;$$&#xA;|\Psi\rangle=\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}|x\rangle|f(x)\rangle&#xA;$$&#xA;so, in some sense,the function $f$ has been evaluated at every $x$. But what answers can you get? What you certainly cannot read out is every different value of $f(x)$: when you measure (assuming projective measurements) you get a maximum of 1 bit of information for every measurement, $n+m$ bits. But there are $2^n$ inputs, each with $m$ bits to learn, so you need to be able to determine $m2^n$. This is not really any better than doing things classically (in a sense, it's a bit worse because a single measurement will pick an $x$ at random, but classically you'd normally only get the $m$ bits of information from the final outcome).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real power of quantum computation comes from doing something clever with that state $|\Psi\rangle$. This usually relies on some special properties that you know about $f(x)$, such as &quot;it has a global property which is parametrised by $k$. Find $k$.&quot;. For example, in the Deutsch-Jozsa algorithm, the structure is that either all $f(x)$ are the same, or there's a perfect 50:50 split between answers (Here, $k$ is one bit of information). That sort of comparison between different function evaluations in a classical domain obviously needs lots of different function evaluations, whereas in the quantum domain, sometimes one can perform the right measurement that compares different parts of the superposition and gives you the right information out. &lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-23T14:42:20.023" LastActivityDate="2018-07-23T14:42:20.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3846" PostTypeId="1" AcceptedAnswerId="3849" CreationDate="2018-07-23T09:39:31.433" Score="5" ViewCount="448" Body="&lt;p&gt;As far I understand, qubits in cirq are labelled by their positions on chip. For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print( cirq.google.Foxtail.qubits )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;yields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;frozenset({GridQubit(0, 1), GridQubit(1, 9), GridQubit(0, 2), ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I would like to get a simpler version of the above, namely a simple array of tuples for the positions of all qubits&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ (0,1), (0,2), (0,3), ..., (1,1), (1,2), (1,3), ... ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the easiest way to obtain this for a given known device in cirq?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-07-23T12:16:52.547" Title="List of qubit locations with cirq" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3847" PostTypeId="2" ParentId="3844" CreationDate="2018-07-23T09:56:25.213" Score="2" Body="&lt;p&gt;What you're discovering here is the phenomenon of &lt;em&gt;entanglement&lt;/em&gt;: (Pure) States that cannot be constructed using the tensor product of states of smaller systems. Entanglement typically contains some sort of collective property that cannot be accessed by just acting on one qubit (here, measurement outcomes are always anti-correlated)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, a pure single-qubit system can be described by any normalised vector in $\mathbb{C}^2$, i.e. $\left(\begin{array}{c} \alpha \\ \beta \end{array}\right)$ provided $|\alpha|^2+|\beta|^2=1$. Talking about &quot;0 and 1&quot; is already problematic. Clearly you're thinking about &quot;an equal superposition of 0 and 1&quot;. Now, for two qubits, we can have any normalised state in $\mathbb{C}^4$, which clearly has many more possibilities than the tensor products of two single-qubit states (just count the number of parameters). So, sure, you can ask for &quot;an equally weighted superposition of 01 and 10&quot;, and you'll get exactly what you had in (b): $(|01\rangle+|10\rangle)/\sqrt{2}$. If you try and create a normalised state with equal amplitudes for those two components using a state $|\psi\rangle\otimes|\phi\rangle$, you will necessarily have $|00\rangle$ and $|11\rangle$ components a well, so the state you've specified will be a superposition of all 4 possible basis states, not just the 2 that you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's also take it from the other perspective: let's say I've made $|+\rangle\otimes|+\rangle$. Now let's say that I measure in the computational basis and get the 0 answer. What's my state now? $|0\rangle\otimes|+\rangle$. If I measure the second qubit, I have a 50% change of getting the 0 answer. With a string 00 as my outcome, that certainly does not fulfil your requirement of being a bit 01 or 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond that, I'm not quite sure what your question is asking. &quot;Why&quot; is probably either something incredibly deep (that probably nobody understands) or it's &quot;because the maths says so&quot;. You should probably bear in mind that quantum mechanics is a theory. It's a theory that starts from some postulates, which automatically imply a whole bunch of mathematics. Why we pick those postulates is either an issue of philosophy &quot;why is the world the way it is?&quot; or a very practical &quot;we did some experiments, and this seems to fit&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-23T09:56:25.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3848" PostTypeId="2" ParentId="3841" CreationDate="2018-07-23T11:41:46.320" Score="4" Body="&lt;p&gt;There is no GitHub like service dedicated to quantum programming. It is all on standard GitHub.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most useful examples are on the repositories for the quantum SDKs (IBM's &lt;a href=&quot;https://github.com/Qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKit&lt;/a&gt;, &lt;a href=&quot;https://github.com/rigetticomputing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rigetti's Forest&lt;/a&gt;, Microsoft's &lt;a href=&quot;https://github.com/Microsoft/Quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q#&lt;/a&gt;, Google's &lt;a href=&quot;https://github.com/quantumlib/Cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt;, and &lt;a href=&quot;https://github.com/projectq-framework&quot; rel=&quot;nofollow noreferrer&quot;&gt;ProjectQ&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For QISKit, the tutorial has quite a large number of examples. Beyond the simple 'Hello World' example, most resources are found in the &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorial/tree/master/reference&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference&lt;/a&gt; folder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll also find things scattered around on the pages of single GitHub users. To find these, you could try looking at who has forked the SDKs or participated in quantum hackathons.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="119" LastEditDate="2019-05-10T17:31:03.983" LastActivityDate="2019-05-10T17:31:03.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3849" PostTypeId="2" ParentId="3846" CreationDate="2018-07-23T12:08:08.727" Score="7" Body="&lt;p&gt;&lt;code&gt;GridQubit&lt;/code&gt; has comparison methods defined, so &lt;code&gt;sorted&lt;/code&gt; will give you a list of the qubits in row-major order:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; sorted(cirq.google.Foxtail.qubits)&#xA;[GridQubit(0, 0), GridQubit(0, 1), [...] GridQubit(1, 9), GridQubit(1, 10)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Once you have that, you're one list comprehension away:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; [(q.row, q.col) for q in sorted(cirq.google.Foxtail.qubits)]&#xA;[(0, 0), (0, 1), [...] (1, 9), (1, 10)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because tuples also have a default ordering, it doesn't matter whether you sort before or after the conversion:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; sorted((q.row, q.col) for q in cirq.google.Foxtail.qubits)&#xA;[(0, 0), (0, 1), [...] (1, 9), (1, 10)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-07-23T12:16:52.547" LastActivityDate="2018-07-23T12:16:52.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3850" PostTypeId="2" ParentId="3832" CreationDate="2018-07-23T12:51:34.690" Score="7" Body="&lt;p&gt;Two quick comments before explaining this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The notes don't actually contain a proof of the claim made about the simulation; the intention was only to give a basic idea of how the simulation works. It is therefore not at all surprising that the mathematical justification is not clear, because the notes didn't even try to explain it. (It was the last lecture of the course and there just wasn't time to go over it in detail.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The notation is a little bit unusual here: we're interpreting $Q_x$ as the one-qubit mixed state output by the circuit corresponding to $x$, so $\langle 1 | Q_x | 1 \rangle$ is the probability that $Q_x$ outputs 1 and $\langle 0 | Q_x | 0 \rangle$ is the probability that $Q_x$ outputs 0. The point is that we want the probability that our algorithm outputs 1 minus the probability it outputs 0 to be proportional to the probability the circuit outputs 1 minus the probability it outputs zero.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Moving on to the actual question, let us suppose that $x$ is fixed so that we can just talk about a single quantum circuit $Q$ that acts on $n$ qubits and has $t$ gates of the type described in the question: Hadamard gates, Toffoli gates, and these two-qubit gates that mimic phase shift gates. (You can ignore these if you want, so long as you accept that Toffoli and Hadamard gates are universal for quantum computation. The point is that we do not want to deal with non-real numbers.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, consider a sequence of binary strings $(y_0,\ldots,y_t)$, where each of these strings has length $n$ and there are $t+1$ strings in total. We can think of such a sequence as a possible &lt;em&gt;computation path&lt;/em&gt; through the circuit, where $y_0$ represents a classical state of $n$ qubits at time 0, $y_1$ represents a classical state of $n$ qubits at time 1, and so on. Let us call such a path &lt;em&gt;valid&lt;/em&gt; if $y_0 = 0^n$ and, for every choice of $k\in\{1,\ldots,t\}$, the $k$-th gate of $Q$ takes $|y_{k-1}\rangle$ to $|y_k\rangle$ with a nonzero amplitude. (Given our limited choice of gates, this nonzero amplitude will always be $\pm 1$ or $\pm 1/\sqrt{2}$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Associated with any such path $P = (y_0,\ldots,y_t)$ is an amplitude $\alpha(P)$. Given the gates we are considering, the amplitude $\alpha(P)$ for each valid path $P$ will always take the form&#xA;$$&#xA;\alpha(P) = \frac{s(P)}{2^{m/2}}&#xA;$$&#xA;where $s(P)\in\{-1,+1\}$ and $m$ is the total number of Hadamard gates in the circuit. The probability that the circuit outputs a string $z\in\{0,1\}^n$ is equal to&#xA;$$&#xA;\left(\sum_P \alpha(P)\right)^2&#xA;= \frac{1}{2^m} \sum_P \sum_Q s(P) s(Q),&#xA;$$&#xA;where in these sums $P$ and $Q$ range only over the valid paths that end at $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the probabilistic algorithm. We can again consider paths of the same form as before: $P = (y_0,\ldots,y_t)$. This time, think of these strings as the sequences of states of the register $Z$. The probability associated with each valid path $P$ will be $2^m$, and the bit $B$ will always track the sign of the corresponding amplitude, so that after running through all of the gates you will have $B = 0$ if $s(P) = +1$ and $B = 1$ if $s(P) = -1$. The same reasoning is applied, independently, to $Z'$ and $B'$ for the second run through the process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for a particular choice of a final string $z\in\{0,1\}^n$, consider the situation in which both paths $P$ and $P'$ end in $z$, and look at the binary value $B\oplus B'$. This value is 0 if $B$ and $B'$ are equal, which is the same as saying $s(P)s(Q) = +1$, and 1 if $B$ and $B'$ are different, which is the same as saying $s(P)s(Q) = -1$. Therefore, if the final string contained in $Z$ and $Z'$ is $z$, then the probability that the algorithm outputs 0 minus the probability that it outputs 1 is&#xA;$$&#xA;\frac{1}{2^{2m}} \sum_P \sum_Q s(P) s(Q),&#xA;$$&#xA;where again we're restricting the sums to valid paths $P$ and $Q$ that end at $z$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the final strings of $Z$ and $Z'$ are different, the algorithm just outputs a random bit, so the probability of outputting 0 minus the probability it outputs 1 is zero, so there's effectively no contribution to the bias of the output in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, consider the probabilities as we range over all possible final strings $z$. For those strings beginning with 0, which represent the quantum circuit outputting 0, the expression above is the probability that the algorithm outputs 0 minus the probability it outputs 1. For choices of $z$ beginning with 1, which corresponds to the quantum circuit outputting 1, the algorithm flips the output ($1\oplus B \oplus B'$ would have been a better way to write it than $\overline{B}\oplus B'$). Summing everything up, the probability that the algorithm outputs 1 minus the probability it outputs 0 is exactly $2^{-m}$ times the probability that the quantum circuit outputs 1 minus the probability if outputs zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This argument is based on the original proof of $\text{BQP}\subseteq\text{PP}$ found in this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Adleman, DeMarrais, and Huang. Quantum Computability. SIAM Journal on Computing 26(5):&#xA;  1524-1540, 1997.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-07-23T12:51:34.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3851" PostTypeId="2" ParentId="3828" CreationDate="2018-07-23T15:11:32.863" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1804.01127.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; by one of my group mates includes faulty prep on ancilla qubits and other errors in an analysis of Bacon Shor. I'm not sure what you mean by faulty error extraction (measurement errors?) but it has an explanation of the error model.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-23T15:11:32.863" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3852" PostTypeId="1" CreationDate="2018-07-23T16:16:38.993" Score="2" ViewCount="1054" Body="&lt;p&gt;Are there schematics and/or diagrams out there to build a very basic quantum system? &lt;/p&gt;&#xA;" OwnerUserId="4164" LastEditorUserId="26" LastEditDate="2018-12-14T05:26:05.627" LastActivityDate="2018-12-14T05:26:05.627" Title="Is it possible to purchase quantum computing hardware?" Tags="&lt;architecture&gt;&lt;physical-realization&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ClosedDate="2018-07-27T18:41:54.830" ContentLicense="CC BY-SA 4.0" />
  <row Id="3853" PostTypeId="2" ParentId="1474" CreationDate="2018-07-23T16:54:14.100" Score="3" Body="&lt;p&gt;Unfortunately, the list on Quantiki is pretty old and not well maintained. Even listing all quantum programming languages in a single reply to this question isn't sustainable since the quantum landscape is constantly evolving. For example, Google has just released &lt;a href=&quot;https://github.com/quantumlib/Cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt;, a new quantum programming framework for Noisy Intermediate Scale Quantum (NISQ) computers which isn't featured in any of the above replies since it was announced only a couple of days ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To address this problem and as a response to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1918/does-a-complete-list-of-open-quantum-software-projects-exist/1923#1923&quot;&gt;another question&lt;/a&gt; on QC StackExchange I started a &lt;a href=&quot;https://github.com/markf94/os_quantum_software&quot; rel=&quot;nofollow noreferrer&quot;&gt;curated list of open-source software projects on GitHub&lt;/a&gt; which also includes a comprehensive overview of actively developed quantum programming languages and frameworks. The list is actively maintained by the community and we constantly add new projects.&lt;/p&gt;&#xA;" OwnerUserId="1234" LastActivityDate="2018-07-23T16:54:14.100" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3854" PostTypeId="2" ParentId="3821" CreationDate="2018-07-23T17:02:06.530" Score="1" Body="&lt;p&gt;Additional to the projects you mentioned in your question, the following projects come to my mind:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Toronto-based quantum computing startup Xanadu has recently released a great &lt;a href=&quot;https://strawberryfields.ai/&quot; rel=&quot;nofollow noreferrer&quot;&gt;visual &amp;amp; interactive quantum simulator&lt;/a&gt; on the web.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there is &lt;a href=&quot;https://github.com/jacobmarks/QTop&quot; rel=&quot;nofollow noreferrer&quot;&gt;QTop&lt;/a&gt; which is a great tool for the simulation and visualization of topological quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="1234" LastActivityDate="2018-07-23T17:02:06.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3855" PostTypeId="2" ParentId="3773" CreationDate="2018-07-23T17:05:19.117" Score="4" Body="&lt;p&gt;There is &lt;a href=&quot;https://github.com/jacobmarks/QTop&quot; rel=&quot;nofollow noreferrer&quot;&gt;QTop&lt;/a&gt; which is an open-source project that can simulate but also visualize topological quantum codes.&lt;/p&gt;&#xA;" OwnerUserId="1234" LastActivityDate="2018-07-23T17:05:19.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3856" PostTypeId="2" ParentId="3852" CreationDate="2018-07-23T17:07:35.003" Score="0" Body="&lt;p&gt;Considering that they are currently experiments in different labs, with the &lt;a href=&quot;https://thenextweb.com/artificial-intelligence/2018/03/06/google-reclaims-quantum-computer-crown-with-72-qubit-processor/&quot; rel=&quot;nofollow noreferrer&quot;&gt;record&lt;/a&gt; of around 72 qubit, they are yet very far from a product which can be sold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can choose from a &lt;a href=&quot;https://quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;long list&lt;/a&gt; of different emulators/simulators.&lt;/p&gt;&#xA;" OwnerUserId="27" LastActivityDate="2018-07-23T17:07:35.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3857" PostTypeId="2" ParentId="3852" CreationDate="2018-07-23T17:40:18.530" Score="2" Body="&lt;p&gt;The only commercially available quantum machines are from a  company called &lt;a href=&quot;https://www.dwavesys.com/home&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave&lt;/a&gt; however there is debate on exactly how &quot;quantum&quot; their machines are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;True quantum computers in the way most of the community looks at them are not available for physical purchase, although IBM's &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q Experience&lt;/a&gt; allows you to use their quantum computing resources through the cloud.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of trying to DIY a quantum computer we are a long way from such a goal being viable.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-23T17:40:18.530" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3859" PostTypeId="1" CreationDate="2018-07-24T00:11:30.247" Score="7" ViewCount="77" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1203.4740&quot; rel=&quot;noreferrer&quot;&gt;Aaronson and Christiano&lt;/a&gt; call public-key or private-key quantum mini-schemes $\mathcal M$ &lt;strong&gt;secret-based&lt;/strong&gt; if a mint works by &lt;em&gt;first&lt;/em&gt; uniformly generating a secret random classical strings $r$, and &lt;em&gt;then&lt;/em&gt; generating a banknote $\$:=(s_r,\rho_r)$, where $s_r$ is a (classical) serial number corresponding to the quantum state $\rho_r$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They state: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Intuitively, in a secret-based scheme, the bank can generate many identical banknotes $s$ by simply reusing $r$, while in a non-secret-based scheme, &lt;strong&gt;not even the bank&lt;/strong&gt; might be able to generate two identical banknotes. （emphasis in original).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In characterizing a putative distributed quantum currency based on Aaronson and Christiano's secret-based scheme, &lt;a href=&quot;https://arxiv.org/abs/1604.01383&quot; rel=&quot;noreferrer&quot;&gt;Jogenfors&lt;/a&gt; describes a &quot;reuse attack.&quot;  For example he colorfully envisions someone, say Alice, who has minted and distributed a coin $\$_r$, and learns that the coin is in possession of a political rival Bob; she uses her secret knowledge of $r$ to mint and distribute a large number of identical coins $\$_r$, thus devaluing the coins in Bob's possession.  Jogenfors describes a novel approach to prevent this attack, for example as discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1323/quantum-bitcoin-subdivision?rq=1&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, would the above attack even work with a non-secret-based scheme?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If not even Alice can produce copies of her own coins that she's minted, then she has no way devaluing any others that have been distributed.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-28T13:36:04.847" LastActivityDate="2019-04-28T13:36:04.847" Title="Are non-secret-based quantum money mini-schemes susceptable to Jogenfors' &quot;reuse attack?&quot;" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;cryptocurrency&gt;&lt;quantum-money&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3860" PostTypeId="1" AcceptedAnswerId="3862" CreationDate="2018-07-24T14:48:21.823" Score="5" ViewCount="549" Body="&lt;p&gt;I want to simulate an arbitrary isolated quantum circuit acting on $n$ qubits (i.e. a pure state of $n$ qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I know RAM is the bottleneck for quantum simulators, you can consider a &quot;normal&quot; computer to have between $4$ and $8$ Gio of RAM, all the other components are considered sufficiently powerful to not be the bottleneck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this definition of a &quot;normal&quot; computer, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the maximum value of $n$ (the number of qubits) for which an arbitrary quantum circuit is simulable in a reasonable time ($&amp;lt;1\text{h}$) with a normal computer and freely accessible simulators?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="26" LastEditDate="2018-12-23T12:36:30.260" LastActivityDate="2018-12-23T12:36:30.260" Title="How many qubits are simulable with a normal computer and freely accessible simulators?" Tags="&lt;simulation&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3861" PostTypeId="1" CreationDate="2018-07-24T15:30:19.280" Score="6" ViewCount="309" Body="&lt;p&gt;Given an arbitrary $n$-qudit state vector $|\psi\rangle =\sum_i c_i| i \rangle \in \mathbb{C}_d^n$ for some orthonormal basis $\{|i\rangle\}$, what is the most efficient way one can:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Verify whether the state is a stabilizer state (i.e. can be defined by $n \leq m \leq 2n$ stabilizer generators, with equality for $d=2$), and if so,&lt;/li&gt;&#xA;&lt;li&gt;Find the state's stabilizer generators (in the form of some tensor product of local Pauli matrices).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-25T22:32:31.570" LastActivityDate="2018-07-25T22:32:31.570" Title="Stabilizer state verification and specification from state vector" Tags="&lt;quantum-state&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="17" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3862" PostTypeId="2" ParentId="3860" CreationDate="2018-07-24T16:10:11.297" Score="5" Body="&lt;p&gt;This answer doesn't directly answer the question (I have little experience of &lt;em&gt;real&lt;/em&gt; simulators with practical overheads etc.), but here's a theoretical upper bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume that you need to store the whole state vector of $k$ qubits in memory. There are $2^n$ elements that are complex numbers. A complex number requires 2 real numbers, and a real number occupies &lt;a href=&quot;https://code.tutsplus.com/tutorials/understand-how-much-memory-your-python-objects-use--cms-25609&quot; rel=&quot;nofollow noreferrer&quot;&gt;24 bytes in python&lt;/a&gt;. Let's say we want to cram this into $4\times 10^9$ bytes of RAM (probably leaving a few over for your operating system etc.) Hence,&#xA;$$&#xA;48\times 2^n\leq 4\times 10^9&#xA;$$&#xA;Rearrange for $n$ and you have $n\leq26$ qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that applying gates in a quantum circuit is relatively inexpensive memory-wise. See the &quot;Efficiency Improvements&quot; section in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1970/1837&quot;&gt;this answer&lt;/a&gt;. From that strategy, one should be able to estimate the time it takes to apply a single one- or two-qubit gate to an $n$-qubit system, and hence how many gates you might expect to fit within some times limit (an hour is very modest, but would certainly serve for illustrative purposes).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-25T09:20:33.797" LastActivityDate="2018-07-25T09:20:33.797" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="3863" PostTypeId="1" CreationDate="2018-07-24T17:42:17.647" Score="13" ViewCount="359" Body="&lt;p&gt;As part of a variational algorithm, I would like to construct a quantum circuit (ideally with &lt;a href=&quot;https://github.com/rigetticomputing/pyquil/&quot; rel=&quot;noreferrer&quot;&gt;pyQuil&lt;/a&gt;) that simulates a Hamiltonian of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H = 0.3 \cdot Z_3Z_4 + 0.12\cdot Z_1Z_3 + [...] + &#xA;- 11.03 \cdot Z_3 - 10.92 \cdot Z_4 + \mathbf{0.12i \cdot Z_1 Y_5 X_4}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to the last term, the problem is that pyQuil throws the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;TypeError: PauliTerm coefficient must be real&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started diving into the literature and it seems like a non-trivial problem. I came across &lt;a href=&quot;https://arxiv.org/abs/1701.05182&quot; rel=&quot;noreferrer&quot;&gt;this paper on universal quantum Hamiltonians&lt;/a&gt; where complex-to-real encodings as well as local encodings are discussed. However, it is still not clear to me how one would practically implement something like this. Can anyone give me some practical advice how to solve this problem?&lt;/p&gt;&#xA;" OwnerUserId="1234" LastEditorUserId="26" LastEditDate="2019-01-31T19:25:38.043" LastActivityDate="2019-01-31T19:25:38.043" Title="Hamiltonian simulation with complex coefficients" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;pyquil&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3865" PostTypeId="1" CreationDate="2018-07-24T19:21:03.107" Score="5" ViewCount="91" Body="&lt;p&gt;According to &lt;a href=&quot;https://arxiv.org/abs/1703.05342&quot; rel=&quot;nofollow noreferrer&quot;&gt;J. Gough&lt;/a&gt;, one of the bottlenecks in the current development of large-scale quantum computing may be the lack of our ability to simulate large scale quantum system, which is a NP-hard problem and also requires exponential memory with classical hardware if I understand correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm currently developing a certain powerful discrete approximate algorithm. In principle, it can, for example, find an approximate solution for a given quantum Ising model efficiently or optimize the configuration of quantum gates to minimize the error a la &lt;a href=&quot;https://arxiv.org/abs/1512.00674&quot; rel=&quot;nofollow noreferrer&quot;&gt;U. Las Heras et. al.&lt;/a&gt; by replacing its GA with mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Can we reduce digital/analog quantum simulation to a NP-hard discrete optimization problem (like solving Ising model), so that it can be approximately solved by a classical algorithm using classical device?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) What are some other crucial bottlenecks? Do they need discrete optimization? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I guess one of other bottlenecks is quantum error correction, which was already mentioned above. &lt;/p&gt;&#xA;" OwnerUserId="4193" LastEditorUserId="4193" LastEditDate="2018-07-25T16:09:20.883" LastActivityDate="2018-07-25T16:09:20.883" Title="Application of classical approximate optimization algorithm to bottlenecks of quantum computing" Tags="&lt;simulation&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3866" PostTypeId="5" CreationDate="2018-07-24T22:35:28.237" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2018-07-24T22:35:28.237" LastActivityDate="2018-07-24T22:35:28.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3867" PostTypeId="4" CreationDate="2018-07-24T22:35:28.237" Score="0" Body="Stabilizer states are quantum states that can be efficiently represented by some set of Pauli operators of which the state is a +1 eigenstate. Stabilizer states are used commonly in many areas of quantum computation, such as error correction, teleportation and state verification." OwnerUserId="391" LastEditorUserId="391" LastEditDate="2018-07-26T15:59:14.607" LastActivityDate="2018-07-26T15:59:14.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3868" PostTypeId="2" ParentId="3861" CreationDate="2018-07-25T10:49:17.817" Score="2" Body="&lt;p&gt;Here's a necessary condition that might help recognise potential stabilizer states. I'll state it for qubits as that's what I'm used to thinking about, but I suspect it  can be generalised:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;all the non-zero amplitudes of a stabilizer state must have the same magnitude.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To see this, let's assume that the state $|\psi\rangle$ is an $n$-qubit stabilizer state with linearly independent stabilizers $\Lambda=\{K_i\}_{i=1}^n$. In other words, $K_i|\psi\rangle=|\psi\rangle$, $K_i=K_i^\dagger$ and $[K_i,K_j]=0$. Let $x,y\in\{0,1\}^n$ be such that $\langle x|\psi\rangle\neq 0$ and $\langle y|\psi\rangle\neq 0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider&#xA;$$&#xA;|\psi\rangle\langle \psi|x\rangle=\left(\frac{1}{2^n}\prod_{K\in\Lambda}(\mathbb{I}+K)\right)|x\rangle&#xA;$$&#xA;If we multiply out the terms, there are all the different possible products of subsets of stabilizers, each turning $|x\rangle$ into a (possibly different) basis state. Hence, there is at least one subset $S\subseteq\Lambda$ such that $\left(\prod_{K\in S}K\right)|x\rangle=|y\rangle$ up to a global phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, what is the amplitude we're after?&#xA;$$&#xA;\langle x|\psi\rangle=\langle x|\left(\prod_{K\in S}K\right)|\psi\rangle=\langle y|\psi\rangle&#xA;$$&#xA;up to a global phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably this could put you on a route towards a better-than-brute-force algorithm for determining the stabilizers (I haven't done this myself, hence some vagueness in the statement). If you have a binary string of each of the non-zero basis elements, and the corresponding phase, you know a lot about the group generated by $\Lambda$. A bit of linear algebra should allow you to extract the generators. I would guess that there's even an argument a bit like the one in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2141/1837&quot;&gt;Simon's algorithm&lt;/a&gt; that says you don't need more than $O(n)$ of those basis elements in order to extract the group generators. I'm not sure if this will give you all the information, or just the information about bit-flips. You may also need a Hadamard-rotated version of the state in order to determine the phase flips in the stabilizers.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-25T10:49:17.817" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3869" PostTypeId="1" CreationDate="2018-07-26T05:44:24.210" Score="3" ViewCount="84" Body="&lt;p&gt;I am very interested in this field right now, due to the quantum advantage &#xA;and would like some helpful nudges in the right direction i.e. where should I start from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: I have some background in software engineering and subpar knowledge in math and physics.&lt;/p&gt;&#xA;" OwnerUserId="4207" LastEditorUserId="2484" LastEditDate="2019-02-15T23:02:02.490" LastActivityDate="2019-02-15T23:02:02.490" Title="Any tips on where to start learning quantum computing?" Tags="&lt;resource-request&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ClosedDate="2018-07-26T07:34:48.663" ContentLicense="CC BY-SA 4.0" />
  <row Id="3870" PostTypeId="2" ParentId="3863" CreationDate="2018-07-26T09:31:54.917" Score="3" Body="&lt;p&gt;This simple MATLAB/Octave code shows that $i0.12Z_1Y_2X_3$ is not Hermitian:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z=[1 0 ; 0 -1];&#xA;x=[0 1;  1  0];&#xA;y=[0 -1i; 1i 0];&#xA;&#xA;z1 = kron(z,eye(4));&#xA;y2 = kron(kron(eye(2),y),eye(2));&#xA;x3 = kron(eye(4),x);&#xA;&#xA;H=0.12*1i*z1*y2*x3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is H:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    0     0    0 0.12    0    0     0     0&#xA;    0     0 0.12    0    0    0     0     0&#xA;    0 -0.12    0    0    0    0     0     0&#xA;-0.12     0    0    0    0    0     0     0&#xA;    0     0    0    0    0    0     0 -0.12&#xA;    0     0    0    0    0    0 -0.12     0&#xA;    0     0    0    0    0 0.12     0     0&#xA;    0     0    0    0 0.12    0     0     0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since it's a real matrix, Hermitian means symmetric, but this is not symmetric and therefore not Hermitian. The top-right triangle isn't equal to the bottom-right triangle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the top-right triangle is the &lt;strong&gt;&lt;em&gt;negative&lt;/em&gt;&lt;/strong&gt; of the bottom-right triangle, so it is anti-Hermitian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So doing AHussain's suggestion of adding the conjugate transpose, results in 0. Just run this command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H + H'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and you will get an 8x8 matrix of 0's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you make your Hamiltonian Hermitian by adding the conjugate transpose, you get 0 for this term, and &lt;strong&gt;&lt;em&gt;therefore you do not need to have any imaginary coefficients&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-26T09:31:54.917" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="3871" PostTypeId="1" CreationDate="2018-07-26T16:12:40.003" Score="7" ViewCount="1785" Body="&lt;p&gt;Among available qubit technologies for universal quantum computing these 3 come up as promising. NV centers and Majorana qubits also underway but relatively new. &#xA;I find superconducting qubits and Trapped Ion qubits very hard to scale. Also T1(decoherence) and T2 (dephasing) for superconducting qubits is very less (us).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being a non-physicist, I am not able to exactly locate good sources to convince myself why is one technology preferred over the other? I would really appreciate if you can direct me to relavant literature available on this topic.&lt;/p&gt;&#xA;" OwnerUserId="2391" LastEditorUserId="55" LastEditDate="2020-09-04T09:31:40.770" LastActivityDate="2020-09-04T09:31:40.770" Title="What are the pros/cons of Trapped Ion Qubits, Superconducting Qubits and Si Spin Qubits?" Tags="&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;&lt;models&gt;&lt;majorana-particle&gt;&lt;nv-centers&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3872" PostTypeId="1" AcceptedAnswerId="3876" CreationDate="2018-07-26T16:25:26.450" Score="8" ViewCount="651" Body="&lt;p&gt;I understand that right now qubits are physical entities in a Quantum Computer and I am playing around on the IBM Quantum Computer as well as the Q# language and dipping my toes into the Quantum world for the first time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read a lot of the Alice and Bob style scenarios where it often mentions transporting a qubit from Alice to Bob. I am inferring that as physically transporting it but I haven't found a discussion on what this looks like from a computing sense. As in how it could be theoretically achieved to &quot;package&quot; a qubit, or even a representation of a qubit (state or values) for transportation via a Classical or Quantum channel? I am assuming the only way this is possible is via entanglement and teleportation. Is it possible for non-entangled, ordinary qubits, to be represented in some format and transferred logically between two points, whereby the receiving point can decode and interpret the information contained within. That receiving point could be a computer service in a Classical computer architecture or another Quantum machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ask this in the sense of Classical Computing, where we can encode bits onto a chip but logically represent a bit (or series of bits) in numerous formats and transfer them for manipulation. As a software engineer that's where my thought process is coming from. This might not be a practical thing to want to do in Quantum but in theory, is it something that could be achieved? Any guidance would be welcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &#xA;Thank you for the really comprehensive answers, it has filled in a lot of gaps and I did not realise the strong link between photons &amp;amp; fiber which brings a potential bridge in theory. I'm working my way through the basic hello world applications and was trying to mentally bridge my software knowledge of Classical into this world at a basic transfer and representation level.  I'm trying to build some small apps that bridge both worlds and my mental block right now is representing the characteristics of a qubit in traditional programming notations. Have you any thoughts on what would need to be modelled to create a logical representation of a qubit? What I am getting at is something similar to a specification that would allow a programmer represent a type (like a String e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/String_(computer_science)&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/String_(computer_science)&lt;/a&gt;). In the Quantum programming languages the qubit is it's own type, drilling down a level can the characteristics be captured in a very basic manner so that potentially they could be represented in something like a vector array to capture key characteristics e.g. &#xA;state (notwithstanding the difficulty of superposition!), spin etc.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastEditorUserId="26" LastEditDate="2018-12-23T12:39:20.090" LastActivityDate="2018-12-23T12:39:20.090" Title="The process for transferring qubits between locations" Tags="&lt;physical-qubit&gt;&lt;physical-realization&gt;&lt;classical-computing&gt;&lt;communication&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3873" PostTypeId="1" CreationDate="2018-07-26T17:18:05.183" Score="7" ViewCount="344" Body="&lt;p&gt;If I understand correctly, there must exist unitary operations that can be approximated to a distance $\epsilon$ only by an exponential number of quantum gates and no less.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, by the Solovay-Kitaev theorem, any arbitrary unitary operation in $n$ qubits, with $n$ fixed, can be approximated to a distance of $\epsilon$ using poly(log(1/$\epsilon$)) universal gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't these two statements appear contradictory? What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="26" LastEditDate="2018-12-23T13:20:45.453" LastActivityDate="2019-05-02T15:25:07.257" Title="Number of gates required to approximate arbitrary unitaries" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3874" PostTypeId="2" ParentId="3872" CreationDate="2018-07-26T17:48:59.103" Score="3" Body="&lt;p&gt;It’s worth stating from the start that “Alice and Bob” scenarios are very different from quantum computation scenarios. The Alice and Bob scenarios are very much that there are two distantly separated locations between which it is impossible to directly perform quantum gates. Meanwhile in the quantum computing architectures you’re talking about, two-qubit gates are readily available. Even if you can’t directly interact a pair of qubits, a bunch of swap gates are enough to move the qubits next to each other, and back again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also want to be careful with your classical software engineer interpretation, because classically it’s very easy to move things about, and make multiple copies. In quantum, you can’t make copies of your data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do you move a qubit? Entanglement and teleportation aren’t really an answer. They might help give you error-correction enhanced protocols, but the basic question is still how you share the entangled state to achieve the teleportation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably the best way is to transfer the quantum information from one physical carrier, such as the qubits in a quantum computer, to a different one. We’d usually think about photons in this context - they’re really good at travelling long distances without interacting too much. In the same way that classical data can transfer via an optical fibre, it’s not too wild to imagine sending photons in superpositions through an optical fibre. You ‘just’ have to convert the photon at either end into the different storage/manipulation type of qubit. The technology certainly exists to do this, but I don’t know how reliably it happens.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-07-26T17:48:59.103" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3875" PostTypeId="2" ParentId="3860" CreationDate="2018-07-26T18:56:39.947" Score="-1" Body="&lt;p&gt;Along with depending on time constraints, as Craig mentioned, you also need to specify how accurate/what gates you want the simulation to have. CHP (CNOT, Phase, Hadamard) simulations can do incredibly large circuits with large numbers of qubits incredible quickly, however they only allow a certain restricted gate set, so some gates, such as T gates, must be approximated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other simulations exist (such as quantumsim and others) which store full density matrices, and as a result are much more significantly limited in the number of qubits they work with seeing as they must store a $2^n \times 2^n$ matrix.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-26T18:56:39.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3876" PostTypeId="2" ParentId="3872" CreationDate="2018-07-26T20:35:09.357" Score="12" Body="&lt;p&gt;You are totally right in your assumption about transporting qubits from Alice to Bob implies something physical. Usually problems/situations that have this setup of a transmission between two parties are called &lt;em&gt;quantum communications&lt;/em&gt;. These problems/situations sometimes disambiguate by calling their qubits &quot;flying qubits&quot; which are almost always photons. Single photons are also quantum systems that can be prepared in useful qubit states, they can be operated on with gates (but not all kinds of gates and not as easily as some other physical implementations of qubits), and can be measured just like any other qubit system. Alice and Bob would literally share these photos by either an optical fiber they are connected by or through free space (which could be literally to a satellite in space).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Photons are great for this application because we already use them for a large portion of our classical communication networks. &quot;Fiber&quot; internet or photonic networks send classical information in optical fiber with strong pulsed lasers. So if you wanted to have both a classical channel and a quantum communication channel you could do both with the same fiber (hard for some technical reasons but totally possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also may other physical systems that you cab make qubits out of for quantum computing (super conductors, ion traps, etc.). You are correct in that to connect different groups of these qubits one would not pick the chip up and move it, but instead they often create a(n) photon(s) that are entangled with the original system or have some information they want to share with the second system and then send the photon over.  &lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2018-07-26T20:35:09.357" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3877" PostTypeId="2" ParentId="3852" CreationDate="2018-07-26T20:49:54.707" Score="5" Body="&lt;p&gt;I think this kind of depends on what you are looking for. You asked about building a basic quantum system which you can totally do*. Just grab a good laser, single photon detectors, beam splitters and wave plates, and some attenuating filters. If you can get the laser down to a trickle of single photons you can do some fun quantum key distribution demos, and operations on single qubits (possibly on pairs if you have the right components). Now, that's obviously no computer, but since computers are built out of qubits its a start.&#xA;Also as @peterh mentioned, there is lots of simulators that you can use if you want to work with more qubits now, and example being &lt;a href=&quot;https://en.wikipedia.org/wiki/Q_Sharp&quot; rel=&quot;noreferrer&quot;&gt;Q#&lt;/a&gt; that actually can estimate the number of qubits you would need to run your algorithm on a real quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is still gonna be a couple thousand dollars or more, but not nearly as much as a D-Wave :) Here is a &quot;demo&quot; system from an overpriced lab equipment store: &lt;a href=&quot;https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=9869&quot; rel=&quot;noreferrer&quot;&gt;https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=9869&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2018-07-26T20:49:54.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3878" PostTypeId="2" ParentId="3871" CreationDate="2018-07-26T23:24:23.610" Score="6" Body="&lt;p&gt;It think the (very) short answer is that there is not a preferred platform yet. This is why there are very active research communities around each of these technologies. Often if someone says otherwise they are probably working on one of the platforms :)&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2018-07-26T23:24:23.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3879" PostTypeId="1" AcceptedAnswerId="3911" CreationDate="2018-07-27T08:51:36.893" Score="11" ViewCount="446" Body="&lt;p&gt;In @DaftWullie's answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3823/practical-implementation-of-hamiltonian-evolution&quot;&gt;this question&lt;/a&gt; he showed how to represent in terms of quantum gates the matrix used as example in &lt;a href=&quot;https://arxiv.org/pdf/1110.2232v2.pdf&quot; rel=&quot;noreferrer&quot;&gt;this article&lt;/a&gt;. However, I believe it to be unlikely to have such well structured matrices in real life examples, therefore I was trying to look at other methods to simulate an Hamiltonian.&#xA; I have found in several articles a reference to &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0301023.pdf&quot; rel=&quot;noreferrer&quot;&gt;this one&lt;/a&gt; by Aharonov and Ta-Shma in which, among other things they state that it is possible to have some advantage in simulating &lt;em&gt;sparse&lt;/em&gt; hamiltonians. After reading the article, however, I haven't understood how the simulation of sparse hamiltonians could be performed. The problem is usually presented as one of graph coloring, however also looking at the &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/talks/ibm13.pdf&quot; rel=&quot;noreferrer&quot;&gt;presentation&lt;/a&gt; that @Nelimee suggested to read to study matrix exponentiation, this all falls down the silmulation through product formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make an example, let's take a random matrix like:   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;A = \left[\begin{matrix}&#xA;2 &amp;amp;  0  &amp;amp; 0 &amp;amp; 0\\&#xA;8  &amp;amp;  5 &amp;amp; 0 &amp;amp; 6\\&#xA;0 &amp;amp; 0 &amp;amp; 7 &amp;amp; 0\\&#xA;0 &amp;amp; 5 &amp;amp; 3 &amp;amp; 4&#xA;\end{matrix}\right];&#xA;$$&#xA; this is not hermitian, but using the suggestion from Harrow,Hassidim and Lloyd we can construct an hermitian matrix starting from it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;C = \left[ \begin{matrix}&#xA;0 &amp;amp; A\\&#xA;A^{\dagger} &amp;amp; 0&#xA;\end{matrix} \right]&#xA; =  \left[\begin{matrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 2 &amp;amp;  0  &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 8  &amp;amp;  5 &amp;amp; 0 &amp;amp; 6\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 7 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 5 &amp;amp; 3 &amp;amp; 4\\&#xA;2 &amp;amp; 8 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 5 &amp;amp; 0 &amp;amp; 5 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 7 &amp;amp; 3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 6 &amp;amp; 0 &amp;amp; 4 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\  &#xA;\end{matrix}\right].&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that I have an 8x8, 2-sparse hermitian matrix:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can I simulate its evolution in other ways than the product formula method?&lt;/li&gt;&#xA;&lt;li&gt;Even if I use the product formula, how do I exploit the fact that it is sparse? Is it just because there are less non-zero entries and therefore it should be easier to find the product of basic gates?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2648" LastActivityDate="2018-07-31T13:45:32.017" Title="Advantage of simulating sparse Hamiltonians" Tags="&lt;algorithm&gt;&lt;matrix-representation&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3880" PostTypeId="1" AcceptedAnswerId="3881" CreationDate="2018-07-27T09:09:01.500" Score="7" ViewCount="717" Body="&lt;p&gt;As far as I have seen, when it comes to solving linear systems of equations it is assumed to have a matrix with a number of rows and columns equal to a power of two, but what if it is not the case? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If for instance I have the equation $Ax=b$ where &lt;em&gt;A&lt;/em&gt; is a 4x4 matrix and &lt;em&gt;x&lt;/em&gt; and &lt;em&gt;b&lt;/em&gt; 4x1 vectors, I expect to find the solution in terms of amplitudes of the 4 basis states considered for the problem. What if instead of 4 there is 5? &#xA;My idea would be to choose an Hilbert space of smallest dimension that it includes 5 i.e. 8, and then make it so that 3 basis states will have amplitude 0. Is it correct to reason in this way, or am i making problems for nothing? &lt;/p&gt;&#xA;" OwnerUserId="2648" LastActivityDate="2018-07-27T09:37:37.563" Title="Solving linear systems represented by NxN matrices with N not power of 2" Tags="&lt;quantum-state&gt;&lt;hhl-algorithm&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3881" PostTypeId="2" ParentId="3880" CreationDate="2018-07-27T09:37:37.563" Score="6" Body="&lt;p&gt;This is indeed a correct way to solve linear systems with dimension not equal to a power of 2. Solve the smallest possible system of dimension 2$^n$ that contains the system you want to solve, and pad the matrices and vectors with zeros to make it the right size. This is because the vector $|b\rangle$ in the HHL algorithm, is a quantum state, which means if we have $n$ qubits, its dimension is naturally 2$^n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this procedure is not the &lt;strong&gt;&lt;em&gt;only&lt;/em&gt;&lt;/strong&gt; way to solve systems with dimension not equal to a power of 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember you do not have to work with qubits but can also work with other qudits such as qutrits (3-level systems). Then your $|b\rangle$ will have dimension 3$^n$, so you can do for example a 9x9 system without resorting to solving a 16x16 problem involving 4 qubits. The question then becomes whether or not your hardware can more easily perform the algorithm for the case where $|b\rangle$ is represented by 4 qubits, or for the case where it is 2 qutrits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 5x5 matrix, you can use for $|b\rangle$ a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2100/do-any-specific-types-of-qudits-other-than-qubits-and-qutrits-have-a-name&quot;&gt;qupit&lt;/a&gt; with $p=5$. Or you can use 3 qubits and work with an 8x8 matrix. Since there's not likely to be a lot of quantum computing hardware around with &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2100/do-any-specific-types-of-qudits-other-than-qubits-and-qutrits-have-a-name&quot;&gt;qupits&lt;/a&gt;, it may be easier to do what you suggest, which is to just use more qubits.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-07-27T09:37:37.563" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3883" PostTypeId="2" ParentId="1880" CreationDate="2018-07-27T16:59:58.823" Score="5" Body="&lt;p&gt;I have worked with NVs in nanodiamonds a little bit, and you are totally right, surface characteristics have a huge influence on how far we can push them. There are definitely multiple groups working on the chemistry/material science that are working to clean up the surfaces as much as possible. I had a colleague, Carlo Bradac who worked with our chemistry dept to passivate/manipulate the surface properties of nanodiamonds for us and they were way better than what we could commercially buy from anywhere. I think he has a &lt;a href=&quot;https://www.lucigem.com.au/our-products/&quot; rel=&quot;nofollow noreferrer&quot;&gt;startup&lt;/a&gt; now where you can order samples of nanodiamonds (and other structures) with certain properties. If I recall correctly, they did things like hot acid baths and centrifuging to do this, but as there is a startup I am not sure it is published. A place to start may be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://doi.org/10.1016/j.diamond.2018.01.022&quot; rel=&quot;nofollow noreferrer&quot;&gt;Influence of surface composition on the colloidal stability of ultra-small detonation nanodiamonds in biological media&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4211" LastEditorUserId="26" LastEditDate="2018-07-27T17:24:48.173" LastActivityDate="2018-07-27T17:24:48.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3885" PostTypeId="1" AcceptedAnswerId="3886" CreationDate="2018-07-28T05:57:26.723" Score="6" ViewCount="274" Body="&lt;p&gt;Also, why is Microsoft placing such an emphasis on topological qubits when most other companies seem to be focusing on other qubit technologies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know topological qubits could handle noise far better than other systems, so they are appealing, but they are also new and seemingly only theoretical so far.&lt;/p&gt;&#xA;" OwnerUserId="1287" LastActivityDate="2018-07-29T00:52:41.400" Title="Are there any other companies besides Microsoft pursuing topological QC?" Tags="&lt;topological-quantum-computing&gt;&lt;technologies&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3886" PostTypeId="2" ParentId="3885" CreationDate="2018-07-28T06:36:04.373" Score="4" Body="&lt;p&gt;Microsoft is the only company that is trying to build a topological quantum computer. You mention that topological qubits handle noise far better than other systems, but they are also theoretical. That's the reason Microsoft is applying a topological approach. It's high-risk, high-reward. If Microsoft manages to realize a topological qubit, scaling up a computer made of topological qubits will be easier than competing approaches because a topological quantum computer would use less resources to perform quantum error correction compared to other implementations.&lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2018-07-28T06:36:04.373" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3887" PostTypeId="1" AcceptedAnswerId="3889" CreationDate="2018-07-28T09:05:06.463" Score="4" ViewCount="339" Body="&lt;p&gt;I need to use the following matrix gate in a quantum circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\text{Sign Flip}=\left[\begin{matrix}0 &amp;amp; -1 \\ -1 &amp;amp; 0\end{matrix}\right]$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\text{Sign Flip}$ can be decomposed as (in terms of Pauli-$X$,$Y$,$Z$):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\begin{bmatrix} 0 &amp;amp; -1\\ -1 &amp;amp; 0\end{bmatrix} = \begin{bmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0\end{bmatrix} \begin{bmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0\end{bmatrix} \begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1\end{bmatrix} \begin{bmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0\end{bmatrix} \begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any standard shorthand notation for the $\text{Sign Flip}$ gate? I don't really want to replace one simple custom gate by $5$ quantum gates in my circuit.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-23T13:19:44.317" LastActivityDate="2018-12-23T13:19:44.317" Title="Shorthand notation for the sign flip gate" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3889" PostTypeId="2" ParentId="3887" CreationDate="2018-07-28T10:46:53.723" Score="6" Body="&lt;p&gt;A unitary $U$ and $e^{i\phi}U$, which differs from it by a phase, act &lt;em&gt;exact identically&lt;/em&gt; on any quantum state.  Thus, they should really be considered the &quot;same&quot; unitary in terms of their action.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can therefore use $X$ instead of your unitary, which is $-X$. This will have exactly the identical action in any circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Why is this? There are different ways to see this: Either since $|\psi\rangle$ and $e^{i\phi}|\psi\rangle$ describe the same quantum state, or by working with density operators on which $U$ acts as $\rho\mapsto U\rho U^\dagger$, such that phases cancel.  Also, note that this is not true for &lt;em&gt;controlled&lt;/em&gt;-unitaries -- but this is an entirely different question.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-07-28T14:59:11.647" LastActivityDate="2018-07-28T14:59:11.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3890" PostTypeId="1" CreationDate="2018-07-28T12:37:39.413" Score="7" ViewCount="163" Body="&lt;p&gt;I am going through &lt;a href=&quot;https://www.youtube.com/watch?v=F_Riqjdh2oM&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; video of Quantum Computing for Computer Scientists. I am not able to understand the entanglement state of qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is entanglement just an operation, or is it a state which can be stored. If it's a state which is stored then how can we send two qubits far apart? &#xA;But if it is just an operation then isn't the operation somehow affected the probability from 50% to 100% to superimposed states of qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, what if the operation has 50% chance of assigning the probability. So when measuring multiple times we tend to get 50% probability of qubits collapsing to one of the states.&lt;/p&gt;&#xA;" OwnerUserId="4226" LastEditorUserId="2293" LastEditDate="2018-07-29T17:07:52.640" LastActivityDate="2018-08-24T13:13:18.707" Title="Is entanglement an operation or a stored state for qubits?" Tags="&lt;entanglement&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3891" PostTypeId="2" ParentId="3890" CreationDate="2018-07-28T16:52:28.500" Score="6" Body="&lt;p&gt;It’s a property of the state that is stored. But it’s not a physical change that relates to a force: it is not that you entangle qubits, and that means that they are physically joined. The two physical qubits remain as independent physical entities that can move around separately, just with a joint state. (At least, not usually. In things like covalent bonds, that’s exactly what’s happening!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, try not to talk too much about “probability” as it can be very misleading in a quantum scenario, especially when you start talking about entanglement. Talk about probability amplitudes where possible, and keep probabilities for being associated with the outcomes of measurements. Otherwise the differences between entanglement and classical correlation will be impossible to distinguish.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-24T13:13:18.707" LastActivityDate="2018-08-24T13:13:18.707" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3893" PostTypeId="1" AcceptedAnswerId="3895" CreationDate="2018-07-29T00:53:45.717" Score="7" ViewCount="300" Body="&lt;p&gt;I'm stuck while trying to understand the Hadamard Gate in a more linear algebra understanding. (I understand the algebraic way). This is because I want to program a simulation of a quantum computer. To apply a gate you multiply each &lt;em&gt;ket&lt;/em&gt; by the unitary matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the Hadamard gate maps the state $\alpha |0\rangle + \beta|1\rangle$ to $\frac{\alpha}{\sqrt{2}}\begin{bmatrix}1\\1\\\end{bmatrix}+\frac{\beta}{\sqrt{2}}\begin{bmatrix}1\\-1\\\end{bmatrix}$ right?&#xA;But the outputs are not basis vectors. I know this is hard to understand but how do I &lt;em&gt;make&lt;/em&gt; it back to the basis vector form so I can write it in ket form. I know you can do it algebraically but how to in linear algebra?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So put it in the form:&#xA;$$\alpha\begin{bmatrix}1\\0\\\end{bmatrix}+\beta\begin{bmatrix}0\\1\\\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you understand what I mean, can you explain it in a general matrix form?&lt;/p&gt;&#xA;" OwnerUserId="4232" LastEditorUserId="55" LastEditDate="2020-06-04T15:04:31.657" LastActivityDate="2020-06-04T15:04:31.657" Title="How do you represent the output of a quantum gate in terms of its basis vectors?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3895" PostTypeId="2" ParentId="3893" CreationDate="2018-07-29T04:02:25.290" Score="7" Body="&lt;p&gt;In linear algebra representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state of the qubit is $\alpha|0\rangle + \beta|1\rangle = \begin{bmatrix}\alpha \\ \beta \end{bmatrix}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard matrix is $\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state after applying a Hadamard gate can be calculated by multiplying the column vector representing the state by the matrix representing the operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix} \cdot \begin{bmatrix}\alpha \\ \beta \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix}\alpha + \beta \\ \alpha - \beta \end{bmatrix}$ = $\frac{1}{\sqrt{2}}(\alpha + \beta)|0\rangle + \frac{1}{\sqrt{2}}(\alpha - \beta)|1\rangle$&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="3056" LastEditDate="2018-07-29T06:29:47.110" LastActivityDate="2018-07-29T06:29:47.110" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3896" PostTypeId="2" ParentId="3890" CreationDate="2018-07-29T04:47:13.080" Score="0" Body="&lt;p&gt;To add on to what @DaftWullie said, in my mind it might make more sense to think of entanglement as a property of a multi-qubit state, instead of as a state itself. There is no special &quot;Entangled&quot; state, it's just that some states are entangled and some are not.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-29T04:47:13.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3897" PostTypeId="2" ParentId="3871" CreationDate="2018-07-29T05:04:20.453" Score="6" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1702.01852&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Here's&lt;/strong&gt;&lt;/a&gt; a paper comparing Trapped Ion and Superconducting (the main competitors right now) from the group at UMD which compares their trapped ion system with IBM's transmon (superconducting) system. If you want to look at a more algorithm-focused line of thought.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for a more general summary of the strengths and weaknesses &lt;a href=&quot;https://arxiv.org/pdf/1804.10648.pdf&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/a&gt; paper seems to discuss all major options, and then &lt;a href=&quot;https://arxiv.org/abs/cond-mat/0411174&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/a&gt; one focuses on Superconducting qubits in particular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-07-29T05:04:20.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3898" PostTypeId="1" AcceptedAnswerId="3966" CreationDate="2018-07-29T08:21:47.577" Score="8" ViewCount="248" Body="&lt;p&gt;I recently came to know about this interesting topic of &quot;&lt;strong&gt;communication complexity&lt;/strong&gt;&quot;. In simple words, Wikipedia defines it as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In theoretical computer science, &lt;strong&gt;communication complexity&lt;/strong&gt; studies the&#xA;  &lt;strong&gt;amount of communication&lt;/strong&gt; required to solve a problem when the input to&#xA;  the problem is distributed among two or more parties. It was&#xA;  introduced by Andrew Yao in 1979, who investigated the following&#xA;  problem involving two separated parties, traditionally called Alice&#xA;  and Bob. Alice receives an n-bit string $x$ and Bob another $n$-bit&#xA;  string $y$, and the goal is for one of them (say Bob) to compute a&#xA;  certain function $f(x,y)$ with the least amount of communication&#xA;  between them. Of course, they can always succeed by having Alice send&#xA;  her whole n-bit string to Bob, who then computes the function $f$, but&#xA;  the idea here is to find clever ways of calculating $f$ with fewer than&#xA;  n bits of communication. Note that in communication complexity, we are&#xA;  not concerned with the amount of computation performed by Alice or&#xA;  Bob, or the size of the memory used.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, I was going through the first couple of pages of this paper: &quot;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0101005&quot; rel=&quot;noreferrer&quot;&gt;Quantum Communication Complexity (A Survey) - Brassard&lt;/a&gt;&quot;. Apparently, it seems that if the non-communicating parties are previously entangled then more bits of information may be communicated than in the classical case. The paper looks nice, and so I'll read further. However, are there any other important papers or texts which are &quot;must-reads&quot; when learning about &quot;quantum communication complexity&quot;? (I'm mostly interested in the theoretical/algorithmic side)&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-08-07T14:55:01.860" Title="Resources for Quantum Communication Complexity" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;communication-complexity&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3899" PostTypeId="1" AcceptedAnswerId="3900" CreationDate="2018-07-29T21:25:54.600" Score="6" ViewCount="252" Body="&lt;p&gt;Under the influence of a time-independent Hamiltonian $H$, a state $|\psi\rangle$ will evolve after a time $t$ to the final state $|\psi(t)\rangle=e^{-iH t}|\psi\rangle$, while in the most general case of a time-dependent Hamiltonian $H(t)$, the final state can be formally written as&#xA;$$|\psi(t)\rangle=T\exp\left(-i\int_{t_0}^{t}dt\,H(t)\right) |\psi\rangle.$$&#xA;What are the preferred &lt;em&gt;numerical&lt;/em&gt; methods to compute $|\psi(t)\rangle$, given $H$, $t$ and $|\psi\rangle$?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-30T15:50:29.357" LastActivityDate="2018-07-30T15:50:29.357" Title="What are the preferred numerical methods to simulate the evolution of a state through a time-dependent Hamiltonian?" Tags="&lt;simulation&gt;&lt;dynamics&gt;" AnswerCount="1" CommentCount="12" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3900" PostTypeId="2" ParentId="3899" CreationDate="2018-07-30T08:42:45.407" Score="7" Body="&lt;p&gt;It depends on the Hamiltonian. There are three particular questions whose answers might influence your choice of strategy:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does the Hamiltonian have any particular structure or symmetry?&lt;/li&gt;&#xA;&lt;li&gt;How quickly does the Hamiltonian change in time?&lt;/li&gt;&#xA;&lt;li&gt;What do you know about the initial state in relation to the initial Hamiltonian?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Obviously, if the Hamiltonian has any particular structure or symmetry, you should start by taking advantage of it. For example, if your Hamiltonian $H$ satisfies $$\left[H,\sum_{i=1}^NZ_i\right]=0,$$&#xA;then you can split $H$ into a series of subspaces $H=\bigoplus_{i=0}^NH_i$, whose evolutions you can handle separately. This is particularly good if your initial state turns out to be supported on a small number of those subspaces. Another particularly trivial case is of $[H(t),H(s)]=0$ for all $s$ and $t$. In that case, you would start by decomposing the initial state in terms of the eigenvectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Hamiltonian is changing slowly in time, and your initial state only has support on a small number of eigenstates, it might be worthwhile investigating whether an &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_theorem&quot; rel=&quot;noreferrer&quot;&gt;adiabatic evolution&lt;/a&gt; is occurring. In that case, it may be &quot;just&quot; a case of finding the final Hamiltonian and some of its eigenstates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it's changing at a reasonable speed, but your initial state still has support only on a small number of the low-energy eigenvectors, then you might use matrix-product states (especially if your Hamiltonian has a one-dimensional structure).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your Hamiltonian is changing very quickly in time, then the default option of Trotterising the Hamiltonian can work quite badly, with errors building quickly. There are improved techniques that work in these sorts of situations, but I've never seen them applied in the discrete setting of qubits (that said, I've never looked). Things like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Arnoldi_iteration&quot; rel=&quot;noreferrer&quot;&gt;explicit Arnoldi method&lt;/a&gt;, or explicit Fatunla method. You may find some useful details &lt;a href=&quot;https://arxiv.org/abs/1401.6318&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default method, which will always work (if you take a small enough $\delta t$) is to split the Hamiltonian evolution into lots of little time steps $\delta t$ and just evaluate&#xA;$$&#xA;\ldots e^{-iH(5\delta t/2)\delta t}e^{-iH(3\delta t/2)\delta t}e^{-iH(\delta t/2)\delta t}|\psi\rangle.&#xA;$$&#xA;This can be improved by using &lt;a href=&quot;https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods&quot; rel=&quot;noreferrer&quot;&gt;Runge-Kutta type techniques&lt;/a&gt;. You can also vary the size of the time step depending on how quickly the Hamiltonian is changing at a particular instant. Some of the quantum techniques for simulation may also be interesting. There have been &lt;a href=&quot;https://arxiv.org/abs/1805.00582&quot; rel=&quot;noreferrer&quot;&gt;recent advancements&lt;/a&gt; that massively improve the accuracy of those simulations by moving away from the standard Trotterisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's probably plenty more that could be said, but I guess that's enough to get you started.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-30T11:07:53.497" LastActivityDate="2018-07-30T11:07:53.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3901" PostTypeId="1" CreationDate="2018-07-30T15:07:51.117" Score="4" ViewCount="1529" Body="&lt;p&gt;I have run this program -&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Import the QISKit SDK&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit import execute, register&#xA;&#xA;# Set your API Token.&#xA;# You can get it from https://quantumexperience.ng.bluemix.net/qx/account,&#xA;# looking for &quot;Personal Access Token&quot; section.&#xA;QX_TOKEN = &quot;....&quot;&#xA;QX_URL = &quot;https://quantumexperience.ng.bluemix.net/api&quot;&#xA;&#xA;# Authenticate with the IBM Q API in order to use online devices.&#xA;# You need the API Token and the QX URL.&#xA;register(QX_TOKEN, QX_URL)&#xA;&#xA;# Create a Quantum Register with 2 qubits.&#xA;q = QuantumRegister(2)&#xA;# Create a Classical Register with 2 bits.&#xA;c = ClassicalRegister(2)&#xA;# Create a Quantum Circuit&#xA;qc = QuantumCircuit(q, c)&#xA;&#xA;# Add a H gate on qubit 0, putting this qubit in superposition.&#xA;qc.h(q[0])&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting&#xA;# the qubits in a Bell state.&#xA;qc.cx(q[0], q[1])&#xA;# Add a Measure gate to see the state.&#xA;qc.measure(q, c)&#xA;&#xA;# Compile and run the Quantum Program on a real device backend&#xA;job_exp = execute(qc, 'ibmqx4', shots=1024, max_credits=10)&#xA;result = job_exp.result()&#xA;&#xA;# Show the results&#xA;print(result)&#xA;print(result.get_data())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output - &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;COMPLETED {'time': 19.799431085586548, 'counts': {'00': 445, '01': 62,&#xA;  '10': 67, '11': 450}, 'date': '2018-07-30T14:56:23.330Z'}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But when I was running this, it was no  very fast. Is this due to queuing on the machine?&lt;/p&gt;&#xA;" OwnerUserId="4216" LastEditorUserId="26" LastEditDate="2019-03-12T09:33:38.993" LastActivityDate="2021-04-07T10:49:56.603" Title="Comparing run times on IBM Quantum Experience" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3902" PostTypeId="1" AcceptedAnswerId="3905" CreationDate="2018-07-31T01:55:06.047" Score="3" ViewCount="255" Body="&lt;p&gt;A bit is a binary digit, typically 0 or 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Until a value is assigned (or a measurement is made) a bit is in a superposition of the entangled binary pair, is it not?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-23T12:40:41.950" LastActivityDate="2018-12-23T12:40:41.950" Title="Are classical bits quantum?" Tags="&lt;classical-computing&gt;" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3903" PostTypeId="2" ParentId="3902" CreationDate="2018-07-31T02:00:07.277" Score="1" Body="&lt;p&gt;A bit is effectively&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where either $\alpha = 1, \beta = 0$ (the bit = 0) or $\alpha = 0, \beta = 1$ (the bit = 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, yes, in the sense I think you mean, a classical bit can be represented with the quantum notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember for quantum mechanics to be a legitimate theory, it must describe all the phenomenons and behaviors that classical mechanics explains, which it does. Similar is true in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if you ever refer to a classical bit as quantum, you will probably confuse the heck out of everybody, which is why the distinction is made. Also different gates can apply, etc.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2018-07-31T02:00:07.277" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="3904" PostTypeId="2" ParentId="3902" CreationDate="2018-07-31T03:44:54.973" Score="1" Body="&lt;p&gt;You are correct that if you set $\alpha=0$ or $\alpha=1$, then the information gain upon measurement will be none. There is no way to be surprised. You do need a some nontrivial $p$ for be the prior distribution, to get information gain. If you say the state is $\sqrt{p} \mid 0 \rangle + \sqrt{1-p} \mid 1 \rangle$ instead, then when you measure it in the computational basis you can have some surprise/information. Presumably let $p=\frac{1}{2}$ because you want a full bit, not less. One might play fast and loose between &quot;less than or equal to 1 bit&quot; vs &quot;1 bit&quot; because of implicit assumptions about the probability distribution.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-07-31T03:44:54.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3905" PostTypeId="2" ParentId="3902" CreationDate="2018-07-31T05:26:29.143" Score="5" Body="&lt;p&gt;A bit, either 0 or 1, can certainly be thought of as a special case of being a qubit. However, that is not to say that anything capable of computing with classical bits is capable of computing with quantum bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a bit, and don’t know if it’s a 0 or a 1, then how do you describe its state? You have to use Bayesian priors. If you have no idea which it is, you assign the two options equal probabilities. And it really is probabilities here. So it’s 50:50 being in 0 or 1. You can’t describe this as a pure quantum state, but you can use a density matrix:&#xA;$$\rho=(|0\rangle\langle 0|+|1\rangle\langle 1|)/2.$$&#xA;This formalism also means that if you later learn something about what the bit value might be (perhaps as a result of reading other bits in a computation), you can update those probabilities using conditional probabilities and Bayes’ rule. Note that this also means it’s a subjective description of the state: it reflects your personal knowledge of the state of the bit, while somebody else, who perhaps prepared the bit, already knows what value it has. This is perhaps one way to see why it should be different from the pure state that you proposed, which should be an objective description that everyone would agree on (in that there is no uncertainty in the state; the only uncertainty is induced by the action of the measurement).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="55" LastEditDate="2018-07-31T10:24:16.400" LastActivityDate="2018-07-31T10:24:16.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3906" PostTypeId="2" ParentId="3901" CreationDate="2018-07-31T06:37:38.227" Score="1" Body="&lt;p&gt;The time given in the results is the execution time on the backend. In your example, your quantum circuit took nearly 20 seconds to execute 1024 times (which seems huge for such a short circuit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before these nearly 20 seconds of execution, it is likely that your job had to wait for a few seconds (maybe up to several hours) in the backend queue, where all the jobs submitted but not executed are kept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you can do to estimate the waiting time is to ask to the backend how many jobs there are in queue, but you can't estimate precisely the time your job will need to wait in the queue as you don't know the content of the other jobs before you.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-07-31T06:37:38.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3907" PostTypeId="2" ParentId="3902" CreationDate="2018-07-31T10:38:50.667" Score="4" Body="&lt;p&gt;No, &lt;em&gt;superposition is not the same as uncertainty about an outcome&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you throw a coin, the state of the coin is &lt;em&gt;not&lt;/em&gt; $|0\rangle+|1\rangle$ before landing.&#xA;If you really want to use the formalism of quantum mechanics to describe the uncertainty about the outcome, you have to describe it as a &lt;em&gt;mixture&lt;/em&gt; of the two possible outcomes, that is, something like $|0\rangle\!\langle0|+|1\rangle\!\langle1|$.&#xA;As also discussed in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1476/55&quot;&gt;this other answer&lt;/a&gt;, coherent superpositions and mixtures are two entirely different beasts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, saying that the state of a coin (classical bit) is $|0\rangle+|1\rangle$ before the measurement implies the possibility of performing coherent operations on it, which is wrong: it is not possible, even in principle, to do something like measuring the state of the coin in the $|+\rangle$ basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the crucial difference is that even if you do not know in what state a &lt;em&gt;bit&lt;/em&gt; is, it is still the case that the bit &lt;em&gt;is&lt;/em&gt; in some definite state (which means no interferences), you just don't which one.&#xA;On the other hand, the &quot;uncertainty&quot; associated with a qubit &lt;em&gt;does not&lt;/em&gt; mean that there is something that we do not know about the state: the qubit can be fully characterised, and yet lead to uncertainty in (some) measurement outcomes.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-07-31T11:21:53.087" LastActivityDate="2018-07-31T11:21:53.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3908" PostTypeId="1" AcceptedAnswerId="3909" CreationDate="2018-07-31T12:05:29.067" Score="8" ViewCount="1369" Body="&lt;p&gt;I wish to have a &quot;reset&quot; gate. This gate would have an effect to bring a qubit to the $\mid0\rangle$ state.&lt;br&gt;&#xA;Clearly, such a gate is not unitary (and so I'm unable to find any reliable implementation in terms of universal gates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for my particular needs, I need this ability to reset a qubit or a quantum register to that state so users can always start from $\mid0\rangle$.  I'm making a small programming language that transpiles to QASM, and when a function is exited, I want all local (quantum) variables (qubits) reset to $\mid0\rangle$ so they can be reused.  QASM reset instruction does not work on the real processor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that something to this effect may be achieved with quantum phase estimation but I'm wondering if there is another way.&lt;/p&gt;&#xA;" OwnerUserId="2417" LastEditorUserId="26" LastEditDate="2018-08-01T15:19:56.343" LastActivityDate="2018-08-01T15:19:56.343" Title="Possibility of a &quot;reset&quot; quantum gate" Tags="&lt;quantum-gate&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3909" PostTypeId="2" ParentId="3908" CreationDate="2018-07-31T12:21:31.100" Score="6" Body="&lt;p&gt;One way is simply to measure the qubit in the standard, $Z$, basis. If you get the answer 0, then you've got the state you want. Otherwise, you apply a bit-flip to it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, if you want to implement a non-unitary operation, you need some sort of measurement operation somewhere, whether that's a direct measurement, or the implementation of a CP map or POVM (but for these options, you need to introduce ancillas of a fixed state, which rather negates the point). Or you could use noise in the system, but you are unlikely to have sufficient control of it - it's noise after all! Of course, none of these options just reset a single qubit; anything that qubit is entangled with is also affected, but that's kind of in the definition of &quot;reset&quot; in the quantum context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only other option is to uncompute, but this is not a generic option because, generically you have to uncompute the entire computation to reset even a single qubit, and that resets everything. Except it doesn't work perfectly because of errors. You would be better starting a new computation. There are specific scenarios where an ancilla qubit is used and it can be uncomputed, but this is typically built into the algorithm because the uncomputation step is important for getting rid of some unwanted entanglement that would otherwise appear.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-01T07:11:42.033" LastActivityDate="2018-08-01T07:11:42.033" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3910" PostTypeId="2" ParentId="3908" CreationDate="2018-07-31T12:23:14.650" Score="3" Body="&lt;p&gt;I do not think that you can achieve this with a single gate, but the cool thing of quantum gates and unitary transformations is that they are reversible, therefore, when implementing a function in your quantum circuit, all you need to do is 'uncompute' it just by reversing the gates that you used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:[[%22%E2%80%A2%22,%22X%22],[%22X%22],[%22%E2%80%A2%22,%22X%22,%22%E2%80%A2%22],[1,%22H%22],[%22H%22,%22%E2%80%A2%22],[%22H%22,%22H%22],[%22Sample3%22],[%22H%22,%22H%22],[%22H%22,%22%E2%80%A2%22],[1,%22H%22],[%22%E2%80%A2%22,%22X%22,%22%E2%80%A2%22],[%22X%22],[%22%E2%80%A2%22,%22X%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; i made a random circuit and reversed it; you can see that you are back to the state $\vert 0\rangle$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would mean that you have to &quot;reset&quot; in a specific way for each function, though.&lt;/p&gt;&#xA;" OwnerUserId="2648" LastActivityDate="2018-07-31T12:23:14.650" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3911" PostTypeId="2" ParentId="3879" CreationDate="2018-07-31T13:19:55.917" Score="7" Body="&lt;p&gt;The insight that suggests that sparse matrices are useful goes along the lines of: for any $H$, we can decompose it in terms of a set of $H_i$ whose individual components all commute (making diagonalisation straightforward),&#xA;$$&#xA;H=\sum_{i=1}^mH_i.&#xA;$$&#xA;If the matrix is sparse, then you shouldn't need too many distinct $H_i$. Then you can simulate the Hamiltonian evolution&#xA;$$&#xA;e^{-iHt}=\prod_{j=1}^Ne^{-iH_m\delta t}e^{-iH_{m-1}\delta t}\ldots e^{-iH_{1}\delta t},&#xA;$$&#xA;where $t=N\delta t$. For example, in your case, you can have&#xA;$$&#xA;H_1=\frac14 X\otimes(18\mathbb{I}-6Z\otimes Z-4Z\otimes\mathbb{I}) \\&#xA;H_2=\frac14(X\otimes(11\mathbb{I}+5Z)\otimes X+Y\otimes(11\mathbb{I}+5Z)\otimes Y)\\&#xA;H_3=\frac14(11X\otimes X-Y\otimes Y)\otimes(\mathbb{I}-Z)&#xA;$$&#xA;(the 3 terms corresponding to the fact that it's a 3-sparse Hamiltonian). I believe there's a strategy here: you go through all the non-zero matrix elements of your Hamiltonian and group them so that if I write their coordinates as $(i,j)$ (and I always include their complex conjugate pair), I continue adding other elements to my set $(k,l)$ provided neither $k$ nor $l$ equal $i$ or $j$.. This would mean for an $m$-sparse Hamiltonian, you have $m$ different $H_i$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is this doesn't necessarily work this straightforwardly in practice. For one thing, there's still exponentially many matrix elements that you have to go through, but that's always going to be the case with the way you're setting it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that people get around this is they set up an oracle. One possible oracle is essentially a function $f(j,l)$ which returns the position and value of the $l^{th}$ non-zero entry on the $j^{th}$ row. This can be built into a full on quantum algorithm. There are a few papers on this topic (none of which I've completely understood yet). For example, &lt;a href=&quot;https://arxiv.org/abs/1202.5822&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1501.01715&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. Let me try to give a crude description of the way they work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step is to decompose the Hamiltonian as a set of unitaries, multiplied by positive scale factors $\alpha_i$:&#xA;$$&#xA;H=\sum_i\alpha_iU_i&#xA;$$&#xA;For simplicity, let's assume $H=U_1+\alpha U_2$. It might be assumed that you're given this decomposition. One then defines an operation (constructed out of controlled-$U_1$ and controlled-$U_2$) that implements $V=|0\rangle\langle 0|\otimes U_1+|1\rangle\langle 1|\otimes U_2$. If we input a particular state $|0\rangle+\sqrt{\alpha}|1\rangle$ (up to normalisation) on the control qubit, apply $V$, then measure the control qubit, post-selecting on it being in the state $|0\rangle+\sqrt{\alpha}|1\rangle$, then if the post-selection succeeds, we have implemented $U_1+\alpha U_2$, which happens with a probability at least $(1-\alpha)^2/(1+\alpha)^2$. You can do exactly the same with multiple terms, and indeed with exponentials of Hamiltonians (think about the series expansion), although in practice some better series expansions are used based on Bessel functions.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-07-31T13:45:32.017" LastActivityDate="2018-07-31T13:45:32.017" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3912" PostTypeId="2" ParentId="3901" CreationDate="2018-08-01T00:13:41.880" Score="7" Body="&lt;p&gt;The time that you see in the &lt;code&gt;result&lt;/code&gt; data structure is recorded by the device itself, so it is the running time of your experiment. It &lt;em&gt;does not&lt;/em&gt; include the time spent processing your circuit in Qiskit, or the time spent by your job in the queue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, here is a rough breakdown of this time (ballpark durations):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1) Loading the experiment into the instruments that create the pulses (~ 15s)&lt;/li&gt;&#xA;&lt;li&gt;2) 1024 repetitions (shots) of running calibration pulses &amp;amp; your circuit (~ 5s)&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a) Reset qubits (relaxation) + calibration: ~ 4ms&lt;/li&gt;&#xA;&lt;li&gt;b) Reset qubits (relaxation) + your circuit: ~ 1ms&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which adds up to the total experiment time you are seeing.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2018-08-01T00:13:41.880" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3913" PostTypeId="1" CreationDate="2018-08-01T06:10:46.050" Score="0" ViewCount="230" Body="&lt;p&gt;We are interested in solving an optimization problem, and specifically, the design of efficient yacht hulls. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In designing an efficient yacht hull, one must consider water-hull resistance, wave generation, near-field and far-field wake, side pressure, velocity prediction, and stability. The design is typically done with  simple computational fluid dynamics. Sail design complicated the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, there are hundreds of equations to optimize to find a good yacht.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a question which today's DWave can develop answers? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read DWave gives too many answers for equation systems. My boat designs will be optimized for one speed and free curves and they will be very beautiful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to get a good computation in short time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think, what would be the time taken to do this using a DWave machine?&lt;/p&gt;&#xA;" OwnerUserId="4250" LastEditorUserId="9482" LastEditDate="2020-04-30T21:00:56.430" LastActivityDate="2020-04-30T21:02:40.863" Title="How would D-Wave be used for complex optimization problems?" Tags="&lt;d-wave&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2018-08-04T09:04:30.880" ContentLicense="CC BY-SA 4.0" />
  <row Id="3914" PostTypeId="2" ParentId="1869" CreationDate="2018-08-01T10:09:15.733" Score="1" Body="&lt;p&gt;The problem here is that $U_f$ as you've defined it is not unitary. To see this, note that  the overlaps between states are preserved under the action of a unitary: $\langle\psi|\phi\rangle=\langle\psi|U^\dagger U|\phi\rangle$, while for a constant function $f$ you have $U_f|x\rangle=U_f|x'\rangle$ even if $x\neq x'$ (thereby changing the overlap from 0 to 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that you set this up as a unitary is with some additional qubits. If $f:x\mapsto y$ where $x\in\{0,1\}^n$ and $y\in\{0,1\}^m$, then you define $U_f|x\rangle|y\rangle=|x\rangle|y\oplus f(x)\rangle$. This is definitely unitary because&#xA;$$&#xA;U_fU_f|x\rangle|y\rangle=|x\rangle|y\oplus f(x)\oplus f(x)\rangle=|x\rangle|y\rangle,&#xA;$$&#xA;so $U_f$ is its own inverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you could define a quantum operation that always sets everything to 0. It's basically a measurement (in the $Z$ basis) followed by a compensating action depending on the measurement outcome. But then you can't use linearity as you did in your analysis, because you have to follow through the different measurement outcomes separately.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-01T10:09:15.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3915" PostTypeId="2" ParentId="3913" CreationDate="2018-08-01T13:07:32.303" Score="7" Body="&lt;p&gt;So I do not know much about yacht design but having played a little bit with a D-Wave machine I would suggest to see if you can model your problem as a Quadratic unconstrained binary optimization.&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quadratic_unconstrained_binary_optimization&quot; rel=&quot;nofollow noreferrer&quot;&gt;See on Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is your variables must be binary and a D-Wave machine will try to find a minimum to your QUBO. It will return many answers in a sense that it tries multiple times to find it but the goal is to find one minimum or sample near it with this minimization objective. If you ask for 1000 tries, it may give you a 100 different solutions but some with more frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now about the time to do it, it will depend on how the problem can fit in the hardware. You have to take into account the number of variables and their connectivity (which variables share a coefficient in the QUBO) and finally see if it fits with the number of qubits and their connectivity on D-Wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you can fit it, it will give you answers quickly. Depending on numbers of runs you ask and time parameters for each run you pass, it will be a matter of seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example of a QUBO, here is a the simplest one :&#xA;&lt;span class=&quot;math-container&quot;&gt;$x_0 + x_1 -2x_1x_0$&lt;/span&gt;, where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; are my binary variables (0 or 1 values).&#xA;Here two solutions: (0,0) and (1,1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To solve this on the machine, you generally pass a file/dictionary/table that looks like this and represent your QUBO problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 0 1 (coefficient of x0 with itself)&#xA;1 1 1 (coefficient of x1 with itself) &#xA;0 1 -2 (coefficient between x0 and x1) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="9006" LastEditDate="2020-04-30T21:02:40.863" LastActivityDate="2020-04-30T21:02:40.863" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="3917" PostTypeId="2" ParentId="2717" CreationDate="2018-08-01T22:27:52.640" Score="3" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Often, in quantum optics, the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Heisenberg_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heisenberg picture&lt;/a&gt;&lt;/em&gt; is used, where instead of considering equations of motion of states, equations of motions of operators are looked at instead. When considering creation/annihilation operators, this is often considerably easier as the matrices that determine the evolution (assuming it can be written in terms of matrices) are, for one, finite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Heisenberg equations of motions are calculated using $$\frac{dA}{dt} = \frac i\hbar \left[H, A\right] + \frac{\partial A}{\partial t},$$ for an operator $A$ evolving under a Hamiltonian $H$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the operator $a_j \left(a_j^\dagger\right)$ is the annihilation (creation) operator for spatial mode $j$. For a single mode, this allows for an effective Hamiltonian (acting on the operators) to be written as $$i\frac{d}{dt}\begin{pmatrix}a \\ a^\dagger\end{pmatrix} = H_{\text{eff}}\begin{pmatrix}a \\ a^\dagger\end{pmatrix}.$$ This naturally extends to writing their transformation as $$\begin{pmatrix}b \\ b^\dagger\end{pmatrix} = M\begin{pmatrix}a \\ a^\dagger\end{pmatrix}$$ for input modes $a \left(a^\dagger\right)$ and output modes $b \left(b^\dagger\right)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it exists, this transformation matrix $M$ can be calculated using $U^\dagger A_jU = \sum_{k}M_{jk}A_k$ for unitary evolution $U$. For the Unitaries in the question, this gives:&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Transformations&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Displacement&lt;/strong&gt;&#xA;$$D_j\left(\alpha\right):\begin{pmatrix}b_j\\b_j^\dagger\\I\end{pmatrix} = \begin{pmatrix}1 &amp;amp;&amp;amp; 0 &amp;amp;&amp;amp; \alpha\\0&amp;amp;&amp;amp;1&amp;amp;&amp;amp;\alpha^*\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;1\end{pmatrix} \begin{pmatrix}a_j\\a_j^\dagger\\I\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Rotation&lt;/strong&gt;&#xA;$$R_j\left(\phi\right):\begin{pmatrix}b_j\\b_j^\dagger\end{pmatrix} = \begin{pmatrix}e^{-i\phi} &amp;amp;&amp;amp; 0\\0&amp;amp;&amp;amp;e^{i\phi}\end{pmatrix} \begin{pmatrix}a_j\\a_j^\dagger\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Squeezing&lt;/strong&gt;&#xA;$$S_j\left(\xi=re^{i\theta}\right):\begin{pmatrix}b_j\\b_j^\dagger\end{pmatrix} = \begin{pmatrix}\cosh r &amp;amp;&amp;amp; -e^{i\theta}\sinh r\\-e^{-i\theta}\sinh r&amp;amp;&amp;amp;\cosh r\end{pmatrix} \begin{pmatrix}a_j\\a_j^\dagger\end{pmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Beamsplitter&lt;/strong&gt;&#xA;$$B_{jk}\left(\zeta = te^{i\varphi}\right):\begin{pmatrix}b_j\\b_k\\b_j^\dagger\\b_k^\dagger\end{pmatrix} = \begin{pmatrix}t &amp;amp;&amp;amp; re^{-i\varphi}&amp;amp;&amp;amp;0&amp;amp;&amp;amp; 0\\re^{i\varphi}&amp;amp;&amp;amp;t&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;t&amp;amp;&amp;amp;re^{i\varphi}\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;re^{-i\varphi}&amp;amp;&amp;amp;t\end{pmatrix} \begin{pmatrix}a_j\\a_k\\a_j^\dagger\\a_k^\dagger\end{pmatrix},$$ where $r=\cos\left|\zeta\right|$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cubic Phase&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, this is too nonlinear to write in the above way in matrix form. As $x = \frac{1}{\sqrt 2}\left(a+a^\dagger\right)$, even to first order, $V^\dagger a^\dagger V$ will include terms such as $\left[a^3, a^\dagger\right] = 3a^2$, which cannot be written in terms of $\alpha a^\dagger+\beta a+\gamma$.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-08-01T22:27:52.640" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="3918" PostTypeId="1" AcceptedAnswerId="3924" CreationDate="2018-08-01T22:36:07.587" Score="5" ViewCount="415" Body="&lt;p&gt;It seems that a coin flip &lt;em&gt;game&lt;/em&gt; is a decent metaphor for a 2-level system. Until 1 of the 2 players picks heads or tails, even if the coin has already been flipped, the &lt;em&gt;win/loss&lt;/em&gt; wave form has not yet collapsed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would rock paper scissors be a good metaphor for qutrits? Where the number of players corresponds w/ the number of qutrits (eg. $3^n$ possible states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would a standard pack of 52 cards be a good metaphor for a 52-level quantum system (the &lt;em&gt;game&lt;/em&gt; being guessing correctly a card selected from the deck at random)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly interested in game based metaphors because of the easy correlation to combinitorial game theory &amp;amp; computation complexity.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-08-01T23:24:53.523" LastActivityDate="2018-08-07T15:22:47.230" Title="Good metaphors for n-level quantum systems" Tags="&lt;complexity-theory&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3919" PostTypeId="2" ParentId="3918" CreationDate="2018-08-01T23:15:26.043" Score="2" Body="&lt;p&gt;Rock paper scissors seems a good one. &#xA;Now for the cards pack, I would not see the collapse metaphor here. While a player has not shown his cards, the cards are already set even if you do not see them. But I guess it is a point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe just pick a MMORPG with 52 monsters appearing randomly.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-08-01T23:15:26.043" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3920" PostTypeId="1" AcceptedAnswerId="3921" CreationDate="2018-08-02T02:11:17.597" Score="8" ViewCount="178" Body="&lt;p&gt;I'm a computer science major who's really keen on physics and quantum mechanics. I have started learning about Q# and D-Wave, but I just wanted to know if it's possible to test quantum mechanical theories using quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, then what all different things should I look into? For example, Q# allows us about 30 qubits for free developing. What kind of simulations can I do with that many qubits?&lt;/p&gt;&#xA;" OwnerUserId="4259" LastEditorUserId="26" LastEditDate="2019-03-12T09:11:30.550" LastActivityDate="2019-03-12T09:11:30.550" Title="Can we perform quantum mechanical simulations using a quantum computer?" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3921" PostTypeId="2" ParentId="3920" CreationDate="2018-08-02T02:20:19.763" Score="4" Body="&lt;p&gt;What do you mean by &quot;Quantum Mechanical Simulations&quot; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the primary motivations in the early history of quantum computing was a statement from Richard Feynman that a quantum computer would be able to effectively simulate quantum systems. To that end, a lot of the nearest term quantum programs people are trying to run (and have run) are simulations of ground states of atoms and molecules. These are very classically resource intensive, but &lt;a href=&quot;https://www.ibm.com/blogs/research/2017/09/quantum-molecule/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM has done this to good success&lt;/a&gt; on smaller highly symmetric molecules using their current quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you are wondering if we can test Quantum Mechanics as a theory using a Quantum Computer things like &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell's Inequalities&lt;/a&gt; can be tested. This is a proof that a system is Quantum Mechanical, as there is an inequality which can only be broken if using entanglement. The article linked has a good explanation, and goes into some of the experimental verifications which have already been done, but such a test is one of the ways to ensure that a given Black Box Computer is quantum is nature.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-08-02T02:20:19.763" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3922" PostTypeId="2" ParentId="3918" CreationDate="2018-08-02T02:22:23.290" Score="2" Body="&lt;p&gt;A rolling n-sided die would be a good analogy that follows the coin example very closely. Until the die settles you can think of it as having not &quot;collapsed&quot;, and die can come in whatever side number desired (at least in your mind, if you're trying to make a physical example that might be difficult.)&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-08-02T02:22:23.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3923" PostTypeId="2" ParentId="3918" CreationDate="2018-08-02T04:31:34.117" Score="8" Body="&lt;p&gt;There is always a difference between a quantum system and a classical metaphor. If a system is a qubit in a pure state, then there always exists a measurement basis (or alternatively a proper unitary gate for the standard measurement basis) such that the measurement outcome is 100% predictable, and a measurement basis with measurement outcome 50%-50%. You can't demonstrate this feature using a classical metaphor - in classical physics random is random and deterministic is deterministic.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2018-08-02T04:31:34.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3924" PostTypeId="2" ParentId="3918" CreationDate="2018-08-02T15:57:14.133" Score="4" Body="&lt;p&gt;Your metaphor can be chosen as $N-1$ identical coins, such that the outcome state vector corresponds to the sum of the heads. Thus we wind up in the state $|k\rangle$ when we have $k$ heads and $N-1-k$ tails. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this approach you can actually associate your metaphor with a classical phase space, as a generalization of the association of a qubit with the Bloch sphere whose generator can be thought in the coin case as the direction of the normal to the coin's face.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the multiple coin case, we have $N-1$ such directions. But since in our Hilbert space we don't mind the order of the coins only their summed result, in the classical phase space we should not distinguish states in which the direction of the normal to the coins faces switch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I just described to you in words is actually the &lt;em&gt;Majorana representation&lt;/em&gt; (some call it the Majorana star representation), which is based on the isomorphism of the symmetrized tensor product of $N-1$ spheres to the complex projective space $CP^{N-1}$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\otimes_{\mathrm{sym}} ^{N-1}  S^2 \cong CP^{N-1}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The geometric quantization of this complex projective space is the $N-$ level system. There is some renewed interest in this representation, partially motivated by holonomic quantum computation, please see for example &lt;a href=&quot;https://arxiv.org/abs/1406.6821v4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Liu and Fu&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the outcome of the coin flipping in the case of a single qubit can be described as a measurement of the angular momentum component of the coin in the $z$ direction $j_z$. It is not hard to see that the corresponding operator in the multiple coin flip is the sum of the individual angular momenta:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$J_z = \sum_1^{N-1} j^{(i)}_z$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The above equation is just standard shorthand used by physicists since the operators act on different components in the tensor product Hilbert space). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In the $N\times N$ matrix representation, this operator can be chosen as: $J_z = \mathrm{diag}[N-1, N-3, .,.,., -N+1]$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This representation of the $N-$ qubit system has a further analogy. As in the case of a single coin or qubit, the distribution function of the operator $j_z$ is Bernoullian  for any state (density matrix) in which the system is prepared; the distribution function of $J_z$ in the multiple coin case is Binomial, for any choice of the density matrix of the system.  Thus in both cases this observable returns the classical distribution function.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-08-02T15:57:14.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3925" PostTypeId="2" ParentId="3920" CreationDate="2018-08-02T18:48:20.270" Score="6" Body="&lt;p&gt;A separate note on using simulators for this (as opposed to using an actual quantum computer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulators, like the one that ships with Q#, are built to simulate quantum mechanical theories as we understand them now. This means that any experiment you run on a simulator will behave exactly as the theory says (well, unless the simulator has a bug in the code), but it doesn't mean that this experiment confirms the theory - it only means that it's a good simulation/illustration of the theory.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-08-02T18:48:20.270" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3927" PostTypeId="2" ParentId="3918" CreationDate="2018-08-02T20:40:00.683" Score="3" Body="&lt;p&gt;A coin is an extremely bad and highly misleading analogy for a qubit.  You shouldn't use it by any means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, if you want an equally bad and misleading analogy for a qu-$d$-it, you should use something which is random and has $d$ possible outcome.  For $d=3$, this might be rock-paper-scissors.  On the other hand, a deck of cards with $52$ cards can have $52!$ possibilities, so it is an equally bad analogy for a qu-$(52!)$-it.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It has been suggested to add an explanation why I think this is a horrible analogy.  The key point is that it pretends that quantum mechanics is merely classical randomness -- something which can be easily understood with our classical intuition, and thereby implying that all that talking about quantum mechanics being special is just talking.  Indeed, the coin analogy already fails for a single qubit, when one performs measurements in more than one basis.  This is for instance explained in DaftWullie's answer. Now one could argue that his answer also provides a way to model this with coins, but (1) these are coins which are rigged in a very weird way, and (2) it is still incomplete -- I just need to toss in measurement in yet another basis to make the whole description break down, and to yield an even more complex pattern of rigged coins (even worse, those coins would not get tossed after looking at another coins as in DW's answer, but they would get tossed in a &lt;em&gt;biased&lt;/em&gt; way depending on which measurement I did).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, since quantum theory is a theory about measurements -- which have classical inputs, i.e. measurement settings, and classical outputs, i.e. measurement outcomes -- we can always model this with classical objects which follow some odd distribution. However, the point is exactly that this distribution cannot be modeled by coins any more in any even remotely reasonable way (even more so once we consider two spatially separated qubits).  &lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-08-07T15:22:47.230" LastActivityDate="2018-08-07T15:22:47.230" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="3928" PostTypeId="2" ParentId="3863" CreationDate="2018-08-03T06:42:29.437" Score="11" Body="&lt;p&gt;A conventional Hamiltonian is Hermitian. Hence, if it contains a non-Hermitian term, it must either also contain its Hermitian conjuagte as another term, or have 0 weight. In this particular case, since $Z\otimes X\otimes Y$ is Hermitian itself, the coefficient would have to be 0. So, if you're talking about conventional Hamiltonians, you've probably made a mistake in your calculation. Note that if the Hermitian conjugate of the term is not present, you cannot simply fix things by adding it in; it will give you a completely different result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, you might be wanting to implement a &lt;em&gt;non-Hermitian&lt;/em&gt; Hamiltonian. These things do exist, often for the description of noise processes, but are not nearly so widespread. You need to explicitly include the &quot;non-Hermitian&quot; terminology, otherwise everyone will just think that what you're doing is wrong because it's not Hermitian, and a Hamiltonian should be Hermitian. I'm not overly familiar with what capabilities the various simulators provide, but I'd be surprised if they have non-Hermiticity built in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can simulate it, at the cost of non-deterministic implementation. There will be more sophisticated methods than this (see the links in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3911/1837&quot;&gt;this answer&lt;/a&gt;), but let me describe a particularly simply one: I'm going to assume there's only one non-Hermitian component, which is $i\times$(a tensor product of Paulis). I'll call this tensor product of Paulis $K$. The rest of the Hamiltonian is $H$. You want to create the evolution&#xA;$$&#xA;e^{-iHt+Kt}&#xA;$$ &#xA;We start by Trotterising the evolution,&#xA;$$&#xA;e^{-iHt+Kt}= \prod_{i=1}^Ne^{-iH\delta t+K\delta t}&#xA;$$&#xA;where $N\delta t=t$. Now we work on simulating an individual term $e^{-iH\delta t+K\delta t}\approx e^{-iH\delta t}e^{K\delta t}$ (which becomes more accurate at large $N$). You already know how to deal with the Hermitian part so, focus on $$e^{K\delta t}=\cosh(\delta t)\mathbb{I}+\sinh(\delta t)K.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We introduce an ancilla qubit in the state $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$, and we use this as the control qubit in a controlled-$K$ gate. Then we measure the ancilla in the $\{|\psi\rangle,|\psi^\perp\rangle\}$ basis (where $\langle\psi|\psi^\perp\rangle=0$). If the outcome is $|\psi\rangle$, then on the target qubits we have implemented the operation $|\alpha|^2\mathbb{I}+|\beta|^2K$, up to normalisation. So, if you fix $(1-|\alpha|^2)/|\alpha|^2=\tanh(\delta t)$, you have perfectly implemented that operation. If the measurement fails, then it's up to you whether you want to try to recover (this may well not be possible) or start again.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-03T06:47:58.537" LastActivityDate="2018-08-03T06:47:58.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3929" PostTypeId="1" AcceptedAnswerId="3931" CreationDate="2018-08-03T15:06:12.370" Score="6" ViewCount="560" Body="&lt;p&gt;I’m trying to calculate the probability amplitudes for this circuit:&#xA;&lt;img src=&quot;https://i.stack.imgur.com/O92sm.png&quot; alt=&quot;Quantum Circuit&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My Octave code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sys = kron([1; 0], [1;0], [1;0])&#xA;h = 1/sqrt(2) * [1 1; 1 -1];&#xA;c = [1 0 0 0; 0 1 0 0; 0 0 0 1; 0 0 1 0];&#xA;op1 = kron(h, eye(2), eye(2));&#xA;op2 = kron(c, eye(2));&#xA;op3 = kron(eye(2), c);&#xA;op4 = kron(h, eye(2), eye(2));&#xA;op4*op3*op2*op1 * sys&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ans =&#xA;0.50000&#xA;0.00000&#xA;0.00000&#xA;0.50000&#xA;0.50000&#xA;0.00000&#xA;0.00000&#xA;-0.50000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This differs from the results the quantum circuit simulator gives me, where have I gone wrong?&lt;/p&gt;&#xA;" OwnerUserId="4275" LastEditorUserId="26" LastEditDate="2018-12-23T13:19:00.720" LastActivityDate="2018-12-23T13:19:00.720" Title="Incorrectly Calculating Probability Amplitudes for 3-qbit Circuit" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;quirk&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3930" PostTypeId="2" ParentId="3929" CreationDate="2018-08-03T15:41:07.603" Score="3" Body="&lt;p&gt;The output you've stated there appears to be correct. The Hadamard produces&#xA;$$&#xA;|000\rangle\mapsto\frac{1}{\sqrt{2}}(|000\rangle+|100\rangle).&#xA;$$&#xA;Then, the two controlled-nots give&#xA;$$&#xA;\mapsto\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle).&#xA;$$&#xA;The final Hadamard then yields&#xA;$$&#xA;\mapsto\frac{1}{2}((|0\rangle+|1\rangle)|00\rangle+(|0\rangle-1|\rangle)|11\rangle).&#xA;$$&#xA;This is the same as $\frac12(|000\rangle+|011\rangle+|100\rangle-|111\rangle)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is presumably with the quantum simulator, or your interpretation of it, but since you don’t specify what simulator you’re using, it’s difficult to know...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-04T05:09:38.047" LastActivityDate="2018-08-04T05:09:38.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3931" PostTypeId="2" ParentId="3929" CreationDate="2018-08-03T16:31:43.117" Score="5" Body="&lt;p&gt;You're getting the same output as Quirk, just with a different bit ordering convention for the kets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quirk considers the top qubit to be the &quot;least significant&quot; qubit (i.e. if you count 000, 001, 010, ... then it refers to the rightmost bit). So if you apply a Hadamard gate to the top qubit of a three-qubit circuit in Quirk you get the state |000&gt; + |001&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your code you are using the opposite convention, and putting the H as the first argument to kron instead of the last argument, so you would get |000&gt; + |100&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get comparable results you just need to vertically mirror the Quirk circuit, e.g. by throwing in a swap gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22Swap%22%2C1%2C%22Swap%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wE82H.png&quot; alt=&quot;reversed circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-08-03T16:31:43.117" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3932" PostTypeId="1" AcceptedAnswerId="3950" CreationDate="2018-08-03T22:03:59.450" Score="13" ViewCount="735" Body="&lt;p&gt;Officials in Rubik's cube tournaments have used two different ways of scrambling a cube.  Presently, they break a cube apart and reassemble the cubies in a random order $\pi\in G$ of the Rubik's cube group $G$.  Previously, they would apply a random sequence $g$ of Singmaster moves $\langle U,D, F, B, L, R\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the length $t$ of the word $g$ - the number of random moves needed in order to fully scramble the cube such that each of the $\Vert G\Vert=43,252,003,274,489,856,000$ permutations is roughly equally likely to occur - is presently unknown, but &lt;a href=&quot;https://www.popsci.com/science/article/2010-08/gods-number-revealed-20-moves-will-solve-any-rubiks-cube-position&quot; rel=&quot;nofollow noreferrer&quot;&gt;must be at least&lt;/a&gt; $20$.  This length $t$ can be called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Markov_chain_mixing_time&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;mixing time&lt;/em&gt;&lt;/a&gt; of a random walk on the Cayley graph of the Rubik's cube group generated by the Singmaster moves $\langle U,D, F, B, L, R\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would a quantum computer have any advantages to determining the mixing time $t$ of the Rubik's cube group?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think we can have some clever sequence of Hadamard moves to create a register $\vert A \rangle$ as a uniform superposition over all $\Vert G\Vert$ such configurations; thus applying any sequence of Singmaster moves to $\vert A \rangle$ doesn't change $\vert A \rangle$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have a guess $t'$ as to what the mixing time $t$ is, we can also create another register $\vert B \rangle$ as a uniform superposition of all Singmaster words of length $t'$, and conditionally apply each such word to a solved state $\vert A'\rangle$, to hopefully get a state $\vert B\rangle \vert A\rangle$ such that, if we measure $\vert A \rangle$, each of the $\Vert G \Vert$ configurations are equally likely to be measured.  If $t'\lt t$, then we won't have walked along the Cayley graph of $G$ for long enough, and if we were to measure $\vert A \rangle$, configurations that are &quot;closer&quot; to the solved state would be more likely. Some clever Fourier-like transform on $\vert B \rangle$ might be able to measure how uniformly distributed $\vert A \rangle$ is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me this feels like something a quantum computer may be good at.  For example, if $\vert A \rangle$ hasn't been uniformly mixed by all of the words in $\vert B\rangle$, then some configurations are more likely than others, e.g. $\vert A \rangle$ is more &quot;constant&quot;; whereas if $\vert A \rangle$ &lt;em&gt;has&lt;/em&gt; been fully mixed by all of the walks, then $\vert A \rangle$ is more &quot;balanced&quot;.  But my inuition about both quantum algorithms and Markov chains is not strong enough to get very far.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Contrast this question with the quantum knot verification problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the quantum knot verification, a merchant is given a quantum coin as a state $\vert K \rangle$ of all knots that have a particular invariant.  In order to verify the quantum coin, she applies a Markov chain $M$ to transition $\vert K \rangle$ to &lt;em&gt;itself&lt;/em&gt; (if it's a valid coin.)  She must apply this Markov chain and measure the result at least $t$ times, but otherwise she has no way to construct $\vert K \rangle$ on her own (lest she could forge the coin.)  So if she's given a valid coin, she's given a state that she &lt;em&gt;can't produce on her own&lt;/em&gt;, along with a Markov chain as a matrix $M$, and she presumably knows the mixing time $t$; she's required to test that $\vert K \rangle$ is valid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the present question, it's probably pretty &lt;em&gt;easy&lt;/em&gt; to generate $\vert RC \rangle$ of all Rubik's cube permutations.  The quantum circuit corresponding to the Markov chain, call it $S$, of Singmaster moves, is also probably pretty easy to build.  However, the mixing time $t$ is unknown, and is the one thing to be determined.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-08-06T22:50:21.120" LastActivityDate="2019-11-30T20:17:35.107" Title="Can a quantum computer easily determine the mixing time of the Rubik's cube group?" Tags="&lt;algorithm&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3933" PostTypeId="1" CreationDate="2018-08-03T23:01:21.147" Score="13" ViewCount="358" Body="&lt;p&gt;The quantum effects of the FMO complex (photosynthetic light harvesting complex found in green sulfur bacteria) have been well studied as well as the quantum effects in other photosynthetic systems. One of the most common hypotheses for explaining these phenomenon (focusing on FMO complex) is Environment-Assisted Quantum Transport (ENAQT) originally described by &lt;a href=&quot;https://arxiv.org/abs/0807.0929&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rebentrost et al.&lt;/a&gt;. This mechanism describes how certain quantum networks can &quot;use&quot; decoherence and environment effects to improve the efficiency of quantum transport. Note that the quantum effectss arise from the transport of &lt;em&gt;excitons&lt;/em&gt; from one pigment (chlorophyll) in the complex to another. (There is a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1854/quantum-simulation-of-environment-assisted-quantum-walks-in-photosynthetic-energ&quot;&gt;question&lt;/a&gt; that discusses the quantum effects of the FMO complex in a little more detail).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that this mechanism allows for quantum effects to take place at room temperatures without the negative effects of decoherence, &lt;strong&gt;are their any applications for quantum computing?&lt;/strong&gt; There are some examples of artificial systems that utilize ENAQT and related quantum effects. However, they present biomimetic solar cells as a potential application and do not focus on the applications in quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Originally, it was &lt;a href=&quot;https://www.nature.com/articles/nature05678&quot; rel=&quot;nofollow noreferrer&quot;&gt;hypothesized&lt;/a&gt; that the FMO complex performs a Grover's search algorithm, however, from what I understand, it has now since been showed that this is not true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There have been a couple studies that use chromophores and substrates not found in biology (will add references later). However, I would like to focus on &lt;strong&gt;systems that use a biological substrate.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even for biological substrates there are a couple examples of &lt;em&gt;engineered&lt;/em&gt; systems that use ENAQT. For example, a &lt;a href=&quot;https://www.nature.com/articles/nmat4448#methods&quot; rel=&quot;nofollow noreferrer&quot;&gt;virus-based system&lt;/a&gt; was developed using genetic engineering. A &lt;a href=&quot;https://www.nature.com/articles/nmat5033&quot; rel=&quot;nofollow noreferrer&quot;&gt;DNA-based excitonic circuit&lt;/a&gt; was also developed. However, most of these examples present photovoltaics as a main example and not quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1311.4688&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vattay and Kauffman&lt;/a&gt; was (AFAIK) the first to study the quantum effects as quantum biological computing, and proposed a method of engineering a system similar to the FMO complex for quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How could we use this mechanism to build new types of computers? In&#xA;  the light harvesting case the task of the system is to transport the&#xA;  exciton the fastest possible way to the reaction center whose position&#xA;  is known. In a computational task we usually would like to find the&#xA;  minimum of some complex function $f_n$. For the simplicity let this&#xA;  function have only discrete values from 0 to K. If we are able to map&#xA;  the values of this function to the electrostatic site energies of the&#xA;  chromophores $H_{nn} = \epsilon_0 f_n$ and we deploy reaction centers&#xA;  near to them trapping the excitons with some rate $κ$ and can access&#xA;  the current at each reaction center it will be proportional with the&#xA;  probability to find the exciton on the chromophore $j_n ∼ κ\rho_{nn}$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How can the quantum effects of the FMO complex be used on a biological substrate for quantum computing? Given that the quantum effects occur due to the transport of excitons on network structures, could ENAQT provide more efficient implementations of network-based algorithms (ex: shortest path, traveling salesman, etc.)?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;P.S. I will add more relevant references if needed. Also, feel free to add relevant references as well.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="26" LastEditDate="2018-12-13T20:00:31.103" LastActivityDate="2018-12-13T20:00:31.103" Title="Does the quantum coherence in the FMO complex have any significance to quantum computing (on a biological substrate)?" Tags="&lt;decoherence&gt;&lt;biology&gt;&lt;biocomputing&gt;" AnswerCount="1" CommentCount="10" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3934" PostTypeId="2" ParentId="3918" CreationDate="2018-08-04T05:42:00.680" Score="3" Body="&lt;p&gt;A coin is not a great analogy for a quantum system. A (slightly) better one is a box that contains 3 coins. There are 3 windows, labelled x, y and z. The box is rigged so that you can only open one window at a time. When you open a window, you can see the heads/tails state of the corresponding coin, but the other two coins get flipped, and you can’t see what happens to them (unless you open another window, but then you know nothing anymore about the window you just had open because that coin has been flipped again).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m not sure that this attempt at an analogy scales very well to larger dimensional systems, because you probably can’t, in general, describe the algebra of the system using a set of mutually anti-commuting observables, so your rules for how the different coins flip would have to be more complicated. The qudit analogy has $d^2-1$ coins. For example, 2 qubits have 15 coins, each corresponds to a tensor product of 2 Paulis. You can open sets of windows that correspond to commuting observables. The other coins get flipped upon opening, but there are some consistency conditions that some outcomes of coin flips are entirely determined by the outcomes of other coin flips. It becomes messy very quickly...&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Further explanation (expanding some of the Mathematics)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Any density matrix of a qudit is described by a $d\times d$ matrix. You can pick any basis of matrices that you like to decompose that (Hermitian) matrix. You'll need $d^2$ of them, but one of those terms is always $\mathbb{I}/d$, which I don't need to count. For example, a basis for the qubit are the Pauli matrices $X$, $Y$ and $Z$ (and $\mathbb{I}$). If you correspond each of these basis elements to measurement operators, because there are 2 distinct eigenvalues, you get two measurement outcomes (like head/tails on a coin). If two operators commute, you can simultaneously know the two measurement outcomes. If the two observables anti-commute, the corresponds to maximal uncertainty between the two observables. In other words, you measure one observable (say $Z$), and the other observables ($X$ and $Y$, because both anticommute with $Z$) are complete uncertain, i.e. the coins are flipped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For qubits, all 3 observables pair-wise anticommute: $\{X,Y\}=\{Y,Z\}=\{X,Z\}=0$, so whichever measurement you choose, the other two observables reset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for two qubits, the relationships are not nearly so simple. You have all possible terms&#xA;$$&#xA;\mathbb{I}\otimes X \qquad \mathbb{I}\otimes Y \qquad \mathbb{I}\otimes Z \\&#xA;X\otimes \mathbb{I} \qquad Y\otimes \mathbb{I} \qquad Z\otimes \mathbb{I} \\&#xA;X\otimes X \qquad X\otimes Y \qquad X\otimes Z \\&#xA;Y\otimes X \qquad Y\otimes Y \qquad Y\otimes Z \\&#xA;Z\otimes X \qquad Z\otimes Y \qquad Z\otimes Z&#xA;$$&#xA;You can see that not all of these pair-wise anticommute, because $\mathbb{I}\otimes Z$ and $Z\otimes \mathbb{I}$ commute, for example. So, we could simultaneously measure the set of observables $\mathbb{I}\otimes Z$, $Z\otimes \mathbb{I}$ and $Z\otimes Z$, but all other observables are completely uncertain. Overall, you'd have 15 coins and there are sets of 3 windows that you can open simultaneously, and all other coins are flipped at that instant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to describe the same thing for qutrits, it gets more messy because you can use a basis where everything gives 2 answers, but there's not a perfect division into whether operators commute or anticommute, so you get partial connections between coins which are messier to give a classical equivalent of.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-05T08:01:23.260" LastActivityDate="2018-08-05T08:01:23.260" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3935" PostTypeId="1" AcceptedAnswerId="3941" CreationDate="2018-08-04T11:05:54.010" Score="6" ViewCount="466" Body="&lt;p&gt;Having n qubits, I want to have the unitary described a controlled operation.&#xA;Say for example you get as input a unitary, an index for a controlled qubit and another for a target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you code this unitary operation?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-12-23T13:15:44.150" LastActivityDate="2018-12-23T13:15:44.150" Title="How do we code the matrix for a controlled operation knowing the control qubit, the target qubit and the $2\times 2$ unitary?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3936" PostTypeId="1" AcceptedAnswerId="3938" CreationDate="2018-08-04T11:46:11.020" Score="6" ViewCount="297" Body="&lt;p&gt;Say I have a string representing the operations of a quantum circuit.&#xA;I want to have the unitary operator representing it.&#xA;Is there a tool for doing so in Python or else?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-12-23T13:14:40.970" LastActivityDate="2018-12-23T13:14:40.970" Title="Is there a tool that can give you the unitary representing a quantum circuit from just a string?" Tags="&lt;resource-request&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3937" PostTypeId="2" ParentId="3936" CreationDate="2018-08-04T13:48:54.587" Score="2" Body="&lt;p&gt;Normally, quantum simulators ask you to specify a starting state, for example,  all qubits initially in state $|0\rangle$, and then they give you the final state after that initial state evolves through all of the SEO (sequence of elementary operations). This is performed in my software Qubiter by the class SEO_simulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, a well designed simulator package should also multiply the SEO and give you the unitary matrix it represents. This is done in &lt;a href=&quot;https://github.com/artiste-qb-net/qubiter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qubiter&lt;/a&gt; by the class &lt;code&gt;SEO_MatrixProduct&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have described the features of Qubiter in some of my other answers; it is my own code.&lt;/p&gt;&#xA;" OwnerUserId="1974" LastEditorUserId="91" LastEditDate="2018-08-07T21:19:42.303" LastActivityDate="2018-08-07T21:19:42.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3938" PostTypeId="2" ParentId="3936" CreationDate="2018-08-04T13:52:58.263" Score="6" Body="&lt;p&gt;You can use Python with Qiskit. Say your string representation is written using OpenQASM syntax.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qasm = &quot;&quot;&quot;&#xA;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q[2];&#xA;h q[0];&#xA;t q[1];&#xA;cx q[0], q[1];&#xA;&quot;&quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can build a circuit out of this and simulate it on a unitary simulator:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as qk&#xA;import numpy as np&#xA;circuit = qk.load_qasm_string(qasm)&#xA;result = qk.execute(circuit, 'local_unitary_simulator').result()&#xA;print(np.round(result.get_unitary(), 1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Yields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[ 0.7+0.j   0.7-0.j   0. +0.j   0. +0.j ]&#xA;[ 0. +0.j   0. +0.j   0.5+0.5j -0.5-0.5j]&#xA;[ 0. +0.j   0. +0.j   0.5+0.5j  0.5+0.5j]&#xA;[ 0.7+0.j  -0.7+0.j   0. +0.j   0. +0.j ]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2018-08-04T13:52:58.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3939" PostTypeId="2" ParentId="3935" CreationDate="2018-08-04T14:59:22.240" Score="6" Body="&lt;p&gt;I would solve it like that: suppose you have CNOT gate; it's unitary matrix can be written as a sum of tensor products&#xA;$$&#xA;\begin{pmatrix}1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&#xA;\end{pmatrix}\otimes&#xA;\begin{pmatrix}1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}+&#xA;\begin{pmatrix}0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}\otimes&#xA;\begin{pmatrix}0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&#xA;(this is another way to say: if first qubit is 0, the second qubit is unchanged; if first qubit is 1, the second qubit is swapped).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we have more qubits, we need to insert additional identity matrices&#xA;$$&#xA;\begin{pmatrix}1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&#xA;into the tensor products from the left, from the right, or into the middle, depending on the indexes of control and target CNOT qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I also assumed that the index of control qubit is less than the index of target qubit; if this is not the case swap the terms in the tensor products in the first equation.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-08-05T03:31:29.770" LastActivityDate="2018-08-05T03:31:29.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3940" PostTypeId="2" ParentId="3893" CreationDate="2018-08-04T17:02:55.107" Score="3" Body="&lt;p&gt;I think you are misunderstanding what a basis vector is. $|0\rangle$ and $|1\rangle$ are basis vectors and these are referred to a rectilinear basis vectors and $\frac{|0\rangle+|1\rangle}{\sqrt{2}} = |+\rangle$ and $\frac{|0\rangle-|1\rangle}{\sqrt{2}} = |-\rangle$ are basis vectors too and these are referred to as diagonal basis vectors. The hadamard transform takes a vector from one basis representation to another. If you take a dot product between the diagonal basis vectors i.e $\langle+|-\rangle$ you will realize that they are orthonormal. It is entirely possible for a Hilbert space and more generally a vector space to have multiple sets of basis vectors.&lt;/p&gt;&#xA;" OwnerUserId="422" LastActivityDate="2018-08-04T17:02:55.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3941" PostTypeId="2" ParentId="3935" CreationDate="2018-08-05T05:14:03.127" Score="5" Body="&lt;p&gt;Here’s some pseudo code, where &lt;code&gt;id(n)&lt;/code&gt; creates an $2^n\times 2^n$ identity matrix, and &lt;code&gt;tensor(A,B,...)&lt;/code&gt; returns $A\otimes B\otimes\ldots$.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;def cU(ctrl,targ,U,size):&#xA;    '''implement controlled-U with:&#xA;          control qubit ctrl,&#xA;          target qubit targ,&#xA;          within a set of size qubits'''&#xA;#check input ranges&#xA;    assert 1&amp;#60;=ctrl&amp;#60;=size&#xA;    assert 1&amp;#60;=targ&amp;#60;=size&#xA;    assert ctrl&amp;#60;&amp;#62;targ&#xA;    assert ctrl,targ,size &amp;#8714; &amp;#8484;&#xA;#ensure U is a 2x2 unitary&#xA;    assert U&amp;#8714;&amp;#8450;&lt;sup&gt;2x2&lt;/sup&gt;&#xA;    assert U.U&lt;sup&gt;&amp;dagger;&lt;/sup&gt;=id(2)&#xA;#the actual code&#xA;    if ctrl&amp;#60;targ:&#xA;        return id(size)+tensor(id(ctrl-1),id(1)-Z,id(targ-1-ctrl),U-id(1),id(size-targ))/2&#xA;    else:&#xA;        return id(size)+tensor(id(targ-1),U-id(1),id(ctrl-1-targ),id(1)-Z,id(size-ctrl))/2&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, remember that usually you're trying to calculate the action of a unitary on some state vector. It will be far more memory efficient to calculate that application directly, rather than first calculating the unitary matrix and applying it to the state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand where this formula came from, think about the two-qubit version, where the first qubit is the control qubit. You'd normally write the unitary as&#xA;$$&#xA;|0\rangle\langle 0|\otimes\mathbb{I}+|1\rangle\langle 1|\otimes U.&#xA;$$&#xA;Let's rewrite this as&#xA;$$&#xA;(\mathbb{I}-|1\rangle\langle 1|)\otimes\mathbb{I}+|1\rangle\langle 1|\otimes U=\mathbb{I}\otimes\mathbb{I}+|1\rangle\langle 1|\otimes (U-\mathbb{I}).&#xA;$$&#xA;It can be easier to write things in terms of Pauli matrices, so&#xA;$$&#xA;|1\rangle\langle 1|=(\mathbb{I}-Z)/2.&#xA;$$&#xA;To get the same unitary on a different number of qubits, you just need to pad with identity matrices everywhere.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-06T07:21:48.817" LastActivityDate="2018-08-06T07:21:48.817" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3942" PostTypeId="2" ParentId="2414" CreationDate="2018-08-05T10:40:39.633" Score="6" Body="&lt;p&gt;To start off, I would really suggest you to read this review on &quot;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0410100.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum information with continuous variables(cv)&lt;/a&gt;&quot;. It covers most of your questions with cv architecture. Since it is a very big review, I will try to address your questions with what I can remember from reading that paper and glancing over it again now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For discrete variables(dv), as you have mentioned, Knill and Laflamme have pioneered the LOQC. But this approach was translated to cvs shortly after the proposal for realization of cv teleportation by Braunstein &lt;em&gt;et al.&lt;/em&gt; They showed that &lt;a href=&quot;https://www-users.cs.york.ac.uk/schmuel/papers/Aetal98.pdf&quot; rel=&quot;noreferrer&quot;&gt;cv quantum error correction codes can be implemented using only linear optics and resources of squeezed light&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now coming to the universality of this type of quantum computer, they have also shown in the paper that a universal quantum computer for the amplitudes of the electromagnetic field might be constructed using linear optics, squeezers and at least one further non-linear optical element such as the Kerr effect(pg.48~50). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try to summarize their proof verbally as simple as I can. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) It is true that, for universal qcs, logical operations can only affect few variables in the form of qubit logic gates and by stacking those gates, it can effect any unitary transformation over a finite number of those variables to any desired degree of precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The argument is that since an arbitrary unitary transformation over even a single cv requires an infinite number of parameters to define, it typically cannot be approximated by any finite number of quantum operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) This problem is tackled by showing that a notion of universal quantum computation over cvs for various subclasses of transformations, such as Hamiltonians (which are polynomial functions of the operators corresponding to the cvs). A set of continuous quantum operations will be termed universal for a particular set of transformations if one can, by a finite number of applications of the operations, approach arbitrarily closely to any transformation in the set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) The result is a very lengthy mathematical proof of constructing quadratic Hamiltonians for EM fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to answer your question, even though, as you mentioned, the squeezing of light adds external noise to qc, I believe that it can be used for error correcting the same noise. Along with that, the claim of quantum speedup arrives from the fact that to generate all unitary transformations given by an arbitrary polynomial Hermitian Hamiltonian (as is necessary to perform universal cv quantum computation), one must include a gate described by a Hamiltonian other than an inhomogeneous quadratic in the canonical operators. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These nonlinear transformations can be used in cv algorithms and may provide a significant speedup over any classical process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to conclude, yes cv quantum computation looks optimistic because most of it is theoretical at this point. There are only a few experimental confirmations of the cv architecture like &quot;squeezed-state EPR entanglement&quot;, &quot;coherent state quantum teleportation&quot; etc. But the recent experiments in &quot;quantum key distribution&quot; and &quot;quantum memory effect&quot; shows that continuous variable quantum computers have the potential to be as effective as their discrete counterparts if not more for some tasks. &lt;/p&gt;&#xA;" OwnerUserId="419" LastActivityDate="2018-08-05T10:40:39.633" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="3943" PostTypeId="1" AcceptedAnswerId="3944" CreationDate="2018-08-05T17:41:03.960" Score="11" ViewCount="6007" Body="&lt;p&gt;I've been reading through &quot;Quantum Computing: A Gentle Introduction&quot;, and I've been struggling with this particular problem. How would you create the circuit diagram, and what kind of reasoning would lead you to it?&lt;/p&gt;&#xA;" OwnerUserId="4287" LastEditorUserId="26" LastEditDate="2018-12-23T13:14:05.323" LastActivityDate="2018-12-23T13:14:05.323" Title="How do you implement the Toffoli gate using only single-qubit and CNOT gates?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3944" PostTypeId="2" ParentId="3943" CreationDate="2018-08-05T18:10:40.613" Score="13" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DgKJu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DgKJu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the decomposition (I took this from google images, originally on &lt;a href=&quot;https://www.semanticscholar.org/paper/On-the-CNOT-cost-of-TOFFOLI-gates-Shende-Markov/860a047de8a2fe56ab1f9fc0391da54495191266&quot; rel=&quot;noreferrer&quot;&gt;this website.&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to understand how to decompose it, we can look at it's base structure. The idea is that we combine gates that cancel out, but put CNOT gates in between such that if the specific NOT is executed, the gates don't cancel. This is how generic controlled-U gates are implemented for arbitrary U. as explained in Quantum Computation and Quantum Information by Nielsen and Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a simpler example, imagine you have a gate U and you want to make a controlled-U from it, with just one control. To do so you find single qubit gates A, B, C such that CBA = I, but CXBXA = U. By putting a CNOT where every X gate must be applied, you have created a control-U gate. Similar logic applies in the CC-U case, except you need EDCBA  = EXDCXBA = EDXCBXA = I up to a phase, and EXDXCXBXA = U. Where the first and third X corresponds to a CNOT from one control, and the second and fourth are from the other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially the intuition for this structure is that you want the have the bottom line cancel out if either control is zero, and to be your desired unitary if they both apply the not gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For additional reading check out pages 181-183 in Nielsen and Chuang. [EDIT: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/004-Quantum_Algorithms/061-Basic_Circuit_Identities_and_Larger_Circuits.html&quot; rel=&quot;noreferrer&quot;&gt;The link @Norbert Schuch posted&lt;/a&gt; also contains the same info, and you don't need to track down a textbook.]&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-08-05T21:32:22.463" LastActivityDate="2018-08-05T21:32:22.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3946" PostTypeId="2" ParentId="3898" CreationDate="2018-08-06T03:28:26.163" Score="5" Body="&lt;p&gt;One recent breakthrough which is not covered in that survey is &lt;em&gt;cheat sheets&lt;/em&gt;. See, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Separations in communication complexity using cheat sheets and information complexity&lt;/em&gt;;&#xA;  Anurag Anshu, Aleksandrs Belovs, Shalev Ben-David, Mika Göös, Rahul Jain, Robin Kothari, Troy Lee, and Miklos Santha;&#xA;  &lt;a href=&quot;https://arxiv.org/abs/1605.01142&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1605.01142 [quant-ph]&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It might be a good idea to first familiarize yourself with the cheat sheet framework.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Separations in query complexity using cheat sheets&lt;/em&gt;;&#xA;  Scott Aaronson, Shalev Ben-David, Robin Kothari;&#xA;  &lt;a href=&quot;https://arxiv.org/abs/1511.01937v1&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1511.01937 [quant-ph]&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Personally, I like thinking about query complexity as a whole instead of specializing in communication complexity. A lot of theorems in traditional query complexity can be &lt;em&gt;lifted&lt;/em&gt; into communication complexity, and indeed that is what they do in the above paper.&lt;/p&gt;&#xA;" OwnerUserId="1813" LastActivityDate="2018-08-06T03:28:26.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3947" PostTypeId="1" AcceptedAnswerId="3949" CreationDate="2018-08-06T06:15:11.103" Score="6" ViewCount="1134" Body="&lt;p&gt;When I look at most circuits (admittedly small sample as I'm a beginner), the Hadamard gate is used a lot to prepare a superposition from say the $\mid0\rangle$ state.&lt;br&gt;&#xA;But upon a little reflection, we can prepare a superposition using a $\dfrac{\pi}{2}$ rotation about the X axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do know that a successive application of the Hadamard gate yields the initial state back (for any state).&lt;br&gt;&#xA;If we have one of $\mid0\rangle$ or $\mid1\rangle$, we can recover them using a succession of said rotation followed by a NOT gate (Pauli-X).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So why is the Hadamard gate preferred to create superpositions when it uses more gates (rotation about Z then rotation about X then rotation about Z again)?&lt;br&gt;&#xA;If it is because the Hadamard gate allows recovery of any initial state, why is that property so important? (Even when not actually used when I look at the examples I see.)&lt;/p&gt;&#xA;" OwnerUserId="2417" LastEditorUserId="26" LastEditDate="2018-12-23T13:13:24.013" LastActivityDate="2018-12-23T13:13:24.013" Title="Advantange of Hadamard gate over rotation about the X axis for creating superpositions" Tags="&lt;quantum-gate&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3948" PostTypeId="2" ParentId="3947" CreationDate="2018-08-06T07:00:23.630" Score="3" Body="&lt;p&gt;Any Hermitian quantum gate $U$ is &quot;self-recovering&quot;. This is because $U$ is unitary, and&#xA;$$UU^{\dagger}=U^{\dagger}U=I$$&#xA;If $U$ is also Hermitian, then $U=U^{\dagger}$ and&#xA;$$UU=I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hadamard gate prepares $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ superposition from $|0\rangle$ state. If you need this superposition, you use Hadamard. If you need a different superposition, $\alpha|0\rangle + \beta|1\rangle$ with some $\alpha$ and $\beta$, you need a different gate or a sequence of gates; Hadamard gate has no advantage here.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-08-06T09:50:35.523" LastActivityDate="2018-08-06T09:50:35.523" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="3949" PostTypeId="2" ParentId="3947" CreationDate="2018-08-06T07:09:30.973" Score="4" Body="&lt;p&gt;It's mostly about simplicity and adopted convention. In the end, this is basically the same question as &quot;why should I pick a universal set of gates A rather than a universal set B?&quot; (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1581/1837&quot;&gt;here&lt;/a&gt;). Experimentalists would pick the universal set they have available. Theorists just pick something that they like to work with, and eventually a convention is adopted. But it doesn't matter which convention they adopt because any universal set is easily converted into any other universal set, and it is (or should be) understood that the quantum circuits describing algorithms are not what you actually want to run on a quantum computer: you need to recompile them for the available gate set and optimise based on the available architecture (and this process is unique to each architecture).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could use operations such as $\sqrt{X}$, but they are a little bit more fiddly because of all the imaginary numbers that appear. Or there's $\sqrt{Y}$ which gives an even more direct comparison to $H$, avoiding imaginary numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the main purposes of $H$ in a quantum circuit is to prepare uniform superpositions: $H|0\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$. But $\sqrt{Y}$ also does this: $\sqrt{Y}|1\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$. When you start combining multiple Hadamards on unknown input states (i.e. the Hadamard transform), it has a particularly convenient structure&#xA;$$&#xA;H^{\otimes n}=\frac{1}{\sqrt{2^n}}\sum_{x,y\in\{0,1\}^n}(-1)^{x\cdot y}|x\rangle\langle y|.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard gives you some very nice inter-relations (reflecting basis changes between pairs of mutually unbiased bases),&#xA;$$&#xA;HZH=X\qquad HXH=Z \qquad HYH=-Y.&#xA;$$&#xA;It also enables relations between controlled-not and controlled phase, and between controlled-not in two different directions (swapping control and target). There are similar relations for $\sqrt{Y}$:&#xA;$$&#xA;\sqrt{Y}Z\sqrt{Y}^\dagger=YZ=iX \qquad \sqrt{Y}X\sqrt{Y}^\dagger=YX=-iZ\qquad \sqrt{Y}Y\sqrt{Y}^\dagger=Y&#xA;$$&#xA;Part of this looking (slightly) nicer is because, as stated in the question, $H^2=\mathbb{I}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way that many courses introduce the basic idea of quantum computation, and interference, is to use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Mach%E2%80%93Zehnder_interferometer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mach-Zehnder interferometer&lt;/a&gt;. This consists of two beam splitters which, mathematically, should be described by $\sqrt{X}$ (or $\sqrt{Y}$ would do). Indeed, this is important for a first demonstration because of course these operations are &quot;square root of not&quot;, which you can prove is logically impossible classically. However, once that initial introduction is over, theorists will often substitute the beam splitter operation for Hadamard, just because it makes everything slightly easier.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-07T08:00:47.517" LastActivityDate="2018-08-07T08:00:47.517" CommentCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="3950" PostTypeId="2" ParentId="3932" CreationDate="2018-08-06T07:40:02.150" Score="6" Body="&lt;p&gt;It's an interesting question which is better than most &quot;is there a quantum algorithm for x?&quot; questions. I don't know of an existing quantum algorithm. Let me describe what I think would be a typical first attempt, and why that fails. At the end I'll describe a couple of things that might lead to some improvements.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;First Attempt at an Algorithm&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let's say I want to test a particular mixing time $t$. I'm going to create one register, $RC$ to contains sufficient workspace to hold any of the possible configurations of the Rubik's cube. The initial state of this is a product state that corresponds to the starting state of the cube.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I'm going to make $t$ ancilla registers, $A_1$ to $A_t$. Each of these is the same size as the number of possible Singmaster moves, and is prepared as a uniform superposition across all possible basis elements. Then for each $i=1,\ldots t$, we apply a controlled-unitary from $A_i$ to $RC$ where the register $A_i$ specifies which Singmaster move is applied on $RC$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After all this, if we just look at $RC$, it should be in the maximally mixed state if the mixing has happened as desired. The problem is how to test whether or not this output is the maximally mixed state. There are useful techniques such as &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0203016&quot; rel=&quot;noreferrer&quot;&gt;this one&lt;/a&gt;, but what accuracy do we require (i.e. how many repetitions?). We'll need about $|A|^t$ to be sure, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, this way of doing things is just as bad as doing it classically: you could replace the initial state of each of the $A_i$ with $\mathbb{I}/2^{|A_i|}$ and it wouldn't change the outcome. But this really is just like making a random choice each time and running many times, checking for the correct output distribution.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Possible Improvements&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Running as I described, the output density matrix $\rho$ (on $RC$) must be diagonal. That means that the uniform superposition $|u\rangle$ over all basis states is an eigenstate if and only if the system is maximally mixed. I would if one could combine this observation with some sort of amplitude amplification to get a mild speed-up. Note that $\rho^k|u\rangle$ builds up a difference very rapidly from $|u\rangle$ if the state is not an eigenvector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Aside from that, you probably need to do something smarter with the ancilla registers. There is some hope that this might be possible because there's quite a lot of group structure built in to the Rubik's cube. One thing that you might try is to see whether you can replace all $t$ ancilla registers with a single register, apply Hadmard gates on every qubit of the register in between each round of controlled-unitaries. It might be that all this does is give you an efficiency saving in terms of the number of qubits compared to my original suggestion. It might not even do that.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Whether either of those work directly, I don't know. Still, I think the key principles are to find some useful group structure, and find a way that amplitude amplification can be applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might find it useful to read up about &lt;a href=&quot;https://arxiv.org/abs/1208.0692&quot; rel=&quot;noreferrer&quot;&gt;unitary designs&lt;/a&gt;. This is certainly a distinct problem from what we're talking about here, but some of the technical tools might be useful. Roughly speaking, the idea is that a set of unitaries $\{U\}$ is a $t$-design if random application of these unitaries lets one simulate a truly random unitary (drawn from the Haar measure) on output functions $f$ which, when expanded using a Taylor series, are accurate up to degree $t$. The approximate connection here is that if you take the unitaries representing a sequence of $t$ Singmaster moves as $\{U\}$, it would be sufficient if this set were a 2-design (if you get $\text{Tr}(\rho^2)$ correct, you're done).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-06T08:17:32.567" LastActivityDate="2018-08-06T08:17:32.567" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="3951" PostTypeId="2" ParentId="3943" CreationDate="2018-08-06T15:14:13.653" Score="8" Body="&lt;p&gt;You also have this one with V the square root of NOT gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fKlkb.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fKlkb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have as control qubits :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(0,0) : do nothing;&#xA;(0,1) : apply V and its conjugate which is identity;&#xA;(1,0) : same but inversed;&#xA;(1,1) : apply V twice which correspond to your NOT gate.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-08-06T15:14:13.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3952" PostTypeId="2" ParentId="3947" CreationDate="2018-08-06T17:09:16.600" Score="3" Body="&lt;p&gt;I think the major advantages of the Hadamard gate are &quot;usability&quot; stuff, as opposed to fundamental mathematical stuff. It's just easier to remember and simpler to apply.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Hadamard gate's marix is real and symmetric. Makes it easy to remember.&lt;/li&gt;&#xA;&lt;li&gt;Hadamard is its own inverse. Makes it easy to optimize in circuits. Any two Hs that meet cancel out; whereas $\sqrt{X}$ tends to meet $\sqrt{X}$ as often as $\sqrt{X}^{-1}$ leaving behind $X$ operations.&lt;/li&gt;&#xA;&lt;li&gt;Hadamard's effect on operators is easy to remember: swap X for Z. Whereas for $\sqrt{X}$ style operations you need to remember a right hand rule. If you pass a hadamard over a CZ, it turns into a CNOT. If you pass a $\sqrt{Y}$ over a CZ, whether you get a CNOT or a CNOT+Z depends on whether you went left-to-right or right-to-left.&lt;/li&gt;&#xA;&lt;li&gt;In the surface code you need twist defects or distilled states to do $\sqrt{X}$ gates. Hadamard operations need neither (though the twists are more efficient...).&lt;/li&gt;&#xA;&lt;li&gt;The Hadamard is unique. There are two values $M$ such that $M^2 = X$, and so you need an agreed upon convention for which one $\sqrt{X}$ is.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;PS: it would be better to compare a Hadamard to a 90 degree rotation about the &lt;em&gt;Y&lt;/em&gt; axis, not the X axis, because the Hadamard operation is equivalent $\sqrt{Y}$ up to Pauli operations ($H \propto Z \cdot \sqrt{Y}$).&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-08-06T19:26:37.547" LastActivityDate="2018-08-06T19:26:37.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3953" PostTypeId="1" AcceptedAnswerId="3958" CreationDate="2018-08-06T19:13:32.477" Score="2" ViewCount="147" Body="&lt;p&gt;What Hilbert space of dimension greater than 4.3e19 would be most convenient for working with the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3932/can-a-quantum-computer-easily-determine-the-mixing-time-of-the-rubiks-cube-grou&quot;&gt;Rubik's Cube&lt;/a&gt; verse one qudit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cardinality of the &lt;a href=&quot;https://wikipedia.org/wiki/Rubik%27s_Cube_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rubik's Cube group&lt;/a&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://wikimedia.org/api/rest_v1/media/math/render/svg/cae85de130092535db33b0b2ae7b7ff8cc8f24a3&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Examples&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;66 Qubits yields ~7.378697629484e19 states (almost more than double the number of states needed)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;42 Qutrits yields ~1.094189891315e20 states (more than double the needed states)&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-18T23:14:56.543" LastActivityDate="2018-12-18T23:14:56.543" Title="Hilbert space to accurately represent 3x3 Rubik's Cube" Tags="&lt;complexity-theory&gt;&lt;mathematics&gt;&lt;qudit&gt;&lt;many-body-systems&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3954" PostTypeId="1" CreationDate="2018-08-06T21:00:43.807" Score="7" ViewCount="131" Body="&lt;p&gt;Are there any books, courses, tutorials, etc. for studying quantum biology?&#xA;Preferably they provide some introduction/primer on the relevant quantum aspects of the quantum biological systems being described.&lt;/p&gt;&#xA;" OwnerUserId="141" LastEditorUserId="141" LastEditDate="2018-08-07T02:50:13.890" LastActivityDate="2018-09-03T18:12:27.807" Title="Resources for quantum biology" Tags="&lt;resource-request&gt;&lt;biology&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3955" PostTypeId="1" CreationDate="2018-08-07T01:59:38.123" Score="8" ViewCount="606" Body="&lt;p&gt;What's the simplest algorithm (like &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Deutsch's algorithm&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/175/how-is-the-oracle-in-grovers-search-algorithm-implemented&quot;&gt;Grover's Algorithm&lt;/a&gt;) for intuitively demonstrating quantum speed-up? And can this algorithm be explained intuitively? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ideally this would be also illustrate clear how quantum interference is being utilized, and why it is not possible or useful using just &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2595/if-quantum-speed-up-is-due-to-the-wave-like-nature-of-quantum-mechanics-why-not&quot;&gt;interference of classical waves&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="26" LastEditDate="2018-12-13T20:01:01.267" LastActivityDate="2020-05-04T19:48:15.480" Title="Simplest algorithm for intuitively demonstrating quantum speed-up?" Tags="&lt;algorithm&gt;&lt;quantum-information&gt;&lt;classical-computing&gt;&lt;models&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3956" PostTypeId="2" ParentId="3955" CreationDate="2018-08-07T03:02:51.983" Score="2" Body="&lt;p&gt;There is nice example in the &lt;a href=&quot;https://www.youtube.com/watch?time_continue=1&amp;amp;v=F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft lecture&lt;/a&gt;. Suppose you have a classical black box with 1 input and 1 output. How many queries you need to determine whether the output is constant or variable? Evidently you need 2 queries; first you input 0, second you input 1; if both outputs are identical you have constant, otherwise variable. It turns out that after you convert the classical black box into a quantum black box you can build a circuit that needs only a single query (the lecture explains how to do it).&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2018-08-07T03:02:51.983" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3957" PostTypeId="1" AcceptedAnswerId="3964" CreationDate="2018-08-07T05:35:22.910" Score="7" ViewCount="451" Body="&lt;p&gt;I want to decompose a Toffoli gate into CNOTs and arbitrary single-qubit gates. I want to minimize the number of CNOTs. I have a locality constraint: because the Toffoli is occurring in a linear array, the two controls are not adjacent to each other (so no CNOTs directly between the controls).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the minimum number of CNOTs required to perform this task? What is an example of a circuit which achieves this minimum?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be specific, this is the layout I have in mind:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 ---@---&#xA;     |&#xA;2 ---X---&#xA;     |&#xA;3 ---@---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each control is adjacent to the target, but the controls are not adjacent to each other.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2018-12-23T07:40:14.503" LastActivityDate="2020-02-14T01:47:36.633" Title="Minimum number of CNOTs for Toffoli with non-adjacent controls" Tags="&lt;circuit-construction&gt;&lt;gate-synthesis&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3958" PostTypeId="2" ParentId="3953" CreationDate="2018-08-07T06:36:29.573" Score="4" Body="&lt;p&gt;This question does not need to be phrased as a quantum question. One can equally ask what classical register can be used to store a string that uniquely identifies each different configuration of the Rubik’s Cube. This is already implicitly answered in the question: you need 27 bits, 14 trits....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is labouring under the assumption that you can easily pick and choose your information carrier, and combine together arbitrary sets with different dimensions, and easily talk about the logic operations on them and how they all interact. This is clearly not how it works in classical: your computer only processes bits (and if you want different dimensional systems, the software can handle the conversion: see, for example, the MixedRadix function in Mathematica), and the same will be true of quantum. A particular experiment will focus on one type of information carrier, and will be able to manipulate a certain number of levels. You might be able to repeat that many times, but you won’t be combining qubits, qutrits etc. So you’ll probably be using qubits, and you just need to find the smallest Hilbert space that’s larger than the required dimension. Again, as indicated by the question, that’s 66 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps the concern is that 66 seems like a lot of qubits and we need to make that number as small as possible. Remember that computations will require error correction, which means increasing the number of qubits by several orders of magnitude. One extra qubit doesn’t matter so much on the scale of things.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-07T06:36:29.573" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="3959" PostTypeId="1" AcceptedAnswerId="4000" CreationDate="2018-08-07T06:46:53.363" Score="11" ViewCount="605" Body="&lt;p&gt;&lt;a href=&quot;https://www.cube20.org/&quot; rel=&quot;noreferrer&quot;&gt;God's number&lt;/a&gt; is the worst case of &lt;a href=&quot;https://wikipedia.org/wiki/God%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;God's algorithm&lt;/a&gt; which is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a notion originating in discussions of ways to solve the Rubik's Cube puzzle, but which can also be applied to other combinatorial puzzles and mathematical games. It refers to any algorithm which produces a solution having the fewest possible moves, the idea being that an omniscient being would know an optimal step from any given configuration.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Calculating God's number to be 20 took &quot;35 CPU-years of idle (classical) computer time.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of speed up could be achieved with a quantum approach? &lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-18T20:16:04.217" LastActivityDate="2018-12-18T20:16:04.217" Title="Quantum Algorithm for God's Number" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;complexity-theory&gt;&lt;mathematics&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3960" PostTypeId="1" CreationDate="2018-08-07T07:03:38.357" Score="6" ViewCount="282" Body="&lt;p&gt;I see somewhere that this happens:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w8X0P.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w8X0P.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I wonder if this is just identity. &lt;/p&gt;&#xA;" OwnerUserId="806" LastEditorUserId="26" LastEditDate="2018-08-12T06:13:33.223" LastActivityDate="2018-08-12T07:10:09.783" Title="Just want to confirm: Do two CNOT gates cancel each other?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3961" PostTypeId="2" ParentId="3960" CreationDate="2018-08-07T07:08:37.837" Score="5" Body="&lt;p&gt;Yes, it is. If the bottom qubit is 0, neither gate does anything to the top qubit. If the bottom qubit is 1, both gates apply $X$. But since $X^2=\mathbb{I}$, the net effect is that nothing happens. Hence, overall, nothing happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to see this is to look at the unitary matrix of controlled-not.&#xA;$$&#xA;\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}\right)&#xA;$$ It’s reasonably easy to see that the eigenvalues are 1,1,1,-1 (evidently, $|00\rangle$ and $|01\rangle$ are +1 eigenvectors, leaving behind a $2\times 2$ matrix like Pauli $X$, which we know has $\pm 1$ eigenvalues), so the square obviously has eigenvalues 1,1,1,1 and the only 4x4 unitary matrix with all ones eigenvalues is the identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equally, direct calculation:&#xA;$$&#xA;\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}\right)\cdot \left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}\right)=\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-07T07:34:19.090" LastActivityDate="2018-08-07T07:34:19.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3963" PostTypeId="2" ParentId="3957" CreationDate="2018-08-07T10:04:00.900" Score="3" Body="&lt;p&gt;I believe I've got it down to 9 controlled-not gates:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/J4wb7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J4wb7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I did was I used a set of three cNots in the place of Swap to move the two controls next to each other to achieve the last part of the standard Toffoli circuit (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/3943/1837&quot;&gt;here&lt;/a&gt;). This used 12 cNots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the final $T$ and $H$ gates on the target qubit I propagated through one of these swaps. This let me cancel two controlled-Nots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in the final SWAP, I chose the first of the controlled-nots to be controlled from the middle qubit. I replaced it with a controlled-phase and two Hadamards. The leading Hadamard cancelled. The controlled-phase gate commutes with the preceding controlled gates controlled off the middle qubit, and phase gates on the middle qubit and bottom qubits. These operations bring that controlled phase up to a controlled-not from the first inserted swap. Hence, we can combine these two gates as a controlled-$iY$, controlled off the bottom qubit. But this can be written as a single cNot with some $S$ gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've made no attempt at an optimality proof, but I'm already pretty pleased to have got it this small.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-07T10:04:00.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3964" PostTypeId="2" ParentId="3957" CreationDate="2018-08-07T10:49:12.143" Score="3" Body="&lt;p&gt;Here is the best construction I've found. It uses 8 CNOTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tkwsh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tkwsh.png&quot; alt=&quot;8-cnot construction&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I verified this circuit &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT3%22%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22%2B%3DA3%22%5D%2C%5B%22%E2%80%A6%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22Z%5E-%C2%BC%22%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22%E2%80%A6%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22-%3DA3%22%5D%2C%5B%22QFT%E2%80%A03%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;in Quirk using the channel-state duality and a known-good inverse&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The target is the middle qubit. None of the CNOTs go directly from top to bottom or bottom to top. You can switch which qubit is the the target by simply switching which line the Hadamards are on.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-08-07T22:37:12.013" LastActivityDate="2018-08-07T22:37:12.013" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="3965" PostTypeId="1" CreationDate="2018-08-07T12:44:33.587" Score="9" ViewCount="2095" Body="&lt;p&gt;I found an algorithm that can compute the distance of two quantum states. It is based on a subroutine known as swap test (a fidelity estimator or inner product of two state, btw I don't understand what fidelity mean).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about inner product. How can I calculate the inner product of two quantum registers which contains different number of qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description of the algorithm is found in &lt;a href=&quot;https://arxiv.org/abs/1804.10068&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. Based on the 3rd step that appear on the image, I want to prove it by giving an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let:&#xA;$|a| = 5$, $|b| = 5 $, and $ Z = 50 $&#xA;$$|a\rangle = \frac{3}{5}|0\rangle + \frac{4}{5}|1\rangle$$  $$|b\rangle = \frac{4}{5}|0\rangle + \frac{3}{5}|1\rangle&#xA;$$&#xA;All we want is the fidelity of the following two states $|\psi\rangle$ and $|\phi\rangle$ and to calculate the distance between $|a\rangle$ and $|b\rangle$is given as:&#xA;$ {|a-b|}^2 = 2Z|\langle\phi|\psi\rangle|^2$&#xA;so &#xA;$$|\psi\rangle = \frac{3}{5\sqrt{2}}|00\rangle + \frac{4}{5\sqrt{2}}|01\rangle+ + \frac{4}{5\sqrt{2}}|10\rangle +  + \frac{3}{5\sqrt{2}}|11\rangle$$&#xA;$$|\phi\rangle = \frac{5}{\sqrt{50}} (|0\rangle + |1\rangle) $$&#xA;then how to compute &#xA;$$\langle\phi|\psi\rangle = ??$$&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="55" LastEditDate="2019-05-15T08:35:45.550" LastActivityDate="2019-05-15T09:52:44.073" Title="How can I calculate the inner product of two quantum registers of different sizes?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;mathematics&gt;&lt;fidelity&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3966" PostTypeId="2" ParentId="3898" CreationDate="2018-08-07T14:01:12.820" Score="4" Body="&lt;p&gt;For a review of the subject, see this paper: &quot;Non-locality and Communication Complexity&quot; &#xA;&lt;a href=&quot;https://arxiv.org/abs/0907.3584&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0907.3584&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4294" LastEditorUserId="4294" LastEditDate="2018-08-07T14:55:01.860" LastActivityDate="2018-08-07T14:55:01.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3967" PostTypeId="1" AcceptedAnswerId="3970" CreationDate="2018-08-07T14:09:08.053" Score="3" ViewCount="74" Body="&lt;p&gt;Has any work been done on quantum systems which use a combination of types of qunits (eg. using qubits &amp;amp; qutrits simultaneously)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If work has been done, what kind of work has been done? (eg. in quantum information in general? in quantum computing? in physical implementations?)&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-08-07T15:15:03.323" LastActivityDate="2018-08-07T15:38:49.117" Title="Combining Different Qunits" Tags="&lt;resource-request&gt;&lt;qudit&gt;&lt;many-body-systems&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3968" PostTypeId="2" ParentId="3967" CreationDate="2018-08-07T14:38:09.767" Score="3" Body="&lt;p&gt;Yes. Just to give one example, &lt;a href=&quot;https://www.quantiki.org/wiki/ppt-separability-criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;the PPT criterion&lt;/a&gt; is necessary and sufficient to decide whether a state is separable for qubit-qubit and qubit-qutrit systems, but not beyond.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-08-07T14:38:09.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3969" PostTypeId="2" ParentId="3965" CreationDate="2018-08-07T14:54:43.367" Score="7" Body="&lt;p&gt;I guess you're looking at equations (130) and (131)? So, here, you have $|\psi\rangle=(|0\rangle|a\rangle+|1\rangle|b\rangle)/\sqrt{2}$ and $|\phi\rangle=|a| |0\rangle+|b| |1\rangle$. When it says to calculate $\langle\phi|\psi\rangle$, what it really means is&#xA;$$&#xA;(\langle\phi|\otimes\mathbb{I})|\psi\rangle,&#xA;$$&#xA;padding everything with identity matrices to make them all the same size.&#xA;Thus, the calculation becomes&#xA;$$&#xA;\frac{1}{\sqrt{2Z}}\left(\begin{array}{cccc} |a| &amp;amp; 0 &amp;amp; |b| &amp;amp; 0 \\ 0 &amp;amp; |a| &amp;amp; 0 &amp;amp; |b| \end{array}\right)\cdot\left(\begin{array}{c}  a_0 \\ a_1 \\ b_0 \\ b_1 \end{array}\right),&#xA;$$&#xA;where $a_0$ and $a_1$ are the elements of your vector $|a\rangle$. If you work this through, you'll get&#xA;$$&#xA;\frac{1}{\sqrt{2Z}}(|a| |a\rangle+|b| |b\rangle).&#xA;$$&#xA;I have no idea where the negative sign has come from in equation (133).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-13T06:27:46.470" LastActivityDate="2018-08-13T06:27:46.470" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3970" PostTypeId="2" ParentId="3967" CreationDate="2018-08-07T15:00:44.653" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_walk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum walks&lt;/a&gt; are a simple case of quantum dynamics that involves a qubit (named &lt;em&gt;coin&lt;/em&gt; in this context) interacting with a high-dimensional qudit (named &lt;em&gt;walker&lt;/em&gt; in this context).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Almost anything in quantum optics can be thought of as &quot;&lt;em&gt;combining different qunits&lt;/em&gt;&quot; as well: a photon in a superposition of many spatial modes (high-dimensional qudit), together with its polarization degree of freedom (qubit) fits the bill.&#xA;You can replace &quot;spatial modes&quot; with something like &quot;orbital angular momentum modes&quot; or &quot;frequency modes&quot; or &quot;time modes&quot; and you have the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many quantum algorithms also inherently deal with this scenario: Grover's algorithm and the phase estimation algorithm come to mind (of course, the high-dimensional qudit in those algorithms can be replaced by a number of qubits, but that depends on the context).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Countless other examples could be found, but it would not be very meaningful without specifying the context a bit more.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-08-07T15:38:49.117" LastActivityDate="2018-08-07T15:38:49.117" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3971" PostTypeId="1" AcceptedAnswerId="3979" CreationDate="2018-08-07T20:39:31.180" Score="15" ViewCount="1554" Body="&lt;p&gt;Sligthly related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1367/programming-quantum-computers-for-non-physics-majors&quot;&gt;this question&lt;/a&gt;, but not the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traditional computer science requires no physics knowledge for a computer scientist to be able to research and make progress in the field. Of course, you do need to know about the underlying physical layer when your research is related to that, but in many cases you can ignore it (e.g. when designing an algorithm). Even when architectural details are important (e.g. cache layout), oftentimes it is not necessary to know all the details about them, or how they're implemented at the physical level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has quantum computing reached this level of &quot;maturity&quot;? Can you design a quantum algorithm, or do actual research in the field, as a computer scientist that doesn't know anything about quantum physics? In other words, can you &quot;learn&quot; quantum computing ignoring the physical side, and is it worth it (in terms of scientific career)?&lt;/p&gt;&#xA;" OwnerUserId="4296" LastEditorUserId="26" LastEditDate="2018-12-13T20:02:03.453" LastActivityDate="2020-11-20T11:27:49.470" Title="Is quantum computing mature enough for a computer scientist with no physics background?" Tags="&lt;resource-request&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3972" PostTypeId="2" ParentId="3971" CreationDate="2018-08-07T20:52:49.967" Score="4" Body="&lt;p&gt;It has pretty much always been like that.  You can study the book by Nielsen &amp;amp; Chuang without knowing about physics. There is the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0207118&quot; rel=&quot;nofollow noreferrer&quot;&gt;introduction by Mermin&lt;/a&gt; aimed at computer scientists. There are probably lots of other resources (I'm pretty sure e.g. that Aaronson's book -- based on a &lt;a href=&quot;https://www.scottaaronson.com/democritus/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CS lecture&lt;/a&gt; -- is perfectly suited for people without a physics background.) Overall, the physics formalism needed to understand quantum information and computation is pretty low-key, as compared to other fields of (quantum) physics. (This doesn't mean though that studying the phenomena in quantum information and computation is low-key.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-08-07T20:57:59.113" LastActivityDate="2018-08-07T20:57:59.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3973" PostTypeId="2" ParentId="3971" CreationDate="2018-08-07T22:18:20.997" Score="4" Body="&lt;p&gt;As I can relate in my experience, I will say yes. One can indeed design algorithms without physics knowledge. For me it is so far Maths concepts. &#xA;I remember once I watched a course about quantum computing from Scott Aaronson and he quoted : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum computing is really &quot;easy&quot; when you take the physics out of it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, if you are going to work on applications in physics or chemistry, it will always be useful to have a background of what you are going to work on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The field is open to many backgrounds (Maths, Physics, Computer Science...).&#xA;I think it is just a challenge sometimes communicating between different backgrounds but it is not impossible. Indeed, I would say it is constructive and it can be beneficial to collaborate together. But one can always relate to his preferred interpretation/concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a career, it is again according to your point of view. I think there is much work to be done in this field so do not worry about it. Do it if you feel you like it. Plus working in this field does not mean you have to restrain yourself. You will still have to work with classical algorithms and you will need coding skills.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in learning it from a computer scientist point of view,&#xA;there is this book that may be helpful:&#xA;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/0521879965&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.amazon.com/Quantum-Computing-Computer-Scientists-Yanofsky/dp/0521879965&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck on your quantum trip !&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-08-07T22:18:20.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3974" PostTypeId="1" AcceptedAnswerId="3975" CreationDate="2018-08-07T22:28:33.967" Score="10" ViewCount="194" Body="&lt;p&gt;Recently I've been wondering how high NISQ machines will be able to &quot;count&quot;. What I mean by that is, given the most optimized increment circuit you can make, how many times can you physically apply that circuit to qubits in a secret initial state before there's a more than 50% chance that the output is the wrong value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To that end, I need a good increment circuit that would actually run on a NISQ machine! E.g. this means respecting locality constrains, and costing the circuit based on how many 2-qubit operations are performed (since those are the noisiest). For simplicity, I will say that the gate set is &quot;any single qubit operation + local CNOTs on a grid&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems clear to me that a NISQ machine should be able to apply a 3-qubit incrementer at least 8 times (so it wraps back to 0 and loses count), but I think wrapping a 4-qubit counter is much more challenging. Thus this question's focus on that size specifically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 4-qubit incrementer is a circuit which effects the state permutation $|k\rangle \rightarrow |k + 1\pmod{16}\rangle$. The value $k$ must be stored as a 2s complement binary integer in four qubits. If the value is under superposition, it must still be coherent after applying the incrementer (i.e. no entangling with other qubits except as temporary workspace). You may place the qubits wherever you want on the grid.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-08-09T01:58:43.330" LastActivityDate="2018-08-09T01:58:43.330" Title="Minimum number of CNOTs for a 4-qubit increment on a planar grid" Tags="&lt;optimization&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="3975" PostTypeId="2" ParentId="3974" CreationDate="2018-08-07T22:28:33.967" Score="5" Body="&lt;p&gt;Here is the best circuit I've found. It uses 14 CNOTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this circuit is not using a linear layout! It is placed on the grid like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0-A-1&#xA;  |&#xA;  3&#xA;  |&#xA;  2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where 'A' is an ancilla initialized in the |0&gt; state and '0','1','2','3' are the qubits making up the register (with '0' being the least significant bit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TwZjJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TwZjJ.png&quot; alt=&quot;14 CNOT 4-qubit increment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I verified this circuit &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT4%22%5D%2C%5B%22inputA4%22%2C1%2C1%2C1%2C%22%2B%3DA4%22%5D%2C%5B1%2C1%2C%22%3C%3C7%22%5D%2C%5B1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22H%22%2C%22H%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Z%5E-%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22H%22%2C%22H%22%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22%3E%3E7%22%5D%2C%5B1%2C1%2C%22Swap%22%2C%22Swap%22%5D%2C%5B%22dec4%22%5D%2C%5B1%2C1%2C%22Swap%22%2C%22Swap%22%5D%2C%5B%22inputA4%22%2C1%2C1%2C1%2C%22-%3DA4%22%5D%2C%5B%22QFT%E2%80%A04%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;in Quirk using the channel-state duality and a known-good inverse&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one had access to the sqrt-of-CNOT operation, the number of 2-qubit operations could be brought down to 13 by merging two CNOTs and three Ts in the bottom area into a controlled-S.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If CNOTs had an error rate of 0.5%, and all other sources of error were negligible, you could apply this circuit nearly ten times before reaching a 50% failure rate. Implying a plausible NISQ machine could &quot;almost count to ten&quot;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-08-07T22:48:25.963" LastActivityDate="2018-08-07T22:48:25.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3977" PostTypeId="5" CreationDate="2018-08-08T01:14:29.983" Score="0" Body="&lt;p&gt;&lt;strong&gt;N&lt;/strong&gt;oisy &lt;strong&gt;I&lt;/strong&gt;ntermediate &lt;strong&gt;S&lt;/strong&gt;cale &lt;strong&gt;Q&lt;/strong&gt;uantum (NISQ) computers have enough qubits to see non-classically-simulable behavior, but not enough for error correction. NISQ algorithms often revolve around sampling very short circuits many times and using classical feedback to choose which circuit to sample next. The cost bottlenecks for NISQ computation are things that introduce noise into the results (e.g. circuit depth and two-qubit gates). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See John Preskill's 2018 paper &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Quantum Computing in the NISQ era and beyond&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-08-08T07:22:07.553" LastActivityDate="2018-08-08T07:22:07.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3978" PostTypeId="4" CreationDate="2018-08-08T01:14:29.983" Score="0" Body="For questions related to Noisy Intermediate Scale Quantum (NISQ) computing. NISQ computers cannot be classically simulated in a reasonable time but are not advanced enough to also be error corrected." OwnerUserId="119" LastEditorUserId="23" LastEditDate="2018-08-08T20:24:56.083" LastActivityDate="2018-08-08T20:24:56.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3979" PostTypeId="2" ParentId="3971" CreationDate="2018-08-08T01:26:56.760" Score="22" Body="&lt;p&gt;Speaking as a computer scientist without any physics background making contributions to quantum computing: yes, computer scientists without any physics background can make contributions to quantum computing. Though I think it was always that way; it has nothing to do with the field being &amp;quot;mature&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;If you understand the postulates of quantum mechanics (operations are unitary matrices, states are unit vectors, measurement is a projection), and know how to apply those in the context of a computation, you can create quantum algorithms. The fact that these concepts were originally derived from physics is historically interesting, but not really relevant when optimizing a quantum circuit. As a concrete example: quantum physics is very heavy on calculus, but quantum computation isn't.&lt;/p&gt;&#xA;&lt;p&gt;Quantum physics does become relevant if you are trying to design algorithms for simulating quantum systems. And some of the concepts you would learn in a quantum physics course should also appear in a quantum computation course. But overall &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;noreferrer&quot;&gt;I agree with Scott Aaronson&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[My] way to teach quantum mechanics [...] starts directly from the conceptual core -- namely, a certain generalization of probability theory to allow minus signs. Once you know what the theory is actually about, you can then sprinkle in physics to taste [...]&lt;/p&gt;&#xA;&lt;p&gt;[quantum mechanics is] not a physical theory in the same sense as electromagnetism or general relativity. [...] Basically, quantum mechanics is the operating system that other physical theories run on as application software [...]&lt;/p&gt;&#xA;&lt;p&gt;[...] [quantum mechanics is] about information and probabilities and observables, and how they relate to each other.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="119" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-08-08T01:26:56.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3980" PostTypeId="1" CreationDate="2018-08-08T01:55:53.730" Score="9" ViewCount="720" Body="&lt;p&gt;I was looking into applications of Quantum Computing for machine learning and encountered the following pre-print from 2003. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0309070&quot; rel=&quot;noreferrer&quot;&gt;Quantum Convolution and Correlation Algorithms are Physically Impossible&lt;/a&gt;.  The article doesn't appear to have been published in any journals, but it has been cited a few dozen times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article author makes the case that it is impossible to compute discrete convolution over quantum states.  Intuitively this seems incorrect to me, since I know we can perform quantum matrix multiplication, and I know that discrete convolution can be framed simply as multiplication with a Toeplitz (or circulant) matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The crux of his argument seems to be that there is no realizable composition of unitary operators for the elementwise (Hadamard) product of two vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is my disconnect?  Is there any reason we cannot in general construct a Toeplitz matrix for discrete convolution in a quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is the article simply incorrect?  I have worked through the contradiction that the author presents in his proof of Lemma 14, and it seems to make sense to me.&lt;/p&gt;&#xA;" OwnerUserId="4298" LastActivityDate="2018-08-15T00:45:41.517" Title="Quantum Algorithms for Convolution" Tags="&lt;algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3981" PostTypeId="2" ParentId="3980" CreationDate="2018-08-08T07:09:48.563" Score="3" Body="&lt;p&gt;I am highly suspicious of the result. If you look at Theorem 16, it claims that there is no operation that achieves the map&#xA;$$&#xA;\sum_{ij}\alpha_i\beta_j|ij\rangle\mapsto \sum_i\alpha_i\beta_i|i\rangle&#xA;$$&#xA;up to normalisation. However, consider the measurement operator&#xA;$$&#xA;P=\sum_{i}|i\rangle\langle ii|.&#xA;$$&#xA;This clearly implements the desired map (for that particular measurement outcome). Moreover, its implementation is quite straightforward. There is a unitary (effectively, a generalised controlled-not) that can map&#xA;$$&#xA;|ii\rangle\mapsto|i0\rangle,&#xA;$$&#xA;so that you then measure the second spin and post-select on getting the 0 result. This would seem to invalidate the proof of the paper.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-08T07:09:48.563" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="3982" PostTypeId="1" AcceptedAnswerId="3983" CreationDate="2018-08-08T08:06:14.847" Score="7" ViewCount="1392" Body="&lt;p&gt;In a &lt;a href=&quot;https://qiskit.slack.com/archives/C7SJ0PJ5A/p1526979601000340&quot; rel=&quot;noreferrer&quot;&gt;discussion with Jay Gambetta&lt;/a&gt; on the QISKit Slack channel, Jay told me that &quot;T2 is the time that $\vert 0 \rangle + \vert 1 \rangle$ goes to $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: what is the difference between those two states?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-08-09T01:24:58.500" Title="What is the difference between $\vert 0 \rangle + \vert 1 \rangle$ and $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$?" Tags="&lt;quantum-state&gt;&lt;decoherence&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3983" PostTypeId="2" ParentId="3982" CreationDate="2018-08-08T08:18:03.707" Score="8" Body="&lt;p&gt;In short: &quot;coherence&quot;! It's the crucial difference between quantum and classical. $\rho=|0\rangle\langle 0|+|1\rangle\langle 1|$ is just a statistical mixture, and behaves like a classical coin - any measurement that you perform on it gives a 50:50 split between the two possible outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By contrast, $|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$ is a very different beast. When you look at them both as density matrices, you can see the difference:&#xA;$$&#xA;\rho=\frac{1}{2}\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right)\qquad |+\rangle\langle +|=\frac{1}{2}\left(\begin{array}{cc} 1 &amp;amp; 1 \\ 1 &amp;amp; 1 \end{array}\right)&#xA;$$&#xA;Sure, if you measure $|+\rangle$ in the Z-basis, you get 50:50 outcomes, just like you did with $\rho$, but measurement in other bases gives different outcomes. Most importantly, if you measure in the $X$ basis, you get a definite measurement result, a 100:0 split.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way, if I perform a Hadamard gate on the two states:&#xA;$$&#xA;H\rho H=\rho\qquad H|+\rangle\langle +|H=|0\rangle\langle 0|.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the crucial ways that we use the $|+\rangle$ state is in the first step of quantum algorithms: you prepare one register in $|+\rangle^{\otimes n}$. If, instead, you prepared it in $\rho^{\otimes n}$, this would be equivalent to classical sampling of the function evaluation in the next step. There would be no phase kick-back, and no quantum speed-up.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Exercise for the Reader:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Imagine a qubit starts in the state $\rho_0=|+\rangle\langle +|$ and experiences the noise map&#xA;$$&#xA;\rho_{n+1}=\mathcal{E}(\rho_n)=(1-p)\rho_n+p Z\rho_n Z&#xA;$$&#xA;where $0&amp;lt;p&amp;lt;1$ quantifies the probability of a phase error in a particular time step. Calculate $\rho_n$. Show that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\rho_n-\rho_{n+1}\neq 0$&lt;/li&gt;&#xA;&lt;li&gt;the fixed point of the map is $(|0\rangle\langle 0|+|1\rangle\langle 1|)/2$&lt;/li&gt;&#xA;&lt;li&gt;as $n\rightarrow\infty$, $\rho_n$ tends to this fixed point.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-08T08:44:13.277" LastActivityDate="2018-08-08T08:44:13.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3984" PostTypeId="2" ParentId="3982" CreationDate="2018-08-08T09:10:18.220" Score="5" Body="&lt;p&gt;There are multiple ways to mathematically express the state of a quantum system. One is to write it as a linear combination of basis states, as either a vector or a matrix, as you have here. This is useful in many cases, but it also seems to be confusing to newcomers, since things like $\vert 0 \rangle + \vert 1 \rangle$, $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$ and other states all just look like a $50/50$ mix of $\vert 0 \rangle$ and $\vert 1 \rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's look at another way of representing states: using expectation values for a set of observables. For a single qubit we can use the Pauli matrices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rho = \frac{1}{2} \left( \mathbb{1} + \sum_{\alpha \in \{x,y,z\}} \, \langle \sigma_\alpha \rangle \,\,\sigma_\alpha \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here $\langle \sigma_z \rangle$ is a quantity that takes the value $+1$ if a $|0\rangle$/$|1\rangle$ measurement is certain to give the outcome $|0\rangle$, and takes the value $-1$ if the measurement would certainly give the outcome $|1\rangle$. Otherwise we'll find $1 &amp;gt; \langle \sigma_z \rangle &amp;gt; -1$, with the value depending on the probabilities. For example, the value is $\langle \sigma_z \rangle = 0$ for a $50/50$ mix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantity $\langle \sigma_x \rangle$ is the same but for a $|+\rangle$/$|-\rangle$ measurement (this is equivalent to doing a Hadamard immediately before a $|0\rangle$/$|1\rangle$ measurement). Similarly for $\langle \sigma_y \rangle$, but no-one ever cares much about poor $\sigma_y$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this method, the state $\vert 0 \rangle + \vert 1 \rangle$ (once normalized) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \rho = \frac{1}{2} \left( \mathbb{1} + \sigma_x \right) $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has $\langle \sigma_z \rangle = \langle \sigma_y \rangle =0$. So for these two types of measurement, we'd get the outcomes with $50/50$ probabilities. But $\langle \sigma_x \rangle =1$, showing that the outcome for this type of measurement is certain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$ (once normalized) we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \rho = \frac{1}{2} \mathbb{1} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\langle \sigma_\alpha \rangle = 0$ for $x$, $y$ and $z$. All three of these measurements give random results. In fact, so will any kind of measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way of representing states is explored in IBM's &lt;a href=&quot;http://helloquantum.mybluemix.net/&quot; rel=&quot;noreferrer&quot;&gt;Hello Quantum&lt;/a&gt; project, which might be of some additional help (note: I also helped make this).&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-08-08T09:10:18.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3985" PostTypeId="1" AcceptedAnswerId="4001" CreationDate="2018-08-08T11:06:24.460" Score="12" ViewCount="873" Body="&lt;p&gt;A metric called the &quot;quantum volume&quot; has been proposed to somehow compare the utility of different quantum computing hardware. Roughly speaking, it measures their worth by the square of the maximum depth of quantum computations it permits but limits its value to the square of the qubits involved. This limit is justified by wanting to forestall &quot;gaming&quot; of the system by optimizing towards few qubits. One reference is &lt;a href=&quot;https://arxiv.org/abs/1710.01022&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1710.01022&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am concerned that this measure, as good as it may be for noisy near-term quantum computing devices, hides the actual quality advances for more advanced quantum computers (those with high quantum gate fidelity). The question is: Is this concern justified?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The argument behind my concern is the assumption that potential killer applications for quantum computers, for example quantum chemical calculations, will require computations with a gate depth much larger than the (potentially modest) number of qubits required. In this case, the &quot;quantum volume&quot; would be limited to the square of the number of qubits, regardless of whether one quantum computer (with particularly high fidelity) permits an essentially unlimited depth or whether it only allows the bare minimum gate depth to achieve the limitation of the &quot;quantum volume&quot; to the square of the number of qubits. One aspect of my question is: Is this argument correct?&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="491" LastEditDate="2018-08-08T17:19:34.943" LastActivityDate="2018-08-11T06:52:07.897" Title="Is the &quot;Quantum Volume&quot; a fair metric for future, elaborate, high value quantum computations?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;quantum-volume&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3986" PostTypeId="1" CreationDate="2018-08-08T14:10:53.663" Score="5" ViewCount="107" Body="&lt;p&gt;I have been reading about a family of quantum error correction codes called Quantum Turbo Codes, which are the quantum analog of the well-known classical Turbo codes. This codes were introduced in &lt;a href=&quot;https://arxiv.org/pdf/0712.2888.pdf&quot; rel=&quot;noreferrer&quot;&gt;quantum serial turbo codes&lt;/a&gt; and the entanglement-assisted version of those was presented in &lt;a href=&quot;https://arxiv.org/pdf/1010.1256.pdf&quot; rel=&quot;noreferrer&quot;&gt;entanglement-assisted quantum turbo codes&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such papers, the decoding algorithm presented for  is a modification of the classical belief propagation algorithms that are used for obtaining the most probable codeword received based on the channel information and the syndromes read from the information received. The difference in the quantum paradigm is that the belief propagation algorithm here is used to detect the most probable error that happened in the channel and so the recovery operation can be applied to the received quantum states. This modified algorithm is purely classical, and so it would be executed in a classical computer before feeding the decoded information back to the quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that it is a classical algorithm presents some problems, such as the fact that if the belief propagation takes more time than the decoherence time of the qubits, then the recovery would be unsuccesfull as more errors would have happened before correction is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why I wonder if there are quantum versions of the belief propagation algorithms that use the parallel nature of quantum computers to obtain substantial speedups in the decoding process. I am seeking for reference respect to this topic, or to know if there are research groups concerned about this kind of problem.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-08-08T14:10:53.663" Title="Quantum Belief Propagation decoding" Tags="&lt;error-correction&gt;&lt;resource-request&gt;&lt;decoherence&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3987" PostTypeId="2" ParentId="3932" CreationDate="2018-08-09T00:04:54.733" Score="4" Body="&lt;p&gt;&lt;strong&gt;(CW to avoid reps from self-answer)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There &lt;em&gt;might&lt;/em&gt; be an interactive way for two parties to narrow in on the value of $t$, following up on @DaftWullie's answer and @Steven Sagona's comments.  My formalism is poor, but I hope the idea gets through...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, call  the two parties Alice and Bob.  The parties have to cooperate, and behave honestly according to the protocol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Alice&lt;/strong&gt; knows how to prepare two states, $\vert A_0 \rangle$ and $\vert A_1 \rangle$.  Here, $\vert A_0\rangle$ is the uniform superposition over all Rubik's cube combinations, and $\vert A_1\rangle$ is some other monkey state with the same number of qubits (such as the state corresponding to a solved Rubik's cube, or a uniform superposition over some large subgroup of $G$).   &lt;strong&gt;Bob&lt;/strong&gt; knows how to apply a matrix $M$ to a quantum state, where $M$ corresponds to single step of all of the Singmaster moves (with ancillas where appropriate.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice and Bob want to show that the mixing time $t$ of the Rubik's cube group under Singmaster moves is at most $r$.  Alice and Bob repeat the following $s$ times. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Alice flips a coin $i\in\{0,1\}$, and provides $\vert A_i \rangle$ to Bob&lt;/li&gt;&#xA;&lt;li&gt;Bob repeats $r$ times to apply $M$ to $\vert A_i \rangle$, and measures the projector each time.&lt;/li&gt;&#xA;&lt;li&gt;If the projector is $1$ for each of the $r$ iterations, then Bob says that $i=0$. If the projector is not $1$ for at least one of the $r$ iterations, then Bob says that Alice's $i=1$. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If $i=0$, then each of Bob's $r$ iterations in step 2 does not change $\vert A_0\rangle$ - because by definition $\vert A_0 \rangle$ is an eigenstate of Bob's matrix, and Bob's matrix just permutes the states among themselves. If $i=1$, then the monkey state $\vert A_1 \rangle$ is &lt;em&gt;not&lt;/em&gt; an eigenstate of Bob's projector, and the chance that a $1$ will not be measured grows quickly with $r$.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if Bob has accurately predicted $i$ for $s$ iterations, the probability of success grows exponentially with $s$, and Bob's $r$ is large enough to distinguish a valid Rubik's cube state from a monkey state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how far apart $\vert A_1\rangle$ has to be from $\vert A_0\rangle$.  I also don't know if interaction can be removed.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2018-08-09T00:04:54.733" CommentCount="0" CommunityOwnedDate="2018-08-09T00:04:54.733" ContentLicense="CC BY-SA 4.0" />
  <row Id="3988" PostTypeId="2" ParentId="3982" CreationDate="2018-08-09T01:24:58.500" Score="1" Body="&lt;p&gt;This question is (in my opinion) the most important question to ask when trying to understand the mathematics of &quot;quantum superposition.&quot; Quantum superposition is the essence of how quantum computations are made.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have a coin, and I flip it 50% of the times I'll get heads and 50% of the time I can get tails: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P(Heads) = 50%&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P(Tails) = 50%&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if I make a quantum coin and write it in our fancy ket notation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|H\rangle + |T\rangle)$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that this fancy notation gives me the same results as my coin flip!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P(H) = $| \langle H |\psi\rangle |^2 = \frac{1}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P(T) = $| \langle T |\psi\rangle |^2 = \frac{1}{2}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's even the point? We say there's something special about quantum events, but the math is just the same as flipping coins?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we need to do is investigate a little deeper to see how a coin is different from a quantum coin:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case where we simply check if our quantum coin is heads-or-tails, we don't see how its different from a normal coin. Instead we're going to do a different procedure (with an silly analogy for intuition): Without checking if our coin is heads-or-tails, we insert our quantum coin through a special slot machine. This special slot machine (meant for cheaters) has a trick: if we insert the coin in one orientation (Heads-side pointing to the left) it gives luckier odds than when its inserted in the other orientation (heads-side pointing to the right).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that if we flip a coin and (without looking) insert it into the machine, our odds look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ \text{P(win)} = \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds})   $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Half the time we get the lucky odds and half the time we get unlucky odds. (And everyone who plays this slot that doesn't know the trick will get this average between the two odds!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about the quantum coin?  The quantum coin will not measure what was measured above. Let's work out the mathematical shapes of quantum mechanics, and define winning the slot machine is as a quantum mechanical operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P(\text{win|lucky-odds}) = |\langle W|H \rangle|^2$  and $P(\text{win|unlucky-odds}) = |\langle W|T \rangle|^2$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now if I insert the Heads-to-the-left orientation into the slot machine, I get the probability of winning with the lucky odds (same as before), and if the same if the heads-to-the-right orientation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference now is that when I apply my fancy ket state from before $| \psi \rangle = |H\rangle + |T\rangle$, I am now working with a quantum state, so now to find the probabilties I have to square &lt;strong&gt;everything&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P(Win) &amp;amp;= |\langle W|\psi\rangle|^2 \\&#xA;&amp;amp;= \frac{1}{2}|\langle W | (|H\rangle+|V\rangle)|^2 \\&#xA;&amp;amp;= \frac{1}{2}|\langle W|H\rangle + \langle W|T\rangle|^2 \\&#xA;&amp;amp;= \frac{1}{2}|\langle W|H\rangle|^2 + |\langle W|T\rangle|^2 \\&#xA;&amp;amp;   + \langle T|W\rangle \langle W|H\rangle + \langle H|W\rangle \langle W|T\rangle &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now putting the &quot;normal coin&quot; together with our &quot;quantum coin&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P_{normal}(Win) &amp;amp;= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\&#xA;P_{quantum}(Win) &amp;amp;= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\&#xA;&amp;amp;   + \langle T|W\rangle \langle W|H\rangle + \langle H|W\rangle \langle W|T\rangle   &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see that we have &lt;em&gt;extra&lt;/em&gt; terms that are in the quantum case!  These &quot;interference terms&quot; are the terms that are fundamental to what a quantum superposition is! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These &quot;interference terms&quot; change depending on the sign of the quantum superposition. So consider the case when $|\psi\rangle = |H\rangle  - |T\rangle $ instead of $ |H\rangle  + |T\rangle $ :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;P_{normal}(Win) &amp;amp;= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\&#xA;P_{quantum}(Win) &amp;amp;= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\&#xA;&amp;amp;   - \langle T|W\rangle \langle W|H\rangle - \langle H|W\rangle \langle W|T\rangle   &#xA;\end{align}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sign actually carries through, and this affects the &lt;em&gt;probabilities&lt;/em&gt; to win our slot machine. These weird interference terms are the essence of quantum mechanics, and while the notation of bras and kets are convenient, it's often easy to get lost in the mathematical shapes and not realize the essence or intuition of what's going on!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So finally, to answer your question, what is the difference between $ |H\rangle  + |T\rangle $ and $ |H\rangle \langle H |  + |T\rangle \langle T| $?  The difference is that $ |H\rangle  + |T\rangle $ is a &lt;strong&gt;quantum coin&lt;/strong&gt; that has these extra terms shown above.   The state:   $ |H\rangle \langle H |  + |T\rangle \langle T| $ is a &lt;strong&gt;normal coin&lt;/strong&gt; without any properties of quantum superposition. It has the porbabilities of $P_{normal}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In normal unitary quantum mechanics typically taught in undergraduate classes, it's actually not possible to construct a state that acts like a normal coin without quantum superposition! To get this &quot;normal coin&quot; you actually need to add extra rules to quantum mechanics (called working in the &quot;density matrix&quot; framework). &lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2018-08-09T01:24:58.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3989" PostTypeId="1" CreationDate="2018-08-09T09:34:48.640" Score="6" ViewCount="101" Body="&lt;p&gt;As I understand so far, in some algorithms such as Simon's algorithm, swap-test algorithm or quantum k-means algorithm, we repetitively perform a measurement yielding a classical result. Consequently, this pushes us to run the whole algorithm again and again (starting from initialization of the system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&#xA;&lt;em&gt;do we lose the complexity as the number of repetitions of the algorithm increases?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="55" LastEditDate="2018-08-09T12:09:07.783" LastActivityDate="2018-08-09T12:09:07.783" Title="Does the need of many quantum algorithms to be repeated several times impair the efficiency gains?" Tags="&lt;algorithm&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3990" PostTypeId="2" ParentId="3989" CreationDate="2018-08-09T09:44:36.850" Score="6" Body="&lt;p&gt;You probably want to look at old posts about Simon's algorithm, such as the rather complete explanation I gave &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1718/1837&quot;&gt;here&lt;/a&gt;, or talking more specifically about the number of times the algorithm has to be &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2223/1837&quot;&gt;repeated&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, you have to repeat the algorithm several times to get different pieces of classical data, which you then process classically to get your final answer. But this is taken into account in the complexity. Indeed, that is often one of the most significant bits of the analysis: what's the average run-time to get the answer? It is this that you compare to the classical run-time.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-09T09:44:36.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3992" PostTypeId="2" ParentId="3985" CreationDate="2018-08-09T16:53:35.283" Score="8" Body="&lt;p&gt;As a start, you might want to look at &lt;a href=&quot;https://arxiv.org/abs/1605.03590&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1605.03590&lt;/a&gt;, which lays out conservative (i.e., high) qubit and gate requirements for a meaningful quantum chemistry calculation under some pretty reasonable assumptions. The estimates there are on the order of $10^{15}$ total logical gates (not gate depth) over roughly 100 logical qubits, which means that the gate depth must be on the order of $10^{13}$ or higher (I'm looking at the nested counts).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at the logical level, you're correct: you don't need $10^{13}$ qubits &lt;em&gt;and&lt;/em&gt; $10^{13}$ gate depth to run nitrogenase. The two metrics, qubit count and gate depth, are not really equivalent: to run a real problem, I need on the order of a hundred qubits, but ten quadrillion gate depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not the whole picture, though. It's on the order of a hundred &lt;em&gt;logical&lt;/em&gt; qubits, and &lt;em&gt;logical&lt;/em&gt; gate depth of 10^13. Quantum error correction is essentially all about trading physical qubit count to get better logical gate depth. As you can see in table II in the paper, the logical-to-physical ratio ranges from 17,000/1 to 300/1 as the physical qubits get better (i.e., as the &lt;em&gt;physical&lt;/em&gt; gate depth increases). Again from table II, a &lt;em&gt;physical&lt;/em&gt; gate depth of $10^3$ leads to needing $10^9$ physical qubits, while a physical gate depth of $10^9$ only requires $10^6$ physical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;quantum volume&quot; measurement still doesn't seem quite right to me at this scale, though. I think a measurement more on the order of the product of the physical gate depth and the square of the physical qubit count is more accurate; for the three cases in table II, which represent equally powerful (in some sense) quantum computers, this value is roughly constant across the three columns. It also matches the rule of thumb that the number of qubits in a distance $d$ QEC code scales as $d^2$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one thing this leaves out is that the computer with $10^9$ physical gate depth will run your chemistry simulation much faster than the computer with $10^3$ physical gate depth because the computational and wall-clock overhead of QEC will be much lower. You could come up with a more complicated formula to take this into account, if you like.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastEditorUserId="1978" LastEditDate="2018-08-09T17:24:12.823" LastActivityDate="2018-08-09T17:24:12.823" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3993" PostTypeId="2" ParentId="3965" CreationDate="2018-08-09T21:49:51.040" Score="4" Body="&lt;p&gt;Actually, there should be a minus.&#xA;There is a mistake in the paper. &#xA;Wittek uses a minus in his &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0128100400&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;(expensive) book&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed say :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle =  \frac{1}{\sqrt{2}} (|0,a\rangle + |1,b\rangle) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\phi\rangle =  \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \phi |\psi\rangle = \frac{1}{\sqrt{2Z}} (|a|\langle 0| - |b|\langle 1|) (|0,a\rangle + |1,b\rangle) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \frac{1}{\sqrt{2Z}}( |a|\langle 0|0\rangle|a\rangle - |b|\langle 1|0 \rangle|a\rangle + |a|\langle 0|1 \rangle|b\rangle - |b|\langle 1| 1 \rangle |b\rangle )$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ = \frac{1}{\sqrt{2Z}}  (|a| |a\rangle - 0 + 0 - |b| |b\rangle) = \frac{1}{\sqrt{2Z}}  (|a| |a\rangle  - |b| |b\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the part of the question where you ask how to swap quantum registers of different numbers of qubits, the answer is you don't really do that. You actually swap the ancilla qubit of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle $&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$ |\phi\rangle $&lt;/span&gt;. This is not told in the reference but it is said in the &lt;a href=&quot;http://arxiv.org/abs/1307.0411&quot; rel=&quot;nofollow noreferrer&quot;&gt;original reference it is based on&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-05-15T09:52:44.073" LastActivityDate="2019-05-15T09:52:44.073" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3994" PostTypeId="1" AcceptedAnswerId="3998" CreationDate="2018-08-10T02:24:31.147" Score="6" ViewCount="268" Body="&lt;p&gt;Unlike Google's Bristlecone or IBM's Qbit computer, do simulators like Q# or Alibaba really use quantum mechanics anywhere in their physical chips? Are they just defining properties using a classical computer and trying to achieve quantum simulations ?&lt;/p&gt;&#xA;" OwnerUserId="4259" LastEditorUserId="26" LastEditDate="2018-10-22T08:25:52.397" LastActivityDate="2018-10-22T08:25:52.397" Title="Are quantum simulators like Microsoft Q# actually using quantum mechanics in their chips?" Tags="&lt;physical-realization&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="3996" PostTypeId="2" ParentId="3955" CreationDate="2018-08-10T06:18:36.437" Score="5" Body="&lt;p&gt;The difficulty with the question is the word &lt;em&gt;intuitive&lt;/em&gt;. Intuition basically reflects our understanding of the world around us, which is described by classical physics. Quantum mechanics is exactly the regime where our intuition breaks down because it functions very differently from the world of our everyday experience. As Terry Pratchett said :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It’s very hard to talk quantum using a language originally designed to&#xA;  tell other monkeys where the ripe fruit is.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is exactly that difference that we're using to get the computational speed-up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a sequence of standard algorithms that most quantum computing texts progress through: Deutsch's algorithm, &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Jozsa&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Simon%27s_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon's&lt;/a&gt;/Bernstein-Vazirani. These are chosen because they are the easiest to understand. They all have broadly the same structure, but increasing complexity, with a corresponding gain in computational speed (with Simon's giving exponential speed-up). You will not understand them intuitively. You have to do the maths. I think the closest that you will come is through the following explanation of Deutsch's algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine a one-bit function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. Either &lt;span class=&quot;math-container&quot;&gt;$f(0)=f(1)$&lt;/span&gt;, or it does not. Your task is to determine which. Obviously, in the classical world, you have to evaluate &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt;; two function calls. In the quantum world, crudely speaking, you can look at both values simultaneously, and perform a one-qubit measurement (which will give you one bit of information), but you can choose that measurement so that the one bit is a global property of the function, in this case &lt;span class=&quot;math-container&quot;&gt;$f(0)\oplus f(1)$&lt;/span&gt;. The same is broadly true of the other algorithms I mentioned: there is information, due to the structure of the problem, hidden in the collective properties of the function evaluations, and it is those collective properties that you are trying to determine.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-05-04T19:48:15.480" LastActivityDate="2020-05-04T19:48:15.480" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3997" PostTypeId="2" ParentId="3994" CreationDate="2018-08-10T06:57:43.423" Score="7" Body="&lt;p&gt;Quantum simulators don't rely on quantum-mechanical effects in the physical chips; instead they simulate certain aspects of quantum state and operations on it using only classical compute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Universal simulators simulate full quantum state of the system, performing linear algebra transformations on it. They support universal set of quantum operations, but the memory required grows exponentially with the number of qubits simulated, thus the system size is limited to 30-40 qubits (depending on the hardware and the simulator).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specialized simulators can focus on simulating certain aspects of larger systems at the cost of supporting a smaller set of operations. For example, CHP simulator (described in &lt;a href=&quot;https://www.scottaaronson.com/papers/chp6.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;) evolves only the stabilizer information in a matrix tableau instead of the full quantum state, and the required memory growth is quadratic in the number of qubits. The set of gates supported is limited to CNOT, Hadamard and phase gates, but it is sufficient to study quantum error correction protocols.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2018-08-10T15:42:45.200" LastActivityDate="2018-08-10T15:42:45.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="3998" PostTypeId="2" ParentId="3994" CreationDate="2018-08-10T08:25:03.820" Score="7" Body="&lt;p&gt;There is a distinction between what you use to write a program (the SDK), and what you use to run it (the backend).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SDK can be either a graphical interface, like the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/editor&quot; rel=&quot;noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt; or the &lt;a href=&quot;http://quantumcomputer.ac.cn/index.html&quot; rel=&quot;noreferrer&quot;&gt;CAS-Alibaba Quantum Computing Laboratory&lt;/a&gt;. It could also be a way of writing programs, like Q#, QISKit, Forest, Circ, ProjectQ, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The backend can either be a simulator that runs on a standard computer, or an actual quantum device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulators use our knowledge of quantum theory to construct the simulation program, but no actual quantum computing happens. It is just the standard chips of your own computer, or of a supercomputer they let you use, running standard classical programs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach is something we can do for small quantum programs, but the runtime will become unfeasibly long for large ones. So if you notice that your job takes longer and longer to run as you add more qubits, you know that it is being classically simulated rather than run on a real device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only actual quantum devices that can be used are those by IBM, Rigetti and Alibaba. To write programs for these you can use the Q Experience, QISKit or ProjectQ for the IBM devices, Rigetti's Forest for their devices, or the Alibaba graphical interface for their device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Microsoft are making hardware, and they hope that it will one day be used as a backend in Q#. But they have not yet gotten a single qubit, so we might have to wait a while. Until then it will be only simulators that can be used (or other companies hardware).&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-08-10T08:25:03.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="3999" PostTypeId="2" ParentId="3955" CreationDate="2018-08-10T12:44:20.247" Score="8" Body="&lt;p&gt;I would like to suggest that period finding (a subroutine, if you like, of the famous Shor algorithm) demonstrates a very intuitive, exponential speed-up: It should be intuitively clear that something on the order of (the square root of the uncertainty &lt;span class=&quot;math-container&quot;&gt;$\Delta p$&lt;/span&gt;) of the period &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; of function evaluations is required classically to find an unknown period &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; of a function that is guaranteed to be periodic in its integer input value. I've deliberately placed the paranthesis such that their content will be intuitive to people who have deeply ingrained the birthday paradox yet, for demonstrating a superpolynomial speedup, it is sufficient to intuitively understand that it is somewhere near &lt;span class=&quot;math-container&quot;&gt;$\Delta p$&lt;/span&gt;, the correct answer &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\Delta p}$&lt;/span&gt;, or some polynomial thereof and not something like the number of digits of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$O(\log p)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum algorithm for period finding, as employed by Shor's algorithm, simply takes the quantum Fourier transform of the periodic function applied to the equal superposition of all states. Naturally, only integer multiples of the period can then have a non-zero probability amplitude, so doing this (typically) twice will allow you to quickly extract the common factor as greatest common denominator. But a quantum Fourier transform is trivially implementable by &lt;span class=&quot;math-container&quot;&gt;$O(\log p)$&lt;/span&gt; controlled rotations (one per each input bit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The biggest intuitive speedup obviously occurs if you make the function evaluation very costly: The quantum algorithm only requires a constant (single) evaluation! But even otherwise you get a gain as you have an algorithm that runs, assuming function evaluations are constant time, in &lt;span class=&quot;math-container&quot;&gt;$O(\log p)$&lt;/span&gt; rather than in &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{\Delta p})$&lt;/span&gt; which, if you have no idea of the correct period &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is essentially &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{p})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="26" LastEditDate="2019-10-28T10:27:05.857" LastActivityDate="2019-10-28T10:27:05.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4000" PostTypeId="2" ParentId="3959" CreationDate="2018-08-11T01:39:58.223" Score="5" Body="&lt;p&gt;We can think of the Rubik's cube &lt;a href=&quot;https://en.wikipedia.org/wiki/Cayley_graph&quot; rel=&quot;noreferrer&quot;&gt;Cayley graph&lt;/a&gt; $\Gamma=(V,E)$ with each (colored) edge $E$ being one of the Singmaster moves $\langle U,U^{2},U^{3}=U^{-1},D,D^{2},D^{3},\cdots\rangle$ and each vertex $V$ being one of the $43252003274489856000\approx 4.3e{19}$ different configurations of the $3\times 3\times 3$ cubes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;http://mathworld.wolfram.com/GraphDiameter.html&quot; rel=&quot;noreferrer&quot;&gt;diameter&lt;/a&gt; of a graph is the longest shortest path in the graph.  Classical algorithm for determining the diameter is polynomial in $\vert V \vert$; see, e.g., &lt;a href=&quot;https://cs.stackexchange.com/questions/194/the-time-complexity-of-finding-the-diameter-of-a-graph&quot;&gt;this answer&lt;/a&gt; from a sister site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned above, God's number is (related to) this diameter; to know the longest shortest path between to vertices for a Cayley graph on a group, it suffices to know how many steps away from the solved state one is.  We know, thanks to Rokicki, Kociemba, Davidson, and Dethridge among others, that God's number is $20$.  The algorithms they executed was polynomial in $\vert V\vert$, e.g. polynomial in $4.3e{19}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Heiligman's quantum algorithm for graph diameter, mentioned in the comments, achieves a Grover speedup over Djikstra's algorithms, with &quot;a total quantum cost of $O(|V|^{9/4})$.&quot;  However, I believe Heiligman encodes the graph much as a classical algorithm would; e.g. with $O(|V|)$ qubits.  Clearly if $|V|=4.3e{19}$ then this would not help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Instead,&lt;/em&gt; another way to encode a Rubik's cube, as hinted in the other questions, is of course to prepare a uniform superposition over all $4.3e{19}$ states.  This only takes $\log 4.3e{19}$ qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum algorithms are good at talking about &quot;eigenvalues&quot; and &quot;eigenvectors&quot; and &quot;eigenstates.&quot;  Applying all Singmaster moves to a uniform superposition of all $4.3e{19}$ states does not change the state; i.e. the uniform superposition is an eigenstate of the Markov chain on the Cayley graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are relations between the &lt;em&gt;diameter&lt;/em&gt; of a graph and the &lt;em&gt;eigenvalues/eigenvectors&lt;/em&gt; of the corresponding adjacency/Laplacian matrix, especially the spectral gap, the distance between the two largest eigenvalues ($\lambda_1-\lambda_2$).  A quick Google search of &quot;diameter eigenvalue&quot; produces &lt;a href=&quot;https://link.springer.com/article/10.1007/BF01789463&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;; I recommend exploring similar Google searches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectral gaps are &lt;strong&gt;exactly&lt;/strong&gt; what limits the &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;noreferrer&quot;&gt;adiabatic algorithm&lt;/a&gt;.  Thus, perhaps by knowing how fast an adiabatic algorithm needs to run to evolve from the uniform superpositon to the solved state for various subgroups/subspaces of the Rubik's cube group, one could estimate the spectral gap, and use this to bound God's number.  But I'm quickly out of my league here and I doubt any sense of accuracy is achievable.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-08-11T02:02:00.363" LastActivityDate="2018-08-11T02:02:00.363" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4001" PostTypeId="2" ParentId="3985" CreationDate="2018-08-11T06:52:07.897" Score="8" Body="&lt;p&gt;Quantum volume is likely only useful as a metric for small noisy computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It’s impossible to invent any single-number metric that’s ideal for all tasks. Even with classical computers, metrics such as Dhrystone or Windows Performance Index are at best suggestive at predicting performance on real-world tasks. Conversely, giving more than one number can potentially be much more informative. Within the quantum volume framework, I suggest when characterizing a QPU to give quantum volume as the “executive summary” but also quote for a range of different qubit numbers $N$ the model circuit depths $d(N)$. Comparing the $d(N)$ to the needed depth and qubits will be predictive, at least to the extent that the killer apps resemble the model circuit sequences of parallel random $SU(4)$ on random pairs of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum volume is about correctly implementing the model circuits, thus measuring it involves simulating those circuits to compare the output of the QPU against the ideal results.  Simulation is practical only for relatively few qubits or low depth, so it is only possible to measure the quantum volume for small/noisy devices (without additional assumptions). Fortunately, when width/depth reaches the limit of simulation (very roughly around $N\simeq d\simeq 50$), this is when the noise must necessarily be low enough that we could begin to use such a device to implement logical qubits. Defining appropriate metrics for logical qubits is an open question. The emphasis switches from “Can this algorithm run at all?” to “How long will this algorithm take?” and metrics will surely be very different, involving the logical gate time.&lt;/p&gt;&#xA;" OwnerUserId="4322" LastActivityDate="2018-08-11T06:52:07.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4002" PostTypeId="1" AcceptedAnswerId="4004" CreationDate="2018-08-11T07:51:42.133" Score="7" ViewCount="162" Body="&lt;p&gt;In many sources (like on Page 30 &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;), I found that the complexity of the original Harrow Hassidim Lloyd is stated as $\mathcal{O}(\log (N) s^2 \kappa^2/\epsilon)$ where $s$ is said to be the &quot;matrix sparsity&quot;. What is a precise definition of the term &quot;matrix sparsity&quot;? I couldn't find it stated anywhere. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-08-11T12:23:59.963" Title="What exacty is &quot;matrix sparsity&quot; $s$?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4003" PostTypeId="2" ParentId="4002" CreationDate="2018-08-11T08:12:58.147" Score="2" Body="&lt;p&gt;I believe the way they use it is as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The maximum number of non-zero elements in any row.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Although that’s different to the way Wikipedia defines sparsity, which is essentially the average:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the total number of non-zero elements divided by the number of elements.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-11T08:12:58.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4004" PostTypeId="2" ParentId="4002" CreationDate="2018-08-11T12:09:08.463" Score="7" Body="&lt;p&gt;You have the definitions in your paper &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;noreferrer&quot;&gt;you link&lt;/a&gt; page 12.&#xA;Simply said, it is a matrix with many 0s.&lt;br&gt;&#xA;As an example take N = 16, and the polynomial function is just a simple function like 1.5*X,&#xA;then your matrix has at most 1.5*log(16,2)=6 non-zero entries per row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XQGw9.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XQGw9.png&quot; alt=&quot;Definitions of sparsity&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you prefer a visual, you have it &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/talks/nsf15.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rbRcz.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rbRcz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-08-11T12:23:59.963" LastActivityDate="2018-08-11T12:23:59.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4005" PostTypeId="1" CreationDate="2018-08-11T15:03:39.597" Score="14" ViewCount="4195" Body="&lt;p&gt;Many people have suggested using &quot;Random Circuit Sampling&quot; to demonstrate quantum supremacy. But what is the precise definition of the &quot;Random Circuit Sampling&quot; problem? I've seen statements like &quot;the task&#xA;is to take a random (efficient) quantum circuit of a specific form and generate samples from its output distribution&quot;. But it is not clear to me what the terms &quot;random (efficient) quantum circuit&quot; mean precisely. Also, do we know anything about the classical computational complexity of this problem?&lt;/p&gt;&#xA;" OwnerUserId="4324" LastEditorUserId="2927" LastEditDate="2019-06-26T22:00:05.467" LastActivityDate="2019-06-26T22:00:05.467" Title="What exactly is &quot;Random Circuit Sampling&quot;?" Tags="&lt;speedup&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4006" PostTypeId="2" ParentId="4005" CreationDate="2018-08-11T22:10:07.680" Score="13" Body="&lt;p&gt;There are a continuous set of possible states for $n$ qubits, each of which can be expressed as a superposition of the $2^n$ basis states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mostly of these states are highly entangled, and would require highly complex circuits to create (assuming the standard gate set of single qubit rotations and two or three qubit entangling gates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These circuits would have to be implemented very cleanly to be able to reach these states. Noise causes decoherence, which essentially drives your qubits to an unentangled state (like all qubits $|0\rangle$ due to relaxation, or the maximally mixed state due to constantly rotated relaxation and dephasing).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of unentangled states is just a tiny corner of the total set of all possible states, but it is a corner that is hard to leave for long. So implementing circuits capable of fully exploring the $n$ qubit Hilbert space will be very hard. But taking advantage of the full Hilbert space is what quantum computing is all about. So we have to show that we can overcome this hurdle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to see how well we do this is to focus on just randomly producing $n$ qubit states. These should be picked uniformly from all possible states, and not be biased towards the tiny set of states that it is easy for us to produce or write down. This can be done by running a random circuits of sufficient circuit depth. The number of gates for this thought to be efficient (i.e. polynomial in $n$), though I'm not sure if this is proven or is just a widely held conjecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The randomness of the process ensures that there are no nice properties that could be exploited by a classical simulation. So the task of simulating arbitrary random circuits will require a full simulation of the $n$ qubits, the required classical resources for which scale exponentially with $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The details of how exactly to go about creating the random circuit, and what to look for in the results to declare success, depend on the proposal (such as Google's). It is also not yet clear how many qubits are needed before current supercomputers cannot reproduce the result.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-08-11T22:16:48.567" LastActivityDate="2018-08-11T22:16:48.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4007" PostTypeId="1" CreationDate="2018-08-12T02:25:30.650" Score="5" ViewCount="183" Body="&lt;p&gt;Is there a method to calculate prime factorization in Q# of Visual Studio of Microsoft Quantum Development Kit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Python language, it is the &lt;code&gt;sympy.factorint&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or else is there any Q# sample program?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is like &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt; calling Q# from C#.&lt;/p&gt;&#xA;" OwnerUserId="4308" LastEditorUserId="26" LastEditDate="2019-05-14T05:50:34.603" LastActivityDate="2019-11-15T18:11:06.767" Title="Q# factorization Method Program" Tags="&lt;programming&gt;&lt;resource-request&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4008" PostTypeId="2" ParentId="4007" CreationDate="2018-08-12T05:49:49.290" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/microsoft/Quantum/tree/master/samples/algorithms/integer-factorization&quot; rel=&quot;nofollow noreferrer&quot;&gt;Integer factorization sample&lt;/a&gt; in the official Quantum Development Kit samples repository implements Shor's algorithm in Q# and shows how to call it from C#.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-11-15T18:11:06.767" LastActivityDate="2019-11-15T18:11:06.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4009" PostTypeId="2" ParentId="3960" CreationDate="2018-08-12T07:10:09.783" Score="6" Body="&lt;p&gt;Any Hermitian gate is &quot;self-canceling&quot;. Proof: since any gate $U$ is unitary&#xA;$$&#xA;UU^{\dagger}=U^{\dagger}U=I&#xA;$$&#xA;If $U$ is also Hermitian, $U=U^{\dagger}$ and&#xA;$$UU=I$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT gate&#xA;$$&#xA;\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{array}\right)&#xA;$$&#xA;is Hermitian by inspection.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2018-08-12T07:10:09.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4010" PostTypeId="1" AcceptedAnswerId="4011" CreationDate="2018-08-12T20:34:45.397" Score="11" ViewCount="857" Body="&lt;p&gt;Quoting from &lt;a href=&quot;https://earltcampbell.com/research/magic-states/&quot; rel=&quot;noreferrer&quot;&gt;this blog post by Earl T. Campbell&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Magic states are a special ingredient, or resource, that allows quantum computers to run faster than traditional computers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One interesting example that is mentioned in that blog post is that, in the case of a single qubit, any state apart from the eigenstates of the Pauli matrices is &lt;em&gt;magic&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these &lt;em&gt;magic states&lt;/em&gt; more generally defined? Is it really just &lt;em&gt;any state that is not a stabilizer state&lt;/em&gt;, or is it something else?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-08-13T06:25:12.287" Title="How are magic states defined in the context of quantum computation?" Tags="&lt;speedup&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4011" PostTypeId="2" ParentId="4010" CreationDate="2018-08-13T05:16:07.630" Score="6" Body="&lt;p&gt;It is any state that, if you have an unlimited supply of them, can be used to give you universal quantum computation when used in conjunction with perfect Clifford operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard example is that if you can produce the state $(|0\rangle+e^{i\pi/4}|1\rangle)/\sqrt{2}$, then you can combine this with Clifford operations in order to apply a $T$ gate (see Fig. 10.25 in Nielsen and Chuang), and we know that $T$+Clifford is universal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, in the one qubit case that is being discussed, I assume the accurate statement is that any &lt;em&gt;pure&lt;/em&gt; state that is not an eigenstate of a Pauli operator is magic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real interest is in mixed states - how noisy can a particular magic state be before it isn’t magic any more. The theory being that Clifford operations are often comparatively easy in a fault-tolerant scenario (they can be applied transversally), and it is creating the one non-Clifford gate that’s hard. The more noise it can tolerate, the easier it will be to make.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that I’ve seen results proving that there are some non-Clifford mixed states which are not magic, but I don’t remember the reference off the top of my head. Earl’s papers are the ones you want to read on this topic.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-13T06:25:12.287" LastActivityDate="2018-08-13T06:25:12.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4012" PostTypeId="1" AcceptedAnswerId="4013" CreationDate="2018-08-13T14:27:24.667" Score="4" ViewCount="224" Body="&lt;p&gt;For example, one have measured some states like $|0\rangle$ in the computational basis for many times and got the approximate probability of getting 0 and 1 ($P(0)$ and $P(1)$). Then how does he calculate the off-diagonal elements of the density of the initial quantum state?&#xA;The system is open and with noise.&lt;/p&gt;&#xA;" OwnerUserId="4178" LastActivityDate="2018-08-13T14:41:14.227" Title="How to calculate the off-diagonal elements of a density matrix using the measurement result?" Tags="&lt;measurement&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4013" PostTypeId="2" ParentId="4012" CreationDate="2018-08-13T14:41:14.227" Score="5" Body="&lt;p&gt;With the given measurements, you cannot: there is no observable difference between many different states such as $|\pm\rangle=(|0\rangle\pm|1\rangle)/\sqrt{2}$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to determine what the state is completely, you need more measurements. If you're using projective measurements, you need two more. These would typically be projections onto the bases&#xA;$$&#xA;|\pm\rangle \qquad\text{and}\qquad  (|0\rangle\pm i|1\rangle)/\sqrt{2}&#xA;$$&#xA;However, if you are willing to use POVMs, you can define a single measurement, comprising four measurement operators that does the job. One way to visualise these is in the Bloch-sphere: you need a set of axes that provides a basis in the three dimensional space. Three vectors cannot do this because they satisfy a completeness relation which constrains them to be in a plane. The most effective way to do this is to inscribe a regular tetrahedron inside the Bloch sphere and take the 4 corners as measurement bases.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-13T14:41:14.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4014" PostTypeId="1" AcceptedAnswerId="4020" CreationDate="2018-08-14T02:04:32.497" Score="8" ViewCount="207" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;noreferrer&quot;&gt;Boson Sampling&lt;/a&gt;, sometimes stylized as BosonSampling, is an attractive candidate problem to establish quantum supremacy; the engineering problems appear more surmountable than those associated with a Turing-complete quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Boson Sampling has a downside, in that the output of a photonic quantum computer capable of executing Boson Sampling with only a handful ($\le 100$ or so) of qubits may not even be able to be clasically simulated.  This is, of course, unlike $\mathsf{NP}$ problems such as factoring, the engineering aspects of which are significantly harder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, we may establish the results of Boson Sampling on $100$ or so photons, but in order to verify the results, we need to calculate the permanent of a $100\times100$ matrix.  This is famously computationally hard to verify.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a supercomputer powerful enough to calculate the permanent can do the trick.  But then everyone would have to believe &lt;em&gt;both&lt;/em&gt; the supercomputer's results &lt;em&gt;and&lt;/em&gt; the Boson Sampling results.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there anything about Boson Sampling that can be easily verified?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've had a flight of fancy to maybe put the resources of a cryptocurrency mining network to use to calculate such a permanent, and relying on some $\mathsf{\#P}$ / $\mathsf{IP}$ tricks for public verification, but I haven't gotten very far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like @gIS's answer.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Compare Boson Sampling with Appel and Franken's computer-assisted proof of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Four_color_theorem&quot; rel=&quot;noreferrer&quot;&gt;Four Color Theorem&lt;/a&gt;.  The original proof of the 4CT was allegedly controversial, precisely because the proof was too long to be publicly verified by a human reader.  We've moved so far from the '70's with our trust of computers, wherein I think now most people accept the proof of the 4CT without much controversy. But thinking about how to make things like a proof of the 4CT human-verifiable may lead to interesting ideas like the &lt;a href=&quot;https://en.wikipedia.org/wiki/PCP_theorem&quot; rel=&quot;noreferrer&quot;&gt;$\mathsf{PCP}$ theorem&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-08-14T16:19:23.097" LastActivityDate="2018-09-25T15:37:07.647" Title="What about BosonSampling can be publicly verified?" Tags="&lt;photonics&gt;&lt;boson-sampling&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4015" PostTypeId="5" CreationDate="2018-08-14T12:03:40.867" Score="0" Body="&lt;p&gt;Use for questions about money whose security is based on aspects of the No-Cloning Theorem.  For example, questions regarding Wiesner's scheme from the 1970's, or more recent public-key schemes from the early 2010's, or other questions about distributed ledgers and quantum money from the late 2010's.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2018-08-14T14:38:11.537" LastActivityDate="2018-08-14T14:38:11.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4016" PostTypeId="4" CreationDate="2018-08-14T12:03:40.867" Score="0" Body="For questions about money whose security is based on aspects of the No-Cloning Theorem." OwnerUserId="2927" LastEditorUserId="26" LastEditDate="2019-01-01T09:51:05.890" LastActivityDate="2019-01-01T09:51:05.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4017" PostTypeId="1" AcceptedAnswerId="5343" CreationDate="2018-08-14T12:37:15.387" Score="10" ViewCount="654" Body="&lt;p&gt;I was wondering if there was some code available for Hamiltonian simulation for sparse matrix. And also if they exist, they correspond to a divide and conquer approach or a Quantum walk approach?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-09-25T07:35:12.807" Title="Is there a Hamiltonian simulation technique implemented somewhere?" Tags="&lt;algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4018" PostTypeId="2" ParentId="4017" CreationDate="2018-08-14T12:59:53.410" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2012.668289&quot; rel=&quot;nofollow noreferrer&quot;&gt;In this article&lt;/a&gt; the authors stated that they used this &lt;a href=&quot;https://docs.lib.purdue.edu/cgi/viewcontent.cgi?referer=https://www.google.com/&amp;amp;httpsredir=1&amp;amp;article=1762&amp;amp;context=nanopub&quot; rel=&quot;nofollow noreferrer&quot;&gt;Group Leader's algorithm&lt;/a&gt; in order to obtain the circuit implementing the hamiltonian simulation used as a subroutine in an instance of &lt;em&gt;HHL&lt;/em&gt; algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately though, I did not understand quite well how they actually managed to find the circuit with that method.&lt;/p&gt;&#xA;" OwnerUserId="2648" LastActivityDate="2018-08-14T12:59:53.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4019" PostTypeId="2" ParentId="3980" CreationDate="2018-08-14T13:48:35.050" Score="3" Body="&lt;p&gt;You can actually perform convolution on a quantum computer (and exponentially faster for that matter), if your input signals have a certain structure. But for general inputs, this seems challenging and maybe even physically impossible, which is what the paper seems to argue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider how you would compute the convolution of two discrete signals $f$ and $g$ classically. You can take the Fourier transform of both signals, do a point-wise multiplication of the resulting vectors, and then do an inverse Fourier transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\mathscr{F}^{-1} (\mathscr{F}(f) . \mathscr{F}(g))&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that Fourier transform is a very cheap operation on a quantum computer. So this seems great. The problem is that the point-wise multiplication of two vectors is not so easy. Let's see what factors determine that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we are lucky and the Fourier spectrum of $f$ turns out to be flat:&#xA;$$&#xA;F = \mathscr{F}(f) = \frac{1}{N}\sum_{i=0}^{N-1}{|i\rangle} = \sum_{i=1}^{N-1}F(i)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, your quantum computer can do a diagonal matrix operation that gives you the point-wise multiplication:&#xA;$$&#xA;\mathscr{F}(f) . \mathscr{F}(g) = F.G = &#xA;\left(\begin{array}{cccc}&#xA;F(0) &amp;amp;      &amp;amp;  &amp;amp;  \\&#xA;     &amp;amp; F(1) &amp;amp;  &amp;amp;  \\&#xA;     &amp;amp;      &amp;amp; . &amp;amp; \\&#xA;     &amp;amp;      &amp;amp;  &amp;amp; F(N-1)&#xA;\end{array}\right) &#xA;\left(\begin{array}{c}&#xA;G(0) \\&#xA;G(1) \\&#xA;. \\&#xA;G(N-1)&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, quantum algorithms that find the point-wise multiplication of two vectors may be physically impossible in the general case. This is because this operation is non-unitary in general. As a simple example, suppose that the Fourier transform of $f$ is a spiky function, with zeros in most places:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;F = \mathscr{F}(f) = \frac{1}{2}(|0\rangle + |2\rangle + |5\rangle + |7\rangle)&#xA;$$&#xA;The point-wise multiplication of this state with another state is non-reversible (because of the zeros), and thus not unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There has been prior work to discover functions that result in a flat or near-flat Fourier spectrum, and are thus easy to convolute:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0811.3208&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0811.3208&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0211140&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0211140&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="2503" LastEditDate="2018-08-14T16:43:51.840" LastActivityDate="2018-08-14T16:43:51.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4020" PostTypeId="2" ParentId="4014" CreationDate="2018-08-14T14:53:24.837" Score="7" Body="&lt;h1&gt;About the need of boson sampling verification&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;First of all, let me point out that it is not a strict necessity to &lt;em&gt;verify&lt;/em&gt; the output of a boson sampler. By this, I don't mean to say that it is not useful or interesting to try and do so, but rather that it is in some sense more of a &lt;em&gt;practical&lt;/em&gt; than a fundamental necessity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you yourself put up a good argument for this when you write&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Maybe a supercomputer powerful enough to calculate the permanent can do the trick. But then everyone would have to believe both the supercomputer's results and the Boson Sampling results.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Indeed, there are many instances in which one solves a problem and trusts a solution which cannot really be fully verified. I mean, forget quantum mechanics, just use your computer to multiply two huge numbers. You probably have a high confidence that the result you get is correct, but how do you &lt;em&gt;verify&lt;/em&gt; it without using another computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, &lt;em&gt;trust&lt;/em&gt; in a device's results comes from a variety of things, such as knowledge of the inner working of the device, and unit testing of the device itself (that is, testing that it works correctly for the special instances that you &lt;em&gt;can&lt;/em&gt; verify with some other method).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem of boson sampling certification is no different. We know that, at some point, we will not be able to fully verify the output of a boson sampler, but that does not mean that we will not be able to trust it. If the device is built with due thoroughness, and its output is verified for a variety of small instances, and other tests that one is able to carry out are all successful, then at some point one builds up enough &lt;em&gt;trust&lt;/em&gt; in the device to make a quantum supremacy claim (or whatever else one wants to use the boson sampler for) meaningful.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Is there anything about BosonSampling that can be easily verified?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Yes, there are properties that can be verified. Due to the sampling nature of the problem, what people typically do is to rule out alternative models that might have generated the observed samples. For example, Aaronson and Arkhipov (&lt;a href=&quot;https://arxiv.org/abs/1309.7460&quot; rel=&quot;nofollow noreferrer&quot;&gt;1309.7460&lt;/a&gt;) showed that the BosonSampling distribution is far from the uniform distribution in total variation distance (with high probability over the Haar-random matrices inducing the distribution), and gave a protocol to efficiently distinguish the two distributions.&#xA;A more recent work showing how statistical signatures can be used to certify the boson sampling distribution against alternative hypotheses is (&lt;a href=&quot;https://arxiv.org/abs/1410.8547&quot; rel=&quot;nofollow noreferrer&quot;&gt;Walschaers et al. 2014&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other works that I am aware of focus on certifying specific aspects of a boson sampler, rather than directly tackling the problem of finding alternative distributions which are far from the BosonSampling one for random interferometers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, one can isolate two major possible sources of error in a boson sampling apparatus: those arising from incorrectly implementing the interferometer, and those arising from the input photons not being what they should (that is, totally indistinguishable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first case is (relatively) easy to handle because one can efficiently characterise an interferometer using single-photons.&#xA;However, certifying the indistinguishability of input photons is trickier. One idea to do this is to change the interferometer to a non-random one, such as the QFT interferometer, and see whether something can be efficiently verified in this simpler case. I won't try to add all the relevant references here, but this direction started with (Tichy et al. &lt;a href=&quot;https://arxiv.org/abs/1002.5038&quot; rel=&quot;nofollow noreferrer&quot;&gt;2010&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1312.3080&quot; rel=&quot;nofollow noreferrer&quot;&gt;2013&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the public verification aspect, there isn't anything done in this direction that I've heard of. I am also not sure whether it is even a particularly meaningful direction to explore: why should we require such a &quot;high standard&quot; of verification for a boson sampler, when for virtually any other kind of experiment we are satisfied with trusting the people doing the experiment to be good at what they are doing?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-08-24T11:20:15.910" LastActivityDate="2018-08-24T11:20:15.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4021" PostTypeId="2" ParentId="2151" CreationDate="2018-08-14T16:37:15.337" Score="11" Body="&lt;p&gt;Here's a list of other resources to learn about quantum machine learning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;noreferrer&quot;&gt;An introduction to quantum machine learning&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1408.7005&quot; rel=&quot;noreferrer&quot;&gt;The quest for a Quantum Neural Network&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/profile/Peter_Wittek/publication/264825604_Quantum_Machine_Learning_What_Quantum_Computing_Means_to_Data_Mining/links/5ababcfba6fdcc71647085db/Quantum-Machine-Learning-What-Quantum-Computing-Means-to-Data-Mining.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum Machine Learning: What Quantum Computing Means to Data Mining&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/xanaduai/quantum-machine-learning-1-0-76a525c8cf69&quot; rel=&quot;noreferrer&quot;&gt;Quantum Machine Learning 1.0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4294" LastActivityDate="2018-08-14T16:37:15.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4023" PostTypeId="1" AcceptedAnswerId="4034" CreationDate="2018-08-14T20:22:19.970" Score="5" ViewCount="94" Body="&lt;p&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}$I am trying to show equality of two intermediate steps in the rearrangement of the Quantum Fourier transform definition, but I do not know how to rearrange the coefficients of a tensor product. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The text claims that $$ \frac{1}{2^{n/2}}\sum_{k_1=0}^{1}\sum_{k_2=0}^{1} \cdots \sum_{k_n=0}^{1}e^{2\pi ij \left( \sum_{l=1}^n{k_l 2^{-l}} \right)} \ket{k_1 \ldots k_n} = \frac{1}{2^{n/2}}\sum_{k_1=0}^{1}\sum_{k_2=0}^{1} \cdots \sum_{k_n=0}^{1}{ \bigotimes_{l=1}^n e^{2\pi ijk_l 2^{-l}} \ket{k_l}} $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Isolating the parts that change leaves us with $$ e^{2\pi ij \left( \sum_{l=1}^n{k_l 2^{-l}} \right)} |k_1 \ldots k_n \rangle = \bigotimes_{l=1}^n e^{2\pi ijk_l 2^{-l}} |k_l \rangle. $$ If I were to look at a small case letting $ n = 3. $ I would get the following on the left hand side, $$ e^{2\pi i j \left( k_12^{-1} + k_22^{-2} + k_32^{-3} \right) } |k_1k_2k_3 \rangle, $$ and the following on the right hand side, $$ e^{2 \pi i jk_12^{-1}} |k_1\rangle \otimes e^{2 \pi i jk_22^{-2}}|k_2\rangle \otimes e^{2 \pi i jk_32^{-3}}|k_3\rangle. $$ Is there a rule that is similar to $$ a |k_1\rangle \otimes b |k_2\rangle = ab|k_1k_2\rangle$$ that will allow me to rewrite the RHS to be equal to the LHS as desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also like to ask for reference suggestions to strengthen my understanding of tensor product algebra as well.&lt;/p&gt;&#xA;" OwnerUserId="4348" LastEditorUserId="55" LastEditDate="2018-08-14T20:33:14.973" LastActivityDate="2018-08-15T16:28:37.993" Title="Simplifying Quantum Tensor products with coefficients" Tags="&lt;tensor-product&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4029" PostTypeId="1" AcceptedAnswerId="4038" CreationDate="2018-08-15T01:28:15.780" Score="5" ViewCount="610" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_rotor_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; entry on the subject is rather short. I am also curious about generalizations of quantum rotors in n-dimensions. An introductory explanation with at least one resource for further reading would be greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-14T06:00:29.340" LastActivityDate="2018-12-14T06:00:29.340" Title="What exactly are &quot;quantum rotors&quot;?" Tags="&lt;resource-request&gt;&lt;models&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4030" PostTypeId="5" CreationDate="2018-08-15T05:05:18.760" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-08-15T05:05:18.760" LastActivityDate="2018-08-15T05:05:18.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4031" PostTypeId="4" CreationDate="2018-08-15T05:05:18.760" Score="0" Body="The quantum rotor model is a mathematical model for a quantum system. It can be visualized as an array of rotating electrons which behave as rigid rotors that interact through short-range dipole-dipole magnetic forces originating from their magnetic dipole moments (neglecting Coulomb forces). The model differs from similar spin-models such as the Ising model and the Heisenberg model in that it includes a term analogous to kinetic energy. [from Wikipedia]" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-08-15T05:05:18.760" LastActivityDate="2018-08-15T05:05:18.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4032" PostTypeId="2" ParentId="4023" CreationDate="2018-08-15T06:08:52.480" Score="1" Body="&lt;p&gt;Isn't &#xA;$$ e^{2\pi i j \left( k_12^{-1} + k_22^{-2} + k_32^{-3} \right) } |k_1k_2k_3 \rangle, $$ &#xA;same as&#xA;$$ e^{2 \pi i jk_12^{-1}} |k_1\rangle \otimes e^{2 \pi i jk_22^{-2}}|k_2\rangle \otimes e^{2 \pi i jk_32^{-3}}|k_3\rangle. $$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The kets gets the kronecker product according to $ a |k_1\rangle \otimes b |k_2\rangle = ab|k_1k_2\rangle$ and the exponentials adds up according to $e^{x+y}=e^x.e^y$. Just keep in mind that this identity of exponential holds only if $x$ and $y$ commutes. In your case the power to which exponentials are raised are just scalar numbers and thus commutes.&lt;/p&gt;&#xA;" OwnerUserId="2817" LastActivityDate="2018-08-15T06:08:52.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4033" PostTypeId="1" AcceptedAnswerId="4040" CreationDate="2018-08-15T07:40:35.363" Score="5" ViewCount="439" Body="&lt;p&gt;I'm new to Q# and I was curious on how one would find the number of Q# simulatable qubits for a specific machine.  I know Microsoft has an approximation of 16GB ~ 30 qubits but I wanted a better estimation for my own machines.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wrote this quick program that runs a loop which allocates a register of increasing size.  When I get a &lt;code&gt;std::bad_alloc&lt;/code&gt; error I then have an estimate.  I'm guessing there is a better way either through a tool or some pre-written code.&lt;/p&gt;&#xA;" OwnerUserId="1287" LastEditorUserId="26" LastEditDate="2019-03-12T09:06:00.537" LastActivityDate="2019-03-12T09:06:00.537" Title="Finding the maximum number of Q# simulatable qubits" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4034" PostTypeId="2" ParentId="4023" CreationDate="2018-08-15T10:28:48.633" Score="3" Body="&lt;p&gt;Expanding and generalising from Jitendra's answer: the key observation in this case is that you must use how scalar factors behave over tensor products.&#xA;Specifically,&#xA;$$ a (U \otimes V) = (aU) \otimes V = U \otimes (aV), $$&#xA;or more generally&#xA;$$ a_1 a_2 \cdots a_k \,(U_1 \otimes U_2 \otimes \cdots \otimes U_k)&#xA;= (a_1 U_1) \otimes (a_2 U_2) \otimes \cdots \otimes (a_k U_k). $$&#xA;Let's consider the left-hand side of the expression which you isolated,&#xA;$$&#xA; \exp\bigl(2\pi ij \sum_{\ell=1}^n{k_\ell 2^{-\ell}} \bigr) |k_1 \cdots k_n \rangle \;: $$ &#xA;we may use the fact that $\exp(a+b+\cdots+h) = \exp(a) \exp(b) \cdots \exp(h)$ to re-express this as&#xA;$$&#xA; = \Bigl[\, \prod_{\ell=1}^n \exp\bigl(2\pi ij k_\ell \big/ 2^{\ell} \bigr) \Bigr] |k_1 \cdots k_n \rangle \;. $$ &#xA;We next use the fact that $\lvert k_1 k_2 \cdots k_n \rangle$ is short-hand for a tensor product of operators (state-vectors to be specific):&#xA;$$  = \Bigl[\, \prod_{\ell=1}^n \exp\bigl(2\pi ij k_\ell \big/ 2^{\ell} \bigr) \Bigr] \Bigl[\, \bigotimes_{\ell=1}^n |k_\ell \rangle \Bigr] \;. $$&#xA;Now we use the way that scalars interact with tensor products:&#xA;$$  =  \bigotimes_{\ell=1}^n \Bigl[ \exp\bigl(2\pi ij k_\ell \big/ 2^{\ell} \bigr) |k_\ell \rangle \Bigr] \;, $$&#xA;which was what we wanted to show.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-08-15T16:28:37.993" LastActivityDate="2018-08-15T16:28:37.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4035" PostTypeId="1" CreationDate="2018-08-15T14:14:29.017" Score="13" ViewCount="1972" Body="&lt;p&gt;Say you have a PDE you want to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What kind of quantum algorithms would you use to solve it?&#xA;How do we input our problem on a quantum computer?&#xA;What will be the output and in what form?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that quantum algorithms for solving linear systems (often named HHL but actually this is a bad name as other versions are not from the HHL authors) were listed before but maybe other methods are out there.&#xA;Also as it is considered as a subroutine, the output is quantum and then unless you want statistics from it or use it as an input of another quantum algorithm, it is limiting.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-01-10T08:02:23.453" Title="How would a quantum computer be used to solve Partial Differential Equations?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4036" PostTypeId="2" ParentId="4035" CreationDate="2018-08-15T15:31:59.720" Score="6" Body="&lt;p&gt;I don't have an exact answer to your question (if it actually exists); but I can answer part of your question concerned with the I/O to a quantum processor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a general rule of thumb; Quantum Algorithms (currently) cannot provide direct answers to problem statements. At least for now, quantum processors exists as heterogeneous accelerators with a classical computing unit. The 'quantum accelerator' is concerned with only that part of the overall algorithm that is not trivial (or exponential in complexity) to solve on a classical computer. In the end, only a sub portion of the program is actually computed on the quantum processor. (Eg. Shor's Factoring Algorithm is actually a period finding algorithm. Period finding is a non-trivial task.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Among several other reasons, of the main problems is input and output operation with a quantum processor. The problem 'must' be expressible in a concise form (eg. an equation). This equation is expressed as a quantum circuit in the 'oracle' which is primarily concerned with solving the equation and measurement outcome are recorded (tomography). The output too needs post processing to actually make sense (which is again performed by the classical counterpart).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;p.s. I would be very interested to know more about PDE solving quantum algorithms; if there is an efficient one.&lt;/p&gt;&#xA;" OwnerUserId="2391" LastActivityDate="2018-08-15T15:31:59.720" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4037" PostTypeId="2" ParentId="4029" CreationDate="2018-08-15T15:58:17.720" Score="1" Body="&lt;p&gt;First of all, quantum rotors generally appear in the context of quantum rotor models, which are lattice models, analogous to quantum spin systems on a lattice - this is, identical quantum systems arrange on a lattice and interacting via some (natural) interaction.  One wouldn't usually talk of an isolated quantum rotor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what are quantum rotors?  They are quantum mechanical versions of classical rotors, just as quantum spins can be regarded as quantum versions of classical two-level systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is a classical rotor? It is basically a tiny magnet which can rotate freely in a certain number $d$ of dimensions, such as a compass needle ($d=2$, this would be a O(2) rotor model).  It is thus characterized by a unit vector $\vec n$ in $d$ dimensions. The natural interactions of these models would be dipole-dipole interactions (i.e. $\vec n_i\cdot \vec n_j$), and the natural on-site energy would be a kinetic term $\vec{L}^2/2$ with $L$ the angular momentum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These interactions can be turned quantum mechanical in the canonical way for conjugate variables, as explained on the Wikipedia page.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-08-15T15:58:17.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4038" PostTypeId="2" ParentId="4029" CreationDate="2018-08-15T16:03:30.363" Score="4" Body="&lt;p&gt;Quantum rotor models are quantum systems based on the quantization of systems with rotational configuration spaces. For example, a particle moving on a ring or a pendulum are rotors whose configuration spaces are circular $S^1$, while a rigid body a system whose configuration space is the three-dimensional sphere $S^3$ (or equivalently, the group manifold $SU(2)$). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dynamics of these systems depend in addition on the angular momenta of the configuration space coordinates, whose values are not confined. Thus, for the case of the pendulum, the phase space (spanned by coordinates and angular momenta) is the two-dimensional cylindrical manifold $S^1 \times \mathbb{R}$ and in the rigid body case $S^3 \times \mathbb{R}^3$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once, an appropriate Hamiltonian function on the phase space is defined, there are quantization rules which allow writing the Schrödinger equation to treat the system quantum mechanically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The cylindrical phase space quantum rotor is especially relevant to quantum computation as it enters in the description of the condensate dynamics of Josephson junction arrays which can be used to implement superconducting qubits; Please see the following &lt;a href=&quot;https://arxiv.org/abs/cond-mat/0411174&quot; rel=&quot;nofollow noreferrer&quot;&gt;review &lt;/a&gt; by: Devoret, Wallraff and Martinis. In this case a generic Hamiltonian (of a single isolated qubit) has the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$H = \frac{E_C}{2} (n – n_0)^2 + \frac{E_J}{2} \cos\theta$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $E_C$ is the charging energy and $E_J$ is the total junction energy and, $n$ is the number of Cooper pairs and $n_0$ is an offset proportional to the junction residual charge and:&#xA;$$\theta = 2 \pi \frac{\Phi}{\Phi_0} \mod 2 \pi$$&#xA;is the phase across the junction ($\Phi$ is the magnetic flux, and $\Phi_0$ is the flux quantum), and most importantly is that the cooper pair number is conjugate to the phase:&#xA;$$n = \frac{1}{E_C}\frac{\partial \theta }{\partial t }$$&#xA;This is a consequence of Faraday's law. (Thus this model is defined on a cylindrical phase space since the angular momentum is proportional to the angular velocity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After quantization, the Cooper pair number operator is replaced by:&#xA;$$\hat{n} =i \hbar \frac{\partial }{\partial \theta }$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Schrödinger equation can be solved exactly in terms of Mathieu functions. However, the qubit dynamics can be obtained if we restrict the dynamics to the two lowest eigenfunctions of the number operator $|0\rangle$ and $|1\rangle$, in this case, the kinetic and the potential terms of the Hamiltonian can be   &lt;a href=&quot;http://iramis.cea.fr/spec/Pres/Quantro/Qsite/publi/articles/fichiers/preprints/98-PScripta-Bouchiat-SSbox.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;approximated&lt;/a&gt; for $n_0 = \frac{1}{2}$ as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$ E_C (n – n_0)^2  \approx E_C \sigma_z$$&#xA;And:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$E_J cos\theta \approx E_J \sigma_x$$&#xA;Thus, the quantum Hamiltonian restricted to the lowest two-dimensional number subspace:&#xA;$$\hat{H} = \frac{E_J}{2}(\sigma_x + \frac{E_C}{E_J} \sigma_z)$$&#xA;and we can use the ratio $\frac{E_C}{E_J}$ to control the quantum evolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remarks: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the authors of the main references given above don't use the name quantum rotors in relation to qubits, other authors do, for example: &lt;a href=&quot;https://arxiv.org/abs/0912.3902v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Girvin, Devoret, and  Schoelkopf&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A description of the cylindrical phase and other phase spaces from the point of view of quantum computation can be found in: &lt;a href=&quot;https://arxiv.org/abs/1709.04460&quot; rel=&quot;nofollow noreferrer&quot;&gt;Albert,. Pascazio and Devoret&lt;/a&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of an application of three dimensional rotors to quantum computation, they especially appear in quantum models of molecules.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-08-15T16:08:37.603" LastActivityDate="2018-08-15T16:08:37.603" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4039" PostTypeId="2" ParentId="4033" CreationDate="2018-08-15T20:50:23.743" Score="-1" Body="&lt;p&gt;A simple formula for the number of qubits you can simulate in almost all programs is given by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3862/2293&quot;&gt;this very well received answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After re-arranging the formula given there into a form that's much more relevant to your specific question, and changing 48 to 32 since Q# is written in C++, not python, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;N_{\rm{qubits}} =  \log_2\left( \frac{\rm{RAM}}{32} \right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When $\rm{RAM} = 32\rm{GB} = 32\times 1024^3$, this formula gives 30, meaning you an simulate 30 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you plug the amount of RAM you have, into that formula, it will give a good estimate of how many qubits you can simulate without using a more sophisticated simulator. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-08-15T23:43:47.773" LastActivityDate="2018-08-15T23:43:47.773" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4040" PostTypeId="2" ParentId="4033" CreationDate="2018-08-15T22:37:53.137" Score="2" Body="&lt;p&gt;The simple rule is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Doubling the memory gives you one additional qubit.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So if Microsoft says that &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;16GB -&amp;gt; 30 qubits&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; 8GB -&amp;gt; 29 qubits&#xA; 4GB -&amp;gt; 28 qubits&#xA; 2GB -&amp;gt; 27 qubits&#xA; ...&#xA;32GB -&amp;gt; 31 qubits&#xA;64GB -&amp;gt; 32 qubits&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and so further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This scaling, as well as the number quoted by Microsoft, can be understood from an argument as the one in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3862/2293&quot;&gt;linked answer&lt;/a&gt;, using that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;each complex number equals 2 real numbers with double precision (8 bytes each), so 16 bytes are needed per comples number,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;to describe $N$ qubits, $2^N$ numbers are needed,&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;and 1GB=$1024^3$ bytes&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;which together yields $16\cdot 2^N = x \, \mathrm{GB} = x\cdot 1024^3$ with $x$ the memory required in GB, which results in &#xA;$$&#xA;N = \log_2(x\,\times 1024^3/16) = \log_2(x)+26\ .&#xA;$$&#xA;For $x=16$ (i.e. 16GB of memory), $\log_2(16)=4$, and this yields exactly &#xA;$$&#xA;N=30 \ \mathrm{qubits}\ ,&#xA;$$&#xA;which is the number quoted by Microsoft.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-08-15T22:37:53.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4042" PostTypeId="1" AcceptedAnswerId="4044" CreationDate="2018-08-16T11:12:57.027" Score="9" ViewCount="414" Body="&lt;p&gt;In the literature on QECC, Clifford gates occupy an elevated status.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following examples which attest to this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;When you study stabilizer codes, you separately study how to perform encoded Clifford gates (even if these aren't applicable transversally). All introductory material on QECC emphasize on performing encoded Clifford operations on quantum codes. And otherwise too, emphasize on Clifford gates (i.e., even when not performing encoded Clifford gates in quantum codes).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The entire topic of magic state distillation* is based on the classification of certain operations (including the performance of Clifford gates) as low-cost operations, while, for instance, performing the toffoli-gate or the $\pi/8$-gate, as higher-cost operations. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Possible answers:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;This has been justified in certain places in the literature ,for e.g., Gottesman's PhD dissertation and many papers by him, and also in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403025&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0403025&lt;/a&gt;. The reason given in these places is that it is possible to perform some Clifford gates transversally (a prototypical Fault-tolerant operation) on certain stabilizer codes. On the other hand, it is not easy to find a transversal application of non-Clifford gates on quantum codes. I haven't verified this myself, but am just going by statements which Gottesman makes in his PhD. dissertation and some review articles. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Not being able to perform an encoded gate transversally on a quantum code immediately increases the cost of performing said gate on the code. And hence performing Clifford gates goes into the low-cost category, while non-Clifford gates goes into the high-cost category.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;From an engineering perspective, it is important to decide on a standardized list of basic units of quantum computation (state preparation, gates, measurement-observables/basis), etc. Performing Clifford gates makes for a convenient choice on that list because of multiple reasons (most well-known sets of universal quantum gates include many Clifford gates in them ,Gottesman-Knill theorem**, etc).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;These are the only two reasons I could think of for why the Clifford group has such an elevated status in the study of QECC (particularly when you're studying stabilizer codes). Both reasons stem from an engineering perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is can one identify other reasons, which don't stem from an engineering perspective? Is there some other major role that the Clifford gates play, which I've missed out? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible other reason: I know that the Clifford group is the normaliser of the Pauli group in the Unitary group (on $n$ qubit systems). Also, that it has a &lt;a href=&quot;https://mathoverflow.net/questions/84388/presentation-of-the-clifford-group-by-generators-and-relations&quot;&gt;semidirect product structure&lt;/a&gt; (actually a projective representation of of semidirect product group). Does these relations/properties by themselves give another reason &lt;em&gt;why&lt;/em&gt; one ought to study the Clifford group in association with Stabilizer codes? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;*Feel free to correct this. &#xA;**Which states that restricted to certain operations, you can't obtain the quantum advantage, and hence you need a little-bit more than the set of operations you initially restricted yourself to. &lt;/p&gt;&#xA;" OwnerUserId="4353" LastEditorUserId="4353" LastEditDate="2018-08-16T14:58:35.960" LastActivityDate="2018-08-20T06:50:36.847" Title="Significance of Clifford operations from quantum error correction perspective" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4043" PostTypeId="2" ParentId="1826" CreationDate="2018-08-16T18:01:21.313" Score="2" Body="&lt;p&gt;TL;DR: The efficiency is 2/9, not 25%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Ekert 91 protocol involves many rounds. In each round, Alice and Bob share a Bell pair&#xA;$$&#xA;(|00\rangle+|11\rangle)/\sqrt{2}&#xA;$$&#xA;They both choose randomly which of 3 measurements to make. Alice chooses between the measurement bases $Z$, $(X+Z)/\sqrt{2}$ and $X$. Bob chooses between $(X+Z)/\sqrt{2}$, $X$ and $(X-Z)/\sqrt{2}$. They make their measurements, and get $\pm 1$ answers. They record both the measurement settings and the answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Later, they announce in public what measurement bases they used, but not the answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the scenario of no eavesdropping, and no errors, Alice and Bob are guaranteed to get identical measurement results whenever they measure in the same basis, and each such outcome gives one shared secret bit. If Alice and Bob chose different measurement bases, they announce the outcomes that they got and use them in a CHSH test to detect eavesdropping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How often do they get a secret bit out in this scenario? If we assume that all measurement bases are equally likely, then there are 9 possible combinations for Alice's and Bob's choices. Of these, two are matching pairs. Hence, the efficiency if 2/9.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-17T10:33:02.813" LastActivityDate="2018-08-17T10:33:02.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4044" PostTypeId="2" ParentId="4042" CreationDate="2018-08-16T20:45:22.740" Score="3" Body="&lt;p&gt;Clifford operations are often easy to do fault-tolerantly in stabilizer codes, either transversally or by code deformation. The reason is exactly as you thought: the special relationship between these gates and the Paulis, since the latter are used to define stabilizer codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to get non-Clifford gates in codes, but a price must be paid. Specifically, there is a relationship between the geometric locality of codes and the gates they can do transversally. So if you are allowed to do only nearest neighbour controlled gates on a 2D lattice (such as a surface or Color code) only Cliffords will be possible. See papers like this one for more on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that we can expect fault-tolerant Cliffords from stabilizer codes has subsequently been put at the heart of techniques to synthesize universal gate sets. So if there’s a way to create a non-stabilizer encoded state in a non-fault-tolerant way, we know how to clean it up using our logical Clifford’s. To turn these states into rotations, we use our logical Cliffords. So if you have a code and want to apply all these off-the-shelf results, you’d better find your fault-tolerant Cliffords. Or at least the Paulis, H and a CZ or CNOT if you can’t manage them all.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-08-20T06:50:36.847" LastActivityDate="2018-08-20T06:50:36.847" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4046" PostTypeId="1" AcceptedAnswerId="4052" CreationDate="2018-08-17T15:32:26.547" Score="6" ViewCount="444" Body="&lt;p&gt;Can we process infinite matrices with a quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If then, how can we do that?&lt;/p&gt;&#xA;" OwnerUserId="877" LastEditorUserId="877" LastEditDate="2018-08-23T23:42:07.870" LastActivityDate="2018-08-23T23:42:07.870" Title="Can we process infinite matrices with a quantum computer?" Tags="&lt;matrix-representation&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4047" PostTypeId="1" CreationDate="2018-08-17T17:26:47.417" Score="9" ViewCount="325" Body="&lt;p&gt;I want to preface with a disclaimer that I am a physicist with minimal knowledge of computer hardware. I have a solid understanding of quantum information from a theoretical standpoint but zero knowledge of how it is implemented. Here goes...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a company boasts that there newest chip has $X$ qubits, what exactly does that mean? Should I think of $X$ as being analogous with 32 or 64 bits on a conventional processor, meaning that the quantum computer can hold and process data types of size $X$? Or is $X$ something physical, like the number of Josephson junctions on the chip? should I think of $X$ as being equivalent to the number of transistors on a conventional processor? The benchmark of a conventional microprocessor is the number of transistors, so it is tempting to make the equivalence between transistor and qubit but I don't think that is correct because qubit is a unit of information and a transistor is a hardware thing. And furthermore I would not understand how quantum supremacy could be achieved with only ~50 qubits when conventional processors have billions of transistors. It just seems strange to say that a chip has $X$ 'qubits', because from a theoretical standpoint a qubit is information and not hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am realizing that my confusion boils down to &lt;em&gt;memory&lt;/em&gt; vs &lt;em&gt;processing power&lt;/em&gt;. I get that in order to &lt;em&gt;store&lt;/em&gt; $2^X$ states, I would need $X$ physical qubits (Josephson junctions, spin states, etc). But then where does the processing power come from? On a conventional chip, you have registers to &lt;em&gt;store&lt;/em&gt; the information to be processed, but then a ton of transistors to perform the computation. My question is how this processing power is measured in a quantum computer? Do the number of quantum gates on the chip really not matter as much as the number of qubits they are capable of operating on?&lt;/p&gt;&#xA;" OwnerUserId="4367" LastEditorUserId="26" LastEditDate="2018-12-23T13:12:52.847" LastActivityDate="2018-12-23T13:12:52.847" Title="What does it mean for a quantum computer to have $X$ qubits?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4048" PostTypeId="2" ParentId="4047" CreationDate="2018-08-17T17:42:56.123" Score="2" Body="&lt;p&gt;Take the tables attached in the Wikipedia article here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/List_of_quantum_processors&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as a starting point.  The &quot;Gate model QPU's&quot; are more likely to be Turing-complete than the &quot;Annealing QPU's.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For companies that claim $X$ qubits, they mean they have they have the capability to operate, quantum mechanically, on $2^X$ states, and they are physically implemented qubits, e.g. $X$ Josephson junctions, etc., much like an individual bit on DRAM on a classical computer is physically implemented (with a capacitor and a transistor.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in a sense, the number of qubits &lt;em&gt;is&lt;/em&gt; roughly analogous to the amount of hardware.  We can only &lt;em&gt;read out&lt;/em&gt; $X$ qubits, but we can &lt;em&gt;operate on&lt;/em&gt; up to $2^X$ states.  Your analogy is actually not that bad of an analogy, it's merely the quantum-mechanical weirdness that's hard to get over.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2018-08-17T17:42:56.123" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4049" PostTypeId="2" ParentId="4047" CreationDate="2018-08-17T17:51:48.827" Score="0" Body="&lt;p&gt;I would say they have individual physical systems (represented by one qubit mathematically) that they interconnect together in some fashion way (so that is why we talk about connectivity). Physical systems can be two different polarization of a photon, or as two states of an electron... But there are multiple ways to have such systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now quantum supremacy is a really bad word.&#xA;So the idea is that the biggest number of qubits simulated on classical computers was around 50 qubits. So having a physical realization with a superior size would be considered as a &quot;hope&quot; for quantum computers to &quot;beat&quot;&#xA;classical ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good explanation video about it can be found &lt;a href=&quot;https://www.youtube.com/watch?v=90U_SmKyfGI&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-08-17T17:51:48.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4052" PostTypeId="2" ParentId="4046" CreationDate="2018-08-18T13:53:43.920" Score="4" Body="&lt;p&gt;If instead of manipulating the quantum information in qubits, your quantum computer were to do operations on qu$d$its with $d$ being infinity, then you'd essentially be processing infinite matrices on a quantum computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However most quantum computing hardware we have today, and even most of the experiments being done in academic labs, do operations on qubits (such as spin-1/2 nuclei), rather than on qu$d$its with an infinite value for $d$ (such as a quantum harmonic oscillator). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is theoretically possible to do quantum gates on qu$d$its with infinite $d$, which would be processing infinite matrices, but it is not done in practice. It is hard enough to make quantum computers with ~100 qubits (which would still be processing only finite-dimensional matrices). &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-18T13:53:43.920" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4053" PostTypeId="1" AcceptedAnswerId="4055" CreationDate="2018-08-19T08:44:02.790" Score="8" ViewCount="437" Body="&lt;p&gt;I've just started to mess about with QISKit on Python and one thing is confusing me a fair bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that we are building Quantum Circuits what is the need for a classical register ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it because the collapsed state must be classical ?&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="26" LastEditDate="2018-12-13T20:03:34.077" LastActivityDate="2018-12-13T20:03:34.077" Title="Why do we need a Classical Register for carrying out Quantum Computations?" Tags="&lt;circuit-construction&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4054" PostTypeId="2" ParentId="4053" CreationDate="2018-08-19T14:21:07.220" Score="4" Body="&lt;p&gt;Quantum computations depend on classical control: A classical computer, driven by a classical algorithm, suffices to apply the quantum gates in sequence. In some algorithms (such as quantum teleportation), the gate to be applied depends on an earlier measurement result. Hence a store for measurement results (and, possibly, calculations using it) is helpful and needed in general.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-08-19T14:21:07.220" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4055" PostTypeId="2" ParentId="4053" CreationDate="2018-08-19T18:44:08.660" Score="3" Body="&lt;p&gt;Once we measure a qubit, we get some classical information out. This is something we need to keep track of. We need it to look at the outputs of our computations, or use them as part of classical control within an algorithm. For that reason, it can be useful to have a specific object in a quantum SDK that keeps track of this classical information, and does so in a way that parallels how qubits are dealt with. This is the approach taken by QISKit.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-08-19T18:44:08.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4056" PostTypeId="2" ParentId="4047" CreationDate="2018-08-19T19:02:15.233" Score="2" Body="&lt;p&gt;When we take about hardware specs for classical computers, we are getting some information about the kind of things we can do with the device. For a circuit based quantum computer, the relevant number is how many fault-tolerant qubits we have. We can then computer this to the required qubit number for given instances of our favourite algorithm and see what that means in terms of factoring numbers, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, the number of fault-tolerant qubits is zero. We are instead in an era of noisy prototype devices. They are for testing, and what is possible depends strongly on how noisy the gates are and the connectivity (which pairs of qubits can we do a controlled gate with). If a company/lab does not give you information, there is no way to compare with what other companies/labs are doing (and all are currently a few orders of magnitude away from having enough noisy qubits to make a truly fault-tolerant qubit).&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-08-19T19:02:15.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4057" PostTypeId="1" AcceptedAnswerId="4058" CreationDate="2018-08-20T10:28:38.550" Score="10" ViewCount="1949" Body="&lt;p&gt;As a part of a discussion with my 'classical' friend, he insisted that making a a state machine for calculating the outcome of quantum computer is possible; so, simply calculate the outcomes of (known) algorithms on supercomputers and store their results in a Look-up table. (Something like storing the truth table).&lt;br&gt;&lt;br&gt;&#xA;So, why do people work on quantum simulators (say, capable up to 40 qubits); which calculate the result every time?! Simply (hypothetically) use the supercomputers of the world (say capable up to 60 qubits); calculate the result for $2^{60}$ input cases, store their result and use it as reference? How can I convince him it's not possible?&lt;br&gt;&lt;br&gt;&#xA;&lt;b&gt;Note:&lt;/b&gt; this is for known quantum algorithms and their known circuit implementations.&lt;/p&gt;&#xA;" OwnerUserId="2391" LastEditorUserId="26" LastEditDate="2018-12-13T20:04:11.250" LastActivityDate="2018-12-13T20:04:11.250" Title="Classical Memory enough to store states up to 40 qubits quantum system?" Tags="&lt;algorithm&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4058" PostTypeId="2" ParentId="4057" CreationDate="2018-08-20T11:33:51.827" Score="14" Body="&lt;p&gt;Suppose that you have a quantum algorithm with $2^{60}$ possible inputs. Suppose also that it would take 1 nanosecond to run this on a supercomputer (which is unrealistically optimistic!). The total time required to run through all possible inputs would be 36.5 years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly it would be much better to just run the instance that you care about, and get the answer in an instant, rather than waiting half a lifetime to pick it from a list. This gets ever more true as we raise the runtime from the unrealistic 1 nanosecond.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;why do people work on quantum simulators (say, capable up to 40 qubits); which calculate the result every time?! &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Even if you wanted to create a lookup table, you'd still need a simulator like this to create it.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-08-20T11:33:51.827" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4059" PostTypeId="1" AcceptedAnswerId="4061" CreationDate="2018-08-21T08:13:06.777" Score="8" ViewCount="266" Body="&lt;p&gt;Take two pure bi-partite states $\psi$ and $\phi$ that have the same amount of entanglement in them as quantified by concurrence (does the measure make a difference?). Can any such states be transformed into each other using local unitaries?&lt;/p&gt;&#xA;" OwnerUserId="1860" LastEditorUserId="10480" LastEditDate="2021-01-27T16:08:45.873" LastActivityDate="2021-01-27T17:04:26.733" Title="Can two states with the same entanglement be transformed into each other using local unitaries?" Tags="&lt;entanglement&gt;&lt;concurrence&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4060" PostTypeId="2" ParentId="1826" CreationDate="2018-08-21T09:31:13.243" Score="5" Body="&lt;p&gt;I emailed Artur Ekert to seek help for this quesiton, and he replied:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are different variants of the E91 protocol that may give&#xA;  you different efficiencies. In my original version the settings used for&#xA;  the keys bits were indeed chosen with the probability 2/9, but others&#xA;  optimised it in all kind of ways.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So at least 2/9 is the probability of the original E91 protocol, and for those who want to know the calculation for the original protocol, please refer to DaftWullie's answer which I think is correct. But as I'm not professional in this area, I'm not sure that the calculation in Cabello's paper is a mistake or he just calculated some optimized version.&lt;/p&gt;&#xA;" OwnerUserId="2047" LastActivityDate="2018-08-21T09:31:13.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4061" PostTypeId="2" ParentId="4059" CreationDate="2018-08-21T10:53:41.437" Score="7" Body="&lt;p&gt;Any two bipartite &lt;em&gt;pure&lt;/em&gt; states &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; can be transformed into each other with local unitaries if and only if they have the same &lt;a href=&quot;https://en.wikipedia.org/wiki/Schmidt_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schmidt coefficients&lt;/a&gt;. (To prove the 'only if' part, note that the reduced density matrix of either qubit has eigenvalues that are the squares of the Schmidt coefficients, and are unchanged by unitaries).&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Concurrence_(quantum_computing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;concurrence&lt;/a&gt; is typically specified for two-qubit states. Any reasonable entanglement monotone on two qubits, when calculated for pure states, must be a decreasing function of the largest Schmidt coefficient of the state, and thus two states having the same entanglement would have the same Schmidt coefficients, and hence be unitarily equivalent.&lt;/p&gt;&#xA;&lt;p&gt;If you generalise beyond qubits, there will be entanglement measures that do not contain as much fine-grained information as the Schmidt coefficients, and so equality of that entanglement measure will be necessary but not sufficient for unitary equivalence.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="10480" LastEditDate="2021-01-27T17:04:26.733" LastActivityDate="2021-01-27T17:04:26.733" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4062" PostTypeId="2" ParentId="4057" CreationDate="2018-08-21T11:05:07.183" Score="3" Body="&lt;p&gt;For a specific quantum algorithm that uses 40 qubits, your friend makes a good point. One can just calculate the truth table (one might find this hard, but assume that one can) and use it as reference. Of course this starts to get ridiculous as you increase the number of qubits, not just because of the number of inputs but because computing the outcome of a quantum algorithm could be exponentially harder classically for all we know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, being able to simulate a quantum computer (or having an actual quantum computer) is far more useful. By changing what quantum operations one does, one gets different algorithms. The number of functions that one can define on 40 bits of inputs is 2^2^40. Having a single database that gives you instant access to the results of any quantum algorithm is just absurdly infeasible. We want to be able to switch algorithms easily too, and classically we'd want simulators for that.&lt;/p&gt;&#xA;" OwnerUserId="4394" LastActivityDate="2018-08-21T11:05:07.183" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4063" PostTypeId="1" CreationDate="2018-08-21T14:43:47.137" Score="5" ViewCount="157" Body="&lt;p&gt;I would like to understand what is a continuous quantum register.&#xA;I know the direct definition is a quantum register that stores a real number defined by an observable with a spectrum consisting of $\mathbb{R}$ but that seems really abstract to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also how it relates to qubits? Is a set of qubits used for simulating discretely a continuous quantum register? If yes how?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-12-23T12:41:35.387" LastActivityDate="2018-12-23T12:41:35.387" Title="What is continuous quantum register and how it relates to qubits?" Tags="&lt;physical-qubit&gt;&lt;models&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4064" PostTypeId="1" AcceptedAnswerId="4065" CreationDate="2018-08-21T15:48:28.743" Score="4" ViewCount="106" Body="&lt;p&gt;In their &lt;a href=&quot;https://epubs.siam.org/doi/10.1137/16M1087072&quot; rel=&quot;nofollow noreferrer&quot;&gt;2017 paper&lt;/a&gt;, Childs &lt;em&gt;et al.&lt;/em&gt; gave the definition of QLSP beginning with : &quot;Let $A$ be an $N\times N$ Hermitian matrix with known condition numbers $\kappa$, $||A|| = 1$ and at most $d$ non-zero entries in any row or column...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I initially thought that by $||A|| = 1$ they meant that QLSP requires spectral norm (largest eigenvalue) of $A$ to be $1$, which sounds reasonable to me as even the original HHL paper they needed the eigenvalues of $A$ to lie in between $1/\kappa$ and $1$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, the paper: &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum linear systems algorithms: a primer&lt;/a&gt; seems to have interpreted is as &quot;the determinant of $A$ needs to be $1$&quot; in page 28 definition 6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which interpretation is correct and why? In case the latter is correct, I'm not sure why it is so. I don't see why the restriction that $\text{det}(A)$ needs to be $1$ even make sense. It (the unit determinant condition) doesn't even guarantee that the eigenvalues of $A$ will be less than or equal to $1$, which is necessary for HHL to work. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-08-21T16:04:07.240" Title="What does $||A|| = 1$ mean in the definition of QLSP?" Tags="&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4065" PostTypeId="2" ParentId="4064" CreationDate="2018-08-21T16:04:07.240" Score="4" Body="&lt;p&gt;Certainly it is meant as the largest eigenvalue. I have no idea why the linked review paper uses the determinant. I don't see anywhere that they use that property (from an admittedly brief skim).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume you &lt;em&gt;could&lt;/em&gt; rewrite conditions in terms of the determinant (you would have to alter the time step $t_0$) but it's not clear to me why you would want to. It's also worth noting that definition 8 (page 39) in that paper defines matrix inversion, putting limits on the eigenvalues of the matrix: bounding between some minimum value and 1. So they're also implicitly acknowledging that structure, and certainly not setting the determinant (product of eigenvalues) to 1.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-21T16:04:07.240" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4066" PostTypeId="1" AcceptedAnswerId="4073" CreationDate="2018-08-21T16:17:27.053" Score="5" ViewCount="1006" Body="&lt;p&gt;What would be the best way to re-create the following image of the HHL quantum circuit &lt;em&gt;without compromising on image quality&lt;/em&gt; (the image is from this &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;noreferrer&quot;&gt;review paper&lt;/a&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pMSHL.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pMSHL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://www.media.mit.edu/quanta/qasm2circ/&quot; rel=&quot;noreferrer&quot;&gt;qasm2circ&lt;/a&gt; I can create the basic circuit. But I don't know any good program/software which will help to produce the labels of the various components and also the nice transparent boxes emphasizing the 3 main steps.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;FWIW, I had contacted the corresponding author last week asking about the software they used to generate the image (and also whether the image has any associated copyright license), but haven't received any response so far, which is why I am asking here.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-09-07T13:09:06.473" Title="How to re-create the following circuit image?" Tags="&lt;resource-request&gt;&lt;circuit-construction&gt;&lt;qasm2circ&gt;" AnswerCount="4" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4067" PostTypeId="2" ParentId="4066" CreationDate="2018-08-21T16:30:03.063" Score="4" Body="&lt;p&gt;I know there is the Latex package &#xA;&lt;a href=&quot;https://docs.google.com/viewer?url=http%3A%2F%2Fphysics.unm.edu%2FCQuIC%2FQcircuit%2FQtutorial.pdf&amp;amp;embedded=true&amp;amp;chrome=false&amp;amp;dov=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;qcircuit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am not sure about how they did the boxes for the 3 parts a,b,c. &#xA;Maybe some image tool for drawing them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit : Found this discussion where one admitted using Tikz &lt;a href=&quot;https://tex.stackexchange.com/questions/9767/whats-a-good-package-for-typesetting-quantum-circuits&quot;&gt;for drawing similar images&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 2 : I found this little tool called &lt;a href=&quot;https://github.com/qpic/qpic&quot; rel=&quot;nofollow noreferrer&quot;&gt;qpic&lt;/a&gt; which can help you build fancy quantum circuits. You will be able to do it easily I suppose.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-08-21T20:44:50.557" LastActivityDate="2018-08-21T20:44:50.557" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4068" PostTypeId="2" ParentId="4066" CreationDate="2018-08-21T18:18:50.537" Score="4" Body="&lt;p&gt;According to the meta-information in the PDF of the figure, it has been created with PowerPoint:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ pdfinfo HHL_circuit.pdf &#xA;Title:          HHL_circuit&#xA;Creator:        PowerPoint&#xA;Producer:       Mac OS X 10.13.2 Quartz PDFContext&#xA;[...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(You can download paper sources from the arxiv by choosing &quot;other formats&quot;.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-08-21T18:18:50.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4069" PostTypeId="1" AcceptedAnswerId="4071" CreationDate="2018-08-22T02:19:13.523" Score="13" ViewCount="533" Body="&lt;p&gt;I started reading about Randomized Benchmarking (&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.106.180504&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1009.3639&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv version&lt;/a&gt;) and came across &quot;unitary 2 design.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some googling, I found that the Clifford group being a unitary 2 design is a specific case of &quot;Quantum t-design.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_t-design&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page&lt;/a&gt; and a few other references (&lt;a href=&quot;https://www.cs.mcgill.ca/~akazna/AK_UnitaryDesigns20090929.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one for example,&lt;/a&gt; &lt;a href=&quot;https://www.cs.mcgill.ca/~akazna/&quot; rel=&quot;nofollow noreferrer&quot;&gt;non pdf link to the website that links to the pdf&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have some intuitive understanding of the difference between different t designs and what makes the clifford group 2 design. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I apologize in advance if the question is too basic.&lt;/p&gt;&#xA;" OwnerUserId="4399" LastEditorUserId="26" LastEditDate="2018-08-25T08:30:22.943" LastActivityDate="2018-08-25T08:30:22.943" Title="What is quantum t-design (intuitive understanding)?" Tags="&lt;error-correction&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4070" PostTypeId="2" ParentId="4066" CreationDate="2018-08-22T05:03:53.053" Score="7" Body="&lt;p&gt;I always used to use qcircuit but, as it happens, I've recently been developing a tikz library to do the job, which has some added flexibility. The package will be available at the following DOI: &lt;a href=&quot;http://dx.doi.org/10.17637/rh.7000520&quot; rel=&quot;nofollow noreferrer&quot;&gt;10.17637/rh.7000520&lt;/a&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0GKFy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0GKFy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I load my library in the document preamble&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\usetikzlibrary{quantikz}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I typeset the circuit with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\begin{tikzcd}&#xA;\lstick{Ancilla \ket{0}\\ register $S$} &amp;amp; \qw &amp;amp; \qw\gategroup[background,style={fill=gray!20,rounded corners},wires=3,steps=3]{Phase estimation} &amp;amp; \qw &amp;amp; \qw &amp;amp; \qw &amp;amp;  \gate{R}\gategroup[background,style={fill=gray!20,rounded corners},wires=3,steps=1]{$R(\tilde\lambda^{-1})$ rotation} &amp;amp; \qw &amp;amp; \qw\gategroup[background,style={fill=gray!20,rounded corners},wires=3,steps=3]{Uncompute}  &amp;amp; \qw &amp;amp; \qw &amp;amp; \meter{} &amp;amp; \rstick{\ket{1}} \qw \\&#xA;\lstick{Clock $\ket{0}^{\otimes n}$\\ register $C$}&amp;amp; \qwbundle &amp;amp; \gate{H^{\otimes n}} &amp;amp; \ctrl{1} &amp;amp; \gate{FT^\dagger} &amp;amp; \hphantomgate{}\qw &amp;amp; \ctrl{-1} &amp;amp; \hphantomgate{}\qw &amp;amp; \gate{FT} &amp;amp; \ctrl{1} &amp;amp; \gate{H^{\otimes n}} &amp;amp; \qw &amp;amp; \rstick{$\ket{0}^{\otimes n}$}\qw \\[1em]&#xA;\lstick{Input \ket{b} \\ register $I$}&amp;amp;\qwbundle&amp;amp; \qw&amp;amp;\gate{U}&amp;amp;\qw&amp;amp; \qw &amp;amp; \qw&amp;amp;\qw&amp;amp;\qw&amp;amp;\gate{U}&amp;amp;\qw&amp;amp;\qw &amp;amp;\rstick{\ket{x}}\qw&#xA;\end{tikzcd}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-23T09:48:00.447" LastActivityDate="2018-08-23T09:48:00.447" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4071" PostTypeId="2" ParentId="4069" CreationDate="2018-08-22T05:45:26.613" Score="7" Body="&lt;p&gt;The $t$ in $t$-design is essentially a measure of how good a job the set of gates does in terms of randomising a state (the larger t, the more random, with properly random requiring the infinite limit). Often, you want to compute the average of some function over all possible pure input states, which is equivalent to fixing the input state and averaging over all possible unitaries. However, averaging over all possible unitaries is a pain, and is unnecessary if the function you want to compute is simple enough. If the function you want is a polynomial of degree t or less in terms of the coefficients of the input state, it is sufficient to average over a set of gates that comprise a t-design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of thinking about this is, instead of a degree t polynomial, you can talk about calculating a linear function of t copies of the input state. This is more like you would do in an actual experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for what makes the Clifford group a 2-design, I guess you just have to sit down and do the maths. Let S be the set of 1-qubit Clifford gates. Then you need to show that&#xA;$$&#xA;\sum_{s\in S}s\otimes s|00\rangle\langle 00|s\otimes s\propto\mathbb{I}&#xA;$$&#xA;The critical thing here is that there’s 2 copies of the state that we’re averaging over.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-22T05:59:06.077" LastActivityDate="2018-08-22T05:59:06.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4072" PostTypeId="1" AcceptedAnswerId="4076" CreationDate="2018-08-22T07:47:56.467" Score="4" ViewCount="158" Body="&lt;p&gt;This is the QCSE version of &lt;a href=&quot;https://academia.stackexchange.com/questions/18911/what-should-you-do-if-you-spotted-a-non-trivial-error-in-a-highly-cited-paper&quot;&gt;What should you do if you spotted a non-trivial error in a highly cited paper?&lt;/a&gt; (maybe replace &quot;highly cited&quot; with &quot;moderately cited&quot; and &quot;a non-trivial&quot; with &quot;several minor&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While going through the &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;pre-print v2&lt;/a&gt; as well as the &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2012.668289&quot; rel=&quot;nofollow noreferrer&quot;&gt;published version&lt;/a&gt; of the paper `Quantum Circuit Design for Solving Linear Systems of Equations' by Cao &lt;em&gt;et al.&lt;/em&gt;, I found several errors in the paper:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the published version the connections of the $e^{iAt/2^i}$ gates are connected to clock register in the wrong order (Figure 4). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the pre-print the gates $e^{-iAt/2^i}$ should actually have been $e^{iAt/2^i}$ (Figure 4).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the pre-print the gate decomposition of $e^{iAt/2^i}$ is wrong. The last $Z$ gate must have been a controlled $Z$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The $5$ coefficients of the gate decompositions are wrong in both the pre-print and published version. Only the coefficients given for $e^{iAt/16}$ are fine but the rest they have to be found by some method of multivariable optimization (this was &lt;a href=&quot;https://github.com/nelimee/quantum-tools/blob/master/HHL/4x4_system.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;implemented&lt;/a&gt; by @Nelimee in QISKit and I had verified it)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;No SWAP gate is required in the circuit, as explained by @DaftWullie &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2725/26&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They skipped most explanations of &lt;em&gt;why&lt;/em&gt; they chose the specific form of matrix $A$ in the paper, and everything about the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2605/26&quot;&gt;scaling required&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Anyhow, this paper was essentially what I worked on, through the summer and I need to write a report on what I did, which might be put up on arXiv (and maybe for publishing, probably in &lt;a href=&quot;https://link.springer.com/journal/11128&quot; rel=&quot;nofollow noreferrer&quot;&gt;QIP&lt;/a&gt;, later on, if I can think of sufficiently original material).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I'm not sure how the quantum computing academic community looks at these type of &quot;correction papers&quot;. So, basically, is it ethical to write up a correction paper like this (which doesn't correct a &quot;huge&quot; mistake in a &quot;highly cited&quot; paper but rather several small mistakes in a &quot;moderately cited&quot; paper) or are they highly frowned upon?  In case the latter is true, I'll probably avoid putting it up on arXiv and wait till I can come up with sufficiently original additions to the paper (like extending it to higher dimensions and making the circuit more general).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-08-22T08:19:18.813" LastActivityDate="2018-08-22T18:04:21.613" Title="Ethics: Publishing a corrected version of a moderately cited paper having several minor errors" Tags="&lt;research&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4073" PostTypeId="2" ParentId="4066" CreationDate="2018-08-22T15:48:07.367" Score="11" Body="&lt;h2&gt;Edit &amp;mdash;&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I've revised this answer to make some small improvements in the commands, to tidy up the commands for drawing the wires for instance, because it seemed worthwhile. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Flattering as it is to have this answer be the accepted one for the time being, I think I should point out that the &lt;a href=&quot;http://dx.doi.org/10.17637/rh.7000520&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;quantikz&lt;/code&gt;&lt;/a&gt; package (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4070/124&quot;&gt;Daftwullie's answer&lt;/a&gt; below) and the &lt;a href=&quot;https://github.com/qpic/qpic&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;qpic&lt;/code&gt;&lt;/a&gt; package (as pointed out in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4067/124&quot;&gt;cnada's answer&lt;/a&gt; below) are both libraries with reasonably complete interfaces, and so better for people looking for a quick and simple solution. The code below is probably more suitable for people who are comfortable with TiKZ, and might like to tweak their circuit diagrams with TiKZ commands, but who wouldn't mind having some macros to streamline drawing their diagrams. &amp;mdash; Nice as it might be to, for the moment I have no ambition to write a LaTeX package to make these macros available with a nice interface for all purposes (but anyone else who would like to is welcome if they give me some of the credit).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;Snippet&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;See below for all of the code used to generate this example: the following commands are just the ones used to draw the circuit itself. (This snippet involves macros which I have defined for the purpose of this post, which I also define below.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  % define initial positions of the quantum wires&#xA;  \xdef\dy{1.25}&#xA;  \defwire (A) at (0);&#xA;  \defwire (B) at ({-\dy});&#xA;  \defwire (C) at ({-2*\dy});&#xA;  % draw wires&#xA;  \xdef\dt{0.8}&#xA;  \drawwires [\dt] (15);&#xA;  \node  at ($(B-0)!0.5!(B-1)$) {$/$};&#xA;  \node  at ($(C-0)!0.5!(C-1)$) {$/$};&#xA;  % draw gates&#xA;  \gate     (B-2)         [H^{\otimes n}];&#xA;  \ctrlgate (B-3) (C-3)   [U];&#xA;  \virtgate (A-3);&#xA;  \gate     (B-4)         [\mathit{FT}^\dagger];&#xA;  \ctrlgate (B-7) (A-7)   [R];&#xA;  \virtgate (C-7);&#xA;  \gate     (B-10)        [\mathit{FT}];&#xA;  \ctrlgate (B-11) (C-11) [U^\dagger];&#xA;  \gate     (B-12)        [H^{\otimes n}];&#xA;  \virtgate (A-12);&#xA;  \meas     (A-14)        [Z];&#xA;  % draw input and output labels&#xA;  \inputlabel  (A-0)  [\lvert 0 \rangle];&#xA;  \inputlabel  (B-0)  [\lvert 0 \rangle^{\otimes n}];&#xA;  \inputlabel  (C-0)  [\lvert b \rangle];&#xA;  \outputlabel (A-15) [\lvert 1 \rangle];&#xA;  \outputlabel (B-15) [\lvert 0 \rangle^{\otimes n}];&#xA;  \outputlabel (C-15) [\lvert x \rangle];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Result&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X9zIL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X9zIL.png&quot; alt=&quot;Circuit diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Preamble&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You will need a pre-amble which contains at least the &lt;code&gt;amsmath&lt;/code&gt; package, as well as the &lt;code&gt;tikz&lt;/code&gt; package. You may not need all of the &lt;code&gt;tikz&lt;/code&gt; libraries below, but they don't hurt. Be sure to include the commands involving layers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\documentclass[a4paper,10pt]{article}&#xA;&#xA;\usepackage{amsmath}&#xA;\usepackage{tikz}&#xA;\usetikzlibrary{shapes,arrows,calc,positioning,fit}&#xA;\pgfdeclarelayer{background}&#xA;\pgfsetlayers{background,main}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the purposes of this post, I've defined some ad-hoc macros to make reading the coded circuit easier for public consumption. (The macro format is not exactly good LaTeX practise, but I define them this way in order for the syntax to be more easily read and for it to stand out.) The parameters for dimensions in these gates were chosen to look good in your sample-circuit, and were found by trial-and-error: you can change them to change the appearance of your circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first is a simple macro to draw a gate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\gate (#1) [#2]{%&#xA;  \node [&#xA;    draw=black,fill=white, inner sep=0pt,&#xA;    minimum width=2.5em, minimum height=2em, outer sep=1ex&#xA;  ] (#1) at (#1) {$#2$}%&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The second is a macro to draw an 'invisible' gate. This is not really a command which is important for the circuit itself, but helps for the placement of background frames.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\virtgate (#1){%&#xA;  \node [&#xA;    draw=none, fill=none,&#xA;    minimum width=2.5em, minimum height=2em, outer sep=1ex&#xA;  ] (#1) at (#1) {};&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The third is a macro to draw a controlled gate. This command works well enough for your example circuit, but doesn't allow you to draw a CNOT. (Exercise for the reader proficient in TiKZ: make a &lt;code&gt;\CNOT&lt;/code&gt; command.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\ctrlgate (#1) (#2) [#3]{%&#xA;  \filldraw [black] (#1) circle (2pt) -- (#2);&#xA;  \gate (#2) [#3]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The fourth is a macro to draw a &quot;measurement&quot; box. I think it is perfectly reasonable to want to specify an explicit basis or observable for the measurement, so I allow an argument to specify that.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\meas (#1) [#2]{%&#xA;  \node [&#xA;    draw=black, fill=white, inner sep=2pt,&#xA;    label distance=-5mm, minimum height=2em, minimum width=2em&#xA;  ] (meas) at (#1) {};&#xA;  \draw ($(meas.south) + (-.75em,1.5mm)$) arc (150:30:.85em);&#xA;  \draw ($(meas.south) + (0,1mm)$) -- ++(.8em,1em);&#xA;  \node [&#xA;    anchor=north west, inner sep=1.5pt, font=\small&#xA;  ] at (meas.north west) {#2};&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I define two short macros to produce the labels for the inputs and outputs of wires.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\inputlabel (#1) [#2]{%&#xA;  \node at (#1) [anchor=east] {$#2$}&#xA;}&#xA;\def\outputlabel (#1) [#2]{%&#xA;  \node at (#1) [anchor=west] {$#2$}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The macros above are all looking for co-ordinates at which to place the gates. I also define macros to define &quot;wires&quot;, which have regularly spaced co-ordinates where gates can be located.&#xA;The first is a macro which allows you to define a named wire (such as &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt;, &lt;code&gt;x3&lt;/code&gt;, &lt;em&gt;etc.&lt;/em&gt;) and its vertical position in the circuit diagram (these diagrams are left-to-right by default, which you can change most easily using the &lt;code&gt;rotate&lt;/code&gt; option of the &lt;code&gt;tikzpicture&lt;/code&gt; environment.)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\defwire (#1) at (#2){%&#xA;  \ifx\qmwires\empty&#xA;    \edef\qmwires{#1}%&#xA;  \else&#xA;    \edef\qmwires{\qmwires,#1}%&#xA;  \fi&#xA;  \coordinate (#1-0) at ($(0,#2)$)%&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Having defined a collection of wires, the following command then draws all of them, starting from the same left-most starting point and ending at the same right-most ending point, with increments by a fixed amount (given in the square brackets) and for a given number of time slices. This defines a sequence of 'time-slice' co-ordinates for each wire: for a wire &lt;code&gt;A&lt;/code&gt;, it defines the co-ordinates &lt;code&gt;A-0&lt;/code&gt;, &lt;code&gt;A-1&lt;/code&gt;, and so forth up until &lt;code&gt;A-t&lt;/code&gt; (where &lt;code&gt;t&lt;/code&gt; is the value of the second argument).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\drawwires [#1] (#2);{%&#xA;  \xdef\u{0}&#xA;  \foreach \t in {0,...,#2} {%&#xA;    \foreach \l in \qmwires {%&#xA;      \coordinate (\l-\t) at ($(\l-\u) + (#1,0)$);&#xA;      \draw (\l-\u) -- (\l-\t);&#xA;    }&#xA;    \xdef\u{\t}&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The final macro is one to draw a background frame for different stages in your circuit. It takes an argument specifying which gates (including the invisible virtual 'gates') are meant to belong to the frame.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\def\bgframe [#1]{%&#xA;  \node [%&#xA;    draw=black, fill=yellow!40!gray!30!white, fit=#1&#xA;  ] {}%&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;The circuit diagram itself&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now to begin drawing your circuit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\begin{document}&#xA;\begin{tikzpicture}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We start by defining the relative positions of the wires. (For convenience, I do this using a macro to define the spacing between them, that I can quickly change to adjust the spacing.) Below, I define three wires: &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt;, and &lt;code&gt;C&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  \let\qmwires\empty&#xA;  % define initial positions of the quantum wires&#xA;  \xdef\dy{1.25}&#xA;  \defwire (A) at (0);&#xA;  \defwire (B) at ({-\dy});&#xA;  \defwire (C) at ({-2*\dy});&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We now draw the circuit, using the command to draw the wires and define the co-ordinates on the wire, and placing gates independently of one another according to those co-ordinates.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  % draw circuit&#xA;  \xdef\dt{0.8}&#xA;  \drawwires [\dt] (15);&#xA;  \node  at ($(B-0)!0.5!(B-1)$) {$/$};&#xA;  \node  at ($(C-0)!0.5!(C-1)$) {$/$};&#xA;  \gate     (B-2)         [H^{\otimes n}];&#xA;  \ctrlgate (B-3) (C-3)   [U];&#xA;  \virtgate (A-3);&#xA;  \gate     (B-4)         [\mathit{FT}^\dagger];&#xA;  \ctrlgate (B-7) (A-7)   [R];&#xA;  \virtgate (C-7);&#xA;  \gate     (B-10)        [\mathit{FT}];&#xA;  \ctrlgate (B-11) (C-11) [U^\dagger];&#xA;  \gate     (B-12)        [H^{\otimes n}];&#xA;  \virtgate (A-12);&#xA;  \meas     (A-14)        [Z];&#xA;  % draw input and output labels&#xA;  \inputlabel  (A-0)  [\lvert 0 \rangle];&#xA;  \inputlabel  (B-0)  [\lvert 0 \rangle^{\otimes n}];&#xA;  \inputlabel  (C-0)  [\lvert b \rangle];&#xA;  \outputlabel (A-15) [\lvert 1 \rangle];&#xA;  \outputlabel (B-15) [\lvert 0 \rangle^{\otimes n}];&#xA;  \outputlabel (C-15) [\lvert x \rangle];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Annotations for the circuit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The rest of the circuit diagram is literally commentary. We can do this using a combination of plain-old TiKZ nodes, and the &lt;code&gt;\bgframe&lt;/code&gt; macro which I defined above. (Annotations are a little less predictable, so I don't have a good way of making them as systematic as the earlier parts of the circuit, so general TiKZ commands are a reasonable approach unless you know how to make your annotations uniform.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First the annotations for the stages of the circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  % draw annotations&#xA;  \node [minimum height=4ex] (annotate-1) at ($(A-3) + (0,1)$)&#xA;        {\textit{Phase estimation}};&#xA;  \node [minimum height=4ex] (annotate-2) at ($(A-7) + (0,1)$)&#xA;        {\textit{$\smash{R(\tilde\lambda^{-1}})$ rotation}};&#xA;  \node [minimum height=4ex] (annotate-3) at ($(A-11) + (0,1)$)&#xA;        {\textit{Uncompute}};&#xA;  \node (annotate-a) at ($(C-3) + (0,-1.25)$)  {\textit{(a)}}; &#xA;  \node (annotate-b) at ($(C-7) + (0,-1.25)$)  {\textit{(b)}}; &#xA;  \node (annotate-c) at ($(C-11) + (0,-1.25)$) {\textit{(c)}};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Next, the annotations for the registers, at the input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  \node (A-in-annotate) at ($(A-0) + (-3em,0)$) [anchor=east]&#xA;    {\parbox{4.5em}{\centering  Ancilla register $S$ }};&#xA;  \node (B-in-annotate) at ($(B-0) + (-3em,0)$) [anchor=east]&#xA;    {\parbox{4.5em}{\centering Clock \\ register $C$ }};&#xA;  \node (C-in-annotate) at ($(C-0) + (-3em,0)$) [anchor=east]&#xA;    {\parbox{4.5em}{\centering Input \\ register $I$ }};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Finally, the frames for the stages of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  % draw frames for stages of the circuit&#xA;  \begin{pgfonlayer}{background}&#xA;    \bgframe [(annotate-1)(B-2)(B-4)(C-3)];&#xA;    \bgframe [(annotate-2)(B-7)(C-7)];&#xA;    \bgframe [(annotate-3)(B-10)(B-12)(C-11)];&#xA;  \end{pgfonlayer}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And that's the end of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;\end{tikzpicture}&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-09-07T13:09:06.473" LastActivityDate="2018-09-07T13:09:06.473" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="4074" PostTypeId="1" AcceptedAnswerId="4077" CreationDate="2018-08-22T16:05:10.180" Score="11" ViewCount="1063" Body="&lt;p&gt;Variational Quantum Eigensolver is a popular algorithm in Quantum Computing. But the ansatz part is very tricky. I do not really understand if they are built on some intuition, according to hardware or something else; or if it was just a trial and error approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think about it?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-12-13T20:04:25.827" LastActivityDate="2018-12-13T20:04:25.827" Title="Is there an intuition built on ansatz in VQE algorithm or is it more a trial and error approach?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4075" PostTypeId="2" ParentId="4063" CreationDate="2018-08-22T17:31:39.920" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;direct definition is a quantum register that stores a real number defined by an observable with a spectrum consisting of ℝ&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, qubits can be used to discretize a continuous quantum system.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Lets say $\Phi $ is an operator on the continuous system which we want to simulate using qubits. We need a discrete register ($D$) to store the qubit values. Now the discretization is done by measuring the shifts between the eigenstates of $\Phi$ denoted by operator say $M$. This is done by DFT.&#xA;$$&#xA;M = F^*\Phi F&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $F$ is the DFT operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now all this is considering that you already have a register which is storing continuous quantum output of a continuous system. &quot;What is that register?&quot; is I believe to be your original question. For that, you can take an example of cavity QED.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical quantum system with a continuous degree of freedom is the quantum field and normally, quantum simulations of quantum field theories rely on discretisation of this field.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas &lt;strong&gt;a cavity QED output is a continuous quantum field and &lt;em&gt;this&lt;/em&gt; acts as a continuous quantum register.&lt;/strong&gt; &lt;a href=&quot;https://pdfs.semanticscholar.org/d9ab/29b63427a7d1a3cc4714a89dfed8ee4356bf.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; thesis has even proposed an algorithm to be directly implemented on this continuous quantum field and only discretizing after the implementation, thus utilizing the underlying properties of continuous system.&lt;/p&gt;&#xA;" OwnerUserId="419" LastActivityDate="2018-08-22T17:31:39.920" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4076" PostTypeId="2" ParentId="4072" CreationDate="2018-08-22T17:48:08.410" Score="6" Body="&lt;p&gt;When you believe there are errors in a paper, you have the opportunity to publish a &amp;quot;comment&amp;quot; on the paper, in the same journal that the paper was originally published. The paper to which you refer as published in Molecular Physics, and here is an example of a &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268970110089090&quot; rel=&quot;noreferrer&quot;&gt;&amp;quot;comment&amp;quot; published in that very same journal&lt;/a&gt; in 2002, about a paper that was originally published in 1968.&lt;/p&gt;&#xA;&lt;p&gt;However, be careful when publishing a comment. You are publicly saying that they have made errors in a piece of work on which they have spent a lot of time and energy. Before contacting the journal, you should notify the authors privately. Instead of &lt;em&gt;&lt;strong&gt;telling&lt;/strong&gt;&lt;/em&gt; them that you have found errors in their paper, &lt;em&gt;&lt;strong&gt;ask&lt;/strong&gt;&lt;/em&gt; them if your suggestions are correct. For example:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Dear Prof. Kais, &lt;br&gt;&#xA;I found your paper &amp;quot;Quantum circuit design for solving linear systems of equations&amp;quot; very interesting and it was the subject of my summer project, for which I have to write a report now. While working through the paper I have found the following 6 points came up, which I would like to clarify with you: [here you can point out the 6 things you listed in your question, but I would recommend never to say they are &amp;quot;wrong&amp;quot; or they &amp;quot;skipped&amp;quot; something, but instead just say something like &amp;quot;I think the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; should be a &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt;, am I correct?&amp;quot;].&lt;/p&gt;&#xA;&lt;p&gt;Colleagues have suggested that I publish a Comment on your article in Molecular Physics, but I would like to consult you on it first.&lt;/p&gt;&#xA;&lt;p&gt;Most respectfully yours,&lt;br&gt;&#xA;Blue&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I have written an email like this before, and the author's response indicated to me that he agreed with me (on a much more profound error than the above 6 points: he had claimed something is in QMA but there was an error in his proof of that so it is still an open question whether or not it is in QMA), but it was clear from his response that he would be very angry at me if I published a Comment. I decided to swallow my pride and not publish the Comment. One day he might be the referee for one of my papers, or be the examiner for one of my grant proposals, and I do not want him to have bitterness towards me for publicly exposing that he made this mistake.&lt;/p&gt;&#xA;&lt;p&gt;This author suggested that the two of us publish an &amp;quot;Erratum&amp;quot; instead of a &amp;quot;Comment&amp;quot;, so he could be a co-author on the paper saying that there was an error in the original, but in the end we didn't even do that. Comment and Erratum papers, like the one you may be considering to write in this case, are not so helpful for your CV anyway. They are not regarded at nearly the same level as an &amp;quot;original&amp;quot; paper. I have never published a Comment, and I only know a small number of people who have. The important thing is that you now know the problems with the original paper and the corrections to those problems, and it's up to the original authors whether or not they want to publish an Erratum.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;There is also a journal where you can publish a re-analysis of other people's papers, which most people don't know about. It's the &amp;quot;Analysis&amp;quot; section in the journal Nature. They allow you to publish a re-analysis of other people's already published work, but they do this &lt;em&gt;&lt;strong&gt;very&lt;/strong&gt;&lt;/em&gt; rarely. The only example I know is &lt;a href=&quot;https://www.nature.com/articles/nature12290&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. Nature is not likely to publish the 6 minor things that you point out, because the standards in Nature are very high and you would have to find a much more &lt;em&gt;&lt;strong&gt;profound&lt;/strong&gt;&lt;/em&gt; re-analysis of the original paper rather than just 6 minor errors.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-08-22T18:04:21.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4077" PostTypeId="2" ParentId="4074" CreationDate="2018-08-22T18:20:06.507" Score="7" Body="&lt;p&gt;VQE can be used for many things. The most popular application of VQE is for the quantum chemistry problem, as in &lt;a href=&quot;https://arxiv.org/abs/1701.02691&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;, where they are trying to find the ground state wavefunction of a molecular Hamiltonian (i.e. the VQE is trying to find the eigenvector with the smallest eigenvalue/energy). Here you can see that they suggest a unitary coupled cluster (UCC) ansatz. The reason they choose UCC is because it is well-known that coupled cluster already gives a very good approximation of the ground state wavefunction, in fact it is the basis for what chemists call the &quot;&lt;a href=&quot;https://pubs.acs.org/doi/abs/10.1021/ct400465q&quot; rel=&quot;noreferrer&quot;&gt;gold standard of quantum chemistry&lt;/a&gt;&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember VQE is a heuristic. The better the ansatz that you start with, the  more likely your VQE will perform well. As you correctly said in your question, you can use intuition, or trial-and-error, or just use any knowledge you have of the problem to come up with something that you believe will work well (as in the case of using a coupled cluster ansatz for the problem where coupled cluster is already considered &quot;the gold standard&quot; for people solving the problem on classical computers). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no general recipe for how to come up with the ansatz for VQE which will universally work well on every VQE problem, and that is why VQE is called a &quot;heuristic&quot;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-22T18:20:06.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4078" PostTypeId="1" AcceptedAnswerId="4090" CreationDate="2018-08-23T22:34:21.137" Score="13" ViewCount="6823" Body="&lt;p&gt;For the implementation of a certain quantum algorithm, I need to construct a multi-qubit (in this case, a three-qubit) controlled-Z gate from a set of elementary gates, as shown in the figure below.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IA6d1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IA6d1.png&quot; alt=&quot;Three-qubit controlled-Z gate.&quot;&gt;&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gates that I can use are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the Pauli gates $\rm X, Y, Z$ and all their powers (i.e. all Pauli rotations up to a phase factor),&lt;/li&gt;&#xA;&lt;li&gt;${\rm exp}(i\theta|11\rangle\langle11|)$ (rotation about $|11\rangle\langle11|$ projector),&lt;/li&gt;&#xA;&lt;li&gt;$\rm H$ (Hadamard),&lt;/li&gt;&#xA;&lt;li&gt;$\rm C_X$ (single-qubit controlled-X or CNOT),&lt;/li&gt;&#xA;&lt;li&gt;$\rm C_Z$ (single-qubit controlled-Z), and&lt;/li&gt;&#xA;&lt;li&gt;$\rm S$ (SWAP).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How can I go about building this three-qubit controlled-Z from these gates? I have read several papers on circuit decompositions, but none of them could give me a clear and concise answer.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="26" LastEditDate="2018-12-23T13:12:30.863" LastActivityDate="2018-12-23T13:12:30.863" Title="How to construct a multi-qubit controlled-Z from elementary gates?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="6" CommentCount="2" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4079" PostTypeId="1" AcceptedAnswerId="4080" CreationDate="2018-08-23T22:53:44.517" Score="8" ViewCount="128" Body="&lt;p&gt;We know that the Wigner function of a Gaussian quantum state is (up to a constant) a Gaussian distribution. The first moment and the covariance of this distribution uniquely specify a quantum state. Therefore a Wigner function uniquely determines a Gaussian state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any similar statements applying to non-Gaussian states?&lt;/p&gt;&#xA;" OwnerUserId="1581" LastEditorUserId="55" LastEditDate="2020-07-16T09:22:09.267" LastActivityDate="2020-07-16T09:22:09.267" Title="Does a Wigner function uniquely determine a quantum state?" Tags="&lt;continuous-variable&gt;&lt;wigner-function&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4080" PostTypeId="2" ParentId="4079" CreationDate="2018-08-23T23:18:44.607" Score="7" Body="&lt;p&gt;For any quantum state, we have a unique density matrix $\rho$.&lt;br&gt;&#xA;For any $\rho$, we can do the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wigner_quasiprobability_distribution#Definition_and_meaning&quot; rel=&quot;noreferrer&quot;&gt;Wigner transformation&lt;/a&gt; to get a unique Wigner function $P(x,p)$. &lt;br&gt;&#xA;For any Wigner function $P(x,p)$, we can do the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wigner%E2%80%93Weyl_transform#Definition_of_the_Weyl_quantization_of_a_general_observable&quot; rel=&quot;noreferrer&quot;&gt;Weyl transformation&lt;/a&gt; to get back the unique $\rho$.&lt;br&gt;&#xA;If the construction of the Wigner function from $\rho$ was not unique, then it would not be possible to define an inverse transformation (but we do have an inverse transformation, namely the Weyl transformation, so the Wigner transformation does generate a unique characterization of a quantum state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has also been &lt;a href=&quot;https://physics.stackexchange.com/questions/242189/understanding-the-mathematics-of-wigner-function&quot;&gt;pointed out on the Physics Stack Exchange&lt;/a&gt;, that the Wigner function contains all information about a quantum state, just like the density matrix.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-23T23:18:44.607" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4081" PostTypeId="2" ParentId="4078" CreationDate="2018-08-23T23:33:18.300" Score="6" Body="&lt;p&gt;You can implement an $n$-qubit controlled $U$ by the circuit given in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2178/2293&quot;&gt;this answer&lt;/a&gt;. Just replace $U$ by $Z$. However this requires CCNOT (Toffoli) gates, and you have some &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3943/how-do-you-implement-the-toffoli-gate-using-only-single-qubit-and-cnot-gates&quot;&gt;options for how to implement CCNOT using elementary gates&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-23T23:33:18.300" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4082" PostTypeId="1" CreationDate="2018-08-24T01:48:50.600" Score="7" ViewCount="320" Body="&lt;p&gt;I was reading papers on Randomized Benchmarking, such as &lt;a href=&quot;https://arxiv.org/abs/1404.6025&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1701.04299&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;.&#xA;(more specifically, equation 30 in the second paper)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears to be some kind of averaging but I would like to have a more intuitive and physical picture of what it actually represents in terms of measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I know very little math, especially in terms of group representation)&lt;/p&gt;&#xA;" OwnerUserId="4399" LastEditorUserId="26" LastEditDate="2018-08-25T08:08:08.503" LastActivityDate="2018-08-25T08:08:08.503" Title="Physical meaning of twirling in Randomized Benchmarking" Tags="&lt;error-correction&gt;&lt;randomised-benchmarking&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4083" PostTypeId="2" ParentId="4082" CreationDate="2018-08-24T05:02:46.753" Score="1" Body="&lt;p&gt;An average over conjugations is known as a “twirl”. The “twirling” operation originates from invariant theory (where it is sometimes called “transfer homomorphism”). Twirling a quantum channel over $P_1^{⊗n}$, $C_1^{⊗n}$ or $C_n$ takes it to one described by a polynomial number of parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The twirling operation will be useful if it preserves, at least partially, properties of the original channel. Specifically, one would hope that correctable codes of the twirled channel resemble those of the original channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See page 31 of &quot;&lt;a href=&quot;https://uwspace.uwaterloo.ca/handle/10012/3828&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaining Information About a Quantum Channel Via Twirling&lt;/a&gt;&quot; (Jul 31 2008) by Easwar Magesan.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More in depth references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/1204.6308&quot; rel=&quot;nofollow noreferrer&quot;&gt;Characterization of addressability by simultaneous randomized benchmarking&lt;/a&gt;&quot; (Jan 2 2013), by Jay M. Gambetta, A. D. Corcoles, S. T. Merkel, B. R. Johnson, John A. Smolin, Jerry M. Chow, Colm A. Ryan, Chad Rigetti, S. Poletto, Thomas A. Ohki, Mark B. Ketchen, and M. Steffen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0611002&quot; rel=&quot;nofollow noreferrer&quot;&gt;Evenly distributed unitaries: on the structure of unitary designs&lt;/a&gt;&quot; (May 13 2007), by D. Gross, K. Audenaert, and J. Eisert.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0606161&quot; rel=&quot;nofollow noreferrer&quot;&gt;Exact and Approximate Unitary 2-Designs: Constructions and Applications&lt;/a&gt;&quot; (Aug 31 2012), by Christoph Dankert, Richard Cleve, Joseph Emerson, and Etera Livine.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2018-08-24T05:02:46.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4084" PostTypeId="2" ParentId="4082" CreationDate="2018-08-24T07:59:49.307" Score="4" Body="&lt;p&gt;I think the way that it is used in deriving bounds on quantum cloning is quite insightful, and hopefully gives you a flavour of the broader context. Where possible I'll skip some of the details in favour of description.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine you want to clone an unknown one-qubit quantum state $|\psi\rangle$, making two copies. We know that this is impossible to do perfectly, but you might want to quantify how close you can get. So, let's theorise that there's some map $\rho=\mathcal{E}(|\psi\rangle\langle\psi|)$ that you're going to implement, producing a two-qubit output. The cloning fidelity in this case is&#xA;$$&#xA;F=\text{Tr}\left((|\psi\rangle\langle\psi|\otimes\mathbb{I}+\mathbb{I}\otimes|\psi\rangle\langle\psi|)\rho\right)/2&#xA;$$&#xA;Skipping over the details, including the Choi-Jamiolkowski isomorphism, it turns out that you can relate the optimal choice of $\rho$ to the eigenvector with maximum eigenvalue of the operator&#xA;$$&#xA;|\psi\rangle\langle\psi|^\star\otimes(|\psi\rangle\langle\psi|\otimes\mathbb{I}+\mathbb{I}\otimes|\psi\rangle\langle\psi|).&#xA;$$&#xA;Actually, this is straightforward to calculate: the maximum eigenvector is $|\psi\rangle^\star|\psi\rangle|\psi\rangle$, and has eigenvalue 1. i.e. the operation can be done perfectly. However, this formulation presupposes that we know the state we're trying to clone (and obviously, if you know it, you can make arbitrarily many copies). We somehow have to quantify the fact that we don't know what the state is to be cloned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this, we need to take a Bayesian approach. If we don't know the state, we assign a probability to each of the possible states. In that case, the expected fidelity of the transformation is $\bar F$, the maximum eigenvalue of the operator&#xA;$$&#xA;R=\sum_{\psi}p_{\psi}|\psi\rangle\langle\psi|^\star\otimes(|\psi\rangle\langle\psi|\otimes\mathbb{I}+\mathbb{I}\otimes|\psi\rangle\langle\psi|)&#xA;$$&#xA;You might know something about the possible input state. For example, if you know it's either $|0\rangle$ or $|1\rangle$ with equal probability, you still find the maximum eigenvalue of 1 (which makes sense: you can measure the input state in the Z basis and make as many copies as you want). At the other extreme, if you know nothing about the state at all, you have to average over all single-qubit pure states with equal weights. What is the right way to do this? It's a bit messy as you can perhaps see from looking at the Bloch sphere:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/okgge.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/okgge.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;We need to take an average of all points on the surface of the sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to achieve this is to say that every $|\psi\rangle=U|0\rangle$ for some $U$, and we average over all possible unitaries, where the correct averaging is determined by the Haar measure. So, we can change our operator $R$ into&#xA;$$&#xA;R=\int U^\star\otimes U\otimes U\left(|0\rangle\langle0|^\star\otimes(|0\rangle\langle0|\otimes\mathbb{I}+\mathbb{I}\otimes|0\rangle\langle0|)\right)U^T\otimes U^\dagger\otimes U^\dagger dU&#xA;$$&#xA;This is basically the twirling operation (except for the slight technicality that there's a complex conjugate on one of the qubits), and certainly captures the intuition of how/why it comes into things.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-24T07:59:49.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4085" PostTypeId="2" ParentId="3890" CreationDate="2018-08-24T13:09:47.530" Score="2" Body="&lt;p&gt;&lt;em&gt;entanglement&lt;/em&gt; is neither an operation nor a state, it is a concept describing a particular family of states. Here is a short explanation of this concept.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's limit ourselves to 2 qubits stored on 2 registers A and B :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;case 1 : you prepare independently the qubit A in some state (&lt;code&gt;a1|0&amp;gt; + a2|1&amp;gt;&lt;/code&gt;), then you do the same with the qubit B (&lt;code&gt;b1|0&amp;gt; + b2|1&amp;gt;&lt;/code&gt;). In that case the state of your total system is described as the concatenation of the state of the system A and the state of the system B. This case is intuitive, there is no entanglement between the registers A and B -&gt; we call it a &lt;em&gt;separable&lt;/em&gt; state. We can write the state of the system as &lt;code&gt;a1*b1|00&amp;gt; + a1*b2|01&amp;gt; + a2*b1|10&amp;gt; + a2*b2|11&amp;gt;&lt;/code&gt; (tensor product of states on A and B)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In quantum mechanics, there exists other states for the total system AB that cannot be described as the concatenation of the states of the subsystems A and B. This phenomenon has no equivalent in classical mechanics and is not very intuitive. This leads us to :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;case 2 : you start with some state &lt;code&gt;k1|0&amp;gt; + k2|1&amp;gt;&lt;/code&gt; on the register A and &lt;code&gt;|0&amp;gt;&lt;/code&gt; on register B, then you apply a quantum operator known as CNOT that will &quot;expand&quot; the contents of the two superposition terms of register A to register B. The resulting state &lt;code&gt;k1|00&amp;gt; + k2|11&amp;gt;&lt;/code&gt; on system AB cannot be written as a product (tensor product) of two separate states on A and B. We call it an &lt;em&gt;entangled&lt;/em&gt; state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One particularity of the entangled states is how it behave wrt measurement : in an entangled state, the outcome of a measurement in one of the subsystems can influence the outcome of a measurement on the other. For example with the state in case 2, you have :&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;50% chance of measuring &lt;code&gt;1&lt;/code&gt; on register A&lt;/li&gt;&#xA;&lt;li&gt;50% chance of measuring &lt;code&gt;1&lt;/code&gt; on register B&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;but&lt;/strong&gt; if you have already measured the register A and you have gotten &lt;code&gt;1&lt;/code&gt;, then you have a 100% chance of measuring &lt;code&gt;1&lt;/code&gt; on register B&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This last item &quot;3&quot; would not be true if the state wasn't entangled, in which case the outcome of the measurement on register A couldn't have influenced the probabilities of the outcome on register B.&lt;/p&gt;&#xA;" OwnerUserId="4420" LastActivityDate="2018-08-24T13:09:47.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4086" PostTypeId="1" CreationDate="2018-08-24T18:05:02.970" Score="13" ViewCount="970" Body="&lt;p&gt;A recent question here asked how to compile the 4-qubit gate CCCZ (controlled-controlled-controlled-Z) into simple 1-qubit and 2-qubit gates, and the only answer given so far &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4081/2293&quot;&gt;requires 63 gates&lt;/a&gt;! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step was to use the C$^n$U construction given by Nielsen &amp;amp; Chuang:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wi9FAm.png&quot; width=&quot;400&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With $n=3$ this means 4 CCNOT gates and 3 simple gates (1 CNOT and 2 Hadamards is enough to do the final CZ on the target qubit and the last work qubit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dl.acm.org/citation.cfm?id=2011799&quot; rel=&quot;noreferrer&quot;&gt;Theorem 1 of this paper&lt;/a&gt;, says that in general the CCNOT requires 9 one-qubit and 6 two-qubit gates (15 total):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GRfPe.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GRfPe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;This means:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4 CCNOTs) x (15 gates per CCNOT) + (1 CNOT) + (2 Hadamards) = &lt;strong&gt;63 total gates&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4078/how-to-construct-a-multi-qubit-controlled-z-from-elementary-gates/4081#comment4442_4081&quot;&gt;comment&lt;/a&gt;, it has been suggested the 63 gates can be then further compiled using an &quot;automatic procedure&quot;, for example from the theory of &lt;a href=&quot;https://en.wikipedia.org/wiki/Automatic_group&quot; rel=&quot;noreferrer&quot;&gt;automatic groups&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;How can this &quot;automatic compilation&quot; be done, and how much would it reduce the number of 1-qubit and 2-qubit gates in this case?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-12-13T21:05:06.447" LastActivityDate="2019-04-29T09:03:15.330" Title="Automatic compilation of quantum circuits" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;programming&gt;&lt;gate-synthesis&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4087" PostTypeId="2" ParentId="4078" CreationDate="2018-08-24T18:39:09.697" Score="2" Body="&lt;p&gt;While my other answer is the most obvious &quot;textbook&quot; way (using &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4086/automatic-compilation-of-quantum-circuits&quot;&gt;Nielsen &amp;amp; Chaung's CCCZ decomposition into CCNOTs&lt;/a&gt;, then another &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3943/how-do-you-implement-the-toffoli-gate-using-only-single-qubit-and-cnot-gates&quot;&gt;textbook decomposition to compile the CCNOTs&lt;/a&gt;), a more creative way might allow us to get the job done with fewer gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace all the CNOTs in Nielsen &amp;amp; Chuang's circuit with this gadget:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BYfjl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BYfjl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have a bunch of CCZs instead of CCNOTs, and they can be decomposed like this (courtesy of &lt;a href=&quot;https://dl.acm.org/citation.cfm?id=2011799&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0XIcU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0XIcU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that $H^2 = I$, so some of these Hadamards cancel each other out and we get even more of a reduction :)&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-08-25T19:00:12.907" LastActivityDate="2018-08-25T19:00:12.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4088" PostTypeId="2" ParentId="4078" CreationDate="2018-08-24T19:35:21.047" Score="4" Body="&lt;p&gt;I'm posting another decomposition of CCCZ here just in case it is useful for anyone else trying to compile CCCZ. It requires a smaller number of total gates, and only 1 auxiliary qubit instead of 2, but five more 2-qubit gates than the &quot;obvious&quot; answer, so may actually be worse for implementation on Hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was suggested by user @Rob in this comment: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4086/automatic-compilation-of-quantum-circuits#comment4444_4086&quot;&gt;Automatic compilation of quantum circuits&lt;/a&gt;, and comes from &lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1367-2630/aaa398/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0gtf2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0gtf2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The GMS5$(\chi)$ gate is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wlX8M.png&quot; width=&quot;300&quot;/&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with $n=5$ and all $\chi_{ij}=\chi$, which means it involves 10 two-qubit gates. These will then have to be compiled into the gate set given in the question, so this decomposition should only be used if you are trying to save on the number auxiliary qubits or if you don't mind having more 2-qubit gates in order to reduce the circuit depth by a bit.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-24T19:35:21.047" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4089" PostTypeId="2" ParentId="4086" CreationDate="2018-08-24T23:18:14.510" Score="4" Body="&lt;p&gt;Using the procedure described in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303063&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0303063&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;, &lt;strong&gt;any&lt;/strong&gt; diagonal gate - any thus in particular the CCCZ gate -- can be decomposed in terms of e.g. CNOTs and one-qubit diagonal gates, where the CNOTs can be optimized on their own following a classical optimization procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference provides a circuit using 16 CNOTs for arbitrary diagonal 4-qubit gates (Fig. 4).  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Remark: While there might in principle be a simpler circuit (said circuit has been optimized with a more constrained circuit architecture in mind), it should be close to optimal -- the circuit needs to create all states of the form &lt;span class=&quot;math-container&quot;&gt;$\bigoplus_{i\in I}x_i$&lt;/span&gt; for any non-trivial subset &lt;span class=&quot;math-container&quot;&gt;$I\subset\{1,2,3,4\}$&lt;/span&gt;, and there are 15 of those for 4 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that this construction by no means needs to be optimal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Note: I'm an author&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="23" LastEditDate="2018-11-01T08:48:15.940" LastActivityDate="2018-11-01T08:48:15.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4090" PostTypeId="2" ParentId="4078" CreationDate="2018-08-24T23:24:46.180" Score="7" Body="&lt;p&gt;(EDIT: Improved to 14 CNOTs.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;It can be done with 14 CNOTs, plus 15 single-qubit Z rotations, and no auxiliary qubits.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding circuit is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ddlt6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ddlt6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$\fbox{$\pm$}$&lt;/span&gt; gates are rotations &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_z(\pm\pi/16)\propto \left(\begin{matrix}1\\&amp;amp;e^{\pm i\pi/8}&#xA;\end{matrix}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Derivation:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the procedure described in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303063&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0303063&lt;/a&gt;&lt;sup&gt;1 &lt;/sup&gt;, &lt;strong&gt;any&lt;/strong&gt; diagonal gate - any thus in particular the CCCZ gate -- can be decomposed in terms of e.g. CNOTs and one-qubit diagonal gates, where the CNOTs can be optimized on their own following a classical optimization procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference provides a circuit using 16 CNOTs for arbitrary diagonal 4-qubit gates (Fig. 4).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be improved if arbitrary pairs of qubits can be coupled to 14 qubits. For nearest neighbors with periodic (open) boundary conditions, this can be done with 16 (18) CNOTs. The corresponding circuits can be found in &lt;a href=&quot;https://epub.uni-regensburg.de/1511/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://epub.uni-regensburg.de/1511/&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;, Fig. 5.2, 5.4, and 5.5, and can e.g. be obtained using methods to construct short Gray sequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of one-qubit gates is always 15.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Remark: While there might in principle be a simpler circuit (said circuit has been optimized with a more constrained circuit architecture in mind), it should be close to optimal -- the circuit needs to create all states of the form &lt;span class=&quot;math-container&quot;&gt;$\bigoplus_{i\in I}x_i$&lt;/span&gt; for any non-trivial subset &lt;span class=&quot;math-container&quot;&gt;$I\subset\{1,2,3,4\}$&lt;/span&gt;, and there are 15 of those for 4 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that this construction by no means needs to be optimal.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Note: I'm an author&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="23" LastEditDate="2018-11-01T08:50:16.020" LastActivityDate="2018-11-01T08:50:16.020" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4091" PostTypeId="2" ParentId="4078" CreationDate="2018-08-25T05:55:42.280" Score="6" Body="&lt;p&gt;Here is &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;a CCCZ construction that uses 29 gates&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8DQud.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're allowed to use measurement and classical feedforward, &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Measure%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C1%2C1%2C%22%E2%80%A2%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;the gate count can be reduced to 25&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Measure%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C1%2C1%2C%22%E2%80%A2%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3RDee.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The Hadamard gates can be replaced with square roots of Y if needed to meet the gate set constraint.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you allow me to perform Controlled-S gates and Controlled-sqrt(X) gates and perform X basis measurements, then &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%5E%C2%BD%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%5E-%C2%BD%22%5D%2C%5B1%2C1%2C1%2C%22%E2%97%A6%22%2C%22Z%5E-%C2%BD%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22Z%5E-%C2%BD%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Measure%22%5D%2C%5B1%2C1%2C%22Z%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C1%2C1%2C%22%E2%80%A2%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;I can get it down to 10 gates total&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%5E%C2%BD%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%5E-%C2%BD%22%5D%2C%5B1%2C1%2C1%2C%22%E2%97%A6%22%2C%22Z%5E-%C2%BD%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22Z%5E-%C2%BD%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Measure%22%5D%2C%5B1%2C1%2C%22Z%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C1%2C1%2C%22%E2%80%A2%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/d9cDZ.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-08-26T17:38:42.747" LastActivityDate="2018-08-26T17:38:42.747" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="4092" PostTypeId="2" ParentId="4078" CreationDate="2018-08-25T06:27:19.170" Score="4" Body="&lt;p&gt;There are some large savings that can be made based on the specified gate set. For example, in the typical ccnot construction, if you replace the $T$ gate with $Z^{1/4}$, you don't need that phase correction that constitutes the last few gates between the two control qubits. This construction, which obeys the gate set specified in the question, consists of 21 gates, of which 10 are 2-qubit (you don’t need the last gate in the circuit below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NztpV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NztpV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear (in response to several comments): usually we look at Toffoli, and try to make it using the $T$ gate. If both controls are $|1\rangle$, then the gate sequence on the target qubit is $HXTXT^\dagger XTXT^\dagger H$. Now, since $XT^\dagger X=Te^{-i\pi/4}$, then the sequence simplifies to $-iHT^4H=-iX$, and one has to add a compensating controlled-S gate on the two control qubits. If, instead, we use $Z^{1/4}$, then $XZ^{-1/4}X=Z^{1/4}$, and none of those pesky phases come into it, and it saves you some two-qubit gates!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, note that the two Toffoli gates are only Toffoli because they target the 0 state. Typically you would need an extra two-qubit gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've not found as efficient a construction in existing literature, although this &lt;a href=&quot;https://arxiv.org/abs/1703.10535&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; claims a construction using only 11 2-qubit gates, but I haven’t done a complete gate count once it’s converted into the question’s restricted gate set.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-28T07:25:34.270" LastActivityDate="2018-08-28T07:25:34.270" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4093" PostTypeId="2" ParentId="4086" CreationDate="2018-08-26T19:06:54.813" Score="7" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$g_1 \cdots g_M$&lt;/span&gt; be the basic gates that you are allowed to use. For the purposes of this &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{13}$&lt;/span&gt; etc are treated as separate. So &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is polynomially dependent on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, the number of qubits. The precise dependence involves details of the sorts of gates you use and how &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local they are. For example, if there are &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; single qubit gates and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; 2-qubit gates that don't depend on order like &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$M = xn+\binom{n}{2}y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A circuit is then a product of those generators in some order. But there are multiple circuits that do nothing. Like &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12} \operatorname{CNOT}_{12} = \mathrm{Id}$&lt;/span&gt;. So those give relations on the group. That is it is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Presentation_of_a_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;group presentation&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle g_1 \cdots g_M \mid R_1 \cdots \rangle$&lt;/span&gt; where there are many relations that we do not know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem we wish to solve is given a word in this group, what is the shortest word that represents the same element. For general group presentations, this is hopeless. The sort of group presentation where this problem is accessible are called automatic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we can consider a simpler problem. If we throw out some of the &lt;span class=&quot;math-container&quot;&gt;$g_i$&lt;/span&gt;, then the words from before become of the form &lt;span class=&quot;math-container&quot;&gt;$w_1 g_{i_1} w_2 g_{i_2} \cdots w_k$&lt;/span&gt; where each of the &lt;span class=&quot;math-container&quot;&gt;$w_i$&lt;/span&gt; are words only in the remaining letters. If we managed to make them shorter using the relations that don't involve the &lt;span class=&quot;math-container&quot;&gt;$g_i$&lt;/span&gt;, then we will have made the entire circuit shorter. This is akin to the optimizing the CNOTs on their own made in the other answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if there are three generators and the word is &lt;span class=&quot;math-container&quot;&gt;$aababbacbbaba$&lt;/span&gt;, but we don't want to deal with &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, we will instead shorten &lt;span class=&quot;math-container&quot;&gt;$w_1=aababba$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w_2=bbaba$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\hat{w}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{w}_2$&lt;/span&gt;. We then put them back together as &lt;span class=&quot;math-container&quot;&gt;$\hat{w}_1 c \hat{w}_2$&lt;/span&gt; and that is a shortening of the original word.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So WLOG (without loss of generality), let's suppose we are in that problem already &lt;span class=&quot;math-container&quot;&gt;$\langle g_1 \cdots g_M \mid R_1 \cdots \rangle$&lt;/span&gt; where we now use all the gates specified. Again this is probably not an automatic group. But what if we throw out some of the relations. Then we will have another group that has a quotient map down to the one we really want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The group &lt;span class=&quot;math-container&quot;&gt;$\langle g_1 g_2 \mid - \rangle$&lt;/span&gt; no relations is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Free_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;free group&lt;/a&gt;, but then if you put &lt;span class=&quot;math-container&quot;&gt;$g_1^2=\mathrm{id}$&lt;/span&gt; as a relation, you get the &lt;a href=&quot;https://en.wikipedia.org/wiki/Free_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;free product&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2 \star \mathbb{Z}$&lt;/span&gt; and there is a quotient map from the former to the later reducing the number of &lt;span class=&quot;math-container&quot;&gt;$g_1$&lt;/span&gt;'s in each segment modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relations we throw out will be such that the one upstairs (the source of the quotient map) will be automatic by design. If we only use the relations that remain and shorten the word, then it will still be a shorter word for the quotient group. It just won't be optimal for the quotient group (the target of the quotient map), but it will have the length &lt;span class=&quot;math-container&quot;&gt;$\leq$&lt;/span&gt; to the length it started with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was the general idea, how can we turn this into a specific algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we choose the &lt;span class=&quot;math-container&quot;&gt;$g_i$&lt;/span&gt; and relations to throw out in order to get an automatic group? This is where knowledge of the kinds of elementary gates we typically use comes in. There are a lot of involutions, so keep only those. Keep careful attention to the fact that these are only the elementary involutions, so if your hardware has a hard time swapping qubits that are vastly separated on your chip, this is writing them in only the ones that you can do easily and reducing that word to be as short as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose you have &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2190/allowed-cnot-gates-for-ibm-q-5-quantum-computer&quot;&gt;the IBM configuration&lt;/a&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$s_{01},s_{02},s_{12},s_{23},s_{24},s_{34}$&lt;/span&gt; are the allowed gates. If you wish to do a general permutation, decompose it into &lt;span class=&quot;math-container&quot;&gt;$s_{i,i+1}$&lt;/span&gt; factors. That is a word in the group &lt;span class=&quot;math-container&quot;&gt;$\langle s_{01},s_{02},s_{12},s_{23},s_{24},s_{34} \mid R_1 \cdots \rangle$&lt;/span&gt; that we wish to shorten.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that these don't have to be the standard involutions. You can throw in &lt;span class=&quot;math-container&quot;&gt;$R(\theta) X R(\theta)^{-1}$&lt;/span&gt; in addition to &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; for example. Think of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gottesman%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman-Knill theorem&lt;/a&gt;, but in an abstract manner that means it will be easier to generalize. Such as using the property that under short exact sequences, if you have finite complete rewriting systems for the two sides, then you get one for the middle group. That comment is unnecessary for the rest of the answer, but shows how you can build up bigger more general examples from the ones in this answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relations that are kept are only those of the form &lt;span class=&quot;math-container&quot;&gt;$(g_i g_j)^{m_{ij}} = 1$&lt;/span&gt;. This gives a &lt;a href=&quot;https://en.wikipedia.org/wiki/Coxeter_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coxeter group&lt;/a&gt; and it is automatic. In fact, we don't even have to start from scratch to code up the algorithm for this automatic structure. It is already implemented in &lt;a href=&quot;http://www.sagemath.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sage&lt;/a&gt; (Python based) in general purpose. All you have to do is specify the &lt;span class=&quot;math-container&quot;&gt;$m_{ij}$&lt;/span&gt; and it has the remaining implementation already done. You might do some speedups on top of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$m_{ij}$&lt;/span&gt; is really easy to compute because of the locality properties of the gates. If the gates are at most &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local, then the computation of &lt;span class=&quot;math-container&quot;&gt;$m_{ij}$&lt;/span&gt; can be done on a &lt;span class=&quot;math-container&quot;&gt;$2^{2k-1}$&lt;/span&gt; dimensional Hilbert space. This is because if the indices don't overlap, then you know that &lt;span class=&quot;math-container&quot;&gt;$m_{ij}=2$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$m_{ij}=2$&lt;/span&gt; is for when &lt;span class=&quot;math-container&quot;&gt;$g_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g_j$&lt;/span&gt; commute. You also only have to compute less than half of the entries. This is because the matrix &lt;span class=&quot;math-container&quot;&gt;$m_{ij}$&lt;/span&gt; is symmetric, has &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s on the diagonal (&lt;span class=&quot;math-container&quot;&gt;$(g_i g_i)^1 = 1$&lt;/span&gt;). Also most of the entries are just renaming the involved qubits so if you know the order of &lt;span class=&quot;math-container&quot;&gt;$(\operatorname{CNOT}_{12} H_1)$&lt;/span&gt;, you know the order of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{37} H_3$&lt;/span&gt; without doing the computation over again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That took care of all relations that only involved at most two distinct gates (proof: exercise). The relations that involved &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; or more were all thrown out. We now put them back in.  Let's say we have that, then one can perform &lt;a href=&quot;https://en.wikipedia.org/wiki/Small_cancellation_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dehn's greedy algorithm&lt;/a&gt; using new relations. If there was a change, we knock it back up to run through the Coxeter group again. This repeats until there are no changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time the word is either getting shorter or staying the same length and we are only using algorithms that have linear or quadratic behaviour. This is a rather cheap procedure so might as well do it and make sure you didn't do anything stupid.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to test it out yourself, give the number of generators as &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, the length &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; of the random word you're trying out and the Coxeter matrix as &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;edge_list=[]&#xA;for i1 in range(N):&#xA;    for j1 in range(i):&#xA;        edge_list.append((j1+1,i1+1,m[i1,j1]))&#xA;G3 = Graph(edge_list)&#xA;W3 = CoxeterGroup(G3)&#xA;s3 = W3.simple_reflections()&#xA;word=[choice(list([1,..,N])) for k in range(K)]&#xA;print(word)&#xA;wTesting=s3[word[0]]&#xA;for o in word[1:]:&#xA;    wTesting=wTesting*s3[o]&#xA;word=wTesting.coset_representative([]).reduced_word()&#xA;print(word)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An example with &lt;code&gt;N=28&lt;/code&gt; and &lt;code&gt;K=20&lt;/code&gt;, the first two lines are the input unreduced word, the next two is the reduced word. I hope I didn't make a typo when entering the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; matrix.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[26, 10, 13, 16, 15, 16, 20, 22, 21, 25, 11, 22, 25, 13, 8, 20, 19, 19, 14, 28]&#xA;&#xA;['CNOT_23', 'Y_1', 'Y_4', 'Z_2', 'Z_1', 'Z_2', 'H_1', 'H_3', 'H_2', 'CNOT_12', 'Y_2', 'H_3', 'CNOT_12', 'Y_4', 'X_4', 'H_1', 'Z_5', 'Z_5', 'Y_5', 'CNOT_45']&#xA;&#xA;[14, 8, 28, 26, 21, 10, 15, 20, 25, 11, 25, 20]&#xA;&#xA;['Y_5', 'X_4', 'CNOT_45', 'CNOT_23', 'H_2', 'Y_1', 'Z_1', 'H_1', 'CNOT_12', 'Y_2', 'CNOT_12', 'H_1']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Putting back those generators like &lt;span class=&quot;math-container&quot;&gt;$T_i$&lt;/span&gt; we only put back the relations like &lt;span class=&quot;math-container&quot;&gt;$T_i^n = 1$&lt;/span&gt; and that &lt;span class=&quot;math-container&quot;&gt;$T_i$&lt;/span&gt; commutes with gates that do not involve qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. This allows us to make the decomposition &lt;span class=&quot;math-container&quot;&gt;$w_1 g_{i_1} w_2 g_{i_2} \cdots w_k$&lt;/span&gt; from before have the &lt;span class=&quot;math-container&quot;&gt;$w_i$&lt;/span&gt; as long as possible. We want to avoid situations like &lt;span class=&quot;math-container&quot;&gt;$X_1 T_2 X_1 T_2 X_1 T_2 X_1$&lt;/span&gt;. (In Cliff+T one often seeks to minimize T-count). For this part, the directed acyclic graph showing the dependency is crucial. This is a problem of finding a good topological sort of the DAG. That is done by changing precedence when one has a choice of what vertex to use next. (I wouldn't waste time optimizing this part too hard.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the word is already close to optimal length, there is not much to do and this procedure won't help. But as the most basic example of what it finds is if you have multiple units and you forgot there was an &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; at the end of one and an &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; at the beginning of the next, it will get rid of that pair. This means you can black box common routines with greater confidence that when you put them together, those obvious cancellations will all be taken care of. It does others that aren't as obvious; those use when &lt;span class=&quot;math-container&quot;&gt;$m_{ij} \neq 1,2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-04-29T09:03:15.330" LastActivityDate="2019-04-29T09:03:15.330" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4096" PostTypeId="1" AcceptedAnswerId="4098" CreationDate="2018-08-27T13:54:31.473" Score="6" ViewCount="166" Body="&lt;p&gt;How can I synthesis a two-qubit quantum state of the state vector (a,b,b,b) using basic quantum-gate circuit (arbitrary single-qubit rotation and controlled $Z$ gate)? And further, can I know a given circuit is the simplest? &lt;/p&gt;&#xA;" OwnerUserId="4439" LastEditorUserId="26" LastEditDate="2018-12-23T07:39:53.120" LastActivityDate="2018-12-23T07:39:53.120" Title="What is the smallest quantum circuit to produce two-qubit state (a,b,b,b)?" Tags="&lt;circuit-construction&gt;&lt;quantum-state&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4097" PostTypeId="2" ParentId="4096" CreationDate="2018-08-27T17:17:24.800" Score="4" Body="&lt;p&gt;The simplest way to solve this problem is to work backwards from the output to the input. Suppose you have the state $a|00\rangle + b|01\rangle + b|10\rangle + b|11\rangle$. How can you reduce this to just the state $|00\rangle$ with unitary operations? Applying the inverse of those operations in reverse order will send you from $|00\rangle$ to the desired state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we start here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = a|00\rangle + b|01\rangle + b|10\rangle + b|11\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the amplitude of $|10\rangle$ is equal to the amplitude of $|11\rangle$. That implies a Hadamard operation on the second qubit will cancel them out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_2 |\psi\rangle = \frac{a+b}{\sqrt{2}}|00\rangle + \frac{a-b}{\sqrt{2}}|01\rangle + \sqrt{2} b|10\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, within the subspace where the first qubit is off, we have the state $|v\rangle = \frac{a+b}{\sqrt{2}}|0\rangle + \frac{a-b}{\sqrt{2}}|1\rangle$ on the second qubit. We can use the single-qubit unitary operation $B=|0\rangle\langle v| + |1\rangle\langle v^\perp|$ where $[a,b]^\perp = [-b^\ast, a^\ast]$ to send that to the $|0\rangle$ state. We must control $B$ on the first qubit being OFF to avoid messing up the ON subspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$B_{\bar{1} \rightarrow 2} \cdot H_1 \cdot |\psi\rangle = (|a|^2 + |b|^2) |00\rangle + \sqrt{2} b|10\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have managed to turn off the second qubit, leaving the first qubit in state $|w\rangle = (|a|^2 + |b|^2) |0\rangle + \sqrt{2} b|1\rangle$. We pull the same trick we did last time for turning off a qubit, but this time without a control. The operation we need is $A=|0\rangle\langle w| + |1\rangle\langle w^\perp|$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$A_1 \cdot B_{\bar{1} \rightarrow 2} \cdot H_1 \cdot |\psi\rangle = |00\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which implies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_1 \cdot B_{\bar{1} \rightarrow 2}^\dagger \cdot A_1^\dagger \cdot |00\rangle = a|00\rangle + b|01\rangle + b|10\rangle + b|11\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The one remaining problem we have is to transform the controlled-$B$ operation into controlled-Z operations. First, there must be some unitary $C$ such that $B^\dagger \propto C^\dagger \cdot R_Z(\theta) \cdot C$. Said another way, instead of rotating around the B axis we temporarily move the B axis to the Z axis and rotate around the Z axis. The value of $\theta$ depends on the eigenvalues of $B$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is our current state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H_1 \cdot C_2^\dagger \cdot R_Z(\theta)_{\bar{1} \rightarrow 2} \cdot C_2 \cdot A_1^\dagger \cdot |00\rangle = a|00\rangle + b|01\rangle + b|10\rangle + b|11\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last thing we need to do is turn the anti-controlled-partial-Z into just CZs. That gets really annoying to do with algebra instead of visually, but there's a standard way to do it and the result is our final circuit which looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2V9VT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2V9VT.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $Z^t \propto R_Z(t \pi)$ and $t = \frac{\theta}{2 \pi}$. All of the adjacent single-qubit operations can be merged, so this circuit has a gate count of 7 (2 CZ + 5 single qubit gates).&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-08-27T17:17:24.800" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4098" PostTypeId="2" ParentId="4096" CreationDate="2018-08-27T17:56:32.810" Score="4" Body="&lt;p&gt;A particularly efficient way is the look at the Schmidt coefficients of your target state. You know that your state can be written as&#xA;$$&#xA;U_1\otimes U_2(\alpha|00\rangle+\beta|11\rangle),&#xA;$$&#xA;and the Schmidt decomposition tells you what $\alpha,\beta,U_1,U_2$ are. So, obviously, the problem becomes producing&#xA;$$&#xA;\alpha|00\rangle+\beta|11\rangle.&#xA;$$&#xA;This is simple: produce $(\alpha|0\rangle+\beta|1\rangle)|0\rangle$ and apply controlled-not. Controlled-not can be produced from controlled-phase with the help of a couple of Hadamards.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/V87ET.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V87ET.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Thus, you only need one controlled-phase gate, and you know that must be optimal because the target state is entangled, and therefore requires at least one entangling operation to produce. Obviously we can combing the $H$ and $U_2$ as a single step if we wish.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to talk about optimality in terms of total gate count, you know that a controlled-phase is useless as an entangling gate unless neither qubit is in the computational basis, so you have to have single-qubit unitaries on both qubits before the controlled phase. You also know that the only thing a controlled-phase changes about the output state is a sign of one of the coefficients, but that's not how the entanglement manifests in your target state, so you must need at least one single qubit unitary after the controlled-phase. So, you're certainly very close to optimal.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-27T18:07:35.703" LastActivityDate="2018-08-27T18:07:35.703" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4099" PostTypeId="2" ParentId="3933" CreationDate="2018-08-28T01:57:25.820" Score="5" Body="&lt;p&gt;I agree with  most of what you've written in the first paragraph, though I would say that at roughly the same time (only 1 month apart!) as the Rebentrost et al. paper you mentioned, a very similar paper was posted to arXiv by Plenio and Huelga called &lt;a href=&quot;https://arxiv.org/abs/0807.4902&quot; rel=&quot;noreferrer&quot;&gt;&quot;Dephasing assisted transport: Quantum networks in biomolecules&quot;&lt;/a&gt; and it actually got published in the same journal as the Rebentrost et al. paper, but a few months earlier. There was also Mohseni et al.'s &lt;a href=&quot;https://arxiv.org/abs/0805.2741&quot; rel=&quot;noreferrer&quot;&gt;Environment-Assisted Quantum Walks in Photosynthetic Energy Transfer&lt;/a&gt; posted on arXiv one month earlier than Rebentrost et al., and published in a journal 8 days before the Plenio-Huelga paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But actually 13 years before all of that, Nancy Makri and Eunji Sim wrote papers simulating the full quantum coherence for electron transfer in bacteriochlorophylls (see &lt;a href=&quot;http://www.scs.illinois.edu/~makri/New-Web-Site/preprints/paper36.pdf&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/0009261495013741&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;). Also 11 years before that, Nobel Laureate Rudy Marcus used &lt;a href=&quot;https://en.wikipedia.org/wiki/Marcus_theory&quot; rel=&quot;noreferrer&quot;&gt;Marcus theory&lt;/a&gt; to study energy transfer in the same system, and wrote &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/030441738590014X&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; review on the subject with 331 papers listed in the bibliography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the use of quantum mechanics to study energy transfer in bacteriochlorophyll goes back to decades before that Rebentrost et al. paper, and it was the 2007 Engel paper that you mentioned, where they connected the energy transfer to quantum computing, which created a new wave of interest (including in the quantum computing community which previously was not interested in biological/chemical energy transfer, examples being the two 2008 papers mentioned in the first paragraph, which featured authors from quantum computing such as Martin Plenio and Seth Lloyd).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was lucky to get the chance to see Bob Silbey's talk at the Royal Society meeting called &lt;a href=&quot;https://www.quantiki.org/conference/quantum-coherent-energy-transfer-implications-biology-and-new-energy-technologies&quot; rel=&quot;noreferrer&quot;&gt;&quot;Quantum coherent energy transfer: Implications for biology and new energy technologies&quot;&lt;/a&gt; fewer than 6 months before he died, and he traced quantum biology back to Chapter 4 of Schrödinger's book &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/What_Is_Life%3F&quot; rel=&quot;noreferrer&quot;&gt;What is Life?&lt;/a&gt;&quot; which talks about mutations being causd by electron transfer (which we now learn in high school biology: &lt;a href=&quot;https://en.wikipedia.org/wiki/Pyrimidine_dimer&quot; rel=&quot;noreferrer&quot;&gt;UV radiation causes excitations that cause thymine dimers to form&lt;/a&gt;, leading to cancer).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Things get interesting in your second paragraph when you say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given that this mechanism allows for quantum effects to take place at room temperatures without the negative effects of decoherence, are their any applications for quantum computing?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In my answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1854/quantum-simulation-of-environment-assisted-quantum-walks-in-photosynthetic-energ&quot;&gt;this&lt;/a&gt; I pointed out that if the excitations were in a vacuum with no vacuum modes (in QED, even a vacuum has modes that can interact with the excitations), then the energy would just transfer back and forth (&lt;a href=&quot;https://en.wikipedia.org/wiki/Rabi_cycle&quot; rel=&quot;noreferrer&quot;&gt;Rabi oscillations&lt;/a&gt;) indefinitely due to the quantum version of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Poincar%C3%A9_recurrence_theorem#Quantum_mechanical_version&quot; rel=&quot;noreferrer&quot;&gt;Poincaré recurrence theorem&lt;/a&gt;. You can see that when I turned on the decoherence, these Rabi oscillations didn't just get damped, but also the excitation was &quot;funneled&quot; towards the reaction center, hence allowing it to fuel the subsequent photosynethesis. This is why it's called &quot;decoherence-driven&quot; energy transfer, and why you say that quantum effects take place &quot;without the negative effects of decoherence&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;The implications for quantum computing are more subtle though.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the coherence was practically gone after 1ps (notice the Rabi oscillations are gone at 1ps). This means the decoherence is still bad, in fact &lt;strong&gt;&lt;em&gt;much&lt;/em&gt;&lt;/strong&gt; worse than in some quantum computer candidates such as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1985/2293&quot;&gt;phosphorous-doped silicon&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Said another way, the coherence is killed in the FMO within about 1ps, whereas in phosphorous-doped silicon it was made to last more than a &lt;strong&gt;&lt;em&gt;trillion&lt;/em&gt;&lt;/strong&gt; times longer than 1ps. You should not be surprised by this difference of 12 orders of magnitude, since the FMO was not meant to be a quantum computer (it is a wet, noisy, environment full of decoherence sources), while the phosphorous-doped silicon experiments were purposely done in conditions that would allow the authors to get the longest room-temperature coherence time possible. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;So in summary: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;decoherence helps photosynthesis work,   &lt;/li&gt;&#xA;&lt;li&gt;decoherence happens rapidly in the FMO (roughly 1ps, vs seconds for some QC candidates) &lt;/li&gt;&#xA;&lt;li&gt;circuit-based quantum computers require long coherence times&lt;/li&gt;&#xA;&lt;li&gt;circuit-based quantum computers will not perform well if coherence is completely lost after 1ps, especially if the quantum gates take 100ns each (which is a realistic estimate for superconducting QCs).&lt;/li&gt;&#xA;&lt;li&gt;Therefore I would not choose excitations in chromophores for the qudits in a circuit-based quantum computer. Such a quantum computer is less likely to be as capable as the machines currently being made by the real companies who are trying very hard to make good quantum computers: IBM, Google, D-Wave, Rigetti, Intel, Alibaba, etc. all use superconducting systems, not biological chromophores).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The bottom line is that it is &lt;strong&gt;&lt;em&gt;very&lt;/em&gt;&lt;/strong&gt; interesting that we are able to observe quantum coherence in the energy transfer of the FMO via coherent 2D spectroscopy, but this coherence does not last nearly as long as we need it to for fault-tolerant quantum computing, and QCs that have been engineered in the lab specifically to perform well at quantum computing, have much longer coherence times. &lt;strong&gt;&lt;em&gt;Otherwise, IBM, Google, D-Wave, Rigetti, Intel, Alibaba, etc. would be using biological chromophores, not superconducting qubits.&lt;/em&gt;&lt;/strong&gt; Those companies are well-aware of the quantum coherence in the FMO. In fact as stated in my first paragraph, Mohseni was the first to write about coherence in the FMO (in 2008) in this wave that started after Engel's 2007 paper. Guess where Mohseni works? Google. You said ENAQT was originally proposed by Patrick Rebentrost. Patrick works at Xanadu, a company trying to make photonic QCs, not chromophoric QCs. Patrick's PhD supervisor Alan Aspuru-Guzik who authored (at least) 4 of the mentioned papers, including the DNA one you posted, was also the PhD adviser of multiple other people in Google and Rigetti's quantum teams. &lt;strong&gt;&lt;em&gt;These companies know about coherence in the FMO, employ many of the lead authors on those FMO papers, and if it was a good idea to build an FMO-inspired quantum computer, they would know it, but instead they all use superconducting qubits and sometimes ion-traps or photonics&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-28T01:57:25.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4100" PostTypeId="1" CreationDate="2018-08-28T02:46:19.393" Score="13" ViewCount="569" Body="&lt;p&gt;I am interested in the state of the art gate speeds and decoherence times for the qubit types I know are being pursued by companies presently:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;superconducting qubits,&lt;/li&gt;&#xA;&lt;li&gt;ion trap qubits,&lt;/li&gt;&#xA;&lt;li&gt;photonic qubits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Where can I find these, and is there a place where these are updated regularly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There have been various published tables depicting these times for various types of qubits over the years (including the famous Los Alamos National Lab QC Roadmap), but the numbers always change while the published papers don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I needed these numbers to answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4099/2293&quot;&gt;this question&lt;/a&gt; because I wanted to compare the 1ps decoherence time in the FMO to state-of-the-art decoherence times and gate times in popular candidates for QCs, so I went searching for some reasonable values for roughly this time period, but I don't anymore know where to look. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr&gt; &#xA;The longest coherence time ever measured was given in this answer, but no gate times were given: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1687/what-is-the-longest-time-a-qubit-has-survived-with-0-9999-fidelity/1985#1985&quot;&gt;What is the longest time a qubit has survived with 0.9999 fidelity?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;James Wootton talked about the advantages and disadvantages of the above three qubit types, but not the gate/decoherence times, in this answer: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1226/what-is-the-leading-edge-technology-for-creating-a-quantum-computer-with-the-few/1234#1234&quot;&gt;What is the leading edge technology for creating a quantum computer with the fewest errors?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-30T08:51:41.853" Title="State of the art gate speeds and decoherence times" Tags="&lt;quantum-gate&gt;&lt;architecture&gt;&lt;resource-request&gt;&lt;experiment&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4101" PostTypeId="2" ParentId="4100" CreationDate="2018-08-28T04:01:21.483" Score="4" Body="&lt;p&gt;I guess your best shot would be to look for experimental comparisons like this &#xA;&lt;a href=&quot;https://arxiv.org/pdf/1702.01852.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;one&lt;/a&gt; on Arxiv.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am not aware of a tracking. I do not think we can consider having a &quot;state of the art&quot; in this field. The goal being to make them always better of course with better connectivity for instance (a possible factor to take into account).&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-08-28T04:01:21.483" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4102" PostTypeId="1" CreationDate="2018-08-28T06:47:24.117" Score="4" ViewCount="177" Body="&lt;p&gt;How is it possible to maintain classical data encoded into qubits, which often contains copies of information, given that the no cloning theorem prevents cloning information?&lt;/p&gt;&#xA;" OwnerUserId="4446" LastEditorUserId="55" LastEditDate="2020-08-20T08:04:34.177" LastActivityDate="2020-08-20T08:04:34.177" Title="Cloning classical data encoded into qubits" Tags="&lt;no-cloning-theorem&gt;&lt;cloning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4103" PostTypeId="2" ParentId="4102" CreationDate="2018-08-28T12:59:19.147" Score="8" Body="&lt;p&gt;The no cloning theorem only applies when quantum information is in an unknown superposition. If you know a basis in which the state of some qubits is not under superposition, then you can make all the copies you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical information encoded directly into qubits is going to be in the computational basis state. Therefore you can clone it. You use CNOT operations to do it.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-08-28T12:59:19.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4104" PostTypeId="1" CreationDate="2018-08-29T07:26:28.780" Score="8" ViewCount="1055" Body="&lt;p&gt;I am trying to understand what the importance of tensor networks is (or will/could be) for quantum computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it make sense to study tensor networks deeply and develop them further to help pave the way towards quantum supremacy? If so, how could they help and what are the current most pressing research questions?&lt;/p&gt;&#xA;" OwnerUserId="4449" LastEditorUserId="26" LastEditDate="2018-12-14T06:28:28.810" LastActivityDate="2019-12-20T10:45:19.943" Title="What can tensor networks mean for quantum computing?" Tags="&lt;quantum-advantage&gt;&lt;research&gt;&lt;tensor-networks&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4105" PostTypeId="1" CreationDate="2018-08-29T09:27:53.127" Score="4" ViewCount="114" Body="&lt;p&gt;The magic square game is a two-player pseudo-telepathy game that was presented by Padmanabhan Aravind, who built on work by Mermin. In the magic square we have ones in columns (odd number) and rows (even number).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gfSVE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gfSVE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407221v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0407221v3&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;   A2=&#xA;  \frac12\left[ {\begin{array}{ccccc}&#xA;   i &amp;amp; 1 &amp;amp; 1 &amp;amp; i \\-i &amp;amp; 1 &amp;amp; -1 &amp;amp; i\\i &amp;amp; 1 &amp;amp; -1 &amp;amp; -i\\-i &amp;amp; 1 &amp;amp; 1 &amp;amp; -i   \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;  B3=&#xA; \frac1{\sqrt{2}}\left[ {\begin{array}{ccccc}&#xA;	1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\-1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0   \end{array} } \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have an input the entangled state shared by Alice and Bob&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ \mid \psi \rangle = \frac{1}{2}\mid0011 \rangle -\frac{1}{2}\mid0110 \rangle -\frac{1}{2}\mid1001 \rangle +\frac{1}{2}\mid1100 \rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider for example inputs  x =2 and y =3. After Alice and Bob apply A2 and B3 respectively, the state evolves to&#xA;$$&#xA;  A2 \otimes B3 \mid \psi\rangle = \frac{1}{2\sqrt{2}} \left[\mid0000\rangle -\mid0010\rangle -\mid0101\rangle +\mid 0111\rangle +\mid 1001\rangle +\mid 1011\rangle -\mid 1100\rangle -\mid 1110\rangle \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question is how to obtain this result. I did multiplication of the matrices&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ +(A2 \otimes B3) \mid 00 \rangle \otimes \mid 11 \rangle $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ -(A2 \otimes B3) \mid 01 \rangle \otimes \mid 10 \rangle $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ -(A2 \otimes B3) \mid 10 \rangle \otimes \mid 01 \rangle $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ +(A2 \otimes B3) \mid 11 \rangle \otimes \mid 00 \rangle $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the tensor product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ +(A2 \mid 00 \rangle \otimes B3\mid 11 \rangle $          part 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ -(A2 \mid 01 \rangle \otimes B3\mid 10 \rangle $          part 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ -(A2 \mid 10 \rangle \otimes B3\mid 01 \rangle $          part 3&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ +(A2 \mid 11 \rangle \otimes B3\mid 00 \rangle $          part 4&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's calculate part 2 with step 1 and step 2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA; 	step 1 = A2 | 01 \rangle =&#xA; 	\left[ {\begin{array}{ccccc}&#xA;	i &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\-i &amp;amp; 1 &amp;amp; -1 &amp;amp; 1\\i &amp;amp; 1 &amp;amp; -1 &amp;amp; -i\\-i &amp;amp; 1 &amp;amp; 1 &amp;amp; -i   \end{array} } \right] \left[ {\begin{array}{c} 0 \\ 1 \\ 0 \\ 0\end{array}} \right] =  \left[ {\begin{array}{c} 1 \\ 1 \\ 1 \\ 1\end{array}} \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;step 2 = B3 | 10 \rangle =&#xA;\left[ {\begin{array}{ccccc}&#xA;	1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\-1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0   \end{array} } \right] \left[ {\begin{array}{c} 0 \\ 0 \\ 1 \\ 0\end{array}} \right] =  \left[ {\begin{array}{c} 0 \\ 0 \\ 1 \\ -1\end{array}} \right]&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$ step1 \otimes step2 = \left[ {\begin{array}{c} 0 \\ 0 \\ 1 \\ -1 \\ 0 \\ 0 \\ 1 \\ -1 \\ 0 \\ 0 \\ 1 \\ -1 \\0 \\ 0\\ 1 \\ -1 \end{array}} \right] $&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the way to go?&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1837" LastEditDate="2018-08-29T10:00:06.450" LastActivityDate="2018-08-29T10:00:06.450" Title="How to calculate tensor product for the magic square" Tags="&lt;matrix-representation&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4106" PostTypeId="2" ParentId="4105" CreationDate="2018-08-29T09:59:41.757" Score="2" Body="&lt;p&gt;That is certainly one direction to go, which should ultimately lead to the right answer. Frankly, I'd just throw it into something like Mathematica and get it to calculate &lt;code&gt;KroneckerProduct[A2,B3]&lt;/code&gt;, and complete the calculation that way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you want to continue by hand, there are probably a few tricks that you can use in this special case. For example, take the two components&#xA;$$&#xA;|00\rangle|11\rangle+|11\rangle|00\rangle&#xA;$$&#xA;Ignoring normalisation for now, you can write these as&#xA;$$&#xA;(|00\rangle+|11\rangle)(|00\rangle+|11\rangle)-(|00\rangle-|11\rangle)(|00\rangle-|11\rangle).&#xA;$$&#xA;(You can do something similar for the $|01\rangle|10\rangle$ terms). Why does this help? The components on Bob's space (the last 2 qubits) transform really nicely under $B3$, so the maths suddenly gets a whole lot easier (Alice's get better as well). Indeed, each of the 4 terms (corresponding to Bell states on Bob's qubits) will map to a different basis state on Bob's system, so you'll be able to check the correct outcome term by term, instead of having to wait for the whole calculation and seeing what things cancel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first glance, the claimed output doesn't look right. According to Mathematica, the output should be&#xA;$$&#xA;\left\{\frac{i}{2 \sqrt{2}},0,-\frac{1}{2 \sqrt{2}},0,0,-\frac{i}{2&#xA;   \sqrt{2}},0,\frac{1}{2 \sqrt{2}},0,\frac{i}{2 \sqrt{2}},0,\frac{1}{2&#xA;   \sqrt{2}},-\frac{i}{2 \sqrt{2}},0,-\frac{1}{2 \sqrt{2}},0\right\}.&#xA;$$&#xA;Note the complex phases.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-08-29T09:59:41.757" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4107" PostTypeId="1" CreationDate="2018-08-29T12:16:49.933" Score="6" ViewCount="462" Body="&lt;p&gt;Hamiltionian Simulation (= simulation of quantum mechanical systems) is claimed to be one of the most promising applications of a quantum computer in the future.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One of the earliest – and most important – applications of a quantum&#xA;  computer is likely to be the simulation of quantum mechanical systems.&#xA;  There are quantum systems for which no efficient classical simulation&#xA;  is known, but which we can simulate on a universal quantum computer.&#xA;  What does it mean to “simulate” a physical system? According to the&#xA;  OED, simulation is “the technique of imitating the behaviour of some&#xA;  situation or process (whether economic, military, mechanical, etc.) by&#xA;  means of a suitably analogous situation or apparatus”. What we will&#xA;  take simulation to mean here is approximating the dynamics of a&#xA;  physical system. Rather than tailoring our simulator to simulate only&#xA;  one type of physical system (which is sometimes called analogue&#xA;  simulation), we seek a general simulation algorithm which can simulate&#xA;  many different types of system (sometimes called digital simulation)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For the details, check chapter 7 of the &lt;a href=&quot;https://people.maths.bris.ac.uk/~csxam/teaching/qc2018/lecturenotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; by Ashley Montaro.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Assuming tomorrow we have such a powerful universal quantum computer: &lt;em&gt;which&lt;/em&gt; &lt;em&gt;interesting problem&lt;/em&gt; (1) &lt;em&gt;based on simulating a quantum system&lt;/em&gt; (2) &lt;em&gt;for which a quantum algorithm is known, can we solve&lt;/em&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that it is important that a quantum algorithm is already known to solve this problem or at least that there is good evidence supporting that such quantum algorithm can be found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;em&gt;interesting&lt;/em&gt; I mean that it should have substantial impact beyond the field of quantum computing and quantum chemistry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;em&gt;interesting problem&lt;/em&gt; definitely includes finding molecules that can cure diseases, designing materials with specific characteristics.&lt;/p&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="26" LastEditDate="2018-12-13T20:04:52.660" LastActivityDate="2019-05-13T21:19:05.993" Title="Example of Hamiltonian Simulation solving interesting problem?" Tags="&lt;algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="3" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="4108" PostTypeId="1" CreationDate="2018-08-29T15:25:25.843" Score="6" ViewCount="585" Body="&lt;p&gt;In scientific literature, one typically describes Cooper pair boxes as a small superconducting island coupled to a superconducting reservoir (say, a large ground plane of superconducting metal, or a large piece in any case) via a Josephson junction. This is for example illustrated in panel c below, taken from &lt;a href=&quot;https://qudev.phys.ethz.ch/node/2182&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ooaNz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ooaNz.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main innovation of the transmon over the Cooper pair box was (if I am not mistaken) to shunt the island with a large capacitance, so as to decrease the sensitivity to charge. One can do this while maintaining the geometry of having an island and a large reservoir; see for example figure 1a of &lt;a href=&quot;https://arxiv.org/abs/1703.05643&quot; rel=&quot;nofollow noreferrer&quot;&gt;Anharmonicity of a Gatemon Qubit with a Few-Mode Josephson Junction by Kringhoj et al. (2017)&lt;/a&gt;, where their Josephson junction (in this case an SNS junction made from a nanowire) shunts a T shaped island to the ground plane, the reservoir in this case. The large capacitance here is to ground. I apologise for using an exotic transmon here, I couldn't find a nice picture of a standard one; &lt;a href=&quot;https://arxiv.org/abs/1710.07466&quot; rel=&quot;nofollow noreferrer&quot;&gt;Studying Light-Harvesting Models with Superconducting Circuits by Potocnik et al. (2017)&lt;/a&gt; has grounded $\require{\mhchem}\ce{AlOx}$ transmons in figure 1b, but the level of zoom is a little low.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But something that I often see in modern transmon designs is that it is not a shunted island coupled to a reservoir; it is instead two coupled islands; take this figure from &lt;a href=&quot;http://blog.qutech.nl/index.php/2017/08/13/how-to-make-artificial-atoms-out-of-electrical-circuits-part-ii-circuit-quantum-electrodynamics-and-the-transmon/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The capacitance here is between the two plates themselves. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hBC7r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hBC7r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Optically and intuitively, I would say that this is a rather different device; instead of having a small, isolated (up to Josephson coupling) island coupled to a large reservoir with a very large number of charges (which might even be grounded), one now has two such small, isolated islands with a small number of charges, galvanically isolated from the rest of the circuit. Moreover, the capacitance is now not to ground, but between the islands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I know that the Hamiltonian of these systems does not care about this difference; what matters is the number of Cooper pairs which have tunnelled &lt;em&gt;across&lt;/em&gt; the junction, not the actual number of charges &lt;em&gt;on&lt;/em&gt; the island(s). What my question is, is how in practice these devices &lt;em&gt;do&lt;/em&gt; differ; why would one make their transmon in one way or the other? What constraints/considerations/findings have led modern designs to favour the two island version (if this is even true)? Do they have a better life and or coherence times, and if so, why? I've been trying to find literature that talks about the distinction between the two, but I have been unsuccessful. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This has been &lt;a href=&quot;https://physics.stackexchange.com/questions/425302/transmons-and-cooper-pair-box-qubits-two-islands-or-a-single-island-and-a-reser&quot;&gt;cross posted on Physics SE&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="271" LastEditorUserId="26" LastEditDate="2018-09-02T17:46:26.237" LastActivityDate="2018-12-22T12:01:00.187" Title="Transmons and cooper pair box qubits: two islands or a single island and a reservoir" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;architecture&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4109" PostTypeId="2" ParentId="4107" CreationDate="2018-08-29T15:42:02.667" Score="4" Body="&lt;p&gt;It's not an area I personally know much about, but I know that many of my physicist friends are excited about being able to investigate the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hubbard_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hubbard Model&lt;/a&gt; on larger lattices than we can simulate today. There are known and published algorithms for finding the ground state energy, computing Green's functions, and other important characteristics of the model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hope is that understanding the Hubbard model on larger, more realistic lattices might help us understand superconductivity better, and in particular lead to materials that stay superconducting at higher and higher temperatures.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2018-08-29T15:42:02.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4110" PostTypeId="1" AcceptedAnswerId="4132" CreationDate="2018-08-29T20:20:35.390" Score="5" ViewCount="552" Body="&lt;h2&gt;Context and Motivation:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;As discussed &lt;a href=&quot;https://math.stackexchange.com/questions/84495/computational-complexity-of-least-square-regression-operation&quot;&gt;here&lt;/a&gt;, in multilinear regression, we can express the linear system as $AX = b$. This leads to $A^TA \hat{X} = A^T b$. From here, the estimated value of $X$ is calculated as $(A^TA)^{-1}A^Tb$. The whole process basically involves three steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Matrix multiplication&lt;/strong&gt; of $A$ and $A^T$:  $\mathcal{O}(C^2N)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Matrix multiplication&lt;/strong&gt; of $A^T$ and column matrix $b$: $\mathcal{O}(CN)$&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;LU/Cholesky factorization of matrix $A^T A$ used to compute the product $(A^TA)^{-1}A^Tb$: $\mathcal{O}(C^3)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: $N$ is the number of training samples. $C$ is the number of features/variables.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Questions:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I guess we could speed up step $3$ by using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL&lt;/a&gt; although I guess that would be worth it only if $C$ is sufficiently large i.e. $C\lesssim N$. But is there any quantum algorithm to speed up steps 1 and 2 (which involve matrix multiplication)? The &lt;a href=&quot;https://en.wikipedia.org/wiki/Coppersmith%E2%80%93Winograd_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;fastest classical matrix multiplication&lt;/a&gt; algorithms as of today have time complexities around $\mathcal{O}(N^{2.37})$. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So:&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Can we do better than that? What are state-of-the-art &lt;em&gt;general purpose&lt;/em&gt; quantum algorithms as of today, as far as matrix&#xA;  multiplication is concerned?&lt;/strong&gt; &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;(By &quot;general purpose&quot; I mean that the&#xA;  algorithm should have no specific restrictions on the elements of the&#xA;  matrices. An user &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4110/how-to-speed-up-the-matrix-multiplication-steps-in-multi-linear-regression#comment4583_4110&quot;&gt;mentioned&lt;/a&gt; in the comments that there are different quantum matrix multiplication algorithms depending on sparsity, condition number, etc. which sounds reasonable to me. So any answer which lists and summarizes the best quantum algorithms for different such conditions/restrictions is also welcome.)&lt;/p&gt;&#xA;  &#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;&lt;strong&gt;Would the state-of-the-art quantum matrix multiplication algorithm(s) coupled with HHL help to produce an &lt;em&gt;overall reduction&lt;/em&gt; in the time complexity&#xA;  (considering all the three steps as a whole) of multilinear&#xA;  regression? If yes, by how much?&lt;/strong&gt; &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;(I'm looking for an asymptotic analysis as in &lt;a href=&quot;https://math.stackexchange.com/a/84503/568976&quot;&gt;here&lt;/a&gt; which states that the &lt;em&gt;overall&lt;/em&gt; time complexity of classical multilinear regression at best is $\mathcal{O}(C^2N)$).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;strong&gt;Note&lt;/strong&gt;:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Please &lt;em&gt;summarize&lt;/em&gt; any algorithm you mention (along with the constraints involved). It is practically impossible for people to read each and every paper referenced in order to check whether it suits their criteria! &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-09-01T07:25:45.100" LastActivityDate="2019-02-01T22:35:04.090" Title="How to speed up the matrix multiplication steps in multi-linear regression?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4111" PostTypeId="1" AcceptedAnswerId="4116" CreationDate="2018-08-29T20:39:01.220" Score="3" ViewCount="275" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;A quantum gyroscope is a very sensitive device to measure angular rotation based on quantum mechanical principles. The first of these has been built by Richard Packard and his colleagues at the University of California, Berkeley. The extreme sensitivity means that theoretically, a larger version could detect effects like minute changes in the rotational rate of the Earth.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is a section on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_gyroscope&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; titled &lt;strong&gt;Equation&lt;/strong&gt; with no information in it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can any one help fill in the blank?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-08-30T13:55:14.593" Title="Equation for Quantum Gyroscopes" Tags="&lt;foundations&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4112" PostTypeId="2" ParentId="4110" CreationDate="2018-08-29T20:48:42.867" Score="5" Body="&lt;p&gt;You were correct to seek a new quantum algorithm for this rather than just using HHL to do step 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are separate quantum algorithms to do regressions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.109.050505&quot; rel=&quot;noreferrer&quot;&gt;&#xA;Quantum Algorithm for Data Fitting&lt;/a&gt; (same journal and same last author as HHL)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1402.0660&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithm for Linear Regression&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://dl.acm.org/citation.cfm?id=3031516&quot; rel=&quot;noreferrer&quot;&gt;Fast quantum algorithms for least squares regression and statistic leverage scores&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1601.07823&quot; rel=&quot;noreferrer&quot;&gt;Prediction by linear regression on a quantum computer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There is an interesting note about the $\mathcal{O}(N^{2.37})$ algorithm you mention for matrix multiplication. The constant hidden under the big O is larger than the number of particles in the visible universe. That is why almost 100% of the implementations (for example in MATLAB, BLAS, LAPACK, etc.) use &lt;a href=&quot;https://en.wikipedia.org/wiki/Strassen_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Strassen's algorithm&lt;/a&gt; which has scaling $\mathcal{O}(N^{2.81})$.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-08-29T20:48:42.867" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="4113" PostTypeId="1" AcceptedAnswerId="4124" CreationDate="2018-08-30T04:28:31.417" Score="3" ViewCount="338" Body="&lt;p&gt;I'm a bachelor in Mechanical Engineering, currently pursuing Masters in Nanotechnology. I am interested to pursue a career in the field of quantum computing. I have got a basic understanding of electronics and quantum mechanics. But poor understanding in the area of computer science.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What qualities/prerequisites are required to pursue a career in the above-mentioned field? Will my weakness in computer science pose any hurdles in the future?&lt;/p&gt;&#xA;" OwnerUserId="4460" LastEditorUserId="26" LastEditDate="2018-12-23T13:00:16.040" LastActivityDate="2018-12-23T13:00:16.040" Title="Prerequisites for a career in spintronics based Quantum Computing" Tags="&lt;spintronics&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ClosedDate="2018-09-17T08:28:24.147" ContentLicense="CC BY-SA 4.0" />
  <row Id="4114" PostTypeId="2" ParentId="4107" CreationDate="2018-08-30T08:02:27.393" Score="2" Body="&lt;p&gt;I consider the leading candidate (considering you explicitly excluded quantum chemistry and hence all of biochemistry) the calculation of nuclear properties: This will, with suitable quantum computers, one day allow to compare experimental, atomic physics with theoretical (quantum computer calculated) values from the standard model. It's not entirely science fiction either, see &lt;a href=&quot;https://physics.aps.org/articles/v11/51&quot; rel=&quot;nofollow noreferrer&quot;&gt;this viewpoint about such a calculation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastActivityDate="2018-08-30T08:02:27.393" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4115" PostTypeId="2" ParentId="4100" CreationDate="2018-08-30T08:51:41.853" Score="4" Body="&lt;p&gt;You could also look at the following webpage:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputingreport.com/scorecards/qubit-quality/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumcomputingreport.com/scorecards/qubit-quality/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where they provide recent (I'm not sure how often they update this scores) values for gate fidelities and decoherece times for IBM and Rigetti chips (unfortunately they don't give any results on ion traps and photonics, since these machines are not well described by commercial companies).&lt;/p&gt;&#xA;" OwnerUserId="563" LastActivityDate="2018-08-30T08:51:41.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4116" PostTypeId="2" ParentId="4111" CreationDate="2018-08-30T13:55:14.593" Score="2" Body="&lt;p&gt;By a quantum gyroscope, it is usually meant a device or a sensor capable of measuring the same quantities as a classical gyroscope, namely angular velocities or orientations but with extremely higher precision, limited only by the Heisenberg uncertainty due to the exploitation of the quantum nature of the sensor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The principle of measurement accuracy enhancement to the Heisenberg uncertainty limit, by means of quantum operations such as entanglement and squeezing is general and should be implementable in various technologies. Please see the following &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412078v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;review&lt;/a&gt; by Giovannetti, Lloyd and Maccone. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This principle was used by &lt;a href=&quot;http://www.physics.arizona.edu/~cronin/Research/Publications/otherarticles/optimization%20alex%20july4/optimization%20paper%20references/related%20(not%20cited)%20references/DOW98.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dowling&lt;/a&gt; to propose a quantum gyroscope based on an atomic &lt;a href=&quot;https://en.wikipedia.org/wiki/Mach%E2%80%93Zehnder_interferometer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mach-Zehnder&lt;/a&gt; interferometer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Angular velocity  measurement by means of interferometry is based on the  &lt;a href=&quot;https://en.wikipedia.org/wiki/Sagnac_effect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sagnac effect&lt;/a&gt;, where when a quantum particle moves around a closed loop in a rotating system, it acquires a geometric phase proportional to the angular velocity $\omega$ and the loop area $A$:&#xA; $$\phi = \frac{8 \pi}{\lambda c} \omega A$$ &#xA;$\lambda$ is the wavelength and $c$ is speed of light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Remark: holonomic quantum computing gates are based on Non-Abelian generalization of this phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Dowling quantum gyroscope setup is depicted in the following diagram (extracted from Dowling's paper), &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Aa2b1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Aa2b1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where two beams of particles or modes $A$ and $B$ are split at a first beam splitter, reflected by mirrors and recombined at a second beam splitter.  Two detectors are used to count the particle numbers at the output. A rather straightforward analysis (given in the Dowling's reference) shows that the geometric phase can be computed from the sum and difference of the detectors measurements.&#xA;Dowling showed that the input beams are in a separable state:&#xA;$$|\psi \rangle_{I} = |N\rangle_A |0\rangle_B $$&#xA;The phase measurement accuracy is the classical shot noise limit:&#xA;$$\Delta \phi \approx \frac{1}{\sqrt{N}}$$&#xA;While when the input beams are in the entangled state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$|\psi \rangle_{II} = \frac{1}{\sqrt{2}} \left ( |\frac{N+1}{2}\rangle_A |\frac{N-1}{2}\rangle_B + |\frac{N-1}{2}\rangle_A |\frac{N+1}{2}\rangle_B \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase measurement accuracy reaches the Heisenberg limit:&#xA;$$\Delta \phi \approx \frac{1}{N}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_radar&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum radars&lt;/a&gt;, exactly the same principle (i.e., scattering entangled states) is used to enhance the accuracy to the Heisenberg limit.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-08-30T13:55:14.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4117" PostTypeId="2" ParentId="1472" CreationDate="2018-08-30T14:54:19.240" Score="3" Body="&lt;p&gt;&lt;strong&gt;None.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum race is lead by those entities capable of building the most powerful quantum computer and it are enterprises like IBM, Google, Intel, Microsoft, D-Wave that are currently building the most powerful quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it are enterprises that are leading this race and not countries.&lt;/p&gt;&#xA;" OwnerUserId="2529" LastActivityDate="2018-08-30T14:54:19.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4118" PostTypeId="1" AcceptedAnswerId="4121" CreationDate="2018-08-30T16:44:48.667" Score="14" ViewCount="1829" Body="&lt;p&gt;Suppose we have a single qubit with state $| \psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle$.  We know that $|\alpha|^2 + |\beta|^2 = 1$, so we can write $| \alpha | = \cos(\theta)$, $| \beta | = \sin(\theta)$ for some real number $\theta$.  Then, since only the relative phase between $\alpha$ and $\beta$ is physical, we can take $\alpha$ to be real.  So we can now write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$| \psi \rangle = \cos(\theta) | 0 \rangle + e^{i \phi} \sin(\theta)| 1 \rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My Question:&lt;/strong&gt;  Why are points on the Bloch sphere usually associated to vectors written as&#xA;$$| \psi \rangle = \cos(\theta/2) | 0 \rangle + e^{i \phi} \sin(\theta/2)| 1 \rangle$$&#xA;instead of as I have written?  Why use $\theta /2$ instead of just $\theta$?&lt;/p&gt;&#xA;" OwnerUserId="4465" LastEditorUserId="55" LastEditDate="2019-11-07T19:13:06.723" LastActivityDate="2019-11-07T19:13:06.723" Title="Why are half angles used in the Bloch sphere representation of qubits?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4119" PostTypeId="2" ParentId="4118" CreationDate="2018-08-30T17:32:33.513" Score="1" Body="&lt;p&gt;It is just a convention for $ 0 \le \theta \le \pi $.&#xA;You can write it your way (indeed you can &quot;include&quot; a constant in a variable) but in that case $ 0 \le \theta \le \pi / 2 $.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we take this convention for unique coordinates.&#xA;If you refer to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spherical_coordinate_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spherical coordinate system&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see that if you want a unique set of spherical coordinates for each point of the sphere, you need to restrict their range.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-08-30T17:40:56.093" LastActivityDate="2018-08-30T17:40:56.093" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4120" PostTypeId="2" ParentId="4118" CreationDate="2018-08-30T17:44:05.737" Score="6" Body="&lt;p&gt;If we use the convention&#xA;$$| \psi \rangle = \cos(\theta) | 0 \rangle + e^{i \phi} \sin(\theta)| 1 \rangle$$ then the North ($\theta=0$) and the South ($\theta=\pi)$ are (physically) the same state $|0\rangle$;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we use the convention$$| \psi \rangle = \cos(\theta/2) | 0 \rangle + e^{i \phi} \sin(\theta/2)| 1 \rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then North is $|0\rangle$ and South is $|1\rangle$ which is better.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2018-08-30T17:49:13.607" LastActivityDate="2018-08-30T17:49:13.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4121" PostTypeId="2" ParentId="4118" CreationDate="2018-08-30T17:55:40.320" Score="11" Body="&lt;p&gt;It is a convention, chosen so that $\theta$ is the azimuthal angle of the point representing the state in the Bloch sphere. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see where this convention comes from,&#xA;start from a state $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$. Remembering the normalisation constraint $|\alpha|^2+|\beta|^2=1$, and assuming without loss of generality $\alpha\in\mathbb R$, a natural way to parametrise the state is by defining an angle $\gamma$ such that $|\alpha|=\alpha=\cos\gamma$ and $|\beta|=\sin\gamma$:&#xA;$$|\psi\rangle=\cos\gamma|0\rangle + e^{i\varphi}\sin\gamma|1\rangle.$$&#xA;However, let us consider the coordinates of a generic (pure) state $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$ in the Bloch sphere representation:&#xA; $$\newcommand{\on}[1]{\operatorname{#1}}\newcommand{\bs}[1]{\boldsymbol{#1}}&#xA;x\equiv\langle\psi|\sigma_x|\psi\rangle,\\&#xA;y\equiv\langle\psi|\sigma_y|\psi\rangle,\\&#xA;z\equiv\langle\psi|\sigma_z|\psi\rangle.&#xA;$$&#xA;In particular, the last equation above is easily seen to give&#xA;$z=|\alpha|^2-|\beta|^2$.&#xA;Using our &quot;natural&quot; parametrisation with $\gamma$ we therefore get that $z=\cos^2\gamma-\sin^2\gamma=\cos(2\gamma)$.&#xA;But the standard way to parametrise a sphere is by having $z=\cos\theta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to be consistent with the regular conventions for spherical coordinates we therefore have to choose $\gamma=\theta/2$.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-08-30T18:02:22.973" LastActivityDate="2018-08-30T18:02:22.973" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4122" PostTypeId="2" ParentId="4118" CreationDate="2018-08-30T18:51:10.183" Score="5" Body="&lt;p&gt;Let $\hat{n}=(\cos\phi\sin\theta,\sin\phi \sin\theta,\cos\theta)$ i.e. the Cartesian coordinate vector for a point on the unit sphere with polar angle $\theta$ and azimuthal angle $\phi$. By sending a spin-1/2 particle through a Stern-Gerlach device with orientation $\hat{n}$, we can measure the observable &lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;S_n:=\vec{S}\cdot \hat{n}&#xA;&amp;amp;=S_x \cos\phi\sin\theta +S_y \sin\phi \sin\theta+S_z \cos\theta\\ &amp;amp;= \frac{\hbar}{2}\begin{pmatrix} \cos\theta &amp;amp; \cos\phi\sin\theta-i \sin\phi \sin\theta\\ \cos\phi\sin\theta+i \sin\phi \sin\theta &amp;amp; -\cos\theta\end{pmatrix} \\&amp;amp;= \begin{pmatrix} \cos \theta &amp;amp; e^{-i\phi}\sin\theta \\ e^{i\phi}\sin\theta &amp;amp; -\cos\theta\end{pmatrix}&#xA;\end{align}&#xA;in the $S_z$ basis. The obvious step is now to determine eigenvalues and eigenvectors. But if we denote the spin-up and spin-down eigenstates of $S_z$ as $|0\rangle$ and $|1\rangle$ respectively, then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$| \psi \rangle = \cos(\theta/2) |0 \rangle + e^{i \phi} \sin(\theta/2)| 1 \rangle=\begin{pmatrix} \cos(\theta/2)\\ e^{i\phi}\sin(\theta/2)\end{pmatrix}$$ and therefore &#xA;\begin{align}&#xA;S_n |\psi\rangle &#xA;&amp;amp;= \frac{\hbar}{2}\begin{pmatrix} \cos \theta &amp;amp; e^{-i\phi}\sin\theta \\ e^{i\phi}\sin\theta &amp;amp; -\cos\theta\end{pmatrix}\begin{pmatrix} \cos(\theta/2)\\ e^{i\phi}\sin(\theta/2)\end{pmatrix}  \\&#xA;&amp;amp;= \frac{\hbar}{2}\begin{pmatrix} \cos(\theta)\cos(\theta/2)+\sin(\theta)\sin(\theta/2)\\ e^{i\phi}[\sin(\theta)\cos(\theta/2)-\cos(\theta)\sin(\theta/2)]\end{pmatrix}\\&#xA;&amp;amp;= \frac{\hbar}{2}\begin{pmatrix} \cos(\theta/2)\\ e^{i\phi}\sin(\theta/2)\end{pmatrix}=+\frac{\hbar}{2}|\psi\rangle &#xA;\end{align}&#xA;where in the second-to-last equality I've used the trigonometric product-to-sum formula. Hence $|\psi\rangle$ is the $S_n=+\hbar/2$ eigenstate. In other words: If a spin-1/2 particle passes through an SG device with orientation $\hat{n}$ and comes out deflected up, then $|\psi\rangle$ is the resulting spin state. (Correspondingly, one can show that $S_{-n}|\psi\rangle=-\hbar/2|\psi\rangle$ i.e. $|\psi\rangle$ will deflect down if the SG device is flipped.) The upshot is that $\theta,\phi$ are not angles in Hilbert space; rather, they're the angles in real space for the SG device for which $|\psi\rangle$ is the spin state of the upward-deflected beam.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the above description is limited to points on the &lt;em&gt;surface&lt;/em&gt; of the Bloch sphere i.e pure states. For points on the interior of the Bloch sphere, we need to go to the density matrix formalism as presented by gLs and I'll defer to that answer.&lt;/p&gt;&#xA;" OwnerUserId="171" LastActivityDate="2018-08-30T18:51:10.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4123" PostTypeId="2" ParentId="4107" CreationDate="2018-08-30T19:52:07.797" Score="4" Body="&lt;p&gt;Several graph theory problems such as Graph Coloring (which is NP-complete) can be cleverly mapped to finding ground states of some classes of Hamiltonians. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1705.03082&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph Partitioning using Quantum Annealing on&#xA;the D-Wave System&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1572528610000721&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum annealing of the graph coloring problem&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4467" LastEditorUserId="26" LastEditDate="2019-05-13T21:19:05.993" LastActivityDate="2019-05-13T21:19:05.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4124" PostTypeId="2" ParentId="4113" CreationDate="2018-08-31T01:46:00.597" Score="3" Body="&lt;p&gt;If you are pursuing a Masters and are interested in pursuing a career in quantum computing research, the next step would be to do a PhD. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most PhD students in quantum computing lack strength in some area of quantum information science. People that enter their PhD with an undergrad in CS might have a weak background in physics, people with a background in physics might have a weak background in cryptography, people with a background in pure mathematics might have a weak background in engineering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most PhD programs will give you plenty of time to take CS courses, and you can also start reading Theory of Computation by Michael Sipser  which is not very expensive (and will be in almost all university libraries) and is a beautifully written, simple, gentle introduction to many CS branches important to quantum computing such as complexity theory and cryptography, with no pre-requesites at all except for a desire to learn CS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also depends on what you want your focus to be. I know plenty of experimentalists in spintronics who do not know any CS and know very little math or even quantum physics, but they know how to do a very good job of their experiments. If you do want to be a world-class quantum computing researcher you should at least be familiar with the introductory topics such as complexity theory, even though spintronics itself is far less related to CS than many other quantum computing sub-fields.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do warn you that spintronics might not be the most promising sub-field of quantum computing right now though. NMR and ESR-based quantum computing was very popular in the 90s but has died down since there are scalability issues that have kept the maximum number of spin qubits down to only 12 qubits (even with NV Centers and Phosphorus-doped Silicon, which are two slightly newer spin-based technologies which have been proposed to be more promising than more traditional NMR/ESR proposals).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superconducting qubits are the most popular among the major quantum hardware companies right now, and likely will remain that way for the next few years (which is presumably when you'd be doing your PhD). If you don't want to work in a &quot;crowded&quot; area, but still want to work on something more promising than spintronics, ion-traps and photonic quantum computers are the two next most popular QC sub-fields for QC implementation.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-08-31T03:33:37.297" LastActivityDate="2018-08-31T03:33:37.297" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4125" PostTypeId="1" AcceptedAnswerId="4127" CreationDate="2018-08-31T02:37:41.290" Score="4" ViewCount="127" Body="&lt;p&gt;After getting help here with &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2333/quantum-xnor-gate-construction&quot;&gt;XNOR&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2346/quantum-ripple-carry-adder-construction&quot;&gt;RCA&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2352/quantum-xor-linked-list-construction&quot;&gt;XOR linked lists&lt;/a&gt;, I am now curious about &lt;em&gt;quantum XOR ciphers&lt;/em&gt; (Google returns &quot;no results&quot;). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In cryptography, the simple XOR cipher is a type of additive cipher, an encryption algorithm that operates according to the principles:&lt;br&gt;&lt;br&gt;&#xA;  $A  \oplus  0 = A$,&lt;br&gt;&#xA;  $A  \oplus  A = 0$,&lt;br&gt;&#xA;  $(A  \oplus  B)  \oplus  C = A  \oplus  (B  \oplus  C)$,&lt;br&gt;&#xA;  $(B  \oplus  A)  \oplus  A = B  \oplus  0 = B$,&lt;br&gt;&lt;br&gt;&#xA;  where $\oplus$  denotes the exclusive disjunction (XOR) operation.&lt;br&gt;&lt;br&gt;&#xA;  -&lt;a href=&quot;https://en.wikipedia.org/wiki/XOR_cipher&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How would a quantum XOR cipher be expressed?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-08-31T03:02:16.860" LastActivityDate="2018-08-31T17:18:41.190" Title="Quantum XOR Cipher Construction" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4126" PostTypeId="1" AcceptedAnswerId="8607" CreationDate="2018-08-31T10:02:20.183" Score="20" ViewCount="636" Body="&lt;p&gt;I'm interested in the conversion between different sets of universal gates. For example, it is known that each of the following sets is universal for quantum computation:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\{T,H,\textrm{cNOT}\}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\{H,\textrm{c}S\}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S=T^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S^2=Z$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{c}S = \lvert 0 \rangle\!\langle 0 \rvert {\,\otimes\,} \mathbf 1 + \lvert 1 \rangle\!\langle 1 \rvert {\,\otimes\,} S$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\{H,\textrm{ccNOT}\}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\textrm{ccNOT}$&lt;/span&gt; is also known as the Toffoli gate. Note that this case requires the introduction of an extra ancilla bit that records whether each of the amplitudes is real or imaginary, so that the entire computation only uses real amplitudes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, let's say I've proven that the first set is universal. How can I write this set in terms of gates from the other sets? (It is possible that it is not possible perfectly.) The problem is that the other two cases are proven using a denseness in a particular space argument (&lt;a href=&quot;http://iopscience.iop.org/article/10.1070/RM1997v052n06ABEH002155/meta&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205115&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, much as you would use between &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; to generate arbitrary single-qubit rotations for the first set), each using a different subspace, and not by converting from one set to another. Is there an exact, direct conversion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The particular sticking points are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(2 to 1): creating &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; from controlled-&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. I could also accept creating any single-qubit phase gate that is not &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;(3 to 1): creating a controlled-Hadamard from &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and Toffoli. (Controlled-Hadamard is the equivalent of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; if the target is the ancilla qubit.) Alternatively, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301040&quot; rel=&quot;noreferrer&quot;&gt;Aharonov&lt;/a&gt; gives us a way to convert 3 to 2, so the (2 to 1) step would be sufficient.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For reference, section 4 of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205115&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; seems to make some steps related to achieving the (3 to 1) case, but in aiming for generality, pedagogy has perhaps fallen by the wayside slightly.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Update&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I recently came across &lt;a href=&quot;https://arxiv.org/abs/1206.5236&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; which essentially gives a necessary and sufficient condition for a given single-qubit unitary to be expressible in terms of a finite sequence of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates. Building similar results for the other gate sets (e.g. necessary and sufficient condition for creating a two-qubit gate from &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$cS$&lt;/span&gt;) would be a rigorous way of resolving this question one way or another.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-09T09:12:55.317" LastActivityDate="2019-10-29T21:32:57.247" Title="Explicit Conversion Between Universal Gate Sets" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="10" FavoriteCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4127" PostTypeId="2" ParentId="4125" CreationDate="2018-08-31T12:17:37.637" Score="6" Body="&lt;p&gt;There are two simple ways in which you can generalise an &quot;XOR cipher&quot; (&lt;em&gt;i.e.&lt;/em&gt;,&amp;nbsp;a &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;nofollow noreferrer&quot;&gt;one-time pad or Vernam cipher&lt;/a&gt;) to the quantum regime.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One way is to use the fact that the Pauli operators form a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_t-design&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum 1-design&lt;/a&gt;, which is a fancy way of saying that applying a uniformly random Pauli operator to any single-qubit quantum state makes it indistinguishable from the maximally mixed state &amp;mdash; provided of course that &lt;em&gt;which&lt;/em&gt; Pauli operator you perform is kept secret from any interfering party.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this fact, you can realise a simple &quot;quantum XOR cipher&quot; between Alice and Bob by sharing a one-time pad between them, and then doing the following for any input state $\rho$ of Alice's:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice takes two bits $(x,z)$ from the one-time pad, and performs the transformation $\rho \mapsto \sigma := P \rho P^\dagger$, where $P = X^x Z^z$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice transmits $\sigma$ to Bob. By averaging over all values of $(x,z) \in \{00,01,10,11\}$ it is easy to see that, to someone who doesn't know the value of $(x,z)$, the state $\sigma$ is indistinguishable from $\tfrac{1}{2} \mathbf 1$ and contains no information about the state $\rho$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bob recovers $\rho = P^\dagger \!\sigma P$ using the same operator $P = X^x Z^z$ defined by his copy of the one-time pad.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Building on this idea, another way of generalising the XOR cipher (as Craig Gidney indicates, and which seems to be part of the folklore, see for example &lt;a href=&quot;https://physics.stackexchange.com/a/14285/4976&quot;&gt;a post of mine on Physics.SE&lt;/a&gt;), is teleportation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the EPR state is akin to a shared random bit which is independent of any data which is to be encoded, and again must be carefully distributed between Alice and Bob.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The Bell-basis measurement performed by Alice is akin to computing the parity of the (arbitrary) input quantum state with that shared random bit;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The pair of classical bits which indicate the outcome play the role of the &lt;em&gt;result&lt;/em&gt; of the parity computation, which contain no information about the state which is being &quot;encoded&quot;;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The correction performed by Bob is akin to reversing the parity computation, reproducing the input state original possessed by Alice.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;An intriguing feature of this analogy is that, whereas a one-time pad &lt;em&gt;should&lt;/em&gt; only be used once, in the quantum regime the EPR pair &lt;em&gt;can only&lt;/em&gt; be used once, as it is consumed. Also intriguing is that what one would think of as the encoded quantum state is effectively stored by the system playing the role of the &lt;em&gt;shared random bit&lt;/em&gt; &amp;mdash; the outcome of the &quot;parity computation&quot; instead plays the role of the reversible encoding of that qubit (this part of the protocol is effectively the same as the encoding of a state using a random Pauli operator).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In both cases above, two random bits are involved in what might be thought of as the encoding procedure. This might seem deep, but actually, I would suggest that it is just the fact that a uniformly random Pauli operator is involved in both cases (albeit slightly more subtly in teleportation than in using the Pauli operators as a 1-design).&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-08-31T17:18:41.190" LastActivityDate="2018-08-31T17:18:41.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4129" PostTypeId="1" AcceptedAnswerId="4130" CreationDate="2018-08-31T18:43:59.720" Score="3" ViewCount="404" Body="&lt;p&gt;I've just learned about the density operator, and it seems like a fantastic way to represent the branching nature of measurement as simple algebraic manipulation. Unfortunately, I can't quite figure out how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a simple example: the state $|+\rangle$, which we will measure in the classical basis (so with measurement operator $I_2$). The density operator of this state is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\rho = |+\rangle\langle+| = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} ⊗ \begin{bmatrix} \frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}} \end{bmatrix}&#xA;= \begin{bmatrix} \frac 1 2 &amp;amp; \frac 1 2 \\ \frac 1 2 &amp;amp; \frac 1 2 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since measuring $|+\rangle$ in the classical basis collapses it to $|0\rangle$ or $|1\rangle$ with equal probability, I'm imagining there's some way of applying the measurement operator $I_2$ to $\rho$ such that we end up with the same density operator as when we &lt;em&gt;don't know&lt;/em&gt; whether the state is $|0\rangle$ or $|1\rangle$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\rho = \frac 1 2 \begin{bmatrix} 1 \\ 0 \end{bmatrix} ⊗ \begin{bmatrix} 1, 0 \end{bmatrix}&#xA;+ \frac 1 2 \begin{bmatrix} 0 \\ 1 \end{bmatrix} ⊗ \begin{bmatrix} 0, 1 \end{bmatrix}&#xA;= \begin{bmatrix} \frac 1 2 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}&#xA;+ \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; \frac 1 2 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From there, we can continue applying unitary transformations to the density operator so as to model a measurement occurring mid-computation. What is the formula for applying a measurement operator to the density operator? Looking in the Mike &amp;amp; Ike textbook section on the density operator, I only see the density operator measurement formula for a &lt;em&gt;specific&lt;/em&gt; measurement outcome. I'd like to know the density operator measurement formula which captures all possible results of the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a followup question, I'm also curious as to the formula when measuring some subset of multiple qubits.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2018-09-01T07:36:54.707" LastActivityDate="2018-09-01T07:36:54.707" Title="How is measurement modelled when using the density operator?" Tags="&lt;measurement&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4130" PostTypeId="2" ParentId="4129" CreationDate="2018-08-31T19:10:29.983" Score="3" Body="&lt;p&gt;To define a measurement, you need a set of measurement operators $P_i$, one for each possible measurement outcome, that satisfy a completeness relation&#xA;$$&#xA;\sum_iP_i=\mathbb{I}&#xA;$$&#xA;Let me specialise to the case of projective measurements, where $P_i^2=P_i$.&#xA;To calculate the probability of a given density operator $\rho$ giving outcome $i$, you simply calculate&#xA;$$&#xA;p_i=\text{Tr}(P_i\rho),&#xA;$$&#xA;and the state that you get as output is&#xA;$$&#xA;\rho_i=\frac{P_i\rho P_i}{p_i}.&#xA;$$&#xA;So, in the case of the measurement of a single qubit in the computational basis, you have&#xA;$$&#xA;P_0=|0\rangle\langle 0|\qquad P_1=|1\rangle\langle 1|,&#xA;$$&#xA;and you'll get $p_0=p_1=\frac12$. At that point, you proceed with using the separate measurement outcomes separately, unless there is a case where some other user doesn't know what the outcome was. Then they use a standard Bayesian approach to describe their state of knowledge as&#xA;$$&#xA;\tilde\rho=\sum_ip_i\rho_i.&#xA;$$&#xA;In this case, that's the maximally mixed state $\mathbb{I}/2$. But for anybody who knows what the measurement result is, you just keep going with the separate results. If it's too painful having to do the full calculation twice, you might do a trick like writing a state&#xA;$$&#xA;\frac12(P_0+P_1\pm(P_0-P_1)).&#xA;$$&#xA;Then you just do the calculation once and, at the end, choose either the + sign to see what happens for the 0 measurement result, or - to see what happens for the 1 result. But it probably doesn't actually reduce your workload.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to talk about $n$ qubits where you measure just the first one, then you use the measurement operators&#xA;$$&#xA;P_0=|0\rangle\langle 0|\otimes\mathbb{I}^{\otimes(n-1)}\qquad P_1=|1\rangle\langle 1|\otimes\mathbb{I}^{\otimes(n-1)}&#xA;$$&#xA;and apply all the same formalism as before.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-08-31T19:29:54.640" LastActivityDate="2018-08-31T19:29:54.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4132" PostTypeId="2" ParentId="4110" CreationDate="2018-08-31T22:51:52.327" Score="1" Body="&lt;p&gt;Maybe this &lt;a href=&quot;https://docs.google.com/viewer?url=https%3A%2F%2Fwww.researchgate.net%2Fpublication%2F301740109_Quantum_hyperparallel_algorithm_for_matrix_multiplication%2Ffulltext%2F573a1f5f08ae9ace840dc6ef%2F301740109_Quantum_hyperparallel_algorithm_for_matrix_multiplication.pdf%3Forigin%3Dpublication_detail&quot; rel=&quot;nofollow noreferrer&quot;&gt;one&lt;/a&gt; can be useful. Their algorithm is called quantum hyperparallel algorithm for matrix multiplication and they state that the time complexity is &lt;span class=&quot;math-container&quot;&gt;$O(N^2)$&lt;/span&gt; which is the lower bound for matrix multiplication apparently. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I won't describe the whole procedure but give just the idea behind.&#xA;You know matrix multiplication is just a calculation of inner products.&#xA;There is a quantum algorithm called the swap Test which enables you to compute the overlap (inner product) between quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They based their algorithm on it. It seems you have no restrictions on your matrices. You need however oracles like many quantum algorithms.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-02-01T22:35:04.090" LastActivityDate="2019-02-01T22:35:04.090" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4133" PostTypeId="2" ParentId="1206" CreationDate="2018-09-01T03:38:18.393" Score="8" Body="&lt;p&gt;Less formally-stated than the other answers, but for beginners I like the intuitive method outlined by Prof. Vazirani in &lt;a href=&quot;https://www.youtube.com/watch?v=wLWkHSpt_Zw&amp;amp;t=3m12s&quot; rel=&quot;noreferrer&quot;&gt;this video&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have a general two-qbit state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \begin{bmatrix} \alpha_{00} \\ \alpha_{01} \\ \alpha_{10} \\ \alpha_{11} \end{bmatrix} = \alpha_{00}|00\rangle + \alpha_{01}|01\rangle + \alpha_{10}|10\rangle + \alpha_{11}|11\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose you measure the most-significant (leftmost) qbit in the computational basis (as in, collapse it to either $|0\rangle$ or $|1\rangle$). There are two questions we might ask:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the probability that the measured qbit collapses to $|0\rangle$? What about $|1\rangle$?&lt;/li&gt;&#xA;&lt;li&gt;What is the state of the 2-qbit system after measurement?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the first question, the intuitive answer is this: take the sum of squares of all amplitudes associated with the value for which you want to find the probability of collapse. So, if you want to know the probability of the measured qbit collapsing to $|0\rangle$, you'd look at the amplitudes associated with cases $|00\rangle$ and $|01\rangle$, because those are the cases where the measured qbit is $|0\rangle$. Thus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P[|0\rangle] = |\alpha_{00}|^2 + |\alpha_{01}|^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for $|1\rangle$ you look at the amplitudes associated with cases $|10\rangle$ and $|11\rangle$, so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P[|1\rangle] = |\alpha_{10}|^2 + |\alpha_{11}|^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the state of the 2-qbit system after measurement, what you do is cross out all the components of the superposition which are inconsistent with the answer you got. So, if you measured $|0\rangle$, then the state after measurement is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\require{cancel} |\psi\rangle = \alpha_{00}|00\rangle + \alpha_{01}|01\rangle + \cancel{\alpha_{10}|10\rangle} + \cancel{\alpha_{11}|11\rangle} =  \alpha_{00}|00\rangle + \alpha_{01}|01\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this state is not normalized - the sum of squares does not add up to 1, and so you have to normalize it:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \frac{\alpha_{00}|00\rangle + \alpha_{01}|01\rangle}{\sqrt{|\alpha_{00}|^2 + |\alpha_{01}|^2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, if you measured $|1\rangle$ then you'd get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\require{cancel} |\psi\rangle = \cancel{\alpha_{00}|00\rangle} + \cancel{\alpha_{01}|01\rangle} + \alpha_{10}|10\rangle + \alpha_{11}|11\rangle = \alpha_{10}|10\rangle + \alpha_{11}|11\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalized:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \frac{\alpha_{10}|10\rangle + \alpha_{11}|11\rangle}{\sqrt{|\alpha_{10}|^2 + |\alpha_{11}|^2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that's how you calculate the action of measuring one qbit in a multi-qbit state, in the simplest case!&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-09-01T03:38:18.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4134" PostTypeId="2" ParentId="4110" CreationDate="2018-09-01T21:16:55.083" Score="-1" Body="&lt;p&gt;First of all the cost on a &lt;strong&gt;&lt;em&gt;classical&lt;/em&gt;&lt;/strong&gt; computer of the dominant step can be improved from the $\mathcal{O}(C^2 N)$ in your question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to bring the classical cost down to  $\mathcal{O}(C^{1.37} N)$&#xA; in my new answer to the &lt;a href=&quot;https://math.stackexchange.com/questions/84495/computational-complexity-of-least-square-regression-operation/2902084#2902084&quot;&gt;question on the Mathematics Stack Exchange&lt;/a&gt; that you linked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(1) can a quantum computer do step 1 in time faster than $\mathcal{O}(C^{1.37} N)$, and&lt;/li&gt;&#xA;&lt;li&gt;(2) would this lead to an overall reduction in complexity of the entire regression algorithm?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The answer to (2) is yes. If your quantum algorithm improves the classical $\mathcal{O}(C^{1.37} N)$, then it improves the whole algorithm because this is the step that &lt;strong&gt;&lt;em&gt;dominates&lt;/em&gt;&lt;/strong&gt; the complexity of the whole problem. This is because $N$ has to be bigger than $C$ for the matrix to be invertible, which was pointed out by Chris Taylor in &lt;a href=&quot;https://math.stackexchange.com/a/84503/202425&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to (1) is an open problem.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-09-02T08:52:59.863" LastActivityDate="2018-09-02T08:52:59.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4135" PostTypeId="1" AcceptedAnswerId="4381" CreationDate="2018-09-02T07:03:06.473" Score="3" ViewCount="196" Body="&lt;p&gt;What do the terms &quot;hyperparallel algorithm&quot; and &quot;hyperentangled states&quot; mean? I found it mentioned &lt;a href=&quot;https://www.nature.com/articles/srep24910&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;sup&gt;[1]&lt;/sup&gt;. In the abstract they say: &quot;Hyperentangled states, &lt;em&gt;entangled states with more than one degree of freedom&lt;/em&gt;, are considered as a promising resource in quantum computation&quot;, but I'm not sure they mean by &quot;degree of freedom&quot; in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: Quantum hyperparallel algorithm for matrix multiplication (&lt;em&gt;Zhang et al.&lt;/em&gt;, 2016)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-09T08:55:04.500" LastActivityDate="2018-10-10T09:32:10.143" Title="What do &quot;hyperparallel algorithm&quot; and &quot;hyperentangled state&quot; mean?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4136" PostTypeId="2" ParentId="4135" CreationDate="2018-09-02T09:14:38.737" Score="2" Body="&lt;p&gt;&quot;Hyperparellel algorithm&quot; is not a popular term at all and all instances of this phrase seem to be coming from the same group of co-authors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hyper-entanglement is at least used more in the &quot;mainstream&quot;, although it is still not a very common word to hear. In this &lt;a href=&quot;https://www.nasa.gov/pdf/636902main_Kwiat_Presentation.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation by NASA&lt;/a&gt; they define it as a system being entangled in more than one degree-of-freedom (DOF) at the same time. Here we have two photons that are entangled with respect to three different DOFs at the same time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z5lXS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z5lXS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1207.0168&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; there's two photons that are entangled with respect to polarization, and simultaneously also entangled in terms of their spatial DOF:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gPd5D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gPd5D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this definition, the authors of the paper you mention defined a hyper-CNOT and talked about &quot;hyper-parallel quantum computation&quot; as operating on two DOFs at the same time:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;In this paper, we investigate the possibility of achieving scalable&#xA;  hyper-parallel quantum computation based on two DOFs of photon systems&#xA;  without using the auxiliary spatial modes or polarization modes&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-09T13:03:16.977" LastActivityDate="2018-10-09T13:03:16.977" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4137" PostTypeId="1" CreationDate="2018-09-02T09:20:48.703" Score="8" ViewCount="285" Body="&lt;p&gt;That is to say,&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;what are some common or popular misconceptions about what constitutes quantum computing?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;how are those things misconceptions?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It could help in explaining to frame this while imagining as if you were explaining for a layperson, such as Sophie (your meek-and-kindly-but-fox-news-informed great-aunt twice-removed), who has asked you out of genuine curiosity after hearing it referenced in passing multiple times on TV, radio, etc.&lt;/p&gt;&#xA;&lt;p&gt;Sophie isn't looking for a career in computing, never-mind quantum computing (She's a darned good seamstress herself), but does grok basic maths and logic despite her technologically simpler lifestyle.&lt;/p&gt;&#xA;&lt;p&gt;Sophie would like to know some mildly political things; such as how and why we fund studies in quantum-computing, why quantum-computing is studied, what we're actually using it for, as well as some mildly technical things; such as why her regular computer isn't &amp;quot;quantum&amp;quot; since it computes &amp;quot;quantities&amp;quot;, how quantum-computers are any faster than her Athlon XP with Windows 2000, why doing things the way we've done them in traditional computing isn't satisfactory by itself, and when she can get that quantum-pocket-calculator that answers her questions before she asks them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Of note: I am not Sophie nor do I have any aunt Sophie (to the best of my knowledge anyways; quantum-aunts notwithstanding!).&lt;br&gt;&#xA;I asked this question because I've read and heard a lot of random snippets of information on the topic, from which I have my own basic comprehension, but not an understanding which is strongly communicable to other people. &lt;br&gt;&#xA;Being slightly more computer-informed than other people around am also asked to try and explain the topic of quantum-computing for laypeople.&lt;br&gt;&#xA;Obviously I'm hardly an ideal teacher on the subject, but truncating conversations on the topic to the likes of &amp;quot;&lt;em&gt;I know its not what you just described but I can't tell you how it's not that&lt;/em&gt;&amp;quot; never sits well with me, hence the rather arbitrary framing I offered.&lt;/p&gt;&#xA;" OwnerUserId="4494" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-12-13T20:11:36.963" Title="What is quantum computing vs. what is not quantum computing" Tags="&lt;classical-computing&gt;&lt;terminology&gt;&lt;applications&gt;&lt;history&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4138" PostTypeId="2" ParentId="4137" CreationDate="2018-09-02T16:47:21.717" Score="7" Body="&lt;p&gt;The difficulty with explaining quantum computing is that quantum objects and processes have no direct classical analogue; they're an entirely new ontological category. For example, you might have learned in high school physics that light &quot;is both a particle and a wave&quot; in an attempt to relate it to two classical objects you can intuitively understand. In truth, light is neither a particle nor a wave, but rather a quantum phenomenon - something else entirely which requires learning a whole different language to understand. That language is mathematics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is far beyond what your average curious layperson (or those in the political process holding the science grant money purse strings) is willing to expend learning about quantum computing, so it behooves us to come up with simpler explanations. We can group these explanations into two categories:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What do quantum computers enable us to accomplish?&lt;/li&gt;&#xA;&lt;li&gt;How do quantum computers work?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The first question has been covered at length in zillions of pop science articles. Breaking RSA, simulating molecular interactions, all that stuff. Your question is specifically aimed at the second: how does a quantum computer work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually when someone asks me this, I start out by asking them how they think classical computers work. If they don't have a somewhat-correct understanding of &lt;em&gt;that&lt;/em&gt;, I just say quantum computers make use of weird quantum phenomena like superposition and entanglement to solve certain problems faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they sort of understand how classical computers work, I might explain that superposition enables us to calculate, in some restricted sense, with the values of both 0 and 1 at the same time. However, I make sure to emphasize that this does &lt;em&gt;not&lt;/em&gt; mean quantum computers &quot;try every possible value simultaneously&quot; and in the end if you have $n$ qbits you can only get $n$ bits of classical information from your quantum computation. I explain that we use a phenomenon called quantum interference to make getting the wrong answers less likely, and the right answers more likely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depending on how curious the person is, I might walk them through an explanation of the 2-norm similar to Scott Aaronson's approach in &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing Since Democritus&lt;/a&gt;. It helps if you make this entertaining and engaging for the person, using something like &quot;imagine you're a god, and you're gonna make your own version of the universe; now, just for fun, you want to mess with the way probability works...&quot; etc. Then you can use the concept of &quot;negative probability&quot; to expand on the interference explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Past this point, we're getting into where you'd want to start using linear algebra to show them how things actually work, so I usually just direct them to &lt;a href=&quot;https://www.youtube.com/watch?v=F_Riqjdh2oM&quot; rel=&quot;noreferrer&quot;&gt;my talk&lt;/a&gt; or run through it live depending on how much I like them.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-09-02T18:57:49.057" LastActivityDate="2018-09-02T18:57:49.057" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4139" PostTypeId="1" AcceptedAnswerId="4145" CreationDate="2018-09-02T17:07:11.260" Score="6" ViewCount="358" Body="&lt;p&gt;The density operator can be used to represent uncertainty of quantum state from some perspective, aka a subsystem of the full quantum system. For example, given a Bell state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = \frac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where Alice has one qbit and Bob has the other, Bob does not know whether Alice has already measured her qbit and thus collapsed his to $|0\rangle$ or $|1\rangle$ (or $|+\rangle$ or $|-\rangle$ or whatever other basis Alice used). Thus we can write a density operator for the subsystem of Bob's qbit, which I believe would just be the maximally-mixed state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\rho = \begin{bmatrix} 1/2 &amp;amp; 0 \\ 0 &amp;amp; 1/2 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a multi-qbit system, how do we derive the density operator of some subsystem of those qbits? I'm interested in the answer for both a subsystem consisting of a single qbit and one consisting of some arbitrary subset of the qbits.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-09-03T06:57:44.517" Title="How do we derive the density operator of a subsystem?" Tags="&lt;density-matrix&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4140" PostTypeId="2" ParentId="4139" CreationDate="2018-09-02T17:15:28.267" Score="3" Body="&lt;p&gt;The density operator is defined to be $\rho = \left|\psi\right&amp;gt; \left&amp;lt;\psi\right|$. To get the &quot;reduced&quot; density operator for a subsystem, you have to form the trace (i.e. sum) over all of the qubits not inside your subsystem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, given the Bell state $\left|\psi\right&amp;gt; = \frac{\left|00\right&amp;gt; + \left|11\right&amp;gt;}{\sqrt{2}}$, the density matrix is $\rho = \frac{1}{2} \big( \left|00\right&amp;gt;\left&amp;lt;00\right| + \left|00\right&amp;gt;\left&amp;lt;11\right| + \left|00\right&amp;gt;\left&amp;lt;11\right| + \left|11\right&amp;gt;\left&amp;lt;11\right| \big) = &#xA;\frac{1}{2}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix}$,&#xA;for either qubit, performing the partial trace over the other qubit results in a reduced density matrix&#xA;$\rho_1 =&#xA;\frac{1}{2}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 \\&#xA;\end{bmatrix}$.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2018-09-02T20:41:27.213" LastActivityDate="2018-09-02T20:41:27.213" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4141" PostTypeId="1" AcceptedAnswerId="4156" CreationDate="2018-09-02T17:37:41.353" Score="7" ViewCount="381" Body="&lt;p&gt;I asked a &lt;a href=&quot;https://physics.stackexchange.com/questions/426083/difference-between-coherence-transfer-polarization-transfer-population-transf&quot;&gt;question&lt;/a&gt; on Physics Stack Exchange but no one answered the question and I didn't get enough views on it. I am asking it on QCSE because the question is related to experimental quantum computation realized through NMR. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an ensemble of identical atoms in a superposition state $|\phi\rangle=\alpha|S_z^+\rangle+\beta|S_z^-\rangle$ where $|\alpha|^2$ and $|\beta|^2$ are not equal(although $|\alpha|^2 + |\beta|^2 = 1$) and gives the populations of $|S_z^+\rangle$ and $|S_z^-\rangle$ respectively, we can drive a transition between the two basis states and we call this phenomenon as &lt;em&gt;population transfer&lt;/em&gt;(please correct me if I am wrong). Mathematically, the field induced transitions changes the values of $|\alpha|^2$ &amp;amp; $|\beta|^2$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there can be one more phenomenon going on here called&#xA;    &lt;strong&gt;&lt;em&gt;polarization transfer&lt;/em&gt;&lt;/strong&gt; which is distinct from population transfer because polarization really counts the total spin magnetization of a state in the context of NMR and EPR and maybe Quantum Optics too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the third phenomenon i.e. &lt;strong&gt;&lt;em&gt;coherence transfer&lt;/em&gt;&lt;/strong&gt;(no&#xA;    classical analogue) can't occur between two states but needs three&#xA;    level system say $|1\rangle$, $|2\rangle$ and $|3\rangle$ and the field driven transitions between states $|1\rangle$ &amp;amp; $|2\rangle$ and states $|1\rangle$ &amp;amp;&#xA;    $|3\rangle$ somehow creates transition of states $|2\rangle$ &amp;amp;&#xA;    $|3\rangle$ even though there is no driving field of frequency corresponding to $|2\rangle$ &amp;amp; $|3\rangle$ transition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last two phenomena written in bold are what I do not understand. Any insight into them will be very helpful&#xA;    and mathematics over them will be highly appreciated. &lt;a href=&quot;http://140.117.34.2/faculty/phy/sw_ding/teaching/nmri01_underg/nmri01_underg_lecture04.ppt&quot; rel=&quot;noreferrer&quot;&gt;This link&lt;/a&gt;&#xA;    also tries to explain the difference between population transfer,&#xA;    polarization transfer and coherence transfer through density&#xA;    matrices but I cannot see much physical explanation over the&#xA;    phenomenon.&lt;/p&gt;&#xA;" OwnerUserId="2817" LastEditorUserId="26" LastEditDate="2018-09-02T17:50:20.010" LastActivityDate="2018-09-04T11:44:13.407" Title="Difference between coherence transfer, polarization transfer and population transfer?" Tags="&lt;physical-qubit&gt;&lt;solid-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4142" PostTypeId="1" AcceptedAnswerId="4144" CreationDate="2018-09-03T01:20:52.970" Score="8" ViewCount="168" Body="&lt;p&gt;Is it possible to obtain amplitude information (in lexicographic ordering) for a particular qubit register in Q#?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation GetProbabilityAmplitude() : Double[]&#xA;{&#xA;    body&#xA;    {&#xA;        mutable result = new Double[4];&#xA;        using (register = Qubit[2])&#xA;        {&#xA;            H(register[0]);&#xA;            CNOT(register[0], register[1]);&#xA;            // ...put the amplitude doubles in the result array&#xA;        }&#xA;        return result;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The doubles in &lt;code&gt;result&lt;/code&gt; should be {0.5,0.0,0.0,0.5}.  I looked quite a bit for it in the documentation but couldn't find anything about getting the amplitudes.&lt;/p&gt;&#xA;" OwnerUserId="1287" LastEditorUserId="2879" LastEditDate="2018-09-03T05:15:24.330" LastActivityDate="2018-09-03T05:15:24.330" Title="How does one obtain amplitude information in Q#?" Tags="&lt;simulation&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4143" PostTypeId="2" ParentId="4142" CreationDate="2018-09-03T03:26:54.193" Score="3" Body="&lt;p&gt;I never looked at Q# but it looks like by using &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-techniques-testinganddebugging?view=qsharp-preview&amp;amp;tabs=tabid-vs2017&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dump functions&lt;/a&gt;&#xA;you can output it. Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-03T03:26:54.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4144" PostTypeId="2" ParentId="4142" CreationDate="2018-09-03T05:06:23.073" Score="10" Body="&lt;p&gt;Yes, it is possible to obtain this information, but only for troubleshooting purposes, not for using it in the code.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-techniques-testinganddebugging#dump-functions&quot; rel=&quot;noreferrer&quot;&gt;Dump functions&lt;/a&gt; dump the status of the target machine into a file or to the console output. If the program is executed on the full-state simulator, this status will include the wave function of the whole system (for DumpMachine) or of the register (for DumpRegister).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you could do the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (register = Qubit[2]) {&#xA;    H(register[0]);&#xA;    CNOT(register[0], register[1]);&#xA;    DumpMachine(&quot;&quot;);&#xA;    // to avoid ReleasedQubitsAreNotInZeroState exception&#xA;    ResetAll(register);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and get the following amplitudes (each one is a complex number):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Ids:    [1;0;]&#xA;Wavefunction:&#xA;0:      0.707107        0&#xA;1:      0       0&#xA;2:      0       0&#xA;3:      0.707107        0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note that this does not allow you to implement the &lt;code&gt;GetProbabilityAmplitude()&lt;/code&gt; function which you requested. If you are running a Q# program on a simulator, it will let you see the wave function but it will not let you make any decisions &lt;em&gt;in the program&lt;/em&gt; based on that information. The intent is twofold: to facilitate debugging on a simulator while not allowing to implement any logic which would be impossible to execute on a quantum computer. Since the execution on a quantum computer won't give the program direct access to the quantum state, it's better not to rely on this feature in the code.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-09-03T05:06:23.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4145" PostTypeId="2" ParentId="4139" CreationDate="2018-09-03T06:57:44.517" Score="3" Body="&lt;p&gt;Let's say you have some density matrix, $\rho$, over a set of qubits $1,2,\ldots ,n$. (If you have a pure state $|\psi\rangle$, set $\rho=|\psi\rangle\langle\psi|$.) Let's say that the subsystem that we want the reduced density operator of is specified by the set of qubits $S$ (and all the others are $\bar S$). You have that&#xA;$$&#xA;\rho_S=\text{Tr}_{\bar S}(\rho),&#xA;$$&#xA;where $\text{Tr}_{\bar S}$ is the partial trace over the set $\bar S$. What does this mean in practice? Pick any orthonormal basis $\{|\phi_i\rangle\}_{i=1}^{|\bar S|}$ over $\bar S$, then you simply calculate&#xA;$$&#xA;\text{Tr}_{\bar S}(\rho)=\sum_{i=1}^{|\bar S|}\left(\langle \phi_i|_{\bar S}\otimes\mathbb{I}_S\right)\rho\left(| \phi_i\rangle_{\bar S}\otimes\mathbb{I}_S\right).&#xA;$$&#xA;Usually, you just pick the computational basis. So, in your example of&#xA;$$&#xA;\rho=\frac12\left(|00\rangle\langle 00|+|00\rangle\langle 11|+|11\rangle\langle 00|+|11\rangle\langle 11|\right),&#xA;$$&#xA;you pick the basis $\{|0\rangle,|1\rangle\}$, and you calculate&#xA;$$&#xA;\rho_A=(\mathbb{I}\otimes\langle 0|)\rho(\mathbb{I}\otimes|0\rangle)+(\mathbb{I}\otimes\langle 1|)\rho(\mathbb{I}\otimes|1\rangle)=\frac12(|0\rangle\langle 0|+|1\rangle\langle 1|)).&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make this calculation a bit shorter, then it's worth noting that, over the subsystems $\bar S$ that you're taking the partial trace over, it's permutation invariant. So, you can pick up a ket from the left-hand side, and match it with a bra on the right-hand side (but make sure you always match terms from the same subsystem, and that that subsystem is in $\bar S$):&#xA;$$&#xA;\text{Tr}_B(\rho)=\frac12\left(|0\rangle\langle0|\langle0|0\rangle+|1\rangle\langle0|\langle0|1\rangle+|0\rangle\langle1|\langle1|0\rangle+|1\rangle\langle1|\langle1|1\rangle\right),&#xA;$$&#xA;and you can now simply read off this final result. It's always a good check, to make sure you haven't messed up too badly, to make sure that the $\rho_S$ that you output is (i) Hermitian, (ii) has trace 1.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-03T06:57:44.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4146" PostTypeId="2" ParentId="3954" CreationDate="2018-09-03T07:03:22.730" Score="2" Body="&lt;p&gt;Following are some of the latest resources on Quantum Biology &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Youtube video by the Royal Institution: &lt;a href=&quot;https://www.youtube.com/watch?v=bLeEsYDlXJk&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Biology: An Introduction&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia page on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_biology&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum biology&lt;/a&gt; (and links therein)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;University of Illinois at Urbana-Champaign, NIH Center for Macromolecular Modeling &amp;amp; Bioinformatics, &lt;a href=&quot;https://www.ks.uiuc.edu/Research/quantum_biology/&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum biology research page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TED Talk by Jim Al-Khalili: &lt;a href=&quot;https://www.ted.com/talks/jim_al_khalili_how_quantum_biology_might_explain_life_s_biggest_questions&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;How quantum biology might explain life’s biggest questions&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="23" LastEditDate="2018-09-03T18:12:27.807" LastActivityDate="2018-09-03T18:12:27.807" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4147" PostTypeId="2" ParentId="4137" CreationDate="2018-09-03T07:50:10.600" Score="3" Body="&lt;p&gt;There are lots of separate questions in there: politics, physics, etc. and I won't pretend to answer all of it, but let me try to get towards what I think is the core of the matter.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How do I explain to the interested non-specialist what I do (the general field)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My explanation actually varies a lot depending on who I'm talking to, and depends a lot on having a two-way conversation about it. However, one approach that I quite like, because it doesn't tell any lies or half-truths, it helps avoid some of the common misconceptions, and doesn't require any mind-blowing quantum stuff that I don't really have the right language to describe (apart from with maths), is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume people are familiar with the concept of logic gates. Now, a computation is just a sequence of logic gates all wired up in a specific order for that specific computation. And you can think of a processor as something that can dynamically rewire different circuits. (Of course, the connectivity isn't dynamically changed, it's done with extra gates.) But the point is that every processor, from your basic pocket calculator up to the most powerful supercomputer, is constructed out of the same fundamental set of logic gates. (In fact, just one type of gate is sufficient. The NAND gate, for example, is 'universal' for classical computation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine I suddenly gave you a new type of logic gate that cannot be straightforwardly made out of your existing set of gates. That instantly gives you a low of potential to rewrite your existing software to take advantage of this new gate. That does not mean that every algorithm will be faster. Some won't benefit at all, while some specific ones might show ridiculous speed improvements. Do we know what proportion fall into each camp? Not really, until you go and work on the algorithms extensively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we do know in the case of quantum computation is some specific examples that are radically faster than the existing classical algorithms. Things like Shor's algorithm for factoring numbers, and Grover's search.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If it's that simple, do we have quantum computers already?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not really. That extra logic gate is hard to build, and you can't just interface it directly with the existing logic gates; you have to build those from scratch as well in a new technology (and, really, we're still scratching around trying to figure out what a good technology to use actually is). It's a work in progress that's receiving a lot of attention at the moment. There are small working prototypes which are potentially on the verge of performing computations that we can't do classically, but they're still a long way from useful implementations of algorithms such as Grover of Shor.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why should you care?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That depends on what your interests are. For Sophie, unless she's ultra-paranoid about her tap-and-go seamstress payment system being hacked, she probably doesn't care so much about the practical side. It's not yet clear that it's going to have a significant bearing on things. She can probably trust her payment system provider to take care of things as much as they can, and forget about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do I care? Quantum Mechanics is mind-blowing. I'm really excited not to just be a part of trying to categorise its effect, and explain certain things that are going on, but to harness that quantum weirdness and bend it to my will (cue maniacal laughter!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does it get funding? Well, there are a few reasons (and I'm going to make some very sweeping statements here that are too broad). For one, the few specific killer applications that we have are really useful to specific groups. Shor's algorithm will allow government agencies to spy on communications that use existing public key cryptography systems (practically everybody). Grover's search will help with all sorts of computer sciencey problems which people like Google would really like help with).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another reason is just to drive science on. As science progresses, whether or not the final outcome is ever realised as originally envisaged, there's all sorts of stuff comes out along the way (the classic example is the space program). Everybody wants to invest to make sure they're at the forefront of those new developments, and it's a game of chicken. Once there's major investment from one party, nobody wants to be left behind. Compared to many options, quantum computing appears reasonably accessible (while still being a huge challenge, it's not string theory) and it's amazing how much quantum mechanics has already permeated existing technology. The processor in your computer might not enable quantum computing (because it doesn't have the extra gate), but it still relies on quantum effects for its manufacture and functioning. Lasers are ubiquitous now (CD, DVD players), and their fundamental operating principle is quantum mechanical.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-03T07:50:10.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4148" PostTypeId="2" ParentId="4137" CreationDate="2018-09-03T08:46:54.213" Score="2" Body="&lt;p&gt;When explaining quantum computers, we must deal with the fact that most people don't know the fundamentals of classical computers. Since the difference lies at this fundamental level, that can present a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, many people know that information technology comes in analogue form as well as digital. That already gives them an intuition that there can be different devices that do the same job, but do it differently and with different strengths and weaknesses. This sets up the place that quantum will take, as a third type of information technology distinct from the other two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For those that are more well-versed in analogue and digital computing, you could invite them to think about a device that combines the strengths of both. That, I think, is a good way to think about what a quantum computer is: Wave-particle duality becomes analogue-digital duality when we think in terms of computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I guess I would invite your wise aunt to think about issues like these, tailored to her current knowledge.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-09-03T08:46:54.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4149" PostTypeId="1" CreationDate="2018-09-03T10:37:53.960" Score="3" ViewCount="294" Body="&lt;p&gt;I have been active in this community a while and I repeatedly see questions and answers referring to the so-called Tensor Networks. That makes me wonder what are those elements are and what the motivation behind their construction is. References about where to look for the motivation and construction of those is sought in this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, an insight into the importance of these elements in the quantum computing and/or quantum communication paradigms would be helpful too, as the concept is found in this site in several places.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2018-09-04T07:15:32.037" LastActivityDate="2019-08-05T13:52:18.857" Title="What are Tensor Networks and which is the relationship they have with quantum computing?" Tags="&lt;resource-request&gt;&lt;tensor-networks&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4150" PostTypeId="1" CreationDate="2018-09-03T11:35:23.570" Score="5" ViewCount="235" Body="&lt;p&gt;One of the most promising applications of a quantum computing is the design of new drugs and materials:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum computers promise to run calculations far beyond the reach of&#xA;  any conventional supercomputer. They might revolutionize the discovery&#xA;  of new materials by making it possible to simulate the behavior of&#xA;  matter down to the atomic level.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;source: &lt;a href=&quot;https://www.technologyreview.com/s/610250/serious-quantum-computers-are-finally-here-what-are-we-going-to-do-with-them/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT Technology Review - Will Knight - February 21, 2018&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this moment quantum computers are not powerful enough to do these calculations / simulations.  So we have not yet the proper hardware for this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But assuming we have today quantum computers that are powerful enough, do we know how to use them to revolutionize the design of better drugs and materials in some domains ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is the current obstacle for this revolution that we do not have yet the proper hardware (= powerful quantum computer) or are there actually 2 obstacles:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;having powerful quantum computer (hardware) &lt;/li&gt;&#xA;&lt;li&gt;knowing which quantum algorithms are needed (software)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2529" LastEditorUserId="2529" LastEditDate="2018-09-04T11:34:45.870" LastActivityDate="2018-09-04T11:34:45.870" Title="Do we really know how a universal quantum computer can be used to revolutionize the design of new drugs or materials?" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4151" PostTypeId="2" ParentId="4150" CreationDate="2018-09-03T13:59:13.903" Score="6" Body="&lt;p&gt;There is not a complete story from &quot;run quantum computation&quot; to &quot;make a billion dollars via slightly better batteries&quot;. The vague idea is that a new tool capable of giving new insights into the behavior of materials will lead to important discoveries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's unrealistic to expect a complete quantum-compute-to-engineering-improvement story since the most important discoveries are often the ones that aren't foreseen. I'm sure there are thousands, if not millions, of examples of this happening with classical computers. For example, the study of chaos theory can be traced back to computer simulations of weather behaving in an unexpected way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One specific thing we know quantum computers will be able to do reasonably well is compute the ground state energy of small but classically hard systems. Error-corrected algorithms to do this have improved immensely over the past few years (from runtimes of months with very very optimistic assumptions about hardware [&lt;a href=&quot;http://www.pnas.org/content/early/2017/06/30/1619152114&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;] down to runtimes of hours with plausible 15-years-from-now hardware assumptions [&lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;]). There has also been substantial improvement in NISQ algorithms, though it remains to be seen if they will improve enough to successfully run classically hard cases on non-error-corrected hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently knowing the ground state energy of a system allows predicting reaction rates and other important chemistry numbers. But I'm not a chemist so I can't give much more detail than that.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-09-03T13:59:13.903" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4152" PostTypeId="1" CreationDate="2018-09-03T17:58:56.077" Score="5" ViewCount="54" Body="&lt;p&gt;Are there any good references where from I can learn about photon entanglement using spontaneous parametric down-conversion (SPDC)?&lt;/p&gt;&#xA;" OwnerUserId="4505" LastEditorUserId="26" LastEditDate="2018-09-03T18:06:01.400" LastActivityDate="2018-09-03T18:06:01.400" Title="Photon Entanglement using SPDC" Tags="&lt;entanglement&gt;&lt;resource-request&gt;&lt;spdc&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4153" PostTypeId="1" AcceptedAnswerId="4154" CreationDate="2018-09-04T06:00:37.903" Score="6" ViewCount="1319" Body="&lt;p&gt;Can we use classical XOR gate in a quantum circuit? Or are there any alternatives for XOR gate?&lt;/p&gt;&#xA;" OwnerUserId="4505" LastEditorUserId="26" LastEditDate="2018-12-23T13:08:47.747" LastActivityDate="2018-12-23T13:08:47.747" Title="Classical XOR gate in Quantum Circuit" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4154" PostTypeId="2" ParentId="4153" CreationDate="2018-09-04T06:39:45.497" Score="9" Body="&lt;p&gt;You can't directly use a classical XOR gate inside a quantum circuit because the usual construction of such a gate is a classical construction - it won't preserve coherence. In other words, it will function just fine if you input a 0 or a 1 as each input, but it won't perform as you'd need it to if you supplied it with a superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, you can build XOR out of quantum circuit elements, so that it behaves in exactly the same way as it would for classical inputs, but it does preserve superposition. Indeed, XOR is simple as a reversible circuit, just use a controlled-not! The target qubit is the output you want&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VMPhw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VMPhw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;You can readily verify this just by constructing the truth table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, you can construct all classical gates in this way. For example, the AND gate:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NWPBN.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NWPBN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-04T06:39:45.497" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4155" PostTypeId="1" AcceptedAnswerId="4157" CreationDate="2018-09-04T10:46:37.297" Score="4" ViewCount="72" Body="&lt;p&gt;In reference to this recent nature article: &lt;a href=&quot;https://www.nature.com/articles/s41567-018-0241-6&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41567-018-0241-6&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, does this warrant a new type of gate?&lt;/p&gt;&#xA;" OwnerUserId="419" LastEditorUserId="26" LastEditDate="2018-12-23T13:08:11.437" LastActivityDate="2018-12-23T13:08:11.437" Title="What is the significance of recent demonstration of a passive photon–atom qubit swap operation?" Tags="&lt;quantum-gate&gt;&lt;physical-qubit&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4156" PostTypeId="2" ParentId="4141" CreationDate="2018-09-04T11:24:17.227" Score="4" Body="&lt;p&gt;Given a quantum system in a state defined by a density matrix $\rho$, it is an accepted terminology to use the term population for the diagonal matrix elements (not necessarily in the computational basis). Since a normalized vector corresponds to a pure state, thus we can define a population of the pure state $\psi$ by:&#xA;$$P_{\psi} = \langle \psi | \rho | \psi \rangle$$&#xA;According to this definition, the sum of the populations of an orthonormal basis of pure states is a unity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the system evolves: $\rho = \rho(t)$, the populations also change in time. We can call a population transfer from a state $a$ to a state $b$ when the system starts with a high population of $a$ and low population of $b$ and ends with low population of $a$ and high population of $b$ with all other populations unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, when the density matrix corresponds to photon polarization the same situation can be called a polarization transfer. When the density matrix corresponds to a spin system it can be called a spin transfer, and sometimes also a polarization transfer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes (for example in spectroscopy) when the system is a tensor product of two subsystems for example two energy levels ($n$ and $n+1$) of a spinning electron. A suitable basis in this case can be chosen as: $\{| n \downarrow \rangle,  | n \uparrow \rangle,  | n+1 , \downarrow \rangle, | n+1 , \uparrow \rangle \}$, then the term population transfer can be reserved to the energy level reduced density matrix:&#xA;$$\rho_E = \mathrm{tr}_{\downarrow, \uparrow} \rho$$ &#xA;While the term spin transfer can be used for the spin reduced density matrix&#xA;$$\rho_s = \mathrm{tr}_{n, n+1} \rho$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Population transfers can be also defined for projected density matrices, for example spin transfer of the projected density matrix on the level $n$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coherences on the other hand are used to denote the off-diagonal elements of a density matrix $\langle b | \rho | a\rangle$ . The motivation for this definition is that a density matrix with solely diagonal terms describe a classical state and can be replaced by a probability distribution and the quantum correlations are achieved by means of the off-diagonal terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again when the system evolves it can happen that the reduced density matrices of two subsytems switch from high coherence to low coherence and vice versa. This is the case of coherence transfer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, when the system is two level, there is only one off-diagonal element $\rho_{12} = \rho_{21}$ and we cannot talk about a coherence transfer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example for spin coherence transfer in the above spectroscopy case is given by the following: (Tensor product notation is used where the left matrix lives in the energy level Hilbert space and the right one in the spin space)&#xA;$$\rho_{\mathrm{init}} = \frac{1}{\sqrt{2}}\left(\begin{bmatrix}0 &amp;amp; 0 \\0 &amp;amp; 1 \end{bmatrix}\otimes\begin{bmatrix}\frac{1}{2} &amp;amp; \frac{1}{2} \\\frac{1}{2} &amp;amp; \frac{1}{2} \end{bmatrix} +  \begin{bmatrix}1 &amp;amp; 0 \\0 &amp;amp; 0 \end{bmatrix}\otimes\begin{bmatrix}\frac{1}{2} &amp;amp; 0 \\0 &amp;amp; \frac{1}{2} \end{bmatrix} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\rho_{\mathrm{fin}} = \frac{1}{\sqrt{2}}\left(\begin{bmatrix}0 &amp;amp; 0 \\0 &amp;amp; 1 \end{bmatrix}\otimes\begin{bmatrix}\frac{1}{2} &amp;amp; 0 \\0 &amp;amp; \frac{1}{2} \end{bmatrix} +  \begin{bmatrix}1 &amp;amp; 0 \\0 &amp;amp; 0 \end{bmatrix}\otimes\begin{bmatrix}\frac{1}{2} &amp;amp; \frac{1}{2} \\\frac{1}{2} &amp;amp; \frac{1}{2} \end{bmatrix} \right)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, one can see a coherence transfer from the energy level $n$ to the energy level $n+1$, because the projected density matrices on the energy levels switched coherences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see the following &lt;a href=&quot;https://arxiv.org/abs/1402.2411&quot; rel=&quot;nofollow noreferrer&quot;&gt;work &lt;/a&gt; by Aubourg and Viennot, where they define populations and coherences of a spin chain along the same lines (equations 5-7).&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-09-04T11:44:13.407" LastActivityDate="2018-09-04T11:44:13.407" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4157" PostTypeId="2" ParentId="4155" CreationDate="2018-09-04T11:51:33.263" Score="4" Body="&lt;p&gt;This does not warrant a new type of gate. When we write down quantum circuits, each 'wire' corresponds to a single qubit. However, we do not (usually) specify what technology any of these qubits is made out of. You might typically assume that they're all the same technology (e.g. solid state, photonic,...) but there is no need to do so. There are very good reasons for wanting to interface different types of qubit, particularly static and flying qubits, to take advantage of the benefits of both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, on your quantum circuit, you specify that you want a swap gate. This is an abstraction, and does not tell you how you're physically going to realise it. The cited paper is showing one way of implementing it when the two qubits are two specific (different) types. But it's not a new gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the significance, that comes back to why you want to have both static and flying qubits in your experiment. Flying qubits are great if you need to connect two distant components because they can travel long distances with relatively little decoherence (usually more relevant to different quantum information protocols, rather than computation specifically, but some current quantum computer designs require distributed blocks). Static qubits are great if you actually want to manipulate the quantum state, interacting with other qubits etc. For example, we often talk in quantum information about processes such as &quot;Alice sends a qubit to Bob&quot; and then we talk about Bob holding the particular state he's received. So Alice probably sent it using a photon because they were far apart. But if Bob wants to hold onto the state, planning on doing something with it later, he needs to transfer it onto a static qubit. Perhaps, for example, Alice and Bob want to share a Bell pair, but their quantum communication channel is noisy, so Alice will send many Bell pair halves to Bob, and they will later perform a distillation protocol. The distillation process will be highly non-linear, and probably makes more sense on static qubits.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-04T11:51:33.263" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4158" PostTypeId="1" AcceptedAnswerId="4171" CreationDate="2018-09-05T01:07:22.730" Score="4" ViewCount="166" Body="&lt;p&gt;In the proof of Proposition 2.52 of &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Watrous' QI book&lt;/a&gt;, there is the statement that &lt;span class=&quot;math-container&quot;&gt;$\text{im}(\eta(a))\subset\text{im}(\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_{i=1}^{N}\eta(i)$&lt;/span&gt; is a sum of positive operators and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has trace one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't see &lt;span class=&quot;math-container&quot;&gt;$\text{im}(\eta(a))\subset\text{im}(\rho)$&lt;/span&gt;, could someone please help explain. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2375" LastEditorUserId="26" LastEditDate="2019-05-13T16:05:08.503" LastActivityDate="2019-05-13T16:07:56.070" Title="Image of a sum of positive operators contains the images of each individual operator?" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4159" PostTypeId="2" ParentId="4158" CreationDate="2018-09-05T02:22:04.110" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \eta(a) \subset U_{a \in \sum} \eta(a) $&lt;/span&gt; if I can write it this union way.&#xA;By using the property that if a subset is included in another, the images follow this inclusion too &lt;a href=&quot;https://en.wikipedia.org/wiki/Image_(mathematics)#Consequences&quot; rel=&quot;nofollow noreferrer&quot;&gt;(wikipedia ling for images)&lt;/a&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{im}(\eta(a)) \subset \mathrm{im}(U_{a \in \sum} \eta(a)) = U_{a \in \sum} \mathrm{im}(\eta(a))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By definition, &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt; is applied over all elements in the alphabet &lt;span class=&quot;math-container&quot;&gt;$ \sum$&lt;/span&gt;. So its image will be on the right side of the inclusion.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-05-13T16:07:56.070" LastActivityDate="2019-05-13T16:07:56.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4160" PostTypeId="1" AcceptedAnswerId="4170" CreationDate="2018-09-05T04:00:30.973" Score="6" ViewCount="448" Body="&lt;p&gt;Why are conditional phase shift gates, such as CZ, symmetrical? Why do both the control and target qubit pick up a phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, assuming that they are symmetrical, when using a CNOT gate as an H gate on the target qubit, a CZ gate, and another H gate on the target qubit, wouldn't the CZ gate cause the control qubit to pick up a phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the control qubit is an equal superposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and then this version of the CNOT gate is implemented, wouldn't the control qubit end up with a phase?&lt;/p&gt;&#xA;" OwnerUserId="3061" LastEditorUserId="26" LastEditDate="2018-12-23T13:07:16.547" LastActivityDate="2018-12-23T13:07:16.547" Title="Symmetry in Conditional Phase Shift Gates and Realizing CNOT through HCZH" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4161" PostTypeId="2" ParentId="4160" CreationDate="2018-09-05T04:11:57.217" Score="5" Body="&lt;p&gt;It's not that both the qubits are independently picking up a phase, it's that the two qubit state itself is picking up that phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{CZ}|1\rangle\otimes |1\rangle = |1\rangle\otimes(-1\times |1\rangle) = -|1\rangle\otimes |1\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So although the second qubit is the one that has the Z applied and is actually picking up the phase, that entire $|11\rangle$ state is picking up the phase. If it helps you can look at the effect on a generic state in the computational basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\mathbf{CZ}(\alpha |00\rangle + \beta |01\rangle + \gamma |10\rangle + \delta |11\rangle) = \alpha |00\rangle + \beta |01\rangle + \gamma |10\rangle - \delta |11\rangle$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so the key action is that CZ flips the sign of a $|11\rangle$ two qubit state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you follow this through on your example, you should see that the sign flip does affect the state of both qubits in the $|11\rangle$ case, but then when passed through the H gates in the correct way to get your desired behavior.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-09-05T04:11:57.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4162" PostTypeId="1" AcceptedAnswerId="4165" CreationDate="2018-09-05T10:23:49.770" Score="7" ViewCount="271" Body="&lt;h1&gt;Why are quantum computers scalable?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;With the subjects of spontaneous collapse models and decoherence in mind, it seems to me that the scalability of quantum computers is something which is not only physically difficult to achieve but also theoretically.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Measurement&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;When a measurement is made, a quantum state, whose probability amplitude is a Gaussian function, becomes an eigenstate, whose probability is definite. This change from quantum state to eigenstate on measurement happens also to qubits which change to classical bits in terms of information.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Measurement, decoherence &amp;amp; quantum Darwinism&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;From the work of Zurek one starts to see the environment as a valid observer and indeed one that makes measurments. Within this view, how can we have scalable quantum computers if many-qubit systems create more and more decoherence and as such, from my current understanding, inevitably reduce such a system of qubits to a system of eigenstates.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Is there an upper bound to quantum computing?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If the train of thought I am following is correct than shouldn't there be an upper bound to the number of qubits we can have without them (all, the whole system) being reduced to eigenstates, classical states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the feeling that what I am saying is incorrect and I am fundamentally misunderstanding something. I'd really appreciate it if you could tell me why my argument is wrong and point me in the direction of understanding why quantum computers are theoretically scalable.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;An example with ion trap quantum computers&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Within this set up, the information is encoded within the energy levels of ions with a shared trap. Given that the ions are all within the shared trap then interactions are bound to occur given scaling within such a shared trap, &lt;em&gt;or at least that's what my intuition says&lt;/em&gt;. Do we overcome this by having multiple traps working say in tandem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0105127.pdf&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt; - &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0105127.pdf&quot; rel=&quot;noreferrer&quot;&gt;Zurek's Decoherence, einselection, and the quantum origins of the classical &lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="2687" LastEditDate="2018-09-06T22:00:22.887" LastActivityDate="2018-09-06T22:00:22.887" Title="Is there a classical limit to quantum computing?" Tags="&lt;quantum-information&gt;&lt;measurement&gt;&lt;decoherence&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4163" PostTypeId="1" AcceptedAnswerId="4168" CreationDate="2018-09-05T13:11:51.917" Score="6" ViewCount="91" Body="&lt;p&gt;From a high-level point of view, given a quantum program, typically the last few operations are measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most cases, in order to extract a useful answer, it is necessary to run multiple times to reach a point where it is possible to estimate the probability distribution of the output q-bits with some level of statistical significance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even when ignoring noise, if the number of q-bits of the output increases, the number of required runs will increase too. In particular, for some output probability distributions it is likely that the number of required samples can be very high to obtain some sensible statistical power.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While increasing the number of q-bits seems to indicate an exponential growth, the number of measurements required (each run taking x nanoseconds) seem to limit how will quantum computation do scale.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this argument sensible or there is some critical concept that I am missing?&lt;/p&gt;&#xA;" OwnerUserId="180" LastEditorUserId="26" LastEditDate="2018-12-13T20:06:20.207" LastActivityDate="2018-12-13T20:06:20.207" Title="How scalable are quantum computers when measurement operations are considered?" Tags="&lt;physical-realization&gt;&lt;performance&gt;&lt;scalability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4164" PostTypeId="1" AcceptedAnswerId="4172" CreationDate="2018-09-05T14:59:27.757" Score="12" ViewCount="1134" Body="&lt;p&gt;I have been reading the paper &lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=8006824&quot; rel=&quot;noreferrer&quot;&gt;Belief propagation decoding of quantum&#xA;channels by passing quantum messages&lt;/a&gt; by Joseph Renes for decoding Classical-Quantum channels and I have crossed with the concept of &lt;strong&gt;Helstrom Measurements&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some knowledge about quantum information theory and quantum error correction, but I had never read about such measurement until I worked on that paper. In such article, the author states that the measurement is optimal for this decoding procedure, so I would like to know what are such kind of measurements and how can they be done.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2020-08-22T08:05:36.643" LastActivityDate="2020-08-22T08:05:36.643" Title="What is the Helstrom measurement?" Tags="&lt;algorithm&gt;&lt;measurement&gt;&lt;error-correction&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4165" PostTypeId="2" ParentId="4162" CreationDate="2018-09-05T15:02:57.210" Score="10" Body="&lt;p&gt;In simpler terms your question is: if noise/decoherence keeps entering the computation, how can a big computation possibly survive?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key concept you're missing is &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;noreferrer&quot;&gt;quantum error correction&lt;/a&gt;, which can pump noise/decoherence back out of the system. Of particular practical interest is the &lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;noreferrer&quot;&gt;surface code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-09-05T15:02:57.210" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4166" PostTypeId="1" AcceptedAnswerId="4167" CreationDate="2018-09-05T15:09:34.543" Score="8" ViewCount="139" Body="&lt;p&gt;If you have good references about the CV model that are understandable from a computer science background, that would be great. If they include numerical examples, that would even be better.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-05T15:53:22.157" Title="What good references would you recommend to understand the (continuous-variable) CV model of computation?" Tags="&lt;resource-request&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4167" PostTypeId="2" ParentId="4166" CreationDate="2018-09-05T15:53:22.157" Score="8" Body="&lt;p&gt;One of the best places to learn about the continuous-variable (CV) model is &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/&quot; rel=&quot;noreferrer&quot;&gt;the documentation&lt;/a&gt; of the Strawberry Fields software for photonic quantum computing. It also includes several numerical examples. You can also read the white paper &lt;a href=&quot;https://arxiv.org/abs/1804.03159&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, which contains a dedicated section to explaining the CV model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0410100.pdf&quot; rel=&quot;noreferrer&quot;&gt;this review paper&lt;/a&gt; by Braunstein and van Loock contains a short section on quantum computing with continuous variables. If you're also interested in physical implementations, &lt;a href=&quot;https://arxiv.org/pdf/0903.3233.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; by Gu et al. has a nice description of the cluster-state model of photonic quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. The result is simply that in the CV model, we end up with a different set of canonical states and gates, as summarized for example in the table below (taken from the Strawberry Fields white paper):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JDpFq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JDpFq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4294" LastActivityDate="2018-09-05T15:53:22.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4168" PostTypeId="2" ParentId="4163" CreationDate="2018-09-05T16:23:35.220" Score="5" Body="&lt;p&gt;Some near-term quantum algorithms rely on getting lucky with the measurements, and in fact these algorithms will not scale efficiently to large sizes. But most quantum algorithms don't have this problem; it is required that the amount luck needed [i.e. retries] scales only polynomially with the problem size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Shor's algorithm fails if the quantum part outputs 0. But the chance of 0 becomes smaller and smaller as N (the number to factor) becomes larger. Shor's algorithm also fails if the base B you pick randomly has a k such that to B^k = -1 (mod N), but AFAIK the chance of that happening stays constant as N increases so you don't expect to have to pick too many Bs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, yes you have identified a problem that quantum algorithms do in fact have to avoid. This is the difference between &lt;a href=&quot;https://en.wikipedia.org/wiki/BQP&quot; rel=&quot;noreferrer&quot;&gt;BQP&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/PostBQP&quot; rel=&quot;noreferrer&quot;&gt;PostBQP&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-09-05T16:23:35.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4169" PostTypeId="1" AcceptedAnswerId="4174" CreationDate="2018-09-05T17:29:06.417" Score="12" ViewCount="1218" Body="&lt;p&gt;As the title suggests, I'm searching for published examples of quantum algorithms being applied to problems in computational biology. Clearly the odds are high that practical examples don't exist (yet) – what I'm interested in is any &lt;em&gt;proof of concepts&lt;/em&gt;. Some examples of computational biology problems in this context would be:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Protein Structure Prediction (Secondary, Tertiary)&lt;/li&gt;&#xA;&lt;li&gt;Drug-Ligand Binding &lt;/li&gt;&#xA;&lt;li&gt;Multiple Sequence Alignment&lt;/li&gt;&#xA;&lt;li&gt;De-novo Assembly&lt;/li&gt;&#xA;&lt;li&gt;Machine Learning Applications&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've found only one such reference that I think is illustrative of what I'm looking for. In this research, a D-Wave was used for transcription factor binding, however, it would be interesting to have examples outside the realm of adiabatic quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1803.00135.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum annealing versus classical machine learning applied to a simplified computational biology problem&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are several in terms of quantum simulation. While they clearly aren't simulations at a scale often considered to be biologically relevant, one could imagine that this line of research is a precursor to modeling larger molecules of biological significance (among many other things). &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1801.03897.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cloud Quantum Computing of an Atomic Nucleus&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.6.031007&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scalable Quantum Simulation of Molecular Energies&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, aside from transcription factor binding and quantum simulation, are there any other proof of concepts that exist and are relevant to biology? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I’ve accepted the best answer so far but I’ll be checking in to see if any more examples come up. Here's another I found, somewhat old (2010), that aimed at &lt;a href=&quot;https://arxiv.org/pdf/1204.5485.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;demonstrating identification of low energy protein conformations in lattice protein models&lt;/a&gt; – also a D-Wave publication.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="55" LastEditDate="2020-09-01T22:28:14.287" LastActivityDate="2020-09-01T22:28:14.287" Title="Are there any examples of anyone applying quantum algorithms to problems in computational biology?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;applications&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4170" PostTypeId="2" ParentId="4160" CreationDate="2018-09-05T17:56:16.823" Score="4" Body="&lt;p&gt;A $Z$ gate's effect is &quot;If the target is ON then negate the phase&quot;. A controlled gate's effect is &quot;If the control is ON then apply the gate to the target&quot;. Therefore a controlled Z's effect is &quot;If the control is ON then if the target is ON then negate the phase&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Said another way, the controlled Z's effect is &quot;If the control and target are both ON, negate the phase&quot;. This is a symmetric effect because it conditions on both the control and the target in the same way. The fact that we distinguish between the control and the target is just an accident of history.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking of the control and target as fundamentally different is particularly tricky when it comes to the CNOT gate, as you have noticed. Assuming that the control cannot be affected is a holdover from classical-style thinking that no longer applies in the quantum case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classically, you think of a NOT gate as toggling the target qubit. Quantumly, the NOT gate's effect can instead be thought of as negating the phase of the $|-\rangle$ state. The $X$ gate leaves $|+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle)$ alone and negates $|-\rangle = \frac{1}{\sqrt{2}} (|0\rangle - |1\rangle)$, in the same way that the $Z$ gate leaves $|0\rangle$ alone and negates $|1\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, quantumly, a CNOT's effect is &quot;If the control is ON then &lt;em&gt;if the target is $|-\rangle$ then negate the phase&lt;/em&gt;&quot;. Equivalently, &quot;If the control is ON and the target is $|-\rangle$ then negate the phase&quot;. I hope that makes it clear that &quot;control&quot; and &quot;target&quot; are not really the most appropriate names. It's more like &quot;&lt;a href=&quot;http://algassert.com/post/1706&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Z-axis control and the X-axis control&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-09-06T19:36:22.327" LastActivityDate="2018-09-06T19:36:22.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4171" PostTypeId="2" ParentId="4158" CreationDate="2018-09-05T20:34:05.850" Score="6" Body="&lt;p&gt;It suffices to prove that if $P$ and $Q$ are positive semidefinite operators, then&#xA;$$&#xA;\operatorname{im}(P) \subseteq \operatorname{im}(P+Q).&#xA;$$&#xA;Once you have this, the statement follows by taking $P = \eta(a)$ and $Q = \rho - \eta(a)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that $u$ is a vector with $u \perp \operatorname{im}(P+Q)$. This implies that&#xA;$$&#xA;0 = u^{\ast} (P + Q) u = u^{\ast} P u + u^{\ast} Q u.&#xA;$$&#xA;As $u^{\ast} P u$ and $u^{\ast} Q u$ are both nonnegative and sum to zero, they must both be zero. Because $u^{\ast} P u = 0$, we have that $u \perp \operatorname{im}(P)$. We have just proved that&#xA;$$&#xA;\operatorname{im}(P+Q)^{\perp} \subseteq \operatorname{im}(P)^{\perp},&#xA;$$&#xA;which is equivalent to the first containment above that we're aiming to prove, so we're done.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-09-05T20:34:05.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4172" PostTypeId="2" ParentId="4164" CreationDate="2018-09-06T08:31:42.163" Score="13" Body="&lt;p&gt;The Helstrom measurement is the measurement that has the minimum error probability when trying to distinguish between two states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's imagine you have two pure states $|\psi\rangle$ and $|\phi\rangle$, and you wish to know which it is that you have. If $\langle\psi|\phi\rangle=0$, then you can specify a measurement with three projectors&#xA;$$&#xA;P_{\psi}=|\psi\rangle\langle\psi|\qquad P_{\phi}=|\phi\rangle\langle\phi|\qquad \bar P=\mathbb{I}-P_{\psi}-P_{\phi}.&#xA;$$&#xA;(For a two-dimensional Hilbert space, $\bar P=0$.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is what measurement should you perform in the case that $\langle\psi|\phi\rangle\neq0$? Specifically, let's assume that $\langle\psi|\phi\rangle=\cos(2\theta)$, and I'll concentrate just on projective measurements (IIRC, this is optimal). In that case, there is always a unitary $U$ such that&#xA;$$&#xA;U|\psi\rangle=\cos\theta|0\rangle+\sin\theta|1\rangle\qquad U|\phi\rangle=\cos\theta|0\rangle-\sin\theta|1\rangle.&#xA;$$&#xA;Now, those states are optimally distinguished by $|+\rangle\langle +|$ and $|-\rangle\langle -|$ (you get $|+\rangle$, and you assume you had $U|\psi\rangle$). Hence, the optimal measurement is&#xA;$$&#xA;P_{\psi}=U^\dagger|+\rangle\langle+|U\qquad P_{\phi}=U^\dagger|-\rangle\langle-|U\qquad \bar P=\mathbb{I}-P_{\psi}-P_{\phi}.&#xA;$$&#xA;The success probability is&#xA;$$&#xA;\left(\frac{\cos\theta+\sin\theta}{\sqrt{2}}\right)^2=\frac{1+\sin(2\theta)}{2}.&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, how do you distinguish between two density matrices $\rho_1$ and $\rho_2$? Start by calculating&#xA;$$&#xA;\delta\rho=\rho_1-\rho_2,&#xA;$$&#xA;and finding the eigenvalues $\{\lambda_i\}$ and corresponding eigenvectors $|\lambda_i\rangle$ of $\delta\rho$. You construct 3 measurement operators&#xA;$$&#xA;P_1=\sum_{i:\lambda_i&amp;gt;0}|\lambda_i\rangle\langle\lambda_i|\qquad P_2=\sum_{i:\lambda_i&amp;lt;0}|\lambda_i\rangle\langle\lambda_i|\qquad P_0=\mathbb{I}-P_1-P_2.&#xA;$$&#xA;If you get answer $P_1$, you assume you had $\rho_1$. If you get $P_2$, you had $\rho_2$, while if you get $P_0$ you simply guess which you had. You can verify that this reproduces the pure state strategy described above. What's the success probability of this strategy?&#xA;$$&#xA;\frac12\text{Tr}((P_1+P_0/2)\rho_1)+\frac12\text{Tr}((P_2+P_0/2)\rho_2)&#xA;$$&#xA;We can expand this as&#xA;$$&#xA;\frac14\text{Tr}((P_1+P_2+P_0)(\rho_1+\rho_2))+\frac14\text{Tr}((P_1-P_2)(\rho_1-\rho_2))&#xA;$$&#xA;Since $P_1+P_2+P_0=\mathbb{I}$ and $\text{Tr}(\rho_1)=\text{Tr}(\rho_2)=1$, this is just&#xA;$$&#xA;\frac12+\frac14\text{Tr}((P_1-P_2)(\rho_1-\rho_2))=\frac12+\frac14\text{Tr}|\rho_1-\rho_2|.&#xA;$$&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-09-06T08:49:45.420" LastActivityDate="2018-09-06T08:49:45.420" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4173" PostTypeId="2" ParentId="4169" CreationDate="2018-09-06T09:29:18.490" Score="3" Body="&lt;p&gt;Quantum simulation can be used to test models that could describe certain biological process. For example, a &lt;a href=&quot;https://www.nature.com/articles/s41467-018-03312-x&quot; rel=&quot;nofollow noreferrer&quot;&gt;2018 paper by Potočnik et al.&lt;/a&gt; examined light harvesting models using superconducting quantum circuits (see figure below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently, it's an open question whether quantum mechanics plays an important functional role in biological processes. Some candidate biological processes where quantum mechanics may have such a role include magnetoreception in birds, olfaction, and light harvesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cArLX.jpg&quot; alt=&quot;Figure from the paper by Potočnik et al. 2018&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1937" LastEditDate="2018-09-07T07:53:29.043" LastActivityDate="2018-09-07T07:53:29.043" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4174" PostTypeId="2" ParentId="4169" CreationDate="2018-09-06T17:29:43.353" Score="4" Body="&lt;p&gt;I was not able to find references specifically in quantum biology. &#xA;I found however a review called &lt;a href=&quot;https://docs.google.com/viewer?url=http%3A%2F%2Frsta.royalsocietypublishing.org%2Fcontent%2Froypta%2F368%2F1924%2F3581.full.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Assisted biomolecular modeling&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may find it interesting but this is from 2010. The field has evolved since but I guess the ideas remain similar. The authors focus more on the idea of the ability of a quantum computer to try every classical paths simultaneously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know much about the field and common practice. However if computational biology is more focused on Optimization, then applying quantum search algorithms or hybrid classical-quantum setups should be suited (even if not that practical at the moment). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now about Machine Learning, it is a bit unclear with quantum computing. Especially with the name Quantum Machine Learning. Different approaches/goals are taken. Some algorithms are designed for getting a speedup on classical algorithms (based on a hypothetical device called qRAM) like K-Means, SVM... Or use QC for helping the learning process in classical algorithms like restricted boltzmann machines.&#xA;Some focus on doing ML with quantum data like compressing quantum data for instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conclusion: we do not have a clear idea yet but this makes it exciting. In the process, we may just create new algorithms or improve current classical ones. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Recently a &lt;a href=&quot;https://medium.com/rigetti/introducing-rigetti-quantum-cloud-services-c6005729768c&quot; rel=&quot;nofollow noreferrer&quot;&gt;press release&lt;/a&gt; announced a partnership between Rigetti Computing and Entropica Labs to develop real world applications of quantum computing to bioinformatics and genomics.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="1937" LastEditDate="2018-09-10T18:32:48.373" LastActivityDate="2018-09-10T18:32:48.373" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4175" PostTypeId="1" CreationDate="2018-09-06T18:07:11.240" Score="11" ViewCount="257" Body="&lt;p&gt;I have a superconducting system with tens of qubits, each of which can be tuned using DC flux.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the main tasks for coherent manipulation of the qubits is to find good idling frequencies and operating points for entangling gates. This effort is confounded by two-level systems (TLS), which cause rapid energy relaxation, and wreak general havok on coherent manipulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I spent a long time finding a good set of idling frequencies and operating points, all the while considering the locations of the TLS's, and then one day I came in the the lab and they had moved around! I had to start all over again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to learn more about how and why TLS's move, and whether it's possible to maybe control the movement. As part of my research, I want to poll the community and see what other people's experience with this problem is like.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1867" LastEditDate="2018-09-10T18:31:51.767" LastActivityDate="2018-12-22T15:14:07.163" Title="Superconducting qubit researchers: Do your TLS's move?" Tags="&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4176" PostTypeId="2" ParentId="1881" CreationDate="2018-09-07T14:44:17.900" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Dimension_(vector_space)&quot; rel=&quot;nofollow noreferrer&quot;&gt;dimension of a vector space&lt;/a&gt; is the number of vectors that make up its basis.&lt;br&gt;&#xA;For a qubit, there's two basis vectors: [ 1 0 ], and [ 0 1 ]. Therefore the dimension of the vector space is 2. &lt;/p&gt;&#xA;" OwnerDisplayName="user2898" LastActivityDate="2018-09-07T14:44:17.900" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4177" PostTypeId="1" AcceptedAnswerId="4189" CreationDate="2018-09-08T09:12:56.557" Score="2" ViewCount="223" Body="&lt;p&gt;If the state of one qubit can be described by a ray in $\mathbb{C}^2$, then the combined state of an $n$-qubit system can be described by a ray in $(\mathbb{C}^2)^{\otimes n}=\mathbb{C}^{2 n}$. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if $G_1$ is the Pauli group of one qubit, with the 16 elements&#xA;$$G_1=\{i,-1,-i,1\}\times\{I,X,Y,Z\}\,,$$&#xA;the Pauli group on $n$ qubits is defined by&#xA;$$G_n=\{i,-1,-i,1\}\times\{I,X,Y,Z\}^{\otimes n}$$&#xA;which &lt;strong&gt;not the tensor product of $n$ Pauli groups $G_1$&lt;/strong&gt; (because $G_n$ contains $4\cdot 4^n$ elements, which does not equal $16^n$). My question thus is: what kind of tensor product do we use on the space of operators on a Hilbert space $\mathbb{C}^2$, to define $G_n$ using $G_1$? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I do understand intuitively that we should disregard global phase (and that therefore the number of operators in the $n$-qubit Pauli group is not $16^n$), and that this can be done by introducing the &lt;em&gt;projective Hilbert space&lt;/em&gt;, but how do tensor products work on the space of operators on a projective Hilbert space?)&lt;/p&gt;&#xA;" OwnerUserId="4534" LastEditorUserId="26" LastEditDate="2018-12-23T12:43:01.853" LastActivityDate="2018-12-23T12:43:01.853" Title="Tensor product between operators" Tags="&lt;tensor-product&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4178" PostTypeId="1" AcceptedAnswerId="5524" CreationDate="2018-09-08T12:21:21.077" Score="7" ViewCount="127" Body="&lt;p&gt;[I'm sorry, I've already posted the &lt;a href=&quot;https://physics.stackexchange.com/questions/427393/is-there-a-relation-between-the-factorisation-of-the-joint-conditional-probabili&quot;&gt;same question&lt;/a&gt; in the physics community, but I haven't received an answer yet.] &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm approaching the study of Bell's inequalities and I understood the reasoning under the Bell theorem (&lt;a href=&quot;https://cds.cern.ch/record/111654/files/vol1p195-200_001.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ON THE EINSTEIN PODOLSKY ROSEN PARADOX&lt;/a&gt; (PDF)) and how the postulate of locality was assumed at the start of the demonstration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I find problematic to arrive at the equivalence &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ E(\vec{a},\vec{b}) = \int_{\Lambda}d\lambda \rho(\lambda)A(\vec{a},\lambda)B(\vec{b},\lambda),$$&lt;/span&gt;&lt;br&gt;&#xA;starting from the point of view expressed by the Clauser and Horne definition of locality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CH claimed that a system is local if there is a parameter &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and a joint conditional probabilities that can be written as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(a,b|x,y,\lambda) = p(a|x,\lambda)p(b|y,\lambda),$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$$p(a,b|x,y) = \int_\Lambda d\lambda \rho(\lambda) p(a|x,\lambda)p(b|y,\lambda)$$&lt;/span&gt;&#xA;which make sense since it affirms that the probability of obtaining the value &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; depends only on the measument &lt;span class=&quot;math-container&quot;&gt;$x = \vec{\sigma}\cdot\vec{x} $&lt;/span&gt; and the value of &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if I use this expression to write down the expectation value of the products of the two components &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}\cdot\vec{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}\cdot\vec{b}$&lt;/span&gt;, I obtain as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;E (\vec{a},\vec{b}) = \sum_{i,j}a_ib_jp(a,b|x,y) = \\&#xA;= \sum_{ij}a_ib_j \int_\Lambda d\lambda \rho(\lambda)  p(a|x,\lambda)p(b|y,\lambda) \\&#xA;= \int_\Lambda d\lambda \rho(\lambda) (\sum_{i}a_ip(a|x,\lambda))(\sum_{i}b_ip(b|y,\lambda)) &#xA;$$&lt;/span&gt;&#xA;where in the last equivalence I've used the fact that if the measument are independent their covariance must be equal to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, the terms in the RHS in the brackets are equal to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (\sum_{i}a_ip(a|x,\lambda)) = E(a,\lambda) =? = A(\vec{a},\lambda)\quad \quad  (\sum_{i}b_ip(b|y,\lambda)) = E(b,\lambda) =?= B(\vec{b},\lambda).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is not the equivalence that I want to find. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact in the RHS of the first equation &lt;span class=&quot;math-container&quot;&gt;$A(\vec{a},\lambda)$&lt;/span&gt; is, according to Bell original article, the result of measure &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}\cdot\vec{a}$&lt;/span&gt;, and fixing both &lt;span class=&quot;math-container&quot;&gt;$\vec{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; it can assume only the values of &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt;. (The same is applied for &lt;span class=&quot;math-container&quot;&gt;$B(\vec{b},\lambda)$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some of you knows, where I fail? How can I obtain the original equivalence (that then is proved to be violate in the case of an entangled system) starting from the CH definition of reality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit #1:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've noted that I obtain the wanted equivalence only if I assume that  &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy\lambda) = E(\vec{a}\vec{b})$&lt;/span&gt;, but is it possible? How can a conditional probability be linked to the mean value of the product of two components?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit #2:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surfing the internet I found an article (&lt;a href=&quot;https://arxiv.org/abs/1709.04260&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1709.04260&lt;/a&gt;, page 2, right on the top) which reports the same CH's local condition (to be accurate, the article presents the discrete version) and then affirm that: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Blockquote&#xA;  &quot;The central realization of Bell’s theorem is the fact that there are quantum correlations obtained by local measurements (&lt;span class=&quot;math-container&quot;&gt;$M_a^x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_b^y$&lt;/span&gt;) on distant parts of a joint entangled state &lt;span class=&quot;math-container&quot;&gt;$\varrho$&lt;/span&gt;, that according to quantum theory are described as:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$p_{Q}(a,b,|x,y) = \text{Tr}(\varrho(M_a^x\otimes M_b^y) $$&lt;/span&gt;&#xA;  and cannot be decomposed in the LHV form (i.e. The CH condition for locality)&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So why &lt;span class=&quot;math-container&quot;&gt;$p_Q(a,b|x,y)$&lt;/span&gt; is seen as a measure of quantum correlation (that for definition is the mean of the product of the possible output)? It isn't a joint probability distribution (as stating while obtaining the LHV form)?&#xA;Is there a link between the classical correlation (&lt;span class=&quot;math-container&quot;&gt;$E(\vec{a},\vec{b})$&lt;/span&gt;) and the joint probability distribution &lt;span class=&quot;math-container&quot;&gt;$p(a,b|x,y,\lambda)$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="4541" LastEditorUserId="26" LastEditDate="2019-05-13T16:10:52.060" LastActivityDate="2019-05-13T16:10:52.060" Title="Is there a relation between the factorisation of the joint conditional probability distribution and Bell inequality?" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4179" PostTypeId="1" AcceptedAnswerId="4180" CreationDate="2018-09-08T14:49:17.523" Score="6" ViewCount="385" Body="&lt;p&gt;It is known that in a classical computer we can't generate a purely random number by deterministic process. I am taking a course in Quantum Computing, recently I learnt that using state we can generate a deterministic process which will produce random number &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle $&lt;/span&gt;. But, I am not aware of the physical implementation and very excited to know about it. I have searched online and got &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1103/1103.4381.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, but this needs knowledge of architecture inside QC I think.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone explain(from basic please) how we can develop a deterministic process to generate &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle $&lt;/span&gt; random-ly? Also explain please how that process is a deterministic one.&lt;/p&gt;&#xA;" OwnerUserId="3023" LastEditorUserId="26" LastEditDate="2018-12-13T20:07:04.640" LastActivityDate="2019-11-15T06:21:57.917" Title="Randomness from deterministic machine" Tags="&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4180" PostTypeId="2" ParentId="4179" CreationDate="2018-09-08T17:09:32.207" Score="6" Body="&lt;p&gt;We start with the following qbit state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle = |1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we apply the Hadamard gate to that qbit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$H|\psi\rangle =&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}&#xA;\end{bmatrix}\begin{bmatrix} 0 \\ 1 \end{bmatrix}&#xA;= \begin{bmatrix}\frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting state is also known as the $|-\rangle$ state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can measure this state in the $|0\rangle$, $|1\rangle$ basis (also called the computational basis) and it will collapse to $|0\rangle$ or $|1\rangle$ with the following probabilities:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P[|0\rangle] = |\frac{1}{\sqrt{2}}|^2 = \frac 1 2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$P[|1\rangle] = |\frac{-1}{\sqrt{2}}|^2 = \frac 1 2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that quantum mechanics is indeed fundamentally probabilistic, this gives you a deterministic random number generator.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-09-08T17:09:32.207" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4183" PostTypeId="1" AcceptedAnswerId="4216" CreationDate="2018-09-09T01:17:57.037" Score="7" ViewCount="228" Body="&lt;p&gt;In &lt;a href=&quot;http://algassert.com/post/1717&quot; rel=&quot;noreferrer&quot;&gt;Breaking Down the Quantum Swap&lt;/a&gt;, it is stated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thanks to the CNOT, we can implement a xor-swap on a quantum computer. All we need to do is chain three CNOTs back and forth.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4125/quantum-xor-cipher-construction#comment4566_4125&quot;&gt;comment&lt;/a&gt; to a previous question, the author of the aforementioned post states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The quantum equivalent of the one time pad (i.e. xoring a message with a secret key) is quantum teleportation. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Near the end of the post there is this circuit graphic&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V9zIn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V9zIn.png&quot; alt=&quot;swapping qubits with quantum teleportation (ahead of time)&quot;&gt;&lt;/a&gt;&#xA;&amp;amp; it is also stated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I would go into detail about how this works, but honestly it's just two quantum teleportations shoved together and this post is already way too long.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can someone provide more detail on &lt;em&gt;just&lt;/em&gt; two quantum teleportations?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a generalization for $n$ quantum teleportations?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-13T21:01:20.280" LastActivityDate="2018-12-13T21:01:20.280" Title="Generalization for $n$ quantum teleportations" Tags="&lt;quantum-information&gt;&lt;resource-request&gt;&lt;circuit-construction&gt;&lt;teleportation&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4184" PostTypeId="2" ParentId="4183" CreationDate="2018-09-09T09:26:28.353" Score="2" Body="&lt;p&gt;I suggest firstly reading up on famous 1935 EPR paper which should lead to some interesting thoughts about the nature of entangled quantum states.&#xA;To then see how these thoughts are applied to Quantum Teleportation, I suggest page 26 of the all too famous Quantum Computing bible by &lt;a href=&quot;http://admin.cambridge.org/gb/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mike &amp;amp; Ike&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now since you can only measure once affectively what you must do is build a long chain of qubits and then entangle that so as to reach a &quot;a generalization for $n$ quantum teleportations?&quot; and as you can imagine that has its own problems given that for larger $n$ the more decoherence and interaction you're going to get in the system and each Qubit will need a minimum of 5 other Qubits to correct for such an error, so as you can begin to appreciate this is no simple task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read more about this stuff here from people that know more about $n$ qubit Quantum teleportation in &lt;a href=&quot;https://arxiv.org/abs/1105.4160&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this will give you some good resources to further your inquiry.&#xA;Apologies for not being best suited to give a whole self contained answer myself.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastActivityDate="2018-09-09T09:26:28.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4185" PostTypeId="1" CreationDate="2018-09-09T14:08:18.430" Score="12" ViewCount="399" Body="&lt;p&gt;I understand there are a lot of programming languages (e.g. Q#, Qiskit, etc.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which one is suitable for someone that just started learning programming and doesn't know anything about quantum mechanics?&lt;/p&gt;&#xA;" OwnerUserId="2316" LastEditorUserId="2879" LastEditDate="2019-08-03T23:16:26.607" LastActivityDate="2019-08-03T23:16:26.607" Title="Which programming language is suitable for a beginner?" Tags="&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4186" PostTypeId="1" AcceptedAnswerId="4190" CreationDate="2018-09-09T16:52:00.597" Score="11" ViewCount="676" Body="&lt;p&gt;I was trying to self-study qmc by reading the Quantum Computing A Gentle Introduction book, in section 2.4 it talks about the quantum key distribution protocol BB84. After (I thought) I understood it I went to work on exercise 2.9 and 2.10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex. 2.9 is asking &lt;em&gt;how many bits do Alice and Bob need to compare to be 90% confident that there is no Eve present in BB84.&lt;/em&gt; So if I understood correctly, BB84 is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Alice randomly chooses a basis/polarization of photon from the two bases &lt;span class=&quot;math-container&quot;&gt;$\{ | 0 \rangle, | 1 \rangle \}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{ |+\rangle, |-\rangle \}$&lt;/span&gt; to encode the bit information &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (the encoding rule is known e.g. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; represents &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;). Then she sends a sequence of such photons to Bob.&lt;/li&gt;&#xA;&lt;li&gt;Bob receives the sequence of photons and randomly chooses a basis from the two same bases and measures for each one of the photon.&lt;/li&gt;&#xA;&lt;li&gt;They then compare the bases they chose and discard the ones where they chose base differently. Bob should be able to figure out what bit Alice is trying to send. (e.g. if the base they use is &lt;span class=&quot;math-container&quot;&gt;$\{ |0\rangle, |1\rangle \}$&lt;/span&gt; and Bob has measured using the basis &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; but got &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; light intensity then he knows that Alice's polarization was &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; so the bit information is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;li&gt;To be more secure, they also compare a subset of bits, if there is no interference then their bits should all agree. They discard these bits and what left is the key.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Eve, on the other hand, is trying to intercept the photon from Alice, measures it randomly from the two bases too, then she sends the basis she uses for measurement to Bob. After Alice &amp;amp; Bob publicly compare their bases, Eve can know &lt;span class=&quot;math-container&quot;&gt;$25%$&lt;/span&gt; of the key for sure, although she inevitably changed the photon Bob would have received.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to answer the first question ex. 2.9, I listed out different scenarios when Alice and Bob compare a subset of bits :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose Alice sends a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There is &lt;span class=&quot;math-container&quot;&gt;$0.25$&lt;/span&gt; probability Eve also measures with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then she would not get detected.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$0.25$&lt;/span&gt; - Eve measures using &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then she would get detected for sure as Bob will get the opposite bit value as Alice.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$0.25$&lt;/span&gt; chance Eve measures using &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, Bob now will receive &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, then if Bob uses &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and obtain the same with &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt; chance, else if he uses &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to measure but still end up with the correct bit with &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt; chance. That is &lt;span class=&quot;math-container&quot;&gt;$0.25 \times (0.5 + 0.5) = 0.25$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Same as 3, 0.25&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So to sum up the probability Eve would go undetected, it's &lt;span class=&quot;math-container&quot;&gt;$0.25 + 0 + 0.25 + 0.25 = 3/4$&lt;/span&gt;, and we want the sequence of bits Eve goes undetected be less than &lt;span class=&quot;math-container&quot;&gt;$10%$&lt;/span&gt;, which yields &lt;span class=&quot;math-container&quot;&gt;$(\frac{3}{4})^n &amp;lt; 0.1$&lt;/span&gt;, approximately &lt;span class=&quot;math-container&quot;&gt;$n=8$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question 2.10c, modifies the condition a little bit, &lt;em&gt;instead of Eve chooses from the two known bases (the standard and the &lt;span class=&quot;math-container&quot;&gt;$+/-$&lt;/span&gt;), she does not know which to choose so she chooses randomly, then how many bits A&amp;amp;B needs to compare to have 90% confidence?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My approach is that, suppose Alice still uses standard base &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle |1\rangle \}$&lt;/span&gt; and she sends a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Now Eve can measure it in her base &lt;span class=&quot;math-container&quot;&gt;$\{ |e_1\rangle, |e_2\rangle \}$&lt;/span&gt; where&#xA;&lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle = \cos\theta|0\rangle + \sin\theta|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle = \sin\theta|0\rangle-\cos\theta|1\rangle$&lt;/span&gt;, then Eve sends off the basis she uses to Bob again. I'm again listing out the scenarios,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If Eve measures with &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt; (with 0.5 chance) then Bob receives &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt;, then if Bob measures with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then he gets correct bit with &lt;span class=&quot;math-container&quot;&gt;$|\cos\theta|^2$&lt;/span&gt; probabiltity, if he measures in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then he gets correct bit with &lt;span class=&quot;math-container&quot;&gt;$1 - |\sin\theta|^2=|\cos\theta|^2$&lt;/span&gt;. Simiarly when Eve uses &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;sum up then I got &lt;span class=&quot;math-container&quot;&gt;$0.5\times(2|\cos\theta|^2)+0.5\times(2|\sin\theta|^2)=1$&lt;/span&gt;, this for sure is not correct! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I tried to search online and found a solution &lt;a href=&quot;https://phys140.files.wordpress.com/2012/09/soln2-10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, where it says the probability Bob gets correct bit is instead: &lt;span class=&quot;math-container&quot;&gt;$|\langle0|e_1\rangle\langle e_1|0\rangle|^2 + |\langle0|e_2\rangle\langle e_2|0\rangle|^2 =\cos^4\theta+\sin^4\theta$&lt;/span&gt;, then integrate over &lt;span class=&quot;math-container&quot;&gt;$[0, \frac{\pi}{2}]$&lt;/span&gt; (normalized by &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;) is &lt;span class=&quot;math-container&quot;&gt;$\frac{3}{4}$&lt;/span&gt; which is again same as in ex2.9. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain why it's &lt;span class=&quot;math-container&quot;&gt;$\cos^4\theta+\sin^4\theta$&lt;/span&gt; in both math details and high-level intuition (e.g. why even Eve does not know which base to use it still requires 8 bits comparison for A&amp;amp;B?)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="2069" LastEditorUserId="2927" LastEditDate="2021-02-20T22:16:11.193" LastActivityDate="2021-02-20T22:16:11.193" Title="How many bits do Alice and Bob needs to compare to make sure the channel is secure in BB84?" Tags="&lt;cryptography&gt;&lt;communication&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4187" PostTypeId="2" ParentId="4185" CreationDate="2018-09-09T18:11:35.863" Score="8" Body="&lt;p&gt;The languages themselves are all essentially the same for a new user. They all implement the same basic set of quantum operations, which are the ones that have been used by researchers for the last few decades.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you’ve just started programming, the most relevant factor for you might be the language that the quantum SDK that is written in. They are mostly in Python, but QISKit also has Swift and Java variants. Q# is integrated into Visual Studio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond this, there are differences in things like&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;tutorial materials &lt;/li&gt;&#xA;&lt;li&gt;the simulators or real quantum devices your programs will run on&lt;/li&gt;&#xA;&lt;li&gt;high-level applications  that require no quantum knowledge.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am very biased in what I recommend (and so I hope that others biased in different directions will also answer your question) but I’d say that taking a look at the &lt;a href=&quot;https://medium.com/qiskit&quot; rel=&quot;noreferrer&quot;&gt;QISKit blog&lt;/a&gt; might be a good start. Here’s a couple of my own articles&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://medium.com/qiskit/hello-quantum-2c1c00fe830c&quot; rel=&quot;noreferrer&quot;&gt;Hello Quantum: Taking your first steps into quantum computation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://medium.com/qiskit/how-to-program-a-quantum-computer-982a9329ed02&quot; rel=&quot;noreferrer&quot;&gt;How to program a quantum computer&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-09-10T07:16:16.770" LastActivityDate="2018-09-10T07:16:16.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4188" PostTypeId="2" ParentId="4177" CreationDate="2018-09-09T21:21:46.870" Score="2" Body="&lt;p&gt;Tensor products &lt;em&gt;always&lt;/em&gt; mod out $\mathbb C$ (or $\mathbb R$, or whatever field your vector space is defined over).  Thus, there is only &lt;em&gt;one&lt;/em&gt; phase in the tensor product.  This is also true for the corresponding space of operators, and thus also for $G_1^{\otimes N}$.  This is just the normal definition of the tensor product.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-09-09T21:21:46.870" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4189" PostTypeId="2" ParentId="4177" CreationDate="2018-09-10T00:53:21.880" Score="2" Body="&lt;p&gt;The group &lt;span class=&quot;math-container&quot;&gt;$(G_1)^{n}$&lt;/span&gt; does act on &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{\otimes n}$&lt;/span&gt; (you made a typo with &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2n}$&lt;/span&gt; vs &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n}$&lt;/span&gt;) but the action factors through a quotient thereof. So you can write down this group initially as the set of all &lt;span class=&quot;math-container&quot;&gt;$(a_1 \sigma^{0,x,y,z}_1  \otimes \cdots a_n \sigma^{0,x,y,z}_n)$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$a_i \in \{ 1,i,-1,-1 \}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma^0=Id_2$&lt;/span&gt;. Not using the properties of &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; to shuffle the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; through yet. Each tensorand is a copy of &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; and these factors commute amongst each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then when we interpret the symbol &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt;, we see that &lt;span class=&quot;math-container&quot;&gt;$i \sigma^0_1 \otimes -i \sigma^0_2 \otimes 1 \sigma^0_3 \otimes \cdots \otimes 1 \sigma^0_n$&lt;/span&gt; acts trivially. It is in the kernel of the map &lt;span class=&quot;math-container&quot;&gt;$(G_1)^{n} \to Aut((\mathbb{C}^2)^{\otimes n})$&lt;/span&gt;. By understanding this kernel, one sees that &lt;span class=&quot;math-container&quot;&gt;$(G_1)^{n}/(ker) \simeq G_n$&lt;/span&gt;. There are still some global phases from the &lt;span class=&quot;math-container&quot;&gt;$\{1,i,-1,-i\}$&lt;/span&gt; factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose one wants to work projectively from the very beginning. Then on 1-qubit we have some subgroup of &lt;span class=&quot;math-container&quot;&gt;$PU(2)$&lt;/span&gt;. In this case &lt;span class=&quot;math-container&quot;&gt;$PG_1 \simeq \mathbb{Z}_2^2$&lt;/span&gt;. Then for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits you even lose that first global phases factor above and are only left with &lt;span class=&quot;math-container&quot;&gt;$(PG_1)^n \simeq PG_n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="5296" LastEditDate="2018-12-11T15:33:00.873" LastActivityDate="2018-12-11T15:33:00.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4190" PostTypeId="2" ParentId="4186" CreationDate="2018-09-10T09:04:01.213" Score="8" Body="&lt;p&gt;Your analysis of Eve's cheating doesn't seem quite right (although the final answer is correct). What you need to say is: Assume Alice prepares a particular state in one of the bases. You could assume that's $|0\rangle$, but you can make the argument more generally.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;With 50% probability, Eve measures in the same basis that Alice prepared in (the 0/1 basis in this case). Eve is guaranteed to get the same answer (0), and so Bob will still get the same answer (0) because we're working specifically in the set of cases where Bob measures in the same basis as Alice. Eve is not detected.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;With 50% probability, Eve measures in the other basis. She'll get an answer. It doesn't actually matter what it is (in this case, either $|+\rangle$ or $|-\rangle$). Bob receives whatever that state is, and measures in the original basis, and gets the two different outcomes with 50:50 probability. Eve never learns anything about Alice's chosen bit, and she is detected half the time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Overall, Eve learns the bit value half the time, and is detected in 1/4 of the cases. Now, strictly, you should average over all possible inputs of Alice. But there's sufficient symmetry in this simple case that all the outcomes are the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second question, you've missed one important feature: if Eve changes her measurement basis, the probability that she gets the different results varies (you've kept it fixed at 1/2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;High-level hand waving: If Eve chooses a basis which is very close to the 0/1 basis, she is almost guaranteed to get the same answer as the bit value Alice was sending (if she was sending in the 0/1 basis), and she is almost guaranteed to not be detected. As you get further away from that basis, Eve learns less, and is more likely to be detected. But, the trade-off is that if Alice had used the &lt;em&gt;other&lt;/em&gt; basis, her chance of being detected decreases, and her knowledge of the bit improves. That said, it is not a perfect trade-off. I'll show you why very easily: Imagine that Alice is using the two standard bases. What if Eve measures in the basis $(|0\rangle\pm i|1\rangle)/\sqrt{2}$ every time? It is &lt;em&gt;always&lt;/em&gt; the case (no matter which basis Alice chooses) that there is a 50% chance of Eve being detected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, what you were supposed to say was to imagine Alice sent $|0\rangle=\cos\theta|e_1\rangle+\sin\theta|e_2\rangle$. Thus, with probability $\cos^2\theta$, Eve gets answer $|e_1\rangle$, which gets passed on to Bob, who gets answer $|0\rangle$ with probability $\cos^2\theta$. Meanwhile, with probability $\sin^2\theta$, Eve gets answer $|e_2\rangle$, sends it on to Bob, and he gets answer $|0\rangle$ with probability $\sin^2\theta$. Thus, the overall probability of Bob not detecting anything is&#xA;$$&#xA;\cos^4\theta+\sin^4\theta=1-\frac12\sin^2(2\theta),&#xA;$$&#xA;given that Alice sent $|0\rangle$. The analysis will be identical if Alice sent $|1\rangle$. However, you do need to repeat the analysis for if Alice sent $|+\rangle$. (At this moment, it should become apparent that you needed a phase parameter in your definition of $|e_1\rangle$ and $|e_2\rangle$ if you truly want to average over all possible bases, but I'll keep going with your definition.) So, assume Alice sent $|+\rangle=((\cos\theta+\sin\theta)|e_1\rangle-(\cos\theta-\sin\theta)|e_2\rangle)/\sqrt{2}$. So, Eve gets answer $|e_1\rangle$ with probability $(\cos\theta+\sin\theta)^2/2$, and Bob gets answer $|+\rangle$ with probability $(\cos\theta+\sin\theta)^2/2$. Hence, overall, the probability of Eve not being detected is&#xA;$$&#xA;\left(\frac{\cos\theta+\sin\theta}{\sqrt{2}}\right)^4+\left(\frac{\cos\theta-\sin\theta}{\sqrt{2}}\right)^4=1-\frac12\cos^2(2\theta).&#xA;$$&#xA;Averaging over all possible inputs of Alice, we therefore get&#xA;$$&#xA;\frac12\left(1-\frac12\cos^2(2\theta)\right)+&#xA;\frac12\left(1-\frac12\sin^2(2\theta)\right)=\frac34.&#xA;$$&#xA;At this point, the $\theta$ has disappeared. We don't have to average over all possible $\theta$. However, note that if we had correctly introduced a phase $\phi$ in the definition of $|e_1\rangle$, it would be necessary to perform some averaging. Moreover, the solution that you cite does not do that averaging correctly. Remember that if you want to convert from an integral in $(x,y)$ coordinates to an integral in $(r,\theta)$ coordinates, you need a conversion. You're going to have to perform an integral that's something like&#xA;$$&#xA;\frac{1}{2\pi}\int_0^{2\pi}d\phi\int_{0}^{\pi/2}\sin(2\theta)d\theta f(\theta,\phi),&#xA;$$&#xA;where $f(\theta,\phi)$ is the probability of detecting Eve for a given $\theta,\phi$. (You probably want to check out this formula carefully, and verify factors of 2, as I've written this from memory. It gets a bit messy because, given you've used an angle $\theta$ in the definition of $|e_1\rangle$, that translates into an angle of $2\theta$ on the Bloch sphere.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing we haven't calculated it how much Eve learns. If she corresponds $|e_1\rangle$ with bit value 0, and $|e_2\rangle$ with bit value 1, she is correct with probability&#xA;$$&#xA;\frac12\left(\cos^2\theta+\left(\frac{\cos\theta+\sin\theta}{\sqrt{2}}\right)^2\right).&#xA;$$&#xA;You could average this over $\theta$, but one of the interesting things to observe is that if Eve does know that two bases that are being used, she can optimise her value of $\theta$. The value $\theta=\frac{\pi}{8}$ gives her more knowledge (on average) that setting $\theta=0$ or $\pi/4$ (which are effectively the cases you analysed in the first question.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-10T09:04:01.213" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4191" PostTypeId="1" AcceptedAnswerId="4192" CreationDate="2018-09-10T09:45:06.420" Score="3" ViewCount="90" Body="&lt;p&gt;I've been taking a course on Quantum Mechanics in which, right now, I'm learning about its application in Computing to give Quantum Computing. &#xA;Quantum Mechanics is a concept that is applied to microscopic particles explaining their motion, behaviour etc. in the microscopic (quantum world). How is this correlated to computing? They seem entirely different things.&lt;/p&gt;&#xA;" OwnerUserId="4557" LastEditorUserId="1837" LastEditDate="2018-09-10T09:49:49.910" LastActivityDate="2018-09-10T10:04:15.417" Title="How is Quantum Mechanics (a Physics Concept) used in computing?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4192" PostTypeId="2" ParentId="4191" CreationDate="2018-09-10T10:04:15.417" Score="3" Body="&lt;p&gt;Here's a simple idea that relates the two:&#xA;If you're going to build a computer, you have to build a computer out of something. What you can get that computer to do must be bound by what the stuff you've built it out of can do. So, physics is very important for telling you what a computer can do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I put it like this, there's a clear relation between the two. But it &lt;em&gt;looks&lt;/em&gt; like physics is going to be a limiting factor, telling you that you can't do things. For example, there's a finite speed of communication between two physically separate entities (the bits in your computer), determined by the speed of light, so there's a maximum speed of operations. You can't put things (your bits) too close together, or they'l  turn into a black hole, so there's a maximum density storage. OK, these numbers are crazy, and really not limits on existing hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the real question here is how could physics possibly let you do something better? There's a cute example that I like. Think about two rooms. One room has 3 light switches, and the other has 3 light bulbs. Each switch switches exactly 1 bulb. Your job is to determine which switch matches each bulb, but you're only allowed to visit each room once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, a computer scientist will look at this problem and tell you it's impossible. There are 6 possible ways of wiring up the switches to the bulbs. You need $\log_2(6)$ bits of information to describe that. But, by flicking some switches and observing the bulbs, you only get $\log_2(3)$ bits of information, which is insufficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A physicist has several tricks. For example, switch 2 bulbs one, and wait a long time. Then switch one off. Now go into the bulb room. One bulb is on, one is warm, and one is cold. So, you can perfectly map switches to bulbs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point here is that we've used physics to do better. The problem is that the computer scientist used an abstraction of the system that actually made several assumptions about the system, and the physicist exploited the difference between the assumption and the reality. It's kind of similar with classical versus quantum computers. In effect, the theory of classical computation assumes probability theory. But probability theory isn't always true; at the quantum level, you need probability amplitudes. These include simple probabilities (so quantum computation includes classical), but provides more options. Hence there's the possibility for doing some things better.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-10T10:04:15.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4193" PostTypeId="1" CreationDate="2018-09-10T11:36:37.630" Score="3" ViewCount="1655" Body="&lt;p&gt;The word 'state' makes sense in Quantum Mechanics. In classical computers, numbers are represented in binary as a series of 0s and 1s. It seems that the word 'state' extracted from QM and the 0s and 1s extracted from Computing are put together to make $\lvert 0\rangle$ and $\lvert 1\rangle$. This doesn't make sense. What's the physical significance behind that representation?&lt;/p&gt;&#xA;" OwnerUserId="4557" LastEditorUserId="45" LastEditDate="2018-09-10T21:55:51.807" LastActivityDate="2018-09-11T22:44:02.777" Title="What's the physical significance of |0⟩ and |1⟩?" Tags="&lt;quantum-state&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4194" PostTypeId="2" ParentId="4193" CreationDate="2018-09-10T12:54:18.687" Score="1" Body="&lt;p&gt;The |0,1&gt; is a mathematical representation which makes correspondance with classical computing easier. But qubits can be realised by different physical systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take for instance two different polarization of a photon; the alignment of a nuclear spin in a uniform magnetic field; two states of an electron orbiting a single atom...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes instead of 0,1, you can hear spin up or spin down to refer to the computational basis state. So it is just a matter of convention. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-10T12:54:18.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4195" PostTypeId="2" ParentId="4193" CreationDate="2018-09-10T13:19:19.710" Score="8" Body="&lt;p&gt;Consider: in classical computing, what do the &lt;code&gt;0&lt;/code&gt; and the &lt;code&gt;1&lt;/code&gt; refer to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sometimes (and as suggested by Turing when he introduced Turing Machines), they represent literal symbols which are written down: a &lt;strong&gt;'0'&lt;/strong&gt; character, or a &lt;strong&gt;'1'&lt;/strong&gt; character. But when we use electronic computers, they more often refer to a low voltage versus a high voltage, or a magnetic field pointing in one direction or another. In each of these cases, what we are looking for is some physical system, in which there are some 'states' (either ink on a piece of paper, voltages in a wire, or direction of a magnetic field) which we can easily distinguish from one another (by seeing the differences in the ink patterns under ambient light, or by a suitable piece of electronics).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, as in quantum mechanics, we are considering questions of the state of a physical system, and the reason for this is that information must always be encoded in terms of physically distinguishable properties of the ways that a system could be &amp;mdash; properties of the &lt;em&gt;state&lt;/em&gt; of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we consider quantum computation, we have the same situation, only we have to be much more precise in what we are distinguishing. We not only want to have easily distinguished properties &amp;mdash; like the orientation of an electron spin, or the polarisation of a photon &amp;mdash; but for those properties also not to be closely coupled to any other properties of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we can succeed in this, and if that relatively isolated degree of freedom can have only two distinct values (which we could give any labels that we like, such as &lt;code&gt;value A&lt;/code&gt; and &lt;code&gt;value B&lt;/code&gt;, or indeed &lt;code&gt;'0'&lt;/code&gt; and &lt;code&gt;'1'&lt;/code&gt;), then we identify this as a qubit. By virtue of it not being strongly coupled to any other properties of the system, we can consider any possible configuration that this isolated degree of freedom can have, so that we may consider superpositions of &lt;code&gt;'0'&lt;/code&gt; and &lt;code&gt;'1'&lt;/code&gt;, whether we can cause this degree of freedom to interact in a &lt;em&gt;controlled&lt;/em&gt; way with other measurable degrees of freedom of the system, and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often, but not always, this isolated degree of freedom (our 'qubit') is a property of one particular part of our system, such as an electron, a nuclear spin, a photon, a current through a small superconducting element, &lt;em&gt;etc.&lt;/em&gt;; and the fact that it gives us this qubit is due to the fact that it is not too strongly coupled to other electrons, photons, &lt;em&gt;etc.&lt;/em&gt; in the physical set-up being considered. Of course, arranging that this should be the case is a question of delicate engineering, but we can consider how to do so. Even so, it is not necessary that a qubit be as easily isolated as pointing to one particular physical system: once we get going with quantum error correction, particularly if we use &lt;a href=&quot;https://arxiv.org/abs/1808.02892&quot; rel=&quot;noreferrer&quot;&gt;planar surface codes&lt;/a&gt;, the story of &quot;where is my qubit&quot; may become a bit more complicated &amp;mdash; but the qubits will still be there, and will arise out of a well-controlled degree of freedom of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short: just as &lt;code&gt;'0'&lt;/code&gt; and &lt;code&gt;'1'&lt;/code&gt; are shorthand for physically distinguishable values of some degree of freedom in some classical physical system, &lt;code&gt;|0⟩&lt;/code&gt; and &lt;code&gt;|1⟩&lt;/code&gt; are shorthand for physically distinguishable values of some degree of freedom in a quantum mechanical system.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-09-10T13:19:19.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4196" PostTypeId="2" ParentId="4185" CreationDate="2018-09-10T15:53:21.420" Score="5" Body="&lt;p&gt;It depends on languages you will have more affinity with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qiskit, pyQuil, etc are in Python, which is a programming language easy to understand generally with a lot of helpful libraries. They provide documentations/tutorials to make any beginners start quantum computing. Writing codes can be done in a few lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q# is in C#. I have not tried it but if you started learning programming focusing on C or C++ (and like it), I guess you should be comfortable with this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For learning, I would recommend to read the book Quantum Computation and Quantum Information from Nielsen and Chuang or Quantum Computing for Computer Scientists from Yanofsky and Mannucci; if you can have access to them and in parallel look at some code in the platform of your choice. But it is always a good idea to combine different sources and explanations to understand better.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-09-10T18:58:31.870" LastActivityDate="2018-09-10T18:58:31.870" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4197" PostTypeId="2" ParentId="4193" CreationDate="2018-09-10T19:51:23.760" Score="1" Body="&lt;p&gt;$\left|0\right&amp;gt;$ and $\left|1\right&amp;gt;$ are shorthand for vectors in a pre-defined state space.&#xA;Their physical meaning depends on the underlying technology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you could have an optical polarization system, such that&#xA;$\left|0\right&amp;gt;$ means that the photon is vertically polarized, and&#xA;$\left|1\right&amp;gt;$ means that the photon is horizontally polarized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could have a superconducting flux loop system, such that&#xA;|0&gt; means that the loop current is clockwise (+ magnetic flux), and &#xA;|1&gt; means that the loop current is counter-clockwise (- magnetic flux).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could have differential optical system, such that&#xA;$\left|0\right&amp;gt;$ means that the photon is in the left fiber, and &#xA;$\left|1\right&amp;gt;$ means that the photon is in the right fiber.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could have a neutral atom system, such that&#xA;$\left|0\right&amp;gt;$ means that the unpaired electron spin is parallel to the nucleus spin, and&#xA;$\left|1\right&amp;gt;$ means that the unpaired electron spin is opposed to the nucleus spin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the large number of possible technologies which might be used, &#xA;you can see that this list goes on for a while.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main thing to know is that, in principle, you could build a Quantum Computer&#xA;out of any of these technologies.  The software description should be identical,&#xA;as long as certain elementary operations, such as CNOT, are supported.&#xA;A quantum algorithm which implements an Oracle should work the same way,&#xA;no matter which implementation technology is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As other people point out, this is similar to the situation in classical logic.&#xA;Ethernet, for example, could be implemented using copper wire, optical fiber, or&#xA;radio.  This is called &quot;Layer 1&quot;.  The definition of 0 and 1 depends on the&#xA;underlying technology.  What is important is that Ethernet (and TCP/IP running on&#xA;top of Ethernet) does not care what the physical implementation of the bits is.&lt;/p&gt;&#xA;" OwnerUserId="4562" LastEditorUserId="23" LastEditDate="2018-09-10T22:02:34.203" LastActivityDate="2018-09-10T22:02:34.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4198" PostTypeId="1" CreationDate="2018-09-10T22:06:44.073" Score="8" ViewCount="207" Body="&lt;p&gt;Fix $n$, the number of qubits and $k$, the number of encoded logical qubits. We can find a set of $(n-k)$ operators that all mutually commute and moreover form a group $S$. Let's assume that the group $S$ is a subgroup of the Pauli group. We can use these operators to fix a $2^{n-k}$ vector space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider all the stabilizer groups $S_i$ formed this way, encoding $k$ qubits in $n$, and consider the set $\mathcal{S}= \{S_i \, \vert\, i=1 \ldots N\}$, where $S_i$ is a specific stabilizer group that stabilizes some $2^{n-k}$ dimensional vector space. How can I explicitly parametrize this set? For example: for $n=3$ and $k=1$, we could have $S_1 = \langle Z_1Z_2, Z_2 Z_3\rangle $ and $S_2 = \langle X_1X_2, X_2 X_3\rangle $, and so forth for other distinct stabilizer groups. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible way to a solution is to consider the parity check matrix for a specific $S_i$, and then ask what group action we could define will on the parity check matrix of $S_i$ to produce the parity check matrix for any other stabilizer group of the same cardinality. But I don't know how such a group would act on the stabilizer group. In my example for $(n,k) = (3,1)$ above, for example, I can change $S_1$ to $S_2$ by conjugating by a Hadamard, and I think this corresponds to a right multiplication of some $2n \times 2n $ matrix on the parity check matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of this example, I am tempted to think that what I require is conjugation by either the whole Clifford group or a subgroup of it to act by conjugation of the $S_i$, and that will correspond to a symplectic $(2n \times 2n)$ matrix acting on the parity check matrices. In that case, the set $\mathcal{S}$ is parametrized by fixing a specific stabilizer group $S_i$ and acting on it by conjugation by a unitary representation of the Clifford group or subgroup. Is this close? &lt;/p&gt;&#xA;" OwnerUserId="4565" LastEditorUserId="2371" LastEditDate="2018-09-12T21:56:27.273" LastActivityDate="2018-09-12T21:56:27.273" Title="Compact way of describing the set of all stabilizer groups for fixed number of physical qubits and encoded logical qubits" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4199" PostTypeId="1" AcceptedAnswerId="4207" CreationDate="2018-09-11T10:07:24.300" Score="3" ViewCount="385" Body="&lt;p&gt;The power of a quantum computer is often described in terms of how many qubits it has. Does that mean that quantum computers can be run using  only qubits, and nothing more? Wouldn't we require some kind of quantum RAM or quantum hard drive for a fully functional quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="4182" LastEditorUserId="26" LastEditDate="2018-12-13T20:08:03.823" LastActivityDate="2018-12-13T20:08:03.823" Title="Are qubits the only elements required to build a quantum computer?" Tags="&lt;physical-qubit&gt;&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4200" PostTypeId="1" CreationDate="2018-09-11T10:31:58.767" Score="4" ViewCount="755" Body="&lt;p&gt;I am working in Anaconda using spyder editor.&#xA;Can anyone tell me how to install qiskit in spyder?&lt;/p&gt;&#xA;" OwnerUserId="4573" LastEditorUserId="26" LastEditDate="2019-03-12T09:34:51.657" LastActivityDate="2019-03-12T09:34:51.657" Title="How to install qiskit in spyder editor?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4201" PostTypeId="2" ParentId="4198" CreationDate="2018-09-11T11:32:04.303" Score="5" Body="&lt;p&gt;There's good news and bad news. The good news is that your intuitions are essentially right, and that there is such a group action via the Clifford group. The bad news is, depending on what you want out of that parameterisation, it may not be as useful as you are hoping.$\def\ket#1{\lvert #1 \rangle}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The good news first &amp;mdash; every Pauli stabiliser group on $n$ qubits, with $r = n-k$ independent generators, can be mapped to any other such group by conjugation by Clifford group operators. The simplest way to show this is by induction on $r$. If $r = 0$, then there is only one such stabiliser group: the trivial group $\{ \mathbf 1 \}$. For any $r &amp;gt; 0$, given an input stabilizer group $S$, you can reduce to the case of $r-1$ by the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Select any generator $P_r$ of the stabiliser group, and some qubit $x_r$ on which $P_r$ acts non-trivially.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find a Clifford group operator $C_r$ such that $C_r P_r C_r^\dagger = Z_{n-r}$, the single-qubit Pauli $Z$ operator acting only on qubit $(n-r)$. The operator $C_r$ may involve SWAP operators in order to exchange the tensor factors for qubit $x_r$ and $(n-r)$.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Determine how the other generators of the stabilizer group transform under $C_r$. This produces a list of generators for the group  $S' = \{ C_r P C_r^\dagger \,\vert\, P \in S\}$. Because $S'$ is abelian, the image of each generator either acts on qubit $(n-r)$ with $\mathbf 1$ or $Z$. In the latter case, produce a new generator by multiplying it by $Z_{n-r}$. As $Z_{n-r}$ is an element of $S'$, this yields an equivalent set of generators for the group.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Having done this, you have a stabiliser group for a subspace which is stabilized by $Z_{n-r}$. Any state in this group factors as a tensor product of $\ket{0}$ on qubit $(n-r)$, and some state on the remaining qubits. By considering the stabilizer code defined on all of the other qubits, you have reduced to the case of a stabiliser group on $n-1$ qubits and with $r-1$ generators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we unpack this inductive proof, we obtain a recursive procedure to map any stabiliser code $S$ with $r$ generators to a Clifford circuit $\mathcal C$ which maps that stabiliser group to the specific group $$\mathcal Z_{n,r} := \langle Z_{n-r}, Z_{n-r+1}, \ldots, Z_n\rangle \,.$$ If you have two such codes $S_1$ and $S_2$, just compose their circuits $\mathcal C_2^\dagger \mathcal C_1$ to obtain a circuit which maps $S_1$ to $S_2$. There is some redundancy, in that different sets of generators of the stabilizer group of $S_j$ will yield different circuits $\mathcal C_j$: this corresponds to the fact that some Clifford circuits just evaluate automorphisms (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;logical unitaries) of the code. But never mind: what you have is a way of generating any stabilizer code on $n$ qubits with $r$ stabilizer generators from a single code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bad news is that, as this stands, all that we have done above is in effect to parameterize stabiliser codes by their encoding circuits. By &quot;encoding circuit&quot;, I mean just the circuit which takes a $k = n-r$ qubit state $\ket{\psi}$, and then encodes $\ket{\psi}$ in an $n$-qubit system by preparing $r$ fresh qubits in the state $\ket{0}$ and acting on them by an appropriate unitary. By reducing an arbitrary stabilizer code with $r$ generators to a 'canonical' (and extremely dull) code whose stabilizer group is $\mathcal Z_{n,r}$, we have proven nothing more or less than that a stabilizer code is one with a Clifford encoding circuit. Describing stabiliser codes in terms of the orbit of $\mathcal Z_{n,r}$ under the $n$-qubit Clifford group is no more or less than describing codes in terms of their encoding circuits. This is a good fact to rely on, but more of a basic result than a deep result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take some other code as the 'reference' code, then you are essentially doing the same thing, except prefacing that encoding circuit by some other Clifford circuit. This point of view may or may not be helpful to you &amp;mdash; it's certainly a good elementary property to be aware of, when you're discussing stabiliser codes and stabiliser states with others who are less familiar with them &amp;mdash; but without imposing additional constraints on what encoding circuits or code representations you're interested in (&lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;to limit the automorphisms of codes which you consider), my guess is that this parameterisation may be of limited usefulness. The crux, in the end, will be which properties of stabilizer codes you are concerned with.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-09-11T11:32:04.303" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4202" PostTypeId="2" ParentId="4200" CreationDate="2018-09-11T12:31:58.043" Score="2" Body="&lt;p&gt;The recommended way is to &lt;a href=&quot;https://qiskit.org/documentation/install.html#installation&quot; rel=&quot;nofollow noreferrer&quot;&gt;install&lt;/a&gt; it using pip which should be already within anaconda. If not, check this &lt;a href=&quot;https://www.makeuseof.com/tag/install-pip-for-python/&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;pip install qiskit&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-11T12:31:58.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4203" PostTypeId="2" ParentId="4199" CreationDate="2018-09-11T12:41:33.410" Score="1" Body="&lt;p&gt;Qubits are indeed the main elements. But in the future hopefully, we will have complementary devices like a &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;qRAM&lt;/a&gt; and this will be helpful for many quantum algorithms like the HHL to input in a quanntum form classical data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more visual presentation of the qRAM, you can check these &lt;a href=&quot;https://docs.google.com/viewer?url=https%3A%2F%2Fpdfs.semanticscholar.org%2Fpresentation%2Ff6fd%2F743103363f93b365f671a440c3d2a063b581.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;slides&lt;/a&gt;.&#xA;The architecture proposed at that time was the bucket-brigade with qutrits.&#xA;What we need is basically the ability to load data in a fast and coherent way. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-09-11T13:06:24.273" LastActivityDate="2018-09-11T13:06:24.273" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4204" PostTypeId="1" AcceptedAnswerId="4222" CreationDate="2018-09-11T19:56:33.823" Score="12" ViewCount="1506" Body="&lt;p&gt;Can anyone give me a list of different research journals that has quantum computing articles that I can use.&lt;/p&gt;&#xA;" OwnerUserId="4576" LastEditorUserId="55" LastEditDate="2021-03-07T23:19:12.293" LastActivityDate="2021-03-07T23:19:12.293" Title="What is a list of research journals publishing quantum computing articles?" Tags="&lt;resource-request&gt;&lt;research&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4205" PostTypeId="2" ParentId="4199" CreationDate="2018-09-11T21:01:54.650" Score="2" Body="&lt;p&gt;Currently, as far as I know, all gate-model quantum architectures start computation in a ground state, normally denoted as the zero state $|0\rangle$. &lt;em&gt;In theory&lt;/em&gt;, any desired input state can be created from this by use of a correct unitary transformation $\rm U$, since by definition the Hilbert space of quantum states is invariant under unitary transformations (of equal dimensions). This suggests qubits are the only thing we need for a working quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is, however, that we don't always know how to construct $\rm U$. We know the first column vector of $\rm U$—as this is the vector that $|0\rangle$ is to be mapped to—but finding a complete matrix which can be nicely expressed in terms of quantum gates quickly becomes an intractable problem. For up to four qubits (or maybe six if you're really devoted) this might be doable, but it becomes impossible for an arbitrary large number of qubits, as may be required in, for example, the HHL algorithm to represent the input vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And don't even talk about compiling this possibly huge $\rm U$ to the hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where QRAM is supposed to come in. QRAM, which as of now only exists in theory, is a device which is capable of storing a quantum state for an extended period of time, and which, given an index state $|i\rangle$, will load the quantum state located at position $i$ in the memory into an empty state. That is:&#xA;$${\rm QRAM}: |i\rangle|0\rangle\mapsto|i\rangle|{\rm load}(i)\rangle.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you are wondering: yes, this can be realised as a unitary transformation. But again, even though some proposals have been made, nobody has been able to reliably implement such a map yet. This is in part caused by the short decoherence times of quantum states, which makes building QRAM a huge challenge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, there is a fundamental problem with the use of QRAM. Assuming we have access to such a QRAM is equivalent to assuming someone or something else will prepare the required quantum state $|{\rm load}(i)\rangle$ and write it into the QRAM for us, so we can simply read it out without effort and run our quantum algorithm with it. And this is precisely the finicky part about these famous quantum algorithms like HHL (and also Grover's, to some extent): they don't provide any description regarding how the input states are actually to be prepared. And a QRAM won't solve this, as in order to load a quantum state, it needs to be written there first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only upside is that there may be a clever procedure to write the desired state in a QRAM, allowing us to circumvent having to construct $\rm U$; but that's not something I can draw any conclusions on with certainty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from QRAM, there is one more aspect I want to mention regarding the power of a quantum computer: &lt;em&gt;error rates&lt;/em&gt;. Quantum particles are fragile and very prone to error, which means we have to account for that in some way. After all, a quantum computer with thousands of qubits is completely useless if these qubits can't hold a state for long enough to do the computation. The currently most widely known method to deal with these errors is &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum error correction&lt;/a&gt;, which (roughly speaking) uses auxiliary qubits to reduce the probability of error occuring in the work qubits. Suffices to say that the effort put into correcting quantum errors directly contributes to the computational power—and thus usefulness—of the quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is for this reason that the notion of &lt;a href=&quot;https://storageconsortium.de/content/sites/default/files/quantum-volumehp08co1vbo0cc8fr.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum volume&lt;/a&gt; was introduced to express the actual power of a quantum chip. This metric incorporates the number of qubits, the error rate as well as a few other things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question: I would say yes in some sense, since (a) QRAM doesn't solve the problem of efficiently preparing input states and (b) error correction is done with extra qubits. However, if we want to build a big quantum computer which is comparable in power to a classical computer, we will need stuff like QRAM (including a clever way of writing states to it) to make it work. Just like a classical computer can't operate on bits alone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't expect such a machine to be built within the next twenty years, though.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="2687" LastEditDate="2018-09-11T21:37:03.243" LastActivityDate="2018-09-11T21:37:03.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4206" PostTypeId="2" ParentId="4193" CreationDate="2018-09-11T22:16:59.607" Score="1" Body="&lt;p&gt;Building upon the previous answers, I will give a concrete example in terms of spin-$\frac12$ particles.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume such a particle, say an electron, is at rest inside a magnetic field of strength $B$ pointing in the $z$ direction. The hamiltonian of this small system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$${\rm H}=-\gamma B\,{\rm S}_z=-\gamma B\,\frac\hbar2\begin{bmatrix}1&amp;amp;0\\0&amp;amp;-1\end{bmatrix}$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where $\gamma$ is some constant called the gyromagnetic ratio and ${\rm S}_z$ is the observable corresponding to spin in the $z$ direction. The eigenstates of this hamiltonian are the states that we prefer to name spin up and spin down,&#xA;$$|\!\uparrow\rangle=\begin{bmatrix}1\\0\end{bmatrix},\;\;\;\;|\!\downarrow\rangle=\begin{bmatrix}0\\1\end{bmatrix},$$&#xA;with eigen-energies&#xA;$$E_\uparrow=-\gamma B\frac\hbar2,\;\;\;\;E_\downarrow=+\gamma B\frac\hbar2.$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to build a quantum computer using these spin-$\frac12$ particles as qubits, we could relabel the spin up state $|\!\uparrow\rangle$ as $|0\rangle$, and the spin down state $|\!\downarrow\rangle$ as $|1\rangle$. After all, it is much more convenient to reason about strings of qubits like $|001001010111\rangle$ than strings of ups and downs, i.e. $|\!\uparrow\uparrow\downarrow\uparrow\uparrow\downarrow\uparrow\downarrow\uparrow\downarrow\downarrow\downarrow\rangle$. Measuring a qubit would then mean measuring its spin, and finding either $E_\uparrow$ or $E_\downarrow$ to determine which state it collapsed to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you could build a quantum computer with a completely different system under a different hamiltonian, but the same principle holds. Computer scientists talking about quantum computation generally toss out the entire idea of hamiltonians, energies and so forth because circuits carrying $|0\rangle$s and $|1\rangle$s are easier for them to understand, and because it abstracts away the underlying physical system.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="2687" LastEditDate="2018-09-11T22:44:02.777" LastActivityDate="2018-09-11T22:44:02.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4207" PostTypeId="2" ParentId="4199" CreationDate="2018-09-12T06:39:18.763" Score="2" Body="&lt;p&gt;Before answering your question, let's go back to classical computing. The classical computer has a processor, which implements functions on bits, and it has varying levels of memory which trade speed of access against volatility and capacity. So, there are hard drives with large, non-volatile, but comparatively slow storage, and RAM, which is volatile, smaller, but fast. There's even some cache on the processor, which is smaller and faster again. But, all of this stores bits. Overall, a computer can simply be described as something that stores and processes bits, it's just that for different aspects of that process, it is more appropriate to use different technologies, leveraging their different advantages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exactly the same is true of quantum. Everything is qubits, both processing (application of unitaries, e.g. gate model, and measurement) and storage. We know of different technologies that have different advantages in terms of the trade between gate speed and volatility (measured as &quot;decoherence time&quot;). One might also add into the mix an ability to transmit quantum information over moderate distances. So, one might imagine that the ultimate quantum computer separates out in a similar way to the classical computer. But it's still all qubits. Of course, we're not there yet. It's hard enough doing one part of the experiment with one type of hardware. Add into the mix an interface between two different types of hardware, and it's even trickier.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-12T06:39:18.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4208" PostTypeId="2" ParentId="4204" CreationDate="2018-09-12T06:48:02.990" Score="6" Body="&lt;p&gt;There are loads of different quantum computing journals, so you might want to be more specific about what you're looking for. However, the vast majority of papers (certainly theory, perhaps a bit less so the experiments) appear as preprints on the &lt;a href=&quot;https://arxiv.org/&quot; rel=&quot;noreferrer&quot;&gt;arXiv&lt;/a&gt;, specifically the &lt;a href=&quot;https://arxiv.org/archive/quant-ph&quot; rel=&quot;noreferrer&quot;&gt;quant-ph section&lt;/a&gt;. The majority of papers, all in one place, collectively searchable, and free to read. What more could you ask for? If it's been published, usually it'll link to the published version as well (that depends on the author updating the record).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with any paper you read, you'll have to make up your own mind about the validity of any paper you find on the arXiv, but these haven't necessarily been through peer review, or have been through peer review of varying degrees of rigour, depending on the ultimate publication journal.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-12T06:48:02.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4209" PostTypeId="1" CreationDate="2018-09-12T06:53:08.773" Score="7" ViewCount="727" Body="&lt;p&gt;How can I get access to IBM Q 20 Tokyo and IBM Q 20 Austin?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Q- experience site there is written that the access is for IBM clients only and in the profile there is a &quot;promotional code&quot; that you need to put to gain access to those chips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I became a IBM Q client and get this promotional code?&lt;/p&gt;&#xA;" OwnerUserId="4524" LastActivityDate="2018-11-13T08:22:36.753" Title="How can I get access to IBM Q 20 Tokyo and IBM Q 20 Austin?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4210" PostTypeId="1" AcceptedAnswerId="4214" CreationDate="2018-09-12T07:47:12.397" Score="4" ViewCount="205" Body="&lt;p&gt;I am using Jupyter notebook to write and running my qiskit codes (python 3.6)&#xA;and every time I encounter the message: LookupError: backend &quot;ibmqx4&quot; is not found, right now the ibmqx4 computer is not in maintenance and it running well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to regenerate Apitoken in the advanced option and make correspondingly the file Qconfig.py but the message still appears.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;look at the example for a code that I write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import qiskit as qk&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, register&#xA;&#xA;&#xA;import Qconfig&#xA;&#xA;&#xA;&#xA;    batch = []&#xA;n=50&#xA;t=450&#xA;// we defining n similar quantum circuits&#xA;for j in range(1,n+1):&#xA;    q = QuantumRegister(1)&#xA;    c = ClassicalRegister(1)&#xA;    qc = QuantumCircuit(q, c)&#xA;    qc.x(q)&#xA;    qc.barrier()&#xA;&#xA;&#xA;// we decide the pausing time of the system be t*Gate Time&#xA;    for i in range(t):&#xA;        qc.iden(q)&#xA;    qc.measure(q,c)    &#xA;   //we append every circuit we create to batch so batch is like a list of n &#xA;  circuits&#xA;    batch.append(qc)&#xA;&#xA;// we executing all the n circuits and for each we run 1024 shots&#xA;shots = 1024&#xA;job = execute(qc,'ibmqx4',shots=shots)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I get the output from the last row:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;LookupError                               Traceback (most recent call last)&#xA;&amp;lt;ipython-input-38-a89f2171589f&amp;gt; in &amp;lt;module&amp;gt;()&#xA;      1 # we executing all the n circuits and for each we run 1024 shots&#xA;      2 shots = 1024&#xA;----&amp;gt; 3 job = execute(qc,'ibmqx4',shots=shots)&#xA;&#xA;~\Anaconda3\envs\QISKit\lib\site-packages\qiskit\wrapper\_wrapper.py in execute(circuits, backend, config, basis_gates, coupling_map, initial_layout, shots, max_credits, seed, qobj_id, hpc, skip_transpiler)&#xA;    270     # pylint: disable=missing-param-doc, missing-type-doc&#xA;    271     if isinstance(backend, str):&#xA;--&amp;gt; 272         backend = _DEFAULT_PROVIDER.get_backend(backend)&#xA;    273     qobj = compile(circuits, backend,&#xA;    274                    config, basis_gates, coupling_map, initial_layout,&#xA;&#xA;~\Anaconda3\envs\QISKit\lib\site-packages\qiskit\wrapper\defaultqiskitprovider.py in get_backend(self, name)&#xA;     29 &#xA;     30     def get_backend(self, name):&#xA;---&amp;gt; 31         name = self.resolve_backend_name(name)&#xA;     32         for provider in self.providers:&#xA;     33             try:&#xA;&#xA;~\Anaconda3\envs\QISKit\lib\site-packages\qiskit\wrapper\defaultqiskitprovider.py in resolve_backend_name(self, name)&#xA;    218 &#xA;    219         if resolved_name not in available:&#xA;--&amp;gt; 220             raise LookupError('backend &quot;{}&quot; not found.'.format(name))&#xA;    221 &#xA;    222         return resolved_name&#xA;&#xA;LookupError: backend &quot;ibmqx4&quot; not found.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;please help me to solve this repetitive bug...&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="26" LastEditDate="2019-03-12T09:35:10.373" LastActivityDate="2019-03-12T09:35:10.373" Title="How to deal with -LookupError: backend &quot;ibmqx4&quot; is not found?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;error-correction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4211" PostTypeId="2" ParentId="4204" CreationDate="2018-09-12T07:47:44.073" Score="4" Body="&lt;p&gt;I mostly work on quantum error correction and quantum information theory, so I can give you references about journals that cover such topics. Anyway, I am pretty sure that articles about quantum computing in general do also get published in such journals. I give you a list of them:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;IEEE transactions on Information Theory&lt;/li&gt;&#xA;&lt;li&gt;Physical Review Letters&lt;/li&gt;&#xA;&lt;li&gt;Physical Review A&lt;/li&gt;&#xA;&lt;li&gt;Physical Review X&lt;/li&gt;&#xA;&lt;li&gt;Springer Quantum Information Processing&lt;/li&gt;&#xA;&lt;li&gt;Entropy Journal&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Take into account that those journals aer not in general only dedicated to quantum computing, so you must look for the articles related to the topic you are looking for in them. Also, arXiv is a really good place to look for papers in any topic, as most of the author publish their preprints/papers in such site.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-09-12T07:47:44.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4212" PostTypeId="1" CreationDate="2018-09-12T08:44:44.467" Score="4" ViewCount="94" Body="&lt;p&gt;Given an arbitrary graph state $|G\rangle$ represented by the graph $G$, can one use the graphical structure to calculate the number of ebits (entanglement bits) present in the state? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, how?&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2018-09-12T15:02:56.547" Title="How to calculate the number of ebits in a graph state?" Tags="&lt;entanglement&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4213" PostTypeId="2" ParentId="4183" CreationDate="2018-09-12T09:50:46.967" Score="2" Body="&lt;p&gt;You can think of teleportation as the process of sending the state of one qubit from one place to another without having to physically send the qubit itself. Instead, you start with an entangled pair shared between the two locations, and that entanglement is consumed in the process. If you're not already familiar with teleportation, I strongly recommend that you find out about it. It's one of the basic building blocks of many results in quantum information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, a swap gate is simply sending the state of one qubit from A to B, and another from B to A, which you can therefore do with two teleportations. So, how does this circuit work? Consider two locations, A and B. At each location, there are 3 qubits. So, at A, we have A1, A2 and A3.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Before the start of the main protocol, we create two entangled pairs, one between A2 and B3, and another between B2 and A3. This is the stuff in the red box.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the main protocol, there is a one-qubit state (unknown) on A1, and another on B1. The aim is to swap them.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The A1 qubit is teleported using the A2-B3 entangled pair, so the state arrives at B3.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The B1 qubit is teleported using the B2-A3 entangled pair, so the state arrives at A3.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A swap is performed from A3 to A1, and another from B3 to B1. Hence, the transmitted states arrive on the specific qubits they were supposed to be on.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can't quite follow that sequence on the depicted circuit diagram as the final swaps are actually performed a little bit earlier. That just changes which qubits some of the operations are performed on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, you can see that this really is just 2 teleportations run independently to distribute the 2 different quantum states. As such, you can easily generalise it. If you have n parties, and everybody knows in advance where they will be sending their qubit, then, again, each party can manage with just 3 qubits, and they will share two entangled pairs, one with the user they'll be receiving a state from, and one with the user they'll be sending their state to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you don't know in advance where each party will want to send their qubit, you could make it so that each location has $n$ qubits: $n-1$ with entangled pairs shared with every other party, and one with the qubit state to be sent. But that is highly inefficient in terms of resources, and it is an interesting question about how little entanglement is actually necessary. I assume this has been answered somewhere, but I don't know where off the top of my head.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-12T09:50:46.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4214" PostTypeId="2" ParentId="4210" CreationDate="2018-09-12T10:31:31.310" Score="2" Body="&lt;p&gt;I got it, there is need to add two codes :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the first one in the begining before starting programming:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import  sys,,  time,,  getpass&#xA;try:&#xA;    sys.path.append(&quot;../../&quot;) # go to parent dir&#xA;    import Qconfig&#xA;    qx_config = {&#xA;        &quot;APItoken&quot;: Qconfig.APItoken,&#xA;        &quot;url&quot;: Qconfig.config['url']}&#xA;    print('Qconfig loaded from %s.' % Qconfig.__file__)&#xA;except:&#xA;    APItoken = getpass.getpass('Please input your token and hit enter: ')&#xA;    qx_config = {&#xA;        &quot;APItoken&quot;: APItoken,&#xA;        &quot;url&quot;:&quot;https://quantumexperience.ng.bluemix.net/api&quot;}&#xA;    print('Qconfig.py not found in qiskit-tutorial directory; Qconfig loaded using user input.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the second one is before execution:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;register(qx_config['APItoken'], qx_config['url'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;hope I helped anyone with similar error!&lt;/p&gt;&#xA;" OwnerUserId="4524" LastActivityDate="2018-09-12T10:31:31.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4215" PostTypeId="2" ParentId="4209" CreationDate="2018-09-12T12:30:39.970" Score="1" Body="&lt;p&gt;By going to this &lt;a href=&quot;https://www.research.ibm.com/ibm-q/network/&quot; rel=&quot;nofollow noreferrer&quot;&gt;website&lt;/a&gt;. &#xA;But I do not know how exactly the process work.&#xA;It should involve your company/startup/institution and then you make some kind of agreement to be part of the &quot;community&quot;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-12T12:30:39.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4216" PostTypeId="2" ParentId="4183" CreationDate="2018-09-12T12:52:35.677" Score="3" Body="&lt;p&gt;The simplest way to generalize teleportation is to just repeat it. If you have one EPR pair divided between Alice and Bob, teleportation allows you to move one qubit from Alice to Bob (or vice versa) by consuming the EPR pair and using a classical communication channel. If you have two EPR pairs, you can move two qubits by performing two independent teleportations. If you have N EPR pairs, you can move N qubits by performing teleportation N times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the diagram you posted, what's happening is that there is one teleportation from Alice to Bob (to move the A qubit from the top to the bottom) and one teleportation from Bob to Alice (to move the B qubit to the top). This is somewhat obscured by the fact that the teleportations' operations are being interleaved, and also the two swap gates that ensure the output qubits end on on the same lines as the input qubits. But it really is just two independent copies of the teleportation circuit, one from Alice to Bob followed by one from Bob to Alice, but &quot;shoved together&quot; (i.e. with the operations slid around so they interleave more).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The more complicated way to generalize teleportation is figuring out how to make it work on qutrits and qudits instead of only qubits. Basically, instead of using a &quot;basis&quot; made up of tensor products of X and Z matrices, you need to switch to a basis based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Construction:_The_clock_and_shift_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;clock and shift matrices&lt;/a&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-09-12T12:52:35.677" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4217" PostTypeId="2" ParentId="4212" CreationDate="2018-09-12T14:57:35.683" Score="4" Body="&lt;p&gt;The number of Bell pairs required to construct a given graph state can easily be given an upper bound: $|V|-1$, where $V$ is the set of vertices. You do this simply by preparing the entire state at one site, and teleporting all the other qubits to the relevant party.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if this is actually all there is to it? If we assume that the entire graph is connected, then every individual qubit is (maximally) entangled with the rest of the graph, and that entanglement must be distributed somehow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lower bounds in the multipartite entanglement setting are quite difficult to prove. In a bipartite setting, you'd do it be showing how many Bell states you can extract from asymptotically many copies of the state of interest, but in the regime of multipartite entanglement, that rapidly leads you to MREGS (minimal reversible entanglement generating set), about which very little is known.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-09-12T15:02:56.547" LastActivityDate="2018-09-12T15:02:56.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4218" PostTypeId="2" ParentId="4185" CreationDate="2018-09-12T19:54:55.713" Score="4" Body="&lt;p&gt;I agree with James Wootton's answer. The choice of the language becomes important once you work on a larger project in which you want to rely on libraries, resource estimates and other advanced features. When you're starting to learn the basics of quantum computing and quantum programming, your programs will be very small and really not that different across different languages. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume you'll be going through some book/course on the theory of quantum computing. In this case, there are two things you'll definitely want from the programming language:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a nice set of introductory tutorials/programming exercises to help you internalize the theory you've learned.&lt;/li&gt;&#xA;&lt;li&gt;a quantum state simulator that will allow you to see the state of the qubits as your program executes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My recommendation (biased in different direction, as James suggested :-) ) is to take a look at Q#:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Microsoft/QuantumKatas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas&lt;/a&gt; are self-paced programming tutorials designed to accompany a course on quantum computing theory. Each tutorial consists of a set of exercises for you to solve and a behind-the-scenes testing harness which checks whether your code is correct, providing you immediate feedback. The existing tutorials cover a nice set of introductory topics, and we are working on creating more tutorials.&lt;/li&gt;&#xA;&lt;li&gt;The full state simulator included in the Quantum Development Kit allows to dump system state as a list of amplitudes, so you can use it whenever you want to check that the state of the system matches your understanding/expectation or to figure out what went wrong.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-09-12T19:54:55.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4219" PostTypeId="1" AcceptedAnswerId="4221" CreationDate="2018-09-12T20:52:53.267" Score="13" ViewCount="1792" Body="&lt;p&gt;What does it mean by &lt;em&gt;''qubit can't be copied''&lt;/em&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;In a note, it is saying that:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Copying a qubit means &lt;span class=&quot;math-container&quot;&gt;$$U|\psi\rangle_A|0\rangle_B=|\psi\rangle_A|\psi\rangle_B$$&lt;/span&gt;&#xA;&lt;em&gt;i.e&lt;/em&gt;; applying a &lt;em&gt;unitary&lt;/em&gt; transformation on the qubit state. It is explained as,  if the copy operation is possible then there will be a unique unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; which will work on all qubit state, and then shown that existence of such &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not possible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I am not getting how it can be written in such a way, &lt;em&gt;unitary&lt;/em&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; will operate on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_A$&lt;/span&gt; only I think, how it can copy it to second &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state?&lt;/p&gt;&#xA;&lt;p&gt;Secondly, why we are making the assumption that, &lt;em&gt;&amp;quot;if such unitary matrix exists then that will be a &lt;strong&gt;unique&lt;/strong&gt; unitary matrix &lt;strong&gt;which will work on all&lt;/strong&gt; qubit states&amp;quot;&lt;/em&gt;   why we can't use different unitary matrix to copy different qubit state(if possible, as &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; can't be copied)?&lt;/p&gt;&#xA;&lt;p&gt;E.g, we can copy &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A$&lt;/span&gt; to another state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_B$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$U|0\rangle_A=|0\rangle_B\\U|1\rangle_A=|1\rangle_B$$&lt;/span&gt;&#xA;as classical bit can be copied, it is possible to find such &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="3023" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-02-07T17:30:52.013" Title="What do they mean by &quot;qubit can't be copied&quot;?" Tags="&lt;unitarity&gt;&lt;no-cloning-theorem&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4220" PostTypeId="2" ParentId="4219" CreationDate="2018-09-12T21:09:40.703" Score="4" Body="&lt;p&gt;To answer the first part of the question (whether unitary matrix $U$ operates on $|\psi_A \rangle$ only):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A unitary matrix can operate on an arbitrary number of qubits. Single-qubit gates, like Pauli X, Y and Z gates, operate on one qubit and are represented by 2x2 matrices; CNOT gate operates on two qubits and is represented by a 4x4 matrix, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case $U$ denotes a unitary transformation operating on two qubits, represented by a 4x4 matrix.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To answer the second part of the question (why should there be only one unitary to copy all possible states):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to find unitaries which copy &lt;em&gt;some&lt;/em&gt; qubit states. The easiest example is CNOT gate which copies the states $|0 \rangle$ and $|1 \rangle$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$CNOT|0\rangle_A |0 \rangle_B=|0\rangle_A|0\rangle_B\\&#xA;CNOT|1\rangle_A |0 \rangle_B=|1\rangle_A|1\rangle_B$$ &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this unitary will not work to copy an unknown superposition of the states $|0 \rangle$ and $|1 \rangle$:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$CNOT(\alpha |0\rangle + \beta |1\rangle)_A |0 \rangle_B=\alpha |0\rangle_A|0\rangle_B + \beta |1\rangle_A |1\rangle_B \neq (\alpha |0\rangle + \beta |1\rangle)_A (\alpha |0\rangle + \beta |1\rangle)_B$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can follow the proof given in &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Wikipedia article&lt;/a&gt; to see that any one unitary can copy at best two orthogonal states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to find one unitary that would work for &lt;em&gt;all&lt;/em&gt; states because the no-cloning theorem addresses only copying of an unknown quantum state. If we know exactly what state we need to create, we can just create it from scratch without using the prototype qubit at all.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2018-09-12T22:42:55.657" LastActivityDate="2018-09-12T22:42:55.657" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4221" PostTypeId="2" ParentId="4219" CreationDate="2018-09-12T21:37:31.927" Score="12" Body="&lt;p&gt;All operations on quantum states are unitary operations. We don't make the rules, this is just how nature seems to work. So if you want to define an operation that copies a qbit, it has to be a unitary operation. That unitary operation would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$U|\psi\rangle_A|0\rangle_B=|\psi\rangle_A|\psi\rangle_B$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have the qbit you want to copy, $|\psi\rangle_A$, and the qbit into which you want to copy it, $|0\rangle_B$. This is the most general way to write the copy operation, although any other way of writing it reaches the same conclusion: it cannot be done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is as follows. Consider your starting state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle|0\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} ⊗ \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} \alpha \\ 0 \\ \beta \\ 0 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now consider your desired ending state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$|\psi\rangle|\psi\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} ⊗ \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \begin{bmatrix} \alpha^2 \\ \alpha\beta \\ \beta\alpha \\ \beta^2 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you want to go from here to here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix} \alpha \\ 0 \\ \beta \\ 0 \end{bmatrix} \rightarrow \begin{bmatrix} \alpha^2 \\ \alpha\beta \\ \beta\alpha \\ \beta^2 \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But see those exponents? They mean this is not a &lt;em&gt;linear&lt;/em&gt; operation! And since we can only perform linear operations on quantum states, no operation exists which can take us from the first state to the second (other than an operation which itself uses the values of $\alpha$ and $\beta$). Thus, copying (cloning) is impossible when you don't know $\alpha$ or $\beta$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for why we don't just use a different unitary transformation for each copy, that would require us knowing the exact quantum state we want to copy. If we know the exact quantum state, we can just take a blank qbit and reconstruct the same quantum state on the qbit. Which is fine, but pretty useless considering the &lt;em&gt;reason&lt;/em&gt; we want to be able to copy a quantum state is so we can find the value of the quantum state in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical bits can always be copied, as you discovered. Of course, we copy classical bits all the time in the real world (you're reading copied classical bits right now!).&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-09-12T23:03:18.093" LastActivityDate="2018-09-12T23:03:18.093" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4222" PostTypeId="2" ParentId="4204" CreationDate="2018-09-12T21:54:54.717" Score="11" Body="&lt;p&gt;Here is what I think is a comprehensive list of journals that publish papers about quantum information with a noteworthy frequency (anyone is free to edit/add more).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Publishing only about quantum information&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Quantum Information &amp;amp; Computation&lt;/li&gt;&#xA;&lt;li&gt;Springer Quantum Information Processing &lt;/li&gt;&#xA;&lt;li&gt;Quantum Computing Frontiers&lt;/li&gt;&#xA;&lt;li&gt;npj Quantm Information&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Publishing papers, which includes papers on quantum information&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Physical Review A &lt;/li&gt;&#xA;&lt;li&gt;Physical Review B&lt;/li&gt;&#xA;&lt;li&gt;Physical Review X &lt;/li&gt;&#xA;&lt;li&gt;Physical Review E &lt;/li&gt;&#xA;&lt;li&gt;Physical Review Letters&lt;/li&gt;&#xA;&lt;li&gt;Reviews of Modern Physics&lt;/li&gt;&#xA;&lt;li&gt;New Journal of Physics&lt;/li&gt;&#xA;&lt;li&gt;Journal of Chemical Physics&lt;/li&gt;&#xA;&lt;li&gt;Quantum Physics Letters&lt;/li&gt;&#xA;&lt;li&gt;Quantum - the open journal for quantum science&lt;/li&gt;&#xA;&lt;li&gt;Journal of Mathematical Physics&lt;/li&gt;&#xA;&lt;li&gt;Physics Letters A&lt;/li&gt;&#xA;&lt;li&gt;IEEE Transactions on Applied Superconductivity&lt;/li&gt;&#xA;&lt;li&gt;IEEE Transactions on Information Theory &lt;/li&gt;&#xA;&lt;li&gt;IEEE Transactions on Automatic Control&lt;/li&gt;&#xA;&lt;li&gt;Processing Entropy Journal&lt;/li&gt;&#xA;&lt;li&gt;AIP Advances&lt;/li&gt;&#xA;&lt;li&gt;Applied Physics Letters&lt;/li&gt;&#xA;&lt;li&gt;Annals of Physics&lt;/li&gt;&#xA;&lt;li&gt;Annalen der Physik&lt;/li&gt;&#xA;&lt;li&gt;Canadian Journal of Physics&lt;/li&gt;&#xA;&lt;li&gt;Journal of Applied Physics&lt;/li&gt;&#xA;&lt;li&gt;Journal of the Physical Society of Japan&lt;/li&gt;&#xA;&lt;li&gt;Nature Physics&lt;/li&gt;&#xA;&lt;li&gt;Nature Chemistry&lt;/li&gt;&#xA;&lt;li&gt;Nature Materials&lt;/li&gt;&#xA;&lt;li&gt;Nature&lt;/li&gt;&#xA;&lt;li&gt;Science&lt;/li&gt;&#xA;&lt;li&gt;Science Advances&lt;/li&gt;&#xA;&lt;li&gt;Scientific Repors&lt;/li&gt;&#xA;&lt;li&gt;Nature Communications&lt;/li&gt;&#xA;&lt;li&gt;European Physical Journal D&lt;/li&gt;&#xA;&lt;li&gt;European Physical Journal B &lt;/li&gt;&#xA;&lt;li&gt;Molecular Physics&lt;/li&gt;&#xA;&lt;li&gt;Laser Physics&lt;/li&gt;&#xA;&lt;li&gt;Journal of Physics B&lt;/li&gt;&#xA;&lt;li&gt;Review of Scientific Instruments&lt;/li&gt;&#xA;&lt;li&gt;Applied Optics&lt;/li&gt;&#xA;&lt;li&gt;Optics Express&lt;/li&gt;&#xA;&lt;li&gt;Optics Letters&lt;/li&gt;&#xA;&lt;li&gt;Nature Photonics&lt;/li&gt;&#xA;&lt;li&gt;Computer Physics Communications&lt;/li&gt;&#xA;&lt;li&gt;Journal of Physics: Condensed Matter&lt;/li&gt;&#xA;&lt;li&gt;Physica Status Solidi&lt;/li&gt;&#xA;&lt;li&gt;Chemical Physics Letters&lt;/li&gt;&#xA;&lt;li&gt;Physical Chemistry Chemical Physics&lt;/li&gt;&#xA;&lt;li&gt;Journal of Physical Chemistry A&lt;/li&gt;&#xA;&lt;li&gt;Journal of Physical Chemistry Letters&lt;/li&gt;&#xA;&lt;li&gt;Communications in Mathematical Physics&lt;/li&gt;&#xA;&lt;li&gt;Electronic Journal of Theoretical Physics&lt;/li&gt;&#xA;&lt;li&gt;SIAM Journal of Computing&lt;/li&gt;&#xA;&lt;li&gt;SIAM Journal on Scientific and Statistical Computing (&lt;a href=&quot;https://epubs.siam.org/doi/10.1137/S0097539795293172&quot; rel=&quot;noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Quantum Science and Technology (IOP)&lt;/li&gt;&#xA;&lt;li&gt;Advanced Quantum Technologies (Wiley)&lt;/li&gt;&#xA;&lt;li&gt;Quantum Machine Intelligence (Springer)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-11-03T05:00:21.853" LastActivityDate="2018-11-03T05:00:21.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4223" PostTypeId="1" AcceptedAnswerId="4225" CreationDate="2018-09-12T23:15:28.487" Score="3" ViewCount="1301" Body="&lt;p&gt;Q# has a measurement operator defined as follows according to the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/prelude/microsoft.quantum.primitive.measure&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;operation Measure (bases : Pauli[], qubits : Qubit[]) : Result&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where you give a Pauli gate $\{I, \sigma_x, \sigma_y, \sigma_z\}$ as a measurement operator and the qbit is projected onto its eigenvectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I measure in an arbitrary basis? I know conceptually what I have to do is first rotate my state vector by some amount then measure in one of the Pauli bases, but what are the actual primitive gates and parameters I would use to do that? For example, say I wanted to measure in the following basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\begin{bmatrix} \frac{\sqrt{3}}{2} \\ \frac 1 2 \end{bmatrix}, \begin{bmatrix} \frac{-1}{2} \\ \frac{\sqrt{3}}{2} \end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically the computational basis but rotated $\pi/6$ radians counter-clockwise around the unit circle.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-03-12T09:06:55.650" LastActivityDate="2019-05-10T07:17:51.080" Title="How to measure in an arbitrary basis in Q#?" Tags="&lt;programming&gt;&lt;measurement&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4225" PostTypeId="2" ParentId="4223" CreationDate="2018-09-13T00:31:03.487" Score="4" Body="&lt;p&gt;Let's say you want to distinguish two states: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|A\rangle = \cos \alpha |0\rangle + \sin \alpha |1\rangle \\ &#xA;  |B\rangle = -\sin \alpha |0\rangle + \cos \alpha |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your particular example &lt;span class=&quot;math-container&quot;&gt;$\cos \alpha = \frac {\sqrt{3}}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin \alpha = \frac{1}{2}$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{\pi}{6}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These states are orthogonal and can be obtained from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; by rotating around Y axis, i.e. by applying &lt;code&gt;Ry(2.0 * alpha, _)&lt;/code&gt;. You can verify it using the definition of the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ry operation&lt;/a&gt; and matrix exponentiation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, one way to measure the states &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; is to apply adjoint operation &lt;code&gt;Ry(-2.0 * alpha, _)&lt;/code&gt; to your qubit to get those states back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and then to measure the qubit in the computational basis using operation &lt;code&gt;M&lt;/code&gt; (or &lt;code&gt;Measure([PauliZ], _)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more general case you'd use other rotation operations (&lt;code&gt;Rx&lt;/code&gt; and &lt;code&gt;Rz&lt;/code&gt;) to perform the exact rotation which converts your basis states to computational basis before measuring them.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This question is effectively task 1.4 from &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/tree/master/Measurements&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Measurements quantum kata&lt;/a&gt;, if you want to practice it in Q# (as well as more advanced measurement scenarios).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-10T07:17:51.080" LastActivityDate="2019-05-10T07:17:51.080" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4226" PostTypeId="1" AcceptedAnswerId="4227" CreationDate="2018-09-14T03:10:00.330" Score="4" ViewCount="84" Body="&lt;p&gt;Are there any research papers focused on implementing a game/puzzle or game theory in Quantum Computing.&lt;/p&gt;&#xA;" OwnerUserId="4576" LastEditorUserId="26" LastEditDate="2018-12-13T19:30:15.110" LastActivityDate="2018-12-13T19:30:15.110" Title="Quantum Computing Research Papers, on puzzles or game theory" Tags="&lt;resource-request&gt;&lt;research&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4227" PostTypeId="2" ParentId="4226" CreationDate="2018-09-14T04:16:21.177" Score="7" Body="&lt;p&gt;To start, I would read &quot;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0308027.pdf&quot; rel=&quot;noreferrer&quot;&gt;The next stage: quantum game theory&lt;/a&gt;&quot; by E.W.Piotrowski, J. Sladkowski. While the paper is from 2003, the authors discuss how developments in quantum computation allow the extension of the scope of game theory. It includes some basic history as well as some basic ideas and recent developments in quantum game theory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These same authors also wrote a paper entitled &quot;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0106140.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum Bargaining Games&lt;/a&gt;&quot; in 2001 which I would think will also be useful in your research. It's part of a larger analysis they did of &quot;quantum-like&quot; descriptions of market economics with roots in the then recently developed quantum game theory&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think these two papers would be great starting points. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also check out &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/409/james-wootton&quot;&gt;James Wootton's&lt;/a&gt; &quot;&lt;a href=&quot;https://medium.com/@decodoku/understanding-quantum-computers-through-a-simple-puzzle-game-a290dde89fb2&quot; rel=&quot;noreferrer&quot;&gt;Using a simple puzzle game to benchmark quantum computers&lt;/a&gt;&quot; in which he created a puzzle game called &quot;Quantum Awesomeness&quot;. I recommend this primarily because it's slightly related but completely awesome. &lt;/p&gt;&#xA;" OwnerUserId="274" LastActivityDate="2018-09-14T04:16:21.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4228" PostTypeId="2" ParentId="74" CreationDate="2018-09-14T10:55:07.460" Score="8" Body="&lt;h1&gt;Quantum annealing&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing&quot; rel=&quot;noreferrer&quot;&gt;Quantum annealing&lt;/a&gt; is a model of quantum computation which, roughly speaking, generalises the adiabatic model of computation. It has attracted popular &amp;mdash; and commercial &amp;mdash; attention as a result of D-WAVE's work on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Precisely what quantum annealing &lt;em&gt;consists&lt;/em&gt; of is not as well-defined as other models of computation, essentially because it is of more interest to quantum technologists than computer scientists. Broadly speaking, we can say that it is usually considered by people with the motivations of engineers, rather than the motivations of mathematicians, so that the subject appears to have many intuitions and rules of thumb but few 'formal' results. In fact, in an answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1595/124&quot;&gt;my question about quantum annealing&lt;/a&gt;, &lt;code&gt;Andrew O&lt;/code&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1596/124&quot;&gt;goes so far as to say&lt;/a&gt; that &quot;&lt;em&gt;quantum annealing can't be defined without considerations of algorithms and hardware&lt;/em&gt;&quot;. Nevertheless, &quot;quantum annealing&quot; seems is well-defined enough to be described as a way of approaching how to solve problems with quantum technologies with specific techniques &amp;mdash; and so despite &lt;code&gt;Andrew O&lt;/code&gt;'s assessment, I think that it embodies some implicitly defined model of computation. I will attempt to describe that model here.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Intuition behind the model&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Quantum annealing gets its name from a loose analogy to &lt;a href=&quot;https://en.wikipedia.org/wiki/Simulated_annealing&quot; rel=&quot;noreferrer&quot;&gt;(classical) &lt;em&gt;simulated annealing&lt;/em&gt;&lt;/a&gt;.&#xA; They are both presented as means of minimising the energy of a system, expressed in the form of a Hamiltonian:&#xA;$$&#xA;\begin{aligned}&#xA;H_{\rm{classical}} &amp;amp;= \sum_{i,j} J_{ij} s_i s_j \\&#xA;H_{\rm{quantum}} &amp;amp;= A(t) \sum_{i,j} J_{ij} \sigma_i^z \sigma_j^z - B(t) \sum_i \sigma_i^x&#xA;\end{aligned}&#xA;$$&#xA;With simulated annealing, one essentially performs a random walk on the possible assignments to the 'local' variables $s_i \in \{0,1\}$, but where the probability of actually making a transition depends on&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The difference in 'energy' $\Delta E = E_1 - E_0$ between two 'configurations' (the initial and the final global assignment to the variables $\{s_i\}_{i=1}^n$) before and after each step of the walk;&lt;/li&gt;&#xA;&lt;li&gt;A 'temperature' parameter which governs the probability with which the walk is allowed to perform a step in the random walk which has $\Delta E &amp;gt; 0$.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One starts with the system at 'infinite temperature', which is ultimately a fancy way of saying that you allow for all possible transitions, regardless of increases or decreases in energy. You then lower the temperature according to some schedule, so that time goes on, changes in state which increase the energy become less and less likely (though still possible). The limit is zero temperature, in which any transition which decreases energy is allowed, but any transition which increases energy is simply forbidden.&#xA;For any temperature $T &amp;gt; 0$, there will be a stable distribution (a 'thermal state') of assignments, which is the uniform distribution at 'infinite' temperature, and which is which is more and more weighted on the global minimum energy states as the temperature decreases. If you take long enough to decrease the temperature from infinite to near zero, you should in principle be guaranteed to find a global optimum to the problem of minimising the energy. Thus simulated annealing is an approach to solving optimisation problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum annealing is motivated by generalising the work by Farhi &lt;em&gt;et al.&lt;/em&gt; on &lt;strong&gt;adiabatic&lt;/strong&gt; quantum computation [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0001106&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/0001106&lt;/a&gt;], with the idea of considering what evolution occurs when one &lt;strong&gt;does not necessarily&lt;/strong&gt; evolve the Hamiltonian in the adiabatic regime. Similarly to classical annealing, one starts in a configuration in which &quot;classical assignments&quot; to some problem are in a uniform distribution, though this time in coherent superposition instead of a probability distribution: this is achieved for time $t = 0$, for instance, by setting&#xA;$$ A(t=0) = 0, \qquad B(t=0) = 1 $$&#xA;in which case the uniform superposition $\def\ket#1{\lvert#1\rangle}\ket{\psi_0} \propto \ket{00\cdots00} + \ket{00\cdots01} + \cdots + \ket{11\cdots11}$ is a minimum-energy state of the quantum Hamiltonian. One steers this 'distribution' (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;the state of the quantum system) to one which is heavily weighted on a low-energy configuration by slowly evolving the system &amp;mdash; by slowly changing the field strengths $A(t)$ and $B(t)$ to some final value&#xA;$$ A(t_f) = 1, \qquad B(t_f) = 0. $$&#xA;Again, if you do this slowly enough, you will succeed with high probability in obtaining such a global minimum.&#xA;The &lt;em&gt;adiabatic regime&lt;/em&gt; describes conditions which are &lt;strong&gt;sufficient&lt;/strong&gt; for this to occur, by virtue of remaining in (a state which is very close to) the ground state of the Hamiltonian at all intermediate times. However, it is considered possible that one can evolve the system faster than this and still achieve a high probability of success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly to adiabatic quantum computing, the way that $A(t)$ and $B(t)$ are defined are often presented as a linear interpolations from $0$ to $1$ (increasing for $A(t)$, and decreasing for $B(t)$). However, also in common with adiabatic computation, $A(t)$ and $B(t)$ don't necessarily have to be linear or even monotonic. For instance, &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/mwj_dwave_qubits2018.pdf&quot; rel=&quot;noreferrer&quot;&gt;D-Wave has considered the advantages of pausing the annealing schedule and 'backwards anneals'&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Proper' quantum annealing (so to speak) presupposes that evolution is probably not being done in the adiabatic regime, and allows for the possibility of diabatic transitions, but only asks for a high chance of achieving an optimum &amp;mdash; or even more pragmatically still, of achieving a result which would be difficult to find using classical techniques. There are no &lt;em&gt;formal&lt;/em&gt; results about how quickly you can change your Hamiltonian to achieve this: the subject appears mostly to consist of experimenting with a heuristic to see what works in practise. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The comparison with classical simulated annealing&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Despite the terminology, it is not immediately clear that there is much which quantum annealing has in common with classical annealing.&#xA;The main differences between quantum annealing and classical simulated annealing appear to be that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In quantum annealing, the state is in some sense ideally a pure state, rather than a mixed state (corresponding to the probability distribution in classical annealing);&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In quantum annealing, the evolution is driven by an explicit change in the Hamiltonian rather than an external parameter.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is possible that a change in presentation could make the analogy between quantum annealing and classical annealing tighter. For instance, one could incorporate the temperature parameter into the spin Hamiltonian for classical annealing, by writing&#xA;$$\tilde H_{\rm{classical}} = A(t) \sum_{i,j} J_{ij} s_i s_j - B(t) \sum_{i,j} \textit{const.} $$&#xA;where we might choose something like $A(t) = t\big/(t_F - t)$ and $B(t) = t_F - t$ for $t_F &amp;gt; 0$ the length of the anneal schedule. (This is chosen deliberately so that $A(0) = 0$ and $A(t) \to +\infty$ for $t \to t_F$.)&#xA;Then, just as an annealing algorithm is governed in principle by the Schr&amp;ouml;dinger equation for all times, we may consider an annealing process which is governed by a diffusion process which is in principle uniform with tim by small changes in configurations, where the probability of executing a randomly selected change of configuration is governed by&#xA;$$ p(x \to y) = \max\Bigl\{ 1,\; \exp\bigl(-\gamma \Delta E_{x\to y}\bigr) \Bigr\} $$&#xA;for some constant $\gamma$, where $E_{x \to y}$ is the energy difference between the initial and final configurations.&#xA;The stable distribution of this diffusion for the Hamiltonian at $t=0$ is the uniform distribution, and the stable distribution for the Hamiltonian as $t \to t_F$ is any local minimum; and as $t$ increases, the probability with which a transition occurs which increases the energy becomes smaller, until as $t \to t_F$ the probability of any increases in energy vanish (because &lt;em&gt;any&lt;/em&gt; of the possible increase is a costly one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are still disanalogies to quantum annealing in this &amp;mdash; for instance, we achieve the strong suppression of increases in energy as $t \to t_F$ essentially by making the potential wells infinitely deep (which is not a very physical thing to do) &amp;mdash; but this does illustrate something of a commonality between the two models, with the main distinction being not so much the evolution of the Hamiltonian as it is the difference between diffusion and Schr&amp;ouml;dinger dynamics. This suggests that there may be a sharper way to compare the two models theoretically: by describing the difference between classical and quantum annealing, as being analogous to the difference between &lt;a href=&quot;https://en.wikipedia.org/wiki/Random_walk&quot; rel=&quot;noreferrer&quot;&gt;random walks&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_walk&quot; rel=&quot;noreferrer&quot;&gt;quantum walks&lt;/a&gt;. A common idiom in describing quantum annealing is to speak of 'tunnelling' through energy barriers &amp;mdash; this is certainly pertinent to how people consider quantum walks: consider for instance the work by Farhi &lt;em&gt;et al.&lt;/em&gt; on &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0702144&quot; rel=&quot;noreferrer&quot;&gt;continuous-time quantum speed-ups for evaluating NAND circuits&lt;/a&gt;, and more directly foundational work by Wong on &lt;a href=&quot;https://arxiv.org/abs/1509.07112&quot; rel=&quot;noreferrer&quot;&gt;quantum walks on the line tunnelling through potential barriers&lt;/a&gt;. Some work has been done by Chancellor [&lt;a href=&quot;https://arxiv.org/abs/1606.06800&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1606.06800&lt;/a&gt;] on considering quantum annealing in terms of quantum walks, though it appears that there is room for a more formal and complete account.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a purely operational level, it appears that quantum annealing gives a &lt;em&gt;performance&lt;/em&gt; advantage over classical annealing (see for example these slides on the &lt;a href=&quot;https://www.isi.edu/sites/default/files/top_level/events/aqc2014/day2-talk5-Troyer.pdf&quot; rel=&quot;noreferrer&quot;&gt;difference in performance between quantum vs. classical annealing&lt;/a&gt;, from Troyer's group at ETH, ca.&amp;nbsp;2014).&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Quantum annealing as a phenomenon, as opposed to a computational model&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Because quantum annealing is more studied by technologists, they focus on the concept of &lt;em&gt;realising quantum annealing as an effect&lt;/em&gt; rather than defining the model in terms of general principles. (A rough analogy would be studying the unitary circuit model only inasmuch as it represents a means of achieving the 'effects' of eigenvalue estimation or amplitude amplification.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, whether something counts as &quot;quantum annealing&quot; is described by at least some people as being hardware-dependent, and even input-dependent: for instance, on the layout of the qubits, the noise levels of the machine. It seems that even trying to approach the adiabatic regime will prevent you from achieving quantum annealing, because the idea of what quantum annealing even consists of includes the idea that noise (such as decoherence) will prevent annealing from being realised: as a &lt;em&gt;computational effect&lt;/em&gt;, as opposed to a &lt;em&gt;computational model&lt;/em&gt;, quantum annealing essentially requires that the annealing schedule is shorter than the decoherence time of the quantum system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people occasionally describe noise as being somehow essential to the process of quantum annealing. For instance, Boixo &lt;em&gt;et al.&lt;/em&gt; [&lt;a href=&quot;https://arxiv.org/abs/1304.4595&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1304.4595&lt;/a&gt;] write&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Unlike adiabatic quantum computing[, quantum annealing] is a positive temperature method involving an open quantum system coupled to a thermal bath. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It might perhaps be accurate to describe it as being an inevitable feature of systems in which one will perform annealing (just because noise is inevitable feature of a system in which you will do quantum information processing of &lt;em&gt;any&lt;/em&gt; kind): as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1596/124&quot;&gt;&lt;code&gt;Andrew O&lt;/code&gt; writes&lt;/a&gt; &quot;&lt;em&gt;in reality no baths really help quantum annealing&lt;/em&gt;&quot;. It is possible that a dissipative process can help quantum annealing by helping the system build population on lower-energy states (as suggested by work by Amin &lt;em&gt;et al.&lt;/em&gt;, [&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0609332&quot; rel=&quot;noreferrer&quot;&gt;arXiv:cond-mat/0609332&lt;/a&gt;]), but this seems essentially to be a classical effect, and would inherently require a quiet low-temperature environment rather than 'the presence of noise'.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The bottom line&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;It might be said &amp;mdash; in particular by those who study it &amp;mdash; that quantum annealing is an effect, rather than a model of computation. A  &quot;quantum annealer&quot; would then be best understood as &quot;a machine which realises the effect of quantum annealing&quot;, rather than a machine which attempts to embody a model of computation which is known as '&lt;em&gt;quantum annealing&lt;/em&gt;'. However, the same might be said of adiabatic quantum computation, which is &amp;mdash; in my opinion correctly &amp;mdash; described as a model of computation in its own right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps it would be fair to describe quantum annealing as an approach to realising a very general &lt;em&gt;heuristic&lt;/em&gt;, and that there is an implicit model of computation which could be characterised as the conditions under which we could expect this heuristic to be successful. If we consider quantum annealing this way, it would be a model which includes the adiabatic regime (with zero-noise) as a special case, but it may in principle be more general.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-09-20T13:11:43.007" LastActivityDate="2018-09-20T13:11:43.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4229" PostTypeId="1" CreationDate="2018-09-14T20:41:44.317" Score="8" ViewCount="91" Body="&lt;p&gt;A stored programming computer model is that where a central memory is used to store both instructions and data that they operate on. Basically all the classical computers of today that follow the von Neumann architecture use the stored programming model. During program execution the CPU reads instructions or data from the RAM and places it in the various registers such as Instruction Register (IR) and other general purpose registers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is whether such a stored programming model is applicable to a Quantum Computer or not, since because of the no-cloning theorem it is not possible to clone any arbitrary quantum state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means that if we have some qubits in some state stored in a memory register then because of the no-cloning theorem the Quantum Computer processor will not be able to read or copy those qubits from the memory to some internal registers.&lt;/p&gt;&#xA;" OwnerUserId="4594" LastEditorUserId="26" LastEditDate="2018-12-23T12:43:42.087" LastActivityDate="2018-12-23T12:43:42.087" Title="Can a stored programming model be applied to a Quantum Computer?" Tags="&lt;architecture&gt;&lt;classical-computing&gt;&lt;quantum-memory&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4230" PostTypeId="1" CreationDate="2018-09-15T04:07:41.233" Score="8" ViewCount="1070" Body="&lt;p&gt;As you know, &lt;strong&gt;universal quantum computing&lt;/strong&gt; is the ability to construct a circuit from a finite set of operations that can approximate to arbitrary accuracy any unitary operation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There also exist some results proving that &lt;strong&gt;exact decompositions&lt;/strong&gt; of particular unitary operations can be found. For instance, a method was provided &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0308006.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; (see section V) to construct a quantum circuit for a general two-qubit gate, based on the method given by &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0011050.pdf&quot; rel=&quot;noreferrer&quot;&gt;Kraus and Cirac&lt;/a&gt; to decompose any desired two-qubit gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to understand this method such that I learn how to find the&#xA;quantum circuit implementing any $4\times4$ unitary matrix. To help&#xA;with that, I devised the following challenge: You are given an unitary&#xA;matrix, $U$, over two qubits and asked to follow either the previously&#xA;mentioned methods or another method you know about to come up with&#xA;the quantum circuit implementing this unitarity. I know what one circuit&#xA;representation is because I built it myself to obtain this matrix.&#xA;Our goal should be to find the decomposition with the fewer number&#xA;of gates, however, other decomposition methods will also be useful to learn. Here's the matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;U\left(x\right)=\left(\begin{array}{cccc}&#xA;0 &amp;amp; \left(-\frac{1}{2}+\frac{i}{2}\right)e^{ix/2} &amp;amp; 0 &amp;amp; \left(\frac{1}{2}+\frac{i}{2}\right)e^{ix/2}\\&#xA;0 &amp;amp; \frac{ie^{-ix/2}}{\sqrt{2}} &amp;amp; 0 &amp;amp; -\frac{e^{-ix/2}}{\sqrt{2}}\\&#xA;\left(-\frac{1}{2}-\frac{i}{2}\right)e^{-ix/2} &amp;amp; 0 &amp;amp; \left(\frac{1}{2}-\frac{i}{2}\right)e^{-ix/2} &amp;amp; 0\\&#xA;-\frac{e^{ix/2}}{\sqrt{2}} &amp;amp; 0 &amp;amp; \frac{ie^{ix/2}}{\sqrt{2}} &amp;amp; 0&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are aware of any numerical methods that can achieve this task&#xA;I also encourage you to post the solution you find and the steps to&#xA;find it. E.g., as answered at another question on this site, &lt;a href=&quot;https://github.com/artiste-qb-net/qubiter&quot; rel=&quot;noreferrer&quot;&gt;qubiter&lt;/a&gt;&#xA;has a module which apparently can decompose any n-qubit unitary into&#xA;cnots and single qubit rotations using the cosine-sine decomposition,&#xA;and this is probably not the only numerical method looking into this&#xA;problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe an exhaustive exploration of these methods will be a helpful&#xA;reference to a big audience, but let us start simple: can you give&#xA;a circuit decomposition for $U\left(x\right)$?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Universal gate set:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may consider the following set of basic gates: hadamard ($H$), phase ($S$), $\pi/8$ rotation ($T$), $cX$, $S^{\dagger}$, $T^{\dagger}$, and rotations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;R_{x}\left(\theta\right)=\left(\begin{array}{cc}&#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -i\sin\left(\frac{\theta}{2}\right)\\&#xA;-i\sin\left(\frac{\theta}{2}\right) &amp;amp; \cos\left(\frac{\theta}{2}\right)&#xA;\end{array}\right),\quad R_{y}\left(\theta\right)=\left(\begin{array}{cc}&#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -\sin\left(\frac{\theta}{2}\right)\\&#xA;\sin\left(\frac{\theta}{2}\right) &amp;amp; \cos\left(\frac{\theta}{2}\right)&#xA;\end{array}\right),\quad R_{z}\left(\theta\right)=\left(\begin{array}{cc}&#xA;e^{-\frac{i\theta}{2}} &amp;amp; 0\\&#xA;0 &amp;amp; e^{\frac{i\theta}{2}}&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With an eye on a real implementation, you may also consider IBM QX universal gate set made of a $cX$ together with one-qubit rotational and phase gates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\begin{split}V_{1}(\lambda) &amp;amp; =\begin{pmatrix}1 &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\lambda}&#xA;\end{pmatrix}\\&#xA;V_{2}(\phi,\lambda) &amp;amp; =\frac{1}{\sqrt{2}}\begin{pmatrix}1 &amp;amp; -e^{i\lambda}\\&#xA;e^{i\phi} &amp;amp; e^{i(\lambda+\phi)}&#xA;\end{pmatrix}\\&#xA;V_{3}(\theta,\phi,\lambda) &amp;amp; =\begin{pmatrix}\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{i\lambda}\sin\left(\frac{\theta}{2}\right)\\&#xA;e^{i\phi}\sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\lambda+\phi)}\cos\left(\frac{\theta}{2}\right)&#xA;\end{pmatrix}&#xA;\end{split}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, $V_{1}$ and $V_{2}$ are just special cases of $V_{3}$, hence IBM's universal set can be reduced to just two gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you wanted to find the circuit implementation for an unitarity $U\left(x,y\right)$ given by the following matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;\left(\begin{array}{cccc}&#xA;e^{-\frac{1}{2}i\pi y}\cos\frac{x}{2} &amp;amp; 0 &amp;amp; 0 &amp;amp; -e^{-\frac{1}{2}i\pi y}\sin\frac{x}{2}\\&#xA;0 &amp;amp; -ie^{\frac{i\pi y}{2}}\sin\frac{x}{2} &amp;amp; -ie^{\frac{i\pi y}{2}}\cos\frac{x}{2} &amp;amp; 0\\&#xA;\sqrt[4]{-1}e^{-\frac{1}{2}i\pi y}\sin\frac{x}{2} &amp;amp; 0 &amp;amp; 0 &amp;amp; \sqrt[4]{-1}e^{-\frac{1}{2}i\pi y}\cos\frac{x}{2}\\&#xA;0 &amp;amp; -(-1)^{3/4}e^{\frac{i\pi y}{2}}\cos\frac{x}{2} &amp;amp; (-1)^{3/4}e^{\frac{i\pi y}{2}}\sin\frac{x}{2} &amp;amp; 0&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check $U\left(x,y\right)$ can be decomposed into the following&#xA;product of operations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;U\left(x,y\right)=\left(T\otimes S^{\dagger}\right)\cdot CNOT_{01}\cdot\left(R_{y}\left(x\right)\otimes R_{z}\left(y\pi\right)\right)\cdot CNOT_{10}&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the circuit representation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5NZTu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5NZTu.png&quot; alt=&quot;decomposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1897" LastEditorUserId="1897" LastEditDate="2018-09-16T14:32:12.780" LastActivityDate="2018-09-17T13:26:46.617" Title="Decomposition of arbitrary 2 qubit operator" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4231" PostTypeId="1" CreationDate="2018-09-15T04:56:16.860" Score="2" ViewCount="195" Body="&lt;p&gt;I have programmed in C++, but I am interested in writing quantum programs. I have some experience with Microsoft's Q#, and I know about the canonical Shor's and Grover's algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me how to write a quantum program to add two integers?&lt;/p&gt;&#xA;" OwnerUserId="4596" LastEditorUserId="23" LastEditDate="2018-09-15T21:57:19.323" LastActivityDate="2018-09-15T21:57:19.323" Title="How to add two integers in Q#?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4232" PostTypeId="2" ParentId="4219" CreationDate="2018-09-15T08:41:59.603" Score="7" Body="&lt;p&gt;As already mentioned in the other answers, the crucial point is that copying means implicitly that the state of the original qubit is &lt;em&gt;unknown&lt;/em&gt;, i.e. given a qubit in an unknown state, you want to prepare a second qubit to be in exactly the same state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it more intelligible, there is a less mathematical argument that this should not be possible: By the uncertainty relation you cannot determine the values of two complementary observables (e.g. orthogonal spin directions) on the qubit with arbitrary precision at the same time. If you could copy the qubit, you could make copies and measure each of the observables on the copies with arbitrary precision, which contradicts the uncertainty relation.&lt;/p&gt;&#xA;" OwnerUserId="4598" LastEditorUserId="4598" LastEditDate="2019-02-07T17:30:52.013" LastActivityDate="2019-02-07T17:30:52.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4233" PostTypeId="2" ParentId="4231" CreationDate="2018-09-15T13:48:43.743" Score="4" Body="&lt;p&gt;You will need quantum circuits called adders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have for example one from &lt;a href=&quot;https://docs.google.com/viewer?url=https%3A%2F%2Farxiv.org%2Fpdf%2Fquant-ph%2F0410184.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cuccaro &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt; and another from &lt;a href=&quot;https://docs.google.com/viewer?url=https%3A%2F%2Farxiv.org%2Fpdf%2F1712.02630.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Himanshu &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-09-15T18:14:43.197" LastActivityDate="2018-09-15T18:14:43.197" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4234" PostTypeId="2" ParentId="4229" CreationDate="2018-09-15T15:44:00.707" Score="3" Body="&lt;p&gt;Yes, you can encode a program into your qubits in exactly the same way you'd encode a program into bits and then run circuits that interpret the program. One might hope that you could encode the program in some fancy exponentially efficient way, but in Mike&amp;amp;Ike they prove that's not possible. Because there's no exponential advantage, and because the operations needed to read and decode the program are billions of time more expensive on a quantum computer, you want to store the program in the classical control computer in almost all cases.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-09-15T15:44:00.707" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4235" PostTypeId="1" AcceptedAnswerId="4236" CreationDate="2018-09-16T15:47:57.967" Score="14" ViewCount="753" Body="&lt;p&gt;I have done some research &amp;amp; found a few different papers that discuss &lt;a href=&quot;https://www.google.com/search?q=%22xor+games%22&amp;amp;oq=%22xor+games%22&quot; rel=&quot;noreferrer&quot;&gt;xor games&lt;/a&gt; (classic &amp;amp; quantum). I am curious if someone could give a &lt;strong&gt;concise introductory explanation&lt;/strong&gt; as to what exactly xor games are &amp;amp; how they are or could be used/useful in quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-10-01T01:03:03.073" LastActivityDate="2021-03-11T06:39:01.230" Title="What exactly are Quantum XOR Games?" Tags="&lt;foundations&gt;&lt;games&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4236" PostTypeId="2" ParentId="4235" CreationDate="2018-09-17T08:12:51.053" Score="10" Body="&lt;p&gt;Quantum xor games are a method of greatly simplifying the ideas behind &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell's theorem&lt;/a&gt;, which states that no physical theory of &lt;a href=&quot;https://en.wikipedia.org/wiki/Local_hidden-variable_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;local hidden variables&lt;/a&gt; can ever reproduce all of the predictions of quantum mechanics.&lt;/p&gt;&#xA;&lt;p&gt;Basically, when two qubits are entangled, measurements on them appear correlated even if they are vastly far apart. The question then is whether the qubits decided how they would collapse at time of entanglement (thus carrying &amp;quot;local hidden variables&amp;quot; with them) or decided how they would collapse at time of measurement (thus requiring some kind of instantaneous &amp;quot;spooky action at a distance&amp;quot;). Bell's theorem, and xor games, come down firmly on the side of the latter.&lt;/p&gt;&#xA;&lt;p&gt;Xor games generally have the format of two people (Alice and Bob) given some random bits, and without communication outputting some other bits with the goal of making true a logical formula.&lt;/p&gt;&#xA;&lt;p&gt;For example with the original xor game, the &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;CHSH game&lt;/a&gt;, Alice is given random bit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and Bob random bit &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. Alice then outputs a chosen bit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and Bob outputs a chosen bit &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. They want to satisfy the equation &lt;span class=&quot;math-container&quot;&gt;$X \cdot Y = a \oplus b$&lt;/span&gt;. Of course, since they cannot communicate, they can only win some of the time; they want to choose a strategy to maximize the probability of winning. The best possible classical strategy is for Alice and Bob to both always output &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, which will result in a win 75% of the time. However if Alice and Bob share an entangled qubit pair, they can come up with a strategy to win 85% of the time! The conclusion is this disproves the existence of local hidden variables, because if the qubits contained a local hidden variable (some string of bits) then Alice and Bob could have pre-shared that same string of bits to employ in their classical strategy to also get an 85% chance of winning; since no string of bits enables them to do this, that means the entangled qubits cannot be relying on a shared string of bits (local hidden variable) and something spookier is happening. You can see an implementation of the CHSH game in Microsoft's Q# samples (with expanded explanation) &lt;a href=&quot;https://github.com/Microsoft/Quantum/blob/b0ec52d5ad6c19da8de480689c69963e660643c3/Samples/CHSHGame/Game.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The best explanation of the CHSH game is from Professor Vazirani in &lt;a href=&quot;https://youtu.be/r2oI2lF8wgw&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video&lt;/a&gt;. He claims something interesting (possibly rhetorically), which is that if Einstein had had access to the simplified presentation of xor games, he'd have avoided wasting the last three decades of his life searching for a hidden variable-based theory of quantum mechanics!&lt;/p&gt;&#xA;&lt;p&gt;I have also written a blog post detailing the CHSH game &lt;a href=&quot;https://medium.com/@ahelwer/walking-the-faster-than-light-tightrope-35147a7c6e3d&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One application of xor games is self-testing: when running algorithms on an untrusted quantum computer, you can use xor games to verify that the computer isn't corrupted by an adversary trying to steal your secrets! This is useful in &lt;a href=&quot;https://en.wikipedia.org/wiki/Device-independent_quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;device-independent quantum cryptography&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="10480" LastEditDate="2021-03-11T06:39:01.230" LastActivityDate="2021-03-11T06:39:01.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4237" PostTypeId="1" AcceptedAnswerId="4238" CreationDate="2018-09-17T10:39:51.347" Score="4" ViewCount="70" Body="&lt;p&gt;I am working with the quantum turbo codes presented in this &lt;a href=&quot;https://arxiv.org/pdf/1010.1256.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; by Wilde, Hsieh and Babar, and it is claimed that a package to simulate such codes is available at &lt;a href=&quot;https://code.google.com/archive/p/ea-turbo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ea-turbo&lt;/a&gt;. However, the hyperlink to such package appears to be broken, and so I have not been able to reach that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if anyone around knows another link to get such package, or it by any chance has the package, if he could share it so that other people can work with such codes in an easier way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like a package containing the version used by the authors for a previous &lt;a href=&quot;https://ieeexplore.ieee.org/document/6034165/&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; on the topic where a simpler decoder is used can be downloaded from the link presented in the answer by user1271772. I discovered such fact by reading the README file that such file contains. It would be very useful to know if newer versions (looks like the broken link that I was talking about in the questions refers to a second version of the package) can be obtained too.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-10-07T06:50:49.803" LastActivityDate="2018-10-07T06:50:49.803" Title="EA-Turbo simulation package" Tags="&lt;error-correction&gt;&lt;quantum-information&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4238" PostTypeId="2" ParentId="4237" CreationDate="2018-09-17T10:58:27.173" Score="1" Body="&lt;p&gt;This hyperlink works for me: &lt;a href=&quot;https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ea-turbo/ea-turbo.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ea-turbo/ea-turbo.zip&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is a zip file which I was able to download. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-09-17T10:58:27.173" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4239" PostTypeId="2" ParentId="4230" CreationDate="2018-09-17T13:26:46.617" Score="3" Body="&lt;p&gt;The circuit that I came up with is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QsnJP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QsnJP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;up to a global phase factor of $-e^{i x/2 + i \pi/4}$. The phase gate &quot;x&quot; that I used is essentially $R_z(x/2)=V_1(x)$ up to a global phase factor, so this is directly applicable to the first gates set. There's some possibility to move around some of the single-qubit gates, but I think this option minimises the depth of the circuit, which may be a more relevant number than the absolute number of gates, as it's more related to the time a circuit would take to implement (and hence how susceptible to noise it might be). Of course, I don't pretend that all gates would take the same length of time, and that's a completely different set of rules that one would be optimising over.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This same circuit can be rewritten using the other gate set&lt;a href=&quot;https://i.stack.imgur.com/3Vech.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Vech.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To come up with this decomposition, I didn't use any particular method beyond the standard &quot;I stared at it for a long time&quot; technique. I then wrote down a circuit which was always going to be sub-optimal (including a swap gate, and a two-qubit diagonal gate with arbitrary phases on the diagonal), but then rearranged the circuit to bring some elements together so that they cancelled.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-17T13:26:46.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4240" PostTypeId="1" AcceptedAnswerId="4241" CreationDate="2018-09-17T13:42:11.780" Score="1" ViewCount="111" Body="&lt;p&gt;We know the QFT gives us a new orthogonal basis from the original one, however, when I apply it on two qubits, I am not getting the output vectors orthogonal.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|out(k)\rangle = \Sigma^{N-1}_{j=0} e^{\frac{2\pi ij.k}{N}}|j\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$j.k$&lt;/span&gt; is the bitwise 'AND' and then summed up.&lt;/p&gt;&#xA;&lt;p&gt;Applying this on the basis:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle , |01\rangle , |10\rangle , |11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I get the following vectors (ignore normalization factor):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle + |10\rangle + |11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle + i|01\rangle + |10\rangle + i|11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle - |10\rangle - |11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle + i|01\rangle + |10\rangle -i|11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;However these are not orthogonal, as you can see, the dot product does not equal zero for the first and second vector.&lt;/p&gt;&#xA;&lt;p&gt;Why is this the case?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-09-17T13:58:05.707" Title="Quantum Fourier Transform on two qubits: Non orthogonal outputs" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4241" PostTypeId="2" ParentId="4240" CreationDate="2018-09-17T13:58:05.707" Score="3" Body="&lt;p&gt;You are mis-quoting the definition of the QFT. You simply take the product of the decimal values of $j$ and $k$, and don't use their binary representations.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-17T13:58:05.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4242" PostTypeId="1" CreationDate="2018-09-17T18:00:54.897" Score="6" ViewCount="967" Body="&lt;p&gt;In quantum algorithms we need to initialize the qubits at the start of our algorithm in some quantum register. Suppose that if we are working with a four qubit quantum register we can initialize the register into values such as &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt; or another value such as &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt;, which means that the first and third qubits are in basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and the second and fourth qubits are in basis &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. Once we have initialized these qubits as such we can then proceed to apply various quantum gates on them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that in a physical quantum computer (not a simulator) where say we represent qubits with electron spin, how do we manupulate such electrons so that we can initialize a Quantum register, say with the value &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4594" LastEditorUserId="26" LastEditDate="2018-12-23T12:44:59.060" LastActivityDate="2018-12-23T12:44:59.060" Title="How do we physically initialize qubits in a Quantum register?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4243" PostTypeId="2" ParentId="4242" CreationDate="2018-09-17T20:17:33.783" Score="2" Body="&lt;p&gt;Well the procedure depends on the physical system that you are using to realize the quantum register. An example I can give is of Diamond NV-Center. In simplest case, the vacancy electron is modelled as spin-1 particle here(there are reasons to model it like this) and nitrogen-14 nuclei has spin 1. So total system lies in a Hilbert space of 9-Dimensions or you can say there are 9 energy levels. Lets say you want to realise a 2-qubit register, then you would need 4-energy levels. Define the levels as $|00\rangle$, $|01\rangle$, $|10\rangle$ and $|11\rangle$. Lets say in equilibrium system is in $|00\rangle$ state, if you want to initialize the system in $|01\rangle$ state then all you would need is an electromagnetic pulse of energy being equal to the energy difference of $|01\rangle$ and $|00\rangle$ levels. In NV-Center, normally microwave and radio-frequency pulses are used.&lt;/p&gt;&#xA;" OwnerUserId="2817" LastActivityDate="2018-09-17T20:17:33.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4244" PostTypeId="1" CreationDate="2018-09-17T22:17:37.173" Score="3" ViewCount="307" Body="&lt;p&gt;I am working with &lt;code&gt;sympy.physics.quantum.qubit&lt;/code&gt; to help teach myself more about quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused about how best to simplify two ket expressions that appear to me to be identical.  Seems to me that &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; below should be the same:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B = Qubit('01')&#xA;&#xA;C = TensorProduct(Qubit('0'),Qubit('1'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;because their representation is identical, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;B.represent() == C.represent()       #returns True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it feels like they are the same qubit state.  So far, so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now when I print out &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(&quot;B is&quot;, B)&#xA;&#xA;B is |01&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(&quot;C is&quot;, C)&#xA;&#xA;C is |0&amp;gt;x|1&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;My question:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Is there some way I could get the Python library to use the output of &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; so that the equivalence between the two would be obvious?  Basically, how do I get &lt;code&gt;C&lt;/code&gt; to simplify it's output so that it exactly resembles &lt;code&gt;B&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am grateful for any help you could provide.&lt;/p&gt;&#xA;" OwnerUserId="4605" LastEditorUserId="26" LastEditDate="2018-11-20T14:44:43.570" LastActivityDate="2018-11-20T14:44:43.570" Title="Confusion over tensor products in sympy.physics.quantum.qubit (in Python)" Tags="&lt;programming&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4245" PostTypeId="2" ParentId="4242" CreationDate="2018-09-17T22:44:01.247" Score="2" Body="&lt;p&gt;One of the simplest way to think about physical realization of qubits is using Photons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you have a photon that is vertically or horizontally polarized. There are physical devices to create and measure polarizations of these photons. So, you can mark the horizontally polarized photons as the state $\lvert 0 &#xA;\rangle$ and the vertically polarized one as the $\lvert 1 \rangle$ state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you could use photon polarizer to change a particular photons polarization to turn a $\lvert 0 &#xA;\rangle$ to a $\lvert 1 \rangle$ or vice versa. This &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Physical_implementations&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt; article would help you a bit. Moreover, you could check out this cool video from professor Allan Adams where real life photon polarization is demonstrated. (&lt;a href=&quot;https://www.youtube.com/watch?v=Ei8CFin00PY&amp;amp;list=PLUl4u3cNGP61-9PEhRognw5vryrSEVLPr&amp;amp;index=3&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2018-09-17T22:44:01.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4246" PostTypeId="2" ParentId="4237" CreationDate="2018-09-17T22:56:35.883" Score="1" Body="&lt;p&gt;Since the question has been edited, there is a slightly different answer to the question (though my previous answer still has a valid link, so I am keeping it there).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The broken link presumably refers to:&#xA;&lt;a href=&quot;https://googledrive.com/host/0B77vaqbQKbrDMWEtTUxyZDgwanc/ea-turbo-v2.zip&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://googledrive.com/host/0B77vaqbQKbrDMWEtTUxyZDgwanc/ea-turbo-v2.zip&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the link at the bottom of:&#xA;&lt;a href=&quot;https://code.google.com/archive/p/ea-turbo/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://code.google.com/archive/p/ea-turbo/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution to the problem (broken link) is to contact the authors: Mark M. Wilde, Min-Hsiu Hsieh, and Zunaira Babar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with you that ideally questions like these could just be answered here on the QCSE, but I am almost 100% sure that the only three people that will be able to fix the broken link are Mark M. Wilde, Min-Hsiu Hsieh, and Zunaira Babar, and I'm 0% sure that they will see the question if it's asked here.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-09-17T22:56:35.883" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4247" PostTypeId="2" ParentId="4244" CreationDate="2018-09-18T03:16:18.540" Score="2" Body="&lt;p&gt;After some more reading of the documentation, I now realize the &lt;code&gt;C&lt;/code&gt; above is a &lt;code&gt;TensorProduct&lt;/code&gt; object (and not a &lt;code&gt;Qubit&lt;/code&gt;) but &lt;code&gt;B&lt;/code&gt; is a &lt;code&gt;Qubit&lt;/code&gt;.   The way you can make the tensor product become a Qubit (and print it out in a way that's comparable with &lt;code&gt;B&lt;/code&gt;) is to just call:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;matrix_to_qubit(represent(C))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which returns a &lt;code&gt;Qubit&lt;/code&gt; with the answer you'd expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for being patient with me as I worked that out.&lt;/p&gt;&#xA;" OwnerUserId="4605" LastEditorUserId="26" LastEditDate="2018-11-20T14:41:47.277" LastActivityDate="2018-11-20T14:41:47.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4248" PostTypeId="2" ParentId="4242" CreationDate="2018-09-18T05:08:19.810" Score="4" Body="&lt;p&gt;It very much depends on your physical realisation. In some realisations, such as when using photons, the process of producing the photon typically produces it in a fixed polarisation (which is probably what you’re using to encode a qubit). Alternatively, you pass the photon through a polarisation filter. This is equivalent to the most typical strategy - measure the qubit in some basis. That way, you know the definite state that the qubit is in, and you can convert it into the right state. As a final option, many systems have a natural Hamiltonian that is applied to them, and the system is cooled in order to produce the ground state of that Hamiltonian. Again, you’ve got a fixed state (typically the all zero state) and you can convert that into whatever initial state you want.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-18T05:08:19.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4249" PostTypeId="1" AcceptedAnswerId="4250" CreationDate="2018-09-18T08:30:32.567" Score="7" ViewCount="849" Body="&lt;p&gt;Any 1-qubit special gate can be decomposed into a sequence of rotation gates ($R_z$, $R_y$ and $R_z$). This allows us to have the general 1-qubit special gate in matrix form:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$&#xA;U\left(\theta,\phi,\lambda\right)=\left(\begin{array}{cc}&#xA;e^{-i(\phi+\lambda)}\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{-i(\phi-\lambda)}\sin\left(\frac{\theta}{2}\right)\\&#xA;e^{i(\phi-\lambda)}\sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\phi+\lambda)}\cos\left(\frac{\theta}{2}\right)&#xA;\end{array}\right)&#xA;$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If given $U\left(\theta,\phi,\lambda\right)$, how do I decompose it into any arbitrary set of gates such as rotation gates, pauli gates, etc?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make the question more concrete, here is my current situation: for my project, I am giving users the ability to apply $U\left(\theta,\phi,\lambda\right)$ for specific values of $\theta$, $\phi$ and $\lambda$ to qubits.&lt;br&gt;&#xA;But I am targeting real machines that only offer specific gates. For instance, the Rigetti Agave quantum processor only offers $R_z$, $R_x\left(k\pi/2\right)$ and $CZ$ as primitive gates.&lt;br&gt;&#xA;&lt;strong&gt;One can think of any $U\left(\theta,\phi,\lambda\right)$ as an intermediate form that needs to be transformed into a sequence of whatever is the native gateset of the target quantum processor.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in that spirit, how do I transform any $U\left(\theta,\phi,\lambda\right)$ into say $R_z$ and $R_x\left(k\pi/2\right)$? Let us ignore $CZ$ since it is a 2-qubit gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I'm writing a compiler so an algorithm and reference papers or book chapters that solve this exact problems are more than welcome!&lt;/p&gt;&#xA;" OwnerUserId="2417" LastEditorUserId="2417" LastEditDate="2018-09-18T12:42:52.117" LastActivityDate="2018-10-31T12:54:31.140" Title="Decomposition of an arbitrary 1-qubit gate into a specific gateset" Tags="&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4250" PostTypeId="2" ParentId="4249" CreationDate="2018-09-18T14:31:17.567" Score="6" Body="&lt;h3&gt;Exact decomposition for your particular gate set&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Given the range of &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; gates available to you together with arbitrary &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gates, you should be able to find an easy decomposition of arbitrary &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;as a product of three of your elementary gates). Then using simple techniques &amp;mdash; similar to the exercises of Chapter 4 in Nielsen &amp;amp; Chuang &amp;mdash; you can show that you can exactly realise any single-qubit unitary operator that you like, using at most five of your gates.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;The general problem of approximate decomposition for finite gate-sets&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;In general, it may not be possible to decompose a single-qubit gate exactly, as a product of some other single-qubit gates. This is true even of 'universal' gate sets such as Hadamard+T, consisting of the gates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \tfrac{1}{\sqrt 2}\begin{bmatrix} 1 \!&amp;amp;\! \phantom-1 \\ 1 \!&amp;amp;\! -1 \end{bmatrix},&#xA;\qquad&#xA;T = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; \!\mathrm{e}^{\pi i \!\:/ 4}\! \end{bmatrix},&#xA;$$&lt;/span&gt;&#xA;which of course can only generate a countably infinite subgroup of the continuum of single-qubit unitaries. The sense in which they are 'universal' is that this subgroup is &lt;em&gt;dense&lt;/em&gt; in the single-qubit unitaries, so that any single-qubit unitary can be approximated as closely as you like by some product of &lt;em&gt;H&lt;/em&gt; and &lt;em&gt;T&lt;/em&gt; gates, which is all that we really need to solve problems with &lt;strong&gt;bounded error&lt;/strong&gt; on quantum computers. So it makes sense to me, practically speaking, to interpret your question as asking:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Question.&lt;/strong&gt;  For a given single-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, how can you generate some approximating unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; (such that &lt;span class=&quot;math-container&quot;&gt;$\lVert U - V \rVert &amp;lt; \varepsilon$&lt;/span&gt;, for some precision parameter &lt;span class=&quot;math-container&quot;&gt;$\varepsilon &amp;gt; 0$&lt;/span&gt;) from a set of unitary gates?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The best-known work on these lines was by Solovay [unpublished] and Kitaev &lt;a href=&quot;http://iopscience.iop.org/article/10.1070/RM1997v052n06ABEH002155/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;[Russ. Math. Sure. &lt;strong&gt;52&lt;/strong&gt; (1191–1249), 1997]&lt;/a&gt;, and is known as the Solovay&amp;ndash;Kitaev Theorem. The excellent review article by Dawson and Nielsen [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0505030&lt;/a&gt;] would be a good place to read about this from an algorithms point of view: they give a detailed description of how you might realise such a decomposition, with improved run-time bounds on the original Theorem. This technique only works if the set of gates that you have is closed under inverses, however.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For specific gate sets such as Clifford+T (of which Hadamard+T is&#xA;essentially the single-qubit special case), it is possible to do much better than the Solovay&amp;ndash;Kitaev Theorem proves for general (but closed under inverses) gate sets. As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/4265/alan-geller&quot;&gt;Alan Geller&lt;/a&gt; points out in the comments, for the specific sets of Clifford+T, Clifford+(Z&lt;sup&gt;1/6&lt;/sup&gt;) or &quot;Clifford+&lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;/12&quot; gates, and &quot;Fibonacci&quot; or &quot;V&quot;  gates, the techniques developed by Kliuchnikov, Bocharov, Roetteler, and&#xA;Yard&amp;nbsp;[&lt;a href=&quot;https://arxiv.org/abs/1510.03888&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1510.03888&lt;/a&gt;]&#xA;allow you to obtain better asymptotically optimal &lt;span class=&quot;math-container&quot;&gt;$O(\log(1/\varepsilon))$&lt;/span&gt; decompositions, and in &lt;span class=&quot;math-container&quot;&gt;$O(\mathrm{polylog}(1/\varepsilon))$&lt;/span&gt; time, though depending in on a number theoretic conjecture in this case.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-31T12:54:31.140" LastActivityDate="2018-10-31T12:54:31.140" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4251" PostTypeId="1" CreationDate="2018-09-18T14:46:14.440" Score="10" ViewCount="573" Body="&lt;p&gt;I need some useful sources about the geometry of qutrit. Specifically related to the Gell-Mann matrix representation.&lt;/p&gt;&#xA;" OwnerUserId="4620" LastEditorUserId="55" LastEditDate="2019-06-04T22:51:49.003" LastActivityDate="2019-06-04T22:51:49.003" Title="Geometry of qutrit and Gell-Mann matrices" Tags="&lt;resource-request&gt;&lt;qutrit&gt;&lt;state-space-geometry&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4252" PostTypeId="1" AcceptedAnswerId="4255" CreationDate="2018-09-18T19:15:55.053" Score="24" ViewCount="3123" Body="&lt;p&gt;In a three-qubit system, it's easy to derive the CNOT operator when the control &amp;amp; target qubits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in the untouched qubit's position of significance:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_{10}|\phi_2\phi_1\phi_0\rangle = (\mathbb{I}_2 \otimes C_{10})|\phi_2\phi_1\phi_0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, it isn't obvious how to derive the CNOT operator when the control &amp;amp; target qubits are &lt;em&gt;not&lt;/em&gt; adjacent in significance:&#xA;&lt;span class=&quot;math-container&quot;&gt;$C_{20}|\phi_2\phi_1\phi_0\rangle.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How is this done?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="55" LastEditDate="2020-08-24T09:15:45.443" LastActivityDate="2020-08-24T09:15:45.443" Title="How to derive the CNOT matrix for a 3-qubit system where the control &amp; target qubits are not adjacent?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;gate-synthesis&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="4253" PostTypeId="2" ParentId="4252" CreationDate="2018-09-18T19:46:59.170" Score="1" Body="&lt;p&gt;As a general idea CNOT flips target based on control. I choose to flip the target if control is $\uparrow (= [1\ 0]^T)$, you may choose it $\downarrow (= [0\ 1]^T)$ too. So assume any general multiparticle state $|\phi\rangle=|\uparrow_1\downarrow_2\downarrow_3....\uparrow_{n-1}\downarrow_n\rangle$. Now you choose your control and target, lets say $i'th$ is control and $k'th$ is target. Applying CNOT on $|\phi\rangle$ will be just&#xA;\begin{equation}&#xA;CNOT|\phi\rangle=CNOT|\uparrow_1\downarrow_2...\uparrow_i...\uparrow_k...\uparrow_{n-1}\downarrow_n\rangle= |\uparrow_1\downarrow_2...\uparrow_i...\downarrow_k...\uparrow_{n-1}\downarrow_n\rangle&#xA;\end{equation} &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To construct the matrix of such CNOT gate we apply $\sigma_x$($x$-Pauli matrix) if $i'th$ state is up and we apply $I$($2\times2$ Identity) if $i'th$ state is down. We apply these matrices at the $k'th$ position, which is our target. Mathematically,&#xA;\begin{equation}&#xA;CNOT = \Big[|\uparrow_1...\uparrow_i...\uparrow_{k-1}\rangle\langle\uparrow_1...\uparrow_i...\uparrow_{k-1}|\otimes\sigma_x\otimes|\uparrow_{k+1}...\uparrow_n\rangle\langle\uparrow_{k+1}...\uparrow_n| + all\ permutations\ of\ states\ other\ then\ i'th\Big]&#xA;+ \Big[|\uparrow_1...\downarrow_i...\uparrow_{k-1}\rangle\langle\uparrow_1...\downarrow_i...\uparrow_{k-1}|\otimes I\otimes|\uparrow_{k+1}...\uparrow_n\rangle\langle\uparrow_{k+1}...\uparrow_n| + all\ permutations\ of\ states\ other\ then\ i'th\Big]&#xA;\end{equation}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note $k'th$ state(target) is excluded while creating the permutation matrix and at $k'th$ position the operator $\sigma_x$ or $I$ is written.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take an example of five qubits in which $2^{nd}$ qubit is target and $4^{th}$ is control. Lets build the permutation matrix of $CNOT$. I take, if control is $\uparrow$ flip the target. You can take vice-versa too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\begin{align}&#xA;CNOT &amp;amp; = |\uparrow_1\rangle\langle\uparrow_1|\otimes\sigma_x\otimes|\uparrow_3\uparrow_4\uparrow_5\rangle\langle\uparrow_3\uparrow_4\uparrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes\sigma_x\otimes|\uparrow_3\uparrow_4\downarrow_5\rangle\langle\uparrow_3\uparrow_4\downarrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes\sigma_x\otimes|\downarrow_3\uparrow_4\uparrow_5\rangle\langle\downarrow_3\uparrow_4\uparrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes\sigma_x\otimes|\downarrow_3\uparrow_4\downarrow_5\rangle\langle\downarrow_3\uparrow_4\downarrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes\sigma_x\otimes|\uparrow_3\uparrow_4\uparrow_5\rangle\langle\uparrow_3\uparrow_4\uparrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes\sigma_x\otimes|\uparrow_3\uparrow_4\downarrow_5\rangle\langle\uparrow_3\uparrow_4\downarrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes\sigma_x\otimes|\downarrow_3\uparrow_4\uparrow_5\rangle\langle\downarrow_3\uparrow_4\uparrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes\sigma_x\otimes|\downarrow_3\uparrow_4\downarrow_5\rangle\langle\downarrow_3\uparrow_4\downarrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes I\otimes|\uparrow_3\downarrow_4\uparrow_5\rangle\langle\uparrow_3\downarrow_4\uparrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes I\otimes|\uparrow_3\downarrow_4\downarrow_5\rangle\langle\uparrow_3\downarrow_4\downarrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes I\otimes|\downarrow_3\downarrow_4\uparrow_5\rangle\langle\downarrow_3\downarrow_4\uparrow_5|\\&#xA;&amp;amp; +|\uparrow_1\rangle\langle\uparrow_1|\otimes I\otimes|\downarrow_3\downarrow_4\downarrow_5\rangle\langle\downarrow_3\downarrow_4\downarrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes I\otimes|\uparrow_3\downarrow_4\uparrow_5\rangle\langle\uparrow_3\uparrow_4\downarrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes I\otimes|\uparrow_3\downarrow_4\downarrow_5\rangle\langle\uparrow_3\downarrow_4\downarrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes I\otimes|\downarrow_3\downarrow_4\uparrow_5\rangle\langle\downarrow_3\downarrow_4\uparrow_5|\\&#xA;&amp;amp; +|\downarrow_1\rangle\langle\downarrow_1|\otimes I\otimes|\downarrow_3\downarrow_4\downarrow_5\rangle\langle\downarrow_3\downarrow_4\downarrow_5| &#xA;\end{align}&lt;/p&gt;&#xA;" OwnerUserId="2817" LastActivityDate="2018-09-18T19:46:59.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4254" PostTypeId="2" ParentId="4252" CreationDate="2018-09-18T19:56:38.513" Score="11" Body="&lt;p&gt;This is a good question; it's one that textbooks seem to sneak around.  I reached this exact question when preparing a quantum computing lecture a couple days ago.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, there's no way of getting the desired 8x8 matrix using the Kronecker product $\otimes$ notation for matrices.  All you can really say is:  Your operation of applying CNOT to three qubits, with the control being the first and the target being the third, has the following effects:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 000\rangle \mapsto \lvert 000\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 001\rangle \mapsto \lvert 001\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 010\rangle \mapsto \lvert 010\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 011\rangle \mapsto \lvert 011\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 100\rangle \mapsto \lvert 101\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 101\rangle \mapsto \lvert 100\rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 110 \rangle \mapsto \lvert 111 \rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$\lvert 111 \rangle \mapsto \lvert 110 \rangle$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and therefore it is given by the following matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$U = \begin{bmatrix}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &#xA;\end{bmatrix}$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This matrix $U$ is indeed neither $I_2 \otimes \mathrm{CNOT}$ nor $\mathrm{CNOT} \otimes I_2$.  There is no succinct Kronecker-product-based notation for it; it just is what it is.&lt;/p&gt;&#xA;" OwnerUserId="1947" LastActivityDate="2018-09-18T19:56:38.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4255" PostTypeId="2" ParentId="4252" CreationDate="2018-09-18T20:51:56.660" Score="22" Body="&lt;p&gt;For a presentation from first principles, I like &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4254/124&quot;&gt;Ryan O'Donnell's answer&lt;/a&gt;. But for a slightly higher-level algebraic treatment, here's how I would do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main feature of a controlled-$U$ operation, for any unitary $U$, is that it (coherently) performs an operation on some qubits depending on the value of some single qubit. The way that we can write this explicitly algebraically (with the control on the first qubit) is:&#xA;$$ \mathit{CU} \;=\; \def\ket#1{\lvert #1 \rangle}\def\bra#1{\langle #1 \rvert}\ket{0}\!\bra{0} \!\otimes\! \mathbf 1 \,+\, \ket{1}\!\bra{1} \!\otimes\! U$$&#xA;where $\mathbf 1$ is an identity matrix of the same dimension as $U$. Here, $\ket{0}\!\bra{0}$ and $\ket{1}\!\bra{1}$ are projectors onto the states $\ket{0}$ and $\ket{1}$ of the control qubit &amp;mdash; but we are not using them here as elements of a measurement, but to describe the effect on the other qubits depending on one or the other subspace of the state-space of the first qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can use this to derive the matrix for the gate $\mathit{CX}_{1,3}$ which performs an $X$ operation on qubit 3, coherently conditioned on the state of qubit 1, by thinking of this as a controlled-$(\mathbf 1_2 \!\otimes\! X)$ operation on qubits 2 and 3:&#xA;$$&#xA;\begin{aligned}&#xA;\mathit{CX}_{1,3} \;&amp;amp;=\;&#xA;\ket{0}\!\bra{0} \otimes \mathbf 1_4 \,+\, \ket{1}\!\bra{1} \otimes (\mathbf 1_2 \otimes X)&#xA;\\[1ex]&amp;amp;=\;&#xA;\begin{bmatrix}&#xA;  \mathbf 1_4 &amp;amp; \mathbf 0_4  \\&#xA;  \mathbf 0_4 &amp;amp; (\mathbf 1_2 \!\otimes\! X) &#xA;\end{bmatrix}&#xA;\;=\;&#xA;\begin{bmatrix}&#xA;  \mathbf 1_2 &amp;amp; \mathbf 0_2 &amp;amp; \mathbf 0_2 &amp;amp; \mathbf 0_2 \\&#xA;  \mathbf 0_2 &amp;amp; \mathbf 1_2 &amp;amp; \mathbf 0_2 &amp;amp; \mathbf 0_2 \\&#xA;  \mathbf 0_2 &amp;amp; \mathbf 0_2 &amp;amp; X &amp;amp; \mathbf 0_2 \\&#xA;  \mathbf 0_2 &amp;amp; \mathbf 0_2 &amp;amp; \mathbf 0_2 &amp;amp; X&#xA;\end{bmatrix},&#xA;\end{aligned}&#xA;$$&#xA;where the latter two are block matrix representations to save on space (and sanity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Better still: we can recognise that &amp;mdash; on some mathematical level where we allow ourselves to realise that the order of the tensor factors doesn't have to be in some fixed order &amp;mdash; the control and the target of the operation can be on any two tensor factors, and that we can fill in the description of the operator on all of the other qubits with $\mathbf 1_2$. This would allow us to jump straight to the representation&#xA;$$&#xA;\begin{alignat}{2}&#xA;\mathit{CX}_{1,3} \;&amp;amp;=&amp;amp;\;&#xA;\underbrace{\ket{0}\!\bra{0}}_{\text{control}} \otimes \underbrace{\;\mathbf 1_2\;}_{\!\!\!\!\text{uninvolved}\!\!\!\!} \otimes \underbrace{\;\mathbf 1_2\;}_{\!\!\!\!\text{target}\!\!\!\!}&#xA;&amp;amp;+\,&#xA;\underbrace{\ket{1}\!\bra{1}}_{\text{control}} \otimes \underbrace{\;\mathbf 1_2\;}_{\!\!\!\!\text{uninvolved}\!\!\!\!} \otimes \underbrace{\; X\;}_{\!\!\!\!\text{target}\!\!\!\!}&#xA;\\[1ex]&amp;amp;=&amp;amp;\;&#xA;\begin{bmatrix}&#xA;  \mathbf 1_2 &amp;amp; \mathbf 0_2 &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} \\&#xA;  \mathbf 0_2 &amp;amp; \mathbf 1_2 &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} \\&#xA;  \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} \\&#xA;  \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2}&#xA;\end{bmatrix}&#xA;\,&amp;amp;+\,&#xA;\begin{bmatrix}&#xA;  \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} \\&#xA;  \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} \\&#xA;  \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; X &amp;amp; \mathbf 0_2 \\&#xA;  \phantom{\mathbf 0_2} &amp;amp; \phantom{\mathbf 0_2} &amp;amp; {\mathbf 0_2} &amp;amp; X&#xA;\end{bmatrix}&#xA;\end{alignat}&#xA;$$&#xA;and also allows us to immediately see what to do if the roles of control and target are reversed:&#xA;$$&#xA;\begin{alignat}{2}&#xA;\mathit{CX}_{3,1} \;&amp;amp;=&amp;amp;\;&#xA;\underbrace{\;\mathbf 1_2\;}_{\!\!\!\!\text{target}\!\!\!\!} \otimes \underbrace{\;\mathbf 1_2\;}_{\!\!\!\!\text{uninvolved}\!\!\!\!} \otimes \underbrace{\ket{0}\!\bra{0}}_{\text{control}}&#xA;\,&amp;amp;+\,&#xA;\underbrace{\;X\;}_{\!\!\!\!\text{target}\!\!\!\!} \otimes \underbrace{\;\mathbf 1_2\;}_{\!\!\!\!\text{uninvolved}\!\!\!\!} \otimes \underbrace{\ket{1}\!\bra{1}}_{\text{control}}&#xA;\\[1ex]&amp;amp;=&amp;amp;\;&#xA;{\scriptstyle\begin{bmatrix}&#xA; \!\ket{0}\!\bra{0}\!\! &amp;amp; &amp;amp; &amp;amp; \\&#xA; &amp;amp; \!\!\ket{0}\!\bra{0}\!\! &amp;amp; &amp;amp; \\&#xA;&amp;amp; &amp;amp; \!\!\ket{0}\!\bra{0}\!\! &amp;amp; \\&#xA;&amp;amp; &amp;amp; &amp;amp; \!\!\ket{0}\!\bra{0}&#xA;\end{bmatrix}}&#xA;\,&amp;amp;+\,&#xA;{\scriptstyle\begin{bmatrix}&#xA; &amp;amp; &amp;amp; \!\!\ket{1}\!\bra{1}\!\! &amp;amp; \\&#xA; &amp;amp; &amp;amp; &amp;amp; \!\!\ket{1}\!\bra{1} \\&#xA;\!\ket{1}\!\bra{1}\!\! &amp;amp; &amp;amp; &amp;amp;  \\&#xA;&amp;amp; \!\!\ket{1}\!\bra{1} &amp;amp; &amp;amp;&#xA;\end{bmatrix}}&#xA;\\[1ex]&amp;amp;=&amp;amp;\;&#xA;\left[{\scriptstyle\begin{matrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{matrix}}\right.\,\,&amp;amp;\,\,\left.{\scriptstyle\begin{matrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{matrix}}\right].&#xA;\end{alignat}&#xA;$$&#xA;But best of all: if you can write down these operators algebraically, you can take the first steps towards dispensing with the giant matrices entirely, instead  reasoning about these operators algebraically using expressions such as $\mathit{CX}_{1,3} =&#xA;\ket{0}\!\bra{0} \! \otimes\!\mathbf 1_2\! \otimes\! \mathbf 1_2 +&#xA; \ket{1}\!\bra{1} \! \otimes\!  \mathbf 1_2 \! \otimes\!  X$&#xA;and&#xA;$\mathit{CX}_{3,1} =&#xA;\mathbf 1_2 \! \otimes\! \mathbf 1_2 \! \otimes \! \ket{0}\!\bra{0} +&#xA;X \! \otimes\! \mathbf 1_2 \! \otimes \! \ket{1}\!\bra{1}$.&#xA;There will be a limit to how much you can do with these, of course &amp;mdash; a simple change in representation is unlikely to make a difficult quantum algorithm efficiently solvable, let alone tractable by manual calculation &amp;mdash; but you can reason about simple circuits much more effectively using these expressions than with giant space-eating matrices.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-09-19T06:20:11.097" LastActivityDate="2018-09-19T06:20:11.097" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4256" PostTypeId="2" ParentId="4204" CreationDate="2018-09-19T08:59:51.460" Score="3" Body="&lt;p&gt;We should add that applied quantum computing is also covered as on-topic by the new cross-disciplinary journals:&lt;/p&gt;&#xA;&lt;p&gt;(IOP) Quantum Science and Technology&lt;/p&gt;&#xA;&lt;p&gt;(Wiley) Advanced Quantum Technologies&lt;/p&gt;&#xA;&lt;p&gt;(Springer) Quantum Machine Intelligence&lt;/p&gt;&#xA;" OwnerUserId="410" LastEditorUserId="2293" LastEditDate="2021-03-07T22:29:54.407" LastActivityDate="2021-03-07T22:29:54.407" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4257" PostTypeId="2" ParentId="4251" CreationDate="2018-09-19T18:52:22.530" Score="3" Body="&lt;pre&gt;&lt;code&gt;I need some useful sources about the geometry of qutrit.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The most useful resource I know on the geometries of qutrits is the paper &lt;a href=&quot;https://arxiv.org/pdf/1111.4427.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Geometry of the generalized Bloch sphere for qutrits&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Specifically related to the Gell-Mann matrix representation.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The eight Gell-Mann matrices, which form one of the generalizations of Pauli matrices to 3-level systems, are involved in what is sometimes called the &quot;Bloch representation of a qutrit&quot;. This is described on &lt;strong&gt;Page 4&lt;/strong&gt; of the above linked paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in the mathematics of the geometry of qutrits, the above resource is probably the best available. If you are more interested in the visualization of qutrits, the paper &lt;a href=&quot;https://arxiv.org/pdf/1601.07361.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Three-dimensional visualization of a qutrit&lt;/a&gt; is the best resource I know. Keep in mind that generalizations of the Bloch sphere for higher dimensional qudits will never be as simple and elegant as the Bloch sphere is for 2-level systems, just as 4D hyper-spheres are not as easy to visualize as 3D spheres.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-09-19T18:52:22.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4258" PostTypeId="1" CreationDate="2018-09-20T09:52:12.343" Score="4" ViewCount="33" Body="&lt;p&gt;The &lt;a href=&quot;https://www.quantiki.org/wiki/activation-bound-entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;superactivation&lt;/em&gt;&lt;/a&gt; of quantum capacity is an effect that some quantum channels present such that is two of those channels with zero capacity are combined, a non-zero channel capacity can be achieved for the combined channel. This is obviously an effect that can only happen in the quantum world, as it is known that in classical communications two zero-capacity channels give a zero-capacity channel when combined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of the most surprising and weird effects known from quantum information theory, and so I am wondering if someone can give reference about an experimental realization of such effect.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-03-08T11:13:27.547" LastActivityDate="2021-03-08T11:13:27.547" Title="Experimental Realization of Superactivation of Quantum Capacity" Tags="&lt;resource-request&gt;&lt;quantum-operation&gt;&lt;channel-capacity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4259" PostTypeId="2" ParentId="4251" CreationDate="2018-09-20T10:04:54.183" Score="7" Body="&lt;p&gt;There are many ways to describe a qutrit or a general $N$ level system geometrically. There is also a large amount of references either explaining these geometries or applying them to various problems in quantum information. I'll try to explain here one quite general geometrical method, somewhat in detail. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method is a generalization of the Bloch sphere of the qubit, however, the qubit case is degenerate because the Bloch sphere describes the parameter space of both pure and mixed qubits (but not the maximally mixed case), while in the general case, the geometry of the parameter space depends on the degeneracy structure of the eigenvalues of the density matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description is based on the diagonalization formula of the density matrix of a general $N$ level density matrix:&#xA;$$ \rho = U \Lambda U^{-1}$$&#xA;Where $\Lambda$ is the eigenvalue matrix, which in the most general case has the form:&#xA;$$\Lambda = \mathrm{diag}(\underbrace{\lambda_1, \lambda_1, …}_{N_1 \mathrm{times}}, \underbrace{\lambda_2, \lambda_2, …}_{N_2 \mathrm{times}}, ...., \underbrace{\lambda_k, \lambda_k, …}_{N_k \mathrm{times}})$$&#xA;The matrix $U$ is an $N$ dimensional unitary matrix, i.e., belonging to $N$-dimensional unitary group $U(N)$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, since we are diagonalizing a density matrix, we must have:&#xA;$$\sum_{i=1}^{k}N_i \lambda_i = 1 \space\mathrm{and} \space \lambda_i \ge 0 \space \mathrm{for \space all}\space  i$$&#xA;Inspecting the eigenvalue vector, we see that the action of a general $N_i$ unitary matrix belonging to a $U(N_i)$ subgroup keeps the eigenvalue matrix diagonal, therefore the space of the unitary transformations that do change the density matrix can be identified with the coset space:&#xA;$$\frac {U(N)}{U(N_1) \times U(N_2) … \times U(N_k)}$$&#xA;The above spaces are called coadjoint orbits. They all admit explicit parametrizations in coordinates which allow actual work on specific cases.  They are compact, homogeneous and Kähler i.e., they are compatibly complex and Riemannian. They are described in a rather elementary manner in the following &lt;a href=&quot;http://emis.ams.org/proceedings/Varna/vol9/Bernatska.pdf&quot; rel=&quot;noreferrer&quot;&gt;work&lt;/a&gt;  of Bernatska and Holod.&#xA;Please see the following &lt;a href=&quot;https://arxiv.org/abs/1702.04152v1&quot; rel=&quot;noreferrer&quot;&gt;work &lt;/a&gt; by Loi, Mossa and Zuddas for explicit parametrization formulas for general cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, even from the general form of the coset space we can extract some information of the parameter space, namely its dimension, which is in the general case:&#xA;$$d = N^2-\sum_i N_i^2$$&#xA;In the following paragraph, I'll describe in more detail the case of a pure qutrit case. Here:&#xA;$$\Lambda = \mathrm{diag}(1, 0, 0)$$&#xA;And the space parametrizing the pure single qutrit case is:&#xA;$$\mathbb{C}P^2 = \frac {U(3)}{U(1) \times U(2)}$$&#xA;This is the two-dimensional complex projective space, (having a real dimension of $4$).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is quite easy to parametrize this space since we know that we can parametrize (almost) every pure qutrit space by means of the unit vector:&#xA;$$v = \frac{1}{\sqrt{1+|z_1|^2+|z_2|^2}}\begin{pmatrix}1  \\z_1 \\ z_2  \end{pmatrix}$$&#xA;The coordinates $(z_1, z_2)$ are the complex coordinates of $\mathbb{C}P^2$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We get the parametrization of the pure qutrit density matrix (which is a projector):&#xA;$$ \rho(z_1, z_2, \bar{z}_1, \bar{z}_2) = v v^{\dagger} =  \frac{1}{1+|z_1|^2+|z_2|^2}\begin{pmatrix}1  &amp;amp;\bar{z}_1 &amp;amp; \bar{z}_2  \\ z_1  &amp;amp;z_1 \bar{z}_1 &amp;amp; z_1 \bar{z}_2 \\ z_2  &amp;amp;z_2 \bar{z}_1 &amp;amp; z_2 \bar{z}_2  \end{pmatrix}$$&#xA;This space is symplectic, which characteristic to closed quantum system, its symplectic form sometimes called KKS (after Kirillov-Kostant-Souriau) is given by:&#xA;$$\omega_{\alpha \bar{\beta}}  = \mathrm{tr}\partial_{\alpha} \rho \bar{\partial}_{\beta} \rho$$&#xA;Being Kählerian, the symplectic form can be computed from a Kähler potential:&#xA;$$\omega_{\alpha \bar{\beta}}  = \partial_{\alpha} \bar{\partial}_{\beta} K$$&#xA;with&#xA;$$K =  \ln(1 + |z_1|^2 +|z_2|^2)$$&#xA;Given a set of Gell-Mann matrices $\mathbf{G}_i, \space i=1,…,8$, their expectation values in a general pure qubit state given by &#xA;$$ G (z_1, z_2, \bar{z}_1, \bar{z}_2) = \mathrm{tr}(\rho(z_1, z_2, \bar{z}_1, \bar{z}_2) \mathbf{G}_i)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Become classical Hamiltonians on $\mathbb{C}P^2$, and their algebra closes to the Lie algebra $\mathfrak{su}(3)$ under the Poisson brackets:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$$\{G_i, G_j\} = \omega^{\alpha \bar{\beta}} (\partial_{\alpha} G_i \bar{\partial}_{\alpha} G_j - &#xA;\partial_{\alpha} G_j\bar{\partial}_{\alpha} G_i )$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where $\omega$ with the upper indices is the inverse symplectic form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This formulation of the qutrit allows many applications in quantum information theory, please see, for example, &lt;a href=&quot;https://arxiv.org/abs/1410.5862&quot; rel=&quot;noreferrer&quot;&gt;Hughston and Salamon &lt;/a&gt;, where they construct a SIC-POVM using this parametrization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another application by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0312146v1&quot; rel=&quot;noreferrer&quot;&gt;Chaturvedi, Ercolessi, Marmo, Morandi, Mukunda and Simon&lt;/a&gt;. Although they do not spell out the above  parametrization, but they show that the connection:&#xA;$$A_{\alpha} = (\partial_{\alpha} - \bar{\partial}_{\alpha })K$$&#xA;is a Berry connection which gives rise to  Berry phases that can be used in holonomic quantum computation to generate gates for the qutrit system, Please see for example &lt;a href=&quot;https://arxiv.org/abs/math-ph/0111022v1&quot; rel=&quot;noreferrer&quot;&gt;Boya, Perelomov and Santander&lt;/a&gt; and &lt;a href=&quot;https://pdfs.semanticscholar.org/3b03/c624fb9a4767af21d5910179f2c2cc4de886.pdf&quot; rel=&quot;noreferrer&quot;&gt;Khanna, Mukhopadhyay, Simon and Mukunda&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One very important property of the pure state parameter spaces is that there is a geometric interpretation of the measurement probabilities as follows: The complex projective spaces parametrizing the pure states are equipped with a metric called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fubini%E2%80%93Study_metric&quot; rel=&quot;noreferrer&quot;&gt;Fubini-Study&lt;/a&gt; metric. The measurement probabilities of any observable, (for example one of the Gell-Mann matrices) is proportional to the geodesic length from the point representing the state to the point representing the observable eigenstate projector in $\mathbb{C}P^N$. Please see the important work by &lt;a href=&quot;https://arxiv.org/abs/gr-qc/9706069v1&quot; rel=&quot;noreferrer&quot;&gt;Ashtekar and Schilling&lt;/a&gt;. As far as I know a generalization of this property to mixed state cases has not been found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of $\mathbb{C}P^2$, the Fubini-Study metric is given by:&#xA;$$g_{\alpha \bar{\beta}}= \frac{(1 + |z_1|^2 +|z_2|^2)\delta_{\alpha \beta}-z_{\alpha} \bar{z_{\beta}} }{(1 + |z_1|^2 +|z_2|^2)^2}$$&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-09-20T12:15:52.987" LastActivityDate="2018-09-20T12:15:52.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4260" PostTypeId="1" AcceptedAnswerId="4261" CreationDate="2018-09-20T10:32:45.643" Score="5" ViewCount="1362" Body="&lt;p&gt;I am trying to make a quantum circuit with one qubit and 2 classical bits for each measurment in the system below: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/8TXdz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8TXdz.jpg&quot; alt=&quot;condition on the first measurment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to make condition on the first bit: if the first collapse to zero so x operator is act on the circuit, else (one) nothing is acting on the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using qiskit language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but when I try to create my circuit, there is always an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#definitions&#xA;q = QuantumRegister(1)&#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q,c)&#xA;&#xA;# building the circuit&#xA;qc.h(q)&#xA;qc.measure(q[0],c[0])&#xA;qc.x(q[0]).c[0]_if(c[0], 0)&#xA;qc.measure(q[0],c[1])&#xA;circuit_drawer(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the error is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  File &quot;&amp;lt;ipython-input-4-66c70285946b&amp;gt;&quot;, line 3&#xA;    qc.x(q[0]).c[0]_if(c[0], 0)&#xA;                     ^&#xA;SyntaxError: invalid syntax&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;how to write it correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to change &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(q[0]).c[0]_if(c[0], 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(q).c_if(c, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I succeed in building my circuit but I get circuit that I don`t want to work with:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FqpgQ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FqpgQ.jpg&quot; alt=&quot;Unwanted condition on measurment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wish for help, thanks.&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="26" LastEditDate="2018-12-23T11:41:29.620" LastActivityDate="2020-01-03T12:22:20.227" Title="How to create a condition on only one classical bit when we have a total of 2 classic bits in the system" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4261" PostTypeId="2" ParentId="4260" CreationDate="2018-09-20T11:27:23.003" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;controlled NOT&lt;/a&gt; gate does the opposite of what you want, it applies $X$ to the target qubit if the control qubit is 1, and does nothing if the control qubit is 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you want is to apply $X$ when the control qubit is 0 and do nothing when it is 1. This can be accomplished by applying a NOT gate (i.e. an $X$ gate) before doing the CNOT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the IBM composer it would look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cpHrG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cpHrG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code for doing CNOT in quiskit is: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gate cx c,t {&#xA; CX c,t; &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since there is a specific gate for what you want to do, you do not need any &quot;if statements&quot;!&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-09-20T14:43:00.247" LastActivityDate="2018-09-20T14:43:00.247" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4262" PostTypeId="2" ParentId="4258" CreationDate="2018-09-20T12:01:27.840" Score="3" Body="&lt;p&gt;The paper &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.108.190501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superactivation of Multipartite Unlockable Bound Entanglement&lt;/a&gt;, presented the first experimental realization of the following superactivation: Alice and Charlie have zero entanglement. Bob and Charle have zero entanglement. But Alice, Bob, and Charlie have non-zero tripartite entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Six years earlier was the experimental demonstration of a slightly different type of superactivation was done in &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.108.190501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superactivation of Multipartite Unlockable Bound Entanglement&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One year further back, there was &lt;a href=&quot;https://ieeexplore.ieee.org/document/5943448/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Generation and superactivation of bound entanglement&lt;/a&gt;, which was an experimental demonstration of superactivation in involving only bound entanglement.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-09-20T12:01:27.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4263" PostTypeId="1" AcceptedAnswerId="4264" CreationDate="2018-09-21T04:47:36.667" Score="27" ViewCount="1264" Body="&lt;p&gt;&lt;em&gt;(Sorry for a somewhat amateurish question)&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I studied quantum computing from 2004 to 2007, but I've lost track of the field since then. At the time there was a lot of hype and talk of QC potentially solving all sorts of problems by outperforming classical computers, but in practice there were really only two theoretical breakthroughs: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shor's algorithm, which did show significant speed up, but which had limited applicability, and wasn't really useful outside of integer factorization. &lt;/li&gt;&#xA;&lt;li&gt;Grover's algorithm, which was applicable to a wider category of problems (since it could be used to solve NP-Complete problems), but which only showed polynomial speed-up compared to classical computers. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Quantum annealing was also discussed, but it wasn't clear whether it was really better than classical simulated annealing or not. Measurement based QC and the graph state representation of QC were also hot topics, but nothing definitive had been proved on that front either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has any progress in the field of quantum algorithms been made since then? In particular: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Have there been any truly ground breaking algorithms besides Grover's and Shor's? &lt;/li&gt;&#xA;&lt;li&gt;Has there been any progress in defining BQP's relationship to P, BPP and NP? &lt;/li&gt;&#xA;&lt;li&gt;Have we made any progress in understanding the nature of quantum speed up other than saying that &quot;it must be because of entanglement&quot;? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4636" LastEditorUserId="1837" LastEditDate="2018-09-21T07:38:01.107" LastActivityDate="2019-10-16T15:25:25.007" Title="Has there been any truly ground breaking advance in quantum algorithms since Grover and Shor?" Tags="&lt;speedup&gt;&lt;grovers-algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4264" PostTypeId="2" ParentId="4263" CreationDate="2018-09-21T07:30:15.360" Score="21" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Have there been any truly ground breaking algorithms besides Grover's&#xA;  and Shor's?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It depends on what you mean by &quot;truly ground breaking&quot;. Grover's and Shor's are particularly unique because they were really the first instances that showed particularly valuable types of speed-up with a quantum computer (e.g. the presumed exponential improvement for Shor) and they had killer applications for specific communities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There have been a few quantum algorithms that have been designed since, and I think three are particularly worthy of mention:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The BQP-complete &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;noreferrer&quot;&gt;algorithm for evaluating the Jones polynomial&lt;/a&gt; at particular points. I mention this because, aside from more obvious things like Hamiltonian simulation, I believe it was the first BQP-complete algorithm, so it really shows the full power of a quantum computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; for solving linear equations. This is a slightly funny one because it's more like a quantum subroutine, with quantum inputs and outputs. However, it is also BQP-complete and it's receiving a lot of attention at the moment, because of potential applications in machine learning and the like. I guess this is the best candidate for truly ground breaking, but that's a matter of opinion.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.chemistryworld.com/feature/quantum-chemistry-on-quantum-computers/3007680.article&quot; rel=&quot;noreferrer&quot;&gt;Quantum Chemistry&lt;/a&gt;. I know very little about these, but the algorithms have developed substantially since the time you mention, and it has always been cited as one of the useful applications of a quantum computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Has there been any progress in defining BQP's relationship to P, BPP&#xA;  and NP?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Essentially, no. We know BQP contains BPP, and we don't know the relation between BQP and NP.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Have we made any progress in understanding the nature of quantum speed&#xA;  up other than saying that &quot;it must be because of entanglement&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Even back when you were studying it originally, I would say it was more precisely defined than that. There are (and were) good comparisons between universal gate sets (potentially capable of giving exponential speed-up) and classically simulable gate sets. For example, recall that the Clifford gates produce entanglement but are classically simulable. Not that it's straightforward to state precisely what is required in a more pedagogical manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps where some progress has been made is in terms of other models of computation. For example, the model DQC1 is better understood - this is a model that appears to have some speed-up over classical algorithms but is unlikely to be capable of BQP-complete calculations (but before you get drawn into the hype that you might find online, there &lt;em&gt;is&lt;/em&gt; entanglement present during the computation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the &quot;it's because of entanglement&quot; sort of statement still isn't entirely resolved. Yes, for pure state quantum computation, there must be some entanglement because otherwise the system is easy to simulate, but for mixed separable states, we don't know if they can be used for computations, or if they can be efficiently simulated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, one might try to ask a more insightful question: Have we made any progress in understanding which problems will be amenable to a quantum speed-up? This is subtly different because if you think that a quantum computer gives you new logic gates that a classical computer doesn't have, then it's obvious that to get a speed-up, you must use those new gates. However, it is not clear that every problem is amenable to such benefits. Which ones are? There are classes of problem where one might hope for speed-up, but I think that still relies on individual intuition. That can probably still be said about classical algorithms. You've written an algorithm x. Is there a better classical version? Maybe not, or maybe you're just not spotting it. That's why we don't know if P=NP.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-21T07:30:15.360" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4265" PostTypeId="2" ParentId="1404" CreationDate="2018-09-22T15:25:40.297" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1807.10781&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a latest development from Xanadu, a photonic quantum circuit which mimics a neural network. This is an example of a neural network running on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This photonic circuit contains interferometers and squeezing gates which mimic the weighing functions of a NN, a displacement gate acting as bias and a non-linear transformation similar to ReLU function of a NN.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have also used this circuit to train the network to generate quantum states and also implement quantum gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are their &lt;a href=&quot;https://arxiv.org/abs/1804.03159&quot; rel=&quot;nofollow noreferrer&quot;&gt;publication&lt;/a&gt; and &lt;a href=&quot;https://github.com/XanaduAI/quantum-learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;code used to train the circuit&lt;/a&gt;. Here is a &lt;a href=&quot;https://medium.com/xanaduai/photonic-quantum-neural-networks-ee0cbaefe4ac&quot; rel=&quot;nofollow noreferrer&quot;&gt;medium article&lt;/a&gt; explaining their circuit.&lt;/p&gt;&#xA;" OwnerUserId="419" LastActivityDate="2018-09-22T15:25:40.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4266" PostTypeId="1" AcceptedAnswerId="4284" CreationDate="2018-09-22T18:40:33.370" Score="6" ViewCount="447" Body="&lt;p&gt;In the three-polarizing-filter experiment, two orthogonal polarizing filters block all light but then allow some amount when a third polarizing filter is placed oriented at a 45 degree angle between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we analyze this experiment through terms familiar to quantum computation? For example, representing photons as being in a superposition of horizontal &amp;amp; vertical polarization, being sent through unitary gates (the polarization filters) with some end measurement giving us a result with probability corresponding to the proportion of photons allowed through. Basically, reducing this experiment to a form which could be written as a quantum circuit!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ask because it seems like quantum information processing is an &quot;easy&quot; path to reasoning about quantum phenomena, but I cannot see how exactly to apply it in this simple case.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-09-25T13:09:20.743" Title="Analyzing the three-polarizing-filter experiment as a quantum circuit" Tags="&lt;photonics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4267" PostTypeId="2" ParentId="4266" CreationDate="2018-09-22T19:04:12.560" Score="3" Body="&lt;p&gt;Consider a sequence of 3 measurement devices, applied sequentially to the same qubit, which starts in the 0 state. The first and last devices measure in the Z basis. The second measures in the X basis. Now you ask what the probability of getting the outcome 1 from the final measurement, depending on whether or not the second measurement device is present.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-22T19:04:12.560" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4268" PostTypeId="1" AcceptedAnswerId="4269" CreationDate="2018-09-22T21:31:52.747" Score="7" ViewCount="827" Body="&lt;p&gt;It seems like it should be simple, based on how Nielsen and Chuang talk about it, but I cannot seem to correctly implement the Inversion About the Mean operator (&lt;span class=&quot;math-container&quot;&gt;$2|\psi\rangle \langle\psi| - \mathcal{I}$&lt;/span&gt;) that is used in the Grover search algorithm, especially without using any ancilla bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about performing a NOT operation on all the working qubits, then performing a controlled-NOT on a separate toggle qubit with the control being all the working qubits, then performing a controlled phase flip with control of the toggle bit, and finally flipping the phase of all the states. I'm not sure how I'd actually implement the controlled phase flipping, though, since, I believe, phase flipping one or all of the bits would not produce the desired effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how I can construct this? I am using Q#, by the way, if you'd like to answer in code.&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="26" LastEditDate="2019-03-12T09:07:13.040" LastActivityDate="2019-07-09T17:54:17.173" Title="How to construct the &quot;Inversion About the Mean&quot; operator?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4269" PostTypeId="2" ParentId="4268" CreationDate="2018-09-22T23:57:34.600" Score="7" Body="&lt;p&gt;First, let's represent operation &lt;span class=&quot;math-container&quot;&gt;$2|\psi\rangle \langle\psi| - \mathcal{I}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}(2|0\rangle \langle0| - \mathcal{I})H^{\otimes n}$&lt;/span&gt;, as Nielsen and Chuang do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; is easy - it's just &lt;code&gt;ApplyToEach(H, register)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2|0\rangle \langle0| - \mathcal{I}$&lt;/span&gt; flips the phase of all computational basis states except &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt;. Let's do instead &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I} - 2|0\rangle \langle0|$&lt;/span&gt;, flipping the phase of only &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; (it introduces a global phase of -1 which in this case I think can be ignored).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To flip the phase of only &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;flip the state of all qubits using &lt;code&gt;ApplyToEach(X, register)&lt;/code&gt;. Now we need to flip the phase of only &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;li&gt;do a controlled-Z gate on one of the qubits (for example, the last one), using the rest as control. This can be done using &lt;code&gt;Controlled&lt;/code&gt; functor: &lt;code&gt;(Controlled Z)(Most(register), Tail(register))&lt;/code&gt;. &lt;code&gt;Tail&lt;/code&gt; returns the last element of the array, and &lt;code&gt;Most&lt;/code&gt; returns all elements except the last one.&lt;/li&gt;&#xA;&lt;li&gt;flip the state of all qubits again to return them to the original state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-09-22T23:57:34.600" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4270" PostTypeId="1" CreationDate="2018-09-23T02:43:29.647" Score="6" ViewCount="1448" Body="&lt;p&gt;I'm writing a simple multiplication algorithm that uses the Quantum Fourier Transform to repetitively add a number (the multiplicand) to itself and decrements another number (the multiplier). The repeated addition process is to be stopped once the multiplier hits the fundamental state (all qubits are in the zero state). Registers a, b, c hold the product, multiplicand and multiplier respectively. Classical register cl is used to store the final result:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def multiply(first, second, n, m):  &#xA;    a = QuantumRegister(m+n, &quot;a&quot;)&#xA;    b = QuantumRegister(m+n, &quot;b&quot;)&#xA;    c = QuantumRegister(m, &quot;c&quot;)&#xA;    d = QuantumRegister(m, &quot;d&quot;)&#xA;    cl = ClassicalRegister(m+n, &quot;cl&quot;)&#xA;    qc = QuantumCircuit(a, b, c, d, cl, name=&quot;qc&quot;)&#xA;&#xA;    for i in range(0, n):&#xA;        if first[i] == &quot;1&quot;:&#xA;            qc.x(b[n-(i+1)])&#xA;        if second[i] == &quot;1&quot;:&#xA;            qc.x(c[m-(i+1)])&#xA;    qc.x(d[0])&#xA;&#xA;    for i in range(0, m+n):&#xA;        createInputState(qc, a, m+n-(i+1))&#xA;&#xA;    for i in range(m):&#xA;        createInputState(qc, c, m-(i+1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;At this point, however, I need to create a while loop of sorts that allows me to add the multiplicand to the accumulator (register a) until register c is in the fundamental state. Unfortunately the only method I could think of was using a for loop with range (0, (value of multiplier)), but I want to find out if there is a more 'quantum' alternative. The while loop would need to have work as below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;while (register c is not in the fundamental state):&#xA;        for i in range(0, m+n):&#xA;            evolveQFTState(qc, a, b, m+n-(i+1)) &#xA;        for i in range(0, m):&#xA;            decrement(qc, c, d, m-(i+1))&#xA;        for i in range(0, m):&#xA;            inverseQFT(qc, c, i)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then we wrap things up:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    for i in range(0, m+n):&#xA;        inverseQFT(qc, a, i)&#xA;    for i in range(0, m+n):&#xA;        qc.measure(a[i], cl[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, in short, I am looking for a way to implement a set of statments that execute while a given condition holds true, i.e. a quantum register is not in the fundamental state. The problem I face is due to the fact that, to the best of my knowledge, we cannot use classical register bits in if statements, such as below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if c[0] == 0:   -------&amp;gt; not possible for QISkit classical register bits&#xA;    #Do something &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Another approach I tried was to perform the decrement operation in a different quantum circuit, but I got error messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: This is my first question here on QC SE, so please let me know if I have to rephrase it, change it or provide any additional information.&lt;/p&gt;&#xA;" OwnerUserId="4412" LastEditorUserId="26" LastEditDate="2019-03-12T09:35:25.760" LastActivityDate="2019-03-12T09:35:25.760" Title="How would one implement a quantum equivalent of a while loop in IBM QISkit?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4271" PostTypeId="2" ParentId="4270" CreationDate="2018-09-23T14:57:59.850" Score="5" Body="&lt;p&gt;Qiskit makes and manipulates quantum circuits specified by the &lt;a href=&quot;https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst#id49&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenQASM standard&lt;/a&gt;. This does indeed support statements that are conditional on a classical register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;if&lt;/code&gt; statement conditionally executes a quantum operation based on the value of a classical register. So you can have statements like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(c==3) U(theta, phi, lambda) q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will perform the rotation &lt;code&gt;U(theta, phi, lambda)&lt;/code&gt; on &lt;code&gt;q[0]&lt;/code&gt; if the classical register &lt;code&gt;c&lt;/code&gt; is holds the bit string that corresponds to the number 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @sashwat-anagolum pointed out in a comment, at the the Qiskit level this can be done with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;quantumCircuit.U(theta, lambda, phi).c_if(classicalRegister, value)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that classical conditionals like these are not currently supported on quantum hardware.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-09-25T16:51:04.750" LastActivityDate="2018-09-25T16:51:04.750" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4272" PostTypeId="2" ParentId="1404" CreationDate="2018-09-23T15:35:24.840" Score="3" Body="&lt;p&gt;All of the answers here seem to be ignoring a fundamental practical limitation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Deep Learning specifically works best with big data. MNIST is 60000 images, ImageNet is 14 Million images. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meanwhile, the largest quantum computers right now have 50~72 Qbits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even in the most optimistic scenarios, quantum computers that can handle the volumes of data that would require Deep Learning algorithms instead more traditional modeling methods are not going to be around anytime soon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So applying QC to Deep Learning might be a nice theoretical curiosity, but not something that's soon going to be practical. &lt;/p&gt;&#xA;" OwnerUserId="4636" LastEditorUserId="-1" LastEditDate="2019-11-29T19:01:05.373" LastActivityDate="2019-11-29T19:01:05.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4273" PostTypeId="1" CreationDate="2018-09-23T22:28:31.217" Score="3" ViewCount="119" Body="&lt;p&gt;I am trying to develop a more intuitive understanding of quantum computing -- I suppose Feynman would tell me that’s impossible! Let’s try: if we are trying to find the minimum of a surface or function, I can picture a grouping of qubits that would somehow consider the whole surface somewhat simultaneously, eventually finding the minimum. (Feel free to correct or improve upon that description, or tell me it’s completely useless.) My question is this: Where is the function specified, in the arrangement or connection of qubits, or in the classical programming of the inputs (and outputs?).&lt;/p&gt;&#xA;" OwnerUserId="4665" LastActivityDate="2018-09-23T23:32:17.323" Title="Where is the problem stored in a quantum computer?" Tags="&lt;programming&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4274" PostTypeId="2" ParentId="4273" CreationDate="2018-09-23T23:32:17.323" Score="1" Body="&lt;p&gt;It depends on how you encode the problem with a quantum computer. There are different ways but I can explain one easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we will call a set of qubits a register.&#xA;Let's say our problem can be represented by n qubits and the output of the function on m qubits.&#xA;You start usually in the &lt;span class=&quot;math-container&quot;&gt;$ | 0 \rangle^n | 0 \rangle^m $&lt;/span&gt; state.&#xA;You can create a superposition, which will represent all the candidates in the register of size n :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_i | i \rangle | 0 \rangle^m$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see the &lt;span class=&quot;math-container&quot;&gt;$ | i \rangle $&lt;/span&gt; as binary strings, which can be considered candidate values/input of your problem.&#xA;Note that sometimes the &lt;span class=&quot;math-container&quot;&gt;$| i \rangle $&lt;/span&gt; are considered as indexes or adresses. In that case, you can either have values in another register and they will be &quot;entangled&quot; or linked with the &lt;span class=&quot;math-container&quot;&gt;$| i \rangle $&lt;/span&gt;, that is you have for each i an &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; value, &lt;span class=&quot;math-container&quot;&gt;$| i \rangle | x_i \rangle $&lt;/span&gt;, but often in quantum algorithms it is left to an &quot;oracle&quot; which is a shortcut for stating any ways that will do it for us, or any ways of accessing those values (and computing the function most of the time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now by using quantum gates, which is a unitary transformation representing our function (call it U), we apply and we get the output for each candidate in the register of size m:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U \sum_i | i \rangle | 0 \rangle^m \rightarrow  \sum_i | i \rangle | f(i) \rangle or  \sum_i | i \rangle | x_i \rangle | f(x_i) \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The unitary may just be a translation of bit operations into quantum gates, representing the classical computation of this function but abstractly we denote by any unitary transformations U. This can also be shortcuted as an &quot;oracle&quot;. Note that with measurements, you get only one output at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second type of encoding I have seen is encoding values in amplitudes of a quantum register. For example having a vector (which will be considered normalized) of real components &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, it will be encoded in a n-qubit register as :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{i=1}^{2^n} x_i | i \rangle $$&lt;/span&gt;&lt;br&gt;&#xA;But that is non trivial to carry out and this way you are not representing every possibilities in superposition, but again computing the function is like applying a unitary operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conclusion : You specify the function as a unitary operation or an &quot;oracle&quot;. The storing of a problem on a quantum computer is not restricted to one way and is an exercise on its own. Still you have one more natural way I tried explaining. And this is also the case classically. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-23T23:32:17.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4275" PostTypeId="1" AcceptedAnswerId="13879" CreationDate="2018-09-24T02:13:59.120" Score="9" ViewCount="397" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196&quot; rel=&quot;noreferrer&quot;&gt;Improved Simulation of Stabilizer Circuits&lt;/a&gt; by Aaronson and Gottesman, it is explained how to compute a table describing which Pauli tensor products the X and Z observable of each qubit get mapped to as a Clifford circuit acts upon them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here as an example Clifford circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0: -------@-----------X---&#xA;          |           |&#xA;1: ---@---|---@---@---@---&#xA;      |   |   |   |&#xA;2: ---|---|---@---|-------&#xA;      |   |       |&#xA;3: ---@---@-------Y-------&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the table describing how it acts on the X and Z observables of each qubit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       +---------------------+-&#xA;       | 0    1    2    3    |&#xA;+------+---------------------+-&#xA;| 0    | XZ   X_   __   Z_   |&#xA;| 1    | ZZ   YZ   Z_   ZZ   |&#xA;| 2    | __   Z_   XZ   __   |&#xA;| 3    | Z_   X_   __   XZ   |&#xA;+------+---------------------+-&#xA;| sign |  ++   ++   ++   ++  |&#xA;+------+---------------------+-&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each column of the table describes how the circuit acts on the X observable (left half of column) and Z observable (right half of column) of each qubit. For example, the left side of column 3 is Z,Z,_,X meaning an X3 operation (Pauli X on qubit 3) at the right hand side of the circuit is equivalent to a Z1 * Z2 * X4 operation at the left hand side of the circuit. The 'sign' row indicates the sign of the product, which is important if you're going to simulate a measurement (it tells you whether or not to invert the result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also compute the table for the inverse of a circuit. In the example case I've given, the inverse table is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;       +---------------------+-&#xA;       | 0    1    2    3    |&#xA;+------+---------------------+-&#xA;| 0    | XZ   Y_   __   Z_   |&#xA;| 1    | _Z   YZ   Z_   _Z   |&#xA;| 2    | __   Z_   XZ   __   |&#xA;| 3    | Z_   Y_   __   XZ   |&#xA;+------+---------------------+-&#xA;| sign |  ++   -+   ++   ++  |&#xA;+------+---------------------+-&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The tables look &lt;em&gt;almost&lt;/em&gt; the same if you transpose their rows and columns. But the entries aren't exactly identical. In addition to transposing, you have to encode the letters into bits (&lt;code&gt;_&lt;/code&gt;=00, &lt;code&gt;X&lt;/code&gt;=01, &lt;code&gt;Z&lt;/code&gt;=10, &lt;code&gt;Y&lt;/code&gt;=11) then swap the middle bits then decode. For example, ZZ encodes into 1010 which swaps into 1100 which decodes into Y_.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question I have is: is there also a simple rule for the computing the inverse table's signs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I'm inverting these tables by decomposing them into circuits, inverting the circuits, then multiplying them back together. It's extremely inefficient compared to transpose+replace, but if I'm going to use transpose+replace I need a sign rule.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-09-24T21:00:06.220" LastActivityDate="2020-09-22T19:29:17.247" Title="Is there a simple rule for the inverse of a Clifford circuit's stabilizer table?" Tags="&lt;pauli-gates&gt;&lt;clifford-group&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4277" PostTypeId="2" ParentId="4273" CreationDate="2018-09-23T22:24:14.877" Score="0" Body="&lt;p&gt;Generally speaking if you're doing, say, Grover's algorithm (function inversion in &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; time) you would want to program the function itself using the quantum gates that your qubits are passing through. Hypothetically that information could be stored in a &quot;program&quot; of classical bits stored alongside, if you have the ability to control which of a set of quantum gates is applied with a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hazard here is that quantum gates can only describe reversible logic whereas usual logic gates like AND and OR are not reversible. So your first step would typically involve implementing a reversible logic gate that is universal, like Toffoli (also called CCNOT, &lt;code&gt;toffoli_3(x, y, z) = (x AND y) XOR z&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerDisplayName="CR Drost" LastActivityDate="2018-09-23T22:24:14.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4278" PostTypeId="1" CreationDate="2018-09-24T09:10:22.203" Score="3" ViewCount="156" Body="&lt;p&gt;I have successfully installed qiskit. However, when I try to run a simulation I get the error &quot;No module named 'qiskit'&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I get or enable this module?&lt;/p&gt;&#xA;" OwnerUserId="4668" LastEditorUserId="26" LastEditDate="2019-03-12T09:34:03.930" LastActivityDate="2019-03-12T09:34:03.930" Title="How can I get the qiskit module" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4280" PostTypeId="1" AcceptedAnswerId="4282" CreationDate="2018-09-24T11:24:39.757" Score="2" ViewCount="786" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it real now or not completed yet?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I buy one? / How many quantum computers have been manufactured in the world?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is quantum computing independent (e.g Quantum+LCD+Keyboard) or it add-on for PC (e.g GPU)? / Can I use a quantum computer directly or must connect it to PC?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can a quantum computer process same CPU data? (e.g CPU can't process GPU graphics)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can quantum computers run high-end games?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can I program a quantum computer using C++? If not, why so?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4670" LastEditorUserId="26" LastEditDate="2018-12-14T05:45:23.793" LastActivityDate="2018-12-14T05:45:23.793" Title="What's the current status of quantum computers?" Tags="&lt;physical-realization&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2018-11-25T18:02:50.980" ContentLicense="CC BY-SA 4.0" />
  <row Id="4281" PostTypeId="2" ParentId="4280" CreationDate="2018-09-24T13:30:55.420" Score="2" Body="&lt;p&gt;1 - Not completed in the sense computations suffer from noise. Doing fault-tolerant quantum computations would be a major advancement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Unless you are wealthy, no. They are hosted by big groups generally. For how many, it is non-exhaustive but you can refer to this &lt;a href=&quot;https://www.quora.com/How-many-quantum-computers-exist-as-of-2018&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - So far it is just a chip, with big cooling system which takes some storage place. Connection with a classical computer will be just to send instructions to the chip and get the answers back to you as classical information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4 - No classical data cannot be processed unless we have a way to convert it to quantum form, which is non trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5 - So far it is not the purpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;6 -  You have some quantum simulators in C++. You can find them on &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantiki's list of QC simulators&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-24T13:30:55.420" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4282" PostTypeId="2" ParentId="4280" CreationDate="2018-09-24T14:42:21.840" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Is it real now&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum computers are real, and they &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;have been made by several companies&lt;/a&gt; such as IBM, Intel, Google, Alibaba, and Rigetti. D-Wave also makes quantum annealers, which do not have provable speed-up over classical computers for most problems, but do have the same speed-up as circuit-based quantum computers for some problems (such as the square-root speed-up for the sort problem that Grover's algorithm solves on circuit-based quantum computers). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;or not completed yet?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The pursuit to build quantum computers is far from complete. We want to make machines with more qubits and less noise, for example.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2- Can I buy one?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;D-Wave has released 4 models for public sale in the last 7 years. They sold their first annealer (the D-Wave One) for \$10 million and their second one (the D-Wave Two) for $15 million (&lt;a href=&quot;https://www.sans.org/reading-room/whitepapers/securitytrends/straddling-frontier-1-quantum-computing-primer-35390&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt;). Their most recent machine, the 2000Q also &lt;a href=&quot;https://www.nextbigfuture.com/2018/02/d-wave-quantum-annealing-gets-20-million-in-funding-and-talks-to-softbank-and-others-for-a-lot-more.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;sold for \$15 million&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;None of the circuit-based quantum computers are publicly advertised for sale, but I'm sure if you offered Rigetti \$15 million for one, they would make it for you. Google and Intel might not be as interested in your money since they already have a lot of that, and since they seem a lot more reluctant to let people use their machines than IBM (who let's anybody use their machines directly), maybe they wouldn't sell you one for any price you offer, but this is just a guess.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;How many quantum computers have been manufactured in the world? &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first quantum computer had only 2 qubits in 1998 and was made at Oxford University by Jonathan Jones with theoretical input from Michele Mosca (see the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801027&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper&lt;/a&gt;). Hundreds of quantum devices like this have been made in universities since then. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;15 larger-scale quantum devices are listed &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but this list doesn't include Alibaba's quantum computer, and dozens of other prototypes made by these companies. For example &lt;a href=&quot;https://c1.staticflickr.com/9/8181/8054771535_af92c448ed_b.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; shows that D-Wave made at least 9 more machines that are not listed in that Wikipedia article. They have also made machines for their own testing such as the machine with the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2536/what-is-d-waves-pegasus-architecture&quot;&gt;Pegasus&lt;/a&gt; architecture.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;3&quot;&gt;&#xA;  &lt;li&gt;Is quantum computing independent (e.g Quantum+LCD+Keyboard) or it add-on for PC (e.g GPU)? / Can I use a quantum computer directly or must connect it to PC?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Think of it more like a GPU accelerator. Use a classical keyboard and mouse to give it commands, and a classical LCD screen to see the output, but allow the calculations to happen on a device that involves qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a famous picture of someone using a classical keyboard and classical LCD when using a quantum annealer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fZbBc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fZbBc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;4&quot;&gt;&#xA;  &lt;li&gt;Can a quantum computer process same CPU data? &lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;QPU's can process all classical data. A classical CPU can't process all QPU data, but certainly can process any classical data that a QPU uses.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;5&quot;&gt;&#xA;  &lt;li&gt;Can quantum computers run high-end games?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum computers right now don't have enough qubits. If and when quantum computers have enough qubits, they will be able to do &lt;strong&gt;&lt;em&gt;anything that a classical computer can do, and more&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;6&quot;&gt;&#xA;  &lt;li&gt;Can I program a quantum computer using C++? If not, why so?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There's some C/C++ simulators &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but there's also languages specifically for quantum computers, such as Q#. See &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_programming&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; list.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2018-11-25T18:09:08.107" LastActivityDate="2018-11-25T18:09:08.107" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4283" PostTypeId="1" CreationDate="2018-09-24T16:31:48.220" Score="3" ViewCount="184" Body="&lt;p&gt;I am writing a small algorithm to multiply two numbers using IBM's QISkit. The code  is below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;times_shell.py&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import times&#xA;&#xA;first = input(&quot;Enter a number with less than 7 digits.&quot;)&#xA;l1 = len(first)&#xA;second = input(&quot;Enter another number with less than &quot; + str(8-l1) + &quot; &#xA;digits.&quot;)&#xA;l2 = len(second)&#xA;if l1 &amp;gt; l2:&#xA;    n = l1&#xA;    m = l2&#xA;else:&#xA;    first, second = second, first&#xA;    n = l2&#xA;    m = l1&#xA;&#xA;prod = (&quot;0&quot;)*(m+n)&#xA;&#xA;while int(second) is not 0:&#xA;    second, prod = times.multiply(first, second, prod, n, m)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;times.py&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def multiply(first, second, product, n, m):&#xA;&#xA;    a = QuantumRegister(m+n, &quot;a&quot;) #accumulator&#xA;    b = QuantumRegister(m+n, &quot;b&quot;) #holds multiplicand&#xA;    c = QuantumRegister(m, &quot;c&quot;) #hold multiplier&#xA;    d = QuantumRegister(m, &quot;d&quot;) #register with value 1&#xA;    cl = ClassicalRegister(m+n, &quot;cl&quot;) #used for final output&#xA;    cl2 = ClassicalRegister(m, &quot;cl2&quot;)&#xA;    qc = QuantumCircuit(a, b, c, d, cl, cl2, name=&quot;qc&quot;)&#xA;&#xA;    for i in range(0, m+n):&#xA;        if product[i] == &quot;1&quot;:  &#xA;            qc.x(a[m+n-(i+1)])&#xA;&#xA;    for i in range(0, n):&#xA;        if first[i] == &quot;1&quot;:&#xA;            qc.x(b[n-(i+1)])&#xA;&#xA;    for i in range(0, m):&#xA;        if second[i] == &quot;1&quot;:&#xA;            qc.x(c[m-(i+1)])&#xA;&#xA;    qc.x(d[0])&#xA;&#xA;    for i in range(0, m+n):&#xA;        createInputState(qc, a, m+n-(i+1), pie)&#xA;&#xA;    for i in range(m):&#xA;        createInputState(qc, c, m-(i+1), pie)&#xA;&#xA;    for i in range(0, m+n):&#xA;        evolveQFTState(qc, a, b, m+n-(i+1), pie) &#xA;&#xA;    for i in range(0, m):&#xA;        decrement(qc, c, d, m-(i+1), pie)&#xA;&#xA;    for i in range(0, m):&#xA;        inverseQFT(qc, c, i, pie)&#xA;&#xA;    for i in range(0, m+n):&#xA;        inverseQFT(qc, a, i, pie)&#xA;&#xA;    for i in range(0, m+n):&#xA;        qc.measure(a[i], cl[i])&#xA;&#xA;    for i in range(0, m):&#xA;        qc.measure(c[i], cl2[i])&#xA;&#xA;    print(qc.qasm())&#xA;&#xA;    register(Qconfig['APItoken'], Qconfig['url'])&#xA;    result = execute(qc, backend='ibmq_qasm_simulator', &#xA;                  shots=1024).result()&#xA;    counts = result.get_counts(&quot;qc&quot;)&#xA;    print(counts)&#xA;    output = max(counts.items(), key=operator.itemgetter(1))[0]&#xA;    multiplier, accumulator = str(output).split(&quot; &quot;)&#xA;&#xA;    print(multiplier)&#xA;    print(accumulator)&#xA;&#xA;    return multiplier, accumulator&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run it I get an error. The terminal output (the program output and the error) is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;    File &quot;times_shell.py&quot;, line 18, in &amp;lt;module&amp;gt; second, prod = &#xA;    times.multiply(first, second, prod, n, m)&#xA;    File &quot;D:\Projects\Quantum_Computing\IBM_Python\times.py&quot;, line 122, in &#xA;    multiply&#xA;    register(Qconfig['APItoken'], Qconfig['url'])&#xA;    File &quot;C:\Users\ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site- &#xA;    packages\qiskit\wrapper\_wrapper.py&quot;, line 56, in register&#xA;    _DEFAULT_PROVIDER.add_provider(provider)&#xA;    File &quot;C:\Users\ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site- &#xA;    packages\qiskit\wrapper\defaultqiskitprovider.py&quot;, line 158, in &#xA;    add_provider&#xA;    raise QISKitError(&quot;The same provider has already been registered!&quot;)&#xA;    qiskit._qiskiterror.QISKitError: 'The same provider has already been &#xA;    registered!'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what the issue is here. Any help with this issue would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4412" LastActivityDate="2018-09-25T14:21:40.347" Title="How can I resolve the error QISkit Error: The same provider has already been registered!" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4284" PostTypeId="2" ParentId="4266" CreationDate="2018-09-24T18:34:41.820" Score="5" Body="&lt;p&gt;We may simulate the three-polarising-filter experiment as a circuit, in the following way, using &lt;em&gt;qutrits&lt;/em&gt;.&#xA;I will start by describing this as a sequence of transformations (a &lt;em&gt;channel&lt;/em&gt;) on qutrits, and then give a circuit which simulates this using qubits.&#xA;&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\left\lvert#1\right\rangle} \def\bra#1{\left\langle#1\right\rvert}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The three-polarising-filter experiment as a channel on qutrits&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We consider the path that the photon &lt;em&gt;could&lt;/em&gt; take in the experiment, and describe the state of this path at each point in terms of a qutrit with state-space spanned by &lt;span class=&quot;math-container&quot;&gt;$\{ \ket\varnothing,  \ket H, \ket V \} $&lt;/span&gt;. The state &lt;span class=&quot;math-container&quot;&gt;$\ket\varnothing$&lt;/span&gt; is the &lt;em&gt;vacuum state&lt;/em&gt;, meaning a state with no photons. The states &lt;span class=&quot;math-container&quot;&gt;$\ket H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \ket V$&lt;/span&gt; correspond to having one photon which is horizontally or vertically polarised. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(A more general treatment would allow any finite number of photons, in which case one should instead consider an analysis in terms of creation and annihilation opeeators; for any finite number of qubits or qudits of fixed dimension, we must restrict ourselves to some limited number of photons &amp;mdash; here we consider just one.)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As input, we can consider an arbitrary single-photon state. The state doesn't even have to be a pure state: we may consider any density matrix as input in the space spanned by &lt;span class=&quot;math-container&quot;&gt;$\{  \ket H, \ket V \} $&lt;/span&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The first filter does not quite 'measure' the photon, as it &amp;mdash; well &amp;mdash; filters it out. For a horizontally polarised filter, it strips away the vertical component, transforming it to the zero-photon state, and leaves the other 'basis' states unchanged. This realises the following transformation on density operators:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ F_H(\rho) \,=\, \ket\varnothing\!\!\bra\varnothing \,\rho\, \ket\varnothing\!\!\bra\varnothing \,+\, \ket H\!\!\bra H \,\rho\, \ket H \!\!\bra H \,+\, \ket\varnothing\!\!\bra V \,\rho\, \ket V\!\!\bra\varnothing$$&lt;/span&gt;&#xA;&amp;mdash; note the final term above.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Note that this transformation is irreversible, and in particular, non-unitary. It is sometimes said of such transformations that they involve an 'implicit measurement'. Sure enough, this transformation could be in an abstract sense simulated by a non-demolition polarisation measurement, followed by a unitary on the state-space which depends on the measurement outcome, and finally by &lt;em&gt;forgetting the measurement outcome&lt;/em&gt; so that no explicit trace is left of whether the filtering happened. That could be a way of simulating the filtering operation, &lt;em&gt;e.g.&lt;/em&gt; with CNOTs and qubits representing operations on qutrits. But the actual physics is a bit closer to the irreversible map &lt;span class=&quot;math-container&quot;&gt;$F_H$&lt;/span&gt; itself, that I've described.&lt;br&gt;&lt;br&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The second filter acts much the way the first filter does, but in a different basis. Consider the basis  &lt;span class=&quot;math-container&quot;&gt;$\{ \ket\varnothing,  \ket D, \ket d \} $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$ \ket\varnothing$&lt;/span&gt; is as before and &lt;span class=&quot;math-container&quot;&gt;$\ket D = (\ket H + \ket V) \,/ \sqrt 2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket d = (\ket H - \ket V) \,/ \sqrt 2$&lt;/span&gt;.&#xA;Then we may analogously define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ F_D(\rho) \,= \,\ket\varnothing\!\!\bra\varnothing \,\rho\, \ket\varnothing\!\!\bra\varnothing + \ket D\!\!\bra D \,\rho\, \ket D \!\!\bra D \,+\, \ket\varnothing\!\!\bra d \,\rho\, \ket d\!\!\bra\varnothing$$&lt;/span&gt;&#xA;to describe the effect of a polarising filter for &lt;span class=&quot;math-container&quot;&gt;$\ket D$&lt;/span&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The final filter is much as you might now expect:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ F_V(\rho) \,=\, \ket\varnothing\!\!\bra\varnothing \,\rho\, \ket\varnothing\!\!\bra\varnothing \,+\, \ket \varnothing\!\!\bra H \,\rho\, \ket H \!\!\bra \varnothing \,+\, \ket V\!\!\bra V \,\rho\, \ket V\!\!\bra V$$&lt;/span&gt;&#xA;&amp;mdash; note here the second term.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The observation of the three-polarising-filter experiment is then that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;(F_V \circ F_H) (\rho) = F_V ( F_H(\rho)) &amp;amp;= \ket\varnothing \!\! \bra\varnothing, \quad\text{whereas}&#xA;\\&#xA;(F_V \circ F_D \circ F_H) (\rho) = F_V \bigl(F_D\bigl( F_H(\rho)\bigr) \bigr) &amp;amp;= \tfrac 14 p\ket V \!\! \bra V + (1-\tfrac 14 p) \ket\varnothing \!\! \bra\varnothing,&#xA;\end{align}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p = \bra H \rho \ket H$&lt;/span&gt; may be non-zero.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Simulation with a circuit using qubits&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There are a number of different ways in which we could simulate this using qubits. A good choice of representation of the 'photon qutrit' will give us a simpler circuit. I would suggest the following.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Use a two-qubit representation with qubits labelled &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (for &#xA;number') and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; (for 'polarisation'), where we consider &lt;span class=&quot;math-container&quot;&gt;$\ket{0}_P$&lt;/span&gt; to correspond to horizontal polarisation (or the lack of polarisation when there are no photons) and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; to correspond to vertical polarisation.&#xA;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{\varnothing} \equiv \ket{0}_N\ket{0}_P\,,&#xA;\quad&#xA;\ket{H} \equiv \ket{1}_N\ket{0}_P\,,&#xA;\quad&#xA;\ket{V} \equiv \ket{1}_N\ket{1}_P\,.&#xA;$$&lt;/span&gt;&#xA;The two-qubit state &lt;span class=&quot;math-container&quot;&gt;$\ket{01}$&lt;/span&gt; is not in the state-space of the simulation; by asserting that it is not valid as an input, we may use a simpler circuit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The action of each filter can be described in terms of forcing a particular polarisation at output, for instance by mapping the polarisation to be selected for the &lt;span class=&quot;math-container&quot;&gt;$\ket{0}_P$&lt;/span&gt;, conditioned on the photon number being &lt;span class=&quot;math-container&quot;&gt;$\ket{1}_N$&lt;/span&gt;; preparing a fresh qubit in the state &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; and substituting it for the polarisation qubit; forcing the photon number to zero for the part of the state where the photon polarisation is not what we were selecting for; and then by discarding the information about the input polarisation and restoring the frame of reference for the polarisation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Using this representation, the following circuit then represents the set-up of having all three filters present:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8puAa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8puAa.png&quot; alt=&quot;qubit circuit representing three-polarisation-filter experiment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I've used a 'controlled-X' gate for the &lt;span class=&quot;math-container&quot;&gt;$F_V$&lt;/span&gt; filter to emphasise the similarity to the &lt;span class=&quot;math-container&quot;&gt;$F_D$&lt;/span&gt; filter: in general one can define a filter using any controlled unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; determines the polarisation to filter.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbols at the end of the 'auxiliary' wires for each filter is just a map of discarding that qubit (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;you don't care about anything at all that happens to it from that point on and it isn't accessible for measurement). This is equivalent to using a &lt;em&gt;destructive&lt;/em&gt; measurement, summing up the non-normalised density operators for the two measurement outcomes, and then forgetting the measurement outcome, but from a physical perspective, you don't usually have to measure a qubit &amp;mdash; or a photon, or your carry-on luggage &amp;mdash; in order to forget about it and then lose access to it forever.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-09-25T13:09:20.743" LastActivityDate="2018-09-25T13:09:20.743" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4285" PostTypeId="2" ParentId="4275" CreationDate="2018-09-24T20:06:13.137" Score="4" Body="&lt;p&gt;There is a very closely related representation of the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196&quot; rel=&quot;nofollow noreferrer&quot;&gt;tableau representation of Aaronson (and Gottesman)&lt;/a&gt;, which works not only for qubits but for qudits of arbitrary finite dimension, which works particularly well for purely Clifford circuits (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;at most one terminal measurement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this alternative representation, one has tableaus describing how the single-qubit X and Z operators transform, with phase information, as in the usual representation. The columns describe multi-qubit Weyl operators specifically, which are a special subset of the Pauli operators. The advantage of doing so is that the tableau is not just an array of coefficients, but an actual linear operator on the vectors which represent Weyl operators and phases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a small catch. For qubits, these vectors have coefficients which are integers modulo 4 (corresponding to a double cover of the non-trivial single-qubit Pauli operators by Weyl operators), rather than modulo 2. I think this is a small price to pay &amp;mdash; though I might be slightly biased, as it's my own result [&lt;a href=&quot;https://arxiv.org/abs/1102.3354&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1102.3354&lt;/a&gt;]. However, it does seem to be a somewhat 'naturally occurring' representation: Appleby developed the single-qubit or qudit special case somewhat earlier [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412001&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0412001&lt;/a&gt;] (something which I would really liked to have known before spending two years needlessly re-creating essentially the same conventions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using such a representation, by virtue of the fact that the 'tableau' &lt;span class=&quot;math-container&quot;&gt;$M_C$&lt;/span&gt; of a Clifford circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is now an actual matrix (and an invertible one) which transforms vectors, the tableau for the inverse circuit &lt;span class=&quot;math-container&quot;&gt;$C^{\dagger}$&lt;/span&gt; is then the inverse &lt;span class=&quot;math-container&quot;&gt;$M_C^{-1}$&lt;/span&gt; of the tableau. So, for this closely related representation at least, the rule for computing the tableau for the inverse circuit is easy.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-09-24T20:06:13.137" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4286" PostTypeId="2" ParentId="4275" CreationDate="2018-09-25T06:47:39.187" Score="2" Body="&lt;p&gt;To draw out Aaronson and Gottesman's techniques a bit more explicitly: you can set up each stabilizer as a bit string of length &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; (for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits). The first &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; bits specify the locations of Z operators, and the second set of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; specify the locations of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators (so, &lt;span class=&quot;math-container&quot;&gt;$X_1Z_2$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; is 0110). For your circuit on four qubits, the transformation due to a Clifford circuit (up to some phases) would then be given by an &lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt; matrix. We can think of this as a block matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\left(\begin{array}{cc}&#xA;A &amp;amp; B \\ C &amp;amp; D \end{array}\right),&#xA;$$&lt;/span&gt;&#xA;where each of the blocks is &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt;. By the fact that the stabilizers commute, we know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc}&#xA;A &amp;amp; B \\ C &amp;amp; D \end{array}\right)\cdot\left(\begin{array}{cc}&#xA;0 &amp;amp; \mathbb{I} \\ \mathbb{I} &amp;amp; 0 \end{array}\right)\cdot \left(\begin{array}{cc}&#xA;A &amp;amp; B \\ C &amp;amp; D \end{array}\right)^T\equiv 0\text{ mod }2&#xA;$$&lt;/span&gt;&#xA;You want to find the inverse of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; modulo 2. Your claimed form of the inverse is then of the form (I think)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc}&#xA;D^T &amp;amp; B^T \\ C^T &amp;amp; A^T \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;which is interestingly reminiscent of the inverse of a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix (but that is not sufficient for block matrices. There is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Block_matrix#Block_matrix_inversion&quot; rel=&quot;nofollow noreferrer&quot;&gt;block-wise inverse&lt;/a&gt; but that's not so helpful here, I think).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mess, of course, comes from keeping track of the phases. I guess the signs will be related to a change in the number of Y operators in each stabilizer, but I haven't succeeded in a unified treatment. Niel's answer probably does a better job of taking care of it automatically.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="124" LastEditDate="2018-09-25T10:31:02.497" LastActivityDate="2018-09-25T10:31:02.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4289" PostTypeId="1" AcceptedAnswerId="4294" CreationDate="2018-09-25T13:17:47.417" Score="7" ViewCount="135" Body="&lt;p&gt;I am reading the paper &lt;a href=&quot;https://arxiv.org/pdf/1109.2591.pdf&quot; rel=&quot;noreferrer&quot;&gt;Polar codes for classical-quantum channels&#xA;&lt;/a&gt; by Wilde and Guha, and it is stated the fact that collective measurements are necessary in order to aciheve the Holevo symmetric information as it can be seen from the HSW theorem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering what are such collective measurements and why are they different from the normal quantum measurements. Additionally, I was expecting to obtain some insight about some physical realization of such kind of measurements, as it seems that if applied in an optical-fiber link, the usage of such codes would be a way to obtain a tranmission rate equal to the Holevo symmetric information, which would be the ultimate capacity of such a channel.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-09-26T08:13:14.483" Title="Collective measurements: importance and realization" Tags="&lt;error-correction&gt;&lt;quantum-information&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4290" PostTypeId="2" ParentId="4283" CreationDate="2018-09-25T14:21:40.347" Score="2" Body="&lt;p&gt;It seems that the solution is rather simple - simply move the registration bit of the code, i.e. the bit below, to the &lt;strong&gt;times_shell.py&lt;/strong&gt; script.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;register(Qconfig['APItoken'], Qconfig['url'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way I only register once, and can run my job multiple times. The successful results of my algorithm can be seen below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Enter a number with less than 7 digits.1111&#xA;Enter another number with less than 4 digits.11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'10 101111': 459, '10 001111': 565}&#xA;10&#xA;001111&#xA;&#xA;{'01 000010': 15, '01 101110': 130, '01 011110': 197, '01 010110': 38, '01 110110': &#xA;78, '01 000110': 58, '01 110010': 14, '01 100010': 50, '01 010010': 5, '01 100110': &#xA;71, '01 111010': 21, '01 101010': 30, '01 001010': 19, '01 011010': 14, '01 111110': &#xA;169, '01 001110': 115}&#xA;01&#xA;&#xA;{'00 101101': 664, '00 110001': 1, '00 101001': 128, '00 001001': 7, '00 111001': 18, &#xA;'00 011101': 8, '00 001101': 163, '00 100001': 4, '00 111101': 31}&#xA;00&#xA;101101&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope this helps anyone facing similar issues.&lt;/p&gt;&#xA;" OwnerUserId="4412" LastActivityDate="2018-09-25T14:21:40.347" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4291" PostTypeId="2" ParentId="4014" CreationDate="2018-09-25T15:37:07.647" Score="3" Body="&lt;p&gt;Just a small complement to @gIS excellent answer: I know of several people (including myself) interested on the public verification aspect. As far as I know, all attempts  have failed, hence the lack of literature on the subject: as soon as one can prove the Boson sampler acted correctly, it is indeed a regime where the Boson sampler can be efficiently simulated classically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that such a verification is not totally hopeless, as it exists in the related &lt;span class=&quot;math-container&quot;&gt;$IQP$&lt;/span&gt; non-universal computation model introduced by Shepherd and Brenner in (&lt;a href=&quot;https://arxiv.org/abs/0809.0847&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0809.0847&lt;/a&gt; / &lt;a href=&quot;https://dx.doi.org/10.1098/rspa.2008.0443&quot; rel=&quot;nofollow noreferrer&quot;&gt;Proc. R. Soc. A 465, 1413&lt;/a&gt;). &#xA;&lt;span class=&quot;math-container&quot;&gt;$IQP$&lt;/span&gt; stands for &lt;strong&gt;I&lt;/strong&gt;nstantaneous &lt;strong&gt;Q&lt;/strong&gt;uantum computing in &lt;strong&gt;P&lt;/strong&gt;olynomial time. In this model, one only applies commuting gates, but they do not commute with the computational basis. This leads to quantum superiority through a model widely thought to be less powerful as &lt;em&gt;BQP&lt;/em&gt;, like boson sampling. In this model, there are ways to embed computation with known results (the paper speaks about matroids, but I honestly do not understand this part) inside larger computations showing quantum advantage and use them to verify the computation. Attempts have been made to hide submatrices with known determinants inside larger matrices for boson sampling, but, as far as I know, all such submatrix family tried for such role have some telltale signs (usually too big coefficients) allowing them to be detected in &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, thus defeating their very purpose.&lt;/p&gt;&#xA;" OwnerUserId="1782" LastActivityDate="2018-09-25T15:37:07.647" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4292" PostTypeId="1" CreationDate="2018-09-25T23:11:44.557" Score="4" ViewCount="151" Body="&lt;p&gt;I am trying to develop a feel for quantum computing at a basic level. I would very much appreciate someone will take a look at the statement below and fix it, since I assume it needs fixing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;“Problems to be solved by a quantum computer can be programmed by creating a set of qubit input registers and connecting them to a set of output registers through an assemblage of quantum logic gates that define the problem to be solved or computation to be done. When the computation is started the qubits traverse the logic gates according to the laws of quantum mechanics, not giving the same result measurement every time, but after a sufficient number of cases have been run and measured (no trivial matter) the answer is contained in the measurements. That method, connecting the input bits to the output bits so as to provide the solution, is suitable only for trivial problems. In practice, a considerable amount of classical programming must be done to set the input qubits in such a way that the quantum machine that is configured as required for the problem can process the qubits using their quantum mechanical properties. A typical problem requires that considerable classical manipulation of the output is required also.”&lt;/p&gt;&#xA;" OwnerUserId="4665" LastActivityDate="2018-09-26T09:28:37.950" Title="Quantum computing concepts" Tags="&lt;models&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4293" PostTypeId="2" ParentId="4292" CreationDate="2018-09-26T00:03:19.083" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Problems to be solved by a quantum computer can be programmed by creating a set of qubit input registers and connecting them to a set of output registers through an assemblage of quantum logic gates that define the problem to be solved or computation to be done.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are always exactly as many input registers (usually just called qubits) as output registers, because quantum computers are reversible computers.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the computation is started the qubits traverse the logic gates according to the laws of quantum mechanics, not giving the same result measurement every time, but after a sufficient number of cases have been run and measured (no trivial matter) the answer is contained in the measurements.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The qubits traversing the logic gates &quot;according to the laws of quantum mechanics&quot; is sort of an odd thing to say; I mean pedantically, everything everywhere happens according to the laws of quantum mechanics, but here it might be better to just say something like &quot;the qubits are sent through the circuit and the logic gates are applied to them&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It isn't necessarily the case that quantum algorithms must be run more than once. Deterministic quantum algorithms exist which give the correct answer every time, assuming no errors.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That method, connecting the input bits to the output bits so as to provide the solution, is suitable only for trivial problems. In practice, a considerable amount of classical programming must be done to set the input qubits in such a way that the quantum machine that is configured as required for the problem can process the qubits using their quantum mechanical properties. A typical problem requires that considerable classical manipulation of the output is required also.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't think this is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be interested in a quantum computing video I've made aimed at computer scientists &amp;amp; software engineers (&lt;a href=&quot;https://www.youtube.com/watch?v=F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;) which will answer many of your questions as to the nature of quantum computation.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-09-26T00:03:19.083" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4294" PostTypeId="2" ParentId="4289" CreationDate="2018-09-26T07:50:33.437" Score="4" Body="&lt;p&gt;Collective measurements &lt;em&gt;are&lt;/em&gt; normal measurements. You just need to be clear on the setting under which they are operating. I haven't delved deeply into the specific paper you mention (so it's always possible they make marginally different assumptions), but I expect it goes like this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You are looking at using many copies of the same channel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Encoding will, generically, be an entangled state across the inputs for a quantum-quantum channel. In this case of a classical-quantum channel, the inputs are classical bits, so the inputs can be correlated but not entangled.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Decoding will, generically, involve measurement of all outputs of the channel simultaneously, in an entangled basis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is these measurements across multiple outputs in an entangled basis that are referred to as collective measurements, in comparison to single-system measurements on the outputs of individual channels. In comparison to measurements on the outputs of the individual channels, these collective measurements first involve an entangling unitary between all the outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I said &quot;generically&quot; in the sense that this is the most general case that you should consider. One might hope that the optimum measurement might be simpler than that, e.g. measurements performed on individual channel outputs. Presumably one of the points this paper is making is that this is not the case in their specific setting.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-09-26T08:13:14.483" LastActivityDate="2018-09-26T08:13:14.483" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4295" PostTypeId="2" ParentId="4292" CreationDate="2018-09-26T09:28:37.950" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Problems to be solved by a quantum computer can be programmed by&#xA;  creating a set of qubit input registers and connecting them to a set&#xA;  of output registers through an assemblage of quantum logic gates that&#xA;  define the problem to be solved or computation to be done.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is certainly one way to do it, based on the quantum circuit model. There are various &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/74/1837&quot;&gt;alternatives&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When the computation is started the qubits traverse the logic gates&#xA;  according to the laws of quantum mechanics, not giving the same result&#xA;  measurement every time, but after a sufficient number of cases have&#xA;  been run and measured (no trivial matter) the answer is contained in&#xA;  the measurements&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Depending on the physical implementation, the qubits themselves may not actually move. They might, or they might sit in the same place and have the quantum gates applied to them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;If&lt;/em&gt; you measured the qubits in the middle of a computation, they would give different (intermediate) answers every time. But, you &lt;em&gt;must not&lt;/em&gt; measure qubits in the middle (unless the algorithm specifically tells you to), as that destroys the quantumness of the computation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;but after a sufficient number of cases have been run and measured (no trivial matter) the answer is contained in the measurements&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is not usually the case. The key to designing good quantum algorithms is that, at the &lt;em&gt;end&lt;/em&gt; of the computation, you get the right answer with high probability. In examples such as Grover's algorithm, the probability of error is vanishingly small. So, in practice, you only have to run the algorithm a small number of times, often only once.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In practice, a considerable amount of classical programming must be&#xA;  done to set the input qubits in such a way that the quantum machine&#xA;  that is configured as required for the problem can process the qubits&#xA;  using their quantum mechanical properties. A typical problem requires&#xA;  that considerable classical manipulation of the output is required&#xA;  also.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could think about it like that, and that is certainly the way that Shor's algorithm is typically described, for example, using some classical post-processing such as the continued fractions algorithm. Perhaps a better way of thinking about it is that the entire problem could be solved on a quantum computer, specified by a single, unified, algorithm. However, because quantum computers are trickier to build and run than classical computers, if some parts of the algorithm can be performed on a classical computer, it's easier to do so, and we only run the bit that needs quantum processing on the quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-26T09:28:37.950" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4296" PostTypeId="2" ParentId="4278" CreationDate="2018-09-26T14:07:11.477" Score="1" Body="&lt;p&gt;Just install by using pip package &#xA;pip3 install qiskit &#xA;You can find the pip3.exe under the python installation.&lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2018-09-26T14:07:11.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4298" PostTypeId="1" CreationDate="2018-09-26T14:35:47.727" Score="5" ViewCount="325" Body="&lt;p&gt;I have an algorithm that uses QRAM, after accessing the given QRAM that store M d-dimensional classical vectors, the state of the index register and the data register become entangled. But for now I don't have the QRAM black box, I just initialize the state of both systems by providing an array value to the registers at once using initialize function that exists in the qiskit module. &#xA;My question is I have assigned the value 0 for non-visible basis. Is that ok?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="1782" LastEditDate="2018-09-27T22:42:29.070" LastActivityDate="2018-09-27T22:42:29.070" Title="Entanglement state preparation by using amplitude values" Tags="&lt;entanglement&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4299" PostTypeId="1" AcceptedAnswerId="4300" CreationDate="2018-09-26T19:09:05.833" Score="8" ViewCount="125" Body="&lt;p&gt;Say you have &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits, namely &lt;span class=&quot;math-container&quot;&gt;$q_1, q_2$&lt;/span&gt;.  What's the right language for saying apply CNOT on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is the control qubit and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is the target?&lt;/p&gt;&#xA;&lt;p&gt;For instance, can I say &amp;quot;apply CNOT on &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; controlled by &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;&amp;quot;?  What's the standard way of saying that?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="2927" LastEditDate="2021-01-23T00:01:43.340" LastActivityDate="2021-01-23T00:01:43.340" Title="How to say &quot;apply CNOT on qubit 1 controlled by qubit 2&quot;?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4300" PostTypeId="2" ParentId="4299" CreationDate="2018-09-26T22:18:43.530" Score="5" Body="&lt;p&gt;The most common convention is to refer to qbits by the index of their significance, with the least-significant qbit having index $0$. This is cribbed from binary, where the significance index is the same as the exponent in the sum of powers of two:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;$1011=1 \cdot 2^3 + 0 \cdot 2^2 + 1 \cdot 2^1 + 1 \cdot 2^0$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for the system $|abc\rangle = a \otimes b \otimes c$, you'd say $a$ is qbit $2$, $b$ qbit $1$, and $c$ qbit $0$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT is usually denoted $C_{c,t}$ (or $CX_{c,t}$ or even $CNOT_{c,t}$) where $c$ is the index of the control qbit and $t$ is the index of the target qbit. So a CNOT gate with the most-signifigant qbit of a three-qbit system as control and least-significant qbit as target is denoted $C_{2,0}$, or just $C_{20}$ when there are ten or fewer qbits so the comma is unnecessary. Applying this operator to your system is written as $C_{20}|abc\rangle$.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This convention is outlined in detail in section 1.4, pages 10-11 of &lt;em&gt;Quantum Computer Science: An Introduction&lt;/em&gt; by N. David Mermin.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For plain-language phrasing, something like &quot;apply CNOT with qbit $x$ as control, $y$ as target&quot; or even just &quot;apply CNOT-$x$-$y$&quot; (if spoken) works fine.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-09-26T22:34:46.980" LastActivityDate="2018-09-26T22:34:46.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4301" PostTypeId="1" CreationDate="2018-09-27T08:13:30.127" Score="5" ViewCount="177" Body="&lt;p&gt;In a previous question I asked how stationary bits could be processed by logic gates. I casually mentioned that I could visualize qubits traversing stationary logic gates, and @DaftWullie said “It might help if you explain how you're visualising the flying qubit”, and I said to myself “Oops, I probably don’t have that right at at all!”. I simply visualize Bloch spheres moving in some constrained way from gate to gate, changing their vector angle according to the logic of the gate, with communication between the gates as programmed (like IBM Q makes it appear). If you can correct that image, maybe it would help me understand how stationary qubits (with moving gates?) work as well.&lt;/p&gt;&#xA;" OwnerUserId="4665" LastActivityDate="2018-09-27T11:04:43.137" Title="Flying qubits compared with stationary qubits" Tags="&lt;programming&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4302" PostTypeId="2" ParentId="4301" CreationDate="2018-09-27T11:04:43.137" Score="4" Body="&lt;p&gt;Bloch spheres are a reasonable visualisation of individual qubits, so long as you don't fall in to the trap of thinking that's what they actually, &lt;em&gt;physically&lt;/em&gt; look like. It's just a convenient mathematical mapping from a parametrisation of the state into a pretty picture. And it doesn't work so well once entanglement between multiple qubits comes into play.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you are thinking about Bloch spheres, one can then think about what a single qubit unitary is and does. The unitary basically defines an axis through the sphere, and an angle of rotation.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XIYe1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XIYe1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;For any given state, and a fixed axis, there's basically an orbit that the state could map to (because unitaries preserve inner product, so the angle between the state and the axis must remain fixed), and the angle is just how far around that orbit the state is moved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how might you think about physically implementing this. You need some sort of apparatus that fixes what the direction of the axis &lt;em&gt;is&lt;/em&gt;. This is usually some sort of electro-magnetic field. The angle of rotation is essentially determined by how long the qubit is in that field. For flying qubits, you can therefore think about setting up a region of a particular size in which this field is active. If you know how fast your qubit is travelling, you know how long it's in the field for, and that determines its angle of rotation (up to caveats about Heisenberg uncertainty principle). But equally, you could just have the qubit sitting in one place, and simply switch on the field for the right length of time. Indeed, these two solutions are practically the same. Just think about your flying qubit situation from the reference frame of the qubit. In that frame, the qubit is stationary, and it is the field that moves towards it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of something slightly more concrete and physical for the stationary qubits, the direction of the axis of the unitary can often be determined by a couple of lasers. So, you have a couple of lasers that can be shined at each qubit, and you just switch them on and off at the right moments in time, with the correct relative strengths.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-09-27T11:04:43.137" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4303" PostTypeId="2" ParentId="4298" CreationDate="2018-09-27T12:16:14.380" Score="2" Body="&lt;p&gt;If you are talking about the qRAM for encoding real numbers in amplitudes of a quantum system yes. Basically, you assume without loss of generalities that your problem/vector is of size a power of 2. But if your problem is not exactly of this type, we just pad with 0s. When you apply a quantum algorithm, you just need to be sure you are doing the computation you want.  &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-27T12:16:14.380" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4304" PostTypeId="1" CreationDate="2018-09-28T01:13:15.160" Score="5" ViewCount="144" Body="&lt;p&gt;I have a HPC (High Performance Computing) cluster with NVIDIA GPU and Xeon CPU partitions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this simulator &lt;a href=&quot;https://quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;list&lt;/a&gt; complete? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which do you recommended to use on a HPC cluster? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will it increase the performance (it has 512GB of memory). &lt;/p&gt;&#xA;" OwnerUserId="914" LastEditorUserId="914" LastEditDate="2018-09-29T14:34:43.377" LastActivityDate="2018-09-29T14:34:43.377" Title="Which QC platform is better to use on HPC cluster?" Tags="&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4305" PostTypeId="2" ParentId="4304" CreationDate="2018-09-28T02:09:31.003" Score="2" Body="&lt;p&gt;You will find on this website most of them (not commercial ones I think).&#xA;The choice is all yours and you have to get to know the tools depending on what kind of simulation you want to do. For example if you are going to work on universal quantum computing, write algorithms from scratch or using already available implementations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum++ seems to be a nice library with the use of openMP so that could be something suited for a HPC cluster. With GPUs, look for something integrating openCL like qRack or QCGPU&#xA;For toolkits, Forest, Qiskit and Microsoft quantum developmenent kit based on Q# would be good candidates to look at.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-09-28T02:09:31.003" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4306" PostTypeId="1" AcceptedAnswerId="4310" CreationDate="2018-09-28T14:02:34.607" Score="1" ViewCount="700" Body="&lt;p&gt;I've only recently started using density matrices in my work but I am confused with the following code that I have whether I am getting the right matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def Hamiltonian(alpha,h):&#xA;&#xA;    Sx = np.array([[0,1],[1,0]])&#xA;    Sy = np.array([[0,-1j],[1j,0]])&#xA;    Sz = np.array([[1,0],[0,-1]])&#xA;    I  = np.array([[1,0],[0,1]])&#xA;&#xA;    H =  (alpha*np.kron(np.kron(Sx,Sx),I)) &#xA;    H =+ (alpha*np.kron(np.kron(Sy,Sy),I)) &#xA;    H =+ (alpha*np.kron(np.kron(I,Sx),Sx)) &#xA;    H =+ (alpha*np.kron(np.kron(I,Sy),Sy)) &#xA;    H =+ (h*np.kron(np.kron(I,Sz),I))&#xA;&#xA;    return H&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So the above gives me my Hamiltonian Function, where alpha is a real number and h is a magnetization parameter acting on one of my qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H = Hamiltonian(1,0.5)&#xA;print(H)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;0.5&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0.5&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;-0.5&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;-0.5&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0.5&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0.5&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;-0.5&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;-0.5&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it diagonal?&lt;/p&gt;&#xA;" OwnerUserId="4681" LastEditorUserId="26" LastEditDate="2018-10-07T10:32:21.670" LastActivityDate="2018-10-07T10:32:21.670" Title="Why is this Hamiltonian matrix diagonal?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4307" PostTypeId="1" AcceptedAnswerId="4309" CreationDate="2018-09-28T16:39:58.813" Score="6" ViewCount="452" Body="&lt;p&gt;I'm working through Scott Aaronson's Quantum Information Science problem sets, and I'm having trouble with a specific problem in &lt;a href=&quot;https://www.scottaaronson.com/qclec/ps5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ps5&lt;/a&gt; (PDF). Specifically the following problem:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A “qutrit” has the form &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle+b|1\rangle+c|2\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|a|^2+|b|^2+|c|^2=1$&lt;/span&gt;.  Suppose Alice and Bob share the entangled state &lt;span class=&quot;math-container&quot;&gt;$(|00\rangle+|11\rangle+|22\rangle)/\sqrt 3$&lt;/span&gt;.  Then consider the following protocol for teleporting a qutrit &lt;span class=&quot;math-container&quot;&gt;$|\psi〉=a|0\rangle+b|1\rangle+c|2\rangle$&lt;/span&gt; from Alice to Bob: first Alice applies a CSUM gate from &lt;span class=&quot;math-container&quot;&gt;$|\psi〉$&lt;/span&gt; onto her half of the entangled pair, where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CSUM}(|x\rangle\otimes|y\rangle) =|x\rangle\otimes|y+x \bmod 3\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, Alice applies the unitary matrix &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; register, where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F=\frac{1}{\sqrt{3}}\begin{bmatrix}1&amp;amp;1&amp;amp;1\\1&amp;amp;\omega&amp;amp;\omega^2\\1&amp;amp;\omega^2&amp;amp;\omega^3\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2i\pi/3}$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$\omega^3= 1$&lt;/span&gt;. She then measures both of her qutrits in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle,|2\rangle\}$&lt;/span&gt; basis, and sends the results to Bob over a classical channel. Show that Bob can recover a local copy of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; given these measurement results.&lt;/p&gt;&#xA;&lt;p&gt;This quantum circuit summarizes the protocol:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vbWGt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vbWGt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here the double-lines represent classical ‘trits’ being sent from Alice to Bob.  Depending on the value of 0, 1 or 2 Bob can apply a ? gate 0, 1, or 2 times.  Prove that &lt;span class=&quot;math-container&quot;&gt;$|\psi〉=|\psi_\text{out}\rangle$&lt;/span&gt; for appropriately chosen ? gates for all possible measurement results. &lt;em&gt;Hint:  You could explicitly work out all 9 possible cases,  but you could also save time by noticing a general pattern that lets you handle all the cases in a unified way.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Here's what I've done: after applying the CSUM gate to the mixed state of three qutrits, Alice and Bob share the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp; \frac{a}{\sqrt{3}}(|000 \rangle + |011 \rangle + |022 \rangle) \\&#xA;+ &amp;amp; \frac{b}{\sqrt{3}}(|110 \rangle + |121 \rangle + |102 \rangle) \\&#xA;+ &amp;amp; \frac{c}{\sqrt{3}}(|220 \rangle + |201 \rangle + |212 \rangle)&#xA;\end{align*}&lt;/span&gt;&#xA;After Alice applies &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; to the first qutrit in the shared state, they're left with:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp; \frac{|00 \rangle}{3}(a|0 \rangle + c|1 \rangle + b|2 \rangle)\\&#xA; + &amp;amp; \frac{|01 \rangle}{3}(b|0 \rangle + a|1 \rangle + c|2 \rangle)\\&#xA; + &amp;amp; \frac{|02 \rangle}{3}(c|0 \rangle + b|1 \rangle + a|2 \rangle) \\&#xA; + &amp;amp; \frac{|10 \rangle}{3}(a|0 \rangle + w^2c|1 \rangle + wb|2 \rangle)\\&#xA; + &amp;amp; \frac{|11 \rangle}{3}(wb|0 \rangle + a|1 \rangle + w^2c|2 \rangle)\\&#xA; + &amp;amp; \frac{|12 \rangle}{3}(w^2c|0 \rangle + wb|1 \rangle + a|2 \rangle)\\&#xA; + &amp;amp; \frac{|20 \rangle}{3}(a|0 \rangle + wc|1 \rangle + w^2b|2 \rangle) \\&#xA; + &amp;amp; \frac{|21 \rangle}{3}(w^2b|0 \rangle + a|1 \rangle + wc|2 \rangle) \\&#xA; + &amp;amp; \frac{|22 \rangle}{3}(wc|0 \rangle + w^2b|1 \rangle + a|2 \rangle) \\&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So after Alice measures her qutrits, whatever is inside the parenthesis is the state that Bob holds. However, I don't wee what operations can be used multiple times to &amp;quot;fix&amp;quot; the output.&lt;/p&gt;&#xA;&lt;p&gt;It seems to me that Alice could communicate to Bob with one trit which two coefficients need to be transposed, and use one trit to tell Bob how to fix the remaining &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;'s. That doesn't seem to fit the desired protocol though, making me doubt the computations that I have performed above. If anyone could help me out (or point out a better approach), it would be appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4707" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-11-13T18:37:44.763" Title="Problem about qutrit teleportation protocol" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;qutrit&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4309" PostTypeId="2" ParentId="4307" CreationDate="2018-09-29T16:50:44.140" Score="4" Body="&lt;p&gt;I tested this out in Quirk by embedding each qutrit into two qubits, and I get a simular result to you, where in addition to the cyclic shift fixup and the phasing operation you need to transpose states 1 and 2. Presumably there's some simple change to the circuit that fixes this, such as picking a different F, but I did't check too hard to see if it was possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the circuit (and &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C%22~to7u%22%2C1%2C%7B%22id%22%3A%22setR%22%2C%22arg%22%3A3%7D%5D%2C%5B1%2C1%2C%22%E2%97%A6%22%2C%22H%22%5D%2C%5B1%2C1%2C%22inputA2%22%2C1%2C%22%2BAmodR2%22%5D%2C%5B1%2C1%2C%22Amps4%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22X%5Et%22%5D%2C%5B%22%E2%97%A6%22%2C%22Y%5Et%22%5D%2C%5B%22Amps2%22%5D%2C%5B%5D%2C%5B%22inputA2%22%2C1%2C%22%2BAmodR2%22%5D%2C%5B%22~fad9%22%2C1%2C%22inputA2%22%2C1%2C%22-AmodR2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Swap%22%2C%22Swap%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22~khdv%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22~dl75%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Amps2%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~to7u%22%2C%22name%22%3A%22e%5E2Yi%CF%80%2F3%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%94%2C-%E2%88%9A%E2%85%93%7D%2C%7B%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%94%7D%7D%22%7D%2C%7B%22id%22%3A%22~fad9%22%2C%22name%22%3A%22F%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%93%2C0%7D%2C%7B%E2%88%9A%E2%85%93%2C-0.2886751%2B%C2%BDi%2C-0.2886751-%C2%BDi%2C0%7D%2C%7B%E2%88%9A%E2%85%93%2C-0.2886751-%C2%BDi%2C-0.2886751%2B%C2%BDi%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~khdv%22%2C%22name%22%3A%22%CF%89%5Ek%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C-0.4999999999999998%2B0.8660254037844387i%2C0%2C0%7D%2C%7B0%2C0%2C-0.5000000000000004-0.8660254037844385i%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~dl75%22%2C%22name%22%3A%22%CF%89%5E2k%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C-0.5000000000000004-0.8660254037844385i%2C0%2C0%7D%2C%7B0%2C0%2C-0.4999999999999998%2B0.8660254037844387i%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the simulator itself&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C%22~to7u%22%2C1%2C%7B%22id%22%3A%22setR%22%2C%22arg%22%3A3%7D%5D%2C%5B1%2C1%2C%22%E2%97%A6%22%2C%22H%22%5D%2C%5B1%2C1%2C%22inputA2%22%2C1%2C%22%2BAmodR2%22%5D%2C%5B1%2C1%2C%22Amps4%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22X%5Et%22%5D%2C%5B%22%E2%97%A6%22%2C%22Y%5Et%22%5D%2C%5B%22Amps2%22%5D%2C%5B%5D%2C%5B%22inputA2%22%2C1%2C%22%2BAmodR2%22%5D%2C%5B%22~fad9%22%2C1%2C%22inputA2%22%2C1%2C%22-AmodR2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Swap%22%2C%22Swap%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22~khdv%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22~dl75%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Amps2%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~to7u%22%2C%22name%22%3A%22e%5E2Yi%CF%80%2F3%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%94%2C-%E2%88%9A%E2%85%93%7D%2C%7B%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%94%7D%7D%22%7D%2C%7B%22id%22%3A%22~fad9%22%2C%22name%22%3A%22F%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%93%2C0%7D%2C%7B%E2%88%9A%E2%85%93%2C-0.2886751%2B%C2%BDi%2C-0.2886751-%C2%BDi%2C0%7D%2C%7B%E2%88%9A%E2%85%93%2C-0.2886751-%C2%BDi%2C-0.2886751%2B%C2%BDi%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~khdv%22%2C%22name%22%3A%22%CF%89%5Ek%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C-0.4999999999999998%2B0.8660254037844387i%2C0%2C0%7D%2C%7B0%2C0%2C-0.5000000000000004-0.8660254037844385i%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~dl75%22%2C%22name%22%3A%22%CF%89%5E2k%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C-0.5000000000000004-0.8660254037844385i%2C0%2C0%7D%2C%7B0%2C0%2C-0.4999999999999998%2B0.8660254037844387i%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PaceC.png&quot; alt=&quot;trit teleportation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've put displays throughout the circuit to have a better idea that it's working. In the bottom left area the blue rectangle with the three circles along its diagonal is showing that, yes, we're in the 00+11+22 state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the top middle I'm preparing some state to teleport. It doesn't really matter what it is, so I used gates that keep changing what they're doing. The important bit is that the blue rectangle here looks the same as the one in the bottom right, indicating the state moved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the bottom right you can see the fixups being applied. The cyclic shift (-A mod 3), the mystery transpose (implemented by the swap), and then the phasing operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't include the measurements, but if you add some before the controls in the top right and just before the Input A of the -A mod R operation the circuit will behave identically.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-09-29T16:50:44.140" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4310" PostTypeId="2" ParentId="4306" CreationDate="2018-09-30T00:02:46.157" Score="2" Body="&lt;p&gt;Your matrix is diagonal because the + signs are on the wrong sides of the equals signs. The code below will give you the correct matrix:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha=1;h=0.5;&#xA;&#xA;x=[0  1;  1 0 ];&#xA;y=[0 -1i; 1i 0];&#xA;z=[1  0;  0 -1];&#xA;I=eye(2);&#xA;&#xA;H = alpha*kron(kron(x,x),I)+...&#xA;    alpha*kron(kron(y,y),I)+...&#xA;    alpha*kron(kron(I,x),x)+...&#xA;    alpha*kron(kron(I,y),y)+...&#xA;    h*kron(kron(I,z),I)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1lka8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1lka8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eigenvectors and eigenvlaues are much more complicated than what you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have Octave, these commands will install it, then open it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install octave&#xA;octave&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-09-30T10:17:50.053" LastActivityDate="2018-09-30T10:17:50.053" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4311" PostTypeId="1" AcceptedAnswerId="4312" CreationDate="2018-09-30T11:19:03.090" Score="2" ViewCount="1748" Body="&lt;p&gt;I have a Hamiltonian and I want to know the corresponding density matrix. The matrix I'm interested in is the one in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4306/why-is-this-hamiltonian-matrix-diaongal/&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4681" LastEditorUserId="26" LastEditDate="2018-10-07T10:31:49.903" LastActivityDate="2018-10-07T10:31:49.903" Title="How do I construct a Density Matrix corresponding to a Hamiltonian?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;density-matrix&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4312" PostTypeId="2" ParentId="4311" CreationDate="2018-09-30T11:44:39.797" Score="2" Body="&lt;p&gt;There's many different density matrices that can correspond to a given Hamiltonian. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the 8x8 matrix in your question, there's 8 different &quot;eigenstate&quot; density matrices that can be obtained, one for each of the 8 eigenvectors. The density matrices are constructed by doing the outer product of the eigenvectors. For the &lt;span class=&quot;math-container&quot;&gt;$i^{\rm{th}}$&lt;/span&gt; eigenstate of the Hamiltonian, the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\rho_i = |\psi_i\rangle_ \langle \psi_i|&#xA;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A system can also be in a &quot;pure&quot; superposition of eigenstates, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \frac{1}{\sqrt{2}}|\psi_1\rangle + \frac{1}{\sqrt{2}}|\psi_2\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the density matrix is once again made by doing the outer product of the pure wave function &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with itself.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A system can also be in a &quot;mixed&quot; state, which means it's a linear combination of &quot;pure&quot; states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case you would construct the density matrix like this (for example):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = 0.5 \rho_1 + 0.5\rho_2$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which descrbes a state which is a 50% mixture of &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; and a 50% mixture of &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-09-30T20:03:25.687" LastActivityDate="2018-09-30T20:03:25.687" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4313" PostTypeId="1" AcceptedAnswerId="4319" CreationDate="2018-09-30T13:08:49.243" Score="5" ViewCount="143" Body="&lt;p&gt;I am working with the set &lt;span class=&quot;math-container&quot;&gt;$\{\mathrm{CNOT}, \mathrm{H}, \mathrm{P}(\theta)\}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}$&lt;/span&gt; is the Hadamard gate, and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}(\theta)$&lt;/span&gt; is the phase gate with angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to build other gates with these gates, like &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt;, Control-&lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt;, or Control-&lt;span class=&quot;math-container&quot;&gt;$P(\theta)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="4725" LastEditorUserId="2293" LastEditDate="2018-09-30T20:29:01.913" LastActivityDate="2018-10-01T07:08:56.977" Title="How can I decompose a gate into $\{\mathrm{CNOT}, \mathrm{H}, \mathrm{P}(\theta)\}$?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4314" PostTypeId="1" CreationDate="2018-09-30T23:33:02.013" Score="6" ViewCount="241" Body="&lt;p&gt;D-Wave has a new prototype annealer that uses a Hamiltonian which, if there was enough qubits and sufficient control, would be able to simulate any universal circuit-based quantum computer with at most polynomial overhead. It was presented at the AQC 2018 conference at NASA:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KXeff.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KXeff.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hamiltonian on the slide contains both a ZZ term and a YY term.&#xA;Using the YY gadget of Section VI of &lt;a href=&quot;http://link.aps.org/pdf/10.1103/PhysRevA.91.012315&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, the Hamiltonian becomes the classic ZZ + XX Hamiltonian, which is &lt;a href=&quot;https://arxiv.org/abs/0704.1287&quot; rel=&quot;nofollow noreferrer&quot;&gt;well known to be universal&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One issue with this design though, is that the YY term is part of the driver, not part of the problem Hamiltonian. Therefore the coefficient of the YY term has to change simultaneously with the linear X term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am not an expert in superconducting circuits, I wonder why the YY term, which makes it possible for the machine to do universal quantum computation, cannot change with the problem Hamiltonian, instead of the driving Hamiltonian?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-10T21:48:21.293" LastActivityDate="2018-10-10T21:48:21.293" Title="In D-Wave's universal quantum computer, why does the YY term have to be driven along with the linear X term?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;d-wave&gt;&lt;superconducting-quantum-computing&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4315" PostTypeId="2" ParentId="1674" CreationDate="2018-09-30T23:42:07.273" Score="2" Body="&lt;p&gt;In the accepted answer, it is said that XX couplers are &quot;necessary&quot;. &lt;br&gt;&#xA;However YY couplers would also do the job. This is because of te YY gadget explained in section VI of &lt;a href=&quot;http://link.aps.org/pdf/10.1103/PhysRevA.91.012315&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually even the original &lt;a href=&quot;https://arxiv.org/abs/0704.1287&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; given in the accepted answer, says that XZ would also be good enough (not just XX). For that reason, YZ should also be good enough, although no one has explicitly constructed the gadget yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Out of all four of these options (XX, YY, XZ, YZ) for added couplers that would make D-Wave's machines universal, one of them has already been implemented in hardware by D-Wave: the YY coupler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was presented at the AQC conference in 2018:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E0jij.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E0jij.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However there are some restrictions on the control of these YY terms, and the physical reason for this is the subject of my question here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4314/in-d-waves-universal-quantum-computer-why-does-the-yy-term-have-to-be-driven-a&quot;&gt;In D-Wave&amp;#39;s universal quantum computer, why does the YY term have to be driven along with the linear X term?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-09-30T23:42:07.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4316" PostTypeId="1" AcceptedAnswerId="4317" CreationDate="2018-10-01T01:00:52.683" Score="2" ViewCount="320" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The standard way to implement a reversible XOR gate is by means of a controlled-NOT gate or CNOT; this is the &quot;standard quantum XOR operation&quot;. &lt;a href=&quot;https://physics.stackexchange.com/a/72001/198219&quot;&gt;Physics.Stackexchange&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there a &quot;standard quantum &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2333/quantum-xnor-gate-construction&quot;&gt;XNOR&lt;/a&gt; operation&quot;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The XNOR gate (sometimes ENOR, EXNOR or NXOR and pronounced as Exclusive NOR) is a digital logic gate whose function is the logical complement of the exclusive OR (XOR) gate. &lt;a href=&quot;https://en.wikipedia.org/wiki/XNOR_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Alternatively, what is the logical complement of the CNOT gate&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-10-01T01:21:31.117" LastActivityDate="2018-10-01T01:21:31.117" Title="What quantum gate is XNOR equivalent to?" Tags="&lt;gate-synthesis&gt;&lt;universal-gates&gt;&lt;quantum-gate&gt;&lt;foundations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4317" PostTypeId="2" ParentId="4316" CreationDate="2018-10-01T01:14:47.083" Score="4" Body="&lt;p&gt;There is no &quot;standard&quot; method to implement XNOR, but it can be logically obtained by attaching a NOT gate (often called an X gate in quantum computing) to a logical XOR (which you know is implemented using CNOT). The X gate is applied to the target qubit of the CNOT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your question more directly, there is no standard &quot;quantum gate&quot; that is equivalent to XNOR. The best way to implement XNOR in a quantum circuit is with a CNOT and an X on the second qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why {CNOT,X} can give you a logical XNOR was explained in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2335/2293&quot;&gt;this&lt;/a&gt; answer to your own question 3.5 months ago.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-01T01:20:53.053" LastActivityDate="2018-10-01T01:20:53.053" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4318" PostTypeId="2" ParentId="4311" CreationDate="2018-10-01T06:51:27.587" Score="8" Body="&lt;p&gt;Your question remains very unclear as to what it actually is that you want to calculate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no direct correspondence between a system Hamiltonian and the quantum state of the system. No matter what the Hamiltonian, any quantum state is a valid state of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where a Hamiltonian comes in useful is, if you know the state at some time (say, &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt;), you can find out what the state is at any later time via the Schroedinger equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\frac{\partial |\psi\rangle}{\partial t}=H(t)|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; does not change in time, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi(t)\rangle=e^{-iHt}|\psi(0)\rangle&#xA;$$&lt;/span&gt;&#xA;or, if your initial state is a mixed state,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho(t)=e^{-iHt}\rho(0)e^{iHt}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, there are two reasonable things that &lt;em&gt;might&lt;/em&gt; be relevant in terms of a state derived from a Hamiltonian - the thermal state and the ground state (which is the thermal state at 0 temperature). At temperature &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, the thermal state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{\text{thermal}}=\frac{e^{-H/(k_BT)}}{\text{Tr}(e^{-H/(k_BT)})},&#xA;$$&lt;/span&gt;&#xA;while the ground state is simply the eigenstate of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; with the smallest energy. You can (crudely) think of the thermal state as the best guess about what the state would be if you cooled it to a temperature &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In one of the comments on another answer, you say&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I need it to get the purity of my qubit states and the internal energy&#xA;  of the system vs. the magnetisation factor h&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Purity has nothing to do with the Hamiltonian. If you know the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of your system, purity is just &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)$&lt;/span&gt;. The Hamiltonian will help you with the expected internal energy: &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho H)$&lt;/span&gt; but, again, the state has to be provided from elsewhere, not from the Hamiltonian.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-01T09:19:33.287" LastActivityDate="2018-10-01T09:19:33.287" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="4319" PostTypeId="2" ParentId="4313" CreationDate="2018-10-01T07:08:56.977" Score="4" Body="&lt;p&gt;In your question, you don't define &lt;span class=&quot;math-container&quot;&gt;$P(\theta)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt;. I'm going to assume:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(\theta)=\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\theta} \end{array}\right)\qquad R_z(\theta)=\left(\begin{array}e^{-i\theta} &amp;amp; 0 \\ 0 &amp;amp; e^{i\theta} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;In this case, you simply have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_z(\theta)=P(2\theta)e^{-i\theta}\equiv P(2\theta),&#xA;$$&lt;/span&gt;&#xA;the point being that global phases are irrelevant. However, the difference is important when you look at the controlled-gates. Let's say we can create either controlled-&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; or controlled-&lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;. We can create the other via the identity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YcRbz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YcRbz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The extra &lt;span class=&quot;math-container&quot;&gt;$P(-\theta)$&lt;/span&gt; is the gate that compensates for the extra phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make controlled-&lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;, the trick is to notice the identities &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta_1)R_z(\theta_2)=R_z(\theta_1+\theta_2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$XR_z(\theta)X=R_z(-\theta)$&lt;/span&gt;, where we will replace the Xs by controlled-not so that the change in rotation angle only happens if the control qubit is 1. Hence, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pBhBM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pBhBM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-01T07:08:56.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4320" PostTypeId="1" AcceptedAnswerId="4321" CreationDate="2018-10-01T11:50:49.723" Score="5" ViewCount="1378" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\q}[2]{\langle #1 | #2 \rangle}$&lt;/span&gt;&#xA;I know from linear algebra that the inner product of two vectors is 0 if the vectors are orthogonal.  I also know the inner product is positive if the vectors more or less point in the same direction and I know it's negative if the vectors more or less point in opposite directions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the same inner product as in &lt;span class=&quot;math-container&quot;&gt;$\q{x}{y}$&lt;/span&gt;, right?  Can you show an example of the inner product being useful in a quantum algorithm?  The simplest the better.  It doesn't have to be a useful algorithm.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="55" LastEditDate="2021-04-22T23:07:41.573" LastActivityDate="2021-04-22T23:07:41.573" Title="What's an use case of the inner product between two qubits in a quantum algorithm?" Tags="&lt;algorithm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4321" PostTypeId="2" ParentId="4320" CreationDate="2018-10-01T12:30:34.573" Score="9" Body="&lt;p&gt;The absolute value of the inner product between two (pure) states &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi\rvert\phi\rangle\rvert$&lt;/span&gt;, can be used to quantify the &lt;em&gt;distance&lt;/em&gt; between the two states, and is commonly referred to as &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;noreferrer&quot;&gt;fidelity&lt;/a&gt; (though the fidelity is often defined as the &lt;em&gt;square&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi\rvert\phi\rangle\rvert$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the current state is &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; is a possible outcome of a measurement, then &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi\rvert\phi\rangle\rvert^2$&lt;/span&gt; is the probability of getting the outcome &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;.&#xA;More generally, &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi\rvert\phi\rangle\rvert^2$&lt;/span&gt; can be thought of as a measure of &lt;em&gt;indistinguishability&lt;/em&gt; of the two states. This quantity will thus be important every time one wants to figure out what is the current state of the system, as a high fidelity implies that a lot of measurements are necessary to tell the two states apart.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a quantum algorithm computing this quantity is the C-SWAP test, which &lt;em&gt;I think&lt;/em&gt; was introduced in (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102001&quot; rel=&quot;noreferrer&quot;&gt;Buhrman et al. 2001&lt;/a&gt;). One usage of this algorithm that comes to mind is given in (&lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;noreferrer&quot;&gt;LLoyd et al. 2013&lt;/a&gt;), where they use it as a subroutine for their supervised cluster assignment algorithm (see end of pag. 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, the inner product between two states is their overlap, which is such a fundamental quantity in quantum mechanics that it is hard to say how it can &lt;em&gt;not&lt;/em&gt; be &quot;useful&quot; for any kind of protocol.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-10-01T12:30:34.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4322" PostTypeId="2" ParentId="4320" CreationDate="2018-10-01T13:37:56.500" Score="1" Body="&lt;p&gt;If you want to estimate the inner product of two quantum states, use three quantum registers. The first one stores one qubit, the other two registers contains n qubits where n is used to store the value of the two states separetely. Next apply hadamard gate to the first register. Then by using controll swap gate which accepts three inputs, pass the three registers through this gate (where the first register act as a controller). Finally apply a hadamard gate to the first register qubit again and measure the first register alone. If the measurment result is 0.5 being in the ground state i.e. the two states are orthogonal. Unless the more the probability of the ancilla qubit (the first register) being in zero tends to 1, the two states are simillar. &lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2018-10-01T16:56:27.757" LastActivityDate="2018-10-01T16:56:27.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4323" PostTypeId="2" ParentId="4320" CreationDate="2018-10-01T13:43:20.833" Score="1" Body="&lt;p&gt;There is also an algorithm denoted in this &lt;a href=&quot;https://arxiv.org/abs/1804.10068&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; denoted by DistCalc and it enables you to compute the Euclidian distance between two real vectors &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; based on the computation of the inner product between two quantum states created from &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say your vectors &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; have a dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; which can be expressed as a power of 2 without loss of generalities, then you can compute this distance with a complexity of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log N)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="45" LastEditDate="2018-10-01T16:54:39.863" LastActivityDate="2018-10-01T16:54:39.863" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4324" PostTypeId="1" CreationDate="2018-10-01T20:56:35.623" Score="3" ViewCount="529" Body="&lt;p&gt;I am just getting started with Qiskit and IBM Quantum Experience, so please forgive my newby question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a IBM Quantum Experience account and I generated an API token.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used the generated token in the following tiny Python3 program:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;QX_CONFIG = {&#xA;  &quot;APItoken&quot;: &quot;&amp;lt;my-token-here&amp;gt;&quot;,&#xA;  &quot;url&quot;:&quot;https://quantumexperience.ng.bluemix.net/api&quot;}&#xA;qiskit.register(QX_CONFIG['APItoken'], QX_CONFIG['url'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I run this program qiskit.register throws the following exception:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Exception has occurred: qiskit._qiskiterror.QISKitError&#xA;&quot;Couldn't instantiate provider! Error: Couldn't connect to IBMQuantumExperience server: error during login: HTTPSConnectionPool(host='quantumexperience.ng.bluemix.net', port=443): Max retries exceeded with url: /api/users/loginWithToken (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:645)'),))&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The API endpoint is reachable:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ curl https://quantumexperience.ng.bluemix.net/api&#xA;&#xA;{&quot;error&quot;:{&quot;status&quot;:400,&quot;message&quot;:&quot;Generic error&quot;,&quot;code&quot;:&quot;GENERIC_ERROR&quot;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions on how to fix this issue?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;api = IBMQuantumExperience(QX_API_TOKEN)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;generates the same exception&lt;/p&gt;&#xA;" OwnerUserId="4733" LastEditorUserId="26" LastEditDate="2019-03-12T09:21:15.597" LastActivityDate="2019-03-12T09:21:15.597" Title="Qiskit Python program cannot connect to QE API" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4325" PostTypeId="1" AcceptedAnswerId="4327" CreationDate="2018-10-02T04:49:16.060" Score="2" ViewCount="180" Body="&lt;p&gt;How can one show that measuring the second qubit of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is the same as measuring the second qubit after applying &lt;span class=&quot;math-container&quot;&gt;$U \otimes I$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that &lt;span class=&quot;math-container&quot;&gt;$\psi = \Sigma_{ij} a_{ij}|i⟩|j⟩$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(U \otimes I)|\psi⟩ = \Sigma_{ij}a_{ij}U|i⟩ \otimes |j⟩$&lt;/span&gt;, but I'm not sure what to do next&lt;/p&gt;&#xA;" OwnerUserId="4728" LastEditorUserId="26" LastEditDate="2018-12-23T12:45:16.863" LastActivityDate="2020-04-16T13:03:05.627" Title="Let $\psi$ be a two-qubit state, $U \in \mathbb{C}^{2\times2}$ be a single-qubit unitary. Measure second qubit after applying U to the first qubit?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4326" PostTypeId="1" CreationDate="2018-10-02T06:15:37.470" Score="4" ViewCount="313" Body="&lt;p&gt;Let's assume we developed a hashcat-like programs for quantum computer. How many qubits we need to find the correct hash (WPA, MD5,...) from a 10 characters password make from upper, lower &amp;amp; numeric characters (about 604,661,760,000,000,000 combinations)&lt;/p&gt;&#xA;" OwnerUserId="4182" LastActivityDate="2018-10-02T16:51:56.043" Title="How many qubits does it take to break a 10 characters password?" Tags="&lt;cryptography&gt;&lt;grovers-algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4327" PostTypeId="2" ParentId="4325" CreationDate="2018-10-02T06:42:43.627" Score="3" Body="&lt;p&gt;There are a couple of different technical tools that one could use. Perhaps the simplest is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's describe the measurement that you want to perform on qubit 2 by a set of projectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_i=I\otimes \sigma_i,&#xA;$$&lt;/span&gt;&#xA;where I've just written that to emphasise the structure that the measurement is on qubit 2. What is the probability, &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, of getting result &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_i=\langle\psi|P_i|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;If, instead, you'd applied &lt;span class=&quot;math-container&quot;&gt;$U\otimes I $&lt;/span&gt; first, then you'd be calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_i'&amp;amp;=\langle\psi|U^\dagger\otimes I P_iU\otimes I |\psi\rangle \\&#xA;&amp;amp;=\langle\psi|(U^\dagger U)\otimes\sigma_i|\psi\rangle \\&#xA;&amp;amp;=\langle\psi| I \otimes\sigma_i|\psi\rangle \\&#xA;&amp;amp;=\langle\psi|P_i|\psi\rangle \\&#xA;&amp;amp;=p_i&#xA;\end{align}&lt;/span&gt;&#xA;Hence, the probabilities are unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to do this is using the partial trace. Everything that can be determined just from the second qubit is described by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_2=\text{Tr}_1|\psi\rangle\langle\psi|.&#xA;$$&lt;/span&gt;&#xA;Basically, what you do is sum over any orthonormal basis on the first qubit,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_2=\sum_i\left(\langle i|\otimes I \right)\rho\left(|i\rangle\otimes I \right)&#xA;$$&lt;/span&gt;&#xA;where I've written &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;. Now, if I introduce the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we'd be calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_2'=\sum_i\left(\langle i|\otimes I \right)U\otimes I \rho U^\dagger\otimes I\left(|i\rangle\otimes I \right).&#xA;$$&lt;/span&gt;&#xA;The trick here, is to change which orthonormal basis you're summing over. You can use &lt;span class=&quot;math-container&quot;&gt;$|\eta_i\rangle=U|i\rangle$&lt;/span&gt; instead, so that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho_2'&amp;amp;=\sum_i \left( \langle \eta_i| \otimes I \right) (U\otimes I)\rho (U^\dagger\otimes I) \left(|\eta_i\rangle\otimes I \right). \\&#xA;&amp;amp;=\sum_i\left(\langle i|\otimes I \right)\rho \left(|i\rangle\otimes I\right). \\&#xA;&amp;amp;=\rho_2.&#xA;\end{align}&lt;/span&gt;&#xA;This shows the stronger result that everything that can be learnt or done to just qubit 2, without knowledge of qubit 1, is independent of the unitary applied to qubit 1.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="11709" LastEditDate="2020-04-16T13:03:05.627" LastActivityDate="2020-04-16T13:03:05.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4328" PostTypeId="2" ParentId="4326" CreationDate="2018-10-02T14:15:05.853" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\log_2 604,661,760,000,000,000 \approx 59.07&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So use &lt;span class=&quot;math-container&quot;&gt;$60$&lt;/span&gt; qubits for the data lines where you will put a uniform superposition. This gives a total of &lt;span class=&quot;math-container&quot;&gt;$61$&lt;/span&gt; qubits to run Grover's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2^{59} = 5.764607523034e+17$&lt;/span&gt; so if you can throw away about &lt;span class=&quot;math-container&quot;&gt;$2.8e+16$&lt;/span&gt; possibilities first, you would be able to do it &lt;span class=&quot;math-container&quot;&gt;$60$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: As cautioned this is for logical qubits.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2018-10-02T16:51:56.043" LastActivityDate="2018-10-02T16:51:56.043" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4330" PostTypeId="1" AcceptedAnswerId="4337" CreationDate="2018-10-02T16:34:45.597" Score="7" ViewCount="521" Body="&lt;p&gt;I know the inner product has a relationship to the angle between two vectors and I know it can be used to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4320&quot;&gt;quantify the distance&lt;/a&gt; between two vectors.  Similarly, what's an use case for the outer product?  You can exemplify with the simplest case.  It doesn't have to be a useful algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do know the outer product is a matrix and I know how to compute it, but I don't know how and where I'd use it.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="124" LastEditDate="2018-10-03T15:53:31.873" LastActivityDate="2018-10-03T15:53:31.873" Title="When would I consider using an outer product of quantum states, to describe aspects of a quantum algorithm?" Tags="&lt;mathematics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4331" PostTypeId="1" AcceptedAnswerId="4332" CreationDate="2018-10-02T18:43:27.597" Score="5" ViewCount="498" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\q}[2]{\langle #1 | #2 \rangle}&#xA;\newcommand{\qr}[1]{|#1\rangle} &#xA;\newcommand{\ql}[1]{\langle #1|} &#xA;\renewcommand{\v}[2]{\langle #1,#2\rangle}&#xA;\newcommand{\norm}[1]{\left\lVert#1\right\rVert}$&lt;/span&gt;&#xA;Here's an application of the operator &lt;span class=&quot;math-container&quot;&gt;$\qr{\psi}\ql{\phi}$&lt;/span&gt; to the vector &lt;span class=&quot;math-container&quot;&gt;$\qr{x}$&lt;/span&gt;.   One writes &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;(\qr{\psi}\ql{\phi})\qr{x} &amp;amp;= \qr{\psi}(\ql{\phi}\qr{x})\\&#xA;                           &amp;amp;= \qr{\psi}(\q{\phi}{x})\\&#xA;                           &amp;amp;= (\ql{\phi}\phi\qr{x})\qr{\psi}&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last equation totally loses me.  First I don't understand what is the meaning of &lt;span class=&quot;math-container&quot;&gt;$\ql{\phi}\phi\qr{x}$&lt;/span&gt; and I have no idea how it came about (moving &lt;span class=&quot;math-container&quot;&gt;$\qr{\psi}$&lt;/span&gt; to the other end of the expression).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know &lt;span class=&quot;math-container&quot;&gt;$\qr{\psi}\ql{\phi}$&lt;/span&gt; is a matrix and I know how to get the matrix if I have two concrete vectors &lt;span class=&quot;math-container&quot;&gt;$\qr{\psi}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ql{\phi}$&lt;/span&gt;. I also know how to multiply a matrix by a vector, but I don't know how to apply the outer product as in those equations above.  (They seem to be saying something important and I'm missing it.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is found in the very definition of outer product in the nice book by David McMahon: Quantum Computing Explained, ISBN 978-0-470-09699-4.  &lt;a href=&quot;https://files.fm/u/8cqar4fq#/view/outer-product.pdf&quot; rel=&quot;noreferrer&quot;&gt;The two relevant pages, including an example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VYjUS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VYjUS.png&quot; alt=&quot;David McMahon defining outer product.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2018-12-23T11:39:32.697" LastActivityDate="2018-12-23T11:39:32.697" Title="How to apply the outer product operator?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4332" PostTypeId="2" ParentId="4331" CreationDate="2018-10-02T21:53:31.823" Score="3" Body="&lt;p&gt;It is normal you are lost. Indeed that is mathematically incorrect.&#xA;I guess the original idea was to say that the inner product &lt;span class=&quot;math-container&quot;&gt;$ \langle \phi | \chi \rangle $&lt;/span&gt; corresponds just to a coefficient and can be written either at the right or left of &lt;span class=&quot;math-container&quot;&gt;$  | \psi \rangle $&lt;/span&gt;, giving you a proportionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the example 3.1, you see an i appearing from nowhere but it should be a 1. As advised in the comments, use a different book. This one has many bad errors.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-10-02T21:53:31.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4333" PostTypeId="1" AcceptedAnswerId="4334" CreationDate="2018-10-03T01:07:27.773" Score="5" ViewCount="544" Body="&lt;p&gt;Suppose there are 3 parties, of which 2 pairs share an EPR pair and can communicate classically. What is a protocol that results in the third pair sharing an EPR pair?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the problem I'm given, I'm lost on how to do it, let alone what it means to &quot;share an EPR pair&quot; in the end.&lt;/p&gt;&#xA;" OwnerUserId="4728" LastEditorUserId="26" LastEditDate="2018-12-23T12:45:51.713" LastActivityDate="2018-12-23T12:45:51.713" Title="Protocol for entaglement swapping" Tags="&lt;entanglement&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4334" PostTypeId="2" ParentId="4333" CreationDate="2018-10-03T02:14:20.237" Score="7" Body="&lt;p&gt;For two parties to share an EPR pair means that each party has one qubit, and these two qubits together are in state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt; (or one of the other Bell pairs).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entanglement swapping protocol is described, for example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation#Entanglement_swapping&quot; rel=&quot;noreferrer&quot;&gt;in Wikipedia&lt;/a&gt;. It is the same as traditional (I almost wrote &quot;classical&quot; but caught myself in time) quantum teleportation, but applied to qubit in mixed state instead of pure state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Alice has qubit Q1, &lt;/li&gt;&#xA;&lt;li&gt;Bob has qubits Q2 (entangled with Q1) and Q3, &lt;/li&gt;&#xA;&lt;li&gt;and Carol has qubit Q4 (entangled with Q3). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If Bob teleports the state of qubit Q2 to Carol (using up the entanglement of qubits Q3 and Q4 in the process), Carol's qubit Q4 will end up entangled with Alice's qubit Q1.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="1837" LastEditDate="2018-10-03T07:03:46.383" LastActivityDate="2018-10-03T07:03:46.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4335" PostTypeId="2" ParentId="4330" CreationDate="2018-10-03T10:37:51.337" Score="3" Body="&lt;p&gt;The outer product is just a mathematical tool to write matrices, and therefore quantum operations and states. It is &quot;useful&quot; in the same sense that matrices, or more generally linear algebra, are &quot;useful&quot; in quantum mechanics. It is the mathematical formalism in which QM is formulated.&#xA;Given the above, I don't think it is particularly meaningful to talk of its utility for quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I feel like the question is akin to asking &quot;&lt;em&gt;what is a use of linear algebra in a quantum algorithm?&lt;/em&gt;&quot;, and the answer is: it is the language in which QM is formulated, so it can never be &lt;em&gt;not&lt;/em&gt; useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is a bit different than asking about inner products. The inner product between two vectors is a well-defined operation between sets of numbers, which makes meaningful to talk of a quantum algorithm performing this operation.&#xA;On the other hand, the outer product is (roughly speaking) only a way to denote matrix elements. There is nothing to compute here.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-10-03T10:37:51.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4336" PostTypeId="1" CreationDate="2018-10-03T15:22:49.800" Score="6" ViewCount="102" Body="&lt;p&gt;I am reding the paper &lt;a href=&quot;https://arxiv.org/pdf/1502.00910.pdf&quot; rel=&quot;noreferrer&quot;&gt;EXIT-Chart Aided Near-Capacity Quantum Turbo Code Design&lt;/a&gt; by Babar &lt;em&gt;et al.&lt;/em&gt; and in the introduction, it is stated that due to the exponentially increasing complexity of the MIMO ML decoding, it is an idea to pass such problem to the quantum domain in order to make use of the inherent parallel nature of it, and so reduce the complexity of such problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering then if there has been any research on the topic of using quantum computing to solve such problem related with MIMO channels, and so if there has been, to reference some papers where such type of quantum algorithms are presented.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-12-13T19:29:15.360" LastActivityDate="2018-12-13T19:29:15.360" Title="Quantum Algorithm for MIMO ML detection" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4337" PostTypeId="2" ParentId="4330" CreationDate="2018-10-03T15:38:31.043" Score="5" Body="&lt;p&gt;An outer product is a description of an operator, which is very often to be applied to a state. It can therefore be used to describe how the state transforms under the action of the operator.&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\!\langle#1\rvert}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we may describe the Hadamard gate by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \;=\; \ket{+}\bra{0} \,+\, \ket{-}\bra{1},&#xA;$$&lt;/span&gt;&#xA;which describes the fact that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; transforms &lt;span class=&quot;math-container&quot;&gt;$\ket{0} \mapsto \ket{+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1} \mapsto \ket{-}$&lt;/span&gt;, and transforms all linear combinations of &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; linearly.&#xA;If you want to describe the effect of the Hadamard gate on the standard basis &amp;mdash; describing its matrix, but symbolically, so that you can actually carry out symbolic analysis &amp;mdash; then you might then want to write something like &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \;=\;&#xA;  \frac{1}{\sqrt 2}\sum_{x,y \in \{0,1\}} (-1)^{xy} \,\ket{y}\bra{x}.&#xA;$$&lt;/span&gt;&#xA;Admittedly this is not often very important specifically for a single Hadamard matrix, though a representation like this may well prove useful if you want to reason about performing a Hadamard on many qubits at once,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; H^{\otimes n} \;=\;&#xA;  \frac{1}{\sqrt{2^n}} \sum_{k,z \in \{0,1\}^n} (-1)^{k\cdot z}\,\ket{k_1 k_2 \cdots k_n}\bra{z_1 z_2 \cdots z_n} ,$$&lt;/span&gt;&#xA;or to describe the quantum Fourier transform with respect to the integers modulo &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; for some integer &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA; F_{M} \,=\, \frac{1}{\sqrt M} \sum_{x,y \in \mathbb Z_M} \mathrm e^{2\pi i x y\!\:/\!\:M} &#xA;\end{align} \ket{y}\bra{x}.&#xA;$$&lt;/span&gt;&#xA;It is sometimes useful to describe projectors using outer products as well: for example, the operator which projects states onto the &lt;span class=&quot;math-container&quot;&gt;$\ket{+}$&lt;/span&gt; states would be written simply as &lt;span class=&quot;math-container&quot;&gt;$\ket{+}\bra{+}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-10-03T15:38:31.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4338" PostTypeId="1" AcceptedAnswerId="4345" CreationDate="2018-10-03T22:19:33.770" Score="17" ViewCount="737" Body="&lt;p&gt;I'm working through Mike and Ike (Nielsen and Chuang) for self-study, and I'm reading about stabilizer codes in Chapter 10. I'm an electrical engineer with somewhat of a background in classical information theory, but I'm by no means an expert in algebraic coding theory. My abstract algebra is essentially just a little more than what's in the appendix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I totally understand the Calderbank-Shor-Steane construction, where two linear classical codes are used to construct a quantum code. The Steane code is constructed using &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; (the code for qbit flips) as the [7,4,3] Hamming code, and &lt;span class=&quot;math-container&quot;&gt;$C_2^{\perp}$&lt;/span&gt; (the code for phase flips) as the same code. The parity check matrix the [7,4,3] code is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix}&#xA;    0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;1&amp;amp;1&amp;amp;1 \\&#xA;    0&amp;amp;1&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;1 \\&#xA;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;1 &#xA;\end{bmatrix}&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The stabilizer generators for the Steane code can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array} {|r|r|}&#xA;\hline&#xA;Name &amp;amp; Operator \\&#xA;\hline&#xA; g_1 &amp;amp; IIIXXXX \\&#xA;\hline&#xA; g_2 &amp;amp; IXXIIXX \\&#xA;\hline&#xA; g_3 &amp;amp; XIXIXIX \\&#xA;\hline&#xA;g_4 &amp;amp; IIIZZZZ \\&#xA;\hline&#xA; g_5 &amp;amp; IZZIIZZ \\&#xA;\hline&#xA; g_6 &amp;amp; ZIZIZIZ \\&#xA;\hline&#xA;\end{array}&lt;/span&gt; where for the sake of my sanity &lt;span class=&quot;math-container&quot;&gt;$IIIXXXX = I \otimes I\otimes I\otimes X \otimes X \otimes X \otimes X$&lt;/span&gt; and so on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's pointed out in the book that the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s are in the same positions as the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s in the original parity check code. Exercise 10.32 asks to verify that the codewords for the Steane code are stabilized by this set. I could obviously plug this in and check it by hand. However, it's stated that with the observation of the similarities between the parity check matrix and the generator the exercise is &quot;self-evident&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen this fact noted in other places (&lt;a href=&quot;http://www-bcf.usc.edu/~tbrun/Course/lecture21.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://www-bcf.usc.edu/~tbrun/Course/lecture21.pdf&lt;/a&gt;), but I'm missing some kind of (probably obvious) intuition. I think I'm missing some further connection from the classical codewords to the quantum codes other than how they're used in the indexing of basis elements in the construction of the code (i.e. Section 10.4.2).&lt;/p&gt;&#xA;" OwnerUserId="4746" LastEditorUserId="304" LastEditDate="2018-10-10T20:13:30.447" LastActivityDate="2018-10-10T20:13:30.447" Title="Connection between stabilizer generators and parity check matrices in the Steane code" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4339" PostTypeId="2" ParentId="4336" CreationDate="2018-10-03T22:34:47.900" Score="2" Body="&lt;p&gt;Yeah. See this one for a more-or-less analogous problem: &lt;a href=&quot;https://ieeexplore.ieee.org/document/6515077?arnumber=6515077&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ieeexplore.ieee.org/document/6515077?arnumber=6515077&lt;/a&gt; . Look for some papers by Lajos Hanzo on IEEE Explore. One thing that's notable is that MIMO detection is NP hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, to solve the MIMO (or MU) ML detection problem exactly (currently) requires searching an exponential space. Applying quantum unstructured search gives a square root factor improvement via Grover's Algorithm, so the resulting problem is still exponential. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more practical MIMO detection, people generally apply heuristics or solve relaxations of the actual problem. Typically, we can do a solid job in low polynomial complexity. &lt;/p&gt;&#xA;" OwnerUserId="4746" LastActivityDate="2018-10-03T22:34:47.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4340" PostTypeId="1" CreationDate="2018-10-04T06:08:50.777" Score="5" ViewCount="131" Body="&lt;p&gt;As a fundamental component for a quantum computation, the measurement needs to be implemented in a fault tolerant way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As indicated in Chuang and Nielsen &lt;a href=&quot;https://www.cambridge.org/core/books/quantum-computation-and-quantum-information/01E10196D0A682A6AEFFEA52D53BE9AE&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computation and Quantum Information&lt;/a&gt;, a quantum circuit that allows the implementation of a FT measurement is the one represented in Fig.1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Hwymnt.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hwymnt.png&quot; alt=&quot;Fault tolerant Quantum Measurement&quot;&gt;&lt;/a&gt; &#xA;&lt;sup&gt;&lt;i&gt;Quantum Circuit representation of a fault tolerant measurement.&lt;/i&gt;&lt;/sup&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, three measurements are needed in order to make this implementation actually fault tolerant, due to the possible presence of errors in various part of the circuit (as it is said in the book, between two CNOT gates in a verification step for the cat state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how is it actually possible to execute three subsequent set of measurements? Isn't the data (the states on which the measured is performed) modified by the application of the measurement operation? &#xA;If that is the case, are the measurement operations applied on different data? &lt;/p&gt;&#xA;" OwnerUserId="2601" LastActivityDate="2018-10-04T08:22:24.447" Title="Fault tolerant quantum measurement: how is implemented the &quot;majority vote&quot;" Tags="&lt;measurement&gt;&lt;circuit-construction&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4341" PostTypeId="2" ParentId="4338" CreationDate="2018-10-04T06:37:08.677" Score="2" Body="&lt;p&gt;One way that you could construct what the codeword is is to project on the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace of the generators,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|C_1\rangle=\frac{1}{2^6}\left(\prod_{i=1}^6(\mathbb{I}+g_i)\right)|0000000\rangle.&#xA;$$&lt;/span&gt;&#xA;Concentrate, to start with, one the first 3 generators&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\mathbb{I}+g_1)(\mathbb{I}+g_2)(\mathbb{I}+g_3).&#xA;$$&lt;/span&gt;&#xA;If you expand this out, you'll see that it creates all the terms in the group (&lt;span class=&quot;math-container&quot;&gt;$\mathbb{I},g_1,g_2,g_3,g_1g_2,g_1g_3,g_2g_3,g_1g_2g_3)$&lt;/span&gt;. Corresponding it to binary strings, the action of multiplying two terms (since &lt;span class=&quot;math-container&quot;&gt;$X^2=\mathbb{I}$&lt;/span&gt;) is just like addition modulo 2. So, contained within the code are all of the words generated by the parity check matrix (and this is a group, with group operation of addition modulo 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you multiply by one of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; stabilizers, that's like doing the addition modulo 2 on the corresponding bit strings. But, because we've already generated the group, by definition every group element is mapped to another (unique) group element. In other words, if I do&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;g_1\times\{\mathbb{I},g_1,g_2,g_3,g_1g_2,g_1g_3,g_2g_3,g_1g_2g_3\}=\{g_1\mathbb{I},g_1g_2,g_1g_3,g_2,g_3,g_1g_2g_3,g_2g_3\},&#xA;$$&lt;/span&gt;&#xA;I get back the set I started with (using &lt;span class=&quot;math-container&quot;&gt;$g_1^2=\mathbb{I}$&lt;/span&gt;, and the commutation of the stabilizers), and therefore I'm projecting onto the same state. Hence, the state is stabilized by &lt;span class=&quot;math-container&quot;&gt;$g_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$g_3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can effectively make the same argument for &lt;span class=&quot;math-container&quot;&gt;$g_4$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$g_6$&lt;/span&gt;. I prefer to think about first applying a Hadamard to every qubit, so the Xs are changed to Zs and vice versa. The set of stabilizers are unchanged, so the code is unchanged, but the Z stabilizer is mapped to an X stabilizer, about which we have already argued.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-04T06:37:08.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4342" PostTypeId="2" ParentId="4338" CreationDate="2018-10-04T06:37:58.677" Score="2" Body="&lt;p&gt;What follows perhaps doesn't exactly answer your question, but instead aims to provide some background to help it become as 'self-evident' as your sources claim.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator has eigenstates &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;). The &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; operator on two qubits therefore has eigenstates &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |00\rangle, |01\rangle, |10\rangle, |11\rangle $$&lt;/span&gt;.&#xA;The eigenvalues for these depend on the parity of the bit strings. For example, with &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; we multiply the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalues of the individual &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators to get &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; we multiply the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenvalues together and also get &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;. So both these even parity bit strings have eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;, as does any superposition of them. For both odd parity states (&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;) we must multiply a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; with a &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, and get a &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenvalue for &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that superpositions of bit strings with fixed parity (such as some &lt;span class=&quot;math-container&quot;&gt;$\alpha |00\rangle + \beta |00\rangle$&lt;/span&gt;) are also eigenstates, and have the eigenvalue associated with their parity. So measuring &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; would not collapse such a superposition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This analysis remains valid as we go to higher number of qubits. So if we want to know about the parity of qubits 1, 3, 5, and 7 (to pick a pertinent example), we could use the operator &lt;span class=&quot;math-container&quot;&gt;$ZIZIZIZ$&lt;/span&gt;. If we measure this and get the outcome &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;, we know that this subset of qubits has a state represented by an even parity bit string, or a superposition thereof. If we get &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, we know that it is an odd parity state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows us to write the [7,4,3] Hamming code using the notation of quantum stabilizer codes. Each parity check is turned into a stabilizer generator which has &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on every qubit not involved in the check, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on every qubit that is. The resulting code will protect against errors that anticommute with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; (and therefore have the effect of flipping bits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, qubits do not restrict us to only working in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis. We could encode our qubits for a classical Hamming code in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; states instead. These are the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, so you just need to replace &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in everything I've said to see how this kind of code works. It would protect against errors that anticommute with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (and so have the effect of flipping phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The magic of the Steane code, of course, is that it does both at the same time and protects against everything.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-10-04T06:37:58.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4343" PostTypeId="2" ParentId="4340" CreationDate="2018-10-04T06:51:35.440" Score="0" Body="&lt;p&gt;The three measurements you refer to are applied on parts of the circuit where a qubit is first initialized, then acted upon by a controlled gate, and then measured. The fact that they are initialized at the beginning of each of these three processes means that any dependence on their previous history is removed. So we could use the same qubit three times (and use the result of the previous measurement to inform us how to initialize) or we could use three different qubits. We can just choose whatever is practical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, there is not reason why we shouldn't measure a qubit multiple times, despite the fact that measurement modifies the state. For example, in stabilizer codes, we constantly move information about errors that have occurred to certain qubits, and then measure them to get that information out. In this case, the effect of the measurement in collapsing superpositions has the positive benefit of collapsing complex types of error into simpler ones. So if you ever see a multiply measured qubit in a reputable source, you can be sure that the disturbance caused by the measurement has been taken into account, and is probably being specifically made use of.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-10-04T06:51:35.440" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4344" PostTypeId="2" ParentId="4340" CreationDate="2018-10-04T08:22:24.447" Score="1" Body="&lt;p&gt;The three measurements you refer to are composed of two data qubits and an ancilla. They essentially ask the question &quot;is the state of the data qubits in the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; (in which case the measurement result on the ancilla will be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;) or is the state in the subspace &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; (in which case the ancilla would output &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;)?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that if you only ever prepare you state in some superposition of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, then the measurement will have no effect. It will leave the superposition completely intact, because every part of the state corresponds to the same measurement result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the actual circuit here, things are a little more complicated. There are three data qubits in all, prepared in a superposition of &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;. But still, for each pair of data qubits the state should be within the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. So the three measurements (each for a different pair of data qubits) should always return the output &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. They would have no effect on the superposition in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If they return a different result, it is a sign of error. The majority voting helps us determine what to do to mitigate for that error.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-10-04T08:22:24.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4345" PostTypeId="2" ParentId="4338" CreationDate="2018-10-04T12:13:08.000" Score="8" Body="&lt;p&gt;There are a few conventions and intuition here, which perhaps it would help to have spelled out &amp;mdash; &lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\!\langle#1\rvert}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sign bits versus {0,1} bits&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&#xA;The first step is to make what is sometimes called the 'great notational shift', and think of bits (even classical bits) as being encoded in signs. This is productive to do if what you're mostly interested in is the parities of bit strings, because bit-flips and sign-flips basically act the same way. We map &lt;span class=&quot;math-container&quot;&gt;$0 \mapsto +1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1 \mapsto -1$&lt;/span&gt;, so that for instance the sequence of bits &lt;span class=&quot;math-container&quot;&gt;$(0,0,1,0,1)$&lt;/span&gt; would be represented by the sequence of signs &lt;span class=&quot;math-container&quot;&gt;$(+1,+1,-1,+1,-1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Parities of sequences of bits then corresponds to products of sequences of signs. For instance, just as we would recognise &lt;span class=&quot;math-container&quot;&gt;$0 \oplus 0 \oplus 1 \oplus 0 \oplus 1 = 0$&lt;/span&gt; as a parity computation, we may recognise &lt;span class=&quot;math-container&quot;&gt;$(+1)\cdot(+1)\cdot(-1)\cdot(+1)\cdot(-1) = +1$&lt;/span&gt; as representing &lt;em&gt;the same&lt;/em&gt; parity computation using the sign convention.&lt;br&gt;&lt;br&gt;&#xA;&lt;em&gt;Exercise.&lt;/em&gt; Compute the 'parity' of &lt;span class=&quot;math-container&quot;&gt;$(-1,-1,+1,-1)$&lt;/span&gt; and of &lt;span class=&quot;math-container&quot;&gt;$(+1,-1,+1,+1)$&lt;/span&gt;. Are these the same?&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parity checks using sign bits&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&#xA;In the {0,1}-bit convention, parity checks have a nice representation as a dot-product of two boolean vectors, so that we can realise complicated parity computations as linear transformations.&#xA;By shifting to sign-bits, we have inevitably lost the connection to linear algebra on a &lt;em&gt;notational&lt;/em&gt; level, because we're taking products instead of sums.&#xA;On a computational level, because this is only a shift in notation, we don't really have to worry too much.&#xA;But on a pure mathematical level, we now have to think again a little about what we're doing with parity check matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we use sign bits, we may still represent a 'parity check matrix' as a matrix of 0s and 1s, instead of signs &amp;pm;1. &lt;em&gt;Why?&lt;/em&gt; One answer is that a row vector describing a &lt;em&gt;parity check of bits&lt;/em&gt; is of a different type than the sequence of bits themselves: it describes a function on data, not the data itself. The array of 0s and 1s now just requires a different interpretation &amp;mdash; instead of &lt;em&gt;linear coefficients&lt;/em&gt; in a sum, they correspond to exponents in a product. If we have sign bits &lt;span class=&quot;math-container&quot;&gt;$(s_1, s_2, \ldots, s_n) \in \{-1,+1\}^n$&lt;/span&gt;, and we want to compute a parity check given by a row-vector &lt;span class=&quot;math-container&quot;&gt;$(b_1, b_2, \ldots, b_n) \in \{0,1\}$&lt;/span&gt;, the parity check is then computed by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (s_1)^{b_1} \cdot (s_2)^{b_2} \cdot [\cdots] \cdot (s_n)^{b_n} \in \{-1,+1\},$$&lt;/span&gt; where recall that &lt;span class=&quot;math-container&quot;&gt;$s^0 = 1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. &#xA;As with {0,1}-bits, you can think of the row &lt;span class=&quot;math-container&quot;&gt;$(b_1,b_2,\ldots,b_n)$&lt;/span&gt; as just representing a 'mask' which determines which bits &lt;span class=&quot;math-container&quot;&gt;$s_j$&lt;/span&gt; make a non-trivial contribution to the parity computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Exercise.&lt;/em&gt; Compute the result of the parity check &lt;span class=&quot;math-container&quot;&gt;$(0,1,0,1,0,1,0)$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$(+1,-1,-1,-1,-1,+1,-1)$&lt;/span&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Eigenvalues as parities.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&#xA;The reason &lt;em&gt;why&lt;/em&gt; we would want to encode bits in signs in quantum information theory is because of the way that information is stored in quantum states &amp;mdash; or more to the point, the way that we can describe accessing that information. Specifically, we may talk a lot about the standard basis, but the reason why it is meaningful is because we can extract that information by measurement of &lt;em&gt;an observable&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This observable could just be the projector &lt;span class=&quot;math-container&quot;&gt;$\ket{1}\bra{1}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; has eigenvalue 0 and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; has eigenvalue 1, but it is often helpful to prefer to describe things in terms of the Pauli matrices.&#xA;In this case, we would talk about the standard basis as the eigenbasis of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator, in which case we have &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; as the +1&lt;em&gt;-eigenvector of Z&lt;/em&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; as the &amp;minus;1&lt;em&gt;-eigenvector of Z&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: we have the emergence of sign-bits (in this case, eigenvalues) as representing the information stored in a qubit. And better still, we can do this in a way which is not specific to the standard basis: we can talk about information stored in the 'conjugate' basis, just by considering whether the state is an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, and what eigenvalue it has. But more than this, we can talk about the eigenvalues of a &lt;em&gt;multi-qubit&lt;/em&gt; Pauli operator as encoding &lt;em&gt;parities&lt;/em&gt; of multiple bits &amp;mdash; the tensor product &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt; represents a way of accessing the &lt;em&gt;product of the sign-bits&lt;/em&gt;, that is to say the parity, of two qubits in the standard basis.&#xA;In this sense, the eigenvalue of a state with respect to a multi-qubit Pauli operator &amp;mdash; if that eigenvalue is defined (&lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;in the case that the state &lt;em&gt;is&lt;/em&gt; an eigenvalue of the Pauli operator) &amp;mdash; is in effect the outcome of a parity calculation of information stored in some choice of basis for each of the qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Exercise.&lt;/em&gt; What is the parity of the state &lt;span class=&quot;math-container&quot;&gt;$\ket{11}$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt;? Does this state have a well-defined parity with respect to &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt;?&lt;br&gt;&lt;br&gt;&#xA;&lt;em&gt;Exercise.&lt;/em&gt; What is the parity of the state &lt;span class=&quot;math-container&quot;&gt;$\ket{+-}$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt;? Does this state have a well-defined parity with respect to &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt;?&lt;br&gt;&lt;br&gt;&#xA;&lt;em&gt;Exercise.&lt;/em&gt; What is the parity of &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+} = \tfrac{1}{\sqrt 2}\bigl(\ket{00} + \ket{11}\bigr)$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt;?&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stabiliser generators as parity checks.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&#xA;We are now in a position to appreciate the role of stabiliser generators as being analogous to a parity check matrix.&#xA;Consider the case of the 7-qubit CSS code, with generators&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array} {|r|ccccccc|}&#xA;\hline&#xA;\scriptstyle\text{Generator} &amp;amp;   &amp;amp;   &amp;amp;   &amp;amp; \!\!\!\!\!\!\!\!\!\scriptstyle\text{Tensor factors}\!\!\!\!\!\!\!\!\! &amp;amp; &amp;amp; &amp;amp; \\[-0.5ex]&#xA;                             &amp;amp; \scriptstyle1 &amp;amp; \scriptstyle2 &amp;amp; \scriptstyle3 &amp;amp; \scriptstyle4 &amp;amp; \scriptstyle5 &amp;amp; \scriptstyle6 &amp;amp; \scriptstyle7 \\&#xA;\hline&#xA;\hline&#xA; g_1 &amp;amp;   &amp;amp;   &amp;amp;   &amp;amp; X &amp;amp; X &amp;amp; X &amp;amp; X \\&#xA;\hline&#xA; g_2 &amp;amp;   &amp;amp; X &amp;amp; X &amp;amp;   &amp;amp;   &amp;amp; X &amp;amp; X \\&#xA;\hline&#xA;\hline&#xA; g_3 &amp;amp; X &amp;amp;   &amp;amp; X &amp;amp;   &amp;amp; X &amp;amp;   &amp;amp; X \\&#xA;\hline&#xA;g_4 &amp;amp;   &amp;amp;   &amp;amp;   &amp;amp; Z &amp;amp; Z &amp;amp; Z &amp;amp; Z \\&#xA;\hline&#xA; g_5 &amp;amp;   &amp;amp; Z &amp;amp; Z &amp;amp;   &amp;amp;   &amp;amp; Z &amp;amp; Z \\&#xA;\hline&#xA; g_6 &amp;amp; Z &amp;amp;   &amp;amp; Z &amp;amp;   &amp;amp; Z &amp;amp;   &amp;amp; Z \\&#xA;\hline&#xA;\end{array}&lt;/span&gt;&#xA;I've omitted the identity tensor factors above, as one might sometimes omit the 0s from a {0,1} matrix, and for the same reason: in a given stabiliser operator, the identity matrix corresponds to a tensor factor which is not included in the 'mask' of qubits for which we are computing the parity. For each generator, we are only interested in those tensor factors which are being acted on somehow, because those contribute to the parity outcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the 'codewords' (the encoded standard basis states) of the 7-qubit CSS code are given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA; \ket{0_L} \propto{}&amp;amp;{}&#xA; \ket{0000000} + \ket{0001111} + \ket{0110011} + \ket{0111100} \\&amp;amp;+ \ket{1010101} + \ket{1011010} + \ket{1100110} + \ket{1101001}&#xA; =&#xA;  \sum_{y \in C} \ket{y},&#xA;\\[1ex]&#xA; \ket{1_L} \propto{}&amp;amp;{}&#xA; \ket{1111111} + \ket{1110000} + \ket{1001100} + \ket{1000011} \\&amp;amp;+ \ket{0101010} + \ket{0100101} + \ket{0011001} + \ket{0010110}&#xA; =&#xA;  \sum_{y \in C} \ket{y \oplus 1111111},&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is the code generated by the bit-strings &lt;span class=&quot;math-container&quot;&gt;$0001111$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0110011$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$1010101$&lt;/span&gt;. Notably, these bit-strings correspond to the positions of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators in the generators &lt;span class=&quot;math-container&quot;&gt;$g_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$g_3$&lt;/span&gt;. While those are stabilisers of the code (and represent parity checks as I've suggested above), we can also consider their action as operators which permute the standard basis. In particular, they will permute the elements of the code &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, so that the terms involved in &lt;span class=&quot;math-container&quot;&gt;$\ket{0_L}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1_L}$&lt;/span&gt; will just be shuffled around.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The generators &lt;span class=&quot;math-container&quot;&gt;$g_4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_5$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$g_6$&lt;/span&gt; above are all describing the parities of information encoded in standard basis states.&#xA;The encoded basis states you are given are superpositions of codewords drawn from a linear code, and those codewords all have even parity with respect to the parity-check matrix from that code.&#xA;As &lt;span class=&quot;math-container&quot;&gt;$g_4$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$g_6$&lt;/span&gt; just describe those same parity checks, it follows that the eigenvalue of the encoded basis states is &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; (corresponding to even parity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the way in which&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;'with the observation about the similarities between the parity check matrix and the generator the exercise is &quot;self evident&quot;'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&amp;mdash; because the stabilisers either manifestly permute the standard basis terms in the two 'codewords', or manifestly are testing parity properties which by construction the codewords will have.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Moving beyond codewords&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The list of generators in the table you provide represent the first steps in a powerful technique, known as &lt;em&gt;the stabiliser formalism&lt;/em&gt;, in which states are described using &lt;em&gt;no more or less&lt;/em&gt; than the parity properties which are known to hold of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some states, such as standard basis states, conjugate basis states, and the perfectly entangled states &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+} \propto \ket{00} + \ket{11}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^-} \propto \ket{01} - \ket{10}$&lt;/span&gt; can be completely characterised by their parity properties. (The state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+}$&lt;/span&gt; is the only one which is a +1-eigenvector of &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt;; the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^-}$&lt;/span&gt; is the only one which is a &amp;minus;1-eigenvector of both these operators.) These are known as stabiliser states, and one can consider how they are affected by unitary transformations and measurements by tracking &lt;em&gt;how the parity properties themselves&lt;/em&gt; transform. For instance, a state which is stabilised by &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt; before applying a Hadamard on qubit 1, will be stabilised by &lt;span class=&quot;math-container&quot;&gt;$Z \otimes X$&lt;/span&gt; afterwards, because &lt;span class=&quot;math-container&quot;&gt;$(H \otimes I)(X \otimes X)(H \otimes I) = Z \otimes X$&lt;/span&gt;.&#xA;Rather than transform the state, we transform &lt;em&gt;the parity property which we know to hold&lt;/em&gt; of that state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use this also to characterise how &lt;em&gt;subspaces&lt;/em&gt; characterised by these parity properties will transform.&#xA;For instance, given an unknown state in the 7-qubit CSS code, I don't know enough about the state to tell you what state you will get if you apply Hadamards on all of the qubits, but I can tell you that it is stabilised by the generators &lt;span class=&quot;math-container&quot;&gt;$g_j' = (H^{\otimes 7}) g_j (H^{\otimes 7})$&lt;/span&gt;, which consist of&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{array} {|r|ccccccc|}&#xA;\hline&#xA;\scriptstyle\text{Generator} &amp;amp;   &amp;amp;   &amp;amp;   &amp;amp; \!\!\!\!\!\!\!\!\!\scriptstyle\text{Tensor factors}\!\!\!\!\!\!\!\!\! &amp;amp; &amp;amp; &amp;amp; \\[-0.5ex]&#xA;                             &amp;amp; \scriptstyle1 &amp;amp; \scriptstyle2 &amp;amp; \scriptstyle3 &amp;amp; \scriptstyle4 &amp;amp; \scriptstyle5 &amp;amp; \scriptstyle6 &amp;amp; \scriptstyle7 \\&#xA;\hline&#xA;\hline&#xA; g'_1 &amp;amp;   &amp;amp;   &amp;amp;   &amp;amp; Z &amp;amp; Z &amp;amp; Z &amp;amp; Z \\&#xA;\hline&#xA; g'_2 &amp;amp;   &amp;amp; Z &amp;amp; Z &amp;amp;   &amp;amp;   &amp;amp; Z &amp;amp; Z \\&#xA;\hline&#xA;\hline&#xA; g'_3 &amp;amp; Z &amp;amp;   &amp;amp; Z &amp;amp;   &amp;amp; Z &amp;amp;   &amp;amp; Z \\&#xA;\hline&#xA;g'_4 &amp;amp;   &amp;amp;   &amp;amp;   &amp;amp; X &amp;amp; X &amp;amp; X &amp;amp; X \\&#xA;\hline&#xA; g'_5 &amp;amp;   &amp;amp; X &amp;amp; X &amp;amp;   &amp;amp;   &amp;amp; X &amp;amp; X \\&#xA;\hline&#xA; g'_6 &amp;amp; X &amp;amp;   &amp;amp; X &amp;amp;   &amp;amp; X &amp;amp;   &amp;amp; X \\&#xA;\hline&#xA;\end{array}&lt;/span&gt;&#xA;This is just a permutation of the generators of the 7-qubit CSS code, so I can conclude that the result is &lt;em&gt;also&lt;/em&gt; a state in that same code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is one thing about the stabiliser formalism which might seem mysterious at first: you aren't really dealing with information about the states that tells you anything about how they expand as superpositions of the standard basis. You're just dealing abstractly with the generators. And in fact, this is the point: you don't really want to spend your life writing out exponentially long superpositions all day, do you? What you really want are tools to allow you to reason about quantum states which require you to write things out as linear combinations as rarely as possible, because any time you write something as a linear combination, you are &lt;strong&gt;(a)&lt;/strong&gt;&amp;nbsp;making a lot of work for yourself, and &lt;strong&gt;(b)&lt;/strong&gt;&amp;nbsp;preferring some basis in a way which might prevent you from noticing some useful property which you can access using a &lt;em&gt;different&lt;/em&gt; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still: it is sometimes useful to reason about 'encoded states' in error correcting codes &amp;mdash; for instance, in order to see what effect an operation such as &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes 7}$&lt;/span&gt; might have on the codespace of the 7-qubit code. What should one do instead of writing out superpositions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is to describe these states in terms of observables &amp;mdash; in terms of &lt;em&gt;parity properties&lt;/em&gt; &amp;mdash; to fix those states. For instance, just as &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; is the +1-eigenstate of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, we can characterise the logical state &lt;span class=&quot;math-container&quot;&gt;$\ket{0_L}$&lt;/span&gt; of the 7-qubit CSS code as the +1-eigenstate of &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Z_L = Z \otimes Z \otimes Z \otimes Z \otimes Z \otimes Z \otimes Z$$&lt;/span&gt;&#xA;and similarly, &lt;span class=&quot;math-container&quot;&gt;$\ket{1_L}$&lt;/span&gt; as the &amp;minus;1-eigenstate of &lt;span class=&quot;math-container&quot;&gt;$Z_L$&lt;/span&gt;.&#xA;(It is important that &lt;span class=&quot;math-container&quot;&gt;$Z_L = Z^{\otimes 7}$&lt;/span&gt; commutes with the generators &lt;span class=&quot;math-container&quot;&gt;$\{g_1,\ldots,g_6\}$&lt;/span&gt;, so that it is possible to be a +1-eigenstate of &lt;span class=&quot;math-container&quot;&gt;$Z_L$&lt;/span&gt; at the same time as having the parity properties described by those generators.)&#xA;This also allows us to move swiftly beyond the standard basis: using the fact that &lt;span class=&quot;math-container&quot;&gt;$X^{\otimes 7}$&lt;/span&gt; anti commutes with &lt;span class=&quot;math-container&quot;&gt;$Z^{\otimes 7}$&lt;/span&gt; the same way that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; anti commutes with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, and also as &lt;span class=&quot;math-container&quot;&gt;$X^{\otimes 7}$&lt;/span&gt; commutes with the generators &lt;span class=&quot;math-container&quot;&gt;$g_i$&lt;/span&gt;, we can describe &lt;span class=&quot;math-container&quot;&gt;$\ket{+_L}$&lt;/span&gt; as being the +1-eigenstate of &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X_L = X \otimes X \otimes X \otimes X \otimes X \otimes X \otimes X,$$&lt;/span&gt;&#xA;and similarly, &lt;span class=&quot;math-container&quot;&gt;$\ket{-_L}$&lt;/span&gt; as the &amp;minus;1-eigenstate of &lt;span class=&quot;math-container&quot;&gt;$X_L$&lt;/span&gt;.&#xA;We may say that the &lt;em&gt;encoded standard basis&lt;/em&gt; is, in particular, encoded in the parities of all of the qubits with respect to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators; and the &lt;em&gt;encoded 'conjugate' basis&lt;/em&gt; is encoded in the parities of all of the qubits with respect to &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By fixing a notion of encoded operators, and using this to indirectly represent encoded states, we may observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (H^{\otimes 7}) \,X_L\, (H^{\otimes 7}) = Z_L, \quad (H^{\otimes 7}) \,Z_L\, (H^{\otimes 7}) = X_L, $$&lt;/span&gt;&#xA;which is the same relation as obtains between &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; with respect to conjugation by Hadamards; which allows us to conclude that for this encoding of information in the 7-qubit CSS code, &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes 7}$&lt;/span&gt; not only preserves the codespace but is an encoded Hadamard operation.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus we see that the idea of observables as a way of describing information about a quantum states in the form of sign bits &amp;mdash; and in particular tensor products as a way of representing information about &lt;em&gt;parities&lt;/em&gt; of bits &amp;mdash; plays a central role in describing how the CSS code generators represent parity checks, and also in how we can describe properties of error correcting codes without reference to basis states.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-04T15:30:23.537" LastActivityDate="2018-10-04T15:30:23.537" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4347" PostTypeId="1" AcceptedAnswerId="4352" CreationDate="2018-10-04T21:55:14.800" Score="4" ViewCount="248" Body="&lt;p&gt;Suppose Alice and Bob hold one qubit each of an arbitrary two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; that is possibly entangled. They can apply local operations and are allowed classical communication. Their goal is to apply the CNOT gate to their state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt;. How can they achieve this using two ebits of communication?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm pretty lost on where to start this problem. I would assume that if Alice has the control bit for the CNOT, I would need to follow a protocol something like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;tensor &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with the EPR pairs&lt;/li&gt;&#xA;&lt;li&gt;Alice applies some local operations and measures the EPR pairs&lt;/li&gt;&#xA;&lt;li&gt;Alice classically communicates something to Bob&lt;/li&gt;&#xA;&lt;li&gt;Bob applies some local operations with the information sent classically by Alice&lt;/li&gt;&#xA;&lt;li&gt;CNOT completed. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, it is possible that Alice would only use one ebit, and Bob would use one as well to communicate something back. I'm not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really I just feel like I have no clue where to start this problem. Initially, some guidance on how to approach this would perfect, because right now i'm just poking around at a 6 qubit state.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A second idea I just had: might it be beneficial to instead of looking at the complete state, look at Alice and Bob's local density matrices? &lt;/p&gt;&#xA;" OwnerUserId="4707" LastEditorUserId="26" LastEditDate="2018-12-23T11:37:03.027" LastActivityDate="2018-12-23T11:37:03.027" Title="Applying CNOT with local operations and two EPR pairs" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4348" PostTypeId="1" CreationDate="2018-10-05T05:47:57.757" Score="6" ViewCount="253" Body="&lt;p&gt;Is there a straightforward generalization of the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; Bell basis to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; dimensions? Is there a rotational invariant Bell state in higher dimensions? If yes, then what is the form of that state (&lt;em&gt;how does it look like&lt;/em&gt;)? And, by rotational invariance, I mean that the state is invariant under applying the same unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to each qubit separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;span class=&quot;math-container&quot;&gt;$|\psi^-\rangle = \frac{|0\rangle|1\rangle -  |1\rangle|0\rangle}{\sqrt{2}} = \frac{|\gamma\rangle|\gamma_\perp\rangle -  |\gamma_\perp\rangle|\gamma\rangle}{\sqrt{2}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\gamma\rangle$&lt;/span&gt; is some quantum state in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|\gamma_\perp\rangle$&lt;/span&gt; is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\gamma\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be helpful if I could see an example of the same, in say &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^4$&lt;/span&gt; space, perhaps in the computational basis {&lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle, |2\rangle, |3\rangle$&lt;/span&gt;} itself.&lt;/p&gt;&#xA;" OwnerUserId="506" LastEditorUserId="506" LastEditDate="2018-10-05T06:04:25.693" LastActivityDate="2018-10-05T07:14:31.420" Title="Rotationally invariant maximally entangled states in higher dimensions" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4349" PostTypeId="2" ParentId="4348" CreationDate="2018-10-05T07:14:31.420" Score="4" Body="&lt;p&gt;An orthonormal maxinammly entangled basis for two quNits is easily defined:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_{xy}\rangle=\frac{1}{\sqrt{N}}\sum_{i=0}^{N-1}\omega^{iy}|i,i+x\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-th root of unity, and &lt;span class=&quot;math-container&quot;&gt;$x,y=0,1,\ldots,N-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't believe that there is a rotationally invariant maximally entangled state, except in the case &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;. You may want to look up '&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9708015&quot; rel=&quot;nofollow noreferrer&quot;&gt;twirling&lt;/a&gt;', which almost does the calculation you need (they find states invariant under &lt;span class=&quot;math-container&quot;&gt;$U\otimes U^\star$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$U\otimes U$&lt;/span&gt;), however the way that I convinced myself is the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Any state invariant under &lt;span class=&quot;math-container&quot;&gt;$U\otimes U$&lt;/span&gt; must be invariant under particular examples. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's start with the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-equivalent,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tilde Z=\sum_{n=1}^N\omega^n|n\rangle\langle n|&#xA;$$&lt;/span&gt;&#xA;The class of maximally entangled states that are invariant under this operation are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{N}}\sum_{n=0}^{N-1}|n\rangle|N-1-n\rangle e^{i\phi_n},&#xA;$$&lt;/span&gt;&#xA;where we have free choice over the phases &lt;span class=&quot;math-container&quot;&gt;$\phi_n$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next consider the action of the permutation operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P=\sum_{n=0}^{N-2}|n+1\rangle\langle n|+|0\rangle\langle N-1|&#xA;$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;, this maps back to the original state provided &lt;span class=&quot;math-container&quot;&gt;$e^{2i(\phi_2-\phi_1)}=1$&lt;/span&gt;. For all other &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, we cannot map back to the original state. Terms like &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|N-2\rangle$&lt;/span&gt; become &lt;span class=&quot;math-container&quot;&gt;$|2\rangle|N-1\rangle$&lt;/span&gt; which are not of the form &lt;span class=&quot;math-container&quot;&gt;$|m\rangle|N-1-m\rangle$&lt;/span&gt;, and are hence not in the original state.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-05T07:14:31.420" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4350" PostTypeId="1" AcceptedAnswerId="4356" CreationDate="2018-10-05T09:18:25.400" Score="12" ViewCount="1952" Body="&lt;p&gt;Two of the most well known entangled states are the GHZ-state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = 1/\sqrt{2}\left( |0\rangle^{\otimes n} + |1\rangle^{\otimes n}\right)$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt;-state, with &lt;span class=&quot;math-container&quot;&gt;$W_3 = 1/\sqrt{3}\left(|100\rangle + |010\rangle + |001\rangle\right)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Constructing the GHZ-state is simple for arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. However, implementing the &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt;-state is more difficult. For &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; it is easy, and for &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt; we can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H q[0,3]&#xA;X q[0,3]&#xA;Toffoli q[0],q[3],q[1]&#xA;X q[0,3]&#xA;Toffoli q[0],q[3],q[2]&#xA;CNOT q[2],q[0]&#xA;CNOT q[2],q[3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even for &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt; we have implementations, see &lt;a href=&quot;https://physics.stackexchange.com/questions/311743/quantum-circuit-for-a-3-qubit-w-state&quot;&gt;this answer&lt;/a&gt; for instance. However, I have not found an algorithm that, given an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, outputs the circuit for constructing the &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt;-state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does such an algorithm, defined by single- and two-qubit gates, exist? And if so, what is it? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-05-10T07:16:13.553" Title="General construction of $W_n$-state" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;quantum-state&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4351" PostTypeId="2" ParentId="4350" CreationDate="2018-10-05T09:40:06.493" Score="4" Body="&lt;p&gt;You can define the sequence recursively. Conceptually, what you want to do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Create the initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes N}$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On qubit 1, apply the gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{N}}\left(\begin{array}{cc}&#xA;1 &amp;amp; \sqrt{N-1} \\&#xA;\sqrt{N-1} &amp;amp; -1&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Controlled off qubit 1, apply &quot;make &lt;span class=&quot;math-container&quot;&gt;$|W_{N-1}\rangle$&lt;/span&gt;&quot; on qubits 2 to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (i.e. on do this if qubit 1 is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, otherwise do nothing)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a bit-flip gate on qubit 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This algorithm, as expressed, is not made up of only one- and two-qubit gates, but it can certainly be broken down as such by standard universality constructions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this may not be the most efficient algorithm you could come up with. For example, if &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt;, you could use just &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; layers of square-root of swap gates to produce what you want -- start with a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on a single qubit. Root-swap with a second qubit, and you've got the &lt;span class=&quot;math-container&quot;&gt;$|W_2\rangle$&lt;/span&gt; (up to phases that you'll need to take care of). Put an ancilla next to both of these, and do root swaps between W-ancilla pairs, and you've got &lt;span class=&quot;math-container&quot;&gt;$|W_4\rangle$&lt;/span&gt;, repeat and you've got &lt;span class=&quot;math-container&quot;&gt;$|W_8\rangle$&lt;/span&gt;, and so on. I believe this is basically what they do &lt;em&gt;experimentally&lt;/em&gt; &lt;a href=&quot;https://www.nature.com/articles/nphoton.2014.204&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. You should be able to incorporate this algorithm into the first one to make it more efficient (&lt;span class=&quot;math-container&quot;&gt;$O(\log N)$&lt;/span&gt;) for any arbitrary size, but I've never stopped to work out the details with any great care.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-05T13:15:50.510" LastActivityDate="2018-10-05T13:15:50.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4352" PostTypeId="2" ParentId="4347" CreationDate="2018-10-05T10:13:22.910" Score="3" Body="&lt;p&gt;Here is an idea of how could this be solved. It is based on teleportation.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, Alice teleports her qubit by means of one of the EPR pairs that she shares with Bob. In order to do that, she sends the classical information she obtains by measuring her EPR halve and her qubit.&lt;/li&gt;&#xA;&lt;li&gt;Bob uses the clasical information received in order to reconstruct the qubit in his side. Now teleportation is completed, and Bob posseses the whole qubit system.&lt;/li&gt;&#xA;&lt;li&gt;As local operations are allowed, now Bob performs the CNOT gate on the two qubit system.&lt;/li&gt;&#xA;&lt;li&gt;Now that the operation has been done, Bob uses both the second EPR pair and classical information in order to teleport the first qubit back to Alice.&lt;/li&gt;&#xA;&lt;li&gt;Alice reconstructs the qubit by appying the operations in her halve of the EPR pairs depending on the information classically obtained from Bob. Teleportation is done again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As a consequence, Alice ercovers the qubit that she teleported back, but in this case after applying the CNOT that was desired. This way, the objective is succesfully done while fulfilling the constraint of using just two ebits (in this case the two EPR pairs for teleportation), and the allowed classical communication.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-10-05T10:13:22.910" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4353" PostTypeId="1" AcceptedAnswerId="4355" CreationDate="2018-10-05T11:03:34.360" Score="7" ViewCount="295" Body="&lt;p&gt;I am interesting in finding a circuit to implement the operation &lt;span class=&quot;math-container&quot;&gt;$f(x) &amp;gt; y$&lt;/span&gt; for an arbitrary value of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. Below is the circuit I would like to build:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/e4fKG.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e4fKG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use the first three qubits to encode &lt;span class=&quot;math-container&quot;&gt;$|x⟩$&lt;/span&gt;, use the other three qubits to encode &lt;span class=&quot;math-container&quot;&gt;$|f(x) = x⟩$&lt;/span&gt;, and finally I want to filter out all of the solutions for which &lt;span class=&quot;math-container&quot;&gt;$f(x) \leq y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if we set &lt;span class=&quot;math-container&quot;&gt;$y = 5$&lt;/span&gt;, the states would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Psi_{0} = |0⟩\otimes|0⟩ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Psi_{1} = \frac{1}{\sqrt{8}}\sum_{i=0}^{7} (|i⟩\otimes|0⟩) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Psi_{2} = \frac{1}{\sqrt{8}}\sum_{i=0}^{7} (|i⟩\otimes|i⟩) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Psi_{3} = \frac{1}{\sqrt{2}}(|6⟩\otimes|6⟩ + |7⟩\otimes|7⟩)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a general method to come up with such filter, or is this non-trivial?&lt;/p&gt;&#xA;" OwnerUserId="4755" LastEditorUserId="26" LastEditDate="2018-12-23T07:39:37.417" LastActivityDate="2018-12-23T07:39:37.417" Title="Is there a general method to implement a 'greater than' quantum circuit?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4354" PostTypeId="1" CreationDate="2018-10-05T13:09:08.103" Score="8" ViewCount="396" Body="&lt;p&gt;From &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/D-Wave%202000Q%20Tech%20Collateral_0117F.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave flyer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The D-Wave 2000Q system has up to 2048 qubits and 5600 couplers. To reach this scale, it uses 128,000&#xA;  Josephson junctions, which makes the D-Wave 2000Q QPU by far the most complex superconducting&#xA;  integrated circuit ever built. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How do they define &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qubit&lt;/a&gt;? Do these qubits build an universal quantum computer? Does D-Wave's system satisfy DiVincenzo's criteria?&lt;/p&gt;&#xA;" OwnerUserId="914" LastEditorUserId="8141" LastEditDate="2020-06-11T15:02:50.300" LastActivityDate="2020-06-11T18:53:40.083" Title="What's a Qubit on D-Wave 2000Q?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4355" PostTypeId="2" ParentId="4353" CreationDate="2018-10-05T13:12:21.340" Score="4" Body="&lt;p&gt;What you are looking for I think is to use a quantum circuit for doing comparison.&#xA;Those are made from adder circuits with a slight modification to have comparators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For adders, you have for example one from &lt;a href=&quot;https://docs.google.com/viewer?url=https%3A%2F%2Farxiv.org%2Fpdf%2Fquant-ph%2F0410184.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cuccaro &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt; (this one give the modification to adapt for comparison) and another from &lt;a href=&quot;https://docs.google.com/viewer?url=https%3A%2F%2Farxiv.org%2Fpdf%2F1712.02630.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Himanshu &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-10-05T13:12:21.340" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4356" PostTypeId="2" ParentId="4350" CreationDate="2018-10-05T16:25:51.747" Score="9" Body="&lt;p&gt;Yes, there are several implementations of this algorithm in the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/blob/master/Superposition/ReferenceImplementation.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superposition&lt;/a&gt; quantum kata (tasks 14 and 15):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 2^k$&lt;/span&gt;, you can use a recursive algorithm: create a W state on the first &lt;span class=&quot;math-container&quot;&gt;$2^{k-1}$&lt;/span&gt; qubits, allocate an ancilla qubit in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state, do some controlled SWAPs to set the state of the second &lt;span class=&quot;math-container&quot;&gt;$2^{k-1}$&lt;/span&gt; qubits, and then some controlled NOTs to reset the ancilla back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (&lt;code&gt;WState_PowerOfTwo_Reference&lt;/code&gt; operation).&lt;/li&gt;&#xA;&lt;li&gt;For an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, you can use a recursive algorithm as described by DaftWullie (&lt;code&gt;WState_Arbitrary_Reference&lt;/code&gt; operation).&lt;/li&gt;&#xA;&lt;li&gt;There is also a neat trick you can use to create a &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt; state for an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; using the first recursive algorithm. Allocate extra qubits to pad the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; given ones to &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;, create a state &lt;span class=&quot;math-container&quot;&gt;$W_{2^k}$&lt;/span&gt; on them and measure the extra qubits; if all qubits measure to 0, the state of the original qubits is &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt;, otherwise reset and repeat the process (&lt;code&gt;WState_Arbitrary_Postselect&lt;/code&gt; operation).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is my favorite task of that kata, because it allows so many different approaches.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-10T07:16:13.553" LastActivityDate="2019-05-10T07:16:13.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4357" PostTypeId="2" ParentId="4353" CreationDate="2018-10-05T17:47:39.333" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be the circuit you stated that takes &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle^{\otimes (2n)}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\psi=\frac{1}{2^{n/2}}\sum_{i=0}^{2^n-1} | i \rangle \otimes | f(i) \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S_\psi = I - 2 | \psi \rangle \langle \psi | = U ( S_{| 0 \rangle^{\otimes (2n)}} ) U^\dagger$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S_P$&lt;/span&gt; needs to be the unitary that sends &lt;span class=&quot;math-container&quot;&gt;$| i \rangle \otimes | j \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(-1)^{j&amp;gt;y} (| i \rangle \otimes | j \rangle)$&lt;/span&gt;. For example if &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}-1$&lt;/span&gt;, then this would be done with a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on the most significant index. Generally for &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; 1 less than a power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; this should be easy by combining information from all more significant indices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those are the requisite ingredients for amplitude amplification for &lt;span class=&quot;math-container&quot;&gt;$f(x) \geq 2^k$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. The number of times you need to apply &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is dependent on the overlap which is dependent on how many solutions &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; there are to &lt;span class=&quot;math-container&quot;&gt;$f(k) \geq 2^k$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is reversible so just giving a permutation of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, then you have the overlap in terms of &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt; without bothering with any details of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't get exactly the result you asked for because that was projecting to a subspace/not unitary, but this will get you close to that desired state given your starting setup. There is also the trouble of setting &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; arbitrarily, but at least you can amplify the condition &lt;span class=&quot;math-container&quot;&gt;$f(x) \geq 2^k$&lt;/span&gt; as a step along the way to amplifying &lt;span class=&quot;math-container&quot;&gt;$f(x) \geq y$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$y \geq 2^k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may have misunderstood the question. You might have wanted something that works more generally, but given your small example this approach is okay. You don't have to worry about the fact that &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4\theta}$&lt;/span&gt; will get really big as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; grows you, if you don't let &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; grow. Did you want to input &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; as a quantum state as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wasn't careful about checking &lt;span class=&quot;math-container&quot;&gt;$\geq$&lt;/span&gt; vs &lt;span class=&quot;math-container&quot;&gt;$\gt$&lt;/span&gt; so you should check that.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-10-05T17:47:39.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4358" PostTypeId="2" ParentId="4350" CreationDate="2018-10-05T18:20:48.023" Score="7" Body="&lt;p&gt;The conceptually simplest way to produce a W state is somewhat analogous to classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Reservoir_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;reservoir sampling&lt;/a&gt;, in that it involves a series of local operations that ultimately create a uniform effect.&lt;/p&gt;&#xA;&lt;p&gt;Basically, you look at each qubit in turn and consider &amp;quot;how much amplitude do I have left in the all-0s state, and how much do I want to transfer into the just-this-qubit-is-ON state?&amp;quot;. It turns out that the family of rotations you need is what I'll call the &amp;quot;odds gates&amp;quot; which have the following matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M(p:q) = \sqrt{\frac{1}{p+q}} \begin{bmatrix} \sqrt{p} &amp;amp; \sqrt{q} \\ -\sqrt{q} &amp;amp; \sqrt{p} \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using these gates, you can get a W state with a sequence of increasingly-controlled operations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FQbPA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FQbPA.png&quot; alt=&quot;transfer-out-of-0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This circuit is somewhat inefficient. It has cost &lt;span class=&quot;math-container&quot;&gt;$O(N^2 + N \lg(1/\epsilon))$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of qubits and &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is the desired absolute precision (since, in an error corrected context, the odds gates are not native and must be approximated).&lt;/p&gt;&#xA;&lt;p&gt;We can improve the efficiency by switching from a &amp;quot;transfer out of what was left behind&amp;quot; strategy to a &amp;quot;transfer out of what is traveling along&amp;quot; strategy. This adds a fixup sweep at the end, but only requires single controls on each operation. This reduces the cost to &lt;span class=&quot;math-container&quot;&gt;$O(N \lg(1/\epsilon))$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HdoJb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HdoJb.png&quot; alt=&quot;transfer-out-of-1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is still possible to do better, but it starts to get complicated. Basically, you can use a single partial Grover step to get &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; amplitudes equal to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1/N}$&lt;/span&gt; but they will be encoded into a binary register (we want a one-hot register with a single bit set). Fixing this requires a binary-to-unary conversion circuit. The tools needed to do this are covered in &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Encoding Electronic Spectra in Quantum Circuits with Linear T Complexity&amp;quot;&lt;/a&gt;). Here are the relevant figures.&lt;/p&gt;&#xA;&lt;p&gt;The partial grover step:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/huR7I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/huR7I.png&quot; alt=&quot;Preparing a uniform distribution with a partial grover step&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How to perform an indexed operation (well... sort of. the closest figure had an accumulator which is not quite right for this case):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NPjNk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NPjNk.png&quot; alt=&quot;indexed operation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using this more complicated approach reduces the cost from &lt;span class=&quot;math-container&quot;&gt;$O(N \lg(1/\epsilon))$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$O(N + \lg(1/\epsilon))$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-11-02T20:40:12.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4359" PostTypeId="1" AcceptedAnswerId="4363" CreationDate="2018-10-05T20:56:29.820" Score="4" ViewCount="198" Body="&lt;p&gt;I am seeking introductory resources which will enable me to answer these questions (textbooks, lecture series, etc.):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Given a simple quantum system, how do I derive its Hamiltonian? &lt;/li&gt;&#xA;&lt;li&gt;Given a Hamiltonian, what questions can I answer about the system it describes (and how?).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am approaching this topic primarily from the computer science side. I am familiar with Newtonian classical mechanics as presented in first-year undergraduate physics courses, but never learned classical Hamiltonian mechanics.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="2293" LastEditDate="2018-10-06T17:08:57.977" LastActivityDate="2018-10-30T02:48:44.647" Title="Introductory resources for learning about quantum Hamiltonians" Tags="&lt;resource-request&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="14" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4361" PostTypeId="1" CreationDate="2018-10-06T15:57:28.850" Score="11" ViewCount="339" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/DiVincenzo%27s_criteria&quot; rel=&quot;noreferrer&quot;&gt;DiVincenzo's criteria&lt;/a&gt; for quantum computation are the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A scalable physical system with well characterized qubits. &lt;/li&gt;&#xA;&lt;li&gt;The ability to initialize the state of the qubits to a simple fiducial&#xA;state.&lt;/li&gt;&#xA;&lt;li&gt;Long relevant decoherence times.&lt;/li&gt;&#xA;&lt;li&gt;A “universal” set of quantum gates. &lt;/li&gt;&#xA;&lt;li&gt;A qubit-specific measurement capability. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are they satisfied by the D-Wave 2000Q?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This was originally part of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4354/whats-a-qubit-on-d-wave-2000q&quot;&gt;this question&lt;/a&gt; but is better suited to be a separate question.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-06T16:46:02.203" LastActivityDate="2018-12-04T08:21:28.553" Title="Does the D-Wave 2000Q satisfy DiVincenzo's criteria?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;d-wave&gt;&lt;adiabatic-model&gt;&lt;scalability&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4363" PostTypeId="2" ParentId="4359" CreationDate="2018-10-06T17:36:39.883" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Given a simple quantum system, how do I derive its Hamiltonian?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For quantum systems of continuous variables, the most common way to construct the Hamiltonian is to add the kinetic energy and potential energy, as described in &lt;a href=&quot;https://en.wikipedia.org/w/index.php?title=Hamiltonian_(quantum_mechanics)#The_Schr%C3%B6dinger_Hamiltonian&quot; rel=&quot;nofollow noreferrer&quot;&gt;this resource&lt;/a&gt;. The kinetic energy part is explained &lt;a href=&quot;https://en.wikipedia.org/wiki/Kinetic_energy#Kinetic_energy_in_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and various potential energy models are given here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mrBYl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mrBYl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;br&gt; which unfortunately I could only get to from &lt;a href=&quot;https://en.wikipedia.org/wiki/Morse/Long-range_potential&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum systems on discrete variables, you can construct any &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; Hamiltonian using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli matrices&lt;/a&gt;, and any Hamiltonian of any dimension using &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Generalized_Gell-Mann_matrices_(Hermitian)&quot; rel=&quot;nofollow noreferrer&quot;&gt;generalizations of the Gell-Mann matrices&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;In terms of other resources&lt;/em&gt;&lt;/strong&gt;:&#xA;There is an open source &lt;a href=&quot;https://github.com/HPQC-LABS/Hamiltonian_Zoo/blob/master/Hamiltonian_Zoo.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamiltonian Zoo&lt;/a&gt; on GitHub, but it is very incomplete. So far it tells you how to derive the Hamiltonian for two charges interacting with each other (Coulomb), for a spin system interacting with a magnetic field (Zeeman), and for a 2D p-wave Fermi superfluid, but not much else. However, since this is a resource request, I think the Hamiltonian Zoo is a good starting point, because it &lt;strong&gt;&lt;em&gt;lists&lt;/em&gt;&lt;/strong&gt; the names of almost every mainstream Hamiltonian imaginable, and the best resource for learning about each of those listed Hamiltonians is Wikipedia. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Molecular_Hamiltonian&quot; rel=&quot;nofollow noreferrer&quot;&gt;Molecular Hamiltonian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Hubbard_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hubbard Hamiltonian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Tight_binding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tight Binding Hamiltonian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.scholarpedia.org/article/Bardeen-Cooper-Schrieffer_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;BCS Hamiltonian&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In every case, the Hamiltonian is in the article, just look for the equation containing the big &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;! &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given a Hamiltonian, what questions can I answer about the system it describes (and how?).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There is no &quot;resource&quot; I know that teaches people what can be learned about a system based on looking at its Hamiltonian, and I'd be quite surprised if such a resource existed. What I can tell you is that there are things about the system that can be learned by looking at the Hamiltonian (such as number of particles or number of degrees of freedom, by looking at the number of terms in the kinetic and potential energy operators in the case of continuous variables, or the size of the matrix in discrete variable Hamiltonians). However you may want to ask this part as a separate question (and not a resource request) in case other people want to suggest other things that can be learned about a system by looking at the Hamiltonian apart from what I've already told you.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-10-06T17:36:39.883" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4364" PostTypeId="1" CreationDate="2018-10-07T00:18:00.340" Score="8" ViewCount="485" Body="&lt;p&gt;Given a single qubit in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle =\alpha |0\rangle + \beta|1\rangle$&lt;/span&gt;, the density matrix is &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\langle\psi|=\begin{pmatrix} \alpha^2 &amp;amp; \alpha \beta^*\\&#xA;\alpha^*\beta &amp;amp; \beta ^2\end{pmatrix}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Depolarizing channel is defined to be the super-operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}:\rho \rightarrow (1-p)\rho +p\pi$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\pi=I/2$&lt;/span&gt;. Therefore, here, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N} (\rho) = (1-p)\begin{pmatrix} \alpha^2 &amp;amp; \alpha \beta^*\\&#xA;\alpha^*\beta &amp;amp; \beta ^2\end{pmatrix} &#xA;+ \frac{p}{2} \begin{pmatrix} 1 &amp;amp; 0\\0 &amp;amp; 1\end{pmatrix}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can one implement this evolution on IBM Q? &lt;/p&gt;&#xA;" OwnerUserId="2757" LastEditorUserId="26" LastEditDate="2019-01-01T09:15:19.547" LastActivityDate="2019-01-01T09:15:19.547" Title="Depolarizing channel implementation on IBM Q" Tags="&lt;ibm-q-experience&gt;&lt;quantum-operation&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4366" PostTypeId="1" CreationDate="2018-10-07T14:25:43.680" Score="6" ViewCount="78" Body="&lt;p&gt;Am I correct in thinking that post-quantum cryptography such as lattice-based solutions run on classical computers are resistant to quantum attacks (as opposed to RMS), whereas quantum key distribution schemes such as the BB84 are designed to run on quantum computers to communicate between them?&lt;/p&gt;&#xA;" OwnerUserId="4773" LastEditorUserId="26" LastEditDate="2019-05-08T10:22:00.877" LastActivityDate="2019-05-08T10:22:00.877" Title="Lattice based cryptography vs BB84" Tags="&lt;cryptography&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4367" PostTypeId="1" AcceptedAnswerId="4376" CreationDate="2018-10-07T16:27:49.577" Score="2" ViewCount="428" Body="&lt;p&gt;I want to make an operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}(\arccos(\sqrt p),0,0)$&lt;/span&gt;, when &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is a random value between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I write code in QASM language of this &quot;random &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt;&quot; operator?&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="26" LastEditDate="2018-10-08T07:09:39.847" LastActivityDate="2018-10-09T08:41:04.570" Title="How to make &quot;random U3&quot; in QASM?" Tags="&lt;programming&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4368" PostTypeId="1" AcceptedAnswerId="5430" CreationDate="2018-10-07T20:32:28.527" Score="7" ViewCount="164" Body="&lt;p&gt;I found a paper by Grover titled &quot;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0309123&quot; rel=&quot;noreferrer&quot;&gt;How significant are the known collision and element distinctness quantum algorithms?&lt;/a&gt;&quot;, in which he expressed criticism to several famous algorithms, including &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0311001&quot; rel=&quot;noreferrer&quot;&gt;Ambainis's algorithm&lt;/a&gt; for element distinctness. More precisely, he argues that all those algorithms use too much space, and there is a trivial way to obtain the same speedup(using same amount of memory) by separating the search space into several parts and search them on independent processors simultaneously. It seems Ambainis admitted this in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504012&quot; rel=&quot;noreferrer&quot;&gt;another article&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1.Is Grover correct about those algorithms? That is, are they &quot;trivial&quot; in Grover's sense?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2.Have there been new algorithms obtaining the same speedup and using less space since then?&lt;/p&gt;&#xA;" OwnerUserId="4776" LastActivityDate="2019-02-08T08:53:25.700" Title="How significant are the variants of Grover's Algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4369" PostTypeId="2" ParentId="4364" CreationDate="2018-10-07T23:30:15.423" Score="6" Body="&lt;p&gt;There are several ways that you could realise the depolarising map &lt;span class=&quot;math-container&quot;&gt;$&#xA;\mathcal N_p(\rho) = (1\!-\!p)\:\!\rho + p \!\!\:\cdot\!\tfrac{1}{2}\mathbf 1$&lt;/span&gt;  map on a quantum computer &amp;mdash; including an idealised quantum computer, in which waiting around for the noise to do the work for you would not be an available method.&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start from the fact that the &lt;em&gt;completely&lt;/em&gt; depolarising map can be realised by using a uniformly random Pauli operator:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal N_1(\rho) = \tfrac{1}{2}\mathbf 1 = \tfrac{1}{4}\rho + \tfrac{1}{4}X\rho X + \tfrac{1}{4} Y \rho Y + \tfrac{1}{4} Z \rho Z \mspace{48mu} (*) \mspace{-48mu}$$&lt;/span&gt;&#xA;For the sake of brevity, let &lt;span class=&quot;math-container&quot;&gt;$\mathrm{id}$&lt;/span&gt; be the identity operation on a single qubit density operator, and let &lt;span class=&quot;math-container&quot;&gt;$\mathcal X(\rho) = X \rho X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y(\rho) = Y \rho Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z(\rho) = Z \rho Z$&lt;/span&gt;.&#xA;Then we may abbreviate Eqn.&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$(*)$&lt;/span&gt; by writing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal N_1 = \tfrac{1}{4} \mathrm{id} + \tfrac{1}{4} \mathcal X + \tfrac{1}{4} \mathcal Y + \tfrac{1}{4} \mathcal Z ,$$&lt;/span&gt;&#xA;which emphasises the fact we are considering a randomly applied operation.&#xA;Then, more generally, we may decompose:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\mathcal N_p \,&amp;amp;=\, (1\!-\!p) \;\!\mathrm{id} \,+\, p \:\!\mathcal N_1 &#xA;\\&amp;amp;=\, (1\!-\!\tfrac{3p}{4}) \;\!\mathrm{id} + \tfrac{p}{4}\mathcal X + \tfrac{p}{4}\mathcal Y + \tfrac{p}{4}\mathcal Z.&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;Then, one approach we can take is to simulate a source of randomness which governs which of the four maps &lt;span class=&quot;math-container&quot;&gt;$\mathrm{id}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt; are applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which way you would like to do this depends in part in what operations you would like to use to do so.&#xA;There are two approaches which strike me as being more obvious ones:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If you are happy to use up to three TOFFOLI gates, then you can describe the maps as being governed by a probability distribution on two bits in which &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pr}[x \!=\! 00] \,=\, 1 - 3p/4$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pr}[x \!=\! ab] \,=\, p/4$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$ab \ne 00$&lt;/span&gt;.&#xA;We could do this by considering an appropriate superposition state to describe the distribution &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{\gamma} = \tfrac{\sqrt{4-3p\,}}{2} \ket{00} + \tfrac{\sqrt p}{2} \ket{01} + \tfrac{\sqrt p}{2} \ket{10} + \tfrac{\sqrt p}{2} \ket{11} $$&lt;/span&gt;&#xA;and then using TOFFOLI gates to control an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation conditioned on &lt;span class=&quot;math-container&quot;&gt;$x = 01$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x = 10$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$x = 11$&lt;/span&gt; respectively.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At the cost of only one more qubit, you can instead use three CNOT gates, using different independently prepared qubits to control whether an &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; operation is applied, a &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt; operation is applied, a &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt; operation is applied, or any combination of them or none of them. This seems to me to be substantially  less resource intensive, so I will describe this in some detail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are going to use three qubits to trigger independent events. These events are acting on the input with an &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; channel, acting on the input with a &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt; channel, and action on the input with a &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt; operation, in sequence.&#xA;Because the events are independent, it may be that more than one of them occurs. This is something we have to take into account in order to simulate the distribution &lt;span class=&quot;math-container&quot;&gt;$(1\!-\!\tfrac{3p}{4},\,\tfrac{p}{4},\,\tfrac{p}{4},\,\tfrac{p}{4})$&lt;/span&gt; of Pauli operations to be applied &amp;mdash; because the event of [&lt;em&gt;apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;, don't apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt;, then apply  &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt;&lt;/em&gt;] has the same net effect as [&lt;em&gt;don't apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;, apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt;, and don't apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt;&lt;/em&gt;], and we would like to have the correct probabilities of having each possible net effect.&#xA;By symmetry, we can infer that we would like to have the same probability &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; of each of the effects to occur, so we would like to solve the equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \tfrac{1}{4}p = z(1-z)^2 + z^2(1-z) = z-z^2 $$&lt;/span&gt;&#xA;For any &lt;span class=&quot;math-container&quot;&gt;$0 \leqslant p \leqslant 1$&lt;/span&gt;, there should be a unique &lt;span class=&quot;math-container&quot;&gt;$0 \leqslant z \leqslant \tfrac{1}{2}$&lt;/span&gt; which solves the above equation.&#xA;Subject to that value of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, we define the state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{\delta_z} = \sqrt{1-z\;\!}\;\! \ket{0} + \sqrt{z}\;\! \ket{1}.$$&lt;/span&gt;&#xA;We then prepare three copies of this state to use effectively as a source of randomness, albeit involved in coherently controlled operations which determines whether the input qubit is subject to an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; transformation.&#xA;The circuit conveying the main idea is the following one on the left (with the circuit on the right describing how it would be realised in terms of the usual set of Clifford gates): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ukxPw.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ukxPw.png&quot; alt=&quot;quantum circuit to simulate depolarisation noise&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbols at the  end of the top three wires are 'trace out' operations, and in effect mean 'ignore anything that happens to this qubit from now on'. (You could measure the qubits and simply ignore the result if you like, though to get the result of the depolarising channel it is important that you actually do ignore the outcomes of those measurements, as the transformation that occurs conditioned on &lt;em&gt;any particular outcome&lt;/em&gt; will be not a depolarising map but a particular Pauli transformation.) The three instances of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; followed by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; in the right-hand circuit realises the Clifford operation which permutes the Bloch sphere axes  &lt;span class=&quot;math-container&quot;&gt;$X \to Y \to Z \to X$&lt;/span&gt;, allowing us to simulate the different controlled Pauli operators via cyclically changing the reference frame on the input qubit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-07T23:35:25.533" LastActivityDate="2018-10-07T23:35:25.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4370" PostTypeId="2" ParentId="4366" CreationDate="2018-10-08T05:42:20.350" Score="2" Body="&lt;p&gt;Post-quantum crypto schemes run on classical computers and are &lt;em&gt;hoped&lt;/em&gt; to be secure against quantum attacks. Quantum key distribution such as bb84 or e91 run on quantum hardware (although does not require the full power of a quantum computer) and is provably secure (subject to certain underlying assumptions about lab security etc) against quantum attack.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-08T05:42:20.350" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4371" PostTypeId="1" AcceptedAnswerId="4372" CreationDate="2018-10-08T22:03:19.037" Score="6" ViewCount="122" Body="&lt;p&gt;What is the relation between &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt; and how do we prove it? Are these classes equal?&lt;/p&gt;&#xA;" OwnerUserId="4650" LastEditorUserId="26" LastEditDate="2018-10-09T04:44:01.237" LastActivityDate="2018-10-09T08:18:48.540" Title="Relation between $\mathrm{QMA}$ and $\mathrm{P^{QMA}}$" Tags="&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4372" PostTypeId="2" ParentId="4371" CreationDate="2018-10-08T22:48:03.677" Score="6" Body="&lt;p&gt;Clearly &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA \subseteq P^{QMA}}$&lt;/span&gt;, as we can construct a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt; algorithm to solve any problem in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt;, by using an oracle call. The question is whether the reverse containment is known to hold. And the answer is that the reverse containment &lt;em&gt;is not known&lt;/em&gt; to hold (and I think is not expected to hold).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, computational complexity is full of classes where we don't know whether or not they're different &amp;mdash; and where &lt;em&gt;proving&lt;/em&gt; that classes are different (even when they're &quot;obviously&quot; different, as with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BPP}$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt;) seems to be much more difficult than proving that they're equal (even when it isn't obvious at all that they're equal, as with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PSPACE}$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{IP}$&lt;/span&gt;). So if two classes are different but not &quot;enormously&quot; different, you might be waiting a long time to hear about a definitive proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, we can elaborate a little bit on the obstacles to showing that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt; are equal, if you think that maybe they are equal. One point is that one of them is known to be closed under complements, and the other isn't.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&amp;thinsp;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt; is clearly closed under complements.&#xA;The model of computation which is the basis for the definition of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt; is a deterministic Turing machine which has access to a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; oracle. We can produce a similar oracle machine for the complementary problem by switching the final status ACCEPT / REJECT of the original machine. Therefore, if a language &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; belongs to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt;, then the complementary language &lt;span class=&quot;math-container&quot;&gt;$\overline{L}$&lt;/span&gt; also belongs to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P^{QMA}}$&lt;/span&gt;. (The same goes for any promise problems, as opposed to languages.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At present, it is not known whether &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; is closed under complement. Part of the problem is the same difficulty suffered by &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{MA}$&lt;/span&gt;: there's no obvious way to construct an (efficient bounded error) verifier for certificates of NO instances of problems in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt;, given that all you know about them is that their YES instances do admit efficient bounded error verifiers. In fact, based on the intuition drawn from &lt;em&gt;computability&lt;/em&gt; theory which might lead one to think that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP \ne coNP}$&lt;/span&gt; (and that therefore &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P \ne NP}$&lt;/span&gt;), one might well guess that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; closed under complements.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Obviously, if &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA = P^{QMA}}$&lt;/span&gt;, it would follow that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; is closed under complement: but if &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; were closed under complement, you might also hope to be able to show that by other (possibly easier) means as well. For now, the fact that we're confused about one but not the other is a sort of suggestive, if not entirely reliable, higher-order evidence that these classes might be different.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-09T08:18:48.540" LastActivityDate="2018-10-09T08:18:48.540" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4373" PostTypeId="1" AcceptedAnswerId="4374" CreationDate="2018-10-08T22:52:05.187" Score="9" ViewCount="300" Body="&lt;p&gt;Question inspired by &lt;a href=&quot;https://spectrum.ieee.org/tech-history/heroic-failures/for-some-reason-these-quantum-mechanics-toys-didnt-catch-on&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; from IEEE Spectrum on blocks containing different polarization filters for use in classrooms, and my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4266/4153&quot;&gt;previous question&lt;/a&gt; on representing the three-polarizing-filter experiment in quantum computing terms. Here I want to go the other way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do there exist any easily-purchasable educational quantum computing toys, such as those a physics teacher might use in a classroom? I am imagining here a set of polarizing filters or beam splitters with which you can (in conjunction with a laser) create very simple quantum circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am especially interested in ways to make a CNOT gate.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-10-11T01:21:53.013" LastActivityDate="2018-12-19T16:11:07.447" Title="Do any educational quantum computing toys or devices exist?" Tags="&lt;resource-request&gt;&lt;photonics&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4374" PostTypeId="2" ParentId="4373" CreationDate="2018-10-09T04:49:05.627" Score="5" Body="&lt;p&gt;You can get the sort of optical bench that is typically used for classrooms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a couple examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.a3bs.com/optical-bench-100-cm-1010042-u29301-1010042,p_869_17214.html?utm_source=google&amp;amp;utm_campaign=gmc_feed&amp;amp;utm_medium=shop&amp;amp;gclid=EAIaIQobChMI2fLn_r343QIVgyZpCh2LjQzsEAkYAiABEgJ68_D_BwE&quot; rel=&quot;noreferrer&quot;&gt;3B Scientific&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.schoolspecialty.com/science-first-deluxe-optical-bench-1324383?gclid=EAIaIQobChMI2fLn_r343QIVgyZpCh2LjQzsEAkYByABEgK_nPD_BwE&quot; rel=&quot;noreferrer&quot;&gt;School Speciality&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the one I have taught with before was from 3B, but I don't know about any of the others so research them yourself rather than taking a product recommendation from me. There are several options and this choice will be dependent on your quality/cost requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those will be for experiments about lenses and diffraction rather than polarization so you will have to get the polarizers separately. An example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.edmundoptics.com/p/125mm-dia-left-handed-plastic-circular-polarizer/30380/&quot; rel=&quot;noreferrer&quot;&gt;Edmund Optics&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you see how all the pieces are put on mounts along a track so you can easily slide them around. That is the sort of setup to look for so that lining everything up along the beamline is easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In teaching the three polarizer experiment, we would also have a detector to measure intensity, but you wouldn't need that if this is more like a toy rather than teaching fitting the data to something like &lt;span class=&quot;math-container&quot;&gt;$A \sin^2 (B \theta + C)$&lt;/span&gt; with error analysis.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-10-09T04:49:05.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4375" PostTypeId="2" ParentId="4373" CreationDate="2018-10-09T06:45:56.190" Score="5" Body="&lt;p&gt;Quantum computers are, unfortunately, quite hard to build. Experiments with polarizing filters or beam splitters would be able to demonstrate quantum effects, but I know of no way to make simple quantum circuits for multiple qubits unless you have single photon sources and detectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you could use current cloud-based devices. The &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt; has a simple GUI interface that would be suitable for students (after some introduction), and will then run the circuit on real hardware. If you students would be able to make circuits programmatically, they can use more quantum IBM hardware as well as hardware by &lt;a href=&quot;https://www.rigetti.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rigetti&lt;/a&gt;, with other companies also in the pipeline.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a 'single qubit' experiment, you could perhaps just use polarizing filters. The &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states of the qubit could be associated with horizontal and vertical polarization, and the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; states could be associated with angles of &lt;span class=&quot;math-container&quot;&gt;$45^{\circ}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$135^{\circ}$&lt;/span&gt;. Then just by holding up a filter, you can turn sunlight into a stream of single qubits in a given state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a second filter, you can similarly measure in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle / |1\rangle$&lt;/span&gt; basis (by holding it horizontally or vertically, and seeing if any light comes out) or the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle / |-\rangle$&lt;/span&gt; basis (by holding it diagonally). With multiple filters you could chain these measurements, and show the how the measurement bases are complementary. You could even remake the game I made to run on quantum computers: &lt;a href=&quot;https://medium.com/@decodoku/how-to-program-a-quantum-computer-part-2-f0d3eee872fe&quot; rel=&quot;nofollow noreferrer&quot;&gt;Battleships with complementary measurements&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would be a single qubit example, despite the fact you have many qubits, because they are always the same state and they never interact. So you just have many samples of a single qubit process, that just happen to be shining down on you all at once.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclosure: I work for IBM, and Rigetti once gave me a t-shirt&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-10-09T11:16:09.690" LastActivityDate="2018-10-09T11:16:09.690" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4376" PostTypeId="2" ParentId="4367" CreationDate="2018-10-09T08:41:04.570" Score="3" Body="&lt;p&gt;There are many forms of QASM, so I'll answer for OpenQASM 2.0, as is currently used by IBM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Declaring a gate to be random means that it would be randomly generated at compile time. Since QASM is used as an expression of a compiled circuit, such randomness must be resolved by the time the QASM is created.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is true that are transpilation processes in the IBM stack, which convert a user generated QASM into one optimized for the needs of a given device. This could allow for the functionality your desire to be built into future versions. But I doubt that will be the case. It is much easier just to use randomness when generating the QASM, such as with Pythons random number generation when creating circuits with Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I work for IBM.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-10-09T08:41:04.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4378" PostTypeId="2" ParentId="4108" CreationDate="2018-10-09T15:33:27.143" Score="1" Body="&lt;p&gt;One advantage of the transmon design is the additional loop you gain from what you called two-island-design. The yellow flux bias line changes the &lt;a href=&quot;https://en.wikipedia.org/wiki/Josephson_effect#Josephson_energy&quot; rel=&quot;nofollow noreferrer&quot;&gt;Josephson energy&lt;/a&gt;, thus the resonance of the qubit. You can imagine this as changing the (Josephson) inductance of the SQUID loop being a non-linear LC-resonator. This helps for example in two-qubit gate implementations that rely on identical qubit frequencies. But it comes at the cost of higher sensitivity to flux noise. More details you can find in &lt;a href=&quot;https://arxiv.org/abs/1702.02253&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4750" LastEditorUserId="2293" LastEditDate="2018-10-09T16:56:35.353" LastActivityDate="2018-10-09T16:56:35.353" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4379" PostTypeId="1" CreationDate="2018-10-09T21:13:55.337" Score="6" ViewCount="368" Body="&lt;p&gt;Suppose we have a classical quantum state &lt;span class=&quot;math-container&quot;&gt;$\sum_x |x\rangle \langle x|\otimes \rho_x$&lt;/span&gt;, one can define the smooth-min entropy &lt;span class=&quot;math-container&quot;&gt;$H_\min(A|B)_\rho$&lt;/span&gt; as the best probability of guessing outcome &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; given &lt;span class=&quot;math-container&quot;&gt;$\rho_x$&lt;/span&gt;. How does this quantity relate to &lt;span class=&quot;math-container&quot;&gt;$H(A|B)_\rho$&lt;/span&gt; the standard conditional entropy? If not, how does it relate to the mutual information &lt;span class=&quot;math-container&quot;&gt;$I(A:B)_\rho$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4798" LastEditorUserId="10480" LastEditDate="2021-03-20T23:25:18.583" LastActivityDate="2021-03-20T23:25:18.583" Title="Relating min-entropy with conditional entropy" Tags="&lt;entanglement&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4380" PostTypeId="1" AcceptedAnswerId="4382" CreationDate="2018-10-09T23:57:03.660" Score="4" ViewCount="293" Body="&lt;p&gt;I'm going through the phase estimation algorithm, and wanted to sanity-check my calculations by making sure the state I'd calculated was still normalized. It is, assuming the square of the absolute value of the eigenvalue of the arbitrary unitary operator I'm analyzing equals 1. So, does it? Assuming that the eigenvector of the eigenvalue is normalized.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-10-10T00:02:36.003" LastActivityDate="2018-10-10T16:34:47.440" Title="Are the squared absolute values of the eigenvalues of a unitary matrix always 1?" Tags="&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4381" PostTypeId="2" ParentId="4135" CreationDate="2018-10-10T00:25:00.953" Score="2" Body="&lt;p&gt;&lt;em&gt;Hyperentanglement&lt;/em&gt; refers to entanglement between multiple degrees of freedom of a given system. It is a concept commonly encountered in some fields of quantum information processing, typically in the context of photonics.&#xA;As an example, this can mean that you have entanglement between the polarisation and the position degrees of freedom of a single photon.&#xA;A review paper on the subject can be found in &lt;a href=&quot;https://arxiv.org/abs/1610.09896&quot; rel=&quot;nofollow noreferrer&quot;&gt;1610.09896&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note first of all that there isn't anything fundamental about hyperentanglement. At the end of the day, a hyperentangled system is a &quot;regularly entangled&quot; system in which you just happen to have nonseparability between degrees of freedom that somehow &quot;look different&quot;.&#xA;The reason for having a specific name for it is more practical than fundamental.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest example of a hyperentangled system that comes to mind is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_walk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum walk&lt;/a&gt;. More specifically, one can implement a photonic quantum walk in which the walker degree of freedom is implemented as the position (or orbital angular momentum, or frequency, or time, or something else) of a single photon, and the coin degree of freedom is the photon's polarisation.&#xA;Already after a single step (assuming a bunch of things about the kind of quantum walk under consideration) one has a state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert-1,\uparrow\rangle+\lvert1,\downarrow\rangle,$$&lt;/span&gt;&#xA;where the first label characterises the walker (path, OAM, or anything else) dof, while the second one the polarisation dof. This is probably the simplest example of a &quot;hyperentangled&quot; photonic state. Again, note that this differs from a standard Bell state only in the physical substrate associted with the degrees of freedom, so there is nothing fundamental about it (which does not mean it is not interesting of course).&#xA;An example of such a OAM+polarisation quantum walk is studied in &lt;a href=&quot;https://arxiv.org/abs/1407.5424&quot; rel=&quot;nofollow noreferrer&quot;&gt;1407.5424&lt;/a&gt; (even though they don't use the term &quot;hyperentanglement&quot; there).&#xA;More generally, any vector beam (class of beams characterised by a space-variant polarisation in the transverse plane, see e.g. &lt;a href=&quot;https://www.nature.com/articles/ncomms8706&quot; rel=&quot;nofollow noreferrer&quot;&gt;ncomms8706&lt;/a&gt;) qualifies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More interesting states can be obtained by &quot;hyperentangling&quot; different degrees of freedom of different photons. An example of this is found in &lt;a href=&quot;https://arxiv.org/abs/1602.03769&quot; rel=&quot;nofollow noreferrer&quot;&gt;1602.03769&lt;/a&gt;, in which entanglement of path and polarisation of two photons is exploited to get a four-qubit entangled state. Another example is &lt;a href=&quot;https://arxiv.org/abs/1507.08887&quot; rel=&quot;nofollow noreferrer&quot;&gt;1507.08887&lt;/a&gt;, in which the authors implement a state in which there it entanglement between different hyperentangled states.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-10-10T09:32:10.143" LastActivityDate="2018-10-10T09:32:10.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4382" PostTypeId="2" ParentId="4380" CreationDate="2018-10-10T01:19:20.917" Score="6" Body="&lt;p&gt;Good question. The answer turns out to be &lt;strong&gt;&lt;em&gt;Yes&lt;/em&gt;&lt;/strong&gt;.&lt;br&gt;&#xA;You don't even need the vector to be normalized. Watch:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with the definition of eigenvalues and eigenvectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;U|\psi\rangle &amp;amp;= \lambda |\psi\rangle\\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conjugate and transpose both sides of the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle\psi|U^\dagger &amp;amp;= \langle \psi| \lambda^*. &#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Left multiply each side of line 1 by the corresponding side of line 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle \psi|U^\dagger\cdot U|\psi \rangle  &amp;amp;= \langle \psi | \lambda^* \lambda |\psi\rangle \\&#xA;\langle \psi |\psi \rangle &amp;amp;= |\lambda |^2 \langle \psi   |\psi \rangle \\&#xA;c &amp;amp;= |\lambda|^2 c\\&#xA;1 &amp;amp;= |\lambda|^2&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle $&lt;/span&gt; is normalized, it just means that &lt;span class=&quot;math-container&quot;&gt;$c=1$&lt;/span&gt;, which makes no difference in this proof because the &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; was on both sides of the equation and can be divided out. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-10T16:34:47.440" LastActivityDate="2018-10-10T16:34:47.440" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4383" PostTypeId="2" ParentId="4380" CreationDate="2018-10-10T07:10:06.937" Score="5" Body="&lt;p&gt;@user1271772's answer is excellent, and absolutely the right answer. I just wanted to add in some additional perspective, given recent questions regarding Hamiltonians. Many physicists start from the Hamiltonian being the underlying thing that determines evolution, and unitaries are derived as a consequence. They start from the Schrödinger equation,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\frac{d|\psi\rangle}{dt}=H|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;For a time-invariant Hamiltonian, the solution is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi(t)\rangle=e^{-iHt}|\psi(0)\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; is unitary because &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}e^{iHt}=\mathbb{I}$&lt;/span&gt;. Just stating this solution actually skips over the thing I really want to focus on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could expand a generic &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_ia_i|i\rangle$&lt;/span&gt;, so the Schrödinger equation becomes a series of simultaneous differential equations for the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\frac{da_i}{dt}=\sum_jH_{ij}a_j.&#xA;$$&lt;/span&gt;&#xA;Now consider what happens to an eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle=\sum_ib_i|i\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j}H_{ij}b_i^\star=\lambda b_i^\star.&#xA;$$&lt;/span&gt;&#xA;We can take linear combinations of the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\frac{d\sum_ib_i^\star a_i}{dt}=\sum_{ij}b_i^\star H_{ij}a_j=\lambda\sum_jb_j^\star a_j.&#xA;$$&lt;/span&gt;&#xA;Hence, we see that the component &lt;span class=&quot;math-container&quot;&gt;$x=\sum_jb_j^\star a_j$&lt;/span&gt; simply satisfies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\frac{dx}{dt}=\lambda x,&#xA;$$&lt;/span&gt;&#xA;so &lt;span class=&quot;math-container&quot;&gt;$x(t)=e^{-i\lambda t}x(0)$&lt;/span&gt;. In other words, a state initially created as an eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; stays in that state and just acquires a phase over time &lt;span class=&quot;math-container&quot;&gt;$e^{-i\lambda t}|\lambda\rangle$&lt;/span&gt;. Hence, eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; are also eigenvectors of the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$e^{-i\lambda t}$&lt;/span&gt;, and these have modulus 1.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-10T07:10:06.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4384" PostTypeId="1" CreationDate="2018-10-10T21:49:55.737" Score="4" ViewCount="54" Body="&lt;p&gt;Lovas and Andai (&lt;a href=&quot;https://arxiv.org/abs/1610.01410&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1610.01410&lt;/a&gt;) have recently established that the separability probability (ratio of separable volume to total volume) for the nine-dimensional convex set  of two-re[al]bit states (representable by &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; “density matrices” with real entries) is &lt;span class=&quot;math-container&quot;&gt;$\frac{29}{64}$&lt;/span&gt;. The measure employed was the Hilbert-Schmidt one. Building upon this work of Lovas and Andai, strong evidence has been adduced that the corresponding result for the (standard) fifteen-dimensional convex set of two-qubit states (representable by density matrices with off-diagonal complex entries) is &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33}$&lt;/span&gt; (&lt;a href=&quot;https://arxiv.org/abs/1701.01973&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1701.01973&lt;/a&gt;). (A density matrix is Hermitian, positive definite with unit trace.) Further, with respect to a different measure (one of the class of “monotone” ones), the two-qubit separability probability appears, quite strikingly,  to be &lt;span class=&quot;math-container&quot;&gt;$1-\frac{256}{27 \pi^2}=1-\frac{2^8}{3^3 \pi^2}$&lt;/span&gt;. Further, exact values appear to have been found for higher-dimensional sets of states, endowed with Hilbert-Schmidt measure, such as &lt;span class=&quot;math-container&quot;&gt;$\frac{26}{323}$&lt;/span&gt; for the 27-dimensional set of two-quater[nionic]bit states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, perhaps the measure upon the quantum states of greatest interest is the Bures (minimal monotone) one (&lt;a href=&quot;https://arxiv.org/abs/1410.6883&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1410.6883&lt;/a&gt;). But exact computations pertaining to it appear to be more challenging. Lower-dimensional analyses (having set numbers of entries of the density matrices to zero) have yielded certain exact separability probabilities such as  &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}, \frac{1}{2}, \sqrt{2}-1$&lt;/span&gt; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9911058&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9911058&lt;/a&gt;).&#xA;Efforts to estimate/determine the (15-dimensional) two-qubit Bures separability probability have been reported in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308037&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0308037&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently (&lt;a href=&quot;https://arxiv.org/abs/1809.09040&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1809.09040&lt;/a&gt;, secs. X.B, XI), we have undertaken large-scale numerical simulations—employing both random and quasi-random [low-discrepancy] sequences of points—in this matter. Based on  4,372,000,000 randomly-generated points, we have obtained an estimate of 0.0733181. Further  based on ongoing quasi-randomly-generated (sixty-four-dimensional) points, for which convergence should be stronger, we have obtained independent estimates of 0.0733181 and (for a larger sample) 0.0733117.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach to the suggestion of possible associated exact formulas, is to feed the estimates into &lt;a href=&quot;http://www.wolframalpha.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.wolframalpha.com&lt;/a&gt; and/or &lt;a href=&quot;https://isc.carma.newcastle.edu.au&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://isc.carma.newcastle.edu.au&lt;/a&gt; (the Inverse Symbolic Calculator) and let it issue candidate expressions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certainly, &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{11 \pi^2} \approx 0.073688$&lt;/span&gt; would qualify as “elegant”, as well as &lt;span class=&quot;math-container&quot;&gt;$\frac{11}{150} \approx 0.073333$&lt;/span&gt;, but they do  not seem to have the precision required. Also, since in the two cases mentioned above, we have the “entanglement probabilities” of &#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{25}{33} =1 -\frac{8}{33}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{27}{256 \pi^2} =1-(1-\frac{27}{256 \pi^2})$&lt;/span&gt;,  it might be insightful to think in such terms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bengtsson and Zyczkowski (p. 415 of “Geometry of quantum states: an introduction to quantum entanglement [2017]) ”have observed ``that the Bures volume of the set of mixed states is equal to the volume of an &lt;span class=&quot;math-container&quot;&gt;$(N^2-1)$&lt;/span&gt;-dimensional hemisphere of radius &lt;span class=&quot;math-container&quot;&gt;$R_B=\frac{1}{2}$&lt;/span&gt;''. It is also noted there that &lt;span class=&quot;math-container&quot;&gt;$R_B$&lt;/span&gt; times the area-volume ratio asymptotically increases with the dimensionality &lt;span class=&quot;math-container&quot;&gt;$D=N^2-1$&lt;/span&gt;, which is typical for hemispheres. The Bures volume of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional qubit density matrices is given by &lt;span class=&quot;math-container&quot;&gt;$\frac{2^{1-N^2} \pi ^{\frac{N^2}{2}}}{\Gamma \left(\frac{N^2}{2}\right)}$&lt;/span&gt;, which for &lt;span class=&quot;math-container&quot;&gt;$N=4$&lt;/span&gt;, gives &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi ^8}{165150720}=\frac{\pi^8}{2^{19} \cdot 3^2  \cdot 5 \cdot 7}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionaly, we have similarly investigated the two-rebit Bures separability probability question with estimates being obtained of 0.1570934 and (larger sample) 0.1570971. But our level of confidence that some exact simple elegant formula exists for this probability is certainly not as high, based upon the Lovas-Andai two-rebit result for the  particular monotone metric  they studied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strongly related, with a slightly different focus, to this issue is my question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2740/estimate-determine-bures-separability-probabilities-making-use-of-corresponding&quot;&gt;Estimate/determine Bures separability probabilities making use of corresponding Hilbert-Schmidt probabilities&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="3089" LastEditDate="2018-10-12T16:53:43.953" LastActivityDate="2018-10-12T17:35:30.593" Title="Suggest, partly based upon limited numerical results, possible “elegant” exact formulas for Bures two-qubit separability probability" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4385" PostTypeId="1" CreationDate="2018-10-11T13:55:37.710" Score="3" ViewCount="119" Body="&lt;p&gt;In many algorithms an array that stores a classical data or quantum data is crucial. The QRAM (quantum random access memory) that stores classical data in the circuit has been done. My question focuses on storing the given normalized d-dimensional vector using a quantum circuit. To do that I have used a generalized n-controlled phase shift gate between two Hadamard gates rotated in the specified angle. But when I try to measure the data register I couldn't find what I want, what shall I do?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="26" LastEditDate="2018-12-23T11:33:32.793" LastActivityDate="2018-12-23T11:33:32.793" Title="Simulating Read only QRAM (constructing an oracle)" Tags="&lt;circuit-construction&gt;&lt;quantum-memory&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2018-10-24T02:16:28.417" ContentLicense="CC BY-SA 4.0" />
  <row Id="4386" PostTypeId="1" AcceptedAnswerId="4417" CreationDate="2018-10-11T20:29:57.813" Score="4" ViewCount="301" Body="&lt;p&gt;I'm working through a problem set, and I've come across the following problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In this problem, you'll explore something that we said in class about the Many-Worlds Interpretation of quantum mechanics: namely, that &quot;two branches interfere with each other if and only if they produce an outcome that's identical in all respects.&quot; Consider the n-qubit &quot;Schrodinger cat states&quot;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\frac{|0\cdots 0 \rangle + |1 \cdots 1 \rangle}{\sqrt2}$$&lt;/span&gt;&#xA;  a) What probability distribution over n-bit strings do we observe if we Hadamard the first &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; qubits, then measure all n qubits in the &lt;span class=&quot;math-container&quot;&gt;$\{ |0 \rangle , |1 \rangle \}$&lt;/span&gt; basis?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;b) Is this the same distribution or a different one than if we had applied the same measurement to the state &#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\frac{|0 \cdots 0 \rangle \langle 0 \cdots 0 | + |1 \cdots 1 \rangle \langle 1 \cdots 1 |}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;c) What probability distribution over n-bit strings do we observe if we Hadamard all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, then measure all n qubits in the &lt;span class=&quot;math-container&quot;&gt;$\{ |0 \rangle , |1 \rangle \}$&lt;/span&gt; basis?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;d) Is this the same distribution or a different one than if we had applied the same measurement to the state &#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\frac{|0 \cdots 0 \rangle \langle 0 \cdots 0 | + |1 \cdots 1 \rangle \langle 1 \cdots 1 |}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have solved the problem as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Equal probability of seeing any n-bit string of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Different: that mixed state has a 50/50 shot of seeing &lt;span class=&quot;math-container&quot;&gt;$|0 \cdots 0 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1 \cdots 1 \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;c) Equal probability of seeing any n-bit string of qubits that have an even number of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;d) Different. Same state as b. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is what this has to do with the Many-Worlds Interpretation! Could someone explain the significance of this exercise? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4707" LastEditorUserId="55" LastEditDate="2019-11-07T11:10:29.367" LastActivityDate="2019-11-07T11:10:29.367" Title="Many-Worlds Interpretation and GHZ States" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;interpretations&gt;" AnswerCount="2" CommentCount="10" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4387" PostTypeId="2" ParentId="4386" CreationDate="2018-10-11T21:04:27.440" Score="1" Body="&lt;p&gt;You are 100% correct that this question has nothing to do with the Everett interpretation (also known as &amp;quot;many-worlds interpretation&amp;quot;) of quantum mechanics, and in fact I would even agree with your professor's description of the many-worlds interpretation that &amp;quot;two branches interfere with each other if and only if they produce an outcome that's identical in all respects.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;many-world's interpretation&amp;quot; is an interpretation of wavefunction collapse in which if the wavefunction is in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle\right)$&lt;/span&gt; and you get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; when you measure the state, &lt;strong&gt;there is a different parallel universe somewhere in which &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; was measured&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The picture right at the top of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Many-worlds_interpretation&quot; rel=&quot;nofollow noreferrer&quot;&gt;many-worlds Wikipedia page&lt;/a&gt; depicts exactly this (the cat dies in one universe and survives in another):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QGZRc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QGZRc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;What does it mean to be a &amp;quot;different&amp;quot; universe, if the universe is &lt;em&gt;&lt;strong&gt;everything&lt;/strong&gt;&lt;/em&gt;? Well Hawking talked about this in the first page of his book Brief History of Time. He defines our universe to be literally everything that is physically capable of having any influence on any measurement that anything in our universe ever makes. Therefore there is not much value in talking about other universes, because by definition we will not be able to make any measurements to test any theories we have about other universes, and if we could, then by definition they would be part of our universe (so not actually a different universe).&lt;/p&gt;&#xA;&lt;p&gt;So certainly use the many-worlds interpretation to conceptualize wavefunction collapse &lt;em&gt;&lt;strong&gt;if it helps you&lt;/strong&gt;&lt;/em&gt;, or think of the Bohr interpretation or the Einstein interpretation (whatever helps you conceptualize wavefunction collapse). In all cases, the outcome of any measurements in our universe should &lt;strong&gt;not change&lt;/strong&gt;, and that's why these are called &lt;em&gt;&lt;strong&gt;interpretations&lt;/strong&gt;&lt;/em&gt; and not &lt;em&gt;&lt;strong&gt;theories&lt;/strong&gt;&lt;/em&gt; (it's called &amp;quot;many-worlds interpretation&amp;quot; not &amp;quot;many-worlds theory&amp;quot;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;So it was a trick question. Probabilities do not depend on the &amp;quot;interpretation&amp;quot; they use, they depend on the theory you use: classical mechanics, quantum mechanics (Schroedinger's equation), quantum electrodynamics, quantum chromodynamics, string theory, loop quantum gravity, or whatever you wish.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;You are therefore correct, and may also want to point out to your professor that s/he is missing a &lt;em&gt;&lt;strong&gt;square root&lt;/strong&gt;&lt;/em&gt; symbol in the denominator, otherwise these states are not normalized and the probabilities given as the square moduli of the coefficients, will not add up to 1, which violates the definition of probability that all probabilities should add up to 1.&lt;/p&gt;&#xA;&lt;p&gt;*The image is courtesy of Christian Schirm who made the image himself and put it on Wikipedia with the Creative Commons license.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-10-11T21:04:27.440" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4388" PostTypeId="1" AcceptedAnswerId="4389" CreationDate="2018-10-11T23:50:19.760" Score="7" ViewCount="112" Body="&lt;p&gt;Why is the &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gate sometimes written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{z}\left(\theta\right)=\begin{pmatrix}1 &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\theta}&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while other times it is written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{z}\left(\theta\right)=\begin{pmatrix}e^{-i\theta/2} &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\theta/2}&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and even as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{z}\left(\theta\right)=\begin{pmatrix}e^{-i\theta} &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\theta}&#xA;\end{pmatrix}?&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And when we see an algorithm diagram using this gate, does it always work the same regardless of what the &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; representation is ? Do the papers not always say what their standard representation is?&lt;/p&gt;&#xA;" OwnerUserId="4819" LastEditorUserId="26" LastEditDate="2018-12-23T11:31:24.927" LastActivityDate="2018-12-23T11:31:24.927" Title="$R_z$ gate representations" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4389" PostTypeId="2" ParentId="4388" CreationDate="2018-10-12T00:10:11.120" Score="3" Body="&lt;p&gt;Two representations of &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; are equivalent if they are the same modulo only a &lt;a href=&quot;https://physics.stackexchange.com/questions/401523/global-phases-and-indistinguishable-quantum-states-mathematical-understanding&quot;&gt;global phase&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}1 &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\theta}&#xA;\end{pmatrix}&#xA;=&#xA;e^{+i\theta/2}\begin{pmatrix}e^{-i\theta/2} &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\theta/2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply this gate to any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, the only difference in the outcome is a global (constant) phase of &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta/2}$&lt;/span&gt;. This cannot be detected by any measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example measurements on the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;will result in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with a probability of &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}$&lt;/span&gt;, and &lt;br&gt;&#xA;will result in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with a probability of &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{e^{i\theta/2}}{\sqrt{2}}\left(|0\rangle + |1\rangle \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measurements will:&lt;br&gt;&#xA;result in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with a probability of &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{e^{i\theta/2}}{\sqrt{2}}\right|^2 = \frac{1}{2}$&lt;/span&gt;, and will &lt;br&gt;&#xA;result in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with a probability of &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{e^{i\theta/2}}{\sqrt{2}}\right|^2 = \frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two gates that are equivalent up to a global phase (one that's the same for all components) are equivalent for the purpose of anything you will be able to detect by measurement. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-12T00:16:12.677" LastActivityDate="2018-10-12T00:16:12.677" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4390" PostTypeId="2" ParentId="4388" CreationDate="2018-10-12T00:20:32.037" Score="3" Body="&lt;p&gt;Note that the first two are proportional with a &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta /2}$&lt;/span&gt; factor. Even as you tensor with other gates and continue multiplying, this just comes out in front as an unobservable global phase. Distinguishing the last one you can tell by looking at the range of angles they allow. 0 to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; etc. If the authors fail to include their conventions , you could find the conventions described in their previous writings. Maybe they forgot in the current paper, but remembered before. Also if they are working with some particular software elsewhere, then it seems likely they are using the same conventions as the software does.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-10-12T00:20:32.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4391" PostTypeId="2" ParentId="4388" CreationDate="2018-10-12T08:41:38.457" Score="2" Body="&lt;p&gt;As already explained, the first two are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If no convention is given, the first two are being meant - in that case, one needs to rotate by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; to get the identity (up to a global phase), which is the natural convention.  (Also, it is the evolution generated by the spin-1/2 operator &lt;span class=&quot;math-container&quot;&gt;$S_z=\tfrac12\sigma_z$&lt;/span&gt; in time &lt;span class=&quot;math-container&quot;&gt;$t=\phi$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$R_z(\phi)$&lt;/span&gt; is defined, any definition is ok - though one deviating from the standard one might not be the wisest choice.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-10-12T08:50:03.740" LastActivityDate="2018-10-12T08:50:03.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4392" PostTypeId="1" CreationDate="2018-10-12T14:08:50.037" Score="2" ViewCount="256" Body="&lt;p&gt;I have this as my minor project and plan to use Shor' Algorithm for factorization to figure out the &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; factors for cracking. Although I understand the theoretical part, I am having some problems in implementing it.&lt;/p&gt;&#xA;" OwnerUserId="4823" LastEditorUserId="2293" LastEditDate="2018-10-23T21:09:27.190" LastActivityDate="2018-10-23T21:09:27.190" Title="How can Shor's algorithm be used to crack 32 bit RSA Encryption?" Tags="&lt;cryptography&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2018-10-12T19:29:52.693" ContentLicense="CC BY-SA 4.0" />
  <row Id="4393" PostTypeId="2" ParentId="4392" CreationDate="2018-10-12T15:50:00.353" Score="1" Body="&lt;p&gt;As Craig Gidney has said in the first comment, you will have to give us further instructions about what specific part of Shor's algorithm you need assistance with, since asking us to work through an entire 32-bit example would be considered &quot;doing your homework for you&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I see no harm in helping you with the non-quantum part of it, and I think this will be useful for other users who want to learn RSA without reading a rather large Wikipedia page or tutorial which is catered more towards pure math students.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt; &#xA;&#xA;&lt;p&gt;In RSA you will have a public key which contains two numbers: &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt;. You need to factor &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$p\times q$&lt;/span&gt;. Once you have &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; you can calculate &lt;a href=&quot;https://en.wikipedia.org/wiki/Carmichael_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;Carmichael's totient function&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, which is called &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and is equal to the lowest common multiple of &lt;span class=&quot;math-container&quot;&gt;$p-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q-1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;private key&quot; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; can be found by solving: &lt;span class=&quot;math-container&quot;&gt;$e\times d = 1\hspace{-3mm}\mod\hspace{-1mm} \lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now crack the code &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; to get the original message &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$m=c^d \hspace{-3mm}\mod \hspace{-1mm}n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-12T21:33:49.333" LastActivityDate="2018-10-12T21:33:49.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4394" PostTypeId="2" ParentId="4384" CreationDate="2018-10-12T17:24:28.580" Score="2" Body="&lt;p&gt;Use of the Inverse Symbolic Calculator (&lt;a href=&quot;https://isc.carma.newcastle.edu.au&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://isc.carma.newcastle.edu.au&lt;/a&gt;) suggested the possible exact two-qubit separability probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{629}{8580} =\frac{17 \cdot 37}{2^2 \cdot 3 \cdot 5 \cdot 11 \cdot 13} \approx 0.07331002$&lt;/span&gt;, quite close to the current estimate of ours, based on the largest sample, of 0.0733116 (employing 4,945,000,000 realizations of a quasirandom sequence of interest per the answer of Martin Roberts to &lt;a href=&quot;https://math.stackexchange.com/questions/2231391/how-can-one-generate-an-open-ended-sequence-of-low-discrepancy-points-in-3d&quot;&gt;https://math.stackexchange.com/questions/2231391/how-can-one-generate-an-open-ended-sequence-of-low-discrepancy-points-in-3d&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the estimate further evolves, we may be led to modify/expand (if possible) upon this current &quot;suggestion&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a plot of estimates based upon two quasirandom sequences (one using &lt;span class=&quot;math-container&quot;&gt;$\alpha_0=0$&lt;/span&gt; and one [the indicated longer one, using &lt;span class=&quot;math-container&quot;&gt;$\alpha_0 =\frac{1}{2}$&lt;/span&gt;] in the terminology of Roberts) along with the line &lt;span class=&quot;math-container&quot;&gt;$\frac{629}{8580}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Eh9J5.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Eh9J5.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="3089" LastEditDate="2018-10-12T17:35:30.593" LastActivityDate="2018-10-12T17:35:30.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4395" PostTypeId="1" CreationDate="2018-10-12T20:43:01.873" Score="10" ViewCount="740" Body="&lt;p&gt;In a 2D surface code lattice, there are some data qubits and some measurement qubits. Suppose we want to do a 2-qubit computation, for example, let say, an X-gate on qubit-1 followed by a CNOT gate with qubit-1 as the control bit and qubit-2 as the target bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q: How is this computation realized in a quantum computer with a 2D surface code arrangement of qubits? i.e. Which gates are applied and on which qubits?&lt;/p&gt;&#xA;" OwnerUserId="4722" LastEditorUserId="2293" LastEditDate="2018-10-12T23:46:08.293" LastActivityDate="2018-10-18T10:22:05.653" Title="How is computation done in a 2D surface code array?" Tags="&lt;error-correction&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4396" PostTypeId="2" ParentId="4395" CreationDate="2018-10-12T22:55:01.913" Score="5" Body="&lt;p&gt;One way to store qubits in the surface code is as pairs of &quot;holes&quot;. A hole is a chunk of the surface where, instead of performing the stabilizer measurements used to detect whether errors are occurring, you instead do nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two different types of hole, depending on whether the boundary of the hole travels along would-be X measurement qubits or along would-be Z measurement qubits. A CNOT is performed by cycling a hole of one type around a hole of the other type.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Diagrammatically speaking, it looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zYUg2.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zYUg2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the (b) diagram, time is moving from left to right. Each bar corresponds to the location of a hole over time. Each qubit is stored between the corresponding pairs of white bars. The black bar represents the hole being used to perform the CNOT. It avoids the middle qubit (which is not involved), surrounds one of the bars of the bottom qubit (which is the target), and goes around a 'cross-bar' introduced into the top qubit (which is the control). That's what a surface code CNOT looks like.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-10-12T22:55:01.913" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4397" PostTypeId="1" AcceptedAnswerId="4400" CreationDate="2018-10-14T22:18:34.500" Score="3" ViewCount="725" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\vert s\rangle = \frac{1}{\sqrt{N}}\sum_{i=1}^N\vert x_i\rangle$&lt;/span&gt; be an equal superposition over states from which we need to find one solution state &lt;span class=&quot;math-container&quot;&gt;$\vert w\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase flip operator in Grover's search is &lt;span class=&quot;math-container&quot;&gt;$I - 2\vert w\rangle\langle w\vert$&lt;/span&gt;. Next, one inverts about the mean with the operator &lt;span class=&quot;math-container&quot;&gt;$2\vert s\rangle\langle s\vert - I$&lt;/span&gt;. We do this, say &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; times and then measure the state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is why flip about the mean? What other options would one have that is still unitary and why are they less optimal than choosing the mean?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2019-06-12T07:40:55.793" Title="Why does Grover's search invert about the mean?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4398" PostTypeId="2" ParentId="1474" CreationDate="2018-10-14T22:53:05.070" Score="3" Body="&lt;p&gt;I would include IBM's Composer. It doesn't feel like programming because you don't get all the bugs and errors and funtionality, but it clearly converts your instructions on gates into QASM and runs it on a real IBM simulator, or a real IBM quantum computer (the choice is the user's).&lt;/p&gt;&#xA;" OwnerUserId="4833" LastEditorUserId="2293" LastEditDate="2018-10-15T03:45:24.013" LastActivityDate="2018-10-15T03:45:24.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4399" PostTypeId="1" CreationDate="2018-10-14T23:32:11.247" Score="2" ViewCount="101" Body="&lt;p&gt;I have been interested in the idea of computer clusting which is about making multiple pysical computer system to act as one whole logical computer system computing the same task at the same time, but what about this idea in the quantum computing world has it been done or proposed before?&lt;/p&gt;&#xA;" OwnerUserId="1313" LastEditorUserId="1313" LastEditDate="2018-10-16T00:07:44.267" LastActivityDate="2020-06-17T17:26:47.990" Title="Can quantum computers be clustered together?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4400" PostTypeId="2" ParentId="4397" CreationDate="2018-10-15T04:10:02.110" Score="5" Body="&lt;p&gt;It doesn't have to be an inversion about the mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; be the &quot;reflect-a-vector operator&quot;, meaning&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R(v) = I - 2 |v\rangle \langle v|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm works by starting in some state &lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt; and then alternating two reflection operations, &lt;span class=&quot;math-container&quot;&gt;$R(s)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R(d)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is the solution vector and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is a &quot;diffusion vector&quot;. The choice of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; affects the speed of the algorithm. Basically, the more &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; aligns with &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; (the closer they are to parallel), the faster you will go. The problem is that you don't know what &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is, so you need to pick a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; that works okay for any possible &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; that works equally well for every possible &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, and the &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; that Grover happened to use, is the normalized sum of each possible &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. That is to say, you set &lt;span class=&quot;math-container&quot;&gt;$d= \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} |k\rangle = |+\rangle^{\otimes \lg N}$&lt;/span&gt;. This &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the average of all the solutions, so it inverts about the average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another perfectly acceptable choice of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$d = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} (-1)^{\text{HammingWeight}(k)} |k\rangle = |-\rangle^{\otimes \lg N}$&lt;/span&gt;. For example, this is the state used in &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Chance5%22%5D%2C%5B%22~vn6c%22%5D%2C%5B%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22X%22%5D%2C%5B%22Chance5%22%5D%2C%5B%22~vn6c%22%5D%2C%5B%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22X%22%5D%2C%5B%22Chance5%22%5D%2C%5B%22~vn6c%22%5D%2C%5B%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22X%22%5D%2C%5B%22Chance5%22%5D%2C%5B%22~vn6c%22%5D%2C%5B%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22%E2%8A%96%22%2C%22X%22%5D%2C%5B%22Chance5%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~vn6c%22%2C%22name%22%3A%22Oracle%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22Z%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;Quirk's example Grover circuit&lt;/a&gt;. Yet another perfectly acceptable choice of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the Fourier transform of any &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt;, e.g. &lt;span class=&quot;math-container&quot;&gt;$d = \text{QFT} \cdot |1\rangle = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} e^{i k / N} |k\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, any &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; that can be written in the form &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} e^{i \theta_k}|k\rangle$&lt;/span&gt; will work. As long as &lt;span class=&quot;math-container&quot;&gt;$|\langle d|k \rangle|^2 = 1/N$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, you're good to go ... except that not all choices have a nice compact circuit. For that reason, you should stick to values of &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt; that factor across the qubits, i.e. states that can be factorized into the form &lt;span class=&quot;math-container&quot;&gt;$\otimes_{q=0}^{\lg N - 1} Z^{\phi_q}|+\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-10-15T04:34:42.643" LastActivityDate="2018-10-15T04:34:42.643" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4401" PostTypeId="2" ParentId="4399" CreationDate="2018-10-15T04:47:09.687" Score="4" Body="&lt;p&gt;Yes, this has been thought about. For example, the plan for scaling up ion trap computers involves having multiple &quot;modules&quot;, each with a few dozen qubits. When qubits in separate modules need to interact, they are moved to the same module using quantum teleportation or some other quantum channel. Each &quot;module&quot; is like a little quantum computer in a cluster, with the cluster forming a larger quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example paper: &lt;a href=&quot;https://www.nature.com/articles/npjqi201634&quot; rel=&quot;nofollow noreferrer&quot;&gt;Co-designing a scalable quantum computer with trapped atomic ions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-10-15T04:47:09.687" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4402" PostTypeId="1" CreationDate="2018-10-15T11:05:56.607" Score="2" ViewCount="523" Body="&lt;p&gt;So I am getting this error when I fire the command on Ipython or Jupyter Notebook&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ipython-input-14-8c9b14139f9d&amp;gt; in&amp;lt; module&amp;gt;()&#xA;           from qiskit import IBMQ&#xA;&#xA;ImportError: cannot import name 'IBMQ'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know that kinda error?&#xA;If anyone has experienced such errors while using qiskit, please help here.&lt;/p&gt;&#xA;" OwnerUserId="4446" LastEditorUserId="26" LastEditDate="2019-03-12T09:20:12.267" LastActivityDate="2019-03-12T09:20:12.267" Title="Qiskit SDK problem" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="9" ClosedDate="2020-10-06T06:56:04.643" ContentLicense="CC BY-SA 4.0" />
  <row Id="4403" PostTypeId="1" AcceptedAnswerId="4409" CreationDate="2018-10-15T12:37:37.033" Score="7" ViewCount="883" Body="&lt;p&gt;I'm working my way through the book &quot;Quantum computation and quantum information&quot; by Nielsen and Chuang. (EDIT: the 10th anniversary edition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On chapter 3 (talking about reversibility of the computation) exercise 3.32, it is possible to see that the minimum number of Toffoli gates required to simulate Fredkin gate is 4. See &lt;a href=&quot;http://info.phys.unm.edu/~alandahl/phys452f07/ps1soln.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andrew Landahl's notes&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the end of Chapter 3, it is also stated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;From the point of view of quantum computation and quantum information,&#xA;  reversible computation is enormously important. To harness the full power of quantum computation, any classical subroutines in a quantum computation must be performed reversibly and without the production of garbage bits depending on the classical input.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On chapter 4 exercise 4.25, we construct the Fredkin gate using only 3 Toffoli gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is: what's the difference between &lt;em&gt;simulation&lt;/em&gt; and &lt;em&gt;construction&lt;/em&gt; of Fredkin gate using Toffoli gates?&lt;/p&gt;&#xA;" OwnerUserId="4504" LastEditorUserId="26" LastEditDate="2018-12-23T07:39:12.597" LastActivityDate="2018-12-23T07:39:12.597" Title="Simulation vs Construction of Fredkin gate with Toffoli gates" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4404" PostTypeId="2" ParentId="1584" CreationDate="2018-10-15T12:39:45.490" Score="4" Body="&lt;p&gt;Similar to Blue's picture, I like this one from &lt;a href=&quot;https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quanta Magazine&lt;/a&gt; better, since it seem to visually summarize what we are talking about.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JQGG0.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JQGG0.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1408" LastActivityDate="2018-10-15T12:39:45.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4405" PostTypeId="2" ParentId="4395" CreationDate="2018-10-15T12:51:27.907" Score="9" Body="&lt;p&gt;I will illustrate how one can perform operations using logical operations on the qubits, and using lattice surgery for two-qubit operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the diagrams below, all of the 'dots' are data qubits: measurement qubits are omitted in order to help demonstrate the basic principles more clearly. The measurement qubits are there for when you perform stabiliser measurements, and are only ever involved in stabiliser measurements, so the story is about what you do with the data qubits &amp;mdash; including such things as the stabiliser measurements that you perform on the data qubits.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Surface codes and logical single-qubit Pauli operations&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;One can use fragments of the plane to store qubits. The image below shows four qubits which are encoded as part of a larger lattice: the light dots with black outlines are qubits which are not involved in the encoded qubits, and can in principle be in any state that you like, unentangled from the rest.&#xA;&lt;br&gt;&lt;span class=&quot;math-container&quot;&gt;$\qquad\qquad\qquad$&lt;/span&gt;&lt;img src=&quot;https://i.stack.imgur.com/uydzJ.png&quot; width=&quot;200&quot;/&gt;&lt;br&gt;&lt;br&gt;&#xA;In each of these fragments, the qubit is defined by the stabiliser relations which (ideally, in the absence of errors) hold among the qubits. For surface codes with the sorts of boundary conditions illustrated here, these are either 3-qubit &lt;em&gt;X&lt;/em&gt; or &lt;em&gt;Z&lt;/em&gt; stabilisers around the boundary, and either 4-qubit &lt;em&gt;X&lt;/em&gt; or &lt;em&gt;Z&lt;/em&gt; stabilisers in the 'bulk' or body of the code. The pattern of these stabilisers is illustrated below. Note that each &lt;em&gt;X&lt;/em&gt; stabiliser that overlaps with a &lt;em&gt;Z&lt;/em&gt; stabiliser, does so at two qubits, so that they commute with one another. (Apologies for the image size: I cannot manage to get it to display at a reasonable size.)&#xA;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;math-container&quot;&gt;$\qquad\qquad\qquad$&lt;/span&gt;&lt;img src=&quot;https://i.stack.imgur.com/H94nX.png&quot; width=&quot;200&quot;/&gt;&lt;br&gt;&lt;br&gt;&#xA;Note that by using the regularity of these stabilisers, it isn't necessary for the surface code fragment to be square (or even in principle rectangular).* This will become important later.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a number of (tensor product) Pauli operations which commute with all of these stabilisers. These may be used to define &lt;em&gt;logical&lt;/em&gt; Pauli operators, which describe ways in which you can both &lt;em&gt;access&lt;/em&gt; and &lt;em&gt;transform&lt;/em&gt; the logical qubits. For instance, a product of &lt;em&gt;Z&lt;/em&gt; operators across any row from boundary to boundary will commute with all stabilisers, and can be taken to represent a &lt;strong&gt;logical &lt;em&gt;Z&lt;/em&gt;&lt;/strong&gt; operator; a product of &lt;em&gt;X&lt;/em&gt; operators across any column from boundary to boundary can similarly be take to represent a &lt;strong&gt;logical &lt;em&gt;X&lt;/em&gt;&lt;/strong&gt; operator:&#xA;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;math-container&quot;&gt;$\qquad$&lt;/span&gt;&lt;img src=&quot;https://i.stack.imgur.com/miJrQ.png&quot; width=&quot;500&quot;/&gt;&lt;br&gt;&lt;br&gt;&#xA;It doesn't matter which row or which column you use: this follows from the fact that a product of any &lt;em&gt;two&lt;/em&gt; rows of &lt;em&gt;Z&lt;/em&gt; operators, or of any &lt;em&gt;two&lt;/em&gt; columns of &lt;em&gt;X&lt;/em&gt; operators, can be generated as a product of stabilisers and therefore realises an identity operation on the encoded qubit (as the stabiliser generators &lt;em&gt;themselves&lt;/em&gt; are operators which perform the identity operation on an encoded qubit state, by definition). So: &lt;strong&gt;if you want to apply an &lt;em&gt;X&lt;/em&gt; operation to an encoded qubit,&lt;/strong&gt; one way to do so would be to apply such a logical &lt;em&gt;X&lt;/em&gt; operation, by realising &lt;em&gt;X&lt;/em&gt; operators on each qubit in a column reaching between two boundaries.**&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Logical single-qubit Pauli measurements&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;One advantage of thinking of the encoded qubits in terms of logical operators is that it allows you to also determine how you can perform a 'logical measurement' &amp;mdash; that is, a measurement not only of (some of) the qubits in the code, but of the data that they encode.&#xA;Take the logical &lt;em&gt;X&lt;/em&gt; operator above, for example: the operator &lt;em&gt;X&lt;/em&gt;&amp;otimes;&lt;em&gt;X&lt;/em&gt;&amp;otimes;...&amp;otimes;&lt;em&gt;X&lt;/em&gt; is not only unitary, but Hermitian, which means that it is an observable which you can &lt;em&gt;measure&lt;/em&gt;. (The same idea is used all the time with the stabilisers of the code, of course, which we measure in order to try to detect errors.)&#xA;This means that in order to realise a logical &lt;em&gt;X&lt;/em&gt; measurement, it is enough to measure the logical &lt;em&gt;X&lt;/em&gt; observable.&#xA;(The same goes for the logical &lt;em&gt;Z&lt;/em&gt; observable, if you want to realise a standard basis measurement on your encoded qubit; and everything I say below can also be applied to logical &lt;em&gt;Z&lt;/em&gt; measurements with the appropriate modifications.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now &amp;mdash; measuring the logical &lt;em&gt;X&lt;/em&gt; observable  is &lt;strong&gt;not exactly&lt;/strong&gt; the same as measuring each of those single-qubit &lt;em&gt;X&lt;/em&gt; operators one at a time. The operator &lt;em&gt;X&lt;/em&gt;&amp;otimes;&lt;em&gt;X&lt;/em&gt;&amp;otimes;...&amp;otimes;&lt;em&gt;X&lt;/em&gt; has only two eigenvalues, +1 and &amp;minus;1, so measuring that precise operator can only have two outcomes, whereas measuring each of &lt;em&gt;n&lt;/em&gt; qubits will have 2&lt;sup&gt;&lt;em&gt;n&lt;/em&gt;&lt;/sup&gt; outcomes.&#xA;Also, measuring each of those single-qubit &lt;em&gt;X&lt;/em&gt; operators will not keep you in the code-space: if you want to do computations on a projected post-measurement state, you would have to do a lot of clean-up work to restore the qubit to a properly encoded state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However:&lt;/strong&gt; if you don't mind doing that clean-up work, or if you don't care about working with the post-measurement state, you can &lt;em&gt;simulate&lt;/em&gt; the logical &lt;em&gt;X&lt;/em&gt; measurement by doing those single-qubit measurements, obtaining +1 and &amp;minus;1 outcomes, and then computing their products to obtain what the result of the measurement of  &lt;em&gt;X&lt;/em&gt;&amp;otimes;&lt;em&gt;X&lt;/em&gt;&amp;otimes;...&amp;otimes;&lt;em&gt;X&lt;/em&gt; &quot;would have&quot; been.&#xA;(More precisely: measuring all of those single-qubit &lt;em&gt;X&lt;/em&gt; operators is something that does not disturb a state which would result from a measurement of the tensor product operator &lt;em&gt;X&lt;/em&gt;&amp;otimes;&lt;em&gt;X&lt;/em&gt;&amp;otimes;...&amp;otimes;&lt;em&gt;X&lt;/em&gt;, and the product of those single-qubit measurements would have to yield a consistent outcome with the tensor product operator &lt;em&gt;X&lt;/em&gt;&amp;otimes;&lt;em&gt;X&lt;/em&gt;&amp;otimes;...&amp;otimes;&lt;em&gt;X&lt;/em&gt;, so we can use this as a way to simulate that more complicated measurement if we don't mind all of the qubits being projected onto conjugate basis states as a side-effect.)&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Lattice surgery for logical two-qubit operations&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;To realise a two-qubit operation, you can use a technique known as &lt;em&gt;lattice surgery&lt;/em&gt;, wherein you 'merge' and 'split' different patches of the 2D lattice to realise operations between those patches (see [&lt;a href=&quot;https://arxiv.org/abs/1111.4022&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1111.4022&lt;/a&gt;], [&lt;a href=&quot;https://arxiv.org/abs/1612.07330&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1612.07330&lt;/a&gt;], or [&lt;a href=&quot;https://arxiv.org/abs/1704.08670&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1704.08670&lt;/a&gt;] for complete descriptions of these operations. Disclosure: I am an author on the third of these articles.)&#xA;This may be realised between two adjacent patches of the planar lattice (as illustrated above) by preparing those &quot;uninvolved&quot; rows and columns of qubits in a suitable state, and then &lt;em&gt;measuring stabilisers which previously you were not measuring&lt;/em&gt; in order to extend the memory to a larger system.&#xA;(In the diagram below, the horizontal spacing between the code segments and the column of qubits in the &lt;strong&gt;|0&amp;rang;&lt;/strong&gt; states is exaggerated for effect.)&#xA;&lt;br&gt;&lt;br&gt;&lt;span class=&quot;math-container&quot;&gt;$\qquad$&lt;/span&gt;&lt;img src=&quot;https://i.stack.imgur.com/emsm8.png&quot; width=&quot;500&quot;/&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will affect the logical operators of the system in a non-unitary way, and is most often used (see [&lt;a href=&quot;https://arxiv.org/abs/1612.07330&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1612.07330&lt;/a&gt;] for example) to realise a coherent &lt;em&gt;X&lt;/em&gt;&amp;otimes;&lt;em&gt;X&lt;/em&gt; or &lt;em&gt;Z&lt;/em&gt;&amp;otimes;&lt;em&gt;Z&lt;/em&gt; measurement, which can be composed to realise a CNOT operation [arXiv:1612.07330, Fig.&amp;thinsp;1(b)]:&#xA;&lt;br&gt;&lt;span class=&quot;math-container&quot;&gt;$\qquad\qquad\qquad$&lt;/span&gt;&lt;img src=&quot;https://i.stack.imgur.com/qdfyL.png&quot; width=&quot;400&quot;/&gt;&lt;br&gt;&#xA;In this way, you can realise a CNOT operation between a pair of encoded qubits.***&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Footnotes&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;*&amp;nbsp;You can also use slight modifications of the regular pattern of stabilisers, as Letinsky [&lt;a href=&quot;https://arxiv.org/abs/1808.02892&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1808.02892&lt;/a&gt;] demonstrates, to achieve more versatile planar-surface representations of encoded qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;**&amp;nbsp;In practise, rather than explicitly performing (imperfect single-qubit) operations, you would take advantage of the fact that the frame of reference for the encoded qubits is one which you are fixing by convention, and update (or 'transform') the reference frame rather than the state itself when you wish to realise a Pauli operation. This is the smart way to go about error correction as well: to treat errors not as 'mistakes' which must be 'fixed', but as an &lt;em&gt;uncontrolled but observable drift in your reference frame&lt;/em&gt; as a result of interaction with the environment. You then hope that this drift is slow enough that you can track it accurately, and compensate for the change in reference frame when you do your computation. Particularly in the context of tracking errors, this reference frame is described as the &lt;em&gt;Pauli frame&lt;/em&gt;, and its job is to describe the frame of reference in terms of the Pauli operations which would be required to put the system in the state usually described by an error-free error correcting code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;***&amp;nbsp;Many authors would describe this construction as the point of lattice surgery, and it is certainly the original concrete application of it described in the original article [&lt;a href=&quot;https://arxiv.org/abs/1111.4022&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1111.4022&lt;/a&gt;]. It is possible in principle to do more elaborate operations using splits and merges, by treating the merges and splits as primitive operations in their own right rather than just the components of a CNOT, and using more versatile (but not especially circuit-like) transformations &amp;mdash; this is essentially the point of my article with Dom Horsman [&lt;a href=&quot;https://arxiv.org/abs/1704.08670&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1704.08670&lt;/a&gt;], which opens up the possibility of the ZX calculus (a somewhat heterodox representation of quantum computation) to be directly practically useful for surface-code memories.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-18T10:22:05.653" LastActivityDate="2018-10-18T10:22:05.653" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4406" PostTypeId="2" ParentId="4395" CreationDate="2018-10-15T13:12:06.293" Score="3" Body="&lt;p&gt;There are multiple ways to store information in surface codes. Depending on the method you use, there are then multiple ways to do gates. So there's actually a lot to say on this issue!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Despite the multiplicity of methods, in practical terms they all come to pretty much the same thing: if you want you gate to be kept fault-tolerant by the code, you can only do Clifford gates (such as X, Z, H, CNOT, S). For other gates you'll need to invoke additional mechanisms to become fault-tolerant, such as magic state distillation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you didn't ask for anything beyond Clifford in your example. You just wanted an X and a CNOT. So that makes things easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a concrete example, let's take the 17 qubit surface code shown below (as depicted in &lt;a href=&quot;https://arxiv.org/abs/1609.04673&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, of which I am an author).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GVSQE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GVSQE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is made up of &lt;span class=&quot;math-container&quot;&gt;$n=9$&lt;/span&gt; physical qubits, numbered from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;. There are also 8 ancilla qubits depicted here, but we'll ignore them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dark patches in this image denote stabilizers made of &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; (so we measure the observables &lt;span class=&quot;math-container&quot;&gt;$\sigma_x^0 \otimes \sigma_x^1 \otimes \sigma_x^3 \otimes \sigma_x^4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_x^1 \otimes \sigma_x^2$&lt;/span&gt;, for example). The light patches are then the &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; stabilizers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example of an operation that commutes with all stabilizers is to do a &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; rotation on a line of qubits from top to bottom, such as &lt;span class=&quot;math-container&quot;&gt;$\sigma_x^0 \otimes \sigma_x^3 \otimes \sigma_x^6$&lt;/span&gt;.  Another example is to do a line of &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; rotations from left to right, such as &lt;span class=&quot;math-container&quot;&gt;$\sigma_z^3 \otimes \sigma_z^4 \otimes \sigma_z^5$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All other operations that commute with the stabilizer will be either products of stabilzers themselves (and so act trivially), or they will be equivalent to one of these two examples. So these operations act on our logical qubit. Since one is made of &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;s, the other is made of &lt;span class=&quot;math-container&quot;&gt;$sigma_z$&lt;/span&gt;s, and they anticommute, it is would seem sensible to assign them as the Pauli operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; of the logical qubit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X = \sigma_x^0 \otimes \sigma_x^3 \otimes \sigma_x^&#xA;6, Z = \sigma_z^3 \otimes \sigma_z^4 \otimes \sigma_z^5$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to do an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, you just perform the operation above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a CNOT, one of the many ways to do it is &lt;em&gt;transversally&lt;/em&gt;. For this, suppose we have two logical qubits &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Each is made of many physical qubits, that we'll number &lt;span class=&quot;math-container&quot;&gt;$0, 1, 2, \ldots$&lt;/span&gt;. So let's us &lt;span class=&quot;math-container&quot;&gt;$0_A$&lt;/span&gt; to denote physical qubit &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; of logical qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do &lt;span class=&quot;math-container&quot;&gt;${\rm CNOT}(A,B)$&lt;/span&gt;, a CNOT with qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as control and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as target, we can then do&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ {\rm CNOT}(0_A,0_B) \,\, {\rm CNOT}(1_A,1_B) \,\, {\rm CNOT}(1_A,1_B) \,\, \ldots$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see how this works, we have to look at the logical &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states when expressed in the computational basis of the physical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's use &lt;span class=&quot;math-container&quot;&gt;$| \tilde 0 \rangle = |0\rangle^{\otimes n}$&lt;/span&gt; to denote the state where all physical qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$| \tilde 1 \rangle = X | \tilde 0 \rangle$&lt;/span&gt; a state with a line of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s from top to bottom, on a background of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then simply express the logical &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state as the superposition of &lt;span class=&quot;math-container&quot;&gt;$| \tilde 0 \rangle$&lt;/span&gt; with all the state that you can get to from &lt;span class=&quot;math-container&quot;&gt;$| \tilde 0 \rangle$&lt;/span&gt; by applying stabilizers. Logical &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is similarly the superposition of &lt;span class=&quot;math-container&quot;&gt;$| \tilde 1 \rangle$&lt;/span&gt; with all the state that you can get to from &lt;span class=&quot;math-container&quot;&gt;$| \tilde 1 \rangle&#xA;$&lt;/span&gt; by applying stabilizers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By thinking of the action of the transversal CNOTs in terms of these states, you should hopefully be able to see how it acts as a CNOT on the logical qubits.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-10-16T04:06:07.803" LastActivityDate="2018-10-16T04:06:07.803" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4407" PostTypeId="2" ParentId="4403" CreationDate="2018-10-15T14:30:04.630" Score="3" Body="&lt;p&gt;The words &quot;construct&quot; and &quot;generate&quot; are in practice synonyms when it comes to transformations, but suggest different ways in which we consider what's going on.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;Construct&quot; suggests thinking of a FREDKIN gate as a subroutine, which you realise as a composition of more primitive operations. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&quot;Simulate&quot; suggests the idea that there is some model (eg. conservative reversible computation) for which FREDKIN is a primitive, and which you are realising by other operations in some other model (eg. quantum computation, or reversible but not necessarily conservative computation) in which it is not a primitive.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The second viewpoint is particularly useful when you consider operations which are being realised using a protocol which succeeds only under certain circumstances, or using a protocol which is only realises an operation up to some probability of error or up to some precision. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-15T19:52:04.847" LastActivityDate="2018-10-15T19:52:04.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4409" PostTypeId="2" ParentId="4403" CreationDate="2018-10-15T17:57:51.603" Score="4" Body="&lt;p&gt;I don't think there is a difference between the meanings of &quot;construct&quot; and &quot;simulate&quot; in this case. Exercise 3.32 of Nielsen and Chuang doesn't actually tell you that you need 4 Toffoli gates to simulate a Fredkin one, and you can in fact do it using just 3 gates, similar to the construction of SWAP gate using 3 CNOT gates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CCNOT(control1, control2, target)&#xA;CCNOT(control1, target, control2)&#xA;CCNOT(control1, control2, target)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The circuit given in Andrew Landahl's notes with 4 gates doesn't seem to perform a  Fredkin gate on the three given qubits. Based on the notes on the circuit provided in the notes, the middle qubit (the z input) ends up in &lt;span class=&quot;math-container&quot;&gt;$y \oplus z$&lt;/span&gt; state, not in &lt;span class=&quot;math-container&quot;&gt;$x(y \oplus z) \oplus z$&lt;/span&gt; state as the Fredkin gate requires (the fifth qubit, which started in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, ends in this state instead).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-10-15T17:57:51.603" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4410" PostTypeId="2" ParentId="4379" CreationDate="2018-10-15T20:01:23.900" Score="5" Body="&lt;p&gt;The conditional min-entropy &lt;span class=&quot;math-container&quot;&gt;$\text{H}_{\text{min}}(A | B)_{\rho}$&lt;/span&gt; can be defined for an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of a pair of registers &lt;span class=&quot;math-container&quot;&gt;$(A,B)$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;- \inf_{\sigma} \,\text{D}_{\text{max}}(\rho \| \mathbb{1}\otimes \sigma),&#xA;$$&lt;/span&gt;&#xA;where the infimum is over all states &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{D}_{\text{max}}$&lt;/span&gt; is the quantum relative max-entropy:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{D}_{\text{max}}(P\|Q) = \inf\{\lambda\in\mathbb{R}: P\leq 2^{\lambda} Q\}.&#xA;$$&lt;/span&gt;&#xA;In contrast, the ordinary conditional entropy &lt;span class=&quot;math-container&quot;&gt;$\text{H}(A | B)_{\rho}$&lt;/span&gt; can be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;- \inf_{\sigma}\, \text{D}(\rho \| \mathbb{1}\otimes \sigma),&#xA;$$&lt;/span&gt;&#xA;where here &lt;span class=&quot;math-container&quot;&gt;$\text{D}$&lt;/span&gt; refers to the ordinary quantum relative entropy. (This expression for the conditional entropy simplifies to something more familiar once you know that the infimum is always achieved by &lt;span class=&quot;math-container&quot;&gt;$\sigma = \operatorname{Tr}_{A}(\rho)$&lt;/span&gt;, which is not necessarily true for the formula for the conditional min-entropy.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It happens to be the case that for a classical-quantum state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_x p(x) \,|x\rangle \langle x | \otimes \rho_x&#xA;$$&lt;/span&gt;&#xA;that the conditional min-entropy &lt;span class=&quot;math-container&quot;&gt;$\text{H}_{\text{min}}(A | B)_{\rho}$&lt;/span&gt; is equal to the &lt;em&gt;negative logarithm&lt;/em&gt; of the optimal guessing probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is always the case that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{H}_{\text{min}}(A | B)_{\rho} \leq \text{H}(A | B)_{\rho},&#xA;$$&lt;/span&gt;&#xA;for every state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and not just classical-quantum states. This follows from the fact that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{D}(\rho \| Q) \leq \text{D}_{\text{max}}(\rho \| Q)&#xA;$$&lt;/span&gt;&#xA;for every density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and every positive semidefinite operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;. This inequality follows from the observation that &lt;span class=&quot;math-container&quot;&gt;$\rho \leq 2^{\lambda} Q$&lt;/span&gt; implies&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{D}(\rho \| Q) &amp;amp; = \operatorname{Tr}(\rho \log(\rho)) - \operatorname{Tr}(\rho \log(Q))\\&#xA;&amp;amp; \leq \operatorname{Tr}(\rho\log(\rho)) - \operatorname{Tr}(\rho\log(2^{-\lambda}\rho))\\&#xA;&amp;amp; = \lambda,&#xA;\end{align}&lt;/span&gt;&#xA;where the inequality makes use of the operator monotonicity of the logarithm function: if &lt;span class=&quot;math-container&quot;&gt;$Q \geq 2^{-\lambda}\rho$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\log(Q) \geq \log(2^{-\lambda}\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-10-15T20:01:23.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4411" PostTypeId="1" CreationDate="2018-10-15T21:23:33.563" Score="3" ViewCount="543" Body="&lt;p&gt;I am trying to run an optimization problem on IBMQ. Running the same code on QASM simulator works fine. However, changing only the backend name to IBMQX takes long time. I am aware of the queues although, there is no way to track the status of my job. I have followed the same code structure given on qiskit-aqua partition example tutorial. &#xA;Any help would be really appreciated. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="4838" LastEditorUserId="26" LastEditDate="2019-03-12T09:24:10.040" LastActivityDate="2019-05-31T17:52:14.170" Title="How to run algorithms on IBMQ via Qiskit-Aqua?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;optimization&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4412" PostTypeId="1" AcceptedAnswerId="4646" CreationDate="2018-10-15T21:30:59.623" Score="6" ViewCount="119" Body="&lt;p&gt;I'm having trouble understanding the difference between weak fourier sampling and strong fourier sampling. From &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0503095.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...two important variants of the Fourier sampling paradigm have been&#xA;  identified: the weak standard method, where only representation names&#xA;  are measured, and the strong standard method, where full measurement&#xA;  (i.e., the row and column of the representation, in a suitably chosen&#xA;  basis, as well as its name) occurs.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can someone explain like I'm 5 years old?&lt;/p&gt;&#xA;" OwnerUserId="4728" LastEditorUserId="2293" LastEditDate="2018-10-18T16:05:49.167" LastActivityDate="2019-05-13T21:22:37.533" Title="Weak Fourier Sampling vs Strong Fourier Sampling?" Tags="&lt;quantum-fourier-transform&gt;&lt;fourier-sampling&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4413" PostTypeId="1" AcceptedAnswerId="4419" CreationDate="2018-10-15T23:07:18.287" Score="4" ViewCount="274" Body="&lt;p&gt;Consider the following circuit, where &lt;span class=&quot;math-container&quot;&gt;$F_n$&lt;/span&gt; swaps two n-qubit states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IQ3CR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IQ3CR.png&quot; alt=&quot;quantum swap circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the inital state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |\psi\rangle \otimes |\phi\rangle = |0\rangle|\psi\rangle|\phi\rangle$&lt;/span&gt;, the state before measurement is (unless I'm wrong):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}\left(|0\rangle \left(|\psi\rangle|\phi\rangle + |\phi\rangle|\psi\rangle\right) + |1\rangle \left(|\psi\rangle|\phi\rangle - |\phi\rangle|\psi\rangle\right)\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate the post measurement distribution for the first qubit, in terms of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4728" LastEditorUserId="26" LastEditDate="2018-12-23T11:30:21.227" LastActivityDate="2018-12-23T11:30:21.227" Title="Calculating measurement result of quantum swap circuit" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4415" PostTypeId="1" AcceptedAnswerId="4421" CreationDate="2018-10-16T05:17:52.070" Score="7" ViewCount="730" Body="&lt;p&gt;This question builds off of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2682/hhl-algorithm-controlled-by-eigenvalues-rotations&quot;&gt;this question&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the HHL algorithm, how do you efficiently do the &lt;span class=&quot;math-container&quot;&gt;$\tilde{\lambda}_k$&lt;/span&gt;-controlled rotations on the ancilla qubit? It seems to me that since you don't know the eigenvalues a priori, you would have to control on every single &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; within your eigenvalue bounds &lt;span class=&quot;math-container&quot;&gt;$[\lambda_{\text{min}},\lambda_{\text{max}}]$&lt;/span&gt; (since every &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; requires a different rotation angle), requiring a potentially exponential number of controlled rotations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I kind of get how you can avoid an exponential number of controls in Shor's algorithm, because we can split up the modular exponentiation &lt;span class=&quot;math-container&quot;&gt;$a^x\pmod N$&lt;/span&gt; so that we can deal with each bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; separately, &lt;span class=&quot;math-container&quot;&gt;$a^{2^{k-1}x_{k-1}}a^{2^{k-2}x_{k-2}}...a^{2^0 x_0} \pmod N$&lt;/span&gt;, so you only need as many controls as the number of bits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. But I'm not sure how you can do something similar in the case of HHL, because &lt;span class=&quot;math-container&quot;&gt;$\tilde{\lambda}_k$&lt;/span&gt; is not only in the denominator, but nested inside an arcsin, e.g.&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathrm{Controlled\ Rotation}=\sum_{m \in [\lambda_{\text{min}},\lambda_{\text{max}}]}\underbrace{|m\rangle\langle m|}_{\text{control reg.}} \otimes \underbrace{R_y\left(\sin^{-1}(2C/m) \right)}_{\text{anc reg.}}&#xA;\end{align}&lt;/span&gt;&#xA;where the number of terms in the sum is exponential in the number of bits of precision in &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;. Is there a way to do this more efficiently, and if not, wouldn't this severely eat into the exponential speedup of the algorithm?&lt;/p&gt;&#xA;" OwnerUserId="4841" LastEditorUserId="26" LastEditDate="2019-04-26T19:38:18.623" LastActivityDate="2019-04-26T19:38:18.623" Title="Efficiently performing controlled rotations in HHL" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4416" PostTypeId="2" ParentId="4413" CreationDate="2018-10-16T06:42:41.843" Score="5" Body="&lt;p&gt;Let's start from the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac12\left(|0\rangle(|\psi\rangle|\phi\rangle+|\phi\rangle|\psi\rangle)+|1\rangle(|\psi\rangle|\phi\rangle-|\phi\rangle|\psi\rangle)\right).&#xA;$$&lt;/span&gt;&#xA;There are a couple of ways to do the calculation. If you want to be formal, which typically leads to fewer mistakes, you identify the measurement operators on a single spin&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0=|0\rangle\langle 0|\otimes\mathbb{I}^{2n}\qquad P_1=|1\rangle\langle 1|\otimes\mathbb{I}^{2n}&#xA;$$&lt;/span&gt;&#xA;and you evaluate the probabilities of the two outcomes as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_i=\langle\Psi|P_i|\Psi\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Slightly less formally, but equivalent, you can collect the terms for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, much as you have, but &lt;strong&gt;make sure the state on the other qubits is normalised&lt;/strong&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac12\left(\sqrt{2+2|\langle\psi|\phi\rangle|^2}|0\rangle\frac{|\psi\rangle|\phi\rangle+|\phi\rangle|\psi\rangle}{\sqrt{2+2|\langle\psi|\phi\rangle|^2}}+\sqrt{2-2|\langle\psi|\phi\rangle|^2}|1\rangle\frac{|\psi\rangle|\phi\rangle-|\phi\rangle|\psi\rangle}{\sqrt{2-2|\langle\psi|\phi\rangle|^2}}\right).&#xA;$$&lt;/span&gt;&#xA;Then you can read of the probability amplitude for finding the state in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and take the mod-square to get the probability&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-16T06:42:41.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4417" PostTypeId="2" ParentId="4386" CreationDate="2018-10-16T07:22:45.163" Score="4" Body="&lt;p&gt;I should probably start by describing my philosophical standpoint: I would never talk about &quot;many worlds&quot; or some such. However, I certainly believe that it is possible that everything, including measurement, is unitary. That apparently makes me a many-worldian. It's not necessary to buy wholesale into a picture of diverging worlds. And I think this question demonstrates my (possible) view point quite well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I think of measurement as being like a controlled-not, but because the measurement device is a large device, it's like targetting many qubits. So, if you've got a qubit in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt; that you might be measuring, the post-measurement state would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left(|000\ldots 0\rangle+|111\ldots 1\rangle\right)&#xA;$$&lt;/span&gt;&#xA;(Aside: you might even consider yourself part of the measuring device. At that point, if you're in the 0 branch, you see results 0, and the you're in the 1 branch, you see 1 results).&#xA;The issue is, if this is true, why do we end up describing something post-measurement using classical probabilities, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12\left(|000\ldots 0\rangle\langle000\ldots 0|+|111\ldots 1\rangle\langle 111\ldots 1|\right)?&#xA;$$&lt;/span&gt;&#xA;The answer is basically, that, if you made sure that you did something with &lt;em&gt;every&lt;/em&gt; quantum system that has become entangled as a result of the measurement, you would be able to see a difference between the quantum and classical descriptions (answer c&lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt;d). Miss just one qubit (which may be part of the measurement device, or somewhere else in the environment. there's so many that you'll always miss some), and all subsequent results are as if you had the classical probability distribution (answer a=b).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully you now see how that should correspond to the questions you're being asked. As other commenters have indicated, however, the measurement process that you're performing on the two different systems is the full combination of Hadamards+computational basis measurement.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-16T07:22:45.163" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4418" PostTypeId="2" ParentId="4411" CreationDate="2018-10-16T07:34:00.913" Score="1" Body="&lt;p&gt;Depending on what is your definition of &quot;long time&quot; the answer might be different:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If it is of the order of minutes, then you can't do anything and you just have to wait for your turn in the queue. &lt;/li&gt;&#xA;&lt;li&gt;If it is several days, then there might be a problem (or a very very long queue).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Anyway, you &lt;strong&gt;can&lt;/strong&gt; track the status of your job, even if this status does not include its position within the queue. Here is a (non-tested) example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Setup everything for Qiskit.&#xA;# Create your quantum program&#xA;job = qiskit.execute(my_circuits, the_backend)&#xA;# Ask for the status&#xA;print(job.status()) # will return one of the values listed here:&#xA;                    # https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/backends/jobstatus.py&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-10-16T07:34:00.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4419" PostTypeId="2" ParentId="4413" CreationDate="2018-10-16T09:46:14.333" Score="4" Body="&lt;p&gt;While &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4416/124&quot;&gt;DaftWullie's answer&lt;/a&gt; gives you everything you need to calculate the answer in this particular case, I'd like to focus on a particular approach which is helpful in situations like yours, where you have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit state state&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\!\langle#1\rvert}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{\Psi} = \ket{0}\ket{\alpha} + \ket{1}\ket{\beta}\,,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt; are &lt;strong&gt;not necessarily normalised&lt;/strong&gt; vectors on &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; qubits. (Notice that at least &lt;em&gt;one&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt; must be sub-normalised in this case if &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi}$&lt;/span&gt; has norm 1.) We can then ask: given such a &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi}$&lt;/span&gt;, what distribution do we expect on &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;'Normalising' your superpositions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If you had a &lt;em&gt;very slightly&lt;/em&gt; different representation for &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi}$&lt;/span&gt;, of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{\Psi} = u_0 \ket{0}\ket{\alpha'} + u_1 \ket{1}\ket{\beta'}\,,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha'}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta'}$&lt;/span&gt; were indeed normalised, then you'd probably be comfortable with this: you'd just recognise that the probability of '0' is &lt;span class=&quot;math-container&quot;&gt;$\lvert u_0 \rvert^2$&lt;/span&gt; and the probability of '1' is &lt;span class=&quot;math-container&quot;&gt;$\lvert u_1 \rvert^2$&lt;/span&gt;. But we can obtain this just by considering the norms of &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt;, and computing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ u_0 = \sqrt{\langle \alpha \vert \alpha \rangle}\,,\qquad u_1 = \sqrt{\langle \beta \vert \beta \rangle} $$&lt;/span&gt;&#xA;and (if both &lt;span class=&quot;math-container&quot;&gt;$u_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$u_1$&lt;/span&gt; are non-zero) defining the normalised versions &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha'} \propto \ket{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta'} \propto \ket{\beta}$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{\alpha'} = \tfrac{1}{u_0} \ket{\alpha}\,,\qquad\ket{\beta'} = \tfrac{1}{u_1} \ket{\beta}\,. $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Short-cutting to the measurement probabilities&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;But actually, the states &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha'}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta'}$&lt;/span&gt; are beside the point: what you actually wanted are &lt;span class=&quot;math-container&quot;&gt;$u_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$u_1$&lt;/span&gt;, or more precisely,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Pr\!\big[\,0\,\big] = \lvert u_0 \rvert^2 = \langle \alpha \vert \alpha \rangle\,,\qquad \Pr\!\big[\,1\,\big] = \lvert u_1 \rvert^2 = \langle \beta \vert \beta \rangle\,.$$&lt;/span&gt;&#xA;So you can just compute those inner products without even worrying about representing the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi}$&lt;/span&gt; in one particular way or another, and in particular without giving any thought as to whether or which of &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt; is normalised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your particular case, you have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{\alpha} = \frac{1}{2} \bigl( \ket{\psi}\ket{\phi} + \ket{\phi}\ket{\psi} \bigr) , \qquad \ket{\beta} = \frac{1}{2} \bigl( \ket{\psi} \ket{\phi} - \ket{\phi} \ket{\psi} \bigr); $$&lt;/span&gt;&#xA;then computing the probability of obtaining either '0' or '1' is just a question of computing some inner products, and in particular will give interesting results when &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\phi}$&lt;/span&gt; are either orthogonal (in which case &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt; are both clearly maximally entangled, normalisation aside) or parallel (in which case &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt; is clearly zero).&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-10-16T09:46:14.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4420" PostTypeId="1" CreationDate="2018-10-16T10:00:40.847" Score="5" ViewCount="247" Body="&lt;p&gt;I am currently working on a quantum computing subject for my coding school, and I had some questions for you. My objective would be to introduce students to quantum computing with an algorithmic project. I had two games ideas for it, one of them being harder to implement than the other one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first (the hardest), would be to provide each of the two players a quantum byte, randomly initialized: to do that, we  would apply a Hadamard gate to each qubit in the byte, measure it, use the result of the measurement as the initial state for the byte, and then apply a Hadamard gate to each of the qubits again. This way, the player really has no way to know what lies within the byte. Once the bytes are initialized, each player is given a model of 7 bits he has to reproduce over measurement. For instance, if you are given the string 01110110, you would have to obtain either 01110110 or 11110110 upon measurement, the first qubit being used as a register, allowing the players to apply multi-qubit gates to the byte without alienating the rest of their QuBits. The first player who measures his byte and obtains what he or she was asked to obtain wins. This way students are introduced to quantum state preparation, and might even produce a &lt;code&gt;strToQuBit&lt;/code&gt; type of function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second idea would be similar, but instead of a model of byte they would have to reproduce, the game would be played by two players, one would have to fill their byte with 1s, the other with 0s, in other words, the string they would have to obtain upon measurement would always be either (00000000 or 10000000), or (11111111 or 01111111). The byte would of course still be randomly initialized before players can work with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which idea do you think is the best, and is such a project even doable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I have omitted an important precision: players cannot change the states of the qubits once they have measured it, and all QuBits will be measured at once. Once the whole byte has been measured, either the result corresponds to the model byte and the player wins, or it does not and then a new model byte is assigned to the player who failed! ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this make it more complex?&lt;/p&gt;&#xA;" OwnerUserId="4844" LastEditorUserId="26" LastEditDate="2019-10-14T10:15:46.130" LastActivityDate="2019-10-14T10:15:46.130" Title="Algorithm-based game project to introduce quantum computing" Tags="&lt;algorithm&gt;&lt;games&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4421" PostTypeId="2" ParentId="4415" CreationDate="2018-10-16T10:03:52.610" Score="8" Body="&lt;p&gt;The setting is that you've got some state &lt;span class=&quot;math-container&quot;&gt;$$\sum_{x\in\{0,1\}^n}\alpha_x|x\rangle$$&lt;/span&gt; on a register, you introduce an ancilla in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and you want to create some state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x\in\{0,1\}^n}\alpha_x|x\rangle\otimes R_X(f(x))|0\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is some angle that you can compute. So, certainly, if you had to build that gate out of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; different gates &quot;if register=&lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, then apply &lt;span class=&quot;math-container&quot;&gt;$R_X(f(x))$&lt;/span&gt; on the ancilla&quot; for each &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, that would be a very bad way to go. So, here's another way to think about it.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Firstly, let's not apply &lt;span class=&quot;math-container&quot;&gt;$R_X(f(x))$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$HR_Z(f(x))H$&lt;/span&gt;. The two Hadamards don't have to be controlled off anything because every gate requires them.&lt;/li&gt;&#xA;&lt;li&gt;Secondly, let's assume that we know an efficient classical computation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. That means we can build a reversible quantum computation that runs in the same time. This involves introducing a second register. So, what you'd have is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_x\alpha_x|x\rangle|f(x)\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-bit representation of the value &lt;span class=&quot;math-container&quot;&gt;$2^kf(x)/\pi$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Now, recognise that if you've got some state &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$z\in\{0,1\}^k$&lt;/span&gt;, it's easy to turn it into &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi z 2^k}$&lt;/span&gt; - you apply &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on the most significant bit, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z}$&lt;/span&gt; on the second-most, &lt;span class=&quot;math-container&quot;&gt;$Z^{1/4}$&lt;/span&gt; on the third, &lt;span class=&quot;math-container&quot;&gt;$Z^{1/8}$&lt;/span&gt; on the fourth, and so on (think about how you convert from a binary to a decimal representation). Thus, if you apply these gates but controlled off the ancilla, this achieves exactly what you need.&lt;/li&gt;&#xA;&lt;li&gt;Finally, you have to uncompute the second register.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus, overall, the scaling is limited primarily by the time it takes to compute &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. The point is this happens simultaneously for all values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; due to linearity.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-16T10:03:52.610" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4422" PostTypeId="2" ParentId="4420" CreationDate="2018-10-16T16:32:21.697" Score="8" Body="&lt;p&gt;This is definitely doable, but the tasks seem quite simple and they only introduce single-qubit measurement and the X gate, while quantum state preparation usually involves some superposition and entanglement generation. One can get rid of the input superposition by measuring each qubit and then use a bunch of X gates to set each qubit to the right state, you don't even need the scratch qubit for two-qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am biased in my recommendation, but I would suggest taking a look at the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Katas&lt;/a&gt; project. I created it to help people learn quantum computing; it has some nice tasks of varying complexity and (most importantly) test harnesses that verify that the task solutions are correct. The Superposition kata in particular introduces state preparation. We have had a lot of success using the katas to teach people unfamiliar with quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="4265" LastEditDate="2018-10-16T17:18:54.993" LastActivityDate="2018-10-16T17:18:54.993" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4423" PostTypeId="2" ParentId="4420" CreationDate="2018-10-17T06:13:54.150" Score="3" Body="&lt;p&gt;They certainly seem doable. I'd suggest the first one, as it is a little more complex. For added complexity you could also include constraints on the allowed gates, such as not allowing X or Y on certain qubits, but instead supplying CNOTs (so a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; can be copied from other qubits) or partial rotations around the X and Y axis, such that the X or Y can be built up from multiple applications.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-10-17T06:13:54.150" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4424" PostTypeId="1" CreationDate="2018-10-17T08:52:23.567" Score="4" ViewCount="269" Body="&lt;p&gt;I have been studying on  Quantum Fourier Transform (QFT) by myself, and I am little bit confused about how could QFT be used. &#xA;  For example, if the QFT of three quantum bits is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a_1|000\rangle + a_2|001\rangle + a_3|010\rangle + a_4|011\rangle + a_5|100\rangle + a_6|101\rangle + a_7|110\rangle+&#xA; a_8|111\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;three questions arising in my mind:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Whether or not the useful information is represented by the probability amplitude coefficients (&lt;span class=&quot;math-container&quot;&gt;$a_1,..., a_8$&lt;/span&gt;) of the superposition state? Are these coefficients the same as their counterparts in DFT?&lt;/li&gt;&#xA;&lt;li&gt;To my best knowledge, once a quantum system is measured, the superposition state will be destroyed, and the information represented by the probability coefficients (&lt;span class=&quot;math-container&quot;&gt;$a_1, ..., a_8$&lt;/span&gt;) will be lost. Then how could the coefficients be extracted from by measurements?&lt;/li&gt;&#xA;&lt;li&gt;How is QFT related with Shor’s Algorithm?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you by advance for answers.&lt;/p&gt;&#xA;" OwnerUserId="4853" LastEditorUserId="55" LastEditDate="2018-10-18T11:46:25.310" LastActivityDate="2018-10-18T12:06:51.400" Title="Do the probability amplitudes of the superposition state produced by the QFT transform convey useful information?" Tags="&lt;algorithm&gt;&lt;quantum-information&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4425" PostTypeId="2" ParentId="4424" CreationDate="2018-10-17T09:12:35.020" Score="7" Body="&lt;p&gt;You probably shouldn't be thinking of the Quantum Fourier Transform as being something where you want to extract the outcoming probability amplitudes. As you say, when you start measuring, you destroy the superposition. The only way to extract the amplitudes is to make the same state many, many times, and keep repeating your measurements until you get enough statistics to determine the &lt;span class=&quot;math-container&quot;&gt;$|a_n|^2$&lt;/span&gt; with reasonable accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, think of it as a quantum subroutine. Something that takes a quantum superposition as input, and provides a superposition as output. So, for example, QFT is used as a subroutine within Shor's algorithm. Before application of the QFT, Shor's algorithm has worked very hard to produce a superposition that somehow contains the correct computational answer, but it contains that answer encoded in the relative phases of the superposition. The QFT spits out that relative phase information as a bit string. The trick is that you don't want to know the probability amplitudes. You want to know the bit string that is produced with highest probability (i.e. the value of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$|a_n|^2$&lt;/span&gt; is largest. It occurs with a probability at least &lt;span class=&quot;math-container&quot;&gt;$4/\pi^2$&lt;/span&gt;, if memory serves). In fact, all you do is run the algorithm once. There's a fair chance you've got the right answer, and with a bit of classical post-processing, you can tell whether or not you got the right answer, and hence whether or not you need to run the whole algorithm again.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-17T09:12:35.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4426" PostTypeId="1" AcceptedAnswerId="4429" CreationDate="2018-10-17T17:25:00.750" Score="8" ViewCount="381" Body="&lt;h2&gt;Context:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have been trying to understand the genetic algorithm discussed in the paper &lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.3575402&quot; rel=&quot;nofollow noreferrer&quot;&gt;Decomposition of unitary matrices for finding quantum circuits: Application to molecular Hamiltonians (Daskin &amp;amp; Kais, 2011)&lt;/a&gt; (PDF &lt;a href=&quot;https://drive.google.com/file/d/1OuuBIaDYnzJtkixrvkvc5hsoF8pAbeOu/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) and &lt;a href=&quot;https://arxiv.org/abs/1004.2242&quot; rel=&quot;nofollow noreferrer&quot;&gt;Group Leaders Optimization Algorithm (Daskin &amp;amp; Kais, 2010)&lt;/a&gt;. I'll try to summarize what I understood so far, and then state my queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the example of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli gate&lt;/a&gt; in section III-A in the first paper. We know from other sources such as &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.88.010304&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, that around 5 two-qubit quantum gates are needed to simulate the Toffoli gate. So we arbitrarily choose a set of gates like &lt;span class=&quot;math-container&quot;&gt;$\{V, Z, S, V^{\dagger}\}$&lt;/span&gt;. We restrict ourselves to a maximum of &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; gates and allow ourselves to only use the gates from the gate set &lt;span class=&quot;math-container&quot;&gt;$\{V, Z, S, V^{\dagger}\}$&lt;/span&gt;. Now we generate &lt;span class=&quot;math-container&quot;&gt;$25$&lt;/span&gt; groups of &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; random strings like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; 3 2 0.0; &lt;strong&gt;2&lt;/strong&gt; 3 1 0.0; &lt;strong&gt;3&lt;/strong&gt; 2 1 0.0; &lt;strong&gt;4&lt;/strong&gt; 3 2 0.0; &lt;strong&gt;2&lt;/strong&gt; 1 3&#xA;  0.0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the above string of numbers, the first numbers in bold are the index number of the gates (i.e. &lt;span class=&quot;math-container&quot;&gt;$V = 1, Z = 2, S = 3, Z^{\dagger} = 4$&lt;/span&gt;), the last numbers are the values of the angles in &lt;span class=&quot;math-container&quot;&gt;$[0,2\pi]$&lt;/span&gt; and the middle integers are the target qubit and the control qubits respectively. There would be &lt;span class=&quot;math-container&quot;&gt;$374$&lt;/span&gt; such other randomly generated strings.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4dLaX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4dLaX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our groups now look like this (in the image above) with &lt;span class=&quot;math-container&quot;&gt;$n=25$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p=15$&lt;/span&gt;. The fitness of each string is proportional the trace fidelity &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F} = \frac{1}{N}|\operatorname{Tr}(U_aU_t^{\dagger})|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U_a$&lt;/span&gt; is the unitary matrix representation corresponding to any string we generate and &lt;span class=&quot;math-container&quot;&gt;$U_t$&lt;/span&gt; is the unitary matrix representation of the 3-qubit Toffoli gate. The group leader in any group is the one having the maximum value of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once we have the groups we'll follow the algorithm: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cZdhI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cZdhI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Eq. (4) mentioned in the image is basically:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{new string} [i] = r_1 \times \text{old string}[i] + r_2 \times \text{leader string}[i] + r_3 \times \text{random string}[i]$$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$1 \leq i \leq 20$&lt;/span&gt;) s.t. &lt;span class=&quot;math-container&quot;&gt;$r_1+r_2+r_3 = 1$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$[i]$&lt;/span&gt; represents the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; th number in the string, for example in &lt;code&gt;1 3 2 0.0; 2 3 1 0.0; 3 2 1 0.0; 4 3 2 0.0; 2 1 3 0.0&lt;/code&gt;, the &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;-th element is &lt;code&gt;3&lt;/code&gt;. In this context, we take &lt;span class=&quot;math-container&quot;&gt;$r_1 = 0.8$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r_2,r_3 = 0.2$&lt;/span&gt;. That is, in each iteration, all the &lt;span class=&quot;math-container&quot;&gt;$375$&lt;/span&gt; strings get mutated following the rule: for each string in each group, the individual elements (numbers) in the string gets modified following the Eq. (4). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In addition to the mutation, in each iteration for each group of the&#xA;  population one-way-crossover (also called the parameter transfer) is&#xA;  done between a chosen random member from the group and a random member&#xA;  from a different random group. This operation is mainly replacing some&#xA;  random part of a member with the equivalent part of a random member&#xA;  from a different group. The amount of the transfer operation for each&#xA;  group is defined by a parameter called transfer rate, here, which is&#xA;  defined as &lt;span class=&quot;math-container&quot;&gt;$$\frac{4\times \text{max}_{\text{gates}}}{2} - 1$$&lt;/span&gt; where&#xA;  the numerator is the number of variables forming a numeric string in&#xA;  the  optimization.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Questions:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When we are applying this algorithm to find the decomposition of a random gate, how do we know the number and type of elementary gates we need to take in our gate set? In the example above they took &lt;span class=&quot;math-container&quot;&gt;$\{V,Z,S,V^{\dagger}\}$&lt;/span&gt;. But I suspect that that choice was not completely arbitrary (?) Or could we have chosen something random like &lt;span class=&quot;math-container&quot;&gt;$\{X,Z,R_x,R_{zz},V\}$&lt;/span&gt; too? Also, the fact that they used only &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; gates in total, isn't arbitrary either (?) So, could someone explain the logical reasoning we need to follow when choosing the gates for our gate set and choosing the number of gates to use in total? (It is mentioned in the papers that the maximum possible value of the number of gates is restricted to &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; in this algorithm)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After the part (in &quot;Context&quot;) discussing the selection of the gate set and number of gates,is my explanation/understanding (paragraph 3 onwards) of the algorithm correct? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I didn't quite understand the meaning of &quot;parameter transfer rate&quot;. They say that &lt;span class=&quot;math-container&quot;&gt;$4\times \text{max}_{\text{gates}} - 2$&lt;/span&gt; is the &lt;em&gt;number of variables forming a numeric string in the optimization&lt;/em&gt;. What is &lt;span class=&quot;math-container&quot;&gt;$\text{max}_{\text{gates}}$&lt;/span&gt; in this context: &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt;? Also, what exactly do they mean by the portion I italicized (&lt;em&gt;number of variables forming a numeric string in the optimization&lt;/em&gt;) ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do we know when to terminate the program? Do we terminate it when any one of the group leaders cross a desired value of trace fidelity (say &lt;span class=&quot;math-container&quot;&gt;$0.99$&lt;/span&gt;)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-02T19:12:02.937" LastActivityDate="2019-04-02T19:12:02.937" Title="Understanding the Group Leaders Optimization Algorithm" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4428" PostTypeId="2" ParentId="4420" CreationDate="2018-10-17T19:57:03.667" Score="2" Body="&lt;p&gt;Consider the task on one qubit. You are given a state that is either &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle$&lt;/span&gt; and your task before the measurement is to get it to be either more probably &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as instructed. Say you were instructed to get 0, then you are trying for a unitary that takes both &lt;span class=&quot;math-container&quot;&gt;$H \mid 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H | 1 \rangle$&lt;/span&gt; to states close to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Say you do &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; then you are good on half the initial states but not on the other half. Same if you do &lt;span class=&quot;math-container&quot;&gt;$XH$&lt;/span&gt;. The probabilities are &lt;span class=&quot;math-container&quot;&gt;$\mid\langle 0 | U H | i \rangle \mid^2$&lt;/span&gt; where i indicates the starting and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is what you do with it. But&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mid\langle 0 | U H | 0 \rangle \mid^2 + \mid\langle 0 | U H | 1 \rangle \mid^2 =\\&#xA;\mid\langle 0 | H U^\dagger | 0 \rangle \mid^2 + \mid\langle 1 | H U^\dagger | 0 \rangle \mid^2 = 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so as you make the probability to get &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; when you start in &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle$&lt;/span&gt; larger, you worsen the other case. Similarly if you were asked to get &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the probability that if it started in &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle$&lt;/span&gt; you got it into the desired result. There is &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt; that if it started in &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle$&lt;/span&gt; you got it into the desired result. Combine those &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}p + \frac{1}{2}(1-p) = \frac{1}{2}$&lt;/span&gt;. No matter what you do, you can't escape the randomness of the initial state. If you knew something more about it then you could win, but right now you don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were allowed to do processing after the measurement, then do what Mariia suggested. But as stated it's a coin flip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the state was entangled then you could use some information that way, but right now the problem is broken up into each qubit.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-10-17T19:57:03.667" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4429" PostTypeId="2" ParentId="4426" CreationDate="2018-10-17T22:31:02.880" Score="2" Body="&lt;p&gt;I suggest looking at how a genetic algorithm works in a context of discrete variables to understand it. They provide a methodology but you can apply other mutation/crossover techniques.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Briefly, in a simple optimization problem where the variables are discrete, we can solve heuristically with genetic algorithms (which belongs to the class evolutionary algorithms). We generate a population of candidates (randomly) and we change the candidates at each iteration to try to find a good solution minimizing/maximizing an objective function (called fitness). You can represent the candidates by a string of values (called chromosomes in general). If you input this string of values to the objective function, you are evaluating the candidate or you assigning a fitness. Crossover/mutation operations are meant to change candidates and hope for achieving our objective in a way related to what happens in genetic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The GLOA is just another genetic algorithms but with the difference of having different groups of population with a local optimum (leader as best candidate if you prefer) for each and of course a slightly different strategy for mutation/crossover. Usually, we have one group of candidates with one best candidate at each iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now for your questions:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; You can choose whatever set of gates you want (like your example of a set). This is also true for the maximum number of gate operations you want to restrict your decomposition. Those are just parameters for the algorithm. I would say this is completely arbitrary (not so much logic necessarily just heuristic) but maybe what they chose was more adapted to their example or setup of work. In practice, you would have to try many parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; You are kinda retaking the original explanations and especially the diagram so I think you are summing up well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7gd3L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7gd3L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; I suggest looking at Figure 2 which shows the pseudo-code of this part to understand it. This is similar to one-way crossover in genetic algorithms.&#xA;If you look at their original algorithm (GLOA, 2010), they choose a number &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and half of the number of total parameters (variables) plus one. In this case, the number of parameters/variables is the length of a string which is &lt;span class=&quot;math-container&quot;&gt;$4 \times \text{max}_{\text{gates}}$&lt;/span&gt;. For the Toffoli gate, it was &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;. For other examples, it could have been more. But in general, they recommend &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; as a good maximum (you can imagine how hard the optimization is with strings of more than &lt;span class=&quot;math-container&quot;&gt;$80$&lt;/span&gt; variables on a simple computer). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your visualization, look at the example string you give :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; 3 2 0.0; &lt;strong&gt;2&lt;/strong&gt; 3 1 0.0; &lt;strong&gt;3&lt;/strong&gt; 2 1 0.0; &lt;strong&gt;4&lt;/strong&gt; 3 2 0.0; &lt;strong&gt;2&lt;/strong&gt; 1 3 0.0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here, a string represents a set of operations forming a circuit. We associate with it a fitness, which is related to the fidelity. It is like a candidate solution for our optimization problem. In that case, our &lt;span class=&quot;math-container&quot;&gt;$\text{max}_{\text{gates}}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; because you see &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; operations represented. Each operation is a gate of the set, the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits it applies to and the angle if necessary, that is &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; variables. In total, &lt;span class=&quot;math-container&quot;&gt;$5 \times 4 = 20$&lt;/span&gt; variables for the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1 3 2 0.0&lt;/code&gt;, in this case, means apply the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; gate on qubit &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; controlled by qubit &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; with an angle &lt;span class=&quot;math-container&quot;&gt;$0.0$&lt;/span&gt; (note that with the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; gate there is no angle but say you were playing with like rotation gates, this becomes relevant).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; This is also arbitrary depending on what you want. It can be a fixed number of iterations, or until you reach a threshold/convergence criteria.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-10-17T23:05:26.627" LastActivityDate="2018-10-17T23:05:26.627" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4430" PostTypeId="1" AcceptedAnswerId="4431" CreationDate="2018-10-18T02:01:23.727" Score="4" ViewCount="206" Body="&lt;p&gt;I have read about how Alice can send Bob a qubit &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta|1\rangle$&lt;/span&gt; if they share an EPR pair. This gives an initial state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\alpha |0\rangle + \beta|1\rangle) \otimes (\frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first two qubits belong to Alice, the third belongs to Bob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step is for Alice to apply a controlled not from first qubit onto her half of the EPR pair. This gives the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} \big(\alpha (|000\rangle + |011\rangle) + \beta (|110\rangle + |101\rangle)\big)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, let us say that Alice measures her second qubit. This has a 50/50 chance of resulting in a zero or a one. That leaves the system in one of two states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha |000\rangle + \beta |101\rangle \quad\text{OR}\quad \alpha |011\rangle + \beta |110\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Alice measures the second qubit as zero, she is in the first state. She can tell Bob: &quot;Your half of the EPR is now the qubit I wanted to send you.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Alice measures the second qubit as one, she is in the second state. She can tell Bob: please apply the matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 1\\&#xA;1 &amp;amp; 0&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to your qubit to flip the roles of zero and one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hasn't Alice teleported her qubit at this point?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only problem I see is this: Alice must continue not to measure her original qubit. If her unmeasured qubit were to be measured, that would force Bob's qubit to collapse as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this therefore why Alice needs to apply a Hadamard matrix to her first qubit? Let us apply the Hadamard to the state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha |000\rangle + \beta |101\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is one of the two possibilities from above). We get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\frac{1}{\sqrt{2}} \big(&#xA;(\alpha |000\rangle + \beta |001\rangle)&#xA;(\alpha |100\rangle - \beta |101\rangle)&#xA;\big)&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice measures her first qubit now. If it is a zero, she can tell Bob: your qubit is fine. If it is one, she can tell Bob: you need to fix it from &lt;span class=&quot;math-container&quot;&gt;$\alpha |100\rangle - \beta |101\rangle$&lt;/span&gt; (by an appropriate rotation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, my questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If Alice is okay with sharing an entangled copy of the transfered qubit with Bob, can she send just the first classical bit?&lt;/li&gt;&#xA;&lt;li&gt;Is the application of the Hadamard simply to separate Alice's first qubit from Bob's qubit?&lt;/li&gt;&#xA;&lt;li&gt;It is the application of the Hadamard to Alice's first qubit, followed by the measurement, which may disturb Bob's qubit, possibly necessitating a &quot;fixup.&quot; The second classical bit is transferred to communicate whether the fixup is needed. Am I correct?&lt;/li&gt;&#xA;&lt;li&gt;The reason Alice wants Bob to have a qubit unentangled from her own is probably because it is burdensome for Alice to keep an entangled copy from being measured. Correct?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sorry for the very long and rambly question. I &lt;em&gt;think&lt;/em&gt; I understand, but maybe this writeup will help someone else.&lt;/p&gt;&#xA;" OwnerUserId="4862" LastEditorUserId="26" LastEditDate="2018-12-13T21:01:06.520" LastActivityDate="2018-12-13T21:01:06.520" Title="Quantum teleportation: second classical bit for removing entanglement?" Tags="&lt;entanglement&gt;&lt;communication&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4431" PostTypeId="2" ParentId="4430" CreationDate="2018-10-18T07:52:43.617" Score="7" Body="&lt;p&gt;Your initial calculations are correct. When Alice performs her first measurement and gets a 0 outcome then, as you say, Alice and Bob are left sharing a two-qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\alpha|00\rangle+\beta|11\rangle&#xA;$$&lt;/span&gt;&#xA;(you can safely ignore the measured qubit). The problem is the statement&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;She can tell Bob: &quot;Your half of the EPR is now the qubit I wanted to send you.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;because it doesn't make sense. It kind of looks like the amplitudes are doing the right sort of thing, but it's not quite enough. The two qubits are entangled, and you need the second measurement to remove that entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this more clearly, what it &lt;em&gt;should&lt;/em&gt; mean if Bob has received the state is that if he performs a measurement that projects onto one of two states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp\rangle=\beta|0\rangle-\alpha|1\rangle$&lt;/span&gt;, then Bob &lt;em&gt;must&lt;/em&gt; always get the answer corresponding to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. So, let's try it. We get the required answer with probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Psi|(\mathbb{I}\otimes|\psi\rangle\langle\psi|)|\Psi\rangle=|\alpha|^4+|\beta|^4&#xA;$$&lt;/span&gt;&#xA;Since we know that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;, this is not generally equal to 1. (It could be if &lt;span class=&quot;math-container&quot;&gt;$\alpha\beta=0$&lt;/span&gt;). So, you can see that the outcomes of experiments that Bob performs on his half of the state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; do not match up perfectly with what he should get if he were experimenting with the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; which he should have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way of thinking about it is that if Bob holds the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that he's supposed to after teleportation, nothing that Alice can do should be able to change it. But when they share &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;, she certainly can change it. That's why the measurement basis of her second measurement is so important - there must be no Z component to the measurement because otherwise she would learn something about the state being sent (in other words, she'd collapse the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;If Alice is okay with sharing an entangled copy of the transfered qubit with Bob, can she send just the first classical bit?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. Bob has not received the state at this point, as I hope I've conveyed.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;4&quot;&gt;&#xA;  &lt;li&gt;The reason Alice wants Bob to have a qubit unentangled from her own is probably because it is burdensome for Alice to keep an&#xA;  entangled copy from being measured. Correct?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, it's so that Bob actually receives the state he's supposed to.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;Is the application of the Hadamard simply to separate Alice's first qubit from Bob's qubit?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No. The separation doesn't happen at this point. It only happens in the act of measurement that follows. The Hadamard is important for changing the state so that Alice only removes the entanglement and does not collapse the state of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;3&quot;&gt;&#xA;  &lt;li&gt;It is the application of the Hadamard to Alice's first qubit, followed by the measurement, which may disturb Bob's qubit, possibly&#xA;  necessitating a &quot;fixup.&quot; The second classical bit is transferred to&#xA;  communicate whether the fixup is needed. Am I correct?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Pretty much. The measurement is guaranteed to disturb the qubit, because it does change after the measurement. But, as you say, the bit of communication is required to convey how it changed, and therefore what fix is required.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-18T07:52:43.617" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4432" PostTypeId="2" ParentId="4411" CreationDate="2018-10-18T10:01:40.877" Score="2" Body="&lt;p&gt;Here is tested code (also provided in one of the qiskit tutorials)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;lapse = 0&#xA;interval = 60&#xA;while not job.done:&#xA;    print('Status @ {} seconds'.format(interval * lapse))&#xA;    print(job.status)&#xA;    time.sleep(interval)&#xA;    lapse += 1&#xA;print(job.status)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where interval is giving in seconds (if your job requires longer waiting and execution, I would suggest to increase it). This will provide you information about your queue placement. &lt;/p&gt;&#xA;" OwnerUserId="563" LastActivityDate="2018-10-18T10:01:40.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4433" PostTypeId="2" ParentId="4424" CreationDate="2018-10-18T12:06:51.400" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The probability amplitudes of a quantum state are what characterises the state itself. In this sense, they convey &lt;em&gt;all&lt;/em&gt; of the information. The modulus squared of &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; gives the probability of finding the system in the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th state (for example, &lt;span class=&quot;math-container&quot;&gt;$\lvert a_2\rvert^2$&lt;/span&gt; is the probability of finding your system in the state &lt;span class=&quot;math-container&quot;&gt;$\lvert 001\rangle$&lt;/span&gt;). Furthermore, the phases of &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; give information about the way the state will turn out when subjected to some evolution.&lt;/p&gt;&#xA;&lt;p&gt;These coefficients are &lt;em&gt;not&lt;/em&gt; the same as their counterparts in the context of the DFT, in the sense that the DFT produces as output a list of numbers written in your computer, while the QFT is a physical operation that produces &lt;em&gt;a quantum state&lt;/em&gt; whose amplitudes are related to the amplitudes of the initial state via the DFT. In particular, while one has in principle complete knowledge about the output of a DFT of some vector, you &lt;em&gt;do not&lt;/em&gt; have direct access to the amplitudes of the quantum state that is obtained after applying the QFT to some state.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Yes, measuring the system will only give you one of the states of which the system is in a superposition of. Measuring your state you might get the second output, then the fourth, and so forth. &lt;em&gt;If you perform the measurement many times&lt;/em&gt;, however, you will recover &lt;span class=&quot;math-container&quot;&gt;$\lvert a_i\rvert^2$&lt;/span&gt; into the frequencies with which you observe the different outcomes. More generally, one can (but generally does not want to) perform &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum state tomography&lt;/a&gt; to completely reconstruct the amplitudes of a state.&lt;/p&gt;&#xA;&lt;p&gt;However, it is important to notice that reconstructing a state via tomography is highly inefficient, and will most likely destroy all the advantages you would have gained by running a given quantum algorithm. Instead, the usefulness of the QFT (and similar operations) is that, if you set things up correctly, you can get the answer to whatever question you are asking more or less directly. For example, say the answer to your question is &amp;quot;3&amp;quot;, then you might have an algorithm which generates a quantum state such that, after application of the QFT, evolves into the state &lt;span class=&quot;math-container&quot;&gt;$\lvert001\rangle$&lt;/span&gt;, that is, the &lt;em&gt;third&lt;/em&gt; state using your notation.&#xA;Note that such a state does not have the problem abovementioned: if you measure the output and find it to be &amp;quot;3&amp;quot;, then that is the answer to the problem (in an ideal scenario at least).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They are related in that the QFT is a fundamental ingredient of Shor's factorisation algorithm. Very roughly speaking, &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;the idea&lt;/a&gt; is to reduce the problem of factoring to the problem of period finding, and then period finding can be efficiently solved using the QFT. If you want more details about this process I would ask it in a separate question though.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="55" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-10-18T12:06:51.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4434" PostTypeId="1" CreationDate="2018-10-18T14:28:07.917" Score="1" ViewCount="63" Body="&lt;p&gt;When I look at &lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/doc/quprog.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;QCL&lt;/a&gt; (the documentation of the language begins in chapter 3) I don't see a way to compute the tensor product between two q-bits.  Is the programming operator &lt;code&gt;&amp;amp;&lt;/code&gt; doing the tensor product's job?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="10480" LastEditDate="2021-03-20T23:16:38.520" LastActivityDate="2021-04-19T23:56:16.583" Title="How to compute the tensor product in QCL?" Tags="&lt;programming&gt;&lt;tensor-product&gt;&lt;qcl&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4435" PostTypeId="1" CreationDate="2018-10-18T14:33:45.100" Score="1" ViewCount="657" Body="&lt;p&gt;It seems &lt;span class=&quot;math-container&quot;&gt;$V(\pi/2, \qr{1}) = i \qr{1}.$&lt;/span&gt;  I didn't expect that.  To me &lt;span class=&quot;math-container&quot;&gt;$\qr{1}$&lt;/span&gt; points up because &lt;span class=&quot;math-container&quot;&gt;$\qr{0}$&lt;/span&gt; points to the right.  So rotating &lt;span class=&quot;math-container&quot;&gt;$\qr{1}$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; &#xA;should yield &lt;span class=&quot;math-container&quot;&gt;$-\qr{0}$&lt;/span&gt;.  What am I missing here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\q}[2]{\langle #1 | #2 \rangle}&#xA;\newcommand{\qr}[1]{|#1\rangle} &#xA;\newcommand{\ql}[1]{\langle #1|}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2018-12-23T11:28:47.903" LastActivityDate="2018-12-23T11:28:47.903" Title="Why does a rotation of $\pi/2$ on $|1\rangle$ yield $i|1\rangle$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4436" PostTypeId="2" ParentId="4435" CreationDate="2018-10-18T15:01:01.227" Score="4" Body="&lt;p&gt;When people talk about single qubit rotations, the rotations they are visualising are generally rotations on the Bloch Sphere. In this picture, orthogonal states are represented by vectors that point in opposite directions, so &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; points up while &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; points down.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ff2Dl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ff2Dl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Since the Bloch sphere is a 3 dimensional shape, there is a lot of freedom to pick the axis that is being rotated about. Since you don't define &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; or describe where it comes from, I can only guess, but my guess would be that you're talking about a rotation about the Z axis, which preserves the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, up to phases. You're probably thinking (more or less) about a rotation about the X axis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-18T15:01:01.227" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4437" PostTypeId="1" AcceptedAnswerId="5233" CreationDate="2018-10-18T15:28:58.990" Score="4" ViewCount="165" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Hidden_subgroup_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;hidden subgroup problem&lt;/a&gt; is often cited as a generalisation of many problems for which efficient quantum algorithms are known, such as factoring/period finding, the discrete logarithm problem, and Simon's problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is the following: given a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; defined over a group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; such that, for some subgroup &lt;span class=&quot;math-container&quot;&gt;$H\le G$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant over the cosets of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, find &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (through a generating set).&#xA;In this context, &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is given as an oracle, which means that we don't care about the cost of evaluating &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; for different &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, but we only look at the number of times &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; must be evaluated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is often stated that a quantum computer can solve the hidden subgroup problem efficiently when &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is abelian. The idea, as stated for example &lt;a href=&quot;https://en.wikipedia.org/wiki/Hidden_subgroup_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the wiki page&lt;/a&gt;, is that one uses the oracle to get the state &#xA;&lt;span class=&quot;math-container&quot;&gt;$\lvert gH\rangle\equiv\sum_{h\in H} \lvert gh\rangle$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt;, and then the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;QFT&lt;/a&gt; is used to efficiently recover from &lt;span class=&quot;math-container&quot;&gt;$\lvert gH\rangle$&lt;/span&gt; a generating set for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that sampling from &lt;span class=&quot;math-container&quot;&gt;$\operatorname{QFT}\lvert gH\rangle$&lt;/span&gt; is somehow sufficient to efficiently reconstruct &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, for a generic subgroup &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;? If yes, is there an easy way to see how/why, in the general case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-01-15T10:51:51.587" LastActivityDate="2019-01-20T09:34:55.973" Title="Why does Fourier sampling allow to efficiently recover hidden subgroups?" Tags="&lt;algorithm&gt;&lt;quantum-fourier-transform&gt;&lt;fourier-sampling&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4438" PostTypeId="1" AcceptedAnswerId="4460" CreationDate="2018-10-18T17:24:56.923" Score="2" ViewCount="106" Body="&lt;p&gt;I was wondering where to look for open Ph.D. positions for specific sub-fields/topics of quantum computing like error correction, optimization, quantum chemistry, etc. It is preferable if the offers/positions can be sorted subfield-wise or topic-wise.   &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-10-20T15:06:10.010" LastActivityDate="2018-10-20T15:06:10.010" Title="Resources to keep a track on open Ph.D. positions in specific sub-fields/topics of quantum computing" Tags="&lt;resource-request&gt;" AnswerCount="1" CommentCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="4439" PostTypeId="1" CreationDate="2018-10-18T17:31:39.187" Score="2" ViewCount="102" Body="&lt;p&gt;My question is definitely regarding quantum-speedup but the quantum-speedup tag is confined to algorithms... and my question is &lt;strong&gt;definitely not&lt;/strong&gt; on algorithms.  So, this is just my best shot at tagging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://dml.riken.jp/images/pub/nori/pdf/PWJan14ball.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This article&lt;/a&gt; in Physics World discusses quantum speedup and makes some pretty provocative statements (examples below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It also tells me that people in a forum like this one might feel as follows:&#xA;“Some feel that this debate about the “how” of quantum computation is a red herring. “Researchers attending most conferences in quantum computing never mention these issues, or only in discussions over beer”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some of those &quot;provocative statements&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;“None of the explanations for how quantum computers achieve speed-up is universally accepted.”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;“If it’s not from the vastness of Hilbert space, not from entanglement and not interference, then what? “As far as I am aware, right now it’s pretty silent in the theatre where this question is played out – that’s because the main candidates are all dead...”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here are two specific questions.&lt;/strong&gt;&#xA;As a worker in this field, does the following statement from the 2014 Physics World article match your own perception here in 2018?  If not, what are the favored candidates today?  And again, this is not a question about speedups obtained via algorithmic refinement. Why exclude algorithmic refinement?  See &quot;Footnote&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Deutsch’s notion of quantum parallelism has stuck – the standard explanation in popular descriptions of quantum-computing speed-up is still that massively parallel computation takes place...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Footnote: Why exclude algorithmic refinements?&lt;/strong&gt; &#xA;Again from that article:&#xA;“Designing good quantum algorithms is a very difficult task,” Van den Nest agrees. “I believe this task could be made lighter if we were to arrive at a systematic understanding of the possible ways to move from classical to quantum computing” – in other words, &lt;strong&gt;if we had a better grasp of which aspect of quantum physics the advantages ultimately stem from&lt;/strong&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just noticed that link is going be unfamiliar (to me too). So I vetted it just a little.  The home page says: &quot;Dr. Franco Nori is a RIKEN Chief Scientist, heading the “Theoretical Quantum Physics Laboratory” at the “Cluster for Pioneering Research” at Riken, Saitama, Japan. He is also at the University of Michigan, Ann Arbor, USA&quot;&lt;/p&gt;&#xA;" OwnerUserId="4865" LastEditorUserId="4865" LastEditDate="2018-10-19T21:49:42.427" LastActivityDate="2018-10-19T21:49:42.427" Title="Physics World - Questioning quantum speed" Tags="&lt;speedup&gt;" AnswerCount="0" CommentCount="14" ClosedDate="2018-10-19T07:21:20.943" ContentLicense="CC BY-SA 4.0" />
  <row Id="4440" PostTypeId="1" AcceptedAnswerId="4445" CreationDate="2018-10-18T19:25:59.780" Score="7" ViewCount="252" Body="&lt;p&gt;I'd like to be able to program simple functions into simulators such as &lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/qcl.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QCL&lt;/a&gt;.  I read that any function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be implemented, but I don't know how to get say a unitary matrix that implements &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;&#xA;I think first I must figure out a function that mimics &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; in a reversible way.  I think that &lt;span class=&quot;math-container&quot;&gt;$$U_f\qr{x}\qr{0} = \qr{x}\qr{0 \oplus f(x)}$$&lt;/span&gt; does it.  However, how do I implement this as a circuit?  Please give a simple example, if you would.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2018-12-23T11:28:00.580" LastActivityDate="2019-01-21T15:44:52.830" Title="What's an example of building a circuit $U_f$ that implements a simple function $f$?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4441" PostTypeId="2" ParentId="4435" CreationDate="2018-10-18T20:28:10.870" Score="3" Body="&lt;p&gt;First off, you may have some misunderstanding regarding the placement of Bloch vectors on the sphere. The placement of a state on the sphere is dictated by the following parametrisation of this state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\cos\theta/2\,|0\rangle+e^{i\phi}\sin\theta/2\,|1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The parameters (&lt;span class=&quot;math-container&quot;&gt;$\theta, \phi$&lt;/span&gt;) are then taken as the tangential and azimuthal angles for the Bloch vector representation. As such, the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; vectors, parametrised by &lt;span class=&quot;math-container&quot;&gt;$(0, 0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2\pi, 0)$&lt;/span&gt; respectively, are parallel to one another on the sphere – as confusing as it may seem – since &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; points up (by convention) and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; points down. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, it seems that you are rotating about the Z axis, instead of about the X or Y axis.&#xA;The exponentiated operator &lt;span class=&quot;math-container&quot;&gt;$e^{-i\alpha/2\,{\rm Z}}=:{\rm R}_{\rm Z}(\alpha)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha\in(-2\pi, 2\pi]$&lt;/span&gt;, is a rotation about the Z axis, and has the following matrix form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm R}_{\rm Z}(\alpha)=&#xA;\begin{bmatrix}e^{-i\alpha/2}&amp;amp;0\\&#xA;0&amp;amp;e^{i\alpha/2}\end{bmatrix}.$$&lt;/span&gt;&#xA;You can check that this indeed corresponds to a Z rotation of a Bloch vector by the same angle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming you took &lt;span class=&quot;math-container&quot;&gt;$V(\beta,|\psi\rangle)={\rm R}_{\rm Z}(2\beta)|\psi\rangle$&lt;/span&gt;, apply this operator to the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state with &lt;span class=&quot;math-container&quot;&gt;$\beta=\frac\pi2$&lt;/span&gt; and you get &lt;span class=&quot;math-container&quot;&gt;${\rm R}_{\rm Z}(\pi)|1\rangle=e^{i\pi/2}|1\rangle=i|1\rangle.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The X and Y rotation operators, on the other hand, look like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${\rm R}_{\rm X}(\alpha)=e^{-i\alpha/2\,{\rm X}}=&#xA;\begin{bmatrix}\cos\alpha/2&amp;amp;-i\sin\alpha/2\\&#xA;-i\sin\alpha/2&amp;amp;\cos\alpha/2\end{bmatrix},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${\rm R}_{\rm Y}(\alpha)=e^{-i\alpha/2\,{\rm Y}}=&#xA;\begin{bmatrix}\cos\alpha/2&amp;amp;-\sin\alpha/2\\&#xA;\sin\alpha/2&amp;amp;\cos\alpha/2\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the same reasoning, let us apply &lt;span class=&quot;math-container&quot;&gt;${\rm R}_{\rm X}(\pi)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;${\rm R}_{\rm Y}(\pi)$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${\rm R}_{\rm X}(\pi)|1\rangle=-i\sin\pi/2\,|0\rangle+\cos\pi/2\,|1\rangle=-i|0\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${\rm R}_{\rm Y}(\pi)|1\rangle=-\!\sin\pi/2\,|0\rangle+\cos\pi/2\,|1\rangle=-|0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Long story short, it depends on the axis about which you rotate (as is always the case with rotations). In this case you were expecting a Y rotation, but you did a Z rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, I highly recommend you check out &lt;a href=&quot;http://www.vcpc.univie.ac.at/~ian/hotlist/qc/talks/bloch-sphere-rotations.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; excellent lecture by Ian Glendinning on Pauli rotations.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastActivityDate="2018-10-18T20:28:10.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4442" PostTypeId="1" AcceptedAnswerId="4446" CreationDate="2018-10-18T20:54:18.903" Score="4" ViewCount="297" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt; I gave myself the task of building an operator that implements the following function: &lt;span class=&quot;math-container&quot;&gt;$f(0) = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(1) = 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(2) = 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(3) = 0$&lt;/span&gt;.  I restricted myself to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; up to 2 bits.  That is, &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; tells the parity of its argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read that in order to be reversible, a circuit &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; could be defined to have the following effect: &lt;span class=&quot;math-container&quot;&gt;$U_f\qr{x}_2 \qr{0}_1 \to \qr{x}_2\qr{0 \oplus f(x)}_1$&lt;/span&gt;.  After doing my calculations, I think the following matrix represents &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix} \otimes I_2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm really not sure.  I once read that this definition isn't complete, that I should also define the behavior for the input &lt;span class=&quot;math-container&quot;&gt;$\qr{x}_2\qr{1}$&lt;/span&gt;.  (I'm not too clear on that.)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So --- though confused ---, I went ahead and defined &lt;span class=&quot;math-container&quot;&gt;$$U_f\qr{x}_2 \qr{1}_1 \to \qr{x}_2\qr{1 \oplus f(x)}_1.$$&lt;/span&gt;  Doing my calculations again, I get the following matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix} \otimes I_2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I don't know which should be my matrix.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2018-10-24T03:38:00.027" Title="What is the matrix for the operator that implements a function to tell the parity of its argument?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4443" PostTypeId="2" ParentId="4440" CreationDate="2018-10-18T21:15:51.473" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;It would really depend on f. Say for instance you want to compute &lt;span class=&quot;math-container&quot;&gt;$f(x) = 3*x$&lt;/span&gt; :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_f\qr{x}\qr{3}\qr{0} = \qr{x}\qr{3}\qr{3*x}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need a &lt;a href=&quot;https://arxiv.org/abs/1706.05113&quot; rel=&quot;nofollow noreferrer&quot;&gt;multiplier circuit like this one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can mimic simple operations with NOT, CNOT, Toffoli... For example, create a function which verify a set of clauses in your bits like it is done in SAT problems. It will output a bit 1 if it satisfy the set, 0 otherwise. The whole circuit will be represented by a unitary operation.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="23" LastEditDate="2019-01-21T13:12:44.690" LastActivityDate="2019-01-21T13:12:44.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4444" PostTypeId="2" ParentId="4440" CreationDate="2018-10-18T21:30:39.593" Score="4" Body="&lt;p&gt;Firstly, I would like to mention that it is more common to use&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm U}_f|x\rangle|0\rangle=|x\rangle|f(x)\rangle$$&lt;/span&gt;&#xA;instead of what you wrote down. (By the way, &lt;span class=&quot;math-container&quot;&gt;$0\oplus f(x)$&lt;/span&gt; is simply &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what you want completely depends on &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and the domain of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. If for example &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is allowed only to be a computational basis state, &lt;span class=&quot;math-container&quot;&gt;$f(x)=x$&lt;/span&gt; could be implemented easily with a CNOT gate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm C}_{\rm X}|0\rangle|0\rangle=|0\rangle|0\rangle,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm C}_{\rm X}|1\rangle|0\rangle=|1\rangle|1\rangle;$$&lt;/span&gt;&#xA;however if &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is a general quantum state, &lt;span class=&quot;math-container&quot;&gt;$f(x)=x$&lt;/span&gt; cannot be implemented in this form since that would violate the no-cloning theorem. In this case, you should simply read out the first qubit. This shows that sometimes (i.e. when &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be represented as a unitary operator) you don't even need a second state.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastActivityDate="2018-10-18T21:30:39.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4445" PostTypeId="2" ParentId="4440" CreationDate="2018-10-18T21:55:21.277" Score="10" Body="&lt;p&gt;For me the problem with understanding quantum oracles was figuring out how they work if the input is in superposition. The answer is: build the oracle so that it is a unitary which does the right thing for inputs in each of the computational basis states, and it will do the right thing for the superposition due to linearity of the unitary transformation. I don't want to write out the formulas here, you can look up a more detailed explanation &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-concepts-10-oracles&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;&#xA;Now, to the examples.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest function to implement is the constant function &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;. Indeed,  &lt;span class=&quot;math-container&quot;&gt;$U_0\qr{x}\qr{y} = \qr{x}\qr{y \oplus 0} = \qr{x}\qr{y}$&lt;/span&gt; - that's just an identity matrix, which you can program as doing exactly nothing :-)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The constant function &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; is the next easiest thing: &lt;span class=&quot;math-container&quot;&gt;$U_0\qr{x}\qr{y} = \qr{x}\qr{y \oplus 1}$&lt;/span&gt;, and all you need to do is to apply an X gate to the output qubit.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How about a function which actually depends on its input values, for example, &lt;span class=&quot;math-container&quot;&gt;$f(x) = x_k$&lt;/span&gt; (if the k-th qubit of the input is in &lt;span class=&quot;math-container&quot;&gt;$\qr{1}$&lt;/span&gt; state, flip the state of the output qubit)? You need to make sure that it works if &lt;span class=&quot;math-container&quot;&gt;$x_k = 0$&lt;/span&gt; (doing nothing) and if &lt;span class=&quot;math-container&quot;&gt;$x_k = 1$&lt;/span&gt; (flipping the state of y). This can be done by a CNOT with the k-th qubit of the input used as a control and the output qubit as a target.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can find more complicated examples in the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas&lt;/a&gt; and try to actually implement them. Writing the oracles are covered in Deutsch-Jozsa algorithm, Simon's algorithm and Grover's algorithm katas (each kata covers writing oracles used in the respective algorithm). My favorite one is probably the oracle which implements the majority function on 3 qubits.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="26" LastEditDate="2019-01-21T15:44:52.830" LastActivityDate="2019-01-21T15:44:52.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4446" PostTypeId="2" ParentId="4442" CreationDate="2018-10-18T22:08:08.127" Score="5" Body="&lt;p&gt;All quantum operators must be unitary. Unitary means the conjugate-transpose of the operator is its inverse. In your case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$UU^{\dagger} = \begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 2 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it is most certainly not unitary because &lt;span class=&quot;math-container&quot;&gt;$UU^{\dagger} \neq \mathbb{I}_4$&lt;/span&gt; (same as your second attempt).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a long way to construct functions like this, and a short way. The long way is to write out all inputs and outputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|000\rangle = |000\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|001\rangle = |001\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|010\rangle = |011\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|011\rangle = |010\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|100\rangle = |101\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|101\rangle = |100\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|110\rangle = |110\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|111\rangle = |111\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then pretty easily construct the operator from this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easier way is to use projection operators &amp;amp; matrix addition to implement &quot;if-then&quot; semantics with matrices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U = |00\rangle\langle00| \otimes \mathbb{I}_2 + |01\rangle\langle01|\otimes X_2 + |10\rangle\langle10| \otimes X_2 + |11\rangle\langle11|\otimes \mathbb{I}_2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to read this is &quot;if the input is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, do not flip the third bit. If the input is &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, flip the third bit. &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\langle \phi|$&lt;/span&gt; is called the &lt;em&gt;outer product&lt;/em&gt;, and is defined for example as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle0| = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix} = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is called a &lt;em&gt;projection operator&lt;/em&gt;. Use projection operators to only apply an operation on specific states - here, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A huge benefit of this projectors &amp;amp; addition approach is that you never have to actually write out the full matrix, which can become enormous as the number of qbits increase - 3-qbit 8x8 matrices already have 64 elements! This is your first step into using symbolic rather than matrix reasoning. For example, we can use the rules of linear algebra to calculate the action of our &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on some input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|101\rangle = (|00\rangle\langle00| \otimes \mathbb{I}_2 + |01\rangle\langle01|\otimes X_2 + |10\rangle\langle10| \otimes X_2 + |11\rangle\langle11|\otimes \mathbb{I}_2)|101\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, matrix multiplication distributes over addition. This means we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle\langle00| \otimes \mathbb{I}_2 |101\rangle + |01\rangle\langle01|\otimes X_2 |101\rangle + |10\rangle\langle10| \otimes X_2 |101\rangle + |11\rangle\langle11|\otimes \mathbb{I}_2 |101\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's apply further transformation rules. Note &lt;span class=&quot;math-container&quot;&gt;$|101\rangle = |10\rangle \otimes |1\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$(U\otimes V)(|x\rangle \otimes |y\rangle) = U|x\rangle \otimes V|y\rangle$&lt;/span&gt;, where in our cases (for example) &lt;span class=&quot;math-container&quot;&gt;$U = |00\rangle\langle00|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$V = \mathbb{I}_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x=|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y=|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle\langle00|10\rangle \otimes \mathbb{I}_2 |1\rangle + |01\rangle\langle01|10\rangle \otimes X_2 |1\rangle + |10\rangle\langle10|10\rangle \otimes X_2 |1\rangle + |11\rangle\langle11|10\rangle \otimes \mathbb{I}_2 |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, note we have the following four terms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle00|10\rangle, \langle01|10\rangle, \langle10|10\rangle, \langle11|10\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are called &lt;em&gt;inner products&lt;/em&gt;, or &lt;em&gt;dot products&lt;/em&gt; and here all of them are zero except for &lt;span class=&quot;math-container&quot;&gt;$\langle10|10\rangle$&lt;/span&gt; - the dot product of &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; with itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle10|10\rangle = \begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{bmatrix}&#xA;\begin{bmatrix}0 \\ 0 \\ 1 \\ 0\end{bmatrix} = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the other terms are all zero, they all cancel out:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\require{cancel} \cancel{|00\rangle\cdot 0 \otimes \mathbb{I}_2 |1\rangle} + \cancel{|01\rangle\cdot 0 \otimes X_2 |1\rangle} + |10\rangle\cdot 1 \otimes X_2 |1\rangle + \cancel{|11\rangle\cdot 0 \otimes \mathbb{I}_2 |1\rangle}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we are left with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle \otimes X_2 |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where of course &lt;span class=&quot;math-container&quot;&gt;$X_2|1\rangle = |0\rangle$&lt;/span&gt;, so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle \otimes |0\rangle = |100\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And we calculated &lt;span class=&quot;math-container&quot;&gt;$U|101\rangle = |100\rangle$&lt;/span&gt; as expected, without once having to write out a huge inconvenient matrix!&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-10-18T22:39:49.373" LastActivityDate="2018-10-18T22:39:49.373" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4447" PostTypeId="2" ParentId="4442" CreationDate="2018-10-18T22:08:27.410" Score="5" Body="&lt;p&gt;Since your desired operation is a non-injective function, you need a third qubit and a unitary acting on &lt;em&gt;all three qubits&lt;/em&gt;. Using an operator on your two input qubits and tensoring this with &lt;span class=&quot;math-container&quot;&gt;${\rm I}_2$&lt;/span&gt; on the third qubit is not going to work as you might as well forget about the third qubit completely if that were the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, the two matrices you present aren't unitary (&lt;span class=&quot;math-container&quot;&gt;${\rm U}{}^\dagger{\rm U}={\rm I}_4$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; the conjugate transpose does not hold), and tensoring a non-unitary matrix with &lt;span class=&quot;math-container&quot;&gt;${\rm I}_2$&lt;/span&gt; won't make it unitary either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's start over: take three qubits, define the first two as your input registers and the third as your output register. Then, what you want your operation to do, is this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm U}_f|000\rangle=|000\rangle\\&#xA;{\rm U}_f|010\rangle=|011\rangle\\&#xA;{\rm U}_f|100\rangle=|101\rangle\\&#xA;{\rm U}_f|110\rangle=|110\rangle$$&lt;/span&gt;&#xA;Note that to fully define &lt;span class=&quot;math-container&quot;&gt;${\rm U}_f$&lt;/span&gt;, we would have to determine a desired output for the four other possible (computational basis) input states, &lt;span class=&quot;math-container&quot;&gt;$|\!*\!*1\rangle$&lt;/span&gt;. How we do this is entirely up to us! (As long as &lt;span class=&quot;math-container&quot;&gt;${\rm U}_f$&lt;/span&gt; remains unitary, of course.) So we can just choose something convenient, such as this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm U}_f|001\rangle=|001\rangle\\&#xA;{\rm U}_f|011\rangle=|010\rangle\\&#xA;{\rm U}_f|101\rangle=|100\rangle\\&#xA;{\rm U}_f|111\rangle=|111\rangle$$&lt;/span&gt;&#xA;This has the following matrix form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm U}_f=\begin{bmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;Intuitively, this unitary is constructed with two CNOT gates, which swap the third qubit &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\to|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\to|0\rangle$&lt;/span&gt; if and only if one of the first two qubits is in a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q0PLB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q0PLB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check that multiplying the matrices of the two CNOTs indeed gives the same &lt;span class=&quot;math-container&quot;&gt;${\rm U}_f$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="2687" LastEditDate="2018-10-20T22:32:18.563" LastActivityDate="2018-10-20T22:32:18.563" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4448" PostTypeId="2" ParentId="4442" CreationDate="2018-10-19T01:41:55.140" Score="3" Body="&lt;p&gt;Your bit strings &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in the case when you specify &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; bits are &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;. Now you want to output the result in another bit/qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Whether the outpit bit/qubit is initialized as &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; should not change your unitary operation. The only thing changing is the initial quantum state your system is onto where you apply the unitary operation representing your function.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the implementation is straightforward. This is a first CNOT with first qubit of register &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as control and the output qubit as target followed by another CNOT with the second qubit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as control. If you input &lt;span class=&quot;math-container&quot;&gt;$x=00$&lt;/span&gt;, nothing happens. If &lt;span class=&quot;math-container&quot;&gt;$x=01$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;, you apply one CNOT which adds &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to the target (definition of CNOT). If &lt;span class=&quot;math-container&quot;&gt;$x=11$&lt;/span&gt;, the two CNOTs are applied so you add &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to the target twice and &lt;span class=&quot;math-container&quot;&gt;$1 + 1 = 0$&lt;/span&gt; when having one output bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the unitary, you can just take the unitary matrix of the CNOT, tensor product with the identity matrix (but respect the order when you write). You do this for the first CNOT giving you one unitary &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;, then the second giving &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; and finally multiply &lt;span class=&quot;math-container&quot;&gt;$U_2 U_1$&lt;/span&gt; to get your unitary operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is another way to get unitary operator which is more useful when dealing with controlled-gates in a multi-qubit system. For example,  can also be written as :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle\langle 0|\otimes\mathbb{I}+|1\rangle\langle 1|\otimes U $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is like a sort of quantum if statement. Basically, if the control is 0, do nothing, otherwise apply U. Using this definition on your example, it follows that :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle\langle 0|\otimes\mathbb{I} \otimes\mathbb{I} +|1\rangle\langle 1|  \otimes\mathbb{I}\otimes X $$&lt;/span&gt;&#xA;where X is the NOT gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have an example on a 5-qubit system in this &#xA;&lt;a href=&quot;https://jarrodmcclean.com/basic-quantum-circuit-simulation-in-python/&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog&lt;/a&gt;. Also, I asked a similar &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3935/how-do-we-code-the-matrix-for-a-controlled-operation-knowing-the-control-qubit&quot;&gt;question&lt;/a&gt; in the past but for a code of such operation.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-10-24T03:38:00.027" LastActivityDate="2018-10-24T03:38:00.027" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4449" PostTypeId="1" AcceptedAnswerId="4451" CreationDate="2018-10-19T11:41:26.370" Score="1" ViewCount="245" Body="&lt;p&gt;I'm having a bit of trouble understand @DaftWullie's answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3824/26&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understood that the &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{4} \left[\begin{matrix}&#xA;15 &amp;amp; 9 &amp;amp; 5 &amp;amp; -3 \\&#xA;9 &amp;amp; 15 &amp;amp; 3 &amp;amp; -5 \\&#xA;5 &amp;amp; 3 &amp;amp; 15 &amp;amp; -9 \\&#xA;-3 &amp;amp; -5 &amp;amp; -9 &amp;amp; 15&#xA;\end{matrix}\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be decomposed into Pauli matrices as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A=15\mathbb{I}\otimes\mathbb{I}+9Z\otimes X+5X\otimes Z-3Y\otimes Y$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then he says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, it is interesting to note that every one of these terms commutes.&#xA;  So, that means that &lt;span class=&quot;math-container&quot;&gt;$$ e^{iA\theta}=e^{15i\theta}e^{9i\theta Z\otimes&#xA; X}e^{5i\theta X\otimes Z}e^{-3i\theta Y\otimes Y}. $$&lt;/span&gt; You could work&#xA;  out how to simulate each of these steps individually, but let me make&#xA;  one further observation first: these commuting terms are the&#xA;  stabilizers of the 2-qubit cluster state. That may or may not mean&#xA;  anything to you, but it tells me that a smart thing to do is apply a&#xA;  controlled-phase gate.&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ CP\cdot A\cdot CP=15\mathbb{I}\otimes\mathbb{I}+9\mathbb{I}\otimes&#xA; X+5X\otimes \mathbb{I}-3X\otimes X. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, I hadn't heard of clusters states before, but &lt;a href=&quot;https://en.wikipedia.org/wiki/Cluster_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; gave me some idea (I'll probably need to through it a few more times though). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, as far as I know, the controlled phase gate &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; is basically a controlled-&lt;span class=&quot;math-container&quot;&gt;$R_{\phi}$&lt;/span&gt; gate where &lt;span class=&quot;math-container&quot;&gt;$R_{\phi}$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left[\begin{matrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\phi}\end{matrix}\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, controlled &lt;span class=&quot;math-container&quot;&gt;$R_{\phi}$&lt;/span&gt; would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left[\begin{matrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\phi}&#xA;\end{matrix}\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where I am confused. Shouldn't &lt;span class=&quot;math-container&quot;&gt;$(\text{controlled }R_{\phi})A(\text{controlled }R_{\phi})$&lt;/span&gt; contain a &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; term somewhere? I don't understand how its Pauli decomposition &lt;span class=&quot;math-container&quot;&gt;$15\mathbb{I}\otimes\mathbb{I}+9\mathbb{I}\otimes&#xA; X+5X\otimes \mathbb{I}-3X\otimes X$&lt;/span&gt; contains no term containing the phase angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. &lt;a href=&quot;http://www.wolframalpha.com/input/?i=multiply+matrix+%7B%7B1,0,0,0%7D,%7B0,1,0,0%7D,%7B0,0,1,0%7D,%7B0,0,0,e%5E%7Bix%7D%7D%7D+and+%7B%7B15,9,5,-3%7D,%7B9,15,3,-5%7D,%7B5,3,15,-9%7D,%7B-3,-5,-9,15%7D%7D+and+%7B%7B1,0,0,0%7D,%7B0,1,0,0%7D,%7B0,0,1,0%7D,%7B0,0,0,e%5E%7Bix%7D%7D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wolfram Alpha&lt;/a&gt; also agrees that the matrix multiplication result of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CP\cdot A\cdot CP}$&lt;/span&gt; must contain a phase term. So, I'm not quite sure how Pauli decomposition of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CP\cdot A\cdot CP}$&lt;/span&gt; as stated by DaftWullie in his answer arises. Am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-08-14T06:12:25.850" LastActivityDate="2020-08-14T06:12:25.850" Title="How does the stated Pauli decomposition for $\operatorname{CP\cdot A\cdot CP}$ arise?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;pauli-gates&gt;&lt;cluster-states&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4450" PostTypeId="2" ParentId="4449" CreationDate="2018-10-19T11:57:44.183" Score="1" Body="&lt;p&gt;Yes if you work with general phase shift there would be &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; in the final answer. In fact you would be able to take &lt;span class=&quot;math-container&quot;&gt;$\phi=0$&lt;/span&gt; and just get &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; back. Try &lt;span class=&quot;math-container&quot;&gt;$\phi=\frac{\pi}{4}$&lt;/span&gt;. Looks like notational mismatch of what's called a phase gate/phase shift gate. Whether it means the entire 1 parameter family or just one specific value of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Incorrect, see comment below.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2018-10-19T19:19:42.877" LastActivityDate="2018-10-19T19:19:42.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4451" PostTypeId="2" ParentId="4449" CreationDate="2018-10-19T12:18:28.263" Score="2" Body="&lt;p&gt;When I talked about a controlled-phase gate, I meant the standard gate that has unitary matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is related to the controlled-not via the action of a Hadamard on the target qubit. It also satisfies some standard propagation relations on Pauli operations:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_n\mapsto Z_n\qquad X_n\mapsto Z_{3-n}X_n&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$n\in\{1,2\}$&lt;/span&gt; being the two qubits that the controlled-phase gate acts on. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/rke7Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rke7Q.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-19T12:30:38.843" LastActivityDate="2018-10-19T12:30:38.843" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4452" PostTypeId="1" CreationDate="2018-10-19T13:53:38.023" Score="6" ViewCount="69" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AbXq8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AbXq8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to simulate a system of &lt;code&gt;j&lt;/code&gt; qubits and for visualization of the dynamics considering the Husimi distribution of the state.&#xA;To carry out the projection onto coherent states I have proceeded in the following manner&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    R=LA.expm(1j*theta*(Sx*np.sin(phi)-Sy*np.cos(phi)))&#xA;    alpha=dot(R,psi0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where alpha represents the coherent state centered at (phi,theta), &lt;code&gt;R&lt;/code&gt; is Rotation matrix, &lt;code&gt;psi_0&lt;/code&gt; spin state of &lt;code&gt;|j,j&amp;gt;&lt;/code&gt; and &lt;code&gt;Sx,Sy&lt;/code&gt; are spin operators along &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; direction respectively.&#xA;I am using scipy's linalg library to carry out exponentiation of matrix.&#xA;From all such alpha's I am able to construct the coherent distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am able to produce supposedly correct distribution for most cases but for some cases, I am getting negative values which should not be obtained for Husimi distribution, though the order of these are very less and might be related to an error in numerical approximation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doubtful about my implementation and would like to clarify if the methodology that I have followed is correct or is there any better alternative for the same.&lt;/p&gt;&#xA;" OwnerUserId="4874" LastEditorUserId="26" LastEditDate="2018-12-23T13:01:36.310" LastActivityDate="2018-12-23T13:01:36.310" Title="Discrepancy regarding Husimi Probability distribution" Tags="&lt;dynamics&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4453" PostTypeId="1" AcceptedAnswerId="4454" CreationDate="2018-10-19T16:51:09.613" Score="1" ViewCount="120" Body="&lt;p&gt;&lt;strong&gt;Context:&lt;/strong&gt; I am particularly interested in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_cognition&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum cognition&lt;/a&gt; &amp;amp; would like to use a tool like &lt;a href=&quot;https://github.com/Quantomatic/pyzx&quot; rel=&quot;nofollow noreferrer&quot;&gt;pyZX&lt;/a&gt; to perform the following types of optimizations.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1708.08250&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preparing a (quantum) belief system&lt;/a&gt; they &quot;establish a theoretical result showing that in the absence of constraints on measurements, &lt;em&gt;any state can be obtained as the result of a suitable sequence of measurements&lt;/em&gt;.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also stated in the paper that &quot;achieving the desired belief state &lt;em&gt;may require a sequence of measurements that is not practically feasible&lt;/em&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How could the &lt;a href=&quot;https://arxiv.org/abs/1004.2242&quot; rel=&quot;nofollow noreferrer&quot;&gt;Group Leaders Optimization Algorithm&lt;/a&gt; be applied in the above context to generate &lt;em&gt;practically feasible sequences of measurements&lt;/em&gt;?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-23T11:26:25.767" LastActivityDate="2018-12-23T11:26:25.767" Title="Applying Group Leaders Optimization to Quantum Belief Systems" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4454" PostTypeId="2" ParentId="4453" CreationDate="2018-10-19T17:12:54.167" Score="1" Body="&lt;p&gt;The GLOA is just an optimization algorithm (another genetic algorithm actually). So as long as your problem translates into an objective function you seek to minimize/maximize, this would be possible (even by another genetic algorithm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest to first think how you encode your problem for the optimization. For example, a sequence of discrete and/or real variables. The objective function is also important to specify. I am guessing here you would look at the fidelity with the desired belief state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing however you would have to consider is the definition of being practically feasible as I don't know what the authors refer to &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a sequence of measurements that is not practically feasible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, let us take the example of the GLOA applied to find the decomposition of a unitary operator U into a sequence of gates (or circuit) within a predefined set, which you can find the explanation in this &lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.3575402&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;. This was discussed in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4426/understanding-the-group-leaders-optimization-algorithm/4429#4429&quot;&gt;question&lt;/a&gt; before. Maybe it will help you relate to your problem.&#xA;The idea is to represent a circuit as a sequence of variables taking integer or real values. For instance, let's try to find the decomposition of the Toffoli gate using the set of gates &lt;span class=&quot;math-container&quot;&gt;$\{V,Z,S,V^{\dagger},R_x(\theta) \}$&lt;/span&gt; and we allow to use maximum 5 gates. We start by randomly creating candidate circuits. Here is one example of candidate circuit (showing you an encoding of the problem) :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; 3 2 0.0; &lt;strong&gt;2&lt;/strong&gt; 3 1 0.0; &lt;strong&gt;3&lt;/strong&gt; 2 1 0.0; &lt;strong&gt;4&lt;/strong&gt; 3 2 0.0; &lt;strong&gt;5&lt;/strong&gt; 1 3 0.75&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You see you have 5 sequences of 4 numbers (3 integers and one real). Each sequence represent an application of a gate.&#xA;&lt;code&gt;1 3 2 0.0&lt;/code&gt;, in this case, means apply the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; gate (index 1 in the set) on qubit &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; controlled by qubit &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; with an angle &lt;span class=&quot;math-container&quot;&gt;$0.0$&lt;/span&gt; (note that with the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; gate there is no angle but say you were playing with like rotation gates, this becomes relevant). So it is like a problem of 20 variables to tweak for the optimization scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimization will consist of finding the solution circuit represented by a unitary operator &lt;span class=&quot;math-container&quot;&gt;$ U_a $&lt;/span&gt; close to the unitary operator of interest &lt;span class=&quot;math-container&quot;&gt;$ U_t $&lt;/span&gt;; using GLOA which maximize the trace fidelity (here serving as an objective function telling us how close the candidate is to the solution):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{F} = \frac{1}{N}|\operatorname{Tr}(U_aU_t^{\dagger})| $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you were looking for quantum states, the objective function would be for instance to minimize a distance between two quantum states with one being the desired solution. In the &lt;a href=&quot;https://docs.google.com/viewer?url=http%3A%2F%2Fmichaelnielsen.org%2Fqcqi%2FQINFO-book-nielsen-and-chuang-toc-and-chapter1-nov00.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;book of Nielsen and Chuang&lt;/a&gt;, you have chapter 9.2 which is about quantifying how two quantum states are close. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-10-29T21:24:18.163" LastActivityDate="2018-10-29T21:24:18.163" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4455" PostTypeId="1" AcceptedAnswerId="4456" CreationDate="2018-10-19T17:34:34.663" Score="1" ViewCount="277" Body="&lt;p&gt;The circuit below implements the following two-level unitary transformation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8zjqh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8zjqh.png&quot; alt=&quot;transformation matrix&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aSYHs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aSYHs.png&quot; alt=&quot;quantum circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\tilde{U}$&lt;/span&gt; is a unitary matrix: &lt;span class=&quot;math-container&quot;&gt;$\tilde{U} = \left[\begin{matrix} a &amp;amp; c \\ b &amp;amp; d \end{matrix}\right]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a, b, c, d$&lt;/span&gt; are any complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts non-trivially only on the states &lt;span class=&quot;math-container&quot;&gt;$\lvert 000 \rangle, \lvert 111 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would you solve the circuit for the input state &lt;span class=&quot;math-container&quot;&gt;$\lvert 000 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lvert 111 \rangle$&lt;/span&gt;? My problem is figuring out how to deal with the state &lt;span class=&quot;math-container&quot;&gt;$\tilde{U}A$&lt;/span&gt; in last two CNOT gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: to clarify what I want:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I start with &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{0} \rangle = \lvert 0, 0, 0 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;after the first CNOT I get &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{1} \rangle = \lvert 0, 0, 1 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;after the second CNOT I get &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{2} \rangle = \lvert 0, 1, 1 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How would you write &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{3} \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{4} \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{5} \rangle$&lt;/span&gt;? For this specific circuit, is it even possible to write the full steps like that?&lt;/p&gt;&#xA;" OwnerUserId="4504" LastEditorUserId="26" LastEditDate="2018-12-23T11:25:42.697" LastActivityDate="2018-12-23T11:25:42.697" Title="Solving a circuit implementing a two-level unitary operation" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4456" PostTypeId="2" ParentId="4455" CreationDate="2018-10-19T20:45:57.533" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \psi_3 \rangle = a | 0 1 1 \rangle + b | 1 1 1 \rangle\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the 1 on B and C criterion is met.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \psi_4 \rangle = a | 0 0 1 \rangle + b | 1 1 1 \rangle\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because only the first term meets the criterion for the controls so it is the only part affected to flip the B index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \psi_5 \rangle = a | 0 0 0 \rangle + b | 1 1 1 \rangle\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because only the first term meets the criterion for the controls so it is the only part affected to flip the C index.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-10-19T20:45:57.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4457" PostTypeId="1" AcceptedAnswerId="4458" CreationDate="2018-10-19T23:03:02.543" Score="4" ViewCount="168" Body="&lt;p&gt;I was watching the following video  &lt;a href=&quot;https://www.youtube.com/watch?v=IrbJYsep45E&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=IrbJYsep45E&lt;/a&gt;&lt;br&gt;&#xA;And around 3 minutes in, they do an example computation with two qubits. The qubits started off in the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and then go through what I assume is a Hadamard gate which puts them in a superposition. Why is it a &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; chance of being &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, and a fifty percent chance of being &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;? Why is it not a quarter chance of being &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;?  &lt;/p&gt;&#xA;" OwnerUserId="4879" LastEditorUserId="26" LastEditDate="2018-12-23T11:24:04.913" LastActivityDate="2018-12-23T11:24:04.913" Title="What happens when I input two qubits starting at state $|00\rangle$ into a hadamard gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4458" PostTypeId="2" ParentId="4457" CreationDate="2018-10-19T23:22:33.393" Score="1" Body="&lt;p&gt;It is not two Hadamard gates.&lt;br&gt;&#xA;You are 100% correct that two Hadamrd gates would put you in an equal superposition of 00, 01, 10, 11, meaning 25% chance of getting any of those.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's construct her gate based on the input &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and the output &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|10\rangle +|01\rangle\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final state is &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2260/2293&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the state can be constructed with this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l5LJO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l5LJO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the middle gate is a CNOT.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-19T23:43:39.350" LastActivityDate="2018-10-19T23:43:39.350" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4459" PostTypeId="1" AcceptedAnswerId="4461" CreationDate="2018-10-20T13:24:02.820" Score="4" ViewCount="74" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;Say I begin with &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits &lt;span class=&quot;math-container&quot;&gt;$\qr{+}\qr{+}\qr{+}\qr{+}$&lt;/span&gt; forming a register &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Name these qubits as &lt;span class=&quot;math-container&quot;&gt;$b_3, b_2, b_1, b_0$&lt;/span&gt;.  Also, let &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; be another register &lt;span class=&quot;math-container&quot;&gt;$\qr0\qr0\qr0\qr0$&lt;/span&gt; whose qubit names are &lt;span class=&quot;math-container&quot;&gt;$c_3, c_2, c_1, c_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now apply &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}(b_i, c_i)$&lt;/span&gt;, that is, entangle &lt;span class=&quot;math-container&quot;&gt;$b_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; and so on.  Suppose I measure &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and I obtain &lt;span class=&quot;math-container&quot;&gt;$\qr{0101} = \qr5$&lt;/span&gt;.  What will I get if I measure &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; now?  I say I'll get precisely &lt;span class=&quot;math-container&quot;&gt;$\qr{5}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this happen a &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; of the time?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="55" LastEditDate="2018-10-20T14:57:54.940" LastActivityDate="2018-10-21T14:32:51.693" Title="Does entanglement correlate qubits a $100\%$ of the time?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4460" PostTypeId="2" ParentId="4438" CreationDate="2018-10-20T14:32:07.743" Score="0" Body="&lt;p&gt;You may keep a tab on the &lt;a href=&quot;https://www.quantiki.org/jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jobs page&lt;/a&gt; or in particular the &lt;a href=&quot;https://www.quantiki.org/jobs?field_job_type_tid%5B%5D=628&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ph.D. positions page&lt;/a&gt; on &lt;a href=&quot;https://www.quantiki.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantiki&lt;/a&gt;. You can view the extended descriptions for each position by clicking on the individual position names and see the project details like location, duration of the Ph.D., potential supervisors, etc. The positions are not restricted to any specific country as such and cannot be sorted according to sub-fields (as far as I know). &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-10-20T14:32:07.743" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4461" PostTypeId="2" ParentId="4459" CreationDate="2018-10-20T14:47:02.957" Score="3" Body="&lt;p&gt;If you only operate on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th qubit, then the other qubits do not matter and can be ignored, so you effectively are considering the operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert+\rangle\lvert0\rangle\to\frac{1}{\sqrt2}[\lvert0,0\rangle+\lvert1,1\rangle]$$&lt;/span&gt;&#xA;on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th qubit, with all other qubits not being affected.&#xA;Then, measuring the first qubit always collapses the second one, like in the example you showed, which means that outcomes are always correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, if you apply CNOT operations to a subset of the qubits (say those with indices &lt;span class=&quot;math-container&quot;&gt;$i\in A\subseteq\{1,...,n\}$&lt;/span&gt;), then you are doing the following&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left[\bigotimes_{k=1}^n \lvert+\rangle\right]\left[\bigotimes_{k=1}^n \lvert0\rangle\right] \rightarrow \left[\bigotimes_{i\notin A}\lvert+,0\rangle\right]\otimes 2^{-|A|/2}\left[\bigotimes_{i\in A} \big(\lvert0,0\rangle+\lvert 1,1\rangle\big)\right].$$&lt;/span&gt;&#xA;Measuring the first register does not do anything interesting on the indices &lt;span class=&quot;math-container&quot;&gt;$i\notin A$&lt;/span&gt;, while it completely collapses the qubits in the second register with indices &lt;span class=&quot;math-container&quot;&gt;$i\in A$&lt;/span&gt;. If the outcome measured on the first register is &lt;span class=&quot;math-container&quot;&gt;$\lvert\boldsymbol x\rangle\equiv\lvert x_1,...,x_n\rangle$&lt;/span&gt;, then the state of the second register becomes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left[\bigotimes_{i\notin A}\lvert0\rangle\right]\otimes \left[\bigotimes_{i\in A}\lvert x_i\rangle\right].$$&lt;/span&gt;&#xA;Clearly, the state of the second register is entirely determined by what has been measured in the first register, so that the measurement results will always be correlated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely stated, the measurement results are &quot;&lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt;&quot; correlated in the sense that the conditional entropy &lt;span class=&quot;math-container&quot;&gt;$H(C|B)$&lt;/span&gt; between the two measurement outcomes (when measuring in the computational basis) is zero.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-10-21T14:32:51.693" LastActivityDate="2018-10-21T14:32:51.693" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4462" PostTypeId="2" ParentId="4457" CreationDate="2018-10-20T15:13:49.317" Score="3" Body="&lt;p&gt;There is a slight misconception in your question. You can't apply a Hadamard gate on &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. Because the basis state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is actually a tensor product of a &lt;span class=&quot;math-container&quot;&gt;$2\times 1$&lt;/span&gt; dimensional basis state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; used twice. This results in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = |0\rangle \otimes |0\rangle =  \begin{bmatrix}1 \\0\\0\\0\end{bmatrix}$&lt;/span&gt;. Now you must take the tensor product of Hadamard gate(which is &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; dimensional) too in order to apply it in this state. Like so:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H \otimes H (|0\rangle \otimes |0\rangle)$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$= H|0\rangle \otimes H|0\rangle$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$ =\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle)$$&lt;/span&gt;. Now obviously &lt;span class=&quot;math-container&quot;&gt;$ 4 \times (\frac{1}{2})^2 = 1$&lt;/span&gt;, as you have correctly inferred. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2018-10-20T17:49:42.290" LastActivityDate="2018-10-20T17:49:42.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4463" PostTypeId="1" AcceptedAnswerId="4466" CreationDate="2018-10-20T15:23:50.047" Score="2" ViewCount="50" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;Say I begin with &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; q-bits&#xA;&lt;span class=&quot;math-container&quot;&gt;$\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}$&lt;/span&gt; forming&#xA;a register &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Name these q-bits as &lt;span class=&quot;math-container&quot;&gt;$b_9, ..., b_2, b_1, b_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply a gate &lt;span class=&quot;math-container&quot;&gt;$U_{\operatorname{div}}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.  For clarity, assume&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_\text{div}$&lt;/span&gt; divides the number represented by q-bits &lt;span class=&quot;math-container&quot;&gt;$b_7 b_6 b_5 b_4 b_3&#xA;b_2 b_1 b_0$&lt;/span&gt; by the number represented by &lt;span class=&quot;math-container&quot;&gt;$b_9 b_8$&lt;/span&gt;.  The output of&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_\text{div}$&lt;/span&gt; is written as follows.  It leaves &lt;span class=&quot;math-container&quot;&gt;$b_9 b_8$&lt;/span&gt; alone, writes the&#xA;quotient of the division in &lt;span class=&quot;math-container&quot;&gt;$b_7 b_6 b_5 b_4 b_3 b_2$&lt;/span&gt; and the rest is&#xA;written in &lt;span class=&quot;math-container&quot;&gt;$b_1 b_0$&lt;/span&gt;.  (This makes sense: if only &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; q-bits are&#xA;allowed for the divisor, the greatest divisor possible is &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, so the&#xA;greatest rest possible is &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; q-bits for the rest is enough.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say now I measure &lt;span class=&quot;math-container&quot;&gt;$b_1 b_0$&lt;/span&gt; getting the classical bits &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, meaning&#xA;the rest of the division is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.  Also I measure &lt;span class=&quot;math-container&quot;&gt;$b_7 b_6 b_5 b_4 b_3&#xA;b_2$&lt;/span&gt; getting the classical bits &lt;span class=&quot;math-container&quot;&gt;$001110$&lt;/span&gt;, meaning my quotient is &lt;span class=&quot;math-container&quot;&gt;$14$&lt;/span&gt;.&#xA;Finally, say I measure &lt;span class=&quot;math-container&quot;&gt;$b_9 b_8$&lt;/span&gt; getting the classical bits &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means I effectively had &lt;span class=&quot;math-container&quot;&gt;$a = 14\times 2 + 1 = 29$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&#xA;represents the dividend.  But it seems to me impossible to talk about what &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; had to be since &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; would be written in q-bits &lt;span class=&quot;math-container&quot;&gt;$b_7 b_6 b_5 b_4 b_3&#xA;b_2 b_1 b_0$&lt;/span&gt; which was &lt;span class=&quot;math-container&quot;&gt;$\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}\qr{+}$&lt;/span&gt; at the start.  It seems to me I could never infer the dividend in this experiment, though the only arithmetic that seems to make sense is &lt;span class=&quot;math-container&quot;&gt;$a = 14\times 2 + 1 = 29$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's going on here?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastActivityDate="2018-10-20T20:50:36.133" Title="What's the meaning of applying $U_{\text{div}}$ to a register in superposition?" Tags="&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4465" PostTypeId="1" AcceptedAnswerId="4473" CreationDate="2018-10-20T19:17:55.793" Score="2" ViewCount="141" Body="&lt;p&gt;If you have two registers in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{n/2}} \sum_{x = 0}^{2^{n/2} - 1} |x\rangle |0\rangle$&lt;/span&gt;, how could you construct a gate that produces a superposition of states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|1\rangle$&lt;/span&gt; when some integer &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; divides &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|0\rangle$&lt;/span&gt; otherwise, for each input?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. a unitary quantum gate that replicates the function &lt;span class=&quot;math-container&quot;&gt;$f(x) = \begin{cases} 1 \text{ if } r \text{ divides } x\\&#xA;0 \text{ otherwise}&#xA;\end{cases}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="26" LastEditDate="2018-12-23T11:23:41.713" LastActivityDate="2018-12-23T11:23:41.713" Title="How to construct a quantum gate producing 1 if r divides x, 0 otherwise?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4466" PostTypeId="2" ParentId="4463" CreationDate="2018-10-20T20:50:36.133" Score="2" Body="&lt;p&gt;You cannot replace those bits with the quotient without leaving pieces of information elsewhere. Wherever you put the quotient, it will be entangled with the bits that determine it. Remember that all quantum gates are reversible, so no information is lost until measurement. That being said, you will get a different answer for &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; on different repetitions of the procedure, so you can only determine the answer for one particular (random) &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; on each procedure.&lt;/p&gt;&#xA;" OwnerUserId="4657" LastActivityDate="2018-10-20T20:50:36.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4468" PostTypeId="1" AcceptedAnswerId="4534" CreationDate="2018-10-21T04:05:52.867" Score="5" ViewCount="216" Body="&lt;p&gt;This is along the same lines as the earlier question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2097/when-was-the-first-use-of-the-word-entanglement&quot;&gt;When was the first use of the word Entanglement?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was surprised to discover that when searching for &quot;chimera&quot; in both of Vicky Choi's minor-embedding papers: &lt;br&gt;&#xA;&lt;a href=&quot;https://arxiv.org/abs/0804.4884&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0804.4884&lt;/a&gt;, &lt;br&gt;&#xA;&lt;a href=&quot;https://arxiv.org/abs/1001.3116&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1001.3116&lt;/a&gt;,&lt;br&gt;&#xA;no results came up!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that finding the first &quot;chimera&quot; paper is harder than I imagined and I don't know where to look anymore. When and where can I find the first use of the term?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-21T21:34:25.167" LastActivityDate="2018-11-01T08:52:58.277" Title="When and where was the first use of the term Chimera?" Tags="&lt;architecture&gt;&lt;d-wave&gt;&lt;annealing&gt;&lt;chimera&gt;&lt;embedding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4469" PostTypeId="1" CreationDate="2018-10-21T12:08:17.897" Score="7" ViewCount="194" Body="&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solvay Kitaev algorithm&lt;/a&gt; was discovered long before the &lt;a href=&quot;https://arxiv.org/abs/1004.2242&quot; rel=&quot;nofollow noreferrer&quot;&gt;Group Leaders Optimization algorithm&lt;/a&gt; and it has some nice theoretical properties. As far as I understand, both have exactly the same goals: given a finite dimensional unitary operator, they decompose the operator into basic quantum gates. I couldn't find any theoretical results about the time complexity or convergence time or error bounds for the GLOA as such. Does the latter (GLOA) have any practical advantage over the former at all, in terms of convergence time or anything?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: For a detailed description of the GLOA, see: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4426/understanding-the-group-leaders-optimization-algorithm&quot;&gt;Understanding the Group Leaders Optimization Algorithm&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:28:54.350" LastActivityDate="2020-09-09T15:09:01.403" Title="Does the GLOA have any advantage over the Solovay-Kitaev algorithm?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4470" PostTypeId="1" AcceptedAnswerId="4514" CreationDate="2018-10-21T18:14:21.777" Score="6" ViewCount="211" Body="&lt;p&gt;Can we convert every algorithm in &lt;span class=&quot;math-container&quot;&gt;$\text{P}$&lt;/span&gt; (polynomial time complexity for deterministic machines) into a  quantum algorithm with polynomial time and &lt;span class=&quot;math-container&quot;&gt;$O(\log n)$&lt;/span&gt; quantum bit?&lt;/p&gt;&#xA;" OwnerUserId="4213" LastEditorUserId="26" LastEditDate="2018-10-22T06:22:02.710" LastActivityDate="2018-10-23T09:28:44.947" Title="Can we use quantum machines to reduce space complexity of deterministic turing machines?" Tags="&lt;complexity-theory&gt;&lt;memory-space&gt;&lt;space-complexity&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4471" PostTypeId="1" AcceptedAnswerId="4474" CreationDate="2018-10-21T18:26:13.703" Score="2" ViewCount="1579" Body="&lt;p&gt;I have some utility operations that I'd like to use across projects. How can I import its namespace using Q# in Visual Studio 2017 in other projects?&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="26" LastEditDate="2019-03-12T09:03:06.400" LastActivityDate="2019-03-12T09:03:06.400" Title="Q# How to use a namespace in another project?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4472" PostTypeId="1" AcceptedAnswerId="4484" CreationDate="2018-10-21T18:54:45.687" Score="4" ViewCount="304" Body="&lt;p&gt;This transformation comes up a lot during symbolic manipulation of quantum operations on state vectors. It's the reason why, for instance, &lt;span class=&quot;math-container&quot;&gt;$(X\otimes \mathbb{I}_2)|00\rangle = |10\rangle$&lt;/span&gt; - it lets us operate on a single qbit by tensoring a unitary operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with identity operators where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is at the same position of significance as the qbit to which we want to apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to write out a proof of why this transformation works, but I lack good notation for representing and reasoning about tensored matrices and vectors - it becomes very clunky very quickly. Is there a simple way to prove this transformation holds, or a convenient notation for representing tensored matrices/vectors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a square complex unitary matrix of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; a square complex unitary matrix of size &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-element complex column vector where &lt;span class=&quot;math-container&quot;&gt;$\langle x|x\rangle=1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-element complex column vector where &lt;span class=&quot;math-container&quot;&gt;$\langle y|y\rangle=1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-10-23T22:06:45.443" Title="Simple proof that $(U \otimes V)(|x\rangle \otimes |y\rangle) = U|x\rangle \otimes V|y\rangle$?" Tags="&lt;matrix-representation&gt;&lt;mathematics&gt;" AnswerCount="3" CommentCount="12" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4473" PostTypeId="2" ParentId="4465" CreationDate="2018-10-21T19:10:56.527" Score="3" Body="&lt;p&gt;The simplest way would be to do a long division to compute the remainder, toggle the target bit if there is a non-zero remainder, then uncompute the long division.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example &lt;span class=&quot;math-container&quot;&gt;$r=3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N &amp;lt; 16$&lt;/span&gt; circuit &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT4%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C%7B%22id%22%3A%22setA%22%2C%22arg%22%3A9%7D%5D%2C%5B%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22-%3DA4%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C%7B%22id%22%3A%22setA%22%2C%22arg%22%3A3%7D%5D%2C%5B%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22-%3DA4%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22-%3DA4%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance4%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%97%A6%22%2C1%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22%2B%3DA4%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22%2B%3DA4%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setA%22%2C%22arg%22%3A9%7D%5D%2C%5B%5D%2C%5B%22%2B%3DA4%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%97%A6%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;in Quirk&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT4%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C%7B%22id%22%3A%22setA%22%2C%22arg%22%3A9%7D%5D%2C%5B%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22-%3DA4%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C%7B%22id%22%3A%22setA%22%2C%22arg%22%3A3%7D%5D%2C%5B%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22-%3DA4%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22-%3DA4%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance4%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%97%A6%22%2C1%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22%2B%3DA4%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22%2B%3DA4%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setA%22%2C%22arg%22%3A9%7D%5D%2C%5B%5D%2C%5B%22%2B%3DA4%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22inputB4%22%2C1%2C1%2C1%2C%22%5EA%3C%3DB%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance4%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%97%A6%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LnuhI.png&quot; alt=&quot;mod 3 != 0 circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note the displays on the right hand side, which show that conditioning on the output qubit (the bottom one) leaves only values divisible by 3 in the input register (the top 4 qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to keep track of the maximum value &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; that could possibly be in the input register &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, then iteratively pick the largest &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$r^k \leq m$&lt;/span&gt; and subtract &lt;span class=&quot;math-container&quot;&gt;$r^k$&lt;/span&gt; out of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i \geq r^k$&lt;/span&gt;. This reduces &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$r^k$&lt;/span&gt;. Repeat this until &lt;span class=&quot;math-container&quot;&gt;$m &amp;lt; r$&lt;/span&gt;, then toggle your output bit if &lt;span class=&quot;math-container&quot;&gt;$i=0$&lt;/span&gt;. Then uncompute all the conditional subtractions to restore &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A proper construction would not require &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; subtractions for each value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; as this one does, and a proper construction would expand the comparison and addition circuits into their full form, but I think this construction gets the right idea across.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-10-21T19:16:12.980" LastActivityDate="2018-10-21T19:16:12.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4474" PostTypeId="2" ParentId="4471" CreationDate="2018-10-21T19:45:02.653" Score="2" Body="&lt;p&gt;First, you need to add the project which contains the utility operations as a reference to the project which will be using them. If you're using Visual Studio Code or command line, you can use &lt;a href=&quot;https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-add-reference&quot; rel=&quot;nofollow noreferrer&quot;&gt;dotnet add reference&lt;/a&gt; command to do that, and in Visual Studio you can use &lt;a href=&quot;https://docs.microsoft.com/en-us/visualstudio/ide/how-to-add-or-remove-references-by-using-the-reference-manager&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reference Manager&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you need to open the namespace which contains the utility operations in each Q# file which uses them. To do this, add an &lt;code&gt;open&lt;/code&gt; statement after the declaration of the namespace and before definition of any functions or operations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace ProjectNamespace {&#xA;    open Utilities;&#xA;&#xA;    // you can use operations defined in Utilities namespace now&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-10-21T19:45:02.653" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4475" PostTypeId="2" ParentId="4472" CreationDate="2018-10-21T21:01:52.273" Score="3" Body="&lt;p&gt;I will give you a few elements for the demonstration on real vectors which you can extend to complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let {&lt;span class=&quot;math-container&quot;&gt;$e_i$&lt;/span&gt;} be the standard basis for the space where &lt;span class=&quot;math-container&quot;&gt;$U (n*n)$&lt;/span&gt; is defined .&#xA;Let {&lt;span class=&quot;math-container&quot;&gt;$e_j$&lt;/span&gt;} be the standard basis for the space where &lt;span class=&quot;math-container&quot;&gt;$V (m*m)$&lt;/span&gt; is defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, it is a property that the basis {&lt;span class=&quot;math-container&quot;&gt;$e_i \otimes e_j$&lt;/span&gt;} is a basis for the n*m-matrices space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ U \otimes V $&lt;/span&gt; is a linear mapping on the space and we have that :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U \otimes V (e_i \otimes e_j) = (U e_i) \otimes(V e_j)      (1) $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A remark to be given is that in linear algebra, when &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; is linear and &lt;span class=&quot;math-container&quot;&gt;$W e_i$&lt;/span&gt; is known, W is uniquely determined. As {&lt;span class=&quot;math-container&quot;&gt;$e_i \otimes e_j$&lt;/span&gt;} is a basis for the linear mapping &lt;span class=&quot;math-container&quot;&gt;$ U \otimes V $&lt;/span&gt;, it will be unique for the definition (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular,&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U \otimes V (x \otimes y) = (U x) \otimes(V y) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U \otimes V (x \otimes y) = U \otimes V (\sum_i x_i e_i \otimes \sum_j y_j e_j)  $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = U \otimes V (\sum_{i,j} x_i y_j (e_i \otimes e_j)) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  \sum_{i,j} x_i y_j U \otimes V (e_i \otimes e_j) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  \sum_{i,j} x_i y_j (U e_i) \otimes(V e_j) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  \sum_{i,j} x_i y_j (U e_i) (V e_j)^T $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  \sum_{i} x_i (U e_i) \sum_{j} y_j  (V e_j)^T $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  U (\sum_{i} x_i e_i)  (V (\sum_{j} y_je_j))^T $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  U x  (V y)^T $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =  U x \otimes V y $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can look at that &lt;a href=&quot;https://www.uio.no/studier/emner/matnat/math/nedlagte-emner/MAT-INF2360/v12/tensortheory.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;PDF&lt;/a&gt; if it makes it more clear.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-10-22T09:42:07.513" LastActivityDate="2018-10-22T09:42:07.513" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4476" PostTypeId="5" CreationDate="2018-10-21T21:35:49.510" Score="0" Body="" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-21T21:35:49.510" LastActivityDate="2018-10-21T21:35:49.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4477" PostTypeId="4" CreationDate="2018-10-21T21:35:49.510" Score="0" Body="For questions about embedding problems onto quantum annealing hardware, whether or not by minor-embedding or sub-division-embedding." OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-21T21:35:49.510" LastActivityDate="2018-10-21T21:35:49.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4478" PostTypeId="5" CreationDate="2018-10-22T06:25:42.407" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:25:42.407" LastActivityDate="2018-10-22T06:25:42.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4479" PostTypeId="4" CreationDate="2018-10-22T06:25:42.407" Score="0" Body="Space complexity describes the amount of memory space required by a deterministic Turing machine to solve a given computational problem with a certain algorithm. If necessary, also use the [memory-space] tag." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:10:45.107" LastActivityDate="2019-01-01T10:10:45.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4480" PostTypeId="5" CreationDate="2018-10-22T06:31:55.967" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:31:55.967" LastActivityDate="2018-10-22T06:31:55.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4481" PostTypeId="4" CreationDate="2018-10-22T06:31:55.967" Score="0" Body="Communication complexity studies the amount of communication required to solve a problem when the input to the problem is distributed among two or more parties. It was introduced by Andrew Yao in 1979. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:31:55.967" LastActivityDate="2018-10-22T06:31:55.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4482" PostTypeId="5" CreationDate="2018-10-22T06:32:37.413" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:32:37.413" LastActivityDate="2018-10-22T06:32:37.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4483" PostTypeId="4" CreationDate="2018-10-22T06:32:37.413" Score="0" Body="qasm2circ is a package which converts a QASM file into a graphical depiction of the quantum circuit, using standard quantum gate symbols (and other user-defined symbols). This is done using latex (specifically, xypic), to produce high-quality output in epsf, pdf, or png formats. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:32:37.413" LastActivityDate="2018-10-22T06:32:37.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4484" PostTypeId="2" ParentId="4472" CreationDate="2018-10-22T06:33:12.590" Score="3" Body="&lt;p&gt;If we write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\sum_{i,j}U_{ij}|i\rangle\langle j|\quad V=\sum_{kl}V_{kl}|k\rangle\langle l|,&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle=\sum_jx_j|j\rangle\quad |y\rangle=\sum_ly_l|l\rangle,&#xA;$$&lt;/span&gt;&#xA;then we can evaluate both sides of the equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(U\otimes V)(|x\rangle\otimes|y\rangle)=(U|x\rangle)\otimes(V|y\rangle)&#xA;$$&lt;/span&gt;&#xA;using the definition of the tensor product as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U\otimes V=\sum_{ijkl}U_{ij}V_{kl}|ik\rangle\langle jl|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the left-hand side is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;(U\otimes V)(|x\rangle\otimes|y\rangle)&amp;amp;=\left(\sum_{ijkl}U_{ij}V_{kl}|ik\rangle\langle jl|\right)\left(\sum_{jl}x_jy_l|jl\rangle\right)  \\&#xA;&amp;amp;=\sum_{ijkl}U_{ij}x_jV_{kl}y_l|ik\rangle.&#xA;\end{align*}&lt;/span&gt;&#xA;Similarly, the right-hand side is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;(U|x\rangle)\otimes(V|y\rangle)&amp;amp;=\left(\sum_{ij}U_{ij}x_j|i\rangle\right)\otimes\left(\sum_{kl}V_{kl}y_l|k\rangle\right) \\&#xA;&amp;amp;=\sum_{ijkl}U_{ij}x_jV_{kl}y_l|ik\rangle&#xA;\end{align*}&lt;/span&gt;&#xA;The two are the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may worry that there's a little bit of trickery going on with the kets, that contained within the &quot;definition&quot; of the tensor product is already hiding an implicit use o f the tensor product because I'm going from &lt;span class=&quot;math-container&quot;&gt;$|i\rangle\otimes|k\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|ik\rangle$&lt;/span&gt;, and that makes the definition rather circular. However, remember that the text in a ket is just a label, so you can really think about what I'm doing as defining a new composite label in some different Hilbert space.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-22T06:40:34.973" LastActivityDate="2018-10-22T06:40:34.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4485" PostTypeId="5" CreationDate="2018-10-22T06:34:23.573" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:34:23.573" LastActivityDate="2018-10-22T06:34:23.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4486" PostTypeId="4" CreationDate="2018-10-22T06:34:23.573" Score="0" Body="Spintronics (a portmanteau meaning spin transport electronics), also known as spin electronics, is the study of the intrinsic spin of the electron and its associated magnetic moment, in addition to its fundamental electronic charge, in solid-state devices. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T06:34:23.573" LastActivityDate="2018-10-22T06:34:23.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4487" PostTypeId="5" CreationDate="2018-10-22T08:29:10.513" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T08:29:10.513" LastActivityDate="2018-10-22T08:29:10.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4488" PostTypeId="4" CreationDate="2018-10-22T08:29:10.513" Score="0" Body="For questions related to applications of quantum computing in the biological sciences." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:56:39.253" LastActivityDate="2019-01-01T09:56:39.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4489" PostTypeId="5" CreationDate="2018-10-22T08:30:50.790" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T08:30:50.790" LastActivityDate="2018-10-22T08:30:50.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4490" PostTypeId="4" CreationDate="2018-10-22T08:30:50.790" Score="0" Body="For questions about the construction of complex circuits using elementary quantum gates." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T08:45:12.973" LastActivityDate="2019-01-01T08:45:12.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4491" PostTypeId="5" CreationDate="2018-10-22T08:31:32.500" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T08:31:32.500" LastActivityDate="2018-10-22T08:31:32.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4492" PostTypeId="4" CreationDate="2018-10-22T08:31:32.500" Score="0" Body="For questions related to quantum computing and quantum information research. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:48:29.127" LastActivityDate="2019-01-01T09:48:29.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4493" PostTypeId="5" CreationDate="2018-10-22T08:42:50.860" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T08:42:50.860" LastActivityDate="2018-10-22T08:42:50.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4494" PostTypeId="4" CreationDate="2018-10-22T08:42:50.860" Score="0" Body="For questions about quantum computing models which utilize spin (e.g. electronic spin, nuclear spin, etc.) particles as qubits" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T08:42:50.860" LastActivityDate="2018-10-22T08:42:50.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4495" PostTypeId="1" AcceptedAnswerId="4496" CreationDate="2018-10-22T09:24:57.463" Score="3" ViewCount="113" Body="&lt;p&gt;I would like to calculate the state after a transformation using the Hadamard gate on a complex state. I get stuck mid-calculation, most likely due to not being able to dealing with the global state. Anybody who can tell me what the part on the question mark should be (and/or which other errors I made)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H {|0\rangle + i|1\rangle\over\sqrt 2} \equiv&#xA;{1\over\sqrt 2}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix} {1\over\sqrt 2} \begin{bmatrix} 1 \\ i \end{bmatrix} = &#xA;{1\over2} \begin{bmatrix}1+i\\1-i\end{bmatrix} = &#xA;? =&#xA;{1\over\sqrt 2} \begin{bmatrix}1\\-i\end{bmatrix}&#xA;\equiv&#xA;{|0\rangle - i|1\rangle\over\sqrt 2}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update trying to use @DaftWullie his answer:&#xA;&lt;span class=&quot;math-container&quot;&gt;$H {|0\rangle + i|1\rangle\over\sqrt 2} \equiv&#xA;{1\over\sqrt 2}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix} {1\over\sqrt 2} \begin{bmatrix} 1 \\ i \end{bmatrix} = &#xA;{1\over2} \begin{bmatrix}1+i\\1-i\end{bmatrix} \neq&#xA;{1\over\sqrt 2} \begin{bmatrix}1+i\\1-i\end{bmatrix} =&#xA;\begin{bmatrix}{1\over\sqrt 2}+{1\over\sqrt 2}i\\{1\over\sqrt 2}-{1\over\sqrt 2}i\end{bmatrix} =&#xA;\begin{bmatrix}\cos(\pi/4)+i \cdot \sin(\pi/4)\\&#xA;(\cos(\pi/4)+i \cdot \sin(\pi/4))\cdot(\cos(\pi/2-i\cdot \sin(\pi/2))\end{bmatrix} = &#xA;\begin{bmatrix}e^{i\pi/4}\\e^{-i\pi/2}e^{i\pi/4}\end{bmatrix}=\\&#xA;e^{i\pi/4}\begin{bmatrix}1\\e^{-i\pi/2}\end{bmatrix}=&#xA;e^{i}e^{\pi/4}\begin{bmatrix}1\\e^{-i\pi/2}\end{bmatrix}\equiv&#xA;e^{\pi/4}\begin{bmatrix}1\\e^{-i\pi/2}\end{bmatrix} = &#xA;{1\over\sqrt 2}\begin{bmatrix}1\\-i\end{bmatrix} &#xA;\equiv&#xA;{|0\rangle - i|1\rangle\over\sqrt 2}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I still get partly stuck, as I was expecting to calculate using &lt;span class=&quot;math-container&quot;&gt;${1\over 2}$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;${1\over\sqrt 2}$&lt;/span&gt;. I see that this too falls into the category of &quot;multiplies the whole vector has no observable consequence&quot;, but I wonder if I can calculate this &quot;cleaner&quot; (or did I simply make a mistake?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, how do I indicate removing the global phase in an equation? Do I use the equivalence symbol? An equal symbol with a footnote above it?&lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="26" LastEditDate="2018-12-23T11:23:08.517" LastActivityDate="2018-12-23T11:23:08.517" Title="Outcome of Hadamard transformation on a complex state" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4496" PostTypeId="2" ParentId="4495" CreationDate="2018-10-22T09:30:58.250" Score="3" Body="&lt;p&gt;Taking out a common factor,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;?=\frac{e^{i\pi/4}}{\sqrt{2}}\left[\begin{array}{c}1 \\ e^{-i\pi/2}\end{array}\right]&#xA;$$&lt;/span&gt;&#xA;Then the equality that comes after the ? is &quot;up to global phases&quot;, meaning that any factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; that multiplies the whole vector has no observable consequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the update... You've made several things worse. Let me emphasise that the things with no obervable consequence are overall multiplicative factors &lt;em&gt;of modulus 1&lt;/em&gt;. Lengths are very important and you can't arbitrarily play around with factor of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;. Let me suggest you think of your sequence thus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}\left[\begin{array}{c} 1+i \\ 1-i \end{array}\right]=\left[\begin{array}{c} \frac{1+i}{2} \\ \frac{1-i}{2} \end{array}\right]=\left[\begin{array}{c} \frac{e^{i\pi/4}}{\sqrt{2}} \\ \frac{e^{-i\pi/4}}{\sqrt{2}}\end{array}\right]=\left[\begin{array}{c} \frac{e^{i\pi/4}}{\sqrt{2}} \\ \frac{e^{i\pi/4}e^{-i\pi/2}}{\sqrt{2}}\end{array}\right]=e^{i\pi/4}\left[\begin{array}{c} \frac{1}{\sqrt{2}} \\ \frac{e^{-i\pi/2}}{\sqrt{2}}\end{array}\right]=e^{i\pi/4}\left[\begin{array}{c} \frac{1}{\sqrt{2}} \\ \frac{-i}{\sqrt{2}}\end{array}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware for a standadr notation for &quot;up to a global phase&quot;. You might chose to write &lt;span class=&quot;math-container&quot;&gt;$\equiv\left[\begin{array}{c} \frac{1}{\sqrt{2}} \\ \frac{-i}{\sqrt{2}}\end{array}\right]$&lt;/span&gt;, but most people tend to write &quot;up to a global phase&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-22T15:04:46.780" LastActivityDate="2018-10-22T15:04:46.780" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4497" PostTypeId="5" CreationDate="2018-10-22T12:39:05.920" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:39:05.920" LastActivityDate="2018-10-22T12:39:05.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4498" PostTypeId="4" CreationDate="2018-10-22T12:39:05.920" Score="0" Body="A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits. It is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-10T15:54:51.970" LastActivityDate="2019-05-10T15:54:51.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4499" PostTypeId="5" CreationDate="2018-10-22T12:41:31.087" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:41:31.087" LastActivityDate="2018-10-22T12:41:31.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4500" PostTypeId="4" CreationDate="2018-10-22T12:41:31.087" Score="0" Body="For questions related to the 72 qubit quantum processor launched by Google in 2018." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:11:21.840" LastActivityDate="2019-01-01T10:11:21.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4501" PostTypeId="5" CreationDate="2018-10-22T12:42:39.557" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:42:39.557" LastActivityDate="2018-10-22T12:42:39.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4502" PostTypeId="4" CreationDate="2018-10-22T12:42:39.557" Score="0" Body="Rigetti Computing is a Berkeley, California-based developer of quantum integrated circuits used for quantum computers. The company also develops a cloud platform called Forest that enables programmers to write quantum algorithms. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:42:39.557" LastActivityDate="2018-10-22T12:42:39.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4503" PostTypeId="5" CreationDate="2018-10-22T12:47:29.330" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:47:29.330" LastActivityDate="2018-10-22T12:47:29.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4504" PostTypeId="4" CreationDate="2018-10-22T12:47:29.330" Score="0" Body="For questions about the hidden subgroup problem. The hidden subgroup problem (HSP) is a topic of research in mathematics and theoretical computer science. The framework captures problems like factoring, graph isomorphism, and the shortest vector problem. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:47:29.330" LastActivityDate="2018-10-22T12:47:29.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4505" PostTypeId="5" CreationDate="2018-10-22T12:50:51.887" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:50:51.887" LastActivityDate="2018-10-22T12:50:51.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4506" PostTypeId="4" CreationDate="2018-10-22T12:50:51.887" Score="0" Body="For questions about the amplitude-amplitude algorithm. Do NOT use for general Grover's algorithm related question. Amplitude amplification is a technique in quantum computing which generalizes the idea behind Grover's search algorithm and gives rise to a family of quantum algorithms. It was discovered by Gilles Brassard and Peter Høyer in 1997 and independently rediscovered by Lov Grover in 1998. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:50:51.887" LastActivityDate="2018-10-22T12:50:51.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4507" PostTypeId="5" CreationDate="2018-10-22T12:52:33.183" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-10-22T12:52:33.183" LastActivityDate="2018-10-22T12:52:33.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4508" PostTypeId="4" CreationDate="2018-10-22T12:52:33.183" Score="0" Body="Quantum assembly language (QASM) called OpenQASM is used to implement experiments with low depth quantum circuits. OpenQASM represents universal physical circuits over the CNOT plus SU(2) basis with straight-line code that includes measurement, reset, fast feedback, and gate subroutines. The simple text language can be written by hand or by higher level tools and may be executed on the IBM Q Experience. (arXiv:1707.03429)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:57:45.427" LastActivityDate="2019-01-01T09:57:45.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4509" PostTypeId="1" AcceptedAnswerId="4515" CreationDate="2018-10-22T13:12:00.393" Score="3" ViewCount="550" Body="&lt;p&gt;Is there a way to express the general &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; Hamiltonian in some block diagonal form of &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; matrices that I can solve, knowing the exact solution of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is necessary for the treatment I am going to perform later, as I cannot go for general quartics solutions of this system. I need to see the action of the Hamiltonian to subspaces and the interaction between them.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2018-10-22T17:24:37.183" LastActivityDate="2018-10-23T07:34:15.193" Title="Is there a way to express the general 4X4 Hamiltonian in some block diagonal form of 2X2 matrices that I can solve, knowing the exact solution of 2X2?" Tags="&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4510" PostTypeId="1" AcceptedAnswerId="4512" CreationDate="2018-10-22T18:30:48.730" Score="3" ViewCount="150" Body="&lt;p&gt;I'm trying to study quantum entanglement variation during quantum computation with 4 qubit systems comprising a variety of quantum gates.&#xA;How can I simulate this variation on MATLAB? Is there any other alternatives?&lt;/p&gt;&#xA;" OwnerUserId="4460" LastEditorUserId="26" LastEditDate="2018-10-22T18:33:38.257" LastActivityDate="2018-10-23T01:10:49.423" Title="How to simulate quantum entanglement variation in different quantum gates?" Tags="&lt;entanglement&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4511" PostTypeId="2" ParentId="4413" CreationDate="2018-10-22T18:48:57.600" Score="0" Body="&lt;p&gt;A general way you can predict the measurement outcomes is to calculate the density matrix as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = |\Psi \rangle \langle \Psi|$&lt;/span&gt; and calculate the &lt;a href=&quot;https://physics.stackexchange.com/a/180682/134583&quot;&gt;partial trace&lt;/a&gt; over qubits &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \rm{Tr}_{B,C} \left(\rho \right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then have a 2x2 density matrix where the two diagonals tell you the probabilities of getting &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-10-22T18:48:57.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4512" PostTypeId="2" ParentId="4510" CreationDate="2018-10-23T01:10:49.423" Score="4" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;/strong&gt; Choose a &lt;a href=&quot;https://www.quantiki.org/wiki/entanglement-measure&quot; rel=&quot;noreferrer&quot;&gt;measure&lt;/a&gt; for the entanglement. There are &lt;a href=&quot;https://physics.stackexchange.com/questions/322317/why-are-there-so-many-different-measures-of-entanglement&quot;&gt;a lot of entanglement measures&lt;/a&gt;, some of them are easier to calculate in MATLAB than others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;/strong&gt; Initialize your 4-qubit system's density matrix. It will be a 16x16 matrix since &lt;span class=&quot;math-container&quot;&gt;$2^4 = 16$&lt;/span&gt;. This means all calculations will be very fast in MATLAB and you will have no problem working with the density matrix rather than wavefunction. You could also work with the wavefunction, but a lot of entanglement measures are defined in terms of the density matrix so it's better to work with the density matrix for this type of thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 3:&lt;/em&gt;&lt;/strong&gt; Apply your various gates. They will be unitaries, so this will just be some matrix multiplications like: &lt;span class=&quot;math-container&quot;&gt;$\rho_{t} = U\rho_{t-1} U^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho_{t-1}$&lt;/span&gt; is the density matrix before the gate is applied, and &lt;span class=&quot;math-container&quot;&gt;$\rho_{t}$&lt;/span&gt; is the density matrix after the gate is applied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 4:&lt;/em&gt;&lt;/strong&gt; Calculate the your entanglement measure, which can be a function of the density matrix: &lt;span class=&quot;math-container&quot;&gt;$f(\rho_t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 5:&lt;/em&gt;&lt;/strong&gt; Now you have &lt;span class=&quot;math-container&quot;&gt;$f(\rho_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(\rho_2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(\rho_3) \ldots $&lt;/span&gt;&lt;br&gt;&#xA;You now have the entanglement measure at each point in time, and you can plot this and see how your measure of etanglement varies over the course of applying all your gates.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-10-23T01:10:49.423" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="4513" PostTypeId="2" ParentId="4509" CreationDate="2018-10-23T01:14:31.597" Score="0" Body="&lt;p&gt;If you want to diagonalize a general 4x4 Hamiltonian, you cannot just diagonalize the four 2x2 blocks and piece together what you get. You need to diagonalize the entire 4x4 matrix all at once. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the 4x4 matrix is already block diagonal, then of course you can diagonalize each 2x2 block separately, but not in the general case where all 16 elements of the 4x4 matrix can be arbitrary.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-10-23T01:14:31.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4514" PostTypeId="2" ParentId="4470" CreationDate="2018-10-23T06:52:25.453" Score="4" Body="&lt;p&gt;It seems this problem is open.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Watrous [&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0022000099916550&quot; rel=&quot;nofollow noreferrer&quot;&gt;J.&amp;nbsp;Comp. Sys. Sci. &lt;strong&gt;59&lt;/strong&gt;, (pp.&amp;nbsp;281-326), 1999&lt;/a&gt;]&#xA;proved that any space &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; bounded quantum Turing Machine (for space constructible &lt;span class=&quot;math-container&quot;&gt;$s(n)&amp;gt;\Omega(\log n)$&lt;/span&gt;) can be simulated by deterministic Turing machine with &lt;span class=&quot;math-container&quot;&gt;$O(s^2)$&lt;/span&gt; space.&#xA;With the assumption &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P \neq SC}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SC \subseteq P}$&lt;/span&gt; is defined as &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:S#sc&quot; rel=&quot;nofollow noreferrer&quot;&gt;the class of problems solvable by a DTM simultaneously in polynomial time and poly-logarithmic space&lt;/a&gt;), quantum machines will not reduce space complexity exponentially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N.B.&amp;nbsp;We don't know whether &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P=SC}$&lt;/span&gt; or not, though it is considered unlikely that they would be equal.&lt;/p&gt;&#xA;" OwnerUserId="4213" LastEditorUserId="124" LastEditDate="2018-10-23T09:28:44.947" LastActivityDate="2018-10-23T09:28:44.947" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4515" PostTypeId="2" ParentId="4509" CreationDate="2018-10-23T07:34:15.193" Score="3" Body="&lt;p&gt;I don't have a completely general method for doing what you ask. However, there are a few of the steps that I might take:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can always be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=a\mathbb{I}\otimes\mathbb{I}+\underline{n}_1\cdot\underline{\sigma}\otimes\mathbb{I}+\mathbb{I}\otimes\underline{n}_2\cdot\underline{\sigma}+\underline{\sigma}\cdot M\cdot\underline{\sigma}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a real &lt;span class=&quot;math-container&quot;&gt;$3\times 3$&lt;/span&gt; matrix. Remember that if you want to find the coefficient of a particular term, then you can calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(H(\sigma_i\otimes\sigma_j))/4&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$i,j\in\{0,1,2,3\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you implement the unitary &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; on qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, Pauli matrices change as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_j\mapsto \underline{R}_j^{(i)}\cdot\underline{\sigma},&#xA;$$&lt;/span&gt;&#xA;and, if you work it through, you find that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; updates to &lt;span class=&quot;math-container&quot;&gt;$R^{(1)}\cdot M\cdot {R^{(2)}}^T$&lt;/span&gt;. So, you can choose the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; matrices to be the matrices that yield the singular values of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. In that way, you only ever have to deal with a matrix of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H= a\mathbb{I}\otimes\mathbb{I}+\underline{m}_1\cdot\underline{\sigma}\otimes\mathbb{I}+\mathbb{I}\otimes\underline{m}_2\cdot\underline{\sigma}+n_1X\otimes X+n_2Y\otimes Y+n_3Z\otimes Z.&#xA;$$&lt;/span&gt;&#xA;If you get lucky and the local fields are in the Z-direction only, this matrix divides into two &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices spanned by &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|11\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other option is that if you get really lucky (e.g. in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/3823/1837&quot;&gt;question&lt;/a&gt;!), the non-zero terms in the decomposition all mutually commute. Then you can analytically diagonalise &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in a much easier manner.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, all of that is far more work that just throwing the &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix into the computer and asking for the eigenvalues. After all, I've already had to require diagonalization of a &lt;span class=&quot;math-container&quot;&gt;$3\times 3$&lt;/span&gt; matrix. (Where it is more useful is if you have a translation invariant Hamiltonian of many qubits.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-23T07:34:15.193" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4516" PostTypeId="2" ParentId="4260" CreationDate="2018-10-23T12:26:12.660" Score="3" Body="&lt;p&gt;See the answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4270/how-would-one-implement-a-quantum-equivalent-of-a-while-loop-in-ibm-qiskit&quot;&gt;this question&lt;/a&gt; for more on how the classical control works. Basically, your operations are controlled on the integer stored (in binary) across a register rather than on the individual bits themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't quite know the 'best practice' way of controlling on single bits, but I can tell you my workaround. Instead of creating a register with two bits, I create a list of two single qubit registers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = [ ClassicalRegister(1) for _ in range(2) ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;These can be added using the &lt;code&gt;add&lt;/code&gt; method of a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(1)&#xA;qc = QuantumCircuit(q)&#xA;for register in c:&#xA;    qc.add_register( register )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then it is possible to use your 'building the circuit' code can be done with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.h(q)&#xA;qc.measure(q,c[0])&#xA;qc.x(q[0]).c_if(c[0], 0)&#xA;qc.measure(q,c[1])&#xA;circuit_drawer(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works because &lt;code&gt;c[0]&lt;/code&gt; now refers to a classical register, rather than a single bit from a classical register.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2020-01-03T12:22:20.227" LastActivityDate="2020-01-03T12:22:20.227" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4518" PostTypeId="2" ParentId="4472" CreationDate="2018-10-23T22:06:45.443" Score="0" Body="&lt;p&gt;What you have in the title of your question is known as the &quot;mixed-product property&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vO3PO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vO3PO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you can get this plus many other properties from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker product&lt;/a&gt; wikipedia page.&#xA;The other answers have shown why the mixed-product property holds true for the &lt;strong&gt;&lt;em&gt;left Kronecker product&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerDisplayName="user2898" LastActivityDate="2018-10-23T22:06:45.443" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4519" PostTypeId="1" AcceptedAnswerId="4526" CreationDate="2018-10-24T00:05:36.277" Score="2" ViewCount="407" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1810.04521&quot; rel=&quot;nofollow noreferrer&quot;&gt;Duality, matroids, qubits, twistors and surreal numbers&lt;/a&gt; (recently submitted!) they &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;show that via the Grassmann-Plucker relations, the various apparent unrelated concepts, such as duality, matroids, qubits, twistors and surreal numbers are, in fact, deeply connected.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The paper includes many interesting topics which I am not well versed in (Grassmannian, Plucker Embedding, Hopf Map, Matroids, etc) &amp;amp; am wondering if it might be possible that someone could explain Grassmann-Plucker relations &amp;amp; how they are used in a quantum context?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2018-10-25T02:21:16.190" Title="What are Grassmann-Plucker relations?" Tags="&lt;resource-request&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4520" PostTypeId="2" ParentId="4519" CreationDate="2018-10-24T01:08:53.967" Score="3" Body="&lt;p&gt;Consider a single fermionic state given by a single Slater determinant. Let the Hilbert space for the single mode be &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt;. Let there be &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; fermions. Then that single Slater determinant is the Plucker embedding with the same notation as on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pl%C3%BCcker_embedding&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki page&lt;/a&gt;. The task of the Plucker relations is then to identify this embedding from the full projectivized fermionic Hilbert space. What homogenous equations do you need to impose on the entries of the vector in order to know that it came from a single Slater determinant? That is the question that these relations answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I had left it as unsaid implication, but @DavidBarMoshe made a good point about being explicit about it. Working within this embedding is beginning premise of Hartree-Fock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is analogous to the similar question about the &lt;a href=&quot;https://en.wikipedia.org/wiki/Segre_embedding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Segre embedding&lt;/a&gt; judging which states are entangled or not. That is the comment about this being a determinantal variety.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not familiar with the linked paper, so I have no comment about how they use these definitions.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2018-10-25T02:21:16.190" LastActivityDate="2018-10-25T02:21:16.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4521" PostTypeId="1" CreationDate="2018-10-24T02:05:09.593" Score="4" ViewCount="836" Body="&lt;p&gt;I am trying to simulate Deutsch's algorithm, and I need to apply the oracle function matrix to my circuit.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2020-04-29T19:08:57.567" Title="How do I create my own unitary matrices that I can apply to a circuit in Cirq?" Tags="&lt;cirq&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4522" PostTypeId="2" ParentId="4521" CreationDate="2018-10-24T02:21:50.317" Score="2" Body="&lt;p&gt;I searched for doing a custom gate on the Cirq documentation and here are the  &lt;a href=&quot;https://cirq.readthedocs.io/en/latest/simulation.html?highlight=Custom%20gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;results&lt;/a&gt; :&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Gate sets&lt;/p&gt;&#xA;&lt;p&gt;The xmon simulator is designed to work with operations that&#xA;are either a GateOperation applying an XmonGate, a CompositeOperation&#xA;that decomposes (recursively) to XmonGates, or a 1-qubit or 2-qubit&#xA;operation with a KnownMatrix. By default the xmon simulator uses an&#xA;Extension defined in xgate_gate_extensions to try to resolve gates&#xA;that are not XmonGates to XmonGates.&lt;/p&gt;&#xA;&lt;p&gt;So if you are using a custom gate, there are multiple options for&#xA;getting it to work with the simulator:&lt;/p&gt;&#xA;&lt;p&gt;Define it directly as an XmonGate. Provide a CompositeGate made up of&#xA;XmonGates. Supply an Exentension to the simulator which converts the&#xA;gate to an XmonGate or to a CompositeGate which itself can be&#xA;decomposed in XmonGates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-10-24T03:24:04.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4523" PostTypeId="2" ParentId="4521" CreationDate="2018-10-24T08:07:07.267" Score="3" Body="&lt;p&gt;[Note: this answer is outdated]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is going to change somewhat radically in the next version of cirq, so I'll give an answer for both versions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In v0.3, in order for a simulator to understand a custom gate, the gate must implement either &lt;code&gt;cirq.CompositeGate&lt;/code&gt; or &lt;code&gt;cirq.KnownMatrix&lt;/code&gt;. For your case, the simplest is to implement the matrix:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# assuming cirq v0.3&#xA;import cirq&#xA;import numpy as np&#xA;class Oracle(cirq.Gate, cirq.KnownMatrix):&#xA;    def __init__(self, secret_state, qubit_count):&#xA;        self.secret_state = secret_state&#xA;        self.qubit_count = qubit_count&#xA;    def matrix(self):&#xA;        m = np.eye(1 &amp;lt;&amp;lt; self.qubit_count)&#xA;        m[self.secret_state, self.secret_state] = -1&#xA;        return m&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use this oracle to simulate e.g. a Grover circuit and see that the secret state ends up with quite a high probability:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qs = cirq.LineQubit.range(5)&#xA;secret = 5&#xA;oracle = Oracle(secret, len(qs)).on(*qs)&#xA;&#xA;diffusion = [&#xA;    cirq.H.on_each(qs),&#xA;    Oracle(0, len(qs)).on(*qs),&#xA;    cirq.H.on_each(qs)&#xA;]&#xA;c = cirq.Circuit.from_ops(&#xA;    cirq.H.on_each(qs),&#xA;    [oracle, diffusion] * 4&#xA;)&#xA;output_vector = c.apply_unitary_effect_to_state()&#xA;print(np.round(abs(output_vector)**2, 3))&#xA;# [0  0  0  0  0  .999  0  0 ...]&#xA;#                  ^ big probability at offset 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the coming v0.4 the classes such as &lt;code&gt;KnownMatrix&lt;/code&gt; will be replaced by &quot;magic methods&quot; such as &lt;code&gt;_unitary_&lt;/code&gt;. (This is generally how things are supposed to be done in python.) One of those magic methods is &lt;code&gt;_apply_unitary_to_tensor_&lt;/code&gt;, which is used to enable faster simulation. With that method the oracle application can be simulated much much faster; in &lt;span class=&quot;math-container&quot;&gt;$O(q)$&lt;/span&gt; time instead of &lt;span class=&quot;math-container&quot;&gt;$O(4^q)$&lt;/span&gt; time assuming the oracle covers all of the qubits. We also happen to avoid the need to know the number of qubits ahead of time:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# assuming cirq v0.4&#xA;import cirq&#xA;class Oracle(cirq.Gate):&#xA;    def __init__(self, secret_state):&#xA;        self.secret_state = secret_state&#xA;    def _apply_unitary_to_tensor_(self, target_tensor, available_buffer, axes):&#xA;        s = cirq.slice_for_qubits_equal_to(axes, self.secret_state)&#xA;        target_tensor[s] *= -1&#xA;        return target_tensor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-04-29T19:08:57.567" LastActivityDate="2020-04-29T19:08:57.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4524" PostTypeId="1" AcceptedAnswerId="4525" CreationDate="2018-10-24T08:59:54.197" Score="2" ViewCount="575" Body="&lt;p&gt;I am having hard time figuring out how the CX (controlled-NOT) gate is represented in the matrix representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understood that tensor product and the identity matrix are the keys, and I understood how the matrix representation works for single-qubit matrices. For example, if we have a circuit with a quantum register &lt;code&gt;q&lt;/code&gt; composed of 3 qubits, the operation &lt;code&gt;X q[1]&lt;/code&gt; has the matrix representation &lt;sup&gt;1&lt;/sup&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I_2 \otimes X \otimes I_2 = \begin{pmatrix} &#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, I am aware of the matrix representation of the CX gate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking back our quantum register &lt;code&gt;q&lt;/code&gt;, applying &lt;code&gt;CX&lt;/code&gt; to the second (control) and third register (target) (&lt;code&gt;CX q[1], q[2]&lt;/code&gt;) gives us the matrix representation &lt;sup&gt;2&lt;/sup&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I_2 \otimes CX = \begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem comes when we try to apply the &lt;code&gt;CX&lt;/code&gt; gate to other pairs of qubits:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I suspect the matrix representation of &lt;code&gt;CX q[2], q[1]&lt;/code&gt; (applying a &lt;code&gt;CX&lt;/code&gt; gate with the third qubit of the system as control and the second qubit of the system as target) to be &lt;span class=&quot;math-container&quot;&gt;$I_2 \otimes CX^r$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$$CX^r = \begin{pmatrix}&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;but I am not sure.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I really don't know how &lt;code&gt;CX q[0], q[2]&lt;/code&gt; (applying a &lt;code&gt;CX&lt;/code&gt; gate with the first qubit of the system as control and the third qubit of the system as target) would be represented. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To summarise&lt;/strong&gt;, my question is &quot;how does the &lt;code&gt;CX&lt;/code&gt; (or more generally multi-qubit gates) is represented as a matrix when there are more than 2 qubits in the system?&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; Computed with Python and numpy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;X = np.array([[0, 1], [1, 0]])&#xA;ID2 = np.identity(2)&#xA;print(np.kron(np.kron(ID2, X), X))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2&lt;/sup&gt; Computed with Python and numpy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;CX = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])&#xA;ID2 = np.identity(2)&#xA;print(np.kron(ID2, CX))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="26" LastEditDate="2018-12-23T11:22:02.890" LastActivityDate="2018-12-23T11:22:02.890" Title="Matrix representation and CX gate" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ClosedDate="2018-10-24T09:39:24.797" ContentLicense="CC BY-SA 4.0" />
  <row Id="4525" PostTypeId="2" ParentId="4524" CreationDate="2018-10-24T09:20:57.293" Score="2" Body="&lt;p&gt;An easy way is to get it via braket notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the general case of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. The representation of a CNOT between the last two qubits (last qubit being the target) is easily seen to be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\ketbra}[1]{\lvert#1\rangle\!\langle#1\rvert}&#xA;CX_{n-1\to n}= I_{2^{n-2}}\otimes\big(\ketbra0\otimes I_2+\ketbra1\otimes X\big),$$&lt;/span&gt;&#xA;that is, in matrix notation, the resulting of tensoring the identity over the first &lt;span class=&quot;math-container&quot;&gt;$n-2$&lt;/span&gt; qubits with the usual CNOT matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if the CNOT acts instead between the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th qubits?&#xA;The braket representation does not change significantly, we just need to change the order of the terms so that it becomes a bit uglier&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;CX_{i\to j} &amp;amp;=&#xA;I_{2^{i-1}}\otimes\ketbra0\otimes I_{2^{j-i-1}}\otimes I\otimes I_{2^{n-j}} \\&#xA;&amp;amp;+ I_{2^{i-1}}\otimes\ketbra1\otimes I_{2^{j-i-1}}\otimes X\otimes I_{2^{n-j}}.&#xA;\end{align}&lt;/span&gt;&#xA;To build up the typical matrix representation you then just compute the Kronecker product of these terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;, the control is the third qubit and the target is the first second qubit, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CX_{3\to 2}=I\otimes I\otimes\ketbra0+I\otimes X\otimes \ketbra1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; Note that the way I've written it, this representation only works for &lt;span class=&quot;math-container&quot;&gt;$i&amp;lt;j$&lt;/span&gt;, but I'm sure you can easily see what it becomes when &lt;span class=&quot;math-container&quot;&gt;$i&amp;gt;j$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-10-24T09:20:57.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4526" PostTypeId="2" ParentId="4519" CreationDate="2018-10-24T11:46:41.437" Score="2" Body="&lt;p&gt;(This answer is given from the point of view of the theory of quantization, in which quantum systems are described by means of a quantization map of a classical phase space into a quantum space. The Plucker embedding will be described as a special case of such a map. This case has many applications in quantum computation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical dynamics takes place on manifolds. For example, the dynamics of a particle moving on a straight line is completely determined by its initial position &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and momentum &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; (or equivalently velocity).  The set of initial parameters needed to determine the dynamics, i.e., to solve the equations of motion is known as the system's phase space. In the above case it is &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^2$&lt;/span&gt;. i.e., a two -dimensional vector space of all possible values of the position and the momentum. The dynamics is generated by functions on the phase called Hamiltonians &lt;span class=&quot;math-container&quot;&gt;$H(p, q)$&lt;/span&gt; through the Hamilton's equation of motion: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{dx}{dt} = \frac{\partial H}{\partial p}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{dp}{dt} = -\frac{\partial H}{\partial x}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; = time). The Hamiltonian corresponding to free motion is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H(p, q) = \frac{1}{2m} p^2$$&lt;/span&gt;&#xA;Any reasonable function on the phase space can serve as  a classical Hamiltonian. For example, the function:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H(p, q) = p^2 + x^2$$&lt;/span&gt;&#xA;is the classical Hamiltonian of the Harmonic oscillator (which is the basis of continuous variable models.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase spaces (i.e., sets of initial data) need not necessarily be vector spaces. This can happen, for example, if the particle's position is confined, for example, a particle in a box, or a particle with rotational degrees of freedom, in which the angular position is confined to lie on a sphere. In all the above cases, the particle momentum is not confined and can assume any value, thus the phase space has an infinite volume, as it has unbounded directions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum systems (including all quantum systems used in quantum computing, such as qubits, qudits, continuous variable models, toric codes, etc.) can be described by a classical system + a procedure of quantization, in which the phase space geometrical manifold is traded by a quantum system Hilbert space and the Hamiltonian functions are traded by operators on the Hilbert space. There is no unique procedure applicable to all kinds of systems, different quantization procedures often give slightly different results, but nevertheless, I'll describe one of these procedures which is certainly applicable at least when the quantum Hilbert spaces are finite dimensional (such as the case of qudits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let me remark that a Hilbert space does not describe the quantum mechanical set of pure states because in quantum mechanics there is no relevance to the overall magnitude and phase of a state vector; the pure states are described by rays; thus, we are talking about a projective Hilbert space which is a Hilbert space with an equivalence relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle \sim c |\Psi\rangle, \quad c \in \mathbb{C},   \quad c \ne 0   $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the Hilbert space is finite dimensional, the projective Hilbert spaces are called projective vector spaces or simple projective spaces, for example the projective vector space corresponding to an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensional complex vector space is called a complex projective space and denoted by &lt;span class=&quot;math-container&quot;&gt;$P(\mathbb{C}^n) \cong \mathbb{C}P^{n-1}$&lt;/span&gt; (Its dimension is &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt;, one dimension less due to the equivalence relation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantization procedure in this case reduces to an embedding of a classical phase &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; space into a quantum space &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; of states which an appropriate projective vector space:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M \overset{i}{\rightarrow} Q = \mathbb{C}P^{n-1}$$&lt;/span&gt;&#xA;In each quantization method, there is a recipe of how given a classical Hamiltonian function, one can construct a corresponding quantum operator (at least for a certain class of functions). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the Hilbert spaces are finite dimensional, such as in the qudit case, the corresponding phase spaces have finite volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the most amazing things in the above quantization procedure is that in the case of a qudit, the complex projective space is also the classical phase space. Please see  &lt;a href=&quot;https://arxiv.org/abs/gr-qc/9706069v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ashtekar and Schilling&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This does not mean that quantum mechanics is equivalent to classical mechanics. It only means that the space of classical pure states is the same as the space of quantum pure states. The difference lies in  the process of measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me remark that the qudit is a representative case where the  dimension of the quantum Hilbert space is finite, in this case the volume of the classical phase space is also finite. This is a general principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above complete correspondence breaks in cases other than a single qudit. For example, for a set of two &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional qudits, the phase space &lt;span class=&quot;math-container&quot;&gt;$M =  \mathbb{C}P^{n-1} \otimes \mathbb{C}P^{n-1}$&lt;/span&gt; while the quantum space is  &lt;span class=&quot;math-container&quot;&gt;$Q =  \mathbb{C}P^{2n-1} $&lt;/span&gt;. The quantization map: &lt;span class=&quot;math-container&quot;&gt;$M \overset{i}{\rightarrow} Q$&lt;/span&gt; in this case is a special case of the Segre embedding mentioned in AHusain's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another case of with a finite dimensional Hilbert case is the case of fermions. A set of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; fermions living in an &lt;span class=&quot;math-container&quot;&gt;$n \ge k$&lt;/span&gt; dimensional Hilbert space can assume only certain entangled state vectors which are fully antisymmetric (because fermions cannot be in the same state), for example a set of two fermions (&lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;) on a &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt; dimensional Vector space can assume only the following state vectors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\Psi\rangle =  c_{12} v_1\wedge v_2  +  c_{13} v_1\wedge v_3  + c_{14} v_1\wedge v_4  + c_{23} v_2\wedge v_3  + c_{24} v_2\wedge v_4  + c_{34}  v_3\wedge v_4 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The wedge &lt;span class=&quot;math-container&quot;&gt;$\wedge$&lt;/span&gt; is the antisymmetric tensor product: &lt;span class=&quot;math-container&quot;&gt;$v_i \wedge v_j = v_i \otimes v_j - v_j \otimes v_i$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complex dimension of this vector space is &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; and of the corresponding projective vector space is &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; (the real dimension is 10).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classical phase space of the above set of fermions can be obtained as follows: Taking a fixed fermionic state, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\Psi\rangle =  v_1\wedge v_2  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vectors &lt;span class=&quot;math-container&quot;&gt;$v_i$&lt;/span&gt; are 4 dimensional; the phase space is the orbit of the action of the unitary group &lt;span class=&quot;math-container&quot;&gt;$U(4)$&lt;/span&gt; on this fixed vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ g \cdot |\Psi\rangle =  gv_1\wedge gv_2, \quad g \in U(4)  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; acts only within the two dimensional subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$v_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_4$&lt;/span&gt;, it clearly does not change the fermion state; also if &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; acts only within the two dimensional subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$v_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_2$&lt;/span&gt;, it also does not the fermion state because it only changes the basis, thus there is a subgroup &lt;span class=&quot;math-container&quot;&gt;$U(2) \times U(2)$&lt;/span&gt; which does not change the initial state, thus the phase space in this case is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Gr(2, 4) = \frac{U(4)}{U(2) \times U(2)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This manifold is called the complex Grassmann manifold. The dimension in our case is: &lt;span class=&quot;math-container&quot;&gt;$4^2-2^2-2^2 = 8$&lt;/span&gt;. The quantization map, i.e., the embedding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Gr(2, 4)  \overset{i}{\rightarrow} \mathbb{C}P^{5}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is called the &lt;em&gt;Plucker embedding&lt;/em&gt; (this term is applicable in the general case, for arbitrary &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; ) . It is clear from comparing the dimensions (&lt;span class=&quot;math-container&quot;&gt;$8 &amp;lt; 10$&lt;/span&gt;) that not every state in the projective Hilbert state can be obtained from a point of the Grassmannian, i.e., from a unitary rotation of a fixed initial state. Thus, if we take a general element in the projective space  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{5}$&lt;/span&gt;, there will be certain relations that it must satisfy to be a unitary rotation of a fixed elements, these are called the &quot;Plucker relations&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our example there is a single Plucker relation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$c_{12} c_{34} -c_{13} c_{24} + c_{14} c_{23} = 0$$&lt;/span&gt;&#xA;(These relations are necessarily homogeneous because both manifolds are projective. Please see for example the following &lt;a href=&quot;https://arxiv.org/abs/1508.03010&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; by Smirnov, where the Plucker embedding is explained in some detail, the above equation appears in example 2.11).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One use of the Grassmann manifold is in the solution the Schrödinger equation for fermions. Instead of looking for the ground state in the entire Hilbert space, we can formulate a variational problem running only on vectors belonging to the Grassmannian. This procedure, known as the Hartree-Fock method, results in an approximate solution. (This point was also mentioned in AHusain's answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see the following &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301140v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; by Karle  and Pachos analyzing the geometry of the Grassmannian &lt;span class=&quot;math-container&quot;&gt;$Gr(2,4)$&lt;/span&gt; from the holonomic quantum computation point of view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Grassmann manifold appears also as the ground state manifold of stabilizer codes, please see for example the following &lt;a href=&quot;https://arxiv.org/abs/1309.1534&quot; rel=&quot;nofollow noreferrer&quot;&gt;article &lt;/a&gt; by Zheng and Brun.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-10-24T16:28:05.363" LastActivityDate="2018-10-24T16:28:05.363" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4527" PostTypeId="1" CreationDate="2018-10-24T12:12:26.273" Score="11" ViewCount="610" Body="&lt;p&gt;What are the fields/business ideas that a new business can work on within quantum computing that can be profitable if this business has no access to onboard quantum setups but can access the cloud-based quantum computing platforms? What are the problems it can work on that can be valuable to industry?&lt;/p&gt;&#xA;" OwnerUserId="4718" LastEditorUserId="4718" LastEditDate="2018-10-27T10:26:03.630" LastActivityDate="2019-06-17T05:58:17.230" Title="Can quantum computing be profitable without quantum hardware?" Tags="&lt;applications&gt;&lt;technologies&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4528" PostTypeId="1" CreationDate="2018-10-24T13:43:48.723" Score="11" ViewCount="439" Body="&lt;p&gt;It is known by the no-cloning theorem that constructing a machine that is able to clone an arbitrary quantum state is impossible. However, if the copying is assumed not to be perfect, then universal quantum cloning machines can be generated, being able to create imperfect copies of arbitrary quantum states where the original state and the copy have a certain degree of fidelity that depends on the machine. I came across the paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9607018.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum copying: Beyond the no-cloning theorem&lt;/a&gt; by Buzek and Hillery where this kind of &lt;em&gt;universal quantum cloning machine&lt;/em&gt; is presented. However, this paper is from 1996 and I am not aware if some advances in this kind of machines have been done yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, I would like to know if someone does know if any advances in such kind of cloning machines have been done since then, that is, machines whose fidelity is better than the one presented in such paper, or the methods are less complex ... Additionally, it would be also interesting to obtain references about any useful application that such machines present if there is any.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2018-10-24T13:51:04.387" LastActivityDate="2018-12-26T17:28:21.067" Title="Imperfect Quantum Copying" Tags="&lt;quantum-state&gt;&lt;resource-request&gt;&lt;cloning&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4529" PostTypeId="2" ParentId="4528" CreationDate="2018-10-24T14:28:22.050" Score="10" Body="&lt;p&gt;Regarding the optimality of the results of your linked article [1],&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\!\langle#1\rvert}$&lt;/span&gt; we find in &lt;strong&gt;Section&amp;nbsp;III&amp;nbsp;A&lt;/strong&gt; that on input &lt;span class=&quot;math-container&quot;&gt;$\ket{\phi}$&lt;/span&gt;, the states produced by this imperfect cloning operation are of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\qquad\qquad\qquad&#xA;\rho_{\text{out}} \,=\, \tfrac{5}{6}\ket{\phi}\bra{\phi} \,+\, \tfrac{1}{6}\ket{\phi^\perp}\bra{\phi^\perp}\,,&#xA;\qquad\qquad\qquad(\text{3.16 paraphrased}) &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\ket{\phi^\perp}$&lt;/span&gt; is the unique state orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\ket{\phi}$&lt;/span&gt;. Put otherwise, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\qquad\qquad\qquad&#xA;\rho_{\text{out}} \,=\, \tfrac{2}{3}\ket{\phi}\bra{\phi} \,+\, \tfrac{1}{3}\rho_{noise}\,,&#xA;\qquad\qquad\qquad\qquad\qquad\qquad\qquad\; &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho_{\text{noise}} = \tfrac{1}{2}\mathbf 1$&lt;/span&gt; is the maximally mixed state. In this sense what you get is two copies of the state which you provide as input, albeit each being corrupted with white noise.&#xA;It turns out that this performance is optimal: in [2], it is shown that 5/6 is the optimal fidelity for 'universal cloners', which is what is shown to be achieved in Eqn.&amp;nbsp;(3.16) of [1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Buzek and Hillery.&#xA;&lt;em&gt;Quantum copying: Beyond the no-cloning theorem&lt;/em&gt;.&lt;br&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&#xA;Phys. Rev. A &lt;strong&gt;54&lt;/strong&gt; (1844), 1996.&#xA;[&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607018&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/9607018&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Bruss &lt;em&gt;et al&lt;/em&gt;. &#xA; &lt;em&gt;Optimal Universal and State-Dependent Quantum Cloning&lt;/em&gt;.&lt;br&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;Phys. Rev. A &lt;strong&gt;57&lt;/strong&gt; (2368), 1998.&#xA;[&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9705038&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/9705038&lt;/a&gt;].&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-10-24T14:28:22.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4530" PostTypeId="1" CreationDate="2018-10-24T18:37:59.933" Score="4" ViewCount="79" Body="&lt;p&gt;The paper &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum linear systems algorithms: a primer&lt;/a&gt; by Dervovic &lt;em&gt;et al&lt;/em&gt; has this table on page 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KPV8i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KPV8i.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why there's no &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; in the time complexity of the algorithm by Childs &lt;em&gt;et al.&lt;/em&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(s\kappa \ \text{polylog}(s\kappa/\epsilon))$&lt;/span&gt;. It's a bit hard to believe that the time complexity doesn't depend on the dimensions of the matrix involved. I also checked the &lt;a href=&quot;https://epubs.siam.org/doi/10.1137/16M1087072&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper&lt;/a&gt; by Childs &lt;em&gt;et al&lt;/em&gt; but I couldn't find the time complexity written in this form there. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2018-10-24T18:37:59.933" Title="Why is there no $N$ in the time complexity of the QLSP algorithm by Childs et al.?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4531" PostTypeId="1" AcceptedAnswerId="4538" CreationDate="2018-10-24T20:06:08.157" Score="10" ViewCount="486" Body="&lt;p&gt;In classical computing, we can run the key search (for example AES) by running parallel computing nodes as many as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear that we can run many Grover's algorithms, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is&lt;/strong&gt;; it possible to have a speed up using more than one Grover's algorithm as in classical computing?&lt;/p&gt;&#xA;" OwnerUserId="4866" LastEditorUserId="26" LastEditDate="2018-10-25T17:55:49.033" LastActivityDate="2018-10-26T07:31:32.263" Title="Can we speed up the Grover's Algorithm by running parallel processes?" Tags="&lt;classical-computing&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4532" PostTypeId="1" AcceptedAnswerId="4537" CreationDate="2018-10-24T20:41:22.577" Score="5" ViewCount="332" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;In &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quantum-concepts-10-oracles?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;this lecture&lt;/a&gt;, it is nicely explained how to define an operator that computes a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;.  I know how to implement such operators.  (We just define &lt;span class=&quot;math-container&quot;&gt;$O\qr{x}\qr{y} = \qr{x}\qr{y \oplus f(x)}$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it it said in the lecture that this effectively proves &lt;span class=&quot;math-container&quot;&gt;$O = O^\dagger$&lt;/span&gt; and I fail to see it so clearly.  It says &lt;span class=&quot;math-container&quot;&gt;$O = O^\dagger$&lt;/span&gt; &lt;strong&gt;by construction&lt;/strong&gt;.  How can I see that so clearly as it is implied?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="491" LastEditDate="2018-10-25T12:12:17.383" LastActivityDate="2018-10-25T13:32:09.333" Title="Why are oracles Hermitian by construction?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4533" PostTypeId="2" ParentId="4531" CreationDate="2018-10-24T20:50:31.850" Score="3" Body="&lt;p&gt;In a sense, if we were doing it in parallel on different nodes, you would save time for running. But if we talk about complexity (that is what we refer to speedup generally), we need a bit of analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You agree that we need about &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{N} $&lt;/span&gt; operations for the non-parallel case. &#xA;Say we have two nodes, and we separate the list of N elements into two lists of size &lt;span class=&quot;math-container&quot;&gt;$ N_1,N_2 $&lt;/span&gt;. The search on the sub-lists takes about &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{N_1},\sqrt{N_2} $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we have that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sqrt{N} = \sqrt{N_1+N_2} \le \sqrt{N_1} + \sqrt{N_2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you would still need to verify which output among what is returned by the parallel processes is the one you seek. It adds a constant in the complexity so we generally hide it into the &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, that would still be interesting especially if we have to cluster hardware because we are limited in numbers of qubits or another limitations.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-10-25T05:55:14.597" LastActivityDate="2018-10-25T05:55:14.597" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4534" PostTypeId="2" ParentId="4468" CreationDate="2018-10-24T20:54:05.267" Score="5" Body="&lt;p&gt;The earliest non-internal reference I can find is in NIPS 2009 &lt;a href=&quot;https://static.googleusercontent.com/media/www.google.com/en//googleblogs/pdfs/nips_demoreport_120709_research.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;from a Google/D-Wave effort&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;.  You'll notice that the two Choi papers, in addition to not using the term &quot;Chimera&quot;, do not describe a Chimera graph (and note that the name comes from D-Wave, not from graph theory).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a good early reference on Chimera, I recommend &lt;a href=&quot;https://ieeexplore.ieee.org/document/6802426?arnumber=6802426&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bunyk et al., 2014&lt;/a&gt;&lt;sup&gt;1 &lt;/sup&gt;, which describes graph theoretical and other practical considerations related to the architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Note: I work at D-Wave&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="4920" LastEditorUserId="23" LastEditDate="2018-11-01T08:52:58.277" LastActivityDate="2018-11-01T08:52:58.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4535" PostTypeId="2" ParentId="4532" CreationDate="2018-10-24T21:23:02.973" Score="5" Body="&lt;p&gt;Defining such oracles, you may visualize it as many controlled operations, especially &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;s which is an easy way to build oracles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know the effect of the &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; is if the control is a 1 then we add 1 into the target (you can see it as part of a function itself but it is meant for one bit representing the output register). &#xA;If we enumerate options on a simple 2-bit example with the first as control we have :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{CNOT}(00) = 00; \text{CNOT}(01) = 01; \text{CNOT}(10) = 1(0+1)=11;\text{CNOT}(11) = 1(1+1)=10$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know also that we cancel the effect of the CNOT by applying it again. Take the action of a CNOT but now on images from a first CNOT:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{CNOT}(00) = 00; \text{CNOT}(01) = 01; \text{CNOT}(11) = 1(1+1)=10;\text{CNOT}(10) = 1(0+1)=11$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you see that the effect on bits representing the output of your function represented by controlled operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$ \oplus $&lt;/span&gt; symbol illustrate that if I may say so.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-10-25T13:32:09.333" LastActivityDate="2018-10-25T13:32:09.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4536" PostTypeId="2" ParentId="4430" CreationDate="2018-10-25T02:34:27.217" Score="1" Body="&lt;p&gt;I wanted to expand on DaftWullie's accepted answer in case it is helpful to others. DaftWullie's is correct; mine is only a continuation of the same idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the one-qubit state &lt;span class=&quot;math-container&quot;&gt;$\psi = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;. We know that applying the Hadamard matrix &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix}$&lt;/span&gt; will give us &lt;span class=&quot;math-container&quot;&gt;$H\psi = (\frac{1}{2} + \frac{1}{2}) |0\rangle + (\frac{1}{2} - \frac{1}{2}) |1\rangle = |0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course the reason is constructive and destructive interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's consider a two qubit system with state &lt;span class=&quot;math-container&quot;&gt;$\psi = \frac{1}{\sqrt{2}} (|00\rangle + |11\rangle)$&lt;/span&gt;. Let us say that we want to apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to the second qubit, but do nothing to the first (apply the identity &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What matrix represents this transformation? The answer is &lt;span class=&quot;math-container&quot;&gt;$I \otimes H$&lt;/span&gt;. What is that? It is this matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;H &amp;amp; 0 \\&#xA;0 &amp;amp; H&#xA;\end{bmatrix} = \frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you see why this is? It is because the the overall operation should move &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|00\rangle &amp;amp;\mapsto \frac{1}{\sqrt{2}}(|00\rangle + |01\rangle) \\&#xA;|01\rangle &amp;amp;\mapsto \frac{1}{\sqrt{2}}(|00\rangle - |01\rangle)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and likewise for &lt;span class=&quot;math-container&quot;&gt;$|10\rangle, |11\rangle$&lt;/span&gt;. This is because the Hadamard application to the second qubit is not changing the first qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you may verify that &lt;span class=&quot;math-container&quot;&gt;$I \otimes H$&lt;/span&gt; applied to &lt;span class=&quot;math-container&quot;&gt;$(\alpha |0\rangle + \beta |1\rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle + 1\rangle)$&lt;/span&gt; gives you &lt;span class=&quot;math-container&quot;&gt;$\alpha |00\rangle + \beta|10\rangle$&lt;/span&gt;. When the qubits are not entangled, then you can do the intuitive thing and apply &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; independently to each qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the story is totally different when the two qubits are entangled! Consider the application to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} ( |00\rangle + |11\rangle)$&lt;/span&gt;. In this case, you get the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;\frac{1}{2} \\&#xA;\frac{1}{2} \\&#xA;\frac{1}{2} \\&#xA;-\frac{1}{2} \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you see what happened here? Applying &lt;span class=&quot;math-container&quot;&gt;$I \otimes H$&lt;/span&gt; no longer mean that the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle \mapsto \frac{1}{\sqrt{2}} (|00\rangle + |01\rangle)$&lt;/span&gt; part destructively interferes with the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle \mapsto \frac{1}{\sqrt{2}} (|10\rangle - |11\rangle)$&lt;/span&gt; part to cancel out the possibility that the second qubit takes on the value &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. That's because &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; are orthogonal basis states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now you can see my mistake. As DaftWullie explained. A qubit cannot be considered transmitted when it is still entangled. That's because an operation on one of the entangled qubits will not give the result that would have been expected if the qubit were not entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps! Thanks to all!&lt;/p&gt;&#xA;" OwnerUserId="4862" LastActivityDate="2018-10-25T02:34:27.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4537" PostTypeId="2" ParentId="4532" CreationDate="2018-10-25T06:04:23.110" Score="8" Body="&lt;p&gt;Showing that &lt;span class=&quot;math-container&quot;&gt;$O=O^\dagger$&lt;/span&gt; is equivalent to showing that &lt;span class=&quot;math-container&quot;&gt;$O^2=\mathbb{I}$&lt;/span&gt;. In other words,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O^2|x\rangle|y\rangle=|x\rangle|y\rangle&#xA;$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show this, we start from the definition of the oracle&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O|x\rangle|y\rangle=|x\rangle|y\oplus f(x)\rangle&#xA;$$&lt;/span&gt;&#xA;and apply &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; again:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O^2|x\rangle|y\rangle=O|x\rangle|y\oplus f(x)\rangle=|x\rangle|y\oplus f(x)\oplus f(x)\rangle=|x\rangle|y\rangle&#xA;$$&lt;/span&gt;&#xA;as required (since &lt;span class=&quot;math-container&quot;&gt;$a\oplus a=0$&lt;/span&gt;, and bitwise addition is associative).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-25T06:04:23.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4538" PostTypeId="2" ParentId="4531" CreationDate="2018-10-25T08:02:00.380" Score="6" Body="&lt;p&gt;Certainly! Imagine you have &lt;span class=&quot;math-container&quot;&gt;$K=2^k$&lt;/span&gt; copies of the search oracle &lt;span class=&quot;math-container&quot;&gt;$U_S$&lt;/span&gt; that you can use. Normally, you'd search by iterating the action&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H^{\otimes n}(\mathbb{I}_n-2|0\rangle\langle 0|^{\otimes n})H^{\otimes n}U_S,&#xA;$$&lt;/span&gt;&#xA;starting from an initial state &lt;span class=&quot;math-container&quot;&gt;$(H|0\rangle)^{\otimes n}$&lt;/span&gt;. This takes time &lt;span class=&quot;math-container&quot;&gt;$\Theta(\sqrt{N})$&lt;/span&gt;. (I'm using &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_n$&lt;/span&gt; to denote the &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; identity matrix.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could replace this with &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; parallel copies, each indexed by an &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^k$&lt;/span&gt;, using&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\mathbb{I}_k\otimes H^{\otimes (n-k)}\right)\mathbb{I}_k\otimes(\mathbb{I}_{n-k}-2|0\rangle\langle 0|^{\otimes (n-k)})\left(\mathbb{I}_k\otimes H^{\otimes (n-k)}\right)U_S&#xA;$$&lt;/span&gt;&#xA;and starting from a state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle(H|0\rangle)^{\otimes(n-k)}$&lt;/span&gt;&#xA;The time required for running these would be reduced to &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N/K})$&lt;/span&gt;, at the cost of requiring &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; times more space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a scaling sense, one might consider this an irrelevant result. If you have a fixed number of oracles, &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, then you get a fixed (&lt;span class=&quot;math-container&quot;&gt;$\sqrt{K}$&lt;/span&gt;) improvement (just like, if you have &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; parallel classical cores, the best improvement you can get is a factor of &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;), and that does not change the scaling. But it does change the fundamental running time. We know that Grover's algorithm is exactly optimal. It takes the absolute minimum time possible with a single oracle. So, knowing that you get a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{K}$&lt;/span&gt; improvement in time is useful with regards to that benchmark of a specific running time at a specific value of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-26T07:31:32.263" LastActivityDate="2018-10-26T07:31:32.263" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4540" PostTypeId="1" AcceptedAnswerId="4688" CreationDate="2018-10-25T14:48:49.033" Score="9" ViewCount="395" Body="&lt;p&gt;The line of questioning is inspired by the pick one trick in Section 4 of the &lt;a href=&quot;https://eprint.iacr.org/2014/296.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;PDF version&lt;/a&gt; of the paper &#xA;&lt;a href=&quot;https://arxiv.org/abs/1404.6898&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Attacks on Classical Proof Systems - The Hardness of Quantum Rewinding (Ambainis &lt;em&gt;et al.&lt;/em&gt;, 2014)&lt;/a&gt;. Slides available &lt;a href=&quot;http://2014.qcrypt.net/wp-content/uploads/Unruh-1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I don't fully follow the argument there so maybe I missed something important but here is my interpretation of their trick. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a classical hash function &lt;span class=&quot;math-container&quot;&gt;$x \rightarrow H(x)$&lt;/span&gt; that is collision resistant i.e. it is computationally hard to find &lt;span class=&quot;math-container&quot;&gt;$H(x) = H(x') \land  x\neq x'$&lt;/span&gt;. We wish to encode a commitment of a message using this hash function. That is, I take some message &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; and concatenate some randomness &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; at the end such that I generate a commitment &lt;span class=&quot;math-container&quot;&gt;$c = H(m\Vert u)$&lt;/span&gt;. When asked to prove my commitment, I cannot find a different pair &lt;span class=&quot;math-container&quot;&gt;$(m',u')$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$c = H(m'\Vert u')$&lt;/span&gt; because of the collision-free nature of hashes. My only choice is to open the commitment to &lt;span class=&quot;math-container&quot;&gt;$(m,u)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we attack this protocol with a quantum circuit of the hash function.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a superposition over all possible inputs &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; and query the hash function with this state to obtain the state &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle = \sum_{i}\vert x_i\rangle\vert H(x_i)\rangle$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure the second register to obtain a random commitment. The measurement randomly picks &lt;span class=&quot;math-container&quot;&gt;$c = H(x_i)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. The first register then has &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle = \sum_j \vert x_j\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\forall j, c = H(x_j)$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'd like to open the commitment to some &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt; that is given to me by the opponent. Use Grover's search on the first register to find a &lt;span class=&quot;math-container&quot;&gt;$x_{\text{sol}}$&lt;/span&gt; from the state &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle = \sum_j\vert x_j\rangle$&lt;/span&gt; that satisfies some special property. Specifically, the special property is that the first &lt;span class=&quot;math-container&quot;&gt;$|m'|$&lt;/span&gt; bits of &lt;span class=&quot;math-container&quot;&gt;$x_{\text{sol}}$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt;. That is, I will search to find &lt;span class=&quot;math-container&quot;&gt;$x_{\text{sol}} = m'\Vert u'$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Using the slides posted earlier (Slide 8) and their terminology, it is efficient to find a value &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from the intersection of two sets &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the set of all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$H(x) = c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the set of all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; where the first &lt;span class=&quot;math-container&quot;&gt;$|m'|$&lt;/span&gt; bits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; are exactly &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions regarding this attack are the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Did I get the basic idea of the attack correct? If wrong, ignore the rest of the post!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How many elements are there in the superposition &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle$&lt;/span&gt; after we commit to a certain &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;? In order that I can open the commitment to any message, it seems like I should have &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; (the size of the hash function's range) elements. But this is too large.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The speed of Grover search - this is related to the previous point - is the other thing. Wouldn't the computational complexity of searching over such a large superposition &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle$&lt;/span&gt; be the same as trying to guess a pre-image for a given output of the hash function since one has to search over all the &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;? In this case, where is the advantage? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm looking for the intuition more than mathematical proofs so any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2018-11-09T10:35:47.473" LastActivityDate="2018-11-12T14:51:15.450" Title="Quantum attack on hash functions" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4541" PostTypeId="1" AcceptedAnswerId="4542" CreationDate="2018-10-25T18:54:54.670" Score="5" ViewCount="315" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/0905.2794&quot; rel=&quot;noreferrer&quot;&gt;Devitt et al. 2013&lt;/a&gt;'s introduction to quantum error correction, the authors mention (bottom of page 12) how the stabilizer group for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits is abelian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, here is the quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit stabilizer state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle_N$&lt;/span&gt; is then defined by the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; generators of an Abelian (all elements commute) subgroup &lt;span class=&quot;math-container&quot;&gt;$\mathcal G$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit Pauli group,&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\mathcal G=\{K^i\,|\,K^i\lvert\psi\rangle=\lvert\psi\rangle,\,[K^i,K^j]=0,\forall (i,j)\}\subset \mathcal P_N.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am confused by this. Is the stabilizer subgroup &lt;span class=&quot;math-container&quot;&gt;$\mathcal G$&lt;/span&gt; &lt;em&gt;defined&lt;/em&gt; as an abelian subgroup of elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt; that stabilizes &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;, or is it instead the case that the subgroup of elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt; that stabilize &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; is abelian?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the latter, doesn't this introduce ambiguity in the definition? There could be other elements that stabilize &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; but not commute with &lt;span class=&quot;math-container&quot;&gt;$\mathcal G$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the former, how is this shown? I can see why the action of &lt;span class=&quot;math-container&quot;&gt;$K^i K^j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$K^j K^i$&lt;/span&gt; is identical on &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;, but how do you show that &lt;span class=&quot;math-container&quot;&gt;$K^i=K^j$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-10-25T20:25:57.950" Title="Why is the $N$-qubit stabilizer group abelian?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4542" PostTypeId="2" ParentId="4541" CreationDate="2018-10-25T19:16:11.533" Score="6" Body="&lt;p&gt;It is not necessary to &lt;em&gt;define&lt;/em&gt; the group as commuting &amp;mdash;&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}$&lt;/span&gt; by virtue of every element in the group stabilising the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;, this property follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because we are considering subgroups of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit Pauli group, any two elements either commute or anti-commute.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$P \in \mathcal P_N$&lt;/span&gt; be an operator which stabilises &lt;em&gt;some&lt;/em&gt; vector &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;, that is such that &lt;span class=&quot;math-container&quot;&gt;$P \ket{\psi} = \ket{\psi}$&lt;/span&gt;. Suppose that &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; anticommutes with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.&#xA;It then follows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Q \ket{\psi} = Q P \ket{\psi} = - P Q \ket{\psi}. $$&lt;/span&gt;&#xA;Now, if &lt;span class=&quot;math-container&quot;&gt;$Q \ket{\psi} = \lambda_Q \ket{\psi}$&lt;/span&gt; for any scalar &lt;span class=&quot;math-container&quot;&gt;$\lambda_Q$&lt;/span&gt; at all, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \lambda_Q \ket{\psi} = - P Q\ket{\psi} = - \lambda_Q \ket{\psi}. $$&lt;/span&gt;&#xA;But this implies that either &lt;span class=&quot;math-container&quot;&gt;$\lambda_Q = 0$&lt;/span&gt; (which is impossible as &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is unitary) or &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} = \mathbf 0$&lt;/span&gt;, the zero vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It follows that if &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; is actually a state (so that in particular it has norm 1), any operator in &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt; which has &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; as a &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; eigenvector must commute with all operators which stabilise &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;.&#xA;Thus the subgroup of &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt; which stabilises &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; is abelian.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-10-25T20:25:57.950" LastActivityDate="2018-10-25T20:25:57.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4543" PostTypeId="2" ParentId="4528" CreationDate="2018-10-26T11:11:22.610" Score="13" Body="&lt;p&gt;Numerous papers on quantum cloning have been written since 1996, including both theoretical and experimentally focused papers. The following survey paper is a good place to start if you want to learn more:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Valerio Scarani, Sofyan Iblisdir, Nicolas Gisin, and Antonio Acin. Quantum cloning. &lt;em&gt;Reviews of Modern Physics&lt;/em&gt; 77: 1225-1256, 2005. &lt;a href=&quot;http://arxiv.org/abs/quant-ph/0511088&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/0511088&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-10-26T11:11:22.610" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4544" PostTypeId="2" ParentId="4528" CreationDate="2018-10-26T11:21:45.843" Score="5" Body="&lt;p&gt;As John Watrous said, the Rev. Mod. Phys. article is an excellent starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know the sort of thing that's been looked at since, then in a shameless bit of self-promotion, you might look at &lt;a href=&quot;https://arxiv.org/abs/0901.3626&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. There have been a couple of follow-up papers as well (including one that closes a small step left open in one of the proofs). What is does is asymmetric cloning, in which the different copies of the state have different qualities. We can get optimal results even in these cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also look for the term &quot;broadcasting&quot;, which is kind of related to cloning but on mixed states rather than pure states.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-26T11:21:45.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4545" PostTypeId="1" CreationDate="2018-10-26T15:14:28.137" Score="1" ViewCount="180" Body="&lt;p&gt;I was wondering if anybody to help me to generate the following state.&#xA;It would be preferable if you use only Hadamard, CNOT and T-gates, on &lt;span class=&quot;math-container&quot;&gt;$\lceil\log_2(M+1)\rceil$&lt;/span&gt; qubits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{\sqrt{2}}\biggl(|0\rangle + \frac{1}{\sqrt{M}}\sum_{j=1}^M|j\rangle\biggr)$$&lt;/span&gt;&#xA;Assume M is a power of 2 value.&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="26" LastEditDate="2019-03-12T09:20:59.397" LastActivityDate="2019-03-12T09:20:59.397" Title="How can the state $\lvert0\rangle+M^{-1/2}\sum_{j=1}^M\lvert j\rangle$ be generated?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4546" PostTypeId="2" ParentId="4545" CreationDate="2018-10-26T16:08:51.490" Score="1" Body="&lt;p&gt;As you used the tag Qiskit I assume that you want a method to implement this state with Qiskit. Moreover, you did not mention any performance goal, so here is a general method that can be used for &lt;strong&gt;any&lt;/strong&gt; quantum state:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Import the Qiskit SDK&#xA;import qiskit&#xA;# Import the initializer&#xA;import qiskit.extensions.quantum_initializer._initializer as initializer&#xA;# Import numpy&#xA;import numpy&#xA;&#xA;&#xA;def generate_amplitudes(M: int) -&amp;gt; numpy.ndarray:&#xA;    qubit_number = int(numpy.ceil(numpy.log2(M + 1)))&#xA;    amplitudes = numpy.zeros((2**qubit_number, ), dtype=numpy.complex)&#xA;    amplitudes[0] = 1 / numpy.sqrt(2)&#xA;    amplitudes[1:M+1] = 1 / numpy.sqrt(2*M)&#xA;    return amplitudes&#xA;&#xA;M = 10&#xA;N = int(numpy.ceil(numpy.log2(M + 1)))&#xA;# Create a Quantum Register with 2 qubits.&#xA;q = qiskit.QuantumRegister(N)&#xA;# Create a Quantum Circuit&#xA;qc = qiskit.QuantumCircuit(q)&#xA;&#xA;# Initialise the state with the gate set of IBM (not H+T+CX)&#xA;qc.initialize(params=generate_amplitudes(M), qubits=q)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this method is &lt;strong&gt;not efficient&lt;/strong&gt; in the sense that the generated circuit may not be optimal at all. As your state is quite simple, there is probably a clever algorithm to construct it more efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are restricted to a gate set of &lt;code&gt;H&lt;/code&gt;, &lt;code&gt;T&lt;/code&gt; and &lt;code&gt;CX&lt;/code&gt; then you will need to use an external&lt;sup&gt;1&lt;/sup&gt; tool to translate the non-{&lt;code&gt;H&lt;/code&gt;,&lt;code&gt;T&lt;/code&gt;} gates into sequences of &lt;code&gt;H&lt;/code&gt; and &lt;code&gt;T&lt;/code&gt;. This can be done efficiently with the Solovay-Kitaev algorithm or (more?) efficiently with the algorithm described in &lt;a href=&quot;https://arxiv.org/abs/1212.6253&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1212.6253&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; I tried to play with Qiskit's compiler and unroller, but I could not make them work properly to perform the translation to the gate set &lt;code&gt;H&lt;/code&gt;, &lt;code&gt;T&lt;/code&gt; and &lt;code&gt;CX&lt;/code&gt;. Maybe someone else have an idea on how to do this translation with Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-10-26T16:08:51.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4547" PostTypeId="2" ParentId="4545" CreationDate="2018-10-26T16:09:02.063" Score="1" Body="&lt;p&gt;Get a qubit &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; into the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state, then do controlled uniform superposition preparation onto a register &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; conditioned on &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, then increment &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; conditioned on &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, then toggle &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i&amp;gt;0$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; now holds the state you wanted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The asymptotic T cost is &lt;span class=&quot;math-container&quot;&gt;$O(\lg M - \lg \epsilon)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is the absolute error tolerance. The circuit uses two more qubits than what you wanted in order to achieve that time cost (one for the control, one to hold the temporary comparison).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the controlled uniform superposition preparation circuit (the figure is from &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt; . I don't know the original paper that discovered this technique):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xBsvx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xBsvx.png&quot; alt=&quot;controlled uniform&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are standard constructions for exactly converting the comparisons, increments, multi-controlled-NOTs, and controlled-Hs into the H/CNOT/T gate set. You have to be careful to use single-dirty-ancilla constructions for the arithmetic ( &lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1706.07884&lt;/a&gt; ) because otherwise the qubit count will secretly double. And there are standard constructions for approximating the arbitrary-angle Z gates.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-10-26T16:17:47.327" LastActivityDate="2018-10-26T16:17:47.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4548" PostTypeId="1" AcceptedAnswerId="4549" CreationDate="2018-10-26T20:16:18.263" Score="6" ViewCount="125" Body="&lt;p&gt;I'm currently reading the paper &quot;&lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;nofollow noreferrer&quot;&gt;Surface codes: Towards practical large scale quantum computing&lt;/a&gt;&quot; and have a couple of very basic questions that if answered will help me contextualize and organize the information in this paper much better. I understand the requisite info for basic QC topics but have the sneaking feeling I'm missing/misunderstanding some implicit abstraction core to the topic of surface codes. And so, would like to double check my intuitions against someone's actual knowledge.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is a surface code an architecture onto which logical qubits, logical operations, and their connections are physically implemented? That is, is the common depiction of a surface code (the pattern of the measure qubits and data qubits) to be taken literally as a real-space image of the actual hardware or does it correspond to some abstraction in software that I'm not quite grasping?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are quantum computers currently designed to compile programs into a surface code implementation or are surface codes still a theoretical framework due to the massive amount of qubits that are needed?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="55" LastEditDate="2019-02-07T10:41:42.820" LastActivityDate="2019-02-07T10:41:42.820" Title="Is the common depiction of a surface code to be taken literally as a real-space image of the actual hardware?" Tags="&lt;error-correction&gt;&lt;surface-code&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4549" PostTypeId="2" ParentId="4548" CreationDate="2018-10-26T23:26:46.783" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;is the common depiction of a surface code (the pattern of the measure qubits and data qubits) to be taken literally as a real-space image of the actual hardware?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct. The surface code is physically implemented by a planar grid of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RfSPo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RfSPo.png&quot; alt=&quot;hardware vs diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.technologyreview.com/s/604242/googles-new-chip-is-a-stepping-stone-to-quantum-computing-supremacy/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Left image source&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;are surface codes still a theoretical framework due to the massive amount of qubits that are needed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct. To do error corrected quantum computation you need on the order of a thousand physical qubits per logical qubit. And your physical qubits must have fewer than 1 error per thousand operations (especially the 2-qubit operations). No one has a hundred physical qubits yet, and the best demonstrated error rates are ~5 in a thousand.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-10-26T23:38:27.207" LastActivityDate="2018-10-26T23:38:27.207" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4550" PostTypeId="2" ParentId="4527" CreationDate="2018-10-27T03:28:43.397" Score="10" Body="&lt;p&gt;You have two different questions here:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Can quantum computing be profitable without quantum hardware?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the comments people have said this is an opinion based question, but the truth is that there's already people (and companies!) making profits off of quantum computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In 2016 Doug Finke made a &lt;a href=&quot;https://quantumcomputingreport.com&quot; rel=&quot;noreferrer&quot;&gt;website&lt;/a&gt; with his own money, which kept track of the number of qubits in all quantum computers, and a list of all companies involved in quantum computing. In 2018 started making profit from advertising. Recently he has also added a job postings section where Google, IBM, Microsoft, and other big companies have job openings listed there. He now makes even more money from consulting. Although it might sound like it, I am in no way related to the person or website, he just attends some of the major quantum computing conferences and makes himself known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's more than just individual consultants making profits off of quantum computing. A famous quantum information theorist (Michele Mosca) and famous a physicist known for his work in quantum key distribution (Norbert Lutkenhaus) started a company called evolutionQ which makes a profit by selling &lt;a href=&quot;https://www.evolutionq.com/assets/evolutionq-brochure.pdf&quot; rel=&quot;noreferrer&quot;&gt;products (if you click the link a PDF will open)&lt;/a&gt; such as  courses on quantum-safe security, and quantum cryptography, and for other products like risk assessments and even software. Again, I have no relation to this company.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I've given an example of an individual person making profit from advertising on a website &lt;strong&gt;&lt;em&gt;about&lt;/em&gt;&lt;/strong&gt; quantum computers, and a company making a profit from consulting &lt;strong&gt;&lt;em&gt;about&lt;/em&gt;&lt;/strong&gt; quantum computing. If you are &lt;strong&gt;&lt;em&gt;very&lt;/em&gt;&lt;/strong&gt; picky you might say that these are not examples of quantum computing being profitale without hardware, because no quantum computing is actually directly involved. So I will give a third example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The company 1Qbit is a company that does not have any quantum hardware, but thrives by making algorithms and software for companies that are interested in running things on present or future quantum hardware. Again, I have no relation to this company.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;How long will the above three examples keep making profit?&lt;/em&gt;&lt;/strong&gt; &#xA;&lt;br&gt;&lt;strong&gt;That&lt;/strong&gt; is what is opinion based.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some people (not necessarily me) are of the opinion that quantum computers that can actually outperform classical computers for a useful task will never exist, so eventually people will get less and less interested in spending money on advertising on a QC-related website, or on buying software for present or future quantum computers, or on consulting fees or courses. Others disagree and think that quantum computing will become an industry just like classical computing (i.e. profits can be made by plenty of companies that don't have hardware, such as software companies, consulting companies, magazine publishers, etc.).  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) What are the fields/business ideas that a new business can work on within quantum computing that can be profitable if this business has no access to onboard quantum setups but can access the cloud-based quantum computing platforms?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a different question.&lt;br&gt;&#xA;First, if you have access to cloud-based quantum hardware, you can run calculations on the hardware, just like if you had it yourself in front of you, so your potential to make profit can't be too much smaller than if you actually had the hardware in front of you. Maybe you just want to know if people can make a profit apart from selling hardware? Selling the hardware is probably the only thing that you can't do to make profit if you &lt;em&gt;only&lt;/em&gt; have access to the cloud-based hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know how you can make profit from quantum computing is some way other than selling hardware, there some &quot;fields&quot; (as you call them) in which this can be done. Some examples are consulting, software development, algorithm development, and teaching private courses. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of actually using the cloud-based quantum hardware to make profit, your chances of making a profit are smaller. Nothing useful that a cloud-based quantum computer can do at present cannot already be done for less cost on a classical computer (though companies like IBM are known to offer their cloud-based QPU time for free, there is still not much you can do to make money from running calculations on their cloud based chips because they don't have enough qubits to do anything very useful). You would have to be extremely good at sales to make a profit right now, and whether or not you will be able to do it easier in the future is an opinion-based matter. Present-day hardware (whether available on the cloud or not) is mainly only useful for testing the physics of the chips, or for playing around. If a competing company needs someone to learn how IBM's chip works for example, maybe they could pay you to do some experiments, but they probably already have someone that can do it. Maybe you can organize games, tournaments, or other prized competitions for doing small calculations on present-day devices and get sponsors for that, but that is about it! &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-10-27T03:28:43.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4551" PostTypeId="2" ParentId="2622" CreationDate="2018-10-27T05:56:27.530" Score="7" Body="&lt;p&gt;The restriction on the eigenvalues is usually given in the form of a &lt;strong&gt;&lt;em&gt;condition number&lt;/em&gt;&lt;/strong&gt;. This is the &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; that you see in all the runtimes in your table. &lt;span class=&quot;math-container&quot;&gt;$\kappa = |\lambda_{\rm{max}}/\lambda_{\rm{min}}|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\rm{max}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\rm{min}}$&lt;/span&gt;  are the maximum and minimum &lt;strong&gt;&lt;em&gt;eigenvalues&lt;/em&gt;&lt;/strong&gt; respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In all runtimes listed in your table, it is assumed that the condition number is known. One does not usually think of &quot;calculating the condition number&quot; as part of the algorithm for solving &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;, for example. If the condition number is larger, the system is harder to solve, and if it is smaller the system is easier to solve (assuming all other parameters, including the maximum desired error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; are held fixed).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of needing to know that &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\rm{max}} &amp;lt; M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\rm{min}}&amp;gt;L$&lt;/span&gt;, there are lots of examples where we can know the bounds on the eigenvalues without actually going through the effort of calculating the eigenvalues. In this way, HHL can be a great way to find the state you're looking for, without the cost of calculating the condition number or any eigenvalues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give just one real-world example. Let's say I want to find the molecular vibrational state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; such that after &lt;span class=&quot;math-container&quot;&gt;$t=10$&lt;/span&gt;ps of evolving under its Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, the molecule ends up in state &lt;span class=&quot;math-container&quot;&gt;$|b\rangle $&lt;/span&gt;. This can be described by the equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iHt}|\psi\rangle  = |b\rangle&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; satisfying this equation is what you want to know. You can find your desired &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; by using the HHL algorithm with &lt;span class=&quot;math-container&quot;&gt;$A = e^{-\frac{i}{\hbar}Ht}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obtaining the smallest and largest eigenvalues of a molecular Hamiltonian to arbitrary precision is extremely costly on a classical compter, but knowing that they lie within the range &lt;span class=&quot;math-container&quot;&gt;$(L,M)$&lt;/span&gt; can be determined with no cost at all. For example if the molecule is the nitrogen dimer we know the lowest and highest vibrational states have energies (eigenvalues) between 0 and 10 eV and since &lt;span class=&quot;math-container&quot;&gt;$e^{0}=1$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$L=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M = e^{-\frac{i}{\hbar} 10 \rm{eV} \cdot 10 \rm{ps}}$&lt;/span&gt;. You can convert eV to Hz, and ps to seconds to evaluate &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; numerically, and then you can obtain the lower and upper bounds that you need to use when scaling your matrix the way you described in your previous question. At no point did I need to calculate the eigenvalues of a 14-electron molecular Hamiltonian (which would be extremely hard and would defeat the purpose of using HHL, because if I could calculate the eigenvalues I could just calculate &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and invert it to get &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;). I just used the dissociation energy of the molecule to come up with the bounds on its vibrational energies. I could have come up with even better bounds by using the semi-classical &lt;a href=&quot;https://en.wikipedia.org/wiki/WKB_approximation&quot; rel=&quot;noreferrer&quot;&gt;WKB approximation&lt;/a&gt;, also with much less cost than actually calculating the eigenvalues, but the first example is already enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So now let's address all your individual questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;First group of questions:&lt;/strong&gt; I read plenty of papers on HHL and none of&#xA;  them even mentioned this restriction. Why? Is this restriction known&#xA;  but considered weak (i.e. it's easy to have this kind of information)?&#xA;  Or the restriction was not known? Is there any research paper that&#xA;  mention this restriction?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Out of the 539 papers that have (at present) cited the original HHL paper, many of them will not know the finer details like the dependence of its performance on the condition number or eigenvalues. Some of the papers will certainly know that the performance of the algorithm will depend on the condition number or eigenvalues of the matrix, namely, the papers listed in your table on improvements to the HHL algorithm.  Robin Kothari also mentioned it, for example, at the very beginning of his talk in 2016 on the CKS algorithm (which is mentioned in your table).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Second group of questions:&lt;/strong&gt; Is there a better algorithm in term of&#xA;  complexity? If not, then why is the HHL algorithm still presented as&#xA;  an exponential improvement over classical algorithms?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The algorithm you mention, suggested by DaftWulie, to estimate the bounds on the eigenvalues, is not going to be improved over &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; because the dominant cost in that algorithm is in searching through all &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; rows for the maximum and minimum values. The cost of everything else is small because the matrix is assumed to have a sparsity of &lt;span class=&quot;math-container&quot;&gt;$s \lll N$&lt;/span&gt;. There is no way to do this search faster in faster than  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; time (unless you have some other extra knowledge of the system) because Grover's algorithm has been proven to be optimal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are right, people should mention the caveats of algorithms more often in their papers. In terms of your specific question &quot;why is the HHL algorithm still presented as an exponential improvement over classical algorithms,&quot; I think the original authors HHL did do their due diligence in explaining the algorithm and its caveats, in that they said that there's an exponential scaling but the cost grows quadratically with the condition number and sparsity and inversely with the size of the error you are willing to tolerate. Why do most other people after HHL not mention all the caveats? Well many of them don't know the caveats, and those that do might have felt it wasn't necessary because calculating the condition number is not part of the algorithm. Knowing the condition number will tell you how well the algorithm will work, but it is assumed you already know this like in the molecular vibrations example I gave above! &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-27T06:04:49.787" LastActivityDate="2018-10-27T06:04:49.787" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4552" PostTypeId="1" AcceptedAnswerId="4553" CreationDate="2018-10-27T15:25:20.867" Score="8" ViewCount="599" Body="&lt;p&gt;I am trying to construct a quantum multiplier using the method described here: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403048&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0403048&lt;/a&gt;. However, it seems that the control qubit would only disable the following gates for one iteration. Afterward, the &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; would still be in the fundamental, so would flip &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; again and enable the next iteration of gates. How do I prevent all future iterations (essentially break out of the loop) using a control qubit?&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="26" LastEditDate="2018-12-23T12:47:18.213" LastActivityDate="2018-12-23T12:47:18.213" Title="How to prevent future loops using a control qubit?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4553" PostTypeId="2" ParentId="4552" CreationDate="2018-10-27T17:41:36.920" Score="8" Body="&lt;p&gt;You're correct, there is a bug in the algorithm described by the paper. D should be unconditionally decremented in each iteration, and the control (which I would instead call the accumulator... except it looks like it is actually intended to control it?) should be toggled if D=0. The author has made the mistake of conditioning the decrement on the accumulator, which will prevent &lt;span class=&quot;math-container&quot;&gt;$D=0$&lt;/span&gt; from becoming &lt;span class=&quot;math-container&quot;&gt;$D=2^N-1$&lt;/span&gt; in the relevant iteration and result in the accumulator re-toggling in the next iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rhe2v.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rhe2v.png&quot; alt=&quot;figure from paper&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In any case, this is an extremely inefficient multiplier. It has cost &lt;span class=&quot;math-container&quot;&gt;$O(N 2^N)$&lt;/span&gt; instead of the &lt;span class=&quot;math-container&quot;&gt;$O(N^2)$&lt;/span&gt; you get from naive schoolbook multiplication. Just do this instead:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for index, qubit in enumerate(input1):&#xA;  if qubit:&#xA;    output += input2 &amp;lt;&amp;lt; index&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j3tsS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j3tsS.png&quot; alt=&quot;multiplication&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-10-27T18:01:52.407" LastActivityDate="2018-10-27T18:01:52.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4554" PostTypeId="1" AcceptedAnswerId="4555" CreationDate="2018-10-27T18:35:12.920" Score="7" ViewCount="2567" Body="&lt;p&gt;Can anyone explain how the CNOT matrix below is a valid presentation for the four-qubit states that follow after?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1KBd3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1KBd3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|0 0&amp;gt; -&amp;gt; |0 0&amp;gt; &#xA;|0 1&amp;gt; -&amp;gt; |0 1&amp;gt;&#xA;|1 0&amp;gt; -&amp;gt; |1 1&amp;gt;&#xA;|1 1&amp;gt; -&amp;gt; |1 0&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4120" LastEditorUserId="55" LastEditDate="2018-10-28T13:12:59.203" LastActivityDate="2018-10-28T13:12:59.203" Title="Why is the CNOT gate matrix a valid representation for two-qubit states?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4555" PostTypeId="2" ParentId="4554" CreationDate="2018-10-27T19:10:30.023" Score="9" Body="&lt;p&gt;The one concept that I think would really help you is knowing how to turn those 4 states, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle, |11\rangle$&lt;/span&gt;, into vectors, so that you can do the matrix multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me show you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|00\rangle = \begin{bmatrix} 1 \\ 0 \\ 0 \\  0  \end{bmatrix},|01\rangle = \begin{bmatrix} 0 \\ 1 \\ 0 \\  0  \end{bmatrix},   |10\rangle = \begin{bmatrix} 0 \\ 0 \\ 1 \\  0  \end{bmatrix}, |11\rangle = \begin{bmatrix} 0 \\ 0 \\ 0 \\  1  \end{bmatrix}&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you do the matrix multplication: &lt;span class=&quot;math-container&quot;&gt;$\rm{CNOT} \times |00\rangle$&lt;/span&gt;&lt;br&gt;&#xA;You will see that you will get exactly what you said, which is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and the same is true for the rest of them!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is using the convention that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|ab\rangle = |a\rangle \otimes |b\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product#Definition&quot; rel=&quot;noreferrer&quot;&gt;left Kronecker product&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-27T21:00:46.697" LastActivityDate="2018-10-27T21:00:46.697" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4556" PostTypeId="1" AcceptedAnswerId="4559" CreationDate="2018-10-27T20:21:45.527" Score="5" ViewCount="75" Body="&lt;p&gt;If we have a &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (unitary with all real entries) such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U|0\rangle =a|0\rangle +b|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle=?$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know: the definition of what it means to be unitary ie. &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U=UU^\dagger =I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've worked out: for &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle=c|0\rangle+d|1\rangle$&lt;/span&gt; must satisfy &lt;span class=&quot;math-container&quot;&gt;$ac+bd=0$&lt;/span&gt; (by taking it's dagger and multiplying it for the constants). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the only information we can derive? How can I write &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4946" LastEditorUserId="2293" LastEditDate="2021-04-16T21:27:18.350" LastActivityDate="2021-04-16T21:27:18.350" Title="Unitary acting on standard qubit basis properties" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4558" PostTypeId="2" ParentId="4556" CreationDate="2018-10-27T21:40:08.777" Score="2" Body="&lt;p&gt;The general form of a 2x2 unitary matrix is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\alpha &amp;amp; \beta \\&#xA;-e^{i\phi}\beta^* &amp;amp; e^{i\phi}\alpha^*&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the constraint that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2$&lt;/span&gt; = 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you say that &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = U\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} a \\ b \end{pmatrix}$&lt;/span&gt;, we have that &lt;span class=&quot;math-container&quot;&gt;$\alpha = a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-e^{i\phi}\beta^* = b$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the &lt;strong&gt;&lt;em&gt;most&lt;/em&gt;&lt;/strong&gt; we can say about the bottom-right corner is that &lt;span class=&quot;math-container&quot;&gt;$d=e^{i\phi}a^*$&lt;/span&gt;, and the most we can say about the  top-right corner is &lt;span class=&quot;math-container&quot;&gt;$c=\beta = -b^* e^{i\phi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have: &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle = e^{i\phi}b^*|0\rangle - e^{i\phi}a^*|1\rangle$&lt;/span&gt;.&#xA;We therefore do not have enough information to determine the phase &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, but since you only ask how to write &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; we don't need &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; because it enters our expression for &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; only as a &lt;em&gt;global phase&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In conclusion:&lt;/strong&gt; If all we know is &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = a|0\rangle = b|1\rangle$&lt;/span&gt;, then we can say that &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle = b^*|0\rangle -a^*|1\rangle$&lt;/span&gt;, which is correct up to a global phase.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2018-10-28T00:29:09.193" LastActivityDate="2018-10-28T00:29:09.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4559" PostTypeId="2" ParentId="4556" CreationDate="2018-10-27T23:37:58.250" Score="4" Body="&lt;p&gt;You have &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle=e^{i\phi}(b^*|0\rangle-a^*|1\rangle)$&lt;/span&gt; (and for real entries, &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}=\pm1$&lt;/span&gt;). This condition follows automatically from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0|U^\dagger U |1\rangle=0&#xA;$$&lt;/span&gt;&#xA;-- this is exactly the condition you describe -- together with the fact that &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; must have the same normalization,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle k|U^\dagger U |k\rangle=1&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$k=0,1$&lt;/span&gt;. (This also means that &lt;span class=&quot;math-container&quot;&gt;$|a|^2+|b|^2=1$&lt;/span&gt;.)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the only condition, since now you have ensured that all matrix elements of &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U$&lt;/span&gt; are of the correct form.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-10-27T23:37:58.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4560" PostTypeId="2" ParentId="4527" CreationDate="2018-10-28T01:44:02.980" Score="4" Body="&lt;p&gt;In complement to the other answer from @user1271772:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Can quantum computing be profitable without quantum hardware?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I can add another two elements. First companies that can sell/develop anti-quantum security protocols because as you may know, RSA is threatened by quantum computers  (at least in theory but it can be enough to transition to new protocols).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, we may have new algorithms created inspired by quantum computing. Indeed we may cite quantum evolutionary algorithms and more recently a &lt;a href=&quot;https://arxiv.org/pdf/1807.04271.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;new algorithm for recommendation systems&lt;/a&gt; was developed inspired by a previous work on a &lt;a href=&quot;https://arxiv.org/pdf/1603.08675.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum recommendation system algorithm&lt;/a&gt;. In a sense, you can say quantum computing can contribute even classically algorithmically speaking.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) What are the fields/business ideas that a new business can work on within quantum computing that can be profitable if this business has no access to onboard quantum setups but can access the cloud-based quantum computing platforms?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The list may be long to give. It is first a research playground and businesses have to study the potential of the field first (and each business is different or will consider it differently). If you want an example, you can look at this &lt;a href=&quot;https://arxiv.org/pdf/1807.03890.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;document which is a study the potential of quantum computing for finance&lt;/a&gt;. Having access with the cloud can be just enough but one should consider more how one would approach a problem with quantum computing (after all the modelization part is always crucial). &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-10-28T01:44:02.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4562" PostTypeId="2" ParentId="136" CreationDate="2018-10-28T18:25:30.013" Score="1" Body="&lt;p&gt;Quantum states can change in two ways: 1. &lt;strong&gt;quantumly&lt;/strong&gt;, 2. &lt;strong&gt;classically&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;All the state changes taking place &lt;strong&gt;quantumly&lt;/strong&gt;, are unitary. All the quantum gates, quantum errors, etc., are quantum &lt;em&gt;changes&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no obligation on &lt;strong&gt;classical&lt;/strong&gt; changes to be unitary, e.g. measurement is a classical &lt;em&gt;change&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All the more reason, why it is said that the quantum state is 'disturbed' once it's measured.&lt;/p&gt;&#xA;" OwnerUserId="4954" LastEditorUserId="26" LastEditDate="2019-05-15T14:06:22.627" LastActivityDate="2019-05-15T14:06:22.627" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4563" PostTypeId="1" AcceptedAnswerId="4587" CreationDate="2018-10-29T03:58:23.660" Score="6" ViewCount="174" Body="&lt;p&gt;The CHSH inequality was presented in the paper &lt;em&gt;Proposed Experiment to Test Local Hidden-Variable Theories&lt;/em&gt; published in 1969 by J.F. Clauser, M.A. Horne, A. Shimony, and R.A. Holt. I'm interested in which paper first presented their proposed experimental apparatus in nonlocal game format, presumably also introducing &amp;amp; defining the concept of nonlocal games in general.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-10-31T15:09:10.620" Title="In which paper was the CHSH game first presented?" Tags="&lt;resource-request&gt;&lt;games&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4564" PostTypeId="1" AcceptedAnswerId="4566" CreationDate="2018-10-29T14:17:55.073" Score="2" ViewCount="97" Body="&lt;p&gt;In my former &lt;a href=&quot;https://physics.stackexchange.com/questions/437538/about-2d-graph-state-and-branching-mera&quot;&gt;post&lt;/a&gt; on Physics SE I deduced a contradiction in the classical simulation of 2D graph state and the classical simulation of general measurement-based quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Norbert's answer, he mentioned that the serial measurements on the graph state cannot be classically simulated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be the right answer if we admit that a general quantum computation cannot be efficiently simulated classically. Especially if the quantum computation is not measurement based but rather a normal quantum circuit based implementation, since even the initial state can be simulated classically, the evolution of the state may change the state and the entanglement pattern so that it does not fulfill a certain criterion for the classical simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for measurement based QC, the measurement is carried out on each individual qubit and the measurement on one qubit will not change the state of another qubit. So the sequential measurements on each qubit can all be classically simulated. Then the contradiction is still there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure there must be something wrong with my deduction. Please help me to find it.&lt;/p&gt;&#xA;" OwnerUserId="4959" LastEditorUserId="26" LastEditDate="2018-10-29T15:14:18.677" LastActivityDate="2018-10-29T15:53:38.630" Title="The classical simulation of 2D graph state and the measurement based quantum computation" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4565" PostTypeId="1" CreationDate="2018-10-29T15:02:53.143" Score="9" ViewCount="207" Body="&lt;p&gt;Both quantum entanglement and &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0701004&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum state complexity&lt;/a&gt; are important in quantum information processing. They are usually highly correlated, i.e., roughly a state with a higher entanglement corresponds to a higher quantum state complexity or a complex state is usually highly entangled. But of course this correspondence is not exact. There are some highly entangled states that are not complex quantum states, for example quantum states represented by branching MERA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if we use the geometric measure of entanglement (defined as the minimal distance to the nearest separable state w.r.t. a certain distance metric in Hilbert space) to justify the entanglement, then it seems it's very similar with the definition of quantum state complexity (the minimal distance to a simple product state). If we only consider pure states and choose the same distance metric for them, for example, the Fubini-Study distance or Bures distance, then they are really almost identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, when we are talking about state complexity, it's better to use the more physically motivated 'quantum circuit complexity' to measure the distance. But still, this distance can also be used to define the geometric measure of entanglement(maybe it's not a perfect distance measure for entanglement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then what's the relationship between entanglement and quantum state complexity? Are they essentially two different distance measures on Hilbert space? What should be the optimal metrics for them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, if entanglement and complexity are both distance measures on the Hilbert space, can we find a transformation between these two metrics?&lt;/p&gt;&#xA;" OwnerUserId="4959" LastEditorUserId="26" LastEditDate="2019-11-24T14:31:35.220" LastActivityDate="2019-11-24T14:31:35.220" Title="Relation between quantum entanglement and quantum state complexity" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="11" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4566" PostTypeId="2" ParentId="4564" CreationDate="2018-10-29T15:53:38.630" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;the measurement is carried out on each individual qubit and the&#xA;  measurement on one qubit will not change the state of another qubit&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is an incorrect statement. If the state that you are measuring is entangled (which it very much &lt;em&gt;is&lt;/em&gt; for the 2D cluster state), measuring the state of one qubit absolutely changes the state of another qubit. The trivial example of this is teleportation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-29T15:53:38.630" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4567" PostTypeId="1" CreationDate="2018-10-29T16:20:34.637" Score="5" ViewCount="208" Body="&lt;p&gt;I noticed that there was already a &lt;a href=&quot;https://physics.stackexchange.com/questions/33377/what-is-the-mechanism-for-fast-scrambling-of-information-by-black-holes&quot;&gt;post&lt;/a&gt; discussing the fast scrambling property of black holes. But it seems no satisfactory answer was given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned by L. Susskind et. al, the fast scrambling property of BHs seems to say BHs are infinite dimensional systems so that every pair of qubits can directly interact 'locally' so that the fast scrambling can be implemented by BHs. He also mentioned that this is due to the effect of gravity during the collapse procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering, how such a gravitational collapse can lead to such an 'infinite dimensional' geometry? If the geometry is related with tensor networks, then what's the correspondent tensor network of BHs? It sounds very strange for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative is that maybe we do not need such an 'infinite dimensional' geometry, instead if the &lt;em&gt;internal&lt;/em&gt; geometry of BHs is a manifold with a vanishing geodesic distance as discussed &lt;a href=&quot;https://arxiv.org/abs/math/0409303v2&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, then the fast scrambling assumption may also be valid. But still, how such a geometry can be built inside a BH? Also, it seems that such a vanishing geodesic manifold should be an infinite dimensional manifold too.  &lt;/p&gt;&#xA;" OwnerUserId="4959" LastActivityDate="2018-11-06T00:12:04.157" Title="How can blackholes be fast information scramblers?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;quantum-information&gt;&lt;tensor-networks&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4568" PostTypeId="1" AcceptedAnswerId="4573" CreationDate="2018-10-29T16:21:40.073" Score="6" ViewCount="599" Body="&lt;p&gt;BB84 attack with entangled qubits example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi, I'am interested in an attack for BB84 protocol with entangled quibits.&#xA;Lets say Alice sends a qubit &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;_x$&lt;/span&gt; to Bob and Eve takes the CNOT gate to&#xA;entangle the states. Therefore, Eve uses a qubit &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;_e$&lt;/span&gt;. Using CNOT gate the result of this operation is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left|1\right&amp;gt;_x\left|0\right&amp;gt;_e\rightarrow \left|1\right&amp;gt;\left|1\right&amp;gt;.$$&lt;/span&gt;&#xA;Let's say now Bob measures base B in 90° and 0° orientation (the $|0\rangle/|1\rangle basis). Alice and Bob communicate their choice of basis over the&#xA;classical channel. Eve now knows the orientation and therefore measures her entangled qubit in the right orientation.&#xA;That means Eve knows now the bit value of the key, lets say 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what would be the case if Alice sends now a qubit in the state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_x-\left|1\right&amp;gt;_x)?$$&lt;/span&gt;&#xA;Eve would create the entangled state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(\left|00\right&amp;gt;-\left|11\right&amp;gt;)$$&lt;/span&gt;&#xA;There are two different cases depending on Bob's choice of basis:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;case 1: Alice sends the qubit to Bob and Bob measures in the wrong base B 90° and 0° orentation, therefore nothing happens, because Alice and Bob have different bases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;case 2: But what if Bob measures in diagonal base 45° and -45° (&lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle=(|0\rangle\pm|1\rangle)/\sqrt{2}$&lt;/span&gt;). Someone said that BB84 protocol covers this in 50% of cases. But why is it like that?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A measurement in 45° and -45° basis is equal to use the Hadamard transform and a measurement in base B (90°,0°).&#xA;So it results in something like this (Bob measures the first bit):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H(\left|x\right&amp;gt;)\left|e\right&amp;gt;=\frac{1}{\sqrt{2}}((H\left|0\right&amp;gt;)\left|0\right&amp;gt; - (H\left|1\right&amp;gt;)\left|1\right&amp;gt;)$$&lt;/span&gt;&#xA;this comes to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(\left|00\right&amp;gt;-\left|01\right&amp;gt;+\left|10\right&amp;gt;+\left|11\right&amp;gt;)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But why does this result does not agree with Alice's bit?&#xA;Why does the BB84 protocol expose 50% of cases (in my example)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I made understandable what I wanted to ask.&#xA;I know that it is complicated. I would be very happy to receive an answer. Thank you!&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2018-12-23T12:47:40.133" LastActivityDate="2021-04-29T16:22:56.170" Title="BB84 attack with entangled qubits example" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;cryptography&gt;" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="4569" PostTypeId="1" AcceptedAnswerId="4570" CreationDate="2018-10-30T00:46:36.270" Score="3" ViewCount="92" Body="&lt;p&gt;One of the benefits I'm reading about qubits is that they can be in an infinite number of states. I'm aware of Holevo's bound (even though I don't fully understand it). However, it made me think of why we haven't tried varying voltage on classical computers and have programmable gates to control what passes in terms of a voltage. In that way, we could simulate quantum computing more closely.&lt;/p&gt;&#xA;" OwnerUserId="4966" LastEditorUserId="26" LastEditDate="2018-11-02T14:25:52.023" LastActivityDate="2019-05-08T16:39:16.030" Title="Could we use varying voltage with programmable gates?" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;simulation&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4570" PostTypeId="2" ParentId="4569" CreationDate="2018-10-30T02:03:19.543" Score="3" Body="&lt;p&gt;This reminds me of another question we had here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2225/whats-the-difference-between-a-set-of-qubits-and-a-capacitor-with-a-subdivided&quot;&gt;What&amp;#39;s the difference between a set of qubits and a capacitor with a subdivided plate?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me try to answer your question separately though:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One of the benefits I'm reading about qubits is that they can be in an&#xA;  infinite number of states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, qubits don't have to be in state 0 or state 1, but can be in an infinite number of states represented by something called the Bloch sphere. However, while it  &lt;strong&gt;&lt;em&gt;sounds&lt;/em&gt;&lt;/strong&gt; impressive that you can be in an &lt;strong&gt;&lt;em&gt;infinite&lt;/em&gt;&lt;/strong&gt; number of states, this alone is not what gives quantum computers their full  power!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, an analog classical computer can be in an infinite number of states too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to really get the full power of a quantum computer, you need at least 2 qubits. The pair of qubits can exist in a state that no digital &lt;strong&gt;&lt;em&gt;or&lt;/em&gt;&lt;/strong&gt; analog classical computer can be in, which is a mixture of being in (0,0) and (1,1) at the same time. I explained this in my answer to that previous question:  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2226/2293&quot;&gt;What's the difference between a set of qubits and a capacitor with a subdivided plate?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I'm aware of Holevo's bound (even though I don't fully understand it).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you have a specific question on Holevo's theorem, or Ashwin Nayak's generalization of it, I'm sure you'll get an answer if you ask that as a separate question here :)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, it made me think of why we haven't tried varying voltage on classical computers and have programmable gates to control what passes in terms of a voltage. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I suppose you are suggesting this because voltage can be in any state between, for example, 0V and 20V (i.e. can be 0, or 1, or anything in between, like  maybe 0.5 would be 10V). Qubits can also be in an infinite number of states other than 0 or 1, but that is not what gives them their full power. The power comes from how two qubits can interact. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a pair of voltage-based bits, can the pair be in a state where the two bits are 0 and the two bits are also 1, at the same time? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have the two bits being in the states:&lt;br&gt;&#xA;(0V, 0V), or &lt;br&gt;&#xA;(0V, 20V), or &lt;br&gt;&#xA;(20V, 0V), or &lt;br&gt;&#xA;(20V, 20V), or, since you want to allow an infinite number of voltages, &lt;br&gt;&#xA;(15V, 12.3V), &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but you cannot have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left[(0\rm{V},0\rm{V}) + (20\rm{V},20\rm{V})\right]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means you're both in the (0V,0V) state and the (20V,20V) state at the same time (like Schrodinger's cat is alive and dead at the same time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In conclusion&lt;/strong&gt;: Even the ability to be in an infinite number of different states (like in analog classical computing), is not enough to do what a quantum computer can do!&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="26" LastEditDate="2019-05-08T16:39:16.030" LastActivityDate="2019-05-08T16:39:16.030" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4571" PostTypeId="1" CreationDate="2018-10-30T02:47:15.883" Score="8" ViewCount="665" Body="&lt;p&gt;As it is shown &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/devices&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, CNOT gates between different qubits have different error rates. I have the following questions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)  While defining a circuit on QISkit, does &lt;code&gt;q[0]&lt;/code&gt; always correspond to the same qubit on a device (e.g. the qubit labeled &lt;code&gt;q0&lt;/code&gt; on the device manual)? If so, how can I only use for example qubit &lt;code&gt;12&lt;/code&gt; and &lt;code&gt;13&lt;/code&gt; of &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; (just as an example)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) If one job is being executed on a device, say for instance using 3 qubits, is any other job running on that device at the same time? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) How many CNOT gates one circuit can have so that its error stays reasonable? Basically, how deep can a circuit be on any of the devices to get a reasonable result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="2757" LastEditorUserId="26" LastEditDate="2019-03-12T09:36:10.780" LastActivityDate="2019-03-19T08:12:23.413" Title="Qubits specification on IBMQ devices" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4573" PostTypeId="2" ParentId="4568" CreationDate="2018-10-30T08:04:16.980" Score="3" Body="&lt;p&gt;Firstly, it's not entirely clear that your described eavesdropping strategy is the best there could be. But it is useful for trying to work through what's going on. As you say, If Alice sends the state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; to Bob, then by Eve performing the controlled-not, they are left with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|-\rangle_x|0\rangle_e\rightarrow\frac{1}{\sqrt{2}}(|0\rangle_x|0\rangle_e-|1\rangle_x|1\rangle_e)&#xA;$$&lt;/span&gt;&#xA;We can rewrite this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|+\rangle_x|-\rangle_e+|-\rangle_x|+\rangle_e).&#xA;$$&lt;/span&gt;&#xA;Remember that these are the qubits that Bob and Eve hold at this point. Alice is expecting Bob to get measurement result &lt;span class=&quot;math-container&quot;&gt;$-\rangle$&lt;/span&gt;. But you can see from the way that I've written the state that Bob gets answer &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; 50% of the time, and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; 50% of the time. So, half the time, his answer does not match Alice's expectation. However, Eve always knows exactly what answer Bob got by using the same measurement basis (once it's been announced) because her answers are always the opposite of what Bob gets.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-10-30T08:15:26.807" LastActivityDate="2018-10-30T08:15:26.807" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="4574" PostTypeId="2" ParentId="4571" CreationDate="2018-10-30T08:13:45.923" Score="7" Body="&lt;pre&gt;&lt;code&gt;1) While defining a circuit on QISkit, does q[0] always correspond to the same qubit on a device &#xA;(e.g. the qubit labeled q0 on the device manual)? If so, how can I only use for example qubit 12 and &#xA;13 of ibmq_16_melbourne (just as an example)?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Quick answer: not always. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way Qiskit works with quantum circuit and backends is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Generate the quantum circuit with the API. The quantum circuit is stored in a &lt;code&gt;QuantumCircuit&lt;/code&gt; object.&lt;/li&gt;&#xA;&lt;li&gt;Transform this &lt;code&gt;QuantumCircuit&lt;/code&gt; object into a &lt;code&gt;DAGCircuit&lt;/code&gt; object which represents the same quantum circuit but uses a &lt;a href=&quot;https://en.wikipedia.org/wiki/Directed_acyclic_graph&quot; rel=&quot;nofollow noreferrer&quot;&gt;DAG&lt;/a&gt; instead of a list of gates.&lt;/li&gt;&#xA;&lt;li&gt;Give this &lt;code&gt;DAGCircuit&lt;/code&gt; object to the compiler. The compiler takes care of multiple things:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Respecting the topology of the backend you are compiling for. This is the step that will bother you as the compiler will probably &quot;shuffle&quot; (not in a random way of course) your qubits. One exception I see is when the circuit already respects the backend topology. In this case the compiler may not change the qubits.&lt;/li&gt;&#xA;&lt;li&gt;Respecting the basis gates used by the backend.&lt;/li&gt;&#xA;&lt;li&gt;Optimising your circuit. This step might also be problematic. I don't know if such an optimisation is present in the Qiskit compiler, but if the compiler tries to optimise also with respect to the errors rates then you might end up with &quot;shuffled&quot; qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You will need to check what I am saying experimentally.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2) If one job is being executed on a device, say for instance using 3 qubits, is any other job being &#xA;ran on that device at the same time?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems unlikely to me but lets wait for the answer of one of the developers of Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;3) How many CNOT gates one circuit can have so that its error stays reasonable? Basically, how &#xA;deep can a circuit be on any of the devices to get a reasonable result?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Very few.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you limit yourself to &lt;code&gt;Q12&lt;/code&gt; and &lt;code&gt;Q13&lt;/code&gt; then the &lt;code&gt;CX&lt;/code&gt; gate between the two has a probability of failure of 0.041. This means that applying &lt;strong&gt;only&lt;/strong&gt; &lt;code&gt;CX&lt;/code&gt; gates, you have a probability of success of &lt;span class=&quot;math-container&quot;&gt;$(1 - 0.041)^n$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; being the number of &lt;code&gt;CX&lt;/code&gt; gates applied. For &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; &lt;code&gt;CX&lt;/code&gt; gates, the probability is &lt;span class=&quot;math-container&quot;&gt;$\approx 0.66$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; gates, the probability of success drops to &lt;span class=&quot;math-container&quot;&gt;$\approx 0.43$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-03-19T08:12:23.413" LastActivityDate="2019-03-19T08:12:23.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4575" PostTypeId="6" CreationDate="2018-10-30T16:02:15.287" Score="0" Body="&lt;p&gt;I am MEE and I want to be one of your mods.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Pro&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;I am ...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a beta user from the beginning (user id: 11, member &gt; 200 days).&lt;/li&gt;&#xA;&lt;li&gt;extremely active in community moderation (&lt;a href=&quot;/users/11/mee?tab=votes&amp;amp;sort=closure&quot;&gt;close&lt;/a&gt;/&lt;a href=&quot;/users/11?tab=votes&amp;amp;sort=reopen&quot;&gt;reopen&lt;/a&gt;, &lt;a href=&quot;/users/11?tab=activity&amp;amp;sort=reviews&quot;&gt;votes&lt;/a&gt;, one of the most active users in all queues I can access (#1 or #2).&lt;/li&gt;&#xA;&lt;li&gt;active in meta with &gt;20 posts (total score: 86).&lt;/li&gt;&#xA;&lt;li&gt;Main impact: 3k, Meta: 2k&lt;/li&gt;&#xA;&lt;li&gt;I really want to be your moderator. I read every QC meta post and all important ones on MSE. ==&gt; &lt;strong&gt;I know the SE system and rules.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;I know how to &quot;lead by example&quot; due to me being a examined Judo referee.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;Cons&lt;/h1&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I didn't ask/answer any question in the last time, as I am still in secondary school and don't know that much about QC yet. &lt;a href=&quot;//quantumcomputing.meta.stackexchange.com/q/345&quot;&gt;Not a problem&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;My native language isn't English.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Important for me is that everyone feels welcome, is treated fairly and to assume good-faith.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't like how some complains are expressed in meta. BUT I have a &lt;a href=&quot;//bit.ly/2qs7bEQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;solution&quot;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;a href=&quot;//quantumcomputing.meta.stackexchange.com/a/344&quot;&gt;&lt;strong&gt;My election answer&lt;/strong&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;" OwnerUserId="11" LastEditorUserId="11" LastEditDate="2018-11-05T19:13:53.717" LastActivityDate="2018-11-05T19:13:53.717" CommentCount="0" CommunityOwnedDate="2018-10-30T16:02:15.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="4576" PostTypeId="1" CreationDate="2018-10-30T16:49:55.147" Score="16" ViewCount="3602" Body="&lt;p&gt;I am trying to simulate Deutsch's algorithm (elementary case of Deutsch-Jozsa algorithm), and I am not entirely sure how I would go about implementing the quantum oracle necessary for the algorithm to function, without defeating the purpose of the algorithm and &amp;quot;looking&amp;quot; at what the inputted function is, by evaluating the function.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="2927" LastEditDate="2021-04-27T23:03:34.300" LastActivityDate="2021-04-27T23:03:34.300" Title="How would I implement the quantum oracle in Deutsch's algorithm?" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="5" CommentCount="7" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4577" PostTypeId="2" ParentId="4576" CreationDate="2018-10-30T17:50:16.530" Score="2" Body="&lt;p&gt;You have two examples on the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=004-Quantum_Algorithms~2F080-Deutsch-Jozsa_Algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience page about the algorithm&lt;/a&gt;.&#xA;They show an example of a function. This could inspire you for your simulations I hope.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-10-30T17:50:16.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4578" PostTypeId="2" ParentId="4576" CreationDate="2018-10-30T18:01:45.747" Score="3" Body="&lt;p&gt;I don't have an example for Deutsch's algorithm handy, but &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/tree/master/DeutschJozsaAlgorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://github.com/Microsoft/GHC18-IntroToQuantumComputing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; are two tutorials which walk you through implementing the Deutsch-Jozsa algorithm and the oracles it uses in Q#. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea for these two algorithms is the same: you have to provide the oracle to the algorithm as an operation implemented elsewhere. This way the algorithm doesn't know which oracle it is given and doesn't have a way to &quot;look&quot; at the oracle other than by calling it. These tutorials also have a harness which counts how many times the oracle is called, so that if your solution calls it more than once, it fails the test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Admittedly, this still has a problem which oracle algorithms frequently have: a &lt;em&gt;human&lt;/em&gt; can look at the implementation of the test and of the oracle passed and figure out the answer by figuring out which oracle is implemented. This can be countered by randomizing the oracle choice, as DaftWullie suggested.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-10-30T18:01:45.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4579" PostTypeId="2" ParentId="4576" CreationDate="2018-10-30T18:27:10.497" Score="10" Body="&lt;p&gt;There are two questions here. The first asks how you might actually implement this in code, and the second asks what's the point if you know which oracle you're passing in.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Implementation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Probably the best way is to create a function &lt;code&gt;IsBlackBoxConstant&lt;/code&gt; which takes the oracle as input, then runs the Deutsch Oracle program to determine whether it is constant. You can select the oracle at random, if you want. Here it is, implemented in Q#:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation IsBlackBoxConstant(blackBox: ((Qubit, Qubit) =&amp;gt; ())) : (Bool)&#xA;{&#xA;    body&#xA;    {&#xA;        mutable inputResult = Zero;&#xA;        mutable outputResult = Zero;&#xA;&#xA;        // Allocate two qbits&#xA;        using (qbits = Qubit[2])&#xA;        {&#xA;            // Label qbits as inputs and outputs&#xA;            let input = qbits[0];&#xA;            let output = qbits[1];&#xA;&#xA;            // Pre-processing&#xA;            X(input);&#xA;            X(output);&#xA;            H(input);&#xA;            H(output);&#xA;&#xA;            // Send qbits into black box&#xA;            blackBox(input, output);&#xA;&#xA;            // Post-processing&#xA;            H(input);&#xA;            H(output);&#xA;&#xA;            // Measure both qbits&#xA;            set inputResult = M(input);&#xA;            set outputResult = M(output);&#xA;&#xA;            // Clear qbits before release&#xA;            ResetAll(qbits);&#xA;        }&#xA;&#xA;        // If input qbit is 1, then black box is constant; if 0, is variable&#xA;        return One == inputResult;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;What's the point?&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;Query complexity&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Computational complexity is a field concerned with classifying algorithms according to the quantity of resources they consume as a function of input size. These resources include time (measured in steps/instructions), memory, and also something called &lt;em&gt;query complexity&lt;/em&gt;. Query complexity is concerned with the number of times an algorithm has to query a black-box oracle function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Deutsch oracle problem is interesting to complexity theorists because the quantum algorithm only has to query the black box once, but the classical algorithm has to query it twice. With the generalized Deutsch-Josza problem where an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit oracle contains a function which is either constant or balanced, the quantum algorithm again only has to query it once but the (deterministic) classical algorithm requires &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that a probabilistic classical algorithm exists which solves the Deutsch-Josza problem in much fewer than &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; queries by randomly sampling oracle inputs: if the oracle continues to output the same value no matter the input, the probability that the oracle is constant grows very quickly. This means Deutsch-Josza is not a good candidate for a quantum supremacy/advantage problem, which leads into...&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Applications in the real world&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you aren't a complexity theorist, you might reasonably not care very much about query complexity and instead want to know why the Deutsch oracle problem is important in a &quot;no rules&quot; world where you're allowed to look inside the black box. Trying to analyze an oracle problem as a non-oracle problem is fraught with difficulty, and I don't believe anybody has solved the question of the best classical algorithm for the Deutsch oracle problem when you are allowed to analyze the oracle circuit. You might think - what is there to analyze? There are only four possible circuits! In fact, it is much more complicated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at the &lt;em&gt;simplest&lt;/em&gt; representation of the one-bit Deutsch Oracle, the gate construction is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Identity: &lt;span class=&quot;math-container&quot;&gt;$C_{1,0}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Negation: &lt;span class=&quot;math-container&quot;&gt;$X_0C_{1,0}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Constant-0: &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_4$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Constant-1: &lt;span class=&quot;math-container&quot;&gt;$X_0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, these are by no means the only way to implement the oracles. All of these can be rewritten using hundreds, thousands, even millions of logic gates! All that matters is the cumulative effect of these logic gates is equivalent to the above simple construction. Consider the following alternative implementation of Constant-1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_0Z_0H_0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It turns out that, for any input you could ever give:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_0Z_0H_0|\psi\rangle = X_0|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because of the associativity of matrix multiplication. If you write out the actual matrices for &lt;span class=&quot;math-container&quot;&gt;$H_0Z_0H_0$&lt;/span&gt; and multiply them together, you get &lt;span class=&quot;math-container&quot;&gt;$X_0$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_0Z_0H_0 =&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}}&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}}&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{bmatrix} = X_0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(H_0(Z_0(H_0|\psi\rangle))) = (((H_0Z_0)H_0)|\psi\rangle) = X_0|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can pass in the circuit &lt;span class=&quot;math-container&quot;&gt;$H_0Z_0H_0$&lt;/span&gt; (or something vastly more complicated) into your quantum Deutsch Oracle algorithm instead of &lt;span class=&quot;math-container&quot;&gt;$X_0$&lt;/span&gt;, and the algorithm still works! It will tell you whether the oracle is constant or variable, regardless of how complicated its internals are. So an algorithm which &quot;cheats&quot; and looks inside the black box doesn't have quite as simple a time as you might think. Consider the case of I, a stranger on the internet, giving you a very complicated circuit guaranteed to be constant or variable then asking you which it is. Not something so easily solved by just looking at it!&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Important for historical &amp;amp; pedagogical reasons&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Primarily, the Deutsch Oracle problem is important for historical and pedagogical reasons. It's the first algorithm taught to students because it's the simplest, and seems to demonstrate quantum speedup as long as you don't ask too many questions. It also serves as a good launching point for learning Simon's Periodicity Problem and then Shor's Algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-11-02T22:58:35.743" LastActivityDate="2018-11-02T22:58:35.743" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4580" PostTypeId="1" AcceptedAnswerId="4582" CreationDate="2018-10-30T18:44:16.173" Score="12" ViewCount="3653" Body="&lt;p&gt;What tools exist for creating quantum circuit diagrams and exporting them as images? Preferably one which runs in Windows, or even better one which runs in the web browser.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-10-30T20:03:30.750" LastActivityDate="2021-04-24T19:10:25.430" Title="Tools for creating quantum circuit diagrams" Tags="&lt;resource-request&gt;" AnswerCount="6" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4581" PostTypeId="2" ParentId="4580" CreationDate="2018-10-30T19:35:12.387" Score="7" Body="&lt;p&gt;I'm new to the quantum world as well, but so far I've been able to draw my basic simple circuits with &lt;a href=&quot;http://www.media.mit.edu/quanta/qasm2circ/&quot; rel=&quot;noreferrer&quot;&gt;Qasm2Circ&lt;/a&gt;. It requires:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;latex2e with xypic (included in tetex)&lt;/li&gt;&#xA;&lt;li&gt;python version 2.3 or greater&lt;/li&gt;&#xA;&lt;li&gt;ghostscript (and epstopdf) (for creation of pdfs)&lt;/li&gt;&#xA;&lt;li&gt;netpbm (for creation of png files)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hopefully, somebody will be able to list other tools.&lt;/p&gt;&#xA;" OwnerUserId="4504" LastActivityDate="2018-10-30T19:35:12.387" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4582" PostTypeId="2" ParentId="4580" CreationDate="2018-10-30T23:26:07.657" Score="14" Body="&lt;p&gt;Depending on how involved your circuit is you could use &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1809.03842&quot; rel=&quot;noreferrer&quot;&gt;Quantikz&lt;/a&gt; (written by @DaftWullie I believe) &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://physics.unm.edu/CQuIC/Qcircuit/Qtutorial.pdf&quot; rel=&quot;noreferrer&quot;&gt;Q-circuit&lt;/a&gt; by Bryan Eastin and Steve Flammia. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are tools to make circuit diagrams in TeX for papers and the like, but you can always make your TeX file just the circuit you want and save it as a pdf. Making complex and incredibly long circuits might be a bit of a hassle and would be better done in an automated tool like the one posted by Davide_sd.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2018-10-31T17:20:41.267" LastActivityDate="2018-10-31T17:20:41.267" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4583" PostTypeId="2" ParentId="4580" CreationDate="2018-10-31T08:25:24.357" Score="7" Body="&lt;ol&gt;&#xA;&lt;li&gt;Master of Science degree project developed by Joanna Patrzyk and Bartłomiej Patrzyk at AGH UST in Cracow.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.quide.eu/&quot; rel=&quot;noreferrer&quot;&gt;http://www.quide.eu/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can simulate designed circuits by generating simulator code in C#. Runs under Windows. Available under GPLv3.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;IBM Quantum Experience. Its interface runs in web browser.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/editor&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/qx/editor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can run on &quot;real&quot; quantum computer. Available for research purposes only. &lt;br /&gt; Here is the agreement: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/terms&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/qx/terms&lt;/a&gt;&#xA;&lt;br /&gt; And user guide: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=introduction&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=introduction&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4973" LastEditorUserId="4973" LastEditDate="2018-10-31T08:31:00.637" LastActivityDate="2018-10-31T08:31:00.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4584" PostTypeId="1" CreationDate="2018-10-31T09:30:14.507" Score="7" ViewCount="718" Body="&lt;p&gt;I am relatively new and interested in quantum computing.&#xA;Specifically, I am interested in transforming an equation that I found on Wikipedia. But I did not quite understand the transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_x\left|0\right&amp;gt;_y-\left|1\right&amp;gt;_x\left|1\right&amp;gt;_y) = \frac{1}{\sqrt{2}}(|+\rangle_x|-\rangle_y+|-\rangle_x|+\rangle_y) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea is so far to use Hadamard transform for the two qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{\sqrt{2}}(H(\left|0\right&amp;gt;_x\left|0\right&amp;gt;_y)-H(\left|1\right&amp;gt;_x\left|1\right&amp;gt;_y)) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the Hadamard transformation and now come to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ = \frac{1}{\sqrt{2}}(\frac{1}{2}[(\left|00\right&amp;gt;+\left|10\right&amp;gt;+\left|01\right&amp;gt;+\left|11\right&amp;gt;) -(\left|00\right&amp;gt;-\left|10\right&amp;gt;-\left|01\right&amp;gt;+\left|11\right&amp;gt;)]) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I simplify that a bit now then I have that as a result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ = \frac{1}{\sqrt{2}}(\left|1_x0_y\right&amp;gt;+\left|0_x1_y\right&amp;gt;) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the result looks different now than the equation I wrote down at the beginning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ = \frac{1}{\sqrt{2}}(\left|1_x0_y\right&amp;gt;+\left|0_x1_y\right&amp;gt;) = \frac{1}{\sqrt{2}}(|+\rangle_x|-\rangle_y+|-\rangle_x|+\rangle_y) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know if the forming is allowed that way. If somebody knows how the transformation of the equation works, so that I get what I wrote in the beginning, I would be very happy if somebody could explain it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that my question is understandable :)&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="26" LastEditDate="2018-12-23T11:17:18.237" LastActivityDate="2018-12-23T11:17:18.237" Title="Transformation of a Bell state" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4585" PostTypeId="2" ParentId="4584" CreationDate="2018-10-31T09:37:26.107" Score="6" Body="&lt;p&gt;You've started wanting to talk about&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|00\rangle-|11\rangle)/\sqrt{2},&#xA;$$&lt;/span&gt;&#xA;but you've then gone ahead and calculated&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(H\otimes H)\cdot(|00\rangle-|11\rangle)/\sqrt{2}.&#xA;$$&lt;/span&gt;&#xA;You should not expect these to be equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the calculation that you've done is sensible if you understand what you're doing. What you actually want to see, in order to verify your original statement is that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(H\otimes H)\cdot(|00\rangle-|11\rangle)/\sqrt{2}=(H\otimes H)\cdot(|+-\rangle+|-+\rangle)/\sqrt{2}.&#xA;$$&lt;/span&gt;&#xA;You've already calculated the left-hand side. The calculation on the right-hand side is, I suspect, the whole reason why you've chosen to apply the Hadamard transform - you know that the Hadamard converts &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. So, you can immediately read that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(H\otimes H)\cdot(|+-\rangle+|-+\rangle)/\sqrt{2}=(|01\rangle+|10\rangle)/\sqrt{2},&#xA;$$&lt;/span&gt;&#xA;so you can see that the left-hand side is equal to the right-hand side, as desired.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-10-31T09:37:26.107" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4586" PostTypeId="2" ParentId="4584" CreationDate="2018-10-31T09:49:13.840" Score="9" Body="&lt;p&gt;You are not proving the equality in a correct way. By multiplying by the Hadamard matrix, you are changing the state you are trying to calculate, not demonstrating the equality you want to prove.&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to prove what you state at the beginning of the question, I would use the facts that &lt;span class=&quot;math-container&quot;&gt;$$&#xA; \ket+ =\frac{1}{\sqrt{2}}\bigl(\ket0 + \ket1\bigr), \qquad\ket-=\frac{1}{\sqrt{2}}\bigl(\ket0 - \ket1\bigr),$$&lt;/span&gt;&#xA;and then develop the equality in the inverse order. Consequently:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{alignat}{2}&#xA;  \frac{1}{\sqrt{2}}&amp;amp;\bigl(\ket+_x \ket-_y - \ket-_x \ket+_y\bigr)\mspace{-128mu}&#xA;\\[1ex]=\;&amp;amp;&#xA;  \frac{1}{\sqrt{2}}\Bigl(\frac{1}{2}\bigl(&amp;amp;&amp;amp;\ket0_x+\ket1_x\bigr)\bigl(\ket0_y-\ket1_y\bigr)+\bigl(\ket0_x-\ket1_x\bigr)\bigl(\ket0_y+\ket1_y\bigr)\Bigr)&#xA;\\[1ex]=\;&amp;amp;&#xA;\frac{1}{\sqrt{2}}\Bigl(\frac{1}{2}\bigl(&amp;amp;&amp;amp;\ket0_x\ket0_y+\ket1_x\ket-_y-\ket0_x\ket1_y-\ket1_x\ket1_y&#xA;\\[-1ex]&amp;amp;&amp;amp;&amp;amp;+\ket0_x\ket0_y+\ket0_x\ket1_y-\ket1_x\ket0_y-\ket1_x\ket1_y\bigr)\Bigr)&#xA;\\=\;&amp;amp;&#xA;\frac{1}{\sqrt{2}}\bigl(\ket0_x\ket0_y - \ket1_x\ket1_y\bigr).\mspace{-128mu}&#xA;\end{alignat}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so you prove the equality you were trying to solve at the beginning of the question.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="124" LastEditDate="2018-10-31T10:02:15.490" LastActivityDate="2018-10-31T10:02:15.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4587" PostTypeId="2" ParentId="4563" CreationDate="2018-10-31T15:09:10.620" Score="6" Body="&lt;p&gt;As far as I have been researching from the intrenet about the CHSH game, the first experimental realization seems to be the one published by Aspect in &lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.49.91&quot; rel=&quot;noreferrer&quot;&gt;Experimental Realization of Einstein-Podolsky-Rosen-Bohm Gedankenexperiment:&#xA;A New Violation of Bell's Inequalities&lt;/a&gt;. The experiment is based on photon polarization and is the proof of the universe's nonlocality at subatomical particle level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About the general description of the non-local games I have tracked the paper &lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=1313847&quot; rel=&quot;noreferrer&quot;&gt;Consequences and Limits of Nonlocal Strategies&lt;/a&gt; by Cleve &lt;em&gt;et al.&lt;/em&gt; as the first formal description of those, and the CHSH game. I am not completely sure that this might be the first paper defining such concepts, but I think that is really one of them and it is a really good article concerning such topics. &lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-10-31T15:09:10.620" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4588" PostTypeId="2" ParentId="4580" CreationDate="2018-10-31T17:08:24.533" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;[...] quantum circuit diagrams [...] even better one which runs in the web browser.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk (algassert.com/quirk)&lt;/a&gt; runs in browsers and can be used to create simple circuit diagrams. I use it for this purpose all of the time, though it's main purpose is to simulate circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just drag the gates you want into the circuit, perhaps use the simulation results to check that everything is behaving correctly, and then take a screenshot with e.g. Windows' Snipping Tool. Most browsers also have an option to turn a canvas into an image (e.g. in firefox if you right-click on the circuit you can select 'view image' that you can then download and crop). You can bookmark the circuit to come back to it later, in case you make a small mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main downside of this approach is a) it requires manual work every time, b) it produces bitmap images instead of vector images, and c) it is somewhat inflexible (e.g. you can't put operations with different controls into the same column).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B%22Amps3%22%2C1%2C1%2C%22Amps1%22%5D%2C%5B%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BD%22%2C1%2C%22H%22%2C%22H%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Measure%22%2C%22Measure%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22Z%22%5D%2C%5B%22%E2%97%A6%22%2C1%2C%22%E2%80%A2%22%2C1%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22Measure%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22Z%22%2C%22Z%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22Z%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C%22Amps1%22%2C%22Amps1%22%2C%22Amps1%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1WFey.png&quot; alt=&quot;It&amp;#39;s a mystery&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-10-31T19:02:37.933" LastActivityDate="2018-10-31T19:02:37.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4589" PostTypeId="2" ParentId="4576" CreationDate="2018-10-31T22:19:03.810" Score="5" Body="&lt;p&gt;There is no way to build the oracle in a way which would not defeat the point of Deutsch's algorithm - that's why it is an oracle-based algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way would be if you would come up with an incredibly hard to compute function (this is, an incredibly long circuit) which would take one input bit &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and give one output bit &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; (but on the way could use as many ancillas as you want), and where for some reason you would only be interested whether &lt;span class=&quot;math-container&quot;&gt;$f(0)=f(1)$&lt;/span&gt;.  Then, you could use Deutsch's algorithm to save half the time (since you have to run this circuit only once).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, this sounds pretty contrived, and it is.  On the other hand, it sounds equally contrived that there might be function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$1 \leq x \leq N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; integer, and you would like to find some &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x+y)=f(x)$&lt;/span&gt;, without the need to learn &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; itself - yet, it turns out this is exactly what is required for factoring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the point is that oracle-based algorithms prove that you can get a speed-up &lt;em&gt;if&lt;/em&gt; you have a problem with that structure (i.e. where you only want to learn some specific property of a function), but it doesn't tell you if such a problem exists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you want to implement Deutsch, any way of doing the oracle is fine - it is a &quot;proof-of-principle&quot; algorithm and does not yield an actual speed-up on a real problem (at least none we know of).&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="26" LastEditDate="2018-11-02T14:23:43.417" LastActivityDate="2018-11-02T14:23:43.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4591" PostTypeId="6" CreationDate="2018-11-01T06:25:00.693" Score="0" Body="&lt;p&gt;Having pondered on the idea for the past few days, I finally decided to volunteer to be a site moderator on Quantum Computing SE. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been closely following QCSE's progress since the Area 51 stage and have spent a considerable amount of time participating on the site ever since its inception 7 months ago. I know the site’s policies and meta-history fairly well. I guess the net positive scores on all of my meta posts is testimony to that. Moreover, I am the most active editor and one of the most active reviewers on the site. In many cases, my edits managed to salvage questions which were already closed or were at the brink of getting closed. I usually know what it takes for a post to be suitable for our site and hence, I can guide those users whose questions get put on hold.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides, being a student, I have sufficient time to deal with any issues that might arise on a day-to-day basis. I check my Stack Exchange inbox almost every two hours and I’m always just a ping away on &lt;a href=&quot;https://chat.stackexchange.com/rooms/74398/the-classical-channel&quot;&gt;The Classical Channel&lt;/a&gt;. You can feel free to discuss with me in case you don’t agree with me on a moderator action :). &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-11-01T14:33:39.433" LastActivityDate="2018-11-01T14:33:39.433" CommentCount="1" CommunityOwnedDate="2018-11-01T06:25:00.693" ContentLicense="CC BY-SA 4.0" />
  <row Id="4592" PostTypeId="1" CreationDate="2018-11-01T09:07:04.070" Score="3" ViewCount="915" Body="&lt;p&gt;Is there any real example for Grover's algorithm but with real database (generated from SQL or file)? I download the Q# development kit &amp;amp; its example, there was one call DatabaseSearchExample claim to use Grover's but it technically doesn't have any kind of database. May I ask a code for this if available?&lt;/p&gt;&#xA;" OwnerUserId="2994" LastEditorUserId="26" LastEditDate="2019-03-12T09:03:29.223" LastActivityDate="2019-03-12T09:03:29.223" Title="Practical example of Grover's algorithm (in Q#)" Tags="&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4593" PostTypeId="2" ParentId="4592" CreationDate="2018-11-01T10:04:37.743" Score="5" Body="&lt;p&gt;So far, it is better to say that the Grover Search algorithm, while presented as an algorithm searching through a database, would not be suited for such purpose. We prefer to say that we search through inputs of a function (the famous oracle). Loading the database/list in a quantum form would be costly in terms of qubits so for now it is not the best application. When presenting, we say that the oracle will have access to the elements of the list/database, but it is not applicable at that time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I remember seeing an example of using Grover for SAT problems in Qiskit.&#xA;There was a notebook showing an example on 3 qubits, and the oracle was built so that it would select the binary combination satisfying a set of clauses. They changed much the files now so you may not see it in the github for Qiskit.&#xA;You were seeking through all possible combinations using superposition and I think it was a good practical example not involving list/database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To help you visualize the example, say you have such 3 clauses to satisfy :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ f(x_1, x_2, x_3) = (x_1 \vee x_2 \vee \neg x_3) \wedge (\neg x_1 \vee \neg x_2 \vee \neg x_3) \wedge (\neg x_1 \vee x_2 \vee x_3) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$x_1,x_2,x_3$&lt;/span&gt; binary values.&#xA;We seek a combination (&lt;span class=&quot;math-container&quot;&gt;$x_1,x_2,x_3$&lt;/span&gt;) such that f equals 1.&#xA;We can have all the possible combinations of (&lt;span class=&quot;math-container&quot;&gt;$x_1,x_2,x_3$&lt;/span&gt;) using the Hadamard transform (000,001,010,...) so we don't need to input a list here.&#xA;If you provide the f function as a quantum operator, that is a set of gates for applying f onto the combinations presented in basis states, with one application you can compute the result of the function in parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And in Grover's algorithm, using a qubit oracle in the &lt;span class=&quot;math-container&quot;&gt;$ |-\rangle $&lt;/span&gt; state, you compute the output of f into it, which makes a phase kickback &lt;span class=&quot;math-container&quot;&gt;$ (-1)^{f(x_1,x_2,x_3)}|-\rangle $&lt;/span&gt;, marking with a minus sign the combinations for which f equals 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the Grover diffusion operator, you amplify the amplitudes of the good combinations, to increase their probability of being measured as output of the circuit by measurement.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-11-01T10:38:58.927" LastActivityDate="2018-11-01T10:38:58.927" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4594" PostTypeId="1" AcceptedAnswerId="4595" CreationDate="2018-11-01T16:33:20.187" Score="5" ViewCount="661" Body="&lt;p&gt;For 1 qubit, the maximally mixed state is &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathrm{I}}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for two qubits, I assume the maximally mixed state is the maximally mixed state is &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathrm{I}}{4}$&lt;/span&gt;?&#xA;Which is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4} (|00\rangle  \langle 00| + |01\rangle  \langle 01| + |10\rangle  \langle 10| + |11\rangle  \langle 11|)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is this state more mixed than the following, for instance?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} (|00\rangle  \langle 00| + |11\rangle  \langle 11|)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also, does this generalize to higher dimensions similarly?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2018-12-14T06:20:42.427" LastActivityDate="2018-12-14T06:20:42.427" Title="Maximally mixed states for more than 1 qubit" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;entropy&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4595" PostTypeId="2" ParentId="4594" CreationDate="2018-11-01T17:12:26.677" Score="3" Body="&lt;p&gt;The Von Neumann entropy of &lt;span class=&quot;math-container&quot;&gt;$1/2 (|00\rangle  \langle 00| + |11\rangle  \langle 11|)$&lt;/span&gt; is one bit. For &lt;span class=&quot;math-container&quot;&gt;$I/4$&lt;/span&gt; it's two bits of entropy instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entropy of states that only have entries on the diagonal of a density matrix is very easy to compute in general, because you just treat the entries as probabilities and compute the Shannon entropy. The Shannon entropy is maximized when all the probabilities are equal, which is why 0.25 four times beats 0.5 twice with 0 twice.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-11-01T17:12:26.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4596" PostTypeId="2" ParentId="4594" CreationDate="2018-11-01T17:13:43.790" Score="3" Body="&lt;p&gt;For a general &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional system, the maximally mixed state is the one described by the normalised identity matrix: &lt;span class=&quot;math-container&quot;&gt;$$\rho=I/d.$$&lt;/span&gt;&#xA;In the specific case of a two-qubit system, this reduces to the first state you write.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is this state more mixed than the following&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a bit hard to answer, as it depends on what your current understanding/intuition of &quot;more mixed&quot; is. One possible answer is that it is &quot;more mixed&quot; because it represents a state associated with a higher uncertainty, as quantifiable for example via the von Neumann entropy.&#xA;You can also have a look at &lt;a href=&quot;https://physics.stackexchange.com/a/170516/58382&quot;&gt;the answers to a similar question on physics.SE&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-11-01T17:13:43.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4597" PostTypeId="2" ParentId="4594" CreationDate="2018-11-01T17:53:57.263" Score="8" Body="&lt;p&gt;For two probability distributions, there is a clear notion how to say which one is more mixed: &lt;span class=&quot;math-container&quot;&gt;$\vec p$&lt;/span&gt; is more mixed than &lt;span class=&quot;math-container&quot;&gt;$\vec q$&lt;/span&gt; if it can be obtained from &lt;span class=&quot;math-container&quot;&gt;$\vec p$&lt;/span&gt; by a mixing process, this is, a stochastic process described by a doubly stochastic matrix (i.e. one which preserved the flat distribution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Birkhoff's theorem relates this to a concept called majorization, which introduces a partial order on the space of probability distributions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same concept generalized to mixed states, allowing us to say which mixed state is more mixed -- for instance, one can establish an order by using the majorization condition on the eigenvalues, and then use a Birkhoff's theorem to prove that one can be converted into the other by a quantum &quot;mixing map&quot; (a unital channel).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is explained in detail e.g. in &lt;a href=&quot;http://michaelnielsen.org/papers/majorization_review.pdf&quot; rel=&quot;noreferrer&quot;&gt;http://michaelnielsen.org/papers/majorization_review.pdf&lt;/a&gt;, or also in the book of Nielsen and Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, this yields that the state with all eigenvalues equal (or equivalently the flat probability distribution) is most mixed.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To relate this to the quantification of mixedness through entropy mentioned in the other answers, the connection comes from the fact that if a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is more random than another state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; in the above sense -- i.e., if &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; can be transformed into &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; by mixing, or equivalently the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; majorize those of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; -- then the entropy of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is larger than the one of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. This property (monotonicity under majorization) is known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Majorization&quot; rel=&quot;noreferrer&quot;&gt;Schur-concavity&lt;/a&gt;, a property shared e.g. by all Renyi-entropies.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-11-01T21:51:29.173" LastActivityDate="2018-11-01T21:51:29.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4599" PostTypeId="6" CreationDate="2018-11-02T12:25:29.330" Score="0" Body="&lt;p&gt;Hi everyone,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am cnada and I am nominating myself too for the election.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started contributing to QCSE 3 months ago thinking that it would be a good idea to help the quantum computing community here but also curious people or beginners in QC. QC is growing fast and unfortunately, we are just a few really working in the field with many things to look at and do. &lt;strong&gt;I believe that sharing knowledge, discussing but also helping people get into the field will be key.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think my contribution is still modest (I use QCSE very simply honestly) but it is the only SE I am active on and I managed to help many people I hope. If I can help the QCSE by being a modo, I will do it for the QC community. My way of carrying out things is to always take the &lt;strong&gt;calm&lt;/strong&gt;, &lt;strong&gt;simple&lt;/strong&gt; and &lt;strong&gt;cool way&lt;/strong&gt;, trying to help whenever I can. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So let's make the experience of every QCSE user enjoyable, and help the QC field the best we can.&lt;/strong&gt; I am available by @ or on the chat if you have any questions or remarks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yours sincerely,&#xA;cnada&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-11-02T12:25:29.330" LastActivityDate="2018-11-02T12:25:29.330" CommentCount="2" CommunityOwnedDate="2018-11-02T12:25:29.330" ContentLicense="CC BY-SA 4.0" />
  <row Id="4600" PostTypeId="1" CreationDate="2018-11-02T13:30:39.323" Score="3" ViewCount="89" Body="&lt;p&gt;So the question came up in a book I am working through. Given a circuit with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, construct a state with only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; possible measurement results, each of which has only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits as &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, such as &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0010\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0100\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1000\rangle$&lt;/span&gt;, obviously normalized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I can think to do this is to take the all &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; input state, apply &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; to each qubit and then used multiple-controlled &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gates to affect the change on each qubit, but I feel like this won't lead to the desired end state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, I am enquiring how to create a &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt; state can be arbitrarily prepared, given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="26" LastEditDate="2018-12-23T08:07:25.270" LastActivityDate="2018-12-23T08:07:25.270" Title="Circuit to construct a $n$-qubit state which is a superposition of states with only a single qubit being $\lvert1\rangle$" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="13" ClosedDate="2018-11-02T14:28:30.103" ContentLicense="CC BY-SA 4.0" />
  <row Id="4601" PostTypeId="1" AcceptedAnswerId="4603" CreationDate="2018-11-03T01:44:05.640" Score="3" ViewCount="252" Body="&lt;p&gt;In this question on Quora: &lt;a href=&quot;https://www.quora.com/What-is-meant-by-the-photon-is-its-own-antiparticle&quot; rel=&quot;nofollow noreferrer&quot;&gt;What is meant by &quot;the photon is its own antiparticle&quot;?&lt;/a&gt;, an answer is given which states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In quantum theory, we have a procedure for transforming the wave function of a particle into that of an antiparticle.  It is called the &quot;CP&quot; operation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, the author of the answer does not explain what the &quot;CP&quot; operation is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the &quot;CP&quot; Operation in the context of anti-particles?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-14T06:29:15.377" LastActivityDate="2018-12-14T06:29:15.377" Title="What is the &quot;CP&quot; operation in the context of anti-particles?" Tags="&lt;cpt-symmetry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ClosedDate="2018-11-06T14:46:46.453" ContentLicense="CC BY-SA 4.0" />
  <row Id="4602" PostTypeId="1" AcceptedAnswerId="4604" CreationDate="2018-11-03T01:56:26.787" Score="4" ViewCount="146" Body="&lt;p&gt;I was thinking of an error correcting code to correct 1-qubit errors. I came up with the following, which I guess has to have a mistake somewhere, but I am not able to find it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is the same as the 9 qubit Shor code with one small difference. As in the Shor code, first we encode our qubit using the 3-qubit phase code. Then, instead of further encoding the 3 qubits against bit-flip errors, we only encode one of them, namely, the one that contains the state that we want to protect. The resulting code would be the following &lt;span class=&quot;math-container&quot;&gt;$$\small{|0\rangle \rightarrow |00000\rangle + |00001\rangle + |00010\rangle + |11100\rangle + |00011\rangle + |11101\rangle + |11110\rangle + |11111\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\small{|1\rangle \rightarrow |00000\rangle - |00001\rangle - |00010\rangle - |11100\rangle + |00011\rangle + |11101\rangle + |11110\rangle - |11111\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="4994" LastEditorUserId="26" LastEditDate="2018-11-03T13:03:04.410" LastActivityDate="2018-11-03T13:03:04.410" Title="Why does this error correcting code not work?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4603" PostTypeId="2" ParentId="4601" CreationDate="2018-11-03T05:03:13.463" Score="4" Body="&lt;p&gt;C = charge conjugation&lt;br&gt;&#xA;P = parity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/CP_violation#CP-symmetry&quot; rel=&quot;nofollow noreferrer&quot;&gt;CP symmetry&lt;/a&gt; is often mentioned in the context of particle physics.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2018-11-03T05:03:13.463" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4604" PostTypeId="2" ParentId="4602" CreationDate="2018-11-03T07:04:16.480" Score="1" Body="&lt;p&gt;It’s worth noting that it’s not impossible that your code could work - there is a 5 qubit code that is capable of correcting a single error (look up the perfect quantum error correcting code, just beware that I seem to remember there was a slight error in one of the circuit diagrams in one of the original papers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, to see that your particular code does not work, consider applying an X gate on the last qubit. Logical 0 stays as logical 0, while logical 1 is returned as logical 1, but with an overall negative sign. In other words, that single X implements logical Z. So, when this gate is applied, there is no error that an be detected let alone corrected, but obviously the logical state is not preserved.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-03T07:04:16.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4605" PostTypeId="1" AcceptedAnswerId="4610" CreationDate="2018-11-04T08:14:02.527" Score="4" ViewCount="121" Body="&lt;p&gt;I want to test some ideas using the quantum internet. I know that is not widely available now. Can it be simulated? Are there any simulation systems which allow - &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Entanglement &lt;/li&gt;&#xA;&lt;li&gt;Testing states &lt;/li&gt;&#xA;&lt;li&gt;Integration states in third-party systems (eg C++ programs)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The kind of tool would be useful, would basically confirm certain properties of the communications and how they could then be used in a classical layer e.g. for communications.&lt;/p&gt;&#xA;" OwnerUserId="4489" LastEditorUserId="26" LastEditDate="2018-12-13T21:46:26.313" LastActivityDate="2018-12-13T21:46:26.313" Title="How to test with the &quot;Quantum Internet&quot;?" Tags="&lt;communication&gt;&lt;quantum-networks&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4606" PostTypeId="1" AcceptedAnswerId="4607" CreationDate="2018-11-04T10:21:58.303" Score="6" ViewCount="122" Body="&lt;p&gt;On page 3 &lt;a href=&quot;https://arxiv.org/abs/1110.2232&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; it is mentioned that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, building on prior works [32, 36, 38] recently it has been&#xA;  shown in [39] that to simulate &lt;span class=&quot;math-container&quot;&gt;$e^{−iHt}$&lt;/span&gt; for an &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-sparse Hamiltonian&#xA;  requires only &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(s^2||Ht||\text{poly}(\log N,&#xA; \log(1/\epsilon)))$&lt;/span&gt;, breaching the limitation of previous algorithms&#xA;  on the scaling in terms of &lt;span class=&quot;math-container&quot;&gt;$1/\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Questions:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is meant by &quot;simulate&quot; in this context? Does it mean it takes &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{O}(s^2||Ht||\text{poly}(\log N,&#xA; \log(1/\epsilon)))$$&lt;/span&gt; time to &lt;strong&gt;decompose&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; into elementary quantum gates given we know &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Or does it mean we can &lt;strong&gt;compute&lt;/strong&gt; the matrix form of  &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{O}(s^2||Ht||\text{poly}(\log N,\log(1/\epsilon)))$$&lt;/span&gt; time given we know the matrix form of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What does &lt;span class=&quot;math-container&quot;&gt;$||Ht||$&lt;/span&gt; mean here? Determinant of &lt;span class=&quot;math-container&quot;&gt;$Ht$&lt;/span&gt;? Spectral norm of &lt;span class=&quot;math-container&quot;&gt;$Ht$&lt;/span&gt;? I checked the &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=2ahUKEwjqxI65wrreAhUHLo8KHXKNBtYQFjAAegQIAhAC&amp;amp;url=http%3A%2F%2Fwww.dominicberry.org%2Fpresentations%2Fpolylog.pptx&amp;amp;usg=AOvVaw2DnATXIDpkfYGrUA46GrEz&quot; rel=&quot;noreferrer&quot;&gt;linked ppt&lt;/a&gt; and it seems to call &lt;span class=&quot;math-container&quot;&gt;$||H||$&lt;/span&gt; the &quot;norm&quot; of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Now I have no idea how they're defining &quot;norm&quot;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-11-04T10:27:01.640" LastActivityDate="2018-11-04T13:40:56.943" Title="Clarification needed: &quot;Simulation&quot; of $e^{-iHt}$ and its time complexity" Tags="&lt;quantum-gate&gt;&lt;complexity-theory&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4607" PostTypeId="2" ParentId="4606" CreationDate="2018-11-04T11:18:35.073" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;Yes. Computing this matrix is something we call Hamiltonian Simulation. We do not use the verb &quot;simulate&quot; alone though I think. &lt;/li&gt;&#xA;&lt;li&gt;It is the norm. I think you assume in general they use either the max norm, which is the largest entry of the Hamiltonian, or the norm is referring to the largest eigenvalue in absolute value (which is called the spectral radius and would be less confusing to call it this way). I think it is a bit unclear here but as they mention quantum walks, the max norm is associated (&lt;a href=&quot;http://arxiv.org/pdf/1501.01715.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is a mention of this norm for a quantum walk approach&lt;/a&gt;) You can find a very good explanation about Hamiltonian Simulation from this &lt;a href=&quot;https://youtu.be/PerdRJ-offU?t=1893&quot; rel=&quot;nofollow noreferrer&quot;&gt;talk from Robin Kothari&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-11-04T13:40:56.943" LastActivityDate="2018-11-04T13:40:56.943" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4608" PostTypeId="2" ParentId="4605" CreationDate="2018-11-04T12:55:16.557" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1707.00966.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reutter and Vicary&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Features of teleportation, dense coding and secure key distribution are mimicked even without having an honest quantum internet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main idea is the groudit. That is a special type of groupoid where there certain bijections as sets given as extra data. That is for a given natural number &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, think about &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; finite groups all of cardinality &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and put them all together.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some Haskell you can use to play around with this concept if you want.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-11-04T12:55:16.557" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4609" PostTypeId="2" ParentId="4606" CreationDate="2018-11-04T13:01:56.340" Score="3" Body="&lt;p&gt;&quot;Hamiltonian Simulation&quot; means applying the time evolution given by &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to some initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, i.e. to implement the unitary &lt;span class=&quot;math-container&quot;&gt;$U=e^{iHt}$&lt;/span&gt; on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not mentioned otherwise, for an operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\|H\|$&lt;/span&gt; generally denotes the &lt;em&gt;operator norm&lt;/em&gt;, i.e., the largest eigenvalue (in absolute value) of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.  Whether this is &lt;em&gt;really&lt;/em&gt; the case the answer linked is unclear, see the answer by cnada.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-11-04T13:27:25.540" LastActivityDate="2018-11-04T13:27:25.540" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4610" PostTypeId="2" ParentId="4605" CreationDate="2018-11-04T13:14:05.110" Score="3" Body="&lt;p&gt;There is a set of two packages in Mathematica called &quot;Quantum Notation&quot; and &quot;Quantum Computing&quot; for Wolfram Mathematica Environment, and here you can very well mimic all three considerations you are concerned with and much more in the usual Dirac Notation and Quantum Circuit Formalism. &#xA;The link to the packages are as follows: &#xA;&lt;a href=&quot;http://homepage.cem.itesm.mx/jose.luis.gomez/quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://homepage.cem.itesm.mx/jose.luis.gomez/quantum/&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use the QET package for MATLAB if you are familiar with that environment:&#xA;&lt;a href=&quot;http://www.qetlab.com/Main_Page&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.qetlab.com/Main_Page&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference being that this will be performed on a classical computer and not really on a Quantum Interface. &#xA;Since there is not really such a vast open source network for Quantum Computing, except a few like IBM-Q, the best option for my experience is to use the packages in Mathematica.&#xA;Hope this helps. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-04T13:14:05.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4611" PostTypeId="2" ParentId="4580" CreationDate="2018-11-04T13:25:33.960" Score="3" Body="&lt;p&gt;One of the best tools to use is the &quot;Quantum Computing&quot; package in Mathematica:&#xA;&lt;a href=&quot;http://homepage.cem.itesm.mx/jose.luis.gomez/quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://homepage.cem.itesm.mx/jose.luis.gomez/quantum/&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can just input all the useful gates directly and also completely manipulate the Circuits in a complete GUI interface.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fjq4X.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fjq4X.png&quot; alt=&quot;Screenshot is taken from Gomez&amp;#39;s webpage&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, you can also perform all the desired operations over qubits.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-04T13:25:33.960" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4612" PostTypeId="1" CreationDate="2018-11-04T13:58:16.357" Score="2" ViewCount="81" Body="&lt;p&gt;I am starting to step into the field of Topological Quantum Information and Computation and am in search of tools which I can use to directly simulate or realize these transformations in a textual or graphical manner.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2018-11-04T14:01:15.827" LastActivityDate="2018-11-05T05:23:37.793" Title="Is there any tool or simulator for Topological quantum gates and circuits?" Tags="&lt;topological-quantum-computing&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2018-11-05T20:24:37.830" ContentLicense="CC BY-SA 4.0" />
  <row Id="4613" PostTypeId="1" CreationDate="2018-11-04T14:18:40.090" Score="4" ViewCount="178" Body="&lt;p&gt;I was reading this &lt;a href=&quot;https://arxiv.org/abs/1611.01068&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; which introduces a mapping from a qubit Hamiltonian to an Ising model. Firstly, the first step of the mapping seems to assume that we know an eigenstate of the system (correct me here because it seems unlikely in practice). Below, is the mention of the first step : &#xA;&lt;a href=&quot;https://i.stack.imgur.com/PKn98.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PKn98.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, such mapping seems extremely costly if we look at their complexity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: would this method be considered interesting for practice compared to classical methods and how can this be implemented on practical examples? &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-11-06T02:05:02.993" LastActivityDate="2018-11-06T02:05:02.993" Title="Electronic structure calculations and the Ising model: practical?" Tags="&lt;algorithm&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4614" PostTypeId="2" ParentId="1958" CreationDate="2018-11-04T14:21:35.557" Score="3" Body="&lt;p&gt;An assumption in general measurements: The measuring device itself has no degrees of freedom and it does not couple with the qudit in any form of interaction, which is not true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A projective measurement is ideal and non-realistic because it is always assumed that there is no extension of this Projector to a bigger Hilbert space or more degrees of freedom than the Qudit degrees of freedom. But actually what happens experimentally is the fact that, to measure on a qubit we always have to assign a classical operation called a &quot;Pointer&quot; that is a link between your classical outcome by the measurement and the quantum measurement. By doing this the system is always exposed to a non-unitary and open environment where the measurement becomes non-deal and the information is leaked in outer degrees of freedom when the system coupled with the measuring device. This in principle itself is a nature's inherent property that forbids an ideal Quantum Measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) To go about this, as you pointed out, the true realistic method is a weak measurement method. To minimize the coupling with the environement and be close to a true quantum measurment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are certain cases which are special, certain states called &quot;Pointer states&quot; allow true ideal measurement w.r.t particular Measurement operators (Because they retain their quantum properties like Coherence, entanglement, etc) in the smaller Hilbert space and do not couple with higher degrees of freedom of the measuring device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some literature about this which I read in detail is from this article by W.H. Zurek:  &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0105127&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0105127&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-04T14:21:35.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4615" PostTypeId="2" ParentId="4601" CreationDate="2018-11-04T15:51:06.270" Score="3" Body="&lt;p&gt;This is the context of Particle Physics and Field Theory where CP as pointed out above very precisely, are the fundamental symmetries which conserve various quantities. This has no direct significance with Quantum Information/Computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of the term &quot;CP&quot;, in Quantum Information Theory, we have what is called &quot;Completely Positive&quot; maps or more restrictively &quot;CPTP - Completely Positively Trace Preserving Maps&quot; which are transformations (called Quantum Channels) on a qudit state from one Hilbert space to another. There are certain axioms that the channels satisfy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just for the literature of the subject, this is a very hot topic of research in QI, you may find some information in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_channel&lt;/a&gt; &#xA;Or, Nielsen and Chuang, Chapter 8 titled &quot;Quantum noise and quantum operations.&quot;&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-04T15:51:06.270" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4616" PostTypeId="2" ParentId="4594" CreationDate="2018-11-04T16:07:22.547" Score="1" Body="&lt;p&gt;In the sense of the entropy, the maximum entropy from a &quot;&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;&quot; dimensional density matrix is just &lt;span class=&quot;math-container&quot;&gt;$\log_2 d$&lt;/span&gt; if you measure wrt two degrees of freedom. This is more than &lt;span class=&quot;math-container&quot;&gt;$\log_22=1 \ \text{bit}$&lt;/span&gt;, and hence more information. This is because we always compare the Quantum Information with the Classical Information as over a &lt;strong&gt;&quot;bit&quot;&lt;/strong&gt;. However, if we measure the information of a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensional system over an &quot;information basis&quot; of &quot;&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;&quot; itself we will see that the maximum is &lt;span class=&quot;math-container&quot;&gt;$\log_d d$&lt;/span&gt; which will be equivalent to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;bit again in the sense of comparison of maximally mixed states and maximum information. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intuitive answer as to why the higher dimensional system has more entropy as a bound is simply because it has more parameters to be identified and measured to describe it completely. This means, conversely; for two systems &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; with Hilbert Space dimesnions &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$m\geq n$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; will have more information if both are initially completely mixed. Because more mixedness&lt;span class=&quot;math-container&quot;&gt;$\implies$&lt;/span&gt; more uncertainty before measurement&lt;span class=&quot;math-container&quot;&gt;$\implies$&lt;/span&gt; more surprise after a measurement. This is the intuition behind mixedness of a state. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2018-11-04T16:14:40.553" LastActivityDate="2018-11-04T16:14:40.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4617" PostTypeId="1" CreationDate="2018-11-04T16:29:34.320" Score="4" ViewCount="90" Body="&lt;p&gt;I understood how a Quantum Turing Machine works from &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=2ahUKEwjF95m-mrveAhUZdCsKHQKBCHUQFjAAegQIBRAC&amp;amp;url=https%3A%2F%2Fpeople.eecs.berkeley.edu%2F~vazirani%2Ff97qcom%2Flec19.ps&amp;amp;usg=AOvVaw3q_ZVoVtCMMG8hLif0NA4U&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; lecture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great if someone could give an example of how this machine could be used to solve a real problem though, for example, simulate the Deutsch algorithm on a Quantum Turing machine.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2018-11-04T16:57:26.620" LastActivityDate="2018-11-04T16:57:26.620" Title="Deutsch Algorithm on a Quantum Turing Machine" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;quantum-turing-machine&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4619" PostTypeId="1" AcceptedAnswerId="4621" CreationDate="2018-11-04T23:26:18.383" Score="5" ViewCount="79" Body="&lt;p&gt;How does one map an ANF to a toffoli network? Is there a straight-forward procedure for doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, given the ANF for the Sum function of an adder:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S = A \oplus B \oplus C \oplus ABC$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that mapping would be trivial following the process of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Perform &lt;span class=&quot;math-container&quot;&gt;$A \oplus B$&lt;/span&gt; with two CNOT gates, storing the result in ancilla bit, call it &lt;span class=&quot;math-container&quot;&gt;$Anc_1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Perform &lt;span class=&quot;math-container&quot;&gt;$Anc_1 \oplus C$&lt;/span&gt; with two CNOT gates, storing the result in &lt;span class=&quot;math-container&quot;&gt;$Anc_2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Perform &lt;span class=&quot;math-container&quot;&gt;$Anc_2 \oplus ABC$&lt;/span&gt; using a CNOT and a 3-control bit toffoli, storing the result in the output, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This process results in this circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9BhTR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9BhTR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does this not work? What is the process to map an ANF to a toffoli network?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS I apologize for not being able to find an appropriate tag.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="26" LastEditDate="2018-12-23T08:05:40.277" LastActivityDate="2018-12-23T08:05:40.277" Title="Mapping Algebraic Normal Form of Exclusive Sum of Products to Toffoli Network" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4620" PostTypeId="2" ParentId="3773" CreationDate="2018-11-05T00:20:12.657" Score="4" Body="&lt;p&gt;Those figures were created manually with &lt;a href=&quot;https://www.sketchup.com/products/sketchup-free&quot; rel=&quot;nofollow noreferrer&quot;&gt;sketchup&lt;/a&gt;, which is a 3d modelling tool. There was no simulation involved, only careful application of known rules.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-11-05T00:20:12.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4621" PostTypeId="2" ParentId="4619" CreationDate="2018-11-05T01:48:22.620" Score="3" Body="&lt;p&gt;My mistake.&#xA;The ANF for the sum function of an adder is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$S = A \oplus B \oplus C$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The process for mapping ANF to toffoli network works, but only if the ANF is correct.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastActivityDate="2018-11-05T01:48:22.620" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4622" PostTypeId="2" ParentId="4612" CreationDate="2018-11-05T02:11:55.547" Score="0" Body="&lt;p&gt;I found below repo on github which you can check.&#xA;&lt;a href=&quot;https://github.com/jacobmarks/QTop&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/jacobmarks/QTop&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QTop allows for the simulation of topologies with arbitrary code depth, qudit dimension, and error models. Currently, QTop features Kitaev quantum double models, as well as color codes in 3-regular planar tilings.&lt;/p&gt;&#xA;" OwnerUserId="4925" LastEditorUserId="4925" LastEditDate="2018-11-05T05:23:37.793" LastActivityDate="2018-11-05T05:23:37.793" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4623" PostTypeId="1" AcceptedAnswerId="4624" CreationDate="2018-11-05T10:18:24.993" Score="6" ViewCount="698" Body="&lt;p&gt;I am new to quantum computation and I recently came across the statement that super-dense coding can be called the inverse of quantum teleportation&lt;/p&gt;&#xA;" OwnerUserId="5007" LastEditorUserId="26" LastEditDate="2018-12-13T21:01:51.397" LastActivityDate="2018-12-13T21:01:51.397" Title="Why is super-dense coding called the inverse of quantum teleportation?" Tags="&lt;teleportation&gt;&lt;superdense-coding&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4624" PostTypeId="2" ParentId="4623" CreationDate="2018-11-05T10:23:16.827" Score="8" Body="&lt;p&gt;In quantum teleportation, one starts with an entangled state shared between two parties, and (after some messing at the sender's side), &lt;strong&gt;two classical bits&lt;/strong&gt; are transmitted from one party to the other so that the net effect is a &lt;strong&gt;quantum state&lt;/strong&gt; is sent from the first party to the second without sending any quantum data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In superdense coding, the parties start with an entangled state shared between two parties, and (after some messing at the sender's side), a &lt;strong&gt;quantum state&lt;/strong&gt; is sent from one party to the other so that the net effect is &lt;strong&gt;two classical&lt;/strong&gt; bits are sent from the first party to the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully I've written that in such a way that it conveys the symmetry between the two settings. Where I say &quot;quantum state&quot;, I specifically mean a single qubit in an unknown state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-05T10:23:16.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4625" PostTypeId="1" AcceptedAnswerId="4626" CreationDate="2018-11-05T10:29:14.613" Score="24" ViewCount="6437" Body="&lt;p&gt;What exactly is an &quot;&lt;em&gt;oracle&lt;/em&gt;&quot;? Wikipedia says that an oracle is a &quot;&lt;em&gt;blackbox&lt;/em&gt;&quot;, but I'm not sure what that means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Deutsch–Jozsa algorithm&lt;/a&gt;,&lt;br/&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{85px}$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/GZ11I.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GZ11I.png&quot; width=&quot;450&quot;/&gt;&lt;/a&gt;,&lt;br/&gt;is the oracle just the box labeled &lt;span class=&quot;math-container&quot;&gt;$`` U_f &quot; ,$&lt;/span&gt; or is it everything between the measurement and the inputs (including the Hadamard gates)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to give the oracle, do I need to write &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; in matrix form or the condensed form: &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$y \rightarrow y \oplus f(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x \rightarrow x$&lt;/span&gt; is enough with respect to the definition of an oracle?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-09-10T11:47:08.267" LastActivityDate="2020-09-10T11:47:08.267" Title="What exactly is an oracle?" Tags="&lt;terminology&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="4626" PostTypeId="2" ParentId="4625" CreationDate="2018-11-05T10:39:17.747" Score="28" Body="&lt;p&gt;An oracle (at least in this context) is simply an operation that has some property that you don't know, and are trying to find out. The term &quot;black box&quot; is used equivalently, to convey the idea that it's just a box that you can't see inside, and hence you don't know what it's doing. All you know is that you can supply inputs and receive outputs. In the circuit diagram you depict, it is just the &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; box. Everything else is stuff that you are adding in order order to help interrogate the oracle and discover its properties.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give the oracle, you can write it in any valid form that defines a map from all possible inputs to outputs. This could be a matrix (presumably with an unknown parameter), or it could be the map &lt;span class=&quot;math-container&quot;&gt;$U:(x,y)\mapsto (x,y\oplus f(x))$&lt;/span&gt; (strictly, &lt;span class=&quot;math-container&quot;&gt;$\forall x,y\in\{0,1\}$&lt;/span&gt;), because given either description, you can work out the other.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-05T10:39:17.747" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4627" PostTypeId="1" AcceptedAnswerId="4637" CreationDate="2018-11-05T12:23:21.877" Score="4" ViewCount="823" Body="&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B\neq H_B\otimes H_A$&lt;/span&gt; (in general). Theoretically, we know the formalism and what observables to construct from the two compositions possible, but we never talk about both the possibilities. I wish to know that how experimentally the Measurements or Evolutions are done over such composite systems (let's just assume a bipartition as above). &#xA;How does the experimentalist know whether he is working in the &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$B\otimes A$&lt;/span&gt; composite Hilbert Space? &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-06T11:06:26.263" Title="What role does the non-commutativity of the tensor product play in experimental quantum computation?" Tags="&lt;tensor-product&gt;" AnswerCount="4" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4628" PostTypeId="1" AcceptedAnswerId="4631" CreationDate="2018-11-05T12:57:41.853" Score="7" ViewCount="1195" Body="&lt;p&gt;There is something I really misunderstand about the Deutsch-Jozsa algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To check if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced or constant, we use the following algorithm :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jGqvr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jGqvr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$(x,y) \rightarrow (x, y \oplus f(x))$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; for simplicity (thus the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is defined on &lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; possible &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; associated to &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; constants possibility (&lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; equal to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), and two balanced possibilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in &lt;strong&gt;practice&lt;/strong&gt;, if I want to implement this in a circuit, I have to know exactly the &quot;matrix&quot; of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;. And to do it I have to compute &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; times. Thus, I know if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced or constant even before having applied the quantum algorithm. So for a practical aspect, I don't understand what is the point of this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Said differently, if I am given &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; I agree that in &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; step I will know if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced or constant. But if I know &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; I already know the answer to this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a little confused...&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5024" LastEditDate="2018-11-06T14:46:05.703" LastActivityDate="2018-11-06T14:46:05.703" Title="How is the Deutsch-Jozsa algorithm faster than classical for practical implementation?" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4629" PostTypeId="2" ParentId="4627" CreationDate="2018-11-05T13:14:13.240" Score="5" Body="&lt;p&gt;When you say &lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt; I presume you are talking about the implied basis in usual ordering like (00, 01, 02, 10 etc). Otherwise you would have the isomorphism of Hilbert spaces vs an equality statement. That is, AB implies a certain ordered basis and BA a different one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The experiment has it's observables on the combined system in a basis independent way. If the experimentalist wants to put their results down, they can choose whatever basis they like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distinction goes into the question being asked. What is the second entry of vector v in Hilbert space that combines A and B is not a well defined question. What is the second entry with respect to a given ordered basis is. The experimentalist has to ask the second in order to get an answer. You have to ask a sensible question if you want a sensible answer.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-11-05T13:14:13.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4630" PostTypeId="2" ParentId="4627" CreationDate="2018-11-05T13:33:10.137" Score="3" Body="&lt;p&gt;The order in the tensor product is a convention and has nothing to do with experiments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, if I have a cavity (with photons in it, &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt;) and an atom (with internal states, &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;), it is clear which is the atom and which is the cavity, regardless of the order ones chooses for their Hilbert spaces in the tensor product when describing the setup theoretically.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-11-05T13:33:10.137" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="4631" PostTypeId="2" ParentId="4628" CreationDate="2018-11-05T13:33:53.247" Score="6" Body="&lt;p&gt;If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, imagine now &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is very large, say just &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;50$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;60$&lt;/span&gt;, it becomes a bit difficult to store a &lt;span class=&quot;math-container&quot;&gt;$2^n * 2^n$&lt;/span&gt; unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us give you an example just on n=3:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ f(x) = x_0 \oplus x_1 x_2 $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To apply &lt;span class=&quot;math-container&quot;&gt;$ U_f $&lt;/span&gt;, we just need a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and a Toffoli gate representing the different operations of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into &quot;simple&quot; operations). You can extend to examples where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is very large.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-11-05T13:33:53.247" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="4632" PostTypeId="2" ParentId="4628" CreationDate="2018-11-05T13:47:46.927" Score="8" Body="&lt;p&gt;I think there are probably two points to make here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is &quot;do nothing&quot; which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you &lt;em&gt;need&lt;/em&gt; to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Incidentally, I think &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4576/1837&quot;&gt;this question&lt;/a&gt; is closely related.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-05T13:47:46.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4633" PostTypeId="2" ParentId="4613" CreationDate="2018-11-05T18:22:26.767" Score="5" Body="&lt;p&gt;In this paper, the authors use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Ising_model&quot; rel=&quot;noreferrer&quot;&gt;Ising model&lt;/a&gt; to simulate the electronic structure Hamiltonian. &lt;br&gt;&#xA;The electronic structure Hamiltonian after the Jordan-Wigner or Bravyi-Kitaev transformation (which the authors of this paper did use) has quadratic (and sometimes higher-order) terms containing  &lt;span class=&quot;math-container&quot;&gt;$\sigma_x, \sigma_y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;, but the Ising model does not have any quadratic terms containing &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; in any way. &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to efficiently simulate any Hamiltonian using a Hamiltonian that has quadratic terms containing &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;, as proven by &lt;a href=&quot;https://arxiv.org/abs/0704.1287&quot; rel=&quot;noreferrer&quot;&gt;Biamonte &amp;amp; Love&lt;/a&gt;. However, since the Ising Hamiltonian does not have such terms, which are required to simulate the electronic structure Hamiltonian efficiently, the method in the paper you mentioned, is not capable of &lt;em&gt;efficiently&lt;/em&gt; finding the ground state of the electronic structure Hamiltonian. &lt;/p&gt;&#xA;" OwnerDisplayName="user5019" LastActivityDate="2018-11-05T18:22:26.767" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="4635" PostTypeId="1" AcceptedAnswerId="4643" CreationDate="2018-11-05T21:23:35.797" Score="6" ViewCount="242" Body="&lt;p&gt;I've been looking at basic quantum algorithms such as the Deutsch-Jozsa algorithm that are able to characterize functions very well and I was wondering if similar approaches exist to characterize quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following example: Given a normalized state &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^{N} a_i\vert x_i\rangle$&lt;/span&gt;, is there some way to check if all the &lt;span class=&quot;math-container&quot;&gt;$a_i = 1/\sqrt{N}$&lt;/span&gt; or if there exists some &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; that are different from the others?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial lines of thinking were to apply a Hadamard on the state but for large &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, it's not clear if that approach helps. Do you have any ideas on how to proceed, or is it the case that such problems are not things that quantum computers can help with?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: I should have emphasized some features of my question better&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is large, yet the &quot;unbalancedness&quot; i.e. the variance among the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; can be small. Hence POVM measurements will succeed in giving me the answer with very low probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Methods that distinguish between two known non-orthogonal states seem slightly hard to apply since my question is subtly different. I ask if my state is of a specific kind (balanced) or not. Intuitively, my question seems easier to answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) I should have stated it earlier but one can assume that one is allowed &lt;span class=&quot;math-container&quot;&gt;$c\ll N$&lt;/span&gt; copies of the state if this helps.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-08-02T07:54:52.783" LastActivityDate="2020-08-02T07:54:52.783" Title="Balanced vs unbalanced superposition distinguisher" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4636" PostTypeId="1" AcceptedAnswerId="5821" CreationDate="2018-11-05T21:52:22.943" Score="7" ViewCount="243" Body="&lt;p&gt;Rigetti reports the following parameters: (&lt;a href=&quot;https://www.rigetti.com/qpu&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.rigetti.com/qpu&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;T1, T2* times&lt;/li&gt;&#xA;&lt;li&gt;1-qubit gate fidelity (F1q)&lt;/li&gt;&#xA;&lt;li&gt;2-qubit gate fidelity (F2q) and,&lt;/li&gt;&#xA;&lt;li&gt;read-out fidelity (Fro)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;IBM QX reports the following: (&lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/devices&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/qx/devices&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;T1, T2 times&lt;/li&gt;&#xA;&lt;li&gt;(single) qubit gate error&lt;/li&gt;&#xA;&lt;li&gt;multi-qubit gate error and, &lt;/li&gt;&#xA;&lt;li&gt;read-out error.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I understand that one can simulate the effect of noise on qubit state using operator-sum representation. According to Nielsen and Chuang, the operation elements are: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Amplitude damping&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0 = \begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; \sqrt{1-\gamma}\end{bmatrix}$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$E_1 = \begin{bmatrix} 0 &amp;amp; \sqrt{\gamma}\\ 0 &amp;amp; 0\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Phase damping&lt;/strong&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0 = \begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; \sqrt{1-\gamma}\end{bmatrix}$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$E_1 = \begin{bmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; \sqrt{\gamma}\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Phase flip&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0 = \sqrt{p}\begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1\end{bmatrix}$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$E_1 = \sqrt{1-p} \begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bit flip&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0 = \sqrt{p}\begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1\end{bmatrix}$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$E_1 = \sqrt{1-p} \begin{bmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bit-phase flip&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0 = \sqrt{p}\begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1\end{bmatrix}$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$E_1 = \sqrt{1-p} \begin{bmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Depolarizing channel&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0 = \sqrt{1-3p/4}\begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1\end{bmatrix}$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$E_1 = \sqrt{p/4} \begin{bmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_2 = \sqrt{p/4} \begin{bmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0\end{bmatrix}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$E_3 = \sqrt{p/4} \begin{bmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are the original device parameters related to the parameters in the operations elements i.e., &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt;? (A first-order approximation of relation between these parameters are also welcomed.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[P.S. are operations elements described in N&amp;amp;L and Kraus operators the same thing?] &lt;/p&gt;&#xA;" OwnerUserId="4722" LastEditorUserId="26" LastEditDate="2019-01-01T09:04:04.737" LastActivityDate="2019-04-01T04:09:07.723" Title="How are Rigetti and IBM QX device parameters related to Kraus operators?" Tags="&lt;ibm-q-experience&gt;&lt;noise&gt;&lt;quantum-operation&gt;&lt;rigetti&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4637" PostTypeId="2" ParentId="4627" CreationDate="2018-11-05T21:54:25.960" Score="11" Body="&lt;p&gt;For many questions that appear on this site, and about quantum information and computation in general, it is possible to ask a completely classical version of the question, and often the (sometimes obvious) answer that one finds in the more familiar classical setting translates directly to the quantum setting. In this case, a reasonable classical version of the question asks what role the non-commutativity of the Cartesian product plays in experimental classical computing (or, let's say, in practical implementations of classical computation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; that can be in any classical state drawn from a set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt;, and a system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; that can be in any classical state drawn from the set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;. If we put system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; next to each other on the table, then we can represent the classical state of the two systems together as an element of the Cartesian product &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}\times\mathcal{B}$&lt;/span&gt;. Note that there is an implicit assumption here, which is that the two systems are distinguishable, and we're deciding more or less arbitrarily that when we talk about a state &lt;span class=&quot;math-container&quot;&gt;$(a,b)\in\mathcal{A}\times\mathcal{B}$&lt;/span&gt; that the state &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; of system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is listed first and the state &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; of system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is listed second. We could just as easily have decided to represent the classical state of the two systems together as an element of the Cartesian product &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}\times\mathcal{A}$&lt;/span&gt;, with the understanding that the state of system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; now gets listed first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, if the two systems were indistinguishable, implying that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A} = \mathcal{B}$&lt;/span&gt;, and further we placed the two systems in a bag rather than on the table, then I guess there would really be no difference between &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(b,a)$&lt;/span&gt;. For this reason we would probably not use the Cartesian product to represent states of the bagged systems -- maybe we would use the set of all multisets of size 2 instead -- but let us forget about this situation and assume &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are distinguishable for simplicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what role does this play in experiments or practical applications of classical computing? How does an experimenter or programmer know he or she is working in the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}\times\mathcal{B}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}\times\mathcal{A}$&lt;/span&gt; state space? When you think about the question this way, I believe it may come into focus. My answer, which is consistent with the other answers that concern the quantum setting, is that it really doesn't play any role at all, and the experimenter/programmer knows because it was his or her decision which order to use. We know the difference between the systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and the decision to represent states of the two systems together by elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}\times\mathcal{B}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}\times\mathcal{A}$&lt;/span&gt; is totally arbitrary -- but once the decision is made we stick with it to avoid confusion. The decision will not affect any calculations we do, so long as the calculations are consistent with the decision of which order to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my eye, at a fundamental level there is no difference between the classical version of this question and the quantum version. We &lt;em&gt;decide&lt;/em&gt; whether to represent states of the compound quantum system using the space &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$H_B\otimes H_A$&lt;/span&gt;, and that's all there is to it. You'll get exactly the same results of any calculations you perform, so long as your calculations are consistent with the choice to use &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$H_B\otimes H_A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-11-05T21:54:25.960" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4638" PostTypeId="2" ParentId="4635" CreationDate="2018-11-06T07:37:49.750" Score="4" Body="&lt;p&gt;There are many different variants depending on what it is precisely that you want to achieve (note, this was written before recent edits, although I think there is still value/relevance in this more general answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest analogy to the Deutsch-Jozsa algorithm is probably to say that you're given one of two states, and you want to know which you've been given (with maximum probability). If those two states are orthogonal, you can perfectly distinguish them just by using projective measurements, two of which project onto those particular states. Beyond the orthogonality assumption, there are ways of selecting the measurement to maximise the probability of distinguishing them. For more details, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2256/1837&quot;&gt;this answer&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4172/1837&quot;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if I take your question literally (which one certainly should given the edits to the question), then probably the best strategy is to define the projectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_1=|\psi\rangle\langle\psi|^{\otimes c}\qquad E_2=\mathbb{I}-E_1,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the uniform superposition state (&lt;span class=&quot;math-container&quot;&gt;$a_i=1/\sqrt{N}$&lt;/span&gt;), and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; copies are allowed. If you get the measurement result &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt;, you learn essentially nothing. However, if you get the answer &lt;span class=&quot;math-container&quot;&gt;$E_2$&lt;/span&gt; (which may well happen with low probability if the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;s are close to uniform), you know that the state definitely was not &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, so some of the amplitudes were different.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-06T12:56:34.603" LastActivityDate="2018-11-06T12:56:34.603" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4640" PostTypeId="2" ParentId="4627" CreationDate="2018-11-06T11:06:26.263" Score="1" Body="&lt;p&gt;The two spaces &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are just labels, with arbitrary ordering. For distinguishable qubits (or more general), the experimentalist can just say &quot;this one's &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and this other one's &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;&quot;. If you swap the labels, you need to swap the labels everywhere - in both the Hamiltonian &lt;em&gt;and&lt;/em&gt; the state (including eigenvectors, density matrix etc).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if I define a swap operator &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(H_A\otimes H_B)S=H_B\otimes H_A,&#xA;$$&lt;/span&gt;&#xA;then evolution of states can be calculated either using&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-i H_A\otimes H_B t}|\psi_{AB}\rangle \quad\text{or}\quad e^{-i H_B\otimes H_A t}|\psi_{BA}\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi_{BA}\rangle=S|\psi_{AB}\rangle$&lt;/span&gt;. Or, if you're working with a density matrix, you have &lt;span class=&quot;math-container&quot;&gt;$\rho_{BA}=S\rho_{AB}S$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-06T11:06:26.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4641" PostTypeId="2" ParentId="4623" CreationDate="2018-11-06T11:08:02.730" Score="3" Body="&lt;p&gt;Basically quantum teleportation is in facto the determinate side of super-dense coding. In superdense coding we fit two classical bits of information using fairly a single qubit. On the other hand, quantum teleportation uses two classical bits of information to send a single qubit that is in an unknown quantum state. I suggest you to check &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q documentation&lt;/a&gt; for more details.&#xA;Also, the “No Cloning Theorem” states that you cannot prevailingly clone a qubit in an unknown quantum state. Let’s delve a deeper into this to see why this is accurate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider |⟩,|⟩, and |⟩ are vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the sum |⟩ + |⟩ is a vector. The scalar product |⟩ is a vector and  is a complex number  ∈ ℂ.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Commutativity: |⟩ + |⟩ = |⟩ + |⟩&lt;/li&gt;&#xA;&lt;li&gt;Associativity: (|⟩ + |⟩) + |⟩ = |⟩ + (|⟩ + |⟩)&lt;/li&gt;&#xA;&lt;li&gt;Distributive property for scalars and vectors:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;( + )|⟩ = |⟩ + |⟩ where , ∈ ℂ&lt;/li&gt;&#xA;&lt;li&gt;(|⟩ + |⟩) = |⟩ + |⟩ where  ∈ ℂ&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Associative property:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(|⟩) = ()|⟩ where , ∈ ℂ&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, consider that we could build a special unitary operator called U that could clone a qubit. This operator would take two qubits as input, one in an unknown state |⟩ and the other in a state such as |0⟩ that will undergo as our target for duplication. The cloning operator would then turn out with a copy of our qubit along with the original source qubit and both qubits will be in the same state |⟩.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For more detail, please check this paper: &lt;a href=&quot;https://www.cs.mcgill.ca/~yli252/files/quantum.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cs.mcgill.ca/~yli252/files/quantum.pdf&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5028" LastActivityDate="2018-11-06T11:08:02.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4642" PostTypeId="1" CreationDate="2018-11-06T14:45:09.577" Score="11" ViewCount="850" Body="&lt;p&gt;First of all : I am a beginner in quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have a resource (or an answer if it is not complicated) explaining where we put the error correction codes in a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, I know we have different possible errors that can occur (bit flip, phase flip etc), and we have algorithm to correct them. But what I would like to know is if there are some strategies to where we put the error correction algorithm. Is it after each gate involved of the main algorithm ? Is there a smarter strategy used to do a single correction for a set of gates ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the answer is &quot;complicated&quot; I would like to have a resource to learn all this (I find a lot of things for error correction code, but I haven't found anything about where we must do the correction).&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="2371" LastEditDate="2018-11-06T14:53:51.290" LastActivityDate="2018-11-07T07:33:49.253" Title="Where do we put error correction code in quantum circuit?" Tags="&lt;error-correction&gt;&lt;resource-request&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4643" PostTypeId="2" ParentId="4635" CreationDate="2018-11-06T14:55:44.487" Score="6" Body="&lt;p&gt;It is not possible at an information-theoretic level to do what you want to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us suppose we have two pure states: &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle = \frac{1}{\sqrt{N}}\sum_{i=1}^N |x_i\rangle&#xA;$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is similar to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; but with a few of the coefficients tweaked in some way. Notice that we're fixing just two states, and even if you're promised that you're given one of these two states it will not be possible to determine which one you're given with high probability, under the assumption that &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; are close together. (As DaftWullie has suggested, a variant of this problem where &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is fixed and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is not known ahead of time is certainly no easier than the case in which &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is known ahead of time.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To keep things simple, let us suppose that we're given &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, and we're aiming to maximize the probability of correctly determining which of the two states we were given. A theorem sometimes called the Holevo-Helstrom theorem tells us exactly what the optimal probability of a correct guess is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} + \frac{1}{4} \bigl\| |\phi\rangle\langle \phi| - |\psi\rangle\langle \psi| \bigr\|_1,&#xA;$$&lt;/span&gt;&#xA;where the norm is the trace norm. Because we're working with pure states, this expression can be simplified to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} + \frac{1}{2}\sqrt{1 - |\langle \psi | \phi \rangle|^2}.&#xA;$$&lt;/span&gt;&#xA;This is for the &lt;em&gt;optimal&lt;/em&gt; measurement; you cannot do any better than this, no matter what you try to do, assuming you start with one of the two states selected at random and by honest means do your best to determine which state you were given.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the question suggests that the &quot;unbalancedness,&quot; or variance among the coefficients of the states, is small. With that in mind we could define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\varepsilon = 1 - |\langle \psi | \phi \rangle|^2&#xA;$$&lt;/span&gt;&#xA;and regard &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; as a small (but nonnegative) real number. This means that our probability of a correct guess is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} + \frac{\sqrt{\varepsilon}}{2},&#xA;$$&lt;/span&gt;&#xA;which is not much better than just randomly guessing (which yields a correct answer with probability 1/2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you assume that you are given &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; copies of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; copies of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, the calculation is exactly the same, except replacing the states with &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle^{\otimes k}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle^{\otimes k}$&lt;/span&gt;, also as DaftWullie has suggested. We can see how this will affect the optimal correctness probability: it now becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} + \frac{1}{2}\sqrt{1 - |\langle \psi | \phi \rangle|^{2k}}.&#xA;$$&lt;/span&gt;&#xA;Notice that we're placing no constraints on the measurements for distinguishing the two cases -- they could be arbitrarily correlated across the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; copies of the states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can compare this optimal correctness probability with the one-shot case by using the inequality&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;1 - |\langle \psi | \phi \rangle|^{2k}&#xA;\leq k \bigl(1 - |\langle \psi | \phi \rangle|^2\bigr).&#xA;$$&lt;/span&gt;&#xA;To prove this inequality, notice that it is trivial if &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi | \phi \rangle| = 1$&lt;/span&gt;, and otherwise we can use the crude estimate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1 - |\langle \psi | \phi \rangle|^{2k}}{1 - |\langle \psi | \phi \rangle|^2} = 1 + |\langle \psi | \phi \rangle|^2 + \cdots + |\langle \psi | \phi \rangle|^{2(k-1)} &amp;lt; k&#xA;$$&lt;/span&gt;&#xA;for the case &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi | \phi \rangle| &amp;lt; 1$&lt;/span&gt;. We find that the optimal correctness probability is upper-bounded by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} + \frac{\sqrt{k\varepsilon}}{2}.&#xA;$$&lt;/span&gt;&#xA;So, if &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is considered to be much smaller than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is on the order of &lt;span class=&quot;math-container&quot;&gt;$1/N$&lt;/span&gt;, then we're still not doing much better than randomly guessing.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-11-06T14:55:44.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4644" PostTypeId="2" ParentId="4642" CreationDate="2018-11-06T15:03:34.890" Score="9" Body="&lt;p&gt;Based on your question I think that you were not looking for the correct term. Error correction codes are methods in order to detect and correct possible errors that arise in qubits due to the effect of decoherence. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term fault-tolerant quantum computing refers to the paradigm of quantum devices that work effectively even when its elementary components are imperfect, and the error correction codes you have been looking for are the base to construct such kind of computations. I encourage you to look for information related to fault tolerance by yourself as it is quite a big area in quantum computing. However, I strongly recommend you the text &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9712048.pdf&quot; rel=&quot;noreferrer&quot;&gt;Fault-tolerant quantum computation&lt;/a&gt; by Preskill. In such paper, the author does indeed start speaking about error correction codes, but afterwards goes deep into the fault tolerant concept, and I think that it will solve much of your doubts about the topic.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-11-06T15:03:34.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4645" PostTypeId="1" AcceptedAnswerId="4883" CreationDate="2018-11-06T17:37:33.730" Score="4" ViewCount="114" Body="&lt;p&gt;In an answer to a previous question, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4235/2645&quot;&gt;What exactly are Quantum XOR Games?&lt;/a&gt;, ahelwer states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One application of xor games is self-testing: when running algorithms on an untrusted quantum computer, you can use xor games to verify that the computer isn't corrupted by an adversary trying to steal your secrets! &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In an answer to a different previous question, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2489/2645&quot;&gt;How to benchmark a quantum computer?&lt;/a&gt; (which includes a link to &lt;a href=&quot;https://medium.com/@decodoku/understanding-quantum-computers-through-a-simple-puzzle-game-a290dde89fb2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using a simple puzzle game to benchmark quantum computers&lt;/a&gt; by James Wootton), DaftWullie suggests blind quantum computation as a general strategy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can XOR games be used to perform blind quantum computations to benchmark quantum computers?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-18T19:41:16.753" LastActivityDate="2018-12-18T19:41:16.753" Title="Using XOR games to benchmark quantum computers" Tags="&lt;randomised-benchmarking&gt;&lt;games&gt;&lt;blind-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4646" PostTypeId="2" ParentId="4412" CreationDate="2018-11-07T00:45:40.443" Score="3" Body="&lt;p&gt;Within the paper itself that you linked to, on page 4 section 1.2 &quot;Nonabelian Fourier Transforms&quot; and page 5 section 1.3 &quot;Weak vs Strong Sampling and the Choice of Basis&quot;, they define what they mean by representation on page 4 third indent from the top. It specifies that they represent the finite group G as a homomorphism (structure-preserving map) ρ : G → U(d), meaning G is mapped to a unitary matrix U of dimension d, with d = to the number of columns and rows in U.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as the differences between the weak standard method and the strong standard method, while both perform fourier analysis on non-abelian groups, the weak method uses a random basis, while the strong method specifies the rows and columns in a suitably chosen basis in order to perform a full measurement. They state on page 5: &quot;We show...that we lose information-theoretic reconstructibility if we measure using a random basis. Specifically, we need an exponential number of measurements to distinguish conjugates of small subgroups of Ap. This establishes for the first time that the strong standard method is indeed stronger then measuring in a random basis: some bases provide much more information about the hidden subgroup then others.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps. They link to some useful resources in the paper, I found these two pretty helpful: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0211124&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0211124&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.math.tau.ac.il/~borovoi/courses/ReprFG/Hatzagot.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.math.tau.ac.il/~borovoi/courses/ReprFG/Hatzagot.pdf&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5029" LastEditorUserId="26" LastEditDate="2019-05-13T21:22:37.533" LastActivityDate="2019-05-13T21:22:37.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4647" PostTypeId="2" ParentId="4642" CreationDate="2018-11-07T07:33:49.253" Score="6" Body="&lt;p&gt;In fault-tolerant quantum computing, we make a distinction between &lt;em&gt;physical&lt;/em&gt; qubits and &lt;em&gt;logical&lt;/em&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logical qubits are the ones we use in our algorithm. So if our input is a number stored in binary across &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (as in Shor's algorithm), then these &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are logical qubits. When we ask for a quantum Fourier transform on a collection of qubits, then these will also be logical qubits. We expect logical qubits and the operations we do on them to be completely error free, just as we do with the bits and operations in normal computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physical qubits are the ones that actually exist, and they are noisy. These are what we use to make logical qubits, but it typically takes many physical qubits to make one logical qubit. This is because of the large redundancy needed to be able to detect and correct errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The design of the actual code run on physical qubits will happen in layers. A quantum error correction software engineer will design the logical qubits by writing the program needed to implement the quantum error correcting code. For each operation that someone might need in an algorithm, they will design an error correction compatible version, which performs the operation on the logical qubits in a way that allows its imperfections to be detected and corrected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the programmer will come along and write their program. They won't need to think about physical qubits or error correction at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the compiler will combine everything to create the fault-tolerant version of the program to run on the physical qubits. This will look nothing like what was written by the programmer. It won't look like a constant alternation of things that the programmer wrote, followed by error correction things to clean it up. It will almost completely deal with just detecting and correcting the errors that constantly occur, with minor perturbations to implement the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a reference, I guess it is best to recommend something that explains how operations on logical qubits are implemented on physical qubits via an error correcting code. &lt;a href=&quot;https://arxiv.org/abs/1609.04673&quot; rel=&quot;noreferrer&quot;&gt;One of my own papers&lt;/a&gt; does this job, by explaining this for a variety of ways to get logical operations in the surface code. It also has references to many works by others in the same area.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-11-07T07:33:49.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4648" PostTypeId="1" CreationDate="2018-11-07T08:00:10.157" Score="9" ViewCount="538" Body="&lt;p&gt;There are multiple ways of building a qubit: Superconducting (transmons), NV-centers/spin-qubits, topological qubits, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The superconducting qubits are the most well-known qubits and are also the easiest to build. The machines by IBM and Google, for instance, use superconducting qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spin qubits have sizes in the order of a few nanometers and thus have great scaling capabilities. The problem with superconducting qubits, on the other hand, is the size. Apparently, it is hard to shrink the size of a superconducting qubit (typically ~0.1mm). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the limiting factor in the size of superconducting qubits and why can this limiting factor not be scaled down? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2018-11-07T09:55:35.953" LastActivityDate="2018-11-09T17:49:45.957" Title="What limits scaling down the size of superconducting qubits?" Tags="&lt;superconducting-quantum-computing&gt;&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4649" PostTypeId="1" CreationDate="2018-11-07T13:06:51.703" Score="7" ViewCount="78" Body="&lt;p&gt;I have a script that takes a while to simulate. I can modify it in such a way where I can use fewer qubits at a time, but it will require more iterations of manipulation. I believe this will cut down on simulation time, but does is it worse when running on an actual quantum computer? It will still run in polynomial time, regardless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am thinking I should go with the fewer qubits and more gates method, since I would free up qubits for others and cut my simulation time, but I would like to know which is technically the better way, computationally.&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="26" LastEditDate="2018-12-23T12:48:02.303" LastActivityDate="2018-12-23T12:48:02.303" Title="Is it better to use fewer gates or fewer working qubits?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ClosedDate="2018-11-13T21:57:18.393" ContentLicense="CC BY-SA 4.0" />
  <row Id="4650" PostTypeId="1" AcceptedAnswerId="4653" CreationDate="2018-11-07T17:48:58.470" Score="0" ViewCount="148" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1410/2645&quot;&gt;What is the Computational Basis?&lt;/a&gt; gIS states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One also often speaks of &quot;computational basis&quot; for higher-dimensional states (qudits), in which case the same applies: a basis is called &quot;computational&quot; when it's the most &quot;natural&quot; in a given context.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Wikipedia page for &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert space&lt;/a&gt; includes this snippet:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When that set of axes is countably infinite, the Hilbert space can also be usefully thought of in terms of the space of infinite sequences that are square-summable. The latter space is often in the older literature referred to as &lt;em&gt;the&lt;/em&gt; Hilbert space.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If &lt;em&gt;the&lt;/em&gt; Hilbert space has countably infinite axes, is the computational basis for it transfinite?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strike&gt;Additionally, would it be accurate to state that computations with finite bases correlate to classical computations, while computations with transfinite bases correlate quantum computations?&lt;/strike&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2018-12-14T06:26:00.217" LastActivityDate="2018-12-14T06:26:00.217" Title="Is the computational basis for Hilbert space transfinite?" Tags="&lt;mathematics&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4652" PostTypeId="1" CreationDate="2018-11-07T18:38:34.593" Score="7" ViewCount="339" Body="&lt;p&gt;I am very new to quantum computing and just try to understand things from a computer scientist's perspective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of computational power, what I have understood, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;100 ideal qubits ... &lt;a href=&quot;https://blog.usejournal.com/quantum-computing-the-basics-the-bad-and-the-solution-59af357fb52&quot; rel=&quot;nofollow noreferrer&quot;&gt;can equate&lt;/a&gt; to [&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; pieces of information]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now &lt;em&gt;Rigetti Computing&lt;/em&gt; has &lt;a href=&quot;https://medium.com/rigetti/the-rigetti-128-qubit-chip-and-what-it-means-for-quantum-df757d1b71ea&quot; rel=&quot;nofollow noreferrer&quot;&gt;announced&lt;/a&gt; a 128 qubit computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's imagine they indeed release it next year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads me to the following thoughts, please correct me if I am wrong:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;let's say hypothetically due to the noise about 28 qubits can't be taken into consideration (as used for the fault tolerance for example)&lt;/li&gt;&#xA;&lt;li&gt;that is, we could work with 100 qubits as in the example above.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could we say then, we have an analog of &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_architecture&quot; rel=&quot;nofollow noreferrer&quot;&gt;von Neumann architecture&lt;/a&gt; i.e. say  64 qubits go for memory and 32 qubits for the instruction set (say remaining 4 are reserved).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean then (oversimplified!):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;we get 2^32 bits equivalent ~ 537 MB worth of &quot;register bits&quot; for CPU instructions, altogether with caches (no idea who might need that but could probably become a many-core &quot;die&quot; see for example &lt;a href=&quot;https://arxiv.org/abs/1702.02583&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum 4004&lt;/a&gt;), compared to say 512KB=2^15 bits cache for one level on a classical computer&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;and for &quot;RAM&quot;, we get remaining 2^64 bits equivalent = 2.3 &lt;em&gt;exabytes&lt;/em&gt; worth memory? (way more than current supercomputers have; Google had though &lt;a href=&quot;https://en.wikipedia.org/wiki/Exabyte&quot; rel=&quot;nofollow noreferrer&quot;&gt;reportedly&lt;/a&gt; total disk storage of 10 exabytes in 2013)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5044" LastEditorUserId="5044" LastEditDate="2018-11-07T20:52:05.553" LastActivityDate="2019-01-10T21:13:26.097" Title="Understanding (theoretical) computing power of quantum computers" Tags="&lt;architecture&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4653" PostTypeId="2" ParentId="4650" CreationDate="2018-11-07T20:36:55.180" Score="3" Body="&lt;p&gt;You have a finite basis for &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{\otimes n}$&lt;/span&gt; if you have n qubits. Finite basis (with cardinality &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;)-still quantum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; could be countably infinite dimensional. Like &lt;span class=&quot;math-container&quot;&gt;$L^2 (\mathbb{R}^3)$&lt;/span&gt; for an orbital. Or an anti-symmetric combination of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; of those denoted &lt;span class=&quot;math-container&quot;&gt;$\wedge^N (L^2 (\mathbb{R}^3))$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; electrons in some molecule. Both countable dimensional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of states is uncountable, but that is just like saying &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; or the set of phases &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta}$&lt;/span&gt; is uncountable as a set. True but not really relevant because you are using other structure besides just being a set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uncountable dimensional Hilbert spaces are hairier. They would not be separable so a bunch of theorems you need would disappear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Was referring to orthogonal basis not algebraic basis. If you demanded everything written as a finite linear combinations of basis vectors then the sequence &lt;span class=&quot;math-container&quot;&gt;$e_i$&lt;/span&gt; of vectors that have &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in position &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and 0's elsewhere would not be a basis for &lt;span class=&quot;math-container&quot;&gt;$\ell^2 (\mathbb{N})$&lt;/span&gt;. You would need infinitely many of them for something like &lt;span class=&quot;math-container&quot;&gt;$(1,\frac{1}{2},\frac{1}{4},\cdots)$&lt;/span&gt;. So to make an algebraic basis you would need more basis vectors, in fact uncountably more. Another way to see this is the set of &lt;span class=&quot;math-container&quot;&gt;$(1,t,t^2,\cdots)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;t&amp;lt;1$&lt;/span&gt; is uncountable and algebraically linearly independent so algebraically &lt;span class=&quot;math-container&quot;&gt;$\ell^2 (\mathbb{N})$&lt;/span&gt; is at least uncountably infinite dimensional in the algebraic sense. In a Hilbert space usually using Hilbert space dimension not vector space dimension.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2018-11-08T10:30:32.623" LastActivityDate="2018-11-08T10:30:32.623" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4654" PostTypeId="2" ParentId="4652" CreationDate="2018-11-08T00:12:36.407" Score="6" Body="&lt;p&gt;It isn't really like that, for a few reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the link saying &quot;100 ideal qbits can equate to &lt;span class=&quot;math-container&quot;&gt;$2^{100}$&lt;/span&gt; pieces of information&quot;, that's talking about &lt;em&gt;logical&lt;/em&gt; qbits. Logical qbits are composed of many (perhaps hundreds or even thousands) of physical qbits entangled in a quantum error correction scheme, functioning together as a single qbit. So with 128 physical qbits maybe we can make a single sort-of-okay logical qbit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;em&gt;even if&lt;/em&gt; we had 100 perfect logical qbits, those &lt;span class=&quot;math-container&quot;&gt;$2^{100}$&lt;/span&gt; pieces of information are not equivalent to &lt;span class=&quot;math-container&quot;&gt;$2^{100}$&lt;/span&gt; classical bits. It's much easier to understand with math; here's a single qbit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with this single qbit, we do have &lt;span class=&quot;math-container&quot;&gt;$2^1=2$&lt;/span&gt; &quot;pieces of information&quot; (&lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, actually called &lt;em&gt;amplitudes&lt;/em&gt;). However, this doesn't mean we can store two classical bits of information in it. Rather, the amplitudes just encode the probabilities that the qbit will collapse to the classical bit 0 or 1 upon measurement; the probability it collapses to 0 is given by &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;, and the probability it collapses to 1 is given by &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;. It's a bit more complicated than that because there are other ways we can measure it where it won't collapse to 0 or 1, but we won't worry about those here. The upshot is that at the end of the day, you can only get a single bit of classical information out of the qbit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at two qbits. We represent multiple qbits with something called the &lt;em&gt;tensor product&lt;/em&gt;, which is where the exponential growth comes in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle \otimes |\phi_1\rangle =&#xA;\begin{bmatrix} \alpha_0 \\ \beta_0 \end{bmatrix} \otimes&#xA;\begin{bmatrix} \alpha_1 \\ \beta_1 \end{bmatrix} =&#xA;\begin{bmatrix} \alpha_0\alpha_1 \\ \alpha_0\beta_1 \\ \beta_0\alpha_1 \\ \beta_0\beta_1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we measure these two qbits, &lt;span class=&quot;math-container&quot;&gt;$|\alpha_0\alpha_1|^2$&lt;/span&gt; is the probability the system collapses to 00, &lt;span class=&quot;math-container&quot;&gt;$|\alpha_0\beta_1|^2$&lt;/span&gt; to 01, &lt;span class=&quot;math-container&quot;&gt;$|\beta_0\alpha_1|^2$&lt;/span&gt; to 10, and &lt;span class=&quot;math-container&quot;&gt;$|\beta_0\beta_1|^2$&lt;/span&gt; to 11. So even though the number of amplitudes we have is growing exponentially (with three qbits there would be eight amplitudes), again at the end of the day you can only get out as many classical bits as you have qbits. This principle is also known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's bound&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If quantum computers don't get their speedup from storing &amp;amp; operating upon exponential numbers of amplitudes, where do they get it from? It's tricky to boil it down to a single thing. You should know this exponential growth property we're talking about (called the exponential size of the Hilbert space) is an important component, but isn't the full story. It's true that when we don't measure the qbits and continue to operate on them within the quantum computer, we indeed manipulate an exponential number of amplitudes at once. However, you have to be very clever when you do this, because at the end of the day you can only extract a very small number of classical bits from the system - you can never know the actual values of the amplitudes themselves - and so only very specific problems are amenable to speedup on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in learning more, I gave a &lt;a href=&quot;https://youtu.be/F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;video lecture&lt;/a&gt; on quantum computing aimed at computer scientists that you might enjoy.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-01-10T21:13:26.097" LastActivityDate="2019-01-10T21:13:26.097" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4655" PostTypeId="2" ParentId="4652" CreationDate="2018-11-08T07:37:29.850" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;100 ideal qubits ... can equate to [&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; pieces of information]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is really not the case. Taking an equivalent line from the same article:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To put this all into perspective, 100 normal bits just equals 100&#xA;  pieces of information, while 100 ideal qubits (qubits we get in a&#xA;  computer simulation: they are perfect and are not influenced by&#xA;  external factors that influence a physical qubit) can equate to&#xA;  1,267,650,600,228,229,401,496,703,205,376 pieces of information.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Simply, No. It looks a bit like this, but it's very misleading. This is no more true for a quantum computer than it is for a probabilistic classical computer where you describe the state at any moment in time by a set of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; probabilities. In both cases, if you measure the state, the maximum information you can retrieve (on average) is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;let's say hypothetically due to the noise about 28 qubits can't be&#xA;  taken into consideration (as used for the fault tolerance for example)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This isn't how error corrected computing (classical or quantum) works. For one level of error correction, you'll have to encode every logical qubit in 7 physical qubits (let's say). You'll get some improvement in the error rate, but you're already down to only have 18 useful qubits. But if that's not enough, you need a second level of error correction, so effectively you've got 1 logical qubit for every 49 physical qubits. So, you're down to 2 logical qubits. (If you have &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; levels of error correction, then roughly speaking you need &lt;span class=&quot;math-container&quot;&gt;$7^k$&lt;/span&gt; physical qubits per logical qubit, but the per-qubit error rate is doubly exponentially reduced.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your discussion of the structure of the (processor,RAM, etc.) is probably also not appropriate to the Rigetti device. Why do classical computers have hard drives, RAM, cache etc? We have a bunch of different technologies which all have different trade-offs in terms of speed of access, volatility of storage, capacity etc. A computer is a careful combination of all of these things to get the most cost effective, fast computation possible. But a device such as Rigetti's will have all the qubits essentially the same (there'll be some local variation depending on where they are on the chip, but this is a very small effect). There is no reason to split up the architecture in terms of RAM, cache, hard drive etc. These concepts only become relevant when you are interfacing several different hardware types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you were using the device in such a way then, to repeat a previous statement, you don't get to store &lt;span class=&quot;math-container&quot;&gt;$2^{128}$&lt;/span&gt; bits of information, only 128 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for the source of a quantum speed-up, then think about classical computation in terms of universals sets of logic gates. For example, everything can be built out of NAND gates. If I suddenly gave you a new gate that cannot be built out of NAND gates, then suddenly you have a new tool that might, on a case by case basis, give you the potential to improve algorithms. This is basically what a quantum computer does.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-08T07:37:29.850" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4656" PostTypeId="1" CreationDate="2018-11-08T07:47:52.543" Score="6" ViewCount="847" Body="&lt;p&gt;By my first impression, there are many-qubits computers out there and more to come, as to follow the press.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a closer look reveals that it's all about designing and building &lt;em&gt;physical&lt;/em&gt; qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, as it seems from further reading, you actually need quite many physical qubits (dozens or hundreds) to come close to a practically usable logical qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So does it mean after all, nobody has yet built any single &lt;em&gt;logical&lt;/em&gt; qubit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note. This question is meant to understand the state of the art as applyied to computing, not to blame it!&lt;/p&gt;&#xA;" OwnerUserId="5044" LastEditorUserId="26" LastEditDate="2018-12-23T12:48:36.040" LastActivityDate="2018-12-23T12:48:36.040" Title="Is there any single-logical-qubit physical device out there as of end 2018?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;technologies&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4657" PostTypeId="2" ParentId="4656" CreationDate="2018-11-08T08:53:25.323" Score="7" Body="&lt;p&gt;A logical qubit is a very fluid concept. You &lt;em&gt;could&lt;/em&gt; use physical qubits as logical qubits. Or, you can encode multiple physical qubits as a single logical qubit. The more physical qubits you use, the better the resistance to noise. So, I would suggest that you question isn't exactly the right one to ask, and a better question is whether something useful can be done with existing quantum technology (in the direction of computation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The long-term goal is to build quantum computers, which require logical operations to be performed with a suitable level of reliability (below the &quot;fault-tolerant threshold&quot;), that can be maintained for a long time. It's true that we're probably not quite there yet, even with a single logical qubit. I don't actually know how close current hardware is to achieving it. That doesn't mean that existing devices are entirely pointless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a lot of research going on at the moment into &quot;quantum supremacy&quot;, in other words, given the sort of noisy quantum devices of 50-100 qubits that are starting to appear, is there anything that we could do with them that is unequivocally better than anything we could do with a classical computer? The expectation is that we're somewhere around that threshold at the moment, but I'm not aware of anything that is definitive.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-08T08:53:25.323" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4658" PostTypeId="2" ParentId="4648" CreationDate="2018-11-08T18:28:57.560" Score="8" Body="&lt;p&gt;Getting enough capacitance and maintaining coherence essentially set the size limit. A superconducting qubit, for the purposes of answering this question, can be imagined as an oscillator consisting of an inductor and a capacitor. The frequency of the oscillator can't be too high otherwise controlling the qubit becomes difficult. At Google, we typically work with the frequency range 4-8 GHz. A wide range of microwave generation, manipulation, and analysis tools are available off-the-shelf for this range.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The capacitor is built in a simple manner to reduce noise. Essentially a plus-shaped cut in a piece of metal. The kinds of techniques used to achieve large capacitors in small sizes such as a pair of meshed combs or some kind of multi-layer metal-dielectric sandwich increase field strengths and therefore the strength of interaction with imperfections in the chip, increasing noise. To get a large capacitance with this simple design requires significant space. Indeed, our qubits are closer to 1 mm center to center.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's the answer to your question, but there's a premise in the set up of your question that big is bad. In my opinion, small is bad, and big is far more scalable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We drive our qubits with microwaves, these are typically delivered with coaxial cables of diameter currently of order 1/32nd of an inch. If you imagine a million qubit computer, at our scale this is about a square meter, and getting a few million lines in sounds very achievable. I'm not sure why you would want a quantum supercomputer to be smaller than this.&lt;/p&gt;&#xA;" OwnerUserId="5056" LastActivityDate="2018-11-08T18:28:57.560" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4659" PostTypeId="1" CreationDate="2018-11-08T18:51:27.320" Score="6" ViewCount="132" Body="&lt;p&gt;Given some set of basis states &lt;span class=&quot;math-container&quot;&gt;$\{\vert 0\rangle, \vert 1\rangle, \vert 2\rangle...\vert N\rangle\}$&lt;/span&gt; and an unknown superposition of the form &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(\vert i \rangle + \vert j \rangle)$&lt;/span&gt;, what exactly forbids us from computing &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;? I know about the no cloning theorem but why can I not see it from a single copy of the state?&lt;/p&gt;&#xA;" OwnerUserId="5057" LastActivityDate="2018-11-09T07:34:55.287" Title="Can one ever find the elements of a superposition state?" Tags="&lt;measurement&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4660" PostTypeId="2" ParentId="4659" CreationDate="2018-11-08T19:31:46.907" Score="5" Body="&lt;p&gt;Given only one copy of such a state, it is not possible to determine it with any good probability. Reason being there is no way, in principle, to extract information from the system without making a measurement on the system. And when we go for a measurement, we project it to a basis element &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; if we turn out to pick these by chance from the set &lt;span class=&quot;math-container&quot;&gt;$\{1,2,...,N\}$&lt;/span&gt;, in otherwise cases, we can never make out what is &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; from the given set of degrees of freedom. To answer a more general question, if we don't even know what the set &lt;span class=&quot;math-container&quot;&gt;$\{1,2,...,N\}$&lt;/span&gt; is; Suppose someone prepares a quantum state and gives to you without telling what kind of experimental apparatus may be the basis, there is no way in principle to figure out anything (if someone gives &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; isolated levels of a harmonic oscillator and you are looking for two states of polarization in it, for instance). Hence, in all literature, we assume that the type of the experimental apparatus is always known, which means that the basis &lt;span class=&quot;math-container&quot;&gt;$\{1,2,...,N\}$&lt;/span&gt; is known but a general state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\frac{1}{\sqrt{N}}\sum_i c_i |i\rangle$&lt;/span&gt; is unknown in this Basis, where we can evaluate the coefficients &lt;span class=&quot;math-container&quot;&gt;$c_i$&lt;/span&gt;s by repeated measurements. One such technique is the &lt;strong&gt;State Tomography&lt;/strong&gt;. Otherwise, the most ordinary and default way is to use the projectors &lt;span class=&quot;math-container&quot;&gt;$|i\rangle \langle i|$&lt;/span&gt; formed from the basis and see what we get as the final state after the measurement. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-08T19:31:46.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4661" PostTypeId="2" ParentId="4659" CreationDate="2018-11-08T19:52:08.577" Score="4" Body="&lt;p&gt;Denote &lt;span class=&quot;math-container&quot;&gt;$| \psi_{i,j} \rangle = \frac{1}{\sqrt{2}} ( | i \rangle + | j \rangle) $&lt;/span&gt; for fixed &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. Alice gives a randomly drawn one of this form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is for each &lt;span class=&quot;math-container&quot;&gt;$0 \leq i&amp;lt;j \leq N$&lt;/span&gt; she assigns a probability &lt;span class=&quot;math-container&quot;&gt;$p_{ij}$&lt;/span&gt; and sends the corresponding state &lt;span class=&quot;math-container&quot;&gt;$| \psi_{ij} \rangle$&lt;/span&gt; with that probability. When you say unknown of that form, I'll assume &lt;span class=&quot;math-container&quot;&gt;$p_{ij}=\frac{2}{N(N+1)}$&lt;/span&gt; uniformly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then Bob receives a &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_{0 \leq i &amp;lt; j \leq N} p_{ij} | \psi_{ij} \rangle \langle \psi_{ij} |$&lt;/span&gt;. Bob can do any transformation followed by measurement he wants to get a variable &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How much information about &lt;span class=&quot;math-container&quot;&gt;$p_{ij}$&lt;/span&gt; is contained therein? &lt;span class=&quot;math-container&quot;&gt;$\leq S(\rho)$&lt;/span&gt;. The second term is 0 in this case. I haven't calculated this entropy out though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's Theorem&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-11-08T19:52:08.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4662" PostTypeId="1" CreationDate="2018-11-09T06:13:17.877" Score="2" ViewCount="157" Body="&lt;p&gt;I read this &lt;a href=&quot;https://iitis.pl/~miszczak/files/papers/gawron04simulations.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;research&lt;/a&gt; paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have octave and the &lt;a href=&quot;https://github.com/ZKSI/quantum-octave&quot; rel=&quot;nofollow noreferrer&quot;&gt;package&lt;/a&gt; running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of what I did so far - &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;octave:3&gt; s1 = state(normalize(ket([1,0])+ket([0,1])))  &#xA;s1 =&#xA;&#xA;   0.00000   0.00000   0.00000   0.00000&#xA;   0.00000   0.50000   0.50000   0.00000&#xA;   0.00000   0.50000   0.50000   0.00000&#xA;   0.00000   0.00000   0.00000   0.00000&#xA;&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I see whether or not a state is entangled? Are there any examples using octave demonstrating entanglement?&lt;/p&gt;&#xA;" OwnerUserId="4489" LastEditorUserId="4489" LastEditDate="2018-11-12T10:41:45.147" LastActivityDate="2018-11-13T08:50:03.937" Title="Are there any test examples of Octave and Quantum Entanglement?" Tags="&lt;entanglement&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4663" PostTypeId="2" ParentId="4659" CreationDate="2018-11-09T06:24:29.793" Score="2" Body="&lt;p&gt;To determine the state, you’ll have to measure it. As you've said, the no-cloning theorem forbids us from making copies, so we just have to work with the single copy we're give. If we restrict to projective measurements, there are no more than &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; outcomes to the measurement. However, you want to distinguish &lt;span class=&quot;math-container&quot;&gt;$\binom{N+1}{2}$&lt;/span&gt; different outcomes. Hence, it’s not possible with just one copy of the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, one must mention the exception of &lt;span class=&quot;math-container&quot;&gt;$N=1$&lt;/span&gt; but that is a triviality because you already know what state it is! This still leaves the case of &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; not covered by my argument, which one should look at explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative approach is as follows: imagine you could determine from a single copy what the values of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; are. In that case, you could use that knowledge to produce as many copies as you like. In other words, you can perform quantum cloning. As you state in the question, this is impossible (except when all the states are orthogonal to each other, i.e. &lt;span class=&quot;math-container&quot;&gt;$N=1$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a fully rigorous answer, one strategy is to ask about how well one can distinguish &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|2\rangle)/\sqrt{2}$&lt;/span&gt;. If one is to complete the specified task, one must certainly be able to do this sub-task. However, the optimal measurement to distinguish these two states is known as the Helstrom measurement. See my previous answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4172/1837&quot;&gt;here&lt;/a&gt; for further details. Since the two states are not orthogonal, you derive that it is impossible to distinguish them perfectly.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-09T07:34:55.287" LastActivityDate="2018-11-09T07:34:55.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4664" PostTypeId="1" AcceptedAnswerId="4692" CreationDate="2018-11-09T10:55:09.557" Score="5" ViewCount="494" Body="&lt;p&gt;I have read the Wikipedia article which relates the polar decomposition to a complex number being split into its modulus and phase but this analogy isn't very intuitive to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Nielsen and Chuang, the polar decomposition is especially important in proving results around fidelity. If I have states &lt;span class=&quot;math-container&quot;&gt;$\rho \in H_{R}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma \in H_{Q}$&lt;/span&gt;, Uhlmann's theorem shows that the best purification that preserves fidelity &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma)$&lt;/span&gt; is some state in &lt;span class=&quot;math-container&quot;&gt;$R\otimes Q$&lt;/span&gt; and gives us a method to find it. Set state &lt;span class=&quot;math-container&quot;&gt;$ m = \sum_i\vert i_R\rangle\vert i_Q\rangle$&lt;/span&gt;. Now&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle = 1\otimes \sqrt{\rho}\vert m\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle = 1\otimes \sqrt{\sigma}V^{\dagger}\vert m\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;gives the purification that preserves fidelity. Here, the polar decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho}\sqrt{\sigma}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\sqrt{\rho}\sqrt{\sigma}|V$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I can follow the proof in Nielsen and Chuang, I have no intuition about what the polar decomposition is doing here and why this particular purification preserves fidelity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for intuition only, so proofs are unimportant. Could someone help with simple example states and how they transform under different purifications and why the polar decomposition-based purification works best?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2018-11-09T11:01:50.970" LastActivityDate="2019-11-08T12:47:34.867" Title="Intuitive role of the polar decomposition in proof of Uhlmann's theorem for fidelity" Tags="&lt;nielsen-and-chuang&gt;&lt;fidelity&gt;" AnswerCount="3" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4665" PostTypeId="1" CreationDate="2018-11-09T17:35:27.803" Score="3" ViewCount="248" Body="&lt;p&gt;This is a question that must be asked a lot but is it possible? And if in theory possible, what are the challenges to do it, and what are the drawbacks?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-11-10T21:46:23.143" Title="Can we do adiabatic quantum computing with a quantum circuit model and how?" Tags="&lt;circuit-construction&gt;&lt;adiabatic-model&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4666" PostTypeId="2" ParentId="4648" CreationDate="2018-11-09T17:49:45.957" Score="3" Body="&lt;p&gt;I wanted to add a comment on Austin Flowers but it says I need 50 point reputations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So essentially you need a low enough frequency in your superconducting circuit (4-8 GHz is Google's choice, to make use of established microwave spectroscopy tools). To get a low frequency, you need a high capacitance. To get a high capacitance, you need either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a large-size capacitor (1 mm from center to center at Google), or&lt;/li&gt;&#xA;&lt;li&gt;exotic technology such as a pair of meshed combs, but this will amplify decoherence.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So making smaller qubits is limited by (in some hierarchical way):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the lack of cheap tools for working in a higher frequency region (above 8 GHz)&lt;/li&gt;&#xA;&lt;li&gt;the inability to get to low enough frequencies without using larger capacitance (could this be mitigated by adjusting the properties of the inductor? I don't know)&lt;/li&gt;&#xA;&lt;li&gt;the inability to get large capacitance without making the capacitor large &lt;strong&gt;[or]&lt;/strong&gt; the inability to get large capacitance in small capacitors without increasing the noise.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A simple way to put it is that they are limited by decoherence/noise, but there's other ways to improve the design which might make it possible to make qubits smaller without increasing the noise too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have one final comment on the answer of Austin Fowler, which questions the validity of the original quesiton by saying that a few millions qubits can fit in a few square metres, so why do you want any smaller than that? That is an interesting point. In classical computing we keep thinking about wanting to make them smaller so that more gigs of RAM and more gigs of storage space can fit in our pocket or take up less space on the table, but quantum computers at present would only be &quot;supercomputers&quot; as Austin Fowler correctly pointed out. A few square meters isn't bad for a supercomputer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's not clear whether or not a few million qubits will be enough to do any useful, valuable, real-world computation, as Austin's series of Shor algorithm papers suggest (with error correction, which will definitely be needed to do anything useful, you will need billions of qubits). It is true that 100 qubits can't easily be simulated, in general, on a classical computer (people once said 25 qubits, then 30 qubits, then Haner &amp;amp; Steiger did 45 qubits with 500TB of RAM, then Sergio Boixo said 47 qubits in a 7x7 array, then IBM and Chinese groups simulated 60, then 70, on classical supercomputers, so let's just say 100 qubits for now). Simulating a fully controllable 100-qubit system will be interesting to study the physics of the system itself, and may provide insight into how to better engineer better quantum computers in the future, but &quot;simulating quantum computers&quot; is a very very tiny portion of what the world uses supercomputers for (and in this case one can argue that building quantum computers doesn't even help, since we're talking about simulating a quantum computer with a classical computer in the first place). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most real-world HPC problems: weather modeling, stock market prediction, image processing for satellite data, astrophysics, etc. are not going to be solved with a few million qubits physical qubits error correcting a thousand logical qubits. If we need a billion qubits to outperform a classical computer on a real-world problem (I think we might need even more), then your square meter becomes 1000 square meters which is 0.1 hectares. 10 billion qubits would take up all the grass within a 400m running track, and this is then going to be too much effort to control with microwaves, to maintain in decent condition, and to power. ORNL's Titan is 400 square meters. If the quantum computer is allowed to be 1000 square meters (for 1 billion qubits), then let's allow the classical computer to be that big. Then if 1 billion was big enough to beat Titan, maybe you'll need 2 billion to beat Titan's bigger brother. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully there will be a cross-over point at some point, but I agree both with Austin (that we reached the point where there's many more important things to think about than just the &lt;em&gt;size&lt;/em&gt; of the qubits) and with Nippons, who asked this question, because it does seem that we can use some size reduction for the qubits.&lt;/p&gt;&#xA;" OwnerDisplayName="user5062" LastActivityDate="2018-11-09T17:49:45.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4667" PostTypeId="2" ParentId="4665" CreationDate="2018-11-09T17:57:59.977" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405098&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adiabatic Quantum Computation is Equivalent to Standard&#xA;Quantum Computation.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper proved the other direction, that adiabatic can simulate circuit model. The direction you ask, which is whether or not circuit model can simulate adiabatic, was proven much earlier. In the paper I linked at the top there is the sentence &quot;It is known that adiabatic computation can be efficiently simulated by standard quantum computers [9, 13].&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of those papers [13], is basically where Adiabatic Quantum Computation was first introduced:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0104129&quot; rel=&quot;nofollow noreferrer&quot;&gt;E. Farhi, J. Goldstone, S. Gutmann, J. Lapan, A. Lundgre&#xA;n, and D. Preda, A quantum adiabatic evolution algorithm applied to random instances of a n NP-complete problem&lt;/a&gt;, Science&#xA;, 292(5516):472–476, 2001.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what that says is, that right from the beginning of Adiabatic model, people knew that circuit model could simulate it.&lt;/p&gt;&#xA;" OwnerDisplayName="user5062" LastEditorUserId="491" LastEditDate="2018-11-10T21:46:23.143" LastActivityDate="2018-11-10T21:46:23.143" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4668" PostTypeId="2" ParentId="4665" CreationDate="2018-11-10T06:09:53.303" Score="5" Body="&lt;p&gt;Adiabatic Quantum Computation is simply the time-evolution of a Hamiltonian where the system is prepared in a particular initial state (the ground state) and the Hamiltonian varies slowly in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulating a Hamiltonian on a quantum computer is a standard problem. Making that Hamiltonian time varying doesn’t really make it any worse since you break it down into lots of little steps to simulate it anyway, and the slow variation means that it’s not a bad approximation to assume that theHamiltonian is fixed in each of those little steps. Preparing the initial state is also not a problem. By design, it’s something that is easily prepared, such as the all zero state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The challenge, as with any simulation, is that there’s a polynomial overhead compared to the original scheme. While that doesn’t change computational complexity, it can have a massive impact on the practicality of implementation. What you gain, on the other hand, is the ability to use fault-tolerant techniques.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-10T06:09:53.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4669" PostTypeId="1" AcceptedAnswerId="4671" CreationDate="2018-11-10T06:50:21.533" Score="2" ViewCount="163" Body="&lt;p&gt;NB - notation from Octave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;ket([0]) &#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is the &lt;span class=&quot;math-container&quot;&gt;$(1,0)$&lt;/span&gt; in a &lt;span class=&quot;math-container&quot;&gt;$(x,y)$&lt;/span&gt; plane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try a ket with three numbers I get a column vector of dimension &lt;span class=&quot;math-container&quot;&gt;$(8,1)$&lt;/span&gt;. I assume that comes from &lt;span class=&quot;math-container&quot;&gt;$2^3=8$&lt;/span&gt; ie there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; states for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; variables in the ket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how is that understood in terms of a vector space? I have seen the algebra online but that has not really explained how the vector space can be envisioned. I am mainly trying to relate a column position to a physical characteristic or at least explain why that size would exist.   &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;octave:27&gt; ket([0,1])&#xA;ans =&#xA;&#xA;   0&#xA;   1&#xA;   0&#xA;   0&#xA;&#xA;octave:28&gt; ket([0,1,1])&#xA;ans =&#xA;&#xA;   0&#xA;   0&#xA;   0&#xA;   1&#xA;   0&#xA;   0&#xA;   0&#xA;   0&#xA;&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="4489" LastEditorUserId="26" LastEditDate="2018-11-10T10:19:43.200" LastActivityDate="2018-11-10T10:19:43.200" Title="Why do $n$ inputs to a ket give a vector of dimension $(2^n,1)$?" Tags="&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4670" PostTypeId="2" ParentId="4669" CreationDate="2018-11-10T09:31:08.367" Score="1" Body="&lt;p&gt;The classical bit has ha state either 0 or 1. A &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Qubit_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubit&lt;/a&gt; also has a state: it could be in state &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt; or in state &lt;span class=&quot;math-container&quot;&gt;$\lvert 1 \rangle$&lt;/span&gt; but it can also be in a linear combination of states, called superposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \psi \rangle = \alpha \lvert 0 \rangle + \beta \lvert 1 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta$&lt;/span&gt; are complex numbers. This means that the state of the qubit is a vector in a 2-dimensional complex vector space! The special states &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert 1 \rangle$&lt;/span&gt; are called computational basis state, and form an orthonormal basis for this vector space. Just to clarify:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Orthonormality&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthonormal&lt;/a&gt;: two vectors are said to be orthonormal when they both are unit vectors, and they are orthogonal (therefore, taking the dot product of these two vectors you obtain 0). This is precisely the case with &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle = \left[\begin{matrix} 1 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert 1 \rangle = \left[\begin{matrix} 0 &amp;amp; 1 \end{matrix}\right]^{T}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Basis_(linear_algebra)&quot; rel=&quot;nofollow noreferrer&quot;&gt;basis&lt;/a&gt;: a set of vectors in a vector space is called a &lt;em&gt;basis&lt;/em&gt; if every other vector of that particular vector space can be written as linear combination of the basis set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A two qubit system has &lt;span class=&quot;math-container&quot;&gt;$2^{2}=4$&lt;/span&gt; computational basis states: &lt;span class=&quot;math-container&quot;&gt;$\lvert 00 \rangle, \lvert 01 \rangle, \lvert 10 \rangle, \lvert 11 \rangle$&lt;/span&gt;. A pair of qubits can exist in superpositions (linear combination) of these four states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \psi \rangle = \alpha_{00} \lvert 00 \rangle + \alpha_{01} \lvert 01 \rangle + \alpha_{10} \lvert 10 \rangle + \alpha_{11} \lvert 11 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\lvert 00 \rangle = \left[\begin{matrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert 01 \rangle = \left[\begin{matrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert 10 \rangle = \left[\begin{matrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert 11 \rangle = \left[\begin{matrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{matrix}\right]^{T}$&lt;/span&gt;. You can easily wherify they are orthonormal! The notation &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 0 \rangle = \lvert 0 \rangle \otimes \lvert 0 \rangle$&lt;/span&gt;, where the symbol &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; indicates the &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor product&lt;/a&gt;. From wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The tensor product of (finite dimensional) vector spaces has dimension equal to the product of the dimensions of the two factors&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In our two qubit system, &lt;span class=&quot;math-container&quot;&gt;$\dim(\lvert 00 \rangle) = \dim(\lvert 0 \rangle) \cdot \dim(\lvert 0 \rangle) = 2 \cdot 2 = 4$&lt;/span&gt;, this means &lt;span class=&quot;math-container&quot;&gt;$\lvert 00 \rangle$&lt;/span&gt; is represented by a vector having 4 elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A thre qubit system has &lt;span class=&quot;math-container&quot;&gt;$2^{3}=8$&lt;/span&gt; computational basis states. Same arguments can be made about &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 0 0 \rangle = \lvert 0 \rangle \otimes \lvert 0 \rangle \otimes \lvert 0 \rangle$&lt;/span&gt;, where you can verify that &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 0 0 \rangle$&lt;/span&gt; is represented by a vector having 8 elements.&lt;/p&gt;&#xA;" OwnerUserId="4504" LastEditorUserId="4504" LastEditDate="2018-11-10T09:44:59.903" LastActivityDate="2018-11-10T09:44:59.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4671" PostTypeId="2" ParentId="4669" CreationDate="2018-11-10T09:44:05.383" Score="3" Body="&lt;p&gt;First, read my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/92/26&quot;&gt;previous answer&lt;/a&gt; on what the bra-ket notation means. Now proceed:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your post, &lt;code&gt;ket([0])&lt;/code&gt; stands for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;code&gt;ket([0,1])&lt;/code&gt; stands for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\otimes |1\rangle = |01\rangle$&lt;/span&gt; and &lt;code&gt;ket([0,1,1])&lt;/code&gt; stands for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\otimes |1\rangle \otimes |1\rangle = |011\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computational basis states of a single qubit are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computational basis states of a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system are &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Basically, take all &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-digit permutations of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. That is the first qubit can be in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and second can be in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; too; the first can be in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; while the second is in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and so on. So as you see, a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system resides in a &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-dimensional complex vector space &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^4$&lt;/span&gt; (as it has four basis states). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you might be confused because you think a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system can also exist in some state like &lt;span class=&quot;math-container&quot;&gt;$(a|0\rangle+b|1\rangle)\otimes (c|0\rangle + d|1\rangle)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d \in \Bbb C$&lt;/span&gt; . Sure, but even then you can express such a state as a linear combination of the elements of &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\}$&lt;/span&gt; i.e. the computational basis set. The size of the&#xA;basis set is what defines the dimension of the vector space, that is &quot;there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; states for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; variables in the ket&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The column vectors you speak of are just alternative representations of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Say you could consider &#xA;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\left[\begin{matrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\left[\begin{matrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\left[\begin{matrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{matrix}\right]^{T}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\left[\begin{matrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{matrix}\right]^{T}$&lt;/span&gt;. You're basically mapping the computational basis states of a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system to the standard basis of &lt;span class=&quot;math-container&quot;&gt;$\Bbb R^4$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now can you do a similar analysis for a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-qubit system?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-11-10T09:53:17.057" LastActivityDate="2018-11-10T09:53:17.057" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4672" PostTypeId="2" ParentId="4665" CreationDate="2018-11-10T09:47:01.427" Score="1" Body="&lt;p&gt;The first difficulty is to answer whether we can convert all conventional circuit gates into adiabatic ones (or simply geometric), this has been done theoretically and recently experimentally as well (ref: &lt;a href=&quot;https://arxiv.org/abs/1304.5186&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1304.5186&lt;/a&gt;). To answer the first question, yes, it is possible.&#xA;Since this correspondence is now true, we need to tackle the problems arising in the evolution of such gates. &#xA;The challenges and drawbacks could be: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Experimentally constructing such systems which can be easily controlled classically (because the driving parameter space in an adiabatic scenario is mostly a classical parameter such as an external magnetic field) and adiabatically. These are now quite possible and easily exploitable and most such systems are optical cavities which interact with spin systems inside. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The time complexity and speed. This is the biggest issue with adiabatic evolution, it is very slowly evolving. This is the biggest price to pay w.r.t other models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Advantage: &#xA;Very fault tolerant, the speed of the evolution and path doesn't really matter once a particular operation is targeted. Slower or faster don't matter in the adiabatic domain. For operations, even paths in the driving parameter space don't matter up-to a phase.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-10T09:47:01.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4673" PostTypeId="1" AcceptedAnswerId="4682" CreationDate="2018-11-10T10:53:36.730" Score="7" ViewCount="296" Body="&lt;p&gt;In superdense coding, you can use one qubit to control the Hilbert space of two qubits and steer it into 4 mutually orthogonal states, so that measurement of both qubits together will not have a probabilistic outcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the idea is cool. I want to understand a more general question that arises from this result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if I have 100 qubits (or N qubits, if you like), entangled by a neutral party, and 99 are sent to my friend and 1 is sent to me. How much control do I have over the composite quantum state? How many mutually orthogonal states can one steer the global state into?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your interest in this question. I can't seem to figure out who is right, so let's consider a slightly different question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a total of 5 qubits. I have 2, and my friend has 3. Clearly the upper bound of classical bits I can send to my friend is 5. But is it possible to find 5 unitary operations I can perform on my two qubits to steer the state into 5 orthogonal states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can answer that, then how does this generalize to N and M qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this comes closer to the real question I want to ask. &lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="26" LastEditDate="2018-11-15T23:54:50.283" LastActivityDate="2019-11-18T10:19:02.430" Title="Controlling high-dimensional Hilbert spaces with a single qubit" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;&lt;superdense-coding&gt;" AnswerCount="3" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4674" PostTypeId="2" ParentId="4673" CreationDate="2018-11-10T12:54:48.297" Score="0" Body="&lt;p&gt;The question, as to me, it seems that the person has tried to make the analogy of a bipartite entanglement distribution with a &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-partite distribution, which are entirely different cases. When explaining the effect of one entity in a system, entangled with more than one other constituent, various factors have to be taken into account, such as witnesses of entanglement which might (in their own sense), allow a measure of entanglememt to be distributed over multiparty. And mainly the &lt;strong&gt;Monogamous&lt;/strong&gt; nature of quantum entanglement (see &lt;strong&gt;CKW Inequality&lt;/strong&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer the question precisely, it has first to be defined to which class the composite entangled state belongs to. The multipartite entanglement can be addressed to this date, only for few specific states such as the &lt;strong&gt;GHZ states&lt;/strong&gt; or &lt;strong&gt;W-states&lt;/strong&gt; most broadly. A general framework is not yet known to answer this question. These two class of states saturate the CKW inequality in two extremes and hence can be formulated in a quantifiable manner in protocols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Especially for GHZ states, this question can be answered and it is definitely possible as is executed in various protocols of &lt;strong&gt;Multiparty Secret Sharing&lt;/strong&gt; where GHZ states are distributed and later on the members have to distinguish the resulting orthogonal states by appropriate projectors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;No mechanism, in general, is known for your query, but a particular class of states can make this possible. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-11-10T12:54:48.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4675" PostTypeId="2" ParentId="4673" CreationDate="2018-11-10T14:20:47.543" Score="6" Body="&lt;p&gt;Let me call you A and your friend B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You initially share a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. W.l.o.g., we can write this in its Schmidt decomposition:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \sum_{i=1}^d \lambda_i |i\rangle_A|i\rangle_B.&#xA;$$&lt;/span&gt;&#xA;You are now asking how many (orthogonal) states A can implement by acting with a unitary on their side of the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This number is upper bounded by the total number of basis states involved on &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;'s side, which is &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, times the dimension of the space of Alice, &lt;span class=&quot;math-container&quot;&gt;$d_A$&lt;/span&gt;. So one can prepare at most &lt;span class=&quot;math-container&quot;&gt;$d_Ad$&lt;/span&gt; states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, &lt;span class=&quot;math-container&quot;&gt;$d_A=d=2$&lt;/span&gt;, so you can prepare at most &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; orthogonal states.  This is exactly achieved if your state is maximally entangled (&lt;span class=&quot;math-container&quot;&gt;$\lambda_1=\lambda_2=1/\sqrt2$&lt;/span&gt;); this is dense coding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You can easily see that the same idea as in dense coding also applies if &lt;span class=&quot;math-container&quot;&gt;$d_A$&lt;/span&gt; is larger. Then, you can accordingly encode more states, but A also has to send a larger &lt;span class=&quot;math-container&quot;&gt;$d_A$&lt;/span&gt;-dimensional system -- the amount of saving in the information you send is always given by &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the bottomline is that the number of states you can steer the system to is always given by (i) the dimension of your system and (ii) the amount of entanglement, but entirely independent of the system size of B. &lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="55" LastEditDate="2019-11-18T10:19:02.430" LastActivityDate="2019-11-18T10:19:02.430" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4676" PostTypeId="1" AcceptedAnswerId="4678" CreationDate="2018-11-10T19:35:20.057" Score="1" ViewCount="432" Body="&lt;p&gt;How do I calculate the matrix representation of this part of a teleportation circuit? It must be a matrix of dimension 8.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mssSW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mssSW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="55" LastEditDate="2021-05-22T16:22:14.347" LastActivityDate="2021-05-22T16:22:14.347" Title="What's the matrix representation of this 3-qubit CZ circuit?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4677" PostTypeId="1" CreationDate="2018-11-10T20:54:48.007" Score="4" ViewCount="219" Body="&lt;p&gt;I am trying to formulate the calculation of conditional min-entropy as a semidefinite program. However, so far I have not been able to do so. Different sources formulate it differently. For example, in this highly influential &lt;a href=&quot;https://arxiv.org/abs/0807.1338&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, it has been formulated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\text{min}}(A|B)_\rho = - \underset{\sigma_B} {\text{inf}} \ D_{\infty}(\rho_{AB} \| id_A \otimes \sigma_B) &#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$$\rho_{AB} \in \mathcal{H_A \otimes H_B}, \sigma \in \mathcal{H_B}$$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D_{\infty}(\tau \| \tau') = \text{inf} \{\lambda \in &#xA;\mathbb{R}: \tau \leq 2^{\lambda} \tau' \}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I formulate it into a semidefinite program? It is possible as is mentioned in this &lt;a href=&quot;http://users.cms.caltech.edu/~vidick/teaching/120_qcrypto/LN_Week3.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possible SDP program is given in Watrous's &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/CS867.Winter2017/Notes/09.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{maximize}: &amp;lt;\rho, X&amp;gt;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{subject to}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr_X{X} == \mathcal{1}_Y$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X \in \text{Pos}(X \otimes Y)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I write it in &lt;a href=&quot;http://cvxr.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;CVX&lt;/a&gt; or any other optimization system? &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2021-05-06T12:41:54.637" LastActivityDate="2021-05-06T12:41:54.637" Title="How to calculate the conditional min-entropy via a semidefinite program?" Tags="&lt;information-theory&gt;&lt;entropy&gt;&lt;semidefinite-programming&gt;&lt;relative-entropy&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4678" PostTypeId="2" ParentId="4676" CreationDate="2018-11-10T20:59:39.490" Score="5" Body="&lt;p&gt;One way to do it is to build a sort of quantum IF statement. &#xA;You have in quantum computing projector operators telling you whether a qubit is 0 or 1:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P_0 = \begin{pmatrix} &#xA;1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0  &#xA;\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P_1 = \begin{pmatrix} &#xA;0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1  &#xA;\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we have the Z gate :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Z= \begin{pmatrix} &#xA;1 &amp;amp; 0 \\ &#xA;0 &amp;amp; -1  &#xA;\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To build the unitary for your controlled operation, we do :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CZ = P_0 \otimes I \otimes I + P_1 \otimes I \otimes Z $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$ \otimes $&lt;/span&gt; the tensor product.&#xA;That means, if your first qubit is in the &lt;span class=&quot;math-container&quot;&gt;$ |0\rangle $&lt;/span&gt; state, we apply the identity operation, otherwise we apply the Z operator only on the third qubit.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-11-10T20:59:39.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4679" PostTypeId="1" CreationDate="2018-11-11T09:14:51.817" Score="5" ViewCount="122" Body="&lt;p&gt;I know that if you have a circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that transforms &lt;span class=&quot;math-container&quot;&gt;$A → B$&lt;/span&gt;, it's possible to construct an inverse, &lt;span class=&quot;math-container&quot;&gt;${U\dagger}(B) → A$&lt;/span&gt;. Is it also possible to transform the states with &lt;span class=&quot;math-container&quot;&gt;$T_{i,o}$&lt;/span&gt; so that I can use the original circuit to do the reverse computation? Like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(T_o(B)) → T_i(A)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I know the Toffoli gate is its own inverse. So &lt;span class=&quot;math-container&quot;&gt;$T_{i,o}$&lt;/span&gt; can be the identity function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_{\operatorname{Tof}}(A) → B$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_{\operatorname{Tof}}(I(B)) → I(A)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if some reasonable &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; functions exists when &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a universal circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a quantum computing newbie and coming at this question more from a physics standpoint, so not sure quite sure how to ask this most clearly. Suggestions are appreciated. Links to related research would also be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; may differ for input and output states.&lt;/p&gt;&#xA;" OwnerUserId="5071" LastEditorUserId="5071" LastEditDate="2018-11-13T04:44:54.583" LastActivityDate="2018-11-13T04:44:54.583" Title="Reversible computation without inverting the circuit" Tags="&lt;circuit-construction&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4680" PostTypeId="5" CreationDate="2018-11-11T09:33:57.863" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-11-11T09:33:57.863" LastActivityDate="2018-11-11T09:33:57.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4681" PostTypeId="4" CreationDate="2018-11-11T09:33:57.863" Score="0" Body="The min-entropy, in information theory, is the smallest of the Rényi family of entropies, corresponding to the most conservative way of measuring the unpredictability of a set of outcomes, as the negative logarithm of the probability of the most likely outcome. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-11-11T09:33:57.863" LastActivityDate="2018-11-11T09:33:57.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4682" PostTypeId="2" ParentId="4673" CreationDate="2018-11-11T11:09:58.407" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;There are a total of 5 qubits. I have 2, and my friend has 3. Clearly&#xA;  the upper bound of classical bits I can send to my friend is 5. But is&#xA;  it possible to find 5 unitary operations I can perform on my two&#xA;  qubits to steer the state into 5 orthogonal states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can simply set up two standard superdense coding runs. So, this starts with each qubit of yours being maximally entangled with a qubit of your friend's. You do the typical things with each qubit, send them over, and your friend can extract 2 bits from each, giving a total of 4 bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You know that you cannot do better than this because of the idea of Schmidt coefficients. Whatever (pure) quantum state you and your friend hold, there is a unitary that your friend can apply that changes it into a pure state on just two of his/her qubits.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you can answer that, then how does this generalize to N and M&#xA;  qubits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In general, if you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, and your friend has &lt;span class=&quot;math-container&quot;&gt;$m&amp;gt;n$&lt;/span&gt; qubits, you can communicate &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; classical bits by sending the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to go up to different dimensions of spin, and on your side, you have a spin of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, and your friend has a spin of dimension &lt;span class=&quot;math-container&quot;&gt;$d'&amp;gt;d$&lt;/span&gt;, I believe you can always send &lt;span class=&quot;math-container&quot;&gt;$2\log_2(d)$&lt;/span&gt; classical bits. Again, you set up a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional maximally entangled state between the two spins, and you perform the correct unitary options. If memory serves, these are comprised of the power 0 to &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; of the two unitaries &lt;span class=&quot;math-container&quot;&gt;$\tilde X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde Z$&lt;/span&gt;. These are both &lt;span class=&quot;math-container&quot;&gt;$d^{th}$&lt;/span&gt; roots of the identity matrix, but in different bases. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tilde Z=\sum_{i=0}^{d-1}\omega^i|i\rangle\langle i|\qquad \tilde X=\sum_{i=0}^{d-2}|i\rangle\langle i+1|+|d-1\rangle\langle 0|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-11T11:09:58.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4683" PostTypeId="2" ParentId="4679" CreationDate="2018-11-11T14:32:34.980" Score="2" Body="&lt;p&gt;You might like to look up about quantum cellular automata. These are systems where you can repeatedly apply the same global unitary operation to generate the circuit that you want. The circuit is specified by the initial (product) state that is operated on. In that sense, you achieve the inverse using the same sequence of unitaries, just by changing the initial state in order to specify the inverse gate sequence. Thus, T will just be a sequence of bit flips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper might be helpful: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0502143&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0502143&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess that, overall, this only gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(T(B))=A,&#xA;$$&lt;/span&gt;&#xA;rather than &lt;span class=&quot;math-container&quot;&gt;$U(T(B))=T(A)$&lt;/span&gt;, as desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a special class of unitaries (aside from the obvious &lt;span class=&quot;math-container&quot;&gt;$U=U^\dagger$&lt;/span&gt;) that can be inverted in the right sort of way. Imagine that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is created by Hamiltonian evolution where the interactions are of the form &lt;span class=&quot;math-container&quot;&gt;$(XX+YY)$&lt;/span&gt; between pairs of qubits. Let us further restrict to the case where the interactions are bipartite in nature, meaning that there is a consistent two-colouring of qubits such that every pair of qubits that are interacting under such a Hamiltonian term have different colours. (A one-dimensional chain with nearest-neighbour interactions, for example.) In this case, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; can be a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on every qubit or one particular colour, because &lt;span class=&quot;math-container&quot;&gt;$Z_1e^{-i(XX+YY)t}Z_1=e^{i(XX+YY)t}$&lt;/span&gt;. I don't know if any Hamiltonians which are universal for quantum computation satisfy a property such as this (certainly, they can be nearest-neighbour in a 1D chain).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-12T13:21:36.293" LastActivityDate="2018-11-12T13:21:36.293" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4684" PostTypeId="1" AcceptedAnswerId="4690" CreationDate="2018-11-11T17:33:19.187" Score="9" ViewCount="328" Body="&lt;p&gt;We know how a quantum correlation setup can help us with a better probability of winning games like the CHSH. But what is the upper bound that physics can allow? Is it the quantum correlation setup? Or can we exceed them in general sense to get much stronger correlations? &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="10480" LastEditDate="2021-04-16T20:39:33.730" LastActivityDate="2021-04-16T20:39:33.730" Title="Are correlations stronger than those allowed by quantum mechanics possible?" Tags="&lt;non-locality&gt;&lt;games&gt;&lt;correlations&gt;&lt;foundations&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4685" PostTypeId="2" ParentId="4677" CreationDate="2018-11-11T17:51:05.917" Score="2" Body="&lt;p&gt;I think I have an answer. The following should be the CVX code for one of the formulations found in this &lt;a href=&quot;https://www.slideshare.net/wtyru1989/smooth-entropies-a-tutorial&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cvx_begin sdp&#xA;variable X(2, 2) hermitian&#xA;&#xA;minimize(trace(id' * X)) % id is eye(2)&#xA;subject to&#xA;&#xA;kron(id, X) &amp;gt;= rho_ab % the tensor product of two density matrices a, b&#xA;X &amp;gt;= 0&#xA;&#xA;cvx_end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The optimal value found in this program is &lt;span class=&quot;math-container&quot;&gt;$$\text{optval} = e^{-H_{\text{min}}(A|B)}.$$&lt;/span&gt; So simple calculation would solve for &lt;span class=&quot;math-container&quot;&gt;${H_{\text{min}}(A|B)}$&lt;/span&gt;. It turns out to be pretty simple at the end, given that the theoretical foundation leading up to this solution is not quite straightforward.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="9854" LastEditDate="2020-07-02T15:00:38.580" LastActivityDate="2020-07-02T15:00:38.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4687" PostTypeId="2" ParentId="4664" CreationDate="2018-11-12T09:50:20.030" Score="3" Body="&lt;p&gt;Purifications play an important role in the theory of density matrices (or more generally quantum states) because they provide a geometric tool in the explanation and  description algebraic relations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I'll be following here &lt;a href=&quot;https://www.researchgate.net/profile/Karol_Zyczkowski/publication/258239605_Geometry_of_Quantum_States/links/56a20af808ae24f627048c51.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bengtsson and Życzkowski's&lt;/a&gt;&#xA; reasoning in derivation of the fidelity formula (section 9.4)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A positive &lt;span class=&quot;math-container&quot;&gt;$ N \times N$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be (nonuniquely) written as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho =  A^{\dagger} A$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$N \times M$&lt;/span&gt; matrix.&#xA;The matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be viewed as a vector in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^N \otimes \mathbb{C}^M$&lt;/span&gt;, i.e. a purification. Of course, the purification is not unique and any matrix of the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A' = A U$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$M\times M$&lt;/span&gt; unitary matrix, is an equally good purification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in physics, distance functions between points in various spaces can be frequently obtained as the solutions of variational principles, or optimization problems. This is the method adopted by Bengtsson and Życzkowski to define the fidelity function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the multiplication by a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$A' = A U$&lt;/span&gt; doesn't change the matrix norm, the various purifications of a density matrix can be viewed as points on a sphere, given purifications of two density matrices: &lt;span class=&quot;math-container&quot;&gt;$\rho_1 =   A_1^{\dagger} A_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_2 =   A_2^{\dagger} A_2$&lt;/span&gt;, a reasonable distance function can be taken as the spherical geodesic distance between their purification vectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\cos d = \frac{1}{2} \operatorname{Tr}(A_1A_2^{\dagger} + A_2A_1^{\dagger})$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the angle between the two directions &lt;span class=&quot;math-container&quot;&gt;$A_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A_2$&lt;/span&gt;. Now, since the above formula depends on the purification, it is reasonable to define the distance between the density matrices (the fidelity) as the maximum distance as we run over all the purifications:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho_1, \rho_2) = \max_{U, V} \frac{1}{2} \operatorname{Tr}(A_1 U V^{\dagger} A_2^{\dagger} + A_2 V U^{\dagger} A_1^{\dagger})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution of the above optimization problem which depends only on the density matrices and not on the specific purifications(as explicitly done by Bengtsson and Życzkowski) is exactly the fidelity function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uhlmann extensively uses purifications in his work; one of the most important objects defined by him using purifications is the Uhlmann's phase which is the generalization of Berry's geometric phase for mixed states (and which has numerous applications in quantum computing). Please see the following &lt;a href=&quot;https://pdfs.semanticscholar.org/e3e2/f5679a270f9fb3a688c9e0a392f9986a0835.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;review &lt;/a&gt;of his.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="55" LastEditDate="2018-11-12T15:13:01.277" LastActivityDate="2018-11-12T15:13:01.277" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4688" PostTypeId="2" ParentId="4540" CreationDate="2018-11-12T14:51:15.450" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Did I get the basic idea of the attack correct? If wrong, ignore the rest of the post!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Mostly. The way you describe it, you will indeed get the state &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;, but you will &lt;em&gt;not&lt;/em&gt; be able to perform the unitary transformation &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt;. But in step 3, when you run Grover on state &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;, you actually need to apply &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt; as part of Grover's algorithm. The reason is the following: Usually, Grover is presented as an algorithm that searches a value &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; that satisfies a predicate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. In this case, Grover's algorithm first initializes the state to &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle:=\sum_{x\in\{0,1\}^n}2^{-n/2}\lvert x\rangle$&lt;/span&gt;. And, during its main loop, it applies the flip operator &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt;. That operator is quite easy to construct if &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle=\sum_{x\in\{0,1\}^n}2^{-n/2}\lvert x\rangle$&lt;/span&gt;, so it is normally not mentioned as a requirement of the algorithm. However, instead of searching &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;, you could search for &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; for some set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. (After all, there is nothing special about the bitstrings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.) Then you need to change the description of Grover: The initial state will be &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle=\sum_{x \in X}2^{-\lvert X\rvert/2}\lvert x\rangle$&lt;/span&gt;, and we need to apply &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt; during the main loop. For many sets &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (e.g., numbers modulo &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) it will be fairly easy to construct &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt;. However, in the general case, it might be that it is difficult to construct either of them. In your description of the algorithm, we have a similar situation. Namely, &lt;span class=&quot;math-container&quot;&gt;$X=\{x:H(x)=c\}$&lt;/span&gt; for some fixed &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. But for that set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, there is no way to construct &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt;. That's why your algorithm doesn't work (but it still gives the right idea). Instead, in the paper you cite, both &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt; are provided by special oracles constructed just for this purpose. Using those oracle, you can then run Grovers algorithm on the state &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How many elements are there in the superposition &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;&#xA;  after we commit to a certain &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This will depend on the parameters you chose. We expect roughly &lt;span class=&quot;math-container&quot;&gt;$M/N$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the size of the domain and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; the size of the range of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. For things to be interesting, you should choose &lt;span class=&quot;math-container&quot;&gt;$M\gg N$&lt;/span&gt; so that there will be exponentially many elements in the superposition (and at least &lt;span class=&quot;math-container&quot;&gt;$2^{\lvert m\rvert}$&lt;/span&gt; so that every message is possible). However, I assume the reason why you are wondering about this is because you think that the number of elements should be small for Grover to work, which is not the case, see below:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The speed of Grover search - this is the main problem and I'm not sure how their trick actually works. Wouldn't the computational complexity be the same as trying to guess a pre-image for a given output of the hash function since one has to search over all the u? In this case, where is the advantage? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here seems to lie a misconception. Remember my explanations about Grover's algorithm in the beginning of this answer. Grover searches some &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt;, satisfying some predicate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. In our case &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; can be huge (&lt;span class=&quot;math-container&quot;&gt;$M/N$&lt;/span&gt; elements) because it is the set of all preimages of &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. But that does not matter. Recall that the original Grover works on &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; which is also huge, but works fast as long as we are searching for some &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; that has some common property &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. For example, if we search using Grover for &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; that satisfies that &lt;span class=&quot;math-container&quot;&gt;$33\mid x$&lt;/span&gt; (the predicate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;), then we have that there are many &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;'s that satisfy &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, every 33. &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; satisfies it! And the runtime will be something like &lt;span class=&quot;math-container&quot;&gt;$\sqrt{33}$&lt;/span&gt;. So, as a general rule, if a predicate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is satisfied for every &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th element of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, then Grover's algorithm that searches for &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; that satisfies &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; takes about &lt;span class=&quot;math-container&quot;&gt;$\sqrt i$&lt;/span&gt; steps. Here it does not matter what set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is, or how big it is! (As long as we have a way to construct &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I-\lvert\phi\rangle\langle\phi\rvert$&lt;/span&gt; for this set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.) Now, in the setting you describe, &lt;span class=&quot;math-container&quot;&gt;$X=\{x:H(x)=c\}$&lt;/span&gt;. And &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the predicate saying that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; starts with &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt;. To analyze the runtime of Grover's algorithm in this case, we don't care about &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, but we do need to know how often an element satisfies &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. That is easy: Every &lt;span class=&quot;math-container&quot;&gt;$2^{\lvert m'\rvert}$&lt;/span&gt;-th element does. So the runtime of Grover will be &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{2^{\lvert m'\rvert}})$&lt;/span&gt;. This is a problem if &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt; is long, but if &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt; is, e.g., just a bit, then this works fine. For example, if we use the hash function to commit to one-bit messages, we can open the commitment to any value of &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want an example where &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt; is longer, then you need to vary the construction. Basically, you commit on every bit individually and concatenate the commitments. Then each commitment can be broken using the method described above, and you need to run the algorithm &lt;span class=&quot;math-container&quot;&gt;$\lvert m'\rvert$&lt;/span&gt; times.&lt;/p&gt;&#xA;" OwnerUserId="5058" LastActivityDate="2018-11-12T14:51:15.450" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4689" PostTypeId="2" ParentId="4664" CreationDate="2018-11-12T15:10:16.403" Score="3" Body="&lt;h2&gt;Short version&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Consider the two following observations:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, the problem of finding purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is equivalent to that of finding matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho=AA^\dagger$&lt;/span&gt;. The purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are then the vectorisations of these &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (i.e. a vector &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; is a purification of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; iff its matrix of coefficients &lt;span class=&quot;math-container&quot;&gt;$\Psi_{ij}$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$\Psi\Psi^\dagger=\rho$&lt;/span&gt;).&#xA;In this notation, the overlap between two purifications &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; is written as &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(A^\dagger B$&lt;/span&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We want to find the value of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}|\sqrt\rho\sqrt\sigma|$&lt;/span&gt;.&#xA;As shown in &lt;a href=&quot;https://math.stackexchange.com/a/3427050/173147&quot;&gt;this other answer&lt;/a&gt;, this is equivalent to finding the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; maximising &lt;span class=&quot;math-container&quot;&gt;$\lvert\operatorname{Tr}(U\sqrt\rho\sqrt\sigma)\rvert$&lt;/span&gt;, and the unitary achieving this maximum turns out to equal &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is the unitary in the polar decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sqrt\sigma$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Observation (2) above tells us why finding the fidelity reduces to a maximisation problem, and how the polar decomposition (or more generally, the singular values) enters into it, while observation (1) tells us why we can understand the terms in this maximisation as overlaps of purifications of the states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider then the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)=\operatorname{Tr}(U\sqrt\rho\sqrt\sigma)$&lt;/span&gt;, and define &lt;span class=&quot;math-container&quot;&gt;$A\equiv U\sqrt\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B=\sqrt\sigma$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)=\operatorname{Tr}(AB^\dagger)$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)$&lt;/span&gt; equals the overlap between the purification of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; corresponding to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and the purification of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; corresponding to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Detailed version&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The starting observation is that there are two &quot;natural&quot; ways to write down &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sqrt\sigma$&lt;/span&gt; (or any other product of two normal operators): using their spectral decompositions, and using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;singular value decomposition&lt;/a&gt; of their product:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt\rho\sqrt\sigma=\sum_{jk} \sqrt{\lambda_j\mu_k}\lvert\lambda_j\rangle\!\langle\lambda_j\rvert \mu_k\rangle\!\langle \mu_k\rvert&#xA;= \sum_m s_m \lvert s_m^L\rangle\!\langle s_m^R\rvert,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_j\lambda_j\lvert\lambda_j\rangle\!\langle\lambda_j\rvert$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma=\sum_k\mu_k\lvert\mu_k\rangle\!\langle\mu_k\rvert$&lt;/span&gt; are the spectral decompositions of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, and I denoted with &lt;span class=&quot;math-container&quot;&gt;$s_m$&lt;/span&gt; the singular values of &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sqrt\sigma$&lt;/span&gt;, and with &lt;span class=&quot;math-container&quot;&gt;$\lvert s_m^{L(R)}\rangle$&lt;/span&gt; the left (right) singular vectors of &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sqrt\sigma$&lt;/span&gt;.&#xA;Note that using these definitions, we have &#xA;&lt;span class=&quot;math-container&quot;&gt;$\lvert\sqrt\rho\sqrt\sigma\rvert=\sum_m s_m \lvert s_m^R\rangle\!\langle s_m^R\rvert$&lt;/span&gt; (if using the definition &lt;span class=&quot;math-container&quot;&gt;$\lvert A\rvert\equiv\sqrt{A^\dagger A}$&lt;/span&gt;, otherwise replace &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; if you want to define &lt;span class=&quot;math-container&quot;&gt;$\lvert A\rvert\equiv\sqrt{AA^\dagger}$&lt;/span&gt;),&#xA;and thus &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}\lvert\sqrt\rho\sqrt\sigma\rvert=\sum_m s_m$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now denote with &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_\rho\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_\sigma\rangle$&lt;/span&gt; a pair of purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. These can be written in general as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert\psi_\rho\rangle=\sum_k \sqrt{\lambda_k}\lvert\lambda_k\rangle\otimes\lvert u_k\rangle, \\&#xA;\lvert\psi_\sigma\rangle=\sum_k \sqrt{\mu_k}\lvert\mu_k\rangle\otimes\lvert v_k\rangle,&#xA;$$&lt;/span&gt;&#xA;for arbitrary orthonormal bases &lt;span class=&quot;math-container&quot;&gt;$\{u_k\}_k, \{v_k\}_k$&lt;/span&gt;. We can then write their overlap as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle\psi_\rho\rvert\psi_\sigma\rangle = \sum_{jk}\sqrt{\lambda_j\mu_k}&#xA;\langle\lambda_j\rvert\mu_k\rangle\langle u_k\rvert v_k\rangle =&#xA;\sum_{jk}\langle\lambda_j\rvert\sqrt\rho\sqrt\sigma\lvert\mu_k\rangle \langle u_j\rvert v_k\rangle,&#xA;$$&lt;/span&gt;&#xA;where I exploited the fact that &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\lvert\lambda_j\rangle=\sqrt{\lambda_j}\lvert\lambda_j\rangle$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sqrt\sigma\lvert\mu_k\rangle=\sqrt{\mu_k}\lvert\mu_k\rangle$&lt;/span&gt;.&#xA;Using the singular value decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sqrt\sigma$&lt;/span&gt; we thus get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\langle\psi_\rho\rvert\psi_\sigma\rangle &amp;amp;= \sum_{jkm}&#xA;s_m \langle\lambda_j\rvert s_m^L\rangle\!\langle s_m^R\rvert\mu_k\rangle \langle u_j\rvert v_k\rangle \\&#xA;&amp;amp;= \sum_m s_m \langle s_m^R\rvert&#xA;  \Bigg(\underbrace{\sum_k \lvert \mu_k\rangle\!\langle \bar{v}_k\rvert }_{U_1}\Bigg)&#xA;  \Bigg(\underbrace{\sum_j \lvert\bar{u}_j\rangle\!\langle \lambda_j\rvert}_{U_2}\Bigg)&#xA;  \lvert s_m^L\rangle,&#xA;\end{align}&lt;/span&gt;&#xA;where I denoted with &lt;span class=&quot;math-container&quot;&gt;$\lvert \bar{u}_j\rangle$&lt;/span&gt; the complex conjugate vector of &lt;span class=&quot;math-container&quot;&gt;$\lvert u_j\rangle$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$\langle u_j\rvert v_k\rangle=\langle \bar{v}_k\rvert \bar{u}_j\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uhlmann's theorem is almost straightforward from this.&#xA;The triangle inequality gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi_\rho\rvert\psi_\sigma\rangle\rvert\le \sum_m s_m$&lt;/span&gt; because matrix elements of unitary matrices are always less than &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in modulus, and the inequality is saturated when&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_1 U_2=\sum_m \lvert s_m^R\rangle\!\langle s_m^L\rvert\equiv \mathcal U_{PD}^\dagger$&lt;/span&gt;.&#xA;In terms of the purification vectors &lt;span class=&quot;math-container&quot;&gt;$\lvert u_j\rangle,\lvert v_k\rangle$&lt;/span&gt;, this happens when&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle u_j\rvert v_k\rangle = \langle \mu_k \rvert \Bigg(\sum_m \lvert s_m^R\rangle \!\langle s_m^L\rvert \Bigg) \lvert \lambda_j\rangle&#xA;= \langle \mu_k\rvert \mathcal U_{PD}^\dagger\rvert \lambda_j\rangle.$$&lt;/span&gt;&#xA;Note that here &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_{PD}$&lt;/span&gt; is the unitary matrix that you get out of the polar decomposition, that is, the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; in your post.&#xA;We can thus conclude that the purifications that saturate the inequality are those of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\lvert u_j\rangle = V\lvert\bar{\lambda}_j\rangle, \qquad&#xA;\lvert v_k\rangle = V\mathcal U_{PD}^*\lvert\bar{\mu}_k\rangle,&#xA;\end{align}&lt;/span&gt;&#xA;or, equivalently,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\lvert u_j\rangle = V\lvert j\rangle, \qquad&#xA;\lvert v_k\rangle = V\lvert j\rangle \langle \mu_k\rvert\mathcal U_{PD}^\dagger\lvert\lambda_j\rangle,&#xA;\end{align}&lt;/span&gt;&#xA;for any unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in conclusion, what does this tell us? That the vectors &lt;span class=&quot;math-container&quot;&gt;$\lvert u_j\rangle,\lvert v_k\rangle$&lt;/span&gt; that make the purifications the most aligned are determined by the overlap between the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, and the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; rotated through unitary that maps the right singular vectors of &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sqrt\sigma$&lt;/span&gt; into the left ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this the case? I have no idea, mostly because I don't know of any easy way to relate the SVD of a product of two operators with their eigenvectors.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-08T12:47:34.867" LastActivityDate="2019-11-08T12:47:34.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4690" PostTypeId="2" ParentId="4684" CreationDate="2018-11-12T16:51:36.803" Score="7" Body="&lt;p&gt;Yes, it is possible to conceive theories with &quot;stronger correlations&quot; than those given by quantum mechanics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to make this statement precise is to consider some kind of &quot;measurement apparatus&quot; (you can think of it as simply a black a box with some buttons that you can push and different LEDs that correspond to different possible outputs), and analyse the set of correlations between inputs and outputs that different physical theories allow for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you have two possible inputs and two possible outputs than the set of possible theories, often referred to as &lt;em&gt;behaviours&lt;/em&gt; in this context, is the set of probabilities &lt;span class=&quot;math-container&quot;&gt;$\{p(a|x)\}_{x,a\in\{0,1\}}$&lt;/span&gt;. This is the set of vectors &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol p$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$[0,1]^{2^2}\subset\mathbb R^{2^2}$&lt;/span&gt; normalised to one. In other words, it's a section of the &lt;span class=&quot;math-container&quot;&gt;$2^2$&lt;/span&gt;-dimensional hyperplane.&#xA;More generally, in this context, it is common to consider a Bell-like scenario in which two parties are involved and each has its own box. Then, if each party can choose between &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; possible inputs and can get &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; possible outputs, the set of possible behaviours is a hyperplane &lt;span class=&quot;math-container&quot;&gt;$\mathcal P\subset\mathbb R^{\Delta^2 m^2}$&lt;/span&gt;, which therefore has dimension &lt;span class=&quot;math-container&quot;&gt;$(\Delta^2-1)m^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The behaviours allowed by quantum mechanics are a strict subset of &lt;span class=&quot;math-container&quot;&gt;$\mathcal P$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can consider different restrictions imposed on a physical theory and study the corresponding set of possible behaviours. A first natural assumption is to require a theory to be &lt;em&gt;no-signalling&lt;/em&gt;, which means that it doesn't allow for faster-than-light communication. The set  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{NS}$&lt;/span&gt; of no-signalling behaviours is strictly larger than the set &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q$&lt;/span&gt; of quantum behaviours. &#xA;In the context of CHSH inequalities, the boundary between &lt;span class=&quot;math-container&quot;&gt;$\mathcal{NS}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q$&lt;/span&gt; would be observable via &lt;a href=&quot;https://en.wikipedia.org/wiki/Tsirelson%27s_bound&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tsirelson's bound&lt;/a&gt;, which tells us that quantum mechanics cannot produce correlations such that &lt;span class=&quot;math-container&quot;&gt;$S&amp;gt;2\sqrt 2$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the usual operator defined for CHSH inequalities). Similarly, the boundary between &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q$&lt;/span&gt; and the set &lt;span class=&quot;math-container&quot;&gt;$\mathcal L$&lt;/span&gt; of &lt;em&gt;local&lt;/em&gt; (classical) behaviours can be witnessed via the standard Bell's inequalities.&#xA;See the following picture representing the relations between these different sets (taken from &lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;nofollow noreferrer&quot;&gt;Brunner et al.&lt;/a&gt;, pag. 7):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xqeZ0.png&quot; width=&quot;300&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have a look at Brunner et al.'s review (&lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;nofollow noreferrer&quot;&gt;1303.2849&lt;/a&gt;) for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want to assume anything about a theory, then no, there are no restrictions at all. Any correlation between present and future is in principle possible.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2018-11-13T09:54:41.033" LastActivityDate="2018-11-13T09:54:41.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4691" PostTypeId="2" ParentId="4679" CreationDate="2018-11-12T19:18:48.663" Score="3" Body="&lt;p&gt;This paper gives a fairly complete answer to the question &quot;given oracle access to U, implement the inverse of U&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1810.06944&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1810.06944&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They give a protocol which implements U inverse with a number of queries that's linear in the dimension of U and show that this is essentially optimal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems to be fairly closely related to your question. I think that you could transform a good protocol for your problem into a good protocol for their problem, which means that the lower bound in their paper would carry over to your setting. I'm not sure, though.&lt;/p&gt;&#xA;" OwnerUserId="483" LastActivityDate="2018-11-12T19:18:48.663" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4692" PostTypeId="2" ParentId="4664" CreationDate="2018-11-12T20:10:47.147" Score="4" Body="&lt;p&gt;(I will give the argument with formulas for now, hopefully I find time for some pictures later.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|m\rangle$&lt;/span&gt; be the (unnormalized) maximally entangled state.  Then, a purification of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\rho\rangle_{AB}=(\sqrt{\rho}_A\otimes1\!\!1_B)|m\rangle\ ,&#xA;$$&lt;/span&gt;&#xA;and correspondingly for &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; -- this can be seen most easily by first tracing the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; system from &lt;span class=&quot;math-container&quot;&gt;$|m\rangle$&lt;/span&gt;, which gives &lt;span class=&quot;math-container&quot;&gt;$1\!\!1$&lt;/span&gt;, which implies that the partial trace of &lt;span class=&quot;math-container&quot;&gt;$|\rho\rangle_{AB}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho}1\!\!1\sqrt{\rho}=\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now there is a unitary degree of freedom in the purification -- &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can apply any unitary and it is the same purification (as &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is being traced anyway).  Let's use it for the purification of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\sigma\rangle = (\sqrt{\sigma}\otimes U)|m\rangle\ .&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what is the overlap of the two states?  It is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\rho|\sigma\rangle = \langle m| \sqrt{\rho}\sqrt{\sigma}\otimes U|m\rangle\ .$$&lt;/span&gt;&#xA;It is not straightforward to work out that this equals &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\rho|\sigma\rangle = \mathrm{tr}[\sqrt{\rho}\sqrt{\sigma}U^T]\ .$$&lt;/span&gt;&#xA;Now we want this quantity to be maximal.  When is it maximal? It is maximal if &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho}\sqrt{\sigma}U^T = |\sqrt{\rho}\sqrt{\sigma}|$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$\bar U$&lt;/span&gt; is given by the polar decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho}\sqrt{\sigma}$&lt;/span&gt;.  (Here -- and in the question -- &lt;span class=&quot;math-container&quot;&gt;$|X|$&lt;/span&gt; denotes the positive part of the polar decomposition of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, which is &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X^\dagger X}$&lt;/span&gt;, &lt;em&gt;different&lt;/em&gt; from the absolute value function defined on the eigenvalues.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The last statement holds since &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{tr}[XU]|\le \|X\|_1\|U\|_\infty = \|X\|_1$&lt;/span&gt; -- this is Hölder's inequality -- where &lt;span class=&quot;math-container&quot;&gt;$\|X\|_1=\mathrm{tr}|X|$&lt;/span&gt; is the sum of the singular values.  Alternatively (following @glS) one can use the SVD of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X=\sum \sigma_i|s_i\rangle\langle q_i|$&lt;/span&gt;: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\mathrm{tr}[XU]|=|\sum \sigma_i\langle q_i|U|s_i\rangle| \le &#xA;\sum \sigma_i|\langle q_i|U|s_i\rangle| \le \sum \sigma_i\ ,&#xA;$$&lt;/span&gt;&#xA;where we have used that&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\langle q_i|U|s_i\rangle|\le1$&lt;/span&gt;,&#xA;since &lt;span class=&quot;math-container&quot;&gt;$||q_i\rangle|=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|U|s_i\rangle|=||s_i\rangle|=1$&lt;/span&gt;.) &lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-11-13T09:07:37.163" LastActivityDate="2018-11-13T09:07:37.163" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="4693" PostTypeId="1" AcceptedAnswerId="4695" CreationDate="2018-11-13T03:26:03.243" Score="3" ViewCount="1209" Body="&lt;p&gt;It is my understanding that light, and its polarization, is used to transfer information in quantum computers, but how can the information encoded in say, an electron also be stored in light? I understand that the spin of an electron or other particle is often used to create the qubit, where its &quot;value&quot; can be any point on the sphere below between zero and one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, how is the polarization of a photon able to have that kind of variety of possible values? Is there something I'm missing? Is there a quantized version/explanation of polarizations that I simply haven't seen that allows for the same range of information storage and extraction?  &lt;a href=&quot;https://i.stack.imgur.com/iTevd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iTevd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5032" LastEditorUserId="1837" LastEditDate="2018-11-13T07:51:19.227" LastActivityDate="2018-11-13T08:37:36.200" Title="Polarization and qubit information" Tags="&lt;physical-qubit&gt;&lt;quantum-information&gt;&lt;photonics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4694" PostTypeId="2" ParentId="4693" CreationDate="2018-11-13T07:34:26.003" Score="4" Body="&lt;p&gt;In quantum theory, the pure states are associated with the unit vectors of the Hilbert space. A pure state of a quantum bit can be represented as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$| \psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle$$&lt;/span&gt; &#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;. The basis &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt; can be viewed as two orthogonal polarization directions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bloch sphere is a geometric representation of qubits which makes the mathamatics of a qubit more intuitive. To see this, we may rewrite the equation as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$| \psi \rangle = e^{i \gamma} ( &#xA;\cos \frac \theta 2 | 0 \rangle + e^{i\phi} \sin \frac \theta 2 | 1 \rangle )$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since global phase has no observable effects, we can ignore the factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\gamma}$&lt;/span&gt;. It follows that a pure qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$| \psi \rangle = \cos \frac \theta 2 | 0 \rangle + e^{i\phi } \sin \frac \theta 2 | 1 \rangle$$&lt;/span&gt;&#xA;1-to-1 correponds to a point on the Bloch sphere whose sphere coordinate is exactly &lt;span class=&quot;math-container&quot;&gt;$(\theta, \phi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, a state can be probability mixture of pure states, which leads to the notion of density operators. A density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is positive and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\rho) = 1$&lt;/span&gt;. In a qubit system, a density operator can be decomposed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac 1 2 (I+r_1\sigma_1+r_2\sigma_2+r_3\sigma_3) $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$r_1,r_2,r_3 \in \mathbb R$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$r_1^2 + r_2^2 + r_3^2 \leq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; are Pauli matrices&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_0 = I = \begin{bmatrix}&#xA;                1 &amp;amp; 0 \\&#xA;                0 &amp;amp; 1&#xA;            \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_1 = \sigma_x = \begin{bmatrix}&#xA;                0 &amp;amp; 1 \\&#xA;                1 &amp;amp; 0&#xA;            \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_2 = \sigma_y = \begin{bmatrix}&#xA;                0 &amp;amp; -i \\&#xA;                i &amp;amp; 0&#xA;            \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_3 = \sigma_z = \begin{bmatrix}&#xA;                1 &amp;amp; 0 \\&#xA;                0 &amp;amp; -1&#xA;            \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This indicates that the whole Bloch ball can be associated with states. In particular, the states on the sphere is pure and those inside the sphere is mixed.&lt;/p&gt;&#xA;" OwnerUserId="4891" LastEditorUserId="4891" LastEditDate="2018-11-13T08:37:36.200" LastActivityDate="2018-11-13T08:37:36.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4695" PostTypeId="2" ParentId="4693" CreationDate="2018-11-13T07:50:59.217" Score="4" Body="&lt;p&gt;Firstly, that sphere that you've pictured is convenient for thinking about what's going on, but remember that it is not what is actually happening. So the fact that you don't visualise light as having a little arrow pointing somewhere doesn't matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact of that matter is that for an electron spin, having the two possible states &quot;up&quot; and &quot;down&quot;, we associate two distinguishable states, which we label as perhaps &lt;span class=&quot;math-container&quot;&gt;$|up\rangle,|down\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt;. Since quantum mechanics is a linear theory, and linear superposition of the two is allowed, &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for a photon, there are two distinguishable states of polarisations, horizontal and vertical. You can label these as &lt;span class=&quot;math-container&quot;&gt;$|H\rangle,|V\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt;. The labels really are arbitrary. But again, because quantum mechanics is linear, you can have a linear superposition of these, &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, and you can capture the same information as you can with the state of an electron.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Bloch Sphere, particular points are often highlighted, such as &lt;span class=&quot;math-container&quot;&gt;$0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+i|1\rangle)/\sqrt{2}$&lt;/span&gt;. If we've decided that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the same as a horizontally polarised photon, then &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is the same as a photon polarised at &lt;span class=&quot;math-container&quot;&gt;$45^{\circ}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+i|1\rangle)/\sqrt{2}$&lt;/span&gt; is the same as a circularly polarised photon.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-13T07:50:59.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4696" PostTypeId="2" ParentId="4209" CreationDate="2018-11-13T08:22:36.753" Score="3" Body="&lt;p&gt;The kinds of people that use these devices are affiliated with companies, quantum startups, or the IBMQ Hubs (in Oxford, Keio, Melbourne, ... ). The process is more involved than a simple web sign-up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are a company and want to get the process started, you can use &lt;a href=&quot;https://www.research.ibm.com/ibm-q/network/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this web form&lt;/a&gt;, or try to ping someone important on the &lt;a href=&quot;https://join.slack.com/t/qiskit/shared_invite/enQtNDc2NjUzMjE4Mzc0LTMwZmE0YTM4ZThiNGJmODkzN2Y2NTNlMDIwYWNjYzA2ZmM1YTRlZGQ3OGM0NjcwMjZkZGE0MTA4MGQ1ZTVmYzk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Slack&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are neither a company nor an academic at one of the hubs, then I'm afraid there is no scope for access to these devices. But there are, of course, the many publicly available devices that are just as awesome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I work for IBM&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-11-13T08:22:36.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4697" PostTypeId="2" ParentId="4662" CreationDate="2018-11-13T08:50:03.937" Score="1" Body="&lt;p&gt;There are a few tests of whether a two qubit state is entangled. One is to perform the so-called 'partial transpose', which can be done with the &lt;code&gt;partialtranspose&lt;/code&gt; function in quantum-octave. If the resulting matrix has any negative eigenvalues, you know that your original state was entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another test works only when your two qubit state is &lt;em&gt;pure&lt;/em&gt; (note: a state can be said to be either &lt;em&gt;pure&lt;/em&gt; or &lt;em&gt;mixed&lt;/em&gt;, depending on whether it has only a single non-zero eigenvalue, or multiple non-zero eigenvalues). To test this you can look at the eigenvalues. Or you can calculate the Von Neumann entropy with &lt;code&gt;vnentropy&lt;/code&gt;. This returns a value of zero only for pure states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have a pure state of two qubits and want to test for entanglement, your next step is to perform a partial trace using &lt;code&gt;ptrace&lt;/code&gt;. This will give a description of the state of just one of your qubits. If this state is also pure, your overall two qubit state is not entangled. But if it is mixed, it is entangled. To determine which is true, you can again use &lt;code&gt;vnentropy&lt;/code&gt;. The result of this can be regarded as a measure of how entangled the state is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another measure of entanglement, and one that works even when your overall state is the concurrence. This can be calculated in quantum-octave with &lt;code&gt;concurrence&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also a bunch of other ways. As you learn about entanglement you will learn many concepts, and then you'll find that many of those have an implementation in quantum-octave.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-11-13T08:50:03.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4698" PostTypeId="1" CreationDate="2018-11-13T09:49:46.780" Score="5" ViewCount="143" Body="&lt;p&gt;To date, what is the longest quantum computation ever performed? Length is measured in number of operations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT ---&#xA;I'm looking for a quantum computation with a clear ending and a clear output. Something like a quantum computation that solves a set of linear equations would count. But I consider a benchmarking experiment that measures the lifetime of the quantum information 'long' because it can be arbitrarily long and give the same output as a similar experiment which is much shorter.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1867" LastEditDate="2018-11-15T12:29:05.080" LastActivityDate="2018-11-15T12:29:05.080" Title="What is the longest quantum circuit?" Tags="&lt;algorithm&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4699" PostTypeId="1" CreationDate="2018-11-13T10:05:23.127" Score="20" ViewCount="4010" Body="&lt;p&gt;The Bloch sphere is a nice visualization of single qubit states. Mathematically, it can be generalized to any number of qubits by means of a high-dimensional hypersphere. But such things are not easy to visualize.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What attempts have been made to extend visualizations based on the Bloch sphere to two qubits?&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="55" LastEditDate="2019-06-04T22:54:01.827" LastActivityDate="2019-06-04T22:54:01.827" Title="Can the Bloch sphere be generalized to two qubits?" Tags="&lt;resource-request&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4700" PostTypeId="2" ParentId="4699" CreationDate="2018-11-13T10:44:45.623" Score="2" Body="&lt;p&gt;A paper has been published on the subject, called &quot;Bloch sphere model for two-qubit pure states&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1403.8069&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1403.8069&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4160" LastEditorUserId="26" LastEditDate="2018-11-13T13:06:05.280" LastActivityDate="2018-11-13T13:06:05.280" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4701" PostTypeId="2" ParentId="4699" CreationDate="2018-11-13T10:51:56.147" Score="5" Body="&lt;p&gt;For more than 1-qubit visualization, we will need more complex visualizations than a Bloch sphere. The below answer from Physics Stack Exchange explains this concept quite authoritatively:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/346506/bloch-sphere-for-2-and-more-qubits&quot;&gt;Bloch sphere for 2 and more qubits&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In another article, the two qubit representation is described as a seven-dimensional sphere, S 7, which also allows for a Hopf fibration, with S 3 fibres and a S 4 base. The most striking result is that suitably oriented S 7 Hopf fibrations are entanglement sensitive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/0305-4470/34/47/324/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Geometry of entangled states, Bloch spheres and Hopf fibrations&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said that, a Bloch sphere based approach is quite useful even to model the behavior of qubits in a noisy environment. There has been analysis of the two-qubit system by use of the generalized Bloch vector to generate tractable analytic equations for the dynamics of the four-level Bloch vectors. This is based on the application of geometrical concepts from the well-known two-level Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can find that in the presence of correlated or anti-correlated noise, the rate of decoherence is very sensitive to the initial two-qubit state, as well as to the symmetry of the Hamiltonian. In the absence of symmetry in the Hamiltonian, correlations only weakly impact the decoherence rate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;a href=&quot;http://iopscience.iop.org/article/10.1088/1751-8113/45/45/455302&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch-sphere approach to correlated noise in coupled qubits&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is another interesting research article on the representation of the two-qubit pure state parameterized by three unit 2-spheres and a phase factor.For separable states, two of the three unit spheres are the Bloch spheres of each qubit with coordinates (A,A) and (B,B). The third sphere parameterises the degree and phase of concurrence, an entanglement measure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sphere may be considered a ‘variable’ complex imaginary unit t where the stereographic projection maps the qubit-A Bloch sphere to a complex plane with this variable imaginary unit. This Bloch sphere model gives a consistent description of the two-qubit pure states for both separable and entangled states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per this hypothesis, the third sphere (entanglement sphere) parameterizes the nonlocal properties, entanglement and a nonlocal relative phase, while the local relative phases are parameterized by the azimuthal angles, A and B, of the two quasi-Bloch spheres. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1403/1403.8069.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere model for two&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="734" LastEditDate="2018-11-14T07:44:20.953" LastActivityDate="2018-11-14T07:44:20.953" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4702" PostTypeId="2" ParentId="4699" CreationDate="2018-11-13T12:42:40.590" Score="9" Body="&lt;p&gt;Since a spin &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; irreducible representation of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; has a dimension &lt;span class=&quot;math-container&quot;&gt;$2j+1$&lt;/span&gt;  (&lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is half integer), any finite dimensional Hilbert space can be obtained as a representation space of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;. Moreover, since all irreducible representations of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; are symmetric tensor products of the fundamental spinor representation, therefore every finite dimensional Hilbert space can be thought of as a symmetric tensor product of fundamental &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; fundamental representation spaces. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the basis of the Majorana stellar representation construction. A state of a qudit living in a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2j+1$&lt;/span&gt; can be represented by &lt;span class=&quot;math-container&quot;&gt;$2j$&lt;/span&gt; points on the Bloch sphere. The state vector can be reconstructed from the &lt;span class=&quot;math-container&quot;&gt;$2j$&lt;/span&gt; (2-dimensional) spin vectors of the &lt;span class=&quot;math-container&quot;&gt;$2j$&lt;/span&gt; points by a symmetrized tensor product. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a state vector in a &lt;span class=&quot;math-container&quot;&gt;$2j+1$&lt;/span&gt; dimensional Hilbert space (Please see &lt;a href=&quot;https://pdfs.semanticscholar.org/942e/c57dd2910f1d1c23cca37b371b8241b30cc7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Liu, Fu and Wang&lt;/a&gt;, section 2.1)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_{m=-j}^{j} C_m |j, m\rangle, $$&lt;/span&gt;&#xA;The locations of the corresponding points (the Majorana stars) on the Bloch sphere are given by the roots of the equation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{k=0}^{2j} \frac{(-1)^k C_{j-k}}{(2j-k)! k!} z^{2j-k}=0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The parametrization is by means of the stereographic projection coordinate &lt;span class=&quot;math-container&quot;&gt;$ z = \tan \theta e^{i\phi}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; are the spherical coordinates))&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One application of this representation to quantum computation, is in the visualization of the trajectories giving rise to geometric phases, which serve as the gates in holonomic quantum computation. These trajectories are reflected as trajectories of the Majorana stars on the Bloch spheres and the geometric phases can be computed from the solid angles enclosed by these trajectories. Please see &lt;a href=&quot;https://arxiv.org/abs/1406.6821v4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Liu and Fu's&lt;/a&gt; work on Abelian geometric phases. A treatment of some non-Abelian cases is given by &lt;a href=&quot;https://arxiv.org/abs/1109.2569v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Liu Roy and Stone&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, let me remark that there are many geometric representations relevant to quantum computation, but they are multidimensional and may be not useful in general as visualization tools. Please see for example &lt;a href=&quot;http://emis.ams.org/proceedings/Varna/vol9/Bernatska.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bernatska and Holod&lt;/a&gt; treating coadjoint orbits which can serve as phase spaces of  the finite dimensional Hilbert spaces used in quantum computation. The Grassmannian which parametrizes  the ground state manifold of adiabatic quantum Hamiltonians is a particular example of these spaces.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-11-14T09:44:13.263" LastActivityDate="2018-11-14T09:44:13.263" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4703" PostTypeId="2" ParentId="4698" CreationDate="2018-11-13T12:55:16.643" Score="6" Body="&lt;p&gt;The longest circuit ever performed is probably one used for benchmarking. So the point would be to run many gates, look at the associated decay in fidelity, and use that to find a measure of how good the gates are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1712.06550&quot; rel=&quot;noreferrer&quot;&gt;Here's&lt;/a&gt; a recent paper that I found on a fairly brief search. In Fig. 2 we see depths of 1500 single qubit gates and 130 for gates on two qubits. Given that these circuits are designed to drive states to a point of complete randomness, there's not much point in going further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, note that circuit depth isn't uniquely defined, especially since one circuit can be recompiled to an equivalent one with non-equal depth. This is especially true of single qubit operations. For example, should the gate sequence &lt;span class=&quot;math-container&quot;&gt;$H Z H$&lt;/span&gt; be regarded as depth 3 or as depth 1, because it is equivalent to &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. So a more concrete measure is perhaps the depth of cnots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this, the longest I know of is my own &lt;a href=&quot;https://github.com/decodoku/A_Game_to_Benchmark_Quantum_Computers/blob/master/paper/paper.pdf&quot; rel=&quot;noreferrer&quot;&gt;benchmarking program&lt;/a&gt; that I ran for 10 'rounds' in which each round has a cnot depth of 4 (except for the last, which has two). This makes a total cnot depth of 38. But, of course, I only know of this because it is my own project. There might be runs with more cnots, though current noise levels mean that there is not much reason to go too far beyond this.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-11-13T13:02:01.443" LastActivityDate="2018-11-13T13:02:01.443" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4704" PostTypeId="2" ParentId="4699" CreationDate="2018-11-13T22:53:26.630" Score="4" Body="&lt;p&gt;We have some multiqubit visualizations within &lt;a href=&quot;https://q-ctrl.com/products/#black-opal&quot; rel=&quot;noreferrer&quot;&gt;Q-CTRL's Black Opal package&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are all fully interactive and are designed to help build intuition about correlations in interacting two-qubit systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two Bloch spheres represent the relevant separable states of two qubits.  The tetrahedra in the middle visually capture correlations between certain projections of the two qubits.  When there is no entanglement, the Bloch vectors live entirely on the surfaces of the respective spheres.  However, a fully entangled state lives exclusively in the space of correlations in this representation.  The extrema of these spaces will always be maximally entangled states like Bell states, but maximally entangled states can also reside within multiple tetrahedra simultaneously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eFffn.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eFffn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5092" LastEditorUserId="26" LastEditDate="2018-11-14T03:54:41.817" LastActivityDate="2018-11-14T03:54:41.817" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4705" PostTypeId="2" ParentId="4699" CreationDate="2018-11-13T23:42:52.400" Score="19" Body="&lt;p&gt;For pure states, there &lt;a href=&quot;http://algassert.com/post/1716&quot; rel=&quot;noreferrer&quot;&gt;is a reasonably simple way to make a &quot;2 qubit bloch sphere&quot;&lt;/a&gt;. You basically use the Schmidt decomposition to divide your state into two cases: not entangled and fully entangled. For the not-entangled part, you just use two bloch spheres. And then the entangled part is isomorphic to the set of possible rotations in 3d space (the rotation is how you translate measurements on one qubit into predictions on the other qubit). This gives you a representation with eight real parameters:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A real value w between 0 and 1 indicating the weight of not-entangled vs fully-entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2+3) The not-entangled unit bloch vector for qubit 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4+5) The not-entangled unit bloch vector for qubit 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6+7+8) The fully-entangled rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what it looks like if you show the rotation part as &quot;where X Y and Z axes get mapped&quot;, and additionally scale the axes by w so that it gets bigger the more entangled you are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WUR1W.gif&quot; alt=&quot;entangled view&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The bouncing in the middle one is due to a numerical degeneracy in my code.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For mixed states, I've had a bit of success showing the envelope of bloch vectors predicted for qubit 2 given every possible measurement of qubit 1. That looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/puv1Q.gif&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/puv1Q.gif&quot; alt=&quot;mixed state envelope&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But note that a) this 'envelope' representation is not symmetric (one of the qubits is the control and the other is the target) and b) although it looks pretty it's not algebraically compact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This display is available in the alternate &lt;a href=&quot;https://github.com/strilanc/quirk/tree/dev-entanglement-display&quot; rel=&quot;noreferrer&quot;&gt;dev-entanglement-display&lt;/a&gt; branch of Quirk. If you're able to follow the build instructions, then you can play with it directly.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-11-13T23:42:52.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4706" PostTypeId="1" CreationDate="2018-11-14T06:44:34.750" Score="6" ViewCount="385" Body="&lt;p&gt;I've been working through the paper &lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Bell nonlocality&lt;/em&gt;&lt;/a&gt; by Brunner et al. after seeing it in user glS' answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4690/4153&quot;&gt;here&lt;/a&gt;. Early on in the paper, the standard Bell experimental setup is defined:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VUVqD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VUVqD.png&quot; alt=&quot;Bell experiment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$x, y \in \{0,1\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a, b \in \{-1, 1\}$&lt;/span&gt;, and the two people (Alice &amp;amp; Bob) measure a shared quantum system generated by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; according to their indepedent inputs &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, outputting the results as &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper then has the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(ab|xy) \ne P(a|x)P(b|y)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And claims the fact this is an &lt;em&gt;inequality&lt;/em&gt; means the two sides are &lt;em&gt;not&lt;/em&gt; statistically independent. It's been a long time since I took probability &amp;amp; statistics in university, so I'm interested in this equation, what it means, and why it is a test for statistical independence. Why is this equation used, and what is the intuitive meaning of each side? I have basic knowledge of conditional probability and Bayes' theorem.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="55" LastEditDate="2020-12-01T11:36:31.143" LastActivityDate="2020-12-01T11:36:31.143" Title="In Bell nonlocality, why does $P(ab|xy)\neq P(a|x)P(b|y)$ mean the variables are not statistically independent?" Tags="&lt;mathematics&gt;&lt;information-theory&gt;&lt;correlations&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4707" PostTypeId="1" CreationDate="2018-11-14T08:07:22.847" Score="8" ViewCount="533" Body="&lt;p&gt;I'm working through a problem set, and am stuck on the following problem:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;a&lt;/strong&gt;) What can go wrong in Shor’s algorithm if Q (the dimension of the Quantum Fourier Transform) is not taken to be sufficiently large? Illustrate with an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;b&lt;/strong&gt;) What can go wrong if the function, f, satisfies &lt;span class=&quot;math-container&quot;&gt;$f(p) = f(q)$&lt;/span&gt; if the period &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; divides &lt;span class=&quot;math-container&quot;&gt;$p − q$&lt;/span&gt;, but it’s not an “if and only if” (i.e., we could have &lt;span class=&quot;math-container&quot;&gt;$f(p) = f(q)$&lt;/span&gt; even when &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; doesn’t divide &lt;span class=&quot;math-container&quot;&gt;$p − q$&lt;/span&gt;)? Note that this does not actually happen for the function in Shor’s algorithm, but it could happen when attempting period finding on an arbitrary function. Illustrate with an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;c&lt;/strong&gt;) What can go wrong in Shor’s algorithm if the integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to be factored is even (that is, one of the prime factors, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, is equal to 2)? Illustrate with an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;d&lt;/strong&gt;) Prove that there can be at most one rational &lt;span class=&quot;math-container&quot;&gt;$\frac{a}{b}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; positive integers, that’s at most &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; away from a real number &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and that satisfies &lt;span class=&quot;math-container&quot;&gt;$b &amp;lt; \frac{1}{\sqrt{2\epsilon}}$&lt;/span&gt;. Explain how this relates to the choice, in Shor’s algorithm, to choose Q to be quadratically larger than the integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; that we’re trying to factor.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I've been wrestling with it for a while, and my attempt so far is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;a) When &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; (the period) does not divide &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, a sufficiently large &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; ensures that the rational approximation to &lt;span class=&quot;math-container&quot;&gt;$\frac{k Q}{s}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an integer is sufficiently close to determine a unique &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;b) There might be more than one period &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; associated with the function (something &lt;a href=&quot;https://en.wikipedia.org/wiki/Beat_(acoustics)&quot; rel=&quot;noreferrer&quot;&gt;like an acoustic beat&lt;/a&gt;), so it would be much more difficult to solve for one period individually.&lt;/p&gt;&#xA;&lt;p&gt;c) Completely lost....&lt;/p&gt;&#xA;&lt;p&gt;d) I supposed that there existed two different rationals such that &lt;span class=&quot;math-container&quot;&gt;$\mid{\frac{a_1}{b_1} - \frac{a_2}{b_2}}\mid&amp;gt; 0$&lt;/span&gt; and tried to force a contradiction using the constraints &lt;span class=&quot;math-container&quot;&gt;$\mid\frac{a_\mu}{b_\mu}-x\mid \leq \epsilon$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_\mu &amp;lt; \frac{1}{\sqrt{2\epsilon}}$&lt;/span&gt;, but couldn't get it to come out. Either I am making a stupid mistake and/or missing something simple (?).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I am really struggling to gain intuition for Shor's algorithm and its specific steps, so I'm very unconfident when trying to address parts (a) - (c). I'm stumped by (c) especially; isn't Shor's algorithm robust in the sense that it does not matter if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is even or odd? If anyone could point me in the right direction, it would be appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5097" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-03-16T22:14:43.140" Title="Shor's algorithm weaknesses &amp; uniqueness of close rational" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4708" PostTypeId="2" ParentId="4706" CreationDate="2018-11-14T08:11:18.870" Score="3" Body="&lt;p&gt;The equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(ab|xy) = P(a|x)P(b|y)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;would imply that any dependence that the output &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; has on the inputs &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt; (expressed by the lhs) is solely due to &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; depending on &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; alone, and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; depending on &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; alone. This is expressed by the rhs by treating the value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and its dependence on &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as an independent event from the value of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and its dependence on &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, and hence the probability of a particular &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; is the product of these independent probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Bell's equalities, we see that this is not the case. Correlations between &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; depend explicitly on which pair of inputs &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt; is chosen. Specifically, for the CHSH inequality, whether or not &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; agrees with &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; depends on both &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, and hence &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; cannot be said to be independent of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; (nor &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;). This behaviour means that there will be at least some values of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; where the above equality does not hold.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-11-14T08:11:18.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4709" PostTypeId="2" ParentId="4706" CreationDate="2018-11-14T08:30:22.340" Score="4" Body="&lt;p&gt;It perhaps helps to express &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy)$&lt;/span&gt; in words:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the probability that Alice gets answer A and Bob gets answer B given that choices x and y were made&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now independence in classical probability holds if and only if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(e_1\text{ and }e_2)=P(e_1)P(e_2)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$e_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e_2$&lt;/span&gt; are events, and practically, you can see what it means through Bayes' theorem&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(e_1|e_2)=\frac{P(e_1\text{ and }e_2)}{P(e_2)}=P(e_1)&#xA;$$&lt;/span&gt;&#xA;i.e. for independent events, the condition probability is independent of the conditioning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we could rewrite&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(ab|xy)=P(a|bxy)P(b|xy)&#xA;$$&lt;/span&gt;&#xA;you lose a bit of symmetry by doing it like this, but only briefly. Now, the idea of independence in the current context is that Alice's result should not depend on anything that happens on Bob's side, so &lt;span class=&quot;math-container&quot;&gt;$P(a|bxy)=P(a|x)$&lt;/span&gt; and Bob's result should be independent of anything that happens on Alice's side, so &lt;span class=&quot;math-container&quot;&gt;$P(b|xy)=P(b|x)$&lt;/span&gt;. Hence, independence between Alice and Bob would imply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(ab|xy)=P(a|x)P(b|y).&#xA;$$&lt;/span&gt;&#xA;So, if this condition holds for all &lt;span class=&quot;math-container&quot;&gt;$a,b,x,y$&lt;/span&gt;, then the probability distribution is independent, otherwise, the results are not statistically independent.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-14T08:30:22.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4711" PostTypeId="1" CreationDate="2018-11-14T10:07:02.617" Score="5" ViewCount="761" Body="&lt;p&gt;I recently stumbled upon a &lt;a href=&quot;https://www.prnewswire.com/news-releases/xanadu-releases-pennylane-the-first-dedicated-machine-learning-software-for-quantum-computers-300749107.html&quot; rel=&quot;noreferrer&quot;&gt;press release&lt;/a&gt; from Xanadu.ai stating that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Under the hood, PennyLane's core feature is that it implements a&#xA;  version of the backpropagation algorithm - the workhorse for training&#xA;  deep learning models - that is naturally compatible with quantum&#xA;  devices.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as I know, not many algorithms are known to profit from the features of a quantum computer. So is quantum backpropagation one of these algorithms that is theoretically faster than classical backpropagation? Or what advantages should one get from running backpropagation on a quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="5100" LastActivityDate="2018-11-14T15:13:07.700" Title="Is quantum backpropagation faster than classical backpropagation?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4712" PostTypeId="1" CreationDate="2018-11-14T11:43:55.977" Score="2" ViewCount="113" Body="&lt;p&gt;I have a network problem that I believe would be represented as an adjacency-list on a quantum circuit. Typically, the list is up for traversing from various perspectives (e.g., shortest-path between two points).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adjacency-list example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x-&amp;gt; a, b, c&#xA;y-&amp;gt; a, d, e&#xA;x-&amp;gt; b, c, d&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any insight will be much appreciated!&lt;/p&gt;&#xA;" OwnerUserId="4120" LastEditorUserId="26" LastEditDate="2018-12-23T08:02:17.697" LastActivityDate="2018-12-23T08:02:17.697" Title="How to you encode a network as an adjacency-list in the quantum-gate model?" Tags="&lt;quantum-gate&gt;&lt;quantum-networks&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4713" PostTypeId="2" ParentId="4711" CreationDate="2018-11-14T11:50:37.993" Score="5" Body="&lt;p&gt;In general, the efficiency of Quantum Machine Learning Techniques will be calibrated and measured more in terms of the energy efficiency, ability to handle complex computational problems, NP-hard problems and the ability to ensemble different domain algorithms than the speed and learning rate.  However, there could be exceptionally faster quantum algorithms for a specific set of computational problems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum Backpropagation can be more energy efficient and faster if the right combination of quantum algorithms is used. It depends on how efficiently the output neuron states converge the quantum correlations employed in the feedforward network and what kind of control system algorithms are used for backpropagation. An efficient control NOT gate with lesser decoherence and optimized topology will be useful for this purpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One interesting approach to quantum backpropagation is by implementing&#xA;a form of quantum adaptive error correction, in the sense that, for a feedforward network, the input layer is conditionally transformed so that it exhibits the firing patterns that solve a given computational problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this approach quantum backpropagation dynamics is integrated in a two-stage neural cognition scheme: there is a feedforward learning stage such that the output neurons’&#xA;states, initially separable from the input neurons’ states, that converge during a&#xA;neural processing time to correlated states with the input layer, and then&#xA;there is a backpropagation stage, where the output neurons act as a control&#xA;system that triggers different quantum circuits that are implemented on the&#xA;input neurons, conditionally transforming their state in such a way that a&#xA;given computational problem is solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1609.06935&quot; rel=&quot;noreferrer&quot;&gt;The following research paper&lt;/a&gt; has a deep analysis on the Quantum Back Propagation dynamics through the application of a Hamiltonian framework. It  introduces a Hamiltonian framework for quantum neural machine learning with basic feedforward neural networks integrating quantum measurement theory and dividing the quantum neural dynamics in the learning stage and the backpropagation stage and then apply the framework to two example problems: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The firing pattern selection problem, where the neural network places the input layer in a specific well-defined firing configuration, from an initially arbitrary superposition of neural firing patterns&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The n-to-m Boolean functions’ representation problem, where the goal for the network is to correct the input layer so that it represents an arbitrary n-to-m Boolean function.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There is another experimental implementation of Quantum Back Propagation algorithm for a Multi Layer Perceptron based Artificial Neural Network as outlined &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S156849461400581X&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="26" LastEditDate="2018-11-14T15:13:07.700" LastActivityDate="2018-11-14T15:13:07.700" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4714" PostTypeId="2" ParentId="4712" CreationDate="2018-11-14T17:02:29.463" Score="2" Body="&lt;p&gt;Say you have &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; vertices and the longest list you can build is of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest way I could think of is an encoding in basis state like :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | \text{origin} \rangle | v_0 (\text{origin})\rangle |v_1 (\text{origin})\rangle... |v_{n-1}(\text{origin})\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We basically would encode the origin vertex and its corresponding n-sized adjacency-list whose elements are noted by &lt;span class=&quot;math-container&quot;&gt;$ v_0...v_{n-1} $&lt;/span&gt;. Potentially, the list may be of size less than &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; but you can encode an empty element as a bitstring of your choice (&lt;span class=&quot;math-container&quot;&gt;$000$&lt;/span&gt; for instance).  Each vertex would be represented by a bit string of approximately &lt;span class=&quot;math-container&quot;&gt;$ \log(m+1) $&lt;/span&gt; (qu)bits if you take into account the empty element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, the elements would be represented as &lt;span class=&quot;math-container&quot;&gt;$$(\text{empty},000),(a,001), (b,010), (c,011), (x,111), \cdots$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$x \to a,b,c$&lt;/span&gt; you would have :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | x \rangle | a\rangle |b\rangle|c\rangle = | 111 \rangle | 001\rangle |010\rangle|011\rangle = |111 001 010 011 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means also you can have all pairs of &lt;span class=&quot;math-container&quot;&gt;$(\text{origin, list})$&lt;/span&gt; in superposition, where at the end you retrieve one by measurement according to the corresponding amplitudes.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-11-14T17:07:46.650" LastActivityDate="2018-11-14T17:07:46.650" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4715" PostTypeId="1" AcceptedAnswerId="4716" CreationDate="2018-11-15T07:05:23.733" Score="5" ViewCount="154" Body="&lt;p&gt;Continuing from my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4706/4153&quot;&gt;previous question&lt;/a&gt; on &lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;noreferrer&quot;&gt;Brunner et al.'s paper&lt;/a&gt;; so given a standard Bell experimental setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dY7tO.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dY7tO.png&quot; alt=&quot;Bell experiment setup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where independent inputs &lt;span class=&quot;math-container&quot;&gt;$x,y \in \{0, 1\}$&lt;/span&gt; decide the measurement performed by Alice &amp;amp; Bob on quantum state &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; with outcomes &lt;span class=&quot;math-container&quot;&gt;$a,b \in \{-1, 1\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are correlated (not independent) if:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy) \ne P(a|xy)P(b|xy) \ne P(a|x)P(b|y)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, there are perfectly innocent non-quantum reasons why &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; could be correlated; call these reasons confounding variables, some artifact of when Alice &amp;amp; Bob's systems interacted in the past. The set of all confounding variables we call &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;. If we take into account all variables in &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, a local theory claims that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; will become independent and thus &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy)$&lt;/span&gt; will factorize:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy,\lambda) = P(a|x,\lambda)P(b|y,\lambda)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This equation expresses outcomes depending only on their local measurement and past variables &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, and explicitly not the remote measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question one&lt;/strong&gt;: what is the mathematical meaning of the comma in equation (2)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question two&lt;/strong&gt;: what is an example of a variable in &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper then says the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; will not necessarily be constant for all runs of the experiment, even if the procedure which prepares the particles to be measured is held fixed, because &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; may involve physical quantities that are not&#xA;  fully controllable. The different values of &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; across the runs should thus be characterized by a probability distribution &lt;span class=&quot;math-container&quot;&gt;$q(\lambda)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question three&lt;/strong&gt;: why was it a set of variables before but is now only a single variable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question four&lt;/strong&gt;: what is an example of a probability distribution for &lt;span class=&quot;math-container&quot;&gt;$q(\lambda)$&lt;/span&gt; here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then have the fundamental definition of locality for Bell experiments:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy) = \int_{Λ} q(\lambda)P(a|x, \lambda)P(b|y, \lambda) d\lambda$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$q(\lambda|x,y) = q(\lambda)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question five&lt;/strong&gt;: What does the Λ character mean under the integral sign?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;General question&lt;/strong&gt;: so we have a continuous probability distribution &lt;span class=&quot;math-container&quot;&gt;$q(\lambda)$&lt;/span&gt; over which we're integrating. Why are we multiplying the RHS of equation (2) by &lt;span class=&quot;math-container&quot;&gt;$q(\lambda)$&lt;/span&gt; in the integrand? That would seem to make equation (3) different than equation (2). What's an example of this integral with concrete values?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-03-10T05:45:03.113" LastActivityDate="2019-03-10T05:45:03.113" Title="Definition of locality in Bell experiments" Tags="&lt;quantum-information&gt;&lt;mathematics&gt;&lt;correlations&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4716" PostTypeId="2" ParentId="4715" CreationDate="2018-11-15T14:48:51.773" Score="5" Body="&lt;p&gt;I think that I can explain the definition through the following simple example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that you perform two experiments in the same house in two separate rooms. In the first you measure the observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and instantaneously in the second you measure the observable  &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. The measurements are afflicted with noise, so you do not get a definite answer every time you measure but a distribution &lt;span class=&quot;math-container&quot;&gt;$P(A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(B)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, as very well known that the noise is temperature dependent (we suppose that the temperature is uniform throughout the house), so when you repeat your experiment at a different teperature you observe that you obtain a different distribution. Thus, our distributions are temperature dependent and we write them as: &lt;span class=&quot;math-container&quot;&gt;$P(A, T)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$P(B, T)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since the two rooms are remote, we know that there is no effect of each measurement on the other, thus our joint distribution must have the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P(AB,T) = P(A,T) P(B,T) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The comma here means that the temperature is a parameter on which the distribution depends and not an observable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose that we don't know in which season in which we performed the experiment; but we only know the probability density function f(T) of the temperature over the seasons. The best we can do in order to forecast predictions is to perform a weighted averaging over all the temperature values, and make our predictions according to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P(AB) = \int_{\mathcal{T}} f(T) P(A,T) P(B,T) dT$$&lt;/span&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{T}$&lt;/span&gt;  (corresponding to the character &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; in the question) is the space of all temperature values. This space can be one dimensional as in our case where our experiments depend on one parameter, or it can be a multidimensional manifold parametrizing the possible parameters which can influence our experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the measurements are local, they were performed in distant rooms, with no correlation, except through the fact that the temperature was the same every time the observables were measured instantaneously. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difference of the above from your question is that the     observables in the question are conditional &lt;span class=&quot;math-container&quot;&gt;$a|x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b|y$&lt;/span&gt;, instead of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. This just mean that you did not perform a single experiment of measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, but several experiments: For example if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are binary; it means that you performed an experiment measuring the observable &lt;span class=&quot;math-container&quot;&gt;$A = a|0$&lt;/span&gt; where you held &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, then performed another experiment measuring &lt;span class=&quot;math-container&quot;&gt;$A = a|1$&lt;/span&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example of the confounding variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; exemplified by the temperature in the above description, would be a binary variable, in this case its probability density is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$q(\lambda) = \frac{1}{2}(\delta(q) + \delta(q-1))$$&lt;/span&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is the Dirac delta functions), and in this case, its range will be the whole real axis &lt;span class=&quot;math-container&quot;&gt;$\Lambda = \mathbb{R}$&lt;/span&gt; equipped with a Lebesgue measure.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-11-15T14:54:30.723" LastActivityDate="2018-11-15T14:54:30.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4717" PostTypeId="7" CreationDate="2018-11-15T17:05:29.310" Score="0" Body="&lt;p&gt;&lt;b&gt;Quantum Computing Stack Exchange&lt;/b&gt; is a question and answer site for scientists, engineers, mathematicians, programmers and computing professionals interested in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_information_science&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum computing and quantum information&lt;/a&gt;. It's built and run &lt;i&gt;by you&lt;/i&gt; as part of the &lt;a href=&quot;https://stackexchange.com&quot;&gt;Stack Exchange&lt;/a&gt; network of Q&amp;amp;A sites. With your help, we're working together to build a library of detailed answers to every question about quantum computing and quantum information.&lt;/p&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="26" LastEditDate="2018-12-31T19:06:12.693" LastActivityDate="2018-12-31T19:06:12.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4718" PostTypeId="7" CreationDate="2018-11-15T17:05:49.570" Score="0" Body="&lt;ul&gt;&#xA;    &lt;li&gt;Specific issues with quantum computing or quantum information&lt;/li&gt;&#xA;    &lt;li&gt;Real problems or questions that you’ve encountered&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="26" LastEditDate="2018-11-15T17:05:49.570" LastActivityDate="2018-11-15T17:05:49.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4719" PostTypeId="7" CreationDate="2018-11-15T17:06:11.713" Score="0" Body="&lt;ul&gt;&#xA;    &lt;li&gt;Anything not directly related to quantum computing or quantum information&lt;/li&gt;&#xA;    &lt;li&gt;Questions that are primarily opinion-based&lt;/li&gt;&#xA;    &lt;li&gt;Questions with too many possible answers or that would require an extremely long answer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="-1" LastEditorUserId="26" LastEditDate="2018-11-15T17:06:11.713" LastActivityDate="2018-11-15T17:06:11.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4720" PostTypeId="1" AcceptedAnswerId="4722" CreationDate="2018-11-15T18:02:57.907" Score="3" ViewCount="1272" Body="&lt;p&gt;What Clifford gate circuit operating on states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;  prepares the state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=|\psi_1\rangle \otimes |\psi_2\rangle$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="26" LastEditDate="2018-12-23T08:00:39.553" LastActivityDate="2019-02-24T07:49:01.020" Title="What circuit or operation corresponds to the tensor product?" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;&lt;circuit-construction&gt;" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4721" PostTypeId="1" AcceptedAnswerId="4725" CreationDate="2018-11-15T18:17:52.730" Score="2" ViewCount="112" Body="&lt;p&gt;After posting &lt;a href=&quot;https://physics.stackexchange.com/questions/441138/how-to-characterize-the-modular-expressions-in-shors&quot;&gt;this question&lt;/a&gt; to Physics, it became pretty clear I should have posted here. So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How might a (e.g.) 72-bit crypto-relevant quantum computer attack RSA-2048?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus: how might that be characterized? (e.g., nn-qubit requires xxx passses, run time ~yyy)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shor's algorithm appears to allow for parallel execution or iterative runs with a combination step. Assumption is that smaller-qubit QC might be able to perform those pieces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;a href=&quot;https://www.entrust.com/wp-content/uploads/2013/05/WP_QuantumCrypto_Jan09.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;it is suggested&lt;/a&gt; that a 4000-qubit/100m-gate quantum computer would be necessary. As the quantum piece of Shor's is a large transform, I assume that sets the constraint for qubit-size&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Side note: there also appear to be possible speedups that may reduce the run time, such as qubit recycling? or the 4-8 passes vs. the 20-30 passes (by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0112055&quot; rel=&quot;nofollow noreferrer&quot;&gt;David McAnally&lt;/a&gt;) &lt;/p&gt;&#xA;" OwnerUserId="5113" LastEditorUserId="26" LastEditDate="2019-05-13T21:52:28.603" LastActivityDate="2019-05-13T21:52:28.603" Title="Lesser qubit computer doing the parts of Shor's against e.g., RSA-2048 sized prime" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;speedup&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4722" PostTypeId="2" ParentId="4720" CreationDate="2018-11-15T18:46:05.790" Score="6" Body="&lt;p&gt;I think that you misunderstood the concept of tensor product here. There is no need of a Clifford gate in order to have a multi-qubit system. The fact that a multi-qubit system is described by the tensor produt of their state vectors comes from the fourth postulate of quantum mechanics, refer to the &lt;span class=&quot;math-container&quot;&gt;$94^{th}$&lt;/span&gt; page of &lt;a href=&quot;http://csis.pace.edu/ctappert/cs837-18spring/QC-textbook.pdf&quot; rel=&quot;noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt; to see the formulation of this postulate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, what I mean here is that if you have two qubits represented by state vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;, the tensor product is the mathematical operation that describes the composite state of the 2-qubit sytem &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. This something known by postulates, and so there is no need to use any Clifford gate to obtain that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clifford gates for example could be used if you have state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=|\psi_1\rangle\otimes |\psi_2\rangle$&lt;/span&gt; and you want to obtain another state &lt;span class=&quot;math-container&quot;&gt;$|\Psi'\rangle$&lt;/span&gt;, then the transformation would be given by some Clifford group unitary so that &lt;span class=&quot;math-container&quot;&gt;$|\Psi'\rangle=U|\Psi\rangle$&lt;/span&gt;. However, in order to calculate such unitary, the initial states should be needed, and so here no more can be said.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-11-15T18:46:05.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4723" PostTypeId="2" ParentId="4720" CreationDate="2018-11-15T18:50:11.807" Score="5" Body="&lt;p&gt;There is no circuit operation or Clifford gate! If you have &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; entering a circuit, then mathematically we say that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; |\psi_1\rangle \otimes |\psi_2\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is entering the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means if you represent the whole circuit as a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, it will have a dimension corresponding to the size of &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle \otimes |\psi_2\rangle$&lt;/span&gt;, not of  &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;. Your output is literally the matrix-vector product:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U\left(\left|\psi_1\right\rangle \otimes |\psi_2\rangle\right),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;even without using any extra Clifford gates!&lt;/p&gt;&#xA;" OwnerDisplayName="user5115" LastEditorUserId="23" LastEditDate="2018-11-16T00:06:28.873" LastActivityDate="2018-11-16T00:06:28.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4724" PostTypeId="2" ParentId="4720" CreationDate="2018-11-15T18:54:48.167" Score="4" Body="&lt;p&gt;The tensor product is not a gate, but rather a way for us as humans to model the behavior of a quantum system. Whenever we're using multiple qbits, we can look at them in two ways: in their product state (a complex vector of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbits) or their individual state (&lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle \otimes \ldots \otimes |\psi_{n-1}\rangle$&lt;/span&gt;). We can usually switch back and forth between the two representations at will (again, they are two equivalent ways of writing the same quantum state) except for when the qbits become entangled, in which case we cannot factor them back into the individual state (this is roughly the definition of entanglement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're just learning quantum computing and are writing out matrices &amp;amp; vectors explicitly, you usually use the product state to calculate the action of an operator on the quantum state, then factor the result back into the individual state to see the action of that operator on the individual qbits. So for example, if we want to calculate the action of CNOT on &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; with leftmost qbit as control:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$C|10\rangle = C \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} =&#xA;\begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} = &#xA;\begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix}&#xA;= |11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we see that CNOT on &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; flipped the rightmost qbit to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as expected, because the control (leftmost) qbit was &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an entangled product state which cannot be factored into its individual state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$C_{1,0}H_1|00\rangle = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ 0 \\ 0 \\ \frac{1}{\sqrt{2}} \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you try to factor that out into the tensor product of two qbits, you will see you cannot.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-11-15T18:54:48.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4725" PostTypeId="2" ParentId="4721" CreationDate="2018-11-15T18:55:52.260" Score="3" Body="&lt;p&gt;Even with qubit recycling, 72 qubits will not be enough to do RSA-2048. &#xA;Table 1 of the paper: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/nature12290&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/nature12290&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tells you that 1154 qubits are needed to do RSA-768 (which is much smaller than RSA-2048). This is without error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure you can use your 72-qubit quantum computer to do a little sub-routine of Shor's algorithm, but this will not help if you have to do the rest of the algorithm on a classical computer. For any benefit, the quantum computer has to be doing the &quot;rate-limiting step&quot;&lt;/p&gt;&#xA;" OwnerDisplayName="user5115" LastEditorUserId="26" LastEditDate="2019-05-13T21:23:23.670" LastActivityDate="2019-05-13T21:23:23.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4726" PostTypeId="1" CreationDate="2018-11-15T19:06:03.860" Score="2" ViewCount="62" Body="&lt;p&gt;I was looking up how to program for a D-Wave machine and I came across this image which says it's the &quot;optimal hardware graph&quot; for a D-Wave machine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uKOiK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uKOiK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately the image seems to have come from this website: &#xA;&lt;a href=&quot;http://people.cs.vt.edu/~vchoi/MinorEmbed.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://people.cs.vt.edu/~vchoi/MinorEmbed.pdf&lt;/a&gt; (I got a preview somewhere else and they provided a link to this website), and when I click on that link it says &quot;Forbidden You don't have permission to access /~vchoi on this server.&quot; The same happens if I remove the PDF from the URL and only look at the faculty member's webpage. The webpage does work if I remove the faculty member's name though, but then it's just the CS department website.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So where can I find the original work where this comes from?&#xA;I searched for alternative sources on Google, but it seems that &quot;triad&quot; means very many different things!&lt;/p&gt;&#xA;" OwnerDisplayName="user5115" LastActivityDate="2018-11-15T19:21:03.350" Title="What is the &quot;TRIAD&quot; graph and where can I find more information about it?" Tags="&lt;architecture&gt;&lt;d-wave&gt;&lt;adiabatic-model&gt;&lt;embedding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4727" PostTypeId="2" ParentId="4726" CreationDate="2018-11-15T19:21:03.350" Score="2" Body="&lt;p&gt;Here I found a few resources talking about TRIAD which is a minor embedding technique Vicky Choi introduced :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1704.01996&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimizing Adiabatic Quantum Program Compilation using a Graph-Theoretic Framework&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0804.4884&quot; rel=&quot;nofollow noreferrer&quot;&gt;Minor-Embedding in Adiabatic Quantum Computation: I. The Parameter Setting Problem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pdfs.semanticscholar.org/7761/ab691c0261eca2d3361020047522cec046cf.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Minor-Embedding in Adiabatic Quantum Computation: II. Minor-universal graph design&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third one contains your image.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-11-15T19:21:03.350" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4729" PostTypeId="1" AcceptedAnswerId="4732" CreationDate="2018-11-15T20:31:26.817" Score="3" ViewCount="215" Body="&lt;p&gt;Let a three-qubit state shared between Alice, Bob and Charlie stationed at distant laboratories be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\psi_{ABC}=\frac{\sqrt{2}}{\sqrt{3}}|000\rangle+\frac{1}{\sqrt{3}}|111\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to evaluate the maximum probability of transforming the state to a three&#xA;qubit maximally entangled state by local operations and classical communication only?&lt;/p&gt;&#xA;" OwnerUserId="5007" LastEditorUserId="26" LastEditDate="2018-11-15T20:32:43.070" LastActivityDate="2018-11-16T07:42:40.737" Title="How to transfer non maximally entangled state to maximally entangled?" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4730" PostTypeId="1" AcceptedAnswerId="6447" CreationDate="2018-11-15T23:21:51.800" Score="6" ViewCount="366" Body="&lt;p&gt;I cannot seem to get an estimate for the number of solutions using the quantum counting algorithm described in Nielsen and Chuang, i.e. phase estimation with the Grover iteration acting as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try doing the following with &lt;code&gt;control&lt;/code&gt; and &lt;code&gt;target&lt;/code&gt; as allocated qubit registers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let controlBE = BigEndian(control);&#xA;let ancilla = target[0];&#xA;&#xA;X(ancilla);&#xA;ApplyToEachCA(H, control + target);&#xA;for (i in 0..Length(control) - 1) {&#xA;    Controlled GroverPow([control[Length(control) - 1 - i]], (2 ^ i, target));&#xA;}&#xA;Adjoint QFT(controlBE);&#xA;&#xA;let fiBE = MeasureInteger(controlBE);&#xA;let numSolutionsD = PowD(Sin(ToDouble(fiBE) / 2.0), 2.0) * ToDouble(2 ^ Length(inputQubits));&#xA;&#xA;Message(&quot;numSolutions: &quot; + Round(numSolutionsD));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My &lt;code&gt;GroverPow&lt;/code&gt; is a discrete oracle that is supposed to perform the Grover iteration to the power defined by the given integer.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation GroverPow(power: Int, qubits: Qubit[]): Unit {&#xA;    let ancilla = qubits[0];&#xA;    let inputQubits = qubits[1..Length(qubits) - 1];&#xA;    let aug = Tail(inputQubits);&#xA;    let ans = Most(inputQubits);&#xA;&#xA;    for (i in 1..power) {&#xA;        Oracle(ans, database, ancilla, aug);  // Grover iteration&#xA;        ApplyToEachCA(H, inputQubits);&#xA;        ApplyToEachCA(X, inputQubits);&#xA;        Controlled Z(Most(inputQubits), Tail(inputQubits));&#xA;        ApplyToEachCA(X, inputQubits);&#xA;        ApplyToEachCA(H, inputQubits);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This just doesn't give the correct answer, even when I have the oracle do absolutely nothing. Is there an obvious bug that I'm missing? I've tried using various combinations of my home-grown functions as well as the built-in &lt;code&gt;AmpAmpByOracle&lt;/code&gt; and &lt;code&gt;QuantumPhaseEstimation&lt;/code&gt; functions and various initial/target states but to no avail. I've tried absolutely everything I can think of, and am almost starting to get suspicious of the validity of this algorithm...obviously it's sound but that's where I'm at! Just doesn't seem to work.&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="4657" LastEditDate="2018-11-16T16:06:41.343" LastActivityDate="2019-06-14T00:31:00.813" Title="Quantum counting in Q#" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4732" PostTypeId="2" ParentId="4729" CreationDate="2018-11-16T07:42:40.737" Score="4" Body="&lt;p&gt;The first question that we have to deal with is what is meant by &quot;maximally entangled&quot; in this context. There's no single straightforward notion. In particular, for three qubits, there are two inequivalent classes of entangled state that cannot be interconverted by SLOCC (stochastic local operations and classical communication). Each has a maximally entangled representative:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|W\rangle=\frac{1}{\sqrt{3}}(|001\rangle+|010\rangle+|100\rangle)\qquad |GHZ\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle).&#xA;$$&lt;/span&gt;&#xA;In this case, we're obviously talking about conversion to GHZ; conversion to W is impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A straightforward protocol to achieve the conversion is to introduce the POVM&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_1=\frac{1}{\sqrt{2}}|0\rangle\langle 0|+|1\rangle\langle 1|\qquad M_2=\frac{1}{\sqrt{2}}|0\rangle\langle 0|&#xA;$$&lt;/span&gt;&#xA;such that &lt;span class=&quot;math-container&quot;&gt;$M_1^\dagger M_1+M_2^\dagger M_2=\mathbb{I}$&lt;/span&gt;. If Alice performs this measurement and gets answer 1, then she has created the desired state,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(M_1\otimes\mathbb{I}\otimes\mathbb{I})|\psi\rangle=\sqrt{\frac{2}{3}}|GHZ\rangle,&#xA;$$&lt;/span&gt;&#xA;which succeeds with probability 2/3. The other outcome gives a separable state, so there's no hope of getting anything useful out of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we know that this is the best we can do? Imagine a second protocol of two players, Alice and Bob. They initially share &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{\frac23}|00\rangle+\frac{1}{\sqrt{3}}|11\rangle)$&lt;/span&gt; and wish to create &lt;span class=&quot;math-container&quot;&gt;$(|00\rangle+|11\rangle)/\sqrt{2}$&lt;/span&gt;. We know that their greatest probability of success is 2/3 thanks to work by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807077&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vidal&lt;/a&gt;. Now, one specific strategy that Alice and Bob could follow is for Bob to introduce an extra qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, apply a control not targeting this new qubit, controlled from his qubit in the entangled state. This leaves them with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Then they apply the optimal tripartite protocol for converting to &lt;span class=&quot;math-container&quot;&gt;$|GHZ\rangle$&lt;/span&gt; before Bob repeats the same controlled-not again. The overall success probability cannot be higher than 2/3, and the only probabilistic step in there is the protocol we're interested in, so that protocol cannot succeed with probability greater than 2/3. Hence our original solution must be optimal.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-16T07:42:40.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4733" PostTypeId="2" ParentId="4720" CreationDate="2018-11-16T07:48:16.243" Score="2" Body="&lt;p&gt;To put another way, the circuit is just&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zpFKr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zpFKr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As everyone else said, the tensor product is just the way of constructing a composite quantum system from smaller subsystems, and doesn't require gates as such. But ordering is important, &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle\otimes|\psi_2\rangle\neq |\psi_2\rangle\otimes|\psi_1\rangle$&lt;/span&gt;, and there is a standard correspondence in quantum circuits between the first item in the tensor product being on the top wire.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-16T07:48:16.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4734" PostTypeId="1" AcceptedAnswerId="4735" CreationDate="2018-11-16T09:07:35.217" Score="3" ViewCount="181" Body="&lt;p&gt;The state of a spin &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; particle is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; which is eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;. What is the most generalized way to show that the results of any spin measurement along any direction in x-y plane is completely random. &lt;/p&gt;&#xA;" OwnerUserId="5007" LastEditorUserId="26" LastEditDate="2018-12-23T12:58:49.580" LastActivityDate="2018-12-23T12:58:49.580" Title="Quantum spin measurement" Tags="&lt;measurement&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4735" PostTypeId="2" ParentId="4734" CreationDate="2018-11-16T10:58:07.333" Score="5" Body="&lt;p&gt;Any set of commuting observables in any quantum state can be characterized by a joint classical distribution function describing the probabilities of its measurement outputs in that quantum state. Since you need &#xA;a single observable and it is of course self commuting, the above is valid in your case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obsevable in your case is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma = \cos \phi \sigma_x + \sin \phi \sigma_y$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a state having a densiyy matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, the characteristic function of the probability density of this observable is given by: (this is the most important thing to remember here)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$g(t) = tr(\rho e^{it\sigma})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the projector on the spin up state, and it is not difficult to show that the exponent is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \cos (t/2 )+i \sin( t/2 )\sigma$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$g(t) = \cos (t/2)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability density function is the Fourier transform of the characteristic function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(s) = \frac{1}{2\pi}\int_{-\infty}^{\infty} g(t) e^{ist} dt$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is the measurement outcome of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. We get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(s) = 0.5 \delta(s-0.5) + 0.5 \delta(s+0.5)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the probability distribution function of a Bernoullian random variable, uniformly distrinuted at &lt;span class=&quot;math-container&quot;&gt;$\pm 0.5$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-11-17T11:05:05.977" LastActivityDate="2018-11-17T11:05:05.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4737" PostTypeId="1" AcceptedAnswerId="4739" CreationDate="2018-11-16T17:04:46.437" Score="5" ViewCount="1078" Body="&lt;p&gt;I'm trying to deduce the Kraus representation of the dephasing channel using the Choi operator (I know the Kraus operators can be guessed in this case, I want to understand the general case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dephasing channel maps a density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho\rightarrow D(\rho)=(1-p)\rho+ p\textrm{diag}(\rho_{00},\rho_{11}) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Choi operator acts on a channel as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C(D)=(I \otimes D)\sum_{k,j=0}^1 \vert k\rangle \langle j \vert \otimes \vert k\rangle \langle j \vert=\sum_{k,j=0}^1\vert k\rangle \langle j \vert \otimes D(\vert k\rangle \langle j \vert)=\\=|0\rangle\langle 0|\otimes|0\rangle\langle 0|+p|0\rangle\langle 1|\otimes|0\rangle\langle 1|+p|1\rangle\langle 0|\otimes|1\rangle\langle 0|+|1\rangle\langle 1|\otimes|1\rangle\langle 1|=\\=|00\rangle\langle00|+p|01\rangle\langle01|+p|10\rangle\langle10|+|11\rangle\langle11|= \sum_{j=0}^3 |\psi_j\rangle\langle\psi_j|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to find the Kraus operators, I should just find some &lt;span class=&quot;math-container&quot;&gt;$K_j$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\psi_j\rangle =(I\otimes K_j) \sum_{k=0}^1 \vert k\rangle \otimes \vert k\rangle$&lt;/span&gt;. These operators are simply&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ K_0=|0\rangle\langle 0|\quad K_1=\sqrt{p}|1\rangle\langle 0| \quad K_2=\sqrt{p}|0\rangle\langle 1|\quad K_3=|1\rangle\langle 1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I should have &lt;span class=&quot;math-container&quot;&gt;$$D(\rho)=\sum_{j=1}^3 K_j\rho K_j^\dagger$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{j=1}^3 K_j\rho K_j^\dagger=(\rho_{00}+p\rho_{11})|0\rangle\langle0| + (\rho_{11}+p\rho_{00})|1\rangle\langle1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is most certainly not what I should get. I'm sure I'm either doing a massive calculation error, or I have massively misunderstand everything.&#xA;Moreover, doing this I should only be able to find 4 Kraus operator, while I know that the representation is not unique and in particular this channel can be represented by only two Kraus operators. Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="55" LastEditDate="2021-03-09T09:36:20.517" LastActivityDate="2021-03-09T09:36:20.517" Title="Deduce the Kraus operators of the dephasing channel using the Choi" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4738" PostTypeId="1" AcceptedAnswerId="4740" CreationDate="2018-11-16T18:34:41.243" Score="2" ViewCount="204" Body="&lt;p&gt;What are the necessary &amp;amp; sufficient conditions for a matrix to be an observable, and what is the proof that any such matrix has eigenvalues -1 and 1 (if indeed that is the case)? I ask because in the standard Bell experimental setup the measurement outputs are always -1 or 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possibly related: in a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4380/4153&quot;&gt;previous question&lt;/a&gt; I asked whether the squared absolute values of the eigenvalues of a unitary matrix are always 1 (they are).&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2018-11-21T20:07:34.233" LastActivityDate="2018-11-21T20:07:34.233" Title="Are the eigenvalues of an observable always -1 and 1?" Tags="&lt;quantum-information&gt;&lt;measurement&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4739" PostTypeId="2" ParentId="4737" CreationDate="2018-11-16T19:15:01.553" Score="4" Body="&lt;p&gt;Acting with the dephasing channel on the possible states of a single qubit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}D\left(\left|0\rangle\langle0\right|\right) &amp;amp;= \left|0\rangle\langle0\right| \\ D\left(\left|0\rangle\langle1\right|\right) &amp;amp;= \left(1-p\right)\left|0\rangle\langle1\right|\\&#xA;D\left(\left|1\rangle\langle0\right|\right) &amp;amp;= \left(1-p\right)\left|1\rangle\langle0\right|\\&#xA;D\left(\left|1\rangle\langle1\right|\right) &amp;amp;= \left|1\rangle\langle1\right|.\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives that &lt;span class=&quot;math-container&quot;&gt;\begin{align}C\left(D\right) &amp;amp;= \sum_{k,j=0}^1\vert k\rangle \langle j \vert \otimes D(\vert k\rangle \langle j \vert) \\&#xA;&amp;amp;= |0\rangle\langle 0|\otimes|0\rangle\langle 0|+\left(1-p\right)|0\rangle\langle 1|\otimes|0\rangle\langle 1|+\left(1-p\right)|1\rangle\langle 0|\otimes|1\rangle\langle 0|+|1\rangle\langle 1|\otimes|1\rangle\langle 1|\\&#xA;&amp;amp;= |00\rangle\langle00|+|00\rangle\langle11|+|11\rangle\langle00|+|11\rangle\langle11|- p|00\rangle\langle 11|-p|11\rangle\langle 00|\\&#xA;&amp;amp;=\sum_{k, j=0}^1\left(1-p\right)\vert k\rangle \langle j \vert \otimes \vert k\rangle \langle j \vert + p\left(|0\rangle\langle 0|\otimes|0\rangle\langle 0|+|1\rangle\langle 1|\otimes|1\rangle\langle 1|\right) \\&#xA;&amp;amp;= \sum_{j=0}^N |\psi_j\rangle\langle\psi_j|.\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using &lt;span class=&quot;math-container&quot;&gt;$|\psi_j\rangle =(I\otimes K_j) \sum_{k=0}^1 \vert k\rangle \otimes \vert k\rangle$&lt;/span&gt; to get &lt;span class=&quot;math-container&quot;&gt;$$\sum_{j=0}^N |\psi_j\rangle\langle\psi_j| = \sum_{j=0}^N\sum_{k,l=0}^1\vert k\rangle\langle l\vert \otimes K_j\vert k\rangle \langle l\vert K_j^{\dagger},$$&lt;/span&gt; which equals &lt;span class=&quot;math-container&quot;&gt;$C\left(D\right)$&lt;/span&gt; when the Kraus operators &lt;span class=&quot;math-container&quot;&gt;$K_0 = \sqrt{1-p}I,\, K_1 = \sqrt p |0\rangle\langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$K_2 = \sqrt p |1\rangle\langle 1|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking an arbitrary (single qubit) density matrix &lt;span class=&quot;math-container&quot;&gt;$$\rho = \rho_{00}|0\rangle\langle 0| + \rho_{01}|0\rangle\langle 1| + \rho_{10}|1\rangle\langle 0| + \rho_{11}|1\rangle\langle 1|$$&lt;/span&gt; and acting on this using the above Kraus operators gives &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}D(\rho)&amp;amp;=\sum_{j=1}^3 K_j\rho K_j^\dagger \\&#xA;&amp;amp;=\left(1-p\right)\rho + p\rho_{00}|0\rangle\langle 0| + p\rho_{11}|1\rangle\langle 1|,\end{align}&lt;/span&gt; as expected for the dephasing channel.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2018-11-16T19:15:01.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4740" PostTypeId="2" ParentId="4738" CreationDate="2018-11-16T19:33:50.260" Score="7" Body="&lt;p&gt;An observable only needs to be Hermitian, and can have any real eigenvalues. They don't even need to be distinct eigenvalues: if there are repeated eigenvalues, we say that the eigenspace for that eigenvalue is &lt;em&gt;degenerate&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In the case of observables on a qubit, having a repeated eigenvalue makes the observable rather uninteresting, because absolutely all pure states are eigenstates in that case; I'd be tempted to call such an observable 'degenerate' in an informal sense as well in that case &amp;mdash; though it is on occasion useful to include &lt;span class=&quot;math-container&quot;&gt;$\mathbf 1$&lt;/span&gt; in an analysis of things to do with single-qubit observables.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the analysis of Bell's Theorem, the reason why the observables are taken to be ones with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; are conventional. It makes them analogous to Pauli spin operators in particular, and it makes a perfectly mixed state have expectation value &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Having eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; also allows the expectation values of the operators to describe a bias towards one of two outcomes, and for expectation values of tensor products to be straightforwardly interpreted as a correlation coefficient of outcomes. You &lt;em&gt;could&lt;/em&gt; prove versions of Bell's Theorem for observables with other eigenvalues, but those versions could be derived from Bell's Theorem as its usually stated. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-11-16T21:15:25.733" LastActivityDate="2018-11-16T21:15:25.733" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4742" PostTypeId="2" ParentId="4730" CreationDate="2018-11-16T22:57:34.083" Score="3" Body="&lt;p&gt;Comparing your code to the reference implementation for the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/blob/master/GroversAlgorithm/ReferenceImplementation.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover search quantum kata&lt;/a&gt;, I think the problem might be in the way you're using your oracle in GroverPow. It's a little hard to tell, but if your Oracle is flipping the state of the ancilla based on whether or not the state is a &quot;hit&quot;, you're then not including the ancilla in the rest of the iteration. In the kata, there's a step that transforms a &quot;marking&quot; oracle into a &quot;phase flip&quot; oracle; might you need to do that as well?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry I can't be more certain! Sharing the code for your oracle might help.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2018-11-16T22:57:34.083" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4743" PostTypeId="1" CreationDate="2018-11-17T00:32:19.517" Score="1" ViewCount="249" Body="&lt;p&gt;Is it possible to create controlled gates with an exponent in Cirq? For example, a controlled &lt;span class=&quot;math-container&quot;&gt;$\sqrt Z$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2018-11-17T12:36:04.077" LastActivityDate="2018-11-18T13:09:44.613" Title="Is it possible to create controlled gates with an exponent in Cirq?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;cirq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4744" PostTypeId="2" ParentId="4743" CreationDate="2018-11-17T01:09:05.093" Score="3" Body="&lt;p&gt;Looking at the documentation and the GitHub, there is a something called &lt;code&gt;ControlledGate&lt;/code&gt;. This class is said to augment existing gates with a control qubit. &#xA;You can look at the  &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/75bb352554424b1767e9ef4450f1d01492488e90/cirq/ops/controlled_gate_test.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;test file&lt;/a&gt;. &#xA;I can see line 72 :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cxa = cirq.ControlledGate(cirq.X**cirq.Symbol('a'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Could you try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;gate = cirq.ControlledGate(cirq.X**0.5)&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-11-18T13:09:44.613" LastActivityDate="2018-11-18T13:09:44.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4745" PostTypeId="2" ParentId="4743" CreationDate="2018-11-17T01:34:35.297" Score="6" Body="&lt;p&gt;Yes, it is possible to create controlled gates with an exponent in Cirq.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the specific case of the Z gate, Cirq includes a dedicated CZ gate that can be raised to a power:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cs = cirq.CZ**0.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;More generally, &lt;code&gt;cirq.ControlledGate&lt;/code&gt; works on any gate. It's a bit clunkier than the dedicated gates, but it does support being raised to a power (as long as the gate it is being applied to can be raised to a power). The following two lines are equivalent:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;controlled_sqrt_y = cirq.ControlledGate(cirq.Y**0.5)&#xA;controlled_sqrt_y = cirq.ControlledGate(cirq.Y)**0.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also raise to a power after applying to qubits, which is syntactically convenient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cs_on_ab = cirq.CZ(a, b)**0.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-11-17T01:34:35.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4746" PostTypeId="1" AcceptedAnswerId="4759" CreationDate="2018-11-17T07:32:23.337" Score="1" ViewCount="87" Body="&lt;p&gt;Let's say, that we are in the possession of a quantum gate, that is implementing the action of such an operator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{U}|u \rangle = e^{2 \pi i \phi}|u\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, let's say, that this operator has at least two eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt;, with the following eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{U}|u \rangle = e^{2 \pi i \phi_0}|u\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{U}|v \rangle = e^{2 \pi i \phi_1}|v\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we would like to act with such a quatntum gate on the eigenvector &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;, we could write this in the matrix form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{U}|u\rangle \equiv \begin{bmatrix}&#xA;    e^{2 \pi i \phi_0} &amp;amp; 0 \\&#xA;    0 &amp;amp; e^{2 \pi i \phi_0} \\&#xA;\end{bmatrix} |u\rangle \equiv e^{2 \pi i \phi_0} |u\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to do, is to act with the &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; gate on the superposition of &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt;, that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{U} [c_0|u\rangle + c_1|v\rangle] = c_0e^{2 \pi i \phi_0}|u\rangle + c_1e^{2 \pi i \phi_1}|v\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We could use the following notation to write down eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; in the matrix form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |u\rangle = \begin{bmatrix} a_0 \\ a_1 \end{bmatrix}, |v\rangle = \begin{bmatrix} a_2 \\ a_3 \end{bmatrix} $$&lt;/span&gt;&#xA;Then, we could rewrtie the action &lt;span class=&quot;math-container&quot;&gt;$\hat{U} [c_0|u\rangle + c_1|v\rangle]$&lt;/span&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{U} [c_0|u\rangle + c_1|v\rangle] = c_0e^{2 \pi i \phi_0}|u\rangle + c_1e^{2 \pi i \phi_1}|v\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ = c_0e^{2 \pi i \phi_0}\begin{bmatrix} a_0 \\ a_1 \end{bmatrix} + c_1e^{2 \pi i \phi_1} \begin{bmatrix} a_2 \\ a_3 \end{bmatrix} = \begin{bmatrix} c_0 e^{2 \pi i \phi_0} a_0 + c_1 e^{2 \pi i \phi_1} a_2 \\ c_0 e^{2 \pi i \phi_0} a_1 + c_1 e^{2 \pi i \phi_1} a_3 \end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way of writing the &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; gate in the matrix form for the above case? The only thing that comes to my mind, is that it should &quot;at the same time&quot; have values &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi_0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi_1}$&lt;/span&gt; on its diagonal, but I know that this reasoning is wrong and I was wondering, if there is some official way to write this down.&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="26" LastEditDate="2018-11-18T13:11:41.440" LastActivityDate="2018-11-19T08:30:17.710" Title="How to properly write the action of a quantum gate implementing an operator $U$ on the superposition of its eigenvectors?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;mathematics&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4747" PostTypeId="1" AcceptedAnswerId="4748" CreationDate="2018-11-17T14:46:45.760" Score="5" ViewCount="248" Body="&lt;p&gt;I am doing a thesis on &quot;Metaheuristics and Quantum Computing&quot;, and was wondering if anyone could recommend some papers/pages&#xA;to read talking about hybrid quantum/classical computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(My idea is to get quantum population, evaluate through classical&#xA;function and then considering the classical evaluation, change the original&#xA;state of qubits to get new quantum sample, and so on and so forth.) &lt;/p&gt;&#xA;" OwnerUserId="5130" LastEditorUserId="124" LastEditDate="2018-11-17T21:48:16.290" LastActivityDate="2018-11-27T15:36:13.543" Title="Resources on hybrid quantum-classical algorithms applied to combinatorial optimization problems" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4748" PostTypeId="2" ParentId="4747" CreationDate="2018-11-17T16:10:55.540" Score="4" Body="&lt;p&gt;So for hybrid quantum-classical algorithms, I suggest looking at :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Quantum Approximate Optimization Algorithm&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1509.04279&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational hybrid quantum-classical algorithms&lt;/a&gt; that include the so famous &lt;a href=&quot;https://developer.ibm.com/dwblog/2017/quantum-computing-qubit-vqe-variational-quantum-eigensolver/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Eigensolver&lt;/a&gt; applied for Max-Cut problems&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://pennylane.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PennyLane&lt;/a&gt; which helps you in developping hybrid computation for optimization problems and Machine Learning. They give a list of references for hybrid computation in their &lt;a href=&quot;https://pennylane.readthedocs.io/en/latest/zreferences.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;references&lt;/a&gt; like the &lt;a href=&quot;https://arxiv.org/abs/1701.01450&quot; rel=&quot;nofollow noreferrer&quot;&gt;Practical optimization for hybrid quantum-classical algorithms&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;List is non exhaustive of course.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-11-17T16:10:55.540" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4749" PostTypeId="1" AcceptedAnswerId="5042" CreationDate="2018-11-17T16:34:49.463" Score="6" ViewCount="788" Body="&lt;p&gt;I am trying to implement VQE in pyQuil and am dumbfounded by how to measure the expectation value of a general Hamiltonian on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n}$&lt;/span&gt; i.e. determine &lt;span class=&quot;math-container&quot;&gt;$\langle\psi , H \psi\rangle$&lt;/span&gt; on a Quantum computer. As far as I understand on a real Quantum Computer (not any quantum virtual machine) I can only measure in the computational basis, which is the basis of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = X = \sum x \left|x\right&amp;gt;\left&amp;lt;x\right|$&lt;/span&gt;, but not for any Hamiltonian whose eigenvectors are not the computational basis. But how do I measure with any Hamiltonian that is not diagonal in the computational basis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure I can measure e.g. some of the qubits in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-basis instead of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis by applying a Hadamard gate to them, but this surely doesn't help me if I want to measure sth. non-local, i.e. if the ground-state of my hamiltonian is an entangled state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On a maybe related note: Can I write any hamiltonian (hermitian matrix) as a Pauli decomposition? I know I can for a single qubit, but does this hold for multiqubits aswell?&lt;/p&gt;&#xA;" OwnerUserId="4850" LastEditorUserId="26" LastEditDate="2019-01-31T19:23:54.187" LastActivityDate="2019-01-31T19:25:05.000" Title="Measuring the Hamiltonian in the VQE" Tags="&lt;programming&gt;&lt;gate-synthesis&gt;&lt;pyquil&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4750" PostTypeId="2" ParentId="4749" CreationDate="2018-11-17T20:25:30.140" Score="1" Body="&lt;p&gt;No. The computational basis is not necessarily the basis that diagonalizes the Hamiltonian. It also looks like you are confusing the X basis with the basis of the Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Advice: You should write it as &lt;span class=&quot;math-container&quot;&gt;$H = \sum \lambda_i | \lambda_i \rangle \langle \lambda_i |$&lt;/span&gt; not with &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; so you don't confuse with the X operator. The right notation will help you avoid confusing yourself.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-11-17T20:25:30.140" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4751" PostTypeId="2" ParentId="4746" CreationDate="2018-11-17T21:02:16.553" Score="1" Body="&lt;p&gt;It would be better to ask this on &lt;a href=&quot;https://www.math.stackexchange.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mathematics Stack Exchange&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; be the unitary matrix that takes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1\\&#xA;0&#xA;\end{pmatrix}&#xA;\to \begin{pmatrix}&#xA;a_0\\&#xA;a_1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;0\\&#xA;1&#xA;\end{pmatrix}&#xA;\to \begin{pmatrix}&#xA;a_2\\&#xA;a_3&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V \begin{pmatrix}&#xA;e^{2\pi i \phi_0} &amp;amp; 0\\&#xA;0 &amp;amp; e^{2 \pi i \phi_1}&#xA;\end{pmatrix} V^\dagger&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;will take &lt;span class=&quot;math-container&quot;&gt;$(a_0,a_1)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(1,0)$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi_0} (1,0)$&lt;/span&gt; and then from there &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi_0} (a_0,a_1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for &lt;span class=&quot;math-container&quot;&gt;$(a_2,a_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple change of basis problem.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2018-11-18T13:11:00.140" LastActivityDate="2018-11-18T13:11:00.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4752" PostTypeId="2" ParentId="2366" CreationDate="2018-11-17T22:41:34.550" Score="3" Body="&lt;p&gt;The paper propounds that quantumizing the unabridged blockchain could address the problem of &lt;a href=&quot;https://www.nationalreview.com/2018/02/quantum-computing-blockchain-technology-threat/&quot; rel=&quot;nofollow noreferrer&quot;&gt;prevailing crisis&lt;/a&gt; to the security of blockchain encryption. While quantum cryptography has been suggested as a workaround for this problem before, the proposed design by Rajan and Visser is novel. They argue that the solution lies in developing a blockchain that rests on quantum particles entangled in time, rather than space. Based on the new structure, any attempt to hack or distort the blockchain would result in the link being destroyed, as entanglement is heavily critical. In their paper, Rajan and Visser explain that by encoding transactions on a quantum particle (or photon), it would be possible to entangle the past information, allowing the chronologically older blocks to vanish once they have been absorbed into the more fresh addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their might be a proper chance of &lt;a href=&quot;https://spectrum.ieee.org/tech-talk/computing/networks/quantum-blockchains-could-act-like-time-machines&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum networked time machine&lt;/a&gt; effect in future based on the current research arena of quantum entanglement in blockchain.&lt;/p&gt;&#xA;" OwnerUserId="5028" LastActivityDate="2018-11-17T22:41:34.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4753" PostTypeId="1" CreationDate="2018-11-18T02:33:56.853" Score="4" ViewCount="53" Body="&lt;p&gt;A common task to perform during quantum computation on the surface code is moving qubits from one place to another. There are standard ways to do this within the surface code, but I was wondering what the actual fundamental limits are. If we forget about the fact that we're using the surface code, and just focus on the fact that we have a planar grid of noisy qubits with nearest-neighbor connections, and a fast classical computer noting measurements and generally helping out, how fast can we move quantum information across that patch?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given an operation failure rate &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, a patch of length L and height H, and the ability operations in parallel with some duration T, how long does it take to move N qubits from the left side of the patch to the right side of the patch?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2018-11-18T13:00:28.077" LastActivityDate="2018-11-18T13:00:28.077" Title="What is the quantum bandwidth of a planar array of noisy qubits, assuming free classical communication?" Tags="&lt;quantum-information&gt;&lt;communication&gt;&lt;surface-code&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="4754" PostTypeId="1" CreationDate="2018-11-18T12:13:01.487" Score="7" ViewCount="1918" Body="&lt;p&gt;How did we derive that the state we get by &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is their tensor product? You can use &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; in the explanation for simplicity.&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-23T12:48:50.713" LastActivityDate="2018-12-23T12:48:50.713" Title="Why is the state of multiple qubits given by their tensor product?" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4755" PostTypeId="2" ParentId="4754" CreationDate="2018-11-18T15:45:17.067" Score="4" Body="&lt;p&gt;This assertion is an axiom of quantum mechanics. It appears, for example, as Postulate 4 on page 94 of &lt;a href=&quot;https://books.google.co.il/books?id=-s4DEy7o-a0C&amp;amp;printsec=frontcover&amp;amp;dq=Nielsen%20and%20Chuang&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=0ahUKEwiozKb3ld7eAhXHZ1AKHYO9A4AQ6wEIKDAA#v=onepage&amp;amp;q=Nielsen%20and%20Chuang&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is considered to be one of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Mathematical_formulation_of_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirac-von Neuman axioms&lt;/a&gt; of quantum mechanics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the quantum system's Hilbert space is defined as the space of &lt;span class=&quot;math-container&quot;&gt;$l^2$&lt;/span&gt; functions on some set, then when the set is a Cartesian product, the corresponding  Hilbert space becomes a tensor product. For example, when you put spins on a lattice &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; as in Kitaev's surface code, then the Systems Hilbert space is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$l^2(\underline{2}^{\Lambda}) = \bigotimes_{\Lambda} \mathbb{C}^2$$&lt;/span&gt;&#xA;Or, when you quantize a system of two particles moving on the line &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt;, the individual particle Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$ L^2(\mathbb{R})$&lt;/span&gt; and the composite system Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$L^2(\mathbb{R} \times \mathbb{R}) $&lt;/span&gt;. It is known that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$L^2(\mathbb{R} \times \mathbb{R}) = L^2(\mathbb{R}) \bigotimes L^2(\mathbb{R}),$$&lt;/span&gt;&#xA;Even though a specific basis of the tensor product &lt;span class=&quot;math-container&quot;&gt;$L^2(\mathbb{R}) \bigotimes L^2(\mathbb{R})$&lt;/span&gt; does not include the entangled states in &lt;span class=&quot;math-container&quot;&gt;$L^2(\mathbb{R} \times \mathbb{R})$&lt;/span&gt;, these states can be constructed from combinations of this basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the above explanation doesn't prove the assertions; it only transfers the problem to the classical spaces before quantization. Then why should they be taken as Cartesian products?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many authors analyzed this problem from the quantum logic point of view, see for example &#xA;&lt;a href=&quot;https://www.researchgate.net/profile/Diederik_Aerts/publication/2928875_Physical_Justification_for_Using_the_Tensor_Product_to_Describe_Two_Quantum_Systems_as_One_Joint/links/00b7d5172a3765d59f000000/Physical-Justification-for-Using-the-Tensor-Product-to-Describe-Two-Quantum-Systems-as-One-Joint.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aerts and Daubechies&lt;/a&gt;. These attempts intend to find a logical equivalent to the above axiom and not to prove it.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2018-11-18T18:36:16.600" LastActivityDate="2018-11-18T18:36:16.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4756" PostTypeId="1" CreationDate="2018-11-18T21:02:16.293" Score="11" ViewCount="306" Body="&lt;p&gt;According to the Wikipedia (Which quotes this paper &lt;a href=&quot;https://arxiv.org/abs/1203.5813&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1203.5813&lt;/a&gt; by Preskill) the definition of Quantum Supremacy is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum supremacy or quantum advantage is the potential ability of&#xA;  quantum computing devices to solve problems that classical computers&#xA;  practically cannot.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On that same paper, Preskill says that a more feasible approach would be to find Quantum Systems that a quantum computer can simulate in polynomic time while a classical computer can't. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Would that situation be enough to prove Quantum Supremacy? How do we know no better classical algorithm exist? Maybe there is a efficient way of simulating that system but we don't know it yet. If this is the case, then proving quantum supremacy is more about proving rigorously that a problem is classically hard than about finding that it is quantumly easy, right?&lt;/p&gt;&#xA;" OwnerUserId="5140" LastActivityDate="2018-11-20T09:50:13.790" Title="Quantum Supremacy: How do we know that a better classical algorithm doesn't exist?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;&lt;quantum-advantage&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4757" PostTypeId="2" ParentId="4756" CreationDate="2018-11-18T22:26:25.480" Score="9" Body="&lt;p&gt;For all we know, it is extraordinarily hard to prove that a problem which can be solved by a quantum computer is classically hard.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that this would solve an important and long-standing open problem in complexity theory, namely whether PSPACE is larger than P.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, any problem which can be solved by a quantum computer in polynomial time can also be solved in polynomial space by a classical computer (the class PSPACE).  However, it is not known whether PSPACE is strictly larger than P (the class of problems efficiently solvable on a classical computer).  This is a long-standing open question in complexity theory, and thus any hardness result as the ones you talk about would also resolve that question, making it an extremely hard problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In fact, there are tighter upper bounds on BQP, most importantly the class PP, but separating PP from P is even harder.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This might be a reason for Preskill's careful formulation&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum supremacy or quantum advantage is the &lt;strong&gt;potential&lt;/strong&gt; ability of quantum computing devices to solve problems that classical computers &lt;strong&gt;practically&lt;/strong&gt; cannot.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It should however be said that this does not mean that we &lt;em&gt;cannot&lt;/em&gt; make any statement about the hardness of certain problems: What we can do is to relate their hardness to the hardness of other problems, for which -- while equally not proven -- there is a lot of accumulated evidence: For instance, it might be known that if problem X is easy, a range of other problems would also be easy, which have long resisted solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, while we cannot unconditionally prove hardness of a problem, it is possible to relate it to the hardness of other problems whose hardness, while also unproven, are far better backed up with evidence.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-11-20T09:50:13.790" LastActivityDate="2018-11-20T09:50:13.790" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4758" PostTypeId="2" ParentId="4754" CreationDate="2018-11-19T08:12:47.043" Score="5" Body="&lt;p&gt;Perhaps it helps to take a step back and start with something simpler:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;why do we tabulate probability amplitudes for state vectors and unitaries?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For a single quantum system with &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; distinct states, labelled 0 to &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt;, we associate a complex number &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; with the probability amplitude for being in state &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. For a unitary, we associate a probability amplitude &lt;span class=&quot;math-container&quot;&gt;$U_{ij}$&lt;/span&gt; with transforming an input &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; into an output &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. We choose to tabulate these as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left(\begin{array}{cccc}&#xA;U_{00} &amp;amp; U_{21} &amp;amp; \ldots &amp;amp; U_{0,d-1} \\&#xA;U_{10} &amp;amp; U_{11} &amp;amp; \ldots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots \\&#xA;U_{d-1,0} &amp;amp; U_{d-1,1} &amp;amp; \ldots &amp;amp; U_{d-1,d-1}&#xA;\end{array}\right)\qquad |\psi\rangle=\left(\begin{array}{c} a_0 \\ a_1 \\ \vdots \\ a_{d-1} \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;for the simple reason that calculating &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt; takes are of the two axioms of quantum theory that tell us how to calculate the output probability amplitudes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;for independent events, the probability amplitude for both events happening is the product of the individual probability amplitudes.&lt;/li&gt;&#xA;&lt;li&gt;for mutually exclusive events, the probability amplitude for either of the two events to happen is the sum of their probability amplitudes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This puts is in a position to answer&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is the state of multiple qubits given by their tensor product?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If two quantum systems have distinguishable states &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, then we can choose to label the states of the composition system by &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt;, meaning that the first system is in state &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and the second system is in state &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. Then, if the two systems start in states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\left(\begin{array}{c} a_0 \\ a_1 \\ \vdots \\ a_{d-1} \end{array}\right) \qquad |\phi\rangle=\left(\begin{array}{c} b_0 \\ b_1 \\ \vdots \\ b_{d-1} \end{array}\right),&#xA;$$&lt;/span&gt;&#xA;then what's the probability amplitude for the overall system to be in &lt;span class=&quot;math-container&quot;&gt;$1,0$&lt;/span&gt;, for example? By the independence axiom, it must be &lt;span class=&quot;math-container&quot;&gt;$a_1b_0$&lt;/span&gt;. Hence, if we tabulate the probability amplitudes using the ordering &lt;span class=&quot;math-container&quot;&gt;$00,01,02,03,\ldots (0,d-1),10,11,\ldots,(1,d-1),20,21,\ldots,(d-1,d-1)$&lt;/span&gt;, the column vector turns out to be exactly &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\otimes|\phi\rangle$&lt;/span&gt;, basically by definition of what the tensor product is. If you do similar things with unitaries &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, you find the composite action is &lt;span class=&quot;math-container&quot;&gt;$U\otimes V$&lt;/span&gt;, and everything is internally consistent, meaning that the outcome of the combined unitary evolution would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(U\otimes V)(|\psi\rangle\otimes|\phi\rangle)=(U|\psi\rangle)\otimes(V|\phi\rangle),&#xA;$$&lt;/span&gt;&#xA;as was explicitly checked &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4484/1837&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-19T08:12:47.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4759" PostTypeId="2" ParentId="4746" CreationDate="2018-11-19T08:30:17.710" Score="2" Body="&lt;p&gt;The most straightforward way to construct the matrix representation of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is to write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=e^{2\pi i\phi_0}|u\rangle\langle u|+e^{2\pi i\phi_1}|v\rangle\langle v|&#xA;$$&lt;/span&gt;&#xA;which will work just fine under the assumption that &lt;span class=&quot;math-container&quot;&gt;$\langle u|v\rangle=0$&lt;/span&gt; (which must be the case if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is going to be unitary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you should also be able to work it out from the maths you were writing down, so long as you impose some of the important properties of the eigenvectors. Firstly, you need &lt;span class=&quot;math-container&quot;&gt;$\langle u|u\rangle=1$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|a_0|^2+|a_1|^2=1$&lt;/span&gt;. Secondly, you need &lt;span class=&quot;math-container&quot;&gt;$\langle u|v\rangle=0$&lt;/span&gt;, as already mentioned. This means that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle=e^{i\gamma}\left(\begin{array}{c}&#xA;-a_1^\star \\ a_0^\star&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, when trying to work out &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, it helps to pick two different sets of &lt;span class=&quot;math-container&quot;&gt;$(c_0,c_1)$&lt;/span&gt;. In the first, we want &lt;span class=&quot;math-container&quot;&gt;$c_0|u\rangle+c_1|v\rangle=\left(\begin{array}{c} 1 \\ 0 \end{array}\right)$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$U\left(\begin{array}{c} 1 \\ 0 \end{array}\right)$&lt;/span&gt; is the first column of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. This is achieved with &lt;span class=&quot;math-container&quot;&gt;$c_0=a_0^\star$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_1=-a_1e^{-i\gamma}$&lt;/span&gt;. Similarly, if we can calculate &lt;span class=&quot;math-container&quot;&gt;$U\left(\begin{array}{c} 0 \\ 1 \end{array}\right)$&lt;/span&gt;, using &lt;span class=&quot;math-container&quot;&gt;$c_0=a_1^\star$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_1=e^{-i\gamma}a_0$&lt;/span&gt;, we find the second column of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-19T08:30:17.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4760" PostTypeId="1" AcceptedAnswerId="4763" CreationDate="2018-11-19T11:52:13.937" Score="4" ViewCount="265" Body="&lt;p&gt;In the discussions about quantum correlations, particularly beyond entanglement (discord, dissonance e.t.c), one can often meet two definitions of mutual information of a quantum system &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt;:&#xA;    &lt;span class=&quot;math-container&quot;&gt;$$&#xA;   I(\rho^{AB}) = S(\rho^A) + S(\rho^B) - S(\rho^{AB})&#xA;	$$&lt;/span&gt;&#xA;    and &#xA;    &lt;span class=&quot;math-container&quot;&gt;$$&#xA;		J(\rho^{AB}) = S(\rho^A)-S_{\{\Pi^B_j\}}(\rho^{A|B}),&#xA;	$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the Von-Neumann entropy, &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho^B$&lt;/span&gt; are the reduced states of the individual subsystems of &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; and the second term in &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; is the quantum analogue of the conditional entropy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_{\{\Pi^B_j\}}(\rho^{A|B}) = \sum_j p_j S(\rho^{A|\Pi^B_j}).&#xA;$$&lt;/span&gt;&#xA;In the expression for the conditional entropy &lt;span class=&quot;math-container&quot;&gt;$\rho^{A|\Pi^B_j} = \text{Tr}_B[\rho^{AB} (\mathbb{I}^A \otimes \Pi^B_j )]/p_j $&lt;/span&gt; are the states of the subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; after getting a particular projector &lt;span class=&quot;math-container&quot;&gt;$\Pi^B_j$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, which happens with a probability &lt;span class=&quot;math-container&quot;&gt;$p_j = \text{Tr}[\rho^{AB} (\mathbb{I}^A \otimes \Pi^B_j ) ]$&lt;/span&gt;. While &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; characterizes the total correlations between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; the second expression involves a measurement process, in which non-classical features of &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; are lost, and therefore &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; characterizes classical correlations in &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While measuring &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; is relatively straightforward, (for 2 qubits one can just measure 4 probabilities &lt;span class=&quot;math-container&quot;&gt;$p(\Pi^A_i \Pi^B_j), \, i,j = 1,2$&lt;/span&gt; and calculate the mutual information of the resulting probability distribution) I can't think of an easy way of estimating &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. So my question is: is it possible to measure &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; without performing a full tomography of &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="5145" LastEditorUserId="10480" LastEditDate="2021-04-05T17:46:18.073" LastActivityDate="2021-04-05T17:46:18.073" Title="Total mutual information of a quantum system" Tags="&lt;measurement&gt;&lt;density-matrix&gt;&lt;information-theory&gt;&lt;entropy&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4761" PostTypeId="1" CreationDate="2018-11-19T13:40:17.253" Score="5" ViewCount="235" Body="&lt;p&gt;I have some very basic questions about stabilizers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I understood:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To describe a state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; that lives in an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Hilbert space, we can either give the wavefunction (so the expression of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;), either give a set of commuting observable that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is an eigenvector with &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We define a stabilizer &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; as a tensor product of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Pauli matrices (including the identity) that verifies &lt;span class=&quot;math-container&quot;&gt;$M |\psi \rangle = |\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And (apparently) we need &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; stabilizers to fully define a state.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The things I don't understand:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can a stabilizer necessarily be a product of Pauli matrices?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt;, I take &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha | 0 \rangle + \beta |1 \rangle$&lt;/span&gt;, excepted for specific values of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, this state is only an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; (not of the other pauli matrices). But saying &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the stabilizer doesn't give me which state I am working for.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;How can we need only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; stabilizers to fully define a state?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits we have &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; dimensional Hilbert space. I thus expect to have &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; stabilizers, not &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; to fully describe a state.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am looking for a simple answer. Preferably an answer based on the same materials as my question, if possible. I am really a beginner in quantum error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I learned these things within a 1-hour tutorial, so I don't have references for which book I learned this from. It is what I understood (maybe badly) from the professor talking.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="26" LastEditDate="2018-11-19T13:57:06.020" LastActivityDate="2018-11-20T08:32:11.013" Title="Stabilizer for quantum error correction code" Tags="&lt;error-correction&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4762" PostTypeId="2" ParentId="4761" CreationDate="2018-11-19T14:48:12.650" Score="2" Body="&lt;p&gt;Here are a couple of observations which will hopefully clarify things.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Only some states have Pauli stabilisers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have correctly identified that not all states have Pauli stabilisers. An example of a state that does not have any Pauli stabilisers (apart from the identity operator of course, which we typically ignore) is &lt;span class=&quot;math-container&quot;&gt;$\lvert A \rangle = \tfrac{1}{\sqrt 2}\bigl( \lvert 0 \rangle + \mathrm{e}^{i \pi /4} \lvert 1 \rangle \bigr)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, a &lt;em&gt;quantum error correction code&lt;/em&gt; is not a single state: it is a &lt;em&gt;subspace&lt;/em&gt; of some larger state-space. &lt;em&gt;Some&lt;/em&gt; subspaces can be described as the &lt;em&gt;set of states&lt;/em&gt; which are stabilised by a set of commuting operators from the Pauli group, on some number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of qubits.&#xA;That set of stabilising operators forms an abelian subgroup of the Pauli group, and is referred to as a &lt;em&gt;stabiliser group&lt;/em&gt;. &#xA;If the stabiliser group has &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; generators, then the dimension of the subspace which they jointly stabilise is &lt;span class=&quot;math-container&quot;&gt;$2^{n-r}$&lt;/span&gt;.&#xA;In the case that &lt;span class=&quot;math-container&quot;&gt;$r = n$&lt;/span&gt;, the space which you stabilise has dimension &lt;span class=&quot;math-container&quot;&gt;$2^0 = 1$&lt;/span&gt;, which means that you &lt;em&gt;have&lt;/em&gt; identified a single state (representing in this case a somewhat degenerate example of an error correcting code, because it is 'encoding' zero qubits of information).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; stabiliser generators are needed to characterise a state, because for each independent stabiliser (each operator for which you impose the restriction to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, which cannot be formed as a product of the other operators), you are essentially removing one qubit's worth of freedom from the range of states that you can have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is of course the intuitive description. More formally &amp;mdash; given that we are talking about commuting operators selected from the Pauli group &amp;mdash; a more formal way of seeing this is that &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For any commuting set of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; independent Pauli operators &lt;span class=&quot;math-container&quot;&gt;$\{P_1,P_2,\ldots,P_r\}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, there is a Clifford group operation &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$C P_j P^\dagger = Z_j$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$1 \leqslant j \leqslant r$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$Z_j$&lt;/span&gt; is the single-qubit &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator acting only on qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The set of Pauli operators &lt;span class=&quot;math-container&quot;&gt;$\{ Z_1, Z_2, \ldots, Z_k \}$&lt;/span&gt;, as a set of stabilisers, describe a set of states in which qubit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is fixed to the state &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt;, qubit &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is also fixed to the state &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt;, and so forth up to qubit &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;; the more of these operators there are, the more qubits there are with fixed states, and the fewer degrees of freedom there are in the states which satisfy those constraints. In particular, the subspace of states satisfying this property has dimension &lt;span class=&quot;math-container&quot;&gt;$2^{n-r}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The error correcting code is related to this second set of states with single-qubit constraints by a unitary transformation, which preserves the dimension of subspaces by virtue of being invertible. Thus, the error correcting code also has dimension &lt;span class=&quot;math-container&quot;&gt;$2^{n-r}$&lt;/span&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Each added stabiliser generator can be said to remove one qubit of freedom from the state-space, in the sense of the formal argument above. In particular, any set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; independent commuting Pauli stabilisers on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, will characterise &lt;em&gt;some&lt;/em&gt; single state (though, as observed above, not all states do have such a representation).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-11-20T08:32:11.013" LastActivityDate="2018-11-20T08:32:11.013" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4763" PostTypeId="2" ParentId="4760" CreationDate="2018-11-19T16:27:30.250" Score="5" Body="&lt;p&gt;The mutual information can be written in terms of the relative entropy, please see &#xA;&lt;a href=&quot;https://books.google.co.il/books?id=-s4DEy7o-a0C&amp;amp;printsec=frontcover&amp;amp;dq=Nielsen%20and%20Chuang&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=0ahUKEwiozKb3ld7eAhXHZ1AKHYO9A4AQ6wEIKDAA#v=onepage&amp;amp;q=Nielsen%20and%20Chuang&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt; (the entropy Venn diagram figure 11.2). I am writing the equation in the question's notation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I(\rho^{AB}) = S(\rho^{AB}|\rho^{A} \otimes \rho^{B})$$&lt;/span&gt; &#xA;The relative entropy can be estimated without full tomography. The procedure is described in &lt;a href=&quot;https://www.researchgate.net/profile/Karol_Zyczkowski/publication/258239605_Geometry_of_Quantum_States/links/56a20af808ae24f627048c51.pdf&quot; rel=&quot;noreferrer&quot;&gt;Bengtsson and Życzkowski&lt;/a&gt; (equation 12.55-12.59) based on Lindblad's &lt;a href=&quot;https://projecteuclid.org/download/pdf_1/euclid.cmp/1103860161&quot; rel=&quot;noreferrer&quot;&gt;work&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The estimation procedure for the estimation of &lt;span class=&quot;math-container&quot;&gt;$S(\rho|\sigma)$&lt;/span&gt; is performed as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Preparation of a composite system:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^N = \otimes^{N} \rho$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measurement a set of POVMs &lt;span class=&quot;math-container&quot;&gt;$\{E\}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_i = \operatorname{Tr}(\rho^N E_i)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$q_i = \operatorname{Tr}(\sigma^N E_i)$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Computation of the &quot;Classical&quot; relative entropy:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_N(\rho|\sigma) = \frac{1}{N} \sum_i p_i \log{\frac{p_i}{q_i}}$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The relative entropy is estimated by optimization over a large set of POVMs and for a large number of copies &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; due to the result:&#xA; &lt;span class=&quot;math-container&quot;&gt;$$ S(\rho|\sigma) =  \lim_{N\rightarrow \infty}\operatorname{Sup}_E S_N(\rho|\sigma)  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, as in any statistical estimation, there are estimation errors due to finite samples, however, I don't know how to obtain these error bounds.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-11-19T16:27:30.250" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="4764" PostTypeId="2" ParentId="4754" CreationDate="2018-11-19T16:47:54.257" Score="1" Body="&lt;p&gt;I'll attempt here to provide a physical justification for why tensor products are the natural way to describe systems comprised of a number of different subsystems (e.g. a number of qubits).&#xA;The takeaway message is that tensor products, while &lt;em&gt;not&lt;/em&gt; strictly necessary, are a natural choice when dealing with &lt;em&gt;local operations&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, it is important to notice that &lt;em&gt;it is not strictly necessary to use tensor products at all to describe any kind of quantum mechanical system&lt;/em&gt;.&#xA;It just so happens that not using them makes things much more complicated and inelegant that they could be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this, I mean that we &lt;em&gt;can&lt;/em&gt; describe, say, the state of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit system, as a &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt;-dimensional complex vector (a &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt;-dimensional qudit if you prefer) with no tensor product structure. If you choose to describe things this way, unitary operations, as well as any other operator acting on states, become &lt;span class=&quot;math-container&quot;&gt;$2^N\times 2^N$&lt;/span&gt; matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if we are talking of &quot;&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits&quot;, instead of simply a single system with many degrees of freedom, we are implicitly assuming that we will deal with &lt;em&gt;local operations&lt;/em&gt;. Local operations are operations that act only on some subset of the degrees of freedom of the system, leaving the rest untouched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, if you have a system which is composed of two subsystems, each of which can be in one of a number of different states, it is only natural to describe the whole system in terms of the states of the single subsystems. Therefore, if the first system can be in one of the states &lt;span class=&quot;math-container&quot;&gt;$i=1,2,...,N$&lt;/span&gt; and the second system in one of &lt;span class=&quot;math-container&quot;&gt;$j=1,2,...,M$&lt;/span&gt;, then a natural choice for the basis states of the whole system is the set of &lt;span class=&quot;math-container&quot;&gt;$NM$&lt;/span&gt; pairs &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider as a toy example a system with &lt;span class=&quot;math-container&quot;&gt;$N=6$&lt;/span&gt; degrees of freedom (a &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;-dimensional qudit), which is obtained by combining a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-dimensional system with a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-dimensional one. Without tensor products, it is awkward to describe a local operation acting only on the first subsystem: states would be described as single-index vectors &lt;span class=&quot;math-container&quot;&gt;$\psi_i\in\mathbb C$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1,...,6$&lt;/span&gt; and operations as matrices &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_{ij}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$i,j=1,...,6$&lt;/span&gt;, and a local operation would be some &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_{ij}$&lt;/span&gt; is always zero when &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; are indices corresponding to two different states of the second subsystem, assuming some conventional way to arrange the indices.&#xA;On the other hand, if you describe the state as an object &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij}\in\mathbb C$&lt;/span&gt;  with &lt;span class=&quot;math-container&quot;&gt;$i=1,2,3$&lt;/span&gt; describing the states of the first subsystem and &lt;span class=&quot;math-container&quot;&gt;$j=1,2$&lt;/span&gt; describing the state of the second subsystem, an operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; acting locally on the first subsystem is naturally written as one satisfying &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_{ij,kl}=U_{ij}\delta_{kl}$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can then proceed with building the mathematical infrastructure to reason formally about tensor product spaces etc., but from a physical perspective, this is all there is to it. It is a convenient way to describe systems which are comprised of subsystems in such a way that it is natural to describe the state of the whole system via the tuples of states of the subsystems.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-11-19T16:47:54.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4765" PostTypeId="1" AcceptedAnswerId="4767" CreationDate="2018-11-19T21:18:29.120" Score="2" ViewCount="114" Body="&lt;p&gt;I've written an API which takes in a circuit scaffold, according to some specifications, and outputs the results of simulating the circuit.  The circuit constraints are that the measurements are performed optionally at the end.  I want to test the API against known quantum circuit results.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if there was a online resource which tabulates a list of known circuits and their results/outputs?  An online quantum simulator would also work.&lt;/p&gt;&#xA;" OwnerUserId="1287" LastEditorUserId="26" LastEditDate="2018-11-19T21:55:50.697" LastActivityDate="2018-11-20T14:48:17.113" Title="List of known circuits and their expected output" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4766" PostTypeId="2" ParentId="4756" CreationDate="2018-11-19T22:53:00.450" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How do we know no better classical algorithm exist?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We &lt;em&gt;can&lt;/em&gt; know thanks to &lt;a href=&quot;https://en.wikipedia.org/wiki/Computational_complexity_theory&quot; rel=&quot;noreferrer&quot;&gt;computational complexity theory&lt;/a&gt;, which studies the complexity of solving different problems with different computational models.&#xA;It is in principle possible to prove that &lt;em&gt;no&lt;/em&gt; classical algorithm can solve a given problem efficiently.&#xA;A common way to do it is using &lt;a href=&quot;https://en.wikipedia.org/wiki/Reduction_(complexity)&quot; rel=&quot;noreferrer&quot;&gt;reductions&lt;/a&gt;, that is, proving that solving a given problem is equivalent to solving another problem. One might thus prove that if it were possible to solve efficiently some kind of problem with a classical computer, it would also be possible to solve efficiently another problem which might be known to be hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as pointed out in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4757/55&quot;&gt;the other answer&lt;/a&gt;, this is much easier said than done. A thorough discussion would be out of place here, but the main issue is that there are some big open problems at the core of computational complexity theory which no one has been able to solve yet (most notably the &lt;a href=&quot;https://en.wikipedia.org/wiki/P_versus_NP_problem&quot; rel=&quot;noreferrer&quot;&gt;P vs NP problem&lt;/a&gt;). &#xA;While unproven, many of these problems correspond to assumptions which are widely believed to hold (e.g. that P&lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt;NP). Many other results have then been proven conditionally to these assumptions holding.&#xA;By reflection, these results also do not constitute complete proofs, but they can still be regarded as strong evidence for something to be true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the current situation with &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_supremacy&quot; rel=&quot;noreferrer&quot;&gt;quantum supremacy&lt;/a&gt;. There are problems which have been &quot;proven&quot; to be impossible to solve/simulate efficiently with a classical device, but for which efficient solutions are possible with a quantum computer, where &quot;proven&quot; here means that is has been shown that if these problems were efficiently solvable classically, then there would be unexpected consequences for some complexity classes. Notable examples are &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;noreferrer&quot;&gt;boson sampling&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1005.1407&quot; rel=&quot;noreferrer&quot;&gt;simulating commuting circuits&lt;/a&gt;. &lt;a href=&quot;https://cstheory.stackexchange.com/q/32817/29288&quot;&gt;This post on cstheory.SE&lt;/a&gt; gives some other examples of such problems. A recent review on the topic is &lt;a href=&quot;https://arxiv.org/abs/1809.07442&quot; rel=&quot;noreferrer&quot;&gt;1809.07442&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-11-19T22:53:00.450" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4767" PostTypeId="2" ParentId="4765" CreationDate="2018-11-20T01:19:51.300" Score="2" Body="&lt;p&gt;Maybe &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; would suit your needs? It's an in-browser, graphical quantum-circuit simulator. You can build your circuit with drag-and-drop and it will show the probabilities of measurements. However, there is a limit to the number of qubits you can simulate. I think it is 16 or so.&lt;/p&gt;&#xA;" OwnerUserId="4657" LastEditorUserId="4657" LastEditDate="2018-11-20T14:48:17.113" LastActivityDate="2018-11-20T14:48:17.113" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4769" PostTypeId="1" AcceptedAnswerId="4771" CreationDate="2018-11-20T09:25:26.387" Score="6" ViewCount="997" Body="&lt;p&gt;Firstly, I'd like to specify my goal: to know why QFT runs exponentially faster than classical FFT.&#xA;I have read many tutorials about QFT (Quantum Fourier Transform), and &lt;a href=&quot;http://d.umn.edu/~vvanchur/2015PHYS4071/Chapter5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; tutorial somehow explains something important between classical and quantum Fourier Transform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Inside &lt;a href=&quot;http://d.umn.edu/~vvanchur/2015PHYS4071/Chapter5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, it describes that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The quantum Fourier transform is based on essentially the same idea with the only difference that the vectors x and y are state vectors (see formula 5.2, 5.3), &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yLhvD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yLhvD.png&quot; alt=&quot;formulas 5.2, 5.3, 5.4, and 5.5 from the mentioined pdf file&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I couldn't catch up the statement regarding &quot;x and y are state vectors&quot;; I get stuck at the formula 5.2 and 5.3.&#xA;I want to know how to convert the classical input vector x to the right hand side of the formula 5.2.&#xA;If this confusing problem is solved, it'll be better for me to understand the time complexity issue of QFT.  &lt;/p&gt;&#xA;" OwnerUserId="5152" LastEditorUserId="26" LastEditDate="2018-11-20T14:01:47.423" LastActivityDate="2018-11-20T14:01:47.423" Title="How to describe, or encode, the input vector x of Quantum Fourier Transform?" Tags="&lt;algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4770" PostTypeId="2" ParentId="4769" CreationDate="2018-11-20T09:53:22.783" Score="5" Body="&lt;p&gt;You don't convert a classical input to the r.h.s. of Eq. (5.2).  The r.h.s. of Eq. (5.2) is something you get as the output of a preceding quantum computation &lt;em&gt;as a quantum state&lt;/em&gt;, such as in Shor's algorithm.  This is the only way to get an exponential speedup -- if you had to start from an exponentially big classical vector, there would be no way to solve this in polynomial time.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-11-20T09:53:22.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4771" PostTypeId="2" ParentId="4769" CreationDate="2018-11-20T09:55:35.763" Score="6" Body="&lt;p&gt;Formula 5.2 refers to an encoding we call amplitude encoding. Imagine you have a vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with components &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, the components are then encoded as amplitudes of a quantum state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This encoding is very important as a vector that has a dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, will be encoded in quantum form using about &lt;span class=&quot;math-container&quot;&gt;$log(N)$&lt;/span&gt; qubits. This is the main reason why in many quantum algorithms using this encoding we can achieve exponential speedup in the size of the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, generally in quantum computing, you have to assume that this encoding is done using a device called quantum random access memory for loading in this form a vector. Or you are given a circuit that do the job for you.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-11-20T11:10:10.153" LastActivityDate="2018-11-20T11:10:10.153" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4772" PostTypeId="1" CreationDate="2018-11-20T10:01:02.377" Score="2" ViewCount="75" Body="&lt;p&gt;Recently I have started to read about network quantum information theory, where network problems are studied under the classical-quantum channel. For example, capacities of the cq-MAC, cq-broadcast or the cq-interference cannels are studied to characterize the maximum achievable rates possible in such communication scenarios. I found Ivan Savov's &lt;a href=&quot;http://digitool.library.mcgill.ca/webclient/StreamGate?folder_id=0&amp;amp;dvs=1542704345080~4&quot; rel=&quot;nofollow noreferrer&quot;&gt;PhD thesis&lt;/a&gt; to be a really interesting document regarding this issues, and very recommendable for anyone interested to start to study network quantum information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in chapter 4.3.1 the author states a conjecture called &lt;em&gt;the three sender quantum simultaneous decoder conjecture&lt;/em&gt;, where the existence of a POVM decoder for a cq-channel with three senders is conjectured. Such result is very important to proof most of the results of the thesis and it is an important result in general for network quantum information theory. However, at the time it was unproved, and so it remained as a conjecture. I have been researching to see if such cojecture has been proved, but I have been unable to find a general proof for it (in &lt;a href=&quot;https://arxiv.org/pdf/1102.2624.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical communication over a quantum interference channel&lt;/a&gt; it is proved for an special case, but not in a general way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, I was wondering if such conjecture has already been proved and so if it has been, I would like to go through such proof. Note that both references I gave are from 2012, so I assume that advances in the issue have been done by this point.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2019-01-01T09:16:56.800" LastActivityDate="2019-01-01T09:16:56.800" Title="Three sender quantum simultaneous decoder conjecture" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;&lt;quantum-networks&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4773" PostTypeId="1" CreationDate="2018-11-20T10:28:44.077" Score="4" ViewCount="81" Body="&lt;p&gt;I have an interesting idea for a proof approach that someone might find useful. Here it is.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we are given a quantum qubit channel &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (for example the amplitude damping channel) whose Holevo information we are trying to prove is additive for two uses, i.e, we are trying to show that &lt;span class=&quot;math-container&quot;&gt;$\chi_{N \otimes N} = 2 \chi_N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the channel &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and another channel &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; that we know has strongly additive Holevo information, suppose we construct a channel &lt;span class=&quot;math-container&quot;&gt;$N^\prime$&lt;/span&gt; that simulates the channel &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$(\chi_{N \otimes N} - 2 \chi_N)$&lt;/span&gt;, and simulates the channel &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1 - (\chi_{N \otimes N} - 2 \chi_N)$&lt;/span&gt;, i.e, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$N^\prime = (\chi_{N \otimes N} - 2 \chi_N) N + (1 - (\chi_{N \otimes N} - 2 \chi_N))M.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for qubit channels &lt;span class=&quot;math-container&quot;&gt;$\chi_{N \otimes N} \leq 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\chi_N \leq 1$&lt;/span&gt;, so the assumption that &lt;span class=&quot;math-container&quot;&gt;$(\chi_{N \otimes N} - 2 \chi_N) \leq 1$&lt;/span&gt; -- and so can be used as a probability -- is reasonable.&#xA;From the construction of the channel, we can see that if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is additive, then &lt;span class=&quot;math-container&quot;&gt;$(\chi_{N \otimes N} - 2 \chi_N) = 0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$N^\prime$&lt;/span&gt; is strongly additive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was the idea; to use &lt;span class=&quot;math-container&quot;&gt;$(\chi_{N \otimes N} - 2 \chi_N)$&lt;/span&gt; in the construction of a new channel. May be this idea, or a variant of it, can be used to prove something. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be interested to know about similar ideas that have been used in proofs before.&lt;/p&gt;&#xA;" OwnerUserId="1860" LastEditorUserId="26" LastEditDate="2019-01-01T09:15:42.447" LastActivityDate="2019-01-01T09:15:42.447" Title="Quantum channel Holevo information additivity: proof approach" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4774" PostTypeId="1" CreationDate="2018-11-20T11:15:49.627" Score="7" ViewCount="1261" Body="&lt;p&gt;Let's say you have a system with which you can perform arbitrary rotations around the X and Z axis. How would you then be able to use these rotations to obtain an arbitrary rotation around the Y axis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen somewhere that rotation around an arbitrary axis can be achieved by doing three rotations around two fixed axis, that is, &lt;span class=&quot;math-container&quot;&gt;$$\hat{R}_\vec{n}(\theta)=R_Z(\gamma)R_X(\beta)R_Z(\alpha)$$&lt;/span&gt; for some angles &lt;span class=&quot;math-container&quot;&gt;$\gamma, \alpha, \beta$&lt;/span&gt;. But how do you actually use this? What if I want to rotate around the Y axis with an angle of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$\hat{R}_Y(\theta)$&lt;/span&gt;? Then how do I figure out what &lt;span class=&quot;math-container&quot;&gt;$\gamma,\alpha,\beta$&lt;/span&gt; to use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I've found a &lt;a href=&quot;https://physics.stackexchange.com/questions/442133/how-to-obtain-y-rotation-with-only-x-and-z-rotation-gates-on-the-bloch-sphere/442139#442139&quot;&gt;nice answer&lt;/a&gt; on Physics SE. &lt;/p&gt;&#xA;" OwnerUserId="5153" LastEditorUserId="26" LastEditDate="2018-11-20T13:49:34.760" LastActivityDate="2018-12-19T11:10:15.580" Title="How to obtain Y rotation with only X and Z rotations gates?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4775" PostTypeId="2" ParentId="4774" CreationDate="2018-11-20T12:07:35.227" Score="2" Body="&lt;p&gt;Try selecting &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; so that you get the rotation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{Z}R_X(\beta)\sqrt{Z}^\dagger.&#xA;$$&lt;/span&gt;&#xA;There's two little tricks here that make this work. Firstly, the &lt;span class=&quot;math-container&quot;&gt;$R_X(\beta)$&lt;/span&gt; has an &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; component and an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; component (I always get factors of &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; wrong here, so I won't write out the cos and sin functions explicitly unless you define your &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; function). Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{Z}\mathbb{I}\sqrt{Z}^\dagger=\mathbb{I}&#xA;$$&lt;/span&gt;&#xA;while there's some funky anti-commutation that goes on with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{Z}X\sqrt{Z}^\dagger=ZX=iY,&#xA;$$&lt;/span&gt;&#xA;so you've managed to effectively change the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; into a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, so you're getting &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; rotations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this doesn't answer your more general question about how you get a more general rotation....&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-20T12:07:35.227" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4776" PostTypeId="1" AcceptedAnswerId="4781" CreationDate="2018-11-20T16:39:18.090" Score="1" ViewCount="114" Body="&lt;p&gt;I have recently read a lot about the BB84 protocol, I have used three primary sources, the original work, a QK book, and a diploma thesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions refer to the photons sent by Alice, the base of Bob and a possible attack on the protocol (MITM attack).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question is about sending the photons from Alice to Bob. The original paper states that Alice sends a single photon in one out of four polarization directions, my question. How does Alice know the direction of the photon? I imagine that I look at a single unpolarized photon, this is sent through a random filter. But there are cases in which a photon does not come through a filter (photon has 90° and the filter is 0°). So how does Alice know if a photon is ever sent? How can she even produce a single say we make a vertically polarized photon?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second question is based on Bob, in the original paper, only Bob is measured in one of two possible bases (0°, 90°) or (45° and -45°). In my second source (the book), however, it is stated that Bob simply uses a filter from the respective base. I'll explain it a bit more carefully: The statement of the book is that Bob measures (always) at 90° or 45°. But now the diploma thesis, which I use as a third source, says that Bob uses 0°, 90° 45° -45° as a filter for the detection at random. I understand both possibilities, because assuming a photon comes in 90° and I measure in 0° then I can indeed from the non-detection conclude that the photon has been polarized in 90° direction. So I suspect the statements are equivalent, both in the book and in the thesis. Is it correct that way? and what does measuring in a base mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My third question relates to a possible attack. I have read a paper in which a MITM (man-in-the-middle) attack is carried out. My book source also lists this attack. But in what way is that an attack scenario, if only I have to authenticate the connection? Then the actual attack is still witless?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope my questions are understandable. It is important for me to understand that. I am looking forward to your answers. If I should explain one or the other in more detail, then, of course, I would correct my question and specify. Thanks so far!&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2018-11-20T19:14:31.003" LastActivityDate="2018-11-21T08:17:27.303" Title="Comprehension questions on quantum cryptography especially BB84" Tags="&lt;quantum-information&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4778" PostTypeId="1" AcceptedAnswerId="4780" CreationDate="2018-11-20T21:13:14.443" Score="2" ViewCount="458" Body="&lt;p&gt;I recently came across the concepts of operators. However with current my knowledge I am unable to solve the following problem.Given an operator &lt;span class=&quot;math-container&quot;&gt;$$\vec{A}=\frac{1}{2}(I+\vec{n}.\vec{\sigma})$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\vec{n}=n_x\hat{x}+n_y\hat{y}+n_z\hat{z}$&lt;/span&gt; is a unit vector and  &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}=\sigma_x\hat{x}+\sigma_y\hat{y}+\sigma_z\hat{z}$&lt;/span&gt; in usual Pauli matrices notation, under what condition on &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt;, is  &lt;span class=&quot;math-container&quot;&gt;$\vec{A}$&lt;/span&gt; is a positive operator and in other condition &lt;span class=&quot;math-container&quot;&gt;$\vec{A}$&lt;/span&gt; is a projection operator. &lt;/p&gt;&#xA;" OwnerUserId="5007" LastEditorUserId="26" LastEditDate="2018-11-21T06:38:39.727" LastActivityDate="2018-11-21T07:49:30.400" Title="Projection operators and positive operators" Tags="&lt;mathematics&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4779" PostTypeId="1" CreationDate="2018-11-21T05:19:59.517" Score="2" ViewCount="71" Body="&lt;p&gt;Recently, I was reading a paper (&lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1804.03719&lt;/a&gt; [cs.ET]), which had the following quote (the most relevant part has been bolded),&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum algorithms are often grouped into number-theory-based, Oracle-based, and quantum simulation algorithms, such as for instance on the excellent Quantum Zoo site [57], which is largely based on the main quantum algorithmic paradigm that these algorithms use. These paradigms are the Quantum Fourier Transform (QFT), the Grover Operator (GO), the Harrow/Hassidim/Lloyd (HHL) method for linear systems, variational quantum eigenvalue solver (VQE), and direct Hamiltonian simulation (SIM). The fact that most known quantum algorithms are based on these few paradigms in combination is remarkable and perhaps surprising. &lt;strong&gt;The discovery of additional quantum algorithm paradigms, which should be the subject of intense research, could make quantum algorithms applicable across a much wider range of applications.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am very interested in exploring the topic of quantum algorithm paradigms. However, my usual approach of following the reference trail failed to unearth any relevant papers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anyone has any suggestions regarding where to look, or know any relevant papers, I would appreciate your input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5157" LastEditorUserId="26" LastEditDate="2018-11-21T06:37:46.350" LastActivityDate="2018-11-21T06:37:46.350" Title="Pointer to related research (paper)" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;research&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4780" PostTypeId="2" ParentId="4778" CreationDate="2018-11-21T07:49:30.400" Score="4" Body="&lt;p&gt;This is really a question about eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A projector has eigenvalues 1 and 0. So, for a qubit, that could be eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{1,1\}$&lt;/span&gt; or eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{1,0\}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A positive operator is one for which all eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; satisfy &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;gt;0$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;One could calculate the eigenvalues by brute force, but there are a couple of tricks that will help you. Firstly, the trace is equal to the sum of the eigenvalues&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(A)=\sum_{i=1}^2\lambda_i.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reader exercise: justify that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(A)=\frac12$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, it is impossible that the projector has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{1,1\}$&lt;/span&gt; (this should be obvious, as that can only give you &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt;). We're looking for the projector to have eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{1,0\}$&lt;/span&gt;. Note also that this must be the edge case for positivity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to progress with the calculation of the eigenvalues, evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(A\cdot A)=\sum_{i=1}^2\lambda_i^2=\lambda_1^2+\left(\frac12-\lambda_1\right)^2.&#xA;$$&lt;/span&gt;&#xA;To answer the specific question, we don't need a full calculation of the eigenvalues. Instead, we just need to know when &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(A\cdot A)=1$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{Tr}(A\cdot A)&amp;amp;=\frac{1}{4}\text{Tr}\left((\mathbb{I}+\vec{n}\cdot\vec{\sigma})(\mathbb{I}+\vec{n}\cdot\vec{\sigma})\right) \\&#xA;&amp;amp;=\frac{1}{4}\text{Tr}\left(\mathbb{I}+2\vec{n}\cdot\vec{\sigma}+(\vec{n}\cdot\vec{\sigma})(\vec{n}\cdot\vec{\sigma})\right) \\&#xA;&amp;amp;=\frac12+\frac14\text{Tr}\left((\vec{n}\cdot\vec{\sigma})(\vec{n}\cdot\vec{\sigma})\right)&#xA;\end{align}&lt;/span&gt;&#xA;Reader Exercise: Justify that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}\left((\vec{n}\cdot\vec{\sigma})(\vec{n}\cdot\vec{\sigma})\right)=2\vec{n}\cdot\vec{n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the condition for being a projector is &lt;span class=&quot;math-container&quot;&gt;$|\vec{n}|=1$&lt;/span&gt;, and the condition for being positive is &lt;span class=&quot;math-container&quot;&gt;$|\vec{n}|&amp;lt;1$&lt;/span&gt;, although I would suggest that of more relevance for density matrices is the positive semi-definite condition: &lt;span class=&quot;math-container&quot;&gt;$|\vec{n}|\leq 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-21T07:49:30.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4781" PostTypeId="2" ParentId="4776" CreationDate="2018-11-21T08:17:27.303" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How does Alice know the direction of the photon?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You're talking about the photons as if we've just magically plucked them out of the air with no idea what polarisation they're in. In practice, we're producing the photons. A source of individual photons that can be produced 'on demand' is still an experimental challenge (not that I'm completely up to date with the latest experimental literature). But the point is that we have systems that produce photons for us, and they can produce polarised photons. For example, &lt;a href=&quot;https://physics.stackexchange.com/questions/183216/is-the-output-of-a-laser-pointer-polarized-or-not&quot;&gt;some designs of laser&lt;/a&gt; produce polarised outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way that could help you think of this (although I don't think people really do this), is imagine you have a photon going along a path. If you put a polarising beamsplitter in the way, then you direct one output to a detector. If that detector doesn't click then (if it's a perfect detector), the photon is travelling along the other path in the opposite polarisation.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I suspect the statements are equivalent&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, they are. The overall protocol is to make a random choice of which basis you want (0/90 or &lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt;45) and then perform that basis measurement. This is basically the same as the original statement. Those individual measurements could be made using a polarising beamsplitter with detectors on both outputs of the beamsplitter, or you could just put the detector on one output and assume that if you don't get a hit, it was the other outcome. At that point, you can use a filter instead of the beamsplitter because, either way, you just lose the other polarisation. So, the random basis choice is making a random choice between whether you're using a 0 or a 45 degree filter. This is the same as the book's statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equally, using the combination of 0,90,&lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt;45 will achieve just the same, it's just more complicated than necessary (because 90 will always give the opposite result to 0, so why not just use 0?).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what does measuring in a base mean?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's a much bigger question which deserves a much fuller answer than I can reasonably give as a sub-answer, and would preferably require some mathematical formalism. Still, to give you a sense: in quantum, when you want to ask a system what its state is, you can only ask limited questions. You cannot ask &quot;what is the polarisation angle of the photon?&quot; but, instead, you can ask if it's in one of two perpendicular directions, such as 0 and 90, and get the answer with varying probabilities.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But in what way is that an attack scenario, if only I have to authenticate the connection? Then the actual attack is still witless?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't really understand what you're asking here. Of course, the point of the protocol is to make sure that a man in the middle attack cannot work. But you have to prove that, and this helps give insight as to why the quantum protocol is a good one. The sort of thing that might go on is that Eve, sat in the middle between Alice and Bob, can take an (approximate) copy of the photons as they zoom past, and later use her copies to get as much information about the key shared between Alice and Bob as possible. The point is that Eve trying to do this has a knock-on effect on what Bob measures, and so Eve's meddling is detectable. In principle, they can even estimate how much she might know, and perform a protocol called privacy amplification to reduce that knowledge arbitrarily.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-21T08:17:27.303" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4782" PostTypeId="1" AcceptedAnswerId="4784" CreationDate="2018-11-21T08:54:22.883" Score="1" ViewCount="480" Body="&lt;p&gt;I saw some related topics, but none of them give step by step instructions on measuring in standard basis (or some other basis). Could you please give such instructions? Giving an example would be good, too.&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-11-21T09:00:29.907" LastActivityDate="2018-11-21T13:53:39.997" Title="How to measure in the standard basis?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4783" PostTypeId="1" CreationDate="2018-11-21T09:21:01.870" Score="1" ViewCount="291" Body="&lt;p&gt;I wonder what the steps for encoding a qubit in a certain basis are (you can give your answer in terms of the standard basis for simplicity). Example and a little explanation about steps would be great.&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-11-21T10:29:12.807" LastActivityDate="2020-01-19T15:00:09.467" Title="How to encode a qubit in standard basis?" Tags="&lt;quantum-state&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4784" PostTypeId="2" ParentId="4782" CreationDate="2018-11-21T12:46:50.787" Score="3" Body="&lt;p&gt;Measurements have corresponding measurement operators, &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt;, satisfying&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_iP_i=\mathbb{I}.&#xA;$$&lt;/span&gt;&#xA;Often, we talk about projective measurements, meaning &lt;span class=&quot;math-container&quot;&gt;$P_i^2=P_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, measurement in the standard basis means setting&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0=|0\rangle\langle 0|\equiv \left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{array}\right)\qquad P_1=|1\rangle\langle 1|\equiv \left(\begin{array}{cc} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we measure a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, it gives outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_i=\langle\psi|P_i|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;and the state of the system (for a non-destructive measurement) is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_i|\psi\rangle/\sqrt{p_i}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's take &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;. We get outcome 0 with probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_0=(\alpha^\star\langle 0|+\beta^\star\langle 1|)|0\rangle\langle 0|(\alpha|0\rangle+\beta|1\rangle)=|\alpha|^2,&#xA;$$&lt;/span&gt;&#xA;and the remaining state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 0|(\alpha|0\rangle+\beta|1\rangle)/|\alpha|=e^{i\text{Arg}(\alpha)}|0\rangle.&#xA;$$&lt;/span&gt;&#xA;Up to an irrelevant global phase, the outcome is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you don't need the full formalism of projectors to get this. If you look at a state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, that literally says that the probability amplitude for finding the system in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, and hence the probability is &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-21T13:53:39.997" LastActivityDate="2018-11-21T13:53:39.997" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4785" PostTypeId="1" AcceptedAnswerId="4791" CreationDate="2018-11-21T19:16:32.623" Score="4" ViewCount="201" Body="&lt;p&gt;I'm currently trying to understand the T magic state distillation algorithm described in &quot;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0403025.pdf&quot; rel=&quot;noreferrer&quot;&gt;Universal Quantum Computation with Ideal Clifford Gates and Noisy Ancillas&lt;/a&gt;&quot; [1] (Section V starting on Page 6). I need to understand the basics of magic state distillation in order to understand the motivations for optimization procedures used in &lt;a href=&quot;https://arxiv.org/abs/1809.01302&quot; rel=&quot;noreferrer&quot;&gt;another paper&lt;/a&gt; [2], which I need to give a talk on for a class. I know the distillation procedure used [2] (Bravyi-Haah) is different from the one described in [1], but [1] seems like a more natural starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this is background for the class presentation I am to give, my goals with this post are to refine my understanding as I continue to try and understand this topic and (most importantly) to make sure I do not spread any misinformation. That is, I don't expect to achieve 100% understanding from the responses to this post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to verify which points of the following plain-language laymen's explanation of the magic state distillation procedure described in [1] are incorrect or correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagining the production of T-states for use in a surface code,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Magic state distillation is performed &lt;em&gt;within the surface code&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The initial step of producing many copies of raw noisy T-states is done through the direct use of a non-fault tolerant T-gate &lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Distillation of these raw states is performed through discarding states which cause nontrivial surface code stabilizer measurements (eigenvalue = -1) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) The raw states with trivial surface code stabilizer measurements (eigenvalue = 1) are transformed into a single qubit magic state.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastActivityDate="2018-11-22T18:24:55.140" Title="Magic State Distillation Understanding Check" Tags="&lt;fault-tolerance&gt;&lt;surface-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4786" PostTypeId="1" CreationDate="2018-11-21T19:35:37.000" Score="4" ViewCount="108" Body="&lt;p&gt;Continuing from my previous (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4706/4153&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4715/4153&quot;&gt;2&lt;/a&gt;) questions on &lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;nofollow noreferrer&quot;&gt;Brunner et al.'s paper&lt;/a&gt; on Bell nonlocality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, we have the following standard Bell experiment setup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dY7tO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dY7tO.png&quot; alt=&quot;Bell experiment setup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where independent inputs &lt;span class=&quot;math-container&quot;&gt;$x,y \in \{0, 1\}$&lt;/span&gt; decide the measurement performed by Alice &amp;amp; Bob on quantum state &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; with outcomes &lt;span class=&quot;math-container&quot;&gt;$a,b \in \{-1, 1\}$&lt;/span&gt;. We say &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are correlated (not independent) if:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(ab|xy) \ne P(a|x)P(b|y)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is a lazy physicist's way of writing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P[A = a \cap B = b | X = x \cap Y = y] \ne P[A = a | X = x] \cdot P[B = b | Y = y]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$A, B, X, Y$&lt;/span&gt; are discrete random variables and &lt;span class=&quot;math-container&quot;&gt;$a,b,x,y$&lt;/span&gt; some specific elements from the sets defined above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to check this basic (in)equality with some simple example values, so I considered the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S = |++\rangle$&lt;/span&gt;, a non-entangled quantum state&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$X = 0$&lt;/span&gt;, Alice measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;; if &lt;span class=&quot;math-container&quot;&gt;$X = 1$&lt;/span&gt;, she measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$Y = 0$&lt;/span&gt;, Bob measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;; if &lt;span class=&quot;math-container&quot;&gt;$Y = 1$&lt;/span&gt;, he measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is not an entangled state, we can write out the following probability tables:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{array}{|c|c|c|}&#xA;\hline&#xA;x &amp;amp; a &amp;amp; P(a|x) \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; 0.5 \\ \hline&#xA;0 &amp;amp; -1 &amp;amp; 0.5 \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; 1 \\ \hline&#xA;1 &amp;amp; -1 &amp;amp; 0 \\ \hline&#xA;\end{array}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{array}{|c|c|c|}&#xA;\hline&#xA;y &amp;amp; b &amp;amp; P(b|y) \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; 1 \\ \hline&#xA;0 &amp;amp; -1 &amp;amp; 0 \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; 0.5 \\ \hline&#xA;1 &amp;amp; -1 &amp;amp; 0.5 \\ \hline&#xA;\end{array}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then expect &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy) = P(a|x)P(b|y)$&lt;/span&gt; for all the values of &lt;span class=&quot;math-container&quot;&gt;$a,b,x,y$&lt;/span&gt;. The problem is I don't know how to calculate the LHS of that equation! I can make the following table:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{array}{|c|c|c|c|c|c|}&#xA;\hline&#xA;x &amp;amp; y &amp;amp;  a &amp;amp;  b &amp;amp; P(a|x)P(b|y)         &amp;amp; P(ab|xy) \\ \hline&#xA;0 &amp;amp; 0 &amp;amp;  1 &amp;amp;  1 &amp;amp; 0.5 \cdot   1 =  0.5 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 0 &amp;amp;  1 &amp;amp; -1 &amp;amp; 0.5 \cdot   0 =    0 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp;  1 &amp;amp; 0.5 \cdot   1 =  0.5 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp; -1 &amp;amp; 0.5 \cdot   0 =    0 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 1 &amp;amp;  1 &amp;amp;  1 &amp;amp; 0.5 \cdot 0.5 = 0.25 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 1 &amp;amp;  1 &amp;amp; -1 &amp;amp; 0.5 \cdot 0.5 = 0.25 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; -1 &amp;amp;  1 &amp;amp; 0.5 \cdot 0.5 = 0.25 &amp;amp; ?        \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 0.5 \cdot 0.5 = 0.25 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 0 &amp;amp;  1 &amp;amp;  1 &amp;amp;   1 \cdot   1 =    1 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 0 &amp;amp;  1 &amp;amp; -1 &amp;amp;   1 \cdot   0 =    0 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp;  1 &amp;amp;   0 \cdot   1 =    0 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; -1 &amp;amp;   0 \cdot   0 =    0 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 1 &amp;amp;  1 &amp;amp;  1 &amp;amp;   1 \cdot 0.5 =  0.5 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 1 &amp;amp;  1 &amp;amp; -1 &amp;amp;   1 \cdot 0.5 =  0.5 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; -1 &amp;amp;  1 &amp;amp;   0 \cdot 0.5 =    0 &amp;amp; ?        \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 &amp;amp;   0 \cdot 0.5 =    0 &amp;amp; ?        \\ \hline&#xA;\end{array}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But cannot figure out how to fill in the value of &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy)$&lt;/span&gt;. How do I do that (without using the values of &lt;span class=&quot;math-container&quot;&gt;$P(a|b)P(b|y)$&lt;/span&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would then like to perform the same exercise with the CHSH setup:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S = |\Psi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$X = 0$&lt;/span&gt;, Alice measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;; if &lt;span class=&quot;math-container&quot;&gt;$X = 1$&lt;/span&gt;, she measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$Y = 0$&lt;/span&gt;, Bob measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; rotated &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{8}$&lt;/span&gt; radians counter-clockwise around the y-axis; if &lt;span class=&quot;math-container&quot;&gt;$Y = 1$&lt;/span&gt;, he measures with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; rotated &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{8}$&lt;/span&gt; radians clockwise around the y-axis&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How would we then write out the above three probability tables? I guess we probably wouldn't be able to easily write out the first two, but we can with the third?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-03-10T05:44:46.963" LastActivityDate="2019-03-10T05:44:46.963" Title="Determining whether $P(ab|xy)$ factorizes in Bell experiments" Tags="&lt;quantum-information&gt;&lt;mathematics&gt;&lt;correlations&gt;&lt;non-locality&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4787" PostTypeId="1" AcceptedAnswerId="4789" CreationDate="2018-11-21T20:09:54.320" Score="3" ViewCount="127" Body="&lt;p&gt;If we're measuring in common bases like &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; we express this by saying we're measuring with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;, or measuring in the computational or sign bases. What's the conventional or most-concise way to say we're measuring in a non-standard basis, like the in CHSH experiment where Bob measures in the computational basis rotated &lt;span class=&quot;math-container&quot;&gt;$\pm\frac{\pi}{8}$&lt;/span&gt; radians around the y-axis? Do we derive the observable from its eigenvectors and use that?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2018-11-22T00:55:18.913" LastActivityDate="2018-11-22T08:38:00.897" Title="Convention for expressing measurement in non-standard basis" Tags="&lt;quantum-information&gt;&lt;measurement&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4788" PostTypeId="1" CreationDate="2018-11-21T21:50:28.740" Score="0" ViewCount="516" Body="&lt;p&gt;This question is regarding the simulation of qubits, using FPGAs. My question is: how does using FPGAs to simulate qubits help us understand or give us an insight into how quantum computers could be constructed? I know many quantum computation scientists use software to simulated qubits, for example, Matlab and even Python. But I just don't understand why to use FPGAs. &#xA;I know for a fact that FPGAs are really useful in speeding up processing power and execute processes in parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the sole purpose of using FPGAs or are there other reasons why they are being used in quantum computation simulations?&lt;/p&gt;&#xA;" OwnerUserId="3043" LastEditorUserId="26" LastEditDate="2018-12-13T19:28:02.693" LastActivityDate="2019-02-08T08:18:22.333" Title="FPGA qubit simulation" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;simulation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4789" PostTypeId="2" ParentId="4787" CreationDate="2018-11-22T08:38:00.897" Score="2" Body="&lt;p&gt;If you express it as an operator of the form &lt;span class=&quot;math-container&quot;&gt;$\vec{n}\cdot\vec{\sigma}$&lt;/span&gt;, it will certainly be understood. In this context, you're probably talking about &lt;span class=&quot;math-container&quot;&gt;$(Z+X)/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could derive this from the eigenvectors, of you can derive it from the Bloch sphere picture, where a measurement corresponds to any point on the surface of the Bloch sphere (and that is specified by the vector &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt;). You just have to remember that there's a doubling of angles between the way we write them on states, and the angles on the Bloch sphere, so your &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; angle becomes &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-22T08:38:00.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4790" PostTypeId="2" ParentId="4786" CreationDate="2018-11-22T08:47:33.627" Score="4" Body="&lt;p&gt;I think you're doing things a little bit backwards. You probably shouldn't be calculating &lt;span class=&quot;math-container&quot;&gt;$P(a|x)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$P(b|y)$&lt;/span&gt; in advance, because you're simply trying to ask:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given a set of &lt;span class=&quot;math-container&quot;&gt;$\{P(ab|xy)\}$&lt;/span&gt;, do there exist assignments to &lt;span class=&quot;math-container&quot;&gt;$P(a|x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(b|y)$&lt;/span&gt; that satisfy &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy)=P(a|x)P(b|y)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$a,b,x,y$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, how do you evaluate the probability of getting answers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; when you make measurements &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;? Let's assume your two observables for measurement choices &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\vec{n}\cdot\vec{\sigma}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{m}\cdot{\sigma}$&lt;/span&gt; respectively. Then you have projectors for each of the 4 possible outcomes described by &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{ab}=\frac{1}{4}(\mathbb{I}+(-1)^a\vec{n}\cdot\vec{\sigma})\otimes(\mathbb{I}+(-1)^b\vec{m}\cdot\vec{\sigma}).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what's &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy)$&lt;/span&gt;?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(ab|xy)=\langle\psi|P_{ab}|\psi\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|++\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$x=y=0$&lt;/span&gt; (meaning &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; measurements, as specified in the question), then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(00|00)=\langle++|\frac{1}{4}(\mathbb{I}+X)\otimes(\mathbb{I}+X)|++\rangle=1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-22T08:47:33.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4791" PostTypeId="2" ParentId="4785" CreationDate="2018-11-22T18:19:38.817" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Magic state distillation is performed within the surface code&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you mean the distillation circuit is implemented with encoded logical qubits instead of raw physical qubits, then yes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2) The initial step of producing many copies of raw noisy T-states is done through the direct use of a non-fault tolerant T-gate &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, the initial T states fed into the process are made with physical gates. Later rounds use T states distilled in the previous round.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3) Distillation of these raw states is performed through discarding states which cause nontrivial surface code stabilizer measurements (eigenvalue = -1)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, you discard states that fail any of various parity checks. In principle you could try to correct errors instead of just detecting them, but this would be significantly less efficient because you get less error suppression (e.g. the 15-to-1 distillation process can correct any single T-gate error, but then you'd get p -&gt; O(p^2) suppression instead of the p -&gt; O(p^3) you get by detecting any pair of errors).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;4) The raw states with trivial surface code stabilizer measurements (eigenvalue = 1) are transformed into a single qubit magic state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, though it could be multiple magic states. In the case of the 15-to-1 factory, it's just one.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2018-11-22T18:24:55.140" LastActivityDate="2018-11-22T18:24:55.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4792" PostTypeId="1" AcceptedAnswerId="4796" CreationDate="2018-11-22T20:49:23.440" Score="4" ViewCount="180" Body="&lt;p&gt;I came across a quantum circuit very similar to the &lt;code&gt;phase estimation&lt;/code&gt; circuit, which is shown below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w758k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w758k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the &lt;code&gt;phase estimation algorithm&lt;/code&gt; we assume, that we can efficiently implement an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, which performs the following operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U|u\rangle \equiv e^{2 \pi i \phi} |u\rangle, $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; is the eignevector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi}$&lt;/span&gt; is the corresponding eigenvalue. Such an operator can be denoted in the matrix form as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U \equiv \begin{bmatrix} e^{2 \pi i \phi} &amp;amp; 0 \\ 0 &amp;amp; e^{2 \pi i \phi}\end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its controlled version can be written as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CU \equiv \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; e^{2 \pi i \phi} &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{2 \pi i \phi}\end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(the &lt;span class=&quot;math-container&quot;&gt;$CU^j$&lt;/span&gt; gate will only have &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi j}$&lt;/span&gt; in places of &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \phi}$&lt;/span&gt;). For such a case I was still able to express the resulting vector (after going through the &lt;span class=&quot;math-container&quot;&gt;$CU^j$&lt;/span&gt; gate) as the tensor product of two vectors. Thanks to this, I was able to see what is the effect of applying the &lt;code&gt;inverse quantum Fourier transform&lt;/code&gt; on one of these vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's say, that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not diagonal and its each entry is different from 0. In such a case, I think there appears strong entanglement between qubits in the first and the second register. Because of this (from the very definition of entanglement) I wasn't able to express the resulting vector as tensor product of some compound vectors and I don't know, what will be the result of applying the &lt;code&gt;inverse quantum Fourier transform&lt;/code&gt; on the first register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of the above is just one example showing my real problem - how to analyze quantum circuits, where qubits (or registers) are highly entangled?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="55" LastEditDate="2018-11-25T11:00:35.693" LastActivityDate="2018-11-25T11:00:35.693" Title="How to analyze highly entangled quantum circuits?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;circuit-construction&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4793" PostTypeId="1" CreationDate="2018-11-22T22:16:46.737" Score="2" ViewCount="286" Body="&lt;p&gt;How can I show that a multi-qudit graph state &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt; is the maximally entangled state? What kind of measure of entanglement can be used to quantify the amount of entanglement in a given graph state?&lt;/p&gt;&#xA;" OwnerUserId="4288" LastEditorUserId="91" LastEditDate="2018-11-23T03:39:13.713" LastActivityDate="2018-11-23T09:39:04.737" Title="Graph state and maximally entangled state" Tags="&lt;entanglement&gt;&lt;qudit&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4794" PostTypeId="1" CreationDate="2018-11-23T02:21:13.617" Score="3" ViewCount="200" Body="&lt;p&gt;This is really a question out of curiosity. I am aware that geometric algebra and geometric calculus provide simplifications in many aspects of physics. I'm wondering if this framework's usefulness extends to the realm of quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="5172" LastEditorUserId="26" LastEditDate="2018-11-23T04:18:12.863" LastActivityDate="2018-11-23T04:18:12.863" Title="Is geometric algebra/calculus used in quantum computing?" Tags="&lt;mathematics&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4795" PostTypeId="2" ParentId="4794" CreationDate="2018-11-23T03:15:02.027" Score="2" Body="&lt;p&gt;The algebra generated over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x,y,z}$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$\text{Cliff}(\mathbb{R}^{3,0})$&lt;/span&gt;. But this doesn't really use more of the general features of Clifford algebra for general &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^{p,q}$&lt;/span&gt;. You can phrase it in terms of Clifford algebra if you want, but not necessary for small examples.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2018-11-23T04:05:18.313" LastActivityDate="2018-11-23T04:05:18.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4796" PostTypeId="2" ParentId="4792" CreationDate="2018-11-23T07:43:02.837" Score="3" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; used in phase estimation is &lt;em&gt;not&lt;/em&gt; only a diagonal matrix with the same diagonal elements. Instead, it is an arbitrary unitary matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that you analyse it, instead, is that the input &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; is specifically chosen to be &lt;em&gt;an eigenvector&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. That means &lt;span class=&quot;math-container&quot;&gt;$U|u\rangle=e^{i\phi}|u\rangle$&lt;/span&gt;. But there are different eigenvectors with different eigenvalues. For example, perhaps &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U|v\rangle=e^{i\theta}|v\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the way that you've analysed it tells you that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|u\rangle\mapsto|\phi\rangle|u\rangle$&lt;/span&gt; (assuming &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is of the form &lt;span class=&quot;math-container&quot;&gt;$2\pi k/2^t$&lt;/span&gt; for integer &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;). But it tells you that you get the same effect for every eigenvector, so &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|v\rangle\mapsto|\theta\rangle|v\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what happens for an arbitrary input that is not an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;? The eigenvectors form a basis, so we can write any input state as a superposition of the different eigenvectors. And by linearity we know how each of those components evolve. For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle(\alpha|u\rangle+\beta|v\rangle)\rightarrow \alpha|\phi\rangle|u\rangle+\beta|\theta\rangle|v\rangle.&#xA;$$&lt;/span&gt;&#xA;This will, typically, be highly entangled, but the entanglement itself does not necessarily cause a problem in the analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, what's the answer? Well, ultimately, you might not be able to analyse these circuits. Part of the point of quantum circuits is that you cannot easily simulate them on a classical computer. But there are plenty of strategies such as the one above (picking a basis of states which are easy to analyse), or the Gottesman-Knill theorem, that let you deal with specific situations when there's lots of entanglement present.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-23T07:43:02.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4797" PostTypeId="2" ParentId="4793" CreationDate="2018-11-23T09:39:04.737" Score="2" Body="&lt;p&gt;I'm not familiar with how graph states extend to qudits, so let me just answer for the specific case of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a graph &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, and we create the corresponding graph state &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt; by placing a qubit on every vertex in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state, and applying a controlled-phase gate along every edge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, take a bipartition of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. On either side of the bipartition, we can apply unitaries (we're just not allowed to do anything across the partition). Hence, we can apply controlled-phases along any edges that remain within a bipartition. We are reduced to a graph state that is the same as the original, but only has edges across the bipartition, and it has the same amount of entanglement with respect to that bipartition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, throw away all vertices that don't have an edge, as they're irrelevant. Let's have the sizes of the two bipartitions being &lt;span class=&quot;math-container&quot;&gt;$n\leq m$&lt;/span&gt;. Then we can write the graph state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}|x\rangle\otimes(Z_{N(x)}|+\rangle^{\otimes m}),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N(x)$&lt;/span&gt; describes the neighbourhood of the spins of the first bipartition specified by &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. More explicitly, a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is applied to any qubit in the second bipartition if it is the neighbour to an odd number of vertices &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in the first bipartition for which &lt;span class=&quot;math-container&quot;&gt;$x_i=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under the assumption that &lt;span class=&quot;math-container&quot;&gt;$N(x)$&lt;/span&gt; is distinct for all &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;, this is a Schmidt decomposition, meaning that there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; Schmidt coefficients, each of value &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;, from which you can calculate anything such as the entanglement entropy, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. However, if any qubits were discarded in the discard step, this entanglement entropy will &lt;em&gt;not&lt;/em&gt; be maximal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, the assumption of the distinctness of &lt;span class=&quot;math-container&quot;&gt;$N(x)$&lt;/span&gt; is not necessarily true. Think, for example, of the square graph (of 4 vertices), and a bipartition of grouping qubits on the diagonals. Here, &lt;span class=&quot;math-container&quot;&gt;$N(00)=N(11)$&lt;/span&gt;. However, this can be avoided by using the local equivalence of graph states to minimise the number of edges across the bipartition. I don't have a rigorous proof for this off the top of my head, bur probably a good way to approach it is to show that if &lt;span class=&quot;math-container&quot;&gt;$N(x)=N(y)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$N(x\oplus z)=N(y\oplus z)$&lt;/span&gt;. This means that you would break down the state into the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2^n}}\sum_{z\in\{0,1\}^n}(|z\rangle+|z\oplus x\oplus y\rangle)\otimes\left(Z_{N(z)}|+\rangle^{\otimes m}\right),&#xA;$$&lt;/span&gt;&#xA;where we restrict the sum over &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; to avoid double counting. This leads to a halving of the number of Schmidt coefficients, each of which has doubled in value. The entanglement entropy is &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt;. Of course, it could be reduced by any integer amount depending on the structure. The most extreme case, of course, is the fully connected graph (which is locally equivalent to a GHZ state). Any bipartition only has 1 ebit of entanglement across the bipartition, even though it initially looks like there are many edges crossing it.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-23T09:39:04.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4798" PostTypeId="1" AcceptedAnswerId="4802" CreationDate="2018-11-23T12:53:11.490" Score="21" ViewCount="2809" Body="&lt;p&gt;I read about 9-qubit, 7-qubit and 5-qubit error correcting codes lately. But why can there not be a quantum error correcting code with fewer than 5 qubits? &lt;/p&gt;&#xA;" OwnerUserId="5007" LastEditorUserId="1837" LastEditDate="2018-11-23T14:04:14.037" LastActivityDate="2018-12-01T16:14:34.040" Title="Why can't there be an error correcting code with fewer than 5 qubits?" Tags="&lt;error-correction&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4799" PostTypeId="2" ParentId="4798" CreationDate="2018-11-23T13:17:50.320" Score="14" Body="&lt;p&gt;What we can easily prove is that there's no smaller &lt;em&gt;non-degenerate&lt;/em&gt; code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a non-degenerate code, you have to have the 2 logical states of the qubit, and you have to have a distinct state for each possible error to map each logical state into. So, let's say you had a 5 qubit code, with the two logical states &lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1_L\rangle$&lt;/span&gt;. The set of possible single-qubit errors are &lt;span class=&quot;math-container&quot;&gt;$X_1,X_2,\ldots X_5,Y_1,Y_2,\ldots,Y_5,Z_1,Z_2,\ldots,Z_5$&lt;/span&gt;, and it means that all the states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0_L\rangle,|1_L\rangle,X_1|0_L\rangle,X_1|1_L\rangle,X_2|0_L\rangle,\ldots&#xA;$$&lt;/span&gt;&#xA;must map to orthogonal states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we apply this argument in general, it shows us that we need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2+2\times(3n)&#xA;$$&lt;/span&gt;&#xA;distinct states. But, for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, the maximum number of distinct states is &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. So, for a non-degenerate error correct code of distance 3 (i.e. correcting for at least one error) or greater, we need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2^n\geq 2(3n+1).&#xA;$$&lt;/span&gt;&#xA;This is called the Quantum Hamming Bound. You can easily check that this is true for all &lt;span class=&quot;math-container&quot;&gt;$n\geq 5$&lt;/span&gt;, but not if &lt;span class=&quot;math-container&quot;&gt;$n&amp;lt;5$&lt;/span&gt;. Indeed, for &lt;span class=&quot;math-container&quot;&gt;$n=5$&lt;/span&gt;, the inequality is an equality, and we call the corresponding 5-qubit code the perfect code as a result.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-26T07:49:48.053" LastActivityDate="2018-11-26T07:49:48.053" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4800" PostTypeId="2" ParentId="4798" CreationDate="2018-11-23T14:45:59.683" Score="8" Body="&lt;p&gt;As a complement to the other answer, I am going to add the general quantum Hamming bound for quantum non-degenerate error correction codes. The mathematical formulation of such bound is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;2^{n-k}\geq\sum_{j=0}^t\pmatrix{n\\j}3^j,&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; refers to the number of qubits that form the codewords, &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the number of information qubits that are encoded (so they are protected from decoherence), and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-qubit errors corrected by the code. As &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is related with the distance by &lt;span class=&quot;math-container&quot;&gt;$t = \lfloor\frac{d-1}{2}\rfloor$&lt;/span&gt;, then such non-degenerate quantum code will be a &lt;span class=&quot;math-container&quot;&gt;$[[n,k,d]]$&lt;/span&gt; quantum error correction code. This bound is obtained by using an sphere-packing like argument, so that the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; dimensional Hilbert space is partitioned into &lt;span class=&quot;math-container&quot;&gt;$2^{n-k}$&lt;/span&gt; spaces each deistinguished by the syndrome measured, and so one error is assigned to each of the syndromes, and the recovery operation is done by inverting the error associated with such measured syndrome. That's why the number of total errors corrected by a non-degenerate quantum code should be less or equal to the number of partitions by the syndrome measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, degeneracy is a property of quantum error correction codes that imply the fact that there are classes of equivalence between the errors that can affect the codewords sent. This means that there are errors whose effect on the transmitted codewords is the same while sharing the same syndrome. This implies that those classes of degenerate errors are corrected via the same recovery operation, and so more errors that expected can be corrected. That is why it is not known if the quantum Hamming bound holds for this degenerate error correction codes, as more errors than the partitions can be corrected this way. Please refer to this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2060/violation-of-the-quantum-hamming-bound&quot;&gt;question&lt;/a&gt; for some information about the violation of the quantum Hamming bound.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-11-23T14:45:59.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4801" PostTypeId="1" AcceptedAnswerId="4803" CreationDate="2018-11-23T16:52:37.297" Score="2" ViewCount="233" Body="&lt;p&gt;Suppose I have two registers x and y, of length m and n bits respectively. I want to initialize my system to contain an equal superposition of all &lt;span class=&quot;math-container&quot;&gt;$2^{n+m}$&lt;/span&gt; states, then apply an oracle function (in superposition). How do I notate this correctly?&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;p&gt;Consider the system &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|x_{m-1}\rangle...|x_0\rangle|y_{n-1}\rangle...|y_0\rangle = |x\rangle|y\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and quantum oracle &lt;span class=&quot;math-container&quot;&gt;$F(x,y)\rightarrow \{0,1\}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialize the system to &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle=|0\rangle|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply the Hadamard gate to obtain uniform superposition over all states&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$H|\psi_0\rangle = \frac{1}{\sqrt{2^{n+m}}}\sum_{x=0}^{2^m}\sum_{y=0}^{2^n}|x\rangle|y\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compute &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = F(|s\rangle) = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta \in \mathbb{C}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I hope the algorithmic steps I'm describing are relatively clear but is this the correct way to notate it?&lt;/p&gt;&#xA;" OwnerUserId="5174" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-01-17T10:46:47.593" Title="Notation for two entangled registers" Tags="&lt;entanglement&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4802" PostTypeId="2" ParentId="4798" CreationDate="2018-11-23T22:04:19.710" Score="14" Body="&lt;h2&gt;A proof that you need at least 5 qubits (or qudits)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Here is a proof that any single-error correcting (&lt;em&gt;i.e.,&lt;/em&gt; distance&amp;nbsp;3) quantum error correcting code has at least 5 qubits. In fact, this generalises to qudits of any dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, and any quantum error correcting code protecting one or more qudits of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4832/124&quot;&gt;Felix Huber notes&lt;/a&gt;, the original proof that you require at least 5 qubits is due to the Knill--Laflamme article [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9604034&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9604034&lt;/a&gt;] which set out the Knill--Laflamme conditions: the following is the proof technique which is more commonly used nowadays.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any quantum error correcting code which can correct &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; unknown errors, can also correct up to &lt;span class=&quot;math-container&quot;&gt;$2t$&lt;/span&gt; erasure errors (where we simply lose some qubit, or it becomes completely depolarised, or similar) if the locations of the erased qubits are known. [1,&amp;nbsp;Sec.&amp;nbsp;III&amp;nbsp;A]*.&#xA;Slightly more generally, a quantum error correcting code of distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; can tolerate &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; erasure errors. For example, while the &lt;span class=&quot;math-container&quot;&gt;$[\![4,2,2]\!]$&lt;/span&gt; code can't correct any errors at all, in essence because it can tell an error has happened (and even which type of error) but not which qubit it has happened to, that same code can protect against a single erasure error (because by hypothesis we know precisely where the error occurs in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It follows that any quantum error correcting code which can tolerate one Pauli error, can recover from the loss of two qubits.&#xA;Now: suppose you have a quantum error correcting code on &lt;span class=&quot;math-container&quot;&gt;$n \geqslant 2$&lt;/span&gt; qubits, encoding one qubit against single-qubit errors. Suppose that you give &lt;span class=&quot;math-container&quot;&gt;$n-2$&lt;/span&gt; qubits to Alice, and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits to Bob: then Alice should be able to recover the original encoded state. If &lt;span class=&quot;math-container&quot;&gt;$n&amp;lt;5$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$2 \geqslant n-2$&lt;/span&gt;, so that Bob should &lt;em&gt;also&lt;/em&gt; be able to recover the original encoded state &amp;mdash; thereby obtaining a clone of Alice's state. As this is ruled out by the No Cloning Theorem, it follows that we must have &lt;span class=&quot;math-container&quot;&gt;$n \geqslant 5$&lt;/span&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;On correcting erasure errors&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;*&amp;nbsp;The earliest reference I found for this is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]&#xA;Grassl, Beth, and Pellizzari.&#xA;&lt;br&gt;&amp;thinsp; &amp;thinsp; &amp;thinsp;&#xA;&lt;em&gt;Codes for the Quantum Erasure Channel&lt;/em&gt;.&#xA;&lt;br&gt;&amp;thinsp; &amp;thinsp; &amp;thinsp;&#xA;Phys. Rev. A &lt;strong&gt;56&lt;/strong&gt; (pp.&amp;thinsp;33&amp;ndash;38), 1997.&#xA;&lt;br&gt;&amp;thinsp; &amp;thinsp; &amp;thinsp;&#xA;[&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9610042&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9610042&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;mdash; which is not much long after the Knill&amp;ndash;Laflamme conditions were described in [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9604034&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9604034&lt;/a&gt;] and so plausibly the original proof of the connection between code distance and erasure errors. The outline is as follows, and applies to error correcting codes of distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; (and applies equally well to qudits of any dimension in place of qubits, using generalised Pauli operators).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The loss of &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; qubits can be modelled by those qubits being subject to the completely depolarising channel, which in turn can be modeled by those qubits being subject to uniformly random Pauli errors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the locations of those &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; qubits were unknown, this would be fatal.&#xA;However, as their locations are known, any pair Pauli errors on &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; qubits can be distinguished from one another, by appeal to the&#xA;Knill-Laflamme conditions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Therefore, by substituting the erased qubits with qubits in the maximally mixed state and testing for Pauli errors on those &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; qubits specificaly (requiring a different correction procedure than you would use for correcting arbitrary Pauli errors, mind you), you can recover the original state.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2018-11-30T11:03:35.503" LastActivityDate="2018-11-30T11:03:35.503" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4803" PostTypeId="2" ParentId="4801" CreationDate="2018-11-24T07:14:27.377" Score="2" Body="&lt;p&gt;Your notation is OK up to and including step 2, except for the range of summation. You need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|s\rangle=\frac{1}{\sqrt{2^{n+m}}}\sum_{x=0}^{2^n-1}\sum_{y=0}^{2^m-1}|x\rangle|y\rangle&#xA;$$&lt;/span&gt;&#xA;Now the problem is how to write down the effect of the oracle, and you cannot just write down the output qubit. I think you probably know this from the title of the question, because entanglement will appear that you're not describing. So, you have an oracle that acts as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle|y\rangle|0\rangle\xrightarrow{\text{oracle}}|x\rangle|y\rangle|F(x,y)\rangle.&#xA;$$&lt;/span&gt;&#xA;Hence, if the input is some superposition state such as &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|s\rangle|0\rangle\xrightarrow{\text{oracle}}|\Psi\rangle=\frac{1}{\sqrt{2^{n+m}}}\sum_{x=0}^{2^n-1}\sum_{y=0}^{2^m-1}|x\rangle|y\rangle|F(x,y)\rangle.&#xA;$$&lt;/span&gt;&#xA;You absolutely cannot describe (except in very special cases of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;) the last qubit in the form &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; because it is entangled with the other registers.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The question seems to be evolving into&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If I'm not measuring &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, why can't the state of the extra qubit be written in the form &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are several ways that this might be answered. Normally, I'd take the partial trace and calculate the reduced density matrix, but I infer from comments that the OP doesn't know this technique. Thus, let us try another route.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume that the extra qubit can be written in the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;. This means that we could define a measurement&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_\psi=|\psi\rangle\langle\psi|\qquad P_{\perp}=|\psi^\perp\rangle\langle\psi^\perp|&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp\rangle=\beta^{\star}|0\rangle-\alpha^\star|1\rangle$&lt;/span&gt; is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. If we can guarantee that the extra qubit is in that state, then we are guaranteed to get the measurement result &lt;span class=&quot;math-container&quot;&gt;$P_{\psi}$&lt;/span&gt;. In other words,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Psi|\mathbf{I}\otimes\mathbf{I}\otimes P_{\psi}|\Psi\rangle=1.&#xA;$$&lt;/span&gt;&#xA;(The identity operations are how we say that we're not measuring the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; systems.) I claim that there are no satisfying &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;, unless &lt;span class=&quot;math-container&quot;&gt;$F(x,y)$&lt;/span&gt; is a constant function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we start to evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\langle\Psi|\mathbf{I}\otimes\mathbf{I}\otimes P_{\psi}|\Psi\rangle&amp;amp;=\frac{1}{2^{n+m}}\sum_x\sum_y\langle F(x,y)|P_{\psi}|F(x,y)\rangle \\&#xA;&amp;amp;=\frac{1}{2^{n+m}}\left(\sum_{x,y:F(x,y)=0}|\alpha|^2+\sum_{x,y:F(x,y)=1}|\beta|^2\right) \\&#xA;&amp;amp;= \frac{1}{2^{n+m}}(M|\alpha|^2+(2^{n+m}-M)(1-|\alpha|^2))&#xA;\end{align*}&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the number of values such that &lt;span class=&quot;math-container&quot;&gt;$F(x,y)=0$&lt;/span&gt;. Setting this equal to 1, we can rearrange for &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\alpha|^2=\frac{M}{2M-2^{n+m}}&#xA;$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; to be a valid value, it must be &lt;span class=&quot;math-container&quot;&gt;$0\leq|\alpha|^2\leq 1$&lt;/span&gt;. One has to be careful in the analysis here. If we assume that &lt;span class=&quot;math-container&quot;&gt;$2M&amp;gt;2^{n+m}$&lt;/span&gt;, then the denominator is positive, and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2\leq 1$&lt;/span&gt; implies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M\geq 2^{n+m}.&#xA;$$&lt;/span&gt;&#xA;This only happens if &lt;span class=&quot;math-container&quot;&gt;$M=2^{n+m}$&lt;/span&gt;, in other words, &lt;span class=&quot;math-container&quot;&gt;$F(x,y)=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. On the other hand, if &lt;span class=&quot;math-container&quot;&gt;$2M&amp;lt;2^{n+m}$&lt;/span&gt;, the denominator is negative, and so &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2\geq 0$&lt;/span&gt; implies &lt;span class=&quot;math-container&quot;&gt;$M\leq 0$&lt;/span&gt;. This can only happen if &lt;span class=&quot;math-container&quot;&gt;$M=0$&lt;/span&gt;, i.e. all answers &lt;span class=&quot;math-container&quot;&gt;$F(x,y)$&lt;/span&gt; give answer 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We conclude that unless &lt;span class=&quot;math-container&quot;&gt;$F(x,y)$&lt;/span&gt; is constant, there is no valid &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; so that the measurement gives probability 1, which means there is no pure state description of that qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="5174" LastEditDate="2018-12-10T19:20:22.380" LastActivityDate="2018-12-10T19:20:22.380" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="4805" PostTypeId="1" AcceptedAnswerId="4808" CreationDate="2018-11-25T04:24:13.120" Score="5" ViewCount="171" Body="&lt;p&gt;In version 2 of the paper &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations&lt;/a&gt; by Cao &lt;em&gt;et al.&lt;/em&gt;, they have given circuit decomposition for &lt;span class=&quot;math-container&quot;&gt;$e^{iA\frac{2\pi}{16}}$&lt;/span&gt;, given a particular &lt;span class=&quot;math-container&quot;&gt;$A_{4\times 4}$&lt;/span&gt; matrix, in Fig 4. I am trying to find equivalent decomposition for a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix like &lt;span class=&quot;math-container&quot;&gt;$A'=\begin{pmatrix} 1.5&amp;amp;0.5\\0.5&amp;amp;1.5 \end{pmatrix}$&lt;/span&gt;. Can anyone explain and summarize the standard method for this?&lt;/p&gt;&#xA;" OwnerUserId="4644" LastEditorUserId="26" LastEditDate="2018-11-25T07:19:53.547" LastActivityDate="2018-11-26T08:14:23.513" Title="How to find parameters for circuit decomposition of Hamiltonian simulation of any matrix $A$?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4806" PostTypeId="1" CreationDate="2018-11-26T03:36:05.287" Score="2" ViewCount="122" Body="&lt;p&gt;My goal in writing this algorithm in Q# was that &lt;code&gt;func&lt;/code&gt; would either output &lt;code&gt;(1,2)&lt;/code&gt; or &lt;code&gt;(10,20)&lt;/code&gt;, since the output result can be either &lt;code&gt;One&lt;/code&gt; or &lt;code&gt;Zero&lt;/code&gt;. However, I sometimes have &lt;code&gt;(1,20)&lt;/code&gt; or &lt;code&gt;(10,2)&lt;/code&gt; as output. Does anyone know why this happens?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    operation func () : (Int,Int)&#xA;{&#xA;    mutable res000 = Zero;&#xA;    mutable int1 = 0;&#xA;    mutable int2 = 0;&#xA;&#xA;    using (goop = Qubit[1])&#xA;    {&#xA;&#xA;       H(goop[0]);&#xA;&#xA;       set res000 = M(goop[0]);&#xA;&#xA;&#xA;       if(res000 == Zero)&#xA;       {&#xA;           set int1 = 1;&#xA;           set int2 = 2;&#xA;       }&#xA;       else&#xA;       {&#xA;           set int1 = 10;&#xA;           set int2 = 20;&#xA;       }&#xA;&#xA;       ResetAll(goop);&#xA;    }&#xA;&#xA;    return (int1,int2);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's another bit of information. I also have two projection functions, and I want the projection functions to output &lt;code&gt;func&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    operation Pr0 (m:Int,n:Int) : Int&#xA;{&#xA;    return m;&#xA;}&#xA;&#xA;operation Pr1 (m:Int,n:Int) : Int&#xA;{&#xA;    return n;&#xA;}&#xA;&#xA;operation func () : (Int,Int)&#xA;{&#xA;    mutable res000 = Zero;&#xA;    mutable int1 = 0;&#xA;    mutable int2 = 0;&#xA;&#xA;    using (goop = Qubit[1])&#xA;    {&#xA;&#xA;       H(goop[0]);&#xA;&#xA;       set res000 = M(goop[0]);&#xA;&#xA;&#xA;       if(res000 == Zero)&#xA;       {&#xA;           set int1 = 1;&#xA;           set int2 = 2;&#xA;       }&#xA;       else&#xA;       {&#xA;           set int1 = 10;&#xA;           set int2 = 20;&#xA;       }&#xA;&#xA;       ResetAll(goop);&#xA;    }&#xA;&#xA;    return (int1,int2);&#xA;}&#xA;&#xA;operation testPr1 () : (Int,Int)&#xA;{&#xA;    return (Pr0(func()),Pr1(func()));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are the C# codes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    class Driver&#xA;{&#xA;    static void Main(string[] args)&#xA;    {&#xA;        using (var sim = new QuantumSimulator())&#xA;        {&#xA;            var res3 = testPr1.Run(sim).Result;&#xA;            Console.WriteLine(res3);&#xA;&#xA;        }&#xA;&#xA;        Console.WriteLine(&quot;Press any key to continue...&quot;);&#xA;        Console.ReadKey();&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5189" LastEditorUserId="26" LastEditDate="2018-11-28T04:13:41.523" LastActivityDate="2018-11-28T04:13:41.523" Title="An algorithm with the Hadamard operator" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4807" PostTypeId="1" AcceptedAnswerId="4817" CreationDate="2018-11-26T07:15:35.667" Score="4" ViewCount="392" Body="&lt;p&gt;Often unitary gates are defined as a product of exponentials, with some parameter in the power-term. However, often it is not clear how to construct unitary gates from it, at least not for me that is. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/1411.4028.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; we see two of such situations. The first is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Pi_{j=1}^n e^{-i\beta\sigma_j^x},$$&lt;/span&gt;&#xA;with parameter &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_j^x$&lt;/span&gt; a single bit Pauli-X on qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. As I understand it, this is the same as a &lt;span class=&quot;math-container&quot;&gt;$R_X(2\beta)$&lt;/span&gt; gate applied to every qubit. Is that correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second one, that is a bit harder I believe and is related to clauses, is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Pi_{\alpha} e^{-i\gamma C_{\alpha}},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$C_{\alpha}$&lt;/span&gt; is 1 whenever clause &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is true and 0 otherwise. How can I implement this as elementary unitary gates? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="2005" LastEditDate="2018-11-30T11:52:28.343" LastActivityDate="2020-04-30T14:11:15.207" Title="Unitary gate(s) from product of exponent" Tags="&lt;quantum-gate&gt;&lt;simulation&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4808" PostTypeId="2" ParentId="4805" CreationDate="2018-11-26T07:53:40.093" Score="3" Body="&lt;p&gt;The simplest method to implement &lt;span class=&quot;math-container&quot;&gt;$e^{iA\theta}$&lt;/span&gt; for a small, Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; and eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Construct the unitary &lt;span class=&quot;math-container&quot;&gt;$U=\sum_i|i\rangle\langle\lambda_i|$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Implement the gate sequence:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$e^{i\theta\sum_i\lambda_i|i\rangle\langle i|}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, for one qubit, you have the middle term is equivalent to &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta(\lambda_0-\lambda_1) Z}$&lt;/span&gt;, up to an irrelevant global phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Technically, this answers your question. However, this is a silly way of doing it for solving a system of linear equations. If you can find the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, you might as well directly invert the linear system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, instead, you need to proceed as if you cannot directly calculate the eigenvalues/vectors, because you're going to use your implementation of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; within a phase estimation protocol to find these. There are various methods for Hamiltonian simulation. A very basic summary of one method (there are much &lt;a href=&quot;https://arxiv.org/abs/1805.00582&quot; rel=&quot;nofollow noreferrer&quot;&gt;more efficient methods&lt;/a&gt; available) is &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2081/1837&quot;&gt;here&lt;/a&gt;. But your given example is kind of trivial: I decompose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A'=\frac32\mathbb{I}+\frac12X,&#xA;$$&lt;/span&gt;&#xA;and since you don't care about a global phase, one might as will implement &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta X}$&lt;/span&gt;, for whatever the relevant &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is. Now it depends on what gates you're allowing in your quantum circuit as to how you decompose it. You might be able to implement it directly. Or, if you've only got a finite gate set such as &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, you might need to apply the Solovay-Kitaev algorithm to get a good decomposition.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-11-26T08:14:23.513" LastActivityDate="2018-11-26T08:14:23.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4809" PostTypeId="1" AcceptedAnswerId="4816" CreationDate="2018-11-26T11:40:24.430" Score="6" ViewCount="653" Body="&lt;p&gt;I am reading about the phase damping channel, and I have seen that some of the different references talking about such channel give different definitions of the Kraus operators that define the action of such channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;a href=&quot;http://csis.pace.edu/ctappert/cs837-18spring/QC-textbook.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt; define in page 384 the phase damping channel with Kraus operators&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_0=\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-\lambda}\end{pmatrix}, \qquad E_1=\begin{pmatrix}0 &amp;amp; 0\\0 &amp;amp; \sqrt{\lambda} \end{pmatrix},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is the phase damping parameter. However, in the &lt;span class=&quot;math-container&quot;&gt;$28^{th}$&lt;/span&gt; page of &lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph219/chap3_15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill's notes on quantum error correction&lt;/a&gt;, such channel is defined by Kraus operators:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_0=\sqrt{1-\lambda}I, \qquad E_1=\begin{pmatrix}\sqrt{\lambda} &amp;amp; 0 \\0  &amp;amp; 0 \end{pmatrix}, \qquad E_2=\begin{pmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{\lambda}\end{pmatrix}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seeing the notable difference between both descriptions, while also having a diffeent number of Kraus operators, I am wondering which is the correct one, or if they are equivalent, why is it such case. A unitary description of the phase damping channel will also be helpful for me.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-02-14T18:57:07.187" LastActivityDate="2021-02-14T18:57:07.187" Title="Confusion on the definition of the phase-damping channel" Tags="&lt;error-correction&gt;&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4810" PostTypeId="1" AcceptedAnswerId="4812" CreationDate="2018-11-26T12:57:30.207" Score="3" ViewCount="314" Body="&lt;p&gt;I am trying to implement the HHL algorithm (for solving &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;). I am assuming &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to be unitary and Hermitian so that I can find the Hamiltonian simulation for it easily. &#xA;For any &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to be Hermitian and unitary, it has to be of form,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ A = \begin{pmatrix} x &amp;amp; \pm\sqrt{1-x^2}\\ \pm\sqrt{1-x^2} &amp;amp; x\end{pmatrix} $$&lt;/span&gt;&#xA;I reduced &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha A}$&lt;/span&gt; to following (by using formula &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta A} = (\cos\theta)I + i(\sin\theta)A$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt;), but I don't know how to implement it on Qiskit.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ e^{i\alpha A} = \begin{pmatrix} \cos\alpha+i\sin\alpha\cos\frac{\theta}{2} &amp;amp; i\sin\alpha \sin\frac{\theta}{2} \\ i\sin\alpha \sin\frac{\theta}{2} &amp;amp; \cos\alpha+i\sin\alpha\cos\frac{\theta}{2} \end{pmatrix} .$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta = 2\cos^{-1}{x}$&lt;/span&gt;. How to construct this gate?&lt;/p&gt;&#xA;" OwnerUserId="4644" LastEditorUserId="26" LastEditDate="2018-12-23T07:59:13.163" LastActivityDate="2018-12-23T07:59:13.163" Title="Implementing gate with two parameters using Qiskit in Python" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4811" PostTypeId="2" ParentId="4810" CreationDate="2018-11-26T14:13:58.530" Score="2" Body="&lt;p&gt;There are plenty of methods that can be used to implement a given unitary matrix.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Only for 1-qubit gates (&lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix):&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The algorithm described in &lt;a href=&quot;https://arxiv.org/abs/1212.6253&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1212.6253&lt;/a&gt; seems to be the most efficient at the moment. It is restricted to 1-qubit quantum gates (&lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitary matrices) and only decompose in the Clifford + T basis.&lt;/li&gt;&#xA;&lt;li&gt;See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4250/1386&quot;&gt;this answer from @Niel de Beaudrap&lt;/a&gt; for other links.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h2&gt;For n-qubit gates (&lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; unitary matrices):&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solovay-Kitaev algorithm&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;All the Hamiltonian simulation algorithms. See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2497/1386&quot;&gt;my answer on another question&lt;/a&gt; for a list of links about Hamiltonian simulation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As you specifically mentioned Qiskit, you will probably be interested by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4546/1386&quot;&gt;this answer&lt;/a&gt; that show how to use Qiskit to initialise the &lt;span class=&quot;math-container&quot;&gt;$|0^{\otimes n}\rangle$&lt;/span&gt; state to an arbitrary state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you give to this procedure the desired output state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\alpha A}|0\rangle = \begin{pmatrix} \cos\alpha+i\sin\alpha\cos\frac{\theta}{2} &amp;amp; i\sin\alpha \sin\frac{\theta}{2} \\ i\sin\alpha \sin\frac{\theta}{2} &amp;amp; \cos\alpha+i\sin\alpha\cos\frac{\theta}{2} \end{pmatrix} \begin{pmatrix}1 \\ 0\end{pmatrix} = \begin{pmatrix} \cos\alpha+i\sin\alpha\cos\frac{\theta}{2} \\ i\sin\alpha \sin\frac{\theta}{2}\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;then the quantum circuit generated by the procedure will implement the unitary &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue with this method is that you will need to recompute the unitary for every different value of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; you encounter.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-11-26T14:13:58.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4812" PostTypeId="2" ParentId="4810" CreationDate="2018-11-26T14:19:16.380" Score="2" Body="&lt;p&gt;(Remark: I have corrected a typo in the matrix exponentiation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please notice that the matrix has the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ e^{i\alpha A} = \begin{pmatrix} a  &amp;amp; b \\ b &amp;amp; a \end{pmatrix} $$&lt;/span&gt;&#xA;with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|a|^2 + |b|^2 = 1$$&lt;/span&gt;&#xA;Now, please notice that this matrix can be expanded as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix} a  &amp;amp; b \\ b &amp;amp; a \end{pmatrix}  = \begin{pmatrix} e^{i \arg(a)}  &amp;amp; 0 \\ 0 &amp;amp; e^{i \arg(a)}  \end{pmatrix}   \begin{pmatrix} |a | &amp;amp; i|b| \\ i|b |&amp;amp; |a| \end{pmatrix}    $$&lt;/span&gt;&#xA;Defining&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |a| = \cos \phi$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |b| = \sin \phi$$&lt;/span&gt;&#xA;Thus we obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ e^{i\alpha A} = e^{i \arg(a) I_2}  e^{i\phi \sigma_x}   $$&lt;/span&gt;&#xA;In short, the result constitutes of an overall phase multiplication and an  &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expressed in the question's original variables:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\arg(a) = \arctan (\tan \alpha \cos \frac{\theta}{2})$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\phi = \arcsin (\sin \alpha \sin \frac{\theta}{2})$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-11-26T14:19:16.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4814" PostTypeId="1" AcceptedAnswerId="4815" CreationDate="2018-11-26T23:07:59.163" Score="1" ViewCount="68" Body="&lt;p&gt;Assume that Alice and Bob are allowed to share entanglement and are spatially separated. Alice is given an unknown state and asked to measure this in the computational basis to obtain &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;. Is there some way for Bob to also have a copy of same state as Alice instantaneously? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that it does not violate no-signalling since the outcome of the measurement for Alice is random - so she cannot use it to communicate. Another perspective is that this is sort of like cloning but since the only outcomes that Alice gets are &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt; and they are orthogonal, it isn't forbidden by the no-cloning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this can be done, how should she and Bob design a quantum circuit that achieves this? Otherwise, what forbids this possibility?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="26" LastEditDate="2018-11-27T00:32:43.227" LastActivityDate="2018-11-27T01:54:14.433" Title="Shared entanglement to copy orthogonal states" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;&lt;cloning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4815" PostTypeId="2" ParentId="4814" CreationDate="2018-11-26T23:56:10.950" Score="4" Body="&lt;p&gt;Assume this works. Then, nothing prevents Alice from applying the same protocol to a quantum state that is known to her, such as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This way, she &lt;em&gt;could&lt;/em&gt; send information to Bob instantaneously. Thus, it violates faster-than-light communication and thus is impossible.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="26" LastEditDate="2018-11-27T01:54:14.433" LastActivityDate="2018-11-27T01:54:14.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4816" PostTypeId="2" ParentId="4809" CreationDate="2018-11-27T00:58:23.943" Score="8" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; be the channels which subscripts for which conventions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{N}_{N.C.} (\rho) = \begin{pmatrix}&#xA;\rho_{00} &amp;amp; \rho_{01} \sqrt{1-\lambda}\\&#xA;\rho_{10} \sqrt{1-\lambda} &amp;amp; \rho_{11}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As compared to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{N}_{P} (\rho) = \begin{pmatrix}&#xA;\rho_{00} &amp;amp; \rho_{01} (1-\lambda)\\&#xA;\rho_{10} (1-\lambda) &amp;amp; \rho_{11}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can see that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_P (\bullet) = \mathcal{N}_{N.C.} (\mathcal{N}_{N.C.} (\bullet ))$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Easy to see that these are both representing the same sort of process just with different timescales. Preskill's does Nielsen-Chuang's twice.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-11-27T00:58:23.943" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4817" PostTypeId="2" ParentId="4807" CreationDate="2018-11-27T01:30:33.707" Score="2" Body="&lt;p&gt;It may be easier to write with &lt;span class=&quot;math-container&quot;&gt;$e^{-i \beta \sigma^z}$&lt;/span&gt;. You can see that this is the matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-i \beta \sigma^z} = \begin{pmatrix}&#xA;e^{-i \beta} &amp;amp; 0\\&#xA;0 &amp;amp; e^{i \beta}&#xA;\end{pmatrix}\\&#xA;= e^{-i \beta} \begin{pmatrix}&#xA;1 &amp;amp; 0\\&#xA;0 &amp;amp; e^{i 2 \beta}&#xA;\end{pmatrix}\\&#xA;= e^{-i \beta} R_Z (2 \beta)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was already diagonal in the computational basis so easier, but the same logic holds in the basis for &lt;span class=&quot;math-container&quot;&gt;$\sigma^x$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the product, yes you are applying the same to every qubit. You can see that all the individual terms in the product commute. It doesn't matter which order you apply these &lt;span class=&quot;math-container&quot;&gt;$R_X (2 \beta)$&lt;/span&gt; gates on each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question is a bit misstated with the indexing. You use &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; as the labels for your clauses so it should be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\prod_{\alpha=1}^k e^{-i \gamma C_\alpha}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C_\alpha$&lt;/span&gt; is the diagonal &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; matrix whose entries are either &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; depending on whether the clause is true or not. For example if the clause was AND and there were 2 qubits then &lt;span class=&quot;math-container&quot;&gt;$C_\alpha$&lt;/span&gt; would have diagonal entries &lt;span class=&quot;math-container&quot;&gt;$0,0,0,1$&lt;/span&gt; for the basis vectors being &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt; in that chosen order. The number of clauses, the number of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;'s does not have to be the same as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; the number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question is also a bunch of commuting terms. So if you know how to decompose into gates for a single term, you can just put them one after another in order &lt;span class=&quot;math-container&quot;&gt;$\alpha=1$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. So let's do just a single term &lt;span class=&quot;math-container&quot;&gt;$e^{-i \gamma C_\alpha}$&lt;/span&gt; for some arbitrary Boolean expression &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the terms are diagonal in the computational basis of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; with entries either &lt;span class=&quot;math-container&quot;&gt;$e^{-i \gamma}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be useful to have an auxiliary qubit. Then you can think about the reversible circuit that takes you from &lt;span class=&quot;math-container&quot;&gt;$x_1 , \cdots ,  x_n , y \to x_1 \cdots x_n , y \bigoplus f(x_1 \cdots x_n)$&lt;/span&gt;. This is a reversible operation, so I'll refer to other resources for how to break this down in terms of TOF gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you have an auxiliary with &lt;span class=&quot;math-container&quot;&gt;$y=0$&lt;/span&gt; you can do this and then get the auxiliary to be in the state 1 if and only if the &lt;span class=&quot;math-container&quot;&gt;$x_1 \cdots x_n$&lt;/span&gt;. Now do an &lt;span class=&quot;math-container&quot;&gt;$R_Z (-\gamma)$&lt;/span&gt; on that auxiliary. Now uncompute. That means bringing the auxiliary back to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. You can do this with the reverse of the reversible circuit you already found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will take care of &lt;span class=&quot;math-container&quot;&gt;$e^{-i \gamma C_\alpha}$&lt;/span&gt; for a single clause. Then just stick all the circuits for all the clauses back to back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this will be longer than necessary. But now that you have a circuit in many quantum gates that does the job poorly, getting one that does the job well is a much easier task.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2020-04-30T14:11:15.207" LastActivityDate="2020-04-30T14:11:15.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4818" PostTypeId="2" ParentId="4747" CreationDate="2018-11-27T15:36:13.543" Score="1" Body="&lt;p&gt;Pedro! I assume you are familiar to Grover's algorithm. Therefore, I suggest to read carefully these two papers below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9605034&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tight bounds on quantum searching&lt;/a&gt; (BBHT): it's a very broad Grover's algorithm analysis;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;nofollow noreferrer&quot;&gt;A quantum algorithm for finding the minimum&lt;/a&gt; (DH): this is the first Grover's algorithm application to optimization problems and we call DH (authors' name);&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first steps in quantum computing were in optimization problems. I think the papers below are a very good start:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) &lt;a href=&quot;https://epubs.siam.org/doi/abs/10.1137/040605072?journalCode=sjope8&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover’s quantum algorithm applied to global optimization&lt;/a&gt; (BBW): an adaptation of Grover's to optimization and it uses DH at the framework;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) &lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0377221710003954&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using modifications to grover’s search algorithm for quantum global optimization&lt;/a&gt;: a modification of BBW;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) &lt;a href=&quot;https://link.springer.com/article/10.1007/s10898-011-9806-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;A hybrid method for quantum global optimization&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) &lt;a href=&quot;https://link.springer.com/article/10.1007/s10898-013-0112-8&quot; rel=&quot;nofollow noreferrer&quot;&gt;A new hybrid classical-quantum algorithm for continuous global optimization problems&lt;/a&gt;: this last paper was produced at my research group at LNCC (Brazil) and you search several minimums with classical routines and the algorithm escapes with Grover.&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2018-11-27T15:36:13.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4819" PostTypeId="2" ParentId="2261" CreationDate="2018-11-27T15:54:47.493" Score="2" Body="&lt;p&gt;I suggest a good introductory book, but using lots of linear algebra, and it covers several nice topics. I really, really, love this book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/0470096993&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Explained&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend my advisor's book because it has a very nice view on Grover's algorithm and a good explanation on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/1461463351&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Walks and Search Algorithms&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5209" LastActivityDate="2018-11-27T15:54:47.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4820" PostTypeId="1" CreationDate="2018-11-27T17:04:12.463" Score="3" ViewCount="80" Body="&lt;p&gt;How can a CHSH game be realized in a photonic circuit?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-18T20:13:16.993" LastActivityDate="2018-12-18T20:13:16.993" Title="Photonic CHSH Games" Tags="&lt;resource-request&gt;&lt;photonics&gt;&lt;games&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4821" PostTypeId="2" ParentId="2261" CreationDate="2018-11-27T17:53:59.230" Score="2" Body="&lt;p&gt;The best book I could suggest is from Yanofsky and Mannucci &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/0521879965&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing for Computer Scientists&lt;/a&gt;. You would find very detailed and very numerical examples rather than abstract theorems which I believe is better in the beginner level. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2018-11-27T17:53:59.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4822" PostTypeId="1" AcceptedAnswerId="4826" CreationDate="2018-11-27T19:53:21.117" Score="2" ViewCount="127" Body="&lt;p&gt;I'm trying to work through a self-made exercise, which may be ill formed as a question. Any general advice in dealing with these types of problems is also much appreciated!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking at a quantum gate &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; for a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, that has the effect &lt;span class=&quot;math-container&quot;&gt;$$\sum_x \alpha_x \vert x\rangle\vert 0\rangle \mapsto \sum_x \alpha_x\vert x\rangle\vert f(x)\rangle. $$&lt;/span&gt; &#xA;This will in most cases be an entangled state: for instance, if &lt;span class=&quot;math-container&quot;&gt;$f(x) = x$&lt;/span&gt;, then I get what looks like a Bell state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to consider a case where the first register is already maximally entangled with a third party, Eve.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;One way to proceed is to write the first register as a mixed state which I obtain after tracing out Eve's part. The trouble now is, when we consider the action of the gate, that the gate entangles the two registers. I have no idea how to sort out the entanglement between Eve and the first register and the new entanglement between the first and second registers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alternatively, if I don't trace out Eve's register and instead implement the gate &lt;span class=&quot;math-container&quot;&gt;$\mathbb 1\otimes U_f$&lt;/span&gt;, then I'm still not sure what the outcome is. Before the gate, I have &lt;span class=&quot;math-container&quot;&gt;$$\sum_x \vert x \rangle_E\vert x\rangle\vert 0\rangle. $$&lt;/span&gt; (I have marked Eve's register for clarity.) After the gate, I could naively write &lt;span class=&quot;math-container&quot;&gt;$$\sum_x \vert x\rangle_E\vert x\rangle\vert f(x)\rangle, $$&lt;/span&gt; but this looks dubious to me. Particularly, this looks like Eve is now entangled with the second register but that seems wrong.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how entanglement monogamy fits in but I suspect my guess for the state isn't compatible with it. Can anyone clarify what's going on for me? &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="26" LastEditDate="2018-12-23T08:15:45.717" LastActivityDate="2018-12-23T08:15:45.717" Title="A quantum circuit with entanglement with Eve" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4823" PostTypeId="2" ParentId="2261" CreationDate="2018-11-27T21:20:27.443" Score="1" Body="&lt;p&gt;I created &lt;a href=&quot;https://youtu.be/F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;this simple video lecture&lt;/a&gt; aimed at computer scientists, which explains how basic quantum circuits work mathematically and how you can use them to solve the Deutsch Oracle problem: the simplest problem where a quantum computer outperforms a classical computer in some sense. I tried to make the lecture I would have wanted to watch when originally struggling through introductory textbooks on quantum computing (I used &lt;em&gt;Quantum Computing for Computer Scientists&lt;/em&gt; by Mannucci &amp;amp; Yanofsky and &lt;em&gt;Quantum Computer Science: An Introduction&lt;/em&gt; by Mermin) and am happy with the result. The slides are available &lt;a href=&quot;https://speakerdeck.com/ahelwer/quantum-computing-for-computer-scientists&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-11-27T21:20:27.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4825" PostTypeId="2" ParentId="4806" CreationDate="2018-11-28T01:36:24.367" Score="3" Body="&lt;p&gt;Thanks for posting the full Q# code! The problem is in testPr1: you're calling func() twice, and returning the first element of the tuple returned from the first call, and the second element of the tuple returned from the second call. Each call operates on a different qubit and performs a separate random measurement, so all 4 possible combinations should show up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the results you're looking for, try replacing the body of testPr1 with something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let res = func();&#xA;return (Pr0(res), Pr1(res));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2018-11-28T01:36:24.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4826" PostTypeId="2" ParentId="4822" CreationDate="2018-11-28T08:10:57.040" Score="2" Body="&lt;p&gt;In fact, what you suggest is absolutely right. If you start in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_x|x\rangle_E|x\rangle|0\rangle,&#xA;$$&lt;/span&gt;&#xA;then you will get the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_x|x\rangle_E|x\rangle|f(x)\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Monogamy of entanglement is a slightly different issue that's not really a concern here. What is says (loosely), is that if Alice and Eve share a maximally entangled state, then Alice and Bob cannot share any entanglement at all. But then, there's a tradeoff. As you reduce the amount of entanglement between Alice and Eve, you can correspondingly increase the amount of entanglement between Alice and Bob. The state that you've produced is entangled (a particular type of multipartite entanglement called GHZ), and there's entanglement between all 3 parties. But it sits within the bounds of what's allowed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be explicit, there are several different types of entanglement measure to which you can apply monogamy arguments. Probably the most common is the tangle, but I'm going to compute a different one (because it's something I did in one of &lt;a href=&quot;https://arxiv.org/abs/0901.3626&quot; rel=&quot;nofollow noreferrer&quot;&gt;my papers&lt;/a&gt;, which means I remember how to do it). Let's assume we have the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac{1}{\sqrt{n}}\sum_{x=0}^{n-1}|x\rangle_E|x\rangle_A|x\rangle_B.&#xA;$$&lt;/span&gt;&#xA;We're going to calculate something called the singlet fraction between Alice and Eve, &lt;span class=&quot;math-container&quot;&gt;$p_{AE}$&lt;/span&gt;. By symmetry (exchange the labels of E and B), Alice and Bob will share the same singlet fraction &lt;span class=&quot;math-container&quot;&gt;$p_{BE}=p_{AE}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The monogamy relation that they're supposed to satisfy (according to the &lt;a href=&quot;https://arxiv.org/abs/0901.3626&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;) is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{AE}+p_{AB}\leq\frac{n-1}{n}+\frac{1}{n+1}\left(\sqrt{p_{AE}}+\sqrt{p_{AB}}\right)^2,&#xA;$$&lt;/span&gt;&#xA;so for &lt;span class=&quot;math-container&quot;&gt;$p_{AE}=p_{AB}$&lt;/span&gt;, we're expecting to find that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p\leq\frac{n+1}{2n}.&#xA;$$&lt;/span&gt;&#xA;So long as it does that, there's no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the single monogamy?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{AE}=\max_{U,V}\text{Tr}(|B\rangle\langle B|_{AE}\otimes \mathbb{I}_BV_E\otimes U_A\otimes \mathbb{I}_B|\Psi\rangle\langle\Psi|V_E^\dagger\otimes U_A^\dagger\otimes\mathbb{I}_B).&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|B\rangle=\frac{1}{\sqrt{n}}\sum_x|x\rangle|x\rangle$&lt;/span&gt; is the Bell state.&#xA;You can certainly verify that if &lt;span class=&quot;math-container&quot;&gt;$U=V=\mathbb{I}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$p_{AE}=1/n$&lt;/span&gt;, and you can prove that this is optimal with just a little more work. Since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{n}\leq\frac{n+1}{2n},&#xA;$$&lt;/span&gt;&#xA;we're happy. Indeed, this particular state is nowhere near saturating this monogamy relation for &lt;span class=&quot;math-container&quot;&gt;$n\geq 2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-11-28T08:10:57.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4827" PostTypeId="1" AcceptedAnswerId="5324" CreationDate="2018-11-28T15:12:27.340" Score="2" ViewCount="196" Body="&lt;p&gt;The question is already explained in the title, but I'm curious regarding the possibility to adopt the BB84 protocol over LiFi (in theory). Could it be possible or are there some limitations, such as the single photon evaluation?&lt;/p&gt;&#xA;" OwnerUserId="5214" LastEditorUserId="26" LastEditDate="2018-11-28T15:15:33.277" LastActivityDate="2019-01-31T12:30:17.240" Title="BB84 protocol over LiFi" Tags="&lt;cryptography&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4828" PostTypeId="2" ParentId="2261" CreationDate="2018-11-28T17:29:27.393" Score="3" Body="&lt;p&gt;If you prefer to learn while coding, check out the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas&lt;/a&gt;. There are katas for teleportation, Deutsch-Jozsa, Grover's, and Simon's algorithms, among others.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2018-11-28T17:29:27.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4829" PostTypeId="1" AcceptedAnswerId="4830" CreationDate="2018-11-29T04:03:01.417" Score="4" ViewCount="281" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Zeno machines&lt;/strong&gt; (abbreviated ZM, and also called accelerated Turing machine, ATM) are a hypothetical computational model related to Turing machines that allows a countably infinite number of algorithmic steps to be performed in finite time. -&lt;a href=&quot;https://en.wikipedia.org/wiki/Zeno_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The &lt;strong&gt;quantum Zeno effect&lt;/strong&gt; (also known as the Turing paradox) is a feature of quantum-mechanical systems allowing a particle's time evolution to be arrested by measuring it frequently enough with respect to some chosen measurement setting. -&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Zeno_effect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This seems fitting for a continuous-variable environment (eg. photonics). &lt;strong&gt;Has any research been done on quantum Zeno machines?&lt;/strong&gt; (&lt;a href=&quot;https://www.google.com/search?q=&amp;quot;quantum+zeno+machine&amp;quot;&amp;amp;oq=&amp;quot;quantum+zeno+machine&amp;quot;&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google&lt;/a&gt;: &lt;em&gt;No results found for &quot;quantum zeno machine&quot;.&lt;/em&gt;)&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="55" LastEditDate="2020-08-09T04:59:46.627" LastActivityDate="2020-08-09T04:59:46.627" Title="Has any research been done on quantum Zeno machines?" Tags="&lt;complexity-theory&gt;&lt;quantum-turing-machine&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4830" PostTypeId="2" ParentId="4829" CreationDate="2018-11-29T15:43:37.343" Score="5" Body="&lt;p&gt;There are two notions of Zeno topics related to quantum computation. The first, which is &lt;a href=&quot;https://arxiv.org/abs/1210.3304v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;controversial&lt;/a&gt; is usually called &lt;a href=&quot;http://research.cs.queensu.ca/home/akl/cisc879/papers/PAPERS_FROM_MINDS_AND_MACHINES/VOLUME_12_NO_4/N415066054476282.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;hypercomputation&lt;/em&gt;&lt;/a&gt;, which deals with the possibility of surpassing the limitations of the Church-Turing thesis by means of quantum computation. It is related to the Zeno effect through the fact that if it could be realized, it may solve the halting problem.  &lt;a href=&quot;https://pdfs.semanticscholar.org/f6bd/f9382d7d629d416ca36c40ffcf348f28ab12.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Contogo&lt;/a&gt; refers to this option as a &quot;Quantum Zeno machine&quot;. In this context, please see also:&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706006v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen &lt;/a&gt; exploring this possibility.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second topic which goes by the name &lt;em&gt;Quantum Zeno effect&lt;/em&gt; (as referred to in the Wikipedia page in the question) is well established and experimentally verified, (please see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9909083v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kwiat, White, Mitchell, Nairz, Weihs, Weinfurter, and Zeilinger&lt;/a&gt; ).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kwiat et al. were motivated by one of the most striking examples of this effect: the Elitzur-Vaidman bomb testing problem, (please see the following &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9610033v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;review&lt;/a&gt; by Vaidman). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem deals with bombs which can only interact with the outside world by means of their trigger, classically, testing the bomb would cause every good bomb to explode, but quantum mechanically, one can reach, using the Zeno effect, almost 100% detection probability without exploding the bomb.  This is an example of a non-demolition measurement which is not accompanied by state reduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Translated to quantum computation terminology, this effect is called by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9805086v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jozsa&lt;/a&gt; &lt;em&gt;counterfactual quantum computation&lt;/em&gt;, according to which a quantum computer, programmed to solve a problem, can give the result even without running. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A detailed account of the Elitzur-Vaidman bomb testing problem is given by Penrose in his popular book: &lt;a href=&quot;https://pdfs.semanticscholar.org/4029/60524f55f8d84c7765b892a2e97cc8a3c4a1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Shadows of the mind&lt;/em&gt;.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the most important application of the quantum Zeno effect is its exploitation to keep a system inside a decoherence free subspace (by performing repeated measurements) as proposed by: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0004043v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Beige, Braun, Tregenna, and Knigh&lt;/a&gt;. Very recently, this proposal was adapted to holonomic quantum computation by &lt;a href=&quot;https://arxiv.org/abs/1803.00308v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mousolou and Sjöqvist&lt;/a&gt; .&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="2645" LastEditDate="2018-11-29T15:45:46.807" LastActivityDate="2018-11-29T15:45:46.807" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="4831" PostTypeId="1" AcceptedAnswerId="4891" CreationDate="2018-11-30T01:20:58.067" Score="2" ViewCount="74" Body="&lt;p&gt;I'm simulating a circuit like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(0, 0): ───────────────X───────X─────────@───────────────M─────────────                 &#xA;                       │       │         │               │                             &#xA;(1, 0): ───H───@───H───@───X───@^0.333───@^0.5───X───H───M─────────────                 &#xA;               │                                         │                                                                 &#xA;(2, 0): ───────X─────────────────────────────────────────M───────────── &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but when I try to debug by simulating with moments steps (as instructed &lt;a href=&quot;https://cirq.readthedocs.io/en/latest/simulation.html#stepping-through-a-circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), I end up getting 36 steps, and I assume this is because some of the gates in the circuit are decomposed into XmonGates. Is there a way to see this decomposed circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, is there a way to step through the simulation where each step matches a moment in the original circuit?&lt;/p&gt;&#xA;" OwnerUserId="5222" LastEditorUserId="26" LastEditDate="2018-12-23T07:58:09.837" LastActivityDate="2018-12-23T07:58:09.837" Title="Is it possible to see how CompositeGates are decomposed when simulated using XmonSimulator?" Tags="&lt;quantum-gate&gt;&lt;simulation&gt;&lt;cirq&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4832" PostTypeId="2" ParentId="4798" CreationDate="2018-11-30T10:26:08.880" Score="5" Body="&lt;p&gt;I wanted to add a short comment to the earliest reference. I believe this was shown already a bit earlier in Section 5.2 of&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;A Theory of Quantum Error-Correcting Codes&#xA;Emanuel Knill, Raymond Laflamme &#xA;https://arxiv.org/abs/quant-ph/9604034&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the specific result is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Theorem 5.1.&lt;/strong&gt; &lt;em&gt;A &lt;span class=&quot;math-container&quot;&gt;$(2^r,k)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt;-error-correcting quantum code must satisfy &lt;span class=&quot;math-container&quot;&gt;$r \geqslant 4e + \lceil \log k \rceil$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here, an &lt;span class=&quot;math-container&quot;&gt;$(N,K)$&lt;/span&gt; code is an embedding of a &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;-dimensional subspace into an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional system; it is an &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt;-error-correcting code if the system decomposes as a tensor product of qubits, and the code is capable of correcting errors of weight &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt;.&#xA;In particular, a &lt;span class=&quot;math-container&quot;&gt;$(2^n, 2^k)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt;-error-correcting code is what we would now describe as an &lt;span class=&quot;math-container&quot;&gt;$[\![n,k,2e\:\!{+}1]\!]$&lt;/span&gt; code. Theorem&amp;nbsp;5.1 then allows us to prove that for &lt;span class=&quot;math-container&quot;&gt;$k \geqslant 1$&lt;/span&gt; and an odd integer &lt;span class=&quot;math-container&quot;&gt;$d \geqslant 3$&lt;/span&gt;, an &lt;span class=&quot;math-container&quot;&gt;$[\![n,k,d]\!]$&lt;/span&gt; code must satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA; n&#xA;\;&amp;amp;\geqslant\;&#xA; 4\bigl\lceil\tfrac{d-1}{2}\bigr\rceil + \lceil \log 2^k \rceil&#xA;\\[1ex]&amp;amp;\geqslant\;&#xA; \bigl\lceil 4 \cdot \tfrac{d-1}{2} \bigr\rceil + \lceil k \rceil&#xA;\\[1ex]&amp;amp;=\;&#xA; 2d - 2 + k&#xA;\;\geqslant\;&#xA; 6 - 2 + 1&#xA;\;=\;&#xA; 5.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;N.B.&lt;/strong&gt;&#xA;There is a peculiarity with the dates here: the arxiv submission of above paper is April 1996, a couple of months earlier than Grassl, Beth, and Pellizzari paper submitted in Oct 1996. However, the date below the title in the pdf states a year earlier, April 1995.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative proof, I could imagine (but haven't tested yet) that simply solving for a weight distribution that satisfies the Mac-Williams Identities should also suffice. Such a strategy is indeed used&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Quantum MacWilliams Identities&#xA;Peter Shor, Raymond Laflamme&#xA;https://arxiv.org/abs/quant-ph/9610040&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to show that no degenerate code on five qubits exists that can correct any single errors.&lt;/p&gt;&#xA;" OwnerUserId="2192" LastEditorUserId="124" LastEditDate="2018-12-01T16:14:34.040" LastActivityDate="2018-12-01T16:14:34.040" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4834" PostTypeId="1" AcceptedAnswerId="4836" CreationDate="2018-11-30T17:55:57.293" Score="10" ViewCount="2036" Body="&lt;p&gt;Let's say Alice wants to send Bob a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;em&gt;.5&lt;/em&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; also with probability &lt;em&gt;.5&lt;/em&gt;. So after a qubit Alice prepares leaves her lab, the system could be represented by the following density matrix: &lt;span class=&quot;math-container&quot;&gt;$$\rho = .5 |0\rangle \langle 0| + .5 |1\rangle \langle 1|= \begin{bmatrix} .5 &amp;amp; 0 \\ 0 &amp;amp; .5 \end{bmatrix} $$&lt;/span&gt;Am I right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, Bob would perform measurement in the standard basis. This is where I get confused. For example, he could get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability .5 and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with .5. So what is the density matrix representing the state after Bob performs his measurement in the standard basis accounting for both of his possible outcomes? &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2021-02-20T16:25:14.187" LastActivityDate="2021-02-20T16:25:14.187" Title="Density matrix after measurement on density matrix" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;cryptography&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4835" PostTypeId="2" ParentId="4834" CreationDate="2018-11-30T18:25:43.983" Score="5" Body="&lt;p&gt;So Alice sends Bob a qubit with the density matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{1}{2}|0\rangle\langle 0| + \frac{1}{2}|1\rangle\langle 1| = \begin{bmatrix} .5 &amp;amp; 0 \\ 0 &amp;amp; .5 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as you said. (I've fixed the notation to make it a density matrix, what you wrote was in the structure of a state, but with non-normalized coeffecients. It is important to note the distinction of pure states vs mixed states. What you are discussing is a mixed state and cannot be described as a single state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, mixed states can only be described in the density matrix picture.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After measurement the state Bob has becomes a pure state, as you described. He gets either &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle \rightarrow \rho = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&#xA;or &lt;span class=&quot;math-container&quot;&gt;$$|1\rangle \rightarrow \rho = \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt;&#xA;with equal probability. As you can see once the qubit is measured you lose all indication that it was once in a mixed state or anything else about its history.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2018-11-30T18:25:43.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4836" PostTypeId="2" ParentId="4834" CreationDate="2018-11-30T19:40:09.820" Score="10" Body="&lt;p&gt;So, Bob is given the following state (also called the &lt;em&gt;maximally-mixed state&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{2}|0\rangle\langle 0| + \frac{1}{2}|1\rangle\langle 1| = \begin{bmatrix} \frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2} \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noticed, one nice feature of density matrices is they enable us to capture the uncertainty of an outcome of a measurement and account for the different possible outcomes in a single equation. Projective measurement is defined by a set of measurement operators &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt;, one for each possible measurement outcome. For example, when measuring in the computational basis (collapsing to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) we have the following measurement operators:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_0 = |0\rangle\langle0| = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_1 = |1\rangle\langle1| = \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; is associated with outcome &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; is associated with outcome &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. These matrices are also called &lt;em&gt;projectors&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, given a single-qbit density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, we can calculate the probability of it collapsing to some value with the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_i = Tr(P_i \rho)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$Tr(M)$&lt;/span&gt; is the &lt;em&gt;trace&lt;/em&gt;, which is the sum of the elements along the main diagonal of matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. So, we calculate the probability of your example collapsing to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_0 = Tr(P_0 \rho)&#xA;= Tr \left( \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} \begin{bmatrix} \frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2} \end{bmatrix} \right)&#xA;= Tr \left( \begin{bmatrix} \frac 1 2 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} \right) = \frac 1 2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the formula for the post-measurement density operator is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho_i = \frac{P_i \rho P_i}{p_i}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which in your example is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho_0 = \frac{\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} \begin{bmatrix} \frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2} \end{bmatrix} \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}}{\frac 1 2} = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is indeed the density matrix for the pure state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't just want the density operator for a certain measurement outcome, though - what we want is a density operator which captures the branching nature of measurement, representing it as an ensemble of possible collapsed states! For this, we use the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho' = \sum_i p_i \rho_i = \sum_i P_i \rho P_i$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in our example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho' = \left( \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} \begin{bmatrix} \frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2} \end{bmatrix} \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} \right) + \left( \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix} \begin{bmatrix} \frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2} \end{bmatrix} \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix} \right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho' = \begin{bmatrix} \frac 1 2 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}&#xA;+ \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; \frac 1 2 \end{bmatrix} = \begin{bmatrix} \frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2} \end{bmatrix} = \frac{1}{2}|0\rangle\langle 0| + \frac{1}{2}|1\rangle\langle 1|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your final density matrix is unchanged! This should actually be unsurprising, because we started out with the maximally-mixed state and performed a further randomizing operation on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Much of this answer copied from my previous detailed answer &lt;a href=&quot;https://physics.stackexchange.com/a/426519/182854&quot;&gt;here&lt;/a&gt;, which in turn is based off of another answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4130/4153&quot;&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2018-11-30T19:45:30.507" LastActivityDate="2018-11-30T19:45:30.507" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4837" PostTypeId="2" ParentId="4834" CreationDate="2018-12-01T11:58:02.980" Score="4" Body="&lt;p&gt;It is important to emphasise that a density matrix may not be absolute; it represents the state of somebody's knowledge of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this, consider 3 parties: Alice, Bob and Charlie. Alice prepares a qubit in either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Now, Alice knows which state she prepared (let's assume it's &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;), so Alice's description of the qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|$&lt;/span&gt;. However, Bob and Charlie only know the preparation procedure, not which choice Alice made. So, they both have to describe the state as 50:50 being 0 or 1. i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}(|0\rangle\langle 0|+|1\rangle\langle 1|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, Bob receives the state and measures it in the Z basis. So long as Alice knows what measurement is being done, she knows that the state won't change, so her description of the state remains the same, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|$&lt;/span&gt;. Bob gets the measurement result, so now he knows that the state is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, so if he's using a density matrix, he describes it as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|$&lt;/span&gt;. However, Charlie, who does not know what measurement result Bob got, still does not know any better than to describe the state by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}(|0\rangle\langle 0|+|1\rangle\langle 1|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-01T11:58:02.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4838" PostTypeId="1" CreationDate="2018-12-01T23:51:26.643" Score="3" ViewCount="390" Body="&lt;p&gt;How to set up Qconfig.py and where is the file? I mean under which folder? Like &lt;code&gt;/anaconda/lib/python3.6/site-packages/qiskit/&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5232" LastEditorUserId="26" LastEditDate="2018-12-02T06:13:45.820" LastActivityDate="2018-12-07T10:53:21.703" Title="How to set up Qconfig.py and where is the file?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4839" PostTypeId="1" AcceptedAnswerId="4841" CreationDate="2018-12-02T11:28:41.900" Score="6" ViewCount="539" Body="&lt;p&gt;In the Polar Decomposition section in Nielsen and Chuang (page 78 in the 2002 edition),&#xA;there is a claim that any matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; will have a decomposition &lt;span class=&quot;math-container&quot;&gt;$UJ$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; is positive and is equal to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{A^\dagger A}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, how can we be sure that every matrix &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A$&lt;/span&gt; will have a square root, and secondly, that the square root will be a positive operator?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="640" LastEditDate="2019-01-28T21:45:05.340" LastActivityDate="2019-03-04T16:44:49.850" Title="How can we be sure that for every $A$, $A^\dagger A$ has a positive square root?" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4841" PostTypeId="2" ParentId="4839" CreationDate="2018-12-02T12:44:31.577" Score="5" Body="&lt;p&gt;A matrix is &lt;a href=&quot;https://en.wikipedia.org/wiki/Positive-definite_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;positive&lt;/a&gt; if and only if it is Hermitian (and thus unitarily diagonalizable) and all its eigenvalues are positive (that they are real follows automatically from it being Hermitian).&#xA;If this is not the way you define a positive operator, then you need to specify how you do so that we can prove the equivalence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is positive, &lt;span class=&quot;math-container&quot;&gt;$A\ge0$&lt;/span&gt;, iff it can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\sum_k \lambda_k v_k v_k^*\equiv \sum_k \lambda_k \lvert v_k\rangle\!\langle v_k\rvert, \quad \lambda_k\ge0,$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\langle v_k\rvert v_j\rangle\equiv v_k^* v_j=\delta_{jk}$&lt;/span&gt;.&#xA;I used here both diadic notation and bra-ket notation just to point out that these are simply two equivalent ways to write the same thing.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Why is &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A\ge0$&lt;/span&gt;?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;One way to show this is to start from the fact that &lt;em&gt;unitarily diagonalizable is equivalent to normal&lt;/em&gt;.&#xA;This means that a matrix &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$B=UDU^\dagger$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and diagonal matrix &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; &lt;em&gt;if and only if&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$BB^\dagger=B^\dagger B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can readily verify, it is the case that &lt;span class=&quot;math-container&quot;&gt;$(A^\dagger A)^\dagger (A^\dagger A)=(A^\dagger A)(A^\dagger A)^\dagger$&lt;/span&gt;. It follows that we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A^\dagger A=\sum_k s_k\lvert v_k\rangle\!\langle v_k\rvert$$&lt;/span&gt;&#xA;for some (generally complex as far as we know now) &lt;span class=&quot;math-container&quot;&gt;$s_k$&lt;/span&gt;, satisfying &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A\lvert v_k\rangle=s_k\lvert v_k\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That &lt;span class=&quot;math-container&quot;&gt;$s_k\in\mathbb R$&lt;/span&gt;, and more precisely &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0$&lt;/span&gt;, now follows from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A^\dagger A\lvert v_k\rangle=s_k\lvert v_k\rangle&#xA;\Longrightarrow s_k=\langle v_k\rvert A^\dagger A\lvert v_k\rangle=\|Av_k\|^2\ge0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Why &lt;span class=&quot;math-container&quot;&gt;$\sqrt{A^\dagger A}\ge0$&lt;/span&gt;?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The square root of a positive operator is (can be) defined through the square root of its eigenvalues. In other words, if &lt;span class=&quot;math-container&quot;&gt;$A=\sum_k s_k\lvert v_k\rangle\!\langle v_k\rvert$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0$&lt;/span&gt;, then we define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt A=\sum_k \sqrt{s_k}\lvert v_k\rangle\!\langle v_k\rvert.$$&lt;/span&gt;&#xA;Clearly, &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0\Longrightarrow \sqrt{s_k}\ge0$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$A\ge0\Longrightarrow \sqrt A\ge0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Polar_decomposition#Matrix_polar_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polar decomposition&lt;/a&gt; from &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt;&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;This is not directly related to the question asked, but as we are talking about this in connection with the polar decomposition, let me show another way to get to the polar decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start from the previously shown fact that &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A\ge0$&lt;/span&gt;.&#xA;This is equivalent to it being writable as &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A=\sum_k s_k\lvert v_k\rangle\!\langle v_k\rvert$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0$&lt;/span&gt;.&#xA;But then again, note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A^\dagger A v_k=s_k v_k&#xA;\Longleftrightarrow \langle A v_k,Av_j\rangle=\delta_{jk}s_k&#xA;\Longleftrightarrow Av_j=\sqrt{s_j}w_j$$&lt;/span&gt;&#xA;for some orthonormal set of vectors &lt;span class=&quot;math-container&quot;&gt;$w_j$&lt;/span&gt;.&#xA;This is nothing but the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;singular value decomposition&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to get to the polar decomposition, we just rewrite this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\sum_k \sqrt{s_k}\lvert w_k\rangle\!\langle v_k\rvert=&#xA;\Bigg(\underbrace{\sum_k \lvert w_k\rangle\!\langle v_k\rvert}_{U}\Bigg)\Bigg(\underbrace{\sum_k \sqrt{s_k} \lvert v_k\rangle\!\langle v_k\rvert}_{\sqrt{A^\dagger A}}\Bigg),$$&lt;/span&gt;&#xA;which is nothing but the polar decomposition of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-03-04T16:44:49.850" LastActivityDate="2019-03-04T16:44:49.850" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4842" PostTypeId="1" AcceptedAnswerId="4843" CreationDate="2018-12-02T20:26:33.073" Score="4" ViewCount="118" Body="&lt;p&gt;Given an operator &lt;span class=&quot;math-container&quot;&gt;$L = \sum_{ij}L_{ij}\vert i\rangle\langle j\vert$&lt;/span&gt;, in some basis, the definition of vectorization is &lt;span class=&quot;math-container&quot;&gt;$vec(L) = \sum_{ij}L_{ij}\vert i\rangle\vert j\rangle$&lt;/span&gt;. The operation is invertible and heavily used in quantum information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This definition always leads to a pure bipartite state but my notes, Wikipedia, etc. have no indication about whether one can also map operators (of some sort) to a mixed bipartite state. Can anyone shed some light on if this makes sense and there exist extensions of the definition of vectorization?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-08-20T08:03:29.113" LastActivityDate="2020-08-20T08:03:29.113" Title="Can vectorization lead to mixed states?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4843" PostTypeId="2" ParentId="4842" CreationDate="2018-12-02T22:17:12.530" Score="4" Body="&lt;p&gt;You have given &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; as a general linear operator between Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; (the one indexed by &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; respectively). That is all possible linear operators, the entirety of &lt;span class=&quot;math-container&quot;&gt;$Mor(H_1,H_2)$&lt;/span&gt;. Mor here is short for the word morphism, a word for whatever the notion of whatever sorts of functions/operators/etc that are allowed. In the present context of vector spaces, this just means what are the linear operators &lt;span class=&quot;math-container&quot;&gt;$H_1 \to H_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we have all of the linear operators and for each of them &lt;span class=&quot;math-container&quot;&gt;$\mathbf{vec}$&lt;/span&gt; produces a pure state in &lt;span class=&quot;math-container&quot;&gt;$H_2 \otimes H_1$&lt;/span&gt;. There is nothing missing. There are no other linear operators. There is no way to get states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$H_2 \otimes H_1$&lt;/span&gt; that aren't pure here. Only mixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You already noticed this is invertible. That is we have &lt;span class=&quot;math-container&quot;&gt;$Mor(H_1,H_2) \simeq H_2 \otimes H_1$&lt;/span&gt;. The LHS is where &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is an element and the RHS is where &lt;span class=&quot;math-container&quot;&gt;$\mathbf{vec}(L)$&lt;/span&gt; is an element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are extensions of this concept. For example suppose we have 3 Hilbert spaces. &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_3$&lt;/span&gt;. Giving a linear map from &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; to the space of linear maps from &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H_3$&lt;/span&gt;, which would be denoted as &lt;span class=&quot;math-container&quot;&gt;$Mor(H_1, Mor(H_2,H_3))$&lt;/span&gt; is the same as giving a linear operator from &lt;span class=&quot;math-container&quot;&gt;$H_1 \otimes H_2 \to H_3$&lt;/span&gt;. See how this implies the above. Take &lt;span class=&quot;math-container&quot;&gt;$H_3=\mathbb{C}$&lt;/span&gt;. Then a way of thinking about a bra for &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; is as a linear map &lt;span class=&quot;math-container&quot;&gt;$H_2 \to H_3=\mathbb{C}$&lt;/span&gt;. I'll leave you to ponder this fact some more to fully flush out how it implies the above.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2018-12-03T07:49:42.537" LastActivityDate="2018-12-03T07:49:42.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4844" PostTypeId="1" CreationDate="2018-11-26T22:23:24.493" Score="3" ViewCount="70" Body="&lt;p&gt;Show that an isometric extension of the erasure channel is &lt;span class=&quot;math-container&quot;&gt;$$U^N_{A\to BE} =\sqrt{1−\epsilon}\left(|0\rangle_B \langle 0|_A +|1\rangle_B \langle 1|_A \right)\otimes|e\rangle_E+ \sqrt{\epsilon}|e\rangle_B \langle0|_A \otimes |0\rangle_E + \sqrt{\epsilon}|e\rangle_ B \langle 1|_A \otimes |1\rangle_E$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\sqrt{1−\epsilon} \text{ I}_{A \to B}\otimes|e\rangle_E+\sqrt{\epsilon}\text{ I}_{A \to E}\otimes\otimes|e\rangle_B$$&lt;/span&gt;&#xA;where, the Erasure Channel implements the following: &lt;span class=&quot;math-container&quot;&gt;$\rho \to (1 − \epsilon) \rho + \epsilon|e\rangle\langle e|$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the Kraus operators for the quantum erasure channel are the following:  &lt;span class=&quot;math-container&quot;&gt;$\left\{\sqrt{1−\epsilon}\left(|0\rangle_B \langle 0|_A +|1\rangle_B \langle 1|_A \right),\sqrt{\epsilon}|e\rangle_B \langle0|_A,\sqrt{\epsilon}|e\rangle_B \langle1|_A\right\}$&lt;/span&gt;. I also know that for a quantum channel &lt;span class=&quot;math-container&quot;&gt;$N_{A\to B}$&lt;/span&gt; with the following Kraus representation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$N_{A\to B}(\rho_A) = \sum_jN_j\rho_A N_j^{\dagger},$$&lt;/span&gt;&#xA;an isometric extension of the channel &lt;span class=&quot;math-container&quot;&gt;$N_{A\to B}$&lt;/span&gt; is the following linear map: &lt;span class=&quot;math-container&quot;&gt;$$U^N_{A \to BE} =\sum_jN_j \otimes|j\rangle$$&lt;/span&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this, the &lt;span class=&quot;math-container&quot;&gt;$N_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N_3$&lt;/span&gt; in our case are &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1−\epsilon}\left(|0\rangle_B \langle 0|_A +|1\rangle_B \langle 1|_A \right)$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\sqrt{\epsilon}|e\rangle_B \langle0|_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\epsilon}|e\rangle_B \langle1|_A$&lt;/span&gt; are respectively. I am just confused on, which &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; to choose. How do I know the appropriate orthonormal vectors in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerDisplayName="tattwamasi amrutam" LastEditorUserId="26" LastEditDate="2019-01-01T09:03:21.227" LastActivityDate="2019-01-01T09:03:21.227" Title="Isometric Extension of an Erasure Channel" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4845" PostTypeId="1" CreationDate="2018-12-03T05:06:57.113" Score="2" ViewCount="95" Body="&lt;p&gt;I am trying to implement the order finding algorithm on Cirq finding the minimal positive &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; for coprime &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; satisfying the equation &lt;span class=&quot;math-container&quot;&gt;$x^r \ = \ 1$&lt;/span&gt;(mod&lt;span class=&quot;math-container&quot;&gt;$ \ N$&lt;/span&gt;). In my case, I have set &lt;span class=&quot;math-container&quot;&gt;$x \ = \ 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N \ = \ 3$&lt;/span&gt;, so the algorithm should output &lt;span class=&quot;math-container&quot;&gt;$r \ = \ 2$&lt;/span&gt;. In order to implement the unitary, I simply observed that if we initialize the input that is being acted upon by the controlled-unitary matrices as a collection of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states, the unitary operation for this algorithm, &lt;span class=&quot;math-container&quot;&gt;$U|y\rangle \ = \ |2^jy \ $&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\rangle$&lt;/span&gt; acts trivially, in all circumstances, since &lt;span class=&quot;math-container&quot;&gt;$|y\rangle \ = \ |11\rangle \ = \ |3\rangle$&lt;/span&gt;. I feel as though I am missing a very important point, or maybe am not understanding the algorithm correctly, because when I try to implement the algorithm with no unitary gate (since it is supposedly trivial), the algorithm does not work.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2018-12-03T07:31:11.683" LastActivityDate="2018-12-03T07:31:11.683" Title="Would this quantum algorithm implementation work?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;cirq&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="4846" PostTypeId="1" AcceptedAnswerId="4847" CreationDate="2018-12-03T06:58:50.657" Score="3" ViewCount="251" Body="&lt;p&gt;Are projective measurement bases always orthonormal?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2018-12-03T07:21:28.250" LastActivityDate="2018-12-03T19:04:22.273" Title="Are projective measurement bases always orthonormal?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4847" PostTypeId="2" ParentId="4846" CreationDate="2018-12-03T07:42:44.813" Score="7" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that you require several properties of a projective measurement including &lt;span class=&quot;math-container&quot;&gt;$P_i^2=P_i$&lt;/span&gt; for each projector, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_iP_i=\mathbb{I}.&#xA;$$&lt;/span&gt;&#xA;The first of these show you that the &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; have eigenvalues 0 and 1. Now take a &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; that is an eigenvector of eigenvalue 1 of a particular projector &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt;. Use this in the identity relation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\sum_jP_j\right)|\phi\rangle=\mathbb{I}|\phi\rangle&#xA;$$&lt;/span&gt;&#xA;Clearly, this simplifies to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle+\sum_{j\neq i}P_j|\phi\rangle=|\phi\rangle.&#xA;$$&lt;/span&gt;&#xA;Hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j\neq i}P_j|\phi\rangle=0.&#xA;$$&lt;/span&gt;&#xA;The &lt;span class=&quot;math-container&quot;&gt;$P_j$&lt;/span&gt; are all non-negative, so the only way that this can be 0 is if &lt;span class=&quot;math-container&quot;&gt;$P_j|\phi\rangle=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j\neq i$&lt;/span&gt;. (To expand upon this, assume there's a &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$P_k|\phi\rangle=|\psi\rangle\neq 0$&lt;/span&gt;. This means that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j\neq i,k}\langle\psi|P_j|\phi\rangle=-\langle\psi|P_k|\phi\rangle,&#xA;$$&lt;/span&gt;&#xA;so some terms must be negative, which is impossible if the eigenvalues are all 0 and 1.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-12-03T16:20:11.307" LastActivityDate="2018-12-03T16:20:11.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4848" PostTypeId="2" ParentId="64" CreationDate="2018-12-03T11:26:55.217" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://quantumcomputer.ac.cn&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://quantumcomputer.ac.cn&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They really need to get their act together and make sure it's on the first page of Google. I had to go way into uncharted territory to find this. (Like, not the first page of Google.)&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2018-12-03T11:26:55.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4849" PostTypeId="1" CreationDate="2018-12-03T12:26:38.123" Score="0" ViewCount="129" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\q}[2]{\langle #1 | #2 \rangle}&#xA;\newcommand{\qr}[1]{|#1\rangle}&#xA;\newcommand{\ql}[1]{\langle #1|}&#xA;\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}&#xA;\newcommand{\round}[1]{\left\lfloor #1 \right\rceil}&#xA;\DeclareMathOperator{\div}{div}&#xA;\DeclareMathOperator{\modulo}{mod}&#xA;$&lt;/span&gt;I present all the detailed reasoning in my strategy and show it has a problem.  My question is how to overcome this flaw.  An example here will be best.  In what follows, &quot;bit&quot; means &quot;q-bit&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$N = 77$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; be the number of bits of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. How many bits do I need to superpose all odd integers from 1 to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{77}$&lt;/span&gt;?  I believe that's approximately &lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt;.  (It is &lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt; exactly if &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; were even.  Since it is not, I need &lt;span class=&quot;math-container&quot;&gt;$\floor{n/2} + 1$&lt;/span&gt;.)  For &lt;span class=&quot;math-container&quot;&gt;$N = 77$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; bits is enough.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; be a register big enough to hold the superposed states of all all odd integers from 1 to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{77}$&lt;/span&gt;.  Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be a register big enough to hold &lt;span class=&quot;math-container&quot;&gt;$77$&lt;/span&gt;, but also big enough to hold the division of &lt;span class=&quot;math-container&quot;&gt;$77$&lt;/span&gt; by the superposed state held in &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.  For clarity, assume my division operator is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_{\div} \qr{b}_x \qr{a}_y = \qr{b}_x (\qr{a \div b} \qr{a \modulo b})_y$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and assume that &lt;span class=&quot;math-container&quot;&gt;$y = n + (n/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x = n/2$&lt;/span&gt;.  So, in our example, since &lt;span class=&quot;math-container&quot;&gt;$N=77$&lt;/span&gt;, it follows &lt;span class=&quot;math-container&quot;&gt;$n = 8$&lt;/span&gt; and then the size of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; bits, while the size of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$8 + 4 = 12$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But since I want in &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; only the odd integers, I take &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;'s lowest bit and force it to be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.  So my preparation of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is to start with it completely zeroed out, flip its lowest bit and finally use the Hadamard gate on all of B's bits except the lowest.  I get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes 3} \qr{000}\otimes\qr1 = \qr{+}\qr{+}\qr{+} \otimes \qr{1}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I get the states &lt;span class=&quot;math-container&quot;&gt;$\qr{1}, \qr3, \qr5, \qr7, \qr9, \qr{11}, \qr{13}, \qr{15}$&lt;/span&gt;.  I wish I had stopped at &lt;span class=&quot;math-container&quot;&gt;$\qr{7}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means I need less than &lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt; bits in register &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.  By inspection, I see in this example that the size of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; should be &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; bits, not &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; because this way I end up with the superposition terms &lt;span class=&quot;math-container&quot;&gt;$\qr1, \qr3, \qr5, \qr7$&lt;/span&gt;, but all I'm sure of here is just this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is what size in general should &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; have so that it is able to hold all superposition terms of only odd integers from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="1589" LastEditDate="2018-12-03T23:30:45.937" LastActivityDate="2018-12-04T01:07:09.790" Title="How to prepare a superposed states of odd integers from $1$ to $\sqrt{N}$?" Tags="&lt;algorithm&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4850" PostTypeId="2" ParentId="4849" CreationDate="2018-12-03T17:51:14.453" Score="1" Body="&lt;p&gt;You would only need &lt;span class=&quot;math-container&quot;&gt;$\log_2(N)$&lt;/span&gt; bits to represent a number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and also all the numbers from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Similarly, you would need &lt;span class=&quot;math-container&quot;&gt;$$\log_2(\sqrt{N}) = \log_2(N^{\frac{1}{2}}) = \frac{1}{2} \times \log_2(N) $$&lt;/span&gt; bits to represent numbers from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt;. So I would say you would need half of &lt;span class=&quot;math-container&quot;&gt;$\log_2(N)$&lt;/span&gt; qubits in your B register. The power of quantum computing comes from the fact that in the classical computer, you could only represent a specific number in the range of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\log_2(\sqrt{N})$&lt;/span&gt; qubits, here you would get the benefit of superposition that would hold all of them. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2018-12-03T22:35:19.383" LastActivityDate="2018-12-03T22:35:19.383" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4851" PostTypeId="2" ParentId="4846" CreationDate="2018-12-03T19:04:22.273" Score="3" Body="&lt;p&gt;Here is another way to see this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Projection_(linear_algebra)&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;projection&lt;/em&gt;&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is an operator such that &lt;span class=&quot;math-container&quot;&gt;$P^2=P$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This directly implies that we can attach to each projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; a set of orthonormal states that represent it, by choosing any orthonormal base for its range. More precisely, if &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; has trace &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(P_i)=n$&lt;/span&gt;, then we can represent &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; as a set of orthonormal states &lt;span class=&quot;math-container&quot;&gt;$\{\lvert\psi_{i,j}\rangle\}_{j=1}^n$&lt;/span&gt;.&#xA;Note in particular that if &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(P_i)=1$&lt;/span&gt; then this choice is unique, meaning that there is always a bijection between trace-1 projections and states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The projector &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; and the corresponding states are connected through&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_i=\sum_{j=1}^n \lvert\psi_{ij}\rangle\!\langle \psi_{ij}\rvert.$$&lt;/span&gt;&#xA;In the simpler case of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(P_i)=1$&lt;/span&gt; this reads &lt;span class=&quot;math-container&quot;&gt;$P_i=\lvert\psi_i\rangle\!\langle\psi_i\rvert$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you are asking for a projective measurement &lt;em&gt;basis&lt;/em&gt;, then you require a set of operators which describes every possible outcome of your state.&#xA;This condition is expressed mathematically by requiring &lt;span class=&quot;math-container&quot;&gt;$$\sum_i P_i=I,$$&lt;/span&gt;&#xA;which in terms of the associated ket states reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{ij}\lvert\psi_{ij}\rangle\!\langle\psi_{ij}\rvert=I,$$&lt;/span&gt;&#xA;which is the completeness relation for the vectors &lt;span class=&quot;math-container&quot;&gt;$\{\lvert\psi_{ij}\rangle\}_{ij}$&lt;/span&gt;.&#xA;This immediately implies that this is also an orthonormal set (to see it, take for example the sandwich of this expression with any &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{ij}\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Orthogonality of &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; is equivalent to orthogonality of the corresponding &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{ij}\rangle$&lt;/span&gt;, thus the conclusion.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-12-03T19:04:22.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4852" PostTypeId="1" CreationDate="2018-12-03T23:51:42.080" Score="6" ViewCount="479" Body="&lt;p&gt;&lt;sub&gt;I asked a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4845/would-this-quantum-algorithm-implementation-work&quot;&gt;question&lt;/a&gt; about this earlier, but I am still coming across problems in my algorithm implementation.&lt;/sub&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to implement the order finding algorithm on Cirq finding the minimal positive &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; for coprime &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; satisfying the equation &lt;span class=&quot;math-container&quot;&gt;$x^r \ = \ 1$&lt;/span&gt;(mod&lt;span class=&quot;math-container&quot;&gt;$ \ N$&lt;/span&gt;). In my case, I have set &lt;span class=&quot;math-container&quot;&gt;$x \ = \ 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N \ = \ 3$&lt;/span&gt;, so the algorithm should output &lt;span class=&quot;math-container&quot;&gt;$r \ = \ 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the unitary is defined by &lt;span class=&quot;math-container&quot;&gt;$U|y\rangle \ = \ |2^jy$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$y \ = \ |1\rangle$&lt;/span&gt;, then the value of &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; should simply switch back and forth between &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt;. Since we are defining:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2^j$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3) \ = \ \big(2^{j_1 2^0}$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\big)\big(2^{j_2 2^1}$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\big) \ ... \ \big(2^{j_t 2^{t-1}}$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\big)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of the terms in the form &lt;span class=&quot;math-container&quot;&gt;$\big(2^{j_k 2^k}$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\big)$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$\big(1 \ $&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\big)$&lt;/span&gt;, except for when &lt;span class=&quot;math-container&quot;&gt;$k \ = \ 0$&lt;/span&gt;, in which case we get &lt;span class=&quot;math-container&quot;&gt;$\big(2 \ $&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$3)\big)$&lt;/span&gt;. Because of this, I implemented two &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates being controlled by the &lt;span class=&quot;math-container&quot;&gt;$j_1$&lt;/span&gt; qubit acting on each of the two qubits acting as &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; if the control qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if the control qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;). It doesn't seem necessary to implement more gates on all the other &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; qubits because mathematically, they turn out to act trivially in this context. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this, I then pass all of the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; qubits through the inverse quantum Fourier transform. The outputs I'm getting seem kind of strange:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BXIHa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BXIHa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is all &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; qubits measured for &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; iterations of the circuit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was just wondering if anyone had any insight, since I feel as though I made some kind of mistake in creating the unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think this is necessarily a coding problem but just in case it is helpful, this is the code I have for the circuit so far:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Quantum Order Finding Algorithm&#xA;&#xA;import cirq&#xA;import numpy as np&#xA;import random&#xA;import tensorflow as tf&#xA;import time&#xA;import timeit&#xA;from cirq.google import ExpWGate, Exp11Gate, XmonMeasurementGate&#xA;from cirq.google import XmonSimulator&#xA;from matplotlib import pyplot as plt&#xA;from itertools import combinations&#xA;from cirq.circuits import InsertStrategy&#xA;&#xA;# Gate schematic --&amp;gt; Hadamard (0) --&amp;gt; Controlled Phase gate (1, 0) --&amp;gt; Hadamard (1) --&amp;gt; Swap (0, 1) --&amp;gt; Measure (0, 1)&#xA;&#xA;n = 5&#xA;a = 2&#xA;&#xA;qubits = []&#xA;for i in range(0, n):&#xA;    qubits.append(cirq.GridQubit(0, i))&#xA;&#xA;other_qubits = []&#xA;for k in range(n, n+a):&#xA;    other_qubits.append(cirq.GridQubit(0, k))&#xA;&#xA;circuit = cirq.Circuit()&#xA;&#xA;#Preparing the qubits&#xA;&#xA;for j in qubits:&#xA;    had_gate = cirq.H.on(j)&#xA;    circuit.append([had_gate], strategy=InsertStrategy.EARLIEST)&#xA;&#xA;'''&#xA;for l in other_qubits:&#xA;    x_gate = cirq.X.on(l)&#xA;    circuit.append([x_gate], strategy=InsertStrategy.EARLIEST)&#xA;'''&#xA;&#xA;circuit.append(cirq.X.on(other_qubits[1]))&#xA;&#xA;&#xA;&#xA;&#xA;#Applying the unitary&#xA;&#xA;circuit.append([cirq.CNOT.on(qubits[0], other_qubits[0]), cirq.CNOT.on(qubits[0], other_qubits[1])])&#xA;#circuit.append([cirq.CNOT.on(qubits[0], other_qubits[1]), cirq.CNOT.on(qubits[0], other_qubits[2]), cirq.CNOT.on(qubits[1], other_qubits[2]), cirq.CNOT.on(qubits[1], other_qubits[0]), cirq.CCX.on(qubits[0], qubits[1], other_qubits[0])])&#xA;&#xA;#Applying the Inverse QFT&#xA;&#xA;&#xA;circuit.append(cirq.SWAP.on(qubits[0], qubits[4]))&#xA;circuit.append(cirq.SWAP.on(qubits[1], qubits[3]))&#xA;&#xA;&#xA;&#xA;for b in range(0, n):&#xA;    place = n-b-1&#xA;    for h in range(n-1, place, -1):&#xA;        holder = h&#xA;        gate = cirq.CZ**(1/(2**(h-place)))&#xA;        circuit.append(gate.on(qubits[holder], qubits[place]))&#xA;    circuit.append(cirq.H.on(qubits[place]))&#xA;&#xA;def circuit_init_again(meas=True):&#xA;    if meas:&#xA;        yield XmonMeasurementGate(key='qubit0')(qubits[0])&#xA;        yield XmonMeasurementGate(key='qubit1')(qubits[1])&#xA;        yield XmonMeasurementGate(key='qubit2')(qubits[2])&#xA;        yield XmonMeasurementGate(key='qubit3')(qubits[3])&#xA;        yield XmonMeasurementGate(key='qubit4')(qubits[4])&#xA;&#xA;#circuit.append()&#xA;circuit.append(circuit_init_again())&#xA;&#xA;print(&quot; &quot;)&#xA;print(&quot; &quot;)&#xA;print(circuit)&#xA;print(&quot; &quot;)&#xA;print(&quot; &quot;)&#xA;&#xA;simulator = XmonSimulator()&#xA;result = simulator.run(circuit, repetitions=50)&#xA;print(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="4907" LastEditDate="2018-12-04T22:41:24.770" LastActivityDate="2019-07-22T20:57:39.520" Title="Why is this implementation of the order finding algorithm not working?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4855" PostTypeId="1" CreationDate="2018-12-04T01:22:12.107" Score="5" ViewCount="67" Body="&lt;p&gt;I've been looking into &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QPIP}_\tau$&lt;/span&gt; as a complexity class. The following will be a summary of definition 3.12 in &lt;a href=&quot;https://arxiv.org/abs/1804.01082&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical Verification of Quantum Computations&lt;/a&gt; by Urmila Mahadev.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A language &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is said to have a Quantum Prover Interactive Proof (&lt;span class=&quot;math-container&quot;&gt;$\mathsf{QPIP}_\tau$&lt;/span&gt; ) with completeness &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;&#xA;  and soundness &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$c − s$&lt;/span&gt; is at least a constant) if there exists a pair of algorithms &lt;span class=&quot;math-container&quot;&gt;$(P, V)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the&#xA;  prover and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is the verifier, with the following properties:&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;&lt;p&gt;The prover &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; machine, which also has access to a quantum channel which can transmit &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; qubits.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;The verifier &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is a hybrid quantum-classical machine. Its classical part is a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt; machine. The quantum&#xA;  part is a register of &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; qubits, on which the verifier can perform arbitrary quantum operations and which has&#xA;  access to a quantum channel which can transmit &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; qubits. At any given time, the verifier is not allowed to&#xA;  possess more than &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; qubits. The interaction between the quantum and classical parts of the verifier is the&#xA;  usual one: the classical part controls which operations are to be performed on the quantum register, and&#xA;  outcomes of measurements of the quantum register can be used as input to the classical machine.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;There is also a classical communication channel between the prover and the verifier, which can transmit&#xA;  polynomially many bits at any step.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;At any given step, either the verifier or the prover perform computations on their registers and send bits and&#xA;  qubits through the relevant channels to the other party.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There are some more details regarding defining &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, but these are unimportant for my question.&#xA;Additionally, it should suffice to take &lt;span class=&quot;math-container&quot;&gt;$\tau = 0$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt; machine that has entirely classical communication with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm curious about how specifically the classical part of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is supposed to manipulate the input.&#xA;The setting for this paper is taking arbitrary &lt;span class=&quot;math-container&quot;&gt;$L\in\mathsf{BQP}$&lt;/span&gt; and reducing it to 2-Local Hamiltonian (where the non-identity parts are Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates), which is &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt;-complete.&#xA;This means that the initial input &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is specified as some polynomial-size quantum circuit, which must be reduced (in quantum polynomial time) to a local hamiltonian instance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have issues understanding how &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; (in the case when &lt;span class=&quot;math-container&quot;&gt;$\tau = 0$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is just a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt; machine) can preform this reduction, or even more generally hold the quantum circuit. Each of the (polynomially many) gates in the circuit is a quantum gate, which for a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system would be of size &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt;. I feel like &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; can't have an input of this size, because then the input size is exponential in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (which would cause all sorts of issues with restricting &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to be poly-time in the input).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could see each of (polynomial many) gates &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; being written as a product of (polynomial many) universal gates from some fixed, finite set of gates (or even some gate set of size &lt;span class=&quot;math-container&quot;&gt;$\mathsf{poly}(n)$&lt;/span&gt; --- it shouldn't matter). This would mean that the input to &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is small enough such that &quot;polynomial time in the input&quot; is a reasonable restriction.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Under such a restriction, can a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt; verifier &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; reduce the circuit &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-Local Hamiltonian?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Additionally, while such a restriction is natural to me, is this how it is typically done? Specifically, how are quantum circuits generally input to classical machines?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5248" LastEditorUserId="26" LastEditDate="2018-12-23T07:57:28.990" LastActivityDate="2018-12-23T07:57:28.990" Title="What's the notion of input size for Quantum Verification?" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4856" PostTypeId="2" ParentId="4855" CreationDate="2018-12-04T05:02:57.100" Score="2" Body="&lt;p&gt;The answer is yes to both questions. See page 2 of &lt;a href=&quot;https://arxiv.org/pdf/1212.6312.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bookatz's &lt;em&gt;QMA-Complete Problems&lt;/em&gt;&lt;/a&gt;, which states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When&#xA;  a problem is given a unitary or quantum circuit, &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt;, it is assumed that the problem is actually given&#xA;  a classical description &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; of the corresponding quantum circuit, which consists of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{poly}(|x|)$&lt;/span&gt; elementary&#xA;  gates. Likewise, quantum channels are specified by efficient classical description.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the input to &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is entirely classical, and polynomial-sized in &lt;span class=&quot;math-container&quot;&gt;$|x|$&lt;/span&gt;, which is usually taken to be the input to the circuit (and therefore the number of qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for a verifier being able to reduce things to 2 local Hamiltonian, this is also yes. This picture is from &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0302079.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;3-Local Hamiltonian is QMA Complete&lt;/a&gt;, and constructs a 3-Local Hamiltonian entirely from projections and &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;'s. As the various &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;'s are efficiently representable classically (and I assume projections onto the computational basis are as well), it appears a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; machine should be able to construct the local Hamiltonian efficiently (given the classical description of &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt;, likely with respect to a fixed universal gate set).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the below construction is for 3 Local Hamiltonian, and while the construction for 2 Local Hamiltonian is more technical, I see no difficulties in extending the above argument.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/e3wHh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e3wHh.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5248" LastActivityDate="2018-12-04T05:02:57.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4857" PostTypeId="2" ParentId="4361" CreationDate="2018-12-04T08:21:28.553" Score="2" Body="&lt;p&gt;No, as point 4 is not satisfied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The D-Wave machines are quantum annealers and thus not universal. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1674/what-would-be-the-simplest-addition-that-would-make-the-d-wave-architecture-univ/&quot;&gt;this&lt;/a&gt; question on how to make from the D-Wave machine a universal quantum computer. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2018-12-04T08:21:28.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4858" PostTypeId="1" AcceptedAnswerId="4860" CreationDate="2018-12-04T15:26:31.950" Score="5" ViewCount="369" Body="&lt;p&gt;In the &quot;Quantum Computation and Quantum Information 10th Anniversary textbook by Nielsen &amp;amp; Chuang&quot;, they claim that Eqn(4.75) is a rotation about the axis along the direction &#xA;( &lt;span class=&quot;math-container&quot;&gt;${cos(\pi/8)}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;${sin&#xA;(\pi/8)}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;${cos(\pi/8)}$&lt;/span&gt; ). They then defined an angle &lt;span class=&quot;math-container&quot;&gt;${\theta}$&lt;/span&gt; such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${cos(\theta/2)}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$cos^2$&lt;/span&gt;(&lt;span class=&quot;math-container&quot;&gt;${\pi/8}$&lt;/span&gt;)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and its also claimed to be an irrational multiple of 2&lt;span class=&quot;math-container&quot;&gt;${\pi}$&lt;/span&gt;.&lt;br&gt;&#xA;We know that the rotational matrices about any arbitrary axis takes the form of  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${cos(\theta/2)}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;${I}$&lt;/span&gt; - &lt;span class=&quot;math-container&quot;&gt;${i}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;${n_x}$${X}$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;${n_y}$${Y}$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;${n_z}$${Z}$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;${sin(\theta/2)}$&lt;/span&gt; ,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but Eqn(4.75) gives:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${cos^2(\pi/8)}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;${I}$&lt;/span&gt; - &lt;span class=&quot;math-container&quot;&gt;${i}$&lt;/span&gt; [ &lt;span class=&quot;math-container&quot;&gt;${cos(\pi/8)(X+Z)+sin(\pi/8)Y}$&lt;/span&gt; ] &lt;span class=&quot;math-container&quot;&gt;${sin(\pi/8)}$&lt;/span&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how does this &lt;span class=&quot;math-container&quot;&gt;${\theta}$&lt;/span&gt; be able to simultaneously satisfy &lt;span class=&quot;math-container&quot;&gt;${sin(\pi/8})$&lt;/span&gt;? Why does &lt;span class=&quot;math-container&quot;&gt;${\theta}$&lt;/span&gt; be referenced from &lt;span class=&quot;math-container&quot;&gt;${cos^2(\pi/8)}$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;${sin(\pi/8})$&lt;/span&gt;?     &lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="26" LastEditDate="2018-12-23T07:56:55.420" LastActivityDate="2018-12-23T07:56:55.420" Title="Construction of ${R_n(\theta)}$ using only the Hadamard and ${\pi/8}$ gates" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4859" PostTypeId="1" CreationDate="2018-12-04T15:32:39.533" Score="3" ViewCount="284" Body="&lt;p&gt;I'm taking a quantum information course and one of my exercises says to find &lt;span class=&quot;math-container&quot;&gt;$p,p'$&lt;/span&gt;, for which there is a channel &lt;span class=&quot;math-container&quot;&gt;$\tilde\Lambda(\Lambda(\rho))=\Lambda'(\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Lambda'$&lt;/span&gt; are dephasing channels with &lt;span class=&quot;math-container&quot;&gt;$\Lambda(\rho)=(1-p)\rho+p\sigma_z\rho\sigma_z, \Lambda'(\rho)=(1-p')\rho+p'\sigma_z\rho\sigma_z$&lt;/span&gt;. I'm rather confused how to do that, would appreciate any tips and hints. &lt;/p&gt;&#xA;" OwnerUserId="5254" LastEditorUserId="26" LastEditDate="2019-01-01T09:16:05.150" LastActivityDate="2019-01-01T09:16:05.150" Title="Dephasing channels" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4860" PostTypeId="2" ParentId="4858" CreationDate="2018-12-04T15:49:57.283" Score="4" Body="&lt;p&gt;In order to compare to the Pauli vector exponentiation formula, we need to write in terms a normalized unit vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${\displaystyle R = \cos^2(\pi/8) I_2 -\frac{i}{\sqrt{1+\cos^2(\pi/8)} } \times \quad \times \left [\cos(\pi/8)(X+Z)+  \sin(\pi/8)Y \right ] \sqrt{1+\cos^2(\pi/8)}\sin(\pi/8)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the result can be seen by inspection from the comparison to the general formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${\displaystyle e^{ia({\hat {n}}\cdot {\vec {\sigma }})}=I\cos {a}+i({\hat {n}}\cdot {\vec {\sigma }})\sin {a}}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-12-04T15:49:57.283" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4861" PostTypeId="1" CreationDate="2018-12-04T20:35:11.927" Score="2" ViewCount="211" Body="&lt;p&gt;The algorithm is being implemented on Cirq, with the goal of finding the smallest &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; for cooprime numbers &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; satisfying the equation &lt;span class=&quot;math-container&quot;&gt;$x^r \ = \ 1($&lt;/span&gt;mod &lt;span class=&quot;math-container&quot;&gt;$N)$&lt;/span&gt;. I have set &lt;span class=&quot;math-container&quot;&gt;$x \ = \ 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N \ = \ 3$&lt;/span&gt;, so the algorithm should output &lt;span class=&quot;math-container&quot;&gt;$r \ = \ 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the circuit that Cirq outputs for my code. Are there any mistakes that I'm making in the algorithm implementation, as I am getting some strange results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ckq3g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ckq3g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2018-12-04T22:32:07.250" Title="Is this the correct quantum circuit for the order-finding algorithm?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4862" PostTypeId="2" ParentId="4861" CreationDate="2018-12-04T22:32:07.250" Score="3" Body="&lt;p&gt;The Fourier transform part (everything from the swaps onward) looks correct. The initialization (column of Hadamards) looks correct. But the part where you do controlled modular multiplications doesn't, because there's no operations controlled on the 2nd through fifth qubits that you are QFT-ing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also seem to expect the output to be the period, when actually the output is a number of the form &lt;span class=&quot;math-container&quot;&gt;$2^n / (kp)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the period and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an integer and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits in your QFT. &lt;a href=&quot;http://algassert.com/post/1718&quot; rel=&quot;nofollow noreferrer&quot;&gt;This blog post may be helpful.&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my recommendation on how to proceed.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Start from &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22~input%22%2C1%2C1%2C1%2C%22~guess%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setR%22%2C%22arg%22%3A55%7D%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A26%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22X%22%5D%2C%5B%22inputA10%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22*BToAmodR6%22%5D%2C%5B%22QFT%E2%80%A010%22%5D%2C%5B1%2C1%2C1%2C1%2C%22~out%22%5D%2C%5B%22Chance10%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~guess%22%2C%22name%22%3A%22guess%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~input%22%2C%22name%22%3A%22input%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~out%22%2C%22name%22%3A%22out%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk's example period finding circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xNm1a.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xNm1a.png&quot; alt=&quot;example period from quirk&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In Quirk, adjust the circuit to apply to your case, where &lt;span class=&quot;math-container&quot;&gt;$B=2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R=3$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Replace the &lt;span class=&quot;math-container&quot;&gt;$\times B^A \pmod{R}$&lt;/span&gt; operation with a series of controlled &lt;span class=&quot;math-container&quot;&gt;$\times A \pmod{R}$&lt;/span&gt; operations, with a different &lt;span class=&quot;math-container&quot;&gt;$A=\text{constant}$&lt;/span&gt; for each one.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Replace each &lt;span class=&quot;math-container&quot;&gt;$\times A \pmod{R}$&lt;/span&gt; operation, one by one, with simple gates such as CNOTs and Toffolis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Replace the inverse QFT with simple gates such as Hadamards and controlled phases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compare with the circuit you're trying to make in Cirq.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As you are making the circuit transformations, keep an eye on the output display. If the spikes have moved around or changed, you made a mistake when doing a decomposition.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-12-04T22:32:07.250" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4863" PostTypeId="1" CreationDate="2018-12-05T02:50:11.310" Score="1" ViewCount="66" Body="&lt;p&gt;I'm sorry for posting so many questions about this specific problem, but I just want to make sure that I am implementing an algorithm correctly. I am simulating the order finding algorithm (finding minimal &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x^r \ = \ 1$&lt;/span&gt;mod(&lt;span class=&quot;math-container&quot;&gt;$N)$&lt;/span&gt;). Right now, I am trying to implement the case of &lt;span class=&quot;math-container&quot;&gt;$x \ = \ 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N \ = \ 5$&lt;/span&gt;. I am getting outputs that look somewhat like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tOjce.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tOjce.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I pass these results through the continued fraction algorithm, I'm getting the expected results of the algorithm, however, these results seem weird, as they are basically just every combination of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; for the first two qubits. I just want to make sure that I am actually implementing the algorithm correctly, and not just getting lucky with my results. Again, I'm very sorry for all the questions about this specific problem.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2018-12-05T09:38:48.080" Title="Do these outputs seem normal for the order finding algorithm?" Tags="&lt;algorithm&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4864" PostTypeId="1" CreationDate="2018-12-05T04:16:22.873" Score="2" ViewCount="193" Body="&lt;p&gt;Do they both just use similar methods of calculation, or are they completely interchangeable?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2018-12-05T10:22:49.270" Title="Are the order finding and period finding algorithms the same thing?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4865" PostTypeId="1" CreationDate="2018-12-05T06:45:19.087" Score="1" ViewCount="100" Body="&lt;p&gt;I am reading an article on representation of digital images using qubits. But I am not able to understand the notations of the &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0030402616311500&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;.&#xA;Can somebody help me: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;: It means the first basis vector in the respective vector space. But what does &lt;span class=&quot;math-container&quot;&gt;$ |0\rangle^{3q+ 2n}$&lt;/span&gt; mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/10VXb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/10VXb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5263" LastEditorUserId="26" LastEditDate="2018-12-05T14:17:37.427" LastActivityDate="2018-12-06T07:54:37.183" Title="A question about notation for quantum states" Tags="&lt;quantum-state&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4866" PostTypeId="2" ParentId="4865" CreationDate="2018-12-05T07:47:07.323" Score="3" Body="&lt;p&gt;A single qubit in the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; state is often written as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have two independent qubits in the zero state we can write them as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\otimes|0\rangle$&lt;/span&gt;. This is often also written as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle = |00\rangle =|0\rangle^{\otimes2}=|0\rangle^2$&lt;/span&gt;. This extends naturally to more qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming back to your question: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes 3q+2}$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{3q+2}$&lt;/span&gt;), it are just &lt;span class=&quot;math-container&quot;&gt;$3q+2$&lt;/span&gt; qubits, all in the zero state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2018-12-05T07:47:07.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4867" PostTypeId="2" ParentId="4863" CreationDate="2018-12-05T09:38:48.080" Score="1" Body="&lt;p&gt;This looks right, although I would emphasise that it is not really best practice to have to ask this question at this stage. The whole point of doing a particularly simple example is so that you can confirm that it's doing what you've &lt;em&gt;already calculated analytically&lt;/em&gt;. It's quite important to do the analytic bit first to avoid confirmation bias.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, let's see what we should get. I'm going to assume a first register (the one that we do the Fourier transform etc on) contains &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; qubits. I'm guessing that &lt;span class=&quot;math-container&quot;&gt;$t=7$&lt;/span&gt; from your output. We start with the system in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes t}|1\rangle$&lt;/span&gt;, and apply the Hadamard transform to the first register:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2^t}}\sum_{j=0}^{2^t-1}|j\rangle|1\rangle.&#xA;$$&lt;/span&gt;&#xA;Then we apply the modular exponentiation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2^t}}\sum_{j=0}^{2^t-1}|j\rangle|2^j\text{ mod }5\rangle.&#xA;$$&lt;/span&gt;&#xA;We can simply this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2^t}}\sum_{k=0}^3\left(\sum_{j=0}^{2^{t-2}-1}|k+4j\rangle\right)|2^k\text{ mod }5\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, instead of simply applying the inverse Quantum Fourier Transform, I prefer to think about its action on states. The QFT (not inverse), transforms basis states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle\rightarrow|\psi_x\rangle=\frac{1}{\sqrt{2^t}}\sum_{y=0}^{2^t-1}\omega^{xy}|y\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2\pi i/2^t}$&lt;/span&gt;, so we want to describe our states such as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|4\rangle+|8\rangle+|12\rangle+\ldots$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$|\psi_x\rangle$&lt;/span&gt; to know what values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; we might get as output from the inverse QFT. But we can easily observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle+|4\rangle+|8\rangle+|12\rangle+\ldots=\frac{1}{2}\sum_{x=0}^3|\psi_{2^{t-2}x}\rangle.&#xA;$$&lt;/span&gt;&#xA;Hence, for the &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; case, we get each of the 4 answers &lt;span class=&quot;math-container&quot;&gt;$0,2^{t-2},2^{t-1},3\times 2^{t-2}$&lt;/span&gt; with equal probability. These are the 4 bit strings that you're seeing on output. Similarly, the other 3 values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; can be decomposed also in terms of &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_{2^{t-2}x}\rangle\}_{x=0}^3$&lt;/span&gt;, just with different multiplicative factors (fourth roots of unity), the point being that these 4 vectors all have period 4 and they form a basis for the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-05T09:38:48.080" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4868" PostTypeId="2" ParentId="4864" CreationDate="2018-12-05T09:43:56.690" Score="5" Body="&lt;p&gt;If you look at Nielsen and Chuang, figure 5.5, page 241 (at least in my 2002 version), order finding and period finding are separated. (Note that this is talking about the problem definition, not the algorithm for solving them). Essentially, period finding aims to find the least positive &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x+r)=f(x)&#xA;$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, while order finding is doing a special case of this where the function is of a specific form: &lt;span class=&quot;math-container&quot;&gt;$f(x)=a^x\text{ mod }N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of an algorithm for solving them, it turns out that a quantum computer gives us a good algorithm for period finding, and hence it can also be applied to the special case of order finding. Strictly, this doesn't rule out the possibility that there could be something better for order finding than there is for period finding in general, I guess.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-12-05T10:22:49.270" LastActivityDate="2018-12-05T10:22:49.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4869" PostTypeId="2" ParentId="4865" CreationDate="2018-12-05T16:16:13.147" Score="1" Body="&lt;p&gt;Also, think about the dimensions these basis vectors are creating. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$2\times 1$&lt;/span&gt; vector, which is in the standard basis looks like: &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1\\0 \end{bmatrix}$$&lt;/span&gt;Then, continuing &lt;span class=&quot;math-container&quot;&gt;$$|0\rangle^{\otimes2} = |00\rangle=|0\rangle|0\rangle =  |0\rangle \otimes |0\rangle = \begin{bmatrix} 1\\0 \end{bmatrix} \otimes \begin{bmatrix} 1\\0 \end{bmatrix} = \begin{bmatrix} 1\\0\\0\\0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They all mean the same thing. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2018-12-06T07:54:37.183" LastActivityDate="2018-12-06T07:54:37.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4870" PostTypeId="1" CreationDate="2018-12-05T16:57:36.890" Score="7" ViewCount="530" Body="&lt;p&gt;I have a computer science and mathematics degree and am trying to wrap my head around quantum computing and it just doesn't seem to make sense from the very beginning.  I think the problem is the definitions out there are generally watered down for lay-people to digest but don't really make sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, we often see a bit compared to a qubit and are told that an &quot;old fashion digital bit&quot; can only be in one of two states, 0 or 1.  But qubits on the other hand can be in a state of 0, 1, or &quot;superposition&quot;, presumably a third state that is both 0 AND 1.  But how does being in a state of &quot;both 0 and 1&quot; deliver any value in computing as it is simply the same as &quot;I don't know&quot;?  So for example, if a qubit represents the last binary digit of your checking account balance, how does a superimposed 0 and 1 deliver any useful information for that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Worse you see these same articles say things like &quot;and two qubits can be put together for a total of 4 states, three can make a total of 8 states&quot; -- ok that's just &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, the same capability that &quot;old-fashioned bits&quot; have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously there is great promise in quantum computing so I think its more a problem of messaging.  Any suggestions for intro/primer literature that doesn't present the quantum computing basics in this oxymoronic way?&lt;/p&gt;&#xA;" OwnerUserId="5266" LastEditorUserId="26" LastEditDate="2018-12-06T08:22:03.757" LastActivityDate="2021-02-12T01:02:39.360" Title="Non-layperson explanation of why a qubit is more useful than a bit?" Tags="&lt;physical-qubit&gt;&lt;quantum-state&gt;&lt;resource-request&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4871" PostTypeId="2" ParentId="4870" CreationDate="2018-12-05T17:45:47.310" Score="1" Body="&lt;p&gt;So there are two major advantages qubits have over classical bits: superposition and entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superposition is the one more often discussed, and is the &quot;0 or 1&quot; phrase you always hear. Essentially the idea is that instead of just being in 0 or 1, we can be in some mix of the two. However quantum operators are linear, so if they are fed a superposition, they apply themselves to both parts separately:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A(\alpha |0\rangle + \beta |1\rangle ) = \alpha A |0\rangle + \beta A |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is essentially a system with built in parallelization, which is nice, as a blackbox can be queried multiple times at once. A common starting point for quantum algorithms is to apply the Hadamard operator (Which takes &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;) to each of a string of qubits in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. This leads to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes N} |0\rangle^{\otimes N} = \sum_{k=0}^{2^N - 1}|k\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; is the state with it's qubits in the binary representation of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Plugging this state into a quantum operator essentially gets every single possible input into said operator with one query, and if you can tease out the information you need with that one operator then you only need one attempt instead of &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; queries. See the &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Josza algorithm&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement is the second idea, and I would argue is much more powerful. The idea is that you can combine qubits in ways which are inseparable, meaning that they stop being objects with independent values. For example you can put two qubits into a state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the values are linked together. That means that when qubits are combined, the possible states they can occupy are far more varied. If I measure one of the qubits I affect the data stored in the other qubit because they were a linked object. Through this you can get cool interference effects by changing bases. I would also look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation&lt;/a&gt; circuit to get an idea of how this can be useful for things that classical bits cannot do.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="26" LastEditDate="2018-12-06T05:51:17.320" LastActivityDate="2018-12-06T05:51:17.320" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4872" PostTypeId="1" CreationDate="2018-12-05T20:35:36.717" Score="1" ViewCount="82" Body="&lt;p&gt;This circuit was created on the Quirk platform. I'm trying to implement a basic case of phase estimation. For some reason, I'm getting this strange result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vlivN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vlivN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the Inverse QFT is broken down, it seems to yield the expected answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UbLBW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UbLBW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea why this is happening. I tried playing around with the endian-ness of the qubits, but it didn't seem to work.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2018-12-06T08:14:04.833" LastActivityDate="2018-12-06T08:14:04.833" Title="Why are these circuits not producing the expected output?" Tags="&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;&lt;cirq&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4873" PostTypeId="2" ParentId="4872" CreationDate="2018-12-05T20:59:50.253" Score="2" Body="&lt;p&gt;The endian-ness of the qubits is the answer. Both QFT and phase estimation rely on certain endianness of the register, and the representations used in the controlled-unitary part has to match the endianness used in the QFT part (and in the answer). This circuit produces the expected outcome with the inverse QFT block:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IieBD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IieBD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2018-12-05T21:13:14.417" LastActivityDate="2018-12-05T21:13:14.417" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4874" PostTypeId="1" AcceptedAnswerId="4884" CreationDate="2018-12-05T21:12:26.920" Score="3" ViewCount="104" Body="&lt;p&gt;As I understand it, &lt;a href=&quot;https://en.wikipedia.org/wiki/Device-independent_quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;device-independent quantum cryptography&lt;/a&gt; enables you to safely perform cryptographic operations without necessarily trusting the quantum device on which they are performed. Nonlocal games are said to have applications in this domain; see for example &lt;a href=&quot;https://arxiv.org/abs/1210.4359&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;A Monogamy-of-Entanglement Game With Applications to Device-Independent Quantum Cryptography&lt;/em&gt;&lt;/a&gt; by Tomamichel et al. Is there a simple explanation of how nonlocal games can help in this domain? I understand the mechanics of the CHSH game quite well.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-12-06T14:29:01.817" Title="How are nonlocal games used in device-independent quantum cryptography?" Tags="&lt;cryptography&gt;&lt;games&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4875" PostTypeId="1" AcceptedAnswerId="4877" CreationDate="2018-12-05T21:57:07.493" Score="6" ViewCount="1585" Body="&lt;p&gt;When implementing the inverse quantum Fourier transform, in addition to reversing the circuit, does one need to take the conjugate transpose of the phase shift gates in the circuit as well?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2018-12-06T08:13:30.357" LastActivityDate="2018-12-06T08:13:30.357" Title="Implementation of inverse QFT?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4876" PostTypeId="1" CreationDate="2018-12-05T22:41:17.457" Score="8" ViewCount="203" Body="&lt;p&gt;What is known about quatum algorithms for problems outside NP (eg NEXP-complete problems), both theoretically like upper &amp;amp; lower speedup bounds and various (im)possibility results, as well as concrete algorithms fro specific problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I am asking is that we currently have processorrs with low 10's of qubits. NP problems over low 10s of classical bits can generally solved on classical computers. With non-NP problems we could have problems which are not classically tractable even in that range. This could be an opportunity to demonstrate practical quantum advantage on current hardware. This does not necessarily require the quantum algorithm to be generally tractable, only that it can solve smallish problems in acceptable time where classical algorithms can not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is to find problems that take considerable time on classical computers for instance sizes that are representable on current quantum processors. Finding quantum algorithms that are faster on those instances would be a form of quantum advantage even if the quantum algorithms were not necessarily superior asymptotically.&lt;/p&gt;&#xA;" OwnerUserId="1370" LastEditorUserId="1370" LastEditDate="2018-12-07T22:20:30.467" LastActivityDate="2019-01-31T13:07:58.000" Title="Quantum algorithms for problems outside NP" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4877" PostTypeId="2" ParentId="4875" CreationDate="2018-12-05T23:13:42.303" Score="9" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have been given a factorization &lt;span class=&quot;math-container&quot;&gt;$QFT=U_1 \cdots U_n$&lt;/span&gt; where each &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; is an individual gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT^{-1} = U_n^{-1} \cdots U_1^{-1}\\&#xA;= U_n^{\dagger} \cdots U_1^{\dagger}\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of the individual gates will have the property that &lt;span class=&quot;math-container&quot;&gt;$U_i = U_i^\dagger = U_i^{-1}$&lt;/span&gt;. These are the involutions like NOT, CNOT, etc. In those cases you are lucky and don't have to worry about conjugating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other gates, you do have to change parameters in order to acheive the conjugate transpose. Like &lt;span class=&quot;math-container&quot;&gt;$R_Z (\beta)$&lt;/span&gt; vs &lt;span class=&quot;math-container&quot;&gt;$R_Z (-\beta)$&lt;/span&gt;. In these sorts of basic gates, the conjugate transpose is straightforward to see how parameters like Euler angles change.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-12-05T23:13:42.303" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4878" PostTypeId="1" CreationDate="2018-12-06T00:21:42.003" Score="1" ViewCount="86" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dAnGX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dAnGX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DsKx8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DsKx8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am simulating the phase shift algorithm on the Quirk platform. Even when the endian-ness of the built-in inverse QFT gate is corrected for, the circuits still output different results. Shouldn't the output be identical?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bottom circuit seems to be producing the output I would expect from the phase estimation algorithm, I'm not sure what is going on with the top circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using Quirk to ensure I am implementing the order finding algorithm correctly, so this result is kind of worrying, since I trust the built in inverse QFT over the one that I made, however, mathematically, I am fairly certain that my circuit is producing the right values.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2018-12-06T08:12:46.467" LastActivityDate="2018-12-06T09:10:46.767" Title="Why are these circuits not producing the same output?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;&lt;cirq&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4880" PostTypeId="2" ParentId="4870" CreationDate="2018-12-06T04:17:53.907" Score="2" Body="&lt;p&gt;Adding to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4871/26&quot;&gt;@Dripto's answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For example, we often see a bit compared to a qubit and are told that&#xA;  an &quot;old fashion digital bit&quot; can only be in one of two states, 0 or 1.&#xA;  But qubits on the other hand can be in a state of 0, 1, or&#xA;  &quot;superposition&quot;, presumably a third state that is both 0 AND 1. But&#xA;  how does being in a state of &quot;both 0 and 1&quot; deliver any value in&#xA;  computing as it is simply the same as &quot;I don't know&quot;? So for example,&#xA;  if a qubit represents the last binary digit of your checking account&#xA;  balance, how does a superimposed 0 and 1 deliver any useful&#xA;  information for that?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In this context, 0 and 1 refer to orthogonal &lt;a href=&quot;https://en.wikipedia.org/wiki/Basis_(linear_algebra)&quot; rel=&quot;nofollow noreferrer&quot;&gt;basis states&lt;/a&gt; of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert space&lt;/a&gt; (a complex vector space) representation of the states of physical objects like electrons (say &lt;a href=&quot;https://en.wikipedia.org/wiki/Spin_(physics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;spin&lt;/a&gt; states of an electron - &quot;up&quot; and &quot;down&quot;). It is more appropriate to denote them as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, according to the Dirac notation. I've written about this previously, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/92/26&quot;&gt;here&lt;/a&gt;. Just saying &quot;superposition of state 0 and state 1&quot; doesn't convey any useful information, yes. However &lt;em&gt;specifying&lt;/em&gt; the superposition state like &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta\in \Bbb C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;, makes complete sense &lt;em&gt;mathematically&lt;/em&gt; and conveys useful information. By the way, &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; is the probability of the qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;nofollow noreferrer&quot;&gt;collapsing&lt;/a&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; upon measurement and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; is the probability of it collapsing to state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, upon measurement. You might say &quot;superposition of state 0 and state 1&quot; doesn't make physical or intuitive sense. Sure, quantum mechanics is simply a mathematical model that happens to give correct predictions about real world phenomena. It doesn't need to make physical or intuitive sense. It just needs to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, we would never use a qubit to represent the last binary digit of your account balance, in the first place. That would be silly. And even if we do, the qubit should be &lt;em&gt;restricted&lt;/em&gt; to the computational basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and not their superposition states.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Worse you see these same articles say things like &quot;and two qubits can&#xA;  be put together for a total of 4 states, three can make a total of 8&#xA;  states&quot; -- ok that's just &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, the same capability that&#xA;  &quot;old-fashioned bits&quot; have.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, that is nonsense. A single qubit can exist in any state one out of &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncountable_set&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncountably infinite&lt;/a&gt; number of states like &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta \in \Bbb C$&lt;/span&gt; (simply because there are uncountably many complex numbers and &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; can take up any of those uncountably many values). And, by extension, any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system can exist in an uncountably infinite number of states. I guess by &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; they just meant the number of basis of the Hilbert space in which the composite qubit system belongs, for instance, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; form the computational basis set for a 2 qubit system. In general, a two qubit system can take up any state like &lt;span class=&quot;math-container&quot;&gt;$(\alpha|0\rangle+\beta|1\rangle)\otimes (\gamma |0\rangle + \delta |1\rangle)$&lt;/span&gt; (a &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor product&lt;/a&gt; of the state of the two individual qubits which constitute the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system), where &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta, \gamma, \delta \in \Bbb C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\gamma|^2+|\delta|^2=1$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$$(\alpha|0\rangle+\beta|1\rangle)\otimes (\gamma |0\rangle + \delta |1\rangle)$$&lt;/span&gt; can  be expressed as a linear combination of the computational basis elements &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$$\alpha\gamma |0\rangle \otimes |0\rangle + \alpha\delta |0\rangle \otimes |1\rangle + \beta\gamma |1\rangle \otimes |0\rangle + \beta\delta|1\rangle \otimes |1\rangle,$$&lt;/span&gt; alternatively denoted as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\gamma |00\rangle + \alpha\delta |01\rangle + \beta\gamma |10\rangle + \beta\delta|11\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here you can say that a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system can store &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; values(coefficients) in parallel, although there's always the restriction that the squared sum of the moduli of the coefficients of the computational basis states must add up to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Obviously there is great promise in quantum computing so I think its&#xA;  more a problem of messaging.  Any suggestions for intro/primer&#xA;  literature that doesn't present the quantum computing basics in this&#xA;  oxymoronic way?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See my previous answers: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1972/26&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2669/26&quot;&gt;this&lt;/a&gt;, for resource recommendations. As mentioned there, I'd recommend starting with &lt;a href=&quot;https://www.youtube.com/playlist?list=PL2jykFOD1AWap0r8WOuZ-08BFgMyx-5RT&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vazirani's lectures&lt;/a&gt; and then moving on to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt;. I recently found the 2006 &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; by John Watrous which are also pretty great for beginners. It helps a lot to have a thorough grounding in linear algebra, while learning quantum computing, but I suspect you already have that, being a mathematics and computer science graduate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for how computation using qubits can be faster, in some cases, than using classical bits, I recommend carefully thumbing through the standard quantum algorithms like &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Jozsa&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's&lt;/a&gt; among others. &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a simple explanation of the Deutsch-Jozsa algorithm. It would be a bit  difficult to summarize that in one answer. Please keep in mind that quantum computing cannot speed up all type of computations. It's applicable to only very specific problems.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-06T07:33:39.677" LastActivityDate="2018-12-06T07:33:39.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4881" PostTypeId="2" ParentId="4878" CreationDate="2018-12-06T09:10:46.767" Score="1" Body="&lt;p&gt;You have to put an extra SWAP-gate after the QFT, see &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22,%22H%22,1,%22H%22,%22H%22],[1,1,%22X%22,1,1,%22X%22],[%22%E2%80%A2%22,1,%22Z%22],[1,%22%E2%80%A2%22,%22Z%22],[1,%22%E2%80%A2%22,%22Z%22],[%22QFT%E2%80%A02%22],[1,1,1,1,%22%E2%80%A2%22,%22Z%22],[1,1,1,%22%E2%80%A2%22,1,%22Z%22],[1,1,1,%22%E2%80%A2%22,1,%22Z%22],[1,1,1,%22Swap%22,%22Swap%22],[1,1,1,1,%22H%22],[1,1,1,%22Z%5E-%C2%BD%22,%22%E2%80%A2%22],[1,1,1,%22H%22],[1,1,1,%22Swap%22,%22Swap%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the two controlled-Z gates on the same qubit are not necessary. This can reduce the circuit further to &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22,%22H%22,%22X%22,%22H%22,%22H%22,%22X%22],[%22%E2%80%A2%22,1,%22Z%22],[1,1,1,1,%22%E2%80%A2%22,%22Z%22],[%22QFT%E2%80%A02%22,1,1,%22Swap%22,%22Swap%22],[1,1,1,1,%22H%22],[1,1,1,%22Z%5E-%C2%BD%22,%22%E2%80%A2%22],[1,1,1,%22H%22],[1,1,1,%22Swap%22,%22Swap%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2018-12-06T09:10:46.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4882" PostTypeId="1" CreationDate="2018-12-06T10:19:40.240" Score="2" ViewCount="132" Body="&lt;p&gt;Recently I have been reading about surface codes a little and one thing I came acros was a specific order in which gates should be applied before the ancilla is measured. See for instance figure 2 in &lt;a href=&quot;https://journals.aps.org/prapplied/abstract/10.1103/PhysRevApplied.8.034021&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; article.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific order of the two-qubit gates with the ancilla is important due to some commutation relations which will not be valid otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain in more detail why this order is important? (heavy math is allowed here)&lt;br&gt;&#xA;Furthermore, what goes wrong if we use different orders? And why is this order different for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type plaquettes?&lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2018-12-13T20:39:40.957" LastActivityDate="2018-12-13T20:39:40.957" Title="Measuring order ancilla qubits in surface code" Tags="&lt;error-correction&gt;&lt;measurement&gt;&lt;surface-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4883" PostTypeId="2" ParentId="4645" CreationDate="2018-12-06T13:20:03.073" Score="2" Body="&lt;p&gt;If you look at the literature for blind quantum computation, there is the concept of a &quot;trap state&quot;. Basically, something that isn't part of the main computation that is supposed to give specific results so that you can easily verify that the computer is behaving as expected. I believe some of these trap states are Bell pairs, and the measurements performed on them are implementing CHSH tests and the like, to verify that there really is (effectively, perhaps hidden by a layer of encoding) a maximally entangled qubit pair present. See, for example, Fig. 2 &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0025-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-06T13:20:03.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4884" PostTypeId="2" ParentId="4874" CreationDate="2018-12-06T13:29:23.470" Score="3" Body="&lt;p&gt;Imagine you're playing a CHSH game with someone, although you don't know what quantum system it is that you're playing with, or even what measurements it is that you're doing on the system.  You just know that you're getting the average value&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A_1(B_1+B_2)+A_2(B_1-B_2)\rangle=2\sqrt{2}&#xA;$$&lt;/span&gt;&#xA;(where measurement results of &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; are recorded in &lt;span class=&quot;math-container&quot;&gt;$A_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_2$&lt;/span&gt; by the first player for their two separate measurements, and in &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt; for the second player's two separate measurements). The simple fact that you got this value of &lt;span class=&quot;math-container&quot;&gt;$2\sqrt2$&lt;/span&gt; tells you that, in effect, you have a maximally entangled qubit pair, and that your measurements are acting as qubit measurements with the correct relative angles to generate the CHSH result. That's the essence of how device-independent crypto works, as you could now use this &quot;thing that's proven to be equivalent to a Bell pair+measurements&quot; in a standard crypto scheme such as the key distribution protocol of E91.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, instead, you get some expectation value &lt;span class=&quot;math-container&quot;&gt;$2&amp;lt;S\leq2\sqrt2$&lt;/span&gt;, then you know that at least some of your answers are being generated in a truly random way (and it gives you a quantitative statement about how much somebody else could know about those randomly generated answers) because if they're not, you'd have to be getting &lt;span class=&quot;math-container&quot;&gt;$S\leq 2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-12-06T14:29:01.817" LastActivityDate="2018-12-06T14:29:01.817" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4885" PostTypeId="2" ParentId="4882" CreationDate="2018-12-06T13:30:52.897" Score="2" Body="&lt;p&gt;To make a simple example, let's imagine we are not doing measurement by instead just applying the stabilizer operators. So we want to do &lt;span class=&quot;math-container&quot;&gt;$XXXX$&lt;/span&gt; around the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; plaquettes, and &lt;span class=&quot;math-container&quot;&gt;$ZZZZ$&lt;/span&gt; around the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; plaquettes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method in the article you mention applies operations in four steps: first to the 'north east' qubit of each plaquette, then in the order NW &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; SE &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; SE for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; plaquettes and SE &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; NW &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; SW for the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; plaquettes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This ensures two properties. One is that no qubit is involved in more than one operation during each step. To see what the other important property, let's focus on two neigbouring plaquettes: one &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and one &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0---1---3&#xA;| X | Z |&#xA;3---4---5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Step-by-step, the operation we apply is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ (Z_{4} X_{3})~~(Z_{1} X_{4})~~(Z_{5} X_{0})~~(Z_{3} X_{1})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's do some commutations. We know that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; anticommute when applied to the same qubit, but the operations all commute otherwise. So note that each &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; commutes to everything to its left. That means we can rewrite this as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ ( Z_{4} Z_{1}Z_{5} Z_{3} )~~( X_{3} X_{4} X_{0} X_{1}).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So though we didn't do a complete &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; stabilizer operation followed by a complete &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; stabilizer operation, the effect is the same as if we had. The same holds true for the stabilizer measurements made using controlled operations. Due to this exact same commutation behaviour, the effect is equivalent to doing them independently, one after the other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other sequences of operators, we might instead come out with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ - ~~ ( Z_{4} Z_{1}Z_{5} Z_{3} )~~( X_{3} X_{4} X_{0} X_{1}),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;due to an anticommutation that we needed to account for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When applying stabilizer operators, this just results in a global phase and is not too important. When applying controlled operations for stabilizer measurements, however, the effects are much more drastic. It is no longer possible to separate out the two independent measurements of the two types of stabilizer. Instead, you'll get some strange combined measurements of both plaquettes. This won't tell you about errors, and won't preserve your code space. So it is exactly what you don't what to do in your surface code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any method that prevents all neigbouring pairs of plaquette measurements from becoming interleaved in this way is valid. So you could swap the methods for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; in the paper and it would still work.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-12-06T15:37:15.647" LastActivityDate="2018-12-06T15:37:15.647" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4886" PostTypeId="1" AcceptedAnswerId="12135" CreationDate="2018-12-06T16:19:22.763" Score="4" ViewCount="373" Body="&lt;p&gt;I'm stuck with a very specific problem that I'm not sure on how to implement using quantum gates. Suppose I have an &lt;code&gt;n&lt;/code&gt; qubit circuit and that I want in output a random &lt;code&gt;n&lt;/code&gt; qubit string containing exactly &lt;code&gt;k&lt;/code&gt; qubits equals to one. E.g. if &lt;code&gt;n=7&lt;/code&gt; and &lt;code&gt;k=3&lt;/code&gt;, possible outputs can be &lt;span class=&quot;math-container&quot;&gt;$|0010110\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0101001\rangle$&lt;/span&gt;.&#xA;In other words, it basically should give one of the possible combinations of the binomial coefficient &lt;span class=&quot;math-container&quot;&gt;$\binom{n}{k}$&lt;/span&gt;.&#xA;Is there any efficient way to implement this?&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="26" LastEditDate="2018-12-06T17:21:32.807" LastActivityDate="2020-08-12T00:07:55.837" Title="How to get all combinations of given input?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4887" PostTypeId="1" CreationDate="2018-12-06T18:35:41.847" Score="6" ViewCount="442" Body="&lt;p&gt;If we have a quantum channel mapping from a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional state to a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional state, it can be described by at most &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; Kraus operators. Suppose our channel maps instead from a &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt;-dimensional state to a &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt;-dimensional state, with &lt;span class=&quot;math-container&quot;&gt;$d_1&amp;gt;d_2$&lt;/span&gt;, e.g. with the quantum operation of taking the partial trace over a mode. What is the maximum required number of Kraus operators to characterise the channel? Is it &lt;span class=&quot;math-container&quot;&gt;$d_1d_2$&lt;/span&gt;, analogous to the case where &lt;span class=&quot;math-container&quot;&gt;$d_1=d_2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5276" LastEditorUserId="55" LastEditDate="2021-05-16T16:18:29.030" LastActivityDate="2021-05-16T16:18:29.030" Title="How many Kraus operators are required to characterise a channel with different start and end dimensions?" Tags="&lt;quantum-operation&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4888" PostTypeId="2" ParentId="4887" CreationDate="2018-12-06T20:34:57.720" Score="2" Body="&lt;p&gt;Yes. &lt;a href=&quot;https://en.wikipedia.org/wiki/Choi%27s_theorem_on_completely_positive_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;Choi's Theorem&lt;/a&gt; a priori uses different Hilbert spaces of potentially different dimensions &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$d_1=d_2$&lt;/span&gt; is a corollary. The proof is included there.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="5870" LastEditDate="2020-02-05T11:41:54.733" LastActivityDate="2020-02-05T11:41:54.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4889" PostTypeId="2" ParentId="4886" CreationDate="2018-12-07T03:10:23.647" Score="1" Body="&lt;p&gt;Go inductively like the strategy described in @DaftWullie answer of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4350/general-construction-of-w-n-state/4358#4358&quot;&gt;General construction of W_n state&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have the circuits &lt;span class=&quot;math-container&quot;&gt;$U_{n-1,k-1}$&lt;/span&gt; that take you from &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle^{\otimes (n-1)}$&lt;/span&gt; to the state that is an equal superposition of the &lt;span class=&quot;math-container&quot;&gt;$\binom{n-1}{k-1}$&lt;/span&gt; possibilities with &lt;span class=&quot;math-container&quot;&gt;$k-1$&lt;/span&gt; ones. That is each with a coefficent &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{\binom{n-1}{k-1}}}$&lt;/span&gt;. Same but for &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; as well with &lt;span class=&quot;math-container&quot;&gt;$U_{n-1,k}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting from &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle ^{\otimes n}$&lt;/span&gt; apply a unitary on the first qubit that gets you in &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{\binom{n-1}{k}}}{\sqrt{\binom{n}{k}}} | 0 \rangle + \frac{\sqrt{\binom{n-1}{k-1}}}{\sqrt{\binom{n}{k}}} | 1 \rangle$&lt;/span&gt;. This is just a 2 by 2 unitary so you can say where &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt; goes by swapping &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; coefficients and putting the &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; sign. From there figure out the Euler angles to get into standard form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now do two controlled unitaries. A controlled version of &lt;span class=&quot;math-container&quot;&gt;$U_{n-1,k-1}$&lt;/span&gt; when first qubit is 1. Also a controlled version of &lt;span class=&quot;math-container&quot;&gt;$U_{n-1,k}$&lt;/span&gt; when first qubit is 0. The numerators cancel and you get the desired resulting state. The whole circuit for this would be &lt;span class=&quot;math-container&quot;&gt;$U_{n,k}$&lt;/span&gt; then.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For small values of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; you need the base case of the induction. But that is going to either be &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; in which case you do a &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; gate. Or &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; in which case you do the identity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again same caveats about one and two qubit gates and not the most efficient. You can check how &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; special case works.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2018-12-07T03:10:23.647" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4890" PostTypeId="2" ParentId="4838" CreationDate="2018-12-07T10:53:21.703" Score="1" Body="&lt;p&gt;The Qconfig file was used to hold your API key, so that you could access the cloud based quantum devices and simulators. For the most recent version of Qiskit, it is no longer required. Instead you can use the command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.save_account('MY_API_TOKEN')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is a python command. You can do it in a Jupyter notebook, on the python command line, or wherever else you prefer that accepts python3 commands. You will need to replace &lt;code&gt;MY_API_TOKEN&lt;/code&gt; with the token you get from the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience website&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This step of saving credentials only needs to be done once. Afterwards, you can simply load the saved information using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.load_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Full instructions can be found &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still want to use a Qconfig file, you can. You can create one yourself using the template in the link above. Then you place it wherever you want. To import it, using the sys package to append the path to where you have placed the file.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-12-07T10:53:21.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4891" PostTypeId="2" ParentId="4831" CreationDate="2018-12-07T19:20:42.353" Score="0" Body="&lt;p&gt;In v0.4 (which is out now), your problem is fixed by using &lt;code&gt;cirq.Simulator&lt;/code&gt; instead of &lt;code&gt;cirq.google.XmonSimulator&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We originally added automatic decomposition to the xmon simulator as a convenience feature, because it was the only simulator and it seemed onerous to require users to figure out how to decompose their circuits into native xmon gates before they could do a simulation. But it has become clear that it's very confusing to do this because a) it can easily quintuple the size of the circuit because the decomposition is done naively and b) it makes the results of the moment stepping simulation completely impossible to predict (as you have noticed). This is why we introduced the more flexible &lt;code&gt;cirq.Simulator&lt;/code&gt; and why, in the future, &lt;code&gt;cirq.google.XmonSimulator&lt;/code&gt; is going to  require predecomposed inputs so these accidental decompositions don't happen anymore and so the moment structure of the circuit is preserved.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-12-07T19:20:42.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4892" PostTypeId="2" ParentId="4886" CreationDate="2018-12-07T19:46:53.940" Score="2" Body="&lt;p&gt;An alternative way to prepare this state is by using amplitude amplification and a circuit to compute the Hamming weight (number of set bits) of a register.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Computing the Hamming Weight&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You can use a 3-bit adder to fold three qubits of weight &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; into one qubit of weight &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; and one qubit of weight &lt;span class=&quot;math-container&quot;&gt;$2W$&lt;/span&gt; (plus some temporary junk). Assume you have this circuit.&lt;/p&gt;&#xA;&lt;p&gt;To compute the Hamming weight, consider of all the register's qubits to have weight &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Keep applying the 3-to-2 adder to triplets of remaining weight &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; qubits until you have exactly &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; qubit of weight &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; qubits of weight &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. Repeat on the qubits of weight &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, until you have exactly &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; qubit of weight &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$N/4$&lt;/span&gt; qubits of weight &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Keep repeating until you have exactly one qubit of each weight class up to weight &lt;span class=&quot;math-container&quot;&gt;$2^{\lceil(\log_2(N))\rceil}$&lt;/span&gt;. These qubits form your binary Hamming weight register. If you measured that register and it returned &lt;span class=&quot;math-container&quot;&gt;$\ldots 000110$&lt;/span&gt;, then you would be projected into an equal superposition containing all the cases where exactly 6 bits are set.&lt;/p&gt;&#xA;&lt;p&gt;Once you have the weight, you can easily create a qubit that's set or not set depending on if the weight equals the desired weight. Applying a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate to this qubit is the crucial step needed for amplitude amplification.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Amplitude amplification.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You want to amplify cases where the Hamming weight is equal to the desired weight. We have just defined how to perform an operation that negates the phases of correct states (compute the Hamming weight, compute the 'is it the right weight?' indicator qubit, hit that qubit with a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, uncompute the indicate and the Hamming weight). If you alternate this with Grover diffusion operations, you will rotate towards the desired state.&lt;/p&gt;&#xA;&lt;p&gt;Depending on what your target Hamming weight is, this will take different amounts of time. There is one tricky bit during the very last iteration where you want to use partial phasing operations to exactly nail the desired states, but otherwise it's straightforward.&lt;/p&gt;&#xA;&lt;p&gt;For example, here is a circuit that creates a superposition of all states less than a given value. It only needs to do one partial step, no full steps, because it limits itself to the case where at least half of the values are included:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/U8eVR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U8eVR.png&quot; alt=&quot;create uniform superposition&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Overview&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I am unsure if this approach will be more or less efficient than the inductive approach used in the other answer. It may depend on what your target weight is.&lt;/p&gt;&#xA;&lt;p&gt;If amplitude amplification is daunting to you, and you're in a very small case, you can avoid it by initializing the register into &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; states, measuring the Hamming weight, and keep retrying until it returns the right answer.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="2927" LastEditDate="2020-08-12T00:07:55.837" LastActivityDate="2020-08-12T00:07:55.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4893" PostTypeId="1" AcceptedAnswerId="5239" CreationDate="2018-12-08T01:07:35.093" Score="3" ViewCount="314" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we define an operator CPT that carries out the CPT transformation:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\text{CPT}|\Psi\rangle = A|\Psi\rangle$$&lt;/span&gt;&#xA;  where A is just a constant. Or put another way, the states of our theory are eigenfunctions of the CPT operator. -&lt;a href=&quot;https://physics.stackexchange.com/a/390463/198219&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What do the eigenvalues of the CPT operator mean? &lt;a href=&quot;https://physics.stackexchange.com/questions/390321/clarification-on-cpt-symmetry#comment877141_390463&quot;&gt;*&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="26" LastEditDate="2019-01-18T10:42:24.380" LastActivityDate="2019-01-21T14:35:53.207" Title="Eigenvalues of CPT operator" Tags="&lt;cpt-symmetry&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4894" PostTypeId="1" AcceptedAnswerId="4903" CreationDate="2018-12-08T22:04:28.477" Score="4" ViewCount="161" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Time-bin encoding is a technique used in Quantum information science to encode a qubit of information on a photon.  &lt;a href=&quot;https://en.wikipedia.org/wiki/Time-bin_encoding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a generalization for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th level qudits? &lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-09T19:27:15.917" LastActivityDate="2018-12-11T10:26:54.647" Title="Time-bin encoding qudits" Tags="&lt;resource-request&gt;&lt;qudit&gt;&lt;photonics&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4895" PostTypeId="1" AcceptedAnswerId="4896" CreationDate="2018-12-09T17:38:16.173" Score="4" ViewCount="873" Body="&lt;p&gt;If a control qubit is in superposition, how it will affect target qubit if it is collapsed or in superposition?  Is it true that CNOT works only if the control bit collapsed to 1? Also, is it possible to collapse or Hadamard control qubit “on the go” in a real life quantum computer and have a functional CNOT gate? &lt;/p&gt;&#xA;" OwnerUserId="5292" LastEditorUserId="26" LastEditDate="2018-12-23T12:49:34.447" LastActivityDate="2018-12-23T12:49:34.447" Title="CNOT gate - control qubit is in superposition" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4896" PostTypeId="2" ParentId="4895" CreationDate="2018-12-09T18:07:12.850" Score="4" Body="&lt;p&gt;By an example with a control qubit in superposition and the target in &lt;span class=&quot;math-container&quot;&gt;$ |0\rangle $&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{|0\rangle + |1\rangle}{\sqrt{2}} |0\rangle  = \frac{|0\rangle|0\rangle + |1\rangle |0\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying a CNOT will have the following result:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{ CNOT(|0\rangle|0\rangle + |1\rangle |0\rangle)}{\sqrt{2}} = \frac{ CNOT(|0\rangle|0\rangle) + CNOT(|1\rangle |0\rangle)}{\sqrt{2}}  = \frac{ |0\rangle|0\rangle + |1\rangle |1\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the CNOT acts linearly with a control qubit in superposition, but will change the target only on the part involving a &lt;span class=&quot;math-container&quot;&gt;$ |1\rangle$&lt;/span&gt; in the control qubit.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-12-09T18:07:12.850" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4897" PostTypeId="1" AcceptedAnswerId="4898" CreationDate="2018-12-09T21:06:54.233" Score="3" ViewCount="695" Body="&lt;p&gt;Suppose I have created a circuit composed of some registers with the usual&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(qr, cr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;qr&lt;/code&gt; and &lt;code&gt;cr&lt;/code&gt; are a quantum register and a classical register respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose that at this point I want to invoke a subroutine. This subroutine, however, uses some ancillas. Is there any functions to append this new set of qubits to the original circuit? Something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ancillas = QuantumRegister(n, 'ancillas')&#xA;#qc.append(ancillas)    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;An equivalent problem (maybe) is the following one. Suppose I have a quantum circuit &lt;code&gt;qcn&lt;/code&gt; composed of &lt;code&gt;n&lt;/code&gt; qubits and a subroutine which returns another quantum circuit &lt;code&gt;qck&lt;/code&gt; operating on &lt;code&gt;k&lt;/code&gt; qubits, with &lt;code&gt;k &amp;gt; n&lt;/code&gt;. Is it possible to compose the two circuits in such a way that the first &lt;code&gt;n&lt;/code&gt; qubits on which the subroutine operates are the same of the original circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment, the only solution to me seems to declare in advance all the total number of qubits required (&lt;code&gt;k&lt;/code&gt; in the previous case) and then passing around them to the various functions.&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="26" LastEditDate="2018-12-10T04:18:16.337" LastActivityDate="2018-12-10T04:18:16.337" Title="Is it possible to expand/merge different circuits?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4898" PostTypeId="2" ParentId="4897" CreationDate="2018-12-09T21:58:46.513" Score="5" Body="&lt;p&gt;For the first question, you can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.add(ancillas)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this will change to &lt;code&gt;add_registers&lt;/code&gt; in Qiskit Terra 0.7.0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some more guidance on how to combine and extend circuits, you can see &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorial/blob/master/qiskit/terra/QuantumCircuits.ipynb&quot; rel=&quot;noreferrer&quot;&gt;this guide&lt;/a&gt;. Note that this is for the upcoming 0.7.0 release, but you can already get the functionality with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/Qiskit/qiskit-terra.git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-12-09T21:58:46.513" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4899" PostTypeId="1" CreationDate="2018-12-09T22:29:45.787" Score="3" ViewCount="47" Body="&lt;p&gt;In his 2009 paper, Grover vs McElicee, Bernstein proposed to use the Grover's algorithm to obtain a quadratic speedup on the Prange ISD.&#xA;However, it is not quite clear to me in which part of the algorithm a Grover search can be used and all other papers and references citing Bernstein's paper don't seem to clarify the point.&#xA;Does anyone has any idea on this point? &lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="26" LastEditDate="2018-12-10T03:36:57.673" LastActivityDate="2018-12-10T03:36:57.673" Title="Speedup Prange ISD using Grover" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4900" PostTypeId="2" ParentId="2200" CreationDate="2018-12-09T22:43:12.673" Score="0" Body="&lt;p&gt;I implemented the same problem for multiple qubits using qiskit &lt;a href=&quot;https://github.com/tigerjack/qiskit_grover/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the 3 qubit state you presented, you can use an oracle like the one &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22,%22H%22,%22H%22],[%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22],[1,1,%22H%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,%22H%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (I'm using quirk just to show the amplitudes in real time).&#xA;Note that the first three Hadamards (the ones before the &lt;code&gt;...&lt;/code&gt;) are there only to simulate a random input to the oracle and are not part of the oracle itself. In every case, as you can see from the amplitudes at the end of the circuit, only the &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; state gets flipped out, while all the other states remain unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the idea is to simulate a CCZ gate using Hadamard on target bit following by a CCX gate and then another Hadamard on the target bit.&lt;/p&gt;&#xA;" OwnerUserId="4848" LastActivityDate="2018-12-09T22:43:12.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4901" PostTypeId="1" CreationDate="2018-12-10T00:56:55.643" Score="6" ViewCount="68" Body="&lt;p&gt;I am reading on how the adiabatic evolution can be approximated by a quantum circuit of size poly(nT) and I am trying to follow the derivation in the paper &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;W. van Dam, M. Mosca, and U. Vazirani, “How Powerful is Adiabatic&#xA;  Quantum Computation?,” Proceedings 2001 IEEE International Conference&#xA;  on Cluster Computing, pp. 279–287, 2001.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In section 4, page 4, it states that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The Campbell-Baker-Hausdorff theorem tells us how well we can approximate ‘parallel Hamiltonians’ by consecutive&#xA;ones: &lt;span class=&quot;math-container&quot;&gt;$|||\exp(A+B) − \exp(A)\exp(B)||| \in O(|||AB|||)$&lt;/span&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The norm I believe is just the operator induced norm. I am familiar with the BCH formula but could not see the above relation directly coming out from the formula. &lt;strong&gt;So how is this relation derived?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking into the reference which is &quot;matrix analysis&quot; by Rajendra Bhatia but didn't get any success.&lt;/p&gt;&#xA;" OwnerUserId="5005" LastEditorUserId="26" LastEditDate="2018-12-10T03:34:28.190" LastActivityDate="2018-12-10T09:47:16.823" Title="Proof on approximating adiabatic evolution by quantum circuit" Tags="&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4902" PostTypeId="2" ParentId="4901" CreationDate="2018-12-10T08:17:38.040" Score="3" Body="&lt;p&gt;The Baker-Campbell-Hausdorff formula says that you can expand&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\log(e^Ae^B)=A+B+[A,B]/2+\ldots=M&#xA;$$&lt;/span&gt;&#xA;where higher order terms have 3 or more uses of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Now, let's say that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are anti-Hermitian so that &lt;span class=&quot;math-container&quot;&gt;$e^A$&lt;/span&gt;, and similar terms, are unitary. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\exp(A+B)-\exp(A)\exp(B)\|=\|e^{A+B}\left(\mathbb{I}-e^Me^{-(A+B)}\right)\|.&#xA;$$&lt;/span&gt;&#xA;The matrix norm is invariant under the action of unitaries, so this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathbb{I}-e^Me^{-(A+B)}\|.&#xA;$$&lt;/span&gt;&#xA;Now, you might apply the BCH formula again to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathbb{I}-e^{M-A-B-[M,A+B]/2+\ldots}\|,&#xA;$$&lt;/span&gt;&#xA;the point being that the leading order &lt;span class=&quot;math-container&quot;&gt;$A+B$&lt;/span&gt; stuff cancels from &lt;span class=&quot;math-container&quot;&gt;$M-A-B$&lt;/span&gt; and the commutator, leaving terms like &lt;span class=&quot;math-container&quot;&gt;$[A,B]$&lt;/span&gt;. If both &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are small (&lt;span class=&quot;math-container&quot;&gt;$O(\epsilon)$&lt;/span&gt;), then higher order terms have vanishing relevance, so we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathbb{I}-e^{[A,B]/2+O(\epsilon^3)}\|,&#xA;$$&lt;/span&gt;&#xA;and if we do an expansion on that, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathbb{I}-(\mathbb{I}+[A,B]/2+O(\epsilon^3))\|=\|[A,B]\|/2+O(\epsilon^3)=O(\|AB\|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-12-10T09:47:16.823" LastActivityDate="2018-12-10T09:47:16.823" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4903" PostTypeId="2" ParentId="4894" CreationDate="2018-12-10T23:37:38.167" Score="2" Body="&lt;p&gt;Yes! The first application of time bin photonic qudits that comes to mind is for quantum key distribution. Here's an example: &lt;a href=&quot;https://arxiv.org/abs/1611.01139&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1611.01139&lt;/a&gt;. I am sure there are more references out there though!&lt;/p&gt;&#xA;" OwnerUserId="4222" LastActivityDate="2018-12-10T23:37:38.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4904" PostTypeId="1" CreationDate="2018-12-11T08:48:38.407" Score="1" ViewCount="104" Body="&lt;p&gt;Suppose that in my circuit I have to generate multiple, say &lt;code&gt;n&lt;/code&gt;, random coin flips. &#xA;For example, this coin flips could be used to activate &lt;code&gt;n&lt;/code&gt; CNOTs half of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trivial solution could be to use &lt;code&gt;n&lt;/code&gt; different qubits and Hadamard them. However, this gets really huge when &lt;code&gt;n&lt;/code&gt; is large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any better way? By better I mean using a small (fixed??) number of qubits and only a few simple quantum gates.&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="4848" LastEditDate="2018-12-11T08:54:16.547" LastActivityDate="2018-12-11T09:33:26.720" Title="Multiple random coin flips" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4905" PostTypeId="2" ParentId="4904" CreationDate="2018-12-11T09:33:26.720" Score="1" Body="&lt;p&gt;This depends on exactly what you want to do with the outcome. If you want to use the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; outcomes simultaneously, then you need &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; separate coins. Alternatively, you are happy to implement them all in sequence (one after the other), then what you could do is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;start with qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;apply Hadamard to it&lt;/li&gt;&#xA;&lt;li&gt;measure it in the 0/1 basis&lt;/li&gt;&#xA;&lt;li&gt;drive the controlled-not off it&lt;/li&gt;&#xA;&lt;li&gt;apply Hadamard to it&lt;/li&gt;&#xA;&lt;li&gt;measure it in the 0/1 basis&lt;/li&gt;&#xA;&lt;li&gt;drive the controlled-not off it&lt;/li&gt;&#xA;&lt;li&gt;apply Hadamard to it&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;which only requires the one qubit.&#xA;This is assuming that when you talk about coin flips, you really mean the classical version (which is why I have the measurements in there). If the coherence were important to you, it might be a different matter.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-11T09:33:26.720" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4906" PostTypeId="2" ParentId="4894" CreationDate="2018-12-11T10:26:54.647" Score="2" Body="&lt;p&gt;There is a number of groups using time-bin encoding to realise computation/communication protocols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example is Furusawa's group in Japan, which among other things works on measurement-based QC with time-bin encoding (e.g. &lt;a href=&quot;https://arxiv.org/abs/1706.06312&quot; rel=&quot;nofollow noreferrer&quot;&gt;1706.06312&lt;/a&gt;).&#xA;Another example that comes to mind is Silberhorn's group in Paderborn. They use time-bin encoding for various things, a random example of which is &lt;a href=&quot;https://arxiv.org/abs/1710.06103&quot; rel=&quot;nofollow noreferrer&quot;&gt;1710.06103&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2018-12-11T10:26:54.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4907" PostTypeId="1" AcceptedAnswerId="4971" CreationDate="2018-12-11T10:46:05.323" Score="2" ViewCount="772" Body="&lt;p&gt;I have a circuit composed by &lt;code&gt;n&lt;/code&gt; qubits, plus a single one which is an ancilla. I'm making multiple measurements on the ancilla at different stages of the circuit, while working on the &lt;code&gt;n&lt;/code&gt; qubits. These measurements are not really needed at all: they are just a way to collapse the state of the qubit at some point during the computation and then reuse the same qubit in a different way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of the circuit, when I'm measuring the outcome of the &lt;code&gt;n&lt;/code&gt; qubits, I don't want the result of this ancilla to be shown in the output of the &lt;code&gt;get_counts()&lt;/code&gt; function; what I want is only the output of the &lt;code&gt;n&lt;/code&gt; qubits. Is there any way to achieve this result?&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="4848" LastEditDate="2018-12-15T18:12:13.947" LastActivityDate="2018-12-15T18:22:56.650" Title="qiskit - Is there any way to discard the results of a measurement?" Tags="&lt;circuit-construction&gt;&lt;programming&gt;&lt;measurement&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4908" PostTypeId="1" AcceptedAnswerId="4909" CreationDate="2018-12-11T12:58:02.273" Score="6" ViewCount="318" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1610.06546v2&quot; rel=&quot;noreferrer&quot;&gt;this research paper&lt;/a&gt;, the authors introduce a new algorithm to perform Hamiltonian simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The beginning of their abstract is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given a Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$\hat{H} = \langle G\vert \hat{U} \vert G\rangle$&lt;/span&gt; that is the projection of an oracle &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; by state &lt;span class=&quot;math-container&quot;&gt;$\vert G\rangle$&lt;/span&gt;&#xA;  created with oracle &lt;span class=&quot;math-container&quot;&gt;$\hat{G}$&lt;/span&gt;, the problem of Hamiltonian simulation is approximating the time evolution operator &lt;span class=&quot;math-container&quot;&gt;$e^{-i\hat{H}t}$&lt;/span&gt; at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; with error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the article:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{G}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; are called &quot;oracles&quot;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{H}$&lt;/span&gt; is an Hermitian operator in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n} \times \mathbb{C}^{2^n}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert G \rangle \in \mathbb{C}^d$&lt;/span&gt; (legend of Table 1).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is the following: what means &lt;span class=&quot;math-container&quot;&gt;$\hat{H} = \langle G\vert \hat{U} \vert G\rangle$&lt;/span&gt;? More precisely, I do not understand what &lt;span class=&quot;math-container&quot;&gt;$\langle G\vert \hat{U} \vert G\rangle$&lt;/span&gt; represents when &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; is an oracle and &lt;span class=&quot;math-container&quot;&gt;$\vert G \rangle$&lt;/span&gt; a quantum state.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2018-12-11T13:33:56.380" LastActivityDate="2018-12-11T13:33:56.380" Title="Problem with the mathematical formulation of &quot;qubitization&quot;" Tags="&lt;mathematics&gt;&lt;hamiltonian-simulation&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4909" PostTypeId="2" ParentId="4908" CreationDate="2018-12-11T13:23:56.893" Score="5" Body="&lt;p&gt;You want to start by being careful with the sizes of the operators. &lt;span class=&quot;math-container&quot;&gt;$\hat U$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; qubits, and &lt;span class=&quot;math-container&quot;&gt;$\hat H$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$n&amp;lt;q$&lt;/span&gt; qubits. I believe that &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt; is a state of &lt;span class=&quot;math-container&quot;&gt;$q-n$&lt;/span&gt; qubits. So, what we really need to talk about is two distinct sets of qubits. Let me call them sets &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; contains &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; contains &lt;span class=&quot;math-container&quot;&gt;$q-n$&lt;/span&gt; qubits. I'll use subscripts to denote which qubits the different operators and states act upon:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat H_A=(\langle G|_B\otimes\mathbb{I}_A)\hat U_{AB}(|G\rangle_B\otimes\mathbb{I}_A)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-11T13:23:56.893" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4910" PostTypeId="1" AcceptedAnswerId="4911" CreationDate="2018-12-11T13:46:46.483" Score="8" ViewCount="273" Body="&lt;p&gt;How do I find an explicit isomorphism between the elements of the Clifford group and some 24 quaternions? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The easy part:&lt;/em&gt;&#xA;The multiplication of matrices should correspond to multiplication of quaternions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The identity matrix &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; should be mapped to the quaternion &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The hard part:&lt;/em&gt;&#xA;&lt;strong&gt;To what should the other elements of the Clifford group be mapped?&lt;/strong&gt; Since the following to elements generate the entire group, mapping these will be sufficient:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=\frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\end{bmatrix}\text{ and }P=\begin{bmatrix}1&amp;amp;0\\0&amp;amp;i\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody help?&lt;/p&gt;&#xA;" OwnerUserId="5305" LastActivityDate="2018-12-12T10:10:23.033" Title="Isomorphism between the Clifford group and the quaternions" Tags="&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4911" PostTypeId="2" ParentId="4910" CreationDate="2018-12-11T16:34:29.787" Score="6" Body="&lt;p&gt;The quaternions are represented faithfully in two dimensions by the unit matrix and the Pauli matrices multiplied by the imaginary unit: &lt;span class=&quot;math-container&quot;&gt;$i = \sqrt{-1} X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$j = \sqrt{-1} Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k = \sqrt{-1} Z$&lt;/span&gt; respectively, thus you only need to write &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; the linear combinations: &lt;span class=&quot;math-container&quot;&gt;$H = -\frac{\sqrt{-1} }{\sqrt{2}}(i+k)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P = \frac{1+\sqrt{-1}}{2}(1-k)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is not an isomorphism between the Clifford group and the quaternions, because here we use the quaternions as an algebra not a group. What can be said that the Clifford group is isomorphic to a subgroup of invertible elements of the quaternion algebra.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term Quaternion group is reserved to another subgroup of invertible elements of the quaternion algebra consisting of &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pm (-iX = R_x(\pi))$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pm (-iY = R_y(\pi))$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pm (-iZ = R_z(\pi))$&lt;/span&gt;. This group is called the quaternion group.  This group can be generated by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; rotations around two major axes. However, the order-8 quaternion group is not isomorphic to the order-24 Clifford group, which can be generated by &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt; rotations around two major axes. The Clifford group is in a certain sense the square root of the quaternion group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Clarifications&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@Knot Log, Sorry I have misled you on two points: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The quaternions imaginary units should be represented as &lt;span class=&quot;math-container&quot;&gt;$i = \sqrt{-1} X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$j = \sqrt{-1} Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k = \sqrt{-1} Z$&lt;/span&gt;, as they have to square to &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; (I have corrected that in the main text) . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I forgot to mention that we need to work with the quaternion algebra over the complex field, i.e., we need to distinguish between the complex imaginary unit &lt;span class=&quot;math-container&quot;&gt;$\sqrt{-1}$&lt;/span&gt; and the quaternion &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, (I hope you took care of that in your analysis – in any case I have added the explicit expressions of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; to the main text. In addition, it is correct that global phases are not important when you use the elements as quantum gates, and you correctly took equivalence classes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Please see the article by &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.593.5165&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Michel Planat&lt;/a&gt; , where in section 2.2. he mentions that the group generated by &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; should be of order 192, such that only when you remove a &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_8$&lt;/span&gt; center you reach the 24 element Clifford group (I haven't done the work myself). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, it is possible to generate the &lt;span class=&quot;math-container&quot;&gt;$24$&lt;/span&gt; element group directly without additional phases (Please see the &lt;a href=&quot;http://www.physinfo.fr/pdf/Lecture-10-III-0601(0603c).pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes &lt;/a&gt; by Michel Devoret if you start with generators of unit determinant (for example,  &lt;span class=&quot;math-container&quot;&gt;$R_x(\frac{\pi}{2})$&lt;/span&gt; and   &lt;span class=&quot;math-container&quot;&gt;$R_z(\frac{\pi}{2})$&lt;/span&gt;), because the Clifford group is geometric, as it is isomorphic to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Octahedral_symmetry&quot; rel=&quot;nofollow noreferrer&quot;&gt;octahedral group&lt;/a&gt;, the group of symmetries of the cube or the octahedron and all of its elements are rotations, i.e., with a unit determinant.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4534" LastEditDate="2018-12-12T10:10:23.033" LastActivityDate="2018-12-12T10:10:23.033" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4912" PostTypeId="1" CreationDate="2018-12-13T00:42:59.087" Score="5" ViewCount="289" Body="&lt;p&gt;Shor's algorithm to factor a number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; goes as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Pick a random value &lt;span class=&quot;math-container&quot;&gt;$b \in (0, N)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use a specific quantum computation to a sample a value &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; that should be close to &lt;span class=&quot;math-container&quot;&gt;$2^{m} k/p$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is a precision parameter of the quantum computation, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the period of &lt;span class=&quot;math-container&quot;&gt;$f(x) = b^x \pmod{N}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an unknown integer resulting from the sampling process.&lt;/li&gt;&#xA;&lt;li&gt;Convert &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; into a potential period &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; using an algorithm based on continued fractions.&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$b^p \neq 1 \pmod{N}$&lt;/span&gt;, goto 1. The period finding process failed (e.g. maybe you got &lt;span class=&quot;math-container&quot;&gt;$v=0$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is odd, goto 1. You got a useless period. Try a different &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$b^{p/2} \equiv -1 \pmod{N}$&lt;/span&gt;, goto 1. You got a useless period. Try a different &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Output &lt;span class=&quot;math-container&quot;&gt;$\gcd(b^{p/2} - 1, N)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is: how often do steps 4, 5, or 6 fail? Assuming an ideal quantum computer with no error, how often do you just get unlucky and pick a bad &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; or sample a bad &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;? How many times do you expect to repeat step 2 before the factoring succeeds?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References giving numerical upper bounds on the 4-5-6 failure chance would be especially appreciated.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2018-12-13T16:09:08.367" LastActivityDate="2019-05-09T08:16:48.577" Title="Expected repetitions of the quantum part of Shor's algorithm" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4913" PostTypeId="2" ParentId="4912" CreationDate="2018-12-13T01:18:15.970" Score="5" Body="&lt;p&gt;This self-answer gives a not-very-good worst case analysis. I'd really rather have a proper distribution of repetition counts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Probability of a period resulting in factoring&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's original paper&lt;/a&gt;, you can find the following statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The multiplicative group (mod &lt;span class=&quot;math-container&quot;&gt;$p^α$&lt;/span&gt;) for any odd prime power &lt;span class=&quot;math-container&quot;&gt;$p^α$&lt;/span&gt; is cyclic [Knuth 1981], so for any odd prime power &lt;span class=&quot;math-container&quot;&gt;$p_i^{a_i}$&lt;/span&gt;, the probability is at most 1/2 of choosing an &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; having any&#xA;  particular power of two as the largest divisor of its order &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;. Thus each of these powers of 2 has at most a 50% probability of agreeing with the previous ones, so all k of them agree with probability at most &lt;span class=&quot;math-container&quot;&gt;$1/2^{k−1}$&lt;/span&gt;, and there is at least a &lt;span class=&quot;math-container&quot;&gt;$1 - 1/2^{k-1}$&lt;/span&gt; chance that the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; we choose is good. This scheme will thus work as long as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is odd and not a prime power; finding factors of prime powers can be done efficiently with classical methods&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(Oddly, I also found an &lt;a href=&quot;https://www.computer.org/csdl/proceedings/focs/1994/6580/00/0365700.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;older version of the paper&lt;/a&gt; with a bound of &lt;span class=&quot;math-container&quot;&gt;$1-2^{-k}$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$1-2^{1-k}$&lt;/span&gt;. Might be an error that was corrected?)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implies a 50% chance of success of getting a good period (steps 4+5), since all numbers have at least two distinct factors or else can be factored classically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Probability of a sample determining a period&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For getting a good sample (step 3), Shor gives a more complicated bound. If you sample a value with a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; that's not relatively prime to the period, the period you recover will be wrong. But integers have a limited number of divisors, and Shor cites a bound:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are also &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; possible values for &lt;span class=&quot;math-container&quot;&gt;$x^k$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the order of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Thus, there are &lt;span class=&quot;math-container&quot;&gt;$r \phi(r)$&lt;/span&gt; states which would enable us to obtain &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. Since each of these states occurs with probability at least &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3r^2}$&lt;/span&gt;, we obtain &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; with probability at least &lt;span class=&quot;math-container&quot;&gt;$\frac{\phi(r)}{3r}$&lt;/span&gt;.&#xA;  Using the theorem that &lt;span class=&quot;math-container&quot;&gt;$\phi(r)/r &amp;gt; k/\log \log r$&lt;/span&gt; for some fixed &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; [17, Theorem 328], this shows that we find &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; at least a &lt;span class=&quot;math-container&quot;&gt;$k/ \log \log r$&lt;/span&gt; fraction of the time.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;[17]: G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Fifth Edition, Oxford University Press, New York (1979).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We know &lt;span class=&quot;math-container&quot;&gt;$r &amp;lt; N$&lt;/span&gt;, so this proves step 3 introduces at most &lt;span class=&quot;math-container&quot;&gt;$O(\lg \lg N)$&lt;/span&gt; repetitions. It seems likely to me that this can be improved (e.g. if you keep replacing &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$b^p$&lt;/span&gt; when you get a bad &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; that would presumably keep reducing &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, or maybe that's bad?), and I'm sure someone has explained how to do this in great detail, but I don't know the reference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;On Shor's Quantum Factor Finding Algorithm: Increasing the Probability of Success and Tradeoffs Involving the Fourier Transform Modulus&quot; seems promising. It discusses using the lcm of two samples in order to get a constant probability of successfully recovering a period (~60%).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I also did some &lt;a href=&quot;https://gist.github.com/Strilanc/6126baaa201ae60b621f5931f569363c&quot; rel=&quot;nofollow noreferrer&quot;&gt;simulation of how many repetitions are needed when the two factors are similarly sized primes&lt;/a&gt;, using some basic post-processing, and it appears to converge to 1.5. The following plot is showing a blue dot for each factoring attempt, with a random +-0.5 on each dot's X and Y position so you get a sense of the density in each area. The thick black line is the average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HWMPN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HWMPN.png&quot; alt=&quot;plot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-05-09T08:16:48.577" LastActivityDate="2019-05-09T08:16:48.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4914" PostTypeId="1" AcceptedAnswerId="4916" CreationDate="2018-12-13T15:02:03.383" Score="2" ViewCount="1507" Body="&lt;p&gt;I was reading a proof of No-cloning theorem, there are a couple of steps that are not clear to me, but the book does not give explanation for them. So here it is:&#xA;Theorem: It is impossible to create an identical copy of an arbitrary unknown quantum state.&#xA;Proof (by contradiction): Suppose that there exists a unitary &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; (that copies an arbitrary unknown q-state). Then: &lt;a href=&quot;https://i.stack.imgur.com/CmQSj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CmQSj.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the first thing I have trouble with, why do we take only one state (&lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right&amp;gt;$&lt;/span&gt; state) to prove that it is impossible to copy any arbitrary state into &lt;span class=&quot;math-container&quot;&gt;$any$&lt;/span&gt; qubit?&#xA;The proof goes on stating:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/sjwFm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sjwFm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I don't understand how (116) is the same as (117) (don't mind explaining the identity matrix in the middle). I will appreciate it if you make these 2 steps clearer to me.&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2018-12-13T20:40:22.857" LastActivityDate="2018-12-13T20:40:22.857" Title="Proof of no-cloning" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;&lt;no-cloning-theorem&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4915" PostTypeId="2" ParentId="4852" CreationDate="2018-12-13T15:48:24.547" Score="3" Body="&lt;p&gt;You can test stand alone the a modular multiplication circuit. In this case &lt;span class=&quot;math-container&quot;&gt;$\text{base} = 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N = 3$&lt;/span&gt;. However the smallest useful composite &lt;span class=&quot;math-container&quot;&gt;$N = 15 = 3 \times 5$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a well known &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=004-Quantum_Algorithms~2F110-Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multiplication by 7 modulo 15&lt;/a&gt; circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J0Plg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J0Plg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with input &lt;span class=&quot;math-container&quot;&gt;$$\ |1\rangle \text{ gives } |7\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ |7\rangle \text{ gives } |4\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ |4\rangle \text{ gives } |13\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ |13\rangle \text{ gives } |1\rangle$$&lt;/span&gt;&#xA;This repeats after &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; times and the period = &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the not so useful case of &lt;span class=&quot;math-container&quot;&gt;$N = 3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a = 2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$1 \times 2 \text{mod} (3) = 2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$2 \times 2 \text{mod} (3) = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It repeats after &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; times. Period is correct  &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and can be tested in a quantum simulator.&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1773" LastEditDate="2019-07-22T20:57:39.520" LastActivityDate="2019-07-22T20:57:39.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4916" PostTypeId="2" ParentId="4914" CreationDate="2018-12-13T16:36:52.703" Score="4" Body="&lt;p&gt;For step (116), the equivalence between both of them is proved by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;(\langle\psi_1|\otimes\langle0|)C^\dagger C(|\psi_2\rangle\otimes|0\rangle) = (\langle\psi_1|\otimes\langle0|)(|\psi_2\rangle\otimes|0\rangle) = \langle\psi_1|\psi_2\rangle\otimes\langle0|0\rangle=\langle\psi_1|\psi_2\rangle\langle0|0\rangle,&#xA;\end{equation}&lt;/span&gt;&#xA;where in the second step I used the property of tensor products that &lt;span class=&quot;math-container&quot;&gt;$(A\otimes B)(C\otimes D)=AC\otimes BD$&lt;/span&gt;, where obviously the dimensions of the multiplying matrices should match; and for the third step I used the fact that &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_1|\psi_2\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle0|0\rangle$&lt;/span&gt; are scalars, implying that their tensor product is just a multiplication between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your first question, state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is used because it is the typical ancillary system used for quantum algorithms, that is, the zero state is the one used a auxilliary variable for doing the corresponding operations. However, note that the proof is not state dependent, meaning that you can take an arbitrary ancillary qubit, name it &lt;span class=&quot;math-container&quot;&gt;$|\rho\rangle$&lt;/span&gt;, and prove the theorem. Here I leave you such proof:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C(|\psi_1\rangle\otimes|\rho\rangle) = |\psi_1\rangle\otimes|\psi_1\rangle\\&#xA;C(|\psi_2\rangle\otimes|\rho\rangle) = |\psi_2\rangle\otimes|\psi_2\rangle&#xA;\end{equation}&lt;/span&gt;&#xA;And so &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; would be the unitary we are looking for, so now the proof:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\langle\psi_1|\psi_2\rangle=\langle\psi_1|\psi_2\rangle\langle\rho|\rho\rangle =(\langle\psi_1|\otimes\langle\rho|)C^\dagger C(|\psi_2\rangle\otimes|\rho\rangle) = (\langle\psi_1|\otimes\langle\psi_1|)(|\psi_2\rangle\otimes|\psi_2\rangle)=(\langle\psi_1|\psi_2\rangle)^2.&#xA;\end{equation}&lt;/span&gt;&#xA;And so the same contradiction as before is obtained, and the theorem is proved.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2018-12-13T16:36:52.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4917" PostTypeId="1" AcceptedAnswerId="4918" CreationDate="2018-12-13T19:15:20.820" Score="2" ViewCount="477" Body="&lt;p&gt;I'm trying to build the matrix that corresponds to this quantum teleportation circuit, but it never works when I test it in the &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk simulator&lt;/a&gt;, I tried finding the matrix corresponding to every part of the circuit and then multiplying but it never works, anyone knows what I might be doing wrong?&#xA;When I was calculating the matrices I didn't consider the measurement gates.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/AYfEA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AYfEA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="26" LastEditDate="2018-12-23T07:55:29.407" LastActivityDate="2019-11-15T16:31:47.467" Title="Building a matrix corresponding to the teleportation circuit" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;teleportation&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4918" PostTypeId="2" ParentId="4917" CreationDate="2018-12-13T19:35:48.293" Score="4" Body="&lt;p&gt;Since the quantum teleportation circuit has three qbits, the matrix at each step is 8x8 and thus has 64 elements; this is pretty clunky to type out in its entirety, so I'll just walk you through step by step and you can derive the full matrix for a specific step if you want. Given a qbit we want to teleport:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the operations are as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_2C_{2,1}C_{1,0}H_1&#xA;\left ( &#xA;\begin{bmatrix} \alpha \\ \beta \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0\end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0\end{bmatrix}&#xA;\right ) = H_2C_{2,1}C_{1,0}&#xA;\left ( &#xA;\begin{bmatrix} \alpha \\ \beta \end{bmatrix} \otimes \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0\end{bmatrix}&#xA;\right ) = H_2C_{2,1} \left (\begin{bmatrix} \alpha \\ \beta \end{bmatrix} \otimes \begin{bmatrix} \frac{1}{\sqrt{2}} \\ 0 \\ 0 \\ \frac{1}{\sqrt{2}} \end{bmatrix} \right ) = H_2 \left ( \frac{1}{\sqrt{2}} \begin{bmatrix} \alpha \\ 0 \\ 0 \\ \alpha \\ 0 \\ \beta \\ \beta \\ 0 \end{bmatrix} \right ) = \frac{1}{2} \begin{bmatrix} \alpha \\ \beta \\ \beta \\ \alpha \\ \alpha \\ -\beta \\ -\beta \\ \alpha \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the vector directly before the first two qbits are measured. Note we can write it as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \begin{bmatrix} \alpha \\ \beta \\ \beta \\ \alpha \\ \alpha \\ -\beta \\ -\beta \\ \alpha \end{bmatrix}&#xA;= \frac{1}{2} \left ( |00\rangle \otimes \begin{bmatrix} \alpha \\ \beta \end{bmatrix}&#xA;+ |01\rangle \otimes \begin{bmatrix} \beta \\ \alpha \end{bmatrix}&#xA;+ |10\rangle \otimes \begin{bmatrix} \alpha \\ -\beta \end{bmatrix}&#xA;+ |11\rangle \otimes \begin{bmatrix} -\beta \\ \alpha \end{bmatrix} \right )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then apply the intuitive &quot;cancel and normalize&quot; approach to measurement for each of the four possible measurement outcomes, which I outline in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4133/4153&quot;&gt;this&lt;/a&gt; answer. It should then become clear how applying the final &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates (depending on measurement outcomes) will lead to the rightmost qbit taking on the value of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you'd like a more advanced account of how measurement works in quantum teleportation, you can also see an approach using the density operator which I go over &lt;a href=&quot;https://physics.stackexchange.com/a/426519/182854&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-11-15T16:31:47.467" LastActivityDate="2019-11-15T16:31:47.467" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4920" PostTypeId="5" CreationDate="2018-12-13T20:31:13.617" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:31:13.617" LastActivityDate="2018-12-13T20:31:13.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4921" PostTypeId="4" CreationDate="2018-12-13T20:31:13.617" Score="0" Body="The Deutsch–Jozsa algorithm is a quantum algorithm, proposed by David Deutsch and Richard Jozsa in 1992. Although of little practical use, it is one of the first examples of a quantum algorithm that is exponentially faster than any possible deterministic classical algorithm. It is also a deterministic algorithm, meaning that it always produces an answer, and that answer is always correct. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:31:13.617" LastActivityDate="2018-12-13T20:31:13.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4922" PostTypeId="5" CreationDate="2018-12-13T20:33:57.337" Score="0" Body="&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2107&quot;&gt;https://quantumcomputing.stackexchange.com/a/2107&lt;/a&gt; (by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/409/james-wootton&quot;&gt;@JamesWootton&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The surfaces codes are a family of quantum error correcting codes defined on a 2D lattice of qubits. Each code within this family has stabilizers that are defined equivalently in the bulk, but they differ in their boundary conditions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The members of the surface code family are sometimes also described by more specific names: The &lt;a href=&quot;https://en.wikipedia.org/wiki/Topic_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;toric code&lt;/a&gt; is a surface code with periodic boundary conditions, the planar code is one defined on a plane, etc. The term ‘surface code’ is sometimes also used interchangeably with ‘planar code’, since this is the most realistic example of the surface code family.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The surface codes are currently a large research area, so I’ll just point you towards some good entry points (in addition to the Wikipedia article linked to above).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0110143&quot; rel=&quot;nofollow noreferrer&quot;&gt;Topological quantum memory (paper)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;nofollow noreferrer&quot;&gt;Surface codes: Towards practical large-scale quantum computation (paper)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://decodoku.blogspot.ch/2016/02/5-story-so-far_57.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;My blog series introducing surface codes&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The surface codes can also be generalized to qudits. For more on that, see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9707021&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:33:57.337" LastActivityDate="2018-12-13T20:33:57.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4923" PostTypeId="4" CreationDate="2018-12-13T20:33:57.337" Score="0" Body="The surfaces codes are a family of quantum error correcting codes defined on a 2D lattice of qubits. Each code within this family has stabilizers that are defined equivalently in the bulk, but they differ in their boundary conditions. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:33:57.337" LastActivityDate="2018-12-13T20:33:57.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4924" PostTypeId="5" CreationDate="2018-12-13T20:36:14.307" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:36:14.307" LastActivityDate="2018-12-13T20:36:14.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4925" PostTypeId="4" CreationDate="2018-12-13T20:36:14.307" Score="0" Body="A tensor network is simply a countable collection of tensors connected by contractions.  ‘Tensor network methods’ is the term given to the entire collection of associated&#xD;&#xA;tools,  which  are  regularly  employed  in  modern  quantum  information  science,  condensed&#xD;&#xA;matter physics, mathematics and computer science. (arXiv:1708.00006)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:48:51.747" LastActivityDate="2019-01-01T09:48:51.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4926" PostTypeId="5" CreationDate="2018-12-13T20:37:25.857" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:37:25.857" LastActivityDate="2018-12-13T20:37:25.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4927" PostTypeId="4" CreationDate="2018-12-13T20:37:25.857" Score="0" Body="Quantum cloning is a process that takes an arbitrary, unknown quantum state and makes an exact copy without altering the original state in any way. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T20:37:25.857" LastActivityDate="2018-12-13T20:37:25.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4928" PostTypeId="5" CreationDate="2018-12-13T21:34:29.893" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:34:29.893" LastActivityDate="2018-12-13T21:34:29.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4929" PostTypeId="4" CreationDate="2018-12-13T21:34:29.893" Score="0" Body="Quantum teleportation is a process by which quantum information (e.g. the exact state of an atom or photon) can be transmitted (exactly, in principle) from one location to another, with the help of classical communication and previously shared quantum entanglement between the sending and receiving location. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:34:29.893" LastActivityDate="2018-12-13T21:34:29.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4930" PostTypeId="5" CreationDate="2018-12-13T21:45:42.613" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:45:42.613" LastActivityDate="2018-12-13T21:45:42.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4931" PostTypeId="4" CreationDate="2018-12-13T21:45:42.613" Score="0" Body="A k-local Hamiltonian is a Hamiltonian which can be written as the sum of Hamiltonians, each of which act non-trivially on at most k qubits (instead of all n qubits). (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:45:42.613" LastActivityDate="2018-12-13T21:45:42.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4932" PostTypeId="5" CreationDate="2018-12-13T21:47:34.370" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:47:34.370" LastActivityDate="2018-12-13T21:47:34.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4933" PostTypeId="4" CreationDate="2018-12-13T21:47:34.370" Score="0" Body="In physics, the no-cloning theorem states that it is impossible to create an identical copy of an arbitrary unknown quantum state. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:47:34.370" LastActivityDate="2018-12-13T21:47:34.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4934" PostTypeId="5" CreationDate="2018-12-13T21:51:03.770" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:51:03.770" LastActivityDate="2018-12-13T21:51:03.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4935" PostTypeId="4" CreationDate="2018-12-13T21:51:03.770" Score="0" Body="In information theory, the conditional entropy (or equivocation) quantifies the amount of information needed to describe the outcome of a random variable Y given that the value of another random variable X is known. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:51:03.770" LastActivityDate="2018-12-13T21:51:03.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4936" PostTypeId="5" CreationDate="2018-12-13T21:51:40.770" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:51:40.770" LastActivityDate="2018-12-13T21:51:40.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4937" PostTypeId="4" CreationDate="2018-12-13T21:51:40.770" Score="0" Body="In quantum statistical mechanics, the von Neumann entropy, named after John von Neumann, is the extension of classical Gibbs entropy concepts to the field of quantum mechanics. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:51:40.770" LastActivityDate="2018-12-13T21:51:40.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4938" PostTypeId="5" CreationDate="2018-12-13T21:54:11.743" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:54:11.743" LastActivityDate="2018-12-13T21:54:11.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4939" PostTypeId="4" CreationDate="2018-12-13T21:54:11.743" Score="0" Body="Roughly speaking, quantum volume measures the worth of quantum computing hardware by the square of the maximum depth of quantum computations it permits but limits its value to the square of the qubits involved. This limit is justified by wanting to forestall &quot;gaming&quot; of the system by optimizing towards few qubits. (https://quantumcomputing.stackexchange.com/q/3985)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T10:33:48.580" LastActivityDate="2019-01-01T10:33:48.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4940" PostTypeId="5" CreationDate="2018-12-13T21:56:26.220" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:56:26.220" LastActivityDate="2018-12-13T21:56:26.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4941" PostTypeId="4" CreationDate="2018-12-13T21:56:26.220" Score="0" Body="Games employing quantum mechanical phenomena such as superposition and entanglement. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:56:26.220" LastActivityDate="2018-12-13T21:56:26.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4942" PostTypeId="5" CreationDate="2018-12-13T21:57:52.833" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:57:52.833" LastActivityDate="2018-12-13T21:57:52.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4943" PostTypeId="4" CreationDate="2018-12-13T21:57:52.833" Score="0" Body="A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:57:52.833" LastActivityDate="2018-12-13T21:57:52.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4944" PostTypeId="5" CreationDate="2018-12-13T21:58:47.557" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:58:47.557" LastActivityDate="2018-12-13T21:58:47.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4945" PostTypeId="4" CreationDate="2018-12-13T21:58:47.557" Score="0" Body="A mixed state is a statistical ensemble of pure quantum states. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T21:58:47.557" LastActivityDate="2018-12-13T21:58:47.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4946" PostTypeId="5" CreationDate="2018-12-13T22:01:19.757" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-13T22:01:19.757" LastActivityDate="2018-12-13T22:01:19.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4947" PostTypeId="4" CreationDate="2018-12-13T22:01:19.757" Score="0" Body="For questions related to the Clifford also known as the Pauli group, as relevant to quantum computing." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-14T06:07:11.007" LastActivityDate="2018-12-14T06:07:11.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4949" PostTypeId="5" CreationDate="2018-12-14T05:54:46.187" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-14T05:54:46.187" LastActivityDate="2018-12-14T05:54:46.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4950" PostTypeId="4" CreationDate="2018-12-14T05:54:46.187" Score="0" Body="For questions about the various kinds of entropies ---  as defined in the context of quantum information theory and quantum statistical mechanics. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:38:53.403" LastActivityDate="2019-01-01T09:38:53.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4951" PostTypeId="5" CreationDate="2018-12-14T06:05:25.653" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-14T06:05:25.653" LastActivityDate="2018-12-14T06:05:25.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4952" PostTypeId="4" CreationDate="2018-12-14T06:05:25.653" Score="0" Body="For questions regarding quantum computation by state injection." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-14T06:05:25.653" LastActivityDate="2018-12-14T06:05:25.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4953" PostTypeId="5" CreationDate="2018-12-14T06:17:56.480" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-14T06:17:56.480" LastActivityDate="2018-12-14T06:17:56.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4954" PostTypeId="4" CreationDate="2018-12-14T06:17:56.480" Score="0" Body="Use this tag for questions related to CPT symmetry, as relevant to quantum computing or quantum information theory. Charge, parity, and time reversal symmetry is a fundamental symmetry of physical laws under the simultaneous transformations of charge conjugation (C), parity transformation (P), and time reversal (T). CPT is the only combination of C, P, and T that is observed to be an exact symmetry of nature at the fundamental level (Wikipedia)." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-14T06:17:56.480" LastActivityDate="2018-12-14T06:17:56.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4955" PostTypeId="1" AcceptedAnswerId="4956" CreationDate="2018-12-14T07:13:26.217" Score="2" ViewCount="86" Body="&lt;p&gt;I have a three composite system of the form &lt;span class=&quot;math-container&quot;&gt;$H_{\text{tot}}=H_{ab}\otimes H_c$&lt;/span&gt; where the system &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is behaving as the dissipator or the environment (I can model it as a thermal bath). And it is coupled only to system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; but not &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. While &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is coupled with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and entangles with it under time evolution. At &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt; is can take a composite state completely separable &lt;span class=&quot;math-container&quot;&gt;$H_{\text{tot}}(0)=H_a\otimes H_b \otimes H_c$&lt;/span&gt;. &#xA;My objective is to solve the &lt;strong&gt;Master equation&lt;/strong&gt; (more precisely the &lt;em&gt;Lindbladian&lt;/em&gt; form) for &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}.$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I do that (with the partition as &lt;span class=&quot;math-container&quot;&gt;$H_{ab}|H_c$&lt;/span&gt;), the sub-system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; trivially disappears from the equations of motion. Because it does not couple with &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; directly but only acts via &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; indirectly.&#xA;What is the right way to model this kind of interaction? &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2018-12-14T07:14:52.310" LastActivityDate="2018-12-14T08:11:52.497" Title="How to formulate the master equation for three systems?" Tags="&lt;quantum-information&gt;&lt;open-quantum-systems&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4956" PostTypeId="2" ParentId="4955" CreationDate="2018-12-14T08:11:52.497" Score="3" Body="&lt;p&gt;To be clear:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You have a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes\mathcal{H}_B\otimes\mathcal{H}_C$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The initial state is &lt;span class=&quot;math-container&quot;&gt;$\rho_\text{tot}(0)=\rho_A\otimes\rho_B\otimes\rho_C$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;There is a Hamiltonian acting on the system of the form &lt;span class=&quot;math-container&quot;&gt;$H_{\text{tot}}=H_{AB}\otimes\mathbb{I}_C+\mathbb{I}_A\otimes H_{BC}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Instead of directly calculating the effect of the Hamiltonian evolution &lt;span class=&quot;math-container&quot;&gt;$\rho_{\text{tot}}(t)=e^{-iH_{\text{tot}}}\rho_{\text{tot}}(0)e^{iH_{\text{tot}}}$&lt;/span&gt;, you want to solve a Master equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{d\rho_{AB}}{dt}=-i[H_{AB},\rho_{AB}]+\sum_nL_n\rho_{AB}L_n^\dagger-\frac12L_n^\dagger L_n\rho_{AB}-\frac12\rho_{AB}L_n^\dagger L_n&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is this a correct summary of what you're wanting to do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, then note that the presence of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_{AB}$&lt;/span&gt; means that the systems A and B should couple together.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-14T08:11:52.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4957" PostTypeId="1" AcceptedAnswerId="4959" CreationDate="2018-12-14T10:46:14.827" Score="1" ViewCount="635" Body="&lt;p&gt;Once a state is measured, but we don't look at the result, is the state now written as a density matrix, that is, the probability that it could land on a measurement operator multiplied by the operator applied on the state, this summed up for every measurement operator that it could land on contained in the measurement?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2020-05-28T10:46:54.813" LastActivityDate="2020-05-28T10:46:54.813" Title="How to write a post-measurement state, if we don't know the measurement result?" Tags="&lt;measurement&gt;&lt;density-matrix&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4958" PostTypeId="2" ParentId="4957" CreationDate="2018-12-14T10:54:01.050" Score="1" Body="&lt;p&gt;In the Copenhagen interpretation, there are only two kinds of &lt;em&gt;things&lt;/em&gt; that one can do, one is &lt;strong&gt;evolution&lt;/strong&gt; and other is the &lt;strong&gt;measurement&lt;/strong&gt;. Measuring but &lt;em&gt;not looking&lt;/em&gt; is equivalent to measuring the system and hence projecting it to one of the possible eigenstates. (Or maybe you can clarify more what you meant by &lt;em&gt;not looking&lt;/em&gt;?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And after the system is probed in the measurement, it is no longer in a superposition and no longer in the statistical mixture anymore. It just becomes a decohered density matrix with a single element in the measurement (projector) basis. Density matrix representation then becomes trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I think in the latter part of your question you are pointing the completeness of probability in the measurement which summed over all the measurement projectors will be unity. But this has to do with the act of measurement, once that is performed, there is only one deterministic state.)&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-12-14T10:54:01.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4959" PostTypeId="2" ParentId="4957" CreationDate="2018-12-14T11:58:58.350" Score="4" Body="&lt;p&gt;Suppose you have a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and a random process that changes this to a state &lt;span class=&quot;math-container&quot;&gt;$\rho_j$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_j$&lt;/span&gt;. If you know what the value of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is, your knowledge of the resulting state will be described by the corresponding &lt;span class=&quot;math-container&quot;&gt;$\rho_j$&lt;/span&gt;. If you have no information regarding &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, your knowledge will be described by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_j ~ p_j ~ \rho_j$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a general statement that holds for any random process. For the case you describe, which is measurement, the possible outcomes can often be described by a set of projectors &lt;span class=&quot;math-container&quot;&gt;$\{P_j\}$&lt;/span&gt;. For these&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ p_j = {\rm tr}~(~P_j~\rho~), ~~~ \rho_j = \frac{P_j \rho P_j}{p_j}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probabilities for more general measurements can be calculated by more general operators, but figuring out the post-measurement states for these is not always as easy. &lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2018-12-14T12:02:40.137" LastActivityDate="2018-12-14T12:02:40.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4960" PostTypeId="1" AcceptedAnswerId="4961" CreationDate="2018-12-14T12:21:31.490" Score="4" ViewCount="202" Body="&lt;p&gt;I've been struggling to understand the modular exponent bit of Shor's algorithm. My understanding is that it takes &#xA;a register in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{Q}}\sum_{k=1}^{Q-1} |k\rangle |0\rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{Q}\sum_{k=1}^{Q-1} |k\rangle |f(k)\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$f(k) = x^{k}$&lt;/span&gt; mod &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. &#xA;(Here, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the random integer found at the start of Shor's algorithm.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: &lt;strong&gt;Why is this operation unitary?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5328" LastEditorUserId="26" LastEditDate="2018-12-14T13:04:53.430" LastActivityDate="2018-12-19T19:28:30.177" Title="Understanding why the modular function part of Shor's algorithm is unitary" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4961" PostTypeId="2" ParentId="4960" CreationDate="2018-12-14T13:05:47.707" Score="3" Body="&lt;p&gt;The critical thing, in this case, about a unitary operator is that it maps orthogonal states to orthogonal states (if &lt;span class=&quot;math-container&quot;&gt;$\langle i|j\rangle=0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\langle i|U^\dagger U|j\rangle=0$&lt;/span&gt;, so the transformed vectors &lt;span class=&quot;math-container&quot;&gt;$U|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|j\rangle$&lt;/span&gt; are orthogonal). Now, you've defined what it must do for a set of states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|k\rangle|0\rangle\mapsto |k\rangle|f(k)\rangle.&#xA;$$&lt;/span&gt;&#xA;Now, it should be clear that all of the outputs are orthogonal to all other ones, simply as a result of the different values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. So, surely, it will be possible to define a unitary over all possible basis states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the one of the usual starting points is to define the action of the unitary as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|k\rangle|y\rangle\mapsto \left\{\begin{array}{cc}&#xA;|k\rangle|y+x^k\text{ mod }N\rangle &amp;amp; y&amp;lt;N \\&#xA;|k\rangle|y\rangle &amp;amp; y\geq N&#xA;\end{array}\right.&#xA;$$&lt;/span&gt;&#xA;(a second is to use &lt;span class=&quot;math-container&quot;&gt;$|k\rangle|yx^k\text{ mod }N\rangle$&lt;/span&gt; on the top line).&#xA;If we look at all possible &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, then we're looking at the whole basis. Again, different &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;s clearly give orthogonal vectors, independent of the value of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. Primarily, we have to check that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle y+x^k\text{ mod }N|y'+x^k\text{ mod}N\rangle=0.&#xA;$$&lt;/span&gt;&#xA;This must be true provided &lt;span class=&quot;math-container&quot;&gt;$y-y'\text{ mod }N\neq0$&lt;/span&gt;, which is true for cases &lt;span class=&quot;math-container&quot;&gt;$y,y'&amp;lt;N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y\neq y'$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="2879" LastEditDate="2018-12-19T19:28:30.177" LastActivityDate="2018-12-19T19:28:30.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4962" PostTypeId="1" AcceptedAnswerId="4969" CreationDate="2018-12-14T20:14:03.147" Score="3" ViewCount="767" Body="&lt;p&gt;I'm using this simple code to test my Qiskit and learn how to use it but it keeps giving this problems, how do I fix it (Using VS Code and Anaconda Python 3.7)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit import execute&#xA;# Create a Quantum Register with 3 qubits.Basicaly creating the number of qubits your system will use&#xA;q = QuantumRegister(3, 'q')&#xA;# Create a Quantum Circuit acting on the q register. Declaring the Circuit, this circuit shall create a GHZ state&#xA;circ = QuantumCircuit(q,)&#xA;# Add a H gate on qubit 0, putting this qubit in superposition.&#xA;circ.h(q[0])&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting&#xA;# the qubits in a Bell state.&#xA;circ.cx(q[0], q[1])&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 2, putting&#xA;# the qubits in a GHZ state.&#xA;circ.cx(q[0], q[2])&#xA;#Draws the circuit&#xA;from qiskit.tools.visualization import circuit_drawer&#xA;circuit_drawer(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/riOVh.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/riOVh.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="26" LastEditDate="2018-12-15T04:58:09.657" LastActivityDate="2018-12-15T10:59:52.800" Title="How to fix? 'E1101:Instance of 'QuantumCircuit' has no 'h' member' and 'E1101:Instance of 'QuantumCircuit' has no 'cx' member'" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4963" PostTypeId="1" AcceptedAnswerId="4970" CreationDate="2018-12-14T21:24:01.637" Score="4" ViewCount="377" Body="&lt;p&gt;In the general form of Grover's algorithm, we start with the uniform superposition of &lt;code&gt;n&lt;/code&gt; qubits. Now, suppose instead that we start with a generic state, for example the &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;W state&lt;/a&gt;, and the oracle only inverts the phase of one of the basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it more concrete, let's say we have in input a &lt;span class=&quot;math-container&quot;&gt;$W_3$&lt;/span&gt; state &lt;span class=&quot;math-container&quot;&gt;$$|W\rangle = \frac{1}{\sqrt{3}} (|001\rangle + |010\rangle + |100\rangle)$$&lt;/span&gt;&#xA;and that the oracle inverts only state &lt;span class=&quot;math-container&quot;&gt;$$|001\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, how can we implement the diffusion operator? In other words, how can we amplify only this state in order to obtain the right output with an high probability?&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="26" LastEditDate="2018-12-15T04:49:45.573" LastActivityDate="2018-12-15T16:07:47.440" Title="Grover's algorithm with W-state" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4965" PostTypeId="2" ParentId="4963" CreationDate="2018-12-15T02:16:09.713" Score="2" Body="&lt;p&gt;Say &lt;span class=&quot;math-container&quot;&gt;$ | \psi \rangle $&lt;/span&gt; represents the uniform suposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the Grover diffusion operator is written :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 2 | \psi \rangle \langle \psi | - I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to act on a subset of a superposition, you would need to implement :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 2 | W\rangle \langle W | - I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure if someone had really looked into how decompose this operation as a circuit. I guess it would be too dependent on the initial state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807053&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; however shows a trick to still get the state you want with a high probability. Check section 3.3.1 .&#xA;The idea is to start with &lt;span class=&quot;math-container&quot;&gt;$ | W \rangle $&lt;/span&gt; and use a first Grover iteration to inverse amplitudes about average by only marking the target state. Then you would mark the computational basis states that are present initially in &lt;span class=&quot;math-container&quot;&gt;$ | \psi \rangle $&lt;/span&gt; and use inversion about average again. Finally, you would continue with usual Grover iterations. They provide an example to help you visualize the effect of the steps. The target should have a high probability of being measured, even if others states not present in &lt;span class=&quot;math-container&quot;&gt;$ | W \rangle $&lt;/span&gt; can be measured.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-12-15T02:16:09.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4966" PostTypeId="2" ParentId="4962" CreationDate="2018-12-15T02:30:45.407" Score="0" Body="&lt;p&gt;I guess you are following the code from the notebook &lt;code&gt;getting_started_with_qiskit_terra&lt;/code&gt;.&#xA;However it should be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(q) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;instead of &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(q,)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;according to this notebook.&#xA;Can you try removing the coma and running?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2018-12-15T04:55:00.887" LastActivityDate="2018-12-15T04:55:00.887" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4967" PostTypeId="1" CreationDate="2018-12-15T04:04:42.660" Score="2" ViewCount="241" Body="&lt;p&gt;I would like to see the compiled circuit as executed on a hardware.&#xA;Nominally, this sequence of commands should return the QASM circuit in the variable &lt;code&gt;ran_qc&lt;/code&gt;, but it is a Null pointer. Does anyone know how to make it work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was notified via &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/1114&quot; rel=&quot;nofollow noreferrer&quot;&gt;this ticket&lt;/a&gt; that it should be fixed, but I do not see any improvement on my end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using  qiskit.&lt;strong&gt;version&lt;/strong&gt;'0.6.1'&#xA;and connected to IBMQX4.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;jobRes=job.result()&#xA;print('ran_qc get_names()=',jobRes.get_names())&#xA;assert len( jobRes.get_names()) ==1&#xA;circuit_name = jobRes.get_names()[0]&#xA;print('ran_qc name=',circuit_name)&#xA;ran_qc=jobRes.get_ran_qasm(circuit_name)&#xA;print(ran_qc)&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="5334" LastEditorUserId="26" LastEditDate="2018-12-15T04:56:56.850" LastActivityDate="2018-12-16T05:43:43.740" Title="Print circuit compiled on hardware?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4969" PostTypeId="2" ParentId="4962" CreationDate="2018-12-15T10:59:52.800" Score="4" Body="&lt;p&gt;There are no errors in your program.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pylint is a static code analysis tool and sometimes it gets confused and emits false positives. In this case, gate methods (&lt;code&gt;h&lt;/code&gt;, &lt;code&gt;cx&lt;/code&gt; and others) are added to &lt;code&gt;QuantumCircuit&lt;/code&gt; dynamically at a later point, so Pylint cannot detect them. See &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/extensions/standard&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;qiskit.extensions.standard&lt;/code&gt;&lt;/a&gt; if you'd like to learn how this works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simplest “fix” for this “error” is making Pylint ignore those classes in your &lt;a href=&quot;https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;pylintrc&lt;/code&gt;&lt;/a&gt; (if your installation of Pylint comes pre-built into your IDE, you'll have to see if the IDE has some particular way of configuring Pylint).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[TYPECHECK]&#xA;&#xA;# List of class names for which member attributes should not be checked (useful&#xA;# for classes with dynamically set attributes). This supports the use of&#xA;# qualified names.&#xA;ignored-classes=QuantumCircuit,CompositeGate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="580" LastActivityDate="2018-12-15T10:59:52.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4970" PostTypeId="2" ParentId="4963" CreationDate="2018-12-15T14:04:05.277" Score="3" Body="&lt;p&gt;Okay I think I have a potential solution, but I don't know if it's plausible or theoretically correct.&lt;/p&gt;&#xA;&lt;h2&gt;Standard Grover's algorithm&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Chance3%22%5D%2C%5B%22Sample3%22%5D%2C%5B%22Z%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22Z%22%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Chance3%22%5D%2C%5B%22Sample3%22%5D%2C%5B%22Z%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22Z%22%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Chance3%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is an example of the original Grover's algorithm with just three qubits; the oracle negates the phase of &lt;span class=&quot;math-container&quot;&gt;$$|011\rangle$$&lt;/span&gt; I'll post the image also:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gx9nq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gx9nq.png&quot; alt=&quot;Grover, selecting 011&quot; /&gt;&lt;/a&gt;&#xA;At the various steps you can see the probabilities and the amplitudes. In particular, after the oracle, you can see that there is precisely one state whose phase is negated, the &lt;code&gt;011&lt;/code&gt; one. Then the oracle rotates all the qubits around the superposition, by amplifying the &lt;code&gt;000&lt;/code&gt; state.&#xA;After one repetition of Grover's algorithm we have a 78% chance of reading the right state, which grows to 94.5% after two repetition.&lt;/p&gt;&#xA;&lt;h2&gt;Grover with W3 and standard diffusion&lt;/h2&gt;&#xA;&lt;p&gt;The trick should be to rotate around one of the basis states, say the first one i.e. &lt;span class=&quot;math-container&quot;&gt;$$|001\rangle$$&lt;/span&gt; &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7Euaoq%22%5D,%5B%22Z%22,%22%E2%97%A6%22,%22%E2%97%A6%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22H%22,%22H%22,%22H%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22H%22,%22H%22,%22H%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22Chance3%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E1b3%22,%22name%22:%22G(1/3)%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,-%E2%88%9A%E2%85%93%7D,%7B%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22%7Eaiht%22,%22name%22:%222:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,%E2%88%9A%E2%85%93%7D,%7B-%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22%7E8pun%22,%22name%22:%222:1i%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,-%E2%88%9A%E2%85%93%7D,%7B%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22%7E9738%22,%22name%22:%221:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D,%7B-%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7Eika7%22,%22name%22:%221:1i%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,-%E2%88%9A%C2%BD%7D,%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7E3m4f%22,%22name%22:%22X-%22,%22matrix%22:%22%7B%7B0,1%7D,%7B-1,0%7D%7D%22%7D,%7B%22id%22:%22%7Eek0i%22,%22name%22:%22X-i%22,%22matrix%22:%22%7B%7B0,-1%7D,%7B1,0%7D%7D%22%7D,%7B%22id%22:%22%7Euaoq%22,%22name%22:%22W3%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%7Eaiht%22%5D,%5B%22%E2%97%A6%22,%22%7E9738%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E3m4f%22%5D%5D%7D%7D,%7B%22id%22:%22%7Efeve%22,%22name%22:%22W3i%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7Eek0i%22%5D,%5B%22%E2%97%A6%22,%22%7Eika7%22%5D,%5B%22%7E8pun%22%5D%5D%7D%7D,%7B%22id%22:%22%7En9lm%22,%22name%22:%22Oracle%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22%5D%5D%7D%7D,%7B%22id%22:%22%7E4ig5%22,%22name%22:%22Diffusion%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D,%5B%22X%22,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22%5D,%5B%22X%22,%22X%22%5D,%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7E6t4c%22,%22name%22:%22Oracle100%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ebjin%22,%22name%22:%22Ora010%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22Z%22,%22%E2%97%A6%22%5D%5D%7D%7D,%7B%22id%22:%22%7Elotq%22,%22name%22:%22Ora001%22,%22circuit%22:%7B%22cols%22:%5B%5B%22Z%22,%22%E2%97%A6%22,%22%E2%97%A6%22%5D%5D%7D%7D,%7B%22id%22:%22%7Epqg5%22,%22name%22:%22Ora100%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22%5D%5D%7D%7D,%7B%22id%22:%22%7E6n0r%22,%22name%22:%22Rep2_100%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%7Epqg5%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22H%22,%22H%22,%22H%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22X%22,%22X%22,%22X%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22X%22,%22X%22,%22X%22%5D,%5B%22Amps3%22%5D,%5B%5D,%5B%22H%22,%22H%22,%22H%22%5D,%5B%22Amps3%22%5D%5D%7D%7D,%7B%22id%22:%22%7E496c%22,%22name%22:%22Rep2_100%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%7Epqg5%22%5D,%5B%22H%22,%22H%22,%22H%22%5D,%5B%22X%22,%22X%22,%22X%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22X%22,%22X%22,%22X%22%5D,%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7Eq0bq%22,%22name%22:%22Diff1%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D,%5B%22X%22,%22X%22,%22X%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22X%22,%22X%22,%22X%22%5D,%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is the circuit representing it:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aNHqq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aNHqq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because we only have 3 overall possible states, a single iteration should suffice. The above circuits correctly select the state &lt;span class=&quot;math-container&quot;&gt;$$|001\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Grover with W5 state and standard diffusion&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7Eb7jm%22%5D,%5B%22Amps5%22%5D,%5B%5D,%5B%5D,%5B%22%E2%97%A6%22,%22Z%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22%5D,%5B%22Amps5%22%5D,%5B%5D,%5B%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Amps5%22%5D,%5B%5D,%5B%5D,%5B%22Chance5%22%5D,%5B%22%E2%97%A6%22,%22Z%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Chance5%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E2fgd%22,%22name%22:%224:2%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D,%7B-%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7Eo1l5%22,%22name%22:%224:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%98,%E2%88%9A%E2%85%95%7D,%7B-%E2%88%9A%E2%85%95,%E2%88%9A%E2%85%98%7D%7D%22%7D,%7B%22id%22:%22%7E647n%22,%22name%22:%223:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BE,%C2%BD%7D,%7B-%C2%BD,%E2%88%9A%C2%BE%7D%7D%22%7D,%7B%22id%22:%22%7E2j21%22,%22name%22:%222:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,%E2%88%9A%E2%85%93%7D,%7B-%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22%7E9erl%22,%22name%22:%22X-%22,%22matrix%22:%22%7B%7B0,1%7D,%7B-1,0%7D%7D%22%7D,%7B%22id%22:%22%7E9rlf%22,%22name%22:%221:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D,%7B-%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7Eb7jm%22,%22name%22:%22W5%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%7Eo1l5%22%5D,%5B%22%E2%97%A6%22,%22%7E647n%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E2j21%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E9rlf%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E9erl%22%5D%5D%7D%7D,%7B%22id%22:%22%7En9sl%22,%22name%22:%22Ora10000%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22%5D%5D%7D%7D,%7B%22id%22:%22%7E4pj4%22,%22name%22:%22Diff%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is another example with a W5 state selecting &lt;span class=&quot;math-container&quot;&gt;$$|00010\rangle$$&lt;/span&gt; while rotating around &lt;span class=&quot;math-container&quot;&gt;$$|00001\rangle$$&lt;/span&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TRYsJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TRYsJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As we can see, in both cases the standard diffusion selects the right amplitude with a not so huge probability&lt;/p&gt;&#xA;&lt;h2&gt;Grover with W4 and W4 conjugate transpose&lt;/h2&gt;&#xA;&lt;p&gt;A much better algorithm is the one described by &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7E2gbk%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22,%22%E2%97%A6%22%5D,%5B%22Amps4%22%5D,%5B%5D,%5B%5D,%5B%5D,%5B%22%7Ej78r%22%5D,%5B%22X%22,%22X%22,%22X%22,%22X%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22X%22,%22X%22,%22X%22,%22X%22%5D,%5B%22%7E2gbk%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E2fgd%22,%22name%22:%224:2%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D,%7B-%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7Eo1l5%22,%22name%22:%224:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%98,%E2%88%9A%E2%85%95%7D,%7B-%E2%88%9A%E2%85%95,%E2%88%9A%E2%85%98%7D%7D%22%7D,%7B%22id%22:%22%7E647n%22,%22name%22:%223:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BE,%C2%BD%7D,%7B-%C2%BD,%E2%88%9A%C2%BE%7D%7D%22%7D,%7B%22id%22:%22%7E2j21%22,%22name%22:%222:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,%E2%88%9A%E2%85%93%7D,%7B-%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22%7E9erl%22,%22name%22:%22X-%22,%22matrix%22:%22%7B%7B0,1%7D,%7B-1,0%7D%7D%22%7D,%7B%22id%22:%22%7E9rlf%22,%22name%22:%221:1%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D,%7B-%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7Eb7jm%22,%22name%22:%22W5%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%7Eo1l5%22%5D,%5B%22%E2%97%A6%22,%22%7E647n%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E2j21%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E9rlf%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E9erl%22%5D%5D%7D%7D,%7B%22id%22:%22%7En9sl%22,%22name%22:%22Ora10000%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22Z%22%5D%5D%7D%7D,%7B%22id%22:%22%7E4pj4%22,%22name%22:%22Diff%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7E2gbk%22,%22name%22:%22W4%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%7E647n%22%5D,%5B%22%E2%97%A6%22,%22%7E2j21%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E9rlf%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E9erl%22%5D%5D%7D%7D,%7B%22id%22:%22%7Eh32m%22,%22name%22:%22X-i%22,%22matrix%22:%22%7B%7B0,-1%7D,%7B1,0%7D%7D%22%7D,%7B%22id%22:%22%7E6rog%22,%22name%22:%221:1i%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BD,-%E2%88%9A%C2%BD%7D,%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BD%7D%7D%22%7D,%7B%22id%22:%22%7Eq2t8%22,%22name%22:%222:1i%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,-%E2%88%9A%E2%85%93%7D,%7B%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22%7E5ctp%22,%22name%22:%223:1i%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BE,-%C2%BD%7D,%7B%C2%BD,%E2%88%9A%C2%BE%7D%7D%22%7D,%7B%22id%22:%22%7Ej78r%22,%22name%22:%22W4i%22,%22circuit%22:%7B%22cols%22:%5B%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7Eh32m%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%7E6rog%22%5D,%5B%22%E2%97%A6%22,%22%7Eq2t8%22%5D,%5B%22%7E5ctp%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this circuit&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UYV6H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UYV6H.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The idea is pretty similar to the original Grover algorithm. Basically, you apply the conjugate transpose of the &lt;code&gt;W4&lt;/code&gt; state (and in the general case, the conjugate transpose of whatever you have applied to obtain the initial state of the Grover's algorithm). In this way, you have a non zero probability of obtaining the all zero state, which in this case is &lt;span class=&quot;math-container&quot;&gt;$$|0000\rangle$$&lt;/span&gt;. Then, you invert about this state and reapply the &lt;code&gt;W4&lt;/code&gt; state.&#xA;In this case, because we starts with 4 possible answers, the Grover's algorithm works 100% of the time.&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2018-12-15T16:07:47.440" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4971" PostTypeId="2" ParentId="4907" CreationDate="2018-12-15T17:32:29.473" Score="2" Body="&lt;p&gt;If you keep measuring to the same bit, the value should get overridden every time. So you won't receive the intermediary values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the following will output a single &lt;code&gt;1&lt;/code&gt; from the second measurement, with no trace of the first.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit&#xA;from qiskit import execute&#xA;from qiskit import BasicAer&#xA;&#xA;q = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;qc = QuantumCircuit(q,c)&#xA;&#xA;qc.measure(q,c)&#xA;qc.x(q)&#xA;qc.measure(q,c)&#xA;&#xA;job = execute(qc,backend=BasicAer.get_backend('qasm_simulator'))&#xA;job.result().get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess what you want is something more like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(n) # n qubits&#xA;a = QuantumRegister(1) # one ancilla qubit&#xA;c = ClassicalRegister(n) # n classical bits for output&#xA;&#xA;qc = QuantumCircuit(q,a,c)&#xA;&#xA;qc.x(a[0]) &#xA;qc.measure(a[0],c[0]) # measure the ancilla to one of the classical bits&#xA;&#xA;qc.measure(q,c) # measure the n qubits to the n bits (overwriting the output from the previous measurement&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-12-15T18:22:56.650" LastActivityDate="2018-12-15T18:22:56.650" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4972" PostTypeId="2" ParentId="4967" CreationDate="2018-12-15T17:41:58.383" Score="2" Body="&lt;p&gt;You need to extract the compiled qasm from a qobj object. You can create this by compiling&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import compile&#xA;qobj = compile(qc,backend,shots=shots)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to create a batch job, where you send many circuits in at once, you can replace the single circuit &lt;code&gt;qc&lt;/code&gt; with a list of circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Information about the circuits, the backend on which they'll run, and how they've been compiled, can then be found by querying the qobj.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps the best was is to use &lt;code&gt;qobj.as_dict()&lt;/code&gt;, which returns a dictionary containing the information. In Qiskit 0.7.0 (which will be the stable version as of end of Dec 2018), you can get the information you want using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qobj.as_dict()['experiments'][index]['header']['compiled_circuit_qasm']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Actually running the job defined by the qobj can be done with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = backend.run(qobj)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-12-15T17:41:58.383" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4974" PostTypeId="1" AcceptedAnswerId="4986" CreationDate="2018-12-16T16:09:26.130" Score="3" ViewCount="412" Body="&lt;p&gt;I'm studying teleportation circuits with &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/community/terra/qis_intro/teleportation_superdensecoding.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt; and just out of curiosity, why can't a teleportation circuit be run on an IBM Q device?&lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="26" LastEditDate="2019-03-12T09:16:52.973" LastActivityDate="2019-03-12T09:16:52.973" Title="Why can't you run a teleportation circuit on an IBM Q device?" Tags="&lt;ibm-q-experience&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4975" PostTypeId="1" AcceptedAnswerId="5012" CreationDate="2018-12-16T17:13:17.150" Score="18" ViewCount="5894" Body="&lt;p&gt;I'm creating a gate for a project and need to test if it has the same results as the original circuit in a simulator, how do I build this gate on Qiskit? It's a 3 qubit gate, 8x8 matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; -1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; -1&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="26" LastEditDate="2019-03-12T09:16:38.247" LastActivityDate="2021-03-03T04:03:27.093" Title="How do I build a gate from a matrix on Qiskit?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="6" CommentCount="4" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="4976" PostTypeId="1" AcceptedAnswerId="4983" CreationDate="2018-12-16T18:55:11.153" Score="5" ViewCount="202" Body="&lt;p&gt;For a one qubit system, take a basis.&#xA;Call this the mixture basis.&#xA;Consider only basis states and classical mixtures of these basis states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Definition of Shannon Entropy used here: Defined with respect to the measurement basis, on the probabilities of various outcomes.&#xA;For eg: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}|0\rangle \langle0| + \frac{1}{2}|+\rangle \langle+|$&lt;/span&gt;, &lt;strong&gt;when measured in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt; basis&lt;/strong&gt; has Shannon Entropy &lt;span class=&quot;math-container&quot;&gt;$-\frac{3}{4}\log(\frac{3}{4}) - \frac{1}{4}\log(\frac{1}{4})$&lt;/span&gt; because there is &lt;span class=&quot;math-container&quot;&gt;$\frac{3}{4}$&lt;/span&gt; chance of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt; chance of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to prove that the least value of Shannon Entropy will occur when the measurement basis is equal to the mixture basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is for me to get an intuition of Von Neumann entropy. If I prove the above, then I can think of Von Neumann entropy as the least Shannon entropy I could get after measuring across any basis.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the mixture basis be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(I + n.\sigma)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(I - n.\sigma)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the measurement basis be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(I + m.\sigma)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(I - m.\sigma)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the qubit be &lt;span class=&quot;math-container&quot;&gt;$$p\frac{1}{2}(I + n.\sigma) + (1-p)\frac{1}{2}(I - n.\sigma)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probability of the qubit showing up as &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(I + m.\sigma)$&lt;/span&gt; when measured is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(\frac{1}{2}(1 + m.n)) + (1-p)(\frac{1}{2}(1-m.n))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the above value be &lt;span class=&quot;math-container&quot;&gt;$p^{'}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the Shannon Entropy will be &lt;span class=&quot;math-container&quot;&gt;$p^{'}log(p^{'}) + (1-p^{'})log(1-p^{'})$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to minimize the entropy, I need to minimise or maximise &lt;span class=&quot;math-container&quot;&gt;$p^{'}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to do that though, and whether what I'm trying to do so far makes sense. I'll be grateful for any help on continuing the proof/ insight on the intuition I'm trying to build.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="10480" LastEditDate="2021-03-20T23:26:43.083" LastActivityDate="2021-03-20T23:26:43.083" Title="Shannon entropy is least when Measurement basis = Mixture basis" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4977" PostTypeId="1" AcceptedAnswerId="5102" CreationDate="2018-12-16T19:00:02.033" Score="3" ViewCount="340" Body="&lt;p&gt;Inspired by the question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/12/2645&quot;&gt;Are there emulators for quantum computers?&lt;/a&gt;, I'm curious to know if it's possible to emulate a quantum network on a classic computer. Additionally, &lt;strong&gt;is it possible to emulate a quantum network over a classic network&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Current resources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/SoftwareQuTech/SimulaQron&quot; rel=&quot;nofollow noreferrer&quot;&gt;SimulaQron&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/att-innovate/squanch&quot; rel=&quot;nofollow noreferrer&quot;&gt;Squanch&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.mcl.hu/~balazsf/quantum/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QDNS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-16T22:29:17.763" LastActivityDate="2020-11-14T13:51:21.447" Title="Are there emulators for quantum networks?" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;quantum-networks&gt;&lt;emulation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4978" PostTypeId="1" AcceptedAnswerId="4980" CreationDate="2018-12-16T20:35:45.460" Score="4" ViewCount="1519" Body="&lt;p&gt;In Nielsen and Chuang (page:379), it is shown that the operator sum representation of a depolarizing channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho) = \frac{pI}{2} + (1-p)\rho$&lt;/span&gt; is easily seen by substituting the identity matrix with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\mathbb{I}}{2} = \frac{\rho + X\rho X + Y\rho Y +Z\rho Z}{4}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What is the more systematic way to see this result? Particularly, for the higher dimensional analogue, I cannot see how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-07-16T00:53:00.040" LastActivityDate="2020-07-16T00:53:00.040" Title="How to find the operator sum representation of the depolarizing channel?" Tags="&lt;nielsen-and-chuang&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4979" PostTypeId="2" ParentId="4977" CreationDate="2018-12-16T21:07:58.657" Score="2" Body="&lt;p&gt;I joined the &lt;a href=&quot;https://labs.ripe.net/Members/becha/join-the-quantum-internet-hackathon-2018&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum internet Hackaton with Simulaqron&lt;/a&gt; We did simulations for the quantum leader election algorithms &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulaqron is more an abstract simulator on a classical computer or classical network. Most important aspect is entanglement between 2 nodes. This can be done with only command called EPR and creates an entangled pair of qubits on different nodes, nice and easy setup for your quantum network. Keep in mind though that it is not an real entangled pair but only a classical local copy.&lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2018-12-16T21:07:58.657" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4980" PostTypeId="2" ParentId="4978" CreationDate="2018-12-16T21:45:05.207" Score="7" Body="&lt;p&gt;This really depends where you want to start from.  For instance, you can construct the Choi state of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;, i.e.,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma = (\mathcal E \otimes \mathbb I)(|\Omega\rangle\langle\Omega|)\ ,&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\Omega = \tfrac{1}{\sqrt{D}}\sum_{i=1}^D |i,i\rangle$&lt;/span&gt;, and then extract the Kraus operators of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)=\sum M_i\rho M_i^\dagger$&lt;/span&gt; by taking &lt;em&gt;any&lt;/em&gt; decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma = \sum |\psi_i\rangle\langle\psi_i|\ ,\tag{*}&#xA;$$&lt;/span&gt;&#xA;and writing &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle = (M_i\otimes\mathbb I)|\Omega\rangle$&lt;/span&gt; (which is always possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the decomposition &lt;span class=&quot;math-container&quot;&gt;$(*)$&lt;/span&gt; is highly non-unique (any &lt;span class=&quot;math-container&quot;&gt;$|\phi_j\rangle = \sum V_{ij} |\psi_i\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; an isometry, is also a valid decomposition), which relates to the fact that the Kraus decomposition is equally non-unique.  Obviously, the eigenvalue decomposition is a simple choice (which, moreover, minimizes the number of Kraus operators).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's look at your example in a bit more detail. Here, &lt;span class=&quot;math-container&quot;&gt;$D=2$&lt;/span&gt;. You have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal E(X)=p\mathrm{tr}(X)\,\frac{\mathbb I}{2}+(1-p)X&#xA;$$&lt;/span&gt;&#xA;for any &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (due to linearity) -- the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(X)$&lt;/span&gt; is required to make this trace-preserving for general &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now have that &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sigma &amp;amp;= (\mathcal E \otimes \mathbb I)(|\Omega\rangle\langle \Omega|)&#xA;\\&#xA;&amp;amp; = \tfrac1D \sum_{ij} \mathcal E(|i\rangle\langle j|)\otimes  |i\rangle\langle j|\ &#xA;\end{align}&lt;/span&gt;&#xA;inserting the definition of &lt;span class=&quot;math-container&quot;&gt;$|\Omega\rangle$&lt;/span&gt; and using linearity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This yields&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma = \frac{p}{2D}\mathbb I\otimes \sum_{i}|i\rangle\langle i| +&#xA;(1-p)\frac1D \sum_{ij}|i\rangle\langle j|\otimes |i\rangle\langle j|\ .&#xA;$$&lt;/span&gt;&#xA;The second term is just &lt;span class=&quot;math-container&quot;&gt;$(1-p)|\Omega\rangle\langle\Omega|$&lt;/span&gt;, and the first term is&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{p}{2D}\mathbb I\otimes\mathbb I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now see that one possible eigenvalue decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is given by the four Bell states (I leave it to you to work out the weights), and it is well known and easy to check that that the four Bell states can be written as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\sigma_k\otimes \mathbb I)|\Omega\rangle\ ,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; are the three Pauli matrices or the identity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, you get that the &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; in the Kraus representation are the Paulis and the identity, with the weight given by the eigenvalue decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2018-12-17T00:16:58.423" LastActivityDate="2018-12-17T00:16:58.423" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4981" PostTypeId="1" AcceptedAnswerId="4982" CreationDate="2018-12-17T06:28:36.610" Score="5" ViewCount="264" Body="&lt;p&gt;In the Quantum Operations section in Nielsen and Chuang, (page 358 in the 2002 edition), they have the following equation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E(\rho) = \mathrm{Tr}_{env} [U(\rho \otimes \rho_{env})U^\dagger]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;They show an example with&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho_{env} = |0\rangle \langle0|$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$U = \mathrm{CNOT}$&lt;/span&gt;, and claim that the final solution is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_0\rho P_0 + P_1\rho P_1,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P_0=|0\rangle \langle0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1=|1\rangle \langle 1|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;These are my steps so far to get this, but I don't know how to trace out the environment after this:&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \langle \psi |$&lt;/span&gt;,&#xA;so that &lt;span class=&quot;math-container&quot;&gt;$\rho \otimes \rho_{env} = |\psi, 0\rangle \langle \psi, 0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Applying the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |00 \rangle \langle 00| \psi, 0 \rangle \langle \psi, 0 | 00 \rangle \langle 00 |&#xA; + |00 \rangle \langle 00| \psi 0 \rangle \langle \psi 0 | 10 \rangle \langle 11 | \\&#xA; + |11 \rangle \langle 10| \psi 0 \rangle \langle \psi 0 | 00 \rangle \langle 00 |&#xA; +  |11 \rangle \langle 10| \psi 0 \rangle \langle \psi 0 | 10 \rangle \langle 11 |.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't know how to trace out the environment in the above state.&lt;/p&gt;&#xA;&lt;p&gt;Also, I realize that I have considered only a pure state, if anyone can show it for a general state that would be great.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-02-19T18:38:42.817" LastActivityDate="2021-02-19T19:02:28.310" Title="How does $\mathcal E(\rho)=\mathrm{Tr}_{env}[U(\rho\otimes\rho_{env})U^\dagger]$ turn into $P_0\rho P_0+P_1\rho P_1$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;partial-trace&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4982" PostTypeId="2" ParentId="4981" CreationDate="2018-12-17T08:03:51.837" Score="4" Body="&lt;p&gt;Let's start with a general state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\otimes\rho_0=\sum_{x,y\in\{0,1\}}\langle x|\rho|y\rangle|x\rangle\langle y|\otimes |0\rangle\langle 0|.&#xA;$$&lt;/span&gt;&#xA;If we apply the controlled-not, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rightarrow\rho_{\text{final}}=\sum_{x,y\in\{0,1\}}\langle x|\rho|y\rangle|x\rangle\langle y|\otimes |x\rangle\langle y|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we want to take the partial trace over the second subsystem. This means calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_k(\mathbb{I}\otimes\langle k|)\rho_{\text{final}}(\mathbb{I}\otimes|k\rangle)=\sum_k\sum_{x,y\in\{0,1\}}\langle x|\rho|y\rangle|x\rangle\langle y|\times \langle k|x\rangle\langle y|k\rangle.&#xA;$$&lt;/span&gt;&#xA;If we perform the sums over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, we find that &lt;span class=&quot;math-container&quot;&gt;$x=y=k$&lt;/span&gt;, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\sum_k\langle k|\rho|k\rangle|k\rangle\langle k|,&#xA;$$&lt;/span&gt;&#xA;which is entirely equivalent to removing all the off-diagonal elements of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-17T08:03:51.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4983" PostTypeId="2" ParentId="4976" CreationDate="2018-12-17T08:13:30.010" Score="2" Body="&lt;p&gt;Let's write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p'=\frac12+m\cdot n\frac{2p-1}{2},&#xA;$$&lt;/span&gt;&#xA;and assume without loss of generality that &lt;span class=&quot;math-container&quot;&gt;$p&amp;gt;\frac12$&lt;/span&gt;, which also means that &lt;span class=&quot;math-container&quot;&gt;$p'&amp;gt;\frac12$&lt;/span&gt;. Note the binary entropy function &lt;span class=&quot;math-container&quot;&gt;$h(p')$&lt;/span&gt; is symmetric about &lt;span class=&quot;math-container&quot;&gt;$p'=\frac12$&lt;/span&gt;, and is monotonically decreasing for &lt;span class=&quot;math-container&quot;&gt;$p'&amp;gt;\frac12$&lt;/span&gt;, meaning that we want to make &lt;span class=&quot;math-container&quot;&gt;$p'$&lt;/span&gt; as large as possible in order to minimise &lt;span class=&quot;math-container&quot;&gt;$h(p')$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is fixed, the only way to increase &lt;span class=&quot;math-container&quot;&gt;$p'$&lt;/span&gt; is to make &lt;span class=&quot;math-container&quot;&gt;$m\cdot n$&lt;/span&gt; as large as possible. This happens with &lt;span class=&quot;math-container&quot;&gt;$m=n$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$m\cdot n=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p'=p$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-17T08:13:30.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4985" PostTypeId="1" CreationDate="2018-12-17T10:28:42.483" Score="1" ViewCount="78" Body="&lt;p&gt;The question is similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4904/multiple-random-coin-flips/4905?noredirect=1&quot;&gt;this one&lt;/a&gt;. As suggested in the answer, I can easily do this with just one qubit: I repeatedly Hadamard it and measure in order to have a fair coin flip at every point. The problem with it is that, because of the measurements, the computation is not reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, again, suppose that in my circuit I have to generate multiple, say &lt;code&gt;n&lt;/code&gt;, random coin flips. For example, this coin flips could be used to activate n CNOTs half of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trivial solution could be to use n different qubits and Hadamard them. However, this gets really huge when &lt;code&gt;n&lt;/code&gt; is large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any better way? By better I mean using a smaller number of qubits and only a few simple quantum gates.&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="26" LastEditDate="2018-12-23T07:54:16.657" LastActivityDate="2018-12-23T07:54:16.657" Title="Multiple random coin flips without measurements" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4986" PostTypeId="2" ParentId="4974" CreationDate="2018-12-17T12:05:29.400" Score="3" Body="&lt;p&gt;I asked someone from IBM and got this answer:&#xA;Teleportation can not be run on the IBM Q devices at the moment as no operations can be performed after a measurement.&lt;/p&gt;&#xA;" OwnerUserId="5065" LastActivityDate="2018-12-17T12:05:29.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4987" PostTypeId="2" ParentId="4976" CreationDate="2018-12-17T16:50:29.853" Score="4" Body="&lt;p&gt;My favourite way of proving that the Shannon entropy is minimized for a measurement in the qubit basis is through the notion of majorizaion (see Nielsen and Chuang or the book on Matrix Analyis by Bhatia for a formal definition). Specifically &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(1-p)$&lt;/span&gt; is related to &lt;span class=&quot;math-container&quot;&gt;$p'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(1-p')$&lt;/span&gt; with the following relation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left(\begin{array}{c}&#xA;p'\\&#xA;1-p'&#xA;\end{array}\right)=D&#xA;\left(\begin{array}{c}&#xA;p\\&#xA;1-p&#xA;\end{array}\right)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;D=&#xA;\left(&#xA;\begin{array}{c}&#xA;\frac{1}{2}(1+m\cdot n)&amp;amp;\frac{1}{2}(1-m\cdot n)\\&#xA;\frac{1}{2}(1-m\cdot n)&amp;amp;\frac{1}{2}(1+m\cdot n)&#xA;\end{array}&#xA;\right)&#xA;\end{equation}&lt;/span&gt;&#xA;is a bistochastic matrix, meaning it's elements are probabilities and the sum of it's columns and arrays is equal to one. We then say that the probability distribution defined be the left hand side of the first equation (call it &lt;span class=&quot;math-container&quot;&gt;$\vec{p}'$&lt;/span&gt;) is majorized by that on the right hand side (call it &lt;span class=&quot;math-container&quot;&gt;$\vec{p}$&lt;/span&gt;) and we write symbolically that &lt;span class=&quot;math-container&quot;&gt;$\vec{p}'\prec\vec{p}$&lt;/span&gt;. Inuitively this means that &lt;span class=&quot;math-container&quot;&gt;$\vec{p}'$&lt;/span&gt; is more &quot;random&quot; than &lt;span class=&quot;math-container&quot;&gt;$\vec{p}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for any Schur concave function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(\vec{p}')\geq f(\vec{p})\quad \mbox{when}\quad \vec{p}'\prec\vec{p}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Shannon entropy is such a Schur concave function and the proof is now complete.&lt;/p&gt;&#xA;" OwnerUserId="5238" LastActivityDate="2018-12-17T16:50:29.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4988" PostTypeId="2" ParentId="4985" CreationDate="2018-12-17T21:21:28.543" Score="2" Body="&lt;p&gt;You say it's a problem that when using measurements your circuit is not reversible, but generating a truly random number is an inherently non-reversible operation. Consider that for an operation to be reversible, you must be able to uniquely determine the input given the output. If the output of your operation is truly random, then it is by necessity unrelated to the input and thus not reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could possibly implement a classical deterministic pseudo-random number generator in a reversible way on a quantum computer and use that instead, but that sounds like a tremendous inconvenience unless you have a very good reason for requiring reversibility. At that point why not just generate the random numbers classically and give them as input to the quantum circuit?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2018-12-17T21:21:28.543" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4989" PostTypeId="1" AcceptedAnswerId="4993" CreationDate="2018-12-17T22:40:46.343" Score="8" ViewCount="391" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4216/2645&quot;&gt;an answer&lt;/a&gt; to a previous question, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4183/2645&quot;&gt;Generalization for n quantum teleportations&lt;/a&gt;, Craig Gidney states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The more complicated way to generalize teleportation is figuring out how to make it work on qutrits and qudits instead of only qubits. Basically, instead of using a &quot;basis&quot; made up of tensor products of X and Z matrices, you need to switch to a basis based on &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Construction:_The_clock_and_shift_matrices&quot; rel=&quot;noreferrer&quot;&gt;clock and shift matrices&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can quantum teleportation be generalized for qudits?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="55" LastEditDate="2021-03-05T09:02:27.567" LastActivityDate="2021-03-05T09:02:27.567" Title="Generalizing quantum teleportation for qudits" Tags="&lt;teleportation&gt;&lt;qudit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="4990" PostTypeId="1" CreationDate="2018-12-17T23:44:23.927" Score="2" ViewCount="190" Body="&lt;p&gt;In the process of research leading up to my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4989/2645&quot;&gt;previous question&lt;/a&gt;, I found out about &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_clock&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_clock&quot; rel=&quot;nofollow noreferrer&quot;&gt;vector&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://en.wikipedia.org/wiki/Logical_clock&quot; rel=&quot;nofollow noreferrer&quot;&gt;logical&lt;/a&gt; clocks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The citation in the aforementioned question mentions &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Construction:_The_clock_and_shift_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;clock and shift matrices&lt;/a&gt;. Wikipedia states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;These two matrices are also the cornerstone of quantum mechanical dynamics in finite-dimensional vector spaces as formulated by Hermann Weyl, and find routine applications in numerous areas of mathematical physics. The clock matrix amounts to the exponential of position in a &quot;clock&quot; of d hours, and the shift matrix is just the translation operator in that cyclic vector space, so the exponential of the momentum. They are (finite-dimensional) representations of the corresponding elements of the Weyl-Heisenberg on a d-dimensional Hilbert space.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am curious to find out&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if there is any usage of matrix, vector or logical clocks in quantum computing &lt;/li&gt;&#xA;&lt;li&gt;how clock matrices and matrix clocks compare &amp;amp; contrast&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-26T16:25:49.520" LastActivityDate="2018-12-26T16:25:49.520" Title="Clock matrix vs matrix clock" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;tensor-product&gt;&lt;tensor-networks&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4991" PostTypeId="1" CreationDate="2018-12-18T01:42:10.423" Score="4" ViewCount="146" Body="&lt;p&gt;I am trying to wrap my head around the correlation between &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4183/2645&quot;&gt;repeating&lt;/a&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4127/2645&quot;&gt;teleportation&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2352/2645&quot;&gt;XOR linked lists&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&quot;the quantum equivalent of the one time pad (i.e. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4125/2645&quot;&gt;XORing&lt;/a&gt; a message with a secret key) is quantum teleportation&quot; (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4125/quantum-xor-cipher-construction#comment4566_4125&quot;&gt;source&lt;/a&gt;) &lt;/li&gt;&#xA;&lt;li&gt;&quot;the simplest way to generalize teleportation is to just repeat it&quot; (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4216/2645&quot;&gt;source&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is how repeating teleportation could lead to &quot;a data structure which is used to maintain a list of data items&quot; (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2573/2645&quot;&gt;this answer&lt;/a&gt; for more use cases for quantum XOR linked lists). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can help me to understand how these concepts connect, because I do &lt;em&gt;not&lt;/em&gt; understand teleportation well enough to see how it could be used to accomplish any of the use cases described in the answer to my XOR linked list question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also: &lt;a href=&quot;https://arxiv.org/abs/1110.2998&quot; rel=&quot;nofollow noreferrer&quot;&gt;Equivalent Quantum Circuits&lt;/a&gt; sections VII. A &amp;amp; B &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As example applications we study quantum teleportation and dense coding protocols in terms of a simple XOR swapping circuit and give an intuitive picture of a basic gate teleportation circuit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2018-12-24T17:38:36.273" LastActivityDate="2018-12-24T17:38:36.273" Title="What does teleportation have to do w/ XOR linked lists?" Tags="&lt;cryptography&gt;&lt;teleportation&gt;" AnswerCount="0" CommentCount="6" ClosedDate="2019-03-27T16:44:41.413" ContentLicense="CC BY-SA 4.0" />
  <row Id="4992" PostTypeId="1" AcceptedAnswerId="5033" CreationDate="2018-12-18T05:14:44.547" Score="4" ViewCount="54" Body="&lt;p&gt;Suppose I have a quantum algorithm that produces solutions where more than one different linear combination of qubit values with raised probability amplitudes is a correct result. Each linear combination is correct in the context of this hypothetical algorithm, but it is not the task of the algorithm to also iteratively elicit the solutions, but merely to produce a superposition where all possible solutions are represented within it. The problem isn't with the implementation of the supposed algorithm, but with the issue of potentially measuring a superposition that hasn't been fully honed to a single maximal linear combination, since in the ensemble of measurements you might obtain each of the different linear combinations, making the results unclear, despite the fact the algorithm implementation is potentially correct. The objective is therefore to have an abstract procedure to read off these possible answers in a clean manner, so that they aren't lost, but for which the superposition has been narrowed to a final value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose I have linear combinations &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, each which cannot be decomposed into simpler expressions with independent amplitudes, that have raised probability in that, for my quantum algorithm, these are correct. The others, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; have amplitudes near zero. For simplicity, it can be said that each the current superposition is described by: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|10\rangle + |11\rangle)$&lt;/span&gt;. Before reading each value off, I want to cancel the probability of all others aside from the ith term of the superposition. Therefore, first cancel out &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, so that I don't have a very high chance of reading &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; when the first measurement is done, so the superposition becomes simply &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. In every iteration of this procedure, I want the superposition narrowed to a single term, so that there is no confusion upon measurement. As with the example, after the first measurement, repeat, but with probability canceled from &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I want a mechanism to do this form me for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; possible admissible answers, so that it works in the more general case.&lt;/p&gt;&#xA;" OwnerUserId="5350" LastEditorUserId="26" LastEditDate="2018-12-22T11:50:27.263" LastActivityDate="2018-12-22T14:19:37.650" Title="Solution enumeration algorithm?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4993" PostTypeId="2" ParentId="4989" CreationDate="2018-12-18T07:56:09.987" Score="7" Body="&lt;p&gt;Let's define the shift and clock matrices (the generalisation of the Pauli X and Z matrices) as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X=\sum_{i=0}^{d-1}|i+1\text{ mod }d\rangle\langle i|\qquad Z=\sum_{i=0}^{d-1}\omega^i|i\rangle\langle i|&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2\pi \sqrt{-1}/d}$&lt;/span&gt;. Now we can define a maximally entangled orthonormal basis (the equivalent of the Bell basis):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_{ij}\rangle=(X^iZ^j\otimes\mathbb{I})\frac{1}{\sqrt{d}}\sum_{k=0}^{d-1}|k\rangle|k\rangle.&#xA;$$&lt;/span&gt;&#xA;(Reader exercise: verify that &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi_{ij}|\Psi_{kl}\rangle=\delta_{ik}\delta_{jl}$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The teleportation setup is basically the same as for qubits. Alice holds an unknown qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb{C}^d$&lt;/span&gt;, and Alice and Bob share the two-qudit state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{00}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice performs a measurement between her two qudits using the basis &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{ij}\rangle$&lt;/span&gt;, and gets an answer &lt;span class=&quot;math-container&quot;&gt;$(ij)$&lt;/span&gt;. Let's assume that the answer is &lt;span class=&quot;math-container&quot;&gt;$(00)$&lt;/span&gt;. In this case, Bob receives the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;d^2\text{Tr}_A\left(|\Psi_{00}\rangle\langle\Psi_{00}|_A\otimes\mathbb{I}_B\cdot|\psi\rangle\langle\psi|\otimes|\Psi_{00}\rangle\langle\Psi_{00}|\right)=|\psi\rangle\langle\psi|,&#xA;$$&lt;/span&gt;&#xA;i.e. the state is perfectly teleported. What happens for the other measurement results? We need to calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;d^2\text{Tr}_A\left(\left(X^iZ^j\otimes\mathbb{I}|\Psi_{00}\rangle\langle\Psi_{00}|Z^{-j}X^{-i}\otimes\mathbb{I}\right)_A\otimes\mathbb{I}_B\cdot|\psi\rangle\langle\psi|\otimes|\Psi_{00}\rangle\langle\Psi_{00}|\right)&#xA;$$&lt;/span&gt;&#xA;But this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;d^2\text{Tr}_A\left(|\Psi_{00}\rangle\langle\Psi_{00}|_A\otimes\mathbb{I}_B\cdot\left(Z^{-j}X^{-i}|\psi\rangle\langle\psi|X^iZ^j\right)\otimes|\Psi_{00}\rangle\langle\Psi_{00}|\right)&#xA;$$&lt;/span&gt;&#xA;so it's as if we're teleporting the state &lt;span class=&quot;math-container&quot;&gt;$Z^{-j}X^{-i}|\psi\rangle$&lt;/span&gt; and getting measurement result &lt;span class=&quot;math-container&quot;&gt;$(00)$&lt;/span&gt;. So, we know that Bob receives &lt;span class=&quot;math-container&quot;&gt;$Z^{-j}X^{-i}|\psi\rangle$&lt;/span&gt;, so when Alice sends Bob the 2-dit message of her measurement result &lt;span class=&quot;math-container&quot;&gt;$(ij)$&lt;/span&gt;, he can apply the correction &lt;span class=&quot;math-container&quot;&gt;$X^iZ^j$&lt;/span&gt;, and he's perfectly received &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, no matter what Alice's measurement result was.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-06-03T18:42:39.513" LastActivityDate="2019-06-03T18:42:39.513" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="4994" PostTypeId="1" CreationDate="2018-12-18T09:46:45.283" Score="2" ViewCount="594" Body="&lt;p&gt;After installing &lt;code&gt;qiskit-terra&lt;/code&gt; via git (&lt;code&gt;pip install qiskit&lt;/code&gt;), all python programs involving the line &lt;code&gt;from qiskit import BasicAer&lt;/code&gt; do not run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; from qiskit import *&#xA;&#xA; q = QuantumRegister(2)&#xA;&#xA; c = ClassicalRegister(2)&#xA;&#xA; qc = QuantumCircuit(q,c)&#xA;&#xA; qc.h(q[0])&#xA;&#xA;&amp;lt;qiskit.extensions.standard.h.HGate object at 0x7f6a146ee7f0&amp;gt;&#xA;&#xA; qc.cx(q[0],q[1])&#xA;&#xA;&amp;lt;qiskit.extensions.standard.cx.CnotGate object at 0x7f6a146ee940&amp;gt;&#xA;&#xA;qc.measure(q,c)&#xA;&#xA;&amp;lt;qiskit.circuit.instructionset.InstructionSet object at 0x7f6a146eea58&amp;gt;&#xA;&#xA; backend_sim = Aer.get_backend('qasm_smulator')&#xA;&#xA;Traceback (most recent call last):&#xA;  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;&#xA;NameError: name 'Aer' is not defined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5353" LastEditorUserId="5353" LastEditDate="2018-12-18T09:59:55.050" LastActivityDate="2018-12-18T12:54:42.787" Title="Module BasicAer not found" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="4995" PostTypeId="2" ParentId="1472" CreationDate="2018-12-18T09:56:16.687" Score="4" Body="&lt;p&gt;Actually, after having researched the question over the last months, the two answers (one above and one below) are correct, but we can build upon them to get something more up to date.&#xA;The first answer, however, relies on figures and data which are slightly obsolete, while the source is uncertain (it is impossible to know if the source is McKinsey or The Netherlands). We have updated these figures for a number of countries and also updated the way to understand the race and its funding as static figures do not at all reflect what is happening in the world.&#xA;So, for example, in terms of government funding, according to available non classified figures we would have China, leading followed by Germany then by the US.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EPlIS.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EPlIS.jpg&quot; alt=&quot;Screenshot from the video: Mapping the Race to Quantum - Video 4&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture above is just a screenshot (sorry for the definition). You can watch the dynamic mapping we came up with showing this state of play of the evolving race in the article - we recorded it as a short video to show evolution &lt;a href=&quot;https://www.redanalysis.org/2018/12/17/mapping-the-race-for-quantum-computing-quantum-ai-and-geopolitics-3/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mapping The Race for Quantum Computing - Quantum, AI and Geopolitics (3)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet, things are actually not that simple.&#xA;As underlined by JanVdA, indeed, as soon as one adds one of the giant IT companies, it becomes clear that they lead the race. We did the test with IBM and the amount of funding just completely dwarfs state funding in a quite impressive way (this is the fifth mapping in the article mentioned above).&#xA;We also foresee that all this is likely to be completely upset by the entry of Venture Capital notably through mega tech funds such as Vision Fund (belonging to Softbank, which is also the major shareholders of Ali Baba). The overall amount of the fund is 100 billion USD, for digital and new tech, not only quantum... yet this is an awfully huge amount of money available. Interestingly Saudi Arabia has invested 45 billion USD in this fund. Thus if we just play a rapid &quot;what if&quot; scenario and imagine that one third of Vision Fund is invested in Quantum Computing - i.e. 33 billion USD - this means that Saudi Arabia will have invested $14.85 bn in quantum tech... which puts it at the forefront of the race in terms of funding. True enough, there is a difference between yearly funding and venture capital investment for which we should also account. Nonetheless, when one knows that Softbank plans for a second Vision Fund, then investors within these funds become really serious player in the Race to Quantum Computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it is also truly important to understand that the race has quite numerous specificities that need to be considered if one want to truly assess who is at the top or not. Our work is work in progress considering the amount of research needed. So, stay put. Furthermore, it is not because a lab publishes a lots of scientific papers, or because an actor spends a huge amount of money that the still necessary breakthroughs to create and engineer a universal quantum computer will take place in that country and/or in this lab. Thus, we should consider that the race is still young, and that it is conducive to surprises. &lt;/p&gt;&#xA;" OwnerUserId="5352" LastActivityDate="2018-12-18T09:56:16.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="4996" PostTypeId="2" ParentId="4994" CreationDate="2018-12-18T10:49:46.703" Score="3" Body="&lt;p&gt;What was Aer in 0.6 is being renamed BasicAer in 0.7. The Aer name will then be used for a larger and fancier simulation package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the current stable version is 0.6.1, your pip install will have given you that version of Terra. So you can simply replace each instance of BasicAer with Aer for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to get 0.7 already, you can install with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/Qiskit/qiskit-terra.git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it should also be moved to stable very soon.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2018-12-18T12:54:42.787" LastActivityDate="2018-12-18T12:54:42.787" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="4998" PostTypeId="1" CreationDate="2018-12-18T14:06:11.163" Score="2" ViewCount="2575" Body="&lt;p&gt;The following message I got by running the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/examples/python/qft.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;qft.py code&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Traceback (most recent call last):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File &quot;qft.py&quot;, line 18, in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.ibmq import least_busy&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ModuleNotFoundError: No module named qiskit.providers&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This the code snippet (from the QISKit repository):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose that something was wrong with the installation process?)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# -*- coding: utf-8 -*-&#xA;&#xA;# Copyright 2017, IBM.&#xA;#&#xA;# This source code is licensed under the Apache License, Version 2.0 found in&#xA;# the LICENSE.txt file in the root directory of this source tree.&#xA;&#xA;&quot;&quot;&quot;&#xA;Quantum Fourier Transform examples.&#xA;Note: if you have only cloned the Qiskit repository but not&#xA;used `pip install`, the examples only work from the root directory.&#xA;&quot;&quot;&quot;&#xA;&#xA;import math&#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit import execute, BasicAer, IBMQ&#xA;from qiskit.providers.ibmq import least_busy&#xA;&#xA;&#xA;###############################################################&#xA;# make the qft&#xA;###############################################################&#xA;def input_state(circ, q, n):&#xA;    &quot;&quot;&quot;n-qubit input state for QFT that produces output 1.&quot;&quot;&quot;&#xA;    for j in range(n):&#xA;        circ.h(q[j])&#xA;        circ.u1(math.pi/float(2**(j)), q[j]).inverse()&#xA;&#xA;&#xA;def qft(circ, q, n):&#xA;    &quot;&quot;&quot;n-qubit QFT on q in circ.&quot;&quot;&quot;&#xA;    for j in range(n):&#xA;        for k in range(j):&#xA;            circ.cu1(math.pi/float(2**(j-k)), q[j], q[k])&#xA;        circ.h(q[j])&#xA;&#xA;&#xA;q = QuantumRegister(5, &quot;q&quot;)&#xA;c = ClassicalRegister(5, &quot;c&quot;)&#xA;qft3 = QuantumCircuit(q, c, name=&quot;qft3&quot;)&#xA;qft4 = QuantumCircuit(q, c, name=&quot;qft4&quot;)&#xA;qft5 = QuantumCircuit(q, c, name=&quot;qft5&quot;)&#xA;&#xA;input_state(qft3, q, 3)&#xA;qft3.barrier()&#xA;qft(qft3, q, 3)&#xA;qft3.barrier()&#xA;for j in range(3):&#xA;    qft3.measure(q[j], c[j])&#xA;&#xA;input_state(qft4, q, 4)&#xA;qft4.barrier()&#xA;qft(qft4, q, 4)&#xA;qft4.barrier()&#xA;for j in range(4):&#xA;    qft4.measure(q[j], c[j])&#xA;&#xA;input_state(qft5, q, 5)&#xA;qft5.barrier()&#xA;qft(qft5, q, 5)&#xA;qft5.barrier()&#xA;for j in range(5):&#xA;    qft5.measure(q[j], c[j])&#xA;&#xA;print(qft3)&#xA;print(qft4)&#xA;print(qft5)&#xA;&#xA;###############################################################&#xA;# Set up the API and execute the program.&#xA;###############################################################&#xA;try:&#xA;    IBMQ.load_accounts()&#xA;except:&#xA;    print(&quot;&quot;&quot;WARNING: There's no connection with the API for remote backends.&#xA;             Have you initialized a file with your personal token?&#xA;             For now, there's only access to local simulator backends...&quot;&quot;&quot;)&#xA;&#xA;print('Qasm simulator')&#xA;sim_backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute([qft3, qft4, qft5], sim_backend, shots=1024)&#xA;result = job.result()&#xA;print(result.get_counts(qft3))&#xA;print(result.get_counts(qft4))&#xA;print(result.get_counts(qft5))&#xA;&#xA;# Second version: real device&#xA;least_busy_device = least_busy(IBMQ.backends(simulator=False,&#xA;                                             filters=lambda x: x.configuration().n_qubits &amp;gt; 4))&#xA;print(&quot;Running on current least busy device: &quot;, least_busy_device)&#xA;job = execute([qft3, qft4, qft5], least_busy_device, shots=1024)&#xA;result = job.result()&#xA;print(result.get_counts(qft3))&#xA;print(result.get_counts(qft4))&#xA;print(result.get_counts(qft5))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5353" LastEditorUserId="26" LastEditDate="2018-12-18T14:31:19.860" LastActivityDate="2019-01-18T11:39:13.203" Title="ModuleNotFoundError: No module named qiskit.providers" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5000" PostTypeId="1" AcceptedAnswerId="5004" CreationDate="2018-12-18T14:46:39.070" Score="6" ViewCount="1011" Body="&lt;p&gt;How can you measure qubits in QuTiP? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I have seen you can define a Hamiltonian and let it evolve in time. It is also possible to define a quantum circuit, however, measuring and running it is not possible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple circuit could be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H q[0]&#xA;CNOT q[0],q[1]&#xA;Measure q[0], q[1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2018-12-18T14:49:54.053" LastActivityDate="2020-04-02T14:03:20.503" Title="Measuring qubits in QuTiP" Tags="&lt;programming&gt;&lt;measurement&gt;&lt;qutip&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5001" PostTypeId="2" ParentId="4975" CreationDate="2018-12-18T21:14:08.403" Score="4" Body="&lt;p&gt;Qubiter uses a CSD compiler for a &lt;a href=&quot;https://github.com/artiste-qb-net/qubiter/blob/master/jupyter-notebooks/quantum_CSD_compiler_intro.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unitary matrix to a sequence of elementary operations tranformation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One setback is that qubiter needs extra packages so installing could be troublesome. &lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2018-12-18T21:14:08.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5002" PostTypeId="2" ParentId="4975" CreationDate="2018-12-18T22:44:05.533" Score="8" Body="&lt;p&gt;Here's the circuit for your specific case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WzSH2.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WzSH2.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made it manually, by &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT3%22%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22%2B%3DA3%22%5D%2C%5B%22~39sb%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%22X%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22Z%22%2C%22%E2%80%A2%22%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22-%3DA3%22%5D%2C%5B%22QFT%E2%80%A03%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~39sb%22%2C%22matrix%22%3A%22%7B%7B%C2%BD%2C0%2C%C2%BD%2C0%2C0%2C%C2%BD%2C0%2C-%C2%BD%7D%2C%7B0%2C%C2%BD%2C0%2C%C2%BD%2C%C2%BD%2C0%2C-%C2%BD%2C0%7D%2C%7B0%2C%C2%BD%2C0%2C-%C2%BD%2C%C2%BD%2C0%2C%C2%BD%2C0%7D%2C%7B%C2%BD%2C0%2C-%C2%BD%2C0%2C0%2C%C2%BD%2C0%2C%C2%BD%7D%2C%7B%C2%BD%2C0%2C%C2%BD%2C0%2C0%2C-%C2%BD%2C0%2C%C2%BD%7D%2C%7B0%2C%C2%BD%2C0%2C%C2%BD%2C-%C2%BD%2C0%2C%C2%BD%2C0%7D%2C%7B0%2C%C2%BD%2C0%2C-%C2%BD%2C-%C2%BD%2C0%2C-%C2%BD%2C0%7D%2C%7B%C2%BD%2C0%2C-%C2%BD%2C0%2C0%2C-%C2%BD%2C0%2C-%C2%BD%7D%7D%22%7D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;entering the matrix into Quirk&lt;/a&gt;, diagonalizing the matrix by adding operations, then simplifying the operations. It's not too hard to do by hand when all the operations are Clifford as in this case.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-12-18T22:44:05.533" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5003" PostTypeId="2" ParentId="4975" CreationDate="2018-12-19T01:40:59.807" Score="3" Body="&lt;p&gt;You can't directly build a gate from arbitrary matrices because custom gates need to be implemented using the build-in gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to decompose your matrix to known gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a random two-qubit gate, there is &lt;a href=&quot;https://qiskit.org/documentation/autodoc/qiskit.mapper._compiling.html?highlight=two%20qubit%20kak#qiskit.mapper._compiling.two_qubit_kak&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;two_qubit_kak&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;two_qubit_kak (unitary_matrix, verify_gate_sequence=False)&lt;/code&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Decompose a two-qubit gate over CNOT + SU(2) using the KAK decomposition.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Based on MATLAB implementation by David Gosset.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Computes a sequence of 10 single and two qubit gates, including 3 CNOTs, which multiply to U, including global phase. Uses Vatan and Williams optimal two-qubit circuit (quant-ph/0308006v3). The decomposition algorithm which achieves this is explained well in Drury and Love, 0806.4015.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2214" LastEditorUserId="26" LastEditDate="2019-05-01T10:01:04.973" LastActivityDate="2019-05-01T10:01:04.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5004" PostTypeId="2" ParentId="5000" CreationDate="2018-12-19T04:23:48.310" Score="2" Body="&lt;p&gt;QuTiP is not really meant for this I think. As said on the home page : &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;QuTiP is open-source software for simulating the dynamics of open quantum systems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Simulating dynamics of open quantum systems by definition means you are interested in the quantum state as a result of your algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried looking at the Notebook examples provided in this &lt;a href=&quot;https://github.com/qutip/qutip-notebooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;Github&lt;/a&gt; but could not find measurement examples somewhere.&#xA;You have a possibility to get expectation values though (see this &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/docs/guide/StatesOperators.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;notebook&lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2018-12-19T04:33:15.977" LastActivityDate="2018-12-19T04:33:15.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5005" PostTypeId="1" AcceptedAnswerId="5008" CreationDate="2018-12-19T05:24:08.090" Score="7" ViewCount="854" Body="&lt;p&gt;I was recently watching a talk by Urmila Mahadev on &quot;Classical Verification of Quantum Computations&quot; (&lt;a href=&quot;https://www.youtube.com/watch?v=kql5dSywvy0&quot; rel=&quot;noreferrer&quot;&gt;see this&lt;/a&gt;). I am not new to quantum computation just have a familiarity with the qubit and some part of quantum mechanics. I even did not get the meaning of the simulation. I am guessing it means that given an encoding of a quantum device with input. The classical device will take this encoding and get the results. The only thing which I have understood is that there may be many states in which quantum device can go through on a particular input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;  Why it is hard to simulate a quantum device by a classical device?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that I am not sure what it means by &quot; hard &quot;. Is it time-wise or space-wise? The meaning of &quot; simulation &quot; is also not clear to me.&lt;/p&gt;&#xA;" OwnerUserId="5361" LastActivityDate="2018-12-19T10:21:53.910" Title="Why it is hard to simulate a quantum device by a classical devices?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5006" PostTypeId="1" AcceptedAnswerId="5024" CreationDate="2018-12-19T06:29:21.573" Score="7" ViewCount="566" Body="&lt;p&gt;I have read somewhere / heard that the set of all states that have non-negative conditional Von Neumann entropy forms a convex set. Is this true? Is there a proof for it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anything be said about the reverse - set of all states that have negative conditional Von Neumann entropy?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="10480" LastEditDate="2021-04-05T17:43:12.650" LastActivityDate="2021-04-05T17:43:12.650" Title="Is the set of all states with negative conditional Von Neumann entropy convex?" Tags="&lt;information-theory&gt;&lt;entropy&gt;&lt;state-space-geometry&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5007" PostTypeId="1" AcceptedAnswerId="6710" CreationDate="2018-12-19T07:08:21.060" Score="8" ViewCount="270" Body="&lt;p&gt;This is how I think about classical relative entropy: There is a variable that has distribution P, that is outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; has probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; of occuring, but someone mistakes it to be of a distribution Q instead, so when outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; occurs, instead of being &lt;span class=&quot;math-container&quot;&gt;$-log(p_i)$&lt;/span&gt; surprised, they are &lt;span class=&quot;math-container&quot;&gt;$-log(q_i)$&lt;/span&gt; surprised (or gain said amount of information).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now someone who knows both the distributions is calculating the relative Shannon entropy, so expectation value of their surprise is &lt;span class=&quot;math-container&quot;&gt;$-\Sigma p_i log(p_i)$&lt;/span&gt; and they know that the mistaken person's probability of being &lt;span class=&quot;math-container&quot;&gt;$log(q_i)$&lt;/span&gt; surprised is &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, so their the expectation value of surprise is &lt;span class=&quot;math-container&quot;&gt;$-\Sigma p_i log({q_i})$&lt;/span&gt; and the difference is &lt;span class=&quot;math-container&quot;&gt;$\Sigma p_i log(p_i) - \Sigma p_i log(q_i)$&lt;/span&gt; which is the classical relative entropy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given state, the Von Neumann entropy is the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4976/2832&quot;&gt;Shannon entropy minimised&lt;/a&gt; over all possible bases. Since in the measurement basis, the eigenvalues are the probabilities, and both eigenvalues and trace are basis invariant, we can write this as &lt;span class=&quot;math-container&quot;&gt;$\Sigma \lambda _i log(\lambda_i)$&lt;/span&gt; which is also equal to &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho log( \rho ))$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relative Von Neumann entropy is defined as follows: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Tr(\rho log(\rho)) - Tr(\rho log (\sigma))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first term is understandable, but by analogy to the classical relative entropy, assuming that person Q is measuring in the sigma basis, let's call it &lt;span class=&quot;math-container&quot;&gt;${\{| \sigma_i \rangle&#xA;\}}$&lt;/span&gt;, the second term should reduce to &lt;span class=&quot;math-container&quot;&gt;$p^{'}_1 log (q1) + p^{'}_2 log(q2) ... $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$p^{'}_i$&lt;/span&gt; is the actual probability of the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; landing on &lt;span class=&quot;math-container&quot;&gt;$| \sigma_i \rangle $&lt;/span&gt;. The log part is take care of, but I'm not sure how multiplying and tracing out will give this result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there's a better way to understand relative Von Neumann entropy, that's welcome too.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="10480" LastEditDate="2021-03-20T23:25:37.397" LastActivityDate="2021-03-20T23:25:37.397" Title="Building Intuition for Relative Von Neumann Entropy" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5008" PostTypeId="2" ParentId="5005" CreationDate="2018-12-19T08:54:35.603" Score="5" Body="&lt;p&gt;The first thing to understand is how quantum operations (i.e. quantum gates) and quantum states are mathematically represented:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Quantum operations on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are unitary matrices of size &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Quantum states on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are complex vectors of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you are not 100% sure of theses numbers, you can read more about it in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(Almost?) every book on quantum computing. For example, Nielsen &amp;amp; Chuang wrote about that in the very beginning of their book.&lt;/li&gt;&#xA;&lt;li&gt;These exponents in base &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; are due to the way states are composed with tensor product. You can read a little bit more about it &lt;a href=&quot;https://physics.stackexchange.com/questions/54896/should-it-be-obvious-that-independent-quantum-states-are-composed-by-taking-the&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Once you are convinced that the numbers I wrote above are valid, you have your answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Simulating a quantum device by a classical device is limited by the available RAM memory on the classical computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To elaborate a little more, think about how a classical computer would simulate a quantum one. One thing that the classical computer will definitely have to store is the current quantum state of the quantum machine it is simulating. As I wrote in the beginning of my answer, a quantum state is a vector of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex numbers. Now let's compute (in the following, byte == octet):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The size of a floating-point number is 4 or 8 octets (depending on the precision, i.e. &lt;code&gt;float&lt;/code&gt; or &lt;code&gt;double&lt;/code&gt;, and assuming a non-exotic classical computer).&lt;/li&gt;&#xA;&lt;li&gt;A complex number is represented by 2 floating-point numbers: one for the real-part and the second for the imaginary-part. So it needs 8 or 16 octets.&lt;/li&gt;&#xA;&lt;li&gt;The quantum state needs &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex numbers, i.e. &lt;span class=&quot;math-container&quot;&gt;$f_{\text{simple}}(n) = 2^{3+n}$&lt;/span&gt; octets if you use simple precision or &lt;span class=&quot;math-container&quot;&gt;$f_{\text{double}}(n) =2^{4+n}$&lt;/span&gt; octets if you use double precision.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Say you want to simulate a n-qubit quantum computer with your classical computer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 10$&lt;/span&gt; you will need at least &lt;span class=&quot;math-container&quot;&gt;$f_{\text{simple}}(10) = 2^{13} = 8192\, \text{o} = 8\, \text{kio}$&lt;/span&gt;. Every classical computer should be able to do this.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 20$&lt;/span&gt;  you will need at least &lt;span class=&quot;math-container&quot;&gt;$f_{\text{simple}}(20) = 2^{23} = 8388608\, \text{o} = 8\, \text{Mio}$&lt;/span&gt;. Every classical computer should be able to do this.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 30$&lt;/span&gt;  you will need at least &lt;span class=&quot;math-container&quot;&gt;$f_{\text{simple}}(30) = 2^{33} = 8589934592\, \text{o} = 8\, \text{Gio}$&lt;/span&gt;. A publicly-accessible laptop is capable of doing it, but old computer may not have a sufficient amount of RAM.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 40$&lt;/span&gt;  you will need at least &lt;span class=&quot;math-container&quot;&gt;$f_{\text{simple}}(40) = 2^{43} = 8796093022208\, \text{o} = 8\, \text{Tio}$&lt;/span&gt;. This is definitely out of reach for publicly-accessible things, you will need access to a computing server.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 50$&lt;/span&gt;  you will need at least &lt;span class=&quot;math-container&quot;&gt;$f_{\text{simple}}(50) = 2^{53} = 9007199254740992\, \text{o} = 8\, \text{Pio}$&lt;/span&gt;. Even &lt;a href=&quot;https://www.top500.org/system/179397&quot; rel=&quot;noreferrer&quot;&gt;Summit&lt;/a&gt;, the TOP 1 computer (in terms of FLOPS), cannot simulate this as it &quot;only&quot; has &lt;span class=&quot;math-container&quot;&gt;$2.8\, \text{Pio}$&lt;/span&gt; of RAM.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Of course some clever simulation algorithms are capable of using the specific structure of some quantum programs in order to reduce the needed amount of memory. But for a generic quantum program, this is the quantity of RAM you will need.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note that I did not speak about computing power. The cost in terms of floating-point operations is generally not a limitation because most of the quantum circuits are a succession of &lt;strong&gt;sparse&lt;/strong&gt; quantum operations (i.e. they are represented by a sparse matrix) and matrix-vector multiplication with a sparse matrix are quite cheap (depending on the sparseness of the matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, note that you may have a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit quantum program that contains &lt;span class=&quot;math-container&quot;&gt;$10^{30}$&lt;/span&gt; quantum gates. In this case, the simulation algorithm will be time-wise limited, not memory-wise.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2018-12-19T08:54:35.603" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5009" PostTypeId="2" ParentId="5005" CreationDate="2018-12-19T10:21:53.910" Score="3" Body="&lt;p&gt;The &lt;strong&gt;simulation of a quantum computation&lt;/strong&gt; (some people choose to use the term 'emulation' in this context to disambiguate from a different type of simulation) is when one tries to recreate the calculation that you want a quantum computer to perform, but on a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're simulating a particular algorithm, there are many different problem instances with problem sizes &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (this is usually the number of bits required to specify the problem instance). We say a problem is &lt;strong&gt;hard&lt;/strong&gt; if the time that it takes to run grows quicker than any polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it must be emphasised that we don't &lt;em&gt;know&lt;/em&gt; that simulating a quantum computer is hard. It's just that we don't know how to do it. And we've tried quite hard. For example, we believe that quantum computers can perform some classical computations that are hard at least as strongly as we believe that there's no efficient classical algorithm for factoring large composite integers (because there's a quantum algorithm that achieves that in polynomial time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we could prove that classical computers can simulate quantum computers, then there wouldn't be nearly so much interest in building a quantum computer. That said, simulation is a polynomial overhead equivalence. Quantum computers could still be much faster, which might be desirable in some contexts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, your question effectively boils down to &quot;where do quantum computers get their power from&quot;? Variations on this theme have been asked a number of times already on this site. The way that I like to think about it is to recall that classical computers, no matter how complex, are built out of the same fundamental set of gates (indeed, one gate such as NAND is sufficient). If somebody suddenly comes along with an extra gate that cannot be built out of the existing gates, it suddenly gives you the potential to use this gate to improve existing algorithms. Sometimes it'll help, sometimes it won't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would just like to point out that one aspect which is not the source of power is the exponential state space. Probabilistic classical computations also have an exponentially large state space, and yet we can still perform them. (Of course, the difference is about how we deal with probabilities. Quantum probabilities can interfere, which means that we have to keep &lt;em&gt;all&lt;/em&gt; the paths &quot;alive&quot; as we simulate, rather than just sampling individual paths. But this is a much more subtle issue.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-19T10:21:53.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5010" PostTypeId="2" ParentId="4998" CreationDate="2018-12-19T10:22:14.797" Score="3" Body="&lt;p&gt;This issue was due to you taking example code using the master branch, and running it using the stable version (which is installed when you &lt;code&gt;pip install qiskit&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this question was asked, Qiskit has been updated. The program given in the question will now run fine with the stable version of Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you ever want to run code from the master branch, you can pip install the relevant version of Qiskit using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/Qiskit/qiskit-terra.git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-01-18T11:39:13.203" LastActivityDate="2019-01-18T11:39:13.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5011" PostTypeId="2" ParentId="4774" CreationDate="2018-12-19T11:10:15.580" Score="5" Body="&lt;p&gt;Single-qubit unitaries are just 3D rotations, multiplied by a phase. So in order to find the actual angles, you can resort to the theory of rotation matrices, in particular to &lt;a href=&quot;http://mathworld.wolfram.com/EulerAngles.html&quot; rel=&quot;noreferrer&quot;&gt;Euler's rotation theorem&lt;/a&gt;, which states that any rotation is a composition of 3 rotations (the theorem proof is constructive, so you get the actual angles).&lt;/p&gt;&#xA;" OwnerUserId="2558" LastActivityDate="2018-12-19T11:10:15.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5012" PostTypeId="2" ParentId="4975" CreationDate="2018-12-19T12:43:44.827" Score="5" Body="&lt;p&gt;I don't think Qiskit has this simulation feature. You have to decompose it indeed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is another way to solve your problem.&#xA;To check if a quantum circuit (that you can submit in Qiskit) corresponds to a unitary matrix, you can use the &lt;a href=&quot;https://qiskit.org/documentation/_autodoc/qiskit.backends.aer.unitary_simulator.html&quot; rel=&quot;noreferrer&quot;&gt;unitary_simulator&lt;/a&gt; backend.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Run the quantum circuit on a unitary simulator backend&#xA;backend = Aer.get_backend('unitary_simulator')&#xA;job = execute(circ, backend)&#xA;result = job.result()&#xA;print(np.around(result.get_unitary(circ), 3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will print the unitary matrix that your circuit represents. And you can compare to yours.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-12-19T12:43:44.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5013" PostTypeId="1" CreationDate="2018-12-19T14:13:07.607" Score="3" ViewCount="554" Body="&lt;p&gt;Can I decompose a 4-qubit Toffoli gate into two qubit CNOT gate without ancillary state?&lt;/p&gt;&#xA;" OwnerUserId="4131" LastEditorUserId="26" LastEditDate="2018-12-23T07:53:18.050" LastActivityDate="2018-12-23T07:53:18.050" Title="How to decompose 4 qubits Toffoli-gate into two-qubits CNOT gate?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5014" PostTypeId="2" ParentId="5006" CreationDate="2018-12-19T14:16:37.553" Score="9" Body="&lt;p&gt;Geometric characterization (as any other characterization) of subsets of the quantum state space in relation with their locality and entanglement properties becomes very complicated as the number of qubits rises. The geometry of the space of negative conditional entropy two qubit states, which are also locally maximally mixed (Weyl states) is known; it is reviewed by &lt;a href=&quot;https://arxiv.org/abs/1609.04144&quot; rel=&quot;noreferrer&quot;&gt;Friis, Bulusu and Bertlmann&lt;/a&gt;. All the figures and the data given in this answer are taken from this review.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their result is described in the following figure of the Weyl tetrahedron, which can be summarized as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rYDrp.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rYDrp.png&quot; alt=&quot;Weyl Tetrahedron&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The corners of the tetrahedron are the four Bell states.&lt;/li&gt;&#xA;&lt;li&gt;The center of the tetrahedron is the maximally mixed two qubit sate.&lt;/li&gt;&#xA;&lt;li&gt;The maximally mixed state is surrounded by what is called the Kuś-Życzkowski ball of maximally separable states whose unitary translates are also separable.&lt;/li&gt;&#xA;&lt;li&gt;The surface of the ball touches the double pyramid of separable states in the central points of its faces.&lt;/li&gt;&#xA;&lt;li&gt;The dark-yellow surface outside the double pyramid encloses the local states which cannot violate the CHSH inequality.&lt;/li&gt;&#xA;&lt;li&gt;The outer red surface encloses all the states with positive conditional entropy.&lt;/li&gt;&#xA;&lt;li&gt;The solid red line parametrizes a family of Werner states which penetrates through the whole Weyl tetrahedron. The cross section of this line in the tetrahedron is given by:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u1rN3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u1rN3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-12-19T14:16:37.553" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5015" PostTypeId="2" ParentId="5013" CreationDate="2018-12-19T14:44:01.257" Score="3" Body="&lt;p&gt;Yes, it is possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A circuit is given e.g. in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4090/491&quot;&gt;this answer&lt;/a&gt; to a closely related question.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-12-19T14:44:01.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5016" PostTypeId="2" ParentId="4373" CreationDate="2018-12-19T16:11:07.447" Score="4" Body="&lt;p&gt;Here are a couple of contributions related to your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1- Very recently, &lt;a href=&quot;https://csferrie.com/2018/12/13/brakets/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chris Ferrie created an open-source card game based on a toy version of quantum mechanics, called &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;B|racket|S&amp;gt;$&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2- The company &lt;a href=&quot;https://phasespacecomputing.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phase Space Computing&lt;/a&gt; markets electronic kits that simulate quantum gates and simple quantum algorithms.&lt;/p&gt;&#xA;" OwnerUserId="2558" LastActivityDate="2018-12-19T16:11:07.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5017" PostTypeId="1" AcceptedAnswerId="5018" CreationDate="2018-12-19T18:52:12.510" Score="2" ViewCount="493" Body="&lt;p&gt;This may be a silly question but at the start of Shor's algorithm to factorise a number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; we need to find a number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that &#xA;&lt;span class=&quot;math-container&quot;&gt;$N^{2} \leq 2^{n} \leq 2N^{2}$&lt;/span&gt;&#xA;Why does such a number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; exist for any &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5328" LastEditorUserId="26" LastEditDate="2018-12-19T19:33:53.480" LastActivityDate="2018-12-19T19:56:04.117" Title="Shor's algorithm beginning" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;shors-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5018" PostTypeId="2" ParentId="5017" CreationDate="2018-12-19T19:04:24.207" Score="6" Body="&lt;p&gt;Let's represent &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$2^a+b$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the greatest power of 2 that not exceeds &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$b \ge 0$&lt;/span&gt; (which is always possible to do - &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is just the number of bits in binary representation of &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt;). Then &lt;span class=&quot;math-container&quot;&gt;$n = a+1$&lt;/span&gt;: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$N^2 \le 2^{a+1}$&lt;/span&gt;, because otherwise &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; would not be the greatest power of 2 that not exceeds &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$2^{a+1} \le 2N^2 = 2(2^a+b) = 2^{a+1} + 2b$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$b \ge 0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-12-19T19:04:24.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5019" PostTypeId="2" ParentId="5017" CreationDate="2018-12-19T19:56:04.117" Score="2" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; is less than &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, you can increase &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; by 1 without exceeding &lt;span class=&quot;math-container&quot;&gt;$2x$&lt;/span&gt;. Because if &lt;span class=&quot;math-container&quot;&gt;$2^k &amp;lt; x$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$2 \cdot 2^k &amp;lt; 2 \cdot x$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$2^{k+1} &amp;lt; 2x$&lt;/span&gt;. If you start at &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; and keep incrementing, &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; will eventually exceed &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and at that exact moment you stop; knowing that you didn't also exceed &lt;span class=&quot;math-container&quot;&gt;$2x$&lt;/span&gt; and so have met both criteria.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can just use a closed-form definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k = \lceil \log_2 x \rceil$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, in the original variables:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n = \lceil \log_2 N^2 \rceil$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-12-19T19:56:04.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5020" PostTypeId="1" AcceptedAnswerId="5021" CreationDate="2018-12-19T20:20:44.347" Score="3" ViewCount="1642" Body="&lt;p&gt;Let me take Grover's algorithm as an example.  In most cases, Grover's algorithm is able to yield with a high probability the desired term of the superposition.  When the superposition has more than 4 terms, there's a small chance we will not obtain the desired term of the superposition, in which case we can repeat the procedure and measure it again, until we really get the desired result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although the probability of not getting the desired result decreases exponentially, it is technically not guaranteed that one will ever get the desired measurement.  Therefore, we cannot prove that Grover's algorithm is an algorithm because we cannot prove it terminates with the correct answer in a finite number of steps. &#xA; (Otherwise, what part of the definition of &quot;algorithm&quot; I'm missing here?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can however define Grover's algorithm as a Las Vegas algorithm because if we do not measure the desired result, we could produce a &quot;failure&quot; result, satisfying therefore the definition of &quot;Las Vegas algorithm&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Surely a quantum computer is able to calculate everything a classical computer can, so quantum computers can execute algorithms in the formal sense of the word.  But is there an algorithm (not a Las Vegas algorithm) that uses true quantum features like superpositions and entanglement always producing the right answer in a finite number of steps and is not a Las Vegas algorithm?  That's what I'm after.  I appreciate any light on this direction.&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="1589" LastEditDate="2018-12-19T20:26:34.570" LastActivityDate="2018-12-19T21:02:11.233" Title="Is there any (really) quantum procedure that's an algorithm and not a Las Vegas algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5021" PostTypeId="2" ParentId="5020" CreationDate="2018-12-19T20:45:38.230" Score="9" Body="&lt;p&gt;It sounds like you're looking for algorithms that succeed deterministically with probability 1, instead of probabilistic algorithms that succeed with probability bounded from a 1/2 by a finite amount, say 2/3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Exact&lt;/code&gt; is the keyword for deterministic quantum algorithms, such as in this paper &lt;a href=&quot;https://arxiv.org/abs/1404.1684&quot; rel=&quot;noreferrer&quot;&gt;Exact quantum algorithms have advantage for almost all Boolean functions by Andris Ambainis, Jozef Gruska, Shenggen Zheng&lt;/a&gt; that answers your question in the affirmative.&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2018-12-19T20:45:38.230" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5022" PostTypeId="2" ParentId="5020" CreationDate="2018-12-19T20:52:27.053" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Although the probability of not getting the desired result decreases exponentially, it is technically not guaranteed that one will ever get the desired measurement. Therefore, we cannot prove that Grover's algorithm is an algorithm because we cannot prove it terminates with the correct answer in a finite number of steps. (Otherwise, what part of the definition of &quot;algorithm&quot; I'm missing here?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is important that an 'algorithm' terminates, but it is possible to consider slightly more flexible final conditions than you are considering when it does terminate. This is true of classical algorithms as well as quantum algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Las Vegas algorithm is one which can 'succeed' or 'fail', and which produces a correct result whenever it 'succeeds' (so that it is meaningful to say that it has succeeded). We look for the probability of failure to be low, ideally &amp;mdash; and this can be achieved in principle by trying again if you don't succeed (though in some cases you may end up trying many times).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This idea is taken seriously enough that there is a Las Vegas version of the complexity class &lt;strong&gt;P&lt;/strong&gt;, known as &lt;strong&gt;ZPP&lt;/strong&gt;. (It does not do to take complexity class names too seriously, but the acronym stands for &quot;zero error probabilistic polynomial-time&quot;, as it is the class of decision problems solvable in polynomial time, using randomness, and without error &amp;mdash; allowing however for a bounded probability of failing to produce a  YES/NO answer at all.) This is a class between &lt;strong&gt;P&lt;/strong&gt; and &lt;strong&gt;BPP&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an analogous class, &lt;strong&gt;ZQP&lt;/strong&gt;, of problems solvable with an idealised quantum computer in polynomial time with zero error, which happens to contain integer factorisation (due to a combination of Shor's algorithm, the fact that verifying integer multiplication is in &lt;strong&gt;P&lt;/strong&gt;, and the fact that primality testing is in &lt;strong&gt;ZPP&lt;/strong&gt; and indeed also in &lt;strong&gt;P&lt;/strong&gt;). These of course are analogous to 'Las Vegas' algorithms in the sense that they are zero error (though 'Las Vegas' would usually only be used for &lt;em&gt;classical&lt;/em&gt; randomised algorithms) &amp;mdash; and in particular, they are indeed algorithms. &lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2018-12-19T20:52:27.053" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5023" PostTypeId="2" ParentId="5020" CreationDate="2018-12-19T21:02:11.233" Score="5" Body="&lt;p&gt;Firstly, I would say that when you embrace quantum computing, you are considering probabilistic programming and not deterministic if I may say so (so your definition of algorithm depends on the kind of programming/computing you are doing). It will still be an algorithm though because you create a &lt;strong&gt;&lt;em&gt;circuit&lt;/em&gt;&lt;/strong&gt; (which is what we call an algorithm in quantum computing with the circuit model). A quantum algorithm through its quantum operations change the quantum state of a circuit(and this is the definition of quantum computing). Briefly said, this is just a different kind of computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are looking for deterministic output though from a quantum algorithm, we can take quantum circuits for arithmetic operations like adder circuits. You have also the common quantum phase estimation in the case you input one eigenvector of the unitary operation of interest. In that case, it outputs the phase (approximately) associated with the eigenvector provided exactly. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-12-19T21:02:11.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5024" PostTypeId="2" ParentId="5006" CreationDate="2018-12-20T13:05:35.593" Score="10" Body="&lt;p&gt;The conditional von Neumann entropy is a concave function: if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are states of a pair of registers &lt;span class=&quot;math-container&quot;&gt;$(\mathsf{X},\mathsf{Y})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda\in[0,1]$&lt;/span&gt; is a real number, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{H}(\mathsf{X}|\mathsf{Y})_{\lambda\rho + (1-\lambda)\sigma} \geq \lambda\, \mathrm{H}(\mathsf{X}|\mathsf{Y})_{\rho} + (1-\lambda)\,\mathrm{H}(\mathsf{X}|\mathsf{Y})_{\sigma}.&#xA;$$&lt;/span&gt;&#xA;It follows that the set of all states having nonnegative conditional von Neumann entropy is convex. This is true for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Y}$&lt;/span&gt; being registers with arbitrary dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some things can be said about the set of all states having negative conditional von Neumann entropy. Every such state is entangled, for instance, but it is certainly not a convex set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to prove that the conditional von Neumann entropy is concave is as follows. Consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda\, \rho \otimes |0\rangle\langle 0| + (1-\lambda)\, \sigma \otimes |1\rangle\langle 1|&#xA;$$&lt;/span&gt;&#xA;of three registers &lt;span class=&quot;math-container&quot;&gt;$(\mathsf{X},\mathsf{Y},\mathsf{Z})$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Z}$&lt;/span&gt; is a new, single qubit register that is being introduced for the sake of the proof. By the strong subadditivity of von Neumann entropy we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{H}(\mathsf{X},\mathsf{Y},\mathsf{Z}) + \mathrm{H}(\mathsf{Y}) \leq \mathrm{H}(\mathsf{X},\mathsf{Y}) + \mathrm{H}(\mathsf{Y},\mathsf{Z}).&#xA;$$&lt;/span&gt;&#xA;If you evaluate each of the entropies in this inequality for the state above, and then rearrange using &lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}(\mathsf{X}|\mathsf{Y}) = \mathrm{H}(\mathsf{X},\mathsf{Y})-\mathrm{H}(\mathsf{Y})$&lt;/span&gt;, you should get the concavity of conditional von Neumann entropy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the strong subadditivity of von Neumann entropy is far from trivial to prove, but there are multiple known proofs, and if you search you will easily find one.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="26" LastEditDate="2019-05-13T19:45:05.220" LastActivityDate="2019-05-13T19:45:05.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5025" PostTypeId="1" AcceptedAnswerId="5035" CreationDate="2018-12-20T14:35:42.220" Score="4" ViewCount="208" Body="&lt;p&gt;On a classical computer, I want to simulate a learning-based quantum state tomography of a qubit. We can formulate it as finding a parametrized unitary evolution that takes the unknown pure state to a known state. We measure on the basis of the known state (see &lt;a href=&quot;https://arxiv.org/abs/1805.06580&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;). If we get the known state we proceed, otherwise we change the parameter of the unitary evolution slightly, until we obtain a large number of projections to the known state successfully. There are a lot of simulators listed in quantiki website and also in some previous posts here. Does anyone know a simple simulator to do that?&lt;/p&gt;&#xA;" OwnerUserId="5377" LastEditorUserId="26" LastEditDate="2018-12-31T16:03:09.803" LastActivityDate="2018-12-31T16:03:09.803" Title="Numerical quantum state tomography simulator" Tags="&lt;simulation&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5026" PostTypeId="1" CreationDate="2018-12-20T19:20:22.997" Score="4" ViewCount="336" Body="&lt;p&gt;Suppose one of my functions create some ancillary qubits and reset them. &#xA;Then, another function wants to create a larger number of ancillary qubits. So, I'd like to reuse the first set of qubits and add the difference two them. Is there any efficient way to achieve the goal?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def function1(qc):&#xA;    r = 3&#xA;    ancillas = QuantumRegister(r, 'ancillas')&#xA;    qc.add(sum_q)&#xA;    # use the ancillas&#xA;    return ancillas&#xA;&#xA;def function2(qc, partial_ancillas):&#xA;    r = 5&#xA;    diff = r - len(partial_ancillas)&#xA;    if diff &amp;gt; 0:&#xA;        # something like ancillas = partial_ancillas.add(diff)&#xA;        # or maybe ancillas = partial_ancillas + QuantumRegister(diff)&#xA;    else:&#xA;        ancillas = partial_ancillas&#xA;    return ancillas&#xA;&#xA;qc = QuantumCircuit()&#xA;anc = function1(qc)&#xA;anc = function2(qc, anc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="26" LastEditDate="2018-12-21T07:15:58.840" LastActivityDate="2018-12-21T15:01:39.880" Title="Qiskit - expand and/or merge registers" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5027" PostTypeId="1" CreationDate="2018-12-21T12:46:17.597" Score="5" ViewCount="90" Body="&lt;p&gt;I want to find out what values &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; can take if I want to write &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2} (|00\rangle + |11\rangle)$$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2} (|uu\rangle + |vv\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|u\rangle = a|0\rangle + b|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|v\rangle = c|0\rangle + d|1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2} (|uu\rangle + |vv\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;= &lt;span class=&quot;math-container&quot;&gt;$$(a^2 + b^2)|00\rangle + (ab + cd)(|01\rangle + |10\rangle) + (c^2 + d^2)|11\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(a^2 + b^2)e^{i\theta} = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(c^2 + d^2)e^{i\theta} = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(for the same &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ab + cd = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also know that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|a|^2 + |b|^2 = 1 \implies a^*a + b^*b = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|c|^2 + |d|^2 = 1 \implies c^*c + d^*d = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I find the relation between &lt;span class=&quot;math-container&quot;&gt;$a, b, c, d$&lt;/span&gt; as rigorously as possible?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2018-12-21T13:00:40.203" LastActivityDate="2018-12-21T14:37:40.953" Title="Ways in which $\frac{1}{\sqrt 2} (|00\rangle + |11\rangle)$ can be expressed as $\frac{1}{\sqrt 2} (|uu\rangle + |vv\rangle)$" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5028" PostTypeId="1" CreationDate="2018-12-21T12:52:56.550" Score="1" ViewCount="194" Body="&lt;p&gt;When I use Qiskit to do quantum computing, I suffer from a big problem.&#xA;When running the code,it turns out to be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {&quot;error&quot;:{&quot;name&quot;:&quot;Error&quot;,&quot;status&quot;:401,&quot;message&quot;:&quot;Authorization Required&quot;,&#xA;   &quot;statusCode&quot;:401,&quot;code&quot;:&quot;AUTHORIZATION_REQUIRED&quot;}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It seems that I failed to authorize my account. I don't know how to get authorization. Can anyone help me?&lt;/p&gt;&#xA;" OwnerUserId="4763" LastEditorUserId="26" LastEditDate="2018-12-21T12:55:52.567" LastActivityDate="2019-11-05T03:33:18.730" Title="Qiskit - Authorization Required error" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5029" PostTypeId="2" ParentId="5027" CreationDate="2018-12-21T13:39:58.057" Score="2" Body="&lt;p&gt;I think the clearest way to specify this is &lt;span class=&quot;math-container&quot;&gt;$|u\rangle,|v\rangle\in\mathbb{R}^2$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\langle u|v\rangle=0$&lt;/span&gt; (up to the same global phase shared by both states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see how this corresponds to what you wrote: &#xA;We start with &lt;span class=&quot;math-container&quot;&gt;$b^2=e^{-i\theta}-a^2$&lt;/span&gt; and take the mod-square:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|b|^4=1+|a|^4-a^2e^{i\theta}-{a^*}^2e^{-i\theta}&#xA;$$&lt;/span&gt;&#xA;and we can compare this to the square of the normalisation condition:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|b|^4=1+|a|^4-2|a|^2&#xA;$$&lt;/span&gt;&#xA;Hence, we require&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a^2e^{i\theta}+{a^*}^2e^{-i\theta}=2|a|^2,&#xA;$$&lt;/span&gt;&#xA;which must mean that &lt;span class=&quot;math-container&quot;&gt;$a=|a|e^{-i\theta/2}$&lt;/span&gt;. Putting this back in &lt;span class=&quot;math-container&quot;&gt;$b^2=e^{-i\theta}-a^2$&lt;/span&gt; gives that &lt;span class=&quot;math-container&quot;&gt;$b=e^{-i\theta/2}|b|$&lt;/span&gt;. Hence, we might as well take &lt;span class=&quot;math-container&quot;&gt;$a,b\in\mathbb{R}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\theta/2$&lt;/span&gt; just being a global phase. We can apply an identical argument to &lt;span class=&quot;math-container&quot;&gt;$c,d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we know &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d$&lt;/span&gt; are real, we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle u|v\rangle=ab+cd=0$&lt;/span&gt;,&#xA;i.e. &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; are orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, I should probably point out that you're presupposing that &lt;span class=&quot;math-container&quot;&gt;$\langle u|v\rangle=0$&lt;/span&gt; because otherwise your state &lt;span class=&quot;math-container&quot;&gt;$(|uu\rangle+|vv\rangle)/\sqrt{2}$&lt;/span&gt; wouldn't be normalised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also just noticed that you've switched somewhere in the middle between b being &lt;span class=&quot;math-container&quot;&gt;$\langle 1|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle 0|v\rangle$&lt;/span&gt;. I don't think that affects the calculation, but it would be better to have it consistent!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-12-21T14:37:40.953" LastActivityDate="2018-12-21T14:37:40.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5030" PostTypeId="2" ParentId="4528" CreationDate="2018-12-21T13:59:23.633" Score="3" Body="&lt;p&gt;You may also want to check for:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;state dependent deterministic cloners which clone with a better fidelity when input state comes from a known ensemble.&lt;br&gt;&#xA;Ref: Bruss et al., PRA 57, 2368 (1997)&lt;/li&gt;&#xA;&lt;li&gt;probabilistic cloners which clone with unit fidelity but with less than unity success probability&lt;/li&gt;&#xA;&lt;li&gt;asymmetric cloners where the outputs have cloned with different fidelities&lt;/li&gt;&#xA;&lt;li&gt;coherent state cloning machines in infinite dimensional Hilbert space picture which have better optimal fidelity than those for discrete variables in finite dimensions.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5392" LastEditorUserId="11" LastEditDate="2018-12-26T17:28:21.067" LastActivityDate="2018-12-26T17:28:21.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5031" PostTypeId="2" ParentId="5027" CreationDate="2018-12-21T14:29:38.293" Score="2" Body="&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle=\tfrac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt; is invariant under transformations of the form &lt;span class=&quot;math-container&quot;&gt;$U\otimes \bar{U}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; unitary (or more generally, &lt;span class=&quot;math-container&quot;&gt;$X\otimes {\bar X^{-1}}$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\omega\rangle=(U\otimes \bar U)|\omega\rangle\ .&#xA;$$&lt;/span&gt;&#xA;Thus, &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\omega\rangle &amp;amp;= \tfrac{1}{\sqrt{2}}(U|0\rangle\otimes \bar U|0\rangle+U|1\rangle\otimes \bar U|1\rangle)&#xA;\\&#xA;&amp;amp;= \tfrac{1}{\sqrt{2}}(|u\rangle\otimes |\bar u\rangle+|v\rangle\otimes |\bar v\rangle)\ ,&#xA;\end{align}&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$|u\rangle=U|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\bar u=\bar U|0\rangle$&lt;/span&gt;, etc.  Thus, if you want &lt;span class=&quot;math-container&quot;&gt;$|\bar u\rangle=|u\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\bar v\rangle=|v\rangle$&lt;/span&gt;, you need to choose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; real. In that case,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|u\rangle = \cos\phi|0\rangle + \sin\phi|1\rangle\ ,&#xA;|v\rangle = -\sin\phi|0\rangle + \cos\phi|1\rangle\ .&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-12-21T14:29:38.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5032" PostTypeId="2" ParentId="5026" CreationDate="2018-12-21T15:01:39.880" Score="1" Body="&lt;p&gt;I don't think you can add qubits in a QuantumRegister already set.&#xA;If your goal however is to create another ancilla registers that cannot exceed a limit of qubits, what you can do is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def create_ancillas(r=3):&#xA;&#xA;    ancillas = QuantumRegister(r, 'ancillas')&#xA;    return ancillas&#xA;&#xA;def create_ancillas_limited(partial_ancillas,r=5):&#xA;&#xA;    diff = r - partial_ancillas.size&#xA;    if diff &amp;gt; 0:&#xA;        return QuantumRegister(diff, 'ancillas_2')&#xA;    else:&#xA;        return None&#xA;&#xA;qc = QuantumCircuit()&#xA;anc1 = create_ancillas()&#xA;qc.add(anc1)&#xA;&#xA;anc2 = create_ancillas_limited(anc1)&#xA;qc.add(anc2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Maybe better if you want to limit the number of qubits in your circuits when adding ancillas is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def add_ancillas_limited(qc,n_ancillas_to_add=3,limit=5):&#xA;    if qc.width() - n_ancillas_to_add &amp;gt; limit:&#xA;        print(&quot;Cannot exceed limit!&quot;)&#xA;    else:&#xA;        qc.add(QuantumRegister(n_ancillas_to_add))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-12-21T15:01:39.880" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5033" PostTypeId="2" ParentId="4992" CreationDate="2018-12-22T14:19:37.650" Score="2" Body="&lt;p&gt;There are a couple of possible strategies that I can think of. I have no idea what their scaling is like. I guess nothing will perform better than random sampling, but that’s a complete guess.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I’d start from is just do the usual search, get a random answer, and then adapt my search the next time round, explicitly unmarking that known marked item.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to use the fact that Grover’s search can be applied to learning the minimum of a set, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2004/1837&quot;&gt;What applications does Grover&amp;#39;s Search Algorithm have?&lt;/a&gt;. So, you might adapt it to find the smallest, then the second smallest, and so on.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-22T14:19:37.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5034" PostTypeId="2" ParentId="4175" CreationDate="2018-12-22T15:14:07.163" Score="5" Body="&lt;p&gt;The resonance frequencies of TLS fluctuate due to their interaction with neighboring TLS, which occurs through electric dipole interaction or the local mechanical strain in the material. If a TLS at low energy (below kB*T) is involved, this one may change its state randomly due to thermal activation. The resulting change in local electric field or strain can detune also TLS at higher energy which are within the qubit tuning range. Here's a theory paper on that: &lt;a href=&quot;https://arxiv.org/abs/1503.01637&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1503.01637&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This process is called 'spectral diffusion' and can probably only be avoided by improving circuit materials to reduce the TLS density (and thus interactions). But even without thermal processes, a TLS may be trapped in a long-living metastable potential well from which escape by tunneling could take hours, days, or even years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TLS can be detuned in frequency by controlling the mechanical strain in the sample, see this paper which also discusses TLS interactions:&#xA;&lt;a href=&quot;https://www.nature.com/articles/ncomms7182&quot; rel=&quot;noreferrer&quot;&gt;https://www.nature.com/articles/ncomms7182&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a review article which summarizes decoherence effects from TLS on superconducting qubits and resonators: &lt;a href=&quot;https://arxiv.org/abs/1705.01108&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1705.01108&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5398" LastActivityDate="2018-12-22T15:14:07.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5035" PostTypeId="2" ParentId="5025" CreationDate="2018-12-23T02:50:27.573" Score="0" Body="&lt;p&gt;To me the best choice is clearly &lt;a href=&quot;http://qutip.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qutip&lt;/a&gt;, a quantum computing simulator based in Python. It's free, and it has good documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us know if you have any other queries beyond asking which simulator could do the job best.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2018-12-23T02:50:27.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5036" PostTypeId="2" ParentId="5000" CreationDate="2018-12-23T02:59:21.113" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://qutip.org/docs/4.1/apidoc/classes.html#solver-options-and-results&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here.&lt;/a&gt; Scroll down to the stochastic solver, and you'll find an attribute for storing measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's certainly not the emphasis of the package, as cnada pointed out, but it's there.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1867" LastEditDate="2018-12-25T00:14:48.847" LastActivityDate="2018-12-25T00:14:48.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5037" PostTypeId="1" CreationDate="2018-12-23T06:49:56.183" Score="3" ViewCount="268" Body="&lt;p&gt;While computing the carry bit [C=0 XOR (AB)] I am unable to compute that AB in Qiskit. I don't whether Toffoli gate is available in Qiskit. So does anyone know how to perform AB, which is basically the AND gate without using the Toffoli gate if it isn't available? &lt;/p&gt;&#xA;" OwnerUserId="4446" LastEditorUserId="26" LastEditDate="2018-12-31T22:22:54.307" LastActivityDate="2018-12-31T22:22:54.307" Title="Programming quantum half adder" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5038" PostTypeId="2" ParentId="5037" CreationDate="2018-12-23T10:05:43.580" Score="1" Body="&lt;p&gt;The Toffoli gate is indeed available in qiskit. It goes by the name &lt;code&gt;ccx&lt;/code&gt;. Here's an example circuit where the Toffoli is used.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister&#xA;from qiskit import QuantumCircuit, BasicAer, execute&#xA;&#xA;q = QuantumRegister(3)&#xA;c = ClassicalRegister(3)&#xA;qc = QuantumCircuit(q, c)&#xA;&#xA;qc.h(q[0])&#xA;qc.h(q[1])&#xA;qc.ccx(q[0], q[1], q[2])&#xA;qc.measure(q, c)&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(qc, backend)&#xA;result = job.result()&#xA;&#xA;print(result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The third qubit in the argument (&lt;code&gt;q[2]&lt;/code&gt; here) acts as the target. The other two are the controls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are still interested in how to make this gate from two qubit gates, you can check out the blog post &lt;a href=&quot;https://medium.com/qiskit/using-quantum-operations-to-achieve-computing-objectives-868a7f1cfa09&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, which explains how the following gate sequence will give you the effect you need (though it isn't quite the same as a Toffoli).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.ch(q[0], q[3])&#xA;qc.cz(q[1], q[3])&#xA;qc.ch(q[0], q[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastActivityDate="2018-12-23T10:05:43.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5039" PostTypeId="1" CreationDate="2018-12-23T16:59:21.160" Score="4" ViewCount="122" Body="&lt;p&gt;I am reading on how to approximate adiabatic evolution with quantum circuit and I had some trouble following the arguments given in the early papers which proves this results. I am mainly following&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;W. van Dam, M. Mosca, and U. Vazirani, “How Powerful is Adiabatic Quantum Computation?,” Proceedings 2001 IEEE International Conference on Cluster Computing, pp. 279–287, 2001.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In it the authors assumed a problem Hamiltonian&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_p=f(z)|z\rangle\langle z|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so &lt;span class=&quot;math-container&quot;&gt;$H_p$&lt;/span&gt; is diagonal in the computational basis. Towards the end of the proof, it is kind of assumed that &lt;span class=&quot;math-container&quot;&gt;$H_p$&lt;/span&gt; and its associated evolution operator can be efficiently computed and implemented in quantum circuits. I struggled to see why this is so. Doesn't one need to fully specify &lt;span class=&quot;math-container&quot;&gt;$H_p$&lt;/span&gt; to implement the unitary associated with it? In this case does it become equivalent to assuming we can already solve the optimization problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if we don't assume &lt;span class=&quot;math-container&quot;&gt;$H_p$&lt;/span&gt; to be diagonal in the computational basis, would it be possible that we need exponential number of gates to implement the adiabatic evolution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a relevant and more general question is, in general is there any hard Hamiltonian's that is difficult to simulate on a quantum circuit?&lt;/p&gt;&#xA;" OwnerUserId="5005" LastEditorUserId="5005" LastEditDate="2018-12-25T16:15:29.610" LastActivityDate="2018-12-27T07:56:53.937" Title="Problem with approximating adiabatic evolution with quantum circuit" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5040" PostTypeId="2" ParentId="5000" CreationDate="2018-12-23T20:43:33.010" Score="2" Body="&lt;p&gt;Main purpose of Qutip is to explore dynamics of quantum systems and therefore density matrices are the tool to use. According to  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4129/how-is-measurement-modelled-when-using-the-density-operator?rq=1&quot;&gt;this answer on Quantum computing,&lt;/a&gt; we can model a measurement operator Pi  on a density matrix. &#xA;In the case of the measurement of a single qubit in the computational basis, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_0=|0\rangle\langle 0|\qquad P_1=|1\rangle\langle 1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to talk about n qubits where you measure just the first one, then you use the measurement operators&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_0=|0\rangle\langle 0|\otimes\mathbb{I}^{\otimes(n-1)}\qquad P_1=|1\rangle\langle 1|\otimes\mathbb{I}^{\otimes(n-1)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementation with the Qutip dag method.&#xA;First we set up a two level quantum system with the basis method&#xA;use a vector v0 for the zero vector and v1 for one vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;v0 = qp.basis(2, 0)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate outer product with the dag method this will give a density operator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P0 = v0 * v0.dag()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;expand for multiqubit gate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M0 = qp.gate_expand_1toN(P0, self.activeQubits, qubitNum)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also&lt;/p&gt;&#xA;&#xA;&lt;p&gt;v1 = qp.basis(2, 1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a basic  qubit quantum simulator running on Qutip in the SimulaQron software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/SoftwareQuTech/SimulaQron/blob/master/virtNode/crudeSimulator.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;SimulaQron crudeSimulator&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2018-12-23T20:43:33.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5041" PostTypeId="1" CreationDate="2018-12-24T17:40:54.827" Score="6" ViewCount="945" Body="&lt;p&gt;Simon's problem is that you are given a function &lt;span class=&quot;math-container&quot;&gt;$f : \{0,1\}^n \to \{0,1\}^n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(y)$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$x \bigoplus y$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$0^n$&lt;/span&gt; or some unknown &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. The problem is to find &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$s=0^n$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is 1 to 1 otherwise 2 to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the classical complexity for Simon's problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia says &lt;span class=&quot;math-container&quot;&gt;$\sqrt {2^n}$&lt;/span&gt; but without any proof. Is there any site or book where I can find the proof for this?&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="2879" LastEditDate="2018-12-26T16:56:05.493" LastActivityDate="2018-12-26T16:56:05.493" Title="Classical complexity for Simon's problem" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;complexity-theory&gt;&lt;simons-algorithm&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5042" PostTypeId="2" ParentId="4749" CreationDate="2018-12-24T17:56:54.067" Score="4" Body="&lt;p&gt;Yes, you can decompose any Hamiltonian. For VQE purposes, any finite-dimensional Hamiltonian can be presented as a sum of terms which consist of tensor products of Pauli matrices (&lt;a href=&quot;https://arxiv.org/abs/1304.3061&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1304.3061&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \sum_{\alpha, i} h^{\alpha}_{i} \sigma^{\alpha}_{i} + &#xA;\sum_{\alpha, \beta, i, j} h^{\alpha \beta}_{ij} \sigma^{\alpha}_{i} \sigma^{\beta}_{j} + \dots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, the expected value &lt;span class=&quot;math-container&quot;&gt;$ \langle H \rangle$&lt;/span&gt; can be estimated by measuring the expected values of such combinations of Pauli matrices. There may be trouble if the quantity of these terms grows exponentially in the size of the system, but many interesting Hamiltonians decompose into a polynomial number of operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coefficients of the decomposition can be obtained by making a scalar product of the Hamiltonian with the basis term: &lt;span class=&quot;math-container&quot;&gt;$(H, A) = \frac1d \mathrm{Tr}(HA)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastEditorUserId="26" LastEditDate="2019-01-31T19:25:05.000" LastActivityDate="2019-01-31T19:25:05.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5043" PostTypeId="1" AcceptedAnswerId="5046" CreationDate="2018-12-24T18:13:36.377" Score="1" ViewCount="238" Body="&lt;p&gt;The Qiskit documentation on VQE &lt;a href=&quot;https://qiskit.org/documentation/aqua/variational_forms.html#ry&quot; rel=&quot;nofollow noreferrer&quot;&gt;describes&lt;/a&gt; two of the ansatz as &quot;rotations with entanglements&quot;. The rotation gates are more or less clear, but the documentation doesn't mention what gate is used for entanglement. I suspect they use something like &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \alpha Z_1 Z_2)$&lt;/span&gt;, but what exactly?&lt;/p&gt;&#xA;" OwnerUserId="5103" LastEditorUserId="26" LastEditDate="2019-03-12T09:16:08.777" LastActivityDate="2019-03-12T09:16:08.777" Title="Entanglement in VQE ansatz in Qiskit" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5044" PostTypeId="2" ParentId="5041" CreationDate="2018-12-25T05:09:26.237" Score="1" Body="&lt;p&gt;Sources on quantum computing tend to give a classical complexity of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2^n}$&lt;/span&gt; but not the proof. I believe the sources on classical cryptography call this algorithm &lt;a href=&quot;https://en.wikipedia.org/wiki/Birthday_attack&quot; rel=&quot;nofollow noreferrer&quot;&gt;birthday attack&lt;/a&gt; and use it to find collisions of hash functions (which is effectively what the Simon's algorithm does). You should be able to find the math details looking for it in crypto context - Crypto StackExchange even has a &lt;a href=&quot;https://crypto.stackexchange.com/questions/tagged/birthday-attack&quot;&gt;dedicated tag&lt;/a&gt; for birthday attack.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2018-12-25T05:09:26.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5045" PostTypeId="1" AcceptedAnswerId="5066" CreationDate="2018-12-25T08:15:27.197" Score="6" ViewCount="967" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho^{AB} (\sigma^A \otimes I/d)) = Tr(\rho^A \sigma^A)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I came across the above, but I'm not sure how it's true. I figured they first partial traced out the B subsystem, and then trace A, but I don't see how you are allowed to partial trace out B from both the factors in the arguments. A proof or any intuition on this would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; is a state in Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H_A \otimes H_B$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma^A$&lt;/span&gt; is a state in Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; subsystem traced out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I/d$&lt;/span&gt; is the maximally mixed state in Hilbert space &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw this being used in Nielsen and Chuang, section 11.3.4, in the proof of subadditivity of entropy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I tried to write an answer based on DaftWullie's comment and Алексей Уваров's answer, but I am stuck again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;span class=&quot;math-container&quot;&gt;$$\rho^{AB} = \sum_{mnop} \rho_{mnop} |mo\rangle \langle np|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$$\rho^{A} = \sum_{mno} \rho_{mnoo} |m\rangle \langle n|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$$\sigma^A = \sum_{ij} \sigma_{ij} |i\rangle \langle j|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And &lt;span class=&quot;math-container&quot;&gt;$$I/d = \sum_{xy} [I/d]_{xy} |x\rangle \langle y|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;RHS&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho^A \sigma^A)\\ &#xA;= Tr(\sum_{mno} \rho_{mnoo} |m\rangle \langle n|\sum_{ij} \sigma_{ij} |i\rangle \langle j|)\\&#xA;= Tr(\sum_{mnoj} \rho_{mnoo} \sigma_{nj} | m \rangle \langle j|)\\&#xA;= \sum_{mno} \rho_{mnoo} \sigma_{nm}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;LHS&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho^{AB} (\sigma^A \otimes I/d)\\&#xA;= Tr(\sum_{mnop} \rho_{mnop} |mo\rangle \langle np| \sum_{ijxy} \sigma_{ij} [I/d]_{xy} |ix\rangle \langle jy|)\\&#xA;= Tr(\sum_{mnoxjy}\rho_{mnox} \sigma_{nj} [I/d]_{xy} | mo \rangle \langle jy |)\\&#xA;= \sum_{mnyx} \rho_{nm}[I/d]_{xy}\\&#xA;= (1/d)\sum_{mny} \rho_{mnyy} \sigma_{nm}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the same as the RHS, but there's an extra &lt;span class=&quot;math-container&quot;&gt;$1/d$&lt;/span&gt; factor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, am I thinking about this the wrong way? Is there a simpler way to look at this?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="10480" LastEditDate="2021-04-16T20:38:17.920" LastActivityDate="2021-04-16T20:38:17.920" Title="Partial trace over a product of matrices - one factor is in tensor product form" Tags="&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;&lt;information-theory&gt;&lt;tensor-product&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5046" PostTypeId="2" ParentId="5043" CreationDate="2018-12-25T12:29:12.730" Score="1" Body="&lt;p&gt;Looks like the entangler gates are controlled-PHASE gates, at least that is mentioned in the Qiskit &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/aqua/chemistry/dissociation_profile_of_molecule.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;c\text{PHASE} = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in hardware, one also uses the &lt;a href=&quot;https://arxiv.org/pdf/1704.05018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;drift Hamiltonian&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$U_{\text{ENT}}=\exp(-iH_0 \tau)$&lt;/span&gt;, which naturally entangles all qubits.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastEditorUserId="26" LastEditDate="2018-12-25T14:33:34.773" LastActivityDate="2018-12-25T14:33:34.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5047" PostTypeId="2" ParentId="5045" CreationDate="2018-12-25T12:42:38.190" Score="7" Body="&lt;p&gt;Here the important fact is that the maximally mixed state is in fact an identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me rewrite the expression on the left in index notation (the summation sign is omitted according to the Einstein convention):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Tr(\rho^{AB} (\sigma^A \otimes I/d)) = [\rho^{AB}]_{ijkl} [\sigma^A]_{ji} [I/d]_{lk}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &lt;span class=&quot;math-container&quot;&gt;$[I/d]_{lk} = \frac1d \delta_{lk}$&lt;/span&gt;, therefore &lt;span class=&quot;math-container&quot;&gt;$[\rho^{AB}]_{ijkl} [\sigma^A]_{ji} [I/d]_{lk} = \frac1d [\rho^{AB}]_{ijkk} [\sigma^A]_{ji}$&lt;/span&gt;, which is exactly what happens if you first trace out the subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (&lt;strong&gt;UPD&lt;/strong&gt;: up to the prefactor of &lt;span class=&quot;math-container&quot;&gt;$1/d$&lt;/span&gt; apparently).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The physical intuition would be as follows. This expression is basically an expected value of a Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$\frac1d \sigma^A \otimes I$&lt;/span&gt; over a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. This operator only acts nontrivially on the first subsystem, thus we can safely trace out the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Also, this contraction problem can be understood better if you use tensor network notation. Learning it requires some time, but if you do, I suggest starting &lt;a href=&quot;https://arxiv.org/abs/1603.03039&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1708.00006&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastEditorUserId="5103" LastEditDate="2018-12-28T09:06:04.957" LastActivityDate="2018-12-28T09:06:04.957" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5048" PostTypeId="1" AcceptedAnswerId="5056" CreationDate="2018-12-25T21:32:39.763" Score="8" ViewCount="1763" Body="&lt;p&gt;First, I know there are differences in logical qubits and physical qubits. It takes more physical qubits for each logical qubit due to quantum error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia states that it takes quantum &lt;strong&gt;gates&lt;/strong&gt; of order &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}((\log N)^2(\log \log N)(\log \log \log N)$&lt;/span&gt; using fast multiplication for Shor's Algorithm. That comes out to &lt;span class=&quot;math-container&quot;&gt;$1,510,745$&lt;/span&gt; &lt;strong&gt;gates&lt;/strong&gt; for &lt;span class=&quot;math-container&quot;&gt;$2^{1024}$&lt;/span&gt;. Further down the article, it says that it usually take &lt;span class=&quot;math-container&quot;&gt;$n^3$&lt;/span&gt; gates for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. This would mean it would take ~&lt;span class=&quot;math-container&quot;&gt;$115$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've run Shor's Algorithm as implemented in Q# samples using Quantum Phase Estimation and it comes out to &lt;span class=&quot;math-container&quot;&gt;$1025$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;" OwnerUserId="4693" LastEditorUserId="1828" LastEditDate="2019-01-21T04:33:51.297" LastActivityDate="2019-01-21T04:33:51.297" Title="How many logical qubits are needed to run Shor's algorithm efficiently on large integers ($n &gt; 2^{1024}$)?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;q#&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5049" PostTypeId="1" AcceptedAnswerId="5051" CreationDate="2018-12-26T02:25:02.553" Score="5" ViewCount="109" Body="&lt;p&gt;Within photonic quantum computing, one of the ways to represent information is the dual-rail representation of single-photon states (&lt;span class=&quot;math-container&quot;&gt;$c_0|01\rangle \ + \ c_1|10\rangle$&lt;/span&gt;). Is it possible to utilize multi-photon states (for example, two optical cavities with total energy &lt;span class=&quot;math-container&quot;&gt;$2\hbar\omega$&lt;/span&gt;, using a state like &lt;span class=&quot;math-container&quot;&gt;$c_0|02\rangle \ + \ c_1|20\rangle \ + \ c_2|11\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|02\rangle$&lt;/span&gt; represents two photons in one cavity, &lt;span class=&quot;math-container&quot;&gt;$|20\rangle$&lt;/span&gt; represents two photons in the other cavity, and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; represents one photon in each cavity?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2018-12-31T15:49:44.867" LastActivityDate="2018-12-31T15:49:44.867" Title="Multi-photon states in photonic quantum computing?" Tags="&lt;quantum-state&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5050" PostTypeId="2" ParentId="5041" CreationDate="2018-12-26T11:21:21.590" Score="1" Body="&lt;p&gt;Here's a partial explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by thinking about the 2 bit case. We first evaluate &lt;span class=&quot;math-container&quot;&gt;$f(00)$&lt;/span&gt;, and we learn nothing. Then, we evaluate (say) &lt;span class=&quot;math-container&quot;&gt;$f(01)$&lt;/span&gt;. Now we can compare the values, and see if &lt;span class=&quot;math-container&quot;&gt;$s=01$&lt;/span&gt;, or not. Next we calculate a new value, say &lt;span class=&quot;math-container&quot;&gt;$f(10)$&lt;/span&gt;. By comparing to &lt;span class=&quot;math-container&quot;&gt;$f(00)$&lt;/span&gt;, we can determine if &lt;span class=&quot;math-container&quot;&gt;$s=10$&lt;/span&gt; but, also, by comparing to &lt;span class=&quot;math-container&quot;&gt;$f(01)$&lt;/span&gt;, we simultaneously check if &lt;span class=&quot;math-container&quot;&gt;$s=11$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, there are &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt; possible values of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; (I'm ignoring the &lt;span class=&quot;math-container&quot;&gt;$s=000...0$&lt;/span&gt; case). If we were cunning, by selecting the right &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; values of &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; values, then so long as &lt;span class=&quot;math-container&quot;&gt;$\binom{k}{2}\geq 2^n-1$&lt;/span&gt;, this could be possible as you could have checked &lt;span class=&quot;math-container&quot;&gt;$\binom{k}{2}$&lt;/span&gt; different values of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. This is achieved by &lt;span class=&quot;math-container&quot;&gt;$k\sim 2^{n/2}$&lt;/span&gt;. Now, there still remains a careful argument about what those &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; values are that you need to select, which I'm not presenting here. It's probably worthwhile trying a few small cases (as I did for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; above) to gain some understanding.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="2645" LastEditDate="2018-12-26T15:30:59.173" LastActivityDate="2018-12-26T15:30:59.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5051" PostTypeId="2" ParentId="5049" CreationDate="2018-12-26T11:27:47.170" Score="3" Body="&lt;p&gt;Yes. The kets themselves can have arbitrary labels, and it's just for you to establish the connection between them and the physical scenario. There's no reason why you can't have the physical scenario you've specified and, indeed, people frequently do.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-26T11:27:47.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5052" PostTypeId="2" ParentId="5039" CreationDate="2018-12-26T11:43:09.650" Score="2" Body="&lt;p&gt;I'm not sure if you're wanting to implement &lt;span class=&quot;math-container&quot;&gt;$H_p=f(z)|z\rangle\langle z|$&lt;/span&gt; for a specific &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_p=\sum_zf(z)|z\rangle\langle z|.&#xA;$$&lt;/span&gt;&#xA;I'm going to assume the latter because you can easily redefine the function to convert it into the former. Now, assume that &lt;span class=&quot;math-container&quot;&gt;$g(z)$&lt;/span&gt; is a function that we can compute efficiently on a classical computer that gives the best &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-bit approximation for &lt;span class=&quot;math-container&quot;&gt;$f(z)$&lt;/span&gt;.  Now, construct a unitary that can compute&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|z\rangle|y\rangle=|z\rangle|y\oplus g(z)\rangle&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$y\in\{0,1\}^k$&lt;/span&gt;. You can implement &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; because it can be computed classically, and &lt;span class=&quot;math-container&quot;&gt;$U^\dagger=U$&lt;/span&gt;. So, if you have a first register on which you want to implement the Hamiltonian (state &lt;span class=&quot;math-container&quot;&gt;$\sum_z\alpha_z|z\rangle$&lt;/span&gt;), a second register of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits, initialised in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes k}$&lt;/span&gt;, and you implement &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then you've got state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_z\alpha_z|z\rangle|g(z)\rangle.&#xA;$$&lt;/span&gt;&#xA;Now think about the binary representation of &lt;span class=&quot;math-container&quot;&gt;$g(z)$&lt;/span&gt;. If you implement a phase gate &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi Z}$&lt;/span&gt; on the least significant bit, a phase &lt;span class=&quot;math-container&quot;&gt;$e^{i2\phi Z}$&lt;/span&gt; on the second bit, and &lt;span class=&quot;math-container&quot;&gt;$e^{i2^{j-1}\phi Z}$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$j^{th}$&lt;/span&gt; least significant bit, then the net effect is a phase &lt;span class=&quot;math-container&quot;&gt;$e^{ig(z)\phi}$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_z\alpha_ze^{ig(z)\phi}|z\rangle|g(z)\rangle&#xA;$$&lt;/span&gt;&#xA;Now we run &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; again, leaving&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_z\alpha_ze^{ig(z)\phi}|z\rangle|0\rangle^{\otimes k}.&#xA;$$&lt;/span&gt;&#xA;This is as if the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_zg(z)|z\rangle\langle z|&#xA;$$&lt;/span&gt;&#xA;has been applied for a time &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, and this, for sufficiently large &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, will be a good approximation to &lt;span class=&quot;math-container&quot;&gt;$H_p$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In terms of different bases, if there's a unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; that you can efficiently implement that changes basis, then you're certainly fine - you just add that before the evolution I've described, and add a &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt; after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, is there a Hamiltonian evolution that you can't efficiently implement on a quantum computer? Assuming certain basic properties such as a bounded energy, then the answer is no: Hamiltonian simulation is BQP-complete, meaning that every Hamiltonian can be efficiently simulated on a quantum computer (up to some accuracy), and there are some for which it is the hardest thing you could ask of a quantum computer and it still be efficient. The caveat here is the way in which the Hamiltonian is specified. For instance, the way you specify the Hamiltonian &lt;em&gt;could&lt;/em&gt; make it hard to implement, while specifying it a different way would be OK.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, that's not necessarily the question that you want to be asking. In terms of &quot;implementing the adiabatic evolution&quot;, it's one thing to be able to implement the Hamiltonian. The other issue is how long do you have to simulate the adiabatic evolution for. There are certain Hamiltonians for which we know that finding the ground state is QMA-complete (see &lt;a href=&quot;https://arxiv.org/abs/1311.3161&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, for example), which means it's strongly believed to be an exponential time problem (the difference between BQP and QMA is effectively the quantum version of the difference between P and NP).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2018-12-27T07:56:53.937" LastActivityDate="2018-12-27T07:56:53.937" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5053" PostTypeId="1" CreationDate="2018-12-26T16:25:13.477" Score="3" ViewCount="252" Body="&lt;p&gt;I am interested in &lt;a href=&quot;https://en.wikipedia.org/wiki/Combinatorial_game_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;combinatorial game theory&lt;/a&gt; &amp;amp; was doing some research on &lt;a href=&quot;https://arxiv.org/abs/1701.02193&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum combinatorial games&lt;/a&gt;. This lead me to wondering how a quantum computer might be able to perform &lt;a href=&quot;https://en.wikipedia.org/wiki/Nimber&quot; rel=&quot;nofollow noreferrer&quot;&gt;nimber&lt;/a&gt; arithmetic (perhaps as a part of a game playing AI). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of the fact that nim sums are equivalent to bitwise XOR &amp;amp; that &lt;a href=&quot;https://physics.stackexchange.com/a/72001/198219&quot;&gt;XOR correlates to CNOT&lt;/a&gt;, which is why it seems resonable to me that a quantum computer would be able to perform calculations with nimbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How could a quantum computer perform nimber arithmetic?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="2645" LastEditDate="2020-05-16T02:47:16.050" LastActivityDate="2020-05-17T07:49:23.067" Title="How could a quantum computer perform nimber arithmetic?" Tags="&lt;mathematics&gt;&lt;resource-request&gt;&lt;games&gt;&lt;artificial-intelligence&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5054" PostTypeId="2" ParentId="5041" CreationDate="2018-12-26T16:48:54.397" Score="7" Body="&lt;p&gt;To determine the classical complexity of a problem you need two things, of course: an upper bound (generally an algorithm) and a lower bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an easy randomized algorithm that works with high probability given &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/2})$&lt;/span&gt; queries to the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;: for a suitable constant &lt;span class=&quot;math-container&quot;&gt;$c&amp;gt;0$&lt;/span&gt;, generate &lt;span class=&quot;math-container&quot;&gt;$k = c 2^{n/2}$&lt;/span&gt; strings &lt;span class=&quot;math-container&quot;&gt;$x_1,\ldots,x_k\in\{0,1\}^n$&lt;/span&gt; uniformly at random, compute &lt;span class=&quot;math-container&quot;&gt;$f(x_j)$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$j\in\{1,\ldots,k\}$&lt;/span&gt;, and check to see if there is a collision. If you find distinct strings &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$f(x) = f(y)$&lt;/span&gt;, then answer &lt;span class=&quot;math-container&quot;&gt;$s = x \oplus y$&lt;/span&gt; (which is guaranteed to be correct). Otherwise answer &lt;span class=&quot;math-container&quot;&gt;$s = 0^n$&lt;/span&gt; (which might be wrong if you were unlucky). The probability that this succeeds depends on the choice of &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, but for any desired constant probability of error &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; there is a constant &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; that yields success probability &lt;span class=&quot;math-container&quot;&gt;$1-\varepsilon$&lt;/span&gt;. The analysis is essentially that of the generalized birthday problem, and it can be found in numerous books and lecture notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is, in fact, a classical deterministic algorithm that succeeds with certainty and requires &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/2})$&lt;/span&gt; queries to &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. The idea is to choose the strings &lt;span class=&quot;math-container&quot;&gt;$x_1,\ldots,x_k$&lt;/span&gt; in advance so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{x_i\oplus x_j \,:\, i,j\in\{1,\ldots,k\}\} = \{0,1\}^n,&#xA;$$&lt;/span&gt;&#xA;so a collision will be guaranteed if there is one. This paper describes one way to do this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Guangya Cai and Daowen Qiu. &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0022000018305178&quot; rel=&quot;noreferrer&quot;&gt;Optimal separation in exact query complexities for Simon's problem&lt;/a&gt;. Journal of Computer and System Sciences 97: 83-93, 2018.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The lower bound is more difficult, as lower bounds generally are, if you want a formal analysis. Simon's original paper proved that any probabilistic algorithm making &lt;span class=&quot;math-container&quot;&gt;$2^{n/4}$&lt;/span&gt; queries to &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can determine whether or not &lt;span class=&quot;math-container&quot;&gt;$s=0^n$&lt;/span&gt; with probability at most &lt;span class=&quot;math-container&quot;&gt;$1/2 + 2^{-n/2}$&lt;/span&gt;, assuming that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is chosen randomly from a certain distribution that gives &lt;span class=&quot;math-container&quot;&gt;$s=0^n$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;. In other words, a probabilistic algorithm making &lt;span class=&quot;math-container&quot;&gt;$2^{n/4}$&lt;/span&gt; queries gives only an exponentially small advantage over random guessing. You can find a proof of the stronger claim that &lt;span class=&quot;math-container&quot;&gt;$\Omega(2^{n/2})$&lt;/span&gt; queries are required for a classical algorithm to solve Simon's problem with probability at least 3/4 in these lecture notes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Richard Cleve. &lt;a href=&quot;https://cs.uwaterloo.ca/~cleve/courses/F11CS667/SimonClassicalLB.pdf&quot; rel=&quot;noreferrer&quot;&gt;Classical lower bound for Simon's problem&lt;/a&gt;. Lecture Notes, 2011.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-12-26T16:48:54.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5055" PostTypeId="2" ParentId="5049" CreationDate="2018-12-26T18:39:23.753" Score="1" Body="&lt;p&gt;This is very much possible. And is a very general technique of how product systems in composite states are coupled. Here of the form &lt;span class=&quot;math-container&quot;&gt;$|n_1\rangle |n_2\rangle$&lt;/span&gt;. This kind of general ket is a solution of the Hamiltonian interaction/coupling terms like &lt;span class=&quot;math-container&quot;&gt;$V\sim (a_1^\dagger a_2 +h.c)$&lt;/span&gt; which describe the exchange of one quanta (between the two optical cavities here). &lt;span class=&quot;math-container&quot;&gt;$a_i (a_i^\dagger)$&lt;/span&gt; are the annihilation and creator operators for &lt;span class=&quot;math-container&quot;&gt;$i^{th}$&lt;/span&gt; cavity in second quantisation. It follows similarly for more systems coupled in the form of product states. &#xA;A very general and frequently used is a spin (with an excited and ground state as &lt;span class=&quot;math-container&quot;&gt;$|e\rangle,|g\rangle$&lt;/span&gt;) in an optical cavity with solutions like &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=c_1|e,n\rangle+c_2|g,n+1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of photons in the cavity, and so on for more complicated systems.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-12-26T18:39:23.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5056" PostTypeId="2" ParentId="5048" CreationDate="2018-12-26T19:42:08.783" Score="15" Body="&lt;p&gt;The question is about how many logical qubits it takes to implement Shor's algorithm for factoring an integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; of bit-size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, i.e., a non-negative integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$1 \leq N \leq 2^n{-}1$&lt;/span&gt;. The question is a poignant one and not easy to answer as there are various tradeoffs possible (e.g., between number of qubits and circuit size). &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Executive Summary Answer:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$2n{+}2$&lt;/span&gt; qubits which leads to a quantum circuit implementation that has less than &lt;span class=&quot;math-container&quot;&gt;$448 n^3 \log_2(n)$&lt;/span&gt; number of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-gates. For a bit-size of &lt;span class=&quot;math-container&quot;&gt;$n=1,024$&lt;/span&gt;, this would work out to be &lt;span class=&quot;math-container&quot;&gt;$2050$&lt;/span&gt; logical qubits and &lt;span class=&quot;math-container&quot;&gt;$4.81 \cdot 10^{12}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-gates. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As mentioned in the question, one can apply fast methods such as Schoenhage-Strassen's algorithm for fast multiplication to implement the modular arithmetic asymptotically in &lt;span class=&quot;math-container&quot;&gt;$O(n^2 \log(n) \log \log(n))$&lt;/span&gt; primitive operations (say, over the Clifford&lt;span class=&quot;math-container&quot;&gt;$+T$&lt;/span&gt; gate set). This has been discussed for instance in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9806084&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zalka's paper&lt;/a&gt;. However, it should be pointed out that this is indeed (i) only a statement about asymptotic cost and (ii) only a statement about the number of operations required and does not imply the number of qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding (i), the constant that is hidden in the &quot;O-notation&quot; can be prohibitively large. To the best of my knowledge, it has not been attempted to construct a quantum circuit to implement Shor's algorithm based on Schoenhage-Strassen, so we do not even know upper bounds on what that constant is. The other catch, (ii), is that it is not straightforward to relate the number of qubits and the gate cost as seems to be suggested in the question. Besides the fact that we do not know the constant, there is another issue, namely that a straightforward implementation of Schoenhage-Strassen via Bennett's method would lead to a very large number of logical qubits required. Therefore, even as there are faster methods available for integer multiplication than the simple method of n additions, these are much more non-trivial to code in quantum programming languages such as LIQUi|&gt; and Q#. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of concrete resource estimates for Shor's algorithm, the paper by &lt;a href=&quot;https://arxiv.org/abs/1611.07995&quot; rel=&quot;nofollow noreferrer&quot;&gt;Haener et al&lt;/a&gt; might be a good entry point which implemented the arithmetic in terms of so-called Toffoli gates which have the advantage of being testable at scale on classical input vectors. It is shown in that paper that &lt;span class=&quot;math-container&quot;&gt;$2n{+}2$&lt;/span&gt; logical qubits are sufficient to implement Shor's algorithm for factoring integers using a circuit that uses &lt;span class=&quot;math-container&quot;&gt;$64 n^3 \log_2(n)$&lt;/span&gt; Toffoli gates which yields &lt;span class=&quot;math-container&quot;&gt;$448 n^3 \log_2(n)$&lt;/span&gt; primitive gates (this latter number refers to the number of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-gates and ignores that number of Clifford gates as these are significantly more easy to implement fault-tolerantly). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The currently available Q# implementation of Shor's algorithm (see the &lt;a href=&quot;https://github.com/Microsoft/Quantum/tree/release/v0.3.1810/Samples/src/IntegerFactorization&quot; rel=&quot;nofollow noreferrer&quot;&gt;IntegerFactorization&lt;/a&gt; sample at &lt;a href=&quot;https://github.com/microsoft/quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/quantum&lt;/a&gt;) is based on another way of implementing the arithmetic, namely based on &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0008033&quot; rel=&quot;nofollow noreferrer&quot;&gt;Draper's method&lt;/a&gt; to implement additions using the Fourier basis, see also &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0410184&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. This implementation follows &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0205095v3.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Beauregard's paper&lt;/a&gt; and requires &lt;span class=&quot;math-container&quot;&gt;$2n{+}3$&lt;/span&gt; logical qubits in total. A recent improvement has been obtained by &lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gidney&lt;/a&gt; who reduced the number of clean qubits to &lt;span class=&quot;math-container&quot;&gt;$2n{+}1$&lt;/span&gt; (of which only &lt;span class=&quot;math-container&quot;&gt;$n{+}2$&lt;/span&gt; have to be &quot;clean&quot; qubits, i.e., initialized in a known state. The rest can be &quot;dirty&quot; qubits that can be used and returned in their (unknown) state). Finally, there is &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0601097.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;an interesting claim&lt;/a&gt; by Zalka that the number of qubits can be reduced to &lt;span class=&quot;math-container&quot;&gt;$1.5n{+}2$&lt;/span&gt; (and perhaps even further), however, his proposed solution comes at a dramatic increase of circuit size as it involves inversions and, to my knowledge, has not been verified nor implemented in a programmatic way.   &lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="1828" LastEditDate="2019-01-20T01:18:24.030" LastActivityDate="2019-01-20T01:18:24.030" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5057" PostTypeId="1" CreationDate="2018-12-27T04:04:05.053" Score="3" ViewCount="63" Body="&lt;p&gt;In Mermin's &lt;em&gt;Quantum Computer Science&lt;/em&gt;, section 1.10 (Measurement gates and state preparation), Mermin writes that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This role of measurement gates in state preparation follows from the Born rule if the Qbits that are to be prepared already have a state of their own, even though that state might not be known to the user of the quantum computer. It also follows from the generalized Born rule if the Qbits already share an entangled state – again, not necessarily known to the user – with additional (unmeasured) Qbits. But one cannot deduce from the Born rules that measurement gates serve to prepare states for Qbits “off the shelf,” whose past history nobody knows anything about. In such cases the use of measurement gates to assign a state to the Qbits is a reasonable and plausible extension of the Born rules. It is consistent with them, but goes beyond them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why are &quot;off the shelf&quot; qubits any different from qubits whose state is unknown to the user? And why does whatever property these qubits have mean that the use of measurement gates for state preperation doesn't follow directly from the Born rule?&lt;/p&gt;&#xA;" OwnerUserId="5418" LastActivityDate="2018-12-27T04:04:05.053" Title="Why does state preparation of 'off the shelf' qubits not follow from the Born rule (Mermin)?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5058" PostTypeId="1" AcceptedAnswerId="5061" CreationDate="2018-12-27T09:30:39.493" Score="12" ViewCount="1215" Body="&lt;p&gt;I currently have 2 unitary matrices that I want to approximate to a good precision with the fewer quantum gates possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my case the two matrices are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The square root of NOT gate (up to a global phase)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G = \frac{-1}{\sqrt{2}}\begin{pmatrix} i &amp;amp; 1 \\ 1 &amp;amp; i \end{pmatrix} = e^{-\frac{3}{4}\pi} \sqrt{X}$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$$W = &#xA;\begin{pmatrix} &#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0\\&#xA;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{-1}{\sqrt{2}}&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is the following: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I approximate these specific matrices with the fewer quantum gates possible and a good precision?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What I want to have an can afford to have it:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I can afford to use several days/weeks of CPU time and a &lt;strong&gt;lot&lt;/strong&gt; of RAM.&lt;/li&gt;&#xA;&lt;li&gt;I can afford to spend 1 or 2 human days searching for mathematical tricks (in last resort, that is why I ask here first). This time does not include the time I would need to implement the hypothetical algorithms used for the first point.&lt;/li&gt;&#xA;&lt;li&gt;I want the decomposition to be nearly exact. I don't have a target precision at the moment, but the 2 gates above are used extensively by my circuit and I don't want errors to accumulate too much. &lt;/li&gt;&#xA;&lt;li&gt;I want the decomposition to use the fewest quantum gates possible. This point is secondary for the moment.&lt;/li&gt;&#xA;&lt;li&gt;A good method would let me choose the trade-off I want between the number of quantum gates and the precision of the approximation. If this is not possible, an accuracy of at least &lt;span class=&quot;math-container&quot;&gt;$10^{-6}$&lt;/span&gt; (in terms of trace norm) is probably (as said before, I do not have estimates so I am not sure of this threshold) required.&lt;/li&gt;&#xA;&lt;li&gt;The gate set is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left\{ H, X, Y, Z, R_\phi, S, T, R_x, R_y, R_z, \text{CX}, \text{SWAP}, \text{iSWAP}, \sqrt{\text{SWAP}} \right\}&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$R_\phi, \text{SWAP}, \sqrt{\text{SWAP}}$&lt;/span&gt; as described in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipédia&lt;/a&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_A$&lt;/span&gt; the rotation with respect to the axe &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;) and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{iSWAP} = \begin{pmatrix}   1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA;  0 &amp;amp; 0 &amp;amp; i &amp;amp; 0  \\&#xA;  0 &amp;amp; i &amp;amp; 0 &amp;amp; 0  \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1  \\ \end{pmatrix}$$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The methods I know about:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Solovay-Kitaev algorithm. I have an implementation of this algorithm and already tested it on several unitary matrices. The algorithm generates sequences that are quite long and the trade-off [number of quantum gates] VS [precision of the approximation] is not enough parametrisable. Nevertheless, I will execute the algorithm on these gates and edit this question with the results I obtained.&lt;/li&gt;&#xA;&lt;li&gt;Two papers on &lt;a href=&quot;https://arxiv.org/abs/1212.6253&quot; rel=&quot;nofollow noreferrer&quot;&gt;1-qubit gate approximation&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1212.0506&quot; rel=&quot;nofollow noreferrer&quot;&gt;n-qubit gate approximation&lt;/a&gt;. I also need to test these algorithms.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;EDIT: edited the question to make &quot;square root of not&quot; more apparent.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-09-20T13:09:15.767" LastActivityDate="2019-09-20T13:09:15.767" Title="Approximating unitary matrices" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5059" PostTypeId="2" ParentId="5058" CreationDate="2018-12-27T13:50:20.033" Score="4" Body="&lt;p&gt;Neither of these gates require approximate sequences. You can implement them exactly with your specified gate sets with no great effort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Up to a global phase (which should be irrelevant), G is simply &lt;span class=&quot;math-container&quot;&gt;$HSH$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second, &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, is a little more complicated. The way that I constructed this was to think of it as a controlled-Hadamard where I then required a basis change which is created by a controlled-not. One therefore has the circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a9DQG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a9DQG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U=\cos\frac{\pi}{8}\mathbb{I}-i\sin\frac{\pi}{8}Y$&lt;/span&gt;. I always get factors of 2 wrong in these angles, but this is of the form &lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta)$&lt;/span&gt;. I've taken no particular effort to optimise this gate sequence, but this is probably fairly good.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-27T13:50:20.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5060" PostTypeId="2" ParentId="5058" CreationDate="2018-12-27T15:07:54.643" Score="6" Body="&lt;p&gt;When a two qubit gate &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; can be expressed (up to a global phase) in the computational basis by a matrix with entirely real entries, i.e., &lt;span class=&quot;math-container&quot;&gt;$W \in O(4)$&lt;/span&gt;, then there is general construction of implementing the gate with &lt;span class=&quot;math-container&quot;&gt;$CNOTs$&lt;/span&gt; and single qubit gates, please see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308006v3&quot; rel=&quot;noreferrer&quot;&gt;Vatan and Williams&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The construction is optimal in the sense that it requires two CNOT gates and at most 12 single qubit gates (for the most general case of a real two qubit gate).&#xA;The construction is based on the homomorphism:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$SO(4) \approx SU(2) \times SU(2),$$&lt;/span&gt;&#xA;which asserts that any two-qubit gate &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; with real entries can be expressed as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$W = M U M^{\dagger}$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$U\in SU(2) \otimes SU(2)$&lt;/span&gt; , i.e., can be implemented by two single qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; inducing this homomorphism is named by Makhlin the magic matrix, one possible solution is given on the bottom of page 2 in Vatan and Williams work, another possibility is given in equation (10) by &lt;a href=&quot;https://arxiv.org/abs/1111.1487v1&quot; rel=&quot;noreferrer&quot;&gt;Fujii&lt;/a&gt;.&#xA;Vatan and Williams gave a construction with one CNOT for &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ULATR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ULATR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this construction, the full gate implementation given by Vatan and Williams is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j8iz2.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j8iz2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$S_1 = S_z(\frac{\pi}{2})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_1 = S_y(\frac{\pi}{2})$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this construction, it should be a quite an easy exercise to compute the one-qubit gates &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, for your case.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2018-12-27T15:07:54.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5061" PostTypeId="2" ParentId="5058" CreationDate="2018-12-27T15:58:14.047" Score="9" Body="&lt;p&gt;You have picked two particularly simple matrices to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first operation (G) is just the square root of X gate (up to global phase):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WO9Ms.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WO9Ms.png&quot; alt=&quot;G gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your gate set, this is &lt;span class=&quot;math-container&quot;&gt;$R_X(\pi/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second operation (W) is a Hadamard matrix in the middle 2x2 block of an otherwise-identity matrix. Anytime you see this 2x2-in-the-middle pattern you should think &quot;controlled operation conjugated by CNOTs&quot;. And that's exactly what works here (note: you may need to swap the lines; depends on your endianness convention):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lOr2W.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lOr2W.png&quot; alt=&quot;W operation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the only real trouble is how to implement a controlled Hadamard operation. A Hadamard is a 180 degree rotation around the X+Z axis. You can use a 45 degree rotation around the Y axis to move the X+Z axis to the X axis, then do a CNOT in place the CH, then move the axis back:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dHeeR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dHeeR.png&quot; alt=&quot;W operation again&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$Y^{1/4} \equiv R_Y(\pi/4)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2018-12-27T15:58:14.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5063" PostTypeId="1" CreationDate="2018-12-27T22:13:23.120" Score="5" ViewCount="281" Body="&lt;p&gt;I read about the classical-quantum states in the textbook by Mark Wilde and there is an exercise that asks to show the set of classical-quantum states is not a convex set. But I have an argument to show it is a convex set. I wonder whether I made a mistake in my proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the definition of classical-quantum states (definition 4.3.5): &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The density operator corresponding to a classical-quantum ensemble&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\{p_X(x)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\langle x|_X \otimes \rho_A^x\}_{x\in \mathcal{X}}$&lt;/span&gt; is called a classical-quantum state and takes the following form:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\rho_{XA} = \sum_{x \in \mathcal{X}} p_X(x) |x\rangle\langle x|_X \otimes \rho_A^x.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My argument about the set of classical-quantum states is convex is as follows. Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{XA}$&lt;/span&gt; to be two arbitrary classical-quantum states. Specifically, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{XA} = \sum_{x \in \mathcal{I}_1} p_X(x) |x\rangle\langle x|_X \otimes \rho_A^x,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_{XA} = \sum_{x \in \mathcal{I}_2} q_X(x) |x\rangle\langle x|_X \otimes \sigma_A^x,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I}_1 = \{x: p_X(x) \neq 0\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I}_2 = \{x: q_X(x) \neq 0\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we take the union &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I}=\mathcal{I}_1 \cup \mathcal{I}_2$&lt;/span&gt;. We define &lt;span class=&quot;math-container&quot;&gt;$\rho_A^x$&lt;/span&gt; to be an arbitrary density operator for &lt;span class=&quot;math-container&quot;&gt;$x \notin \mathcal{I}_1$&lt;/span&gt; and similarly &lt;span class=&quot;math-container&quot;&gt;$\sigma_A^x$&lt;/span&gt; to be an arbitrary density operator for &lt;span class=&quot;math-container&quot;&gt;$x \notin \mathcal{I}_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then rewrite &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{XA}$&lt;/span&gt; as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{XA} = \sum_{x \in \mathcal{I}} p_X(x) |x\rangle\langle x|_X \otimes \rho_A^x,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_{XA} = \sum_{x \in \mathcal{I}} q_X(x) |x\rangle\langle x|_X \otimes \sigma_A^x.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we are adding zero operators, &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{XA}$&lt;/span&gt; are not changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then for any &lt;span class=&quot;math-container&quot;&gt;$\lambda \in (0,1)$&lt;/span&gt;, we want to show &lt;span class=&quot;math-container&quot;&gt;$\lambda \rho_{XA} + (1-\lambda) \sigma_{XA}$&lt;/span&gt; is a classical-quantum state. &#xA;(Note that the trivial case where &lt;span class=&quot;math-container&quot;&gt;$\lambda =1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lambda = 0$&lt;/span&gt; just gives back &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{XA}$&lt;/span&gt; back, respectively.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now define &lt;span class=&quot;math-container&quot;&gt;$\xi_{XA} :=\lambda \rho_{XA} + (1-\lambda) \sigma_{XA}.$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\xi_{XA} =\lambda \sum_{x \in \mathcal{I}} p_X(x) |x\rangle\langle x|_X \otimes \rho_A^x + (1-\lambda) \sum_{x \in \mathcal{I}} q_X(x) |x\rangle\langle x|_X \otimes \sigma_A^x\\&#xA;=\sum_{x \in \mathcal{I}} |x\rangle\langle x|_X  \otimes (\lambda p_X(x) \rho_A^x + (1-\lambda) q_X(x)\sigma_A^x) \\&#xA;=\sum_{x \in \mathcal{I}} w_X(x)|x\rangle\langle x|_X \otimes \xi_A^x,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$w_X(x) = \lambda p_X(x) + (1-\lambda) q_X(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\xi_A^x = \frac{\lambda p_X(x) \rho_A^x + (1-\lambda) q_X(x)\sigma_A^x}{\lambda p_X(x) + (1-\lambda) q_X(x)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$X \in \mathcal{I}$&lt;/span&gt;, not both &lt;span class=&quot;math-container&quot;&gt;$p_X (x)=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_X(x)=0$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$\lambda \in (0,1)$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$w_X(x) \neq 0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x \in \mathcal{I}.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, &lt;span class=&quot;math-container&quot;&gt;$\sum_{x \in \mathcal{I}} w_X(x) = \sum_{X \in \mathcal{I}} \lambda p_X(x) + (1-\lambda) q_X(x) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the state &lt;span class=&quot;math-container&quot;&gt;$\xi_{XA}$&lt;/span&gt; is a classical-quantum state. &#xA;So, I conclude the set of classical-quantum states is convex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone point out where I made a mistake?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a typo in the textbook?&lt;/p&gt;&#xA;" OwnerUserId="5427" LastEditorUserId="26" LastEditDate="2019-02-07T07:52:31.793" LastActivityDate="2019-02-07T07:52:31.793" Title="Is the set of classical-quantum states convex?" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;mathematics&gt;&lt;density-matrix&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5064" PostTypeId="2" ParentId="5063" CreationDate="2018-12-27T22:34:09.580" Score="5" Body="&lt;p&gt;Your mistake is that you assume that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are classical-quantum in the same classical basis on &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. However, there is no need to do so -- all which is necessary is that there &lt;em&gt;exists&lt;/em&gt; such a basis, which can however depend on the state. As soon as you choose a different classical basis for the two states, your argument breaks down.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2018-12-27T22:34:09.580" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5065" PostTypeId="1" AcceptedAnswerId="5078" CreationDate="2018-12-28T05:11:44.200" Score="2" ViewCount="97" Body="&lt;p&gt;I refer to this &lt;a href=&quot;https://arxiv.org/pdf/1711.01053.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; but reproduce a simplified version of their argument. Apologies if I have misrepresented the argument of the paper!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice has a classical description of a quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Alice and Bob both agree on a two outcome observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. Now, the goal for Bob is to come up with a classical description of a state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; that gives the right measurement statistics i.e. &lt;span class=&quot;math-container&quot;&gt;$Tr(M\rho) \approx Tr(M\sigma)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way this is done is that Bob has a guess state, say the maximally mixed state, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. Alice then tells him the value of &lt;span class=&quot;math-container&quot;&gt;$Tr(M\rho)$&lt;/span&gt;. Bob then measures the maximally mixed state repeatedly (or he runs a classical simulation of this with many copies of the maximally mixed state) and &quot;postselects&quot; the outcomes where he obtains &lt;span class=&quot;math-container&quot;&gt;$Tr(M\rho) \approx Tr(MI)$&lt;/span&gt;. In this way, he obtains a state that reproduces the measurement statistics of the true state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the meaning of postselection in this context? How does Bob go from &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; in this procedure? &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="26" LastEditDate="2018-12-31T16:03:00.807" LastActivityDate="2018-12-31T16:03:00.807" Title="How is postselection used in quantum tomography?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;postselection&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5066" PostTypeId="2" ParentId="5045" CreationDate="2018-12-28T13:36:54.150" Score="6" Body="&lt;p&gt;The equation at the top of the question is not correct: there is a missing factor of &lt;span class=&quot;math-container&quot;&gt;$1/d$&lt;/span&gt; on the right-hand side. Let's eliminate this factor from the left-hand side to make it simpler, so that the equation we want is this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\bigl(\rho^{AB} \bigl(\sigma^A \otimes I\bigr)\bigr) = \text{Tr}\bigl(\rho^A \sigma^A\bigr).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see why this is true, it helps to start with an easy special case, which is that &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; is a product state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho^{AB} = \rho^A \otimes \rho^B.&#xA;$$&lt;/span&gt;&#xA;In this case we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\bigl(\bigl(\rho^A \otimes\rho^B\bigr) \bigl(\sigma^A \otimes I\bigr)\bigr) = \text{Tr}\bigl(\rho^A \sigma^A\bigr)\text{Tr}\bigl(\rho^B\bigr) = \text{Tr}\bigl(\rho^A \sigma^A\bigr),&#xA;$$&lt;/span&gt;&#xA;using just elementary properties of tensor products and their traces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, given that the equation is true in the special case, it has to be true in general because the expressions&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\bigl(\rho^{AB} \bigl(\sigma^A \otimes I\bigr)\bigr)\;\;\text{and}\;\;\text{Tr}\bigl(\rho^A \sigma^A\bigr)&#xA;$$&lt;/span&gt;&#xA;depend linearly on &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt;, and the set of all product states &lt;span class=&quot;math-container&quot;&gt;$\rho^A\otimes\rho^B$&lt;/span&gt; spans the vector space of all operators acting on &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}((X\otimes Y)(Z\otimes I)) = \text{Tr}(XZ)\text{Tr}(Y) = \text{Tr}\bigl(\text{Tr}_B(X\otimes Y)\, Z\bigr)&#xA;$$&lt;/span&gt;&#xA;for all operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt; and all &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;, irrespective of their traces, and therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(W(Z\otimes I)) = \text{Tr}\bigl(\text{Tr}_B(W) Z\bigr)&#xA;$$&lt;/span&gt;&#xA;for all operators &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt; by linearity.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2018-12-28T13:36:54.150" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5067" PostTypeId="2" ParentId="5053" CreationDate="2018-12-28T15:38:40.010" Score="5" Body="&lt;p&gt;Nonlocal games such as the CHSH game are not impartial games in the sense of Sprague-Grundy. Alice and Bob are thought to be cooperating rather than competing, and randomness is central to the study of nonlocal games. Impartial games are competitive, deterministic, and perfect information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A good sanity check when asking about quantizing some classical object is to first see whether it can be meaningfully randomized. &lt;/p&gt;&#xA;" OwnerUserId="483" LastActivityDate="2018-12-28T15:38:40.010" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5068" PostTypeId="1" CreationDate="2018-12-28T23:34:04.383" Score="5" ViewCount="123" Body="&lt;p&gt;If I implement an adder operation in Q#, I'd like to see a quantum circuit diagram of what that adder is doing in order to check that it looks right. Is there a built-in way to do this?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-01T07:32:00.507" LastActivityDate="2019-01-01T07:32:00.507" Title="How do I produce circuit diagrams from a Q# program?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5069" PostTypeId="1" CreationDate="2018-12-29T03:41:57.453" Score="2" ViewCount="75" Body="&lt;p&gt;I'm trying to write unit tests for some small Q# operations. It would be ideal if I could access the wavefunction. Is there a way to get it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpregister&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Microsoft.Quantum.Diagnostics.DumpRegister&lt;/code&gt;&lt;/a&gt;, but it writes its output to the console or a file in a format intended for humans. I don't want to parse a non-trivial file format as part of writing a unit test.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="2879" LastEditDate="2019-11-15T18:07:26.593" LastActivityDate="2019-11-15T18:08:20.667" Title="Programmatic access to wavefunction in Q# for tests" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5070" PostTypeId="1" AcceptedAnswerId="5072" CreationDate="2018-12-29T04:06:38.150" Score="4" ViewCount="198" Body="&lt;p&gt;In Q#'s &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/type-model?view=qsharp-preview#operation-and-function-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;type documentation&lt;/a&gt;, it is mentioned that you can create signatures like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function ConjugateInvertibleWith : (inner: ((Qubit[] =&amp;gt; Unit) : Adjoint),&#xA;                                    outer : ((Qubit[] =&amp;gt; Unit) : Adjoint))&#xA;                                 : ((Qubit[] =&amp;gt; Unit) : Adjoint)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is: how is this function actually implemented.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Presumably a function with this name will return an operation that, when invoked, calls outer, then inner, then adjoint outer. However, I have no idea how to actually write a function like this. In particular, it's not clear how to write the equivalent of a lambda with a closure. For example, if I try to declare an operation inside a function (similar to how you can def inside a def in python), I get a syntax error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this have to be done in a non-Q# library, like in C#, then imported into Q#? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-01T07:32:30.237" LastActivityDate="2019-11-15T18:06:04.070" Title="How do I write functions that modify operations in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5071" PostTypeId="2" ParentId="5069" CreationDate="2018-12-29T05:21:38.723" Score="2" Body="&lt;p&gt;For unit testing, you can use &lt;code&gt;Assert*&lt;/code&gt; operations which allow you to verify that certain properties of the wavefunction match your expectations, for example, &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.arithmetic.assertprobint&quot; rel=&quot;nofollow noreferrer&quot;&gt;AssertProbInt operation&lt;/a&gt; or &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.diagnostics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft.Quantum.Diagnostics namespace&lt;/a&gt;. The documentation mentions some of them &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/libraries/standard/diagnostics&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;; you can also do &quot;Filter by title&quot; for library reference using &quot;Assert&quot; query and check which ones fit your specific goal best.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-11-15T18:08:20.667" LastActivityDate="2019-11-15T18:08:20.667" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5072" PostTypeId="2" ParentId="5070" CreationDate="2018-12-29T05:31:49.120" Score="5" Body="&lt;p&gt;For this example, one obtains a function with that signature by partial application of an operation that is defined outside the body, instead of as a lambda in the function. As a concrete example, consider this non-generic version of the WithA operation, modified from &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/master/Standard/src/Canon/Combinators/With.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q# canon&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation WithA(&#xA;    outer : (Qubit[] =&amp;gt; Unit : Adjoint), &#xA;    inner : (Qubit[] =&amp;gt; Unit : Adjoint), &#xA;    target : Qubit[]) &#xA;    : Unit&#xA;{&#xA;    body (...)&#xA;    {&#xA;        outer(target);&#xA;        inner(target);&#xA;        Adjoint outer(target);&#xA;    }&#xA;    adjoint invert;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This applies the sequence &lt;span class=&quot;math-container&quot;&gt;$|\textrm{target}\rangle\rightarrow\textrm{outer}^\dagger\cdot\textrm{inner}\cdot\textrm{outer}|\textrm{target}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/expressions?view=qsharp-preview#partial-application&quot; rel=&quot;nofollow noreferrer&quot;&gt;partially apply the target&lt;/a&gt;, by using the underscore character in place of an argument, to create the desired signature as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function WithAFunction(&#xA;    outer : (Qubit[] =&amp;gt; Unit : Adjoint), &#xA;    inner : (Qubit[] =&amp;gt; Unit : Adjoint)) &#xA;    : ((Qubit[] =&amp;gt; Unit) : Adjoint)&#xA;{&#xA;    return WithA(outer, inner, _);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5370" LastEditorUserId="2879" LastEditDate="2019-11-15T18:06:04.070" LastActivityDate="2019-11-15T18:06:04.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5073" PostTypeId="1" CreationDate="2018-12-29T09:16:01.983" Score="5" ViewCount="284" Body="&lt;p&gt;Is there any way to get information from intermediate points in the execution of a quantum circuit. This is not possible on real quantum hardware but would be very useful on the Aer simulators for both learning quantum programming and for debugging.&lt;/p&gt;&#xA;" OwnerUserId="1370" LastEditorUserId="26" LastEditDate="2019-03-12T09:15:24.190" LastActivityDate="2019-11-19T22:11:32.227" Title="Introspecting quantum circuit execution on Qiskit Aer simulators" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5074" PostTypeId="1" CreationDate="2018-12-29T16:33:33.893" Score="4" ViewCount="45" Body="&lt;p&gt;I am working in Adiabatic Quantum Computing and I have a &lt;span class=&quot;math-container&quot;&gt;$6\times6$&lt;/span&gt; Hamiltonian. I have only the symbolic expression for its eigenstates which have complicated expressions in solutions of degree &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; characteristic polynomial of the Hamiltonian and even ordinary computing over these eigenstates is beyond the power of Mathematica in my computer.&lt;br&gt;&#xA;I need to evaluate the &lt;strong&gt;Geometric phases&lt;/strong&gt; terms like &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_n|\partial _{\phi}|\psi_n\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is just a driving adiabatic parameter and &lt;span class=&quot;math-container&quot;&gt;$|\psi_n\rangle$&lt;/span&gt; are the solutions to the Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I can get numerics for &lt;span class=&quot;math-container&quot;&gt;$|\psi_n\rangle$&lt;/span&gt; but once I get that, how can I evaluate the differential &lt;span class=&quot;math-container&quot;&gt;$\partial_{\phi}|\psi_n\rangle$&lt;/span&gt;? &#xA;Or to even approximate it in any form? Because it is impossible to get a manipulative symbolic form for &lt;span class=&quot;math-container&quot;&gt;$|\psi_n\rangle$&lt;/span&gt; with such messy calculations, all that can be done is to write Hamiltonian numerically and find the obvious numerical eigenstates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using all kinds of Numerical functions available in Mathematica but such a numerical differentiation in one parameter is not possible for this kind of complexity (takes a lot of time).&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-12-29T16:33:33.893" Title="Numerical approximation to eigenstates and their differentials" Tags="&lt;hamiltonian-simulation&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5075" PostTypeId="1" AcceptedAnswerId="5077" CreationDate="2018-12-29T16:38:13.133" Score="4" ViewCount="120" Body="&lt;p&gt;For example, if I've defined the operation &lt;code&gt;PlusEqual&lt;/code&gt;, I'd like to say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation MinusEqual = Adjoint PlusEqual;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but this produces a syntax error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the only way to do this by exhaustively re-listing all arguments and functors?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation MinusEqual (all_args_and_types_again) : ReturnType {&#xA;    body (...) {&#xA;        return Adjoint AddEqual(all_args);&#xA;    }&#xA;    adjoint auto;&#xA;    controlled auto;&#xA;    controlled adjoint auto;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-01T08:09:44.607" LastActivityDate="2019-01-01T08:09:44.607" Title="How do I name the adjoint of an operation in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5076" PostTypeId="1" AcceptedAnswerId="5087" CreationDate="2018-12-29T18:40:59.860" Score="4" ViewCount="254" Body="&lt;p&gt;Quantum parallelism is usually introduced from CNOT schema, saying that there it results, calling  &lt;span class=&quot;math-container&quot;&gt;$ |c\rangle $&lt;/span&gt; the control and &lt;span class=&quot;math-container&quot;&gt;$|t\rangle$&lt;/span&gt; the target&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle |t\rangle \implies |0\rangle |t\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |1\rangle |t\rangle \implies  |1\rangle X|t\rangle $$&lt;/span&gt;&#xA;Generalizing that for a generic controlled-U gate, it gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|1\rangle |t\rangle \implies |1\rangle U|t\rangle&#xA;$$&lt;/span&gt;&#xA;To note that the separation of the output is possible only if the control &lt;span class=&quot;math-container&quot;&gt;$|c\rangle$&lt;/span&gt; is a pure state (i.e. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a further step it is said that, if &lt;span class=&quot;math-container&quot;&gt;$|t\rangle = |0\rangle$&lt;/span&gt;, the controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; behaves as following&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|c\rangle |0\rangle \implies |c\rangle |f(c)\rangle&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; a proper function, non necessarily equal to &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. More generally &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|c\rangle |t\rangle \implies |c\rangle |t XOR f(c)\rangle &#xA;$$&lt;/span&gt;&#xA;Now my question: from where above two expressions are derived? And how can we build &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; from U? Making some examples with &lt;span class=&quot;math-container&quot;&gt;$C_X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C_Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C_Y$&lt;/span&gt; the unitaries needed for implementing the &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; are always different, and I couldn't find any clear logic for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clarification, or a working examples, would be great!&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="26" LastEditDate="2018-12-31T23:17:14.467" LastActivityDate="2018-12-31T23:17:14.467" Title="How does quantum function parallelism work?" Tags="&lt;quantum-gate&gt;&lt;quantum-parallelism&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5077" PostTypeId="2" ParentId="5075" CreationDate="2018-12-29T18:57:13.610" Score="4" Body="&lt;p&gt;You can define an immutable symbol for &lt;code&gt;MinusEqual&lt;/code&gt; inside the body of an operation which will use it (you can't define it globally):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation UseMinusEqual () : Unit {&#xA;    ...&#xA;    let MinusEqual = Adjoint PlusEqual;&#xA;    MinusEqual(...);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you need &lt;code&gt;MinusEqual&lt;/code&gt; to be a globally visible operation, there is no shorthand syntax for this right now, so the only way to do it is a full operation definition like you say.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2018-12-29T19:08:03.870" LastActivityDate="2018-12-29T19:08:03.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5078" PostTypeId="2" ParentId="5065" CreationDate="2018-12-29T19:08:04.027" Score="1" Body="&lt;p&gt;In principle, Bob here just has to guess the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. &#xA;If he starts with any parametric state &lt;span class=&quot;math-container&quot;&gt;$\sigma(\alpha,\beta)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta\in\mathbb{C}$&lt;/span&gt; and measures the outcome &lt;strong&gt;Tr&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$(M\sigma)$&lt;/span&gt; with the post measurement state &lt;span class=&quot;math-container&quot;&gt;$\sigma '=M\rho M^\dagger/\text{Tr}(M\rho)$&lt;/span&gt;, he receives a number and he has to tune &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; to come close to the value &lt;strong&gt;Tr&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$(M\rho)$&lt;/span&gt;. This tuning is done on the basis of &lt;em&gt;postselection&lt;/em&gt; by which it is implied that he &lt;strong&gt;selects&lt;/strong&gt; the state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; close to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; on the constraint of &lt;strong&gt;minimising&lt;/strong&gt; the relative entropy:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho\text{ln}\rho-\rho\text{ln}\sigma&#xA;\end{equation}&lt;/span&gt;&#xA;so as to move closer to the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, which can be found out in terms of &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt;. In such problems usually one starts with a parametric state in one variable and optimises over it. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2018-12-29T19:08:04.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5079" PostTypeId="2" ParentId="4684" CreationDate="2018-12-29T20:18:30.243" Score="1" Body="&lt;p&gt;This question is precisely answered within the following work:&#xA;&lt;a href=&quot;https://arxiv.org/abs/1511.08144&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1511.08144&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They basically present that quantum bounds are basically the upper bounds for classical probabilistic correlations. And this is not unique to quantum mechanics, the upper bounds can be attained by other frameworks which are deterministic. They present a simple experiment based on &lt;em&gt;tree&lt;/em&gt; network via which this can be realized. &lt;/p&gt;&#xA;" OwnerDisplayName="user5438" LastEditorUserId="26" LastEditDate="2019-01-02T12:21:07.927" LastActivityDate="2019-01-02T12:21:07.927" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5080" PostTypeId="2" ParentId="5076" CreationDate="2018-12-29T20:39:36.587" Score="2" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$cX$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$cY$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt; first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U_Y$&lt;/span&gt; be the 1 qubit unitary such that &lt;span class=&quot;math-container&quot;&gt;$U_Y^\dagger X U_Y = Y$&lt;/span&gt; and similarly for &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. This can be done because they all diagonalize to the same thing &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, so you can find that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as an exercise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you did &lt;span class=&quot;math-container&quot;&gt;$U_Y$&lt;/span&gt; on the target qubit, then a CNOT and then a &lt;span class=&quot;math-container&quot;&gt;$U_Y^\dagger$&lt;/span&gt; on the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the initial state is of the form &lt;span class=&quot;math-container&quot;&gt;$|0\rangle | t \rangle$&lt;/span&gt; then you get &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle ( U_Y | t \rangle )$&lt;/span&gt; after the first step. The second step doesn't change anything and then the third step takes you to &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle ( U_Y^\dagger U_Y | t \rangle )$&lt;/span&gt; which is the same as the starting state. So that agrees with what &lt;span class=&quot;math-container&quot;&gt;$cY$&lt;/span&gt; should have done on this type of state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the initial state is of the form &lt;span class=&quot;math-container&quot;&gt;$|1\rangle | t \rangle$&lt;/span&gt; then you get &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle ( U_Y | t \rangle )$&lt;/span&gt; after the first step. The second step does change things this time. You get &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle ( X U_Y | t \rangle )$&lt;/span&gt;. The third step then takes you to &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle ( U_Y^\dagger X U_Y | t \rangle )$&lt;/span&gt;. But by definition of &lt;span class=&quot;math-container&quot;&gt;$U_Y$&lt;/span&gt; this is &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle ( Y | t \rangle )$&lt;/span&gt;.So that agrees with what &lt;span class=&quot;math-container&quot;&gt;$cY$&lt;/span&gt; should have done on this type of state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same applies mutatis munandis with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; replacing &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; to make &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondarily:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you have some complicated expression for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; but it is written as a product of &lt;span class=&quot;math-container&quot;&gt;$U_1 \cdots U_n$&lt;/span&gt; but you know how to make controlled versions of each of the &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;. Then you can make &lt;span class=&quot;math-container&quot;&gt;$cU$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$cU_1 \cdots cU_n$&lt;/span&gt;. Like &lt;span class=&quot;math-container&quot;&gt;$U=XZY$&lt;/span&gt; turning into &lt;span class=&quot;math-container&quot;&gt;$cX cZ cY$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;General 2-qubit &lt;span class=&quot;math-container&quot;&gt;$cU$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use theorem 5 of &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0308006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; to decompose other controlled unitaries &lt;span class=&quot;math-container&quot;&gt;$cU$&lt;/span&gt; besides those where there exists a &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$V^\dagger X V=U$&lt;/span&gt;. In those cases you can do the first procedure, but if not, you must do something more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 2 qubits with &lt;span class=&quot;math-container&quot;&gt;$f(c)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$f(0)=0$&lt;/span&gt;, then either &lt;span class=&quot;math-container&quot;&gt;$f(1)=1$&lt;/span&gt; in which case you are describing a controlled not or &lt;span class=&quot;math-container&quot;&gt;$f(1)=0$&lt;/span&gt; in which case you are describing the identity.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$f(0)=1$&lt;/span&gt;, then either &lt;span class=&quot;math-container&quot;&gt;$f(1)=1$&lt;/span&gt; in which case you are describing a &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on the target qubit no matter the control. Or &lt;span class=&quot;math-container&quot;&gt;$f(1)=0$&lt;/span&gt; in which case you are doing a controlled NOT but after reversing the way the controls go so that &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; means perform the operation and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; means do not. This would be implemented by conjugating by an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on the control qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should more be thinking of this as building the unitary from the function not the other way around. There are functions &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^c \to \{0,1\}^t$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is the number of control qubits and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is the number of target qubits and XOR is replaced by bitwise XOR in your formula. These give unitary matrices as you describe on &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{c+t}$&lt;/span&gt;. But there are far more unitaries than functions. So you can't expect to go from unitary to function, only the other way around.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2018-12-31T16:12:29.843" LastActivityDate="2018-12-31T16:12:29.843" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5081" PostTypeId="1" AcceptedAnswerId="5082" CreationDate="2018-12-30T03:18:30.217" Score="2" ViewCount="130" Body="&lt;p&gt;If I write this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function f(n: Int) : Double {&#xA;    return 1.5*n;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The arguments to the binary operator do not have a common base type.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apparently I need a function to turn &lt;code&gt;n&lt;/code&gt; from an &lt;code&gt;Int&lt;/code&gt; into a &lt;code&gt;Double&lt;/code&gt;. There are lots of functions going from double to int, like &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/prelude/microsoft.quantum.extensions.math.floor?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Microsoft.Quantum.Extensions.Math.Floor&lt;/code&gt;&lt;/a&gt;, but I wasn't able to find anything from int to double.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-01T07:32:56.420" LastActivityDate="2019-05-13T19:29:02.113" Title="How do I multiply an integer and a double in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5082" PostTypeId="2" ParentId="5081" CreationDate="2018-12-30T04:23:37.837" Score="5" Body="&lt;p&gt;You want the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.extensions.convert.todouble&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Microsoft.Quantum.Extensions.Convert.ToDouble&lt;/code&gt;&lt;/a&gt; function (deprecated in favor of &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.convert.intasdouble&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Microsoft.Quantum.Convert.IntAsDouble&lt;/code&gt;&lt;/a&gt; in 0.6 release).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Extensions.Convert;&#xA;&#xA;function f(n: Int) : Double {&#xA;    return 1.5*ToDouble(n);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason it works this way is because in Q# &lt;code&gt;(Num a) =&amp;gt; a -&amp;gt; a -&amp;gt; a&lt;/code&gt; is not the same as &lt;code&gt;(Num a,Num b) =&amp;gt; a -&amp;gt; b -&amp;gt; a&lt;/code&gt; as Haskell would denote it.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="2879" LastEditDate="2019-05-13T19:29:02.113" LastActivityDate="2019-05-13T19:29:02.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5083" PostTypeId="1" CreationDate="2018-12-30T05:15:20.977" Score="-1" ViewCount="82" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;It is conventional to assume that the state input to the circuit is a&#xA;  computational basis state, usually the state consisting of all&#xA;  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s. This rule is broken frequently in the literature on&#xA;  quantum computation and quantum information, but it is considered&#xA;  polite to inform the reader when this is the case.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does this mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;:  M. Nielsen and I. Chuang. Quantum Computation and Quantum Information. Cambridge UniversityPress, 2000. (1.3.4 Quantum Circuits)&lt;/p&gt;&#xA;" OwnerUserId="5439" LastEditorUserId="26" LastEditDate="2019-01-01T10:08:38.763" LastActivityDate="2019-01-01T10:08:38.763" Title="Default input states of qubits to quantum circuits" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-04-03T13:21:11.020" ContentLicense="CC BY-SA 4.0" />
  <row Id="5084" PostTypeId="2" ParentId="5083" CreationDate="2018-12-30T05:43:36.777" Score="1" Body="&lt;p&gt;You have some quantum algorithms assuming you prepared a special input state which is not represented as a superposition of bitstrings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you can just say you start in the &lt;span class=&quot;math-container&quot;&gt;$| + \rangle$&lt;/span&gt; state for all your qubits.&#xA;Another one is starting in a state where you have encoded your input in the amplitudes of a quantum state (this type of encoding is called amplitude encoding). This is used in quantum linear system solvers (originally HHL) to input a vector in a quantum form to solve a linear system.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2018-12-30T05:43:36.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5085" PostTypeId="1" AcceptedAnswerId="5088" CreationDate="2018-12-30T15:36:45.490" Score="4" ViewCount="172" Body="&lt;p&gt;In Shor's algorithm we require the period to be even. If the period is not even or &lt;span class=&quot;math-container&quot;&gt;$x^{r/2}+1 \equiv 0 \bmod N$&lt;/span&gt; then we have to restart the process and pick a new random &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Why do we know that the process will work for some &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and still be quicker than the current method of just checking if factors work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Here &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the period, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the random number given at the start of Shor's, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number to be factorised.)&lt;/p&gt;&#xA;" OwnerUserId="5328" LastEditorUserId="26" LastEditDate="2018-12-31T16:21:23.107" LastActivityDate="2018-12-31T16:21:23.107" Title="Shor's algorithm effectiveness" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5086" PostTypeId="1" CreationDate="2018-12-30T18:56:38.720" Score="6" ViewCount="64" Body="&lt;p&gt;For example, given the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; gates and Toric codes for a given problem, how to convert this code into the conventional circuit model and vice versa. &#xA;From the literature developed, it seems that they tackle fairly different kinds of problems for these realizations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to write, let's say, Grover's algorithm for a topological experiment? &#xA;What is the correspondence to convert them back and forth? &lt;/p&gt;&#xA;" OwnerDisplayName="user5438" LastEditorUserId="26" LastEditDate="2018-12-31T16:18:41.617" LastActivityDate="2018-12-31T16:18:41.617" Title="Correspondence between the Topological model and Quantum Circuit model" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;&lt;models&gt;&lt;topological-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5087" PostTypeId="2" ParentId="5076" CreationDate="2018-12-31T08:18:39.987" Score="2" Body="&lt;p&gt;Generically, given any controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you cannot go backwards and work out the function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, because it may not exist. For example, controlled-Hadamard takes a basis state and returns a superposition of basis states rather than a single basis state output. So there's no single &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; value to identify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it happens to be the case that for all inputs of the form &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|0\rangle$&lt;/span&gt; you gate an output of the form &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|f(x)\rangle$&lt;/span&gt;, then you could literally just write down a table to the values &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and the corresponding &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. That truth table would define the function. Of course, that does not mean that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle$&lt;/span&gt; necessarily produces &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\oplus f(x)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for controlled-not, one has&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+---+------+&#xA;| x | f(x) |&#xA;+---+------+&#xA;| 0 |    0 |&#xA;| 1 |    1 |&#xA;+---+------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i.e. f(x) is the identity function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you &lt;em&gt;can&lt;/em&gt; do is work in the other direction. If you're given &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, you can figure out the circuit that gives you a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that acts as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle|y\rangle\mapsto |x\rangle|y\oplus f(x)\rangle.$$&lt;/span&gt;&#xA;This is not a quantum problem, but a problem of reversible classical computation (how do you convert a function evaluation into a reversible function, and find the circuit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, imagine I have a two-bit input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and I want to evaluate &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; as the AND function. You need the truth table&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+----+---+------------+&#xA;| x  | y | y XOR f(x) |&#xA;+----+---+------------+&#xA;| 00 | 0 |          0 |&#xA;| 01 | 0 |          0 |&#xA;| 10 | 0 |          0 |&#xA;| 11 | 0 |          1 |&#xA;| 00 | 1 |          1 |&#xA;| 01 | 1 |          1 |&#xA;| 10 | 1 |          1 |&#xA;| 11 | 1 |          0 |&#xA;+----+---+------------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hopefully, you can convince yourself that this is the same as the Toffoli gate (controlled-controlled-not).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-31T08:18:39.987" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5088" PostTypeId="2" ParentId="5085" CreationDate="2018-12-31T08:23:45.427" Score="5" Body="&lt;p&gt;Check out Thoerem 5.3 in Nielsen and Chuang. It conveys that we are almost guaranteed to get a good value of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (the probability is stated to be at least &lt;span class=&quot;math-container&quot;&gt;$1-\frac{1}{2^m}$&lt;/span&gt; where there are &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; unique prime factors of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;). The expected number of repetitions of the algorithm (due to this effect) is only just more than 1. At worst, it's 2. There's no absolute guarantee that in a particular instance you wouldn't need many, many repetitions, it's just ridiculously unlikely.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2018-12-31T08:23:45.427" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5089" PostTypeId="2" ParentId="5068" CreationDate="2018-12-31T09:06:04.667" Score="8" Body="&lt;p&gt;Unfortunately, there is indeed currently no way to generate circuit diagrams from a Q# program. Since this is a feature request, consider making it here: &lt;a href=&quot;https://quantum.uservoice.com/forums/906940-debugging-and-simulation&quot; rel=&quot;noreferrer&quot;&gt;https://quantum.uservoice.com/forums/906940-debugging-and-simulation&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give a little bit of context, Q# makes a conscious effort to encourage reasoning about quantum algorithms in terms of control flow and transformations rather than circuits, allowing e.g. qubit aliasing. Correspondingly, the kit focuses on tools that are commonly used in software engineering like unit testing instead of circuit diagrams. I can understand that a diagram may come in handy for publications, though it is certainly not unheard of to give pseudo code instead. &lt;/p&gt;&#xA;" OwnerUserId="5448" LastActivityDate="2018-12-31T09:06:04.667" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5090" PostTypeId="5" CreationDate="2018-12-31T23:26:32.347" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-31T23:26:32.347" LastActivityDate="2018-12-31T23:26:32.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5091" PostTypeId="4" CreationDate="2018-12-31T23:26:32.347" Score="0" Body="For questions about quantum state tomography, that is, the process of fully characterizing a quantum state from experimental measurements." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-03-12T17:59:14.150" LastActivityDate="2021-03-12T17:59:14.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5092" PostTypeId="5" CreationDate="2018-12-31T23:31:40.337" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-31T23:31:40.337" LastActivityDate="2018-12-31T23:31:40.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5093" PostTypeId="4" CreationDate="2018-12-31T23:31:40.337" Score="0" Body="The hidden subgroup problem (HSP) is a topic of research in mathematics and theoretical computer science. The framework captures problems like factoring, discrete logarithm, graph isomorphism, and the shortest vector problem. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2018-12-31T23:31:40.337" LastActivityDate="2018-12-31T23:31:40.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5094" PostTypeId="5" CreationDate="2018-12-31T23:38:53.523" Score="0" Body="&lt;p&gt;The &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Partial_trace&quot; rel=&quot;nofollow noreferrer&quot;&gt;partial trace&lt;/a&gt;&lt;/em&gt; is a generalization of the notion of &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_(linear_algebra)&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace&lt;/a&gt; which is defined for multipartite systems.&lt;/p&gt;&#xA;&lt;p&gt;For example, given a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system with density matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_{AB}=\begin{pmatrix}&#xA;\rho_{11} &amp;amp;\rho_{12} &amp;amp;\rho_{13} &amp;amp;\rho_{14} \\&#xA;\rho_{21} &amp;amp;\rho_{22} &amp;amp;\rho_{23} &amp;amp;\rho_{24} \\&#xA;\rho_{31} &amp;amp;\rho_{32} &amp;amp;\rho_{33} &amp;amp;\rho_{34} \\&#xA;\rho_{41} &amp;amp;\rho_{42} &amp;amp;\rho_{43} &amp;amp;\rho_{44}&#xA;\end{pmatrix},&#xA;\end{equation}&lt;/span&gt;&#xA;one can compute the partial traces with respect to either system:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if we &amp;quot;trace out&amp;quot; the second system, which we will label with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, we get the residual state:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\newcommand{\Tr}{\operatorname{Tr}}&#xA;\rho_{A}=\Tr_{B}(\rho_{AB})=\begin{pmatrix}&#xA;\Tr\begin{pmatrix}&#xA;\rho_{11} &amp;amp;\rho_{12} \\&#xA;\rho_{21} &amp;amp;\rho_{22}&#xA;\end{pmatrix}&#xA;&amp;amp;\Tr\begin{pmatrix}&#xA; \rho_{13} &amp;amp;\rho_{14} \\&#xA; \rho_{23} &amp;amp;\rho_{24}&#xA;\end{pmatrix}\\&#xA;\Tr\begin{pmatrix}&#xA;\rho_{31} &amp;amp;\rho_{32} \\&#xA;\rho_{41} &amp;amp;\rho_{42}&#xA;\end{pmatrix}&#xA;&amp;amp;\Tr\begin{pmatrix}&#xA; \rho_{33} &amp;amp;\rho_{34} \\&#xA; \rho_{43} &amp;amp;\rho_{44}&#xA;\end{pmatrix}&#xA;\end{pmatrix}=&#xA;\begin{pmatrix}&#xA;\rho_{11}+\rho_{22} &amp;amp; \rho_{13}+\rho_{24}\\&#xA;\rho_{31}+\rho_{24} &amp;amp; \rho_{33}+\rho_{44}&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if we &amp;quot;trace out&amp;quot; the first system, labelled with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, the residual state is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_{B}=\Tr_{A}(\rho_{AB})=\begin{pmatrix}&#xA;\Tr\begin{pmatrix}&#xA;\rho_{11} &amp;amp;\rho_{13} \\&#xA;\rho_{31} &amp;amp;\rho_{33}&#xA;\end{pmatrix}&#xA;&amp;amp;\Tr\begin{pmatrix}&#xA; \rho_{12} &amp;amp;\rho_{14} \\&#xA; \rho_{32} &amp;amp;\rho_{34}&#xA;\end{pmatrix}\\&#xA;\Tr\begin{pmatrix}&#xA;\rho_{21} &amp;amp;\rho_{23} \\&#xA;\rho_{41} &amp;amp;\rho_{43}&#xA;\end{pmatrix}&#xA;&amp;amp;\Tr\begin{pmatrix}&#xA; \rho_{22} &amp;amp;\rho_{24} \\&#xA; \rho_{42} &amp;amp;\rho_{44}&#xA;\end{pmatrix}&#xA;\end{pmatrix}=&#xA;\begin{pmatrix}&#xA;\rho_{11}+\rho_{33} &amp;amp; \rho_{12}+\rho_{34}\\&#xA;\rho_{21}+\rho_{43} &amp;amp; \rho_{22}+\rho_{44}&#xA;\end{pmatrix}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-04-12T12:41:47.197" LastActivityDate="2021-04-12T12:41:47.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5095" PostTypeId="4" CreationDate="2018-12-31T23:38:53.523" Score="0" Body="For questions centred around or involving the notion of partial trace. The partial trace is a generalization of the notion of trace defined for multipartite systems." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-04-12T12:44:48.300" LastActivityDate="2021-04-12T12:44:48.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5096" PostTypeId="1" AcceptedAnswerId="15164" CreationDate="2019-01-01T02:11:15.017" Score="4" ViewCount="183" Body="&lt;p&gt;Shor's algorithm works with very large integers; larger than 64 bits. So the built-in 64-bit &lt;code&gt;Int&lt;/code&gt; type is insufficient for doing the classical processing (e.g. computing the multipliers &lt;span class=&quot;math-container&quot;&gt;$b^{2^k} \pmod{N}$&lt;/span&gt;). Is there a big int type suitable for those purposes?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-01-03T18:16:29.800" LastActivityDate="2020-12-16T17:50:30.830" Title="Does Q# have a bigint type?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5097" PostTypeId="2" ParentId="5068" CreationDate="2019-01-01T04:23:37.520" Score="3" Body="&lt;p&gt;Q#'s full state simulator has an &lt;code&gt;OnOperationStart&lt;/code&gt; and &lt;code&gt;OnOperationEnd&lt;/code&gt; events that, as the names imply, are triggered every time a quantum operation starts/ends. Thus the easiest way to get and print the sequence of gates would be to attach a handler to the &lt;code&gt;OnOperationStart&lt;/code&gt;, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        using (var qsim = new QuantumSimulator())&#xA;        {&#xA;            qsim.OnOperationStart += (op, arg) =&amp;gt; Console.WriteLine($&quot;{op.Name}:{op.Variant}&quot;);&#xA;&#xA;            HelloQ.Run(qsim).Wait();&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The event sends two parameters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;the operation itself&lt;/strong&gt;, exposed via the &lt;code&gt;ICallable&lt;/code&gt; interface; from it, you can get the &lt;code&gt;Name&lt;/code&gt; (e.g. &lt;code&gt;X&lt;/code&gt;), the &lt;code&gt;FullName&lt;/code&gt; (e.g. &lt;code&gt;Microsoft.Quantum.Primitive.X&lt;/code&gt;) or the &lt;code&gt;Variant&lt;/code&gt; (i.e.  &lt;code&gt;Body&lt;/code&gt;, &lt;code&gt;Adjoint&lt;/code&gt;, &lt;code&gt;Controlled&lt;/code&gt; or &lt;code&gt;ControlledAdjoint&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;the argument tuple&lt;/strong&gt;, exposed via the &lt;code&gt;IApplyData&lt;/code&gt; interface; from it you can get the actual values the operation received or just the list of Qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This doesn't produce the circuit diagram, but as you point out, could allow you to print and feed the list of operations to other tools.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're still actively working on this part of the Quantum Development Kit, which is why it still needs much more documentation. However, we're active monitoring stackoverflow so please let us know if you need any more help.&lt;/p&gt;&#xA;" OwnerUserId="2918" LastActivityDate="2019-01-01T04:23:37.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5098" PostTypeId="5" CreationDate="2019-01-01T09:19:56.763" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-01T09:19:56.763" LastActivityDate="2019-01-01T09:19:56.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5099" PostTypeId="4" CreationDate="2019-01-01T09:19:56.763" Score="0" Body="For questions about completely positive (CP) linear maps between quantum states. Can also be used for trace-preserving CP maps (quantum channels). For questions about unitary operations, please use quantum-gate instead." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-07-26T17:57:32.783" LastActivityDate="2020-07-26T17:57:32.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5102" PostTypeId="2" ParentId="4977" CreationDate="2019-01-01T20:32:07.120" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is it possible to emulate a quantum network over a classic network?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Yes.&lt;/strong&gt; The following projects are currently available:&lt;/p&gt;&#xA;&lt;h3&gt;SimulaQron&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://softwarequtech.github.io/SimulaQron/html/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;SimulaQron&lt;/a&gt; is a distributed simulation of the end nodes in a future quantum internet with the specific goal to explore application development. The end nodes in a quantum internet are few qubit processors, which may exchange qubits using a quantum internet. Specifically, &lt;em&gt;SimulaQron allows the installation of a local simulation program on each computer in the network that provides the illusion of having a local quantum processor to potential applications. The local simulation programs on each classical computer connect to each other classically, forming a simulated quantum internet allowing the exchange of simulated qubits between the different network nodes, as well as the creation of simulated entanglement.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3&gt;Squanch&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Simulator for Quantum Networks and Channels (&lt;a href=&quot;https://arxiv.org/abs/1808.07047&quot; rel=&quot;nofollow noreferrer&quot;&gt;SQUANCH&lt;/a&gt;) is an open-source Python library for creating parallelized simulations of distributed quantum information processing. The framework includes many features of a general-purpose quantum computing simulator, but it is optimized specifically for simulating quantum networks. It includes functionality to allow users to easily design complex multi-party quantum networks, extensible classes for modeling noisy quantum channels, and a multiprocessed NumPy backend for performant simulations.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3&gt;NetSquid&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Currently under development at QuTech, &lt;a href=&quot;https://netsquid.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;NetSquid&lt;/a&gt; is the world’s first network simulator that is capable of simulating the decay of quantum information over time together with noisy operations and stochastic feedback loops. Its primary use is the prediction of the performance of quantum network protocols in a physically-realistic setting.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-01-01T20:32:07.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5103" PostTypeId="1" AcceptedAnswerId="5113" CreationDate="2019-01-02T04:31:17.803" Score="2" ViewCount="330" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Figure 1.16:&lt;/strong&gt; FANOUT with the Toffoli gate, with the second bit being the input to the FANOUT (and the other two bits standard ancilla states), and the output from the FANOUT appearing on the second and third bits. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/54sKn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/54sKn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; Quantum Computation and Quantum Information: 10th Anniversary Edition (Fig 1.16, p.30) &lt;br&gt;by &lt;em&gt;Michael A. Nielsen &amp;amp; Isaac L. Chuang&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can we say that the third qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume &lt;span class=&quot;math-container&quot;&gt;$a = x|0\rangle + y|1\rangle$&lt;/span&gt;. We know that the output of the bottom two qubits is &lt;span class=&quot;math-container&quot;&gt;$x|00\rangle+y|11\rangle$&lt;/span&gt; (entangled qubits) and the output of the second qubit must be &lt;span class=&quot;math-container&quot;&gt;$x|0\rangle+y|1\rangle$&lt;/span&gt;. Which says that they both have to be in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; at the same time, and so the third qubit should have the same probabilities as like of the second qubit. But it can be &lt;span class=&quot;math-container&quot;&gt;$-x|0\rangle + y|1\rangle$&lt;/span&gt; and many more possibilities as &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are complex (as probabilities are square of modulo of coefficients). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please correct me if my interpretation and understanding is wrong.&lt;/p&gt;&#xA;" OwnerUserId="5439" LastEditorUserId="26" LastEditDate="2019-01-02T05:39:15.523" LastActivityDate="2019-01-03T21:53:49.153" Title="FANOUT with Toffoli Gate" Tags="&lt;quantum-gate&gt;&lt;classical-computing&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5104" PostTypeId="1" CreationDate="2019-01-02T04:59:25.463" Score="2" ViewCount="162" Body="&lt;p&gt;Given a two-qubit state of equal superposition, what is the post-measurement state (should be the same number of qubits that have changed as a result of the measurement) on one of the two qubits and the probabilities that the state will be in a given state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input state &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; CNOT &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; Measurement&lt;/p&gt;&#xA;" OwnerUserId="5460" LastEditorUserId="26" LastEditDate="2019-01-02T12:02:22.107" LastActivityDate="2019-01-02T12:02:22.107" Title="What is the post measurement state given an input and the outcome measurement?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5105" PostTypeId="2" ParentId="5104" CreationDate="2019-01-02T05:34:18.660" Score="1" Body="&lt;p&gt;If I interpret the question correctly, we start with a state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle)$&lt;/span&gt; (an equal superposition of all basis states on 2 qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After we apply a CNOT, the state doesn't actually change (if the first qubit is the control, the &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; components swap amplitudes but they are equal, so nothing changes).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After we measure one of the qubits, we get 0 with probability 50% and 1 with probability 50%, and the state of the second qubit is guaranteed to be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt;. You can see this easily if you use the fact that the state is separable: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle) = \frac{1}{\sqrt2}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt;, so the measurement of one qubit doesn't affect the state of the second one.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-02T05:34:18.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5106" PostTypeId="1" CreationDate="2019-01-02T05:43:27.600" Score="3" ViewCount="459" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What are some examples of measuring qubits in different&#xA;  basis states (it's known that preferable choices are the computation&#xA;  basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and the Bell basis states&#xA;  &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; on a two-qubit system)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Context:&lt;/strong&gt; I am an undergraduate sophomore working on quantum information with a professor so this isn't for a class. Over break, I was given the task of writing a Mathematica function that provides a numerical modeling procedure for measuring a qubit. The function's inputs are the quantum state, measurement basis, and which qubit to measure. The outputs of the function are the post-measurement state of the qubit, and what the outcome of the measurement is (being &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) by running a similar function to a density probability. That being said, I am still in the process of learning this material. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5460" LastEditorUserId="26" LastEditDate="2019-01-02T07:56:31.377" LastActivityDate="2019-01-02T07:56:31.377" Title="What are some examples of measuring qubits in different basis states?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5107" PostTypeId="2" ParentId="5106" CreationDate="2019-01-02T07:56:25.047" Score="2" Body="&lt;p&gt;The way that you phrase the question makes it sound like you're given a pure state, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, and you are tasked with performing a single qubit projective measurement on a given qubit, &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. That's adding in a little precision to your statement which may not be accurate, so please clarify if it's not (because you also mention a Bell basis measurement).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably the easiest way to specify a one-qubit measurement is to accept 3-component real vector &lt;span class=&quot;math-container&quot;&gt;$\underline{n}=(n_x,n_y,n_z)$&lt;/span&gt; which satisfies &lt;span class=&quot;math-container&quot;&gt;$\underline{n}\cdot\underline{n}=1$&lt;/span&gt;. This corresponds to a measurement observable &lt;span class=&quot;math-container&quot;&gt;$M=n_xX+n_yY+n_zZ$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; are the standard Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To calculate the probability of getting the &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; measurement outcomes on qubit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, you calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{\pm}=\frac12\pm\langle\psi|\mathbb{I}^{\otimes(k-1)}\otimes M\otimes\mathbb{I}^{\otimes(n-k)}|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;and the post-measurement state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(|\psi\rangle\pm\mathbb{I}^{\otimes(k-1)}\otimes M\otimes\mathbb{I}^{\otimes(n-k)}|\psi\rangle\right)/\sqrt{p_{\pm}},&#xA;$$&lt;/span&gt; &#xA;depending on which of the two outcomes was obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are alternative approaches to calculating the effect of the measurement. Take a look at the answers to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4413/1837&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-02T07:56:25.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5108" PostTypeId="1" AcceptedAnswerId="5110" CreationDate="2019-01-02T17:26:56.797" Score="3" ViewCount="96" Body="&lt;p&gt;In Nielsen and Chuang, it is stated that the photonic phase shift gate acts on the single photon states as &lt;span class=&quot;math-container&quot;&gt;$P|0\rangle \ = \ |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P|1\rangle \ = \ e^{i\Delta}|1\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Delta \ = \ (n \ - \ n_0)L/c_0$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the index of refraction of the phase shifter, &lt;span class=&quot;math-container&quot;&gt;$n_0$&lt;/span&gt; is the index of refraction of the surrounding space in which the photon is propagating, &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is the distance the photon travels through the phase shifter, and &lt;span class=&quot;math-container&quot;&gt;$c_0$&lt;/span&gt; is the speed of light in a vacuum. It is then stated that the phase shifter acting on the dual-rail photon state is equal to: &lt;span class=&quot;math-container&quot;&gt;$a_0e^{-i\Delta/2}|01\rangle \ + \ a_1e^{i\Delta/2}|10\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt; are simply the coefficients on the different states. How exactly was this result obtained?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2019-01-02T17:42:49.010" LastActivityDate="2019-01-03T14:57:15.267" Title="Phase shifter acting on double rail states" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;photonics&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5109" PostTypeId="1" AcceptedAnswerId="5111" CreationDate="2019-01-02T21:11:41.560" Score="3" ViewCount="204" Body="&lt;p&gt;I have some understanding that with qubits, I can represent a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; size vector using only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. However, I'm having trouble putting this together in a way that can make a useful circuit. Say I want to represent the input &lt;span class=&quot;math-container&quot;&gt;$(0 \ 0 \ 0 \ 1)$&lt;/span&gt; for my circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should be able to do this with only 2 qubits. Starting with the initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle$&lt;/span&gt;, which as far as I know represents the vector &lt;span class=&quot;math-container&quot;&gt;$(1 \ 0 \ 1 \ 0)$&lt;/span&gt;, I can use a not gate on the second qubit to transform that to &lt;span class=&quot;math-container&quot;&gt;$(1 \ 0 \ 0 \ 1)$&lt;/span&gt;. However, I'm not sure what operation I can do to put the first qubit into a &lt;span class=&quot;math-container&quot;&gt;$(0 \ 0)$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On top of that, I have even less of an idea of how to represent real-value vectors, like &lt;span class=&quot;math-container&quot;&gt;$(0.5 \ 0.5)$&lt;/span&gt; (assuming including a normalization constant). I have a feeling I can use phase, but I'm not sure how to set up a circuit to achieve this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;Realized my earlier representation was very off. The initial state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is the same as the vector &lt;span class=&quot;math-container&quot;&gt;$(1 \ 0 \ 0 \ 0)$&lt;/span&gt;, so transforming that into the the desired &lt;span class=&quot;math-container&quot;&gt;$(0 \ 0 \ 0 \ 1)$&lt;/span&gt; Would just require two NOT gates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0 -- NOT -- 1&#xA;0 -- NOT -- 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I'm still unsure how to represent real-valued vectors, or even a vector like &lt;span class=&quot;math-container&quot;&gt;$(1 \ 0 \ 1 \ 0)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5465" LastEditorUserId="26" LastEditDate="2019-01-03T14:46:55.200" LastActivityDate="2019-01-03T14:46:55.200" Title="Representing a real valued vector with qubits" Tags="&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5110" PostTypeId="2" ParentId="5108" CreationDate="2019-01-02T23:24:10.737" Score="3" Body="&lt;p&gt;Start in&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a_0 | 01 \rangle + a_1 | 10 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then apply &lt;span class=&quot;math-container&quot;&gt;$P \otimes I$&lt;/span&gt; to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a_0 * 1 | 01 \rangle + a_1*e^{i \Delta} | 10 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that is the same up to phase as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-i \Delta /2} (a_0 * 1 | 01 \rangle + a_1*e^{i \Delta} | 10 \rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which simplifies to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a_0 e^{-i \Delta /2} | 01 \rangle + a_1 e^{i \Delta /2} | 10 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-01-02T23:24:10.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5111" PostTypeId="2" ParentId="5109" CreationDate="2019-01-02T23:31:21.173" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(1,0,1,0)$&lt;/span&gt; means&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;1 (1,0,0,0) + 1 (0,0,1,0)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you already know how &lt;span class=&quot;math-container&quot;&gt;$| 0 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; correspond.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make &lt;span class=&quot;math-container&quot;&gt;$(0,0,1,0)$&lt;/span&gt; the encoding would be &lt;span class=&quot;math-container&quot;&gt;$| 1 0 \rangle$&lt;/span&gt;. I'm assuming you are reading the entries as 0,1,2,3 in that order for the vector and the first qubit corresponds to the most significant bit. (Little vs Big endian). If not, make the necessary changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all together you need &lt;span class=&quot;math-container&quot;&gt;$1 | 00 \rangle + 1 | 10 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other combinations like &lt;span class=&quot;math-container&quot;&gt;$(a_0 , 0 , a_2 , 0)$&lt;/span&gt; change the coefficents. &lt;span class=&quot;math-container&quot;&gt;$a_0 | 00 \rangle + a_2 | 10 \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-01-02T23:31:21.173" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5112" PostTypeId="2" ParentId="5108" CreationDate="2019-01-03T14:57:15.267" Score="1" Body="&lt;p&gt;&lt;em&gt;For the former part:&lt;/em&gt;&#xA;Even a simple slab of glass can act as a phase shift quantum gate.&#xA;The difference in path covered is &lt;span class=&quot;math-container&quot;&gt;$(n-n_0)L \equiv \delta L$&lt;/span&gt; and the time difference is &lt;span class=&quot;math-container&quot;&gt;$\delta L/c_0$&lt;/span&gt; and then the phase shift is proportional to this time shift. Or just divide this time phase difference by some time &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; taken by the light in a vacuum to travel the same length &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;, often taken to be any constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For the latter part:&lt;/em&gt;&#xA;Simply apply the operator &lt;span class=&quot;math-container&quot;&gt;$P\otimes I $&lt;/span&gt; on a dual rail &lt;span class=&quot;math-container&quot;&gt;$a_0|01\rangle +a_1|10\rangle.$&lt;/span&gt;&#xA;The fact that has been used here is that the &lt;strong&gt;global phase&lt;/strong&gt; is not an observable and only the relative phase is what leads to observable quantities. It disappears when you calculate any inner product. We can safely drop the global phase as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;a_1e^{i\theta}|\psi_1\rangle+a_2e^{i\phi}|\psi_2\rangle \equiv e^{i\theta}(a_1|\psi_1\rangle+a_2e^{i(\phi-\theta)}|\psi_2\rangle)&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; \equiv (a_1|\psi_1\rangle+a_2e^{i(\phi-\theta)}|\psi_2\rangle)&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; \equiv (a_1e^{-i(\phi-\theta)/2}|\psi_1\rangle+a_2e^{i(\phi-\theta)/2}|\psi_2\rangle)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-01-03T14:57:15.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5113" PostTypeId="2" ParentId="5103" CreationDate="2019-01-03T21:53:49.153" Score="2" Body="&lt;p&gt;This section of Nielsen &amp;amp; Chuang is talking specifically about simulating a classical circuit with a quantum circuit using Toffoli gate. So &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) the state &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; will not be in superposition, since you're simulating a classical circuit and you can't have superposition in a classical circuit; &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; will always be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) you know the state of the third qubit is &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; because the circuit is defined to used Toffoli gate, and this is the definition of how Toffoli gate acts when input qubits are &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. If a different gate was used the third qubit could be in a different state, but with this gate it will be in this state.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-03T21:53:49.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5114" PostTypeId="2" ParentId="5096" CreationDate="2019-01-04T01:40:57.067" Score="6" Body="&lt;p&gt;There is none at the moment (as of version 0.3). We're working on adding it as a primitive type, hopefully it will be included in the next release.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-04T01:40:57.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5115" PostTypeId="2" ParentId="5096" CreationDate="2019-01-04T10:30:57.687" Score="2" Body="&lt;p&gt;In the meantime you could make&lt;/p&gt;&#xA;&#xA;&lt;p&gt;newtype LongInt = (Int,Int)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where (a,b) could represent the integer &lt;span class=&quot;math-container&quot;&gt;$(2^{64}*a)+(b+2^{63})$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The arithmetic operations for this would then be overridden so you define your own (a,b)*(c,d) that gives another LongInt but with potential for overflow. So if this could be wrapped in Maybe monad, that would be better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continue this way like &quot;long long int&quot; that are 4 times the length of a standard 16 bit int in C.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could make a different choice of how you want to encode larger integers as combinations of Int if you want.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-01-04T10:30:57.687" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5116" PostTypeId="2" ParentId="2177" CreationDate="2019-01-04T13:22:22.063" Score="10" Body="&lt;p&gt;I want to add a method that does not use ancilla qubits, but does require gates more complicated than just controlled-not. I believe this method was first presented by Barenco et. al. &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9503016.pdf&quot; rel=&quot;noreferrer&quot;&gt;in this paper&lt;/a&gt;, Lemma 7.5:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/r1ujX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/r1ujX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$V^2=U$&lt;/span&gt;. In this case, one wants that &lt;span class=&quot;math-container&quot;&gt;$V^2=X$&lt;/span&gt;, and hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V = &#xA;\frac{1}{2}&#xA;\begin{pmatrix}&#xA;1+i &amp;amp; 1-i \\&#xA;1-i &amp;amp; 1+i \\&#xA;\end{pmatrix} \ .&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a recursive definition, so the control n qubit gate is defined in terms of the control n-1 qubit gate. This would continue until you reach the two qubit gate CNOT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implementation is a little difficult, however, a simpler one exists if one does not mind collecting a relative phase (see Lemma 7.9 of the same paper).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement a gate such as &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; in QISKIT, you will need to use the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=002-The_Weird_and_Wonderful_World_of_the_Qubit~2F004-advanced_qubit_gates&quot; rel=&quot;noreferrer&quot;&gt;advanced single qubit gates.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4230" LastActivityDate="2019-01-04T13:22:22.063" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5117" PostTypeId="2" ParentId="2230" CreationDate="2019-01-04T23:59:31.417" Score="4" Body="&lt;p&gt;For superconducting qubits, x and y rotations are usually both done with microwave pulses, and as you said the phase of the pulse determines the rotation axis. See mathematical details in this Physics Stack Exchange post: &lt;a href=&quot;https://physics.stackexchange.com/q/138765&quot;&gt;How do we perform transverse measurements in a two level system?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rotations about the z axis are quite different; they are done by changing the qubit's resonance frequency (a.k.a. &quot;detune&quot;) for a specified duration of time. For example, detuning by 1 MHz for 100 ns gives a z-axis rotation by 1/10 of a full rotation.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="26" LastEditDate="2019-01-05T10:00:41.500" LastActivityDate="2019-01-05T10:00:41.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5118" PostTypeId="1" CreationDate="2019-01-05T00:09:50.040" Score="8" ViewCount="1029" Body="&lt;p&gt;I'm aware that the optimality of the quantum strategy for the CHSH game is given by &lt;a href=&quot;https://en.wikipedia.org/wiki/Tsirelson%27s_bound&quot; rel=&quot;noreferrer&quot;&gt;Tsirelson's bound&lt;/a&gt;, but presentations all skip over the (admittedly much less interesting) proof of the classical strategy's optimality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the CHSH game, we have two players: Alice and Bob. They are separately given independent random bits &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; as input, and without communication must output bits of their own (&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;) with the goal of making true the logical formula &lt;span class=&quot;math-container&quot;&gt;$X \cdot Y = A \oplus B$&lt;/span&gt;. The claimed optimal classical strategy is for Alice and Bob to both always output &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, which results in a win 75% of the time:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{array}{|c|c|c|c|c|c|}&#xA;\hline&#xA;X &amp;amp; Y &amp;amp; A &amp;amp; B &amp;amp; X \cdot Y &amp;amp; A \oplus B \\ \hline&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ \hline&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ \hline&#xA;\end{array}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum strategy (which I go over &lt;a href=&quot;https://medium.com/@ahelwer/walking-the-faster-than-light-tightrope-35147a7c6e3d&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;) results in a win ~85% of the time. You can use this in a proof of the insufficiency of local hidden variables to explain entanglement as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Assume qbits decide at time of entanglement how they will collapse (rather than at time of measurement); this means they must carry with them some information (the local hidden variable), and this information can be written as a string of bits.&lt;/li&gt;&#xA;&lt;li&gt;Since the information is sufficient to completely describe the way in which the entangled qbits collapse, Alice and Bob could, if given access to that same string of classical bits, simulate the behavior of a shared pair of entangled qbits.&lt;/li&gt;&#xA;&lt;li&gt;If Alice and Bob could simulate the behavior of a shared pair of entangled qbits, they could implement the quantum strategy with local classical methods using the pre-shared string of classical bits. Thus, there must exist some classical strategy giving an 85% success rate with some string of bits as input.&lt;/li&gt;&#xA;&lt;li&gt;However, there exists no string of bits which enables a classical strategy with success rate above 75%.&lt;/li&gt;&#xA;&lt;li&gt;By contradiction, the behavior of entangled particles is not reducible to a string of bits (local hidden variable) and thus the entangled particles must instantaneously affect one another at time of measurement.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'm interested in the proof of (4). I imagine this proof takes the form of a noncommunicative pair of Turing machines which take as input independent random bits &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; plus an arbitrary shared bitstring, which then win the CHSH game with probability greater than 75%; presumably this results in some contradiction demonstrating the nonexistence of such TMs. So what is this proof?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondarily, which papers have presented a proof of the classical strategy's optimality?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus question: in (1), we claim that the local hidden variable can be written as a string of bits; is there a simple reason why this is the case?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-01-19T20:51:34.763" Title="Proof of optimality for CHSH game classical strategy" Tags="&lt;games&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5119" PostTypeId="2" ParentId="5118" CreationDate="2019-01-05T07:17:57.010" Score="6" Body="&lt;p&gt;I would argue that this is &lt;em&gt;the&lt;/em&gt; critical issue to understand for Bell inequalities. Finding a violation of a Bell inequality tells you that the system is not classical (note: it does not prove that it &lt;em&gt;is&lt;/em&gt; quantum), so you need to understand what the classical thing is that the world is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's state the CHSH random variable that we're interested in:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=A_1B_1+A_1B_2+A_2B_1-A_2B_2,&#xA;$$&lt;/span&gt;&#xA;where each of &lt;span class=&quot;math-container&quot;&gt;$A_1,A_2,B_1,B_2$&lt;/span&gt; are random variables with &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; values. The key assumption for the classical strategy is that for every run of the experiment, &lt;strong&gt;all four variables have a fixed value&lt;/strong&gt; (even though we only ever find out two of the values). Hidden variables are essentially irrelevant here - they let two distant parties coordinate what those fixed values will be without having to communicate in the moment, but cannot change this basic assumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the consequences of this? Rewrite &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=A_1(B_1+B_2)+A_2(B_1-B_2).&#xA;$$&lt;/span&gt;&#xA;Now, if &lt;span class=&quot;math-container&quot;&gt;$B_1\in\{\pm1\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_2\in\{\pm1\}$&lt;/span&gt;, then either &lt;span class=&quot;math-container&quot;&gt;$B_1=B_2$&lt;/span&gt;, in which case &lt;span class=&quot;math-container&quot;&gt;$B_1-B_2=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_1+B_2=\pm 2$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$B_1=-B_2$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$B_1+B_2=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_1-B_2=\pm 2$&lt;/span&gt;. In either case, &lt;span class=&quot;math-container&quot;&gt;$S=\pm 2$&lt;/span&gt;. Finally, if, in every run of the experiment, &lt;span class=&quot;math-container&quot;&gt;$S=\pm 2$&lt;/span&gt;, then the average value &lt;span class=&quot;math-container&quot;&gt;$|\langle S\rangle|\leq 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what you learn from violation of a Bell inequality is that, each time the experiment is run, not all of the possible answers were determined. Classically, this is possible with the locality loophole -- if both questions are known, then a winning answer can be deterministically decided without having to specify all the other possible outcomes. Otherwise, there's some inherent randomness in play at picking the answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for where you might find proofs in the literature, why not follow up on the references in the &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality#Derivation&quot; rel=&quot;noreferrer&quot;&gt;wikipedia article&lt;/a&gt;? As I say, the classical bound is &lt;em&gt;the&lt;/em&gt; central element, so it must be in the original papers.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Bonus question: in (1), we claim that the local hidden variable can be written as a string of bits; is there a simple reason why this is the case?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Any information can be written as a string of bits.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-05T07:17:57.010" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5120" PostTypeId="1" CreationDate="2019-01-05T19:24:51.590" Score="6" ViewCount="479" Body="&lt;p&gt;The D-wave quantum computer allows us to be able to minimize Ising models. In reading other questions and responses, particularly &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1674/what-would-be-the-simplest-addition-that-would-make-the-d-wave-architecture-univ/1682#1682&quot;&gt;What would be the simplest addition that would make the D-Wave architecture universal?&lt;/a&gt;, XX couplings (and others have been mentioned. They (XX, YY etc. couplings) look like names for connections between qubits based on an axis but beyond that I get lost (especially since the couplers on D-waves architecture seem to be identical from pair to pair). I  addition I fail to understand how they fit in with the Ising model math; what are these couplers/what purpose do they serve?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The other question that mentioned XX, YY etc. couplings:&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4314/in-d-waves-universal-quantum-computer-why-does-the-yy-term-have-to-be-driven-a?rq=1&quot;&gt;In D-Wave&amp;#39;s universal quantum computer, why does the YY term have to be driven along with the linear X term?&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5219" LastActivityDate="2019-01-07T07:45:42.973" Title="What are XX, YY, YZ etc. couplings?" Tags="&lt;d-wave&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5121" PostTypeId="1" AcceptedAnswerId="5122" CreationDate="2019-01-05T21:41:08.993" Score="1" ViewCount="132" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JuuvN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JuuvN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input state on the qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\otimes(2|0\rangle+|1\rangle)$&lt;/span&gt;. I am assuming this means that the first qubit has the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and the second qubit has the state &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle+|1\rangle$&lt;/span&gt;. I could be wrong though. My question is, given the quantum circuit is shown below, what is the probability of the measurement outcomes, as well as the outcome measurement, and finally the new state after measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is anything that needs to be further specified please let me know. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="5460" LastEditorUserId="26" LastEditDate="2019-01-05T22:47:31.673" LastActivityDate="2019-01-06T19:00:25.317" Title="Evaluate the given quantum circuit" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5122" PostTypeId="2" ParentId="5121" CreationDate="2019-01-06T02:03:55.423" Score="3" Body="&lt;p&gt;The starting state is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2 | 1 0 \rangle + | 1 1 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the &lt;span class=&quot;math-container&quot;&gt;$H \otimes 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{2} | 0 0 \rangle - \sqrt{2} | 1 0 \rangle + 1/\sqrt{2} | 0 1 \rangle - 1/\sqrt{2} | 1 1 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the first 2 terms come from the first term above and the last two from the last term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the CNOT&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{2} | 0 0 \rangle - \sqrt{2} | 1 1 \rangle + 1/\sqrt{2} | 0 1 \rangle - 1/\sqrt{2} | 1 0 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You didn't normalize initially so it doesn't make sense to talk about probabilities right now. You would have to normalize by a factor of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{5}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H | 1 \rangle = 1/\sqrt{2} | 0 \rangle - 1/\sqrt{2} | 1 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;H \otimes 1 | 10 \rangle &amp;amp;=&amp;amp; 1/\sqrt{2} | 00 \rangle - 1/\sqrt{2} | 10 \rangle\\&#xA;(H \otimes 1) 2 | 10 \rangle &amp;amp;=&amp;amp; 2/\sqrt{2} | 00 \rangle - 2/\sqrt{2} | 10 \rangle\\&#xA;&amp;amp;=&amp;amp; \sqrt{2} | 00 \rangle - \sqrt{2} | 10 \rangle\\&#xA;H \otimes 1 | 11 \rangle &amp;amp;=&amp;amp; 1/\sqrt{2} | 01 \rangle - 1/\sqrt{2} | 11 \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalization factor doesn't change with applying &lt;span class=&quot;math-container&quot;&gt;$H \otimes 1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;. It is still &lt;span class=&quot;math-container&quot;&gt;$\sqrt{5}$&lt;/span&gt;. The normalized state is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{\sqrt{2}}{\sqrt{5}} | 0 0 \rangle - \frac{\sqrt{2}}{\sqrt{5}} | 1 1 \rangle + 1/\sqrt{2*5} | 0 1 \rangle - 1/\sqrt{2*5} | 1 0 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as can be checked by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;(\frac{\sqrt{2}}{\sqrt{5}})^2+(-\frac{\sqrt{2}}{\sqrt{5}})^2+(-1/\sqrt{2*5})^2+(1/\sqrt{2*5})^2 &amp;amp;=&amp;amp; \frac{2}{5}+\frac{2}{5}+\frac{1}{10}+\frac{1}{10}\\&#xA;&amp;amp;=&amp;amp; 1&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2019-01-06T19:00:25.317" LastActivityDate="2019-01-06T19:00:25.317" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5123" PostTypeId="2" ParentId="2230" CreationDate="2019-01-06T12:36:24.233" Score="4" Body="&lt;p&gt;Whilst we normally talk about &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; as unchanging states in quantum computing, this is not usually the case in a physical realization where there tends to be an energy difference &lt;span class=&quot;math-container&quot;&gt;$\Delta E$&lt;/span&gt; between these states such that &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;_\mathrm{logical} = e^{-it \Delta E / \hbar} \left|1\right&amp;gt;_\mathrm{physical}$&lt;/span&gt;. This phase rotation has the same angular frequency &lt;span class=&quot;math-container&quot;&gt;$\Delta E / \hbar$&lt;/span&gt; that you need to drive a transition between &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;. Their relative phase is the angle that determines if you drive a &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-rotation (or rotate about an axis somewhere else in the plane spanned by the axes for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-rotations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to achieve a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-rotation is to wait and let the &lt;span class=&quot;math-container&quot;&gt;$e^{-it \Delta E / \hbar}$&lt;/span&gt; factor achieve it for you. However, this would be a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on every qubit which is not the goal if you want a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on one spcific qubit. To achieve that, you can for example combine partial rotations about the axes for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-gates. Its easy to verify with a globe (or any ball with marked directions) that &quot;half&quot; of an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate (a 90 degree rotation) followed by a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate and then the reverse &quot;half&quot; if an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate (a -90 degree rotation) together is the same as a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are more complicated tricks you could alternatively use. For example, by driving a pulse in a detuned way, you move the effective Bloch sphere rotation axis away from the equatorial plane (in which the rotation axes for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gates lie). But this works only for moderate tiltings of this angle as the pulses' effect in the case of trying to realize a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate this way would tend to zero: It happens infinitely slow. Hence you need to combine at least two Bloch sphere rotations to get a Z gate with such pulses driving the transition between your qubit basis state.&lt;/p&gt;&#xA;" OwnerUserId="1039" LastEditorUserId="1039" LastEditDate="2019-01-06T14:27:35.453" LastActivityDate="2019-01-06T14:27:35.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5124" PostTypeId="2" ParentId="5118" CreationDate="2019-01-06T13:37:57.177" Score="4" Body="&lt;p&gt;One way to go about proving this is to characterise the set of all possible strategies that Alice &amp;amp; Bob can adopt. By &quot;strategy&quot; here I mean a possible relation between inputs and outputs, encoded in the set of four binary numbers &lt;span class=&quot;math-container&quot;&gt;$A_0,A_1,B_0,B_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is worth noting that it doesn't matter whether we are considering &lt;em&gt;deterministic&lt;/em&gt; or &lt;em&gt;probabilistic&lt;/em&gt; protocols here. The difference between these two approaches is in the way the steps of the protocol proceed, but if one considers only input and output of the protocol, without caring about how the output is actually obtained, then characterising the set of all possible input-output relations and showing that none of these combinations gives a winning probability greater than &lt;span class=&quot;math-container&quot;&gt;$75\%$&lt;/span&gt; is enough.&#xA;In other words, using a probabilistic approach does not expand the number of possible outcomes/strategies, but only provide a different way to get to them. Because we are only interested in the final winning probability, and therefore in the overall strategy, we don't need to take into account separately deterministic and probabilistic case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, given a strategy &lt;span class=&quot;math-container&quot;&gt;$\mathcal S\equiv\{A_0,A_1,B_0,B_1\}$&lt;/span&gt;, we can write the number of input combinations for which this strategy gives the &lt;em&gt;wrong&lt;/em&gt; result as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{\mathcal S}\equiv A_0\oplus B_0 + A_0\oplus B_1 + A_1\oplus B_0 + (1-A_1\oplus B_1),\tag1$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a\oplus b$&lt;/span&gt; denotes addition modulo 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our problem is to find the strategy &lt;span class=&quot;math-container&quot;&gt;$\mathcal S$&lt;/span&gt; that minimises &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, there are several ways to do this.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Brute force&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The simplest way, if the least elegant, is to compute the value of &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}$&lt;/span&gt; for all the possible strategies &lt;span class=&quot;math-container&quot;&gt;$\mathcal S$&lt;/span&gt;. There are 16 of these, so this isn't too bad. With a few lines of code you can obtain the following table&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(&#xA;\begin{array}{ccccc}&#xA; A_0 &amp;amp; A_1 &amp;amp; B_0 &amp;amp; B_1 &amp;amp; P_{\mathcal S} \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 3 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 3 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 3 \\&#xA; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 3 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 3 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 3 \\&#xA; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 3 \\&#xA; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 3 \\&#xA; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;$$&lt;/span&gt;&#xA;which confirms that indeed all possible strategies lead to the game being lost for at least one input combination (that is, in your words, to a success probability not greater than &lt;span class=&quot;math-container&quot;&gt;$75\%$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now, of course, this is not a very satisfying way to solve the problem (for me at least). It would be much nicer to have a way to prove optimality without having to check all possibilities. The main hurdle to overcome is that Eq. (1) contains both modular sums and regular sums, which makes manipulation a bit awkward, as we cannot write something like &lt;span class=&quot;math-container&quot;&gt;$A_0\oplus B_0+A_0\oplus B_1=A_0(B_0\oplus B_1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see two ways around this, the second of which also sheds light to the similarities between this formalism and the regular proof of the CHSH inequalities.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;First method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;A way around this problem is to notice that we can express modular sums using regular sums and products, as following&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A\oplus B=(1-A)B+A(1-B)=A+B-2AB.$$&lt;/span&gt;&#xA;Simple algebraic manipulation thus allows us to write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A_0\oplus B_0+A_0\oplus B_1=2A_0(1-(B_0+B_1))+(B_0+B_1),\\&#xA;A_1\oplus B_0+(1-A_1\oplus B_1)=1+(2A_1-1)(B_1-B_0),$$&lt;/span&gt;&#xA;and finally&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{\mathcal S}=1+2\{B_0+A_0[1-(B_0+B_1)]+A_1(B_1-B_0)\}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can now verify that if &lt;span class=&quot;math-container&quot;&gt;$B_0=B_1$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}=1+2A_0\oplus B_0$&lt;/span&gt;, while if &lt;span class=&quot;math-container&quot;&gt;$B_0+B_1=1$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}=1+2A_1\oplus B_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equivalently, one can verify that &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}$&lt;/span&gt; can also be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{\mathcal S}=(1-2B_0)(B_1-B_0)[1+2A_1\oplus B_0]&#xA;+ [1-(B_0+B_1)](1-2B_0)[1+2A_0\oplus B_0]+ B_0(1-B_0)(...),$$&lt;/span&gt;&#xA;where the last term is always zero as &lt;span class=&quot;math-container&quot;&gt;$B_0\in\{0,1\}$&lt;/span&gt;.&#xA;Note that this is just a way to express algebraically what happens in the two cases &lt;span class=&quot;math-container&quot;&gt;$B_0=B_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_0=-B_1$&lt;/span&gt;, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$(1-2B_0)(B_1-B_0)=1$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$B_0=-B_1$&lt;/span&gt;,&#xA;and &lt;span class=&quot;math-container&quot;&gt;$(1-2B_0)(1-B_0-B_1)=1$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$B_0=B_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Second method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This involves showing that this formalism is equivalent to the one commonly used in the context of deriving the CHSH inequalities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denote with &lt;span class=&quot;math-container&quot;&gt;$\tilde A_x\equiv 1-2A_x$&lt;/span&gt; the number obtained by replacing &lt;span class=&quot;math-container&quot;&gt;$0,1$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$A_x$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$+1,-1$&lt;/span&gt;, respectively, and similarly for &lt;span class=&quot;math-container&quot;&gt;$\tilde B_y$&lt;/span&gt;.&#xA;For example, &lt;span class=&quot;math-container&quot;&gt;$A_x=0$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$\tilde A_x=+1$&lt;/span&gt;.&#xA;Note that, under this mapping, we have the identities&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A_x\oplus B_y=(1-\tilde A_x\tilde B_y)/2.$$&lt;/span&gt;&#xA;We can then write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_{\mathcal S}=\frac{1}{2}\left[4-\tilde A_0\tilde B_0-\tilde A_0\tilde B_1-\tilde A_1\tilde B_0+\tilde A_1\tilde B_1\right]&#xA;=2 - S/2,$$&lt;/span&gt;&#xA;where we defined&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S\equiv \tilde A_0\tilde B_0+\tilde A_0\tilde B_1+\tilde A_1\tilde B_0-\tilde A_1\tilde B_1,$$&lt;/span&gt;&#xA;which you might recognise as equivalent to the operator &lt;span class=&quot;math-container&quot;&gt;$\hat S$&lt;/span&gt; used when discussing the CHSH inequalities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Standard arguments now give you &lt;span class=&quot;math-container&quot;&gt;$S=\pm 2$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$\lvert S\rvert\le 2$&lt;/span&gt;, and finally&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}\ge1$&lt;/span&gt; (or more precisely &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal S}\in\{1,3\}$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-01-15T09:34:17.943" LastActivityDate="2019-01-15T09:34:17.943" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5125" PostTypeId="1" AcceptedAnswerId="5126" CreationDate="2019-01-06T22:05:29.077" Score="21" ViewCount="6339" Body="&lt;p&gt;I know that &lt;span class=&quot;math-container&quot;&gt;$re^{i\theta} = x + iy$&lt;/span&gt; for any complex number &lt;span class=&quot;math-container&quot;&gt;$x + iy$&lt;/span&gt; by Euler's formula. How do you calculate relative and global phase?&lt;/p&gt;&#xA;" OwnerUserId="4693" LastEditorUserId="10480" LastEditDate="2021-02-02T18:30:50.490" LastActivityDate="2021-02-02T18:30:50.490" Title="What is the difference between a relative phase and a global phase? In particular, what is a phase?" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="5126" PostTypeId="2" ParentId="5125" CreationDate="2019-01-07T00:29:33.537" Score="21" Body="&lt;p&gt;As clearly evident from the Euler's form &lt;span class=&quot;math-container&quot;&gt;$z=re^{i\theta}$&lt;/span&gt;, a phase has something to do with rotation in the Argand plane but not affect the amplitude of a complex number. You can make a set of set of infinite complex numbers with the same magnitude. It can just be regarded as the extra degree of freedom for a given complex number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the perspective of Quantum Information/Computing, the &lt;em&gt;observable&lt;/em&gt; quantities are the probabilities which are proportional to the complex number amplitudes &lt;span class=&quot;math-container&quot;&gt;$|z|^2=|re^{i\theta}|^2=(re^{i\theta})(r^*e^{-i\theta})=r^2$&lt;/span&gt; which clearly doesn't care about the the &lt;em&gt;phase&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the most simple non-trivial example. For any quantum state with two degrees of freedom (qubit):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle=r_1e^{i\theta_1}|0\rangle+r_2e^{i\theta_2}|1\rangle&#xA;\end{equation}&lt;/span&gt;&#xA;This is described by two complex numbers with phases &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_2$&lt;/span&gt; respectively. It can be rewritten as:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle=e^{i\theta_1}(r_1|0\rangle+r_2e^{i(\theta_2-\theta_1)}|1\rangle)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you calculate the amplitude &lt;span class=&quot;math-container&quot;&gt;$|\psi|^2$&lt;/span&gt;, the factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta_1}$&lt;/span&gt; in front will vanish by the argument above. This is called a &lt;em&gt;global phase&lt;/em&gt; which is an overall phase in front. The &lt;em&gt;relative phase&lt;/em&gt; is the quantity &lt;span class=&quot;math-container&quot;&gt;$\theta_2-\theta_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\theta_1-\theta_2$&lt;/span&gt;, however defined. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relative phase is an &lt;em&gt;observable&lt;/em&gt; quantity in Quantum Theory and it can be changed when a state evolved in accordance with the Schrodinger's equation &lt;span class=&quot;math-container&quot;&gt;$i\hbar\frac{d}{dt}|\psi\rangle=\hat{H}|\psi\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relative phase has also great importance when we consider the density matrix for a state defined as &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle \langle \psi|$&lt;/span&gt; which for the example above is: &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho=r_1^2|0\rangle\langle0|+r_1r_2e^{i(\theta_1-\theta_2)}|0\rangle\langle1|+r_2r_1e^{i(\theta_2-\theta_1)}|1\rangle\langle0|+r_2^2|1\rangle\langle1|&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where it is only the relative phase that appears and not the global phase. In Quantum Information point of view, this relative phase appearing in the off-diagonal terms of the above matrix carries the information of &lt;strong&gt;&lt;em&gt;coherence&lt;/em&gt;&lt;/strong&gt; of the system which is one of the most unique properties of quantum systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are some general concerns of relative and global phases. It does not make any sense to talk about a relative phase for a single complex number &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, please see the wiki articles of such concepts, they clear enough content on these as a good start.&#xA;Here you can refer to &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Qubit&lt;/a&gt;, mainly the Bloch sphere section.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-01-07T00:29:33.537" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5127" PostTypeId="1" AcceptedAnswerId="5139" CreationDate="2019-01-07T00:43:39.680" Score="5" ViewCount="209" Body="&lt;p&gt;In the adiabatic model, we have a system acquiring a Berry phase due to cyclic &lt;em&gt;slow&lt;/em&gt; periodic evolution under a Hamiltonian. While in the topological phases, we talk about systems such as anyons which acquire fractional phases under permutation or exchange trajectories in space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not clear about how the topological phases arise (in general)? Has it the same mechanism as the Berry phase? Is it a special kind of Berry phase characteristic of the topological system? Has the system to follow a path adiabatically and return back to its initial state for such a phase to emerge? &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-01-08T11:07:24.097" Title="What is the correspondence between adiabatic phase and a topological phase?" Tags="&lt;adiabatic-model&gt;&lt;topological-quantum-computing&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5128" PostTypeId="1" CreationDate="2019-01-07T01:04:22.310" Score="2" ViewCount="680" Body="&lt;p&gt;Suppose &lt;code&gt;Circuits= [circuit1, circuit2, ..., circuitn]&lt;/code&gt; is a list of defined circuits. Then, &lt;code&gt;job = execute(Circuits, backend=backend, shots=shots, max_credits=max_credits)&lt;/code&gt; will execute a list of circuits all together. Then, one can get the result by using &lt;code&gt;job.result().get_counts&lt;/code&gt;. It looks like this (with the results of the first circuit execution highlighted): &#xA;&lt;a href=&quot;https://i.stack.imgur.com/fe6h1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fe6h1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to extract the counts like how it usually is with only one circuit in execution?&lt;/p&gt;&#xA;" OwnerUserId="2757" LastEditorUserId="26" LastEditDate="2019-01-07T12:46:46.153" LastActivityDate="2019-05-28T15:50:57.673" Title="Result of a job for a list of circuits on QISKit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5129" PostTypeId="2" ParentId="5128" CreationDate="2019-01-07T02:16:17.150" Score="3" Body="&lt;p&gt;From the Getting started tutorial on Qiskit, it seems that you grab the result of job first and you access the counts via the function get_counts(circuit) for a specific circuit. So I would loop through Circuits and use this function on each:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result_submissions = job.result()&#xA;for qc in Circuits:&#xA;     counts = result_submissions.get_counts(qc)&#xA;     print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-01-07T02:16:17.150" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5130" PostTypeId="2" ParentId="5120" CreationDate="2019-01-07T07:45:42.973" Score="7" Body="&lt;p&gt;In the mentioned context, what is meant is that, between a pair of qubits that are coupled, an XX coupling means something of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X\otimes X\equiv\left(\begin{array}{cccc} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{array}\right),&#xA;$$&lt;/span&gt;&#xA;tensored with identity between all other qubits, where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is the standard Pauli matrix. You then sum these terms over every possible pair of coupled qubits, possibly with different strengths. For example, in a spin chain, qubits labelled 1 to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, with a nearest-neighbour coupling (i.e. between all pairs &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i+1$&lt;/span&gt;), the XX coupling means&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=1}^{N-1}J_i\mathbb{I}^{\otimes(i-1)}\otimes X\otimes X\otimes\mathbb{I}^{\otimes(n-i-1)} &#xA;$$&lt;/span&gt;&#xA;for real parameters &lt;span class=&quot;math-container&quot;&gt;$J_i$&lt;/span&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$YY$&lt;/span&gt; means replacing the &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other contexts, the terminology can be used slightly differently. For example, in the condensed matter community, they usually talk about an &quot;XX Hamiltonian&quot;. This does not mean a Hamiltonian with XX couplings. Instead, it means a Hamiltonian with terms of the form &lt;span class=&quot;math-container&quot;&gt;$XX+YY$&lt;/span&gt; between coupled pairs of qubits. This is also called the exchange interation. To make this notation clearer, let me give further examples. An &lt;span class=&quot;math-container&quot;&gt;$XXX$&lt;/span&gt; Hamiltonian, normally called the Heisenberg Hamiltonian, would mean couplings of the for &lt;span class=&quot;math-container&quot;&gt;$XX+YY+ZZ$&lt;/span&gt;, while &lt;span class=&quot;math-container&quot;&gt;$XXZ$&lt;/span&gt; means &lt;span class=&quot;math-container&quot;&gt;$XX+YY+\Delta ZZ$&lt;/span&gt; for some parameter &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt;. In other words, there are generally 3 terms that you have to worry about in a two-qubit coupling: &lt;span class=&quot;math-container&quot;&gt;$aXX+bYY+cZZ$&lt;/span&gt;, and a notation like &quot;XX&quot; or &quot;XXX&quot; tells you the number of non-zero terms &lt;span class=&quot;math-container&quot;&gt;$(a,b,c)$&lt;/span&gt; which are the same. While &quot;XXZ&quot; tells you two values are the same (&lt;span class=&quot;math-container&quot;&gt;$a=b$&lt;/span&gt;), but that one value is different. The further complication is that this notation is not consistently used. Sometimes people use &quot;XY&quot; to mean &lt;span class=&quot;math-container&quot;&gt;$XX+YY$&lt;/span&gt; and &quot;XYZ&quot; to mean &lt;span class=&quot;math-container&quot;&gt;$XX+YY+ZZ$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what purpose do they serve&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The purpose is to change the maths. The whole point is that without these extra terms, D-wave's quantum computer is not universal - it is incapable of implementing an arbitrary quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me try to give some insight as to why that might be (I don't pretend that this applies directly). To that end, consider the simple geometry of a one-dimensional chain. You'd have some sort of Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{i=1}^{n-1}\Delta_iZ_iZ_{i+1}+\sum_{i=1}^nB_iX_i.&#xA;$$&lt;/span&gt;&#xA;The great thing about this Hamiltonian, the transverse Ising model, is that it's exactly solvable via Bogoliubov and Jordan-Wigner transformations. But that means that we can classically simulate its effects and so it's not interesting from a computation perspective. However, if we add extra terms to make the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{i=1}^{n-1}\Delta_iZ_iZ_{i+1}+\sum_{i=1}^{n-1}\tilde\Delta_iX_iX_{i+1}+\sum_{i=1}^nB_iX_i.&#xA;$$&lt;/span&gt;&#xA;then we don't know how to simulate it, and it has the potential to perform interesting computations (this is a long way from proving that simulation of this Hamiltonian is BQP complete).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-07T07:45:42.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5131" PostTypeId="2" ParentId="5127" CreationDate="2019-01-07T08:04:05.893" Score="4" Body="&lt;p&gt;From &lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_order&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In physics, topological order is a kind of order in the&#xA;  zero-temperature phase of matter (also known as quantum matter).&#xA;  Macroscopically, topological order is defined and described by robust&#xA;  ground state degeneracy and &lt;strong&gt;quantized non-Abelian geometric phases&lt;/strong&gt;&#xA;  of degenerate ground states&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(emphasis is mine). Clearly, it is a special kind of Berry Phase, determined by the ground state degeneracy of the defining Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You asked:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Has the system to follow a path adiabatically..&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure that adiabaticity of the evolution is absolutely necessary (in a similar way to the way that you can find plenty of discussion about non-adiabatic geometric phases), but in practice it's probably a good idea to minimise the occurrence of further excitations that could cause errors in what you're trying to achieve, even if, due to the nature of topological systems, it's quite unlikely that those excitations would contribute anything.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...and return back to its initial state for such a phase to emerge&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, it wouldn't return to its initial &lt;em&gt;state&lt;/em&gt;. The whole point of the topological phase is that you don't want it to return to its initial state. You might return it to its original position, but even that isn't necessary. People talk about braiding anyons -- essentially, swapping their positions.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-07T08:04:05.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5132" PostTypeId="1" CreationDate="2019-01-07T13:17:03.400" Score="5" ViewCount="543" Body="&lt;p&gt;The real devices used as backends for Qiskit have calibration data that quantifies errors (&lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt;, gate fidelities, etc). This can be accessed by, for example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.load_accounts()&#xA;device = IBMQ.get_backend('ibmq_5_tenerife')&#xA;properties = device.properties()&#xA;&#xA;print( properties.to_dict() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can a simulation be performed that takes all of this information into account, and produces a result given a simulation of this noise?&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2019-01-07T15:00:23.257" LastActivityDate="2019-01-07T15:00:23.257" Title="How can noise on a device be simulated using measured noise parameters?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5133" PostTypeId="2" ParentId="5132" CreationDate="2019-01-07T13:17:03.400" Score="7" Body="&lt;p&gt;This can be done using the 'Aer' component of Qiskit. The properties information can be turned into a noise model using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import noise&#xA;properties = device.properties()&#xA;noise_model = noise.device.basic_device_noise_model(properties)&#xA;basis_gates = noise_model.basis_gates&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This can then be supplied to the &lt;code&gt;execute()&lt;/code&gt; method, as is normally used to run jobs. Here is a full working example of a simulation using the noise model from the Tenerife device, for a circuit that creates a Bell pair.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.providers.aer import noise&#xA;&#xA;# Choose a real device to simulate&#xA;IBMQ.load_accounts()&#xA;device = IBMQ.get_backend('ibmq_5_tenerife')&#xA;properties = device.properties()&#xA;coupling_map = device.configuration().coupling_map&#xA;&#xA;# Generate an Aer noise model for device&#xA;noise_model = noise.device.basic_device_noise_model(properties)&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;# Generate a quantum circuit&#xA;q = QuantumRegister(2)&#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q, c)&#xA;&#xA;qc.h(q[0])&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q, c)&#xA;&#xA;# Perform noisy simulation&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;job_sim = execute(qc, backend,&#xA;                  coupling_map=coupling_map,&#xA;                  noise_model=noise_model,&#xA;                  basis_gates=basis_gates)&#xA;sim_result = job_sim.result()&#xA;&#xA;print(sim_result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The result I got when running this was &lt;code&gt;{'00': 409, '11': 411, '10': 94, '01': 110}&lt;/code&gt;, which shows that the expected results of &lt;code&gt;'00'&lt;/code&gt; and &lt;code&gt;'11'&lt;/code&gt; are indeed dominant, but &lt;code&gt;'01'&lt;/code&gt; and &lt;code&gt;'10'&lt;/code&gt; also appear due to the simulated noise.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-01-07T13:17:03.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5134" PostTypeId="2" ParentId="2536" CreationDate="2019-01-07T13:45:04.553" Score="2" Body="&lt;p&gt;Hope this late contribution won't be a meaningless contribution, but as mentioned in one of the comments above, by using D-Waves version of NetworkX you can visualize the Pegasus network. I have attached a few images here of the Pegasus 2 (P2) and Pegasus 6 (P6) architectures using the D-Wave NetworkX.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xZSqK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xZSqK.png&quot; alt=&quot;P2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p8GSJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p8GSJ.png&quot; alt=&quot;P6&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason that I find Pegasus interesting is that the architecture allows for odd number cycles, and of course the obvious scale up in the maximum degree. The theoretical inability for Chimera to have odd cycles is limiting, but practically it can be approximated using minor embedding techniques and maybe imperfect chimera, but of course, Pegasus overcomes that entirely.&lt;/p&gt;&#xA;" OwnerUserId="5490" LastEditorUserId="26" LastEditDate="2019-01-07T14:53:42.633" LastActivityDate="2019-01-07T14:53:42.633" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5135" PostTypeId="5" CreationDate="2019-01-07T14:57:22.820" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-07T14:57:22.820" LastActivityDate="2019-01-07T14:57:22.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5136" PostTypeId="4" CreationDate="2019-01-07T14:57:22.820" Score="0" Body="For questions about the D-Wave Pegasus architecture. Unlike the Chimera graph where each qubit can have at most 6 qubits, the Pegasus graph allows each qubit to couple to 15 other qubits. Consider using the [dwave] tag with this. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-07T14:57:22.820" LastActivityDate="2019-01-07T14:57:22.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5137" PostTypeId="2" ParentId="97" CreationDate="2019-01-08T03:50:56.597" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;noise should average itself out.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Noise doesn't perfectly average itself out. That's the Gambler's Fallacy. Even though noise tends to meander back and forth, it still accumulates over time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you generate N fair coin flips and sum them up, the expected magnitude of the difference from exactly &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; heads grows like &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt N)$&lt;/span&gt;. That's quadratically better than the &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; you expect from a biased coin, but certainly not 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even worse, in the context of a computation over many qubits the noise doesn't cancel itself nearly as well, because the noise is no longer along a single dimension. In a quantum computer with &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; qubits and single-qubit noise, there are &lt;span class=&quot;math-container&quot;&gt;$2Q$&lt;/span&gt; dimensions at any given time for the noise to act on (one for each X/Z axis of each qubit). And as you compute with the qubits, these dimensions change to correspond to different subspaces of a &lt;span class=&quot;math-container&quot;&gt;$2^Q$&lt;/span&gt; dimensional space. This makes it unlikely for later noise to undo earlier noise, and as a result you're back to &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; accumulation of noise.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;run the operations, say, a hundred times, and pick the average/most common answer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As computations get larger and longer, the chance of seeing no noise or of the noise perfectly cancelling out rapidly becomes so close to 0% that you can't expect see the correct answer even once even if you repeated the computation a trillion times.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-01-08T18:22:36.157" LastActivityDate="2019-01-08T18:22:36.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5138" PostTypeId="1" CreationDate="2019-01-08T07:15:46.363" Score="1" ViewCount="568" Body="&lt;p&gt;Simulated annealing is applied for deep learning using convolutional neural networks. Likewise, can quantum annealing be used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These two papers: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1877050915035759&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulated Annealing Algorithm for Deep Learning (Rere &lt;em&gt;et al.&lt;/em&gt;, 2015)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1510.06356&quot; rel=&quot;nofollow noreferrer&quot;&gt;Application of Quantum Annealing to Training of Deep Neural Networks (Adachi &amp;amp; Henderson, 2015)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;have both used the annealing technique for optimization of the problems but with different learning types. Therefore, my concern is whether quantum annealing can be applied for convolutional neural networks as well as or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes, then how? If no, then why not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any reference or related theories or work will be a great help.&lt;/p&gt;&#xA;" OwnerUserId="4924" LastEditorUserId="26" LastEditDate="2019-01-08T08:59:00.283" LastActivityDate="2019-01-08T11:58:56.320" Title="Can quantum annealing be used for training convolutional neural networks?" Tags="&lt;annealing&gt;&lt;machine-learning&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5139" PostTypeId="2" ParentId="5127" CreationDate="2019-01-08T09:39:59.577" Score="4" Body="&lt;p&gt;When a quantum system, parametrized by a manifold of classical parameters, evolves along a closed path in the parameter space, its state experiences a unitary transformation, which is called a geometric phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most applications of quantum computing, this parameter space is usually a set of control parameters used to drive the system. More precisely, the system's Hamiltonian depends on a set of parameters, some of them can be controlled by the experimenter to generate an evolution according to the Schrödinger equation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d|\psi(t)\rangle}{dt} = \frac{1}{i\hbar} H(x(t)) |\psi(t)\rangle$$&lt;/span&gt;&lt;br&gt;&#xA;The Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(x)$&lt;/span&gt; depends on the parameters (coordinates) &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; belonging to the control manifold &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt;. The control of the system evolution is performed through the &quot;driving the Hamiltonian&quot; along the trajectories &lt;span class=&quot;math-container&quot;&gt;$x(t)$&lt;/span&gt; by the experimenter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a space of control parameters of a quantum computing system is the parameter space of the laser pulses acting on trapped ion qubits. Here, the control parameters &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; consist of the laser phases and exposure times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Adiabatic phase&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the system's initial Hamiltonian has a degenerate ground state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H(x(0)) |\psi_n\rangle = E_0 |\psi_n\rangle, \quad  n=1, ..., N,$$&lt;/span&gt;&#xA;Then if we evolve the system very slowly along a closed cycle in the parameter space, specifically if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle\psi_n|\frac{dH}{dt}|\psi_n\rangle T &amp;lt;&amp;lt; E_1(t)-E_0(t)$$&lt;/span&gt; &#xA;Where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the cycle time period and &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; is the energy of the first excited state. Then, when the above adiabatic condition applies, the system evolves within the degenerate ground state subspace and its final state after the evolution cycle can be approximated by:&#xA; &lt;span class=&quot;math-container&quot;&gt;$$ |\Psi(T) \rangle = e^{\frac{-iET}{\hbar}} Pe^{\frac{i}{\hbar}\oint A_i(x) dx^i} |\Psi(0) \rangle, $$&lt;/span&gt;&#xA;The term in front of &lt;span class=&quot;math-container&quot;&gt;$|\Psi(0) \rangle $&lt;/span&gt; is the geometric phase. Both the initial &lt;span class=&quot;math-container&quot;&gt;$|\Psi(0) \rangle $&lt;/span&gt; and the final &lt;span class=&quot;math-container&quot;&gt;$|\Psi(T) \rangle $&lt;/span&gt;, states are combinations of the ground state vectors; &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; denotes the time ordering operator, and &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; are the matrices whose elements are given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A^{mn}_i  = \langle\psi_m(t)|\frac{d}{dx^i} |\psi_n(t)\rangle $$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$|\psi_n(t)\rangle$&lt;/span&gt; are instantaneous eigenvectors of the time varying Hamiltonian:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H(x(t)) |\psi_n(t)\rangle = E_0(t) |\psi_n(t)\rangle$$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Lie algebra valued differential form &lt;span class=&quot;math-container&quot;&gt;$A_i dx^i$&lt;/span&gt; is called the Wilczek-Zee non-Abelian potential. It is a non-Abelian generalization of the electromagnetic vector potential. The Wilczek-Zee potential is also a gauge potential; a change of the (computational) basis that we use for the degenerate subspace is equivalent to a gauge transformation which does not change the value of the geometric phase. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &lt;span class=&quot;math-container&quot;&gt;$e^{\frac{-iET}{\hbar}}$&lt;/span&gt; is called a dynamical phase. In our case it is just a global phase which does not change the physical state. The dynamic phase in contrast to the geometric phase depends explicitly on the cycle time. If the system is rotated fast, then less dynamical phase is accumulated. The Wilczek-Zee phase in contrast depends only on the trajectory in the parameter space and not on the evolution time (as long as the evolution is not too fast to break the adiabatic theorem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the major applications of the adiabatic geometric phase is in the construction of gates in holonomic quantum computers as originally proposed in the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9904011&quot; rel=&quot;nofollow noreferrer&quot;&gt;seminal paper&lt;/a&gt; by Rasetti and Zanardi.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;non-Adiabatic phase&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum computation, the adiabatic condition is a burden, because it requires the controlled evolution of the system to be slow, enabling the system more time to decohere.  Thus, adiabatic quantum evolution, although not excluded as a viable possibility of realizing a quantum computer, is quite constrained. But the fact is, that when the system's evolution is fast, such that the adiabatic theorem does not apply, the system still follows a unitary evolution which can be expressed by a geometric phase. However, this time, it is the responsibility of the experimenter to keep the system in the computational subspace, as the adiabatic theorem ceases to apply. In this case the final state of the system can be expressed by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\Psi(T) \rangle = Pe^{\frac{i}{\hbar}(-\int_0^T -E(t) dt + \oint A_i(x) dx^i)} |\Psi(0) \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time, the Hilbert space does not need to be a degenerate ground space of a given Hamiltonian, and the energy matrix in the first term is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E_{mn}(t)  = \langle\psi_m(t)|H(t) |\psi_n(t)\rangle $$&lt;/span&gt;&#xA;Here, the vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi_n(t)\rangle$&lt;/span&gt; are just the (computational) basis vectors that we choose to work with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above geometric phase is usually referred to as the (non-Abelian version of the) Aharonov-Anandan phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We observe here, there is a very big complication, the dynamical phase became a matrix and it appears inside the time ordering operator. The control of dynamical phases is very complicated and depends on our precise modeling of the system and on our precise speed in controlling the system's evolution. However, there is a trick which helps very much in the non-adiabatic case: If we can control the system along a parallel transport trajectory, in which:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \Psi(t) |\frac{d}{dt} |\Psi(t) \rangle = 0, $$&lt;/span&gt;&#xA;Then the dynamical phase becomes again a global phase factor and the geometric phase will be again be given in an expression similar to the Wilczek-Zee case (please see , for example, &lt;a href=&quot;https://arxiv.org/abs/1503.04847&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sjöqvist&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Topological phase&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As stated earlier, the geometric phase does not depend on the speed that we evolve the system in along the trajectory, but it depends on the shape of the trajectory itself. For example, in the Abelian case when the trajectory resides on a Bloch sphere, the geometric phase (a &lt;span class=&quot;math-container&quot;&gt;$U(1)$&lt;/span&gt; phase in this case) is just the area enclosed by the trajectory. Thus, a change in the trajectory's shape introduces a change in the geometric phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when the Wilczek-Zee, or the Aharonov-Anandan potentials are flat, i.e., when the curvature&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F_{ij}= \frac{d A_i }{dx^j} - \frac{d A_j  }{dx^i} + [A_i, A_j] = 0$$&lt;/span&gt; &#xA;vanishes, then the geometric phase does not depend on the exact details of the trajectory, but only on its homotopy class. Thus, if we choose two trajectories enclosing the same holes in the parameter space, we obtain exactly the same geometric phase, which quite a relief, because in this case we do not need to draw exact trajectories in order to generate quantum gates. For example, in braiding two non-Abelian anyons, the geometric phase is topological, and in this case, the anyon trajectories need not to be precise as long one rotates about the other.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2019-01-08T11:07:24.097" LastActivityDate="2019-01-08T11:07:24.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5140" PostTypeId="2" ParentId="5138" CreationDate="2019-01-08T11:58:56.320" Score="2" Body="&lt;p&gt;I will assume you are asking about D-Wave's quantum annealer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is a part of the learning process that can fit the QUBO (Quadratic Unconstrained Binary Optimization) formulation, then yes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem however is what to consider as binary variables of your problem. In CNN, we have in general real-valued parameters that we tweak for training (using Stochastic Gradient Descent for instance). At first glance, considering the cost function would not fit the requirements, especially because you have nonlinear functions applied to the real weights so it does not look like a QUBO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second paper you mention used it especially because the energy function of Restricted Boltzmann machines is a QUBO and they were using the machine as a Boltzmann-like sampler for estimating an intractable part in the gradient (the negative part). So it's a different setup than CNNs. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-01-08T11:58:56.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5144" PostTypeId="1" AcceptedAnswerId="5209" CreationDate="2019-01-08T17:51:00.630" Score="5" ViewCount="1355" Body="&lt;p&gt;Suppose I want to implement run several circuits one after another, but they are constructed in a similar fashion. I could reinstantiate a &lt;code&gt;QuantumCircuit&lt;/code&gt; for each iteration, like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;params = np.linspace(0, 2 * np.pi, num=20)&#xA;for p in params:&#xA;    circ = QuantumCircuit(q, c)&#xA;    do_stuff(circ, p)&#xA;    do_other_stuff()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I'm afraid that creating a bunch of unnecessary &lt;code&gt;circ&lt;/code&gt; objects takes too much memory or too many calls to the garbage collector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, I would like to remove the gates from the &lt;code&gt;QuantumCircuit&lt;/code&gt; object and build the new circuit in the old object. Is it possible, and if so, is it reasonable?&lt;/p&gt;&#xA;" OwnerUserId="5103" LastEditorUserId="26" LastEditDate="2019-01-08T18:23:32.700" LastActivityDate="2019-01-15T15:01:15.070" Title="Can I remove gates from a QuantumCircuit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5145" PostTypeId="1" AcceptedAnswerId="5146" CreationDate="2019-01-08T20:19:01.450" Score="3" ViewCount="165" Body="&lt;p&gt;In Cirq, is it possible to take a sub-circuit generator and use it as the &lt;code&gt;sub_gate&lt;/code&gt; in a &lt;code&gt;cirq.ControlledGate&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;... instantiate circuit and qubits q0-q3 ...&#xA;&#xA;... define sub circuit generator:&#xA;def my_layer():&#xA;    &quot;&quot;&quot;&#xA;    sub-circuit generator&#xA;    ref: https://github.com/quantumlib/Cirq/blob/master/docs/circuits.md&#xA;    &quot;&quot;&quot;&#xA;    yield CZ(q0, q1)&#xA;    yield [H(q) for q in (q0, q1, q2)]&#xA;    yield [CZ(q1, q2)]&#xA;    yield [H(q0), [CZ(q1, q2)]]&#xA;&#xA;... take the sub-circuit generator and do something like:&#xA;gate = cirq.ControlledGate(sub_gate = my_layer())&#xA;circuit.append(gate(q3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In other words, how can I take a sub-circuit and make its execution conditional on a control qubit?&lt;/p&gt;&#xA;" OwnerUserId="5502" LastEditorUserId="26" LastEditDate="2019-01-09T01:58:39.950" LastActivityDate="2019-01-09T01:58:39.950" Title="cirq.ControlledGate from sub-circuit generator" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5146" PostTypeId="2" ParentId="5145" CreationDate="2019-01-08T21:03:59.093" Score="1" Body="&lt;p&gt;The following code snippet will do almost what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyLayerGate(cirq.Gate):&#xA;    def _decompose_(self, qubits):&#xA;        a, b, c = qubits&#xA;        return my_layer(a, b, c)&#xA;&#xA;    # [will be unnecessary in v0.5.0] workaround for cirq.unitary ignoring _decompose_:&#xA;    def _unitary_(self):&#xA;        return cirq.unitary(&#xA;            cirq.Circuit.from_ops(self._decompose_(&#xA;                cirq.LineQubit.range(3))))&#xA;&#xA;controlled_my_layer_gate = cirq.ControlledGate(MyLayerGate())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the future, the &lt;code&gt;# workaround&lt;/code&gt; part won't be necessary anymore. Currently it's needed because:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;code&gt;cirq.ControlledGate&lt;/code&gt; doesn't implement a &lt;code&gt;_decompose_&lt;/code&gt; method. I've &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/1284&quot; rel=&quot;nofollow noreferrer&quot;&gt;opened an issue to fix this&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;code&gt;cirq.apply_unitary&lt;/code&gt; and &lt;code&gt;cirq.unitary&lt;/code&gt; should use &lt;code&gt;_decompose_&lt;/code&gt; when &lt;code&gt;_unitary_&lt;/code&gt; isn't implemented on a gate, so that circuit simulation works when using gates with nothing but a specified decomposition. There is an in-progress PR &lt;a href=&quot;https://github.com/quantumlib/Cirq/pull/1250&quot; rel=&quot;nofollow noreferrer&quot;&gt;to fix that&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I do like the idea of controlling the gates coming out of a method without having to define a new class. A unified &lt;code&gt;cirq.control(callable_or_gate_or_operation, optional_specified_control)&lt;/code&gt; method would be useful. I'll also open &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/1285&quot; rel=&quot;nofollow noreferrer&quot;&gt;an issue to do that&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-01-08T21:14:56.917" LastActivityDate="2019-01-08T21:14:56.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5147" PostTypeId="1" CreationDate="2019-01-08T22:30:58.257" Score="13" ViewCount="925" Body="&lt;p&gt;I'm unclear why the Bloch sphere representation of a maximally entangled qubit shows the state of the bit as being at the origin of the sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this illustration &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hkWbP.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hkWbP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;shows the effect of the simple circuit &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ci1FC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ci1FC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;over time, with &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; on the left and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; on the right. Both qubits end up at the origin of their respective spheres following application of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; &quot;waits&quot; at its initial value until after &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; moves &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is a maximally entangled qubit shown at the origin of a Bloch sphere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An explanation of sorts is &lt;a href=&quot;https://docs.q-ctrl.com/visualizations#two-qubits&quot; rel=&quot;noreferrer&quot;&gt;provided here&lt;/a&gt;, but I'm too much of a beginner to follow it.&lt;/p&gt;&#xA;" OwnerUserId="5318" LastEditorUserId="26" LastEditDate="2019-01-09T03:09:36.510" LastActivityDate="2021-03-17T07:52:15.397" Title="Why is an entangled qubit shown at the origin of a Bloch sphere?" Tags="&lt;entanglement&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5148" PostTypeId="2" ParentId="5147" CreationDate="2019-01-08T23:38:15.410" Score="10" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$(x,y,z)$&lt;/span&gt; be a point in the unit ball with &lt;span class=&quot;math-container&quot;&gt;$x^2+y^2+z^2 \leq 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The state associated with this point is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\rho &amp;amp;=&amp;amp; \frac{1}{2} (I_2 + x \sigma_x + y \sigma_y + z \sigma_z)\\&#xA;&amp;amp;=&amp;amp; \frac{1}{2} \begin{pmatrix}&#xA;1+z&amp;amp;x-iy\\&#xA;x+iy&amp;amp;1-z\\&#xA;\end{pmatrix}&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is just a convenient way to parameterize all &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; density matrices. This doesn't work as nicely for qudits with &lt;span class=&quot;math-container&quot;&gt;$d \neq 2$&lt;/span&gt;. But since we are talking &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, we might as well use this nice parameterization.&lt;/p&gt;&#xA;&lt;p&gt;In particular let &lt;span class=&quot;math-container&quot;&gt;$(x,y,z)=(0,0,0)$&lt;/span&gt;, the associated &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\rho &amp;amp;=&amp;amp; \frac{1}{2} \begin{pmatrix}&#xA;1+0&amp;amp;0-i0\\&#xA;0+i0&amp;amp;1-0\\&#xA;\end{pmatrix}\\&#xA;&amp;amp;=&amp;amp; \begin{pmatrix}&#xA;\frac{1}{2}&amp;amp;0\\&#xA;0&amp;amp;\frac{1}{2}&#xA;\end{pmatrix}&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the maximally mixed state.&lt;/p&gt;&#xA;&lt;p&gt;What is being shown is the state for only 1 qubit. This is the result after taking a partial trace over the other qubit.&lt;/p&gt;&#xA;&lt;p&gt;So if looking at the first one &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. It starts off in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\rho &amp;amp;=&amp;amp; | 0 \rangle \langle 0 |\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which corresponds to &lt;span class=&quot;math-container&quot;&gt;$(x,y,z)=(0,0,1)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then it goes to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\rho &amp;amp;=&amp;amp; H | 0 \rangle \langle 0 | H\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But after the CNOT it is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\rho &amp;amp;=&amp;amp; \text{Tr}_2 (\operatorname{CNOT}_{12} H | 0 0 \rangle \langle 00 | H \operatorname{CNOT}_{12}) \\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which ends up being the maximally mixed state corresponding to &lt;span class=&quot;math-container&quot;&gt;$(x,y,z)=(0,0,0)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Edit: As stated above &amp;quot;This is just a convenient way to parameterize all &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; density matrices. This doesn't work as nicely for qudits with &lt;span class=&quot;math-container&quot;&gt;$d \neq 2$&lt;/span&gt;. But since we are talking &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, we might as well use this nice parameterization.&amp;quot; So even if density matrices still make you queasy, don't think of the center of a sphere as being something particularly meaningful. It is just a convenient way to draw all states and in this case the center happens to line up with the maximally mixed state. So no it is not something fundamental. It doesn't generalize to other &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; or more qubits. Don't take this particular parameterization too seriously, it just allows us to plot the state in a way to quickly convey the information visually.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2021-03-17T07:52:15.397" LastActivityDate="2021-03-17T07:52:15.397" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5149" PostTypeId="2" ParentId="5125" CreationDate="2019-01-09T01:40:51.467" Score="4" Body="&lt;p&gt;From a physical point of view, there couldn't be a bigger difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Global phases are artefacts of the mathematical framework you are using, and have no physical meaning. Two states differing only by a global phase represent the same physical system.&#xA;Indeed, a more careful treatment of quantum mechanics would involve defining quantum states as elements of a &lt;em&gt;projective&lt;/em&gt; Hilbert space, in which all elements differing only by a phase are identified as equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, relative phases are in some sense the core of quantum mechanics. States differing by a relative phase are different systems that evolve in different ways, although they will appear identical if only measured in the measurement basis in which they only differ by such relative phase.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-01-09T01:40:51.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5150" PostTypeId="2" ParentId="5147" CreationDate="2019-01-09T06:12:00.120" Score="9" Body="&lt;p&gt;The Bloch sphere only represents the state of a single qubit. What you’re talking about is taking a multi-qubit state, and representing the state of just one of those qubits on the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the multi-qubit state is a product state (pure and separable), then the state of the single qubit is a pure state, and is represented as a point on the surface of the Bloch sphere. If the overall state is entangled, then the individual qubit is not pure, and is represented by a point that is on the interior of the Bloch sphere. The shorter the distance to the centre, the more mixed the individual qubit is, and hence the more entangled the global state is. The maximally entangled state yields the shortest possible distance, i.e. the point right at the centre of the sphere. AHussain’s answer gives you the mathematics of how to formally calculate that.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-09T06:12:00.120" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5152" PostTypeId="1" CreationDate="2019-01-09T17:03:45.383" Score="2" ViewCount="79" Body="&lt;p&gt;Suppose a have a circuit coded up in ProjectQ, suppose also it is that large to be hard enough to write it down as a unitary matrix by hands (e.g. order-finding, which is rather standard, but turns out to be very complex when you decompose the modular exponent into elementary 1- and 2-qubit gates, the typical Hilbert space size even for simple numbers would be &lt;span class=&quot;math-container&quot;&gt;$2^8-2^{10}$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you propose or you maybe you already know an existing way how to obtain a unitary or even a product of unitaries that delivers the circuit results applied to initial state?&lt;/p&gt;&#xA;" OwnerUserId="4264" LastEditorUserId="10480" LastEditDate="2021-01-31T20:37:34.190" LastActivityDate="2021-01-31T20:37:34.190" Title="Implement a circuit as a matrix in ProjectQ" Tags="&lt;circuit-construction&gt;&lt;projectq&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5153" PostTypeId="1" AcceptedAnswerId="5161" CreationDate="2019-01-09T19:25:17.170" Score="1" ViewCount="88" Body="&lt;p&gt;Following on from my question on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4373/4153&quot;&gt;educational quantum computing toys&lt;/a&gt;, I was wondering whether it is possible to implement the BB84 key distribution protocol with easily-obtained consumer hardware - lasers, fiber-optic cables, optical filters, etc. Does anyone know of any papers detailing this, or simple demonstrations, or whether it's theoretically possible? I did find &lt;a href=&quot;https://uwaterloo.ca/stories/weve-got-photons&quot; rel=&quot;nofollow noreferrer&quot;&gt;an article&lt;/a&gt; detailing an experiment from the University of Waterloo.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-05-08T10:21:28.753" LastActivityDate="2019-05-08T10:21:28.753" Title="Implementing BB84 protocol with easily-obtained consumer hardware" Tags="&lt;resource-request&gt;&lt;photonics&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5154" PostTypeId="1" AcceptedAnswerId="5163" CreationDate="2019-01-09T20:19:45.323" Score="6" ViewCount="213" Body="&lt;p&gt;By &quot;quantum compiling&quot;, what I mean is classical algorithms to solve the following problem: given a &lt;span class=&quot;math-container&quot;&gt;$SU(D)$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (the goal) and a set of &lt;span class=&quot;math-container&quot;&gt;$SU(D)$&lt;/span&gt; unitary matrices &lt;span class=&quot;math-container&quot;&gt;$V_1 \cdots V_N$&lt;/span&gt; (the gates), find a string &lt;span class=&quot;math-container&quot;&gt;$i_1\cdots i_K$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U \approx \prod_{k=1}^K V_{i_k}\text.&#xA;$$&lt;/span&gt;&#xA;In other words: given a target unitary and a set of gates, implement the target unitary from those gates. Note that I'm not just interested in optimizing a pre-existing circuit, but generating a circuit from a full unitary matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What software packages are available which solve this problem? In particular, are there software packages ready-to-use with IBM Q Experience/Qiskit or Rigetti's forest?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I understand that there are many algorithms, with different performance characteristics, which tackle this. I'm interested less in optimal performance characteristics than in low-effort usability. Is the current ecosystem well-enough-developed that I don't need to pick and implement one of these algorithms myself?)&lt;/p&gt;&#xA;" OwnerUserId="5513" LastEditorUserId="409" LastEditDate="2019-01-10T08:09:32.333" LastActivityDate="2019-01-10T08:28:25.717" Title="Status of software packages for quantum compiling" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;solovay-kitaev-algorithm&gt;&lt;rigetti&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5155" PostTypeId="1" AcceptedAnswerId="5158" CreationDate="2019-01-09T21:50:06.197" Score="2" ViewCount="510" Body="&lt;p&gt;I want to compile &lt;span class=&quot;math-container&quot;&gt;$$\exp(-i \theta \sigma_i^z \sigma_j^z)$$&lt;/span&gt; down to a gate sequence of single qubit rotations and CNOTs. How do I do this? What is the general procedure for compiling a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to an elementary gate sequence? (As I understand it, this is a very hard problem, but I am curious how I could begin going about it.)&lt;/p&gt;&#xA;" OwnerUserId="5467" LastEditorUserId="26" LastEditDate="2019-01-10T03:23:28.170" LastActivityDate="2019-01-10T03:23:28.170" Title="Gate sequence for exponential of product of Pauli Z operators" Tags="&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5156" PostTypeId="1" AcceptedAnswerId="5157" CreationDate="2019-01-09T22:37:52.707" Score="3" ViewCount="109" Body="&lt;p&gt;I want to write code that prints out the controls of each operation executed during a simulation in Q#. For example this code prints the control counts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var qsim = new QCTraceSimulator(config);&#xA;qsim.OnOperationStart += (op, arg) =&amp;gt; {&#xA;    Console.WriteLine($&quot;{Controls(op, arg).Length&quot;});&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm having trouble writing the &lt;code&gt;Controls&lt;/code&gt; function, which extracts a list of qubits being used as controls. When the operation is uncontrolled, or controlled by 0 qubits, the returned array should be of length 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue I'm running into is that the type and layout of &lt;code&gt;arg.Value&lt;/code&gt; varies from operation to operation, even after conditioning on &lt;code&gt;op.Variant&lt;/code&gt; being &lt;code&gt;OperationFunctor.ControlledAdjoint&lt;/code&gt; or &lt;code&gt;OperationFunctor.Controlled&lt;/code&gt;. I can handle individual cases by inspecting the types, but I keep running into new unhandled cases. This indicates there's probably a &quot;correct&quot; way to do this that I'm missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, how do I implement this function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;object[] Controls(ICallable op, IApplyData arg) {&#xA;    ???&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By &quot;controls&quot; I always mean the &lt;code&gt;cs&lt;/code&gt; in &lt;code&gt;Controlled Op(cs, ...)&lt;/code&gt;. The same operation may have different controls when expressed in different ways. For example, the controls list of &lt;code&gt;Controlled Toffoli(a, (b, c, d))&lt;/code&gt; is the list &lt;code&gt;[a]&lt;/code&gt; whereas the controls list of &lt;code&gt;Controlled X([a, b, c], d)&lt;/code&gt; is the list &lt;code&gt;[a, b, c]&lt;/code&gt;. A further example: the controls list of &lt;code&gt;Toffoli(b, c, d)&lt;/code&gt; is &lt;code&gt;[]&lt;/code&gt;, even though normally one might think of the first two arguments as the controls. It is of course expected that within &lt;code&gt;Toffoli(b, c, d)&lt;/code&gt; there may be a sub-operation &lt;code&gt;Controlled X((b, c), d)&lt;/code&gt; where the controls list is &lt;code&gt;[b, c]&lt;/code&gt;; I'm not thinking of controls as some kind of absolute concept that is invariant as you go down through layers of abstraction.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-10T03:21:51.037" LastActivityDate="2019-01-11T21:31:51.837" Title="How do I get a list of control qubits from Q# operations when tracing the simulation in C#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5157" PostTypeId="2" ParentId="5156" CreationDate="2019-01-09T23:42:21.287" Score="6" Body="&lt;p&gt;&lt;code&gt;arg.Value&lt;/code&gt; contains the actual tuple that the controlled operation receives at runtime. It's a two item tuple in which the first item is the control qubits, and the second another tuple with the arguments the operation normally expects, so in your case you are only interested in the first item of this tuple.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, &lt;code&gt;arg.Value&lt;/code&gt; can be anything, thus it has &lt;code&gt;object&lt;/code&gt; as type, but fear not, using a little bit of C#'s reflection is easy to retrieve its content. The implementation you are looking for is this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    static Qubit[] Controls(ICallable op, IApplyData arg)&#xA;    {&#xA;        // Uncontrolled operations have no control qubits.&#xA;        if (op.Variant != OperationFunctor.Controlled &amp;amp;&amp;amp;&#xA;            op.Variant != OperationFunctor.ControlledAdjoint)&#xA;        {&#xA;            return new Qubit[0];&#xA;        }&#xA;&#xA;        // Get the first item of the (controls, args) tuple.&#xA;        dynamic v = arg.Value;&#xA;        QArray&amp;lt;Qubit&amp;gt; ctrls = v.Item1;&#xA;        return ctrls.ToArray();&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the array of Qubits is encapsulated in something called a &lt;code&gt;QArray&amp;lt;Qubit&amp;gt;&lt;/code&gt;, &lt;code&gt;QArray&lt;/code&gt; is the data structure we use in simulation for all Q# arrays.&lt;/p&gt;&#xA;" OwnerUserId="2918" LastEditorUserId="119" LastEditDate="2019-01-11T21:31:51.837" LastActivityDate="2019-01-11T21:31:51.837" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5158" PostTypeId="2" ParentId="5155" CreationDate="2019-01-10T00:35:49.030" Score="3" Body="&lt;p&gt;On the computational basis. This acts as &lt;span class=&quot;math-container&quot;&gt;$e^{-i \theta}$&lt;/span&gt; when both are the same and &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta}$&lt;/span&gt; when they are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So first do a circuit that computes whether or not they are the same or not. That is do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;| 0 0 \rangle &amp;amp;\to&amp;amp; | 0 0 \rangle\\&#xA;| 0 1 \rangle &amp;amp;\to&amp;amp; | 0 1 \rangle\\&#xA;| 1 0 \rangle &amp;amp;\to&amp;amp; | 1 1 \rangle\\&#xA;| 1 1 \rangle &amp;amp;\to&amp;amp; | 1 0 \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is the first qubit is left alone and the second is 0 when they are the same and 1 when different. This is a &lt;span class=&quot;math-container&quot;&gt;$CNOT_{12}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now do a single qubit unitary that does&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;| 0 \rangle &amp;amp;\to&amp;amp; e^{-i \theta} | 0 \rangle\\&#xA;| 1 \rangle &amp;amp;\to&amp;amp; e^{i \theta} | 1 \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now put the second qubit back to what it was with another &lt;span class=&quot;math-container&quot;&gt;$CNOT_{12}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In total:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;| 0 0 \rangle &amp;amp;\to&amp;amp; e^{-i \theta} | 0 0 \rangle\\&#xA;| 0 1 \rangle &amp;amp;\to&amp;amp; e^{i \theta} | 0 1 \rangle\\&#xA;| 1 0 \rangle &amp;amp;\to&amp;amp; e^{i \theta} | 1 0 \rangle\\&#xA;| 1 1 \rangle &amp;amp;\to&amp;amp; e^{-i \theta} | 1 1 \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It does the right thing on the computational basis and so we are done.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-01-10T00:35:49.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5159" PostTypeId="1" AcceptedAnswerId="5168" CreationDate="2019-01-10T02:57:59.047" Score="1" ViewCount="115" Body="&lt;p&gt;I've been using qiskit for about a year now, and as of late, I've had issues finding an available backend to run my circuit on. Looking into the matter, I reinstalled qiskit to find that most everything had changed quite a bit. Now when I try to run just a basic test circuit program, taken from the tutorial I get this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;~$ python3 test.py&#xA;&#xA;Traceback (most recent call last):&#xA;  File &quot;test.py&quot;, line 27, in &amp;lt;module&amp;gt;&#xA;    job = execute(circ, backend)&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/tools/compiler.py&quot;, line 108, in execute&#xA;    skip_transpiler, seed_mapper, pass_manager, memory)&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/tools/compiler.py&quot;, line 67, in compile&#xA;    coupling_map=coupling_map, seed=seed, memory=memory)&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/converters/circuits_to_qobj.py&quot;, line 61, in circuits_to_qobj&#xA;    coupling_map))&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/converters/circuits_to_qobj.py&quot;, line 92, in _circuit_to_experiment&#xA;    json_circuit = DagUnroller(dag, JsonBackend(dag.basis)).execute()&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/unroll/_dagunroller.py&quot;, line 38, in execute&#xA;    self._process()&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/unroll/_dagunroller.py&quot;, line 161, in _process&#xA;    self.backend.new_qreg(name, width)&#xA;  File &quot;/home/micciche/.local/lib/python3.5/site-packages/qiskit/unroll/_jsonbackend.py&quot;, line 98, in new_qreg&#xA;    assert size &amp;gt;= 0, &quot;invalid qreg size&quot;&#xA;  TypeError: unorderable types: QuantumRegister() &amp;gt;= int()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anybody know how to resolve this? Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: This is the code I tried to run, which I just copied from a tutorial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit import execute&#xA;&#xA;# Create a Quantum Register with 3 qubits.&#xA;q = QuantumRegister(3, 'q')&#xA;&#xA;# Create a Quantum Circuit acting on the q register&#xA;circ = QuantumCircuit(q)&#xA;&#xA;# Add a H gate on qubit 0, putting this qubit in superposition.&#xA;circ.h(q[0])&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting&#xA;# the qubits in a Bell state.&#xA;circ.cx(q[0], q[1])&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 2, putting&#xA;# the qubits in a GHZ state.&#xA;circ.cx(q[0], q[2])&#xA;&#xA;# Import Aer&#xA;from qiskit import BasicAer&#xA;&#xA;# Run the quantum circuit on a statevector simulator backend&#xA;backend = BasicAer.get_backend('statevector_simulator')&#xA;&#xA;# Create a Quantum Program for execution&#xA;job = execute(circ, backend)&#xA;&#xA;result = job.result()&#xA;&#xA;outputstate = result.get_statevector(circ, decimals=3)&#xA;print(outputstate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5516" LastEditorUserId="5516" LastEditDate="2019-01-10T13:29:23.153" LastActivityDate="2019-01-10T15:32:38.373" Title="TypeError: unorderable types: QuantumRegister() &gt;= int()" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5160" PostTypeId="2" ParentId="4035" CreationDate="2019-01-10T04:02:26.037" Score="5" Body="&lt;p&gt;I came across an approach to solve differential equations using D-wave quantum annealer. The link is here: &lt;a href=&quot;https://arxiv.org/abs/1812.10572&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1812.10572&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic method is to derive the energy functional for the differential equation that is then minimized on a quantum annealer. The minimization can use finite element basis to map the energy to a localized sub graph of the D-wave machine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage of this over classical algorithm is that there is no need to even build a system of equations, so there is memory savings and avoids cost of  assembly of a linear system. The solution complexity however is same as the classical conjugate gradient method: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(n)$&lt;/span&gt;. The HHL algorithm on the other hand can give exponential speed up, but like you said does not directly give the solution, plus we do need to assemble the linear system in the first place.&lt;/p&gt;&#xA;" OwnerUserId="5517" LastEditorUserId="1386" LastEditDate="2019-01-10T08:02:23.453" LastActivityDate="2019-01-10T08:02:23.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5161" PostTypeId="2" ParentId="5153" CreationDate="2019-01-10T07:15:14.763" Score="3" Body="&lt;p&gt;I am glad you enjoyed my experiments! :) I'd be happy to talk more about how I ran that project --- dm me at twitter.com/crazy4pi314.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To your question, I don't know of any good papers or articles on the setup, but you can get a pretty reasonable demo of polarization-encoded BB84 with a few pretty common components:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;polarized laser pointer&lt;/li&gt;&#xA;&lt;li&gt;some half wave plates&lt;/li&gt;&#xA;&lt;li&gt;polarizers to represent Eve&lt;/li&gt;&#xA;&lt;li&gt;a 50:50 beam splitter&lt;/li&gt;&#xA;&lt;li&gt;2 polarizing beam splitters&lt;/li&gt;&#xA;&lt;li&gt;2 photo detectors&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It is not &lt;em&gt;really&lt;/em&gt; quantum key distribution (consumer grade single photon sources aren't really a thing, sadly) but it worked well in a number of outreach events I have done with middle schoolers -&gt; undergrads. We just had a bunch of ThorLabs &quot;Legos&quot; and let them in two teams try to assemble a working Alice and Bob. Then, if there was an odd number someone got to be eve with a polarizer between. We had some very simple displays on a computer showing where signal was being received at the detectors.&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2019-01-10T07:15:14.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5162" PostTypeId="1" CreationDate="2019-01-10T07:28:53.303" Score="6" ViewCount="141" Body="&lt;p&gt;Say I have an &lt;span class=&quot;math-container&quot;&gt;$N \times N$&lt;/span&gt; matrix and I want to know the eigenvalues to a precision of &lt;span class=&quot;math-container&quot;&gt;$\pm \epsilon$&lt;/span&gt;. How many qubits and how many gates do I need?&lt;/p&gt;&#xA;" OwnerUserId="5518" LastEditorUserId="5518" LastEditDate="2019-01-10T08:27:48.263" LastActivityDate="2019-02-08T03:52:36.060" Title="How many qubits and how many gates, are required for finding the eigenvalues of a matrix?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="5163" PostTypeId="2" ParentId="5154" CreationDate="2019-01-10T08:28:25.717" Score="5" Body="&lt;p&gt;For Qiskit, there are two tools you can check out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://qiskit.org/documentation/_autodoc/qiskit.mapper._compiling.html#qiskit.mapper._compiling.two_qubit_kak&quot; rel=&quot;noreferrer&quot;&gt;two qubit kak&lt;/a&gt; tool does exactly what you want for 2 qubits. If you give it a two qubit unitary, it gives you a list of gates to realize this, using the standard gate set used in Qiskit. This tool uses &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308006&quot; rel=&quot;noreferrer&quot;&gt;Vatan and Williams optimal two-qubit circuit&lt;/a&gt;. The decomposition algorithm used is explained in &lt;a href=&quot;https://arxiv.org/abs/0806.4015&quot; rel=&quot;noreferrer&quot;&gt;Drury and Love&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example in code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.mapper import two_qubit_kak&#xA;import numpy as np&#xA;&#xA;# matrix to decompose&#xA;perm = np.array([[0.,0.,0.,1.], [1.,0.,0.,0.], [0.,1.,0.,0.], [0.,0.,1.,0.] ])&#xA;&#xA;#decomposition&#xA;permCircuit = two_qubit_kak(perm)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The corresponding result is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[{'name': 'u1', 'args': [0], 'params': (0.0, 0.0, 1.5707963267948968)}, {'name': 'u2', 'args': [1], 'params': (1.5707963267948966, 2.220446049250313e-16, -3.1415926535897922)}, {'name': 'cx', 'args': [1, 0], 'params': ()}, {'name': 'u1', 'args': [0], 'params': (0.0, 0.0, 1.5707963267948968)}, {'name': 'u2', 'args': [1], 'params': (1.5707963267948966, 3.141592653589793, -3.141592653589793)}, {'name': 'cx', 'args': [0, 1], 'params': ()}, {'name': 'u3', 'args': [1], 'params': (3.141592653589793, 0.0, 0.0)}, {'name': 'cx', 'args': [1, 0], 'params': ()}, {'name': 'u2', 'args': [0], 'params': (1.5707963267948966, 1.5707963267948968, -1.5707963267948957)}, {'name': 'u2', 'args': [1], 'params': (1.5707963267948966, -4.71238898038469, -1.5707963267948957)}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;u1&lt;/code&gt;, etc here are single qubit rotations as defined by the &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;noreferrer&quot;&gt;OpenQASM standard&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another tool is arbitary state vector initialization, which can be used for an arbitrary number of qubits. For this you can state what state vector you want, and you'll get a circuit that builds it. Obviously this is not what you asked for, but it may nevertheless be useful depending on your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example in code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qubit = QuantumRegister(2)&#xA;bit = ClassicalRegister(2)&#xA;circuit = QuantumCircuit(qubit,bit)&#xA;&#xA;vector = [0, 1 / np.sqrt(3), 1 / np.sqrt(3), 1 / np.sqrt(3) ]&#xA;circuit.initialize( vector, qubit )&#xA;&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here the final print command yields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                       ┌───┐┌────────────┐┌───┐┌────────────┐&#xA; q_0: |0&amp;gt;──────────────┤ X ├┤ Ry(0.7854) ├┤ X ├┤ Ry(2.3562) ├&#xA;         ┌────────────┐└─┬─┘└────────────┘└─┬─┘└────────────┘&#xA; q_1: |0&amp;gt;┤ Ry(1.9106) ├──■──────────────────■────────────────&#xA;         └────────────┘                                      &#xA;  c_0: 0 ════════════════════════════════════════════════════&#xA;&#xA;  c_1: 0 ════════════════════════════════════════════════════&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Other than these existing Qiskit tools, the only algorithm I know of that is planning an implementation is that of &lt;a href=&quot;https://arxiv.org/abs/1609.08103&quot; rel=&quot;noreferrer&quot;&gt;Iten, et al&lt;/a&gt;. I have heard that a Mathematica version will be produced soon.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-01-10T08:28:25.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5164" PostTypeId="1" CreationDate="2019-01-10T09:47:36.523" Score="5" ViewCount="263" Body="&lt;p&gt;I'm looking for an efficient implementation of the Clifford group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt;&#xA;of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&#xA;The Clifford group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; has stucture &lt;span class=&quot;math-container&quot;&gt;$(2_+^{1+2n} \circ C_8).Sp(2,n)$&lt;/span&gt;, &#xA;where  &lt;span class=&quot;math-container&quot;&gt;$2_+^{1+2n}$&lt;/span&gt; denotes an extraspecial 2 group of &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; type, &lt;span class=&quot;math-container&quot;&gt;$C_8$&lt;/span&gt; the&#xA;cyclic group of order 8, and &lt;span class=&quot;math-container&quot;&gt;$Sp(2n,2)$&lt;/span&gt; a symplectic group over the binary field. &#xA;Here &quot;&lt;span class=&quot;math-container&quot;&gt;$\circ$&lt;/span&gt;&quot; means the central product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Clifford group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; can be used for the simulation of quantum &#xA;computing with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and a restricted set of qubit gates in polynomial time,&#xA;see e.g. [1]. It has a unitary complex representation of dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, &#xA;see e.g. [2].  Quantum theorists use an explicit construction &#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of that representation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; based on Pauli matrices, &#xA;see [1]. Vectors in &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are called &lt;strong&gt;state vectors&lt;/strong&gt;. In [1] the group &#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; is generated by the qubit gates CNOT, Phase, and Hadamard.&#xA;These gates operate (repeatedly) on the state vectors starting at a certain &#xA;unit vector &lt;span class=&quot;math-container&quot;&gt;$e_0 = |0 \ldots 0 \rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt; be the image of &lt;span class=&quot;math-container&quot;&gt;$e_0$&lt;/span&gt; &#xA;under the operation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; in the state vector space. The states in &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt; are also called &#xA;&lt;strong&gt;stabilizer states&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need an  implementation of representation&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; that supports the following operations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiplication, inversion, and test for equality in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Operation of an element of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; on a state vector in &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Output of an entry of the matrix representing &#xA;an element of  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Output of an entry of a state vector in &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Some kind of qubit measurement applied to a state vector in &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt;,&#xA;as in [1].&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Entries of matrices and vectors are with respect to the representation &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;&#xA;in [1]. Runtime should be polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some concrete ideas for such an implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Has anybody implemented  a similar representation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt;  before?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the representation in [1] implements state vectors in &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt;&#xA;(up to a scalar multiple), and operation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$V_0$&lt;/span&gt;, but not &#xA;the computation of entries of group elements or state vectors. In [1] elements of&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_n$&lt;/span&gt; cannot easily be tested for equality. I also need to &#xA;distingiush between scalar multiples of a state vector, which is irrelevant &#xA;in quantum theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0406196&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] &lt;a href=&quot;https://arxiv.org/abs/math/0001038&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/math/0001038&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;&lt;a href=&quot;https://mathoverflow.net/questions/320160/efficient-implementation-of-the-clifford-group-for-n-qubits&quot;&gt;Cross-posted from MathOverflow&lt;/a&gt;&lt;/strong&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="14018" LastEditorUserId="26" LastEditDate="2019-01-10T13:32:01.910" LastActivityDate="2020-12-03T19:48:34.563" Title="Efficient implementation of the Clifford group for $n$ qubits" Tags="&lt;matrix-representation&gt;&lt;stabilizer-state&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5165" PostTypeId="1" CreationDate="2019-01-10T10:26:05.743" Score="5" ViewCount="313" Body="&lt;p&gt;Suppose we have a square matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt;. It is given that any element &lt;span class=&quot;math-container&quot;&gt;$M_{ij}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a real number and satisfies &lt;span class=&quot;math-container&quot;&gt;$0 \leq M_{ij} \leq 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\forall$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt;. No other property for &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is known. Is it possible to create a new matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s.t.$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a square matrix of size &lt;span class=&quot;math-container&quot;&gt;$2n\times 2n$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is of the form &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}M&amp;amp;A\\B&amp;amp;C\end{bmatrix}$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$A,B,C$&lt;/span&gt; are all of size &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; and all of &lt;span class=&quot;math-container&quot;&gt;$A,B,C$&lt;/span&gt; are unique linear transformations of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;The elements of &lt;span class=&quot;math-container&quot;&gt;$A,B,C$&lt;/span&gt; can take complex values,&lt;/li&gt;&#xA;&lt;li&gt;And that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, &lt;span class=&quot;math-container&quot;&gt;$i.e.$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger = U^\dagger U = I$&lt;/span&gt;, (where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identitiy matrix, and &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; is symbol for complex conjugate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you  &lt;/p&gt;&#xA;" OwnerUserId="5521" LastEditorUserId="26" LastEditDate="2019-01-14T16:55:21.813" LastActivityDate="2019-01-14T16:55:21.813" Title="Extending a square matrix to a unitary matrix" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5166" PostTypeId="2" ParentId="5165" CreationDate="2019-01-10T10:37:39.327" Score="4" Body="&lt;p&gt;No. The rows and columns of a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; must have a sum-mod-square of 1.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i}|U_{ij}|^2=\sum_{j}|U_{ij}|^2=1&#xA;$$&lt;/span&gt;&#xA;Your &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, as specified, could have a 1 element along a whole row so the sum-mod-square of the corresponding row in &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. So, unless &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt;, it's impossible without further constraints on &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-10T10:37:39.327" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5167" PostTypeId="1" CreationDate="2019-01-10T12:22:28.853" Score="5" ViewCount="431" Body="&lt;p&gt;DaftWulie's answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5165/extending-a-square-matrix-to-a-unitary-matrix&quot;&gt;Extending a square matrix to a Unitary matrix&lt;/a&gt; says that extending a matrix into a unitary cannot be done unless there's constraints on the matrix. What are the constraints?&lt;/p&gt;&#xA;" OwnerUserId="5518" LastEditorUserId="55" LastEditDate="2020-08-19T11:36:14.450" LastActivityDate="2020-08-19T11:36:14.450" Title="What are the constraints on a matrix that allow it to be &quot;extended&quot; into a unitary?" Tags="&lt;mathematics&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5168" PostTypeId="2" ParentId="5159" CreationDate="2019-01-10T13:58:57.533" Score="1" Body="&lt;p&gt;The code you provide works fine for me, so I guess that something is wrong with your installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I recommend running the command&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip uninstall qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and also&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip uninstall qiskit-terra&#xA;pip uninstall qiskit-aqua&#xA;pip uninstall qiskit-aer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then reinstalling with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-01-10T13:58:57.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5169" PostTypeId="2" ParentId="5167" CreationDate="2019-01-10T14:20:47.080" Score="7" Body="&lt;p&gt;A necessary and sufficient condition is that, given an &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, you can construct a &lt;span class=&quot;math-container&quot;&gt;$2n\times 2n$&lt;/span&gt; unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; provided the singular values of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; are all upper bounded by 1.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Sufficiency&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;To see this, express the singular value decomposition of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=RDV&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is diagonal and &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; are unitary. Now define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left(\begin{array}{cc}&#xA;M &amp;amp; R\sqrt{\mathbb{I}-D^2}V \\&#xA;R\sqrt{\mathbb{I}-D^2}V &amp;amp; -M&#xA;\end{array}\right),&#xA;$$&lt;/span&gt;&#xA;which we can only do if the singular values are no larger than 1. Let's verify that it's unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;UU^\dagger&amp;amp;=\left(\begin{array}{cc}&#xA;RDV &amp;amp; R\sqrt{\mathbb{I}-D^2}V \\&#xA;R\sqrt{\mathbb{I}-D^2}V &amp;amp; -RDV&#xA;\end{array}\right)\left(\begin{array}{cc}&#xA;V^\dagger DR^\dagger &amp;amp; V^\dagger\sqrt{\mathbb{I}-D^2}R^\dagger \\&#xA;V^\dagger\sqrt{\mathbb{I}-D^2}R^\dagger &amp;amp; -V^\dagger DR^\dagger&#xA;\end{array}\right) \\&#xA;&amp;amp;=\left(\begin{array}{cc}&#xA;RD^2R^\dagger+R(\mathbb{I}-D^2)R^\dagger &amp;amp; 0 \\&#xA;0 &amp;amp;  RD^2R^\dagger+R(\mathbb{I}-D^2)R^\dagger&#xA;\end{array}\right) \\&#xA;&amp;amp;=\mathbb{I}.&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Necessity&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Imagine I have a matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with a singular value &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;gt;1$&lt;/span&gt; and corresponding normalised vector &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt;. Assume I construct a unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left(\begin{array}{cc} M &amp;amp; A \\ B &amp;amp; C \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Let's act &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the state &lt;span class=&quot;math-container&quot;&gt;$\left(\begin{array}{c} |\lambda\rangle \\ 0 \end{array}\right)$&lt;/span&gt;. We get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U\left(\begin{array}{c} |\lambda\rangle \\ 0 \end{array}\right)=\left(\begin{array}{c} M|\lambda\rangle \\ B|\lambda\rangle \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;This output state must have a norm that is at least the norm of &lt;span class=&quot;math-container&quot;&gt;$M|\lambda\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;gt;1$&lt;/span&gt;. But if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary, the norm must be 1. So it must be impossible to perform such a construction if there exists a singular value &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;gt;1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-10T14:20:47.080" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5171" PostTypeId="2" ParentId="5167" CreationDate="2019-01-10T15:45:24.990" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{\boldsymbol{#1}}$&lt;/span&gt;Here is a slightly different way to prove what &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5169/55&quot;&gt;the other excellent answer&lt;/a&gt; did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary &lt;em&gt;if and only if&lt;/em&gt; it sends orthonormal bases into orthonormal bases.&#xA;This, in particular, means that if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary then &lt;span class=&quot;math-container&quot;&gt;$\|U\bs v\|=1$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$\bs v$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\|\bs v\|=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us write the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$M\bs u_k=s_k\bs v_k$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0$&lt;/span&gt; are the singular values of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is an extension of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$U\bs u_k=s_k \bs v_k+\bs w_k$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\bs w_k$&lt;/span&gt; orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\bs v_k$&lt;/span&gt; (and more generally to the whole range of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If follows that if, for any &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s_k&amp;gt;1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\|U\bs u_k\|&amp;gt;1$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if &lt;span class=&quot;math-container&quot;&gt;$s_k\le1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, let us show how can always construct a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that contains &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as a submatrix.&#xA;Let us denote with &lt;span class=&quot;math-container&quot;&gt;$\bs v\oplus \bs 0$&lt;/span&gt; the vectors in the extended &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt;-dimensional space that are built by appending zeros to the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional vector &lt;span class=&quot;math-container&quot;&gt;$\bs v$&lt;/span&gt;, and with &lt;span class=&quot;math-container&quot;&gt;$\bs 0\oplus\bs v$&lt;/span&gt; the vectors that are equal to &lt;span class=&quot;math-container&quot;&gt;$\bs v$&lt;/span&gt; in the last &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensions by zero in the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; ones.&#xA;Being &lt;span class=&quot;math-container&quot;&gt;$\{\bs u_k\}_k$&lt;/span&gt; a basis for the original space, it follows that &lt;span class=&quot;math-container&quot;&gt;$\{\bs u_k\oplus \bs 0,\bs0\oplus\bs u_k\}_k$&lt;/span&gt; is a basis for the extended space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will define &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; through its action on the vectors &lt;span class=&quot;math-container&quot;&gt;$u_k\oplus \bs 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bs0\oplus u_k$&lt;/span&gt; as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U(\bs u_k\oplus \bs 0)&amp;amp;=s_k(\bs v_k\oplus\bs 0)+\sqrt{1-s_k^2}(\bs 0\oplus \bs v_k) \\&#xA;U(\bs0 \oplus \bs u_k)&amp;amp;=\sqrt{1-s_k^2}(\bs v_k\oplus\bs 0)-s_k(\bs 0\oplus \bs v_k).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can then check that all of these output vectors form an orthonormal system in the extended space, and thus &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-01-10T15:45:24.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5172" PostTypeId="1" CreationDate="2019-01-10T18:20:24.090" Score="2" ViewCount="1141" Body="&lt;p&gt;I'm trying to plot a set of data using &lt;code&gt;plot_histogram&lt;/code&gt;, but the rendered image looks like this (the larger values are outside the image): &#xA; &lt;a href=&quot;https://i.stack.imgur.com/BZy9Om.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BZy9Om.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set the y-axis to contain larger values? Or, is there any alternative way to avoid this problem? I have tried the &lt;code&gt;figsize(,)&lt;/code&gt; &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/basics/plotting_data_in_qiskit.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;option&lt;/a&gt; but it isn't effective.&lt;/p&gt;&#xA;" OwnerUserId="2757" LastEditorUserId="26" LastEditDate="2019-01-10T18:29:06.357" LastActivityDate="2019-01-10T23:23:13.097" Title="Plotting data in QISKit using plot_histogram" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5173" PostTypeId="1" AcceptedAnswerId="5178" CreationDate="2019-01-10T22:46:55.327" Score="10" ViewCount="398" Body="&lt;p&gt;Qiskit can be used to submit jobs to IBM devices using Python (or Swift and JavaScript). But what if I want to use a different language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose I have a specific circuit I want to run. Assume I've already created it in Python Qiskit, and generated the corresponding qasm string or (ideally) the full qobj object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to be able to run this and get the results back in any language of my choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I understand, these is a way to do this via HTML. The information generated in Qiskit can be turned into a JSON, and then submitted over the web. This is the way ProjectQ sends jobs to IBM devices (though they do it in Python).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since reverse engineering &lt;a href=&quot;https://github.com/ProjectQ-Framework/ProjectQ/blob/develop/projectq/backends/_ibm/_ibm_http_client.py&quot; rel=&quot;noreferrer&quot;&gt;the ProjectQ code&lt;/a&gt; is a little daunting, I'd like a simple guide to using this feature. Especially in a language other than Python.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-01-11T09:01:08.383" LastActivityDate="2019-01-13T16:56:40.533" Title="Submitting jobs to IBM devices without Python" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5174" PostTypeId="2" ParentId="5172" CreationDate="2019-01-10T23:23:13.097" Score="3" Body="&lt;p&gt;This is a bug in the &lt;code&gt;plot_histogram&lt;/code&gt; function. I pushed a fix for it here: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/1661&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/1661&lt;/a&gt; In the meantime you can probably workaround this locally by doing something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fig = plot_histogram(data)&#xA;ax = fig.axes[0]&#xA;ax.set_ylim(0, 1)&#xA;fig.savefig('output.png') # Or whatever you doing to output the image&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will adjust the y axis boundaries to be between 0 and 1.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2019-01-10T23:23:13.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5175" PostTypeId="1" CreationDate="2019-01-11T01:30:50.437" Score="2" ViewCount="69" Body="&lt;p&gt;Can quantum computing do a simple simulated extrapolation of &lt;strong&gt;CRISPR&lt;/strong&gt; (clustered regularly interspaced short palindromic repeats) projects using a limited number of variables? I mean something like finding short clusters of palindrome repeats in a genome sequence, where the binding can take place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; I am not qualified in the CRISPR area, and this is a question a client has asked. I would love any input and even questions to feedback for extra information.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="5383" LastEditorUserId="26" LastEditDate="2019-01-11T03:39:29.280" LastActivityDate="2019-01-11T03:39:29.280" Title="Extrapolation of CRISPR" Tags="&lt;algorithm&gt;&lt;biology&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5176" PostTypeId="1" AcceptedAnswerId="5219" CreationDate="2019-01-11T03:15:06.617" Score="4" ViewCount="111" Body="&lt;p&gt;Some of my larger annealer embeddings (~200 qubits) don't anneal down to the ground state while some of them do very easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there established guidelines for designing annealer embeddings to ensure that ground state configurations can be easily found? If so, where can this information be found? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, is addressing this issue more a matter of properly setting annealer parameters/annealing schedule. What are some good papers with information on this?&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="26" LastEditDate="2019-01-11T03:28:16.517" LastActivityDate="2019-01-17T16:50:30.667" Title="Are there established best practices for designing Dwave embeddings?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;embedding&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5178" PostTypeId="2" ParentId="5173" CreationDate="2019-01-11T05:27:00.357" Score="8" Body="&lt;p&gt;I will try answering this way but I have not tried it myself. Just reverse engineering reading the code with a few notions of HTML request.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume in the language of your choice, you have the ability to send HTTP requests via GET and POST methods. The &lt;code&gt;api_url&lt;/code&gt; is &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/api/&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/api/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To submit a job, you will send a POST request with some information (like you have filled a form on the web and you want to talk to a server). It is like addressing a server with a dictionary of information.&#xA;It will be to the link &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/api/Jobs&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/api/Jobs&lt;/a&gt;&#xA;with the POST request header set as &lt;code&gt;application/json&lt;/code&gt; (showing how you submit the information). The information here is submitted in a JSON formatting in the body of the request:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;   &quot;data&quot;: QASM as string or JSON string,&#xA;&#xA;   &quot;params&quot;: {&quot;access_token&quot;: access_token,&#xA;                              &quot;deviceRunType&quot;: device,&#xA;                              &quot;fromCache&quot;: &quot;false&quot;,&#xA;                              &quot;shots&quot;: shots}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I guess we can add in params &lt;code&gt;maxCredits&lt;/code&gt; and other parameters for submission.&#xA;device refers to the name of the backend if I follow their comments: &lt;code&gt;simulator&lt;/code&gt;, &lt;code&gt;ibmqx4&lt;/code&gt;, or &lt;code&gt;ibmqx5&lt;/code&gt;.&#xA;You get an answer back as JSON again with an id argument referring to the &lt;code&gt;execution_id&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once it is submitted, your job will be in queue. You will have to request by GET this job ID to get the answer from the backend.&#xA;The GET URL is: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/api/Jobs/execution_id&quot; rel=&quot;noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/api/Jobs/execution_id&lt;/a&gt;.&#xA;You will get another JSON answer (put it in a &lt;code&gt;r_json&lt;/code&gt; variable). If it has the &lt;code&gt;qasms&lt;/code&gt; item, see if &lt;code&gt;r_json['qasms'][0]&lt;/code&gt; has a &lt;code&gt;result&lt;/code&gt; item and you will get the result of the submission. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should sum up the procedure.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-01-13T16:56:40.533" LastActivityDate="2019-01-13T16:56:40.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5179" PostTypeId="1" AcceptedAnswerId="5180" CreationDate="2019-01-11T08:33:10.977" Score="11" ViewCount="4763" Body="&lt;p&gt;When constructing the matrices for the two CNOT based on the target and control qubit, I can use reasoning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;If &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;==&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, everything simply passes through&quot;, resulting in an Identity matrix style &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1&amp;amp;0\\0&amp;amp;1\end{bmatrix}$&lt;/span&gt; in the top left. &quot;If &lt;span class=&quot;math-container&quot;&gt;$q_0==|1\rangle$&lt;/span&gt;, we need to let &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; pass and swap &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, resulting in a Pauli X &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}0&amp;amp;1\\1&amp;amp;0\end{bmatrix}$&lt;/span&gt; in the bottom right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT \equiv \begin{bmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;If &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;==&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, everything simply passes through&quot;, results in leaving &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; unaffected. &quot;If &lt;span class=&quot;math-container&quot;&gt;$q_1==|1\rangle$&lt;/span&gt;, we need to let &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; pass and swap &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, mapping &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT \equiv \begin{bmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This all seems to check out, but here comes &lt;strong&gt;my question&lt;/strong&gt;:&lt;br&gt;&#xA;I would like to know if there is a more mathematical way to express this, just as there would be when combining for instance two hadamard gates:&#xA;&lt;span class=&quot;math-container&quot;&gt;$H \otimes H \equiv \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\\ \end{bmatrix} \otimes \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\\ \end{bmatrix} = \frac{1}{2}\begin{bmatrix}1&amp;amp;1&amp;amp;1&amp;amp;1\\1&amp;amp;-1&amp;amp;1&amp;amp;-1\\1&amp;amp;1&amp;amp;-1&amp;amp;-1\\1&amp;amp;-1&amp;amp;-1&amp;amp;1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And a &lt;strong&gt;bonus question&lt;/strong&gt;: &#xA;How I can, using notation like &quot;CNOT&quot;, show which qubit is the control bit and which qubit the target bit?&lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="1837" LastEditDate="2019-01-11T09:59:01.827" LastActivityDate="2020-02-22T22:50:29.227" Title="How to construct matrix of regular and &quot;flipped&quot; 2-qubit CNOT?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;pauli-gates&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5180" PostTypeId="2" ParentId="5179" CreationDate="2019-01-11T09:25:08.283" Score="9" Body="&lt;p&gt;The CNOT gate is a 2-qubit gate, and consequently, its operation cannot be expressed by the tensor product of two one-qubit gates as the example you gave with the Hadamard gates. An easy way to check that such matrix cannot be expressed as the tensor product of two other matrices is to take matrices&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A =\begin{pmatrix}a &amp;amp; b \\ c &amp;amp; d\end{pmatrix}$&lt;/span&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B=\begin{pmatrix}e &amp;amp; f \\ g &amp;amp; h\end{pmatrix}$&lt;/span&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and see which values should get the elements of them so that &lt;span class=&quot;math-container&quot;&gt;$CNOT = A\otimes B$&lt;/span&gt;. Following this reasoning:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A\otimes B= \begin{pmatrix}ae &amp;amp;af &amp;amp; be &amp;amp; bf \\ ag &amp;amp; ah &amp;amp; bg &amp;amp; bh \\ ce &amp;amp; cf &amp;amp; de &amp;amp; df\\cg &amp;amp; ch &amp;amp; dg &amp;amp; dh\end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is clear that &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c=0$&lt;/span&gt; are needed, as all the elements they affect must be zero, and so &lt;span class=&quot;math-container&quot;&gt;$a=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d=1$&lt;/span&gt; because some of the elements they affect must be non-zero. This leaves last matrix as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}e &amp;amp;f &amp;amp; 0 &amp;amp; 0 \\ g &amp;amp; h &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; e &amp;amp; f\\0 &amp;amp; 0 &amp;amp; g &amp;amp; h\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this matrix it is pretty straightforward to see that it is not possible to obtain the CNOT matrix, as for example &lt;span class=&quot;math-container&quot;&gt;$e=1$&lt;/span&gt; so that the &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt; element is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, but also &lt;span class=&quot;math-container&quot;&gt;$e=0$&lt;/span&gt; because the &lt;span class=&quot;math-container&quot;&gt;$(3,3)$&lt;/span&gt; element is one; implying a contradiction, and so proving that CNOT cannot be expressed in such a way. The same happens with the other definition of CNOT. From a notation point of view to see which is the target and control qubit I usually use&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(1\rightarrow2)=\begin{pmatrix}1 &amp;amp;0&amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(1\leftarrow2)=\begin{pmatrix}1 &amp;amp;0&amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This way it is know that the target qubit is the one being pointed by the arrow. One thing you can express mathematically easily is the relationship between &lt;span class=&quot;math-container&quot;&gt;$CNOT(1\rightarrow2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT(1\leftarrow2)$&lt;/span&gt;, which is easily proved to be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(1\leftarrow2) = (H\otimes H)CNOT(1\rightarrow 2)(H\otimes H)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2019-01-11T09:42:47.833" LastActivityDate="2019-01-11T09:42:47.833" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5181" PostTypeId="2" ParentId="5179" CreationDate="2019-01-11T09:44:48.853" Score="5" Body="&lt;p&gt;I like to use the projectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0=|0\rangle\langle 0|\equiv\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{array}\right)\qquad P_1=|1\rangle\langle 1|\equiv\left(\begin{array}{cc} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;to express the intuition of the controlled-not when constructing it:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT=P_0\otimes\mathbb{I}+P_1\otimes X.&#xA;$$&lt;/span&gt;&#xA;Here you can see very plainly the statement &quot;if the first qubit is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, do nothing (apply identity) to the second qubit, while if the first qubit is in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, apply the bit flip&quot;. Similarly, the reversed version is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbb{I}\otimes P_0+X\otimes P_1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not aware of a standard notation to specify the direction of the controlled-not. Whenever I've needed to do it, I've needed to do it a lot, and went for something very compact: &lt;span class=&quot;math-container&quot;&gt;$C^i_j$&lt;/span&gt; to indicate a controlled not controlled by qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and targeting qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. But it's far from standard, so whatever convention you pick, you'd want to state it quite explicitly.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-01-11T09:57:26.297" LastActivityDate="2019-01-11T09:57:26.297" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5182" PostTypeId="1" CreationDate="2019-01-11T12:16:26.200" Score="3" ViewCount="49" Body="&lt;p&gt;This question is related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4162/104&quot;&gt;this question&lt;/a&gt;, but I'm specifically interested in self-induced collapse. Suppose that the size of a quantum system alone somehow leads to a projection of the state (a &quot;collapse of the wavefunction&quot;), i.e. the collapse is self-induced by the system, without any interaction with an environment which ultimately has some effect on the knowledge of the observer. This is not standard quantum mechanics, but &lt;a href=&quot;https://physics.stackexchange.com/q/453410&quot;&gt;answers to this question&lt;/a&gt; lead me to think that this is a common assumption. My question is: Would this imply that large quantum computers are impossible? Maybe there are even known limits in some models?&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="26" LastEditDate="2019-01-11T12:46:17.520" LastActivityDate="2019-01-11T12:46:17.520" Title="Does self-induced collapse limit the size of a quantum computer?" Tags="&lt;physical-realization&gt;&lt;decoherence&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5184" PostTypeId="1" CreationDate="2019-01-11T15:20:02.500" Score="1" ViewCount="29" Body="&lt;p&gt;Some information about the spectral properties of the hamiltonian of a given annealer emebedding is needed to determine a proper annealing schedule, correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are methods that are used to find this spectral information?&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="4943" LastEditDate="2019-01-11T18:08:09.110" LastActivityDate="2019-01-11T18:08:09.110" Title="What are techniques are used to esimate the spectral properties of annealer embedding hamiltonians?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;embedding&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5185" PostTypeId="1" AcceptedAnswerId="5189" CreationDate="2019-01-11T22:41:12.153" Score="2" ViewCount="115" Body="&lt;p&gt;The features of major search engines (looking at you, google!) prevent me from searching for an answer to this question, so I will poll the community here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the state &lt;span class=&quot;math-container&quot;&gt;$|{\pm} i\rangle$&lt;/span&gt; generally understood to mean &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \pm i|1\rangle$&lt;/span&gt;, in the same way that &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; is generally understood to mean &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \pm |1\rangle$&lt;/span&gt;, or should I define it in the paper I'm writing ?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="26" LastEditDate="2019-03-30T07:48:24.223" LastActivityDate="2019-03-30T07:48:24.223" Title="What is the notational convention for the single-qubit states $\lvert0\rangle\pm i\lvert1\rangle$?" Tags="&lt;quantum-state&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5187" PostTypeId="1" AcceptedAnswerId="5211" CreationDate="2019-01-12T02:19:09.040" Score="4" ViewCount="250" Body="&lt;p&gt;I came across this circuit diagram for CV quantum state teleportation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u3ILT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u3ILT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;  &lt;strong&gt;Source&lt;/strong&gt;: &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Xanadu Strawberry Fields: Docs / Quantum algorithms / State teleportation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It was accompanied by a brief description, but I still feel as though I am lacking in some intuition as to why this circuit works in teleporting the state in qumode 0 to qumode 2. What would the full procedure to teleport some coherent state across a communication channel using CV quantum computing protocols be?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more context, the beam-splitter gates are &lt;span class=&quot;math-container&quot;&gt;$50/50$&lt;/span&gt;, and the two qumodes &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; have been squeezed by a factor of &lt;span class=&quot;math-container&quot;&gt;$-2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; respectively (although infinite squeezing would be ideal for this circuit). The measurements are the homodyne-x and homodyne-p measurement gates respectively (as shown on the circuit). This then leads to &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; being condition displaced in the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; quadratures, based on the previous measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part of the circuit I'm struggling to understand is the role of the second beam-splitter.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="26" LastEditDate="2019-01-14T15:24:28.913" LastActivityDate="2019-01-15T21:16:35.160" Title="Quantum teleportation over continuous variables?" Tags="&lt;teleportation&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5188" PostTypeId="2" ParentId="5185" CreationDate="2019-01-12T04:26:09.187" Score="3" Body="&lt;p&gt;I think that most people would understand what you mean, although maybe mentioning they are the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; wouldn't go amiss depending on your target audience.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2019-01-12T04:26:09.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5189" PostTypeId="2" ParentId="5185" CreationDate="2019-01-12T06:37:29.333" Score="5" Body="&lt;p&gt;I’ve never seen that notation, and would expect to see it defined. Personally, I use circles with clockwise/anti-clockwise arrows, trying to conjure up a visual connection with the idea of circular polarisation. But, again, I’d define it before usage.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-12T06:37:29.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5192" PostTypeId="2" ParentId="5179" CreationDate="2019-01-12T23:34:15.353" Score="12" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT =&#xA;\begin{bmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;p&gt;But what does this matrix &lt;em&gt;mean&lt;/em&gt;? The above matrix means: on a two qubit system (such as &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt;, etc.) if the first qubit is a one, apply the not gate (X) on the second qubit. That's cool, but what if you have a 4 qubit system &lt;span class=&quot;math-container&quot;&gt;$\left(\left|0101\right&amp;gt;\right)$&lt;/span&gt; or an 8 qubit system &lt;span class=&quot;math-container&quot;&gt;$\left(\left|00010011\right&amp;gt;\right)$&lt;/span&gt; ? Also, let's say on the 8 qubit system you want to apply the X gate on the 7th qubit if the 2nd is one, how would you go about constructing this matrix?&lt;/p&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Cookbook Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;p&gt;Most books and articles will discuss a cookbook method where you build a matrix based on what the operation does to the base states. Let's work through this for the 2 qubit CNOT gate above. The above gate says if the first qubit is 1 then apply an X to the 2nd qubit. An X just changes the qubit from a 0 to a 1 or a 1 to a 0. The base states for a two qubit system are: &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;,\, \left|01\right&amp;gt;,\, \left|10\right&amp;gt;,\, \left|11\right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I know those are the 4 states? Quantum qubit systems grow as &lt;span class=&quot;math-container&quot;&gt;$2^q$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is the number of qubits. For a two qubit system &lt;span class=&quot;math-container&quot;&gt;$q=2$&lt;/span&gt; therefore there are 4 qubit states. Then you count from 0 to 3 in binary. That is all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, this is how CNOT operates on the base states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT\left|00\right&amp;gt; \rightarrow \left|00\right&amp;gt; $$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT\left|01\right&amp;gt; \rightarrow \left|01\right&amp;gt; $$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT\left|10\right&amp;gt; \rightarrow \left|11\right&amp;gt; $$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT\left|11\right&amp;gt; \rightarrow \left|10\right&amp;gt; $$&lt;/span&gt;&lt;p&gt;To build a matrix you use the following trick:&lt;/p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;CNOT &amp;amp;= \begin{bmatrix}\left&amp;lt;00|CNOT|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;00|CNOT|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;00|CNOT|10\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;00|CNOT|11\right&amp;gt; \\&#xA;\left&amp;lt;01|CNOT|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;01|CNOT|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;01|CNOT|10\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;01|CNOT|11\right&amp;gt; \\&#xA;\left&amp;lt;10|CNOT|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;10|CNOT|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;10|CNOT|10\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;10|CNOT|11\right&amp;gt; \\&#xA;\left&amp;lt;11|CNOT|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;11|CNOT|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;11|CNOT|10\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;11|CNOT|11\right&amp;gt; \end{bmatrix} \\ \\&#xA;&amp;amp;= \begin{bmatrix}\left&amp;lt;00|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;00|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;00|11\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;00|10\right&amp;gt; \\&#xA;\left&amp;lt;01|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;01|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;01|11\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;01|10\right&amp;gt; \\&#xA;\left&amp;lt;10|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;10|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;10|11\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;10|10\right&amp;gt; \\&#xA;\left&amp;lt;11|00\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;11|01\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;11|11\right&amp;gt; &amp;amp;&amp;amp; \left&amp;lt;11|10\right&amp;gt; \end{bmatrix} \\ \\&#xA;&amp;amp;=\begin{bmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{bmatrix}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is nice, but now suppose you want a CNOT gate between the 3rd and 9th qubit of a 10 qubit system? You will have &lt;span class=&quot;math-container&quot;&gt;$2^{10}$&lt;/span&gt; base states and a &lt;span class=&quot;math-container&quot;&gt;$2^{10} \times 2^{10}$&lt;/span&gt; matrix! Good luck with the cookbook method! What we need is an &lt;em&gt;algorithmic&lt;/em&gt; method that we can code up in Python.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Algorithmic Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;p&gt;A better algorithmic way to think about quantum control gates is by using operators and tensor products. Suppose we have a two qubit system.&lt;/p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To say &quot;If the first qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; leave the second qubit alone&quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \left|0\rangle\langle0\right| \otimes I $$&lt;/span&gt;&#xA;to leave a qubit alone you apply the Identity operator / matrix &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To say &quot;If the first qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; apply X to the second qubit&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \left|1\rangle\langle1\right| \otimes X $$&lt;/span&gt;&lt;p&gt;Now put them together by adding them, &quot;If the first qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; leave the second qubit alone and If the first qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; apply X to the second qubit&quot;:&lt;/p&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \left|0\rangle\langle0\right| \otimes I + \left|1\rangle\langle1\right| \otimes X $$&lt;/span&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;In&amp;nbsp;[3]:&#xA;&#xA;    &#xA;&lt;pre&gt;from qudotpy import qudot&#xA;import numpy as np&#xA;&#xA;zero_matrix = qudot.ZERO.ket * qudot.ZERO.bra&#xA;one_matrix = qudot.ONE.ket * qudot.ONE.bra&#xA;&#xA;CNOT = np.kron(zero_matrix, np.eye(2)) + np.kron(one_matrix, qudot.X.matrix)&#xA;print(CNOT)&#xA;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;[[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j]&#xA; [ 0.+0.j  1.+0.j  0.+0.j  0.+0.j]&#xA; [ 0.+0.j  0.+0.j  0.+0.j  1.+0.j]&#xA; [ 0.+0.j  0.+0.j  1.+0.j  0.+0.j]]&#xA;&lt;/pre&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;Nice! This is a good algorithmic way to make CNOT gates (or control gates in general). For example, suppose now you want a CNOT gate of a 10 qubit system where the 3rd qubit is the control and the 9th qubit is the target:&lt;/p&gt;&#xA;&lt;p&gt;&quot;If the third qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; leave the ninth qubit alone:&quot;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ I \otimes I \otimes \left|0\rangle\langle0\right| \otimes I \otimes I \otimes I \otimes I \otimes I \otimes I \otimes I $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&quot;If the third qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; apply X to the ninth qubit&quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ I \otimes I \otimes \left|1\rangle\langle1\right| \otimes I \otimes I \otimes I \otimes I \otimes I \otimes X \otimes I $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Add those two expression together and you have your 10 qubit CNOT gate.&lt;/p&gt;&#xA;&lt;p&gt;The above algorithm is straightforward to implement in Python. &#xA;&#xA;&#xA;&#xA;" OwnerUserId="4359" LastEditorUserId="9006" LastEditDate="2020-02-22T22:50:29.227" LastActivityDate="2020-02-22T22:50:29.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5193" PostTypeId="2" ParentId="5176" CreationDate="2019-01-13T02:32:44.613" Score="4" Body="&lt;p&gt;On parameter setting, check our work: &lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.5.031040&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.5.031040&lt;/a&gt; &#xA;(Basically you want to make sure that the chains representing the logical qubit have a phase transition synchronized with the minimum gap).&#xA;But in general this is a hard problem, and precision issues connected to the embedding characteristics are probably the dominant effect that influences performance.&lt;/p&gt;&#xA;" OwnerUserId="410" LastActivityDate="2019-01-13T02:32:44.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5194" PostTypeId="1" CreationDate="2019-01-13T12:50:38.063" Score="3" ViewCount="76" Body="&lt;p&gt;In the Environment and Quantum Operations in Nielsen and Chuang, section 8.2.2, they say that when you apply a unitary on a state, you expect the output as the just the state transformed by the unitary, but here we haven't taken environment into consideration. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we take environment into consideration and assume the state is in a product state with the environment And then apply the unitary on both, and trace out the environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the unitary is something we specify, right? I imagine we have a machine where we can decide what unitary we want to apply and give it as input, and it gets applied on the state inside.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we know that it might be coupled with the environment, do we apply the right unitary assuming the dimensions? Or do we just apply what we would have applied for our system only, and the dimensions get taken care of?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, do we just specify I, and I2 gets applied if it is a 2d system, and I4 gets applied if it's a 4d system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or do we exactly specify the matrix? Basically how do we apply these unitaries, atleast on a conceptual level?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-01-13T12:50:38.063" Title="What do you specify when you physically apply a unitary?" Tags="&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;noise&gt;&lt;unitarity&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5195" PostTypeId="1" AcceptedAnswerId="5196" CreationDate="2019-01-13T22:45:49.953" Score="5" ViewCount="155" Body="&lt;p&gt;The qubit &lt;span class=&quot;math-container&quot;&gt;$a\left|0\right&amp;gt;+b\left|1\right&amp;gt;$&lt;/span&gt; is a superposition w.r.t. the basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|0\right&amp;gt;,\, \left|1\right&amp;gt;\right\rbrace$&lt;/span&gt; because it may collapse to &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; when measured w.r.t. the above basis. However the same qubit, when measured w.r.t the basis &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace a\left|0\right&amp;gt;+b\left|1\right&amp;gt;, b^*\left|0\right&amp;gt;−a^*\left|1\right&amp;gt;\right\rbrace$&lt;/span&gt;, always collapses to the first vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I therefore conclude that superposition is a basis-dependent concept?&lt;/p&gt;&#xA;" OwnerUserId="5543" LastEditorUserId="26" LastEditDate="2019-01-14T15:30:40.483" LastActivityDate="2019-01-14T15:30:40.483" Title="Is qubit superposition a basis-dependent concept?" Tags="&lt;measurement&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5196" PostTypeId="2" ParentId="5195" CreationDate="2019-01-14T04:56:19.020" Score="4" Body="&lt;p&gt;Yes. You already have the reasoning for why. Sometimes the basis is implied but not explicitly stated though. So caution when reading something like that.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-01-14T04:56:19.020" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5197" PostTypeId="1" AcceptedAnswerId="5198" CreationDate="2019-01-14T07:44:19.673" Score="3" ViewCount="472" Body="&lt;p&gt;In Qiskit, they have the concept of a Toffoli gate (&lt;code&gt;ccx&lt;/code&gt;). However, the following code throws an error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit import execute, Aer&#xA;&#xA;q1 = QuantumRegister(2)&#xA;qctrl = QuantumRegister(1)&#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q1, qctrl, c)&#xA;&#xA;qc.x(q1)&#xA;qc.ccx(q1[0], q1[1], qctrl)&#xA;qc.measure(q1, c)&#xA;&#xA;backend_sim = Aer.get_backend('qasm_simulator')&#xA;job_sim = execute(qc, backend_sim)&#xA;result_sim = job_sim.result()&#xA;print(result_sim.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to my knowledge and research, this should produce the output &lt;code&gt;111&lt;/code&gt; but instead I get an error message:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;qiskit.qiskiterror.QiskitError: &quot;QuantumRegister(1, 'q0') is not a tuple. A qubit should be formated as a tuple.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This seems like a bug with Qiskit to me. Am I wrong? And if so, how can I fix my code?&lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="26" LastEditDate="2019-01-14T15:30:15.863" LastActivityDate="2019-01-14T15:30:15.863" Title="Why won't Qiskit ccx gate accept registers?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5198" PostTypeId="2" ParentId="5197" CreationDate="2019-01-14T08:32:26.553" Score="4" Body="&lt;p&gt;It is not a bug. Qiskit makes the difference between quantum &lt;strong&gt;registers&lt;/strong&gt; and quantum bits. In your case, &lt;code&gt;qctrl&lt;/code&gt; is a QuantumRegister (as shown in your error) whereas the &lt;code&gt;ccx&lt;/code&gt; gate expect a qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Qiskit, a qubit is defined as a Tuple of a QuantumRegister and an index. You can get a qubit from a QuantumRegister by using the indexing notation: &lt;code&gt;qtrl[0]&lt;/code&gt; represents the first qubit (and the only one) of the QuantumRegister &lt;code&gt;qctrl&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, replace&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.ccx(q1[0], q1[1], qctrl)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;by&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.ccx(q1[0], q1[1], qctrl[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and your issue should be fixed.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-01-14T08:32:26.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5199" PostTypeId="1" AcceptedAnswerId="5201" CreationDate="2019-01-14T08:32:50.917" Score="7" ViewCount="1401" Body="&lt;p&gt;Following is an excerpt from QCQI:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0SeQv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0SeQv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can understand that this matrix satisfies a unitary matrix. Also, intuitively, I am able to understand it. However, what is the proof that any given Unitary Matrix can be converted as above? Like why there should be only 4 variables and not more or less? Looking for some formal authentic proof. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="55" LastEditDate="2019-11-26T10:41:36.887" LastActivityDate="2019-11-26T10:41:36.887" Title="General parametrisation of an arbitrary $2\times 2$ unitary matrix?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5200" PostTypeId="2" ParentId="5197" CreationDate="2019-01-14T09:15:41.867" Score="3" Body="&lt;p&gt;Nelimee has provided &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5198/409&quot;&gt;the answer&lt;/a&gt;, but there's another point to note that is too big for a comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Qiskit, it &lt;em&gt;is&lt;/em&gt; possible to pass registers to gates instead of qubits. You do this in your example with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(q1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This applied &lt;code&gt;x&lt;/code&gt; to both qubits in the register &lt;code&gt;q1&lt;/code&gt;, and so is equivalent to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for q in range(2):&#xA;    qc.x(q1[n])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should be regarded as a kind of shortcut notation. Providing single qubits is the 'proper way' to do it, and using registers is something that can be done to make your code a bit more elegant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like any shortcut, it should be used with care. Specifically, you have to remain consistent. So the problem in your case was supplying a single qubit for two arguments, and a single qubit register for the last. If you'd used single qubits for all, as in Nelimee's answer, then it would work. Using single qubit registers for all would also work. But mixing and matching does not.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-01-14T09:15:41.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5201" PostTypeId="2" ParentId="5199" CreationDate="2019-01-14T09:35:39.030" Score="10" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the proof that any given unitary matrix can be converted as above?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be an arbitrary &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary matrix&lt;/a&gt;. This is equivalent to the rows/columns of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; forming an orthonormal system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us write a generic &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}a&amp;amp;b\\c&amp;amp;d\end{pmatrix}.$$&lt;/span&gt;&#xA;The constraints imposed on the coefficients &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d$&lt;/span&gt; by the requirement of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; being unitary are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|a|^2+|c|^2=1,\qquad |b|^2+|d|^2=1,\qquad a^* b+c^* d=0.$$&lt;/span&gt;&#xA;A pair of complex numbers &lt;span class=&quot;math-container&quot;&gt;$a,b\in\mathbb C$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$|a|^2+|b|^2=1$&lt;/span&gt; can always be parametrized as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$a=e^{i\alpha_{11}}\cos\theta,\qquad b=e^{i\alpha_{12}}\sin\theta,$$&lt;/span&gt;&#xA;for some real coefficients &lt;span class=&quot;math-container&quot;&gt;$\alpha_{ij},\theta\in\mathbb R$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It follows that using only the normalization constraint (but without taking into account the orthogonality) we can parametrize &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}e^{\alpha_{11}}\cos\theta&amp;amp; e^{\alpha_{12}}\sin\theta\\&#xA;e^{\alpha_{21}}\sin\theta &amp;amp; e^{\alpha_{22}}\cos\theta&#xA;\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Requiring the columns to be orthogonal then gives the additional relation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i(\alpha_{11}-\alpha_{12})}+e^{i(\alpha_{21}-\alpha_{22})}=0,$$&lt;/span&gt;&#xA;that is, &lt;span class=&quot;math-container&quot;&gt;$\alpha_{11}=\alpha_{12}+\alpha_{21}-\alpha_{22}+\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We conclude that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is parametrized by &lt;em&gt;three&lt;/em&gt; real parameters, here denoted &lt;span class=&quot;math-container&quot;&gt;$\theta,\alpha_{12},\alpha_{21},\alpha_{22}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the form you show you simply need to change variables as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\theta&amp;amp;=\gamma/2, \\&#xA;\alpha_{12} &amp;amp;= \alpha-\beta/2+\delta/2+\pi,\\&#xA;\alpha_{21} &amp;amp;= \alpha+\beta/2-\delta/2, \\&#xA;\alpha_{22} &amp;amp;= \alpha+\beta/2+\delta/2.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Like why there should be only 4 variables and not more or less?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While the above already proved this, it can be useful to know that this a special case of a more general result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A generic unitary &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix is specified by &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; real parameters (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki page on the unitary group for more details&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy way to see this is again to remember that unitary matrices are characterised by their columns/rows forming an orthonormal system.&#xA;This amounts to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; real constraints (imposing each of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; columns to be normalized), plus &lt;span class=&quot;math-container&quot;&gt;$\binom{n}{2}=n(n-1)/2$&lt;/span&gt; additional &lt;em&gt;complex&lt;/em&gt; constraints (imposing each pair of columns to be orthogonal). Each complex constraints amounts to two real constraints, so this sums up to a total of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$n+2\binom{n}{2}=n+n(n-1)=n^2$$&lt;/span&gt;&#xA;real, &lt;em&gt;independent&lt;/em&gt; constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A generic &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix is characterised by &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; complex numbers, that is, &lt;span class=&quot;math-container&quot;&gt;$2n^2$&lt;/span&gt; real numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We conclude that the number of free parameters of a generic &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; unitary matrix is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$2n^2-n^2=n^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to the simple &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; case above, you can see how we get back the previous result because &lt;span class=&quot;math-container&quot;&gt;$2^2=4$&lt;/span&gt; (you might also notice that to count parameters in the special case &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; I used a different &lt;em&gt;ad-hoc&lt;/em&gt; strategy, rather then the one showed here to get the count in the general case).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Yet another way to count parameters&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Another method I like is to think entirely in terms of orthonormal systems.&#xA;The question is: how many parameters need to be given to specify an orthonormal basis in an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional complex vector space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us start by the first vector. The only constraint here is that we want the vector to be normalized.&#xA;The number of real parameters needed to specify a normalized vector in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensions is &lt;span class=&quot;math-container&quot;&gt;$d_1=2n-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now add another vector. Now we have to impose both the normalization of this additional vector (one real constraint), and the orthogonality of this additional vector to the initial one (two real constraints).&#xA;The additional parameters are therefore &lt;span class=&quot;math-container&quot;&gt;$d_2= 2n-3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A third vector will need to be normalized (one real constraint), and orthogonal to the first two vectors (&lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; real constraints), thus &lt;span class=&quot;math-container&quot;&gt;$d_3=2n-5$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Iterate this reasoning until you get to the last vector, which will be specified by a single real parameter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The total number of parameters is therefore:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_k d_k=(2n-1)+(2n-3)+\cdots+3+1=\sum_{k=0}^{n-1} (2k+1).$$&lt;/span&gt;&#xA;In other words, the number of parameters is given by the sum of the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; odd integers, which is again readily shown to equal &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-01-14T17:45:52.517" LastActivityDate="2019-01-14T17:45:52.517" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5202" PostTypeId="1" AcceptedAnswerId="5203" CreationDate="2019-01-14T18:25:52.197" Score="3" ViewCount="130" Body="&lt;p&gt;I am currently working on the algorithm of Deutsch. The algorithm defines two starting states, which are for &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0\rangle$&lt;/span&gt; and for &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |1\rangle$&lt;/span&gt;.&#xA;So far, that's clear to me. But what would happen if you change the input bits, lets say the qubits are initially in the state: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |y\rangle = |0\rangle$&lt;/span&gt;, what are the implications for the algorithm? And what would happen, if the bits in the original algorithm were switched: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |1\rangle$&lt;/span&gt; and for &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |0\rangle$&lt;/span&gt; does the last idea just switch the last bit in the final states?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose the input bits are 0 and 0 (according to my calculation):&#xA;I apply the H matrix to both input bits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H(|0\rangle)H(|0\rangle)=|+\rangle\cdot|+\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle+|11\rangle)$$&lt;/span&gt;&#xA;By &lt;span class=&quot;math-container&quot;&gt;$f'$&lt;/span&gt; I mean the negation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|0,f(0)\rangle+|0,f'(0)\rangle+|1,f(1)\rangle+|1,f'(1)\rangle))$$&lt;/span&gt;&#xA;Now let's say &lt;span class=&quot;math-container&quot;&gt;$ f (0) = f (1) $&lt;/span&gt; (constant) then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}((|0\rangle+|1\rangle)(|f(0)\rangle+|f'(0)\rangle))$$&lt;/span&gt;&#xA;But what would happen if &lt;span class=&quot;math-container&quot;&gt;$ f (0) = f '(1)$&lt;/span&gt; (balanced)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that my question has come across as understandable.&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="55" LastEditDate="2019-05-15T08:32:07.187" LastActivityDate="2019-05-15T08:32:07.187" Title="What happens in Deutsch algorithm if I use equal input bits?" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5203" PostTypeId="2" ParentId="5202" CreationDate="2019-01-14T19:09:18.443" Score="3" Body="&lt;p&gt;TL;DR: You won't be able to distinguish the constant and balanced function scenarios if you start with &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you start with &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a balanced function  &lt;span class=&quot;math-container&quot;&gt;$ f (0) = f '(1)$&lt;/span&gt; you'll get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|0,f(0)\rangle+|0,f'(0)\rangle+|1,f(1)\rangle+|1,f'(1)\rangle)) = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{2}(|0,f(0)\rangle+|0,f'(0)\rangle+|1,f'(0)\rangle+|1,f(0)\rangle)) = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{2}((|0\rangle+|1\rangle)(|f(0)\rangle+|f'(0)\rangle))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the same result as you'd get for a constant function. That's why you need to start with &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |1\rangle$&lt;/span&gt; - you need to get a phase difference between the two scenarios somehow.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you start with &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |0\rangle$&lt;/span&gt;, you get the same outcome: the state both for balanced and for constant scenarios is the same, and you can't distinguish them. (The math is very straightforward so I won't write it out here).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-14T19:09:18.443" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5204" PostTypeId="1" CreationDate="2019-01-14T21:41:44.503" Score="8" ViewCount="366" Body="&lt;h2&gt;Context:&lt;/h2&gt;&#xA;&lt;p&gt;I was going through John Watrous' lecture &lt;a href=&quot;https://youtu.be/fc12NHko8sw?t=2895&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Complexity Theory (Part 1) - CSSQI 2012&lt;/a&gt;. Around 48 minutes into the lecture, he presents the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;No relationship&lt;/strong&gt; is known between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;...they are conjectured to be &lt;strong&gt;incomparable&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So far so good. Then I came across &lt;a href=&quot;https://physics.stackexchange.com/users/8940/scott-aaronson&quot;&gt;Scott Aaronson&lt;/a&gt;'s answer to &lt;a href=&quot;https://physics.stackexchange.com/a/34637&quot;&gt;Can a parallel computer simulate a quantum computer? Is BQP inside NP?&lt;/a&gt; He mentions these points:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose you insist on talking about decision problems only (&amp;quot;total&amp;quot;&#xA;ones, which have to be defined for every input), as people&#xA;traditionally do when defining complexity classes like P, NP, and BQP.&#xA;Then we have &lt;strong&gt;proven separations&lt;/strong&gt; between BQP and NP in the &amp;quot;&lt;strong&gt;black-box&#xA;model&lt;/strong&gt;&amp;quot; (i.e., the model where both the BQP machine and the NP machine&#xA;get access to an oracle), as &lt;strong&gt;mmc alluded to&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And to reiterate, all of these separations are in the &lt;strong&gt;black-box model&#xA;only&lt;/strong&gt;. It remains completely unclear, even at a conjectural level,&#xA;whether or not these translate into separations in the &amp;quot;real&amp;quot; world&#xA;(i.e., the world without oracles). We don't have any clear examples&#xA;analogous to factoring, of real decision problems in BQP that are&#xA;plausibly not in NP. After years thinking about the problem, I still&#xA;don't have a strong intuition either that BQP should be contained in&#xA;NP in the &amp;quot;real&amp;quot; world or that it shouldn't be.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;According to his answer, it seems that in the &amp;quot;&lt;strong&gt;black-box model&lt;/strong&gt;&amp;quot; we can show some relationship (as in &lt;em&gt;non-overlapping&lt;/em&gt;) between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;. He cites &lt;a href=&quot;https://physics.stackexchange.com/a/34547&quot;&gt;@mmc's answer&lt;/a&gt;, which says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;There is no definitive answer due to the fact that no problem is known&#xA;to be inside PSPACE and outside P. But &lt;a href=&quot;http://www.scottaaronson.com/papers/uncompute.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;recursive Fourier sampling&lt;/a&gt;&#xA;is conjectured to be outside &lt;a href=&quot;http://en.wikipedia.org/wiki/Arthur%E2%80%93Merlin_protocol#MA&quot; rel=&quot;nofollow noreferrer&quot;&gt;MA&lt;/a&gt; (the probabilistic generalization&#xA;of NP) and has an efficient quantum algorithm. Check page 3 of &lt;a href=&quot;http://www.csee.umbc.edu/%7Elomonaco/ams/lecturenotes/Vazirani.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&#xA;survey by Vazirani&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Question:&lt;/h2&gt;&#xA;&lt;p&gt;It's not clear from &lt;a href=&quot;https://physics.stackexchange.com/a/34547&quot;&gt;@mmc's answer&lt;/a&gt; as to how the &lt;strong&gt;recursive Fourier sampling&lt;/strong&gt; algorithm is related to the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; class and how (or whether at all) it proves separations between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; in the &amp;quot;&lt;strong&gt;black-box model&lt;/strong&gt;&amp;quot;. In fact, I'm not even sure what &amp;quot;&lt;strong&gt;black-box model&lt;/strong&gt;&amp;quot; means in this context, although I suspect that it refers to some kind of computation model involving &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/oracles?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum oracles&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It would be great if someone could provide a brief and digestible summary of what the &lt;strong&gt;recursive Fourier sampling&lt;/strong&gt; algorithm is and how it proves separations between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;. Even a rough sketch of the idea behind the proof would be okay. I'm hoping this will give me a head start in understanding the papers linked by &lt;a href=&quot;https://physics.stackexchange.com/users/1656/mmc&quot;&gt;@mmc&lt;/a&gt;, which are otherwise rather dense for me at present.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-04-06T15:08:23.033" Title="What is recursive Fourier sampling and how does it prove separations between BQP and NP in the black-box model?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;bqp&gt;&lt;fourier-sampling&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5206" PostTypeId="1" AcceptedAnswerId="5207" CreationDate="2019-01-15T09:00:18.653" Score="4" ViewCount="187" Body="&lt;p&gt;Introductory textbooks I've read define entanglement as when your product state cannot be factored into the tensor product of individual quantum states. But consider a three-qbit system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_{2,0}H_2|000\rangle = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ 0 \\ 0 \\ 0 \\ 0 \\ \frac{1}{\sqrt{2}}  \\ 0 \\ 0 \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this system, the most- and least- significant qubits are entangled. However, a naive &quot;cannot factor&quot; analysis would also lead you to believe the middle qubit is entangled with the rest. The definition of entanglement must thus include permutation of qubit order in some way. So, what is this definition?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="55" LastEditDate="2020-05-25T08:44:23.803" LastActivityDate="2020-05-25T08:44:23.803" Title="Defining entanglement for systems with more than two qubits" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5207" PostTypeId="2" ParentId="5206" CreationDate="2019-01-15T11:06:46.393" Score="5" Body="&lt;p&gt;There is far more structure in entanglement than your simplistic definition seems to be implying. Yes, you could ask a question&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is there any entanglement in this pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which can be answered by whether or not the entire state can be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=|\phi_1\rangle|\phi_2\rangle\ldots|\phi_n\rangle&#xA;$$&lt;/span&gt;&#xA;but as you are rightly realising, you can ask far more structured questions of&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;is qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; entangled?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or even&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;is qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; entangled with qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What sort of entanglement does qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; share with different qubits, and how much?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first is answered in much the same way as your original strategy: if it can be written as &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle_i\otimes|\psi\rangle_{1,2,\ldots,n\setminus i}$&lt;/span&gt;, then qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is not entangled with anything. In your example, qubit 2 is not entangled, but qubits 1 and 3 are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second is far more subtle, and perhaps requires a more precise definition of entanglement. Should we say that qubits 1 and 2 in the state &lt;span class=&quot;math-container&quot;&gt;$(|000\rangle+|111\rangle)/\sqrt{2}$&lt;/span&gt; are entangled? If you look at just those two qubits, they are in a maximally mixed state, i.e. not entangled, but they are definitely part or an entangled state that cannot be localised to any pair of qubits. Hence the question about the type of entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, this really comes down to a question of why are you interested in entanglement. Usually, it's to do something with the entangled state, so you have a measure of a given state's usefulness (and that is often some form of entanglement measure), and you can ask questions with respect to that particular measure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-15T11:06:46.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5209" PostTypeId="2" ParentId="5144" CreationDate="2019-01-15T14:53:19.127" Score="5" Body="&lt;p&gt;Quantum circuits have a &lt;code&gt;data&lt;/code&gt; attribute, which is a list of all gates. You can remove elements from this as with any Python list. For example, here's a circuit&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(1)&#xA;circ = QuantumCircuit(q)&#xA;&#xA;circ.h(q[0])&#xA;circ.s(q[0])&#xA;circ.x(q[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Let's get rid of the S gate. First, we can look at the list of gates with &lt;code&gt;circ.data&lt;/code&gt;. This gives&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[&amp;lt;qiskit.extensions.standard.h.HGate at 0x11721b7b8&amp;gt;,&#xA; &amp;lt;qiskit.extensions.standard.s.SGate at 0x11721b828&amp;gt;,&#xA; &amp;lt;qiskit.extensions.standard.x.XGate at 0x11721b7f0&amp;gt;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Element 1 of this list (i.e. the second element) is the gate we want rid of. We can do this with &lt;code&gt;pop&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.data.pop(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting circuit can then be seen by &lt;code&gt;print(circ)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;         ┌───┐┌───┐&#xA;q0_0: |0&amp;gt;┤ H ├┤ X ├&#xA;         └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, we have succeeded in removing the S gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that you can get information about the elements of the &lt;code&gt;data&lt;/code&gt; list using the methods &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;qargs&lt;/code&gt;, etc, of gate objects. For example, to see that element 0 is a Hadamard, and to see which qubit it acts on, we can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print( circ.data[0].name )&#xA;print( circ.data[0].qargs )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;h&#xA;[(QuantumRegister(1, 'q0'), 0)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-01-15T15:01:15.070" LastActivityDate="2019-01-15T15:01:15.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5210" PostTypeId="1" AcceptedAnswerId="5213" CreationDate="2019-01-15T20:34:03.397" Score="4" ViewCount="697" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Promise Problem&lt;/strong&gt; : It is a pair &#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{A}=\{\mathcal{A}_{\text{yes}},\mathcal{A}_{\text{no}}\}$$&lt;/span&gt;&#xA;  where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}_{\text{yes}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}_{\text{no}}$&lt;/span&gt; are disjoint sets of inputs (&lt;strong&gt;yes&lt;/strong&gt; inputs and &lt;strong&gt;no&lt;/strong&gt; inputs). Strings not contained in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}_{\text{yes}} \cup \mathcal{A}_{\text{no}}$&lt;/span&gt; are &quot;don't care&quot; inputs. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PP}:$&lt;/span&gt; The class of &lt;strong&gt;promise problems&lt;/strong&gt; solvable in polynomial time on a probabilistic Turing machine with bounded error (correct on every input with probability at least &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt;). &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}:$&lt;/span&gt; The class of &lt;strong&gt;promise problems&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A} = (\mathcal{A}_{\text{yes}}, \mathcal{A}_{\text{no}})$&lt;/span&gt; for which there exists a polynomial time-uniform family &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Q} = \{\mathrm{Q}_n: n\in \Bbb N\}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;of quantum circuits such that, for all input strings &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, we have:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x\in\mathcal{A}_{\text{yes}} \implies \text{Pr}[\mathrm{Q}(x)=1]\geq \frac{2}{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x\in\mathcal{A}_{\text{no}} \implies \text{Pr}[\mathrm{Q}(x)=0]\geq \frac{2}{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;: &lt;a href=&quot;https://www.youtube.com/watch?v=fc12NHko8sw&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Watrous - Quantum Complexity Theory (Part 1) - CSSQI 2012&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Watrous says that an intuitive approach for proving the containment &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\subseteq \mathsf{PP}$&lt;/span&gt; is along the lines of: unbounded error probabilistic computations can &lt;strong&gt;simulate interference&lt;/strong&gt; in quantum computations (e.g. run two probabilistic processes, and condition them on obtaining the same outputs). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure what they mean by &quot;&lt;strong&gt;simulate interference&lt;/strong&gt;&quot; and how it is relevant to the proof. This so-called intuitive proof doesn't seem clear to me. Could someone clarify the proof-sketch and give me an actual &lt;em&gt;example&lt;/em&gt; of a &lt;strong&gt;promise problem&lt;/strong&gt; (with a quantum algorithm) which lies in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;, and the corresponding equivalent classical algorithm involving two or more parallel probabilistic processes, such that the classical algorithm can be easily proven to lie in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PP}$&lt;/span&gt;? I'm finding it a bit hard to imagine without a solid example. Relevant reading material suggestions are also welcome.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Related&lt;/strong&gt;: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3832&quot;&gt;Query regarding BQP belonging to PP&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-14T16:04:22.533" LastActivityDate="2019-03-14T16:04:22.533" Title="Intuitive Proof: BQP ⊆ PP" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5211" PostTypeId="2" ParentId="5187" CreationDate="2019-01-15T21:16:35.160" Score="2" Body="&lt;p&gt;Here's a schematic description of quantum teleportation for general systems:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Alice and Bob share a maximally entangled state.&lt;/li&gt;&#xA;&lt;li&gt;To teleport &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to Bob, Alice performs a joint measurement of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and her local copy of the maximally entangled state. This measurement is entangling, in the sense that the output state after the measurement can be entangled across Alice's two systems even if it was not initially so. &lt;/li&gt;&#xA;&lt;li&gt;Alice sends Bob a classical description of her measurement outcome. Bob applies a conditional gate to his state depending on the information received by Alice.&lt;/li&gt;&#xA;&lt;li&gt;Bob's local state is now &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the CV version of the protocol, these steps are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A maximally entangled state is produced by interacting two infinitely-squeezed states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_x$&lt;/span&gt; on a 50:50 beam-splitter. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Interfering &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and a local copy of the maximally entangled state in a 50:50 beam splitter creates entanglement between these systems. In combination with a homodyne measurement at the output, this is equivalent to the required entangling measurement.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice sends her outcome to Bob, who performs conditional displacements on his system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bob recovers &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If you want to go beyond schematics and understand the mathematics behind the protocol, I recommend these references:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1110.3234&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian Quantum Information&lt;/a&gt;, section IV.A&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://authors.library.caltech.edu/3827/1/BRAprl98.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Teleportation of Continuous Quantum Variables&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4294" LastActivityDate="2019-01-15T21:16:35.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5212" PostTypeId="2" ParentId="5206" CreationDate="2019-01-16T08:57:55.870" Score="3" Body="&lt;p&gt;One definition for whether a state &lt;span class=&quot;math-container&quot;&gt;$\psi \in V_1 \otimes \cdots V_n$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qudits with various values of &lt;span class=&quot;math-container&quot;&gt;$d_i = \text{dim} V_i$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is not entangled if it can be written as a single summand &lt;span class=&quot;math-container&quot;&gt;$\psi = v_1 \otimes \cdots v_n$&lt;/span&gt;. Conversely it is entangled if it requires more than 1 summand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\sigma \in S_n$&lt;/span&gt; be a permutation and &lt;span class=&quot;math-container&quot;&gt;$R_\sigma$&lt;/span&gt; be the corresponding operator &lt;span class=&quot;math-container&quot;&gt;$V_1 \otimes \cdots V_n \to V_{\sigma (1)} \otimes \cdots V_{\sigma (n)}$&lt;/span&gt;. If we apply &lt;span class=&quot;math-container&quot;&gt;$R_\sigma$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and it was not entangled then we could write it as &lt;span class=&quot;math-container&quot;&gt;$v_{\sigma (1)} \otimes \cdots v_{\sigma (n)}$&lt;/span&gt;. Conversely if &lt;span class=&quot;math-container&quot;&gt;$R_{\sigma} \psi$&lt;/span&gt; is not entangled then we get &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is not either. That means this notion of entanglement does not depend on the ordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem with this is that it is very sensitive. Consider the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + \epsilon | 11 \rangle$&lt;/span&gt; for small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further information see the notion of &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_rank_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor rank and border rank&lt;/a&gt;. Substitute &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; for the field &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; everywhere. The statistics applications more use the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt; case. The border rank is the phenomenon underlying the W-state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing one can do is do redefinition using any set partition of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; parts. For example, if &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt; a set partition might be &lt;span class=&quot;math-container&quot;&gt;$1,2,4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt; parts. Then from this we define &lt;span class=&quot;math-container&quot;&gt;$W_1 = V_1 \otimes V_2 \otimes V_4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W_2 = V_3$&lt;/span&gt;. Then we get the image of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; as an element of &lt;span class=&quot;math-container&quot;&gt;$W_1 \otimes \cdots W_k$&lt;/span&gt; by an appropriate permutation and taking tensor products. One can then compute the rank in this context instead of the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; context. With some permutation, we can get the state to become unentangled. This is when all the entanglement has been absorbed into the set partition.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-01-16T08:57:55.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5213" PostTypeId="2" ParentId="5210" CreationDate="2019-01-16T13:57:59.353" Score="5" Body="&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; can be defined on different universal gate sets due to the Solovay-Kitaev theorem, we can choose Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; and Toffoli gate &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CCNOT}$&lt;/span&gt; as a gate set, like Scott Aaronson's &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412187&quot; rel=&quot;nofollow noreferrer&quot;&gt;definition&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt; mentioned in the following: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Here ‘uniform’ means that there exists a classical algorithm that outputs a description of &lt;span class=&quot;math-container&quot;&gt;$C_n$&lt;/span&gt; in time&#xA;  polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Note that, by a result of Shi, we can assume without loss of generality that Cn is&#xA;  composed only of Hadamard and Toffoli gates. (This is true even for a postselected quantum circuit since by&#xA;  the Solovay-Kitaev Theorem, we can achieve the needed accuracy in amplitudes at the cost of a polynomial&#xA;  increase in circuit size.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But the definition of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt; for different universal gate sets is a little delicate, we also need the matrix element of any gate cannot be too small, namely the theorem 2.10 in &lt;a href=&quot;https://arxiv.org/abs/0908.0512&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kuperberg's paper&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that matrix elements of these gates is either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; up to some normalization (the number of Hadamard gates in such sequence), namely &lt;span class=&quot;math-container&quot;&gt;$$\operatorname{H}=\frac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp;-1\\-1&amp;amp;1\\\end{pmatrix}, \operatorname{CCNOT} = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the outcome of a polynomially long gate sequence of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CCNOT}$&lt;/span&gt; can be simulated by counting the number of paths which their product is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the number of paths which their product is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. It can be thought as the following &lt;a href=&quot;https://en.wikipedia.org/wiki/Directed_acyclic_graph&quot; rel=&quot;nofollow noreferrer&quot;&gt;DAG&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Starting from a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit string &lt;span class=&quot;math-container&quot;&gt;$00\cdots0$&lt;/span&gt; with an associated value &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$(00\cdots0,1)$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;li&gt;Generating vertices in the next level of the DAG by applying a Hadamard gate (out-degree &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;) or a Toffoli gate (out-degree &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), also let the associated value be the correspondent matrix element in the gate. For instance, leaves of &lt;span class=&quot;math-container&quot;&gt;$(00,1)$&lt;/span&gt; by applying a Hadamard gate on the first qubit are &lt;span class=&quot;math-container&quot;&gt;$(00,1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(10,-1)$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;li&gt;The &quot;depth&quot; of such DAG is the length of the gate sequence.&lt;/li&gt;&#xA;&lt;li&gt;And we only care about leaves associated with string &lt;span class=&quot;math-container&quot;&gt;$0\cdots$&lt;/span&gt; (the first qubit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let such polynomially long gate sequence denoted by &lt;span class=&quot;math-container&quot;&gt;$A_x$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is an input of some &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; problem. Notice that the following in the defintion of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$$\|\Pi_1 A_x|0^n \rangle\|_2^2 = \langle 0^n| A_x^{\dagger} \Pi_1 A_x | 0^n \rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\Pi_1 = |0\rangle\langle 0|\otimes I_{n-1}$&lt;/span&gt;, we can simply do the above construction for &lt;span class=&quot;math-container&quot;&gt;$A_x^{\dagger} \Pi_1 A_x$&lt;/span&gt;, and at the end of day, we only care above the leave associated with string &lt;span class=&quot;math-container&quot;&gt;$0\cdots 0$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the probability of getting some leaf is &lt;span class=&quot;math-container&quot;&gt;$\dfrac{a-b}{2^{k}}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the number of Hadamard gates, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the number of paths which the product of all associated values on such path is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is the number of paths which the product of all associated values on such path is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. &#xA;Such a counting task can be calculated by &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PP}$&lt;/span&gt; machine, namely using the GapP function mentioned in &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;nofollow noreferrer&quot;&gt;Marriott-Watrous (page 6)&lt;/a&gt;, also the proof the theorem 3.1 in &lt;a href=&quot;https://arxiv.org/pdf/cs/9811023.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fortnow-Rogers&lt;/a&gt;. Also, Watrous explained a similar proof for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\subseteq\mathsf{PP}$&lt;/span&gt; in &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/22.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;his lecture notes&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the above proof of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\subseteq\mathsf{PP}$&lt;/span&gt; can be automatically extended to show that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}\subseteq\mathsf{PP}$&lt;/span&gt;. The reason is mentioned in Greg Kuperberg's &lt;a href=&quot;https://arxiv.org/abs/0908.0512&quot; rel=&quot;nofollow noreferrer&quot;&gt;clarification on &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt;&lt;/a&gt;, namely the matrix element of the gate in the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt; quantum circuit need an exponential accuracy (instead of a polynomial accuracy in the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; case). Since the Solovay-Kitaev theorem gives an approximation algorithm in time &lt;span class=&quot;math-container&quot;&gt;$\text{poly}(n,\log(1/\epsilon))$&lt;/span&gt; for a single &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit gate, such quantum gate with exponentially accuracy still can be generated by polynomial long quantum gates on the given universal set (such as &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CCNOT}$&lt;/span&gt;). Therefore, any &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt; quantum circuit can be described as a polynomial long gate sequence on &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CCNOT}$&lt;/span&gt;, and we can use the same argument which we mentioned above. &lt;/p&gt;&#xA;" OwnerUserId="1777" LastEditorUserId="1777" LastEditDate="2019-01-27T11:52:04.143" LastActivityDate="2019-01-27T11:52:04.143" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5215" PostTypeId="1" AcceptedAnswerId="5217" CreationDate="2019-01-17T11:54:03.160" Score="9" ViewCount="378" Body="&lt;p&gt;To my understanding, Deutsch-Jozsa algorithm solves a specific problem in constant time, using a fixed circuit depth, compared to a classical deterministic algorithm, which would require time exponential to the number of bits used to store the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought this proves that there exist certain problems that we cannot solve in polynomial time on a classical machine (so they are not in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;), that we &lt;em&gt;can&lt;/em&gt; solve in constant time on a quantum machine (so they are in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This led me to a natural &quot;conclusion&quot; that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P} ≠ \mathsf{BQP}$&lt;/span&gt;. However, I believe this is actually still an open question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why doesn't Deutsch-Jozsa algorithm prove that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P} \neq \mathsf{BQP}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5463" LastEditorUserId="26" LastEditDate="2019-03-04T10:14:30.570" LastActivityDate="2019-11-22T07:57:28.540" Title="Why doesn't Deutsch-Jozsa Algorithm show that P ≠ BQP?" Tags="&lt;complexity-theory&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;bqp&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5216" PostTypeId="1" CreationDate="2019-01-17T12:01:06.917" Score="5" ViewCount="253" Body="&lt;p&gt;Using the quantum adversary lower bound technique, how can one calculate lower bound for Majority function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n \to \{0,1\}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$|x|\leq n/2$&lt;/span&gt; else &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|x|$&lt;/span&gt; is the hamming weight of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="5568" LastEditorUserId="1828" LastEditDate="2019-01-21T04:34:02.170" LastActivityDate="2019-01-21T04:34:02.170" Title="Query lower bound for Majority function using the quantum adversary method" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5217" PostTypeId="2" ParentId="5215" CreationDate="2019-01-17T12:45:33.310" Score="9" Body="&lt;p&gt;I believe there are two issues here. The first isn't anything wrong with your statement, but rather that you could make a far stronger (non-quantum) statement by the same reasoning: &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}\neq \mathsf{BPP}$&lt;/span&gt;. Why is this? For testing if an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit function is constant or balanced with certainty (as required by &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;), it could be that we have to check &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}+1$&lt;/span&gt; different inputs to see if they're all the same or not. However, imagine we just check 100 different, randomly chosen, input strings and see if they're all the same. The probability of a balanced function giving all the same outputs is approximately &lt;span class=&quot;math-container&quot;&gt;$1/2^{99}$&lt;/span&gt;. Hence we can determine in constant time on a classical computer whether the function is constant or balanced up to some finite accuracy threshold. It's certainly within BPP. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question still remains as to where the reasoning falls down. The fallacy is in the construction of the algorithm. It uses an oracle. That oracle computes something using the function in a very specific way. So the statement is really &quot;if we compute using this oracle, then we can prove that separation&quot;. It's said to be separation with respect to that oracle. Now you might say &quot;that oracle is just the evaluation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. What else could there be?&quot; but if you actually implement the algorithm, you have to program the function. So you have to know the function (or somebody else provides you with the code) and maybe you could analyse the function specification directly rather than just blindly evaluating it. (There doesn't have to be a proof that you can do better, we just have to allow for the possibility.) As a trivial example, let &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; be the most significant bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$f(x)=x_1$&lt;/span&gt;. If I wrote a program that systematically worked through all values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, if I was unlucky, I'd try all &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; options with &lt;span class=&quot;math-container&quot;&gt;$x_1=0$&lt;/span&gt; first. But if I saw the function definition, I'd know immediately that it's a balanced function.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2019-03-04T10:18:06.967" LastActivityDate="2019-03-04T10:18:06.967" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5218" PostTypeId="1" AcceptedAnswerId="5220" CreationDate="2019-01-17T15:50:29.443" Score="2" ViewCount="109" Body="&lt;p&gt;I'm trying to understand the Deutsch-Josza algorithm from an adiabatic perspective as presented in &lt;a href=&quot;https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.90.015002&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adiabatic quantum computing A: Review of modern physics, vol 90, (2018) pp 015002-1&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/1611.04471&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When explaining the unitary interpolation technique, the authors begin with:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The initial Hamiltonian is chosen such that its ground state is the uniform superposition state [&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = |+\rangle^{\otimes n}$&lt;/span&gt;], i.e., &lt;span class=&quot;math-container&quot;&gt;$H(0) = w\sum^{n}_{i = 1}|-\rangle_i \langle-|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; is the energy scale.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How can I calculate the ground state of &lt;span class=&quot;math-container&quot;&gt;$H(0)$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, I have seen, but don't remember exactly where, an observation that &lt;span class=&quot;math-container&quot;&gt;$H(0)$&lt;/span&gt; is introduced in a such a way that a penalty is provided for any state having a contribution of &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. What does it mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the paper goes on and states that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An adiabatic implementation requires a final Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(1)$&lt;/span&gt; such that its ground state is &lt;span class=&quot;math-container&quot;&gt;$|\Psi(1)\rangle = U|\Psi(0)\rangle$&lt;/span&gt;, and that this can be accomplished via a unitary transformation of &lt;span class=&quot;math-container&quot;&gt;$H(0)$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$H(1) = UH(0)U^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a diagonal matrix such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = diag[(-1)^{f(0)}, \dots,(-1)^{f(2^n-1)}] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, I don't see why bother with this; since to arrive at the answer using adiabatic quantum computation I need to construct a unitary in such a way that I will already have the answer if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced or constant. Am I overlooking anything?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Trying to workout an example, setting &lt;span class=&quot;math-container&quot;&gt;$n = 1$&lt;/span&gt; and making &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; (constant 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(0) = w|-\rangle\langle-| = w\pmatrix{1 &amp;amp; -1 \\ -1 &amp;amp; 1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will set &lt;span class=&quot;math-container&quot;&gt;$w = 1$&lt;/span&gt; to get it out of the way. Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = \pmatrix{-1 &amp;amp; 0 \\ 0 &amp;amp; -1} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H(1) = UH(0)U^\dagger = \pmatrix{-1 &amp;amp; 0 \\ 0 &amp;amp; -1}\pmatrix{1 &amp;amp; -1 \\ -1 &amp;amp; 1}\pmatrix{-1 &amp;amp; 0 \\ 0 &amp;amp; -1}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H(1) = \pmatrix{1 &amp;amp; -1 \\ -1 &amp;amp; 1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meaning that the ground state of &lt;span class=&quot;math-container&quot;&gt;$H(1)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If now I do the function &lt;span class=&quot;math-container&quot;&gt;$f(x) = x$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = \pmatrix{1 &amp;amp; 0 \\ 0 &amp;amp; -1} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(1) = \pmatrix{1 &amp;amp; 1 \\ 1 &amp;amp; 1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, I suppose, has ground state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. And with this we can differentiate between a constant and a balanced function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5570" LastEditorUserId="45" LastEditDate="2019-05-15T15:45:42.443" LastActivityDate="2019-05-15T15:45:42.443" Title="How to understand Deutsch-Jozsa algorithm from an adiabatic perspective?" Tags="&lt;algorithm&gt;&lt;adiabatic-model&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5219" PostTypeId="2" ParentId="5176" CreationDate="2019-01-17T16:50:30.667" Score="4" Body="&lt;p&gt;There are multiple factors that affect an embedding's performance, including what Davide mentions.  Depending on your background, the following interpretation of Davide's answer might be easier for you to understand:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Early in the anneal, the Ising (classical/user-input/final) Hamiltonian has no effect, which means that two spins in a chain are not compelled to agree.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As the anneal progresses, the chain couplings become increasingly impactful... so do the other Ising terms (h's and J's).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You want the chain terms to become important just before the other Ising terms become important.  This is a fine balance that can be influenced by the &lt;em&gt;strength&lt;/em&gt; of the chains (relative to the other terms), and by &lt;em&gt;anneal offsets&lt;/em&gt;, which can make some qubits anneal slightly in advance of others.  &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/14-1002A_B_tr_Boosting_integer_factorization_via_quantum_annealing_offsets.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This D-Wave whitepaper&lt;/a&gt; shows an example where anneal offsets can be effective.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;More generally I would start &quot;debugging&quot; an embedding by answering, in order, the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Are one or more chains frequently (or almost always) broken in the output?  If a chain frequently comes out as partly up and partly down, it suggests that one or all of the couplings in that chain need to be stronger.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you find multiple embeddings of the same problem (heuristically using sapiFindEmbedding or similar), do they all &quot;fail&quot; in the same way?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does your embedding have some chains that are very large compared to others?  If so, the larger chains will have slower dynamics (they will be &quot;heavier&quot;) and perhaps should be adjusted with anneal offsets as described in the link.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Note that if your output (without postprocessing) doesn't have any broken chains, it may suggest that your chains are too &lt;em&gt;strong&lt;/em&gt;.  This means that the non-chain terms will be very small, and therefore the problem will be sensitive to noise and will have a high effective temperature, which is bad.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4920" LastActivityDate="2019-01-17T16:50:30.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5220" PostTypeId="2" ParentId="5218" CreationDate="2019-01-18T07:36:48.917" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I calculate the ground state of &lt;span class=&quot;math-container&quot;&gt;$H(0)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The ground state means the eigenvector with lowest eigenvalue. Take your given example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(1)=\left(\begin{array}{cc} 1 &amp;amp; 1 \\ 1 &amp;amp; 1 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;You solve &lt;span class=&quot;math-container&quot;&gt;$\text{det}(H(1)-\lambda\mathbb{I})=0$&lt;/span&gt; to find the eigenvalues. In this case, &lt;span class=&quot;math-container&quot;&gt;$\lambda=0,2$&lt;/span&gt;. So you're interested in the smallest eigenvalue, 0. So, we solve for &lt;span class=&quot;math-container&quot;&gt;$H(1)|\lambda\rangle=0$&lt;/span&gt;, which you'll find is satisfied for the state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle=(|0\rangle-|1\rangle)/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find the ground state of &lt;span class=&quot;math-container&quot;&gt;$H(0)$&lt;/span&gt; in its general form, the easiest way is just to recognise what's going on. If I apply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(0)|+\rangle^{\otimes n}=0.&#xA;$$&lt;/span&gt;&#xA;So, this is an eigenvector of 0 eigenvalue. Whenever I change a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; into a &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, the eigenvector relation is still satisfied, but the eigenvalue increases by &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; each time. So there is an energy penalty of &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; for having a &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state. In this way, we can construct a complete basis, and find all the eigenvalues: &lt;span class=&quot;math-container&quot;&gt;$kw$&lt;/span&gt;, repeated &lt;span class=&quot;math-container&quot;&gt;$\binom{n}{k}$&lt;/span&gt; times for &lt;span class=&quot;math-container&quot;&gt;$k=0,1,\ldots ,n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At this point, I don't see why bother with this; since to arrive at the answer using adiabatic quantum computation I need to construct a unitary in such a way that I will already have the answer if f is balanced or constant. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, Deutsch-Jozsa is very much defined in terms of an oracle, i.e. the unitary is something that is given directly to you, and you can't look inside it to see what's happening. &lt;em&gt;You do not construct the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;&lt;/em&gt;. The question then is how long your algorithm needs to run for in order to find out if the function is constant or balanced. This is where the adiabatic part comes in; using the oracle in an adiabatic way, you can calculate how long it takes, and find it's a constant time.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-18T07:36:48.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5221" PostTypeId="1" CreationDate="2019-01-18T14:18:07.410" Score="3" ViewCount="72" Body="&lt;p&gt;Define the recursive sequence &lt;span class=&quot;math-container&quot;&gt;$x_{i+1} = x_0 x_i \mod 21$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x_0 = 2$&lt;/span&gt;, and hence &lt;span class=&quot;math-container&quot;&gt;$x_1 = x_0 x_0 = 4$&lt;/span&gt;, and so on, generating the sequence &lt;span class=&quot;math-container&quot;&gt;$[2, 4, 8, 16, 11, 1]$&lt;/span&gt;, where the brackets mean it cycles on forever.  This sequence has 6 elements so &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; q-bits suffice to put each of these numbers in a superposition.  My objective is to get &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{\left|#1\right\rangle}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\qr2 + \qr4 + \qr8 + \qr{16} + \qr{11} + \qr1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being a superposition, I think I'll have to fill it with other terms until I complete a power of 2, so zeros would be fine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\qr2 + \qr4 + \qr8 + \qr{16} + \qr{11} + \qr1 + \qr0 + \qr0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I prepare such state from, say, &lt;span class=&quot;math-container&quot;&gt;$\qr{00000}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="1867" LastEditDate="2019-01-24T18:45:43.267" LastActivityDate="2019-01-24T18:45:43.267" Title="How to prepare a superposed state where its terms are elements of a sequence?" Tags="&lt;superposition&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5222" PostTypeId="1" AcceptedAnswerId="5224" CreationDate="2019-01-18T15:21:33.640" Score="10" ViewCount="1194" Body="&lt;p&gt;In implementing a quantum subroutine it is important to uncompute temporary registers after use, to ensure the output state of the subroutine is not entangled with them (which would affect its behaviour).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it necessary to perform this through uncomputation rather than simply setting temporary registers to zero afterwards?&lt;/p&gt;&#xA;" OwnerUserId="5174" LastActivityDate="2019-01-19T23:38:02.320" Title="Why do we have to uncompute rather than simply set registers to zero?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5223" PostTypeId="2" ParentId="5221" CreationDate="2019-01-18T16:02:40.200" Score="4" Body="&lt;p&gt;Do you want to know about this specific sequence, or more generally?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, this is essentially a W state, about which there have been several questions in the past. You just need one extra term (effectively &lt;span class=&quot;math-container&quot;&gt;$|32\rangle$&lt;/span&gt;) that you could later change into &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, leaving the others untouched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I've got a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|1\rangle+|2\rangle+|4\rangle+|8\rangle+|16\rangle+|32\rangle)/\sqrt{6}&#xA;$$&lt;/span&gt;&#xA;This is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|000001\rangle+|000010\rangle+|000100\rangle+|001000\rangle+|010000\rangle+|100000\rangle)/\sqrt{6}.&#xA;$$&lt;/span&gt;&#xA;We do controlled-nots, controlled off the first qubit targetting qubits 3, 5 and 6. This changes &lt;span class=&quot;math-container&quot;&gt;$|100000\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|101011\rangle$&lt;/span&gt;. Now we do a controlled-controlled-not controlled by qubits 3 and 5, targetting qubit 1. This changes the &lt;span class=&quot;math-container&quot;&gt;$|101011\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|001011\rangle$&lt;/span&gt; without changing anything else. Thus, we're left with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle(|10000\rangle+|01000\rangle+|00100\rangle+|00010\rangle+|00001\rangle+|01011\rangle)/\sqrt{6},&#xA;$$&lt;/span&gt;&#xA;which is the state you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, meaning a state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{r}} \sum_{i=0}^{r-1}|a^i\text{ mod }N\rangle,&#xA;$$&lt;/span&gt;&#xA;I advise looking at the order finding algorithm for quantum computers. You're basically talking about preparing one of the eigenvectors of the order finding unitary. While you would like to be able to prepare such a state in order to find the order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, we don't know how to do that without first finding &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. But, when you've run the order finding algorithm, and it randomly outputs a value of &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;, the state of the second register is in the eigenvector related to &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{r}} \sum_{k=0}^{r-1}e^{-2\pi i k s/r}|a^k\text{ mod }N\rangle&#xA;$$&lt;/span&gt;&#xA;Once you've got that, and you know the value &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;, you should easily be able to compensate for the phases.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-01-21T08:24:17.150" LastActivityDate="2019-01-21T08:24:17.150" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5224" PostTypeId="2" ParentId="5222" CreationDate="2019-01-18T16:05:03.057" Score="2" Body="&lt;p&gt;Because all operations you carry out (besides measurement) need to be unitary and this one would not.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-01-18T16:05:03.057" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5225" PostTypeId="2" ParentId="5222" CreationDate="2019-01-18T17:52:20.717" Score="4" Body="&lt;p&gt;Uncomputing temporary registers seem to me to be the most efficient way to set temporary registers back to zero. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't measure these and classically flip them &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;because a measurement of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; doesn't necessarily mean the state of the temporary register is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;because measuring would cause entangled qubits to collapse into a corresponding state so that would defeat the purpose of uncomputing temporary registers that you mentioned in your question.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And somehow implementing a circuit that detected a temporary register's state moved it back to 0 would be much more difficult than simply uncomputing the temporary register.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="26" LastEditDate="2019-01-18T21:36:02.993" LastActivityDate="2019-01-18T21:36:02.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5226" PostTypeId="1" AcceptedAnswerId="5229" CreationDate="2019-01-19T10:32:50.663" Score="4" ViewCount="344" Body="&lt;p&gt;I'm a bit familiar with the concept of stochastic computing, where numbers are stored in large bit streams called &quot;Stochastic Numbers&quot;, which represent numbers in the domain &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt; typically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Stochastic_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article on stochastic computing&lt;/a&gt; summarizes all basic concepts and history behind it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does any of the concepts of stochastic computing relate to quantum computing? Or are they two very different ways of treating calculations?&lt;/p&gt;&#xA;" OwnerUserId="5583" LastEditorUserId="26" LastEditDate="2019-01-19T11:27:00.373" LastActivityDate="2019-01-19T19:57:48.747" Title="Does quantum computing relate to stochastic computing in any way?" Tags="&lt;classical-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5227" PostTypeId="2" ParentId="5118" CreationDate="2019-01-19T14:52:23.837" Score="2" Body="&lt;p&gt;In the CHSH game we have 2 players Alice and Bob. Can we proof in the form of a noncommunication pair of TMs which takes as input independant random bits x and y plus an arbitrary shared bitstring, that ALice and Bob win the CHSH game with probability greater than 75%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We ask Alice and Bob questions x and y with probability p(xy) they give answers a and b. The rules of the game are denoted using &lt;span class=&quot;math-container&quot;&gt;$V(a,b|x,y)$&lt;/span&gt;wich takes the value &quot;1&quot; if a and b are the winning answers. The probability that Alice and Bob win the game is maximized over all possible strategies &#xA;&lt;span class=&quot;math-container&quot;&gt;$ P_{win} =  max_{strategy} \sum_{x,y} p(x,y) | \sum_{a,b} V(a,b|x,y) p(a,b|x,y). $&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$p(a,b|x,y) $&lt;/span&gt; is the probability that Alice and Bob produce answers a and b given x and y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pdSaR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pdSaR.png&quot; alt=&quot;Test setup&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of probabilities there is an distinction between a classical deterministic prob and a classical shared ramdoness probability. A deterministic classical stratey is given by the functions &lt;span class=&quot;math-container&quot;&gt;$f_{A}(x) = a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_{B}(y) = b $&lt;/span&gt; that take the questions x and y. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have shared randomness another string r is used with a sharing probability &lt;span class=&quot;math-container&quot;&gt;$p(r)$&lt;/span&gt;. Classicaly Alice and Bob can only apply functions &lt;span class=&quot;math-container&quot;&gt;$a = f_{A}(x,r)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b = f_{b}(y,r)$&lt;/span&gt; &#xA;This gives &lt;span class=&quot;math-container&quot;&gt;$ p(a,b|x,y) =  \sum_{x,y}^{} (p(r)) p(a,b|x,y,r) $&lt;/span&gt;&#xA;In this case the pobability of winning the game is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ P_{win} =  max_{strategy} \sum_{x,y} p(x,y) \sum_{a,b} V(a,b|x,y)\sum_{r}p(r)p(a,b|x,y,r)$&lt;/span&gt;. In this case of shared randomnes we have an extra term with the string r. Alice and Bob can fix the best possible r given a deterministic strategy  for a and b.&#xA;So it is possible to run an algorithm on a Turing machine using a string r according to the test setup in the picture. Problem how do we find the best possible string r?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to look at it is to say that the string r as a shared randomness is referred to as a hidden variabele in physics. So the Hidden Variabele Theory is equivalent to using a string r in a turing machine. Therefore we might just as well make use of a proof of the CHSH inequality. Furthermore we can compare an arbitrary HVT (dashed line ) and QM results for a photonic experiment.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vIlrh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vIlrh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A compact proof of the CHSH inequality based on a hidden variabele can be found in &lt;a href=&quot;https://arxiv.org/PS_cache/quant-ph/pdf/0205/0205171v1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the article Entangled photons, nonlocality and Bell inequalities in the undergraduate laboratory.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1773" LastEditDate="2019-01-19T20:51:34.763" LastActivityDate="2019-01-19T20:51:34.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5228" PostTypeId="2" ParentId="5226" CreationDate="2019-01-19T19:46:19.377" Score="4" Body="&lt;p&gt;The two are very different ways of treating calculations. You've probably heard that qbits &quot;can be both 0 and 1 at the same time&quot; or similar; this isn't accomplished by assigning them a value in the domain &lt;span class=&quot;math-container&quot;&gt;$[0, 1]$&lt;/span&gt;, but rather a linear combination of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + \beta|1\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is called a state vector, and quantum operations take the form of matrices multiplying this state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're interested in learning more, I have created a video on quantum computing you might find instructive &lt;a href=&quot;https://youtu.be/F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-01-19T19:46:19.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5229" PostTypeId="2" ParentId="5226" CreationDate="2019-01-19T19:57:48.747" Score="5" Body="&lt;p&gt;Scott Aaronson relates quantum and stochastic computation as follows: quantum computation is stochastic computation, &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;noreferrer&quot;&gt;but using the 2-norm instead of the 1-norm&lt;/a&gt; as the conserved quantity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both paradigms you form vectors of weighted states, and operate on those vectors using matrices. So they have many similarities. But in stochastic computation the weights have to add up to 1 (as probabilities do) whereas for quantum computation the &lt;em&gt;squares&lt;/em&gt; of the weights have to add up to 1 (as amplitudes do).&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-01-19T19:57:48.747" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5230" PostTypeId="2" ParentId="1192" CreationDate="2019-01-19T20:33:11.847" Score="4" Body="&lt;p&gt;You can't ignore the constant factors when comparing quantum computation to classical computation. They're too large.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is an image from some &lt;a href=&quot;https://docs.google.com/presentation/d/1WslAa7VOiJ5XBX0MP0ZuH_8B_nImg97APZFsqQQTdC4/present?token=AC4w5VinCpYndlylegZVB191vyVFMrEUgw%3A1527781817511&amp;amp;includes_info_params=1#slide=id.p&quot; rel=&quot;nofollow noreferrer&quot;&gt;slides&lt;/a&gt; I presented last year:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YVMsg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YVMsg.png&quot; alt=&quot;quantum and gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The things along the bottom are magic state factories. They have a footprint of 150K physical qubits. Since the AND gate uses 150K qubits for 0.6 milliseconds, we surmise that the spacetime volume of a quantum AND gate is on the order of 90 qubit seconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of my coworkers' goals is to use 1 cpu per 100 qubits when performing error correction. So we might say that 90 qubit seconds requires 0.9 cpu seconds of work. We've made the quantum constructions &lt;a href=&quot;https://arxiv.org/abs/1812.01238&quot; rel=&quot;nofollow noreferrer&quot;&gt;several times more efficient&lt;/a&gt; since the above image was made, so let's call it 0.1 cpu seconds instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There are many assumptions that go into these estimates. What kind of architecture, error rates, etc. I'm only trying to convey an order of magnitude idea.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It takes 63 AND gates to perform a 64 bit addition. 63*0.1 cpu seconds ~= 6 cpu seconds. Quantumly, a 64 bit addition costs more than a CPU second. Classically, a 64 bit addition costs less than a CPU nanosecond. There's easily a constant factor difference of 10 billion here. If you compare against a parallel classical machine, such as a GPU, the numbers get even worse. You can't ignore constant factors with that many digits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider Grover's algorithm, which allows us to search for a satisfying input to a function in sqrt(N) evaluations of the function instead of N evaluations. Add in the constant factor of 10 billion, and solve for where the quantum computer starts to require fewer evaluations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;N &amp;amp;&amp;gt; 10^{10} \sqrt{N}\\&#xA;N &amp;amp;&amp;gt; 10^{20}&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm can't parallelize the evaluations, and the evaluations require at least one AND gate, so basically you only start seeing CPU time benefits when the search is taking tens of millions of years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless we make the constant factors a lot better, no one is ever going to use Grover search for anything useful. Right now the quantum-vs-classical situation is exponential advantage or bust.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-01-19T21:57:50.217" LastActivityDate="2019-01-19T21:57:50.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5231" PostTypeId="2" ParentId="5216" CreationDate="2019-01-19T23:03:18.427" Score="2" Body="&lt;p&gt;First, note that for functions that do not change their value upon permutation of their inputs—or in other words, functions that only depend on the Hamming weight &lt;span class=&quot;math-container&quot;&gt;$|x|$&lt;/span&gt; of the input—it is known that the polynomial method tightly characterizes the query complexity, see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9802049&quot; rel=&quot;nofollow noreferrer&quot;&gt;Beals et al.&lt;/a&gt; In particular, this can be applied to the majority function &lt;span class=&quot;math-container&quot;&gt;$MAJ(x_1, \ldots, x_n)$&lt;/span&gt; to obtain a tight &lt;span class=&quot;math-container&quot;&gt;$\Theta(n)$&lt;/span&gt; bound of the query complexity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you asked specifically for a derivation of the &lt;span class=&quot;math-container&quot;&gt;$\Omega(n)$&lt;/span&gt; lower bound via the &lt;em&gt;adversary&lt;/em&gt; method, one can proceed as follows, following &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0002066&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ambainis’ initial paper&lt;/a&gt; about the adversary method (note that ever since, there were numerous further developments regarding  the adversary method, see for instance &lt;a href=&quot;https://arxiv.org/abs/1402.3858&quot; rel=&quot;nofollow noreferrer&quot;&gt;Belov’s thesis&lt;/a&gt; and the references cited therein):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theorem 2 in Ambainis' paper asserts that a lower bound can be shown if one can identify a hard distribution for the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. Technically, this means to find two sets of inputs &lt;span class=&quot;math-container&quot;&gt;$X, Y\subseteq \{0,1\}^n$&lt;/span&gt; that lead to different evaluations of the function (i.e., &lt;span class=&quot;math-container&quot;&gt;$f(x)\not= f(y)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y \in Y$&lt;/span&gt;) and a relation &lt;span class=&quot;math-container&quot;&gt;$R \subset X \times Y$&lt;/span&gt; (which makes sure that the two distributions are close in a suitable sense), such that the following hold:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For every &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt;, there are at least &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; different &lt;span class=&quot;math-container&quot;&gt;$y \in Y$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(x,y) \in R$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;for every &lt;span class=&quot;math-container&quot;&gt;$y \in Y$&lt;/span&gt;, there are at least &lt;span class=&quot;math-container&quot;&gt;$m’$&lt;/span&gt; different &lt;span class=&quot;math-container&quot;&gt;$x \in X$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(x,y) \in R$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;for every &lt;span class=&quot;math-container&quot;&gt;$x \in X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i \in \{1, \ldots, n\}$&lt;/span&gt;, there are at most &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; different &lt;span class=&quot;math-container&quot;&gt;$y\in Y$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(x,y)\in R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_i\not= y_i$&lt;/span&gt;, and&lt;/li&gt;&#xA;&lt;li&gt;for every &lt;span class=&quot;math-container&quot;&gt;$y \in Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i \in \{1, \ldots, n\}$&lt;/span&gt;, there are at most &lt;span class=&quot;math-container&quot;&gt;$\ell’$&lt;/span&gt; different &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(x,y)\in R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_i\not= y_i$&lt;/span&gt;.  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If all this holds, then the query complexity of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be lower bounded by &lt;span class=&quot;math-container&quot;&gt;$\Omega\left(\sqrt{\frac{m m’}{\ell \ell’}}\right)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$MAJ$&lt;/span&gt;, one can define an adversary as follows: let &lt;span class=&quot;math-container&quot;&gt;$X = \{x : |x|=n/2\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y = \{y : |y|=n/2+1\}$&lt;/span&gt;, and define the relation as &lt;span class=&quot;math-container&quot;&gt;$R = \{ (x,y) : |x \oplus y|=1\}$&lt;/span&gt;. Then clearly each fixed &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; can be extended in at least &lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt; ways to obtain an element in &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; that is related to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$m\geq n/2$&lt;/span&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$m’ \geq n/2$&lt;/span&gt;. For a fixed &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and a fixed location &lt;span class=&quot;math-container&quot;&gt;$i\in \{1, \ldots, n\}$&lt;/span&gt; there can be at most one bit-vector &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; that has Hamming distance &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (namely, this happens precisely when &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is not in the support of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;), so &lt;span class=&quot;math-container&quot;&gt;$\ell=1$&lt;/span&gt;. By a similar argument, &lt;span class=&quot;math-container&quot;&gt;$\ell’=1$&lt;/span&gt;. Putting is all together yields the lower bound of &lt;span class=&quot;math-container&quot;&gt;$\Omega\left(\sqrt{\frac{n/2 \cdot n/2}{1 \cdot 1}}\right) = \Omega(n)$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="1828" LastEditDate="2019-01-20T01:09:03.560" LastActivityDate="2019-01-20T01:09:03.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5232" PostTypeId="2" ParentId="5222" CreationDate="2019-01-19T23:38:02.320" Score="4" Body="&lt;p&gt;While it is definitely possible to reset registers after using them (namely, by simply measuring them) the issue is that doing so can potentially destroy interference that one might want to achieve by &lt;em&gt;subsequent&lt;/em&gt; computations with the quantum data. Unfortunately, this is the most common case encountered in quantum algorithms, such as e.g. the computation of arithmetic in Shor's factoring and dlog algorithms or the computation of a Boolean predicate in case of Grover's search algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concretely, assume that we have two registers, a data register &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, an output register &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and an ancilla register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and that half-way through the computation we arrived at an entangled state &lt;span class=&quot;math-container&quot;&gt;$\sum_{x} \alpha_{x} |x\rangle |f(x)\rangle |g(x)\rangle$&lt;/span&gt;, where the inputs are held in &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, the function values &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; are computed into &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and the values &lt;span class=&quot;math-container&quot;&gt;$g(x)$&lt;/span&gt; are results of some intermediate computations that is stored in the scratch register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now, instead of uncomputing the register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; so that it holds &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (or some other state that is unentangled with registers &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;), we decide to reset the register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, this will have the following detrimental effect: we will measure (at random) some value &lt;span class=&quot;math-container&quot;&gt;$c_0$&lt;/span&gt; and the state will collapse to the superposition of all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that are consistent with this measured value, so that the state will become (up to normalization): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{x: g(x) = c_0} \alpha_x |x\rangle |f(x)\rangle. $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this can be vastly different from the state &lt;span class=&quot;math-container&quot;&gt;$\sum_x \alpha_x |x\rangle |f(x)\rangle$&lt;/span&gt; that we really wanted (and actually only for constant functions &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; yields the correct result). Indeed, if &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is a permutation, only a single &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; will survive from the initial superposition! Hence, temporary/scratch registers have to be uncomputed if we want to do subsequent computations with the data in the other registers.  &lt;/p&gt;&#xA;" OwnerUserId="1828" LastActivityDate="2019-01-19T23:38:02.320" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5233" PostTypeId="2" ParentId="4437" CreationDate="2019-01-20T00:08:19.630" Score="3" Body="&lt;p&gt;The question is whether taking the Fourier transform &lt;span class=&quot;math-container&quot;&gt;$\operatorname{QFT}|gH\rangle$&lt;/span&gt; followed by sampling allows to &lt;em&gt;efficiently&lt;/em&gt; recover generators of the hidden subgroup &lt;span class=&quot;math-container&quot;&gt;$H\leq G$&lt;/span&gt;. While the problem is wide open for non-abelian groups (see &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0511148.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for a discussion of the limitations of the Fourier sampling method for instances in case of &lt;span class=&quot;math-container&quot;&gt;$G=S_n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$G=PSL(2,\mathbb{F}_q)$&lt;/span&gt; and other non-abelian groups), for abelian groups &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; the PO is correct that Fourier sampling solves the abelian hidden subgroup problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to perform several measurements &lt;span class=&quot;math-container&quot;&gt;$\operatorname{QFT}|gH\rangle$&lt;/span&gt; and to note that a result &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; can be sampled if and only if &lt;span class=&quot;math-container&quot;&gt;$z\in H^\perp$&lt;/span&gt; holds, where &lt;span class=&quot;math-container&quot;&gt;$H^\perp = \{ g \in G : \chi_g(h)=1 \; \forall h \in H\}$&lt;/span&gt;. Here we (non-canonically) identified the characters &lt;span class=&quot;math-container&quot;&gt;$\chi \in \hat{G}$&lt;/span&gt; with the elements of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; (which is possible if and only if &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is abelian). One can prove that doing this procedure &lt;span class=&quot;math-container&quot;&gt;$\log^2(|G|)$&lt;/span&gt; times will with constant probability uniquely characterize &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; from the measurement results &lt;span class=&quot;math-container&quot;&gt;$z_1, z_2, \ldots$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is more, if the group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is explicitly known (i.e., one knows an isomorphism to a direct product of cyclic groups), then one can efficiently compute &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$H^\perp$&lt;/span&gt; using classical post-processing which essentially is linear algebra. A good reference for this is &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9704027.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Brassard and Hoyer&lt;/a&gt;. If the group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is abelian, but the structure is not known, then one can first discover the structure of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; and then find &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in a subsequent step. This was described in &lt;a href=&quot;https://arxiv.org/abs/cs/0101004&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cheung and Mosca&lt;/a&gt;. However, all this assumes at a minimum that &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; has the structure of a black-box group with unique encoding. As shown by &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0102014.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ivanyos et al&lt;/a&gt;, even in case of non-unique encodings, one can recover the hidden subgroup, provided certain additional assumptions hold such as the existence of oracles for identity and membership test.&lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="26" LastEditDate="2019-01-20T09:34:55.973" LastActivityDate="2019-01-20T09:34:55.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5234" PostTypeId="1" AcceptedAnswerId="5236" CreationDate="2019-01-20T03:17:54.207" Score="4" ViewCount="533" Body="&lt;p&gt;I am a physics and math undergraduate and I want to learn quantum computing mainly I want to try doing research. Are there any resources online courses or books or websites? I not familiar with the concepts of computing. In particular, it would be really helpful if the books are for physics people. &lt;/p&gt;&#xA;" OwnerUserId="5585" LastEditorUserId="26" LastEditDate="2019-01-20T08:03:15.547" LastActivityDate="2019-01-23T10:36:13.720" Title="Resources for learning quantum computing from an undergraduate physics perspective" Tags="&lt;resource-request&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5235" PostTypeId="2" ParentId="5234" CreationDate="2019-01-20T04:32:37.487" Score="1" Body="&lt;p&gt;Some answers have already been proposed in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2082/are-there-any-organised-resources-available-from-where-i-can-begin-my-quantum-co&quot;&gt;previous question&lt;/a&gt; and in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1926/does-a-study-guide-exist-that-starts-from-a-purely-cs-background-and-advances&quot;&gt;one&lt;/a&gt;. Nielsen and Chuang's book is the reference but may introduce much and very fast. But you have many introduction PDFs like &lt;a href=&quot;https://warwick.ac.uk/fac/sci/physics/research/cfsa/people/pastmembers/charemzam/pastprojects/mcharemza_quant_comp.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Introduction to Quantum Computing (Michal Charemza)&lt;/a&gt;. I would recommend crossing different sources to learn even material for non-physicists, like &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9809016&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Introduction to Quantum Computing for Non-Physicists (Rieffel &amp;amp; Polak)&lt;/a&gt;. Look at quantum development kits like Q#, Qiskit, pyQuil and follow their docs and getting started.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-01-20T08:55:30.433" LastActivityDate="2019-01-20T08:55:30.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5236" PostTypeId="2" ParentId="5234" CreationDate="2019-01-20T08:46:48.800" Score="2" Body="&lt;p&gt;I had already mentioned some beginner level resources in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1972&quot;&gt;this answer&lt;/a&gt; to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1926&quot;&gt;Does a study guide exist that starts from a “purely CS background” and advances towards “making a new quantum programming language”?&lt;/a&gt; I'll list some other good resources others which I have found since then, which I believe will be more suitable for physics undergrads.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://uwaterloo.ca/institute-for-quantum-computing/programs/useqip&quot; rel=&quot;nofollow noreferrer&quot;&gt;University of Waterloo's USEQIP 2011-12&lt;/a&gt; lectures are now &lt;a href=&quot;https://www.youtube.com/playlist?list=PLE2D9E49457E950E7&quot; rel=&quot;nofollow noreferrer&quot;&gt;available on YouTube&lt;/a&gt;. Ideally, you should follow them in sequential order and if you devote full-time you should be able to grasp the basics of quantum computing in around 2 weeks. The lectures are extremely well structured and specifically aimed at pre-final year undergrads. They cover both theoretical and experimental topics like linear algebra, quantum algorithms, practical decoherence modeling, error correction, quantum dots, quantum key distribution, spin-polarized transport, superconducting qubits, quantum foundations, and NMR quantum computing. Generally, it's quite rare to find undergrad-level lectures by the leading quantum computing scientists like &lt;a href=&quot;https://en.wikipedia.org/wiki/Michele_Mosca&quot; rel=&quot;nofollow noreferrer&quot;&gt;Michele Mosca&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Andrew_Childs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andrew Childs&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Raymond_Laflamme&quot; rel=&quot;nofollow noreferrer&quot;&gt;Raymond Laflamme&lt;/a&gt; themselves. So you're lucky!&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;John Watrous' &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CPSC519.Winter2006/&quot; rel=&quot;nofollow noreferrer&quot;&gt;2006 lecture notes&lt;/a&gt;  are a great resource to accompany &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2669/26&quot;&gt;Vazirani's lectures and notes&lt;/a&gt;. You can think of this as an abridged undergrad-version of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt;. It covers the basics of quantum algorithms, quantum information, cryptography, and error correction. This will be more useful if you're bent towards the computer science side of quantum computing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;John Watrous' &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CS766.Fall2011/&quot; rel=&quot;nofollow noreferrer&quot;&gt;2011 lecture notes&lt;/a&gt; provide a very thorough exposition of quantum information theory (some of the topics discussed there are not even available in Nielsen and Chuang). You may go ahead with it once you're done with the resources mentioned in points 1 and 2, and find yourself sufficiently interested in quantum information theory. I've personally only been able to go through the first couple of chapters so far, as it's quite dense. Not recommended for beginners but definitely useful for the advanced students. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To get a basic idea of quantum complexity theory, go through &lt;a href=&quot;https://www.youtube.com/watch?v=fc12NHko8sw&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Complexity Theory (Part 1) - CSSQI 2012&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=D1cZbRvBMqY&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Complexity Theory (Part 2) - CSSQI 2012&lt;/a&gt;. I believe complexity theory is a topic which very few physics students have a solid grounding in. But it's extremely helpful to have at least an undergrad level knowledge of computational complexity theory if you wish to pursue higher studies in quantum computing, even if you choose the physicist's path. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://www.youtube.com/playlist?list=PLq2e2Zi6KW-uHqylI-9paEJEj2zIS6dD-&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSSQI 2012 playlist&lt;/a&gt; also has topics like topological quantum computing and quantum control theory. I haven't watched all of them yet, but from what I've seen, they seem to be very high quality lectures, aimed at beginners. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-23T10:36:13.720" LastActivityDate="2019-01-23T10:36:13.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5237" PostTypeId="1" CreationDate="2019-01-20T13:21:52.203" Score="1" ViewCount="111" Body="&lt;p&gt;I have created a &lt;span class=&quot;math-container&quot;&gt;$16\times 16$&lt;/span&gt; unitary operator using a Hamiltonian by finding its exponential&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=\exp(-iH\delta t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I set &lt;span class=&quot;math-container&quot;&gt;$\delta t=1$&lt;/span&gt; then I can take this matrix and input it into &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk&lt;/a&gt; using the custom gate maker. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some gates have the option to rotate wrt time. These are the &quot;spinning&quot; gates &lt;span class=&quot;math-container&quot;&gt;$Z^t$&lt;/span&gt; etc, which performs the rotation &lt;span class=&quot;math-container&quot;&gt;$R_Z(\theta=2\pi t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some way to generalize this spinning to any unitary matrix with a time component?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel there must be a way to do it by adjusting &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Perhaps by rotating all qubits by some angle and then applying a modified &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;? But I'm not sure if it's possible since we'd need to do something like &lt;span class=&quot;math-container&quot;&gt;$U'|a\rangle=U^a|0\rangle.$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5594" OwnerDisplayName="James" LastEditorUserId="26" LastEditDate="2019-01-20T20:13:37.280" LastActivityDate="2019-01-21T04:09:53.127" Title="Creating a time dependent custom gate in Quirk" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5238" PostTypeId="2" ParentId="5237" CreationDate="2019-01-20T21:45:40.543" Score="1" Body="&lt;p&gt;The only way to make a time-dependent custom gate is to decompose the desired unitary into a circuit using the built-in time-dependent gates (typically &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z^t$&lt;/span&gt;), then make a custom circuit gate using that circuit. (Assuming you're not willing to implement the gate by editing the source code.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I didn't add support for e.g. using the variable &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; in a custom matrix or rotation gate is that I'm worried that storing the equation could result in very unfortunate backward compatibility constraints (e.g. future versions needing to reproduce existing parsing bugs to keep circuit links from breaking or changing behavior). Also, it doesn't play well with the &quot;ensure unitary&quot; option.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-21T04:09:53.127" LastActivityDate="2019-01-21T04:09:53.127" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5239" PostTypeId="2" ParentId="4893" CreationDate="2019-01-20T22:18:21.433" Score="4" Body="&lt;h2&gt;Background - CPT (and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt;) symmetry in QFT&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I think the first step in answering is this is explaining what CPT (also, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt;) symmetry from a quantum &lt;em&gt;computing&lt;/em&gt; perspective is &lt;em&gt;not&lt;/em&gt;. If this same question on physics SE was asked, I would refer them to chapters 23 and 40 of Srednicki's &lt;a href=&quot;http://web.physics.ucsb.edu/~mark/qft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Field Theory&lt;/em&gt;&lt;/a&gt; for the full-blown explanation. However, while that is useful background for understanding the CPT operation from a computational perspective, the important point is that the Parity &lt;span class=&quot;math-container&quot;&gt;$\left(\mathcal P\right)$&lt;/span&gt; and Time &lt;span class=&quot;math-container&quot;&gt;$\left(\mathcal T\right)$&lt;/span&gt; reversal transformations are operations that act on the spatial and temporal co-ordinates, giving unitary Parity &lt;span class=&quot;math-container&quot;&gt;$\left(P\right)$&lt;/span&gt; and Time &lt;span class=&quot;math-container&quot;&gt;$\left(T\right)$&lt;/span&gt; operators on the &lt;em&gt;field&lt;/em&gt;, as well as additional Charge conjugation operations &lt;span class=&quot;math-container&quot;&gt;$\left(\mathcal C\text{ and }C\right)$&lt;/span&gt; and so, may change depending on the particle being looked at/used. Implementing these transformations on a quantum computer would then mean that different 'implementations' of computer could act differently under the &lt;span class=&quot;math-container&quot;&gt;$\mathcal C,\, \mathcal P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal T$&lt;/span&gt; operations, which is not so good.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}$&lt;/span&gt;-symmetric Hamiltonians&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;However&lt;/em&gt;, what this &lt;em&gt;does&lt;/em&gt; lead to is the realisation that Hamiltonians can be non-Hermitian, yet have real eigenvalues due to having &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}$&lt;/span&gt; symmetry (of the 'reversing the spatial and temporal co-ordinates' sense) as discovered by &lt;a href=&quot;https://arxiv.org/abs/physics/9712001&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bender and Boettcher&lt;/a&gt;. This symmetry can be broken (the Hamiltonian has real eigenvalues) or unbroken (the Hamiltonian has complex eigenvalues), with a phase transition (often known as the &lt;em&gt;exceptional point&lt;/em&gt;) in between. This allows for the definition of &lt;span class=&quot;math-container&quot;&gt;$\mathcal P\text{ and }\mathcal T$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mathcal T$&lt;/span&gt; is complex conjugation), as well as the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}$&lt;/span&gt; inner product: for a state &lt;span class=&quot;math-container&quot;&gt;$\psi\left(x\right)$&lt;/span&gt; and Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; with eigenstates &lt;span class=&quot;math-container&quot;&gt;$\phi_n\left(x\right)$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathcal P\left(x, y\right) &amp;amp;= \delta\left(x+y\right) \\ &#xA;&amp;amp;= \sum_n\left(-1\right)^n\phi_n\left(x\right)\phi_n\left(-y\right) \\&#xA;\mathcal{PT}\psi\left(x\right) &amp;amp;= \psi^{\mathcal{PT}}\left(x\right)  \\&#xA;&amp;amp;= \int dy\, \mathcal P\left(x, y\right)\mathcal T \psi\left(y\right) = \psi^*\left(-x\right) \\&#xA;\left\langle\psi|\chi\right\rangle^{\mathcal{PT}} &amp;amp;= \int dx\,\psi^{\mathcal{PT}}\left(x\right)\chi\left(x\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208076&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bender, Brody and Jones&lt;/a&gt;, in the unbroken regime, an operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt; (resembling the charge conjugation operator in QFT mentioned above) can be defined, as well as the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; inner product &lt;span class=&quot;math-container&quot;&gt;$\left\langle\psi|\chi\right\rangle^{\mathcal{CPT}}$&lt;/span&gt;: &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Eigenvectors of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; operator&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In the unbroken phase, the eigenvalues of the Hamiltonian are real. As the parity reversal operator has no effect on a number and the time reversal operator is complex conjugation, we have that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}E_n\phi_n = E_n\mathcal{PT}\phi_n$&lt;/span&gt; and so, the eigenstates of the Hamiltonian are simultaneously eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}$&lt;/span&gt; operator (it's assumed that the eigenvectors are non-degenerate for simplicity, although this breaks down at the exceptional point).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As shown by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0306040&quot; rel=&quot;nofollow noreferrer&quot;&gt;Weigert&lt;/a&gt;, we also have the completeness relation &lt;span class=&quot;math-container&quot;&gt;$\sum_n\left(-1\right)^n\phi_n\left(x\right)\phi_n\left(y\right) = \delta\left(x-y\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We also have that &lt;span class=&quot;math-container&quot;&gt;$\left(\mathcal{PT}\right)^2\phi_n\left(x\right) = \mathcal{PT}\phi^*_n\left(-x\right) = \phi_n\left(x\right)$&lt;/span&gt;, giving eigenvalues &lt;span class=&quot;math-container&quot;&gt;$e^{-i\omega_n}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mathcal Te^{-i\omega_n} = e^{i\omega_n}\mathcal T$&lt;/span&gt;. This eigenvalue is absorbed into the definition of the eigenvector so that &lt;span class=&quot;math-container&quot;&gt;$\phi_n\left(x\right)\rightarrow e^{-\frac{1}{2}i\omega_n}\phi_n\left(x\right)$&lt;/span&gt; and now &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}\phi_n\left(x\right) = \phi_n\left(x\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives that &lt;span class=&quot;math-container&quot;&gt;$\left\langle\phi_n|\phi_m\right\rangle^{\mathcal{PT}} = \int dx\,\phi_n\left(x\right)\phi_m\left(x\right)$&lt;/span&gt;. However, this is not necesarily positive, so we define an additional operator, &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt;, alongside the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; inner product, in order to satisfy the completeness relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\mathcal C\left(x, y\right) &amp;amp;= \sum_{n=0}^\infty \phi_n\left(x\right)\phi_n\left(y\right) \\ &#xA;\mathcal C\phi_n\left(x\right) &amp;amp;= \left(-1\right)^n\phi_n\left(x\right) \\&#xA;\psi^{\mathcal{CPT}}\left(x\right) &amp;amp;= \int dy\, \mathcal C\left(x, y\right)\psi^*\left(-y\right) \\&#xA;\left\langle\psi|\chi\right\rangle^{\mathcal{CPT}} &amp;amp;= \int dx\,\psi^{\mathcal{CPT}}\left(x\right)\chi\left(x\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computationally, discrete Hamiltonians/systems are more commonly used than continuous ones and helpfully, the above applies in the same/equivalent way to continuous systems (swapping continuous for discrete where applicable) as above.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The eigenvalues of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; operator&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Having defined parity and time reversal operators and a new operator that looks like charge conjugation in order to satisfy the completeness relation, we have the answer of what the eigenvalue of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; operator is already written down: &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{CPT}\phi_n\left(x\right) = \left(-1\right)^n\phi_n\left(x\right),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\phi_n$&lt;/span&gt; is an eigenstate of both the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; operator and some &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}$&lt;/span&gt;-symmetric Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what do these eigenvalues &lt;em&gt;mean&lt;/em&gt;?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;As per the &lt;a href=&quot;https://physics.stackexchange.com/a/390463/114272&quot;&gt;linked answer&lt;/a&gt;, it's analogous to the result in QFT where the eigenstates of the system are invariant under &lt;span class=&quot;math-container&quot;&gt;$\mathcal{CPT}$&lt;/span&gt; reversal&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Hamiltonian is in the &lt;em&gt;unbroken&lt;/em&gt; regime (that is, it has real eigenvalues)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As such, the eigenbasis is &lt;em&gt;complete&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the eigenvectors corresponding to the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenvalues have a &lt;em&gt;negative&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PT}$&lt;/span&gt; inner product&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which feels similar to the notions of positive and negative charge of e.g. positrons and electrons, only, it's not that&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Not much else, really&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2019-01-21T14:35:53.207" LastActivityDate="2019-01-21T14:35:53.207" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5240" PostTypeId="1" CreationDate="2019-01-21T11:29:15.550" Score="2" ViewCount="69" Body="&lt;p&gt;I know I must define &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;, the unitary operator, on the computational basis.  But what's my computational basis here?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2019-01-21T21:18:18.837" LastActivityDate="2019-01-21T21:18:18.837" Title="What's my computational basis if I want to define a unitary operator that implements a function such as $f(i) = 2^{i+1} \text{mod 21}$?" Tags="&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5241" PostTypeId="2" ParentId="5240" CreationDate="2019-01-21T12:58:08.640" Score="2" Body="&lt;p&gt;First, I would say you need to specify registers, their size, their role and what will they will contain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It depends on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; you want to apply this function, which is to be represented as a bitstring (in this case, I guess an unsigned integer representation) that will be one of the computational basis. It can be a particular one or just a superposition. You need to define the registers (the one containing &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, garbage register containing intermediary results and the one containing the result).&#xA;Mathematically, your operator will have the following effect if you uncompute intermediary results :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U_f  | i \rangle | 0 \rangle_g | 0 \rangle_f = | i \rangle | 0 \rangle_g | f(i) \rangle_f $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, to define this unitary, you need the sequence of unitary operations that will achieve your goal. It is recommended to not create a unitary operator by specifying the matrix.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2019-01-21T14:41:56.773" LastActivityDate="2019-01-21T14:41:56.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5242" PostTypeId="2" ParentId="5240" CreationDate="2019-01-21T14:26:40.660" Score="2" Body="&lt;p&gt;Presumably you want to work with qubits? So the usual computation basis applies: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; for a single qubit, and a composite basis of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; when composing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I guess you're asking is how you translate your problem onto qubits. For that, you need to make the decimal values correspond to particular bit values. The conventional way of doing this is using the binary string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; like a binary number, which corresponds to a decimal value. There are a number of different numbering conventions you can pick from but, for example, you might have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x=x_0x_1x_2\ldots x_{n-1},&#xA;$$&lt;/span&gt;&#xA;meaning that the corresponding decimal value is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x_{n-1}+2x_{n-2}+4x_{n-3}+\ldots+2^{n-2}x_1+2^{n-1}x_0.&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits lets you represent any decimal number 0 to &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-21T14:26:40.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5245" PostTypeId="1" CreationDate="2019-01-22T16:25:48.343" Score="4" ViewCount="120" Body="&lt;p&gt;In quantum information theory, classical-quantum channels are considered to be channels whose input is the realizations &lt;span class=&quot;math-container&quot;&gt;$x\in\mathcal{X}$&lt;/span&gt; of a classical random variable to a quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_x^B$&lt;/span&gt;, that is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$W:x\rightarrow\rho_x^B$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where each quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_x$&lt;/span&gt; is described by a positive semi-definite operator with unit trace. This kind of channels are useful due to the fact that they arise in the reality, such as an optic fiber communication link, and so codes taking into account the impact of quantum mechanics can be constructed to make the link perform better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if someone can give reference about more examples of real life communication scenarios where this kind of channels can be useful to describe them apart from the optical link example that is the most typical one.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2019-02-07T07:52:50.827" LastActivityDate="2019-02-07T07:52:50.827" Title="Real-life examples of classical-quantum channels" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;&lt;communication&gt;&lt;classical-quantum&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5246" PostTypeId="1" AcceptedAnswerId="5247" CreationDate="2019-01-22T22:53:54.743" Score="6" ViewCount="438" Body="&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Circuit_composition_and_entangled_states&quot; rel=&quot;noreferrer&quot;&gt;Circuit composition and entangled states section&lt;/a&gt; of Wikipedia's article on Quantum logic gates the final result of a combined Hadamard gate and identity gate on &lt;span class=&quot;math-container&quot;&gt;$|\Phi^{+}\rangle$&lt;/span&gt; state is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ M \frac{|00\rangle + |11\rangle}{\sqrt{2}} = \frac{1}{2} \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{bmatrix} \begin{bmatrix}1 \\ 0 \\ 0 \\ 1\end{bmatrix} = \frac{1}{2} \begin{bmatrix} 1 \\ 1 \\ 1 \\ -1 \end{bmatrix} = \frac{|00\rangle + |01\rangle + |10\rangle - |11\rangle}{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly does the &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 1 \\ 1 \\ -1 \end{bmatrix}$&lt;/span&gt; translate into &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle + |10\rangle - |11\rangle$&lt;/span&gt; states?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had no problems translating &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 \\ 0 \\ 0 \\ 0\end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}0 \\ 0 \\ 0 \\ 1\end{bmatrix}$&lt;/span&gt; but I'm not exactly sure how do you reverse the process in this example.&lt;/p&gt;&#xA;" OwnerUserId="5575" LastEditorUserId="55" LastEditDate="2020-06-04T15:03:59.513" LastActivityDate="2020-06-04T15:03:59.513" Title="How to translate matrix back into Dirac notation?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5247" PostTypeId="2" ParentId="5246" CreationDate="2019-01-22T23:27:15.277" Score="3" Body="&lt;p&gt;First read about the &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Standard_Representation&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard representation of qubit systems&lt;/a&gt; of and the basics of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/92/26&quot;&gt;bra-ket notation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I had no problems translating &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 &amp;amp; 0&#xA; &amp;amp; 0 &amp;amp; 0\end{bmatrix}^T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}0 &amp;amp; 0&#xA; &amp;amp; 0 &amp;amp; 1\end{bmatrix}^T$&lt;/span&gt; but I'm not exactly sure how do you reverse&#xA;   the process in this example.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Cool. Then you should also be able to understand that &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |11\rangle \equiv \begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\end{bmatrix}^T + \begin{bmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{bmatrix}^T = \begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{bmatrix}^T$&lt;/span&gt;. Yes? Read on.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How exactly does the &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -1 \end{bmatrix}^T$&lt;/span&gt;&#xA;  translate into &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle + |10\rangle - |11\rangle$&lt;/span&gt;&#xA;  states?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The standard basis states of a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit sytem &lt;span class=&quot;math-container&quot;&gt;$|00\rangle,|01\rangle,|10\rangle,|11\rangle$&lt;/span&gt; i.e. standard basis elements of &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2\times \Bbb C^2$&lt;/span&gt; can be mapped to the four &lt;span class=&quot;math-container&quot;&gt;$4\times 1$&lt;/span&gt; column vectors &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T, \begin{bmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T,\begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}^T \&amp;amp; \ \begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}^T.$$&lt;/span&gt; This is essentially an isomorphism from &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2\times \Bbb C^2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\Bbb R^4$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say that you already know the following mappings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T \to |00\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T \to |01\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}^T \to |10\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}^T \to |11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you simply need to expand the column vector &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -1 \end{bmatrix}^T$&lt;/span&gt; in terms of its basis elements, as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -1 \end{bmatrix}^T$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T + \begin{bmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T + \begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}^T + \begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \end{bmatrix}^T$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T + \begin{bmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{bmatrix}^T + \begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}^T - \begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{bmatrix}^T$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\implies \begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -1 \end{bmatrix}^T \equiv |00\rangle + |01\rangle + |10\rangle - |11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case you can't understand the last couple of steps, review &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_addition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix addition&lt;/a&gt;.  And you're done! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; stands for &lt;a href=&quot;https://en.wikipedia.org/wiki/Transpose&quot; rel=&quot;nofollow noreferrer&quot;&gt;transpose&lt;/a&gt;.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-23T00:07:02.823" LastActivityDate="2019-01-23T00:07:02.823" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5248" PostTypeId="2" ParentId="5246" CreationDate="2019-01-22T23:28:27.163" Score="3" Body="&lt;p&gt;This is using vector addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle = \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \\ 0 \\ 0 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by the rules of vector addition. Adding in the other two terms:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle + |10\rangle - |11\rangle = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} - \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 1 \\ 1 \\ -1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason you might want to write a state vector this way is to see how measurement of one qbit affects the other, for example (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4133/4153&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-01-22T23:28:27.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5249" PostTypeId="5" CreationDate="2019-01-23T11:11:02.430" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-23T11:11:02.430" LastActivityDate="2019-01-23T11:11:02.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5250" PostTypeId="4" CreationDate="2019-01-23T11:11:02.430" Score="0" Body="Semidefinite programming (SDP) is a subfield of convex optimization concerned with the optimization of a linear objective function (a user-specified function that the user wants to minimize or maximize) over the intersection of the cone of positive semidefinite matrices with an affine space, i.e., a spectrahedron. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-23T11:11:02.430" LastActivityDate="2019-01-23T11:11:02.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5251" PostTypeId="1" CreationDate="2019-01-23T11:58:33.063" Score="6" ViewCount="156" Body="&lt;p&gt;I'm having some trouble understanding &lt;strong&gt;quantum interactive proof systems&lt;/strong&gt; (QIP systems) and the related circuit constructions. &lt;a href=&quot;https://en.wikipedia.org/wiki/Interactive_proof_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;Interactive proof systems&lt;/a&gt; model these type of  situations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/31b1A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/31b1A.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Interactive proof systems:&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To say a promise problem &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt; has an interactive proof system&#xA;means there exists a verifier meeting two conditions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Completeness&lt;/strong&gt;: For every input &lt;span class=&quot;math-container&quot;&gt;$x\in \mathcal{A}_{\text{yes}}$&lt;/span&gt;, there must exist a prover strategy causing the verifier to accept with&#xA;high probability.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Soundness&lt;/strong&gt;: For every &lt;span class=&quot;math-container&quot;&gt;$x\in \mathcal{A}_{\text{no}}$&lt;/span&gt;, all prover strategies must cause the verifier to reject with high probability.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Classical protocol for graph non-isomorphism:&lt;/h2&gt;&#xA;&lt;p&gt;Now let's consider the classical proof system for the graph non-isomorphism problem.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Input:&lt;/strong&gt; Two simple undirected graphs &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Yes:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; are not isomorphic. (&lt;span class=&quot;math-container&quot;&gt;$G_0 \ncong G_1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;No:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; are isomorphic. (&lt;span class=&quot;math-container&quot;&gt;$G_0 \cong G_1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;There is a simple (classical) interactive proof system requiring just&#xA;one question and response:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The verifier randomly chooses a bit &lt;span class=&quot;math-container&quot;&gt;$b\in\{0,1\}$&lt;/span&gt; and a permutation &lt;span class=&quot;math-container&quot;&gt;$\sigma \in S_n$&lt;/span&gt;, and sends &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=\sigma(G_b)$&lt;/span&gt; to the prover.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Implicitly, the prover is being challenged to identify whether &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt;. If the prover guesses correctly, the verifier accepts&#xA;(or outputs &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), otherwise he rejects (or outputs &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Quantum interactive proof systems:&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The quantum interactive proof system works exactly the same as the&#xA;classical model except that the prover and verifier may exchange and&#xA;process quantum information. General assumptions and notions of&#xA;completeness and soundness are unchanged. The model may be formalized&#xA;in terms of quantum circuits. An illustration of an interaction:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/npaaE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/npaaE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(There are 6 messages in this example.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Quantum protocol for graph non-isomorphism?&lt;/h2&gt;&#xA;&lt;p&gt;The previous section on &lt;strong&gt;quantum interactive proof systems&lt;/strong&gt; appears rather vague to me. I'm not sure how we can map a classical interactive proof system protocol to an equivalent quantum protocol or construct a quantum circuit for it (as shown in the above example).&lt;/p&gt;&#xA;&lt;p&gt;For simplicity, let's just take the graph non-isomorphism problem. What would be a quantum circuit i.e. a &lt;strong&gt;quantum interactive proof system&lt;/strong&gt; for the &lt;strong&gt;graph non-isomorphism problem&lt;/strong&gt;? How to construct such a quantum circuit, given that we know the corresponding classical proof system protocol?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; All quotes are from &lt;a href=&quot;https://youtu.be/D1cZbRvBMqY?t=1530&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Watrous - Quantum Complexity Theory (Part 2) - CSSQI 2012&lt;/a&gt; (timestamp included).&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="2927" LastEditDate="2021-02-11T00:12:11.190" LastActivityDate="2021-02-11T00:12:11.190" Title="How to construct a quantum circuit (QIP system) for the graph non-isomorphism problem?" Tags="&lt;circuit-construction&gt;&lt;complexity-theory&gt;&lt;graph-isomorphism&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5252" PostTypeId="1" AcceptedAnswerId="5257" CreationDate="2019-01-23T12:24:28.613" Score="5" ViewCount="182" Body="&lt;h2&gt;Group non-membership problem:&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Input:&lt;/strong&gt; Group elements &lt;span class=&quot;math-container&quot;&gt;$g_1,..., g_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Yes:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$h \not\in \langle g_1, ..., g_k\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;No:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$h\in \langle g_1, ..., g_k\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Notation:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle g_1, ..., g_k\rangle$&lt;/span&gt; is the subgroup generated by &lt;span class=&quot;math-container&quot;&gt;$g_1,...,g_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Quantum proof:&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The group non-membership problem is in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt;. The idea is&#xA;simple: for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \langle g_1, ..., g_k\rangle$&lt;/span&gt;, the quantum&#xA;proof that &lt;span class=&quot;math-container&quot;&gt;$h\in \mathcal{H}$&lt;/span&gt; will be the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\mathcal H\rangle = \frac{1}{\sqrt{|\mathcal H|}}\sum_{a\in&#xA; \mathcal{H}} |a\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2&gt;Questions:&lt;/h2&gt;&#xA;&lt;p&gt;I think the idea of the proof is that if &lt;span class=&quot;math-container&quot;&gt;$|h\rangle$&lt;/span&gt; can be shown to be &lt;em&gt;orthogonal&lt;/em&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\mathcal H\rangle$&lt;/span&gt; then it would imply that that &lt;span class=&quot;math-container&quot;&gt;$h \not\in \mathcal{H}$&lt;/span&gt;. Otherwise, &lt;span class=&quot;math-container&quot;&gt;$h\in \mathcal{H}$&lt;/span&gt;. But how exactly are we supposed to &lt;em&gt;assign&lt;/em&gt; quantum states (i.e. the &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt;'s) corresponding to the elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;? Do we need to assign separate binary strings to all the elements of the group generated by the elements of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, such that they can be represented by qubit systems?&lt;/p&gt;&#xA;&lt;p&gt;And if we &lt;em&gt;do&lt;/em&gt; assign such binary strings a priori, wouldn't it be much simpler to directly (classically) check whether the string assigned to &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; matches with any of the strings corresponding to the elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;? I can't really see the &lt;em&gt;speed advantage&lt;/em&gt; here. Could someone clarify this &amp;quot;quantum&amp;quot; proof?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; All quotes are from &lt;a href=&quot;https://youtu.be/D1cZbRvBMqY?t=810&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Watrous - Quantum Complexity Theory (Part 2) - CSSQI 2012&lt;/a&gt; (timestamp included).&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-21T21:50:22.057" Title="Quantum proof for the group non-membership problem" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5253" PostTypeId="1" CreationDate="2019-01-23T18:29:43.880" Score="2" ViewCount="515" Body="&lt;p&gt;I am currently working on the Grover algorithm and have a few questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the third step of the algorithm, a phase shift is performed on all states, except &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. My question is, why is the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; omitted here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then I would like to know how to show that the unitary operator corresponding to the phase shift in the Grover iteration is &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle0|-I$&lt;/span&gt;.&#xA;I do not know how to show it exactly but my idea was: Lets say in this example:&#xA;&lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle0|-I=\begin{pmatrix}1&amp;amp;0\\0&amp;amp;-1\end{pmatrix}$&lt;/span&gt;&#xA;For example, if I apply the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states now, then this results in:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1&amp;amp;0\\0&amp;amp;-1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}1\\0\end{pmatrix}$&lt;/span&gt;&#xA;And for the other state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1&amp;amp;0\\0&amp;amp;-1\end{pmatrix}\begin{pmatrix}0\\1\end{pmatrix}=\begin{pmatrix}0\\-1\end{pmatrix}$&lt;/span&gt;&#xA;This means that on the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; the operator does not cause a phase shift, but already on the last one &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. But is that enough to show that&#xA;the unitary operator corresponding to the phase shift in the Grover iteration is &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle0|-I$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that my question is understandable. Thanks for coming answers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: If anyone still has good sources regarding the Grover algorithm, &#xA;I would be very happy if they could send me a link to good documentation, just to dig deeper into the subject matter.&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="55" LastEditDate="2020-08-09T05:51:30.123" LastActivityDate="2020-08-09T05:51:30.123" Title="In Grover's algorithm, why is the unitary corresponding to the phase shift $2\lvert0\rangle\langle0\rvert-I$?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5254" PostTypeId="1" AcceptedAnswerId="5258" CreationDate="2019-01-23T19:57:01.817" Score="4" ViewCount="1064" Body="&lt;p&gt;I am an undergraduate in Engineering physics, yet to take classes on Quantum mechanics, but none (if I'm not mistaken) on quantum information and quantum algorithms, and I am curious about the subject so I've began reading some things to get the basics on quantum computing (I've been reading &lt;em&gt;Quantum Computing since Democritus&lt;/em&gt; by Scott Anderson) so as to move afterwards to Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for Qiskit learning, I am a bit lost, as it is such a new concept, there are little to none tutorials available online, I only found a collection of &lt;em&gt;Jupyter Notebooks&lt;/em&gt; on GitHub (&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials&lt;/a&gt;) that, however helpful, are overwelming and seem directed to someone that already needs to learn Qiskit and has a project that needs it. My goal to learn it is to be ready for when I need it, to just add a tool in my toolbox. But to do so I need some advice for I am stuck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I would like to ask if anyone knows any online course with verified certificate's related to the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank's in advance.&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="26" LastEditDate="2019-01-23T20:37:34.060" LastActivityDate="2019-01-24T08:22:09.740" Title="Path to learn Qiskit as a tool for the future" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5255" PostTypeId="2" ParentId="5253" CreationDate="2019-01-23T20:15:24.657" Score="4" Body="&lt;p&gt;The third step applies a phase shift to all states except &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; so that steps 2-4 taken together would perform inversion about mean. This is not the only possible choice for these steps; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4397/why-does-grovers-search-invert-about-the-mean&quot;&gt;this question&lt;/a&gt; has an excellent answer detailing the logic behind this choice and several alternatives.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the second part of the question, both operators are defined on all basis states, albeit in a different manner. You can just check that the effect of both definitions on all basis states is the same; this would mean that the operators are the same.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-23T20:15:24.657" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5256" PostTypeId="2" ParentId="5253" CreationDate="2019-01-24T03:07:09.727" Score="2" Body="&lt;p&gt;The reason behind the choice of &lt;span class=&quot;math-container&quot;&gt;$\lvert 0^{\otimes n}\rangle$&lt;/span&gt; as reference state, found in many basic treatments of Grover's algorithm, is best understood by considering the technique that generalizes it: the so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum amplitude amplification&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of amplitude amplification is a very generic one: given some initial state &#xA;&lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{in}\rangle$&lt;/span&gt;, we want to transform it into a state that belongs to a given target subspace &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_{target}$&lt;/span&gt;.&#xA;The initial state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{in}\rangle$&lt;/span&gt; is assumed to be known, but &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_{target}$&lt;/span&gt; needs not be (and can indeed be seen as the &lt;em&gt;goal&lt;/em&gt; of the algorithm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is consistent with what you have in the special case of Grover's algorithm with &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{in}\rangle=\lvert+,\cdots,+\rangle=H^{\otimes n}\lvert 0,\cdots, 0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_{target}=\mathbb C\lvert \psi_{target}\rangle$&lt;/span&gt; one-dimensional and encoding the state that we are trying to find, and given only indirectly via oracular access to a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$x=\lvert\psi_{target}\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$f(x)=0$&lt;/span&gt; otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the general amplitude amplification scheme, the way we get from the initial to the target space is via repeated application of a pair of two reflections, &lt;span class=&quot;math-container&quot;&gt;$-S_t S_i$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_i\equiv 2\lvert \psi_{in}\rangle\!\langle \psi_{in}\rvert-I, \\&#xA;S_t\equiv 2\lvert \psi_{t}\rangle\!\langle \psi_{t}\rvert-I,$$&lt;/span&gt;&#xA;and we used the notation &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_t\rangle\simeq\sum_{x\in\mathcal H_{target}}\lvert x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it turns out, the product of two reflections amounts to a rotation in state space:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}&#xA;R\equiv-S_t S_i=-4\ketbra{\psi_{in}}\psi_{t}\rangle\!\langle \psi_t\rvert&#xA;+2(\ketbra{\psi_{in}}+\ketbra{\psi_t})-I,$$&lt;/span&gt;&#xA;which brings the initial state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{in}\rangle$&lt;/span&gt; closer to the target, as long as the initial overlap is not too big to begin with:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R\lvert\psi_{in}\rangle=(1-4\lvert\langle\psi_{in}\rvert\psi_{t}\rangle\rvert^2 )\lvert\psi_{in}\rangle+2\langle\psi_t\rvert\psi_{in}\rangle\lvert\psi_t\rangle,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle\psi_{in}\rvert R\lvert\psi_{in}\rangle=1-2\lvert\langle\psi_{in}\rvert\psi_{t}\rangle\rvert^2.$$&lt;/span&gt;&#xA;You can then verify how repeated applications of &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; get you closer and closer to the target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows how there is nothing special about the choice of &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; often used: what is needed is a pair of reflections, one with respect to the initial state and the other with respect to the projector over the target state/space.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why does the operator corresponding to the phase shift in Grover's algorithm correspond to &lt;span class=&quot;math-container&quot;&gt;$2\ketbra0-I$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; be any state, and define &lt;span class=&quot;math-container&quot;&gt;$S\equiv 2\ketbra\psi-I$&lt;/span&gt;. Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S\lvert\psi\rangle=2\lvert\psi\rangle-\lvert\psi\rangle=\lvert\psi\rangle,$$&lt;/span&gt;&#xA;while for any &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\langle\phi\rvert\psi\rangle=0$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S\lvert\phi\rangle=-\lvert\phi\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-01-24T03:07:09.727" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5257" PostTypeId="2" ParentId="5252" CreationDate="2019-01-24T04:07:36.620" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I think the idea of the proof is that if &lt;span class=&quot;math-container&quot;&gt;$|h\rangle$&lt;/span&gt; can be shown to be &lt;em&gt;orthogonal&lt;/em&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\mathcal H\rangle$&lt;/span&gt; then it would imply that that &lt;span class=&quot;math-container&quot;&gt;$h \not\in \mathcal{H}$&lt;/span&gt;. Otherwise, &lt;span class=&quot;math-container&quot;&gt;$h\in \mathcal{H}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not really as far as the method shown in the linked video is concerned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm described there uses a controlled-unitary operation of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}&#xA;\mathcal U_h\equiv\ketbra0\otimes I+\ketbra1\otimes \mathcal M_h,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal M_h$&lt;/span&gt; is the unitary that acts on each state &lt;span class=&quot;math-container&quot;&gt;$\lvert g\rangle$&lt;/span&gt; representing the group element &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; by sending this state into the state that represents the group element &lt;span class=&quot;math-container&quot;&gt;$hg$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal M_h\lvert g\rangle=\lvert hg\rangle.$$&lt;/span&gt;&#xA;Then, you can readily verify that &lt;span class=&quot;math-container&quot;&gt;$\mathcal M_h\lvert \mathcal H\rangle=\lvert \mathcal H\rangle$&lt;/span&gt; (because &lt;span class=&quot;math-container&quot;&gt;$h\mathcal H=\mathcal H$&lt;/span&gt;), which I would call the &quot;main idea&quot; here. We are exploiting the fact that, given an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$h\in G$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$h\in\langle g_1,...,g_n\rangle=\mathcal H\Longleftrightarrow \mathcal M_h\lvert \mathcal H\rangle=\lvert \mathcal H\rangle,\\&#xA;h\notin\mathcal H\Longleftrightarrow \mathcal M_h\lvert \mathcal H\rangle\perp \lvert \mathcal H\rangle,&#xA;$$&lt;/span&gt;&#xA;the latter fact following from the general result of group theory that &lt;span class=&quot;math-container&quot;&gt;$xH\cap H=\{\}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x\notin H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a subgroup of a group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having &lt;span class=&quot;math-container&quot;&gt;$\mathcal M_h$&lt;/span&gt; as controlled by an additional qubit can then be thought of as just a gimmick to have the first qubit tell us deterministically which one of the two cases are we dealing with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case &lt;span class=&quot;math-container&quot;&gt;$h\in\mathcal H$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert +\rangle\lvert\mathcal H\rangle\xrightarrow[]{\mathcal U_h}\lvert+\rangle\lvert\mathcal H\rangle&#xA;\xrightarrow[]{H_1}\lvert0\rangle\lvert\mathcal H\rangle,$$&lt;/span&gt;&#xA;while in the case &lt;span class=&quot;math-container&quot;&gt;$h\notin\mathcal H$&lt;/span&gt;, we get (ignoring normalization constants)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert +\rangle\lvert\mathcal H\rangle\xrightarrow[]{\mathcal U_h}\lvert0\rangle\lvert\mathcal H\rangle+\lvert1\rangle\lvert hH\rangle\xrightarrow[]{H_1}&#xA;\lvert0\rangle\otimes(\lvert\mathcal H\rangle+\lvert h\mathcal H\rangle) +&#xA;\lvert1\rangle\otimes(\lvert\mathcal H\rangle-\lvert h\mathcal H\rangle).&#xA;$$&lt;/span&gt;&#xA;Now, it doesn't really matter what the exact states in the second register are in the last bit. What matters is that we have something of the form &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle\lvert a\rangle+\lvert 1\rangle\lvert b\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\langle a\rvert b\rangle=0$&lt;/span&gt;.&#xA;For any state like this, measuring the first qubit gives you equal probabilities of finding &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt;.&#xA;You then just need to repeat the experiment a few times to assess with good probability whether the measurement results on the first qubit are always equal or uniformly distributed.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But how exactly are we supposed to &lt;em&gt;assign&lt;/em&gt; quantum states (i.e. the &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt;'s) corresponding to the elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;? Do we need to assign separate binary strings to all the elements of the group generated by the elements of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, such that they can be represented by qubit systems?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a possible way, but really it doesn't matter how you do the encoding for the sake of the algorithm. The only thing that matters is that different group elements must be assigned orthogonal states.&#xA;After this, you can decide to assign binary strings to each group element and then convert these to qubits, or just use appropriate high-dimensional qudits, or whatever else might be more convenient in the specific use-case.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;And if we &lt;em&gt;do&lt;/em&gt; assign such binary strings a priori, wouldn't it be much simpler to directly (classically) check whether the string assigned to &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; matches with any of the strings corresponding to the elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;? I can't really see the &lt;em&gt;speed advantage&lt;/em&gt; here. Could someone clarify this &quot;quantum&quot; proof?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Indeed, if you &lt;em&gt;do&lt;/em&gt; know the classical representation of &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; in the encoding of your choice, then you already essentially have the solution to the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this might not be the case. You might only have access to the unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_h$&lt;/span&gt;. You might have &lt;span class=&quot;math-container&quot;&gt;$\lvert h\rangle$&lt;/span&gt; as input (the quantum state, not the classical description of the corresponding group element), and use the state to implement &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_h$&lt;/span&gt;, and thus using this protocol to figure out whether &lt;span class=&quot;math-container&quot;&gt;$h\in \mathcal H$&lt;/span&gt;, &lt;em&gt;without even knowing what &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; actually is&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-01-24T04:07:36.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5258" PostTypeId="2" ParentId="5254" CreationDate="2019-01-24T08:22:09.740" Score="4" Body="&lt;p&gt;For a certificate, check out these &lt;a href=&quot;https://quantumcurriculum.mit.edu/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT courses&lt;/a&gt; that you can participate in online. They are done in collaboration with IBM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IBM also recently gave awards for university level courses that use Qiskit. You can find all the best submissions &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/tree/awards/community/awards/teach_me_quantum_2018&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. These are also courses you can follow along at home (though there won't be a certificate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the Jupyter notebook tutorials, I'd suggest starting with &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/awards/community/games/Hello_Qiskit.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; which is an interactive guide to basic quantum operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For advice for when you are stuck, I'd suggest the quantum computing stack exchange. I'm sure I don't need to provide a link for that ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclosure: I work for IBM.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-01-24T08:22:09.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5259" PostTypeId="1" AcceptedAnswerId="5265" CreationDate="2019-01-24T11:40:42.563" Score="4" ViewCount="278" Body="&lt;p&gt;Apparently, the decomposition of a state into an ensemble of pure states is not unique. I can't understand why, as if I understood correctly a &quot;pure state ensemble decomposition&quot; is just the diagonalization of the density operator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\sum_{k=0}^rp_k|\psi_k\rangle\langle\psi_k| $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the rank of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt; are its eigenvectors with associated eigenvalues &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a diagonalization is unique up to permutations of the &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt;, i.e. there exists a unique basis where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is diagonal. How can the pure ensemble decomposition not be unique? What have I misunderstood?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="26" LastEditDate="2019-01-24T11:47:35.733" LastActivityDate="2019-01-25T07:45:57.150" Title="Non-uniqueness of pure states ensemble decomposition" Tags="&lt;quantum-information&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5260" PostTypeId="2" ParentId="5259" CreationDate="2019-01-24T12:13:18.273" Score="2" Body="&lt;p&gt;For any matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, there are (typically) many different choices of &lt;span class=&quot;math-container&quot;&gt;$\{p_i\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_ip_i|\psi_i\rangle\langle\psi_i|.&#xA;$$&lt;/span&gt;&#xA;The simplest way to do it, with the fewest number of terms, is always the eigenvalue decomposition, but there are other ways as well. You do not have to use the eigenvector decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We should start by noting that not even the eigenvector decomposition is unique if you have repeated eigenvalues. For example, the maximally mixed state can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\frac{1}{d}\mathbb{I}=\frac{1}{d}\sum_{i=1}^d|u_i\rangle\langle u_i|&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{|u_i\rangle\}$&lt;/span&gt; is &lt;em&gt;any&lt;/em&gt; orthonormal basis of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can use this to show how there can be many different ways of decomposing something even if there aren't repeated eigenvalues. Take a one-qubit state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=p_0|v_0\rangle\langle v_0|+(1-p_0)|v_1\rangle\langle v_1|$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_0&amp;gt;\frac12$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle v_0|v_1\rangle=0$&lt;/span&gt;. We could write this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left((p_0-q)|v_0\rangle\langle v_0|+(1-p_0-q)|v_1\rangle\langle v_1|\right)+q\mathbb{I}&#xA;$$&lt;/span&gt;&#xA;for any &lt;span class=&quot;math-container&quot;&gt;$q\leq 1-p_0$&lt;/span&gt;, and we can decompose &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; in terms of any one (or more) orthonormal bases that we want to. You have a larger ensemble, but it still describes the same &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. As an example, look at&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\left(\begin{array}{cc} \frac45 &amp;amp; 0 \\ 0 &amp;amp; \frac15 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;I'm going to rewrite this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\left(\begin{array}{cc} \frac35 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{array}\right)+\left(\begin{array}{cc} \frac15 &amp;amp; 0 \\ 0 &amp;amp; \frac15 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;You can easily check that this is the same as, for example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\frac35|0\rangle\langle 0|+\frac{1}{5}(|+\rangle\langle +|+|-\rangle\langle -|).&#xA;$$&lt;/span&gt;&#xA;This means that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, as well as being described by the ensemble &lt;span class=&quot;math-container&quot;&gt;$\{(\frac45,|0\rangle),(\frac15,|1\rangle)\}$&lt;/span&gt;, we can also use the ensemble &lt;span class=&quot;math-container&quot;&gt;$\{(\frac35,|0\rangle),(\frac15,|+\rangle),(\frac15,|-\rangle)\}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-01-25T07:45:57.150" LastActivityDate="2019-01-25T07:45:57.150" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5261" PostTypeId="1" AcceptedAnswerId="5267" CreationDate="2019-01-24T12:22:28.243" Score="6" ViewCount="874" Body="&lt;p&gt;I am having problems with this task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the Hadamard gate rotates a state &lt;span class=&quot;math-container&quot;&gt;$180°$&lt;/span&gt; about the &lt;span class=&quot;math-container&quot;&gt;$\hat{n} = \frac{\hat{x} + \hat{z}}{\sqrt{2}}$&lt;/span&gt; axis, I imagine the solution can be found the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First rotate &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; so it lies in the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; plane:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_z(\pi/2)$$&lt;/span&gt;&#xA;Then rotate &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; so it is parallell with the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_x(\pi/4)$$&lt;/span&gt;&#xA;Now do the desired rotation about the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_z(\pi)$$&lt;/span&gt;&#xA;Then rotate &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; back to its original position.&#xA;The Hadamard gate can then be written:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H = e^{i\lambda}R_z(-\pi/2)R_x(-\pi/4) R_z(\pi) R_x(\pi/4) R_z(\pi/2) $$&lt;/span&gt;&#xA;However, this doesn't seem to work. Can someone explain where my logic is flawed? Thank you very much&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="26" LastEditDate="2019-03-29T19:39:48.897" LastActivityDate="2019-03-29T19:39:48.897" Title="Hadamard gate as a product of $R_x$, $R_z$ and a phase" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5262" PostTypeId="2" ParentId="5261" CreationDate="2019-01-24T12:55:53.893" Score="2" Body="&lt;p&gt;Check exercise 4.4 of &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;rct=j&amp;amp;url=http://people.math.gatech.edu/~jeanbel/4782/Year09/problem207.pdf&amp;amp;ved=2ahUKEwi_wsanuYbgAhULhuAKHfeTDN4QFjAGegQICRAB&amp;amp;usg=AOvVaw1-oAkWqk882BVVuqJcBYys&amp;amp;cshid=1548334205310&quot; rel=&quot;nofollow noreferrer&quot;&gt;this PDF&lt;/a&gt;. It should explain your concern.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you are right but maybe when doing your calculations, you are not dividing by 2 the angles in the rotation matrix definition.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2019-01-25T10:43:19.320" LastActivityDate="2019-01-25T10:43:19.320" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5263" PostTypeId="1" CreationDate="2019-01-24T13:54:47.703" Score="2" ViewCount="174" Body="&lt;p&gt;Both the words 'Quantum Key Distribution' and 'Quantum Key Exchange' are used in quantum cryptography in the problem of a secure key distribution for encryption/decryption between parties. There are popular algorithms like the BB84, B94 and E91 protocols for the above-stated task. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However what I want to know is that is there a difference between the two terms 'Quantum Key Distribution (QKD)' and 'Quantum Key Exchange (QKE)' or both represent the same concept?&lt;/p&gt;&#xA;" OwnerUserId="4594" LastEditorUserId="26" LastEditDate="2019-05-08T10:22:12.763" LastActivityDate="2020-06-16T06:04:20.473" Title="What is the difference between quantum key distribution and quantum key exchange?" Tags="&lt;cryptography&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5264" PostTypeId="2" ParentId="5252" CreationDate="2019-01-24T16:26:57.163" Score="4" Body="&lt;p&gt;This result concerns the black-box group model, which is a fairly standard model in computational group theory. It is intended to represent &lt;em&gt;minimal assumptions&lt;/em&gt; on the groups we're working with. In the black box group model we assume that each group element has a (unique) string representation of a fixed length, and a black-box performs the group operations for us.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The literal answer to the question of how we assign binary strings to the group elements is therefore that we don't: this is assumed to have already been done. Note that if the length of the binary string representations of the group elements is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, then there could be exponentially many (in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) different group elements, which is why the simpler classical check is unsatisfactory. The verification procedure here, assuming we're given a quantum proof as described, requires time polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To motivate this model, let's consider the specific example of matrix groups. In particular, let us suppose that every group element we're working with is an &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrix with entries in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_p$&lt;/span&gt; (integers modulo &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;) for some large prime number &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, such that the matrix is invertible modulo &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. In other words, our group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is the general linear group &lt;span class=&quot;math-container&quot;&gt;$\text{GL}(N,p)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can easily represent elements of &lt;span class=&quot;math-container&quot;&gt;$\text{GL}(N,p)$&lt;/span&gt; as binary strings of length &lt;span class=&quot;math-container&quot;&gt;$n = N^2 \lceil \log(p)\rceil$&lt;/span&gt; by simply encoding each element of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_p$&lt;/span&gt; using binary notation and then concatenating the encodings of the entries together. Knowing this assignment of strings to group elements by itself does not, however, solve the problem: if you had group elements (i.e., matrices) &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g_1,\ldots,g_k$&lt;/span&gt;, and wanted to be convinced that &lt;span class=&quot;math-container&quot;&gt;$h\not\in\langle g_1,\ldots,g_k\rangle$&lt;/span&gt;, you would still have a lot of work to do, and it would be a very difficult computational task in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, because we can efficiently perform the group operations (multiplication and inversion) on these string encodings, we can easily adapt any method based on the black-box group model by replacing the group oracle with circuits that efficiently perform these group operations. Thus, for this example of &lt;span class=&quot;math-container&quot;&gt;$\text{GL}(N,p)$&lt;/span&gt; , there exist quantum proofs that will convince an efficient (i.e., polynomial-time) verifier that &lt;span class=&quot;math-container&quot;&gt;$h\not\in\langle g_1,\ldots,g_k\rangle$&lt;/span&gt; when this statement is true and not when it is false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The appeal of the black-box group model is that this is reasoning extends to many other concrete ways of representing group elements and performing operations. There is, of course, nothing specific about &lt;span class=&quot;math-container&quot;&gt;$\text{GL}(N,p)$&lt;/span&gt; or any other group to the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the idea of the method, gIS has already answered this part very well (so let me suggest that you accept that answer if you find it to be helpful).&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2019-01-24T16:26:57.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5265" PostTypeId="2" ParentId="5259" CreationDate="2019-01-24T19:00:26.873" Score="4" Body="&lt;p&gt;Suppose that we're talking about &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; density operators, so that the rank will never exceed &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Now suppose that you choose &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to be much larger than &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and then &lt;em&gt;arbitrarily&lt;/em&gt; pick a probability vector &lt;span class=&quot;math-container&quot;&gt;$(p_1,\ldots,p_N)$&lt;/span&gt; and pure states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle,\ldots,|\psi_N\rangle$&lt;/span&gt;. Assuming that more than &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of the entries in the probability vector are nonzero, and the vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle,\ldots,|\psi_N\rangle$&lt;/span&gt; represent distinct states, the decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_{k=1}^N p_k |\psi_k\rangle \langle \psi_k |&#xA;$$&lt;/span&gt;&#xA;for the operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; you have selected through this process will surely be different from the spectral decomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for a &lt;em&gt;given&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, it will always be possible to do something along these lines. If the rank of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is 1, it will be trivial (meaning that every &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle \langle \psi_k |$&lt;/span&gt; will have to be equal to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, assuming &lt;span class=&quot;math-container&quot;&gt;$p_k &amp;gt;0$&lt;/span&gt;), but as long as the rank of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is at least 2, there will be a continuum of different inequivalent ways to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, for any choice of &lt;span class=&quot;math-container&quot;&gt;$\varepsilon &amp;gt; 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; for which&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho - \varepsilon |\psi\rangle \langle \psi|&#xA;$$&lt;/span&gt;&#xA;is positive semidefinite, you could write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \varepsilon |\psi\rangle \langle \psi| + (1-\varepsilon) \sigma&#xA;$$&lt;/span&gt;&#xA;for&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma = \frac{\rho - \varepsilon |\psi\rangle \langle \psi|}{1-\varepsilon}&#xA;$$&lt;/span&gt;&#xA;and then recurse on &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. For &lt;em&gt;any&lt;/em&gt; choice of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the image of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, not just eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, this will be possible so long as &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is small enough. And, as long you take &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; small enough each time, you could recurse as long as you like, and in general you will get different decompositions of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2019-01-24T19:07:49.393" LastActivityDate="2019-01-24T19:07:49.393" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5266" PostTypeId="2" ParentId="5261" CreationDate="2019-01-25T07:55:11.190" Score="2" Body="&lt;p&gt;As far as I can tell, it works fine. If I use the channel-state duality to view this sequence of operation's effect in Quirk's output display, it's the Hadamard gate's matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3rVIr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3rVIr.png&quot; alt=&quot;It&amp;#39;s a Hadamard&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe you're multiplying or dividing by 2 somewhere you shouldn't be, when performing the operations?&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-01-25T07:55:11.190" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5267" PostTypeId="2" ParentId="5261" CreationDate="2019-01-25T08:14:26.780" Score="3" Body="&lt;p&gt;Why do you say that it doesn't work? If I enter the following code into Mathematica, it works fine:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X = {{0, 1}, {1, 0}};&#xA;Z = {{1, 0}, {0, -1}};&#xA;FullSimplify[-I MatrixExp[-I Pi Z/4].MatrixExp[-I Pi X/8].MatrixExp[I Pi Z/2].MatrixExp[I Pi X/8].MatrixExp[I Pi Z/4]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The only thing that I had to remember was to halve the angles compared to how you wrote them (because &lt;span class=&quot;math-container&quot;&gt;$R_Z(\pi)$&lt;/span&gt; should give a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotation, which is &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi Z/2}$&lt;/span&gt;). That's the place that I always make the mistake with these calculations...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-25T08:14:26.780" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5269" PostTypeId="1" AcceptedAnswerId="5300" CreationDate="2019-01-25T14:11:32.867" Score="4" ViewCount="670" Body="&lt;p&gt;I am just starting to get around Qiskit, I'm going at baby steps, so I tried to run the code below and I noticed three things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I tried using &lt;code&gt;matplotlib_circuit_drawer()&lt;/code&gt; instead of &lt;code&gt;circuit_drawer()&lt;/code&gt;, but is return a DeprecationWarning and sugested using &lt;code&gt;circuit_drawer&lt;/code&gt;. I assume this is due to the constant updates and the functions are going to change frequently;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the &lt;code&gt;qc.measure(q, c)&lt;/code&gt; I get a highlight in PyCharm saying &lt;em&gt;Unresolved attribute reference 'measure' for class 'QuantumCircuit'&lt;/em&gt;, and I don't know what that really means;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I think this is also related to 1). When using &lt;code&gt;draw(qc)&lt;/code&gt; I get the warning &lt;code&gt;DeprecationWarning: The current behavior for the default output will change in a future release. Instead of trying latex and falling back to mpl on failure it will just use &quot;text&quot; by default&#xA;'&quot;text&quot; by default', DeprecationWarning)&lt;/code&gt; and no image pops up. However when I use &lt;code&gt;print(qc)&lt;/code&gt; the circuit pops up in text format;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How can I be up to date about the commands?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit&#xA;from qiskit.tools.visualization import circuit_drawer as draw&#xA;&#xA;c = ClassicalRegister(2)&#xA;q = QuantumRegister(2)&#xA;qc=QuantumCircuit(q, c)&#xA;&#xA;qc.measure(q, c)&#xA;draw(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="26" LastEditDate="2019-01-25T14:14:12.903" LastActivityDate="2019-01-29T02:48:36.423" Title="Deprecation warnings in Qiskit (circuit drawing)" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5273" PostTypeId="1" AcceptedAnswerId="5277" CreationDate="2019-01-26T07:57:38.877" Score="5" ViewCount="5011" Body="&lt;p&gt;I'm new to this field of science. I'm curious about how quantum computing can win 97% of times in a coin flipping experiment?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Refer this link: &lt;a href=&quot;https://www.ted.com/talks/shohini_ghose_quantum_computing_explained_in_10_minutes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ted Talk by Shohini Ghose&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give an idea about how this coin experiment works:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantum Computer plays a move but it is not revealed to the Opponent[Human].  &lt;/li&gt;&#xA;&lt;li&gt;Opponent[Human] plays a move and it is also not revealed to the Quantum Computer.&lt;/li&gt;&#xA;&lt;li&gt;Finally Quantum Computer plays a move.&lt;/li&gt;&#xA;&lt;li&gt;Results are shown. If its &lt;code&gt;heads&lt;/code&gt;, then Quantum Computer wins. Else, Opponent[Human] wins.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here, playing a move refers to &lt;code&gt;&quot;Flipping the coin&quot;&lt;/code&gt;. The video talks of superposition and how it can recover &lt;code&gt;heads&lt;/code&gt; every time in the final move. This made me think about 2 possibilities:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantum computer is tracking something low level in hardware. So, it knows every time, what did the opponent played.&lt;/li&gt;&#xA;&lt;li&gt;Superposition and the third state is just a way, to not consider Opponent's Move (i.e. Ignoring Opponent's move). So, it is actually all the moves of Quantum Computer. So, it knows how to win. If this is the case, then actually there is no randomness or uncertainty added in the game by Opponent.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Just same as how the magician does the coin flipping trick. He practices and controls the flipping power of his thumb, so he knows every time he flips the coin, whether its going to be heads or tails.&lt;/p&gt;&#xA;" OwnerUserId="5643" LastEditorUserId="55" LastEditDate="2021-02-14T18:56:25.587" LastActivityDate="2021-02-14T18:56:25.587" Title="How can quantum computing win 97% of times in coin flipping experiment?" Tags="&lt;games&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5275" PostTypeId="1" AcceptedAnswerId="5276" CreationDate="2019-01-26T23:10:03.580" Score="1" ViewCount="606" Body="&lt;p&gt;I have been told that one of the great &lt;em&gt;keys&lt;/em&gt; that unlock quantum computing's potential is the reversibility of quantum logic gates as for classical gates there's some loss of information, but I cannot grasp this concept. Mathematically I see why the quantum logic gate is reversible, it is a mere unitary operator but on the classical one I don't see where the information is lost, could someone clarify it?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="26" LastEditDate="2019-01-27T08:02:41.563" LastActivityDate="2019-01-27T08:02:41.563" Title="Reversibility and irreversibility of logic gates (quantum vs classical)" Tags="&lt;quantum-gate&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5276" PostTypeId="2" ParentId="5275" CreationDate="2019-01-26T23:40:47.300" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Mathematically I see why the quantum logic gate is reversible, it is a&#xA;  mere unitary operator but on the classical one I don't see where the&#xA;  information is lost, could someone clarify it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For illustration, let's take the classical &lt;a href=&quot;https://en.wikipedia.org/wiki/XOR_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;XOR&lt;/code&gt; gate&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wYaTM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wYaTM.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say you know that the output or end result of a certain &lt;code&gt;XOR&lt;/code&gt; operation is &lt;code&gt;1&lt;/code&gt;. Now what could have been the possible values for &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;B&lt;/code&gt;? Either &lt;code&gt;A = 0&lt;/code&gt; &amp;amp; &lt;code&gt;B = 1&lt;/code&gt; or &lt;code&gt;A=1&lt;/code&gt; &amp;amp; &lt;code&gt;B = 0&lt;/code&gt;. That is, you cannot &lt;em&gt;unambiguously&lt;/em&gt; reconstruct its two inputs from its single output i.e. the information about the initial state of &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;B&lt;/code&gt; is lost after the XOR logic operation. This is exactly what they mean when they mean by &quot;irreversibility of classical logic gates&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, the reversible &lt;em&gt;quantum&lt;/em&gt; version of the &lt;code&gt;XOR&lt;/code&gt; gate is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;CNOT&lt;/code&gt; gate&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are exceptions like the classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Inverter_(logic_gate)&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;NOT&lt;/code&gt; gate&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t66ay.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t66ay.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;code&gt;NOT&lt;/code&gt; gate, if you're given that the output state &lt;code&gt;1&lt;/code&gt;, then you can unambiguously say the initial state of &lt;code&gt;A&lt;/code&gt; was &lt;code&gt;0&lt;/code&gt;. Similarly, if you're given &lt;code&gt;NOT A&lt;/code&gt; is &lt;code&gt;0&lt;/code&gt;, you can unambiguously say that &lt;code&gt;A&lt;/code&gt; was &lt;code&gt;1&lt;/code&gt;. No information is lost here during the logic operation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's possible to perform all classical logic operations using only reversible gates. But in those cases, often it becomes necessary to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Ancilla_bit&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancilla bits&lt;/a&gt;. For instance, the reversible &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli gate&lt;/a&gt; gate can implement all classical logic functions. The Toffoli gate has a quantum version too. Basically, all reversible classical logic operations can be directly mapped to quantum gate operations, which are unitary and reversible. In case you're wondering &lt;em&gt;why&lt;/em&gt; quantum gates are unitary, read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2040&quot;&gt;this answer&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have been told that one of the great keys that unlock quantum&#xA;  computing's potential is the reversibility of quantum logic gates as&#xA;  for classical gates there's some loss of information, but I cannot&#xA;  grasp this concept.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's true. Read up the Wikipedia articles on &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;reversible computing&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Landauer%27s_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Landauer's principle&lt;/a&gt;. Note that there's two kinds of reversibilities: &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing#Logical_reversibility&quot; rel=&quot;nofollow noreferrer&quot;&gt;logical reversibility&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing#Physical_reversibility&quot; rel=&quot;nofollow noreferrer&quot;&gt;physical reversibility&lt;/a&gt;. A &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal Turing machine&lt;/a&gt; can be made both physically and logically reversible. Logical and physical reversibility together would enable running &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;efficient algorithms&lt;/a&gt; and energy-efficient computation in quantum computers. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-27T00:34:22.547" LastActivityDate="2019-01-27T00:34:22.547" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5277" PostTypeId="2" ParentId="5273" CreationDate="2019-01-27T00:41:19.923" Score="6" Body="&lt;p&gt;We translate this game into conventional QC terminology as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The coin is a single qbit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\begin{bmatrix}\alpha \\ \beta\end{bmatrix}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Flipping&quot; the coin is application of the bit-flip operator &lt;span class=&quot;math-container&quot;&gt;$X = \begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The &quot;heads&quot; state is defined as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &quot;tails&quot; as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The quantum computer &quot;plays&quot; by applying the Hadamard operator &lt;span class=&quot;math-container&quot;&gt;$H = \begin{bmatrix} \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}} \end{bmatrix}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The game is conducted as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The coin is initialized to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &quot;heads&quot; state.&lt;/li&gt;&#xA;&lt;li&gt;The computer plays, applying the Hadamard operator to the coin (operators are applied using matrix multiplication). The coin enters the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;li&gt;The human plays, choosing whether to flip the coin (apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator). However, since the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator just flips the state vector upside down, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; has no effect; &lt;span class=&quot;math-container&quot;&gt;$X|+\rangle = |+\rangle$&lt;/span&gt;. No matter what, the state is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; after the human plays.&lt;/li&gt;&#xA;&lt;li&gt;The computer plays, applying the Hadamard operator again, taking the coin to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &quot;heads&quot; state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thus the computer always wins, except for &lt;span class=&quot;math-container&quot;&gt;$3\%$&lt;/span&gt; of the time when errors cause it to not behave according to this model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The example deals with the basic quantum states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, plus the common ways of moving between them with the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates. This is the same material you learn about in IBM's &lt;a href=&quot;https://www.ibm.com/blogs/research/2018/07/hello-quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hello Quantum&lt;/a&gt; game.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This isn't a great example to use to illustrate how a quantum computer works (since it only makes sense if you &lt;em&gt;already know&lt;/em&gt; how a quantum computer works), but I guess the speaker only had ten minutes.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-01-27T08:12:20.000" LastActivityDate="2019-01-27T08:12:20.000" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5278" PostTypeId="1" AcceptedAnswerId="5279" CreationDate="2019-01-27T00:53:24.227" Score="3" ViewCount="111" Body="&lt;p&gt;The Wikipedia article on &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Reversible_computing#Logical_reversibility&quot; rel=&quot;nofollow noreferrer&quot;&gt;logical reversibility&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...reversible logic gates offered practical improvements of&#xA;  bit-manipulation transforms in cryptography and computer graphics.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I guess that's not all? Aren't reversible logic gates a necessity for the (efficient) execution of quantum algorithms? &lt;sup&gt;[1]&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I'm basically asking this: Isn't the use of reversible operations or unitaries necessary for efficiently executing quantum algorithms? Or are there &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/74&quot;&gt;models&lt;/a&gt; of quantum computation which can execute these algorithms efficiently without making use of logically reversible operations at all?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[1]: Inspired from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5275/reversibility-and-irreversibly-in-logic-gates-quantum-vs-classical&quot;&gt;Reversibility and irreversibility of logic gates (quantum vs classical)&lt;/a&gt;.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-27T08:25:13.047" LastActivityDate="2019-01-28T07:55:56.000" Title="Aren't reversible logic gates a necessity for efficiently executing quantum algorithms?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;&lt;models&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5279" PostTypeId="2" ParentId="5278" CreationDate="2019-01-27T06:51:52.420" Score="4" Body="&lt;p&gt;Originally, I misunderstood the question, and was answering a question like &quot;Is it true that quantum computers are necessarily formulated only out of reversible gates?&quot;. However, I now understand that the question was intended to be &quot;Must there always be a reversible step inside a quantum computation?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No - there are some computational schemes, such as the &lt;a href=&quot;https://arxiv.org/abs/0803.1447&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, in which every computational step can be formulated as a dissipation, which is non-reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think about it is in terms of the measurement-based model. Here, one must prepare a particular state, and perform a sequence of measurements on it. Usually, we talk about the initial state preparation as a unitary, but that's not necessary. The usual cluster state is the common eigenstate of a set of stabilizers &lt;span class=&quot;math-container&quot;&gt;$\{K_n\}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$K_n^2=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[K_n,K_m]=0$&lt;/span&gt;). So, imagine you take some initial state of a system, and start measuring sets of qubits according to the stabilizers &lt;span class=&quot;math-container&quot;&gt;$\{K_n\}$&lt;/span&gt;. The state people normally talk about preparing is the +1 eigenstate of all of these. Obviously, it's quite unlikely the we succeed in preparing that. However, we will have a record of which stabilizers gave -1 answers. It's a particular property of these stabilizers that each one anti-commutes with a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on a particular site, while all others commute with that particular &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. This means that the list of stabilizers with -1 values corresponds to a list of sites with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; errors. But, knowing that, we can just incorporate the existence of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotations into the measurement bases of the computation. Everything can be achieved through measurements! (Although you require 5-qubit measurements. While not impossible, I think most people would consider implementing them using some unitaries and single-qubit measurements, but the formalism doesn't require it.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Original Answer&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;No. Usually, we phrase quantum algorithms in terms of unitaries (reversible) plus measurements (not reversible). You might even argue that for many algorithms, with a deterministic output, the final measurement does nothing, and hence does not do anything irreversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is partially the fault of the gate model which hides measurement at the end. In fact, there is some degree of choice about trading off between the two. For example, measurement-based computation implements one very simple unitary operation that may have nothing to do with the computation to be performed, and then the computation itself is specified by the measurement choices, and the measurements also detect the outcomes. This extreme certainly shows that it is not necessary to have reversibility.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-01-28T07:55:56.000" LastActivityDate="2019-01-28T07:55:56.000" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5280" PostTypeId="1" CreationDate="2019-01-27T08:41:09.833" Score="10" ViewCount="144" Body="&lt;p&gt;I like making diagrams to describe computations. For the surface code, an excellent tool is 3d topological diagrams. Here is an example diagram (made by me in &lt;a href=&quot;https://www.sketchup.com/&quot; rel=&quot;noreferrer&quot;&gt;SketchUp&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FF2H7m.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FF2H7m.png&quot; alt=&quot;diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is that white boundaries are places where Z observable chains can terminate, black boundaries are places where X observable chains can terminate, and the computation is defined by how these boundaries are merged/split/braided/etc (other colors are used for labeling.). There is a simple correspondence between the diagram and what a quantum computer running the surface code would actually be doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although these diagrams are a good tool for describing topological computations, not everyone knows how to read them. Is there a reference I can point them toward when they ask?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a paper using these diagrams is &lt;a href=&quot;https://arxiv.org/abs/1209.0510&quot; rel=&quot;noreferrer&quot;&gt;A bridge to lower overhead quantum computation (Fowler &amp;amp; Devitt, 2013)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J2Ewem.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J2Ewem.png&quot; alt=&quot;T factory&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may notice that the two diagrams I've included look different in their details. That's because the second one is using braiding whereas the first one is using lattice surgery. But it's ultimately the same diagrammatic concept.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-27T10:25:33.340" LastActivityDate="2019-01-27T10:25:33.340" Title="Reference that explains how to read 3d topological diagrams for surface code computations" Tags="&lt;resource-request&gt;&lt;error-correction&gt;&lt;topological-quantum-computing&gt;&lt;surface-code&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5281" PostTypeId="1" AcceptedAnswerId="5282" CreationDate="2019-01-27T11:26:13.907" Score="6" ViewCount="202" Body="&lt;p&gt;I'm using Mermin's Quantum Computer Science book to understand Shor's algorithm, but I can't figure out why one of the phase factors drops out of the probability for measuring a certain y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the application of the QFT on the superposition of the first register in Shor's algorithm (&lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; is the offset and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the period):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}U_{FT}\frac{1}{\sqrt{m}}\sum_{k=0}^{m-1}\left|{x_0+kr} \right&amp;gt;_n&amp;amp;=\frac{1}{2^{n/2}}\sum^{2^n-1}_{y=0}\frac{1}{\sqrt{m}}\sum_{k=0}^{m-1}e^{2\pi i(x_0+kr)/2^n}\left |{y} \right&amp;gt;_n \\ &amp;amp;=\sum^{2^n-1}_{y=0}e^{2\pi i x_0 y/2^n}\frac{1}{2^n\sqrt{m}}\left(\sum_{k=0}^{m-1}e^{2\pi ikry/2^n}\right)\left |{y} \right&amp;gt;_n\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Mermin, the probability of getting the result &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$p(y) = \frac{1}{2^nm}\big |\sum_{k=0}^{m-1}e^{2\pi ikry/2^n}\big |^2$&lt;/span&gt;. Why can we just ignore &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i x_0 y/2^n}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5051" LastEditorUserId="26" LastEditDate="2019-01-27T14:26:34.347" LastActivityDate="2019-07-12T15:19:27.497" Title="What happens with first phase factor in QFT?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5282" PostTypeId="2" ParentId="5281" CreationDate="2019-01-27T14:41:45.413" Score="6" Body="&lt;p&gt;If you have a quantum state like &lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle_n = a_0|0\rangle_n+a_1|1\rangle_n+...+a_n|2^n-1\rangle_n$$&lt;/span&gt; and you measure it in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle_n,...,|2^{n-1}\rangle_n\}$&lt;/span&gt; basis, then the probability &lt;span class=&quot;math-container&quot;&gt;$p(y)$&lt;/span&gt; of getting the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle_n$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|a_y|^2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a_y \in \Bbb C$&lt;/span&gt; (i.e it's a &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex number&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, &lt;span class=&quot;math-container&quot;&gt;$$a_y = e^{2\pi i x_0 y/2^n} \frac{1}{2^n\sqrt{m}} \sum_{k=0}^{m-1}e^{2\pi ikry/2^n}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remind yourself that for a complex number &lt;span class=&quot;math-container&quot;&gt;$re^{i\theta}$&lt;/span&gt;, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Absolute_value#Complex_numbers&quot; rel=&quot;nofollow noreferrer&quot;&gt;modulus&lt;/a&gt; is &lt;span class=&quot;math-container&quot;&gt;$$|re^{i\theta}| = |r||e^{i\theta}|=|r| \cdot 1=|r|$$&lt;/span&gt; (since &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; has a modulus of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;) and the square of the modulus is &lt;span class=&quot;math-container&quot;&gt;$|r|^2.$&lt;/span&gt; Note that I've not specified &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is real; it could still be a complex number itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i x_0 y/2^n}$&lt;/span&gt; and so you don't see it in &lt;span class=&quot;math-container&quot;&gt;$p(y)$&lt;/span&gt;, as &lt;span class=&quot;math-container&quot;&gt;$p(y)$&lt;/span&gt; is essentially &lt;span class=&quot;math-container&quot;&gt;$|a_y|^2$&lt;/span&gt;. This &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; has a special name — it's a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5125&quot;&gt;global phase&lt;/a&gt; for &lt;span class=&quot;math-container&quot;&gt;$a_y|y\rangle_n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="6065" LastEditDate="2019-07-12T15:19:27.497" LastActivityDate="2019-07-12T15:19:27.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5283" PostTypeId="1" AcceptedAnswerId="5285" CreationDate="2019-01-27T19:48:46.233" Score="1" ViewCount="398" Body="&lt;p&gt;Suppose we have the quantum circuit below with a quantum register of 2 qubits and a classical register of 2 bits. The Hadamard gates and CNOT gate are not important for the question. When we measure a qubit we collapse it into one of the computational basis states (let's suppose we are working with the basis &lt;span class=&quot;math-container&quot;&gt;$ \{|0\rangle,|1\rangle\}$&lt;/span&gt;). But on &lt;em&gt;Nielsen&lt;/em&gt; and &lt;em&gt;Chuang&lt;/em&gt;'s book, it says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...this operation [measurement] converts a single qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle=\alpha |0\rangle +\beta |1\rangle$&lt;/span&gt; into a probabilistic bit &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (...) which is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with a probability of &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;, or 1 with a probability of &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now here's what I don't understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If the measurement is an irreversible process then the probability of the resultant state is towards the initial quantum state it was in, that is, if the resultant state is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; with a probability of, say, &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt;, that means that is has a &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt; probability that the initial state was &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle= |1\rangle$&lt;/span&gt;. However, after it has collapsed to a bit, then, there is no probability associated with it, it certainly is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for all future measurements, it shouldn't be a probabilistic bit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the circuit below, what is the need of registering the state of the qubit in a classical bit if it has collapsed irreversibly into that same state? Does it only make sense to do so when it is the end of the circuit? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UA0EN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UA0EN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="26" LastEditDate="2019-01-27T21:36:04.537" LastActivityDate="2019-01-27T22:09:45.100" Title="Measurement of a qubit and storage of the information on a bit" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;measurement&gt;&lt;decoherence&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5284" PostTypeId="2" ParentId="5251" CreationDate="2019-01-27T19:59:32.423" Score="1" Body="&lt;p&gt;As I understand &lt;span class=&quot;math-container&quot;&gt;$\mathsf{IP}$&lt;/span&gt; and similarly &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QIP}$&lt;/span&gt;, two parties, prover Peggy and verifier Vicky, engage in a number of rounds that are polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.  Each round consists of Vicky providing a challenge to Peggy, then Peggy replying with a response, &lt;em&gt;with the challenges and responses being a function of the previous rounds.&lt;/em&gt;  Eventually after the polynomial number of rounds, Vicky should be convinced by Peggy.  This is how I read Shamir's &lt;span class=&quot;math-container&quot;&gt;$\mathsf{IP=PSPACE}$&lt;/span&gt; paper - after each round, Peggy simplifies a polynomial based on challenges from Vicky, until eventually Vicky can be assured that the polynomial is non-zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is distinct from the standard protocol used for the graph non-isomorphism &lt;span class=&quot;math-container&quot;&gt;$GNI$&lt;/span&gt; problem.  In &lt;span class=&quot;math-container&quot;&gt;$GNI$&lt;/span&gt;, the weaker Vicky challenges the powerful Peggy with a &lt;em&gt;single round&lt;/em&gt; to determine which graph Vicky has permuted.  The &lt;span class=&quot;math-container&quot;&gt;$GNI$&lt;/span&gt; protocol can be run a plurality of times between Vicky and Peggy to amplify soundness, but each round is done independent of the others, and there is no challenge/response that is based on previous challenge/responses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore the classes &lt;span class=&quot;math-container&quot;&gt;$\mathsf{MA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt; are different still - here the powerful &lt;em&gt;Merlin&lt;/em&gt; provides the weaker &lt;em&gt;Arthur&lt;/em&gt; initially with a classical/quantum certificate (not the other way around).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Watrous ended the 2000 paper &quot;Succinct Quantum Proofs for Properties of Finite Groups&quot; with an open question as to whether &lt;span class=&quot;math-container&quot;&gt;$GNI\in\mathsf{QMA}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Okamoto and Tanaka offer an answer Watrous's problem in the affirmative with their 2007 paper &quot;&lt;a href=&quot;https://www.semanticscholar.org/paper/Graph-Non-Isomorphism-Has-a-Succinct-Quantum-Okamoto-Tanaka/c1db5fdc6764126198f7db7fe720b42b0efc4320&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph Non Isomorphism Has a Succinct Quantum Certificate&lt;/a&gt;.&quot;  Although there are some areas in the paper that are causing me a little bit of confusion, as I understand it Merlin's quantum certificate &lt;span class=&quot;math-container&quot;&gt;$\mathsf{MA}$&lt;/span&gt; protocol for &lt;span class=&quot;math-container&quot;&gt;$GNI$&lt;/span&gt; consists of  &lt;span class=&quot;math-container&quot;&gt;$O(n^{12})$&lt;/span&gt; replicates of their FIG. 1.  Their verification procedure entails Arthur burning through most of these by measuring random replicates without performing any quantum gates, just to confirm that the structure of the certificates for remaining replicates is highly likely to be correct.  They then have Arthur permute adjacency matrices conditioned on the value of their garbage registers (going from FIG. 1 to FIG. 2).  At the end they have Arthur perform some CNOTs and Hadamard transforms on remaining replicates, to get a rough measure of the structure of the replicates and how close the vectors in the replicates are to one another.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In step 6 in their protocol, Arthur has possession of a state that should be a uniform superposition of (an appropriately normalized version of)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{b\in\{0,1\},i\in S_n}\vert b\rangle\vert \pi_i(G_b)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for rigid graphs &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;.  That is, the state that Arthur possesses consists of a uniform superposition over all adjacency matrices that are equivalent to either the given &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; or the given &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;.  Arthur can then Hadamard and measure &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt;.  Depending on whether &lt;span class=&quot;math-container&quot;&gt;$G_0\not\cong G_1$&lt;/span&gt;, after Hadamarding Arthur should measure &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt; the appropriate number of times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though Okomoto and Tanaka's protocol uses &lt;span class=&quot;math-container&quot;&gt;$O(n^{12})$&lt;/span&gt; replicates, it still is fundamentally an &lt;span class=&quot;math-container&quot;&gt;$\mathsf{MA}$&lt;/span&gt; protocol, as most of these replicates are for improving soundness.  The protocol does not use the sophistication of more than one round of interaction in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QIP}$&lt;/span&gt; (the second figure in the question).  Certainly such a multi-round &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QIP}$&lt;/span&gt; protocol is likely to exist, because &lt;span class=&quot;math-container&quot;&gt;$GNI\in\mathsf{AM}\subseteq\mathsf{IP}=\mathsf{PSPACE}=\mathsf{QIP}$&lt;/span&gt;, but at least according to Okomoto and Tanaka, it would be overkill and a single round is sufficient.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-01-28T21:22:43.083" LastActivityDate="2019-01-28T21:22:43.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5285" PostTypeId="2" ParentId="5283" CreationDate="2019-01-27T20:35:57.340" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;If the measurement is an irreversible process then the probability of&#xA;  the resultant state is towards the initial quantum state it was in,&#xA;  that is, if the resultant state is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; with a probability of, say,&#xA;  &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt;, that means that is has a &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt; probability that the initial&#xA;  state was &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle= |1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a fundamental misinterpretation. If the resultant state after measurement is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt; probability, then it simply means that the initial quantum state was of the form &lt;span class=&quot;math-container&quot;&gt;$\sqrt{0.27}e^{i\theta}|0\rangle + \sqrt{0.63}e^{i\phi}|1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi\in \Bbb R$&lt;/span&gt; (of course, assuming we measured in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; basis). This initial quantum state &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;nofollow noreferrer&quot;&gt;collapses&lt;/a&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt; probability! Don't think of it as &quot;if the resultant state is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt; probability it means that the initial quantum state was &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$63\%$&lt;/span&gt; probability.&quot; That's wrong. Qubits can totally &lt;em&gt;exist&lt;/em&gt; in a linear &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;superposition&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;strong&gt;do not&lt;/strong&gt; necessarily need to be either one of them i.e. &lt;em&gt;either&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &lt;em&gt;or&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. A superposition is a perfectly valid state of existence for a qubit! It also &lt;strong&gt;does not&lt;/strong&gt; make sense to say: it's &lt;strong&gt;both&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; at the same time. Quantum mechanics is a mathematical model of reality and it does not need to match with your classical intuitions and need not be describable with the limited English vocabulary we apply for classical objects. We need to extend our vocabulary to describe qubits and that's where mathematics helps us. The word &quot;superposition&quot; is a mathematical term in this context. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, after it has collapsed to a bit, then, there is no&#xA;  probability associated with it, it certainly is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for all future&#xA;  measurements, it shouldn't be a probabilistic bit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe the word in the term that's confusing you is &quot;converts&quot;. I'd say don't overthink this. They simply mean that on measurement of a qubit in the state &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b|1\rangle$&lt;/span&gt; there &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt; probability of getting &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b|^2$&lt;/span&gt; probability of getting &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The term &quot;probabilitic bit&quot; here is simply an abstraction. They mean that upon measurement you can &lt;em&gt;imagine&lt;/em&gt; your qubit to be a &quot;bit&quot; with a value of either &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt;. That is, it has the value &lt;code&gt;0&lt;/code&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt; and value &lt;code&gt;1&lt;/code&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|b|^2$&lt;/span&gt;. But this is assuming they don't &lt;em&gt;know&lt;/em&gt; the measurement result yet. They're simply mathematically modelling the measured qubit as a probabilitic bit &lt;em&gt;without the knowledge&lt;/em&gt; of the result of the measurement. Of course, if you &lt;em&gt;know&lt;/em&gt; the result of the measurement it's going to be either &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; with &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; probability. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the circuit below, what is the need of registering the state of the&#xA;  qubit in a classical bit if it has collapsed irreversibly into that&#xA;  same state? Does it only make sense to do so when it is the end of the&#xA;  circuit?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is already answered in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4053&quot;&gt;Why do we need a Classical Register for carrying out Quantum Computations?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results of the measurements are basically classical information i.e. &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; if you're measuring in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; basis. Remember that in reality you're measuring things like &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/92&quot;&gt;electron spin&lt;/a&gt;.  You need to store that classical information somewhere for future use, and that is what copying the results of the measurement to the classical bits achieves. And yes, in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1348&quot;&gt;gate model&lt;/a&gt; it's generally done after the measurements (which is usually the final step of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum algorithm&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-27T22:09:45.100" LastActivityDate="2019-01-27T22:09:45.100" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5286" PostTypeId="1" CreationDate="2019-01-27T22:55:35.543" Score="9" ViewCount="936" Body="&lt;p&gt;Consider the following game:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I flip a fair coin, and depending on the outcome (either heads/tails), I'll give you one of the following states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle \text{ or } \cos(x)|0\rangle + \sin(x)|1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a known constant angle. But, I don't tell you which state I give you. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I describe a measurement procedure (i.e. an orthonormal qubit basis) to guess which state I'm given, while maximizing the chance of being right? Is there an optimal solution?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been self-studying quantum computing, and I came across this exercise. I don't really know how to even start, and I would really appreciate some help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that a good strategy would be to perform an orthogonal transformation with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;\cos(x) &amp;amp; -\sin(\theta)\\&#xA;\sin(x) &amp;amp; \cos(\theta)&#xA;\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can't make much progress...&lt;/p&gt;&#xA;" OwnerUserId="5656" LastEditorUserId="26" LastEditDate="2019-01-28T10:49:52.130" LastActivityDate="2019-01-29T13:58:03.677" Title="Optimal strategy to a quantum state game" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;games&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5287" PostTypeId="1" AcceptedAnswerId="5361" CreationDate="2019-01-27T23:31:36.437" Score="7" ViewCount="322" Body="&lt;p&gt;It is known that there are big companies behind the specific qubit implementations (e.g. ion traps, superconducting loops, topological qubits, etc.). But I have not managed to find the company that is backing/implementing diamond vacancy quantum computers. Currently, it seems to me that this technology is confined only to the laboratories of universities. I am speaking about &lt;a href=&quot;https://en.wikipedia.org/wiki/Nitrogen-vacancy_center&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nitrogen-vacancy center&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So - is there any company that backs and implements diamond vacancy quantum computers?&lt;/p&gt;&#xA;" OwnerUserId="1326" LastEditorUserId="26" LastEditDate="2019-01-28T08:20:37.127" LastActivityDate="2020-08-14T12:27:43.750" Title="Is there any company that backs and implements diamond vacancy quantum computers?" Tags="&lt;physical-realization&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5288" PostTypeId="2" ParentId="5286" CreationDate="2019-01-28T07:09:49.107" Score="1" Body="&lt;p&gt;The key is in the optimal strategy for distinguishing two non-orthogonal states. This is something called the Helstrom measurement, which I described &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4172/1837&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2019-01-28T07:45:42.373" LastActivityDate="2019-01-28T07:45:42.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5289" PostTypeId="2" ParentId="5286" CreationDate="2019-01-28T09:16:20.367" Score="8" Body="&lt;p&gt;We simply translate the binary result of a qubit measurement to our guess whether it's the first state or the second, calculate the probability of success for every possible measurement of the qubit, and then more find the maximum of a function of two variables (on the two-sphere).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, something that we won't really need, the precise description of the state. The full state of the system that depends both on superpositions a well as a classical fair coin may be encoded in the density matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = \frac 12 \pmatrix{1&amp;amp;0\\0&amp;amp;0} + \frac 12 \pmatrix{\cos^2x &amp;amp;\sin x \cos x\\ \sin x\cos x &amp;amp; \sin^2 x} $$&lt;/span&gt;&#xA;where the left column and upper row corresponds to the basis state &quot;zero&quot; and the remaining ones to &quot;one&quot;. It's helpful to rewrite the density matrix in terms of the 4-element basis of the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = \frac 12+ \frac{\sin x \cos x}{2} \sigma_x + \left(\frac{\cos^2 x - \sin^2 x}{4}+\frac 14\right) \sigma_z  $$&lt;/span&gt;&#xA;That may be written in terms of the angle &lt;span class=&quot;math-container&quot;&gt;$2x$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac 12 + \frac {\sin 2x}{4} \sigma_x + \frac{\cos 2x +1}{4} \sigma_z $$&lt;/span&gt;&#xA;Now, regardless of the mixed state, this is still a two-level system and all measurements on the two-dimensional Hilbert space are either trivial (measurements of a &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;-number) or equivalent to the measurement of the spin along an axis, i.e. measurements of &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ V = \vec n \cdot \vec \sigma $$&lt;/span&gt;&#xA;which is a unit 3D vector multiplied by the vector of Pauli matrices. OK, what happens if we measure &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;? The eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; are plus one or minus one. The probability of each may be obtained from the expectation value of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; which is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle V \rangle = {\rm Tr} (V \rho) $$&lt;/span&gt;&#xA;The traces of products only contribute if &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; meets &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (but we assume there was no term in &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;) or &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; meets &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; etc., in which cases the trace of the matrix gives an extra factor of 2. So we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle V \rangle = \frac{\sin 2x}{2}n_x + \frac{\cos 2x +1}{2} n_z $$&lt;/span&gt;&#xA;We get the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; with the probabilities &lt;span class=&quot;math-container&quot;&gt;$(1\pm\langle V \rangle) / 2$&lt;/span&gt;, respectively. Exactly when &lt;span class=&quot;math-container&quot;&gt;$\cos x = 0$&lt;/span&gt;, the two initial &quot;head and tail&quot; states are orthogonal to one another (basically &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) and we may fully discriminate them. To make the probabilities &lt;span class=&quot;math-container&quot;&gt;$0,1$&lt;/span&gt;, we must simply choose &lt;span class=&quot;math-container&quot;&gt;$\vec n=(0,0,\pm 1)$&lt;/span&gt;; note that the overall sign of &lt;span class=&quot;math-container&quot;&gt;$\vec n$&lt;/span&gt; doesn't matter for the procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for &lt;span class=&quot;math-container&quot;&gt;$\cos x \neq 0$&lt;/span&gt;, the states are non-orthogonal i.e. &quot;not mutually exclusive&quot; in the quantum sense and we can't measure directly whether the coin was tails or heads because those possibilities were mixed in the density matrix. In fact, the density matrix contains all probabilities of all measurements, so if we could get the same density matrix by a different mixture of possible states from coin tosses, the states of the qubit would be strictly indistinguishable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our probability of success will be below 100% if &lt;span class=&quot;math-container&quot;&gt;$\cos x\neq 0$&lt;/span&gt;. But the only meaningful way to use the classical bit &lt;span class=&quot;math-container&quot;&gt;$V=\pm 1$&lt;/span&gt; from the measurement is to directly translate it to our guess about the initial state. Without a loss of generality, our translation may be chosen to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (V = +1) \to |i\rangle = |0\rangle \\ $$&lt;/span&gt;&#xA;and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (V = -1) \to |i\rangle = \cos x |0\rangle + \sin x |1 \rangle.$$&lt;/span&gt;&#xA;If we wanted the opposite, cross-identification of the heads-tails and the signs of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, we could simply achieve it by flipping the overall sign of &lt;span class=&quot;math-container&quot;&gt;$\vec n \to -\vec n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's call the first simple initial state &quot;heads&quot; (the zero) and the second harder one &quot;tails&quot; (the cosine-sine superposition). The probability of success is, given our translation from &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; to heads and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; to tails,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P_{\rm success} = P(H) P(+1|H) + P(T) P(-1|T). $$&lt;/span&gt;&#xA;Because it's a fair coin, the two factors included above are &lt;span class=&quot;math-container&quot;&gt;$P(H)=P(T)=1/2$&lt;/span&gt;. The most difficult calculation among the four probabilities is &lt;span class=&quot;math-container&quot;&gt;$P(-1|T)$&lt;/span&gt;. But we have already made a harder calculation above, it was the &lt;span class=&quot;math-container&quot;&gt;$(1-\langle V\rangle) / 2$&lt;/span&gt;. Here we just omit the constant term proportional to &lt;span class=&quot;math-container&quot;&gt;$n_z$&lt;/span&gt; and multiply by two:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P(-1|T ) = \frac 12 - \sin 2x \frac{ n_x}2 - \cos 2x \frac{ n_z}2 $$&lt;/span&gt;&#xA;The result for &quot;heads&quot; is simply obtained by setting &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; because the &quot;heads&quot; state equals &quot;tails&quot; states with &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; substituted. So &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P(-1|H) = \frac{1-n_z}{2} $$&lt;/span&gt;&#xA;and the complementary &lt;span class=&quot;math-container&quot;&gt;$1-P$&lt;/span&gt; probability is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P(+1|H) = \frac{1+n_z}{2} $$&lt;/span&gt;&#xA;Substitute those results to our &quot;success probability&quot; to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{\rm success} = \frac{1+n_z +1 - (\sin 2x)n_x - (\cos 2x)n_z}{4} $$&lt;/span&gt;&#xA;or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{\rm success} = \frac 12 - \frac{n_x}4 \sin 2x + \frac{n_z}{4} (1-\cos 2x ) $$&lt;/span&gt;&#xA;If we define &lt;span class=&quot;math-container&quot;&gt;$(n_x,n_z)=(-\cos \alpha,-\sin\alpha)$&lt;/span&gt;, we may also write it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P_{\rm success} = \frac 12 +\frac{\sin(2x+\alpha)-\sin \alpha}{4} =\frac 12+\frac{\sin x \cos(x+\alpha)}{2} $$&lt;/span&gt;&#xA;We want to maximize that over &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;. Clearly, the maximum is for &lt;span class=&quot;math-container&quot;&gt;$\cos(x+\alpha)=\pm 1$&lt;/span&gt; where the sign agrees with that of &lt;span class=&quot;math-container&quot;&gt;$\sin x$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$\alpha=-x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\alpha=\pi -x $&lt;/span&gt; and the value at this maximum is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P_{\rm success} = \frac{1+|\sin x|}{2}$$&lt;/span&gt;&#xA;which sits in the interval 50% and 100%. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's a nice measurement which is really quantum mechanical. We use a different measurement than that of &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;, i.e. the classical measurement of the bit. Instead, we measure the spin along the axis in the &lt;span class=&quot;math-container&quot;&gt;$xz$&lt;/span&gt;-plane that is defined by the same nonzero angle as the angle &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; at the beginning, with some correct signs and shifts by multiples of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;. Note that if you measured simply &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;, the classical bit, the success rate would be just &lt;span class=&quot;math-container&quot;&gt;$(3-\cos 2x)/4$&lt;/span&gt;, also between 50% and 100%, but smaller than our result. In particular, for a small &lt;span class=&quot;math-container&quot;&gt;$x=0+\epsilon$&lt;/span&gt;, our optimal result would be Taylor-expanded as &lt;span class=&quot;math-container&quot;&gt;$1/2+|x|/2$&lt;/span&gt; while the non-optimum result using the classical measurement would increase above &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; more slowly, as &lt;span class=&quot;math-container&quot;&gt;$1/2+x^2/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For many hours, a wrong answer (a mistake in the final portions) was posted here, despite the fact that I had previously fixed many wrong factors of two. I posted a slightly edited version of this answer on my weblog where some discussion may take place:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://motls.blogspot.com/2019/01/a-fun-simple-problem-in-quantum.html?m=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Reference Frame: A fun simple problem in quantum computing&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;On that page, I also write the eigenstates of the measured operator in the appendix. The arguments in the angles may be surprising for some folks who think that this problem is obvious in terms of the wave functions or that the wave functions after the measurement have to be simple.&lt;/p&gt;&#xA;" OwnerUserId="5659" LastEditorUserId="26" LastEditDate="2019-01-29T13:58:03.677" LastActivityDate="2019-01-29T13:58:03.677" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5291" PostTypeId="1" CreationDate="2019-01-28T11:27:24.860" Score="4" ViewCount="1603" Body="&lt;p&gt;I get below error when I run a code on spyder environment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;File &lt;code&gt;C:/MYPYTHON Programs/My Quantum Programs/Shor algo.py&lt;/code&gt;, line 4, in from &lt;code&gt;qiskit import QuantumProgram&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImportError: cannot import name 'QuantumProgram' from 'qiskit' &#xA;(C:\Users\gurmo\Anaconda3\envs\Qiskitenv\lib\site-packages\qiskit__init__.py)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5663" LastEditorUserId="26" LastEditDate="2019-01-28T11:30:02.867" LastActivityDate="2019-08-16T15:22:09.653" Title="ImportError: cannot import name 'QuantumProgram' from 'qiskit'" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5292" PostTypeId="2" ParentId="5291" CreationDate="2019-01-28T15:20:09.753" Score="8" Body="&lt;p&gt;&lt;code&gt;QuantumProgram&lt;/code&gt; was removed in Qiskit 0.6.0. (&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/releases/tag/0.6.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Release Notes&lt;/a&gt;) Your example code is likely for an older version. You can either install Qiskit 0.5.7, or find an &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/terra0_7/community/algorithms/shor_algorithm.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;updated Shor's Algorithm example&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="52" LastEditorUserId="52" LastEditDate="2019-01-29T12:55:07.233" LastActivityDate="2019-01-29T12:55:07.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5293" PostTypeId="1" AcceptedAnswerId="5306" CreationDate="2019-01-28T15:26:20.137" Score="5" ViewCount="639" Body="&lt;p&gt;I have seen that it is possible to represent the Grover iterator as a rotation matrix &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. My question is, how can you do that exactly?&#xA;So we say that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a superposition of the states of searched and not searched elements, that can be represented like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\sqrt{\frac{N-1}{N}}|\alpha\rangle+\sqrt{\frac{1}{N}}|\beta\rangle$$&lt;/span&gt;&#xA;Now you can rewrite that so you get this expression:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\cos(\theta/2)|\alpha\rangle+\cos(\theta/2)|\beta\rangle$$&lt;/span&gt;&#xA;I have seen that an application of the Grover iteration can be represented as a rotation matrix, e.g. in this form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G=\begin{pmatrix}\cos(\theta)&amp;amp;-\sin(\theta)\\\sin(\theta)&amp;amp;\cos(\theta)\end{pmatrix}$$&lt;/span&gt;&#xA;But how do you get to the shape, what are the necessary steps and calculations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that the question is expressed as understandably and clearly.&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="55" LastEditorDisplayName="user4961" LastEditDate="2021-02-02T10:32:48.320" LastActivityDate="2021-02-02T10:32:48.320" Title="How is Grover's operator represented as a rotation matrix?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5294" PostTypeId="1" CreationDate="2019-01-28T15:51:39.587" Score="3" ViewCount="89" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}$&lt;/span&gt; can be defined as the following (see &lt;a href=&quot;https://arxiv.org/pdf/1704.01514.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Morimae-Nishimura&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/1703.08118.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Usher-Hoban-Browne&lt;/a&gt;): &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A promise problem &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}=(\mathcal{L_{yes},L_{no}})$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA(c,s)}$&lt;/span&gt; if there exists a polynomially bounded function &lt;span class=&quot;math-container&quot;&gt;$m:\mathbb{Z}^+\rightarrow \mathbb{N}$&lt;/span&gt; and a polynomial time quantum verifier &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, which is a polynomial time uniformly generated family of quantum circuits &lt;span class=&quot;math-container&quot;&gt;$\{V_{x}\}_{x\in\{0,1\}^n}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n+m$&lt;/span&gt; qubits such that for every input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(\langle \psi|\otimes\langle0|^{\otimes m}) V_x^{\dagger} (|0\rangle\langle0|\otimes I_{n+m-1}) V_x(|\psi\rangle\otimes |0\rangle^{\otimes m}) &amp;gt; 2^{-p(n)}$&lt;/span&gt; for some polynomial &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;: &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Completeness: if &lt;span class=&quot;math-container&quot;&gt;$x \in \mathcal{L}_{yes}$&lt;/span&gt;, there exists a witness &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\frac{(\langle \psi|\otimes\langle0|^{\otimes m}) V_x^{\dagger} (|00\rangle\langle00|\otimes I_{n+m-2}) V_x(|\psi\rangle\otimes |0\rangle^{\otimes m})}{(\langle \psi|\otimes\langle0|^{\otimes m}) V_x^{\dagger} (|0\rangle\langle0|\otimes I_{n+m-1}) V_x(|\psi\rangle\otimes |0\rangle^{\otimes m})} \geq c.$$&lt;/span&gt;&lt;/li&gt;&#xA;  &lt;li&gt;Soundness: if &lt;span class=&quot;math-container&quot;&gt;$x \in \mathcal{L}_{no}$&lt;/span&gt;, for any witness &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\frac{(\langle \psi|\otimes\langle0|^{\otimes m}) V_x^{\dagger} (|00\rangle\langle00|\otimes I_{n+m-2}) V_x(|\psi\rangle\otimes |0\rangle^{\otimes m})}{(\langle \psi|\otimes\langle0|^{\otimes m}) V_x^{\dagger} (|0\rangle\langle0|\otimes I_{n+m-1}) V_x(|\psi\rangle\otimes |0\rangle^{\otimes m})} \leq s.$$&lt;/span&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Namely, we do the postselection such that if the first output qubit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, then we consider the second output qubit. Usually, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}:=\mathsf{PostQMA(2/3,1/3)}$&lt;/span&gt;. As mentioned in Morimae-Nishimura, the error bound can be amplified from &lt;span class=&quot;math-container&quot;&gt;$(2/3,1/3)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(1-2^{-r(n)},2^{-r(n)})$&lt;/span&gt; for any polynomial &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The naive approach is requiring &lt;strong&gt;polynomially many copies&lt;/strong&gt; of the witness and using the standard Chernoff bound on indicators which indicate whether &lt;span class=&quot;math-container&quot;&gt;$x \in \mathcal{L}_{yes}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}_{no}$&lt;/span&gt; and repeat such trials. As mentioned in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0412187.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson's paper&lt;/a&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A little-advanced approach is requiring &lt;strong&gt;two copies&lt;/strong&gt; of the witness. Using the proposition 2.9 in &lt;a href=&quot;https://arxiv.org/pdf/0908.0512.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kuperberg's paper&lt;/a&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt; verifier &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; can be thought as two quantum polynomial-time algorithms run by Alice and Bob that report &quot;yes&quot; with probabikity &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; respectively. For some constant &lt;span class=&quot;math-container&quot;&gt;$c&amp;gt;1$&lt;/span&gt;, postselection guarantee the &lt;em&gt;free-to-retry&lt;/em&gt; property: &#xA;- &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; reports &quot;yes&quot; if &lt;span class=&quot;math-container&quot;&gt;$a &amp;gt; cb$&lt;/span&gt;; &#xA;- &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; reports &quot;no&quot; if &lt;span class=&quot;math-container&quot;&gt;$a &amp;lt; cb$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And Alice and Bob are free to retry if &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt; is not in either above ranges. Hence, we can do something similar to the &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;nofollow noreferrer&quot;&gt;Marriott-Watrous gap amplification&lt;/a&gt; (or &lt;a href=&quot;https://arxiv.org/abs/0904.1549&quot; rel=&quot;nofollow noreferrer&quot;&gt;the phase estimation variant&lt;/a&gt;), consider the following projections: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;\Pi_0 &amp;amp;= I_n\otimes |0\rangle\langle 0|^{\otimes m},\\&#xA;\Pi_1^A &amp;amp;= V_x^{\dagger} (|00\rangle\langle 00|\otimes I_{n+m-2}) V_x,\\&#xA;\Pi_1^B &amp;amp;= V_x^{\dagger} (|01\rangle\langle 01|\otimes I_{n+m-2}) V_x.\\&#xA;\end{aligned}$$&lt;/span&gt;&#xA;Invoking Marriott-Watrous procedure for &lt;span class=&quot;math-container&quot;&gt;$\Pi_0\Pi_1^A\Pi_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Pi_0\Pi_1^B\Pi_0$&lt;/span&gt; and using the free-to-retry property, then we can do the same thing with the standard Chernoff bound. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Therefore, the final question is that could we do the promise gap amplification using &lt;strong&gt;only one copy&lt;/strong&gt; of the witness (i.e. strong error reduction) for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}$&lt;/span&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Historically, such strong error reduction usually will have complexity-theoretic consequences, such as showing that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}\subseteq \mathsf{PP}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PreciseQMA}\subseteq \mathsf{PSPACE}$&lt;/span&gt; (see &lt;a href=&quot;https://arxiv.org/abs/1604.08192&quot; rel=&quot;nofollow noreferrer&quot;&gt;space-efficient strong error reduction&lt;/a&gt;). So such strong error reduction for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}$&lt;/span&gt; might give us a &lt;em&gt;direct proof&lt;/em&gt; for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}\subseteq\mathsf{PSPACE}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two facts might be helpful: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1704.01514.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Morimae-Nishimura&lt;/a&gt; proved that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}=\mathsf{PreciseQMA}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PreciseQMA}$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt;-type class with exponentially small completeness-soundness gap. And &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PreciseQMA}$&lt;/span&gt; have such strong error reduction (but it needs exponential time) -- so even such strong error reduction for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostQMA}$&lt;/span&gt; exists, it might need exponential time to amplify. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412187&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson&lt;/a&gt; proved that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PostBQP}$&lt;/span&gt; machine can do efficiently generated uniformly polynomial-size bounded-error quantum circuits, where the circuits can consist of arbitrary &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit &lt;strong&gt;invertible&lt;/strong&gt; linear transformations. It is not clear to me whether such Marriott-Watrous type error reduction exists for &lt;em&gt;invertible&lt;/em&gt; gates complexity class or not. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1777" LastActivityDate="2019-01-28T15:51:39.587" Title="Does strong error reduction for PostQMA exist?" Tags="&lt;complexity-theory&gt;&lt;qma&gt;&lt;postselection&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5295" PostTypeId="1" CreationDate="2019-01-28T16:06:21.193" Score="6" ViewCount="106" Body="&lt;p&gt;I have seen their applications in quantum state tomography but not in computation as such. &lt;/p&gt;&#xA;" OwnerUserId="5667" LastEditorUserId="26" LastEditDate="2019-01-28T16:07:48.127" LastActivityDate="2019-01-31T09:38:52.500" Title="Do weak measurements (with/without weak values) have any application in quantum computation?" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5296" PostTypeId="1" AcceptedAnswerId="5297" CreationDate="2019-01-28T17:52:20.067" Score="1" ViewCount="72" Body="&lt;p&gt;As far as I know, correlation of two qubits in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis implies that under a simultaneous bit flip, the composite quantum state must be invariant. For instance, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can be said to be correlated in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis if they share a Bell state i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle_{AB} = \frac{1}{\sqrt{2}}(|0\rangle_A\otimes |0\rangle + |1\rangle_A\otimes |1\rangle_B).$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Under simultaneous bit flip it becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle_{AB}' = \frac{1}{\sqrt{2}}(|1\rangle_A\otimes |1\rangle_B + |0\rangle_A\otimes |0\rangle_B).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, &lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle_{AB}=|\Psi\rangle_{AB}'.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Preskill uses the notation &lt;span class=&quot;math-container&quot;&gt;$X\otimes X = 1$&lt;/span&gt; to denote this kind of correlation &lt;sup&gt;[1]&lt;/sup&gt;. He also uses a similar notation &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt; to imply correlation in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis. Any idea where this notation comes from? It doesn't seem obvious to me. At first sight, I would have considered &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt; to mean the tensor product of the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator with itself. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[1]: &lt;a href=&quot;https://youtu.be/Q4xBlSi_fOs?t=2650&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Preskill - Introduction to Quantum Information (Part 1) - CSSQI 2012 (~44:10)&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-30T07:52:26.793" LastActivityDate="2019-03-30T07:52:26.793" Title="Why is correlation in the $X$ basis represented as $X\otimes X = 1$?" Tags="&lt;notation&gt;&lt;correlations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5297" PostTypeId="2" ParentId="5296" CreationDate="2019-01-28T18:37:36.017" Score="3" Body="&lt;p&gt;It &lt;em&gt;is&lt;/em&gt; the tensor product of the Pauli X with itself. Preskill is specifying the kind of correlation by giving you a matrix with a +1 eigenspace corresponding to the desired set of states. States where the simultaneous application of an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to each qubit has no effect, including phase kickback when conditioned on an ancilla qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This notation is very common in the stabilizer formalism. For example, error correcting codes that are stabilizer codes are often specified by a set of tensor-products-of-Paulis that must be repeatedly measured, e.g. &lt;span class=&quot;math-container&quot;&gt;$X_1 X_3 Z_5 Z_7$&lt;/span&gt;. When errors occur, the state will flip between the +1 and -1 eigenspaces of some of the measured stabilizers.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-01-28T18:50:03.393" LastActivityDate="2019-01-28T18:50:03.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5298" PostTypeId="1" CreationDate="2019-01-28T19:16:19.923" Score="6" ViewCount="150" Body="&lt;p&gt;This isn't my area but the recent Quanta article &lt;a href=&quot;https://www.quantamagazine.org/how-space-and-time-could-be-a-quantum-error-correcting-code-20190103/&quot; rel=&quot;nofollow noreferrer&quot;&gt;How Space and Time Could Be a Quantum Error-Correcting Code&lt;/a&gt; struck me as interesting. They mention:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In their paper&lt;sup&gt;[1]&lt;/sup&gt; conjecturing that holographic space-time and quantum&#xA;  error correction are one and the same, they described how even a&#xA;  simple code could be understood as a 2D hologram. It consists of three&#xA;  “qutrits” — particles that exist in any of three states — sitting at&#xA;  equidistant points around a circle. The entangled trio of qutrits&#xA;  encode &lt;strong&gt;one logical qutrit&lt;/strong&gt;, corresponding to a &lt;strong&gt;single space-time point&lt;/strong&gt;&#xA;  in the circle’s center. The code protects the point against the&#xA;  erasure of any of the three qutrits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The rest of the article more or less makes sense, but this is one point where I got stuck. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not very clear to me why one space-time point can be modeled specifically by a logical &quot;qutrit&quot;? What's so special about a &quot;qutrit&quot; in this context? Why not a &quot;qubit&quot; or a general &quot;qudit&quot;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How exactly does the entangled trio perform the error correction of the central logical qutrit?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note that I'm not acquainted with the AdS/CFT formalism. So an exposition aimed at a general audience is preferable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[1]: &lt;a href=&quot;https://arxiv.org/abs/1411.7041&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bulk Locality and Quantum Error Correction in AdS/CFT (Almheiri &lt;em&gt;et al., 2014)&lt;/em&gt;&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-29T10:55:51.033" LastActivityDate="2019-01-29T14:47:31.333" Title="Why can a point in anti-de Sitter space be modeled as a logical qutrit and how is its error correction done?" Tags="&lt;error-correction&gt;&lt;qudit&gt;&lt;qutrit&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5299" PostTypeId="1" CreationDate="2019-01-28T20:11:48.710" Score="3" ViewCount="582" Body="&lt;p&gt;I was trying the qiskit Terra &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/9e3b1faacaa529208e615f5e5ef239c3fe610d34/qiskit/basics/getting_started_with_qiskit_terra.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; and it seems that the code provided to connect to an actual quantum computer doesn't run properly. With my API token generated and stored into the variable &quot;my_token&quot;, I typed :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account(my_token)&#xA;IBMQ.load_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and got the following error message :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;------------------------------------------------------------------&#xA;TypeError                        Traceback (most recent call last)&#xA;&amp;lt;ipython-input-21-7eeefb4c8c69&amp;gt; in &amp;lt;module&amp;gt;()&#xA;----&amp;gt; 1 IBMQ.save_account(my_token)&#xA;      2 IBMQ.load_accounts()&#xA;&#xA;~/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqprovider.py in save_account(self, token, url, overwrite, **kwargs)&#xA;    134         &quot;&quot;&quot;&#xA;    135         credentials = Credentials(token, url, **kwargs)&#xA;--&amp;gt; 136         store_credentials(credentials, overwrite=overwrite)&#xA;    137 &#xA;    138     def active_accounts(self):&#xA;&#xA;~/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/credentials/_configrc.py in store_credentials(credentials, overwrite, filename)&#xA;    122     # Read the current providers stored in the configuration file.&#xA;    123     filename = filename or DEFAULT_QISKITRC_FILE&#xA;--&amp;gt; 124     stored_credentials = read_credentials_from_qiskitrc(filename)&#xA;    125 &#xA;    126     # Check if duplicated credentials are already stored. By convention,&#xA;&#xA;~/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/credentials/_configrc.py in read_credentials_from_qiskitrc(filename)&#xA;     61         if 'verify' in single_credentials.keys():&#xA;     62             single_credentials['verify'] = bool(single_credentials['verify'])&#xA;---&amp;gt; 63         new_credentials = Credentials(**single_credentials)&#xA;     64         credentials_dict[new_credentials.unique_id()] = new_credentials&#xA;     65 &#xA;&#xA;TypeError: __init__() missing 1 required positional argument: 'token'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please tell me where I got it wrong.&lt;/p&gt;&#xA;" OwnerUserId="5569" LastEditorUserId="26" LastEditDate="2019-01-28T20:37:06.683" LastActivityDate="2019-01-28T23:42:22.207" Title="Why can't I connect to an IBMQ device?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5300" PostTypeId="2" ParentId="5269" CreationDate="2019-01-28T23:08:37.493" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/releases/tag/0.7.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Terra 0.7&lt;/a&gt; changed visualization quite a bit. &lt;a href=&quot;https://medium.com/qiskit/terra-0-7-better-visualization-compilation-memorization-895b05b7197f&quot; rel=&quot;nofollow noreferrer&quot;&gt;This blog post&lt;/a&gt; from the Qiskit team might be helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's your code, updated for Qiskit Terra 0.7.2:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit&#xA;&#xA;c = ClassicalRegister(2)&#xA;q = QuantumRegister(2)&#xA;qc=QuantumCircuit(q, c)&#xA;&#xA;qc.measure(q, c)&#xA;&#xA;# draws an ascii circuit&#xA;print(qc)&#xA;&#xA;# Output:&#xA;#             ┌─┐&#xA;# q0_0: |0&amp;gt;───┤M├&#xA;#          ┌─┐└╥┘&#xA;# q0_1: |0&amp;gt;┤M├─╫─&#xA;#          └╥┘ ║&#xA;#  c0_0: 0 ═╬══╩═&#xA;#           ║&#xA;#  c0_1: 0 ═╩════&#xA;&#xA;# draws a circuit with Matplotlib &#xA;diagram = qc.draw(output=&quot;mpl&quot;)&#xA;&#xA;# if you'd like to save to a file&#xA;diagram.savefig(&quot;test.svg&quot;, format=&quot;svg&quot;)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the SVG that was generated (converted to PNG for StackExchange):&#xA;&lt;img src=&quot;https://i.stack.imgur.com/1iTEe.png&quot; width=&quot;364&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your second question... this sounds like something with your IDE's access to the library symbols. I don't have help for you there, except to say it's a fairly common problem. Good luck!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: This advice applies to Qiskit 0.7.x. Qiskit is rapidly evolving and you should expect breaking changes on new versions. You can find the release notes &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/CHANGELOG.rst&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Troubles installing Matplotlib/visualizations?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Per the &lt;a href=&quot;https://medium.com/qiskit/terra-0-7-better-visualization-compilation-memorization-895b05b7197f&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog post&lt;/a&gt;, you should be able to run:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;pip install qiskit[visualization]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it has worked for me in the past, it currently returns:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qiskit 0.7.2 does not provide the extra 'visualization'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, you can install the packages this &quot;extra&quot; &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/stable/setup.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;references&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;pip install matplotlib nxpd ipywidgets pydot&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, in the off chance you are using MacOS with &lt;code&gt;virtualenv&lt;/code&gt;, you may run into &lt;a href=&quot;https://matplotlib.org/faq/osx_framework.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this issue&lt;/a&gt;. I had to use &lt;code&gt;venv&lt;/code&gt; to get it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="52" LastEditorUserId="52" LastEditDate="2019-01-29T02:48:36.423" LastActivityDate="2019-01-29T02:48:36.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5301" PostTypeId="2" ParentId="5299" CreationDate="2019-01-28T23:42:22.207" Score="4" Body="&lt;p&gt;I was able to reproduce your issue by changing the key a few times... seems to be a bug.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way, I was able to resolve my issue by removing the &lt;code&gt;qiskitrc&lt;/code&gt; file.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;rm ~/.qiskit/qiskitrc&lt;/code&gt; (your location may vary)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, set the key again and you should be good.&lt;/p&gt;&#xA;" OwnerUserId="52" LastActivityDate="2019-01-28T23:42:22.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5302" PostTypeId="1" CreationDate="2019-01-29T04:59:58.987" Score="0" ViewCount="59" Body="&lt;p&gt;I am reading that entangled particles can share information across long distances and the speed is usually faster than the speed of light...so am I right in assuming that future communications in the world will be without satellites and cell phone towers? Two entangled computers can talk instantaneously ...say between New York and Mumbai?  I sit in New York and feed in &quot;A&quot; in my computer, that information shows up in my friend's computer in Mumbai? Only thing is these two computers (processors/monitors) need to be entangled during manufacture? &lt;/p&gt;&#xA;" OwnerUserId="5671" LastEditorUserId="26" LastEditDate="2019-01-29T08:25:13.000" LastActivityDate="2019-01-29T08:57:11.840" Title="Transmission of information over long distances" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5303" PostTypeId="2" ParentId="5302" CreationDate="2019-01-29T08:57:11.840" Score="5" Body="&lt;p&gt;No. As far as we know, entangled states do not permit faster than light communication. You might be able to use them for things like doubling bandwidth (see superdense coding) or sending quantum states, but that will all happen at the speed of light (or slower).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is true that entangled states do seem to know &lt;em&gt;something&lt;/em&gt; about the constituent elements faster than they ought to know. If the two parties make measurements on the entangled state, although the individual outcomes are random, the measurement results display correlations. However, these correlations between measurement results cannot be used to communicate anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing that must be emphasised is that it's not quite so simple as &quot;these two computers (processors/monitors) need to be entangled during manufacture&quot;. Every communication action that uses entanglement &lt;em&gt;consumes&lt;/em&gt; that entanglement. So, you need a constantly replenishing supply.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-29T08:57:11.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5304" PostTypeId="1" CreationDate="2019-01-29T13:00:20.003" Score="3" ViewCount="60" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1106.4267&quot; rel=&quot;nofollow noreferrer&quot;&gt;An optimal quantum algorithm to approximate the mean and its application for approximating the median of a set of points over an arbitrary distance&lt;/a&gt; Brassard presents a quantum algorithm for finding the mean output of a function &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$F(1,..,N) \implies [0,1]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in time &lt;span class=&quot;math-container&quot;&gt;$O(1/\text{error})$&lt;/span&gt;. The paper implies that an equivalent classical algorithm would take &lt;span class=&quot;math-container&quot;&gt;$O(1/\text{error}^2)$&lt;/span&gt; (actually it gives results for error in terms of time, but no matter). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classical algorithm is not actually given but I assume it would just be repeated sampling from &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; with error properties depending on the sample mean formula &lt;span class=&quot;math-container&quot;&gt;$\sigma_\bar{F}=\sigma_F/\sqrt{n}$&lt;/span&gt;. The validity of &lt;span class=&quot;math-container&quot;&gt;$\sigma_\bar{F}$&lt;/span&gt; therefore does not depend on the distribution of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;, although if we are interested in the distribution of &lt;span class=&quot;math-container&quot;&gt;$\bar{F}$&lt;/span&gt; then the distribution of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; becomes important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does Brassard's mean1 algorithm differ at all from the classical counterpart in its dependence on distribution of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;? i.e. the distribution does not matter so far as &lt;span class=&quot;math-container&quot;&gt;$\sigma_\bar{F}$&lt;/span&gt; is concerned but is important if we are interested in the distribution of the mean?&lt;/p&gt;&#xA;" OwnerUserId="5174" LastEditorUserId="26" LastEditDate="2019-01-29T13:17:16.540" LastActivityDate="2019-01-29T13:17:16.540" Title="Does Brassard's algorithm for calculating the mean make implicit assumptions on distribution?" Tags="&lt;algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5306" PostTypeId="2" ParentId="5293" CreationDate="2019-01-29T18:50:17.130" Score="5" Body="&lt;p&gt;This is essentially the same calculation I outlined in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5256/55&quot;&gt;this other answer&lt;/a&gt; (though it might not be immediately obvious).&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}\newcommand{\ketbra}[2]{\lvert#1\rangle\!\langle#2\rvert}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us denote with &lt;span class=&quot;math-container&quot;&gt;$\Pi_Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Pi_N=I-\Pi_Y$&lt;/span&gt; the projectors onto the &amp;quot;yes space&amp;quot; and the &amp;quot;no space&amp;quot;.&#xA;Given an initial state &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;, the goal is getting as close to a state in &lt;span class=&quot;math-container&quot;&gt;$\Pi_Y$&lt;/span&gt; as possible, as fast as possible.&lt;/p&gt;&#xA;&lt;p&gt;Because &lt;span class=&quot;math-container&quot;&gt;$\{\Pi_Y,\Pi_N\}$&lt;/span&gt; define a separation of the full space, any state can be decomposed using these operators. In particular, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ket\psi=\cos\theta\ket\alpha+\sin\theta\ket\beta,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is defined via &lt;span class=&quot;math-container&quot;&gt;$\cos\theta\equiv\|\Pi_Y\ket\psi\|$&lt;/span&gt;, while &lt;span class=&quot;math-container&quot;&gt;$\ket\alpha\equiv\Pi_Y\ket\psi/\cos\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\beta\equiv\Pi_N\ket\psi/\sin\theta$&lt;/span&gt; (I'm using a slightly different notation with the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; than the one in the OP, sorry about that).&lt;/p&gt;&#xA;&lt;p&gt;The Grover iterator is defined as &lt;span class=&quot;math-container&quot;&gt;$G=-S_\psi S_Y$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S_Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_\psi$&lt;/span&gt; are &lt;em&gt;reflections&lt;/em&gt; in state space, that is, operators which leave untouched some subspace and change the sign on everything else.&#xA;More specifically &lt;span class=&quot;math-container&quot;&gt;$S_Y$&lt;/span&gt; flips the &amp;quot;yes space&amp;quot;, while &lt;span class=&quot;math-container&quot;&gt;$S_\psi$&lt;/span&gt; flips the direction corresponding to the initial state &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; (that is, it leaves the direction of the initial state untouched and flips everything else).&#xA;Mathematically, these reflections can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_Y\equiv I - 2\Pi_Y, \qquad&#xA;S_\psi\equiv I - 2\ket\psi\!\langle\psi\rvert.$$&lt;/span&gt;&#xA;It follows that the Grover operator reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G=(I-2\ket\psi\!\langle\psi\rvert)(2\Pi_Y-I).$$&lt;/span&gt;&#xA;Expanding this product we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G=2\Pi_Y-I-4 \lvert\psi\rangle\!\langle\psi\rvert\Pi_Y + 2\ket\psi\!\langle\psi\rvert.$$&lt;/span&gt;&#xA;Expanding &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$\ket\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\beta$&lt;/span&gt;, and remembering the property of &lt;span class=&quot;math-container&quot;&gt;$\ket\alpha$&lt;/span&gt; that &lt;span class=&quot;math-container&quot;&gt;$\Pi_Y\ket\alpha=\ket\alpha$&lt;/span&gt;, you can readily verify that this expression becomes, after a bit of algebra, the following (let me use here the shorthand notation &lt;span class=&quot;math-container&quot;&gt;$c\equiv\cos\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s\equiv\sin\theta$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G=2\Pi_Y-I+2s^2\ketbra\beta\beta-2c^2 \ketbra\alpha\alpha +2cs (\ketbra\alpha\beta-\ketbra\beta\alpha).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now this represents a rotation in state space of some angle with respect to some axis, but because we are only interested in the action of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; on states spanned by the &lt;span class=&quot;math-container&quot;&gt;$\ket\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\beta$&lt;/span&gt; states, we need only analyse how &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; acts on these two states. We then readily get:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;G\ket\alpha&amp;amp;=-\cos(2\theta)\ket\alpha-\sin(2\theta)\ket\beta, \\&#xA;G\ket\beta&amp;amp;=\phantom{-}\sin(2\theta)\ket\alpha-\cos(2\theta)\ket\beta. \\&#xA;\end{align}&lt;/span&gt;&#xA;Collecting the corresponding amplitudes in a matrix, we conclude that the action of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; in the space spanned by &lt;span class=&quot;math-container&quot;&gt;$\ket\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\beta$&lt;/span&gt; can be represented as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G\doteq\begin{pmatrix}-\cos(2\theta) &amp;amp;\sin(2\theta)\\-\sin(2\theta) &amp;amp; -\cos(2\theta)\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that this shows that the result holds in a more general scenario that the one often used when first explaining Grover's algorithm.&#xA;You can however easily reduce to the standard situation (which you also use in your post) by having &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; be a balanced superposition of all basis states, and &lt;span class=&quot;math-container&quot;&gt;$\Pi_Y$&lt;/span&gt; a trace-1 projector (that is, a projector over a one-dimensional subspace).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Another derivation with different notation&lt;/h3&gt;&#xA;&lt;p&gt;Let us use the shorthand notation &lt;span class=&quot;math-container&quot;&gt;$\psi\equiv\ketbra\psi\psi$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y\equiv\Pi_Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N\equiv\Pi_N$&lt;/span&gt;. We then have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}G = (I-2\psi)(2Y-I)&#xA;= &amp;amp;Y(1-2\psi)Y - 2N\psi Y \\&#xA;&amp;amp; +2 Y\psi N -N(1-2\psi)N.&#xA;\end{align}&lt;/span&gt;&#xA;Then, specialising to the case &lt;span class=&quot;math-container&quot;&gt;$\ket\psi=\cos(\theta)\ket y+\sin(\theta)\ket n$&lt;/span&gt;, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G = Y(I - 2\cos^2(\theta) \ketbra y y)Y + \sin(2\theta)(\ketbra y n - \ketbra n y) \\&#xA;- N(I- 2 \sin^2(\theta) \ketbra n n)N,$$&lt;/span&gt;&#xA;and in particular its action on &lt;span class=&quot;math-container&quot;&gt;$\ket y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket n$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;G\ket y &amp;amp;= -\cos(2\theta)\ket y - \sin(2\theta)\ket n, \\&#xA;G\ket n &amp;amp;= \phantom{-}\sin(2\theta) \ket y - \cos(2\theta) \ket n.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-09T11:27:37.093" LastActivityDate="2020-08-09T11:27:37.093" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5307" PostTypeId="1" CreationDate="2019-01-29T19:09:12.863" Score="1" ViewCount="62" Body="&lt;p&gt;When I run a QASM program on a QE simulator, I get this error.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No handlers could be found for logger        &#xA;&quot;IBMQuantumExperience.IBMQuantumExperience&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What does this mean and how do I fix it?&lt;/p&gt;&#xA;" OwnerUserId="5676" LastEditorUserId="26" LastEditDate="2019-01-29T19:17:16.090" LastActivityDate="2019-01-29T19:17:16.090" Title="QE error: No handlers could be found for logger" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5308" PostTypeId="1" AcceptedAnswerId="5309" CreationDate="2019-01-29T19:41:20.493" Score="2" ViewCount="473" Body="&lt;p&gt;Is there a way to access the results of measurements 'per shot' performed on a backend such as one of the real IBM machines?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it can generate a histogram from the cumulative data, but I was wondering if it is possible to see what the measurement outcomes were for a particular shot out of the standard 1024.&lt;/p&gt;&#xA;" OwnerUserId="5679" LastEditorUserId="26" LastEditDate="2019-01-29T19:45:57.343" LastActivityDate="2019-01-30T02:26:54.227" Title="Qiskit: 'per shot' result" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5309" PostTypeId="2" ParentId="5308" CreationDate="2019-01-30T02:26:54.227" Score="1" Body="&lt;p&gt;There is indeed. You just need to use &lt;code&gt;get_memory()&lt;/code&gt; instead of &lt;code&gt;get_counts()&lt;/code&gt; (and also use a &lt;code&gt;memory=True&lt;/code&gt; flag in the execute function. It works with the local qasm simulator and the 5 qubit device (and not currently with the cloud-based qasm simulator or 14 qubit device).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example using it to generate a series of random bits.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;circ = QuantumCircuit(q, c)&#xA;&#xA;circ.h(q)&#xA;&#xA;circ.measure(q,c)&#xA;&#xA;job = execute(circ, Aer.get_backend('qasm_simulator'), shots=10024, memory=True)&#xA;data = job.result().get_memory()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-01-30T02:26:54.227" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5311" PostTypeId="1" CreationDate="2019-01-30T04:04:05.687" Score="2" ViewCount="146" Body="&lt;p&gt;In VQE we wish to minimize some cost function &lt;span class=&quot;math-container&quot;&gt;$F(\vec{x})$&lt;/span&gt; that is dependent on a quantum state &lt;span class=&quot;math-container&quot;&gt;$\left| \psi_\vec{x} \right&amp;gt;$&lt;/span&gt; which is prepared by a unitary &lt;span class=&quot;math-container&quot;&gt;$U(\vec{x})$&lt;/span&gt; depending on some (typically real) parameters &lt;span class=&quot;math-container&quot;&gt;$\vec{x} \in \mathbb{R}^n$&lt;/span&gt;. A typical example for the cost function is the energy expectation value of some hamiltonian, i.e. &lt;span class=&quot;math-container&quot;&gt;$F(\vec{x}) = \left&amp;lt; \psi_\vec{x} \right|H \left|\psi_\vec{x} \right&amp;gt;$&lt;/span&gt;. Usually I can't measure my cost function directly, but only learn about it by making more and more measurements. For optimization I need some accuracy to decide in which direction to take the next optimization step, but I don't want to take arbitrarily many samples before moving on, since each sample means preparing &lt;span class=&quot;math-container&quot;&gt;$\psi_\vec{x}$&lt;/span&gt; and measuring its energy w.r.t &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any research done, on what are optimal (in the sense of minimizing the number of calls to my quantum computer) sampling strategies for this kind of problem? Or what should I search for? &quot;optimizing functions from samples&quot; doesn't get me anywhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cheers,&#xA;Jan Lukas&lt;/p&gt;&#xA;" OwnerUserId="4850" LastActivityDate="2021-03-28T00:04:00.467" Title="Optimal sampling strategy for VQE" Tags="&lt;algorithm&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5315" PostTypeId="1" AcceptedAnswerId="5317" CreationDate="2019-01-30T13:21:55.213" Score="8" ViewCount="937" Body="&lt;p&gt;I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;quirk&lt;/a&gt;. Ideally I would like to generalise this to any simulator. The unitary matrix is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(t)=e^{-iHt}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I've found a way to decompose the Hamiltonian into the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(t)=A+B(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B(t)$&lt;/span&gt; can be implemented individually. (Although A is a non-unitary diagonal matrix consisting of 0s and 1s) One with a static, custom matrix gate and the other using a series of time dependent and standard gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a systematic way to reconstruct &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; generally? There is no limit on the number of ancillary gates &lt;/p&gt;&#xA;" OwnerUserId="5594" LastEditorUserId="5594" LastEditDate="2019-01-31T14:29:32.153" LastActivityDate="2019-03-09T09:16:44.670" Title="Is there any method of adding two operators in a circuit?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;&lt;quirk&gt;" AnswerCount="3" CommentCount="5" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5316" PostTypeId="2" ParentId="5315" CreationDate="2019-01-30T13:51:26.920" Score="10" Body="&lt;p&gt;Below is a recent paper by Gilyén et al on doing &quot;quantum matrix arithmetics&quot;, allowing to implement linear combinations of unitary operators. They consider the general case where the linear combination in itself might not be unitary. Since the linear combination in your case is unitary, maybe there's a more efficient way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1]: Gilyén, András, et al. &quot;Quantum singular value transformation and beyond: exponential improvements for quantum matrix arithmetics.&quot; arXiv preprint &lt;a href=&quot;https://arxiv.org/abs/1806.01838&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1806.01838&lt;/a&gt; (2018).&lt;/p&gt;&#xA;" OwnerUserId="282" LastEditorUserId="26" LastEditDate="2019-01-30T16:45:53.657" LastActivityDate="2019-01-30T16:45:53.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5317" PostTypeId="2" ParentId="5315" CreationDate="2019-01-30T16:59:33.150" Score="8" Body="&lt;p&gt;What you are trying to do is called Hamiltonian Simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your exponential can be split in a sum of unitary matrices, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5316/1386&quot;&gt;@smapers' answer&lt;/a&gt; guide you to a good algorithm: the Linear Combination of Unitary (LCU) algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to the paper linked by @smapers, here are some other papers/videos explaining LCU:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Maybe the first paper to present LCU: &lt;a href=&quot;https://arxiv.org/abs/1412.4687v1&quot; rel=&quot;noreferrer&quot;&gt;Simulating Hamiltonian dynamics with a truncated Taylor series (Dominic W. Berry, Andrew M. Childs, Richard Cleve, Robin Kothari, Rolando D. Somma, 2015)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper is quite concise but explains the idea behind this algorithm.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://youtu.be/-qSMUd3y4BY?t=1411&quot; rel=&quot;noreferrer&quot;&gt;A presentation given by Nathan Wiebe at a conference&lt;/a&gt;. He explains quickly what is LCU and how it works.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://youtu.be/mWg56DxtDy0?t=888&quot; rel=&quot;noreferrer&quot;&gt;A presentation given by Robin Kothari at the same conference&lt;/a&gt;. You should look the whole presentation from the beginning, but if you don't have the time I provided you a link directly to the part about LCU algorithm.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, a paper explaining in details how LCU works and how they implemented LCU for a very specific kind of Hamiltonian: &lt;a href=&quot;https://arxiv.org/abs/1711.10980v1&quot; rel=&quot;noreferrer&quot;&gt;Toward the first quantum simulation with quantum speedup (Andrew M. Childs, Dmitri Maslov, Yunseong Nam, Neil J. Ross, Yuan Su, 2017)&lt;/a&gt;. The parts about LCU are spread in the whole article, look at all the parts dealing with the TS (Taylor Series) algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Section 3.2 (page 4) for a 2-paragraph summary.&lt;/li&gt;&#xA;&lt;li&gt;Appendix C.2 (page 13) for an explanation of the TS/LCU algorithms.&lt;/li&gt;&#xA;&lt;li&gt;Appendix G (page 38) for an error analysis and for an explanation on how they implemented some sub-routines needed by the LCU algorithm.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;PS: there are &lt;strong&gt;plenty&lt;/strong&gt; of other algorithms to perform Hamiltonian simulation. If your exponential can be split into known unitary matrices, LCU is probably the best algorithm, but you should know that it is not the only algorithm capable of simulating Hamiltonian. You can find more links in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2497/1386&quot;&gt;one of my previous answers about Hamiltonian Simulation&lt;/a&gt;. If you think you need more links on Hamiltonian Simulation algorithms just let me know.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-01-30T16:59:33.150" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5318" PostTypeId="1" CreationDate="2019-01-30T17:32:47.303" Score="2" ViewCount="858" Body="&lt;p&gt;I am currently working on the Grover algorithm again. In many lectures and documents, as well as books, I noticed that there is always talk of looking for a single element of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; elements. Now I read to Nielsen that Grovers algorithm can also be used for multiple searches. For example if you are looking for &lt;span class=&quot;math-container&quot;&gt;$M&amp;gt;1$&lt;/span&gt; elements from &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now comes the problem, in Nielsen is e.g. said that the process does not change fundamentally. I tried an example by looking for a single element, you can see the result here, I have successively applied the individual steps of the algorithm:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Searched item: &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input: &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hadamard on n-bits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H|00\rangle=\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle+|11\rangle)$$&lt;/span&gt;&#xA;Apply &lt;span class=&quot;math-container&quot;&gt;$ U_f $&lt;/span&gt; to bits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|00\rangle-|01\rangle+|10\rangle+|11\rangle)$$&lt;/span&gt;&#xA;Hadamard on n-bits (again):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}(|00\rangle+|01\rangle+|10\rangle+|11\rangle-&#xA;|00\rangle+|01\rangle-|10\rangle+|11\rangle&#xA;+|00\rangle+|01\rangle-|10\rangle-|11\rangle&#xA;+|00\rangle-|01\rangle-|10\rangle+|11\rangle)&#xA;=\frac{1}{2}(|00\rangle+|01\rangle-|10\rangle+|11\rangle)$$&lt;/span&gt;&#xA;Phase Shift:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|00\rangle-|01\rangle+|10\rangle-|11\rangle)$$&lt;/span&gt;&#xA;Hadamard transform (again):&#xA;$\frac{1}{4}(|00\rangle+|01\rangle+|10\rangle+|11\rangle&#xA;-|00\rangle+|01\rangle-|10\rangle+|11\rangle&#xA;+|00\rangle+|01\rangle-|10\rangle-|11\rangle&#xA;-|00\rangle-|01\rangle-|10\rangle-|11\rangle)&#xA;=\frac{1}{4}(4|01\rangle)$$&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you see directly that the searched (single) element (&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;) comes out, the question is, what happens if I say we are looking for two elements e.g &lt;span class=&quot;math-container&quot;&gt;$|01\rangle, |10\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This is understandable for me as far as possible, especially that even at the end exactly one single element is in the register, that one has searched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now my question comes: What happens if I search for several elements? Let's say, how do you stay with the example and are you looking for another element? How about the individual steps of the algorithm and, most importantly, what is in the register afterwards?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am very much looking forward to your answers and hope that my question is clear and understandable. Thanks in advance!&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastActivityDate="2019-01-30T23:58:13.357" Title="Grover algorithm for more than one element" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5320" PostTypeId="2" ParentId="5318" CreationDate="2019-01-30T23:58:13.357" Score="2" Body="&lt;h2&gt;Firstly, the general case:&lt;/h2&gt;&#xA;&lt;p&gt;When looking for a single element, you apply the inversion &lt;span class=&quot;math-container&quot;&gt;$U_f = I - 2\left|\psi\rangle\langle\psi\right|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; is the searched-for element. When searching for &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; elements, forming a subset &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, this inversion becomes &lt;span class=&quot;math-container&quot;&gt;$$U_f = I - 2\sum_{x\in S}\left|x\rangle\langle x\right|,$$&lt;/span&gt; which is now an inversion about &lt;span class=&quot;math-container&quot;&gt;$\left|S\right&amp;gt; = \frac{1}{\sqrt M}\sum_{x\in S}\left|x\right&amp;gt;$&lt;/span&gt; for states in the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$\left|S\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the single element case, the angle &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; can be given by &lt;span class=&quot;math-container&quot;&gt;$\sin\gamma = \left&amp;lt;\psi|+\right&amp;gt; = \frac{1}{\sqrt N}$&lt;/span&gt;, with an initial angle between the starting state &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\gamma_0 = \frac{1}{2}\pi - \gamma$&lt;/span&gt;. After &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; iterations, the angle between the current state and the &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$$\gamma_T = \frac{1}{2}\pi - \left(2T+1\right)\sin^{-1}\frac{1}{\sqrt N},$$&lt;/span&gt; as after each iteration, the current state shifts by &lt;span class=&quot;math-container&quot;&gt;$2\gamma$&lt;/span&gt;. This gives a probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$$\sin^2\left(\left(2T+1\right)\sin^{-1}\frac{1}{\sqrt N}\right)$$&lt;/span&gt; and so we take &lt;span class=&quot;math-container&quot;&gt;$$T = \left\lfloor\frac{\pi\sqrt N}{4}\right\rfloor.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the multiple element case, this extends to &lt;span class=&quot;math-container&quot;&gt;$\sin\gamma = \left&amp;lt;S|+\right&amp;gt; = \sqrt{\frac{M}{N}}$&lt;/span&gt;, we get a &lt;strong&gt;probability of obtaining the state &lt;span class=&quot;math-container&quot;&gt;$\left|S\right&amp;gt;$&lt;/span&gt;&lt;/strong&gt; of &lt;span class=&quot;math-container&quot;&gt;$$\sin^2\left(\left(2T+1\right)\sin^{-1}\sqrt{\frac{M}{N}}\right)$$&lt;/span&gt;, giving &lt;span class=&quot;math-container&quot;&gt;$$T = \left\lfloor\frac{\pi}{4}\sqrt{\frac{N}{M}}\right\rfloor.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;The given example&lt;/h2&gt;&#xA;&lt;p&gt;We're looking for the 2 elements &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$M=2,\, N = 4\implies T=1$&lt;/span&gt;. Following the algorithm:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}H^{\otimes 2}\left|00\right&amp;gt; &amp;amp;= \frac{1}{2}\left(\left|00\right\rangle+\left|01\right\rangle+\left|10\right\rangle+\left|11\right\rangle\right)\\&#xA;U_fH^{\otimes 2}\left|00\right&amp;gt; &amp;amp;= \frac{1}{2}\left(\left|00\right\rangle-\left|01\right\rangle-\left|10\right\rangle+\left|11\right\rangle\right) \\&#xA;H^{\otimes 2}U_fH^{\otimes 2}\left|00\right&amp;gt; &amp;amp;= \left|11\right\rangle \\&#xA;-U_0H^{\otimes 2}U_fH^{\otimes 2}\left|00\right&amp;gt; &amp;amp;= -\left|11\right\rangle \\&#xA;-H^{\otimes 2}U_0H^{\otimes 2}U_fH^{\otimes 2}\left|00\right&amp;gt; &amp;amp;= \frac{1}{2}\left(-\left|00\right\rangle+\left|01\right\rangle+\left|10\right\rangle-\left|11\right\rangle\right).\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this specific case, this is obviously no more help than picking at random. Going back to the probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$\left|S\right&amp;gt;$&lt;/span&gt;, we have that &lt;span class=&quot;math-container&quot;&gt;$\sin^{-1}\frac{1}{\sqrt 2} = \frac{\pi}{4}$&lt;/span&gt; and that &lt;span class=&quot;math-container&quot;&gt;$$\sin^2\left(\frac{\pi}{4}\left(2T+1\right)\right) = \frac{1}{2},$$&lt;/span&gt; so the probability of obtaining the correct result is 1/2, as a result of &lt;span class=&quot;math-container&quot;&gt;$N=2M$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-01-30T23:58:13.357" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5321" PostTypeId="1" AcceptedAnswerId="5322" CreationDate="2019-01-31T01:50:47.173" Score="3" ViewCount="72" Body="&lt;p&gt;The R operation in Q# is listed by Microsoft in the documentation as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;operation R (pauli : Pauli, theta : Double, qubit : Qubit) : Unit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I try to use the following command in a Q# operation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;R(PauliX,0,Q1);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get an error, referencing the line of code for the R command:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;The type of the given argument does not match the expected type.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1 is of course a Qubit, so I don't see what could be causing the problem. I've also been having difficulty getting the R1 gate working, but I suspect for similar reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the relevant documentation, please visit &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.r&quot; rel=&quot;nofollow noreferrer&quot;&gt;R operation, Q# Docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5689" LastEditorUserId="2879" LastEditDate="2019-05-10T07:08:46.480" LastActivityDate="2019-05-10T07:08:46.480" Title="Type error creating R gate in Q#?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5322" PostTypeId="2" ParentId="5321" CreationDate="2019-01-31T01:59:39.907" Score="2" Body="&lt;p&gt;The second argument &lt;code&gt;theta&lt;/code&gt; has to be a &lt;code&gt;Double&lt;/code&gt;, and 0 is a constant of type &lt;code&gt;Int&lt;/code&gt;. Q# doesn't have implicit type casting, so you need to make sure your second argument is a &lt;code&gt;Double&lt;/code&gt;. If you're looking for a rotation by zero angle, you'll need to do &lt;code&gt;R(PauliX, 0.0, Q1);&lt;/code&gt;. Alternatively, you can use &lt;code&gt;ToDouble&lt;/code&gt; to cast an integer parameter to a &lt;code&gt;Double&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-31T01:59:39.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5323" PostTypeId="1" AcceptedAnswerId="5325" CreationDate="2019-01-31T06:09:05.243" Score="4" ViewCount="565" Body="&lt;p&gt;I know how to create controlled versions of gates like X, Y, Z. For example, a controlled X gate would be implemented by writing&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(Controlled X)([control],target);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've tried numerous times to create a controlled R1 gate with no success, and there are no examples available on the Q# documentation or elsewhere on the web from what I've seen. As an example of what I've attempted, I've tried&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;(Controlled R1)([control],theta,target);&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;The shape of the given tuple does not match the argument type.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I gather the issue is that an X gate does not require any additional parameters, whereas an angle needs to be specified for the R1 gate to be well defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the relevant documentation, please visit &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1&quot; rel=&quot;nofollow noreferrer&quot;&gt;R1 Operation, Q# Docs&lt;/a&gt;, and &lt;a href=&quot;https://docs.microsoft.com/quantum/techniques/operations-and-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;Operations and Functions, Q# Docs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5689" LastEditorUserId="2879" LastEditDate="2020-01-06T19:02:19.887" LastActivityDate="2020-01-06T19:02:19.887" Title="Creating controlled R1 gates in Q#?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5324" PostTypeId="2" ParentId="4827" CreationDate="2019-01-31T06:33:50.930" Score="2" Body="&lt;p&gt;Absolutely! BB84 can be implemented over LiFi. There are however certain constraints and inefficiencies involved, which will have to be taken into account for implementation - possibly leading to the usage of BB84 variants like Decoy State, with higher efficiencies than pure BB84.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A four non-orthogonal polarization basis encoded single photon would be very inefficient (mainly loss and complexity of implementation) primarily due to mobility of participants and ambient light noise. We will have to switch to phase encoding, RFI QKD protocol or the decoy state variant of BB84 as an alternate improvement strategy.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Aligning the transmitter and receiver to deliver weak coherent pulses will be challenging, assuming that the transmitter will be handheld or mobile.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Detector needs to be precisely placed and current cost implications will force us to implement a single detector/multiple transmitter system. This would imply that we have to have a multiplexing (and coordination) strategy for serving individual transmitters. Also, the efficiency shows significant variations on the positioning of the detector in the room (line of sight) and the field of view angle. Losses of the order of 30-50dB have been observed in experimental results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Hope the insight helps.&lt;/p&gt;&#xA;" OwnerUserId="5690" LastEditorUserId="5690" LastEditDate="2019-01-31T12:30:17.240" LastActivityDate="2019-01-31T12:30:17.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5325" PostTypeId="2" ParentId="5323" CreationDate="2019-01-31T06:52:52.060" Score="3" Body="&lt;p&gt;If the base operation takes several arguments, you need to enclose the corresponding arguments of the controlled version of the operation in parentheses to convert them into a single tuple. In your case, you need to call it as &lt;code&gt;(Controlled R1)([control], (theta, target));&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is covered in the &quot;Controlled&quot; section of &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/type-model#operation-and-function-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q# type model documentation&lt;/a&gt; with Rz gate used as an example. I wonder how to make this information more discoverable...&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-01-31T06:52:52.060" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5326" PostTypeId="1" AcceptedAnswerId="5329" CreationDate="2019-01-31T09:16:00.777" Score="3" ViewCount="97" Body="&lt;p&gt;In the last chapter of John Preskill's &lt;a href=&quot;http://www.theory.caltech.edu/~preskill/ph219/topological.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture Notes for Physics 219:&#xA;Quantum Computation&lt;/a&gt; (PDF), he mentions the following on pg.12.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This behavior is compatible with the spin-statistics connection: the&#xA;  angular momentum &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-anyon molecule satisfies&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-2\pi i J_n} = e^{-2\pi i n^2 J} = e^{i n^2 \theta}.$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, consider a molecule of two anyons, and imagine rotating&#xA;  the molecule counterclockwise by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. Not only does each anyon in&#xA;  the molecule rotate by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;; in addition one of the anyons revolves&#xA;  around the other. One revolution is equivalent to two successive&#xA;  exchanges, so that the phase generated by the revolution is&#xA;  &lt;span class=&quot;math-container&quot;&gt;$e^{i2\theta}$&lt;/span&gt;. The total effect of the two rotations and the&#xA;  revolution is the phase &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exp[i(\theta + \theta + 2\theta)] = e^{i4\theta}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not only does each anyon in the&#xA;molecule rotate by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;; in addition one of the anyons revolves around the&#xA;other. One revolution is equivalent to two successive exchanges so that&#xA;the phase generated by the revolution is &lt;span class=&quot;math-container&quot;&gt;$e^{i2\theta}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this possible? A molecule here is just a localized region of two close anyons in the given space. Rotating the &quot;molecule&quot; should just be equal to revolving the two anyons one complete orbit about each other, that must give me a phase of &lt;span class=&quot;math-container&quot;&gt;$e^{i2\theta}$&lt;/span&gt;.&#xA;What is meant by&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Not only does each anyon in the&#xA;  molecule rotate by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as I know, &quot;rotation&quot; of an anyon is no permutation in Topological QC. &#xA;What's the concept involved here with additional &lt;span class=&quot;math-container&quot;&gt;$e^{i2\theta}$&lt;/span&gt; phase that we are getting? &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2019-01-31T14:52:08.427" LastActivityDate="2019-01-31T15:08:17.037" Title="Topological anyonic molecule statistics" Tags="&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5327" PostTypeId="2" ParentId="5295" CreationDate="2019-01-31T09:38:52.500" Score="1" Body="&lt;p&gt;The weak measurement was primarily built as a tool for tomography for obvious reasons, to estimate and approximate the state statistically with the least disturbance. &#xA;They do not have much use in the conventional Quantum Circuit model and other formalisms because the measurement and readout are performed after all the gate operations are done on specific qubits, and because you require to extract the maximum information out of the measurement, there isn't any intrinsic requirement of a weak measurement. Also, in all conventional circuits, we have the state and register initialization only once, in the start of the protocol. This is the basic layout of most quantum algorithms in use. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there are recent few extended protocols where you require to preserve and re-initialize the qubits successively after readout, there comes the use of weak measurement wrt certain trade-off parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One such article which claims to increase efficiency using weak measurements is (without restarting a whole protocol every time): &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/13/5/053024/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://iopscience.iop.org/article/10.1088/1367-2630/13/5/053024/meta&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-01-31T09:38:52.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5328" PostTypeId="1" CreationDate="2019-01-31T11:23:59.247" Score="2" ViewCount="161" Body="&lt;p&gt;If I have a mutually commuting set of observables &lt;span class=&quot;math-container&quot;&gt;$\{A, B, C, D,...\}$&lt;/span&gt; and when we talk of simultaneous measurements of these observables, do we mean a single apparatus is required for simultaneous measurement or a series of apparatuses are required?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because &quot;simultaneous&quot; suggests that at the same instant knowing values of all observables.&lt;/p&gt;&#xA;" OwnerUserId="5667" LastEditorUserId="26" LastEditDate="2019-01-31T13:59:54.413" LastActivityDate="2019-01-31T14:00:37.523" Title="What does simultaneous measurement of a mutually commuting set of observables mean?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5329" PostTypeId="2" ParentId="5326" CreationDate="2019-01-31T11:50:18.363" Score="3" Body="&lt;p&gt;The spin-statistics theorem requires a particle's wave function to acquire the same phase when it is rotated by an angle of &lt;span class=&quot;math-container&quot;&gt;$2 \pi$&lt;/span&gt; about itself and when exchanged with an identical (indistinguishable) particle. For example, a fermion acquires a phase of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; both in exchange and self-rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, when we think of an anyon as a flux-charge entity, we have to think of it also as an extended object having an inner structure of a spinning body, or equivalently, when it rotates about its axis, its own charge rotates around its own flux.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The self-rotation explains the doubling of the topological phase of the anyon molecule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property is explained, possibly more clearly, by &lt;a href=&quot;https://www.lorentz.leidenuniv.nl/quantumcomputers/literature/Pachos.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pachos&lt;/a&gt;, (sections 2.1.2 and 4.1.6). The following figure explains the phase acquired in self-rotation is taken from section 2.1.2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cRT0M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cRT0M.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Pachos description of the figure:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(a)    Anyons can be described effectively as composite particles with an attached magnetic flux, and a ring with electric charge, &lt;span class=&quot;math-container&quot;&gt;$q.$&lt;/span&gt; When anyon 1 moves around anyon 2 along loop &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; its charge circulates the flux of the other anyon and the Aharonov-Bohm effect gives rise to a non-trivial statistical phase.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(b)    When the composite particle rotates around itself by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; it again acquires a phase factor as its charge circulates its flux, which can be attributed to a spin.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Abelian and non-Abelian anyons can be described by means of mathematical objects called ribbon categories. &lt;a href=&quot;https://www.lorentz.leidenuniv.nl/quantumcomputers/literature/Pachos.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pachos&lt;/a&gt; in section 4.1.6 (figure 4.9), shows how this ribbon model explains the spin statistics theorem, in an example when creation of an identical anyon-anti-anyon pair, their exchange, then their annihilation back to the vacuum is identical to replacing the exchange by a rotation of one anyon about itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eKbdA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eKbdA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Pachos description of the figure:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;An anyon &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; and an anti-anyon &lt;span class=&quot;math-container&quot;&gt;$\bar{q}$&lt;/span&gt; denoted with their worldribbons are pair-created, exchanged and then fused to the vacuum. The exchange process can be continuously deformed to rotating one of the anyons around itself by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. This equivalence can be nicely verified with a belt.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2019-01-31T15:08:17.037" LastActivityDate="2019-01-31T15:08:17.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5330" PostTypeId="2" ParentId="5328" CreationDate="2019-01-31T12:05:54.710" Score="2" Body="&lt;p&gt;A mutually commuting set of observables can be perfectly measured (in principle) simultaneously in the sense that they can be brought in the diagonal form to have the same eigenvector basis. &quot;Simultaneous&quot; here means the simultaneous sharing of the eigenvectors and not necessarily &quot;simultaneous in time&quot;. Hence, it can be thought to be a simultaneous measurement in time also, with different apparatus. And hence 'an apparatus' that can share the measurement operators constructed from the same eigenbasis can perfectly measure (project) them all perfectly. Such an apparatus can always be constructed for these observables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be confused with the position-momentum uncertainty relation where it is stated about the incompatible measurement 'in time'. But it essentially is the same phenomenon there because &lt;span class=&quot;math-container&quot;&gt;$\hat{x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{p}$&lt;/span&gt; do not commute and hence cannot be brought to the same eigenbasis at once. one can be measured making the other have great standard deviation and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, refer to &lt;a href=&quot;https://physics.stackexchange.com/questions/226038&quot;&gt;this question&lt;/a&gt; (precisely the same question asked on StackExchange Physics): &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2019-01-31T14:00:37.523" LastActivityDate="2019-01-31T14:00:37.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5331" PostTypeId="2" ParentId="5315" CreationDate="2019-01-31T12:17:57.350" Score="4" Body="&lt;p&gt;It seems that you need oblivious fixed point amplitude amplification. See Theorem 26-28 in the aforementioned paper: &lt;a href=&quot;https://arxiv.org/abs/1806.01838&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1806.01838 [quant-ph]&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first step, you can implement &lt;span class=&quot;math-container&quot;&gt;$\frac{A+B(t)}{2}$&lt;/span&gt; as a block of a unitary. This is however not a unitary itself, but then you can turn it into a unitary using oblivious fixed point amplitude amplification. If you also happen to know the (spectral) norm of &lt;span class=&quot;math-container&quot;&gt;$A+B(t)$&lt;/span&gt;, then ordinary oblivious amplitude amplification suffices.&lt;/p&gt;&#xA;" OwnerUserId="5692" LastEditorUserId="26" LastEditDate="2019-03-09T09:16:44.670" LastActivityDate="2019-03-09T09:16:44.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5332" PostTypeId="2" ParentId="4876" CreationDate="2019-01-31T13:07:58.000" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1411.5729&quot; rel=&quot;nofollow noreferrer&quot;&gt;Forrelation&lt;/a&gt; might be such a problem.  The question is &quot;Is a first Boolean function highly correlated with the Fourier transform of a second Boolean function?&quot;  This is solved with &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; quantum query but Aaronson and Ambainis showed that classically one needs &lt;span class=&quot;math-container&quot;&gt;$\Omega(\sqrt N /\log N)$&lt;/span&gt; random queries.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also the Quanta magazine &lt;a href=&quot;https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;- by the work of &lt;a href=&quot;https://eccc.weizmann.ac.il/report/2018/107/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Raz and Tal&lt;/a&gt; the problem is likely to be out of the polynomial hierarchy.  Considering Norbert Schuch's comment about &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\subseteq\mathsf{PSPACE}$&lt;/span&gt;, this may be about as good a separation as can be expected.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-01-31T13:07:58.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5333" PostTypeId="1" CreationDate="2019-01-31T13:18:33.753" Score="5" ViewCount="875" Body="&lt;p&gt;What is the difference between the D-Wave systems and the newly-born IBM Q System One?  &lt;/p&gt;&#xA;" OwnerUserId="5693" LastEditorUserId="26" LastEditDate="2019-01-31T14:10:49.780" LastActivityDate="2019-01-31T14:44:13.547" Title="D-Wave systems and IBM Q System One" Tags="&lt;physical-realization&gt;&lt;d-wave&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5334" PostTypeId="2" ParentId="5328" CreationDate="2019-01-31T13:55:00.837" Score="1" Body="&lt;p&gt;It depends a bit on the context, but the idea is that if two observables commute that means that measuring one will not affect measurement results of the other, and you can therefore think of the values of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in a given state as &quot;simultaneously existing&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that you can characterize a state by the measurement outcomes you will get if you measure it in the different bases. For example, you might have a state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; which gives outcome &quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&quot; if you measure the observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and outcome &quot;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;&quot; if you measure the observable &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and therefore you can assign to the state the labels &quot;&lt;span class=&quot;math-container&quot;&gt;$1_A,-1_B$&lt;/span&gt;&quot;, to represent this fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how this contrasts sharply with the case of noncommuting observables. If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; do &lt;em&gt;not&lt;/em&gt; commute, then measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; changes the results of measuring &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and vice versa. This means that you cannot meaningfully assign to a state labels representing what results you would get by measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, because the order in which you do that changes the kind of results you would get.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-01-31T13:55:00.837" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5335" PostTypeId="2" ParentId="5333" CreationDate="2019-01-31T14:35:51.343" Score="4" Body="&lt;p&gt;When referring to the commercial quantum computers of both parties, it is that both are based on a different quantum principles. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The D-Wave machine works via quantum annealing and is suited for optimization problems. The machine by IBM is a gate-based quantum computer, similar to how digital computers work at the elementary level. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the two quantum paradigms differ, it is also hard to compare them based on for instance the number of qubits (~2,000 vs. 20). The details of both machines can easily be found online. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2019-01-31T14:44:13.547" LastActivityDate="2019-01-31T14:44:13.547" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5336" PostTypeId="5" CreationDate="2019-01-31T14:49:03.410" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-31T14:49:03.410" LastActivityDate="2019-01-31T14:49:03.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5337" PostTypeId="4" CreationDate="2019-01-31T14:49:03.410" Score="0" Body="For questions about IBM's quantum computing processors and devices. For their cloud-computing service use the [ibm-q-experience] tag instead. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-13T21:47:06.513" LastActivityDate="2019-05-13T21:47:06.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5338" PostTypeId="1" AcceptedAnswerId="5339" CreationDate="2019-01-31T16:51:08.513" Score="1" ViewCount="95" Body="&lt;p&gt;What is the proof that any &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; quantum operator can be expressed in terms of the tensor product of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; number of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; quantum operators acting on a single qubit space each?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="26" LastEditDate="2019-02-01T21:53:19.303" LastActivityDate="2019-02-06T23:50:07.947" Title="Proof that $2^n \times 2^n$ operator be decomposed in terms of $2 \times 2$ operators" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5339" PostTypeId="2" ParentId="5338" CreationDate="2019-01-31T17:00:57.047" Score="4" Body="&lt;p&gt;I presume you mean a &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; quantum operator, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\sum_{x,y\in\{0,1\}^n}U_{xy}|x\rangle\langle y|.&#xA;$$&lt;/span&gt;&#xA;All we have to do is show that we can construct any &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\langle y|$&lt;/span&gt; using Pauli operators. But this is just the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bigotimes_{i=1}^n|x_i\rangle\langle y_i|,&#xA;$$&lt;/span&gt;&#xA;so provided I can create any &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle\langle y_i|$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x_i,y_i\in\{0,1\}$&lt;/span&gt; using Pauli matrices, I'm done. It's a simple exercise to check&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 0|=(\mathbb{I}+Z)/2\qquad |1\rangle\langle 1|=(\mathbb{I}-Z)/2&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 1|=(X+iY)/2\qquad |1\rangle\langle 0|=(X-iY)/2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-01-31T17:00:57.047" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5340" PostTypeId="1" CreationDate="2019-01-31T18:35:59.703" Score="6" ViewCount="651" Body="&lt;p&gt;I'm trying to implement Grover's algorithm in pyQuil, but I'm having trouble creating the oracle matrix given the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x=w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x)=0$&lt;/span&gt; otherwise. In most of the implementations I've seen, either a mysterious oracle function is called or the matrix representation is created using the knowledge of the index, which requires classical computation of all the &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; values, defeating the purpose of Grover search. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone show me exactly how to create in the matrix (in say pyQuil) when writing the algorithm from scratch without classically computing all of the &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; values? &lt;/p&gt;&#xA;" OwnerUserId="5694" LastEditorUserId="55" LastEditDate="2019-04-14T14:49:01.270" LastActivityDate="2019-04-14T14:49:01.270" Title="How to create the oracle matrix in Grover's algorithm?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;pyquil&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5341" PostTypeId="5" CreationDate="2019-01-31T18:41:13.667" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-31T18:41:13.667" LastActivityDate="2019-01-31T18:41:13.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5342" PostTypeId="4" CreationDate="2019-01-31T18:41:13.667" Score="0" Body="A Python library for quantum programming using Quil. http://docs.rigetti.com" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-01-31T18:41:13.667" LastActivityDate="2019-01-31T18:41:13.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5343" PostTypeId="2" ParentId="4017" CreationDate="2019-02-01T08:46:34.563" Score="5" Body="&lt;p&gt;Update on the subject: there are several implementations in the wild. I don't know if you still need them, but even if you don't it will hopefully be useful to other people.&lt;/p&gt;&#xA;&lt;p&gt;I chose to list the implementations by &amp;quot;provenance&amp;quot; rather than by the algorithm used because there are not that much implementations. This may change in the future.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Qiskit-aqua&lt;/strong&gt;: Qiskit is the library of IBM for quantum computing. &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit-aqua&lt;/a&gt; is the part of the library that deals with quantum algorithms.&lt;/p&gt;&#xA;&lt;p&gt;The Qiskit-aqua implementation can only simulate Hamiltonians that are a sum of hermitian matrices that can be written as tensor products of Pauli operators. To do so, they used the Trotter-Suzuki formula.&lt;/p&gt;&#xA;&lt;p&gt;The documentation is available &lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.aqua.operators.html#module-qiskit.aqua.operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;simcount&lt;/strong&gt;: Implementation of 3 hamiltonian simulation algorithms for a specific kind of hamiltonian. Based on &lt;a href=&quot;https://www.mathstat.dal.ca/%7Eselinger/quipper/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quipper&lt;/a&gt;. All their work is explained in the paper &lt;a href=&quot;https://arxiv.org/abs/1711.10980&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toward the first quantum simulation with quantum speedup (Andrew M. Childs, Dmitri Maslov, Yunseong Nam, Neil J. Ross, Yuan Su, 2017)&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The 3 algorithms (and their variations) implemented in the repository have been optimised for a very specific Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$$H = \sum_{j=1}^n \left( \vec{\sigma}_j \cdot{} \vec{\sigma}_{j+1} + h_j \sigma_j^z \right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The implementations are available &lt;a href=&quot;https://github.com/njross/simcount&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;QatHS&lt;/strong&gt; (disclaimer: I did this one): Implementation of the Trotter-Suzuki formula along with Hamiltonian Simulation algorithms for black-box oracles. The oracle-based Hamiltonian Simulation algorithms are based on a Master thesis &lt;a href=&quot;https://prism.ucalgary.ca/handle/1880/41417&quot; rel=&quot;nofollow noreferrer&quot;&gt;available here&lt;/a&gt;  (requires to ask for the PDF, I could not find it elsewhere).&lt;/p&gt;&#xA;&lt;p&gt;In short: you can simulate any Hermitian matrix as long as you have an oracle for each of the matrices in your decomposition. Integer-weighted matrices have been extensively tested with the wave equation solver implementation, fixed-points weighted matrices should also work but have not been tested as thoroughly.&lt;/p&gt;&#xA;&lt;p&gt;The implementation is available &lt;a href=&quot;https://gitlab.com/cerfacs/qaths&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2020-09-25T07:35:12.807" LastActivityDate="2020-09-25T07:35:12.807" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5344" PostTypeId="2" ParentId="5340" CreationDate="2019-02-01T09:05:37.440" Score="8" Body="&lt;p&gt;For most functions &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, there is nothing better than calculating all the values. After all, for most functions, there is no better way of defining the function than giving its truth table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably, you want to talk about the relatively small fraction of cases in which the function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; has some reasonably compact description. In that case, you should be able to design a classical circuit for its implementation. If you can do that, you can make the implementation reversible. And, once you've done that, it's no problem programming that reversible implementation into a quantum computer to act in the place of your oracle. And the whole point of Grover's search is to minimise the number of calls to the oracle, and hence minimise the number of times the function is evaluated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, some philosophical questions may arise, some of which were discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2110/1837&quot;&gt;here&lt;/a&gt;. Particularly regarding search, remember that the function would not typically be defined by having the marked item programmed into it directly, just that the function can run and recognise the marked item. You can think of this a bit like factoring. If I give you a large composite number of factor, you can run some code to determine if a particular integer is a factor or not. It doesn't mean that the code you've written already knows what the factors are.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-01T09:05:37.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5345" PostTypeId="1" AcceptedAnswerId="5348" CreationDate="2019-02-01T09:40:40.853" Score="3" ViewCount="265" Body="&lt;p&gt;What is the Hamiltonian of a single ion in an ion trap? How to derive that formula? Also, how exactly can we create superposition by sending laser beams? I am interested in knowing the exact solutions of the Schrodinger's equation in this scenario. It will be helpful if someone can answer them or at least point to a book where I can find the answer. &lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="26" LastEditDate="2019-02-01T22:15:20.433" LastActivityDate="2019-02-01T22:15:20.433" Title="Ion trap qubit Hamiltonian calculation manipulation" Tags="&lt;quantum-state&gt;&lt;trapped-ion&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5346" PostTypeId="1" AcceptedAnswerId="5349" CreationDate="2019-02-01T11:17:17.193" Score="4" ViewCount="395" Body="&lt;p&gt;I am currently reading various survey papers in Quantum Machine Learning, such as &quot;Quantum Machine Learning&quot; by Biamonte, Wittek, Pancotti, Rebentrost, Wiebe, and Lloyd. To me, it is not clear when they are talking about Adiabatic Quantum Computing or the Logic Gate approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&#xA;&quot;The quantum basic linear algebra subroutines (BLAS)—Fourier transforms, finding eigenvectors and eigenvalues, solving linear equations—exhibit exponential quantum speedups over their best known classical counterparts [8, 9, 10].&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Are these people always talking about one of the two technologies (if so, which?), or are they discussing them interchangeably?&lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="26" LastEditDate="2019-02-01T21:46:07.047" LastActivityDate="2019-02-04T08:33:57.793" Title="How to recognize if a paper is talking about quantum annealing or gate logic?" Tags="&lt;quantum-gate&gt;&lt;adiabatic-model&gt;&lt;machine-learning&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5347" PostTypeId="2" ParentId="5346" CreationDate="2019-02-01T11:59:44.973" Score="6" Body="&lt;p&gt;I've not looked at those papers specifically, but there are several different models for quantum computation (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/74/1837&quot;&gt;here&lt;/a&gt;), including the gate model and the adiabatic model, which are polynomial time equivalent. That means if one has an exponential speedup, so does the other. The discussion should be interchangeable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The title, if not the question body, also asks about quantum annealing. So, to summarise the comments:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Adiabatic QC is a special case of quantum annealing. So, in that sense, since adiabatic is one of those interchangeable ones, so is quantum annealing.&lt;/li&gt;&#xA;&lt;li&gt;However, when people talk about quantum annealing, they are often thinking beyond the adiabatic case, with non-adiabatic trajectories, finite temperature etc. Here, the answer is simply &lt;em&gt;we don't know&lt;/em&gt; if it is polynomial time equivalent with the other models. Many people believe that it has equivalent computational power, but it has not been proven.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-04T08:33:57.793" LastActivityDate="2019-02-04T08:33:57.793" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5348" PostTypeId="2" ParentId="5345" CreationDate="2019-02-01T12:51:57.560" Score="2" Body="&lt;p&gt;The general Hamiltonian of a trapped ion is simply its kinetic, vibrational energy along with the potential energy interaction (Coulombic) with other ions (if in the neighborhood):&#xA;(For a single trapped ion)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H=\frac{|p|^2}{2m}+\frac{m}{2}(\omega_x^2x^2+\omega_y^2y^2+\omega_z^2z^2)&#xA;\end{equation}&lt;/span&gt;&#xA;where usually &lt;span class=&quot;math-container&quot;&gt;$\omega_x,\omega_y\ll \omega_z$&lt;/span&gt; (nearly a 1D vibrational mode).&#xA;But this not via which the quantum information processing is achieved. In principle, the aim is to minimize the effect of this Hamiltonian and cool the ion via &lt;em&gt;laser cooling&lt;/em&gt; to minimize the splitting levels via this Hamiltonian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key to quantum computation lies in the atomic structure (as @DaftWullie pointed out) of the ion, which is coupled to a laser. We usually isolate the atomic levels and tune the laser with the transition frequency. The effective way is to extract out a &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; Hilbert space associated with the &lt;em&gt;hyperfine&lt;/em&gt; structure of the atom where nuclear and electronic spin both interact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to isolate two internal states in an approximately harmonic potential, which is used for multiple ions (qubits). For single qubit operations, for example, apply a EM field with a sharp frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt;, the transition frequency of internal states, it turns on an internal Hamiltonian &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_{int}=\frac{\hbar \omega_0}{2}(S_+ e^{i\phi}+S_-e^{-i\phi})&#xA;\end{equation}&lt;/span&gt;&#xA;which will give rise to a superpositon of the two internal states. &lt;span class=&quot;math-container&quot;&gt;$S_\pm$&lt;/span&gt; are the spin operators governing the internal total spin states and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is the phase associated (rotation). From this by tuning the parameters involved, we can form single qubit gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure is similar for multi-qubit gates where we couple both the ions by a known mechanism, like the laser coupling and we formulate the Hamiltonian associated with the given transitions. Gates like the Controlled-unitary are somewhat hard to achieve because of their non-local nature. All these Hamiltonians can be easily solved analytically in the matric form (writing the Hamiltonian in the basis of the possible ket states involved with the given isolated levels). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In experiment it is very difficult to achieve a particular transition without other couplings involved and hence the ion is cooled to the order of &lt;span class=&quot;math-container&quot;&gt;$mK$&lt;/span&gt; and tuned at very fine frequencies. The scalability is very hard to achieve in experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To my knowledge, the best place to start it is the &lt;em&gt;Nielsen and Chuang&lt;/em&gt; book, Physical Realization chapter from pg.309 onwards. &#xA;Also refer to this webpage by Oxford (who have a great group in Ion Trap experiments): &lt;a href=&quot;https://www2.physics.ox.ac.uk/research/ion-trap-quantum-computing-group/intro-to-ion-trap-qc&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www2.physics.ox.ac.uk/research/ion-trap-quantum-computing-group/intro-to-ion-trap-qc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Watch this talk: &lt;a href=&quot;https://www.youtube.com/watch?v=WOQ_jWe62EA&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=WOQ_jWe62EA&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Read via the wikipage: &lt;a href=&quot;https://en.wikipedia.org/wiki/Trapped_ion_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Trapped_ion_quantum_computer&lt;/a&gt; and few references therein. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if time permits, refer to &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0370157308003463&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/science/article/pii/S0370157308003463&lt;/a&gt; which was one of the foundational work in this area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-02-01T12:51:57.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5349" PostTypeId="2" ParentId="5346" CreationDate="2019-02-01T16:21:49.483" Score="3" Body="&lt;p&gt;In this particular one (by quickly overlooking), they refer mostly to the logic gate approach. But nothing prevent them from talking about both. It depends on the algorithm and on which original model it was thought/designed on. Generally, if it is linear algebra based, it will be the logic gate approach. If they refer to optimization of a QUBO, they will talk about a D-Wave quantum annealer (should be mentionned in an introduction part), a specific case of quantum annealing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to be sure which one for each algorithm, the best way when it is not clear is looking at the references. That helped me a lot figure out details like that.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-02-01T16:21:49.483" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5350" PostTypeId="5" CreationDate="2019-02-01T21:47:47.953" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-01T21:47:47.953" LastActivityDate="2019-02-01T21:47:47.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5351" PostTypeId="4" CreationDate="2019-02-01T21:47:47.953" Score="0" Body="A trapped ion quantum computer is one proposed approach to a large-scale quantum computer. Ions, or charged atomic particles, can be confined and suspended in free space using electromagnetic fields. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-01T21:47:47.953" LastActivityDate="2019-02-01T21:47:47.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5352" PostTypeId="5" CreationDate="2019-02-01T22:24:06.757" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-01T22:24:06.757" LastActivityDate="2019-02-01T22:24:06.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5353" PostTypeId="4" CreationDate="2019-02-01T22:24:06.757" Score="0" Body="Quantum contextuality is a foundational concept in quantum mechanics stating that the outcome one observes in a measurement is dependent upon what other measurements one is trying to make. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-01T22:24:06.757" LastActivityDate="2019-02-01T22:24:06.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5355" PostTypeId="1" CreationDate="2019-02-02T16:46:48.143" Score="3" ViewCount="51" Body="&lt;p&gt;An article entitled &quot;&lt;a href=&quot;https://www.nature.com/articles/s42005-019-0110-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental data from a quantum computer verifies the generalize Pauli exclusion principle&lt;/a&gt;&quot; by Scott E. Smart, David I. Schuster, and David A. Mazziotti has just appeared&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the study, they generate sets of random pure states of 3 fermions in 6 orbitals and examine their 1-RDM's (reduced density matrices). For this purpose, they employ &quot;the IBM Quantum Experience devices (ibmqx4 and ibmqx2), available online, in particular, the 5-transmon quantum computing device&quot;. Can one adapt their approach to testing the &quot;separability probability&quot; question (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804024&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9804024&lt;/a&gt;) in any form (&lt;a href=&quot;https://www.researchgate.net/publication/231041509&quot; rel=&quot;nofollow noreferrer&quot;&gt;fermionic&lt;/a&gt;, or otherwise)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, can the conjectures that the two-qubit separability probabilities are &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\frac{25}{341}$&lt;/span&gt; or &#xA;&lt;span class=&quot;math-container&quot;&gt;$1-\frac{256}{27 \pi^2}$&lt;/span&gt;, depending upon the choice of Hilbert-Schmidt, Bures or operator monotone function &lt;span class=&quot;math-container&quot;&gt;$\sqrt{x}$&lt;/span&gt; measures (&lt;a href=&quot;https://arxiv.org/abs/1701.01973&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1701.01973&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1901.09889&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1901.09889&lt;/a&gt;)  be evaluated? If one could generate random (using Fubini-Study measure) pure four-qubit states, and find the reduced two-qubit systems, then perhaps one could examine the Hilbert-Schmidt instance (&lt;a href=&quot;https://www.cambridge.org/core/books/geometry-of-quantum-states/46B62FE3F9DA6E0B4EDDAE653F61ED8C&quot; rel=&quot;nofollow noreferrer&quot;&gt;p. 422 of Bengtsson-Zyczkowski monograph&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that there is 2011 and subsequent work of J. A. Miszczak (&lt;a href=&quot;https://arxiv.org/abs/1102.4598&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1102.4598&lt;/a&gt;) concerning the (Mathematica) generation of random numbers through quantum processes, and their use in the production of random quantum states (such as I am seeking)--through standard (Ginibre-ensemble/random matrix theory) algorithms. But, I think, this is (presently?) comparatively slow in relation to pseudo-random means. Also, can the random states be generated &quot;more directly&quot; with the IBM devices? (Smart, Schuster, Mazziotti prepare initial pure states and then perform &quot;arbitrary unitary transformations&quot; [&quot;generated on the quantum computer&quot;] to obtain random pure states.)&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-02-02T16:55:07.953" LastActivityDate="2019-02-02T16:55:07.953" Title="Can &quot;experimental data from a quantum computer&quot; be used to test separability probability conjectures?" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;entanglement&gt;&lt;experiment&gt;&lt;ibm&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5356" PostTypeId="1" AcceptedAnswerId="5358" CreationDate="2019-02-02T20:58:53.027" Score="5" ViewCount="131" Body="&lt;p&gt;Measurements create entropy as we all know. But computers themselves are deterministic machines. Most devices use processor heat as a source for random number generation as far as I know - which has lead to problems in the past. Any cryptographic key is only as good as the entropy source from which its content originate. When I try to collect binary entropy as results from a quantum measurement it is still a simulation - yet for huge numbers it converges well to the distribution I should obtain. So how does the simulator collect the entropy for the measurement outcomes?&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="26" LastEditDate="2019-02-02T21:18:37.993" LastActivityDate="2019-02-02T21:46:04.750" Title="Where does the Xmon simulator from Googles cirq framework its entropy from?" Tags="&lt;measurement&gt;&lt;simulation&gt;&lt;cirq&gt;&lt;entropy&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5357" PostTypeId="2" ParentId="1269" CreationDate="2019-02-02T21:05:10.383" Score="1" Body="&lt;p&gt;Easiest thing talk about the algorithms for each architecture and the difference between physical and logical qubits. As far as I know we do not know yet how to perform quantum error correction efficiently on an adiabatic machine. Most computations on these devices are just repeated lots and lots of times without much error correction. For the gate model error correcting codes exist - leading to a smaller number of logical qubits. On the other hand the gate model is universal so you can run algorithms on it which are proved to be faster than any known classical counterpart (notably Grover and Shor). Thus the gate model is much more powerful and still worth investigating.&lt;/p&gt;&#xA;" OwnerUserId="5705" LastActivityDate="2019-02-02T21:05:10.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5358" PostTypeId="2" ParentId="5356" CreationDate="2019-02-02T21:46:04.750" Score="5" Body="&lt;p&gt;Cirq uses numpy's pseudo random number generator to pick measurement results, e.g. here is code from &lt;code&gt;XmonStepper.simulate_measurement&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    def simulate_measurement(self, index: int) -&amp;gt; bool:&#xA;        [...]&#xA;        prob_one = np.sum(self._pool.map(_one_prob_per_shard, args))&#xA;        result = bool(np.random.random() &amp;lt;= prob_one)&#xA;        [...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Cirq simulations are not intended to be a source of cryptographically secure entropy.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-02T21:46:04.750" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5359" PostTypeId="1" AcceptedAnswerId="5368" CreationDate="2019-02-03T11:21:51.520" Score="4" ViewCount="160" Body="&lt;h1&gt;Context:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/P3mJM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P3mJM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Three coins on the table. Each is either heads or tails. You can&#xA;  uncover any one of the three coins, revealing whether it is heads or&#xA;  tails but then you choose two the other two coins disappear --- you'll&#xA;  never know whetehr those two other coins are heads or tails.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm a bit confused by Preskill's description of a Bell experiment &lt;sup&gt;[&lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt;]&lt;/sup&gt;. He describes a game, using correlated coins. &lt;strong&gt;Donald&lt;/strong&gt; sitting in Denver manufactures three pairs of correlated coins. He then sends one set of coins (containing coin from each correlated pair) to &lt;strong&gt;Alice&lt;/strong&gt; in Pasadena and another set of coins to &lt;strong&gt;Bob&lt;/strong&gt; in Waterloo. Now according to the rules of the game: if &lt;strong&gt;Alice&lt;/strong&gt; or &lt;strong&gt;Bob&lt;/strong&gt; uncover any one coin from their set (to check if it's head or tails), the other two coins instantaneously disappear (and we can't ever know the states of those disappeared coins). Also, if &lt;strong&gt;Alice&lt;/strong&gt; and &lt;strong&gt;Bob&lt;/strong&gt; uncover the same number coin from their respective set (say if both choose coin number 2), they &lt;em&gt;always&lt;/em&gt; observe the same side (i.e. either both get heads or both get tails).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0UZg9m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0UZg9m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are many sets of coins, identically prepared by &lt;strong&gt;Donald&lt;/strong&gt; (in Denver). For each of the three coins, in Pasadena or Waterloo, the probability is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; that the coin is heads or tails. But, if &lt;strong&gt;Alice&lt;/strong&gt; and &lt;strong&gt;Bob&lt;/strong&gt; both uncover the same coin, the outcomes are perfectly correlated. We know it always works, we've checked it a million times. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6Remh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Remh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Bob&lt;/strong&gt; reasons: &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;We know the correlation is always perfect. &lt;/li&gt;&#xA;  &lt;li&gt;And surely what &lt;strong&gt;Alice&lt;/strong&gt; does in Pasadena exerts no influence on what Bob finds when he uncovers a coin in Waterloo.&lt;/li&gt;&#xA;  &lt;li&gt;So, in effect, &lt;strong&gt;Alice&lt;/strong&gt; and &lt;strong&gt;Bob&lt;/strong&gt;, working together can learn the outcome when any two of the coins are uncovered in Waterloo.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/John_Stewart_Bell&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Bell&lt;/strong&gt;&lt;/a&gt; reasons:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{x,y,z \in \{H,T\}} P(x,y,z)= 1$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(1,2)_{\text{same}} = P(HHH) + P(HHT) + P(TTH) + P(TTT),$$&lt;/span&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$P(2,3)_{\text{same}} = P(HHH) + P(THH) + P(HTT) + P(TTT),$$&lt;/span&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$P(1,3)_{\text{same}} = P(HHH) + P(HTH) + P(THT) + P(TTT).$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore P(1,2)_{\text{same}} + P(2,3)_{\text{same}} +&#xA; P(1,3)_{\text{same}} = 1 + 2P(HHH) + 2P(TTT) \geq 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I do understand that the sum of these three probabilities is greater than one because there are some &lt;em&gt;constraints&lt;/em&gt; already involved and that the three cases: &lt;span class=&quot;math-container&quot;&gt;$(1,2)_{\text{same}}, (2,3)_{\text{same}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(1,3)_{\text{same}}$&lt;/span&gt; are &lt;em&gt;not&lt;/em&gt; mutually exclusive; like if we uncover all three coins at least two have to be the same. So naturally, there's some redundancy leading to a sum of probabilities that is greater than one!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Alice&lt;/strong&gt; and &lt;strong&gt;Bob&lt;/strong&gt; repeat the measurement a million times, and found ...&lt;sup&gt;[&lt;span class=&quot;math-container&quot;&gt;$\dagger\dagger$&lt;/span&gt;]&lt;/sup&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$P(1,2)_{\text{same}} = P(2,3)_{\text{same}} = P(1,3)_{\text{same}} = \frac{1}{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;How could &lt;strong&gt;Bell&lt;/strong&gt;'s prediction be wrong? &lt;strong&gt;Bell&lt;/strong&gt; assumed the probability distribution describes our ignorance about the actual state of the coins under the black covers, and there is no &quot;action at a distance&quot; between Pasadena and Waterloo. The lesson:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;&lt;p&gt;Don't reason about counterfactuals (&quot;I found H when I uncovered 1; I would have found either H or T if I had uncovered 2 instead, I just don't know which.&quot;). When the measurements are incompatible, then if we do measurement 1 we can't speak about what would have happened if we had done measurement 2 instead.  &lt;/p&gt;&lt;/li&gt;&#xA;  &lt;li&gt;&lt;p&gt;Quantum randomness is not due to ignorance. Rather, it is intrinsic, occuring even when we have the most complete knowledge that Nature will allow.&lt;/p&gt;&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;Note that the quantum correlations do not allow &lt;strong&gt;A&lt;/strong&gt; and &lt;strong&gt;B&lt;/strong&gt; to send signals to one another. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I believe Preskill's actually referring to shared pairs of &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell states&lt;/a&gt; between &lt;strong&gt;Alice&lt;/strong&gt; and &lt;strong&gt;Bob&lt;/strong&gt; here rather than the coin setup. I'll try to clarify the difference between the two setups. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Classical Coin Game:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If we were to consider the setup using classical coins as described in the question, the probabilities would have turned out to be considerably different. It is given that the same numbered coins on Alice's and Bob's side always turn out to have the same side. Now, the important point here is that &quot;coins&quot; can't exist in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5285&quot;&gt;superposition&lt;/a&gt;, unlike qubits! Their only states of existence are either heads or tails. So according to the correlation described in the question if we can know the state of all the coins on &lt;strong&gt;Alice&lt;/strong&gt;'s side we already know the the state of all the coins on &lt;strong&gt;Bob&lt;/strong&gt;'s side! That is, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(1,2)_{\text{same}} = P(HHH) + P(HHT) + P(TTH) + P(TTT)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\implies P(1,2)_{\text{same}}= \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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, &lt;span class=&quot;math-container&quot;&gt;$P(2,3)_{\text{same}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(1,3)_{\text{same}}$&lt;/span&gt; are also &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;! As you can see, the answer isn't &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt; in this setup.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The Quantum Game:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Here &lt;strong&gt;Alice&lt;/strong&gt; and &lt;strong&gt;Bob&lt;/strong&gt; share three &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; Bell pairs. I'll denote &lt;strong&gt;Alice&lt;/strong&gt;'s qubits with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (numbered &lt;span class=&quot;math-container&quot;&gt;$1,2,3$&lt;/span&gt;) and &lt;strong&gt;Bob&lt;/strong&gt;'s qubits with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (numbered &lt;span class=&quot;math-container&quot;&gt;$1,2,3$&lt;/span&gt;). The overall state is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Phi^+\rangle \otimes |\Phi^+\rangle \otimes |\Phi^+\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \small{= \frac{1}{\sqrt{2}}(|0\rangle_{A1}|0\rangle_{B1} + |1\rangle_{A1} |1\rangle_{B1}) \otimes \frac{1}{\sqrt{2}}(|0\rangle_{A2}|0\rangle_{B2} + |1\rangle_{A2} |1\rangle_{B2}) \otimes \frac{1}{\sqrt{2}}(|0\rangle_{A3}|0\rangle_{B3} + |1\rangle_{A3} |1\rangle_{B3})}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, in this quantum case too:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(1,2)_{\text{same}} = P(\text{A1} = |0\rangle \ \cap \ \text{B2} = |0\rangle) + P(\text{A1} = |1\rangle \ \cap \ \text{B2} = |1\rangle) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = (\frac{1}{\sqrt 2})^2.(\frac{1}{\sqrt 2})^2 + (\frac{1}{\sqrt 2})^2.(\frac{1}{\sqrt 2})^2 = \frac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Question:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;So I'm not quite sure how Preskill came up with the probabilities &lt;span class=&quot;math-container&quot;&gt;$$P(1,2)_{\text{same}} = P(2,3)_{\text{same}} = P(1,3)_{\text{same}} = \frac{1}{4}$$&lt;/span&gt; in either the quantum case or the classical case. Could someone clarify? I did go through the proof for &lt;span class=&quot;math-container&quot;&gt;$P(X=Y) = \frac{1}{4}$&lt;/span&gt; in the &lt;a href=&quot;https://en.wikiversity.org/wiki/Bell%27s_theorem/Introduction#Probability_of_passing_at_30_and_60_degrees&quot; rel=&quot;nofollow noreferrer&quot;&gt;light polarization experiment&lt;/a&gt;, but in that experiment &lt;span class=&quot;math-container&quot;&gt;$P(X=Y)$&lt;/span&gt; means &lt;em&gt;given photon passed X, the probability that it passes Y is&lt;/em&gt;. There they didn't mention &lt;em&gt;anything&lt;/em&gt; about Bell pairs, and so I can't quite relate the two experiments. Here the situation is rather different; we want to know &lt;em&gt;what is the probability of the two qubits &lt;span class=&quot;math-container&quot;&gt;$\text{A1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{B2}$&lt;/span&gt; having the same state after consecutive or simultaneous measurements?&lt;/em&gt; And for this question I don't quite see how the answer is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[&lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt;]: &lt;a href=&quot;https://youtu.be/Q4xBlSi_fOs?t=3054&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Preskill - Introduction to Quantum Information (Part 1) - CSSQI 2012 (timestamp included)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[&lt;span class=&quot;math-container&quot;&gt;$\dagger \dagger$&lt;/span&gt;]: &lt;a href=&quot;https://youtu.be/PJ6HbxBKZ68?t=8&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Preskill - Introduction to Quantum Information (Part 2) - CSSQI 2012 (timestamp included)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-30T06:32:13.710" LastActivityDate="2019-03-30T06:32:13.710" Title="Why is $P(1,2)_{\text{same}} = \frac{1}{4}$ and not $\frac{1}{2}$ in Preskill's Bell experiment?" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;games&gt;&lt;correlations&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5361" PostTypeId="2" ParentId="5287" CreationDate="2019-02-03T12:44:35.740" Score="5" Body="&lt;p&gt;It's unlikely. And even if there is, they've not announced it publicly. Most of the private companies and startups in this area are still in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Stealth_mode&quot; rel=&quot;noreferrer&quot;&gt;stealth mode&lt;/a&gt;. &lt;a href=&quot;https://quantumcomputingreport.com/players/privatestartup/&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; is the most complete list of quantum computing startups that I know of. Among the companies listed, &lt;a href=&quot;https://www.atom-computing.com/&quot; rel=&quot;noreferrer&quot;&gt;Atom Computing&lt;/a&gt; &lt;em&gt;may&lt;/em&gt; be working on diamond-based quantum computers, but they haven't released much information yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All I could find about them is: &quot;Utilizing techniques pioneered by quantum gas and precision measurement experiments, Atom Computing will create machines using optically trapped neutral atoms capable of reaching the large qubit numbers needed for error-corrected quantum computing.&quot; For what it's worth, one of their co-founders &lt;a href=&quot;https://www.linkedin.com/in/kingjonathanp/&quot; rel=&quot;noreferrer&quot;&gt;Jonathan King&lt;/a&gt; specializes in this area and was a co-author on &lt;a href=&quot;https://arxiv.org/abs/1711.07576&quot; rel=&quot;noreferrer&quot;&gt;Multi-spin-assisted optical pumping of bulk 13C nuclear spin polarization in diamond (Pagliero &lt;em&gt;et al.&lt;/em&gt;, 2018)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also be interested in the article &lt;a href=&quot;http://news.mit.edu/2017/toward-mass-producible-quantum-computers-0526&quot; rel=&quot;noreferrer&quot;&gt;Toward mass-producible quantum computers&lt;/a&gt; published by MIT news, which discusses the current progress in NV-center based quantum computing. Now &lt;em&gt;why&lt;/em&gt; diamond-based quantum computing isn't so mainstream is a good question, but you should probably ask that in a new thread.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-02-03T12:44:35.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5362" PostTypeId="1" CreationDate="2019-02-03T18:37:40.787" Score="3" ViewCount="35" Body="&lt;p&gt;According to &lt;a href=&quot;https://www.youtube.com/watch?v=QKK0Ge87hwI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Christopher Monroe: &quot;Modular Ion Trap Quantum Networks: Going Big&quot;&lt;/a&gt;, the hyperfine states of the valence electron in the Yb+ is used as a qubit. I know that we can change the spin orientation of this electron by using precession by appropriately applying a magnetic field for a specific duration. However, he mentions that the qubit can be manipulated using lasers. I am unable to understand how this is done. Laser beam will only give a oscillating magnetic field right? How can this be used to create precession over any arbitrary axis (as required by Bloch Sphere rotations)?&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="26" LastEditDate="2019-02-03T18:53:45.817" LastActivityDate="2019-02-03T18:53:45.817" Title="Spin precession using a laser" Tags="&lt;architecture&gt;&lt;experiment&gt;&lt;bloch-sphere&gt;&lt;ion-trap-quantum-computing&gt;&lt;chemistry&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5363" PostTypeId="1" CreationDate="2019-02-03T21:09:00.143" Score="5" ViewCount="170" Body="&lt;p&gt;I understand the first step in the Cirac-Zoller controlled-phase gate; about how to move the state from the electronic state to the vibrational mode state. However, I am unable to understand how a &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; pulse gives the -1 sign to the state and how it is applied conditioned on the vibrational mode. Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="26" LastEditDate="2019-02-04T04:57:20.260" LastActivityDate="2019-02-07T21:45:35.337" Title="How does a $2 \pi$ pulse in Cirac Zoller give a -1 sign to the state?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5364" PostTypeId="1" AcceptedAnswerId="5365" CreationDate="2019-02-03T22:33:15.963" Score="5" ViewCount="220" Body="&lt;p&gt;I have tried to implement Grover's algorithm for three qubits in python/numpy and the first two iterations work like a charm but the third one starts to diverge. Is this expected, or is there a bug in the code? I expected the inversion around the mean to blow up the coefficient of the marked state in each iteration. The code follows Nielsen closely, with a silly Oracle that hard-codes the negation of the basis state. The Python code requires a little bit of set-up but the essential idea is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Define a phase shift operator of -1 on all basis states except zero.&lt;/li&gt;&#xA;&lt;li&gt;Define a reflection around the mean operator as Hadamard ⊗ Phase Shift ⊗ Hadamard.&lt;/li&gt;&#xA;&lt;li&gt;Define the full Grover step as the Oracle followed by the reflection.&lt;/li&gt;&#xA;&lt;li&gt;Start with an equally balanced state.&lt;/li&gt;&#xA;&lt;li&gt;Repeatedly apply the Grover step.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Source code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;def dagger(m):&#xA;    return np.transpose(np.conjugate(m))&#xA;&#xA;def proj(m):&#xA;    return m * dagger(m)&#xA;&#xA;# identity matrix for 3 qubits = 8x8 matrix&#xA;id3 = np.identity(2**3)&#xA;&#xA;# hadamard matrix for 1, 2 and 3 qubits&#xA;H1 = np.matrix([[1.0, 1.0], [1.0, -1.0]], dtype=np.complex256) / np.sqrt(2)&#xA;H2 = np.kron(H1, H1)&#xA;H3 = np.kron(H2, H1)&#xA;&#xA;# 3 qubit zero vector |000&amp;gt;&#xA;zero3 = np.array([[1],[0],[0],[0],[0],[0],[0],[0]], dtype=np.complex256)&#xA;&#xA;# phase shift operator  2*|0&amp;gt;&amp;lt;0| - I  for 3 qubits&#xA;PS3 = 2 * proj(zero3) - id3&#xA;&#xA;# reflection around the mean&#xA;R = H3 * PS3 * H3&#xA;&#xA;# 3 qbit oracle, marking/negating state |101&amp;gt; = column vector (0 0 0 0 0 1 0 0)&#xA;O = id3&#xA;O[5,5] = -1&#xA;&#xA;# grover operator&#xA;G = R * O&#xA;&#xA;# start state |000&amp;gt;&#xA;x0 = H3 * zero3&#xA;&#xA;# apply grover step three times&#xA;x1 = G * x0&#xA;print x1&#xA;&#xA;x2 = G * x1&#xA;print x2&#xA;&#xA;x3 = G * x2&#xA;print x3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output of the program is shown below. The coefficient (driving the probability) for the state to search for is 0.88 after one iteration, then 0.97 but then falls back to 0.57. Am I missing any essential step in the algorithm?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[ 0.1767767+0.0j]&#xA; [ 0.1767767+0.0j]&#xA; [ 0.1767767+0.0j]&#xA; [ 0.1767767+0.0j]&#xA; [ 0.1767767+0.0j]&#xA; [ 0.88388348+0.0j]&#xA; [ 0.1767767+0.0j]&#xA; [ 0.1767767+0.0j]]&#xA;[[-0.088388348+0.0j]&#xA; [-0.088388348+0.0j]&#xA; [-0.088388348+0.0j]&#xA; [-0.088388348+0.0j]&#xA; [-0.088388348+0.0j]&#xA; [ 0.97227182+0.0j]&#xA; [-0.088388348+0.0j]&#xA; [-0.088388348+0.0j]]&#xA;[[-0.30935922+0.0j]&#xA; [-0.30935922+0.0j]&#xA; [-0.30935922+0.0j]&#xA; [-0.30935922+0.0j]&#xA; [-0.30935922+0.0j]&#xA; [ 0.57452426+0.0j]&#xA; [-0.30935922+0.0j]&#xA; [-0.30935922+0.0j]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5389" LastEditorUserId="26" LastEditDate="2019-02-04T05:03:26.990" LastActivityDate="2019-02-04T07:37:58.173" Title="Why is Grover's algorithm not converging monotonically? (Python implementation)" Tags="&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5365" PostTypeId="2" ParentId="5364" CreationDate="2019-02-03T23:01:26.750" Score="4" Body="&lt;p&gt;This seems normal by applying the definition of the inversion about average operator which transforms the amplitudes &lt;span class=&quot;math-container&quot;&gt;$\alpha_i $&lt;/span&gt; by the formula :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ - \alpha_i + 2 \langle\alpha\rangle\,, $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply this to your example (using the above formula for each step to verify your intermediary steps) and you should retrieve this numbers. This operator is periodic. After the maximum number of operations giving you the highest probability of the desired state to be measured, you will reset the amplitudes if you apply it another time, meaning you have to reapply again to amplify its amplitude the same way. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-02-03T23:01:26.750" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5367" PostTypeId="2" ParentId="5364" CreationDate="2019-02-04T07:37:58.173" Score="4" Body="&lt;p&gt;Your algorithm is working exactly as it should. &lt;em&gt;Grover's algorithm does not monotonically converge&lt;/em&gt;. Instead, the better intuition is to think about a point moving around a circle at constant speed. If you choose the right moment, you will be close to a particular point, but leave it longer and it'll go past, although it will eventually come back again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the amplitude of the marked item after &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; iterations should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sin((2n+1)\theta)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sin\theta=\frac{1}{\sqrt{N}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of items being search over. In this case, &lt;span class=&quot;math-container&quot;&gt;$N=8$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\sin\theta=\frac{1}{\sqrt{8}}$&lt;/span&gt; and the first few values of the marked amplitude will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;0.883883, 0.972272, 0.574524, -0.110485,\ldots&#xA;$$&lt;/span&gt;&#xA;Thus, you stop after 2 iterations and have extremely high probability of finding the marked item, but you continue to the third iteration and it gets worse again. The point is that since you know &lt;span class=&quot;math-container&quot;&gt;$\sin\theta$&lt;/span&gt;, you can predict the value of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sin((2n+1)\theta)\approx 1$&lt;/span&gt;, and know when to stop. (Note that this is a better and better approximation as &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; gets larger.) You measure the outcome, and get some answer &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. You then input that to the oracle again and test if it is the correct answer. If not, you start the whole algorithm again, and repeat until success.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-04T07:37:58.173" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5368" PostTypeId="2" ParentId="5359" CreationDate="2019-02-04T08:05:49.750" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I do understand that the sum of these three probabilities is greater&#xA;  than one because there are some constraints already involved; like if&#xA;  we uncover all three coins at least two have to be the same. So&#xA;  naturally, there's some redundancy leading to a sum of probabilities&#xA;  that is greater than one!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would say the explanation is simpler than that. Remember that the rule for adding probabilities and them summing to 1 only applies if (i) the set of events is mutually exclusive and (ii) covers everything that could possibly happen. Now, the set of things that are added together do include everything that can happen because, as you said, at least two coins must come out the same. However, they're not mutually exclusive. It can be that 1 and 2 get the same answer and 1 and 3 get the same answer. These are the cases TTT and HHH. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I believe Preskill's actually referring to shared pairs of Bell states between Alice and Bob here rather than the coin setup.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Implicitly, yes. But that's not important. The philosophy is important. Bell predicts something. You do an experiment of some form. The experimental details are irrelevant, but the outcome is different from the prediction. Why? One of the assumptions of the model must be incorrect.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So I'm not quite sure how Preskill came up with the probabilities &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As I tried to say above, that is not necessarily the point. He could have picked anything arbitrarily to make his point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I were trying to build a model, I'd build it a bit differently to yours. I'd give Alice and Bob a single entangled state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)&#xA;$$&lt;/span&gt;&#xA;Alice and Bob each choose from one of 3 possible measurement bases,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z,\quad \frac{-Z+\sqrt{3}X}{2},\quad \frac{-Z-\sqrt{3}X}{2}.&#xA;$$&lt;/span&gt;&#xA;When a measurement is performed, it gives answers &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; which we correspond with the heads and tails outcomes of the coins.&#xA;You can verify that for each basis &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Psi|\sigma\otimes\sigma|\Psi\rangle=1,&#xA;$$&lt;/span&gt;&#xA;meaning that is both parties choose the same measurement (aka coin), they get the same result. You can also see that the individual outcomes are 50:50 by evaluating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Psi|\sigma\otimes\mathbb{I}|\Psi\rangle=0.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take two different measurements &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Psi|\sigma\otimes\tau|\Psi\rangle=-\frac12.&#xA;$$&lt;/span&gt;&#xA;Since this is effectively evaluating &lt;span class=&quot;math-container&quot;&gt;$P(\text{same})-P(\text{different})$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$P(\text{same})+P(\text{different})=1$&lt;/span&gt;, you can see that &lt;span class=&quot;math-container&quot;&gt;$P(\text{same})=\frac14$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this different from what you suggested? Well one of the important things is that the analogy should be clearer. With measurements on the same qubit, you can only measure one of them, and you cannot simultaneously measure the outcomes, i.e. the other two coins disappear. In what you were measuring, it was still in principle possible to perform all 3 measurements because the measurement operators would have commuted.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-04T09:35:08.503" LastActivityDate="2019-02-04T09:35:08.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5369" PostTypeId="1" AcceptedAnswerId="5372" CreationDate="2019-02-04T16:07:40.907" Score="3" ViewCount="229" Body="&lt;p&gt;I have no idea how to read Dirac notation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|↑↑ \right\rangle \tag{1}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\left|↑↓\right\rangle+\left|↓↑\right\rangle \tag{2}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\left|↑↓\right\rangle-\left|↓↑\right\rangle \tag{3}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\left|↓↓\right\rangle \tag{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do the above expressions mean? Can you explain this in terms of the superposition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; I am a sophomore in high school and have no linear algebra background. I am taking a science research course on quantum computing. Obviously, Dirac notation pops up a lot, but I don't know how to read it or tell what it is saying.&lt;/sup&gt; &lt;/p&gt;&#xA;" OwnerUserId="5719" LastEditorUserId="23" LastEditDate="2019-02-04T20:05:18.493" LastActivityDate="2019-02-04T20:07:15.887" Title="How to read Dirac notation (without algebra)?" Tags="&lt;quantum-state&gt;&lt;superposition&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5370" PostTypeId="1" CreationDate="2019-02-04T16:17:08.260" Score="3" ViewCount="415" Body="&lt;p&gt;I'm dealing with Simon's algorithm a bit and &quot;stumbled&quot; upon something called for the algorithm. It is said that if the period is &lt;span class=&quot;math-container&quot;&gt;$s = 0^n$&lt;/span&gt;, then it is an injective function, that is, a 1 to 1 function. How can you show that this is so?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I would be interested. Moreover, if that is not the case, so &lt;span class=&quot;math-container&quot;&gt;$s \neq 0^n$&lt;/span&gt;, then why is it a 2 to 1 function?&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="55" LastEditDate="2019-02-07T10:36:14.200" LastActivityDate="2019-02-07T10:36:14.200" Title="In Simon's algorithm, why is $f$ one-to-one if (and only if) $s=0^n$?" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5371" PostTypeId="2" ParentId="5370" CreationDate="2019-02-04T16:39:51.147" Score="3" Body="&lt;p&gt;This is basically the definition of the type of function that you apply Simon's algorithm to. You are required to have a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x)=f(y)&#xA;$$&lt;/span&gt;&#xA;&lt;em&gt;if and only if&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x\oplus y=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, if &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is all zeros, the outcomes are all unique: if &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(y)$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$x=y\oplus 000\ldots 0$&lt;/span&gt;, but bitwise addition modulo with 0 doesn't change the bit values, so &lt;span class=&quot;math-container&quot;&gt;$x=y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is non-zero, there are exactly two values that give the same value of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$x\oplus00\ldots 0=x$&lt;/span&gt;, just leaving the distinct &lt;span class=&quot;math-container&quot;&gt;$y=x\oplus s$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To add, following a comment. I suspect we need to go further back and understand the notation better. There is a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. It accepts, as an argument, a sequence of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit values, which we write as a variable &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (we write &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; as a shorthand for conveying it's made up of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit values). The answer is a sequence of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit values, which we write as &lt;span class=&quot;math-container&quot;&gt;$y=f(x)$&lt;/span&gt;. We are promised that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, also a sequence of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit values exists such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x)=f(x\oplus a).&#xA;$$&lt;/span&gt;&#xA;The calculation &lt;span class=&quot;math-container&quot;&gt;$x\oplus a$&lt;/span&gt; has a very specific meaning; we take each bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (call the &lt;span class=&quot;math-container&quot;&gt;$i^{th}$&lt;/span&gt; bit &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;) and each bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and return the sequence where they have been added together modulo 2:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x_i\oplus a_i=x_i\text{ XOR }a_i=x_i+a_i\text{ mod }2=\left\{\begin{array}{cc} 0 &amp;amp; x_i=a_i \\ 1 &amp;amp; x_i\neq a_i\end{array}\right.&#xA;$$&lt;/span&gt;&#xA;So, for example&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;00110\oplus 01010=01100.&#xA;$$&lt;/span&gt;&#xA;A key feature of this bitwise addition function is that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x\oplus a\oplus a=x.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;An example of a suitable &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|cccccccc}&#xA;x &amp;amp; 000 &amp;amp; 001 &amp;amp; 010 &amp;amp; 011 &amp;amp; 100 &amp;amp; 101 &amp;amp; 110 &amp;amp; 111 \\&#xA;f(x) &amp;amp; 010 &amp;amp; 011 &amp;amp; 000 &amp;amp; 001 &amp;amp; 010 &amp;amp; 011 &amp;amp; 000 &amp;amp; 001&#xA;\end{array}&#xA;$$&lt;/span&gt;&#xA;Here, you can see that each value of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is repeated exactly twice. So, we find two values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that give the same output, say &lt;span class=&quot;math-container&quot;&gt;$001$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$101$&lt;/span&gt;. These correspond to values &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x\oplus a$&lt;/span&gt;, so we can find &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a=x\oplus(x\oplus a)=001\oplus101=100.&#xA;$$&lt;/span&gt;&#xA;Then you can check for every &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(x\oplus 100)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-05T08:54:48.483" LastActivityDate="2019-02-05T08:54:48.483" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5372" PostTypeId="2" ParentId="5369" CreationDate="2019-02-04T16:53:35.327" Score="6" Body="&lt;p&gt;The dirac notation itself, the &lt;span class=&quot;math-container&quot;&gt;$|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; parts is simply a notation to remind you that you're dealing with quantum states. What you write inside this `ket' is completely arbitrary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the examples you give, somebody has (probably) chosen to depict a quantum system of two quantum bits. The up arrow and the down arrow depict two distinguishable states, i.e. we could measure each qubit and ask &quot;is it up or down&quot;? They have also made an implicit connection between an ordering of the labels and the qubits themselves.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the first example says that both qubits are &quot;up&quot;. The last one says that they are both &quot;down&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The middle two are very similar, so let's just talk about &lt;span class=&quot;math-container&quot;&gt;$\left|↑↓\right\rangle+\left|↓↑\right\rangle$&lt;/span&gt;. You could effectively read this as saying &quot;if you ask which of the two qubits is up or down, you have a 50:50 chance of the first being up and the second down, or vice versa&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You asked for an example using superposition. Examples 2 and 3 that you gave are using a particular type of superposition called entanglement. Basically, whenever you have more than one ket, you've got superposition. When the superpositions span different physical entities (such as two qubits), that superposition is entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we can talk about superposition of a single qubit. If we start from &lt;span class=&quot;math-container&quot;&gt;$\left|↑\right\rangle$&lt;/span&gt;, i.e. the qubit is &quot;up&quot;, we can talk about any superposed state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta \left|↑\right\rangle+\sin\theta e^{i\phi}\left|↓\right\rangle.&#xA;$$&lt;/span&gt;&#xA;If you asked whether it's up or down, you'd get answer &quot;up&quot; with probability &lt;span class=&quot;math-container&quot;&gt;$\cos^2\theta$&lt;/span&gt;, and &quot;down&quot; with probability &lt;span class=&quot;math-container&quot;&gt;$\sin^2\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is if you only talk about the question &quot;up or down?&quot; you can't really see anything quantum happening. To do that, you have to perform measurements in other bases, and then you really start to need to do the maths properly.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="23" LastEditDate="2019-02-04T20:07:15.887" LastActivityDate="2019-02-04T20:07:15.887" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5374" PostTypeId="1" AcceptedAnswerId="5375" CreationDate="2019-02-05T03:03:06.780" Score="7" ViewCount="601" Body="&lt;p&gt;I'm struggling to find much about the language &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_Language&quot; rel=&quot;nofollow noreferrer&quot;&gt;QCL&lt;/a&gt;, rather than about quantum computing itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything out there like that? It doesn't have to be free. &lt;/p&gt;&#xA;" OwnerUserId="5722" LastEditorUserId="10480" LastEditDate="2021-03-20T23:24:32.460" LastActivityDate="2021-03-20T23:24:32.460" Title="What resources are available for learning QCL?" Tags="&lt;programming&gt;&lt;resource-request&gt;&lt;qcl&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5375" PostTypeId="2" ParentId="5374" CreationDate="2019-02-05T04:26:27.530" Score="6" Body="&lt;p&gt;A quick googling reveals that &lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/&quot; rel=&quot;noreferrer&quot;&gt;Bernhard Ömer&lt;/a&gt; has worked extensively on this topic. Check out the documentation section &lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/qcl.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. He describes the installation procedure on the corresponding &lt;a href=&quot;https://github.com/aviggiano/qcl&quot; rel=&quot;noreferrer&quot;&gt;GitHub page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/doc/quprog.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum Programming in QCL (PDF)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My master thesis in computing science deals with computational and architectural questions of quantum programming and illustrates the design of quantum algorithms in QCL. For readers with a CS rather than a physical background, this book also features a brief introduction into quantum physics in general. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/doc/qcldoc.pdf&quot; rel=&quot;noreferrer&quot;&gt;A Procedural Formalism for Quantum Computing (PDF)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My master thesis in theoretical physics about QCL. Besides a general introduction to quantum programming and a description of the language, a complete QCL implementation of the Shor algorithm is presented. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://tph.tuwien.ac.at/~oemer/doc/structquprog.pdf&quot; rel=&quot;noreferrer&quot;&gt;Structured Quantum Programming (PDF)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;My PhD thesis on structured programming languages for quantum computing (latest revision Jan 9 2009).  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0211100&quot; rel=&quot;noreferrer&quot;&gt;Classical Concepts in Quantum Programming&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This paper from the QS2002 conference describes classical concepts in QCL, including new features like conditional operators, quantum conditions and quantum if-statements. The print version appeared in the International Journal of Theoretical Physics 44/7, pp. 943-955, 2005. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Also, check out these video lectures on QCL by &lt;a href=&quot;http://macheads101.com/pages/about.php&quot; rel=&quot;noreferrer&quot;&gt;Macheads101&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=rF2DDvGsYmY&quot; rel=&quot;noreferrer&quot;&gt;Quantum Programming Tutorial #1: Installing QCL&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=GO6TsdwxcwM&quot; rel=&quot;noreferrer&quot;&gt;Quantum Programming Tutorial #2: Basic Qubit Operations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=X5rJ78_U_go&quot; rel=&quot;noreferrer&quot;&gt;Quantum Programming Tutorial #3: The V Gate&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-05T04:45:51.210" LastActivityDate="2019-02-05T04:45:51.210" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5376" PostTypeId="1" AcceptedAnswerId="5382" CreationDate="2019-02-05T09:59:03.443" Score="3" ViewCount="90" Body="&lt;p&gt;I found something in a lecture on Simon's algorithm that I do not quite understand how to interpret. There the following is said:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{y\in\{0,1\}^n}|y\rangle\left(\sum_{x\in\{0,1\}^n} (-1)^{x\cdot y}|f(x)\rangle\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we assume a 1 to 1 function and &lt;span class=&quot;math-container&quot;&gt;$s=0$&lt;/span&gt;. As far as that is understandable. Then it says (that's the part I'm not quite sure of): &quot;The probability that a measurement in String Y results is:&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|\left|\frac{1}{2^n}\sum_{x\in\{0,1\}^n} (-1)^{x\cdot y}|f(x)\rangle\right|\right|^2=\frac{1}{2^n}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to make something more understandable, which I do not quite understand. So if you have a 1 to 1 function then that means that each value occurs exactly once, say you have three bits, then there are 8 states, that is from 000 to 111. These then also occur with the same probability of 1/8 for each state. But now I do not quite understand the result of the top formula, why is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n}$&lt;/span&gt; out there, why is not it squared? What happens to the sum there? What is the exact calculation behind it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean, on the one hand, I understand why &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n}$&lt;/span&gt; comes out there, but on the other hand, I do not quite understand the calculation (&lt;span class=&quot;math-container&quot;&gt;$||...||^2$&lt;/span&gt;) behind it, I hope somebody can explain it a bit.&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="26" LastEditDate="2019-02-05T14:56:22.380" LastActivityDate="2019-02-05T20:49:02.823" Title="Simon's Algorithm - Probability that the measurement results in a string Y" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5377" PostTypeId="2" ParentId="5376" CreationDate="2019-02-05T15:15:16.990" Score="2" Body="&lt;p&gt;The first state in your question is not a valid quantum state as it is not normalized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result comes directly from the axioms of quantum mechanics. You just have to apply the Born rule. For a state &lt;span class=&quot;math-container&quot;&gt;$\sum_y ~ a_y |y\rangle$&lt;/span&gt; the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|a_y|^2.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose you are given a state &lt;span class=&quot;math-container&quot;&gt;$\sum_y ~ a_y |y\rangle|0\rangle +  b_y |y\rangle|1\rangle$&lt;/span&gt;. The probability of getting &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; should be sum of probabilities of getting &lt;span class=&quot;math-container&quot;&gt;$|y\rangle|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|y\rangle|0\rangle$&lt;/span&gt;. This, according to the Born rule is &lt;span class=&quot;math-container&quot;&gt;$|a_y|^2 + |b_y|^2. $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So extending this logic to the case of a state of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_y ~  |y\rangle|\psi_y\rangle$&lt;/span&gt;, we get that the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|| |\psi_y\rangle||^2.$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2663" LastActivityDate="2019-02-05T15:15:16.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5378" PostTypeId="1" AcceptedAnswerId="5381" CreationDate="2019-02-05T19:11:41.263" Score="0" ViewCount="110" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|#1\rangle}$&lt;/span&gt;Is there some standard computational basis defined in quantum computing?  Can I just call &lt;span class=&quot;math-container&quot;&gt;$\{\ket{0}, \ket{1}\}$&lt;/span&gt; the standard computational basis?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2019-03-30T07:52:18.913" LastActivityDate="2019-03-30T07:52:18.913" Title="Can I call $\{|0\rangle, |1\rangle\}$ the &quot;standard computational basis&quot; as it is done in linear algebra?" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5379" PostTypeId="2" ParentId="5378" CreationDate="2019-02-05T19:12:40.270" Score="3" Body="&lt;p&gt;Yes, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is commonly called the computational basis. Some sources also call it the classical basis.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-02-05T19:12:40.270" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5380" PostTypeId="1" AcceptedAnswerId="5385" CreationDate="2019-02-05T19:54:07.817" Score="2" ViewCount="199" Body="&lt;p&gt;I was redirected from theoretical computing to quantum computing for this question. I've been mildly researching quantum computers to figure out how entanglement and superposition are utilized for higher performance. I understand what these are and I've gotten to the point where it looks like the key is in the logic gate but explanations are vague other than stating that simultaneous possible configurations of all 0s and 1s can be processed at the same time. But what is the actual mechanism involved?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like a condensed understanding of how the quantum effect is utilized for any particular function. Is this possible or is the explanation too complex for a simple description?&#xA;My background is Aeronautical Engineering, then Math and Physics Education as a late second career (BA in Math Education, MA in Science Education).&lt;/p&gt;&#xA;" OwnerUserId="5728" LastEditorUserId="55" LastEditDate="2019-02-07T10:21:53.227" LastActivityDate="2019-02-08T16:51:12.660" Title="What is the actual mechanism behind quantum computing?" Tags="&lt;algorithm&gt;&lt;speedup&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5381" PostTypeId="2" ParentId="5378" CreationDate="2019-02-05T20:18:10.200" Score="2" Body="&lt;p&gt;You can either call it the &lt;a href=&quot;https://en.wikipedia.org/wiki/Standard_basis&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard basis&lt;/a&gt;  (as it can be mapped to the natural orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$\Bbb R^2$&lt;/span&gt;) or the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1410/what-is-the-computational-basis&quot;&gt;computational basis&lt;/a&gt;, of the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-dimensional complex Hilbert space. The latter is more frequently used in the context of quantum computing, but you'll see mathematicians using the former more. Anyway, calling it the &quot;standard computational&quot; basis is simply redundant when you're dealing with &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2$&lt;/span&gt;, although I've seen some authors use it. For instance, check page 5 of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208008&quot; rel=&quot;nofollow noreferrer&quot;&gt;From Qubits to Continuous-Variable Quantum Computation (Sanders &lt;em&gt;et al.&lt;/em&gt;, 2002)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related:&lt;/strong&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1410&quot;&gt;What is the Computational Basis?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="1589" LastEditDate="2019-02-07T02:08:36.480" LastActivityDate="2019-02-07T02:08:36.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5382" PostTypeId="2" ParentId="5376" CreationDate="2019-02-05T20:49:02.823" Score="1" Body="&lt;p&gt;In the first state you write they omitted to write the normalization factor. This is not rare to see, as one can usually easily deduce what the normalization should be from the context (though it might not be a very pedagogical choice).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To deduce the correct normalization in this case, you need only notice that, because &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is one-to-one, the sum over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is something of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_x c_x \lvert x\rangle$&lt;/span&gt; for some coefficients &lt;span class=&quot;math-container&quot;&gt;$c_x$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\lvert c_x\rvert=1$&lt;/span&gt;, and where the sum is over all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-digit binary strings. There are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; of these, and therefore the state (just the one inside the parentheses) should more precisely be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^{n/2}}\sum_{x\in\{0,1\}^n} (-1)^{x\cdot y}|f(x)\rangle.$$&lt;/span&gt;&#xA;A similar reasoning applies to the outer sum, so that the overall state, written with the normalization included, is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^n}\sum_{y\in\{0,1\}^n}|y\rangle\left(\sum_{x\in\{0,1\}^n} (-1)^{x\cdot y}|f(x)\rangle\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This brings you to the second equation. To compute the norm there, you now notice that, again because &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is one-to-one,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left|\left|\frac{1}{2^n}\sum_{x\in\{0,1\}^n} (-1)^{x\cdot y}|f(x)\rangle\right|\right|^2&#xA;=\frac{1}{2^{2n}}\sum_{x\in\{0,1\}^n}\lvert (-1)^{x\cdot y}\rvert^2&#xA;=\frac{1}{2^{2n}}\sum_{x\in\{0,1\}^n}1&#xA;=\frac{1}{2^{2n}}2^n=\frac{1}{2^n}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-02-05T20:49:02.823" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5383" PostTypeId="1" CreationDate="2019-02-05T21:03:03.873" Score="2" ViewCount="21" Body="&lt;p&gt;Let's say I have chosen the valence electron of Yb+ as my qubit. I want to consider it's hyperfine structure as the two-level energy states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are my following assumptions correct?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If the magnetic moment of the electron is parallel to that of the nucleus, then the potential energy will be minimum&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the magnetic moment of the electron is anti-parallel to the nucleus, then the PE will be maximum&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I can use a circularly polarized laser to create Rabi oscillations (should it be always circularly polarized light? why can't I use a linearly polarized laser)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, given this exact scenario, what will be the Hamiltonian of the electron so that I can solve for the SE?&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="26" LastEditDate="2019-02-05T21:28:18.897" LastActivityDate="2019-02-05T21:28:18.897" Title="Hamiltonian of the valence electron of Yb+ ion" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;chemistry&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5384" PostTypeId="1" CreationDate="2019-02-05T21:21:06.077" Score="3" ViewCount="47" Body="&lt;p&gt;Please check this Rabi oscillations image&lt;sup&gt;1&lt;/sup&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tq91gm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tq91gm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's say I want to create a superposition of E1 and E2, so I started an EM field tuned to a frequency related to E2-E1. But, let's say there is another energy difference E3-E1, as per the above image there is still some probability (though it will never be 1) that E1 to E3 transition might occur. Isn't it? Or is there something wrong in my understanding?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Source: &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Mplwp_Rabi_oscillations.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://commons.wikimedia.org/wiki/File:Mplwp_Rabi_oscillations.svg&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="23" LastEditDate="2019-02-05T21:31:19.470" LastActivityDate="2019-02-07T21:52:43.147" Title="Rabi oscillations with different energy differences" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5385" PostTypeId="2" ParentId="5380" CreationDate="2019-02-05T22:29:04.923" Score="2" Body="&lt;p&gt;A qbit is a two-element vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;, a property called the 2-norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have two important qbit values which we associate with the classical bits 0 and 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A qbit is in superposition when it is in any state other than &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. When people say superposition means the qbit &quot;is both 0 and 1 at the same time&quot;, what they mean is it is a &lt;em&gt;linear combination&lt;/em&gt; of 0 and 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \alpha\begin{bmatrix} 1 \\ 0 \end{bmatrix} + \beta\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We operate on qbits with quantum logic gates, which must always be equivalent in action to unitary matrices. For example, here's the bitflip or &quot;not&quot; operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X|0\rangle = \begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix} = |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We represent the state of multiple qbits through their tensor product:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} a \\ b \end{bmatrix} \otimes \begin{bmatrix} c \\ d \end{bmatrix} = \begin{bmatrix} ac \\ ad \\ bc \\ bd \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the size of the product state vector grows exponentially with the number of qbits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} a \\ b \end{bmatrix} \otimes \begin{bmatrix} c \\ d \end{bmatrix} \otimes \begin{bmatrix} e \\ f \end{bmatrix} = \begin{bmatrix} ace \\ acf \\ ade \\ adf \\ bce \\ bcf \\ bde \\ bdf \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ordinarily this doesn't matter very much, but sometimes qbits become entangled, which means their product state cannot be factored into the tensor product of individual qbits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \frac{1}{\sqrt{2}} \\ 0 \\ 0 \\ \frac{1}{\sqrt{2}} \end{bmatrix} \ne \begin{bmatrix} a \\ b \end{bmatrix} \otimes \begin{bmatrix} c \\ d \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this happens, applying a quantum logic gate to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbits (which takes the form of a &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; unitary matrix) can manipulate &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; pieces of information (the elements of the product state, called amplitudes) in one shot. However, there's a bottleneck: you can only ever get &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of information out of an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qbit system (through measurement), even though the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qbit system contains &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; pieces of information. This bottleneck means we cannot &quot;solve problems by trying all possible solutions simultaneously&quot; or some other such nonsense you might have read, and quantum computers can only provide speedup in very specific problem domains.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I gave a lecture where I expand on these concepts &lt;a href=&quot;https://youtu.be/F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-02-05T22:29:04.923" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5386" PostTypeId="1" CreationDate="2019-02-06T00:36:51.547" Score="-2" ViewCount="162" Body="&lt;p&gt;What are some of the most probable directions for quantum computation to go in the future and what research still needs to be done in the field?&lt;/p&gt;&#xA;" OwnerUserId="5719" LastEditorUserId="26" LastEditDate="2019-04-11T14:13:17.113" LastActivityDate="2019-04-11T14:13:17.113" Title="Future research in quantum computation and information" Tags="&lt;research&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2019-02-06T04:50:53.347" ContentLicense="CC BY-SA 4.0" />
  <row Id="5387" PostTypeId="2" ParentId="5386" CreationDate="2019-02-06T02:02:56.737" Score="2" Body="&lt;p&gt;One research direction that's in some ways just getting going is &lt;em&gt;making the constant factors on the costs of quantum computation smaller&lt;/em&gt;. For example, the &lt;a href=&quot;https://www.quantumresource.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the first international workshop on quantum resource estimation (QRE2019)&lt;/a&gt; didn't happen ten years ago, it's happening later this year.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given known techniques, if you try to run a classical computation on an error corrected quantum computer, it will be billions or trillions of times less efficient. So basically quantum algorithms start with that as a penalty factor. The constant factors are so bad that, unless we make serious improvements, no one will ever see a benefit in practice from running Grover's search algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As another example, the meat of Shor's algorithm is basically just one modular exponentiation done under superposition. Modular exponentiations are an operation your computer can do in a fraction of a second. Yet the resource estimates for running Shor's algorithm are huge.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-06T02:02:56.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5388" PostTypeId="1" CreationDate="2019-02-06T19:32:30.963" Score="2" ViewCount="231" Body="&lt;p&gt;Was wondering if anyone has any historical data/charts showing the number of over logical qubits over time. I am hoping to include something illustrative of Moore's law as applied to quantum computing for a presentation. Thank you. &lt;/p&gt;&#xA;" OwnerUserId="5736" LastEditorUserId="26" LastEditDate="2019-02-06T19:34:35.873" LastActivityDate="2019-02-06T19:59:19.850" Title="Chronological list of improvements in number of logical qubits" Tags="&lt;resource-request&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5389" PostTypeId="2" ParentId="5388" CreationDate="2019-02-06T19:53:43.523" Score="1" Body="&lt;p&gt;I don't know if such a chart &lt;em&gt;already&lt;/em&gt; exists, but I'd refer you to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Timeline_of_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Timeline of quantum computing&lt;/a&gt; on Wikipedia and the citations therein. It is quite comprehensive and you can extract the &quot;number of qubits vs. time&quot; data from there and create your own charts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also &lt;a href=&quot;https://sciencenode.org/feature/3-reasons-why-quantum-computing-is-closer-than-ever.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; but it misses out on a lot of details (and is a bit misleading):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6YzjXm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6YzjXm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, I'd like to mention that the number of qubits by itself is not a good measure of the performance of quantum computers. And Moore's law is not really applicable to quantum computing. Please read through the following threads.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1428&quot;&gt;Is Google's 72 qubit device better than D-Wave's machines, which feature more than 2000 qubits?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1255&quot;&gt;How should different quantum computing devices be compared?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1803&quot;&gt;Does Moore's law apply to quantum computing?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-06T19:59:19.850" LastActivityDate="2019-02-06T19:59:19.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5390" PostTypeId="2" ParentId="5388" CreationDate="2019-02-06T19:58:15.397" Score="1" Body="&lt;p&gt;I recommend you the &lt;a href=&quot;https://quantumcomputingreport.com/our-take/applying-moores-law-to-quantum-qubits/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Report&lt;/a&gt; page, where several news about quantum computing and other interesting data about the quantity of qubits and quality of them in each existing nowadays is presented. The link I added refers to a post called &quot;Applying Moore's law to quantum qubits&quot; as you are specifically requiring such information.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2019-02-06T19:58:15.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5391" PostTypeId="1" CreationDate="2019-02-06T23:34:23.273" Score="8" ViewCount="403" Body="&lt;p&gt;Suppose we are using GA (Grover's algorithm) such that we are given it has 2 or more solutions. The search space is of size &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. We all know Grover's algorithm has, at worst, a time complexity proportional to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt;.&#xA;Now assume we are using quantum phase estimation to get the exact number of solutions in GA to precision &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; bits (which is actually an angle on the complex unit circle) – so this means we will need to apply quantum phase estimation to get this angle – from this we get the exact numbers of solutions in GA. Using GA with phase estimation in this way is well known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, does the quantum phase estimation algorithm, in the worst case, run in polynomial time and polynomial space according to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="26" LastEditDate="2019-02-07T13:31:23.853" LastActivityDate="2021-04-15T01:04:08.020" Title="What is the complexity of the quantum phase estimation in Grover's algorithm?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;grovers-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5393" PostTypeId="1" AcceptedAnswerId="5394" CreationDate="2019-02-06T23:56:22.917" Score="4" ViewCount="105" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\qr}[1]{|#1\rangle}$&lt;/span&gt;Grover algorithm's input is a superposition, representing the haystack, and the Bell state &lt;span class=&quot;math-container&quot;&gt;$\qr{-}$&lt;/span&gt;.  The &lt;span class=&quot;math-container&quot;&gt;$\qr{-}$&lt;/span&gt; seems utterly important: when I replaced &lt;span class=&quot;math-container&quot;&gt;$\qr{-}$&lt;/span&gt; by, say, &lt;span class=&quot;math-container&quot;&gt;$\qr{+}$&lt;/span&gt;, the oracle became the identity operator and so Grover's algorithm couldn't work with it.  So it seems that we need &lt;span class=&quot;math-container&quot;&gt;$\qr{-}$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$$U_f\qr{i}\qr{-} = (-1)^{f(i)}\qr{i}\qr{-},$$&lt;/span&gt; which is the phase kickback tricky.  Is &lt;span class=&quot;math-container&quot;&gt;$\qr{-}$&lt;/span&gt; the only state that can do the trick for Grover's algorithm?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2019-03-30T07:52:07.077" LastActivityDate="2019-03-30T07:52:07.077" Title="Is the $|-\rangle$ state the only one that can do the trick for Grover's algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;phase-kickback&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5394" PostTypeId="2" ParentId="5393" CreationDate="2019-02-07T00:01:38.167" Score="3" Body="&lt;p&gt;It would still work if you rotated the &lt;span class=&quot;math-container&quot;&gt;$|−\rangle$&lt;/span&gt; state, you refer to, by an angle with cosine less than  &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{L}$&lt;/span&gt;  where &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is the square root of the size of the search space (which is a power of 2). So it works with a different state which is a small rotation of the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="26" LastEditDate="2019-02-07T08:12:19.827" LastActivityDate="2019-02-07T08:12:19.827" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5395" PostTypeId="1" AcceptedAnswerId="5397" CreationDate="2019-02-07T00:23:58.077" Score="9" ViewCount="321" Body="&lt;p&gt;Was it David Deutsch? Can you say who was the first paper to mention the phase kickback trick? &lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2019-02-07T08:05:58.910" LastActivityDate="2019-02-09T00:13:18.080" Title="Who discovered the phase kickback trick?" Tags="&lt;history&gt;&lt;phase-kickback&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5396" PostTypeId="1" CreationDate="2019-02-07T01:02:15.270" Score="1" ViewCount="65" Body="&lt;p&gt;I have this cq-state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2} \times (|0\rangle \langle0|_A \otimes \rho^0_E + |1\rangle \langle1|_A \otimes \rho^1_E)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where Alice (A) is classical and an adversary Eve (E) has some knowledge about Alice's system. If Alice's measurement is 0, then Eve's knowledge is &lt;span class=&quot;math-container&quot;&gt;$\rho^0_E$&lt;/span&gt; and similarly, if Alice's measurement is 1, then Eve's knowledge about it is &lt;span class=&quot;math-container&quot;&gt;$\rho^1_E$&lt;/span&gt;. Now, how do I measure how different these &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;s are? How do I separate it from the system and measure their difference?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was using projectors on the standard basis to filter them out. But is there a standard way?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2019-02-07T07:59:37.730" LastActivityDate="2019-02-07T12:45:16.047" Title="Better Way Of Separating Two CQ-States" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;tensor-product&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5397" PostTypeId="2" ParentId="5395" CreationDate="2019-02-07T03:06:27.737" Score="12" Body="&lt;p&gt;The phase kickback trick appears in this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Richard Cleve, Artur Ekert, Chiara Macchiavello, Michele Mosca. Quantum Algorithms Revisited. &lt;em&gt;Proceedings of the Royal Society of London A&lt;/em&gt;, 454(1969): 339-354, 1998.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The authors credit Alain Tapp for independently discovering the same improvement to Deutsch's algorithm that results from using this trick. (Deutsch's original algorithm, which did not make use of the phase kickback trick, was in fact not deterministic; the algorithm we now typically call Deutsch's algorithm is actually the improved version proposed in the above paper.)&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2019-02-07T03:06:27.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5398" PostTypeId="1" AcceptedAnswerId="5406" CreationDate="2019-02-07T04:42:52.393" Score="8" ViewCount="2527" Body="&lt;p&gt;I’m currently studying the Shor’s algorithm and am confused about the matter of complexity. From what I have read, the Shor’s algorithm reduces the factorization problem to the order-finding problem or period of modular exponentiation sequence of some random &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$1 &amp;lt; x &amp;lt; N$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no problem regarding the idea of the algorithm. But I'm wondering if Shor’s algorithm creates such a sequence by repeated squaring (which is an efficient way classically). In my understanding, the term &quot;efficient&quot; means that the complexity of the algorithm is polynomial in time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that there is an efficient way to create the sequence classically, can we not just add a little check for whether we have encountered &lt;span class=&quot;math-container&quot;&gt;$x^{r} = 1 \ \text{mod} N$&lt;/span&gt;? During the creation process, it should not increase complexity to exponential-time, right? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why bother with quantum Fourier transform at all? Did I misunderstand it in some way?&lt;/p&gt;&#xA;" OwnerUserId="4729" LastEditorUserId="4729" LastEditDate="2019-02-07T07:50:01.047" LastActivityDate="2019-02-08T15:33:29.630" Title="Why is quantum Fourier transform required in Shor's algorithm?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5399" PostTypeId="2" ParentId="5398" CreationDate="2019-02-07T05:20:30.573" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Given that there is an efficient way to create the sequence&#xA;  classically, can we not just add a little check for whether we have&#xA;  encountered &lt;span class=&quot;math-container&quot;&gt;$x^{r} = 1 \ \text{mod} N$&lt;/span&gt;? During the creation process,&#xA;  it should not increase complexity to exponential-time, right?&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Why bother with quantum Fourier transform at all? Did I misunderstand&#xA;  it in some way?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer to the above question is that there exists no known classical (non-quantum) algorithm that can find this period efficiently (in polynomial complexity). So that means there is no efficient classical algorithm to find the period of functions like &lt;span class=&quot;math-container&quot;&gt;$x = 2^r_{1} \ \text{mod} N$&lt;/span&gt;. That is not to say such a classical algorithm does not exist – just that no one knows such a classical algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classical discrete Fourier transform has exponential complexity – however, the quantum version of that Fourier transform has polynomial complexity. So we do need to bother with the quantum Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="26" LastEditDate="2019-02-07T07:44:46.163" LastActivityDate="2019-02-07T07:44:46.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5400" PostTypeId="2" ParentId="5393" CreationDate="2019-02-07T07:40:01.343" Score="3" Body="&lt;p&gt;Remember that the states &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; form a basis. That means that any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that you use can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\alpha|+\rangle+\beta|-\rangle.&#xA;$$&lt;/span&gt;&#xA;By linearity, we can basically treat what these two components do separately. The &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; component is basically useless and gives the correct output with probability &lt;span class=&quot;math-container&quot;&gt;$1/N$&lt;/span&gt; if there are &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; items in the database, while the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; component returns the marked item with a probability close to 1. Hence the overall success probability of a single run is approximately&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p=\frac{|\alpha|^2}{N}+|\beta|^2.&#xA;$$&lt;/span&gt;&#xA;With, on average &lt;span class=&quot;math-container&quot;&gt;$1/p$&lt;/span&gt; repetitions, we'll find the answer we're looking for. So long as &lt;span class=&quot;math-container&quot;&gt;$1/p&amp;lt;\sqrt{N}$&lt;/span&gt;, we still get a speed-up over the classical case. Hence, roughly, we want &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2&amp;gt;1/\sqrt{N}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar analysis can be repeated whenever the phase kickback trick is used (with the caveat that you never do anything to that qubit that should be in &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; except do the operation that creates the phase kickback, but I believe that is always the case)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-07T07:40:01.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5401" PostTypeId="5" CreationDate="2019-02-07T07:53:29.730" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-07T07:53:29.730" LastActivityDate="2019-02-07T07:53:29.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5402" PostTypeId="4" CreationDate="2019-02-07T07:53:29.730" Score="0" Body="For questions about classical-quantum (CQ) states and channels. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-07T07:53:29.730" LastActivityDate="2019-02-07T07:53:29.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5403" PostTypeId="5" CreationDate="2019-02-07T08:08:45.150" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-07T08:08:45.150" LastActivityDate="2019-02-07T08:08:45.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5404" PostTypeId="4" CreationDate="2019-02-07T08:08:45.150" Score="0" Body="For questions about phase kick-back. For a detailed description of the mechanism, go through https://quantumcomputing.stackexchange.com/questions/2565 and the answers therein. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-07T08:08:45.150" LastActivityDate="2019-02-07T08:08:45.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5405" PostTypeId="2" ParentId="5396" CreationDate="2019-02-07T10:00:51.100" Score="2" Body="&lt;p&gt;In quantum information theory, the standard way to obtain what it is called &lt;em&gt;reduced density operator&lt;/em&gt; from a quantum system composed by several quantum states is to use the so-called &lt;em&gt;partial trace&lt;/em&gt; operation. For the case where there are two quantum states, &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; can be reduced to &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho ^B$&lt;/span&gt; in the following way:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho^A=tr_B(\rho^{AB})$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho^B=tr_A(\rho^{AB})$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This operator acts like it is tracing out one of the systems from the whole density matrix that describes the whole system. Apart from that, in order to measure how different two quantum states are, the &lt;em&gt;fidelity&lt;/em&gt; measurement is used usually in quantum information theory. Such the measure is defined as&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)=\sqrt{\rho^{1/2}\sigma\rho^{1/2}}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are quantum density matrices. These things are explained in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt; book, refer there for more information.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="26" LastEditDate="2019-02-07T12:45:16.047" LastActivityDate="2019-02-07T12:45:16.047" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5406" PostTypeId="2" ParentId="5398" CreationDate="2019-02-07T12:09:31.940" Score="7" Body="&lt;p&gt;The essential feature of this problem is that while both the quantum and classical algorithms can make use of the efficient classical function of calculating &lt;span class=&quot;math-container&quot;&gt;$a^k\text{ mod }N$&lt;/span&gt;, the issue is how many times does each have to evaluate the function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the classical algorithm you're suggesting, you'd calculate &lt;span class=&quot;math-container&quot;&gt;$a\text{ mod }N$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$a^2\text{ mod }N$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$a^3\text{ mod }N$&lt;/span&gt;, and so on, until you hit a repeating value. You have to perform &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; evaluations, and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; could be quite large. Indeed, it could be &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt;. It's this large number of repetitions that kills this idea for the classical algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By comparison, the quantum algorithm only evaluates the order &lt;em&gt;once&lt;/em&gt;. You then need the Quantum Fourier Transform in order to be able to compare all the simultaneously calculated values because you cannot access all of these values all at once. The QFT is what does all the magic.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-07T12:09:31.940" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5407" PostTypeId="1" CreationDate="2019-02-07T12:36:00.657" Score="2" ViewCount="62" Body="&lt;p&gt;This is a question in the Nielsen and Chuang textbook (Exercise 2.2).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is a vector space with basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&#xA;   and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a linear operator from &lt;span class=&quot;math-container&quot;&gt;$V \to V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$A|0\rangle =&#xA; |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A|1\rangle =|0\rangle$&lt;/span&gt;. Given a matrix representation&#xA;   for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, with respect to the input basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt;&#xA;   and output basis &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle,  |0\rangle\}$&lt;/span&gt;. Find input and output&#xA;   basis which give rise to a different matrix representation of A.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My doubts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why do we mention the input and output specifically? Isn't the matrix-dependent only on the input and output as long as the transformation is in the same vector space?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How to solve the second part of the question?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5614" LastEditorUserId="26" LastEditDate="2019-02-07T13:08:29.763" LastActivityDate="2019-02-07T13:08:29.763" Title="Nielsen &amp; Chuang Exercise 2.2 - Matrix representations in different input and output basis" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2019-04-14T11:51:17.723" ContentLicense="CC BY-SA 4.0" />
  <row Id="5408" PostTypeId="1" CreationDate="2019-02-07T13:20:32.297" Score="3" ViewCount="382" Body="&lt;p&gt;I am currently running the following document from &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/aqua/general/amplitude_estimation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Qiskit documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This notebook is running in Jupyter, and I started Jupyter from the Mac terminal within a Conda environment. Normally, this works fine with Qiskit. The problem is that when I run the command:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ae._circuit.draw(output='latex')&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;WARNING: Unable to compile latex. Is 'pdflatex' installed? Skipping latex circuit drawing...&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried &lt;code&gt;conda install pdflatex&lt;/code&gt; and many variations of this, but nothing worked so far. Does anyone know how to solve this problem?&lt;/p&gt;&#xA;" OwnerUserId="5600" LastEditorUserId="26" LastEditDate="2019-02-07T13:24:01.317" LastActivityDate="2019-02-07T16:12:13.943" Title="LaTeX error when drawing circuits with Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5409" PostTypeId="1" CreationDate="2019-02-07T13:49:02.157" Score="7" ViewCount="2146" Body="&lt;p&gt;I don't understand, why is the control not gate used so often.  As far as I understand it, if you apply two 2 level operations on two qubits then you get a 4 x 4 matrix by the tensor product.  So how would you express the CNOT gate as a product of the one matrix acting upon the first qubit and the second acting on the second qubit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another thing which I have difficulty understanding is why we use so many single qubits and CNOT gates for implementing the Toffoli gate?  Can't we implement it using just an AND between the first two qubits and then applying a controlled NOT for the third one? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="55" LastEditDate="2019-02-08T11:32:04.697" LastActivityDate="2019-02-20T12:06:40.273" Title="Composing the CNOT gate as a tensor product of two level matrices" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5410" PostTypeId="2" ParentId="5409" CreationDate="2019-02-07T14:16:08.607" Score="12" Body="&lt;p&gt;The whole point is that CNOT &lt;em&gt;cannot&lt;/em&gt; be written in the form &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt;. This is absolutely essential because if we only ever had operators of the form &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt;, states of the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\otimes|\phi\rangle$&lt;/span&gt; would always remain separable. There's be no entanglement, and all quantum circuits would be easy to simulate on a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the Toffoli construction you describe, we require that in a quantum circuit, all gates are &lt;em&gt;reversible&lt;/em&gt;. The AND gate is not reversible as you can see from the way the number of outputs is smaller than the number of inputs (so it's impossible to know what the inputs were just by looking at the outputs).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The above answers the question actually asked. However, I infer from the follow up comments of the OP, both here and on other questions, that there's something else that they're trying to get at. Here's my attempt to resolve some confusion.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Any &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrix can be composed as a product of &quot;two-level matrices&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is the normal matrix product, &lt;strong&gt;not&lt;/strong&gt; the tensor product. A &quot;two-level matrix&quot; in this context is a matrix which is the identity everywhere except for two basis elements &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, on which the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix is an arbitrary unitary matrix. The controlled-not is by no means an exception to this rule. In fact, it's a particularly simple example because controlled-not &lt;em&gt;is&lt;/em&gt; a two-level matrix where &lt;span class=&quot;math-container&quot;&gt;$s=10$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t=11$&lt;/span&gt;. That makes it a particularly natural building block which allows the further statement&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Any &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; two-level matrix can be decomposed in terms of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; two-level matrices and the special case &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; two-level matrix  that is controlled-not.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;remembering that any system on which the gate does not act requires us to take the tensor product of the operator with identity in order to make it act on the correct dimension.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-20T12:06:40.273" LastActivityDate="2019-02-20T12:06:40.273" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="5411" PostTypeId="2" ParentId="5408" CreationDate="2019-02-07T15:23:19.087" Score="3" Body="&lt;p&gt;You are missing the pdflatex binary. Install pdflatex from your OS's LaTeX installer. For MacOS, follow this link: &lt;a href=&quot;https://superuser.com/questions/1038612/where-do-i-get-the-pdflatex-program-for-mac&quot;&gt;Where do I get the pdflatex program for Mac?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5744" LastEditorUserId="26" LastEditDate="2019-02-07T16:12:13.943" LastActivityDate="2019-02-07T16:12:13.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5413" PostTypeId="1" AcceptedAnswerId="5419" CreationDate="2019-02-07T19:05:03.013" Score="1" ViewCount="518" Body="&lt;p&gt;I am new to quantum computing and saw this argument on this site but I don't understand it.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First of all, I don't understand what is exactly meant by 'reversible'. Because even if you had a unitary matrix operation that doesn't mean you would be able to tell what were the inputs.   For example the XOR gate which is like CNOT but without the control output, is actually unitary but that doesn't mean I can reverse the process. I can sometimes somewhat say what were the inputs but can I always tell 0,1 from 1,0 as inputs?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose now, you have a 4x4 unitary matrix acting on two qubits as a tensor product of two operations.  How can you reverse the process? I am not seeing how just being 'unitary' helps you?  Can you tell what came in?&#xA;Another thing I don't understand: if all the point of control gates is because of unitary matrices have to be reversible, then again why would we need control in first place?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Granted that all of your operations are Unitarian then also compositions and multiplications would be Unitarian. Then why do you need a control to guarantee reversibility if you claim reversibility follows from the unitary property?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Sure I am missing something here.  But what is it?  What's the point of control gates? Everyone says it's for reversibility. Why we need reversibility? People say due to unitarity. Unitarity is needed to keep the normal size of the probability vector. But then again, if all of them are unitary they are already reversible (if they aren't then again why is reversibility needed) so why then use controlled gates?&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="5742" LastEditDate="2019-02-07T20:47:32.043" LastActivityDate="2019-02-08T03:22:58.300" Title="Is it correct to say that we need controlled gates because unitary matrices are reversible?" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5414" PostTypeId="2" ParentId="5409" CreationDate="2019-02-07T20:02:03.813" Score="5" Body="&lt;p&gt;Any two qubit &lt;em&gt;Controlled-U&lt;/em&gt; gate is not decomposable as &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; in general. The whole point is that a conditional operator has a non-local nature and it gives rise to non-trivial correlations when operated on a state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Physics behind is that; imagine a Controlled operation which can be factored as &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt;, and the sub-systems (or the two qubits) are separated non-locally in space. then the only way to perform a controlled conditional operation is to measure the state of a first qubit, convey the outcome &lt;em&gt;classically&lt;/em&gt; to the second qubit and apply the desired unitary on the second qubit, and finally re-initialize the first qubit. But now note that this is NOT actually a 'true' controlled gate because it cannot work for an arbitrary control qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the actual nature of a conditional gate is non-local, which essentially implies that it cannot be factored as &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; over the sub-spaces. The intuition can be taken as the operation reads system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and simultaneously changes system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; based on the state of system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. This is strictly non-local in nature. Physically how it is implemented in experiments is most often by a single exchange of quanta between the states, which is triggered by the state of one sub-system. Hence, this gives rise to entanglement between the sub-systems. It is most often called the 'entanglement generator'. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, you can think of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gate to be the most simplified two-qubit gate which can generate the class of two-qubit non-local gates when combined with few other gates. This is already proved by the Universality of single-qubit gates and the &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;About the Toffoli gate, the most obvious way to implement it (after taking in mind the universality) is to decompose it in parts of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gates and single qubit gates. This is what is done. And because &lt;em&gt;reversibility&lt;/em&gt; is a must requirement for a quantum operation, you cannot use any analogous irreversible gate like the &lt;span class=&quot;math-container&quot;&gt;$\operatorname{AND}$&lt;/span&gt; gate in quantum circuits. To perform the &lt;span class=&quot;math-container&quot;&gt;$\operatorname{AND}$&lt;/span&gt; analogous operation as you pointed out, this is further broken up in parts of the single qubit and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gates (to ensure the reversibility and unitarity). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: One essential reason why this decomposition is done because in experiments all we can implement are these single qubit and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gates only. Any such protocol must be decomposed in these gates to cope up with some experimental implementation. And these are intuitive as well, rather than using multi-qubit gates which are nothing but a series of the single qubit gates and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt;s. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2019-02-08T00:42:43.243" LastActivityDate="2019-02-08T00:42:43.243" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="5415" PostTypeId="1" CreationDate="2019-02-07T20:24:35.417" Score="3" ViewCount="478" Body="&lt;p&gt;After reading through Shor's algorithm, I have a few questions about the probability of factoring semiprime number out. Here is some background of the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To factor a semiprime number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$N = pq$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; are prime numbers) efficiently, Shor's algorithm is employed with the following  steps (roughly):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Register 2 sets of qubit &lt;span class=&quot;math-container&quot;&gt;$\overbrace{\vert00...0\rangle}^{\text{t qubits}}\overbrace{\vert00...0\rangle}^{\text{n qubits}}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N^{2} &amp;lt; 2^{t} &amp;lt; 2N^{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n = \log_{2}{N}$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;Randomly choose &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$1 &amp;lt; x &amp;lt; N$&lt;/span&gt; and check if &lt;span class=&quot;math-container&quot;&gt;$\gcd(x,N) = 1$&lt;/span&gt; if not here is a factor&lt;/li&gt;&#xA;&lt;li&gt;Finding a period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; (or order) of a modular exponentiation sequence, &lt;span class=&quot;math-container&quot;&gt;$f(x) = x^{a} \mod N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a = 0,1,2,3,...$&lt;/span&gt; with quantum fourier transform (QFT) (I have skip many details about operation after initialize a qubits, if interested then I suggest this &lt;a href=&quot;https://nbviewer.jupyter.org/github/Qiskit/qiskit-tutorial/blob/master/community/algorithms/shor_algorithm.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit tutorial&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Measure the first set register which contain an information in form of&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\psi\rangle = \frac{1}{2^{t}}\sum_{a=0}^{2^{t}-1}\sum_{z=0}^{2^{t}-1}e^{(2\pi i)(\frac{aj}{2^{t}})}\vert j \rangle \vert x^a \bmod N \rangle \hspace{0.2cm} ;\text{where} \hspace{0.3cm} \frac{j}{2^{t}} = \frac{k}{r} \hspace{0.3cm}, 0 &amp;lt; k &amp;lt; N$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;After obtaining &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; by using continued fraction to approx &lt;span class=&quot;math-container&quot;&gt;$\frac{j}{2^t}$&lt;/span&gt; close to &lt;span class=&quot;math-container&quot;&gt;$\frac{k}{r}$&lt;/span&gt; which is irreducible, so the denominator is a period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Check if &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is even and is period of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; by using &lt;span class=&quot;math-container&quot;&gt;$2^{r} = 1 \mod{N}$&lt;/span&gt; if not then run 2.) again ,if yes then &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is period of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and the prime factor can be compute by &lt;span class=&quot;math-container&quot;&gt;$\gcd(x^{r/2} \pm 1, N)$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now consider an example &lt;span class=&quot;math-container&quot;&gt;$N = 21$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x = 2$&lt;/span&gt; follow this &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303175&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; (which I follow from &lt;a href=&quot;https://nbviewer.jupyter.org/github/Qiskit/qiskit-tutorial/blob/master/community/algorithms/shor_algorithm.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit tutorial&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By following the above step until 4, the probability density of state becomes: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rm{Probability} \ (j) = \frac{1}{512 \times 86} \bigg\vert \sum_{a=0}^{85}e^{-2 \pi i \frac{6ja}{512}} \bigg\vert^2$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Normalization factor is different from 4 (which is more general) because the example does a measurement on the second register before QFT to simplify an expression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then consider the possible outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; corresponding probability and period compute from continued fraction approximation of a measurement which are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$(16.66\%)$&lt;/span&gt; ; algorithm fail, retry&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$83 \leq j \leq 87$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$(16.66\%)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$r = 6$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$168 \leq j \leq 172$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$(16.66\%)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$r = 3$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$254 \leq j \leq 257$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$(16.66\%)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$r = 2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$339 \leq j \leq 343$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$(16.66\%)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$r = 3$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$425 \leq j \leq 429$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$(16.66\%)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$r = 6$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;the expected result, period of &lt;span class=&quot;math-container&quot;&gt;$2^a \text{mod} N$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;. From the above result, it is easily seen that a probability of obtaining the right answer is around &lt;span class=&quot;math-container&quot;&gt;$33\%$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here is the beginning of the question&lt;/strong&gt; from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's original paper&lt;/a&gt;, which says: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;when applied to a random &lt;span class=&quot;math-container&quot;&gt;$x \ (\text{mod} \hspace{0.1cm}n)$&lt;/span&gt;,&#xA;  yields a factor of n with probability at least &lt;span class=&quot;math-container&quot;&gt;$1 - \frac{1}{2^k}$&lt;/span&gt;&#xA;  , where k is the number of distinct&#xA;  odd prime factors of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;After looking through other possible value &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; there are &lt;span class=&quot;math-container&quot;&gt;$2, 8, 10, 11, 13, 19$&lt;/span&gt; that return an even period such that I can use them to successfully compute prime factors of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. And for &lt;span class=&quot;math-container&quot;&gt;$3, 6, 7, 12, 14, 15, 18$&lt;/span&gt; that returns a prime factor in step 2 above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is if we consider &lt;span class=&quot;math-container&quot;&gt;$x = 2$&lt;/span&gt; (follow the above example) then the consecutive probability is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{19}\times\frac{1}{3}$&lt;/span&gt; which is less than &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;. So what about such a probability that is stated in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's original paper&lt;/a&gt;? Does it just mean the probability of encountered &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that &quot;may return the right answer&quot; does not include its consecutive probability? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's original paper&lt;/a&gt;  it is mentioned that the outcome that may be a factor of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, namely &lt;span class=&quot;math-container&quot;&gt;$r = r_{1}r_{2}$&lt;/span&gt; and suggests a tactic: to check &lt;span class=&quot;math-container&quot;&gt;$r' = 2r, 3r, ...$&lt;/span&gt; (stop before &lt;span class=&quot;math-container&quot;&gt;$r' &amp;gt; N$&lt;/span&gt;). Then how can I speak about the probability of obtaining the right answer in this aspect?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if one can obtain a factor of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, namely &lt;span class=&quot;math-container&quot;&gt;$r_{1}$&lt;/span&gt; (i.e. above example third to fifth a outcome) in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303175&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; that suggests one to run the quantum part again with &lt;span class=&quot;math-container&quot;&gt;$x' = x^{r} \text{mod} N$&lt;/span&gt; which will return &lt;span class=&quot;math-container&quot;&gt;$r_{2}$&lt;/span&gt; with some probability again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are so many ways to do it. So I am now wondering which way is the most efficient way to perform Shor's algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Not deal with the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that return odd &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; or trivial solution. &lt;/li&gt;&#xA;&lt;li&gt;Extracting the period from measured information using continued fraction method which might not return the right period even if it is &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that should (i.e. the above example with to say &lt;span class=&quot;math-container&quot;&gt;$\frac{256}{512} = \frac{1}{2}$&lt;/span&gt; then return &lt;span class=&quot;math-container&quot;&gt;$r = 2$&lt;/span&gt;). &lt;/li&gt;&#xA;&lt;li&gt;Retry with a new &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; every time?&lt;/li&gt;&#xA;&lt;li&gt;Use a tactic that Shor suggests?&lt;/li&gt;&#xA;&lt;li&gt;Retry again with &lt;span class=&quot;math-container&quot;&gt;$x'$&lt;/span&gt; to obtain another factor of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Another way that I don't know.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Also, how many times  do we need to repeat the algorithm if we want to factor like say 232 digits numbers (or maybe say an order like 10 times is enough. Or 100? 1,000?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get that it is still worth run Shor's algorithm again and again. It is still more efficient than the classical factoring algorithm. But with the above statement from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's original paper&lt;/a&gt; an example in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303175&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; makes me confused. Did I misunderstand or miscalculate something in the above process? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4912/expected-repetitions-of-the-quantum-part-of-shors-algorithm&quot;&gt;similar question&lt;/a&gt;, but still not getting it and want to ask for my understanding.&lt;/p&gt;&#xA;" OwnerUserId="4729" LastEditorUserId="26" LastEditDate="2019-02-08T10:32:22.430" LastActivityDate="2019-02-08T10:32:22.430" Title="Possible results from Shor's algorithm in practice" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5416" PostTypeId="2" ParentId="5413" CreationDate="2019-02-07T21:01:36.753" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Any quantum operation is basically a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; acting on an isolated Hilbert space states. Now, the requirements for a Hamiltonian is to a matrix which is Unitary and Hermitian. This intrinsically implies it has an &lt;em&gt;inverse&lt;/em&gt;, which means it is &lt;em&gt;reversible&lt;/em&gt; because you can always find a matrix &lt;span class=&quot;math-container&quot;&gt;$H^{-1}$&lt;/span&gt; and apply it on the state. This is where reversibility comes from.&lt;/p&gt;&#xA;&lt;p&gt;Physics behind: To perform quantum computation, we need an isolated Hilbert space (2 dimensional for a qubit) which means there must be no dissipation outside the Hilbert space. This implies unitarity to be a must requirement as it conserves the inner product (and hence the probability). Now, there is a principle - &amp;quot;Landauer's Principle&amp;quot; which implies for every bit of the information loss there is an energy loss of &lt;span class=&quot;math-container&quot;&gt;$k_BT$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the temperature of the system. And because we need an isolated system (in principle), we cannot allow dissipation and hence reversibility is a must requirement from Physics point of view.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Any &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; unitary has an inverse that exists. But this does not mean you can make it a separable operation as answered in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5409/composing-the-cnot-gate-as-a-tensor-product-of-two-level-matrices/5414?noredirect=1#comment7941_5414&quot;&gt;Composing the CNOT gate as a tensor product of two level matrices&lt;/a&gt;. We can reverse the process by simply applying the inverse gate. That single operation does the job. Control has nothing to do with the reversibility or unitarity in specific, these two are basic requirements of every quantum operation on qubits. You need control gates to perform the control operations which basically form the part of connecting different qubits, most fundamental in its way.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We don't need &amp;quot;control&amp;quot; or &amp;quot;conditional&amp;quot; nature of gates to guarantee the reversibility. This is a misconception. Reversibility comes from Unitarity, Hermicity and Landauer's principle for quantum computation.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-02-07T21:06:20.257" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5417" PostTypeId="2" ParentId="5413" CreationDate="2019-02-07T21:38:05.827" Score="4" Body="&lt;p&gt;Controlled gates are used to create &lt;em&gt;entanglement&lt;/em&gt;. They don't have anything to do with reversibility; all unitary gates are reversible by definition, since all unitary operators have inverses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could come up with an alternative choice of gates that you used to write algorithms in that didn't include controlled gates. For instance, for quantum computers based on ion traps, it is common to use &lt;a href=&quot;https://en.wikipedia.org/wiki/M%C3%B8lmer%E2%80%93S%C3%B8rensen_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mølmer-Sørensen&lt;/a&gt; gates instead of controlled gates. It is possible to convert between different choices of primitive gates, as long as each set is &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal&lt;/a&gt;; that is, as long as each set is capable of expressing all possible quantum operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To your question 1, if I apply CNOT to qubits 1 (control) and 2 (target), and then apply the same CNOT operation a second time, I will return the system to its original state. CNOT is unitary and self-adjoint, which implies that it is its own inverse; there are other gates that are unitary but not self-adjoint, but these gates all have inverses, and so by applying the inverse gate I can get back to where I started.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To question 2, if I apply a single-qubit unitary gate to qubit 1 and apply another unitary gate to qubit 2, then applying the inverse of each unitary gate to the same respective qubits will undo the original pair of gates.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2019-02-07T21:38:05.827" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5418" PostTypeId="2" ParentId="5363" CreationDate="2019-02-07T21:45:35.337" Score="2" Body="&lt;p&gt;CNOT in ion traps is not implemented in one go. It is decomposed in terms of SWAP gate. The general decomposition they use is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\operatorname{CNOT}_{jk}=H_k \operatorname{SWAP}^{-1}_k C_j(Z) \operatorname{SWAP}_kH_k&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$j,k$&lt;/span&gt; are the labels for the control and target ion (qubit) respectively, in the array. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hadamard gate and &lt;span class=&quot;math-container&quot;&gt;$C(Z)$&lt;/span&gt; is the control-Z operation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hadamard is just rotations, so we can ignore that for a while and focus on the middle three gates, they are the three crucial steps of the algorithm of Cirac-Zoller implementation in the right order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit is as shown (Source: Nielsen and Chuang, pg.323)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0ZGdZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0ZGdZ.png&quot; alt=&quot;(Source: Nielsen and Chuang, pg.323)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Control-Z is what the &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; pulse is in the second step. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you follow this scheme of Nielsen and Chuang (sec-7.6.4), the &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; pulse implements this operation as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iuuwa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iuuwa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to switch &lt;span class=&quot;math-container&quot;&gt;$|01\rangle \leftrightarrow |10\rangle$&lt;/span&gt; for the control-Z. This is done as follows. We need a way to swap qubits between the atom’s internal spin state and the&#xA;phonon state (little perturbation over the spin states). This can be done by tuning a laser to the frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_0-\omega_z$&lt;/span&gt;, and arranging for the phase (which can always be done by the laser) to be such that we perform the rotation &lt;span class=&quot;math-container&quot;&gt;$R_y(\pi)$&lt;/span&gt; on the subspace spanned by&#xA;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, which is just the unitary transform &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C_{SWAP}=|00\rangle \langle 00|+|01\rangle \langle 10|-|10\rangle \langle 01|+|11\rangle \langle 11|&#xA;\end{equation}&lt;/span&gt;&#xA;on the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle, |11\rangle$&lt;/span&gt; space. If the initial state is &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle + b|10\rangle$&lt;/span&gt; (that is, the phonon is initially &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;), then the state after the swap is &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle + b|01\rangle$&lt;/span&gt;, so this accomplishes the desired swap operation, which is the second step in Cirac-Zoller. Note here that &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; pulse is just the &lt;span class=&quot;math-container&quot;&gt;$R_y(\pi)$&lt;/span&gt; here which is equivalent by just a convention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The frequency notation is explained in the last image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest to read thoroughly the section 7.6 of Nielsen and Chuang to make a complete understanding.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gCTvl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gCTvl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-02-07T21:45:35.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5419" PostTypeId="2" ParentId="5413" CreationDate="2019-02-07T21:48:44.387" Score="3" Body="&lt;p&gt;Siddhant's answer should suffice, but as you said you are new to quantum computing (QC), I am not sure whether you are new to quantum mechanics (QM) as well. I will assume you are new to QM, and if that is not the case please excuse my ignorance.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Is it correct to say that we need controlled gates because unitary matrices are reversible?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, controlled gates have nothing to do with guaranteeing the reversibility of unitary matrices. I hope it becomes clear after reading the following&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;First of all, I don't understand what is exactly meant by 'reversible'.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In QC, the operations(gates) are reversible. Suppose you have a unitary operation(gate) &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, it can always be inverted, &lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$U^{-1}$&lt;/span&gt; exists. You can think of it like this, whatever &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; does, &lt;span class=&quot;math-container&quot;&gt;$U^{-1}$&lt;/span&gt; does &lt;em&gt;reverse&lt;/em&gt; of that, since &lt;span class=&quot;math-container&quot;&gt;$U U^{-1} = \mathbb{I} $&lt;/span&gt;. &#xA;This is independent of the input/output basis as queried in the last part of your first question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the reason for why they are operations are unitary matrices, is pointed out by @siddhant in his first point.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... How can you reverse the process? I am not seeing how just being 'unitary' helps you? Can you tell what came in?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, just being unitary helps. Since an inverse of a unitary matrix always exists.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...if all the point of control gates is because of unitary matrices have to be reversible, then again why would we need control in first place?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, that is not the point of control gates. Control gates are a subset of all the gates, and all gates are unitary.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;If you are correct then, take the XOR gate which is unitary, provided you have &#xA;  an output can you say what were the inputs?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Depends, the XOR gate you are referring to is with two inputs one outputs? then no and it is not unitary. The CNOT gate, on the other hand, is unitary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you may be wondering only thing that differentiates them is the output of the control and just adding the output of the control makes the gate unitary(thus reversible).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And you would be correct. But that is not the question you asked, although, after reading the second comment you copy/pasted in every answer, now I think this the question you intended to ask: &lt;strong&gt;Is it correct to say that we need &lt;em&gt;output of the control bit&lt;/em&gt; because unitary matrices are reversible?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the answer is Yes. Think of it this way (read it as a flow chart)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;QM required the gates/operation to be unitary (in a closed system)&lt;/li&gt;&#xA;&lt;li&gt;XOR gate with two input one output is not unitary&lt;/li&gt;&#xA;&lt;li&gt;What can we do to perform a task which XOR gate does in QM?&lt;/li&gt;&#xA;&lt;li&gt;If we know the state of control bit as well, it is!&lt;/li&gt;&#xA;&lt;li&gt;Bingo!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;your answer implying that a universal system must include an entanglement? Is this a correct phrasing? Since you say controlled gates are for entanglement and it's a gate inside universal set. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, entanglement is not necessary for quantum computation, it helps but it is not necessary.&lt;/p&gt;&#xA;" OwnerUserId="5746" LastEditorUserId="26" LastEditDate="2019-02-08T03:22:58.300" LastActivityDate="2019-02-08T03:22:58.300" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5420" PostTypeId="2" ParentId="5384" CreationDate="2019-02-07T21:52:43.147" Score="1" Body="&lt;p&gt;Which of these transitions will occur will be governed by the operation regime of the apparatus and laser. It might happen, for example, that state 3 is unfavorable due to &lt;em&gt;selection rules&lt;/em&gt; or it only acts as an &lt;em&gt;auxiliary&lt;/em&gt; state. The very first step according to the &lt;strong&gt;D.Vincenzo's criteria&lt;/strong&gt; is to identify and isolate the Hilbert space of the system to work with. This already implies that your operations are restricted and the energy domains too. You only perform certain operations that contribute to the q.computation and does not affect parts of the system to interfere and decohere the operating state. This is all a matter of experimental conditions.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-02-07T21:52:43.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5421" PostTypeId="1" CreationDate="2019-02-07T21:54:38.397" Score="2" ViewCount="322" Body="&lt;p&gt;Is there a polynomial time and polynomial space quantum algorithm for finding a 4 colouring of any loopless planar graph?&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="26" LastEditDate="2019-02-08T03:14:28.643" LastActivityDate="2019-02-10T19:35:48.187" Title="Is there a polynomial quantum algorithm for graph coloring?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;space-complexity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5422" PostTypeId="1" CreationDate="2019-02-07T22:06:11.787" Score="4" ViewCount="788" Body="&lt;p&gt;I am able to apply multiple measurements (2) to the same qubit system. However, I would like to get the counts right after each measurement is executed. I realize that the counts should be the same after every measurement of the same system. I would just like to see empirical proof of the so-called &quot;repeated measurement principle&quot; without any evolution of the system. I attempted to write a program which would achieve this, but had no success:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import time &#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister &#xA;from qiskit import execute, IBMQ, Aer &#xA;from qiskit.backends.ibmq import least_busy &#xA;from qiskit import compile as q_compile&#xA;&#xA;counter = 0&#xA;&#xA;def generate_circuits(num_q):&#xA;    # Create a Quantum Register with 1 qubits.&#xA;    q = QuantumRegister(num_q, 'q')&#xA;    # Create a Classical Register with 1 bits.&#xA;    c = ClassicalRegister(num_q, 'c')&#xA;    # Create a Quantum Circuit&#xA;    qc = QuantumCircuit(q, c)&#xA;&#xA;    if counter == 0:&#xA;        # Add a H gate on qubit 0, putting this qubit in superposition.&#xA;        qc.h(q[0])&#xA;        # Add a Measure gate to see the state.&#xA;        qc.measure(q, c)&#xA;        qc.barrier(q)&#xA;        return qc&#xA;    else:&#xA;        qc.measure(q, c)&#xA;        return qc&#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;&#xA;qc_gen = generate_circuits(1)&#xA;&#xA;qobj = q_compile(qc_gen, backend, shots=1000)&#xA;&#xA;job = backend.run(qobj)&#xA;&#xA;result = job.result()&#xA;&#xA;data = result.get_counts(qc_gen)&#xA;&#xA;print(data)&#xA;&#xA;counter += 1&#xA;&#xA;qobj = q_compile(qc_gen, backend, shots=1000)&#xA;&#xA;job = backend.run(qobj)&#xA;&#xA;result = job.result()&#xA;&#xA;data = result.get_counts(qc_gen)&#xA;&#xA;print(data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which returned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'0': 489, '1': 511} &#xA;{'0': 491, '1': 509}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="26" LastEditDate="2019-02-08T15:32:35.943" LastActivityDate="2019-02-08T15:32:35.943" Title="Qiskit - How do we measure the same single qubit system multiple times while also getting the counts/results after each measurement?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5424" PostTypeId="2" ParentId="23" CreationDate="2019-02-08T02:40:35.487" Score="2" Body="&lt;p&gt;Yes, it can because quantum computing is a generalization of classical computing. So the procedure you ask for exists. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can take a universal classical logic gate such as NOR gate, generalize to a reversible quantum version of that NOR gate. Thus a procedure can be as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Design classical circuit&lt;/li&gt;&#xA;&lt;li&gt;Rewrite classical circuit using only the chosen universal classical gate (e.g. NOR)&lt;/li&gt;&#xA;&lt;li&gt;Convert the classical circuit above using quantum the quantum version of the classical universal gate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;We pick a set of basis states, to represent the two binary classical states, and we ignore complex amplitudes as the other answer, by jknappen, implies.&lt;/p&gt;&#xA;" OwnerUserId="5737" LastEditorUserId="26" LastEditDate="2019-02-08T03:43:20.340" LastActivityDate="2019-02-08T03:43:20.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5430" PostTypeId="2" ParentId="4368" CreationDate="2019-02-08T08:53:25.700" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Grover focuses on &lt;em&gt;gate&lt;/em&gt; costs, while Ambainis focuses on &lt;em&gt;queries&lt;/em&gt;. Ambainis solves element distinctness in &lt;span class=&quot;math-container&quot;&gt;$O(N^{2/3})$&lt;/span&gt; queries, using &lt;span class=&quot;math-container&quot;&gt;$O(N^{2/3})$&lt;/span&gt; memory. If you used that memory to run &lt;span class=&quot;math-container&quot;&gt;$O(N^{2/3})$&lt;/span&gt; copies of Grover's algorithm (since each copy needs poly-log space, and I'm being imprecise about logarithmic factors) then each one would search a space of size &lt;span class=&quot;math-container&quot;&gt;$N^2/N^{2/3}=N^{4/3}$&lt;/span&gt;, and with the square-root speed up, would take time &lt;span class=&quot;math-container&quot;&gt;$O(N^{2/3})$&lt;/span&gt;. But, each copy is making simultaneous queries, so parallel Grover makes &lt;span class=&quot;math-container&quot;&gt;$O(N^{4/3})$&lt;/span&gt; queries in total. So in query complexity, it's not a trivial result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is query complexity a good measure? It depends on your model of computation, and in this case: Do you have a quantum random access gate? If you only have Clifford+T gates (or any other finite set with bounded fanin) then quantum random memory access to &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; elements needs &lt;span class=&quot;math-container&quot;&gt;$\Omega(M)$&lt;/span&gt; gates. This is because the gates you use cannot be &quot;dynamically generated&quot; by the input, which is quantum. When I think about this, I always envision a classical control computer that &lt;em&gt;applies&lt;/em&gt; gates somehow. The classical control cannot measure the input (which is quantum) so it must apply the necessary gates for any possible memory access. If you had given a superposition of addresses for the memory access, then it would &lt;em&gt;definitely&lt;/em&gt; need to apply all the gates!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ambainis explicitly adds a random access gate to the usual gate set. Once he does this, the query complexity he derives will be roughly equal to the total gate cost. If you don't add a random access gate, and you need to &quot;build&quot; one out of Clifford+T, then a single memory access would use &lt;span class=&quot;math-container&quot;&gt;$O(N^{2/3})$&lt;/span&gt; gates itself. Then Ambainis' algorithm will end up with an &lt;span class=&quot;math-container&quot;&gt;$O(N^{4/3})$&lt;/span&gt; total gate cost - the same as Grover's algorithm (up to poly-log factors).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For other algorithms, I've looked a lot (this is the subject of my master's thesis, essentially) and I haven't seen much. The algorithms at the end of &quot;&lt;a href=&quot;https://arxiv.org/abs/1207.2307&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient Distributed Quantum Computing&lt;/a&gt;&quot; do slightly better, though they focus on depth, not gate cost, and they rely on hypercube connectivity in their qubits. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2019-02-08T08:53:25.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5431" PostTypeId="1" AcceptedAnswerId="5433" CreationDate="2019-02-08T10:41:41.203" Score="6" ViewCount="207" Body="&lt;p&gt;I'm curious about how to form arbitrary-sized uniform superpositions, i.e., &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}\vert x\rangle$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; that is not a power of 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is possible, then one can use the inverse of such a circuit to produce &lt;span class=&quot;math-container&quot;&gt;$\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$&lt;/span&gt; (up to some precision). Kitaev &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9511026&quot; rel=&quot;nofollow noreferrer&quot;&gt;offers a method for the reverse&lt;/a&gt; procedure, but as far as I can tell there is no known method to do one without the other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly such a circuit is &lt;em&gt;possible&lt;/em&gt;, and there are lots of general results on how to asymptotically make any unitary I want, but it seems like a massive headache to distill those results into this one simple, specific problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a known, efficient, Clifford+T circuit that can either produce arbitrary uniform superpositions or states like &lt;span class=&quot;math-container&quot;&gt;$\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4517" LastEditorUserId="26" LastEditDate="2019-02-08T14:34:05.057" LastActivityDate="2021-04-13T08:43:38.287" Title="Forming states of the form $\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5432" PostTypeId="1" CreationDate="2019-02-08T12:39:52.433" Score="5" ViewCount="196" Body="&lt;p&gt;I saw an example which takes a 2 level matrix. Which is a &lt;span class=&quot;math-container&quot;&gt;$8\times8$&lt;/span&gt; matrix that acts non trivially only on 2 levels of only states &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;.  The way they do it is by using a gray code from &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; and then shifting &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|011\rangle$&lt;/span&gt; and performing the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation only on the most left qubit conditional on the two &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; qubits to the right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing I am trying to do, is to show that in the end this is equivalent to the original &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation of &lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt; matrix.  How can I show their equivalency?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I was trying to do is, to take the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on the left hand side qubit and tensor product it with two identity matrices acting on the two other qubits. But this doesn't yeild the original &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt; matrix).  What did I get wrong here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And how do you actually prove that the original &lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt; matrix operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting only on states &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|011\rangle$&lt;/span&gt; can be translated by a small &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; matrix acting only on the most left qubit plus CNOT gates.  How can I show it?  It would be even preferred to show it by using matrix manipulation of sorts to get the original &lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt; matrix.  Or even some intuition would be good as well. Thanks! &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-02-08T12:53:21.933" LastActivityDate="2020-10-23T23:38:40.470" Title="Decomposition of any 2-level matrix into single qubit and CNOT gates" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5433" PostTypeId="2" ParentId="5431" CreationDate="2019-02-08T13:29:28.143" Score="5" Body="&lt;p&gt;As long as you want to set arbitrary states for a single qubit, like in your example, the solution is straightforward and it makes use of standard 2x2 &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gate. In there if you set &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta = 2\arctan(\sqrt{1-p}/\sqrt{p})$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and apply &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt; in the form &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\sin(\theta/2)\\&#xA;\sin(\theta/2)  &amp;amp; \cos(\theta/2)&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to an input qubit in superimposed state (i.e. passed through a H gate), you get what you're looking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course things get more complicated in case you want to set an arbitrary state over a qubit register of size &gt; 1. In that case there are algorithms like Ventura's one (Initializing the Amplitude Distribution of a Quantum State) which can do it with polynomial complexity.&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="26" LastEditDate="2019-02-08T14:22:35.257" LastActivityDate="2019-02-08T14:22:35.257" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5434" PostTypeId="1" AcceptedAnswerId="5439" CreationDate="2019-02-08T13:43:27.443" Score="3" ViewCount="478" Body="&lt;p&gt;I'm using the SWAP test circuit for implementing a qubit registers comparison&#xA;&lt;a href=&quot;https://i.stack.imgur.com/D0x6e.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/D0x6e.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the documentation I could find I've understood it can be applied to input qubits |&lt;span class=&quot;math-container&quot;&gt;$\alpha\rangle$&lt;/span&gt; and |&lt;span class=&quot;math-container&quot;&gt;$\beta\rangle$&lt;/span&gt; of the same size. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that really a constraint? Or it can be also applied to general cases of qubits of different size?&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="55" LastEditDate="2021-05-22T12:03:43.237" LastActivityDate="2021-05-22T12:03:43.237" Title="Can the SWAP test only compare registers with the same number of qubits?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;swap-test&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5436" PostTypeId="2" ParentId="5434" CreationDate="2019-02-08T14:09:38.697" Score="6" Body="&lt;p&gt;Yes they should be the same size. Otherwise, if you use it for getting the inner product between them, it would not make sense they aren't. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-02-08T14:09:38.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5438" PostTypeId="1" CreationDate="2019-02-08T14:36:24.967" Score="4" ViewCount="42" Body="&lt;p&gt;In this paper &lt;a href=&quot;https://arxiv.org/abs/1803.00745&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Learning&lt;/a&gt; they say that the ability of a quantum circuit to approximate a function can be enhanced by terms like &lt;span class=&quot;math-container&quot;&gt;$x\sqrt{1-x^2}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$x\in[-1,1])$&lt;/span&gt;.&#xA;Given inputs &lt;span class=&quot;math-container&quot;&gt;$\{x,f(x)\}$&lt;/span&gt;, it aims to approximate an analytical function by a polynomial with higher terms up to the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th order. the steps are similar to the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Encoding &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; by constructing a state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^N}\otimes_{i=1}^N[I+xX_i+\sqrt{1-x^2}Z_i]^n$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a parameterized unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Minimize the cost function by tuning the parameters &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; iteratively.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I am a little confused about how can terms like &lt;span class=&quot;math-container&quot;&gt;$x\sqrt{1-x^2}$&lt;/span&gt; in the polynomial represented by the quantum state can enhance its ability to approximate the function. Maybe it's implemented by introducing nonlinear terms, but I can't find the exact mathematical representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help in advance!&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="26" LastEditDate="2019-02-08T14:42:20.903" LastActivityDate="2019-02-08T14:42:20.903" Title="Why does $x\sqrt{1-x^2}$ enhance the ability to approximate analytical functions in quantum circuit learning?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5439" PostTypeId="2" ParentId="5434" CreationDate="2019-02-08T14:45:17.273" Score="2" Body="&lt;p&gt;Qubits can be only with a size of 2, which means a dimensionality of 2. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$|\alpha \rangle,|\beta\rangle$&lt;/span&gt; here, for the SWAP gate to make sense, they must be of the same dimensionality (in the operating Hilbert space), then only there is a meaningful correspondence for the SWAP to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case if it happens that they are not (suppose one qubit and other qtrit), then the extra degrees of freedom of the qtrit would not take part in the algorithm governed by the Hamiltonian which mimics the SWAP gate.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-02-08T14:45:17.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5440" PostTypeId="2" ParentId="5422" CreationDate="2019-02-08T15:28:03.300" Score="3" Body="&lt;p&gt;The two quantum circuits generated and submitted to the IBMQ system by your code are the same. So ideally, the result should be both &lt;code&gt;{'0':500,'1':500}&lt;/code&gt;, but since those circuits are run on an experimental platform, a little fluctuation is tolerable.&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="26" LastEditDate="2019-02-08T15:31:32.860" LastActivityDate="2019-02-08T15:31:32.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5442" PostTypeId="2" ParentId="5380" CreationDate="2019-02-08T16:40:16.293" Score="1" Body="&lt;p&gt;Answering what &lt;em&gt;the&lt;/em&gt; &quot;actual mechanism&quot; is, is a very difficult question. I don't think there is any widespread consensus as to exactly which aspect of quantum mechanics leads to quantum speed-ups. Or said differently, the answer to &quot;&lt;em&gt;what is the actual mechanism behind quantum computing&lt;/em&gt;&quot; is arguably &quot;&lt;em&gt;quantum mechanics&lt;/em&gt;&quot;, although this is obviously not a very satisfactory answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonetheless, there are a few tricks that quantum computers exploit which can be considered among the main tricks at play in many quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, one of the main characteristics of quantum computers is that they can operate on a space that is &lt;em&gt;much&lt;/em&gt; larger than the space of the possible classical states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this I mean that if, for example, you consider a computation on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, then the corresponding (pure) states correspond to unit vectors in a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional vector space, and quantum computers operate by rotating and moving around these vectors in this huge vector space.&#xA;Whenever you actually get an output, you will still only get one of the possible &quot;classical&quot; outputs (a bit string in this case), but still to get to that output from the given input, the quantum computer is allowed to explore a vastly larger space of possibilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A case in which this is nicely seen is for example &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt;.&#xA;Each step of Grover's algorithm can be directly visualized as a rotation of the initial state towards the target state (see e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5306/55&quot;&gt;this answer&lt;/a&gt;). Such rotations exist in a space that is quite simply not accessible to classical devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another common argument is that quantum computers allow you to somehow probe the output of a function on many different inputs at the same time (assuming to be able to implement that function coherently as a unitary operation). This does not quite mean that one can &quot;check many possibilities at the same time&quot;, but it does mean that one can use a function a single time and get an output which &lt;em&gt;depends&lt;/em&gt; on the way that function operates on a whole lot of inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, Grover's algorithm is a good example of this, but in this case Deutsch-Jozsa is probably an even better one, as it shows how one can use a function &lt;em&gt;a single time&lt;/em&gt; and yet deterministically figure out how that function operates on different inputs (while classically there is simply no way to know how a function operates on two inputs without trying them both).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-02-08T16:51:12.660" LastActivityDate="2019-02-08T16:51:12.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5443" PostTypeId="2" ParentId="5395" CreationDate="2019-02-09T00:13:18.080" Score="2" Body="&lt;p&gt;As to &quot;who discovered/invented the &lt;em&gt;quantum phase estimation algorithm&lt;/em&gt;,&quot; in his 2011 &lt;a href=&quot;https://www.youtube.com/watch?v=KtIPAPyaPOg&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; at Keio University describing the linear equations algorithm, at about the 18 minute mark Lloyd claims that it was inherent in the works of Von Neumann.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That reminds me of the argument that &quot;Gauss &lt;a href=&quot;https://ieeexplore.ieee.org/document/1162257&quot; rel=&quot;nofollow noreferrer&quot;&gt;discovered&lt;/a&gt; the Fast Fourier Transform 160 years before Cooley and Tukey.&quot;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-02-09T00:13:18.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5444" PostTypeId="1" AcceptedAnswerId="5585" CreationDate="2019-02-09T07:44:26.943" Score="6" ViewCount="776" Body="&lt;p&gt;Consider the modular exponentiation part of Shor's algorithm which in many works is just referred to as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_{f}\sum^{N-1}_{x = 0}\vert x\rangle\vert 0\rangle = \vert x\rangle\vert a^{x}\text{ mod }N\rangle$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is random number between &lt;span class=&quot;math-container&quot;&gt;$1 &amp;lt; a &amp;lt; N.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{f}$&lt;/span&gt; is frequently left as a black box, but sometimes when I look in papers that write about it and see the actual circuit I don't really understand. More so when I trying to connect it with the algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here is my understanding: Shor's algorithm begins with the initialization of 2 registers of qubits. First set to hold the superposition of number from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number that needs to be factored) and the second register to hold the function &lt;span class=&quot;math-container&quot;&gt;$f(x) = a^{x} \text{ mod } N$&lt;/span&gt;. Then with or without measuring the second register, the result is the same. So does measurement matter or not? Then one obtains the result after applying quantum Fourier transform on the first register (leave the matter of extract period).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am confused about how the second register holds &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. I mean the algorithm computes &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; with repeated squaring (classically) right? Then how does the second register of qubits hold the value in a superposition of sequence (modular exponentiation sequence)? Did I misunderstand something?&lt;/p&gt;&#xA;" OwnerUserId="4729" LastEditorUserId="26" LastEditDate="2019-02-09T08:32:25.880" LastActivityDate="2019-03-01T15:15:41.663" Title="How exactly does modular exponentiation in Shor's algorithm work?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5445" PostTypeId="1" CreationDate="2019-02-09T09:06:28.097" Score="9" ViewCount="207" Body="&lt;p&gt;I was wondering why till date Grover search has been implemented only till 3 qubits (corresponding to size of database = 8). &lt;a href=&quot;https://www.nature.com/articles/s41467-017-01904-7&quot; rel=&quot;noreferrer&quot;&gt;Refer this paper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why I ask is that we have much larger sized quantum computers today. For eg IBM has 50 qubits, Google has announced 72. Why can't we run a larger sized Grover algorithm on these computers ? Some of my guesses (based on theoretical issues) are as follows : &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Circuit architecture restrictions : Perhaps the gate set and the underlying architecture of the circuits provided by these computers puts a restriction. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Error corrections : Additional qubits are required for correcting errors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would like to know if there are any additional practical/physics issues that is limiting the use of Grover search currently. &lt;/p&gt;&#xA;" OwnerUserId="5761" LastActivityDate="2019-02-09T12:48:11.497" Title="Current limits on Grover search space" Tags="&lt;architecture&gt;&lt;physical-realization&gt;&lt;grovers-algorithm&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5446" PostTypeId="2" ParentId="5445" CreationDate="2019-02-09T12:48:11.497" Score="4" Body="&lt;p&gt;I am going to try to give guesses that can make sense:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;More qubits does not mean better machines. They may be less noise-tolerant and with less connectivity between qubits. That is why, when you benchmark them (with or without error-correction), you look first at the simplest implementations of state of art algorithms. Plus, you may change some calibrations parameters of the machine based on these results.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Implementing a multi-controlled NOT gate (for example as the oracle) can require a lot of quantum operations like Toffolis (which has a quite deep decomposation into 2-qubit and 1-qubit set of gates), meaning you have deeper circuits, which are more difficult to apply given the (depth) limit of these quantum computers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The example circuit you refer to is a very toy example. So it is not very useful other than benchmarking so far.&lt;/p&gt;&#xA;&lt;p&gt;Please, bear in mind these are guesses. There may be many things going on and this is a research playground with a few people involved in the field.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-02-09T12:48:11.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5447" PostTypeId="1" CreationDate="2019-02-09T14:21:34.673" Score="1" ViewCount="203" Body="&lt;p&gt;I have updated qiskit module but unfortunately, it doesn't work it says &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;C:\Users\Aman\AppData\Local\Programs\Python\Python36-32&#xA;\lib\site-packages\marshmallow\schema.py:364: &#xA;ChangedInMarshmallow3Warning: strict=False is not recommended. &#xA;&#xA;In marshmallow 3.0, schemas will always be strict. See &#xA;https://marshmallow.readthedocs.io/en/latest/upgrading.html&#xA;#schemas-are-always-strict ChangedInMarshmallow3Warning&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What shall I do?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="26" LastEditDate="2019-02-09T14:57:14.307" LastActivityDate="2019-02-11T05:35:48.070" Title="QISKit warrning on marshmallow" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5448" PostTypeId="1" CreationDate="2019-02-10T00:55:58.463" Score="2" ViewCount="67" Body="&lt;p&gt;There is a vast amount of new notations which would be new even to Ph.D. in math.  How on Earth can I catch up with all of this?  Is there a place online which is devoted to the QC syntax? &#xA;I would like to show a few examples, if someone can explain even just them, it would be of much help!&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle\psi|U^{\dagger}MU|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle0|$&lt;/span&gt;  or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle |0\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ {\oplus}$&lt;/span&gt;                               &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have no clue it looks like some sort of inner product.  I saw somewhere this equals the probability of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. (Where M is a measurement matrix?) Have no idea!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The first I saw something like it's a projection of any vector on zero. So this is an operator, not a vector.  On the other hand, not sure about  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle |0\rangle$&lt;/span&gt;.  Thought saw them somewhere.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it a NOT gate? XOR gate? Or denoting any possible operation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Vector zero, and composition of subscript n appearing above like a 'power'.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Can someone clear up the confusion?  Or offering a place to look them all and their definitions up? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-02-10T07:22:46.527" LastActivityDate="2019-02-10T07:30:15.303" Title="Is there a place online where I can catch up with all the notational syntax associated with quantum computing?" Tags="&lt;resource-request&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5449" PostTypeId="2" ParentId="5448" CreationDate="2019-02-10T07:30:15.303" Score="2" Body="&lt;p&gt;Get hold of a copy of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang textbook&lt;/a&gt; and read the first few chapters. If you google it you'll find the PDF version easily, although, of course, I'd recommend buying it. Almost all the notation you mention is explained in chapters 1 and 2 of the textbook. Catching up with notation is no big deal if you have studied linear algebra before. Even if you haven't, the book has a whole chapter dedicated to linear algebra, which you can learn from scratch.  &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-02-10T07:30:15.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5450" PostTypeId="1" AcceptedAnswerId="5453" CreationDate="2019-02-10T15:44:59.577" Score="2" ViewCount="142" Body="&lt;p&gt;Is there a way to create a rotation gate which has half the angle of some implementable gate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking to implement a gate on Quirk which allows for standard time-dependent rotations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_x(\theta=t)=e^{iXt}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I'd like to construct the same gate but with &lt;span class=&quot;math-container&quot;&gt;$\theta=\frac{t}{2}$&lt;/span&gt; so I can have two different oscillation frequencies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some standard way to do this?&lt;/p&gt;&#xA;" OwnerUserId="5594" LastEditorUserId="26" LastEditDate="2019-03-30T07:45:11.510" LastActivityDate="2019-03-30T07:45:11.510" Title="How to implement a $\frac{\theta}{2}$ rotation from $\theta$ rotation?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5451" PostTypeId="2" ParentId="5421" CreationDate="2019-02-10T19:35:48.187" Score="7" Body="&lt;p&gt;There is evidently a classical polynomial-time algorithm for finding a four-coloring of a given planar graph, so the answer to the question is &quot;yes&quot; for the trivial reason that every polynomial-time classical algorithm can be implemented as a polynomial-time quantum algorithm. (Also, polynomial time implies polynomial space, for both quantum and classical algorithms, so that part is trivially satisfied.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An important aspect of the problem that the question describes is that we are asked to &lt;em&gt;find&lt;/em&gt; a four-coloring, as opposed to deciding whether or not a four-coloring exists. Deciding the existence of a four-coloring for a planar graph would be trivial: the correct answer is always &quot;yes&quot; by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Four_color_theorem&quot; rel=&quot;noreferrer&quot;&gt;four-color theorem&lt;/a&gt;. This theorem was proved in 1976 by Appel and Haken's famous computer-assisted proof, and it is my understanding that Appel and Haken's proof can in principle be turned into a quartic-time algorithm for finding a four-coloring of a planar graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof of the four-color theorem was simplified somewhat in this paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Neil Robertson, Daniel Sanders, Paul Seymour, and Robin Thomas. The four-colour theorem. &lt;em&gt;Journal of Combinatorial Theory, Series B&lt;/em&gt; 70: 2-44, 1997.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(Available from &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.158.9438&amp;amp;rep=rep1&amp;amp;type=pdf&quot; rel=&quot;noreferrer&quot;&gt;CiteSeerX&lt;/a&gt;.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In this paper, the authors claim explicitly (see Section 6) that their proof yields a quadratic-time classical algorithm for finding a four-coloring of a planar graph.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2019-02-10T19:35:48.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5452" PostTypeId="1" CreationDate="2019-02-10T20:16:01.040" Score="7" ViewCount="170" Body="&lt;p&gt;I have questions regarding quantum teleportation, which keep confusing me.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose Alice and Bob are in the same inertial frame &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, and at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; (in &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;) Alice teleports a quantum state to Bob. What I always hear is that this means that at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, Bob has then got one of four states, although he does not yet know exactly which one of the four. Is this true?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, what if Alice and Bob are both moving along the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis of &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, in the same direction, both with the same speed &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;? If Alice does her part of the protocol at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; (again, as seen in &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;), then if Bob is behind Alice (w.r.t. their common direction of movement in &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;), he must get the quantum state before &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, due to special relativity (as calculated by the Lorentz transformation, assuming his quantum state &quot;arrives&quot; at the same time as Alice sends it, in the inertial frame where both of them are at rest). This sounds weird as if the cause had happened after the effect.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And what if Alice and Bob are not in the same inertial frame? Then the point in time Alice executes her part in her inertial frame does not correspond to any single point in time in Bob’s inertial frame. So what can we say about the arrival time of the quantum state to Bob?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Cross-posted to &lt;a href=&quot;https://physics.stackexchange.com/questions/459986/quantum-teleportation-with-moving-alice-and-bob&quot;&gt;Physics&lt;/a&gt;. I've accepted &lt;a href=&quot;https://physics.stackexchange.com/a/460001&quot;&gt;this&lt;/a&gt; answer there. &lt;/p&gt;&#xA;" OwnerUserId="5767" LastEditorUserId="55" LastEditDate="2019-02-13T09:44:33.193" LastActivityDate="2019-02-13T09:44:33.193" Title="Quantum teleportation with moving Alice and Bob" Tags="&lt;quantum-information&gt;&lt;teleportation&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5453" PostTypeId="2" ParentId="5450" CreationDate="2019-02-10T20:29:29.890" Score="3" Body="&lt;p&gt;(This answer is specific to the context of the question, which is about doing this construction out of Quirk's time dependent gates.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not possible to have proper half-speed time-dependent rotations in Quirk. Behind the scenes there is actually a value &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; that is varying from 0 to 1 and then cycling. If you managed to find a construction to cut the angle in half, your rotation would jump from 180 degrees to 0 degrees when &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; went from 1 to 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that's acceptable, then the simplest way to achieve it is by &lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C%22Counting5%22%5D%2C%5B%22X%5Et%22%2C%22X%5E(A%2F2%5En)%22%2C%22inputA5%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;using the parameterized rotation gates and a counting gate&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C%22Counting5%22%5D%2C%5B%22X%5Et%22%2C%22X%5E(A%2F2%5En)%22%2C%22inputA5%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/96KYi.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative trade-off do is define double-speed rotations by using pairs of time-dependent rotation gates, and then work in units of &lt;span class=&quot;math-container&quot;&gt;$2t$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. You can use custom circuit gates to fuse them into a single block. If custom gates annoy you (they are by far the weakest part of the UX), the time-dependent gradient gate gives you a series of faster and faster rotations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22grad%5Et3%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%2C%22Bloch%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bS5wH.png&quot; alt=&quot;gradient gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-10T20:29:29.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5454" PostTypeId="1" AcceptedAnswerId="5537" CreationDate="2019-02-10T23:06:48.910" Score="10" ViewCount="493" Body="&lt;p&gt;In other words, will factoring research remain &lt;em&gt;solely&lt;/em&gt; in the classical world or are there interesting research on-going in the quantum world related to factoring?&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="1589" LastEditDate="2019-02-21T13:51:54.467" LastActivityDate="2019-05-05T14:01:49.497" Title="Does Shor's algorithm end the search for factoring algorithms in the quantum world of computation?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5455" PostTypeId="1" CreationDate="2019-02-10T23:17:38.943" Score="8" ViewCount="211" Body="&lt;p&gt;I'm looking for fast code, or a fast algorithm, for checking if a given state vector &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be transformed into another state vector &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; using only the Pauli operations &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The naive strategy is to simply iterate through all &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; ways to apply a Pauli operation (or no operation) to each of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, actually simulate applying the operations (&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; cost for each qubit for each case) to one of the states, and check if the resulting state vector is equivalent to the other state. Surely it's possible to do this in better than worst case &lt;span class=&quot;math-container&quot;&gt;$n 8^n$&lt;/span&gt; time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Update] I am specifically interested in &lt;em&gt;worst case&lt;/em&gt; performance. Heuristics are interesting and useful answers, but won't become the accepted answer.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-02-11T19:13:41.910" LastActivityDate="2019-02-11T19:13:41.910" Title="Fast way to check if two state vectors are equivalent up to Pauli operations" Tags="&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5456" PostTypeId="2" ParentId="5447" CreationDate="2019-02-11T05:35:48.070" Score="3" Body="&lt;p&gt;This is a Just a Python warning about deprecated usage. It will be fixed in the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/1652&quot; rel=&quot;nofollow noreferrer&quot;&gt;next release&lt;/a&gt;. It should not prevent you from upgrading Qiskit or writing any code today.&lt;/p&gt;&#xA;" OwnerUserId="5771" LastActivityDate="2019-02-11T05:35:48.070" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5458" PostTypeId="2" ParentId="5455" CreationDate="2019-02-11T08:05:00.467" Score="2" Body="&lt;p&gt;The way that I thought to start was to look at the reduced density matrices of the individual qubits. If they cannot be interconverted using Pauli matrices, then the whole thing can't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only problem is that this idea breaks down as soon any of the reduced density matrices are maximally mixed. At that point, you could ask &quot;are the two states equivalent under local unitaries?&quot;. If you derive the unitaries as a result of that question, then it's easy to test if they're Pauli or not. This was studied &lt;a href=&quot;https://arxiv.org/abs/0909.5152v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I think there are still cases where the scaling is problematic, but I don't remember the bit with maximally mixed reduced density matrices well enough.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-11T08:05:00.467" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5459" PostTypeId="1" CreationDate="2019-02-11T09:52:36.743" Score="6" ViewCount="229" Body="&lt;p&gt;Since quantum computer with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is described by a &lt;span class=&quot;math-container&quot;&gt;$2^{n}\times2^{n}$&lt;/span&gt;  unitary matrix is it equivalent to an oracle that can do multiplication of large matrix and return &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; numbers computed from it in a time polynomial by &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if yes how precise the number representation in the oracle should be, should the precision increase exponentially with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: as pointed out the oracle should not simply multiply, but should expand &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit string into &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; corresponding to a pure state, work only for unitary matrices, and return n bits corresponding to measurement, and not arbitrary numbers. Are there some other such corrections to make a representation with oracle possible?&lt;/p&gt;&#xA;" OwnerUserId="5768" LastEditorUserId="5768" LastEditDate="2019-02-13T19:48:34.203" LastActivityDate="2019-02-14T16:53:07.960" Title="Is quantum computer equivalent to Turing machine with matrix multiplication oracle?" Tags="&lt;complexity-theory&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5460" PostTypeId="1" CreationDate="2019-02-11T12:37:33.640" Score="3" ViewCount="108" Body="&lt;p&gt;I don't really know the difference between projective measurement and regular measurement or POVM.  Until now, wherever I read about the subject I saw that the amplitude describes the probability of obtaining corresponding state when measuring it.  I am not sure if this said measure is what you call a projective or regular.&#xA;Can someone clear up the confusion? What's the about projective vs regular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I saw somewhere that there is such a measurement M associated with POVM (corresponding to P??), but I am not sure what it says intuitively as well as mathematically.  Which may as well help make clear the difference between the above mentioned ones. &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="5742" LastEditDate="2019-02-12T00:40:09.237" LastActivityDate="2019-02-12T00:40:09.237" Title="Do the probability amplitudes describe the probability of projective measurement?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5461" PostTypeId="2" ParentId="5455" CreationDate="2019-02-11T15:37:09.690" Score="2" Body="&lt;p&gt;Pick an element &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; of A and find its position in B, disregarding changes in phase.&#xA;The shift in position uniquely identifies the series of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; applications needed for the transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relative phase of &lt;span class=&quot;math-container&quot;&gt;$(a_0, b_0)$&lt;/span&gt; tells you, in steps of &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; rotations, how many &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gates you need for the transformation. The relative phase of &lt;span class=&quot;math-container&quot;&gt;$(a_1,b_1)$&lt;/span&gt; to  &lt;span class=&quot;math-container&quot;&gt;$(a_0,b_0)$&lt;/span&gt; tells you have many &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates act on the first qubit; and so on for the relative phase of &lt;span class=&quot;math-container&quot;&gt;$(a_{2^{k-1}},b_{2^{k-1}})$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(a_0,b_0)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates acting on qubit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; does not appear in B then the transformation is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the above can be done in &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;-sh.&lt;/p&gt;&#xA;" OwnerUserId="2214" LastActivityDate="2019-02-11T15:37:09.690" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="5462" PostTypeId="1" AcceptedAnswerId="5463" CreationDate="2019-02-11T18:37:37.540" Score="4" ViewCount="263" Body="&lt;p&gt;When faced with exercises like these, I find it hard to know how to construct the circuits due to the amount of input one needs to account for.&#xA;I have seen the solution provided &lt;a href=&quot;http://web.mit.edu/2.111/www/2010/ps4solution.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; however, I don't think I would have been able to solve this exercise my self.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any tips on a systematic way to construct a circuit like this? I start out with a circuit which solves one specific input (for example for &lt;span class=&quot;math-container&quot;&gt;$x = |00\rangle, y = |01\rangle$&lt;/span&gt;), but after this I get stuck. I appreciate any help!&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="26" LastEditDate="2019-03-30T08:31:07.830" LastActivityDate="2020-01-24T22:06:39.423" Title="Constructing a circuit which performs the transformation $|x,y\rangle \to |x, x + y \bmod 4\rangle$" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5463" PostTypeId="2" ParentId="5462" CreationDate="2019-02-11T19:32:54.093" Score="6" Body="&lt;p&gt;Here are some strategies.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Start from a classical circuit, and do a naive transformation into a quantum circuit (e.g. AND gate becomes Toffoli onto a clean ancilla). Find ways to uncompute intermediate values and other garbage. Then optimize optimize optimize until it's compact. It helps to know a lot of trivial circuit identities when optimizing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Decompose into simpler problems. For example, separate the two-bit addition into two controlled increments then figure out how to do a controlled increment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get inspiration from algebraic boolean expressions for the output values. For example, if you are incrementing a register &lt;span class=&quot;math-container&quot;&gt;$x_0, x_1, x_2, ..., x_k$&lt;/span&gt; then qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; transitions from &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x_i \oplus \prod_{j&amp;lt;i} x_j$&lt;/span&gt; and this form suggests a simple circuit that you can create.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Brute force one output bit at a time. This only works for smaller circuits. Figure out every situation where each bit should be ON, and for each of those cases output a multi-controlled NOT targeting a clean ancilla to represent the output. Then do the same strategy in reverse to uncompute the input. Then optimize optimize optimize.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Diagonalize the problem. Is there a simple unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that maps your problem's eigenstates to the computational basis states? Apply it, then phase the appropriate states using many-controlled Z rotations, then un-apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. In the case of addition, the operation that does this is the QFT and you won't even need the Z rotations to be controlled.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Find a loop invariant that breaks the problem into constant-sized pieces. In the case of adders, the invariant is packaged up into the carry bit that propagates through ripple-carry adders. Can you find an equivalent of a carry bit for your problem?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pay attention to data dependencies. Start by getting the value of qubits with no dependents correct. Then remove those qubits from the dependency graph and iterate. Two-bit addition has a very simple dependency graph, and so this approach works well on it. If the dependency graph has cycles, the problem will be much harder.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply generic problem solving (i.e. read &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/069111966X&quot; rel=&quot;noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to Solve It&lt;/a&gt;). For example, get a foothold by dropping constraints. What if you were allowed to get the phases wrong, or to create junk? What if you only have to get &lt;em&gt;some&lt;/em&gt; of the qubits correct, and are allowed to trash the others? What if you had more workspace? What if one of the input qubits was promised to be in the 0 state? The 1 state? The + state? What if you only had to do 1 bit addition, or 1-bit-register-into-2-bit-register addition?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-02-11T19:46:41.437" LastActivityDate="2019-02-11T19:46:41.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5464" PostTypeId="2" ParentId="5462" CreationDate="2019-02-11T20:02:31.640" Score="4" Body="&lt;p&gt;For simplicity let's assume &lt;span class=&quot;math-container&quot;&gt;$x, y \in \mathbb{N}$&lt;/span&gt;, since worrying about two's complement representation for negative numbers is just annoying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, this function must be reversible. That means &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is restricted to the range &lt;span class=&quot;math-container&quot;&gt;$0 \dots 3$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$(x + 0) \bmod 4 = (x + 4) \bmod 4$&lt;/span&gt;, so if we allow &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; values outside of &lt;span class=&quot;math-container&quot;&gt;$0 \dots 3$&lt;/span&gt; we cannot reverse the function (uniquely identify &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; given the values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(x + y) \bmod 4$&lt;/span&gt;). This means the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; input can be at most two qbits in size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then consider that &lt;span class=&quot;math-container&quot;&gt;$(x + y) \bmod 4 = (x \bmod 4) + (y \bmod 4)$&lt;/span&gt;. This means that we only have to care about the two least-significant qbits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; when calculating &lt;span class=&quot;math-container&quot;&gt;$(x + y) \bmod 4$&lt;/span&gt;. Thus, given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; input qbits for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; input qbits for &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, our circuit will only &quot;touch&quot; the two least-significant qbits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (probably as input to a CNOT) and leave the other &lt;span class=&quot;math-container&quot;&gt;$n-2$&lt;/span&gt; qbits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; alone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For simplicity, let's build our circuit assuming &lt;span class=&quot;math-container&quot;&gt;$n = 2$&lt;/span&gt;. We can of course construct our circuit by just calculating the desired action on all &lt;span class=&quot;math-container&quot;&gt;$2^4$&lt;/span&gt; possible input values then writing a matrix corresponding to that, but that's boring. Let's simplify it even more; let &lt;span class=&quot;math-container&quot;&gt;$x = |ab\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y = |cd\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d \in \{0, 1\}$&lt;/span&gt;; &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; are also our output qbits. We have the following observations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When &lt;span class=&quot;math-container&quot;&gt;$b = d = 1$&lt;/span&gt;, we want to flip &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; (since addition of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; overflows). This is clearly the action of a Toffoli gate.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;span class=&quot;math-container&quot;&gt;$b = 1$&lt;/span&gt;, we want to flip &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. For this we use a CNOT.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;span class=&quot;math-container&quot;&gt;$a = 1$&lt;/span&gt;, we want to flip &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. For this we again use a CNOT.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This means for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, our circuit is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/g1fwx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g1fwx.png&quot; alt=&quot;solution circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For higher values of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, we just ignore the &lt;span class=&quot;math-container&quot;&gt;$n-2$&lt;/span&gt; most-significant qbits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, problems like these are just that: problems. They require some amount of mathematical trickiness, reasoning, and breaking down the problem to work through. Hopefully when reading the above you can see how each step followed from the last until we can use our intuition to solve the problem. For quantum computing problems specifically, they'll become easier as you learn the valid &quot;moves&quot; you can make around the problem space.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-02-11T20:17:50.753" LastActivityDate="2019-02-11T20:17:50.753" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5465" PostTypeId="2" ParentId="5460" CreationDate="2019-02-11T20:52:59.993" Score="3" Body="&lt;p&gt;What you call &quot;regular&quot; measurement is probably projective measurement onto the computational basis, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Most introductory quantum computing resources define a qbit as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; gives you the probability of collapse to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; gives you the probability of collapse to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If this is what you know as &quot;regular&quot; measurement, then yes it's just projective measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition to measuring in the computational basis, you can do a projective measurement onto any pair of orthogonal unit vectors. You do this by rewriting your quantum state in that basis. &lt;a href=&quot;https://www.youtube.com/watch?v=P2LTAUO1TdA&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a good video tutorial on how to do change-of-basis. For example, we can measure in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following qbit value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = 1|0\rangle + 0|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This qbit value has a 100% chance of collapsing to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; when measured in the computational basis. What if we were to measure it in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis? First we have to do a change-of-basis to the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis, where it is written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \frac{1}{\sqrt{2}}|+\rangle + \frac{1}{\sqrt{2}}|-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note we did not change the value of the qbit at all, we are just writing it a different way (in a different basis). Now we see that if we measure &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis, it has a 50% chance of collapsing to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and a 50% chance of collapsing to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's called projective measurement because geometrically you're &quot;projecting&quot; your quantum state vector onto the measurement basis vectors, and the length of the projection on a basis vector gives you the probability of collapsing to that basis vector.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-02-11T20:52:59.993" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5466" PostTypeId="1" AcceptedAnswerId="5467" CreationDate="2019-02-12T12:33:57.207" Score="6" ViewCount="72" Body="&lt;p&gt;Assume that we know a quantum state and the result of applying an unknown unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on it. For example, if the quantum states are pure qubits, we know &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle=\gamma|0\rangle+\delta|1\rangle$&lt;/span&gt;. Then how can we compute the unknown operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="26" LastEditDate="2019-03-30T07:49:39.947" LastActivityDate="2019-03-30T07:49:39.947" Title="If $|\psi\rangle, U|\psi\rangle$ are known, how many pairs of such qubits are required to find the operator $U$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5467" PostTypeId="2" ParentId="5466" CreationDate="2019-02-12T12:44:03.017" Score="7" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts on a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional Hilbert space, then you need the result &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt; for a set of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; linearly independent vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you're talking about a single qubit unitary, you need two different states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. If you have these, then by linearity you can find out&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|0\rangle=\alpha|0\rangle+\beta|1\rangle\qquad U|1\rangle=\gamma|0\rangle+\delta|1\rangle.&#xA;$$&lt;/span&gt;&#xA;Then, your &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is just&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left(\begin{array}{cc} \alpha &amp;amp; \gamma \\ \beta &amp;amp; \delta \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;(the columns are just the individual outcomes for the computational basis states.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might wonder if you can get away with fewer. For example, we know that &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; must be orthogonal. However, there is still some freedom of parameters (such as a global phase) that you cannot determine, and hence you need to know both outcomes.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-12T12:44:03.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5468" PostTypeId="1" CreationDate="2019-02-12T13:10:39.407" Score="6" ViewCount="43" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0612147&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiseman et al. (2007)&lt;/a&gt;, in the process of deriving necessary and sufficient conditions for the steerability of some classes of states, the authors show (lemma 1, page 3) how to construct an &lt;em&gt;optimal ensemble&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$F^\star=\{\rho_\xi^\star\mathscr P_\xi^\star\}$&lt;/span&gt; such that, if this ensemble &lt;em&gt;cannot&lt;/em&gt; explain Bob's state via a local hidden state, then no other ensemble can.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;More precisely, the context is that of Alice trying to convince Bob that she can &lt;em&gt;steer&lt;/em&gt; his state by means of her performing measurements on her part of the system. In other words, we assume that Alice and Bob share some state &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, and that Alice performs measurements &lt;span class=&quot;math-container&quot;&gt;$A\in\mathscr M$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mathscr M$&lt;/span&gt; denoting here the measurements that Alice can choose to perform) on her part of the system.&#xA;If Alice performs measurement &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and gets result &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, then Bob's state becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tilde\rho_a^A=\operatorname{Tr}_\alpha[W(\Pi_a^A\otimes I)],$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_\alpha$&lt;/span&gt; denotes the partial trace with respect to Alice's part of the system, and the tilde is used to remember that this is an &lt;em&gt;unnormalised&lt;/em&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Bob &lt;em&gt;can&lt;/em&gt; describe this state by means of some prior &lt;em&gt;local hidden state&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_\xi p_\xi\rho_\xi$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tilde\rho_a^A=\sum_\xi\mathscr P(a|A,\xi)p_\xi\rho_\xi,\tag5$$&lt;/span&gt;&#xA;then he is &lt;em&gt;not&lt;/em&gt; convinced that Alice can steer his system, as it would mean that he can describe his observations by simply assuming that what he is measuring is some local state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; that is not affected by Alice.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is about the aforementioned lemma that is proved in the paper: &lt;em&gt;why is the ensemble &lt;span class=&quot;math-container&quot;&gt;$F^\star$&lt;/span&gt; optimal&lt;/em&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The lemma is as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider a group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; with unitary representation &lt;span class=&quot;math-container&quot;&gt;$U_{\alpha\beta}(g)=U_\alpha(g)\otimes U_\beta(g)$&lt;/span&gt;. Suppose that for every measurement &lt;span class=&quot;math-container&quot;&gt;$A\in\mathscr M$&lt;/span&gt;, outcome (that is, eigenvalue) &lt;span class=&quot;math-container&quot;&gt;$a\in\lambda(A)$&lt;/span&gt;, and group element &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$U_\alpha^\dagger(g)A U_\alpha(g)\in\mathscr M$&lt;/span&gt;, and moreover&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\tilde\rho_a^{U_\alpha^\dagger(g)AU_\alpha(g)}=U_\beta(g)\tilde\rho_a^A U^\dagger_\beta(g).$$&lt;/span&gt;&#xA;  Then there exists a &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;-covariant optimal ensemble, that is, one such that &lt;span class=&quot;math-container&quot;&gt;$\forall g\in G$&lt;/span&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\{\rho_\xi^\star\mathscr P_\xi^\star\}=\{U_\beta(g)\rho_\xi^\star U_\beta^\dagger(g)\mathscr P_\xi^\star\}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They then proceed to give an ensemble that they prove (not that I understand this proof, but that is another matter) &lt;em&gt;does&lt;/em&gt; satisfy &lt;strong&gt;(5)&lt;/strong&gt;.&#xA;Why is this then proving that if this ensemble &lt;em&gt;does not&lt;/em&gt; satisfy &lt;strong&gt;(5)&lt;/strong&gt; then no other ensemble can? I find this quite confusing, given that we just proved that it &lt;em&gt;does&lt;/em&gt; satisfy &lt;strong&gt;(5)&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-12-20T22:22:08.513" LastActivityDate="2020-12-20T22:22:08.513" Title="Construction of optimal ensemble to show quantum steerability" Tags="&lt;entanglement&gt;&lt;nonclassicality&gt;&lt;steering&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5469" PostTypeId="5" CreationDate="2019-02-12T13:17:21.183" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-02-12T13:17:21.183" LastActivityDate="2019-02-12T13:17:21.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5470" PostTypeId="4" CreationDate="2019-02-12T13:17:21.183" Score="0" Body="For questions about the nonclassical properties of quantum systems, that is, properties of quantum systems that are incompatible with classical physics. Nonclassicality is a more general notion than that of entanglement, and the term can be used to loosely refer to different notions, such as nonlocality, steerability, non-Gaussianity, and many more." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-02-12T13:17:21.183" LastActivityDate="2019-02-12T13:17:21.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5471" PostTypeId="1" AcceptedAnswerId="5475" CreationDate="2019-02-12T13:54:43.287" Score="2" ViewCount="147" Body="&lt;p&gt;I just started programming in Q# and I wonder if the coding for Q# in classical computer would be the same as coding in a quantum computer. Obviously, these 2 kinds of computers work differently, so I guess the language must be working differently as well. Does this affect the coding part in any way (syntax, dealing with operations and variables etc.)?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="26" LastEditDate="2019-02-12T15:37:59.703" LastActivityDate="2019-02-12T17:48:13.500" Title="Is programming in quantum computer same as programming in quantum simulator in classical computer?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5472" PostTypeId="1" AcceptedAnswerId="5478" CreationDate="2019-02-12T15:04:44.810" Score="-1" ViewCount="129" Body="&lt;p&gt;In QC and QI by Chuang and Nielsen, they state that the &lt;span class=&quot;math-container&quot;&gt;$P_U$&lt;/span&gt; of operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; can be reached by &lt;span class=&quot;math-container&quot;&gt;$\langle \psi |U^{\dagger} M U |\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$P_U$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$P_V$&lt;/span&gt;) is the probability of obtaining the corresponding measurement outcome if the operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;). And &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a POVM measurement element.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|P_U − P_V | = \langle \psi |U^{\dagger} M U|\psi\rangle −\langle \psi |V^{\dagger} M V |\psi\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This equality appears in the book on page 195 (Box 4.1: Approximating quantum circuits; equation 4.64).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand it. Can anyone explain it? And why do they equal each other? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-02-12T22:55:19.703" LastActivityDate="2019-02-13T08:42:40.957" Title="Why does $|P_U − P_V |$ equal $\langle \psi |U^{\dagger} M U|\psi\rangle −\langle \psi |V^{\dagger} M V |\psi\rangle$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5473" PostTypeId="2" ParentId="5471" CreationDate="2019-02-12T15:56:41.660" Score="2" Body="&lt;p&gt;As far as working is concerned, you are right. A quantum computer works entirely differently than a classical simulator for the same. &#xA;Whether there will be any difference in the &quot;coding part&quot; depends on the specific cases. While you cannot get a real quantum computer yet, a lot of online tools are available for cloud Quantum Computation. IBM's Qiskit, for instance, would have no difference in the coding part in the cloud quantum and the classical simulation. All you change is you import another library for the API usage. You can check the same for Rigetti's pyQuil. &lt;/p&gt;&#xA;" OwnerUserId="2951" LastActivityDate="2019-02-12T15:56:41.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5474" PostTypeId="2" ParentId="5459" CreationDate="2019-02-12T17:31:40.080" Score="2" Body="&lt;p&gt;The answer is &lt;strong&gt;no&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for this is the exponential size of the Hilbert space. Consider a single-tape TM with a matrix multiplication (MM) oracle which calculates the action of any unitary matrix on a vector of complex numbers. We'll define its input format as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[U][x][\alpha_0 \ldots \alpha_{x-1}]$&lt;/span&gt; where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is some symbol or series of symbols specifying the unitary transformation to perform (easily done in polynomial space)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a binary encoding of the number of complex numbers in the input vector&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha_0 \ldots \alpha_{x-1}$&lt;/span&gt; is some encoding of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; complex numbers separated by a symbol&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The MM oracle reads this input format, applies &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\alpha_0 \ldots \alpha_{x-1}$&lt;/span&gt;, then overwrites those numbers with the output &lt;span class=&quot;math-container&quot;&gt;$\alpha_0' \ldots \alpha'_{x-1}$&lt;/span&gt; in a single step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key here is that for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbits, &lt;span class=&quot;math-container&quot;&gt;$x = 2^n$&lt;/span&gt; because of entanglement. When the qbits become entangled, their product state cannot be factored into &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; individual qbit states and thus the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-sized vector must be maintained in memory. This trivially means that our TM takes exponential time to write the input vector for the MM oracle, and would also take exponential time to calculate the effect of measuring the state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: to answer your revised question, if you have tensor expansion, unitary matrix multiplication, and measurement oracles, then yes you have a quantum computer. We know this because this is the exact model used by all quantum programming languages. We write a classical-looking algorithm with these three oracles and all the magic is done under the hood.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-02-14T16:53:07.960" LastActivityDate="2019-02-14T16:53:07.960" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5475" PostTypeId="2" ParentId="5471" CreationDate="2019-02-12T17:48:13.500" Score="6" Body="&lt;p&gt;Running programs on a quantum computer will indeed require some routines which are not required for running them on a classical simulation. Two easiest examples are error correction (a classical simulation is perfect but a quantum device will be noisy and will require error correction to produce useful results) and translating logical qubits and gates to physical ones (in a simulation you can do any gate on any pair of qubits, but a physical device will be limited to certain set of primitive gates and a certain connectivity scheme).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the person writing high-level quantum code is likely uninterested in such low-level routines (unless they are researching them specifically), same as a person writing this answer doesn't really want to care about the addresses of the bytes storing it on their computer. High-level programming languages (in particular Q#, since you asked about it) aim to provide a high-level abstraction for the programmer and delegate low-level routines to the compiler. This also allows to run the same code on the simulators (for debugging and resource estimation purposes) and then to take it to a quantum device without modifications.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-02-12T17:48:13.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5476" PostTypeId="1" AcceptedAnswerId="5477" CreationDate="2019-02-12T18:59:09.550" Score="3" ViewCount="266" Body="&lt;p&gt;For example, we can create a single qubit state with a polar angle of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; with the Hadamard gate. But, can we create a state such as this,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Psi = \cos(\pi/8)|0\rangle + \sin(\pi/8)|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the polar angle does not equal &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;, in QISkit?&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="26" LastEditDate="2019-03-30T07:50:10.760" LastActivityDate="2019-03-30T07:50:10.760" Title="Is it possible to create a superposition in IBMQ QISkit which has probability amplitudes $|a|\neq |b|$?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5477" PostTypeId="2" ParentId="5476" CreationDate="2019-02-12T19:24:28.460" Score="4" Body="&lt;p&gt;You use the &lt;a href=&quot;https://qiskit.org/documentation/terra/summary_of_quantum_operations.html#standard-rotations&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard rotations&lt;/a&gt;. In this case, you're looking for the &lt;code&gt;ry&lt;/code&gt; operator (rotation around the y-axis). To rotate the state vector counter-clockwise around the unit circle by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, call &lt;code&gt;ry&lt;/code&gt; with &lt;span class=&quot;math-container&quot;&gt;$2\theta$&lt;/span&gt; or in your case &lt;span class=&quot;math-container&quot;&gt;$\frac{2\pi}{8}$&lt;/span&gt; applied to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;import numpy as np&#xA;q = QuantumRegister(1)&#xA;qc = QuantumCircuit(q)&#xA;qc.ry(2*np.pi/8,q)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="409" LastEditDate="2019-02-13T10:20:38.667" LastActivityDate="2019-02-13T10:20:38.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5478" PostTypeId="2" ParentId="5472" CreationDate="2019-02-12T23:12:57.410" Score="2" Body="&lt;p&gt;The probability that outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; associated with POVM measurement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; comes out after measuring state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be calculated by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p(m)=\langle\psi|M|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The box in the Isaac and Chuang book says that &lt;span class=&quot;math-container&quot;&gt;$P_U$&lt;/span&gt; is the probability of such outcome if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation is applied, and &lt;span class=&quot;math-container&quot;&gt;$P_V$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is applied. Consequently, we want to calculate such probabilities for states:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_U\rangle=U|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_V\rangle=&#xA;V|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Applying the definition for calculating such probabilities that I presented at the beginning, then you can obtain what you need:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$P_U=\langle\psi_U|M|\psi_U\rangle=(U|\psi\rangle)^\dagger MU|\psi\rangle=\langle\psi|U^\dagger MU|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$P_V=\langle\psi_V|M|\psi_V\rangle=(V|\psi\rangle)^\dagger MV|\psi\rangle=\langle\psi|V^\dagger MV|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To follow the question you gave in the comment to the answer. Postulate 3 of quantum mechanics states that those are described by a collection of measurement operators &lt;span class=&quot;math-container&quot;&gt;$\{M_m\}$&lt;/span&gt; related with each of the outcomes &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; that the quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can have. Such postulate does also state that the probability to get outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p(m)=\langle\psi|M_m^\dagger M_m|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;POVM measurements are given by a collection of positive operators &lt;span class=&quot;math-container&quot;&gt;$E_m$&lt;/span&gt; that fullfil that &lt;span class=&quot;math-container&quot;&gt;$\sum_m E_m=I$&lt;/span&gt;. Such operators can be related with the measument operators like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_m\equiv M_m^\dagger M_m$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this is stated in the Isaac and Chuang book on quantum computation and information that seems that you are using, so refer there for more complete details.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2019-02-13T08:42:40.957" LastActivityDate="2019-02-13T08:42:40.957" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="5480" PostTypeId="1" AcceptedAnswerId="5559" CreationDate="2019-02-13T19:58:02.370" Score="2" ViewCount="98" Body="&lt;p&gt;I've been trying to decompose the ProjectQ objects and I could manage to decompose non-controlled gates and daggered gates. But I noticed that &#xA;the object of a controlled version of a gate is the exact same as the object of that gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code generating these objects:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  eng = MainEngine()&#xA;  q = eng.allocate_qubit()&#xA;  p = eng.allocate_qubit()&#xA;  c = eng.allocate_qubit()&#xA;  X | q&#xA;  CNOT | (p,q)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the XGate object&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'_control_qubits': [],&#xA; '_engine': &amp;lt;__main__.MainEngine object at 0x7fc323e4d198&amp;gt;,&#xA; '_qubits': ([&amp;lt;projectq.types._qubit.WeakQubitRef object at 0x7fc30b0a3ef0&amp;gt;],),&#xA; 'gate': &amp;lt;projectq.ops._gates.XGate object at 0x7fc316778048&amp;gt;,&#xA; 'tags': []}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the CNOT gate, which is the same as ControlledGate(XGate)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'_control_qubits': [],&#xA; '_engine': &amp;lt;__main__.MainEngine object at 0x7fc323e4d198&amp;gt;,&#xA; '_qubits': ([&amp;lt;projectq.types._qubit.WeakQubitRef object at 0x7fc30b0b1080&amp;gt;],),&#xA; 'gate': &amp;lt;projectq.ops._gates.XGate object at 0x7fc316778048&amp;gt;,&#xA; 'tags': []}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Both have no control qubits and it seems like the control gates lost the control qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea on where the control qubit is stored?&lt;/p&gt;&#xA;" OwnerUserId="5791" LastEditorUserId="26" LastEditDate="2019-02-15T09:14:19.180" LastActivityDate="2019-02-26T08:24:06.650" Title="ProjectQ - In which part of the controlled gate object are the control bits scored" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5481" PostTypeId="1" CreationDate="2019-02-13T22:21:12.827" Score="2" ViewCount="588" Body="&lt;p&gt;We often seek to decompose multi-qubit unitaries into single-qubit rotations and controlled-rotations, minimising the latter or restricting to gates like CNOTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm interested in expressing a general 2-qubit unitary in the minimum &lt;em&gt;total&lt;/em&gt; number of gates, which can include controlled general unitaries. That is, express &lt;span class=&quot;math-container&quot;&gt;$U_{4}$&lt;/span&gt; with as few as possible gates in &lt;span class=&quot;math-container&quot;&gt;$\{U_2,\; |0⟩⟨0|\mathbb{1} + |1⟩⟨1|U_2\}$&lt;/span&gt;. While I could simply take the shortest decomposition to CNOTs and rotations (&lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.69.032315&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vatan et al&lt;/a&gt;) and bring some rotations into the CNOTs, I suspect another formulation could add more control-unitaries to achieve fewer total gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I go about performing this decomposition algorithmically for any 2-qubit unitary?&#xA;This decomposition could be useful for easily extending &lt;em&gt;distributed&lt;/em&gt; quantum simulators with the ability to effect general 2-qubit unitaries, which otherwise ad-hoc communication code.&lt;/p&gt;&#xA;" OwnerUserId="2591" LastEditorUserId="26" LastEditDate="2019-02-13T22:48:29.797" LastActivityDate="2019-02-13T23:07:07.200" Title="Decompose a general two-qubit gate into general controlled-qubit gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5482" PostTypeId="2" ParentId="5481" CreationDate="2019-02-13T22:33:32.470" Score="3" Body="&lt;p&gt;A simple place to start would be to put all the controls on qubit #2, so that you can propagate all of the single-qubit operations on qubit #1 across the two-qubit operations and merge them together. That would give you a circuit with at most 8 gates:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;--------C1-------C2-------C3---S5---&#xA;        |        |        |&#xA;---S1---*---S2---*---S3---*----S4---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is probably not minimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A general 4x4 unitary has 7+5+3+1=16 real parameters. Every single-qubit gate has three real parameters (Euler angles), and every two-qubit gate has four real parameters (Euler angles + phase kickback). So the above construction has 4*3 + 4*4 = 28 real parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is provable that you need at least three different controlled gates for some two-qubit operations. So the absolute best you could hope for is three of those and one single-qubit operation. But some of the degrees of freedom overlap, so I suspect you need more single-qubit gates.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-02-13T23:07:07.200" LastActivityDate="2019-02-13T23:07:07.200" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5484" PostTypeId="1" CreationDate="2019-02-14T03:46:12.787" Score="4" ViewCount="371" Body="&lt;p&gt;I ran the Grover's Algorithm for 3 Qubits on the IBM Q platform (ibmqx4) and the results of the simulation and the actual computer differ a lot. The screenshots of the circuit and the results are attached. &lt;img src=&quot;https://i.stack.imgur.com/WL4O4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tPY7r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="5796" LastEditorUserId="26" LastEditDate="2019-02-14T08:24:09.310" LastActivityDate="2019-02-14T18:30:51.320" Title="Why is there a difference between the simulation results and the actual quantum computer results?" Tags="&lt;simulation&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5485" PostTypeId="1" AcceptedAnswerId="5513" CreationDate="2019-02-14T10:01:57.727" Score="12" ViewCount="1223" Body="&lt;p&gt;I'm trying to figure out how to simulate the evolution of qubits under the interaction of Hamiltonians with terms written as a tensor product of Pauli matrices in a quantum computer. I have found the following trick in Nielsen and Chuang's book which is explained in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1875/obtaining-gate-e-i-delta-t-z-from-elementary-gates&quot;&gt;post&lt;/a&gt;  for a Hamiltonian of the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = Z_1 \otimes Z_2 \otimes ... \otimes Z_n $$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is not explained in detail how would the simulation for a Hamiltonian with terms including Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; would work. I understand that you can transform these Pauli's into Z's by considering that &lt;span class=&quot;math-container&quot;&gt;$HZH = X$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the Hadamard gate and also &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}HZHS =Y$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the phase &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; gate. How exactly should I use this to implement for example &#xA;&lt;span class=&quot;math-container&quot;&gt;$$H= X \otimes Y$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What if now the Hamiltonian contains the sum of terms with Pauli matrices?&#xA;For example&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = X_1 \otimes Y_2 + Z_2 \otimes Y_3$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1754" LastEditorUserId="26" LastEditDate="2019-02-14T12:29:18.313" LastActivityDate="2019-09-12T14:36:08.450" Title="Simulate hamiltonian evolution" Tags="&lt;hamiltonian-simulation&gt;&lt;nielsen-and-chuang&gt;&lt;pauli-gates&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5486" PostTypeId="2" ParentId="5484" CreationDate="2019-02-14T10:36:53.440" Score="3" Body="&lt;p&gt;This follows almost exclusively from noise and decoherence. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In simulations, the qubits are perfect and will not decohere. Furthermore, noise has no influence on the qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the actual hardware, the qubits are not perfect and hence are subject to decoherence and influences from the outside world. Therefore, measurement results might differ from what you expect. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-02-14T10:36:53.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5487" PostTypeId="2" ParentId="5484" CreationDate="2019-02-14T16:48:40.590" Score="7" Body="&lt;p&gt;There isn't much of a difference. If you read the labels, the values are roughly the same but for some reason are presented in a different order. Any differences for a given value are due to noise and decoherence.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-02-14T16:48:40.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5488" PostTypeId="2" ParentId="5484" CreationDate="2019-02-14T18:30:51.320" Score="4" Body="&lt;p&gt;The &lt;em&gt;Run&lt;/em&gt; command on the IBMQ interface is for the actual run on the quantum architecture. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The command &lt;em&gt;Simulate&lt;/em&gt; implements the quantum circuit on a normal classical architecture but randomizes it to make it look like the actual quantum runs. Note that this could be a perfect measurement if it were to report, but IBM uses the statistics based on its own quantum architecture and mimics those when we use the &lt;em&gt;simulate&lt;/em&gt; command. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point of the simulate operation is just for us to know what can we expect from the actual Run of the circuit. &lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-02-14T18:30:51.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5489" PostTypeId="1" CreationDate="2019-02-14T18:34:16.097" Score="4" ViewCount="142" Body="&lt;p&gt;I'm just wondering how one should go about using parametrised values and the Symbol object that gets resolved at runtime?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I would like to implement the gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$R_x(\theta) = e^{-i\theta/2}$&lt;/span&gt;, but would like to leave &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; as a Symbol to be resolved at the end of the simulation, what would be the best way to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any answers :)&lt;/p&gt;&#xA;" OwnerUserId="5804" LastEditorUserId="26" LastEditDate="2019-02-14T18:39:42.977" LastActivityDate="2019-02-14T23:02:03.687" Title="Using parametrised values and 'Symbols' in Cirq" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5490" PostTypeId="1" AcceptedAnswerId="5492" CreationDate="2019-02-14T20:34:27.120" Score="7" ViewCount="175" Body="&lt;p&gt;How can a &lt;em&gt;pure&lt;/em&gt; two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a |00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$&lt;/span&gt;, be written in the following form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;|\psi_{\alpha}\rangle = \sqrt{\alpha}|01\rangle + \sqrt{1-\alpha} |10\rangle.&#xA;\end{equation}&lt;/span&gt;&#xA;How can one prove this. And what would be &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$a,~b,~c,~d$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="55" LastEditDate="2019-02-23T17:46:58.407" LastActivityDate="2019-02-23T17:46:58.407" Title="A two qubit state in a special form" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5491" PostTypeId="2" ParentId="5489" CreationDate="2019-02-14T21:34:32.210" Score="2" Body="&lt;p&gt;In the current release of Cirq (0.4.0) there is a strong limitation on symbols: you can't scale them or add them (Why? We were worried about being pulled down the rabbit hole of implementing a whole symbolic algebra system.). Making matters worse, Cirq internally works in radians divided by pi to avoid some minor sources of floating point error. So when you write &lt;code&gt;cirq.Rx(cirq.Symbol(&quot;θ&quot;))&lt;/code&gt; it internally attempts to scale the argument, and you get an error about multiplication/division not being supported for symbols.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is &lt;a href=&quot;https://github.com/quantumlib/Cirq/pull/990&quot; rel=&quot;nofollow noreferrer&quot;&gt;an active pull request&lt;/a&gt; to fix this by delegating all symbolic work to sympy. Once that's merged, the next release will allow you to write &lt;code&gt;cirq.Rx(sympy.Symbol(&quot;θ&quot;))&lt;/code&gt; whereas currently you can only use symbols in exponents e.g. &lt;code&gt;cirq.X**cirq.Symbol(&quot;t&quot;)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, currently in 0.4.0, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import matplotlib.pyplot as plt&#xA;&#xA;q = cirq.LineQubit(0)&#xA;circuit = cirq.Circuit.from_ops(&#xA;    cirq.X(q)**cirq.Symbol('angle_over_pi'),&#xA;    cirq.measure(q),&#xA;)&#xA;results = cirq.Simulator().run_sweep(&#xA;    circuit,&#xA;    params=cirq.Linspace(key='angle_over_pi', start=0, stop=2, length=20),&#xA;    repetitions=1000)&#xA;&#xA;plt.plot([r.histogram(key=str(q))[1] for r in results])&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uBitP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uBitP.png&quot; alt=&quot;rabi oscillation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you'll need to wait until 0.5.0 to be able to do this extremely similar thing using &lt;code&gt;Rx&lt;/code&gt; instead of &lt;code&gt;X**&lt;/code&gt; and &lt;code&gt;sympy.Symbol&lt;/code&gt; instead of &lt;code&gt;cirq.Symbol&lt;/code&gt; (which will be gone):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;q = cirq.LineQubit(0)&#xA;circuit = cirq.Circuit.from_ops(&#xA;    cirq.Rx(sympy.Symbol('rads')).on(q),&#xA;    cirq.measure(q),&#xA;)&#xA;results = cirq.Simulator().run_sweep(&#xA;    circuit,&#xA;    params=cirq.Linspace(key='rads', start=0, stop=2*np.pi, length=20),&#xA;    repetitions=1000)&#xA;&#xA;plt.plot([r.histogram(key=q)[1] for r in results])&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-02-14T23:02:03.687" LastActivityDate="2019-02-14T23:02:03.687" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5492" PostTypeId="2" ParentId="5490" CreationDate="2019-02-14T22:50:17.813" Score="5" Body="&lt;p&gt;The trick is in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Schmidt_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schmidt decomposition&lt;/a&gt; - Following the &lt;a href=&quot;https://en.wikipedia.org/wiki/Schmidt_decomposition#Proof&quot; rel=&quot;nofollow noreferrer&quot;&gt;theorem proof&lt;/a&gt;, we have two qubits, so two Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;, both with dimension 2, with the bases defined as &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|e_0\right&amp;gt; = \left|0\right&amp;gt;_1,\, \left|e_1\right&amp;gt;=\left|1\right&amp;gt;_1 \right\rbrace$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|f_0\right&amp;gt; = \left|0\right&amp;gt;_2,\, \left|f_1\right&amp;gt;=\left|1\right&amp;gt;_2 \right\rbrace$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This defines a tensor &lt;span class=&quot;math-container&quot;&gt;$w = \sum_{i, j=0}^1\beta_{i, j}\left|i\right&amp;gt;_1\otimes\left|j\right&amp;gt;_2$&lt;/span&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$\beta_{00} = a, \,\beta_{01} = b, \,\beta_{10} = c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta_{11} = d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then write this as an &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$$M_w = \begin{pmatrix}\beta_{00} &amp;amp;&amp;amp; \beta_{01} \\ \beta_{10} &amp;amp;&amp;amp; \beta_{11}\end{pmatrix} = \begin{pmatrix}a &amp;amp;&amp;amp; b \\ c &amp;amp;&amp;amp; d\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we've got a matrix, we want to diagonalise it, so we perform a Singular Value Decomposition (SVD). That is, we want to write &lt;span class=&quot;math-container&quot;&gt;$M_w = UDV^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is a diagonal matrix (with the elements known as the 'singular values') and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and unitary &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrices. Or rather, to save having to do a chunk of maths, we know that the columns (also, rows) of both &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; each &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix#Equivalent_conditions&quot; rel=&quot;nofollow noreferrer&quot;&gt;form an orthonormal basis&lt;/a&gt; - I'll call these &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|u_0\right&amp;gt;,\, \left|u_1\right&amp;gt;\right\rbrace$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|v_0\right&amp;gt;,\, \left|v_1\right&amp;gt;\right\rbrace$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Helpfully, the expression for the singular values of a &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; matrix &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition#Analytic_result_of_2_%C3%97_2_SVD&quot; rel=&quot;nofollow noreferrer&quot;&gt;is analytic&lt;/a&gt;: &lt;span class=&quot;math-container&quot;&gt;$$\sigma_{\pm} = \sqrt{\left|z_0\right|^2 + \left|z_1\right|^2 + \left|z_2\right|^2 + \left|z_3\right|^2 \pm \sqrt{\left(\left|z_0\right|^2 + \left|z_1\right|^2 + \left|z_2\right|^2 + \left|z_3\right|^2\right)^2 - \left|z_0^2 - z_1^2 - z_2^2 - z_3^2\right|^2}},$$&lt;/span&gt; where &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}z_0 &amp;amp;= \frac{1}{2}\left(a+d\right) \\&#xA;z_1 &amp;amp;= \frac{1}{2}\left(b+c\right) \\&#xA;z_2 &amp;amp;= \frac{i}{2}\left(b-c\right) \\&#xA;z_3 &amp;amp;= \frac{1}{2}\left(a-d\right).&#xA;\end{align*}&lt;/span&gt; This in turn gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_\pm= \sqrt{\frac{1}{2}\pm\sqrt{\frac{1}{4}-\left|ad - bc\right|^2}},$$&lt;/span&gt; as a result of the normalisation condition &lt;span class=&quot;math-container&quot;&gt;$\left|a\right|^2 + \left|b\right|^2 + \left|c\right|^2 + \left|d\right|^2 = 1$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$\sigma_+^2 + \sigma_-^2 = 1$&lt;/span&gt;, I'll redefine &lt;span class=&quot;math-container&quot;&gt;$\sigma_+ = \sqrt{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_- = \sqrt{\left(1-\alpha\right)}$&lt;/span&gt;, for reasons that should become clear below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can now write &lt;span class=&quot;math-container&quot;&gt;$M_w = \sqrt\alpha\left|u_0\rangle\langle v_0\right| + \sqrt{1-\alpha}\left|u_1\rangle\langle v_1\right|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;'Rewriting' this as a tensor (as at the beginning&lt;sup&gt;1&lt;/sup&gt;) gives a state &lt;span class=&quot;math-container&quot;&gt;$$\left|\psi_\alpha\right&amp;gt; = \sqrt\alpha\left|u_0\right\rangle\otimes\left|v_0\right\rangle + \sqrt{1-\alpha}\left|u_1\right\rangle\otimes\left|v_1\right\rangle,$$&lt;/span&gt; which is equivalent to what you have by defining &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|u_0\right&amp;gt; = \left|0\right&amp;gt;_u,\, \left|u_1\right&amp;gt;=\left|1\right&amp;gt;_u \right\rbrace$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace\left|v_0\right&amp;gt; = \left|1\right&amp;gt;_v,\, \left|v_1\right&amp;gt;=\left|0\right&amp;gt;_v \right\rbrace$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$$\alpha= \frac{1}{2}+\sqrt{\frac{1}{4}-\left|ad - bc\right|^2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Calculating &lt;span class=&quot;math-container&quot;&gt;$M_w$&lt;/span&gt;:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|u_0\right&amp;gt;$&lt;/span&gt; is the left column of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|u_1\right&amp;gt;$&lt;/span&gt;, the right column. Similarly, for &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|v_0\right&amp;gt;$&lt;/span&gt; is the left column and &lt;span class=&quot;math-container&quot;&gt;$\left|v_1\right&amp;gt;$&lt;/span&gt;, the right. This means that I can write &lt;span class=&quot;math-container&quot;&gt;$$U = \begin{pmatrix}\left|u_0\right&amp;gt; &amp;amp;&amp;amp; \left|u_1\right&amp;gt;\end{pmatrix}$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$V^{\dagger} = \begin{pmatrix}\left&amp;lt;v_0\right| \\ \left&amp;lt;v_1\right|\end{pmatrix}$$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$$M_w = UDV^\dagger = \begin{pmatrix}\left|u_0\right&amp;gt; &amp;amp;&amp;amp; \left|u_1\right&amp;gt;\end{pmatrix}\begin{pmatrix}\sqrt\alpha &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp; \sqrt{1-\alpha}\end{pmatrix}\begin{pmatrix}\left&amp;lt;v_0\right| \\ \left&amp;lt;v_1\right|\end{pmatrix},$$&lt;/span&gt; which can be simplified as &lt;span class=&quot;math-container&quot;&gt;$M_w = \sqrt\alpha\left|u_0\rangle\langle v_0\right| + \sqrt{1-\alpha}\left|u_1\rangle\langle v_1\right|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 Even as a non-mathematician, I feel guilty just doing this&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2019-02-16T23:20:59.130" LastActivityDate="2019-02-16T23:20:59.130" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5493" PostTypeId="2" ParentId="5490" CreationDate="2019-02-15T09:05:13.153" Score="6" Body="&lt;p&gt;Mithrandir's answer perfectly covers the functional details, but to state a clear response to the question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is &lt;em&gt;not&lt;/em&gt; true that any two-qubit state &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle+b|01\rangle+c|10\rangle+d|11\rangle$&lt;/span&gt; can be written in the form &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\alpha}|01\rangle+\sqrt{1-\alpha}|10\rangle$&lt;/span&gt;. Obviously, you can only get equality here if &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what you can do is a change of basis. An equivalent way of saying this is that there exists unitaries &lt;span class=&quot;math-container&quot;&gt;$U_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_B$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(U_A\otimes U_B)(a|00\rangle+b|01\rangle+c|10\rangle+d|11\rangle)=\sqrt{\alpha}|01\rangle+\sqrt{1-\alpha}|10\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that clarification, you could now follow Mithrandir's proof. I think of it in a different way (where you don't need to know what the singular value decomposition is, but you do need to know about the reduced density matrix). Consider the reduced density matrix of each way of writing the state, where we restrict to just the first qubit. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1=U_A\left((a|0\rangle+c|1\rangle)(a^\star\langle 0|+c^\star\langle 1|)+(b|0\rangle+d|1\rangle)(b^\star\langle 0|+d^\star\langle 1|)\right)U_A^\dagger\\=\alpha|0\rangle\langle 0|+(1-\alpha)|1\rangle\langle 1|.&#xA;$$&lt;/span&gt;&#xA;Clearly, the right-hand side is diagonal, so &lt;span class=&quot;math-container&quot;&gt;$U_A$&lt;/span&gt; must be the unitary that diagonalises the left-hand side. In other words, &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1-\alpha$&lt;/span&gt; are the eigenvalues of the matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc}&#xA;|a|^2+|b|^2 &amp;amp; ac^\star+bd^\star \\&#xA;a^\star c+b^\star d &amp;amp; |c|^2+|d|^2&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;The &lt;span class=&quot;math-container&quot;&gt;$U_A$&lt;/span&gt; always exists because that matrix is Hermitian. Similarly, &lt;span class=&quot;math-container&quot;&gt;$U_B$&lt;/span&gt; is the unitary rotation that diagonalises the reduced density matrix on the second qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-15T09:05:13.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5494" PostTypeId="1" AcceptedAnswerId="5496" CreationDate="2019-02-15T13:22:03.493" Score="4" ViewCount="625" Body="&lt;p&gt;I'm learning how to use the cirq library. Every time I set up a circuit the starting state of the qubits is &lt;span class=&quot;math-container&quot;&gt;$|0000..0\rangle$&lt;/span&gt;. Is there any way to make the starting state different? I'm thinking of somehow giving as input some &lt;code&gt;np.array (vector)&lt;/code&gt; to the circuit so that the system initializes with such state. I know I could build a circuit to prepare the state I want but I would like a shorter way to do this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="1754" LastEditorUserId="26" LastEditDate="2019-02-15T14:22:19.123" LastActivityDate="2019-02-15T18:13:03.673" Title="How to set a starting state in cirq?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5496" PostTypeId="2" ParentId="5494" CreationDate="2019-02-15T17:42:14.623" Score="7" Body="&lt;p&gt;Cirq distinguishes between &quot;running&quot; a circuit, which is generally supposed to act like hardware would (e.g. only getting samples), and &quot;simulating&quot; a circuit, which has more freedom.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most &quot;simulate&quot; methods, like &lt;code&gt;cirq.Simulator().simulate(...)&lt;/code&gt; have a parameter &lt;code&gt;initial_state&lt;/code&gt; which can either be a computational basis state (specified as an integer e.g. &lt;code&gt;initial_state=0b000111000&lt;/code&gt;) or a state vector (specified as a numpy array e.g. &lt;code&gt;initial_state=np.array([0.5, -0.5, 0.5j, 0.5])&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &quot;run&quot; methods, like &lt;code&gt;cirq.Simulator().run(...)&lt;/code&gt;, there is no way to specify the initial state because that's how it works in hardware. If you want a specific state, you have to make it with gates.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-02-15T18:13:03.673" LastActivityDate="2019-02-15T18:13:03.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5497" PostTypeId="1" AcceptedAnswerId="5499" CreationDate="2019-02-15T21:59:24.633" Score="5" ViewCount="274" Body="&lt;p&gt;When an RF pulse is interacting on resonance with a transmon qubit, it leads to rotation of the qubit around an axis in the XY plane (in a reference frame rotating in the transition frequency of the qubit). What is the exact relation between the pulse amplitude and phase to the rotation of the qubit? Can you give a proof?  &lt;/p&gt;&#xA;" OwnerUserId="5811" LastEditorUserId="26" LastEditDate="2019-02-16T08:15:23.287" LastActivityDate="2019-02-17T03:56:12.453" Title="Interaction of an RF pulse with transmon qubit" Tags="&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5498" PostTypeId="2" ParentId="2082" CreationDate="2019-02-16T00:58:30.717" Score="7" Body="&lt;p&gt;I will answer this question in two ways: one, I will tell you how I learned, and two I will tell you how I would have liked to have learned with the benefit of hindsight. Different people will value one more than the other, but both are more valuable than a giant list of resources with zero guidance where to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How I learned&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out like you, in possession of an undergraduate education in computer science. I began reading &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0521876583&quot; rel=&quot;noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computer Science: An Introduction&lt;/em&gt;&lt;/a&gt; by N. David Mermin. This is a very good textbook, but I absolutely could not skim it. I had to ensure I understood every single line before moving onto the next. I had the impression I wasn't learning very quickly, when in fact (due to the textbook's density) I was taking in a huge amount of information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a few weeks with the Mermin textbook, I bought &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0521879965&quot; rel=&quot;noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computing for Computer Scientists&lt;/em&gt;&lt;/a&gt; by Yanofsky &amp;amp; Mannucci. This is a much softer introduction than Mermin, almost too soft: I skipped the first few chapters on linear algebra and complex numbers. However, in combination with the Mermin textbook, I acquired a good understanding of quantum computing basics. It was at this point I reached my own personal threshold for feeling I &quot;understood&quot; quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;People often recommend &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt;&lt;/a&gt; by Nielsen &amp;amp; Chuang (also called &quot;Mike &amp;amp; Ike&quot;) for beginners. I believe this is not good advice. Had I tried to learn from that textbook, I would have failed. However, it is an excellent textbook &lt;em&gt;after you already understand the basics&lt;/em&gt;. Anecdotally, I knew two people who tried to learn quantum computing at the same time as me: one used Mike &amp;amp; Ike, and the other used a book called &lt;em&gt;Quantum Computing: A Gentle Introduction&lt;/em&gt;. Neither of those people understand quantum computing today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How I wish I had learned&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My experience learning quantum computing required a huge amount of mental effort, and in the end what I learned wasn't actually complicated! So, I created a lecture called &lt;a href=&quot;https://youtu.be/F_Riqjdh2oM&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Quantum Computing for Computer Scientists&lt;/em&gt;&lt;/a&gt; (&lt;a href=&quot;https://speakerdeck.com/ahelwer/quantum-computing-for-computer-scientists&quot; rel=&quot;noreferrer&quot;&gt;slides&lt;/a&gt;) which is the lecture I wish I'd had access to before trying to read any textbooks. The lecture is popular and well-received, and I think it covers all the stuff that's really conceptually tricky; once you're over those conceptual hurdles, you can apply your regular computer science skills to learn everything else about quantum computing you need (how specific algorithms work, etc.) Thus my &quot;hindsight&quot; study guide is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Watch the lecture I created.&lt;/li&gt;&#xA;&lt;li&gt;Watch Professor Umesh Vazirani's lectures on quantum computing; they flesh out my lecture and he is a tremendously effective explainer of concepts (these are scattered around YouTube but you can find a full playlist &lt;a href=&quot;https://www.youtube.com/playlist?list=PLDAjb_zu5aoFazE31_8yT0OfzsTcmvAVg&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Concurrently, work through the first few chapters of either the Mermin or Yanofsky textbooks&lt;/li&gt;&#xA;&lt;li&gt;After you feel you understand the quantum computing basics, pick topics which interest you from the Nielsen &amp;amp; Chuang textbook&lt;/li&gt;&#xA;&lt;li&gt;Stick around quantumcomputing.stackexchange, reading questions &amp;amp; answers, asking your own, and maybe eventually answering your own!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-02-16T00:58:30.717" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5499" PostTypeId="2" ParentId="5497" CreationDate="2019-02-16T09:17:36.817" Score="7" Body="&lt;h2&gt;Kirchhoff to Lagrangian&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let's approximate the transmon as a parallel LC resonant circuit.&#xA;Suppose we connect a voltage source through a coupling capacitor &lt;span class=&quot;math-container&quot;&gt;$C_d$&lt;/span&gt; (d for &quot;drive&quot;) to a transmon qubit.&#xA;If the voltage of the source is &lt;span class=&quot;math-container&quot;&gt;$V_d(t)$&lt;/span&gt;, then Kirchhoff's equations for the circuit are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{C/C_d} \dot{V}_d(t) = \ddot{\Phi}(t) + \frac{\omega_0^2}{1 + C_d / C} \Phi(t)$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is the capacitance of the transmon, &lt;span class=&quot;math-container&quot;&gt;$\Phi(t)$&lt;/span&gt; is the flux of the transmon, and &lt;span class=&quot;math-container&quot;&gt;$\omega_0 \equiv 1 / \sqrt{LC}$&lt;/span&gt;.&#xA;This differential equation is reproduced by the following Lagrangian&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathcal{L}&#xA;&amp;amp;= \frac{1}{2}C \dot{\Phi}^2 - \frac{1}{2L}\Phi^2 + \frac{1}{2} C_d (\dot{\Phi} - V_d(t))^2 \\&#xA;&amp;amp;= \underbrace{\frac{1}{2}(C + C_d) \dot{\Phi}^2 - \frac{1}{2L}\Phi^2}_{\mathcal{L}_0} + \underbrace{\frac{1}{2} C_d V_d(t)^2 - C_d V_d(t) \dot{\Phi}}_{\mathcal{L}_d}&#xA;\end{align}&lt;/span&gt;&#xA;as you can check yourself.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Lagrangian to Hamiltonian&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The first part of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; corresponds to the free oscillation of the qubit and we call it &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}_0$&lt;/span&gt;.&#xA;Analyzing &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}_0$&lt;/span&gt;, we find that the canonical position and momentum are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{position} = \Phi \qquad \text{and} \qquad \text{momentum} \equiv \frac{\partial \mathcal{L}_0}{\partial \dot{\Phi}} = (C + C_d)\dot{\Phi} \equiv Q\, .$$&lt;/span&gt;&#xA;Denoting the canonical momentum &lt;span class=&quot;math-container&quot;&gt;$\partial \mathcal{L}_0 / \partial \dot{\Phi}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is justified by the following reasoning.&#xA;When &lt;span class=&quot;math-container&quot;&gt;$C_d \rightarrow 0$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$\partial \mathcal{L}_0 / \partial \dot{\Phi} = C \dot{\Phi}$&lt;/span&gt;.&#xA;But &lt;span class=&quot;math-container&quot;&gt;$\dot{\Phi}$&lt;/span&gt; is just the voltage on the qubit, so using the definition of capacitance &lt;span class=&quot;math-container&quot;&gt;$C = Q / V$&lt;/span&gt; we see that &lt;span class=&quot;math-container&quot;&gt;$\partial \mathcal{L}_0 / \partial \dot{\Phi} = Q$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is the charge on the qubit.&#xA;It's then clear that adding the drive capacitor just shifts the capacitance associated with the canonical momentum, which makes sense because the drive capacitor simply adds to the qubit's own capacitance since they're connected in parallel.&#xA;Of course, in practical systems &lt;span class=&quot;math-container&quot;&gt;$C_d \ll C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's look at &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}_d$&lt;/span&gt;.&#xA;The first term in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}_d$&lt;/span&gt; doesn't involve the dynamical variables at all, so we can ignore it.&#xA;If we convert the second term to a Hamiltonian through the usual procedure, we find that the drive Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_d = C_d \dot{\Phi}V_d = \frac{1}{1 + C/C_d} Q V_d \approx \frac{C_d}{C} Q V_d \, .$$&lt;/span&gt;&#xA;Using the theory of the quantum harmonic oscillator, the &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; operator can be written in terms of raising and lowering operators as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Q = -i Q_\text{zpf} (a - a^\dagger) $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Q_\text{zpf} = \sqrt{\hbar / 2 Z_{LC}}$&lt;/span&gt; is the zero point fluctuation of the circuit's charge, and &lt;span class=&quot;math-container&quot;&gt;$Z_{LC} \equiv \sqrt{L/C}$&lt;/span&gt; is the characteristic impedance of the oscillator.&#xA;If we restrict to the lowest two levels, then &lt;span class=&quot;math-container&quot;&gt;$-i(a - a^\dagger) = \sigma_y$&lt;/span&gt; so we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_d(t) = \frac{C_d}{C} Q_\text{zpf} V_d(t) \, \sigma_y \, .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Interaction picture (a.k.a. &lt;a href=&quot;https://physics.stackexchange.com/questions/222104/&quot;&gt;rotating frame&lt;/a&gt;)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Of course, there's still the free oscillation part of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;, which in the two-level approximation is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_0 = -\hbar \frac{\omega_0}{2} \sigma_z \, .$$&lt;/span&gt;&#xA;Because &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; don't commute, in order to make progress we have to go into the &lt;a href=&quot;https://en.wikipedia.org/wiki/Interaction_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;interaction picture&lt;/a&gt;.&#xA;When you do that, if we assume that the drive voltage has the form &lt;span class=&quot;math-container&quot;&gt;$V_d(t) = V_0 \cos(\omega_0 t + \phi)$&lt;/span&gt;, then we get [2]&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_d^\text{interaction} = \frac{1}{2} \frac{C_d}{C} Q_\text{zpf} V_0 \left( \cos(\phi) \sigma_x - \sin(\phi) \sigma_y \right) \, .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Final result&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Without loss of generality, we can pick &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt; and compute the unitary time evolution operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(t)&#xA;= \exp \left( - \frac{i}{\hbar} \int_0^t H_d^\text{interaction}(t') dt' \right)&#xA;= - \frac{i}{\hbar} \frac{1}{2} \frac{C_d}{C} Q_\text{zpf} V_0 \sigma_x t \, .$$&lt;/span&gt;&#xA;When you have an exponent of a Pauli matrix like &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \theta \sigma_x)$&lt;/span&gt;, the angle of rotation on the Bloch sphere is &lt;span class=&quot;math-container&quot;&gt;$2 \theta$&lt;/span&gt; [1].&#xA;Therefore, in our case the Bloch sphere rotation angle (in radians) is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{rotation angle} = \frac{C_d}{C} \frac{Q_\text{zpf}}{\hbar} V_0 t \, .$$&lt;/span&gt;&#xA;Now that we found the Bloch sphere rotation angle when &lt;span class=&quot;math-container&quot;&gt;$\phi=0$&lt;/span&gt;, it's clear from symmetry and the form of &lt;span class=&quot;math-container&quot;&gt;$H_d^\text{interaction}$&lt;/span&gt; that changing &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; keeps the same rotation angle on the Bloch sphere but changes the azimuth. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A form that I particularly like can be found by for the case of a pi-pulse where the Bloch sphere rotation angle is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&#xA;In that case, we can rewrite the result we found above as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\text{condition for pi-pulse)} \quad&#xA;1 = \frac{1}{\pi \sqrt{2}} \left( \frac{C_d}{C} \right) \sqrt{\frac{R_K / 8 \pi}{Z_{LC}}} \frac{V_0 t}{\Phi_0 / 2\pi}$$&lt;/span&gt;&#xA;where here &lt;span class=&quot;math-container&quot;&gt;$R_K \equiv h / e^2$&lt;/span&gt; is the resistance quantum and &lt;span class=&quot;math-container&quot;&gt;$\Phi_0 \equiv h / 2e$&lt;/span&gt; is the flux quantum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] You can check this by Taylor expanding the exponential function and grouping even and odd terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Here we are using the so-called rotating wave approximation.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="32" LastEditDate="2019-02-17T03:56:12.453" LastActivityDate="2019-02-17T03:56:12.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5500" PostTypeId="1" AcceptedAnswerId="5501" CreationDate="2019-02-16T10:29:31.630" Score="2" ViewCount="604" Body="&lt;p&gt;What does quantum teleportation mean? Is it something that will allow us to send information faster than the light? Can we teleport a human with it?&lt;/p&gt;&#xA;" OwnerUserId="5813" LastEditorUserId="26" LastEditDate="2019-02-16T11:22:18.200" LastActivityDate="2019-02-16T18:51:43.607" Title="Can we teleport a human or send information faster than light using quantum teleportation?" Tags="&lt;quantum-information&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5501" PostTypeId="2" ParentId="5500" CreationDate="2019-02-16T10:54:33.163" Score="2" Body="&lt;p&gt;In conclusion, NO and NO, respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum teleportation does not mean &lt;em&gt;instantaneous&lt;/em&gt; disappearance and reappearance of information at another spatial point. Quantum teleportation in plain English means &lt;em&gt;moving&lt;/em&gt; a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum state&lt;/a&gt; from one place to another using quantum operations and quantum measurement, which are connected by classical as well as quantum channels or both. This does not exceed the speed of light in any sense and does not violate the theory of special relativity. There is no faster than light (FTL) communication in the basic &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Teleportation protocol&lt;/a&gt; because it is restricted by the speed of light as it uses an ordinary &lt;em&gt;classical channel&lt;/em&gt; as a necessary requirement to attain its perfection in probability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Teleporting a human is a very subjective question today. Because it is not a quantum object to be described by a quantum state. A human is a macroscopic object which is completely classical. To this date, the biggest size of objects that are teleported (to about &lt;span class=&quot;math-container&quot;&gt;$2\ \mathrm{km}$&lt;/span&gt; range) is the size of &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Buckminsterfullerene&quot; rel=&quot;nofollow noreferrer&quot;&gt;buckyballs&lt;/a&gt;&lt;/em&gt; or similar objects (this means teleporting their quantum states - in the sense of information). Teleporting anything classical would be quite metaphysical at this point, it would also bring the questions of &lt;em&gt;consciousness&lt;/em&gt; and other hypotheses into the framework which are not yet modeled or accepted by the science community. One way may be to scramble - teleport - re-assemble such objects, but do they retain their macroscopic properties then? It is a question which is more philosophical to this point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check out some of these links to catch up with the latest breakthrough in quantum teleportation regarding range, loop-holes, security, etc: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://newatlas.com/quantum-entanglement-satellite-distance-record/50071/&quot; rel=&quot;nofollow noreferrer&quot;&gt;New Atlas: Chinese satellite shatters quantum teleportation distance record&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.technologyreview.com/s/608252/first-object-teleported-from-earth-to-orbit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT Technology Review: First Object Teleported from Earth to Orbit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Loopholes_in_Bell_test_experiments&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Loopholes in Bell test experiments&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2019-02-16T18:51:43.607" LastActivityDate="2019-02-16T18:51:43.607" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5502" PostTypeId="2" ParentId="2282" CreationDate="2019-02-16T12:16:16.707" Score="2" Body="&lt;p&gt;In 1996, David DiVincenzo listed five key criteria to build a quantum computer:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A quantum computer must be scalable,&lt;/li&gt;&#xA;&lt;li&gt;It must be possible to initialise the qubits,&lt;/li&gt;&#xA;&lt;li&gt;Good qubits are needed, the quantum state cannot be lost,&lt;/li&gt;&#xA;&lt;li&gt;We need to have a universal set of quantum gates,&lt;/li&gt;&#xA;&lt;li&gt;We need to be able to measure all qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Two additional criteria:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;6&quot;&gt;&#xA;&lt;li&gt;The ability to interconvert stationary and flying qubits, &lt;/li&gt;&#xA;&lt;li&gt;The ability to transmit flying qubits between distant locations.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://ocw.tudelft.nl/wp-content/uploads/QIP3_divincenzo_criteria.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Long Explanation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5813" LastEditorUserId="5813" LastEditDate="2019-02-16T13:05:00.593" LastActivityDate="2019-02-16T13:05:00.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5503" PostTypeId="1" AcceptedAnswerId="5505" CreationDate="2019-02-16T13:06:27.943" Score="7" ViewCount="314" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt;. The standard way to make a query is with an oracle &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; that given an input &lt;span class=&quot;math-container&quot;&gt;$|i,b \rangle $&lt;/span&gt; returns &lt;span class=&quot;math-container&quot;&gt;$|i,b \oplus x_i \rangle$&lt;/span&gt;. Via the phase kick-back trick, this can be used to make another type of query &lt;span class=&quot;math-container&quot;&gt;$O_{x}^{''}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$O_{x}^{''}|i\rangle=(-1)^{x_i}|i\rangle$&lt;/span&gt;. This is easily seen by passing to the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle, |- \rangle$&lt;/span&gt; basis. How can it be seen that the converse is true i.e. that with a query of the latter type (and perhaps some ancillary qubit or transformation) one can implement a query of the former type? &lt;/p&gt;&#xA;" OwnerUserId="5816" LastEditorUserId="55" LastEditDate="2019-12-03T10:51:54.023" LastActivityDate="2020-06-16T13:28:49.747" Title="Show that these two expressions for the oracle transformation are equivalent" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;oracles&gt;&lt;phase-kickback&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5504" PostTypeId="1" AcceptedAnswerId="5536" CreationDate="2019-02-16T13:39:32.073" Score="4" ViewCount="217" Body="&lt;p&gt;I understand in Shor's algorithm we use quantum computers to find the period of a function which can then be used to find N, and we increase the probability of observing the state with the correct period with a Fourier transform. However, why can't we have a superposition of every possible factor and use a Fourier transform to increase the probability of observing the correct factor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully someone can help answer (I'm trying to understand this for my EPQ).&lt;/p&gt;&#xA;" OwnerUserId="4773" LastEditorUserId="26" LastEditDate="2019-02-16T13:40:34.053" LastActivityDate="2019-02-21T15:40:22.677" Title="Why do we use the quantum superposition for a period instead of factors in Shor's algorithm?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5505" PostTypeId="2" ParentId="5503" CreationDate="2019-02-16T18:22:34.983" Score="1" Body="&lt;p&gt;If we express the action of &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; on the basis &lt;span class=&quot;math-container&quot;&gt;$\mid i, \pm \rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\mid i , b \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;O_x \mid i , + \rangle = \mid i , + \rangle\\&#xA;O_x \mid i , - \rangle = (-1)^{x_i} \mid i , - \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because we say auxiliary qubits must be started and ended with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;O_x'' &amp;amp;=&amp;amp; (1 \otimes S_x H) O_x (1 \otimes H S_x)&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$1 \otimes H S_x$&lt;/span&gt; conjugation takes care of turning the auxiliary from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; and back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be careful about what &lt;span class=&quot;math-container&quot;&gt;$O_x''$&lt;/span&gt; does. It does the desired &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x_i}$&lt;/span&gt; only when the ancilla is in &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; as it is supposed to be. If the auxiliary is in &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; instead, &lt;span class=&quot;math-container&quot;&gt;$O_x''$&lt;/span&gt; acts like the identity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;O_x'' \mid i , 0 \rangle &amp;amp;=&amp;amp; (-1)^{x_i} \mid i, 0 \rangle\\&#xA;O_x'' \mid i , 1 \rangle &amp;amp;=&amp;amp; \mid i, 1 \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solve for &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;O_x &amp;amp;=&amp;amp; (1 \otimes H S_x) O_x'' (1 \otimes S_x H)&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See what it does on &lt;span class=&quot;math-container&quot;&gt;$\mid i , + \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mid i, - \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;(1 \otimes H S_x) O_x'' (1 \otimes S_x H) \mid i, + \rangle &amp;amp;=&amp;amp; (1 \otimes H S_x) O_x'' \mid i, 1 \rangle\\&#xA;&amp;amp;=&amp;amp; (1 \otimes H S_x) \mid i, 1 \rangle\\&#xA;&amp;amp;=&amp;amp; \mid i, + \rangle\\&#xA;(1 \otimes H S_x) O_x'' (1 \otimes S_x H) \mid i, - \rangle &amp;amp;=&amp;amp; (1 \otimes H S_x) O_x'' \mid i, 0 \rangle\\&#xA;&amp;amp;=&amp;amp; (1 \otimes H S_x) (-1)^{x_i} \mid i, 0 \rangle\\&#xA;&amp;amp;=&amp;amp; (-1)^{x_i} \mid i , - \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This matches with what we wanted for &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; in the first two lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;O_x \mid i, + \rangle &amp;amp;=&amp;amp; O_x \frac{1}{\sqrt{2}} (\mid i, 0 \rangle + \mid i, 1 \rangle)\\&#xA;&amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} (O_x \mid i, 0 \rangle + O_x \mid i, 1 \rangle)\\&#xA;&amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} (\mid i, 0+x_i \rangle + O_x \mid i, 1+x_i \rangle)\\&#xA;&amp;amp;=&amp;amp; \mid i, + \rangle&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the last equality, the two summands either swap or they don't depending on &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;. Similarly with -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;O_x \mid i, - \rangle &amp;amp;=&amp;amp; O_x \frac{1}{\sqrt{2}} (\mid i, 0 \rangle - \mid i, 1 \rangle)\\&#xA;&amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} (O_x \mid i, 0 \rangle - O_x \mid i, 1 \rangle)\\&#xA;&amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} (\mid i, 0+x_i \rangle - O_x \mid i, 1+x_i \rangle)\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so if &lt;span class=&quot;math-container&quot;&gt;$x_i=0$&lt;/span&gt; there is no swap of terms and the result is &lt;span class=&quot;math-container&quot;&gt;$\mid i, - \rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$x_i=1$&lt;/span&gt;, there is a swap of terms and the result is &lt;span class=&quot;math-container&quot;&gt;$- \mid i, - \rangle$&lt;/span&gt;. This can be put together by saying &lt;span class=&quot;math-container&quot;&gt;$O_x \mid i, - \rangle = (-1)^{x_i} \mid i , - \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2020-06-16T13:28:49.747" LastActivityDate="2020-06-16T13:28:49.747" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5506" PostTypeId="2" ParentId="5503" CreationDate="2019-02-16T18:32:12.563" Score="2" Body="&lt;p&gt;You are given a quantum circuit for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; compiled into the H/CNOT/T gateset. Derive a controlled version of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; by adding a control qubit &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, replacing every H with a controlled H, every CNOT with a CCNOT, and every T with a controlled T. In all cases the new control goes on the &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recompile the modified gates down into the H/CNOT/T gate set. Prepend and append the circuit with a Hadamard on &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. You now have a circuit that toggles &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; when a -1 eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is input and leaves &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; alone when a +1 eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; implements &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(x)}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Derive controlled &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; implementing &lt;span class=&quot;math-container&quot;&gt;$(-1)^{q \cdot f(x)}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Switch control basis from Z to X, achieving &lt;span class=&quot;math-container&quot;&gt;$q \mathrel{\oplus} = f(x)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-16T18:32:12.563" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5507" PostTypeId="1" AcceptedAnswerId="5510" CreationDate="2019-02-17T11:59:14.183" Score="4" ViewCount="68" Body="&lt;p&gt;&lt;a href=&quot;https://algassert.com/2016/05/22/quirk.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Craig Gidney's blog&lt;/a&gt; has some .gifs which directly link to the corresponding simulation on &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Grover Search&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22X%22,%22X%22,%22X%22,%22X%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Chance4%22],[%22Sample4%22],[%22Z%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%80%A2%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Chance4%22],[%22Sample4%22],[%22Z%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%80%A2%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Chance4%22],[%22Sample4%22],[%22Z%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%80%A2%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Z%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22],[%22H%22,%22H%22,%22H%22,%22H%22],[%22Chance4%22],[%22Sample4%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GFcW9.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Delayed Eraser&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22],[%22%E2%80%A2%22,%22X%22],[%22%E2%80%A6%22],[%22e%5EiXt%22],[%22Measure%22],[%22Chance%22],[%22%E2%80%A6%22],[%22Chance%22,%22%E2%80%A2%22],[%22Chance%22,%22%E2%97%A6%22],[%22%E2%80%A6%22],[1,%22H%22],[%22Chance%22,%22%E2%80%A2%22],[%22Chance%22,%22%E2%97%A6%22],[1,%22Measure%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JV46I.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to create these .gifs from within Quirk? Or does one need to use some third-party software?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-17T20:56:35.977" LastActivityDate="2019-02-17T21:23:29.777" Title="Creating .gifs corresponding to Quirk simulations" Tags="&lt;simulation&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5508" PostTypeId="2" ParentId="5485" CreationDate="2019-02-17T13:49:37.067" Score="0" Body="&lt;p&gt;In general, this problem is not very simple, ultimately it comes down to taking a Hamiltonian as you've written and somehow forming the appropriate sequence of gates that implements &lt;span class=&quot;math-container&quot;&gt;$e^{-\Delta t H}$&lt;/span&gt;. From my understanding, this is usually accomplished by using the Trotter-Suzuki approximation and gate decompositions.&lt;/p&gt;&#xA;" OwnerDisplayName="user2318" LastEditorUserId="26" LastEditDate="2019-02-17T13:52:44.190" LastActivityDate="2019-02-17T13:52:44.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5509" PostTypeId="1" CreationDate="2019-02-17T16:10:22.100" Score="2" ViewCount="192" Body="&lt;p&gt;In the book by Chuang and Nielsen they prove that controlled U operations can be made out of CNOTs and single qubit gates. But then they go on to prove that they are universal by showing that every n by n matrix can be decomposed into two level matrices and then to CNOTs and single qubit gates.  But if so, then why can't we prove this way that controlled U can be too, decomposed to them. Since a controlled U is after all an n by n matrix. Why is there a separate proof for them?&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="5742" LastEditDate="2019-02-17T16:47:42.310" LastActivityDate="2019-02-18T11:49:03.620" Title="If CNOTs and single qubit gates are universal then why do we need to prove that controlled U operations can be composed by them as well?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5510" PostTypeId="2" ParentId="5507" CreationDate="2019-02-17T21:23:29.777" Score="4" Body="&lt;p&gt;I made those GIFs using the screen recorder &lt;a href=&quot;https://www.screentogif.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ScreenToGif&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ScreenToGif is not very good at compressing while maintaing quality, so I found it worked better to disable all optimizations while recording, try to preserve all detail, then post-process using &lt;a href=&quot;https://www.gimp.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GIMP&lt;/a&gt;'s &lt;a href=&quot;http://blog.gregzaal.com/2015/08/06/making-an-optimized-gif-in-gimp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Optimize (for GIF)&quot; filter&lt;/a&gt;. GIMP is also handy for e.g. adding the text labels you see in the images.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There was an old dev version of Quirk that had a &quot;record cycle&quot; button, but it was incredibly slow and didn't produce decent results [you have to find javascript code to encode the GIF data, and you often want to vary the framerate because some things look fine at low rates but some don't] so I dropped it.)&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-17T21:23:29.777" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5511" PostTypeId="1" CreationDate="2019-02-18T03:38:51.267" Score="3" ViewCount="239" Body="&lt;p&gt;I am attempting to run the following on a remote backend through QISkit:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;try:&#xA;    import math&#xA;    from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;    from qiskit import execute, IBMQ, Aer&#xA;    from qiskit.backends.ibmq import least_busy&#xA;&#xA;    q = QuantumRegister(1, 'q')&#xA;    c1 = ClassicalRegister(1, 'c1')&#xA;    c2 = ClassicalRegister(1, 'c2')&#xA;    qc1 = QuantumCircuit(q, c1)&#xA;    qc2 = QuantumCircuit(q, c2)&#xA;    qc1.ry(math.pi*0.25, q[0])&#xA;    qc2.ry(math.pi*0.25, q[0])&#xA;&#xA;    qc1.measure(q, c1)&#xA;    qc2.measure(q, c2)&#xA;&#xA;    backend_sim = Aer.get_backend('qasm_simulator')&#xA;&#xA;    job_sim1 = execute(qc1, backend_sim)&#xA;    result_sim1 = job_sim1.result()&#xA;&#xA;    job_sim2 = execute(qc2, backend_sim)&#xA;    result_sim2 = job_sim2.result()&#xA;&#xA;    print(&quot;simulation one: &quot;, result_sim1)&#xA;    print(result_sim1.get_counts(qc1))&#xA;    print(&quot;simulation two: &quot;, result_sim2)&#xA;    print(result_sim2.get_counts(qc2))&#xA;&#xA;    ibmq_backends = IBMQ.backends()&#xA;&#xA;    print(&quot;Remote backends: &quot;, ibmq_backends)&#xA;    try:&#xA;        least_busy_device = least_busy(IBMQ.backends(simulator=False))&#xA;        print(&quot;Running on current least busy device: &quot;, least_busy_device)&#xA;&#xA;        job_exp = execute(qc, least_busy_device, shots=1024, max_credits=10)&#xA;        result_exp = job_exp.result()&#xA;&#xA;        print(&quot;experiment: &quot;, result_exp)&#xA;        print(result_exp.get_counts(qc))&#xA;    except:&#xA;        print(&quot;all devices are unavailable.&quot;)&#xA;except QiskitError as ex:&#xA;    print('an error occurred. Error = {}'.format(ex))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;After the local qasm simulator runs, I receive:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;Remote backends: []&#xA;All devices are currently unavailable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, if I run the &quot;hello_quantum.py&quot; example given through IBMQ, I am able to access multiple backends and use the ibm_16_melbourne computer. Interestingly, there seems to be an error in this program specifically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas on what could be going wrong here?&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="26" LastEditDate="2019-02-18T03:51:31.370" LastActivityDate="2019-02-20T08:35:17.553" Title="Consistent QISkit error: &quot;All devices are currently unavailable&quot;" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5512" PostTypeId="2" ParentId="5509" CreationDate="2019-02-18T07:41:53.443" Score="2" Body="&lt;p&gt;Constructing controlled-U out of single qubit rotations and cNOT is part of the proof of universality of single qubit rotations and cNOT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bit of Nielsen &amp;amp; Chuang that you're referring to decomposes an arbitrary unitary in terms of gates such as controlled-controlled-....-controlled-U. See, for example, Fig 4.16 (P. 193 of 2002 printing). But that gate is built out of controlled-U. See, for example, Fig. 4.10 (P. 184). (although Exercise 4.28 gives you a different construction without work qubits). So, you need to construction of controlled-U for the whole thing to work.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-18T11:49:03.620" LastActivityDate="2019-02-18T11:49:03.620" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5513" PostTypeId="2" ParentId="5485" CreationDate="2019-02-18T08:24:55.753" Score="4" Body="&lt;p&gt;Let's say you have a Hamiltonian of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sigma_1\otimes\sigma_2\otimes\sigma_2\otimes\ldots\otimes\sigma_n&#xA;$$&lt;/span&gt;&#xA;There's a straightforward circuit construction that lets you implement its time evolution &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt;. The trick is basically to decompose the state that you're evolving into the components that are in the &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; eigenspaces of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Then, you apply the phase &lt;span class=&quot;math-container&quot;&gt;$e^{-it}$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, and the phase &lt;span class=&quot;math-container&quot;&gt;$e^{-it}$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace. The following circuit does that job (and uncomputes the decomposition at the end).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9goXj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9goXj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I'm assuming the phase gate element in the middle to be applying the unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} e^{it} &amp;amp; 0 \\ 0 &amp;amp; e^{-it} \end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In general, if you want to evolve some Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=H_1+H_2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; are of the previous form, then by far the easiest is to decompose the evolution as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iHt}\approx \left(e^{-iH_1t/M}e^{-iH_2t/M}\right)^M&#xA;$$&lt;/span&gt;&#xA;for some large &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (although there are algorithms with much better scaling behaviour), and each of those small steps &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_1t/M}$&lt;/span&gt; can be implemented with the previous circuit.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;That said, sometimes there are smarter things that you can do. Your extra example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=X\otimes Y\otimes\mathbb{I}+Z\otimes\mathbb{I}\otimes Y&#xA;$$&lt;/span&gt;&#xA;is one such case. I'd start by apply the unitary rotation &lt;span class=&quot;math-container&quot;&gt;$U=\frac{Z+Y}{\sqrt{2}}$&lt;/span&gt; to qubits 2 and 3. This is the equivalent to the Hadamard gate, but converts &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. Now stop for a moment and think. If qubits 2 and 3 are in 00, then we're applying &lt;span class=&quot;math-container&quot;&gt;$(X+Z)$&lt;/span&gt; to qubit 1. For 01, it's &lt;span class=&quot;math-container&quot;&gt;$(X-Z)$&lt;/span&gt;, for 10 it's &lt;span class=&quot;math-container&quot;&gt;$(Z-X)$&lt;/span&gt;, and for 11 it's &lt;span class=&quot;math-container&quot;&gt;$-(X+Z)$&lt;/span&gt;. Next, let's apply controlled-not from qubit 2 to qubit 3. This just permutes the basis elements slightly. It now says that we have to apply the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(-1)^{x_2}(X+(-1)^{x_3}Z)&#xA;$$&lt;/span&gt;&#xA;to the state of qubit 1, if qubits 2 and 3 are in the states &lt;span class=&quot;math-container&quot;&gt;$x_2x_3$&lt;/span&gt;. Next, remember that &lt;span class=&quot;math-container&quot;&gt;$X+Z=\sqrt{2}H$&lt;/span&gt; (Hadamard, not Hamiltonian), and that &lt;span class=&quot;math-container&quot;&gt;$X\sqrt{2}HX=X-Z$&lt;/span&gt;. So, that gives us an easy way to convert between the two bits of Hamiltonian. We'll just replace those two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s with controlled-nots controlled by qubit 3. Similarly, we can use a circuit identity&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rpPqV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rpPqV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;where this time we'll replace the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s with controlled-nots controlled off qubit 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, I believe the simulation looks like&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BTbxH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BTbxH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;It might look complicated, but there's none of the splitting up into little time steps that accumulate errors as you go along. It won't apply very often, but it's worth being aware of these sorts of possibilities.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-18T08:24:55.753" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5514" PostTypeId="1" CreationDate="2019-02-18T10:43:03.727" Score="3" ViewCount="29" Body="&lt;p&gt;Can one replace Nitrogen with Phosphorus and Carbon with Silicon and so on?&#xA;What would be the conditions that would preclude such a realisation? Are there any implemenations so far?&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="26" LastEditDate="2019-02-18T12:36:20.410" LastActivityDate="2019-02-18T12:36:20.410" Title="Can one make NV centred type qubits from analogus materials in the periodic table?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;experiment&gt;&lt;chemistry&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5516" PostTypeId="1" AcceptedAnswerId="5517" CreationDate="2019-02-18T11:43:28.083" Score="4" ViewCount="345" Body="&lt;p&gt;The concurrence for a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Concurrence_(quantum_computing)&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C(\rho) = {\rm max}\{0, \lambda_1-\lambda_2-\lambda_3-\lambda_4\}.&#xA;\end{equation}&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are the eigenvalues of matrix &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{\sqrt{\rho} \tilde{\rho} \sqrt{\rho}}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho} = (\sigma_y \otimes \sigma_y) \rho^* (\sigma_y \otimes \sigma_y)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt; being the Pauli matrix and &lt;span class=&quot;math-container&quot;&gt;$\rho^*$&lt;/span&gt; is the complex conjugate of state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of Bell diagonal states of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_{k=1}^{4} \lambda_k |\beta_k\rangle\langle\beta_k|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\beta_k\rangle$&lt;/span&gt;  is the Bell state. In this case, the concurrence, as defined &lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.92.062314&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (Eq. B11), is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C = 2~ {\rm max}[0, \Lambda-\frac{1}{2}]&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Lambda = {\rm max}_k\{ \lambda_k\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these two definitions connected?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Thanks for clearing the above doubts. Just found one more definition &lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.80.2245&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (below Eq. 10). Here&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C(\rho) = {\rm max}\{0, \lambda_1-\lambda_2-\lambda_3-\lambda_4\}.&#xA;\end{equation}&lt;/span&gt;&#xA;But this time &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\textit{square root}$&lt;/span&gt; o the eigenvalues of the matrix &lt;span class=&quot;math-container&quot;&gt;$\rho \tilde{\rho}$&lt;/span&gt;, rather than eigenvalue of the  &lt;span class=&quot;math-container&quot;&gt;$\textit{square root}$&lt;/span&gt; of matrix &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{\sqrt{\rho} \tilde{\rho} \sqrt{\rho}}$&lt;/span&gt;. Even if we agree that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho} \tilde{\rho} \sqrt{\rho} = \rho$&lt;/span&gt;, in the Bell basis, then &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$\textit{the eigenvalues of the square root of $\rho$, rather than square root of the eigenvalues of $\rho$}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="10480" LastEditDate="2021-01-27T16:08:12.423" LastActivityDate="2021-01-27T16:08:12.423" Title="Connection between the definitions of concurrence for a two-qubit states" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;quantum-information&gt;&lt;concurrence&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5517" PostTypeId="2" ParentId="5516" CreationDate="2019-02-18T13:05:56.217" Score="3" Body="&lt;p&gt;The Bell states &lt;span class=&quot;math-container&quot;&gt;$|\beta_k\rangle$&lt;/span&gt; all satisfy &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Y|\beta_k\rangle=\pm|\beta_k\rangle$&lt;/span&gt;. Hence, &lt;span class=&quot;math-container&quot;&gt;$\tilde\rho=\rho$&lt;/span&gt;. Thus, the matrix &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\sqrt{\rho}\tilde\rho\sqrt{\rho}}=\rho$&lt;/span&gt;, given that all the &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; are real and non-negative. Hence, the set of eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; is the same as the set of the &lt;span class=&quot;math-container&quot;&gt;$\tilde \lambda_k$&lt;/span&gt;, the Bell-diagonal components (I've denoted these by &lt;span class=&quot;math-container&quot;&gt;$\tilde\lambda_k$&lt;/span&gt; to avoid any confusion). However, the stated definition of the concurrence explicitly orders the eigenvalues, &lt;span class=&quot;math-container&quot;&gt;$\lambda_1\geq\lambda_2\geq\lambda_3\geq\lambda_4$&lt;/span&gt;. Hence, &lt;span class=&quot;math-container&quot;&gt;$\lambda_1=\max_k\tilde\lambda_k=\Lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Recall that &lt;span class=&quot;math-container&quot;&gt;$\sum_k\tilde\lambda_k=1$&lt;/span&gt;, so we have that &lt;span class=&quot;math-container&quot;&gt;$\lambda_2+\lambda_3+\lambda_4=1-\Lambda$&lt;/span&gt;. Using &lt;span class=&quot;math-container&quot;&gt;$C(\rho)=\max[0,\lambda_1-\lambda_2-\lambda_3-\lambda_4]$&lt;/span&gt;, we now have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C=\max[0,2\Lambda-1]=2\max[0,\Lambda-\frac12].&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Given the edit to you question, it appears the following needs to be clarified. Recall that for a normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (of which Hermitian is a special case), it has a spectral decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\sum_i\lambda_i|\lambda_i\rangle\langle\lambda_i|.&#xA;$$&lt;/span&gt;&#xA;For any function &lt;span class=&quot;math-container&quot;&gt;$f:\mathbb{C}\mapsto\mathbb{C}$&lt;/span&gt;, i.e. accepts a complex number as input and gives a complex number as output, we can define the action of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; on the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(A)=\sum_if(\lambda_i)|\lambda_i\rangle\langle\lambda_i|.&#xA;$$&lt;/span&gt;&#xA;This means that &lt;em&gt;the square root of the eigenvalues are equal to the eigenvalues of the square root&lt;/em&gt;. It also means that if you're trying to calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{\sqrt{\rho}\rho\sqrt{\rho}},&#xA;$$&lt;/span&gt;&#xA;then you can start by writing this as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sqrt{\left(\sum_i\sqrt{\lambda_i}|\lambda_i\rangle\langle\lambda_i|\right)\left(\sum_i\lambda_i|\lambda_i\rangle\langle\lambda_i|\right)\left(\sum_i\sqrt{\lambda_i}|\lambda_i\rangle\langle\lambda_i|\right)}&amp;amp;=\sqrt{\sum_i\lambda_i^2|\lambda_i\rangle\langle\lambda_i|} \\&#xA;&amp;amp;=\sum_i|\lambda_i||\lambda_i\rangle\langle\lambda_i|&#xA;\end{align}&lt;/span&gt;&#xA;Since the &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are positive, this is the same as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="12560" LastEditDate="2020-07-06T06:21:28.470" LastActivityDate="2020-07-06T06:21:28.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5518" PostTypeId="1" AcceptedAnswerId="5519" CreationDate="2019-02-18T13:15:38.507" Score="3" ViewCount="149" Body="&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; For 2x2 and 2x3 systems, is the partial transpose the only positive but not completely positive operation that is possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why this came up:&lt;/strong&gt; The criteria for detecting if a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is entangled is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\forall \Lambda $&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is a positive but not completely positive operator,&#xA;if &lt;span class=&quot;math-container&quot;&gt;$$(I \otimes \Lambda ) \rho \geq 0 $$&lt;/span&gt;&#xA;then the state is separable, otherwise it is entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we know the Peres-Horodecki criteria for 2x2 and 2x3 systems says it is enough to check only for one positive operation, that is, the partial transpose. Hence I was wondering if this was true.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-03-09T22:05:29.990" LastActivityDate="2021-03-09T22:05:29.990" Title="For 2x2 and 2x3 systems, is the partial transpose the only positive but not CP operation?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;partial-transpose&gt;&lt;ppt-criterion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5519" PostTypeId="2" ParentId="5518" CreationDate="2019-02-18T14:55:08.373" Score="5" Body="&lt;p&gt;The partial transpose is not the only positive but not completely positive operation that is possible on 2x2 and 2x3 systems. Trivially, any completely positive operation (such as a local unitary) combined with the partial transpose is a different positive operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is that, as &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion#Demonstration&quot; rel=&quot;noreferrer&quot;&gt;wikipedia&lt;/a&gt; puts it&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;every such map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; can be written as&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Lambda=\Lambda_1+\Lambda_2\circ T$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\Lambda _{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Lambda _{2}$&lt;/span&gt; are completely positive and&#xA;  T is the transposition map&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;so, somehow, the partial transpose is the only element that you need to describe all possible positive maps on 2x2 and 2x3 systems. That doesn't mean it's the only map.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-18T14:55:08.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5520" PostTypeId="1" CreationDate="2019-02-18T16:23:11.793" Score="3" ViewCount="814" Body="&lt;p&gt;Bell’s inequality is &lt;span class=&quot;math-container&quot;&gt;$$S = P(a,b)-P(a,d)+P(c,b)+P(c,d) \leq 2,$$&lt;/span&gt; which is calculated as &lt;span class=&quot;math-container&quot;&gt;$$S = ab – ad + cb + cd \leq 2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CHSH version is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E = \frac{N_{11} + N_{00} - N_{10} -N_{01}} {N_{11} + N_{00} + N_{10} + N_{01}}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S = {E_1 - E_2 + E_3 + E_4}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$N_{11}$&lt;/span&gt; is the number of correlations, etc.&#xA;&lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the correlation coefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There appears to be a significant difference between Bell’s and CHSH’s inequalities.  For comparison, converting the  correlation coefficient to Probability makes it possible to enter the values directly into Bell’s Inequality.  The conversion to probability is the correlation coefficient divided by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; then adding &lt;span class=&quot;math-container&quot;&gt;$.5$&lt;/span&gt;.  Using the much mentioned values for &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$-.707,   +.707, +.707$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$+.707$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$a, b, c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; respectively. Bell’s Inequality is calculated as &lt;span class=&quot;math-container&quot;&gt;$$S = (-.8535)(.8535) –  (-.8535)(.8535) + (.8535)(.8535) + (.8535)(.8535)$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$= -.728 + .728 + .728 + .728 = 1.456.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So using the real Bell’s Inequality, there is no violation. Shouldn't the CHSH Inequality be calculated as &lt;span class=&quot;math-container&quot;&gt;$$S=E_1E_2-E_1E_4+E_3E_2+E_3E_4?$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 1:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The essence of the problem with the CHSH experiment is that &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is calculated as a correlation coefficient, similar to probability, then inserted into the CHSH inequality as &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt;, which is a product of 2 independent values.  That is a huge mistake.  Either this is wrong or the fundamental “proof” of quantum theory is seriously flawed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in the calculation of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; are the results of 2 runs of the experiment from run &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and run &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&#xA;The &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in the calculation of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; are the results of 1 run of the experiment from detector a and detector b&#xA;The two &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;’s are completely different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 3:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please excuse my post that was too nebulous to point out an error.  This is a solid description of my problem with the CHSH experiments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CHSH inequality is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S = E(a,b) - E(a,d) + E(c,b) + E(c,d) \leq 2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It, like Bell’s inequality, is valid for all values from &lt;span class=&quot;math-container&quot;&gt;$–1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;To avoid having 2 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;’s, separate letters are assigned to each item in the experiment, lower case for values and upper case for the rest.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The letters &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; are reserved for the CHSH Inequality.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;X and Y are the 2 detectors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; are the 4 angles of the detectors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;K, L, M, and N are the 4 runs.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; are results of K, L, M and N for detector X.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; are results of K, L, M and N for detector Y.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E(p,u)$&lt;/span&gt; is inserted into &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt; by CHSH.  &lt;span class=&quot;math-container&quot;&gt;$E(q,v)$&lt;/span&gt; is inserted into &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$E(a,d)$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$E(r,w)$&lt;/span&gt; is inserted into &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$E(c,b)$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$E(t,z)$&lt;/span&gt; is inserted into &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$E(c,d)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That makes the calculation of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S = E(p,u) - E(q,v) + E(r,w) + E(t,z).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So CHSH puts 8 independent values into the inequality. Both Bell’s and CHSH’s inequalities require exactly 4 values. This makes the inequality invalid. What is the error in this description of the CHSH experiment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 4:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last comment said: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;“We can also calculate the correlations so, if both choose to measure setting 1, we'd have the value &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; being the product of the two answers.&#xA;If we run this many times, we build up expectation values for each of these entities, eventually giving us things like &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt;. Then we can evaluate &#xA;&lt;span class=&quot;math-container&quot;&gt;$S=E(a,b)−E(a,d)+E(c,b)+E(c,d)$&lt;/span&gt;”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That has isolated the problem.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt; from the runs is not the same  as the &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt; in the CHSH Inequality.  In the runs &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the setting of the &quot;a&quot; polarizer in degrees, i.e. 22.5°.  Both Bell’s and CHSH’s inequalities are valid for all numbers from –1 to +1.  They are not valid for 22.5.  If you disagree, what is the value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt; of the runs?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 5:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason the CHSH experiment has been able to get away with a fatal error for 50 years is because of clever but erroneous replies to objections like this typical one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;“In a single run of an experiment, there are two boxes. On each box, you can choose one of two settings, and you get an answer &lt;span class=&quot;math-container&quot;&gt;$±1$&lt;/span&gt;&#xA;If Alice (first box) chose setting 1, she would record her answer in the random variable &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. If she chose setting 2, she records her answer in random variable &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. Similarly, Bob uses random variables &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. We can also calculate the correlations so, if both choose to measure setting 1, we'd have the value &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt;”&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look what that says, set &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; to the same value and correlate them.  The result of the correlation of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; has to be 1.  That is definitely not a justification for the CHSH calculations.&lt;/p&gt;&#xA;" OwnerUserId="5829" LastEditorUserId="10480" LastEditDate="2021-04-16T20:45:02.857" LastActivityDate="2021-04-16T20:45:02.857" Title="How is Bell’s Inequality converted to the CHSH inequality?" Tags="&lt;non-locality&gt;&lt;bell-experiment&gt;&lt;correlations&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5521" PostTypeId="1" AcceptedAnswerId="5522" CreationDate="2019-02-18T19:50:04.987" Score="3" ViewCount="909" Body="&lt;p&gt;My question is very simple. I know there is a method to add a control to previously defined gates. I saw in the API of cirq that there is a command Controlled gate (&lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.ControlledGate.html#cirq.ControlledGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). I'm not understanding though how would this work. Suppose for example I want to add a control to an XPowGate from cirq. How would I write this in a program and how would I define the control qubit and the qubit over which I want to act?&lt;/p&gt;&#xA;" OwnerUserId="1754" LastEditorUserId="26" LastEditDate="2019-02-18T19:55:13.183" LastActivityDate="2019-12-09T05:38:27.250" Title="How to add control to gates in Cirq?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5522" PostTypeId="2" ParentId="5521" CreationDate="2019-02-18T22:45:00.027" Score="7" Body="&lt;p&gt;You can use the &lt;code&gt;controlled_by&lt;/code&gt; method on any Operation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;op = cirq.X(target_qubit).controlled_by(control_qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also use &lt;code&gt;controlled&lt;/code&gt; before specifying the target qubits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;op = cirq.X.controlled().on(control_qubit, target_qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are also built-in controlled operations such as &lt;code&gt;cirq.CNOT&lt;/code&gt;, &lt;code&gt;cirq.CZ&lt;/code&gt;, and &lt;code&gt;cirq.CSWAP&lt;/code&gt;. The built-in operations are generally preferable because they have hand-tuned gate decompositions and simulation methods. The general &lt;code&gt;controlled_by&lt;/code&gt; has to fall back to more general methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the controlled versions of gates support things like raising to a power. The following three expressions produce equivalent operations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(cirq.X(q)**0.5).controlled_by(c)&#xA;&#xA;(cirq.X**0.5).on(q).controlled_by(c)&#xA;&#xA;cirq.X(q).controlled_by(c)**0.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-12-09T05:38:27.250" LastActivityDate="2019-12-09T05:38:27.250" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5524" PostTypeId="2" ParentId="4178" CreationDate="2019-02-19T10:55:56.820" Score="3" Body="&lt;p&gt;First of all, you inverted &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; when trying to draw the analogy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Bell's original paper, &lt;span class=&quot;math-container&quot;&gt;$\vec a,\vec b$&lt;/span&gt; are used to denote the measurement directions, so the underlying probability distribution should be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(x,y|\vec a,\vec b,\lambda)=p(x|\vec a,\lambda)p(y|\vec b,\lambda).$$&lt;/span&gt;&#xA;The expectation values &lt;span class=&quot;math-container&quot;&gt;$A(\vec a,\lambda)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B(\vec b,\lambda)$&lt;/span&gt; used in Bell's paper would then be given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A(\vec a,\lambda)=\sum_x x p(x|\vec a,\lambda)$$&lt;/span&gt;&#xA;and similarly for &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. The sum is here extended over the possible values that can correspond to the measurement choice &lt;span class=&quot;math-container&quot;&gt;$\vec a$&lt;/span&gt;. In the case of Bell's paper, this amounts to &lt;span class=&quot;math-container&quot;&gt;$x=\pm 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the expectation value &lt;span class=&quot;math-container&quot;&gt;$E(\vec a,\vec b)$&lt;/span&gt; you now simply need to take the average over the possible values of the hidden variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This answer was also posted on &lt;a href=&quot;https://physics.stackexchange.com/a/461678/58382&quot;&gt;the duplicate question&lt;/a&gt; on physics.SE&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-02-19T11:46:33.687" LastActivityDate="2019-02-19T11:46:33.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5525" PostTypeId="1" AcceptedAnswerId="15998" CreationDate="2019-02-19T14:21:14.933" Score="27" ViewCount="959" Body="&lt;p&gt;Recently, a series of research papers have been released (&lt;a href=&quot;https://arxiv.org/abs/1807.04271&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1811.00414&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1811.04909&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;, also &lt;a href=&quot;https://arxiv.org/abs/1811.04852&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt;) that provide classical algorithms with the same runtime as quantum machine learning algorithms for the same purpose. From my understanding, the key to all the algorithms that have been &lt;em&gt;dequantized&lt;/em&gt; is the same: the state preparation routine has been substituted by &lt;span class=&quot;math-container&quot;&gt;$\ell^2$&lt;/span&gt;-norm sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few questions arise: after these results, what are the expectations from the field? Since any quantum algorithm will need of state preparation at some point (in every algorithm we will have, at some point, to encode some classical data in a quantum state), can any quantum machine learning algorithm be dequantized using Tang's method? If not, which algorithms are expected to / do resist this dequantization?&lt;/p&gt;&#xA;" OwnerUserId="1917" LastEditorUserId="55" LastEditDate="2020-09-01T22:27:55.410" LastActivityDate="2021-02-11T20:09:03.317" Title="Quantum machine learning after Ewin Tang" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;quantum-advantage&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="5526" PostTypeId="1" AcceptedAnswerId="5527" CreationDate="2019-02-19T17:56:50.523" Score="4" ViewCount="221" Body="&lt;p&gt;In designing reversible circuits one of the useful circuits is the decoder. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operation of a decoder is naturally reversible, so it makes sense to be able to create one with no garbage outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;1-to-2&lt;/a&gt; and &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;2-to-4&lt;/a&gt; decoders this is easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I look up reversible decoder implementations for n greater than 2, I can't find any that reduce the garbage outputs to 0. Is there a reason for this? Has it been proven impossible, or has a solution just eluded research?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular &lt;a href=&quot;http://www.arresearchpublication.com/images/shortpdf/1485842057_N558_IJEEE.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper seems to show that many attempts to create 3-to-8 decoders seem to get stuck at 1 garbage output. I did notice that most papers seem to focus on general quantum cost, not just on garbage output. I suspect that if quantum cost is ignored it should be possible to create a 3-to-8 decoder with no garbage output lines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried with pen and paper to come up with such a design, to no avail, but haven't performed any kind of exhaustive search.&lt;/p&gt;&#xA;" OwnerUserId="5843" LastEditorUserId="5843" LastEditDate="2019-02-20T17:06:20.820" LastActivityDate="2019-02-21T01:25:02.650" Title="Garbage-Free Reversible Binary-To-Unary Decoder Construction" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5527" PostTypeId="2" ParentId="5526" CreationDate="2019-02-20T04:27:13.763" Score="4" Body="&lt;p&gt;I'm assuming that by &quot;decoder&quot; you mean &quot;binary to unary conversion&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a very simple way to produce the unary output from the binary input, by using a series of swap gates in a descending pattern. This even works when you know your input has a maximum value that's not a power of 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OEfQN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OEfQN.png&quot; alt=&quot;binary to unary&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have the unary output, you can use a series of CNOTs to clear the binary input. For example, for unary output qubit #6 you toggle binary bits #1 and #2 because 6 = 2^1 + 2^2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SfHEO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SfHEO.png&quot; alt=&quot;unary to binary&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &quot;garbage free decoder&quot; is just these two circuits in sequence. An encoder is the same thing but in the reverse order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have that circuit, it's not too hard to get rid of the workspace. For example, here's &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Counting3%22%5D%2C%5B%22Chance3%22%5D%2C%5B1%2C1%2C%22%3E%3E6%22%5D%2C%5B1%2C%22%3E%3E3%22%5D%2C%5B%22%3E%3E2%22%5D%2C%5B%22X%22%5D%2C%5B%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22Swap%22%2C1%2C%22Swap%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Swap%22%2C1%2C1%2C1%2C%22Swap%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22Swap%22%2C1%2C1%2C1%2C%22Swap%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22Swap%22%2C1%2C1%2C1%2C%22Swap%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;a no-workspace 3-to-8 decoder circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4iLnA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4iLnA.png&quot; alt=&quot;3-to-8 decoder&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the number of non-Clifford operations in this circuit (n-lg2(n)-1) is provably optimal because every output (there are n) is linearly independent w.r.t. xoring and you start with only lg2(n) + 1 linearly independent components (lg(n) address bits + 1 for the ON state).&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-02-21T01:25:02.650" LastActivityDate="2019-02-21T01:25:02.650" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5528" PostTypeId="2" ParentId="5511" CreationDate="2019-02-20T08:35:17.553" Score="3" Body="&lt;p&gt;To use the remote backends, you need to sign into the IBM Q Experience. This is done with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(after IBMQ has been imported, of course). Since &lt;code&gt;IBMQ.backends()&lt;/code&gt; returns the list of backends that your account allows you to use, it will return an empty list when you are not signed in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An additional note: If you update to the most recent Qiskit version (as of 2019-02-20) you'll need to use &lt;code&gt;from qiskit.providers.ibmq import least_busy&lt;/code&gt; to import &lt;code&gt;least_busy&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-02-20T08:35:17.553" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5529" PostTypeId="1" CreationDate="2019-02-20T15:00:41.783" Score="1" ViewCount="94" Body="&lt;p&gt;I started working in Qiskit, and here is an example of how gates of a circuit are represented graphically in LaTeX format:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6O5Ih.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6O5Ih.png&quot; alt=&quot;Qiskit code&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt;, is a y rotation by a certain angle. But all the other gates look like &lt;span class=&quot;math-container&quot;&gt;$U_i(x,y,z)$&lt;/span&gt;, and I don't know how what they actually do. What is their matrix representation? What do the numbers &lt;span class=&quot;math-container&quot;&gt;$i,x,y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; mean?&lt;/p&gt;&#xA;" OwnerUserId="5600" LastEditorUserId="26" LastEditDate="2019-02-20T23:49:34.273" LastActivityDate="2019-02-20T23:49:34.273" Title="Qiskit gates in LaTeX representation: notation meaning" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;notation&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2019-02-20T17:44:03.517" ContentLicense="CC BY-SA 4.0" />
  <row Id="5530" PostTypeId="1" AcceptedAnswerId="5531" CreationDate="2019-02-20T20:44:58.907" Score="2" ViewCount="316" Body="&lt;p&gt;I don't understand it. But suppose you have a state of two qubits in superposition and it looks like &lt;span class=&quot;math-container&quot;&gt;$|10\rangle-|11\rangle$&lt;/span&gt;.&#xA;Now you have in your circuits two gates one is a controlled-NOT from the first qubit to the second and the other gate following is the Hadamard gate on the first qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I applied first the CNOT I got, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle-|10\rangle$&lt;/span&gt;, right? &#xA;(I am not entirely sure why it's allowed to work like this but ok.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I was trying two approaches yielding different results but I am actually not sure about what is the meaning of the first qubit.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;So one approach was to take the original state  &lt;span class=&quot;math-container&quot;&gt;$|10\rangle-|11\rangle$&lt;/span&gt; and apply to it &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; gate multiplied by  CNOT gate.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The second approach is to take the state after the CNOT &lt;span class=&quot;math-container&quot;&gt;$|11\rangle-|10\rangle$&lt;/span&gt;  and just as I did with the CNOT I would apply &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; gate only on the first qubit which is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle-|1\rangle$&lt;/span&gt;, right? (Could be there is some coefficient there like &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; but I don't care about it now). But the thing I don't understand is how do I apply &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; gate on &lt;span class=&quot;math-container&quot;&gt;$|1\rangle-|1\rangle$&lt;/span&gt;? It isn't even clear to me what it means.  Doesn't &lt;span class=&quot;math-container&quot;&gt;$|1\rangle-|1\rangle$&lt;/span&gt; equal nothing?  I mean, it isn't even a state, no?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Anyways it is strange, the first approach would yead a vector like &lt;span class=&quot;math-container&quot;&gt;$(-1,1,1,-1)$&lt;/span&gt; I am not sure what it means. But it looks like I can never get such a state in the second approach, simply because I can't get more than two states combined because the Hadamard is acting only on the first qubit while the second qubit should remain unchanged. But mainly I am not sure what's &lt;span class=&quot;math-container&quot;&gt;$|1\rangle-|1\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-30T07:51:30.980" LastActivityDate="2019-03-30T07:51:30.980" Title="What is the meaning of the state $|1\rangle-|1\rangle$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5531" PostTypeId="2" ParentId="5530" CreationDate="2019-02-20T21:38:34.813" Score="8" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The second approach is to take the state after the CNOT &lt;span class=&quot;math-container&quot;&gt;$|11\rangle-|10\rangle$&lt;/span&gt;  and just as I did with the CNOT I would apply &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt; gate only on the first qubit which is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle-|1\rangle$&lt;/span&gt;, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The state of the first qubit is &lt;em&gt;not&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle-|1\rangle$&lt;/span&gt;. It is simply &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://physics.stackexchange.com/questions/54896/should-it-be-obvious-that-independent-quantum-states-are-composed-by-taking-the&quot;&gt;tensor product&lt;/a&gt; follows a distributive law. See &lt;a href=&quot;https://math.stackexchange.com/a/425091&quot;&gt;this&lt;/a&gt; for a proof. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the composite state of two qubits (let's call them &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;) is &lt;span class=&quot;math-container&quot;&gt;$|10\rangle-|11\rangle$&lt;/span&gt;. It may be more explicitly written as &lt;span class=&quot;math-container&quot;&gt;$$|1\rangle_A\otimes |0\rangle_B - |1\rangle_A \otimes|1\rangle_B$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=|1\rangle_A\otimes (|0\rangle_B - |1\rangle_B).$$&lt;/span&gt;&#xA;This follows from the distributive law I linked. From here it should be clear that the state of the first qubit A is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A - |1\rangle_A$&lt;/span&gt;. And the state of the second qubit B is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_B-|1\rangle_B$&lt;/span&gt;. Can you take it from here?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-02-20T22:04:44.840" LastActivityDate="2019-02-20T22:04:44.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5532" PostTypeId="1" CreationDate="2019-02-21T06:24:27.030" Score="2" ViewCount="1331" Body="&lt;p&gt;I just got started with Qiskit. When I tried to save my account with the API token from IBMQ website, I got the error: &lt;code&gt;warnings.warn('Credentials already present. Set overwrite=True to overwrite.')&lt;/code&gt;. Then I set &lt;code&gt;overwrite = True&lt;/code&gt; but the warning was still raised and I cannot save the account and connect to the server.&lt;/p&gt;&#xA;" OwnerUserId="5859" LastEditorUserId="26" LastEditDate="2019-03-12T09:13:58.513" LastActivityDate="2020-07-04T12:46:27.057" Title="Cannot load account with Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5533" PostTypeId="2" ParentId="5532" CreationDate="2019-02-21T10:31:20.320" Score="1" Body="&lt;p&gt;Here's some general info, which will hopefully help you find and fix your issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can try using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(IBMQ.stored_accounts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to see what accounts you have stored on disk, and maybe see why they aren't working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simultaneously sign into all accounts on this list, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To only sign into the first, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;token = IBMQ.stored_accounts()[0]['token']&#xA;url = IBMQ.stored_accounts()[0]['url']&#xA;IBMQ.enable_account(token,url)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To only sign into the second, replace the &lt;code&gt;[0]&lt;/code&gt; above with &lt;code&gt;[1]&lt;/code&gt;, and so on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see which accounts you are currently logged into, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(IBMQ.active_accounts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to start afresh by removing all accounts from disk, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.delete_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Adding new accounts is then done with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account(token,url)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where token is a string that represents your API token, and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;url = 'https://quantumexperience.ng.bluemix.net/api'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for those using the public level access.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-02-21T10:31:20.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5534" PostTypeId="1" CreationDate="2019-02-21T13:37:05.390" Score="1" ViewCount="157" Body="&lt;p&gt;For example in grover search algorithm,&#xA;assuming that the amplified amplitude is &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; , is it possible to perform this operation :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha |0...\rangle + \beta |1...\rangle \longmapsto \beta|0...\rangle + \alpha|1...\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that the operation may be reversible&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to apply inverse : &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\alpha},\frac{1}{\beta}$&lt;/span&gt; then how normalize to get the sum of probabilities to 1?&lt;/p&gt;&#xA;" OwnerUserId="5862" LastEditorUserId="5862" LastEditDate="2019-02-25T09:05:27.877" LastActivityDate="2019-02-25T16:05:46.427" Title="Is there a way to reverse the amplitudes of a quantum system?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5535" PostTypeId="2" ParentId="5534" CreationDate="2019-02-21T14:19:30.727" Score="4" Body="&lt;p&gt;The reversing of the amplitudes is a pretty easy operation by using the Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator. The result of applying such operation to a qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X|\psi\rangle=X(\alpha|0\rangle + \beta|1\rangle)=\alpha X|0\rangle + \beta X|1\rangle=\alpha|1\rangle+\beta|0\rangle=\beta|0\rangle+\alpha|1\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so it performs the amplitude swap you are looking for, and that is why this operation receives the name of bit flip as it flips the bits of the state. If you want to apply an operation like that to a multiple qubit state, that is what I think you are asking for, as it would for example be &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0010\rangle+\beta|0111\rangle$&lt;/span&gt; then you should apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates to the qubits you need to change so that the resultant state is what you are looking for. For the example I gave, it would be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(I\otimes X\otimes I\otimes X)|\psi\rangle = (I\otimes X\otimes I\otimes X) (\alpha|0010\rangle+\beta|0111\rangle) =\alpha(I|0\rangle X|0\rangle I|1\rangle X|0\rangle)+\beta(I|0\rangle X|1\rangle I|1\rangle X|1\rangle)=\alpha|0111\rangle+\beta|0010\rangle = \beta|0010\rangle+\alpha|0111\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the swapped amplitude state that you are looking for is obtained.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2019-02-21T14:19:30.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5536" PostTypeId="2" ParentId="5504" CreationDate="2019-02-21T15:40:22.677" Score="5" Body="&lt;p&gt;A QFT can't arbitrarily raise the probability of any state you want to any value you want. Once you create a superposition, you need to find some way to make destructive interference occur between the states you don't want, and construct interference between the states you do want. Finding ways to do this is essentially the entire field of quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't find some way to use the structure of a specific problem, the best you can do is Grover's algorithm. For factoring, Grover's algorithm would run in time &lt;span class=&quot;math-container&quot;&gt;$O(N^{1/4})$&lt;/span&gt; (for a number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) which is worse than the classical number field sieve! So you &lt;em&gt;can&lt;/em&gt; use a superposition of factors, but a) you don't really need the QFT, and b) it's not efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The QFT is well-suited to period finding for abelian groups because the phases it produces, &lt;span class=&quot;math-container&quot;&gt;$\{e^{2\pi i j/N}\}_{j=0}^{N-1}$&lt;/span&gt;, are themselves an abelian group. There is a perspective where the QFT is seen as an application of representation theory,  transforming elements of a group into their representations. This is where I recommend you look if you want a deep understanding on why the QFT works well. Otherwise, I would just say that period-finding for abelian groups simply happens to be a problem for which it is relatively easy to create the necessary interference, and a QFT is an important component of that process.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2019-02-21T15:40:22.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5537" PostTypeId="2" ParentId="5454" CreationDate="2019-02-22T09:09:45.447" Score="8" Body="&lt;p&gt;Asymptotically, Shor's algorithm is &lt;em&gt;really&lt;/em&gt; efficient. Basically it's just: superposition, modular exponentiation (the slowest step), and a fourier transform.  Modular exponentiation is what you do to actually use the RSA cryptosystem. That means to a quantum computer, encrypting/decrypting RSA legitimately would be about the same speed as using Shor's algorithm to break the system. So I'm skeptical that there will be any improvements on the basic idea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, any improvement to integer addition, integer multiplication, or the quantum fourier transform would improve Shor's algorithm, and those are all very general subroutines that people will almost certainly work on. A short search on Google Scholar shows lots of research on improving quantum arithmetic circuits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think there will be more research on classical/quantum trade-offs in Shor's algorithm. That is, if you have a small or noisy quantum computer, can you modify Shor's algorithm so that it still works, but maybe needs a lot more pre- and post-processing on a classical computer, or maybe has a lower probability of success, etc.? In this area there's &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-319-59879-6_20&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithms for Computing Short Discrete Logarithms and Factoring RSA Integers&lt;/a&gt;. There's also the &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-319-59879-6_19&quot; rel=&quot;noreferrer&quot;&gt;Quantum Number Field Sieve&lt;/a&gt;, an approach where a &quot;small&quot; quantum computer (too small to use Shor's algorithm directly) is used as a subroutine of the classical number field sieve, slightly improving the time complexity (though I am personally convinced that error correction for this will require more physical qubits than vanilla Shor's algorithm). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, I don't expect any radical new quantum factoring algorithms and I don't think anyone's working on it. But there are a lot of interesting tweaks to be made to fit specific use cases.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2019-02-22T09:09:45.447" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5539" PostTypeId="1" CreationDate="2019-02-22T11:59:42.840" Score="1" ViewCount="139" Body="&lt;p&gt;I know how polarization filters work using EM waves. Can somebody help me in understanding how they work using photons?&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="5410" LastEditDate="2019-02-25T14:04:47.200" LastActivityDate="2019-02-28T01:18:04.737" Title="How to explain polarization using photon spin?" Tags="&lt;photonics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5541" PostTypeId="2" ParentId="5454" CreationDate="2019-02-22T17:23:31.933" Score="2" Body="&lt;p&gt;As addition to the answer of Sam:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, partly because Shor's approach is not the only way of factorizing numbers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Factorization can also be written as &lt;a href=&quot;https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2002-83.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;an optimization problem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be solved using the &lt;a href=&quot;https://www.dwavesys.com/sites/default/files/14-1002A_B_tr_Boosting_integer_factorization_via_quantum_annealing_offsets.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave machine&lt;/a&gt;, but also using &lt;a href=&quot;https://arxiv.org/pdf/1808.08927.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;a gate-based quantum computer&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-02-22T17:23:31.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5542" PostTypeId="1" CreationDate="2019-02-22T19:42:04.047" Score="4" ViewCount="910" Body="&lt;p&gt;I want to make my quantum machine learning algorithms. As far as I understand I must learn: basics of quantum physics, quantum computing (and algorithms), classical machine learning, quantum information; anything else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And from where would you advise me to start studying?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I really need to learn quantum computing or do you have some books or helpful sources?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be very grateful!&lt;/p&gt;&#xA;" OwnerUserId="5876" LastEditorUserId="26" LastEditDate="2019-02-22T20:01:46.427" LastActivityDate="2019-02-22T22:46:35.620" Title="How to study quantum machine learning?" Tags="&lt;machine-learning&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5543" PostTypeId="2" ParentId="5542" CreationDate="2019-02-22T22:46:35.620" Score="4" Body="&lt;p&gt;There are different review overviews about Quantum Machine Learning (see the question referenced in comments to find a few) but it is an evolving field so you will have to keep updated. There is also an &lt;a href=&quot;https://www.edx.org/course/quantum-machine-learning&quot; rel=&quot;noreferrer&quot;&gt;EDX online course about the subject made by Wittek&lt;/a&gt; recently released if you would like a little more hands-on format. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would advise to start with basics of quantum computing (like the basic linear algebra, notions of measurement...), check in parallel classical Machine Learning and cross-ref with what quantum versions of ML algorithms have been proposed so far.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-02-22T22:46:35.620" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5544" PostTypeId="2" ParentId="4720" CreationDate="2019-02-23T07:04:01.513" Score="2" Body="&lt;p&gt;If two qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; then the combined quantum state of the two qubits is already in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle \otimes |\psi_2\rangle$&lt;/span&gt;, without requiring any gates. We would need to calculate the tensor product classically. If one wants to measure (by sampling) &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, there are two ways of doing it.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure each qubit say &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; times and sample the qubit as &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle =  \alpha_i|0\rangle + \beta_i|1\rangle$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$i=1,2,\dots n$&lt;/span&gt;. Hence, to obtain the quantum state of all the qubits we require &lt;span class=&quot;math-container&quot;&gt;$n\cdot M$&lt;/span&gt; measurements. And to obtain the composite quantum state of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, we need to carry out the tensor product &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle \otimes |\psi_2\rangle \otimes |\psi_3\rangle \dots |\psi_n\rangle$&lt;/span&gt;, ourselves. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure all qubits simultaneously and after each measurement we would get a state &lt;span class=&quot;math-container&quot;&gt;$a_k |k\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$k=0,1,2,\dots 2^n - 1$&lt;/span&gt; (the decimal format of the orthogonal basis vectors with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits) and &lt;span class=&quot;math-container&quot;&gt;$\sum_k a_k^2 = 1$&lt;/span&gt;. However, to sample the complete quantum state we would need some &lt;span class=&quot;math-container&quot;&gt;$2^n\cdot M$&lt;/span&gt; measurements (&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; being some large number).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As you can see, with only &lt;span class=&quot;math-container&quot;&gt;$n\cdot M$&lt;/span&gt; measurements we get the independent quantum state of each qubit (without the tensor product of the qubit states). But with &lt;span class=&quot;math-container&quot;&gt;$2^n \cdot M$&lt;/span&gt; measurements we get the complete quantum state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (tensor product&lt;i&gt;&lt;b&gt;ed&lt;/b&gt;&lt;/i&gt; for us).&lt;/p&gt;&#xA;" OwnerUserId="4954" LastEditorUserId="4954" LastEditDate="2019-02-24T07:49:01.020" LastActivityDate="2019-02-24T07:49:01.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5545" PostTypeId="1" AcceptedAnswerId="5550" CreationDate="2019-02-24T14:56:45.727" Score="4" ViewCount="173" Body="&lt;p&gt;Measuring is clearly not the answer here. Is there some trick to prove it is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state?&lt;/p&gt;&#xA;" OwnerUserId="5887" LastEditorUserId="26" LastEditDate="2019-03-30T07:57:07.573" LastActivityDate="2019-03-30T07:57:07.573" Title="If a qubit is in $|1\rangle$ state, is it possible to prove that it is in $|1\rangle$ state?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5547" PostTypeId="1" CreationDate="2019-02-24T21:26:33.347" Score="2" ViewCount="225" Body="&lt;p&gt;I don't understand something which is I believe pretty fundamental. It's said that an operation represented by a matrix A is an entanglement if A can't be written as a tensor product of other matrices. On the other hand, I just learned lately that a vector state too can be determined by these criteria. That is, it's entangled if and only if it can't be written as a tensor product of other vector states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here comes the confusion. Suppose you take a CNOT for example. This obviously can't be written as a tensor product of other matrices as it's known to be entangled.  What're the consequences of applying a CNOT on a vector? I don't understand it, if you take a vector like (1,0,0,0) or (0,0,10) you will get after CNOT (1,0,0,0) or (0,0,0,1) respectively.   Which obviously &lt;em&gt;can&lt;/em&gt; be written as the tensor product of other vectors.  So what's going on here?  Is CNOT supposed to entangle the vector state or not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it that the gate itself can't be decomposed but the vector which it acted upon &lt;em&gt;can&lt;/em&gt;? Or if it isn't necessary then, what's the definition or requirements for entanglement which I am missing? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-02-24T22:06:12.293" LastActivityDate="2019-02-26T04:34:19.873" Title="The relationship between entanglement of vector states to matrix operations" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5548" PostTypeId="2" ParentId="5547" CreationDate="2019-02-24T21:50:24.787" Score="4" Body="&lt;p&gt;There are 3 different questions you need to ask yourself. First is the operator a tensor product of smaller matrices. Then is your input state a tensor product of smaller vectors. Finally is the result a tensor product of smaller vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stick with the two qubit example and CNOT that you had.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First question: CNOT is not able to be written as &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; operating on 1 qubit each.&#xA;Second question: The examples you gave were &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)=|0 0 \rangle$&lt;/span&gt; which can be broken up as &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle \otimes |0 \rangle$&lt;/span&gt;. The other example can as well. It is &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle \otimes |0 \rangle$&lt;/span&gt;.&#xA;Third question: The result states were &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; which was not entangled again. The other was &lt;span class=&quot;math-container&quot;&gt;$(0,0,0,1)$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle \otimes |1 \rangle$&lt;/span&gt; also not entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The implication goes differently than you seem to think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the operator was not entangled and written as &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt; and the input state was not entangled and written as &lt;span class=&quot;math-container&quot;&gt;$v \otimes w$&lt;/span&gt; with the same dimensions as the operator, then you would get &lt;span class=&quot;math-container&quot;&gt;$Av \otimes Bw$&lt;/span&gt; as the output. So not entangled operator AND not entangled input vector with the same dimensionality imply not entangled on the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the example shows if you only have operator entangled but input not, the output can still be not entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As another example, take the identity operator. It can be written as &lt;span class=&quot;math-container&quot;&gt;$I \otimes I$&lt;/span&gt; so it is not entangled. Apply it to an entangled input, you get the same state out. That gives the case of unentangled operator and entangled input giving entangled output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit to respond to comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT applied to &lt;span class=&quot;math-container&quot;&gt;$(H \mid 0 \rangle) \otimes \mid 0 \rangle$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} \mid 0 \rangle \otimes \mid 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 \rangle \otimes \mid 1 \rangle$&lt;/span&gt;. So the initial state is not entangled, but the output state is a Bell state.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2019-02-26T04:34:19.873" LastActivityDate="2019-02-26T04:34:19.873" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5549" PostTypeId="1" AcceptedAnswerId="5553" CreationDate="2019-02-24T23:53:29.100" Score="2" ViewCount="93" Body="&lt;p&gt;Besides the 'continuous' which I don't fully understand the term. It's all the time said that arbitrary gates can only be estimated but not necessarily be accurate. I don't understand the claim. So what if it's continuous? So do I have, uncountable many points on the Bloch sphere and I could certainly get from one to any other point using just two rotation gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is basically, simply why aren't two rotation matrices enough not just to approximate but even to accurately calculate any arbitrary transformation so they could be described as a 'universal set' (If you need control you can add CNOT but that's it!).  I mean, all you gotta do is playing around with the rotations so you switch a vector state on the surface sphere from one to another.  That's enough, why not?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I know there you may be required to use CNOT for some control qubits, but we usually define the universal set to be a bigger one, why? And why we just approximate and don't get exact or arbitrarily close to the answer?)&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-02-25T04:23:01.063" LastActivityDate="2019-02-25T10:25:41.170" Title="What's the point of quantum gates being 'continuous'?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5550" PostTypeId="2" ParentId="5545" CreationDate="2019-02-25T06:26:03.590" Score="5" Body="&lt;p&gt;No, no trick. You can’t prove it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to think about this is what if you had either the 1 state, or something that is arbitrarily close to the 1 state with a tiny amount of 0. You’re essentially asking if it’s possible to perfectly distinguish them. But if you could, you could copy them, and you’d have perfect cloning of a pair of non-orthogonal states, and that’s impossible.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-25T06:26:03.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5551" PostTypeId="2" ParentId="5547" CreationDate="2019-02-25T06:32:41.353" Score="7" Body="&lt;p&gt;We don’t use the terminology in the way you’re trying to use it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement is a property of states. For pure states shared between two parties, if they can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\otimes|\phi\rangle,&#xA;$$&lt;/span&gt;&#xA;they are &lt;em&gt;separable&lt;/em&gt;. If they are not separable, they are &lt;em&gt;entangled&lt;/em&gt;. Something like cnot is said to be “an entangling operation” meaning that when it acts on &lt;em&gt;some&lt;/em&gt; separable states (but not an arbitrary separable state), it can produce an entangled state vector. We only say that something &lt;em&gt;is entangled&lt;/em&gt; in reference to the state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, as you say cnot acting on a state such as &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; simply produces &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, and no entanglement is produced. But, cnot acting on &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)\otimes|1\rangle$&lt;/span&gt; produces &lt;span class=&quot;math-container&quot;&gt;$|01\rangle+|10\rangle$&lt;/span&gt;, which is entangled. Hence, cnot is capable of turning a separable state into an entangled state, so it is entangling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention that a matrix not being of the form &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; is necessary for it to be entangling but not sufficient. There are operations not of this form which are not entangling, such as swap.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-25T10:32:35.867" LastActivityDate="2019-02-25T10:32:35.867" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="5552" PostTypeId="2" ParentId="5545" CreationDate="2019-02-25T06:41:31.243" Score="3" Body="&lt;p&gt;I assume that you mean to say that initially we are not aware of the quantum state of the qubit. The answer to your question is then, No.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, the qubit was in some state &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;. Now, if by any way we are able to prove that &lt;span class=&quot;math-container&quot;&gt;$\alpha =0$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$\beta =0$&lt;/span&gt;, for that matter), &lt;i&gt; &lt;b&gt;with a single shot experiment&lt;/b&gt;&lt;/i&gt;, then in a sense we are able to 'know' the quantum state of the qubit and hence we can clone it. This is impossible.&lt;/p&gt;&#xA;" OwnerUserId="4954" LastEditorUserId="4954" LastEditDate="2019-02-25T06:49:50.423" LastActivityDate="2019-02-25T06:49:50.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5553" PostTypeId="2" ParentId="5549" CreationDate="2019-02-25T10:25:41.170" Score="2" Body="&lt;p&gt;It's not clear what the exact question is, but here is how I interpret it&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;States can be represented on the Bloch sphere, and unitary gates correspond to rotations in the Bloch sphere. Two rotations are enough to move from any point of a sphere to another point. So why is it not enough to consider two fixed gates instead of the whole continuous set of gates?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First of all, while it is true that &quot;two rotations&quot; with appropriate angles are enough to send a point to any other point on the sphere, even in this case you are still using a continuous set of rotation matrices to do it. Given a pair of initial and final points on the sphere, you can find two specific rotation matrices that send one into the other. Given an initial state, you will then need a continuum of rotation matrices to send that point to all other possible points on the sphere, as every output point will correspond to different rotation angles (even though the rotation axes might be fixed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So more precisely, given an initial state, you need a (continuous) family of rotations of the form &lt;span class=&quot;math-container&quot;&gt;$\{R_{\boldsymbol v}(\alpha)R_{\boldsymbol w}(\beta)\}_{\alpha,\beta\in\mathbb R}$&lt;/span&gt; to describe all possibilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This said, you don't want to describe how a specific initial state evolves, but rather how an operation acts on &lt;em&gt;each&lt;/em&gt; possible input. In other words, a gate is characterised by the way it transforms the &lt;em&gt;whole&lt;/em&gt; Bloch sphere, not just one point on it. As it turns out, in this case you need &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler_angles&quot; rel=&quot;nofollow noreferrer&quot;&gt;three consecutive rotations&lt;/a&gt; to describe arbitrary rotations.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-02-25T10:25:41.170" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5555" PostTypeId="2" ParentId="5534" CreationDate="2019-02-25T16:05:46.427" Score="2" Body="&lt;p&gt;As I understand the question, you're asking if it's possible to produce a transform that looks something like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha|000\rangle+\beta|010\rangle+\gamma|011\rangle\mapsto\frac{1}{\alpha}|000\rangle+\frac{1}{\beta}|010\rangle+\frac{1}{\gamma}|011\rangle&#xA;$$&lt;/span&gt;&#xA;up to normalisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without further knowledge, this is impossible. To see this, consider the problem where I give you either&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\qquad\text{or}\qquad \sqrt{1-\epsilon^2}|0\rangle+\epsilon|1\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is small. You don't know which I've given you, but you're tasked with transforming these two into&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\qquad\text{or}\qquad\sqrt{1-\epsilon^2}|1\rangle+\epsilon|0\rangle&#xA;$$&lt;/span&gt;&#xA;respectively.&#xA;In the case of small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, after the transformation you are almost guaranteed to be able to distinguish between which of the two you were given, which you certainly shouldn't be able to do given the starting position of two practically indistinguishable states. (This violates no-cloning bounds, and similar.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, your question mentioned that your state was the output of a Grover Search. In that specific context, you surely can. This is because Grover's Search lets you explore a particular space of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta|\psi_g\rangle+\sin\theta|\psi_b\rangle.&#xA;$$&lt;/span&gt;&#xA;So, at a particular point in the algorithm you've produced &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; terms (the &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; items you're searching for) with amplitudes &lt;span class=&quot;math-container&quot;&gt;$\cos\theta_0/\sqrt{M}$&lt;/span&gt;, and another &lt;span class=&quot;math-container&quot;&gt;$N-M$&lt;/span&gt; with amplitudes &lt;span class=&quot;math-container&quot;&gt;$\sin\theta_0/\sqrt{N-M}$&lt;/span&gt;. You just have to find a value of &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta_1=\frac{\tan\theta_0}{\sqrt{\tan^2\theta_0+(N/M-1)^2}}&#xA;$$&lt;/span&gt;&#xA;assuming you know &lt;span class=&quot;math-container&quot;&gt;$N,M,\theta_0$&lt;/span&gt;. Then you just use your Grover Search to produce that (or, at least, a good approximation. The larger &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, the better the approximation you can make.). Since the &quot;bad&quot; states now have greater amplitudes, this presumably takes less time than the search itself.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-25T16:05:46.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5557" PostTypeId="1" AcceptedAnswerId="5571" CreationDate="2019-02-25T23:08:11.537" Score="3" ViewCount="122" Body="&lt;p&gt;My Quantum circuit contains &lt;a href=&quot;https://qiskit.org/documentation/autodoc/qiskit.extensions.simulator.wait.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Wait&quot; Gate&lt;/a&gt;.  When I try to execute it (&lt;code&gt;qasm_simulator&lt;/code&gt; or &lt;code&gt;unitary-simulator&lt;/code&gt;), it throws an error . &lt;strong&gt;NotImplementedError: ('No decomposition rules defined for ', 'wait')&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&#xA;1.How to resolve the error?&#xA;2.What is the unit of &lt;code&gt;t&lt;/code&gt; specified in &quot;wait&quot; gate arguments?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dev Env&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anaconda (python 3.6)&#xA;qiskit 0.7.3&#xA;qiskit-aer 0.1.1&#xA;qiskit-terra 0.7.0&lt;/p&gt;&#xA;&#xA;&lt;p&gt;OS&#xA;Mac v10.14&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qiskit installation by &lt;code&gt;pip install qiskit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Minimal Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit.extensions.standard import RXGate, RYGate, RZGate, U3Gate&#xA;from qiskit.extensions.simulator import wait&#xA;&#xA;&#xA;from qiskit import execute, BasicAer, Aer&#xA;&#xA;qubit = QuantumRegister(1, 'qubit')&#xA;circuit = QuantumCircuit(qubit)&#xA;&#xA;circuit.x(qubit)&#xA;circuit.wait(1e-6, qubit)&#xA;circuit.rx(3.1416, qubit)&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;job = execute(circuit, backend)&#xA;result = job.result()&#xA;outputstate = result.get_statevector(circuit, decimals=3)&#xA;print(outputstate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I comment the line &lt;code&gt;circuit.wait(...)&lt;/code&gt; it runs fine. I tried the &lt;code&gt;qasm_simulator&lt;/code&gt; with counts/measurements (same error)&lt;/p&gt;&#xA;" OwnerUserId="5900" LastEditorUserId="5900" LastEditDate="2019-02-27T00:10:37.517" LastActivityDate="2019-02-27T22:08:33.973" Title="&quot;Wait&quot; gate throws an error &quot;NotImplementedError: ('No decomposition rules defined for ', 'wait')&quot;" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5559" PostTypeId="2" ParentId="5480" CreationDate="2019-02-26T08:24:06.650" Score="1" Body="&lt;p&gt;The control qubits are only added to the command after it is received by the &lt;code&gt;ControlEngine&lt;/code&gt; further down the chain after the &lt;code&gt;MainEngine&lt;/code&gt;. For implementation details see &quot;3.2.1 Implementation of meta instructions&quot; &lt;a href=&quot;https://doi.org/10.3929/ethz-b-000322770&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement a testing engine such as this one, that can be used to check that indeed control qubits are added right after the &lt;code&gt;MainEngine&lt;/code&gt;, you could do the following:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;test_eng = Testing(BasicEngine) # Or CommandPrinter&#xA;eng = projectq.MainEngine(engine_list=[test_eng])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5791" LastActivityDate="2019-02-26T08:24:06.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5560" PostTypeId="1" CreationDate="2019-02-26T13:57:24.847" Score="1" ViewCount="87" Body="&lt;p&gt;As part of a course, I've been asked to write a map &lt;span class=&quot;math-container&quot;&gt;$C\rightarrow H,z \rightarrow zv$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$v \in H=C^3\otimes C^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$v=[1, 0, 0, 1, 0, 1]$&lt;/span&gt; in bra-ket notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I never written such a map before, and must have missed the lecture. I would very much appreciate if someone show me some example of how to write this kind of thing.&lt;/p&gt;&#xA;" OwnerUserId="5893" LastEditorUserId="55" LastEditDate="2019-09-10T15:44:10.653" LastActivityDate="2019-09-10T15:44:10.653" Title="How to write the map $\mathbb C\ni z\mapsto zv$ in bra-ket notation?" Tags="&lt;mathematics&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5561" PostTypeId="2" ParentId="5539" CreationDate="2019-02-27T02:04:24.230" Score="1" Body="&lt;p&gt;A photon can be thought of as a tiny piece of a circularly polarized wave. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this sense, all polarization states of EM waves are a superposition of photons, each with a circular (left or right) polarization. Linearly polarized light could then be constructed as a pair of photons with left and right polarization (or spin). Maybe your question is whether the Jones matrix for a linear polarizer can be represented as a spin operator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this is what you where asking.&lt;/p&gt;&#xA;" OwnerUserId="5912" LastEditorUserId="5912" LastEditDate="2019-02-28T01:18:04.737" LastActivityDate="2019-02-28T01:18:04.737" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5562" PostTypeId="1" AcceptedAnswerId="5563" CreationDate="2019-02-27T07:02:28.707" Score="2" ViewCount="491" Body="&lt;p&gt;I've been beating my head against this problem for three days now and I just can't seem to crack it. To construct an N-qubit controlled Unitary gate, I can do something like this (note I'm using Qiskit syntax here):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q_upper = QuantumRegister(n - 1)&#xA;q_lower = QuantumRegister(1)&#xA;q_out = QuantumRegister(1)&#xA;circ = QuantumCircuit(q_upper, q_lower, q_out)&#xA;&#xA;# Setup u on the output line: |((1 &amp;lt;&amp;lt; (n - 1)) - 1) 01&amp;gt; * u/2, |n0 11&amp;gt; * u/2, |((1 &amp;lt;&amp;lt; n) - 1) 1&amp;gt; * u&#xA;circ.cnv(q_upper, q_out)&#xA;circ.cv(q_lower, q_out)&#xA;&#xA;# Cancel out the terms that aren't all ones&#xA;circ.cnx(q_upper, q_lower)&#xA;circ.vdg(q_lower, q_out)&#xA;circ.cnx(q_upper, q_lower)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This circuit requires a little explanation. Here, I'm attempting to build an n-qubit u-gate using an (n-1)-qubit controlled v-gate (which will be half the rotation of u) and a a controlled v-gate. Then I use an (n-1)-qubit controlled x-gate in conjunction with another controlled v-gate to cancel out the terms that aren't all one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example of the implementation, consider the Controlled-S (CS) gate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q_lower = QuantumRegister(1)&#xA;q_out = QuantumRegister(1)&#xA;circ = QuantumCircuit(q_lower, q_out)&#xA;&#xA;# Add a pi/2 rotation for 11, pi/4 for 01 and 10&#xA;circ.t(q_lower)&#xA;circ.t(q_out)&#xA;&#xA;# Cancel out the pi/4 for 01 and 10&#xA;circ.cx(q_lower, q_out)&#xA;circ.tdg(q_out)&#xA;circ.cx(q_lower, q_out)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can expand on this to produce a Toffoli-S (CCS) gate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q_upper = QuantumRegister(1)&#xA;q_lower = QuantumRegister(1)&#xA;q_out = QuantumRegister(1)&#xA;circ = QuantumCircuit(q_upper, q_lower, q_out)&#xA;&#xA;# Construct a pi/2 rotation for 111 and pi/4 rotations for 011 and 101&#xA;circ.cu1(pi / 4, q_upper, q_out)&#xA;circ.cu1(pi / 4, q_lower, q_out)&#xA;&#xA;# Cancel out the pi/4 rotations on 011 and 101&#xA;circ.cx(q_upper, q_lower)&#xA;circ.cu1(pi / -4, q_lower, q_out)&#xA;circ.cx(q_upper, q_lower)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can expand it again to produce a CCCS gate:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q_upper = QuantumRegister(2)&#xA;q_lower = QuantumRegister(1)&#xA;q_out = QuantumRegister(1)&#xA;circ = QuantumCircuit(q_upper, q_lower, q_out)&#xA;&#xA;# Construct a pi/2 rotation for 1111 and pi/4 rotations for 1101 and 0011&#xA;circ.ccu1(pi / 4, q_upper[0], q_upper[1], q_out[0])&#xA;circ.cu1(pi / 4, q_lower, q_out)&#xA;&#xA;# Cancel out the pi/4 rotations for 1101 and 0011&#xA;circ.ccx(q_upper[0], q_upper[1], q_lower[0])&#xA;circ.cu1(pi / -4, q_lower, q_out)&#xA;circ.ccx(q_upper[0], q_upper[1], q_lower[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, this circuit presents a problem: there is no &lt;code&gt;ccu1&lt;/code&gt; gate. Now, I could construct one that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circ.cu1(pi / 8, q_upper[0], q_out)&#xA;circ.cu1(pi / 8, q_upper[1], q_out)&#xA;circ.cx(q_upper[0], q_upper[1])&#xA;circ.cu1(pi / -8, q_upper[1], q_out)&#xA;circ.cx(q_upper[0], q_upper[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But this means that an N-qubit Controlled-S gate would require an (N-1)-qubit Controlled-T gate which would require an (N-2)-qubit Controlled &lt;code&gt;pi / 8&lt;/code&gt; gate and so on and so forth, resulting in increasingly small rotations. Given the current state of quantum hardware (and probably the future of quantum hardware), this implementation doesn't seem practical but I haven't been able to find a better one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone suggest a way to break this recursion at either the S-gate or T-gate level or will I have to just deal with the recursion?&lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="26" LastEditDate="2019-03-12T09:13:39.087" LastActivityDate="2019-03-12T09:13:39.087" Title="Building an N-qubit Controlled S Gate" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5563" PostTypeId="2" ParentId="5562" CreationDate="2019-02-27T07:42:11.523" Score="4" Body="&lt;p&gt;The angles getting smaller is not a problem. The actual problem is that you are generating a ton of gates. To produce one gate with N controls, you're recursing on the producing of 3 gates with N-1 controls. Follow the logic to the end, and you'll see that you end up with &lt;span class=&quot;math-container&quot;&gt;$3^N$&lt;/span&gt; gates!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to reduce the number of gates from exponential to linear. In the ideal case, you have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; ancillae available and can use Toffoli gates to compute the AND of your control qubits. You apply the S gate to the qubit storing the AND, then uncompute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c6GHX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c6GHX.png&quot; alt=&quot;simple CCCCS&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't have any workspace, &lt;a href=&quot;https://algassert.com/circuits/2015/06/22/Using-Quantum-Gates-instead-of-Ancilla-Bits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;it gets a lot more complicated. You have to do stuff like this&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0mRzo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0mRzo.png&quot; alt=&quot;decompose Toffoli&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TDFKU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TDFKU.png&quot; alt=&quot;free up an ancilla&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-27T07:42:11.523" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5564" PostTypeId="1" AcceptedAnswerId="5565" CreationDate="2019-02-27T09:23:21.687" Score="4" ViewCount="91" Body="&lt;p&gt;The state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2}\left(| \phi^+ \rangle \langle \phi^+ | + | \psi^+ \rangle \langle \psi^+ | \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | \phi^+ \rangle = \frac{1}{\sqrt2} \left(|00 \rangle + | 11 \rangle \right) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | \psi^+ \rangle = \frac{1}{\sqrt2} \left(|01 \rangle + | 10 \rangle \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By PPT criteria, we know this is a separable state. If I wanted to find what is the mixture of separable states that form this, how would I go about it?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-03-01T21:57:12.367" Title="Convex Combination of Separable States" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5565" PostTypeId="2" ParentId="5564" CreationDate="2019-02-27T09:30:09.607" Score="3" Body="&lt;p&gt;I would start by writing this as a matrix, and recognising how it can be written in terms of Pauli matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac14\left(\begin{array}{cccc} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{array}\right)=\frac14(\mathbb{I}\otimes\mathbb{I}+X\otimes X)&#xA;$$&lt;/span&gt;&#xA;From here, I don't have a completely formulaic approach for how you do it. But, in this instance, I wrote&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\frac{1}{2}\left(\frac{\mathbb{I}+X}{2}\otimes \frac{\mathbb{I}+X}{2}+\frac{\mathbb{I}-X}{2}\otimes \frac{\mathbb{I}-X}{2}\right).&#xA;$$&lt;/span&gt;&#xA;Now you can see that each of the terms in the tensor product is a separable state. Specifically,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|++\rangle\langle ++|+|--\rangle\langle --|)/2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One approach that I suppose I might have taken is to recognise the separable, diagonal basis of &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt;, and decompose &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}\otimes\mathbb{I}$&lt;/span&gt; in the same basis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{4}(|++\rangle\langle ++|+|+-\rangle\langle +-|+|-+\rangle\langle -+|+|--\rangle\langle --|)+\frac{1}{4}(|++\rangle\langle ++|-|+-\rangle\langle +-|-|-+\rangle\langle -+|+|--\rangle\langle --|),&#xA;$$&lt;/span&gt;&#xA;which inevitably leads to that result.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-02-27T11:06:32.273" LastActivityDate="2019-02-27T11:06:32.273" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5566" PostTypeId="1" AcceptedAnswerId="5568" CreationDate="2019-02-27T13:15:56.127" Score="4" ViewCount="328" Body="&lt;p&gt;I've seen in google cirq that a &lt;span class=&quot;math-container&quot;&gt;$X^q$&lt;/span&gt; gate is converted in openqasm to &lt;span class=&quot;math-container&quot;&gt;$RX(\pi q)$&lt;/span&gt;, why is that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same for &lt;span class=&quot;math-container&quot;&gt;$S^q$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$RZ(\pi q/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5791" LastEditorUserId="26" LastEditDate="2019-02-27T13:30:34.090" LastActivityDate="2019-02-27T21:47:23.910" Title="How is $X^q$ equal to $RX(\pi q)$?" Tags="&lt;quantum-gate&gt;&lt;cirq&gt;&lt;qasm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5567" PostTypeId="1" CreationDate="2019-02-27T16:34:09.700" Score="16" ViewCount="1210" Body="&lt;p&gt;I would like to know how to design a quantum circuit that given a Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$\hat{H}$&lt;/span&gt; and time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, maps &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$e^{i\hat{H}t} |\psi\rangle$&lt;/span&gt;.&#xA;Thank you for your answer.&lt;/p&gt;&#xA;" OwnerUserId="5569" LastEditorUserId="26" LastEditDate="2019-02-28T06:13:13.780" LastActivityDate="2020-07-01T17:34:11.353" Title="Circuit construction for Hamiltonian simulation" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5568" PostTypeId="2" ParentId="5566" CreationDate="2019-02-27T17:38:32.577" Score="2" Body="&lt;p&gt;Note that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$RX(\phi) = \begin{pmatrix} \cos(\phi/2) &amp;amp; -i\sin(\phi/2) \\-isin(\phi/2) &amp;amp; \cos(\phi/2)\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$$RX(\pi q) = \begin{pmatrix} \cos(\pi q/2) &amp;amp; -i\sin(\pi q/2) \\-isin(\pi q/2) &amp;amp; \cos(\pi q/2)\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, using that &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi k + \pi/2) = 0 = \sin(\pi k)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi k) = 1 = \sin(\pi k + \pi/2)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k\in \mathbb{Z}$&lt;/span&gt; and that a global phase does not physically affect the quantum state, we see that for odd &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and for even &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; we get the identity matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can prove the other equation similarly using&#xA;&lt;span class=&quot;math-container&quot;&gt;$$RZ(\phi) = \begin{pmatrix} e^{-\phi/2} &amp;amp; 0  \\ 0 &amp;amp; e^{\phi/2} \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-02-27T17:38:32.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5569" PostTypeId="2" ParentId="5566" CreationDate="2019-02-27T18:05:15.390" Score="4" Body="&lt;p&gt;This is the matrix for &lt;span class=&quot;math-container&quot;&gt;$Z^t$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Z^t = \begin{bmatrix}&#xA;1&amp;amp;0\\0&amp;amp;(-1)^t&#xA;\end{bmatrix} = \begin{bmatrix}&#xA;1&amp;amp;0\\0&amp;amp;e^{i \pi t}&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the matrix for &lt;span class=&quot;math-container&quot;&gt;$R_Z(\pi t)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_Z(\pi t) = e^{-iZt/2} = \begin{bmatrix}&#xA;e^{-i \pi t / 2}&amp;amp;0\\0&amp;amp;e^{+i \pi t / 2}&#xA;\end{bmatrix} = e^{-i \pi t/2} Z^t&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Z^t \equiv R_Z(\pi t) \pmod{\text{global phase}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qiskit doesn't have a concept like &lt;span class=&quot;math-container&quot;&gt;$Z^t$&lt;/span&gt;, but it does have &lt;span class=&quot;math-container&quot;&gt;$R_Z$&lt;/span&gt;, so Cirq relies on this equality-up-to-global-phase and converts from one to the other when producing QASM. The exact same situation repeats with powers of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-02-27T21:47:23.910" LastActivityDate="2019-02-27T21:47:23.910" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5570" PostTypeId="1" AcceptedAnswerId="5572" CreationDate="2019-02-27T20:10:06.870" Score="4" ViewCount="560" Body="&lt;p&gt;I was recently reading through the tutorial on the Cirq documentation about creating variational quantum algorithms, and I came to the section on ansatz preparation. The way that the ansatz is constructed in the tutorial is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply an XPowGate for the same parameter for all qubits. This is the method we have written above.&lt;/li&gt;&#xA;&lt;li&gt;Apply a ZPowGate for the same parameter for all qubits where the transverse field term h is +1.&lt;/li&gt;&#xA;&lt;li&gt;Apply a CZPowGate for the same parameter between all qubits where the coupling field term J is +1. If the field is -1 apply CZPowGate conjugated by X gates on all qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, I know that there is no single, consistent way to construct an ansatz, but I was wondering, how exactly was this ansatz arrived at, and how do we know that it is correct? The reason I ask this is because I was curious, and I changed the ZPow gate to an XPow gate, and got radically different results for the minimized energy.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2019-04-14T19:26:47.253" Title="Creating an ansatz for variational quantum algorithms?" Tags="&lt;algorithm&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5571" PostTypeId="2" ParentId="5557" CreationDate="2019-02-27T22:08:33.973" Score="1" Body="&lt;p&gt;The &lt;code&gt;wait&lt;/code&gt; command has now been deprecated, which is probably why it's causing you problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead you can use the identity gate &lt;code&gt;iden&lt;/code&gt;. You should also use barriers either side so that the compiler doesn't remove it.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.x(qubit)&#xA;circuit.barrier(qubit)&#xA;circuit.iden(qubit)&#xA;circuit.barrier(qubit)&#xA;circuit.rx(3.1416, qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This causes a delay for a the same time as a single &lt;code&gt;u2&lt;/code&gt; gate, which is the time needed for a single &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;-pulse (see &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-02-27T22:08:33.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5572" PostTypeId="2" ParentId="5570" CreationDate="2019-02-28T01:44:07.723" Score="7" Body="&lt;p&gt;Take a look again at the Hamiltonian, which is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \sum_{\langle i, j \rangle} J_{i j} Z_i Z_j + \sum_{i} h_i Z_i&#xA;$$&lt;/span&gt;&#xA;Then notice that ZPowGate is generated by the the Pauli Z operator, and CZPowGate is equivalent to an operator generated by &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt; up to single-qubit rotations. The idea is that Step 2 of the ansatz corresponds to applying a pulse generated by the term on the right-hand side, and Step 3 corresponds to applying a pulse generated by the term on the left-hand side. Applying pulse sequences generated by terms of the Hamiltonian of interest is a common motivation for ansatz choice (see &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1509.04279&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, or &lt;a href=&quot;https://arxiv.org/abs/1607.06473&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; for papers that use this principle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1 of the ansatz is included as a gate generated by a term which does not commute with the other terms. Without such a gate, multiple steps of the ansatz could just be collapsed together and the ansatz would not be very interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative view of why it makes sense to include Step 1, and this kind of ansatz more generally, is explained in Section VI of the &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;noreferrer&quot;&gt;QAOA paper&lt;/a&gt;. The idea is motivated by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0001106&quot; rel=&quot;noreferrer&quot;&gt;quantum computation by adiabatic evolution&lt;/a&gt;. In such a computation, one prepares the ground state of an easy Hamiltonian, which in this case would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B = \sum_{i} X_i&#xA;$$&lt;/span&gt;&#xA;and evolve under the time-dependent Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G(t) = (1 - \frac{t}{T} B) + \frac{t}{T} H&#xA;$$&lt;/span&gt;&#xA;for some total evolution time &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;. It turns out that a large enough evolution time &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; will guarantee that the system ends up in the ground state of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. If you discretize this time evolution, you will get a bunch of time-steps which are like the ansatz: each time step has a gate generated by X on each qubit, and then gates generated by terms of the Hamiltonian. The idea then is to fix the number of time steps and then take the angles of the individual gates to be variational parameters. For a large enough number of ansatz steps, there will certainly be some choice of angles that gives the ground state, but the hope is that a small number of ansatz steps will suffice.&lt;/p&gt;&#xA;" OwnerUserId="5919" LastEditorUserId="5919" LastEditDate="2019-02-28T01:54:29.113" LastActivityDate="2019-02-28T01:54:29.113" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5573" PostTypeId="1" AcceptedAnswerId="5575" CreationDate="2019-02-28T02:26:09.753" Score="2" ViewCount="157" Body="&lt;p&gt;One of the postulates of QC is, that measurements in every circuit can be postponed or never performed in a circuit while achieving the same functionality of the circuit (at least this the way I understand it).&#xA;Given this, why does Alice have to do any measurement at all? Isn't a much better / simpler circuit is, not sending any classical / quantum information to Bob &lt;em&gt;at all&lt;/em&gt; and nevertheless Bob can achieve the original vector state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the point at all of sending any classical bits?&#xA;I mean, imagine today I show you an option that we can communicate with other without a need of sending anything at all (provided we got some prior entangled qubit), just by working remotely, isn't it much better? Than requiring the transformation of either qubits or bits. &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-02-28T05:39:08.973" LastActivityDate="2019-02-28T19:27:13.643" Title="Why is measurement needed in teleportation?" Tags="&lt;measurement&gt;&lt;communication&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5574" PostTypeId="1" AcceptedAnswerId="5584" CreationDate="2019-02-28T03:34:16.083" Score="3" ViewCount="1043" Body="&lt;p&gt;The Bloch sphere isn't so intuitive for me.  But I am not sure how you are supposed to manipulate it using vectors and matrices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do you actually represent a vector on it? Is it &#xA;&lt;span class=&quot;math-container&quot;&gt;$(\cos(a) , e^i\sin(b))$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(\alpha, \theta)$&lt;/span&gt;  or &lt;span class=&quot;math-container&quot;&gt;$(1,0)$&lt;/span&gt;&#xA;In which format do we work with? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On one hand why we would use &lt;span class=&quot;math-container&quot;&gt;$(\cos(a), e^i\sin(b))$&lt;/span&gt; if we can simply use &lt;span class=&quot;math-container&quot;&gt;$(\alpha, \theta)$&lt;/span&gt; which covers the whole sphere. So what do we use?  I saw  &lt;span class=&quot;math-container&quot;&gt;$(\cos(a), e^i\sin(b))$&lt;/span&gt; mentioned but I don't understand then, why do we all the time manipulate vectors like &lt;span class=&quot;math-container&quot;&gt;$|1\rangle, |0\rangle$&lt;/span&gt;?  Is the idea that &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, for example, is just &lt;span class=&quot;math-container&quot;&gt;$\cos a$&lt;/span&gt;?  But what is then the basis? &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(\cos(a) , e^i\sin(b))$&lt;/span&gt;? What do we manipulate using gates and matrices? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't understand how do &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(\cos(a), e^i\sin(b))$&lt;/span&gt; go together physically in the Bloch sphere itself. I mean, what does &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; mean? Is it really the vector vertical with &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt;? Then how would that be represented by &lt;span class=&quot;math-container&quot;&gt;$(\cos(a) , e^i\sin(b))$&lt;/span&gt;?  What would the angle values be for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle $&lt;/span&gt;? I guess a is zero and the &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is free.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third question is, using the rotational matrices, I understand them only if we use vectors like &lt;span class=&quot;math-container&quot;&gt;$(1,0), (0,1)$&lt;/span&gt; and the like because then it's easy to see how &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; is simply a rotation acting on both  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; is the regular two dimensional rotation, and &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; is simply a rotation like the previous one but also taking into account imaginary of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. But if we use something like &lt;span class=&quot;math-container&quot;&gt;$(\cos(a), e^i\sin(b))$&lt;/span&gt; or&#xA;&lt;span class=&quot;math-container&quot;&gt;$(\alpha, \theta)$&lt;/span&gt;  as vectors, I wasn't able to see how &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; rotate. Maybe the claim is, that &lt;span class=&quot;math-container&quot;&gt;$1,0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0,1$&lt;/span&gt; are valid basis vectors so could be used to manipulate even if we use &lt;span class=&quot;math-container&quot;&gt;$(\cos(a), e^i\sin(b))$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(\alpha, \theta)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="55" LastEditDate="2019-10-03T14:22:33.290" LastActivityDate="2019-10-03T14:22:33.290" Title="What's a vector in the Bloch sphere representation?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5575" PostTypeId="2" ParentId="5573" CreationDate="2019-02-28T07:12:17.497" Score="3" Body="&lt;p&gt;To answer this, contrast quantum teleportation with the &lt;a href=&quot;http://demonstrations.wolfram.com/SwappingQubitStates/&quot; rel=&quot;nofollow noreferrer&quot;&gt;swap gate&lt;/a&gt;. Ignoring everything in the middle, the effect of quantum teleportation is to get from state &lt;span class=&quot;math-container&quot;&gt;$|\phi00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|00\phi\rangle$&lt;/span&gt;. This can obviously be accomplished with a simple application of the swap gate. So, why do we care about quantum teleportation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd never run the quantum teleportation protocol on a single quantum computer, except as an academic exercise. Quantum teleportation is a way of getting from &lt;span class=&quot;math-container&quot;&gt;$|\phi00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|00\phi\rangle$&lt;/span&gt; when the first two qbits exist on one quantum computer, and the third exists on another. Any communication between the computers is classical, and all operations are local to the qbits on that computer (except for the initial process of entangling the qbits). Given these restrictions, quantum teleportation is the simplest protocol to get from &lt;span class=&quot;math-container&quot;&gt;$|\phi00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|00\phi\rangle$&lt;/span&gt;. It enables us to transmit a qbit state with perfect fidelity using just two bits of classical information.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-02-28T19:27:13.643" LastActivityDate="2019-02-28T19:27:13.643" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5576" PostTypeId="1" AcceptedAnswerId="5577" CreationDate="2019-02-28T07:25:33.967" Score="3" ViewCount="174" Body="&lt;p&gt;The Bloch sphere is a mainstay of introductions to quantum computing, but what utility does it actually provide? It can't usefully represent multiple qbits because of entanglement and requires a weird transformation to map to &amp;amp; from a state vector. Sure it's a visual representation but I've never seen it actually assist anyone's acquisition of the material. Is it just a holdover from earlier days of the field and the reason why we'll be calling Rx/Ry/Rz with doubled theta values until the stars die out?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-02-28T10:14:56.733" Title="What utility is provided by the Bloch sphere visualization?" Tags="&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5577" PostTypeId="2" ParentId="5576" CreationDate="2019-02-28T10:14:56.733" Score="5" Body="&lt;p&gt;Some people really do visualise single qubit operations by thinking about the Bloch sphere, and they work out everything based on that picture. Those who like thinking in that way are often incredibly quick at these sorts of manipulations, and have more intuitive understandings for why things work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here's one concrete example where I use it: averaging over single qubit states. Let's say I've implemented some quantum operation on a single qubit state, and I want to compare it to the ideal, so perhaps I calculate a fidelity. (For instance, I might be trying to implement optimal cloning.) Perhaps that fidelity varies depending on what the input state is, and so I want to calculate the average fidelity. How do I average over all possible single-qubit states? It's the same as integrating over the surface of the Bloch sphere, and that conversion helps me to get the correct volume element, with the correct factors of 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, I &lt;em&gt;could&lt;/em&gt; memorise that function, just as everything that can be done with the Bloch sphere can be done another way. Personally, I don't &lt;em&gt;usually&lt;/em&gt; use the Bloch sphere, but this is the most obvious instance where I have stuck with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other topics where I believe the Bloch sphere is particularly natural. For example, in the topic of magic states - single-qubit states that when combined with Clifford operations provide universal, fault-tolerant quantum computation. There's a lovely convexity argument that eliminates a particular geometric region of the Bloch sphere from consideration, and I think various subsequent results describe regions of the Bloch sphere that either can or can't act as magic states.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-02-28T10:14:56.733" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5578" PostTypeId="2" ParentId="5573" CreationDate="2019-02-28T14:53:15.603" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;measurements in every circuit can be postponed or never performed in a circuit while achieving the same functionality of the circuit&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's correct. But if the circuit involves two parties, this process will introduce quantum operations between the two parties. It will require a quantum communication channel, so that the qubits can be shuttled back and forth as needed in order to perform these operations.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Isn't a much better / simpler circuit is, not sending any classical / quantum information to Bob at all and nevertheless Bob can achieve the original vector state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You're sending information either way. Teleportation allows you to send the quantum information at leisure ahead of time (while establishing entanglement), and then in the heat of the moment when time is sensitive you can use cheaper/faster/better classical communication instead of having to deal with expensive/brittle/slow quantum communication.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-02-28T14:53:15.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5579" PostTypeId="1" CreationDate="2019-02-28T14:59:10.767" Score="3" ViewCount="123" Body="&lt;p&gt;I understand how to apply UCC to a problem formulated in a second-quantized (fermion) form: you start with some state and then create a unitary operator out of single-body (or double-, triple- and so on) excitations, and then variationally find the best coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T = T^{(1)} + T^{(2)} + \dots \\&#xA;T^{(1)} = \sum c_i a_i^\dagger,  T^{(2)} = \sum c_{ij} a_i^\dagger a_j^\dagger\\&#xA;\Psi = e^{T - T^\dagger} \Psi_0.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement a variational quantum eigensolver (VQE) using this ansatz, you need to apply the Jordan-Wigner or Bravyi-Kitaev transformation to the Hamiltonian and all of the excitation operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what if you start with a Hamiltonian written in spin form already? Do you first transform the Hamiltonian into the second-quantized form and then back? Or do you do something simpler instead? I remember seeing an ansatz simply consisting of the single-qubit and double-qubit Pauli rotations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \exp(i(\theta_1 X_1 + \theta_2 X_2 + \dots + \theta_k X_i Z_j + \dots)).&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can't find any reference to that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any hints to the literature would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2019-02-28T14:59:10.767" Title="How to apply unitary coupled cluster to a spin problem?" Tags="&lt;algorithm&gt;&lt;chemistry&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5580" PostTypeId="1" AcceptedAnswerId="5581" CreationDate="2019-03-01T07:03:38.450" Score="4" ViewCount="134" Body="&lt;p&gt;Just like we have the PPT, NPT criteria for checking if states can be written in tensor form or not, is there any criteria, given the matrix of a unitary acting on 2 qubits, to check if it is local or global (can be factored or not)?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2019-03-03T08:25:57.213" LastActivityDate="2019-03-03T08:25:57.213" Title="Differentiate between local and global unitaries" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5581" PostTypeId="2" ParentId="5580" CreationDate="2019-03-01T08:56:39.077" Score="6" Body="&lt;p&gt;This is actually a much easier problem. In the case of states, you're trying to use the PPT criterion, or others, to distinguish if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_ip_i\sigma^A_i\otimes\sigma^B_i,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sum_ip_i=1$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$\sigma^A_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma^B_i$&lt;/span&gt; are valid states on single sites. The difficulty actually comes from the freedom that the summation over &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; provides.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of unitaries (or more general operations), you're only trying to ascertain if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=U^A\otimes U^B&#xA;$$&lt;/span&gt;&#xA;or not. This is something that you can do very mechanically. For example, if we make matrices&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{k,l}U_{ik,jl}|k\rangle\langle l|,&#xA;$$&lt;/span&gt;&#xA;then each of these ought to be of the form &lt;span class=&quot;math-container&quot;&gt;$U^A_{ij}U^B$&lt;/span&gt;, in other words, the same up to a constant. If they're not, it's not of tensor product form.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-01T08:56:39.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5582" PostTypeId="2" ParentId="5520" CreationDate="2019-03-01T09:12:26.193" Score="3" Body="&lt;p&gt;... and the question changes again. Re Update 4:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure what you &lt;em&gt;intended&lt;/em&gt; the variable &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; to be in the question (I think part of the problem is that you've got muddled between the chosen questions and the given answers), but I have used it very carefully, to always be the &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; answer given. In a quantum setting, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the &lt;em&gt;answer&lt;/em&gt;, a value &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; when Alice's qubit is measured in a particular basis (this basis is the 22.5 degrees you're talking about). A projective measurement on a qubit always gives you one of two answers which you can choose to label as &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; no matter what the basis of that measurement is.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The question has entirely changed from previous versions (i.e. should &lt;em&gt;really&lt;/em&gt; be a new question). Please find old responses below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bell and CHSH inequalities are nothing to do with detectors, measurement angles etc, because those are all things associated with a quantum experiment. These tests are nothing directly to do with a quantum experiment, requiring knowledge of experimental details. Instead, they are more generic than that and, in particular, tell us what properties the answers have to have if the world is classical. This is about proving that the world is &lt;em&gt;not classical&lt;/em&gt; as opposed to proving that it &lt;em&gt;is quantum&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a single run of an experiment, there are two boxes. On each box, you can choose one of two settings, and you get an answer &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;. If Alice (first box) chose setting 1, she would record her answer in the random variable &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. If she chose setting 2, she records her answer in random variable &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. Similarly, Bob uses random variables &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; to record the answers from &lt;em&gt;his&lt;/em&gt; box corresponding to his choice of setting. We can also calculate the correlations so, if both choose to measure setting 1, we'd have the value &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; being the product of the two answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we run this many times, we build up expectation values for each of these entities, eventually giving us things like &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt;. Then we can evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=E(a,b)−E(a,d)+E(c,b)+E(c,d).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we &lt;em&gt;assume&lt;/em&gt; that for each run of the experiment, all 4 of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; have a value (even though we don't see all of them on a single run), then on each run &lt;span class=&quot;math-container&quot;&gt;$a(b-d)+c(b+d)$&lt;/span&gt; is a value &lt;span class=&quot;math-container&quot;&gt;$\pm 2$&lt;/span&gt;, and hence &lt;span class=&quot;math-container&quot;&gt;$\langle S\rangle\leq 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we can do a quantum experiment. You don't actually need to know the details of the experiment, they can entirely be hidden away inside these boxes which act based on the questions asked, and give &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; outputs. You do this, and find &lt;span class=&quot;math-container&quot;&gt;$\langle S\rangle=2\sqrt{2}$&lt;/span&gt;, and that proves that the assumption must be invalid. The 4 values are not predetermined, they must be chosen at random at the moment the question is asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that philosophy out of the way, then you can get stuck into doing the actual quantum calculation, choosing an entangled state and measurement bases of particular angles (these do not need to be variables) and verifying that the &lt;span class=&quot;math-container&quot;&gt;$2\sqrt{2}$&lt;/span&gt; answer should indeed come out.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Previous responses:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've sort of answered your own question. You've stated that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=E_1-E_2+E_3+E_4&#xA;$$&lt;/span&gt;&#xA;and then you've asked whether&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=E_1E_2-E_1E_4+E_3E_2+E_3E_4.&#xA;$$&lt;/span&gt;&#xA;No, it's what you stated it was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You then take the values of &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\pm1/\sqrt{2}$&lt;/span&gt;. The only problem you have is that you've put the minus sign on the wrong one:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_1=E_3=E_4=\frac1{\sqrt{2}}\qquad E_2=-\frac1{\sqrt{2}}&#xA;$$&lt;/span&gt;&#xA;Subbing these in to your original statement about &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, you simply get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=\frac4{\sqrt{2}}=2\sqrt{2},&#xA;$$&lt;/span&gt;&#xA;as you'd expect for the quantum calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For concreteness, let's be clear about the conversion: &lt;span class=&quot;math-container&quot;&gt;$P(a,b)$&lt;/span&gt; is the probability of getting answers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; the same, while &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; is the correlation coefficient between answers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_1=P(a,b)-(1-P(a,b))=2(P(a,b)-1).&#xA;$$&lt;/span&gt;&#xA;Hence, if we start from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(a,b)-P(a,d)+P(c,b)+P(c,d)\leq2,&#xA;$$&lt;/span&gt;&#xA;then we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(E_1/2+1/2)-(E_2/2+1/2)+(E_3/2+1/2)+(E_4/2+1/2)\leq 2,&#xA;$$&lt;/span&gt;&#xA;which is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12(E_1-E_2+E_3+E_4)\leq1,&#xA;$$&lt;/span&gt;&#xA;or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_1-E_2+E_3+E_4\leq2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a final note, please observe that you cannot call both&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_1=P(a,b)-P(a,d)+P(c,b)+P(c,d)&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_2=E_1-E_2+E_3+E_4&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; because they are actually different quantities (&lt;span class=&quot;math-container&quot;&gt;$2S_1-2=S_2$&lt;/span&gt;). It just happens that both definitions coincide when they have value 2. I think that conventionally you'd call &lt;span class=&quot;math-container&quot;&gt;$S_2$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$S_1$&lt;/span&gt; is often called &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-03-18T08:26:40.600" LastActivityDate="2019-03-18T08:26:40.600" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5583" PostTypeId="2" ParentId="5560" CreationDate="2019-03-01T09:28:42.307" Score="2" Body="&lt;p&gt;This map takes a complex number and returns a ket vector. In your case, this would simply mean writing &lt;span class=&quot;math-container&quot;&gt;$f(z) = z | v \rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe a part of the exercise is to decipher &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;, then I would also expand it in ket notation: &lt;span class=&quot;math-container&quot;&gt;$| v \rangle = |0 \rangle \otimes |0 \rangle + |1\rangle \otimes |0 \rangle + |2\rangle \otimes |1 \rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is somewhat tricky at first to think about vectors as maps from complex numbers to the vector space. If you want to describe a linear map &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C} \rightarrow H$&lt;/span&gt;, then it's sufficient to specify &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt;, which is &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2019-03-01T09:28:42.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5584" PostTypeId="2" ParentId="5574" CreationDate="2019-03-01T13:08:01.250" Score="5" Body="&lt;p&gt;The components of the Bloch vector of a state are the expectation values of the X,Y and Z Pauli matrices in that state and it has to be a full three-dimensional vector to capture the interior of the Bloch sphere as well, which represents mixed states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general a state with density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of a single Qbit has Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt; when&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac12(I+\vec r \cdot\vec\sigma)  = \frac12(I+r_x\hat\sigma_x+r_y\hat\sigma_y+r_z\hat\sigma_z)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vec\sigma$&lt;/span&gt; is a vector containing the three Pauli matrices and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix.&#xA;Looking at pure states for example the vector &lt;span class=&quot;math-container&quot;&gt;$(0,0,1)$&lt;/span&gt; leads to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac12(I+1\cdot\sigma_z) = \frac12\left(\begin{matrix}1 &amp;amp;0\\0 &amp;amp;1\end{matrix}\right) + \frac12\left(\begin{matrix}1 &amp;amp;0\\0 &amp;amp;-1\end{matrix}\right) = \left(\begin{matrix}1 &amp;amp;0\\0 &amp;amp;0\end{matrix}\right) = |0\rangle\langle0|&#xA;$$&lt;/span&gt;&#xA;exactly as you would expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The utility it provides is a way to immediately visualize in an intuitive way how a state changes under various transformations. Unitary operators rotate the sphere around some axis (which leads to a very simple proof for the universal set of quantum gates) and decoherence channels shrink the sphere along some axis for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that also clears up some of the confusion between the state vector and the Bloch vector which are two entirely different beasts.&lt;/p&gt;&#xA;" OwnerUserId="5933" LastEditorUserId="5933" LastEditDate="2019-03-01T13:44:33.283" LastActivityDate="2019-03-01T13:44:33.283" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5585" PostTypeId="2" ParentId="5444" CreationDate="2019-03-01T15:15:41.663" Score="4" Body="&lt;p&gt;There are a number of questions here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding your first question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So does measurement matter or not?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I learned a lot about quantum computing/quantum mechanics by figuring out &lt;strong&gt;&lt;em&gt;why&lt;/em&gt;&lt;/strong&gt; measuring the second register is optional.  If it weren't optional, then we can send superluminal messages.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose Alice runs Shor's algorithm.  After applying a Hadarmard operation to &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;, and then the repeating squaring operation &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to the second register, the state is in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_{f}\sum^{N-1}_{x = 0}\vert x\rangle\vert 0\rangle = \vert x\rangle\vert a^{x}\text{ mod }N\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice will perform the QFT on the &lt;em&gt;first&lt;/em&gt; register.  But we have a couple of different things we can do to the second register.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If Alice were to measure and obtain &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in the second register &lt;em&gt;before&lt;/em&gt; performing the QFT on the first register, Alice will simply &lt;em&gt;collapse&lt;/em&gt; the first register to a state consisting of all &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$y=a^x\mod N$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If Alice were to measure and obtain &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in the second register &lt;em&gt;after&lt;/em&gt; performing the QFT, Alice will likewise &lt;em&gt;collapse&lt;/em&gt; the first register into a state where the global phase depends on &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But suppose Alice gives the second register to her friend Bob.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bob can decide whether to measure the second register, or not measure the second register, or measure the second register after Alice performs the QFT on the first register, or measure the second register before Alice performs the QFT...&lt;/li&gt;&#xA;&lt;li&gt;Bob can be very far away! &lt;/li&gt;&#xA;&lt;li&gt;E.G. he can be on the other side of Earth, or on the other side of Alpha Centauri&lt;/li&gt;&#xA;&lt;li&gt;More controversially he could jump into the event horizon of a black hole&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If his course of action affected Alice's first register in such a way that Alice can figure out what he did, then he could send a message superluminally to Alice.  Importantly there is no spooky action at a distance that he can do to affect Alice's QFT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding your second question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I mean the algorithm computes &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; with repeated squaring (classically) right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Shor's paper was rightfully light on details on how modular exponentiation &lt;em&gt;would&lt;/em&gt; be implemented, but his argument was effectively &quot;because there's a classically fast solution to modular exponentiation - i.e. repeated squaring, there's a quantum mechanical sequence of unitaries that efficiently implements repeated squaring.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, one of Shor's many insights is that because modular exponentiation can be easily implemented &quot;classically&quot; by means of repeated squaring, with a bunch of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gates, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOR}$&lt;/span&gt; gates, etc., modular exponentiation can &lt;em&gt;also&lt;/em&gt; be implemented &quot;quantum mechanically&quot; with &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gates, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding your third question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Then how does the second register of qubits hold the value in a superposition of sequence (modular exponentiation sequence)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The contents of the second register is dependent on the contents of the first register.  The first and second register are &lt;em&gt;entangled&lt;/em&gt; after applying &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-03-01T15:15:41.663" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5586" PostTypeId="1" CreationDate="2019-03-01T15:51:48.343" Score="8" ViewCount="962" Body="&lt;p&gt;Which quantum computing programming language should I learn? What are the benefits of said language? As of Wikipedia, there's quite a bit to choose from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to develop end-user applications (when quantum computers become end-user ready).&lt;/p&gt;&#xA;" OwnerUserId="5889" LastEditorUserId="26" LastEditDate="2019-03-01T21:30:21.823" LastActivityDate="2019-03-09T13:07:41.417" Title="Which quantum computing programming language should I learn?" Tags="&lt;programming&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5587" PostTypeId="2" ParentId="5586" CreationDate="2019-03-01T16:42:55.167" Score="3" Body="&lt;p&gt;I would prefer to first learn &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q-sharp&lt;/a&gt; if you want to quickly get into quantum computing programming, otherwise play with existing libraries and framework like &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit framework&lt;/a&gt;, &lt;a href=&quot;http://qutip.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qutip python&lt;/a&gt; library or &lt;a href=&quot;http://www.qetlab.com/Main_Page&quot; rel=&quot;nofollow noreferrer&quot;&gt;QETLAB matlab&lt;/a&gt; toolbox for feeling entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a quantum computing &lt;a href=&quot;http://www.quantumplayground.net/#/home&quot; rel=&quot;nofollow noreferrer&quot;&gt;interactive playground&lt;/a&gt; by Google.&lt;/p&gt;&#xA;" OwnerUserId="5028" LastEditorUserId="26" LastEditDate="2019-03-09T13:07:41.417" LastActivityDate="2019-03-09T13:07:41.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5588" PostTypeId="1" AcceptedAnswerId="5595" CreationDate="2019-03-01T17:52:01.140" Score="3" ViewCount="657" Body="&lt;p&gt;There are other similar questions. But I don't understand the answers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I express &lt;span class=&quot;math-container&quot;&gt;$a|0⟩+b|1⟩$&lt;/span&gt; in the form &lt;span class=&quot;math-container&quot;&gt;$\frac{c}{\sqrt2}(|0⟩+|1⟩)+\frac{d}{\sqrt 2}(|0⟩−|1⟩)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d∈\mathbb C$&lt;/span&gt;.  Then in my new basis the vector &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; is represented like &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt; .  So what does that mean?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vector &lt;span class=&quot;math-container&quot;&gt;$(1,0)$&lt;/span&gt; in computational basis means, I 100% get &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt;  in measurement. But what does it mean on other measurements? Does it mean I get &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0⟩+|1⟩), \frac{1}{\sqrt 2}(|0⟩−|1⟩)$&lt;/span&gt; with equal chances? If so, then how is it possible that in one measurement you get &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; for sure, but in new basis you could get, say &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0⟩+|1⟩)$&lt;/span&gt; with 50% chance which doesn't mean you are guaranteed to get  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on measurement but only half of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, I am asking, if in one basis I have a vector, say, &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; and in a different basis the same vector appears to be  &lt;span class=&quot;math-container&quot;&gt;$(1,0,1,0)$&lt;/span&gt; does that mean I can collapse to &lt;span class=&quot;math-container&quot;&gt;$(0,0,1,0)$&lt;/span&gt;? Which in turn and in the end will collapse me to something different than the original &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="55" LastEditDate="2019-03-03T19:33:36.650" LastActivityDate="2019-03-03T19:33:36.650" Title="The meaning of measurements in different bases" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5589" PostTypeId="1" AcceptedAnswerId="5591" CreationDate="2019-03-02T00:25:25.880" Score="2" ViewCount="140" Body="&lt;p&gt;It's stated that the density operator  is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\displaystyle \rho =\sum _{j}p_{j}|\psi _{j}\rangle \langle \psi _{j}|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't understand why this is the way both in mixed state and pure state. What is the significance of each component in the density matrix besides the trace? And how different a pure state representation than the way a mixed one is represented in the operator? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-02T05:08:50.583" LastActivityDate="2019-03-02T09:55:23.560" Title="Why is a density operator defined the way it's defined?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5590" PostTypeId="2" ParentId="4707" CreationDate="2019-03-02T02:56:02.323" Score="1" Body="&lt;p&gt;For question c,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;c) What can go wrong in Shor’s algorithm if the integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to be factored is even (that is, one of the prime factors, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, is equal to &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In order for the period-finding algorithm to work, there needs to be a period to find in the first place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us do the modular exponentiation (repeated squaring) unitary &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; on the second register:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_{f}\sum^{N-1}_{x = 0}\vert x\rangle\vert 0\rangle = \vert x\rangle\vert a^{x}\text{ mod }N\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we measure the second register and get a number, &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.  It may be the case that, if &lt;span class=&quot;math-container&quot;&gt;$N=2p$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; has to be large, the first register collapses to &lt;em&gt;only one&lt;/em&gt; number &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$y=a^x \mod N$&lt;/span&gt;.  Thus, there is no &quot;collision&quot; to which the QFT can find a period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, doing a QFT on the pure state &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; with only one value, and then measuring, doesn't tell you anything.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-03-02T02:56:02.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5591" PostTypeId="2" ParentId="5589" CreationDate="2019-03-02T09:55:23.560" Score="4" Body="&lt;p&gt;I'm not sure I entirely understand what you're asking, but let me start...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. What is it we can actually find out about that state? Everything is the result of measurements. Each measurement result corresponds to a measurement operator &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, and that outcome is given with probability &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|P|\psi\rangle$&lt;/span&gt;. Essentially, those probabilities are everything we can access.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, note that we can rearrange that calculation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi|P|\psi\rangle=\text{Tr}(P|\psi\rangle\langle\psi|),&#xA;$$&lt;/span&gt;&#xA;so if we do the calculation in that way, we see that it's sufficient to always work with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;. Although this is a matrix, it actually contains less information than the state vector because both &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}|\psi\rangle$&lt;/span&gt; give the same density matrices. In fact, that's important - that's telling you that global phases have no observable consequences.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving on, let's say that we're given a quantum state, and we're promised that either it's state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; (we say it's one of an ensemble). Now what's the probability of getting the measurement outcome corresponding to &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;? With probability &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt; it's &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(P|\psi_1\rangle\langle\psi_1|)$&lt;/span&gt; and with probability &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; it's &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(P|\psi_2\rangle\langle\psi_2|)$&lt;/span&gt;. Hence, overall, the calculation is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_1\text{Tr}(P|\psi_1\rangle\langle\psi_1|)+p_2\text{Tr}(P|\psi_2\rangle\langle\psi_2|)=\text{Tr}(P(p_1|\psi_1\rangle\langle\psi_1|+p_2|\psi_2\rangle\langle\psi_2|))&#xA;$$&lt;/span&gt;&#xA;So, the great thing is that if we group together&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=p_1|\psi_1\rangle\langle\psi_1|+p_2|\psi_2\rangle\langle\psi_2|,&#xA;$$&lt;/span&gt;&#xA;we just have to calculate &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(P\rho)$&lt;/span&gt;. This is true for any measurement, and the &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is independent of which measurement is being done, so that's the natural quantity to use. You &lt;em&gt;could&lt;/em&gt; do the full calculation with an ensemble, but for large ensembles that's just creating extra work because the matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has much less information (which you can see by the fact that many different ensembles give the same density matrix), and is therefore much less work to manipulate.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-02T09:55:23.560" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5592" PostTypeId="1" AcceptedAnswerId="5593" CreationDate="2019-03-02T10:19:56.367" Score="3" ViewCount="86" Body="&lt;p&gt;I'm doing some calculations with qutrits and I need a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that does the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|00\rangle = |12 \rangle - | 21\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|11\rangle = |20 \rangle - | 02\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|22\rangle = |01 \rangle - | 10\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; are the basis states. I don't care how it acts on the other states as long as it acts in the way prescribed earlier. Until now I've been using ad-hoc methods for finding such unitaries. In summary, I require two things: the unitary that fulfills the conditions mentioned above and if possible some general method to find unitaries that perform certain transformations over qutrits or qudits.&lt;/p&gt;&#xA;" OwnerUserId="1754" LastEditorUserId="26" LastEditDate="2019-03-02T13:03:52.297" LastActivityDate="2019-03-02T13:03:52.297" Title="Computing with qutrits" Tags="&lt;quantum-gate&gt;&lt;qudit&gt;&lt;qutrit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5593" PostTypeId="2" ParentId="5592" CreationDate="2019-03-02T12:37:59.413" Score="2" Body="&lt;p&gt;Simply find any set of normalised vectors that are mutually orthogonal and orthogonal to all your target vectors. Then define these to be the outputs for all the basis states whose outputs are not already defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, the easiest thing is probably to put the output vectors as rows on a non-square matrix and compute the null space. That’ll give you a suitable set of vectors. Not all code necessarily orthogonalises the vectors in the null space (depends what you’re using) but, if not Gram-Schmidt will do the job for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this method makes no attempt for find a separable decomposition if one exists, but you suggested that you don’t care about that.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-02T12:37:59.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5594" PostTypeId="1" CreationDate="2019-03-02T16:13:27.183" Score="3" ViewCount="32" Body="&lt;p&gt;When we read books on quantum computing and information theory, specifically in entanglement we find some distinguishability between those who focus on entanglement as a resource or use it as an application  to explain some phenomenons (teleportation, superdense coding,..), and others study its measure (how long/far the state is still entangled) such as controlling satellites by sending entangled particles, because in this case entanglement could be affected by electromagnetic interactions and other factors of disturbance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please clarify this idea?&lt;/p&gt;&#xA;" OwnerUserId="5823" LastEditorUserId="5823" LastEditDate="2019-03-02T19:48:23.587" LastActivityDate="2019-03-02T19:48:23.587" Title="How we can describe entanglement from measurement and resource perspectives?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;&lt;applications&gt;&lt;superdense-coding&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5595" PostTypeId="2" ParentId="5588" CreationDate="2019-03-02T17:49:24.590" Score="3" Body="&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$\mid \psi \rangle$&lt;/span&gt; is fixed. You can write it as &lt;span class=&quot;math-container&quot;&gt;$a |0 \rangle + b |1 \rangle$&lt;/span&gt;. If you write that in the other basis and get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;(a,b) = (1,0) \implies (c,d) = (\frac{\sqrt{2}}{2},\frac{\sqrt{2}}{2})&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are the same state so it is still true that if you do a measurement in the &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; basis, you will surely get &lt;span class=&quot;math-container&quot;&gt;$\mid 0 \rangle$&lt;/span&gt; if you start with &lt;span class=&quot;math-container&quot;&gt;$(a,b)=(1,0)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For shorthand let us call the states &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} (|0 \rangle \pm |1 \rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mid \pm \rangle$&lt;/span&gt; respectively. That way don't have to keep rewriting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we are in state &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{2}}{2} \mid + \rangle + \frac{\sqrt{2}}{2} \mid - \rangle$&lt;/span&gt;. If we measure in the &lt;span class=&quot;math-container&quot;&gt;$\mid + \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mid - \rangle$&lt;/span&gt; basis, we have a a &lt;span class=&quot;math-container&quot;&gt;$(\frac{\sqrt{2}}{2})^2=\frac{1}{2}$&lt;/span&gt; probability for measuring each of &lt;span class=&quot;math-container&quot;&gt;$\mid + \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mid - \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your confusion is about measuring in &lt;span class=&quot;math-container&quot;&gt;$\mid 0 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mid 1 \rangle$&lt;/span&gt; basis vs measuring in the &lt;span class=&quot;math-container&quot;&gt;$\mid \pm \rangle$&lt;/span&gt;. You don't do them both at the same time. Either you pick the first, and surely get &lt;span class=&quot;math-container&quot;&gt;$\mid 0 \rangle$&lt;/span&gt; or you do the second and get &lt;span class=&quot;math-container&quot;&gt;$\mid + \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mid - \rangle$&lt;/span&gt; with equal probabilities. They are different operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your original &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; is in basis 1, then your &lt;span class=&quot;math-container&quot;&gt;$(1,0,1,0)$&lt;/span&gt; is in basis 2. The measurement in basis 2 collapses this to &lt;span class=&quot;math-container&quot;&gt;$(0,0,1,0)$&lt;/span&gt;. Conversely if you measure in basis 1 you get &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; in basis 1. These are different states, but that is expected because you did different measurement operations on the starting state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might still be thinking too classically as being able to do lots of different passive measurements in whatever order.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; (clarifying the confusion in the comments):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurement is not simply reading the state as a vector. Rewriting the vector in different basis doesn't do anything. As in linear algebra, it doesn't matter at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurement in a basis is an operation you do. It is computed by doing the rewrite first, but that is the perspective of you as an omnipetent being when doing the math. You rewrite in the desired basis first because that way the projection operator in that basis is easy to write down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurement changes the vector and different measurements change the vector in different ways. Measurement 0 in basis 1 will apply some projection operator &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;, measurement + in basis 2 will do some other projection operator &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt;. They are different operators, so of course, you can't expect to get the same thing even if the input state was the same. If you write &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; in basis 1 you get a matrix &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt;, and if you write &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt; in basis 2 as &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; you get those same matrix entries, but that doesn't mean that the operators were the same. If you write &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt; in basis 1 you will get something totally different from &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt;. Doing the rewrite of the state into basis 2 was so you wouldn't have to write down that matrix and could just work with matrix &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-03-02T23:19:12.017" LastActivityDate="2019-03-02T23:19:12.017" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5596" PostTypeId="1" AcceptedAnswerId="5610" CreationDate="2019-03-02T19:08:23.573" Score="2" ViewCount="115" Body="&lt;p&gt;It is &lt;a href=&quot;https://physics.stackexchange.com/a/141177/199113&quot;&gt;well known&lt;/a&gt; that entanglement is precisely the difference between the Cartesian product and the tensor product. The space where every point corresponds to a state is the projective Hilbert space, and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Segre_embedding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Segre embedding&lt;/a&gt; from the projective space of the Cartesian product to the projective space of the tensor product. The image of this embedding is the set of non-entangled states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of two-qubit systems, this is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma: \mathbb{C}P^1 \times \mathbb{C}P^1  \to \mathcal{P}(\mathcal{H}_1 \otimes \mathcal{H}_2) \cong \mathbb{C}P^3$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$([x_1 : y_1],[x_2 : y_2]) \mapsto [x_1x_2:x_1y_2:y_1x_2:y_1y_2].$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The image of this embedding is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Algebraic_variety&quot; rel=&quot;nofollow noreferrer&quot;&gt;variety&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$$Z_0Z_3 - Z_1Z_2 = 0$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$$[Z_0:Z_1:Z_2:Z_3] \in \mathbb{C}P^3.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For two qubits systems, the solution set is the above &lt;em&gt;quadric&lt;/em&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to write down the general variety for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit systems? If yes, what will it be?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; Folks may be interested in this thread on Physics SE: &lt;a href=&quot;https://physics.stackexchange.com/questions/54896&quot;&gt;Should it be obvious that independent quantum states are composed by taking the tensor product?&lt;/a&gt; It took me quite some time to appreciate why exactly we choose the tensor product rather than the direct sum for composite quantum systems; it makes a lot more sense now. The tensor product space allows for the notion of entanglement whereas the direct product space does not!&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-02T19:20:16.067" LastActivityDate="2019-03-03T19:56:29.273" Title="What is the general variety corresponding to the Segre embedding for $n$-qubit systems?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5597" PostTypeId="1" CreationDate="2019-03-02T20:22:23.633" Score="3" ViewCount="187" Body="&lt;p&gt;I have the following circuit in qiskit. It is a simple CNOT operation with the control qubit set to 1, by running the control qubit through an X-gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I measure the 2nd qubit, I get the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;,  not &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I add a measurement of the control qubit, I do see &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as the final result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I fully expected &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as the outcome regardless of whether I measure a single or both qubits&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit&#xA;from qiskit import execute&#xA;from qiskit import BasicAer&#xA;from math import *&#xA;q0 = QuantumRegister(2, &quot;q0&quot;) # one ancilla qubit&#xA;c0 = ClassicalRegister(2, &quot;c0&quot;) # n classical bits for output&#xA;qc = QuantumCircuit(q0,c0)&#xA;qc.x(q0[0])&#xA;qc.cx(q0[0], q0[1])&#xA;  #qc.measure(q0[0],c0[0]) &amp;lt;= when commented out I measure |00&amp;gt;&#xA;qc.measure(q0[1],c0[1])&#xA;qc.draw()&#xA; job = execute(qc,backend=BasicAer.get_backend('qasm_simulator'))&#xA; job.result().get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FWqjB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FWqjB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5025" LastEditorUserId="26" LastEditDate="2019-03-02T20:26:13.937" LastActivityDate="2019-03-03T21:42:57.310" Title="For CNOT gate with control qubit set to 1, the measured state of the second qubit unexpectedly depends on the measurement" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5598" PostTypeId="1" AcceptedAnswerId="5602" CreationDate="2019-03-02T22:03:17.703" Score="1" ViewCount="581" Body="&lt;p&gt;For a given teleportation process as depicted in the figure, how one can say that teleporting the qubit state &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt;  has not cloned at the end of Bob's measurement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YFNRI.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YFNRI.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5823" LastEditorUserId="26" LastEditDate="2019-03-03T08:33:05.327" LastActivityDate="2019-03-04T16:11:58.927" Title="How to prove teleportation does not violate no-cloning theorem?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;teleportation&gt;&lt;no-cloning-theorem&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5599" PostTypeId="2" ParentId="5598" CreationDate="2019-03-02T23:04:23.103" Score="3" Body="&lt;p&gt;Firstly, &lt;em&gt;carefully&lt;/em&gt; read through the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation#Formal_presentation&quot; rel=&quot;nofollow noreferrer&quot;&gt;formal presentation of the protocol&lt;/a&gt; as described on Wikipedia. Secondly, there's nothing to prove as such here. It is evident from the teleportation protocol itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, at the conclusion of the teleportation protocol, Bob's qubit certainly will take on the same state as Alice's qubit's &lt;em&gt;initial&lt;/em&gt; state i.e. &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt;. However, Alice's qubit will now exist as an inseparable part of an entangled Bell state. You haven't really been able to create a &quot;copy&quot; of Alice's qubit, in the sense that Alice's qubit's initial state is &quot;destroyed&quot; in the process and is no longer &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In (crude) analogical terms, in the quantum teleportation protocol you &quot;cut and paste&quot; the state &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; rather than &quot;copying and pasting&quot;. So there's no violation of the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;No cloning theorem&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-03T08:18:35.110" LastActivityDate="2019-03-03T08:18:35.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5600" PostTypeId="1" AcceptedAnswerId="5601" CreationDate="2019-03-02T23:39:45.080" Score="4" ViewCount="442" Body="&lt;p&gt;The Bloch sphere is homeomorphic to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Riemann_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Riemann sphere&lt;/a&gt;, and there exists a &lt;a href=&quot;https://physics.stackexchange.com/a/220951/199113&quot;&gt;stereographic projection&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\Bbb S^2\to \Bbb C_\infty$&lt;/span&gt;. But this only holds for pure states. To quote Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum mechanics is mathematically formulated in Hilbert space or&#xA;  projective Hilbert space. The space of &lt;strong&gt;pure states&lt;/strong&gt; of a quantum system&#xA;  is given by the one-dimensional subspaces of the corresponding Hilbert&#xA;  space (or the &quot;points&quot; of the projective Hilbert space). For a&#xA;  two-dimensional Hilbert space, this is simply the complex projective&#xA;  line &lt;span class=&quot;math-container&quot;&gt;$\Bbb C P^1$&lt;/span&gt;. This is the Bloch sphere.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Essentially the set of all possible pure states of a qubit is homeomorphic to &lt;span class=&quot;math-container&quot;&gt;$\Bbb C P^1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qQZxy.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qQZxy.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the set of mixed states homeomorphic to any geometrical structure (or complex projective space) in particular? Is there any similar stereographic projection corresponding to the mixed states? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we assign a manifold structure to the set of mixed states? For instance, &lt;span class=&quot;math-container&quot;&gt;$\Bbb C P^1$&lt;/span&gt; is basically the manifold constructed by quotient as Lie group (&lt;span class=&quot;math-container&quot;&gt;$\Bbb C^\times$&lt;/span&gt;) action on &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2 \setminus \{0\}$&lt;/span&gt;. But that only corresponds to pure states. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moretti says in &lt;a href=&quot;https://physics.stackexchange.com/a/121367/199113&quot;&gt;his Physics SE answer&lt;/a&gt; that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In finite dimension, barring the trivial case &lt;span class=&quot;math-container&quot;&gt;$\text{dim}({\cal H})=2$&lt;/span&gt; where&#xA;  the structure of the space of the states is pictured by the&#xA;  &lt;strong&gt;Poincaré-Bloch ball&lt;/strong&gt; as a &lt;strong&gt;manifold with boundary&lt;/strong&gt;, &lt;span class=&quot;math-container&quot;&gt;$S(\cal H)$&lt;/span&gt; has a structure which generalizes that of a manifold with boundary.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, I suppose, in this context of qubits, the boundary is &lt;span class=&quot;math-container&quot;&gt;$\Bbb C P^1$&lt;/span&gt;, and the manifold &lt;em&gt;without&lt;/em&gt; the boundary is the set of mixed states with some additional structure (?). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do we describe this manifold without boundary in mathematical terms? I guess it would trivially be a 3-ball. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2019-06-04T22:53:51.560" LastActivityDate="2019-06-04T22:53:51.560" Title="Homeomorphism or stereographic projection corresponding to the set of mixed states within the Bloch sphere" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;density-matrix&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5601" PostTypeId="2" ParentId="5600" CreationDate="2019-03-03T00:17:35.807" Score="3" Body="&lt;p&gt;Almost. You get a manifold with boundary with the Bloch ball. The radius from the origin parameterizing how pure it is. The origin being maximally mixed. This isn't a manifold because a point on the boundary has a neighborhood that is homeomorphic to a half space but not one homeomorphic to &lt;span class=&quot;math-container&quot;&gt;$\Bbb R^n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-03-03T00:19:17.130" LastActivityDate="2019-03-03T00:19:17.130" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5602" PostTypeId="2" ParentId="5598" CreationDate="2019-03-03T00:21:17.740" Score="2" Body="&lt;p&gt;I.e., if we have the entire initial state is written as follows&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| q \rangle \otimes | \beta_{00} \rangle =(\alpha | 0\rangle+\beta | 1 \rangle ) \otimes \frac{1}{\sqrt{2}}( |00\rangle+| 11 \rangle)$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{\sqrt{2}}(\alpha | 000\rangle+\alpha | 011 \rangle+\beta | 100 \rangle+\beta | 111 \rangle ),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then, in step three, we obtain the state (the system state collapses to one of four possible result after measurement),&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle \equiv\{ |00\rangle \frac{\alpha | 0 \rangle+\beta | 1\rangle}{2}+| 01 \rangle \frac{\alpha | 1 \rangle+\beta | 0\rangle}{2}+| 10 \rangle \frac{\alpha | 0 \rangle-\beta | 1\rangle}{2}+| 11 \rangle \frac{\alpha | 1 \rangle-\beta | 0\rangle}{2} \},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the right two-qubit is for Alice and the superposed qubits with corresponding probabilities &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are for Bob&lt;/p&gt;&#xA;&lt;p&gt;hence we can no longer write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| q \rangle_A \otimes | \text{something} \rangle_B,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;namely, Alice's &lt;span class=&quot;math-container&quot;&gt;$| q \rangle_A$&lt;/span&gt; dissapeared.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0zcIk.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0zcIk.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5823" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-03-04T09:52:16.877" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="5603" PostTypeId="1" AcceptedAnswerId="5604" CreationDate="2019-03-03T00:43:44.470" Score="2" ViewCount="386" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/434/ahusain?tab=profile&quot;&gt;@AHusain&lt;/a&gt; mentions &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5600/homeomorphism-corresponding-to-the-set-of-mixed-states-within-the-bloch-sphere/5601#5601&quot;&gt;here&lt;/a&gt; that the purity of a qubit state can be expressed as a function of the radius from the center of a Bloch sphere. The state corresponding to the origin is maximally mixed whereas the states corresponding to the boundary points are pure. So far, I haven't seen this fact written anywhere explicitly. What would be the mathematical proof for this claim?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2019-06-04T22:52:09.063" LastActivityDate="2019-06-04T22:52:09.063" Title="Purity of mixed states as a function of radial distance from origin of Bloch ball" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;density-matrix&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5604" PostTypeId="2" ParentId="5603" CreationDate="2019-03-03T07:18:38.410" Score="6" Body="&lt;p&gt;A density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has the properties of being Hermitian, non-negative and has trace 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\frac{n_0\mathbb{I}+\vec{n}\cdot\vec{\sigma}}{2}.&#xA;$$&lt;/span&gt;&#xA;The trace being 1 fixes that &lt;span class=&quot;math-container&quot;&gt;$n_0=1$&lt;/span&gt;, while the Hermitian property imposes that &lt;span class=&quot;math-container&quot;&gt;$\vec{n}\in\mathbb{R}^3$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}$&lt;/span&gt; is the vector of the 3 Pauli matrices. The eigenvalues are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12(1\pm\sqrt{\vec{n}\cdot\vec{n}}),&#xA;$$&lt;/span&gt;&#xA;so it's non-negative iff &lt;span class=&quot;math-container&quot;&gt;$|\vec{n}|\leq 1$&lt;/span&gt;. In the case where the length is 1, the eigenvalues are 0,1 so &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a projector onto a pure state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's consider the purity, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)$&lt;/span&gt;. In this way of writing, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho^2)=\frac12(1+\vec{n}\cdot\vec{n})&#xA;$$&lt;/span&gt;&#xA;Clearly, the largest value of the purity is 1, for pure states, and the smallest value corresponds to &lt;span class=&quot;math-container&quot;&gt;$\vec{n}\cdot\vec{n}=0$&lt;/span&gt;, i.e. the maximally mixed state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how do we depict a state on the Bloch Sphere? We simply plot &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt;, so the distance from the centre of the sphere is given by &lt;span class=&quot;math-container&quot;&gt;$|\vec{n}|=\sqrt{2\text{Tr}(\rho^2)-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Proof of the basic properties&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Let's say we have a density matrix of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_ip_i|\psi_i\rangle\langle\psi_i|,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sum_ip_i=1$&lt;/span&gt;. Trivially, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has trace 1 and is Hermitian. Non-negative matrices satisfy the property&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\phi|\rho|\phi\rangle\geq 0\qquad\forall|\phi\rangle.&#xA;$$&lt;/span&gt;&#xA;So, consider a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\phi|\rho|\phi\rangle=\sum_ip_i|\langle\phi|\psi_i\rangle|^2.&#xA;$$&lt;/span&gt;&#xA;Every term on the right-hand side must be non-negative, and hence &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is non-negative.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-03T07:18:38.410" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5605" PostTypeId="1" AcceptedAnswerId="5606" CreationDate="2019-03-03T10:11:27.533" Score="3" ViewCount="737" Body="&lt;p&gt;Nielsen and Chuang (on page 188 exercise 4.33)  says that the circuit including CNOT and Hadamard is performing a measurement in the Bell basis.  But I can't see how.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nHiYP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nHiYP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix representing the circuit functionality is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\ 0 &amp;amp; 1 &amp;amp;-1 &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what I have found out is, that instead of measuring in the Bell state, it is actually simply converting &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\beta_{00}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\beta_{01}$&lt;/span&gt; and vice versa and so on. So it's actually transforming from one basis to another. But how is it a measurement in the Bell state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you take the vector &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; in the Bell state it's written &lt;span class=&quot;math-container&quot;&gt;$(1,0,1,0)$&lt;/span&gt; then when measuring in Bell state I would expect you get either &lt;span class=&quot;math-container&quot;&gt;$(1,0,0,0)$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |11\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(0,0,1,0)$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle-|11\rangle$&lt;/span&gt;. But why isn't it doing the measurement but just converting from basis to basis and yet Wikipedia says it's a measurement? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-03T13:13:05.447" LastActivityDate="2019-03-04T07:58:40.803" Title="Why isn't the circuit performing a measurement in the Bell basis?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5606" PostTypeId="2" ParentId="5605" CreationDate="2019-03-03T11:01:35.013" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;You're correct that unitary gates like the Hadamard and CNOT &lt;em&gt;do not&lt;/em&gt; perform any measurement. In fact, measurement isn't a unitary operation at all! There are separate measurements gates to measure the individual qubit states. The basis which the measurement gates will use is implementation dependent. However, in your specific circuit (N&amp;amp;C p. 188, Ex. 4.33) they're using the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; basis. Notice the &lt;a href=&quot;https://i.stack.imgur.com/6bAWo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;meter type gates&lt;/a&gt; in your circuit. Those are the measurement gates. That circuit is essentially the one used to distinguish between the four orthogonal Bell states. They're mapped to &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; respectively. The mappings are (notations explained &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state#Bell_basis&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Phi^+\rangle \to |00\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Phi^-\rangle \to |10\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi^+\rangle \to |01\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi^-\rangle \to |11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;As for how we can distinguish the four Bell states using two measurement gates, read &lt;a href=&quot;https://physics.stackexchange.com/users/911/craig-gidney&quot;&gt;Craig Gidney's&lt;/a&gt; answer to &lt;a href=&quot;https://physics.stackexchange.com/questions/285878/distinguishing-between-orthogonal-bell-states&quot;&gt;Distinguishing between orthogonal bell states&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Typically, a Bell basis measurement is done &lt;a href=&quot;http://algorithmicassertions.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Counting2%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22Amps2%22%5D%2C%5B%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22Chance%22%2C%22Chance%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;with a CNOT and a&#xA;  Hadamard like&#xA;  so&lt;/a&gt;:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aZhyS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aZhyS.png&quot; alt=&quot;Bell basis measurement&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;It's exactly the reverse of making a Bell pair.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;You can also &lt;a href=&quot;http://algorithmicassertions.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Counting2%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22Amps2%22%5D%2C%5B%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%8A%95%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%8A%95%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22Measure%22%2C%22Measure%22%5D%2C%5B%22Amps2%22%2C1%2C%22Chance%22%2C%22Chance%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;simply do parity measurements along the X and Z&#xA;  axes&lt;/a&gt;:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xMjyN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xMjyN.png&quot; alt=&quot;Bell basis parity measurement&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Further Reading:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/136/if-all-quantum-gates-must-be-unitary-what-about-measurement/143&quot;&gt;If all quantum gates must be unitary, what about measurement?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1870/what-does-measurement-in-a-certain-basis-mean&quot;&gt;What does “measurement in a certain basis” mean?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/261664/how-to-measure-relative-phases-of-quantum-states&quot;&gt;How to measure relative phases of quantum states?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-03T13:53:27.680" LastActivityDate="2019-03-03T13:53:27.680" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="5607" PostTypeId="1" CreationDate="2019-03-03T17:01:37.310" Score="2" ViewCount="429" Body="&lt;p&gt;In QCQI by Chuang and Nielsen (page 201), they prove that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP} \subseteq \mathsf{PSPACE}$&lt;/span&gt;.  I can't understand what they say.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They write &quot;Supposing the quantum circuit starts in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; we will explain how to evaluate in polynomial space on a classical computer the probability that it ends up in the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does that prove anything? If I can calculate the probability of the algorithm in poly time does that prove I can calculate in poly time the algorithm itself as well? I don't see how.&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-14T16:04:52.940" LastActivityDate="2019-03-14T16:04:52.940" Title="Clarification needed for the N&amp;C proof that BQP ⊆ PSPACE" Tags="&lt;complexity-theory&gt;&lt;nielsen-and-chuang&gt;&lt;bqp&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5608" PostTypeId="1" CreationDate="2019-03-03T17:22:29.240" Score="3" ViewCount="317" Body="&lt;p&gt;So when you have an observable which is the measurement operator acting on the state you get a different result than in a different basis. &#xA;What does it mean in physical terms?  Does that mean writing your space operation in different style could collapse your state to something different?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, we can understand it mathematically but what's in physical terms? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-04T14:27:41.200" LastActivityDate="2019-03-04T14:56:14.713" Title="What does an observable in a different basis mean physically?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5609" PostTypeId="2" ParentId="5608" CreationDate="2019-03-03T19:22:02.640" Score="4" Body="&lt;p&gt;One way to think about it is that &quot;&lt;em&gt;measuring in a given basis&lt;/em&gt;&quot; is how we describe mathematically the act of interacting with the system in different ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking as an example a qubit, &quot;&lt;em&gt;measuring in the &lt;span class=&quot;math-container&quot;&gt;$\{\lvert0\rangle,\lvert1\rangle\}$&lt;/span&gt; basis&lt;/em&gt;&quot; is mathematese for &quot;&lt;em&gt;interacting with the system in a way that reveals to the experimenter whether the system is in the physical state which we are thinking of as corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt;&quot;&lt;/em&gt;. In general, the system will not be in a state that can be directly associated with one of these basis states, in which case the act of measurement &quot;forces&quot; the system to &lt;em&gt;collapse&lt;/em&gt; to one of the two states, and this happens with a probability that depends on the actual state of the system, and induces a physical change in the state of the system.&#xA;Measuring in a different basis then simply corresponds to another type of physical interaction with the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another, slightly more informal way to think about it is to say that each measurement basis corresponds to a different &quot;question&quot; being asked to the system. &quot;&lt;em&gt;Measuring in &lt;span class=&quot;math-container&quot;&gt;$\{\lvert0\rangle,\lvert1\rangle\}$&lt;/span&gt;&lt;/em&gt;&quot; means to be asking the system whether it's in the &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; state, while &quot;&lt;em&gt;measuring in &lt;span class=&quot;math-container&quot;&gt;$\{\lvert+\rangle,\lvert-\rangle\}$&lt;/span&gt;&lt;/em&gt;&quot; means to be asking the system whether it is in the &lt;span class=&quot;math-container&quot;&gt;$\lvert+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lvert-\rangle$&lt;/span&gt; state. As it happens, in quantum mechanics the act of &quot;asking a question&quot; to the system - that is, of collecting some classical information out of the system - will in general result in a perturbation of the system itself, which in quantum mechanics is captured by means  of the noncommutativity of different observables.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-03-03T19:31:18.557" LastActivityDate="2019-03-03T19:31:18.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5610" PostTypeId="2" ParentId="5596" CreationDate="2019-03-03T19:44:41.200" Score="2" Body="&lt;p&gt;It is possible, but a bit annoying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each subset S of &lt;span class=&quot;math-container&quot;&gt;$[1\cdots n]$&lt;/span&gt; containing 1 that isn't all of &lt;span class=&quot;math-container&quot;&gt;$[1 \cdots n]$&lt;/span&gt;. We get a Segre embedding &lt;span class=&quot;math-container&quot;&gt;$\mathbb{CP}^{2^{\mid S \mid} - 1} \times \mathbb{CP}^{2^{\mid S^c \mid} - 1} \to \mathbb{CP}^{2^n-1}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$S^c$&lt;/span&gt; stands for the complementary subset of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason we restrict so that &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; contains 1 is so that we don't repeat between &lt;span class=&quot;math-container&quot;&gt;$(S,S^c)$&lt;/span&gt; and another term which is the same as &lt;span class=&quot;math-container&quot;&gt;$(S^c,S)$&lt;/span&gt;. That is we don't want to repeat when &lt;span class=&quot;math-container&quot;&gt;$S=[1,2]$&lt;/span&gt; giving &lt;span class=&quot;math-container&quot;&gt;$(S,S^c)=([1,2],[3])$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S=[3]$&lt;/span&gt; giving &lt;span class=&quot;math-container&quot;&gt;$([3],[1,2])$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equations that cut out a Segre embedding are similar to the 2 qubit example you state. They are still quadratic equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_{i,j} Z_{k,l} - Z_{i,l} Z_{k,j}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$Z_{i,j}$&lt;/span&gt; means you write the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; homogenous coordinates of the &lt;span class=&quot;math-container&quot;&gt;$CP^{2^n-1}$&lt;/span&gt; in a rectangular matrix which is &lt;span class=&quot;math-container&quot;&gt;$2^{\mid S \mid}$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2^{\mid S^c \mid}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; runs 1  through &lt;span class=&quot;math-container&quot;&gt;$2^{\mid S \mid}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; runs 1 through &lt;span class=&quot;math-container&quot;&gt;$2^{\mid S^c \mid}$&lt;/span&gt;. You have to be careful keeping track of these indices because we have to do this many times for each &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you do that, that takes care of each possible bipartitioning. If you want the states on n qubits that have no way to break up into two or more factors. That is no way to write &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = R_\sigma (|\phi \rangle \otimes | \alpha \rangle)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$R_\sigma$&lt;/span&gt; the action of a permutation of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. I did that because the way the state broke up could be like a bell state with 1 and 3 tensored with 0 for qubit 2. Just needed to straighten everything out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So it can't be in the image of any of those Segre embeddings above. So take the union of all the Segre embeddings and avoid that subspace. Call the space of these genuinely entangled states &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, the complement of all these Segre embeddings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have one of the embeddings cut out by some polynomial &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and another embedding cut out by &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;. So if you look at the zeros of &lt;span class=&quot;math-container&quot;&gt;$fg$&lt;/span&gt;, both of those will be included as well. Naturally, this generalizes to the many embeddings you are trying to avoid with this example. Don't want to use too much of the algebraic geometry vocabulary here, because I don't know how much others are familiar with it, but that is what is happening here so keeping it a little vague for future readers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can send something else I wrote up that used this to calculate certain combinations of cohomology groups of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. It's basically the procedure I describe here, but followed by only remembering the spaces as elements of a certain ring instead of as varieties/complements thereof. It means you don't have to do as much tedious work of writing those quadratic equations for each embedding, but you still get some information out. But that is a different question.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-03-03T19:56:29.273" LastActivityDate="2019-03-03T19:56:29.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5612" PostTypeId="2" ParentId="5597" CreationDate="2019-03-03T21:42:57.310" Score="3" Body="&lt;p&gt;Thanks for pointing this out. This is &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/1838&quot; rel=&quot;nofollow noreferrer&quot;&gt;a bug&lt;/a&gt; that occurs when only a subset of the qubits are measured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's being fixed. Until then, workarounds are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Use &lt;code&gt;Aer&lt;/code&gt; instead of &lt;code&gt;BasicAer&lt;/code&gt; (always the best thing to do when possible).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use &lt;code&gt;LegacySimulators&lt;/code&gt; instead of &lt;code&gt;BasicAer&lt;/code&gt; (this will give a deprecation warning).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Install Qiskit from the master branch, where the issue has been fixed (here be dragons!).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-03-03T21:42:57.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5613" PostTypeId="2" ParentId="5605" CreationDate="2019-03-04T07:58:40.803" Score="1" Body="&lt;p&gt;Just to supplement the given answer, if you want to know what the effective measurement is, you start from the measurement operators and work backwards. So, the two measurements mean that you're projecting on the states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle,|01\rangle,|10\rangle,|11\rangle$&lt;/span&gt;. How do these transform under the preceding gates? Immediately before the measurement, we have a Hadamard on the first quibt. Incorporating that into the measurement basis means measuring in &lt;span class=&quot;math-container&quot;&gt;$|+0\rangle,|+1\rangle,|-0\rangle,|-1\rangle$&lt;/span&gt;. Finally, we incorporate the controlled-not, and we see that the overall thing corresponds to measurement in the Bell basis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-04T07:58:40.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5614" PostTypeId="2" ParentId="5607" CreationDate="2019-03-04T08:22:29.947" Score="3" Body="&lt;h1&gt;Basic Definitions:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;If you don't know the definitions of the basic computational complexity classes well, I strongly recommend going through &lt;a href=&quot;https://www.youtube.com/watch?v=fc12NHko8sw&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' lecture&lt;/a&gt;. We won't be using the quantum Turing machine formulation here, unlike the formal rigorous proof by &lt;a href=&quot;https://epubs.siam.org/doi/10.1137/S0097539796300921&quot; rel=&quot;nofollow noreferrer&quot;&gt;Berstein and Vazirani&lt;/a&gt;. Anyway, I'm including a brief discussion on the definitions here. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Polynomial-time quantum algorithms&lt;/strong&gt;: In the quantum circuit model, a quantum algorithm &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is described by a family of quantum circuits &lt;span class=&quot;math-container&quot;&gt;$$Q = \{Q_n:n\in \Bbb N\}.$$&lt;/span&gt; Such a family is &lt;strong&gt;polynomial-time uniform&lt;/strong&gt; if there exists a classical algorithm that produces a description of &lt;span class=&quot;math-container&quot;&gt;$Q_n$&lt;/span&gt; for each input &lt;span class=&quot;math-container&quot;&gt;$n\in \Bbb N$&lt;/span&gt;, in time polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To run this algorithm on an input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, we apply &lt;span class=&quot;math-container&quot;&gt;$Q_n$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, and measure the output in the standard basis:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YRlZL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YRlZL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Shorthand: Write &lt;span class=&quot;math-container&quot;&gt;$Q(x)$&lt;/span&gt; to denote the outcome, which is a random variable in general. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Promise Problem&lt;/strong&gt; : It is a pair  &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{A}=\{\mathcal{A}_{\text{yes}},\mathcal{A}_{\text{no}}\}$$&lt;/span&gt;&#xA;   where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}_{\text{yes}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}_{\text{no}}$&lt;/span&gt; are&#xA;   disjoint sets of inputs (&lt;strong&gt;yes&lt;/strong&gt; inputs and &lt;strong&gt;no&lt;/strong&gt; inputs). Strings&#xA;   not contained in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}_{\text{yes}} \cup&#xA; \mathcal{A}_{\text{no}}$&lt;/span&gt; are &quot;don't care&quot; inputs.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;: The class of &lt;strong&gt;promise problems&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A} = (\mathcal{A}_{\text{yes}}, \mathcal{A}_{\text{no}})$&lt;/span&gt; for which there exists a polynomial time-uniform family &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Q} = \{\mathrm{Q}_n: n\in \Bbb N\}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;of quantum circuits such that, for all input strings &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, we have:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x\in\mathcal{A}_{\text{yes}} \implies \text{Pr}[\mathrm{Q}(x)=1]\geq \frac{2}{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x\in\mathcal{A}_{\text{no}} \implies \text{Pr}[\mathrm{Q}(x)=0]\geq \frac{2}{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE}$&lt;/span&gt;: The class of promise problems solvable in polynomial space on a deterministic &lt;a href=&quot;https://en.wikipedia.org/wiki/Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;Turing machine&lt;/a&gt;. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href=&quot;https://www.youtube.com/watch?v=fc12NHko8sw&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Watrous - Quantum Complexity Theory (Part 1) - CSSQI 2012&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In the gate model, a quantum algorithm is essentially a set of unitary gate operations followed by measurement. Think of &lt;span class=&quot;math-container&quot;&gt;$Q(x)$&lt;/span&gt; as a sequence of gate operations performed on an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, with measurement performed on one specific qubit at the end. As a qubit can only collapse to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; when measured in the standard basis, you'll get either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; as the output i.e. either &lt;span class=&quot;math-container&quot;&gt;$Q(x) = 1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Q(x) = 0$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Explanation:&lt;/h1&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why is it that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\subseteq \mathsf{PSPACE}$&lt;/span&gt;? Here's an intuitive outline of the proof (a rigorous proof is left to the references in 'History and further reading'). Suppose we have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit quantum computer, and do a computation involving a set of &lt;span class=&quot;math-container&quot;&gt;$p(n)$&lt;/span&gt; gates, where &lt;span class=&quot;math-container&quot;&gt;$p(n)$&lt;/span&gt; is some polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Supposing the quantum circuit starts in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; we will explain how to evaluate in polynomial space on a classical computer the probability that it ends in the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;. Suppose the gates that are executed on the quantum computer, are in the order &lt;span class=&quot;math-container&quot;&gt;$U_1, U_2, ..., U_{p(n)}$&lt;/span&gt;. Then the probability of ending up in the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; is the modulus squared of &lt;span class=&quot;math-container&quot;&gt;$$\langle y|U_{p(n)} ... U_2U_1|0\rangle. \tag{4.86}$$&lt;/span&gt; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;This quantity may be estimated in polynomial space on a classical computer. The basic idea is to insert the &lt;a href=&quot;https://physics.stackexchange.com/questions/251803/what-is-meant-by-the-term-completeness-relation&quot;&gt;completeness relation&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\sum_x|x\rangle\langle x|=I$&lt;/span&gt; between each term in &lt;span class=&quot;math-container&quot;&gt;$(4.86)$&lt;/span&gt; obtaining &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle y| U_{p(n)}...U_2U_1 |0\rangle = \sum_{x_1,...,x_{p(n)-1}} \langle y |U_{p(n)}|x_{p(n)-1}\rangle \langle x_{p(n)-1}|U_{p_{n-1}}... U_2|x_1\rangle \langle x_1|U_1|0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nielsen and Chuang prove that if your quantum circuit begins with all qubits initialized in the state &lt;span class=&quot;math-container&quot;&gt;$|0\dots\rangle$&lt;/span&gt; (all qubits in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;; N&amp;amp;C has labeled that state as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; so don't get confused), you can evaluate in &lt;strong&gt;polynomial space&lt;/strong&gt; (i.e. the memory space required on a classical computer can be written down as a polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) the probability that the final  would be any arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, given a certain composite quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, you can calculate in polynomial space the probability of a specific qubit returning &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;), upon the final measurement. You may be thinking that even the generating the description of &lt;span class=&quot;math-container&quot;&gt;$Q_n$&lt;/span&gt;'s, the &lt;span class=&quot;math-container&quot;&gt;$Q_n$&lt;/span&gt;'s themselves, and storing the results of their operations on the composite quantum state would occupy space. Yes, that is true. However, that too will only be a polynomial amount of space, as in polynomial time only polynomial space can be accessed. C.f. &lt;a href=&quot;https://cs.stackexchange.com/questions/13655/polynomial-time-algorithm-with-exponential-space-is-eligible&quot;&gt;Polynomial-time algorithm with exponential space is eligible?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the background, it's really similar to the &lt;a href=&quot;https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-845-quantum-complexity-theory-fall-2010/lecture-notes/MIT6_845F10_lec04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;path integral approach&lt;/a&gt; (you may skip this and jump to the exercise at the end of answer, in the first reading).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In terms of computational complexity, the Schrodinger picture&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\alpha_x|x\rangle$&lt;/span&gt; and Heisenberg's density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, both lead&#xA;  to exponential-space simulation since we need to calculate whole&#xA;  evolution of state vectors. On the other hand, the Feynman's path&#xA;  integral, summing up all the histories, leads to a polynomial-space&#xA;  simulation. By writing each final amplitude as a sum of contributions&#xA;  from all possible paths, we can calculate the sum in&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE}$&lt;/span&gt;. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For example, the calculation of &lt;span class=&quot;math-container&quot;&gt;$H\otimes H|0\rangle$&lt;/span&gt; can be viewed as&#xA;  follows in Feynman's path integral. We calculate amplitude for each&#xA;  path separately which needs polynomial space only.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0ZwPH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0ZwPH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, the point is that you can evaluate the result of your decision problem in polynomial space by summing over the desired paths instead of having to carry out those exponential size matrix multiplications. For arbitrary inputs &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, you'd have to decompose it into the individual standard basis vectors and carry out the calculation for each &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; basis vector separately (erasing previous data as you proceed). Note the emphasized part in the following paragraph (from N&amp;amp;C) carefully, in case you're worried that there could be exponentially many paths to sum over.  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given that the individual unitary gates appearing in this sum are operations such as the Hadamard gate, CNOT, and so on, it is clear that each term in the sum can be calculated to high accuracy using only polynomial space on a classical computer, and thus the sum as a whole can be calculated using polynomial space, &lt;strong&gt;since individual terms in the sum can be erased after being added to the running total&lt;/strong&gt;. Of course, this algorithm is rather slow, since there are exponentially many terms in the sum which need to be calculated and added to the total; however, only polynomially much space is consumed, and thus &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP} \subseteq \mathsf{PSPACE}$&lt;/span&gt;, as we set out to show.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Exercise:&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Calculate the probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (upon measurement), in the first (top) qubit, for this circuit using the summation over paths methods explained above (and in N&amp;amp;C page 202). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ct41G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ct41G.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a hint. To get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on the top qubit you'd need either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; as the final composite state of the two qubits upon measurement. You can now calculate &lt;span class=&quot;math-container&quot;&gt;$\langle 00|U_2U_1|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle 01|U_2U_1|00\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U_1=H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_2 = \operatorname{CNOT}$&lt;/span&gt; using the method desribed in the first paragraph of N&amp;amp;C page 202 i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle y| U_{p(n)}...U_2U_1 |0\rangle = \sum_{x_1,...,x_{p(n)-1}} \langle y |U_{p(n)}|x_{p(n)-1}\rangle \langle x_{p(n)-1}|U_{p_{n-1}}... U_2|x_1\rangle \langle x_1|U_1|0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$|\langle 00|U_2U_1|00\rangle|^2+ |\langle 01|U_2U_1|00\rangle|^2$&lt;/span&gt; gives you the necessary probability. Luckily here we began in the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; rather than any arbitrary quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. Otherwise you'd have to repeat this calculation for all the basis states: &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; was &lt;span class=&quot;math-container&quot;&gt;$\alpha|00\rangle+\beta|01\rangle+\gamma|10\rangle + \delta |11\rangle$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, the final answer would have been &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\alpha\langle 00|U_2U_1|00\rangle|^2+ |\alpha\langle 01|U_2U_1|00\rangle|^2 + |\beta\langle 00|U_2U_1|01\rangle|^2+ |\beta\langle 01|U_2U_1|01\rangle|^2 +&#xA;|\gamma\langle 00|U_2U_1|10\rangle|^2+ |\gamma\langle 01|U_2U_1|10\rangle|^2 +&#xA;|\delta\langle 00|U_2U_1|11\rangle|^2+ |\delta\langle 01|U_2U_1|11\rangle|^2 $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This probability should be &lt;span class=&quot;math-container&quot;&gt;$\geq \frac{2}{3}$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$x\in\mathcal{A}_{\text{no}}$&lt;/span&gt;. Note that you don't have to do any full-fledged matrix multiplication here, as you would have to do in case you wanted to calculate &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}.H|00\rangle$&lt;/span&gt;. No unnecessary usage of exponential amount of space!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-04T22:01:10.513" LastActivityDate="2019-03-04T22:01:10.513" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5615" PostTypeId="2" ParentId="5586" CreationDate="2019-03-04T09:14:32.930" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q-sharp&lt;/a&gt; is a nice starting point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also I would suggest some general purpose mathematical language.&lt;br&gt;&#xA;&lt;a href=&quot;https://julialang.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Julia&lt;/a&gt; is really awesome. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-03-04T09:14:32.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5616" PostTypeId="2" ParentId="5598" CreationDate="2019-03-04T09:32:01.697" Score="3" Body="&lt;p&gt;Cloning means the generation of &lt;span class=&quot;math-container&quot;&gt;$|q\rangle|q\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|q\rangle|0\rangle$&lt;/span&gt;.  This is not what happens in teleportation. Teleportation is kind of a swap operation, i.e. something like &lt;span class=&quot;math-container&quot;&gt;$|q\rangle|0\rangle \to |0\rangle|q\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="26" LastEditDate="2019-03-04T16:11:58.927" LastActivityDate="2019-03-04T16:11:58.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5617" PostTypeId="2" ParentId="5608" CreationDate="2019-03-04T12:19:38.600" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So when you have an observable which is the measurement operator&#xA;  acting on the state you get a different result than in a different&#xA;  basis. What does it mean in physical terms?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;@glS has already explained the physics. I'll give an example of an observable: &lt;a href=&quot;https://en.wikipedia.org/wiki/Photon_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;photon polarization&lt;/a&gt;. You'll find an elaborate description &lt;a href=&quot;http://www.users.csbsju.edu/~frioux/polarize/POLAR-sup.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Measurements in this context would simply mean passing the photons through linear polarizers (in various orientations). If you can write the out the quantum state, using any appropriate orthogonal basis (one basis vector would be in the direction of the slit of linear polarizer and another would be in a direction orthogonal to it) you can predict the percentage of photons that will come out of the polarizers. You can compare the results with &lt;a href=&quot;https://en.wikipedia.org/wiki/Polarizer#Malus%27s_law_and_other_properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;Malus' law&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does that mean writing your space operation in different style could collapse your state to something different?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not exactly sure what you mean by &quot;space operation&quot; (measurement is not an operator!), but I &lt;em&gt;think&lt;/em&gt; you're on the right track. If you measure the observable in a certain basis (say, pass any arbitrary linearly polarized light through a horizontal-vertical dual polarizer), the photons which will pass through the polarizer will either be horizontally polarized or vertically polarized. Similarly, if you pass any arbitrary linearly polarized light through a diagonal-antidiagonal dual polarizer the photons which will pass through will either be &lt;a href=&quot;https://en.wikipedia.org/wiki/Jones_calculus#The_Jones_vector&quot; rel=&quot;nofollow noreferrer&quot;&gt;diagonally polarized or anti-diagonally polarized&lt;/a&gt;. Does this help with the intuition?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-04T14:56:14.713" LastActivityDate="2019-03-04T14:56:14.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5618" PostTypeId="1" AcceptedAnswerId="5658" CreationDate="2019-03-04T14:15:20.940" Score="3" ViewCount="123" Body="&lt;p&gt;I am interested in showing the validity of the Grover operator. Now there are several ways to show it. One way is with complete induction.&#xA;It has to be shown that the following relationship applies: &lt;span class=&quot;math-container&quot;&gt;$D_N=-H_n\cdot R_N \cdot H_n $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For induction proof I have already formulated the induction assumption and the induction condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Induction hypothesis: &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ D_N=-H_n\cdot R_N \cdot H_n, \quad D_N\text{ see Eq. 1 and } R_N \text{ see Eq. 2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$N=2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D_2 = -H\cdot R_2 \cdot H = -\frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;1\\1&amp;amp;-1\end{pmatrix}\cdot \begin{pmatrix}-1&amp;amp;0\\0&amp;amp;1\end{pmatrix}\cdot\frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;1\\1&amp;amp;-1\end{pmatrix} = \begin{pmatrix}0&amp;amp;1\\1&amp;amp;0\end{pmatrix}$$&lt;/span&gt;&#xA;Thus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D_2=\begin{pmatrix}0&amp;amp;1\\1&amp;amp;0\end{pmatrix}=\begin{pmatrix}0&amp;amp;1\\1&amp;amp;0\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Induction Prerequisite:&lt;/strong&gt;&#xA;For an arbitrary but fixed &lt;span class=&quot;math-container&quot;&gt;$N \in \mathbb N  $&lt;/span&gt; the statement applies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the induction step, I'm not sure if that's right. Here I need some support.&#xA;In the induction step we show the assertion for an &lt;span class=&quot;math-container&quot;&gt;$N + 1$&lt;/span&gt;. I am not sure if I have to show both &lt;span class=&quot;math-container&quot;&gt;$n + 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N + 1$&lt;/span&gt;.&#xA;At least this is the first idea for an induction step:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{N+1}=-H_{n+1}R_{N+1}H_{n+1}$$&lt;/span&gt;&#xA;This is an important statement that you probably need for the induction step:&#xA;&lt;span class=&quot;math-container&quot;&gt;$H_{n+1}$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$H_1\otimes H_n=\frac{1}{\sqrt{2}}\begin{pmatrix}H_n&amp;amp;H_n\\H_n&amp;amp;-H_n\end{pmatrix}$&lt;/span&gt;&#xA;then you would have first:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D_{N+1}=-\frac{1}{\sqrt{2}}\begin{pmatrix}H_n&amp;amp;H_n\\H_n&amp;amp;-H_n\end{pmatrix}\cdot R_{N+1}\cdot \frac{1}{\sqrt{2}}\begin{pmatrix}H_n&amp;amp;H_n\\H_n&amp;amp;-H_n\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm stuck with this step. I am grateful for the answers and hope that the question is clear and understandable.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Appendix:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 1:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D_N = \begin{pmatrix}-1+\frac{2}{N}&amp;amp;\frac{2}{N}&amp;amp;...&amp;amp;\frac{2}{N}\\\frac{2}{N}&amp;amp;-1+\frac{2}{N}&amp;amp;...&amp;amp;\frac{2}{N}\\\vdots&amp;amp;\vdots&amp;amp;\ddots&amp;amp;\vdots\\\frac{2}{N}&amp;amp;\frac{2}{N}&amp;amp;...&amp;amp;-1+\frac{2}{N}\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 2:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_N=\begin{pmatrix}-1&amp;amp;0&amp;amp;...&amp;amp;0\\0&amp;amp;1&amp;amp;\ddots&amp;amp;\vdots\\\cdots&amp;amp;\ddots&amp;amp;\ddots&amp;amp;0\\0&amp;amp;...&amp;amp;0&amp;amp;1\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 3:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$N=2^n$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="55" LastEditDate="2019-04-14T14:45:21.320" LastActivityDate="2019-04-14T14:45:21.320" Title="Proof that Grover's operator can be written as $D_N=-H_n R_N H_n$" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5619" PostTypeId="1" AcceptedAnswerId="5621" CreationDate="2019-03-04T14:38:25.600" Score="4" ViewCount="67" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer (Shor, 1995)&lt;/a&gt; [p. 15]&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To find a factor of an odd number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, given a method for computing the order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, choose a random &lt;span class=&quot;math-container&quot;&gt;$x \pmod n$&lt;/span&gt;, find its order, and compute &lt;span class=&quot;math-container&quot;&gt;$\text{gcd}(x^{\frac{r}{2}}-1,n)$&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$\text{gcd}(a,b)$&lt;/span&gt; is the greatest common divisor of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, i.e., the largest integer that divides both &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. The Euclidean algorithm [Knuth 1981] can be used to compute &lt;span class=&quot;math-container&quot;&gt;$\text{gcd}(a,b)$&lt;/span&gt; in polynomial time. Since &lt;span class=&quot;math-container&quot;&gt;$$(x^{\frac{r}{2}}+1)(x^{\frac{r}{2}}-1) \equiv 0 \pmod n,$$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\text{gcd}(x^{\frac{r}{2}}-1, n)$&lt;/span&gt; fails to be a non-trivial divisor of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; only if &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is odd or if &lt;span class=&quot;math-container&quot;&gt;$x^{\frac{r}{2}} \equiv -1 \pmod n$&lt;/span&gt;. Using this criterion, it can be shown that this procedure, when applied to a random &lt;span class=&quot;math-container&quot;&gt;$x \pmod n$&lt;/span&gt;, yeilds a factor of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1-2^{k-1}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the number of distinct odd prime factors of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. A brief sketch of the proof of this result follows. Suppose that &lt;span class=&quot;math-container&quot;&gt;$n = \prod_{i=1}^{k} p_i^{a_i}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; be the order of &lt;span class=&quot;math-container&quot;&gt;$x \pmod {p_i^{a_i}}$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the least common multiple of all &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;. Consider the largest power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; dividing each &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;. The algorithm only fails &lt;strong&gt;if all these powers of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; agree&lt;/strong&gt;: if they are all &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is odd and &lt;span class=&quot;math-container&quot;&gt;$\frac{r}{2}$&lt;/span&gt; does not exist; &lt;strong&gt;if they are all equal and larger than &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&lt;/strong&gt;, then &lt;span class=&quot;math-container&quot;&gt;$x^{\frac{r}{2}} \equiv -1 \pmod n$&lt;/span&gt; &lt;strong&gt;since &lt;span class=&quot;math-container&quot;&gt;$x^{\frac{r}{2}} \equiv -1 \pmod {p_i^{a_i}}$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&lt;/strong&gt;.  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know that in factoring algorithms the general idea is that if we can obtain &lt;span class=&quot;math-container&quot;&gt;$b^2\equiv c^2 \pmod n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b\not\equiv \pm c\pmod n$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\gcd(b+c,n)$&lt;/span&gt; will be a non-trivial factor of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. So far so good. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then it is not clear to me why &lt;span class=&quot;math-container&quot;&gt;$x^{\frac{r}{2}} \equiv -1 \pmod {p_i^{a_i}}$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, in this context. It doesn't seem to logically follow from &quot;all these powers of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; (i.e. the highest powers of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; that divide each &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;) agree&quot; and &quot;if they are all equal and larger than &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm probably missing something. Could someone clarify?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related:&lt;/strong&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1808/shors-algorithm-caveats-when-ar-2-1-mod-n&quot;&gt;Shor&amp;#39;s algorithm caveats when $a^{r/2} =-1 \mod N$&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-04T21:21:36.060" LastActivityDate="2019-03-04T21:21:36.060" Title="How does $x^{\frac{r}{2}} \equiv -1 \pmod {p_i^{a_i}}$ follow from &quot;if all these powers of $2$ agree&quot;?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5620" PostTypeId="1" CreationDate="2019-03-04T15:09:16.007" Score="4" ViewCount="161" Body="&lt;p&gt;I have been reading &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308098&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; but don't yet understand how to implement a circuit to determine in which state the qubit is &lt;em&gt;not&lt;/em&gt; for a cyclic POVM. More specifically, I want to implement a cyclic POVM with &lt;span class=&quot;math-container&quot;&gt;$m=3$&lt;/span&gt;;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: I came across having to implement this unitary matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;   M=&#xA;  \frac{1}{\sqrt{2}}\left[ {\begin{array}{cc}&#xA;   1 &amp;amp; 1 \\&#xA;   1 &amp;amp; w \\&#xA;  \end{array} } \right]&#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; is a third root of unity using rotations, after which I am stuck.&lt;/p&gt;&#xA;" OwnerUserId="5954" LastEditorUserId="55" LastEditDate="2020-08-22T05:54:33.753" LastActivityDate="2020-08-22T05:54:33.753" Title="POVM three-qubit circuit for symmetric quantum states" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5621" PostTypeId="2" ParentId="5619" CreationDate="2019-03-04T15:35:19.143" Score="3" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the least common multiple of the &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;, then for each &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; there is an integer &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$r=r_is_i$&lt;/span&gt;. If at least one of the &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; is even, then so is &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, which we need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, if all the &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; agree on the powers of 2 dividing the &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; contains the same number of powers of 2, and &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; must be odd. Hence, for each &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x^{r/2}\text{ mod }p_i^{a_i}=(x^{r_i/2})^{s_i}\text{ mod }p_i^{a_i}&#xA;$$&lt;/span&gt;&#xA;Now, we know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x^{r_i}-1=(x^{r_i/2}+1)(x^{r_i/2}-1)\equiv 0\text{ mod }p_i^{a_i}&#xA;$$&lt;/span&gt;&#xA;but &lt;span class=&quot;math-container&quot;&gt;$x^{r_i/2}-1$&lt;/span&gt; is not 0 modulo &lt;span class=&quot;math-container&quot;&gt;$p_i^{a_i}$&lt;/span&gt; because otherwise the order would be &lt;span class=&quot;math-container&quot;&gt;$r_i/2$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;. So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x^{r/2}\text{ mod }p_i^{a_i}=(-1)^{s_i}\text{ mod }p_i^{a_i}=(-1)\text{ mod }p_i^{a_i}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-04T15:35:19.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5622" PostTypeId="2" ParentId="5620" CreationDate="2019-03-04T16:00:45.823" Score="5" Body="&lt;p&gt;This is not the unitary that you have to implement: you need a two-qubit unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{3}}\left(\begin{array}{cccc}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; \omega &amp;amp; \omega^2 &amp;amp; 0 \\&#xA;1 &amp;amp; \omega^2 &amp;amp; \omega &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \sqrt{3}&#xA;\end{array}\right),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2i\pi/3}$&lt;/span&gt;, the point being that if you introduce an ancilla qubit in the state 0, apply this unitary, and then measure in the computational basis, the 3 measurement outcomes 00, 01 and 10 correspond to the 3 POVM elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't (yet) have a circuit implementation for this. You'll see the paper you cite carefully avoids talking about the Fourier transform in non-power of 2 dimensions. You certainly could use the standard constructions based on Givens rotations, but the result is going to be fairly horrible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an attempt at a circuit. I've made a few tweaks since I last ran it through a computer to check, so it's always possible that a slight error has crept in, but broadly...&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4P3xV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4P3xV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Here, I'm using &lt;span class=&quot;math-container&quot;&gt;$Z^r$&lt;/span&gt; to denote&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\pi r} \end{array}\right),&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V=\frac{1}{\sqrt{3}}\left(\begin{array}{cc}&#xA;1 &amp;amp; \sqrt{2} \\ -\sqrt{2} &amp;amp; 1&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-03-04T19:46:49.683" LastActivityDate="2019-03-04T19:46:49.683" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5623" PostTypeId="1" AcceptedAnswerId="5643" CreationDate="2019-03-04T19:40:15.890" Score="1" ViewCount="89" Body="&lt;p&gt;&lt;sup&gt;This is a sequel to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5619/how-does-x-fracr2-equiv-1-pmod-p-ia-i-follow-from-if-all-these&quot;&gt;How does $x^{\frac{r}{2}} \equiv -1 \pmod {p_i^{a_i}}$ follow from &amp;quot;if all these powers of $2$ agree&amp;quot;?&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer (Shor, 1995)&lt;/a&gt; [p. 16]&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The multiplicative group (mod &lt;span class=&quot;math-container&quot;&gt;$p^\alpha$&lt;/span&gt;) for any odd prime power &lt;span class=&quot;math-container&quot;&gt;$p^\alpha$&lt;/span&gt; is cyclic [Knuth 1981], so for any odd prime power &lt;span class=&quot;math-container&quot;&gt;$p_i^{a_i}$&lt;/span&gt;, the probability is at most 1/2 of choosing an &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; having any&#xA;  particular power of two as the largest divisor of its order &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt;. Thus each of these powers of 2 has at most a 50% probability of agreeing with the previous ones, so all k of them agree with probability at most &lt;span class=&quot;math-container&quot;&gt;$1/2^{k−1}$&lt;/span&gt;, and there is at least a &lt;span class=&quot;math-container&quot;&gt;$1 - 1/2^{k-1}$&lt;/span&gt; chance that the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; we choose is good. This scheme will thus work as long as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is odd and not a prime power; finding factors of prime powers can be done efficiently with classical methods.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is the probability of choosing an &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; having any particular power of two as the largest divisor of its order &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; &lt;strong&gt;at most&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is the probability of each of these powers of 2 agreeing with the previous &lt;strong&gt;at most&lt;/strong&gt; 50%?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related:&lt;/strong&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4912/expected-repetitions-of-the-quantum-part-of-shors-algorithm&quot;&gt;Expected repetitions of the quantum part of Shor&amp;#39;s algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-03-08T18:09:39.950" Title="Confusion regarding probability of period resulting in factoring" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5624" PostTypeId="1" AcceptedAnswerId="5625" CreationDate="2019-03-04T21:43:00.327" Score="0" ViewCount="78" Body="&lt;p&gt;In the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quadratic_sieve&quot; rel=&quot;nofollow noreferrer&quot;&gt;quadratic sieve&lt;/a&gt; algorithm, the idea is to find &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^2 \equiv b^2 \bmod n$&lt;/span&gt;. We need that &lt;span class=&quot;math-container&quot;&gt;$a\not\equiv \pm b \bmod n$&lt;/span&gt;. However, there the &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is not necessarily &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\gcd(b \pm c,n)$&lt;/span&gt; returns &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2452/26&quot;&gt;non-trivial&lt;/a&gt; factors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in Shor's algorithm, we &lt;em&gt;specifically&lt;/em&gt; need to find square roots of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (in modulo &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) i.e. we look for &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^2 \equiv 1 \bmod n$&lt;/span&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is &lt;em&gt;specifically&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Why is this choice necessary?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Related:&lt;/strong&gt; &lt;a href=&quot;https://math.stackexchange.com/questions/2856758/chinese-remainder-theorem-four-square-roots-of-1-modulo-n&quot;&gt;Math SE: Chinese Remainder Theorem: four square roots of 1 modulo N&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-04T21:51:13.433" LastActivityDate="2019-03-04T23:12:25.180" Title="Why do we search for square roots of 1 in Shor's algorithm unlike the qudratic sieve?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5625" PostTypeId="2" ParentId="5624" CreationDate="2019-03-04T23:12:25.180" Score="1" Body="&lt;p&gt;The two problems are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you give me a pair &lt;span class=&quot;math-container&quot;&gt;$a, b$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^2 = b^2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$a \neq \pm b$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$c = a b^{-1}$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$c \neq \pm 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you give me a &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$c^2 = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c \neq \pm 1$&lt;/span&gt;, and some target value &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$b = a \cdot c$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$a^2 = b^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a \neq \pm b$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can derive a square root of 1 from an &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; pair. You can derive an &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; pair with desired &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; from a square root of 1. They're reducible to each other.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-03-04T23:12:25.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5626" PostTypeId="1" AcceptedAnswerId="5627" CreationDate="2019-03-05T05:43:36.093" Score="2" ViewCount="103" Body="&lt;p&gt;Define a quantum algorithm that computes the maximum of two n-qubit registers.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;From Quantum Computing: A Gentle Introduction (Eleanor Rieffle &amp;amp; Wolfgang Polak), exercise 6.4.a (page 121).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know how to do this classically using bit logic and a signed bit, but I don’t think there are signed bits in quantum computing. I think the answer should be pretty straight forward but I have no idea what to do.&lt;/p&gt;&#xA;" OwnerUserId="5961" LastEditorUserId="26" LastEditDate="2019-03-30T07:45:56.640" LastActivityDate="2019-03-30T07:45:56.640" Title="Computing max of 2, length n bit registries" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5627" PostTypeId="2" ParentId="5626" CreationDate="2019-03-05T08:41:02.780" Score="2" Body="&lt;p&gt;I will not give you the exact answer but here are some hints:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You already know how to perform the addition (mod &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;) of 2 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum registers (section 6.4.3).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's say you want to compare &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; stored in binary in registers, &lt;strong&gt;if the most significant bit of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is 0&lt;/strong&gt;, then the most significant bit of &lt;span class=&quot;math-container&quot;&gt;$a-b (\text{mod} \ 2^n)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$a &amp;lt; b$&lt;/span&gt; (the subtraction is done with unsigned integer, the result should be interpreted as a unsigned integer in the previous sentence).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Exercise 6.4.b statement &lt;em&gt;may&lt;/em&gt; help you understand. For those who do not have the book:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Exercise 6.4.b:&lt;/strong&gt; Explain why such an algorithm requires one additional qubit that cannot be reused; that is, the algorithm will have to have &lt;span class=&quot;math-container&quot;&gt;$2n+1$&lt;/span&gt; input and output qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-03-05T08:41:02.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5628" PostTypeId="2" ParentId="5626" CreationDate="2019-03-05T08:42:41.950" Score="1" Body="&lt;p&gt;A simple solution I can think of is use a comparator circuit. If &lt;span class=&quot;math-container&quot;&gt;$a&amp;lt;b$&lt;/span&gt;, this will output 1 in another qubit register. You can then put &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in another register using Toffolis with this qubit as control if you want the result in another register.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2019-03-05T10:13:32.587" LastActivityDate="2019-03-05T10:13:32.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5629" PostTypeId="1" CreationDate="2019-03-05T10:41:53.807" Score="5" ViewCount="497" Body="&lt;p&gt;I'm working on solving a linear system with the quantum algorithm HHL. I don't understand how I can recover my vector &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; of real solution of the system starting from the states measured with ancilla qubit in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&#xA;I found something about using tomography but I don't know how to apply it successfully to my circuit with Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone help me? Many thanks.&lt;/p&gt;&#xA;" OwnerUserId="5963" LastEditorUserId="26" LastEditDate="2019-03-30T07:51:54.480" LastActivityDate="2019-03-30T07:51:54.480" Title="Quantum algorithm for linear system of equations (HHL) - Final Step: How can I find my vector of solution $|x\rangle$?" Tags="&lt;qiskit&gt;&lt;hhl-algorithm&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5630" PostTypeId="2" ParentId="5629" CreationDate="2019-03-05T12:37:47.587" Score="2" Body="&lt;p&gt;&lt;strong&gt;Quick answer:&lt;/strong&gt; You will not be able to fully recover &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Explanations:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;By design, the HHL algorithm stores &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in the amplitudes of a quantum state. Because of how quantum mechanics works, the vector representing the quantum state (i.e. containing all the amplitudes of the quantum state) needs to be of unit-norm (according to the Euclidean norm). Because of this, the result stored in the amplitudes of your quantum state is (most of the time) not &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt; but rather &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle = \frac{\vec{x}}{\vert\vert\vec{x}\vert\vert}$&lt;/span&gt;. Also because quantum states are defined up to a global-phase, the most general expression of the &quot;solution&quot; of the linear system stored in the amplitudes is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert x \rangle = e^{i\phi}\frac{\vec{x}}{\vert\vert\vec{x}\vert\vert}.$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As said in point 1, the HHL algorithm stores the result of the linear system provided by the user in the amplitudes of a quantum state. The problem is that these amplitudes are not directly measurable. You can measure the value of your qubits and the measured value will depend (probabilistically) on the underlying amplitudes, but you can't measure the amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to approximate the amplitudes (up to a global phase) is to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum state tomography&lt;/a&gt;. Here are some links related to quantum state tomography in Qiskit:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/ignis/state_tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;A tutorial about quantum state tomography with Qiskit&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/tools/qcvv/tomography.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code in qiskit-terra&lt;/a&gt; along with &lt;a href=&quot;https://qiskit.org/documentation/autodoc/qiskit.tools.qcvv.tomography.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the generated documentation&lt;/a&gt;. &lt;strong&gt;Warning&lt;/strong&gt;: the two previous link may be deprecated in the future, I think the aim is to implement the tomography procedures &lt;a href=&quot;https://github.com/Qiskit/qiskit-ignis/tree/master/qiskit/ignis/verification/tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (but I am not sure).&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-03-05T12:37:47.587" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5631" PostTypeId="2" ParentId="5520" CreationDate="2019-03-05T13:02:32.557" Score="-4" Body="&lt;p&gt;The original answer did not address the observation that CHSH calculates &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; from 2 different scenarios, then uses them interchangeably.  A technique that allows the generation of impossible results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bell’s Inequality is valid for Correlation Coefficients and the CHSH Inequality is computed the same way as Bell’s, that is &lt;span class=&quot;math-container&quot;&gt;$S = ab – ad + cb + cd$&lt;/span&gt; where a, b, c and d are the results of 4 runs of the experiment.  &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt; is the correlation coefficient of 1 run of the experiment.  The problem is that &lt;span class=&quot;math-container&quot;&gt;$E(a,b)$&lt;/span&gt; should become “&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;” in the S calculation, not &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5829" LastEditorUserId="5829" LastEditDate="2019-03-07T20:35:10.133" LastActivityDate="2019-03-07T20:35:10.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5632" PostTypeId="1" AcceptedAnswerId="5633" CreationDate="2019-03-05T13:11:52.627" Score="2" ViewCount="92" Body="&lt;p&gt;I need to implement a quantum comparator that, given a quantum register &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and a real number &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; &lt;strong&gt;known at generation time&lt;/strong&gt; (i.e. when the quantum circuit is generated), set a qubit &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; to the boolean value &lt;span class=&quot;math-container&quot;&gt;$(a &amp;lt; b)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I successfully implemented a comparator using 2 quantum registers as input by following &lt;a href=&quot;http://arxiv.org/abs/quant-ph/0410184v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;A new quantum ripple-carry addition circuit (Steven A. Cuccaro and Thomas G. Draper and Samuel A. Kutin and David Petrie Moulton, 2004)&lt;/a&gt;. This means that given two quantum registers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, the circuit set a qubit &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; to the boolean value &lt;span class=&quot;math-container&quot;&gt;$(a &amp;lt; b)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could use an ancilla quantum register that will be initialised to the constant value &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; I am interested in and then use the implementation I already have, but this sounds quite inefficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only gate that use the quantum register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; (the one fixed at generation time) is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ha5Wr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ha5Wr.png&quot; alt=&quot;MAJ gate as described by Cuccaro&amp;#39;s paper&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When this gate is used, the qubits of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are given as the second input (i.e. the middle line in the circuit representation above) and the value of each of the qubit of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is known at circuit generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there a way to remove completely the quantum register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; by encoding the constants values of each &lt;span class=&quot;math-container&quot;&gt;$b_i$&lt;/span&gt; in the quantum circuit generated?&lt;/li&gt;&#xA;&lt;li&gt;Can the fact of knowing the value of the second entry of the gate at generation time be used to optimise the number of gates used (or their complexity)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I already have a partial answer for question n°2: the Toffoli gate may be simplified to one CX gate when &lt;span class=&quot;math-container&quot;&gt;$b_i = 1$&lt;/span&gt; and to the identity (i.e. no gate) when &lt;span class=&quot;math-container&quot;&gt;$b_i = 0$&lt;/span&gt;. There is still a problem with the first CX gate that prevent this optimisation, but this may be a track to follow?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-03-05T15:25:33.367" Title="Optimise implementation of a quantum algorithm when an input is fixed" Tags="&lt;gate-synthesis&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5633" PostTypeId="2" ParentId="5632" CreationDate="2019-03-05T15:25:33.367" Score="1" Body="&lt;p&gt;Let's answer my own question: it is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After some research I ended up computing the &quot;truth table&quot; for the two possible cases:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$b = 0$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle\rightarrow\vert 00 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 01 \rangle\rightarrow\vert 10 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 10 \rangle\rightarrow\vert 10 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 11 \rangle\rightarrow\vert 01 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$b = 1$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle\rightarrow\vert 00 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 01 \rangle\rightarrow\vert 11 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 10 \rangle\rightarrow\vert 11 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 11 \rangle\rightarrow\vert 01 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It is clearly visible in the above truth tables that the operation I want to produce is not reversible (two different input give the same output) and so not unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will have to find another algorithm to do what I am searching for. I am still open to suggestions on interesting algorithms.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-03-05T15:25:33.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5634" PostTypeId="1" AcceptedAnswerId="5663" CreationDate="2019-03-05T22:58:54.167" Score="4" ViewCount="118" Body="&lt;p&gt;So far what I have learned is that von-Neumann entropy is a tool to measure or quantify information and therefore entanglement for a given pure state system. However, similar concepts emerge from the task of measuring entanglement in general, which would be entanglement cost and distillable entanglement.&#xA;My question is what are the similarities and divergences of these concepts with von-Neumann entropy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reference from which I spotted this question is from &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0504163.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5823" LastEditorUserId="5823" LastEditDate="2019-03-08T14:34:19.030" LastActivityDate="2019-03-08T14:34:19.030" Title="What do entanglement cost and distillable entanglement have to do with measuring entanglement?" Tags="&lt;entanglement&gt;&lt;entropy&gt;&lt;state-distillation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5635" PostTypeId="1" AcceptedAnswerId="5636" CreationDate="2019-03-06T02:27:07.813" Score="4" ViewCount="326" Body="&lt;p&gt;What language is more suitable for quantum machine learning algorithms? Is it right that it's Python + Pyquil? Or something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And do you know the sources where you can see the sample codes of different quantum ML algorithms if it exists? I didn't find anything.&lt;/p&gt;&#xA;" OwnerUserId="5876" LastEditorUserId="26" LastEditDate="2019-03-06T05:07:50.707" LastActivityDate="2019-11-19T22:56:38.890" Title="What language is more suitable for quantum machine learning algorithms?" Tags="&lt;programming&gt;&lt;resource-request&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5636" PostTypeId="2" ParentId="5635" CreationDate="2019-03-06T05:22:12.583" Score="7" Body="&lt;p&gt;One can recommend &lt;a href=&quot;https://pennylane.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PennyLane&lt;/a&gt; by Xanadu.AI. You can find complete examples of quantum machine learning algorithms (e.g. Iris Classification), using hybrid quantum-classical computations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, they offer built-in &lt;a href=&quot;https://pennylane.ai/plugins.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugins&lt;/a&gt; for IBM QisKit, Pyquil etc., to enable running Pennylane QML codes on IBM and Rigetti quantum hardwares.&lt;/p&gt;&#xA;" OwnerUserId="4954" LastEditorUserId="9118" LastEditDate="2019-11-19T22:56:38.890" LastActivityDate="2019-11-19T22:56:38.890" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5637" PostTypeId="1" AcceptedAnswerId="5639" CreationDate="2019-03-06T08:49:06.133" Score="1" ViewCount="89" Body="&lt;p&gt;When we expand the Ising model we have one component with 3 qbits like Q1Q2Q3. But in qubo file we can only set coupling for 2 qbit only. How should I set this 3-qbit element to qubo file? &lt;/p&gt;&#xA;" OwnerUserId="5968" LastEditorUserId="26" LastEditDate="2019-03-06T15:13:49.303" LastActivityDate="2019-03-06T15:13:49.303" Title="Q1Q2Q3 coupling in qubo file" Tags="&lt;annealing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5638" PostTypeId="1" AcceptedAnswerId="5641" CreationDate="2019-03-06T11:59:46.073" Score="3" ViewCount="125" Body="&lt;p&gt;In superconducting quantum computing resonators are typically an LC circuit. If L and C are fixed the resonator will have a fixed resonance frequency. However, I heard that in the group of Prof. John Martinis they are using a different type of resonators that their frequency is tunable. The tunability is somehow possible by applying a DC flux bias. Can anyone elaborate on the subject? How does it work? Usages?  &lt;/p&gt;&#xA;" OwnerUserId="5811" LastEditorUserId="55" LastEditDate="2019-03-07T13:07:57.173" LastActivityDate="2019-03-07T15:33:40.340" Title="How do frequency-tunable microwave resonators work?" Tags="&lt;physical-realization&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5639" PostTypeId="2" ParentId="5637" CreationDate="2019-03-06T12:06:00.663" Score="1" Body="&lt;p&gt;You need to introduce ancillary variables and minimize over them; which would enable you to have a QUBO form with only pairing terms. For example, if your binary variables are called &lt;span class=&quot;math-container&quot;&gt;$ x,y,z $&lt;/span&gt; and you have a &lt;span class=&quot;math-container&quot;&gt;$ a*xyz $&lt;/span&gt; term with the coefficient &lt;span class=&quot;math-container&quot;&gt;$ a$&lt;/span&gt;, you can use a technique of reduction by minimum selection where you introduce another variable &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; such that this becomes a QUBO again:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}\begin{aligned}axyz = aw ( x+y+z -2) \quad a&amp;lt;0\\axyz = a \left\{ w ( x+y+z -1) + (xy+yz+zx) - (x+y+z) +1 \right\} \quad a&amp;gt;0\end{aligned}\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is explained in the D-Wave documentation.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-03-06T12:06:00.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5640" PostTypeId="1" CreationDate="2019-03-06T13:43:06.730" Score="4" ViewCount="114" Body="&lt;p&gt;In quantum physics, because of the no-cloning theorem, lots of classical proofs of cryptographic problems cannot be turned into quantum proofs (rewinding is usually not possible quantumly). A dream theorem would be the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Dream theorem&lt;/strong&gt;: Let C be a circuit on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits made of a polynomial (in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) number of 1-qubit and 2-qubits gates (say &lt;span class=&quot;math-container&quot;&gt;$H, T, Ctrl-X)$&lt;/span&gt;. Now, run this circuit on input &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;, and measure the first &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits in computational basis, giving you the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle\otimes |\phi\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$y \in \{0,1\}^k$&lt;/span&gt;. Then, there exists a circuit &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt; with a polynomial number of gates such that &lt;span class=&quot;math-container&quot;&gt;$C' |0\rangle^{\otimes (n-k)} = |\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Do you have any argument to say that this theorem is true? Or wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note 1: it would also be great to have &quot;only&quot; an approximate version of this, with &lt;span class=&quot;math-container&quot;&gt;$C' |0\rangle^{\otimes n}$&lt;/span&gt; being exponentially close to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note 2: Note that computing &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt; given &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; should be very hard to do (as soon as PostBQP != BQP), because otherwise it would be more or less equivalent to perform post-selection. But I don't mind, I don't need a constructive proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note 3: This does not directly contradict the theorem (coming from &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0111031.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harrow, Recht and Chuang&lt;/a&gt;?) that states that to produce any state &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt; qubits, up to precision &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;, you need &lt;span class=&quot;math-container&quot;&gt;$O(2^{2(n-k)}\log(1/\varepsilon))$&lt;/span&gt; gates&quot;, as here &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is quite specific and needs to be produced by a polynomial unitary + measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My intuition on why of course it's true/wrong:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note 4: One intuition to say that it's not true would be to take a pseudo-random function &lt;span class=&quot;math-container&quot;&gt;$h : \{0,1\}^{2l} \rightarrow \{0,1\}^{l}$&lt;/span&gt; (say based on sha hash functions), and implement the unitary &lt;span class=&quot;math-container&quot;&gt;$U_h(H^{\otimes2l}|0\rangle^{\otimes 2l})\otimes|0\rangle^{\otimes l} = \sum_{x \in \{0,1\}^{2l}} |x\rangle |h(x)\rangle = \sum_{y \in \{0,1\}^{l}} (\sum_{x \in f^{-1}(y) }|x\rangle) |y\rangle$&lt;/span&gt; and measure the second register, giving &lt;span class=&quot;math-container&quot;&gt;$(\sum_{x \in f^{-1}(y) }|x\rangle) |y\rangle$&lt;/span&gt;, and then see that if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is truly random the left register seems impossible to generate in polynomial time as it contains an exponential number of elements. But the thing is that it's not even possible to have truly random functions in polynomial time, so the argument does not really work, as for polynomial &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; an underlying simple representation may exist to efficiently reproduce this state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note 5: on the other hand, it seems plausible that the coefficient of the matrix of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; are &quot;simple enough&quot; as they are generated from a small circuit, and therefore could be reproduced. I tried to see how to &quot;backpropagate&quot; a measurement in the circuit, by trying to generate lots of possible sub-matrices, and for now I didn't reached a fixed point... but maybe I will at some point!&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="55" LastEditDate="2019-03-07T13:09:56.773" LastActivityDate="2019-03-12T12:36:07.270" Title="Rewrite circuit with measurements with unitaries" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5641" PostTypeId="2" ParentId="5638" CreationDate="2019-03-06T16:03:55.957" Score="3" Body="&lt;p&gt;There's a superconducting circuit element called Josephson junction, which is roughly a nonlinear inductor.&#xA;The inductance of a Josephson junction depends on current via the relation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$L(I) = \frac{L_0}{\sqrt{1 - (I/I_c)^2}}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$L_0$&lt;/span&gt; is the inductance of the junction with no bias current and &lt;span class=&quot;math-container&quot;&gt;$I_c$&lt;/span&gt; is the so-called &quot;critical current&quot; which is the maximum current that can pass through the junction before it stops being superconducting.&#xA;The resonance frequency of an LC resonator is &lt;span class=&quot;math-container&quot;&gt;$\omega_0 = 1 / \sqrt{LC}$&lt;/span&gt;, so if you change &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; you change the resonance frequency.&#xA;Therefore, if you can include a Josephson junction into the resonator, you have a current-dependent resonance frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often, we use a &lt;a href=&quot;https://en.wikipedia.org/wiki/SQUID#DC_SQUID&quot; rel=&quot;nofollow noreferrer&quot;&gt;dc SQUID&lt;/a&gt;, which is two junctions connected in parallel, instead of a single junction.&#xA;When you put some magnetic flux through the SQUID loop, it puts current through the two junctions and changes their inductance, therefore shifting the resonance frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's pretty much how most modern superconducting qubits are frequency tuned.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="32" LastEditDate="2019-03-07T15:33:40.340" LastActivityDate="2019-03-07T15:33:40.340" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5642" PostTypeId="1" AcceptedAnswerId="5649" CreationDate="2019-03-06T17:13:34.803" Score="2" ViewCount="108" Body="&lt;p&gt;I saw that the Pauli matrices really work, that's rotating a state by 180 degrees, only if you take the density matrix for example with X it only works if first we take X &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;  and multiply it by itself dagger. Then you can see it rotating around the X-axis. Same with Y and Z.&#xA;Also, in error correction, you use the R mapping only after you created a density matrix, but you don't use it on the vector state itself. Why is it? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="1837" LastEditDate="2019-03-07T08:48:49.183" LastActivityDate="2019-03-07T08:48:49.183" Title="Why is it that the Pauli matrices and error correction operator act only on $|\psi\rangle\langle \psi|$ and not on state vector $|\psi\rangle$ itself?" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5643" PostTypeId="2" ParentId="5623" CreationDate="2019-03-06T17:46:50.900" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$m = p_{i}^{a_i-1}(p_i-1)$&lt;/span&gt; – the order of our multiplicative group.&#xA;Cyclic group means there is a primitive element &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; with the order equals to the size of the group, that is &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. Moreover, the cyclic group consists of the elements &lt;span class=&quot;math-container&quot;&gt;$a^1, a^2, ... , a^m=1$&lt;/span&gt;.  The order of the element &lt;span class=&quot;math-container&quot;&gt;$a^k$&lt;/span&gt; is exactly &lt;span class=&quot;math-container&quot;&gt;$m/\text{gcd}(m, k)$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$m/\text{gcd}(m, k)$&lt;/span&gt; has a particular power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; as its largest divisor, then &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; has corresponding particular power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.  All numbers &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, i.e. numbers from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, are split into sets by this power value. And the largest set can't have more than &lt;span class=&quot;math-container&quot;&gt;$m/2$&lt;/span&gt; elements, because there is a set with all odd numbers &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, with a size of &lt;span class=&quot;math-container&quot;&gt;$m/2$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because the probability of observing two same results in two experiments is &lt;span class=&quot;math-container&quot;&gt;$$P_1 \cdot P_1 + P_2\cdot P_2 + ... + P_j\cdot P_j,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$(P_1,...,P_j)$&lt;/span&gt; – is the probability distribution for events. Since every &lt;span class=&quot;math-container&quot;&gt;$P_i \leq 1/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1+..+P_j = 1$&lt;/span&gt;, that total expression is also &lt;span class=&quot;math-container&quot;&gt;$ \leq 1/2 $&lt;/span&gt; (observe that &lt;span class=&quot;math-container&quot;&gt;$P_i\cdot P_i \leq P_i/2$&lt;/span&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-03-08T18:09:39.950" LastActivityDate="2019-03-08T18:09:39.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5644" PostTypeId="2" ParentId="5620" CreationDate="2019-03-06T18:37:42.343" Score="2" Body="&lt;p&gt;Check this&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{3}}\left(\begin{array}{ccc}&#xA;1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; \omega &amp;amp; \omega^2 \\&#xA;1 &amp;amp; \omega^2 &amp;amp; \omega \\&#xA;\end{array}\right) = \left(\begin{array}{cc}&#xA;H &amp;amp; 0 \\&#xA;0 &amp;amp; 1 \\&#xA;\end{array}\right) \cdot \frac{1}{\sqrt{3}}\left(\begin{array}{ccc}&#xA;\sqrt{2} &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; \sqrt{3} &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; -\sqrt{2} \\&#xA;\end{array}\right) \cdot &#xA;M_{3}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M_{3} = \left(\begin{array}{ccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \frac{1}{\sqrt{2}}i\omega^2 &amp;amp; \frac{1}{\sqrt{2}}i\omega \\&#xA;0 &amp;amp; -\frac{1}{\sqrt{2}}\omega^2 &amp;amp; -\frac{1}{\sqrt{2}}\omega \\&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left(\begin{array}{ccc}&#xA;i\omega^2 &amp;amp; i\omega \\&#xA;-\omega^2 &amp;amp; -\omega \\&#xA;\end{array}\right) = X \cdot S \cdot X \cdot Z \cdot H \cdot \left(\begin{array}{ccc}&#xA;\omega^2 &amp;amp; 0 \\&#xA;0 &amp;amp; \omega \\&#xA;\end{array}\right) \cdot Z&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-03-06T18:43:26.597" LastActivityDate="2019-03-06T18:43:26.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5645" PostTypeId="2" ParentId="5642" CreationDate="2019-03-06T21:11:00.197" Score="2" Body="&lt;p&gt;Most error correction schemes suppose that the transmitted vector state becomes mixed on the receiver end. For example, the transmitted state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; can turn to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p^2$&lt;/span&gt;, to &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; with prob &lt;span class=&quot;math-container&quot;&gt;$p(1-p)$&lt;/span&gt;, to &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; with prob &lt;span class=&quot;math-container&quot;&gt;$(1-p)p$&lt;/span&gt; and to &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; with prob &lt;span class=&quot;math-container&quot;&gt;$(1-p)^2$&lt;/span&gt;. So, the state in the end is a mixed state which can't be associated to a single vector state.&lt;br&gt;&#xA;You still can work with probability distributions of vector states instead of density matrices (and apply whatever rotations you like just on vectors), but generally this is not that fruitful. Density matrices capture the essence of the physical state. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-03-06T21:11:00.197" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5646" PostTypeId="1" AcceptedAnswerId="5650" CreationDate="2019-03-07T00:46:30.620" Score="3" ViewCount="68" Body="&lt;p&gt;Suppose I prepare following state consisting of (for example) three EPR pairs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\lvert\Psi\rangle = \frac{\lvert00\rangle+\lvert11\rangle}{\sqrt{2}}\otimes\frac{\lvert00\rangle+\lvert11\rangle}{\sqrt{2}}\otimes\frac{\lvert00\rangle+\lvert11\rangle}{\sqrt{2}}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I shuffle the second qubits of all pairs before giving you the full (shuffled) state. You would not know which pairs of qubits form EPR pairs. Does this mean you would have a mixed stated over all possible permutations? How can I write such state?&lt;/p&gt;&#xA;" OwnerUserId="5974" LastEditorUserId="26" LastEditDate="2019-03-08T16:20:34.923" LastActivityDate="2019-03-08T16:20:34.923" Title="EPR states with permuted qubits" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5647" PostTypeId="1" CreationDate="2019-03-07T01:22:22.013" Score="1" ViewCount="131" Body="&lt;p&gt;Why is it that copying an unknown qubit is impossible but creating a copy of the standard computational basis is possible by entangling it to existing qubits? And why one is possible and the other isn't? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-08T16:19:11.037" LastActivityDate="2019-03-08T16:19:11.037" Title="What does it mean that copying a state is impossible but creating a copy of by entangling is possible?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;no-cloning-theorem&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5648" PostTypeId="1" CreationDate="2019-03-07T04:36:09.957" Score="3" ViewCount="126" Body="&lt;p&gt;For example, if you ran the same program on the 'ibmqx2' and 'ibmqx4' computers, how much variance would there be between the results from both systems? There is the inherent presence of noise in each quantum computer, but this deals with the variance in results in a single computer. How can we compare the differences between each computer, if there is any variation?&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="26" LastEditDate="2019-03-08T16:16:58.907" LastActivityDate="2019-04-04T17:05:24.587" Title="How much variation is there in the results between each quantum computer on the IBMQ Quantum Experience system?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5649" PostTypeId="2" ParentId="5642" CreationDate="2019-03-07T08:44:04.443" Score="3" Body="&lt;p&gt;Describing the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix as a rotation by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; about a particular axis is specifically referring to how you would visualise the action of the gate with regards to the Bloch Sphere picture. This most naturally maps to the density matrix, which is why it's most apparent there. But you &lt;em&gt;can&lt;/em&gt; apply it to the pure state picture as well. Note that you can parametrise any single-qubit pure state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\cos\frac{\theta}{2}|0\rangle+\sin\frac{\theta}{2}e^{i\phi}|1\rangle.&#xA;$$&lt;/span&gt;&#xA;This has a Bloch vector of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec{n}=(\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's consider &lt;span class=&quot;math-container&quot;&gt;$X|\psi\rangle=e^{i\phi}\left(\cos\frac{\theta}{2}e^{-i\phi}|1\rangle+\sin\frac{\theta}{2}|0\rangle\right)=e^{i\phi}\left(\sin\left(\frac{\pi}{2}-\frac{\theta}{2}\right)e^{-i\phi}|1\rangle+\cos\left(\frac{\pi}{2}-\frac{\theta}{2}\right)|0\rangle\right)$&lt;/span&gt;. By the same mapping, this has a Bloch vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec{n}'=(\sin(\pi-\theta)\cos\phi,-\sin(\pi-\theta)\sin\phi,\cos(\pi-\theta))=(\sin\theta\cos\phi,-\sin\theta\sin\phi,-\cos(\theta)).&#xA;$$&lt;/span&gt;&#xA;This is exactly a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; rotation (or reflection) about the x axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In error correction, it's a completely different reason for using the density matrix - you're trying to deal with possible errors, and that means you need an ensemble of states (one for each possible error), not just a pure state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-07T08:44:04.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5650" PostTypeId="2" ParentId="5646" CreationDate="2019-03-07T08:47:54.483" Score="4" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$S_x$&lt;/span&gt; be a permutation between qubits 2,4 and 6, and acts as identity on the other qubits. Use &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to index all possible permutations of that form, of which there are 6. Then you do indeed have a mixed state overall, and it's of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\frac{1}{6}\sum_{x=1}^6S|\Psi\rangle\langle\Psi|S^T&#xA;$$&lt;/span&gt;&#xA;(Note that the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; matrix will be real so I can use the transpose in the place of the Hermitian conjugate).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-07T08:47:54.483" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5651" PostTypeId="2" ParentId="5647" CreationDate="2019-03-07T08:56:59.313" Score="3" Body="&lt;p&gt;The no cloning theorem can be stated in the form:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If you are given an unknown state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, which is promised to be one of a set of distinct states &lt;span class=&quot;math-container&quot;&gt;$\{|\phi_i\rangle\}$&lt;/span&gt;, it is impossible to create a second copy of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; if there is a pair of &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; which are not orthogonal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Computational basis states are orthogonal, so they're not covered by the theorem. Indeed, you want them to not be covered by the theorem because we can easily copy classical data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's a very obvious way that you can copy computational basis states. Start with your unknown qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, introduce an extra qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, and perform a controlled-not controlled off the first qubit. What do you get?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|0\rangle\mapsto|0\rangle|0\rangle\qquad|1\rangle|0\rangle\mapsto|1\rangle|1\rangle&#xA;$$&lt;/span&gt;&#xA;The state of the first qubit has been cloned. There's no entanglement in this process itself. Of course, controlled-not is an entangling gate, and this is the essence of the proof of no cloning (the actual proof requires taking care of a few more details): if we wish to clone a state in superposition as well as the possibility of these two basis states, then we know by linearity that if the above two maps hold, it must be that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\alpha|0\rangle+\beta|1\rangle)|0\rangle\mapsto\alpha|00\rangle+\beta|11\rangle.&#xA;$$&lt;/span&gt;&#xA;This is an entangled state, and not the separable state that you want, &lt;span class=&quot;math-container&quot;&gt;$(\alpha|0\rangle+\beta|1\rangle)(\alpha|0\rangle+\beta|1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-07T08:56:59.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5652" PostTypeId="1" AcceptedAnswerId="5654" CreationDate="2019-03-07T09:50:47.677" Score="3" ViewCount="251" Body="&lt;p&gt;I am reading the paper &lt;a href=&quot;https://arxiv.org/abs/0811.4262&quot; rel=&quot;nofollow noreferrer&quot;&gt;Restrictions on Transversal Encoded Quantum Gate Sets, Bryan Eastin, Emanuel Knill&lt;/a&gt;. I am unable to understand the following lines in the proof.     &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As the set of all unitary operators is a metric space, a finite number&#xA;  of unitary operators cannot approximate infinitely many to arbitrary&#xA;  precision&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I need some references or hints as to understand how the above-quoted lines. &lt;/p&gt;&#xA;" OwnerUserId="5977" LastEditorUserId="26" LastEditDate="2019-03-08T16:16:16.413" LastActivityDate="2019-03-08T16:16:16.413" Title="A question on Eastin-Knill theorem" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5653" PostTypeId="1" CreationDate="2019-03-07T09:50:49.083" Score="3" ViewCount="86" Body="&lt;p&gt;The &lt;a href=&quot;https://quest.qtechtheory.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuEST&lt;/a&gt; code allows for simulation of quantum computers taking dephasing and depolarizing noise into account via one and two qubit dephasing and depolarization. What are realistic parameters for such noise representing the current state-of-the-art of super-conducting or ion-trap quantum computers?&#xA;Are there similar options as in &lt;code&gt;qiskit.providers.aer.noise&lt;/code&gt; of the &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit&lt;/a&gt; package (as explained &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5132/how-can-noise-on-a-device-be-simulated-using-measured-noise-parameters/5133#5133&quot;&gt;here&lt;/a&gt;) to get parameters for other systems than IBM Q?&lt;/p&gt;&#xA;" OwnerUserId="5909" LastEditorUserId="26" LastEditDate="2019-03-08T16:15:36.277" LastActivityDate="2019-03-08T16:15:36.277" Title="What are reasonable noise/dephasing parameters for QuEST to emulate state-of-the-art quantum computers?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5654" PostTypeId="2" ParentId="5652" CreationDate="2019-03-07T10:27:05.217" Score="3" Body="&lt;p&gt;In their case, their finite set of unitary operators is closed under composition. They even have footnote that emphasizes this.&lt;br&gt;&#xA;You can't approximate infinite set by some finite subset with the error that is less than half the minimum distance between elements in this finite subset. This is like trying to approximate every real number from &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt; by some finite subset with arbitrary precision. It's impossible. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-03-07T10:27:05.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5655" PostTypeId="2" ParentId="5652" CreationDate="2019-03-07T10:30:53.293" Score="1" Body="&lt;p&gt;Probably the easiest way to think about this is to consider an equivalent statement for the real numbers. Consider the range &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;, for instance. You're given a finite set of real numbers within that range. If you think about these values on the number line, it should be fairly obvious that there are necessarily points that are a finite distance away, so I cannot use members of this set as arbitrarily accurate approximations for any real number in the range. (In this case, if your set contains &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; elements, it would be best to have them at values &lt;span class=&quot;math-container&quot;&gt;$(2i-1)/(2n)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; so that all real numbers in the range are within &lt;span class=&quot;math-container&quot;&gt;$1/(2n)$&lt;/span&gt; of some element in the set. But if you try to bunch some closer together, obviously other have to get further apart).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can make the same argument for any continuous space for which there is a distance measure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-07T10:30:53.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5656" PostTypeId="1" CreationDate="2019-03-07T10:47:21.593" Score="6" ViewCount="109" Body="&lt;p&gt;I have heard multiple times the claim that three rounds of syndrome measurement required for fault-tolerance in the surface code. I'm not sure what situation would require this, as I think less would suffice. Unfortunately, all these mentions were made in cases that I can't cite for you (like an off-hand comment), and I never followed up. But I wondered if anyone here might know what situation this is referring to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my claims that less would suffice, I am specifically imagining a surface code with standard &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma^x$&lt;/span&gt; type stabilizers, and for which the logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is composed of all &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt;s. I'm also assuming that it starts its life placing all physical qubits in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. This will result in the logical &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state once stabilizer measurements are performed. For a logical &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, a string of physical &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s is placed across the code. Measurement of the logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; can be done at readout time by measuring all physical qubits in the &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt;s basis. This provides information that can infer the final &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; value, as well as a final state for the &lt;span class=&quot;math-container&quot;&gt;$\sigma^x$&lt;/span&gt; stabilizers that can be used to correct it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we add in a single ancilla-assisted syndrome round between initialization and readout, we have something a bit more quantum. In the worst case, we could just ignore the results of these measurements. Then they just become an extra source of noise in the case described above. This extra noise wouldn't be enough to effect the fault-tolerance, even for distance 3. The case where we use the measurement results to decode should even be an improvement. And so on for the addition of more rounds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, I see nothing special about the case of three rounds with regards to fault-tolerance. So I guess these claims referred to a slightly different situation.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2019-03-08T16:14:57.857" LastActivityDate="2019-03-14T12:47:15.527" Title="In what situation are three rounds of syndrome measurement required for fault-tolerance in the surface code?" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;&lt;surface-code&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5657" PostTypeId="1" CreationDate="2019-03-07T12:24:45.073" Score="3" ViewCount="199" Body="&lt;p&gt;I have a set of numbers in a superposition state (example: &lt;code&gt;3,8,1,5&lt;/code&gt;) in a quantum register (of 3 qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I try to find the &lt;span class=&quot;math-container&quot;&gt;$n^{\text{th}}$&lt;/span&gt; smallest number (example the &lt;span class=&quot;math-container&quot;&gt;$2^{\text{nd}}$&lt;/span&gt; is 3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by exploring &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;nofollow noreferrer&quot;&gt;the algorithm of Durr-Hoyer&lt;/a&gt; for finding the minimum, but I do not really see a way out, because I have to do a measurement to find the 1st minimum and other difficulties such as amplitudes changed by Grover algorithm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help by telling me if it's possible to perform this computation in QC? And outline the procedure to follow to achieve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;N.B: In Qiskit, I initialize the register with the function: initialization with the desired state, setting the amplitudes of other states &lt;code&gt;(0,2,4,7)&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5862" LastEditorUserId="26" LastEditDate="2019-03-08T16:28:05.187" LastActivityDate="2019-03-08T16:28:05.187" Title="Finding the second smallest number. Is it achievable in QC?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5658" PostTypeId="2" ParentId="5618" CreationDate="2019-03-07T12:46:22.123" Score="1" Body="&lt;p&gt;For the proof by induction there isn't really much more than doing some algebra from the equations you already laid out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me write for simplicity &lt;span class=&quot;math-container&quot;&gt;$D_N\equiv -\mathbb 1_N + \frac{2}{N} \mathcal I_N$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathbb 1$&lt;/span&gt; denotes the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional identity matrix, while &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_N$&lt;/span&gt; denotes the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional matrix whose every element is 1: &lt;span class=&quot;math-container&quot;&gt;$(\mathcal I_N)_{ij}=1\forall i,j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We therefore want to prove that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D_N\equiv-\mathbb 1_N + \frac{2}{N} \mathcal I_N=-H_n R_N H_n.\tag A$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Proof by induction&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Assume &lt;strong&gt;(A)&lt;/strong&gt; to be true for some &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt;, and try to prove it for &lt;span class=&quot;math-container&quot;&gt;$n\to n+1$&lt;/span&gt; (note that &lt;span class=&quot;math-container&quot;&gt;$n\to n+1$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$N\to 2N$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ -\mathbb 1_{2N} + \frac{2}{2N} \mathcal I_{2N}=-H_{n+1} R_{2N} H_{n+1}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_{n+1}=H_n\otimes H_1, \qquad&#xA;R_{2N}=\begin{pmatrix}R_N &amp;amp; 0\\ 0&amp;amp;\mathbb 1_N\end{pmatrix}.$$&lt;/span&gt;&#xA;We therefore have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-H_{n+1} R_{2N} H_{n+1}&#xA;= - \frac{1}{2}\begin{pmatrix}H_n &amp;amp; H_n\\ H_n&amp;amp; -H_n\end{pmatrix}&#xA;\begin{pmatrix}R_N &amp;amp; 0\\ 0&amp;amp;\mathbb 1_N\end{pmatrix}&#xA;\begin{pmatrix}H_n &amp;amp; H_n\\ H_n&amp;amp; -H_n\end{pmatrix} \\&#xA;= -\frac{1}{2}\begin{pmatrix}H_n &amp;amp; H_n\\ H_n&amp;amp; -H_n\end{pmatrix}&#xA;\begin{pmatrix}R_N H_n &amp;amp; R_N H_n\\ H_n&amp;amp; -H_n\end{pmatrix} &#xA;=-\frac{1}{2}\begin{pmatrix}H_n R_N H_n + \mathbb 1_N &amp;amp; H_n R_N H_n - \mathbb 1_N\\ H_n R_N H_n - \mathbb 1_N&amp;amp; H_n R_N H_n + \mathbb 1_N\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;By the induction hypothesis, &lt;span class=&quot;math-container&quot;&gt;$H_n R_N H_n=\mathbb 1_N-\frac{2}{N}\mathcal I_N$&lt;/span&gt;, therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-\frac{1}{2}\begin{pmatrix}H_n R_N H_n + \mathbb 1_N &amp;amp; H_n R_N H_n - \mathbb 1_N\\ H_n R_N H_n - \mathbb 1_N&amp;amp; H_n R_N H_n + \mathbb 1_N\end{pmatrix} =&#xA;\begin{pmatrix}-\mathbb 1_N + \mathcal I_N/N &amp;amp; \mathcal I_N/N \\&#xA;\mathcal I_N/N &amp;amp; -\mathbb 1_N + \mathcal I_N/N\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;which is what you wanted to prove.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;An alternative direct proof&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Here is another way to prove this fact avoiding induction altogether.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to prove that &lt;span class=&quot;math-container&quot;&gt;$-\mathbb 1_N + \frac{2}{N} \mathcal I_N=-H_n R_N H_n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe that, by definition, the components of &lt;span class=&quot;math-container&quot;&gt;$H_n$&lt;/span&gt; read&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(H_n)_{ij}=\frac{1}{\sqrt{2^n}} (-1)^{i_B\odot j_B},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$i_B$&lt;/span&gt; denotes the binary vector whose elements are the components of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in its binary representation, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$i_B\odot j_B\equiv \oplus_k i_k j_k$&lt;/span&gt; (that is, the modulo-&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; sum of the products of the binary components of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, &lt;span class=&quot;math-container&quot;&gt;$R_N$&lt;/span&gt; is written componentwise as &lt;span class=&quot;math-container&quot;&gt;$(R_N)_{ij}=\delta_{ij} (-1)^{\delta_{i,0}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The product &lt;span class=&quot;math-container&quot;&gt;$H_n R_N H_n$&lt;/span&gt; thus gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(H_n R_N H_n)_{ij} = \frac{1}{2^n} \sum_k (-1)^{k\odot(i_B\oplus j_B)} (-1)^{\delta_{k,0}},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$i_B\oplus j_B$&lt;/span&gt; denotes the &lt;em&gt;componentwise bitwise sum&lt;/em&gt; of the binary vectors &lt;span class=&quot;math-container&quot;&gt;$i_B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Observe now that the &lt;span class=&quot;math-container&quot;&gt;$(-1)^{\delta_{k,0}}$&lt;/span&gt; term only affects the &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; element of the sum, and it does so by simply changing its sign from &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. In other words, it simply subtracts &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; from the overall sum, so that we can rewrite the whole thing as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$(H_n R_N H_n)_{ij}&#xA;= \frac{1}{2^n} \left(\sum_k (-1)^{k\odot(i_B\oplus j_B)} - 2\right).$$&lt;/span&gt;&#xA;To reach the conclusion you now only need to observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_k (-1)^{k\odot(i_B\oplus j_B)}=N\delta_{i,j}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-03-07T13:00:15.753" LastActivityDate="2019-03-07T13:00:15.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5659" PostTypeId="2" ParentId="5657" CreationDate="2019-03-07T17:38:48.677" Score="4" Body="&lt;p&gt;I don't think that's possible: Suppose your initial state is &lt;span class=&quot;math-container&quot;&gt;$\vert \phi\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\vert \psi\rangle$&lt;/span&gt; be a state with the numbers &lt;span class=&quot;math-container&quot;&gt;$1,4,8,13$&lt;/span&gt; in superposition. Then &lt;span class=&quot;math-container&quot;&gt;$\langle \psi \vert \phi\rangle\neq 0$&lt;/span&gt;, since the states have &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$13$&lt;/span&gt; in common. But if we have some sort of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th minimum circuit &lt;span class=&quot;math-container&quot;&gt;$U_n$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U_2\vert \phi\rangle\vert 0\rangle=\vert\phi\rangle\vert 3\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_2\vert \psi\rangle\vert 0\rangle=\vert \psi\rangle\vert 4\rangle$&lt;/span&gt;, the outputs are orthogonal. This is impossible if &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; is a unitary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure exactly what you had in mind (a circuit, a channel,...?). In the most generality I can think of: Suppose &lt;span class=&quot;math-container&quot;&gt;$\vert \phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt; are uniform superpositions of the numbers &lt;span class=&quot;math-container&quot;&gt;$\{1,3,8,13\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{1,4,8,13\}$&lt;/span&gt;, respectively. Then the fidelity between them is 0.75. Suppose we have some quantum channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; that is supposed to select the 2nd smallest element. We know the fidelity between &lt;span class=&quot;math-container&quot;&gt;$\Phi(\vert \phi\rangle\langle\phi\vert)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi(\vert \psi\rangle\langle\psi\vert)$&lt;/span&gt; is at least 0.75 because channels increase fidelity. (I think) This implies that if the probability of measuring 3 in the first state is &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, then the probability of measuring 3 in the second state is at least &lt;span class=&quot;math-container&quot;&gt;$0.75p$&lt;/span&gt;. So if we have a high probability of measuring 3 in the first state (which we should) then we also have a high probability of measuring 3 in the second state (which we should not).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there is a big difference between what you asked, and the problem of finding the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th minimum given the state &lt;span class=&quot;math-container&quot;&gt;$\vert a_1\rangle\vert a_2\rangle\cdots \vert a_N\rangle$&lt;/span&gt;. In this case, if any of the numbers &lt;span class=&quot;math-container&quot;&gt;$a_1,\cdots, a_N$&lt;/span&gt; are different, the states are orthogonal. The paper you linked provides a method to solve the problem in this case. &lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2019-03-07T17:38:48.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5660" PostTypeId="1" AcceptedAnswerId="5665" CreationDate="2019-03-08T01:41:32.000" Score="2" ViewCount="106" Body="&lt;p&gt;I was recently asked two questions concerning error in quantum computing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible for quantum computers to exhibit behavior similar to flip errors in classical computers where a state &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$\vert1\rangle$&lt;/span&gt; due to this error?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible for a quantum computer to decohere to &lt;span class=&quot;math-container&quot;&gt;$\vert1\rangle$&lt;/span&gt; or some probability distribution between &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert1\rangle$&lt;/span&gt; based on the state the system is currently in.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My own thoughts are that the first is possible depending on where in the Bloch sphere your qubits are and the operations you're trying to do. That's why we have quantum error-correction code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second question was more tricky. My explanation is that, if I have a density matrix representing the pure state &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{bmatrix} / \sqrt 2$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0.5 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.5 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0.5&amp;amp; 0&amp;amp; 0&amp;amp; 0.5\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then I can see the probabilities of all given outcomes for the system. However, if I introduce some noise, I might get something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0.3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0.1 \\ 0 &amp;amp; 0.2 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0.2 &amp;amp; 0 \\ 0.1&amp;amp; 0&amp;amp; 0&amp;amp; 0.3\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to measure the state corresponding to this density matrix, I get the result &lt;code&gt;0.08&lt;/code&gt;, which is very close to 0. What I glean from this experiment is that, as the system interacts with the environment, information is lost, returning the system to the ground state, which is 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this interpretation correct? If not, can somebody provide more detail into what's going on?&lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="26" LastEditDate="2019-03-08T16:09:05.470" LastActivityDate="2019-03-08T16:09:05.470" Title="Decoherence in quantum systems always produces $\vert0\rangle$" Tags="&lt;error-correction&gt;&lt;density-matrix&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5661" PostTypeId="1" CreationDate="2019-03-08T03:40:30.527" Score="7" ViewCount="205" Body="&lt;p&gt;&lt;em&gt;Cross-posted on &lt;a href=&quot;https://mathoverflow.net/questions/324580/what-role-do-hecke-operators-and-ideal-classes-perform-in-quantum-money-from-mo&quot;&gt;MO&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original ideas from the 70's/80's - that begat the [&lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;noreferrer&quot;&gt;BB84&lt;/a&gt;] quantum key distribution - concerned quantum money that is unforgeable by virtue of the no-cloning theorem.  A limitation was that the quantum money required the &lt;em&gt;bank&lt;/em&gt; to verify each transaction.  Quantum money based on &lt;a href=&quot;https://arxiv.org/abs/1004.5127&quot; rel=&quot;noreferrer&quot;&gt;knots&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1203.4740&quot; rel=&quot;noreferrer&quot;&gt;hidden subspaces&lt;/a&gt; have been explored to provide a &quot;public key&quot; quantum distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I find the knots paper, aided by Farhi's &lt;a href=&quot;https://www.youtube.com/watch?v=HaJEDyahLZY&quot; rel=&quot;noreferrer&quot;&gt;exposition&lt;/a&gt;, to be quite accessible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enter the recent &lt;a href=&quot;https://arxiv.org/abs/1809.05925&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; &quot;Quantum Money from Modular Forms,&quot; by Daniel Kane.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me modular forms are much more intimidating than knots; my knowledge is mostly limited to an excellent &lt;a href=&quot;https://www.youtube.com/watch?v=LolxzYwN1TQ&quot; rel=&quot;noreferrer&quot;&gt;series of lectures&lt;/a&gt; by Keith Conrad and friends.  However, Kane's exposition is very good and I can see some general relation to the previous work on knots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonetheless, I'm getting hung up on section 3.2 onward. I'm wondering how much of a dictionary we can have between the knots work and modular forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, I know we can say something like there are &lt;span class=&quot;math-container&quot;&gt;$d!\times[\frac{d!}{e}]$&lt;/span&gt; grid diagrams of grid dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, and a uniform superposition of grid diagrams all with the same Alexander polynomial is an eigenstate of a Markov chain of Cromwell moves; not only that, the Markov chain can be made doubly stochastic and easy to apply, and the Alexander polynomial is efficient to calculate.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does it even make sense to say something roughly as in &quot;there are &lt;span class=&quot;math-container&quot;&gt;$\lfloor N/12\rfloor$&lt;/span&gt; cusp modular forms of weight &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and level &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, and a uniform superposition of modular forms all with a same number of ideal classes is an eigenstate of a Hecke operator; not only that, the Hecke operator is Hermitian and easy to apply and the number of ideal classes is efficient to calculate?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Have I gotten off track?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-11T01:50:47.387" LastActivityDate="2021-02-11T22:08:00.750" Title="What role do Hecke operators and ideal classes perform in “Quantum Money from Modular Forms?”" Tags="&lt;mathematics&gt;&lt;cryptocurrency&gt;&lt;quantum-money&gt;&lt;no-cloning-theorem&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5662" PostTypeId="1" AcceptedAnswerId="5669" CreationDate="2019-03-08T05:25:31.987" Score="5" ViewCount="143" Body="&lt;p&gt;As I understand it the Pauli-X, Y and Z gates are the same as their rotational gates with a rotation of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;. But given the expression for those gates, I find that there is a factor of &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; in each of them. Can someone explain why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the X-gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_X(\theta)=\begin{align}\begin{bmatrix}&#xA;\cos\frac{\theta}{2}&amp;amp;-i\;\sin\frac{\theta}{2}\\&#xA;-i\;\sin\frac{\theta}{2}&amp;amp;\cos\frac{\theta}{2}&#xA;\end{bmatrix}\end{align}\\&#xA;$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$R_X(\pi)=\begin{align}\begin{bmatrix}&#xA;0&amp;amp;-i\\&#xA;-i&amp;amp;0&#xA;\end{bmatrix}\end{align}\\&#xA;$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$X=\begin{align}\begin{bmatrix}&#xA;0&amp;amp;1\\&#xA;1&amp;amp;0&#xA;\end{bmatrix}\end{align}\\&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5932" LastEditorUserId="26" LastEditDate="2019-03-29T19:52:28.313" LastActivityDate="2019-03-29T19:52:28.313" Title="Where is the factor of $-i$ in rotation gates coming from?" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5663" PostTypeId="2" ParentId="5634" CreationDate="2019-03-08T07:47:12.297" Score="2" Body="&lt;p&gt;The entanglement entropy (what you call &quot;von Neumann entropy&quot;) is a good measure for entanglement of pure states in the asymptotic setting, i.e. when one is dealing with many copies.  However, it is &lt;em&gt;not&lt;/em&gt; a good measure for mixed states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Distillable entanglement and entanglement cost are entanglement measures which apply to both pure and mixed states.  Moreover, for pure states, all three measures are equal, which is desirable due to the special status of the entanglement entropy.  Finally, entanglement cost and distillable entanglement are the largest and smallest entanglement measure which coincides with entanglement entropy for pure states, and which is operationally meaningful in an asymptotic scenario.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-03-08T07:47:12.297" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5664" PostTypeId="1" AcceptedAnswerId="5666" CreationDate="2019-03-08T08:41:29.750" Score="3" ViewCount="589" Body="&lt;p&gt;If we suppose that &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; is the tensor product of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; such as &lt;span class=&quot;math-container&quot;&gt;$XX = X \otimes X$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would we calculate the rotation operator of this &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this work? If so why?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R(XX)_\theta = e^{-i\frac{\theta}{2}XX} = \cos\left(\frac{\theta}{2}\right)I  - i\sin\left(\frac{\theta}{2}\right)XX $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5791" LastEditorUserId="26" LastEditDate="2019-03-30T07:46:48.087" LastActivityDate="2019-03-30T07:46:48.087" Title="Rotation operator on Pauli parity gates $XX$, $YY$ and $ZZ$" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5665" PostTypeId="2" ParentId="5660" CreationDate="2019-03-08T08:48:59.097" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible for quantum computers to exhibit behavior similar to flip errors in classical computers where a state |0⟩ becomes |1⟩ due to this error?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. It would be a very abrupt error if you're talking about errors on physical qubits. Usually, we'd think of an error as being a little bit of an X rotation (for example). However, the effect of performing an error correction step, and measuring the syndrome, divides that into two cases, &quot;no error&quot; and &quot;bit flip&quot;, the latter occurring with small probability. Hence, in particular when you're talking about the effects of error correction/fault tolerance on an encoded qubit, the ultimate errors will generally be of this Pauli form.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it possible for a quantum computer to decohere to |1⟩ or some probability distribution between |0⟩ and |1⟩ based on the state the system is currently in.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That depends very much on your noise model. In the context of error correction, people often describe the errors as the action of Pauli operators (i.e. the depolarising channel on each qubit). The only stationary state of this channel is the maximally mixed state (NB Not &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;), so the ultimate state after a long time is independent of the initial state. Perhaps you're thinking about the specific noise model that is relaxation/amplitude damping? In that case, anything in the excited state has a tendency to relax to the ground state, and so the only stationary state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I can easily give you noise models where the final state depends on the initial state. Dephasing noise (effectively, Pauli Z errors on each qubit) acting on several qubit is one such example. To see why, note that &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; never changes the number of qubits in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, so the final state must depend on how many &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s there were in the initial state. (Ultimately, you get a mixed state which is maximally mixed in each 'excitation subspace', but the weight on that subspace is determined by the initial state.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-08T08:48:59.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5666" PostTypeId="2" ParentId="5664" CreationDate="2019-03-08T08:55:32.460" Score="5" Body="&lt;p&gt;This does indeed work because this construction works for any matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H^2=\mathbb{I}$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_\theta(H)=e^{-i\theta H/2}=\cos\frac{\theta}{2}\mathbb{I}-i\sin\frac{\theta}{2}H&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several ways that you could prove this. I think the easiest way is to realise that because &lt;span class=&quot;math-container&quot;&gt;$H^2=\mathbb{I}$&lt;/span&gt;, then the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H^2$&lt;/span&gt; are 1, and hence the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; must be &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$P_{\pm}$&lt;/span&gt; be projectors onto the eigenspaces of eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; respectively. So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbb{I}=P_++P_-\qquad H=P_+-P_-&#xA;$$&lt;/span&gt;&#xA;Furthermore, by definition of how a function can be applied to a matrix (you apply the function to each of the eigenvalues),&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_\theta(H)=e^{-i\theta/2}P_++e^{i\theta/2}P_-.&#xA;$$&lt;/span&gt;&#xA;Now we can substitute for &lt;span class=&quot;math-container&quot;&gt;$P_{\pm}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_\theta(H)=e^{-i\theta/2}(\mathbb{I}+H)/2+e^{i\theta/2}(\mathbb{I}-H)/2&#xA;$$&lt;/span&gt;&#xA;Group the terms of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; and for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and simplify.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-08T08:55:32.460" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5667" PostTypeId="2" ParentId="5657" CreationDate="2019-03-08T09:12:32.337" Score="1" Body="&lt;p&gt;Sam Jaques' &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5659/1837&quot;&gt;first paragraph&lt;/a&gt; is a very good explanation of why what you want to do is impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just wanted to add that your question seems to be implying that you &lt;em&gt;can&lt;/em&gt; start with a state such as &lt;span class=&quot;math-container&quot;&gt;$(|1\rangle+|3\rangle+|5\rangle+|8\rangle)/2$&lt;/span&gt; and return the minimum using the Durr-Hoyer paper that you cite. This is not the case either, by the same argument. The Durr-Hoyer algorithm simply doesn't apply to your setting. They use what is essentially a database function &lt;span class=&quot;math-container&quot;&gt;$f(n)$&lt;/span&gt; where, in your case, &lt;span class=&quot;math-container&quot;&gt;$f(0)=3, f(1)=8, f(2)=1, f(3)=5$&lt;/span&gt;. They do not start with the state you're talking about, and they access their database function many times. If you did have their setting, you should be able to adapt it to find the 2nd smallest.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-08T09:12:32.337" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5668" PostTypeId="1" AcceptedAnswerId="5739" CreationDate="2019-03-08T10:27:37.503" Score="2" ViewCount="84" Body="&lt;p&gt;I am trying to figure out how to use the functions &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/dagcircuit/_dagcircuit.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;_make_pred_succ_maps&quot;&lt;/a&gt;. Here is a description of the function from Github:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def _make_pred_succ_maps(self, n):&#xA;    &quot;&quot;&quot;Return predecessor and successor dictionaries.&#xA;    Args:&#xA;        n (int): reference to self.multi_graph node id&#xA;    Returns:&#xA;        tuple(dict): tuple(predecessor_map, successor_map)&#xA;            These map from wire (Register, int) to predecessor (successor)&#xA;            nodes of n.&#xA;    &quot;&quot;&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, I do not understand how to interpret outputs like the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; circuit_name._make_pred_succ_maps(1)&#xA;({}, {(QuantumRegister(3, 'a'), 0): 10})&#xA;&#xA;&amp;gt;&amp;gt;&amp;gt; circuit_name._make_pred_succ_maps(2)&#xA;({(QuantumRegister(3, 'a'), 0): 41}, {})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What do the individual numbers mean?&lt;/p&gt;&#xA;" OwnerUserId="5600" LastEditorUserId="26" LastEditDate="2019-03-08T15:59:41.003" LastActivityDate="2019-03-19T09:29:32.257" Title="Qiskit predecessor and successor map of DAG circuits" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5669" PostTypeId="2" ParentId="5662" CreationDate="2019-03-08T20:53:34.260" Score="3" Body="&lt;p&gt;Let's start from the basics. Any arbitrary single qubit state can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = e^{i\gamma} \left(\cos \frac {\theta}{2} |0\rangle+ e^{i\phi} \sin \frac{\theta}{2}|1\rangle\right),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi, \gamma \in \Bbb R$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$0\leq \theta \leq \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0\leq \phi\leq 2\pi$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$e^{i\gamma}$&lt;/span&gt; is a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5125&quot;&gt;global phase&lt;/a&gt; here. Qubit states with arbitrary values of &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; represent the same quantum state as global phases don't have any &lt;em&gt;observable effects&lt;/em&gt;. So the standard notation for qubit states is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \cos \frac {\theta}{2} |0\rangle+ e^{i\phi} \sin \frac{\theta}{2}|1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we neglect the global phase factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\gamma}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember that you are working on a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/92&quot;&gt;vector space structure&lt;/a&gt; where &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are your basis elements. The rotation operators &lt;span class=&quot;math-container&quot;&gt;$R_X, R_Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_Z$&lt;/span&gt; are simply &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_map&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear maps&lt;/a&gt; in this context (in the standard &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; basis). And so are the Pauli &lt;span class=&quot;math-container&quot;&gt;$X, Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, note that you can write &lt;span class=&quot;math-container&quot;&gt;$R_X(\pi)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$-iX$&lt;/span&gt;. When &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; acts on an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; it will produce &lt;span class=&quot;math-container&quot;&gt;$X|\Psi\rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$-iX$&lt;/span&gt; acts, it will produce &lt;span class=&quot;math-container&quot;&gt;$-iX|\Psi\rangle$&lt;/span&gt; instead. However, the states &lt;span class=&quot;math-container&quot;&gt;$-iX|\Psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X|\Psi\rangle$&lt;/span&gt; simply differ by a global phase of &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;, or in other words by a factor of &lt;span class=&quot;math-container&quot;&gt;$e^{i\gamma}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\gamma = (2n+1)\frac{\pi}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n\in \Bbb N$&lt;/span&gt;. So, as you can see, &lt;span class=&quot;math-container&quot;&gt;$R_X(\pi)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; are equivalent mappings as global phases don't matter in quantum mechanics! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &lt;em&gt;why&lt;/em&gt; the Pauli operators and rotation operators differ by a phase factor, you'll have to check out the derivations for the following. &#xA;You'll find an outline &lt;a href=&quot;https://physics.stackexchange.com/a/338985&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_X(\theta) = e^{-i \frac{\theta}{2}X},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_Y(\theta) = e^{-i \frac{\theta}{2}Y},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_Z(\theta) = e^{-i \frac{\theta}{2}Z}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-08T22:21:22.263" LastActivityDate="2019-03-08T22:21:22.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5670" PostTypeId="1" CreationDate="2019-03-08T21:26:01.143" Score="2" ViewCount="76" Body="&lt;p&gt;In a semiclassical treatment, the noise Hamiltonian of a quantum system can be treated as a summation over its noise channels in the following way: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{H}_{\text{noise}}=\sum_{k}\beta_{k}\left(t\right)\hat{N}_{k}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\hat{N}_k$&lt;/span&gt; is an operator indicating the noise axis in Hilbert space, and &lt;span class=&quot;math-container&quot;&gt;$\beta_k(t)$&lt;/span&gt; is a classical noise field. Considering the case of a single qubit that is &lt;strong&gt;not subjected to control fields&lt;/strong&gt;, the trivial noise channel  is &lt;span class=&quot;math-container&quot;&gt;$N_z = \sigma_z$&lt;/span&gt; - fluctuations in the magnetic field in the environment of the qubit results in Zeeman splitting and therefore to an undesirable Z rotation.  However, I would like to know what physical process can lead to a noise channel in an orthogonal direction to the quantization axis (XY rotations)? To make it clear, all I am asking for is an example. &lt;/p&gt;&#xA;" OwnerUserId="5811" LastEditorUserId="5811" LastEditDate="2019-03-12T18:08:52.973" LastActivityDate="2019-03-12T18:08:52.973" Title="What noise channel that is not coming from the control can lead to XY qubit rotations?" Tags="&lt;physical-qubit&gt;&lt;decoherence&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5671" PostTypeId="2" ParentId="5586" CreationDate="2019-03-09T01:23:06.207" Score="3" Body="&lt;p&gt;It might be a better investment to learn an SDK or API that's written in a common classical language. Each company that offers (or claims to it will soon offer) cloud quantum computer access has developed its own SDK for programming quantum circuits. The four main providers (API's) are IBM (qiskit and ProjectQ), Rigetti (Forest), Google (cirq), and Microsoft (QDK). I've worked extensively in cirq and pyquil (Forest's API), and I'm not really a fan of either - both are buggy and clunky in places, but this is natural given how young quantum programming is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're all different and its smart to have a feel for all of them, so if you want a more in depth comparison in order to commit to just one, check out LaRose's comparison &#xA;&lt;a href=&quot;https://quantumcomputingreport.com/wp-content/uploads/2018/06/Overview-and-Comparison-of-Gate-Level-Quantum-Software-Platforms-Final-June-21-2018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (and his slightly dated followup on cirq &lt;a href=&quot;https://github.com/rmlarose/cirq-overview/blob/master/article/notebook/cirq.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-03-09T01:23:06.207" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5672" PostTypeId="1" CreationDate="2019-03-09T02:03:19.717" Score="2" ViewCount="97" Body="&lt;p&gt;I don't understand how it's being proven that error correction can be applied only to X, Z noises and this solves all errors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this have to be with this set being universal? (Z is exactly like phase matrix or rotation matrix.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bonus question: When recovering a state in Shors code does it matter if I apply X, Z or Z, X?&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-09T12:36:38.360" LastActivityDate="2019-03-09T12:36:38.360" Title="Why does phase flip correction error? Why could any error be written as a linear combination of I, X, Z and ZX matrices?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5673" PostTypeId="2" ParentId="5672" CreationDate="2019-03-09T02:24:36.640" Score="3" Body="&lt;p&gt;The reason people focus on X and Z errors is because&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;X and Z are super simple. You can propagate the errors through common gates like CNOT and H without any trouble. A product of X and Z errors on various qubits before a series of Clifford gates is equivalent to a (different) product of X and Z errors on various qubits after the gates. And error correcting codes are almost all made up of Clifford gates.&lt;/li&gt;&#xA;&lt;li&gt;You can still get upper bounds on how bad more flexible real quantum errors will be. An accidental 5 degree rotation around the Z axis of a qubit is no worse than a &lt;span class=&quot;math-container&quot;&gt;$\sin^2(5^\circ)$&lt;/span&gt; chance of a Z error on that qubit.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-03-09T02:24:36.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5674" PostTypeId="1" CreationDate="2019-03-09T08:46:05.703" Score="3" ViewCount="146" Body="&lt;p&gt;I have read that quantum computers are not known to be able to solve NP-complete problems in polynomial time. However, if you consider a game of Battleship with grid size &lt;span class=&quot;math-container&quot;&gt;$X, Y$&lt;/span&gt; and represent this by a binary string &lt;span class=&quot;math-container&quot;&gt;$01100\cdots$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$X \times Y$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s represents ship locations, wouldn't Grover's algorithm be able to solve this in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{XY})$&lt;/span&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Battleship is considered NP-complete. Why isn't this considered polynomial time?&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="26" LastEditDate="2019-03-09T09:37:32.173" LastActivityDate="2019-04-28T14:43:45.180" Title="Grover's algorithm and Battleship solution" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5675" PostTypeId="2" ParentId="5586" CreationDate="2019-03-09T12:14:23.397" Score="4" Body="&lt;p&gt;If you like Python and want to run jobs on a real device, your options are &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt;, &lt;a href=&quot;https://projectq.ch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ProjectQ&lt;/a&gt; or &lt;a href=&quot;https://www.rigetti.com/forest&quot; rel=&quot;nofollow noreferrer&quot;&gt;Forest&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you like Python and are happy to wait for access to a real device, you could additionally go for &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/README.rst&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt;. In this case, you might also want to look into the features of the simulators provided by all the Python frameworks, to find the one that best suits your intended use cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the Python frameworks use the same basic way of building up quantum circuits by laying down simple quantum gates. They differ in their fancy features. Since I work on Qiskit, I am most familiar with its fancy features. But the fancy features of the others may suit you better. It all depends on what you want to do. But your decision on which to learn is not irreversible: it should be quite easy to learn with one and then use that same experience in using the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are familiar with Visual Studio, and especially if you work in C#, it may be that &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q#&lt;/a&gt; would be easiest for you. I am not a Visual Studio kind of person, so I have no experience with this myself.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="26" LastEditDate="2019-03-09T12:59:13.640" LastActivityDate="2019-03-09T12:59:13.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5676" PostTypeId="1" CreationDate="2019-03-09T15:27:21.243" Score="2" ViewCount="64" Body="&lt;p&gt;I know what the Hamming code is. But I don't understand how could this idea be applied in quantum computation since it's required to cover the case of superposition and entanglement. How could you decide parity in that case? And how is the measurement performed in this coding so that we get the information on where is the error while being able to not change the codeword?&#xA;Is it possible to know where is the error while not changing the state that was sent? Basically, how is it performed? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a place to read about it which explains it in a concise way and explains it well? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-09T15:31:27.353" LastActivityDate="2019-04-15T10:29:40.670" Title="How does Steane code use the classical Hamming code for error correction?" Tags="&lt;resource-request&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5677" PostTypeId="1" CreationDate="2019-03-09T16:10:54.947" Score="3" ViewCount="106" Body="&lt;p&gt;I am new and I don't understand where I should give the input and where I should get the output. Please explain with an example of a circuit run on the Quirk simulator. How to add two numbers?&lt;/p&gt;&#xA;" OwnerUserId="5991" LastEditorUserId="26" LastEditDate="2019-03-09T16:16:54.107" LastActivityDate="2019-03-09T16:16:54.107" Title="How to simulate a simple circuit to add two numbers in Quirk?" Tags="&lt;circuit-construction&gt;&lt;quirk&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5678" PostTypeId="5" CreationDate="2019-03-10T05:49:17.780" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-03-10T05:49:17.780" LastActivityDate="2019-03-10T05:49:17.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5679" PostTypeId="4" CreationDate="2019-03-10T05:49:17.780" Score="0" Body="For questions on Bell test experiments or Bell's inequality experiments, including but not limited to the CHSH and CH74." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-08-24T09:01:34.633" LastActivityDate="2020-08-24T09:01:34.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5680" PostTypeId="1" AcceptedAnswerId="5683" CreationDate="2019-03-10T10:27:05.207" Score="1" ViewCount="92" Body="&lt;p&gt;In error correction, like the bit flip, you perform a measurement which corresponds to different projections so that the outcomes can teach you about the error. What does it mean? How do you actually do it? Do you have to do the measurement in different bases? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same with arbitrary errors which are composed of &lt;span class=&quot;math-container&quot;&gt;$I, X, Y, Z$&lt;/span&gt; matrices and you want to perform a measurement which will collapse the state to either one of them. How is it performed? Do you measure in different bases? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the difference between measurement in different bases to measurement with different projections? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-10T12:07:28.877" LastActivityDate="2019-03-11T07:29:38.127" Title="What does it mean to perform a measurement in correspondence with different projections?" Tags="&lt;error-correction&gt;&lt;measurement&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5681" PostTypeId="1" CreationDate="2019-03-10T21:21:26.500" Score="3" ViewCount="110" Body="&lt;p&gt;Instead of the complicated Steane code, I don't understand why don't we use a much simpler and exact imitation of the classical Hamming code.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is my idea: Let's have 7 qubits, and we will encode our qubit in the last wire. Based on this we will create CNOTs gates which will fix the parity of the code.  The control would be qubit 1, 2, 4 just like classical code. &#xA;This is all exactly like classical code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then to decode it, you can create 3 ancillas which simply read/copy the values of 1, 2, 4 qubits.  So for now, just like classical qubits, you have the value specified in the three ancillas indicating where the error is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All that remains to be done is performing a partial measurement of the three ancillas to just get the index of the error. The rest is unchanged.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's the problem with this? What is the point of creating categories of even codes and odd ones and collapsing into them like in Steane code? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-10T23:32:30.700" LastActivityDate="2019-03-31T17:55:14.167" Title="In error correction code why don't we imitate the Hamming code instead of the complicated Steane code?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5683" PostTypeId="2" ParentId="5680" CreationDate="2019-03-11T07:29:38.127" Score="2" Body="&lt;p&gt;Let's get some terminology correct. A particular measurement basis corresponds to a set of projectors, &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt; (satisfying &lt;span class=&quot;math-container&quot;&gt;$\sum_iP_i=\mathbb{I}$&lt;/span&gt;), where each &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; corresponds to a measurement outcome. Sometimes, measurements are specified by giving a Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; which is not a set of projectors. Most often, we'd be talking about something with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, so you'd have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=P_1-P_2,&#xA;$$&lt;/span&gt;&#xA;so that defines the corresponding projectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a theorist's perspective you can 'just' measure in that particular basis. From a practical perspective, what you often want to do is convert the measurement into a measurement on the computational basis. You can find a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tilde P_i=UP_iU^\dagger&#xA;$$&lt;/span&gt;&#xA;is diagonal. So, instead, you can apply unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and then measure in the computational basis (although if the projectors are not rank 1, there would be some grouping of terms).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to error correction, there is a particularly natural way to measure the &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; eigenvalue of a stabilizer.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7jDFP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7jDFP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;You measure the top qubit in the computational basis, where the &lt;span class=&quot;math-container&quot;&gt;$\sigma_1\otimes\ldots\otimes\sigma_n$&lt;/span&gt; is the stabilizer operator that you want to measure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-11T07:29:38.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5684" PostTypeId="1" CreationDate="2019-03-11T14:54:43.750" Score="3" ViewCount="171" Body="&lt;p&gt;When considering quantum error correction over depolarizing channels, the depolarizing probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; such that an error of the kind &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; will happen is used as &lt;em&gt;a priori&lt;/em&gt; information in order to use it for determining the most likely error coset to have affected the quantum information &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; sent through such channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, it is logical to use such &lt;em&gt;a priori&lt;/em&gt; information for decoding, as it gives the information needed about the channel to decode with high probability of success. However, in the reality, such knowledge about the depolarizing channel will be an estimate &lt;span class=&quot;math-container&quot;&gt;$\hat{p}$&lt;/span&gt; that will be used as &lt;em&gt;a priori&lt;/em&gt; inforamation, as perfect knowledge of the channel is not possible. I was wondering then how such estimation of the depolarizing probability might be performed, and so which would be the error that such estimates might present.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2019-03-12T09:21:21.877" Title="Estimating the depolarizing probability of depolarizing channels" Tags="&lt;error-correction&gt;&lt;resource-request&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5685" PostTypeId="2" ParentId="5684" CreationDate="2019-03-12T09:21:21.877" Score="1" Body="&lt;p&gt;This probably only addresses half of your question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most of the time, estimates of the error probability are not so important. If you're using a non-degenerate error correcting code for a single logical qubit, all you need to know (effectively) is enough to resolve a choice between two different error corrections (i.e. you want to know that the number of errors is smaller than half the distance of the code with high probability). Small mistakes in estimation are not going to change that, unless you're right up at the boundary of whether it works or not (and then, whichever side of the boundary you're on, the 'with high probability' rider I just put on it is unlikely to hold. You want to know you're at least a few standard deviations away from that threshold).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest example is the classical repetition code. At the time of decoding, if you see a bunch of 0s and 1s, which do you decode it to? You assume that the per-bit probability of error is less than 1/2, and you decode to whichever bit value you see more of. It doesn't matter if that error probability is 0.3 or 0.31, you proceed in the same way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where your estimate of the error probability does make a difference is if you're using error correcting codes out beyond the literal distance value of the code. The typical example of this is with the Toric Code. This is defined for &lt;span class=&quot;math-container&quot;&gt;$O(N^2)$&lt;/span&gt; qubits on an &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; grid. The code has distance &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, i.e. there are combinations of &lt;span class=&quot;math-container&quot;&gt;$N/2+1$&lt;/span&gt; errors that would lead to a logical error when you do the syndrome measurement and correction. However, people still try to use the Toric Code when there are &lt;span class=&quot;math-container&quot;&gt;$\epsilon N^2$&lt;/span&gt; errors, for some small enough &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. That is based heavily on an assumption about the noise model and its parameters to determine which errors are most likely. I did &lt;a href=&quot;https://arxiv.org/abs/1208.4924&quot; rel=&quot;nofollow noreferrer&quot;&gt;some work&lt;/a&gt; at some point (not quite for depolarising noise) looking at the Toric code and how the error correction threshold changes depending on how good an estimate you have of the noise parameters. For example, if you have different rates of X and Z errors, but you assume they're the same rate, as compared to knowing what their rates are. See Figure 2 of that paper.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-12T09:21:21.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5687" PostTypeId="2" ParentId="5640" CreationDate="2019-03-12T12:36:07.270" Score="2" Body="&lt;p&gt;Here's a silly method that works if you know &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, you know the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, and you can efficiently generate arbitrary-size superpositions of the form &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N}}\sum_{b &amp;lt; N}\vert b\rangle.$$&lt;/span&gt;&#xA;To do this, use a Grover-like search: You need two circuits &lt;span class=&quot;math-container&quot;&gt;$U_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt;, with the following action:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_y\vert x\rangle \vert \psi\rangle = \begin{cases}\phantom{-}\vert x\rangle\vert\psi\rangle&amp;amp;,x\neq y\\-\vert x\rangle\vert \psi\rangle&amp;amp;,x=y\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_0\vert x\rangle= \begin{cases}\phantom{-}\vert x\rangle&amp;amp;,x=0\\-\vert x\rangle&amp;amp;,x\neq 0\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define a &quot;Grover Iteration&quot;  &lt;span class=&quot;math-container&quot;&gt;$G:=CU_yC^{-1}U_0$&lt;/span&gt; and just apply this repeatedly. If the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, you will need &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{1/p})$&lt;/span&gt; iterations to have a high probability that the final state is close to &lt;span class=&quot;math-container&quot;&gt;$\vert y\rangle \vert\phi\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why: If we define &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle=C^{-1}\vert y\rangle\vert \phi\rangle$&lt;/span&gt;, and decompose &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle=\alpha_1\vert \psi\rangle+\alpha_2\vert \psi^\perp\rangle$&lt;/span&gt;, then this algorithm will rotate through the space spanned by &lt;span class=&quot;math-container&quot;&gt;$\vert \psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert \psi^\perp\rangle$&lt;/span&gt;, the same as Grover's algorithm. Each iteration will rotate by the angle &lt;span class=&quot;math-container&quot;&gt;$\theta:= \arccos(\vert\langle \psi^\perp\vert 0\rangle\vert)\approx \sqrt{p}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that we need &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; to be near an integer multiple of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; to get an exact answer. Thus, we add some number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; of ancilla qubits, expand the circuit to &lt;span class=&quot;math-container&quot;&gt;$C'=C\otimes H^{\otimes N}$&lt;/span&gt;, and expand &lt;span class=&quot;math-container&quot;&gt;$U_y$&lt;/span&gt; to be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_y\vert x\rangle \vert \psi\rangle\vert n\rangle = \begin{cases}\phantom{-}\vert x\rangle\vert\psi\rangle\vert n\rangle&amp;amp;,x\neq y\text{ or }n&amp;gt;q\\-\vert x\rangle\vert \psi\rangle\vert n\rangle&amp;amp;,x=y\text{ and }n\leq q\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We choose &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; such that the probability of both getting &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in the first register and &lt;span class=&quot;math-container&quot;&gt;$n\leq q$&lt;/span&gt; in the third register is precisely enough that an integer number of these &quot;Grover&quot; iterations will take us to the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{q}}\sum_{n\leq q}\vert y\rangle\vert \phi\rangle\vert n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we use the arbitrary superposition circuit to clear the third register, and we use a series of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates to clear &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in the first register (since it is a bitstring that is known to us). All that's left is &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, the complexity is roughly &lt;span class=&quot;math-container&quot;&gt;$O(1/\sqrt{p})$&lt;/span&gt; times the complexity of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; itself, plus some number of ancilla (for the &lt;span class=&quot;math-container&quot;&gt;$\vert n\rangle$&lt;/span&gt; register) that will be logarithmic in the desired precision of the final state (since we should be able to get &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-close to an integer multiple of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\Omega(\log(1/\epsilon))$&lt;/span&gt; ancilla).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence: Not very efficient, requires a lot of knowledge of the circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, but doesn't need any measurements!&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2019-03-12T12:36:07.270" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5688" PostTypeId="1" CreationDate="2019-03-13T01:24:54.743" Score="3" ViewCount="68" Body="&lt;p&gt;An error can be written as a linear combination of &lt;span class=&quot;math-container&quot;&gt;$\Bbb I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$XZ$&lt;/span&gt; Pauli matrices. So when measuring an errand state we aim at collapsing the error into one of these four possibilities. How is it done in practice in terms of matrices of observables, projections, and measurements? Can you specify what are the observables that when measured collapse an error state to one of the four possibilities? &lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="26" LastEditDate="2019-03-13T13:28:57.370" LastActivityDate="2019-03-14T18:38:11.413" Title="How does the actual measurement collapsing an error to an orthogonal basis look like?" Tags="&lt;error-correction&gt;&lt;measurement&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5690" PostTypeId="1" AcceptedAnswerId="5693" CreationDate="2019-03-13T12:28:51.970" Score="1" ViewCount="60" Body="&lt;p&gt;According to the question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5637&quot;&gt;Q1Q2Q3 coupling in qubo file&lt;/a&gt; we can couple 3 qbits. When it comes with 4 qbits like q1q2q3q4, how should set this 4-qbit element to qubo file? &lt;/p&gt;&#xA;" OwnerUserId="5968" LastEditorUserId="26" LastEditDate="2019-03-13T13:23:47.723" LastActivityDate="2019-03-13T21:20:31.090" Title="Q1Q2Q3Q4 coupling in qubo file" Tags="&lt;annealing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5692" PostTypeId="1" CreationDate="2019-03-13T21:14:40.327" Score="5" ViewCount="511" Body="&lt;p&gt;I would like to implement a Fredkin gate based on square root of swap and one-qubit gates. In particular, I was hoping to find the exact gate named &quot;?&quot; in this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Hdt6X.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hdt6X.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, I want to avoid using C-SQSWAP. Otherwise, the solution would be trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6017" LastEditorUserId="6017" LastEditDate="2019-03-13T21:20:31.130" LastActivityDate="2019-03-14T10:17:51.413" Title="Implement Fredkin gate with square root of swap" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5693" PostTypeId="2" ParentId="5690" CreationDate="2019-03-13T21:20:31.090" Score="1" Body="&lt;p&gt;You can use a technique of reduction by substitution.&#xA;Here we represent using ancilla representing a Boolean constraint &lt;span class=&quot;math-container&quot;&gt;$ z\Leftrightarrow x_1\wedge x_2 $&lt;/span&gt; as a quadratic penalty function :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P(x_1,x_2;z) = x_1 x_2 - 2(x_1+x_2)z + 3z$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a triplet interaction, you use it to reduce to pairwise :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ x_1 x_2 x_3 = \min_z \bigl\{ z x_3 + M P(x_1,x_2;z) \bigr\}, M&amp;gt;1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For higher degrees, you can sequentially define ancilla variables in order to reduce terms by one until you have pairwise interactions. Again, this is explained in the D-Wave documentation.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-03-13T21:20:31.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5694" PostTypeId="1" AcceptedAnswerId="5697" CreationDate="2019-03-13T22:12:39.377" Score="4" ViewCount="107" Body="&lt;p&gt;There was a &lt;a href=&quot;https://codeforces.com/contest/1116/problem/B1&quot; rel=&quot;nofollow noreferrer&quot;&gt;problem&lt;/a&gt; at the Winter 2019 Q# codeforces contest (that is now over), which I cannot find a mathematical solution for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem goes like this:&#xA;You are given 3 qubits that can be in one of the following states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|ψ_0⟩=\frac{1}{\sqrt 3}\left(|100⟩+ω|010⟩+ω^2|001⟩\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|ψ_1⟩=\frac{1}{\sqrt 3}\left(|100⟩+ω^2|010⟩+ω|001⟩\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ω=e^{2iπ/3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Build a function that determines in which of the 2 states are the 3 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, how could you solve this problem in linear algebra (bra-kets notation) and the normal quantum logic gates? I figured out you have to somehow measure the coefficients, but I don't know quite how. If you could include a &quot;code algorithm proof of concept&quot; that would be great, but I am mainly interested in understanding the algebra part. After understanding it, implementing would be just a problem of translating the operations/gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I got something wrong, please correct me. I am new-ish to the whole quantum computing scene.&lt;/p&gt;&#xA;" OwnerUserId="6018" LastEditorUserId="26" LastEditDate="2019-03-14T15:20:08.087" LastActivityDate="2019-05-10T07:07:39.080" Title="How to measure superposition coefficients to determine state?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5695" PostTypeId="2" ParentId="5692" CreationDate="2019-03-13T23:03:19.547" Score="2" Body="&lt;p&gt;This is a square root of swap circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ol1SC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ol1SC.png&quot; alt=&quot;sqrt swap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get a CNOT operation by doing single-qubit rotations between two sqrt swaps. &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B%22X%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22X%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~amvp%22%2C%22name%22%3A%22SWAP%5E1%2F2%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%5E%C2%BD%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's the circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K43uj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K43uj.png&quot; alt=&quot;CNOT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are standard decompositions of the Fredkin gate into the Toffoli gate and CNOTs, and standard decompositions of the Toffoli gate into CNOTs and single-qubit operations. For example, here is a Fredkin decomposition used by Cirq that only uses CNOTs between adjacent qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I0D69.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I0D69.png&quot; alt=&quot;Fredkin&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Replace all the CNOTs with the CNOT decomposition and &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT3%22%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22%2B%3DA3%22%5D%2C%5B1%2C%22H%22%2C%22X%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22Z%5E%C2%BD%22%2C%22Z%5E-%C2%BD%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22H%22%2C%22X%22%5D%2C%5B1%2C1%2C%22Y%5E-%C2%BD%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C%22Z%5E-%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BC%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C%22X%5E%C2%BD%22%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B%22~amvp%22%5D%2C%5B%22X%22%2C%22H%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22Z%5E-%C2%BD%22%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C%22~amvp%22%5D%2C%5B1%2C%22X%22%2C%22H%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C%22X%5E%C2%BD%22%2C%22X%5E-%C2%BD%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~amvp%22%2C%22name%22%3A%22SWAP%5E1%2F2%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%5E%C2%BD%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;voila&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lWTRn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lWTRn.png&quot; alt=&quot;Fredkin from sqrt swap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you would try to cancel as many of the single qubit operations as possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there better decompositions? Almost definitely. But this is one that's easy to find.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-03-13T23:03:19.547" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5696" PostTypeId="1" CreationDate="2019-03-14T00:48:08.470" Score="12" ViewCount="1259" Body="&lt;h3&gt;Question&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I want to use the Grover-Algorithm to search an unsorted database for an element &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Now the question arises, how do I initialize index and value of the database with the qubits?&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Example&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let's say I have &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits. Thus, &lt;span class=&quot;math-container&quot;&gt;$2 ^ 4 = 16$&lt;/span&gt; classical values can be mapped.&lt;/li&gt;&#xA;&lt;li&gt;My unsorted database &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; has the following elements: &lt;span class=&quot;math-container&quot;&gt;$d [\text{Value}] = [3,2,0,1]$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I want to search for &lt;span class=&quot;math-container&quot;&gt;$x = 2_d = 10_b = |10\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;My approach: index the database &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$d [(\text{Index, Value})] = [(0,3), (1,2), (2,0), (3,1)]$&lt;/span&gt;. Registers &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for the index and registers &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; for the value. Then apply the Grover-Algorithm only to registers &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3 (\text{Value})$&lt;/span&gt;. Can this be realized? Is there another approach?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;What I already implemented (&lt;a href=&quot;https://github.com/soultanis/Grover-Algorithmus-Qiskit&quot; rel=&quot;noreferrer&quot;&gt;on GitHub&lt;/a&gt;)&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The &quot;Grover-Algorithm with 2-, 3-, 4-Qubits&quot;, but what it does is simple: the bits are initialized with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the oracle will mark my solution &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (which is just a number like &lt;span class=&quot;math-container&quot;&gt;$2_d = 10_b$&lt;/span&gt;), the Grover part will increase the probability of the selected element &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and decrease all other probabilities and then the qubits are read out by being mapped to the classical bits. We let this process run several times in succession and thus obtain a probability distribution, where the highest probability has our sought element &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output is always the same as the one marked in the oracle. How can I generate more information from the output, that I do not know at the time when I constructed the oracle?&lt;/p&gt;&#xA;" OwnerUserId="6021" LastEditorUserId="26" LastEditDate="2019-03-14T15:18:36.537" LastActivityDate="2019-07-02T11:17:39.790" Title="How is the Grover-Algorithm applied to a database?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5697" PostTypeId="2" ParentId="5694" CreationDate="2019-03-14T05:55:34.643" Score="5" Body="&lt;p&gt;The idea is to apply a unitary transformation which will map these states to a different pair of orthogonal states which are easy to distinguish by measuring in computational basis.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let's construct a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; which prepares &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; starting from &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first step is to prepare a &lt;span class=&quot;math-container&quot;&gt;$W_3 = \frac{1}{\sqrt{3}}\left(|100\rangle + |010\rangle + |001\rangle\right)$&lt;/span&gt; state, as described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4350/general-construction-of-w-n-state&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that you just have to apply the &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega^2$&lt;/span&gt; phases to the states &lt;span class=&quot;math-container&quot;&gt;$|010\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt; - this can be done using rotation gates. Depending on the primitives you have, you can do it using &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1&quot; rel=&quot;nofollow noreferrer&quot;&gt;R1&lt;/a&gt; gate, like the authors' solution, using Rz gate if you're ok with some accumulating some global phase, or using zero-controlled Rz.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, what happens if you take the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and apply the adjoint of the transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to them? You know that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; will be transformed to &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;, and the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; will be transformed to some other state. It doesn't really matter what state it is, it's enough to know that it is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;. So to distinguish these states you can measure all qubits after applying &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; - if you get all zeroes, you know it was &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt;, otherwise it was &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can find a more detailed explanation and the code for this problem in the &lt;a href=&quot;https://assets.codeforces.com/rounds/1116/contest-editorial.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;contest editorial&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-10T07:07:39.080" LastActivityDate="2019-05-10T07:07:39.080" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5698" PostTypeId="2" ParentId="5696" CreationDate="2019-03-14T07:43:47.270" Score="3" Body="&lt;p&gt;When presenting Grover's algorithm as applied to search in a database, it is supposed that the Oracle has access to the elements of the classical list. Yet it is a very strong assumption and this is why we represent that by a controlled-selector using CNOT/Toffolis of an index representing simply this operation (like the Toffoli circuit in the case &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention the approach of computing the values in another register :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_i | i\rangle | d(i)\rangle $$&lt;/span&gt;&#xA;You assume again you are given an oracle for doing so and efficiently (a straightforward way is to control-NOT but you have to do this for every index/value so not very efficient).&#xA;In this case, the oracle would be the function &lt;span class=&quot;math-container&quot;&gt;$ f(i)= 2 $&lt;/span&gt; in a quantum circuit format (again a controlled-selector), marking this state and continue with Grover iterations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it is better to think of the quantum search algorithm as optimizing a function, instead of searching in a list/database. Here is an &lt;a href=&quot;https://arxiv.org/abs/1902.00445&quot; rel=&quot;nofollow noreferrer&quot;&gt;article I worked on where quantum search is used for solving a combinatorial maximization problem&lt;/a&gt; if you want to pursue further your understanding of the algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-03-14T15:19:35.477" LastActivityDate="2019-03-14T15:19:35.477" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5699" PostTypeId="1" AcceptedAnswerId="5716" CreationDate="2019-03-14T07:59:30.420" Score="3" ViewCount="594" Body="&lt;p&gt;I am currently working intensively on the Grover algorithm and have understood the individual &quot;building blocks&quot; of the algorithm so far. There are also references in the literature to Nielsen, e.g. an implementation example, but only for 4 elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, of a more general nature. How would you actually implement a gate for more elements than just 4? Is there a general approach? The Grover operator G is composed of the n-fold Hadamard transformation and of the conditional phase change and a renewed H transformation. If I have a unitary matrix, eg. the one for the phase shift in the Grover operator, how can I convict this common unitary matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I summarize briefly:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do you convert the gates in the Grover algorithm for N bits? Is there a general derivation somewhere?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can a unitary matrix e.g. the phase shift &lt;span class=&quot;math-container&quot;&gt;$ 2 |0\rangle \langle 0| -I $&lt;/span&gt; realize as a gate? Are there any general phrases that might somehow express that?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What does a general construction procedure look like to create a gate from a unitary matrix?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="55" LastEditDate="2019-03-15T10:59:40.420" LastActivityDate="2019-03-15T13:53:57.307" Title="How do you implement the gates for Grover's algorithm for more than 4 elements?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5700" PostTypeId="1" CreationDate="2019-03-14T09:38:26.090" Score="4" ViewCount="136" Body="&lt;p&gt;I need some hint on how to adapt grover's algorithm to search the minimum in a database with &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; elements in &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N}\log(N))$&lt;/span&gt; queries with probability of success &lt;span class=&quot;math-container&quot;&gt;$\geq 2/3$&lt;/span&gt;. I know I can do it by basically choosing randomly a &quot;pivot&quot; and then applying Grover to find a number smaller than that, then update my pivot. But is there something more to it?&lt;/p&gt;&#xA;" OwnerUserId="5816" LastEditorUserId="55" LastEditDate="2019-03-15T19:51:52.550" LastActivityDate="2019-03-15T19:51:52.550" Title="Adapting search algorithm to search the minimum in a database in $O(\sqrt{N}\log(N))$ queries" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5701" PostTypeId="2" ParentId="5692" CreationDate="2019-03-14T10:17:51.413" Score="1" Body="&lt;p&gt;For other readers who, like me, would otherwise have to go and check this, the Fredkin gate is the same thing as controlled-swap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some insight that you can get into the construction comes by focussing only on the elements &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt; on the two target qubits. The square root of swap looks like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\pi/4}\left(\begin{array}{cc} 1 &amp;amp; i \\ i &amp;amp; 1 \end{array}\right)/\sqrt{2}&#xA;$$&lt;/span&gt;&#xA;on those two elements (at least, that's the definition that I'm taking). Let's all this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. This reminds me of the beam splitter matrix in the Mach-Zehnder interferometer, which inspired the following construction.  We have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UU=X\qquad UZUZ=\mathbb{I}.&#xA;$$&lt;/span&gt;&#xA;So, what we want is a sequence of V, sqrt-SWAP, V, sqrt-SWAP where V does nothing if the control qubit is in 1 (so we get the sequence &lt;span class=&quot;math-container&quot;&gt;$UU$&lt;/span&gt;), and if the control qubit is 0, does the gate &lt;span class=&quot;math-container&quot;&gt;$\text{diag}(1,1,-1,1)$&lt;/span&gt; on the target qubits. In other words, &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is a controlled-controlled-phase up to a couple of bit flips.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the following does the job (but of course depends on what you allow your &quot;?&quot; to be constructed out of):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/oaJDj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oaJDj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-14T10:17:51.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5702" PostTypeId="1" AcceptedAnswerId="5713" CreationDate="2019-03-14T10:31:48.953" Score="3" ViewCount="251" Body="&lt;p&gt;I have installed a Python 3.7.2, download anaconda and visual studio code. Install Qiskit SDK 0.5.3. But when I launch my first test program from &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra&lt;/a&gt; I received a couple of messages like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;&quot;message&quot;: &quot;Instance of 'QuantumCircuit' has no 'h' member&quot;,&#xA;&quot;message&quot;: &quot;Instance of 'QuantumCircuit' has no 'cx' member&quot;,&#xA;&quot;message&quot;: &quot;Instance of 'QuantumCircuit' has no 'measure' member&quot;,&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I do wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;q = QuantumRegister(2)&#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q, c)&#xA;qc.h(q[0])&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q, c)&#xA;backend_sim = BasicAer.get_backend('qasm_simulator')&#xA;result = execute(qc, backend_sim).result()&#xA;print(result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6025" LastEditorUserId="55" LastEditDate="2019-03-18T12:38:57.663" LastActivityDate="2019-03-19T07:45:31.270" Title="Problems with qiskit-terra: missing members of instance QuantumCircuit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5703" PostTypeId="2" ParentId="5700" CreationDate="2019-03-14T14:30:20.407" Score="5" Body="&lt;p&gt;There is an algorithm by &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9607014.pdf&quot; rel=&quot;noreferrer&quot;&gt;Dürr and Høyer&lt;/a&gt; that seems to solve your problem. This algorithm finds the correct answer in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; time with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The crux is that they have an oracle which flips the phase of all states with a smaller value than the currently selected one. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-03-14T14:30:20.407" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5704" PostTypeId="1" AcceptedAnswerId="5712" CreationDate="2019-03-14T15:00:53.230" Score="5" ViewCount="647" Body="&lt;p&gt;I'm trying to understand this algorithm: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/9607014&lt;/a&gt; and I already have a problem on page 1, when they say that initializing the memory and &quot;marking the elements &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$T[j]&amp;lt;T[y]$&lt;/span&gt;&quot; can be achieved in &lt;span class=&quot;math-container&quot;&gt;$O(\log N)$&lt;/span&gt; steps. How is checking every singe element and marking it run in less than &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; steps? And also: is this step meant to restrict the set of states to which we apply Grover's algorithm? Can we simply forget about some kets and run it on some others? &lt;/p&gt;&#xA;" OwnerUserId="5816" LastEditorUserId="26" LastEditDate="2019-03-14T18:35:38.477" LastActivityDate="2019-03-15T07:53:06.893" Title="Durr and Hoyer's: A Quantum Algorithm for Finding the Minimum" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5705" PostTypeId="2" ParentId="5688" CreationDate="2019-03-14T15:44:41.890" Score="4" Body="&lt;p&gt;This phenomenon is sometimes known as a &lt;em&gt;discretization of errors&lt;/em&gt;. It is a property of certain error correcting codes that allows it to work. It is described (somewhat briefly) in Section 10.2 of Nielsen and Chuang. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that we have an arbitrary error that affects just one qubit, and suppose that we represent this error by a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; mapping one qubit to one qubit. Such a channel can be expressed in Kraus form as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(\rho) = A_1 \rho A_1^{\dagger} + \cdots + A_m \rho A_m^{\dagger}&#xA;$$&lt;/span&gt;&#xA;for some choice of Kraus operators &lt;span class=&quot;math-container&quot;&gt;$A_1,\ldots,A_m$&lt;/span&gt;. (For a qubit channel we can always take &lt;span class=&quot;math-container&quot;&gt;$m = 4$&lt;/span&gt; if we want, but this doesn't matter for this answer.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each of the Kraus operators &lt;span class=&quot;math-container&quot;&gt;$A_k$&lt;/span&gt; can be expressed as a linear combination of Pauli operators, because the Pauli operators form a basis for the space of 2 by 2 complex matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_k = a_k I + b_k X + c_k Y + d_k Z.&#xA;$$&lt;/span&gt;&#xA;If you now expand out the Kraus representation of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; above, you will obtain a messy expression where &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)$&lt;/span&gt; looks like a linear combination of operators of the form &lt;span class=&quot;math-container&quot;&gt;$P_i \rho P_j$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$i,j\in\{1,2,3,4\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1 = I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_2 = X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_3 = Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$P_4 = Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine that you have a quantum error correcting code that protects against an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; error on one qubit. The usual way this works is that some extra qubits in the 0 state are tacked on to the encoded data and a unitary operation is performed that reversibly computes into these extra qubits a syndrome describing which error occurred, if any, and which qubit was affected. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposing that the arbitrary error &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; happened on the first qubit for simplicity, after the syndrome computation you will end up with a state that looks like a linear combination of terms like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_i |\psi\rangle \langle \psi| P_j \otimes |P_i\: \text{syndrome}\rangle\langle P_j\:\text{syndrome}|.&#xA;$$&lt;/span&gt;&#xA;The assumption here is that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; represents the encoded data without any noise, &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_j$&lt;/span&gt; act on the first qubit, and that &quot;&lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; syndrome&quot; and &quot;&lt;span class=&quot;math-container&quot;&gt;$P_j$&lt;/span&gt; syndrome&quot; refer to the standard basis states that indicate that these errors have occurred on the first qubit. (The situation is similar for the error affecting any other qubit; I'm just trying to keep the notation simple by assuming the error happened to the first qubit.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the key is that you &lt;em&gt;measure&lt;/em&gt; (with respect to the standard basis) the syndrome to see what error occurred, and all of the cross terms disappear because of the measurement. You are left with a probabilistic mixture of states that look like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_i |\psi\rangle \langle \psi| P_i \otimes |P_i\: \text{syndrome}\rangle\langle P_i\:\text{syndrome}|.&#xA;$$&lt;/span&gt;&#xA;The error is corrected and the original state is recovered. In effect, by measuring the syndrome, you &quot;project&quot; or &quot;collapse&quot; the error to a Pauli operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me acknowledge that this answer was mostly cut-and-paste from one of my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2128/quantum-channel-models/2199#2199&quot;&gt;previous answers&lt;/a&gt; (where it seems that it did not actually answer the question).&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2019-03-14T18:38:11.413" LastActivityDate="2019-03-14T18:38:11.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5706" PostTypeId="1" AcceptedAnswerId="5707" CreationDate="2019-03-14T17:08:41.197" Score="3" ViewCount="61" Body="&lt;p&gt;I have created 10 qubits, where I have set 2 in superposition by applying Hadamard gate to each of the 2 qubits. So the 2 qubits state can be &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. I need to assign values based on the values present in 2 superpositioned qubits. For eg, if the 2 qubits are in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; I need to set the other qubits as &lt;span class=&quot;math-container&quot;&gt;$|00011110\rangle$&lt;/span&gt;, if the 2 qubits are in &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; states, I need to set the other qubits as &lt;span class=&quot;math-container&quot;&gt;$|10101010\rangle$&lt;/span&gt; and if the 2 qubits are in &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; I need to set the other qubits as &lt;span class=&quot;math-container&quot;&gt;$|11110000\rangle$&lt;/span&gt;. So in the broad sense after applying H gate to 2 qubits when they have totally 4 states for each state I need to assign qubits other values. I saw I can apply the Toffoli gate if the state is |11⟩. However, if the state is &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; then what is the way?&lt;/p&gt;&#xA;" OwnerUserId="6031" LastEditorUserId="26" LastEditDate="2019-03-14T18:32:11.143" LastActivityDate="2019-05-10T07:06:27.487" Title="How to implement such a gate where one input bit is zero and the other is one and the output should be one?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5707" PostTypeId="2" ParentId="5706" CreationDate="2019-03-14T18:10:29.150" Score="3" Body="&lt;p&gt;I believe the question boils down to &quot;How to apply a controlled version of the X gate if the control qubits should be in states other than &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Toffoli gate CCNOT applies an X gate to the target qubit if both control qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. If you need to apply an X gate if the control qubits are in some different state, you can do the following: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Convert the control qubits to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; state using X gates on qubits which have to be in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;li&gt;Apply CCNOT gate.&lt;/li&gt;&#xA;&lt;li&gt;Convert the control qubits back to their original state, using the same sequence of X gates as in step 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For example, if you need to apply an X gate to &lt;code&gt;target&lt;/code&gt; if control qubits are in &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; state, you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X(control[0]);&#xA;CCNOT(control[0], control[1], target);&#xA;X(control[0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use the same approach when implementing gates controlled on any pattern of control qubit states.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This question looks very similar to &lt;a href=&quot;https://codeforces.com/contest/1116/problem/A2&quot; rel=&quot;nofollow noreferrer&quot;&gt;problem A2&lt;/a&gt; from the recent Q# contest. If you're looking to implement this in Q#, check &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.canon.controlledonbitstring&quot; rel=&quot;nofollow noreferrer&quot;&gt;ControlledOnBitString&lt;/a&gt; library function which does exactly this. You can find the full code for the problem in the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/blob/master/Superposition/ReferenceImplementation.qs#L270&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superposition kata&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-10T07:06:27.487" LastActivityDate="2019-05-10T07:06:27.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5708" PostTypeId="1" CreationDate="2019-03-14T18:18:43.807" Score="4" ViewCount="72" Body="&lt;p&gt;I am interested to know if models in quantum mechanics and techniques like superdense coding teleportation are just single cases where they were found to work. Or rather just a prototype of many other examples of similar things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean is, the Deutsch oracle is just a single algorithm that was found or they found many examples similar to this and it is just a prototype?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superdense works only if you follow the exact protocol of applying &lt;span class=&quot;math-container&quot;&gt;$\Bbb I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZX$&lt;/span&gt;?  Only two qubits? Or rather it's just an example of many other known things?  It seems unreasonable that this is a single example. Aren't there other 3, 4 qubits with same techniques performed by applying other matrices?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same for teleportation.&lt;/p&gt;&#xA;" OwnerUserId="5742" LastEditorUserId="55" LastEditDate="2019-03-15T11:37:44.303" LastActivityDate="2019-03-15T11:37:44.303" Title="Are superdense coding and teleportation just a prototype or the 'only' type?" Tags="&lt;teleportation&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5709" PostTypeId="2" ParentId="5708" CreationDate="2019-03-14T21:00:16.500" Score="2" Body="&lt;p&gt;As for superdense coding, you can design different schemes for &lt;span class=&quot;math-container&quot;&gt;$n, m$&lt;/span&gt; qubits, but they are not giving any advantage over a simple scheme &lt;span class=&quot;math-container&quot;&gt;$1 \text{qubit} + 1 \text{ebit} \rightarrow 2 \text{cbits}$&lt;/span&gt;. In general, if Alice has access to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and Bob has access to &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits and all &lt;span class=&quot;math-container&quot;&gt;$n+m$&lt;/span&gt; qubits are entangled, then Alice can't transmit more than &lt;span class=&quot;math-container&quot;&gt;$n+\text{min}(n,m)$&lt;/span&gt; classical bits by sending her qubits to Bob. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, of course, change the task. For example, there can be many parties instead of just two, or your task might be to transmit qubits with a lesser amount of qubits by consuming entangled qubits, etc. Those tasks have different answers and different optimal schemes.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="26" LastEditDate="2019-03-15T07:50:14.130" LastActivityDate="2019-03-15T07:50:14.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5710" PostTypeId="1" CreationDate="2019-03-14T22:02:59.977" Score="3" ViewCount="71" Body="&lt;p&gt;Say I have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{2}}\bigl(|1\rangle|221\rangle|0\rangle + |3\rangle|73\rangle|2\rangle\bigr).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I change that into &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{2}}\bigl(|1\rangle|221\rangle|1\rangle + |3\rangle|73\rangle|2\rangle\bigr)?$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1589" LastEditorUserId="26" LastEditDate="2019-03-15T07:43:00.763" LastActivityDate="2019-03-15T08:35:07.473" Title="How can I invert the least significant bit of a certain term of a superposed state?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5711" PostTypeId="2" ParentId="5710" CreationDate="2019-03-15T06:46:02.833" Score="1" Body="&lt;p&gt;The first register the way you write it is about two qubits if not more. In the state, it is either 01 (1) or 11 (3).  Then I would just use a X/NOT controlled by the two qubits of the register and only applied when the control is 01. This is done by Toffoli where you use X gate in between the first qubit so the control is applied when it is 0.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2019-03-15T07:08:55.920" LastActivityDate="2019-03-15T07:08:55.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5712" PostTypeId="2" ParentId="5704" CreationDate="2019-03-15T06:59:34.657" Score="2" Body="&lt;p&gt;Well, the idea is simple. You have at first a superposition of N indexes where &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt;. So basically you are doing your operations on &lt;span class=&quot;math-container&quot;&gt;$n $&lt;/span&gt; qubits, so they are &lt;span class=&quot;math-container&quot;&gt;$\log_2(N)$&lt;/span&gt; in complexity. The oracle used for marking the states is just called once and is applied on about &lt;span class=&quot;math-container&quot;&gt;$n $&lt;/span&gt; qubits, which marks the states where the output of the oracle is 1 (the one whose values are greater in this case).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last questions you asked, if you mean to apply it on a subset of states in the superposition (often because we have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; which is not a power of 2, it is possible indeed. You can keep the states and do your quantum search with an oracle that will not mark them. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="26" LastEditDate="2019-03-15T07:53:06.893" LastActivityDate="2019-03-15T07:53:06.893" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5713" PostTypeId="2" ParentId="5702" CreationDate="2019-03-15T07:29:17.430" Score="2" Body="&lt;p&gt;The problem was at linter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's necessary to add &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &quot;python.linting.pylintArgs&quot;: [&#xA;        &quot;--disable=E1101&quot;&#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to the &lt;code&gt;settings.json&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6025" LastEditorUserId="26" LastEditDate="2019-03-15T08:47:34.973" LastActivityDate="2019-03-15T08:47:34.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5714" PostTypeId="2" ParentId="5710" CreationDate="2019-03-15T08:35:07.473" Score="2" Body="&lt;p&gt;Assuming that your last spin is of dimension 3, why not just apply the unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{ccc}&#xA;0 &amp;amp; 1 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)?&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-15T08:35:07.473" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5716" PostTypeId="2" ParentId="5699" CreationDate="2019-03-15T13:44:21.027" Score="2" Body="&lt;p&gt;Consider &lt;a href=&quot;https://arxiv.org/pdf/1703.10535.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper where an implementation of Grover's algorithm is given for three qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only difficulty when extending to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is that you need a &lt;span class=&quot;math-container&quot;&gt;$C^n\operatorname{NOT}$&lt;/span&gt; gate (bit flip oracle) or a &lt;span class=&quot;math-container&quot;&gt;$C^{n-1}Z$&lt;/span&gt; gate (phase oracle). The phase oracle is made trivially by combining a &lt;span class=&quot;math-container&quot;&gt;$C^{n-1}\operatorname{NOT}$&lt;/span&gt; gate with two Hadamard gates. The multiple controlled &lt;span class=&quot;math-container&quot;&gt;$\operatorname{NOT}$&lt;/span&gt; gate is constructed from different Toffoli-gates. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="26" LastEditDate="2019-03-15T13:53:57.307" LastActivityDate="2019-03-15T13:53:57.307" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5718" PostTypeId="1" AcceptedAnswerId="5721" CreationDate="2019-03-15T19:10:20.410" Score="5" ViewCount="266" Body="&lt;p&gt;Given access to an oracle for a function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n\to\{0,1\}^n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(y)$&lt;/span&gt; &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x\oplus y\in\{0,s\}$&lt;/span&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Simon%27s_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon's algorithm&lt;/a&gt; allows to recover &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(n)$&lt;/span&gt; queries to the oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Wikipedia page also mentions how Simon's problem is a special case of the more general Abelian &lt;a href=&quot;https://en.wikipedia.org/wiki/Hidden_subgroup_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;hidden subgroup problem&lt;/a&gt;, which concerns, given a function &lt;span class=&quot;math-container&quot;&gt;$f:G\to X$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; group, finding the normal subgroup &lt;span class=&quot;math-container&quot;&gt;$H\triangleleft G$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(y)$&lt;/span&gt; &lt;em&gt;iff&lt;/em&gt; there is some &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$x,y\in gH$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$gH$&lt;/span&gt; denoting the left &lt;a href=&quot;http://cosets&quot; rel=&quot;nofollow noreferrer&quot;&gt;coset&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I can see the similarity between the two definitions, many online sources do not explicitly spell it out, hence my asking here: &lt;strong&gt;&lt;em&gt;what is the normal subgroup that is hidden in Simon's problem?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-03-17T21:01:16.240" LastActivityDate="2019-03-17T21:01:16.240" Title="What is the hidden subgroup in Simon's problem?" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5719" PostTypeId="1" AcceptedAnswerId="5720" CreationDate="2019-03-16T11:46:32.233" Score="2" ViewCount="499" Body="&lt;p&gt;I'm working on a similar problem of that raised by Aman in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3965/inner-product-of-quantum-states/5717?noredirect=1#comment8444_5717&quot;&gt;Inner product of quantum states&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the use of Swap Test for calculating the difference of two vectors.&#xA;An example of the original Lloyd formula is given in &lt;a href=&quot;https://arxiv.org/abs/1804.10068&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum machine learning for data scientists&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I got stuck at the same point, i.e. what mathematically means the inner product between the two qubits &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, which have different size. The explanation in the paper (eq. 133) which says&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \phi|\psi\rangle = \frac{1}{\sqrt{2Z}}(|a||a\rangle - |b||b\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;looks incorrect because it equals an inner product (scalar value) with a qubit! Or am I missing something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The suggestion of composing &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; with tensor products of the identity matrices for matching &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; sizes looks a math trick because such composition is not an allowed quantum operation (identity matrix I should be supposed to be a qubit, and it's not of course). I share Aman's doubts on the demonstration of (132) i.e. &lt;span class=&quot;math-container&quot;&gt;$$|a-b|^2=2Z|\langle\phi|\psi\rangle|^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="55" LastEditDate="2021-05-22T12:02:44.903" LastActivityDate="2021-05-22T12:02:44.903" Title="Swap Test for vector difference - how are different sized inputs combined?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;machine-learning&gt;&lt;swap-test&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5720" PostTypeId="2" ParentId="5719" CreationDate="2019-03-16T16:53:53.703" Score="3" Body="&lt;p&gt;The paper you refer is incomplete and not very right on this part.&#xA;First a minus sign should be present in :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\phi\rangle =  \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, if you look at the &lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;nofollow noreferrer&quot;&gt;original reference&lt;/a&gt; of this procedure on a special case of algorithm but it can be generalized, what you swap is actually the ancilla qubit of &lt;span class=&quot;math-container&quot;&gt;$ |\psi\rangle $&lt;/span&gt; with the qubit in state &lt;span class=&quot;math-container&quot;&gt;$ |\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was mislead by this paper before but found out the trick recently. We should point out also that there is a step of estimation of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; before using this algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-03-16T16:53:53.703" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5721" PostTypeId="2" ParentId="5718" CreationDate="2019-03-17T01:20:07.047" Score="4" Body="&lt;p&gt;To see that Simon's program is an instance of an (abelian) hidden subgroup problem, we have to identify the group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, the subgroup &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, the set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and the function &lt;span class=&quot;math-container&quot;&gt;$f : G \rightarrow X$&lt;/span&gt;. Note first that the set &lt;span class=&quot;math-container&quot;&gt;$\{ 0,1 \}^n$&lt;/span&gt; of all bit vectors of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; naturally comes with a group structure given by the (component-wise) XOR between bit vectors: &lt;span class=&quot;math-container&quot;&gt;$(x_1, \ldots, x_n) \oplus (y_1, \ldots, y_n) := (x_1 \oplus y_1, \ldots, x_n \oplus y_n)$&lt;/span&gt;. Using this definition of the group law, &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; becomes an abelian (i.e., commutative) group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. Any set &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; of bit vectors generates a subgroup of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. If a set consists only of one element, i.e., &lt;span class=&quot;math-container&quot;&gt;$S=\{s\}$&lt;/span&gt;, then the group &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; generated by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; consists of just the neutral element &lt;span class=&quot;math-container&quot;&gt;$0_G$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; (i.e., the all zero bit vector &lt;span class=&quot;math-container&quot;&gt;$(0, \ldots, 0)\in G$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; itself, i.e., &lt;span class=&quot;math-container&quot;&gt;$H=\{0_G, s\}$&lt;/span&gt;. Indeed, any other multiple of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is either the zero vector or &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; as the components are added modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; and the map &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is precisely the map as given in Simon's problem. Let's check that the defining property to make &lt;span class=&quot;math-container&quot;&gt;$(G, H, f)$&lt;/span&gt; an instance of a hidden subgroup problem actually holds, namely that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant on cosets &lt;span class=&quot;math-container&quot;&gt;$gH$&lt;/span&gt; and takes different values for different cosets &lt;span class=&quot;math-container&quot;&gt;$gH \not= g'H$&lt;/span&gt;. We are promised that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(y)$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$x\oplus y \in \{0_G,s\}$&lt;/span&gt;. Pick an element &lt;span class=&quot;math-container&quot;&gt;$g \in G$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$H = \{0_G,s\}$&lt;/span&gt;, the set &lt;span class=&quot;math-container&quot;&gt;$gH$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$\{0_G \oplus g, s \oplus g\} = \{g, s\oplus g\}$&lt;/span&gt;. We have that &lt;span class=&quot;math-container&quot;&gt;$g \oplus (s \oplus g) = s$&lt;/span&gt; which implies that &lt;span class=&quot;math-container&quot;&gt;$f(g) = f(s \oplus g)$&lt;/span&gt;, i.e., the function is constant on the coset. By a similar argument we get that two different cosets get mapped to different values. This shows that Simon's problem is indeed an instance of an abelian hidden subgroup problem. Finally, note that in an &lt;a href=&quot;https://en.wikipedia.org/wiki/Abelian_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;abelian group&lt;/a&gt; every subgroup is a normal subgroup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information about the abelian hidden subgroup problem, see for instance &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9704027.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Brassard and Hoyer or &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9903071.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Mosca and Ekert. &lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="1828" LastEditDate="2019-03-17T01:25:42.950" LastActivityDate="2019-03-17T01:25:42.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5722" PostTypeId="2" ParentId="5719" CreationDate="2019-03-17T13:17:25.400" Score="7" Body="&lt;p&gt;You are not swapping the first register (one qubit) with the entire second register (&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits), but just with the first qubit of the second register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you need to know is what is meant by &lt;span class=&quot;math-container&quot;&gt;$\langle x | y \rangle$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is one qubit and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits. The resulting state is the &lt;span class=&quot;math-container&quot;&gt;$k-1$&lt;/span&gt; qubit state you get when you project one qubit (generally the first one, if it isn't specified) onto the vector &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, suppose &lt;span class=&quot;math-container&quot;&gt;$$|x\rangle = \alpha |0\rangle + \beta |1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and suppose &lt;span class=&quot;math-container&quot;&gt;$$|y\rangle = \frac{1}{\sqrt{2}}\left( |00\rangle + |11\rangle\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we take the inner product of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\langle x | y \rangle &amp;amp;=&amp;amp;  \frac{1}{\sqrt{2}} \left(\alpha^* \langle 0 | + \beta^* \langle1 | \right)&#xA; \big( |0\rangle \otimes |0\rangle + |1\rangle \otimes |1\rangle\big) \\&#xA;&amp;amp;=&amp;amp; \frac{1}{\sqrt{2}} \left( \alpha^* \langle 0| 0\rangle \otimes |0\rangle + \alpha^* \langle 0| 1\rangle \otimes |1\rangle + \beta^* \langle 1| 0\rangle \otimes | 0\rangle+\beta^* \langle 1| 1\rangle \otimes |1\rangle  \right) \\&#xA;&amp;amp;=&amp;amp;  \frac{1}{\sqrt{2}} \left( \alpha^* |0\rangle +\beta^* | 1\rangle \right)&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1765" LastEditorUserId="1765" LastEditDate="2019-03-17T13:30:36.730" LastActivityDate="2019-03-17T13:30:36.730" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5723" PostTypeId="1" AcceptedAnswerId="5725" CreationDate="2019-03-17T13:50:09.690" Score="4" ViewCount="217" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; elements database. Let's define a &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt;-bit database with &lt;span class=&quot;math-container&quot;&gt;$y \in \{0,1\}^{2N}$&lt;/span&gt; indexed by &lt;span class=&quot;math-container&quot;&gt;$(n+1)$&lt;/span&gt;-bit strings &lt;span class=&quot;math-container&quot;&gt;$j=j_1\ldots j_n j_{n+1}$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align} &#xA;y_j=\begin{cases}1 &amp;amp; \text{if }x_{j_1 \ldots j_n}=1 \text{ and } j_{n+1}=0 \\&#xA;0 &amp;amp; \text{otherwise} \end{cases}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can one implement the oracle &lt;span class=&quot;math-container&quot;&gt;$|j \rangle \rightarrow (-1)^{y_j} |j\rangle$&lt;/span&gt; using one query to the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; oracle &lt;span class=&quot;math-container&quot;&gt;$O_x: |i,b \rangle \rightarrow |i, b\oplus x_i \rangle $&lt;/span&gt; and some elementary gates?&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;Basically what would do the job on a high level would be to check if the the result of &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; was 1 or 0. If it was 1 a controlled gate on &lt;span class=&quot;math-container&quot;&gt;$j_{n+1}$&lt;/span&gt; that flips everything again if &lt;span class=&quot;math-container&quot;&gt;$j_{n+1}$&lt;/span&gt; is 1 and do nothing otherwise, if it was 0 do nothing. At least this is my intuition but I cannot formalize it.&lt;/p&gt;&#xA;" OwnerUserId="5816" LastEditorUserId="10480" LastEditDate="2021-04-30T00:59:19.967" LastActivityDate="2021-04-30T00:59:19.967" Title="Implementing an oracle" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5724" PostTypeId="1" CreationDate="2019-03-17T15:10:38.833" Score="3" ViewCount="159" Body="&lt;p&gt;I was trying to learn quantum memory and went through some papers, websites, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The current understanding I have (which I'm not sure is right) is this: Two photons are prepared together which are said to be entangled, one of the photons will interact with an atom and the state of the atom changes according to the what state the photon was in (hence, storing the memory?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that correct? If not, where did I go wrong? and what is correct?&lt;/p&gt;&#xA;" OwnerUserId="6051" LastEditorUserId="26" LastEditDate="2019-03-17T15:55:28.377" LastActivityDate="2019-03-20T20:33:43.243" Title="How does quantum memory work using atoms?" Tags="&lt;quantum-information&gt;&lt;photonics&gt;&lt;quantum-memory&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5725" PostTypeId="2" ParentId="5723" CreationDate="2019-03-17T19:47:02.653" Score="4" Body="&lt;p&gt;You can implement a multiple controlled &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Z}$&lt;/span&gt; gate on &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; qubits together with two &lt;span class=&quot;math-container&quot;&gt;$\operatorname{X}$&lt;/span&gt;-gates on the &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt;-th qubit before and after the multiple controlled gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gate can be made by constructing a multiple controlled &lt;span class=&quot;math-container&quot;&gt;$\operatorname{NOT}$&lt;/span&gt; gate, that is a &lt;span class=&quot;math-container&quot;&gt;$C^n\operatorname{NOT}$&lt;/span&gt; gate, and on the &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt;-th qubit a &lt;span class=&quot;math-container&quot;&gt;$\operatorname{H}$&lt;/span&gt;-gate before and after the multiple controlled &lt;span class=&quot;math-container&quot;&gt;$\operatorname{NOT}$&lt;/span&gt;-gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\operatorname{X}$&lt;/span&gt; gate before and after the multiple controlled gate make sure that the state is flipped for &lt;span class=&quot;math-container&quot;&gt;$j_{n+1}=0$&lt;/span&gt; instead of for &lt;span class=&quot;math-container&quot;&gt;$j_{n+1}=1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simple evaluation of the matrices shows that this works as desired. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-03-17T19:47:02.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5727" PostTypeId="1" CreationDate="2019-03-18T02:01:21.887" Score="1" ViewCount="1158" Body="&lt;p&gt;Let's say I have a pure state of the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\psi = \sqrt{\frac{3}{9}} \lvert 0 \rangle + \sqrt{\frac{6}{9}} \lvert 1 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the density matrix representation would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \psi \otimes \psi' = \begin{bmatrix}.3333&amp;amp;.4714\\4714&amp;amp;.6667\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what would be the Von Neumann entropy of this matrix? I saw that the equation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\rho) = -\text{trace}(\rho \log \rho) = 1.3455.$$&lt;/span&gt; But it's supposed to be 0, isn't it?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2021-03-03T22:36:54.957" LastActivityDate="2021-03-03T22:36:54.957" Title="How do I calculate the von Neumann entropy of a pure one-qubit density matrix?" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5728" PostTypeId="2" ParentId="5719" CreationDate="2019-03-18T08:19:54.897" Score="-2" Body="&lt;p&gt;Starting from the last index, just swap two qubits as long as you have them and then measure the ancilla qubit. This Works fine for me!!&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2019-03-21T07:23:52.987" LastActivityDate="2019-03-21T07:23:52.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5729" PostTypeId="1" AcceptedAnswerId="5737" CreationDate="2019-03-18T10:53:49.710" Score="2" ViewCount="743" Body="&lt;p&gt;I try to use Quantum SVM kernel algorithm: multiclass classifier extension. This is my code section with imports&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import scipy&#xA;from scipy.linalg import expm&#xA;import matplotlib.pyplot as plt&#xA;from mpl_toolkits.mplot3d import Axes3D&#xA;from sklearn import datasets&#xA;from sklearn.model_selection import train_test_split&#xA;from sklearn.preprocessing import StandardScaler, MinMaxScaler&#xA;from sklearn.decomposition import PCA&#xA;&#xA;&#xA;from qiskit import BasicAer&#xA;from qiskit_aqua import run_algorithm&#xA;from qiskit_aqua.input import SVMInput&#xA;import qsvm_datasets &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have an error at import any library. I received the &lt;code&gt;ImportError: DLL load failed:&lt;/code&gt; message. All libs are installed correctly. I found in my folders needed file at &lt;code&gt;\Python\Libs\site-packages\qiskit_aqua\input\svminput.py&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's my debug log:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Warning (from warnings module):&#xA;  File &quot;D:\QASM\Python368\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py&quot;, line 47&#xA;    import imp&#xA;DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses&#xA;Traceback (most recent call last):&#xA;  File &quot;\1.py&quot;, line 14, in &amp;lt;module&amp;gt;&#xA;    from qiskit_aqua import run_algorithm&#xA;  File &quot;D:\QASM\Python368\lib\site-packages\qiskit_aqua\__init__.py&quot;, line 29, in &amp;lt;module&amp;gt;&#xA;    from .utils.backend_utils import (get_aer_backend,&#xA;  File &quot;D:\QASM\Python368\lib\site-packages\qiskit_aqua\utils\__init__.py&quot;, line 31, in &amp;lt;module&amp;gt;&#xA;    from .qpsolver import optimize_svm&#xA;  File &quot;D:\QASM\Python368\lib\site-packages\qiskit_aqua\utils\qpsolver.py&quot;, line 21, in &amp;lt;module&amp;gt;&#xA;    from cvxopt import matrix, solvers&#xA;  File &quot;D:\QASM\Python368\lib\site-packages\cvxopt\__init__.py&quot;, line 50, in &amp;lt;module&amp;gt;&#xA;    import cvxopt.base&#xA;ImportError: DLL load failed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6025" LastEditorUserId="6025" LastEditDate="2019-03-19T07:43:41.680" LastActivityDate="2019-06-26T10:01:42.257" Title="Import from qiskit-aqua error" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5730" PostTypeId="1" CreationDate="2019-03-18T11:23:35.537" Score="2" ViewCount="135" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;nofollow noreferrer&quot;&gt;In this paper&lt;/a&gt; there is a quantum algorithm that can estimate the distance between a given vector U and a set of vectors V (by taking the mean). In some part of the algorithm, we need to find the sum of the vectors norm squared or Z. With the assumption that we do have some given Blackbox that will tell us the norm of each vector. So we can estimate Z by applying &lt;span class=&quot;math-container&quot;&gt;$$ {e^{-iHt}}$$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{2}}\biggl(|0\rangle + \frac{1}{\sqrt{M}}\sum_{j=1}^M|j\rangle\biggr) \otimes |0\rangle $$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$$H = \biggl(\frac{1}{\sqrt{M}}\sum_{j=0}^M |Vj| |j\rangle \langle j|\biggl) \otimes X $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Assume U = V[0] &lt;/p&gt;&#xA;What things do I need to know before I implement it? I really can't understand I tried phase rotations (around the Z axis) but it doesn't work. &#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;you can tell me a little bit about the preparation of the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; using quantum counting?&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2020-06-23T11:24:57.473" LastActivityDate="2020-06-30T04:26:29.790" Title="Estimation of Z in the quantum Euclidean algorithm" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5731" PostTypeId="2" ParentId="5730" CreationDate="2019-03-18T14:38:13.937" Score="1" Body="&lt;p&gt;Based on my understanding, the computation of Z in the quantum-ancilla based algorithm described in the above paper is basically using a post-processing vector U that amounts to estimating Z on the ancilla qubit, which is the same as observable measured in the swap test. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: In this &lt;a href=&quot;https://arxiv.org/pdf/1307.0411.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, read the last sub-paragraph just before unsupervised quantum learning (p.4).&lt;/p&gt;&#xA;" OwnerUserId="5028" LastActivityDate="2019-03-18T14:38:13.937" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5732" PostTypeId="1" CreationDate="2019-03-18T22:19:58.870" Score="4" ViewCount="298" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oCicw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oCicw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk.html#circuit=%7B%22cols%22%3A%5B%5B%22~87lj%22%5D%2C%5B%22Bloch%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22Measure%22%2C%22Measure%22%5D%2C%5B1%2C1%2C%22%E2%80%A6%22%5D%2C%5B1%2C1%2C%22Bloch%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~87lj%22%2C%22name%22%3A%22signal%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22e%5E-iYt%22%5D%2C%5B%22X%5Et%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is a quantum circuit. M represents the act of making a measurement on the first two qubits. The circuit is supposed to transfer the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a |0\rangle + b |1\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$a, b \in \Bbb C$&lt;/span&gt;) from the first qubit to the third qubit, involving a classical operation to select a quantum gate.&#xA;Depending on the measurement outcome of the first two qubits, what quantum gate should be applied in place of ‘...’, such that the transfer is successful? &#xA;The measurement results of M and the quantum gate to be applied in each case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For this circuit a purely classical and a purely quantum&#xA;circuit is possible or not?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user6057" LastEditorUserId="-1" LastEditDate="2019-05-15T15:47:52.600" LastActivityDate="2019-05-15T15:47:52.600" Title="How to complete this teleportation circuit? How to create a copy of $|\psi〉$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;measurement&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5733" PostTypeId="1" CreationDate="2019-03-18T22:46:04.900" Score="6" ViewCount="208" Body="&lt;p&gt;Is there an instance of a quantum algorithm that is faster than its classical counterpart, but doesn't use entanglement, only superposition?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2019-03-19T01:46:47.660" Title="Quantum speedup without entanglement" Tags="&lt;algorithm&gt;&lt;speedup&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5734" PostTypeId="2" ParentId="5727" CreationDate="2019-03-18T23:56:17.607" Score="3" Body="&lt;p&gt;It turns out to be a novice mistake. I was using matlab and this log is elementwise, as @Ahusain pointed out. We must take the matrix logarithm in  Matlab which is denoted by &lt;span class=&quot;math-container&quot;&gt;$logm$&lt;/span&gt;. Then the calculation becomes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\text{trace}(\rho \log m (\rho)) = \text{NaN}.$$&lt;/span&gt; The reason is, we have to define &lt;span class=&quot;math-container&quot;&gt;$0  \times \log (0)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\text{NaN}$&lt;/span&gt; which is the default behavior of Matlab. Another way to calculate it is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this density matrix is representing a pure state, it would have a diagonalization. I.e. it can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_{j} \lambda_j \lvert \phi_j \rangle \langle \phi_j \lvert$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where, &lt;span class=&quot;math-container&quot;&gt;$\lambda_j$&lt;/span&gt; are it's eigenvalues and &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi_j \rangle$&lt;/span&gt; are it's distinct eigenvectors. In which case, the von Neumann entropy is simply the shannon entropy of it's eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\rho) = H(\lambda_1, \lambda_2) = -0 \times \log(0) - 1 \times \log(1) = 0$$&lt;/span&gt;Using the above definition of &lt;span class=&quot;math-container&quot;&gt;$\log(0) = 0$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2019-03-19T17:29:25.310" LastActivityDate="2019-03-19T17:29:25.310" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5735" PostTypeId="2" ParentId="5733" CreationDate="2019-03-19T01:36:25.240" Score="3" Body="&lt;p&gt;No. Without entanglement we can always write the system as the product state of individual qbits, and those qbits are just a pair of complex numbers. We can thus simulate the quantum system on a classical computer in polynomial time &amp;amp; space, and would not gain any benefit from execution on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are methods of analysis by which a quantum computer outperforms a classical computer without entanglement such as query complexity (number of times the black box function is queried) in the Deutsch Oracle problem, but these do not translate into &quot;real world&quot; speedups and are mostly of interest to complexity theorists. When we talk about quantum speedups in the real world, it is usually a physical quantum computer compared to a classically-simulated quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-03-19T01:46:47.660" LastActivityDate="2019-03-19T01:46:47.660" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5736" PostTypeId="2" ParentId="5702" CreationDate="2019-03-19T07:45:31.270" Score="4" Body="&lt;p&gt;These messages pop up in the linter due to the way gates are dynamically added as circuit attributes in Qiskit Terra.  They can safely be ignored. In a future update of Terra these warnings will disappear.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-03-19T07:45:31.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5737" PostTypeId="2" ParentId="5729" CreationDate="2019-03-19T07:50:17.370" Score="4" Body="&lt;p&gt;You are probably running Python 3.7 on Windows.  There is a known issue for the bug you are seeing: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/issues/80&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/issues/80&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-03-19T07:50:17.370" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5738" PostTypeId="2" ParentId="4571" CreationDate="2019-03-19T07:57:51.853" Score="5" Body="&lt;p&gt;When mapping a circuit to a quantum device using Qiskit, the choice of which virtual qubits (the ones in your circuit) get mapped onto which physical (device) qubits depends on whether you let qiskit decide or you implement your own &lt;code&gt;initial_layout&lt;/code&gt;.  By default, qiskit will pick the most connected subset of the device graph that fits your circuit.  These qubits are usually not the lowest noise qubits.  If you want to select specific qubits, you can pass a layout using the &lt;code&gt;initial_layout&lt;/code&gt; keyword argument to either &lt;code&gt;execute&lt;/code&gt; or &lt;code&gt;compile&lt;/code&gt;.  Note that there may be some additional permutation of the qubit labels during the swap mapping phase, in order to lower the number of swap gates needed, if any.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-03-19T07:57:51.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5739" PostTypeId="2" ParentId="5668" CreationDate="2019-03-19T09:29:32.257" Score="6" Body="&lt;p&gt;&lt;code&gt;(QuantumRegister(3, 'a'), 0)&lt;/code&gt;&#xA; means the 0th qubit in a QuantumRegister called &lt;code&gt;'a'&lt;/code&gt; of size 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other numbers (10 and 41) are node ids for the predecessors and successors of the node. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what &lt;code&gt;({(QuantumRegister(3, 'a'), 0): 41}, {})&lt;/code&gt; is saying is there is an edge from node 41 along wire &lt;code&gt;(QuantumRegister(3, 'a'), 0)&lt;/code&gt; that ends at node 2 (the node you provided) and that this node has no successors as the second dict is empty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also worth noting this is a private function and so should not really be used in this way.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-03-19T09:29:32.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5740" PostTypeId="1" CreationDate="2019-03-19T16:37:49.370" Score="2" ViewCount="38" Body="&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/questions/467419&quot;&gt;Physics SE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It's a standard piece of quantum information theory that noise can be helpful in augmenting compatibility of quantum observables. For example given a qubit state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and the two Pauli observables &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt;, it's known that they are incompatible meaning that there is no POVM &lt;span class=&quot;math-container&quot;&gt;$\lbrace M_{x, y} \rbrace$&lt;/span&gt; giving two outcome &lt;span class=&quot;math-container&quot;&gt;$x, y$&lt;/span&gt; that has &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt; as marginals. This means that by calling &lt;span class=&quot;math-container&quot;&gt;$\lbrace E_x \rbrace$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$\lbrace L_y \rbrace$&lt;/span&gt; the effects of the measurement along &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; respectively we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E_x = \sum_{y} M_{x, y} \quad L_y = \sum_{x} M_{x, y}$$&lt;/span&gt;&#xA;If a depolarizing noise is acting one the state: &lt;span class=&quot;math-container&quot;&gt;$\rho \rightarrow \Phi_{\lambda} \left( \rho \right)$&lt;/span&gt; then the two measurement may become compatible. Indeed in the Heisenberg picture the POVMs are &lt;span class=&quot;math-container&quot;&gt;$\Phi^{\dagger} \left( \sigma_x \right)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi^{\dagger} \left( \sigma_y \right)$&lt;/span&gt;, this two admit realization as marginals of a joint POVM.&#xA;Now the question: what are the practical application of this trick? Noise is always present in any process and this says that this very level of noise that you cannot get rid of is at least acting to improve compatibility and you can  find a measurement that is better suited to extract information about the system rather than measuring &lt;span class=&quot;math-container&quot;&gt;$\Phi^{\dagger} \left( \sigma_x \right)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi^{\dagger} \left( \sigma_y \right)$&lt;/span&gt;. But given that you can control the map &lt;span class=&quot;math-container&quot;&gt;$\Phi_{\lambda}$&lt;/span&gt; why would you add noise just to improve compatibility (other than for proving it can be done). If you had &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits you could just as well divide the sample in &lt;span class=&quot;math-container&quot;&gt;$\frac{N}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{N}{2}$&lt;/span&gt; and perform different noiseless measurement on the two bunches to extract information (of course this doesn't work if you had just 1 qubit, let alone this case). It doesn't seem to be convinient to spoil the state (and lose information) just to enhance compatibility. Is it so or am I missing something? Can added &quot;noise&quot; (a generic quantum map) be actually useful for retrieving information?&lt;/p&gt;&#xA;" OwnerUserId="2490" LastEditorUserId="26" LastEditDate="2019-03-19T17:00:03.720" LastActivityDate="2019-03-19T17:00:03.720" Title="Application of improved compatibility" Tags="&lt;quantum-information&gt;&lt;measurement&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5741" PostTypeId="1" CreationDate="2019-03-19T16:54:52.957" Score="5" ViewCount="204" Body="&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/questions/467604/how-to-understand-the-quantum-operators&quot;&gt;Physics SE&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am reading a &lt;a href=&quot;https://link.springer.com/article/10.1007/s11128-016-1411-z&quot; rel=&quot;nofollow noreferrer&quot;&gt;research article&lt;/a&gt; based on quantum image watermarking (PDF &lt;a href=&quot;https://drive.google.com/file/d/1QXXqSk945XAvAyZDzVOZ-ZW5n8EFGEtJ/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). The authors have defined some unitary transforms for the watermarking schemes, which is where I am having great difficulty in understanding. The operators defined as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_1=I^{\otimes 3q-1}\otimes U\otimes |yx\rangle\langle yx|+I^{\otimes3q}\otimes \left(\sum_{j=0}^{2^n-1}\sum_{i=0, ji\neq yx}^{2^n-1}|ji\rangle\langle ji|\right)$$&lt;/span&gt;This is the operator where &lt;span class=&quot;math-container&quot;&gt;$q=8$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$n=8$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U=\begin{bmatrix}&#xA;0&amp;amp;1\\&#xA;1&amp;amp;0\end{bmatrix}$&lt;/span&gt;. This is an operator acting on &lt;span class=&quot;math-container&quot;&gt;$$|I(\theta)\rangle=\dfrac{1}{2^n}\left(\sum_{j=0}^{2^n-1}\sum_{i=0}^{2^n-1}|C(j,i)\rangle\otimes |ji\rangle \right)$$&lt;/span&gt;&#xA;Can somebody explain the operator and how does this act on &lt;span class=&quot;math-container&quot;&gt;$I(\theta)$&lt;/span&gt;. I have a sound linear algebra background but as soon as I see these quantum notations I have a hard time understanding them.&lt;/p&gt;&#xA;" OwnerUserId="6063" LastEditorUserId="26" LastEditDate="2019-04-06T14:02:05.657" LastActivityDate="2019-04-06T14:02:05.657" Title="How to understand the operators for watermarking schemes?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5742" PostTypeId="2" ParentId="5732" CreationDate="2019-03-19T18:44:04.793" Score="2" Body="&lt;p&gt;A trick you can use, in order to figure out the necessary fixups, is to see what happens when you condition the output display on the measurement results. &lt;a href=&quot;https://algassert.com/quirk.html#circuit=%7B%22cols%22%3A%5B%5B%22~87lj%22%5D%2C%5B%22Bloch%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22Measure%22%2C%22Measure%22%5D%2C%5B1%2C1%2C%22%E2%80%A6%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%97%A6%22%2C%22Bloch%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%97%A6%22%2C%22Bloch%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%80%A2%22%2C%22Bloch%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22Bloch%22%5D%2C%5B1%2C1%2C%22Bloch%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~87lj%22%2C%22name%22%3A%22signal%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22e%5E-iYt%22%5D%2C%5B%22X%5Et%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Like this&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JKsDy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JKsDy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See how the conditioned states are all pointing in different directions? Your goal is to fix that by, for each of the measurement cases, introducing controlled operations that make them all match. For example, if we decide that we want everything to match the 00 output, then the 11 output is fixed by introducing a Y fixup:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/D32HI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/D32HI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See how the first and last controlled displays now show an indicator pointing in the same direction? The CCY made them match. Find operations that do the same thing for the other two, and you have a valid teleportation circuit. Once you have that, try to simplify the fixups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some rules of thumb for finding these fixups, which continue to work in more complicated cases:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Most fixups are Pauli operations (X, Y, Z). Try those first.&lt;/li&gt;&#xA;&lt;li&gt;It is common for fixups to have one classical control instead of many classical controls. Do the cases with a single ON measurement result first, and see if controlling only on that one ON bit instead of the entire measurement result just happens to also work for all the other cases.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-03-19T18:49:25.683" LastActivityDate="2019-03-19T18:49:25.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5743" PostTypeId="2" ParentId="5741" CreationDate="2019-03-19T23:46:44.573" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I^{\otimes 23} = I\otimes I\otimes I\otimes \cdots \otimes I$&lt;/span&gt; (containing 23 identity operators, each presumably being &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; operator is just the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Left Kronecker Product&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming that &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; represent qubits, then &lt;span class=&quot;math-container&quot;&gt;$|yx\rangle\langle yx|$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix, which can be calculated as the outer product of the column vector &lt;span class=&quot;math-container&quot;&gt;$|yx\rangle$&lt;/span&gt; and the row vector which is its transpose: &lt;span class=&quot;math-container&quot;&gt;$\langle yx|$&lt;/span&gt; (this is called Dirac notation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first of two summands in your operator is, therefore, a &lt;span class=&quot;math-container&quot;&gt;$2^{26} \times 2^{26}$&lt;/span&gt; matrix which you can calculate by applying the Left Kronecker Product to 3 matrices (the &lt;span class=&quot;math-container&quot;&gt;$2^{23} \times 2^{23}$&lt;/span&gt; identity matrix, the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operator, and the 4x4 matrix &lt;span class=&quot;math-container&quot;&gt;$|yx\rangle\langle yx|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The information I've given you above should also be sufficient for you to now figure out on your own how to get the matrix for the 2nd term of the summand.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As for the 2nd part of your question, which is about how to &quot;act on &lt;span class=&quot;math-container&quot;&gt;$I(\theta)$&lt;/span&gt;&quot; with the operator &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;. It just means the same thing (the &lt;span class=&quot;math-container&quot;&gt;$I(\theta)$&lt;/span&gt; will be some &lt;span class=&quot;math-container&quot;&gt;$2^{26} \times 1$&lt;/span&gt; column vector in Dirac notation, and it can be converted to matrix notation again using the Kronecker product, which is usually taught for matrices, but if you think of column vectors as matrices where the number of columns is 1, then you can apply the Kronecker product to vectors with no problems).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is about all I can tell you without knowing more about the paper itself (such as what &lt;span class=&quot;math-container&quot;&gt;$C(i,j)$&lt;/span&gt; means and what &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; mean. The article you referred to is not free.&lt;/p&gt;&#xA;" OwnerUserId="6058" LastEditorUserId="26" LastEditDate="2019-03-20T05:34:13.687" LastActivityDate="2019-03-20T05:34:13.687" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="5744" PostTypeId="1" AcceptedAnswerId="5748" CreationDate="2019-03-20T02:13:07.107" Score="5" ViewCount="410" Body="&lt;p&gt;I came across the term &quot;diagonal to the computational basis&quot; in my reading recently. I'm not entirely sure what this term means. I know that a diagonal matrix is one with only non-zero elements on the diagonal and I know that the computational basis is &lt;span class=&quot;math-container&quot;&gt;$\alpha \left| 0 \right&amp;gt; + \beta \left| 1 \right&amp;gt;$&lt;/span&gt; but I'm not sure how these terms relate to one another nor how a particular gate could be said to be diagonal to the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="26" LastEditDate="2019-03-20T05:37:50.953" LastActivityDate="2019-03-20T19:47:08.110" Title="Meaning of &quot;diagonal to the computational basis&quot;" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5745" PostTypeId="2" ParentId="5744" CreationDate="2019-03-20T05:29:38.430" Score="3" Body="&lt;p&gt;If the computational basis is the vectors &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt;, then this means that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a diagonal matrix when written in this basis. In other words, &lt;span class=&quot;math-container&quot;&gt;$\rho=p|0\rangle\langle 0|+(1-p)|1\rangle\langle 1|$&lt;/span&gt; for some real number &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;p&amp;lt;1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="452" LastActivityDate="2019-03-20T05:29:38.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5746" PostTypeId="1" CreationDate="2019-03-20T12:28:57.173" Score="3" ViewCount="90" Body="&lt;p&gt;I am reading the paper &lt;a href=&quot;https://eprints.soton.ac.uk/422635/1/2col.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Duality of Quantum and Classical Error Correction&#xA;Codes: Design Principles &amp;amp; Examples&lt;/a&gt; and at the beginning of it, the authors describe how the general Pauli channel is related to more realistic channels such as amplitude/phase damping channels. The Pauli channel is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_P(\rho)=(1-p_x-p_y-p_z)I\rho I + p_xX\rho X+p_y Y\rho Y + p_z Z\rho Z$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to describe how such probabilities of &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; events happen depending on the relaxation (&lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;) and dephasing (&lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt;) times of a qubit, they give the next set of equations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_x=p_y=\frac{1}{4}(1-e^{-\frac{t}{T_1}})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_z=\frac{1}{4}(1+e^{-\frac{t}{T_1}}+ 2e^{-\frac{t}{T_2}})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, my doubt comes from the fact that intuitively, when the time goes to infinity, the probability of no error in the qubits should go to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, that is, complete decoherence of the system. However, making an analysis of this, this is not what happens:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lim_{t\rightarrow\infty} 1 - p_x-p_y-p_z = \lim_{t\rightarrow\infty}\frac{1}{4}(1+e^{-\frac{t}{T_1}}+2e^{-\frac{t}{T_2}})=\frac{1}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So my question here is to clarify why such probability should go to &lt;span class=&quot;math-container&quot;&gt;$1/4$&lt;/span&gt; instead of going to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, or in the case that someone knows more about this kind of relationships, to give some useful reference about it.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-03-20T20:23:12.953" Title="Clarifying the relationship of the probabilities of depolarizing channel and relaxation/dephasing times" Tags="&lt;resource-request&gt;&lt;quantum-operation&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5747" PostTypeId="1" CreationDate="2019-03-20T19:29:11.417" Score="6" ViewCount="806" Body="&lt;p&gt;I'm trying to implement a couple of algorithms on &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;, so I need to know if this device is able to handle with depth and size of my current circuit or not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the circuit size is 300 and depth is 99.&lt;/p&gt;&#xA;" OwnerUserId="6071" LastEditorUserId="26" LastEditDate="2019-03-21T11:33:57.853" LastActivityDate="2019-03-21T13:43:10.757" Title="What is maximum circuit depth and size IBM Q5 and Q16 could handle?" Tags="&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5748" PostTypeId="2" ParentId="5744" CreationDate="2019-03-20T19:47:08.110" Score="4" Body="&lt;p&gt;Matrix just encodes linear operation that transforms basis vectors to some other vectors. For example, matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; can transform vector &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to vector &lt;span class=&quot;math-container&quot;&gt;$m_{11}|0\rangle + m_{12}|1\rangle$&lt;/span&gt; and vector &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$m_{21}|0\rangle + m_{22}|1\rangle$&lt;/span&gt;. In this case, this matrix is written as &lt;span class=&quot;math-container&quot;&gt;$\left(\begin{matrix} m_{11} &amp;amp; m_{21} \\ m_{12} &amp;amp; m_{22} \end{matrix}\right)$&lt;/span&gt;. And vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;  are encoded as &lt;span class=&quot;math-container&quot;&gt;$\left(\begin{matrix} 1 \\ 0 \end{matrix}\right), \left(\begin{matrix} 0 \\ 1 \end{matrix}\right)$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a different basis the same linear operation has different matrix encoding, diagonality is not preserved under basis change.  &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-03-20T19:47:08.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5749" PostTypeId="2" ParentId="5747" CreationDate="2019-03-20T19:53:17.907" Score="6" Body="&lt;p&gt;It depends on what you mean by &quot;able to handle&quot;. You mention a circuit depth of 99, which might be possible, but what will be the fidelity of the final state with respect to the one it's supposed to be (assuming no decoherence)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your fidelity requirement is close to 100%, the maximum circuit depth that the IBM machines can handle, is zero (try just starting with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and then making a measurement ... you will not get back a pure zero, because the measurement fidelity in IBM machines, is an even bigger problem than gate fidelity).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer to your question could be &quot;circuit depth of 0&quot; or &quot;circuit depth of 99&quot; ... it all depends on how good you want your fidelity!  &lt;/p&gt;&#xA;" OwnerUserId="6058" LastActivityDate="2019-03-20T19:53:17.907" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5750" PostTypeId="2" ParentId="5746" CreationDate="2019-03-20T20:16:59.153" Score="3" Body="&lt;p&gt;Josu,&#xA;You might be mis-understanding something.&#xA;Your equation for the Pauli channel says that when &lt;span class=&quot;math-container&quot;&gt;$t\rightarrow \infty$&lt;/span&gt;, all operators (&lt;span class=&quot;math-container&quot;&gt;$X,Y,Z,I$&lt;/span&gt;) have an equal probability (1/4) of transforming the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. You seem to be suggesting that &lt;span class=&quot;math-container&quot;&gt;$t\rightarrow \infty$&lt;/span&gt;, the probability of the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operator acting on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; whould go to 0. Keep in mind that &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is an operator just like &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; and it makes sense that one might model it to be just as likely as &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think of it, is that as time goes to infinity, all sorts of things may have happened, such as the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator having acted twice, which would mean that the overall transformation on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; would be described by &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no reason why there should be a 100% chance that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; would be transformed either by &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. You are saying that there should be a 100% chance that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; changes in some way, whereas I don't see any reason why there should not be an equal chance of it staying the same as there is chance for it to be transformed by &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or by &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; or by &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, all of this is just some extremely simplified model of how decoherence really works. Therefore it is up to the authors how they want to model the decoherence, and up to the referees and the readers of the paper, whether they like the paper or not. In this case they chose a model where all four SU(2) operators have an equal probability (1/4) of acting on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$t\rightarrow \infty$&lt;/span&gt;. I personally would have modeled the qubit's bath with a Hamiltonian, and simulated the &lt;span class=&quot;math-container&quot;&gt;$\rho_{\textrm{qubit}}(t)$&lt;/span&gt; using a quantum master equation or a numerically exact method rather than this extremely simplified model, but I do not blame them. The freedom of choice goes to the author, and we are given the freedom of whether or not we like their paper :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a further point: I believe that in the &lt;strong&gt;real&lt;/strong&gt; story (if everything follows the Schroedinger equation exactly, including system and bath), the limit is &quot;un-defined&quot;. This is because decoherence will happen, then when you wait long enough, there will be a re-vival (Poincaré recurrence), then a decoherence again, then a re-vival, then a decoherence again, then a re-vival, and so on. Therefore what state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; will be in, will depend on what time you make the measurement. There is NO defined limit for sin(x) as x -&gt; &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;. Likewise, there is no defined limit for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="6058" LastEditorUserId="6058" LastEditDate="2019-03-20T20:23:12.953" LastActivityDate="2019-03-20T20:23:12.953" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5751" PostTypeId="2" ParentId="5724" CreationDate="2019-03-20T20:33:43.243" Score="2" Body="&lt;p&gt;You seem to be thinking about &quot;quantum memory&quot; like it is one specific thing and there is only one specific way it can happen. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In reality, what you describe is a valid notion of quantum memory. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another popular one, involving the element Yb, is this one: &lt;a href=&quot;https://arxiv.org/abs/1701.04195&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1701.04195&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6058" LastActivityDate="2019-03-20T20:33:43.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5752" PostTypeId="2" ParentId="5747" CreationDate="2019-03-21T13:43:10.757" Score="6" Body="&lt;p&gt;From &lt;a href=&quot;https://www.research.ibm.com/ibm-q/technology/devices/#ibmq_16_melbourne&quot; rel=&quot;noreferrer&quot;&gt;the public data given by IBM about IBM Q16 Melbourne (14 qubits available&lt;/a&gt;): &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mean gate error: &lt;span class=&quot;math-container&quot;&gt;$2.14 \times 10^{-3}$&lt;/span&gt; (probably higher for &lt;code&gt;CX&lt;/code&gt; and lower for 1-qubit gates, but this information seems to be no longer available).&lt;/li&gt;&#xA;&lt;li&gt;Mean measure error: &lt;span class=&quot;math-container&quot;&gt;$2.68\times 10^{-2}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If your circuit contains &lt;span class=&quot;math-container&quot;&gt;$300$&lt;/span&gt; gates then the probability that at least one gate fails is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;P\left(\text{at least 1 gate fails}\right) &amp;amp;= 1 - P\left(\text{all gates succeed}\right) \\&#xA;&amp;amp;= 1 - P\left( \text{1 gate succeed} \right)^{300} \\&#xA;&amp;amp;= 1 - \left( 1 - 2.14 \times 10^{-3} \right)^{300} \\&#xA;&amp;amp;\approx 0.474&#xA;\end{split}&#xA;$$&lt;/span&gt;&#xA;This means that, &lt;strong&gt;without accounting for decoherence errors&lt;/strong&gt;, your circuit fails nearly one time over two (the &lt;span class=&quot;math-container&quot;&gt;$47$&lt;/span&gt;% computed above does not take into account errors cancelling each other out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking now of decoherence errors, let's compute the time needed to the Melbourne chip to finish the execution of your circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/tree/master/backends/melbourne/V1#gate-specification&quot; rel=&quot;noreferrer&quot;&gt;decomposition of each gate in pulse&lt;/a&gt; and the &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/blob/master/backends/melbourne/V1/version_log.md#gate-specification&quot; rel=&quot;noreferrer&quot;&gt;corresponding pulses duration&lt;/a&gt; (taking a rough average of &lt;span class=&quot;math-container&quot;&gt;$360$&lt;/span&gt;ns for &lt;code&gt;CX&lt;/code&gt;) we have:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Time needed for &lt;code&gt;U1&lt;/code&gt;: &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;ns (&lt;code&gt;U1&lt;/code&gt; is &quot;free&quot; in the sense that it just change the phase of the next operation).&lt;/li&gt;&#xA;&lt;li&gt;Time needed for &lt;code&gt;U2&lt;/code&gt;: &lt;span class=&quot;math-container&quot;&gt;$100 + 20 = 120$&lt;/span&gt;ns (one &lt;code&gt;GD&lt;/code&gt; followed by a buffer time of &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt;ns).&lt;/li&gt;&#xA;&lt;li&gt;Time needed for &lt;code&gt;U3&lt;/code&gt;: &lt;span class=&quot;math-container&quot;&gt;$100 + 20 + 100 + 20 = 240$&lt;/span&gt;ns.&lt;/li&gt;&#xA;&lt;li&gt;Rough average time needed for &lt;code&gt;CX&lt;/code&gt;: &lt;span class=&quot;math-container&quot;&gt;$100 + 20 + 360 + 20 + 100 + 20 + 360 + 20 = 1000$&lt;/span&gt;ns.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Depending on the number of gates in your circuit, you can compute the time needed with the function&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def compute_rough_execution_time_melbourne_ns(number_of_U1: int, &#xA;                                              number_of_U2: int,&#xA;                                              number_of_U3: int,&#xA;                                              number_of_CX: int) -&amp;gt; int:&#xA;    return (0*number_of_U1 + 120*number_of_U2 + 240*number_of_U3 + 1000*number_of_CX)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Say you have a circuit of depth &lt;span class=&quot;math-container&quot;&gt;$90$&lt;/span&gt; with gates &lt;strong&gt;from qiskit&lt;/strong&gt; (i.e. &lt;code&gt;X&lt;/code&gt;, &lt;code&gt;Y&lt;/code&gt;, &lt;code&gt;CX&lt;/code&gt;, &lt;code&gt;H&lt;/code&gt;, ...). We will consider that the qubit on which the &lt;span class=&quot;math-container&quot;&gt;$90$&lt;/span&gt; gates are applied is the &quot;critical path&quot;, i.e. the qubit that takes the most time to reach its final state. Most of the gates in qiskit are translated to one &lt;code&gt;U2&lt;/code&gt; or &lt;code&gt;U3&lt;/code&gt;, so we can say that you have approximately 90 gates that are &lt;code&gt;U2&lt;/code&gt;, &lt;code&gt;U3&lt;/code&gt; or &lt;code&gt;CX&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say that you have &lt;span class=&quot;math-container&quot;&gt;$80$&lt;/span&gt;% of &lt;code&gt;CX&lt;/code&gt;, &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;% of &lt;code&gt;U3&lt;/code&gt; and &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;% of &lt;code&gt;U2&lt;/code&gt;. This means that you have &lt;span class=&quot;math-container&quot;&gt;$72$&lt;/span&gt; &lt;code&gt;CX&lt;/code&gt; gates, &lt;span class=&quot;math-container&quot;&gt;$14$&lt;/span&gt; &lt;code&gt;U3&lt;/code&gt; gates and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; &lt;code&gt;U2&lt;/code&gt; gates. By using &lt;code&gt;compute_rough_execution_time_melbourne_ns&lt;/code&gt; with the appropriate parameters you find that your circuit will take approximately &lt;span class=&quot;math-container&quot;&gt;$75.84 \mu s$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing the decoherence errors is not easy, but knowing that the coherence times for Melbourne are &lt;span class=&quot;math-container&quot;&gt;$T1 = 71.5\mu s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T2 = 21.4\mu s$&lt;/span&gt;, I would say that you have a relatively low probability to execute the whole circuit without at least one error due to decoherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;: without accounting for decoherence errors, you have approximately a &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt;% chance of executing successfully the circuit. With decoherence errors, the probability is much harder to compute but I would not be surprised to see it drop to less than &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;%.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-03-21T13:43:10.757" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5754" PostTypeId="2" ParentId="5741" CreationDate="2019-03-21T17:32:02.150" Score="2" Body="&lt;p&gt;You can think of a pixel state as a combination of color (&lt;span class=&quot;math-container&quot;&gt;$3q$&lt;/span&gt; qubits) and position (&lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; qubits). Authors represent the whole image as a superposition of pixels. This is a lossy image encoding, since measurement in standard basis will give the value of 1 random pixel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operator &lt;span class=&quot;math-container&quot;&gt;$_1$&lt;/span&gt; just flips the least significant qubit of color encoding for a particular pixel at a given &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; location. &#xA;This is basically a multiply controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation, an extended version of the simple CNOT gate.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;EDIT: after some research I must add, that authors of the original encoding scheme of this type (called NEQR, with grayscale encoding instead of RGB, see &lt;a href=&quot;https://www.researchgate.net/publication/257641933_NEQR_A_novel_enhanced_quantum_representation_of_digital_images&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) claim that you can &quot;retrieve digital images from quantum images accurately&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my point of view this is cheating, because to do this retrieval you need a lot of copies of the image state. The minimum number of copies must be at least the number of pixels in the image, but in general you need much bigger number of copies, infinite in the worst case. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-03-21T22:36:04.157" LastActivityDate="2019-03-21T22:36:04.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5755" PostTypeId="1" CreationDate="2019-03-22T14:53:44.030" Score="0" ViewCount="36" Body="&lt;p&gt;Implementing a single-qubit gate in a multi-qubit register is relatively easy. For example, this gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oDo5f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oDo5f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is equivalent to &lt;span class=&quot;math-container&quot;&gt;$I \otimes H \otimes I$&lt;/span&gt;. If the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate was on the first bit, it would be &lt;span class=&quot;math-container&quot;&gt;$H \otimes I^{\otimes 2}$&lt;/span&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about this gate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ITi6S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ITi6S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There doesn't seem to be any Kronecker product of the CNOT matrix that will produce the correct matrix for this. Is there a simple way to calculate the matrix for the general case of a multi-qubit gate on a larger register?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine it could be done by rearranging the qubits to put the gate on the first qubits of a register, and then reversing the rearrangement after the gate. This is a lot harder than the single-gate case though.&lt;/p&gt;&#xA;" OwnerUserId="6078" LastEditorUserId="26" LastEditDate="2019-03-23T17:44:28.233" LastActivityDate="2019-03-23T17:44:28.233" Title="How are multi-qubit gates extended into larger registers?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;gate-synthesis&gt;&lt;matrix-representation&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-03-22T15:11:59.263" ContentLicense="CC BY-SA 4.0" />
  <row Id="5756" PostTypeId="1" AcceptedAnswerId="5757" CreationDate="2019-03-23T03:38:49.687" Score="4" ViewCount="642" Body="&lt;p&gt;I'm trying to understand how the Deutsch–Jozsa algorithm works with the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,1,%22X%22],[%22H%22,%22H%22,%22H%22],[%22%E2%80%A2%22,%22X%22],[%22X%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22X%22],[%22H%22,%22H%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Circuit in Quirk&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vB3xe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vB3xe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since we have the top 2 wires measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with 100% probability, it means &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is constant. And that's what I'm having trouble understanding...what exactly is constant?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I isolate &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; I get this:&#xA;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22%E2%80%A2%22,%22X%22],[%22X%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22X%22],[%22Sample2%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Oracle function&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UfPav.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UfPav.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the concept of balanced and constant functions, and that an n-bit binary string will have &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; mappings, which gives &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible functions. So how can I see that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant in the isolated circuit above? &lt;/p&gt;&#xA;" OwnerUserId="6083" LastEditorUserId="26" LastEditDate="2019-03-29T19:52:38.397" LastActivityDate="2019-03-29T19:52:38.397" Title="Deutsch–Jozsa algorithm: why is $f$ constant?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5757" PostTypeId="2" ParentId="5756" CreationDate="2019-03-23T03:51:42.927" Score="3" Body="&lt;p&gt;The circuit you gave implements an oracle for a function &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;, which is constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vB3xe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vB3xe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can observe that there are no gates leading from the top two wires (inputs &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;) to the bottom wire (output &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;). Since the oracle is supposed to transform &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y \oplus f(x)\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; always remains unaffected, you can see that &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-03-23T03:51:42.927" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5758" PostTypeId="2" ParentId="1654" CreationDate="2019-03-23T13:37:39.397" Score="1" Body="&lt;p&gt;&lt;strong&gt;Parallel computation of the sum of two qubits&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to experience parallel computation of the sum of two qubits, a superposition of 0 and &quot;1 &lt;em&gt;with phase -1&lt;/em&gt;&quot; added to 1; and I was inspired by Mithrandir24601's answer.  The results are below. I hope my answer is within the context of what was asked.  It shows how 1 is added 1, and to 0, at the same time, but whilst both answers are calculated, we can read out the answer to only one of the calculations each time the computation is run.  You can see that out of 1000 runs, 417 times we read out the answer &quot;1&quot; (1=0+1), and 380 times and we read out the answer &quot;2&quot; (2=1+1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(34 times we got nought when the 1 bit was flipped to nought, 54 times we got 0=0+1, 29 times we got 1=1+1, 28 times we got 2=0+1, 42 times we got 3=0+1, and 16 times we got 3=1+1; each of these errors arising no doubt from bit flips, phase flips, or both).&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BUnzu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BUnzu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought an initial &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; phase (created in the 1st of 3 Hadamard gates) represented a negative digit, but it just represents a positive digit with a -1 phase factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A superposition of 0 and &quot;1 &lt;em&gt;with phase -1&lt;/em&gt;&quot; in a one qubit register is added to 1 in a two-qubit register. With three qubits, the first two qubits left to right is the sum (or the 3rd and 4th of 5) and the right-most qubit shows whether the ground state (treated as 0) was added or the excited state (1 with an initial phase of -1) was added.&lt;/p&gt;&#xA;" OwnerUserId="6086" LastActivityDate="2019-03-23T13:37:39.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5760" PostTypeId="2" ParentId="5696" CreationDate="2019-03-24T01:36:16.623" Score="9" Body="&lt;p&gt;I've been working on this problem as well. As a beginner and a classical programmer (i.e., I don't speak Quantum Mechanics), it is difficult to get an understanding of the concepts without complete examples.  I've been working with the &lt;a href=&quot;https://github.com/Microsoft/Quantum/tree/master/Samples/src/DatabaseSearch&quot; rel=&quot;noreferrer&quot;&gt;Microsoft Q# Database Search sample&lt;/a&gt;.  It simply searches for a specific index/key in the database, which is not very useful.  I have expanded upon that sample to search a list of values in a database and return the corresponding key.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As with your example, there is one two-qubit &quot;key register&quot; for the indexes, and a separate two-qubit register for the values.  There is also a fifth &quot;marked qubit&quot; that comes from Microsoft's sample, to indicate when the desired value is found.  The keys and values are associated via entanglement. That is best demonstrated with a circuit. &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22,%22X%22%5D,%5B%22%E2%80%A2%22,%22%E2%97%A6%22,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%80%A2%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22Chance2%22%5D,%5B1,1,%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B1,1,%22%E2%97%A6%22,%22%E2%80%A2%22,%22X%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;Click here to see the actual Quirk circuit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SiKmS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SiKmS.png&quot; alt=&quot;Key/Value Oracle Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this circuit contains only the oracle. It does not implement all of Grover's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The top two qubits are the key register, the next two are the value register, and the bottom qubit is the marked qubit.&lt;/li&gt;&#xA;&lt;li&gt;The first section puts the key register in a uniform superposition using Haramard gates, as required by Grover's algorithm.&lt;/li&gt;&#xA;&lt;li&gt;The second section is where the keys are associated with the values via entanglement. Each key is entangled with a corresponding value in the value register by applying (Anti-)Controlled X gates. So, when the key register is 0, then the value register will be set to 3. When the key is 1, the value is set to 2, and so on on.&lt;/li&gt;&#xA;&lt;li&gt;The third section of the circuit is the search oracle. The value register is entangled with the marked qubit. In this example, the desired value is 2. When the value register contains 2, the marked qubit will be set to 1.&lt;/li&gt;&#xA;&lt;li&gt;Grover's algorithm looks at the key register and marked qubit. The search oracle looks at the value register and sets the marked qubit. This will cause key 1 to be amplified when the value is 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;It's interesting to note that the keys and values are not stored in the qubits, but rather in the circuit/program. You could say it's not really a database per se. It's more like a switch/case statement, but one that can run on a superposition of values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more details, caveats, and Q# code, see &lt;a href=&quot;https://github.com/JoelLeach/QuantumDatabaseSearch&quot; rel=&quot;noreferrer&quot;&gt;my GitHub repository&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Something I understand better since answering... you have to reverse/undo the circuit as part of each iteration. In the Q# code, the Adjoint StatePreparationOracle() call within the ReflectStart() operation handles this, so I didn't have to do it explicitly. I don't know if Qiskit has a similar feature.  If I've done the translation properly, here is a &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22,%22H%22],[%22%E2%80%A6%22,%22%E2%80%A6%22],[%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22,%22X%22],[%22%E2%80%A2%22,%22%E2%97%A6%22,1,%22X%22],[%22%E2%97%A6%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,%22%E2%80%A6%22,%22%E2%80%A6%22],[1,1,%22%E2%97%A6%22,%22%E2%80%A2%22,%22X%22],[1,1,%22%E2%80%A6%22,%22%E2%80%A6%22],[1,1,1,1,%22Z%22],[1,1,%22%E2%80%A6%22,%22%E2%80%A6%22],[1,1,%22%E2%97%A6%22,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22%E2%97%A6%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22%E2%97%A6%22,1,%22X%22],[%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22,%22X%22],[%22H%22,%22H%22],[%22%E2%80%A6%22,%22%E2%80%A6%22],[%22X%22,%22X%22,1,1,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22Z%22],[%22X%22,%22X%22,1,1,%22X%22],[%22%E2%80%A6%22,%22%E2%80%A6%22],[%22H%22,%22H%22],[%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22,%22X%22],[%22%E2%80%A2%22,%22%E2%97%A6%22,1,%22X%22],[%22%E2%97%A6%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,%22%E2%97%A6%22,%22%E2%80%A2%22,%22X%22],[%22Chance2%22,1,%22Chance2%22,1,%22Chance%22]]%7D&quot; rel=&quot;noreferrer&quot;&gt;complete circuit&lt;/a&gt; for the example above.&lt;/p&gt;&#xA;" OwnerUserId="6087" LastEditorUserId="6087" LastEditDate="2019-04-06T15:25:17.637" LastActivityDate="2019-04-06T15:25:17.637" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5761" PostTypeId="1" CreationDate="2019-03-24T19:50:51.147" Score="3" ViewCount="698" Body="&lt;p&gt;How do I embed classical data into qubits? I have a classical data [0 1] and I want to encode it as quantum amplitude to a superposition? What are the gates used to achieve that? I am a beginner to quantum programming?&lt;/p&gt;&#xA;" OwnerUserId="6098" LastEditorUserId="55" LastEditDate="2019-03-26T17:19:59.817" LastActivityDate="2019-03-26T17:19:59.817" Title="How do I embed classical data into qubits?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5762" PostTypeId="2" ParentId="5761" CreationDate="2019-03-25T07:06:16.180" Score="3" Body="&lt;p&gt;Depending on your data there are multiple ways of doing so. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the case of normalized and standardized data (i.e. data on the unit circle). A data point can be given by &lt;span class=&quot;math-container&quot;&gt;$(a, b)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|a|^2+|b|^2=1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can choose an angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; such that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_Y(\theta)\lvert 0\rangle = a\lvert 0\rangle + b\lvert 1\rangle.$$&lt;/span&gt;&#xA;In a similar fashion this can be done for data on the unit sphere. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your data is more than two-dimensional, you have a similar trick. Suppose you have data given by &lt;span class=&quot;math-container&quot;&gt;$(a_1, a_2,\dots,a_{2^n})$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\sum_i |a_i|^2 = 1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now choose angles &lt;span class=&quot;math-container&quot;&gt;$\vec{\theta}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(\vec{\theta})\lvert 0\rangle = \sum_i a_i \lvert i\rangle,$$&lt;/span&gt;&#xA;for a suitable &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. The difficulty with this is that you have to decompose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in a sequence of one- and two-qubit gates.&lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-03-25T07:06:16.180" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5763" PostTypeId="2" ParentId="5761" CreationDate="2019-03-25T08:19:51.777" Score="2" Body="&lt;p&gt;To embed classical data, you don't need superpositions. Bit values 0 and 1 correspond directly to the quantum states of a qubit written as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. From a theorist's perspective, we don't worry about making these; it's a fundamental assertion that you can prepare, say, the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. Then one just has to apply the bit-flip gate (also known as Pauli-X) to convert the 0 into a 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's also worth noting that if you only want to perform a classical computation on these bit values (OK, why would you go to the effort of using qubits? but for the sake of argument...), you just rewrite your classical circuit as a classical reversible circuit. This can be implemented directly on the qubits. Each step will work exactly the same as it did on bits, it's just that instead of a register of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit values &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;, you have a state vector &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-25T08:19:51.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5764" PostTypeId="1" AcceptedAnswerId="5765" CreationDate="2019-03-25T13:34:58.867" Score="1" ViewCount="65" Body="&lt;p&gt;I once experimented with the tool &quot;quirk&quot; and came to a gate, whose function I can not properly tap into. I'm working in the circuit with 4 bits, the last bit is negated, so from 0 to 1. On all 4 bits then I apply a Hadamard transformation. Then this special gate is used, whose function I can not explain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aqg88.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aqg88.png&quot; alt=&quot;the gate in the red box is the one that I mean&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence my question. Can someone explain what makes the gate? How does this work? I know so far the CNOT gate and the Toffoli gate, but this one seems to be something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope the question is understandable.&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2019-03-25T15:57:09.830" LastActivityDate="2019-03-25T15:57:09.830" Title="Explanation of the function of the circuit" Tags="&lt;quantum-gate&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5765" PostTypeId="2" ParentId="5764" CreationDate="2019-03-25T13:42:30.963" Score="2" Body="&lt;p&gt;This gate is closely related to the CNOT gate that you've already learnt about. Where the CNOT gate says &quot;apply NOT to the target if the control is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&quot;, this gate says &quot;apply NOT to the target if all 3 control qubits are in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&quot;. The three control qubits are the closed black circles, and the target qubit is the other one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know more about this gate, it's probably worth starting with the &quot;Toffoli gate&quot;, which is the same but with two control qubits.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-25T13:42:30.963" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5766" PostTypeId="2" ParentId="5696" CreationDate="2019-03-25T14:07:23.777" Score="5" Body="&lt;p&gt;You need to convert the oracle to hold the database too, as a result, the general Oracle (Phase Inversion) will have two sub-oracles take a look the figure.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jHj6U.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jHj6U.png&quot; alt=&quot;General Grover&amp;#39;s algorithm circuit for database searching&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first sub-oracle that have to prepared is the memory circuit, in contrast to QRAM which stores quantum data (state) in its body, this memory (array) circuit is prepared to store only classical information in its frame. An example of such kind of circuit that stores an array of binaries [010, 110, 100, 011] is displayed below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Jo73c.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jo73c.png&quot; alt=&quot;example for a memory circuit&quot;&gt;&lt;/a&gt;&#xA;For more read &lt;a href=&quot;https://arxiv.org/pdf/1502.04943&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="26" LastEditDate="2019-03-25T15:56:17.353" LastActivityDate="2019-03-25T15:56:17.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5767" PostTypeId="1" CreationDate="2019-03-25T17:08:33.790" Score="6" ViewCount="116" Body="&lt;p&gt;I'm addressing the implementation with gates of an algorithm where there is the need of creating a qubit register &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; starting from two input qubit registers &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;, obtaining&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \frac{1}{k}(|0\rangle|a\rangle + |1\rangle|b\rangle)$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; being a normalisation factor &lt;span class=&quot;math-container&quot;&gt;$\sqrt 2$&lt;/span&gt;.&#xA;How that can be obtained using quantum gates starting from &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; and ancilla qubits as needed?&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="26" LastEditDate="2019-03-25T17:31:55.050" LastActivityDate="2019-03-26T11:26:04.513" Title="Summing states of two qubit registers" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5768" PostTypeId="1" AcceptedAnswerId="5783" CreationDate="2019-03-25T18:29:36.593" Score="6" ViewCount="197" Body="&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/questions/468623/phase-estimation-algorithm&quot;&gt;Physics SE&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Hi, I'm studying the quantum phase estimation algorithm from this book: M.A. Nielsen, I.L. Chuang, &quot;Quantum Computation and Quantum Information&quot;, Cambridge Univ. Press (2000) [~p. 221].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He defines &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; as the integer in the range &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2^t-1$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\frac{b}{2^t} $&lt;/span&gt; is the best t bit approximation to &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; (the phase that we want to estimate). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the first part of the circuit we have this state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^{t/2}} \sum\limits_{k=0}^{2^t-1} e^{2 \pi i \varphi k}|k\rangle$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the inverse quantum Fourier transform we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^t} \sum\limits_{k,l=0}^{2^t-1} e^{\frac{-2\pi i k l}{2^t}} e^{2 \pi i \varphi k} |l\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then he define &lt;span class=&quot;math-container&quot;&gt;$\alpha_l$&lt;/span&gt; as the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|(b+l) \bmod{2^t}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we want to bound the probability of obtaining a value of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|m-b|&amp;gt;e $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum\limits_{-2^{t-1} &amp;lt; l \le -(e+1)} |\alpha_l|^2 +  \sum\limits_{e+1 \le l \le 2^{t-1}} |\alpha_l|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the end with &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt; but not the one with &lt;span class=&quot;math-container&quot;&gt;$2^{t-1}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6107" LastEditorUserId="26" LastEditDate="2019-03-29T19:53:08.023" LastActivityDate="2019-03-29T19:53:08.023" Title="Phase estimation algorithm: probability bound of obtaining $m$" Tags="&lt;algorithm&gt;&lt;nielsen-and-chuang&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5769" PostTypeId="1" AcceptedAnswerId="5772" CreationDate="2019-03-25T20:39:25.970" Score="14" ViewCount="3936" Body="&lt;p&gt;Is the circuit depth the longest sequence of gates applied on one of the qubits?&#xA;Or is it something more complicated?&lt;/p&gt;&#xA;" OwnerUserId="6071" LastEditorUserId="9925" LastEditDate="2020-09-20T22:08:18.140" LastActivityDate="2020-09-20T22:08:18.140" Title="How to calculate circuit depth properly?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5770" PostTypeId="2" ParentId="5767" CreationDate="2019-03-25T22:22:29.310" Score="-1" Body="&lt;p&gt;I haven’t seen a simple way for preparing this new state, however it does not mean it is not achieveable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are both states corresponding classical &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit binary integers, the end states will be a entangled state corresponding to two &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; bit integers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will need to have &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; qubits all in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; states, then  use Grover’s algorithm to search for the two states that matches the &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; bit binary integers. Of couse this will take &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; steps to achieve the target state with desired accuracy.&lt;/p&gt;&#xA;" OwnerUserId="6109" LastEditorUserId="6109" LastEditDate="2019-03-25T22:57:07.180" LastActivityDate="2019-03-25T22:57:07.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5771" PostTypeId="2" ParentId="5769" CreationDate="2019-03-25T23:02:29.837" Score="6" Body="&lt;p&gt;It is the maximum time from input to output assuming all gates take 1 unit of time. So in this example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q496a.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q496a.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Register 3 has 5 gates, but the 2nd gate (controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) cannot be done until the controlled-&lt;span class=&quot;math-container&quot;&gt;$U^4$&lt;/span&gt; and controlled-&lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt; are done, so that adds 2 time steps. The controlled-&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; can be done at the same time as the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, so there's no added time steps there. In total we have a gate depth of 7. If you include the measurement as a &quot;gate&quot;, then the gate depth is 8.&lt;/p&gt;&#xA;" OwnerUserId="6099" LastEditorUserId="6099" LastEditDate="2019-03-27T21:43:57.493" LastActivityDate="2019-03-27T21:43:57.493" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5772" PostTypeId="2" ParentId="5769" CreationDate="2019-03-26T00:35:20.850" Score="19" Body="&lt;p&gt;The circuit depth is the length of the longest path from the input (or from a preparation) to the output (or a measurement gate), moving forward in time along qubit wires.&#xA;The stopping points on the path are the gates, the allowed paths that must be considered can enter and exit those gates on any input&amp;nbsp;/&amp;nbsp;output, and the length is the number of jumps from each gate to the next gates along the path.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(When considering a unitary circuit, there is often a convention among theorists to ignore the final measurement in the count of the depth, which I actually provided in my original answer to this question. While it might not be entirely appropriate in the context of quantum technologies, this is something you may see here and there.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put another way: the depth is the smallest amount of time steps required to perform the circuit, if every gate (including each measurement and preparation) is performed at some integer time-step, gates which act on no common qubits are allowed to be performed at the same time-step, and gates acting on at least one qubit in common must act at different time-steps (and in the correct order of course). With a bit of work, it's possible to show that determining this smallest number of time-steps amounts to the first description that I give.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Practically speaking, this is best computed with dynamic programming, taking the circuit gate by gate and computing how each gate contributes to the length of the longest path that ends at a given qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the example provided by Hastings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;img src=&quot;https://i.stack.imgur.com/Q496a.png&quot; width=&quot;400&quot; alt=&quot;A short eigenvalue estimation circuit&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is how you can compute the circuit depth, adding one gate at a time, to compute the length of the longest path that ends at a given qubit.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialise the depth ending at each qubit to 0.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Init:       [0, 0, 0, 0, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each gate in sequence (consistent with the input/output dependencies of the gates), take the maximum depth &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; to that point on all of the qubits on which the gate acts, add one, and set the new max-depth on those qubits to that result. (If you are considering a unitary circuit with final measurements, and for some reason you want to use the convention of ignoring the depth-contribution of the measurements, then just don't count the measurements.) In the case of the circuit above, this yields:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H 1:        [1, 0, 0, 0, 0]&#xA;H 2:        [1, 1, 0, 0, 0]&#xA;H 3:        [1, 1, 1, 0, 0]&#xA;CU^4 1 4 5: [2, 1, 1, 2, 2]&#xA;CU^2 2 4 5: [2, 3, 1, 3, 3]&#xA;CU^1 3 4 5: [2, 2, 4, 4, 4]&#xA;H 1:        [3, 2, 4, 4, 4]&#xA;CS 1 2:     [4, 4, 4, 4, 4]&#xA;H 2:        [4, 5, 4, 4, 4]&#xA;CT 1 3:     [5, 5, 5, 4, 4]&#xA;CS 2 3:     [5, 6, 6, 4, 4]&#xA;H 3:        [5, 6, 7, 4, 4]&#xA;Meas 1:     [6, 6, 7, 4, 4]&#xA;Meas 2:     [6, 7, 7, 4, 4]&#xA;Meas 3:     [6, 7, 8, 4, 4]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take the maximum of the depths ending at each qubit. In this case, it is qubit 3, with a depth of 8. With a little bit of work, by tracing how this depth arose, you can also find one or more particular paths through the circuit which yields this depth (&lt;em&gt;e.g.&lt;/em&gt; &lt;code&gt;H 1 ; CU^4 1 4 5 ; H 1; CS 1 2; H 2; CS 2 3; H 3; Meas 3&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-03-26T10:27:12.260" LastActivityDate="2019-03-26T10:27:12.260" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5773" PostTypeId="1" AcceptedAnswerId="5774" CreationDate="2019-03-26T03:09:11.957" Score="3" ViewCount="196" Body="&lt;p&gt;I've written a small quantum circuit simulator in python, so now I'm trying to evolve some circuits via genetic algorithms. My encoding is very simple, it's just a rectangular table of strings representing the gates. Here's a example of a random circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+--------+--------+--------+-------+--------+-------+&#xA;| qubit  | col_0  | col_1  | col_2 | col_3  | col_4 |&#xA;+--------+--------+--------+-------+--------+-------+&#xA;| q0--&amp;gt;  |   I    | CNOT_2 |   S   |   Z    |   H   |&#xA;| q1--&amp;gt;  | CNOT_0 |   T    |   S   |   I    |   T   |&#xA;| q2--&amp;gt;  |   S    |   I    |   S   | CNOT_1 |   S   |&#xA;+--------+--------+--------+-------+--------+-------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My first attempt is to generate the Toffoli gate, which input/output I encoded as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;inputs = [[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0]]&#xA;output_zero_probs = [[1, 1, 1], [1, 0, 1], [0, 1, 1], [0, 0, 0]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So there are 4 input tests, and for each one there is the correspondent output. The variable &lt;em&gt;output_zero_probs&lt;/em&gt; is the probability of measuring 0 for each wire for each input. Note that the last qubit holds the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for example, if the input is [1, 1, 0], the output should be [1, 1, 1], which correspondes to output_zero_probs of [0, 0, 0].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fitness functions is just some measure of similarity between the circuit output and the expected output probabilities. The circuit dimension was fixed to 3 x 17, ie, 3 qubits x 17 columns. The mutation operator just changes a random cell, and the crossover operator exchanges an entire 'column' between 2 circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far it was not able to find the correct solution, it seems to evolve a bit, then it get stuck. Is this a feasible problem for a GA? If so, how can I improve on this? I mean, how can I 'push' the circuit to the right direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your attention!&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I think it's better to compare the final state of the system with the expected final state, instead of using probabilities, because these may change depending on the measures (I'm not sure if this reasoning is correct).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Follow up question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5833/genetic-algorithm-does-not-converge-to-exact-solution&quot;&gt;Genetic algorithm does not converge to exact solution&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6083" LastEditorUserId="6083" LastEditDate="2019-04-01T18:41:29.923" LastActivityDate="2019-04-01T18:41:29.923" Title="Evolving a quantum circuit using a genetic algorithm" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5774" PostTypeId="2" ParentId="5773" CreationDate="2019-03-26T08:04:19.267" Score="3" Body="&lt;p&gt;So in your example, you try to find the quantum circuit representing the Toffoli operation.&#xA;I would then change my objective/fitness function and compare the unitary matrix representing the operation. You can use an minimization objective like : &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{F} = 1-\frac{1}{2^n} |\operatorname{Tr}(U_aU_t^{\dagger})| $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$ U_a $&lt;/span&gt; is the unitary of the generated solution and &lt;span class=&quot;math-container&quot;&gt;$ U_t $&lt;/span&gt; the unitary you are trying to get. The trace part of this objective means try to get &lt;span class=&quot;math-container&quot;&gt;$ U_aU_t^{\dagger} $&lt;/span&gt; to the identity matrix on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, when using a genetic algorithm, many strategies can be tried, and may generate better solutions than others. You can look at this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4426/understanding-the-group-leaders-optimization-algorithm&quot;&gt;question&lt;/a&gt; where a genetic algorithm is used for circuit decomposition.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-03-26T08:04:19.267" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="5775" PostTypeId="1" CreationDate="2019-03-26T08:56:59.427" Score="3" ViewCount="146" Body="&lt;p&gt;In the chapter about the Grover algorithm, it is suggested that the gate which executes the phase shift is given in the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9YmeF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9YmeF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I have looked at this gate in detail and come to the conclusion that this &quot;only&quot; negates the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, but not all others, this can be shown for different inputs &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; (the gate changes only &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to -&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;) or see &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22%E2%80%A6%22],[%22X%22,%22X%22],[1,%22H%22],[%22%E2%80%A2%22,%22X%22],[1,%22H%22],[%22X%22,%22X%22],[%22%E2%80%A6%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I'm sorry, because in the chapter it says a few pages earlier: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$-|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; remains to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (picture left section). But that does not correspond to the circuit (picture right section).&#xA;That's why I ask myself, what is right now? I want to do this a bit further, we say the Grover operator is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}(2|0\rangle\langle 0|-I)H^{\otimes n}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means I have several Hadamard transformations before and then do the phase shift, followed by Hadamard transformations. I think that you can see this in &lt;span class=&quot;math-container&quot;&gt;$(2|0\rangle\langle 0|-I)$&lt;/span&gt; (matrix with 1 in the first row, all other rows -1), that &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$-|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; stays &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. But that does not correspond to the circuit (picture right).&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2019-03-26T12:28:27.897" LastActivityDate="2019-12-20T01:21:43.430" Title="N&amp;C quantum circuit for Grover's algorithm" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5776" PostTypeId="2" ParentId="5767" CreationDate="2019-03-26T09:13:02.010" Score="4" Body="&lt;p&gt;If I understand your question correctly, you're asking if it's possible to be given two unknown states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;, which may not be orthogonal, and you want to know if there's a transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a\rangle|b\rangle\mapsto\frac{1}{\sqrt{2}}(|0a\rangle+|1b\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, this is impossible to realise deterministically. Let me give a sketch of a proof (it's similar to a standard proof of no cloning).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want this to be a unitary evolution, then we need some ancilla states. Thus, we'd be after the transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a\rangle|b\rangle|s\rangle\mapsto\frac{1}{\sqrt{2}}(|0a\rangle+|1b\rangle)|t_{ab}\rangle.&#xA;$$&lt;/span&gt;&#xA;Now, let's consider two particular inputs, &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; or 1. We need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|0\rangle|s\rangle\mapsto\frac{1}{\sqrt{2}}(|00\rangle+|10\rangle)|t_{0}\rangle \\&#xA;|0\rangle|1\rangle|s\rangle\mapsto\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)|t_{1}\rangle.&#xA;$$&lt;/span&gt;&#xA;Using linearity, we can therefore infer what the evolution has to be for any input &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle(\alpha|0\rangle+\beta|1\rangle)|s\rangle\mapsto\frac{1}{\sqrt{2}}(\alpha|00\rangle|t_0\rangle+\alpha|10\rangle|t_0\rangle+\beta|00\rangle|t_1\rangle+\beta|11\rangle|t_1\rangle)&#xA;$$&lt;/span&gt;&#xA;but it &lt;em&gt;should&lt;/em&gt; be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|00\rangle+\alpha|10\rangle+\beta|11\rangle)|\tilde t\rangle.&#xA;$$&lt;/span&gt;&#xA;To achieve equality, we'd need &lt;span class=&quot;math-container&quot;&gt;$|\tilde t\rangle=|t_1\rangle=|t_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(\alpha|t_0\rangle+\beta|t_1\rangle)=|\tilde t\rangle$&lt;/span&gt;. This can only happen if &lt;span class=&quot;math-container&quot;&gt;$\alpha\beta=0$&lt;/span&gt;, i.e. for the two cases we fixed initially; no other case works, making the transformation impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure one could improve the structure of this proof so that you don't have to make as many assumptions about what's included in the possible set of states to do this with.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the two states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; are guaranteed to be orthogonal, in a known basis, I believe that the transformation is achievable.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-03-26T09:13:02.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5777" PostTypeId="2" ParentId="5767" CreationDate="2019-03-26T11:26:04.513" Score="3" Body="&lt;p&gt;It's impossible if &lt;span class=&quot;math-container&quot;&gt;$|a\rangle, |b\rangle$&lt;/span&gt; are unknown, as DaftWullie proved in his answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though, you can construct another operation, that might suit your needs&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle|a\rangle|b\rangle \mapsto \frac{1}{\sqrt{2}}(|0\rangle|a\rangle|b\rangle + |1\rangle |b\rangle|a\rangle)$$&lt;/span&gt;&#xA;Just use &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on the first qubit, and then controlled swap of the two last registers.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|a\rangle,|b\rangle$&lt;/span&gt; are known in advance, then you can construct whatever you want.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-03-26T11:26:04.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5778" PostTypeId="1" CreationDate="2019-03-26T11:59:33.720" Score="4" ViewCount="457" Body="&lt;p&gt;I have a quantum circuit which I would like to understand, which compares two standard basis states &lt;span class=&quot;math-container&quot;&gt;$|YX\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|AB\rangle$&lt;/span&gt;.&#xA;It operates on the corresponding bits in each of the two states: &lt;em&gt;i.e.&lt;/em&gt;, if &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA; &amp;amp;|YX\rangle=|y_{n-1}y_{n-2}...y_0x_{n-1}x_{n-2}..x_0\rangle \quad\text{and}&#xA;\\&amp;amp;|AB\rangle=|a_{n-1}a_{n-2}...a_0b_{n-1}b_{n-2}....b_0\rangle,&#xA;\end{align*}&#xA;$$&lt;/span&gt; this operator or gate seems to act on the bits &lt;span class=&quot;math-container&quot;&gt;$y_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt;, and on the bits &lt;span class=&quot;math-container&quot;&gt;$x_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_j$&lt;/span&gt;, for each &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the diagram of the circuitry involved: I understand the computations part of it, but can anybody explains the diagram:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tiYDT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tiYDT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-03-30T07:49:11.610" LastActivityDate="2019-04-27T19:37:57.773" Title="Understanding quantum circuit diagrams: a circuit that compares two states $|YX\rangle$ and $|AB\rangle$" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5779" PostTypeId="1" AcceptedAnswerId="5782" CreationDate="2019-03-26T12:11:16.280" Score="8" ViewCount="909" Body="&lt;p&gt;The query oracle: &lt;span class=&quot;math-container&quot;&gt;$O_{x}|i\rangle|b\rangle =  |i\rangle|b \oplus x_{i}\rangle$&lt;/span&gt; used in algorithms like Deutsch Jozsa is unitary. How do I prove it is unitary? &lt;/p&gt;&#xA;" OwnerUserId="5542" LastEditorUserId="10480" LastEditDate="2021-04-30T01:02:11.993" LastActivityDate="2021-04-30T01:02:11.993" Title="How to prove that the query oracle is unitary?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;unitarity&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5780" PostTypeId="2" ParentId="5779" CreationDate="2019-03-26T12:18:22.630" Score="10" Body="&lt;p&gt;Apply it twice:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O_xO_x|i\rangle|b\rangle=O_x|i\rangle|b\oplus x_i\rangle=|i\rangle|b\oplus x_i\oplus x_i\rangle=|i\rangle|b\rangle&#xA;$$&lt;/span&gt;&#xA;Hence, &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; is its own inverse, and therefore reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prove unitarity, it makes more sense to prove that &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; has eigenvectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|i\rangle(|0\rangle+|1\rangle)\quad\text{and}\quad|i\rangle(|0\rangle-|1\rangle)&#xA;$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x_i}$&lt;/span&gt; respectively. These are all orthonormal, and span the full Hilbert space. Consequently, the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; are all &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and therefore &lt;span class=&quot;math-container&quot;&gt;$O_x^\star=O_x$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$^\star$&lt;/span&gt; represents the Hermitian conjugate). Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O_xO_x^\star=\mathbb{I},&#xA;$$&lt;/span&gt;&#xA;as required for a unitary.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-03-27T08:51:01.510" LastActivityDate="2019-03-27T08:51:01.510" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5781" PostTypeId="2" ParentId="5778" CreationDate="2019-03-26T17:08:52.927" Score="2" Body="&lt;h2&gt;How to read the circuit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You should think of this as a diagram describing a transformation of the qubits.&#xA;The input state of the qubits is on the left, and describes the state &lt;span class=&quot;math-container&quot;&gt;$|Y\rangle \otimes |X\rangle \otimes |A\rangle \otimes |B\rangle$&lt;/span&gt;, reading the qubits from top to bottom. Each qubit corresponds to a horizontal wire, which we trace from left to right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The qubits are acted on by operations, which are represented by nodes, symbols, or boxes which interrupt the wires. We think of these (abstractly) as gates which happen at a specific moment in time, &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;at integer time steps. These correspond to quantum gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbols in your upper circuit are different variations of controlled-not gates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A filled cdot on one wire, directly above (or below) an &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; symbol on another wire, represents a CNOT gate where the target is where the &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; symbol is put. These are connected by a vertical wire, which may pass over other qubit wires. (These qubits are not involved in the operation).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A hollow dot on one wire, directly above (or below) an &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; symbol on another wire, represents a CNOT gate where the target is where the &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; symbol is put, and where the operation is conditioned on the control being in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A vertical wire which connects several filled (or empty) dots to an &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; symbol is a multiply-controlled NOT gate. In the case that all of the dots are filled, it performs the operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{C^k NOT} = \mathbf 1^{\otimes k} \otimes \mathbf 1 + \Bigl(\lvert11\cdots1\rangle\!\langle11\cdots1\rvert \otimes \bigl(X - \mathbf 1\bigr)\Bigr)$$&lt;/span&gt;&#xA;which performs an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation on the target provided that all of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; control qubits (marked with filled dots) are all in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Variations in which some or all of the dots are hollow depend on those specific qubits being in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; instead; and the gate acts on arbitrary states in linear superposition, according to how they decompose into standard basis states. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;What the circuit does&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Most of the gates in the circuit are CNOT gates, but conditioned on the control being 0 instead of 1:&lt;span class=&quot;math-container&quot;&gt;$\def\xCNOT{\overline{\textrm{CNOT}}}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \xCNOT = \lvert 0 \rangle\!\langle 0 \rvert \otimes X + \lvert 1 \rangle\!\langle 1 \rvert \otimes \mathbf 1 $$&lt;/span&gt;&#xA;(note that this is not standard notation). What happens if you take two standard basis states, and act on them with this opposite-CNOT, is that the target will have the value 1 if and only if the control and target had different values.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA; \xCNOT \lvert a \rangle\lvert b \rangle&#xA;  &amp;amp;= \lvert a \rangle \lvert b \oplus (\neg a)\rangle&#xA;  \\&amp;amp;= \lvert a \rangle \lvert b \oplus (a \oplus 1)\rangle&#xA;  \\&amp;amp;= \lvert a \rangle \lvert (b \oplus a) \oplus 1\rangle&#xA;  \\&amp;amp;= \begin{cases}&#xA;          \lvert a \rangle \lvert 0 \rangle, &amp;amp; \text{if $a = \neg b$};&#xA;       \\ \lvert a \rangle \lvert 1 \rangle, &amp;amp; \text{if $a = b$}.&#xA;       \end{cases}&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Your circuit is performing this, and then performing a multiply-controlled-NOT gate conditioned on those targets all being equal to 1 &amp;mdash; that is, conditioned on all of those pairs of qubits being equal if they happen to be standard basis states.&#xA;If that is the case, then the pairs of inputs are indeed equal, so the target of that multiply-controlled-NOT gate is flipped.&#xA;The computation of whether the individual qubit-pairs are equal is then undone to restore the original standard basis inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For general quantum states, this all occurs in coherent superposition, of course. But for standard basis states, this realises an equality test.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-04-27T19:37:57.773" LastActivityDate="2019-04-27T19:37:57.773" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="5782" PostTypeId="2" ParentId="5779" CreationDate="2019-03-26T17:49:55.690" Score="5" Body="&lt;p&gt;Notice that &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; is a permutation matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix elements are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle j, c\rvert\mathcal O_x\lvert i,b\rangle&#xA;=\delta_{ij}\langle c\rvert b\oplus x_i\rangle&#xA;=\delta_{ij}\delta_{c,b\oplus x_i}.$$&lt;/span&gt;&#xA;In other words, &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; is diagonal with respect to the first register, and, for each block corresponding to a given &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, connects all and only the indices &lt;span class=&quot;math-container&quot;&gt;$b,c$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$b\oplus c=x_i$&lt;/span&gt; (remember that here &lt;span class=&quot;math-container&quot;&gt;$b,c,x_i\in\mathbb Z_2^{\otimes n}$&lt;/span&gt; are length-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit strings).&#xA;Also, notice that for a given &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; there is no more than one &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$b\oplus c=x_i$&lt;/span&gt; (more precisely, there isn't any such &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x_i=0$&lt;/span&gt;, and there is exactly one if &lt;span class=&quot;math-container&quot;&gt;$x_i\neq 0$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It follows that &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; is a (real) permutation matrix, and such matrices &lt;a href=&quot;https://math.stackexchange.com/a/2505462/173147&quot;&gt;are always unitarily diagonalizable with unit eigenvalues&lt;/a&gt; (and therefore unitary).&#xA;In this case, we have that the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt;, and the eigenvectors are, in the case &lt;span class=&quot;math-container&quot;&gt;$x_i\neq 0$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert i\rangle\otimes(\lvert b\rangle\pm\lvert b\oplus x_i\rangle)$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$x_i=0$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; is the identity, and therefore its spectrum is trivial&lt;span class=&quot;math-container&quot;&gt;${}^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This shows explicitly that &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; is unitarily diagonalizable with unit eigenvalues, and therefore is unitary.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${}^\dagger$&lt;/span&gt; I'm actually being a bit sloppy for the sake of simplicity here. This analysis holds for each different block of &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; corresponding to a given &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. More precisely, I should say that &lt;span class=&quot;math-container&quot;&gt;$\mathcal O_x$&lt;/span&gt; is block-diagonal as it doesn't connect spaces with &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt; on the first register, and each block is either  the identity in the subspace in which it acts if &lt;span class=&quot;math-container&quot;&gt;$x_i=0$&lt;/span&gt;, or a permutation matrix that connects different pairs of basis states if &lt;span class=&quot;math-container&quot;&gt;$x_i\neq 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-03-26T18:05:33.147" LastActivityDate="2019-03-26T18:05:33.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5783" PostTypeId="2" ParentId="5768" CreationDate="2019-03-27T01:23:36.920" Score="2" Body="&lt;p&gt;Was a clarifying comment:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm interpreting your confusion correctly. You're thinking you just need to say &lt;span class=&quot;math-container&quot;&gt;$e+1 \leq l$&lt;/span&gt; not the &lt;span class=&quot;math-container&quot;&gt;$l \leq 2^{t-1} $&lt;/span&gt; part. After all there is no such coefficient as &lt;span class=&quot;math-container&quot;&gt;$\alpha_{100000}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is only 3 for example. All that &lt;span class=&quot;math-container&quot;&gt;$2^{t-1}$&lt;/span&gt; is doing is making sure there are only &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; coefficients. That is it is a qudit with &lt;span class=&quot;math-container&quot;&gt;$d=t$&lt;/span&gt;. Is that your confusion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing from there:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change the indexing from 0 to &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; as you have already by subtracting &lt;span class=&quot;math-container&quot;&gt;$2^{t-1}$&lt;/span&gt; so you get &lt;span class=&quot;math-container&quot;&gt;$-2^{t-1}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2^{t-1}$&lt;/span&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;l just has to be indexed by a fundamental domain of modulo &lt;span class=&quot;math-container&quot;&gt;$2^{t}$&lt;/span&gt; so 0 to &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; works just as well as &lt;span class=&quot;math-container&quot;&gt;$-2^{t-1}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2^{t-1}$&lt;/span&gt;. The answer just looks symmetrical with the second.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-03-27T01:23:36.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5784" PostTypeId="1" AcceptedAnswerId="5786" CreationDate="2019-03-27T01:47:09.047" Score="5" ViewCount="112" Body="&lt;p&gt;I'm watching Christian Schaffner's talk on quantum position-based cryptography (link &lt;a href=&quot;https://www.youtube.com/watch?v=c9S65rJbKNI&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;) and have a question about a particular application of teleportation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At about the 16:40 mark, he seems to say something along these lines (notation is mine)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice receives a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, which is an element of some basis &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;. Alice teleports it to Bob, which gives him the state &lt;span class=&quot;math-container&quot;&gt;$|\psi^\prime\rangle = X^{M_1}Z^{M_2}|\psi\rangle$&lt;/span&gt;, for some values &lt;span class=&quot;math-container&quot;&gt;$M_1,M_2$&lt;/span&gt; which Alice learns as a result of teleportation. What's next is the part that confuses me. He says that Bob can measure &lt;span class=&quot;math-container&quot;&gt;$|\psi^\prime\rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; basis, and then when he receives the classical values &lt;span class=&quot;math-container&quot;&gt;$M_1,M_2$&lt;/span&gt;, he can apply the &lt;span class=&quot;math-container&quot;&gt;$Z^{M_2}X^{M_1}$&lt;/span&gt; to recover &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; Since &lt;span class=&quot;math-container&quot;&gt;$|\psi^\prime\rangle = X^{M_1}Z^{M_2}|\psi\rangle$&lt;/span&gt;, how can we be sure that Bob's measurement will always return the same value? Certainly if he measured &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; basis, he would get result &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with 100% certainty. But if &lt;span class=&quot;math-container&quot;&gt;$|\psi^\prime\rangle$&lt;/span&gt; is some &lt;em&gt;superposition&lt;/em&gt; of basis states, then Bob's answer will not always be the same.&lt;/p&gt;&#xA;" OwnerUserId="6118" LastEditorUserId="124" LastEditDate="2019-03-27T17:13:42.967" LastActivityDate="2019-03-30T02:10:44.630" Title="Quantum teleportation of a state, from one of two bases" Tags="&lt;quantum-information&gt;&lt;mathematics&gt;&lt;cryptography&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5786" PostTypeId="2" ParentId="5784" CreationDate="2019-03-27T15:17:28.630" Score="5" Body="&lt;p&gt;Alice receives a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, which is an element of some basis &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;, though she does not know what &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; is. She then teleports this to Bob, &lt;em&gt;who is told by someone else what &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; is&lt;/em&gt;. Furthermore, it seems that specifically either &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B} = \{ \lvert 0 \rangle, \lvert 1 \rangle \}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B} = \{ \lvert + \rangle, \lvert - \rangle \}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last detail is important here.&#xA;It means that the basis is either the eigenbasis of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator, or the eigenbasis of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator &amp;mdash; which means that when Bob wants to do the corrections, one of the two corrections which he will perform will in principle have no effect, while the other will simply interchange the two possible basis elements.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In a normal teleportation procedure, just after Alice's measurement, the state on Bob's side looks perfectly random to him.&#xA;If Bob didn't know whether Alice would be sending one of the states &lt;span class=&quot;math-container&quot;&gt;$\{ \lvert 0 \rangle, \lvert 1 \rangle \}$&lt;/span&gt; or one of the states &lt;span class=&quot;math-container&quot;&gt;$\{ \lvert + \rangle, \lvert - \rangle \}$&lt;/span&gt;, there is very little that he can do with this qubit which would be of any use: he would have to wait to obtain Alice's measurement outcomes.&#xA;If he did wait for Alice's measurement outcomes, he could perform the necessary &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and/or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; correction to obtain the state.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If someone (Alice or someone else) then came along and told him what&#xA;basis &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; his state was in, he could perform a&#xA;(non-demolition) measurement in the basis &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; to find out&#xA;which state it is without disturbing it.&#xA;But the outcome of this measurement is not affected by one of the corrections he did from Alice's measurement outcomes. If &lt;span class=&quot;math-container&quot;&gt;$\mathcal B = \{ \lvert 0 \rangle, \lvert 1 \rangle \}$&lt;/span&gt;, then the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; correction from Alice's teleportation results didn't have any effect on the teleported state; and if &lt;span class=&quot;math-container&quot;&gt;$\mathcal B = \{ \lvert + \rangle, \lvert - \rangle \}$&lt;/span&gt;, then the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; correction from Alice's teleportation results didn't have any effect.&#xA;The effect of the other correction, on the other hand, would be just to interchange the two possible states of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; measurement, which could have been done before or after the measurement.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It follows that if someone told Bob what basis &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; Alice's state was going to be in, he could perform the &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; measurement first, and then wait for Alice's measurement results.&#xA;The measurement will disturb the state, but it will only collapse it to a state of the same basis &lt;span class=&quot;math-container&quot;&gt;$\mathcal B$&lt;/span&gt; that Alice is sending; then Alice's teleportation results will give Bob enough information to correct the state. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now, if Bob performs the measurement before Alice sends him the correction information, the result of his measurement will be random. But because the two bases are either the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; eigenbasis or the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; eigenbases, the outcome of his measurement will either be the state he is meant to obtain or the orthogonal state; he will always know that the state he obtains is one of those two states, and what those two states are; and it will always be correctable using the information that Alice sends. (The same is also true if there is a third possibility, that the state is in the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; eigenbasis, for essentially the same reason using the fact that &lt;span class=&quot;math-container&quot;&gt;$Y \propto XZ$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-03-27T15:17:28.630" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5787" PostTypeId="1" AcceptedAnswerId="6244" CreationDate="2019-03-27T17:02:42.607" Score="5" ViewCount="404" Body="&lt;p&gt;I am currently working on the proof of Grover's algorithm, which states that the runtime is optimal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Nielsen they say, the idea is to check whether &lt;span class=&quot;math-container&quot;&gt;$D_k$&lt;/span&gt; is restricted and does not grow faster than &lt;span class=&quot;math-container&quot;&gt;$O(k^2)$&lt;/span&gt;. Now in Nielsen, an inductive proof is given which I do not quite understand. The algorithm starts in &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and applies &lt;span class=&quot;math-container&quot;&gt;$O_x$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-times, with some unitary operators. We now define:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$O_x=I-2|x\rangle\langle x|$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_k^x\rangle=U_kO_x...U_1 O_x|\psi\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_k\rangle=U_k...U_1|\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$D_k$&lt;/span&gt; is defined as a deviation after &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{k}=\sum_x |||\psi_k^x\rangle-|\psi_k\rangle||^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a proof it should now be shown that &lt;span class=&quot;math-container&quot;&gt;$D_k$&lt;/span&gt; is restricted and can not grow fatser than &lt;span class=&quot;math-container&quot;&gt;$O(k^2)$&lt;/span&gt;. Now we come to the actual problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am interested in the proof of some points:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why does it have to be shown that &lt;span class=&quot;math-container&quot;&gt;$D_k$&lt;/span&gt; is limited?&lt;/li&gt;&#xA;&lt;li&gt;Why must it be shown that &lt;span class=&quot;math-container&quot;&gt;$D_k$&lt;/span&gt; does not grow faster than &lt;span class=&quot;math-container&quot;&gt;$O(k^2)$&lt;/span&gt;? What &#xA;is the idea behind it?&lt;/li&gt;&#xA;&lt;li&gt;In the second proof it is to be assumed that &lt;span class=&quot;math-container&quot;&gt;$D_k=\Omega(N)$&lt;/span&gt; holds, why exactly is that important? Which statement is behind it?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If someone needs more information, I have a helpful PDF &lt;a href=&quot;https://fenix.tecnico.ulisboa.pt/downloadFile/3779577374068/licao_19.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Otherwise, I can also give more information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that these are not too many questions at once, but I would be glad if someone could give me some clarity.&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="55" LastEditDate="2019-05-27T02:31:49.423" LastActivityDate="2019-05-27T02:40:24.733" Title="Proof of the optimality of Grover's algorithm" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5789" PostTypeId="1" AcceptedAnswerId="5798" CreationDate="2019-03-27T19:08:51.400" Score="4" ViewCount="139" Body="&lt;p&gt;I'm studying the quantum search algorithm on this book:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;M.A. Nielsen, I.L. Chuang, &quot;Quantum Computation and Quantum Information&quot;, Cambridge Univ. Press (2000) [~p. 252].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up we have a state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \cos( \frac{\theta}{2}) |\alpha \rangle + \sin( \frac{\theta}{2})|\beta\rangle$$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\theta \in [0, \pi]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we apply an operator called G that performs a rotation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G |\psi \rangle = \cos( \frac{3\theta}{2}) |\alpha \rangle + \sin( \frac{3\theta}{2})|\beta\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continued application of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; takes the state to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G^k |\psi \rangle = \cos( \frac{(2k+1)\theta}{2}) |\alpha \rangle + \sin( \frac{(2k+1)\theta}{2})|\beta\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the book says: &quot; Repeated application of the Grover iteration rotates the state vector close to &lt;span class=&quot;math-container&quot;&gt;$| \beta \rangle $&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why? Probably it is a silly doubt but I can't figure out. &lt;/p&gt;&#xA;" OwnerUserId="6107" LastEditorUserId="55" LastEditDate="2019-03-28T19:35:21.510" LastActivityDate="2019-03-28T19:45:08.163" Title="In what sense do repeated applications of Grover's operator rotate the state closer to the target?" Tags="&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5790" PostTypeId="2" ParentId="5789" CreationDate="2019-03-27T19:26:56.153" Score="3" Body="&lt;p&gt;In the space of &lt;span class=&quot;math-container&quot;&gt;$\{|\alpha \rangle ,|\beta\rangle\}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$|\beta \rangle$&lt;/span&gt; is the solution vector) vectors, which are orthogonal, there is an initial angle of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;. As you can see from the result that &lt;span class=&quot;math-container&quot;&gt;$\sin \frac{(2k+1)\theta}{2}$&lt;/span&gt; increases when &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; increases for the respective anglular range &lt;span class=&quot;math-container&quot;&gt;$\{0,\pi/2 \}$&lt;/span&gt; while &lt;span class=&quot;math-container&quot;&gt;$\cos \frac{(2k+1)\theta}{2}$&lt;/span&gt; decreases. So the probability of getting state &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$|\sin \frac{(2k+1)\theta}{2}|^2$&lt;/span&gt; increases, before it overshoots with repeated iterations the vector &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle$&lt;/span&gt; at some iteration. The required value of approximate number of iterations can be caculated beforehands for a given problem. This is approximately equal to&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;R\leq \frac{\pi}{4}\sqrt{\frac{N}{M}}&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of total elements while &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the number of solution elements in the basis.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2019-03-27T19:26:56.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5791" PostTypeId="1" AcceptedAnswerId="5792" CreationDate="2019-03-27T22:02:17.487" Score="5" ViewCount="1033" Body="&lt;p&gt;I have lately been studying quantum algorithms. I have gone through the Deutsch algorithm and Grover's algorithm. There's always a function in the oracle which somehow 'recognizes' the solution without 'knowing' it. I somehow understood what is meant by recognizing and knowing the solution but the fact that the function processes all the superposition of states in parallel and gives an output is confusing! What does the function actually do? Does it match integers or can it detect other things like an intersection of two lines? I am sick of taking it as a black box. Without knowing how the function works I am incapable of knowing it's potential. Please help me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom line: how does &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; find the searched item amongst the superpositioned states and evaluate to 1? How are the superpositioned states evaluated by the function? &lt;/p&gt;&#xA;" OwnerUserId="6124" LastEditorUserId="55" LastEditDate="2019-08-16T18:57:35.733" LastActivityDate="2020-03-25T04:32:47.480" Title="How does an oracle function in Grover's algorithm actually work?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5792" PostTypeId="2" ParentId="5791" CreationDate="2019-03-28T02:26:48.540" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Let &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; be your favorite &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SAT}$&lt;/span&gt; problem.  For example, one that I like &lt;a href=&quot;https://www.youtube.com/watch?v=ASoz_NuIvP0&quot; rel=&quot;nofollow noreferrer&quot;&gt;is&lt;/a&gt;:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there integers &lt;span class=&quot;math-container&quot;&gt;$x_1, x_2, x_3$&lt;/span&gt;, each &lt;span class=&quot;math-container&quot;&gt;$-2^{50}\le x_1,x_2,x_3 \le 2^{50}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$x_1^3+x_2^3+x_3^3=42?$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Write &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; as a sequence of irreversible &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gates, etc., and convert them to a sequence of reversible &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gates, etc. to determine a unitary &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;.  In the example problem, this unitary will take the &lt;span class=&quot;math-container&quot;&gt;$103$&lt;/span&gt; bits of &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; to a single output &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.  Here &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if and only if the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SAT}$&lt;/span&gt; problem is solved.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Take a first register initially at &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;, and apply a Hadamard to put it in the uniform superposition of all states.  In the example problem, the first register is &lt;span class=&quot;math-container&quot;&gt;$153$&lt;/span&gt; qubits (&lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; plus &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; sign bit each.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to the second register conditioned on the first register.  Thus, in the sample problem, the system is in the state &lt;span class=&quot;math-container&quot;&gt;$\vert x_1,x_2,x_3\rangle \vert f(x_1,x_2,x_3)\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x_1,x_2,x_3$&lt;/span&gt; are between &lt;span class=&quot;math-container&quot;&gt;$-2^{50}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2^{50}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$x_1^3+x_2^3+x_3^3=42$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a phase shift to the first register conditioned on the value of the second register&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply the Grover diffusion operator to the first register&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Repeat steps 5 and 6 &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt N)$&lt;/span&gt; times.  (With the sample problem, apply this &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt {2^{153}})$&lt;/span&gt; times.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If there's only one solution, the first register should be in the state that satisfies &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt;.  With the sample problem, it should be in the state &lt;span class=&quot;math-container&quot;&gt;$\vert x_1,x_2,x_3\rangle$&lt;/span&gt; solving &lt;span class=&quot;math-container&quot;&gt;$x_1^3+x_2^3+x_3^3=42$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The heart of Grover is steps 5, 6, and 7.  Steps 1-4 can be fiddled with.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is applied to the second register &lt;em&gt;based on the values&lt;/em&gt; of the first register.  The first register is left &lt;em&gt;unchanged&lt;/em&gt; upon the application of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to the second register.  If the first register is in a uniform superposition over all states initially, then after application of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;, acting on &lt;em&gt;both&lt;/em&gt; the first register &lt;em&gt;and&lt;/em&gt; the second register, the first register will &lt;em&gt;still be&lt;/em&gt; in a uniform superposition.  &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; relies on the contents of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to determine the contents of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; but it leaves the contents of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, from the questions in your comments, I can tell that you understand that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be written &lt;em&gt;classically&lt;/em&gt; as a set of irreversible &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND},\mathsf{NOR},\mathsf{AND}$&lt;/span&gt;, etc. gates.  &lt;em&gt;Classically&lt;/em&gt; if we were to apply &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, then we may lose the value of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.  But remember quantum-mechanically the states must be reversible.  Thus from your questions I think you also recognize that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gates etc. need to be converted to &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gates etc.  It's no surprise that these gates tend to &lt;em&gt;leave some inputs unchanged&lt;/em&gt; - the qubits that are left unchanged would correspond to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and the qubits that are changed would correspond to &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After application of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;, for each possible value of the first register, a different value is stored in the second register, but the first register is unchanged.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shor's algorithm is a little different - initially a uniform superposition is applied to a first register, then a value of some function is calculated in the second register.  In Shor, we can throw away the second register; in Grover, we need to save the second register for the repeated conditional rotations (this part I think you understand).&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-03-28T12:09:16.557" LastActivityDate="2019-03-28T12:09:16.557" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5793" PostTypeId="1" CreationDate="2019-03-28T07:30:53.200" Score="2" ViewCount="243" Body="&lt;p&gt;We can use OpenFermion to get the molecular Hamiltonian in the form of:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H = \sum_{pq} h_{pq} a_p^\dagger a_q + \frac12 \sum_{pqrs} h_{pqrs} a_p^\dagger a_q^\dagger a_r a_s$$&lt;/span&gt;&#xA;and we can also use the Jordan-Wigner transformation to get the spin Hamiltonian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in the molecular Hamiltonian such as the &lt;span class=&quot;math-container&quot;&gt;$\require{mhchem}\ce{H2}$&lt;/span&gt; molecule we  don't add any occupied or active indices limitation, there is a four-qubit Hamiltonian. What does every qubit represent? &lt;/p&gt;&#xA;" OwnerUserId="6128" LastEditorUserId="6099" LastEditDate="2019-03-30T06:25:31.430" LastActivityDate="2019-03-30T08:54:26.063" Title="What are the rules that map the second-quantized fermionic Hamiltonian into spin-form in OpenFermion?" Tags="&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5794" PostTypeId="1" AcceptedAnswerId="5797" CreationDate="2019-03-28T08:49:48.863" Score="2" ViewCount="777" Body="&lt;p&gt;I have a quantum map described by the following Kraus operators&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A_0 = c_0 \begin{pmatrix}&#xA;            1   &amp;amp;  0\\&#xA;            0   &amp;amp;   1 \end{pmatrix},&#xA;\qquad A_1 = c_1 \begin{pmatrix}&#xA;            1   &amp;amp;  0\\&#xA;            0   &amp;amp;   -1 \end{pmatrix},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;such that &lt;span class=&quot;math-container&quot;&gt;$c_0^2 + c_1^2 = 1$&lt;/span&gt;. I want to know what is a &lt;em&gt;complementary map&lt;/em&gt; and how to construct the same for the above-mentioned channel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt; Checked for some literature. Here is the definition of &lt;a href=&quot;https://arxiv.org/abs/1202.6480&quot; rel=&quot;nofollow noreferrer&quot;&gt;the complementary map&lt;/a&gt; equations 37 and 38.&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="5806" LastEditDate="2019-04-10T13:05:48.190" LastActivityDate="2019-04-10T13:05:48.190" Title="What is a complementary map?" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5795" PostTypeId="1" AcceptedAnswerId="5800" CreationDate="2019-03-28T11:03:16.503" Score="1" ViewCount="327" Body="&lt;p&gt;I need to work out a research project on quantum computing as a part of my curriculum. I was wondering how to implement something theoretically with the basic knowledge I have. I have learned about superposition, Deutsch Jozsa algorithm, and Grover's algorithm. Can I design something simple using these algorithms? Perhaps a way to solve a game, or solve a graph problem or anything? I can't go deep in research now as I have not much time left but would be rather happy to work on the existing knowledge I have. Please enlighten me!&lt;/p&gt;&#xA;" OwnerUserId="6124" LastEditorUserId="26" LastEditDate="2019-03-28T16:53:22.633" LastActivityDate="2019-03-28T21:57:24.570" Title="What can be a mini research project based on Grover's algorithm or the Deutsch Jozsa algorithm?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;grovers-algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;research&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5797" PostTypeId="2" ParentId="5794" CreationDate="2019-03-28T18:06:03.977" Score="11" Body="&lt;p&gt;Let's start by finding a complementary channel for any channel given by a Kraus representation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(X) = \sum_{k=1}^n A_k X A_k^{\dagger}.&#xA;$$&lt;/span&gt;&#xA;To make the necessary equations clear, let us assume that the channel has the form &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathrm{L}(\mathcal{X})\rightarrow \mathrm{L}(\mathcal{Y})$&lt;/span&gt; for finite-dimensional Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;. Let us also define &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z} = \mathbb{C}^n$&lt;/span&gt;; the complementary channel we will define will take the form &lt;span class=&quot;math-container&quot;&gt;$\Psi:\mathrm{L}(\mathcal{X})\rightarrow \mathrm{L}(\mathcal{Z})$&lt;/span&gt;. (For the channel in the question itself, we will have &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt; all equal to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;, but it helps nevertheless to assign different names to these spaces.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define an operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_{k=1}^n A_k \otimes | k\rangle,&#xA;$$&lt;/span&gt;&#xA;which is a linear operator mapping &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}\otimes\mathcal{Z}$&lt;/span&gt;. This gives us a Stinespring representation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(X) = \operatorname{Tr}_{\mathcal{Z}} \bigl( A X A^{\dagger}\bigr).&#xA;$$&lt;/span&gt;&#xA;The channel&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Psi(X) = \operatorname{Tr}_{\mathcal{Y}} \bigl( A X A^{\dagger}\bigr)&#xA;$$&lt;/span&gt;&#xA;is therefore complementary to &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;. We can simplify this expression by observing that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A X A^{\dagger} = \sum_{j=1}^n \sum_{k=1}^n A_j X A_k^{\dagger} \otimes | j \rangle \langle k |,&#xA;$$&lt;/span&gt;&#xA;so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Psi(X) = \sum_{j=1}^n \sum_{k=1}^n \operatorname{Tr}\bigl(A_j X A_k^{\dagger}\bigr) | j \rangle \langle k |.&#xA;$$&lt;/span&gt;&#xA;There's not too much more we can do with this, except perhaps to use the cyclic property of the trace to obtain the expression&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Psi(X) = \sum_{j=1}^n \sum_{k=1}^n \operatorname{Tr}\bigl(A_k^{\dagger} A_j X\bigr) | j \rangle \langle k |.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's plug in the specific operators from the question to obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Psi(X) = c_0^2 \operatorname{Tr}(X) | 0 \rangle \langle 0 | + c_1^2 \operatorname{Tr}(X) | 1 \rangle \langle 1 | + c_0 c_1 \operatorname{Tr}(\sigma_z X) | 0 \rangle \langle 1 | + c_0 c_1 \operatorname{Tr}(\sigma_z X) | 1 \rangle \langle 0 |.&#xA;$$&lt;/span&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; denotes the Pauli-Z operator, which we get because &lt;span class=&quot;math-container&quot;&gt;$A_0^{\dagger} A_1 = A_1^{\dagger}A_0 = c_0 c_1 \sigma_z$&lt;/span&gt;. (I am assuming &lt;span class=&quot;math-container&quot;&gt;$c_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; are real numbers.) The expression may look a bit nicer in matrix form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Psi\begin{pmatrix} \alpha &amp;amp; \beta\\ \gamma &amp;amp; \delta\end{pmatrix} =&#xA;\begin{pmatrix} c_0^2(\alpha + \delta) &amp;amp; c_0 c_1 (\alpha - \delta)\\&#xA;c_0 c_1 (\alpha - \delta) &amp;amp; c_1^2 (\alpha + \delta) \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the question asks for Kraus operators of &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;, which we can get by computing the Choi operator of &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;. In general, this is the operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Psi) = \sum_{j=1}^n\sum_{k=1}^n \Psi(|j\rangle\langle k|) \otimes |j\rangle\langle k|,&#xA;$$&lt;/span&gt;&#xA;and in this particular case we obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Psi) = \begin{pmatrix}&#xA;c_0^2 &amp;amp; 0 &amp;amp; c_0 c_1 &amp;amp; 0\\&#xA;0 &amp;amp; c_0^2 &amp;amp; 0 &amp;amp; -c_0 c_1 \\&#xA;c_0 c_1 &amp;amp; 0 &amp;amp; c_1^2 &amp;amp; 0\\&#xA;0 &amp;amp; -c_0 c_1 &amp;amp; 0 &amp;amp; c_1^2&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;This operator has rank 2, which means just 2 Kraus operators suffice. We can get them through a spectral decomposition of &lt;span class=&quot;math-container&quot;&gt;$J(\Psi)$&lt;/span&gt;. Specifically, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Psi) = \begin{pmatrix} c_0\\ 0\\ c_1\\ 0 \end{pmatrix}&#xA;\begin{pmatrix} c_0 &amp;amp; 0 &amp;amp; c_1 &amp;amp; 0 \end{pmatrix}&#xA;+ \begin{pmatrix} 0\\ c_0\\ 0\\ -c_1 \end{pmatrix}&#xA;\begin{pmatrix} 0 &amp;amp; c_0 &amp;amp; 0 &amp;amp; -c_1 \end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;and by &quot;folding up&quot; these vectors we get Kraus operators:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Psi(X) = B_0 X B_0^{\dagger} + B_1 X B_1^{\dagger}&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B_0 = \begin{pmatrix} c_0 &amp;amp; 0\\ c_1 &amp;amp; 0 \end{pmatrix}&#xA;\quad\text{and}\quad&#xA;B_1 = \begin{pmatrix} 0 &amp;amp; c_0 \\ 0 &amp;amp; -c_1 \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2019-03-29T12:43:47.947" LastActivityDate="2019-03-29T12:43:47.947" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="5798" PostTypeId="2" ParentId="5789" CreationDate="2019-03-28T19:25:12.330" Score="3" Body="&lt;p&gt;As was also pointed out in another answer, repeated applications of the Grover operator rotate the state closer to the target &lt;span class=&quot;math-container&quot;&gt;$\lvert\beta\rangle$&lt;/span&gt; in the sense that the probability of finding the state in &lt;span class=&quot;math-container&quot;&gt;$\lvert\beta\rangle$&lt;/span&gt; increases up to a certain point (or equivalently, the fidelity between the state and &lt;span class=&quot;math-container&quot;&gt;$\lvert\beta\rangle$&lt;/span&gt; gets closer to one).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, you can see that this probability is, after &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; iterations,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p^{(k)}_\beta\equiv \lvert\langle \beta\rvert G^k\lvert\psi\rangle\rvert^2=\sin^2\left(\frac{(2k+1)\theta}{2}\right).$$&lt;/span&gt;&#xA;Now, you start with the probability &lt;span class=&quot;math-container&quot;&gt;$p^{(0)}_\beta=\sin^2(\theta/2)$&lt;/span&gt;. This tells you how close the initial state is to the target.&#xA;In most basic introductions to Grover's algorithm, you have &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta/2)=2^{-n/2}=1/\sqrt N$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; number of qubits or &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; total dimension of the state space, so that &lt;span class=&quot;math-container&quot;&gt;$p_\beta^{(0)}=2^{-n}=1/N$&lt;/span&gt;. This is not really important for the discussion though so let us consider the general case with arbitrary &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By definition, you know that &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta/2)\le1$&lt;/span&gt; (because the overlap of a state with another state can never exceed &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), so that &lt;span class=&quot;math-container&quot;&gt;$\theta\le\pi$&lt;/span&gt;.&#xA;The question thus becomes: &lt;em&gt;what is the smallest integer &lt;span class=&quot;math-container&quot;&gt;$k\ge0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(2k+1)\theta\sim\pi$&lt;/span&gt;?&lt;/em&gt;. More precisely, we are looking for the &lt;span class=&quot;math-container&quot;&gt;$k_0\in\mathbb N$&lt;/span&gt; that minimises the difference between &lt;span class=&quot;math-container&quot;&gt;$(2k+1)\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$k_0=\operatorname{argmin}_k\{(2k+1)\theta-\pi\}.$$&lt;/span&gt;&#xA;In other words, you are looking for the odd number &lt;span class=&quot;math-container&quot;&gt;$(2k+1)$&lt;/span&gt; that is closer to &lt;span class=&quot;math-container&quot;&gt;$\pi/\theta$&lt;/span&gt;, which is the same as saying that you are looking for the non-negative integer &lt;span class=&quot;math-container&quot;&gt;$k_0$&lt;/span&gt; that is closer to &lt;span class=&quot;math-container&quot;&gt;$\pi/2\theta-1/2$&lt;/span&gt;.&#xA;This number is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$k_0=\left\lfloor\frac{\pi}{2\theta}\right\rfloor,$$&lt;/span&gt;&#xA;that is, the integer part of &lt;span class=&quot;math-container&quot;&gt;$\pi/2\theta$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;${}^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, &lt;span class=&quot;math-container&quot;&gt;$p_\beta^{(k)}$&lt;/span&gt; will keep increasing with &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k\le k_0$&lt;/span&gt;, after which it reaches its maximum and will start decreasing again (note that you might have &lt;span class=&quot;math-container&quot;&gt;$k_0=0$&lt;/span&gt;, in which case Grover's algorithm is useless).&#xA;You might notice that the smaller the initial &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is, the more Grover's algorithm brings you closer to the target, but also the more steps will be needed to do that.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${}^\dagger$&lt;/span&gt; To see this, write &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2\theta}=\left\lfloor\frac{\pi}{2\theta}\right\rfloor+r$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$0\le r\le1$&lt;/span&gt; is the decimal part of &lt;span class=&quot;math-container&quot;&gt;$\pi/2\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$0\le r\le 1/2$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\pi}{2\theta}-\frac{1}{2}=\left\lfloor\frac{\pi}{2\theta}\right\rfloor-r'$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$0\le r'\le 1/2$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$\left\lfloor\frac{\pi}{2\theta}\right\rfloor$&lt;/span&gt; is the closer integer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If on the other hand &lt;span class=&quot;math-container&quot;&gt;$1/2\le r\le1$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\pi}{2\theta}-\frac{1}{2}=\left\lfloor\frac{\pi}{2\theta}\right\rfloor+r''$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$0\le r''\le1/2$&lt;/span&gt;. It follows that, again, the integer closest to &lt;span class=&quot;math-container&quot;&gt;$\pi/2\theta-1/2$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\left\lfloor\frac{\pi}{2\theta}\right\rfloor$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-03-28T19:45:08.163" LastActivityDate="2019-03-28T19:45:08.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5799" PostTypeId="1" CreationDate="2019-03-28T20:38:01.587" Score="18" ViewCount="907" Body="&lt;p&gt;(Classical) theoretical computer science (TCS) has a number of outstanding open problems that can easily be instantiated in a manner that is accessible to a wider general public.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For example, questions about &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; can easily be cast in an accessible manner by talking about Sudoku, or the traveling salesperson problem, etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Similarly questions about the polynomial hierarchy &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt; can be instantiated as questions about games, such as &amp;quot;is there a mate-in-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; strategy for white?&amp;quot;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Many open problems in QCS, at least initially, seem to require a good deal of &lt;em&gt;a-priori&lt;/em&gt; knowledge to even begin to understand the questions being asked.&lt;/p&gt;&#xA;&lt;p&gt;For example, even describing the initial rush to find &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; solutions to instances of the hidden-subgroup (HSP) problem seemed to expect the audience to not only have a good deal of knowledge of, or respect for, QM, but also a small amount of knowledge of (finite) group theory.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; Upon further review I think this is an unfair dunk on the early researchers looking in to HSP solutions.  Researches looked into the HSP precisely &lt;em&gt;because&lt;/em&gt; HSP generalized a lot of problems that people cared about. &lt;strong&gt;/EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think the subject has matured so much from the mid-90's that I think there are some important outstanding problems that can be described quickly, to a wider audience.  The descriptions might not demand much but a little patience and curiosity of the audience.&lt;/p&gt;&#xA;&lt;p&gt;I'm looking for a kind of &amp;quot;big-list&amp;quot; of such accessible open problems.  This may be helpful for perennial questions like &amp;quot;what's a good research topic for me?&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;For example, some open problems that come to mind include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What can be said about whether graph isomorphism &lt;span class=&quot;math-container&quot;&gt;$\mathsf{GI}$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt;?  Is it even a worthwhile question in light of Babai's breakthrough?  I think this can be described to a curious-enough audience&lt;/li&gt;&#xA;&lt;li&gt;Can a quantum computer distinguish various knots?  I think the problem statement can be described to maybe even patient elementary-school students&lt;/li&gt;&#xA;&lt;li&gt;One of my favorite problems is the &amp;quot;beltway problem&amp;quot; - determining the location of exits along a beltway (highway around a city) given only their inter-exit distances.  This is related to Golomb rulers. I like to think about whether this is in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The existence of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; certificates does not always seem to imply the existence of a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; solution, but asking if there's a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt; certificate for problems that aren't even known to be in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; seems interesting, such as the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{coNP}$&lt;/span&gt; versions of some &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; problems.  If framed correctly, these might fit the bill.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Can a list of 'high-concept' open problems in Quantum Computing research be created?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here, to keep the question narrow enough, by &amp;quot;high-concept&amp;quot; I mean:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In order to understand the phrasing of the question, a school child might be able to understand at least the question being asked.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I would argue that &amp;quot;Can a quantum computer solve my problem &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; faster than other regular computers?&amp;quot; is an accessible way to frame the question.   Here &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is the problem that is accessible (Sudoku/TSP/mate-in-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; problems classically).&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-02-19T23:30:30.613" LastActivityDate="2021-05-14T14:11:53.200" Title="Is there a list of accessible open problems in quantum computing from a theoretical computer science perspective?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;complexity-theory&gt;&lt;research&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5800" PostTypeId="2" ParentId="5795" CreationDate="2019-03-28T21:57:24.570" Score="5" Body="&lt;p&gt;(Based on the time limitation I assume we're talking about an undergraduate level project, and not something more advanced.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you look at the questions about Grover's algorithm, you'll notice that a lot of them ask about implementing oracles for interesting tasks - or at least tasks more satisfying than looking for the state &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; :-) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One project idea arising from this could be picking some interesting problem that can be solved with Grover's algorithm, implementing the oracle and actually solving it. To give just two examples, here are oracles for solving &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/tree/master/SolveSATWithGrover&quot; rel=&quot;noreferrer&quot;&gt;SAT problem&lt;/a&gt; and &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/pull/82/files&quot; rel=&quot;noreferrer&quot;&gt;graph coloring problem&lt;/a&gt;. &lt;em&gt;(Full disclosure: I wrote the first example myself, and the second one was done as a student project for our course in the University of Washington.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is usually possible to come up with a small version of an interesting problem to simulate the solution (the optimizations you have to do to squeeze things in the 30-ish qubits for simulation can be interesting on their own). After that you can estimate the resources it would take to solve a larger instance of the problem, compare different implementations (for example, if your problem requires arithmetic), etc.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-03-28T21:57:24.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5801" PostTypeId="1" AcceptedAnswerId="5802" CreationDate="2019-03-29T12:44:46.467" Score="3" ViewCount="165" Body="&lt;p&gt;Consider &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and the &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; states that I label &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|k \rangle = \sum_{i=0}^{n-1} 2^i q_i,&#xA;\end{equation}&lt;/span&gt;&#xA;i.e. &lt;span class=&quot;math-container&quot;&gt;$|q_{n-1}\cdots q_0 \rangle \rightarrow |k\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$q_j \in \{0,1\}$&lt;/span&gt;. That is I label the binary string of qubits by its decimal value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then want to find quantum circuits implementing three &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;H_0 &amp;amp;= -\frac{1}{2} \sum_{k=0}^{N-1} |2j\rangle \langle 2j+1| - |2j+1\rangle\langle 2j|, \\&#xA;H_1 &amp;amp;= -\frac{1}{2} \sum_{k=0}^{N-1} |2j+1\rangle \langle 2j+2| - |2j+2\rangle\langle 2j+1|,\\&#xA;H_2 &amp;amp;= -\frac{1}{2} \sum_{k=0}^{N-1} |2j\rangle \langle 2j+3| - |2j+3\rangle\langle 2j|,&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;where the values are all modulo &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Pictorially this is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Zh2Uh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zh2Uh.png&quot; alt=&quot;Schematic of the action of the matrices, H0, H1, H2 for n=3.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find efficient implementations using only CNOTs and single qubit gates. By efficient I mean that I want the lowest CNOT gate count possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first of these can be solved quite easily and is given by &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_0 = 1_{n-1} \otimes (iY_0),&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$1_{n-1}$&lt;/span&gt; is the identity on qubits 1 to &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y_0$&lt;/span&gt; is the Y-Pauli operator on qubit 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can also find &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; using the incrementer&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9n3S5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9n3S5.png&quot; alt=&quot;H1 using incrementer&quot;&gt;&lt;/a&gt;&#xA;However, this uses gates with many controls. I am wondering, due to the symmetry, is it possible to significantly reduce the number of CNOTs to implement this circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I currently have no idea how to tackle &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;. Any solution for these matrices, and or tips, references etc. would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="6076" LastEditorUserId="26" LastEditDate="2019-03-29T19:39:11.640" LastActivityDate="2019-03-29T19:39:11.640" Title="Implementing these $N×N$ matrices on $\log N$ qubits" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5802" PostTypeId="2" ParentId="5801" CreationDate="2019-03-29T14:04:33.073" Score="3" Body="&lt;p&gt;Basically your three operations are, for each even &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, do an interaction with &lt;span class=&quot;math-container&quot;&gt;$k+1+2j$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; the value of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; the value of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; the value of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. I'm going to define &lt;span class=&quot;math-container&quot;&gt;$G_{-1} = H_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$G_0 = H_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$G_1 = H_2$&lt;/span&gt; so that the indices match the value of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way to implement &lt;span class=&quot;math-container&quot;&gt;$G_k$&lt;/span&gt; is by applying a &lt;span class=&quot;math-container&quot;&gt;$-k$&lt;/span&gt; operation to all qubits except the least significant qubit, but using the least significant qubit as a control, then applying your mixing operation to the least significant qubit, then uncomputing the offset by applying a &lt;span class=&quot;math-container&quot;&gt;$+k$&lt;/span&gt; operation to all qubits except the least significant qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You incremented the whole register instead of performing a controlled increment of part of the register. This just happens to be equivalent, modulo that last NOT gate on the control, because of how the increment circuit is built.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; is implemented in the same way as &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; except you decrement instead of incrementing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To optimize the circuit, you can use &lt;a href=&quot;https://algassert.com/circuits/2015/06/12/Constructing-Large-Increment-Gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a more efficient linear-cost increment circuit&lt;/a&gt; such as the one explained in &lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Factoring with n+2 clean qubits and n-1 dirty qubits&quot;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can use the fact that &lt;span class=&quot;math-container&quot;&gt;$+k \equiv \text{QFT} \cdot \text{GRAD}^k \cdot \text{QFT}^\dagger$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\text{QFT}$&lt;/span&gt; is the quantum fourier Transform and &lt;span class=&quot;math-container&quot;&gt;$\text{GRAD}_n^k = \sum_{j=0}^{2^n-1} |j\rangle\langle j| e^{i j \pi / 2^n} = \otimes_{j=0}^{n-1} Z_j^{k/2^j}$&lt;/span&gt; is the phase gradient operation (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0008033&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Addition on a Quantum Computer&quot;&lt;/a&gt;). This allows you to rework &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; into the &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%5D%2C%5B%22Z%22%2C%22QFT4%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BD%22%2C%22Z%22%5D%2C%5B1%2C%22Z%5E-%E2%85%9B%22%2C%22Z%5E-%C2%BC%22%2C%22Z%5E-%C2%BD%22%2C%22Z%22%5D%2C%5B1%2C%22QFT%E2%80%A04%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;following sort of form&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%5D%2C%5B%22Z%22%2C%22QFT4%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BD%22%2C%22Z%22%5D%2C%5B1%2C%22Z%5E-%E2%85%9B%22%2C%22Z%5E-%C2%BC%22%2C%22Z%5E-%C2%BD%22%2C%22Z%22%5D%2C%5B1%2C%22QFT%E2%80%A04%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eicKm.png&quot; alt=&quot;Rewritten circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is equivalent to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3gNWz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3gNWz.png&quot; alt=&quot;Rewritten circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which still has two increments, but they are slightly smaller. I suspect there is a way to merge these two increments into one single addition.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-03-29T14:14:49.400" LastActivityDate="2019-03-29T14:14:49.400" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5803" PostTypeId="1" AcceptedAnswerId="5806" CreationDate="2019-03-29T16:06:52.477" Score="2" ViewCount="292" Body="&lt;p&gt;I want to look more closely at the consequences of the Grovers algorithm. As is well known, the algorithm provides a quadratic improvement compared to classical search algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I would be interested in the implications of Grover's algorithm on modern cryptography. So how is the influence of grover's algorithm on cryptography. Maybe someone here has some good tips and sources where you can read something, or where something is discussed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be very grateful if anyone knows scientific papers that investigate this influence. Also, I would be interested in the weaknesses of the algorithm, what are the practical implications? So if anyone knows of any scientific sources dealing with this problem I would be very happy if you can share this.&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2019-03-29T17:21:59.687" LastActivityDate="2019-03-30T08:01:38.780" Title="Consequences of Grover's algorithm" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;&lt;applications&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5804" PostTypeId="1" AcceptedAnswerId="5816" CreationDate="2019-03-29T17:19:23.093" Score="5" ViewCount="579" Body="&lt;p&gt;I know that the Choi operator is a useful tool to construct the Kraus representation of a given map, and that the &lt;em&gt;vectorization map&lt;/em&gt; plays an important role in such construction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How exactly does the vectorization map work in this context, and how does it relate the Choi and Kraus representations of a given map?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="55" LastEditDate="2021-02-14T18:58:28.033" LastActivityDate="2021-02-14T18:58:28.033" Title="How does the vectorization map relate to the Choi and Kraus representations of a channel?" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5805" PostTypeId="2" ParentId="5793" CreationDate="2019-03-29T22:18:41.687" Score="1" Body="&lt;p&gt;You are correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a 1-1 mapping between the standard &quot;molecular Born-Oppenheimer Hamiltonian&quot; that you wrote down in 2nd quantized form, and the equivalent Jordan-Wigner spin Hamiltonian. That mapping is actually quite simple:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Large{a_j \iff \mathbf{1}^{\otimes {j-1}}\otimes \sigma^{+}\otimes \sigma ^ {z\otimes {N-j-1}}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Large{a_j^{\dagger} \iff \mathbf{1}^{\otimes {j-1}}\otimes \sigma^{-}\otimes \sigma ^{z\otimes {N-j-1}}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By turning each &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a^\dagger$&lt;/span&gt; into an equivalent string of Pauli matrices, we don't add any occupied or active indices (which is exactly what you said).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of terms in the Hamiltonian you wrote down, will be exactly the number of terms in the Jordan-Wigner form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why &lt;span class=&quot;math-container&quot;&gt;$\require{mhchem}\ce{H2}$&lt;/span&gt; has a 4-qubit Jordan-Wigner Hamiltonian in most quantum computing papers, is because they typically use the STO-3G basis set, which has exactly 4 spin orbitals.  &lt;/p&gt;&#xA;" OwnerUserId="6099" LastEditorUserId="26" LastEditDate="2019-03-30T08:54:26.063" LastActivityDate="2019-03-30T08:54:26.063" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5806" PostTypeId="2" ParentId="5803" CreationDate="2019-03-29T22:23:23.087" Score="1" Body="&lt;p&gt;In &lt;a href=&quot;https://www.nature.com/articles/nature23461&quot; rel=&quot;nofollow noreferrer&quot;&gt;this survey article&lt;/a&gt; they discuss Grover's algorithm. In my opinion, the most important part:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Grover’s speed-up from &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; is not as devastating as Shor’s&#xA;  speed-up. Furthermore, each of Grover’s &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; quantum evaluations must&#xA;  wait for the previous evaluation to finish. To quantify this issue,&#xA;  define T as the number of serial evaluations that can be carried out&#xA;  in the time available: for example, if the quantum computer can&#xA;  evaluate f in a nanosecond, and if the attacker is prepared to run a&#xA;  computation lasting for a year, then T≈&lt;span class=&quot;math-container&quot;&gt;$2^{55}$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; exceeds T, then&#xA;  Grover’s algorithm cannot use fewer than N/T evaluations spread across&#xA;  &lt;span class=&quot;math-container&quot;&gt;$N/T^2$&lt;/span&gt;  parallel quantum processors. This is a factor T better than&#xA;  pre-quantum techniques, but it is possible that this improvement will&#xA;  be wiped out by the overhead of qubit operations being more expensive&#xA;  than bit operations, making Grover’s algorithm useless—even if&#xA;  scalable quantum computers are built and run Shor’s algorithm&#xA;  successfully. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is the main and oft-discussed issue, that Grover's algorithm parallelizes very badly (provably so: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9711070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zalka 1997&lt;/a&gt;). Bear in mind that our usual classical heuristics of security - &lt;span class=&quot;math-container&quot;&gt;$2^{80}$&lt;/span&gt; operations, say - are based on extremely parallel architectures. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://eprint.iacr.org/2017/811.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's another paper&lt;/a&gt; discussing the same issue and suggesting a fixed time limit for post-quantum security definitions. NIST included maximum depths in their definitions of quantum security for the post-quantum cryptography standardization process (&lt;a href=&quot;https://csrc.nist.gov/Projects/Post-Quantum-Cryptography/Post-Quantum-Cryptography-Standardization/Call-for-Proposals&quot; rel=&quot;nofollow noreferrer&quot;&gt;See Section 4A&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other issues: &lt;a href=&quot;https://arxiv.org/abs/1512.04965&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grassl et al.&lt;/a&gt; give circuits for AES, showing that reversibility also adds some noticeable overhead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Grover's algorithm has a very high depth compared to Shor's algorithm, meaning the qubits and circuit need to have very, very low errors. This will, in turn, create large (though poly-logarithmic) overheads for error correction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;As far as I know, no one is trying to build any &quot;quantum-safe&quot; symmetric cryptography, because modern symmetric cryptography is already quantum-safe (Grover's algorithm is still exponential)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because of the practical issues I mentioned, the key sizes may not even not to increase&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sill, it's not too hard to eliminate even what little risk there is; from the same survey article:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;On the other hand, if qubit operations are small enough&#xA;  and fast enough, then Grover’s algorithm will threaten many&#xA;  cryptographic systems that aim for &lt;span class=&quot;math-container&quot;&gt;$2^{128}$&lt;/span&gt; security, such as 128-bit AES&#xA;  keys. We recommend simply switching to 256-bit AES keys: the extra&#xA;  costs are rarely noticeable. ‘Information-theoretic’ MACs such as GMAC&#xA;  and Poly1305 already protect against quantum computers without any&#xA;  modifications: their security analysis already assumes an attacker&#xA;  with unlimited computing power.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4517" LastEditorUserId="26" LastEditDate="2019-03-30T08:01:38.780" LastActivityDate="2019-03-30T08:01:38.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5811" PostTypeId="1" CreationDate="2019-03-30T21:55:02.887" Score="6" ViewCount="1028" Body="&lt;p&gt;I've consulted Nielsen and Chuang to understand the Stinespring Dilation, but wasn't able to find anything useful. How does this operation relate to partial trace, Kraus operators, and purification? &lt;/p&gt;&#xA;" OwnerUserId="6147" LastActivityDate="2019-04-01T11:24:03.990" Title="What is Stinespring Dilation?" Tags="&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5813" PostTypeId="1" CreationDate="2019-03-31T08:05:22.403" Score="1" ViewCount="53" Body="&lt;p&gt;When I read about computing using gate based methods, I mainly read about the difficulties with error rates, circuit depth (and connectivity) and not enough qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With computing using quantum annealing, discussion mainly seems to focus on number of qubits and connectivity. It seems error correction is less of an issue here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question: Is there an inherent difference in need for error correction between quantum annealing systems (D-Wave etc) and quantum gate based systems? &lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="26" LastEditDate="2019-03-31T10:57:36.953" LastActivityDate="2019-03-31T17:03:47.260" Title="Is there an inherent difference in need for error correction between quantum annealing and gate based methods?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;annealing&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5815" PostTypeId="1" AcceptedAnswerId="5830" CreationDate="2019-03-31T11:14:57.570" Score="5" ViewCount="272" Body="&lt;p&gt;We can strongly simulate a quantum circuit if we can estimate the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0^n\rangle$&lt;/span&gt;, say,  at the end to within some fixed relative error. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, by measurement, a quantum computer can certainly weakly simulate itself, i.e. &lt;em&gt;sample&lt;/em&gt; from its own output distribution. Naively, I had also thought quantum computers to be able to strongly simulate itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I watched this talk recently by David Gosset: &lt;a href=&quot;https://www.perimeterinstitute.ca/videos/classical-simulation-quantum-circuits-stabilizer-rank&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical simulation of quantum circuits via stabilizer rank&lt;/a&gt; where he claims this is not true (see 1 minute onwards). In particular, he seems to be saying strong simulation is &lt;span class=&quot;math-container&quot;&gt;$P^{\#}$&lt;/span&gt;-hard which &lt;em&gt;implies&lt;/em&gt; quantum computers can't do it. Could someone please provide me with some reference to what he is saying?&lt;/p&gt;&#xA;" OwnerUserId="2375" LastEditorUserId="26" LastEditDate="2019-04-01T12:56:48.677" LastActivityDate="2019-04-01T23:49:18.977" Title="Why can't a quantum computer strongly simulate itself?" Tags="&lt;resource-request&gt;&lt;measurement&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5816" PostTypeId="2" ParentId="5804" CreationDate="2019-03-31T14:34:48.623" Score="13" Body="&lt;p&gt;One way to understand the relationship between the Choi representation of a channel and its possible Kraus representations is to use the &lt;em&gt;vectorization&lt;/em&gt; map.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that we have two finite-dimensional Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;, and that we have fixed a standard basis &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle,\ldots,|n\rangle\}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; and a standard basis &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle,\ldots,|m\rangle\}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;. The vectorization map is the linear map of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{vec}:\text{L}(\mathcal{X},\mathcal{Y})\rightarrow\mathcal{Y}\otimes\mathcal{X},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\text{L}(\mathcal{X},\mathcal{Y})$&lt;/span&gt; is the space of all linear maps from &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;, that is defined by the following action on standard basis elements:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{vec}\bigl( | j\rangle \langle k |\bigr) = |j\rangle |k\rangle.&#xA;$$&lt;/span&gt;&#xA;For other elements of &lt;span class=&quot;math-container&quot;&gt;$\text{L}(\mathcal{X},\mathcal{Y})$&lt;/span&gt; the action of the mapping is determined by linearity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we view elements of &lt;span class=&quot;math-container&quot;&gt;$\text{L}(\mathcal{X},\mathcal{Y})$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$m\times n$&lt;/span&gt; matrices that act by left-multiplication on column vectors of dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, the action of the vectorization mapping is to take the rows of the matrix, turn them into column vectors, and then stack them on top of one another like this (in the case &lt;span class=&quot;math-container&quot;&gt;$n=m=2$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{vec}\begin{pmatrix}&#xA;\alpha &amp;amp; \beta\\&#xA;\gamma &amp;amp; \delta&#xA;\end{pmatrix}&#xA;= \begin{pmatrix}&#xA;\alpha\\&#xA;\beta\\&#xA;\gamma\\&#xA;\delta&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the relationship between all of the possible Kraus representations and the Choi representation of a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; having the form &lt;span class=&quot;math-container&quot;&gt;$\Phi:\text{L}(\mathcal{X}) \rightarrow \text{L}(\mathcal{Y})$&lt;/span&gt; can be easily stated: for any choice of a positive integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and operators &lt;span class=&quot;math-container&quot;&gt;$A_1,\ldots,A_N\in\text{L}(\mathcal{X},\mathcal{Y})$&lt;/span&gt;, it is the case that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(X) = \sum_{k=1}^N A_k X A_k^{\dagger}&#xA;$$&lt;/span&gt;&#xA;is a Kraus representation of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; if and only if the Choi representation of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; satisfies the equality&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Phi) = \sum_{k=1}^N \text{vec}(A_k) \text{vec}(A_k)^{\dagger}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This relationship allows you to convert between the two relationships pretty easily. To get the Choi representation from a Kraus representation, it is just a matter of computing. To go from a Choi representation to a Kraus representation, you can use the spectral theorem to write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Phi) = \sum_{k=1}^r v_k v_k^{\dagger}&#xA;$$&lt;/span&gt;&#xA;for vectors &lt;span class=&quot;math-container&quot;&gt;$v_1,\ldots,v_r\in\mathcal{Y}\otimes\mathcal{X}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$r=\text{rank}(J(\Phi))$&lt;/span&gt;, then take your Kraus operators to be the operators &lt;span class=&quot;math-container&quot;&gt;$A_1,\ldots,A_r\in\text{L}(\mathcal{X},\mathcal{Y})$&lt;/span&gt; that satisfy &lt;span class=&quot;math-container&quot;&gt;$\text{vec}(A_k) = v_k$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$k\in\{1,\ldots,r\}$&lt;/span&gt;. This is why &lt;span class=&quot;math-container&quot;&gt;$\text{rank}(J(\Phi))$&lt;/span&gt; is always the minimum possible number of Kraus operators you need to specify a given channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One warning about this relationship: I am assuming that the Choi representation of a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; of the form described above is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Phi) = &#xA;\sum_{1\leq j,k \leq n} \Phi\bigl(|j\rangle \langle k|\bigr) \otimes |j\rangle \langle k|.&#xA;$$&lt;/span&gt;&#xA;Some people choose to define the Choi representation with the tensor factors in the reverse order, like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J'(\Phi) = &#xA;\sum_{1\leq j,k \leq n} |j\rangle \langle k| \otimes&#xA;\Phi\bigl(|j\rangle \langle k|\bigr).&#xA;$$&lt;/span&gt;&#xA;If you do that, you can still get a similar relationship, but you will have to define your vectorization mapping in a different way, as &lt;span class=&quot;math-container&quot;&gt;$\text{vec}'(|j\rangle\langle k|) = |k\rangle|j\rangle$&lt;/span&gt;. (You will find the vectorization map defined in these two different ways by different authors, so you just need to be aware of which definition is being used whenever you see this mapping.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning references, you can find this relationship in Choi's 1975 paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Man-Duen Choi. Completely positive linear maps on complex matrices. &lt;em&gt;Linear Algebra and Its Applications&lt;/em&gt; 10: 285-290, 1975.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Choi's proof of this relationship is terse, but certainly comprehensible. You can also find more detail in Section 4.4 of Mark Wilde's book:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Mark Wilde. &lt;em&gt;Quantum Information Theory&lt;/em&gt;, second edition. Cambridge University Press, 2017.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Assuming you'll forgive me for a self-citation, I also cover this in Section 2.2.2 of my book, using a similar notation to the description above:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;John Watrous. The Theory of Quantum Information. Cambridge University Press, 2018. (Available at &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/TQI/&quot; rel=&quot;noreferrer&quot;&gt;https://cs.uwaterloo.ca/~watrous/TQI/&lt;/a&gt; .)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2019-04-02T13:16:04.857" LastActivityDate="2019-04-02T13:16:04.857" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5817" PostTypeId="2" ParentId="5813" CreationDate="2019-03-31T16:49:12.077" Score="1" Body="&lt;p&gt;The errors from quantum annealing apart from having crappy qubits will come from the imperfect instantiation of the qubit coupling. The first problem i.e having bad qubits can ultimately be mitigated by a kind of error correction look at &lt;a href=&quot;https://www.nature.com/articles/ncomms4243&quot; rel=&quot;nofollow noreferrer&quot;&gt;&#xA;Error-corrected quantum annealing with hundreds of qubits (Pudenz &lt;em&gt;et al.&lt;/em&gt;, 2014)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as it turns out the second problem related to imperfect instantiation of qubit coupling does not need to be perfect, in fact, some disorder can actually help cf. &lt;a href=&quot;https://arxiv.org/abs/1903.07056&quot; rel=&quot;nofollow noreferrer&quot;&gt;Disorder-assisted graph coloring on quantum annealers (Więckowski &lt;em&gt;et al.&lt;/em&gt;, 2019)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ultimate reason for the gap in the models in relation to error correction stems from the fact that the gate model is a well defined computational model that is universal while on the other hand quantum annealing is more of a heuristic. Having a model of error correction really makes sense in a precise model of computation. Quantum Annealing is a method that is really a &quot;physics&quot; idea for arriving at some state (in this case the ground state). Implementing it requires studying the device that implements it and correcting for the &quot;errors&quot; will require knowing your device well. One can't rely on some general notion of errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a sense, all of quantum computing requires knowing your device well, but what helps you in the gate model is that you have a theoretical model of computation while in quantum annealing you are really dealing with some heuristic.&lt;/p&gt;&#xA;" OwnerUserId="4565" LastEditorUserId="26" LastEditDate="2019-03-31T17:03:47.260" LastActivityDate="2019-03-31T17:03:47.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5818" PostTypeId="2" ParentId="5811" CreationDate="2019-03-31T17:07:03.167" Score="6" Body="&lt;p&gt;Not exactly sure what you find confusing, but the ultimate need for Stinespring dilation theorem is that in quantum mechanics the dynamics is in general defined by a completely positive trace preserving map (CPTP) &lt;span class=&quot;math-container&quot;&gt;$\rho \mapsto \Lambda(\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we have a belief (rightly or wrongly) that all there is is a unitary evolution governed by Schrodinger's equation. Stinespring dilation theorem is a way of stating this desire from a mathematical point of view. It guarantees that as long as I see the evolution of my density matrix as governed by a positive map (in physics we require trace preserving), this CPTP map can ultimately be lifted to a unitary operation on a higher dimensional Hilbert, where we can simply think of unitary evolution (purification).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that this is the case, how do we go back to the lower dimensional space? The prescription is that we trace over the system we appended to get unitary dynamics and then the dynamics in the lower Hilbert space is governed by a set of Kraus operators.&#xA;This procedure is guaranteed by Stinespring dilation theorem.&lt;/p&gt;&#xA;" OwnerUserId="4565" LastEditorUserId="55" LastEditDate="2019-04-01T11:24:03.990" LastActivityDate="2019-04-01T11:24:03.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5819" PostTypeId="2" ParentId="5681" CreationDate="2019-03-31T17:27:32.027" Score="1" Body="&lt;p&gt;It's not clear what your error correction procedure is but I will state the argument more generally as to why we need the Steane code.&#xA;We want to store the information in a &lt;em&gt;quantum&lt;/em&gt; state. This means that a possible subset of errors will be those that introduce wrong &lt;em&gt;relative&lt;/em&gt; phase factors. This means that no pure classical procedure i.e one that doesn't care or forgets that fact that the information was stored in a quantum state can ultimately work in order to detect &lt;em&gt;quantum&lt;/em&gt; errors and recover the &lt;em&gt;quantum&lt;/em&gt; state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your classical procedure can detect a relative minus sign in an encoded quantum state, think again you have apparently found a classical error correction procedure that can detect quantum errors.&lt;/p&gt;&#xA;" OwnerUserId="4565" LastEditorUserId="26" LastEditDate="2019-03-31T17:55:14.167" LastActivityDate="2019-03-31T17:55:14.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5821" PostTypeId="2" ParentId="4636" CreationDate="2019-04-01T01:11:35.847" Score="4" Body="&lt;p&gt;For amplitude damping, &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is something like &lt;span class=&quot;math-container&quot;&gt;$e^{-\Delta t/T_1}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt; is how long the Kraus operator is supposed to act. But be very careful, Kraus evolution assumes your system has no initial correlations, that every qubit interacts with identical baths and that every qubit is identical. All the assumptions are most likely violated and so there will be no simple relation between the actual evolution given by Kraus operators and the evolution on the devices. We may use Kraus evolution as an approximation. It's probably more appropriate to do a master equation simulation but that will not, in general, correspond to the Kraus operators one sees in Nielsen and Chuang.&lt;/p&gt;&#xA;" OwnerUserId="4565" LastEditorUserId="26" LastEditDate="2019-04-01T04:09:07.723" LastActivityDate="2019-04-01T04:09:07.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5822" PostTypeId="1" CreationDate="2019-04-01T03:24:58.080" Score="2" ViewCount="85" Body="&lt;p&gt;How do I find out how many physical-qubits I'm using when I run my program in an IBM Q backend quantum computing system?&lt;/p&gt;&#xA;" OwnerUserId="3043" LastEditorUserId="26" LastEditDate="2019-04-01T04:10:53.363" LastActivityDate="2019-04-01T13:17:13.260" Title="How many physical qubits are used when I run a program on a IBM Q computer?" Tags="&lt;physical-qubit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5823" PostTypeId="1" CreationDate="2019-04-01T04:13:40.190" Score="7" ViewCount="3147" Body="&lt;p&gt;Will it be possible to use quantum computing to one day &lt;a href=&quot;https://en.wikipedia.org/wiki/Solving_chess&quot; rel=&quot;noreferrer&quot;&gt;solve the game of chess&lt;/a&gt;? If so, any estimate as to how many qubits it would require?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The game of checkers has already been solved through back in 2007 after &lt;a href=&quot;https://www.newscientist.com/article/dn12296-checkers-solved-after-years-of-number-crunching/&quot; rel=&quot;noreferrer&quot;&gt;years of number crunching&lt;/a&gt;. But they don't expect that chess will be able to be solved the same way because the problem is an order of magnitude more difficult. There are &lt;a href=&quot;http://www.nwchess.com/articles/misc/Chess_Board_Positions_article.pdf&quot; rel=&quot;noreferrer&quot;&gt;an estimated &lt;span class=&quot;math-container&quot;&gt;$10^{40}$&lt;/span&gt; legal chess positions and about &lt;span class=&quot;math-container&quot;&gt;$10^{120}$&lt;/span&gt; possible games&lt;/a&gt;.   &lt;/p&gt;&#xA;" OwnerUserId="6156" LastEditorUserId="26" LastEditDate="2019-04-01T09:09:30.007" LastActivityDate="2019-04-08T18:03:05.163" Title="Will quantum computers be able to solve the game of chess?" Tags="&lt;algorithm&gt;&lt;quantum-information&gt;&lt;complexity-theory&gt;&lt;applications&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5824" PostTypeId="1" CreationDate="2019-04-01T09:19:58.050" Score="4" ViewCount="419" Body="&lt;p&gt;I would like to start my question with a quote:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If an encrypted document and its source can be obtained, it is possible to attempt to find the 56-bit key. An exhaustive search by conventional means would make it necessary to search 2 to the power 55 keys before hitting the correct one. This would take more than a year even if one billion keys were tried every second, by comparison, Grover's algorithm could find the key after only 185 searches. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This quote is from &lt;a href=&quot;http://www.doc.ic.ac.uk/~nd/surprise_97/journal/vol4/spb3/#4.2%20Grover&amp;#39;s%20algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Brief History of Quantum Computing By Simon Bone and Matias Castro&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a reader, I wonder how the authors got the magic number of 185. Unfortunately, that is not justified.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought about it myself. To calculate the number of iterations, the Grover algorithm uses this formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$k=\frac{\pi}{4\cdot \sin^{-1}\left(\frac{1}{\sqrt{2^n}}\right)}-0.5$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I just do that for the number &lt;span class=&quot;math-container&quot;&gt;$2^{56}$&lt;/span&gt; (DES keysize), then it follows that you need k iterations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$k=\frac{\pi}{4\cdot \sin^{-1}\left(\frac{1}{\sqrt{2^{56}}}\right)}-0.5=210828713$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's still not the number the authors suggest. Therefore I ask here, if anyone can imagine, how the authors came to the number. Is my consideration correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming it were &lt;span class=&quot;math-container&quot;&gt;$2^{16}$&lt;/span&gt;, then you would need about 200 iterations, which are still not 185. I am not aware of a cryptographic system with a key length of &lt;span class=&quot;math-container&quot;&gt;$2^{16} $&lt;/span&gt; ...&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="55" LastEditDate="2019-12-05T09:37:55.387" LastActivityDate="2019-12-05T09:37:55.387" Title="Grover's algorithm: number of searches required to find a key" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5825" PostTypeId="2" ParentId="5815" CreationDate="2019-04-01T11:46:11.983" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Could someone please provide me with some reference to what he is&#xA;  saying?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here is a reference to a discussion of this and related questions: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quant. Inf. Comp. 10, 3-4 pp. pp0258-0271 (2010), or &lt;a href=&quot;https://arxiv.org/abs/0811.0898&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0811.0898&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="26" LastEditDate="2019-04-01T13:03:20.660" LastActivityDate="2019-04-01T13:03:20.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5826" PostTypeId="2" ParentId="5822" CreationDate="2019-04-01T12:15:31.253" Score="1" Body="&lt;p&gt;When you wrote your Qiskit program you had to specify how large your quantum register was or you put qubits in your quantum register as you wrote the program in your code. That's how many qubits you are using.  You can also use the &lt;em&gt;len&lt;/em&gt; function on the Quantum Register to check it's size. Another way is to print the quantum circuit or call the &lt;code&gt;draw()&lt;/code&gt; function and you will get a picture of the quantum circuit, this will show you how many qubits you are using.&lt;/p&gt;&#xA;" OwnerUserId="4565" LastEditorUserId="26" LastEditDate="2019-04-01T13:17:13.260" LastActivityDate="2019-04-01T13:17:13.260" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5827" PostTypeId="1" CreationDate="2019-04-01T14:19:29.937" Score="3" ViewCount="89" Body="&lt;p&gt;I am reading paper &lt;a href=&quot;https://www.researchgate.net/publication/221661424_Channel_Identification_and_its_Impact_on_Quantum_LDPC_Code_Performance&quot; rel=&quot;nofollow noreferrer&quot;&gt;Channel Identification and its Impact on Quantum LDPC Code Performance&lt;/a&gt; where the authors discuss the scenario where the decoder of a Quantum LDPC code uses an estimation of the depolarization probability of the channel in order to correct the errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When doing so, they establish the quantum Cramer-Rao bound in terms of the Fisher information. The Fisher information is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$J_f = \mathrm{Tr}(\rho_f L_f^2)$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$L_f$&lt;/span&gt; is the symmetric logarithmic derivative &lt;span class=&quot;math-container&quot;&gt;$2\partial_f \rho_f=L_f\rho_f+\rho_f L _f$&lt;/span&gt;. They then state that when the probe for the estimation is an unnetangled pure quantum state, such Fisher information can be proved to be &lt;span class=&quot;math-container&quot;&gt;$J_f = [f(2-f)]^{-1}$&lt;/span&gt;, and if the probe is a maximally-entangled qubit pair, it equals &lt;span class=&quot;math-container&quot;&gt;$J_f=[f(\frac{4}{3}-f)]^{-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been trying to prove such equalities for those cases of the Fisher information, but I haven't been able to find something similar to it nor prove it.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-01-03T11:08:28.850" LastActivityDate="2021-01-03T11:08:28.850" Title="Quantum Fisher information" Tags="&lt;quantum-operation&gt;&lt;quantum-fisher-information&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5828" PostTypeId="2" ParentId="5824" CreationDate="2019-04-01T14:22:17.047" Score="4" Body="&lt;p&gt;I think your answer is right, the original article &lt;a href=&quot;http://science.sciencemag.org/content/275/5300/627&quot; rel=&quot;nofollow noreferrer&quot;&gt;Searching a Quantum Phone Book&lt;/a&gt; said that Grover's algorithm would solve the problem after quantum-DES enciphering the known clear text a mere 185 million times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although it is different from the results you calculated, but it looks much better than 185.&lt;/p&gt;&#xA;" OwnerUserId="6157" LastEditorUserId="26" LastEditDate="2019-04-01T14:25:34.843" LastActivityDate="2019-04-01T14:25:34.843" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5829" PostTypeId="1" AcceptedAnswerId="5838" CreationDate="2019-04-01T15:04:55.907" Score="12" ViewCount="4208" Body="&lt;h1&gt;Quantum cNOT Gate (Classical XOR Gate)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;A &quot;Controlled NOT (cNOT) Gate&quot; flips the 2nd qubit if the 1st qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;, and returns the 2nd qubit as-is if the 1st qubit is &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;. The 1st qubit is simply not changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The net effect of this gate is a classical XOR gate:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It keeps the 1st qubit unchanged&lt;/li&gt;&#xA;&lt;li&gt;It outputs &quot;the 1st qubit XOR the 2nd qubit&quot; as the result of the 2nd qubit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In table form, the function looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{cc}0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{cc}0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{cc}0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{cc}1 &amp;amp; \color{red}{1}\end{array} \\&#xA; \hline  &#xA; \begin{array}{cc}1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{cc}1 &amp;amp; \color{red}{0}\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, an input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\gamma\left|10\right&amp;gt;+\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is mapped to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\gamma\left|1\color{red}{1}\right&amp;gt;+\delta\left|1\color{red}{0}\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, in other words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\color{red}{\delta}\left|10\right&amp;gt;+\color{red}{\gamma}\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, we need to find the all the &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt;'s that satisfy the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    a_{11} &amp;amp; a_{12} &amp;amp; a_{13} &amp;amp; a_{14} \\&#xA;    a_{21} &amp;amp; a_{22} &amp;amp; a_{23} &amp;amp; a_{24} \\&#xA;    a_{31} &amp;amp; a_{32} &amp;amp; a_{33} &amp;amp; a_{34} \\&#xA;    a_{41} &amp;amp; a_{42} &amp;amp; a_{43} &amp;amp; a_{44} \\&#xA;    \end{pmatrix}&#xA;    \cdot&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;    =&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \color{red}{\delta} \\&#xA;    \color{red}{\gamma} \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is trivial to find the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; \color{red}{0} &amp;amp; \color{red}{1} \\&#xA;    0 &amp;amp; 0 &amp;amp; \color{red}{1} &amp;amp; \color{red}{0} \\&#xA;    \end{pmatrix}&#xA;    \cdot&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;    =&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \color{red}{\delta} \\&#xA;    \color{red}{\gamma} \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Quantum AND Gate?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Similarly, if there exists a gate that mimics the classical AND gate, it should have the following net effect:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It keeps the 1st qubit unchanged&lt;/li&gt;&#xA;&lt;li&gt;It outputs &quot;the 1st qubit AND the 2nd qubit&quot; as the result of the 2nd qubit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In table form, the function looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{cc}0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{cc}0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{cc}0 &amp;amp; \color{red}{0}\end{array} \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{cc}1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{cc}1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{cc}1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, an input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\gamma\left|10\right&amp;gt;+\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;should be mapped to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|0\color{red}{0}\right&amp;gt;+\gamma\left|10\right&amp;gt;+\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, in other words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\color{red}{(\alpha+\beta)}\left|00\right&amp;gt;+\color{red}{0}\left|01\right&amp;gt;+\gamma\left|10\right&amp;gt;+\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, we need to find the all the &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt;'s that satisfy the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    a_{11} &amp;amp; a_{12} &amp;amp; a_{13} &amp;amp; a_{14} \\&#xA;    a_{21} &amp;amp; a_{22} &amp;amp; a_{23} &amp;amp; a_{24} \\&#xA;    a_{31} &amp;amp; a_{32} &amp;amp; a_{33} &amp;amp; a_{34} \\&#xA;    a_{41} &amp;amp; a_{42} &amp;amp; a_{43} &amp;amp; a_{44} \\&#xA;    \end{pmatrix}&#xA;    \cdot&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;    =&#xA;    \begin{pmatrix}&#xA;    \color{red}{\alpha+\beta} \\&#xA;    \color{red}{0} \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is trivial to find the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    1 &amp;amp; \color{red}{1} &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; \color{red}{0} &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    \end{pmatrix}&#xA;    \cdot&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;    =&#xA;    \begin{pmatrix}&#xA;    \color{red}{\alpha+\beta} \\&#xA;    \color{red}{0} \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;Quantum OR Gate?&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Similarly, if there exists a gate that mimics the classical OR gate, it should have the following net effect:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It keeps the 1st qubit unchanged&lt;/li&gt;&#xA;&lt;li&gt;It outputs &quot;the 1st qubit OR the 2nd qubit&quot; as the result of the 2nd qubit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In table form, the function looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{cc}0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{cc}0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{cc}0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{cc}1 &amp;amp; \color{red}{1}\end{array} \\&#xA; \hline  &#xA; \begin{array}{cc}1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{cc}1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, an input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\gamma\left|10\right&amp;gt;+\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;should be mapped to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\gamma\left|1\color{red}{1}\right&amp;gt;+\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, in other words:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\left|00\right&amp;gt;+\beta\left|01\right&amp;gt;+\color{red}{0}\left|10\right&amp;gt;+\color{red}{(\gamma+\delta)}\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, we need to find the all the &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt;'s that satisfy the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    a_{11} &amp;amp; a_{12} &amp;amp; a_{13} &amp;amp; a_{14} \\&#xA;    a_{21} &amp;amp; a_{22} &amp;amp; a_{23} &amp;amp; a_{24} \\&#xA;    a_{31} &amp;amp; a_{32} &amp;amp; a_{33} &amp;amp; a_{34} \\&#xA;    a_{41} &amp;amp; a_{42} &amp;amp; a_{43} &amp;amp; a_{44} \\&#xA;    \end{pmatrix}&#xA;    \cdot&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;    =&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \color{red}{0} \\&#xA;    \color{red}{\gamma+\delta} \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is trivial to find the solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; \color{red}{0} &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; \color{red}{1} &amp;amp; 1 \\&#xA;    \end{pmatrix}&#xA;    \cdot&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \gamma \\&#xA;    \delta \\&#xA;    \end{pmatrix}&#xA;    =&#xA;    \begin{pmatrix}&#xA;    \alpha \\&#xA;    \beta \\&#xA;    \color{red}{0} \\&#xA;    \color{red}{\gamma+\delta} \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, since:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    A&#xA;    =&#xA;    \begin{pmatrix}&#xA;    1 &amp;amp; \color{red}{1} &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; \color{red}{0} &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    B&#xA;    =&#xA;    \begin{pmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; \color{red}{0} &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; \color{red}{1} &amp;amp; 1 \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;are not unitary matrices, as shown by &lt;span class=&quot;math-container&quot;&gt;$\det(A) = \det(B) = 0 \ne 1$&lt;/span&gt;, they could not be implemented directly as a quantum logic gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read the answer here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/132/6152&quot;&gt;If quantum gates are reversible how can they possibly perform irreversible classical AND and OR operations?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it is not intuitive enough for me:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;to understand what the final solution is; and&lt;/li&gt;&#xA;&lt;li&gt;to visualize how it achieves the same result as the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; above.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea on how to implement &quot;Classical AND&quot; and &quot;Classical OR&quot; with an explanation in matrix form? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6152" LastEditorUserId="26" LastEditDate="2019-04-01T18:17:13.433" LastActivityDate="2019-04-03T19:26:32.230" Title="Implementing &quot;Classical AND Gate&quot; and &quot;Classical OR Gate&quot; with a quantum circuit" Tags="&lt;quantum-gate&gt;&lt;classical-computing&gt;&lt;unitarity&gt;" AnswerCount="4" CommentCount="6" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5830" PostTypeId="2" ParentId="5815" CreationDate="2019-04-01T15:21:18.993" Score="10" Body="&lt;p&gt;Apart from the formal result about &lt;strong&gt;#P&lt;/strong&gt;-hardness, there's something worth touching on, about the nature of strong simulation itself. I'll comment first on strong simulation, and then specifically on the quantum case.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;1. Strong simulation even of &lt;em&gt;classical randomised&lt;/em&gt; computation is hard&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Strong simulation is a very powerful concept &amp;mdash; not only in the fact that it is a useful concept to consider, but in the more practical sense that it would allow you to do very powerful computations, even if you could do it in a purely &lt;em&gt;classical&lt;/em&gt; setting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At issue here is that a process with random outcomes &amp;mdash; whether or not it is quantum &amp;mdash; does not automatically come equipped with a way to compute the probabilities of its events; not even for the probabilities of the events which you actually see realised. The power of randomised computation, so to speak, is that you don't have to worry much about what the precise probability of an event is: it suffices to sample and attempt to realise that event sufficiently often to be confident of roughly what that probability is (or, for instance, just that the probability is non-zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Asking for actual probabilities is a very, well, &lt;em&gt;strong&lt;/em&gt; requirement to ask of a simulation, in the following sense:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Proposition.&lt;/strong&gt; Strongly simulating a polynomial-time &lt;em&gt;randomized&lt;/em&gt; computation with zero error is &lt;strong&gt;#P&lt;/strong&gt;-hard.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Proof:&lt;/em&gt; For any non-deterministic Turing machine &lt;strong&gt;N&lt;/strong&gt;, consider the question of how many branches it accepts on for an input &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^m$&lt;/span&gt;. It is enough for us to consider the case where &lt;strong&gt;N&lt;/strong&gt; makes a non-deterministic choice at every transition, and runs for time &lt;span class=&quot;math-container&quot;&gt;$m \in \mathrm{poly}(n)$&lt;/span&gt; in every branch, so that the branches of the computation can be indexed by the strings &lt;span class=&quot;math-container&quot;&gt;$z \in \{0,1\}^m$&lt;/span&gt;. The computation performed by &lt;strong&gt;N&lt;/strong&gt; can be represented similarly as a deterministic computation (a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;) depending on the input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and a given branch string &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. If we represent the status of 'accept' vs. 'reject' by a bit &lt;span class=&quot;math-container&quot;&gt;$a \in \{0,1\}$&lt;/span&gt; which is computed as &lt;span class=&quot;math-container&quot;&gt;$a = f(x,z)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Determining the number of branches &lt;span class=&quot;math-container&quot;&gt;$z \in \{0,1\}^m$&lt;/span&gt;, for which &lt;span class=&quot;math-container&quot;&gt;$f(x,z) = a$&lt;/span&gt; for a given &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt;, is essentially the canonical &lt;strong&gt;#P&lt;/strong&gt;-complete problem, using this connection to non-deterministic Turing machines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a polynomial-time randomised computation. We can describe this computation as a deterministic classical computation, performed with the help of a uniformly random bit-string of length &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.&#xA;Suppose that we are interested in whether a particular bit yields the outcome '1'.&#xA;For an input &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt; and random bit-string &lt;span class=&quot;math-container&quot;&gt;$z \in \{0,1\}^m$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$f(x,z) \in \{0,1\}$&lt;/span&gt; be the value that this bit takes: then &lt;span class=&quot;math-container&quot;&gt;$f(x,z)$&lt;/span&gt; can be computed in polynomial time.&#xA;The probability &lt;span class=&quot;math-container&quot;&gt;$P(a)$&lt;/span&gt; that this computation gives the result &lt;span class=&quot;math-container&quot;&gt;$a \in \{0,1\}$&lt;/span&gt; is then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P(a) = \frac{\# \bigl\{ z \in \{0,1\}^m \;\big|\; f(x,z) = a \bigr\}}{2^m}\,. $$&lt;/span&gt;&#xA;Because we could choose &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to be the function determining the acceptance condition of a non-deterministic Turing machine on input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in branch &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, then it is &lt;strong&gt;#P&lt;/strong&gt;-complete to compute &lt;span class=&quot;math-container&quot;&gt;$P(a)$&lt;/span&gt; exactly.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Proposition.&lt;/strong&gt; Strongly simulating a polynomial-time &lt;em&gt;randomized&lt;/em&gt; computation, with any relative error, is &lt;strong&gt;NP&lt;/strong&gt;-hard.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Proof.&lt;/em&gt; An important corner-case of the problem of approximating a probability with relative error, is the case where the exact probability is  equal to zero. In this case, any process which gives the correct probability up to any multiplicative factor must correctly produce the exact probability, if that probability happens to be 0. Similarly, any process which approximates an event with positive probability up to a positive scalar factor, must yield a probability estimate which is greater than zero. That process can then be used to determine whether the number of accepting branches of a non-deterministic Turing machine is zero or non-zero.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;From these two observations, you should take away the idea that strong simulation is a strong requirement &amp;mdash; in many cases, unfairly strong &amp;mdash; to make of a simulation method: it allows you to do much more powerful things than the computational model itself might be capable of.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;2. Strong simulation of quantum computation is &lt;em&gt;very&lt;/em&gt; hard&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;One difference between classical and quantum computation is on how difficult we think it is (in a complexity-theoretic sense) to strongly simulate them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that it is &lt;strong&gt;NP&lt;/strong&gt;-hard to strongly simulate a polynomial-time classical randomised process to relative error less than 1. Simulating a quantum process isn't going to be any easier. However, there is reason to believe that even with unreasonably powerful computational resources which would allow us to strongly simulate classical processes with bounded relative error, it will still be difficult to strongly simulate quantum processes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Theorem&lt;/strong&gt; (Stockmeyer [1]). For any counting problem in &lt;strong&gt;#P&lt;/strong&gt;, and any constant &lt;span class=&quot;math-container&quot;&gt;$d \geqslant 0$&lt;/span&gt; constant, the problem of computing the counting problem  within to a &lt;span class=&quot;math-container&quot;&gt;$(1 + O(n^{-d}))$&lt;/span&gt; factor is in &lt;span class=&quot;math-container&quot;&gt;$\mathbf{FP^{\:\!NP^{\:\!NP}}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The difficulty in the q quantum case is that while classical probabilities correspond to counting the number of accepting branches of a non-deterministic Turing machine, quantum computation corresponds more closely to counting &lt;em&gt;the difference between the number of accepting and rejecting branches&lt;/em&gt; of a non-deterministic Turing machine. That is, where a classical probability corresponds to a &lt;strong&gt;#P&lt;/strong&gt; function, a quantum amplitude corresponds to a &lt;strong&gt;GapP&lt;/strong&gt; function, which is the set of functions which may be expressed as a difference between two &lt;strong&gt;#P&lt;/strong&gt; functions. The connection between quantum computation and &lt;strong&gt;GapP&lt;/strong&gt; may be made formal, but on a high level, it is essentially because quantum computation can involve destructive interference between amplitudes associated with different events. More formally:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Proposition&lt;/strong&gt; (Liberal paraphrase of Theorem 3.2 of [2]). For any &lt;span class=&quot;math-container&quot;&gt;$f \in \mathbf{GapP}$&lt;/span&gt;, there is a polynomial-time quantum algorithm &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, with an accepting configuration &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, and a polynomial &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; such that, for all &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle c | Q | x \rangle = -f(x) \cdot 2^{-p(n)/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Approximating &lt;strong&gt;GapP&lt;/strong&gt; functions even to constant factors is difficult, because computing a &lt;strong&gt;GapP&lt;/strong&gt; function to within even a constant factor determines whether it is positive or negative. If you can do this, you can immediately solve the &lt;strong&gt;PP&lt;/strong&gt;-complete problem of determining whether or not the number of accepting paths is &lt;em&gt;greater than&lt;/em&gt; the number of rejecting paths; and if you do it repeatedly, with a number of related quantum computations in which you artificially inflate the number of accepting or rejecting paths by doing your quantum computation conditionally, you can compute the exact &lt;strong&gt;GapP&lt;/strong&gt; function essentially by binary search (the same way you can find a satisfying solution to a boolean formula, if one exists, given an oracle which simply tells you &lt;em&gt;whether&lt;/em&gt; a solution exists).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;References&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In addition to the references mentioned above, Maarten Van den Nest's article [3] mentioned by Martin Schwarz is noteworthy for presenting the first definition of 'strong simulation' of quantum systems (to distinguish it from the more reasonable standard of weak simulation), and also for presenting a number of ideas of the links between classical and quantum computation in the context of simulation.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Stockmeyer.&#xA;&lt;br&gt;&#xA;&lt;em&gt;The complexity of approximate counting.&lt;/em&gt;&#xA;&lt;br&gt;&#xA;Proceedings of STOC '83 (pp.&amp;amp;thinsp.118-126), 1983.&#xA;&lt;br&gt;&#xA;[PDF available at &lt;a href=&quot;https://dl.acm.org/citation.cfm?id=808740&quot; rel=&quot;nofollow noreferrer&quot;&gt;acm.org&lt;/a&gt;]&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fenner, Green, Homer, and Pruim.&#xA;&lt;br&gt;&#xA;&lt;em&gt;Determining Acceptance Possibility for a Quantum Computation is Hard&#xA;for the Polynomial Hierarchy&lt;/em&gt;.&#xA;&lt;br&gt;&#xA;Proceedings of the Royal Society London A vol. 455 (pp.&amp;thinsp;3953&amp;ndash;3966), 1999.&#xA;&lt;br&gt;&#xA;[&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9812056&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;arXiv&lt;/strong&gt;:&lt;strong&gt;quant-ph&lt;/strong&gt;/&lt;strong&gt;9812056&lt;/strong&gt;&lt;/a&gt;]&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Van den Nest.&#xA;&lt;br&gt;&#xA;&lt;em&gt;Classical simulation of quantum computation, the Gottesman-Knill theorem, and slightly beyond.&lt;/em&gt;&#xA;&lt;br&gt;&#xA;Quantum Information and Computation, vol. 10 (pp.&amp;thinsp;258-271), 2010.&#xA;&lt;br&gt;&#xA;[&lt;a href=&quot;https://arxiv.org/abs/0811.0898&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;arXiv&lt;/strong&gt;:&lt;strong&gt;0811.0898&lt;/strong&gt;&lt;/a&gt;].&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-04-01T23:49:18.977" LastActivityDate="2019-04-01T23:49:18.977" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5831" PostTypeId="1" CreationDate="2019-04-01T16:30:40.280" Score="3" ViewCount="92" Body="&lt;p&gt;I have several doubts about measuring Ising anyons. Measurement is crucial for quantum computation and even more so for magic state distillation which is necessary to make Ising anyons universal.&#xA;Several sources, e.g. &lt;a href=&quot;https://arxiv.org/abs/1501.02813&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1501.02813&lt;/a&gt;, say that there are basically two ways of measuring Ising anyons, one is a non-topological operation I address in this question, the other is some interferometry experiment which I might tackle in a different question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The procedure for the measurement is the following:&#xA; Bring anyons close together so that their degenerate Hilbert space is not degenerate anymore and the energy levels split. I believe I understand this part to some extent so let me sketch what I think I know: &#xA;In a 4 quasi-particle (e.g. 4 Majorana zero modes) encoding, a qubit can be represented by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle\equiv|(\sigma\times\sigma)_1\times(\sigma \times \sigma)_1\rangle=1 \\&#xA;|1\rangle\equiv|(\sigma\times\sigma)_\psi\times(\sigma \times \sigma)_\psi\rangle=1$$&lt;/span&gt;&#xA;The second state corresponds to two pairs of excited Majorana zero modes whereas the first one does not have these modes.&#xA;When the quasiparticles &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;  are far apart, then dragging them around each other will cause unitary rotations in the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|0\rangle $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; which corresponds to the degenerate ground state space of a Hamiltonian that exhibits 4 quasiparticles (I am thinking of a Kitaev chain here). As Majorana zero modes are zero energy excitations when far apart, the space is degenerate.  However, bringing close e.g. quasiparticle 1 and 2, suddenly, having the modes present in the system costs a finite amount of energy compared to vacuum, i.e. my logical state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; sits at a higher energy than &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Now, of course unitary time evolution by the Hamiltonian of the system will act like &lt;span class=&quot;math-container&quot;&gt;$U=e^{-iEt}$&lt;/span&gt; and because of the energy difference &lt;span class=&quot;math-container&quot;&gt;$\Delta E$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$|0\rangle $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, this effectively corresponds to letting a phase gate act on the qubit until the quasi-particles &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are pulled apart again. So far so good, only a few minor doubts.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When bringing the anonys together, it is claimed that upon measuring the energy of the system, we measure the state of the qubit. Does this mean an energy measurement will collapse the system even if in a superposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;li&gt;How can we experimentally measure the energy of the system and how do we know if it corresponds to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;? &lt;/li&gt;&#xA;&lt;li&gt;When the reference says &quot;detect their charge parity&quot;, what does it mean? (My encoding of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is such that both belong to the same fermion parity subspace as this quantity is conserved) &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A major doubt however is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this related to fusion at all? I read so often that fusion is bringing anyons together and then regarding them as a composite and I even think I came across the term fusion measurement. Until now, I thought fusion is really just viewing two anyons as one composite one but nothing physical.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="26" LastEditDate="2019-04-01T18:38:24.273" LastActivityDate="2019-04-01T18:38:24.273" Title="Measuring Ising anyons: What is a fusion measurement?" Tags="&lt;measurement&gt;&lt;experiment&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5832" PostTypeId="2" ParentId="5829" CreationDate="2019-04-01T18:37:59.177" Score="3" Body="&lt;h1&gt;Simulating &quot;Classical AND Gate&quot; using &quot;Toffoli Gate&quot; (also known as &quot;Controlled-Controlled-NOT Gate&quot;, or &quot;CCNOT Gate&quot;)&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;With the help of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/26/blue&quot;&gt;Blue&lt;/a&gt;'s comment, and the Wikipedia pages &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Toffoli_(CCNOT)_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate#Universality_and_Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, a solution to simulating classical AND gate was found.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CCNOT gate is a 3-qubit gate having the following properties:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If both the 1st and 2nd inputs are &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;, then it flips the 3rd input while keeping the 1st and 2nd inputs unchanged;&lt;/li&gt;&#xA;&lt;li&gt;Otherwise, it keeps all inputs unchanged.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The net effect of this gate is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It keeps the 1st qubit unchanged;&lt;/li&gt;&#xA;&lt;li&gt;It keeps the 2nd qubit unchanged;&lt;/li&gt;&#xA;&lt;li&gt;It outputs &quot;the 3rd qubit XOR (the 1st qubit AND the 2nd qubit)&quot; as the result of the 3rd qubit.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In table form, the function looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; \color{red}{1}\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; \color{red}{0}\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, it looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{red}{0} &amp;amp; \color{red}{1} \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{red}{1} &amp;amp; \color{red}{0} \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to calculate &lt;span class=&quot;math-container&quot;&gt;$\left|x\right&amp;gt;$&lt;/span&gt; AND &lt;span class=&quot;math-container&quot;&gt;$\left|y\right&amp;gt;$&lt;/span&gt;, we can:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prepare the 1st input to be &lt;span class=&quot;math-container&quot;&gt;$\left|x\right&amp;gt;$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;Prepare the 2nd input to be &lt;span class=&quot;math-container&quot;&gt;$\left|y\right&amp;gt;$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;Prepare the 3rd input to be &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Since we prepare the 3rd input to be &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; on purpose, we can just ignore the cases where the 3rd input is &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;. By removing  all the rows containing a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in the 3rd input (i.e. the 2nd, 4th, 6th, 8th row) from the table above, it becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; \color{red}{1}\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The net effect of the gate in this setting is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It keeps the 1st qubit unchanged;&lt;/li&gt;&#xA;&lt;li&gt;It keeps the 2nd qubit unchanged;&lt;/li&gt;&#xA;&lt;li&gt;It outputs &quot;&lt;s&gt;the 3rd qubit XOR&lt;/s&gt; (the 1st qubit AND the 2nd qubit)&quot; as the result of the 3rd qubit, since &quot;0 XOR x = x&quot; for any &quot;x&quot;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If we just look at the 1st input, the 2nd input, and the 3rd output, the table is exactly the same as the classical AND gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 0\end{array} &amp;amp; 0 \\&#xA; \hline  &#xA; \begin{array}{cc}0 &amp;amp; 1\end{array} &amp;amp; 0 \\&#xA; \hline  &#xA; \begin{array}{cc}1 &amp;amp; 0\end{array} &amp;amp; 0 \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 1\end{array} &amp;amp; \color{red}{1} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6152" LastEditorUserId="6152" LastEditDate="2019-04-01T18:56:41.450" LastActivityDate="2019-04-01T18:56:41.450" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5833" PostTypeId="1" CreationDate="2019-04-01T18:40:42.057" Score="4" ViewCount="231" Body="&lt;p&gt;I'm trying to evolve quantum circuits using genetic algorithms as they did in this paper &lt;a href=&quot;https://aip.scitation.org/doi/abs/10.1063/1.3575402&quot; rel=&quot;nofollow noreferrer&quot;&gt;Decomposition of unitary matrices for finding quantum circuits: Application to molecular Hamiltonians&lt;/a&gt; (Daskin &amp;amp; Kais).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So given a unitary target matrix (&lt;span class=&quot;math-container&quot;&gt;$U_t$&lt;/span&gt;), the task is to evolve a circuit that approximates &lt;span class=&quot;math-container&quot;&gt;$U_t$&lt;/span&gt; (let's call it &lt;span class=&quot;math-container&quot;&gt;$U_a$&lt;/span&gt;). This is the function I'm maximizing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F = \frac{1}{2^n}|\operatorname{Tr}(U_aU_t^{\dagger})|$$&lt;/span&gt; (where &lt;em&gt;n&lt;/em&gt; is the number of qubits)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My circuit encoding is a little bit different, I'm using a json string representation, here's an example of a random circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[{0: ('Y', -1, None), 1: ('Td', -1, None), 2: ('Y', -1, None)}, &#xA;{0: ('Z', 2, None), 1: ('Y', -1, None)}, &#xA;{0: ('Vd', 1, None), 2: ('V', -1, None)}, &#xA;{1: ('X', -1, None), 2: ('Y', 0, None)}, &#xA;{0: ('Td', -1, None), 2: ('V', 1, None)}, &#xA;{1: ('S', -1, None), 2: ('X', 0, None)}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Every dictionary item in the array is a column in the format &lt;code&gt;{target: (gate, control, param)}&lt;/code&gt;. The value -1 means no control, and None means there are no parameters. Here's a visual representation of this circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+--------+-------+-------+-------+-------+-------+-------+&#xA;| qubit  | col_0 | col_1 | col_2 | col_3 | col_4 | col_5 |&#xA;+--------+-------+-------+-------+-------+-------+-------+&#xA;| q0--&amp;gt;  |   Y   |  Z•2  |  Vd•1 |   I   |   Td  |   I   |&#xA;| q1--&amp;gt;  |   Td  |   Y   |   I   |   X   |   I   |   S   |&#xA;| q2--&amp;gt;  |   Y   |   I   |   V   |  Y•0  |  V•1  |  X•0  |&#xA;+--------+-------+-------+-------+-------+-------+-------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So far, I've been successful at finding very small circuits (with 2 &quot;columns&quot;). The problem comes when trying to evolve solutions for more complex circuits. For example, the paper shows this solution for the Toffoli unitary:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rSkfI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rSkfI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My algorithm is not able to find this solution or any other exact solution to this problem. I tried changing the selection method, crossover and mutation rates, but the fitness value never exceeds 0.85. After some generations, it seems that all individuals are converging to the same non-optimal circuit (this happens even with uniform crossover and random selection).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For crossover, I've tried one-point crossover and uniform crossover. The mutation operation can do these things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If it's a controlled gate, it can change the type of the target gate, can change the position of the control, can swap target/control, can remove the control, or can shuffle a column.&lt;/li&gt;&#xA;&lt;li&gt;If it's not a controlled gate, it can change the type of gate or introduce a control.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I don't see what else can I do to improve these operators. In the paper, they also have a continuous &lt;em&gt;angle phase&lt;/em&gt; parameter, but this particular circuit solution does not use it anyway.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another curious fact: for this particular problem, the &lt;em&gt;empty circuit&lt;/em&gt; has a fitness of 0.75. If a take the exact solution (from the image) and change a single gate, I can get a fitness of 0.5. So, an empty circuit has better fitness than a circuit which is a small step from the exact solution. This is very confusing, I don't see where the GA will find &quot;optimal sub-circuits&quot; to exchange during crossover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that the paper uses a more sophisticated version of a GA, but for the reasons stated above, I don't think it will make a difference in my case.&#xA;So what I'm missing or how can I improve this? Thank you!&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Edit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;It seems the GLOA did it's work. The algorithm found this for the Toffoli unitary:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;+--------+-------+-------+-------+-------+-------+&#xA;| qubit  | col_0 | col_1 | col_2 | col_3 | col_4 |&#xA;+--------+-------+-------+-------+-------+-------+&#xA;| q0--&amp;gt;  |   I   |   I   |   I   |   I   |   I   |&#xA;| q1--&amp;gt;  |  Z•2  |   I   |   I   |   I   |  S•0  |&#xA;| q2--&amp;gt;  |   I   |  Vd•0 |  Z•1  |  V•0  |   I   |&#xA;+--------+-------+-------+-------+-------+-------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But I limited the kind of gates it could use, now I'll try with all the gates.&lt;/p&gt;&#xA;" OwnerUserId="6083" LastEditorUserId="6083" LastEditDate="2019-04-02T21:13:34.850" LastActivityDate="2019-04-02T21:13:34.850" Title="Genetic algorithm does not converge to exact solution" Tags="&lt;algorithm&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5834" PostTypeId="2" ParentId="5829" CreationDate="2019-04-01T20:01:44.873" Score="1" Body="&lt;h1&gt;Simulating &quot;Classical OR Gate&quot;&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Please read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5832/6152&quot;&gt;my answer for simulating &quot;Classical AND Gate&quot;&lt;/a&gt; in this post first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this answer, I am going to use another approach to reach the solution. Let's begin with the table for classical OR gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 0\end{array} &amp;amp; 0 \\&#xA; \hline  &#xA; \begin{array}{cc}0 &amp;amp; 1\end{array} &amp;amp; 1 \\&#xA; \hline  &#xA; \begin{array}{cc}1 &amp;amp; 0\end{array} &amp;amp; 1 \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 1\end{array} &amp;amp; 1 \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As discussed in the comment section of the question, it is impossible for any 2-qubit quantum gate to simulate a classical OR gate - an &lt;a href=&quot;https://en.wikipedia.org/wiki/Ancilla_bit&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancilla bit&lt;/a&gt; is needed to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's see the table for the 3-qubit identity gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume the solution to be similar to that of classical AND gate - if we want to calculate &lt;span class=&quot;math-container&quot;&gt;$\left|x\right&amp;gt;$&lt;/span&gt; OR &lt;span class=&quot;math-container&quot;&gt;$\left|y\right&amp;gt;$&lt;/span&gt;, we can:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prepare the 1st input to be &lt;span class=&quot;math-container&quot;&gt;$\left|x\right&amp;gt;$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;Prepare the 2nd input to be &lt;span class=&quot;math-container&quot;&gt;$\left|y\right&amp;gt;$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\color{red}{\text{Prepare the 3rd input to be some value}}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Let's separate the table above by rows having &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; as the 3rd input, and rows having &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; as the 3rd input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{cc}&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;&amp;amp;&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA;\end{array} \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is trivial to see that the table on the right looks more similar to the classical OR gate, and thus is a better starting point. Therefore, we choose to  &lt;span class=&quot;math-container&quot;&gt;$\color{red}{\text{prepare the 3rd input to be} \left|1\right&amp;gt;}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since it is not possible to modify just one entry in the table to make a valid quantum gate - the resulting matrix will not be a unitary matrix, we need to pair it up and swap the values with another entry:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{cc}&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; \color{red}{1}\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;&amp;amp;&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; \color{red}{0}\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA;\end{array} \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Merging them back into one table, we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{Output} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; \color{red}{1}\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 0 &amp;amp; \color{red}{0}\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}0 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 0 &amp;amp; 1\end{array} \\&#xA; \hline&#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 0\end{array} \\&#xA; \hline  &#xA; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} &amp;amp; \begin{array}{ccc}1 &amp;amp; 1 &amp;amp; 1\end{array} \\&#xA; \hline  &#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it is trivial to see the matrix is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    \begin{pmatrix}&#xA;    \color{red}{0} &amp;amp; \color{red}{1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    \color{red}{1} &amp;amp; \color{red}{0} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to show that the matrix above is unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S.: I don't know if there is a name for this quantum gate, or how it could be written in terms of other named gates.&lt;/p&gt;&#xA;" OwnerUserId="6152" LastEditorUserId="6152" LastEditDate="2019-04-01T21:04:56.110" LastActivityDate="2019-04-01T21:04:56.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5836" PostTypeId="1" AcceptedAnswerId="5889" CreationDate="2019-04-02T09:00:43.407" Score="6" ViewCount="220" Body="&lt;p&gt;The classical channel capacity (&lt;span class=&quot;math-container&quot;&gt;$C_{ea}$&lt;/span&gt;) and the quantum channel capacity (&lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;) as defined &lt;a href=&quot;https://www.nature.com/articles/srep05720&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (eqs. 1 and 2) are given by &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C_{ea} = \text{sup}_{\rho} \Big[S(\rho) + S(\Phi_t \rho) - S(\rho,t)\Big],&#xA;\end{equation}&lt;/span&gt;&#xA;and &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Q(\Phi_t) = \text{sup}_{\rho} \Big[ S(\Phi_t \rho) - S(\rho,t)\Big].&#xA;\end{equation}&lt;/span&gt;&#xA;Here, &lt;span class=&quot;math-container&quot;&gt;$S(\cdot)$&lt;/span&gt; is the von-Neumann entropy. Also, &lt;span class=&quot;math-container&quot;&gt;$\Phi_t \rho$&lt;/span&gt; is the state evolved under the action of the map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$S(\rho,t)$&lt;/span&gt; is the entropy at the output of the complementary channel.  The two definitions look exactly the same apart from &lt;span class=&quot;math-container&quot;&gt;$S(\rho)$&lt;/span&gt; in the first case. How does the former correspond to &lt;em&gt;classical&lt;/em&gt; and the late to &lt;em&gt;quantum&lt;/em&gt; case? Further, for a pure state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S(\rho) = 0$&lt;/span&gt;, so the two definitions seem to coincide. Everything right here?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="10480" LastEditDate="2021-04-05T17:44:25.777" LastActivityDate="2021-04-05T17:44:25.777" Title="Understanding classical vs. quantum channel capacities" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;&lt;entropy&gt;&lt;channel-capacity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5837" PostTypeId="1" AcceptedAnswerId="5888" CreationDate="2019-04-02T10:50:16.107" Score="4" ViewCount="139" Body="&lt;p&gt;In the Bertlmann 2009 paper in the Annals of Physics (&lt;a href=&quot;https://arxiv.org/abs/0901.4729&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), an &lt;em&gt;optimal witness operator&lt;/em&gt; for an entangled state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, given that the closest separable state to it is &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A_{\text{opt}} = \frac{\rho_0 - \rho - \langle \rho_0, \rho_0 - \rho \rangle I}{|| \rho_0 - \rho ||} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How was this expression arrived at?&lt;/li&gt;&#xA;&lt;li&gt;Is this true only for the separable set, or any convex set?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-03-09T22:05:18.033" LastActivityDate="2021-03-09T22:05:18.033" Title="How is the expression for the optimal entanglement witness derived?" Tags="&lt;entanglement&gt;&lt;entanglement-witness&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5838" PostTypeId="2" ParentId="5829" CreationDate="2019-04-02T18:19:09.330" Score="11" Body="&lt;p&gt;Your &lt;em&gt;construction by gueswork&lt;/em&gt; in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5834&quot;&gt;this answer&lt;/a&gt;  is OK but not really elegant. Moreover, it's a convention to start in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;; we usually don't initialize a qubit with the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. It's better to follow the general construction which I illustrate here. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The idea here is to use ancillary qubits and impose unitary evolution on the larger system instead i.e. by treating the two-qubit system as a subsystem. There's a general method for constructing such gates. Essentially, you are trying to construct a quantum gate that'll perform a Boolean mapping like &lt;span class=&quot;math-container&quot;&gt;$f: \{0, 1\}^n \longrightarrow \{0, 1\}$&lt;/span&gt;. You've noted that for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; (two qubits), you cannot constructing unitary gates corresponding to some classical operations like the AND and OR as there's a rank deficiency (this happens precisely because those classical operations &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5276&quot;&gt;are irreversible&lt;/a&gt;). So we'll try with &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt; instead. Let's take the example of the quantum OR gate, which would perform the mapping &lt;span class=&quot;math-container&quot;&gt;$$|a \ b \ c\rangle \mapsto |a \ b \ c\oplus(a+b)\rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a,b,c \in \{0,1\}$&lt;/span&gt;. By the way, &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; here stands for XOR and &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; stands for OR. You do know that &lt;span class=&quot;math-container&quot;&gt;$0 \oplus x = x$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}$&lt;/span&gt;? Otherwise, check the &lt;a href=&quot;https://en.wikipedia.org/wiki/XOR_gate&quot; rel=&quot;noreferrer&quot;&gt;XOR table&lt;/a&gt;. Thus, if we set the additional qubit to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; initially, it boils down to &lt;span class=&quot;math-container&quot;&gt;$$|a \ b \ 0\rangle \mapsto |a \ b \ a+b\rangle.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's construct the table now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{|c c c|c c c|}&#xA;\hline&#xA;a &amp;amp; b &amp;amp; c &amp;amp; a &amp;amp; b &amp;amp; c\oplus (a+b) \\ \hline&#xA;0 &amp;amp; 0 &amp;amp; \color{red}{0} &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{red}{0}       \\ \hline&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1       \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; \color{red}{0} &amp;amp; 0 &amp;amp; 1 &amp;amp; \color{red}{1}       \\ \hline&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0       \\ \hline&#xA;1 &amp;amp; 0 &amp;amp; \color{red}{0} &amp;amp; 1 &amp;amp; 0 &amp;amp; \color{red}{1}       \\ \hline&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0       \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; \color{red}{0} &amp;amp; 1 &amp;amp; 1 &amp;amp; \color{red}{1}       \\ \hline&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0       \\ \hline&#xA;\end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're only only concerned with the cases where &lt;span class=&quot;math-container&quot;&gt;$c=0$&lt;/span&gt; i.e. the ones marked in red. Half done now! If we translate this to mapping of the computational basis vectors of the three-qubit system, we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle \mapsto |000\rangle \equiv [1 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0]^T \mapsto \color{blue}{[1 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|001\rangle \mapsto |001\rangle \equiv [0 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0]^T \mapsto \color{brown}{[0 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|010\rangle \mapsto |011\rangle \equiv [0 \ 0 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0]^T \mapsto \color{teal}{[0 \ 0 \ 0 \ 1 \ 0 \ 0 \ 0 \ 0]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|011\rangle \mapsto |010\rangle \equiv [0 \ 0 \ 0 \ 1 \ 0 \ 0 \ 0 \ 0]^T \mapsto \color{violet}{[0 \ 0 \ 1 \ 0 \ 0 \ 0 \ 0 \ 0]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|100\rangle \mapsto |101\rangle \equiv [0 \ 0 \ 0 \ 0 \ 1 \ 0 \ 0 \ 0]^T \mapsto \color{green}{[0 \ 0 \ 0 \ 0 \ 0 \ 1 \ 0 \ 0]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|101\rangle \mapsto |100\rangle \equiv [0 \ 0 \ 0 \ 0 \ 0 \ 1 \ 0 \ 0]^T \mapsto \color{magenta}{[0 \ 0 \ 0 \ 0 \ 1 \ 0 \ 0 \ 0]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|110\rangle \mapsto |111\rangle \equiv [0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 1 \ 0]^T \mapsto \color{orange}{[0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 1]^T}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|111\rangle \mapsto |110\rangle \equiv [0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 1]^T \mapsto \color{purple}{[0 \ 0 \ 0 \ 0 \ 0 \ 0 \ 1 \ 0]^T}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The columns vectors highlighted in blue will the columns of the required matrix cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Change_of_basis#Transformation_matrix&quot; rel=&quot;noreferrer&quot;&gt;change of basis transformation matrix&lt;/a&gt;. The matrix is certainly unitary as basis vectors are simply getting mapped to basis vectors, and the mapping is &lt;a href=&quot;https://en.wikipedia.org/wiki/Bijection&quot; rel=&quot;noreferrer&quot;&gt;bijective&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\color{red}{\text{quantum OR}} = \begin{pmatrix}&#xA;{\color{blue} 1} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 0} \\ &#xA;{\color{blue} 0} &amp;amp; {\color{brown} 1} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 0} \\ &#xA;{\color{blue} 0} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 1} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 0} \\&#xA;{\color{blue} 0} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 1} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 0} \\&#xA;{\color{blue} 0} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 1} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 0} \\&#xA;{\color{blue} 0} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 1} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 0} \\&#xA;{\color{blue} 0} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 0} &amp;amp; {\color{purple} 1} \\&#xA;{\color{blue} 0} &amp;amp; {\color{brown} 0} &amp;amp; {\color{teal} 0} &amp;amp; {\color{violet} 0} &amp;amp; {\color{green} 0} &amp;amp; {\color{magenta} 0} &amp;amp; {\color{orange} 1} &amp;amp; {\color{purple} 0} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Calculate the determinant and convince yourself that it's unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Exercise:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Use the method demonstrated here to construct the quantum gates corresponding to the classical NAND, NOR and XNOR gates. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Prove that the mapping defined by &lt;span class=&quot;math-container&quot;&gt;$(a,b,c)\mapsto (a, b, c\oplus f(a,b))$&lt;/span&gt; is one-one and onto, where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is any arbitrary &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_function&quot; rel=&quot;noreferrer&quot;&gt;Boolean function&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-02T18:41:41.423" LastActivityDate="2019-04-02T18:41:41.423" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5839" PostTypeId="1" CreationDate="2019-04-02T20:48:06.680" Score="5" ViewCount="278" Body="&lt;p&gt;Could you give me an example of a measurement which is separable but not LOCC (Local Operations Classical Communication)?&#xA;Given an ensable of states &lt;span class=&quot;math-container&quot;&gt;$\rho^{N}$&lt;/span&gt;, a separable measurement on it is a POVM &lt;span class=&quot;math-container&quot;&gt;$\lbrace N_i \rbrace$&lt;/span&gt; where the effects &lt;span class=&quot;math-container&quot;&gt;$N_i$&lt;/span&gt; are all of the form &lt;span class=&quot;math-container&quot;&gt;$N_i = A_i^{1} \otimes A_i^{2} \otimes \dots \otimes A_i^{N}$&lt;/span&gt;. So they are a separable product of effects acting on each state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\rho^{N}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/questions/470168&quot;&gt;Physics SE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="2490" LastEditorUserId="55" LastEditDate="2021-02-14T18:56:31.903" LastActivityDate="2021-02-14T18:56:31.903" Title="What is an example of a measurement that is LOCC but not separable?" Tags="&lt;measurement&gt;&lt;locc-operation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5840" PostTypeId="1" CreationDate="2019-04-03T00:20:57.390" Score="4" ViewCount="194" Body="&lt;p&gt;The transmon achieves its reduced sensitivity to charge noise by significantly increasing the ratio of the Josephson energy to the charging energy. What is this charging energy?&lt;/p&gt;&#xA;" OwnerUserId="5719" LastActivityDate="2019-04-03T00:20:57.390" Title="What is the charging energy in relation to a superconducting transmon?" Tags="&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5841" PostTypeId="2" ParentId="5823" CreationDate="2019-04-03T02:43:50.227" Score="3" Body="&lt;p&gt;As an initial matter, let's ask &quot;what is the classical computational complexity of solving 'mate-in-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;' type games?&quot;  For example, is it even in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{NP}$&lt;/span&gt; to know, given a certain chess position, that white can mate in &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; or fewer moves?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's been known for a while that we can consider such questions as a &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/True_quantified_Boolean_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantified boolean formula&lt;/a&gt;&quot; (QBF) question.  Let's rephrase our question as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exists w_1\forall b_1\exists w_2\forall b_2\cdots\exists w_n:\phi(w_1,b_1,w_2,b_2,\cdots,w_n)?$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;mate-in-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&quot; statement can be read as &quot;given a state of the board &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; encoding the rules of chess, does there exist a move by white such that for moves by black, there is a countermove by white such that... the moves applied to the board &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; will lead to a mate by white?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &quot;mate-in-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&quot; is precisely a way to think about the polynomial hierarchy &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PH}$&lt;/span&gt;.  The mate-in-&lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; is at the &lt;span class=&quot;math-container&quot;&gt;$10^{th}$&lt;/span&gt; level of the hierarchy (or maybe it's the &lt;span class=&quot;math-container&quot;&gt;$20^{th}$&lt;/span&gt;) because there are &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; iterations of for-alls and there-exists.  &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is easy to evaluate (polynomial evaluation of whether there's a mate or not).  The number of qubits would be polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; I think (high thousands?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Letting &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; vary polynomialy distinguishes &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PH}$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PSPACE}$&lt;/span&gt;.  Magically, although we know that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{BQP}\subseteq\mathcal{PSPACE}$&lt;/span&gt;, it's likely that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{PH}$&lt;/span&gt; are incomparable.  I think the implication is that certain well-framed QBF-style questions can be answered faster than classical algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For chess proper, most games can be completed in about &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; moves or less.  So we can say &quot;is there a mate-in-&lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; for white, given the starting position?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Chess has a lot of asymmetry that may make it difficult to frame in the right way.  Weichi (Go) may be a better candidate for pondering. I suspect a toy game, based on &lt;a href=&quot;https://arxiv.org/abs/1411.5729&quot; rel=&quot;nofollow noreferrer&quot;&gt;forrelation&lt;/a&gt;, can be built where a quantum computer can outperform a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To think about how to utilize such an algorithm, let's take the QBF a little bit more.  The output of the QBF is either a &quot;YES&quot; (a forced mate is possible) or &quot;NO&quot; (a forced mate is not possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we are &lt;strong&gt;white&lt;/strong&gt;, and we have a quantum QBF-solver that can be fed a given board position with &lt;strong&gt;black&lt;/strong&gt; to move, and will spit out whether there's a winning strategy for &lt;strong&gt;black&lt;/strong&gt; (i.e. YES or NO).  It is our turn to move.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can cycle through all of the available moves for &lt;strong&gt;white&lt;/strong&gt; by making a putative move, and ask our quantum QBF-solver whether &lt;strong&gt;black&lt;/strong&gt; has a winning response.  If we find a move where &lt;strong&gt;black&lt;/strong&gt; doesn't have a winning response we can take that line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the comments, you suggest that chess isn't likely played out in &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; moves starting from the initial board, and that &lt;span class=&quot;math-container&quot;&gt;$6000$&lt;/span&gt; moves is more likely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonetheless even accepting &lt;span class=&quot;math-container&quot;&gt;$6000$&lt;/span&gt; is the better estimate, I maintain that the number of qubits is polynomial in the depth of the tree you are willing to review, otherwise you haven't got a practical algorithm.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-03T12:19:38.607" LastActivityDate="2019-04-03T12:19:38.607" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5842" PostTypeId="1" CreationDate="2019-04-03T09:40:59.410" Score="3" ViewCount="70" Body="&lt;p&gt;I am going to implement  &quot;turn circuit encoding&quot; method of &#xA;&lt;a href=&quot;https://arxiv.org/abs/1811.00713&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coarse-grained lattice protein folding on a quantum annealer(Babej, Ing &amp;amp; Fingerhuth; 2018)&lt;/a&gt; using &lt;a href=&quot;https://pyqubo.readthedocs.io/en/latest/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PyQUBO&lt;/a&gt; to run on the DWave qbsolv environment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this method I have to implement equation 36 given below.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$s^r_{\pm k}(i,j) = r^{\text{th}}  \text{ digit of } \sum ^{j−1}_{p=i}d^p_{\pm k}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$d^p_{\pm k} \implies $&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d^j_{+x} = (1−q_2+\varphi)q_1 + \varphi q_3+\varphi, $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d^j_{−x} = (1−q_3+\varphi)q_1 + \varphi q_2+ \varphi, $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d^j_{+y} = (1−q_1+\varphi)(1−q_2+\varphi)q_3+\varphi, $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d^j_{−y} = (1−q_1+\varphi)(1−q_3+\varphi)q2+\varphi, $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d^j_{+z} = q_1+\varphi q_2+\varphi q_3+\varphi, $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d^j_{−z} = (1−q_2+\varphi)(1−q_3+\varphi)q_1+\varphi $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$$\varphi = 3(j − 2).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we calculate &lt;span class=&quot;math-container&quot;&gt;$$\sum ^{j−1}_{p=i}d^p_{\pm k},$$&lt;/span&gt; we get a list of qubits and want to find the &lt;span class=&quot;math-container&quot;&gt;$r^\text{th}$&lt;/span&gt; digit using PyQUBO. Is it possible to calculate &lt;span class=&quot;math-container&quot;&gt;$r^\text{th}$&lt;/span&gt; digit using PyQUBO and how should I do it?&lt;/p&gt;&#xA;" OwnerUserId="5968" LastEditorUserId="26" LastEditDate="2019-04-03T15:32:33.907" LastActivityDate="2019-04-03T15:32:33.907" Title="How to calculate the $r^{\text{th}}$ digit of $\sum ^{j−1}_{p=i}d^p_{\pm k}$ using PyQUBO?" Tags="&lt;programming&gt;&lt;d-wave&gt;&lt;annealing&gt;&lt;pyqubo&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5844" PostTypeId="2" ParentId="2110" CreationDate="2019-04-03T11:38:44.440" Score="4" Body="&lt;p&gt;The question is ultimately: &quot;What's the point to execute the algorithm if we have already searched for the element in order to build the oracle?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whilst somebody prebuilt the oracle, it may not have been the person using the oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm requires the oracle be queried no more times than &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\text{size of list}}$&lt;/span&gt;.  Naturally we cannot hope respective database lookups, as proposed earlier against which I cannot comment for lack of reputation, on say 5 million keys will return the content we want if our content is not addressed by any of those 5 million keys, but by saying the 9 millionth key, which happens not to be in our sample. How does Grover's algorithm do it then?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We ask the oracle: what is the answer it already has for the question it already has?  Even Mateus and Omar would ask the &quot;oracle-for-a-particular-alphabet-symbol&quot; during runtime, what are the position(s) of its symbol in the string that it has already compiled?  The oracle will give the answer to our query after only one consultation, but in this story, it cannot for example simply write out the answer as a binary string and send it to us over a classical communication channel.  It will hide its answer in a superposition for us to draw it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I let fancy or metaphor run away in this next bit: we don't quite hear the answer the first time, and we have to ask the oracle to repeat the same answer over and over again until we are sure what the oracle has said, except we start to hallucinate from misinformation in the diffusion process if we ask too many times.&lt;/p&gt;&#xA;" OwnerUserId="6086" LastEditorUserId="26" LastEditDate="2019-04-03T12:17:44.023" LastActivityDate="2019-04-03T12:17:44.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5845" PostTypeId="5" CreationDate="2019-04-03T12:05:10.010" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-03T12:05:10.010" LastActivityDate="2019-04-03T12:05:10.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5846" PostTypeId="4" CreationDate="2019-04-03T12:05:10.010" Score="0" Body="For questions about PyQUBO: Python DSL for constructing QUBOs from mathematical expressions. https://pyqubo.readthedocs.io/" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-03T12:05:10.010" LastActivityDate="2019-04-03T12:05:10.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5847" PostTypeId="1" CreationDate="2019-04-03T14:36:44.693" Score="7" ViewCount="313" Body="&lt;p&gt;This question is inspired by thinking about quantum computing power with respect to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5823/will-quantum-computers-be-able-to-solve-the-game-of-chess&quot;&gt;games&lt;/a&gt;, such as chess/checkers/other toy games.  Games fit naturally into the polynomial hierarchy &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt;; I'm curious about follow-up questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every Venn diagram or Hasse diagram I see illustrating the &quot;standard model&quot; of computational complexity describes a universe of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PSPACE}$&lt;/span&gt; problems, and puts &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; into a position containing all of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}$&lt;/span&gt;, and not containing all of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt;, but &lt;em&gt;cutting through&lt;/em&gt; to outside of the polynomial hierarchy &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt;.  That is, such Venn diagrams posit that there are likely problems efficiently solvable with a quantum computer that are outside of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how does this &quot;cut through?&quot;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, does this imply that there must be a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; problem in the &lt;em&gt;first&lt;/em&gt; level of the hierarchy, one in the &lt;em&gt;second&lt;/em&gt; level of the hierarchy, one in the &lt;em&gt;third&lt;/em&gt; level &lt;span class=&quot;math-container&quot;&gt;$\cdots$&lt;/span&gt;, and one such as &quot;forrelation&quot; (correlation of Fourier series) &lt;em&gt;completely outside&lt;/em&gt; of the hierarchy?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or could it be that there are some &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; problems in the &lt;em&gt;first&lt;/em&gt; level of the hierarchy, some &lt;em&gt;outside&lt;/em&gt; of the hierarchy, and an infinite number of levels of the hierarchy that are voided of any &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FdGzsm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FdGzsm.png&quot; alt=&quot;Quanta Magazine Article&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See, e.g., the above picture from the Quanta Magazine article &quot;Finally, a Problem that Only Quantum Computers Will Ever Be Able to Solve&quot; &lt;a href=&quot;https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.  Could &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; be disconnected between &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; and the island outside of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt;?  Or must there be a bridge over &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt; connecting the two?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-12-05T19:28:02.783" LastActivityDate="2019-12-05T19:28:02.783" Title="Is there a BQP algorithm for each level of the polynomial hierarchy PH?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;bqp&gt;&lt;forrelation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5848" PostTypeId="1" AcceptedAnswerId="5856" CreationDate="2019-04-03T17:04:16.673" Score="1" ViewCount="218" Body="&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src=&quot;https://i.stack.imgur.com/ktTzm.png?s=320&amp;amp;d=identicon&amp;amp;r=PG&quot; alt=&quot;https://i.stack.imgur.com/ktTzm.png&quot; title=&quot;CENTERED!&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a certain transformations that goes as follows:&#xA;Given &lt;span class=&quot;math-container&quot;&gt;$A=|abc\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B=|xyz\rangle$&lt;/span&gt;, now I have cases as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{if }c=1,z=1, b\oplus y=1 \implies \text{flip}(x)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{if }c=1, z=1 \implies \text{flip}(y)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{if }c=1\implies \text{flip}(z)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{if }b=1\implies \text{flip}(y)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{if }a=1\implies \text{flip}(x)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody just tell me the circuit for the bit-wise XOR that I have used between &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, i.e &lt;span class=&quot;math-container&quot;&gt;$b\oplus y=1$&lt;/span&gt;? The other gates I know are CNOT and Toffoli. &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-09T10:01:33.423" LastActivityDate="2019-05-09T10:01:33.423" Title="How to construct a quantum circuit for the following state transformation?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="5849" PostTypeId="2" ParentId="5829" CreationDate="2019-04-03T19:14:56.780" Score="5" Body="&lt;h1&gt;Simulating Classical &quot;AND/NAND/OR/NOR/XOR/XNOR&quot; Gates&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;With the help of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5838/6152&quot;&gt;this answer from Blue&lt;/a&gt;, constructing a matrix for a classical gate is just a matter of following the steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the combined truth table for classical logic gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|c|c|c|c|c|}&#xA; \hline&#xA; \text{Input} &amp;amp; \text{AND} &amp;amp; \text{NAND} &amp;amp; \text{OR} &amp;amp; \text{NOR} &amp;amp; \text{XOR} &amp;amp; \text{XNOR} \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 0\end{array} &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA; \hline&#xA; \begin{array}{cc}0 &amp;amp; 1\end{array} &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 0\end{array} &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; \hline&#xA; \begin{array}{cc}1 &amp;amp; 1\end{array} &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; \hline&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It could be seen that since the output of &lt;strong&gt;AND&lt;/strong&gt;, &lt;strong&gt;NAND&lt;/strong&gt;, &lt;strong&gt;OR&lt;/strong&gt;, and &lt;strong&gt;XOR&lt;/strong&gt; do not have equal number of 0's and 1's, they need an &lt;a href=&quot;https://en.wikipedia.org/wiki/Ancilla_bit&quot; rel=&quot;noreferrer&quot;&gt;ancilla bit&lt;/a&gt;. For &lt;strong&gt;XOR&lt;/strong&gt; and &lt;strong&gt;XNOR&lt;/strong&gt;, no ancilla bit is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a table for the mappings and matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The light color mappings represent mappings that are &quot;not used&quot;, since the ancilla bit is always prepared to be &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; by convention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A color tone groups a pair of mapping swap, which is necessary to achieve reversibility and keep the matrix a unitary matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA; \hline&#xA; \text{Gate} &amp;amp; \text{Mapping} &amp;amp; \text{Matrix} \\&#xA; \hline&#xA; \text{AND} &amp;amp;&#xA; \begin{array}{}&#xA;  \left|000\right&amp;gt; \mapsto \left|000\right&amp;gt; \\&#xA;  \color{#999}{\left|001\right&amp;gt; \mapsto \left|001\right&amp;gt;} \\&#xA;  \left|010\right&amp;gt; \mapsto \left|010\right&amp;gt; \\&#xA;  \color{#999}{\left|011\right&amp;gt; \mapsto \left|011\right&amp;gt;} \\&#xA;  \left|100\right&amp;gt; \mapsto \left|100\right&amp;gt; \\&#xA;  \color{#999}{\left|101\right&amp;gt; \mapsto \left|101\right&amp;gt;} \\&#xA;  \left|110\right&amp;gt; \mapsto \color{#f00}{\left|111\right&amp;gt;} \\&#xA;  \color{#999}{\left|111\right&amp;gt; \mapsto \color{#f99}{\left|110\right&amp;gt;}} \\&#xA; \end{array} &amp;amp;&#xA; \begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#f00}{0} &amp;amp; \color{#f00}{1} \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#f00}{1} &amp;amp; \color{#f00}{0} \\&#xA; \end{pmatrix} \\&#xA; \hline&#xA; \text{NAND} &amp;amp;&#xA; \begin{array}{}&#xA;  \left|000\right&amp;gt; \mapsto \color{#f00}{\left|001\right&amp;gt;} \\&#xA;  \color{#999}{\left|001\right&amp;gt; \mapsto \color{#f99}{\left|000\right&amp;gt;}} \\&#xA;  \left|010\right&amp;gt; \mapsto \color{#0b5}{\left|011\right&amp;gt;} \\&#xA;  \color{#999}{\left|011\right&amp;gt; \mapsto \color{#7b9}{\left|010\right&amp;gt;}} \\&#xA;  \left|100\right&amp;gt; \mapsto \color{#07c}{\left|101\right&amp;gt;} \\&#xA;  \color{#999}{\left|101\right&amp;gt; \mapsto \color{#7ac}{\left|100\right&amp;gt;}} \\&#xA;  \left|110\right&amp;gt; \mapsto \left|110\right&amp;gt; \\&#xA;  \color{#999}{\left|111\right&amp;gt; \mapsto \left|111\right&amp;gt;} \\&#xA; \end{array} &amp;amp;&#xA; \begin{pmatrix}&#xA;  \color{#f00}{0} &amp;amp; \color{#f00}{1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  \color{#f00}{1} &amp;amp; \color{#f00}{0} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; \color{#0b5}{0} &amp;amp; \color{#0b5}{1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; \color{#0b5}{1} &amp;amp; \color{#0b5}{0} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#07c}{0} &amp;amp; \color{#07c}{1} &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#07c}{1} &amp;amp; \color{#07c}{0} &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; \end{pmatrix} \\&#xA; \hline&#xA; \text{OR} &amp;amp;&#xA; \begin{array}{}&#xA;  \left|000\right&amp;gt; \mapsto \left|000\right&amp;gt; \\&#xA;  \color{#999}{\left|001\right&amp;gt; \mapsto \left|001\right&amp;gt;} \\&#xA;  \left|010\right&amp;gt; \mapsto \color{#f00}{\left|011\right&amp;gt;} \\&#xA;  \color{#999}{\left|011\right&amp;gt; \mapsto \color{#f99}{\left|010\right&amp;gt;}} \\&#xA;  \left|100\right&amp;gt; \mapsto \color{#0b5}{\left|101\right&amp;gt;} \\&#xA;  \color{#999}{\left|101\right&amp;gt; \mapsto \color{#7b9}{\left|100\right&amp;gt;}} \\&#xA;  \left|110\right&amp;gt; \mapsto \color{#07c}{\left|111\right&amp;gt;} \\&#xA;  \color{#999}{\left|111\right&amp;gt; \mapsto \color{#7ac}{\left|110\right&amp;gt;}} \\&#xA; \end{array} &amp;amp;&#xA; \begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; \color{#f00}{0} &amp;amp; \color{#f00}{1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; \color{#f00}{1} &amp;amp; \color{#f00}{0} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#0b5}{0} &amp;amp; \color{#0b5}{1} &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#0b5}{1} &amp;amp; \color{#0b5}{0} &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#07c}{0} &amp;amp; \color{#07c}{1} \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \color{#07c}{1} &amp;amp; \color{#07c}{0} \\&#xA; \end{pmatrix} \\&#xA; \hline&#xA; \text{NOR} &amp;amp;&#xA; \begin{array}{}&#xA;  \left|000\right&amp;gt; \mapsto \color{#f00}{\left|001\right&amp;gt;} \\&#xA;  \color{#999}{\left|001\right&amp;gt; \color{#f99}{\mapsto \left|000\right&amp;gt;}} \\&#xA;  \left|010\right&amp;gt; \mapsto \left|010\right&amp;gt; \\&#xA;  \color{#999}{\left|011\right&amp;gt; \mapsto \left|011\right&amp;gt;} \\&#xA;  \left|100\right&amp;gt; \mapsto \left|100\right&amp;gt; \\&#xA;  \color{#999}{\left|101\right&amp;gt; \mapsto \left|101\right&amp;gt;} \\&#xA;  \left|110\right&amp;gt; \mapsto \left|110\right&amp;gt; \\&#xA;  \color{#999}{\left|111\right&amp;gt; \mapsto \left|111\right&amp;gt;} \\&#xA; \end{array} &amp;amp;&#xA; \begin{pmatrix}&#xA;  \color{#f00}{0} &amp;amp; \color{#f00}{1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  \color{#f00}{1} &amp;amp; \color{#f00}{0} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; \end{pmatrix} \\&#xA; \hline&#xA; \text{XOR} &amp;amp;&#xA; \begin{array}{}&#xA;  \left|00\right&amp;gt; \mapsto \left|00\right&amp;gt; \\&#xA;  \left|01\right&amp;gt; \mapsto \left|01\right&amp;gt; \\&#xA;  \left|10\right&amp;gt; \mapsto \color{#f00}{\left|11\right&amp;gt;} \\&#xA;  \left|11\right&amp;gt; \mapsto \color{#f00}{\left|10\right&amp;gt;} \\&#xA; \end{array} &amp;amp;&#xA; \begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; \color{#f00}{0} &amp;amp; \color{#f00}{1} \\&#xA;  0 &amp;amp; 0 &amp;amp; \color{#f00}{1} &amp;amp; \color{#f00}{0} \\&#xA; \end{pmatrix} \\&#xA; \hline&#xA; \text{XNOR} &amp;amp;&#xA; \begin{array}{}&#xA;  \left|00\right&amp;gt; \mapsto \color{#f00}{\left|01\right&amp;gt;} \\&#xA;  \left|01\right&amp;gt; \mapsto \color{#f00}{\left|00\right&amp;gt;} \\&#xA;  \left|10\right&amp;gt; \mapsto \left|10\right&amp;gt; \\&#xA;  \left|11\right&amp;gt; \mapsto \left|11\right&amp;gt; \\&#xA; \end{array} &amp;amp;&#xA; \begin{pmatrix}&#xA;  \color{#f00}{0} &amp;amp; \color{#f00}{1} &amp;amp; 0 &amp;amp; 0 \\&#xA;  \color{#f00}{1} &amp;amp; \color{#f00}{0} &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; \end{pmatrix} \\&#xA; \hline&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6152" LastEditorUserId="6152" LastEditDate="2019-04-03T19:26:32.230" LastActivityDate="2019-04-03T19:26:32.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5850" PostTypeId="1" AcceptedAnswerId="5871" CreationDate="2019-04-04T04:36:47.230" Score="6" ViewCount="287" Body="&lt;p&gt;I encountered the hidden shift problem as a benchmarking function to test the quantum algorithm outlined in &lt;a href=&quot;https://arxiv.org/abs/1601.07601&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; paper (the problem also features &lt;a href=&quot;https://arxiv.org/abs/0811.3208&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There are two oracle functions &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f'$&lt;/span&gt; : &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_{2}^{n}&#xA;\rightarrow \{ \pm 1 \}$&lt;/span&gt; and a hidden shift string &lt;span class=&quot;math-container&quot;&gt;$s \in&#xA;\mathbb{F}_{2}^{n}$&lt;/span&gt;. It is promised that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is a bent (maximally&#xA;  non-linear) function, that is, the Hadamard transform of f takes&#xA;  values &lt;span class=&quot;math-container&quot;&gt;$ \pm 1$&lt;/span&gt;. It is also promised that &lt;span class=&quot;math-container&quot;&gt;$f′$&lt;/span&gt; is the shifted version&#xA;  of the Hadamard transform of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, that is&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f'(x \oplus s) = 2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}}&#xA;(−1)^{x·y}f(y) \forall x \in \mathbb{F}_{2}^{n} $$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The oracles are diagonal &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit unitary operators such that&#xA;  &lt;span class=&quot;math-container&quot;&gt;$O_{f}|x \rangle = f(x) |x \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$O_{f'}|x \rangle = f'(x) |x&#xA;\rangle$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x \in \mathbb{F}^{n}_{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It is stated that &lt;span class=&quot;math-container&quot;&gt;$|s⟩ = U|0^{n}⟩$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U ≡ H^{\otimes n} O_{f′} H^{\otimes n} O_{f} H^{\otimes n}$&lt;/span&gt;. I am struggling with this calculation. Here's what I did.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n} O_{f′} H^{\otimes n} O_{f} H^{\otimes n}|0^{n}\rangle$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$= H^{\otimes n} O_{f′} H^{\otimes n} 2^{−\frac{n}{2}}\sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x) |x \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= H^{\otimes n} O_{f′} ~2^{−n}\sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x) \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{x.y}  |y \rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= H^{\otimes n} ~2^{−n} \sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x) \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{x.y} f'(y)  |y \rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= 2^{−\frac{3n}{2}} \sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x) \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{x.y} f'(y) \sum_{z \in \mathbb{F}^{n}_{2}} (-1)^{y.z} |z \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure whether I have the correct expression and if I do, I have no idea how to simplify this large expression to get &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="26" LastEditDate="2019-04-04T07:51:19.967" LastActivityDate="2019-04-08T05:52:28.720" Title="Hidden shift problem as a benchmarking function" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5851" PostTypeId="1" CreationDate="2019-04-04T14:48:39.820" Score="3" ViewCount="139" Body="&lt;p&gt;Nielsen explains how a search algorithm can access a classic database. I have a few questions. I hope you can help me a bit :) I work with a few quotes from the book.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The principle of operation is a means by which the binary encoded state of the quantum index (where &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2^n − 1$&lt;/span&gt; is represented by n qubits) is translated into a unary encoding (where &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2^n − 1$&lt;/span&gt; is represented by the position of a single probe within &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible locations) which addresses the classical database.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Ok, if I understand that correctly, the quantum index register is translated into a unary system that specifies the position in the classic database. What I understand less is this statement: &amp;quot;represented by the position of a single probe within &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible locations&amp;quot; what is being said with &amp;quot;a single probe within &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible locations&amp;quot;?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The database effects a change on a degree of freedom within the probe which is unrelated to its position.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What is the &amp;quot;probe&amp;quot;? And what is behind &amp;quot;degree of freedom&amp;quot;? The sentence is not clear to me.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Each circle represents a switch, addressed by the qubit inscribed within.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;OK, so the qubit controls the switch and thus the route.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The data register qubits enter at the top of the tree, and are routed down to the database&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How does that work exactly? So where is the connection with the switches from earlier?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The binary to unary encoding is then reversed, leaving the data register with the desired contents.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That is, the entries in the database affect the qubits that penetrate the schema. So that the qubits can then accept their content?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The qubits are then routed back into a deﬁnite position&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How does the way back work?&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="7460" LastEditorDisplayName="user4961" LastEditDate="2020-08-03T07:15:16.757" LastActivityDate="2020-09-02T08:00:55.150" Title="Quantum addressing scheme" Tags="&lt;algorithm&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5852" PostTypeId="2" ParentId="5648" CreationDate="2019-04-04T15:38:12.277" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://www.research.ibm.com/ibm-q/technology/devices/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This page&lt;/a&gt; might give some useful information in regards to your question: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On this page you can see the Average Measurements for &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; times, Gate Error, Frequency, and Readout Error for each machine since its most recent calibration. If look at these measurements for &quot;ibmqx4&quot; (IBM Q 5 Tenerife) and &quot;ibmqx2&quot; (IBM Q 5 Yorktown) you can see that the measurements differ. If you were to run the same program on both devices, there could be some variance in results based on these differing measurements, as well as the inherent noise you had mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for exactly how much variance there would be, that is hard to say.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastEditorUserId="26" LastEditDate="2019-04-04T17:05:24.587" LastActivityDate="2019-04-04T17:05:24.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5853" PostTypeId="1" CreationDate="2019-04-04T17:39:43.677" Score="3" ViewCount="106" Body="&lt;p&gt;As per the Shor's algorithm, we need to evaluate &lt;span class=&quot;math-container&quot;&gt;$a^x \bmod N$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$x = 0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt;. What is the reason for this? Why can't we just evaluate for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; or something like that?&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="26" LastEditDate="2019-04-05T14:36:38.273" LastActivityDate="2019-04-05T14:36:38.273" Title="Reason for evaluating $a^x \bmod N$ from $x = 0$ to $N^2$" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5854" PostTypeId="2" ParentId="5853" CreationDate="2019-04-05T00:51:19.280" Score="4" Body="&lt;p&gt;Shor's algorithm relies on determining the period of &lt;span class=&quot;math-container&quot;&gt;$a^x\bmod N$&lt;/span&gt;.  If you only evaluate up to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, then you are undersampling, in much the same way that you would classically be below the &lt;a href=&quot;https://en.wikipedia.org/wiki/Nyquist_frequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nyquist criteria&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you measure the second register and get &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, the first register collapses to all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^x\bmod N =y$&lt;/span&gt;.  These &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; collide at &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.  If you only evaluate up to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, there is a chance that there will be no collisions for which you can properly measure the frequency in the first register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating up to &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; increases the number of such collisions, and hence decreases the odds that you undersampled.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-04-05T00:51:19.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5856" PostTypeId="2" ParentId="5848" CreationDate="2019-04-05T07:05:58.623" Score="4" Body="&lt;p&gt;Why not simply try the following?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/anGx0t.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/anGx0t.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;You could have used an ancilla and computed &lt;span class=&quot;math-container&quot;&gt;$y\oplus b$&lt;/span&gt; (that requires two controlled-nots, one controlled off each of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, not a Toffoli) provided you later uncomputed the ancilla to reset it back to 0. But having an ancilla is unnecessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to explain what's happening in the boxed part of my circuit, both gates only work if &lt;span class=&quot;math-container&quot;&gt;$c=z=1$&lt;/span&gt;. Then the two gates flip &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; depending on the value of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; respectively. So, if &lt;span class=&quot;math-container&quot;&gt;$b\oplus y=1$&lt;/span&gt;, only one flip is applied, because one value is 0 and one value is 1.  If &lt;span class=&quot;math-container&quot;&gt;$b\oplus y=0$&lt;/span&gt;, then either &lt;span class=&quot;math-container&quot;&gt;$b=y=0$&lt;/span&gt;, and no flip is applied, or &lt;span class=&quot;math-container&quot;&gt;$b=y=1$&lt;/span&gt; and two flips are applied. But 2 flips cancel each other, so if &lt;span class=&quot;math-container&quot;&gt;$b\oplus y=0$&lt;/span&gt;, no operation is applied.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="434" LastEditDate="2019-04-05T16:38:00.220" LastActivityDate="2019-04-05T16:38:00.220" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="5857" PostTypeId="1" CreationDate="2019-04-05T17:17:36.617" Score="4" ViewCount="84" Body="&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/questions/470651/is-the-quantum-singleton-bound-compatible-with-the-toric-code&quot;&gt;Physics SE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The quantum Singleton bound states that for an error-correcting code with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; physical qubits and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; encoded qubits, and some subsystem &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits that can 'access the entire quantum code', it is necessary that &lt;span class=&quot;math-container&quot;&gt;$m \ge \frac{n+k}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand (from section 4.3 of Harlow's &lt;a href=&quot;https://arxiv.org/abs/1802.01040&quot; rel=&quot;nofollow noreferrer&quot;&gt;TASI notes&lt;/a&gt;), one way to state the condition for 'accessing the entire code' is the Knill-Laflamme condition, which is the following. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\bar{R}$&lt;/span&gt; denote the complement of &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathscr{H}_\bar{R}$&lt;/span&gt; be&#xA;  the space of operators supported on &lt;span class=&quot;math-container&quot;&gt;$\bar{R}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; denote the projection matrix onto the code subspace &lt;span class=&quot;math-container&quot;&gt;$\mathscr{H}_{code}$&lt;/span&gt;. Then for any operator&#xA;  &lt;span class=&quot;math-container&quot;&gt;$O_{\bar{R}} \in \mathscr{H}_\bar{R}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P O_{\bar{R}} P = \lambda P$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is some constant that depends on the operator &lt;span class=&quot;math-container&quot;&gt;$O_{\bar{R}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This means that operator supported on the complement region &lt;span class=&quot;math-container&quot;&gt;$\bar{R}$&lt;/span&gt; has no effect on measurements on &lt;span class=&quot;math-container&quot;&gt;$\mathscr{H}_{code}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm confused because this does not seem compatible with the toric code. Because, it can be shown that in the toric code (where the number of encoded bits &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;), the Knill-Laflamme condition is satisfied for &lt;span class=&quot;math-container&quot;&gt;$\bar{R}$&lt;/span&gt; being any contractible region of qubits, i.e. for &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; containing the union of two distinct nontrivial cycles on the torus. In this case on a torus of length &lt;span class=&quot;math-container&quot;&gt;$L \times L$&lt;/span&gt;, we will have the number of physical qubits being &lt;span class=&quot;math-container&quot;&gt;$n = L^2$&lt;/span&gt; and the number of bits needed to access being &lt;span class=&quot;math-container&quot;&gt;$m = 2L$&lt;/span&gt;. So, it seems that the singleton bound is explicitly violated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where does the logic I'm presenting fail, and why should the Toric Code be compatible with this?&lt;/p&gt;&#xA;" OwnerUserId="6188" LastEditorUserId="26" LastEditDate="2019-04-05T18:34:19.897" LastActivityDate="2019-04-05T18:34:19.897" Title="Is the quantum Singleton bound compatible with the Toric Code?" Tags="&lt;error-correction&gt;&lt;surface-code&gt;&lt;toric-code&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5859" PostTypeId="1" CreationDate="2019-04-05T22:24:51.033" Score="4" ViewCount="122" Body="&lt;p&gt;The HHL paper &quot;Quantum algorithm for linear systems of equations&quot; [&lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;] initially describes a &quot;simple example&quot; to illustrate the potential power of their algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They state:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider a stochastic process &lt;span class=&quot;math-container&quot;&gt;$x_t=Ax_{t−1}+b$&lt;/span&gt;, where the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;’th coordinate in the vector &lt;span class=&quot;math-container&quot;&gt;$x_t$&lt;/span&gt; represents the abundance of item &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. The stable state of this distribution is given by &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle = (I−A)^{−1}\vert b\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$x_t'=A'x_{t−1}'+b'$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vert x'\rangle = (I−A')^{−1}\vert b '\rangle$&lt;/span&gt;. To know if &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert x'\rangle$&lt;/span&gt; are similar, we perform the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; test between them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I understand this correctly, this seems like a very potent application of HHL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if we have some large space that we &lt;em&gt;know&lt;/em&gt; can be fully explored with a certain set of moves &lt;span class=&quot;math-container&quot;&gt;$s= \langle P, Q, R\rangle$&lt;/span&gt; but we &lt;em&gt;suspect&lt;/em&gt; can be fully explored with a simpler set of moves &lt;span class=&quot;math-container&quot;&gt;$s'=\langle P, Q \rangle$&lt;/span&gt;, then I believe as long as we have some way to prepare &lt;span class=&quot;math-container&quot;&gt;$\vert b\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert b' \rangle$&lt;/span&gt; in a uniform superposition of the entire space, we can determine if both &lt;span class=&quot;math-container&quot;&gt;$s'$&lt;/span&gt; generate as big a space as &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, it's debated whether the Rubik's Cube can be generated with only &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; twists - that, whether one of the twists is redundant.  If we define &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to correspond to a transition matrix flipping all &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; of the faces, while &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; is defined to be only &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; of the faces, and we let both &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert b' \rangle$&lt;/span&gt; be in a uniform superposition over all of the Rubik's cube states, then I believe running the HHL embodiment described above will answer whether that &lt;span class=&quot;math-container&quot;&gt;$6^{\text{th}}$&lt;/span&gt; face twist is redundant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As another example, we know that knot moves on a grid diagram - including cyclic permutations, stabilizations, and castling moves - are sufficient to tie and untie any knot to any other knot.  However, I read somewhere that cyclic permutations may be redundant, and be realized by a sequence of castling and stabilization/destabilization moves.  If we are able to generate a uniform superposition over all grid diagrams, and have &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be the transition matrix including permutations and &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; be the transition matrix excluding permutations, then I believe we would show the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this the correct way to think about the HHL paper's example?  Are there other good examples of HHL's reasoning?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-07T13:27:41.993" LastActivityDate="2019-04-07T13:27:41.993" Title="What are applications of HHL's &quot;simple example&quot; to determine similar stable states of different quantum processes?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5860" PostTypeId="5" CreationDate="2019-04-06T13:08:13.583" Score="0" Body="&lt;p&gt;The &quot;forrelation&quot; problem is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given boolean functions &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, what is the inner product of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; with the Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aaronson pondered this as a potentially simpler version of the &quot;Recursive Fourier Sampling,&quot; defined in Bernstein and Vazirani's foundational work on quantum complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This problem is attractive for showing a maximal separation between quantum computing and classical computing.  Building on the work Aaronson and Ambainis and others, Raz and Tal showed that, relative to an oracle, forrelation is not in the polynomial hierarchy.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-06T13:58:19.327" LastActivityDate="2019-04-06T13:58:19.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5861" PostTypeId="4" CreationDate="2019-04-06T13:08:13.583" Score="0" Body="For questions related to the &quot;forrelation&quot; problem - given boolean functions f and g, is f correlated with the Fourier transform of g?" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-06T13:58:14.550" LastActivityDate="2019-04-06T13:58:14.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5863" PostTypeId="2" ParentId="5204" CreationDate="2019-04-06T15:08:23.033" Score="1" Body="&lt;p&gt;Initially I'll admit that I find the linked papers to be dense as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, to make some headway, a complete problem in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; can be phrased as &quot;given a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt; instance, does there exist a solution?&quot;  A complete problem in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{coNP}$&lt;/span&gt; is &quot;given &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt; instance, do all inputs satisfy the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt;?  Problems in the polynomial hierarchy &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt; alternate &quot;there exists&quot; with &quot;for alls,&quot; with a constant number of iterations of &lt;span class=&quot;math-container&quot;&gt;$\exists$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\forall$&lt;/span&gt;. For me, the easiest problem in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH}$&lt;/span&gt; to think about is &quot;is there a mate in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; for this board position?&quot; because this is just &quot;does there exist a move by white such that for all moves by black, there is a counter-move by white such that... white wins.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ponder the difficulty of such &lt;span class=&quot;math-container&quot;&gt;$\forall x_1,\exists x_2\cdots$&lt;/span&gt; problems as compared to factoring, which is in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}\cap\mathrm{coNP}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Turning to Recursive Fourier Sampling (RFS), much as in Simon's problem, with RFS we are only given oracle access to a function &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.    However, RFS involves a promise having &lt;em&gt;just such an alternation&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\exists$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\forall$&lt;/span&gt;.  By going up to a small-enough height (number of iterations of &lt;span class=&quot;math-container&quot;&gt;$\exists$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\forall$&lt;/span&gt;,) the problem can be shown to be likely difficult for a classical computer to efficiently solve but definitely easy for a quantum computer to solve.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Comparing RFS to the &quot;forrelation&quot; problem that I think is a little easier to understand but somewhat more difficult to see the connection to &lt;span class=&quot;math-container&quot;&gt;$\forall x_1,\exists x_2\cdots$&lt;/span&gt;.  Forrelation is as simple as asking if, given two black-box (oracle) functions &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, is there a correlation between &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and the Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;?  Here, we can simply Fourier transform &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; and find the inner product with &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Forrelation is likely even &lt;em&gt;completely outside&lt;/em&gt; the polynomial hierarchy.  Here the relation to the &lt;span class=&quot;math-container&quot;&gt;$\forall, \exists$&lt;/span&gt; is less clear to me right now but effectively involves translating a tree of alternating &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND's}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{OR's}$&lt;/span&gt; that are capable of solving forrelation to a sequence of alternating &lt;span class=&quot;math-container&quot;&gt;$\forall$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\exists$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; are simply black-box, without any structure.  As far as I know, we don't know a good instantiation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; &quot;in the real world&quot; yet, with &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and/or &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; have a particular structure.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-04-06T15:08:23.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5864" PostTypeId="1" CreationDate="2019-04-06T16:40:35.753" Score="4" ViewCount="41" Body="&lt;p&gt;On p. 3 of &quot;Separability Probability Formulas and Their Proofs for Generalized Two-Qubit X-Matrices Endowed with Hilbert-Schmidt and Induced Measures&quot; (&lt;a href=&quot;https://arxiv.org/abs/1501.02289&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1501.02289&lt;/a&gt;), it is asserted that the Hilbert-Schmidt separability probabilities for the two-rebit, two-qubit and two-quarter[nionic]-bit X-states are, &lt;span class=&quot;math-container&quot;&gt;$\frac{16}{3 \pi^2}, \frac{2}{5}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{7}$&lt;/span&gt;, respectively. (Of course, by X-states [&lt;a href=&quot;https://arxiv.org/abs/1407.3021]&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1407.3021]&lt;/a&gt;, we mean density matrices having an X-shaped nonzero-zero pattern.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally still, for random induced measure (the case &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt;, corresponding to the Hilbert-Schmidt instance), for the two-qubit X-states, we have, on the same page, the formula&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;1-\frac{2 \Gamma (2 k+4)^2}{\Gamma (k+2) \Gamma (3 k+6)},&#xA;\end{equation}&lt;/span&gt;&#xA;giving the indicated &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{5}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt;, and now &lt;span class=&quot;math-container&quot;&gt;$\frac{9}{14}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt;,...(Also, 0 for &lt;span class=&quot;math-container&quot;&gt;$k=-1$&lt;/span&gt;, we note.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in the abstract and sec. VIII of &quot;Extensions of Generalized Two-Qubit Separability Probability Analyses to Higher Dimensions, Additional Measures and New Methodologies&quot; (&lt;a href=&quot;https://arxiv.org/abs/1809.09040&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1809.09040&lt;/a&gt;), it has been asserted that these same probabilities continue to hold in the X-state cases for the higher-dimensional rebit-retrit, two-retrit, qubit-qutrit, two-qutrit,...cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, on some level this seems counter-intuitive, as the evidence (see previous citation) is that for the (15-dimensional) two-qubit states, in general, the Hilbert-Schmidt separability probability is &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33} \approx 0.242424$&lt;/span&gt; and possibly (certainly much less) &lt;span class=&quot;math-container&quot;&gt;$\frac{27}{1000}$&lt;/span&gt; for the qubit-qutrit states,..., also shrinking to zero, asymptotically (as the various works of Aubrun, Szarek, Ye, et al  indicate). The numerical evidence is certainly of a similar nature for the rebit/retrit counterparts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it would be nice to have some independent examination of the proposition that for the X-states, separability/PPT-probabilities remain invariant as the dimensions of the spaces in which they are embedded increase.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-04-11T12:09:54.240" LastActivityDate="2019-04-11T12:09:54.240" Title="Are X-state separability and PPT- probabilities the same for the two-qubit, qubit-qutrit, two-qutrit, etc. states?" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5865" PostTypeId="1" AcceptedAnswerId="5874" CreationDate="2019-04-06T17:14:46.617" Score="3" ViewCount="84" Body="&lt;p&gt;Say, qubit &lt;span class=&quot;math-container&quot;&gt;$\left|a\right\rangle = \alpha_1|0\rangle + \beta_1|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle = \alpha_2|0\rangle + \beta_2|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\text{SWAP}}$&lt;/span&gt;(a,b) what are new probability amplitudes of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$\alpha_1,\, \alpha_2,\, \beta_1,\, \beta_2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6196" LastEditorUserId="6196" LastEditDate="2019-04-06T20:19:23.330" LastActivityDate="2019-04-08T09:26:54.303" Title="What are the individual probabilities after √SWAP gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5866" PostTypeId="1" AcceptedAnswerId="5880" CreationDate="2019-04-06T19:26:35.020" Score="1" ViewCount="114" Body="&lt;p&gt;I just started working in Qiskit and want to use some of the new functions available to Qiskit on Github. Unfortunately, I don't know how to implement the latest GitHub version into my Anaconda distribution of Python. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anaconda uses an older Qiskit library which I installed using pip. I would now like to git clone the latest version of Qiskit into that location. How can I do this? When I just type &lt;code&gt;git clone https://github.com/Qiskit&lt;/code&gt; or something similar, it doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="5600" LastEditorUserId="26" LastEditDate="2019-04-06T19:52:02.567" LastActivityDate="2019-04-09T13:38:56.770" Title="Using latest (GitHub) version of Qiskit as Python library" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5867" PostTypeId="1" AcceptedAnswerId="5882" CreationDate="2019-04-06T20:31:39.480" Score="2" ViewCount="294" Body="&lt;p&gt;I created a DAG circuit in Qiskit and don't really understand how to see which gate is which. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to call a function like &lt;code&gt;dag_circuit.gate_info(gate_number)&lt;/code&gt;, which will then print, for example, that gate number 9 is a hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, and that gate number 11 is a &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta=0.1,\phi=0.2,\lambda=-0.5)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get this information?&lt;/p&gt;&#xA;" OwnerUserId="5600" LastEditorUserId="23" LastEditDate="2019-04-06T20:45:58.430" LastActivityDate="2019-04-10T13:47:44.373" Title="Qiskit DAG circuit - print information about individual gate/node by number" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5868" PostTypeId="2" ParentId="5865" CreationDate="2019-04-06T21:35:35.177" Score="2" Body="&lt;p&gt;Just apply corresponding &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Square_root_of_Swap_gate_(%E2%88%9ASWAP)&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix&lt;/a&gt; of this gate on the vector &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |a\rangle |b\rangle = \alpha_1\alpha_2|00\rangle + \alpha_1\beta_2|01\rangle + \beta_1\alpha_2|10\rangle + \beta_1\beta_2|11\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in general the resulting state will be entangled. Hence every qubit individually will be in the mixed state.  &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-04-06T21:52:18.790" LastActivityDate="2019-04-06T21:52:18.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5869" PostTypeId="1" AcceptedAnswerId="5884" CreationDate="2019-04-07T09:48:04.077" Score="1" ViewCount="205" Body="&lt;p&gt;I'm trying to define a custom gate for my computations. I decided to copy the structure in one of the files in &lt;code&gt;qiskit.extensions.standard&lt;/code&gt; package. Here is the code of &lt;code&gt;h.py&lt;/code&gt; (Hadamard gate):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# -*- coding: utf-8 -*-&#xA;&#xA;# Copyright 2017, IBM.&#xA;#&#xA;# This source code is licensed under the Apache License, Version 2.0 found in&#xA;# the LICENSE.txt file in the root directory of this source tree.&#xA;&#xA;# pylint: disable=invalid-name&#xA;&#xA;&quot;&quot;&quot;&#xA;Hadamard gate.&#xA;&quot;&quot;&quot;&#xA;from qiskit.circuit import Gate&#xA;from qiskit.circuit import QuantumCircuit&#xA;from qiskit.circuit import InstructionSet&#xA;from qiskit.circuit import QuantumRegister&#xA;from qiskit.qasm import pi&#xA;from qiskit.dagcircuit import DAGCircuit&#xA;from qiskit.extensions.standard import header  # pylint: disable=unused-import&#xA;from qiskit.extensions.standard.u2 import U2Gate&#xA;&#xA;&#xA;class HGate(Gate):&#xA;    &quot;&quot;&quot;Hadamard gate.&quot;&quot;&quot;&#xA;&#xA;    def __init__(self, qubit, circ=None):&#xA;        &quot;&quot;&quot;Create new Hadamard gate.&quot;&quot;&quot;&#xA;        super().__init__(&quot;h&quot;, [], [qubit], circ)&#xA;&#xA;    def _define_decompositions(self):&#xA;        &quot;&quot;&quot;&#xA;        gate h a { u2(0,pi) a; }&#xA;        &quot;&quot;&quot;&#xA;        decomposition = DAGCircuit()&#xA;        q = QuantumRegister(1, &quot;q&quot;)&#xA;        decomposition.add_qreg(q)&#xA;        decomposition.add_basis_element(&quot;u2&quot;, 1, 0, 2)&#xA;        rule = [&#xA;            U2Gate(0, pi, q[0])&#xA;        ]&#xA;        for inst in rule:&#xA;            decomposition.apply_operation_back(inst)&#xA;        self._decompositions = [decomposition]&#xA;&#xA;    def inverse(self):&#xA;        &quot;&quot;&quot;Invert this gate.&quot;&quot;&quot;&#xA;        return self  # self-inverse&#xA;&#xA;    def reapply(self, circ):&#xA;        &quot;&quot;&quot;Reapply this gate to corresponding qubits in circ.&quot;&quot;&quot;&#xA;        self._modifiers(circ.h(self.qargs[0]))&#xA;&#xA;&#xA;def h(self, q):&#xA;    &quot;&quot;&quot;Apply H to q.&quot;&quot;&quot;&#xA;    if isinstance(q, QuantumRegister):&#xA;        instructions = InstructionSet()&#xA;        for j in range(q.size):&#xA;            instructions.add(self.h((q, j)))&#xA;        return instructions&#xA;&#xA;    if isinstance(q, QuantumRegister):&#xA;        instructions = InstructionSet()&#xA;        for j in range(q.size):&#xA;            instructions.add(self.h(q))&#xA;        return instructions&#xA;&#xA;    self._check_qubit(q)&#xA;    return self._attach(HGate(q, self))&#xA;&#xA;&#xA;QuantumCircuit.h = h&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Trying to change the names of the class, the property of &lt;code&gt;QuantumCircuit&lt;/code&gt; and the name string in &lt;code&gt;Gate&lt;/code&gt; constructor results in an exception &lt;code&gt;(name of the gate) is not in the list of basic operations&lt;/code&gt;  if I try to either draw or execute an example circuit containing the gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;&quot;&#xA;[1]-const gate.&#xA;&quot;&quot;&quot;&#xA;from qiskit.circuit import Gate&#xA;from qiskit.circuit import QuantumCircuit&#xA;from qiskit.circuit import InstructionSet&#xA;from qiskit.circuit import QuantumRegister&#xA;from qiskit.qasm import pi&#xA;from qiskit.dagcircuit import DAGCircuit&#xA;from qiskit.extensions.standard import header  # pylint: disable=unused-import&#xA;from qiskit.extensions.standard.u2 import U2Gate&#xA;&#xA;&#xA;class OneConstGate(Gate):&#xA;&#xA;    def __init__(self, qubit, circ=None):&#xA;        super().__init__(&quot;oneconst&quot;, [], [qubit], circ)&#xA;&#xA;    def _define_decompositions(self):&#xA;        decomposition = DAGCircuit()&#xA;        q = QuantumRegister(1, &quot;q&quot;)&#xA;        decomposition.add_qreg(q)&#xA;        decomposition.add_basis_element(&quot;u2&quot;, 1, 0, 2)&#xA;        rule = [&#xA;            U2Gate(0, pi, q[0])&#xA;        ]&#xA;        for inst in rule:&#xA;            decomposition.apply_operation_back(inst)&#xA;        self._decompositions = [decomposition]&#xA;&#xA;    def inverse(self):&#xA;        &quot;&quot;&quot;Invert this gate.&quot;&quot;&quot;&#xA;        return self  # self-inverse&#xA;&#xA;    def reapply(self, circ):&#xA;        &quot;&quot;&quot;Reapply this gate to corresponding qubits in circ.&quot;&quot;&quot;&#xA;        self._modifiers(circ.oneconst(self.qargs[0]))&#xA;&#xA;&#xA;def oneconst(self, q):&#xA;    &quot;&quot;&quot;Apply H to q.&quot;&quot;&quot;&#xA;    if isinstance(q, QuantumRegister):&#xA;        instructions = InstructionSet()&#xA;        for j in range(q.size):&#xA;            instructions.add(self.oneconst((q, j)))&#xA;        return instructions&#xA;&#xA;    if isinstance(q, QuantumRegister):&#xA;        instructions = InstructionSet()&#xA;        for j in range(q.size):&#xA;            instructions.add(self.oneconst(q))&#xA;        return instructions&#xA;&#xA;    self._check_qubit(q)&#xA;    return self._attach(OneConstGate(q, self))&#xA;&#xA;&#xA;QuantumCircuit.oneconst = oneconst&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the example code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;x = QuantumRegister(1, 'x')&#xA;gate = QuantumCircuit(x)&#xA;gate.oneconst(x[0])&#xA;gate.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that I haven't changed any logic yet. Just the names. Did I forgot something?&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Edit (1):&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;I had a look at &lt;code&gt;header.py&lt;/code&gt; code in &lt;code&gt;qiskit.extensions.standard&lt;/code&gt;. Adding these lines of code remove the error on &lt;code&gt;draw&lt;/code&gt; method, but not in &lt;code&gt;execute&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sympy&#xA;from qiskit.circuit import QuantumCircuit&#xA;from qiskit.qasm import _node as node&#xA;&#xA;QuantumCircuit.definitions[&quot;oneconst&quot;] = {&#xA;    &quot;print&quot;: False,&#xA;    &quot;opaque&quot;: False,&#xA;    &quot;n_args&quot;: 0,&#xA;    &quot;n_bits&quot;: 1,&#xA;    &quot;args&quot;: [],&#xA;    &quot;bits&quot;: [&quot;a&quot;],&#xA;    # gate x a { u3(pi,0,pi) a; }&#xA;    &quot;body&quot;: node.GateBody([&#xA;        node.CustomUnitary([&#xA;            node.Id(&quot;u3&quot;, 0, &quot;&quot;),&#xA;            node.ExpressionList([&#xA;                node.Real(sympy.pi),&#xA;                node.Int(0),&#xA;                node.Real(sympy.pi)&#xA;            ]),&#xA;            node.PrimaryList([&#xA;                node.Id(&quot;a&quot;, 0, &quot;&quot;)&#xA;            ])&#xA;        ])&#xA;    ])&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="26" LastEditDate="2019-04-07T10:13:16.300" LastActivityDate="2019-04-09T17:49:56.480" Title="(name of gate) is not in the list of basis operations" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5871" PostTypeId="2" ParentId="5850" CreationDate="2019-04-07T14:37:37.773" Score="2" Body="&lt;p&gt;Well, you can simplify &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H^{\otimes n} O_{f} H^{\otimes n}|0^{n}\rangle =&#xA;H^{\otimes n} 2^{−\frac{n}{2}}\sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x) |x \rangle = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= ~2^{−n}\sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x) \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{x.y}  |y \rangle =&#xA;~2^{−n}\sum_{x \in \mathbb{F}^{n}_{2}}\sum_{y \in \mathbb{F}^{n}_{2}}&#xA;f(x)  (-1)^{x.y}  |y \rangle = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= ~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}}\left(~2^{−\frac{n}{2}}\sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x)  (-1)^{x.y} \right) |y \rangle = &#xA;~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} f′(y\oplus s)|y \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O_{f'} H^{\otimes n} |s\rangle = &#xA;O_{f'} ~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{s.y}|y \rangle =&#xA;~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{s.y}f'(y)|y \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if &lt;span class=&quot;math-container&quot;&gt;$|s\rangle = H^{\otimes n} O_{f′} H^{\otimes n} O_{f} H^{\otimes n} |0\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$ O_{f′} H^{\otimes n} |s\rangle = H^{\otimes n} O_{f} H^{\otimes n} |0\rangle$&lt;/span&gt;.&lt;br&gt;&#xA;Hence it must be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} f′(y\oplus s)|y \rangle = &#xA;~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{s.y}f'(y)|y \rangle ,&#xA;$$&lt;/span&gt; i.e. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f′(y\oplus s) = (-1)^{s.y}f'(y)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, the last equality just can't be true for a general bent &lt;span class=&quot;math-container&quot;&gt;$f'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, because you can deduce &lt;span class=&quot;math-container&quot;&gt;$f'(y)=f'(s)$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$f'$&lt;/span&gt; must be constant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, there is a mistake somewhere. Probably with notations or definitions. A deeper look is needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;.&lt;br&gt;&#xA;Ok, after some digging I found a mistake :) &#xA;Authors of the first paper not quite carefully restated results of the source paper (your second link). In fact, &lt;span class=&quot;math-container&quot;&gt;$f'$&lt;/span&gt; must be a Hadamard transform of the shifted &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, and not a shift of the Hadamard transform of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;! That is, it must be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f'(x) = ~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{x.y}f(y\oplus s)&#xA;$$&lt;/span&gt;&#xA;or, equivalently, by changing &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f'(y) = ~2^{−\frac{n}{2}} \sum_{x \in \mathbb{F}^{n}_{2}} (-1)^{x.y}f(x\oplus s)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this correct &lt;span class=&quot;math-container&quot;&gt;$f'$&lt;/span&gt; we have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}}\left(~2^{−\frac{n}{2}}\sum_{x \in \mathbb{F}^{n}_{2}}&#xA;f(x)  (-1)^{x.y} \right) |y \rangle = &#xA;~2^{−\frac{n}{2}} \sum_{y \in \mathbb{F}^{n}_{2}} (-1)^{y.s}f′(y)|y \rangle&#xA;$$&lt;/span&gt;&#xA;and everything coincides (in the context of my previous calculations).&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-04-07T18:01:42.857" LastActivityDate="2019-04-07T18:01:42.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5872" PostTypeId="2" ParentId="5823" CreationDate="2019-04-07T19:24:27.030" Score="3" Body="&lt;p&gt;&lt;strong&gt;Speculatively expanding on previous answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computers tend to outperform classical computers in determining &lt;em&gt;global&lt;/em&gt; properties of functions.  Further, the properties tend to be some measure of global &lt;em&gt;symmetry&lt;/em&gt;.  Based on the global symmetry, the probability amplitudes can constructively (and destructively) interfere, in ways that a classical computer could not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at chess for a moment.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Deciding a winning position in chess, e.g. a mate, seems very much a &lt;em&gt;local&lt;/em&gt; property of the board.  There may be many pieces left on a board, but many of the pieces are irrelevant to the mating position.  Of course pawn structure is a global property in a way, but pawns and many pieces  (knights/kings/bad-color bishops) only have a local influence.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Chess by its nature is very &lt;em&gt;asymmetric&lt;/em&gt;.  Castling of course is a very asymmetric move, but I also mean, for example, that a bishop behaves significantly differently than a knight or a queen.  A pawn captures differently than it moves.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Let's compare chess to wei-chi/&lt;a href=&quot;https://en.wikipedia.org/wiki/Go_(game)&quot; rel=&quot;nofollow noreferrer&quot;&gt;go&lt;/a&gt;/paduk.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Wei-chi has much more of a &lt;em&gt;global&lt;/em&gt; feel to it than chess.  Each stone can have both a long-range and a short-range impact.  Life and death may hinge on being able to connect to a far-away island.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The rules of wei-chi are much more &lt;em&gt;symmetric&lt;/em&gt;, in a sense that &quot;all stones are born equal.&quot;  There are &lt;em&gt;some&lt;/em&gt; asymmetries, of course, such as the ko rule.  The edge-of-the-board is different than the center, which is a bit of asymmetry; however, there's nothing quite like the dramatic difference in strength between a queen and a knight or a pawn.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Ignoring such ko-rule asymmetries for now, let's let &lt;strong&gt;black&lt;/strong&gt; be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;strong&gt;white&lt;/strong&gt; be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1,blank\}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$f(x_1^1,x_1^2,\cdots,x_1^{19},\cdots,x_{19}^{19})$&lt;/span&gt; be a function that takes a &lt;span class=&quot;math-container&quot;&gt;$19\times 19$&lt;/span&gt; wei-chi board (e.g., a board after two consecutive passes), and returns whether white or black or neither has more claimed territory.  I'm pretty sure &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is not that difficult to calculate, at least to a first level.  Once black places the first stone, we can ask the same about the new board position with a new function &lt;span class=&quot;math-container&quot;&gt;$f^1$&lt;/span&gt;, and so on.  Here &lt;span class=&quot;math-container&quot;&gt;$f^1$&lt;/span&gt; is just like &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; but one of the values of one of the &lt;span class=&quot;math-container&quot;&gt;$x^i_j$&lt;/span&gt; has been fixed to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speculatively, a quantum computer &lt;em&gt;may&lt;/em&gt; be able to answer such a global property of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; as &quot;is there a move for black, such that for all moves by white, there's a countermove by black, such that... black ends up with more territory?&quot;  With the placement of each of the stones, it feels like maybe there's constructive/destructive interference at work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speculating very much even more, perhaps we &lt;em&gt;can&lt;/em&gt; construct a toy &quot;battleship-style&quot; or &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Kriegspiel_(chess)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kiregspiel&lt;/a&gt;&quot; style wei-chi game, where white &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and black &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; take turns placing stones secretly on their respective board, and the value of the board is determined by a measure of the correlation between &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and the Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;.  We &lt;em&gt;know&lt;/em&gt; a quantum computer is likely to outperform a classical computer for such a &quot;forrelation&quot; game; working backwards to create rules for such a game may be possible.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-08T18:03:05.163" LastActivityDate="2019-04-08T18:03:05.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5873" PostTypeId="2" ParentId="5850" CreationDate="2019-04-08T05:52:28.720" Score="6" Body="&lt;p&gt;Your calculations are correct, however, there are two issues: first, note that the promise on the dual bent function is actually not &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;f^\prime(x\oplus s) = 2^{-\frac{n}{2}} \sum_{y \in \mathbb{F}_2^n} (-1)^{xy} f(y) , \; \forall x \in \mathbb{F}_2^n&#xA;$$&lt;/span&gt;&#xA;as stated. Instead you really want to define here the dual as in my paper &lt;a href=&quot;https://arxiv.org/abs/0811.3208&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/0811.3208&lt;/a&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f^\prime(x) = 2^{-\frac{n}{2}} \sum_{y \in \mathbb{F}_2^n} (-1)^{xy} f(y) , \; \forall x \in \mathbb{F}_2^n.&#xA;$$&lt;/span&gt;&#xA;Note that the definition of the dual is independent of the hidden shift &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second issue is that in your calculation &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n} {\cal O}_{f^\prime} H^{\otimes n} {\cal O}_{f} H^{\otimes n} |0\rangle$&lt;/span&gt; you used the unshifted version of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. Hence, the outcome is the shift &lt;span class=&quot;math-container&quot;&gt;$s=(0,\ldots,0)$&lt;/span&gt;, corresponding to the unshifted function (which is a perfectly valid input to the problem of course). Indeed, your second to last line can be simplified to &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H^{\otimes n} 2^{-n/2} \sum_{y \in \mathbb{F}_2^n} f^\prime(y) f^\prime(y) |y\rangle = &#xA;H^{\otimes n} 2^{-n/2} \sum_{y \in \mathbb{F}_2^n} |y\rangle = |0 \ldots 0\rangle, &#xA;$$&lt;/span&gt;&#xA;as it should be for hidden shift &lt;span class=&quot;math-container&quot;&gt;$s=(0,\ldots, 0)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a general hidden shift &lt;span class=&quot;math-container&quot;&gt;$s\in \mathbb{F}_2^n$&lt;/span&gt;, the calculation is as follows. Denote by &lt;span class=&quot;math-container&quot;&gt;$g(x) = f(x\oplus s)$&lt;/span&gt;. Then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; H^{\otimes n} {\cal O}_{f^\prime} H^{\otimes n} {\cal O}_{g} H^{\otimes n} |0\rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=  H^{\otimes n} {\cal O}_{f^\prime} H^{\otimes n} 2^{-n/2} \sum_{x\in \mathbb{F}_2^n} f(x\oplus s)|x\rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=  H^{\otimes n} {\cal O}_{f^\prime} 2^{-n} \sum_{y \in \mathbb{F}_2^n} \left( &#xA;\sum_{x \in \mathbb{F}_2^n} (-1)^{xy} f(x\oplus s) \right) |y \rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= H^{\otimes n} {\cal O}_{f^\prime} 2^{-n} \sum_{y \in \mathbb{F}_2^n} (-1)^{ys} \left( &#xA;\sum_{x \in \mathbb{F}_2^n} (-1)^{xy} f(x) \right) |y \rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=  H^{\otimes n} {\cal O}_{f^\prime} 2^{-n/2} \sum_{y \in \mathbb{F}_2^n} (-1)^{ys} f^\prime(y) |y\rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=  H^{\otimes n} 2^{-n/2} \sum_{y \in \mathbb{F}_2^n} (-1)^{ys} f^\prime(y) f^\prime(y) |y\rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=  H^{\otimes n} 2^{-n/2} \sum_{y \in \mathbb{F}_2^n} (-1)^{ys} |y\rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=  |s\rangle,  &#xA;$$&lt;/span&gt;&#xA;as desired. &lt;/p&gt;&#xA;" OwnerUserId="1828" LastActivityDate="2019-04-08T05:52:28.720" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5874" PostTypeId="2" ParentId="5865" CreationDate="2019-04-08T07:08:45.177" Score="4" Body="&lt;p&gt;The overall state of the input is &lt;span class=&quot;math-container&quot;&gt;$|a\rangle|b\rangle$&lt;/span&gt;, which we can represent as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{c} \alpha_1\alpha_2 \\ \alpha_1\beta_2 \\ \beta_1\alpha_2 \\ \beta_1\beta_2 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;We apply the square root of swap gate (note that there are different ways that this matrix could be written ),&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{\text{SWAP}}=\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0                    &amp;amp; 0                    &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\pi/4}/\sqrt{2}  &amp;amp; e^{-i\pi/4}/\sqrt{2} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{-i\pi/4}/\sqrt{2} &amp;amp; e^{i\pi/4}/\sqrt{2}  &amp;amp; 0 \\&#xA;0 &amp;amp; 0                    &amp;amp; 0                    &amp;amp; 1&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Hence, we're after the calculation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\pi/4}/\sqrt{2} &amp;amp; e^{-i\pi/4}/\sqrt{2} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{-i\pi/4}/\sqrt{2} &amp;amp; e^{i\pi/4}/\sqrt{2} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)\left(\begin{array}{c} \alpha_1\alpha_2 \\ \alpha_1\beta_2 \\ \beta_1\alpha_2 \\ \beta_2\beta_2 \end{array}\right)=\left(\begin{array}{c}&#xA;\alpha_1\alpha_2 \\ e^{i\pi/4}(\alpha_1\beta_2-i\beta_1\alpha_2)/\sqrt{2} \\ e^{-i\pi/4}(\alpha_1\beta_2+i\beta_1\alpha_2)/\sqrt{2} \\ \beta_1\beta_2&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Converting this back to Dirac notation gives us the final answer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha_1\alpha_2|00\rangle+\frac{e^{i\pi/4}}{\sqrt{2}}(\alpha_1\beta_2-i\beta_1\alpha_2)|01\rangle+ \frac{e^{-i\pi/4}}{\sqrt{2}}(\alpha_1\beta_2+i\beta_1\alpha_2)|10\rangle+\beta_1\beta_2|11\rangle.&#xA;$$&lt;/span&gt;&#xA;Note that the probability amplitudes of each term are joint probability amplitudes of the whole system. As a general rule, you cannot separate this state into (state of a)&lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt;(state of b), and therefore cannot identify individual probability amplitudes for each system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps I could also suggest a bit of a notational change? If you want to refer to the two qubits as &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, do not also refer to the states of the two qubits as &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;, as that's only likely to lead to confusion when the states change.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="5791" LastEditDate="2019-04-08T09:26:54.303" LastActivityDate="2019-04-08T09:26:54.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5875" PostTypeId="1" CreationDate="2019-04-08T07:53:02.563" Score="1" ViewCount="63" Body="&lt;p&gt;Suppose we have a matrix &lt;span class=&quot;math-container&quot;&gt;$A=\begin{bmatrix}&#xA;2 &amp;amp;4 \\&#xA;1 &amp;amp;  4\\&#xA;\end{bmatrix}$&lt;/span&gt;, when applying the discrete wavelet transform to this matrix we get 4 parts i.e smooth part (&lt;span class=&quot;math-container&quot;&gt;$1\times 1$&lt;/span&gt;) matrix, 3 detail parts each of them being (&lt;span class=&quot;math-container&quot;&gt;$1\times 1$&lt;/span&gt;) matrices. Is there any quantum transformation that performs this task? Can somebody suggest? Is it in some way related to Fourier Transformation?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-08T13:13:29.873" LastActivityDate="2019-04-09T02:36:22.660" Title="Quantum transformation equivalent to Discrete Wavelet transform" Tags="&lt;algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5876" PostTypeId="2" ParentId="5839" CreationDate="2019-04-08T17:44:53.283" Score="6" Body="&lt;p&gt;Such an example is given in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804053&quot; rel=&quot;noreferrer&quot;&gt;Bennett &lt;em&gt;et al.&lt;/em&gt;, Quantum Nonlocality without Entanglement&lt;/a&gt;, &lt;a href=&quot;https://dx.doi.org/10.1103/PhysRevA.59.1070&quot; rel=&quot;noreferrer&quot;&gt;Phys. Rev. A. 59, 1070 (1999)&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="1764" LastEditDate="2019-04-08T19:36:33.237" LastActivityDate="2019-04-08T19:36:33.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5877" PostTypeId="1" AcceptedAnswerId="5878" CreationDate="2019-04-08T20:19:02.213" Score="3" ViewCount="67" Body="&lt;p&gt;When initially writing an &lt;code&gt;operator&lt;/code&gt; in Q#, I often want to see intermediate values of registers during the computation. This allows me to check that I haven't made mistakes. For example, if I was writing an addition circuit I would input a computational basis state and print out the computational basis states of qubits at particular key points.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not aware of a way to do this conveniently. If I print out the qubits like &lt;code&gt;Message($&quot;{qubit}&quot;)&lt;/code&gt; then I get their IDs instead of their values. That makes sense. I have to do a measurement to access their value. But if I do a measurement, then Q# will e.g. not automatically generate an adjoint operation and this tends to cause compilation failures. Also, I don't actually want to perform a measurement (which may have side effects) I just want to peek at the simulator state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I originally thought I could package the concept of &quot;peeking&quot; at a value into an operation that did a hidden measurement, which would have resolved the issue. But Q# doesn't allow operations with an adjoint to have a return type.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some built-in way to get at the computational basis value of some qubits, and print it to the console during simulation under the Toffoli simulator?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-04-08T20:41:46.080" LastActivityDate="2019-04-09T01:14:14.523" Title="How do I do printf debugging in Q# in a convenient way?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5878" PostTypeId="2" ParentId="5877" CreationDate="2019-04-09T01:14:14.523" Score="4" Body="&lt;p&gt;For Toffoli simulator in particular, &lt;code&gt;DumpRegister&lt;/code&gt; will provide this information. For example, the following code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation XorTest() : Bool {&#xA;    using ((a, b) = (Qubit[2], Qubit[2])) {&#xA;        // initialize: a = 1, b = 2&#xA;        ApplyPauli([PauliI, PauliX], a);&#xA;        ApplyPauli([PauliX, PauliI], b);&#xA;        // check initialization&#xA;        Message(&quot;a = &quot;);&#xA;        DumpRegister((), a);&#xA;        Message(&quot;b = &quot;);&#xA;        DumpRegister((), b);&#xA;        // calculate a ⊕ b and write it to b&#xA;        CNOT(a[0], b[0]);&#xA;        CNOT(a[1], b[1]);&#xA;        // check result: a ⊕ b = 3&#xA;        Message(&quot;a xor b = &quot;);&#xA;        DumpRegister((), b);&#xA;    }&#xA;    return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will print the following result (and throw an exception in the end because the qubits are released not in zero state):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;a =&#xA;State:&#xA;0:      False&#xA;1:      True&#xA;b =&#xA;State:&#xA;2:      True&#xA;3:      False&#xA;a xor b =&#xA;State:&#xA;2:      True&#xA;3:      True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The numbers before values are qubit ids.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-04-09T01:14:14.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5879" PostTypeId="2" ParentId="5875" CreationDate="2019-04-09T02:36:22.660" Score="2" Body="&lt;p&gt;This &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9909014&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; by Andreas Klappenecker might be a good starting point. The paper spearheaded quantum wavelet transforms and so-called wavelet packet transforms. A wavelet packet transforms yields an iterated decomposition into high-pass and low-pass filtered signals, whereas a wavelet transform only further decomposes the low-pass filtered and down-scaled version of the signal. &lt;/p&gt;&#xA;" OwnerUserId="1828" LastActivityDate="2019-04-09T02:36:22.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5880" PostTypeId="2" ParentId="5866" CreationDate="2019-04-09T13:38:56.770" Score="3" Body="&lt;p&gt;Yes, installing Qiskit through &lt;code&gt;pip install&lt;/code&gt; will install the latest, stable version of Qiskit onto your environment. So do note, the version you want to clone may not be functional with existing Jupyter Notebooks and other tutorials, since the code is not yet officially released.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, cloning the repo is very easy. The URL that you were trying to clone, &lt;code&gt;https://github.com/Qiskit&lt;/code&gt;, is the Qiskit Github user account page. That is why you were receiving an error. The repo that you are looking to clone would be &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;qiskit-terra&quot;&gt;qiskit-terra&lt;/a&gt;. Once you are there, you can follow this &lt;a href=&quot;https://help.github.com/en/articles/cloning-a-repository&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;article on cloning github repositories&quot;&gt;article on cloning github repositories&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have cloned the repo, you can follow this &lt;a href=&quot;https://qiskit.org/documentation/install/terra.html#install-terra-source,&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;guide&quot;&gt;guide&lt;/a&gt; on how to install Qiskit Terra from the source code you just cloned.  &lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-04-09T13:38:56.770" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5881" PostTypeId="1" CreationDate="2019-04-09T14:35:53.153" Score="4" ViewCount="232" Body="&lt;p&gt;How many qubits and what is the minimum number of gate operations needed to factor an n-bit integer? Are there any other published algorithms that are simpler or more efficient?&lt;/p&gt;&#xA;" OwnerUserId="6109" LastEditorUserId="55" LastEditDate="2019-04-10T09:50:35.340" LastActivityDate="2019-04-27T01:56:40.650" Title="Are there any other published quantum factoring algorithms that are simpler or more efficient than Shor’s?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5882" PostTypeId="2" ParentId="5867" CreationDate="2019-04-09T14:37:11.420" Score="3" Body="&lt;p&gt;&lt;strong&gt;NOTE: At the moment this method is correct, however, this information might be out of date once the 0.9 release of Qiskit is deployed.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi Samuel, if you have a dag circuit and you want to access information about the nodes, you need to call &lt;code&gt;dag_circuit.multi_graph.nodes[index_of_node]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The information you can get from a node in the circuit is a dictionary containing the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;type (either &quot;in&quot;, &quot;out&quot;, or &quot;op&quot;)&lt;/li&gt;&#xA;&lt;li&gt;name (either a qubit, classical bit, or an operation name)&lt;/li&gt;&#xA;&lt;li&gt;wire (the Register Object of the qubit or classical bit that the wire is attached to)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;An &quot;op&quot; node will will have these other values in addition to the ones above (excluding the &quot;wire&quot; value):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;'op' (The data type of the operation)&lt;/li&gt;&#xA;&lt;li&gt;qargs (The qubits this gate is applied to)&lt;/li&gt;&#xA;&lt;li&gt;cargs (The classical bits this gate is applied to)&lt;/li&gt;&#xA;&lt;li&gt;condition&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In your example where you have an &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; Gate at node 9 and a &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta=0.1, \phi=0.2, \lambda=-0.5)$&lt;/span&gt; Gate at node 11, if you were to call &lt;code&gt;print(dag_circuit.multi_graph.nodes[8])&lt;/code&gt; and &lt;code&gt;print(dag_circuit.multi_graph.nodes[10])&lt;/code&gt;, you would receive the following output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{'type': 'op', 'op': &amp;lt;qiskit.extensions.standard.h.HGate object at &quot;some_memory_address&quot;&amp;gt;, 'name': 'h', 'qargs': [(QuantumRegister(1, 'q'), 0)], 'cargs': [], 'condition': None}&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;{'type': 'op', 'op': &amp;lt;qiskit.extensions.standard.u3.U3Gate object at &quot;some_memory_address&quot;&amp;gt;, 'name': 'u3', 'qargs': [(QuantumRegister(1, 'q'), 0)], 'cargs': [], 'condition': None}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6180" LastEditorUserId="6180" LastEditDate="2019-04-10T13:47:44.373" LastActivityDate="2019-04-10T13:47:44.373" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5883" PostTypeId="1" CreationDate="2019-04-09T17:33:29.290" Score="1" ViewCount="92" Body="&lt;p&gt;I am trying to run the code of the notebook example &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/aqua/artificial_intelligence/qsvm_kernel_classification.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;aqua/artificial_intelligence/qsvm_kernel_classification.ipynb&lt;/a&gt;. I save it in a python file and I have an exception at runtime the display of &lt;code&gt;{'A': 0, 'B': 1}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;xception ignored in: &amp;lt;bound method Image.__del__ of &amp;lt;tkinter.PhotoImage object at 0x7f78a3b23d30&amp;gt;&amp;gt;&#xA;Traceback (most recent call last):&#xA;  File &quot;/home/.../anaconda3/lib/python3.6/tkinter/__init__.py&quot;, line 3501, in __del__&#xA;    self.tk.call('image', 'delete', self.name)&#xA;RuntimeError: main thread is not in main loop&#xA;Tcl_AsyncDelete: async handler deleted by the wrong thread&#xA;Abandon (core dumped)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The classical example worked fine: I don't see what I am doing wrong.&lt;/p&gt;&#xA;" OwnerUserId="6216" LastEditorUserId="26" LastEditDate="2019-04-09T22:12:28.700" LastActivityDate="2019-04-10T18:39:02.350" Title="Exception encountered while running quantum-enhanced support vector machines" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5884" PostTypeId="2" ParentId="5869" CreationDate="2019-04-09T17:49:56.480" Score="3" Body="&lt;p&gt;Did you add these lines to the file &lt;code&gt;qiskit/extensions/standard/__init__.py&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;from .oneconst import oneconst&lt;/code&gt;&lt;br&gt;&#xA;&lt;code&gt;from .oneconst import OneConstGate&lt;/code&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did everything you described doing, as well as added those lines to &lt;code&gt;__init__.py&lt;/code&gt; and the following code ran without error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute&#xA;from qiskit import Aer&#xA;&#xA;qr = QuantumRegister(1)&#xA;cr = ClassicalRegister(1)&#xA;gate = QuantumCircuit(qr, cr)&#xA;gate.oneconst(qr[0])&#xA;gate.measure(qr[0], cr[0])&#xA;print(gate.draw())&#xA;&#xA;backend = Aer.get_backend(&quot;qasm_simulator&quot;)&#xA;&#xA;job = execute(gate, backend, shots=100)&#xA;&#xA;print(job.result().get_counts(gate))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-04-09T17:49:56.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5885" PostTypeId="2" ParentId="5881" CreationDate="2019-04-09T18:09:07.810" Score="4" Body="&lt;p&gt;Shor's algorithm is based on the &lt;em&gt;gate&lt;/em&gt; model of quantum computation.  However, there are alternatives to the gate model, such as quantum walks, etc.  See all of the answers to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/74/what-are-the-models-of-quantum-computation&quot;&gt;this question&lt;/a&gt; for a nice summary of the different models of computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to what I believe to be the implicit question &quot;is Shor's the only known quantum factoring algorithm, or are there alternatives that use fewer qubits and/or fewer gate operations?&quot; I refer you to &quot;A Quantum Adiabatic Algorithm for Factorization and Its Experimental Implementation&quot; (&lt;a href=&quot;https://arxiv.org/abs/0808.1935&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;) by Peng, Liao, Xu, Zhou, Suter, and Du.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adiabatic factoring algorithm paper notes that factoring can be recast as an &lt;em&gt;optimization&lt;/em&gt; problem.  More specifically, the adiabatic algorithm notes that in order to factor a number &lt;span class=&quot;math-container&quot;&gt;$N=p\times q$&lt;/span&gt;, it suffices to find an &lt;span class=&quot;math-container&quot;&gt;$(x,y)\in\mathbb{N}^2$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x,y)=(N-xy)^2$&lt;/span&gt; obtains a minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper describes the preparation of a Hamiltonian whose lowest energy corresponds to this minimum.  The first paragraph of the second page of the paper compares the qubit count of the adiabatic algorithm somewhat favorably to that of Shor's.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the adiabatic algorithm evolves adiabatically to the ground state, it does not really make sense to talk about the &quot;total number&quot; of gate operations; rather it makes more sense to talk about the length of time the adiabatic evolution takes. As I understand, the runtime of such adiabatic algorithms are notoriously difficult to describe exactly/analytically, or even to a first order, being based on the spectral gap of the problem Hamiltonian.  So we may be left with only numerical simulations.  That is, unlike counting gates in the gate model, in general it's very difficult (nay undecidable) to know how long the adiabatic evolution takes, but the paper claims that numerical simulations indicate that the running time (evolution time) grows only quadratically with the number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, to answer the questions, there are other quantum factoring algorithms that don't require the same repeated squaring/QFT/classical post-processing of Shor's algorithm, and that uses fewer qubits.  The runtime may also grow polynomially as in s algorithm, but proving that the runtime is quadratic or even polynomial in the number of qubits (bits of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) is difficult.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-27T01:56:40.650" LastActivityDate="2019-04-27T01:56:40.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5886" PostTypeId="1" AcceptedAnswerId="5887" CreationDate="2019-04-09T23:15:44.357" Score="2" ViewCount="83" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be a unitary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit transformation that applies a Hadamard on the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th qubit and the identity on all the others. How would I go about calculating &lt;span class=&quot;math-container&quot;&gt;$U_{ij}=\langle i | U | j \rangle$&lt;/span&gt; in polynomial time? Calculating all of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not feasible in polynomial time as it is a &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; matrix. &lt;/p&gt;&#xA;" OwnerUserId="5816" LastEditorUserId="26" LastEditDate="2019-04-10T05:22:32.863" LastActivityDate="2019-04-10T06:31:54.457" Title="Calculating entries of unitary transformation" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5887" PostTypeId="2" ParentId="5886" CreationDate="2019-04-10T06:31:54.457" Score="3" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; are from computational basis, then we can write &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = I \otimes I ~\otimes ... \otimes ~H ~\otimes ... \otimes ~ I \otimes I &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle i | = \langle i_1| \otimes \langle i_2| ~\otimes ... \otimes ~\langle i_k| ~\otimes ... \otimes ~ \langle i_{n-1}| \otimes \langle i_n| &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|j \rangle = |j_1\rangle \otimes |j_2\rangle ~\otimes ... \otimes ~ |j_k\rangle ~\otimes ... \otimes ~ | j_{n-1}\rangle \otimes | j_n\rangle &#xA;$$&lt;/span&gt;&#xA;where every &lt;span class=&quot;math-container&quot;&gt;$i_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j_x$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the product &lt;span class=&quot;math-container&quot;&gt;$\langle i | U | j \rangle$&lt;/span&gt; will be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle i | U | j \rangle = \langle i_1| j_1\rangle \otimes \langle i_2| j_2\rangle~\otimes ... \otimes ~\langle i_k|H|j_k\rangle ~\otimes ... \otimes ~ \langle i_{n-1}| j_{n-1}\rangle\otimes \langle i_n|j_n\rangle = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \langle i_1| j_1\rangle \cdot \langle i_2| j_2\rangle~\cdot ... \cdot ~\langle i_k|H|j_k\rangle ~\cdot ... \cdot ~ \langle i_{n-1}| j_{n-1}\rangle\cdot \langle i_n|j_n\rangle  &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \delta_{i_1j_1} \cdot \delta_{i_2j_2}~\cdot ... \cdot ~\langle i_k|H|j_k\rangle ~\cdot ... \cdot ~ \delta_{i_{n-1}j_{n-1}}\cdot \delta_{i_nj_n}  &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\delta_{i_xj_x} = 1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i_x = j_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; otherwise.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; are not from computational basis, then it's impossible to compute it that fast, because you need exponential number of parameters just to define &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-04-10T06:31:54.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5888" PostTypeId="2" ParentId="5837" CreationDate="2019-04-10T11:55:11.493" Score="4" Body="&lt;p&gt;The idea behind this expression is indeed a fairly general one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{\boldsymbol{#1}}\newcommand{\calS}{\mathcal{S}}$&lt;/span&gt;An entanglement witness &lt;span class=&quot;math-container&quot;&gt;$\mathcal W$&lt;/span&gt; is defined as an operator such that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\mathcal W\rho)\ge0$&lt;/span&gt; for all separable &lt;span class=&quot;math-container&quot;&gt;$\rho\in\mathcal S$&lt;/span&gt;, while for some entangled &lt;span class=&quot;math-container&quot;&gt;$\rho_{ent}$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\mathcal W\rho_{ent})&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Geometrically, this definition is very easily understood as saying that &lt;span class=&quot;math-container&quot;&gt;$\mathcal W$&lt;/span&gt; defines a &lt;em&gt;hyperplane&lt;/em&gt; in the space of states that separates the separable states from the non-separable ones. Because of the convexity of the space of separable states, any non-separable state can be separated by such an operator (see e.g. (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0702225&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horodecki 2007&lt;/a&gt;) or (&lt;a href=&quot;https://arxiv.org/abs/0811.2803&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gühne 2008&lt;/a&gt;)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now forget for a second about states and quantum mechanics. Let &lt;span class=&quot;math-container&quot;&gt;$\calS$&lt;/span&gt; denote a convex subset of &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^n$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$ v\notin \calS$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$ v_0\in\calS$&lt;/span&gt; be the vector in &lt;span class=&quot;math-container&quot;&gt;$\calS$&lt;/span&gt; that is the closest to &lt;span class=&quot;math-container&quot;&gt;$ v$&lt;/span&gt; (in standard euclidean distance).&#xA;This means that the line (or more generally hyperplane) that is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$ v- v_0$&lt;/span&gt; and touches &lt;span class=&quot;math-container&quot;&gt;$ v_0$&lt;/span&gt; is &lt;em&gt;tangent&lt;/em&gt; to &lt;span class=&quot;math-container&quot;&gt;$\calS$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$ v_0$&lt;/span&gt;. Such a &quot;line&quot; is an &quot;optimal&quot; linear separation between &lt;span class=&quot;math-container&quot;&gt;$\calS$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ v$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1BG3U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1BG3U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now simply need to define an operator that tells us on which side of such separation we are in. A natural candidate would be an operator which projects a candidate vector &lt;span class=&quot;math-container&quot;&gt;$ w$&lt;/span&gt; on the line &lt;span class=&quot;math-container&quot;&gt;$ v- v_0$&lt;/span&gt;, or, more precisely, an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; defined via&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A w\equiv\langle  v- v_0, w- v_0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, we then have &lt;span class=&quot;math-container&quot;&gt;$A v&amp;gt;0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$A v_0=0$&lt;/span&gt;, while all vectors in &lt;span class=&quot;math-container&quot;&gt;$\calS$&lt;/span&gt; (together with the points on the &lt;span class=&quot;math-container&quot;&gt;$\calS$&lt;/span&gt; side of the separation) correspond to &lt;span class=&quot;math-container&quot;&gt;$Aw&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain the given expression for the witness you now simply change the sign (because we conventionally define witnesses to be &lt;em&gt;positive&lt;/em&gt; on the separable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$A_{opt} w=\langle v- v_0, v_0- w\rangle$&lt;/span&gt;, that corresponds to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A_{opt}=( v_0^*-v^*)-\langle v_0, v_0-v\rangle I.$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$v^*$&lt;/span&gt; denotes the linear functional &lt;span class=&quot;math-container&quot;&gt;$v^*(w)\equiv \langle v,w\rangle$&lt;/span&gt; (or, if you prefer, the bra &lt;span class=&quot;math-container&quot;&gt;$\langle v\rvert$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get to the expression given in the paper you now just add a normalisation factor, which I guess was added to make something simpler later on in the paper.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-04-10T11:55:11.493" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5889" PostTypeId="2" ParentId="5836" CreationDate="2019-04-10T14:15:03.053" Score="5" Body="&lt;p&gt;These are not really the definitions of classical and quantum capacity, as I will explain. Before doing that, let me adjust the notation being used slightly: let &lt;span class=&quot;math-container&quot;&gt;$\Phi:\text{L}(\mathcal{X}) \rightarrow \text{L}(\mathcal{Y})$&lt;/span&gt; be the channel whose capacities we are interested in and let &lt;span class=&quot;math-container&quot;&gt;$\Psi:\text{L}(\mathcal{X}) \rightarrow \text{L}(\mathcal{Z})$&lt;/span&gt; be a channel that is complementary to &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we define the &lt;em&gt;coherent information&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; with respect to a state &lt;span class=&quot;math-container&quot;&gt;$\rho \in \text{D}(\mathcal{X})$&lt;/span&gt; like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{I}_\text{C}(\rho;\Phi) = \text{S}(\Phi(\rho)) - \text{S}(\Psi(\rho)).&#xA;$$&lt;/span&gt;&#xA;(This value is the same for all choices of a complementary channel &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;.)&#xA;We then define the &lt;em&gt;maximum coherent information&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; by maximizing over all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{I}_\text{C}(\Phi) = \max_{\rho\in\text{D}(\mathcal{X})} \text{I}_\text{C}(\rho;\Phi).&#xA;$$&lt;/span&gt;&#xA;This is equivalent to the expression written in the second equation of the question. (In particular, the supremum is taken over a compact set and the coherent information is continuous, so we can safely replace it by a maximum.) It is not, however, equal to the quantum capacity in general; the quantum capacity is defined in a completely different, operationally motivated way that I won't explain in this answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is, however, a &lt;em&gt;theorem&lt;/em&gt; that connects the two quantities, known alternatively as the &lt;em&gt;quantum capacity theorem&lt;/em&gt; or the &lt;em&gt;LSD theorem&lt;/em&gt; (named after Lloyd, Shor, and Devetak). The theorem states that the quantum capacity is given by this expression:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Q}(\Phi) = \lim_{n\rightarrow\infty} \frac{\text{I}_{\text{C}}(\Phi^{\otimes n})}{n}.&#xA;$$&lt;/span&gt;&#xA;This is a &lt;em&gt;regularization&lt;/em&gt; of the maximum coherent information, and in general the regularization is requied. There are examples of channels, however, including all so-called &lt;em&gt;degradable channels&lt;/em&gt;, for which the regularization is not required and we have &lt;span class=&quot;math-container&quot;&gt;$\text{Q}(\Phi) = \text{I}_{\text{C}}(\Phi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other quantity under consideration is the &lt;em&gt;entanglement assisted classical capacity&lt;/em&gt;. Again this quantity is defined in a different, operationally motivated way, but this time there is a theorem that characterizes this quantity perfectly:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{C}_{\text{E}}(\Phi) = \max_{\rho\in\text{D}(\mathcal{X})}&#xA;\Bigl( \text{I}_\text{C}(\rho;\Phi) + \text{S}(\rho) \Bigr).&#xA;$$&lt;/span&gt;&#xA;This theorem is sometimes called the &lt;em&gt;entanglement assisted classical capacity theorem&lt;/em&gt;, and it was proved by Bennett, Shor, Smolin, and Thapliyal. It is a rare example in quantum Shannon theory where the characterization of a channel capacity does not require a regularization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In both cases, it is helpful to see the theorems as being quantum analogues of Shannon's noisy channel coding theorem. The states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; that achieve the maximum values should really not be thought of so much as actual states that are sent through the channels, but &quot;suggestions&quot; for codes that stretch across multiple independent uses of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;. It is true, as the question suggests, that the values of these expressions are both zero for pure states, but the codes that these states suggest are effectively trivial and useless for transmitting information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proofs of both theorems are rather difficult. There are intuitive ways of thinking about the different expressions, but I don't think it is healthy to think about the term &lt;span class=&quot;math-container&quot;&gt;$\text{S}(\rho)$&lt;/span&gt; as arising from something classical and disappearing in the quantum case. It is immediate from the definitions that the entanglement assisted classical capacity should be at least as large as the quantum capacity, but because one of these capacities is an entanglement assisted notion and the other is not, we are comparing apples with oranges to some extent. The &lt;em&gt;entanglement assisted quantum capacity&lt;/em&gt;, for instance, is always exactly half the entanglement assisted classical capacity (and that is probably why people don't bother talking about it).&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2019-04-11T13:12:34.727" LastActivityDate="2019-04-11T13:12:34.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5890" PostTypeId="2" ParentId="1918" CreationDate="2019-04-10T15:10:41.833" Score="2" Body="&lt;p&gt;Since this question is still open, I thought I'd share a great paper by professor Pete Wittek titled &lt;a href=&quot;https://arxiv.org/abs/1812.09167&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Open Source Software in Quantum Computing&lt;/em&gt;&lt;/a&gt;. Dr. Wittek has compiled a list of some open-source quantum computing projects with evaluations based on criteria such as documentation, license, etc. Dr. Wittek also provides a sort of call-to-action to get more people involved in advancing the quantum software stack &lt;/p&gt;&#xA;" OwnerUserId="5481" LastEditorUserId="5481" LastEditDate="2019-04-11T05:15:57.960" LastActivityDate="2019-04-11T05:15:57.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5891" PostTypeId="1" AcceptedAnswerId="5896" CreationDate="2019-04-10T17:16:28.963" Score="3" ViewCount="387" Body="&lt;p&gt;Which of the following sets of gates are universal for quantum computation?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;{H, T, CPHASE}&lt;/li&gt;&#xA;&lt;li&gt;{H, T, SWAP}&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And how do we prove it?&lt;/p&gt;&#xA;" OwnerUserId="6224" LastEditorUserId="26" LastEditDate="2019-04-10T20:05:21.903" LastActivityDate="2019-04-12T06:07:29.427" Title="How to prove universality for a set of gates?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5895" PostTypeId="1" CreationDate="2019-04-11T02:18:53.060" Score="5" ViewCount="123" Body="&lt;p&gt;How would I be able to graph the decoherence of qubits being used to perform an algorithm? I'm working with the IBMQ Qiskit framework and I'm trying to write a program that allows me to find the decoherence of qubits. But I do not know if IBMQ has a method to do that. Can anyone help me, or point me the right direction to implement such a thing?&lt;/p&gt;&#xA;" OwnerUserId="3043" LastEditorUserId="26" LastEditDate="2019-04-11T12:16:54.533" LastActivityDate="2020-08-15T01:58:59.310" Title="Graphing the decoherence of qubits being used to perform an algorithm" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;decoherence&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5896" PostTypeId="2" ParentId="5891" CreationDate="2019-04-11T07:21:30.140" Score="4" Body="&lt;p&gt;You can prove that one gate set is universal by showing how to construct another universal gate set out of it. For example, we know that {H, T, cNOT} is universal, so can you find a way of making cNOT out of {H, T, CPHASE}? (Hint: Yes)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the best way to prove that a gate set is not universal is to show that you can simulate the evolution of any circuit efficiently on a classical computer. To the extent that we believe that classical and quantum computers are different is the extent to which we believe that gate set cannot be universal for quantum computation. So, how would you efficiently simulate arbitrary single qubit gates being applied to a set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits? Can you update your simulation algorithm to include SWAP without losing efficiency? (Hint: Yes)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I just wanted to clarify the reasoning behind choosing a particular route for disproving universality. You &lt;em&gt;could&lt;/em&gt; try to make the argument that a universal gate set has to be capable of producing any unitary, which means it has to be capable of producing any state starting from the all zeros state. However, the concept of universality is a bit more subtle than that. For example, the gate set {H,Toffoli} is universal, and yet it can not produce states with complex phases because both gates are real valued. The reason is that it produces arbitrary unitaries within a large enough subspace of the system. But due to this possibility, it makes universality much harder to disprove through this sort of reasoning.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-04-12T06:07:29.427" LastActivityDate="2019-04-12T06:07:29.427" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5897" PostTypeId="1" CreationDate="2019-04-11T12:03:52.133" Score="2" ViewCount="37" Body="&lt;p&gt;For two particular (twelve-and thirteen-dimensional) sets of two-retrit states (corresponding to  9 x 9 density matrices with real off-diagonal entries), I have been able to calculate the Hilbert-Schmidt probabilities that members of the sets have positive partial transposes (the PPT property).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first set is composed of the two-retrit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states--having non-zero diagonal and anti-diagonal entries, and all others zero. For this set, the Hilbert-Schmidt PPT-probability is &lt;span class=&quot;math-container&quot;&gt;$\frac{16}{3 \pi^2} \approx 0.54038$&lt;/span&gt;. &#xA;(For the rebit-retrit and two-rebit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states [&lt;a href=&quot;https://arxiv.org/abs/1501.02289&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1501.02289&lt;/a&gt; p.3], the [now, separability] probability is--somewhat surprisingly--the very same. For still higher [than two-retrit] dimensional states, the PPT-probabilities of their &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states seem not to be presently known--and also not known for the &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second (thirteen-dimensional) set is a one-parameter enlargement of the two-retrit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states, in which the (1,2) (and (2,1)) entries are  now unrestricted. For this set, the HS PPT-probability increases to  &lt;span class=&quot;math-container&quot;&gt;$\frac{65}{36 \pi} \approx 0.574726$&lt;/span&gt;. (It remains an interesting research question of to what extent, if any, does this probability change if other--than the (1,2) (and (2,1)) entries--are chosen to be similarly unrestricted.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now is there any manner, by which I can determine to what extent these two sets of (12- and 13-dimensional) PPT-states are bound entangled or separable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, along similar lines, it would be of interest to try to compute the Hilbert-Schmidt PPT-probability of the eight-dimensional &quot;magic simplex &lt;span class=&quot;math-container&quot;&gt;$\mathcal{W}$&lt;/span&gt; presented in sec. IV of the paper &quot;The geometry of bipartite qutrits including bound entanglement&quot; &lt;a href=&quot;https://arxiv.org/abs/0705.1403&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0705.1403&lt;/a&gt; .&#xA;However, at this point, I have not yet been able to fully implement in Mathematica, the steps required.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-04-11T14:23:42.100" LastActivityDate="2019-04-11T14:23:42.100" Title="What proportions of certain sets of PPT-two-retrit states are bound entangled or separable?" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;qutrit&gt;&lt;state-distillation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5899" PostTypeId="1" AcceptedAnswerId="5900" CreationDate="2019-04-12T13:16:32.290" Score="3" ViewCount="299" Body="&lt;p&gt;I was reading a &lt;a href=&quot;https://www.nature.com/articles/s41598-018-32348-8&quot; rel=&quot;nofollow noreferrer&quot;&gt;research article&lt;/a&gt; on quantum computing and didn't understand the tensor notations for the unitary operations. The article defined two controlled gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U_{2^m}$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$2^m \times 2^m$&lt;/span&gt; unitary matrix, &lt;span class=&quot;math-container&quot;&gt;$I_{2^m}$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$2^m \times 2^m$&lt;/span&gt; identity matrix. Then, controlled gates &lt;span class=&quot;math-container&quot;&gt;$C_n^j(U_{2^m})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_n^j(U_{2^m})$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; control qubits and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; target qubits are defined by &lt;span class=&quot;math-container&quot;&gt;$$ C_n^j(U_{2^m})=(|j\rangle \langle j|) \otimes  U_{2^m}+ \sum_{i=0,i \neq j}^{2^n-1}((|i\rangle \langle i| \ \otimes I_{2^m}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ V_n^j(U_{2^m}) =  U_{2^m} \otimes (|j\rangle \langle j|) + \sum_{i=0,i \neq j}^{2^n-1}(    I_{2^m}  \otimes   (|i\rangle \langle i| ))$$&lt;/span&gt;&#xA; Then they say that &lt;span class=&quot;math-container&quot;&gt;$C_2^j(X)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_2^j(X) $&lt;/span&gt;are toffoli gates.&#xA;Can someone explain the equations that are given&#xA;and how does this special case be a Toffoli?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-12T18:30:53.597" LastActivityDate="2019-04-12T18:30:53.597" Title="Quantum Toffoli gate equation" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5900" PostTypeId="2" ParentId="5899" CreationDate="2019-04-12T14:53:47.420" Score="4" Body="&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; are bit strings of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Correspondingly, &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; are some basis vectors in &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional space, that corresponds to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit register.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those controlled operations &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; act on &lt;span class=&quot;math-container&quot;&gt;$(n+m)$&lt;/span&gt;-qubit space. You can consider first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits as control register and last &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits as target register. Now,  &lt;span class=&quot;math-container&quot;&gt;$C_n^j(U_{2^m})$&lt;/span&gt; applies unitary operation &lt;span class=&quot;math-container&quot;&gt;$U_{2^m}$&lt;/span&gt; on the target register if control register is in the state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; and applies &lt;span class=&quot;math-container&quot;&gt;$I_{2^m}$&lt;/span&gt; (i.e. do nothing) otherwise. You can see this by applying &lt;span class=&quot;math-container&quot;&gt;$C_n^j(U_{2^m})$&lt;/span&gt; on some vector &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle$&lt;/span&gt; from the &lt;span class=&quot;math-container&quot;&gt;$(n+m)$&lt;/span&gt;-qubit space, where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit string: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C_n^j(U_{2^m}) |x\rangle|y\rangle = (|j\rangle \langle j|x\rangle) \otimes  U_{2^m} |y\rangle+ \sum_{i=0,i \neq j}^{2^n-1}((|i\rangle \langle i| x \rangle) \otimes |y\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$|i\rangle \langle i|x\rangle = 0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x\neq i$&lt;/span&gt; and it equals &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x=i$&lt;/span&gt;. &#xA;Hence &#xA;&lt;span class=&quot;math-container&quot;&gt;$$C_n^j(U_{2^m}) |x\rangle|y\rangle = |j\rangle \otimes U_{2^m} |y\rangle + 0 = |x\rangle \otimes U_{2^m} |y\rangle ~~\text{if}~~ x=j$$&lt;/span&gt; &#xA;and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$C_n^j(U_{2^m}) |x\rangle|y\rangle = 0 + |x\rangle|y\rangle = |x\rangle|y\rangle ~~\text{if}~~  x\neq j.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gate &lt;span class=&quot;math-container&quot;&gt;$V_n^j(U_{2^m})$&lt;/span&gt; is basically the same as &lt;span class=&quot;math-container&quot;&gt;$C_n^j(U_{2^m})$&lt;/span&gt;, though we consider first &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits as target and last &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits as control register in this case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if &lt;span class=&quot;math-container&quot;&gt;$j=11$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$C_2^j(X)$&lt;/span&gt; is exactly CCNOT gate on 3 qubits. Because we apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (i.e. negating the value) on the last qubit only if two first qubits are in &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; state. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-04-12T15:08:12.180" LastActivityDate="2019-04-12T15:08:12.180" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="5901" PostTypeId="1" AcceptedAnswerId="5902" CreationDate="2019-04-12T15:03:40.057" Score="1" ViewCount="272" Body="&lt;p&gt;How do you create a random initial state by modifying the &lt;span class=&quot;math-container&quot;&gt;$2^{n}$&lt;/span&gt; vector amplitudes instead of starting every simulation at &lt;span class=&quot;math-container&quot;&gt;$|0000...000\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="26" LastEditDate="2019-04-12T18:21:50.193" LastActivityDate="2019-04-12T18:21:50.193" Title="How do you start a simulation with a random initial state in Cirq?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5902" PostTypeId="2" ParentId="5901" CreationDate="2019-04-12T15:50:36.927" Score="2" Body="&lt;p&gt;If you want a random computational basis state, set the input state to the integer &lt;code&gt;random.randint(0, 2**qubits-1)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a random superposition sampled from the Haar measure, there is a method &lt;code&gt;cirq.testing.random_superposition(dim=2**qubits)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have created your initial state, you pass it into the simulator like &lt;code&gt;cirq.Simulator().simulate(circuit, initial_state=...)&lt;/code&gt;. Note that &lt;code&gt;run&lt;/code&gt; methods do not support an initial state, because they are supposed to more closely mimic the hardware.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-04-12T18:19:40.913" LastActivityDate="2019-04-12T18:19:40.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5903" PostTypeId="2" ParentId="1918" CreationDate="2019-04-12T21:13:56.143" Score="4" Body="&lt;p&gt;To follow up on esduran's answer, another great source is the &lt;a href=&quot;https://qosf.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Open Source Foundation&lt;/a&gt;, run the authors of the &lt;a href=&quot;https://arxiv.org/abs/1812.09167&quot; rel=&quot;nofollow noreferrer&quot;&gt;same paper&lt;/a&gt;. It contains a constantly updated list of all open source projects in quantum computation, which ones are active, good learning resources and community channels, as well as evaluations of the bigger software packages.&lt;/p&gt;&#xA;" OwnerUserId="371" LastActivityDate="2019-04-12T21:13:56.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5904" PostTypeId="1" AcceptedAnswerId="9911" CreationDate="2019-04-13T10:22:20.633" Score="2" ViewCount="332" Body="&lt;p&gt;I have been trying to get the runtime of my experiment on IBM's quantum computer. I am using the classic stuff, i.e&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(qwalk_circuit, backend='ibmq_16_melbourne', shots=1000)&#xA;results = job.result()&#xA;results.get_counts()&#xA;print(results.data())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I saw on another post that you could see the runtime by using &lt;code&gt;results.get_data()&lt;/code&gt;, but that doesnt work anymore, giving me an error that the &lt;code&gt;get_data()&lt;/code&gt; attribute does not exist. Is there another way to pull the runtime of my experiment from IBM's quantum computer backend?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My imports, in case I am missing something there:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# importing QISKit&#xA;from qiskit import Aer, IBMQ&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute&#xA;from qiskit import IBMQ, BasicAer&#xA;from qiskit.providers.ibmq import least_busy&#xA;from qiskit.tools.monitor import job_monitor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6244" LastEditorUserId="26" LastEditDate="2019-04-13T10:23:22.853" LastActivityDate="2020-02-19T15:37:31.653" Title="Experiment runtime on IBMQ" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5905" PostTypeId="1" AcceptedAnswerId="5906" CreationDate="2019-04-13T13:52:51.577" Score="5" ViewCount="153" Body="&lt;p&gt;I'm trying to solve the following problem related to the mathematical explanation of Grover's algorithm. &#xA;Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert\psi\rangle = \dfrac{1}{\sqrt{N}} \sum_{x=0}^{N-1}{\lvert x \rangle} \,\text{,}&#xA;$$&lt;/span&gt;&#xA;then prove that the operator &lt;span class=&quot;math-container&quot;&gt;$HU_{0^{\perp}}H$&lt;/span&gt; can be expressed as &lt;span class=&quot;math-container&quot;&gt;$\left( 2\lvert\psi\rangle\langle\psi\rvert-I \right)$&lt;/span&gt;, where the operator &lt;span class=&quot;math-container&quot;&gt;$U_{0^\perp}$&lt;/span&gt; is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{0^\perp}:\lvert x\rangle\mapsto-\lvert x\rangle \quad \forall\lvert x\rangle \ne \lvert 00...0 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm not able to see which steps should I follow. This problem is from the book &lt;em&gt;An Introduction to Quantum Computing&lt;/em&gt; by Phillip Kaye, but it does not give any hint to solve it. I hope anyone can at least tell me where should I begin to get the answer.&lt;/p&gt;&#xA;" OwnerUserId="6245" LastEditorUserId="55" LastEditDate="2019-04-14T16:56:21.253" LastActivityDate="2019-04-14T16:56:21.253" Title="Prove that the operator $H U_{0^\perp}H$ can be expressed as $2|\psi\rangle\langle\psi|-I$" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5906" PostTypeId="2" ParentId="5905" CreationDate="2019-04-13T15:07:58.490" Score="4" Body="&lt;p&gt;You can start by checking the action of the operator &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle0|-I$&lt;/span&gt; on your quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0\rangle$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$(2|0\rangle\langle0|-I)|0\rangle = |0\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|x\rangle \neq |0\rangle$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$(2|0\rangle\langle0|-I)|x\rangle = -|x\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thus, you can see that the operator &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle0|-I$&lt;/span&gt; shifts the phase of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$|x\rangle \neq |0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, you do the expression &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n}$&lt;/span&gt; by applying the mathematical expression from right to left (i.e first you apply &lt;span class=&quot;math-container&quot;&gt;$(2|0\rangle\langle0|-I)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; to the result of that). That should give you the operator &lt;span class=&quot;math-container&quot;&gt;$2|\psi\rangle\langle\psi|-I$&lt;/span&gt;. Mathematically this goes as following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;D &amp;amp;= H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n} \\&#xA;&amp;amp;= 2 (H^{\otimes n}|0^{\otimes n}\rangle)(\langle0^{\otimes n}|H^{\otimes n}) -H^{\otimes n}IH^{\otimes n} \\&#xA;&amp;amp;= 2 (H^{\otimes n}|0^{\otimes n}\rangle)(H^{\otimes n}|0^{\otimes n}\rangle)^{\dagger} - H^{\otimes n}H^{\otimes n} \\&#xA;&amp;amp;= 2|\psi\rangle\langle\psi|-I&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if you notice that &lt;span class=&quot;math-container&quot;&gt;$HH=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = H^{\otimes n}|0^{\otimes n}\rangle = \frac{1}{\sqrt{N}}\sum_{x=0}^{N-1} |x\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This operator &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is called the &lt;em&gt;diffusion operator&lt;/em&gt; and is essentially the operator that, when applied to your oracle &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; gives you Grover's operator &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="6244" LastActivityDate="2019-04-13T15:07:58.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5907" PostTypeId="1" AcceptedAnswerId="5908" CreationDate="2019-04-13T16:17:25.000" Score="5" ViewCount="363" Body="&lt;p&gt;In the literature before me, the quantum oracle of the Grover algorithm is shown as a function, in which a sign change is made possible &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\rightarrow(-1)^{f(x)}|x\rangle$&lt;/span&gt;. I have read that it is possible to transform any efficient classical circuit into a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question, if I want to crack the DES encryption, is it possible to implement the DES algorithm as a circuit that acts as an oracle then? That's just a consideration. Is that conceivable? Could I find the key you are looking for? Is there perhaps some paper about it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would be very interested in what you think about it!&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2019-04-18T19:45:32.443" LastActivityDate="2019-04-18T19:45:32.443" Title="Grover's algorithm – DES circuit as oracle?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5908" PostTypeId="2" ParentId="5907" CreationDate="2019-04-13T20:46:07.243" Score="5" Body="&lt;p&gt;In principle it is possible to generate code for oracles such as the DES encryption (under fixed plaintext/ciphertext pairs, so that the search space becomes the set of all possible encryption keys). One (simple) way to do so is to apply the Bennett method to a classical, irreversible circuit and then to count the gates manually. There are better ways known that do not create as much memory overhead as Bennett's method. As far as programmatic support for this is concerned, there are several attempts for various ciphers and hash-functions to perform this cost analysis with the help of a computer:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;AES was analyzed (using C/C++ programs for resource counting and well known circuits for the underlying finite field arithmetic) in &quot;Applying Grover's algorithm to AES: quantum resource estimates&quot; by Grassl et al. Link to paper: &lt;a href=&quot;https://arxiv.org/abs/1512.04965&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1512.04965&lt;/a&gt;  &lt;/li&gt;&#xA;&lt;li&gt;MD5 and SHA-2 were analyzed (using prototypes such as REVS) in &quot;Reversible circuit compilation with space constraints&quot; by Parent et al. Note that technically not the entire encryption was implemented, but just one round function. In particular, no key scheduler. Link to paper: &lt;a href=&quot;https://arxiv.org/abs/1510.00377&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1510.00377&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;SHA-2 and SHA-3 were analyzed (again using prototypes such as ReVer) in &quot;Estimating the cost of generic quantum pre-image attacks on SHA-2 and SHA-3&quot; by Amy et al. Again,  again not the entire encryption. Link to paper: &lt;a href=&quot;https://arxiv.org/abs/1603.09383&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1603.09383&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A general programmatic framework to express general oracles, synthesize them into quantum circuits (while keeping quantum memory bounded), and perform cost analyses does not exist to the best of my knowledge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, note that applying Grover to breaking ciphers and hash-functions does not lead to &lt;em&gt;practical&lt;/em&gt; attacks on these schemes, at least not for real-world parameters choices (such as AES-128 or even DES-56). The reason is that despite the quadratic speedup that you get from Grover's algorithm, the problem to find the encryption key is still exponential. Furthermore, the requirement to implement the oracle reversible typically leads to large overheads in terms of qubits and gates, so the quadratic speedup is even less pronounced than one might expect (see e.g. the mentioned AES-128 case above where the gate count is not &lt;span class=&quot;math-container&quot;&gt;$2^{64}$&lt;/span&gt; as one might expect from the square root speedup over a naïve solution, but worked out to be about &lt;span class=&quot;math-container&quot;&gt;$2^{86}$&lt;/span&gt; in the first paper above). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, the whole point of applying Grover's algorithm (and other known quantum algorithm such as claw-finding etc.) to classical cryptographic schemes is not so much to carry out said attacks, but instead is assess their security parameters against quantum attacks.&lt;/p&gt;&#xA;" OwnerUserId="1828" LastEditorUserId="1828" LastEditDate="2019-04-13T23:57:30.860" LastActivityDate="2019-04-13T23:57:30.860" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5911" PostTypeId="1" AcceptedAnswerId="5912" CreationDate="2019-04-14T20:26:01.587" Score="3" ViewCount="466" Body="&lt;p&gt;In my lecture notes on quantum information processing my lecturer gives an example of composite systems as &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=|0\rangle |0\rangle=|00\rangle$&lt;/span&gt;. I understand that if we have two qubits then its product state will be in 2n dimensional Hilbert space and I understand the 2 qubit state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to be represented in matrix representation as &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt; (if that is wrong please do correct my misunderstanding though). My question is about the notation &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle=|00\rangle$&lt;/span&gt;, how can we calculate this with matrices on the left-hand side we have a 2 by 1 matrix multiplied by a 2 by 1 matrix which cannot be calculated. I thought perhaps it was a matter of direct products but my calculation led to an incorrect result there too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone clarify this for me, please?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; It occurred to me that I think I'm mistaken about the matrix representation of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, I think it would make more sense to be &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 \\ 0\\0\\0 \end{pmatrix}$&lt;/span&gt; in which case the direct product does work and I should take the notation &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle$&lt;/span&gt; to be a shorthand for the direct product not the multiplication of two matrices, is that correct?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-14T21:50:01.747" LastActivityDate="2019-04-14T21:50:01.747" Title="Notation for two qubit composite product state" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5912" PostTypeId="2" ParentId="5911" CreationDate="2019-04-14T21:14:17.037" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle$&lt;/span&gt; is actually a shorthand for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0\end{bmatrix} $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; stands for the tensor product or essentially the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker product&lt;/a&gt;. To quote Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In mathematics, the &lt;strong&gt;Kronecker product&lt;/strong&gt;, denoted by &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt;, is an operation&#xA;  on two matrices of arbitrary size resulting in a block matrix. It is a&#xA;  generalization of the outer product (which is denoted by the same&#xA;  symbol) from vectors to matrices, and &lt;strong&gt;gives the matrix of the tensor&#xA;  product with respect to a standard choice of basis&lt;/strong&gt;. The Kronecker&#xA;  product &lt;strong&gt;should not be confused with the usual matrix multiplication,&#xA;  which is an entirely different operation&lt;/strong&gt;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now the &lt;strong&gt;standard choice of basis&lt;/strong&gt; for a two-qubit system is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}, |01\rangle = \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}, |10\rangle = \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix}, |11\rangle = \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix}\}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish, you can also represent the basis as (if you strictly take &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Outer_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;outer product&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix}, |01\rangle = \begin{bmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}, |10\rangle = \begin{bmatrix} 0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{bmatrix}, |11\rangle = \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}\}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but then while carrying out calculations like determining the action of a quantum gate on a composite state you'd have to write the state using the &lt;a href=&quot;https://math.stackexchange.com/a/125874&quot;&gt;vector representation&lt;/a&gt; (carefully read the linked Mathematics SE answer). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key point here is that don't be bent on thinking of these linear algebraic operations in terms of matrices, but rather think in terms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_map&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear maps&lt;/a&gt;. You'll get more comfortable with these things once you learn about &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensors&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S&lt;/strong&gt;: &lt;a href=&quot;https://math.stackexchange.com/questions/796709/kronecker-product-and-outer-product-confusion&quot;&gt;Kronecker product and outer product confusion&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-14T21:27:06.920" LastActivityDate="2019-04-14T21:27:06.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5913" PostTypeId="1" AcceptedAnswerId="5914" CreationDate="2019-04-14T23:22:52.623" Score="5" ViewCount="269" Body="&lt;p&gt;In the context of quantum teleportation, my lecturer writes the following (note that I assume the reader is familiar with the circuit):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the measurement of the first qubit is 0 and the measurement of the second qubit is 0 , then we have the state &lt;span class=&quot;math-container&quot;&gt;$\left|\phi_4\right&amp;gt;=c_0\left|000\right&amp;gt;+c_1\left|001\right&amp;gt;=\left|00\right&amp;gt;\otimes \left(c_0\left|0\right&amp;gt;+c_1\left|1\right&amp;gt;\right)=\left|00\right&amp;gt; \otimes \left|\psi '\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to get the final teleported state we have to go through the final two gates &lt;span class=&quot;math-container&quot;&gt;$Z, X$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My lecturer writes this as;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|\gamma\right&amp;gt;=Z^0X^0\left|\psi '\right&amp;gt;= \left|\psi'\right&amp;gt;= c_0\left|0\right&amp;gt;+c_1\left|1\right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is it that the we do not have &lt;span class=&quot;math-container&quot;&gt;$\left|\gamma\right&amp;gt;=Z^0X^0\left(\left|00\right&amp;gt;\otimes \left|\psi '\right&amp;gt;\right)$&lt;/span&gt;? I don't understand why we cut the state &lt;span class=&quot;math-container&quot;&gt;$\left|\phi_4\right&amp;gt;$&lt;/span&gt; &quot;in half &quot;, to use bad terminology, at this step.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What does the superscript 0 on the operators refer to?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the final state again to use bad terminology we only use half of the state &lt;span class=&quot;math-container&quot;&gt;$\left|\phi_4\right&amp;gt;$&lt;/span&gt; can we always assume that the final state will be the &lt;span class=&quot;math-container&quot;&gt;$\left|\psi'\right&amp;gt;$&lt;/span&gt; part of &lt;span class=&quot;math-container&quot;&gt;$\left|\phi_4\right&amp;gt;=\left|xy\right&amp;gt;\otimes\left|\psi'\right&amp;gt;$&lt;/span&gt; state, and if so what is the significance of the final step.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If my question is unanswerable due to a deep misunderstanding of the math processes here, I'd still really appreciate some clarification on whatever points can be answered and I can edit it to make more sense as I learn.&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-15T05:24:50.357" LastActivityDate="2019-04-15T06:04:09.580" Title="Understanding this description of teleportation" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5914" PostTypeId="2" ParentId="5913" CreationDate="2019-04-15T05:24:06.750" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The first two qubits stay on the sender's side, and since they are not entangled with the receiver's qubit, it's not necessary to mention them any further — we switched to discussing the receiver's side of the protocol, and all information from the first two qubits is now in measurement results.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The superscripts denote the power of the operator applied: if both measurement results are 0, you don't need to apply X or Z corrections, which is the same as applying these operators raised to power 0 (&lt;span class=&quot;math-container&quot;&gt;$X^0 = Z^0 = I$&lt;/span&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After measuring the first two qubits, the state will always be represented as &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle \otimes |\text{some state}\rangle$&lt;/span&gt;, but to convert the receiver's qubit from &lt;span class=&quot;math-container&quot;&gt;$|\text{some state}\rangle$&lt;/span&gt; to the state that needed to be teleported &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; you'll need to apply corrections which depend on the measurement results &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. I believe this is what you refer to as the final step, and its goal is fixing the amplitudes of the state for it to match the state that was teleported.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-04-15T06:04:09.580" LastActivityDate="2019-04-15T06:04:09.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5915" PostTypeId="1" CreationDate="2019-04-15T07:13:06.473" Score="1" ViewCount="497" Body="&lt;p&gt;This is just a basic question. I need to output odd integers till &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;, i.e &lt;span class=&quot;math-container&quot;&gt;$1,3,5,7,9,11,13,15$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; requires &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; bits, I prepare initial state by using Hadamard gate on initial &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, i.e &lt;span class=&quot;math-container&quot;&gt;$$H|0\rangle \otimes H|0\rangle \otimes  H|0\rangle$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$=|000\rangle+|001\rangle+|010\rangle+|011\rangle+|100\rangle+|101\rangle+|110\rangle+|111\rangle.$$&lt;/span&gt; Then take the tensor product with &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, i.e &lt;span class=&quot;math-container&quot;&gt;$$(H|0\rangle \otimes H|0\rangle \otimes  H|0\rangle)|1\rangle$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$=|0001\rangle+|0011\rangle+|0101\rangle+|0111\rangle+|1001\rangle+|1011\rangle+|1101\rangle+|1111\rangle.$$&lt;/span&gt; Is this right?&#xA;Actually, I know the ideas but don't know how to write it in the quantum computing terms, that involves using terms as registers, qubits&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-15T10:57:12.543" LastActivityDate="2019-04-15T10:57:12.543" Title="Preparing odd integers using quantum computation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5916" PostTypeId="2" ParentId="5915" CreationDate="2019-04-15T07:18:17.267" Score="4" Body="&lt;p&gt;It depends what you mean by &quot;output odd integers till 15&quot;. If you actually mean &quot;prepare a uniform superposition of all odd, positive integers up to and including 15&quot;, then yes, you are essentially correct. The only thing to say is that your initial preparation using Hadamards is only over 3 qubits, not 4 (you've got 4 qubits on the left-hand side and 3 on the right-hand side). Similarly for your second equation, you've got 5 qubits on the left-hand side and 4 on the right. You would also be safer to include the normalisation factor.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-15T07:18:17.267" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5917" PostTypeId="2" ParentId="5676" CreationDate="2019-04-15T10:20:24.663" Score="3" Body="&lt;p&gt;Seems like you are interested in the theory of applying results from classical linear coding theory to quantum information theory. When you want to understand how to generalize the Hamming code to a quantum code - the so-called Steane code - you should definitely get familiar to the &quot;stabilizer formalism&quot; introduced by Daniel Gottesman in his Ph.D. thesis which you can find &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9705052&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easier to read and understand book about this topic is &quot;Quantum Computation and Quantum Information&quot; by Michael Nielsen and Isaac Chuang. In particular, in chapter 10 they explain how to construct the Steane code from the Hamming code. I highly recommend this book when you are only getting started with this topic. &lt;/p&gt;&#xA;" OwnerUserId="6263" LastEditorUserId="26" LastEditDate="2019-04-15T10:29:40.670" LastActivityDate="2019-04-15T10:29:40.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5918" PostTypeId="1" CreationDate="2019-04-15T10:37:19.650" Score="3" ViewCount="177" Body="&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Cross-posted on &lt;a href=&quot;https://cstheory.stackexchange.com/questions/42714/what-can-be-some-bachelor-thesis-ideas-in-quantum-random-walks&quot;&gt;Theoretical Computer Science Stack Exchange&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am an undergraduate, reading about quantum information and quantum technology. For about some time, I have been interested in the applications of quantum walks to quantum algorithms. What can be some bachelor thesis ideas in quantum random walks? Can anybody suggest a starting point?&lt;/p&gt;&#xA;" OwnerUserId="6207" LastEditorUserId="26" LastEditDate="2019-04-15T10:44:39.560" LastActivityDate="2019-08-08T21:16:26.033" Title="What can be some bachelor thesis ideas in quantum random walks?" Tags="&lt;algorithm&gt;&lt;research&gt;&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2019-08-10T11:01:31.760" ContentLicense="CC BY-SA 4.0" />
  <row Id="5919" PostTypeId="1" CreationDate="2019-04-15T11:21:19.730" Score="3" ViewCount="516" Body="&lt;p&gt;I have a matrix equation &lt;span class=&quot;math-container&quot;&gt;$X_{\text{new}}=AX_{\text{old}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A=\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1\\&#xA;2 &amp;amp; 3 &amp;amp;2\\&#xA;3&amp;amp;4&amp;amp;4&#xA;\end{bmatrix}\bmod 64$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$X_{\text{old, new}}\in \{1,2,...64\}$&lt;/span&gt;. Now I need to do these calculations in quantum sense, using gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I see is that to get &lt;span class=&quot;math-container&quot;&gt;$X_{\text{new}}(1)=(X_{\text{old}}(1)+X_{\text{old}}(2)+X_{\text{old}}(3))\bmod 2^{6}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since each &lt;span class=&quot;math-container&quot;&gt;$X_{\text{old}}(i)\in \{1,2,...64\}$&lt;/span&gt;, to add these three components, I need 6 full adders and to do the mod &lt;span class=&quot;math-container&quot;&gt;$2^6$&lt;/span&gt; operation I need to just keep the 6 least significant bits of the sum. Is my approach correct? &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-15T11:30:12.577" LastActivityDate="2019-04-15T15:58:47.060" Title="Quantum addition and modulo operation using gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5920" PostTypeId="2" ParentId="5904" CreationDate="2019-04-15T13:19:41.290" Score="3" Body="&lt;p&gt;&lt;code&gt;results.get_data()&lt;/code&gt; was replaced by &lt;code&gt;results.data()&lt;/code&gt;. The new function returns (almost) the same information, but the runtime attribute was removed. As far as I know, there is no official way to get the runtime of your job on the computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some ways to get it through your own code, but keep in mind these are not official methods of doing so, and the times might not be very accurate. One way would be to call &lt;code&gt;time.time()&lt;/code&gt; right when you send your job, and compare it to a &lt;code&gt;time.time()&lt;/code&gt; call right when your job completes. However, this would include any time the job spent waiting in queue. You could also try calling the first &lt;code&gt;time.time()&lt;/code&gt; call when the &lt;code&gt;job.status()&lt;/code&gt; is in a running state, and then call another &lt;code&gt;time.time()&lt;/code&gt; once the job completes. This should, in theory, bypass any time the job spends in queue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the feature may be brought back in the future, so I would keep an eye on future release notes as well.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-04-15T13:19:41.290" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5921" PostTypeId="1" AcceptedAnswerId="5922" CreationDate="2019-04-15T13:33:24.393" Score="4" ViewCount="126" Body="&lt;p&gt;In &quot;&lt;a href=&quot;https://arxiv.org/abs/1112.3333&quot; rel=&quot;nofollow noreferrer&quot;&gt;Another subexponential-time quantum algorithm for the dihedral hidden subgroup problem&lt;/a&gt;&quot;, Kuperberg writes that &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; has a &quot;Burnside decomposition&quot; of &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbb{C}[G]\cong \bigoplus_{V} V^*\otimes V$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where each &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is an irreducible representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He defines &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; as a Hilbert space with an orthonormal basis identified by &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, a finite group. So &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; is the span of &lt;span class=&quot;math-container&quot;&gt;$\{\vert g\rangle :g\in G\}$&lt;/span&gt; for orthonormal vectors &lt;span class=&quot;math-container&quot;&gt;$\vert g\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; works naturally as the representation space of either the left-regular or right-regular representation of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. Thus, it makes sense to me that, letting &lt;span class=&quot;math-container&quot;&gt;$V_i$&lt;/span&gt; be the representation spaces of different representations, we would have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbb{C}[G]=\bigoplus_{i} V_i.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I don't see why the tensor product appears. Even if we consider &lt;span class=&quot;math-container&quot;&gt;$B(\mathbb{C}[G])$&lt;/span&gt;, the set of operators on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt;, to get the density matrices on this Hilbert space, we would end up with vectors of the form &lt;span class=&quot;math-container&quot;&gt;$v_j\otimes v_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$v_j\in V_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_i\in V_i$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, he may be identifying &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; with the left- or right-regular representation itself, and then decomposing it into the representations, not the representation spaces. But this doesn't make sense to me either; &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is finite-dimensional, so &lt;span class=&quot;math-container&quot;&gt;$V^*\otimes V\cong M_n$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, so this decomposition would imply that every irreducible representation of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is isomorphic to &lt;span class=&quot;math-container&quot;&gt;$M_n$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, which I don't think is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is this decomposition?&lt;/p&gt;&#xA;" OwnerUserId="4517" LastEditorUserId="23" LastEditDate="2019-10-28T09:00:07.107" LastActivityDate="2019-10-28T18:41:12.247" Title="Burnside Decomposition in Kuperberg's Hidden Shift" Tags="&lt;mathematics&gt;&lt;fourier-sampling&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5922" PostTypeId="2" ParentId="5921" CreationDate="2019-04-15T14:16:45.593" Score="3" Body="&lt;p&gt;The second part of each tensor product serves as a multiplicity space. It might be more satisfying to write it as a full decomposition like your second one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have &lt;span class=&quot;math-container&quot;&gt;$\bigoplus V_\lambda \otimes V_\lambda^*$&lt;/span&gt; and you want it to look more like your second equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would happen is each &lt;span class=&quot;math-container&quot;&gt;$V_\lambda$&lt;/span&gt; would show up as a direct summand &lt;span class=&quot;math-container&quot;&gt;$d_\lambda$&lt;/span&gt; times where &lt;span class=&quot;math-container&quot;&gt;$d_\lambda$&lt;/span&gt; is the dimension of &lt;span class=&quot;math-container&quot;&gt;$V_\lambda^*$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tensor product there is as vector spaces with one of the factors being a bookkeeping device to say how many times that irreducible is a summand. It is not tensoring as representations that have to be broken down by further C-G coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More detail possible, but for a first pass just leave it at that. Don't take it beyond just conveniently keeping track of multiplicities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maschke's theorem&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-04-15T14:16:45.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5923" PostTypeId="2" ParentId="5919" CreationDate="2019-04-15T15:58:47.060" Score="5" Body="&lt;p&gt;The main criteria that you need, in order to multiply by a matrix on a quantum computer (in the sense of permuting the states, not in the sense of adjusting the amplitudes) is for the matrix to have an inverse. You can find this inverse by performing Guassian elimination. Performing the Guassian elimination spits out exactly the operations you will need to perform, in reverse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's do the Guassian elimination of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# 111&#xA;# 232&#xA;# 344&#xA;&#xA;r2 -= 2*r1&#xA;r3 -= 3*r1&#xA;# 111&#xA;# 010&#xA;# 011&#xA;&#xA;r1 -= r2&#xA;r3 -= r2&#xA;# 101&#xA;# 010&#xA;# 001&#xA;&#xA;r1 -= r3&#xA;# 100&#xA;# 010&#xA;# 001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We managed to reach the identity matrix. Note that we didn't need to compute any multiplicative inverses in order to make the rows cancel properly or to make elements along the diagonal equal to 1, which is good because it means we can multiply by this matrix modulo any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. That won't always be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you run these operations backwards (reverse order and += instead of -=), you will turn the identity matrix into &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. Run them backwards against a vector, and you are multiplying by &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%2C1%2C1%2C1%2C%22X%22%2C1%2C%22X%22%2C%22X%22%5D%2C%5B%22Chance3%22%2C1%2C1%2C%22Chance3%22%2C1%2C1%2C%22Chance3%22%5D%2C%5B%22%2B%3DA3%22%2C1%2C1%2C1%2C1%2C1%2C%22inputA3%22%5D%2C%5B%22%2B%3DA3%22%2C1%2C1%2C%22inputA3%22%2C1%2C1%2C%22%2B%3DA3%22%5D%2C%5B1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A3%7D%5D%2C%5B%5D%2C%5B%22inputA3%22%2C1%2C1%2C1%2C1%2C1%2C%22%2B%3DAB3%22%5D%2C%5B1%2C1%2C1%2C1%2C%22setB%22%5D%2C%5B%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22%2B%3DAB3%22%5D%2C%5B%22Chance3%22%2C1%2C1%2C%22Chance3%22%2C1%2C1%2C%22Chance3%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;here is a circuit which multiplies by &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, working modulo 8&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%2C1%2C1%2C1%2C%22X%22%2C1%2C%22X%22%2C%22X%22%5D%2C%5B%22Chance3%22%2C1%2C1%2C%22Chance3%22%2C1%2C1%2C%22Chance3%22%5D%2C%5B%22%2B%3DA3%22%2C1%2C1%2C1%2C1%2C1%2C%22inputA3%22%5D%2C%5B%22%2B%3DA3%22%2C1%2C1%2C%22inputA3%22%2C1%2C1%2C%22%2B%3DA3%22%5D%2C%5B1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A3%7D%5D%2C%5B%5D%2C%5B%22inputA3%22%2C1%2C1%2C1%2C1%2C1%2C%22%2B%3DAB3%22%5D%2C%5B1%2C1%2C1%2C1%2C%22setB%22%5D%2C%5B%5D%2C%5B%22inputA3%22%2C1%2C1%2C%22%2B%3DAB3%22%5D%2C%5B%22Chance3%22%2C1%2C1%2C%22Chance3%22%2C1%2C1%2C%22Chance3%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HKqye.png&quot; alt=&quot;M circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first column is preparing an input state to test it, the second column is green state displays showing the prepared value is [1, 2, 3], the final column is green state displays showing the output (modulo 8) is [6, 6, 7]. All the stuff in between is the reversed Gaussian elimination operations.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-04-15T15:58:47.060" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="5925" PostTypeId="1" AcceptedAnswerId="5926" CreationDate="2019-04-17T08:31:27.053" Score="5" ViewCount="459" Body="&lt;p&gt;I have a question about the implementation of the controlled unitary &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, from the paper &lt;a href=&quot;https://arxiv.org/abs/1811.01726&quot; rel=&quot;nofollow noreferrer&quot;&gt;Demonstration of a Quantum Circuit Design Methodology for Multiple Regression&lt;/a&gt;, using the Qiskit framework.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this paper, a &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is transformed into &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; unitary and then decomposed by applying the GLOA algorithm.&#xA;I'm not interested in this particular example but rather in general implementation of the arbitrary unitary by using Qiskit. However, it is convenient to use this case as an example. In this paper, we have a series of controlled &lt;span class=&quot;math-container&quot;&gt;$4\times4$&lt;/span&gt; unitary operators implemented according to the phase estimation algorithm. Since the resulting circuit is given in the paper, I have successfully implemented the unitary but I have a difficult time to apply the controlled action of the given unitary in Qiskit framework.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, how can I implement a controlled unitary for some arbitrary &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;? Should I use a given circuit from the paper and apply control to each gate in the circuit or there is another way? &lt;/p&gt;&#xA;" OwnerUserId="5730" LastEditorUserId="26" LastEditDate="2019-04-17T14:42:53.090" LastActivityDate="2019-04-17T14:42:53.090" Title="Controlled unitary from the HHL algorithm – practical implementation using Qiskit" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5926" PostTypeId="2" ParentId="5925" CreationDate="2019-04-17T08:46:19.043" Score="4" Body="&lt;p&gt;Disclaimer: I'm the one that wrote the code of the 4x4 HHL.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Controlling a quantum gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be achieved by controlling each of the &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; gates that are composing &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the specific example you are considering, the implementation is &lt;a href=&quot;https://github.com/nelimee/quantum-hhl-4x4&quot; rel=&quot;nofollow noreferrer&quot;&gt;available online&lt;/a&gt;. Some remarks about the code:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I think the code is not up to date with the last version of Qiskit. I did not re-tested recently. The code should be compatible with Qiskit 0.6.1 as written in the &lt;code&gt;requirements.txt&lt;/code&gt; file.&lt;/li&gt;&#xA;&lt;li&gt;The implementation of the controlled unitary is available &lt;a href=&quot;https://github.com/nelimee/quantum-hhl-4x4/blob/master/hhl4x4/custom_gates/hhl4x4.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The controls are not really explicit, but you can see that each gate used in the implementation of the unitary is controlled by the same qubit.&lt;/li&gt;&#xA;&lt;li&gt;Everything in the above implementation has been hand-tuned. You will probably not be able to understand the generic algorithms to control an arbitrary gate with the code.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the general case, controlling an arbitrary gate may be programmatically quite hard. For example, in order to control a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate (and so to perform a controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;), you will probably end up decomposing the controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate as 2 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates around a controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. Another example is how do you implement a multi-controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. There are known algorithms, but they should be implemented beforehand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;End note:&lt;/strong&gt; if you want to discuss about the implementation, feel free to contact me at the mail address at the end of the README.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-04-17T08:46:19.043" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5927" PostTypeId="1" CreationDate="2019-04-17T08:53:51.770" Score="0" ViewCount="66" Body="&lt;p&gt;I have the following matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix}&#xA;1        &amp;amp;        0      &amp;amp;     0       &amp;amp;     0\\&#xA;0        &amp;amp;        \frac{1}{\sqrt{2}}      &amp;amp;     \frac{-i}{\sqrt{2}}        &amp;amp;     0\\&#xA;0        &amp;amp;        \frac{-i}{\sqrt{2}}      &amp;amp;     \frac{1}{\sqrt{2}}        &amp;amp;     0\\&#xA;0        &amp;amp;        0      &amp;amp;     0       &amp;amp;     1\\       &#xA;\end{bmatrix}&lt;/span&gt;&#xA;I want to understand the operation by this matrix in terms of the familiar quantum logic gates. More precisely, how can one write the above matrix in terms of the quantum logic gates?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="55" LastEditDate="2020-07-26T18:12:42.387" LastActivityDate="2020-07-26T18:12:42.387" Title="Identifying a matrix with the fundamental quantum logic gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2019-05-09T17:45:45.673" ContentLicense="CC BY-SA 4.0" />
  <row Id="5928" PostTypeId="1" AcceptedAnswerId="5932" CreationDate="2019-04-17T09:13:49.057" Score="3" ViewCount="109" Body="&lt;p&gt;I'm working on some papers (&lt;a href=&quot;https://arxiv.org/abs/1512.04965&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and  &lt;a href=&quot;https://arxiv.org/abs/1603.09383&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) that use the Grover algorithm to crack krypto systems like AES and SHA.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had already asked a first question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5907/grovers-algorithm-des-circuit-as-oracle&quot;&gt;here&lt;/a&gt;. Now, however, a new question has arisen for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to my knowledge, AES uses a key and a clear text and generates a cipher from this. If AES is reversibly implemented in the paper, then one could read the plaintext and the key, because the circuit is reversible. Does it make sense? How do you prevent that? Reversible means that I can make the input from an output. In this context, that means that I could read the key directly. Why then use the Grover algorithm at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in the paper &lt;a href=&quot;https://arxiv.org/abs/1603.09383&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; pages 3-4 it is said:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$f : \{0, 1\}^k → \{0, 1\}^k$&lt;/span&gt; be an efficiently function. For a fixed &lt;span class=&quot;math-container&quot;&gt;$y ∈ \{0, 1\}^k$&lt;/span&gt;, the value &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x) = y$&lt;/span&gt; is called a pre-image of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. In the worst case, the only way to compute a pre-image of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is to systematically search the space of all inputs to f. A function that must be searched in this way is known as a one-way function. The Grover iteration has two subroutines. The first, &lt;span class=&quot;math-container&quot;&gt;$U_g$&lt;/span&gt;, implements the predicate &lt;span class=&quot;math-container&quot;&gt;$g : \{0, 1\}^k \rightarrow \{0, 1\}$&lt;/span&gt; that&#xA;  maps &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$f(x) = y$&lt;/span&gt;. Each call to &lt;span class=&quot;math-container&quot;&gt;$U_g$&lt;/span&gt; involves two calls to a reversible implementation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and one call to a comparison circuit that checks whether &lt;span class=&quot;math-container&quot;&gt;$f(x) = y$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then the hash function is a sub-call of the oracle. Which means that the hash function must be reversible. But if the has-function is reversible, I can directly read the plaintext, because I have the cryptotext (the hash). Do I understand something wrong here? Why do you need the Grover algorithm at all?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also have to ask the question, why in the first paper &lt;span class=&quot;math-container&quot;&gt;$AES$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$AES^{-1}$&lt;/span&gt; are executed once and in the second paper &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f^{-1}$&lt;/span&gt; in the oracle part? Why is not just &lt;span class=&quot;math-container&quot;&gt;$AES$&lt;/span&gt; and only &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; executed as a call?&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorDisplayName="user4961" LastEditDate="2019-04-17T10:25:14.930" LastActivityDate="2019-04-17T12:42:09.543" Title="Reversible crypto systems for use in the Grover's algorithm" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5929" PostTypeId="1" AcceptedAnswerId="5931" CreationDate="2019-04-17T09:39:43.750" Score="4" ViewCount="566" Body="&lt;p&gt;Assuming we have two sets of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. The first set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is in state &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and second set in &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. Is there a fixed procedure that generates a superposed state of the two &lt;span class=&quot;math-container&quot;&gt;$|a\rangle + |b\rangle$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="6109" LastEditorUserId="26" LastEditDate="2019-04-17T14:27:33.327" LastActivityDate="2019-04-17T14:27:33.327" Title="How to superpose two composite qubit states?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5930" PostTypeId="2" ParentId="5927" CreationDate="2019-04-17T10:51:58.437" Score="3" Body="&lt;p&gt;This gate, which I'll denote as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is essentially the square root of not gate, whose decomposition has already been discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2468/1837&quot;&gt;elsewhere&lt;/a&gt;. Hence, we only need the conversion:&lt;a href=&quot;https://i.stack.imgur.com/O7saI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O7saI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, if we perform the corresponding matrix multiplications, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i \\&#xA;\end{array}&#xA;\right)\cdot\left(\left(&#xA;\begin{array}{cc}&#xA; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; e^{-\frac{i \pi }{4}} \\&#xA;\end{array}&#xA;\right)\otimes \left(&#xA;\begin{array}{cc}&#xA; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; e^{-\frac{i \pi }{4}} \\&#xA;\end{array}&#xA;\right)\right)\cdot\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{e^{\frac{i \pi }{4}}}{\sqrt{2}} &amp;amp; \frac{e^{-\frac{i \pi }{4}}}{\sqrt{2}} &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{e^{-\frac{i \pi }{4}}}{\sqrt{2}} &amp;amp; \frac{e^{\frac{i \pi }{4}}}{\sqrt{2}} &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)=\\&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; -\frac{i}{\sqrt{2}} &amp;amp; 0 \\&#xA; 0 &amp;amp; -\frac{i}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;$$&lt;/span&gt;&#xA;as required.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-04-17T11:36:48.530" LastActivityDate="2019-04-17T11:36:48.530" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5931" PostTypeId="2" ParentId="5929" CreationDate="2019-04-17T10:56:55.963" Score="7" Body="&lt;p&gt;Depending on what precisely your assumptions are about a, b, I think this is essentially impossible, and is something called the &quot;no superposing theorem&quot;. Please see &lt;a href=&quot;https://arxiv.org/abs/1505.04955&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2019-04-17T14:26:10.300" LastActivityDate="2019-04-17T14:26:10.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5932" PostTypeId="2" ParentId="5928" CreationDate="2019-04-17T12:42:09.543" Score="2" Body="&lt;p&gt;I think there are two meanings of &quot;reversible&quot; at work.  These may be causing confusion.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initially, even in the classical world, when we say that a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is &lt;em&gt;irreversible&lt;/em&gt; without any other qualifications, we mean that, given &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, it is &lt;strong&gt;computationally difficult&lt;/strong&gt; to find an &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$y=f(x)$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In other contexts, when talking about quantum circuits, when we say that a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is implemented in &lt;em&gt;reversible gates&lt;/em&gt;, we mean that the gates come from our favorite set of universal unitaries, e.g. &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt;'s, etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We believe SHA is &lt;em&gt;irreversible&lt;/em&gt; in the first sense; that does not mean it cannot be implemented with &lt;em&gt;reversible&lt;/em&gt; gates as in the second sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we were to use Grover's algorithm to get a polynomial speedup on SHA, then given an output &lt;span class=&quot;math-container&quot;&gt;$y_0$&lt;/span&gt;, we would find a way to implement the SHA function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; with a set of reversible gates to create a unitary &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;, prepare a first register &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; into a uniform superposition, apply &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to a second register &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt; conditioned on the values of the first register, and repeatedly apply the Grover rotations conditioned on the value of the second register &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt; being &lt;span class=&quot;math-container&quot;&gt;$y_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we implement &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, we could also implement it with all of our lossy/irreversible gates &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOR}$&lt;/span&gt;, etc., as long as we keep a copy of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in some of the outputs.  We apply the Grover rotations to the entire superposition.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-04-17T12:42:09.543" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5934" PostTypeId="2" ParentId="5929" CreationDate="2019-04-17T14:00:57.170" Score="4" Body="&lt;p&gt;Your question is not quite correctly defined.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, &lt;span class=&quot;math-container&quot;&gt;$|a\rangle + |b\rangle$&lt;/span&gt; is not a state. You need to normalize it by considering  &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{|||a\rangle + |b\rangle||}(|a\rangle + |b\rangle)$&lt;/span&gt;.&lt;br&gt;&#xA;Secondly, in fact, you don't have access to the states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; but to the states up to some global phase, i.e. you can think that the first register is in the vector-state &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}|a\rangle$&lt;/span&gt; and the second register is in the vector-state &lt;span class=&quot;math-container&quot;&gt;$e^{i\psi}|b\rangle$&lt;/span&gt; with inaccessible &lt;span class=&quot;math-container&quot;&gt;$\phi, \psi$&lt;/span&gt;. Since you don't have access to &lt;span class=&quot;math-container&quot;&gt;$\phi, \psi$&lt;/span&gt;, you can't define sum &lt;span class=&quot;math-container&quot;&gt;$|a\rangle + |b\rangle$&lt;/span&gt;. But you can ask to construct normalized state &lt;span class=&quot;math-container&quot;&gt;$|a\rangle + e^{ it}|b\rangle$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. This question is correct. Though, as DaftWullie pointed out in his answer, it is impossible to construct such a state.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="26" LastEditDate="2019-04-17T14:23:54.640" LastActivityDate="2019-04-17T14:23:54.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5935" PostTypeId="1" AcceptedAnswerId="5940" CreationDate="2019-04-17T15:16:29.680" Score="5" ViewCount="234" Body="&lt;p&gt;This is actually an exercise from Preskill (&lt;a href=&quot;http://www.theory.caltech.edu/~preskill/ph219/index.html#lecture&quot; rel=&quot;nofollow noreferrer&quot;&gt;chapter 4, new version 4.4&lt;/a&gt;). So they are asking about the fidelity of teleporting a random pure quantum state from Bob to Alice, who both have one qubit of the following system (&quot;noisy&quot; entangled state):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = (1 − \lambda)|\psi ^-\rangle \langle \psi ^- | + \frac{1}{4} \lambda I $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$|\psi ^-\rangle$&lt;/span&gt; one of the Bell states. In the notes of Preskill they show you the example of quantum teleportation with a Bell state &lt;span class=&quot;math-container&quot;&gt;$|ψ ^-\rangle_{AB}$&lt;/span&gt;, by uniting the random qubit with the system (Bell state) and then make Alice do some measurements on the system, from which Bob gets a &quot;copy&quot; (or to be correct: the qubit was teleported to Bob) of the random qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in this example, we are presented with the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, from which we cannot just get one &quot;state&quot;. As I can not follow the example of the book (where they manipulate the state &lt;span class=&quot;math-container&quot;&gt;$|\psi ^-\rangle$&lt;/span&gt;), but now have to deal with the density matrix, I have no idea where to begin. How can we proceed to calculate the fidelity with which Bob will have the correct teleported state if using the given noisy entangled system &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to teleport the random qubit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They also state that a random 'guess' has a 1/2 chance (which refers to the identity part &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; system). I also know the fidelity of a pure Bell state will be 1. But I suppose I can't just say that for the system &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; the fidelity is the sum of the parts?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F =  (1 − λ) + \frac{1}{4} \lambda \times \frac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if I can, why is this? How can I explicitly calculate this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S:&lt;/strong&gt; By the way, if anyone would have solutions to the exercises in the notes of Preskill, a link would be much appreciated. &lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="26" LastEditDate="2019-04-18T19:39:37.437" LastActivityDate="2019-04-18T21:44:51.837" Title="Quantum teleportation with &quot;noisy&quot; entangled state" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;teleportation&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5936" PostTypeId="1" CreationDate="2019-04-17T19:08:39.210" Score="3" ViewCount="593" Body="&lt;p&gt;Sometimes we find that the result we want from a quantum algorithm is expressed in terms of a basis that is different from the usual computational basis, which I will call&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B_C = \left\{ \lvert 0 \rangle, \lvert 1 \rangle \right\} = \left\{ \left(\begin{array}{c}1\\0\end{array}\right),\left(\begin{array}{c}0\\1\end{array}\right) \right\}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, at the end of the Deutsch's algorithm, the first qubits is in the state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert\psi\rangle = (-1)^{f(0)} \dfrac{\lvert 0 \rangle + (-1)^{f(0) \oplus f(1)} \lvert 1 \rangle}{\sqrt{2}},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which can be expressed in terms of the Hadamard's basis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B_H = \{ \lvert + \rangle, \lvert - \rangle \} = \left\{ \dfrac{1}{\sqrt{2}} \left( \begin{array}{c}1\\1\end{array} \right), \dfrac{1}{\sqrt{2}} \left( \begin{array}{c}1\\-1\end{array} \right) \right\}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{cases} f(0) \oplus f(1) = 0 \quad\Rightarrow\quad \lvert\psi\rangle = (-1)^{f(0)} \lvert + \rangle \\ f(0) \oplus f(1) = 1 \quad\Rightarrow\quad \lvert\psi\rangle = (-1)^{f(0)} \lvert - \rangle  \end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, we can get the value of &lt;span class=&quot;math-container&quot;&gt;$f(0) \oplus f(1)$&lt;/span&gt; just by measuring &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$B_H$&lt;/span&gt;. Since we can only perform physical measurements on &lt;span class=&quot;math-container&quot;&gt;$B_C$&lt;/span&gt;, this can be achieved performing a change of basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given two basis &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, if the matrix that transforms the elements of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to the elements of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, this is also the matrix that maps the coordinates of vectors with respect to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to their coordinates with respect to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Hence, which of these propositions is the correct to express the change of basis we must do to perform the measurement on &lt;span class=&quot;math-container&quot;&gt;$B_H$&lt;/span&gt; knowing that physical measurements are actually performed in &lt;span class=&quot;math-container&quot;&gt;$B_C$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We must apply the Hadamard's gate, because the matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$\left\{ \lvert 0 \rangle,\lvert 1 \rangle \right\}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\left\{ \lvert + \rangle, \lvert - \rangle \right\}$&lt;/span&gt;, and therefore it transforms the components &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle_{B_H}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle_{B_C}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We must apply the Hadamard's gate, because the matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$\left\{ \lvert + \rangle,\lvert - \rangle \right\}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\left\{ \lvert 0 \rangle, \lvert 1 \rangle \right\}$&lt;/span&gt;, and therefore it transforms the components &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle_{B_C}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle_{B_H}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6245" LastEditorUserId="26" LastEditDate="2019-04-18T19:19:33.507" LastActivityDate="2020-12-25T10:32:47.363" Title="Correct way of expressing a measurement in a different computational basis" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;measurement&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5937" PostTypeId="2" ParentId="5936" CreationDate="2019-04-18T10:17:09.857" Score="1" Body="&lt;p&gt;If you want to measure &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; in some basis &lt;span class=&quot;math-container&quot;&gt;$U|b_1\rangle,...,U|b_n\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|b_1\rangle,...,|b_n\rangle$&lt;/span&gt;, then you need to rotate the state &quot;backward&quot;, i.e. measure &lt;span class=&quot;math-container&quot;&gt;$U^{-1}|\phi\rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$|b_1\rangle,...,|b_n\rangle$&lt;/span&gt;.&lt;br&gt;&#xA;The simple rule to find the direction of rotation is to consider the state and the required measurement basis together &lt;span class=&quot;math-container&quot;&gt;$\{|\phi\rangle, U|b_1\rangle,...,U|b_n\rangle\}$&lt;/span&gt;. Then If you what to perform the same measurement in a different basis you need to rotate the whole system altogether.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-04-18T10:17:09.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5938" PostTypeId="1" AcceptedAnswerId="5941" CreationDate="2019-04-18T16:03:56.073" Score="2" ViewCount="252" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;c) Compute &lt;span class=&quot;math-container&quot;&gt;$$\text{Prob}(\uparrow_\hat{n}\uparrow_\hat{m}) \equiv \text{tr}(\pmb{E}_A(\hat{n})\pmb{E}_B(\hat{n})\pmb{p}(\lambda)), \tag{4.164}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\pmb{E}_A(\hat{n})$&lt;/span&gt; is the projection of Alice's qubit onto &lt;span class=&quot;math-container&quot;&gt;$\left|\uparrow_{\hat{n}}\right\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pmb{E}_B(\hat{m})$&lt;/span&gt; is the projection of Bob's qubit onto &lt;span class=&quot;math-container&quot;&gt;$\left|\uparrow_{\hat{m}}\right\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So what they are actually asking is, you have an entangled system of two qubits &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and we measure the first qubit on some (random) axis n and then the second on some other (random) axis &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. What is the probability of both spins being &amp;quot;spin-up&amp;quot; on their respective axes? The system in the actual exercise is a bit hard, but to show my problem, let's take an easy example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \left|\uparrow \downarrow  \right\rangle _{AB} \left\langle \uparrow \downarrow\right|_{AB}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now without actually using the formula, let's assume we measure in the z-direction twice. We will measure for example a spin-up for qubit A, so looking at the system we know that the second qubit should be spin-down, because this density matrix comes from the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_{AB} = \left|\uparrow \downarrow\right\rangle $&lt;/span&gt;. Now if we look at the given formula, &lt;span class=&quot;math-container&quot;&gt;$E_B(z)$&lt;/span&gt; measures the spin of qubit B, which can be for example -1, then the second operator measures &lt;span class=&quot;math-container&quot;&gt;$E_A(z)$&lt;/span&gt;, as we said, is +1 in the given state (because A &amp;amp; B have opposite spins). We know that the expectation value of an operator is &lt;span class=&quot;math-container&quot;&gt;$\langle E_A E_B \rangle$&lt;/span&gt;, which is the same as taking the trace &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(E_A E_B \rho)$&lt;/span&gt;, which is the described formula above. We will not explicitly calculate this with the trace formula, because we have the corresponding state here, so we know that the probability is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(E_A E_B \rho)= \langle E_A E_B \rangle = \langle \psi | E_A E_B | \psi \rangle = \langle \psi | (+1)(-1) | \psi \rangle = -1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So we have a &amp;quot;probability&amp;quot; of &lt;strong&gt;minus&lt;/strong&gt; 1. How can this be a probability? In the original example, I have also calculated this and we get an expression in the function of the angle between the two axes, which can also be negative. This seems quite logical for two qubits A and B which are entangled in a way they will almost always have opposite spin direction, for example. So my question is: how can this probability be negative?&lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-09T10:31:41.913" Title="How does the probability of measurement turn out to be negative?" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5939" PostTypeId="2" ParentId="5938" CreationDate="2019-04-18T18:36:17.097" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle \psi \vert E_A E_B \vert \psi \rangle$&lt;/span&gt; is just the expectation value of the composite operator &lt;span class=&quot;math-container&quot;&gt;$E_AE_B$&lt;/span&gt; which, of course, can be negative. This is not the same as the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$\left\vert\uparrow \downarrow \right\rangle_{AB}$&lt;/span&gt; which in your case of  &lt;span class=&quot;math-container&quot;&gt;$\rho = \left\vert\uparrow \downarrow \right\rangle_{AB} \left\langle \uparrow \downarrow \right\vert_{AB}$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two values are related by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle \alpha \rangle = \sum_{i} h_i \phi_i $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\langle \alpha \rangle$&lt;/span&gt; is the expectation value of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$h_i$&lt;/span&gt;'s are the eigenvalues of the state in question and the &lt;span class=&quot;math-container&quot;&gt;$\phi_i$&lt;/span&gt;'s their respective probability amplitudes squared (&lt;em&gt;read&lt;/em&gt; probabilities). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy way to remember the difference is with the basic Schrodinger equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat{H} \vert \psi\rangle = E \vert \psi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where then the &lt;em&gt;expectation value&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle \hat{H} \rangle = \langle \psi \vert E \vert \psi \rangle = E$&lt;/span&gt; which is an energy and can be any real number you like, positive or negative. This, again, is not the probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6175" LastEditorUserId="26" LastEditDate="2019-04-18T19:14:50.383" LastActivityDate="2019-04-18T19:14:50.383" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5940" PostTypeId="2" ParentId="5935" CreationDate="2019-04-18T21:44:51.837" Score="2" Body="&lt;p&gt;I'm not sure what was the expected solution, but this also works.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, note that &lt;span class=&quot;math-container&quot;&gt;$$ I = |\phi^+\rangle\langle\phi^+| + |\phi^-\rangle\langle\phi^-| + |\psi^+\rangle\langle\psi^+| + |\psi^-\rangle\langle\psi^-|,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle, |\phi^-\rangle, |\psi^+\rangle, |\psi^-\rangle$&lt;/span&gt; are Bell states and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is 4-dimensional identity operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second observation is that if you apply teleportation scheme (that supposed to correctly work with &lt;span class=&quot;math-container&quot;&gt;$|\psi^-\rangle$&lt;/span&gt; entangled state) on the wrong entangled Bell state (for example, Alice and Bob could share &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|\psi^-\rangle$&lt;/span&gt;), then you will end up with one of this &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|r_0\rangle = a|0\rangle + b|1\rangle \\  &#xA;|r_1\rangle = a|0\rangle - b|1\rangle \\&#xA;|r_2\rangle = a|1\rangle + b|0\rangle \\&#xA;|r_3\rangle = a|1\rangle - b|0\rangle \\&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|r_0\rangle$&lt;/span&gt; is the teleported qubit. I'm sure it can be checked that for 4 possible &#xA;Bell states a fixed teleportation scheme will give exactly 4 different results &lt;span class=&quot;math-container&quot;&gt;$|r_0\rangle, |r_1\rangle, |r_2\rangle, |r_3\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if you will use teleportation scheme (specified to &lt;span class=&quot;math-container&quot;&gt;$|\psi^-\rangle$&lt;/span&gt;) with the entangled state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = (1 − \lambda)|\psi ^-\rangle \langle \psi ^- | + \frac{1}{4} \lambda I = \\ &#xA;= (1 − \lambda)|\psi ^-\rangle \langle \psi ^- | + \frac{1}{4} \lambda (|\phi^+\rangle\langle\phi^+| + |\phi^-\rangle\langle\phi^-| + |\psi^+\rangle\langle\psi^+| + |\psi^-\rangle\langle\psi^-|)&#xA;$$&lt;/span&gt; &#xA;then the result will be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;(1-\lambda)|r_0\rangle\langle r_0| + \frac{1}{4} \lambda (|r_0\rangle\langle r_0| + |r_1\rangle\langle r_1| + |r_2\rangle\langle r_2| + |r_3\rangle\langle r_3|)&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can check that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|r_0\rangle\langle r_0| + |r_1\rangle\langle r_1| + |r_2\rangle\langle r_2| + |r_3\rangle\langle r_3| = 2I&#xA;$$&lt;/span&gt;&#xA;for any random qubit &lt;span class=&quot;math-container&quot;&gt;$|r_0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the final teleported state will be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f = (1-\lambda)|r_0\rangle\langle r_0| + \frac{1}{4} \lambda \cdot 2I  =&#xA;(1-\lambda)|r_0\rangle\langle r_0| + \frac{1}{2} \lambda I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fidelity between &lt;span class=&quot;math-container&quot;&gt;$r = |r_0\rangle\langle r_0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\text{Tr}\sqrt{\sqrt{r}f\sqrt{r}}\right)^2 = \left(\text{Tr}\sqrt{rfr}\right)^2 = \left(\text{Tr}\sqrt{r((1-\lambda)r + \frac{1}{2} \lambda I)} r \right)^2 = \\&#xA;= \left(\text{Tr}\sqrt{(1-\lambda)r^3 + \frac{1}{2} \lambda r^2)} \right)^2 =&#xA;\left(\text{Tr}\sqrt{(1-\lambda)r + \frac{1}{2} \lambda r)} \right)^2 = \\&#xA;= \left(\text{Tr}\sqrt{\frac{1}{2}(2-\lambda)r} \right)^2 = \frac{1}{2}(2-\lambda)&#xA;$$&lt;/span&gt;&#xA;Note, that the link you shared contain the answer on the page 45 (but there &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is actually &lt;span class=&quot;math-container&quot;&gt;$1-\lambda$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-04-18T21:44:51.837" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5941" PostTypeId="2" ParentId="5938" CreationDate="2019-04-19T08:19:00.223" Score="2" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{E}_A(\hat{n})$&lt;/span&gt; is the projection on &lt;span class=&quot;math-container&quot;&gt;$\left|\uparrow_{\hat{n}}\right\rangle$&lt;/span&gt;, then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\boldsymbol{E}_A(\hat{n}) = \left|\uparrow_{\hat{n}}\right\rangle\left\langle \uparrow_{\hat{n}}\right|,&#xA;$$&lt;/span&gt;&#xA;Similarly, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\boldsymbol{E}_B(\hat{m}) = \left|\uparrow_{\hat{m}}\right\rangle \left\langle \uparrow_{\hat{m}}\right|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding projection on the composite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; is the tensor product of projections, that is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\boldsymbol{E}_{AB}(\hat{n},\hat{m}) = \boldsymbol{E}_A(\hat{n}) \otimes \boldsymbol{E}_B(\hat{m}) = \left|\uparrow_{\hat{n}}\right\rangle \left\langle \uparrow_{\hat{n}}\right| \otimes \left|\uparrow_{\hat{m}}\right\rangle \left\langle \uparrow_{\hat{m}}\right| = &#xA;\left|\uparrow_{\hat{n}}\uparrow_{\hat{m}}\right\rangle \left\langle \uparrow_{\hat{n}}\uparrow_{\hat{m}}\right|&#xA;. &#xA;$$&lt;/span&gt;&#xA;Now you can take the usual matrix product of &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{E}_{AB}(\hat{n},\hat{m})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; because they have the same size 4 x 4.&lt;br&gt;&#xA;The trace of the product of two non-negative (positive semi-definite) hermitian matrices always non-negative. So the answer must be non-negative.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-04-19T08:19:00.223" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5943" PostTypeId="1" CreationDate="2019-04-19T14:49:05.673" Score="3" ViewCount="59" Body="&lt;p&gt;Equation (7) in the 2012 paper, &lt;a href=&quot;https://arxiv.org/abs/1212.5046&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Complementarity Reveals Bound Entanglement of Two Twisted Photons&quot; of B. C. Hiesmayr and W. Löffler&lt;/a&gt; for a state &lt;span class=&quot;math-container&quot;&gt;$\rho_d$&lt;/span&gt; in the &quot;magic simplex&quot; of Bell states&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_d= \frac{q_4 (1-\delta (d-3)) \sum _{z=2}^{d-2} \left(\sum _{i=0}^{d-1}&#xA;   P_{i,z}\right)}{d}+\frac{q_2 \sum _{i=1}^{d-1} P_{i,0}}{(d-1) (d+1)}+\frac{q_3 \sum&#xA;   _{i=0}^{d-1} P_{i,1}}{d}+\frac{\left(-\frac{q_1}{d^2-d-1}-\frac{q_2}{d+1}-(d-3)&#xA;   q_4-q_3+1\right) \text{IdentityMatrix}\left[d^2\right]}{d^2}+\frac{q_1&#xA;   P_{0,0}}{d^2-d-1}&#xA;\end{equation}&lt;/span&gt;&#xA;yields &quot;for &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt; the one-parameter Horodecki-state, the first found bound entangled state&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No explicit ranges — in which I am interested — for the four &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; parameters are given, though. Any thoughts/insights?&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-04-19T15:03:08.693" LastActivityDate="2019-04-19T17:59:37.357" Title="What are the ranges of the four $q$ parameters in the magic simplex of Bell states formula?" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;photonics&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5944" PostTypeId="2" ParentId="5943" CreationDate="2019-04-19T17:59:37.357" Score="2" Body="&lt;p&gt;It looks like the only relation they say is &lt;span class=&quot;math-container&quot;&gt;$\text{IdentityMatrix}[3^2]=\sum P_{k,l}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You get a linear combination of &lt;span class=&quot;math-container&quot;&gt;$P_{k,l}$&lt;/span&gt;. Those are vertices of a &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt; simplex so the coefficents &lt;span class=&quot;math-container&quot;&gt;$c_{k,l}$&lt;/span&gt; are baryocentric coordinates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then match with the previous more general definition of &lt;span class=&quot;math-container&quot;&gt;$\rho_d$&lt;/span&gt; term by term on each of the &lt;span class=&quot;math-container&quot;&gt;$c_{k,l}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inequalities &lt;span class=&quot;math-container&quot;&gt;$0 \leq c_{k,l} \leq 1$&lt;/span&gt; turn into &lt;span class=&quot;math-container&quot;&gt;$2d^2$&lt;/span&gt; inequalities on the &lt;span class=&quot;math-container&quot;&gt;$q_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like that how the &lt;span class=&quot;math-container&quot;&gt;$q_i$&lt;/span&gt; were constructed in the first place.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-04-19T17:59:37.357" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5945" PostTypeId="1" CreationDate="2019-04-19T18:55:50.223" Score="5" ViewCount="318" Body="&lt;p&gt;Can someone explain to me how to build a quantum circuit representing the Ising Model? I just want to understand how to represent the Ising Model for the purposes of quantum state label classification. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="119" LastEditDate="2019-04-24T02:35:02.043" LastActivityDate="2019-04-24T02:35:02.043" Title="How to build a quantum circuit representing the Ising Model?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5946" PostTypeId="1" AcceptedAnswerId="5948" CreationDate="2019-04-20T14:22:37.140" Score="2" ViewCount="100" Body="&lt;p&gt;In the &quot;Quantum Computation and Quantum Information 10th Anniversary textbook by Nielsen and Chuang&quot;, chapter 5.3.1 introduces the concept of solving the Order-Finding Problem.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Eqn 5.36) states the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|y\rangle = |xy\text{ mod } N\rangle \text{ whereby } x&amp;lt;N \text{ and } \gcd(x,N)=1$$&lt;/span&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(Eqn 5.37) defines the eigenstates of the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|u_s\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}\exp\left(\frac{-2\pi isk}{r}\right)\left|x^k\text{ mod } N\right\rangle \text{ for integer } 0 \leq s \leq r-1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Then when &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$|u_s\rangle$&lt;/span&gt;, (Eqn 5.38 to 5.39) gives:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|u_s\rangle = \frac{1}{\sqrt{r}} \sum_{k=0}^{r-1}\exp\left(\frac{-2\pi isk}{r}\right) |x^{k+1}\text{ mod } N\rangle = \exp\left(\frac{2\pi is}{r}\right)|u_s\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried to work out Eqn 5.38 to 5.39 by substituting the index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; as dummy index &lt;span class=&quot;math-container&quot;&gt;$v=k+1$&lt;/span&gt; which I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|u_s\rangle = \exp\left(\frac{2{\pi}is}{r}\right) \frac{1}{\sqrt{r}}\sum_{v=1}^{r}\exp\left(\frac{-2\pi isv}{r}\right)|x^v\text{ mod }N\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{r}}\sum_{v=1}^{r}\exp\left(\frac{-2\pi isv}{r}\right)|x^v\text{ mod }N\rangle = |u_s\rangle$&lt;/span&gt; when the summation limits are different?&#xA;&lt;span class=&quot;math-container&quot;&gt;$|x^0\text{ mod }N\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|x^r\text{ mod }N\rangle$&lt;/span&gt; are not the same right?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="26" LastEditDate="2019-04-21T07:09:04.363" LastActivityDate="2019-04-21T12:13:53.583" Title="Eigenstate of unitary operator used for Order-Finding" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="5948" PostTypeId="2" ParentId="5946" CreationDate="2019-04-21T10:58:58.943" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x^0 \bmod N = 1 \implies x^r \bmod N = 1$$&lt;/span&gt; as by definition, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the order of &lt;span class=&quot;math-container&quot;&gt;$x \bmod N$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the least integer that satisfies &lt;span class=&quot;math-container&quot;&gt;$x^r=pN+1$&lt;/span&gt; for some  integer &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="26" LastEditDate="2019-04-21T12:13:53.583" LastActivityDate="2019-04-21T12:13:53.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5949" PostTypeId="1" CreationDate="2019-04-21T19:58:52.477" Score="1" ViewCount="271" Body="&lt;p&gt;Let's say I have a vector &lt;span class=&quot;math-container&quot;&gt;$\vec{v}=(1,0)$&lt;/span&gt; and a state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, and a decimal number &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;. I know that I can associate the decimal &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; with the vector &lt;span class=&quot;math-container&quot;&gt;$\vec{v}$&lt;/span&gt;, but can I also associate the state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; with the decimal &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;? Is there some kind of isomorphism between these two, which I don't think there is because the state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; corresponds to a 4 dimensional vector. Can someone clarify these doubts?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-22T19:28:16.873" LastActivityDate="2019-04-22T19:28:16.873" Title="Associating quantum states with decimal numbers" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5950" PostTypeId="2" ParentId="5949" CreationDate="2019-04-21T23:11:10.923" Score="5" Body="&lt;p&gt;Let's use four bits/qubits for exposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With four bits, you want there to be an isomorphism between the classical vectors &lt;span class=&quot;math-container&quot;&gt;$(d,c,b,a)$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$d,c,b,a\in \{0,1\}$&lt;/span&gt;) and decimal numbers &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;.  There is the obvious mapping &lt;span class=&quot;math-container&quot;&gt;$D=8d+4c+2b+a$&lt;/span&gt;.  If you have &lt;span class=&quot;math-container&quot;&gt;$(d,c,b,a)=(0,0,1,1)$&lt;/span&gt; then you map to &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have four qubits that you &lt;em&gt;know&lt;/em&gt; are in &lt;span class=&quot;math-container&quot;&gt;$\vert dcba\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$(d,c,b,a)=(0,0,1,1)$&lt;/span&gt; (because, say, you measured them) then it's OK to have that same mapping.  The qubits are, in sense, classical bits after measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you're nervous about whether this mapping is still valid even when the system is in a superposition.  But why wouldn't it be?  After Hadamarding &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits that are initially &lt;span class=&quot;math-container&quot;&gt;$\vert 0000 \rangle$&lt;/span&gt; then you can think of it as a uniform superpositon of &lt;span class=&quot;math-container&quot;&gt;$\vert 0000\rangle, \vert 0001\rangle, \cdots, \vert 1111\rangle$&lt;/span&gt; or as a uniform superposition of &lt;span class=&quot;math-container&quot;&gt;$0,1,\cdots ,15$&lt;/span&gt; as you see fit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classically, with modern electronic computers, we have an &quot;isomorphism&quot; between bits and voltages. For example, we can equate +0V to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and +1.1V to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. If we have a plurality of inputs, then we can equate the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; input voltages to an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit binary number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum mechanically, we have an &quot;isomorphism&quot; between, say, qubits and spin states.  For example, we can equate spin down to &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;, and spin up to &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;.  If we have a plurality of spin states, then we can equate a superposition of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; spin states to a superposition of an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit binary number.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-04-22T12:11:24.737" LastActivityDate="2019-04-22T12:11:24.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5951" PostTypeId="1" CreationDate="2019-04-22T00:20:46.663" Score="4" ViewCount="74" Body="&lt;p&gt;From official &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/c_gs_1.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave docs&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The D-Wave 2000Q QPU has up to 2048 qubits and 6016 couplers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For example, I have the optimization problem defined as the QUBO problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to solve it on D-Wave, does it mean that my problem has to have at most 2048 variables (vertices) and no more than 6016 mutual dot products between variables (edges)?&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2019-04-22T22:16:07.743" LastActivityDate="2021-03-12T23:37:25.300" Title="What does it mean to have 2000 qubits and 6016 couplers?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;optimization&gt;&lt;graph-states&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5952" PostTypeId="1" AcceptedAnswerId="5953" CreationDate="2019-04-22T05:29:18.183" Score="5" ViewCount="1413" Body="&lt;p&gt;Say we have a single qubit with some density matrix, for example lets say we have the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=\begin{pmatrix}3/4&amp;amp;1/2\\1/2&amp;amp;1/2\end{pmatrix}$&lt;/span&gt;. I would like to know what is the procedure for checking whether this state is pure or mixed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that a pure state is one which can be written &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\langle\psi|$&lt;/span&gt;, and that a mixed state is one which can be written &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_{k=1}^Np_k|\psi_k\rangle\langle\psi_k|$&lt;/span&gt;. But I have two problems. Firstly I'm not sure what the &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; is, I know it's called the weight function but I don't understand it significance, how to find it, or its role mathematically. Secondly I don't see how it is possible to determine from these definition whether the sate I mentioned above is pure or mixed. How can we? Or perhaps there's some method that doesn't use the definitions directly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could anyone please clear up this problem for me ?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="55" LastEditDate="2021-02-14T18:58:37.717" LastActivityDate="2021-02-14T18:58:37.717" Title="How to show a density matrix is in a pure/mixed state?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5953" PostTypeId="2" ParentId="5952" CreationDate="2019-04-22T06:04:32.870" Score="8" Body="&lt;p&gt;First, the example that you give is not a density matrix (they must have trace 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second, you’re asking how to go from the matrix into an operator representation that is not unique. So, there are many ways of doing this. However, a particularly natural way of decomposing it is using the spectral decomposition. The weights are the eigenvalues and the states are the corresponding eigenvectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if all you want to do is determine if the state is mixed, there’s a simpler way: calculate the trace of the square of the density matrix, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)$&lt;/span&gt;. That's called the &lt;em&gt;purity&lt;/em&gt;. If it’s 1, the state is pure. If it’s less than 1, the state is mixed. If it’s more than 1, you’ve messed up.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-04-23T07:32:05.340" LastActivityDate="2019-04-23T07:32:05.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5954" PostTypeId="2" ParentId="5952" CreationDate="2019-04-22T06:09:24.343" Score="6" Body="&lt;p&gt;By spectral theorem density matrices are diagonizable, since they are hermitian (also they are positive semi-definite and have trace 1). That means that there is a set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; non-negative eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; corresponding mutually orthogonal eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|v_i\rangle$&lt;/span&gt; such that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_{i=1}^n{\lambda_i |v_i\rangle \langle v_i|}&#xA;$$&lt;/span&gt;&#xA;This matrix represents pure state only if it has exactly one non-zero eigenvalue (it must be equal to 1 since &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho)=\sum_{i=1}^n{\lambda_i}=1$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to analyze density matrix you just need to find eigenvalues and eigenvectors.&lt;br&gt;&#xA;Though, to check if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure it is enough to verify the equality &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}(\rho^2)=1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="26" LastEditDate="2019-04-22T19:32:05.290" LastActivityDate="2019-04-22T19:32:05.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5956" PostTypeId="1" CreationDate="2019-04-22T18:59:36.443" Score="4" ViewCount="31" Body="&lt;p&gt;Two recent papers of Jun-Li Li and Cong-Feng Qiao (&lt;a href=&quot;https://arxiv.org/abs/1607.03364&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1607.03364&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1708.05336&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1708.05336&lt;/a&gt;) present &quot;practical schemes for the decomposition of a bipartite mixed state into a sum of direct products of local density matrices&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if this methodology can be applied to (two-qubit, qubit-qutrit, two-qutrit,...) &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-states (only the diagonal and antidiagonal entries of the corresponding density matrices being non-zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this can be successfully accomplished, it might be useful in addressing the question of what amount, if any, does the two-retrit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-state Hilbert-Schmidt PPT-probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{16}{3 \pi^2} \approx 0.54038$&lt;/span&gt; correspond to bound entangled states--an issue I have raised in my earlier postings (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5864/are-x-state-separability-and-ppt-probabilities-the-same-for-the-two-qubit-qubi&quot;&gt;Are X-state separability and PPT- probabilities the same for the two-qubit, qubit-qutrit, two-qutrit, etc. states?&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5897/what-proportions-of-certain-sets-of-ppt-two-retrit-states-are-bound-entangled-or&quot;&gt;What proportions of certain sets of PPT-two-retrit states are bound entangled or separable?&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-04-22T19:11:58.960" LastActivityDate="2019-04-22T19:11:58.960" Title="Finding separable decompositions of bipartite X-states using the methodology of Li and Qiao" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5957" PostTypeId="1" AcceptedAnswerId="5963" CreationDate="2019-04-22T23:35:41.107" Score="4" ViewCount="285" Body="&lt;p&gt;My understanding of the Bernstein-Vazirani algorithm is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We have a black box oracle with secret string &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. The black box does&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(x) =s\cdot{x}=(\sum_1^n s_i\cdot{x_i})$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We run each qubit through a Hadamard gate first, then through the oracle:&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$s_i = 0$&lt;/span&gt;, nothing happens and the ith qubit is still in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. If &lt;span class=&quot;math-container&quot;&gt;$s_i = 1$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th qubit picks up a phase and is now in the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We run ignore the output and run the inputs qubits through another Hadamard gate, and now we've recovered s with only a single query!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The part I don't understand is that nothing about the oracle (1) promises this phase kickback will occur. The references I've seen seem to implicitly assume this, why are they assuming this behavior?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even the first reference, which describes a CNOT-gate based implementation of this oracle, only does so after the solution — which to me suggests that the implementation is a detail rather than a necessary feature of the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I'd have no issues if the oracle was explicitly stated to have this phase kickback behavior, but its seems like this condition is being taken for granted.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://people.cs.uchicago.edu/~ftchong/33001/lecture08.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;CMSC 33001: Novel Computing Architectures and Technologies (Lecture 8)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.scottaaronson.com/qclec/18.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture 18, Tues March 28: Bernstein-Vazirani, Simon (Scott Aaronson)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://pages.cs.wisc.edu/~dieter/Courses/2010f-CS880/Scribes/04/lecture04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture 4:  Elementary Quantum Algorithms (Dieter van Melkebeek)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://courses.cs.washington.edu/courses/cse599d/06wi/lecturenotes7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;CSE 599d - Quantum Computing: The Recursive and Nonrecursive Bernstein-Vazirani Algorithm (Dave Bacon)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="6304" LastEditorUserId="6304" LastEditDate="2019-04-26T23:07:19.467" LastActivityDate="2019-04-26T23:07:19.467" Title="Is the Bernstein-Vazirani algorithm dependent on the specific behavior of the oracle?" Tags="&lt;algorithm&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5958" PostTypeId="1" CreationDate="2019-04-23T01:06:17.220" Score="8" ViewCount="456" Body="&lt;p&gt;A quantum circuit can use any unitary operator. Its matrix is exponential in the number of input bits. In practice how can this ever be possible (aside from operators which are tensor products), i.e. how can you construct exponential size matrix?&lt;/p&gt;&#xA;" OwnerUserId="6306" LastEditorUserId="26" LastEditDate="2019-04-23T07:51:15.333" LastActivityDate="2019-04-23T18:05:43.513" Title="How is it possible to implement unitary operator when its size is exponential in inputs?" Tags="&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5959" PostTypeId="1" AcceptedAnswerId="6083" CreationDate="2019-04-23T02:10:49.750" Score="2" ViewCount="162" Body="&lt;p&gt;I wrote an implementation of Grover's algorithm that looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, Aer, execute&#xA;&#xA;# Initialize circuit&#xA;m_qubit = QuantumRegister(1)&#xA;search_register = QuantumRegister(4)&#xA;result_register = ClassicalRegister(4)&#xA;ancillaries = QuantumRegister(3)&#xA;circuit = QuantumCircuit(search_register, result_register, m_qubit, ancillaries)&#xA;&#xA;# Put M qubit into 1-superposition&#xA;circuit.x(m_qubit)&#xA;circuit.h(m_qubit)&#xA;&#xA;# Put search qubits into superposition&#xA;circuit.h(search_register)&#xA;&#xA;for _ in range(2):&#xA;&#xA;    # Encode S1 * !S2 * S3&#xA;    circuit.x( search_register[2] )&#xA;    circuit.ccx( search_register[1], search_register[2], ancillaries[0] )&#xA;    circuit.ccx( search_register[3], ancillaries[0], ancillaries[1] )&#xA;    circuit.x( search_register[2] )&#xA;&#xA;    # Encode S0 * S1&#xA;    circuit.ccx( search_register[0], search_register[1], ancillaries[2] )&#xA;&#xA;    # Encode oracle ((S0 * S1) + (S1 * !S2 * S3))&#xA;    circuit.x(ancillaries)&#xA;    circuit.ccx( ancillaries[1], ancillaries[2], m_qubit[0] )&#xA;    circuit.x(ancillaries)&#xA;    circuit.x(m_qubit)&#xA;&#xA;    # Reset ancillaries to be used later&#xA;    circuit.reset(ancillaries)&#xA;&#xA;    # Do rotation about the average&#xA;    circuit.h(search_register)&#xA;    circuit.x(search_register)&#xA;    circuit.ccx( search_register[0], search_register[1], ancillaries[0] )&#xA;    circuit.ccx( search_register[2], ancillaries[0], ancillaries[1] )&#xA;    circuit.ccx( search_register[3], ancillaries[1], m_qubit[0] )&#xA;    circuit.x(search_register)&#xA;    circuit.x(m_qubit)&#xA;    circuit.h(search_register)&#xA;&#xA;    # Reset ancillaries for use later&#xA;    circuit.reset(ancillaries)&#xA;&#xA;circuit.measure(search_register, result_register)&#xA;&#xA;# Run the circuit with a given number of shots&#xA;backend_sim = Aer.get_backend('qasm_simulator')&#xA;job_sim = execute(circuit, backend_sim, shots = 1024)&#xA;result_sim = job_sim.result()&#xA;&#xA;# get_counts returns a dictionary with the bit-strings as keys&#xA;# and the number of times the string resulted as the value&#xA;print(result_sim.get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Essentially, this circuit should search for any value that matches &lt;span class=&quot;math-container&quot;&gt;$X_1 X_2 X_3 + X_0 X_1$&lt;/span&gt;. When I do the math for this circuit I get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{1024 \sqrt{2}} \left( -304 \left( \sum_{x \in \{00, 01, 11\}} \left| x \right&amp;gt; \left( \left|00\right&amp;gt; + \left|01\right&amp;gt; + \left|10\right&amp;gt; \right) + \left|1000\right&amp;gt; + \left|1001\right&amp;gt; \right) + 80 \left( \sum_{x = 00}^{11} \left|x\right&amp;gt; \left|11\right&amp;gt; + \left|1010\right&amp;gt; \right) \right) \left( \left|0\right&amp;gt; - \left|1\right&amp;gt; \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These amplitudes correspond to probabilities of &lt;span class=&quot;math-container&quot;&gt;$-\frac{{304}^{2}}{2({1024}^{2})} = -\frac{{19}^{2}}{2({64}^{2})}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{{80}^{2}}{2({1024}^{2})} = \frac{{5}^{2}}{2({64}^{2})}$&lt;/span&gt; for the unsuccessful and successful probabilities, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand from this is how the successful outputs would appear over the unsuccessful ones, because the magnitude of the probability for the unsuccessful results is much higher. Can someone explain how the normalization is done in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, these results do not obtain when I actually &lt;em&gt;run&lt;/em&gt; the circuit. Instead of a step-function for the probabilities, when I run 1024 shots I tend to get between 30 and 50 for the unsuccessful results and the successful results are spread between 200 and 460. While it's obvious that the successful results have been selected, the spread is concerning because the math seems to indicate that they should be fairly close together. Moreover, the successful results always fall in the same order, which is also counter-intuitive given that results are probabilistic. This implies one of two things to me:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The superposition isn't actually equal (i.e. there's some bias towards one value versus the other). However, this doesn't make sense as these results were obtained with a simulator so they should be very close to optimal.&lt;/li&gt;&#xA;&lt;li&gt;I have inadvertently entangled the qubits in such a way that the result is affected.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Any insight into this would be greatly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="26" LastEditDate="2019-04-26T14:28:58.537" LastActivityDate="2019-05-07T01:52:57.640" Title="Grover's algorithm returns skewed probability distribution" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5960" PostTypeId="5" CreationDate="2019-04-23T04:57:42.143" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-23T04:57:42.143" LastActivityDate="2019-04-23T04:57:42.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5961" PostTypeId="4" CreationDate="2019-04-23T04:57:42.143" Score="0" Body="For questions on the Bernstein-Vazirani algorithm." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-23T04:57:42.143" LastActivityDate="2019-04-23T04:57:42.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5962" PostTypeId="2" ParentId="5958" CreationDate="2019-04-23T07:17:20.817" Score="8" Body="&lt;p&gt;The key is that you don't &lt;em&gt;actually&lt;/em&gt; construct a matrix. Yes, if you wanted to simulate a quantum computation on a classical computer, one method is to build the corresponding unitary matrix, and this is essentially why (unless there's special structure) it's impossible to efficiently perform a classical simulation of quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, think on this point: if I have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum system and I do nothing to it, that is described by a &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; identity matrix. So, by your way of thinking, I have constructed a special case of an exponential size matrix. But the point is that we just do some operation. It might be represented by a matrix, but we never look at that matrix, never construct it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic quantum operations that we use are thought about in this way - you only really do anything to one or two qubits at a time and you make it exponential size by adding identities (&quot;do nothing&quot;) to all the other qubits. Combining a small number of these acting on different sets of qubits can create some unitary matrices that are not tensor products.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, while a quantum computer can in principle implement any unitary operator, universality in that sense doesn't say anything about how long the construction takes. The vast, overwhelming, majority of them &lt;em&gt;do&lt;/em&gt; take exponential time to implement. Quantum computation is specifically interested in finding that Goldilocks zone, those small number of instances which can be implemented in polynomial time and give an interesting computation that cannot be computed in polynomial time on a classical computer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-04-23T14:36:31.947" LastActivityDate="2019-04-23T14:36:31.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5963" PostTypeId="2" ParentId="5957" CreationDate="2019-04-23T08:03:55.573" Score="6" Body="&lt;p&gt;The whole point of an oracle-based algorithm is that it does depend on the promised structure of the oracle. For Bernstein-Vazirani, it is assumed that the oracle acts as &lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle|y\rangle\rightarrow |x\rangle|y\oplus (x\cdot s)\rangle.&#xA;$$&lt;/span&gt;&#xA;That is the fundamental starting point (and is just the reversible implementation of &lt;span class=&quot;math-container&quot;&gt;$x\cdot s$&lt;/span&gt;). If you didn't have an oracle that did this, all bets would be off (this is one of the key reasons why we haven't proven that quantum computation is faster that classical - the only proven speedups are with respect to specific oracles, but that can never eliminate the possibility of different oracles offering different results).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that this definition of the oracle involves &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; qubits, the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits of input and one ancilla qubit. The way that you've described the functionality does not quite fit with this. The way that you've written it seems to suggest that you're expecting &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\mapsto|x\oplus s\rangle$&lt;/span&gt;. This is not the case. Indeed, if that were the case, then what you'd actually have to state for the oracle is&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We have a black box oracle with secret string s. For each bit, if &lt;span class=&quot;math-container&quot;&gt;$s_i=1$&lt;/span&gt; then 0 is mapped to 1 and 1 is mapped to 0. If &lt;span class=&quot;math-container&quot;&gt;$s_i=0$&lt;/span&gt; then it is unchanged.&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$s_i=1$&lt;/span&gt; then it also maps &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-|-\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is the result of linearity: if &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\mapsto|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\mapsto|1\rangle$&lt;/span&gt;, then this is the identity map; whatever you input is what you output. Meanwhile, if &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\mapsto|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\mapsto|0\rangle$&lt;/span&gt;, then it must be that &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)\mapsto(|1\rangle+|0\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle-|1\rangle)\mapsto(|1\rangle-|0\rangle)$&lt;/span&gt;. Moreover, determining &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; would be trivial; we'd just input &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt;, and read the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, what you actually have to do is make sure that you input the state &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle-|1\rangle)/\sqrt{2}$&lt;/span&gt; on the ancilla qubit. In doing so, the state of the ancilla qubit will not change. So, we can describe the net effect on just the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; other qubits as being&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle\mapsto (-1)^{s\cdot x}|x\rangle.&#xA;$$&lt;/span&gt;&#xA;This is the phase kick-back that you mention. Notice that if all you do is use basis states, then the phase is undetectable. However, if you input the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes n}$&lt;/span&gt;, as you mention, then you do indeed get the output &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}|s\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-23T08:03:55.573" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="5964" PostTypeId="1" AcceptedAnswerId="5971" CreationDate="2019-04-23T14:46:54.680" Score="6" ViewCount="429" Body="&lt;p&gt;I need to plot drawings of qubit dynamics on the Bloch sphere. I know QuTip allows to do such drawings but I specifically need to represent evolution velocities on the Bloch sphere so I need to draw tangent vectors. Is there a way I can do it with QuTip? More generally it would be good to be able to draw affine vectors with QuTip. Do you know of any way I can do it? If this cannot be done with QuTip do you know of any other software that allows me to do it?&lt;/p&gt;&#xA;" OwnerUserId="2490" LastEditorUserId="55" LastEditDate="2019-04-24T11:39:25.197" LastActivityDate="2019-04-24T11:39:25.197" Title="Drawing tangent vectors to the Bloch sphere with qutip" Tags="&lt;programming&gt;&lt;bloch-sphere&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5965" PostTypeId="1" CreationDate="2019-04-23T16:27:16.803" Score="6" ViewCount="119" Body="&lt;p&gt;A well-known way of encoding &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; levels of a harmonic (bosonic) oscillator is as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    |n\rangle = |1\rangle^{\otimes n} \otimes |0\rangle^{\otimes N-n+1}&#xA;    \quad,\qquad&#xA;    0\leq n \leq N&#xA;    \quad,&#xA;\end{equation}&lt;/span&gt;&#xA;with the ladder operators being defined as:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    \label{bosenc}&#xA;    \begin{alignedat}{99}&#xA;    a &amp;amp;= |000\rangle\langle100|_{1,\,2,\,3} + \sum\limits_{j=2}^{N} \sqrt{j}|100\rangle\langle110|_{j-1,\,j,\,j+1} + \sqrt{N+1}|110\rangle\langle111|_{N-1,\,N,\,N+1}&#xA;    \quad&amp;amp;&amp;amp;,\\&#xA;    a^\dagger &amp;amp;= |100\rangle\langle000|_{1,\,2,\,3} + \sum\limits_{j=2}^{N} \sqrt{j}|110\rangle\langle100|_{j-1,\,j,\,j+1} + \sqrt{N+1}|111\rangle\langle110|_{N-1,\,N,\,N+1}&#xA;    \quad&amp;amp;&amp;amp;.&#xA;    \end{alignedat}&#xA;\end{equation}&lt;/span&gt;&#xA;The subscripts denote on which qubits the term is acting (for the rest of qubits it's just the unity operator).&#xA;Indeed, one can check that the commutator of the so-defined operators is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    [a,\,a^\dagger] = \sum \limits_{n=0}^{N} |n\rangle\langle n| - (N+1)|N+1\rangle\langle N+1| \quad.&#xA;\end{equation}&lt;/span&gt;&#xA;(the last term being the unavoidable 'correction' due to the absence of finite-dimensional representations of the Heisenberg algebra)&lt;/p&gt;&#xA;&lt;p&gt;An obvious downside of such an approach is that we are only using &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; out of total of &lt;span class=&quot;math-container&quot;&gt;$2^{N+1}$&lt;/span&gt; states of the &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; qubit system. The main advantage, however, stems from the fact that the raising and lowering operators are &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-local, and contain only &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; terms each.&lt;/p&gt;&#xA;&lt;p&gt;Is anybody aware of more efficient ways of storing bosonic degrees of freedom? I'm personally interested in encoding multiple bosonic degrees of freedom having various numbers of levels; so, not only I'm interested in &amp;quot;what's the minimum number of qubits required to efficiently work with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; bosonic levels?&amp;quot;, but also &amp;quot;given a fixed number of qubits, how many bosonic oscillators (with, possibly, different number of levels) can one efficiently encode?&amp;quot; Obviously, 'efficiently' here implies that the raising and lowering operators have some reasonable scaling properties.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The approach opposite to the one presented above was suggested by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5965/encoding-bosonic-degrees-of-freedom?noredirect=1#comment8921_5965&quot;&gt;Craig Gidney in comments&lt;/a&gt;: one can encode the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th level of the oscillator with its binary representation &lt;span class=&quot;math-container&quot;&gt;$|(n)_2\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$(\ldots)_2$&lt;/span&gt; stands for the binary form of the number. The number of terms in the expression for ladder operators is the same as in the first approach (it is exponential in the number of qubits - but the number of qubits itself is logarithmic in the number of levels). Note, however, that the main downside of this approach is that each term in the sum is not &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;- or any fixed number-local. Instead, they all are &lt;span class=&quot;math-container&quot;&gt;$\log N$&lt;/span&gt;-local:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a = \underbrace{|\ldots0000\rangle}_{\text{$\log N$ qubits}}\langle\ldots0001| + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It would be interesting though to find a compromise between these two approaches.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-04-24T17:42:12.963" Title="Encoding bosonic degrees of freedom" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5966" PostTypeId="2" ParentId="5958" CreationDate="2019-04-23T18:05:43.513" Score="2" Body="&lt;p&gt;Note that there is nothing specifically quantum about this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An arbitrary classical operation over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &lt;em&gt;bits&lt;/em&gt; can also be represented as a &lt;span class=&quot;math-container&quot;&gt;$2^n\times2^n$&lt;/span&gt; matrix, describing where each input bitstring is sent by the operation. Such matrices are permutation matrices for deterministic operations (in which case using matrices is a bit pointless as there is no notion of &quot;linear combinations of inputs&quot;), or more generally &lt;a href=&quot;https://en.wikipedia.org/wiki/Stochastic_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;stochastic matrices&lt;/a&gt; if one wants to also describe probabilistic processes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The dimension of these matrices also clearly increases exponentially with the number of bits, but this is a non-issue, as it has no connection with how difficult it actually is to implement the corresponding operation, for the reasons laid out in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5962/55&quot;&gt;other answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-04-23T18:05:43.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5967" PostTypeId="2" ParentId="2110" CreationDate="2019-04-24T01:29:42.277" Score="3" Body="&lt;p&gt;Given the oracle you have provided, the search is indeed pointless. However, that oracle misses the point of Grover's algorithm because searching for a card in a deck of cards is not an unstructured search because, as you stated, you already know the order. Ergo, your search is structured. The reason this oracle is used is that it demonstrates how Grover's may be applied without having to discuss an oracle that would make Grover's useful because such an oracle would be more complicated than valuable. Therefore, a better oracle to demonstrate the usefulness of Grover's might be something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x) = \begin{cases} &#xA;         1, &amp;amp; x[0, \ldots, 3] + x[4, \ldots, 7] = 1010 \\&#xA;         0, &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this oracle implies is that you have an 8-qubit search where you take the first four qubits and add them to the second four qubits and flip M if the addition makes 10 (1010 in binary). The difference between this oracle and the one you provided is that this oracle tests a pattern (do the operands add to 10) whereas yours tests equality (is this index 5). This oracle is much more difficult to build but it leverages the true power of Grover's, which is, in essence, a brute-force search where your oracle defines the search space.&lt;/p&gt;&#xA;" OwnerUserId="5472" LastEditorUserId="26" LastEditDate="2019-04-24T04:42:43.660" LastActivityDate="2019-04-24T04:42:43.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5968" PostTypeId="1" AcceptedAnswerId="5970" CreationDate="2019-04-24T08:02:20.937" Score="2" ViewCount="530" Body="&lt;p&gt;I need to write the tensorial representation of the Controlled Swap Gate, what I have written is &#xA;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{CSWAP}=|0\rangle\langle0|\otimes I\otimes I+|1\rangle\langle1|\otimes U$&lt;/span&gt;, where U is the matrix of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CSWAP}$&lt;/span&gt; gate transformation, i.ethat is &lt;span class=&quot;math-container&quot;&gt;$$|00\rangle\to |00\rangle=1|00\rangle+0|01\rangle+0|10\rangle +0|11\rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |01\rangle=0|00\rangle+0|01\rangle+1|10\rangle +0|11\rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|10\rangle=0|00\rangle+1|01\rangle+0|10\rangle +0|11\rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|11\rangle=0|00\rangle+0|01\rangle+0|10\rangle +1|11\rangle,$$&lt;/span&gt; so the matrix becomes &lt;span class=&quot;math-container&quot;&gt;$$U=\begin{bmatrix}&#xA;1 &amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1&#xA;\end{bmatrix},$$&lt;/span&gt;&#xA;Is this the correct implementation? Just to add a bit, how do I make this &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit gate as a tensor product of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit gate so that there is uniformity in the equation above?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-28T13:16:32.853" LastActivityDate="2019-04-28T13:16:32.853" Title="What is the tensorial representation of the quantum swap gate?" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5969" PostTypeId="2" ParentId="5968" CreationDate="2019-04-24T08:53:01.483" Score="1" Body="&lt;p&gt;Yes, that is the correct matrix representation of the CSWAP (also often referred to as &lt;a href=&quot;https://en.wikipedia.org/wiki/Fredkin_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fredkin gate&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding writing it as a &quot;&lt;em&gt;tensor product of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit gates&lt;/em&gt;&quot;, the only missing step is writing the swap in braket notation, which you can do as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{SWAP}=\lvert00\rangle\!\langle00\rvert+\lvert11\rangle\!\langle11\rvert+\lvert01\rangle\!\langle10\rvert+\lvert10\rangle\!\langle01\rvert,$$&lt;/span&gt;&#xA;so that the overall gate reads&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\operatorname{CSWAP}&amp;amp;=|0\rangle\!\langle0|\otimes I\otimes I+|1\rangle\!\langle1|\otimes \operatorname{SWAP}\\&#xA;&amp;amp;=|0\rangle\!\langle0|\otimes I\otimes I+|1\rangle\!\langle1|\otimes(\lvert00\rangle\!\langle00\rvert+\lvert11\rangle\!\langle11\rvert+\lvert01\rangle\!\langle10\rvert+\lvert10\rangle\!\langle01\rvert).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-04-24T09:54:15.057" LastActivityDate="2019-04-24T09:54:15.057" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5970" PostTypeId="2" ParentId="5968" CreationDate="2019-04-24T09:22:12.473" Score="2" Body="&lt;p&gt;SWAP is a two-qubit gate and needs to be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}=|00\rangle\langle 00|+|11\rangle\langle 11|+|01\rangle\langle 10|+|10\rangle\langle 01|.&#xA;$$&lt;/span&gt;&#xA;If you want to write this in terms of Pauli-operators, for example, you might write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}=\frac12\left(\mathbb{I}\otimes\mathbb{I}+Z\otimes Z+X\otimes X+Y\otimes Y\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-24T09:22:12.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5971" PostTypeId="2" ParentId="5964" CreationDate="2019-04-24T11:36:47.227" Score="6" Body="&lt;p&gt;First of all, &lt;code&gt;qutip&lt;/code&gt; is not a visualisation library, even though it does provide some visualisation functionalities, mostly leveraging &lt;code&gt;matplotlib&lt;/code&gt;.&#xA;However, because &lt;code&gt;qutip&lt;/code&gt; does provide handy functionalities to plot Bloch spheres and points on it, it does make sense to ask how one can tweak such functionalities to for example add tangent vectors to the bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading &lt;a href=&quot;http://qutip.org/docs/4.1/guide/guide-bloch.html&quot; rel=&quot;noreferrer&quot;&gt;the relevant doc page&lt;/a&gt;, this functionality does not seem to have been implemented.&#xA;However, having a look at the &lt;a href=&quot;https://github.com/qutip/qutip/blob/199bed53d3745e6400990fa259d9e7e6862781fa/qutip/bloch.py&quot; rel=&quot;noreferrer&quot;&gt;relevant source code&lt;/a&gt;, it does not seem particularly difficult to add manually additional vectors to the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, at least in the current version of &lt;code&gt;qutip&lt;/code&gt;, the vectors are added via the method &lt;a href=&quot;https://github.com/qutip/qutip/blob/199bed53d3745e6400990fa259d9e7e6862781fa/qutip/bloch.py#L538&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;plot_vectors&lt;/code&gt;&lt;/a&gt;, which &lt;a href=&quot;https://github.com/qutip/qutip/blob/199bed53d3745e6400990fa259d9e7e6862781fa/qutip/bloch.py#L555-L559&quot; rel=&quot;noreferrer&quot;&gt;creates the arrows using an &lt;code&gt;Arrow3D&lt;/code&gt; object&lt;/a&gt;.&#xA;One can add any other vector to the sphere by simply adding new &lt;code&gt;Arrow3D&lt;/code&gt; objects to the underlying matplotlib &lt;code&gt;axes&lt;/code&gt; object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of how to do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;%matplotlib inline&#xA;import qutip&#xA;b = qutip.Bloch()&#xA;b.render(b.fig, b.axes)&#xA;new_arrow = qutip.bloch.Arrow3D(xs=[1, 1], ys=[0, .5], zs=[0, .5],&#xA;                    mutation_scale=b.vector_mutation,&#xA;                    lw=b.vector_width, arrowstyle=b.vector_style, color='blue')&#xA;b.axes.add_artist(new_arrow)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a5Mnp.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a5Mnp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;note that we need to call explicitly &lt;code&gt;b.render&lt;/code&gt; instead of &lt;code&gt;b.show&lt;/code&gt; because we need the &lt;code&gt;axes&lt;/code&gt; object to be created but the plot to not be drawn before we add the new arrow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just change the coordinates given to the parameters &lt;code&gt;xs&lt;/code&gt;, &lt;code&gt;ys&lt;/code&gt;, &lt;code&gt;zs&lt;/code&gt; to decide what vectors to draw.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final more or less unrelated note, you might also be interested in the drawing library &lt;code&gt;plotly&lt;/code&gt;, which allows to build very nice 3d plots (see e.g. &lt;a href=&quot;https://plot.ly/python/3d-parametric-plots/&quot; rel=&quot;noreferrer&quot;&gt;these examples&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-04-24T11:36:47.227" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5972" PostTypeId="1" AcceptedAnswerId="12010" CreationDate="2019-04-24T13:23:41.997" Score="4" ViewCount="235" Body="&lt;p&gt;I am interested in HHL algorithm and despite all the problems related to current technologies, I am trying to understand how it has to be implemented. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen from these two available circuits  (&lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1804.03719&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1811.01726&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1811.01726&lt;/a&gt;) that when you define a circuit it is necessary to apply a certain rotation of the ancilla qubit based on the eigenvalues. For what I understood from the original paper, the algorithm &quot;extracts&quot; the information about eigenvalues using the quantum phase estimation algorithm but this part is missing in the circuits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My doubt is if I have to decompose my matrix to find eigenvalues I lose the possible advantage derived from the algorithm; is that correct? &lt;/p&gt;&#xA;" OwnerUserId="6310" LastEditorUserId="26" LastEditDate="2019-04-26T14:45:48.077" LastActivityDate="2020-05-13T18:27:11.927" Title="Does HHL implementation require a priori eigendecomposition?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5973" PostTypeId="1" AcceptedAnswerId="6446" CreationDate="2019-04-24T13:33:35.577" Score="3" ViewCount="288" Body="&lt;p&gt;I have this program derived from Microsoft Quantum Katas for counting (see &lt;a href=&quot;https://gist.github.com/friguzzi/84fbba72f7b6ba7bd58b0c4f8a8be60f&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Quantum.Sample&#xA;{&#xA;    open Microsoft.Quantum.Primitive;&#xA;    open Microsoft.Quantum.Canon;&#xA;    open Microsoft.Quantum.Extensions.Convert;&#xA;    open Microsoft.Quantum.Extensions.Math;&#xA;&#xA;    operation SprinklerAnc (queryRegister:  Qubit[],  target : Qubit,ancilla: Qubit[]) : Unit {&#xA;        body (...) {&#xA;            X(queryRegister[2]);&#xA;            X(queryRegister[3]);&#xA;            X(queryRegister[4]);&#xA;            X(queryRegister[5]);&#xA;            X(queryRegister[6]);&#xA;            X(ancilla[0]);&#xA;            X(ancilla[1]);&#xA;            X(ancilla[2]);&#xA;&#xA;            CCNOT(queryRegister[0],queryRegister[1],ancilla[0]);&#xA;            CCNOT(queryRegister[1],queryRegister[2],ancilla[1]);&#xA;            CCNOT(queryRegister[0],queryRegister[2],ancilla[2]);&#xA;            (Controlled X)([ancilla[0],ancilla[1],ancilla[2],queryRegister[3],queryRegister[4],queryRegister[5],queryRegister[6]],target);&#xA;            CCNOT(queryRegister[0],queryRegister[2],ancilla[2]);&#xA;            CCNOT(queryRegister[1],queryRegister[2],ancilla[1]);&#xA;            CCNOT(queryRegister[0],queryRegister[1],ancilla[0]);&#xA;&#xA;            X(ancilla[2]);&#xA;            X(ancilla[1]);&#xA;            X(ancilla[0]);&#xA;                        X(queryRegister[2]);&#xA;            X(queryRegister[6]);&#xA;            X(queryRegister[5]);&#xA;            X(queryRegister[4]);&#xA;            X(queryRegister[3]);&#xA;&#xA;&#xA;        }&#xA;        adjoint invert;&#xA;        controlled auto;&#xA;        controlled adjoint auto;&#xA;    }           &#xA;    operation OracleConverterImpl (markingOracle : ((Qubit[], Qubit) =&amp;gt; Unit : Adjoint, Controlled), register : Qubit[]) : Unit {&#xA;&#xA;        body (...) {&#xA;            using (target = Qubit()) {&#xA;                // Put the target into the |-⟩ state&#xA;                X(target);&#xA;                H(target);&#xA;&#xA;                // Apply the marking oracle; since the target is in the |-⟩ state,&#xA;                // flipping the target if the register satisfies the oracle condition will apply a -1 factor to the state&#xA;                markingOracle(register, target);&#xA;&#xA;                // Put the target back into |0⟩ so we can return it&#xA;                H(target);&#xA;                X(target);&#xA;            }&#xA;        }&#xA;&#xA;        adjoint invert;&#xA;        controlled auto;&#xA;        adjoint controlled auto;&#xA;    }&#xA;&#xA;    operation HadamardTransform (register : Qubit[]) : Unit {&#xA;&#xA;        body (...) {&#xA;            //ApplyToEachA(H, register);&#xA;&#xA;            // ApplyToEach is a library routine that is equivalent to the following code:&#xA;             let nQubits = Length(register);&#xA;             for (idxQubit in 0..nQubits - 1) {&#xA;                 H(register[idxQubit]);&#xA;             }&#xA;        }&#xA;&#xA;        adjoint invert;&#xA;        controlled auto;&#xA;        controlled adjoint auto;&#xA;    }&#xA;    operation Oracle_ArbitraryPattern (queryRegister : Qubit[], target : Qubit, pattern : Bool[]) : Unit {&#xA;&#xA;        body (...) {&#xA;            (ControlledOnBitString(pattern, X))(queryRegister, target);&#xA;        }&#xA;&#xA;        adjoint invert;&#xA;        controlled auto;&#xA;        controlled adjoint auto;&#xA;&#xA;    }   &#xA;&#xA;    // Task 2.2. Conditional phase flip&#xA;    operation ConditionalPhaseFlip (register : Qubit[]) : Unit {&#xA;&#xA;        body (...) {&#xA;            // Define a marking oracle which detects an all zero state&#xA;            let allZerosOracle = Oracle_ArbitraryPattern(_, _, new Bool[Length(register)]);&#xA;&#xA;            // Convert it into a phase-flip oracle and apply it&#xA;            let flipOracle = OracleConverter(allZerosOracle);&#xA;            flipOracle(register);&#xA;        }&#xA;&#xA;        adjoint self;&#xA;        controlled  auto;&#xA;&#xA;        controlled adjoint auto;&#xA;&#xA;    }&#xA;&#xA;&#xA;&#xA;    // Task 2.3. The Grover iteration&#xA;    operation GroverIteration (register : Qubit[], oracle : (Qubit[] =&amp;gt; Unit :   Adjoint, Controlled)) : Unit {&#xA;&#xA;        body (...) {&#xA;            oracle(register);&#xA;            HadamardTransform(register);&#xA;            ConditionalPhaseFlip(register);&#xA;            HadamardTransform(register);&#xA;        }&#xA;&#xA;        adjoint invert;&#xA;              controlled auto;&#xA;        controlled adjoint auto;&#xA;    }    &#xA;    function OracleConverter (markingOracle : ((Qubit[], Qubit) =&amp;gt; Unit : Adjoint, Controlled)) : (Qubit[] =&amp;gt; Unit : Adjoint, Controlled) {&#xA;        return OracleConverterImpl(markingOracle, _);&#xA;    }&#xA;&#xA;    operation UnitaryPowerImpl (U : (Qubit[] =&amp;gt; Unit : Adjoint, Controlled), power : Int, q : Qubit[]) : Unit {&#xA;        body (...) {&#xA;            for (i in 1..power) {&#xA;                U(q);&#xA;            }&#xA;        }&#xA;        adjoint auto;&#xA;        controlled auto;&#xA;        controlled adjoint auto;&#xA;    }&#xA;&#xA;    operation QPE() : Double {&#xA;        mutable phase = -1.0;&#xA;        let n=8;&#xA;                       using ((reg,phaseRegister,ancilla)=(Qubit[7 ], Qubit[n],Qubit[3]))&#xA;                       {&#xA;        // Construct a phase estimation oracle from the unitary&#xA;                         let phaseOracle = OracleConverter(SprinklerAnc(_,_,ancilla));&#xA;&#xA;        let oracle = DiscreteOracle(UnitaryPowerImpl(GroverIteration(_, phaseOracle), _, _));&#xA;&#xA;              //  let markingOracle = Sprinkler(_, _);&#xA;&#xA;        // Allocate qubits to hold the eigenstate of U and the phase in a big endian register &#xA;&#xA;            let phaseRegisterBE = BigEndian(phaseRegister);&#xA;            // Prepare the eigenstate of U&#xA;                HadamardTransform(reg);&#xA;&#xA;            // Call library&#xA;            QuantumPhaseEstimation(oracle, reg, phaseRegisterBE);&#xA;            // Read out the phase&#xA;            set phase = ToDouble(MeasureIntegerBE(phaseRegisterBE)) / ToDouble(1 &amp;lt;&amp;lt;&amp;lt; (n));&#xA;&#xA;            ResetAll(reg);&#xA;            ResetAll(phaseRegister);&#xA;        }&#xA;        let angle = PI()*phase;&#xA;        let res = 128.0 *(1.0- PowD(Sin(angle),2.0));&#xA;&#xA;        return res;&#xA;    }&#xA;&#xA;&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with driver (see &lt;a href=&quot;https://gist.github.com/friguzzi/3c7b836d572c26450efbdc2380cbc97e&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using System;&#xA;&#xA;using Microsoft.Quantum.Simulation.Core;&#xA;using Microsoft.Quantum.Simulation.Simulators;&#xA;&#xA;namespace Quantum.Sample&#xA;{&#xA;    class Driver&#xA;    {&#xA;        static void Main(string[] args)&#xA;        {&#xA;            using (var qsim = new QuantumSimulator())&#xA;            {&#xA;                for (int i = 0; i &amp;lt; 100; i++)&#xA;                {&#xA;                    var res = QPE.Run(qsim).Result;&#xA;                    System.Console.WriteLine($&quot;Res:{res}&quot;);&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should count the solutions of the 3 bits formula&#xA;(not reg[0] or reg[2]) and (not reg[1] or reg[2]) and (not reg[0] or not reg[1])&#xA;This formula has 4 solutions.&#xA;I consider an extended formula with 7 bits that is true when the first three bit satisfy the above formula and the other four bits are at 0. The extended formula this has 4 solutions as well but I can increase easily the number of solutions by excluding variables from the formula.&#xA;I compute the phase &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; with the linked program, then I compute &lt;span class=&quot;math-container&quot;&gt;$\theta/2$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$2\pi\phi/2=\pi\phi$&lt;/span&gt;&#xA;Now the number of solutions should be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$128\sin(\theta/2)^2$$&lt;/span&gt;&#xA; right?&#xA;I get the correct number of solutions if I compute &#xA;&lt;span class=&quot;math-container&quot;&gt;$$128(1-\sin(\theta/2)^2)$$&lt;/span&gt;&#xA;It's as if the formula is negated but I can't find where the negation is.&#xA;This same formula with &lt;code&gt;GroverSearch&lt;/code&gt; from Microsoft Quantum Katas returns correct solutions.&lt;/p&gt;&#xA;" OwnerUserId="7318" LastEditorUserId="7318" LastEditDate="2019-04-25T08:23:56.500" LastActivityDate="2019-06-14T00:00:35.417" Title="Counting in Q#: number of solutions" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5974" PostTypeId="1" AcceptedAnswerId="5975" CreationDate="2019-04-24T18:54:04.143" Score="1" ViewCount="96" Body="&lt;p&gt;Let's say I have a square matrix of size &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; with entries being 8 bit integers, where &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n=b\times b\times b=2^l\times 2^l\times 2^l$&lt;/span&gt;, then if I want to represent that matrix in the form of a cube, is the following representation correct?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|A\rangle=\dfrac{1}{2^{3k/2}}\sum_{i=0}^{2^l-1}\sum_{j=0}^{2^l-1}\sum_{k=0}^{2^l-1}|A(i,j,k)\rangle\otimes |i\rangle|j\rangle|k\rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A(i,j,k)$&lt;/span&gt; is the value at the location &lt;span class=&quot;math-container&quot;&gt;$(i,j,k)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|A(i,j,k)\rangle$&lt;/span&gt; is the binary representation of the decimal value, and &lt;span class=&quot;math-container&quot;&gt;$|i\rangle,|j\rangle,|k\rangle$&lt;/span&gt; are the position coordinates each of length &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; bits. Can we represent the cube like this? &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-26T14:22:34.470" LastActivityDate="2019-04-26T14:22:34.470" Title="Quantum representation of cube" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5975" PostTypeId="2" ParentId="5974" CreationDate="2019-04-25T07:04:55.737" Score="2" Body="&lt;p&gt;To be clear, you essentially have a cube consisting of &lt;span class=&quot;math-container&quot;&gt;$2^l$&lt;/span&gt; points along each direction, and associated with each point &lt;span class=&quot;math-container&quot;&gt;$(i,j,k)$&lt;/span&gt; is an 8 bit integer &lt;span class=&quot;math-container&quot;&gt;$A(i,j,k)$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, a state of &lt;span class=&quot;math-container&quot;&gt;$3l+8$&lt;/span&gt; qubits,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|A\rangle=\frac{1}{2^{3l/2}}\sum_{i,j,k=0}^{2^l-1}|A(i,j,k)\rangle|i\rangle|j\rangle|k\rangle&#xA;$$&lt;/span&gt;&#xA;is one possible way of representing the data. It is very reminiscent of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0102001&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum fingerprinting&lt;/a&gt; schemes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real question is what you want to use such a representation for? That will determine if the representation is any good. What you cannot do is use single copies to deterministically extract information about the values of &lt;span class=&quot;math-container&quot;&gt;$A(i,j,k)$&lt;/span&gt;. This should be obvious - you cannot use &lt;span class=&quot;math-container&quot;&gt;$3l+8$&lt;/span&gt; qubits to give you arbitrary access to &lt;span class=&quot;math-container&quot;&gt;$24l$&lt;/span&gt; bits of data.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-25T07:04:55.737" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5976" PostTypeId="1" AcceptedAnswerId="5977" CreationDate="2019-04-25T09:40:12.120" Score="5" ViewCount="1518" Body="&lt;p&gt;It is said &lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph219/chap3_15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;in a lecture note&lt;/a&gt;&lt;sup&gt;[1]&lt;/sup&gt; by John Preskill that,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Equivalently, we may imagine measuring system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|a\rangle\}$&lt;/span&gt;, but failing to record the measurement outcome, so we are forced to average over all the possible post-measurement states, weighted by their probabilities. The result is that the initial density operator &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\rho} = |\psi\rangle\langle \psi|$&lt;/span&gt; is subjected to a linear map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, which acts as &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\boldsymbol {\rho}) = \sum_a M_a\boldsymbol{\rho} M^{\dagger}_a, \tag{3.32}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where the operators &lt;span class=&quot;math-container&quot;&gt;$\{M_a\}$&lt;/span&gt; obey the completeness relation eq.(3.25).&lt;/p&gt;&#xA;  &#xA;  &lt;hr&gt;&#xA;  &#xA;  &lt;p&gt;The justification for this name will emerge shortly. Eq.(3.32) is said to be an &lt;em&gt;operator-sum representation&lt;/em&gt; of the quantum channel, and the operators &lt;span class=&quot;math-container&quot;&gt;$\{M_a\}$&lt;/span&gt; are called the &lt;em&gt;Kraus operators&lt;/em&gt; or &lt;em&gt;operation elements&lt;/em&gt; of the channel. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It seems that Kraus operators and measurement operators are the same thing. Is that right?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[1]: Lecture Notes for Ph219/CS219: Quantum Information Chapter 3 (John Preskill, 2018)&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="7327" LastEditorUserId="26" LastEditDate="2019-04-26T14:18:16.093" LastActivityDate="2019-04-26T14:18:16.093" Title="What's the difference between Kraus operators and measurement operators?" Tags="&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5977" PostTypeId="2" ParentId="5976" CreationDate="2019-04-25T16:27:41.843" Score="5" Body="&lt;p&gt;Quantum measurement (without results recording) is just a special case of quantum operation (quantum channel). So, yes, measurement operators (as in general measurement formalism) are indeed Kraus operators. But Kraus operators are more general. For example, they can be &quot;rectangular&quot;, while measurement operators can't.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-04-25T16:27:41.843" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5978" PostTypeId="1" CreationDate="2019-04-25T18:30:22.940" Score="3" ViewCount="197" Body="&lt;p&gt;Suppose we have qubit &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and we want to implement  quantum addition say adding &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt;. When drawing the circuit for this operation one of the outputs that we get is  keeping the state &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; unaltered for reversibility. But since we know the the sum is just the &lt;strong&gt;twice&lt;/strong&gt; of the state, can't we just keep the sum and nothing else and to get back the original we just half it? Pardon if this question sounds weird.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-04-26T13:20:08.513" LastActivityDate="2019-04-26T15:59:59.593" Title="Why do we need reversibility?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5979" PostTypeId="1" CreationDate="2019-04-25T18:38:16.387" Score="1" ViewCount="50" Body="&lt;p&gt;If I use for example 5-qubit IBM-Q quantum computer and we accept the law of quantum parallelism (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit = &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; ordinary bits), so does it mean that computational power of this computer is equal to only &lt;span class=&quot;math-container&quot;&gt;$2^5 = 32$&lt;/span&gt; bits (transistors)? For example in last Intel core processors — hundreds of millions transistors, so is it right that ordinary processors at this time faster than 5-qubit computer for millions of times?&lt;/p&gt;&#xA;" OwnerUserId="5876" LastEditorUserId="26" LastEditDate="2019-04-26T13:22:16.180" LastActivityDate="2019-04-26T13:22:16.180" Title="What is the difference in computational power between qubit and bit (transistor)?" Tags="&lt;physical-realization&gt;&lt;classical-computing&gt;&lt;ibm&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2019-04-25T19:13:14.393" ContentLicense="CC BY-SA 4.0" />
  <row Id="5980" PostTypeId="1" AcceptedAnswerId="5987" CreationDate="2019-04-26T01:28:55.697" Score="7" ViewCount="179" Body="&lt;p&gt;In quantum mechanics each operator corresponds to some physical observable, but say we have the operators &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z,H, \operatorname{CNOT}$&lt;/span&gt;. I understand how these gates act on qubits, but what do they actually represent in terms of a physical observable?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-26T13:22:57.643" LastActivityDate="2019-04-27T18:20:37.843" Title="How should we interpret these quantum logic gates as physical observables?" Tags="&lt;quantum-gate&gt;&lt;quantum-information&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5981" PostTypeId="2" ParentId="5978" CreationDate="2019-04-26T11:17:40.100" Score="4" Body="&lt;p&gt;There is a standard way for constructing a function evaluation &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; in a reversible manner: you define a circuit that acts &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle\mapsto |x\rangle|y\oplus f(x)\rangle$&lt;/span&gt;. This always works (you prove reversibility by acting it twice). Note that while I've used the quantum notation, this is actually a classical statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That does not mean it's the only way to construct a reversible circuit for a specific function. A particularly simple example is the binary function &lt;span class=&quot;math-container&quot;&gt;$f(x)=1-x$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}$&lt;/span&gt;. If we use the standard construction, we end up with a two-bit gate, controlled-NOT. However, if it sufficient to just apply NOT on the bit, as this is reversible. If I've understood your question correctly, this is exactly what's happening with your example.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-26T11:17:40.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5982" PostTypeId="2" ParentId="5980" CreationDate="2019-04-26T11:20:24.867" Score="3" Body="&lt;p&gt;In quantum mechanics, &lt;em&gt;not all&lt;/em&gt; operators are observables. Many operators are observables, and in the first year or two of treatments in some physics courses you will only see operators which are observables; but not all operators of interest are observables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operators you have mentioned all happen to be Hermitian, and &lt;em&gt;could&lt;/em&gt; therefore be interpreted as observables. This is particularly useful for the operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, which up to a scalar factor of &lt;span class=&quot;math-container&quot;&gt;$2\hbar$&lt;/span&gt; you may be more familiar with as &lt;a href=&quot;https://en.wikipedia.org/wiki/Angular_momentum_operator#Commutation_relations_between_components&quot; rel=&quot;nofollow noreferrer&quot;&gt;orbital angular momentum components&lt;/a&gt;. However, in the context of quantum computation, the more important property of the operators &lt;span class=&quot;math-container&quot;&gt;$\{X,Y,Z,H,\mathrm{CNOT}\}$&lt;/span&gt; is that they are &lt;em&gt;unitary&lt;/em&gt;: that is, their eigenvalues are all roots of unity, and so they represent possible finite-time evolutions of a quantum system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finite-time evolutions of the system are of course governed by the wave-equation. Specifically, from the time-independent Schr&amp;ouml;dinger equation, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ i\hbar \frac{\mathrm d}{\mathrm d  t} \lvert \psi(t) \rangle = \hat{\mathrm{H}} \, \lvert \psi(t) \rangle$$&lt;/span&gt;&#xA;which has solutions of the form &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi(t) \rangle \,=\, \hat{\mathrm{U}}(t) \: \lvert \psi(0)\rangle$&lt;/span&gt;, for some initial state-vector &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi(0)\rangle$&lt;/span&gt; and where &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathrm{U}}(t)$&lt;/span&gt; is a unitary operator given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{\mathrm{U}} (t)&#xA;\,=\,&#xA;\exp\bigl(-i \:\!\hat{\mathrm{H}} \,t\big/\hbar\bigr)&#xA;\,=\,&#xA;\sum_{n \geqslant 0} \frac{\bigl( -i\!\:\hat{\mathrm{H}}\,t \big/ \hbar\bigr)^n}{n!} $$&lt;/span&gt;&#xA;whose eigenvalues are of the form &lt;span class=&quot;math-container&quot;&gt;$\mathrm e^{-iE_k t / \hbar}$&lt;/span&gt; for eigenvalues &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathrm H}$&lt;/span&gt;. Such an operator is called a &lt;em&gt;unitary&lt;/em&gt; operator, and had the property that &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathrm U}(t){}^{-1} = \hat{\mathrm U}(-t) = \hat{\mathrm U}{}^\dagger$&lt;/span&gt;. The gates &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; are all operators of this form, where it so happens that the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All unitary operators can be obtained from the exponentiation of a Hermitian operator in this way; though in many cases we prefer to consider them as products if a sequence of different operators &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathrm U} = \hat{\mathrm U}_N(t_N)\,\cdots\,\hat{\mathrm U}_2(t_2)\,\hat{\mathrm U}_1(t_1)$&lt;/span&gt;, representing evolution according to piecewise-constant Hamiltonians. (Realising such a unitary evolution will be more complicated in practise, of course, just as computing with classical computers is more complicated than just applying 'AND' and 'OR' gates to bits represented by electrical voltages in wires, but this is the picture of quantum computation to first-order.)&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-04-26T19:15:17.567" LastActivityDate="2019-04-26T19:15:17.567" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5983" PostTypeId="2" ParentId="5978" CreationDate="2019-04-26T13:13:52.933" Score="4" Body="&lt;p&gt;The way in which we typically describe quantum computation is by unitary circuits, which is a sequence of transformations &lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\ket\psi \mapsto U\ket\psi$&lt;/span&gt;, for unitary operators &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. (This is not the only way in which to describe quantum computation &amp;mdash; for instance, there is measurement-based quantum computation, and quantum annealing &amp;mdash; but measurement-based quantum computation is almost always considered just a way to simulate unitary circuits, and quantum annealing doesn't lend itself well to describing computations by a sequence of operations which you do to compute functions on data.) So for us the starting point is to consider how to describe computations with unitary transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have a piece of classical data, such as &lt;span class=&quot;math-container&quot;&gt;$a \in \{0,1\}^n$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;0$&lt;/span&gt;, this data is represented by a &quot;standard basis state&quot;: a state &lt;span class=&quot;math-container&quot;&gt;$\ket{a}$&lt;/span&gt; which is a vector in &lt;span class=&quot;math-container&quot;&gt;$\mathbb C^{2^n}$&lt;/span&gt;, whose coefficients are indexed by the &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; strings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. The vector &lt;span class=&quot;math-container&quot;&gt;$\ket{a}$&lt;/span&gt; is the one where the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;-th coefficient is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and the others are zero. We can transform this state &amp;mdash; do computations on it &amp;mdash; by acting on it with unitary transformations &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, which are &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; matrices over &lt;span class=&quot;math-container&quot;&gt;$\mathbb C$&lt;/span&gt; which are &lt;strong&gt;(a)&lt;/strong&gt;&amp;nbsp;invertible, and &lt;strong&gt;(b)&lt;/strong&gt;&amp;nbsp;satisfy &lt;span class=&quot;math-container&quot;&gt;$U^{-1} = U^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The short answer to you question&lt;/strong&gt; is then that because the computations that you do are by invertible transformations, that there has to be a way to invert it. And if the transformation you're interested in maps every standard basis state to another standard basis state (as it would if it is realising a computation just with classical data), that transformation is precisely a 'reversible computation'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For a somewhat longer answer&lt;/strong&gt; you would have to consider &lt;em&gt;how&lt;/em&gt; to do your computation reversibly. Building on DaftWullie's answer above, it matters what computation you are doing, and what conditions you want on the output. If you want to add some integer &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, you either have to be flexible enough to allow this to be done reversibly on just the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit register &amp;mdash; for instance, by performing your computation modulo &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; &amp;mdash; or you have to allow for the possibility that &lt;span class=&quot;math-container&quot;&gt;$a+b \geqslant 2^n$&lt;/span&gt;, which will require that you use something like an extra 'overflow' qubit in a particular way. The same goes for multiplying &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, or by any other constant. (As Mark&amp;nbsp;S mentions in a comment, multiplying by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is not automatically a reversible operation: if you multiply by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; in a binary representation on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit integers, there will be an overflow if &lt;span class=&quot;math-container&quot;&gt;$a \geqslant 2^{n-1}$&lt;/span&gt;; and also the reverse operation of dividing by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is not well-defined on odd integers.) There are common conventions for what you might choose to do, but ultimately it depends on what you want to compute and how many qubits, how few operations, etc. you are prepared to use to do it.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-04-26T15:59:59.593" LastActivityDate="2019-04-26T15:59:59.593" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="5984" PostTypeId="1" AcceptedAnswerId="5986" CreationDate="2019-04-27T07:25:11.857" Score="2" ViewCount="93" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1837&quot;&gt;DaftWullie&lt;/a&gt; mentions an interesting point &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4421&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;let's assume that we know an &lt;strong&gt;efficient classical computation&lt;/strong&gt; of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. That means we can build a &lt;strong&gt;reversible quantum computation&lt;/strong&gt; that &lt;strong&gt;runs in the same time&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What exactly is meant by &lt;em&gt;efficient&lt;/em&gt; &quot;classical computation&quot; here? Does it mean something like the &lt;a href=&quot;https://en.wikipedia.org/wiki/CORDIC&quot; rel=&quot;nofollow noreferrer&quot;&gt;Volder's algorithm&lt;/a&gt; for implementing trigonometric, hyperbolic and exponential functions? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Say, we know how to implement &lt;span class=&quot;math-container&quot;&gt;$\sin^{-1}(x)$&lt;/span&gt; using a &lt;a href=&quot;https://en.wikibooks.org/wiki/Digital_Circuits/CORDIC&quot; rel=&quot;nofollow noreferrer&quot;&gt;CORDIC&lt;/a&gt;-based digital circuit (with registers, multiplexers, adders and all that). Can we build an equivalent quantum circuit that has the same computational complexity as its digital counterpart? If yes, how? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do we prove that the time complexities of the digital and quantum counterparts are equal (or nearly equal)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-04-27T13:36:26.777" Title="Is it possible to construct an equivalent quantum circuit from a CORDIC-based digital circuit?" Tags="&lt;circuit-construction&gt;&lt;complexity-theory&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5985" PostTypeId="1" AcceptedAnswerId="5996" CreationDate="2019-04-27T09:53:58.407" Score="2" ViewCount="265" Body="&lt;p&gt;I'm working on an implementation of the algorithms described Brassard &lt;em&gt;et al.&lt;/em&gt; in the following paper: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005055v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0005055v1&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I managed to make the amplitude amplification cases working but I'm stuck with the amplitude estimation because in the paper there is the definition of a &quot;special&quot; operator in a way I don't understand how to realize it. It is the &lt;span class=&quot;math-container&quot;&gt;$\Lambda_M(U^ĵ)$&lt;/span&gt;  defined at the bottom of page 15 as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|j\rangle|y\rangle\mapsto|j\rangle(|U^j |j\rangle)$$&lt;/span&gt;  for &lt;span class=&quot;math-container&quot;&gt;$0 \le j \le M$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a generic integer M and a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of size N (!= M), and where the exponent j is its repetition j times. Any idea on how to realize it in practice, as a product of matrices (not necessarily universal), or build element by element?&lt;/p&gt;&#xA;" OwnerUserId="4927" LastEditorUserId="26" LastEditDate="2019-04-27T10:20:41.890" LastActivityDate="2019-04-27T23:45:36.990" Title="Amplitude Estimation Algorithm — Lambda (Q) Operator" Tags="&lt;algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5986" PostTypeId="2" ParentId="5984" CreationDate="2019-04-27T13:19:05.200" Score="3" Body="&lt;p&gt;DaftWullie's comments aren't special to 'efficiently computable' functions &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; &amp;mdash; any function at all which we know how to compute by conventional means, we can compute reversibly with at most a (small!) constant factor overhead.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;How to reversibly compute a function&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The proof is simple. For any procedure to compute something conventionally &amp;mdash; classically and without regard to reversibility &amp;mdash; we can suppose that it is described in terms of a circuit consisting of FANOUT, NOT, XOR, and AND gates. (If you prefer a different set of universal logic gates, a very slightly different proof can easily be found for that gate set &amp;mdash; but it &lt;em&gt;is&lt;/em&gt; important that we explicitly account for when we make copies of a bit, which is what we use FANOUT for.) Then we can stimulate each of the gates FANOUT, XOR, and AND using CNOT and TOFFOLI gates as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin {aligned}&#xA;\mathrm{FANOUT} (a)&amp;amp; = \mathrm{CNOT} (a, 0) \\&#xA;\bigl(a, \mathrm{XOR} (a, b) \bigr) &amp;amp; = \mathrm{CNOT} (a, b) \\&#xA;\bigl(a, b, \mathrm{AND} (a, b) \bigr) &amp;amp; = \mathrm{TOFFOLI} (a, b, 0)&#xA;\end {aligned} $$&lt;/span&gt;&#xA;Thus it takes exactly one of either CNOT or TOFFOLI (and possibly a fresh bit with the value 0) to simulate the computation of a single FANOUT, XOR, or AND gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Composing these in the appropriate way, we can compute any classical function that we know how to compute, using only reversible gates.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If (as is usually the case for quantum computation) the TOFFOLI or CNOT operations are not primitive operations of your computational model, the more important thing is that it be possible to realise those operations &lt;em&gt;somehow&lt;/em&gt;. If you can decompose them into a fixed size sequence of primitive operations, then doing the computation reversibly only requires an overhead up to some constant factor, &lt;em&gt;i.e.&lt;/em&gt; the size of the most complicated decomposition of those reversible gates. For quantum circuits, it is reasonable to suppose that this factor is at most 15 (which is not wonderful, but from a theoretical standpoint is also not terrible, and can be improved depending on what operations you allow).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This reversible realisation of the computation may require some extra workspace: a number of bits which is at most the number of logic gates in your procedure. In some cases, there may be cleverer ways to reversibly realise the computation which requires fewer additional bits than this: coming up with the most sparing such reversible realisation is not necessarily easy. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;On efficient functions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The above remarks apply in principle to any classical circuit construction, and indeed to the primitive operations in any higher-level gate model (e.g. the CORDIC-based circuits of your question or any digit-extraction algorithm to compute some function). In principle, given a modest amount of (sufficiently high quality) additional memory, we can simulate any such circuit on a gate-by-gate basis to provide reversible equivalents with the same number of gates, or nearly so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more complicated functions, there is ironically enough more opportunities to save on the additional workspace required, which are impossible for the simpler gates (because those gates are &lt;em&gt;too&lt;/em&gt; simple to provide opportunities to save) &amp;mdash; economies of scale become possible, though not guaranteed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important part is that, additional workspace aside, these realisations will respect most notions of 'efficiency'. It does not increase the depth or size of the circuit by more than a constant factor, if at all. If you care about polynomial-size, linear-size, poly-log-depth, what-have-you &amp;mdash; this simulation method preserves it. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-04-27T13:36:26.777" LastActivityDate="2019-04-27T13:36:26.777" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5987" PostTypeId="2" ParentId="5980" CreationDate="2019-04-27T17:34:02.527" Score="4" Body="&lt;p&gt;I agree with the main points that Niel makes: &lt;em&gt;not all operators are observables&lt;/em&gt;, and the purpose of the ones you list is typically to transform states, not to be measured.  However, the operators you list happen to be hermitian (allowing them also to represent observables) as well as unitary (allowing them to represent transformations), so in this case we can still play devil's advocate, and ask if they have physical interpretations as measurable quantities.  So, interpreting your list as observables to be measured...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are easy: these represent unitless versions of spin measurement (or the analogous quantity, if your system is not a spin system) along the three spatial coordinate directions.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; also represents a unitless version of a spin measurement, but along an axis exactly between the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; is the hardest, and I don't have a clean physical interpretation.  It has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; (3 eigenvectors with eigenvalue +1, and one with eivenvalue -1), and as an observable it should represent correlative properties of the two qubits.  We could state what it literally measures, in terms of the four dimensions that it acts on, but this information will be less informative than just looking at its matrix form.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;All this being said, typically the only one of the five that is actually measured is &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, and occasionally the other coordinate spin measurements.&lt;/p&gt;&#xA;" OwnerUserId="7336" LastEditorUserId="26" LastEditDate="2019-04-27T18:20:37.843" LastActivityDate="2019-04-27T18:20:37.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5988" PostTypeId="1" AcceptedAnswerId="5990" CreationDate="2019-04-27T18:48:09.230" Score="1" ViewCount="78" Body="&lt;p&gt;I read that the relation &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CPHASE}_{12}=\operatorname{CPHASE}_{21}$&lt;/span&gt; in the matrix representation but when I tried to work it out I don't see how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{CPHASE}_{12}$&lt;/span&gt; acts in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{12}|00\rangle=\operatorname{CPHASE}_{12}|0\rangle|0\rangle=|0\rangle|0\rangle=|00\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{12}|01\rangle=\operatorname{CPHASE}_{12}|0\rangle|1\rangle=|0\rangle|1\rangle=|01\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{12}|10\rangle=\operatorname{CPHASE}_{12}|1\rangle|0\rangle=|1\rangle(-|0\rangle)=-|10\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{12}|11\rangle=\operatorname{CPHASE}_{12}|1\rangle|1\rangle=|1\rangle(-|1\rangle)=-|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means its matrix representation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{12}= \begin{pmatrix} 1 &amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;-1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;-1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{CPHASE}_{21}$&lt;/span&gt; though acts as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{21}|00\rangle=\operatorname{CPHASE}_{12}|0\rangle|0\rangle=|0\rangle|0\rangle=|00\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{21}|01\rangle=\operatorname{CPHASE}_{12}|0\rangle|1\rangle=(-|0\rangle)|1\rangle=-|01\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{21}|10\rangle=\operatorname{CPHASE}_{12}|1\rangle|0\rangle=|1\rangle|0\rangle=|10\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{21}|11\rangle=\operatorname{CPHASE}_{12}|1\rangle|1\rangle=(-|1\rangle)|1\rangle=-|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which will give matrix representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CPHASE}_{21}=\begin{pmatrix} 1 &amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;-1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;-1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the way I have done it has not produced the aforementioned identity, so where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-27T18:57:24.747" LastActivityDate="2019-04-27T22:07:06.760" Title="Error in showing $\operatorname{CPHASE}_{12}=\operatorname{CPHASE}_{21}$ in the matrix representation" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5989" PostTypeId="1" AcceptedAnswerId="5992" CreationDate="2019-04-27T19:08:13.363" Score="4" ViewCount="1028" Body="&lt;p&gt;When discussing the Dirac notation of an operator, for example, let's just say we have the bit flip gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; if we want to write this in the Dirac notation does that just mean writing it as follows?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X|\psi\rangle=X(c_0|0\rangle+c_1|1\rangle)=c_0|1\rangle+c_1|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-27T19:12:05.030" LastActivityDate="2019-05-01T04:15:28.327" Title="What does it mean to express a gate in Dirac notation?" Tags="&lt;quantum-gate&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5990" PostTypeId="2" ParentId="5988" CreationDate="2019-04-27T19:20:41.597" Score="2" Body="&lt;p&gt;The gates you calculated are not controlled gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CPHASE}_{12}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CPHASE}_{21}$&lt;/span&gt; you calculated are just &lt;span class=&quot;math-container&quot;&gt;$\sigma_z \otimes \mathbb{I}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I} \otimes \sigma_z$&lt;/span&gt; respectively. These are not controlled gates. &#xA;A general controlled phase gates controlled on 1 is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\operatorname{CPHASE}_{12} =   \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes R_{\phi},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where, &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;R_{\phi} = \begin{bmatrix}&#xA;   1 &amp;amp;&#xA;   0 \\&#xA;   0 &amp;amp;&#xA;   e^{i\phi} &#xA;\end{bmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CPHASE}_{12}$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix}&#xA;   1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\phi} &#xA;\end{bmatrix}&lt;/span&gt;&#xA;You can similarly calculate the other one,&#xA;Now, even these gates are not equivalent, maybe you read that their action on some states are equivalent. Please provide the reference of your claim about the equivalency of the two gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How to relate to &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\phi = \pi$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\operatorname{CPHASE}_{12} =   \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes R_{\pi} = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes \begin{bmatrix}&#xA;   1 &amp;amp;&#xA;   0 \\&#xA;   0 &amp;amp;&#xA;   -1 &#xA;\end{bmatrix},&#xA;\end{equation}&lt;/span&gt;&#xA;A &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt; gate is &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\operatorname{CNOT}_{12} =   \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes \sigma_x = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes \begin{bmatrix}&#xA;   0 &amp;amp;&#xA;   1 \\&#xA;   1 &amp;amp;&#xA;   0 &#xA;\end{bmatrix},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which means,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\operatorname{CNOT}_{12} = (\mathbb{I} \otimes R^{\pi/2}_y) \cdot \operatorname{CPHASE}_{12} \cdot (\mathbb{I} \otimes R^{-\pi/2}_y)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5746" LastEditorUserId="26" LastEditDate="2019-04-27T22:07:06.760" LastActivityDate="2019-04-27T22:07:06.760" CommentCount="21" ContentLicense="CC BY-SA 4.0" />
  <row Id="5991" PostTypeId="2" ParentId="5989" CreationDate="2019-04-27T19:25:47.667" Score="3" Body="&lt;p&gt;This might mean using the ketbra notation: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X = |1\rangle \langle0| + |0\rangle \langle1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This notation describes the effect the operator has on the basis vectors: in this case &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; converts &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and vice versa. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of other examples:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Z = |0\rangle \langle0| - |1\rangle \langle1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CNOT} = |0 \rangle\langle0| \otimes I + |1 \rangle\langle 1| \otimes X = |00\rangle \langle00| + |01\rangle \langle01| + |11\rangle \langle10| + |10\rangle \langle11|$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-01T01:53:00.273" LastActivityDate="2019-05-01T01:53:00.273" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="5992" PostTypeId="2" ParentId="5989" CreationDate="2019-04-27T20:04:46.110" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirac notation&lt;/a&gt; for the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|1\rangle \langle0| + |0\rangle \langle1|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you might be wondering where this comes from. The term you're looking for is &lt;strong&gt;outer product representation&lt;/strong&gt; of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. It follows from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral decomposition&lt;/a&gt; theorem (check Nielsen &amp;amp; Chuang 10th edition, p. 72) which holds for all &lt;a href=&quot;https://en.wikipedia.org/wiki/Normal_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;normal operators&lt;/a&gt;. The key point:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In terms of the outer product representation, this means that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$M=\sum_i\lambda_i|i\rangle\langle i|$&lt;/span&gt;,where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; is an orthonormal basis for &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, and each &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The eigenvectors of the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate are &lt;span class=&quot;math-container&quot;&gt;$-|0\rangle+|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt;, and the corresponding eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; cf. &lt;a href=&quot;https://www.wolframalpha.com/input/?i=%7B%7B0,1%7D,%7B1,0%7D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wolfram Alpha&lt;/a&gt;. Normalize the eigenvectors to get an orthonormal basis for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$\{\frac{-|0\rangle+|1\rangle}{\sqrt{2}},\frac{|0\rangle+|1\rangle}{\sqrt{2}}\}$&lt;/span&gt;. According the spectral decomposition theorem you can represent the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$-1(\frac{-|0\rangle+|1\rangle}{\sqrt{2}})(\frac{-\langle 0|+\langle1|}{\sqrt{2}}) + 1(\frac{|0\rangle+|1\rangle}{\sqrt{2}})(\frac{\langle 0|+\langle1|}{\sqrt{2}})$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=-\frac{1}{2}(|0\rangle\langle0|-|0\rangle\langle1|-|1\rangle\langle0|+|1\rangle\langle1|)+\frac{1}{2}(|0\rangle\langle0|+|0\rangle\langle1|+|1\rangle\langle0|+|1\rangle\langle1|)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=|1\rangle \langle0| + |0\rangle \langle1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To convince you that this result is correct let's apply it on an arbitrary qubit state &lt;span class=&quot;math-container&quot;&gt;$c_0|0\rangle+c_1 |1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(|1\rangle \langle0| + |0\rangle \langle1|)(c_0|0\rangle+c_1|1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=c_0|1\rangle\langle0|0\rangle+c_1|0\rangle\langle 1|1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=c_0 |1\rangle + c_1 |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yes, our result is correct and the bits were indeed flipped upon application of &lt;span class=&quot;math-container&quot;&gt;$X=|1\rangle \langle0| + |0\rangle \langle1|$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$c_0|0\rangle + c_1|1\rangle$&lt;/span&gt;.The last step followed from the fact that &lt;span class=&quot;math-container&quot;&gt;$\langle 0|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle 1|1\rangle$&lt;/span&gt; are both equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are &lt;a href=&quot;https://en.wikipedia.org/wiki/Orthonormality&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthonormal vectors&lt;/a&gt; i.e. their inner product &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\psi\rangle=1$&lt;/span&gt; &lt;em&gt;by definition&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're done. As an exercise, find the outer product representation of the Pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate by yourself. And definitely, do go through the proof of the spectral theorem in Nielsen and Chung if time permits!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="2879" LastEditDate="2019-05-01T04:15:28.327" LastActivityDate="2019-05-01T04:15:28.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5993" PostTypeId="1" AcceptedAnswerId="5994" CreationDate="2019-04-27T20:24:40.693" Score="3" ViewCount="644" Body="&lt;p&gt;What is the meaning of writing a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in its Bloch representation. Would I be correct in saying it's just writing out its Bloch vector?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="55" LastEditDate="2019-04-29T10:28:09.703" LastActivityDate="2019-04-29T10:43:42.997" Title="What is the meaning of writing a state in its Bloch representation?" Tags="&lt;notation&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="5994" PostTypeId="2" ParentId="5993" CreationDate="2019-04-27T21:34:10.200" Score="7" Body="&lt;p&gt;Yes. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt; formalism is used for &lt;em&gt;geometrically&lt;/em&gt; representing &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1365/whats-the-difference-between-a-pure-and-mixed-quantum-state&quot;&gt;pure and mixed states&lt;/a&gt; of two-dimensional quantum systems a.k.a qubits. Any &lt;strong&gt;pure state&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; of a qubit can be written in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \cos\frac{\theta}{2}|0\rangle + e^{i\phi}\sin\frac{\theta}{2}|1\rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$0\leq \theta\leq \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0\leq \phi\leq 2\pi$&lt;/span&gt;. This &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; can be represented on the Bloch sphere as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BBEUG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BBEUG.png&quot; alt=&quot;Bloch Sphere&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\vec{a}\in \Bbb R^3$&lt;/span&gt; is basically &lt;span class=&quot;math-container&quot;&gt;$(\sin\theta \cos\phi, \sin\theta\sin\phi, \cos \theta) = (a_1,a_2,a_3)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To represent &lt;strong&gt;mixed states&lt;/strong&gt; you need to consider the corresponding density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. the set of states of a single qubit can be described in terms of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;density matrices&lt;/a&gt; and as &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}$&lt;/span&gt; &lt;a href=&quot;https://physics.stackexchange.com/questions/292102&quot;&gt;forms a basis&lt;/a&gt; for the vector space of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; Hermitian matrices, you can write the density operator as &lt;span class=&quot;math-container&quot;&gt;$$\rho = a_0I+a_1X+a_2Y+a_3Z = \frac{1}{2}\begin{pmatrix}1+a_3 &amp;amp; a_1-ia_2 \\ a_1+ia_2 &amp;amp; 1-a_3\end{pmatrix}.$$&lt;/span&gt; As density matrices always have trace &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and here &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho)=2a_0$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; is necessarily &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;. So from here you can find out the Bloch coordinates of the any mixed state i.e. &lt;span class=&quot;math-container&quot;&gt;$(a_1,a_2,a_3)$&lt;/span&gt; after performing the Pauli decompostion of the density matrix. If you're wondering what ensures that &lt;span class=&quot;math-container&quot;&gt;$|\vec{a}|\leq 1$&lt;/span&gt;, it's the &lt;a href=&quot;https://math.stackexchange.com/questions/518890/prove-that-every-positive-semidefinite-matrix-has-nonnegative-eigenvalues&quot;&gt;positive semidefiniteness&lt;/a&gt;! The two eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(1+|\vec{a}|)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(1-|\vec{a}|)$&lt;/span&gt;. Thus, to ensure that the second eigenvalue is non-negative, &lt;span class=&quot;math-container&quot;&gt;$|\vec{a}|\leq 1$&lt;/span&gt;. The three properties of density matrices which you should drill into your brain are: &lt;strong&gt;self-adjointness&lt;/strong&gt;, &lt;strong&gt;positive-semidefiniteness&lt;/strong&gt; and &lt;strong&gt;unit trace&lt;/strong&gt;; prove them as an exercise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you determine the values &lt;span class=&quot;math-container&quot;&gt;$a_1,a_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt; from the density operator, you can easily find the location of the qubit state &lt;span class=&quot;math-container&quot;&gt;$(\sin\theta \cos\phi, \sin\theta\sin\phi, \cos \theta)$&lt;/span&gt; &lt;em&gt;inside&lt;/em&gt; the Bloch sphere. Let me emphasize on this point: pure states lie on the Bloch sphere (i.e. &lt;span class=&quot;math-container&quot;&gt;$|\vec{a}|=1$&lt;/span&gt;) whereas mixed states lie inside the Bloch sphere (i.e. &lt;span class=&quot;math-container&quot;&gt;$|\vec{a}|&amp;lt;1$&lt;/span&gt;). If you're mathematically inclined, you'll also love to think about the Bloch sphere in terms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Stereographic_projection&quot; rel=&quot;nofollow noreferrer&quot;&gt;stereographic projections&lt;/a&gt;; it's excellently summarized in this &lt;a href=&quot;https://physics.stackexchange.com/a/220951/199113&quot;&gt;Physics SE answer&lt;/a&gt;. I'll attach the image from there, which is originally from &lt;a href=&quot;http://stla.github.io/stlapblog/posts/BlochSphere.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blogpost&lt;/a&gt; (the article is in French, sorry :).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qQZxy.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qQZxy.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are a few &quot;further readings&quot; for you:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/204090&quot;&gt;Understanding the Bloch sphere&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2347&quot;&gt;Density matrices for pure states and mixed states&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4118&quot;&gt;Why do Bloch sphere wavefunctions have half angles?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5603&quot;&gt;Purity of mixed states as a function of radial distance from origin of Bloch ball&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1633&quot;&gt;Alternative to Bloch sphere to represent a single qubit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4699&quot;&gt;Can the Bloch sphere be generalized to two qubits?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5147&quot;&gt;Why is an entangled qubit shown at the origin of a Bloch sphere?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Essentially, go through the &lt;a href=&quot;/questions/tagged/bloch-sphere&quot; class=&quot;post-tag&quot; title=&quot;show questions tagged &amp;#39;bloch-sphere&amp;#39;&quot; rel=&quot;tag&quot;&gt;bloch-sphere&lt;/a&gt; tag; you'll find several interesting questions and answers, which should clarify most of your beginner confusions about the Bloch sphere formalism. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-29T10:43:42.997" LastActivityDate="2019-04-29T10:43:42.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5995" PostTypeId="2" ParentId="3873" CreationDate="2019-04-27T22:34:03.853" Score="1" Body="&lt;p&gt;The full scaling will be &lt;span class=&quot;math-container&quot;&gt;$O(4^n\text{poly}\left(\log\frac{1}{\epsilon}\right))$&lt;/span&gt;, so you do indeed get exponential scaling in the number of qubits.&lt;/p&gt;&#xA;" OwnerUserId="7336" LastActivityDate="2019-04-27T22:34:03.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5996" PostTypeId="2" ParentId="5985" CreationDate="2019-04-27T23:45:36.990" Score="3" Body="&lt;p&gt;There are several different answers to your question, but let me give the answer that computer scientists will find most satisfying here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As it comes to implementing general unitary operators &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, I would like to refer you to section 4.5 in the book &quot;Quantum Computation and Information&quot; by Nielsen and Chuang. They give a construction which allows one to implement any unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; approximately, using only a finite set of elementary quantum gates. Note that one can use this construction to implement the &lt;em&gt;controlled&lt;/em&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then the question remains how one implements the mapping &lt;span class=&quot;math-container&quot;&gt;$|j\rangle|y\rangle \mapsto |j\rangle U^j|y\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0 \leq j \leq M$&lt;/span&gt;. I will use the convention that if &lt;span class=&quot;math-container&quot;&gt;$j = j_{n-1}\dots j_0$&lt;/span&gt; is the binary expansion of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|j\rangle = |j_{n-1}\rangle \cdots |j_0\rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$M \leq 7$&lt;/span&gt;, then one can use the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GVoBB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GVoBB.png&quot; alt=&quot;controlled exponentiation circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to allow for bigger &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, we just have to increase the size of this circuit. Note that in this construction, the number of times one has to apply the controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation equals &lt;span class=&quot;math-container&quot;&gt;$2^{\lceil \log_2(M) + 1\rceil} - 1 = \Theta(M)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2019-04-27T23:45:36.990" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="5997" PostTypeId="1" AcceptedAnswerId="5999" CreationDate="2019-04-28T02:00:29.467" Score="3" ViewCount="792" Body="&lt;p&gt;I'm trying to compute the spectral decomposition of the Hadamard gate but I'm making a mistake somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I believe (though I may be wrong so correct me if I am) that spectral decomposition is a way to find a diagonalized version of a matrix, additionally I am trying to work out &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\operatorname{CNOT}_{12}}$&lt;/span&gt;, and based off an exam paper question it said to do so knowing that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}=H_2Z_{12}H_2$&lt;/span&gt;. I know that &lt;span class=&quot;math-container&quot;&gt;$H_2=I \otimes H$&lt;/span&gt;, and I thought the best way to do this would be to diagonalize &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; by diagonalizing &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; then take the square root of the diagonals of &lt;span class=&quot;math-container&quot;&gt;$H_2, Z$&lt;/span&gt; to find &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\operatorname{CNOT}_{12}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we have &lt;span class=&quot;math-container&quot;&gt;$$H=\begin{bmatrix} \tfrac{1}{\sqrt{2}} &amp;amp;\tfrac{1}{\sqrt{2}} \\ \tfrac{1}{\sqrt{2}} &amp;amp; -\tfrac{1}{\sqrt{2}} \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now spectral decomposition of this matrix will be &lt;span class=&quot;math-container&quot;&gt;$H=\sum_i \lambda_i|\psi_i\rangle \langle\psi_i|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; corresponds to an eigenvalue and &lt;span class=&quot;math-container&quot;&gt;$|\psi_i \rangle$&lt;/span&gt; is its associated eigenvector. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First we find the eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\det(H-\lambda I)=\det \begin{bmatrix} \tfrac{1}{\sqrt{2}}-\lambda &amp;amp;\tfrac{1}{\sqrt{2}} \\ \tfrac{1}{\sqrt{2}} &amp;amp; -\tfrac{1}{\sqrt{2}}-\lambda \end{bmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=(\tfrac{1}{\sqrt{2}}-\lambda)(-\tfrac{1}{\sqrt{2}}-\lambda)-\tfrac{1}{2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=-\tfrac{1}{2}+\lambda^2-\tfrac{1}{2}=-1+\lambda^2\implies \lambda=\pm 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we find the eigenvectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda=1$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} x\\y \end{bmatrix}=\begin{bmatrix} \tfrac{1}{\sqrt{2}} &amp;amp;\tfrac{1}{\sqrt{2}} \\ \tfrac{1}{\sqrt{2}} &amp;amp; -\tfrac{1}{\sqrt{2}} \end{bmatrix}\begin{bmatrix} x\\y \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\implies \tfrac{x+y}{\sqrt{2}}=x \implies (\sqrt{2}-1)x=y$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tfrac{x-y}{\sqrt{2}}=y \implies (\sqrt{2}+1)y=x$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These equations give eigenvectors &lt;span class=&quot;math-container&quot;&gt;$$v_1=\begin{bmatrix} 1 \\(\sqrt{2}-1) \end{bmatrix}, v_2=\begin{bmatrix} (\sqrt{2}+1)\\1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eigenvectors for &lt;span class=&quot;math-container&quot;&gt;$\lambda=-1$&lt;/span&gt; are found, similarly, to be &lt;span class=&quot;math-container&quot;&gt;$$v_3=\begin{bmatrix} 1 \\(-\sqrt{2}-1) \end{bmatrix}, v_4=\begin{bmatrix} (-\sqrt{2}+1)\\1 \end{bmatrix}$$&lt;/span&gt;&#xA;But &lt;span class=&quot;math-container&quot;&gt;$$H=-\begin{bmatrix} 1 \\(-\sqrt{2}-1) \end{bmatrix}\begin{bmatrix} 1 &amp;amp;(-\sqrt{2}-1) \end{bmatrix}- \begin{bmatrix} (-\sqrt{2}+1)\\1 \end{bmatrix}\begin{bmatrix} (-\sqrt{2}+1)&amp;amp;1 \end{bmatrix}+\begin{bmatrix} 1 \\(\sqrt{2}-1) \end{bmatrix}\begin{bmatrix} 1 &amp;amp;(\sqrt{2}-1) \end{bmatrix}+\begin{bmatrix} (\sqrt{2}+1)\\1 \end{bmatrix}\begin{bmatrix} (\sqrt{2}+1)&amp;amp;1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doesn't give me a diagonal matrix, where have I gone wrong?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-29T06:33:12.363" LastActivityDate="2019-04-29T06:33:12.363" Title="Square root of CNOT and spectral decomposition of the Hadamard gate" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="5998" PostTypeId="2" ParentId="5997" CreationDate="2019-04-28T06:55:10.567" Score="1" Body="&lt;p&gt;There are two points where you are wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First: When you compute the eigenvector of H, which is &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix. So there should be one eigenvector corresponding to an eigenvalue, and should be normalized. In your computation for the case of &lt;span class=&quot;math-container&quot;&gt;$\lambda=1$&lt;/span&gt;, if you make a normalization you will find that there are the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second: If you just want to get the square root of a self-adjoint one, then just make a square root of the eigenvalue is fine. That is for a self-adjoint operator:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A = \sum_i \lambda_i |\psi_i\rangle\langle\psi_i|$$&lt;/span&gt;&#xA;then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{A} = \sum_i \sqrt{\lambda_i}|\psi_i\rangle\langle\psi_i| $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6128" LastEditorUserId="26" LastEditDate="2019-04-28T15:25:42.983" LastActivityDate="2019-04-28T15:25:42.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="5999" PostTypeId="2" ParentId="5997" CreationDate="2019-04-28T07:02:07.663" Score="3" Body="&lt;p&gt;Firstly, there's a conceptual error in your calculation of the eigenvectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} x\\y \end{bmatrix}=\begin{bmatrix} \tfrac{1}{\sqrt{2}} &amp;amp;\tfrac{1}{\sqrt{2}} \\ \tfrac{1}{\sqrt{2}} &amp;amp; -\tfrac{1}{\sqrt{2}} \end{bmatrix}\begin{bmatrix} x\\y \end{bmatrix}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\sqrt{2}-1)x=y \tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\sqrt{2}+1)y=x \tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) and (2) are equivalent equations. To convince yourself multiply both sides of (1) by &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2}+1)$&lt;/span&gt;. The point is that when you solve the eigenvalue equation, you &lt;strong&gt;do not&lt;/strong&gt; get a single eigenvector but rather a &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_subspace&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear subspace&lt;/a&gt; of eigenvectors. We can only put forth the form of the eigenvectors in that subspace as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}x \\ (\sqrt{2}-1)x\end{bmatrix}=x\begin{bmatrix}1 \\ (\sqrt{2}-1)\end{bmatrix}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x\in \Bbb C$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your other vector &lt;span class=&quot;math-container&quot;&gt;$\nu_2$&lt;/span&gt; lies in this same linear subspace. It's equivalent to &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2}+1)\nu_1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And again, &lt;span class=&quot;math-container&quot;&gt;$\nu_4$&lt;/span&gt; is simply &lt;span class=&quot;math-container&quot;&gt;$(-\sqrt{2}+1)\nu_3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Secondly, for finding the square root of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt; you could directly diagonalize &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt; instead of going about it in such a roundabout fashion (i.e. writing &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$H_2Z_{12}H_2$&lt;/span&gt;). However, that approach is particularly useful for this specific case; see my update below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a block diagonal matrix, so you can easily diagonalize the individual &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt;  blocks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proceed like this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spectral decompose the upper left block like &lt;span class=&quot;math-container&quot;&gt;$P\Lambda P^{-1}$&lt;/span&gt; and the lower right block like &lt;span class=&quot;math-container&quot;&gt;$Q\Lambda'Q^{-1}$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CNOT}_{12}=\begin{pmatrix}P&amp;amp;0\\0&amp;amp;Q\end{pmatrix}\begin{pmatrix}\Lambda&amp;amp;0\\0&amp;amp;\Lambda'\end{pmatrix}\begin{pmatrix}P^{-1}&amp;amp;0\\0&amp;amp;Q^{-1}\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The required square root is simply &lt;span class=&quot;math-container&quot;&gt;$$\sqrt{\operatorname{CNOT}_{12}}=\begin{pmatrix}P&amp;amp;0\\0&amp;amp;Q\end{pmatrix}\begin{pmatrix}\sqrt\Lambda&amp;amp;0\\0&amp;amp;\sqrt\Lambda'\end{pmatrix}\begin{pmatrix}P^{-1}&amp;amp;0\\0&amp;amp;Q^{-1}\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially, I didn't understand the significance of writing the &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}_{12}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$H_2Z_{12}H_2$&lt;/span&gt; but the hint in the question paper helped. One obvious fact (as &lt;span class=&quot;math-container&quot;&gt;$H_2.H_2=\Bbb I$&lt;/span&gt;) is that &lt;span class=&quot;math-container&quot;&gt;$$\operatorname{CNOT}_{12}=H_2Z_{12}H_2 = (H_2\sqrt{Z_{12}}H_2)(H_2\sqrt{Z_{12}}H_2),$$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$$\sqrt{\operatorname{CNOT}_{12}}=H_2\sqrt{Z_{12}}H_2.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$Z_{12}$&lt;/span&gt; is the &lt;a href=&quot;https://physics.stackexchange.com/a/202291&quot;&gt;controlled phase gate&lt;/a&gt; for &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, an interesting property of the controlled phase gate is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0  &amp;amp; 0  &amp;amp; 1 &amp;amp; 0  \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\phi/2} &#xA; \end{pmatrix}.\begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0  &amp;amp; 0  &amp;amp; 1 &amp;amp; 0  \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\phi/2} &#xA; \end{pmatrix}=&#xA;\begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0  &amp;amp; 0  &amp;amp; 1 &amp;amp; 0  \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\phi} &#xA; \end{pmatrix}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the square root of the &lt;span class=&quot;math-container&quot;&gt;$Z_{12}$&lt;/span&gt; gate i.e. &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z_{12}}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;  0  &amp;amp; 0  &amp;amp; 1 &amp;amp; 0  \\&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\pi/2} &#xA; \end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now just pre- and post-multiply &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z_{12}}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;'s and you're done! This is indeed simpler than the spectral decomposition method I suggested earlier. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-29T04:50:15.417" LastActivityDate="2019-04-29T04:50:15.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6000" PostTypeId="2" ParentId="5674" CreationDate="2019-04-28T14:43:45.180" Score="2" Body="&lt;p&gt;I think you've simplified the problem too much.  The way your question is framed it sounds like you expect a square-root speedup of a small problem, which doesn't seem that impressive.  In actuality there may be a Grover-style speedup not of &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{X Y})$&lt;/span&gt; but of &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{2^X 2^Y})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's set up the problem, and see what is to be solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's let your opponent's battleship grid be of size &lt;span class=&quot;math-container&quot;&gt;$X\times Y$&lt;/span&gt;.  It is populated with &lt;span class=&quot;math-container&quot;&gt;$s\in\{0,1\}$&lt;/span&gt; binary numbers, where &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is &quot;ship&quot; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is &quot;sea&quot;.  Thus you can think of your opponent's grid as an element &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^{XY}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The size of and placement of ships further constrains what &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; can be; for example, there must be two consecutive &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s for a destroyer, four consecutive &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s for a battleship, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nonetheless your goal is to guess the location of all of your opponent's &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s with fewest number of guesses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, you are trying to determine &lt;span class=&quot;math-container&quot;&gt;$S\in \{0,1\}^{XY}$&lt;/span&gt;.  When properly framed this can be a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt; instance and Grover's algorithm can get the polynomial speedup of an exponential problem.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-04-28T14:43:45.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6002" PostTypeId="1" AcceptedAnswerId="6005" CreationDate="2019-04-28T18:53:10.443" Score="3" ViewCount="426" Body="&lt;p&gt;I see a question quite a lot in past exam papers that goes like propose a quantum circuit that generates the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; given the initial state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the initial state &lt;span class=&quot;math-container&quot;&gt;$|000 \rangle $&lt;/span&gt; propose a quantum circuit that generates the state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle=\tfrac{1}{\sqrt{2}} (|+++ \rangle - |--- \rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|\pm \rangle=(|0 \rangle \pm |1\rangle)/\sqrt{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now there's a square root of 2 involved so one would imagine a Hadamard gate is involved, but other than that I don't really see how you could just know the circuit apart from trial and error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any tips and tricks for making circuits that generate states given some initial state?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-04-29T06:35:51.303" LastActivityDate="2019-08-01T01:22:11.827" Title="Tips and tricks for constructing circuits to generate arbitrary quantum states" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6003" PostTypeId="1" AcceptedAnswerId="6007" CreationDate="2019-04-29T06:02:58.040" Score="2" ViewCount="113" Body="&lt;p&gt;In &lt;a href=&quot;https://www.media.mit.edu/quanta/qasm2circ/test6.qasm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example 6&lt;/a&gt;, the case of multiple qubit controlled custom &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate is covered, but I want to reuse the standard NOT symbol i.e. &lt;span class=&quot;math-container&quot;&gt;$\bigoplus$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/af4e0m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/af4e0m.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I want to draw this circuit, but with a &lt;span class=&quot;math-container&quot;&gt;$\bigoplus$&lt;/span&gt; instead of the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in a box. Clearly, &lt;em&gt;defining&lt;/em&gt; a new custom gate isn't going to work as it'll still place the &lt;span class=&quot;math-container&quot;&gt;$\bigoplus$&lt;/span&gt; in a box. I was trying to do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qubit   j0&#xA;qubit   j1&#xA;qubit   j2&#xA;qubit   j3&#xA;&#xA;toffoli j0,j1,j2&#xA;X   j0&#xA;cnot    j2,j3,j0,j1&#xA;H   j2&#xA;measure j3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but as expected, I get the &lt;code&gt;ERROR: [qgate] OOPS! line 8 wrong number of qubits in cnot j2,j3,j0,j1&lt;/code&gt;. There's also the &lt;code&gt;toffoli&lt;/code&gt; but even that is limited to a maximum of two control qubits. It's surprising that none of the other examples cover this case. So, any idea whether it's possible to draw a multiple qubit controlled NOT using the qasm2circ package?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-29T06:12:24.330" LastActivityDate="2019-04-29T10:11:51.690" Title="How to draw a multiple qubit controlled NOT gate using qasm2circ?" Tags="&lt;programming&gt;&lt;qasm2circ&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6004" PostTypeId="1" CreationDate="2019-04-29T07:16:55.513" Score="2" ViewCount="84" Body="&lt;p&gt;I have a set of transformations that transforms &lt;span class=&quot;math-container&quot;&gt;$|11001\rangle\to |10101\rangle$&lt;/span&gt; which is basically keeping the leftmost qubit as it is and then it is just the CNOT between the successive qubits, I have done the circuit construction for this with the steps with the register &lt;span class=&quot;math-container&quot;&gt;$|abcde\rangle$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$1.~~  \operatorname{CNOT}|d,e\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$2.~~  \operatorname{CNOT}|c,d\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$3.~~  \operatorname{CNOT}|b,c\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$4.~~  \operatorname{CNOT}|a,b\rangle$$&lt;/span&gt;&#xA;after these transformations, we get the desired results, but how do I write this whole transformation in Dirac notation or matrix notation. I have figured it myself can somebody just check &#xA;for the  &lt;span class=&quot;math-container&quot;&gt;$$1.   A=\mathrm{kron}(\mathrm{kron}(\mathrm{kron}(I_2,I_2),I_2),U)$$&lt;/span&gt;&#xA;         &lt;span class=&quot;math-container&quot;&gt;$$2.   B=\mathrm{kron}(\mathrm{kron}(\mathrm{kron}(I_2,I_2),U),I_2)$$&lt;/span&gt;&#xA;         &lt;span class=&quot;math-container&quot;&gt;$$3.   C=\mathrm{kron}(\mathrm{kron}(\mathrm{kron}(I_2,U),I_2),I_2)$$&lt;/span&gt;&#xA;         &lt;span class=&quot;math-container&quot;&gt;$$4.   D=\mathrm{kron}(\mathrm{kron}(\mathrm{kron}(U,I_2),I_2),I_2)$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$$U=\begin{bmatrix}&#xA;1 &amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;The last step is just to multiply all these matrix so final transformation matrix is &lt;span class=&quot;math-container&quot;&gt;$$U_f=ABCD$$&lt;/span&gt;&#xA;I have the circuit representation for &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;-qubits as &lt;a href=&quot;https://i.stack.imgur.com/AE9O0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AE9O0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this is product of unitary of transformations, i need &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; unitary matrices for this. The first of these matrices say &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; that i calculated shoyld be &lt;span class=&quot;math-container&quot;&gt;$$ U_1= I^6\otimes \lbrace{|0\rangle \langle 0|\otimes I+|1\rangle \langle 1|\otimes X\rbrace }$$&lt;/span&gt; similarly for the other &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; matrices just the identity matrix size keeps changing. Is my inference correct, can somebody help?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2019-04-29T17:50:55.567" LastActivityDate="2019-04-29T17:50:55.567" Title="Writing the transformation matrix for the following in terms of Kronecker products of elementary 2-qubit gates" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;tensor-product&gt;&lt;notation&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="6005" PostTypeId="2" ParentId="6002" CreationDate="2019-04-29T07:28:05.950" Score="3" Body="&lt;p&gt;For the single qubit case, we can consider the circuit/operation/mapping as a rotation on the Bloch sphere, so just use the form &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta_1)R_z(\theta_2)R_y(\theta_3)$&lt;/span&gt; or any other similar stuff and try to get a set of &lt;span class=&quot;math-container&quot;&gt;$\{\theta\}$&lt;/span&gt; to satisfy the requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, multiple qubits could be much more difficult. Take two-qubit computation, for example, you could find the decomposition is very complex if only real gates are allowed (look at &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308006&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if you don't need the exact operation giving the exact output, I would recommend &lt;a href=&quot;https://arxiv.org/abs/1803.00745&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum circuit learning&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="26" LastEditDate="2019-04-29T08:05:58.257" LastActivityDate="2019-04-29T08:05:58.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6006" PostTypeId="1" CreationDate="2019-04-29T08:49:20.973" Score="4" ViewCount="88" Body="&lt;p&gt;I am trying to use IBM Q to perform the following depolarizing channel on a state of 2 qubits &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi \rangle \langle \psi |$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho \to (1-\lambda)\rho + \frac{\lambda}{4}I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is within the limitations of the IBM Q. Namely 5 channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I come up with a combination of gates that will give this result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A specific case I want to try would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \cos \theta |00\rangle + \sin \theta |11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4725" LastActivityDate="2019-04-29T08:49:20.973" Title="Implementing a depolarizing channel for 2 qubits on IBM Q" Tags="&lt;ibm-q-experience&gt;&lt;quantum-operation&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6007" PostTypeId="2" ParentId="6003" CreationDate="2019-04-29T10:01:31.770" Score="1" Body="&lt;p&gt;I checked the source code in the &lt;code&gt;qasm2tex.py&lt;/code&gt; file. On line 410 the &lt;code&gt;if&lt;/code&gt; structure goes like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(m):&#xA;    (name,nctrl) = m.group(1).split(',')&#xA;    tex = m.group(2)&#xA;    if(tex=='bullet'):        # special for bullet, no \op{}&#xA;        texsym = r'\b'&#xA;    elif(tex.find(r'\dmeter')&amp;gt;=0):  # if meas, don't put in \op{}&#xA;        texsym = tex&#xA;    else:&#xA;        texsym = '\op{%s}' % tex&#xA;    nctrl = int(nctrl)&#xA;    if GateMasterDef.has_key(name):&#xA;        print &quot;[qasm_parser] oops! duplicate def for op %s&quot; % line&#xA;    else:&#xA;        GateMasterDef[name] = (nctrl+1, nctrl, texsym)&#xA;    # print &quot;definition: %s&quot; % m.group(1)&#xA;    continue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So there are no cases for handling &lt;code&gt;oplus&lt;/code&gt; and &lt;code&gt;times&lt;/code&gt; is handled, although they're defined along with &lt;code&gt;bullet&lt;/code&gt; in the &lt;code&gt;xyqcirc.tex&lt;/code&gt; file, as single qubit operations, i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;% single qubit operations&#xA;&#xA;\def\op#1{*+[F]{\rule[-0.2ex]{0ex}{2.1ex}#1}}   % operator in box&#xA;\def\b{*={\bullet}}&#xA;\def\o{*={\oplus}}&#xA;\def\t{*={\times}}              % for swap gate&#xA;\def\sq{*=&amp;lt;6pt,6pt&amp;gt;[F]{}}           % square, for controlled-phase&#xA;\def\m#1{\left[\matrix{#1}\right]}      % matrix shortcut&#xA;\def\z{*+[]{\rule[-0.2ex]{0ex}{2.1ex}~|0\&amp;gt;}}    % re-init to |0&amp;gt;&#xA;\def\discard{*[]{\rule[-0.2ex]{0.75pt}{2.1ex}~}}    % vertical ``|''&#xA;\def\slash{*={/}}               % slash for wire bundles&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is most likely a bug. However, according to the &lt;code&gt;qasm2tex.py&lt;/code&gt; docstring it was last updated by Ike (Isaac Chuang) on 2004/03/25 15:36:59, so I'm not hoping that it'll ever be officially fixed. Anyhow, the fix is just a four-line addition to &lt;code&gt;qasm2tex.py&lt;/code&gt;, so I'm writing it down here just in case someone finds it helpful or wishes to write their own extension to the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(m):&#xA;    (name,nctrl) = m.group(1).split(',')&#xA;    tex = m.group(2)&#xA;    if(tex=='bullet'):        # special for bullet, no \op{}&#xA;        texsym = r'\b'&#xA;    if(tex=='oplus'):&#xA;        texsym = r'\o'        # special for oplus, no \op{}&#xA;    if(tex=='times'):&#xA;        texsym = r'\t'        # special for times, no \op{}        &#xA;    elif(tex.find(r'\dmeter')&amp;gt;=0):  # if meas, don't put in \op{}&#xA;        texsym = tex&#xA;    else:&#xA;        texsym = '\op{%s}' % tex&#xA;    nctrl = int(nctrl)&#xA;    if GateMasterDef.has_key(name):&#xA;        print &quot;[qasm_parser] oops! duplicate def for op %s&quot; % line&#xA;    else:&#xA;        GateMasterDef[name] = (nctrl+1, nctrl, texsym)&#xA;    # print &quot;definition: %s&quot; % m.group(1)&#xA;    continue&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now to answer the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6003&quot;&gt;original question&lt;/a&gt;, after the above fix has been made, the required QASM code and the corresponding TeX output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%   def cccnot,3,'oplus'&#xA;% &#xA;%   qubit   j0&#xA;%   qubit   j1&#xA;%   qubit   j2&#xA;%   qubit   j3&#xA;% &#xA;%   toffoli j0,j1,j2&#xA;%   X   j0&#xA;%   cccnot  j2,j3,j0,j1&#xA;%   H   j2&#xA;%   measure j3&#xA;% &#xA;&#xA;%  Time 01:&#xA;%    Gate 00 toffoli(j0,j1,j2)&#xA;%  Time 02:&#xA;%    Gate 01 X(j0)&#xA;%  Time 03:&#xA;%    Gate 02 cccnot(j2,j3,j0,j1)&#xA;%  Time 04:&#xA;%    Gate 03 H(j2)&#xA;%    Gate 04 measure(j3)&#xA;&#xA;% Qubit circuit matrix:&#xA;%&#xA;% j0: gAxA, gBxA, gCxA, n  , n  &#xA;% j1: gAxB, n  , gCxB, n  , n  &#xA;% j2: gAxC, n  , gCxC, gDxC, n  &#xA;% j3: n  , n  , gCxD, gDxD, N  &#xA;&#xA;\documentclass[11pt]{article}&#xA;\input{xyqcirc.tex}&#xA;&#xA;% definitions for the circuit elements&#xA;&#xA;\def\gAxA{\b\w\A{gAxA}}&#xA;\def\gAxB{\b\w\A{gAxB}}&#xA;\def\gAxC{\o\w\A{gAxC}}&#xA;\def\gBxA{\op{X}\w\A{gBxA}}&#xA;\def\gCxC{\b\w\A{gCxC}}&#xA;\def\gCxD{\b\w\A{gCxD}}&#xA;\def\gCxA{\b\w\A{gCxA}}&#xA;\def\gCxB{\o\w\A{gCxB}}&#xA;\def\gDxC{\op{H}\w\A{gDxC}}&#xA;\def\gDxD{\meter\w\A{gDxD}}&#xA;&#xA;% definitions for bit labels and initial states&#xA;&#xA;\def\bA{ \q{j_{0}}}&#xA;\def\bB{ \q{j_{1}}}&#xA;\def\bC{ \q{j_{2}}}&#xA;\def\bD{ \q{j_{3}}}&#xA;&#xA;% The quantum circuit as an xymatrix&#xA;&#xA;\xymatrix@R=5pt@C=10pt{&#xA;    \bA &amp;amp; \gAxA &amp;amp;\gBxA &amp;amp;\gCxA &amp;amp;\n   &amp;amp;\n  &#xA;\\  \bB &amp;amp; \gAxB &amp;amp;\n   &amp;amp;\gCxB &amp;amp;\n   &amp;amp;\n  &#xA;\\  \bC &amp;amp; \gAxC &amp;amp;\n   &amp;amp;\gCxC &amp;amp;\gDxC &amp;amp;\n  &#xA;\\  \bD &amp;amp; \n   &amp;amp;\n   &amp;amp;\gCxD &amp;amp;\gDxD &amp;amp;\N  &#xA;%&#xA;% Vertical lines and other post-xymatrix latex&#xA;%&#xA;\ar@{-}&quot;gAxC&quot;;&quot;gAxA&quot;\ar@{-}&quot;gAxC&quot;;&quot;gAxB&quot;&#xA;\ar@{-}&quot;gCxB&quot;;&quot;gCxC&quot;\ar@{-}&quot;gCxB&quot;;&quot;gCxD&quot;\ar@{-}&quot;gCxB&quot;;&quot;gCxA&quot;&#xA;}&#xA;&#xA;\end{document}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;Circuit Diagram:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NUBQi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NUBQi.png&quot; alt=&quot;qasm2circ: Example 6 (replaced U with oplus)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-04-29T10:11:51.690" LastActivityDate="2019-04-29T10:11:51.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6008" PostTypeId="2" ParentId="6002" CreationDate="2019-04-29T11:42:38.183" Score="2" Body="&lt;p&gt;As an exam question, you're unlikely to be asked to produce some entirely arbitrary state (I guess). What you want to do is try and spot similarities to things you already know how to produce. On particularly useful strategy to think about here is a change of basis - it's a very cheap way to disguise something you know about as something else.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this instance, have you seen the GHZ state before? Does it look kind of similar in structure? What is the difference and how do you build that into a circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've got a circuit that works, take a moment to see if there are any obvious simplifications you can make.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-29T11:42:38.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6009" PostTypeId="1" AcceptedAnswerId="6025" CreationDate="2019-04-29T14:37:59.510" Score="2" ViewCount="142" Body="&lt;p&gt;Consider an arbitrary qudit state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; modes.&#xA;Any such state can be represented as a point in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^{d^2-1}$&lt;/span&gt; via the standard Bloch representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{1}{d}\left(\mathbb I +\sum_k c_k\sigma_k\right)$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; traceless Hermitian matrices satisfying &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sigma_j\sigma_k)=d\delta_{jk}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a qubit, &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, we can take the &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; matrices to be the standard Pauli matrices, and the set of states is thus mapped into a sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^3$&lt;/span&gt;, which is the standard Bloch sphere representation of qubits.&#xA;For &lt;span class=&quot;math-container&quot;&gt;$d&amp;gt;2$&lt;/span&gt;, this picture becomes significantly more complicated, and the states are not in general mapped into a (hyper-)sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, the special case &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt; is analysed in &lt;a href=&quot;https://arxiv.org/abs/1111.4427&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. At the beginning of page 6, the authors make the following statement:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is clear that the boundary of &lt;span class=&quot;math-container&quot;&gt;$\Omega_3$&lt;/span&gt; comprises density matrices which are singular.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$\Omega_3$&lt;/span&gt; represents the set of qutrit states in their standard Bloch representation (thus &lt;span class=&quot;math-container&quot;&gt;$\Omega_3\subset\mathbb R^8$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This statement does not, however, seem so obvious to me. I understand that if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is not singular, then it can be written as convex combinations of other states, and it would therefore seem that it could not lie on the boundary of the set of states. However, is it not in principle possible that at least a section of &lt;span class=&quot;math-container&quot;&gt;$\Omega_3$&lt;/span&gt; is &quot;flat&quot; (as in, is a subsection of a hyperplane), so that convex combinations of states on this boundary still lie on the boundary?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively this is most likely not the case, but is there an easy way to prove it?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Related questions:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4251/55&quot;&gt;Geometry of qutrit and Gell-Mann matrices&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/398114/58382&quot;&gt;What is the dimension of the space of all pure qudit states of dimension &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-05T09:36:16.747" LastActivityDate="2019-06-05T09:36:16.747" Title="Why is the boundary of the set of states in the generalised Bloch representation comprised of singular matrices?" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6011" PostTypeId="1" AcceptedAnswerId="6020" CreationDate="2019-04-29T16:01:43.610" Score="6" ViewCount="1353" Body="&lt;p&gt;What is the smartest way of calculating the expectation value of some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two ways I know:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;noreferrer&quot;&gt;quantum phase estimation algorithm&lt;/a&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;noreferrer&quot;&gt;Hadamard test&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are there more efficient techniques to do that?&lt;/p&gt;&#xA;" OwnerUserId="4144" LastEditorUserId="4144" LastEditDate="2019-04-29T16:03:14.773" LastActivityDate="2021-02-19T04:00:24.810" Title="Calculating the expectation value of a unitary operator on a quantum computer" Tags="&lt;algorithm&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6012" PostTypeId="2" ParentId="1803" CreationDate="2019-04-29T17:15:02.313" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputingreport.com/our-take/applying-moores-law-to-quantum-qubits/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This article&lt;/a&gt; seems to adequately explain what you are asking. It shows the growth of usable qubits in quantum computers.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;So the question comes up whether Moore’s Law can also be applied to quantum qubits. And early evidence suggests that indeed it may [...]&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qnYTb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qnYTb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The adiabatic line would be a prediction for quantum annealing machines like the D-Wave computers. These have followed the Moore’s Law prediction pretty closely so far with the D-Wave 1 at 128 qubits in 2011, the D-Wave 2 at 512 qubits in 2013, the D-Wave 2X at 1097 qubits in 2015, and a 2048 qubit machine in 2017. [...]&lt;/p&gt;&#xA;&lt;p&gt;The Physical curve predicts the number of physical qubits that will be available.  There is less historical data on these, but there are indications that these will progress rapidly too. As examples, IBM has a 5 qubit machine that is available in the cloud through the IBM Quantum Experience and Google has demonstrated a 9 qubit machine. Both of these companies, and others have indicated that these densities will increase rapidly so the Physical curve maintains the improvement rate of a doubling every year for the next 10 years and a doubling every two years thereafter.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7369" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-01T09:30:35.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6013" PostTypeId="2" ParentId="6011" CreationDate="2019-04-29T20:34:00.777" Score="2" Body="&lt;p&gt;To find modulus of that expectation value you can use swap test on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes U|\psi\rangle$&lt;/span&gt;.&lt;br&gt;&#xA;I doubt there are simpler ways since &lt;span class=&quot;math-container&quot;&gt;$\langle \psi |U|\psi\rangle$&lt;/span&gt; is complex in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also note, that both algorithms you mentioned require access to the controlled version of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. But you can't construct circuit for controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is given as blackbox. Though  there are ways to physically implement controlled version. See &lt;a href=&quot;https://arxiv.org/abs/1309.7976&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-04-29T20:34:00.777" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6015" PostTypeId="1" CreationDate="2019-04-29T23:21:54.677" Score="3" ViewCount="114" Body="&lt;p&gt;I am trying to make a 2-qubit maximally mixed state &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}/4$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; is the identity &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that, for a maximally mixed 1-qubit state I can use a Hadamard gate, and a CNOT gate with an ancilla, and then trace out the ancilla as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(H\otimes \mathrm{id})(|0\rangle \otimes |0\rangle)=\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the density matrix would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{1}{2}(|0\rangle\langle0| + |1\rangle\langle1|)=\frac{1}{2}\begin{pmatrix}1&amp;amp;0\\0&amp;amp;1\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do the same for 2 qubits?&lt;/p&gt;&#xA;" OwnerUserId="4725" LastEditorUserId="7336" LastEditDate="2019-04-30T05:47:24.060" LastActivityDate="2019-04-30T05:47:24.060" Title="Making a maximally mixed 2-qubit state in the IBM Q" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;gate-synthesis&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6016" PostTypeId="2" ParentId="6015" CreationDate="2019-04-30T01:15:59.390" Score="2" Body="&lt;p&gt;Prepare two qubits each in the single-qubit maximally mixed state.  Their state together will be the two-qubit maximally mixed state ;)  You could prepare them sequentially and use the same ancillary qubit for both.&lt;/p&gt;&#xA;" OwnerUserId="7336" LastActivityDate="2019-04-30T01:15:59.390" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6017" PostTypeId="1" AcceptedAnswerId="6031" CreationDate="2019-04-30T02:57:45.970" Score="1" ViewCount="90" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$f(x,y)$&lt;/span&gt; be a random 2n- to 1-bit function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the quantum circuit &lt;span class=&quot;math-container&quot;&gt;$|x,y,z\rangle \to |x,y,z\oplus f(x,y)\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the new state entangled in general? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it entangled if &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$H^{\bigotimes n}|0\rangle$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="7371" LastEditorUserId="26" LastEditDate="2019-05-01T09:35:08.650" LastActivityDate="2019-05-01T11:57:20.253" Title="Is $ |x,y,z\oplus f(x,y)\rangle$ entangled?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6018" PostTypeId="2" ParentId="6017" CreationDate="2019-04-30T03:17:37.413" Score="3" Body="&lt;p&gt;It depends on the input state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If f(x, y) is zero for all x, y in the superposition, then the output will equal the input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This operation is its own inverse, so if you apply it to an unentangled state u and get an entangled state v, that means when you get v as an input state the operation actually disentangles it.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-04-30T03:17:37.413" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6019" PostTypeId="1" CreationDate="2019-04-30T05:13:31.670" Score="4" ViewCount="80" Body="&lt;p&gt;I am playing with the IBM Q and I would like to know what interesting properties I can measure with only a 1 qubit state. This is because things like Bell's inequalities, concurrence, PPT criterion, etc. are all for 2 qubit states (which I plan on doing, eventually).&lt;/p&gt;&#xA;" OwnerUserId="4725" LastEditorUserId="26" LastEditDate="2019-05-01T10:02:45.603" LastActivityDate="2021-03-26T10:25:53.107" Title="What interesting properties can I measure with a 1 qubit state?" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6020" PostTypeId="2" ParentId="6011" CreationDate="2019-04-30T12:09:42.160" Score="5" Body="&lt;p&gt;Since the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is known, we can assume that we have a preparation procedure that takes some standard state (call it &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, although in general it will be composed of many qubits). Thus, there is a unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V|0\rangle=|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In that case, to measure &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi|U|\psi\rangle|^2$&lt;/span&gt;, we simply follow the procedure&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measure in a basis for which &lt;span class=&quot;math-container&quot;&gt;$0\rangle$&lt;/span&gt; is one of the elements&lt;/li&gt;&#xA;&lt;li&gt;Repeat until you have a suitably accurate estimate of the probability of getting the answer &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This probability is your answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|U|\psi\rangle$&lt;/span&gt;, the Hadamard test is probably your best bet. Yes, it requires controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, but you're going to need something like that. This is because there's no observable difference between &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}U$&lt;/span&gt;, so nothing you do can access the phase of &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|U|\psi\rangle$&lt;/span&gt; (but there is a difference between controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}U$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-04-30T12:09:42.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6021" PostTypeId="1" CreationDate="2019-04-30T12:46:26.950" Score="1" ViewCount="65" Body="&lt;p&gt;I am working with a circuit where I use 4 cables, and perform measurements in all of them. Nevertheless, I am only interested in the results from two cables since the other two are ancillas. When I run the circuit in the processor I get more than 4 bars. How do I interpret my results? I attached an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Processor:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SWh2K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SWh2K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simulator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/17LDK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/17LDK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case (and with any other test I ran), if I add up the processor's result for 00000 and 00010 I get almost the same result for 00000 in the simulator. I don't know if this is due to the partial traces.&lt;/p&gt;&#xA;" OwnerUserId="4725" LastEditorUserId="26" LastEditDate="2019-05-02T04:22:31.537" LastActivityDate="2019-05-02T04:22:31.537" Title="Interpreting results from IBM's processor vs. simulator" Tags="&lt;measurement&gt;&lt;simulation&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6022" PostTypeId="2" ParentId="6021" CreationDate="2019-04-30T13:39:38.347" Score="1" Body="&lt;p&gt;When you run in the simulator you are running in an &quot;ideal&quot; environment. This means there is no noise that could cause errors in the readouts. That is why the results you get from the simulator are only those 3 expected results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when you run on the real devices, in this case 'ibmqx2', the environment is not a perfect one. The real devices are noisy, and that noise affects the qubits. These errors are seen when you measure the qubits and experience all of the other unexpected results. You will still see the expected answer as having the highest probability in most cases, though.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-04-30T13:39:38.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6023" PostTypeId="1" CreationDate="2019-04-30T14:53:21.503" Score="2" ViewCount="423" Body="&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/questions/476971&quot;&gt;Physics SE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made some circuit to prepare a 2 qubit state, but I am having trouble understanding how to measure Bell's inequality. I know the inequality is of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|E(a,b)-E(a,b')+E(a',b)+E(a',b')| \leq 2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where for each &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E = \frac{N_{++} + N_{--} - N_{-+} - N_{+-}}{N_{++} + N_{--} + N_{-+} + N_{+-}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is, what would the different &lt;span class=&quot;math-container&quot;&gt;$a,a',b,b'$&lt;/span&gt; be? With this question, I don't mean what their values would be (since IBM Q just outputs &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; basis), but how do I implement this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I just do &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; basis and &lt;span class=&quot;math-container&quot;&gt;$a',b'$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt; basis? And if so, how do I proceed with this? Do I just apply a Hadamard gate before the measurement and take whatever &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; value it outputs?&lt;/p&gt;&#xA;" OwnerUserId="4725" LastEditorUserId="26" LastEditDate="2019-05-01T09:54:49.753" LastActivityDate="2019-05-01T09:54:49.753" Title="How to measure a Bell inequality violation in IBM Q?" Tags="&lt;measurement&gt;&lt;ibm-q-experience&gt;&lt;correlations&gt;&lt;bell-experiment&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6024" PostTypeId="1" AcceptedAnswerId="6032" CreationDate="2019-04-30T15:52:48.750" Score="0" ViewCount="174" Body="&lt;p&gt;Nilsen states that one can define a function for the oracle in the Grover algorithm, which is constructed as follows. So there is a number &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; that consists of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; (both primes) &lt;span class=&quot;math-container&quot;&gt;$m = pq$&lt;/span&gt;. Now define a function that says &lt;span class=&quot;math-container&quot;&gt;$f (x) \equiv 1 $&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; divides &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, 0 otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x \in \{1,7,11,77\}$&lt;/span&gt; would be 1. That means in the algorithm then the amplitudes of these states would be negated and increased by the diffusion operator. If I measure the register then say I could measure states &lt;span class=&quot;math-container&quot;&gt;$1, 7, 11, 77$&lt;/span&gt;. But 1 and 77 do not bring me much as prime factors?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So that I actually measure 7 and 11 as correct prime factors, would it be enough to simply rerun the algorithm?&lt;/p&gt;&#xA;" OwnerDisplayName="user4961" LastEditorUserId="26" LastEditDate="2019-05-01T09:34:06.923" LastActivityDate="2019-05-01T12:20:13.803" Title="Grover's algorithm and RSA from Nielsen" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6025" PostTypeId="2" ParentId="6009" CreationDate="2019-04-30T16:30:09.637" Score="2" Body="&lt;p&gt;Your intuition is correct, since rank-2 density matrices will be convex combinations of rank-1 density matrices, but they will be singular and hence will still be on the boundary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can prove that non-singular &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are in the interior of &lt;span class=&quot;math-container&quot;&gt;$\Omega_3$&lt;/span&gt; with a fairly direct proof. Let &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; be some matrix (the Bloch representation of some vector of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^8$&lt;/span&gt;) such that &lt;span class=&quot;math-container&quot;&gt;$\Vert\rho-\rho'\Vert&amp;lt;\epsilon$&lt;/span&gt;. Because &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; is a Bloch representation of something, it has trace 1, so if we want to show that it's a density matrix, we just need to show that it's positive. To do this we show that &lt;span class=&quot;math-container&quot;&gt;$\langle v,\rho'v\rangle\geq 0$&lt;/span&gt; for all vectors &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that since &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is non-singular, it has a minimum eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;gt;0$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$\langle v,\rho v\rangle\geq\lambda\Vert v\Vert^2$&lt;/span&gt; for all vectors &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;. We also have that &lt;span class=&quot;math-container&quot;&gt;$\vert \langle v,(\rho-\rho')v\rangle\vert\leq \Vert \rho-\rho'\Vert\Vert v\Vert^2$&lt;/span&gt;. Combining these facts:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}\langle v,\rho'v\rangle=&amp;amp;\langle v,(\rho'-\rho) v\rangle+\langle v,\rho v\rangle \\&#xA;\geq &amp;amp; -\Vert \rho-\rho'\Vert\Vert v\Vert^2+\lambda \Vert v\Vert^2\\&#xA;&amp;gt;&amp;amp;-\epsilon\Vert v\Vert^2+\lambda\Vert v\Vert^2&#xA;\end{aligned}$$&lt;/span&gt;&#xA;If we choose &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;lt;\lambda$&lt;/span&gt;, this will be positive for all such &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt;. Thus, the ball of radius &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; around &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is contained in &lt;span class=&quot;math-container&quot;&gt;$\Omega_3$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is an interior point.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastEditorUserId="4517" LastEditDate="2019-05-01T09:50:32.417" LastActivityDate="2019-05-01T09:50:32.417" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6026" PostTypeId="1" AcceptedAnswerId="6027" CreationDate="2019-04-30T18:02:05.173" Score="3" ViewCount="144" Body="&lt;p&gt;I am trying to understand how the quantum gates work, so I started with the simplest one, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Pauli-X_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli X gate&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get that it turns &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&#xA;to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is how do I read its matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;X = \begin{bmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{bmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What maps to it?&lt;/p&gt;&#xA;" OwnerUserId="7375" LastEditorUserId="26" LastEditDate="2019-05-01T09:49:02.920" LastActivityDate="2019-05-01T09:49:02.920" Title="How to interpret the matrix representation of a quantum gate?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6027" PostTypeId="2" ParentId="6026" CreationDate="2019-05-01T03:01:46.943" Score="3" Body="&lt;p&gt;Lets understand this first using Bra-Ket notation then we move on to answering : what does a matrix maps by just looking at it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets get some basics out of the way,&#xA;the vectors &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; are represented by,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\vert 0 \rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \ \ \ \ \ \&amp;amp; \ \ \  &#xA;\vert 1 \rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implies,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\vert 0 \rangle \langle 1\vert = \begin{bmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}&#xA;\ \ \ \ \ \&amp;amp; \ \ \  &#xA;\vert 1 \rangle \langle 0\vert = \begin{bmatrix} 0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{bmatrix}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I can write my &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate as,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;X = \begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix} = \begin{bmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}&#xA;+ \begin{bmatrix} 0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{bmatrix} = \vert 0 \rangle \langle 1\vert  + \vert 1 \rangle \langle 0\vert .&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle \langle 0\vert$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle \rightarrow \vert 1 \rangle$&lt;/span&gt;, and the term &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle \langle 1\vert$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle \rightarrow \vert 1 \rangle$&lt;/span&gt;. You can see this by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left(\vert 0 \rangle \langle 1 \vert\right)  \vert 1\rangle = \vert 0 \rangle&#xA;\ \ \ \ \ \&amp;amp; \ \ \ &#xA;\left(\vert 1 \rangle \langle 0 \vert\right)  \vert 0\rangle = \vert 1 \rangle.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a matix you can always write it in this bra-ket notation, and easily see how it maps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you gain experience working  with these it is easy to see that a general matrix pictorially can be represented as, &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{bmatrix} a &amp;amp; b \\ c &amp;amp; d \end{bmatrix} = \begin{bmatrix} a\vert 0 \rangle\langle 0 \vert &amp;amp; b \vert 0 \rangle\langle 1 \vert \\ c\vert 1 \rangle\langle 0 \vert &amp;amp; d\vert 1 \rangle\langle 1 \vert \end{bmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;Note the word pictorially, cause the way I wrote it, in standard text it would imply a &lt;span class=&quot;math-container&quot;&gt;$4\times4$&lt;/span&gt; matrix. Now given a matrix you can easily work out how each of the non-zero term acts on the basis states &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle, \vert 1 \rangle$&lt;/span&gt; ans see where the matrix maps to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Z = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}&#xA;\end{equation}&lt;/span&gt; &#xA;has non-zero terms &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle\langle0 \vert$&lt;/span&gt; which maps &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle \rightarrow \vert 0 \rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$-\vert 1 \rangle\langle1 \vert$&lt;/span&gt; which maps &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle \rightarrow -\vert 1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a homework for you, Understand the mapping of  Hadamard gate and then move on to understand &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I did not worry about what &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle \langle 0\vert$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; to, cause of orthogonality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT : After writing this I realized maybe you are asking the following&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say someone gives you a mapping and ask you to find the matrix that applies the said mapping. Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vert x \rangle \langle b \vert&#xA;$$&lt;/span&gt; &#xA;maps &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle $&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;.&#xA;So as an example if one asks you find the matrix that maps &#xA;&lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle \rightarrow (\vert 0 \rangle + \vert 1 \rangle)/\sqrt{2}$&lt;/span&gt;&#xA; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle \rightarrow (\vert 0 \rangle - \vert 1 \rangle)/\sqrt{2}$&lt;/span&gt; you can easily write the matrix being&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{\vert 0 \rangle + \vert 1 \rangle}{\sqrt{2}}\langle 0 \vert + \frac{\vert 0 \rangle - \vert 1 \rangle}{\sqrt{2}}\langle 1 \vert&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\frac{1}{\sqrt{2}}(\vert 0 \rangle\langle 0 \vert + \vert 0 \rangle\langle 1 \vert + \vert 1 \rangle\langle 0 \vert - \vert 1 \rangle\langle 1 \vert) = \frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5746" LastEditorUserId="5746" LastEditDate="2019-05-01T08:32:36.967" LastActivityDate="2019-05-01T08:32:36.967" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6028" PostTypeId="1" CreationDate="2019-05-01T03:56:55.710" Score="4" ViewCount="46" Body="&lt;p&gt;Example 2 in &lt;a href=&quot;https://arxiv.org/abs/1811.09896&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1811.09896&lt;/a&gt; states that the &amp;quot;Choi EW (entanglement witness) &lt;span class=&quot;math-container&quot;&gt;$W^{(+)}$&lt;/span&gt; obtained from the Choi map in &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\ldots$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;W^{(+)} = \frac{1}{6} \left( \sum_{i=0}^{2} [ 2| ii \rangle \langle ii |  + | i,i-1 \rangle \langle i, i-1 | ] - 3 \mathrm{P}_{+}  \right) \nonumber,&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}_+ = |\phi^+\rangle \langle \phi^+|$&lt;/span&gt; with the Bell state &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle = (|00\rangle + |11\rangle + |22\rangle) / \sqrt{3}$&lt;/span&gt;.&amp;quot; It is noted that this is applicable in the two-qutrit (&lt;span class=&quot;math-container&quot;&gt;$9 \times 9$&lt;/span&gt; density matrix) setting.&lt;/p&gt;&#xA;&lt;p&gt;I would like to know - if it exists - a two-qudit analogue, applicable to &lt;span class=&quot;math-container&quot;&gt;$16 \times 16$&lt;/span&gt; density matrices. If it does, I presume the summation would run from 0 to 3, and the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{3}$&lt;/span&gt; in the new (obvious) Bell state formula be replaced by 2. Might the coefficient 2 be replaced by 3, and the &lt;span class=&quot;math-container&quot;&gt;$3 P_+$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$4 P_+$&lt;/span&gt;? The &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{6}$&lt;/span&gt; does not seem of particular importance for testing purposes.&lt;/p&gt;&#xA;&lt;p&gt;However, the last paragraph of &lt;a href=&quot;https://arxiv.org/abs/1105.4821&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1105.4821&lt;/a&gt; strongly suggests that there is no simple/direct two-qudit analogue.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="10480" LastEditDate="2021-01-02T04:31:23.617" LastActivityDate="2021-01-02T04:31:23.617" Title="Is there a two-qudit Choi entanglement witness $W^{(+)}$?" Tags="&lt;entanglement&gt;&lt;quantum-information&gt;&lt;density-matrix&gt;&lt;entanglement-witness&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6029" PostTypeId="2" ParentId="6009" CreationDate="2019-05-01T09:56:25.730" Score="2" Body="&lt;p&gt;Non-singular density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; have no zero eigenvalues,  &lt;span class=&quot;math-container&quot;&gt;$\lambda=\lambda_{\mathrm{min}}(\rho)&amp;gt;0$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\min}$&lt;/span&gt; the smallest eigenvalue.  Then, the ball&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{\rho+M|-\lambda I \le M \le \lambda I\}&#xA;$$&lt;/span&gt;&#xA;will also be in the set of density operators, and thus, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is an interior point.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-05-01T09:56:25.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6030" PostTypeId="1" CreationDate="2019-05-01T10:58:26.050" Score="4" ViewCount="93" Body="&lt;p&gt;I am new to the concept of topological quantum computation (TQC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently I have been thinking about simulating a quantum computer on a classical computer. I know that if I use merely the unitary matrices, the process will be very slow due to the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; factor, as is pointed out by many SE answers, such as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1794/is-gil-kalais-argument-against-topological-quantum-computers-sound&quot;&gt;this&lt;/a&gt; to name one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that what if I don't simulate quantum computers that way? What if I simulate a TQC, by (for example) introducing defects on a 2D topological insulators, and do some &quot;simulated&quot; manipulations on such defects? Will that be faster than the brute-force matrix-multiplication method? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that in this way, all the calculations will be reasonably small since the simulation should scale linearly with more &quot;qubits&quot;, which is just an ab-initio calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of me thinks that simulating a TQC will be better, while part of me thinks that this can't be right, TQC should be equivalent to QC.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything I am missing? Or simulating a TQC is indeed faster and better? And if so, why is quantum supremacy has not been achieved yet?&lt;/p&gt;&#xA;" OwnerUserId="7379" LastEditorUserId="7379" LastEditDate="2019-05-02T08:10:06.753" LastActivityDate="2019-05-02T08:10:06.753" Title="Simulating quantum computers using anyon braiding" Tags="&lt;simulation&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;&lt;quantum-advantage&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6031" PostTypeId="2" ParentId="6017" CreationDate="2019-05-01T11:19:42.117" Score="1" Body="&lt;p&gt;If applied on &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}|0\rangle$&lt;/span&gt; then the result will be entangled if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is not constant also in the simpler situation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit strings, &lt;span class=&quot;math-container&quot;&gt;$\forall x,y:~ U|x,y\rangle = |x, y \oplus f(x) \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = U \cdot H^{\otimes n}|0\rangle\otimes|y\rangle$&lt;/span&gt; for some bit string &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. Let's calculate &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\langle\phi|$&lt;/span&gt;. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle\langle\phi| = U \cdot \frac{1}{2^{n-1}}\sum_{i=0}^{2^n-1}|i\rangle\otimes|y\rangle \cdot \frac{1}{2^{n-1}}\sum_{j=0}^{2^n-1}\langle j|\otimes\langle y| \cdot U^\dagger = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{2^{n}} \sum_{i=0}^{2^n-1}|i\rangle\otimes|y\oplus f(i)\rangle \cdot \sum_{j=0}^{2^n-1}\langle j|\otimes\langle y \oplus f(j)| = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{2^{n}} \sum_{i=0}^{2^n-1}\sum_{j=0}^{2^n-1}|i\rangle\langle j|\otimes|y\oplus f(i)\rangle\langle y \oplus f(j)|&#xA;$$&lt;/span&gt;&#xA;Now we can calculate partial trace of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\langle\phi|$&lt;/span&gt; over the first subsystem &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{tr}_1\left(|\phi\rangle\langle\phi|\right) = \text{tr}_1\left(\frac{1}{2^{n}} \sum_{i=0}^{2^n-1}\sum_{j=0}^{2^n-1}|i\rangle\langle j|\otimes|y\oplus f(i)\rangle\langle y \oplus f(j)|\right) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\frac{1}{2^{n}} \sum_{i=0}^{2^n-1}|y\oplus f(i)\rangle\langle y \oplus f(i)|&#xA;$$&lt;/span&gt;&#xA;The result is pure state if and only if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant. Hence &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is entagled iff &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is not constant. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-05-01T11:57:20.253" LastActivityDate="2019-05-01T11:57:20.253" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6032" PostTypeId="2" ParentId="6024" CreationDate="2019-05-01T12:20:13.803" Score="2" Body="&lt;p&gt;If you implement an oracle for Grover's algorithm that sometimes gives unhelpful answers, you can, as you suggest, rerun and remeasure.  In your example, there are only two incorrect answers &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x=m$&lt;/span&gt;.  With the way you defined &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, these would indeed be negated and diffused.  Because there are only two bad answers, the impact may be small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the oracle in Grover's Algorithm can be anything that you can define.  So you can explicitly define &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; divides &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$x\not\in \{0,m\}$&lt;/span&gt;.  This has the effect of making &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; a little more complicated of course, increasing the gate count, but depending on the situation it may be more efficient than having to rerun/remeasure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a reason you wish to run Grover's algorithm to factor a number?  Are you trying to understand something in N&amp;amp;C?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-05-01T12:20:13.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6033" PostTypeId="1" AcceptedAnswerId="6035" CreationDate="2019-05-01T18:18:35.447" Score="3" ViewCount="285" Body="&lt;p&gt;Consider two finite dimensional Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. If I have an isometry &lt;span class=&quot;math-container&quot;&gt;$V:A\rightarrow A\otimes B$&lt;/span&gt;, under what condition can I find a unitary &lt;span class=&quot;math-container&quot;&gt;$U:A\otimes B\to A\otimes B$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$U\rho_{A}\otimes |\psi\rangle\langle \psi|_BU^\dagger=V\rho_{A}V^\dagger$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_B$&lt;/span&gt;? The motivation is I have an isometry like &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and I would like it very much for a state to satisfy &lt;span class=&quot;math-container&quot;&gt;$S(A)_\rho=S(AB)_{V\rho V^\dagger}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is quantum entropy. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="10480" LastEditDate="2021-03-20T06:11:26.183" LastActivityDate="2021-03-20T06:11:26.183" Title="Can an isometry leave entropy invariant?" Tags="&lt;mathematics&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6034" PostTypeId="1" CreationDate="2019-05-01T19:32:32.543" Score="-1" ViewCount="140" Body="&lt;p&gt;I am stuck in a dilemma about how to proceed with a quantum computing algorithm that changes the original state of a system to another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I have a superposition of all &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; bit integer values that are stored in the form of a &lt;span class=&quot;math-container&quot;&gt;$256\times 256$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. In total I would then need &lt;span class=&quot;math-container&quot;&gt;$8+16=24$&lt;/span&gt; qubits to represent the matrix, with the first &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; qubits representing the value in binary i.e &lt;span class=&quot;math-container&quot;&gt;$x\in \{0,1\}^8$&lt;/span&gt; and similarly with index needing &lt;span class=&quot;math-container&quot;&gt;$8+8$&lt;/span&gt; qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I write this matrix in a uniform superposition of all the initial states. If I don't want to perform any operation on this matrix; I need to multiply it with a unitary matrix of size &lt;span class=&quot;math-container&quot;&gt;$ 2^{24}\times 2^{24}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Implementing such a huge matrix on classical computers just to do technically nothing seems weird.  Does quantum computing just theorize this concept for the future? Is merely writing this sufficient when I use classical methods?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="91" LastEditDate="2019-05-01T22:42:07.490" LastActivityDate="2019-05-02T22:04:35.323" Title="Large size of matrices for little outcome" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="8" ClosedDate="2019-05-04T19:49:29.273" ContentLicense="CC BY-SA 4.0" />
  <row Id="6035" PostTypeId="2" ParentId="6033" CreationDate="2019-05-01T19:33:54.160" Score="3" Body="&lt;p&gt;You don't need any additional conditions beyond those already stated in the question. That is, for any isometry &lt;span class=&quot;math-container&quot;&gt;$V: A \rightarrow A\otimes B$&lt;/span&gt; and any unit vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_B$&lt;/span&gt;, there will always be a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; satisfying the equation in the question (simultaneously for every choice of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to see this is to first pick any orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle,\ldots,|n\rangle\}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and then consider the two sets &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle\otimes|\psi\rangle, \ldots, |n\rangle\otimes|\psi\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{V|1\rangle,\ldots,V|n\rangle\}$&lt;/span&gt;. These are orthonormal sets (using the fact that &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is an isometry in the second case), so you can extend them both to be orthonormal bases of &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; and choose a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that maps the first completed basis to the second. Of course there are many ways to do this in general, but in particular you can choose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; so that it maps &lt;span class=&quot;math-container&quot;&gt;$|k\rangle\otimes|\psi\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$V|k\rangle$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$k \in \{1,\ldots,n\}$&lt;/span&gt;. This implies that the equation in the question is satisfied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if what you really want is &lt;span class=&quot;math-container&quot;&gt;$S(A)_{\rho} = S(AB)_{V\rho V^{\dagger}}$&lt;/span&gt;, then it is simpler to conclude that this is always true from the observation that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V \rho V^{\dagger}$&lt;/span&gt; must agree on their nonzero eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2019-05-01T19:33:54.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6036" PostTypeId="2" ParentId="6033" CreationDate="2019-05-01T19:37:25.740" Score="3" Body="&lt;p&gt;You can always do that.&lt;br&gt;&#xA;Subspaces &lt;span class=&quot;math-container&quot;&gt;$\text{Im}(V)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A\otimes |0\rangle$&lt;/span&gt; have the same dimension, so there must be some unitary that translates one subspace to another. That is, &lt;span class=&quot;math-container&quot;&gt;$\exists W \in \text{Unitary}(A\otimes B), W(\text{Im}(V)) = A\otimes |0\rangle$&lt;/span&gt;. Now &lt;span class=&quot;math-container&quot;&gt;$WV$&lt;/span&gt; translates &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$A\otimes |0\rangle$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is isometry &lt;span class=&quot;math-container&quot;&gt;$WV$&lt;/span&gt; is also isometry, hence there exists unitary &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$WV|\phi\rangle = Y|\phi\rangle\otimes |0\rangle$&lt;/span&gt;.&lt;br&gt;&#xA;Now the unitary you are looking is &lt;span class=&quot;math-container&quot;&gt;$U = W^{-1}\cdot Y\otimes I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-05-01T19:37:25.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6037" PostTypeId="1" CreationDate="2019-05-02T05:36:57.763" Score="7" ViewCount="936" Body="&lt;p&gt;What is the representation of the CH gate in ZX-calculus?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a general recipe for going from a ZX-calculus representation of a gate to the representation of the controlled version?&lt;/p&gt;&#xA;" OwnerUserId="1370" LastEditorUserId="26" LastEditDate="2019-05-02T06:12:09.130" LastActivityDate="2019-05-06T11:45:08.390" Title="Controlled Hadamard gate in ZX-calculus" Tags="&lt;quantum-gate&gt;&lt;zx-calculus&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6038" PostTypeId="1" AcceptedAnswerId="15393" CreationDate="2019-05-02T06:01:38.453" Score="6" ViewCount="214" Body="&lt;p&gt;Suppose we use Uhlmann-Jozsa fidelity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(\rho, \sigma):=\left(\mathrm{tr}\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right)^2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can we construct a quantum circuit that helps us calculate the fidelity of two mixed states?&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="2927" LastEditDate="2021-03-20T23:31:48.737" LastActivityDate="2021-03-20T23:31:48.737" Title="Quantum circuit for computing fidelity" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;information-theory&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6039" PostTypeId="5" CreationDate="2019-05-02T06:13:36.900" Score="0" Body="&lt;p&gt;&lt;em&gt;A Simplified Stabilizer ZX-calculus&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;arXiv:1602.04744 [quant-ph]&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="2224" LastEditDate="2019-06-11T00:50:28.130" LastActivityDate="2019-06-11T00:50:28.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6040" PostTypeId="4" CreationDate="2019-05-02T06:13:36.900" Score="0" Body="The ZX-calculus is a high-level and intuitive graphical language for pure qubit quantum mechanics (QM), based on category theory. (arXiv: 1602.04744)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-02T06:13:36.900" LastActivityDate="2019-05-02T06:13:36.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6041" PostTypeId="2" ParentId="6037" CreationDate="2019-05-02T12:11:36.167" Score="6" Body="&lt;p&gt;The easiest way to do this would be to use the general controlled unitary construction given in this post: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1344/given-a-decomposition-for-a-unitary-u-how-do-you-decompose-the-corresponding?rq=1&quot;&gt;Given a decomposition for a unitary $U$, how do you decompose the corresponding controlled unitary gate $C(U)$?&lt;/a&gt; translate the circuit to ZX and hopefully simplify the circuit using ZX rewrite rules to get a nicer expression.  &lt;/p&gt;&#xA;" OwnerUserId="2649" LastActivityDate="2019-05-02T12:11:36.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6042" PostTypeId="2" ParentId="6037" CreationDate="2019-05-02T12:12:34.317" Score="9" Body="&lt;p&gt;In answer to your first question, yes there is a way to build controlled-&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in ZX. It more or less mirrors the construction in quantum circuits. First, one can construct controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-phase gates using the technique described in the &quot;Quantum Computing&quot; chapter of mine and Coecke's book (&lt;a href=&quot;https://www.cambridge.org/core/books/picturing-quantum-processes/1119568B3101F3A685BE832FEEC53E52&quot; rel=&quot;noreferrer&quot;&gt;Picturing Quantum Processes&lt;/a&gt;, p. 687):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TxWWIm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TxWWIm.png&quot; alt=&quot;controlled-Z phase&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;n.b. the white dots are &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-spiders, gray dots are &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-spiders.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a controlled phase gate, which conditionally applies a &lt;span class=&quot;math-container&quot;&gt;$Z(\alpha)$&lt;/span&gt; on the second qubit if the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Using the bialgebra law, it is not too hard to show this is actually equivalent to a more familiar &quot;circuit-like&quot; form of the gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KDjA2m.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KDjA2m.png&quot; alt=&quot;CZ circuit form&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the controlled-&lt;span class=&quot;math-container&quot;&gt;$\operatorname{Z}$&lt;/span&gt; phase gate, wrap the control bit in Hadamards to get a controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; phase gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To create a controlled Hadamard, take its Euler decomposition to get &lt;span class=&quot;math-container&quot;&gt;$Z(\pi/2) X(\pi/2) Z(\pi/2)$&lt;/span&gt;, then to get the controlled version, replace each of the phase gates with controlled-phase gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a general rule (and somewhat in line with Nick's answer), any &quot;circuit-like&quot; ZX-diagram (i.e. built out of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, and phase gates) can be transformed into the controlled version much like you can with a circuit. Phases become controlled-phases, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;s becomes controlled-&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;s, and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt;s become Toffolis (which can also be constructed from spiders, though it's a bit more elaborate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a general technique for adding control wires to ZX-diagrams, which is explained in a recent paper by Jeandel, Perdrix, and Vilmart: &lt;a href=&quot;https://arxiv.org/abs/1805.05296&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1805.05296&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, either technique tends to yields big, unwieldy diagrams. If you find you are working with controlled or multiply-controlled operations a lot, the ZH calculus (a variation on ZX which allows many-legged &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gates) could be more convenient to work with: &lt;a href=&quot;https://arxiv.org/abs/1805.02175&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1805.02175&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7392" LastEditorUserId="26" LastEditDate="2019-05-02T13:53:39.980" LastActivityDate="2019-05-02T13:53:39.980" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6043" PostTypeId="1" CreationDate="2019-05-02T14:05:27.163" Score="1" ViewCount="211" Body="&lt;p&gt;What are some introductory textbooks and resources on quantum computing that do &lt;strong&gt;not&lt;/strong&gt; use Dirac-notation, but rather &lt;strong&gt;ordinary mathematical notation&lt;/strong&gt; (i.e. the notation used by mathematicians to represent vectors, dual vectors, norms, tensor products, inner products, operators, etc.)?&lt;/p&gt;&#xA;" OwnerUserId="7367" LastEditorUserId="26" LastEditDate="2019-05-04T08:08:42.743" LastActivityDate="2019-05-06T07:45:38.220" Title="Resources for quantum computing which do not use Dirac notation" Tags="&lt;resource-request&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6045" PostTypeId="2" ParentId="6043" CreationDate="2019-05-02T14:45:45.207" Score="3" Body="&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note&lt;/strong&gt;: There's some merit in &lt;em&gt;not&lt;/em&gt; using the Dirac notation if you're a mathematics student. Mathematics deals with broader classes of &lt;a href=&quot;https://en.wikipedia.org/wiki/Space_(mathematics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;spaces&lt;/a&gt; than just Hilbert spaces and the properties of Hilbert spaces don't simply carry over cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation#Non-normalizable_states_and_non-Hilbert_spaces&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;. For instance, in &lt;a href=&quot;https://en.wikipedia.org/wiki/Banach_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;Banach spaces&lt;/a&gt; the norm isn't necessarily given by an inner product. In fact, there exist generalizations to quantum theory which specifically employ special Banach spaces rather than the narrower class of Hilbert spaces. It's the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_space#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;additional geometric structure&lt;/a&gt; imposed on the Hilbert space that allows for the bra-ket notation. Using this notation naively when you're studying the properties of the Hilbert spaces as an example of a broader class, isn't a great idea. That said, the bra-ket notation has some beautiful properties cf. the &lt;a href=&quot;https://physics.stackexchange.com/questions/282286&quot;&gt;discussion on Physics SE&lt;/a&gt; and has almost become a tradition in physics. You'll have a hard time following the popular literatures in quantum computing if you do not pick it up over time. Prof. Balakrishnan's has a &lt;a href=&quot;https://www.youtube.com/watch?v=7Xum9jD_IAI&amp;amp;list=PLBD53FA93C10327B9&amp;amp;index=3&quot; rel=&quot;nofollow noreferrer&quot;&gt;wonderful lecture&lt;/a&gt; on this topic! At the end of the lecture, he remarks that &quot;machinery&quot; of Dirac notation, once established, is &lt;em&gt;almost&lt;/em&gt; &quot;automatic&quot; and &quot;self-correcting&quot;, which indeed is true.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You may be interested in &lt;a href=&quot;https://mitpress.mit.edu/books/quantum-algorithms-linear-algebra&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithms via Linear Algebra: A Primer (R.J. Lipton &amp;amp; K.W. Regan)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Summary of notation (including correspondence with &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirac notation&lt;/a&gt;)&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Quantum states&lt;/strong&gt; (vectors in Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\Bbb H^N$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$$\text{Ket: }|a\rangle \longrightarrow  \boldsymbol{a} = \begin{bmatrix}a_0\\ \vdots \\ a_{N-1}\end{bmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Bra: }\langle a| \longrightarrow  \boldsymbol{a}^* = \begin{bmatrix}a_0^* \\ \vdots \\ a_{N-1}^*\end{bmatrix}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a_k \in \Bbb C \space \forall \space k\in\{0,N-1\}$&lt;/span&gt; and * denotes &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_conjugate&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex conjugate&lt;/a&gt;. The &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th component of &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{a}$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{a}_k$&lt;/span&gt; is represented as &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{a}(k)$&lt;/span&gt;. In the textbook, they don't really distinguish between vectors (kets) and their &lt;a href=&quot;https://en.wikipedia.org/wiki/Dual_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;duals&lt;/a&gt; (bras) (i.e. the dual state of &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{a}$&lt;/span&gt; is treated like &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}a_0^* &amp;amp; \dots &amp;amp; a_{N-1}^*\end{bmatrix}^T$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}a_0^* &amp;amp; \dots &amp;amp; a_{N-1}^*\end{bmatrix}$&lt;/span&gt;), so be wary. Note that one particular advantage of the bra-ket notation is that it helps to distinguish a vector from its dual.  &lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Norm&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle a|a\rangle^{\frac{1}{2}} \longrightarrow \langle \boldsymbol{a},\boldsymbol{a}\rangle = ||\boldsymbol{a}|| = |\sum_k\boldsymbol{a}(k)^2|^{1/2}$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tensor Product&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tensor product of two vectors &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{b}$&lt;/span&gt; is the vector &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{c} = \boldsymbol{a} \otimes \boldsymbol{b}$&lt;/span&gt; defined by &lt;span class=&quot;math-container&quot;&gt;$$|c\rangle=|a\rangle\otimes |b\rangle \longrightarrow \boldsymbol{c}(ij)=\boldsymbol{a}(i)\boldsymbol{b}(j).$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Matrices&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are linear operators &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{U}$&lt;/span&gt; on Hilbert spaces. The following properties hold:&#xA; &lt;span class=&quot;math-container&quot;&gt;$$U(|a\rangle+|b\rangle) = U|a\rangle + U|b\rangle \longrightarrow\boldsymbol{U(a+b)}=\boldsymbol{U(a)+U(b)}\tag{1}$$&lt;/span&gt;&#xA; &lt;span class=&quot;math-container&quot;&gt;$$U(k|a\rangle) \longrightarrow \boldsymbol{U}(k\boldsymbol{a})=k\boldsymbol{U(a)}\tag{2}$$&lt;/span&gt;&#xA; where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is a scalar from the underlying field, which is generally &lt;span class=&quot;math-container&quot;&gt;$\Bbb C$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Inner product&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inner product of two vectors &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{b}$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$$\langle a|b\rangle \longrightarrow \langle \boldsymbol{a},\boldsymbol{b}\rangle = \sum_{k=0}^{m}\boldsymbol{a}^*(k)\boldsymbol{b}(k).$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;From the Preface&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This book is an &lt;strong&gt;introduction to quantum algorithms&lt;/strong&gt; unlike any other.&#xA;  It is short, yet it is comprehensive and covers the most important and&#xA;  famous quantum algorithms; it assumes minimal background, yet is&#xA;  mathematically rigorous; it explains quantum algorithms, yet steers&#xA;  clear of the notorious philosophical problems and issues of quantum&#xA;  mechanics.&lt;/p&gt;&#xA;  &#xA;  &lt;hr&gt;&#xA;  &#xA;  &lt;p&gt;Almost all summaries, notes, and books on quantum algorithms use a special  notation for vectors and matrices. This is the famous Dirac notation that was&#xA;  invented by Paul Dirac — who else. It has many advantages and is the&#xA;  de-facto standard in the study of quantum algorithms. &lt;strong&gt;It is a great&#xA;  notation for experts and instrumental to becoming an expert, but we&#xA;  suspect it is a barrier for those starting out who are not experts.&#xA;  Thus, we avoid using it, except for a few places toward the end to&#xA;  givea second view of some complicated states.&lt;/strong&gt; Our thesis is that we&#xA;  can explain quantum algorithms without a single use of this notation.&#xA;  Essentially this book is a testament to that belief: if you find this&#xA;  book more accessible than others, then we believe it owes to this&#xA;  decision. &lt;strong&gt;Our notation follows certain ISO recommendations, including&#xA;  boldface italics for vectors and heavy slant for matrices and&#xA;  operators.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-06T07:45:38.220" LastActivityDate="2019-05-06T07:45:38.220" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6046" PostTypeId="2" ParentId="3873" CreationDate="2019-05-02T14:59:46.873" Score="1" Body="&lt;p&gt;Note that Solovay-Kitaev theorem holds for unitaries on qu&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;it (section 5 in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;DN05&lt;/a&gt;), then we can set &lt;span class=&quot;math-container&quot;&gt;$d=2^n$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary. Following the same analysis, we obtain&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;length of gate sequences &lt;span class=&quot;math-container&quot;&gt;$l_{\epsilon} = O(\ln^{\ln 5/\ln(3/2)} (1/\epsilon))$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;time complexity &lt;span class=&quot;math-container&quot;&gt;$t_{\epsilon} = O(\ln^{\ln 3/\ln(3/2)}(1/\epsilon))$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Now the issue is the accuracy parameter &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$SU(d)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(d^2-1)$&lt;/span&gt;-dimension manifold, so to approximate every gate in &lt;span class=&quot;math-container&quot;&gt;$SU(d)$&lt;/span&gt; within &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;, we generate &lt;span class=&quot;math-container&quot;&gt;$O(1/\epsilon_0^{d^2-1})$&lt;/span&gt; sequences. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, for any specific universal gate set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; the length of gate sequences &lt;span class=&quot;math-container&quot;&gt;$$l_0 \geq O\left(\frac{d^2-1}{\log |\mathcal{G}|} \log(1/\epsilon_0)\right).$$&lt;/span&gt;&#xA;Set &lt;span class=&quot;math-container&quot;&gt;$d=2^n$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, then we obtain &lt;span class=&quot;math-container&quot;&gt;$l_0 \sim 4^n \mathrm{poly}\log(1/\epsilon)$&lt;/span&gt;. Therefore, you indeed need exponentially many gates for approximating unitaries on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.  &lt;/p&gt;&#xA;" OwnerUserId="1777" LastEditorUserId="26" LastEditDate="2019-05-02T15:25:07.257" LastActivityDate="2019-05-02T15:25:07.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6047" PostTypeId="2" ParentId="5603" CreationDate="2019-05-02T15:58:56.533" Score="3" Body="&lt;p&gt;Let me supplement the other answer by also showing what happens in the general case of the Bloch representation of generic qudits of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be an arbitrary state over &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; modes, that is, a &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; positive semi-definite Hermitian matrix with unit trace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As any other Hermitian matrix, we can decompose it in terms of a basis of Hermitian matrices, writing it as something like &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_k c_k\sigma_k$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; an orthonormal basis of Hermitians and &lt;span class=&quot;math-container&quot;&gt;$c_k\in\mathbb R$&lt;/span&gt;.&#xA;There are many ways to choose such a basis for the Hermitian matrices, but a fairly natural choice is to include the &lt;em&gt;identity matrix&lt;/em&gt; in it. If we do, the constraint of orthogonality automatically imposes that all the other elements of the basis must be traceless (because we must have &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\mathbb I^\dagger\sigma_k)=\operatorname{Tr}(\sigma_k)=0$&lt;/span&gt;). Moreover, we remember that we must have &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho)=1$&lt;/span&gt;, and thus we can write the decomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{1}{d}\left(\mathbb I+\sum_k c_k\sigma_k\right),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sigma_j\sigma_k)=\delta_{jk}d$&lt;/span&gt;.&#xA;Note that this choice of normalisation is conventional (we could have equally written &lt;span class=&quot;math-container&quot;&gt;$\rho=\mathbb I/d+\sum_k c_k\sigma_k$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; normalised to one), but is somewhat &quot;natural&quot; in that it puts &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; to a more even footing with &lt;span class=&quot;math-container&quot;&gt;$\mathbb I$&lt;/span&gt;, whose normalisation is instead &quot;forced&quot; by the normalisation constraint on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; (of course, this is conventional as well, but is a &quot;very established&quot; convention).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is now not hard to compute &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)$&lt;/span&gt;, and find it equal to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(\rho^2)=\frac{1}{d}\left(1+\sum_k c_k^2\right)=\frac{1}{d}(1+\lvert\vec c\rvert^2).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; being pure means that it is a projector over some pure state, &lt;span class=&quot;math-container&quot;&gt;$\rho=\lvert\psi\rangle\!\langle\psi\rvert$&lt;/span&gt;, and thus satisfies &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)=1$&lt;/span&gt;.&#xA;It then follows that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure if and only if &lt;span class=&quot;math-container&quot;&gt;$|\vec c|=\sqrt{d-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted that while this result could seem to suggest that the state space for higher-dimensional systems is not significantly more complex than the Bloch sphere we have for qubits, this is far from the case. Indeed, the state space is in general not a (hyper)sphere, nor an (hyper)ellipse or other simple geometrical figure. &lt;a href=&quot;https://physics.stackexchange.com/a/425101/58382&quot;&gt;It stretches by different amounts at different angles&lt;/a&gt;, and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6025/55&quot;&gt;its boundary contains non-pure states&lt;/a&gt;.&#xA;Nevertheless, at least the length of pure states is easy to compute.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-05-02T15:58:56.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6048" PostTypeId="2" ParentId="5603" CreationDate="2019-05-02T19:30:36.693" Score="2" Body="&lt;p&gt;A simple way of proving that the purity (or any other property which only depends on the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;) can only depend on the distance from the center of the Bloch sphere is rotational invariance: Rotating a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto U\rho U^\dagger$&lt;/span&gt; corresponds to a rotation on the Bloch sphere.  Thus, any property which only depends on the eigenvalues (which do not change under &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto U\rho U^\dagger$&lt;/span&gt;) can only depend on the distance from the center. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get an explicit formula, you can then e.g. restrict to diagonal density matrices.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-05-02T19:30:36.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6049" PostTypeId="2" ParentId="6034" CreationDate="2019-05-02T20:21:26.803" Score="1" Body="&lt;p&gt;I'm confused about what you want to do with a &lt;span class=&quot;math-container&quot;&gt;$256\times 256$&lt;/span&gt; matrix of integers &lt;span class=&quot;math-container&quot;&gt;$[0,1,\cdots, 255]$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can create a uniform superposition by Hadamard'ing &lt;span class=&quot;math-container&quot;&gt;$24$&lt;/span&gt; separate qubits, and consider your system as the adjacency matrix of a &lt;span class=&quot;math-container&quot;&gt;$256$&lt;/span&gt;-vertex directed graph, where vertices can be connected with an edge weighted with an integer between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2^8-1=255$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But remember your superposition of &lt;span class=&quot;math-container&quot;&gt;$24$&lt;/span&gt; qubits is then over &lt;strong&gt;all possible&lt;/strong&gt; such graphs.  When you measure your superposition, you would be drawing from all &lt;span class=&quot;math-container&quot;&gt;$2^{24}$&lt;/span&gt; such graphs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It sounds like you want to focus on a &lt;em&gt;particular&lt;/em&gt; instance - e.g., you know your graph already.  But then it's not clear what you are trying to achieve.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-05-02T22:04:35.323" LastActivityDate="2019-05-02T22:04:35.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6050" PostTypeId="2" ParentId="6043" CreationDate="2019-05-03T12:27:12.040" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0003035&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lance Fortnow&lt;/a&gt; has written a brief introduction to quantum complexity theory targeted at computer scientists with no background in quantum physics. It avoids the use of Dirac's bra-ket notation, except in one section that explicitly discusses its absence.&lt;/p&gt;&#xA;" OwnerUserId="1771" LastEditorUserId="1771" LastEditDate="2019-05-06T07:26:59.293" LastActivityDate="2019-05-06T07:26:59.293" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6052" PostTypeId="1" AcceptedAnswerId="6053" CreationDate="2019-05-04T09:08:55.987" Score="8" ViewCount="1189" Body="&lt;p&gt;This is a really easy question, but my mother language is not English and I get confused quite a lot reading Preskill notes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does a bipartite system mean? Is this just that it &quot;lives&quot; in a tensor product of two Hilbert spaces? Does it mean that the system is separable? I just want a clear definition of what bipartite means (without any other special conditions on it), so that I can know for sure. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="26" LastEditDate="2019-05-04T12:05:25.963" LastActivityDate="2019-05-04T22:24:53.060" Title="What does &quot;bipartite&quot; mean?" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6053" PostTypeId="2" ParentId="6052" CreationDate="2019-05-04T11:34:00.050" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does a bipartite system mean?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'll summarize the main definitions below (adapted from &lt;a href=&quot;https://www.quantiki.org/wiki/bipartite-states-and-schmidt-decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantiki&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bipartite system and states&lt;/strong&gt;: If Alice's subsystem is described by the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and Bob's is described by &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt;, the compound bipartite system is described by the tensor product of the two spaces, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt;. State vectors and density operators on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt; are called bipartite quantum states.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bipartite pure state&lt;/strong&gt;:  Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt; be a Hilbert space defined as a tensor product of two Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt;. We call some &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state#Pure_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;pure state&lt;/strong&gt;&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle_{AB}$&lt;/span&gt; on the composite system &lt;span class=&quot;math-container&quot;&gt;$A\cup B$&lt;/span&gt; &lt;strong&gt;bipartite&lt;/strong&gt;, if it is written with respect to the partition &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;, which means &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle_{AB} = \sum_{ij}c_{ij} |i\rangle_A|j\rangle_B$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle_A\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|j\rangle_B\}$&lt;/span&gt; are bases in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt; respectively. Note that if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; has a basis &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle_A\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt; has a basis &lt;span class=&quot;math-container&quot;&gt;$\{|j\rangle_B\}$&lt;/span&gt; then then &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle_A\otimes |j\rangle_B\}$&lt;/span&gt; is automatically a basis for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bipartite mixed state&lt;/strong&gt;: Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; be a mixed state on a composite system &lt;span class=&quot;math-container&quot;&gt;$A\cup B$&lt;/span&gt;. Then we say &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is a bipartite &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state#Mixed_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;mixed state&lt;/strong&gt;&lt;/a&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes\mathcal{H}_B$&lt;/span&gt; and write &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}=\sum_{ij}p_{ij}\rho_{A}^i\otimes \rho_{B}^j$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\{\rho_A^i\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\rho_B^j\}$&lt;/span&gt; are bases of density operators in &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; respectively. Note that if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; has a basis of density operators &lt;span class=&quot;math-container&quot;&gt;$\{\rho_A^i\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt; has a basis of density operators &lt;span class=&quot;math-container&quot;&gt;$\{\rho_B^j\}$&lt;/span&gt; then then &lt;span class=&quot;math-container&quot;&gt;$\{\rho_A^i\otimes \rho_B^j\}$&lt;/span&gt; is automatically a basis for mixed states on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this just that it &quot;lives&quot; in a tensor product of two Hilbert spaces?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Almost, yes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Does it mean that the system is separable?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, not necessarily. You might want to read the Wikipedia page on &lt;a href=&quot;https://en.wikipedia.org/wiki/Separable_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Separable state&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There exist bipartite pure states &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle_{AB}$&lt;/span&gt; which &lt;em&gt;cannot&lt;/em&gt; be written as &lt;span class=&quot;math-container&quot;&gt;$|\Psi_1\rangle_A\otimes |\Psi_2\rangle_B$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|\Psi_1\rangle_A\in \mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Psi_2\rangle_B\in \mathcal{H}_B$&lt;/span&gt;. A bipartite state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle_{AB}$&lt;/span&gt; will separable if and only if it lies in the image of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Segre_embedding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Segre embedding&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$$\iota: \mathbb{C}P^1 \times \mathbb{C}P^1  \to \mathcal{P}(\mathcal{H}_A \otimes \mathcal{H}_B) \cong \mathbb{C}P^3,$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$([x_1 : y_1],[x_2 : y_2]) \mapsto [x_1x_2:x_1y_2:y_1x_2:y_1y_2]$$&lt;/span&gt; as discussed &lt;a href=&quot;https://physics.stackexchange.com/a/141177&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, not every mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; can be written as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Convex_combination&quot; rel=&quot;nofollow noreferrer&quot;&gt;convex combination&lt;/a&gt; of product states (i.e. given &lt;span class=&quot;math-container&quot;&gt;$p_k\geq 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_kp_k=1$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$$\rho_{AB}=\sum_kp_k\rho_A^k\otimes\rho_B^k$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\{\rho_A^k\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\rho_B^k\}$&lt;/span&gt; are bases of mixed states on subsystems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, unlike bipartite pure states, deciding whether an arbitrary density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-hardness&quot; rel=&quot;nofollow noreferrer&quot;&gt;NP-hard&lt;/a&gt; problem cf. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303055&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gurvits, 2003&lt;/a&gt; and &lt;a href=&quot;https://cstheory.stackexchange.com/questions/32122&quot;&gt;this TCS SE discussion&lt;/a&gt;. So in general there are no nice set of rules to distinguish between entangled and separable bipartite mixed states. This is also an open research problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a detailed treatment of quantum entanglement go through &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0702225&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0702225&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-04T22:24:53.060" LastActivityDate="2019-05-04T22:24:53.060" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6054" PostTypeId="2" ParentId="6037" CreationDate="2019-05-04T16:13:10.370" Score="4" Body="&lt;p&gt;If you use the symbol of triangle and lambda box in ZX, see e.g. my paper with KangFeng Ng &lt;a href=&quot;https://arxiv.org/abs/1706.09877&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1706.09877&lt;/a&gt;, then there are two simple ways of representing the CH gate in ZX-calculus, one of them even need not any decomposition of the H gate (diagrams should be read from top to bottom): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PSctF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PSctF.png&quot; alt=&quot;CH without decomposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you don't want any H showing in CH, then you have another diagram for CH:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zIccd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zIccd.png&quot; alt=&quot;CH without H&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my experience, translating C(U) circuits into ZX usually is not an easy way for getting nice expression even after ZX simplification, if you don't know a nicer expression in advance.&lt;/p&gt;&#xA;" OwnerUserId="7412" LastEditorUserId="7412" LastEditDate="2019-05-06T11:45:08.390" LastActivityDate="2019-05-06T11:45:08.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6056" PostTypeId="1" CreationDate="2019-05-04T22:34:49.467" Score="4" ViewCount="32" Body="&lt;p&gt;It's well known that determining whether a bipartite mixed state is separable or entangled is a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-hard problem under some accuracy estimates (cf. this &lt;a href=&quot;https://cstheory.stackexchange.com/questions/32122&quot;&gt;TCS SE discussion&lt;/a&gt;). Now I'm curious whether there exist detailed treatises on the complexity analysis of various possible cases of complete&lt;sup&gt;1&lt;/sup&gt; and partial separability of multipartite (pure and mixed) states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone provide some insight into this? Say, is there any specific case of partial separability, determining which would be a problem in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; rather than in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1: For complete separability, I believe the same arguments apply as for the bipartite case, &lt;a href=&quot;https://cstheory.stackexchange.com/questions/32122/how-does-one-determine-if-a-mixed-bipartite-quantum-state-is-entangled-or-not#comment73436_32158&quot;&gt;as mentioned by Norbert Schuch&lt;/a&gt;. However, it'd be interesting to look at partial separability too. &lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-04T22:43:15.933" LastActivityDate="2019-05-04T22:43:15.933" Title="Complexity analysis of separability in the multipartite case" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;resource-request&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6057" PostTypeId="1" AcceptedAnswerId="6058" CreationDate="2019-05-05T00:47:41.943" Score="4" ViewCount="189" Body="&lt;p&gt;It is known that both algorithms use the same gates: &lt;span class=&quot;math-container&quot;&gt;$H^{\oplus n}U_fH^{\oplus n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the circuit, the qubits are in the state &lt;span class=&quot;math-container&quot;&gt;$\sum_y \left( \sum_x (-1)^{f(x)+xy} \right) |y\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In DJ's algorithm, one measures the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\oplus n}$&lt;/span&gt;. It can only be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and the function is balanced iff it is 0 (for any balanced or constant function).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Bernstein-Vazirani, one measures every qubit in its &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis and deduces the bits of the dot-product function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that one can apply Bernstein-Vazirani to any balanced or constant function (not just a dot-product function) to get a bit vector, and state that the function is constant iff the vector is zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What seems strange to me is that all the vector returned by BV for a DJ input is not necessarily all zero or all one, so I don't understand the criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are the measurements of each qubit and of the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\oplus n}$&lt;/span&gt; related?&lt;/p&gt;&#xA;" OwnerUserId="7415" LastEditorUserId="7415" LastEditDate="2019-05-05T10:32:33.530" LastActivityDate="2019-05-05T10:55:23.343" Title="Deutsch-Jozsa algorithm as a generalization of Bernstein-Vazirani" Tags="&lt;measurement&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6058" PostTypeId="2" ParentId="6057" CreationDate="2019-05-05T10:55:23.343" Score="1" Body="&lt;p&gt;Finally, I found the answer myself &lt;a href=&quot;https://github.com/Microsoft/Quantum/issues/50&quot; rel=&quot;nofollow noreferrer&quot;&gt;there&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only interesting thing is the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\oplus n}$&lt;/span&gt;.&#xA;If the function is constant, it is &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; and if the function is balanced, it is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, in the first case we are sure to measure all qubits in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and in the second case, we cannot measure all of them in this state (else we would have the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\oplus n}$&lt;/span&gt; that has amplitude &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="7415" LastActivityDate="2019-05-05T10:55:23.343" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6059" PostTypeId="1" AcceptedAnswerId="6060" CreationDate="2019-05-05T11:07:28.580" Score="1" ViewCount="59" Body="&lt;p&gt;What's the default value for a state created by &lt;code&gt;QuantumRegister(1,'name_of_the_register')&lt;/code&gt;? Is it a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="26" LastEditDate="2019-05-06T15:15:02.430" LastActivityDate="2019-05-06T15:15:02.430" Title="Default value for a state created by QuantumRegister" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6060" PostTypeId="2" ParentId="6059" CreationDate="2019-05-05T12:06:50.690" Score="2" Body="&lt;p&gt;Here's the source code for &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/quantumregister.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantumregister.py&lt;/a&gt; and &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/quantumcircuit.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantumcircuit.py&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The default is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. The code goes like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;qr = QuantumRegister(1) &#xA;circuit = QuantumCircuit(qr) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By the way, if you're just beginning with Qiskit, you could check out &lt;a href=&quot;https://books.google.co.in/books/about/Mastering_Quantum_Computing_with_IBM_QX.html?id=jCWGDwAAQBAJ&amp;amp;redir_esc=y&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dr. Moran's textbook&lt;/a&gt; (this specific example is covered in chapter 5, ~p. 83).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-05T13:58:06.687" LastActivityDate="2019-05-05T13:58:06.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6062" PostTypeId="2" ParentId="5454" CreationDate="2019-05-05T14:01:49.497" Score="1" Body="&lt;p&gt;As a reminder, Shor's algorithm is implemented in the &lt;strong&gt;gate&lt;/strong&gt; model of computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned by @nippon, factoring is can also be described as an &lt;em&gt;optimization&lt;/em&gt; problem, which may be solved with an &lt;strong&gt;adiabatic&lt;/strong&gt; algorithm - e.g., by evolving a quantum state to a minimum of &lt;span class=&quot;math-container&quot;&gt;$(N-xy)^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; may be factors of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The adiabatic algorithm's runtime is, as I understand it, notoriously fickle to be determined, being based on spectral properties of the problem Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although numerical simulations have sometimes looked encouraging, I believe it is still an open question as to whether an adiabatic factoring algorithm really provides an exponential speedup over classical factoring.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See more details in &lt;a href=&quot;https://arxiv.org/abs/0808.1935&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Peng, Liao, Xu, Gan Qin, Zhou, Suter, and Du - their FIG. 3 simulations of the runtime suggest a quadratic fit; however; I'm not sure if any further research on proving such a fit, or providing more evidence of even a polynomial runtime, has taken place.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-05-05T14:01:49.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6063" PostTypeId="1" AcceptedAnswerId="6068" CreationDate="2019-05-05T16:57:51.243" Score="2" ViewCount="212" Body="&lt;p&gt;I'm going through the &lt;a href=&quot;https://quantum.country/qcvc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computing for the very curious (Matuschak &amp;amp; Nielsen)&lt;/a&gt; tutorial. The example shows a &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gate where the input of the control bit is preceded by a Hadamard gate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6W0Eq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6W0Eq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output of the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate (@ point 2) is &lt;span class=&quot;math-container&quot;&gt;$\frac{|0\rangle+|1\rangle}{\sqrt{2}}$&lt;/span&gt;. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tutorial then writes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For the two qubits it doesn't affect the second qubit at all, and so it takes &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{|00\rangle + |10\rangle}{\sqrt 2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The end result is: &lt;span class=&quot;math-container&quot;&gt;$\frac{|00\rangle + |11\rangle}{\sqrt 2}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I think) I understand:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the first qubit of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is for the control bit and the second for the target qubit&lt;/li&gt;&#xA;&lt;li&gt;a &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; would output a &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; in a &lt;span class=&quot;math-container&quot;&gt;$\operatorname{CNOT}$&lt;/span&gt; gate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, the piece I don't understand is why is the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; also part of the target qubit.&#xA;At point A, the input of the target qubit, remains unchanged a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, no? Why does it suddenly have a &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7418" LastEditorUserId="26" LastEditDate="2019-05-06T05:09:10.510" LastActivityDate="2019-05-06T08:04:40.990" Title="CNOT's control qubit preceded by Hadamard: Why is sqrt also applied to target qubit?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6064" PostTypeId="2" ParentId="6063" CreationDate="2019-05-05T19:13:23.490" Score="3" Body="&lt;p&gt;In general, you can do any computation without worrying about the norm because you cannot actually measure the norm of a quantum state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simplest superposition &lt;span class=&quot;math-container&quot;&gt;$a |0\rangle + b |1\rangle$&lt;/span&gt;, you know that the probability to measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (resp. &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) is proportional to &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt; (resp. &lt;span class=&quot;math-container&quot;&gt;$|b|^2$&lt;/span&gt;). Therefore, as the total must be equal to 1, if we want to directly consider the squared norms as probabilities, it implies &lt;span class=&quot;math-container&quot;&gt;$|a|^2 + |b|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a convention, it is often supposed that the norm of a quantum state is  &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Some authors don't bother to write it though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, the quantum gates are &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary matrices&lt;/a&gt;.&#xA;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_(H)_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard gate&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; from your question verifies indeed &lt;span class=&quot;math-container&quot;&gt;$HH^* = I$&lt;/span&gt;. A consequence is that its eigenvalues are all on the unit circle, therefore it also won't change the norm of a quantum state (it is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Isometry&quot; rel=&quot;nofollow noreferrer&quot;&gt;isometry&lt;/a&gt; for the Euclidean norm).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A related question is whether the &lt;em&gt;phase factor&lt;/em&gt; (a multiplicative factor of norm 1, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Phase_factor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;) matters. That is, are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi/3}|0\rangle$&lt;/span&gt; different?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer (see &lt;a href=&quot;https://physics.stackexchange.com/a/313974/204385&quot;&gt;here&lt;/a&gt; for more details) is that you don't really care about the phase because all experimental values are averages obtained as real eigenvalues of an Hermitial operator, hence the phase is ignored. However, the relative phases between states matter, like in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle + e^{i\pi/3}|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7415" LastEditorUserId="7415" LastEditDate="2019-05-05T20:27:05.847" LastActivityDate="2019-05-05T20:27:05.847" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6065" PostTypeId="1" AcceptedAnswerId="6081" CreationDate="2019-05-05T21:05:04.597" Score="3" ViewCount="111" Body="&lt;p&gt;Say, I wanted to implement a unitary &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to compute a Boolean function &lt;span class=&quot;math-container&quot;&gt;$f:B_n \to B_n$&lt;/span&gt;. This is done by the unitary &lt;span class=&quot;math-container&quot;&gt;$$U_f|x\rangle | y \rangle = &#xA;|x\rangle|y\oplus f(x)\rangle$$&lt;/span&gt; which one can construct even if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; itself is not invertible. Now, suppose &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can classically be computed in polynomial time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the cost of implementing &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="26" LastEditDate="2019-05-06T05:10:52.063" LastActivityDate="2019-05-06T21:21:57.783" Title="Cost of implementing Boolean function quantumly?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6066" PostTypeId="1" AcceptedAnswerId="6086" CreationDate="2019-05-05T21:23:27.183" Score="5" ViewCount="88" Body="&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/q/478237/58382&quot;&gt;Physics SE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I have to show that a superoperator &lt;span class=&quot;math-container&quot;&gt;$\$$&lt;/span&gt; cannot increase relative entropy using the monotonicity of relative entropy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\rho_A || \sigma_A) \leq S(\rho_{AB} || \sigma_{AB}).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have to prove:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\$\rho|| \$ \sigma) \leq S(\rho || \sigma).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the hint is that I should use the unitary representation of the superoperator &lt;span class=&quot;math-container&quot;&gt;$\$$&lt;/span&gt;. I know that we can represent &lt;span class=&quot;math-container&quot;&gt;$ \$ \rho = \sum_i M_i \rho M_i^{\dagger} $&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sum_i M_i M_i^{\dagger} = I$&lt;/span&gt;. Now I am able to write out &lt;span class=&quot;math-container&quot;&gt;$S(\$\rho|| \$ \sigma_A)$&lt;/span&gt; in this notation, but that doesn't bring me any further. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have any idea how to show this in the way that the questions hints to? I already read the original paper of Lindblad but this doesn't help me (he does it another special way). Any clues or how to do this? &lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="10480" LastEditDate="2021-03-20T23:26:06.710" LastActivityDate="2021-03-20T23:26:06.710" Title="Superoperator cannot increase relative entropy" Tags="&lt;entanglement&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6067" PostTypeId="2" ParentId="1461" CreationDate="2019-05-06T01:31:12.967" Score="3" Body="&lt;p&gt;Along with glS' post:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A mixed state would be if you had a can of paint, but you weren't sure if it was blue or yellow. You know it is either one of the two, and once you pop the top and measure it, you'd know, but until you do it is in one of those two pure states. If you picked it up from a stack of cans where you knew there were equally many cans of blue paint as yellow, you would expect an equal chance of it being one or the other. 50% of the time it would be 100% yellow and 50% of the time it would be 100% blue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A superposition is more like if you take half a can of blue and half a can of yellow and pour them together. You've now constructed a new pure state that is expressible as a combination of other pure states. If you test its 'blueness', it is about 50%. If you test its 'yellowness' it is about 50%. It is both yellow and blue at the same time. 100% of the time it is both 50% blue and 50% yellow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measured the amount of blue and yellow in one stack of blue or yellow cans and then in another stack of green, you might be confused to see you have just as much blue and yellow in both stacks, but the difference is that the 'blueness' and 'yellowness' is in a mixed state in the later stack but is in a superposition in the latter.&lt;/p&gt;&#xA;" OwnerUserId="7420" LastActivityDate="2019-05-06T01:31:12.967" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6068" PostTypeId="2" ParentId="6063" CreationDate="2019-05-06T08:04:40.990" Score="3" Body="&lt;p&gt;You should forget about amplitudes as only applying to single qubits. Amplitudes apply to the states of an entire system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, this comes from a property of the tensor product:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\alpha|0\rangle)\otimes(\beta|0\rangle)=(\beta|0\rangle)\otimes(\alpha|0\rangle)=(\alpha\beta|0\rangle)\otimes |0\rangle=|0\rangle\otimes(\alpha\beta|0\rangle)=\alpha\beta(|0\rangle\otimes |0\rangle)&#xA;$$&lt;/span&gt;&#xA;we can move numbers around the tensor product arbitrarily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Physically, what does this mean? Well, if I know my first qubit has a probability amplitude &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; for being in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and the second qubit is guaranteed to be in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then what is the probability amplitude for the two qubits together to be in the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;? It's &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;. Even if you're not yet comfortable with the maths of probability amplitudes, go back to probabilities and check my claim is consistent with what you know: if the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;, and the second is guaranteed to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, what that the probability that the first is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the second is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;? &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-06T08:04:40.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6069" PostTypeId="2" ParentId="6037" CreationDate="2019-05-06T10:56:47.010" Score="5" Body="&lt;p&gt;First, there is a neat way of performing the controlled Hadamard, with only two occurrences of the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0oBc9.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0oBc9.png&quot; alt=&quot;control-H&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your second question, I can give an answer that will get a tad technical, based on the paper arXiv:1805.05296. We are going to use the following construction&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IfRbT.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IfRbT.png&quot; alt=&quot;control-plus&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that we generalise to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; wires: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4SSK2.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4SSK2.png&quot; alt=&quot;control-plus-generalised&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason we denote this operator like this is if plug &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on the control half-edge, we get the identity, while if we plug &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$2|+\rangle\langle+|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are given a diagram &lt;span class=&quot;math-container&quot;&gt;$U:n\to n$&lt;/span&gt;. The first thing we do is use the map/state duality to get a diagram &lt;span class=&quot;math-container&quot;&gt;$U':0\to 2n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/08bdj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/08bdj.png&quot; alt=&quot;map-state-duality&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, suppose there exists a diagram &lt;span class=&quot;math-container&quot;&gt;$\Lambda U':1\to 2n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\Lambda U'|0\rangle = 2^n|+^{2n}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Lambda U'|1\rangle = U'$&lt;/span&gt;. Then the controlled version of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be performed by building:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8UJEP.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8UJEP.png&quot; alt=&quot;control-U&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question hence boils down to finding such a &lt;span class=&quot;math-container&quot;&gt;$\Lambda U'$&lt;/span&gt;. A first &quot;naive&quot; solution is to treat the map &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; nearly as a black box: we only require you know a non-null entry of &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\langle a_1...a_{2n}| U' = x \neq0$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$a_1,...,a_{2n}\in\{0,1\}^{2n}$&lt;/span&gt;, and such that one can represent &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1\\1/x\end{pmatrix}$&lt;/span&gt; with a diagram &lt;span class=&quot;math-container&quot;&gt;$\Lambda (1/x):0\to 1$&lt;/span&gt; in the fragment (in the unrestricted ZX-Calculus, this is always possible). Using yet another construction:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WcvKR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WcvKR.png&quot; alt=&quot;transistor&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;generalised to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/deawm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/deawm.png&quot; alt=&quot;transistor-generalised&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can define &lt;span class=&quot;math-container&quot;&gt;$\Lambda U'$&lt;/span&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZzApD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZzApD.png&quot; alt=&quot;lambda-U&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2019-05-06T10:56:47.010" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6070" PostTypeId="1" AcceptedAnswerId="6071" CreationDate="2019-05-06T13:13:33.533" Score="3" ViewCount="225" Body="&lt;p&gt;Could somebody explain the cnx operator, and how it operates on its qubit parameters to flip the target qubit in Qiskit (Python)?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="124" LastEditDate="2019-05-07T07:57:38.423" LastActivityDate="2019-05-07T07:57:38.423" Title="How does the cnx gate work in Qiskit (Python)?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6071" PostTypeId="2" ParentId="6070" CreationDate="2019-05-06T15:01:04.003" Score="3" Body="&lt;p&gt;The documentation for &lt;code&gt;cnx&lt;/code&gt; says &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/47a0a30949f41c7cf901d5562b225e7fc8f45c21/community/games/game_engines/composite_gates.py#L58&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Control n-1 qubits, apply 'not' to last one&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically &lt;span class=&quot;math-container&quot;&gt;$C^n(X)$&lt;/span&gt; in Qiskit is defined like &lt;span class=&quot;math-container&quot;&gt;$$C^n(X)|x_1\cdots x_{n-1}\rangle|\psi\rangle = |x_1\cdots x_{n-1}\rangle X^{x_1\cdots x_{n-1}}|\psi\rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x_1\cdots x_{n-1}$&lt;/span&gt; in the exponent of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; means the &lt;em&gt;product&lt;/em&gt; of the bits &lt;span class=&quot;math-container&quot;&gt;$x_1,\cdots, x_{n-1}$&lt;/span&gt;. That is, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Pauli-X_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli-X gate&lt;/a&gt; gate gets applied to the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; only when all of the first &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; bits are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="1386" LastEditDate="2019-05-06T15:21:41.887" LastActivityDate="2019-05-06T15:21:41.887" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6072" PostTypeId="1" CreationDate="2019-05-06T15:23:02.890" Score="4" ViewCount="49" Body="&lt;p&gt;I'm a theorist and I assume that I can use entanglement resources for practical use freely, but is this really the case? Is generating entanglement and storing it for long enough periods of time such that it can be consumed a realistic assumption? For example, is it a much longer process with respect to performing logic gates on qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example in quantum algorithms or protocols involving entanglement consumption, like quantum clock synchronization for one. Say the algorithm/protocol needs to be repeated often, continuous clock synchronization lets say. Would entanglement generation be a bottleneck in &quot;realistic&quot; scenarios?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I read about different types of qubits and how entanglement can be generated between them in a lab, but I can't seem to find information about how fast the process is or if it is a deterministic process for each qubit type. I did find some results regarding deterministic entanglement generation, but I couldn't find any metric regarding how fast the process can be repeated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any tips regarding speed or difficulty of quantum entanglement generation would help me a lot, or even just some general insights.&lt;/p&gt;&#xA;" OwnerUserId="509" LastEditorUserId="26" LastEditDate="2019-05-06T15:45:21.677" LastActivityDate="2019-05-06T15:45:21.677" Title="Is generating usable entanglement difficult?" Tags="&lt;entanglement&gt;&lt;physical-realization&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6073" PostTypeId="1" AcceptedAnswerId="6085" CreationDate="2019-05-06T16:26:44.240" Score="3" ViewCount="93" Body="&lt;p&gt;From section 11.3.2 of Nielsen &amp;amp; Chuang:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(4) let &lt;span class=&quot;math-container&quot;&gt;$\lambda_i^j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|e_i^j\right&amp;gt;$&lt;/span&gt; be the eigenvalues and corresponding eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt;. Observe that &lt;span class=&quot;math-container&quot;&gt;$p_i\lambda_i^j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|e_i^j\right&amp;gt;$&lt;/span&gt; are the eigenvalues and eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\sum_ip_i\rho_i$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;\begin{align}S\left(\sum_ip_i\rho_i\right) &amp;amp;= -\sum_{ij}p_i\lambda_i^j\log p_i\lambda_i^j \\ &amp;amp;= - \sum_ip_i\log p_i - \sum_ip_i\sum_j\lambda_i^j\log\lambda_i^j \\ &amp;amp;= H\left(p_i\right) + \sum_ip_iS\left(\rho_i\right)\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So this lemma is used to prove the joint entropy of &lt;span class=&quot;math-container&quot;&gt;$S(\rho_{AB})$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; equal to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = \sum_i p_i (\rho_i)_A \otimes (|e_i\rangle\langle e_i|)_B$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the attached picture (the lemma), they do it first for only the A-system &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \sum_i p_i (\rho_i)_A$&lt;/span&gt;, and then they say that this result directly leads to the &lt;strong&gt;same&lt;/strong&gt; result for the above described AB-system (exactly the same?). First of all, I don't understand how they go from the first to the second line. I understand the fact that &lt;span class=&quot;math-container&quot;&gt;$p_i \lambda^j_i $&lt;/span&gt; are the eigenvalues, but I really don't see how... Second question being, how can you use this result to infer the &lt;strong&gt;same&lt;/strong&gt; result for &lt;span class=&quot;math-container&quot;&gt;$S(\rho_{AB})$&lt;/span&gt;? I mean you have your extra system in &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; &quot;hanging&quot; on your A-system and I don't see how this just magically disappears or eventually comes down to a factor of 1 when explicitly calculating &lt;span class=&quot;math-container&quot;&gt;$S(\rho_AB)$&lt;/span&gt;. I feel pretty silly because this is already the proof aka explanation in the book Nielsen &amp;amp; Chuang and I don't even get it. So maybe explain it really simple and down to Earth for me please. &lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="10480" LastEditDate="2021-04-05T17:43:29.173" LastActivityDate="2021-04-05T17:43:29.173" Title="Proof of joint entropy theorem" Tags="&lt;entanglement&gt;&lt;nielsen-and-chuang&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6074" PostTypeId="1" AcceptedAnswerId="6075" CreationDate="2019-05-06T16:51:07.483" Score="2" ViewCount="128" Body="&lt;p&gt;In the following piece of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cnx(qwc, q[0], q[1],q[2],q[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in what order control qubits and target qubit are? Which qubit is inverted for which values of which ones?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="124" LastEditDate="2019-05-07T07:56:36.590" LastActivityDate="2019-05-07T07:56:36.590" Title="Order of controls and targets of cnx gates in Qiskit (Python)" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6075" PostTypeId="2" ParentId="6074" CreationDate="2019-05-06T16:55:48.310" Score="2" Body="&lt;p&gt;As explained &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6071&quot;&gt;here&lt;/a&gt;, if &lt;em&gt;all&lt;/em&gt; of &lt;code&gt;q[0]&lt;/code&gt;, &lt;code&gt;q[1]&lt;/code&gt; and &lt;code&gt;q[2]&lt;/code&gt; (the n-1 qubits) are 1, then &lt;code&gt;q[3]&lt;/code&gt; (the n-th qubit) is inverted. That is, &lt;code&gt;q[3]&lt;/code&gt; is the target qubit and the rest (&lt;code&gt;q[0]&lt;/code&gt;, &lt;code&gt;q[1]&lt;/code&gt; and &lt;code&gt;q[2]&lt;/code&gt;) are controls.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-06T17:01:07.297" LastActivityDate="2019-05-06T17:01:07.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6080" PostTypeId="2" ParentId="6073" CreationDate="2019-05-06T20:52:26.387" Score="3" Body="&lt;p&gt;That lemma has condition that all &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$1\le i \le n$&lt;/span&gt;) have support on orthogonal subspaces. This means that there is a decomposition &lt;span class=&quot;math-container&quot;&gt;$H = \oplus_i H_i$&lt;/span&gt; of the space &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$p_i(H_j) = 0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_i(v_i)\neq 0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$v_i \in H_i$&lt;/span&gt;. Note that there can be component &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$p_i(H_0)=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i \ge 1$&lt;/span&gt;.&lt;br&gt;&#xA;Now there is a little oversimplification in their explanation. In fact we pick only nonzero eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_i^j$&lt;/span&gt;, so vectors &lt;span class=&quot;math-container&quot;&gt;$|e_i^j\rangle$&lt;/span&gt; lay in &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt;. Now it is easy to see that &lt;span class=&quot;math-container&quot;&gt;$\sum_ip_i\rho_i |e_k^j\rangle = p_k\lambda_k^j|e_k^j\rangle$&lt;/span&gt;. &#xA;Moreover, the union of all vectors &lt;span class=&quot;math-container&quot;&gt;$|e_i^j\rangle$&lt;/span&gt; span the support of &lt;span class=&quot;math-container&quot;&gt;$\sum_ip_i\rho_i$&lt;/span&gt;. So this union is a complete set of orthogonal eigenvectors (excluding those from &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for your second question, we apply lemma to the states &lt;span class=&quot;math-container&quot;&gt;$\rho_i^\prime = (\rho_i)_A \otimes (|e_i\rangle\langle e_i|)_B$&lt;/span&gt; on the system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;. That lemma is general, it is not &quot;just for the A-system&quot;. You can check that all &lt;span class=&quot;math-container&quot;&gt;$\rho_i^\prime$&lt;/span&gt; indeed have orthogonal support.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-05-06T21:18:26.843" LastActivityDate="2019-05-06T21:18:26.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6081" PostTypeId="2" ParentId="6065" CreationDate="2019-05-06T21:21:57.783" Score="3" Body="&lt;p&gt;As to the question of how to convert a function performed &lt;strong&gt;iteratively&lt;/strong&gt; using irreversible gates to the same function performed iteratively using reversible gates, you should probably accept that any boolean function from &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; can be written in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3CNF}$&lt;/span&gt;-normal form with a polynomial number of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND, OR, NOT}$&lt;/span&gt; gates (i.e. &lt;span class=&quot;math-container&quot;&gt;$\lor$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\land$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lnot$&lt;/span&gt; gates).  Of these three, only &lt;span class=&quot;math-container&quot;&gt;$\lnot$&lt;/span&gt; is reversible; the other two, &lt;span class=&quot;math-container&quot;&gt;$\land$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lor$&lt;/span&gt; are not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should probably also accept that you can convert any function written in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3CNF}$&lt;/span&gt; having &lt;span class=&quot;math-container&quot;&gt;$\{\lnot,\lor,\land\}$&lt;/span&gt; gates to the same function written with a polynomial number of clauses using only &lt;span class=&quot;math-container&quot;&gt;$\uparrow$&lt;/span&gt;, the Sheffer stroke (for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt;).  The Sheffer stroke &lt;span class=&quot;math-container&quot;&gt;$\uparrow$&lt;/span&gt; is not reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would suffice to replace the Sheffer stroke &lt;span class=&quot;math-container&quot;&gt;$\{\uparrow\}$&lt;/span&gt;, or the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3CNF}$&lt;/span&gt; gates &lt;span class=&quot;math-container&quot;&gt;$\{\lor,\land,\lnot\}$&lt;/span&gt;, with some reversible gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Enter the &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli gate&lt;/a&gt;, aka the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quoting from Wikipedia:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[The Toffoli gate] preserves two of its inputs &lt;em&gt;a,b&lt;/em&gt; and replaces the third &lt;em&gt;c&lt;/em&gt; by &lt;span class=&quot;math-container&quot;&gt;$c\oplus (a\cdot b)$&lt;/span&gt;. With &lt;span class=&quot;math-container&quot;&gt;$c=0$&lt;/span&gt;, this gives the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt; function, and with &lt;span class=&quot;math-container&quot;&gt;$a\cdot b=1$&lt;/span&gt; this gives the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; function. Thus, the Toffoli gate is universal and can implement any reversible boolean function (given enough zero-initialized ancillary bits).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus, you can implement &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; with Toffoli gates, and hence implement &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; with two Toffoli gates.  The implication is that the &quot;enough zero-initialized ancillary bits&quot; is not more than polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't expect that real synthesis of boolean functions uses only Toffoli gates - but at least there's an outline of how you could convert a function written in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3CNF}$&lt;/span&gt;-normal form into some other normal form using nothing but Toffoli gates.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-05-06T21:21:57.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6083" PostTypeId="2" ParentId="5959" CreationDate="2019-05-07T01:52:57.640" Score="1" Body="&lt;p&gt;It turns out the issue with this circuit was in the use of the &lt;code&gt;reset&lt;/code&gt; operator in conjunction with entanglement and superposition. In the oracle code I submitted, I use a Toffoli gate several times, which creates an entanglement between both input qubits and the output qubit. Since the input qubits are in superposition, that superposition state then &quot;spreads&quot; (for lack of a better term) to the output qubit. So, when the output qubit is reset using the &lt;code&gt;reset&lt;/code&gt; operator, its superposition state and entanglements with the input qubits causes certain states to collapse, which changed the output of the circuit as a whole. This had confused me earlier because using &lt;code&gt;reset&lt;/code&gt; with either superposition &lt;em&gt;or&lt;/em&gt; entanglement causes no issue because both can collapse without change to the input because, in a sense, the output and input qubits are seperated. It is only, therefore, when they are used in conjunction that &lt;code&gt;reset&lt;/code&gt; causes this behavior.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution then, is quite simple: reverse the circuit to return the output qubit to a &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; state after it is no longer needed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Encode S1 * !S2 * S3&#xA;circuit.x( search_register[2] )&#xA;circuit.ccx( search_register[1], search_register[2], ancillaries[0] )&#xA;circuit.ccx( search_register[3], ancillaries[0], ancillaries[1] )&#xA;&#xA;# Encode S0 * S1&#xA;circuit.ccx( search_register[0], search_register[1], ancillaries[2] )&#xA;&#xA;# Encode oracle ((S0 * S1) + (S1 * !S2 * S3))&#xA;circuit.x(ancillaries)&#xA;circuit.ccx( ancillaries[1], ancillaries[2], m_qubit[0] )&#xA;circuit.x(m_qubit)&#xA;&#xA;# Return ancillaries to 0s so they can be used later&#xA;circuit.x(ancillaries)&#xA;circuit.ccx( search_register[0], search_register[1], ancillaries[2] )&#xA;circuit.ccx( search_register[3], ancillaries[0], ancillaries[1] )&#xA;circuit.ccx( search_register[1], search_register[2], ancillaries[0] )&#xA;circuit.x( search_register[2] )&#xA;&#xA;# Do rotation about the average&#xA;circuit.h(search_register)&#xA;circuit.x(search_register)&#xA;circuit.ccx( search_register[0], search_register[1], ancillaries[0] )&#xA;circuit.ccx( search_register[2], ancillaries[0], ancillaries[1] )&#xA;circuit.ccx( search_register[3], ancillaries[1], m_qubit[0] )&#xA;circuit.x(search_register)&#xA;circuit.x(m_qubit)&#xA;&#xA;# Return ancillaries to 0s for use later&#xA;circuit.ccx( search_register[2], ancillaries[0], ancillaries[1] )&#xA;circuit.ccx( search_register[0], search_register[1], ancillaries[0] )&#xA;circuit.h(search_register)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing this instead produced the desired result.&lt;/p&gt;&#xA;" OwnerUserId="5472" LastActivityDate="2019-05-07T01:52:57.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6085" PostTypeId="2" ParentId="6073" CreationDate="2019-05-07T07:18:10.410" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I don't understand how they go from the first to the second line&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, you're starting from &lt;span class=&quot;math-container&quot;&gt;$-\sum_{ij}p_i\lambda^j_i\log(p_i\lambda^j_i)$&lt;/span&gt;. Remember that &lt;span class=&quot;math-container&quot;&gt;$\log(ab)=\log(a)+\log(b)$&lt;/span&gt;, so this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-\sum_{ij}p_i\lambda^j_i\log(p_i)-\sum_{ij}p_i\lambda^j_i\log(\lambda^j_i)&#xA;$$&lt;/span&gt;&#xA;For the first term, do the sum over &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\sum_j\lambda^j_i=\text{Tr}(\rho_i)=1$&lt;/span&gt;. This gives you&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-\sum_{i}p_i\log(p_i)-\sum_{i}p_i\sum_j\lambda^j_i\log(\lambda^j_i),&#xA;$$&lt;/span&gt;&#xA;which was the second line you were after.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how can you use this result to infer the same result for &lt;span class=&quot;math-container&quot;&gt;$S(\rho_{AB})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Observe that the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|e^j_i\rangle|e_i\rangle$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$p_i\lambda^j_i$&lt;/span&gt;. Hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho_{AB})=-\sum_{ij}p_i\lambda^j_i\log(p_i\lambda^j_i),&#xA;$$&lt;/span&gt; &#xA;and you're back to that first line again...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS for anybody else coming in and trying to make sense of the question, it is important to state that a condition of the theorem that is being proven is that the &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; have support on orthogonal subspaces. This way, if a given &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; has an eigenvector &lt;span class=&quot;math-container&quot;&gt;$|e^j_i\rangle$&lt;/span&gt; with a non-zero eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda^j_i$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|e^j_i\rangle$&lt;/span&gt; is also an eigenvector of all other &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k\neq i$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$\lambda^j_k=0$&lt;/span&gt;. That is the key reason why we can write that the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sum_ip_i\rho_i$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$p_i\lambda^j_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-07T07:18:10.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6086" PostTypeId="2" ParentId="6066" CreationDate="2019-05-07T07:38:23.610" Score="3" Body="&lt;p&gt;I'm not an expert with this sort of thing (i.e. there may be imperfections in this argument), but hopefully this will set you in the right direction...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}=\rho_A\otimes |0\rangle\langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}=\sigma_A\otimes |0\rangle\langle 0|$&lt;/span&gt;. It must be that &lt;span class=&quot;math-container&quot;&gt;$S(\rho_A\|\sigma_A)=S(\rho_{AB}\|\sigma_{AB})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, your superoperator can be described by a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; over a larger space:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\$\rho=\text{Tr}_B\left(U(\rho\otimes|0\rangle\langle 0|)U^\dagger\right)&#xA;$$&lt;/span&gt;&#xA;So, let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tilde\rho_{AB}=U\rho_{AB}U^\dagger\qquad\tilde\sigma_{AB}=U\sigma_{AB}U^\dagger.&#xA;$$&lt;/span&gt;&#xA;Since it's unitary,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho_A\|\sigma_A)=S(\rho_{AB}\|\sigma_{AB})=S(\tilde \rho_{AB}\|\tilde\sigma_{AB}),&#xA;$$&lt;/span&gt;&#xA;but from your original statement (I assume, you've not quite stated it precisely enough)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\tilde \rho_{AB}\|\tilde\sigma_{AB})\geq S(\$\rho_A\|\$\sigma_A)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-07T07:38:23.610" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6087" PostTypeId="1" AcceptedAnswerId="6095" CreationDate="2019-05-07T14:08:20.067" Score="3" ViewCount="412" Body="&lt;p&gt;I am actually working on quantum computing with qutrits. I am trying to define standard qubit gates for qutrits. The CNOT gate for qubits is defined as follows: &lt;span class=&quot;math-container&quot;&gt;$$|x,y\rangle \to |x,y+x \bmod 2\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the matrix is &lt;span class=&quot;math-container&quot;&gt;$$\mathrm{UCN} = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the definition of the same type of gate for qutrit I am left with two choices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|x,y\rangle \to |x,y+x \bmod 3\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x,y\rangle \to |x,y+2x \bmod 3\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if one of the two is more common or more usually defined?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I know that applying one two times is equivalent to apply the other one time.&lt;/p&gt;&#xA;" OwnerUserId="7426" LastEditorUserId="26" LastEditDate="2019-05-07T16:14:44.730" LastActivityDate="2019-05-07T23:12:22.190" Title="Defining standard qubit gates for qutrits" Tags="&lt;quantum-gate&gt;&lt;qutrit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6088" PostTypeId="1" AcceptedAnswerId="8631" CreationDate="2019-05-07T15:42:42.017" Score="5" ViewCount="811" Body="&lt;h3&gt;Context&lt;/h3&gt;&#xA;&lt;p&gt;Prof. Aaronson mentions that the quantum extended Church-Turing (quantum ECT) thesis has no known counterexamples cf. &lt;a href=&quot;https://youtu.be/2jz0ugqghys?t=858&quot; rel=&quot;nofollow noreferrer&quot;&gt;around 14:18&lt;/a&gt; but doesn't mention its precise statement.&lt;/p&gt;&#xA;&lt;h3&gt;Questions&lt;/h3&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What precisely is the statement of the quantum extended Church-Turing thesis? Original references appreciated.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any quantum Church-Turing thesis (i.e. a non-extended version that doesn't concern itself with the efficiency of computation)? If yes, what's its precise statement?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there any fundamental difference between the quantum extended Church-Turing thesis and &lt;a href=&quot;https://royalsocietypublishing.org/doi/abs/10.1098/rspa.1985.0070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch's 1985 version&lt;/a&gt;&lt;sup&gt;†&lt;/sup&gt;? Does the former include or imply any assertion about &amp;quot;finitely realizable physical systems&amp;quot; like the latter does?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;sup&gt;†: &amp;quot;Every finitely realizable physical system can be perfectly simulated by a universal model computing machine operating by finite means.&amp;quot;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-09-23T12:20:34.553" LastActivityDate="2020-09-23T12:20:34.553" Title="What precisely is the quantum extended Church-Turing thesis?" Tags="&lt;quantum-turing-machine&gt;&lt;church-turing-thesis&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6089" PostTypeId="5" CreationDate="2019-05-07T15:48:14.387" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-07T15:48:14.387" LastActivityDate="2019-05-07T15:48:14.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6090" PostTypeId="4" CreationDate="2019-05-07T15:48:14.387" Score="0" Body="In theoretical computer science, the theory of computation is the branch that deals with whether and how efficiently problems can be solved on a model of computation, using an algorithm. The field is divided into three major branches: automata theory, computability theory, and computational complexity theory. (Wikipedia) If your question is specifically about complexity theory, also use the [complexity-theory] tag. There's also the [automata-theory] tag." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-07T15:56:50.263" LastActivityDate="2019-05-07T15:56:50.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6091" PostTypeId="5" CreationDate="2019-05-07T15:51:15.910" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-07T15:51:15.910" LastActivityDate="2019-05-07T15:51:15.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6092" PostTypeId="4" CreationDate="2019-05-07T15:51:15.910" Score="0" Body="For questions on quantum automata or automata theory as relevant to quantum computing or quantum information. Automata theory is the study of abstract machines and automata, as well as the computational problems that can be solved using them. It is a theory in theoretical computer science and discrete mathematics (a subject of study in both mathematics and computer science). (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-07T16:06:56.540" LastActivityDate="2019-05-07T16:06:56.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6093" PostTypeId="5" CreationDate="2019-05-07T15:59:44.960" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-07T15:59:44.960" LastActivityDate="2019-05-07T15:59:44.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6094" PostTypeId="4" CreationDate="2019-05-07T15:59:44.960" Score="0" Body="For questions on Church-Turing thesis, computable functions, etc. as relevant to quantum computing. It is a major branch of the theory of computation. Computability theory, also known as recursion theory, is a branch of mathematical logic, of computer science, and of the theory of computation that originated in the 1930s with the study of computable functions and Turing degrees. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-07T15:59:44.960" LastActivityDate="2019-05-07T15:59:44.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6095" PostTypeId="2" ParentId="6087" CreationDate="2019-05-07T16:44:14.757" Score="3" Body="&lt;p&gt;Your first definition,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|x,y\rangle \to |x,y+x \bmod 3\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is both more common and, IMO, easier to use. Especially as you point out that the second definition can be simulated by repeated application of the first. You can see the authors have used this version of the qutrit CNOT in &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1742-6596/766/1/012014&quot; rel=&quot;nofollow noreferrer&quot;&gt;&#xA;Construction of two qutrit entanglement by using magnetic resonance selective pulse sequences (Çorbaci &lt;em&gt;et al.&lt;/em&gt;, 2016)&lt;/a&gt; and in&#xA;&lt;a href=&quot;http://www.iosrjournals.org/iosr-jap/papers/Vol10-issue6/Version-2/D1006021619.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controlled Not (Cnot) Gate For Two Qutrit Systems, (KOCAKOÇ &amp;amp; TAPRAMAZ, 2018)&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, you may want to consider the context of your qutrit gates. For example, section 2 of &lt;a href=&quot;https://arxiv.org/abs/1105.5485&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1105.5485&lt;/a&gt; first defines three versions of the qutrit X gate and then discusses what a controlled X would mean in these cases.&lt;/p&gt;&#xA;" OwnerUserId="7435" LastEditorUserId="26" LastEditDate="2019-05-07T23:12:22.190" LastActivityDate="2019-05-07T23:12:22.190" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6096" PostTypeId="1" CreationDate="2019-05-07T19:31:54.493" Score="4" ViewCount="66" Body="&lt;p&gt;I’m looking for the theoretical calculations of charge and transmon qubit decoherence specifically, but at a high level I'm wondering how decoherence is approached generally. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’ve seen explanations based on finding the time until the Rabi oscillations decay off as well as arguments that end with a Lindblad equation. Are these all equivalent ways of getting the decoherence rate, or does the approach to decoherence calculations depend on the approach to Quantum Computing (charge qubit vs transmon qubit vs spin qubit vs ion trap etc...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to restate my question, when people talk about Linblad vs Rabi, is this two side of the same coin (this is what I'm doubting), or are there specific circumstances that warrant these approaches to decoherence calculations? &lt;/p&gt;&#xA;" OwnerUserId="6000" LastEditorUserId="26" LastEditDate="2019-05-08T10:43:32.670" LastActivityDate="2019-05-08T10:43:32.670" Title="Is the theory of decoherence general or specific to the physical implementation?" Tags="&lt;decoherence&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6097" PostTypeId="1" AcceptedAnswerId="6098" CreationDate="2019-05-08T07:02:54.823" Score="2" ViewCount="52" Body="&lt;p&gt;Why is the trace preserving part necessary? Is it not enough if it can take all matrices to matrices of trace 1?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="26" LastEditDate="2019-05-08T10:28:53.400" LastActivityDate="2019-05-08T10:28:53.400" Title="What is the relevance of preservation of trace in completely postive trace preserving (CPTP) maps?" Tags="&lt;density-matrix&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6098" PostTypeId="2" ParentId="6097" CreationDate="2019-05-08T07:56:16.103" Score="3" Body="&lt;p&gt;Those maps are linear, so if it preserves the trace of trace 1 matrices then it preserves the trace of any other matrix.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We just don't need to restrict ourselves by considering only trace 1 matrices (from mathematical point of view).&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-05-08T07:56:16.103" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6099" PostTypeId="1" AcceptedAnswerId="9709" CreationDate="2019-05-08T09:50:26.760" Score="3" ViewCount="72" Body="&lt;p&gt;The PLOB-bound (&quot;&lt;a href=&quot;https://arxiv.org/abs/1510.08863&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fundamental Limits of Repeaterless Quantum Communications&lt;/a&gt;&quot;) gives an asymptotic upper bound on the secret-key rate per used lossy bosonic channel.&#xA;However, I'm not sure how to count the number of used channels in a physical implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let's assume that I use the BB84 protocol encoded in the polarization degrees of freedom of a single photon pulse.&#xA;One could think that one uses two lossy optical channels per sent photon due to the two polarizations, but this assumes that the photon would have a single frequency contradicting the spatial localization of the photon pulse.&#xA;However, if I assume a localized photon pulse, then the photon does not have a defined frequency anymore, but has a specific linewidth. Therefore, I would possibly use an uncountable number of frequencies and therefore also channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have I misunderstood anything or is this bound not useful in realistic implementations of QKD?&lt;/p&gt;&#xA;" OwnerUserId="4312" LastEditorUserId="10480" LastEditDate="2021-04-16T20:39:12.493" LastActivityDate="2021-04-16T20:39:12.493" Title="Counting channel uses of the lossy bosonic channel or definition of channel uses" Tags="&lt;quantum-operation&gt;&lt;physical-realization&gt;&lt;key-distribution&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6100" PostTypeId="5" CreationDate="2019-05-08T10:19:04.677" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-08T10:19:04.677" LastActivityDate="2019-05-08T10:19:04.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6101" PostTypeId="4" CreationDate="2019-05-08T10:19:04.677" Score="0" Body="For questions about quantum key distribution (QKD). It is a secure communication method which implements a cryptographic protocol involving components of quantum mechanics. (Wikipedia) In case it's also a question about quantum-cryptography, use the [cryptography] tag along with this." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-08T10:30:05.280" LastActivityDate="2019-05-08T10:30:05.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6102" PostTypeId="1" CreationDate="2019-05-08T14:25:04.253" Score="8" ViewCount="89" Body="&lt;p&gt;I'm reading about the threshold theorem, which states that &#xA;&quot;a quantum computer with a physical error rate below a certain threshold can, through the application of quantum error correction schemes, suppress the logical error rate to arbitrarily low levels.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I know that decoherence leads to errors, and I know how to calculate decoherence rates, but I don't understand how I can take a decoherence rate (let's say &lt;span class=&quot;math-container&quot;&gt;$5 \mathrm{\mu s}$&lt;/span&gt;) and turn this into an error rate. I'm also not sure how to compare a given error rate to it's threshold and the threshold theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="7441" LastEditorUserId="26" LastEditDate="2019-05-08T14:57:07.520" LastActivityDate="2020-01-27T19:01:55.207" Title="How is the decoherence rate connected to the error rate?" Tags="&lt;error-correction&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6103" PostTypeId="1" AcceptedAnswerId="6104" CreationDate="2019-05-08T16:07:14.480" Score="3" ViewCount="56" Body="&lt;p&gt;I am having some trouble understanding how the number of simulation qubits are chosen when finding the eigenvalue of a fermionic Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the phase-estimation algorithm, is the number of simulation qubits the same as the number of particles you want to simulate, or is it the number of orthogonal single-particle states you want to include?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&#xA;If I want to find the eigenvalues for a two-particle system and have 10 qubits to spare, do I initialize the 10 qubits to for example &lt;span class=&quot;math-container&quot;&gt;$|0011111111\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1100111111\rangle$&lt;/span&gt; (1s are un-occupied and 0s are occupied states) and let the time evolution operator act on this system? Or do I simply go for a random two-qubit state, for example, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and let the time-evolution operator act on this state?&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="26" LastEditDate="2019-05-08T16:17:23.000" LastActivityDate="2019-05-08T16:48:53.060" Title="How to pick number of simulation qubits for finding eigenvalue of fermionic Hamiltonian?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;hamiltonian-simulation&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6104" PostTypeId="2" ParentId="6103" CreationDate="2019-05-08T16:48:53.060" Score="3" Body="&lt;p&gt;Typically the second option: you map the fermionic occupation number for each single-particle state to a qubit. (Also, the usual convention is that &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; denotes unoccupied, &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; denotes occupied ;) This mapping is usually accomplished via the Jordan-Wigner or Bravyi-Kitaev transformation, or some hybrid of the two: see &lt;a href=&quot;https://arxiv.org/abs/1208.5986&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1208.5986&lt;/a&gt; for a nice overview of both.&lt;/p&gt;&#xA;" OwnerUserId="7336" LastActivityDate="2019-05-08T16:48:53.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6105" PostTypeId="1" CreationDate="2019-05-08T19:25:41.147" Score="4" ViewCount="73" Body="&lt;p&gt;Is there a 5-partite state such that if two parties each hold 2 shares of the state, without knowing what shares the other party holds, they can create a Bell pair between them and know which qubit in their possession is their half of the Bell pair? The two parties may not communicate.&lt;/p&gt;&#xA;" OwnerUserId="7443" LastEditorUserId="7443" LastEditDate="2019-05-10T21:28:36.333" LastActivityDate="2019-05-10T21:28:36.333" Title="Does a 5-partite state with these entanglement properties exist?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6106" PostTypeId="1" CreationDate="2019-05-08T20:18:30.940" Score="3" ViewCount="150" Body="&lt;p&gt;The quantum OR circuit between &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; can be made out of 1 Toffoli and 2 CNOT gates, 1 ancillary qubit. Is there any other implementation? Or is this the minimal in the sense of gates used?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-08T20:20:04.587" LastActivityDate="2019-05-13T14:31:30.773" Title="Minimal quantum OR circuit" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6107" PostTypeId="1" CreationDate="2019-05-08T22:02:28.687" Score="2" ViewCount="172" Body="&lt;p&gt;The quantum volume metric &lt;span class=&quot;math-container&quot;&gt;$V_Q$&lt;/span&gt; is a proposed metric for quantifying and&#xA;comparing the performance of quantum computers&lt;sup&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/480103/58382&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. The quantum volume is&#xA;defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$V_Q = \max_{n&amp;lt;N} \left(\min\left[n, d(n)\right]^2\right),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits used (out of the maximum &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; available qubits on&#xA;the device), &lt;span class=&quot;math-container&quot;&gt;$d(N)\simeq 1/nε_{\text{eff}}$&lt;/span&gt; is the effective/achievable circuit&#xA;depth, and &lt;span class=&quot;math-container&quot;&gt;$\epsilon_{\text{eff}}$&lt;/span&gt; is the effective/average error rate of a random &lt;span class=&quot;math-container&quot;&gt;$SU(4)$&lt;/span&gt; gate between any two qubits (including additional swap gates if the&#xA;device is not fully connected)&lt;sup&gt;[2]&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now setting aside the question of whether &lt;span class=&quot;math-container&quot;&gt;$V_Q$&lt;/span&gt; is a &quot;good&quot; metric (asked&#xA;previously &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3985/is-the-quantum-volume-a-fair-metric-for-future-elaborate-high-value-quantum&quot;&gt;here&lt;/a&gt;),&#xA;can an estimate be made for what &lt;span class=&quot;math-container&quot;&gt;$V_Q$&lt;/span&gt; is needed in order to have a single&#xA;logical qubit? More generally, what is the number of logical qubits a device with &lt;span class=&quot;math-container&quot;&gt;$V_Q$&lt;/span&gt; can support?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: By logical qubit I mean in the sense of fault-tolerant operation, i.e. if I have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; logical qubits I can apply &lt;em&gt;any&lt;/em&gt; arbitrary sequence of gates to the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and end up with the ideal quantum state with bounded error (e.g. probability greater than 2/3).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;&lt;em&gt;NOTE: Cross-posted on &lt;a href=&quot;https://physics.stackexchange.com/q/480103/58382&quot;&gt;physics.SE&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&#xA;&lt;br&gt;&#xA;1. &lt;a href=&quot;https://pdfs.semanticscholar.org/650c/3fa2a231cd77cf3d882e1659ee14175c01d5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bishop, Lev S., et al. &quot;Quantum volume.&quot; Quantum Volume. Technical Report (2017)&lt;/a&gt; (PDF)&#xA;&lt;br&gt;&#xA;2. &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/2058-9565/aab822/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Moll, Nikolaj, et al. &quot;Quantum optimization using variational algorithms on near-term quantum devices.&quot; Quantum Science and Technology 3.3 (2018): 030503&lt;/a&gt;&#xA;&lt;br&gt;&#xA;3. Cross, Andrew W., et al. &quot;Validating quantum computers using randomized model circuits.&quot; arXiv preprint &lt;a href=&quot;https://arxiv.org/abs/1811.12926&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1811.12926&lt;/a&gt; (2018).&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="440" LastEditorUserId="55" LastEditDate="2019-05-15T08:52:21.793" LastActivityDate="2019-05-15T08:52:21.793" Title="What quantum volume is needed to represent a single logical qubit?" Tags="&lt;error-correction&gt;&lt;physical-realization&gt;&lt;randomised-benchmarking&gt;&lt;quantum-volume&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6108" PostTypeId="1" AcceptedAnswerId="6282" CreationDate="2019-05-09T08:52:11.303" Score="2" ViewCount="72" Body="&lt;p&gt;In the Quantum Computation and Quantum Information (10th ed.) textbook by Nielsen and Chuang, section 5.3.1 (titled &quot;Application: order-finding&quot;) describes how phase estimation can be used to find the order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; of a positive integer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After performing the inverse Fourier transform on the first register and then performing a measurement, we'll get an estimation of the phase &lt;span class=&quot;math-container&quot;&gt;$\varphi\approx\frac{s}{r}$&lt;/span&gt; accurate to &lt;span class=&quot;math-container&quot;&gt;$2L+1$&lt;/span&gt; bits. We hope to find &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; by performing the continued fractions procedure, which in certain cases returned &lt;span class=&quot;math-container&quot;&gt;$s'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r'$&lt;/span&gt; instead which happens when &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; share common factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book describes three methods to fix this problem, two of which repeats the order-finding algorithm &lt;span class=&quot;math-container&quot;&gt;$O(L)$&lt;/span&gt; times and the third requires a constant number of trials. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third method: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The idea is to repeat the phase estimation - continued fractions procedure twice, obtaining &lt;span class=&quot;math-container&quot;&gt;$r'_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s'_1$&lt;/span&gt; the first time, and &lt;span class=&quot;math-container&quot;&gt;$r'_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s'_2$&lt;/span&gt; the second time. Provided &lt;span class=&quot;math-container&quot;&gt;$s'_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s'_2$&lt;/span&gt; have no common factors, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; may be extracted by taking the least common multiple of &lt;span class=&quot;math-container&quot;&gt;$r'_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$r'_2$&lt;/span&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; may be extracted by taking the least common multiple of &lt;span class=&quot;math-container&quot;&gt;$r'_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$r'_2$&lt;/span&gt; and what is the rationale of repeating the phase estimation — &#xA;continued fractions procedure twice?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="26" LastEditDate="2019-05-09T09:13:00.040" LastActivityDate="2019-05-30T07:02:03.223" Title="Method to find $r$ in the case when $r'$ returned by the continued fractions procedure is a factor of $r$" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6109" PostTypeId="1" CreationDate="2019-05-09T09:58:49.123" Score="4" ViewCount="107" Body="&lt;p&gt;I need to prove the fact that a quantum channel (a superoperator) cannot increase the Holevo information of an ensemble &lt;span class=&quot;math-container&quot;&gt;$\epsilon = \{\rho_x, p_x\}$&lt;/span&gt;. Mathematically expressed I need to prove&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align} \chi(\$(\epsilon)) \leq \chi(\epsilon)  \end{align} \tag{1}\label{1}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\$$&lt;/span&gt; represents a quantum channel (a positive trace preserving map) which works on the ensemble as &lt;span class=&quot;math-container&quot;&gt;$\$ \epsilon = \{ \$\rho_x, p_x \}$&lt;/span&gt;. This needs to be done with the property that a superoperator &lt;span class=&quot;math-container&quot;&gt;$\$$&lt;/span&gt; cannot increase relative entropy (some may remember &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6066/55&quot;&gt;my previous question about this&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align} S(\$\rho || \$\sigma) \leq S(\rho || \sigma)  \end{align}\tag{2}\label{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with relative entropy defined as &lt;span class=&quot;math-container&quot;&gt;$$S(\rho || \sigma) = \mathrm{tr}(\rho \log \rho - \rho \log \sigma).$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Holevo information is defined as (if someone would not know)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align} \chi(\epsilon) = S(\sum_x p_x \rho_x ) - \sum_x p_x S(\rho_x) \end{align}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how we get from equation &lt;span class=&quot;math-container&quot;&gt;$\eqref{2}$&lt;/span&gt; to equation &lt;span class=&quot;math-container&quot;&gt;$\eqref{1}$&lt;/span&gt;? Maybe what density operators to fill in &lt;span class=&quot;math-container&quot;&gt;$\eqref{2}$&lt;/span&gt;? Or how do we start such a proof? &lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="55" LastEditDate="2021-04-06T08:23:22.950" LastActivityDate="2021-04-06T08:23:22.950" Title="Prove that quantum channels cannot increase the Holevo information of an ensemble" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6112" PostTypeId="1" AcceptedAnswerId="6113" CreationDate="2019-05-09T15:39:08.343" Score="4" ViewCount="146" Body="&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Note:&lt;/strong&gt; I'm reposting &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6110/degradable-channels-and-their-quantum-capacity&quot;&gt;this question&lt;/a&gt; as it was &lt;a href=&quot;https://quantumcomputing.stackexchange.com/posts/6110/timeline#history_32684edb-6429-48ea-8464-3af60dd8f02b&quot;&gt;deleted&lt;/a&gt; by the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/5806/tobias-fritzn&quot;&gt;original author&lt;/a&gt;, so that we do not lose out on the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6111&quot;&gt;existing answer&lt;/a&gt; there, by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1764/john-watrous&quot;&gt;Prof. Watrous&lt;/a&gt;. Further answers are obviously welcome.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What are degradable channels?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given the dephasing channel &lt;span class=&quot;math-container&quot;&gt;$$\Phi^D\begin{pmatrix} \rho_{11} &amp;amp;  \rho_{12}\\ \rho_{21} &amp;amp; \rho_{22} \end{pmatrix}$$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$$=\begin{pmatrix} \rho_{11} &amp;amp; \rho_{12} e^{-\Gamma(t)}\\&#xA;\rho_{21} e^{-\Gamma(t)}  &amp;amp;  \rho_{22} \end{pmatrix},$$&lt;/span&gt; the complementary map is given by &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi^D\begin{pmatrix} \rho_{11} &amp;amp;  \rho_{12}\\ \rho_{21} &amp;amp; \rho_{22} \end{pmatrix}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$= \begin{pmatrix} \frac{1+e^{-\Gamma(t)}}{2}  &amp;amp;   \frac{\sqrt{1-e^{-2\Gamma(t)}}}{2} (\rho_{11}-\rho_{22})\\&#xA;  \frac{\sqrt{1-e^{-2\Gamma(t)}}}{2} (\rho_{11}-\rho_{22}) &amp;amp; \frac{1-e^{-\Gamma(t)}}{2} \end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can one prove that the &lt;em&gt;quantum channel capacity&lt;/em&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$Q_D = 1 - H_2(\frac{1+e^{-\Gamma(t)}}{2} )$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H_2(\cdot)$&lt;/span&gt; is the binary Shanon entropy. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;: Eq. 13 of &lt;a href=&quot;https://www.nature.com/articles/srep05720&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;&lt;sup&gt;†&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt; †: Bylicka, B., D. Chruściński, and Sci Maniscalco. &quot;Non-Markovianity and reservoir memory of quantum channels: a quantum information theory perspective.&quot; Scientific reports 4 (2014): 5720.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="10480" LastEditDate="2021-03-20T06:11:01.867" LastActivityDate="2021-03-20T06:11:01.867" Title="Degradable channels and their quantum capacity" Tags="&lt;quantum-operation&gt;&lt;noise&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6113" PostTypeId="2" ParentId="6112" CreationDate="2019-05-09T15:43:15.403" Score="6" Body="&lt;p&gt;A channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is said to be degradable if there exists another channel &lt;span class=&quot;math-container&quot;&gt;$\Xi$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\Xi\Phi$&lt;/span&gt; is complementary to &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea here is as follows. Suppose &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is a channel and &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; is complementary to &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is applied to a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, then the output of the channel is &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)$&lt;/span&gt; (of course), while &lt;span class=&quot;math-container&quot;&gt;$\Psi(\rho)$&lt;/span&gt; represents whatever the environment effectively receives. A channel being degradable therefore means that given the output of the channel, one could reconstruct whatever the environment receives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On its own, the property of being degradable may be difficult to motivate, except for the fact that we can actually calculate the quantum capacity for degradable channels (while we often cannot for other channels). This is based on two facts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is degradable, then its quantum capacity is equal to its maximum coherent information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The coherent information is a concave function for degradable channels.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now, the channel in part 2 of the question is degradable. (In fact, dephasing channels are always degradable, in every dimension.) Perhaps the easiest way to see this for this particular channel is to observe that we can take &lt;span class=&quot;math-container&quot;&gt;$\Xi = \Psi$&lt;/span&gt;, (i.e., &lt;span class=&quot;math-container&quot;&gt;$\Psi \Phi = \Psi$&lt;/span&gt;), where I am using &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; as the name of the original channel and &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; for the complementary channel given in the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It remains to compute the maximum coherent information of this channel. For a given state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, the coherent information of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{I}_{\text{C}}(\rho; \Phi) = \text{H}(\Phi(\rho)) - \text{H}(\Psi(\rho)).&#xA;$$&lt;/span&gt;&#xA;It is perhaps not obvious, but the maximum value over all states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is obtained by the completely mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho = \mathbb{1}/2$&lt;/span&gt;, and therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Q(\Phi) = \max_{\rho} \text{I}_{\text{C}}(\rho; \Phi)&#xA;= \text{I}_{\text{C}}(\mathbb{1}/2; \Phi)&#xA;= \text{H}(\mathbb{1}/2) - \text{H}(\Psi(\mathbb{1}/2))&#xA;= 1 - \text{H}_2\Bigl(\frac{1 + e^{-\Gamma(t)}}{2}\Bigr).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to argue that the maximum coherent information is obtained by the completely mixed state is to use the fact that &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is a Pauli channel, together with the concavity of coherent information for degradable channels mentioned above.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2019-05-09T15:43:15.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6114" PostTypeId="1" CreationDate="2019-05-09T19:00:06.383" Score="4" ViewCount="115" Body="&lt;p&gt;Even after reading several papers and almost all HHL related questions and answers here on Quantum Computing Stack Exchange, one thing is yet not clear. In several papers, for illustrating HHL they choose matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with convenient eigenvalues of the form &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; such that the rotation angles are like &lt;span class=&quot;math-container&quot;&gt;$\frac{v\pi}{2^r}$&lt;/span&gt;; and show a full circuit of HHL. It's not always the case. Eigenvalues can be anything. So how can one find the angles for rotation without measuring the eigenvalues? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does HHL need to be run in two steps? First to get the eigenvalues and then perform the rotation and QPE-inverse? &lt;/p&gt;&#xA;" OwnerDisplayName="user7451" LastEditorUserId="26" LastEditDate="2019-05-09T19:03:50.817" LastActivityDate="2019-05-09T19:03:50.817" Title="Is HHL executed in a single run? If yes, how do they carry out controlled rotation without knowing eigenvalues?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6115" PostTypeId="2" ParentId="6107" CreationDate="2019-05-09T22:31:19.313" Score="3" Body="&lt;p&gt;Quantum volume is a bad metric for this purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose you have a ten thousand by ten thousand grid of qubits with a gate error rate of 1 in one thousand. The quantum volume of this grid is basically 0, because if you pick two qubits at random they will on average be more than one thousand steps apart. So an error will almost certainly occur as they are routed together in order to interact, and so you can't even perform 1 randomly chosen interaction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But quantum error correction doesn't require randomly chosen interactions. The surface code only performs local interactions, and as a result the 10k x 10k with 10^-3 error grid that I described would be easily capable of large scale fault tolerant quantum computations over thousands of logical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you make the grid bigger, the quantum volume at the physical level will continue to get worse and worse as the quantum volume at the logical level continues to get better.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-05-09T22:31:19.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6116" PostTypeId="2" ParentId="6105" CreationDate="2019-05-10T07:23:01.087" Score="2" Body="&lt;p&gt;Yes, it does exist. Here's something that you could do (I'm sure there are better things):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the symmetric state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\frac{1}{\sqrt{\binom{5}{2}}}\sum_{x\in\{0,1\}^5:\ x\cdot x=2}|x\rangle.&#xA;$$&lt;/span&gt;&#xA;The benefit of selecting the symmetric state is that it is entirely irrelevant which pair of qubit is assigned to Alice, and which pair is assigned to Bob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm going to use a trick based on the fact that I know the total state has 2 excitations. Both Alice and Bob apply a controlled-not between their two qubits, and measure the control qubit in the Z-basis. If they both get answer 0, the protocol has succeeded and they share a Bell pair between the two control qubits, and the extra qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. How did this work? the controlled-not+measurement simply worked to calculate the parity of the two qubits. Post-selecting on the 0 answer means that we forced the two qubits in the original state to be the same, either 00 or 11. If both pairs of qubits were of even parity, then one of them was 00 and the other was 11. Moreover, since the overall state was of even weight, that means the extra qubit must be in the 0 state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't carefully calculated it, but I believe the success probability of this protocol is 1/5. So, if we have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; copies, the probability of failure is &lt;span class=&quot;math-container&quot;&gt;$1-(4/5)^n$&lt;/span&gt;, although we expect it to take about 5 copies to produce a Bell pair on average.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are definitely improvements that can be made to this protocol. I just used the part of the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle_A|11\rangle_B|0\rangle+|11\rangle_A|00\rangle_B|0\rangle.&#xA;$$&lt;/span&gt;&#xA;There's another component that would do just as well, but with higher probability amplitude:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle(|01\rangle+|10\rangle)|1\rangle+(|01\rangle+|10\rangle)|00\rangle|1\rangle,&#xA;$$&lt;/span&gt;&#xA;which I could have used instead (but the measurement is a bit more complicated to describe - instead of mapping &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to 0 and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; to 1, we need to map &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to 0 and &lt;span class=&quot;math-container&quot;&gt;$(|01\rangle+|10\rangle/\sqrt{2}$&lt;/span&gt; to 1), and that's before one gets on to trying to think about whether there are better states... Or, for example, interacting between multiple copies....&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-10T07:23:01.087" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6118" PostTypeId="2" ParentId="6106" CreationDate="2019-05-10T23:07:42.793" Score="2" Body="&lt;p&gt;Your question is not localized to &lt;strong&gt;quantum gates,&lt;/strong&gt; but can be rephrased as &quot;how do I implement a (classical) &lt;strong&gt;reversible gate&lt;/strong&gt; that can realize a logical &lt;span class=&quot;math-container&quot;&gt;$\mathsf{OR}$&lt;/span&gt;?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I propose a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-input &quot;upstart&quot; gate acting on &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^3$&lt;/span&gt; and producing &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; outputs as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;C X Y || O X Y&#xA;==============&#xA;0 0 0 || 0 0 0&#xA;0 0 1 || 1 0 1&#xA;0 1 0 || 1 1 0&#xA;0 1 1 || 1 1 1&#xA;1 0 0 || 1 0 0&#xA;1 0 1 || 0 0 1&#xA;1 1 0 || 0 1 0&#xA;1 1 1 || 0 1 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here we see that the first bit is evaluated to the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{OR}$&lt;/span&gt; of the second and third bits when the first bit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and is evaluated to the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOR}$&lt;/span&gt; of the second and third bits when the first bit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be written in matrix form as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathsf{UPSTART}=&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This of course can be written in many other ways.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="23" LastEditDate="2019-05-11T08:42:02.660" LastActivityDate="2019-05-11T08:42:02.660" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6119" PostTypeId="1" CreationDate="2019-05-11T12:01:37.327" Score="1" ViewCount="195" Body="&lt;p&gt;I would be interested to know how to transform the classic OR gate into a quantum gate. I thought a little about myself. The OR gate can also be rewritten as a NAND gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iBqeu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iBqeu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I have now tried to convert into a quantum circuit. If the lower bit of the Toffoli gate is 0, then the AND operation is performed. Accordingly, I have introduced the NOT gate to replace the NANDs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F1HqQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F1HqQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question, is that right? Or how would the OR gate look like a quantum gate?&lt;/p&gt;&#xA;" OwnerUserId="4974" LastActivityDate="2019-05-11T12:01:37.327" Title="Transferring classical OR gate in a quantum gate" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6120" PostTypeId="1" AcceptedAnswerId="6121" CreationDate="2019-05-12T07:39:06.533" Score="8" ViewCount="190" Body="&lt;p&gt;The following statement is found on the page 199 of Nielsen and Chuang's book (10th Anniversary Edition) in the proof for the fact that 'approximating arbitrary unitary gates is generically hard':&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we have &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; different types of gates available, and each gate&#xA;  works on at most &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; input qubits. These numbers, &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, are&#xA;  fixed by the computing hardware we have available, and may be&#xA;  considered to be constants. Suppose we have a quantum circuit&#xA;  containing m gates, starting from the computational basis state&#xA;  &lt;span class=&quot;math-container&quot;&gt;$|0⟩^{\bigotimes n}$&lt;/span&gt;. For any particular gate in the circuit there are&#xA;  therefore at most&lt;span class=&quot;math-container&quot;&gt;$\binom{n}{f}^g=O(n^{fg})$&lt;/span&gt; possible choices.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I kind of think the number of possible choices for any particular gate is more in line with &lt;span class=&quot;math-container&quot;&gt;$\binom{n}{f}\cdot g=O(n^fg)$&lt;/span&gt;. What do you think?&lt;/p&gt;&#xA;" OwnerUserId="7460" LastEditorUserId="26" LastEditDate="2019-05-12T08:43:44.213" LastActivityDate="2019-05-12T08:43:44.213" Title="Nielsen and Chuang's proof for 'approximating arbitrary unitary gates is generically hard'" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6121" PostTypeId="2" ParentId="6120" CreationDate="2019-05-12T08:30:25.913" Score="3" Body="&lt;p&gt;You are right. There is a choice for place and there is a choice for gate. Then we just multiply the number of choices.&lt;br&gt;&#xA;But it's even stronger limitation on the number of possible states that we can obtain. So the general reasoning is still correct.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-05-12T08:30:25.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6122" PostTypeId="1" AcceptedAnswerId="6125" CreationDate="2019-05-12T09:16:41.273" Score="4" ViewCount="195" Body="&lt;p&gt;One can make an entanglement witness by taking the partial transpose of any pure entangled state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle $&lt;/span&gt; as any pure entangled state.&#xA;Then &lt;span class=&quot;math-container&quot;&gt;$W =  | \phi \rangle \langle \phi |^{T_2} $&lt;/span&gt; is an entanglement witness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, is there any way to prove that it is optimal?&#xA;That is if &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}(W \rho) = 0,$$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; must lie on the boundary of the separable state set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: This question is only in reference to 2 qubit systems - hence there are no PPT entangled states. &lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-03-09T22:04:26.450" LastActivityDate="2021-03-09T22:04:26.450" Title="Are entanglement witnesses of this form optimal?" Tags="&lt;entanglement&gt;&lt;partial-transpose&gt;&lt;entanglement-witness&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6123" PostTypeId="5" CreationDate="2019-05-12T09:19:31.423" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-12T09:19:31.423" LastActivityDate="2019-05-12T09:19:31.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6124" PostTypeId="4" CreationDate="2019-05-12T09:19:31.423" Score="0" Body="For questions about the use of functionals to detect the entanglement of a given quantum state." OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-03-09T22:02:08.450" LastActivityDate="2021-03-09T22:02:08.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6125" PostTypeId="2" ParentId="6122" CreationDate="2019-05-12T13:04:14.893" Score="5" Body="&lt;p&gt;Answer to edited question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's still not true for qubit systems. Consider these two unit vectors, both of which are entangled:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle = \frac{1}{\sqrt{2}} | 00\rangle + \frac{1}{\sqrt{2}} | 11\rangle,\\&#xA;|\psi\rangle = \frac{1}{\sqrt{2}} | 01\rangle + \frac{i}{\sqrt{2}} | 10\rangle.&#xA;$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi\rangle\langle \psi |$&lt;/span&gt;, which of course is not on the boundary of the set of separable states; it's as far away from that set as any state can be. However, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\Bigl( |\phi\rangle \langle \phi |^{T_2} \rho\Bigr) = 0.&#xA;$$&lt;/span&gt;&#xA;To verify this equation, it may help to view the relevant operators as matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle \langle \phi |^{T_2} = \frac{1}{2}\begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = |\psi\rangle \langle \psi | = \frac{1}{2}\begin{pmatrix}0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;-i&amp;amp;0\\0&amp;amp;i&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Original answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand it correctly, the statement suggested in the question is false. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a counter-example, let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be any entangled PPT state whose partial transpose has an entangled state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; in its kernel. We then obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\Bigl( |\phi\rangle \langle \phi |^{T_2} \rho\Bigr) = \text{Tr}\Bigl( |\phi\rangle \langle \phi | \rho^{T_2}\Bigr) = 0,&#xA;$$&lt;/span&gt;&#xA;but because &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is entangled it cannot be on the boundary of the set of separable states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, no entanglement witness of the form suggested in the question can ever detect entanglement in a PPT state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To construct an entangled PPT state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; whose partial transpose has an entangled state in its kernel, one may take any unextendable product basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_1\rangle |\psi_1\rangle,\ldots,|\phi_m\rangle |\psi_m\rangle \in \mathcal{A}\otimes\mathcal{B},&#xA;$$&lt;/span&gt;&#xA;and then let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{m} \sum_{k = 1}^m |\phi_k\rangle \langle \phi_k| \otimes |\psi_k\rangle \langle \psi_k|.&#xA;$$&lt;/span&gt;&#xA;The partial transpose looks like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho^{T_2} = \frac{1}{m} \sum_{k = 1}^m |\phi_k\rangle \langle \phi_k| \otimes |\overline{\psi_k}\rangle \langle \overline{\psi_k}|.&#xA;$$&lt;/span&gt;&#xA;This operator has rank &lt;span class=&quot;math-container&quot;&gt;$m&amp;lt;\text{dim}(\mathcal{A}\otimes\mathcal{B})$&lt;/span&gt; and every nonzero vector in its kernel is entangled.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2019-05-13T17:17:38.923" LastActivityDate="2019-05-13T17:17:38.923" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6126" PostTypeId="1" CreationDate="2019-05-12T19:23:43.920" Score="1" ViewCount="69" Body="&lt;p&gt;I am curious about how to do implement functions like &lt;span class=&quot;math-container&quot;&gt;$$f(x)=\begin{cases} &#xA;2x  &amp;amp;\text{if} &amp;amp;0\leq x &amp;lt;0.5 \\&#xA;x/2 &amp;amp;\text{if} &amp;amp;0.5\leq x&amp;lt;1&#xA;\end{cases}$$&lt;/span&gt;&#xA;Do we implement this like any other equation on a classical computer?&#xA;What initial states and assumptions do we need to make for this computation?&#xA;What gates do we need to use?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-13T07:08:25.537" LastActivityDate="2019-05-13T07:40:08.033" Title="Implementing piecewise functions on a quantum computer" Tags="&lt;circuit-construction&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6127" PostTypeId="2" ParentId="6126" CreationDate="2019-05-13T07:40:08.033" Score="4" Body="&lt;p&gt;First, you need to check if your function is reversible. This determines whether you can perform it inline or not. Your function is not reversible, so we need to perform something like &lt;span class=&quot;math-container&quot;&gt;$x, y \rightarrow x, y + f(x)$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$x \rightarrow f(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The great thing about functions of the form &lt;span class=&quot;math-container&quot;&gt;$x, y \rightarrow x, y + f(x)$&lt;/span&gt; is that it's very easy to derive a quantum circuit for them from a classical circuit. You just:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Compile the function down to a series of assembly instructions, ideally without any jumps. You could use a traditional compiler for this.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Compile each assembly instruction into a classic logic circuit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Switch to the reversible gate set by introducing work space. Replace AND gates with Toffoli gates onto fresh zero qubits, and etc.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Add the result register into &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; using a standard addition circuit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Uncompute all the junk data that was computed during step 3.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course in general you'll want to try to be a bit clever about it in order to create an efficient circuit.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-05-13T07:40:08.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6128" PostTypeId="1" CreationDate="2019-05-13T08:59:11.937" Score="4" ViewCount="138" Body="&lt;p&gt;In classical computing, &lt;a href=&quot;https://en.wikipedia.org/wiki/Arithmetic_circuit_complexity&quot; rel=&quot;nofollow noreferrer&quot;&gt;arithmetic circuit complexity&lt;/a&gt; is apparently a big topic. But I couldn't find much about the complexity of quantum arithmetic circuits. Almost all references like &lt;a href=&quot;https://arxiv.org/abs/1805.12445&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1805.12445&lt;/a&gt; talk about the implementation and construction of the quantum circuits for functions like &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{x}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sin(x)$&lt;/span&gt;, etc. But I'm looking for the quantum analog of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Arithmetic_circuit_complexity#Algebraic_P_and_NP&quot; rel=&quot;nofollow noreferrer&quot;&gt;VP vs. VNP problem&lt;/a&gt; and complexity analyses of the quantum circuit families used to improve the implementation of those functions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any existing work on this area? In other words, what are some authoritative references on quantum arithmetic circuit complexity (with a focus on complexity classes)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;P.S:&lt;/strong&gt; I've asked a very related question on the &lt;a href=&quot;https://cstheory.stackexchange.com/questions/43880&quot;&gt;Theoretical CS&lt;/a&gt; site.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-13T09:20:37.113" LastActivityDate="2020-06-04T23:18:50.500" Title="References on quantum arithmetic circuit complexity" Tags="&lt;resource-request&gt;&lt;complexity-theory&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6129" PostTypeId="1" CreationDate="2019-05-13T12:09:27.927" Score="3" ViewCount="524" Body="&lt;p&gt;Here's a &lt;a href=&quot;https://www.ibm.com/blogs/research/2019/03/power-quantum-device/&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog post&lt;/a&gt; that corresponds with what IBM presented at the 2019 March Meeting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this post, they claim they've measured qubit T1 relaxation times above 500 microseconds, and claim that they've seen evidence of genuinely entangled 18-qubit GHZ states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is far beyond anything that I've seen in published literature. The best results as far as I can find are 12 genuinely entangled qubits (up from 10) from the Pan group in China (&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.122.110501&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;), and ~160 microsecond T1 times (&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0953-2048/29/4/044001/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;), also from IBM, but using a 3D cavity transmon qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the claims are credible, what sort of advancements in fabrication (for the long coherence times) and microwave technology (for large entangled states) could allow such fast progress?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="26" LastEditDate="2019-05-13T16:19:22.827" LastActivityDate="2019-05-15T13:30:57.497" Title="IBM's quantum computing capabilities — entangled 18-qubit GHZ states and high coherence times" Tags="&lt;physical-realization&gt;&lt;experiment&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6130" PostTypeId="2" ParentId="6106" CreationDate="2019-05-13T13:40:55.000" Score="3" Body="&lt;p&gt;Note that there are many ways to make &lt;code&gt;or&lt;/code&gt; into a reversible operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The truth table for the OR reads:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{ccc} x &amp;amp; y &amp;amp; x\operatorname{or}y \\ \hline&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 1\\&#xA;1 &amp;amp; 0 &amp;amp; 1\\&#xA;1 &amp;amp; 1 &amp;amp; 1\\&#xA;\end{array}$$&lt;/span&gt;&#xA;so we only need to add an ancillary degree of freedom that registers the difference between the last three cases.&#xA;In other words, if &lt;span class=&quot;math-container&quot;&gt;$f(x,y)=x+y+xy$&lt;/span&gt; is the OR operation (&lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; denotes modulo-&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; sum here), our reversible operation must be some &lt;span class=&quot;math-container&quot;&gt;$g(x,y)$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;g(0,0)&amp;amp;=(0,\alpha),\\&#xA;g(0,1)&amp;amp;=(1,\beta_1), \\&#xA;g(1,0)&amp;amp;=(1,\beta_2), \\&#xA;g(1,1)&amp;amp;=(1,\beta_3),&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; can be anything, and the &lt;span class=&quot;math-container&quot;&gt;$\beta_i$&lt;/span&gt; have to be different from each other. Any such &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is reversible, and can therefore be implemented as a quantum gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To satisfy the above constraints, we clearly need at least two ancillary bits, and then any assignment to the &lt;span class=&quot;math-container&quot;&gt;$\beta_i$&lt;/span&gt; works. For example, we can choose &lt;span class=&quot;math-container&quot;&gt;$\beta_0=00, \beta_1=01, \beta_2=10$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above argument tells you that you cannot implement a quantum OR operation with less than three qubits. As to how many &quot;elementary gates&quot; you need to realise such an operation as a circuit, that question is meaningless without a choice of the elementary gate set to use.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-05-13T14:31:30.773" LastActivityDate="2019-05-13T14:31:30.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6131" PostTypeId="2" ParentId="6129" CreationDate="2019-05-13T14:14:02.850" Score="3" Body="&lt;p&gt;So, to begin, I would point out that the 500 micosec T1 time is for a single qubit in isolation, while the GHZ results are on a 20 qubit device.  This device has an avg T1 time of around ~75 microsec.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The GHZ results were done by Ken Wei from IBM, and will be published shortly.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8VKsn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8VKsn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, the circuit is a standard GHZ building circuit, with a hadamard gate followed by a chain of CNOT gates (As pictured above). These gates are ordered in such a way as to minimize the construction time by running CNOT gates in parallel on the device(not pictured above).  Then there is a layer of phase gates (U1 gates in the IBM notation), followed by the reverse sequence of gates to undo the GHZ state.  The U1 layer in the middle gives the states a phase that is then kicked-back in the unrolling at the end, and measured by the top qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make everything happen, you need high-fidelity CNOT gates, and high-fidelity &lt;strong&gt;parallel&lt;/strong&gt; CNOT gates.  In addition, and equally important, you need to be able to correct for measurement errors in the final result.  Think of this as measurement tomography if you like.  This is a part of the IBM Qiskit Ignis package (qiskit.org).  Further details of how all this works together will be in the forthcoming publication&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the paper: &lt;em&gt;Wei, Ken X., et al. &quot;Verifying Multipartite Entangled GHZ States via Multiple Quantum Coherences&quot; arXiv preprint &lt;a href=&quot;https://arxiv.org/abs/1905.05720&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1905.05720&lt;/a&gt; (2019)&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="26" LastEditDate="2019-05-15T13:30:57.497" LastActivityDate="2019-05-15T13:30:57.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6132" PostTypeId="1" CreationDate="2019-05-13T16:23:28.473" Score="4" ViewCount="62" Body="&lt;p&gt;I have a set of &lt;span class=&quot;math-container&quot;&gt;$16 \times 16$&lt;/span&gt; two-qudit density matrices. I would like to study the bound-entanglement for this set, making use of entanglement witnesses for which explicit matrix representations are available or can be generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to be fully explicit, can such a matrix (or matrices) be provided?&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-05-13T21:54:54.380" LastActivityDate="2019-05-16T10:22:33.607" Title="Explicit 16⨯16 matrix representations of two-qudit entanglement witnesses" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;qudit&gt;&lt;entanglement-witness&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6133" PostTypeId="2" ParentId="6109" CreationDate="2019-05-13T17:56:58.460" Score="4" Body="&lt;p&gt;Suppose that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{X}$&lt;/span&gt; is a register that can store each possible choice for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, as a classical state, while &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Y}$&lt;/span&gt; is a register that can store each possible state &lt;span class=&quot;math-container&quot;&gt;$\rho_x$&lt;/span&gt;. It is then natural to associate the classical-quantum state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_x p_x |x\rangle \langle x| \otimes \rho_x&#xA;$$&lt;/span&gt;&#xA;with the ensemble &lt;span class=&quot;math-container&quot;&gt;$\{(p_x,\rho_x)\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now try taking the following two steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Verify that the Holevo information of the ensemble &lt;span class=&quot;math-container&quot;&gt;$\{(p_x,\rho_x)\}$&lt;/span&gt; is just another name for the mutual information &lt;span class=&quot;math-container&quot;&gt;$\text{I}(\mathsf{X}:\mathsf{Y})_\rho$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Y}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Verify, for an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of the pair &lt;span class=&quot;math-container&quot;&gt;$(\mathsf{X},\mathsf{Y})$&lt;/span&gt;, that the mutual information &lt;span class=&quot;math-container&quot;&gt;$\text{I}(\mathsf{X}:\mathsf{Y})_\rho$&lt;/span&gt; can be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{I}(\mathsf{X}:\mathsf{Y})_\rho = \mathrm{S}\bigl(\rho\,\big\|\, \rho^{\mathsf{X}}\otimes \rho^{\mathsf{Y}}\bigr).&#xA;$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Once you have done this, it should become clear how to get (1) from (2), but do not assume that it is exactly the same channel appearing in the two inequalities.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="26" LastEditDate="2019-05-13T19:35:07.813" LastActivityDate="2019-05-13T19:35:07.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6134" PostTypeId="1" AcceptedAnswerId="6141" CreationDate="2019-05-13T19:48:26.997" Score="2" ViewCount="100" Body="&lt;p&gt;In Nielsen and Chuang, in the Fidelity section, (Lemma 9.5, page 410 in the 2002 edition), they prove the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{tr}(AU) = |\mathrm{tr}(|A|VU)| = |\mathrm{tr}(|A|^{1/2}|A|^{1/2}VU)| $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\mathrm{tr}(AU)| \leq \sqrt{\mathrm{tr}|A| \mathrm{tr}(U^{\dagger}V^{\dagger}|A|VU)} = \mathrm{tr}|A|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, is &lt;span class=&quot;math-container&quot;&gt;$|A|$&lt;/span&gt; the positive matrix in the polar decomposition of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;?&#xA;And second, apparently, the second equation comes from the first due to Cauchy Schwartz inequality of Hilbert-Schmidt. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does the first expression lead to the second?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2019-05-14T12:04:12.640" LastActivityDate="2019-05-25T13:06:10.517" Title="Proving the inequality $|\mathrm{tr}(AU)|\le \mathrm{tr}|A|$ in Uhlmann's theorem" Tags="&lt;quantum-information&gt;&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6135" PostTypeId="1" CreationDate="2019-05-13T20:07:33.143" Score="3" ViewCount="95" Body="&lt;p&gt;I have 4 states say &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle,|10\rangle, |11\rangle$&lt;/span&gt;. I want to add the states in a manner such that&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|a\rangle=|00\rangle\otimes|01\rangle\to |00\rangle\otimes|01\rangle$&lt;/span&gt;&lt;br /&gt;&#xA;and&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|b\rangle=|10\rangle\otimes|11\rangle\to |10\rangle\otimes|01\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;That is the sum operator where the result is saved in the second register, i.e &lt;span class=&quot;math-container&quot;&gt;$|x,y\rangle\to|x, \mathrm{sum}(x,y)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But there is a rule that:&lt;br /&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$i=1$&lt;/span&gt; then compute case &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&lt;br /&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$i=2$&lt;/span&gt; then compute case &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How do I implement this conditional statement in a quantum circuit?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="10480" LastEditDate="2021-04-05T17:34:15.030" LastActivityDate="2021-04-05T17:34:15.030" Title="Implementing conditional operators in a quantum circuit" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6136" PostTypeId="1" AcceptedAnswerId="6159" CreationDate="2019-05-13T20:29:00.273" Score="3" ViewCount="83" Body="&lt;p&gt;The second qubit of a two-qubit system in the Bell state&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\beta_{01}\rangle= \frac{1}{\sqrt{2}}(|01\rangle+|10\rangle)$$&lt;/span&gt; is sent through an error channel which introduces a bit flip error with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. I want to calculate the state of the system after the second qubit exits the error channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to do this for a single qubit, but there isn't anything in my notes about doing it on a single qubit of a two-qubit system (or on two qubits for that matter).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is from a past exam paper (my exam is next week) could anyone show me the method of how to perform this operation?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="6254" LastEditDate="2019-05-15T20:30:51.250" LastActivityDate="2019-05-16T06:49:04.753" Title="State of a system after the second qubit of a Bell state sent through a bit flip error channel" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6138" PostTypeId="1" AcceptedAnswerId="6140" CreationDate="2019-05-14T07:35:55.500" Score="4" ViewCount="296" Body="&lt;p&gt;Let's take an example of an entanglement witness of the form &lt;span class=&quot;math-container&quot;&gt;$W = | \phi \rangle \langle \phi | ^{T_2}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$ | \phi \rangle $&lt;/span&gt; is some pure entangled state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I wanted to test some state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, I would have to perform &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(W \rho)$&lt;/span&gt;. I assume this is done by measuring &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; multiple times in the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; and finding the expected eigenvalue, and that would be the solution to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(W \rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is this the way it is done?&lt;/li&gt;&#xA;&lt;li&gt;Therefore, specifically in the above case, it is very much possible to physically apply the witness? (Even though there is a mathematical partial transpose present.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-03-09T22:04:41.103" LastActivityDate="2021-03-09T22:04:41.103" Title="How are witness operators physically implemented?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;physical-realization&gt;&lt;entanglement-witness&gt;&lt;ppt-criterion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6139" PostTypeId="1" AcceptedAnswerId="6142" CreationDate="2019-05-14T08:15:52.907" Score="2" ViewCount="148" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\Y}{\mathcal{Y}}\newcommand{\X}{\mathcal{X}}\newcommand{\rmL}{\mathrm{L}}$&lt;/span&gt;As explained for example in &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' book&lt;/a&gt; (chapter 2, p. 79), given an arbitrary linear map &lt;span class=&quot;math-container&quot;&gt;$\Phi\in\rmL(\rmL(&#xA;\X),\rmL(\Y))$&lt;/span&gt;, for every linear operator &lt;span class=&quot;math-container&quot;&gt;$X\in\rmL(\X)$&lt;/span&gt; we can write the &lt;em&gt;Kraus representation&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)=\sum_a A_a X B_a^\dagger,\tag1$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A_a,B_a\in\rmL(\X,\Y)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I understand it, the essential step in showing this is given in Corollary 2.21 of the above book, when we write the Choi representation &#xA;as &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=\sum_a u_a v_a^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been trying to understand how the Kraus representation can be obtained more directly in the &lt;em&gt;natural representation&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, which essentially means to think of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; as a matrix acting on the vectorized versions of the operators, via the equivalence &lt;span class=&quot;math-container&quot;&gt;$\rmL(\X)\sim\X\otimes \X$&lt;/span&gt;.&#xA;In this representation, we can write &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)_{ij}=\Phi_{ijk\ell}X_{k\ell}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Phi_{ijk\ell}$&lt;/span&gt; are the components of the natural representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can apply &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; to the four-index object &lt;span class=&quot;math-container&quot;&gt;$\Phi_{ijk\ell}$&lt;/span&gt; separating &lt;span class=&quot;math-container&quot;&gt;$i,k$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$j,\ell$&lt;/span&gt;, thus obtaining a decomposition of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_{ijk\ell}=\sum_\alpha s_\alpha A^\alpha_{ik}\bar B^{\alpha}_{j\ell}.\tag2$$&lt;/span&gt;&#xA;This looks very close to the typical Kraus representation for a general map as given in &lt;strong&gt;(1)&lt;/strong&gt;. Being &lt;span class=&quot;math-container&quot;&gt;$s_\alpha\ge0$&lt;/span&gt;, one can also write &lt;span class=&quot;math-container&quot;&gt;$s_\alpha=\sqrt{s_\alpha}\sqrt{s_\alpha}$&lt;/span&gt; and redefine the operators &lt;span class=&quot;math-container&quot;&gt;$A, B$&lt;/span&gt; to contain &lt;span class=&quot;math-container&quot;&gt;$\sqrt{s_\alpha}$&lt;/span&gt;, thus getting an even more similar form.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I'm wondering is: is this way of decomposing the channel via SVD equivalent to the Kraus representation? If so, we would also know additional properties for the &lt;span class=&quot;math-container&quot;&gt;$A_{ik}^\alpha, B_{j\ell}^\alpha$&lt;/span&gt; operators, such as their orthogonality: &lt;span class=&quot;math-container&quot;&gt;$\sum_{ik}A^\alpha_{ik} \bar A^\beta_{ik}=\delta_{\alpha\beta}$&lt;/span&gt; etc.&#xA;In this sense, it seems to me that absorbing the singular values &lt;span class=&quot;math-container&quot;&gt;$s_\alpha$&lt;/span&gt; into the operators, like is done in &lt;strong&gt;(1)&lt;/strong&gt;, is actually hiding information, because then we lose the orthogonality between the &lt;span class=&quot;math-container&quot;&gt;$A_a, B_a$&lt;/span&gt;.&#xA;Does one approach have any advantage over the other (assuming they are both equally correct)?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="1764" LastEditDate="2019-05-14T14:06:03.860" LastActivityDate="2019-05-14T14:06:03.860" Title="Direct derivation of the Kraus representation from the natural representation, using SVD" Tags="&lt;quantum-information&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6140" PostTypeId="2" ParentId="6138" CreationDate="2019-05-14T08:41:47.477" Score="3" Body="&lt;p&gt;This is certainly how theorists think of this being done. I don't know if there's an experimental reality to compare this to. Whether they actually decompose it in terms of the eigenvectors, or find some other terms to decompose it as.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just as an example of what I mean, let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W=\left(\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;As it happens, this is just a swap gate, but ignore this for now.&#xA;You might find the eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|00\rangle,|11\rangle,(|01\rangle\pm|10\rangle)/\sqrt{2}$&lt;/span&gt; and measure those expectation values directly. Or, you might write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W=(\mathbb{I}+Z\otimes Z+X\otimes X+Y\otimes Y)/2,&#xA;$$&lt;/span&gt;&#xA;and them you might go off and measure the 3 separate observables &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$YY$&lt;/span&gt;, those being particularly natural, accessible, things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there's no problem using &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; to define a measurement. The partial transpose is irrelevant; it's still a Hermitian matrix. The partial transpose just means it might not be a valid state, but being a valid state is irrelevant as a measurement: if we say &quot;do a Z measurement&quot;, the Z matrix certainly has nothing to do with being a state. It's just a Hermitian matrix.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-14T08:41:47.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6141" PostTypeId="2" ParentId="6134" CreationDate="2019-05-14T12:02:49.120" Score="2" Body="&lt;p&gt;The idea is to use CS inequality in the form &#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\tr}{\operatorname{Tr}}\lvert \sum_{ij}A_{ij}^* B_{ij}\rvert\le\sqrt{\sum_{ij} \left\lvert A_{ij}\right\rvert^2}\sqrt{\sum_{ij}\left\lvert  B_{ij}\right\rvert^2}$&lt;/span&gt;, which in matrix formalism reads &lt;span class=&quot;math-container&quot;&gt;$\lvert\tr(A^\dagger B)\rvert\le\sqrt{\tr(A^\dagger A})\sqrt{\tr(B^\dagger B)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert\tr(AU)\rvert=\lvert\tr(\lvert A\rvert VU)\rvert&#xA;=\lvert\tr(\lvert A\rvert^{1/2} \underbrace{\lvert A\rvert^{1/2} VU}_{D})\rvert&#xA;\le\sqrt{\tr(\lvert A\rvert^{1/2}\lvert A\rvert^{1/2})}\sqrt{\tr(D^\dagger D)},&#xA;$$&lt;/span&gt;&#xA;and putting in the explicit expression for &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; you get the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also have a look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4664/55&quot;&gt;this other answer&lt;/a&gt; for more details on how to prove this result.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-05-25T13:06:10.517" LastActivityDate="2019-05-25T13:06:10.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6142" PostTypeId="2" ParentId="6139" CreationDate="2019-05-14T14:03:35.670" Score="2" Body="&lt;p&gt;As matrices, the natural representation and Choi representation of a map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; have exactly the same entries, but arranged into matrices in different ways. One way to express this is like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle k,\ell | K(\Phi) | i,j \rangle = \langle k | \Phi(|i\rangle\langle j|) | \ell \rangle = \langle k,i | J(\Phi) | \ell,j \rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; denotes the natural representation, &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; denotes the Choi representation, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; index into the input system, and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; index into the output system. It appears to me that applying the singular value decomposition to &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; in the particular way the question describes is equivalent to applying the singular value decomposition to &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; for this reason. Of course, we do not need to use the singular value decomposition to write &lt;span class=&quot;math-container&quot;&gt;$J(\Phi) = \sum_a u_a v_a^{\dagger}$&lt;/span&gt;, but it is one way to obtain this form (and as a bonus to get &lt;span class=&quot;math-container&quot;&gt;$\{u_a\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{v_a\}$&lt;/span&gt; to be orthogonal sets, in case that is useful).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand the statement in the question about information being hidden if the singular values are absorbed into the Kraus operators. The sets &lt;span class=&quot;math-container&quot;&gt;$\{A_a\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{B_a\}$&lt;/span&gt; are both orthogonal sets, and this does not change when their elements are multiplied by scalars.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my view, the main advantage in starting from the Choi representation is that it works better for completely positive maps. In this case, &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; is positive semidefinite, so we can use the spectral decomposition rather than the singular value decomposition to obtain &lt;span class=&quot;math-container&quot;&gt;$A_a = B_a$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. Indeed, equation (1) in the question would be considered by many to be a generalized type of Kraus representation, whereas a proper Kraus representation would require &lt;span class=&quot;math-container&quot;&gt;$A_a = B_a$&lt;/span&gt;, and therefore only exists when &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is completely positive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, the Choi representation &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; is nice because its properties as an operator translate to properties of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; (particularly &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\geq 0$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is completely positive). In some sense the natural representation &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; ignores the operator structure of the inputs and outputs of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, which makes it a less useful representation.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2019-05-14T14:03:35.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6143" PostTypeId="2" ParentId="2047" CreationDate="2019-05-14T17:11:09.840" Score="1" Body="&lt;p&gt;I will give here another way to prove explicitly the equivalence of the two expressions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the Kraus representation, &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)=\sum_a A^a \rho A^{a\dagger}$&lt;/span&gt;, making the indices explicit, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(\rho)_{ij}=\sum_{a,k,\ell}A^a_{ik}A^{a*}_{j\ell}\rho_{k\ell}.\tag1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, unravelling the second expression we have for a generic &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; (let me here use numbers instead of latin letters for the indices, for better clarity, as well as Einstein's notation for repeated indices),&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[U(\rho \otimes \sigma) U^\dagger]_{1234}=U_{1256}U^{*}_{3478}\rho_{57}\sigma_{68}.$$&lt;/span&gt;&#xA;Note that here the first two indices, (&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;) correspond to the &quot;output space&quot; of the operator &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)$&lt;/span&gt;, while the other two (&lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;) correspond to its &quot;input space&quot;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; live in the second Hilbert space, while &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; live in the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tracing with respect to the second Hilbert space amounts to introducing a &lt;span class=&quot;math-container&quot;&gt;$\delta_{24}$&lt;/span&gt; factor, and we thus get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left\{\mathrm{Tr}_B\left[ U(\rho \otimes \sigma) U^\dagger  \right]\right\}_{13}&#xA;=U_{1256}U^{*}_{3478}\rho_{57}\sigma_{68} \color{red}{\delta_{24}}&#xA;=U_{1256}U^{*}_{3278}\rho_{57}\sigma_{68}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; to be a pure state, for example &lt;span class=&quot;math-container&quot;&gt;$\sigma=\lvert0\rangle\!\langle0\rvert$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$\sigma_{68}=\delta_{60}\delta_{80}$&lt;/span&gt;, then we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left\{\mathrm{Tr}_B\left[ U(\rho \otimes \lvert0\rangle\!\langle0\rvert) U^\dagger  \right]\right\}_{13}&#xA;=U_{1250}U^*_{3270}\rho_{57}.$$&lt;/span&gt;&#xA;Going back to using the standard notation for the indices, and making explicit the sums, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left\{\mathrm{Tr}_B\left[ U(\rho \otimes \lvert0\rangle\!\langle0\rvert) U^\dagger  \right]\right\}_{ij}&#xA;=\sum_{a,k,\ell}U_{iak0}U^*_{ja\ell0}\rho_{k\ell}.\tag2$$&lt;/span&gt;&#xA;This expression is equivalent to &lt;strong&gt;(1)&lt;/strong&gt;, defining &lt;span class=&quot;math-container&quot;&gt;$A^a_{ik}\equiv U_{iak0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_{j\ell}^{a*}\equiv U^*_{ja\ell0}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-18T13:52:49.363" LastActivityDate="2019-11-18T13:52:49.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6144" PostTypeId="1" AcceptedAnswerId="14587" CreationDate="2019-05-14T17:59:22.707" Score="3" ViewCount="64" Body="&lt;p&gt;We know that a map &lt;span class=&quot;math-container&quot;&gt;$\Phi\in\mathrm T(\mathcal X,\mathcal Y)$&lt;/span&gt; being completely positive is equivalent to its Choi representation being positive: &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\in\operatorname{Pos}(\mathcal Y\otimes\mathcal X)$&lt;/span&gt;, as shown for example in &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/TQI&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' &lt;em&gt;book&lt;/em&gt;&lt;/a&gt;, around pag. 82.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof for the completely positive case relies on writing the Choi representation &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi)=(\Phi\otimes\mathbb1_{\mathrm L(\mathcal X)})(\operatorname{vec}(\mathbb1_{\mathcal X})\operatorname{vec}(\mathbb1_{\mathcal X})^*),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and noting that because &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(\mathbb1_{\mathcal X})\operatorname{vec}(\mathbb1_{\mathcal X})^*\ge0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi\otimes\mathbb1_{\mathrm L(\mathcal X)}$&lt;/span&gt; is a positive map, then &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\ge0$&lt;/span&gt;.&#xA;It is not obvious whether this sort of argument can give interesting results about &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\Phi\otimes\mathbb1_{\mathrm L(\mathcal X)}$&lt;/span&gt; is not positive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, how does &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; being &quot;only&quot; positive reflect on &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; (if any such simple characterisation is possible)?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-11-11T15:01:14.810" LastActivityDate="2020-11-11T15:01:14.810" Title="How does a map being &quot;only&quot; positive reflect on its Choi representation?" Tags="&lt;mathematics&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6145" PostTypeId="1" CreationDate="2019-05-14T19:49:26.803" Score="6" ViewCount="125" Body="&lt;p&gt;Would there be any disadvantages of using inner product, that is, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(A^{\dagger}B)$&lt;/span&gt; (say making it, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\sqrt A \sqrt B)$&lt;/span&gt; to normalise) to quantify how far two quantum states are instead of fidelity, which is &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\sqrt{\sqrt A B \sqrt A})$&lt;/span&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apart from losing the relationship with trace distance. &lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-02-14T18:57:33.657" LastActivityDate="2021-02-14T18:57:33.657" Title="Are there disadvantages in using the inner product between states instead of the fidelity?" Tags="&lt;fidelity&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6146" PostTypeId="1" AcceptedAnswerId="6147" CreationDate="2019-05-14T21:25:16.453" Score="6" ViewCount="1743" Body="&lt;p&gt;I am reading John Watrous' notes from his course CPSC 519 on quantum computing. In a pre-discussion before presenting Deutsch's algorithm to determine whether a function is constant or not, the author presents a function &lt;span class=&quot;math-container&quot;&gt;$B_f |x \rangle |y \rangle = |x \rangle |y \oplus f(x) \rangle $&lt;/span&gt;, and the diagram:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/z2AdT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z2AdT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inital state is &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle |1 \rangle$&lt;/span&gt;, and after the first two Hadamard transforms, will be &lt;span class=&quot;math-container&quot;&gt;$$\big(\frac {1} {\sqrt 2} |0\rangle +\frac {1} {\sqrt 2} |1\rangle\big)\big(\frac {1} {\sqrt 2} |0\rangle-\frac {1} {\sqrt 2} |1\rangle\big) .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Up to this far I understand. The author then writes: &quot;After performing the &lt;span class=&quot;math-container&quot;&gt;$B_f$&lt;/span&gt; operation the state is transformed to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac {1} {2} |0 \rangle \big(|0 \oplus f(0)\rangle - |1 \oplus f(0)\rangle\big) + \frac {1} {2} |1 \rangle \big(|0 \oplus f(1)\rangle) - |1 \oplus f(1) \rangle\big).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure how this was obtained, from what I understand, the operation should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac {1} {\sqrt 2} \big( |0\rangle + |1\rangle\big) \otimes \big|(\frac {1} {\sqrt 2} |0\rangle +\frac {1} {\sqrt 2} |1\rangle) \oplus f(\frac {1} {\sqrt 2} |0\rangle +\frac {1} {\sqrt 2} |1\rangle) \big\rangle$$&lt;/span&gt; (simply subbing in &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$B_f$&lt;/span&gt;). Any insights appreciated as this subject is completely new to me, although I have a decent mathematics and computer science background.&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="26" LastEditDate="2019-05-15T09:34:16.910" LastActivityDate="2019-05-15T09:34:16.910" Title="Understanding the oracle in Deutsch's algorithm" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6147" PostTypeId="2" ParentId="6146" CreationDate="2019-05-14T21:50:52.127" Score="8" Body="&lt;p&gt;Remember that when you define the oracle effect as &lt;span class=&quot;math-container&quot;&gt;$B_f |x \rangle |y \rangle = |x \rangle |y \oplus f(x) \rangle $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is a classical function of a classical 1-bit argument, so you do not have a way to compute &lt;span class=&quot;math-container&quot;&gt;$f(\frac {1} {\sqrt 2} |0\rangle +\frac {1} {\sqrt 2} |1\rangle)$&lt;/span&gt; (a function of a quantum state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum oracles that implement classical functions are defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Define the effect of the oracle on all basis states for &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$B_f |x \rangle |y \rangle = |x \rangle |y \oplus f(x) \rangle $&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This will automatically define the effect of the oracle on all superposition states: the oracle is a quantum operation and has to be linear in the state on which it acts. So if you start with a state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} (|00\rangle + |10\rangle - |01\rangle - |11\rangle)$&lt;/span&gt; (which is the state after applying Hadamard gates) and apply the oracle, you need to apply oracle to each basis state separately. You'll get&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B_f \frac{1}{2} (|00\rangle + |10\rangle - |01\rangle - |11\rangle) = \frac{1}{2} (B_f|00\rangle + B_f|10\rangle - B_f|01\rangle - B_f|11\rangle) =$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ = \frac{1}{2} (|0\rangle|0 \oplus f(0)\rangle + |1\rangle|0 \oplus f(1)\rangle - |0\rangle|1 \oplus f(0)\rangle - |1\rangle|1 \oplus f(1)\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is the same as the expression in the notes, up to a different grouping or terms.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The part about the oracles being defined by their effect on basis states is implicit in a lot of sources I've seen, and is a frequent source of confusion. If you need more mathematical details on this, we ended up writing it up &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/oracles&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-05-14T21:50:52.127" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6149" PostTypeId="2" ParentId="6107" CreationDate="2019-05-15T00:25:33.127" Score="2" Body="&lt;p&gt;The Quantum Volume is a benchmark for near term, noisy quantum systems. Indeed, like other random unitary benchmarks, you need to be able to sample the ideal distribution. This distribution comes from classical simulations, so your limited to about the ~40 or so qubit limit. However, the Quantum Volume itself was designed to benchmark not only the quantum device itself, but also things like control electronics, measurements, circuit compilation methods, etc, while encoding all of this in a single numerical value. Currently, IBM has shown Quantum Volume numbers for at most four qubits, 2^4=16.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-05-15T00:25:33.127" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6150" PostTypeId="2" ParentId="6132" CreationDate="2019-05-15T03:50:54.583" Score="3" Body="&lt;p&gt;Dariusz Chruscinski has provided me with an example of a particular such entanglement witness. It takes the form&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left(&#xA;\begin{array}{cccccccccccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, he has informed me that a second entanglement witness can be obtained by the replacement of the sixteen diagonal entries of the above matrix by &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;{2, 1, 0, 0, 0, 2, 1, 0, 0, 0, 2, 1, 1, 0, 0, 2}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="3089" LastEditDate="2019-05-16T10:22:33.607" LastActivityDate="2019-05-16T10:22:33.607" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6151" PostTypeId="2" ParentId="6145" CreationDate="2019-05-15T11:31:01.587" Score="4" Body="&lt;p&gt;A few thoughts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It mostly depends on what you are trying to quantify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inner product of states, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho\sigma)$&lt;/span&gt;, is used to quantify the distance in state space. More precisely, the squared distance between two states is commonly defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho,\sigma)^2\equiv \|\rho-\sigma\|_2^2=1-\text{Tr}(\rho\sigma).$$&lt;/span&gt;&#xA;This is useful and used for example to understand the geometrical features of the space of states (think Bloch representations of states).&#xA;For pure states, the definitions coincide, as you have &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho\sigma)=\lvert\langle\psi_\rho\rvert\psi_\sigma\rangle\rvert^2$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\rho=\lvert\psi_\rho\rangle\!\langle\psi_\rho\rvert$&lt;/span&gt; and same for &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. For mixed states, however, I don't know if there is a direct physical interpretation of &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho\sigma)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the fidelity quantifies the indistinguishability between states (equivalently, the probability of finding one state to equal the other, in an appropriate measurement choice). In the case of mixed states, you have to decide what is meant by this, as there are potentially many possible pure states that are compatible with any given mixed state, and comparing the pure states corresponding to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; might give different results depending on such choice. The state fidelity considers the worst-case scenario in terms of distinguishability: as shown by &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states#Uhlmann&amp;#39;s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Uhlmann's theorem&lt;/a&gt; (see also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4664/55&quot;&gt;this question&lt;/a&gt; and links therein), &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\lvert\sqrt\rho\sqrt\sigma\rvert)$&lt;/span&gt; equals the maximum fidelity among the purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(\lvert\sqrt\rho\sqrt\sigma\rvert)=\max_{\psi_\rho,\psi_\sigma}\lvert\langle\psi_\rho\rvert\psi_\sigma\rangle\rvert,$$&lt;/span&gt;&#xA;where the maximisation is performed over all possible purifications &lt;span class=&quot;math-container&quot;&gt;$\psi_\rho,\psi_\sigma$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-05-15T13:41:33.970" LastActivityDate="2019-05-15T13:41:33.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6152" PostTypeId="2" ParentId="6145" CreationDate="2019-05-15T11:54:17.903" Score="4" Body="&lt;p&gt;The quantity &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sqrt{A}\sqrt{B})$&lt;/span&gt; that you defined there is actually referred to as the &quot;just-as-good fidelity&quot; (see &lt;a href=&quot;https://arxiv.org/abs/1801.02800&quot; rel=&quot;nofollow noreferrer&quot;&gt;1801.02800&lt;/a&gt;) because it &lt;em&gt;does&lt;/em&gt; have a relationship with the trace distance very similar to the standard fidelity and is therefore &quot;just as good&quot; for quantifying the distinguishability of states. There is no intrinsic reason to prefer the standard fidelity, but the latter gets used a lot because it is often useful to use Uhlmann's theorem, as glS points out in the other answer.&lt;/p&gt;&#xA;" OwnerUserId="7495" LastActivityDate="2019-05-15T11:54:17.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6154" PostTypeId="2" ParentId="39" CreationDate="2019-05-15T18:56:16.407" Score="1" Body="&lt;p&gt;After introducing Shor's algorithm to an audience, in many of Scott Aaronson's publicly available lectures from the mid-2000's until the early-mid 2010's he would often emphasize the gap between the theoretical capabilities of a quantum computer vs. the engineering difficulties of constructing a quantum computer by stating something to the effect of &quot;a quantum computer has determined that &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; factors into &lt;span class=&quot;math-container&quot;&gt;$3\times5$&lt;/span&gt;... with &lt;strong&gt;&lt;em&gt;high probability&lt;/em&gt;&lt;/strong&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a good line especially with Aaronson's well-timed beat, and the audience always seemed to chuckle at least a little bit, but of course we all know that that's a small &lt;em&gt;oversimplification&lt;/em&gt; of the probabilistic nature of Shor's algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, it's rather that Shor's algorithm would tell us that &quot;a factor of &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; with high probability, and another factor of &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; with high probability.&quot; We can &lt;em&gt;classically&lt;/em&gt; confirm that &lt;span class=&quot;math-container&quot;&gt;$15=3\times 5$&lt;/span&gt;, now that Shor's algorithm has told us what some factors are (with high probability).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, as suggested in Niel de Beaudrap's answer, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{FACTORING}$&lt;/span&gt;, like many problems to which we believe a quantum computer will be useful, are in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}\cap\mathrm{NP}$&lt;/span&gt;.  We might rely on the randomness of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; to generate candidate solutions but we can always test classically whether the quantum computer's putative solutions are correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are, however, many problems which are in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; but are not known to be, and are suspected not to be, in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; - for example, evaluating a Jones polynomial of a knot diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I know that there are two great answers already; however, the question does allow exposition/clarification on Aaronson's quote/anectdote.) &lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-05-16T11:45:07.213" LastActivityDate="2019-05-16T11:45:07.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6155" PostTypeId="1" CreationDate="2019-05-15T20:41:56.103" Score="4" ViewCount="155" Body="&lt;p&gt;Assume &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits to &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; bits function and we want to use Grover's search algorithm to find &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x) = a$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-bit predetermined value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When using the algorithm, can we separate the calls to &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x)=a$&lt;/span&gt;? &#xA;That is, instead of querying &lt;span class=&quot;math-container&quot;&gt;$F(x) \equiv (f(x) = a)$&lt;/span&gt; around &lt;span class=&quot;math-container&quot;&gt;$2^{n/2}$&lt;/span&gt; times (interleaved with amplification), is it possible to query &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; once at the begining and then repeat &lt;span class=&quot;math-container&quot;&gt;$2^{n/2}$&lt;/span&gt; times &lt;span class=&quot;math-container&quot;&gt;$f(x)=a$&lt;/span&gt; (interleaved with amplification) ?&lt;/p&gt;&#xA;" OwnerUserId="7498" LastEditorUserId="7498" LastEditDate="2019-05-16T00:22:05.817" LastActivityDate="2019-05-26T14:47:50.763" Title="Grover search with single query to $f(x)$ and multiple queries to $f(x) = a$" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6157" PostTypeId="1" AcceptedAnswerId="6221" CreationDate="2019-05-16T04:49:17.890" Score="16" ViewCount="2129" Body="&lt;p&gt;I found it a little difficult to understand it using &lt;a href=&quot;https://en.wikipedia.org/wiki/Haar_measure&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; and some mathematical documents. How to understand the Haar measure from a quantum information theory perspective? Are there any materials that explain it?&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="55" LastEditDate="2021-02-14T18:51:56.750" LastActivityDate="2021-02-14T18:51:56.750" Title="How to understand the Haar measure from a quantum information perspective?" Tags="&lt;mathematics&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="17" ContentLicense="CC BY-SA 4.0" />
  <row Id="6159" PostTypeId="2" ParentId="6136" CreationDate="2019-05-16T06:49:04.753" Score="4" Body="&lt;p&gt;If you're told about an operation on a single qubit, then to convert it into an operation on both qubits, you just include the identity matrix on the other qubit. So, contrast the single qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; going through the bit-flip channel&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\rightarrow(1-p)|\psi\rangle\langle\psi|+pX|\psi\rangle\langle\psi|X&#xA;$$&lt;/span&gt;&#xA;with what happens on two qubits&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\beta\rangle\rightarrow(1-p)|\beta\rangle\langle\beta|+p(\mathbb{I}\otimes X)|\beta\rangle\langle\beta|(\mathbb{I}\otimes X).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-16T06:49:04.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6160" PostTypeId="1" AcceptedAnswerId="6161" CreationDate="2019-05-16T10:52:21.450" Score="2" ViewCount="438" Body="&lt;p&gt;I would like to know how the unitary matrix for this circuit looks like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RWkKi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RWkKi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure but I would try something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1&amp;amp;0\\0&amp;amp;0\end{pmatrix}\otimes H_1=\begin{pmatrix}\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\\frac{1}{\sqrt{2}}&amp;amp;-\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second part:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0&amp;amp;0\\0&amp;amp;1\end{pmatrix}\otimes I_1=\begin{pmatrix}0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;putting them together:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\\frac{1}{\sqrt{2}}&amp;amp;-\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\end{pmatrix}+\begin{pmatrix}0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\end{pmatrix}=\begin{pmatrix}\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\\frac{1}{\sqrt{2}}&amp;amp;-\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if that's right, that's just a consideration of mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming the circuit would look like that, what does the matrix look like?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/reDyk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/reDyk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="26" LastEditDate="2019-05-16T10:55:12.427" LastActivityDate="2019-05-16T11:05:48.670" Title="Matrix representation of multiple qubit gates (Hadamard transform on single wire)" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6161" PostTypeId="2" ParentId="6160" CreationDate="2019-05-16T11:05:48.670" Score="3" Body="&lt;p&gt;Your matrix representation is incorrect. In the first case, a &lt;span class=&quot;math-container&quot;&gt;$\mathbf H$&lt;/span&gt; gate is applied to the first qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and an identity gate &lt;span class=&quot;math-container&quot;&gt;$\Bbb I$&lt;/span&gt; is applied to the second qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. So the effective quantum gate acting on the two-qubit system is &lt;span class=&quot;math-container&quot;&gt;$\mathbf H\otimes \Bbb I$&lt;/span&gt;. This is precisely because &lt;span class=&quot;math-container&quot;&gt;$(\mathbf H|0\rangle_A) \otimes (\Bbb I|0\rangle_B) = (\mathbf H\otimes \Bbb I)(|0\rangle_A \otimes |0\rangle_B)$&lt;/span&gt; as explained &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2271&quot;&gt;here&lt;/a&gt;. Similarly, for the second case, the effective quantum gate is &lt;span class=&quot;math-container&quot;&gt;$\Bbb I\otimes \mathbf H$&lt;/span&gt;. If you know the matrix representations of &lt;span class=&quot;math-container&quot;&gt;$\mathbf H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Bbb I$&lt;/span&gt;, simply calculate the two &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker products&lt;/a&gt;, to get the corresponding matrix representations. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-05-16T11:05:48.670" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6163" PostTypeId="1" AcceptedAnswerId="6166" CreationDate="2019-05-16T16:03:28.727" Score="3" ViewCount="147" Body="&lt;p&gt;I have these two classical-quantum states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_{a} \lvert a\rangle \langle a\lvert \otimes q^a \\&#xA; \mu = \sum_{a} \lvert a\rangle \langle a\lvert \otimes r^a $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; are the classical basis vectors, &lt;span class=&quot;math-container&quot;&gt;$q^a, r^a$&lt;/span&gt; are arbitrary matrices dependent on &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we can take the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace distance&lt;/a&gt; of these two classical-quantum states, which would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$T(\rho, \mu) = \frac{1}{2} ||\rho - \mu||_1 \\&#xA;= \frac{1}{2} || \sum_a \lvert a\rangle \langle a\lvert \otimes(q^a - r^a)||_1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my question is, can we rewrite the above expression in the following way?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$T(\rho, \mu) = \frac{1}{2} \sum_a ||q^a - r^a||_1$$&lt;/span&gt;&#xA;I.e. just pulling the summation out of the norm. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="26" LastEditDate="2019-05-16T16:43:41.463" LastActivityDate="2019-05-16T19:50:35.597" Title="Trace distance of two classical-quantum states" Tags="&lt;quantum-state&gt;&lt;quantum-information&gt;&lt;mathematics&gt;&lt;classical-quantum&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6164" PostTypeId="5" CreationDate="2019-05-16T16:05:21.100" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-16T16:05:21.100" LastActivityDate="2019-05-16T16:05:21.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6165" PostTypeId="4" CreationDate="2019-05-16T16:05:21.100" Score="0" Body="In quantum mechanics, and especially quantum information and the study of open quantum systems, the trace distance T is a metric on the space of density matrices and gives a measure of the distinguishability between two states. It is the quantum generalization of the Kolmogorov distance for classical probability distributions. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-16T16:05:21.100" LastActivityDate="2019-05-16T16:05:21.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6166" PostTypeId="2" ParentId="6163" CreationDate="2019-05-16T18:30:55.790" Score="6" Body="&lt;p&gt;Yes, since the trace norm is the sum of the absolute value of the singular values, and the singular values can be found for each of the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; blocks independently.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2019-05-16T19:50:35.597" LastActivityDate="2019-05-16T19:50:35.597" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6167" PostTypeId="1" AcceptedAnswerId="6168" CreationDate="2019-05-16T18:51:09.323" Score="1" ViewCount="86" Body="&lt;p&gt;I want to implement a controlled operation that involves the following: we have the following qubits: &lt;span class=&quot;math-container&quot;&gt;$|x_0\rangle,|x_1\rangle,|0\rangle,|1\rangle,|z_0\rangle,|z_1\rangle$&lt;/span&gt;. I want to add the first four qubits as &lt;span class=&quot;math-container&quot;&gt;$|x_0x_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; where each &lt;span class=&quot;math-container&quot;&gt;$x_i\in\{0,1\}$&lt;/span&gt; conditioned on the  &lt;span class=&quot;math-container&quot;&gt;$|z_1\rangle$&lt;/span&gt; being &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. If the control is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; then do not perform the adder mod operation. So the circuit for this that I constructed is given in the figure: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8TAcU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8TAcU.png&quot; alt=&quot;Controlled ADD MOD 4&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this circuit correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Just to elaborate what this circuit does. It  takes &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; non-negative integer inputs &lt;span class=&quot;math-container&quot;&gt;$x=|x_0x_1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1=|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$z=|z_0z_1\rangle$&lt;/span&gt; and adds the first two integers that are stored in the register &lt;span class=&quot;math-container&quot;&gt;$|x_0x_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. The third integer &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; gives a remainder of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; when divided by &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;, but this can be thought of as the least significant bit being equal to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Is the problem statement and circuit construction matching?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-17T14:13:15.263" LastActivityDate="2019-05-17T14:13:15.263" Title="Implementing a controlled sum operation" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6168" PostTypeId="2" ParentId="6167" CreationDate="2019-05-16T20:06:59.510" Score="2" Body="&lt;p&gt;The second from the top wire should probably be marked &lt;span class=&quot;math-container&quot;&gt;$|x_1 \rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|x_0 \rangle$&lt;/span&gt; (right now you have two &lt;span class=&quot;math-container&quot;&gt;$|x_0 \rangle$&lt;/span&gt;s). Other than that, the circuit looks correct for the described task.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-16T20:27:33.287" LastActivityDate="2019-05-16T20:27:33.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6170" PostTypeId="1" AcceptedAnswerId="6171" CreationDate="2019-05-17T03:23:47.363" Score="3" ViewCount="354" Body="&lt;p&gt;Say we have the Shor 9 qubit code &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_L\rangle=\tfrac{1}{\sqrt{2^3}}((|000\rangle+|111\rangle)^{\otimes3}+(|000\rangle-|111\rangle)^{\otimes3}),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we have a bit flip error. My lecture notes say that error syndromes are obtained by measuring the observables:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Z_1Z_2,Z_2Z_3,Z_4Z_5,Z_5Z_6, Z_7Z_8,Z_8Z_9.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which will give eigenvalues +1 if the two adjacent qubits in the block are the same and -1 if they are different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions about this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How does one measure the observables?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How are the eigenvalues obtained?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-05-17T13:09:43.913" LastActivityDate="2019-05-17T18:46:39.347" Title="Shor 9 qubit code — how are the observables measured and eigenvalues obtained during syndrome measurement?" Tags="&lt;error-correction&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6171" PostTypeId="2" ParentId="6170" CreationDate="2019-05-17T07:45:29.180" Score="5" Body="&lt;p&gt;Note that measuring an observable is equivalent to projecting the quantum state into a particular eigenspace of the operator, and the measurement result tells you which eigenspace. So, in the case of measuring an observable on an eigenstate of that observable, you just project the state onto itself, and the outcome tells you the eigenvalue. So, (2)is equivalent to (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of how to actually measure an observable, there's a standard technique if the observable &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; is such that &lt;span class=&quot;math-container&quot;&gt;$O^2$&lt;/span&gt; is the identity (such as a tensor product of Pauli matrices, as is the case here). I described this in a previous &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5683/1837&quot;&gt;answer&lt;/a&gt;, but add it here for completeness:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qcFYu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qcFYu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Basically, you add an ancilla (the top qubit)for each observable, perform the circuit, and then measure the ancilla in the 0/1 basis. 0 corresponds to the +1 eigenvalue of the operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;, while 1 corresponds to the -1 eigenvalue.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-17T07:45:29.180" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6172" PostTypeId="1" CreationDate="2019-05-17T10:46:07.143" Score="7" ViewCount="387" Body="&lt;p&gt;One of the possible ways to improve the results of an experiment on the IBM machine using the Qiskit language is to use the measurement calibration methods. &lt;a href=&quot;https://qiskit.org/documentation/ignis/measurement_calibration.html&quot; rel=&quot;noreferrer&quot;&gt;This&lt;/a&gt; is the link to the documentation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understood that the calibration matrix is made looking at when a qubit in a determined state is measured in one other state. But I didn't get how this calibration matrix is applied to the results to obtain the mitigated results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the command used:&#xA;&lt;code&gt;mitigated_results = meas_filter.apply(my_results, method)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7513" LastEditorUserId="26" LastEditDate="2019-05-17T14:10:51.630" LastActivityDate="2019-06-05T11:51:17.287" Title="How does measurement calibration work?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;error-correction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6174" PostTypeId="2" ParentId="6170" CreationDate="2019-05-17T16:57:35.260" Score="1" Body="&lt;p&gt;So say we have the encoded single qubit &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_L\rangle=\tfrac{c_0}{\sqrt{2^3}}(|000\rangle+|111\rangle)^{\otimes3}+\tfrac{c_1}{\sqrt{2^3}}(|000\rangle-|111\rangle)^{\otimes3},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then say a bit flip occurs on the 4th qubit  so now we have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_L \rangle=\tfrac{c_0}{\sqrt{2^3}}((|000\rangle+|111\rangle)\otimes(|100\rangle+|011\rangle)\otimes(|000\rangle+|111\rangle))+\tfrac{c_1}{\sqrt{2^3}}((|000\rangle-|111\rangle)\otimes (|100\rangle-|011\rangle)\otimes (|000\rangle-|111\rangle))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we add the ancilla qubit &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, giving &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_i \rangle=\tfrac{c_0|0\rangle}{\sqrt{2^3}}((|000\rangle+|111\rangle)\otimes(|100\rangle+|011\rangle)\otimes(|000\rangle+|111\rangle))+\tfrac{c_1|0\rangle}{\sqrt{2^3}}((|000\rangle-|111\rangle)\otimes (|100\rangle-|011\rangle)\otimes (|000\rangle-|111\rangle))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing the first Hadamard gate in your diagram gives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_i \rangle=\tfrac{c_0(|0\rangle+|1\rangle)}{\sqrt{2}\sqrt{2^3}}((|000\rangle+|111\rangle)\otimes(|100\rangle+|011\rangle)\otimes(|000\rangle+|111\rangle))+\tfrac{c_1(|0\rangle+|1\rangle)}{\sqrt{2}\sqrt{2^3}}((|000\rangle-|111\rangle)\otimes (|100\rangle-|011\rangle)\otimes (|000\rangle-|111\rangle))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing &lt;span class=&quot;math-container&quot;&gt;$Z_4Z_5$&lt;/span&gt; gives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_i \rangle=\tfrac{c_0(|0\rangle+|1\rangle)}{\sqrt{2}\sqrt{2^3}}((|000\rangle+|111\rangle)\otimes(-|100\rangle+|011\rangle)\otimes(|000\rangle+|111\rangle))+\tfrac{c_1(|0\rangle+|1\rangle)}{\sqrt{2}\sqrt{2^3}}((|000\rangle-|111\rangle)\otimes (-|100\rangle-|011\rangle)\otimes (|000\rangle-|111\rangle))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing the second Hadamard gate gives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_i \rangle=\tfrac{c_0|0\rangle}{\sqrt{2^3}}((|000\rangle+|111\rangle)\otimes(|100\rangle+|011\rangle)\otimes(|000\rangle+|111\rangle))+\tfrac{c_1|0\rangle}{\sqrt{2^3}}((|000\rangle-|111\rangle)\otimes (|100\rangle-|011\rangle)\otimes (|000\rangle-|111\rangle))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we take a measurement in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; basis. At this point I'm confused. Does it mean that we use a projective operator, say for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_1=|1\rangle \langle1|$&lt;/span&gt;, then we see what the probability of this is using &lt;span class=&quot;math-container&quot;&gt;$\langle\psi| P_1 |\psi\rangle$&lt;/span&gt;? And if the probability is 1 then the eigenvalue is -1, and if its zero the eigenvalue is +1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When I understand it fully I'll edit this so it's a complete answer.&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-05-17T18:46:39.347" LastActivityDate="2019-05-17T18:46:39.347" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6176" PostTypeId="1" AcceptedAnswerId="6181" CreationDate="2019-05-17T18:53:17.017" Score="2" ViewCount="155" Body="&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;POVM&lt;/a&gt;, as defined for example in (&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.66.1119&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peres and Wooters 1991&lt;/a&gt;), is defined by a set of &lt;em&gt;positive&lt;/em&gt; operators &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$\sum_a \mu(a)=\mathbb 1$&lt;/span&gt;. We do not require the &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; to be projectors, nor commuting operators, like is done in the case of projective measurements.&#xA;The probability of getting the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;-th outcome when the state is &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; is then &lt;span class=&quot;math-container&quot;&gt;$\langle\psi\rvert \mu(a)\rvert\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to understand the significance of such a general kind of measurement operation is via &lt;a href=&quot;https://en.wikipedia.org/wiki/Naimark%27s_dilation_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Naimark's theorem&lt;/a&gt;. Following the notation (sorta) used in &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' book&lt;/a&gt; (chapter 5), we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mu(a)=A^\dagger(\mathbb 1_{\mathcal X}\otimes E_{a,a})A,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an isometry, satisfying &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A=\mathbb 1$&lt;/span&gt;, whose action we can write as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$AX=\sum_a\sqrt{\mu(a)}X\otimes\lvert a\rangle.$$&lt;/span&gt;&#xA;Should I understand this to be saying that the measurement &lt;span class=&quot;math-container&quot;&gt;$(\mu(a))_a$&lt;/span&gt; corresponds to correlating &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; with a bigger system, and then &quot;looking at the enlarged system&quot; (that is, performing a standard projecting measurement)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, it should be sensible to write the state in the enlarged system where the projective measurement actually occurs as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A\lvert\psi\rangle=\sum_a[\sqrt{\mu(a)}\lvert\psi\rangle]\otimes\lvert a\rangle.$$&lt;/span&gt;&#xA;However, writing the spectral decomposition of &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mu(a)=\sum_k\lambda^a_k\lvert\lambda^a_k\rangle\!\langle\lambda^a_k\rvert$&lt;/span&gt;, we would have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A\lvert\psi\rangle=\sum_{a,k}\sqrt{\lambda^a_k}\lvert\lambda^a_k\rangle\!\langle\lambda^a_k\rvert\psi\rangle\otimes\lvert a\rangle.$$&lt;/span&gt;&#xA;But is such an object a proper state? The normalisation reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|A\lvert\psi\rangle\|^2=\sum_a \|\sqrt{\lambda^a_k}\lvert\lambda^a_k\rangle\!\langle\lambda^a_k\rvert\psi\rangle\|^2=\sum_{a,k} \lambda^a_k \lvert\langle\lambda^a_k\rvert\psi\rangle\rvert^2,$$&lt;/span&gt;&#xA;and it does not seem so obvious whether this always sums to one (and intuitively I would say it doesn't, due to its dependence on &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it wrong to think of &lt;span class=&quot;math-container&quot;&gt;$A\lvert\psi\rangle$&lt;/span&gt; as a proper state? Or if not, how can we see that it is always normalised?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-22T07:56:24.040" LastActivityDate="2021-03-11T15:38:16.440" Title="Does the dilation in Naimark's theorem produce a state?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6177" PostTypeId="1" CreationDate="2019-05-17T19:10:56.380" Score="3" ViewCount="748" Body="&lt;p&gt;The definition of spectral decomposition is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\hat{A}$&lt;/span&gt; define a basis &lt;span class=&quot;math-container&quot;&gt;$\beta=\{|\psi_j\rangle\}$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$$A_{kj}=\langle\psi_k|\hat{A}|\psi_j\rangle=\alpha_j\delta_{jk},$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$$\hat{A}=\sum_{kj}A_{kj}|\psi_k\rangle\langle\psi_j|=\sum_{j}\alpha_{j}|\psi_j\rangle\langle\psi_j|.$$&lt;/span&gt;&#xA;But when I try to do this for the bit flip gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, it doesn't seem to work. The eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle-|1\rangle$&lt;/span&gt;. Then if we take &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X&amp;amp;=(\langle0|+\langle1|)X(|0\rangle+|1\rangle)\,\,\times\big[(|0\rangle+|1\rangle)(\langle0|+\langle1|)\big] \\&#xA;&amp;amp;+(\langle0|-\langle1|)X(|0\rangle-|1\rangle)\,\,\times\big[(|0\rangle-|1\rangle)(\langle0|-\langle1|)\big].&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't get anything close to the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix I was looking for. Could anyone please explain this to me? &lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="55" LastEditDate="2019-05-29T08:51:44.357" LastActivityDate="2019-05-29T08:51:44.357" Title="What is the spectral decomposition of the Pauli $X$ gate?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6178" PostTypeId="2" ParentId="6177" CreationDate="2019-05-17T19:58:10.760" Score="2" Body="&lt;h3&gt;TL;DR: You forgot to normalize the eigenvectors!&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Your description of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral theorem&lt;/a&gt; is incomplete; it requires you to use an &lt;strong&gt;orthonormal basis&lt;/strong&gt; i.e. the basis &lt;span class=&quot;math-container&quot;&gt;$\beta=\{|\psi_j\rangle\}$&lt;/span&gt; &lt;em&gt;must be&lt;/em&gt; orthonormal, as I previously discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5989/what-does-it-mean-to-express-a-gate-in-dirac-notation/5992#5992&quot;&gt;here&lt;/a&gt;. When normalized, the eigenvectors of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;  gate form the basis &lt;span class=&quot;math-container&quot;&gt;$\left\{{\frac{|0\rangle+|1\rangle}{\sqrt{2}}},{\frac{|0\rangle-|1\rangle}{\sqrt{2}}}\right\}$&lt;/span&gt;. Now let's evaluate the terms &lt;span class=&quot;math-container&quot;&gt;$\color{red}{\left(\frac{\langle 0|+\langle 1|}{\sqrt{2}}\right)X\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\color{blue}{\left(\frac{\langle 0|-\langle 1|}{\sqrt{2}}\right)X\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)}$&lt;/span&gt;. These are actually the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; corresponding to the two eigenvectors, because if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a normalized eigenvector (i.e. &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\psi\rangle = 1$&lt;/span&gt; ) of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is the corresponding eigenvalue, then &lt;span class=&quot;math-container&quot;&gt;$$X|\psi\rangle = \lambda |\psi\rangle \implies \langle \psi|X|\psi\rangle = \langle \psi|\lambda|\psi\rangle= \lambda\langle \psi|\psi\rangle =\lambda.1=\lambda.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you know that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is the &quot;bit-flip&quot; gate, so it performs &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \mapsto |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\mapsto|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore \color{red}{\left(\frac{\langle 0|+\langle 1|}{\sqrt{2}}\right)X\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)} = \left(\frac{\langle 0|+\langle 1|}{\sqrt{2}}\right)\left(\frac{|1\rangle+|0\rangle}{\sqrt{2}}\right)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(\langle 0|1\rangle + \langle0|0\rangle+\langle 1|1\rangle + \langle 1|0\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(0+1+1+0)=\color{red}{1} \ (\because \text{$|0\rangle$ and $|1\rangle$ are orthonormal})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore \color{blue}{\left(\frac{\langle 0|-\langle 1|}{\sqrt{2}}\right)X\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)} = \left(\frac{\langle 0|-\langle 1|}{\sqrt{2}}\right)\left(\frac{|1\rangle-|0\rangle}{\sqrt{2}}\right)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(\langle 0|1\rangle - \langle0|0\rangle-\langle 1|1\rangle + \langle 1|0\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(0-1-1+0)=\color{blue}{-1} \ (\because \text{$|0\rangle$ and $|1\rangle$ are orthonormal})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now according the spectral decomposition theorem you can represent the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\boxed{\color{blue}{-1}\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)\left(\frac{\langle 0|-\langle1|}{\sqrt{2}}\right) + \color{red}{1}\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)\left(\frac{\langle 0|+\langle1|}{\sqrt{2}}\right)}\tag{*}\label{*}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\require{cancel}=-\frac{1}{2}\left(\cancel{|0\rangle\langle0|}-|0\rangle\langle1|-|1\rangle\langle0|+\cancel{|1\rangle\langle1|}\right)+\frac{1}{2}\left(\cancel{|0\rangle\langle0|}+|0\rangle\langle1|+|1\rangle\langle0|+\cancel{|1\rangle\langle1|}\right)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\color{green}{|1\rangle \langle0| + |0\rangle \langle1|}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To convince you that this result is correct let's apply it on an arbitrary qubit state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\color{green}{(|1\rangle \langle0| + |0\rangle \langle1|)}(\alpha|0\rangle+\beta|1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\alpha|1\rangle\langle0|0\rangle+\beta|0\rangle\langle 1|1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\alpha|1\rangle + \beta|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yes, the bits &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; &lt;em&gt;are&lt;/em&gt; flipped and our representation &lt;span class=&quot;math-container&quot;&gt;$\eqref{*}$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is indeed correct!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-17T22:56:10.447" LastActivityDate="2019-05-17T22:56:10.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6179" PostTypeId="2" ParentId="6177" CreationDate="2019-05-17T19:59:05.233" Score="3" Body="&lt;p&gt;Continue simplifying from what you've given&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;X&amp;amp;=&amp;amp;(\langle0|+\langle1|)X(|0\rangle+|1\rangle)(|0\rangle+|1\rangle)(\langle0|+\langle1|)\\&#xA;&amp;amp;+&amp;amp;(\langle0|-\langle1|)X(|0\rangle-|1\rangle)(|0\rangle-|1\rangle)(\langle0|-\langle1|)\\&#xA;(\langle0|+\langle1|)X(|0\rangle+|1\rangle) &amp;amp;=&amp;amp; 0 + 1 + 1 + 0 = 2\\&#xA;(|0\rangle+|1\rangle)(\langle0|+\langle1|) &amp;amp;=&amp;amp; | 0 \rangle \langle 0 | + | 1 \rangle \langle 0 | + | 0 \rangle \langle 1 | + | 1 \rangle \langle 1 |\\&#xA;(\langle0|-\langle1|)X(|0\rangle-|1\rangle) &amp;amp;=&amp;amp; 0 - 1 - 1 + 0 = -2\\&#xA;(|0\rangle-|1\rangle)(\langle0|-\langle1|) &amp;amp;=&amp;amp; | 0 \rangle \langle 0 | - | 1 \rangle \langle 0 | - | 0 \rangle \langle 1 | + | 1 \rangle \langle 1 |\\&#xA;X &amp;amp;=&amp;amp; 2 (| 0 \rangle \langle 0 | + | 1 \rangle \langle 0 | + | 0 \rangle \langle 1 | + | 1 \rangle \langle 1 |) \\&amp;amp;+&amp;amp; (-2) ( | 0 \rangle \langle 0 | - | 1 \rangle \langle 0 | - | 0 \rangle \langle 1 | + | 1 \rangle \langle 1 |)\\&#xA;X &amp;amp;=&amp;amp; 4 | 1 \rangle  \langle 0 | + 4 | 0 \rangle \langle 1 |&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there should be no factor of 4 there. So what was wrong? You didn't normalize your eigenvectors. That means you should divide all your vectors by &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In each of the 2 summands in your expression at the very top, there are 4 vectors. So each summand should be divided by &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2})^4=4$&lt;/span&gt;. Follow that through and the simplification works and you get &lt;span class=&quot;math-container&quot;&gt;$X=X$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$X=4X$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-05-17T20:58:59.237" LastActivityDate="2019-05-17T20:58:59.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6180" PostTypeId="2" ParentId="6177" CreationDate="2019-05-17T19:59:40.650" Score="4" Body="&lt;p&gt;The eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle = \frac{1}{\sqrt 2} (|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle = \frac{1}{\sqrt 2} (|0\rangle - |1\rangle)$&lt;/span&gt; (remember to keep them normalized), with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$a_1 = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_2 = -1$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the spectral decomposition in terms of the outer product representation is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X = a_1 |\psi_1 \rangle \langle \psi_1| + a_2 |\psi_2 \rangle \langle \psi_2| = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ = \frac{1}{2} (|0\rangle + |1\rangle)(\langle 0| + \langle 1|) - \frac{1}{2} (|0\rangle - |1\rangle)(\langle 0| - \langle 1|) = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ = \frac{1}{2} (\color{red}{|0\rangle\langle0|} + |0\rangle\langle1| + |1\rangle\langle0| + \color{red}{|1\rangle\langle1|}) - \frac{1}{2} (\color{red}{|0\rangle\langle0|} - |0\rangle\langle1| - |1\rangle\langle0| + \color{red}{|1\rangle\langle1|})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The red parts cancel out, so you're left with &lt;span class=&quot;math-container&quot;&gt;$X = |0\rangle\langle1| + |1\rangle\langle0|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-05-17T19:59:40.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6181" PostTypeId="2" ParentId="6176" CreationDate="2019-05-17T20:30:05.513" Score="3" Body="&lt;p&gt;First of all, &lt;span class=&quot;math-container&quot;&gt;$\|A|\psi\rangle\|^2 = (A|\psi\rangle)^\dagger(A|\psi\rangle) = \langle \psi | A^\dagger A|\psi\rangle = 1$&lt;/span&gt;.&lt;br&gt;&#xA;To see why your last expression equals to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; note that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi\rvert \mu(a)\rvert\psi\rangle = \sum_{k} \lambda^a_k \lvert\langle\lambda^a_k\rvert\psi\rangle\rvert^2 ~~\text{and}~~ \sum_a \mu(a) = \mathbb 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it's perfectly legal state from mathematical point of view. Just like in the case of purification. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-05-17T20:41:29.837" LastActivityDate="2019-05-17T20:41:29.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6183" PostTypeId="1" AcceptedAnswerId="6184" CreationDate="2019-05-18T00:55:50.777" Score="2" ViewCount="134" Body="&lt;p&gt;A QuTiP novice here. It's easy to prepare a pure state in QuTiP. For example, to prepare &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0,0\rangle + |1,1\rangle)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;psi = (ket('00') + ket('11')).unit()&#xA;psi = (tensor(basis(2,0), basis(2,0)) + tensor(basis(2,1), basis(2,1))).unit()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But what code would you use to prepare a statistical mixture of &lt;span class=&quot;math-container&quot;&gt;$ |0,0\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |1,1\rangle $&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7520" LastEditorUserId="55" LastEditDate="2019-05-19T12:16:56.407" LastActivityDate="2019-05-19T12:16:56.407" Title="How to prepare a statistical mixture of $|0,0\rangle $ and $ |1,1\rangle $ in QuTiP?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6184" PostTypeId="2" ParentId="6183" CreationDate="2019-05-18T04:05:22.750" Score="1" Body="&lt;p&gt;Mixed states are represented by &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;density matrices&lt;/a&gt; cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2347/density-matrices-for-pure-states-and-mixed-states?noredirect=1&amp;amp;lq=1&quot;&gt;Density matrices for pure states and mixed states&lt;/a&gt;. &lt;a href=&quot;http://qutip.org/docs/3.1.0/guide/guide-states.html#density-matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is the QuTiP documentation for density matrices; check the 4th example. The &lt;a href=&quot;http://qutip.org/docs/3.1.0/apidoc/functions.html?highlight=ket2dm#qutip.states.ket2dm&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ket2dm&lt;/code&gt;&lt;/a&gt; function takes input a ket or bra vector and returns density matrix formed by the outer product. So say for a 50-50 mixture the following code should work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qutip import *&#xA;0.5*ket2dm(tensor(basis(2,0), basis(2,0))) + 0.5*ket2dm(tensor(basis(2,1), basis(2,1)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns the required density matrix representing a 50-50 statistical mixture of &lt;span class=&quot;math-container&quot;&gt;$|0,0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1,1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = True&#xA;Qobj data =&#xA;[[0.5 0.  0.  0. ]&#xA; [0.  0.  0.  0. ]&#xA; [0.  0.  0.  0. ]&#xA; [0.  0.  0.  0.5]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-18T04:19:01.237" LastActivityDate="2019-05-18T04:19:01.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6186" PostTypeId="1" AcceptedAnswerId="6190" CreationDate="2019-05-18T13:36:52.010" Score="4" ViewCount="413" Body="&lt;p&gt;To my understanding, most of the qubits we use today are just Josephson junctions coupled to a resonator that is triggering the qubits to go to different states by using microwave pulses. The same resonators are also used to read the information form qubits. As shown in this picture:&lt;a href=&quot;https://i.stack.imgur.com/ZA66Z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZA66Z.jpg&quot; alt=&quot;Quantum COmputer chip&quot;&gt;&lt;/a&gt;&#xA;So I was wondering how does a qubit readout, when we measure it, gets read and how it is interpreted. How does raw information from qubit look like? &lt;/p&gt;&#xA;" OwnerUserId="7375" LastEditorUserId="26" LastEditDate="2019-05-18T16:40:43.630" LastActivityDate="2019-05-18T22:39:26.930" Title="How is a physical qubit measured and how is the result interpreted?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6187" PostTypeId="1" AcceptedAnswerId="6212" CreationDate="2019-05-18T17:19:39.310" Score="1" ViewCount="283" Body="&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22Sample3%22,1,1,%22Sample3%22,1,1,%22Sample1%22],[1,%22%E2%80%A2%22,1,1,%22%E2%80%A2%22,1,%22X%22],[1,%22%E2%80%A2%22,1,1,1,1,%22X%22],[1,1,1,1,%22%E2%80%A2%22,1,%22X%22],[%22%E2%80%A2%22,1,1,%22%E2%80%A2%22,1,%22X%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,1,1,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,1,1,%22X%22],[1,%22%E2%80%A2%22,1,1,%22X%22],[1,1,%22%E2%80%A2%22,1,1,%22X%22],[1,1,1,%22Sample3%22]],%22init%22:[1,1,1,1,1,1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CrcOy.gif&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have made the above quantum circuit that gives the mod &lt;span class=&quot;math-container&quot;&gt;$8=2^3$&lt;/span&gt;&#xA;operation between &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;. Now I want to write its corresponding program using some language. Where can I do that i.e. online or on my hardware? And what programming language can I use for this purpose? Also please check my circuit for correctness. &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="119" LastEditDate="2019-05-21T16:00:22.410" LastActivityDate="2019-05-21T23:08:48.013" Title="How do I translate a quantum circuit for computing x + y mod 8 into a program?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6188" PostTypeId="1" AcceptedAnswerId="6191" CreationDate="2019-05-18T18:22:25.527" Score="4" ViewCount="124" Body="&lt;p&gt;Suppose I have integers and encode them as binary strings for example: &lt;span class=&quot;math-container&quot;&gt;$$|0\rangle=|00\rangle,|1\rangle= |01\rangle,|2\rangle=|10\rangle,|3\rangle=|11\rangle.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit integer, say &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, is encoded as a state &lt;span class=&quot;math-container&quot;&gt;$|x_0x_1....x_{n-1}\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; being the most significant bit. To check the remainder by &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; we only care about the two least significant bit i.e. &lt;span class=&quot;math-container&quot;&gt;$x_{n-2}x_{n-1}$&lt;/span&gt;. If the remainder is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; then the least significant bit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and hence for a controlled operation that executes whether the remainder is &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; can be triggered only by the least significant bit being &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. But my question is if I want to execute a controlled operation conditioned on the remainder being &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; what should be done? Since &lt;span class=&quot;math-container&quot;&gt;$|3\rangle=|11\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle=|00\rangle $&lt;/span&gt;, should &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,1,%22Sample2%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22X%22],[1,1,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[1,1,1,1,%22%E2%80%A2%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; be the circuit for the control?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,1,%22Sample2%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22X%22],[1,1,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[1,1,1,1,%22%E2%80%A2%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aEbBD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-18T23:29:07.153" LastActivityDate="2019-05-18T23:29:07.153" Title="Circuit construction for execution of conditional statements using least significant bit" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6190" PostTypeId="2" ParentId="6186" CreationDate="2019-05-18T22:28:43.583" Score="5" Body="&lt;p&gt;What follows turned out to be a rather technical explanation, so I'll start with the main point: The qubit state can change the resonator's state, and the resonator's state can be easily measured only if there is a large different in frequencies between the qubit and the resonator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's model a qubit as a two-level system and a resonator as a harmonic oscillator. We need to give both a characteristic frequency, so let's call the qubit frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_q$&lt;/span&gt; and the resonator frequency &lt;span class=&quot;math-container&quot;&gt;$\omega_r$&lt;/span&gt;. We also need to characterize the strength of the interaction (how fast energy is transferred from one thing to another), and that's usually called &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we need to describe the dynamics of the qubit and resonator together. That's done by breaking the Hamiltonian down into three parts: qubit energy, resonator energy, and interaction strength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\text{qubit}} = \frac{1}{2} \hbar \omega_q \sigma_z $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\text{resonator}} = \hbar \omega_r \ a^\dagger a $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_I = \hbar g ( \sigma_+a + a^\dagger \sigma_-)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = H_{\text{qubit}} + H_{\text{resonator}} + H_I $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the Jaynes-Cummings Hamiltonian. Note that the rotating wave approximation was used. Pauli operators are given by &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, and creation and annihilation operators are &lt;span class=&quot;math-container&quot;&gt;$a^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if the frequencies of the resonator and the qubit are the same (that's called the &quot;resonance condition&quot;), then they will exchange energy back and forth, much like an LC circuit or potential and kinetic energy in a pendulum. That's not ideal for measuring a qubit (you want to avoid as much as possible the measurement apparatus influencing the qubit state), so we make the frequency of the resonator very far away from the qubit's. This is a called a dispersive interaction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formally, if &lt;span class=&quot;math-container&quot;&gt;$\omega_r - \omega_q = \Delta$&lt;/span&gt;, the Hamiltonian (now in the interaction picture) can be expressed as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \hbar \frac{g^2}{\Delta} ( |1\rangle \langle 1| + a^\dagger a \sigma_z  ) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the interaction between the qubit and the resonator is dispersive, and if the resonator is driven to a coherent state &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt;, then the qubit states of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; can be distinguished.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Examine the evolution of two initial states, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|\alpha\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|\alpha\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ e^{-iHt/\hbar}|0\rangle|\alpha\rangle = |0\rangle|\alpha e^{-i\frac{g^2}{\Delta}t } \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ e^{-iHt/\hbar}|1\rangle|\alpha\rangle = |1\rangle|\alpha e^{i\frac{g^2}{\Delta}t } \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the point of the dispersive interaction: the coherent state of the resonator changes according to the state of the qubit, without having energy exchanged directly. You can see that the coherent state gets shifted counterclockwise for a 0 and clockwise for a 1. Furthermore, it's a simple matter to measure the state of a coherent resonator, since it can be described classically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is only an outline of the complete answer. I've assumed knowledge of basic quantum mechanics, changing reference frames (interaction picture, Schrodinger picture, etc), coherent states, and the rotating wave approximation. I also glossed over the derivation of the dispersive Hamiltonian, which you can find in &quot;Introductory Quantum Optics&quot; by Gerry and Knight.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="26" LastEditDate="2019-05-18T22:39:26.930" LastActivityDate="2019-05-18T22:39:26.930" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6191" PostTypeId="2" ParentId="6188" CreationDate="2019-05-18T23:11:02.640" Score="5" Body="&lt;p&gt;I would use a circuit that looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y2UDz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y2UDz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is an ancillary output bit. Assume the initial state of the system is in the standard basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, the first &lt;span class=&quot;math-container&quot;&gt;$\land_2(X)$&lt;/span&gt; (CCNOT) applies the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the target qubit for all states that have their two least significant bits set to 1. Note that if none of the states have &lt;span class=&quot;math-container&quot;&gt;$|x_{n-1}\rangle=|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|x_{n-2}\rangle=|1\rangle$&lt;/span&gt; then the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is never applied to the ancilla. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then negate both of the control bits, so that if they were previously 1 they are then set to 0, and vice versa. This results in the next &lt;span class=&quot;math-container&quot;&gt;$\land_2(X)$&lt;/span&gt; gate only being applied if originally, &lt;span class=&quot;math-container&quot;&gt;$|x_{n-1}\rangle=|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|x_{n-2}\rangle=|0\rangle$&lt;/span&gt;. The final two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates uncompute the original negation, so that the original states of the two least significant bits are preserved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the only states that will have the ancillary bit set to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, are those for which the two least significant bits were either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Satisfying the requirements of your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if I can clarify further. &lt;/p&gt;&#xA;" OwnerUserId="5157" LastEditorUserId="5157" LastEditDate="2019-05-18T23:21:32.313" LastActivityDate="2019-05-18T23:21:32.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6192" PostTypeId="1" AcceptedAnswerId="6194" CreationDate="2019-05-19T10:53:28.460" Score="4" ViewCount="279" Body="&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum complexity theory and quantum information, there are &lt;a href=&quot;https://scholar.google.co.in/scholar?hl=en&amp;amp;as_sdt=0%2C5&amp;amp;q=closed+timelike+curves+quantum+computing+information&amp;amp;btnG=&quot; rel=&quot;nofollow noreferrer&quot;&gt;several papers&lt;/a&gt; which study the implications of &lt;a href=&quot;https://en.wikipedia.org/wiki/Closed_timelike_curve&quot; rel=&quot;nofollow noreferrer&quot;&gt;closed timelike curves (CTCs)&lt;/a&gt;. In 2008, Aaronson and Watrous published their &lt;a href=&quot;https://arxiv.org/abs/0808.2669&quot; rel=&quot;nofollow noreferrer&quot;&gt;legendary paper&lt;/a&gt; on this topic which shows that certain forms of time travel can make classical and quantum computing equivalent i.e. quantum computers provide no computational advantage if they can send information to the past through closed-timelike curves. In the paper's abstract they specifically mention:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;While closed timelike curves (CTCs) are not known to exist, studying their consequences has led to &lt;strong&gt;nontrivial insights in general relativity, quantum information, and other areas&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, this sounds pretty interesting, although I haven't really read any of the papers related to CTCs. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In brief, what really are closed timelike curves? &lt;/li&gt;&#xA;&lt;li&gt;Would it be possible to give a general idea about why this &quot;time travel&quot; of information can make quantum computing equivalent to classical computing, without diving too much into the details?&lt;sup&gt;†&lt;/sup&gt;&lt;/li&gt;&#xA;&lt;li&gt;What other non-trivial insights have the study of CTCs provided us in the context of quantum information? &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I do intend to work through some of the papers on CTCs myself and perhaps also write an answer to this question at some point. But the aim of this thread is to gather some ideas about the &quot;big picture&quot; regarding why quantum information theorists and complexity theorists are interested in CTCs.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;†: The abstract says that &quot;given any quantum circuit (not necessarily unitary), a fixed-point of the circuit can be (implicitly) computed in polynomial space&quot;. I'm not sure how this relates to sending information via CTCs, causing quantum computing to be no more efficient than classical computing.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-19T14:46:12.733" LastActivityDate="2019-05-20T15:39:31.693" Title="CTCs and information time travel — what non-trivial insights do they lead to?" Tags="&lt;quantum-information&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6194" PostTypeId="2" ParentId="6192" CreationDate="2019-05-19T13:26:12.417" Score="4" Body="&lt;p&gt;I &lt;strong&gt;just recently&lt;/strong&gt; have been watching a series great YouTube lectures by Ryan O'Donnell at Carnegie Mellon.  The &lt;a href=&quot;https://www.youtube.com/watch?v=XGpxcoI_zxE&quot; rel=&quot;nofollow noreferrer&quot;&gt;last one&lt;/a&gt; in particular has some answers to the above question - especially the last 10 minutes or so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will summarize my limited understanding.  Misunderstandings are my own...&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &quot;closed timelike curve&quot; (CTC) may be something akin to a &lt;em&gt;wormhole&lt;/em&gt; in spacetime.  Ends of the wormhole may connect disparate regions of space.&lt;/li&gt;&#xA;&lt;li&gt;We can put a circuit in the CTC - with inputs on one end, and outputs on another end.&lt;/li&gt;&#xA;&lt;li&gt;Suppose our circuit is a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; gate.  &lt;/li&gt;&#xA;&lt;li&gt;If we put a classical &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; into one mouth of the wormhole, then we get out a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on the other end. But because the wormhole is closed, this can create a contradiction - as if we went back in time to &lt;a href=&quot;https://en.wikipedia.org/wiki/Grandfather_paradox&quot; rel=&quot;nofollow noreferrer&quot;&gt;kill our grandfather&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;But David Deutsch says we shouldn't put in a classical bit into the mouths of the wormhole! And further the operation performed in the wormhole shouldn't just be a classical &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; operation, but can be any &lt;em&gt;quantum&lt;/em&gt; gate.&lt;/li&gt;&#xA;&lt;li&gt;Indeed we can put in a qubit in a uniform superposition of &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle+\vert 1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If we through such a qubit into the mouth of a CTC we won't get a contradiction - the negation of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\vert 0\rangle+ \frac{1}{\sqrt{2}}\vert 1\rangle$&lt;/span&gt; is &lt;em&gt;also&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\vert 0\rangle+ \frac{1}{\sqrt{2}}\vert 1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Thus &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\vert 0\rangle+ \frac{1}{\sqrt{2}}\vert 1\rangle$&lt;/span&gt; is a fixed point of the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; gate.&lt;/li&gt;&#xA;&lt;li&gt;Deutsch showed that &lt;em&gt;any&lt;/em&gt; circuit has such a fixed point, that avoids such a violation/grandfather paradox&lt;/li&gt;&#xA;&lt;li&gt;However, even though it's likely &lt;em&gt;computationally difficult&lt;/em&gt; to determine what the fixed point of a circuit is, Deutsch and Aaronson and Watrous take it as a given that consistency of causality requires a CTC to automagically give the fixed point.&lt;/li&gt;&#xA;&lt;li&gt;For example, if we have a CTC, and we feed it a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SAT}$&lt;/span&gt; problem framed in the correct way, then the fixed points would correspond to only those solutions to the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SAT}$&lt;/span&gt; problem.&lt;/li&gt;&#xA;&lt;li&gt;O'Donnell describes how followups of Aaronson and Watrous leads to &lt;em&gt;positive results&lt;/em&gt; with reference to sampling problems/quantum supremacy&lt;/li&gt;&#xA;&lt;li&gt;That is, O'Donnell outlines a proof that if approximate sampling on a quantum computer were equivalent to approximate sampling on classical computer, then the polynomial time hierarchy collapses&lt;/li&gt;&#xA;&lt;li&gt;The proof relies on the work of Aaronson and Watrous in ways that I'm not entirely sure of.&lt;/li&gt;&#xA;&lt;li&gt;The net is that if quantum supremacy is achieved via approximate sampling, then under some reasonable hypothesis we can say that the &quot;proof&quot; as it were is related to non-trivial insights about the power of closed timelike curves.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-05-20T15:39:31.693" LastActivityDate="2019-05-20T15:39:31.693" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6195" PostTypeId="1" AcceptedAnswerId="6196" CreationDate="2019-05-19T20:57:21.017" Score="4" ViewCount="201" Body="&lt;p&gt;I've been working through the great introduction to quantum computing on &lt;a href=&quot;https://quantum.country/qcvc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Country&lt;/a&gt;. One exercise there is to find a possible quantum gate matrix that is not the &lt;span class=&quot;math-container&quot;&gt;$X,I$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of &lt;span class=&quot;math-container&quot;&gt;$B = \frac{1}{\sqrt2}\begin{bmatrix}i &amp;amp; 1\\1 &amp;amp; i\end{bmatrix}$&lt;/span&gt;. However, I cannot find any article / paper mentioning this quantum gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understood, all quantum gates must be &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt;, unitary matrices. I have even checked whether &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is indeed unitary, and &lt;a href=&quot;https://www.wolframalpha.com/input/?i=is%20(1%2Fsqrt(2))*%5B(i,1),(1,i)%5D%20unitary%3F&quot; rel=&quot;nofollow noreferrer&quot;&gt;yes, it is&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does this gate &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; not have any useful applications? Or is it just not a valid gate?&lt;/p&gt;&#xA;" OwnerUserId="7539" LastEditorUserId="2927" LastEditDate="2019-05-20T05:29:59.680" LastActivityDate="2019-05-20T14:33:20.147" Title="What applications does the quantum gate [(i,1),(1,i)] have?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6196" PostTypeId="2" ParentId="6195" CreationDate="2019-05-20T06:38:37.847" Score="5" Body="&lt;p&gt;That's not the right way to look at it. In quantum mechanics, time evolutions are &lt;a href=&quot;https://physics.stackexchange.com/questions/169936&quot;&gt;considered to be unitary&lt;/a&gt; and any unitary evolution can be written as a sequence of unitary operators &lt;span class=&quot;math-container&quot;&gt;$U_1, U_2, U_3,\ldots$&lt;/span&gt; acting on a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. Any single-qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix#Elementary_constructions&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary operation&lt;/a&gt; is a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}a&amp;amp;b\\-e^{i\phi}b^*&amp;amp;e^{i\phi} a^*\end{pmatrix}, |a|^2+|b|^2=1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, &lt;span class=&quot;math-container&quot;&gt;$a=\frac{i}{\sqrt{2}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b=\frac{1}{\sqrt{2}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi$&lt;/span&gt;. Now, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; isn't one of the &quot;popular&quot; quantum gates like the Pauli or the Hadamard, but that doesn't mean it can't be a valid evolution operator! The Hadamard and the Pauli are generally chosen because they have some neat properties; for instance, the Pauli matrices form a basis for all &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; Hermitian matrices. For more, read the Wikipedia pages on &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard matrix&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli matrices&lt;/a&gt;. Moreover, note that some gates can be easier to engineer than others; I had written &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1280&quot;&gt;an answer&lt;/a&gt; about this before. Also see: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1587/26&quot;&gt;Why do we use the standard gate set that we do?&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So for drawing quantum circuits we generally try to choose a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal gate set&lt;/a&gt; that's also relatively easy to physically implement. Now &lt;em&gt;any&lt;/em&gt; unitary evolution can be replicated with an &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt; precision, with a sufficient number of elementary quantum gates which form a universal set. Niel de Beaudrap also wrote &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4250&quot;&gt;a nice answer&lt;/a&gt; on this topic. Perhaps, as an exercise, you can try to write the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; gate in terms of the elementary quantum gates listed &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you notice carefully, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\operatorname{NOT}}=\frac{1-i}{\sqrt{2}}B$&lt;/span&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; differs from the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\operatorname{NOT}}$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt;) by a simple phase factor! Thus, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\operatorname{NOT}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are essentially the same gate cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3889&quot;&gt;Norbert Schuch's answer&lt;/a&gt;. For a physical implementation of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\operatorname{NOT}}$&lt;/span&gt; check &lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S1090780798916068&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jones, Hansen &amp;amp; Mosca (1998)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest playing around with it a bit on &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22~cjl9%22]],%22gates%22:[%7B%22id%22:%22~cjl9%22,%22name%22:%22B%22,%22matrix%22:%22%7B%7B%E2%88%9A%C2%BDi,%E2%88%9A%C2%BD%7D,%7B%E2%88%9A%C2%BD,%E2%88%9A%C2%BDi%7D%7D%22%7D]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;. The &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2279/26&quot;&gt;Bloch sphere intuition&lt;/a&gt; should help:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://i.stack.imgur.com/nHc1i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nHc1i.png&quot; alt=&quot;Source:https://journals.aps.org/prb/abstract/10.1103/PhysRevB.67.094510&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You see, both &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; rotate a qubit state around &lt;span class=&quot;math-container&quot;&gt;$\hat{x}$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$90^{\mathrm{o}}$&lt;/span&gt;, albeit with different phase factors.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-20T14:33:20.147" LastActivityDate="2019-05-20T14:33:20.147" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6198" PostTypeId="1" CreationDate="2019-05-20T08:34:19.637" Score="6" ViewCount="681" Body="&lt;p&gt;What feature of a quantum algorithm makes it better than its classical counterpart?  Are quantum computers faster than classical ones in all respects?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="55" LastEditDate="2020-09-23T09:34:33.500" LastActivityDate="2021-04-12T18:10:44.213" Title="What exactly makes quantum computers faster than classical computers?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;&lt;quantum-advantage&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6199" PostTypeId="1" AcceptedAnswerId="6200" CreationDate="2019-05-20T09:32:38.237" Score="3" ViewCount="1455" Body="&lt;p&gt;I would like to implement a variational algorithm (similar to VQE but with another cost function, no expectation of a Hamiltonian involved) from zero. Is there any tutorial explaining how to implement a VQE or similar variational algorithm in QISKit tutorial? This means creating the ansatz, implementing the cost function and running on the real quantum computer. I haven't seen it. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7543" LastEditorUserId="26" LastEditDate="2019-05-20T10:15:14.657" LastActivityDate="2019-05-21T15:23:43.227" Title="IBM QISKit: creating a variational algorithm from zero" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6200" PostTypeId="2" ParentId="6199" CreationDate="2019-05-20T09:53:54.190" Score="3" Body="&lt;p&gt;In &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/community/aqua/algorithm_introduction_with_vqe.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Qiskit Aqua tutorial&lt;/a&gt;, they show how to use the Variational Quantum Eigensolver (VQE) for solving a ground state energy problem. &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/9f4f8b8c2a0977f8fe7ec9a12a7062b81ac74c3b/qiskit/aqua/optimization/maxcut_and_tsp.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;'s another in the context of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Travelling_salesman_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;travelling salesman problem&lt;/a&gt;. Note that both use the &lt;a href=&quot;https://qiskit.org/aer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aer&lt;/a&gt; simulators as backend and not the real IBMQ devices. You might also want to go through their documentation on &lt;a href=&quot;https://qiskit.org/documentation/aqua/algorithms.html#vqe&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/documentation/aqua/variational_forms.html#variational-forms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Forms&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/documentation/aqua/optimizers.html#optimizers&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimizers&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/aqua/initial_states.html#initial-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;Initial States&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;&#xA;Quantum Algorithm Implementations for Beginners (Coles &lt;em&gt;et al.&lt;/em&gt;, 2018)&lt;/a&gt; there's a nice discussion about the theory of VQE and how it's used to simulate a transverse Ising model. However, due to the communication bottlenecks when the quantum device and classical computers are not physically co-located, it could not be run on real quantum processors like the ones on IBMQ Cloud.  &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-20T10:22:52.570" LastActivityDate="2019-05-20T10:22:52.570" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6201" PostTypeId="1" CreationDate="2019-05-20T13:21:45.093" Score="8" ViewCount="3194" Body="&lt;p&gt;While writing &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6196&quot;&gt;this answer&lt;/a&gt; I realized it would be really helpful if I could show the OP a video or .gif of how qubit states in Bloch spheres transform under certain unitary operations. I googled up a bit and could find only these two simulators:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://eecs.ceas.uc.edu/~cahaymm/blochsphere/index.html&quot; rel=&quot;noreferrer&quot;&gt;Bloch Sphere Simulation (Stephen Shary and Dr. Marc Cahay)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://demonstrations.wolfram.com/QubitsOnThePoincareBlochSphere/&quot; rel=&quot;noreferrer&quot;&gt;Wolfram Demonstration Project: Qubits on the Poincaré (Bloch) Sphere&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Both involve some messy software installations and I don't really want to do that. The second one apparently doesn't even allow the user to input arbitrary 2×2 operators!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;P.S&lt;/strong&gt;: It would be great if &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/119/craig-gidney?tab=profile&quot;&gt;Craig Gidney&lt;/a&gt; could add a full-fledged Bloch sphere simulator within &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;Quirk&lt;/a&gt; at some point (ideally, by making the already existing Bloch sphere views of the qubit states clickable and enlargeable). :)&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-20T19:23:46.257" LastActivityDate="2021-01-23T22:23:18.197" Title="Is there any online Bloch sphere simulator?" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;bloch-sphere&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6202" PostTypeId="2" ParentId="6201" CreationDate="2019-05-20T16:00:39.983" Score="4" Body="&lt;p&gt;I used &lt;a href=&quot;https://www.st-andrews.ac.uk/physics/quvis/simulations_html5/sims/blochsphere/blochsphere.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; last time I needed to look up something about Bloch sphere. It's not perfect, since it doesn't allow entering the exact values of angles, let alone 2x2 matrices, but it has the benefit of being available online.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ttphan.github.io/Quantum-Bloch-Sphere-Simulator/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This one&lt;/a&gt; looks promising in that it allows to enter matrices (and is also online), but I haven't tried it.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="26" LastEditDate="2019-05-20T17:08:24.690" LastActivityDate="2019-05-20T17:08:24.690" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6205" PostTypeId="1" CreationDate="2019-05-21T09:45:51.753" Score="4" ViewCount="68" Body="&lt;p&gt;To make the partial transpose a complete positive and therefore physical map, one has to mix it with enough of the maximally mixed state to offset the negative eigenvalues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most negative eigenvalue is obtained when partial transpose is applied on the maximally entangled state which is &lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\widetilde{I \otimes \Lambda} = (1-p)(I \otimes \Lambda) \rho + p\frac{I \otimes I}{4}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p = \frac{2}{3}$&lt;/span&gt; will sufficiently offset the values. However, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0111064&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this paper&lt;/a&gt; by Horodecki and Ekert, they say &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; needs to be greater than &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{9}$&lt;/span&gt;, which I can't understand why. &lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-03-09T22:06:01.500" LastActivityDate="2021-03-09T22:06:01.500" Title="Structural Physical Approximation of Partial Transpose" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6206" PostTypeId="2" ParentId="6199" CreationDate="2019-05-21T15:23:43.227" Score="2" Body="&lt;p&gt;For a more high-level interface to coding and running variational quantum algorithms, you can also check out the &lt;a href=&quot;https://pennylane.readthedocs.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;PennyLane&lt;/a&gt; Python library, which has a &lt;a href=&quot;https://github.com/carstenblank/pennylane-qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit plugin&lt;/a&gt; available for using Qiskit simulators and IBM hardware as a backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a variational quantum algorithm in PennyLane using qiskit looks like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pennylane as qml&#xA;&#xA;dev = qml.device('qiskit.basicaer', wires=2)&#xA;# use 'qiskit.ibm' instead to run on hardware&#xA;&#xA;@qml.qnode(dev)&#xA;def circuit(x, y, z):&#xA;    qml.RX(x, wires=0)&#xA;    qml.RY(y, wires=1)&#xA;    qml.RZ(z, wires=0)&#xA;    qml.CNOT(wires=[0, 1])&#xA;    return qml.expval.PauliZ(0)&#xA;&#xA;def cost(x, y, z):&#xA;    return (1-circuit(x, y, z))**2&#xA;&#xA;# optimization follows&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use NumPy, TensorFlow, or PyTorch to do the optimization - &lt;a href=&quot;https://pennylane.readthedocs.io/en/latest/tutorials/notebooks.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;check out some of the tutorials&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I am one of the developers on PennyLane.&lt;/p&gt;&#xA;" OwnerUserId="371" LastActivityDate="2019-05-21T15:23:43.227" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6207" PostTypeId="2" ParentId="6205" CreationDate="2019-05-21T16:17:04.493" Score="4" Body="&lt;p&gt;In the paper that you refer to, they are essentially asking &quot;when can we implement the partial transpose map &lt;span class=&quot;math-container&quot;&gt;$\Theta=I_2\otimes\Lambda$&lt;/span&gt;?&quot;. So, that means the SPA of &lt;em&gt;this&lt;/em&gt; map must be positive. What you have calculated, by comparison, is to ask when the SPA of the transpose map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; can be made positive. It might sound like these ought to be the same answer, but adding identity to the transpose map and then extending the Hilbert space is different from extending the Hilbert space and adding identity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you need to be finding the value &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(1-p)(I_4\otimes \Theta)\rho+p\frac{I_4\otimes I_4}{16}&#xA;$$&lt;/span&gt;&#xA;is positive. As you did, you need to consider the maximally entangled state, but of course it's of larger dimension now. You'll find there's an eigenvalue &lt;span class=&quot;math-container&quot;&gt;$(9p-8)/16$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-05-22T07:33:37.750" LastActivityDate="2019-05-22T07:33:37.750" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6208" PostTypeId="1" CreationDate="2019-05-21T16:43:13.793" Score="4" ViewCount="333" Body="&lt;p&gt;This question is about Lemma &lt;span class=&quot;math-container&quot;&gt;$7.1.2$&lt;/span&gt; in Kaye, Laflamme, and Mosca's textbook:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\omega = \frac{x}{2^n} = 0.x_1x_2\ldots x_n$&lt;/span&gt; be some fixed number. The phase estimation algorithm applied to the input state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2^n}}\sum_{y=0}^{2^n-1}e^{2\pi i \omega y}|y\rangle$&lt;/span&gt; outputs the integer &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$$p(x) = \frac{1}{2^{2n}}\frac{\sin^2(\pi(2^n\omega-x))}{\sin^2(\pi(\omega-x/2^n))}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a mistake here? I thought that the phase estimation algorithm outputs the integer &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with 100% certainty, since that's the whole point of the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By definition, the quantum Fourier transform is the map:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{QFT}_m^{-1} : \frac{1}{\sqrt{m}}\sum_{y=0}^{m-1}e^{2\pi i \frac{x}{m} y}|y\rangle \mapsto|x\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is this not 100% successful?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6118" LastEditorUserId="26" LastEditDate="2019-06-23T13:44:25.997" LastActivityDate="2021-03-17T18:00:58.453" Title="Phase estimation error analysis" Tags="&lt;algorithm&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6209" PostTypeId="1" AcceptedAnswerId="6210" CreationDate="2019-05-21T17:06:28.427" Score="3" ViewCount="156" Body="&lt;p&gt;While reading the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm#Overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm&lt;/a&gt; Wikipedia entry, I noticed that the sentence &quot;A quantum circuit consists of simple quantum gates which act on at most a fixed number of qubits&quot;, was annotated with a &quot;why?&quot;.  &lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2019-05-21T18:03:31.597" LastActivityDate="2019-05-21T18:03:31.597" Title="Why does a quantum circuit consist of simple quantum gates which act on at most a fixed number of qubits?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6210" PostTypeId="2" ParentId="6209" CreationDate="2019-05-21T18:01:12.780" Score="5" Body="&lt;p&gt;Quantum circuits are a way to visualize a quantum operation/algorithm. As such, they are constrained by what you can reasonably express in a drawing. Simple algorithms on a small number of qubits are easy to express - for example, the ubiquitous &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation#/media/File:Quantum_teleportation_circuit.svg&quot; rel=&quot;noreferrer&quot;&gt;teleportation circuit&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Algorithms on a variable number of qubits or algorithms that mix classical processing with quantum get harder to express, and the more complicated the algorithm is, the harder it gets. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can denote a variable number of qubits by &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm#/media/File:Deutsch-Jozsa-algorithm-quantum-circuit.png&quot; rel=&quot;noreferrer&quot;&gt;crossing a wire and writing N on it&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;You can denote a loop by &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover&amp;#39;s_algorithm#/media/File:Grovers_algorithm.svg&quot; rel=&quot;noreferrer&quot;&gt;omitting some gates, replacing them with dots and specifying the number of iterations&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;You can &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;noreferrer&quot;&gt;replace both some wires and some gates with dots&lt;/a&gt;. &lt;/li&gt;&#xA;&lt;li&gt;But what do you do if the body of a loop consists of multiple gates that vary on each iteration? If there are classical controls involved? If the number of loop iterations depends on measurement results? If you want to measure a qubit and do something with it afterwards? If the algorithm takes a thousand gates, let alone a million? The circuit diagrams become rather unreadable rather fast.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is similar to &lt;a href=&quot;https://en.wikipedia.org/wiki/Flowchart&quot; rel=&quot;noreferrer&quot;&gt;flow charts&lt;/a&gt; for classical algorithms - you can use them to visualize a small algorithm, maybe for educational purposes, or a high-level structure of a big algorithm, but you just can't express the internals of, say, a web-browser as a flow chart.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-05-21T18:01:12.780" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6211" PostTypeId="1" AcceptedAnswerId="6217" CreationDate="2019-05-21T18:05:50.460" Score="2" ViewCount="228" Body="&lt;p&gt;I have a state &lt;span class=&quot;math-container&quot;&gt;$$  |\tilde{\Phi_2}\rangle =\dfrac{1}{2^{3l/2}}\sum_{x=0}^{2^l-1}\sum_{y=0}^{2^l-1}\sum_{z=0}^{2^l-1}|0\rangle^{\otimes q}\otimes |x\rangle^{\otimes l}\otimes |y\rangle^{\otimes l}\otimes |z\rangle^{\otimes l}&#xA;$$&lt;/span&gt;&#xA;Now I want to change the state &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; using the states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;. The controls originally &lt;span class=&quot;math-container&quot;&gt;$|x\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; are originally in states &lt;span class=&quot;math-container&quot;&gt;$|x_0x_1...x_{l-1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y_0x_1...y_{l-1}\rangle$&lt;/span&gt;, then if &lt;span class=&quot;math-container&quot;&gt;$$ |x_0\rangle=|y_0\rangle=|1\rangle$$&lt;/span&gt; then the state &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; has to be changed. And the state &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; is changed to &lt;span class=&quot;math-container&quot;&gt;$|00....z_{l-3}\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes q}$&lt;/span&gt; is unaltered we just operate an identity operator &lt;span class=&quot;math-container&quot;&gt;$I^{\otimes q}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next thing I understand is that we have to break the summation into two parts where in the first part the summation indexes of &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; go from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\lfloor \dfrac{2^l-1}{2}\rfloor$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But after that I am unable to write deduce further.&#xA;Can somebody help me in writing the Dirac notation for this operator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; The transformation on the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; register is the right shift by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; operator &lt;span class=&quot;math-container&quot;&gt;$|z,0\rangle \to |z, \frac{z}{4}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-25T17:00:42.030" LastActivityDate="2019-05-25T17:00:42.030" Title="Circuit construction and Dirac notation of the following operation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6212" PostTypeId="2" ParentId="6187" CreationDate="2019-05-21T22:53:15.573" Score="2" Body="&lt;p&gt;I'm not sure if you are trying to represent &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in little-endian or big-endian format, but either way the circuit does not look correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the case of &lt;span class=&quot;math-container&quot;&gt;$x = 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y = 2$&lt;/span&gt;: they are conveniently represented the same way in LE and BE formats, as &lt;span class=&quot;math-container&quot;&gt;$010$&lt;/span&gt;, so the encoding will only matter when reading out the answer.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You start with &lt;span class=&quot;math-container&quot;&gt;$|010\ 010\ 0\rangle$&lt;/span&gt; (writing the states of the qubits in top-to-bottom order). &lt;/li&gt;&#xA;&lt;li&gt;After the first 3 gates you'll get &lt;span class=&quot;math-container&quot;&gt;$|010\ 010\ 1\rangle$&lt;/span&gt; - indeed, OR of these wires is 1.&lt;/li&gt;&#xA;&lt;li&gt;The next three gates are controlled on the first qubit, which is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, so we can ignore them: still &lt;span class=&quot;math-container&quot;&gt;$|010\ 010\ 1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The second-to-last CNOT is executed: &lt;span class=&quot;math-container&quot;&gt;$|010\ 000\ 1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The last CNOT has no effect again, so the final answer is &lt;span class=&quot;math-container&quot;&gt;$000$&lt;/span&gt; - no matter whether you read it as little-endian or big-endian, it yields an incorrect sum of 0.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I believe this circuit doesn't handle the second carry bit properly.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For reference, here is the Q# code I wrote to test this circuit and find a test case for which it fails (you mentioned in the chat that you tried Quantum Development Kit, so this might be helpful):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Allocate x, y and auxiliary qubits&#xA;using ((x, y, a) = (Qubit[3], Qubit[3], Qubit())) {&#xA;    for (xint in 0..7) {&#xA;        for (yint in 0..7) {&#xA;            // x and y qubits start in |0⟩ state; set them to their starting values - in little-endian&#xA;            ApplyPauliFromBitString(PauliX, true, IntAsBoolArray(xint, 3), x);&#xA;            ApplyPauliFromBitString(PauliX, true, IntAsBoolArray(yint, 3), y);&#xA;&#xA;            // Calculate x + y mod 8 using the circuit&#xA;            // (assume the wires top to bottom are x0, x1, x2, y0, y1, y2, a)&#xA;            CCNOT(x[1], y[1], a);&#xA;            CNOT(x[1], a);&#xA;            CNOT(y[1], a);&#xA;            Controlled X([x[0], y[0], a], y[2]);&#xA;            CCNOT(x[0], y[0], y[1]);&#xA;            CNOT(x[0], y[0]);&#xA;            CNOT(x[1], y[1]);&#xA;            CNOT(x[2], y[2]);&#xA;&#xA;            // Read out the result from y register (still as LE)&#xA;            let sum = MeasureInteger(LittleEndian(y));&#xA;            if (sum != (xint + yint) % 8) {&#xA;                Message($&quot;Incorrect sum for x = {xint}, y = {yint}: sum = {sum}&quot;);&#xA;            }&#xA;&#xA;            // Reset all qubits before next iteration&#xA;            ResetAll(x);&#xA;            ResetAll(y);&#xA;            Reset(a);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can switch it to using big-endian by wrapping &lt;code&gt;IntAsBoolArray&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; register in measurement line in &lt;code&gt;Reverse&lt;/code&gt; function to reverse the order of qubits.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a side note, Q# has a library implementation of an adder, you can look it up &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/master/Standard/src/Arithmetic/Integer.qs#L355&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-05-21T23:08:48.013" LastActivityDate="2019-05-21T23:08:48.013" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6213" PostTypeId="1" CreationDate="2019-05-22T01:11:14.637" Score="5" ViewCount="474" Body="&lt;p&gt;I am trying to transform this matrix into a combination of quantum gates but I cannot find any such functionality on Qiskit or anywhere else. I have tried to use Quirk but I do not understand it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\1 &amp;amp; 0&amp;amp;0&amp;amp;0\\0 &amp;amp; 0&amp;amp;0&amp;amp;1\\0 &amp;amp; 0&amp;amp;1&amp;amp;0\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7558" LastEditorUserId="26" LastEditDate="2019-05-25T16:56:37.900" LastActivityDate="2019-05-26T14:54:46.040" Title="Transform matrix into a combination of simple quantum gates" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6214" PostTypeId="2" ParentId="6213" CreationDate="2019-05-22T02:08:06.943" Score="3" Body="&lt;p&gt;This matrix is a tensor product of two simpler matrices, &lt;span class=&quot;math-container&quot;&gt;$I \otimes X$&lt;/span&gt;, which you represent by applying an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the second qubit and doing nothing with the first one.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-05-22T02:08:06.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6215" PostTypeId="2" ParentId="6213" CreationDate="2019-05-22T02:43:45.217" Score="5" Body="&lt;p&gt;&lt;strong&gt;Math:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are familiar with tensor products, observe that &lt;span class=&quot;math-container&quot;&gt;$I \otimes X$&lt;/span&gt; gives the desired matrix. Showing the steps of this computation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I \otimes X = \begin{pmatrix}1 &amp;amp;0\\0 &amp;amp; 1 \end{pmatrix} \otimes \begin{pmatrix}0 &amp;amp;1\\1 &amp;amp; 0 \end{pmatrix} = \begin{pmatrix}1\begin{pmatrix}0 &amp;amp;1\\1 &amp;amp; 0 \end{pmatrix} &amp;amp; 0 \begin{pmatrix}0 &amp;amp;1\\1 &amp;amp; 0 \end{pmatrix} \\0\begin{pmatrix}0 &amp;amp;1\\1 &amp;amp; 0 \end{pmatrix} &amp;amp; 1\begin{pmatrix}0 &amp;amp;1\\1 &amp;amp; 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain the corresponding circuit, note that this tensor represents two gates applied at the same circuit depth on two qubits. That is, you would have an identity gate applied to the top qubit (equivalently, not applying any gate), and you would have the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate applied on the bottom qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shown as a circuit diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GDv4D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GDv4D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Qiskit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the following import, you can decompose a two qubit gate to a sequence of single qubit gates, as long as the input gate does not create entanglement. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info.synthesis import TwoQubitBasisDecomposer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can find the code for this file here: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/quantum_info/synthesis/two_qubit_decompose.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/quantum_info/synthesis/two_qubit_decompose.py&lt;/a&gt; (qiskit-terra/qiskit/quantum_info/synthesis/two_qubit_decompose.py).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as input to the gate decomposer, you need to create a 2-qubit gate corresponding to the matrix given. I am not sure how to do so, and will update my answer when I find out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further note that at the current time, n-qubit gate decomposition is not supported; you can only decompose 2-qubit gates.&lt;/p&gt;&#xA;" OwnerUserId="5157" LastEditorUserId="5157" LastEditDate="2019-05-26T14:54:46.040" LastActivityDate="2019-05-26T14:54:46.040" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6217" PostTypeId="2" ParentId="6211" CreationDate="2019-05-22T06:51:53.267" Score="6" Body="&lt;p&gt;As you say, any register on which you do nothing, use the identity, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. This is also going to be the case on &lt;span class=&quot;math-container&quot;&gt;$x_1,x_2,\ldots$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_1,y_2,\ldots$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you want to control something, use the projectors &lt;span class=&quot;math-container&quot;&gt;$P_0=|0\rangle\langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1=|1\rangle\langle 1|$&lt;/span&gt;. So, controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; looks like &lt;span class=&quot;math-container&quot;&gt;$P_0\otimes I+P_1\otimes U$&lt;/span&gt;. For controlled-controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you can make this notation a bit more concise:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I\otimes I\otimes I+P_1\otimes P_1\otimes(U-I).&#xA;$$&lt;/span&gt;&#xA;This is essentially what you're going to be doing for your operation, where the two controls are &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the next question is what the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; looks like for transforming the register &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. If I understand correctly, you basically want to introduce an additional register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes(l-2)}$&lt;/span&gt; and to perform the joint transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|z_0z_1z_2\ldots z_{l-1}\rangle|0\rangle^{\otimes(l-2)}\rightarrow|z_0z_1z_2\ldots z_{l-1}\rangle|z_0z_1z_2\ldots z_{l-3}\rangle&#xA;$$&lt;/span&gt;&#xA;This is achieved in a straightforward manner. Let &lt;span class=&quot;math-container&quot;&gt;$C_i$&lt;/span&gt; denote the controlled-not gate controlled off qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of the first register, and targetting qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; on the second register (and identity on everything else). Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\prod_{i=0}^{l-3}C_i.&#xA;$$&lt;/span&gt;&#xA;I remain unclear if that target register is supposed to be the one that starts &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes q}$&lt;/span&gt;, or not. I'm assuming not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, you would thus be left with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\prod_{i=0}^{l-3}I^{\otimes q}\otimes(I^{\otimes (4l-2)}+P_1\otimes I^{\otimes(l-1)}\otimes P_1\otimes I^{\otimes(l+i-1)}\otimes P_1\otimes I^{\otimes (l-1)}\otimes(X-I)\otimes I^{\otimes(l-3-i)}).&#xA;$$&lt;/span&gt;&#xA;Note, the first two &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;s are the controls off &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_0$&lt;/span&gt;. The third is the control off &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt;, and the &lt;span class=&quot;math-container&quot;&gt;$(X-I)$&lt;/span&gt; term should be acting on the target, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of the extra register.&#xA;Now you can express each of these operators in Dirac notation if you really want to.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-05-23T07:57:46.717" LastActivityDate="2019-05-23T07:57:46.717" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6218" PostTypeId="2" ParentId="6201" CreationDate="2019-05-22T14:09:27.137" Score="6" Body="&lt;p&gt;This doesn't really answer the question as it's not an &lt;em&gt;online&lt;/em&gt; simulator. It might still be relevant though as it is a way to produce this sort of gifs if one has access to the software.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is relatively easy to do this sort of things using Wolfram Mathematica.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a quick and dirty example, if we just define a couple of relevant helper functions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pauliX = PauliMatrix[1];&#xA;pauliY = PauliMatrix[2];&#xA;pauliZ = PauliMatrix[3];&#xA;ClearAll@decomposeInPauliBasis;&#xA;decomposeInPauliBasis[matrix_?MatrixQ] := {&#xA;    Tr[matrix.pauliX], Tr[matrix.pauliY], Tr[matrix.pauliZ]&#xA;    }/2;&#xA;decomposeInPauliBasis[vec_?VectorQ] := Re@{&#xA;    Dot[Conjugate@vec, pauliX, vec], Dot[Conjugate@vec, pauliY, vec], &#xA;    Dot[Conjugate@vec, pauliZ, vec]&#xA;    };&#xA;ClearAll[simulateStateEvolution, smallestEigenvectors];&#xA;smallestEigenvectors[matrix_, howmany_Integer] := With[&#xA;   {nn = Norm@Flatten@matrix},&#xA;   Eigenvalues[matrix - nn IdentityMatrix[Dimensions@matrix], &#xA;     howmany] + nn&#xA;   ];&#xA;simulateStateEvolution[H : (_Symbol | _Function | _CompiledFunction), &#xA;   time_: 1., initialState_: None] := Module[{t},&#xA;   Module[{\[DiamondSuit]initialState, \[DiamondSuit]H},&#xA;    If[initialState === None,&#xA;     \[DiamondSuit]initialState = &#xA;      First@smallestEigenvectors[H[0], 1],&#xA;     \[DiamondSuit]initialState = initialState&#xA;     ];&#xA;    (* protect from symbolic evaluation *)&#xA;    \[DiamondSuit]H[&#xA;      t_?NumericQ] := H[t];&#xA;    NDSolveValue[{&#xA;       \[Psi][0] == \[DiamondSuit]initialState,&#xA;       \[Psi]'[t] == -I \[DiamondSuit]H[t].\[Psi][t]&#xA;       }, \[Psi], {t, 0, time}&#xA;      ][time]&#xA;    ]&#xA;   ];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;we can then visualise the evolution in the Bloch sphere with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hamiltonian[t_] := pauliZ + 2 pauliX;&#xA;initialState = {1, 0};&#xA;With[{points = Table[&#xA;    decomposeInPauliBasis@&#xA;     simulateStateEvolution[hamiltonian, t, initialState],&#xA;    {t, 0, 1, 0.01}&#xA;    ]},&#xA; Graphics3D[{&#xA;   {Orange, Opacity@0.2, Sphere[{0, 0, 0}, 1]},&#xA;   {Red, PointSize@0.02, Point@points[[1]]},&#xA;   {Blue, PointSize@0.02, Point@points[[-1]]},&#xA;   Dashed, Thickness@0.005, Arrow@points&#xA;   }, Axes -&amp;gt; True, AxesOrigin -&amp;gt; {0, 0, 0}, AxesStyle -&amp;gt; Black, &#xA;  Ticks -&amp;gt; None, Boxed -&amp;gt; False]&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b80mU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b80mU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can also use a time-dependent Hamiltonian, for example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hamiltonian[t_] := pauliZ + t pauliX;&#xA;initialState = {1, 0};&#xA;With[{points = Table[&#xA;    decomposeInPauliBasis@&#xA;     simulateStateEvolution[hamiltonian, t, initialState],&#xA;    {t, 0, 4, 0.01}&#xA;    ]},&#xA; Graphics3D[{&#xA;   {Orange, Opacity@0.2, Sphere[{0, 0, 0}, 1]},&#xA;   {Red, PointSize@0.02, Point@points[[1]]},&#xA;   {Blue, PointSize@0.02, Point@points[[-1]]},&#xA;   Dashed, Thickness@0.005, Arrow@points&#xA;   }, Axes -&amp;gt; True, AxesOrigin -&amp;gt; {0, 0, 0}, AxesStyle -&amp;gt; Black, &#xA;  Ticks -&amp;gt; None, Boxed -&amp;gt; False]&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mYOAt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mYOAt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want something a bit more fancy, you can take the code I used in &lt;a href=&quot;https://mathematica.stackexchange.com/a/125986/27539&quot;&gt;this answer&lt;/a&gt; to draw a better looking Bloch sphere, which would give something like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b2tGm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b2tGm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, if you want some animation, you can try something like the following (where I'm also adding the green line to denote the instantaneous eigenvector of the Hamiltonian):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hamiltonian[t_] := pauliZ + t pauliX;&#xA;initialState = {1, 0};&#xA;timesList = Range[0, 4, 0.01];&#xA;With[{points = Table[&#xA;    decomposeInPauliBasis@&#xA;     simulateStateEvolution[hamiltonian, t, initialState],&#xA;    {t, timesList}&#xA;    ]},&#xA; Animate[&#xA;  Graphics3D[{&#xA;    {Orange, Opacity@0.2, Sphere[{0, 0, 0}, 1]},&#xA;    {Red, PointSize@0.02, Point@points[[1]]},&#xA;    {Purple, PointSize@0.02, Point@points[[idx]]},&#xA;    {Darker@Green, Thickness@0.01, &#xA;     InfiniteLine@{-#, #} &amp;amp;@&#xA;      decomposeInPauliBasis@&#xA;       First@Eigenvectors@hamiltonian@timesList[[idx]]},&#xA;    {Dashed, Thickness@0.005, Tube@points[[;; idx]]}&#xA;    }, Axes -&amp;gt; True, AxesOrigin -&amp;gt; {0, 0, 0}, AxesStyle -&amp;gt; Black, &#xA;   Ticks -&amp;gt; None, Boxed -&amp;gt; False],&#xA;  {idx, 1, Length@points, 1}&#xA;  ]&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k5CsK.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k5CsK.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(quality and smoothness can definitely be improved here)&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-05-23T14:08:44.833" LastActivityDate="2019-05-23T14:08:44.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6219" PostTypeId="1" AcceptedAnswerId="6223" CreationDate="2019-05-23T00:13:09.367" Score="5" ViewCount="398" Body="&lt;p&gt;Proposed experiments in achieving quantum supremacy, such as with BosonSampling or using random circuits, have been described as using a (not necessarily Turing complete) quantum computer to perform some &lt;strong&gt;sampling&lt;/strong&gt; problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example would be to sample the distribution of, say, &lt;span class=&quot;math-container&quot;&gt;$72$&lt;/span&gt; qubits after application of, say, &lt;span class=&quot;math-container&quot;&gt;$1000$&lt;/span&gt; random &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting from the all-zeroes ket &lt;span class=&quot;math-container&quot;&gt;$\vert 000\cdots\rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, a quantum computer would randomly draw from the output distribution after the application of some reasonably-sized unitary &lt;span class=&quot;math-container&quot;&gt;$U\vert 000\cdots\rangle$&lt;/span&gt; (of, say, &lt;span class=&quot;math-container&quot;&gt;$m=O(n^2)$&lt;/span&gt; gates).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classically it is very unlikely that one could draw from the same distribution.  It may take time &lt;span class=&quot;math-container&quot;&gt;$O(\exp(m\times n))$&lt;/span&gt; to draw from this distribution &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because such sampling problems are not likely to be in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{NP}$&lt;/span&gt;, approaches to validation of quantum supremacy experiments are being researched.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The HOG problem - heavy output generation - has been proposed as a test to validate quantum supremacy.  Apparently the HOG test can be performed in time &lt;span class=&quot;math-container&quot;&gt;$O(\exp(n))$&lt;/span&gt;, which is much better than &lt;span class=&quot;math-container&quot;&gt;$O(\exp(m))$&lt;/span&gt;, and may be feasible for supercomputers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what, exactly, is this test?  After a random unitary acts on the all-zeroes ket, the coefficients should be pointing in all different ways asunder - like a Brownian walk.  The vast majority of outputs should have a low probability of occurrence, and would never be sampled (even if there are a large number of bases having a low probability &lt;span class=&quot;math-container&quot;&gt;$p_\epsilon$&lt;/span&gt; of occurrence, if &lt;span class=&quot;math-container&quot;&gt;$p_\epsilon$&lt;/span&gt; is small enough then no .)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How does the HOG test work?  Is my understanding close to correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some links on the characterization of sampling problems:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aaronson - &quot;Aspects of Certified Randomness from Quantum Supremacy&quot; &lt;a href=&quot;https://www.scottaaronson.com/talks/certrand2.ppt&quot; rel=&quot;nofollow noreferrer&quot;&gt;Powerpoint&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bouland, Fefferman, Nirkhe, Vazirani - &quot;Quantum Supremacy and the Complexity of Random Circuit Sampling&quot; - &lt;a href=&quot;https://arxiv.org/abs/1803.04402&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-06-27T01:16:36.703" LastActivityDate="2019-06-27T01:16:36.703" Title="What is the HOG test and how would it help proving quantum supremacy?" Tags="&lt;mathematics&gt;&lt;quantum-advantage&gt;&lt;boson-sampling&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6220" PostTypeId="2" ParentId="6208" CreationDate="2019-05-23T14:42:37.320" Score="1" Body="&lt;p&gt;&lt;strong&gt;First point&lt;/strong&gt;: in most of the cases, the QPE algorithm &lt;strong&gt;cannot&lt;/strong&gt; output the integer &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. That is why &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; is introduced in the algorithm: to represent the closest approximation of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that can be returned by the QPE.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About your question, no &lt;strong&gt;the QPE is not always 100% successful&lt;/strong&gt; (in this case successful means that the algorithm returns &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, the closest approximation of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; possible on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final state of the QPE before measurement is given by (according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm#Phase_approximation_representation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2^{n}} \sum_{x=0}^{2^n - 1}  \sum_{k=0}^{2^n - 1} e^{-\frac{2\pi i k}{2^n} \left ( x-w \right )} e^{2 \pi i \delta k}  |x\rangle \otimes |\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;where:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; are defined as in your question.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\delta = \left\vert \frac{x}{2^n} - w \right\vert = \left\vert \frac{x}{2^n} - \text{round}\left(\frac{x}{2^n}\right) \right\vert$&lt;/span&gt; is the error due to the finite representation of &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I will not rewrite all the calculations, but you can check on the intermediate results on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm#The_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of getting the right result &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; when measuring is then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Pr(w) = \left | \left \langle w \underbrace{\left | \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-w)} e^{2 \pi i \delta k} \right |}_{\text{State of the first register}} x \right \rangle \right |^2 = \frac{1}{2^{2n}} \left | \sum_{k=0}^{2^n-1} e^{2 \pi i \delta k} \right |^2 = \begin{cases}1  &amp;amp; \delta = 0\\ &amp;amp; \\ \frac{1}{2^{2n}} \left | \frac{1- {e^{2 \pi i 2^n \delta}}}{1-{e^{2 \pi i \delta}}} \right|^2 &amp;amp; \delta \neq 0 \end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if the result &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; can be represented exactly on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (i.e. &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;, the error, is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;), the QPE succeed with a probability of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;but if &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits are not enough to represent exactly &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, the QPE might fail.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I tried quickly to derive the expression of your book from the one found on Wikipedia, without success &lt;strong&gt;but&lt;/strong&gt; when the error &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; tends to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, both formulas have the same behaviour: the probability of error is &lt;span class=&quot;math-container&quot;&gt;$ \sim \mathcal{O}\left( \frac{1}{2^{2n} \delta^2} \right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can simplify further this big-&lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}$&lt;/span&gt; notation by noticing that, by construction, &lt;span class=&quot;math-container&quot;&gt;$\delta \leqslant \frac{1}{2^{n+1}}$&lt;/span&gt;. The final probability of error is then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Pr(\text{measurement not returning } \vert w \rangle) \sim \mathcal{O}\left( \frac{1}{2^{4n+1}} \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that, when you increase the number of qubits &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; used to represent the solution by &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, the probability of the QPE returning a bad result is divided by &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt;&lt;sup&gt;[1]&lt;/sup&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[1]&lt;/sup&gt;: There are constants ignored by the big-&lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}$&lt;/span&gt; notation that change this value of &lt;span class=&quot;math-container&quot;&gt;$16 = 2^4$&lt;/span&gt; to something like &lt;span class=&quot;math-container&quot;&gt;$\frac{2^5}{\pi^2} = \frac{32}{\pi^2}$&lt;/span&gt;. The additional factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; in the previous constant is needed to bound the expression &lt;span class=&quot;math-container&quot;&gt;$\left\vert 1- {e^{2 \pi i 2^n \delta}} \right\vert$&lt;/span&gt; found for &lt;span class=&quot;math-container&quot;&gt;$\Pr(w)$&lt;/span&gt; above but is not needed for the expression given in your book. &lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-05-23T14:42:37.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6221" PostTypeId="2" ParentId="6157" CreationDate="2019-05-23T15:53:04.650" Score="22" Body="&lt;p&gt;Computations in quantum information processing are implemented by means of unitary operations. Sometimes, we need to think not about a specific unitary operation required to execute a specific computation, but about the whole space of unitary transformations.  (Examples will be given below). For a single &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional qudit, (which can also be a tensor product of a number of qubits), this space is the unitary group &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; is a compact Lie group; all the matrix element magnitudes of its elements are less or equal to one, thus it can be mapped into a hypersurface occupying finite region in some Euclidean space, given by the orthonormality constraints of its raw vectors. In particular, this implies that its Euclidean volume is finite. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Spaces of finite volume can be naturally turned into probability spaces, basically by normalizing their volume to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. This is the starting point where they become useful in probabilistic analysis, in our case in quantum probability. Probability spaces are equipped with a measure assigning a number between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to subsets, which in the continuous cases, can be taken as the normalized volume of the subset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the group &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;, the normalized Euclidean volume element mentioned above is such a measure. This measure is not invariant, in general, under the group action. The normalized volume of a subset changes if we rotate the subset by means of a group element &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;. However, if we define a new measure by averaging the volumes obtained by rotating the subset by all group elements, the resulting averaged measure will be invariant under the group action. This is the Haar measure.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method described above for the construction of the Haar measure is not practical, since we need to average over an infinite number of elements. More practical methods will be described below. A non-rigorous but reasoned account of the Haar measure of the unitary group U(n), in view of quantum information theory applications, will be given. The sketchy reasoning presented here can be used as a starting  point for a more rigorous treatment. The explanations will refer specifically to the unitary group. Their quite straightforward generalized to other classical compact groups, will not be treated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Properties of the Haar measure&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The (volume element of the) Haar measure will be denoted by  &lt;span class=&quot;math-container&quot;&gt;$d\mu_H(u)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$u\in U(n)$&lt;/span&gt;. The Haar measure has the following properties:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It has a finite volume&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\int_{U(n)} d\mu_H(u) &amp;lt; \infty$$&lt;/span&gt;&#xA;2.  It is (right and left) invariant under the group action: Given an integrable function &lt;span class=&quot;math-container&quot;&gt;$f(u)$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(vu) d\mu_H(u) = \int_{U(n)} f(u) d\mu_H(u) , \quad v\in U(n) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(uv) d\mu_H(u) = \int_{U(n)} f(u) d\mu_H(u) , \quad v\in U(n) $$&lt;/span&gt;&#xA;3.  It is unique up to a multiplication by a scalar: Any another invariant measure &lt;span class=&quot;math-container&quot;&gt;$d\mu(u)$&lt;/span&gt; satisfies:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ d\mu(u) = \mathrm{const.} d\mu_H(u) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;, these properties can be proved by the explicit constructions which will be described below; however, it is worthwhile to show an explicit method to modify any non-invariant measure into a Haar measure, for example the Euclidean measure mentioned above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; is a manifold, it can be covered by coordinate patches in bijection with open subsets in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(n) \supset U\ni u \mapsto x(u) \in \mathbb{R}^n$$&lt;/span&gt; &#xA;In order to change the Euclidean volume element &lt;span class=&quot;math-container&quot;&gt;$d^nx$&lt;/span&gt; into a Haar measure, we need to evaluate the action of a general group element &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; on an element &lt;span class=&quot;math-container&quot;&gt;$u_{\epsilon} = 1 + \epsilon$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\epsilon|&amp;lt;&amp;lt;1$&lt;/span&gt; close to the identity; we get,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x(u u_{\epsilon } )= B(x(u)) + A(x(u))x(u_{\epsilon}) + O(|\epsilon|^2), B(u) \in \mathbb{R}^n , A(u )\in \text{Mat}(n)$$&lt;/span&gt;&#xA;Then the measure:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ d\mu(u(x)) = |\det A(x)|^{-1} d^nx$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a Haar measure. The proof is not a very difficult exercise, please see the following &lt;a href=&quot;https://math.stackexchange.com/questions/172246/a-haar-measure-via-the-lebesgue-measure-on-bbb-rd?noredirect=1&amp;amp;lq=1&quot;&gt;post &lt;/a&gt; in mathematics stackexchange for the details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A similar construction is based on the fact that the Haar measure can be induced by a metric - The Cartan-Killing metric. If we take the other side of the bijection above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbb{R}^n \ni x \mapsto u(x) \in U \subset U(n) $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The metric:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G_{ij}(x) = \mathrm{Tr}\left (\frac{\partial u(x) ^{-1}}{\partial x^i}  \frac{\partial u(x) }{\partial x^j} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Induces a Haar measure, through:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ d\mu_H(u(x)) = \sqrt{\det G(x)} d^nx$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The existence of this metric allows to define a Dirac delta function by means of the solutions of the time independent Schrödinger equation on U(n).&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Delta \psi = E \psi$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; is the Laplacian on &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Delta = \frac{1}{\sqrt{\det G(x)}} \sum_{i, j} \frac{\partial}{\partial x^i}\left(  \sqrt{\det G(x)} G^{ij} \frac{\partial}{\partial x^j}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;span class=&quot;math-container&quot;&gt;$G^{ij}$&lt;/span&gt; is the reciprocal matrix of &lt;span class=&quot;math-container&quot;&gt;$G_{ij}$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\{f_E(u)\}$&lt;/span&gt;, be an orthonormal set (with respect to the Haar measure) of solutions of the Schrödinger equation for all possible energies (I am skipping the issue of the existence of solutions), then due to the completeness property, the function:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\delta_H(u, v) = \sum_E \bar{f_E}(u) f_E(v)$$&lt;/span&gt;&#xA;is an invariant Dirac delta function over the square integrable functions, satisfying the properties:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\delta_H(u, v) = \delta_H(kg, kh)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} \delta_H(u, v) d\mu_H(u) = 1$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(u) \delta_H(u, v) d\mu_H(u) = f(v) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The delta function can be used to sketch the proof of the Haar measure uniqueness up to a factor. Suppose that there exists a second invariant measure &lt;span class=&quot;math-container&quot;&gt;$d\mu(u)$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;.&#xA;Denote by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle f \rangle_{\mu} = \int_{U(n)} f(u) d\mu_H(u) $$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle f \rangle = \int_{U(n)} f(u) d\mu(u) $$&lt;/span&gt;&#xA;Then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} \int_{U(n)} f(u) \delta_H(u, v) d\mu_H(u) d\mu(v) = &amp;lt;f&amp;gt; $$&lt;/span&gt;&#xA;Changing the integration order (Fubini's theorem):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(u)  \left (\int_{U(n)} \delta_H(u, v) d\mu(v) \right) d\mu_H(u) = &amp;lt;f&amp;gt; $$&lt;/span&gt;&#xA;Using the invariance property of the delta function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(u)  \left (\int_{U(n)} \delta_H(e, u^{-1}v) d\mu(v) \right) d\mu_H(u) = &amp;lt;f&amp;gt; $$&lt;/span&gt; &#xA;Using the invariance property of the measure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(u)  \left (\int_{U(n)} \delta_H(e, v) d\mu(v) \right) d\mu_H(u) = &amp;lt;f&amp;gt; $$&lt;/span&gt;&#xA;Thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (\int_{U(n)} \delta_H(e, v) d\mu(v) ) \int_{U(n)} f(u)  d\mu_H(u) = &amp;lt;f&amp;gt; $$&lt;/span&gt;&#xA;Therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{const.} &amp;lt;f&amp;gt;_{\mu} = &amp;lt;f&amp;gt; $$&lt;/span&gt;&#xA;(To be precise, in the above, we assumed that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is both &lt;span class=&quot;math-container&quot;&gt;$L^1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L^2$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some explicit constructions&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The explicit construction of the Haar measure in coordinates requires the parametrization of U(n), one possibility is by means of Euler angles, please see for example the following &lt;a href=&quot;https://arxiv.org/abs/math-ph/0210057&quot; rel=&quot;noreferrer&quot;&gt;article&lt;/a&gt; by Tilma and Sudarshan. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The normalization of the Haar measure to a unit volume, requires the computation of its volume for the purpose of normalization, please see the review  &lt;a href=&quot;https://arxiv.org/abs/1509.00537v3&quot; rel=&quot;noreferrer&quot;&gt;Zhang &lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/math-ph/0210033&quot; rel=&quot;noreferrer&quot;&gt;Boya, Sudarshan and Tilma&lt;/a&gt; for computation techniques which do not require explicit parametrizations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to give a taste of how these computations are performed, I'll describe how the volume of &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; can be computed a product of volumes of spheres:&#xA;The first row in the matrix representing a group element &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is a normalized &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensional complex vector, thus it spans a sphere &lt;span class=&quot;math-container&quot;&gt;$S^{2n-1}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; spans the whole unitary group. The second row is also a normalized &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensional complex vector, but it must be orthogonal to the first one, thus it lives in an &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; dimensional space, thus it spans a sphere &lt;span class=&quot;math-container&quot;&gt;$S^{2n-3}$&lt;/span&gt;, the third should be orthogonal tom the first two thus it spans a sphere &lt;span class=&quot;math-container&quot;&gt;$S^{2n-5}$&lt;/span&gt;,  etc. Thus, the Haar volume of &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Vol}(U(n)) = \text{Vol}(S^{2n-1}) \text{Vol}(S^{2n-3})…\text{Vol}(S^1) $$&lt;/span&gt;&#xA;Using the &lt;a href=&quot;https://en.wikipedia.org/wiki/N-sphere&quot; rel=&quot;noreferrer&quot;&gt;volume formula&lt;/a&gt; of the n-sphere: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Vol}(S^{2n-1}) = \frac{2 \pi^n}{\Gamma(n)},$$&lt;/span&gt;&#xA;the &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; volume is obtained:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Vol}(U(n)) = \frac{(2 \pi)^{n^2+n}}{\prod_{m=1}^{n-1} m!}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These constructions have already applications to quantum information theory: Tilma and Sudarshan apply their results to the computation of the volumes of unitary orbits of density matrices, while Zhang reviews the computation of the Hilbert-Schmidt volume of the space of density matrices.&#xA;It should be mentioned that the integration of class functions i.e. functions which are invariant under the conjugation map:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(u) = f(v^{-1}uv),$$&lt;/span&gt;&#xA;over the unitary group &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; can be simplified to an integration over its maximal torus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_{U(n)} f(u)  d\mu_H(u) = \frac{1}{n!}\int_{T_n} f(t)  V(t)^2 dt$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$t = [t_1, t_2, …, t_n]^T$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and the integration is over the maximal torus &lt;span class=&quot;math-container&quot;&gt;$U(1)^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V(t)$&lt;/span&gt; is the Vandermonde determinant (the determinant of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Vandermonde_matrix&quot; rel=&quot;noreferrer&quot;&gt;Vandermonde matrix&lt;/a&gt;). This is the Weyl integration formula, please see the following &lt;a href=&quot;http://www.math.uwaterloo.ca/~nspronk/math763/WeylIntegral.pdf&quot; rel=&quot;noreferrer&quot;&gt;lecture note&lt;/a&gt; by: Nico Sprong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Measures induced from the Haar measure&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Homogeneous spaces of the unitary group possess measures induced from the Haar measure. One of the most important of such spaces in quantum information theory is the complex projective space: &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^n =  \frac{U(n+1)}{U(n)}$&lt;/span&gt; which is the space of pure states in &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; dimensions.  The induced measure on the space of pure states is called the Fubini-Study measure, please see &lt;a href=&quot;https://pdfs.semanticscholar.org/3f28/893b7e8c5c96525493db8e3d6b09ab47f426.pdf&quot; rel=&quot;noreferrer&quot;&gt;Bengtsson and Życzkowski&lt;/a&gt;  section 4.7. Sometimes the induced measure is also called a Haar measure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; dimensional state vector can be obtained by the application of a unitary matrix on some fixed vector. Thus, in order to construct a &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^n$&lt;/span&gt;-random pure state vector, we can apply a random &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; matrix drawn from a Haar distributed ensemble.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For mixed states, unitary orbits of density matrices are generalized flag manifolds. These spaces are also homogeneous spaces, therefore equipped with measures induced by the Haar measure. The five-dimensional case is explicitly elaborated also in &lt;a href=&quot;https://arxiv.org/abs/math-ph/0210033&quot; rel=&quot;noreferrer&quot;&gt;Boya, Sudarshan and Tilma&lt;/a&gt; in section 7.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Some applications in quantum information&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Identification of unknown quantum channels&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;As discussed above, the generation of a Haar-random state vector can be obtained by acting on a fixed vector by a Haar distributed unitary matrix. Please see the following  &lt;a href=&quot;https://arxiv.org/abs/math-ph/0609050v2&quot; rel=&quot;noreferrer&quot;&gt;article &lt;/a&gt; by Francesco Mezzadri describing the random matrix generation algorithm. Randomly generated state vectors can be used to identify or at least gain information about unknown quantum channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give a motivation of this approach, let's consider first a classical channel modeled as a damped harmonic oscillator:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$m \ddot{x} + c \dot{x} + kx = F(t)$$&lt;/span&gt;&#xA;And we want to estimate the channel parameters &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. If we knew in advance that our channel is a damped harmonic oscillator we could subject it to two sinusoidal inputs with different frequencies and extract the coefficients from its frequency response. But if we no a-priori idea what the channel dynamics is (except that it is linear), we can use a white noise random signal to identify its spectral density function:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle |x(\omega)|^2 \rangle = \frac{\frac{1}{m^2}}{(\omega^2-\frac{k}{m})^2 + (\frac{c \omega}{m})^2}$$&lt;/span&gt;&#xA;The analysis of the spectral density response can be used to identify all the system degree and all of its model coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the quantum case, by analogy we place random state vectors at the input and measure the outer state.  We can gain information about the channel. Please see the following thesis by &lt;a href=&quot;https://uwspace.uwaterloo.ca/bitstream/handle/10012/3828/uw-ethesis.pdf?sequence=1&quot; rel=&quot;noreferrer&quot;&gt;Easwar Magesan&lt;/a&gt;. For example, given a channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, approximating a unitary channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt;,  then the fidelity of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, with respect to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt;, is given by (Equation 2.12 in the thesis).&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\mathcal{E} , \mathcal{U} ) =  \int_{\psi} d\psi \mathrm{tr} \left( \mathcal{U} (|\psi\rangle\langle\psi|)\mathcal{E} (|\psi\rangle\langle\psi|)\right)$$&lt;/span&gt;&#xA;Where the integration is over the Fubini-Study measure. The quantum case is much more difficult than the classical one: Experimentally, on needs to input the channel with randomly generated vectors as described above; each time, perform a full tomography of the output state a perform the averaging with the ideal channel output. Both the generation of the random inputs and the full tomography are hard. One can reduce the complexity by cleverly selecting a specific set of random vectors called a design capable of estimating well behaved classes of channels; and averaging the channel over a group of unitarities called twirling which allows extracting partial information in a scalable way.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Quasi-probability functions on the group manifold.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In the above applications, the group manifold is utilized as a classical probability space. But in fact, we can encode the full quantum information in functions over the &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; group manifold. This can be done by transforming the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; into a function &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; of positive type over the group manifold (which is a generalization of the Wigner function on the phase space): &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\chi(u) = \mathrm{Tr}(\rho u), \quad u \in U(n)$$&lt;/span&gt;&#xA;Please see &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1742-6596/670/1/012004/pdf&quot; rel=&quot;noreferrer&quot;&gt;Anillo&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This function has the following properties stemming from the density matrix properties:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Normalization&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\chi(e) =1$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Symmetry&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\bar{\chi}(u) =\chi(u^{-1})$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Positive definiteness (Bochner's theorem}&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{j,k } \chi(g_j^{-1}g_k) \ge 0$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For any set of group elements {g_1, g_2, …, g_n}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The function &lt;span class=&quot;math-container&quot;&gt;$\chi(u)$&lt;/span&gt; can be regarded as a generalized Fourier transform of the density matrix or a characteristic function. Several types of quantum channels can be implemented on the group manifold, for example if we multiply two different functions &lt;span class=&quot;math-container&quot;&gt;$\chi(u)$&lt;/span&gt; of positive type, we get a function of positive type because the Hadamard product of two positive definite matrices is also a function of positive type, thus the multiplication implements a quantum channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A second use of this representation is to find the probability density function of a set of commuting observables (since a set of commuting observables can be characterized by a classical probability density function), which can be computed as an inverse Fourier transform:&#xA;Defining&#xA;&lt;span class=&quot;math-container&quot;&gt;$$v = e^{i\sum_i T_i v_i}, $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{T_i\}$&lt;/span&gt; is a set of commuting observables&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f_{\{T_i\}}({t_i}) = \prod_n \left(\int_0^{2\pi} \right) d^nv e^{-i\sum_i t_i v_i} \chi(v)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have given an explicit example of this computation in my answer on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4734/quantum-spin-measurement/4735#4735&quot;&gt;this&lt;/a&gt; question. &lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2019-05-23T15:53:04.650" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6222" PostTypeId="1" CreationDate="2019-05-23T17:45:17.323" Score="7" ViewCount="145" Body="&lt;p&gt;In superconducting quantum computers, we use mostly superconducting qubits or trapped ions. However, those systems are quite large because their environment either requires near absolute zero temperature (for superconducting to happen), or vacuum (to trap ions). Also, they need a lot of shielding from the outside world. So I was wondering why aren't we manufacturing QCs with silicon photonics, which would reduce the system size to possibly today's sizes? There is an optical equivalent to Josephson effect (since we use Josephson Junction's effect for superconducting QC) shown &lt;a href=&quot;https://www.osapublishing.org/oe/abstract.cfm?uri=oe-18-14-14586&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, but why haven't we built more QCs around that? I get that light is harder to interfere with than electrons, so could that result in potential higher qubit error rate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I was made aware of Xanadu, but the question still stands. Why are more companies pursuing other forms of quantum computation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="7375" LastEditorUserId="26" LastEditDate="2019-05-25T16:51:10.910" LastActivityDate="2019-05-25T16:51:10.910" Title="What are the main obstacles to overcome to build silicon-photonic quantum computers?" Tags="&lt;physical-realization&gt;&lt;superconducting-quantum-computing&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6223" PostTypeId="2" ParentId="6219" CreationDate="2019-05-23T21:41:37.107" Score="6" Body="&lt;p&gt;There are a couple variants of the HOG test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Old HOG&quot; computed the proportion of unique samples whose probability is larger than the median probability of the distribution. It then compares that proportion to a threshold, e.g. 2/3. If you have enough larger-than-median outputs, you pass the test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;New HOG&quot; instead computes the mean of the probabilities of the unique samples. Again you pick some threshold that this mean must exceed in order to pass the test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also &quot;cross entropy fidelity (XEB)&quot;, which computes the mean of the logarithms of the probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea behind all these quantities is that a random quantum circuit will have a distribution of probabilities known as a Porter Thomas distribution, and this distribution has known medians and means and so forth which are different from the ones you'd get in a uniform distribution. This allows you to determine whether you're seeing larger or smaller probability samples as often as should be the case, which allows you to define a statistical test that is difficult to pass without the ability to sample from the correct distribution.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-05-23T21:41:37.107" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6224" PostTypeId="1" CreationDate="2019-05-24T00:58:38.740" Score="6" ViewCount="227" Body="&lt;p&gt;When we use the formula to calculate two-qubit entanglement, like these:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C(\rho)=\max \left\{\sqrt{e_{1}}-\sqrt{e_{2}}-\sqrt{e_{3}}-\sqrt{e_{4}}, 0\right\}\tag{18}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;with the quantities &lt;span class=&quot;math-container&quot;&gt;$e_{i}\left(e_{1} \geq e_{2} \geq e_{3} \geq e_{4}\right)$&lt;/span&gt; are the eigenvalues of the operator&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R=\rho\left(\sigma^{y} \otimes \sigma^{y}\right) \rho^{*}\left(\sigma^{y} \otimes \sigma^{y}\right),\tag{19}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho^*$&lt;/span&gt; is the complex conjugate of the reduced density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; given by Eq. (12), and &lt;span class=&quot;math-container&quot;&gt;$\sigma^y$&lt;/span&gt; is the Pauli operator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why do we use the complex conjugate of the density matrix instead of its complex conjugate transpose?&lt;/p&gt;&#xA;" OwnerUserId="6155" LastEditorUserId="10480" LastEditDate="2021-01-27T18:50:27.917" LastActivityDate="2021-01-27T18:50:27.917" Title="Why do we use complex-conjugate instead of complex-conjugate-transpose when calculating the concurrence?" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;concurrence&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6225" PostTypeId="1" AcceptedAnswerId="6226" CreationDate="2019-05-24T05:11:32.660" Score="5" ViewCount="346" Body="&lt;p&gt;I am trying to implement &lt;a href=&quot;https://arxiv.org/abs/1802.06002&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1802.06002&lt;/a&gt;&lt;sup&gt;†&lt;/sup&gt;. I do not understand how to take the data set from MNIST and apply it to a quantum circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[†]: Classification with Quantum Neural Networks on Near Term Processors (Farhi &amp;amp; Neven, 2018)&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="26" LastEditDate="2019-05-25T16:40:43.867" LastActivityDate="2019-05-25T16:40:43.867" Title="How to encode MNIST data set on a quantum circuit to study supervised learning with QNN?" Tags="&lt;circuit-construction&gt;&lt;machine-learning&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6226" PostTypeId="2" ParentId="6225" CreationDate="2019-05-24T07:51:18.383" Score="3" Body="&lt;p&gt;First, they reduce the size from 28*28 to 4*4 images (by &lt;a href=&quot;https://www.giassa.net/?page_id=174&quot; rel=&quot;nofollow noreferrer&quot;&gt;downsampling&lt;/a&gt;), then convert into binary values for pixels by just comparing to a value. Then, they encode the data in a quantum uniform superposition (with computational basis representing a bitstring data image with its label).&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-05-24T07:51:18.383" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6227" PostTypeId="1" CreationDate="2019-05-24T20:09:40.883" Score="3" ViewCount="101" Body="&lt;p&gt;Suppose I have an initial state: &lt;span class=&quot;math-container&quot;&gt;$$|A\rangle=\dfrac{1}{2^{3l/2}}\sum_{x=0}^{2^l-1}\sum_{y=0}^{2^l-1}\sum_{z=0}^{2^l-1} |x\rangle^{\otimes l}|y\rangle^{\otimes l}|z\rangle^{\otimes l}|0\rangle^{\otimes l}|0\rangle^{\otimes l}|0\rangle^{\otimes l}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this state is an equal superposition of all states &lt;span class=&quot;math-container&quot;&gt;$\{0....2^l-1\}^3$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I transform this state such that registers &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes l}|0\rangle^{\otimes l}|0\rangle^{\otimes l}$&lt;/span&gt; contains all the states  &lt;span class=&quot;math-container&quot;&gt;$\{0....2^l-1\}^3$&lt;/span&gt;, but not in the traditional order i.e each state say &lt;span class=&quot;math-container&quot;&gt;$(|3\rangle  |7\rangle  |8\rangle)  |0\rangle   |0\rangle |0\rangle \to    (|3\rangle     |7\rangle     |8\rangle)|8\rangle|9\rangle|16\rangle$&lt;/span&gt;. If I keep doing this to all the initial states then I get all the states just in a permuted manner. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also since the new permuted states are done obtained using a reversible transform I don't need the first three registers so I want to just make them &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Basically what I want is just the permutation of indexes for example I have &lt;span class=&quot;math-container&quot;&gt;$1,2,3,4$&lt;/span&gt; then i want &lt;span class=&quot;math-container&quot;&gt;$4,1,3,2$&lt;/span&gt;. Consider without the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; state &lt;span class=&quot;math-container&quot;&gt;$$|A\rangle= (|0\rangle|0\rangle ) |0\rangle|0\rangle + (|0\rangle|1\rangle ) |0\rangle|0\rangle + (|1\rangle|0\rangle ) |0\rangle|0\rangle + (|1\rangle|1\rangle ) |0\rangle|0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this state transforms into&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|B\rangle= (|0\rangle|0\rangle ) |0\rangle|1\rangle + (|0\rangle|1\rangle ) |1\rangle|0\rangle + (|1\rangle|0\rangle ) |1\rangle|1\rangle + (|1\rangle|1\rangle ) |0\rangle|0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output state that I want is &lt;span class=&quot;math-container&quot;&gt;$$ |C\rangle= (|0\rangle|1\rangle ) |0\rangle|0\rangle + (|1\rangle|0\rangle ) |0\rangle|0\rangle + (|1\rangle|1\rangle ) |0\rangle|0\rangle + (|0\rangle|0\rangle ) |0\rangle|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Classically I have three numbers say &lt;span class=&quot;math-container&quot;&gt;$x,y,z$&lt;/span&gt; and I want to transform them to &lt;span class=&quot;math-container&quot;&gt;$(x'y'z')$&lt;/span&gt; using a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; that is invertible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{eqnarray}&#xA;   x'=f(x,y,z)\\&#xA;y'=f(x,y,z)\\&#xA;z'=f(x,y,z)&#xA;\end{eqnarray}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle|z\rangle$&lt;/span&gt; is the original and the result &lt;span class=&quot;math-container&quot;&gt;$x',y',z'$&lt;/span&gt; is stored in the registers &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-25T16:37:13.803" LastActivityDate="2019-05-25T16:37:13.803" Title="Permutation of initialized states" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6228" PostTypeId="1" AcceptedAnswerId="6229" CreationDate="2019-05-25T00:42:47.450" Score="1" ViewCount="126" Body="&lt;p&gt;Which is the correct depiction of a qubit state showing the possibilities before it collapses?  Is it like:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;MODEL 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1000 0100 0010 0001&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;MODEL 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1000 0100 0010 0001&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0111 1011 1101 1110&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;MODEL 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;0000 0000 0000 0000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1000 1000 1000 1000&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1100 1100 1100 1100&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1110 1110 1110 1110&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1111 1111 1111 1111&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Or some other way?  &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I find the spherical diagrams, XOR gates and | difficult to conceptualize concretely. &#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7602" OwnerDisplayName="elsa" LastEditorUserId="55" LastEditDate="2019-05-29T08:48:52.167" LastActivityDate="2019-05-29T08:48:52.167" Title="Which is the correct depiction of a qubit before it collapses?" Tags="&lt;quantum-state&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6229" PostTypeId="2" ParentId="6228" CreationDate="2019-05-25T03:00:37.700" Score="2" Body="&lt;p&gt;I'm going to go out on a limb and say that it sounds like you're having trouble to know what's meant by &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits in a uniform superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remember with &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits, the dimension of the Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$2^4=16$&lt;/span&gt;.  Thus we will be in a superposition of &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; potential kets.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we apply a Hadamard gate to each of the &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits initially in &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;, then after Hadamarding the entire qubits will be in the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}(\vert 0000\rangle+\vert 0001\rangle+\vert 0010\rangle+\vert 0011\rangle+\vert 0100\rangle+\vert 0101\rangle+\vert 0111\rangle+\vert 1000\rangle+\vert 1001\rangle+\vert 1010\rangle+\vert 1011\rangle+\vert 1100\rangle+\vert 1101\rangle+\vert 1110\rangle+\vert 1111\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, each potential &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-bit vector is part of the superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading the above, the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt; coefficient is the &quot;normalizing coefficient.&quot; This is used to determine the probrability that any of the particular states are measured.  According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born's rule&lt;/a&gt; we square the amplitude to determine the probabilities.  Because there are &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; states, and because it sounds like the OP wants the states to be uniformly distributed with an equal chance of collapsing to any vector, we have &lt;span class=&quot;math-container&quot;&gt;$(\frac{1}{4})^2=\frac{1}{16}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally the Dirac &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bra-ket notation&lt;/a&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert \cdots\rangle$&lt;/span&gt;, is how, in the quantum world, we describe vectors. The OP posted her/his vectors without the surrounding notation, which is maybe OK when you're just starting out and you want to grok the point of a superposition.  But the Dirac notation has a lot of advantages later on when you start looking at things like inner/outer products and density matrices.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-05-26T14:15:03.427" LastActivityDate="2019-05-26T14:15:03.427" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="6230" PostTypeId="1" AcceptedAnswerId="6232" CreationDate="2019-05-25T03:21:34.717" Score="8" ViewCount="934" Body="&lt;p&gt;I was very inspired by Michio Kaku's &lt;a href=&quot;https://www.youtube.com/watch?v=YgFVzOksm4o&quot; rel=&quot;noreferrer&quot;&gt;explanation&lt;/a&gt; on the possibilities of quantum computing and also listening to Talia Gershon's &lt;a href=&quot;https://www.youtube.com/watch?v=S52rxZG-zi0&amp;amp;t=4s&quot; rel=&quot;noreferrer&quot;&gt;talk&lt;/a&gt; on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I come from a business &amp;amp; analytics background, what materials can I begin exploring to prepare to learn more about the field of quantum computing? Eg. what would I need to study to understand Peter Shor's algorithm, &lt;a href=&quot;https://www.youtube.com/watch?v=RGD6KQ6bRS8&quot; rel=&quot;noreferrer&quot;&gt;Siraj's video&lt;/a&gt; on physics, etc.&lt;/p&gt;&#xA;" OwnerUserId="7580" LastEditorUserId="26" LastEditDate="2019-05-25T16:23:02.117" LastActivityDate="2019-05-25T18:26:13.360" Title="What are the basics needed to learn quantum computing?" Tags="&lt;resource-request&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6231" PostTypeId="2" ParentId="6227" CreationDate="2019-05-25T09:08:51.070" Score="3" Body="&lt;p&gt;To sum up, you have an unitary operation &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P \ \vert x \rangle \vert y \rangle \vert z \rangle \vert 0 \rangle \vert 0 \rangle \vert 0 \rangle \mapsto \vert x \rangle\vert y \rangle\vert z \rangle\vert 0 \oplus p_1(x, y, z) \rangle\vert 0 \oplus p_2(x, y, z) \rangle\vert  0 \oplus p_3(x, y, z) \rangle&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_3$&lt;/span&gt; already implemented, invertible and you want to create a unitary operation &lt;span class=&quot;math-container&quot;&gt;$P'$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P' \ \vert x \rangle \vert y \rangle \vert z \rangle \vert 0 \rangle \vert 0 \rangle \vert 0 \rangle\mapsto\vert p_1(x, y, z) \rangle\vert p_2(x, y, z) \rangle\vert p_3(x, y, z) \rangle\vert 0 \rangle \vert 0 \rangle \vert 0 \rangle .&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be achieved easily by using the fact that the &lt;code&gt;XOR&lt;/code&gt; (&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;) operation is its self inverse and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, defined as the operation that swap the content of the registers given as input:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S \vert x_1 \rangle\vert x_2 \rangle\vert x_3 \rangle\vert x_4 \rangle\vert x_5 \rangle\vert x_6 \rangle \mapsto \vert x_4 \rangle\vert x_5 \rangle\vert x_6 \rangle\vert x_1 \rangle\vert x_2 \rangle\vert x_3 \rangle.&#xA;$$&lt;/span&gt;&#xA;The &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; operation can be implemented with &lt;code&gt;CNOT&lt;/code&gt; gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gate you are trying to implement is then given by &lt;span class=&quot;math-container&quot;&gt;$P' = P^\dagger S P$&lt;/span&gt; (I'm not 100% sure that &lt;span class=&quot;math-container&quot;&gt;$P^\dagger$&lt;/span&gt; implements the inverses of &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_3$&lt;/span&gt;, you may need to check that, if it's not the case then replace &lt;span class=&quot;math-container&quot;&gt;$P^\dagger$&lt;/span&gt; by the unitary operation inverting &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_3$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;P^\dagger SP \ \vert x \rangle \vert y \rangle \vert z \rangle \vert 0 \rangle \vert 0 \rangle \vert 0 \rangle &amp;amp;= P^\dagger S \ \vert x \rangle\vert y \rangle\vert z \rangle\vert 0 \oplus p_1(x, y, z) \rangle\vert 0 \oplus p_2(x, y, z) \rangle\vert  0 \oplus p_3(x, y, z) \rangle \\&#xA;&amp;amp;= P^\dagger S \ \vert x \rangle\vert y \rangle\vert z \rangle\vert p_1(x, y, z) \rangle\vert p_2(x, y, z) \rangle\vert p_3(x, y, z) \rangle \\&#xA;&amp;amp;= P^\dagger \ \vert p_1(x, y, z) \rangle\vert p_2(x, y, z) \rangle\vert p_3(x, y, z) \rangle \vert x \rangle\vert y \rangle\vert z \rangle \\&#xA;&amp;amp;= \vert p_1(x, y, z) \rangle\vert p_2(x, y, z) \rangle\vert p_3(x, y, z) \rangle \vert x \oplus x \rangle\vert y \oplus y \rangle\vert z \oplus z \rangle \\&#xA;&amp;amp;= \vert p_1(x, y, z) \rangle\vert p_2(x, y, z) \rangle\vert p_3(x, y, z) \rangle\vert 0 \rangle \vert 0 \rangle \vert 0 \rangle &#xA;\end{split}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-05-25T09:08:51.070" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6232" PostTypeId="2" ParentId="6230" CreationDate="2019-05-25T15:26:56.383" Score="5" Body="&lt;h2&gt;&lt;em&gt;General background&lt;/em&gt;:&lt;/h2&gt;&#xA;&lt;p&gt;Quantum computing (theory) is at the intersection of math, physics and computer science. (Experiment also can involve electrical engineering.) Eventually you will want to learn aspects of all of these fields, but when starting you can use any for an entry into the field. Within each field, the subjects you will want to know are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Physics:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;First learn quantum mechanics. At more advanced levels, various&#xA;aspects of quantum information overlap with AMO, condensed matter and&#xA;high energy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;More&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph229/#lecture&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Preskill's lecture notes&lt;/a&gt; are slightly more advanced and use a physics perspective.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Math:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;First linear algebra and probability. Later my preferences would be to&#xA;learn some group and representation theory, random matrix theory and&#xA;functional analysis, but eventually most fields of math have some&#xA;overlap with quantum information, and other researchers may emphasize&#xA;different areas of math.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Computer Science:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Most theory topics are relevant although are less crucial at first:&#xA;i.e. algorithms, cryptography, information theory, error-correcting&#xA;codes, optimization, complexity, machine learning. If you haven't had&#xA;any CS theory exposure, undergrad algorithms is a good place to start&#xA;because it will show you CS-theory ways of thinking, including ideas&#xA;like asymptotic analysis.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;More:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.lassp.cornell.edu/mermin/qcomp/CS483.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;David Mermin's lecture notes&lt;/a&gt; are elementary and have a CS focus&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1926/does-a-study-guide-exist-that-starts-from-a-purely-cs-background-and-advances?rq=1&quot;&gt;Does a study guide exist that starts from a &amp;quot;purely CS background&amp;quot; and advances towards &amp;quot;making a new quantum programming language&amp;quot;?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;General quantum computing texts&lt;/strong&gt;&lt;/em&gt;:&lt;/p&gt;&#xA;&lt;p&gt;Here is a very partial list of resources for learning more about quantum computing and quantum information.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The canonical reference for learning quantum computing is the textbook &lt;a href=&quot;https://books.google.co.in/books?id=-s4DEy7o-a0C&amp;amp;redir_esc=y&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computation and quantum information&lt;/a&gt; by Nielsen and Chuang.&lt;/li&gt;&#xA;&lt;li&gt;Another good book (with more of a &amp;quot;little yellow book&amp;quot; experience) is &lt;a href=&quot;https://www.google.com/search?tbo=p&amp;amp;tbm=bks&amp;amp;q=isbn:0821832298&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical and Quantum Computation&lt;/a&gt; by Kitaev, Shen and Vyalyi.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If you want to get a flavor of what research is currently hot, then&#xA;one place to look is at the program of the last few QIP workshops. A&#xA;less curated list of interesting papers can be found at &lt;a href=&quot;https://scirate.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;scirate.com&lt;/a&gt; ,&#xA;where looking at the most scited papers in the last year should bring&#xA;up some interesting work.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;Specialized sources&lt;/em&gt;:&lt;/p&gt;&#xA;&lt;p&gt;Some more specialized books/lecture notes are here. These are more modern and in-depth than the general resources above.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.cs.umd.edu/%7Eamchilds/qa/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithms&lt;/a&gt; lecture notes by Andrew Childs&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1106.1445&quot; rel=&quot;nofollow noreferrer&quot;&gt;From Classical to Quantum Shannon Theory&lt;/a&gt; by Mark Wilde. Thorough and detailed with plenty of exercises.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1410.7188&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Functional Analysis of Quantum Information Theory&lt;/a&gt; written by Gupta, Mandayam and Sunder based on lectures by Effros, Paulsen, Pisier and Winter. Denser and focused on the math side more than applications.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://math.univ-lyon1.fr/%7Eaubrun/ABMB/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Alice and Bob meet Banach&lt;/a&gt; by Aubrun and Szarek. Incomplete textbook draft, but it looks like it'll be the definitive treatment of the probabilistic method in quantum information.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1604.01790&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Mathematics of Entanglement&lt;/a&gt; by Brandao, Christandl, Walter and myself. Idiosyncratic and incomplete lecture notes on some of our pet topics.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;:&#xA;The above information is based on &lt;a href=&quot;http://www.mit.edu/%7Earam/advice/quantum.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this MIT page&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Other StackExchange Questions.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2082/are-there-any-organised-resources-available-from-where-i-can-begin-my-quantum-co?noredirect=1&amp;amp;lq=1&quot;&gt;Are there any organised resources available from where I can begin my quantum computing studies?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1367/programming-quantum-computers-for-non-physics-majors?noredirect=1&amp;amp;lq=1&quot;&gt;Programming quantum computers for non-physics majors&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Credits : @SanchayanDutta&lt;/p&gt;&#xA;" OwnerUserId="7567" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-25T18:26:13.360" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6233" PostTypeId="2" ParentId="6224" CreationDate="2019-05-25T18:26:13.590" Score="-1" Body="&lt;p&gt;I believe the question is: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;why does Eq. 19 use &lt;span class=&quot;math-container&quot;&gt;$\rho^*$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\rho^\dagger$&lt;/span&gt;?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I believe this is because &lt;span class=&quot;math-container&quot;&gt;$\rho^* = \rho^\dagger$&lt;/span&gt; for Hermitian matrices such as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, so it can be written either way.&lt;/p&gt;&#xA;" OwnerUserId="7583" LastActivityDate="2019-05-25T18:26:13.590" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6234" PostTypeId="2" ParentId="6198" CreationDate="2019-05-25T18:52:09.347" Score="7" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;What feature of a quantum algorithm makes it better than its classical&#xA;counterpart?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;First, a classical algorithm can be thought of as a quantum algorithm that makes no use of quantum superpositions. Therefore a quantum algorithm can be &lt;strong&gt;at least&lt;/strong&gt; as good as its classical counterpart. No classical algorithm can be &amp;quot;better&amp;quot; than quantum algorithms can do, because one example of a quantum algorithm is the classical algorithm itself.&lt;/p&gt;&#xA;&lt;p&gt;What is a feature of quantum algorithms that make them better than classical algorithms? The feature of quantum entanglement and superposition, which allows us to answer the Deutsch-Josza problem with 1 query instead of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Are quantum computers faster than classical ones in all respects?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I believe we do not know much about &amp;quot;speed&amp;quot;. We know that we can factor the number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$log^3(n)$&lt;/span&gt; operations instead of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; operations, but how fast are those operations going to be? We only know the answer to this question for quantum computers that have &amp;lt; 10000 qubits, and these have not been able to factor numbers larger than about 7 digits. You can see in WolframAlpha that factoring any number with ~10 digits finishes instantly, so even if the IBM quantum computer is faster, it is insignificantly faster. We need millions of physical qubits (100s of logical qubits) to make a real comparison, and what that million-qubit architecture will look like (if it's even possible to make) is something we don't yet know. Maybe to make a device with a million qubits will come at the sacrifice of gate fidelities or gate speeds.&lt;/p&gt;&#xA;&lt;p&gt;The answer is &amp;quot;no&amp;quot; quantum algorithms are not better in &amp;quot;all respects&amp;quot; because they are harder to implement physically!&lt;/p&gt;&#xA;" OwnerUserId="7583" LastEditorUserId="2293" LastEditDate="2021-04-11T18:26:06.193" LastActivityDate="2021-04-11T18:26:06.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6235" PostTypeId="1" AcceptedAnswerId="6346" CreationDate="2019-05-25T21:22:34.717" Score="3" ViewCount="963" Body="&lt;p&gt;I am using Qiskit language, and I am working with IBM devices via Quantum Experience beta. How can I find how many credit points I have used and how much there are left till they fill back 24 hour's later? And for each backend, number of qubits and number of shots - how much credit points does the system require per experience with those data?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have a summary mentioning all is known about those credit points.&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="26" LastEditDate="2019-05-26T00:02:22.087" LastActivityDate="2019-06-05T07:43:14.807" Title="How do the credit points work in IBM quantum experience?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6236" PostTypeId="1" AcceptedAnswerId="6240" CreationDate="2019-05-26T02:35:17.127" Score="9" ViewCount="3445" Body="&lt;p&gt;In IBM Qiskit and Quantum Experience, the custom &lt;code&gt;U3&lt;/code&gt; gate is defined as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta, \phi, \lambda) = &#xA;\begin{pmatrix} &#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\&#xA;e^{i\phi} \sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right)&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to quickly obtain the parameters &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; for any arbitrary &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitary &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;? I know it's possible to write up a lengthy program which could do this, but is there already a similar program out there? Any of the common programming languages would be fine.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Related&lt;/strong&gt;: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2707/what-are-theta-phi-and-lambda-in-cu1theta-ctl-tgt-and-cu3theta-phi-lam&quot;&gt;What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-26T03:39:44.357" LastActivityDate="2019-08-29T10:12:16.083" Title="How to quickly calculate the custom U3 gate parameters $\theta, \phi$ and $\lambda$ for any unitary?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;resource-request&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6237" PostTypeId="2" ParentId="6236" CreationDate="2019-05-26T03:37:39.380" Score="3" Body="&lt;h1&gt;Mathematica&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;With help from &lt;a href=&quot;https://mathematica.stackexchange.com/a/199113/63834&quot;&gt;Mathematica SE&lt;/a&gt;, I managed to put this together (assuming &lt;code&gt;Z&lt;/code&gt; is our 2 × 2 unitary):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;U = {{Cos[\[Theta]/&#xA;     2], -E^(I \[Lambda]) Sin[\[Theta]/&#xA;      2]}, {E^(I \[Phi]) Sin[\[Theta]/2], &#xA;   E^(I (\[Lambda] + \[Phi])) Cos[\[Theta]/2]}};&#xA;FullSimplify[&#xA; Reduce[Z == U &amp;amp;&amp;amp; 0 &amp;lt;= \[Phi] &amp;lt; 2 Pi &amp;amp;&amp;amp; 0 &amp;lt;= \[Theta] &amp;lt;= Pi &amp;amp;&amp;amp; &#xA;   0 &amp;lt;= \[Lambda] &amp;lt; 2 Pi, {\[Theta], \[Phi], \[Lambda]}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that you'll need to define &lt;code&gt;Z&lt;/code&gt; beforehand. Say, if &lt;span class=&quot;math-container&quot;&gt;$Z=\begin{pmatrix}-\frac{1}{\sqrt 2} &amp;amp; \frac{i}{\sqrt 2} \\ \frac{i}{\sqrt 2} &amp;amp; -\frac{1}{\sqrt 2} \end{pmatrix}$&lt;/span&gt;, the corresponding code is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Z = {{-1/Sqrt[2], I/Sqrt[2]}, {I/Sqrt[2], -1/Sqrt[2]}};&#xA;Z = Z/Sqrt[Det[Z]];&#xA;Z = Simplify[Z/Exp[I Arg[Z[[1, 1]]]]];&#xA;U = {{Cos[\[Theta]/&#xA;     2], -E^(I \[Lambda]) Sin[\[Theta]/&#xA;      2]}, {E^(I \[Phi]) Sin[\[Theta]/2], &#xA;   E^(I (\[Lambda] + \[Phi])) Cos[\[Theta]/2]}};&#xA;FullSimplify[&#xA; Reduce[Z == U &amp;amp;&amp;amp; 0 &amp;lt;= \[Phi] &amp;lt; 2 Pi &amp;amp;&amp;amp; 0 &amp;lt;= \[Theta] &amp;lt;= Pi &amp;amp;&amp;amp; &#xA;   0 &amp;lt;= \[Lambda] &amp;lt; 2 Pi, {\[Theta], \[Phi], \[Lambda]}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the solution is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;2 \[Theta] == \[Pi] &amp;amp;&amp;amp; 2 \[Phi] == 3 \[Pi] &amp;amp;&amp;amp; 2 \[Lambda] == \[Pi]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that the matrix &lt;span class=&quot;math-container&quot;&gt;$U(\pi/2,3\pi/2,\pi/2)$&lt;/span&gt; differs by a phase factor from &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. This is because of the transformation due to&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Z = Z/Sqrt[Det[Z]];&#xA;Z = Simplify[Z/Exp[I Arg[Z[[1, 1]]]]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which is meant to deal with those cases where &lt;span class=&quot;math-container&quot;&gt;$Z_{11}$&lt;/span&gt; exceeds the range of &lt;span class=&quot;math-container&quot;&gt;$\cos(\frac{\theta}{2})$&lt;/span&gt;. I've discussed about this &lt;a href=&quot;https://math.stackexchange.com/a/3239968&quot;&gt;here&lt;/a&gt;. Remember that &lt;span class=&quot;math-container&quot;&gt;$0\leq \theta \leq \pi$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$0 \leq \phi &amp;lt;2\pi$&lt;/span&gt; according to the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=full-user-guide&amp;amp;page=002-The_Weird_and_Wonderful_World_of_the_Qubit~2F004-advanced_qubit_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;P.S&lt;/strong&gt;: You can run this code on &lt;a href=&quot;http://www.wolframcloud.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mathematica Cloud&lt;/a&gt; now cf. &lt;a href=&quot;https://math.meta.stackexchange.com/questions/30332&quot;&gt;Wolfram Releases the Wolfram Engine for Developers!!&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-06-04T15:19:53.367" LastActivityDate="2019-06-04T15:19:53.367" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6238" PostTypeId="1" AcceptedAnswerId="6246" CreationDate="2019-05-26T10:50:20.633" Score="5" ViewCount="479" Body="&lt;p&gt;The Grover algorithm allows you to search for multiple elements. Assuming my search space contains four elements, if I only search for one element, I get the one I'm looking for with a probability of 100%. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming I search for two elements within the four elements, then the probability is only found at 50% of the searched element. It gets even more interesting. Suppose I search exactly three within the four elements, then the probability increases to measure a state that does not correspond to the solution state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, how does one behave in such a situation? and is it possible to recognize these situations in advance? Are there any other problems that can occur when searching for multiple items?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Calculations (success probabilities):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the number of searched elements, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the size of the search space.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M=1, N =4$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sin^2\left((2\cdot 1 + 1)\cdot\sin^{-1}\left(\sqrt{\frac{1}{4}}\right)\right)=1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M=2, N =4$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sin^2\left((2\cdot 1 + 1)\cdot\sin^{-1}\left(\sqrt{\frac{2}{4}}\right)\right)=\frac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M=3, N =4$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sin^2\left((2\cdot 1 + 1)\cdot\sin^{-1}\left(\sqrt{\frac{3}{4}}\right)=\frac{1}{2}\right)=0$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="55" LastEditDate="2019-05-27T09:19:13.243" LastActivityDate="2019-05-27T09:19:13.243" Title="Success probability in Grover's algorithm where there are multiple targets" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6240" PostTypeId="2" ParentId="6236" CreationDate="2019-05-26T14:42:55.510" Score="5" Body="&lt;h1&gt;Python - Sympy&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It could be done in python using &lt;code&gt;sympy&lt;/code&gt;. I am not really an expert and maybe there could be ways to optimize this, but the following works fine for me.&#xA;Assuming you have the matrix &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}a &amp;amp; b\\ c &amp;amp; d\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My program&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from sympy import *&#xA;&#xA;def get_angles(a, b, c, d):&#xA;    if im(a) == 0:&#xA;        print(&quot;Not phasing&quot;)&#xA;        s = _compute_angles(a, b, c, d)&#xA;        res = _final_constraint(s)&#xA;        if len(res) != 0:&#xA;            return res&#xA;    print(&quot;Phasing by first element...&quot;)&#xA;    matr = Matrix([[a, b], [c, d]])&#xA;    ph = arg(matr[0])&#xA;    matr_phased = simplify(matr/(cos(ph) + I*sin(ph)))&#xA;    s = _compute_angles(matr_phased[0], matr_phased[1], matr_phased[2],&#xA;                        matr_phased[3])&#xA;    return _final_constraint(s)&#xA;&#xA;&#xA;def _compute_angles(a, b, c, d):&#xA;    theta, phi, lamb = symbols('\\theta \\phi \\lambda', real=True)&#xA;    a_eq = Eq(cos(theta / 2), a)&#xA;    b_eq = Eq(-exp(I * lamb) * sin(theta / 2), b)&#xA;    c_eq = Eq(exp(I * phi) * sin(theta / 2), c)&#xA;    d_eq = Eq(exp(I * (phi + lamb)) * cos(theta / 2), d)&#xA;    return solve([a_eq, b_eq, c_eq, d_eq], [theta, phi, lamb], dict=True)&#xA;&#xA;&#xA;def _final_constraint(result):&#xA;    res = []&#xA;    for sol in result:&#xA;        to_add = True&#xA;        for k, v in sol.items():&#xA;            if str(k) == '\\theta' and (v &amp;lt; 0 or v &amp;gt; pi):&#xA;                to_add = False&#xA;                break&#xA;            elif str(k) == '\\phi' and (v &amp;lt; 0 or v &amp;gt;= 2 * pi):&#xA;                to_add = False&#xA;                break&#xA;        if to_add:&#xA;            res.append(simplify(sol))&#xA;    return res&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that for Qiskit &lt;code&gt;U&lt;/code&gt; matrix you should only check if the first number is imaginary and, if it so, you could divide the whole matrix by it. It is not really necessary to divide by the determinant, provided that the matrix represent indeed a valid quantum gate (or, said differently, the magnitude are all less than 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To avoid Python evaluation of fractions, instead of simply using &lt;code&gt;1/2&lt;/code&gt; a common trick is to use &lt;code&gt;S(1)/2&lt;/code&gt; or &lt;code&gt;Rational(1,2)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Examples&lt;/h2&gt;&#xA;&#xA;&lt;h3&gt;A generic unitary&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;get_angles(sqrt(S(1)/5), sqrt(S(4)/5), -sqrt(S(4)/5), sqrt(S(1)/5))&lt;/code&gt;&#xA;returns &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left[ \left\{ \lambda : \pi, \  \phi : \pi, \  \theta : 2 \operatorname{acos}{\left(\frac{\sqrt{5}}{5} \right)}\right\}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Pauli-Y matrix&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;get_angles(0, -I, I, 0)&lt;/code&gt; returns &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left[ \left\{ \lambda : \frac{\pi}{2}, \  \phi : \frac{\pi}{2}, \  \theta : \pi\right\}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt;&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sqnot = Matrix([[1+I, 1-I], [1-I, 1+I]]) * Rational(1,2)&#xA;get_angles(sqnot[0], sqnot[1], sqnot[2], sqnot[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left[ \left\{ \lambda : \frac{\pi}{2}, \  \phi : \frac{3 \pi}{2}, \  \theta : \frac{\pi}{2}\right\}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Matrix of Sanchayan Dutta &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6237/4848&quot;&gt;answer&lt;/a&gt;&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;get_angles(-1/sqrt(2), I/sqrt(2), I/sqrt(2), -1/sqrt(2))&lt;/code&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left[ \left\{ \lambda : \frac{\pi}{2}, \  \phi : \frac{3 \pi}{2}, \  \theta : \frac{\pi}{2}\right\}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="4848" LastEditDate="2019-08-29T10:12:16.083" LastActivityDate="2019-08-29T10:12:16.083" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="6241" PostTypeId="2" ParentId="6155" CreationDate="2019-05-26T14:47:50.763" Score="1" Body="&lt;p&gt;It sounds like you want a state given to you as &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle\vert f(x)\rangle$&lt;/span&gt;, and you wish to only conditionally rotate when &lt;span class=&quot;math-container&quot;&gt;$f(x)=a$&lt;/span&gt;, diffuse over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, conditionally rotate when &lt;span class=&quot;math-container&quot;&gt;$f(x)=a$&lt;/span&gt;, diffuse over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, ... conditionally rotate when &lt;span class=&quot;math-container&quot;&gt;$f(x)=a$&lt;/span&gt;, diffuse over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand your question, then I think the issue is in the &quot;diffuse over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because you can't simply diffuse over the mixed state &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt;, but you must diffuse over the pure state &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle\vert f(x)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\vert f(x)\rangle$&lt;/span&gt; has not been &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncomputation&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncomputed&lt;/a&gt; back to &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;, then the diffusion will not lead to constructive/destructive interference in the first register.  Even if you are diffusing only over the first register &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt;, the second register &lt;span class=&quot;math-container&quot;&gt;$\vert f(x)\rangle$&lt;/span&gt; gets in the way.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-05-26T14:47:50.763" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6242" PostTypeId="1" CreationDate="2019-05-26T19:45:49.610" Score="7" ViewCount="158" Body="&lt;p&gt;Assume we are given an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system and complex numbers &lt;span class=&quot;math-container&quot;&gt;$a_0, \ldots, a_{m-1}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m = 2^n$&lt;/span&gt;. Assume further we start with the initial state &lt;span class=&quot;math-container&quot;&gt;$|0 \ldots 0\rangle$&lt;/span&gt; and want to make the transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0 \ldots 0\rangle \rightarrow \frac{1}{\sqrt{\sum_{i=0}^{m-1} |a_i|^2 }}\sum_{i=0}^{m-1} a_i |i\rangle$$&lt;/span&gt;&#xA;for arbitrary &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;.&#xA;My question is now: What is the most efficient way (fewest gates resp. smallest circuit depth resp. best robustness on a noisy intermediate-scale quantum computer) currently known to implement that transformation?&lt;/p&gt;&#xA;" OwnerUserId="6192" LastEditorUserId="6192" LastEditDate="2019-05-27T09:22:52.487" LastActivityDate="2019-06-10T16:14:57.817" Title="Most efficient way for general state generation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6244" PostTypeId="2" ParentId="5787" CreationDate="2019-05-27T02:40:24.733" Score="3" Body="&lt;p&gt;The point is that, for a search algorithm to be fulfilling its purpose, you want &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi_k^x\rvert x\rangle\rvert^2&amp;gt;1/2$&lt;/span&gt;.&#xA;Note that here &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_k^x\rangle$&lt;/span&gt; is the output of the algorithm after &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; steps if we are using the oracle to mark the &lt;span class=&quot;math-container&quot;&gt;$\lvert x\rangle$&lt;/span&gt; state. If this condition is not verified, then by definition the algorithm is not giving as output the state we asked it to find.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What one can do then is to show that, if &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle\psi_k^x\rvert x\rangle\rvert^2&amp;gt;1/2$&lt;/span&gt; holds for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$D_k=\Omega(N)$&lt;/span&gt;, meaning that there is some positive &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; such that, for large enough &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$D_k\ge cN$&lt;/span&gt;.&#xA;Intuitively, this is saying that a high probability of success means that the algorithm must be moving &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; towards different states, and therefore &lt;span class=&quot;math-container&quot;&gt;$D_k$&lt;/span&gt;, which quantifies how much &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; is moved by the algorithm, must be lower bounded.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, one can also prove that &lt;span class=&quot;math-container&quot;&gt;$D_k=O(k^2)$&lt;/span&gt;, and more specifically that &lt;span class=&quot;math-container&quot;&gt;$D_k\le4k^2$&lt;/span&gt;, simply using the definitions of &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_k\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_k^x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then conclude that, if the algorithm is successfully retrieving the requested states, we must have &lt;span class=&quot;math-container&quot;&gt;$cN\le D_k\le 4k^2$&lt;/span&gt;, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$k\ge\sqrt{cN/4}.$$&lt;/span&gt;&#xA;This means that the sole assumption that the algorithm is working leads to the conclusion that the oracle must be used &lt;span class=&quot;math-container&quot;&gt;$\Omega(\sqrt N)$&lt;/span&gt; times.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-05-27T02:40:24.733" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6245" PostTypeId="1" AcceptedAnswerId="6247" CreationDate="2019-05-27T05:25:01.333" Score="3" ViewCount="845" Body="&lt;p&gt;Michael Nielsen posted on &lt;a href=&quot;https://mobile.twitter.com/michael_nielsen/status/1131784174203953153&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twitter&lt;/a&gt; about a proof on a circuit for quantum teleportation.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Had some fun this afternoon re-analyzing the circuit for quantum teleportation. Here's a proof I found that the circuit works.&lt;/p&gt;&#xA;&lt;p&gt;The circuit to be verified: top two qubits are Alice's, including the state psi to be teleported. Bottom qubit is Bob's - want to show it outputs psi.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B0DtK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B0DtK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I would appreciate if someone can explain and elaborate on the steps for the proof? Also what do the &lt;span class=&quot;math-container&quot;&gt;$X^x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^z$&lt;/span&gt; gates mean?&lt;/p&gt;&#xA;" OwnerUserId="914" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-05-27T20:39:03.857" Title="Can someone walk us through Nielsen's proof on a circuit for quantum teleportation?" Tags="&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6246" PostTypeId="2" ParentId="6238" CreationDate="2019-05-27T05:59:23.653" Score="3" Body="&lt;p&gt;Indeed, applying Grover in the case &lt;span class=&quot;math-container&quot;&gt;$ M \ge N / 2 $&lt;/span&gt; will show this issue. Yet you can use a simple trick to overcome this. You just have to increase the search space by adding N new elements which you won't consider solutions. You end up doing more iterations but you will still get a quadratic speedup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to recognize these situatons in advance is either you just are not getting better during your search or you just use quantum counting to get the number of solutions &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; before doing the search. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Last question : no other problems.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-05-27T05:59:23.653" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6247" PostTypeId="2" ParentId="6245" CreationDate="2019-05-27T08:39:05.617" Score="6" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; are just numbers &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$X^x = I$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z^z = I$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The explanatiton goes as follows   &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The first step is to note that in our case CNOT operation on the 1st and 2nd qubits has the same effect as CNOT on the 1st and 3rd qubits. That is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT_{12} |\psi\rangle(|00\rangle+|11\rangle)\frac{1}{\sqrt{2}} = CNOT_{13} |\psi\rangle(|00\rangle+|11\rangle)\frac{1}{\sqrt{2}}&#xA;$$&lt;/span&gt; &#xA;To see why, just define &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; and compute &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT_{12} |\psi\rangle(|00\rangle+|11\rangle)\frac{1}{\sqrt{2}} = CNOT_{12}(\alpha|0\rangle + \beta|1\rangle)(|00\rangle+|11\rangle)\frac{1}{\sqrt{2}} =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=CNOT_{12}(\alpha|000\rangle + \alpha|011\rangle + \beta|100\rangle + \beta|111\rangle )\frac{1}{\sqrt{2}} =  &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= (\alpha|000\rangle + \alpha|011\rangle + \beta|110\rangle + \beta|101\rangle )\frac{1}{\sqrt{2}},&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT_{13} |\psi\rangle(|00\rangle+|11\rangle)\frac{1}{\sqrt{2}} = CNOT_{13}(\alpha|000\rangle + \alpha|011\rangle + \beta|100\rangle + \beta|111\rangle )\frac{1}{\sqrt{2}} = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=(\alpha|000\rangle + \alpha|011\rangle + \beta|101\rangle + \beta|110\rangle )\frac{1}{\sqrt{2}}&#xA;$$&lt;/span&gt;&#xA;So, we can transform the circuit by switching &lt;span class=&quot;math-container&quot;&gt;$CNOT_{12}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$CNOT_{13}$&lt;/span&gt;. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/NQ7SC.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NQ7SC.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;In the second step we note that in our new circuit the second qubit has only one operation that affects it – the measurement. So we can apply it before all other operations. The result of this operation is &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and 2nd and 3rd qubits after this measurement will be &lt;span class=&quot;math-container&quot;&gt;$|xx\rangle = |00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JIyfV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JIyfV.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Since the 3rd qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;  at this step, we can swap the order of operations &lt;span class=&quot;math-container&quot;&gt;$CNOT_{13}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X^x$&lt;/span&gt; on it. But &lt;span class=&quot;math-container&quot;&gt;$X^x|x\rangle = |0\rangle$&lt;/span&gt;, so what is left is to analyze the circuit &lt;a href=&quot;https://i.stack.imgur.com/xHWff.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xHWff.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;At this step you can directly compute the effect of the CNOT and H gates &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H\otimes I \cdot CNOT_{12} \cdot |\psi\rangle|0\rangle = H\otimes I \cdot CNOT_{12} \cdot (\alpha|00\rangle + \beta|10\rangle) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= H\otimes I (\alpha|00\rangle + \beta|11\rangle) = \frac{1}{\sqrt{2}}\left( \alpha(|0\rangle+|1\rangle)|0\rangle + \beta(|0\rangle-|1\rangle)|1\rangle \right) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; = \frac{1}{\sqrt{2}}\left( \alpha|00\rangle+\alpha|10\rangle + \beta|01\rangle-\beta|11\rangle \right) = \frac{1}{\sqrt{2}}\left( |0\rangle(\alpha|0\rangle+\beta|1\rangle) +  |1\rangle(\alpha|0\rangle-\beta|1\rangle) \right) &#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Now if we measure 1st qubit the result will be &lt;span class=&quot;math-container&quot;&gt;$z=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and the state will be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle(\alpha|0\rangle+\beta|1\rangle)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle(\alpha|0\rangle-\beta|1\rangle)$&lt;/span&gt; correspondingly. So if we apply &lt;span class=&quot;math-container&quot;&gt;$Z^z$&lt;/span&gt; on the last qubit it will be in the state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle = |\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;His second way to prove last circuit (from step 3) is basically by using equality&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha|00\rangle+\beta|11\rangle = \frac{1}{\sqrt{2}}(|+\rangle(\alpha|0\rangle + \beta|1\rangle) + |-\rangle(\alpha|0\rangle - \beta|1\rangle))&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|0\rangle$&lt;/span&gt; we will get the state &lt;span class=&quot;math-container&quot;&gt;$\alpha|00\rangle+\beta|11\rangle$&lt;/span&gt;. Now instead of applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and measuring the 1st qubit in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt; basis we can measure in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle, |-\rangle$&lt;/span&gt; basis right away. The result will be &lt;span class=&quot;math-container&quot;&gt;$z=0$&lt;/span&gt; with the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle(\alpha|0\rangle + \beta|1\rangle)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$z=1$&lt;/span&gt; with the state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle(\alpha|0\rangle - \beta|1\rangle)$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$Z^z$&lt;/span&gt; corrects the state of the last qubit.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-05-27T12:04:29.290" LastActivityDate="2019-05-27T12:04:29.290" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6248" PostTypeId="1" AcceptedAnswerId="6937" CreationDate="2019-05-27T17:08:34.440" Score="2" ViewCount="425" Body="&lt;p&gt;I have two gates here for the Grover diffusion operator. The first gate is completely understandable for me, so I implemented it myself after submitting some papers that I read. &#xA;This is the first gate (understandable for me):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qCPAZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qCPAZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, however, I have seen an implementation of the Grover algorithm in which the diffusion operator still uses the oracle qubit. My question is, what does this circuit do? And why does it work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2oITx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2oITx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="26" LastEditDate="2019-05-27T20:11:23.210" LastActivityDate="2019-08-04T05:20:04.890" Title="Grover diffusion operator different gates" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6249" PostTypeId="1" CreationDate="2019-05-27T17:32:32.543" Score="1" ViewCount="81" Body="&lt;p&gt;Suppose I have the state &lt;span class=&quot;math-container&quot;&gt;$|A\rangle=|x\rangle^l\otimes |y\rangle^l \otimes |z\rangle^l \otimes |0\rangle_x^l\otimes |0\rangle_y^l\otimes |0\rangle_z^l$&lt;/span&gt;. I perform the transformation between the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; register and first &lt;span class=&quot;math-container&quot;&gt;$0_x$&lt;/span&gt; register that is &lt;span class=&quot;math-container&quot;&gt;$$U|x,0\rangle\to |x,(2x)~\text{mod}~l\rangle$$&lt;/span&gt;&#xA;Suppose if &lt;span class=&quot;math-container&quot;&gt;$|x\rangle=|x_0x_1x_2...x_{l-1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle=|0_00_1000..0_{l-1}\rangle$&lt;/span&gt; then the result is &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|x_1x_2x_3....x_{l-1}0\rangle$&lt;/span&gt;.&#xA;So the tensorial notation for this operator on state &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U=\prod_{i=0}^{l-2}  \left( I^{\otimes 1+i}\otimes P_0\otimes I^{\otimes 3l-2}\otimes I\otimes I^{l-1-i}\otimes I^{\otimes 2l} \right.   \\\left.+I^{\otimes 1+i}\otimes P_1\otimes I^{\otimes 3l-2}\otimes X\otimes I^{l-1-i}\otimes I^{\otimes 2l}\right)&#xA;\end{align}&lt;/span&gt;&#xA;Is this operator correct for the operation that I want to perform?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-07-26T18:11:53.737" LastActivityDate="2020-07-26T18:11:53.737" Title="Kronecker notation of an operator" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;&lt;notation&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6250" PostTypeId="1" CreationDate="2019-05-27T18:44:23.560" Score="4" ViewCount="92" Body="&lt;p&gt;I tried to look for the resource constraints but so far haven't been able to find them. They are not present in the &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/tree/master/backends&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub&lt;/a&gt; repository that usually provides the hardware information for the different devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean resource constraints as in:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can any single qubit gates be applied on different qubits simultaneously?&lt;/li&gt;&#xA;&lt;li&gt;Can any two-qubit gates be applied on different links simultaneously?&lt;/li&gt;&#xA;&lt;li&gt;Can measurements be performed on different qubits simultaneously?&lt;/li&gt;&#xA;&lt;li&gt;Combinations of the above, etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Additionally, I'd also like to know the duration of the measurement operations.&lt;/p&gt;&#xA;" OwnerUserId="201" LastEditorUserId="26" LastEditDate="2019-05-28T05:39:44.950" LastActivityDate="2019-05-28T05:39:44.950" Title="IBM Q devices' hardware/resource constraints" Tags="&lt;resource-request&gt;&lt;architecture&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6251" PostTypeId="1" CreationDate="2019-05-27T20:42:24.957" Score="1" ViewCount="140" Body="&lt;p&gt;Is it an open question whether we can do reinforcement learning where the quantum agent is not present in the environment, that is, doesn't contribute noise to the environment? In a classical environment, it seems that the agent is observing the universe while also contributing to it simultaneously. Most papers in this field seem to analyze quantum speed-ups and quantum-inspired algorithms, but I wonder more about classical improvements of the architecture in general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My aim is to understand if there is a way to arrange an environment where an agent is in a quantum state. The purpose is to separate the agent (actor-critic) from the system. For example, through superposition. In other words, can we do learning with a passive agent?&lt;/p&gt;&#xA;" OwnerUserId="2215" LastEditorUserId="2215" LastEditDate="2019-06-13T13:40:15.230" LastActivityDate="2019-06-13T13:40:15.230" Title="Reinforcement learning with a quantum agent" Tags="&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;superposition&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2019-06-05T07:17:56.030" ContentLicense="CC BY-SA 4.0" />
  <row Id="6253" PostTypeId="1" AcceptedAnswerId="6257" CreationDate="2019-05-28T08:16:23.397" Score="3" ViewCount="274" Body="&lt;p&gt;I have the following exercise to solve:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider the Boolean function &lt;span class=&quot;math-container&quot;&gt;$f(x_1 . . . x_n) = x_1 \oplus \dots \oplus x_n$&lt;/span&gt;&#xA;  where &lt;span class=&quot;math-container&quot;&gt;$x_1 \dots x_n$&lt;/span&gt; is an nbit string and &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; denotes addition mod &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&#xA;  Describe a circuit of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit gates on &lt;span class=&quot;math-container&quot;&gt;$n + 1$&lt;/span&gt; qubits that implements the&#xA;  transformation &lt;span class=&quot;math-container&quot;&gt;$| x_1 \dots x_n \rangle | 0 \rangle \mapsto | x_1 \dots x_n \rangle | x_1 \oplus \dots \oplus x_n\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;By considering a relationship between &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Hamiltonian&#xA;  &lt;span class=&quot;math-container&quot;&gt;$Z \otimes \dots \otimes Z$&lt;/span&gt;, show that &lt;span class=&quot;math-container&quot;&gt;$V = \exp(i Z \otimes \dots \otimes Z t)$&lt;/span&gt;, for any&#xA;  fixed &lt;span class=&quot;math-container&quot;&gt;$t &amp;gt; 0$&lt;/span&gt;, may be implemented on n qubit lines (with possible use&#xA;  of further ancillary lines) by a circuit of size &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;- and&#xA;  &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit gates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My circuit for the first part of the question is just &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; CNOT gates controlled by the first register and acting on the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit register. So far so good. However, for the second part of the question, I don't understand the relation to the Hamiltonian. I understand that I could use &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; to convert &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates but still.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="26" LastEditDate="2019-05-28T14:11:45.643" LastActivityDate="2019-05-28T14:11:45.643" Title="Implement a Hamiltonian in O(n) - exercise question" Tags="&lt;algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6254" PostTypeId="2" ParentId="6236" CreationDate="2019-05-28T08:45:31.600" Score="3" Body="&lt;h1&gt;Qiskit&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;You can also do this directly from Qiskit using this piece of code&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info.synthesis import euler_angles_1q &#xA;from scipy.linalg import sqrtm &#xA;import numpy as np &#xA;&#xA;x_matrix = np.array([[0, 1], [1, 0]]) &#xA;x_90_matrix = sqrtm(x_matrix)&#xA;# Returns (theta, phi, lambda) &#xA;euler_angles_1q(x_90_matrix)                                                                                 &#xA;Out[4]: (1.5707963267948966, -1.5707963267948966, 1.5707963267948966)&#xA;&#xA;an_matr = np.array([[-1/sqrt(2), 1j/sqrt(2)], [1j/sqrt(2), -1/sqrt(2)]]&#xA;euler_angles_1q(an_matr)                                                                                                      &#xA;Out[14]: (1.5707963267948966, 4.71238898038469, 1.5707963267948966&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks to the Qiskit slack channel for this hint. For those interested, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/6125f5cbbf322268f53328f23c0be348c4fe0771/qiskit/quantum_info/synthesis/two_qubit_decompose.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; there is the source code of the &lt;code&gt;euler_angles_1q&lt;/code&gt; function.&lt;/p&gt;&#xA;" OwnerUserId="4848" LastEditorUserId="4848" LastEditDate="2019-05-28T09:12:19.920" LastActivityDate="2019-05-28T09:12:19.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6255" PostTypeId="1" CreationDate="2019-05-28T08:51:28.543" Score="10" ViewCount="1078" Body="&lt;p&gt;I am currently working through some papers related with approximations of more general quantum channels such as amplitude and phase damping channels to Pauli channels. The reason to do so is so that the Gottesman-Knill theorem is fulfilled and efficient Monte Carlo simulations can be performed for Quantum Error Correction codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In such reading, I reach to some papers that use the so-called Twirling in order to justify this channel approximation, but I have not found much literature specifically talking about the topic, as I have found the information to be scattered and not so well distinguished. My principal doubt is the difference between Pauli and Clifford twirls, and if both of them can be applied to the same channel without losing too much on the approximation. For example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1210.5799&quot; rel=&quot;noreferrer&quot;&gt;Surface code with decoherence: An analysis of three superconducting architectures&lt;/a&gt; the authors justify the use of Pauli twirling in order to approximate the combined amplitude and phase damping channel to an asymmetric Pauli channel, relating their parameters.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/0707.0685&quot; rel=&quot;noreferrer&quot;&gt;Symmetrized Characterization of Noisy Quantum Processes&lt;/a&gt; the authors use the Clifford twirl to symmetrize channels such as the asymmetric Pauli channel to the depolarizing channel.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am wondering if someone can give me some insight about this topic, or provide specific literature about the topic of Twirling in Quantum Information Theory. Also ideas or references to the use of those techniques as approximations for error correction is interesting for me and welcome.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-02-22T16:00:10.803" LastActivityDate="2021-02-22T16:00:10.803" Title="Twirling Quantum Channels: Pauli and Clifford Twirling" Tags="&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;gottesman-knill&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6256" PostTypeId="1" CreationDate="2019-05-28T10:11:23.647" Score="4" ViewCount="122" Body="&lt;p&gt;Suppose I have registers &lt;span class=&quot;math-container&quot;&gt;$|a\rangle^{l}|b\rangle^{l} |c\rangle^{l}$&lt;/span&gt; and want an adder mod &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; gate  between the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; registers. Let &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; be the adder mod &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; gate. So is this the correct notation for an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that implements this &lt;span class=&quot;math-container&quot;&gt;$$ U=R\otimes I_b^{\otimes l}.$$&lt;/span&gt; But how do I convey that &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is between &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is for the register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-05-28T14:10:15.223" LastActivityDate="2019-05-28T17:36:08.157" Title="Writing the notation when gates act on non successive registers" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;notation&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6257" PostTypeId="2" ParentId="6253" CreationDate="2019-05-28T10:13:12.527" Score="5" Body="&lt;p&gt;Note: I'm deliberately leaving a few gaps here. Hopefully I'm saying enough to let you piece te rest together!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that you want to implement &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; on some state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x\in\{0,1\}^n}\alpha_x|x\rangle&#xA;$$&lt;/span&gt;&#xA;You can fairly easily write down what that state produces. Think about the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$Z^{\otimes n}$&lt;/span&gt;. What eigenvalues does it have? &lt;span class=&quot;math-container&quot;&gt;$\lambda=\pm 1$&lt;/span&gt;. What are the eigenvectors? The computational basis states &lt;span class=&quot;math-container&quot;&gt;$|x_1\ldots x_n\rangle$&lt;/span&gt;. So, the output of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x:\lambda_x=1}\alpha_xe^{i t}|x\rangle+\sum_{x:\lambda_x=-1}\alpha_xe^{-i t}|x\rangle&#xA;$$&lt;/span&gt;&#xA;Hence, can you use your function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to determine which eigenvalue a particular &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; has? How do you then use tha to apply the correct phase for the evolution? Don't forget that if you use an ancilla qubit, you must undo any entanglement you may have created with it.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-28T10:13:12.527" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6258" PostTypeId="2" ParentId="6256" CreationDate="2019-05-28T11:48:33.323" Score="3" Body="&lt;p&gt;As always with notation there is not a &quot;correct&quot; way of doing things: it's just arbitrary conventions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most readable notation I see for your example involves separating the unitary &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; into 2 &lt;strong&gt;virtual&lt;/strong&gt; unitary matrices: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$R_a$&lt;/span&gt; the portion that acts on &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle^l$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$R_c$&lt;/span&gt; the portion that acts on &lt;span class=&quot;math-container&quot;&gt;$\vert c \rangle^l$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and &quot;defining&quot; &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R = R_a \otimes R_c.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I called the matrices &lt;span class=&quot;math-container&quot;&gt;$R_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_c$&lt;/span&gt; &quot;&lt;strong&gt;virtual&lt;/strong&gt; unitaries because it is likely that they do not exist: the decomposition &lt;span class=&quot;math-container&quot;&gt;$R = R_a \otimes R_c$&lt;/span&gt; will probably be impossible to compute because the matrix &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; cannot be split as 2 separate transformations on &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle^l$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert c \rangle^l$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Warning with this kind of non-standard notation:&lt;/strong&gt; as the matrices involved are not really matrices (they are introduced just for the notation and might not exist), it may add more complexity/confusion than it helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, your operation on &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle^l\vert b \rangle^l\vert c \rangle^l$&lt;/span&gt; may be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = R_a \otimes I \otimes R_c.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-05-28T17:36:08.157" LastActivityDate="2019-05-28T17:36:08.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6259" PostTypeId="2" ParentId="5128" CreationDate="2019-05-28T15:50:57.673" Score="1" Body="&lt;p&gt;You can still use the &lt;code&gt;get_counts()&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = job_exp.result()&#xA;result.get_counts(arg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The key here is that that function takes different arguments: simply an integer representing the index of the circuit on the &lt;code&gt;Circuits&lt;/code&gt; list, the circuit object itself, and the circuit.name attribute (I think). You can check this &lt;a href=&quot;https://qiskit.org/documentation/autodoc/qiskit.result.result.html?highlight=result%20get_counts#qiskit.result.result.Result.get_counts&quot; rel=&quot;nofollow noreferrer&quot;&gt;on the documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So even if you have the same circuit several times in the the &lt;code&gt;Circuits&lt;/code&gt; list, you can still correctly identify each circuit by using the index referring to its position on the said list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This goes a bit late, but might still be useful for someone.&lt;/p&gt;&#xA;" OwnerUserId="201" LastActivityDate="2019-05-28T15:50:57.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6260" PostTypeId="2" ParentId="6256" CreationDate="2019-05-28T15:52:15.253" Score="4" Body="&lt;p&gt;Personally, I would just define &lt;span class=&quot;math-container&quot;&gt;$R_{ac}$&lt;/span&gt; to be the unitary that acts &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; between registers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, and acts as identity everywhere else.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-28T15:52:15.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6261" PostTypeId="1" AcceptedAnswerId="6264" CreationDate="2019-05-28T16:42:32.700" Score="2" ViewCount="130" Body="&lt;p&gt;I am trying to get a better understanding of what is the idea behind quantum contextuality. Quoting from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_contextuality&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page&lt;/a&gt; (emphasis mine):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Quantum contextuality is a foundational concept in quantum mechanics stating that the outcome one observes in a measurement is dependent upon what other measurements one is trying to make. &lt;strong&gt;&lt;em&gt;More formally, the measurement result of a quantum observable is dependent upon which other commuting observables are within the same measurement set&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am a bit confused by the phrasing here. If I have two commuting observables, &lt;span class=&quot;math-container&quot;&gt;$[A,B]=0$&lt;/span&gt;, that means that they do not interfere with one another, or, quoting from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Complete_set_of_commuting_observables&quot; rel=&quot;nofollow noreferrer&quot;&gt;relevant Wikipedia page&lt;/a&gt;, that &quot;&lt;em&gt;the measurement of one observable has no effect on the result of measuring another observable in the set&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this just bad phrasing (or a typo) on Wikipedia's side, or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-01-20T16:56:19.230" LastActivityDate="2020-01-20T16:56:19.230" Title="How does quantum contextuality relate to mutually commuting observables?" Tags="&lt;contextuality&gt;&lt;nonclassicality&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6262" PostTypeId="1" AcceptedAnswerId="6288" CreationDate="2019-05-28T18:27:47.837" Score="6" ViewCount="276" Body="&lt;p&gt;I was researching how optical quantum computers work and discovered a KLM protocol that allows for building quantum gates using linear optics elements like mirrors, beam splitters, and phase shifters. However, I was wondering how would we get the same functionality as with superconducting QCs.&#xA;With superconducting QCs, we have Josephson Junctions - JJs. Those JJs are being interacted with differently so they form a specific gate when that gate operation is needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides &lt;a href=&quot;https://www.osapublishing.org/oe/abstract.cfm?uri=oe-18-14-14586&quot; rel=&quot;noreferrer&quot;&gt;optical JJ&lt;/a&gt;, what would be the optical equivalent to Josephson Junction that we could apply quantum gates to? What are the QCs like the ones from Xanadu running on when it comes to physical qubit implementation? &lt;/p&gt;&#xA;" OwnerUserId="7375" LastEditorUserId="26" LastEditDate="2019-05-29T02:15:43.587" LastActivityDate="2019-05-30T21:15:43.067" Title="Physical qubit of optical quantum computer" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;physical-qubit&gt;&lt;optical-quantum-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6263" PostTypeId="1" AcceptedAnswerId="6265" CreationDate="2019-05-28T18:51:10.430" Score="3" ViewCount="94" Body="&lt;p&gt;Following &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6217/55&quot;&gt;this answer by @DaftWullie&lt;/a&gt;, I give what I think of different cases of the CC-NOT gate:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes I\otimes I+ P_0\otimes P_0\otimes(U-I)$&lt;/span&gt; is the CC-NOT operator when the first two controls are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes I\otimes I+ P_0\otimes P_1\otimes(U-I)$&lt;/span&gt; is the CC-NOT operator when the first control is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and second is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes I\otimes I+ P_1\otimes P_0\otimes(U-I)$&lt;/span&gt; is the CC-NOT operator when the first control is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and second is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes I\otimes I+ P_1\otimes P_1\otimes(U-I)$&lt;/span&gt; is the CC-NOT operator when both controls are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What I understood from these cases is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the second case  of &lt;span class=&quot;math-container&quot;&gt;$I\otimes I\otimes I+ P_0\otimes P_1\otimes(U-I)$&lt;/span&gt;. The first part of this operator does not check states of the first and second qubit i.e whether they are &lt;span class=&quot;math-container&quot;&gt;$00,01,10,11$&lt;/span&gt; and operates the identity on the third qubit, which it did have to do when the states were &lt;span class=&quot;math-container&quot;&gt;$00,10,11$&lt;/span&gt;, but because of the Identity operated when the controls were &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; is  not what was intended so we add the extra part with projection operators &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; with the target qubit being acted by &lt;span class=&quot;math-container&quot;&gt;$(U-I)$&lt;/span&gt;  to negate the effect produced when we did not check the states and acted on the third qubit with the identity operator. I have similar arguments for the rest of the cases. Are they correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the unitary transform that I want to implement on the third register controlled by the first two, that is, the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate.&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; are the projection operators onto &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2019-05-29T08:47:32.763" LastActivityDate="2019-05-29T08:47:32.763" Title="Are these notations for the CCNOT gate with different controls correct?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6264" PostTypeId="2" ParentId="6261" CreationDate="2019-05-28T19:45:30.767" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Is this just bad phrasing (or a typo) on Wikipedia's side, or am I missing something?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It does sound like bad phrasing. The idea here is that our set of observables is not necessarily mutually (pairwise) commuting. If you have three observables &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$[A,B]=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[B,C]=0$&lt;/span&gt;, then you're right that the measurement of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; will have no effect on &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and the measurement of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; will have no effect on the measurement of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. But the measurement statistics of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; will still be context-dependent if you have a two observable set i.e. it'll depend on whether you have &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; in your set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if you have all three, then there's some uncertainty in the joint measurement statistics. In other words, given well-defined marginal distributions &lt;span class=&quot;math-container&quot;&gt;$P(a,b|A,B)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(b,c|B,C)$&lt;/span&gt;, you cannot have a well-defined joint probability distribution &lt;span class=&quot;math-container&quot;&gt;$P(a,b,c|A,B,C)$&lt;/span&gt; in this case (although interestingly, the uncertainty can be lower bounded in many cases).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some nice lectures on this topic:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=fZdmv6HC5OM&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture on Quantum Contextuality by Dr. Pawel Kurzynski&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=VT9YGrsMy1c&quot; rel=&quot;nofollow noreferrer&quot;&gt;Algorithmic Approach to Quantum Contextuality by Prof. Dagomir Kaszlikowski&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Rjv2Z9tSodM&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Contextuality and Quantum Cryptography by Prof. Arvind&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-28T20:03:52.883" LastActivityDate="2019-05-28T20:03:52.883" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6265" PostTypeId="2" ParentId="6263" CreationDate="2019-05-28T20:42:49.213" Score="4" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both &lt;span class=&quot;math-container&quot;&gt;$I \otimes I \otimes I + P_0 \otimes P_1 \otimes (U-I)$&lt;/span&gt; etc and the various CC-NOT are linear so in order to check equality of the operators, you only need to check on a basis. That is what you have done with the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-05-28T20:42:49.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6266" PostTypeId="1" CreationDate="2019-05-28T21:33:39.717" Score="1" ViewCount="73" Body="&lt;p&gt;Suppose I have the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^l/2}\sum_{i=0}^{2^l-1}|0\rangle^{\otimes q}\otimes |i\rangle^{\otimes}|0\rangle_i^{\otimes l}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I perform some unitary transformation between the registers   &lt;span class=&quot;math-container&quot;&gt;$|i\rangle^{\otimes}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_i^{\otimes l} $&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That unitary operation is just the permutation, i.e. for each    &lt;span class=&quot;math-container&quot;&gt;$|i\rangle^{\otimes l}|$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$0\rangle_i^{\otimes l}$&lt;/span&gt; stores the permutation of &lt;span class=&quot;math-container&quot;&gt;$    |i\rangle^{\otimes l} $&lt;/span&gt;. Originally each &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes q}$&lt;/span&gt; corresponded to each &lt;span class=&quot;math-container&quot;&gt;$ |i\rangle^{\otimes}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now I want that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes q}$&lt;/span&gt; be associated to the permuted value stored in &lt;span class=&quot;math-container&quot;&gt;$ |0\rangle_i^{\otimes l}$&lt;/span&gt; correspinding to &lt;span class=&quot;math-container&quot;&gt;$|i\rangle^{\otimes l}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example initially I have the  pairs &lt;span class=&quot;math-container&quot;&gt;$(5,0), (10,1), (45,2), (59,3)$&lt;/span&gt;&#xA; Now I perform the permutation on the second coordinate to obtain &lt;span class=&quot;math-container&quot;&gt;$0\to 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1\to 3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2\to 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ 3 \to 2$&lt;/span&gt;. So now I want pairs to be &lt;span class=&quot;math-container&quot;&gt;$ (5,1), (10,3),  (45,0), (59,2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can this be obtained? Can someone help me out?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I give what i think of the solution. Consider an example of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; states as ignore the normalizing factor. &lt;span class=&quot;math-container&quot;&gt;$$|A\rangle= |5\rangle |0\rangle|0\rangle+|10\rangle |1\rangle|0\rangle+|45\rangle |2\rangle|0\rangle+|59\rangle |3\rangle|0\rangle$$&lt;/span&gt; Now i apply the permutation on the second register to  store the result in the third register to get &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|B\rangle= |5\rangle |0\rangle|1\rangle+|10\rangle |1\rangle|3\rangle+|45\rangle |2\rangle|0\rangle+|59\rangle |3\rangle|2\rangle$$&lt;/span&gt; Now i swap the second and third qubits to get &lt;span class=&quot;math-container&quot;&gt;$$|C\rangle= |5\rangle |1\rangle|0\rangle+|10\rangle |3\rangle|1\rangle+|45\rangle |0\rangle|2\rangle+|59\rangle |2\rangle|3\rangle$$&lt;/span&gt; Now since the third register is just the Hadamard on &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits, so i apply Hadamard on the third register of state &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt; to get &lt;span class=&quot;math-container&quot;&gt;$$|D\rangle= |5\rangle |1\rangle|0\rangle+|10\rangle |3\rangle|0\rangle+|45\rangle |0\rangle|0\rangle+|59\rangle |2\rangle|0\rangle$$&lt;/span&gt; Is this reasoning correct?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2019-05-29T15:26:14.640" LastActivityDate="2019-05-29T15:26:14.640" Title="Quantum operation involving permutation" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6268" PostTypeId="1" AcceptedAnswerId="6270" CreationDate="2019-05-29T04:38:01.930" Score="2" ViewCount="306" Body="&lt;p&gt;What happens when an operator is applied only to some bits of a mixed state? &#xA;For instance, assume &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle\vert f(x)\rangle$&lt;/span&gt; is entangled. Then what is the result of &lt;span class=&quot;math-container&quot;&gt;$\vert Ux\rangle\vert f(x)\rangle$&lt;/span&gt; (how to compute the amplitudes) ?&#xA;What if U is Grover's diffusion? Will it still work (without uncomputing &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;) ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; replaced with &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7607" LastEditorUserId="7607" LastEditDate="2019-05-29T09:13:42.313" LastActivityDate="2019-05-29T09:13:42.313" Title="What happens when an operator is applied only to some bits of a mixed state?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6269" PostTypeId="2" ParentId="6268" CreationDate="2019-05-29T06:35:25.590" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|#1\rangle}\ket{x}\ket{y}$&lt;/span&gt; is a pure state, not mixed, and is a product state, which is not entangled by definition, so your example is rather confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer the question in your first sentence, applying a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U_A$&lt;/span&gt; to one subsystem of a bipartite system is equivalent to applying the operator &lt;span class=&quot;math-container&quot;&gt;$U_A\otimes\mathbb{1}_B$&lt;/span&gt; to the whole system, where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{1}_B$&lt;/span&gt; is the identity for subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, so you can treat &lt;span class=&quot;math-container&quot;&gt;$U_A\otimes\mathbb{1}_B$&lt;/span&gt; as one big unitary and apply it how you normally would. If you have a pure state &lt;span class=&quot;math-container&quot;&gt;$\ket\psi = \sum_i \psi_i \ket{i}_A \otimes \ket{i}_B$&lt;/span&gt;, this means that applying such unitary gives &lt;span class=&quot;math-container&quot;&gt;$\sum_i \psi_i (U_A \ket{i}_A) \otimes \ket{i}_B$&lt;/span&gt;, and analogously for a mixed state.&lt;/p&gt;&#xA;" OwnerUserId="7495" LastActivityDate="2019-05-29T06:35:25.590" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6270" PostTypeId="2" ParentId="6268" CreationDate="2019-05-29T07:03:16.910" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle = |x\rangle\otimes |y\rangle$&lt;/span&gt; is the notation for disentangled state. Entangled state can't be written this way. In general, every pure state (entangled or disentangled) on a bipartite system is a linear combination of disentangled states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle_{AB} = \sum_i \alpha_i |x_i\rangle_A\otimes|y_i\rangle_B&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the first subsystem is equivalent to application of &lt;span class=&quot;math-container&quot;&gt;$U \otimes I$&lt;/span&gt; on the whole system. The result will be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(U\otimes I) |\phi\rangle_{AB} = \sum_i \alpha_i U|x_i\rangle_A\otimes|y_i\rangle_B&#xA;$$&lt;/span&gt;&#xA;Mixed state is a different thing (do not confuse it with entangled state). Mixed state can be seen as probability distribution over pure states: &lt;span class=&quot;math-container&quot;&gt;$\{\{p_i,|\phi_i\rangle\}\}, p_i&amp;gt;0, \sum_ip_i=1$&lt;/span&gt;. It has the corresponding density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_ip_i|\phi_i\rangle\langle\phi_i|$&lt;/span&gt;. Note that every &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; can be entangled.&lt;br&gt;&#xA;The result of application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the first subsystem of a mixed state is the probability distribution &lt;span class=&quot;math-container&quot;&gt;$\{\{p_i,(U\otimes I)|\phi_i\rangle\}\}$&lt;/span&gt;, or, in terms of density matrices, &lt;span class=&quot;math-container&quot;&gt;$(U\otimes I) \rho (U^\dagger\otimes I)$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-05-29T07:29:34.987" LastActivityDate="2019-05-29T07:29:34.987" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6271" PostTypeId="1" AcceptedAnswerId="6272" CreationDate="2019-05-29T12:17:39.807" Score="2" ViewCount="114" Body="&lt;p&gt;So I always had this idea in my mind that unitary evolution in quantum mechanics conserves information (or in other words von Neumann entropy) because unitary evolution preserves the trace. But this cannot be true because general evolution with a superoperator (&lt;span class=&quot;math-container&quot;&gt;$\$\rho \rightarrow \rho'$&lt;/span&gt;) of a mixed state does not preserve information and is also trace preserving!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what property of unitary evolution preserves the von Neumann entropy? As it is defined as &lt;span class=&quot;math-container&quot;&gt;$S = -tr(\rho \log \rho)$&lt;/span&gt; and we can always bring this in diagonal form &lt;span class=&quot;math-container&quot;&gt;$S= -\sum_i \lambda_i \log \lambda_i$&lt;/span&gt;, I would expect unitary evolution to preserve the eigenvalues? But I don't find any thing related to this online... Does unitarity imply that &quot;eigenvalues&quot; are conserved or what property makes sure that the entropy is conserved?&lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="10480" LastEditDate="2021-03-20T06:10:22.530" LastActivityDate="2021-03-20T06:10:22.530" Title="What property ensures that von Neumann entropy is conserved?" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6272" PostTypeId="2" ParentId="6271" CreationDate="2019-05-29T13:11:25.670" Score="2" Body="&lt;p&gt;Yes, unitarity preserves eigenvalues. This is because the definition of eigenvalues is that any Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be brought into diagonal form by a unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;VHV^\dagger=D,&#xA;$$&lt;/span&gt;&#xA;and the diagonal elements of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; are the eigenvalues. So, now consider &lt;span class=&quot;math-container&quot;&gt;$UHU^\dagger$&lt;/span&gt;. This can be diagonalised by a unitary &lt;span class=&quot;math-container&quot;&gt;$VU^\dagger$&lt;/span&gt; into the same matrix &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(VU^\dagger)UHU^\dagger(VU^\dagger)^\dagger=VU^\dagger UHU^\dagger UV^\dagger=VHV^\dagger=D.&#xA;$$&lt;/span&gt;&#xA;Hence the eigenvalues are the same, and the von Neumann entropy is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having a constrant trace is a necessary condition for preserving the eigenvalues, but is not sufficient - it only ensures that &lt;span class=&quot;math-container&quot;&gt;$\sum_i\lambda_i$&lt;/span&gt; is constant.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-29T13:11:25.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6273" PostTypeId="2" ParentId="6235" CreationDate="2019-05-29T14:57:55.710" Score="4" Body="&lt;p&gt;For experiments run on the simulator, &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;, no credits are used. For all real devices available, running any experiment uses credits. The different amount of credits used depends on the amount of &lt;code&gt;shots&lt;/code&gt; requested. Currently, there are only 4 options for amount of &lt;code&gt;shots&lt;/code&gt; when running a circuit in the composer in the new IBM Q Experience beta. You can choose between 1, 1024, 4096, or 8192 &lt;code&gt;shots&lt;/code&gt;. I believe if you choose 1 or 1024, it will require 3 credits. If you choose 4096 or 8192, it will require 5 credits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not believe there is any indication on the beta as to how many credits you have/have used. You can view credits used on specific jobs by going to their respective results page, though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The platform is still in beta, so these are features that can be added in the future as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, credits refresh upon the greater of the following: 24 hours or until your most recent job execution has completed.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-05-29T14:57:55.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6274" PostTypeId="1" AcceptedAnswerId="6275" CreationDate="2019-05-29T17:38:43.893" Score="2" ViewCount="481" Body="&lt;p&gt;How can one construct a CCY gate using gates which are native to Qiskit (CCX and single qubit gates). I was able to find the answer for CCZ gates, however guessing and testing until I can figure out CCY seems like a bad way to go.&lt;/p&gt;&#xA;" OwnerUserId="7609" LastEditorUserId="7609" LastEditDate="2019-06-05T18:11:13.613" LastActivityDate="2019-06-05T18:11:13.613" Title="How to construct a CCY gate in Qiskit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6275" PostTypeId="2" ParentId="6274" CreationDate="2019-05-29T17:53:53.297" Score="5" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CC} Y$&lt;/span&gt;, given that you have a decomposition for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CC} Z$&lt;/span&gt; (or for &lt;span class=&quot;math-container&quot;&gt;$\textrm{CC} X = \mathrm{Toffoli}$&lt;/span&gt;), all you need is the relationship between &lt;span class=&quot;math-container&quot;&gt;$ X$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Y = R_z (-\tfrac\pi2) X R_z (\tfrac\pi2) = R_x (\tfrac\pi2) Z R_x(-\tfrac\pi2) $$&lt;/span&gt;&#xA;Then, given &lt;span class=&quot;math-container&quot;&gt;$Y = U P U^\dagger$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; for which you know a decomposition for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CC} P$&lt;/span&gt;, simply do the analogous decomposition:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{CC}Y = (\mathbf 1 \otimes \mathbf 1 \otimes U) \mathrm{CC} P (\mathbf 1 \otimes \mathbf 1 \otimes U)^\dagger. $$&lt;/span&gt;&#xA;You can do this for any self-inverse unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; in place of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; as well. &lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-05-29T17:53:53.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6276" PostTypeId="1" AcceptedAnswerId="6278" CreationDate="2019-05-29T18:22:00.130" Score="3" ViewCount="164" Body="&lt;p&gt;So this is about something from Preskill's notes on Quantum Computation and Information, Chapter 4, page 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine we have a maximally entangled state (Bell state). We can identify the Bell state by measuring the phase and parity bit with the &lt;strong&gt;commuting&lt;/strong&gt; operators&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_1^A \otimes \sigma_1^B \\&#xA;\sigma_3^A \otimes \sigma_3^B$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now they want to show that you cannot do this locally, so when Alice and Bob both are spacelike separated and can only do measurements on their own qubit A and B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Preskill, they can start by measuring &lt;span class=&quot;math-container&quot;&gt;$\sigma_3^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \sigma_3^B$&lt;/span&gt; each on their own, and because this commutes with &lt;span class=&quot;math-container&quot;&gt;$\sigma_3^A \otimes \sigma_3^B$&lt;/span&gt;, this does not disturb the parity bit. So they prepared a simultaneous eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\sigma_3^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \sigma_3^B$&lt;/span&gt;. These eigenstates do not commute with &lt;span class=&quot;math-container&quot;&gt;$ \sigma_1^A \otimes \sigma_1^B$&lt;/span&gt; so they disturbed the phase bit so they cannot measure it. Conclusion: they cannot read the information that is in the entanglement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my real question now is: why do the first two observables &lt;span class=&quot;math-container&quot;&gt;$ \sigma_1^A \otimes \sigma_1^B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$&#xA;\sigma_3^A \otimes \sigma_3^B$&lt;/span&gt; commute, when &lt;span class=&quot;math-container&quot;&gt;$\sigma_3^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \sigma_3^B$&lt;/span&gt; will not commute with &lt;span class=&quot;math-container&quot;&gt;$ \sigma_1^A \otimes \sigma_1^B$&lt;/span&gt;. Because in my opinion, we can write the effect of the measurement of Alice and Bob on the state as;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_3^A \otimes I^B \\&#xA;I^A \otimes \sigma_3^B$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which, when measured after each other will have the effect on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\sigma_3^A \otimes I^B)&#xA;(I^A \otimes \sigma_3^B) |\psi\rangle = \sigma_3^A \otimes \sigma_3^B |\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the original measurement that can be done when both qubits are at the same place? So what is the difference, why is this not the same eigenstate? I must be missing something, but I don't see where I make an error. Can someone please explain.&lt;/p&gt;&#xA;" OwnerUserId="6276" LastEditorUserId="26" LastEditDate="2019-05-29T21:09:07.290" LastActivityDate="2019-05-29T22:56:08.773" Title="Simultaneous eigenstate of commuting observables and their tensor product" Tags="&lt;quantum-information&gt;&lt;entanglement&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6277" PostTypeId="2" ParentId="3786" CreationDate="2019-05-29T18:34:59.843" Score="3" Body="&lt;p&gt;@DrHamed : you could have done this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from sklearn import datasets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A lot of datasets are available in that import. &lt;a href=&quot;https://scikit-learn.org/stable/datasets/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://scikit-learn.org/stable/datasets/index.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7344" LastActivityDate="2019-05-29T18:34:59.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6278" PostTypeId="2" ParentId="6276" CreationDate="2019-05-29T21:42:36.990" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Measuring an &lt;strong&gt;observable&lt;/strong&gt; does &lt;em&gt;not&lt;/em&gt; mean applying the &lt;a href=&quot;https://en.wikipedia.org/wiki/Measurement_in_quantum_mechanics#Measurable_quantities_(%22observables%22)_as_operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;observable operator&lt;/a&gt; to a quantum state but rather measuring the state in the eigenbasis of the operator. A measurement will basically produce an eigenvalue of that observable operator and the system will collapse to a subspace corresponding to all states having that eigenvalue. For example, if you're measuring in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; basis, then you'll get either &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; corresponding to the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; corresponding to the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. Similarly, if you measure in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_3$&lt;/span&gt; basis then you'll either get &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; corresponding to the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; corresponding to the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The fact that &lt;span class=&quot;math-container&quot;&gt;$\sigma_3^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_3^B$&lt;/span&gt; do not commute with &lt;span class=&quot;math-container&quot;&gt;$\sigma_1^A\otimes \sigma_1^B$&lt;/span&gt; is a purely mathematical artefact and it's easy to prove along &lt;a href=&quot;https://math.stackexchange.com/a/2804083/568976&quot;&gt;these&lt;/a&gt; lines. There's  also a technical mistake in your sentence: &quot;These &lt;strong&gt;eigenstates do not commute&lt;/strong&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sigma_1^A\otimes \sigma_1^B$&lt;/span&gt; so they disturbed the phase bit so they cannot measure it.&quot;; it's meaningless to say that a state doesn't commute with an operator — commutators are only defined for operators. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-05-29T22:56:08.773" LastActivityDate="2019-05-29T22:56:08.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6279" PostTypeId="1" CreationDate="2019-05-30T04:14:24.293" Score="1" ViewCount="68" Body="&lt;p&gt;I'm working on QSVM to know the difference between SVM and QSVM. How much better quantum machine learning can do when compared to classical machine learning algorithms? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend = BasicAer.get_backend('qasm_simulator', hub=None)&#xA;quantum_instance = QuantumInstance(backend, shots=1024, seed=seed, &#xA;                                     seed_transpiler=seed)&#xA;result = qsvm.run(quantum_instance) &#xA;print(&quot;test accuracy: &quot;, result['testing_accuracy'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above code, I can get the accuracy of the test. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to know whether I can draw a decision boundary and classify results from QSVM just like how classical SVM does. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(result.keys())&#xA;&#xA;    dict_keys(['svm', 'kernel_matrix_testing', 'test_success_ratio', 'kernel_matrix_training', 'testing_accuracy'])&#xA;&#xA;print (result['svm'].keys())&#xA;&#xA;    dict_keys(['bias', 'alphas', 'support_vectors', 'yin'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given only these are the keys that result has, how can I look at QSVM results into two classes graphically? I could get the prediction results though! &#xA;my new_test_data= 2d array to classify between these two classes : good=1/ bad=0&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;predictions = qsvm.predict(new_test_data,quantum_instance)&#xA;print(predictions)&#xA;    [1 0 0 0 0 0 0 0 1 1 0 1 1 0 1 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given I don't see how get decision function and be able to plot decision boundary and margins? Like this as we do in classical SVM:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lTGK7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lTGK7.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help in clarifying how to read the results to plot a graph like this from running QSVM would be much appreciated.  &lt;/p&gt;&#xA;" OwnerUserId="7344" LastEditorUserId="26" LastEditDate="2019-05-30T14:29:02.663" LastActivityDate="2019-05-30T14:29:02.663" Title="How to plot decision boundary with support vectors when running quantum SVM algorithm?" Tags="&lt;programming&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6281" PostTypeId="1" CreationDate="2019-05-30T04:41:32.467" Score="5" ViewCount="92" Body="&lt;p&gt;The Pauli Z gate inverts the phase of &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle $&lt;/span&gt; while leaving &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; unaffected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I think about how &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; are physically realized, however, as in the Physical Implementations section &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, there tends to be a physical symmetry between the physical realizations of the two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would seem, then, that a Z gate would need to be realized as some experiment which selectively delays the tuning of only spin-up electrons or nuclei, for example. Given the physical symmetry I expect between physical realizations of &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt;, this seems counterintuitive. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the fact that a physical &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; cannot have phase delay, and a physical &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; can, a matter of convention? If not, why can't I describe a single &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; in a multi-qubit system as phase delayed relative to the others? E.g., &lt;span class=&quot;math-container&quot;&gt;$(I \otimes Z)\lvert10\rangle$&lt;/span&gt; seems to be a perfectly reasonable experiment that delays my right qubit relative to my left, why is only the converse experiment allowed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it, in fact, the case that the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate is implemented as an experiment that only affects, e.g., spin-up nuclei but not spin-down nuclei? As background, I'd find an overview of how phase is physically implemented very helpful.&lt;/p&gt;&#xA;" OwnerUserId="7610" LastEditorUserId="26" LastEditDate="2019-05-30T14:34:31.597" LastActivityDate="2020-02-24T20:02:55.403" Title="How do physical implementations of Z gate selectively affect $\lvert1\rangle $ basis vector?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6282" PostTypeId="2" ParentId="6108" CreationDate="2019-05-30T07:02:03.223" Score="1" Body="&lt;p&gt;Numerators and denominators of convergents of continued fractions are always co-prime. If &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; have a common factor, the &lt;span class=&quot;math-container&quot;&gt;$r'$&lt;/span&gt; returned by the continued fractions algorithm would be a factor of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. &lt;br&gt;&#xA;For example, &lt;span class=&quot;math-container&quot;&gt;$r=60$&lt;/span&gt;, provided the phase estimation step gives a good approximate to &lt;span class=&quot;math-container&quot;&gt;$40/60$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$s=40$&lt;/span&gt;), you'll get &lt;span class=&quot;math-container&quot;&gt;$2/3$&lt;/span&gt; as a convergent. Performing the phase estimation again might give you a good approximate to &lt;span class=&quot;math-container&quot;&gt;$21/60$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$s=21$&lt;/span&gt;), and you'll get &lt;span class=&quot;math-container&quot;&gt;$7/20$&lt;/span&gt; as a convergent. &lt;span class=&quot;math-container&quot;&gt;$lcm(3,20)=60$&lt;/span&gt; will give you the correct &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.&lt;br&gt;&#xA;Although doing phase estimation-CF twice doesn't guarantee the correctness of resultant &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; (e.g. if we got &lt;span class=&quot;math-container&quot;&gt;$40/60=2/3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$28/60=7/15$&lt;/span&gt; in our two attempts, &lt;span class=&quot;math-container&quot;&gt;$lcm(3,15)=15$&lt;/span&gt; does not give us the correct &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;), some number theoretic theorem guarantees that we succeed with probability at least &lt;span class=&quot;math-container&quot;&gt;$1/4$&lt;/span&gt; (see the last remark on the last page of &lt;a href=&quot;http://www.qi.damtp.cam.ac.uk/sites/default/files/QIC%20LectNotesFULL2019.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Prof Jozsa's Part II QI&amp;amp;C Notes&lt;/a&gt;).&lt;br&gt;&#xA;(P.S. I'll update my answer with the aforementioned theorem of number theory when I find it)&lt;/p&gt;&#xA;" OwnerUserId="7460" LastActivityDate="2019-05-30T07:02:03.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6283" PostTypeId="1" AcceptedAnswerId="6299" CreationDate="2019-05-30T09:33:54.660" Score="7" ViewCount="150" Body="&lt;p&gt;I'm having trouble accepting, intuitively, that  &lt;span class=&quot;math-container&quot;&gt;$-\rvert1\rangle \otimes \rvert1\rangle  = -\rvert11\rangle = \rvert1\rangle \otimes -\rvert1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's my understanding that &lt;span class=&quot;math-container&quot;&gt;$ -\rvert1\rangle$&lt;/span&gt; is just &lt;span class=&quot;math-container&quot;&gt;$\rvert1\rangle $&lt;/span&gt; but time or space delayed in phase, where what &quot;phase&quot; means here depends on the hardware realization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &lt;span class=&quot;math-container&quot;&gt;$-\rvert1\rangle \otimes \rvert1\rangle  = -\rvert11\rangle $&lt;/span&gt; suggests that, if I take 2 independent systems, with the first completely out-of-phase relative to the second because (by, e.g., a Z gate), and I look at these two systems together, the composite system is completely out of phase with &lt;span class=&quot;math-container&quot;&gt;$\rvert11\rangle $&lt;/span&gt; Somehow, I delayed one qubit, looked at it together with others, and suddenly all N of them are delayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the more, if I have &lt;span class=&quot;math-container&quot;&gt;$\rvert111\rangle$&lt;/span&gt;, phase delay the first qubit with a Z gate, I get &lt;span class=&quot;math-container&quot;&gt;$-\rvert1\rangle \otimes \rvert11\rangle$&lt;/span&gt;, but now I can reassign this phase delay to any qubit and say I have &lt;span class=&quot;math-container&quot;&gt;$\rvert11\rangle \otimes -\rvert1\rangle$&lt;/span&gt; . I.e., it's like saying qubits A-B are in phase together and collectively out of phase with qubit C, but that's the same as qubits B-C are in-phase and collectively out of phase with qubit A. This is a transitivity-violation contradiction of what we expect from equality! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My picture of phase is electrons precessing, or some other periodic process where physical objects corresponding to qubits are time delayed with definite time to each other. In this picture, phase can't be reassigned as will in the seeming contradiction I mentioned above. Is this picture incorrect?&lt;/p&gt;&#xA;" OwnerUserId="7610" LastEditorUserId="26" LastEditDate="2019-05-30T14:35:03.593" LastActivityDate="2019-06-01T15:09:46.807" Title="How to interpret $-\rvert1\rangle \otimes \rvert1\rangle = -\rvert11\rangle$?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6284" PostTypeId="2" ParentId="6283" CreationDate="2019-05-30T11:08:13.270" Score="-1" Body="&lt;p&gt;Maybe this is a suboptimal answer, which doesn't fully answer your question, but maybe it helps you understant why the global phase doesn't matter from a computational point of view (actually, it does matter from a physical point of view). In quantum computing, we manipulate states in the Hilbert space, represented by the Bloch sphere. And this sphere is not sensitive to global phases, i.e. phases multiplying by whole state. This is surely better explained &lt;a href=&quot;https://physics.stackexchange.com/a/351966/69106&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the visualization of that global phase introduced, picture the case of one qubit in the block sphere, in the |1&gt; state. A Z gate introduces a rotation over the Z axis, but in this case, the state is already fully projected over the Z axis, so no effect is noticeable (it would be like the state vector rotating over itself, which doesn't change the position in the Bloch sphere). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something similar would happen for a 2 qubit system, except it is harder to visualize because it is high-dimensional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As referred in the link I shared, this doesn't mean that the global phase doesn't have physical meaning. It does. But that physical meaning isn't captured by the Hilbert space  formalism (&lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt; for a single qubit), on which quantum computation relies. To detect a global phase you would have to look at the &lt;span class=&quot;math-container&quot;&gt;$C^3$&lt;/span&gt; formalism, I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: I work in quantum computing, and my advanced quantum physics knowledge is not as good as before...&lt;/p&gt;&#xA;" OwnerUserId="201" LastActivityDate="2019-05-30T11:08:13.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6286" PostTypeId="2" ParentId="6281" CreationDate="2019-05-30T18:55:56.290" Score="1" Body="&lt;p&gt;You're exactly right about the physical symmetry of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If I handed you a spin-1/2 particle in complete vacuum, the question of whether its in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is meaningless without a preferred coordinate system. So there needs to be some physically preferred direction to even set up computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now say I have the ability to turn on an external magnetic field &lt;span class=&quot;math-container&quot;&gt;$\vec{B}$&lt;/span&gt;. When its turned on, its direction automatically sets a preferred coordinate system, and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are now defined as alignments of spins parallel or antiparallel to the field. Physically, this is because a spin-1/2 particle with some dipole moment &lt;span class=&quot;math-container&quot;&gt;$\vec{\mu}$&lt;/span&gt; interacts with the field &lt;span class=&quot;math-container&quot;&gt;$\vec{B}$&lt;/span&gt; according to the Hamiltonian&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = - \vec{\mu} \cdot \vec{B}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which really just tells us how much energy our particles will have in the external field. Then, we'll choose a convention that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the low-energy state (say &lt;span class=&quot;math-container&quot;&gt;$E_0=0$&lt;/span&gt; for simplicity) and we're ready to compute! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case a Z-gate would just be flipping on the external field for some known time &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, which corresponds to a time-evolution of &lt;span class=&quot;math-container&quot;&gt;$e^{-i H \tau/\hbar}$&lt;/span&gt;. This has the effect:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|0\rangle &amp;amp;\rightarrow |0\rangle \\&#xA;|1\rangle &amp;amp;\rightarrow -|1\rangle &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not only does this describe spin qubits, but also simple superconducting qubits like charge qubits. Charge qubits were originally called &quot;Cooper Pair Box&quot; because they work by trapping a cooper pair (of charge &lt;span class=&quot;math-container&quot;&gt;$2e$&lt;/span&gt;) on a superconducting island separated from the grounded material by some distance.  In a toy geometry, we'll say this distance is  &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, so that the trapped CP creates an electric dipole &lt;span class=&quot;math-container&quot;&gt;$|\vec{d}| = 2ex$&lt;/span&gt;. Now just add an external field to interact with this dipole and you're ready to apply quantum gates.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-05-30T18:55:56.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6287" PostTypeId="1" CreationDate="2019-05-30T19:45:19.607" Score="4" ViewCount="64" Body="&lt;p&gt;Say I have an algorithm over N qubits and I want to find the expectation value of an operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; composed of a sum of mterms, each of which is the tensor product of some number of single-qubit Pauli operators:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; O = \sum_{i=1}^m \alpha_i \prod_{j=1}^N \sigma_{\beta(i,j)}^{(j)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\beta(i,j) \in \{{0,1,2,3}\}$&lt;/span&gt; determines the identity of the j-th Pauli operator in the i-th product in the sum (&lt;span class=&quot;math-container&quot;&gt;$\sigma_0 \equiv I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_1 \equiv X$&lt;/span&gt;, ...) and &lt;span class=&quot;math-container&quot;&gt;$\sigma^{(j)}$&lt;/span&gt; denotes a Pauli operator acting on the j-th qubit. The goal is to determine the following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the minimum number of circuit experiments needed to completely evaluate &lt;span class=&quot;math-container&quot;&gt;$\langle O \rangle$&lt;/span&gt; (a &quot;circuit experiment&quot; means as many measurements as I want for a given configuration of measurement bases over  all N qubits)&lt;/li&gt;&#xA;&lt;li&gt;How do I find the elements of the maximally reduced set of measurement bases that accomplish (1).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example a&lt;/strong&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O = Z_1 + Z_2 + Z_3 + Z_1 Z_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The minimum number of experiments is 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The maximally reduced set of measurement operators is &lt;span class=&quot;math-container&quot;&gt;$\{Z_1 Z_2 Z_3\}$&lt;/span&gt;, which corresponds to measuring all three qubits in the Z-basis. From outcomes of these measurement bases, I can separately compute &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 \rangle $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle Z_2 \rangle $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle Z_3 \rangle $&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_2 \rangle $&lt;/span&gt; and then add the results to find &lt;span class=&quot;math-container&quot;&gt;$\langle O \rangle$&lt;/span&gt;. In general, I'm allowed to combine terms that have identical Pauli products on their overlapping subspace.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example b&lt;/strong&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O = X_1 Y_2 + Y_1 X_2 + X_1 X_2 + Y_1 Y_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The minimum number of experiments is 4.&lt;/li&gt;&#xA;&lt;li&gt;The maximally reduced set is &lt;span class=&quot;math-container&quot;&gt;$\{ X_1 Y_2 , Y_1 X_2 , X_1 X_2 , Y_1 Y_2\}$&lt;/span&gt;. Even though in the course of measuring &lt;span class=&quot;math-container&quot;&gt;$\langle X_1 Y_2 \rangle$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$\langle Y_1 X_2\rangle$&lt;/span&gt; I measured both qubits in both bases, &lt;em&gt;I cannot reuse the results from those measurements to determine &lt;span class=&quot;math-container&quot;&gt;$\langle X_1 X_2 \rangle$&lt;/span&gt;&lt;/em&gt; because I lose any information about classical correlations in the outcomes of &lt;span class=&quot;math-container&quot;&gt;$X_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_2$&lt;/span&gt; (i.e. entanglement) if I try to combine their outcomes taken in two separate experiments.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, given an arbitrary &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; how do I find the minimum number of experiments and the corresponding maximally reduced set of measurements&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="26" LastEditDate="2019-05-30T19:47:03.650" LastActivityDate="2019-05-30T19:47:03.650" Title="How to determine the minimum number of experiments needed to compute m-many k-local Pauli expectations?" Tags="&lt;algorithm&gt;&lt;measurement&gt;&lt;simulation&gt;" AnswerCount="0" CommentCount="8" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6288" PostTypeId="2" ParentId="6262" CreationDate="2019-05-30T21:15:43.067" Score="6" Body="&lt;p&gt;At Xanadu, we're using &lt;a href=&quot;https://en.wikipedia.org/wiki/Integrated_quantum_photonics&quot; rel=&quot;noreferrer&quot;&gt;integrated quantum photonics&lt;/a&gt; to build our photonic quantum computing chips. In this case, we have integrated chips containing waveguides --- these are coupled to lasers to generate input resource states, undergo manipulation on the chip, and then are measured via a variety of detectors available in quantum optics. These can include &lt;a href=&quot;https://en.wikipedia.org/wiki/Photon_counting&quot; rel=&quot;noreferrer&quot;&gt;photon number resolvers&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Homodyne_detection&quot; rel=&quot;noreferrer&quot;&gt;homodyne detectors&lt;/a&gt;, or even &lt;a href=&quot;https://en.wikipedia.org/wiki/Optical_heterodyne_detection&quot; rel=&quot;noreferrer&quot;&gt;heterodyne detectors&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing to note is that there are several formulations for optical quantum computing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Non-universal formulations:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;noreferrer&quot;&gt;Boson sampling&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1612.01199&quot; rel=&quot;noreferrer&quot;&gt;Gaussian boson sampling&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Universal formulations:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_optical_quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;Linear optical quantum computing with the KLM protocol&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-variable_quantum_information&quot; rel=&quot;noreferrer&quot;&gt;Continuous-variable quantum computation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;At Xanadu, our focus is on the last approach, the continuous-variable formulation. In this approach, we are outside the regime of linear photonics, and actually include non-linear quantum photonic operations in our basic gate set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we also differ from the KLM protocol in that we do not depend on &lt;a href=&quot;https://en.wikipedia.org/wiki/Spontaneous_parametric_down-conversion&quot; rel=&quot;noreferrer&quot;&gt;single photon resource states&lt;/a&gt;, which can typically only be produced with a certain probability. Our resource states are instead &lt;a href=&quot;https://en.wikipedia.org/wiki/Squeezed_states_of_light&quot; rel=&quot;noreferrer&quot;&gt;squeezed states of light&lt;/a&gt;, which can be produced deterministically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more details on continuous-variables, the gates we use, and the algorithms available, &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/stable/index.html&quot; rel=&quot;noreferrer&quot;&gt;check out our documentation!&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="371" LastActivityDate="2019-05-30T21:15:43.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6289" PostTypeId="1" CreationDate="2019-05-30T22:16:09.670" Score="4" ViewCount="54" Body="&lt;p&gt;Hobbyist quantum programmer here and just getting back into the swing of things by speccing out some fun apps in my head and trying to build them to learn more about the whole ecosystem which is fascinating. I have a reasonable physics background but not the depth that some of the answers here go to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am getting some conflicting information and I suppose the crux of this is my understanding of the difference between observed and measured and what can actually collapse an entangled state Vs what can be understood. I am thinking through an Alice and Bob scenario where they share 2 entangled qubits and go about their separate ways. Alice goes and does something to her qubit (e.g a spin change or something similar). Does Bob know that something happened without making a measurement (which collapses the entanglement) or without Alice calling him to tell him what happened? My question here: Is Bob aware that something has happened? In the sense that he can detect/observe that something has happened but can't figure it out without one of the 2 scenarios above. I'm thinking of this as a pager kind of app, so Bob gets a notification that something has happened and he should call/expect a call from Alice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any possible entanglement scenarios where the above is feasible? I have read about weak entanglement, no-communication theorem and several articles on entanglement and measurement/observation. Every second search is giving me conflicting results, some say you can detect something. I'm less concerned about a perfect state being maintained, just that the overall entanglement remains in place.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastEditorUserId="26" LastEditDate="2019-05-31T00:01:14.460" LastActivityDate="2019-05-31T07:13:17.697" Title="Observing that some action has happened in an entanglement scenario" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6290" PostTypeId="1" CreationDate="2019-05-31T01:19:36.637" Score="5" ViewCount="41" Body="&lt;p&gt;Assume &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is n-bit to n-bit function. Let &lt;span class=&quot;math-container&quot;&gt;$F(x)$&lt;/span&gt; be defined as &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; iterations of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$F(x) = f^T(x)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum algorithm relies on &lt;span class=&quot;math-container&quot;&gt;$F(x)$&lt;/span&gt;; it calls it &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; times. &#xA;What is the best query complexity of the algorithm in terms of calls to &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we do better than &lt;span class=&quot;math-container&quot;&gt;$R \cdot T$&lt;/span&gt; queries while maintaining negligible quantum memory complexity?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we do better than &lt;span class=&quot;math-container&quot;&gt;$R \cdot T$&lt;/span&gt; queries with additional quantum memory? If so, then how much? Can we do less than &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;?  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7371" LastEditorUserId="26" LastEditDate="2019-05-31T01:22:36.607" LastActivityDate="2019-05-31T06:57:39.947" Title="Best query and memory complexity for iterated function" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6291" PostTypeId="2" ParentId="6290" CreationDate="2019-05-31T06:57:39.947" Score="2" Body="&lt;p&gt;That really depends on the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and the size of &lt;span class=&quot;math-container&quot;&gt;$R\cdot T$&lt;/span&gt;. Generically, I don't think that you can expect improvements over &lt;span class=&quot;math-container&quot;&gt;$R\cdot T$&lt;/span&gt;, but improvements are possible in some special cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, with the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, there's a similar question in classical, and there are instances where speedups are possible, such as modular exponentiation: &lt;span class=&quot;math-container&quot;&gt;$f(x)=x\text{ mod }N$&lt;/span&gt;. There are better ways of calculating &lt;span class=&quot;math-container&quot;&gt;$x^a\text{ mod }N$&lt;/span&gt; than just calculating &lt;span class=&quot;math-container&quot;&gt;$F^a(x)$&lt;/span&gt;, but it's specific to that function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want really large &lt;span class=&quot;math-container&quot;&gt;$R\cdot T$&lt;/span&gt;, or non-integer values, there are quantum algorithms based on phase estimation. You want to have a look at &lt;a href=&quot;https://arxiv.org/abs/0810.3843&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-31T06:57:39.947" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6292" PostTypeId="2" ParentId="6289" CreationDate="2019-05-31T07:13:17.697" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;the difference between observed and measured&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there a difference? What you observe &lt;em&gt;is&lt;/em&gt; what you measure. There are no other observations. (That said, what you know about a state is a combination of what you personally know about what measurements have been performed and their results, and the preparation procedure. Different people can have different knowledge, and hence different descriptions of the state.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am thinking through an Alice and Bob scenario where they share 2&#xA;  entangled qubits and go about their separate ways. Alice goes and does&#xA;  something to her qubit (e.g a spin change or something similar). Does&#xA;  Bob know that something happened without making a measurement (which&#xA;  collapses the entanglement) or without Alice calling him to tell him&#xA;  what happened?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Bob cannot know anything about what Alice has done without inputs. He has to gain information from somewhere. Think of this transmission of information as messages. Either messages that are sent from measurement apparatus saying &quot;I got measurement result X&quot;, or messages from Alice saying &quot;I did Y&quot;. But those messages have to come from somewhere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The crucial thing here is actually the message from Alice. Whatever measurements Bob performs on his qubit, he cannot tell what Alice did; his measurement results are consistent with Alice also having done nothing.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-05-31T07:13:17.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6293" PostTypeId="1" AcceptedAnswerId="6296" CreationDate="2019-05-31T15:06:08.070" Score="1" ViewCount="54" Body="&lt;p&gt;I have a basic question about the encoding of logical information into physical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only know the 3 qubit code (I have very limited knowledge in QEC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 3 qubit code is usually presented as: we have a data defined on a single qubit, we want to protect it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do it, we encode it on 3 physical qubits :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a|0\rangle + b |1\rangle \rightarrow a|000\rangle + b |111\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then by using ancillas, we check the parity and we know if a bit flip-occurred (in very short summary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice when we have a quantum computer, we encode the input in physical qubits (3 in this example), and then if we want to run a quantum algorithm, it will apply unitary on these 3 physical qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it more: we do everything with the single qubit and then at the end of the algorithm we protect by encoding the result on physical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me, it would make sense that it is the first explanation but I would like to check this, like how and where are implemented Q.E.C in a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;An example : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example imagine that my quantum algorithm is just applying a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on an input &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b |1\rangle$&lt;/span&gt;, would it work as :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b |1\rangle$&lt;/span&gt; : &lt;span class=&quot;math-container&quot;&gt;$U a|0\rangle + b |1\rangle = c |0\rangle + d |1\rangle $&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;I encode and protect it with QEC&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;or &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I encode : &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b |1\rangle \rightarrow a|000\rangle + b |111\rangle $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;I apply the &quot;logical equivalent&quot; &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; to the encoded data : &lt;span class=&quot;math-container&quot;&gt;$U_L a|000\rangle + b |111\rangle = c |000\rangle + d |111\rangle $&lt;/span&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="26" LastEditDate="2019-05-31T15:11:25.627" LastActivityDate="2019-06-01T05:50:01.573" Title="Where (in the algorithm) is the logical qubit encoded in Q.E.C?" Tags="&lt;algorithm&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6294" PostTypeId="2" ParentId="4411" CreationDate="2019-05-31T17:52:14.170" Score="2" Body="&lt;p&gt;There is currently no way to check the status of a job in Qiskit Aqua: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/issues/545&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/issues/545&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it looks like it is a feature that is coming.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-05-31T17:52:14.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6295" PostTypeId="1" CreationDate="2019-06-01T03:32:44.193" Score="2" ViewCount="945" Body="&lt;p&gt;I'm trying to run QSVM algorithm in IBMQ experience, want to run in one of those real quantum computers. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; from qiskit import IBMQ&#xA; IBMQ.load_accounts()&#xA; print(&quot;Available backends:&quot;)&#xA; IBMQ.backends()&#xA;&#xA; [&amp;lt;IBMQSimulator('ibmq_qasm_simulator') from IBMQ(ibm-q, open, main)&amp;gt;,&#xA;  &amp;lt;IBMQBackend('ibmqx4') from IBMQ(ibm-q, open, main)&amp;gt;,&#xA;  &amp;lt;IBMQBackend('ibmqx2') from IBMQ(ibm-q, open, main)&amp;gt;,&#xA;  &amp;lt;IBMQBackend('ibmq_16_melbourne') from IBMQ(ibm-q, open, main)&amp;gt;,&#xA;  &amp;lt;IBMQSimulator('ibmq_qasm_simulator') from IBMQ()&amp;gt;]&#xA;&#xA;&#xA;backend = BasicAer.get_backend('ibmq_qasm_simulator')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the BasicAer I realize I'm using IBMQ's simulator and not the actual IBMQ device. if I chose 'ibmq_qasm_simulator', it works!!!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; device = IBMQ.get_backend('ibmq_16_melbourne') # ibmx4&#xA; #Choose a real - device&#xA;&#xA; quantum_instance = QuantumInstance(device, shots=100, seed=seed, &#xA;                                      seed_transpiler=seed)&#xA; result = qsvm.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code which is supposed to use real Quantum computer &quot;ibmq_16_melbourne&quot; throws me a&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;KeyError                                  Traceback (most recent call last)&#xA;&amp;lt;ipython-input-19-b7c0ec9bc7c4&amp;gt; in &amp;lt;module&amp;gt;&#xA;  1 &#xA;----&amp;gt; 2 result = qsvm.run(quantum_instance)&#xA;  3 print(&quot;testing success ratio: &quot;, result['testing_accuracy'])&#xA;  4 end = timer()&#xA;  5 print(&quot;timedelta: &quot; , timedelta(seconds=end-start))&#xA;&#xA;/opt/conda/lib/python3.7/site- &#xA; packages/qiskit/aqua/algorithms/quantum_algorithm.py &#xA; in run(self, quantum_instance, **kwargs)&#xA; 62                 quantum_instance.set_config(**kwargs)&#xA; 63             self._quantum_instance = quantum_instance&#xA; ---&amp;gt; 64         return self._run()&#xA; 65 &#xA; 66     @abstractmethod&#xA;&#xA;/opt/conda/lib/python3.7/site- &#xA;packages/qiskit/aqua/algorithms/many_sample/qsvm/qsvm.py in _run(self)&#xA;306 &#xA;307     def _run(self):&#xA;--&amp;gt; 308         return self.instance.run()&#xA;309 &#xA;310     @property&#xA;&#xA;/opt/conda/lib/python3.7/site- &#xA;packages/qiskit/aqua/algorithms/many_sample/qsvm/_qsvm_binary.py in run(self)&#xA;127     def run(self):&#xA;128         &quot;&quot;&quot;Put the train, test, predict together.&quot;&quot;&quot;&#xA;--&amp;gt; 129         self.train(self._qalgo.training_dataset[0], &#xA;self._qalgo.training_dataset[1])&#xA;130         if self._qalgo.test_dataset is not None:&#xA;131             self.test(self._qalgo.test_dataset[0], &#xA;self._qalgo.test_dataset[1])&#xA;&#xA;/opt/conda/lib/python3.7/site- &#xA;packages/qiskit/aqua/algorithms/many_sample/qsvm/_qsvm_binary.py in train(self, &#xA;data, labels)&#xA; 71         &quot;&quot;&quot;&#xA; 72         scaling = 1.0 if self._qalgo.quantum_instance.is_statevector else &#xA;None&#xA;---&amp;gt; 73         kernel_matrix = self._qalgo.construct_kernel_matrix(data)&#xA; 74         labels = labels * 2 - 1  # map label from 0 --&amp;gt; -1 and 1 --&amp;gt; 1&#xA; 75         labels = labels.astype(np.float)&#xA;&#xA;/opt/conda/lib/python3.7/site- &#xA;packages/qiskit/aqua/algorithms/many_sample/qsvm/qsvm.py in &#xA;construct_kernel_matrix(self, x1_vec, x2_vec, quantum_instance)&#xA;243                                     &#xA;num_processes=aqua_globals.num_processes)&#xA;244 &#xA;--&amp;gt; 245             results = self.quantum_instance.execute(circuits)&#xA;246 &#xA;247             if logger.isEnabledFor(logging.DEBUG):&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/quantum_instance.py in &#xA;execute(self, circuits, **kwargs)&#xA;192         qobjs = compile_circuits(circuits, self._backend, &#xA;self._backend_config, self._compile_config, self._run_config,&#xA;193                                  &#xA;show_circuit_summary=self._circuit_summary, circuit_cache=self._circuit_cache,&#xA;--&amp;gt; 194                                  **kwargs)&#xA;195 &#xA;196         if self._measurement_error_mitigation_cls is not None:&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/utils/run_circuits.py in &#xA;compile_circuits(circuits, backend, backend_config, compile_config, run_config, &#xA;show_circuit_summary, circuit_cache, **kwargs)&#xA;195                     transpiled_sub_circuits = &#xA;compiler.transpile(sub_circuits, backend, **backend_config,&#xA;196                                                                  &#xA;**compile_config)&#xA;--&amp;gt; 197                     qobj = &#xA;circuit_cache.load_qobj_from_cache(transpiled_sub_circuits, i, &#xA;run_config=run_config)&#xA;198                 else:&#xA;199                     qobj = circuit_cache.load_qobj_from_cache(sub_circuits, &#xA;i, run_config=run_config)&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/utils/circuit_cache.py in &#xA;load_qobj_from_cache(self, circuits, chunk, run_config)&#xA;178                 if not hasattr(compiled_gate, 'params') or &#xA;len(compiled_gate.params) &amp;lt; 1: continue&#xA;179                 if compiled_gate.name == 'snapshot': continue&#xA;--&amp;gt; 180                 cache_index = self.mappings[chunk][circ_num][gate_num]&#xA;181                 (uncompiled_gate, regs, _) = raw_gates[cache_index]&#xA;182 &#xA;&#xA;KeyError: 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is my qiskit version via pip: qiskit 0.10.1&#xA;qiskit-aer 0.2.0&#xA;qiskit-aqua 0.5.0&#xA;qiskit-chemistry 0.5.0&#xA;qiskit-ibmq-provider 0.2.2&#xA;qiskit-ignis 0.1.1&#xA;qiskit-terra 0.8.0&lt;/p&gt;&#xA;" OwnerUserId="7344" LastEditorUserId="7344" LastEditDate="2019-06-02T07:35:47.210" LastActivityDate="2019-06-02T07:35:47.210" Title="How to run quantum SVM algorithm from Qiskit in real IBM Quantum Computer using IBMQ?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="6296" PostTypeId="2" ParentId="6293" CreationDate="2019-06-01T05:50:01.573" Score="2" Body="&lt;p&gt;The whole point of encoding in an error correcting code is to protect against errors. You only get that protection while encoded. So you want to apply any unitaries on the encoded state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-01T05:50:01.573" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6297" PostTypeId="1" CreationDate="2019-06-01T06:46:05.537" Score="2" ViewCount="63" Body="&lt;p&gt;I have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; states in superposition &lt;span class=&quot;math-container&quot;&gt;$|A\rangle=\dfrac{1}{2^{l/2}}\sum_{i=0}^{2^l-1}\sum_{j=0}^{2^l-1}|0\rangle^{\otimes q}|i\rangle^{\otimes l}|j\rangle^{\otimes l}$&lt;/span&gt;. Now I have to apply the transform in batches of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; i.e for example Let &lt;span class=&quot;math-container&quot;&gt;$l=2$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$$A= \dfrac{1}{2^{2/2}}\left( |0\rangle^{\otimes q}|00\rangle|00\rangle+ |0\rangle^{\otimes q}|00\rangle|01\rangle+|0\rangle^{\otimes q}|00\rangle|10\rangle+|0\rangle^{\otimes q}|00\rangle|11\rangle+|0\rangle^{\otimes q}|01\rangle|00\rangle+|0\rangle^{\otimes q}|01\rangle|01\rangle+|0\rangle^{\otimes q}|01\rangle|10\rangle+|0\rangle^{\otimes q}|01\rangle|11\rangle+|0\rangle^{\otimes q}|10\rangle|00\rangle+|0\rangle^{\otimes q}|10\rangle|01\rangle+|0\rangle^{\otimes q}|10\rangle|10\rangle+|0\rangle^{\otimes q}|10\rangle|11\rangle+|0\rangle^{\otimes q}|11\rangle|00\rangle+|0\rangle^{\otimes q}|11\rangle|01\rangle+|0\rangle^{\otimes q}|11\rangle|10\rangle+|0\rangle^{\otimes q}|11\rangle|11\rangle\right)$$&lt;/span&gt;Now as there are &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; states in superposition here, I need to apply a unitary transform to &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; states at at a time i.e the first &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;, then the second &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; , then the third &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; , then the last &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;. The transform that I apply every time on the four states is on the first register &lt;span class=&quot;math-container&quot;&gt;$0\rangle^{\otimes q}$&lt;/span&gt; of each state. The unitary transform between these states is &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.  How would the tensorial notation of this state look like is my question? How do I give the right notation that the operator acts on &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; states and then the next four is my doubt. &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-06-01T09:58:37.673" LastActivityDate="2019-07-10T05:02:05.520" Title="Quantum operation in blocks" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6299" PostTypeId="2" ParentId="6283" CreationDate="2019-06-01T14:14:12.343" Score="4" Body="&lt;p&gt;First of all note that, strictly speaking, quantum states are defined up to multiplication by complex scalars (that is, &lt;a href=&quot;https://physics.stackexchange.com/a/157028/58382&quot;&gt;they are elements of the associated projective space&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathbb{CP}^n$&lt;/span&gt;).&#xA;This means that it is not true that &quot;&lt;em&gt;&lt;span class=&quot;math-container&quot;&gt;$-\lvert1\rangle$&lt;/span&gt; is just &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; but time or space delayed in time&lt;/em&gt;&quot;. The vectors &lt;span class=&quot;math-container&quot;&gt;$-\lvert1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; are simply two different ways to write the same exact physical state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless, that is not the correct way to describe the sort of physical scenario you seem to be having in mind. If a particle is freely propagating in space, its state will change, and you can describe this change as an accumulating phase factor. Note that this is a phase factor &lt;em&gt;between the different spatial modes occupied by the particle&lt;/em&gt;. In other words, you have a state with two possible degrees of freedom (say, position one and position two), and you accumulate a phase factor between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you consider two particles, the situation is a bit different. If particle &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is in position/state &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and particle &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is in position/state &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, you can write your state as &lt;span class=&quot;math-container&quot;&gt;$\lvert 1a\rangle\otimes\lvert2b\rangle$&lt;/span&gt;. If particle one goes through a delay line, or other kind of change of its internal state that results in a phase accumulation, then what you would get is something like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert1a\rangle\otimes\lvert 2b\rangle\to\lvert1a'\rangle\otimes\lvert 2b\rangle,\tag1$$&lt;/span&gt; &#xA;where &lt;span class=&quot;math-container&quot;&gt;$\langle a\rvert a'\rangle=e^{i\phi}$&lt;/span&gt;. In other words, the accumulated phase factor is in the internal state of the first particle, not in the overall state.&#xA;This phase factor will be detectable if you then make the particles interfere, for example by joining the two positions &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert2\rangle$&lt;/span&gt; with something such as a beamsplitter&lt;span class=&quot;math-container&quot;&gt;$^{(1)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to understand the question might be: why is the following true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p4oEH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p4oEH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, if you interpret &lt;span class=&quot;math-container&quot;&gt;$Z\lvert1\rangle=-\lvert1\rangle$&lt;/span&gt; as &quot;&lt;em&gt;&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; evolving the state &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; into the state &lt;span class=&quot;math-container&quot;&gt;$-\lvert1\rangle$&lt;/span&gt;&lt;/em&gt;&quot; then this identity would not make much sense. Instead, what is going on is that &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; (as well as &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt;) is a state that is &lt;em&gt;not&lt;/em&gt; affected by &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. The phase factor brought by &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; only has physical meaning when it acts on a different state &lt;span class=&quot;math-container&quot;&gt;$\alpha\lvert0\rangle+\beta\lvert1\rangle$&lt;/span&gt;, which is not stable under the action of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${}^{(1)}$&lt;/span&gt; In this kind of situation, you would most probably also have to take into account the type of particles you are dealing with. If these were photons (or more generally bosons), then the correct state would be the symmetrised version of Eq. (1). Equivalently, you could use second quantisation formalism to describe the state and its evolution, which would read as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$a_{1a}^\dagger a_{2b}^\dagger\lvert\mathrm{vac}\rangle&#xA;\to a_{1a'}^\dagger a_{2b}^\dagger\lvert\mathrm{vac}\rangle.$$&lt;/span&gt;&#xA;Interfering the spatial modes &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; on a beamsplitter would correspond to writing&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;a_{1\alpha}^\dagger&amp;amp;\to \frac{1}{\sqrt2}(a_{1\alpha}^\dagger+a_{2\alpha}^\dagger), \\&#xA;a_{2\alpha}^\dagger&amp;amp;\to \frac{1}{\sqrt2}(a_{1\alpha}^\dagger-a_{2\alpha}^\dagger).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-01T15:09:46.807" LastActivityDate="2019-06-01T15:09:46.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6302" PostTypeId="1" CreationDate="2019-06-02T08:09:09.080" Score="6" ViewCount="386" Body="&lt;p&gt;Why is the application of an oracle function not a measurement, causing the collapse of the system? How can you know the state of the system (the input of the oracle function) without measurement?&lt;/p&gt;&#xA;" OwnerUserId="7626" LastEditorUserId="55" LastEditDate="2019-08-16T18:57:56.190" LastActivityDate="2019-08-16T18:57:56.190" Title="Why is the application of an oracle function not a measurement?" Tags="&lt;algorithm&gt;&lt;measurement&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6303" PostTypeId="2" ParentId="6302" CreationDate="2019-06-02T09:35:30.940" Score="2" Body="&lt;p&gt;Since this question seems to be in the context of Grover's search, I will explain using what happens in Grover's search, however, this is way more general.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The oracle function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; itself can be thought of a specification as to what should happen given various basis states (in fact, just classical bit strings to classical bit strings). &#xA;For example, &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |00\rangle \rightarrow |0\rangle \\ &#xA;|01\rangle \rightarrow |1\rangle \\&#xA;|10\rangle \rightarrow |0\rangle \\&#xA;|11\rangle \rightarrow |0\rangle \\$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, you need not think about implementation. However, when we do implement it, we want to ensure there is no reduction in qubits, and the gate is unitary, so we make a unitary version of any function as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(|x\rangle \otimes |y\rangle) = |x\rangle \otimes |\bar x \oplus f(x)\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we have a unitary gate with a specification of what happens to every basis state, so we implement it as we would a unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the exact physics of how a unitary gate is implemented, but it is not a state-dependent process, so it is not necessary to know the state before applying the gate, hence, &lt;em&gt;knowing&lt;/em&gt; the input state, or measuring it beforehand is not necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence application of an oracle does not cause the state to collapse. &lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="2832" LastEditDate="2019-06-03T07:22:21.947" LastActivityDate="2019-06-03T07:22:21.947" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6304" PostTypeId="2" ParentId="6302" CreationDate="2019-06-02T13:49:18.813" Score="2" Body="&lt;p&gt;It's hard to know what are you referring to without context, but a &quot;&lt;em&gt;quantum oracle&lt;/em&gt;&quot; is just a type of (generally unitary) gate. As such, it does not provide information about the system, and neither it induces collapse. You can find more details about &lt;em&gt;oracles&lt;/em&gt; in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4625/55&quot;&gt;this other question&lt;/a&gt; (and links therein).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot know the state of the system without measurement, that is true, but that is not what an oracle does. A measurement will most probably be performed at some stage &lt;em&gt;after&lt;/em&gt; the oracle was applied.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-03T11:35:36.950" LastActivityDate="2019-06-03T11:35:36.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6305" PostTypeId="2" ParentId="6302" CreationDate="2019-06-02T18:02:33.397" Score="3" Body="&lt;p&gt;An application of an oracle does not return a value; rather, it modifies the state of the system in a non-collapsing way. The oracles are a bit similar to controlled gates in this respect (in fact, a lot of oracles rely on controlled gates for their implementation). Consider, for example, CNOT gate: it does not measure the control qubit and apply an X gate to the target qubit based on measurement results, but rather it is a unitary gate described by a matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CNOT} = \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The oracles are the same: they do not return any value; instead they are unitary transformations which implement classical functions in the following way:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define the effect of the oracle on all basis states, using the classical function it implements.&lt;/li&gt;&#xA;&lt;li&gt;This will automatically define the effect of the oracle on all superposition states: the oracle is a quantum operation and has to be linear in the state on which it acts. The oracle will be applied to superposition states - this is what &quot;calculating the value of the function on all inputs at once&quot; formulation you sometimes see refers to.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;CNOT is an example of an oracle which implements classical function &lt;span class=&quot;math-container&quot;&gt;$f(x) = x$&lt;/span&gt;: you can check that its effects on basis states follow the rule &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT} |x \rangle |y \rangle = |x \rangle |y \oplus x \rangle = |x \rangle |y \oplus f(x) \rangle$&lt;/span&gt;, which is the definition of the oracle effect.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The second part - about the oracles being defined by their effect on basis states using linearity - is implicit in a lot of sources I've seen, and is a frequent source of confusion - the definition of oracle effects on basis states makes it very tempting to try and measure the input state. If you need more mathematical details on this, we ended up writing it up &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/oracles&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are also lots of questions about quantum oracles on this site - it is a bit weird that there is no &quot;oracle&quot; tag, but if you look for Deutsch, Deutsch-Jozsa or Grover algorithms, a lot of the questions are about the oracles.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="26" LastEditDate="2019-06-02T21:11:46.647" LastActivityDate="2019-06-02T21:11:46.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6306" PostTypeId="1" CreationDate="2019-06-02T18:18:34.330" Score="3" ViewCount="324" Body="&lt;p&gt;I tried to implement the Deutsch's problem on IBM Q but didn't get the results as expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is the circuit for the Deutsch algorithm&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0OcBa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0OcBa.png&quot; alt=&quot;Deutsch algorithmn&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this is my implementation on the composer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ybWNz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ybWNz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so let me explain to you what I did/thought:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is qubit q(1) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; is q(2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with qubit q(0) I wanted to realize the oracle function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, which has - as implemented - the properties that &lt;span class=&quot;math-container&quot;&gt;$f(0) = 0$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$f(1) = 1$&lt;/span&gt;. As I used the cnot gate on the initial &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state of q(0) -&gt;  so &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced on q(0) I should have f(x) after the first CNOT gate. q(0) (which is &lt;span class=&quot;math-container&quot;&gt;$f(|x\rangle)$&lt;/span&gt; now determines what happens with q(2) using a flipped CNOT, as it is technically not possible to use the normal CNOT gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I measure &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; i.e. q(1) which should be in a pure state (here &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced) - but it is not:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eK5Oz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eK5Oz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so any ideas what went wrong here? Maybe (probably) my implementation of &lt;span class=&quot;math-container&quot;&gt;$U_{f}$&lt;/span&gt; is wrong, but how can this be realized then?&lt;/p&gt;&#xA;" OwnerUserId="7632" LastEditorUserId="26" LastEditDate="2019-06-02T19:49:38.757" LastActivityDate="2019-06-04T20:10:13.910" Title="Implementing Deutsch's problem on IBM Q composer" Tags="&lt;algorithm&gt;&lt;ibm-q-experience&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6307" PostTypeId="1" CreationDate="2019-06-02T19:56:04.747" Score="3" ViewCount="65" Body="&lt;p&gt;Suppose I have this &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,%22Sample1%22],[%22X%22,%22%E2%80%A2%22],[%22X%22,1,%22%E2%80%A2%22],[%22X%22,1,1,%22%E2%80%A2%22],[%22X%22,1,1,1,%22%E2%80%A2%22],[1,%22X%22,%22%E2%80%A2%22],[1,%22X%22,1,%22%E2%80%A2%22],[1,%22X%22,1,1,%22%E2%80%A2%22],[1,%22X%22,1,1,1,%22%E2%80%A2%22],[1,1,%22X%22,%22%E2%80%A2%22],[1,1,%22X%22,1,%22%E2%80%A2%22],[1,1,%22X%22,1,1,%22%E2%80%A2%22],[1,1,%22X%22,1,1,1,%22%E2%80%A2%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum XOR circuit&lt;/a&gt;; this is a quantum circuit for the classical XOR operation &lt;span class=&quot;math-container&quot;&gt;$$\begin{eqnarray*}&#xA;x_1'= x_1\oplus x_2\oplus x_3\oplus x_4,\\&#xA;x_2'=x_2\oplus x_3\oplus x_4\oplus x_5,\\&#xA;x_3'=x_3\oplus x_4\oplus x_5\oplus x_6.&#xA;\end{eqnarray*}$$&lt;/span&gt;&#xA;Now suppose I had &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; quibts instead of &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;. What would be tensorial notation for this generalized circuit, what I think is &lt;span class=&quot;math-container&quot;&gt;$$U=\prod_{i=0}^{2}\prod_{k=0}^{q-1}I^{\otimes k}\otimes X\otimes I^{\otimes i}\otimes P_1\otimes I^{\otimes l-2-i-k}$$&lt;/span&gt; is this the correct notation. The first &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; tells how many qubits will be unaltered, the second &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; adjusts the correct control, &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; is the projection operator, and last &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; does nothing on the remaining qubits. Ignore the part of this operator when the state is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; i.e. projection operator &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; is omitted. &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-06-03T15:10:21.153" LastActivityDate="2019-06-03T15:10:21.153" Title="Tensorial notation for this quantum XOR circuit" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6308" PostTypeId="1" AcceptedAnswerId="6310" CreationDate="2019-06-02T23:37:11.550" Score="3" ViewCount="73" Body="&lt;p&gt;I was told that qubits don't have a value, they have a &quot;state&quot;. What does that mean? What are the different &quot;states&quot; that a qubit can have (like bits can be either 1 or 0)?&lt;/p&gt;&#xA;" OwnerUserId="5889" LastEditorUserId="26" LastEditDate="2019-06-03T00:12:44.623" LastActivityDate="2019-06-04T10:39:43.037" Title="What &quot;states&quot; can a qubit have if it doesn't have values?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6309" PostTypeId="1" CreationDate="2019-06-03T08:03:23.507" Score="6" ViewCount="411" Body="&lt;p&gt;I'm a beginner with Qiskit and the Python language at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my question:&#xA;One of the VQE function arguments is qubit operator (&lt;code&gt;qubitOp&lt;/code&gt;).&#xA;I saw some examples where the &lt;code&gt;qubitOp&lt;/code&gt; object was produced by some already existing &lt;code&gt;Qiskit&lt;/code&gt; module.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in the following fragment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qubitOp, offset = max_cut.get_max_cut_qubitops(w)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qubitOp&lt;/code&gt; is an Ising Hamiltonian produced from the connection weights matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I define the &lt;code&gt;qubitOp&lt;/code&gt; entirely by myself, from the very beginning?&#xA;(My actual goal is to enrich the Ising Hamiltonian with spin's interactions with the external magnetic field).&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7637" LastEditorUserId="26" LastEditDate="2019-06-03T15:00:19.050" LastActivityDate="2019-06-03T15:02:19.537" Title="Defining qubit operator from scratch" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6310" PostTypeId="2" ParentId="6308" CreationDate="2019-06-03T11:20:52.003" Score="4" Body="&lt;p&gt;It strongly depends on your definition of &lt;em&gt;have a value&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you might be referring to is the fact that &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubits&lt;/a&gt; (and more in general quantum systems) can be in a &lt;em&gt;state&lt;/em&gt; that, when measured in specific ways, gives &lt;em&gt;probabilistic&lt;/em&gt; outcomes.&#xA;Here, with &lt;em&gt;state&lt;/em&gt; I don't mean anything technical. A &lt;em&gt;physical state&lt;/em&gt; is here meant as simply whatever set of property characterises the system under consideration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the quantum system under consideration is a qubit in the following &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;superposition state&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt2}(\lvert0\rangle+\lvert1\rangle),$$&lt;/span&gt;&#xA;then measuring in the so-called &lt;em&gt;computational basis&lt;/em&gt; results &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; of the time in finding the outcome corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; of the time in finding the outcome corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A possible physical realisation of this situation is a photon that is sent through a &lt;a href=&quot;https://en.wikipedia.org/wiki/Beam_splitter&quot; rel=&quot;nofollow noreferrer&quot;&gt;balanced beamsplitter&lt;/a&gt;. In this case, &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle+\lvert1\rangle$&lt;/span&gt; describes the fact that the photon is in a &lt;em&gt;superposition&lt;/em&gt; of the two output ports of the beamsplitter.&#xA;&lt;em&gt;Measuring in the computational basis&lt;/em&gt; then corresponds here to &quot;asking in which of the two output ports the photon came out from&quot;, which you can do by putting photon detectors in the two output ports and seeing which one &quot;clicks&quot;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What are the different &quot;states&quot; that a qubit can have (like bits can be either 1 or 0)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. It should be noted however that, like bits, what &quot;&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;&quot; and &quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&quot; corresponds to physically depends on the situation. In the example above, &quot;&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;&quot; meant &quot;&lt;em&gt;photon on the first output port&lt;/em&gt;&quot; while &quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&quot; meant &quot;&lt;em&gt;photon on the second output port&lt;/em&gt;&quot;. In a different situation &quot;&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;&quot; and &quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&quot; might instead represent two different states of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Photon_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;polarisation&lt;/em&gt; of the photon&lt;/a&gt;. Or one might be studying an entirely different physical scenario which has nothing to do with light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, there are many situations in which a system can be in more than two possible states (in fact, arguably, &lt;em&gt;almost all&lt;/em&gt; situations are like this). In this case one talks of a &lt;em&gt;qudit&lt;/em&gt; (or in case of continuous systems sometimes of &lt;em&gt;qumodes&lt;/em&gt;).&#xA;For example, in the quantum optical scenario with the beamsplitter that I used above, if there are instead many output ports, then the output state should be described as a more general superposition of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_{k=1}^N c_k \lvert k\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; the number of output ports of the interferometer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also have a look at the answers to this related question: &lt;a href=&quot;https://physics.stackexchange.com/q/268899/58382&quot;&gt;How can a quantum logic gate produce a value other than &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;?&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-04T10:39:43.037" LastActivityDate="2019-06-04T10:39:43.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6311" PostTypeId="1" CreationDate="2019-06-03T12:12:55.817" Score="3" ViewCount="54" Body="&lt;p&gt;A bipartite state &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\rho_{AB}$&lt;/span&gt; is said to be &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sharable when it is possible to find an extended state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB_1\cdots B_n}$&lt;/span&gt; such that partial tracing over any subset of &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; systems &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; we recover &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;.&#xA;More formally, if there exists a &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB_1\cdots B_n}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{AB_k}\equiv \mathrm{Tr}_{B_j\forall j\neq k}[\rho_{AB_1\cdots B_n}]=\rho_{AB},\quad \forall k.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, it is a state shared by &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; parties, that will look like &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; when looked from any pair of parties &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_k$&lt;/span&gt; (I took this form of the definition from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0604168&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yang (2006)&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As proven in (I think) &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308032&quot; rel=&quot;nofollow noreferrer&quot;&gt;Doherty et al. (2003)&lt;/a&gt;, a bipartite state is separable &lt;em&gt;if and only if&lt;/em&gt; it is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sharable for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A trivial example of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sharability is the maximally mixed state: if &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}\equiv1/d^2\sum_{ij}\lvert ij\rangle\!\langle ij\rvert$&lt;/span&gt;, then I can extend it by writing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{AB_1\cdots B_n}=\frac{1}{d^{n+1}}\sum_{i_1,...,i_{n+1}}\left(\lvert i_1\rangle\!\langle i_1\rvert\otimes \dots\otimes \lvert i_{n+1}\rangle\!\langle i_{n+1}\rvert\right).$$&lt;/span&gt;&#xA;In this case, I don't even have to consider subsystems of the form &lt;span class=&quot;math-container&quot;&gt;$A, B_k$&lt;/span&gt;, as any pair of subsystems will give the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are nontrivial examples of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sharability? In particular, what is an example of a &lt;em&gt;non-separable&lt;/em&gt; state that is sharable up to some point, but cannot be shared by too many parties?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-04-26T15:42:04.170" LastActivityDate="2021-04-26T15:42:04.170" Title="What are nontrivial examples of $n$-sharable bipartite states?" Tags="&lt;entanglement&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6312" PostTypeId="2" ParentId="6309" CreationDate="2019-06-03T12:24:31.050" Score="5" Body="&lt;p&gt;The question refers to the VQE, so let's start with this and Max_Cut; they can be built on the VQE. There used to be a vqe.ipynp but I can't find, look for &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/community/aqua/vqe2iqpe.ipynb&quot; rel=&quot;noreferrer&quot;&gt;an example&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The VQE algorithm doesn't need much input. You can fill it with the &lt;code&gt;paulis_dict&lt;/code&gt;. This could be a simple Z gate for finding the eigenvalues= -1.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pauli_dict = {&#xA;    'paulis': [{&quot;coeff&quot;: {&quot;imag&quot;: 0.0, &quot;real&quot;: 1}, &quot;label&quot;: &quot;Z&quot;}]&#xA;}&#xA;&#xA;qubitOp = Operator.load_from_dict(pauli_dict)&#xA;print(qubitOp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I will publish my VQE test on github soon. I want to compare Rigetti and IBM VQE.&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="26" LastEditDate="2019-06-03T15:02:19.537" LastActivityDate="2019-06-03T15:02:19.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6314" PostTypeId="1" CreationDate="2019-06-03T15:38:53.727" Score="8" ViewCount="275" Body="&lt;p&gt;How to calculate the distance of the stabilizer code [[n,k,d]]? It's better if you can make a 3-qubit example. And what's the relationship between d and Pauli group?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="26" LastEditDate="2019-06-03T15:48:30.590" LastActivityDate="2019-06-04T08:02:58.747" Title="How to calculate the distance of stabilizer code?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6315" PostTypeId="1" CreationDate="2019-06-03T16:48:21.247" Score="2" ViewCount="236" Body="&lt;p&gt;According to the &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;OPENQASM 2.0&lt;/a&gt; documentation, it's possible to define custom unitary gates using the format:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gate name(params) qargs&#xA;{&#xA;body&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where the optional parameter list &lt;code&gt;params&lt;/code&gt; is a comma-separated list of variable parameter names, and the argument list &lt;code&gt;qargs&lt;/code&gt; is a comma-separated list of qubit arguments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my specific case, I'm trying to implement a single-qubit &lt;strong&gt;controlled&lt;/strong&gt; unitary which will act on two qubits. So is there a way to define a custom controlled unitary gate in OPENQASM 2.0? It should work on the new &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Quantum Experience Beta&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-06-06T12:22:14.700" Title="How to define custom controlled unitaries in OPENQASM 2.0?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6316" PostTypeId="1" AcceptedAnswerId="6318" CreationDate="2019-06-03T18:01:33.740" Score="6" ViewCount="343" Body="&lt;p&gt;In the vein of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6315&quot;&gt;this question&lt;/a&gt;, say I have a 2-qubit unitary gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; which can be represented as a finite sequence of (say) single qubit gates, CNOTs, SWAPs, cXs, cYs and cZs. Now I need to implement a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate and hence need its decomposition in terms of simple one- and two-qubit gates. Is there a standard method to get this decomposed circuit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Nielsen and Chuang they deal with the general recipe for decomposing &lt;span class=&quot;math-container&quot;&gt;$C^n(U)$&lt;/span&gt; gates where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a single qubit unitary, but not where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-qubit unitary cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1354&quot;&gt;glS's answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-06-03T19:41:36.893" Title="How to decompose a controlled unitary $C(U)$ operation where $U$ is a 2-qubit gate?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6317" PostTypeId="1" AcceptedAnswerId="8298" CreationDate="2019-06-03T19:02:09.167" Score="4" ViewCount="373" Body="&lt;p&gt;I was trying to figure out how scheduling works in IBM devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing that's bugging me is that in the quantum computer implementations I had seen before, the cycle concept is used. Say, for example, a cycle = 20ns. And all operations take that time or multiples of that time. &#xA;This is handy because things like parallelism and depth can then be defined using this cycles concept, which makes things like scheduling very clear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With IBM machines, however, the duration of the primitivies can vary a lot, as seen on IBM's Github &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/blob/master/backends/melbourne/V1/version_log.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;repo&lt;/a&gt; containing this information. We can see that the time it takes to perform a CNOT gate varies a lot, depending on the link. Let's have an example to motivate the question. If I define the following circuit in Qiskit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(14, 'q')&#xA;c = ClassicalRegister(14, 'c')&#xA;circ = QuantumCircuit(q, c)&#xA;circ.cx(q[1], q[0])&#xA;circ.cx(q[1], q[0])&#xA;circ.h(q[3])&#xA;circ.h(q[3])&#xA;circ.h(q[3])&#xA;print(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output of the print command will be (with the tracks for q[x&gt;=4] trimmed since nothing was happening on those qubits):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wiVka.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wiVka.png&quot; alt=&quot;Output of &amp;lt;code&amp;gt;print(circ)&amp;lt;/code&amp;gt; command, with the tracks for q[x&amp;gt;=4] trimmed since nothing was happening on those qubits&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In IBM's Q16 Melbourne device, the duration of each Hadamard gate is 100ns (+ 20ns buffer) and for this specific CNOT gate (&lt;code&gt;q[1]&lt;/code&gt;, &lt;code&gt;q[0]&lt;/code&gt;) is 678ns (+80ns buffer). These values can be checked on the repository mentioned before.&#xA;If may look, from the printed circuit, that the 3 Hadamards on &lt;code&gt;q[3]&lt;/code&gt; would take more than the 2 CNOTs, but that is not the case. This raises some questions regarding how gates are actually scheduled on the device:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - Which gates were executed in parallel? The 3 Had gates can be executed faster than a single CNOT gate. Or was each Hadamard gate synchronized with the CNOT? If it's the 1st then this circuit output is pretty misleading, if the 2nd, when there's a lot of lost time for qubit &lt;code&gt;q[3]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So reformulating the question: would the gates on &lt;code&gt;q[3]&lt;/code&gt; be executed asynchronously?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 - Defining depth as the number of gates in the longest track, as compared to the number to cycles, or time to the circuit to end can be misleading. In this case, the depth of the circuit is 3, even though the upper track takes much more time. Is there a way to extract a circuit runtime?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 - How does this synchrony / asynchrony gets translated when compiling to a OPENQasm file?&lt;/p&gt;&#xA;" OwnerUserId="201" LastEditorUserId="1386" LastEditDate="2019-09-18T08:09:01.693" LastActivityDate="2019-09-23T18:30:29.407" Title="IBM Q devices scheduling of gates with different durations" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6318" PostTypeId="2" ParentId="6316" CreationDate="2019-06-03T19:41:36.893" Score="5" Body="&lt;p&gt;By giving U as that sequence you have reduced the problem to controlled SWAPs, cXs, cYs and cZs already. The single qubit gates you already know how to make controlled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can reduce further to controlled SWAPs and cXs by putting in the appropriate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$UXU^\dagger=Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. That gets rid of dealing with the controlled cYs and cZs separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now just have to reduce Toffoli and Fredkin gates to 1 and 2 qubit gates. A Fredkin can be built with 3 Toffoli's just like how a SWAP is built from CNOTs, but with an extra control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now all that remains is decomposing a Toffoli gate into single qubit and 2-qubit gates. That is answered &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3943/how-do-you-implement-the-toffoli-gate-using-only-single-qubit-and-cnot-gates&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-03T19:41:36.893" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6319" PostTypeId="1" CreationDate="2019-06-03T20:06:33.123" Score="3" ViewCount="350" Body="&lt;p&gt;I've started getting into quantum computing in the last few days.&#xA;As part of the learning, I've figured it would be fun to implement some circuits on IBMQ Experience as I learn. So now I'm stuck with implementing a 2-qubit QFT.&#xA;My first try was this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cyejR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cyejR.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where in red is my implementation of a controlled-phase rotation by pi. I did it based on some paper I found which explains how to construct a universal controlled gate.&#xA;On 00 input it gave a 1/4 1/4 1/4 1/4 probability as expected. Then for sanity check, I figured I might try a 'DC' input (hence the Hadamard gates at the start) so the output would be 100% 00 but it failed. After some reading on the internet, I came by &lt;a href=&quot;https://physics.stackexchange.com/questions/202273/controlled-phase-gates?&quot;&gt;this question&lt;/a&gt;. The answer there is basically that the 'controlled' phase shift need only use a simple phase rotation on the MSB qubit. His explanation seemed sound and it did work for the 'DC' case.&#xA;So, my final question is - why my implementation is wrong? I've tried doing the math and it seems ok: when &lt;code&gt;q[2]&lt;/code&gt; is 0, &lt;code&gt;q[1]&lt;/code&gt; isn't rotated, and when &lt;code&gt;q[2]&lt;/code&gt; is 1 &lt;code&gt;q[1]&lt;/code&gt; is rotated by pi (+ a global -pi/2 phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I get some explanation, please? I think I'm missing something.&lt;/p&gt;&#xA;" OwnerUserId="7642" LastEditorUserId="55" LastEditDate="2019-06-04T10:33:41.617" LastActivityDate="2019-06-06T18:11:44.193" Title="2-qubit QFT in IBMQ: controlled phase rotation" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6320" PostTypeId="1" CreationDate="2019-06-04T00:27:28.673" Score="1" ViewCount="32" Body="&lt;p&gt;Non-super-slow review process and non-super-slow publication should take precedence.&lt;/p&gt;&#xA;" OwnerUserId="7644" LastEditorUserId="26" LastEditDate="2019-06-04T02:22:14.033" LastActivityDate="2019-06-04T02:22:14.033" Title="Which journals and conferences would be most appropriate for new number-theoretic quantum algorithms?" Tags="&lt;algorithm&gt;&lt;research&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-06-05T07:10:00.547" ContentLicense="CC BY-SA 4.0" />
  <row Id="6321" PostTypeId="2" ParentId="6314" CreationDate="2019-06-04T08:02:58.747" Score="7" Body="&lt;p&gt;There are various ways that you might go about computing the distance. I'll give a fairly general strategy here, although I'm sure here are imprvements that can be made.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your starting point is a set of stabilizers &lt;span class=&quot;math-container&quot;&gt;$\{K_n\}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits, satisfying &lt;span class=&quot;math-container&quot;&gt;$K_n^2=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[K_n,K_m]=0$&lt;/span&gt;. Generically, you want to consider the full set of &lt;span class=&quot;math-container&quot;&gt;$4^N$&lt;/span&gt; possible tensor products of Pauli operators &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}$&lt;/span&gt; across all &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; sites. Go through each of these in turn. If it does not commute with each and every &lt;span class=&quot;math-container&quot;&gt;$K_n$&lt;/span&gt;, discard it. If it can be written as a product of some subset of the &lt;span class=&quot;math-container&quot;&gt;$K_n$&lt;/span&gt;, discard it. From the set that you have left, find the term with the smallest weight (i.e. the number of terms that are not &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;). That's the distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider the stabilizers&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K_1=Z\otimes Z\otimes Z,\qquad K_2=X\otimes X\otimes I&#xA;$$&lt;/span&gt;&#xA;I'm not writing out all 64 possible terms here, but stare at it for a minute. You'll realise that &lt;span class=&quot;math-container&quot;&gt;$I\otimes I\otimes Z$&lt;/span&gt; commutes with both and cannot be written as a product of the two, so the distance is 1. The problem is that &lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt; is a bit too simple an example to be able to show you too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A brief comment on how I would do the maths: I'd set up a computer to do it, using binary matrices. I'd describe each stabilizer generator by a row of &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; elements. The first &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; are a binary string showing where the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s are, and the second &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; are a binary string showing where the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s are. Commutation is a simple linear algebra check, and similarly, we can check for the containment of stabilizers in a term by using an inner product. All calculations are performd modulo 2.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-04T08:02:58.747" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6322" PostTypeId="1" CreationDate="2019-06-04T10:53:00.260" Score="3" ViewCount="56" Body="&lt;p&gt;Let me first tell my problem statement. Suppose I have a uniform superposition of states &lt;span class=&quot;math-container&quot;&gt;$$|A\rangle=\dfrac{1}{2^{9}}\sum_{i,j,k=0}^{2^6-1}|0\rangle^{\otimes 8}|i\rangle|j\rangle|k\rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes 8}$&lt;/span&gt; is pre-defined for each &lt;span class=&quot;math-container&quot;&gt;$i,j,k$&lt;/span&gt;. So suppose for a particular instance in this superposition state we have the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes 8}$&lt;/span&gt; register as &lt;span class=&quot;math-container&quot;&gt;$|b_7b_6b_5b_4b_3b_2b_1b_0\rangle$&lt;/span&gt; where each &lt;span class=&quot;math-container&quot;&gt;$b_i\in\{0,1\}$&lt;/span&gt;. Now I want to transform this register by a certain rule and that rule is: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|b_7b_6b_5b_4b_3b_2b_1b_0\rangle\to |b_6~ b_5 b_4 (b_3\oplus b_7) (b_2\oplus b_7)~b_1~(b_1\oplus b_7) ~b_7\rangle$$&lt;/span&gt; so for this transform I initialize a register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes 8}$&lt;/span&gt;. So to do this computation I first&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Modify my original superposition state as &lt;span class=&quot;math-container&quot;&gt;$\displaystyle |\tilde{A}\rangle=\dfrac{1}{2^{9}}\sum_{i,j,k=0}^{2^6-1}|0\rangle^{\otimes 8}|0\rangle_B^{\otimes 8}|i\rangle|j\rangle|k\rangle$&lt;/span&gt;, then&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I start the transformation process by  first applying the controlled NOT gate operation between the working register and the output register i.e &lt;span class=&quot;math-container&quot;&gt;$|b_7b_6b_5b_4b_3b_2b_1b_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0\rangle_B^{\otimes 8}$&lt;/span&gt;. This C-NOT gate changes the 3 qubit of &lt;span class=&quot;math-container&quot;&gt;$0\rangle_B^{\otimes 8}$&lt;/span&gt; from the right to &lt;span class=&quot;math-container&quot;&gt;$b_7$&lt;/span&gt;. To do this I apply the transform &lt;span class=&quot;math-container&quot;&gt;$$U_1=  P_1\otimes I^{\otimes 12}\otimes X\otimes I^{\otimes 2}\otimes I^{\otimes 3l}+P_0\otimes I^{\otimes 15+3l}$$&lt;/span&gt; So after this step i have the superposition state as  &lt;span class=&quot;math-container&quot;&gt;$$\displaystyle\dfrac{1}{2^{9}}\sum_{i,j,k=0}^{2^6-1}|b_7b_6b_5b_4b_3b_2b_1b_0\rangle|00000b_700\rangle|i\rangle|j\rangle|k\rangle.$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next, I apply controlled not operation between the working and output registers to change the state of the output register as &lt;span class=&quot;math-container&quot;&gt;$ |000b_7b_70b_7b_7\rangle $&lt;/span&gt;, the operator I define is &lt;span class=&quot;math-container&quot;&gt;$$ U_2=\prod_{i=0}^{4}(P_1\otimes I^{\otimes 10+i}\otimes X\otimes I^{\otimes 4-i}\otimes I^{\otimes 3l}+ P_0\otimes I^{\otimes 10+i}\otimes I\otimes I^{\otimes 4-i}\otimes I^{\otimes 3l})$$&lt;/span&gt;&#xA;At the end of this step I have the working register as &lt;span class=&quot;math-container&quot;&gt;$ |b_7b_6b_5b_4b_3b_2b_1b_0\rangle$&lt;/span&gt; and the output register as &lt;span class=&quot;math-container&quot;&gt;$|000b_7b_70b_7b_7\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The final step is I apply the C-NOT between these two registers with control starting from &lt;span class=&quot;math-container&quot;&gt;$b_6$&lt;/span&gt;. So I define the operator &lt;span class=&quot;math-container&quot;&gt;$$U_3=\prod_{i=1}^{8}I^{\otimes i}\otimes P_1\otimes I^{\otimes 6}\otimes X\otimes I^{\otimes 8-i}\otimes I^{\otimes 3l}$$&lt;/span&gt; after this step I have the state as &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{2^{9}}\sum_{i,j,k=0}^{2^6-1}|b_7b_6b_5b_4b_3b_2b_1b_0\rangle~ |b_6~ b_5 b_4 (b_3\oplus b_7) (b_2\oplus b_7)~b_1~(b_1\oplus b_7) ~b_7\rangle~\rangle|i\rangle~|j\rangle~|k\rangle$$&lt;/span&gt; So the overall operation need to reach the desired state would be &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}=U_3U_2U_1$&lt;/span&gt; operated on &lt;span class=&quot;math-container&quot;&gt;$|\tilde{A}\rangle$&lt;/span&gt;. Now I have a few question about this whole transformation process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1&lt;/strong&gt;. Are the transformation that I have written correct? Can somebody check?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q2&lt;/strong&gt;. If it is correct, then am I able to convey the operation that I am trying to do, by the explanations including the quantum computing terms like qubit, register, working, output register?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q3&lt;/strong&gt;. As we can see, the classical transformation is itself invertible, since given &lt;span class=&quot;math-container&quot;&gt;$$|b_6~ b_5 b_4 (b_3\oplus b_7) (b_2\oplus b_7)~b_1~(b_1\oplus b_7) ~b_7\rangle$$&lt;/span&gt; we can get &lt;span class=&quot;math-container&quot;&gt;$|b_7b_6b_5b_4b_3b_2b_1b_0\rangle$&lt;/span&gt; but for this to be done via quantum computation we had to introduce the ancillary register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_B$&lt;/span&gt; to store the output, but given the output since I can always get back the input, why do I keep that working register now so is there some unitary/non unitary transform that does resets the first register to the state &lt;span class=&quot;math-container&quot;&gt;$|00000000\rangle$&lt;/span&gt; and after that to get the superposition as &lt;span class=&quot;math-container&quot;&gt;$$ |B\rangle=\dfrac{1}{2^{9}}\sum_{i,j,k=0}^{2^6-1}|0\rangle^{\otimes 8}|i\rangle|j\rangle|k\rangle$$&lt;/span&gt; where the register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^8$&lt;/span&gt; here has the modified output from the transform &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Do i just measure the first register and then throw them away ?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2019-06-04T15:50:32.023" LastActivityDate="2019-06-04T15:50:32.023" Title="Restoring an initial state after computation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6325" PostTypeId="1" AcceptedAnswerId="8451" CreationDate="2019-06-04T14:40:25.980" Score="7" ViewCount="1044" Body="&lt;p&gt;I have been trying to understand what could be the advantage of using Grover algorithm for searching in an arbitrary unordered database D(key, value) with N values instead of a classical search.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assumed that the oracle function is a function f(key)=y, where y is the index of the corresponding value in the classical database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is related to the oracle. The oracle circuit has to be modified for each search is performed in the database because the key is specified in the oracle. Let's assume this is a negligible operation for simplicity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Supposing that the oracle circuit has to be calculated classically, it would require to produce a circuit which behaves like the function f(key)=y. This function would be obtained in at least O(N) steps (except for some special cases). The oracle function circuit has to be recalculated each time a database entry is being modified/added/removed, with a cost of O(N).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many papers such as &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithm Implementations for Beginners&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0508205&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithms for Matching and Network Flows&lt;/a&gt; seem to not consider the oracle at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if I have to consider a quantum database for obtaining a real advantage or not (&lt;a href=&quot;https://www.quora.com/What-is-Quantum-Relational-Databases&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; and the unreliability of quantum results convinced me is not a very good idea, but it is just conjecture).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, where is considered the complexity for building the oracle? Have I misunderstood something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &quot;The oracle function circuit has to be recalculated each time a database entry is being modified/added/removed, with a cost of O(N)&quot; a wrong assumption?&lt;/p&gt;&#xA;" OwnerUserId="6201" LastEditorUserId="55" LastEditDate="2019-06-04T19:11:22.367" LastActivityDate="2019-10-10T07:03:48.173" Title="Grover algorithm for a database search: where is the quantum advantage?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;quantum-advantage&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6326" PostTypeId="1" AcceptedAnswerId="6361" CreationDate="2019-06-04T17:50:28.553" Score="7" ViewCount="1009" Body="&lt;p&gt;For example, I want to calculate the fidelity of a 1-qubit and 2-qubit gates (similar to the result shown in figure 2 in &lt;a href=&quot;https://arxiv.org/abs/1811.02292&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;). Is there any way to do that in Qiskit? I've gone through the Qiskit Ignis documentation, but I didn't see if it's relevant. &lt;/p&gt;&#xA;" OwnerUserId="7648" LastEditorUserId="26" LastEditDate="2019-06-04T17:58:43.160" LastActivityDate="2019-06-19T09:05:50.413" Title="How to calculate the fidelity of a certain gate of a IBMQ device in Qiskit using randomized benchmarking/tomography?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;fidelity&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6327" PostTypeId="2" ParentId="6325" CreationDate="2019-06-04T18:10:33.753" Score="6" Body="&lt;p&gt;You are right to recognize the complexity of building the oracle to use it with Grover's search - it is indeed the tricky part of solving the problem, and indeed a lot of sources don't consider this complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like to think about the oracle as a tool to recognize the answer, not to find it. For example, if you're looking to solve a &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_satisfiability_problem&quot; rel=&quot;noreferrer&quot;&gt;SAT problem&lt;/a&gt;, the oracle circuit will encode the Boolean formula for a specific instance of a problem you're trying to solve. The circuit size in this case depends on the size of the formula, and not on the size of the search space. You can find an example of implementing an oracle for an instance of SAT problem in &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/tree/master/SolveSATWithGrover&quot; rel=&quot;noreferrer&quot;&gt;my tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to use Grover's algorithm for database search, the oracle would have to encode the condition you're searching for, but also the criteria of whether the element is in a database. For example, if you're looking for a name starting with A, the oracle needs to recognize all strings starting with A, but it also needs to recognize which of the strings are present in the database - otherwise the algorithm will yield a random string starting with A, which is probably not what you were looking for. (This was not an issue with the SAT problem example, since any variables assignment that satisfies the formula is a valid variable assignment.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of a good example of using Grover's search for searching through an unstructured database - to the best of my understanding this algorithm is suited for searches that have some structure. It is worth checking out other questions on Grover on this site, since a lot of them will consider oracle implementations.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-06-04T18:10:33.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6328" PostTypeId="1" AcceptedAnswerId="6345" CreationDate="2019-06-04T18:14:45.117" Score="5" ViewCount="166" Body="&lt;p&gt;I'm learning Q#. Is there any way to see the QASM code of a Q# function I write, the same way I can see the disassembly of a C# function?&lt;/p&gt;&#xA;" OwnerUserId="7649" LastEditorUserId="26" LastEditDate="2019-06-04T18:27:30.010" LastActivityDate="2019-06-05T15:52:55.720" Title="How to see the QASM code corresponding to compiled Q# function?" Tags="&lt;programming&gt;&lt;q#&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6329" PostTypeId="2" ParentId="6325" CreationDate="2019-06-04T18:21:33.890" Score="5" Body="&lt;p&gt;The problem is with your initial assumption: the oracle for Grover's is based on a function f(value)=0/1, where 1 indicates that the value meets your search criteria and 0 indicates that it doesn't. This means that you do have to build a new oracle for each different search, but not for each different database.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, Grover's algorithm and a quantum database don't make a good replacement for classical database lookup methods. Take a look at &lt;a href=&quot;https://web.eecs.umich.edu/~imarkov/pubs/jour/cise05-grov.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; for a discussion of the practicalities of Grover's algorithm in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm has practical application when generalized to &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;noreferrer&quot;&gt;amplitude amplification&lt;/a&gt;, which shows up as a component of many other quantum algorithms. Amplitude amplification is a way of improving the success likelihood of a probabilistic quantum algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2019-06-04T18:21:33.890" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6330" PostTypeId="1" CreationDate="2019-06-04T19:49:01.697" Score="1" ViewCount="164" Body="&lt;p&gt;In Q#, How do I store a qubits state in a binary-based disk / hard drive for use by regular digital programs? Is this even possible?&lt;/p&gt;&#xA;" OwnerUserId="5889" LastEditorUserId="26" LastEditDate="2019-11-02T06:55:12.200" LastActivityDate="2019-11-02T06:55:12.200" Title="Converting a qubit's state to a binary value in Q#" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6331" PostTypeId="2" ParentId="6306" CreationDate="2019-06-04T20:10:13.910" Score="2" Body="&lt;p&gt;&lt;strong&gt;TL;DR: There are 8 possible outcomes, each with equal probability of being read. The final state has q[1] read as 0 in 4 of the outcomes, and read as 1 in the other 4 outcomes. Since you are only measuring q[1], you only see the two results, one with q[1] as 0 and one with q[1] as 1. They are both around 50% because each outcome had an equal probability of being read.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's go through your circuit and what the state should be at each step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;X-Gate on q[2]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state will now be |100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a simple bit flip on q[2], from 0 to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;H-Gate on q[2] and H-Gate on q[1]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After these gates, the state will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|000&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|010&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|110&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;q[2] and q[1] both get put into superposition. They both can be either 0 or 1, leading to 4 possible outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CNOT from q[1] to q[0]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this gate, the state will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|000&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|011&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|111&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;q[1] and q[0] become entangled. q[0]'s outcome depends on q[1]. The two will either be 00 or 11, and since q[2] is still in superposition, there are still 4 possible outcomes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;H-Gate on q[2] and H-Gate on q[0]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After these gates, the state will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|101&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|110&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|111&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The H-Gate on q[2] cancels the first one out, leaving q[2]'s outcome as 1. The H-Gate on q[0] puts it in superposition, meaning it can be either 0 or 1. There are still 4 outcomes, because although we lost two possible outcomes with q[2] going back to just being 1, we gained two possible outcomes since q[0] can be either 0 or 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CNOT from q[2] to q[0]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this gate, the state will still be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|101&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|110&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|111&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gate essentially does not change the state. What ends up happening is when q[2] is 1, a bit flip will be applied to q[0]. However, at the moment q[2] is always 1, so each possible outcome will have q[0]'s bit flipped. Since each outcome has an equal probability of being read, the bit flip just provides us with the state possible outcomes, each with the same probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;H-Gate on q[2] and H-Gate on q[0]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After these gates, the state will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|000&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|011&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt4}$&lt;/span&gt;|111&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The H-Gate on q[2] puts it back in superposition, meaning it can be either 0 or 1. The H-Gate on q[0] cancels out the first one, meaning it is either 0 or 1 depending on q[1]. q[0] and q[1] will either be 00 or 11, and q[2] will either be 0 or 1, providing us with 4 possible outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;H-Gate on q[1]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After this gate, the state will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|000&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|001&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|010&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|011&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|100&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|101&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|110&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt8}$&lt;/span&gt;|111&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This final H-gate sets q[1]'s outcome as either 0 or 1, and this change won't affect q[0]'s outcome. q[0]'s outcome is still either 0 or 1 depending on what q[1] at the CNOT gate. q[2] is still in superposition, so it is either 0 or 1 as well. Since all 3 of the qubits can be either 0 or 1, there are &lt;span class=&quot;math-container&quot;&gt;$2^3$&lt;/span&gt;, or 8, possible outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last H-Gate on q[1] does not cancel out the first H-Gate (which would end up setting q[1] to only be 0) because of the entanglement between q[0] and q[1].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I do not know exactly how to fix your circuit to have it do what you want it to, as I am not very knowledgable on the algorithm itself. However, &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/004-Quantum_Algorithms/080-Deutsch-Jozsa_Algorithm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; may provide some more information on the topic.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-06-04T20:10:13.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6332" PostTypeId="1" CreationDate="2019-06-04T21:03:42.207" Score="0" ViewCount="75" Body="&lt;p&gt;Is there a way to revert two entangled qubits to a separate state without using code...like restarting a quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: By &quot;restarting a quantum computer&quot;, I do not mean restarting a virtual machine/simulator; I mean restarting a physical quantum computer with physical qubits.&lt;/p&gt;&#xA;" OwnerUserId="5889" LastEditorUserId="26" LastEditDate="2019-06-05T01:57:09.200" LastActivityDate="2019-06-05T12:02:32.223" Title="Can entangled qubits be disentangled without using code or software?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6333" PostTypeId="2" ParentId="6330" CreationDate="2019-06-04T21:04:38.417" Score="1" Body="&lt;p&gt;No, it is not possible. Consider simply counting the number of possibilities. You have N bits so can only differentiate &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; possibilities. How many possible states are there for 1 qubit if you don't do any approximation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do some approximation, then you may want to store the circuit that produced the given state starting from &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt;. But that would have had gates like rotation by some angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; in which case storing &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; would be using the floating point approximation of real numbers in order to turn it into something representable with finite amount of bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't make the type error of floats vs reals.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-04T21:04:38.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6334" PostTypeId="2" ParentId="6330" CreationDate="2019-06-04T21:14:59.050" Score="1" Body="&lt;p&gt;What use case do you have in mind? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q# allows you to produce human-readable dump of wave function using &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpmachine&quot; rel=&quot;nofollow noreferrer&quot;&gt;DumpMachine&lt;/a&gt;  operation (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4142/how-does-one-obtain-amplitude-information-in-q/&quot;&gt;this question&lt;/a&gt; for more details). However, this does not give you an &lt;em&gt;exact&lt;/em&gt; representation, since the floating-point numbers used for storing the amplitudes internally are by definition not exact.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-06-04T21:14:59.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6335" PostTypeId="1" AcceptedAnswerId="6356" CreationDate="2019-06-04T22:38:47.370" Score="3" ViewCount="291" Body="&lt;p&gt;It is well known that the state of a (pure) qubit can be described as a point on a two-dimensional sphere, the so-called &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4251/55&quot;&gt;Bloch sphere&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mapping &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle\mapsto \boldsymbol r_\psi$&lt;/span&gt; that sends each state into its representative in the Bloch sphere has the peculiarity of sending pairs of states that are orthogonal in the original Hilbert space (e.g. &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt;) into &lt;em&gt;collinear&lt;/em&gt; points in the Bloch sphere. For example, &lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle$&lt;/span&gt; are sent to the nadir and zenith of the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional systems can also be represented geometrically, using a &lt;em&gt;generalised Bloch representation&lt;/em&gt; (see e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6009/55&quot;&gt;this question&lt;/a&gt; for how this works). However, on such systems, systems of orthogonal states come in more than pairs, so the property outlined above that held in the Bloch sphere doesn't work anymore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How (if at all) does this property generalise for &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;-dimensional systems? More precisely, considering a set of orthogonal states (e.g. &lt;span class=&quot;math-container&quot;&gt;$\{\lvert k\rangle\}_{k=1}^D$&lt;/span&gt;), are the corresponding points in the generalized Bloch representation arranged into some kind of geometrical structure?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-05T12:52:33.107" LastActivityDate="2019-06-06T18:06:19.070" Title="How are orthogonal sets of pure states arranged in state space?" Tags="&lt;mathematics&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6336" PostTypeId="5" CreationDate="2019-06-04T22:55:37.413" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-04T22:55:37.413" LastActivityDate="2019-06-04T22:55:37.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6337" PostTypeId="4" CreationDate="2019-06-04T22:55:37.413" Score="0" Body="For questions about geometrical features of the set of quantum states." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-04T22:55:37.413" LastActivityDate="2019-06-04T22:55:37.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6338" PostTypeId="1" AcceptedAnswerId="6344" CreationDate="2019-06-04T23:00:25.557" Score="3" ViewCount="476" Body="&lt;p&gt;A possible way to implement the 2 qubit Heisenberg XYZ model using a Quantum computer is to decompose the Hamiltonian as follows: &lt;span class=&quot;math-container&quot;&gt;$$H_{XYZ} = H_{XY} + H_{YZ} + H_{XZ}$$&lt;/span&gt;. In this case, these operators commute so we can apply the trotter formula to get the unitary evolution &lt;span class=&quot;math-container&quot;&gt;$$U = e^{-iH_{XY}t}e^{-iH_{XZ}t}e^{-iH_{YZ}t}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, using appropriate rotations on the single qubits, &lt;span class=&quot;math-container&quot;&gt;$H_{XZ}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_{YZ}$&lt;/span&gt; can be expressed using single qubit gates and &lt;span class=&quot;math-container&quot;&gt;$H_{XY}$&lt;/span&gt;, meaning that the evolution &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; should be able to be simulated using only single qubit rotations and the XY interaction (&lt;span class=&quot;math-container&quot;&gt;$H_{XY} = \sigma_1^X\sigma_2^X + \sigma_1^Y\sigma_2^Y$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this, how can the XY interaction be implemented in IBMQ/Qiskit? Preferably it would be good to be able to do this without the use of an ancillary qubit.&lt;/p&gt;&#xA;" OwnerUserId="7609" LastEditorUserId="26" LastEditDate="2019-06-05T01:58:50.230" LastActivityDate="2019-06-05T06:09:08.193" Title="How to implement the XY Heisenberg interaction using IBMQ and Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6339" PostTypeId="1" AcceptedAnswerId="6342" CreationDate="2019-06-05T00:30:29.103" Score="5" ViewCount="607" Body="&lt;p&gt;While reading the paper &quot;Compiling basic linear algebra subroutines for quantum computers&quot;, &lt;a href=&quot;https://arxiv.org/abs/1902.10394&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, in the Appendix, the author/s have included a section on quantum inner product estimation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider two vectors &lt;span class=&quot;math-container&quot;&gt;$x,y \in \mathbb{C}^n, x= (x_1, \dots , x_n), y= (y_1, \ldots, y_n)$&lt;/span&gt;, we want to estimate the inner product &lt;span class=&quot;math-container&quot;&gt;$\langle x | y \rangle$&lt;/span&gt;. Assume we are given a state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \frac {1} {\sqrt 2} \big(|0 \rangle |x \rangle + |1 \rangle |y \rangle \big)$&lt;/span&gt;, after applying a Hadamard transform to the first qubit, the result is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \frac {1} {2} \big(|0 \rangle (|x \rangle + |y \rangle) + |1 \rangle(|x \rangle - |y \rangle) \big).$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author then states that after measuring the first qubit in the computational basis, the probability to measure &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$p = \frac {1} {2} \big(1 + \mathrm{Re}(\langle x | y \rangle) \big)$&lt;/span&gt;. I do not understand this statement. From what I understand, after applying a partial measurement to the first qubit, the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; is given by &#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac {1} {4} \sqrt { \sum_{i=0}^{n}(\overline{(x_i+y_i)}(x_i+y_i)) }^2$&lt;/span&gt; (in other words the norm of the vector squared), so I am not sure why these formulas are equivalent, or if I am mistaken.&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="55" LastEditDate="2019-06-05T10:47:55.607" LastActivityDate="2019-06-05T10:47:55.607" Title="Understanding a quantum algorithm to estimate inner products" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;mathematics&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6340" PostTypeId="1" AcceptedAnswerId="6343" CreationDate="2019-06-05T01:08:00.217" Score="3" ViewCount="108" Body="&lt;p&gt;In chapter 7, equation 7.6 says CNOT works as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} (|0\rangle + |1\rangle )\otimes |x\rangle \rightarrow &#xA;\frac{1}{\sqrt{2}} (|0\rangle + (-1)^x |1\rangle ) \otimes |x\rangle$&lt;/span&gt;, where it acts trivially if the target is &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; state, and it flips the control if the target is the &lt;span class=&quot;math-container&quot;&gt;$x=1$&lt;/span&gt; state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've looked at a few other resources about CNOT and this is the first time I encountered the &lt;span class=&quot;math-container&quot;&gt;$(-1)^x$&lt;/span&gt; term.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone explain to me where that term comes from? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that the matrix representation of CNOT is &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{pmatrix}$$&lt;/span&gt; I don't see how that &lt;span class=&quot;math-container&quot;&gt;$(-1)^x$&lt;/span&gt; came about. &lt;/p&gt;&#xA;" OwnerUserId="4399" LastEditorUserId="55" LastEditDate="2019-06-05T10:46:18.157" LastActivityDate="2019-06-05T10:46:18.157" Title="Expressing CNOT in the eigenbasis of $X$ (Preskill lecture notes eq. 7.6)" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6341" PostTypeId="2" ParentId="6340" CreationDate="2019-06-05T02:05:07.280" Score="1" Body="&lt;p&gt;Here Preskill is using a physics convention that the states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; are the eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator. So &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; actually means &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and with &lt;span class=&quot;math-container&quot;&gt;$x=1$&lt;/span&gt; actually means &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="483" LastEditorUserId="483" LastEditDate="2019-06-05T02:10:12.133" LastActivityDate="2019-06-05T02:10:12.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6342" PostTypeId="2" ParentId="6339" CreationDate="2019-06-05T02:31:28.683" Score="6" Body="&lt;p&gt;You just need to do a bit more algebra: Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{i=0}^n (\overline{x_i+y_i})(x_i+y_i)=\langle x+y|x+y\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then you can distribute the right-hand side to get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle x|x\rangle+\langle x|y\rangle+\langle y|x\rangle+\langle y|y\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$| x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| y\rangle$&lt;/span&gt; are normalized, we know that &lt;span class=&quot;math-container&quot;&gt;$\langle x|x\rangle=\langle y|y\rangle=1$&lt;/span&gt;. We also know a property of inner products:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle x|y\rangle=\overline{\langle y|x\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, if you add a complex number to its conjugate, you get twice its real part, so we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle x|y\rangle+\langle y|x\rangle=2 Re(\langle x|y\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, altogether, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle x|x\rangle+\langle x|y\rangle+\langle y|x\rangle+\langle y|y\rangle=2+2Re(\langle x|y\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the probability you computed is off by a factor of 2: There is a &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; as a coefficient of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, so since the norm is squared, this will give a factor of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;. This gives the answer you are supposed to get. &lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2019-06-05T02:31:28.683" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6343" PostTypeId="2" ParentId="6340" CreationDate="2019-06-05T03:00:59.480" Score="5" Body="&lt;p&gt;Expanding on Jalex&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at what happens on the possible terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\mid 0 \rangle \otimes \mid + \rangle &amp;amp;\to&amp;amp; \mid 0 \rangle \otimes \mid + \rangle\\&#xA;\mid 0 \rangle \otimes \mid - \rangle &amp;amp;\to&amp;amp; \mid 0 \rangle \otimes \mid - \rangle\\&#xA;\mid 1 \rangle \otimes \mid + \rangle &amp;amp;\to&amp;amp; \mid 1 \rangle \otimes \mid + \rangle\\&#xA;\mid 1 \rangle \otimes \mid - \rangle &amp;amp;\to&amp;amp; (-1) \mid 1 \rangle \otimes \mid - \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the first 2 are unchanged because the control is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; so nothing happens. The third is unchanged because NOT applied to &lt;span class=&quot;math-container&quot;&gt;$\mid + \rangle$&lt;/span&gt; just gives back &lt;span class=&quot;math-container&quot;&gt;$\mid + \rangle$&lt;/span&gt;. The last is the only one with change because NOT applied to &lt;span class=&quot;math-container&quot;&gt;$\mid - \rangle$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$(-1) \mid - \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can summarize these possibilities by knowing that &lt;span class=&quot;math-container&quot;&gt;$\mid + \rangle$&lt;/span&gt; goes with &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mid - \rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x=1$&lt;/span&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray*}&#xA;\mid 0 \rangle \otimes \mid x \rangle &amp;amp;\to&amp;amp; \mid 0 \rangle \otimes \mid x \rangle\\&#xA;\mid 1 \rangle \otimes \mid x \rangle &amp;amp;\to&amp;amp; (-1)^x \mid 1 \rangle \otimes \mid x \rangle\\&#xA;\end{eqnarray*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first two become the first one above. And third and fourth, the second above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now add the two together along with a &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; prefactor to give&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}} ( \mid 0 \rangle + \mid 1 \rangle ) \otimes \mid x \rangle \to \frac{1}{\sqrt{2}} ( \mid 0 \rangle + (-1)^x \mid 1 \rangle ) \otimes \mid x \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-05T03:00:59.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6344" PostTypeId="2" ParentId="6338" CreationDate="2019-06-05T06:09:08.193" Score="3" Body="&lt;p&gt;First, let's use the fact that &lt;span class=&quot;math-container&quot;&gt;$\sigma^X_1 \sigma^X_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma^Y_1 \sigma^Y_2$&lt;/span&gt; commute. This means&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-i H_{XY} t} = e^{-i ~\sigma^X_1 \sigma^X_2~ t} ~ e^{-i ~\sigma^Y_1 \sigma^Y_2~ t}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using appropriate single qubit rotations, &lt;span class=&quot;math-container&quot;&gt;$e^{-i ~\sigma^Y_1 \sigma^Y_2~ t}$&lt;/span&gt; can be expressed using &lt;span class=&quot;math-container&quot;&gt;$e^{-i ~\sigma^X_1 \sigma^X_2~ t}$&lt;/span&gt;. So now we've reduced the problem to simply implementing &lt;span class=&quot;math-container&quot;&gt;$e^{-i ~\sigma^X_1 \sigma^X_2~ t}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, the important relation to note is that,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${CX}_{j,k} ~ e^{-i~\sigma^X_j~t} ~ {CX}_{j,k} = e^{-i ~\sigma^X_j \sigma^X_k~t}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So all you need is a couple of cnots, and an appropriate single qubit rotation &lt;span class=&quot;math-container&quot;&gt;$e^{-i~\sigma^X_j~t}$&lt;/span&gt; implemented on their control qubit. In Qiskit code, here's a two qubit circuit that would implement this (here I named the qubits as &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, to reflect the Python indexing convention)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    qc = QuantumCircuit(2)&#xA;    qc.cx(0,1)&#xA;    qc.rx(t,0)&#xA;    qc.cx(0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Following this method would mean using 12 cnots to implement the whole Hamiltonian, which is quite a lot given the fidelities of current devices. Fancier methods are doubtless possible.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-05T06:09:08.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6345" PostTypeId="2" ParentId="6328" CreationDate="2019-06-05T06:45:34.770" Score="5" Body="&lt;p&gt;Q# is not compiled into QASM, so that would be tricky. Q# compilation and execution process is approximately as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Q# code is parsed into an internal data structure representing an abstract syntax tree. This data structure undergoes some transformations (for example, to generate adjoint and controlled versions of operations used in the code). I don't know a way to see this representation directly.&lt;/li&gt;&#xA;&lt;li&gt;Next, to execute the code on a simulator this data structure is used to generate C# code. This code doesn't look particularly assembly-like, since it maintains a lot of high-level language constructs. If your Q# code was stored in file &lt;code&gt;MyCode.qs&lt;/code&gt; in folder &lt;code&gt;A&lt;/code&gt;, the C# result of code generation will be found in &lt;code&gt;A\obj\qsharp\src\MyCode.g.cs&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;C# compiler compiles this generated code into a classical executable and runs it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Having said that, it is possible to write a separate tool that will convert a subset of Q# operations into OpenQasm; &lt;a href=&quot;https://github.com/qsharp-community/qsharp-integrations/tree/master/src/OpenQasm&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; by Rolf Huisman shows a way to do that.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-06-05T15:52:55.720" LastActivityDate="2019-06-05T15:52:55.720" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6346" PostTypeId="2" ParentId="6235" CreationDate="2019-06-05T07:43:14.807" Score="1" Body="&lt;p&gt;I get a way to count the maximal, and the remaining credits.&#xA;the maximal credits that was shown is 15, although I have made 10 runs and for each 3 credits till the program crushed due to lack of credits, so there is a Lack of coordination from what they write to what you can run for each 24 hours in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;there is packege that needed to be installed for each program, using your IBM account token &#xA;and give you a dictionary type: {'remaining': x, 'promotional': 0, 'maxUserType': 15}&#xA;when x is the remaining number of credits, the code that needed to be written is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; ! pip install IBMQuantumExperience&#xA;from IBMQuantumExperience import IBMQuantumExperience&#xA;api = IBMQuantumExperience(&quot;YOUR TOKEN&quot;, config = {&quot;url&quot;:'https://quantumexperience.ng.bluemix.net/api'}, verify=False)&#xA;api.get_my_credits()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In addition for what I saw there is no influence for the number of shots nor the number of qubits (till 5 because that I reached) influence on the number of credits the program consuming, this is an equal number usually equal to 3.&lt;/p&gt;&#xA;" OwnerUserId="4524" LastActivityDate="2019-06-05T07:43:14.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6347" PostTypeId="2" ParentId="6311" CreationDate="2019-06-05T07:52:40.100" Score="1" Body="&lt;p&gt;I've never thought about this before, and certainly not done any in-depth calculations, but see if this gets you started....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously you want to do two different things: show that there are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sharable states, and show that these states are not &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-shareable for some &lt;span class=&quot;math-container&quot;&gt;$m&amp;gt;n$&lt;/span&gt; (and hopefully get &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; as close as possible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\frac{1}{\sqrt{2}}(|01\rangle+|10\rangle)&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho(p)=p|\psi\rangle\langle\psi|+\frac{1-p}{2}(|00\rangle\langle 00|+|11\rangle\langle 11|).&#xA;$$&lt;/span&gt;&#xA;I believe that we will be able to do this for this state, for a whole range of values of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; (yielding different &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; values).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, to prove &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sharability, and to relate &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. I would start with a state such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac{1}{\sqrt{2}}(|\Psi^n_{(n-3)/2}\rangle+|\Psi^n_{(n+3)/2}\rangle)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\Psi^n_m\rangle$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit symmetric state with &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; 1s in it (so &lt;span class=&quot;math-container&quot;&gt;$|\Psi^3_1\rangle$&lt;/span&gt; is the standard &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;-state), and I'm assuming &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is odd. Since this state is invariant under all permutations, every two-qubit reduced density matrix is the same, and I believe it's of the form &lt;span class=&quot;math-container&quot;&gt;$\rho(p)$&lt;/span&gt;, although I haven't calculated the value of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. (As a partial verification, note that &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; in ivariant under &lt;span class=&quot;math-container&quot;&gt;$X^{\otimes n}$&lt;/span&gt;, which severely limits the possible structure of the reduced density matrix.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to prove that it isn't &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-sharable, I point you towards my paper &lt;a href=&quot;https://arxiv.org/abs/0901.3626&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. (If you want to be fussy, that paper contains a conjecture, which was only closed in the &lt;a href=&quot;https://arxiv.org/abs/1208.5574&quot; rel=&quot;nofollow noreferrer&quot;&gt;follow-up&lt;/a&gt;). Basically, it says that the amount of a single in a two-qubit density matrix (the parmeter &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; here) obeys a monogamy relation, so if you want one party to share the same amount of single with &lt;span class=&quot;math-container&quot;&gt;$m-1$&lt;/span&gt; other parties, there's a maximum size that &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; can be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I get some time later, I'll try to fill in some of the concrete numbers.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-05T07:52:40.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6348" PostTypeId="2" ParentId="6332" CreationDate="2019-06-05T11:49:04.160" Score="1" Body="&lt;p&gt;Well, there's more than one way.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can perform a measurement, though I suppose this doesn't comply&#xA;with your definition of 'without code' (since you actually have to&#xA;perform a command)?&lt;/li&gt;&#xA;&lt;li&gt;Since quantum states are fragile and (at the moment) still not error-corrected, you can just wait for the state to decohere/dephase... if you look at the IBM's device summary information &lt;a href=&quot;https://www.research.ibm.com/ibm-q/technology/devices/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, you can see that those times (T1, T2) are on the order of the tenth's of microseconds... you you wait a couple hundred microseconds, it's pretty likely that they are unentangled now (though of course, they probably assumed some random quantum state and nothing resembling what you initially programmed.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Whatever restarting a quantum computer may mean, it probably takes more time/steps than just waiting less than a milisecond. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The entanglement was created with a quantum operation. If you wish to undo and return to the previous state this you have to perform again a quantum operation, which involve hardware actions, which are directed by code. Or you just let the quantum states degrade/get destroyed with non-coherent effects, like noise, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure where your question comes from though, and why you'd want to do something without code, since even the restarting operations probably has some commands being executed. Why would you want to operate a computer without code?&lt;/p&gt;&#xA;" OwnerUserId="201" LastEditorUserId="201" LastEditDate="2019-06-05T12:02:32.223" LastActivityDate="2019-06-05T12:02:32.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6349" PostTypeId="2" ParentId="6172" CreationDate="2019-06-05T11:51:17.287" Score="3" Body="&lt;p&gt;There are two methods, when you look at the code you'll see their names: pseudo_inverse and least_squares (&lt;a href=&quot;https://github.com/Qiskit/qiskit-ignis/blob/master/qiskit/ignis/mitigation/measurement/filters.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ignis/blob/master/qiskit/ignis/mitigation/measurement/filters.py&lt;/a&gt;). pseudo_inverse is the simpler one, it applies the inverse of the calibration matrix on the measurement results. However it has some issues, which require the usage of the least_squares method, which finds valid mitigated results, such that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{min}_{P_{\rho}} ||\tilde{P}_{\rho}-\mathbf{A}\cdot P_{\rho}||$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; is the calibration matrix and &lt;span class=&quot;math-container&quot;&gt;$\tilde{P}_{\rho}$&lt;/span&gt; are the measurement results. Please see more details in the last section of &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/community/ignis/measurement_error_mitigation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/community/ignis/measurement_error_mitigation.ipynb&lt;/a&gt;. In particular about the issues related to the pseudo inverse.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2019-06-05T11:51:17.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6350" PostTypeId="2" ParentId="6335" CreationDate="2019-06-05T15:04:48.990" Score="4" Body="&lt;p&gt;&quot;Generalized Bloch&quot; manifolds are synonyms to coherent state manifolds. The points of these manifolds do not correspond, in general,  to orthonormal vectors, as there are much more points than the dimension of the system's Hilbert space. Points on the manifold correspond rather to generalized coherent states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These states are actually classical, they satisfy properties analogous to the ordinary coherent states of the harmonic oscillator such as (appropriately defined) minimal uncertainty (please see for example, &lt;a href=&quot;https://www.researchgate.net/profile/Jean-Pierre_Antoine/publication/234422863_Coherent_States_and_Their_Generalizations_a_Mathematical_Overview/links/0046352ce64389966e000000.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ali,  Antoine, Gazeau and Mueller&lt;/a&gt;). More, importantly, they satisfy  Bell's inequality upon splitting, please see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9805007v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Brief Mann and Revzen&lt;/a&gt;. However, they do span the full Hilbert space: Uncountable number of orthonormal bases can be constructed from linear combinations of these states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, given a coherent state manifold; does it contain a set of special points whose corresponding coherent states form an orthonormal basis of the corresponding Hilbert space. In the case of an &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt;-level system (qudit), there is a coherent state manifold for which the answer is positive: The complex projective space: &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^N$&lt;/span&gt; (as well as other coherent state manifolds where the answer is negative).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt;-level system, a coherent state vector parametrized by &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^N$&lt;/span&gt; has the following explicit expression:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi(z, \bar{z}) \rangle= \frac{1}{\sqrt{1 + \bar{z}_1z_1+ … +\bar{z}_N z_N}} &#xA;\begin{bmatrix}&#xA;1\\ &#xA;z_1\\ &#xA;.\\ &#xA;.\\ &#xA;.\\ &#xA;z_N\\ &#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;Where the coordinates, &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt; are global coordinates of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^N$&lt;/span&gt; : &lt;span class=&quot;math-container&quot;&gt;$z_i\in \mathbb{C}\cup \{\infty\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now please observe that the coherent state vectors corresponding to the &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{matrix}&#xA;[z_1=0,...,z_N=0]\\ &#xA;[z_1=0,z_2=\infty,...,z_N=0]\\ &#xA;[z_1=0,z_2=0, z_3=\infty,...,z_N=0]\\ &#xA;.\\ &#xA;.\\ &#xA;.\\ &#xA;[z_1=0,...,z_N=\infty]\\ &#xA;\end{matrix}&lt;/span&gt;&#xA;form the standard orthonormal vector spanning the &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; dimensional Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These special points enjoy unique geometric properties on  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^N$&lt;/span&gt;, please see  &lt;a href=&quot;https://arxiv.org/pdf/dg-ga/9502007.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Berceanu&lt;/a&gt;: Taking the first point as the origin, then the rest of the points&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)  Form a cut locus, whose points are the first on the geodesic joining them to the origin beyond which the geodesic ceases to minimize the arc length (i.e., it maximizes it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)  They form also the conjugate locus which is the set of points which can be connected to the origin with an infinite number of geodesics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) In addition,  since  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^N$&lt;/span&gt;, is an &lt;span class=&quot;math-container&quot;&gt;$SU(N+1)$&lt;/span&gt;, homogeneous space. The transformations which exchange a pair of points are just the matrices which exchange a pair of rows: These transformations generate a discrete group called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Weyl_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;Weyl group&lt;/a&gt;. The order of the Weyl group for &lt;span class=&quot;math-container&quot;&gt;$SU(N+1)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(N+1)!$&lt;/span&gt;, and its action on the orthonormal basis is just by permutations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) In addition, the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^N$&lt;/span&gt; has a cell structure, i.e., it can be decomposed into a disjoint set of affine spaces:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbb{C}P^N = \mathbb{C}^N \cup \mathbb{C}^{N-1}…\cup \mathbb{C} \cup \{0\}$$&lt;/span&gt;&#xA;Such that each special point resides on a different cell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are other choices of coherent state manifolds which do not allow an orthonormal basis of coherent states. For example, we can span an &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; Hilbert space by the Bloch sphere &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^1=S^2$&lt;/span&gt; as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi(z, \bar{z}) \rangle= \frac{1}{\sqrt{(1 + \bar{z}z)^N}} &#xA;\begin{bmatrix}&#xA;1\\ &#xA;\sqrt{N} z\\ &#xA;.\\ &#xA;.\\ &#xA;.\\ &#xA;\sqrt{\begin{pmatrix} N\\  i \end{pmatrix}}z^i\\&#xA;.\\ &#xA;.\\ &#xA;.\\ &#xA;z^N\\ &#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;Where: &lt;span class=&quot;math-container&quot;&gt;$z\in \mathbb{C}\cup \{\infty\}$&lt;/span&gt; isthe stereographic projection coordinate of the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case (for &lt;span class=&quot;math-container&quot;&gt;$N&amp;gt;2$&lt;/span&gt;), we can only generate an orthonormal basis by forming linear combinations of the coherent vectors for different values of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2019-06-06T12:05:24.120" LastActivityDate="2019-06-06T12:05:24.120" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6351" PostTypeId="1" CreationDate="2019-06-05T15:44:25.023" Score="4" ViewCount="94" Body="&lt;p&gt;I have found &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/3d6faa5979a82375f7926de67853bc382c8b2c2f/community/awards/teach_me_qiskit_2018/quantum_machine_learning/2_HHL/Quantum%20Algorithm%20for%20Linear%20System%20of%20Equations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; implementation of HHL, and I don't understand why the controlled unitary operation is expressed in the form of &lt;span class=&quot;math-container&quot;&gt;$\exp(i t_0 A/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\exp(i t_0 A/4)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rotation of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; are derived by the use of &lt;span class=&quot;math-container&quot;&gt;$\exp(i t_0 A/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\exp(i t_0 A/4)$&lt;/span&gt;,  in particular using the diagonal matrix which contains the eigenvalues. But usually, the controlled operations of QPE step is done using the matrices &lt;span class=&quot;math-container&quot;&gt;$A^{2^0}, A^{2^1}, … ,  A^{2^k}$&lt;/span&gt;. Where am I wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have also another question about the representation of the unitary operation: we can we express the unitary operation using only the matrix of the eigenvalues because &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is expressed on the same (standard) basis of the eigenvectors, is that correct?&lt;/p&gt;&#xA;" OwnerUserId="6310" LastEditorUserId="26" LastEditDate="2019-06-07T13:46:30.107" LastActivityDate="2019-06-07T13:46:30.107" Title="How can I express controlled unitary operation in QPE of this implementation of HHL?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6352" PostTypeId="1" CreationDate="2019-06-05T16:28:13.617" Score="3" ViewCount="32" Body="&lt;p&gt;How much power do quantum computers use based on the number of qubits being allocated? If it's not based on qubits, What determines how much power quantum computers use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: A &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1499/5889&quot;&gt;similar question&lt;/a&gt; was asked about 1 year ago, and therefore relatively outdated.&lt;/p&gt;&#xA;" OwnerUserId="5889" LastEditorUserId="26" LastEditDate="2019-06-07T13:52:01.133" LastActivityDate="2019-06-07T13:52:01.133" Title="How much power do quantum computers use based on the number of qubits being allocated?" Tags="&lt;physical-qubit&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6353" PostTypeId="1" CreationDate="2019-06-05T17:20:14.000" Score="4" ViewCount="119" Body="&lt;p&gt;I'm experiencing an issue while using Qiskit where the counts from a job return vastly different values when ran in a loop or as an array of circuits as opposed to single experiments when run by themselves. This is an issue because I'm in the process of tracking decoherence time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, when I run the following code (where N is the number of qubits in a 20-qubit architecture and gates_list is an array containing the number of identity gates to be implemented in each iteration of a circuit), the counts for the last circuit in the array becomes worse as I increase the number of entries in the list prior to that particular circuit. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(N, 'q')&#xA;c = ClassicalRegister(N, 'c')&#xA;qc = QuantumCircuit(q,c)&#xA;circuit=[]&#xA;&#xA;for i in range(N):&#xA;    qc.x(q[i])&#xA;    qc.barrier()&#xA;&#xA;measure = QuantumCircuit(q,c)&#xA;measure.measure(q[0:N], c[0:N])&#xA;&#xA;for j in gates_list:&#xA;    i = 1&#xA;    while i &amp;lt; j+1:&#xA;        for k in range(N):&#xA;            qc.iden(q[k])&#xA;        qc.barrier()&#xA;        i += 1&#xA;    circuit.append(qc+measure)&#xA;&#xA;for j in range(len(circuit)):&#xA;    print(&quot;Executing job&quot;, j+1, &quot;of&quot;, len(circuit))&#xA;    s = &quot;T2_Decoherence_i={}_t.csv&quot;.format(gates_list[j])&#xA;&#xA;    qobj = assemble(circuit[j], shots=8192)&#xA;    job = backend.run(qobj)&#xA;    job_monitor(job)&#xA;    res = job.result().get_counts()&#xA;&#xA;    ibmqf.Write_Data(s,res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when I attempt to run each individual circuit by itself, I receive the expected output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas as to what the issue might be?&lt;/p&gt;&#xA;" OwnerUserId="7666" LastEditorUserId="26" LastEditDate="2019-06-07T14:09:37.897" LastActivityDate="2019-06-07T14:09:37.897" Title="Results from looped experiments on IBM Q different than individual experiments" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6354" PostTypeId="1" AcceptedAnswerId="6355" CreationDate="2019-06-06T02:50:20.413" Score="5" ViewCount="55" Body="&lt;p&gt;In trying to understand a method outlined &lt;a href=&quot;https://arxiv.org/abs/1902.10394&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (page 3, subroutine 1). Consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_3 = &#xA;\begin{bmatrix} 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &#xA;\end{bmatrix} .$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be a square matrix over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt;. Define &lt;span class=&quot;math-container&quot;&gt;$X_3(A) = R_3 \otimes A + R_3^{\dagger} \otimes A^{\dagger}$&lt;/span&gt;, a.k.a &#xA;&lt;span class=&quot;math-container&quot;&gt;$$X_3(A) = \begin{bmatrix} 0_n &amp;amp; 0_n &amp;amp; A \\&#xA;0_n &amp;amp; 0_n &amp;amp; 0_n  \\&#xA;A^{\dagger} &amp;amp; 0_n &amp;amp; 0_n \end{bmatrix}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$0_n$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional zero matrix. &lt;span class=&quot;math-container&quot;&gt;$X_3(A)$&lt;/span&gt; is Hermitian, and the author refers to this as embedding &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in a Hermitian matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next the author makes the assumption that for two square matrices &lt;span class=&quot;math-container&quot;&gt;$A_1, A_2$&lt;/span&gt; of the same dimension, we have access to unitary operators &lt;span class=&quot;math-container&quot;&gt;$e^{iX_3(A_1) \tau},e^{iX_3(A_2)\tau}$&lt;/span&gt; (this is possible since &lt;span class=&quot;math-container&quot;&gt;$X_3(A_i)$&lt;/span&gt; is Hermitian), for &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; some &quot;simulation time&quot;, and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; a positive integer designated as the number of applications. This is described in &quot;input assumption #1&quot; (with &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; a time-parameter). In order to obtain an estimate of &lt;span class=&quot;math-container&quot;&gt;$e^{iX_3(A_1 + A_2)t}$&lt;/span&gt; , the procedure is described as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Procedure: Sequentially apply &lt;span class=&quot;math-container&quot;&gt;$e^{iA_1 t/n}, e^{iA_2 t/n}$&lt;/span&gt; for a total of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; consecutive times , defining &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$u_{add}(t) = (e^{iX_3(A_1)t/n} e^{iX_3(A_2) t/n})^n$&lt;/span&gt; where the number of applications of the unitaries  with &lt;span class=&quot;math-container&quot;&gt;$\tau = t/n$&lt;/span&gt; is proportional to &lt;span class=&quot;math-container&quot;&gt;$n = O(t^2 / \epsilon)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is the error term.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand for two matrices &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$e^A e^B = e^{A+B}$&lt;/span&gt; is generally true only if &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; commute, so the above expression say for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$ e^{iX_3(A_1)t/2} e^{iX_3(A_2)t/2} e^{iX_3(A_1)t/2} e^{iX_3(A_2)t/2}$&lt;/span&gt;, what I'm imagining the procedure shows is : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ e^{iX_3(A_1)t/2} e^{iX_3(A_2)t/2} e^{iX_3(A_1)t/2} e^{iX_3(A_2)t/2} = &#xA;e^{iX_3(A_1)t/2} e^{iX_3(A_1)t/2}e^{iX_3(A_2)t/2} e^{iX_3(A_2)t/2} =&#xA;e^{iX_3(A_1)t} e^{iX_3(A_2)t}=e^{iX_3(A_1+A_2)t} $&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but this assumes that &lt;span class=&quot;math-container&quot;&gt;$X_3(A_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_3(A_2)$&lt;/span&gt; commute? I'm also not sure what the author means by &quot;apply&quot; these operators.&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="55" LastEditDate="2019-06-06T10:51:27.060" LastActivityDate="2019-06-06T10:51:27.060" Title="Clarification of a procedure to compute the product of the exponential of two matrices" Tags="&lt;mathematics&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6355" PostTypeId="2" ParentId="6354" CreationDate="2019-06-06T06:41:00.663" Score="6" Body="&lt;p&gt;Your reasoning is correct if your two Hamiltonians commute. But, as you say, it doesn't work if they don't commute. In that case, the trick is to find something that approximates the the thing you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what you should really be thinking about is taking terms in the opposite order:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iH_1t/2}e^{iH_2t/2}e^{iH_1t/2}e^{iH_2t/2}\approx(e^{i(H_1+H_2)t/2})(e^{i(H_1+H_2)t/2})\approx e^{i(H_1+H_2)t}.&#xA;$$&lt;/span&gt;&#xA;To understand this, be more explicit. Take the first term and compare it to the claimed approximation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iH_1\delta t}e^{iH_2t\delta t}-e^{i(H_1+H_2)\delta t}&#xA;$$&lt;/span&gt;&#xA;in the limit that &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; is small. You can perform a Taylor expansion. Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(1+iH_1\delta t+\frac12H_1^2\delta t^2+\ldots)(1+iH_2\delta t+\frac12H_1^2\delta t^2+\ldots)-(1+i(H_1+H_2)\delta t+\frac12(H_1+H_2)^2\delta t^2+\ldots).&#xA;$$&lt;/span&gt;&#xA;The terms of order &lt;span class=&quot;math-container&quot;&gt;$\delta t^0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta t^1$&lt;/span&gt; all cancel, so this approximation is accurate up to &lt;span class=&quot;math-container&quot;&gt;$O(\delta t^2)$&lt;/span&gt;. Now, to get a full evolution of time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, I need &lt;span class=&quot;math-container&quot;&gt;$t/\delta t$&lt;/span&gt; time steps. All those &lt;span class=&quot;math-container&quot;&gt;$\delta t^2$&lt;/span&gt; sized errors could add up, of which there are &lt;span class=&quot;math-container&quot;&gt;$t/\delta t$&lt;/span&gt;, so the overall error is &lt;span class=&quot;math-container&quot;&gt;$O(\delta t)$&lt;/span&gt; for the full sequence. Thus, make &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; small enough and you've got a fairly accurate simulation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-06T06:41:00.663" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6356" PostTypeId="2" ParentId="6335" CreationDate="2019-06-06T07:37:07.883" Score="3" Body="&lt;p&gt;One natural generalization of that property is that Bloch vectors for a basis set must sum to 0 vector. Though, this property is not a criterion for basis sets in dimensions higher than 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1 .. d,$&lt;/span&gt; are corresponding density matrices for a basis set, then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=1}^d \rho_i = I&#xA;$$&lt;/span&gt;&#xA;Now if &lt;span class=&quot;math-container&quot;&gt;$\sigma_i,$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$i=1 .. d^2-1,$&lt;/span&gt; are generalized Pauli matrices then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_i = \frac{1}{d}\left(I + \sum_{j=1}^{d^2-1} r_{ij}\sigma_j\right), r_{ij}=\text{Tr}(\rho_i\sigma_j^\dagger)&#xA;$$&lt;/span&gt;&#xA;If we add we'll have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{d}\sum_{j=1}^{d^2-1}\left(\sum_{i=1}^d r_{ij}\right)\sigma_i = 0&#xA;$$&lt;/span&gt;&#xA;Hence &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=1}^d \boldsymbol r_i = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, we can also calculate scalar products between vectors &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol r_i$&lt;/span&gt;&lt;br&gt;&#xA;(here I assume that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sigma_i\sigma_i^\dagger)=d$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; are normalized in a sense. Also they are orthogonal, so &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sigma_i\sigma_j^\dagger)=0, i\neq j$&lt;/span&gt;, and traceless &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sigma_i)=0$&lt;/span&gt;).&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta_{kl} = \text{Tr}(\rho_k\rho_l^\dagger) = \frac{1}{d^2}\text{Tr}\left(\left(I + \sum_{j=1}^{d^2-1} r_{kj}\sigma_j\right)\left(I + \sum_{i=1}^{d^2-1} \bar{r}_{li}\sigma_i^\dagger\right)\right) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{d^2}\left(\text{Tr}I + \sum_{j=1}^{d^2-1} r_{kj}\bar{r}_{lj}\text{Tr}(\sigma_j\sigma_j^\dagger)\right) = \frac{1}{d}\left(1 + \sum_{j=1}^{d^2-1} r_{kj}\bar{r}_{lj}\right)&#xA;$$&lt;/span&gt;&#xA;Hence &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\boldsymbol r_k, \boldsymbol r_l) = d\delta_{kl} - 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we add another condition that all &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol r_i$&lt;/span&gt; correspond to pure states (this condition can be extracted from equations &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho_i)=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_i^2=\rho_i=\rho_i^\dagger$&lt;/span&gt;) then all those properties of &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol r_i$&lt;/span&gt; will form a criterion for a generalized Bloch vectors to be corresponding to some basis set of states.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-06-06T18:06:19.070" LastActivityDate="2019-06-06T18:06:19.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6357" PostTypeId="1" CreationDate="2019-06-06T11:10:12.440" Score="3" ViewCount="833" Body="&lt;p&gt;I'm using Qiskit in Visual Studio 2019. I want to draw quantum circuits, but it only shows their sizes with text instead of figures. The output on the interactive window is like this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;   ...: import numpy as np&#xA;   ...: %matplotlib inline&#xA;&#xA;In [2]: qr = QuantumRegister(1)&#xA;   ...: cr = ClassicalRegister(1)&#xA;   ...: circuit = QuantumCircuit(qr, cr)&#xA;   ...: circuit.h(qr[0])&#xA;Out [2]: &amp;lt;qiskit.extensions.standard.h.HGate at 0x2c9b16b8e80&amp;gt;&#xA;&#xA;In [3]: circuit.draw(output=&quot;mpl&quot;)&#xA;Out [3]: &amp;lt;Figure size 240.8x138.46 with 1 Axes&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any way to draw circuits correctly, or is it simply that Qiskit doesn't work in Visual Studio?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&amp;lt;edited&amp;gt; the qiskit version&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;In [6]: print(qiskit.__version__)&#xA;0.8.1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7671" LastEditorUserId="7671" LastEditDate="2019-06-11T10:22:27.407" LastActivityDate="2019-06-11T10:22:27.407" Title="Can't draw figures with Qiskit in Visual Studio" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6358" PostTypeId="2" ParentId="6335" CreationDate="2019-06-06T11:52:50.733" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6356/55&quot;&gt;This other answer&lt;/a&gt; already gave a nice proof that orthogonal bases are mapped into vectors &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_i r_i=0$&lt;/span&gt;. Here I'll work out explicitly the coordinates in a few cases, to show what kind of geometrical figure exactly comes out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll consider in particular the computational basis in &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensions: &lt;span class=&quot;math-container&quot;&gt;$\{\lvert 1\rangle,...,\lvert d\rangle\}$&lt;/span&gt;. Any other orthonormal basis is just a rotation away from the computational basis anyway, so the geometrical features should be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll consider the following standard basis of traceless Hermitians operators:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Z^{(j)}\equiv\sqrt{\frac{d}{j(j+1)}}\left(\sum_{k=1}^j\lvert j\rangle\!\langle j\rvert-j\lvert j+1\rangle\!\langle j+1\rvert\right), \,\, j=1,...,d-1,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X^{(jk)}\equiv\sqrt{d/2}[\lvert j\rangle\!\langle k\rvert + \lvert k\rangle\!\langle j\rvert],&#xA;\quad&#xA;Y^{(jk)}\equiv i\sqrt{d/2}[\lvert j\rangle\!\langle k\rvert - \lvert k\rangle\!\langle j\rvert],\,\, j&amp;gt;k.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is easy to check that for all the elements of this basis, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle X^{(jk)}\rangle=\langle Y^{(jk)}\rangle=0,$$&lt;/span&gt;&#xA;while for the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; coordinates we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;z_j(\lvert\ell\rangle) &amp;amp;=\sqrt{d/[j(j+1)]}, \text{ for all } j\ge\ell,\\&#xA;z_{\ell-1}(\lvert\ell\rangle) &amp;amp;=-\sqrt{d(\ell-1)/\ell}, \text{ for all }, \\&#xA;z_{j}(\lvert \ell\rangle) &amp;amp;=0, \text{ for all }j&amp;lt;\ell-1.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Explicit &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt; example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To get a better understanding of what this means, let us work out explicitly the &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt; case. We have two nonzero coordinates, corresponding to the operators &lt;span class=&quot;math-container&quot;&gt;$Z^{(1)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^{(2)}$&lt;/span&gt;. Remember that these matrices are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Z^{(1)}=\sqrt{3/2}\begin{pmatrix}1&amp;amp;0&amp;amp;0\\0&amp;amp; -1&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix},\qquad&#xA;Z^{(2)}=\sqrt{1/2}\begin{pmatrix}1&amp;amp;0&amp;amp;0\\0&amp;amp; 1&amp;amp;0\\0&amp;amp;0&amp;amp;-2\end{pmatrix}.$$&lt;/span&gt;&#xA;so that the corresponding coordinates are:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{array}{cc}&#xA; &amp;amp; z_1 &amp;amp; z_2 \\ \hline&#xA;\lvert1\rangle &amp;amp; \sqrt{3/2}&amp;amp; \sqrt{1/2}\\ &#xA;\lvert2\rangle &amp;amp; -\sqrt{3/2}&amp;amp; \sqrt{1/2}\\ &#xA;\lvert3\rangle &amp;amp; 0&amp;amp; -\sqrt2&#xA;\end{array}&lt;/span&gt;&#xA;It is easier to recognise what these points represent by normalising the vectors, which gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert1\rangle\doteq\begin{pmatrix}\sqrt3/2 \\ 1/2\end{pmatrix}=\begin{pmatrix}\sin(\pi/3) \\ \cos(\pi/3)\end{pmatrix},\quad&#xA;\lvert2\rangle\doteq\begin{pmatrix}-\sqrt3/2 \\ 1/2\end{pmatrix}=\begin{pmatrix}\sin(2\pi/3) \\ \cos(2\pi/3)\end{pmatrix},\quad&#xA;\lvert3\rangle\doteq\begin{pmatrix}0 \\-1\end{pmatrix}.$$&lt;/span&gt;&#xA;In other words, the states &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle,\lvert2\rangle,\lvert3\rangle$&lt;/span&gt; are mapped into an equilateral triangle:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/q51rS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q51rS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Explicit &lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt; example&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;In four dimensions, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z^{(1)}=\sqrt{2}\begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp; -1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\end{pmatrix},\quad&#xA;Z^{(2)}=\sqrt{2/3}\begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp; 1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;-2&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\end{pmatrix},\quad&#xA;Z^{(3)}=\sqrt{1/3}\begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp; 1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;-3\end{pmatrix},$$&lt;/span&gt;&#xA;and thus the computational basis is sent to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array}{ccc}&#xA; &amp;amp; z_1 &amp;amp; z_2 &amp;amp; z_3 \\ \hline&#xA;\lvert1\rangle &amp;amp; \sqrt{2}&amp;amp; \sqrt{2/3} &amp;amp; \sqrt{1/3} \\ &#xA;\lvert2\rangle &amp;amp; -\sqrt{2}&amp;amp; \sqrt{2/3} &amp;amp; \sqrt{1/3} \\ &#xA;\lvert3\rangle &amp;amp; 0&amp;amp; -2\sqrt{2/3} &amp;amp; \sqrt{1/3} \\&#xA;\lvert4\rangle &amp;amp; 0 &amp;amp; 0 &amp;amp; -\sqrt3&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Renormalising the lengths and working out the angles we find that again the elements of the basis are mapped into a regular figure, in this case a &lt;a href=&quot;https://en.wikipedia.org/wiki/Tetrahedron&quot; rel=&quot;nofollow noreferrer&quot;&gt;tetrahedron&lt;/a&gt; (as in, the states are mapped into the vertices of a tetrahedron):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZKdxQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZKdxQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;General &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The natural next step is to ask whether this feature (that is, that the computational basis is mapped into the regular &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt;-dimensional &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-vertices polytope in which the pairwise distance between vertices is constant) still holds increasing the number of dimensions. It seems almost obvious that it does, but I haven't found a nice way to show it yet.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-06T15:41:42.427" LastActivityDate="2019-06-06T15:41:42.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6360" PostTypeId="2" ParentId="6315" CreationDate="2019-06-06T12:22:14.700" Score="1" Body="&lt;p&gt;Unfortunately, I'm pretty sure that the functionality you desire does not exist. You'll need to do it by constructing the unitary yourself, for example via &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1344/given-a-decomposition-for-a-unitary-u-how-do-you-decompose-the-corresponding?rq=1&quot;&gt;this method&lt;/a&gt; provided in the answer to another question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, the full specification for OpenQASM 2.0 can be found &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-06T12:22:14.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6361" PostTypeId="2" ParentId="6326" CreationDate="2019-06-06T12:53:46.033" Score="4" Body="&lt;p&gt;Fidelity is a single-number measure of how good a gate is. Since there are many ways that a gate can go wrong, there are multiple ways that the fidelity can be defined. The exact answer to your question will therefore depend on which kind of fidelity you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any measure of fidelity will typically involve comparing the gate that you wanted to the channel that actually happened. This channel can be described by a Choi matrix. More discussion of channels and Choi matrices can be found in the answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5794/what-is-a-complementary-map/5797#5797&quot;&gt;to this question&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a concrete example in Qiskit, see the notebook on how to use the &lt;a href=&quot;https://qiskit.org/documentation/ignis/tomography.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tomography tool from Qiskit Ignis&lt;/a&gt;. For example, here is the tomography of a single qubit Hadamard gate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Process tomography of a Hadamard gate&#xA;q = QuantumRegister(1)&#xA;circ = QuantumCircuit(q)&#xA;circ.h(q[0])&#xA;&#xA;# Run circuit on unitary simulator to find ideal unitary&#xA;job = qiskit.execute(circ, Aer.get_backend('unitary_simulator'))&#xA;ideal_unitary = job.result().get_unitary(circ)&#xA;# convert to Choi-matrix in column-major convention&#xA;choi_ideal = outer(ideal_unitary.ravel(order='F'))&#xA;&#xA;# Generate process tomography circuits and run on qasm simulator&#xA;qpt_circs = process_tomography_circuits(circ, q)&#xA;job = qiskit.execute(qpt_circs, Aer.get_backend('qasm_simulator'), shots=4000)&#xA;&#xA;# Extract tomography data so that counts are indexed by measurement configuration&#xA;qpt_tomo = ProcessTomographyFitter(job.result(), qpt_circs)&#xA;qpt_tomo.data&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given the data, we can then find the best fit to a Choi matrix. For example, using the MLE Least-Squares tomographic reconstruction.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;choi_lstsq = qpt_tomo.fit(method='lstsq')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By comparing this with the ideal Choi matrix, we can calculate the fidelity using the &lt;code&gt;state_fidelity&lt;/code&gt; and &lt;code&gt;process_fidelity&lt;/code&gt; tools. For the latter, we'll need to use &lt;code&gt;require_cptp=False&lt;/code&gt; in case the Choi matrix doesn't quite describe a cptp map.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print('fit fidelity (state):', state_fidelity(choi_ideal / 2, choi_lstsq.data / 2))&#xA;print('fit fidelity (process):', np.real(process_fidelity(choi_ideal, choi_lstsq.data, require_cptp=False)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should give an output that is something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fit fidelity (state): 0.9976767994222256&#xA;fit fidelity (process): 0.995358994837865&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-06-19T09:05:50.413" LastActivityDate="2019-06-19T09:05:50.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6362" PostTypeId="1" CreationDate="2019-06-06T13:59:21.063" Score="3" ViewCount="133" Body="&lt;p&gt;I am using Qiskit in an algorithm. In the end, I am measuring exactly a register of 4 qubits but the histograms show states with 5 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qwc = QuantumCircuit(qnodes, qnodes2, cqnodes, cqnodes2)&#xA;qwc.measure(qnodes, cnodes)&#xA;qwc.draw(output=&quot;mpl&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and finally &lt;code&gt;qnodes2&lt;/code&gt; is measured and represented in the plot as states qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas what the problem might be?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="26" LastEditDate="2019-06-09T08:20:46.783" LastActivityDate="2019-06-09T08:20:46.783" Title="Measurement inconsistency in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6363" PostTypeId="2" ParentId="6357" CreationDate="2019-06-06T14:07:05.100" Score="2" Body="&lt;p&gt;If you are in the interactive window, it probably works similarly to Jupyter Notebooks. I would run &lt;code&gt;%matplotlib inline&lt;/code&gt;, and then try calling &lt;code&gt;circuit.draw(output='mpl')&lt;/code&gt; again. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also try running the line &lt;code&gt;circuit.draw(output='mpl')&lt;/code&gt; twice, as that also will render the &lt;code&gt;Figure&lt;/code&gt; in Jupyter Notebookes.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastEditorUserId="6180" LastEditDate="2019-06-06T18:34:57.890" LastActivityDate="2019-06-06T18:34:57.890" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6364" PostTypeId="1" AcceptedAnswerId="6369" CreationDate="2019-06-06T14:40:54.490" Score="4" ViewCount="1174" Body="&lt;p&gt;Where does Qiskit put the rendered figure created by &lt;code&gt;circuit.draw(output='mpl')&lt;/code&gt;? &lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="26" LastEditDate="2019-06-09T08:21:41.573" LastActivityDate="2019-06-09T08:21:41.573" Title="About the Qiskit draw function" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6365" PostTypeId="1" AcceptedAnswerId="6373" CreationDate="2019-06-06T15:43:00.803" Score="6" ViewCount="314" Body="&lt;p&gt;I am trying to solve a minimum spanning tree problem using Grover's Algorithm. To accomplish this I would need to search a list for the minimum weight or edge for each point, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the following list:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gusYe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gusYe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one use Grover's algorithm to search for the minimum weight ie. 1 and then return the values (C, G). I am trying to understand how this problem would be practically applied on either an actual quantum processor or the simulator. I know that an oracle is needed to give the values, but how would this be implemented. Any help is appreciated. &lt;/p&gt;&#xA;" OwnerUserId="7674" LastEditorUserId="26" LastEditDate="2019-06-07T14:11:52.790" LastActivityDate="2019-06-07T14:11:52.790" Title="Implementation of Grover's Algorithm (minimum spanning tree)" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6366" PostTypeId="2" ParentId="6319" CreationDate="2019-06-06T18:11:44.193" Score="1" Body="&lt;p&gt;I think my circuit is wrong is as there is indeed a conditional phase shift on q[1], but as I said it also adds to him a 'global' phase which I didn't care for. This 'global' phase isn't actually global for the whole 2-qubits system, as it doesn't affect q[2].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A reminder for me of the necessity to look at the system as a whole when talking about qubits, as opposed to classical bit by bit examination.&lt;/p&gt;&#xA;" OwnerUserId="7642" LastActivityDate="2019-06-06T18:11:44.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6367" PostTypeId="1" AcceptedAnswerId="6372" CreationDate="2019-06-06T18:48:27.553" Score="5" ViewCount="651" Body="&lt;p&gt;I do not know if the question is not too easy, but I'll put it here, because I'm interested in it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the state of a qubit is often stated in this form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$$&lt;/span&gt;&#xA;An example would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\frac{1}{\sqrt{2}}|0\rangle+\frac{1}{\sqrt{2}}|1\rangle$$&lt;/span&gt;&#xA;So now to my actual question. Suppose that in front of the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and/or &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; would be an &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;About as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=i\alpha|0\rangle+\beta|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would that say, what would be the meaning of it. In short what does that mean? What does this &quot;&lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&quot; say?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope my question is understandable.&lt;/p&gt;&#xA;" OwnerUserId="4974" LastActivityDate="2019-06-07T01:23:15.177" Title="Complex number in the representation of a qubit" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6369" PostTypeId="2" ParentId="6364" CreationDate="2019-06-06T19:30:54.700" Score="6" Body="&lt;p&gt;Qiskit does not save the rendered &lt;code&gt;Figure&lt;/code&gt; of the circuit anywhere, unless you provide a &lt;code&gt;filename&lt;/code&gt; to the call. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: &lt;code&gt;circuit.draw(filename='&amp;lt;file_path&amp;gt;')&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regards to having the &lt;code&gt;Figure&lt;/code&gt; render and stay open, you simply need to remove a line of code. If you go to where qiskit is installed in your environment, go into the file &lt;code&gt;qiskit/visualization/matplotlib.py&lt;/code&gt;, and go to line 436 you will see the line &lt;code&gt;plt.close(self.figure)&lt;/code&gt;. Comment this line out, and run your program again. You should see the &lt;code&gt;Figure&lt;/code&gt; in a new window.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-06-06T19:30:54.700" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6371" PostTypeId="2" ParentId="6367" CreationDate="2019-06-06T20:08:35.620" Score="6" Body="&lt;p&gt;You have applied a&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{pmatrix}&#xA;i &amp;amp;0\\&#xA;0&amp;amp;1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have not affected the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in the computational basis but you have affected other observables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, consider the case you described already as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mid \psi \rangle = \frac{1}{\sqrt{2}} \mid 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 \rangle\\&#xA;U \mid \psi \rangle = \frac{i}{\sqrt{2}} \mid 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 \rangle\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before if you applied &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; you would just get the same state back.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X \mid \psi \rangle = X \frac{1}{\sqrt{2}} \mid 0 \rangle + X \frac{1}{\sqrt{2}} \mid 1 \rangle\\&#xA;= \frac{1}{\sqrt{2}} \mid 1 \rangle + \frac{1}{\sqrt{2}} \mid 0 \rangle\\&#xA;= \frac{1}{\sqrt{2}} \mid 0 \rangle + \frac{1}{\sqrt{2}} \mid 1 \rangle\\&#xA;= \mid \psi \rangle\\&#xA;X U \mid \psi \rangle = X \frac{i}{\sqrt{2}} \mid 0 \rangle + X \frac{1}{\sqrt{2}} \mid 1 \rangle\\&#xA;= \frac{i}{\sqrt{2}} \mid 1 \rangle + \frac{1}{\sqrt{2}} \mid 0 \rangle\\&#xA;\neq U \mid \psi \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So before measuring X gave 1 with probability 1, but after applying &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; it did not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So even though it didn't affect the probabilities in the eigenbasis of the Z operator which gives the computational basis, if you do other transformations, you can see the effect.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-06T20:08:35.620" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6372" PostTypeId="2" ParentId="6367" CreationDate="2019-06-07T01:23:15.177" Score="4" Body="&lt;p&gt;Let's consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle.$$&lt;/span&gt;&#xA;As you said, the magnitudes &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; give you the relative probabilities of finding the state in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if you make a measurement in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is more to it than the magnitudes however, because quantum mechanics is based on the idea of waves, and waves have both a magnitude and a &lt;em&gt;phase&lt;/em&gt;. Imagine two sine waves of equal amplitude, what happens when you interfere them with each other? The answer depends on if they are in-phase (they sum to something with double the amplitude), out-of-phase (the result has zero amplitude), or something in between (somewhere between zero and double amplitude).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, when you see &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle$&lt;/span&gt;, imagine &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; as a ray in the 2D complex plane. This ray has magnitude &lt;span class=&quot;math-container&quot;&gt;$|\alpha|$&lt;/span&gt;, but it also has a phase. If we interfere our qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with another &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=\alpha'|0\rangle+\beta'|1\rangle$&lt;/span&gt;, the result will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(|\psi\rangle+|\phi\rangle\right)=\frac{\alpha+\alpha'}{\sqrt{2}}|0\rangle+\frac{\beta+\beta'}{\sqrt{2}}|1\rangle.$$&lt;/span&gt;&#xA;The coefficient of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is found by adding together the two rays &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\alpha'$&lt;/span&gt;, and similarly for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\beta'$&lt;/span&gt;. Even if &lt;span class=&quot;math-container&quot;&gt;$|\alpha|=|\alpha'|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\beta|=|\beta'|$&lt;/span&gt;, the result will be very different depending on the phases.&lt;/p&gt;&#xA;" OwnerUserId="452" LastActivityDate="2019-06-07T01:23:15.177" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6373" PostTypeId="2" ParentId="6365" CreationDate="2019-06-07T07:58:07.920" Score="5" Body="&lt;p&gt;Just giving two possibilities. There may be others more efficient but that can be a good start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us take your case. You have a graph with 8 points. Say we index each point by an integer alphabetically: A=0,B=1,C=2,...H=7. You can represent them in supperposition using a 3-qubit register and the Hadamard transform. Add another 3-qubit register. This give us all possible connexions between points:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{8} (| AA \rangle + | AB \rangle + | AC \rangle + ... + | GH \rangle) $$&lt;/span&gt;&#xA;Of course, in that case, we consider we can have loops and we also have connexions that may not exist in our graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then using another register, you can compute the edge value for a connexion (using for example a controlled-adder circuit to add the edge value depending on the connexion computational basis):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{8} (| AA \rangle + | AB \rangle + | AC \rangle + ... + | GH \rangle) | 0\rangle \rightarrow &#xA;\frac{1}{8} (| AA \rangle | 0\rangle + | AB \rangle | 5\rangle + | AC \rangle | 7\rangle + ... + | GH \rangle | 6\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, another way I can think of is to assign an integer index to the connexion/edges of the graph themselves , which lets you work on only one register for storing the index. You just need enough qubits to have all edges indices in superposition. And again, use another register to compute their values like above. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the search, you would look at the edge value register when searching.&#xA;You can use &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;noreferrer&quot;&gt;Durr and Hoyer's adaptation of Grover search to find the minimum&lt;/a&gt;. Or in your case, directly implement an oracle that recognizes the value 1 in the edge/value register (imagine this would be your first check/try to find the minimum) and use a simple Grover search.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-06-07T07:58:07.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6374" PostTypeId="1" CreationDate="2019-06-07T17:49:36.137" Score="6" ViewCount="338" Body="&lt;p&gt;&lt;strong&gt;Question 1&lt;/strong&gt;: The bell state for a 2-qubit system has been defined in Neilsen and Chuang's book as the set of maximally entangled states spanned by  &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle + |11\rangle, |00\rangle - |11\rangle, |01\rangle + |10\rangle, |01\rangle- |10\rangle \}$&lt;/span&gt;. What is the higher dimensional definition of a Bell state for an n-qubits system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt;: More specificity, Consider the toric code on a &lt;span class=&quot;math-container&quot;&gt;$L\times L$&lt;/span&gt; lattice. There are &lt;span class=&quot;math-container&quot;&gt;$2L^2$&lt;/span&gt; qubits on it. Consider the minimal case when &lt;span class=&quot;math-container&quot;&gt;$L=3$&lt;/span&gt;, ie. we have &lt;span class=&quot;math-container&quot;&gt;$18$&lt;/span&gt; qubits. How does the code space look like? Is it some sort of &quot;bell-state&quot; for these qubits? Is it possible to explicitly write the code space for this as in the case of say, a repetition code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7685" LastEditorUserId="26" LastEditDate="2019-06-09T08:19:30.840" LastActivityDate="2019-06-10T13:50:44.527" Title="What is the definition of Bell state on a n-qubit system?" Tags="&lt;entanglement&gt;&lt;resource-request&gt;&lt;error-correction&gt;&lt;terminology&gt;&lt;surface-code&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6375" PostTypeId="1" AcceptedAnswerId="6377" CreationDate="2019-06-07T21:39:40.613" Score="6" ViewCount="101" Body="&lt;p&gt;This question relates to exercise 10.4 in Nielsen and Chuang. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For syndrome diagnosis, the textbook provides an example where one has four projectors, by which, you can identify where a one qubit error has occurred.  In this scheme, the syndrome measurement does not cause any change to the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exercise asks you to write down the projectors for the eight computational basis states, which is easy enough. &lt;span class=&quot;math-container&quot;&gt;$|0/1 \,\,  0/1 \,\, 0/1 \rangle \langle0/1 \,\,  0/1 \,\, 0/1 |$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the point of the question is for one to say that when you project these onto your one qubit corrupted state, you can tell where the one qubit error has occurred.  However, I thought projective measurement needs to be repeated multiple times to be able to reconstruct your full state (for example, if my state is &lt;span class=&quot;math-container&quot;&gt;$\alpha |000\rangle + \beta|111\rangle$&lt;/span&gt;, in order for me to actually find out what &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are, I need to repeat projection of the state on to  &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; multiple times to form a statistic.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the bottom line is, I don't see how projections on to the eight computational basis states can be used to diagnose the error syndrome.  Since projecting your state onto any of the eight computational basis states will mess up your state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Even before getting to the question above, how does one perform the syndrome measurement without causing any change to the state?  On page 428, it's claimed that if the corrupted state is &lt;span class=&quot;math-container&quot;&gt;$\alpha |100\rangle + \beta|011\rangle $&lt;/span&gt;, it remains &lt;span class=&quot;math-container&quot;&gt;$\alpha |100\rangle + \beta|011\rangle $&lt;/span&gt; even after the syndrome measurement.  I'm having a hard time wrapping my head around the idea of constructing such syndrome projectors in terms of designing an actual experiment.)&lt;/p&gt;&#xA;" OwnerUserId="4399" LastEditorUserId="23" LastEditDate="2019-06-08T23:57:25.633" LastActivityDate="2019-06-08T23:57:25.633" Title="Error syndromes and recovery procedure in bit flip code" Tags="&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6376" PostTypeId="1" AcceptedAnswerId="6379" CreationDate="2019-06-07T23:06:22.833" Score="6" ViewCount="189" Body="&lt;p&gt;Consider the following protocol.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are given either&#xA; &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \alpha_{0} |0\rangle + \alpha_{1}|1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha_{0}^{2}$&lt;/span&gt; is chosen uniformly at random from &lt;span class=&quot;math-container&quot;&gt;$[0, 1]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha_{1}^{2}$&lt;/span&gt; is chosen accordingly to normalize the sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We measure in the computational basis and depending on the result, discriminate between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is intuitive to see that the protocol is highly likely to fail. But what might be a mathematical way to reach the same conclusion?&lt;/p&gt;&#xA;" OwnerUserId="7688" LastEditorUserId="7688" LastEditDate="2019-06-08T04:54:29.530" LastActivityDate="2019-06-10T19:08:19.600" Title="Question on state distinguishability" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6377" PostTypeId="2" ParentId="6375" CreationDate="2019-06-08T02:51:46.020" Score="5" Body="&lt;p&gt;You quoted the first part of the exercise; your question is exactly the second part of the exercise :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Exercise 10.4 (2) asks you to show that the described recovery procedure (the one which projects the state on one of the 8 basis states) works only for computational basis states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, if you have a corrupted state &lt;span class=&quot;math-container&quot;&gt;$\alpha |100\rangle + \beta|011\rangle$&lt;/span&gt;, projecting it onto one of the basis states will yield &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|011\rangle$&lt;/span&gt;, telling you that there was indeed an error on the first qubit, but at the same time destroying the superposition and ruining the calculation. This is why you have to do a smarter measurement than that to preserve superposition.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the second part of the question, for me it is easier to think about these measurements in terms of measuring &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2Z_3$&lt;/span&gt; observables (see page 430 and exercise 10.3). To measure an observable &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt;, you can do the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;allocate an extra qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;do a CNOT with &lt;span class=&quot;math-container&quot;&gt;$q1$&lt;/span&gt; as control and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; as target, &lt;/li&gt;&#xA;&lt;li&gt;do a CNOT with &lt;span class=&quot;math-container&quot;&gt;$q2$&lt;/span&gt; as control and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; as target, &lt;/li&gt;&#xA;&lt;li&gt;measure &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in computational basis.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If you do the math, you'll see that the measurement will give 1 if qubits 1 and 2 have different parity and 0 if they have the same parity (which is exactly what you're looking for) without destroying the superposition (since in each term of the superposition the parity of qubits 1 and 2 is the same, even if qubit states differ).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-06-08T03:00:10.630" LastActivityDate="2019-06-08T03:00:10.630" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6379" PostTypeId="2" ParentId="6376" CreationDate="2019-06-08T14:26:20.223" Score="10" Body="&lt;p&gt;This is a question from classical probability theory. I suppose &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; are real (and &lt;span class=&quot;math-container&quot;&gt;$\alpha_i \ge 0$&lt;/span&gt;), though it's also possible to consider the complex case. The probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from the measurement of &lt;span class=&quot;math-container&quot;&gt;$\alpha_{0} |0\rangle + \alpha_{1}|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\alpha_0^2$&lt;/span&gt;. This probability is in fact a conditional probability &lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle ~~\vert~~|\phi\rangle = \alpha_{0} |0\rangle + \alpha_{1}|1\rangle )$&lt;/span&gt; of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; where the condition is &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \alpha_{0} |0\rangle + \alpha_{1}|1\rangle$&lt;/span&gt;. In a discrete case (if &lt;span class=&quot;math-container&quot;&gt;$\alpha_0$&lt;/span&gt; has only finite number of possible values) to calculate overall probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; we could use the law of total probability &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(|0\rangle) = \sum_{a_0} P(|0\rangle ~~\vert~~|\phi\rangle = \alpha_{0} |0\rangle + \alpha_{1}|1\rangle )P(|\phi\rangle = \alpha_{0} |0\rangle + \alpha_{1}|1\rangle)&#xA;$$&lt;/span&gt;&#xA;But we have a continuous case here with &lt;span class=&quot;math-container&quot;&gt;$P(|\phi\rangle = \alpha_{0} |0\rangle + \alpha_{1}|1\rangle) = 0$&lt;/span&gt;.&lt;br&gt;&#xA;So we need to take the integral. There is a theory of how to calculate such probabilities with integrals, but I think in our case it is the correct way just to assume that &lt;span class=&quot;math-container&quot;&gt;$\alpha_0^2$&lt;/span&gt; is uniformly distributed on &lt;span class=&quot;math-container&quot;&gt;$\{\frac{k}{n}, k=1..n\}$&lt;/span&gt;, calculate probability &lt;span class=&quot;math-container&quot;&gt;$P_n(|0\rangle)$&lt;/span&gt; and then take the limit for &lt;span class=&quot;math-container&quot;&gt;$n \rightarrow \infty$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_n(|0\rangle) = \sum_{k=1}^n P(|0\rangle ~~\vert~~|\phi\rangle = \sqrt{\frac{k}{n}} |0\rangle + \sqrt{\frac{n-k}{n}}|1\rangle )P(|\phi\rangle = \sqrt{\frac{k}{n}} |0\rangle + \sqrt{\frac{n-k}{n}}|1\rangle) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \sum_{k=1}^n \frac{k}{n} \cdot \frac{1}{n} = \sum_{k=1}^n \frac{k}{n^2} = \frac{n(n+1)}{2}\cdot\frac{1}{n^2} = \frac{n+1}{2n}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The limit is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;, which coincides with the probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from measuring &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |+\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;&lt;br&gt;&#xA;Note that I assumed that you are given a lot of copies of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; or a lot of samples of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; (with varying &lt;span class=&quot;math-container&quot;&gt;$\alpha_0$&lt;/span&gt;) and you are asked to distinguish the case. If you are given only one copy of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, then you can't distinguish it (with certainty) simply because the measurement of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; will give random result.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;Another approach is to calculate the expected density matrix of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E(|\phi\rangle\langle\phi|) = \int_0^1(\sqrt{x_0}|0\rangle+\sqrt{1-x_0}|1\rangle)(\sqrt{x_0}\langle 0|+\sqrt{1-x_0}\langle 1|)dx_0 = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \int_0^1x_0dx_0 \cdot |0\rangle\langle 0| + \int_0^1(1-x_0)dx_0 \cdot |1\rangle\langle 1| + $$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ + \int_0^1\sqrt{x_0(1-x_0)}dx_0 \cdot |0\rangle\langle 1| + \int_0^1\sqrt{(1-x_0)x_0}dx_0 \cdot |1\rangle\langle 0| = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{2}(|0\rangle\langle 0| + |1\rangle\langle 1|) + \frac{\pi}{8}(|0\rangle\langle 1| + |1\rangle\langle 0|) &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the overall probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from measuring &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; in computational basis is &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(E(|\phi\rangle\langle\phi|) \cdot |0\rangle\langle 0|) = \frac{1}{2}$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here we can see the difference with the complex case, since the expected density matrix will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}I$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-06-10T19:08:19.600" LastActivityDate="2019-06-10T19:08:19.600" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="6380" PostTypeId="1" CreationDate="2019-06-08T18:40:24.817" Score="7" ViewCount="52" Body="&lt;p&gt;I was wondering how to create generalized entangled superpositions of qubits when I came to need of an algorithm to generate the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have two &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit states, &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_X \alpha_X\ |X\rangle$$&lt;/span&gt;&#xA;and, &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle = \sum_X \beta_X\ |X\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I come up with a state, &lt;span class=&quot;math-container&quot;&gt;$$|\psi'\rangle = \frac1{\sqrt N}\sum_X (\alpha_X+\beta_X)\ |X\rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the normalization factor?&lt;/p&gt;&#xA;" OwnerUserId="7693" LastEditorUserId="26" LastEditDate="2019-06-09T08:17:26.253" LastActivityDate="2019-06-09T08:17:26.253" Title="Summation of amplitudes" Tags="&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-06-10T14:48:54.507" ContentLicense="CC BY-SA 4.0" />
  <row Id="6381" PostTypeId="1" AcceptedAnswerId="6407" CreationDate="2019-06-08T19:32:16.230" Score="3" ViewCount="53" Body="&lt;p&gt;I am interested in a couple of books or arXiv links to learn how to develop quantum circuits for the purpose of simulating quantum multi-body systems. Moreover, I am interested in learning how to develop an ansatz from a quantum circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions will be very appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="26" LastEditDate="2019-06-09T08:16:36.857" LastActivityDate="2019-06-11T12:18:33.207" Title="Primer for learning about quantum circuits simulating systems" Tags="&lt;circuit-construction&gt;&lt;resource-request&gt;&lt;chemistry&gt;&lt;many-body-systems&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6382" PostTypeId="1" CreationDate="2019-06-08T20:02:09.220" Score="1" ViewCount="61" Body="&lt;p&gt;Let's say I have a circuit that given in the figure &lt;a href=&quot;https://i.stack.imgur.com/N1o7Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N1o7Z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see that this circuit consists of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-Toffoli gates and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; C-NOT gates, and to construct this entire circuit using only single qubit gates I would require at least &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; C-NOT gates &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; for each of the step UMA and MAJ. That makes it a total of at least &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; C-NOT Gates. Now my question is if I modify these circuits by putting two controls for each of them such that each of them operates if both controls are (say) &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Then I have &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; CCCC-NOT gates and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; CCC-NOT gates. Now for this, I need at least &lt;span class=&quot;math-container&quot;&gt;$(8\times 4 + 10\times 2=52)$&lt;/span&gt; C-NOT gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is using an article that says to stimulate a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit Toffoli gate we need at least &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; C-NOT gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my reasoning for my circuit correct? Can somebody help?  &lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-06-09T08:15:20.973" LastActivityDate="2019-06-09T08:15:20.973" Title="Controlled controlled adder gates involved" Tags="&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6383" PostTypeId="1" CreationDate="2019-06-08T20:24:51.513" Score="6" ViewCount="312" Body="&lt;p&gt;Is it possible to run grover's diffusion step on a subset of the possible input space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this, I mean is it possible to do the diffusion process with a state space isn't in a total superposition of all states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have a 2 qubit system in a equal superposition of states &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt;, but have exactly a 0 probability of measuring a &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt;. Also, let's say I have a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; that only outputs a 1 for the input 00. Is there a modification to Grover's where I can do the diffusion only on the &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt; states and leave the &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt; state unchanged?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If that is possible, does it speedup the diffusion? Say I have a state with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits but &lt;span class=&quot;math-container&quot;&gt;$2^x$&lt;/span&gt; non-zero states where &lt;span class=&quot;math-container&quot;&gt;$x &amp;lt; n$&lt;/span&gt;, does this modified grover's algorithm still run in &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(2^{n/2})$&lt;/span&gt;, or can it run in &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(2^{x/2})$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7694" LastEditorUserId="26" LastEditDate="2019-06-09T08:14:04.507" LastActivityDate="2019-06-09T08:14:04.507" Title="Grover's diffusion on subset of input space" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6384" PostTypeId="2" ParentId="6383" CreationDate="2019-06-09T05:18:15.067" Score="6" Body="&lt;p&gt;This can work. There's no reliance on powers of two or anything like that in the basic conception of the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a subset of computational basis states with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; elements and you have a superposition: &lt;span class=&quot;math-container&quot;&gt;$$\left |\phi\right&amp;gt; = \frac{1}{\sqrt{N}}\sum_{x \in S}\left|x\right&amp;gt;$$&lt;/span&gt; then basically all you need to do is change the classic Grover diffusion operator with the complete &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit uniform superposition &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$$2\left|\psi\right&amp;gt;\left&amp;lt;\psi\right| - I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;into: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$2\left|\phi\right&amp;gt;\left&amp;lt;\phi\right| - I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common way of composing the Grover diffusion operator for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system without fancy gates is to make it out of two Hadamards and some implementation of the diagonal matrix &lt;span class=&quot;math-container&quot;&gt;$2\left|0\right&amp;gt;\left&amp;lt;0\right| - I$&lt;/span&gt; via:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}(2 \left|0\right&amp;gt;\left&amp;lt;0\right| - I)H^{\otimes n}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get our new diffusion operator, we just need to replace the left Hadamard gate with a gate &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and the right Hadamard with &lt;span class=&quot;math-container&quot;&gt;$B^*$&lt;/span&gt; (if they are not the same) where &lt;span class=&quot;math-container&quot;&gt;$B\left|0\right&amp;gt; = \left|\phi\right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a fully general perspective, if your subset selection method is weird, like all prime-numbered states, I suspect realistically implementing &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (and having &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;$&lt;/span&gt; in the first place) on, say, IBM Q may be difficult to the point of voiding the advantage of the algorithm, since you'd have to include individual gates to zero the probability of all the specific irrelevant states in the implementation of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming no difficulty with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, it will run in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; with your new &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. The ideal stopping point will also still be &lt;span class=&quot;math-container&quot;&gt;$\approx \frac{\pi}{4}\sqrt{N}$&lt;/span&gt; iterations.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastActivityDate="2019-06-09T05:18:15.067" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6385" PostTypeId="1" CreationDate="2019-06-09T06:42:05.890" Score="6" ViewCount="384" Body="&lt;p&gt;Why should we use inverse QFT instead of QFT in Shor's algorithm? When I tried to simulate Shor's algorithm for small numbers, I got an answer even when I used just QFT instead of inverse QFT.&lt;/p&gt;&#xA;" OwnerUserId="5410" LastEditorUserId="2224" LastEditDate="2019-06-11T00:50:56.493" LastActivityDate="2019-06-11T00:50:56.493" Title="Why should we use inverse QFT instead of QFT in Shor's algorithm?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6386" PostTypeId="1" AcceptedAnswerId="6396" CreationDate="2019-06-09T10:10:41.253" Score="9" ViewCount="389" Body="&lt;p&gt;Let's say, that we have an optimization problem in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \min_x f(x) \\ g_i(x) \leq 0, i = 1, ..., m \\ h_j(x) = 0, j = 1, ..., p,&#xA; $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is an objective function, &lt;span class=&quot;math-container&quot;&gt;$g_i(x)$&lt;/span&gt; are inequality constraints and &lt;span class=&quot;math-container&quot;&gt;$h_j(x)$&lt;/span&gt; are equality constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently I was reading about the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;noreferrer&quot;&gt;adiabatic quantum computing&lt;/a&gt;&lt;/em&gt;. The Wikipedia says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;First, a (potentially complicated) Hamiltonian is found whose ground state describes the solution to the problem of interest. Next, a system with a simple Hamiltonian is prepared and initialized to the ground state. Finally, the simple Hamiltonian is adiabatically evolved to the desired complicated Hamiltonian. By the adiabatic theorem, the system remains in the ground state, so at the end the state of the system describes the solution to the problem. Adiabatic quantum computing has been shown to be polynomially equivalent to conventional quantum computing in the circuit model.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there some general method of expressing the optimization problem (e.g. as presented above) in the Hamiltonian formalism used in &lt;em&gt;adiabatic quantum computing&lt;/em&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="10480" LastEditDate="2021-04-07T17:27:41.810" LastActivityDate="2021-04-07T17:27:41.810" Title="Is there a general method of expressing optimization problem as a Hamiltonian?" Tags="&lt;optimization&gt;&lt;adiabatic-model&gt;&lt;spin-glasses&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6387" PostTypeId="1" AcceptedAnswerId="6415" CreationDate="2019-06-09T11:11:50.623" Score="5" ViewCount="67" Body="&lt;p&gt;Let's say, that we have an optimization problem in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \min_x f(x) \\ g_i(x) \leq 0, i = 1, ..., m \\ h_j(x) = 0, j = 1, ..., p,&#xA; $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is an objective function, &lt;span class=&quot;math-container&quot;&gt;$g_i(x)$&lt;/span&gt; are inequality constraints and &lt;span class=&quot;math-container&quot;&gt;$h_j(x)$&lt;/span&gt; are equality constraints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;em&gt;adiabatic quantum computing&lt;/em&gt; the solution of this problem can be expressed as the ground state of some Hamiltonian. But I think, that it is possible to construct two or more Hamiltonians, whose ground states are solutions to the same problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Summarizing, how to tell, if two Hamiltonians represent the same optimization problem (or rather their ground states are solutions to the same problem)?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="2224" LastEditDate="2019-06-11T01:43:42.420" LastActivityDate="2019-06-12T18:16:42.510" Title="How to tell if the ground states of two Hamiltonians are solutions of the same optimization problem?" Tags="&lt;quantum-state&gt;&lt;adiabatic-model&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6388" PostTypeId="1" AcceptedAnswerId="6389" CreationDate="2019-06-09T14:09:39.247" Score="2" ViewCount="190" Body="&lt;p&gt;The maximally mixed state on m qubits is defined to be the quantum state with associated density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_m = \frac{1}{2^m} I$&lt;/span&gt;. Examples are &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On one qubit this is &lt;span class=&quot;math-container&quot;&gt;$\rho_1 = \frac{1}{2}(|0\rangle\langle0|+|1\rangle\langle1|) = \frac{1}{2}I$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;On two qubits we have &lt;span class=&quot;math-container&quot;&gt;$\rho_2 = \frac{1}{4} (|00\rangle\langle00| +|01\rangle\langle01|+|10\rangle\langle10|+|11\rangle\langle11|$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My question is the following: how can the corresponding state vector &lt;span class=&quot;math-container&quot;&gt;$|\phi_m\rangle$&lt;/span&gt; be expressed in terms of the standard basis elements, eg. &lt;span class=&quot;math-container&quot;&gt;$|\phi_2\rangle = \sum_{i,j}  a_{i,j}|ij\rangle$&lt;/span&gt;? What are the values of &lt;span class=&quot;math-container&quot;&gt;$a_{i,j}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5710" LastEditorUserId="26" LastEditDate="2019-06-10T17:19:16.630" LastActivityDate="2019-06-10T17:19:16.630" Title="How can I write the maximally mixed state on m qubits as a linear combination of basis vectors?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6389" PostTypeId="2" ParentId="6388" CreationDate="2019-06-09T14:46:28.993" Score="2" Body="&lt;p&gt;If by &quot;&lt;em&gt;corresponding state vector&lt;/em&gt;&quot; you mean a pure state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle\!\langle\psi\rvert$&lt;/span&gt; is maximally mixed, then the answer is that there isn't one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$\rho=\lvert\psi\rangle\!\langle\psi\rvert$&lt;/span&gt; for some ket state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; &lt;em&gt;if and only if&lt;/em&gt; it is pure. One easy way to check for this is to compute &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\rho^2)$&lt;/span&gt;, which is the so-called &lt;em&gt;purity&lt;/em&gt; of the state, and equals &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; &lt;em&gt;if and only if&lt;/em&gt; the state is pure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A maximally mixed state is as far away as possible from this situation, in the sense that it is the state (or one of the states) which corresponds to the minimal possible value of the purity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might also want to have a look at these related questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5952/55&quot;&gt;How to show a density matrix is in a pure/mixed state?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2347/55&quot;&gt;Density matrices for pure states and mixed states&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-06-09T14:46:28.993" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6390" PostTypeId="2" ParentId="6385" CreationDate="2019-06-09T19:59:59.243" Score="8" Body="&lt;p&gt;For Shor's algorithm, it actually doesn't matter which one you use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply the QFT twice, it is equivalent to a classical multiplication by -1 modulo &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the size of the register. That is to say, it reverses the order of all of the computational basis states except for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; which stays where it started. &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|-k\rangle = |2^n - k\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in Shor's algorithm, the output of the QFT is a state with amplitudes whose magnitudes are approximately periodic with a period that divides &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. This isn't a coincidence; it's crucial to how the whole algorithm works. Because the period is a divisor of the number of computational basis states, reversing their order has a negligible effect on the state. Therefore there is little difference between using the QFT and the inverse QFT, because &lt;span class=&quot;math-container&quot;&gt;$\text{QFT}^{-1} = \text{QFT} \cdot \text{QFT}^{-1} \cdot \text{QFT}^{-1} = \text{QFT} \cdot \text{Mul}(-1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22~input%22%2C1%2C1%2C1%2C%22~guess%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setR%22%2C%22arg%22%3A55%7D%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A26%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22X%22%5D%2C%5B%22inputA10%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22*BToAmodR6%22%5D%2C%5B%22QFT%E2%80%A010%22%5D%2C%5B%22Chance10%22%5D%2C%5B%22QFT10%22%5D%2C%5B%22QFT10%22%5D%2C%5B%22Chance10%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~guess%22%2C%22name%22%3A%22guess%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~input%22%2C%22name%22%3A%22input%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~out%22%2C%22name%22%3A%22out%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;Example&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22~input%22%2C1%2C1%2C1%2C%22~guess%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setR%22%2C%22arg%22%3A55%7D%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A26%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22X%22%5D%2C%5B%22inputA10%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22*BToAmodR6%22%5D%2C%5B%22QFT%E2%80%A010%22%5D%2C%5B%22Chance10%22%5D%2C%5B%22QFT10%22%5D%2C%5B%22QFT10%22%5D%2C%5B%22Chance10%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~guess%22%2C%22name%22%3A%22guess%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~input%22%2C%22name%22%3A%22input%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22~out%22%2C%22name%22%3A%22out%3A%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C1%2C0%2C0%7D%2C%7B0%2C0%2C1%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pOzNK.png&quot; alt=&quot;try both&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how the probability distributions are almost identical after an inverse QFT or after a QFT (in the above diagram the second qft is just to undo the inverse QFT). Since the output distribution is nearly identical the algorithm works either way.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-06-09T19:59:59.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6391" PostTypeId="1" AcceptedAnswerId="6398" CreationDate="2019-06-09T22:27:52.110" Score="2" ViewCount="87" Body="&lt;p&gt;I am noticing some erroneous behavior coming from the visualizer in some circuits I was running. I am not sure how widespread the issue is, but see the attached image for some strange behavior with the cZ gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a place to see the matrix each gate is implementing like before?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone found similar issues?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This issue does &lt;em&gt;not&lt;/em&gt; persist when I actually click &quot;run&quot; and select simulator. It seems to only affect the visualizer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/S9WmF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S9WmF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="26" LastEditDate="2019-06-11T08:50:21.910" LastActivityDate="2019-06-11T08:50:21.910" Title="Visualizer error in IBM Q Experience Beta" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6392" PostTypeId="2" ParentId="6374" CreationDate="2019-06-10T03:28:57.050" Score="3" Body="&lt;p&gt;1) There are 4 Bell states, namely the ones you listed divided by &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;. There is no &quot;the bell state&quot;. The Bell states are only defined for 2 qubits, so there is no &quot;higher dimensional definition of a Bell state&quot;. One of the key features of the Bell states is that they're maximally entangled. If this is what you'd like in a higher dimensional analog of the Bell states then you'll want the GHZ states as Mark S suggests. An analysis coming to this conclusion can be found here: &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9804045&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9804045&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The code space for the toric code on a 3x3 lattice consists of 4 different, long, complex superpositions of kets which each have 18 elements in them. I doubt anyone is willing to write them out for you. However it wouldn't be too difficult for a computer algebra system to crunch them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Beyond being discussed in entry level texts for clarity, the actual codespace of an error correcting code is rarely ever used. The codespace is uniquely determined as the mutual +1 eigenspace of the code's stabilizers. In fact the stabilizers encode everything about the code so it's common to think of them as the code itself. Compared to the codespace, the stabilizers are much cleaner, more concise and obey nice algebraic properties which makes them preferable to use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the toric code the stabilizers are strings of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ I$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; derived from the topology of a torus. It would be a tedious but straight forward exercise to explicitly enumerate all the stabilizers for the 3x3 lattice then find the elements spanning their mutual +1 eigenspace (hint: there's 4 of them encoding &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;)&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="7701" LastEditDate="2019-06-10T13:50:44.527" LastActivityDate="2019-06-10T13:50:44.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6393" PostTypeId="2" ParentId="6297" CreationDate="2019-06-10T04:36:58.930" Score="1" Body="&lt;p&gt;You'd need to apply &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; controlled on the second register. I assume you want a different operation for each of the 4 sets? In terms of a tensor product you'd need operators like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_1\otimes |00\rangle\langle00|\otimes I$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_2\otimes |01\rangle\langle01|\otimes I$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_3\otimes |10\rangle\langle10|\otimes I$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_4\otimes |11\rangle\langle11|\otimes I$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7701" LastActivityDate="2019-06-10T04:36:58.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6394" PostTypeId="2" ParentId="6242" CreationDate="2019-06-10T05:35:40.253" Score="2" Body="&lt;p&gt;For completely arbitrary coefficients you are out of luck. A simple counting argument says that because:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The coefficients are continuous parameters &#xA;2) gates implement discrete operations &#xA;&lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt;&#xA;There is no finite circuit to prepare the vast majority of states. However, if you're okay with an arbitrarily good approximation to your state,  then it can be done with relatively short gate sequences by the Solovay–Kitaev theorem. An algorithm for doing this is given here: &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/0505030&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;most&lt;/em&gt; efficient is hard to say since, as you point out, there are many different metrics to choose from and this is an intensive area of active research. So I'd say as long as you're not writing quantum compilers and if you want something that will work for completely arbitrary state preparation, then the Solovay–Kitaev algorithm is a solid choice. If you are writing a quantum compiler you'll need to do a months long, intensive literature review.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a recent paper I read that is cutting edge: &lt;a href=&quot;https://arxiv.org/pdf/1807.03206&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1807.03206&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IBM's documentation (&lt;a href=&quot;https://qiskit.org/documentation/terra/summary_of_quantum_operations.html#arbitrary-initialization&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Arbitrary Initialization&lt;/a&gt;) says it uses the techniques from: &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0406176.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/0406176.pdf&lt;/a&gt; to accomplish this &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll also give a nod to dissipative state preparation since that's something I personally work on and it seems to have some promise - but it's still too early for it to be really practical.&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="7701" LastEditDate="2019-06-10T16:14:57.817" LastActivityDate="2019-06-10T16:14:57.817" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6395" PostTypeId="1" AcceptedAnswerId="6405" CreationDate="2019-06-10T14:56:39.183" Score="3" ViewCount="106" Body="&lt;p&gt;Need help! I was working on a project when I required to use a projection operator. For an example case, I have the Bell state, &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac1{\sqrt2}\left(\color{blue}{|0}0\rangle+|11\rangle\right)$$&lt;/span&gt;&#xA;which now I want to take to the state,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi'\rangle = |\color{blue}{0}0\rangle$$&lt;/span&gt;&#xA;by weeding out the states with the leftmost qubit as &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example would be, &lt;span class=&quot;math-container&quot;&gt;$$\frac1{2}\left(|\color{blue}{0}0\rangle+|\color{blue}{0}1\rangle+|10\rangle+|11\rangle\right)\rightarrow\frac1{\sqrt2}\left(|00\rangle+|01\rangle\right).$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&#xA;Just putting another example to make my question clear. I want to weed out states when the third (leftmost) qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in the following example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a three qubit state, &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\displaystyle\frac1{N}\left(|\color{blue}{0}\rangle\otimes\left[|00\rangle+|01\rangle+|10\rangle\right] + |1\rangle\otimes|11\rangle\right)$$&lt;/span&gt;&#xA;it should then get transformed to &lt;span class=&quot;math-container&quot;&gt;$$|\psi'\rangle = \frac1{N'}|\color{blue}{0}\rangle\otimes\left[|00\rangle+|01\rangle+|10\rangle\right].$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible? If yes, how can I implement it in the IBM Quantum Experience?&lt;/p&gt;&#xA;" OwnerUserId="7693" LastEditorUserId="7693" LastEditDate="2019-06-10T18:21:02.830" LastActivityDate="2019-06-11T08:51:19.233" Title="Weeding out qubit states with leftmost qubit as 1" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="6396" PostTypeId="2" ParentId="6386" CreationDate="2019-06-10T18:29:43.470" Score="7" Body="&lt;p&gt;As requested in the comments, here is a worked example. The main body deals with minimizing &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; for a specific problem. At the bottom follows a brief discussion of constraints then a brief discussion about the general case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's solve the Weighted Maximum Cut problem since this &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is a relatively straight-forward example&lt;/li&gt;&#xA;&lt;li&gt;Is hard classically&lt;/li&gt;&#xA;&lt;li&gt;Is a relatively common example in the literature (e.g. &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.90.067903&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.90.067903&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Has a clear connection to a physical Hamiltonian (Ising spin-glasses)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To understand the problem, we start with an undirected graph of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; vertices &lt;span class=&quot;math-container&quot;&gt;$\{V\}$&lt;/span&gt;, where each vertex &lt;span class=&quot;math-container&quot;&gt;$v_i\in V$&lt;/span&gt; has weight &lt;span class=&quot;math-container&quot;&gt;$w_i\geq0$&lt;/span&gt; and each edge connecting &lt;span class=&quot;math-container&quot;&gt;$v_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_j$&lt;/span&gt; has a weight &lt;span class=&quot;math-container&quot;&gt;$w_{ij}\geq0$&lt;/span&gt;. We then cut the graph into two pieces. The cut need not be straight but must not self-intersect and cannot cut any edge twice. Then we calculate a &quot;&lt;em&gt;payout&lt;/em&gt;&quot; &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; for our cut. The payout is the sum of the weights of the edges we cut through, plus the sum of the weights of the vertices on one side of the cut.&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://veterans.topcoder.com/challenges/30084839&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;a href=&quot;https://i.stack.imgur.com/HjgAa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HjgAa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this image, the payout would be, &lt;span class=&quot;math-container&quot;&gt;$1+4+3+3+2 = 13$&lt;/span&gt; for the edges plus &lt;span class=&quot;math-container&quot;&gt;$5+6+1 = 12$&lt;/span&gt; for the vertices &lt;span class=&quot;math-container&quot;&gt;$\to P=25$&lt;/span&gt; (assuming the number inside each vertex is its weight). &lt;strong&gt;The optimization problem is to maximize &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; for a given graph&lt;/strong&gt;.&lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To write this mathematically, we can think in terms of bit strings. We define a cut by a string &lt;span class=&quot;math-container&quot;&gt;$s\in\{0,1\}^n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$s_i=0\to v_i$&lt;/span&gt; &lt;em&gt;is not&lt;/em&gt; counted in the sum and &lt;span class=&quot;math-container&quot;&gt;$s_i=1\to v_i$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; counted in the sum. To make the math a little cleaner, if the graph isn't fully connected, make the graph to be fully connected and set &lt;span class=&quot;math-container&quot;&gt;$w_{ij}=0$&lt;/span&gt; for any unconnected pairs &lt;span class=&quot;math-container&quot;&gt;$v_i,v_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, looking at the image above again, let's interpret the numbers inside the vertices to be the vertex index instead of the weight like we assumed above. Then the drawn cut corresponds to &lt;span class=&quot;math-container&quot;&gt;$s=100011$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$s_1=s_5=s_6=1\to v_1, v_5, v_6$&lt;/span&gt; are on the &quot;good&quot; side of the cut and get counted, while &lt;span class=&quot;math-container&quot;&gt;$s_2=s_3=s_4=0$&lt;/span&gt; are on the &quot;bad&quot; side of the cut and are not counted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This then allows us to write &lt;span class=&quot;math-container&quot;&gt;$$P(s) = \sum_i s_i w_i + \sum_{i,j} s_i(1-s_j)w_{ij}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first term just counts the weights of all the vertices on the &quot;good&quot; side of the cut. The second term counts the weight of an edge if the vertices it connects are on opposite sides of the cut. Note this doesn't double count since it only counts the edge when &lt;span class=&quot;math-container&quot;&gt;$s_i=1, s_j=0$&lt;/span&gt; and not when &lt;span class=&quot;math-container&quot;&gt;$s_i=0, s_j=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now our optimization problem is find the string &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; which maximizes &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt;. The idea here is to think of &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt; as a measure of energy of a system and &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; as the state of the system. This means we can relate &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt; to our Hamiltonian. There's a slight subtly here that we're trying to maximize &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt; but we usually talk about finding the ground state of a Hamiltonian. This isn't an issue but I wanted to point it out - we can instead look at the highest energy excited state (anti-ground state if you will) or use &lt;span class=&quot;math-container&quot;&gt;$-P(s)$&lt;/span&gt; as our energy function then work with the ground state like normal. Let's work with the highest excited state and maximize &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'd like create a Hamiltonian such that its highest energy state is &lt;span class=&quot;math-container&quot;&gt;$|s_0\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$P(s_0)$&lt;/span&gt; is maximal. Essentially we want to turn &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt;, an energy function, into &lt;span class=&quot;math-container&quot;&gt;$\hat{H}$&lt;/span&gt;, an energy operator. We do this by noting that for &lt;span class=&quot;math-container&quot;&gt;$|s\rangle\in\{|0\rangle,|1\rangle\}$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$$\frac{I-Z}{2}|s\rangle=s|s\rangle\to\text{ define } \hat{s}_i=\frac{I-Z_i}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$Z_i$&lt;/span&gt; is the Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; acting on qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. Now we get our Hamiltonian by replacing &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\hat{s}$&lt;/span&gt; (and 1 with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;) in &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=\sum_i \hat{s}_i w_i + \sum_{i,j} \hat{s}_i(I-\hat{s}_j)w_{i,j}=\sum_i\frac{I-Z_i}{2} w_i + \sum_{i,j} \frac{I-Z_i}{2}\left(I-\frac{I-Z_j}{2}\right)w_{i,j}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be cleaned up by expanding and seeing &lt;span class=&quot;math-container&quot;&gt;$\sum_{i,j}(Z_i-Z_j)=0\to$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=\sum_i \frac{w_i}{2}\left(I-Z_i\right) + \sum_{i,j} \frac{w_{ij}}{4}\left(I-Z_iZ_j\right)=\sum_i \frac{w_i}{2}\left(I-Z_i\right) + \sum_{i&amp;lt;j} \frac{w_{ij}}{2}\left(I-Z_iZ_j\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can clean this up even further by multiplying by 2 and removing a constant energy shift (delete the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; terms). New Hamiltonian with same eigenstates with eigenvalues scaled and shifted (clearly the maximum energy is unaffected by these transformations)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=-\sum_i w_iZ_i - \sum_{i&amp;lt;j} w_{ij}Z_iZ_j$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're a condensed matter physicist you'll likely recognize this Hamiltonian as an Ising spin glass. Not really relevant to the problem, but I think it's cool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now we have a Hamiltonian whose (anti-)ground state encodes the bit string &lt;span class=&quot;math-container&quot;&gt;$s_0$&lt;/span&gt; which maximizes &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt; and solves the problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last thing we need is an initial Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;, which we slowly (adiabatically) transform into our final Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; so we can define the full Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$$H_T(t)=(1-f(t))H_0 + f(t)H: f(0)=0, f(t_f)=1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a starting point &lt;span class=&quot;math-container&quot;&gt;$f(t)\propto t$&lt;/span&gt; is often used for simplicity. The minimum &lt;span class=&quot;math-container&quot;&gt;$t_f$&lt;/span&gt; determined by the desired accuracy and the spectral gap&lt;span class=&quot;math-container&quot;&gt;$^3$&lt;/span&gt;. The spectral gap is the minimum energy difference, over all &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, between the (anti-)ground state and the next energy state. The analysis of the gap is highly non-trivial (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0509162&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0509162&lt;/a&gt;) and determines the complexity/efficiency of the algorithm. An algorithm with 0 gap is not guaranteed to work at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we want an &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; such that&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We can easily find and prepare its (anti-)ground state&lt;/li&gt;&#xA;&lt;li&gt;The spectral gap of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is not exponentially small in the size of the problem&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For this problem, a good initial Hamiltonian is &lt;span class=&quot;math-container&quot;&gt;$H_0 = \sum_i X_i$&lt;/span&gt; because it's highest energy state is easy to find, it's &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes n}$&lt;/span&gt;. It's easy to prepare, just apply &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;. I don't have time to get into the analysis of the spectral gap but this Hamiltonian is unlikely to be ideal in that regard (see &lt;a href=&quot;https://arxiv.org/abs/1701.05584&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1701.05584&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this choice of &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; and taking &lt;span class=&quot;math-container&quot;&gt;$f(t)=t/t_f$&lt;/span&gt; we are done. Our Hamiltonian is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H(t) = \left(1-f(t)\right)\sum_i X_i-f(t)\left[\sum_i w_iZ_i + \sum_{i&amp;lt;j} w_{ij}Z_iZ_j\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle = H^{\otimes n}|0\rangle^{\otimes n}$&lt;/span&gt;, evolving according to the above Hamiltonian for time &lt;span class=&quot;math-container&quot;&gt;$t_f$&lt;/span&gt; (choosing a suitable &lt;span class=&quot;math-container&quot;&gt;$t_f$&lt;/span&gt; is, again, generally highly non-trivial) then measuring in the computational basis should return (with high probability) the string &lt;span class=&quot;math-container&quot;&gt;$s=s_0$&lt;/span&gt; which maximizes &lt;span class=&quot;math-container&quot;&gt;$P(s)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; This is ambiguous since by symmetry either side will do. We can make this rigorous by, for example, making the cut directed then taking the vertices to the left of the cut when walking along the direction of the cut.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt; I had said in the comment we minimize a cost function, if you like this better just take cost &lt;span class=&quot;math-container&quot;&gt;$=-$&lt;/span&gt; payout and minimize cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^3$&lt;/span&gt; I'm sweeping some details about what &quot;slow&quot; means under the rug but can be related to the energy scale of the problem (i.e. multiplying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; by a constant will change the speed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Constraints&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we want to modify the problem above to require that exactly &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; vertices are on the &quot;good&quot; side of our cut. Mathematically this is &lt;span class=&quot;math-container&quot;&gt;$\sum_i s_i-5=0$&lt;/span&gt;. To enforce this, we add a penalty term into our Hamiltonian for solutions that break this constraint. So we add a term like &lt;span class=&quot;math-container&quot;&gt;$H_c = -\alpha\left(\sum_i \hat{s}_i -5I\right)^2$&lt;/span&gt; choosing &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; big enough to ensure a state violating this constraint can't be the highest energy state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say instead we want to require that there are &lt;em&gt;no more than&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; vertices on the &quot;good&quot; side of our cut. This, it seems, is rather hard to do. In &lt;a href=&quot;https://arxiv.org/abs/1702.06248&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1702.06248&lt;/a&gt; they state that approximating an inequality constraint to order &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; requires &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\left(N^{2k}\right)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-spin couplings which would require even more overhead to break them down into 2-qubit couplings which is often necessary on a given architecture. Essentially the strategy is to approximate a step function using a &lt;span class=&quot;math-container&quot;&gt;$k^\text{th}$&lt;/span&gt; order polynomial. This seems like a terrible way to go about it - but I can't think of better way. This is coming from Troyer in 2017 so it's relatively unlikely, though certainly possible, that a better way is currently known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The general case&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question asks about a general method for encoding an optimization problem into a Hamiltonian. Specifically we want to minimize &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; subject to a set of constraints. In the section above I discussed adding the constraints to the Hamiltonian. So for a completely general &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, is there a way to encode it into a Hamiltonian? The general method for this in the literature is to assume we have access to an efficient quantum &lt;em&gt;oracle&lt;/em&gt; that implements &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. We can think of this as having a black box operation (i.e. quantum oracle) &lt;span class=&quot;math-container&quot;&gt;$\hat{f}(x)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\hat{f}(x)|x\rangle=f(x) |x\rangle$&lt;/span&gt;. Then we may construct our Hamiltonian as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \sum_x \hat{f}(x)|x\rangle\langle x|&#xA;$$&lt;/span&gt;&#xA;Of course this just pushes the difficult part into finding/constructing &lt;span class=&quot;math-container&quot;&gt;$\hat{f}(x)$&lt;/span&gt;. In fact, simple counting arguments show that almost all (in the mathematical sense) quantum oracles are exponentially inefficient to implement (see &lt;a href=&quot;http://www.ar-tiste.com/imp-oracles/imps2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.ar-tiste.com/imp-oracles/imps2.pdf&lt;/a&gt;). So while this is a general encoding of an optimization problem into a Hamiltonian - it's not really practical. It would seem to be the case that if you want to encode your optimization problem into a Hamiltonian in a &lt;em&gt;useful&lt;/em&gt; way - you'll need to leverage some structure of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. My understanding is that the specifics of exactly how to do this and how to do this in the &lt;em&gt;best&lt;/em&gt; manner is not fully understood and is the subject of active research.&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="7701" LastEditDate="2019-06-11T15:45:17.713" LastActivityDate="2019-06-11T15:45:17.713" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6397" PostTypeId="1" AcceptedAnswerId="6403" CreationDate="2019-06-10T19:30:12.500" Score="4" ViewCount="160" Body="&lt;p&gt;I am faced with the problem of teleporting certain gates using modified Bell states. For example, I have solved the problem with the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate, which is defined as following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice and Bob share a qubit in the state &lt;span class=&quot;math-container&quot;&gt;$S|\Phi^+\rangle = (|00⟩ + i|11⟩) / \sqrt2$&lt;/span&gt;. Alice has a qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; which she wants to send to Bob as &lt;span class=&quot;math-container&quot;&gt;$S|\psi\rangle = \alpha|0\rangle + \beta i|1\rangle$&lt;/span&gt;. The part that needs to be implemented is Bob's fix-up part, so he ends up with &lt;span class=&quot;math-container&quot;&gt;$S|\psi\rangle$&lt;/span&gt;. Bob is only allowed to use Pauli and H gates. After the teleportation, Bob has one of the four states &lt;span class=&quot;math-container&quot;&gt;$S|\psi\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$SX|\psi\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$SZ|\psi\rangle$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$SZX|\psi\rangle$&lt;/span&gt;. We can find the decode circuit by rewriting those as &lt;span class=&quot;math-container&quot;&gt;$S|\psi\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$(SXS^\dagger)S|\psi\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$(SZS^\dagger)S|\psi\rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$(SZXS^\dagger)S|\psi\rangle$&lt;/span&gt;. From here, we can decode to &lt;span class=&quot;math-container&quot;&gt;$S|\psi\rangle$&lt;/span&gt; by finding &lt;span class=&quot;math-container&quot;&gt;$SXS^\dagger = Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SZS^\dagger = Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem comes with trying this with the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate. Alice and Bob share the state &lt;span class=&quot;math-container&quot;&gt;$T|\Phi^+\rangle = (|00⟩ + e^{i\pi / 4}|11⟩) / \sqrt2$&lt;/span&gt;. Alice wants to send her qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; to Bob as &lt;span class=&quot;math-container&quot;&gt;$T|\psi\rangle = \alpha|0\rangle + \beta e^{i\pi / 4}|1\rangle$&lt;/span&gt;. Bob is only allowed to use Pauli, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gates. This gives the problem of finding a Pauli, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate decomposition of &lt;span class=&quot;math-container&quot;&gt;$TXT^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$TZT^\dagger$&lt;/span&gt;. However, this seems impossible to me, given you can't create a &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate from Pauli, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gates. Clearly &lt;span class=&quot;math-container&quot;&gt;$TZT^\dagger = Z$&lt;/span&gt;, but I can't seem to figure &lt;span class=&quot;math-container&quot;&gt;$TXT^\dagger$&lt;/span&gt; out.&lt;/p&gt;&#xA;" OwnerUserId="7712" LastEditorUserId="7712" LastEditDate="2019-06-10T20:46:10.830" LastActivityDate="2019-06-11T06:45:32.230" Title="Quantum gate teleportation T gate" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6398" PostTypeId="2" ParentId="6391" CreationDate="2019-06-10T20:38:49.390" Score="3" Body="&lt;p&gt;Thank you for pointing out this! The matrix of the &lt;code&gt;cZ&lt;/code&gt; gate has been corrected in the in-browser simulator for the visualizations. Simply retry by refreshing your browser.&lt;/p&gt;&#xA;" OwnerUserId="7714" LastActivityDate="2019-06-10T20:38:49.390" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6399" PostTypeId="1" CreationDate="2019-06-10T21:00:34.877" Score="5" ViewCount="388" Body="&lt;p&gt;The Quantum Fourier Transform from Nielsen and Chuang chapter 5 is pictured here:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7QYUu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7QYUu.png&quot; alt=&quot;Quantum Fourier Transform&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the textbook the author refers to &quot;swap gates at the end of the circuit which reverse the order of the qubits&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it possible to transform the circuit shown in some way to avoid the need for any SWAP gates while still using little-endian conventions. Naively, I might think I could &quot;flip the circuit upside down&quot; so that the first operation is H(n), then R2 on qubit n controlled by qubit (n-1), and so on...&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia page on QFTs&lt;/a&gt; makes no reference to reordering or SWAP gates - does this imply a different bitstring convention between the sources, or an error in one of the sources?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="2224" LastEditDate="2019-06-11T01:43:56.023" LastActivityDate="2020-03-13T00:11:32.440" Title="Quantum Fourier Transform without SWAPs" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6400" PostTypeId="1" AcceptedAnswerId="6404" CreationDate="2019-06-11T01:32:13.510" Score="4" ViewCount="129" Body="&lt;p&gt;IBM's simulator allows the use of a reset gate (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;  gate) however when I try to run a circuit using this gate on the hardware it fails to execute. Is there a plan to physically realize this gate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am specifically interested in running dissipative algorithms which need to reset the ancilla. I can get around this by invoking extra ancilla to reset my original ancilla - but this requires a lot of qubits for anything but a modest circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It looks like such things are possible, at least in principle: &lt;a href=&quot;https://arxiv.org/abs/1801.07689&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1801.07689&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="26" LastEditDate="2019-06-11T08:11:35.630" LastActivityDate="2019-06-11T08:11:35.630" Title="Back End for Reset Gate" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6401" PostTypeId="1" CreationDate="2019-06-11T04:15:09.280" Score="3" ViewCount="195" Body="&lt;p&gt;Let's consider the following Bell state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\lvert \Phi^+\rangle = \frac{1}{\sqrt{2}} (\lvert00\rangle + \lvert11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would happen if I measure the first qubit in the standard basis and keep the other one intact? Is the following computation correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle 0I\lvert\Phi^+\rangle\langle\Phi^+\lvert0I\rangle = \frac{1}{2}\lvert0\rangle\langle0\lvert$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I&lt;/strong&gt; is the two dimensional identity matrix. And&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle 1I\lvert\Phi^+\rangle\langle\Phi^+\lvert1I\rangle = \frac{1}{2}\lvert1\rangle\langle1\lvert$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shouldn't have I gotten the probability of measurement instead of states?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2019-11-13T19:03:17.973" LastActivityDate="2019-11-13T19:03:17.973" Title="What happens if I measure only the first qubit of a Bell state?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6402" PostTypeId="2" ParentId="6401" CreationDate="2019-06-11T06:38:39.963" Score="2" Body="&lt;p&gt;Recall the measurement postulate (as applied to projective measurements): A measurement is described by a set of projectors &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$\sum_iP_i=1$&lt;/span&gt;. If a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is being measured, the outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is obtained with probability &lt;span class=&quot;math-container&quot;&gt;$p_i=\langle\psi|P_i|\psi\rangle$&lt;/span&gt;, and if outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is obtained, the state after measurement is &lt;span class=&quot;math-container&quot;&gt;$P_i|\psi\rangle/\sqrt{p_i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is how to describe the projections. In your case, you want to project the first qubit on the standard basis, and do nothing on the second qubit. So, that means you need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0=|0\rangle\langle 0|\otimes1,\qquad P_1=|1\rangle\langle 1|\otimes1,&#xA;$$&lt;/span&gt;&#xA;because we remember that &quot;do nothing to a qubit&quot; is described by the identity operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what's the probability of getting the answer 0?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Phi^+|P_0|\Phi^+\rangle=\frac{1}{2},&#xA;$$&lt;/span&gt;&#xA;and the two-qubit state after the measurement is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{2}P_0|\Phi^+\rangle=|00\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I think all that is actually missing from your calculation is a trace over all the systems, but there's some of the intermediate steps that are not quite right, at least in terms of notation, even though mathematically you appear to have done the right thing.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-11T06:38:39.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6403" PostTypeId="2" ParentId="6397" CreationDate="2019-06-11T06:45:32.230" Score="4" Body="&lt;p&gt;Think about the following sequence:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;XT^\dagger X=\left(\begin{array}{cc} e^{-i\pi/4} &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right)=e^{-i\pi/4}T.&#xA;$$&lt;/span&gt;&#xA;So, that lets us write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;TXT^\dagger=e^{-i\pi/4}TTX=e^{-i\pi/4}SX&#xA;$$&lt;/span&gt;&#xA;Up to some phase, you have the decomposition that you want. In this context, that phase should be an irrelevant global phase that you can ignore.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-11T06:45:32.230" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6404" PostTypeId="2" ParentId="6400" CreationDate="2019-06-11T07:56:49.960" Score="3" Body="&lt;p&gt;I'm afraid that the current interface between the hardware and software does not allow for the reset gate to be performed. Currently the hardware is set up to perform a measurement on qubits simultaneously, and then do nothing else. This means that any operations that come after measurements (either explicitly or as part of operations like &lt;code&gt;reset&lt;/code&gt; or &lt;code&gt;if&lt;/code&gt;) cannot currently be run on hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you point out, such operations are indeed possible in principle, and have been done in certain cases in the lab. But making them possible for general use is a more difficult task. It will be done, and that's why the IBM Q Experience and Qiskit allow you to create quantum programs with such operations, but that functionality is not available yet.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-11T07:56:49.960" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6405" PostTypeId="2" ParentId="6395" CreationDate="2019-06-11T08:38:09.150" Score="5" Body="&lt;p&gt;I'm afraid it is not possible to remove states from a superposition that you do not want. At least, not easily. If it were, a lot of computationally hard problems would become much easier, since you could just create a huge superposition and then weed out all the non-solutions to your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are ways to do it, however. But they always come with a price. The easiest to implement is post-selection, as mentioned in a comment above. This means simply measuring whether a condition is satisfied (in your case, whether a certain qubit outputs &lt;code&gt;0&lt;/code&gt;). The outcome to this measurement will be random, but it will sometimes give the answer you want. You just need to repeat until that happens.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to run this in the IBM Q Experience is to make a circuit in which you first measure whether the condition is satisfied, and then do everything you would do on the remaining state if that condition comes out as true. When you run the circuit, you'll get many bit strings as output: some in which your condition is satisfied and some in which it is not. You then simply discard all the latter, and the former are then the results you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A method that is unitary would be to run Grover's algorithm to search for states that satisfy your condition. The way you do this may depend on the specific application you have in mind.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-11T08:38:09.150" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6407" PostTypeId="2" ParentId="6381" CreationDate="2019-06-11T12:18:33.207" Score="2" Body="&lt;p&gt;Here's a fairly thorough overview: &lt;a href=&quot;https://arxiv.org/abs/1308.6253&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1308.6253&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completeness I'll include the paper from the comment: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0108146&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0108146&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7701" LastActivityDate="2019-06-11T12:18:33.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6408" PostTypeId="1" CreationDate="2019-06-11T17:42:35.223" Score="3" ViewCount="148" Body="&lt;p&gt;When I run a stabilizer simulator such as &lt;a href=&quot;https://www.scottaaronson.com/chp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aaronson's CHP simulator&lt;/a&gt; (defined in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0406196&lt;/a&gt;), one of the possible outputs is a stabilizer table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Strilanc/python-chp-stabilizer-simulator/blob/9e9ba9a2452a5535307048c4ebe6ff7d9800ee12/stabilizer_sim/stabilizer_sim_core_test.py#L110&quot; rel=&quot;nofollow noreferrer&quot;&gt;For example&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sim = StabilizerSim(num_qubits=3)&#xA;sim.hadamard(2)&#xA;sim.cnot(2, 0)&#xA;sim.cnot(2, 1)&#xA;sim.phase(0)&#xA;sim.phase(1)&#xA;sim.hadamard(0)&#xA;sim.hadamard(1)&#xA;sim.hadamard(2)&#xA;print(sim)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Prints:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;-YII&#xA;-IYI&#xA;+IIX&#xA;----&#xA;+XIX&#xA;+IXX&#xA;+YYZ&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where each of the lines is the Pauli product at the start of the circuit that corresponds to a Z or X observable of a qubit at the end of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to convert this representation into an explicit state vector, like shown in the display at the end of &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22Z%5E%C2%BD%22%5D%2C%5B%22Z%5E%C2%BD%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Amps3%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Quirk circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t6rW5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t6rW5.png&quot; alt=&quot;state vector&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to get the state vector without having to simulate the circuit in a state vector simulator, because sometimes the number of output qubits is significantly smaller than the number of intermediate qubits and in such cases it would be much cheaper to only convert the final stabilizer state into a state vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible solution is to take the output stabilizer state, perform a known decomposition into a circuit, then execute the circuit in a state vector simulator. But I doubt that's a particularly efficient approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, I could perform a series of post-selected projective measurements in the vectir simulator. The initial state would be half of an entangled state, and each measurement (and its outcome) is determined by stabilizers from the table. &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B%22Y%22%2C%22Y%22%2C%22Z%22%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C%22X%22%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C1%2C%22X%22%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22Amps3%22%5D%5D%2C%22init%22%3A%5B%22%2B%22%2C%22%2B%22%2C%22%2B%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Like this&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B%22Y%22%2C%22Y%22%2C%22Z%22%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C%22X%22%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C1%2C%22X%22%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22Amps3%22%5D%5D%2C%22init%22%3A%5B%22%2B%22%2C%22%2B%22%2C%22%2B%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OpcvE.png&quot; alt=&quot;Projective&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this requires doubling the qubit count which is a quadratic space and time overhead in the calculation.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-06-11T21:53:52.517" LastActivityDate="2019-06-11T22:32:53.670" Title="Deriving a state vector from a stabilizer state's generators" Tags="&lt;superposition&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6409" PostTypeId="1" AcceptedAnswerId="6455" CreationDate="2019-06-11T18:46:35.390" Score="4" ViewCount="102" Body="&lt;p&gt;I'm trying to obtain a more intuitive understanding of the notion of quantum coherence and how to mathematically represent it. I know that coherence has to do with the interaction of phases between the basis states, so, if I suppose that I have a qubit in some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a|0\rangle + b|1\rangle,$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are unknown values but &lt;span class=&quot;math-container&quot;&gt;$p_{1} = |a|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{2} = |b|^2$&lt;/span&gt; are known values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would I be correct in saying that, in this scenario, I have a state that exhibits decoherence? Would the density matrix for this state be diagonal?&lt;/p&gt;&#xA;" OwnerUserId="7729" LastActivityDate="2019-06-14T08:17:09.857" Title="Quantum state where phase information is unknown" Tags="&lt;density-matrix&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6410" PostTypeId="1" CreationDate="2019-06-11T20:47:29.127" Score="7" ViewCount="90" Body="&lt;p&gt;Without feedback/loop how can we build a sequential circuit? The basic feature of sequential circuit is that is depends not only on the current inputs but also on the previous inputs/outputs. I've gone through few papers on reversible gates and I'm so confused. Is it possible to create a quantum circuit (which is obviously reversible) which is a sequential circuit? &lt;/p&gt;&#xA;" OwnerUserId="7731" LastEditorUserId="26" LastEditDate="2019-06-12T02:59:37.240" LastActivityDate="2019-06-12T02:59:37.240" Title="Sequential circuit using quantum gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6411" PostTypeId="1" CreationDate="2019-06-11T21:19:05.397" Score="5" ViewCount="52" Body="&lt;p&gt;I have read many papers related to it but in every paper, they just show the circuit of order finding algorithm for N=15, but did not explain what is the procedure to make it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be great  if anyone who had done this can suggests a good reference or explain it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7732" LastEditorUserId="26" LastEditDate="2019-06-12T03:02:58.760" LastActivityDate="2019-06-12T03:02:58.760" Title="Can anybody explain or suggest a good reference on how to make a modular exponentiation circuit for N=15 with any coprime base?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;resource-request&gt;&lt;shors-algorithm&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6412" PostTypeId="1" AcceptedAnswerId="6419" CreationDate="2019-06-11T21:50:52.787" Score="2" ViewCount="183" Body="&lt;p&gt;I am writing a program where I need to find the eigenstates of an operator that is a Kronecker product of conditional quantum gates. I am wondering how I would compute this product in matrix form as the conditional gates act on different qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: Say I want to find the Kronecker product of some Pauli-X gate X_k that acts on qubit k and conditional phase gates CZ_i,j that have a control qubit i and target j:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;X_1 ⊗ CZ_2,3 ⊗ CZ_3,4 ⊗ CZ_2,4&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How would I compute this product so the result is a matrix? (Or in some form where I can find the eigenstates) For context, I am using Python and NumPy.&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="26" LastEditDate="2019-06-12T02:56:19.753" LastActivityDate="2019-06-12T22:14:12.070" Title="How do I write a tensor product of conditional gates in matrix form?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6413" PostTypeId="1" AcceptedAnswerId="6456" CreationDate="2019-06-11T22:03:29.507" Score="7" ViewCount="251" Body="&lt;p&gt;I am reading &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; entitled &quot;Quantum algorithm for linear systems of equations&quot; and am trying to understand a portion of the algorithm described on page 2 and in more detail in the appendix starting at the bottom of page 10 (section 3. Phase Estimation calculations). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have a hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; of dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and a vector &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and denote by &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt; the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, which are also eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lambda_j$&lt;/span&gt; the corresponding eigenvalues. Ultimately this algorithm aims to find &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$Ax = b$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming we have access to the state &lt;span class=&quot;math-container&quot;&gt;$\left|\Psi_{0} \right\rangle = \sqrt{\frac {2} {T} } \sum_{\tau = 0} ^{T - 1} \sin \left(\frac {\pi(\tau + 1/2)} {T}\right) |\tau \rangle$&lt;/span&gt;, the algorithm instructs to apply &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau  |\otimes e^{iA \tau to/T}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{0} \rangle |b \rangle$&lt;/span&gt;, the former being referred to as a conditional Hamiltonian evolution. The register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; initially contains &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0 \rangle $&lt;/span&gt;, while the register &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; contains &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author/s then writes &quot;assume the target state is &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt;, so this becomes simply the condition phase &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{\lambda_j t_o} \rangle = \sqrt{\frac {2} {T} } \sum_{\tau = 0} ^{T - 1} e^{\frac {i \lambda_j \tau t_{0}} {T}} \sin \left(\frac {\pi(\tau + 1/2)} {T}\right) |\tau \rangle |u_j\rangle$&lt;/span&gt;&quot;, where now we have a superposition of &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0 \rangle$&lt;/span&gt; and the result of applying &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_{0}/T}$&lt;/span&gt; to the eigenvector &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt;. My questions are: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Are we not applying the conditional Hamiltonian evolution to &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0 \rangle |b \rangle$&lt;/span&gt;? I know that &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; can be decomposed mathematically as &lt;span class=&quot;math-container&quot;&gt;$b= c_1u_1 + \cdots + c_nu_n$&lt;/span&gt; since these eigenvectors form an orthonormal basis. Why only consider the effect on &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is going on with the  &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt; portion of the sum in the conditional Hamiltonian evolution? In this answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2393/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-2-what-is-p&quot;&gt;here&lt;/a&gt;, it&#xA;is described &quot;[...] a control part. It means that the operation will be controlled by the state of the first quantum register (the register C as the exponent tells us)&quot;. I understand the &quot;gist&quot; of this statement but any reference to understand it more fully would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Is &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt;, not simply the identity matrix of dimension &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;? In which case the result after tensoring is a block matrix with &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_{0}/T}$&lt;/span&gt; on the main diagonal, and &lt;span class=&quot;math-container&quot;&gt;$0_n$&lt;/span&gt; elsewhere. Do I have this right?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;After this step, a Fourier transform is applied to the register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, but at this point what is contained in register &lt;span class=&quot;math-container&quot;&gt;$ C$&lt;/span&gt;? The state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{\lambda_j t_o} \rangle $&lt;/span&gt; seems to describe the superposition of registers &lt;span class=&quot;math-container&quot;&gt;$C,I$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I would be happy to edit/add any information that can help decipher this. Thanks&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="26" LastEditDate="2019-06-17T09:01:07.133" LastActivityDate="2019-06-17T09:01:07.133" Title="Clarification of the &quot;Calculations&quot; section of the (HHL09) paper" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6414" PostTypeId="2" ParentId="6408" CreationDate="2019-06-11T22:32:53.670" Score="2" Body="&lt;p&gt;The post-selection idea can be made to work without involving an entangled state. All that matters is that the initial state, before post-selection, has &lt;em&gt;some&lt;/em&gt; overlap with the correct final state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm unsure how to find or prove that a specific easy-to-prepare state has overlap with every possible stabilizer state. It seems like just ensuring each qubit is individually not in a stabilizer state is sufficient. For example, by using &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%5E%C2%BC%22%2C%22X%5E%C2%BC%22%2C%22X%5E%C2%BC%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22Y%22%2C%22Y%22%2C%22Z%22%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C%22X%22%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C1%2C%22X%22%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22Amps3%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;a pair of non-stabilizer X and Z rotations&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%5E%C2%BC%22%2C%22X%5E%C2%BC%22%2C%22X%5E%C2%BC%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22Y%22%2C%22Y%22%2C%22Z%22%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C%22X%22%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C1%2C%22X%22%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C1%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22Amps3%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x7xui.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if this specific initial state strategy does not work, in practice a random initial state would work just fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, here is what you do.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Get the stabilizer table from the stabilizer simulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the table comes in two chunks, and you only want the chunk corresponding to the Z observables.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In a state vector simulator, create an initial state that overlaps every stabilizer state.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the state vector simulator, measure each of the Z-observable stabilizers from the stabilizer table and post-select on the measurement results being False.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Output the state vector simulator's state vector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The running time of this procedure is &lt;span class=&quot;math-container&quot;&gt;$O(n 2^n)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits in the output state. It is unclear if it possible to save the factor of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Space usage is &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt;, which is optimal because that's the output size.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-06-11T22:32:53.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6415" PostTypeId="2" ParentId="6387" CreationDate="2019-06-12T00:08:51.863" Score="4" Body="&lt;p&gt;&lt;strong&gt;Short Answer:&lt;/strong&gt; It is potentially hard (as &lt;code&gt;bRost03&lt;/code&gt; indicates in the comments). To be precise, &lt;strong&gt;coNP&lt;/strong&gt;-hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Longer Answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In adiabatic quantum computation, the ground-space of the final Hamiltonian is typically determined by the optimum solution to some constraint satisfaction problem (CSP). If the CSP is perfectly solvable, the ground-space is spanned by (standard basis states which encode) the assignments which satisfy the constraints. If the CSP is not perfectly satisfiable, the ground-space is spanned by all assignments which are &lt;em&gt;closest&lt;/em&gt; to being satisfying. In this case, your question amounts just to a question of finding out when the set of satisfying assignments &amp;mdash; or the set of optimal assignments &amp;mdash; of a CSP are the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can reduce any such CSP to a boolean formula. So what we're looking at in the case of asking whether the satisfying set of two CSPs are the same is whether a boolean formula of the form &lt;span class=&quot;math-container&quot;&gt;$$ \varphi_1(x) \iff \varphi_2(x) $$&lt;/span&gt;&#xA;is a &lt;em&gt;tautology&lt;/em&gt;, which is to say, whether that biconditional is true for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, for some boolean formulae &lt;span class=&quot;math-container&quot;&gt;$\varphi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi_2$&lt;/span&gt; provided as input. This makes it a special case of &quot;&amp;nbsp;TAUTOLOGY&amp;nbsp;&quot;, the decision problem of whether a logical formula is a tautology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem TAUTOLOGY is in &lt;strong&gt;coNP&lt;/strong&gt; &#xA;&amp;mdash; in fact, it is &lt;strong&gt;coNP&lt;/strong&gt; complete, because it is in effect the complementary problem to the &lt;strong&gt;NP&lt;/strong&gt; compete problem SATISFIABILITY. This shows that the special case of determining whether the satisfying solution sets of two CSPs are equivalent is no harder than &lt;strong&gt;coNP&lt;/strong&gt;. But because we can test whether &lt;span class=&quot;math-container&quot;&gt;$\varphi_1$&lt;/span&gt; is itself a tautology by setting &lt;span class=&quot;math-container&quot;&gt;$\varphi_2$&lt;/span&gt; to the boolean formula 'TRUE', this special case is as hard as TAUTOLOGY is itself, so it is &lt;strong&gt;coNP&lt;/strong&gt; hard.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more general problem of equivalence of optimal solutions contains this problem as a subcase, so it is also &lt;strong&gt;coNP&lt;/strong&gt; hard. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-06-12T18:16:42.510" LastActivityDate="2019-06-12T18:16:42.510" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6416" PostTypeId="2" ParentId="6412" CreationDate="2019-06-12T00:37:29.137" Score="2" Body="&lt;p&gt;&lt;code&gt;pauli_X=[[0,1],[1,0]]&#xA;cz=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,-1]]&#xA;np.kron(np.kron(np.kron(pauli_X,cz),cz),cz)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This would compute &lt;span class=&quot;math-container&quot;&gt;$X_1 \otimes CZ_{2,3} \otimes CZ_{4,5} \otimes CZ_{6,7}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addressing the confusion about what tensor product means. &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; operating on &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt; qubits &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{\otimes d_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; operating on &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt; qubits &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{\otimes d_2}$&lt;/span&gt; means that &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt; will operate on &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{\otimes d_1} \otimes (\mathbb{C}^2)^{\otimes d_2}$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$d_1 + d_2$&lt;/span&gt; qubits. No overlapping indices between the &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: to address comment&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case there are 7 qubits so the total Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^2)^{\otimes 7} \simeq \mathbb{C}^{2^7}$&lt;/span&gt; with basis indexed by the &lt;span class=&quot;math-container&quot;&gt;$2^7$&lt;/span&gt; bit strings of length 7. From 0000000, 0000001, 0000010, etc all the way to 1111111.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2019-06-12T22:14:12.070" LastActivityDate="2019-06-12T22:14:12.070" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6417" PostTypeId="1" CreationDate="2019-06-12T02:26:48.010" Score="2" ViewCount="68" Body="&lt;p&gt;I read &quot;...an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit array can represent &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible array elements..&quot; on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1383/what-makes-quantum-computers-so-good-at-computing-prime-factors&quot;&gt;this&lt;/a&gt; post. A classical &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit array can represent &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible array elements as well, so I'm confused about the difference. Does it mean that the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possibilities represented by the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit array are represented at the same time?&lt;/p&gt;&#xA;" OwnerUserId="7736" LastEditorUserId="26" LastEditDate="2019-06-12T02:54:36.493" LastActivityDate="2019-07-12T12:00:37.763" Title="What does &quot;an $n$-qubit array can represent $2^n$ possible array elements&quot; mean?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6418" PostTypeId="1" CreationDate="2019-06-12T05:19:47.073" Score="4" ViewCount="552" Body="&lt;p&gt;Is there anyone who reproduced the Bloch sphere given in the paper &lt;strong&gt;QuTiP: An open-source Python framework for the dynamics of open quantum systems&lt;/strong&gt; by &lt;em&gt;J. R. Johansson, P. D. Nation, Franco Nori&lt;/em&gt;? I am trying to reproduce the Figure 10: &lt;em&gt;Bloch sphere representation of the Landau-Zener transition&lt;/em&gt;. The code they used is given in the appendix of the paper. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I am trying to plot this, I am getting an error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;AttributeError: 'numpy.ndarray' object has no attribute 'indices'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please help me to correct this one to get the exact Bloch sphere plot?&lt;/p&gt;&#xA;" OwnerUserId="7502" LastEditorUserId="26" LastEditDate="2019-06-12T05:23:56.560" LastActivityDate="2019-07-12T11:02:05.250" Title="Plotting Bloch sphere in QuTiP" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;bloch-sphere&gt;&lt;qutip&gt;&lt;open-quantum-systems&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6419" PostTypeId="2" ParentId="6412" CreationDate="2019-06-12T06:35:15.787" Score="2" Body="&lt;p&gt;You can always write your operation as one gate at a time, and take the product. So, in your case, you'd be calculating a product&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=U_1U_2U_3U_4&#xA;$$&lt;/span&gt;&#xA;where, for example, &lt;span class=&quot;math-container&quot;&gt;$U_1=X_1=X\otimes 1\otimes 1\otimes 1$&lt;/span&gt;, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_2=CZ_{2,3}=I\otimes I\otimes I\otimes I-I\otimes |1\rangle\langle 1|\otimes(Z-I)\otimes I,$$&lt;/span&gt; and so on. In particular, you can start to use the formulation I've given you for &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; to work out how to apply CZ on any pair of qubits. For instance,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_4=CP_{2,4}=I\otimes I\otimes I\otimes I-I\otimes |1\rangle\langle 1|\otimes I\otimes(Z-I).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-12T06:35:15.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6420" PostTypeId="1" CreationDate="2019-06-12T07:26:42.207" Score="3" ViewCount="30" Body="&lt;p&gt;I’m wondering that is there a way to separate phases of basis states from the magnitudes (namely putting phases on some new basis states with the same probability magnitude) if the exact values of phases and magnitudes are unknown? One way I can think of is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum phase estimation routine&lt;/a&gt;. But to me it seems this method can only estimate one single phase at a time, so if there are a lot of basis states it will take a lot of time to estimate all the phases. &lt;/p&gt;&#xA;" OwnerUserId="7739" LastEditorUserId="26" LastEditDate="2019-06-12T12:44:04.733" LastActivityDate="2019-06-12T12:44:04.733" Title="Obtaining phases of all basis states" Tags="&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6421" PostTypeId="2" ParentId="6420" CreationDate="2019-06-12T07:34:25.867" Score="1" Body="&lt;p&gt;So, are you asking whether it's possible (in the qubit case) to perform an arbitrary map of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;ae^{i\theta}|0\rangle+be^{i\phi}|1\rangle\rightarrow \frac{1}{\sqrt{2}}(e^{i\theta}|0\rangle+e^{i\phi}|1\rangle),&#xA;$$&lt;/span&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are unknown real numbers satisfying &lt;span class=&quot;math-container&quot;&gt;$a^2+b^2=1$&lt;/span&gt;? If this is the case, this is impossible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a simple case where instead of completely arbitrary values, you're either given &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle+b|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle-b|1\rangle$&lt;/span&gt;. Your map would require these to be converted into the states &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle\pm|1\rangle)/\sqrt{2}$&lt;/span&gt;, which are orthogonal. This means that your map would facilitate cloning of those two original states (because I can measure the outcome and know which state I had, so I can prepare many copies), which must be impossible because the two states are not orthogonal if &lt;span class=&quot;math-container&quot;&gt;$a^2\neq b^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-12T07:34:25.867" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6423" PostTypeId="1" CreationDate="2019-06-12T08:44:40.383" Score="4" ViewCount="86" Body="&lt;p&gt;I tried to run Grover's search for basis states with complex coefficients, including the marked basis (complex coefficients because the states are obtained from inverse QFT), but it could not amplify the marked basis effectively. I think it has to do with the inverse-about-the-mean part since now the mean is complex but I'm not sure how to analyse the behavior exactly. Can someone help to explain why is that so and is there any way to salvage the situation? And also if I want to amplify multiple marked states concurrently what is the most optimal diffusion operator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the circuit I used:&#xA;first I initialized the initial state (a four-qubit system) as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle=\frac{1}{\sqrt{8}}(1,1,1,1,1,1,1 ,1,0,0,0,0,0,0,0,0)^T&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Z0xmM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z0xmM.png&quot; alt=&quot;figure1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then I applied this inverse QFT circuit. The resultant state vector is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(0.707+0i, 0.088-0.444i, 0, 0.088-0.059i, 0, 0.088-0.132i, 0, 0.088-0.018i, 0, 0.088+0.018i,&#xA; 0, 0.088+0.132i, 0, 0.088+0.059i, 0, 0.088+0.444i)^T&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: values are rounded&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bjr9M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bjr9M.png&quot; alt=&quot;figure2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I negated the states of interest &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1111\rangle$&lt;/span&gt; by using this circuit (I believe you guys can tell which part of it is for which states if now please let me know:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GZos0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GZos0.png&quot; alt=&quot;figure3&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I applied the diffusion operator. Notice that I negated the phase of &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt; instead of the rest. This resulted in a &lt;span class=&quot;math-container&quot;&gt;$180^o$&lt;/span&gt; global phase difference. In the Grover search case where all coefficients are real the result for measurement is identical to marking all the rest states but I'm not sure for complex-valued coefficient will there be any difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mQZ1L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mQZ1L.png&quot; alt=&quot;figure4&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are the qskit codes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import math&#xA;from qiskit import *&#xA;%matplotlib inline&#xA;&#xA;import math&#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, BasicAer&#xA;&#xA;&#xA;#initialization&#xA;q = QuantumRegister(5, &quot;q&quot;)&#xA;c = ClassicalRegister(4, 'c')&#xA;circ = QuantumCircuit(q, c, name=&quot;initializer_circ&quot;)&#xA;&#xA;desired_vector = [&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   1 / math.sqrt(8),&#xA;   0,&#xA;   0,&#xA;   0,&#xA;   0,&#xA;   0,&#xA;   0,&#xA;   0,&#xA;   0]&#xA;&#xA;&#xA;circ.initialize(desired_vector, [q[0], q[1], q[2], q[3]])&#xA;&#xA;#circ.draw()&#xA;&#xA;&#xA;#IQFT&#xA;sub_q = QuantumRegister(4)&#xA;sub_circ = QuantumCircuit(sub_q, name='IQFT')&#xA;sub_circ.swap(sub_q[0], sub_q[3])&#xA;for j in range(4):&#xA;   for k in range(j):&#xA;       sub_circ.cu1(math.pi/float(2**(j-k)), sub_q[j], sub_q[k])&#xA;   sub_circ.h(sub_q[j])&#xA;sub_circ=sub_circ.inverse()&#xA;sub_inst = sub_circ.to_instruction()&#xA;circ.append(sub_inst, [q[0],q[1],q[2],q[3]])&#xA;#circ.draw()&#xA;&#xA;&#xA;#phase inverstion of |0000&amp;gt;&#xA;circ.x(q[0])&#xA;circ.x(q[1])&#xA;circ.x(q[2])&#xA;circ.x(q[3])&#xA;circ.h(q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.ccx(q[2], q[4], q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.h(q[3])&#xA;circ.x(q[0])&#xA;circ.x(q[1])&#xA;circ.x(q[2])&#xA;circ.x(q[3])&#xA;&#xA;#circ.draw()&#xA;&#xA;&#xA;&#xA;#phase inverstion of |0001&amp;gt;&#xA;circ.x(q[1])&#xA;circ.x(q[2])&#xA;circ.x(q[3])&#xA;circ.h(q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.ccx(q[2], q[4], q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.h(q[3])&#xA;circ.x(q[1])&#xA;circ.x(q[2])&#xA;circ.x(q[3])&#xA;&#xA;#circ.draw()&#xA;&#xA;&#xA;#phase inverstion of |1111&amp;gt;&#xA;circ.h(q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.ccx(q[2], q[4], q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.h(q[3])&#xA;&#xA;#circ.draw()&#xA;&#xA;&#xA;&#xA;#Diffusion Operator&#xA;circ.h(q[0])&#xA;circ.h(q[1])&#xA;circ.h(q[2])&#xA;circ.h(q[3])&#xA;circ.x(q[0])&#xA;circ.x(q[1])&#xA;circ.x(q[2])&#xA;circ.x(q[3])&#xA;circ.h(q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.ccx(q[2], q[4], q[3])&#xA;circ.ccx(q[0], q[1], q[4])&#xA;circ.h(q[3])&#xA;circ.x(q[0])&#xA;circ.x(q[1])&#xA;circ.x(q[2])&#xA;circ.x(q[3])&#xA;circ.h(q[0])&#xA;circ.h(q[1])&#xA;circ.h(q[2])&#xA;circ.h(q[3])&#xA;#circ.draw()&#xA;&#xA;&#xA;#check the state vector at any stage run the following code:&#xA;&#xA;# Import Aer&#xA;from qiskit import BasicAer&#xA;&#xA;# Run the quantum circuit on a statevector simulator backend&#xA;backend = BasicAer.get_backend('statevector_simulator')&#xA;# Create a Quantum Program for execution &#xA;job = execute(circ, backend)&#xA;result = job.result()&#xA;outputstate = result.get_statevector(circ, decimals=3)&#xA;print(outputstate)&#xA;print(np.absolute(outputstate))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: uncomment #circ.draw() to plot the circuit&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="7739" LastEditorUserId="9006" LastEditDate="2020-01-06T22:13:47.300" LastActivityDate="2020-01-06T22:13:47.300" Title="Grover search for basis states with complex coefficents and multiple marked states" Tags="&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="6424" PostTypeId="1" CreationDate="2019-06-12T09:48:26.763" Score="4" ViewCount="100" Body="&lt;p&gt;How does the act of erasing information increase the total entropy of the system? This goes by the name Landauer's principle. Some details are &lt;a href=&quot;https://en.wikipedia.org/wiki/Landauer%27s_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Can anyone shed more light on this?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="10480" LastEditDate="2021-04-05T17:44:07.997" LastActivityDate="2021-04-05T17:44:07.997" Title="What is Landauer’s principle?" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6425" PostTypeId="2" ParentId="6418" CreationDate="2019-06-12T10:58:23.440" Score="1" Body="&lt;p&gt;That is a very old paper, corresponding to version one of the software.  It is now on version 4.x.  It is best to see the current documentation for how to use the Bloch sphere: &lt;a href=&quot;http://qutip.org/docs/latest/guide/guide-bloch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://qutip.org/docs/latest/guide/guide-bloch.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-06-12T10:58:23.440" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6426" PostTypeId="2" ParentId="6417" CreationDate="2019-06-12T11:09:15.377" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Now here is where it gets deep an  Qubit Array can represent &lt;span class=&quot;math-container&quot;&gt;$2^$&lt;/span&gt; possible array elements (consult anywhere online for an explanation of that or drop a comment).&lt;/p&gt;&#xA;&lt;p&gt;And similarly an  Qubit quantum operator can act on that entire &lt;span class=&quot;math-container&quot;&gt;$2^$&lt;/span&gt; quantum space, and produce an answer that we can interpret.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's probably not too clear here, but I think the OP meant, an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit array can represent any state that is a linear combination of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; basis states.&lt;/p&gt;&#xA;&lt;p&gt;So, a classical array of 1 bit could represent any state 0 or 1 (&lt;span class=&quot;math-container&quot;&gt;$2^1$&lt;/span&gt; possibilities), but a single qubit could be in any state &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;, so an infinite number of possibilities made from a basis of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; states.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-06-12T11:09:15.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6427" PostTypeId="1" AcceptedAnswerId="6428" CreationDate="2019-06-12T11:56:30.720" Score="3" ViewCount="81" Body="&lt;p&gt;On contrary to amplitude amplification, can I do some reflection such that my marked states' probability will vanish (ideally become zero but if there are small residuals also acceptable)? In order to preserve the normalization condition, all the rest states will get amplified uniformly but the phases of them should remain the same (their coefficients are complex. Is this possible? &lt;/p&gt;&#xA;" OwnerUserId="7739" LastEditorUserId="26" LastEditDate="2019-06-12T15:36:04.473" LastActivityDate="2019-06-13T07:03:46.373" Title="Amplitude suppression" Tags="&lt;amplitude-amplification&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6428" PostTypeId="2" ParentId="6427" CreationDate="2019-06-12T12:04:07.350" Score="3" Body="&lt;p&gt;Any state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; can be decomposed using a two-dimensional subspace comprising marked and unmarked states,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\alpha|\Psi_m\rangle+\beta|\Psi_u\rangle.&#xA;$$&lt;/span&gt;&#xA;Part of the assumption is that you have a marking oracle that acts as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle|0\rangle\rightarrow\alpha|\Psi_m\rangle|1\rangle+\beta|\Psi_u\rangle|1\rangle.&#xA;$$&lt;/span&gt;&#xA;This is exactly the same thing that you use during amplitude amplification (usually, your ancilla bit would be in the state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle=(|0\rangle-|1\rangle)/\sqrt{2}$&lt;/span&gt; in order to get the phase kick-back onto the main system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the typical setting, the amplitude for marked states (&lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;) is small. If this is the case, if you simply measure the ancilla qubit, you'll find it to be in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;, which is close to 1. You're left with the state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_u\rangle$&lt;/span&gt;. Even if it doesn't work, you just have to repeat a small number of times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're in the opposite regime where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is large, then notice this is just your normal amplitude amplification, you've merely switched the roles of marked and unmarked states - suppressing &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is the same as amplifying &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;. To make this work, all you need to do is every time you apply the marking procedure, flip the ancilla qubit as well, converting marked into unmarked and vice versa.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how should I use just one ancilla to record multiple marked states?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Hopefully this is already clearer. However, the point is there is a boolean value for &quot;should this state be marked?&quot;: 0 for no, 1 for yes. Multiple states can answer 1. For example, you could define the marking function to be something like &quot;is the number even?&quot; which is simple enough to mark all the even numbers simultaneously (actually, you just take the least significant bit of the number and flip it).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-06-13T07:03:46.373" LastActivityDate="2019-06-13T07:03:46.373" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6429" PostTypeId="2" ParentId="6424" CreationDate="2019-06-12T12:19:25.887" Score="3" Body="&lt;p&gt;It means that if you lose information from your system, that information must have been transferred to the system's surroundings. This shows up as an increase in the entropy in the surroundings. This is directly related to the 2nd law of thermodynamics which says the entropy of an isolated system is always increasing. See &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Entropy_in_thermodynamics_and_information_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Entropy in thermodynamics and information theory&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="26" LastEditDate="2019-06-12T15:36:52.797" LastActivityDate="2019-06-12T15:36:52.797" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6431" PostTypeId="1" AcceptedAnswerId="6441" CreationDate="2019-06-12T17:12:09.080" Score="2" ViewCount="193" Body="&lt;p&gt;I am reading a paper on Quantum Secret Sharing &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9806063.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Secret Sharing using GHZ states&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have doubts regarding the initial phase of the paper, which are: Let me state what things I read and understood&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice, Bob, Charlie share a GHZ state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\dfrac{|000\rangle+|111\rangle}{\sqrt{2}}$&lt;/span&gt; and are given one particle each from this state, well this is quite clear to me, proceeding next&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;They each choose at random whether to measure their&#xA;particle in the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; direction  They then announce&#xA;publicly in which direction they have made a measurement, but not the results of their measurements. Half&#xA;the time, Bob and Charlie, by combining the results of&#xA;their measurements, can determine what the result of Alice’s measurement was. This allows Alice to establish a&#xA;joint key with Bob and Charlie, which she can then use&#xA;to send her message.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; eigenstates are defined as &lt;span class=&quot;math-container&quot;&gt;$|+x\rangle=\dfrac{|0\rangle+|1\rangle}{\sqrt{2}}, |-x\rangle=\dfrac{|0\rangle-|1\rangle}{\sqrt{2}}$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$|+y\rangle=\dfrac{|0\rangle+i|1\rangle}{\sqrt{2}}, |-y\rangle=\dfrac{|0\rangle-i|1\rangle}{\sqrt{2}}$&lt;/span&gt;.&lt;br&gt;&#xA;Now my questions start from this point.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Q1. What does it mean to measure in &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; direction?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2. The &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; eigenstates and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; eigenstates are just the two different basis of a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; which are actually the eigenvectors of the unitary matrices &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;0 &amp;amp;1\\&#xA;1&amp;amp;0\end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;0 &amp;amp;-i\\&#xA;i&amp;amp;0\end{bmatrix}$&lt;/span&gt; expressed in ket notation, so any Qubit can be expressed in terms of these two basis is what I understand. But what is the results when say measured in the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; basis, and what is the system after that measurement? &#xA;I have a few more doubts but first i want to understand this from a mathematical point of view. Can somebody help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: After @DaftWullie's answer&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say I want to measure what is the probability that upon measurement of the third qubit I get a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;. So, I calculate &lt;span class=&quot;math-container&quot;&gt;$$p_{+}=\left(\dfrac{\langle 000|+\langle 111|}{\sqrt{2}}\right)(I\otimes I\otimes|+x\rangle\langle +x|)\left(\dfrac{ |000\rangle+|111\rangle }{\sqrt{2}}\right).$$&lt;/span&gt;&#xA;Now I express the third qubit in terms of the Pauli basis to get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle=\dfrac{|+x\rangle + |-x\rangle}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle=\dfrac{|+x\rangle - |-x\rangle}{2} $&lt;/span&gt; and substitute these values in place of third qubit above to obtain &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ p_{+}=\left(\dfrac{\langle 00|(\langle +x|+\langle -x|)+\langle 11|(\langle +x|-\langle -x|)}{\sqrt{2}\sqrt{2}}\right)(I\otimes I\otimes|+x\rangle\langle +x|)\left(\dfrac{ |00\rangle( |+x\rangle + |-x\rangle)        +|11\rangle (|+x\rangle - |-x\rangle)  }{\sqrt{2}\sqrt{2}}\right)$$&lt;/span&gt;&#xA; The left part of my expression evaluates to &lt;span class=&quot;math-container&quot;&gt;$$ \dfrac{\langle 00|\left( \langle+x|+x\rangle +  \langle-x|+x\rangle\right) + \langle 11|\left( \langle+x|+x\rangle -  \langle-x|+x\rangle\right)}{2}$$&lt;/span&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ = \dfrac{\langle 00|(1+0) +\langle 11|(1-0)}{2}= \dfrac{\langle 00| +\langle 11|}{2}$$&lt;/span&gt;&#xA;Similarly the right part evaluates to &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{|00\rangle+|11\rangle}{2}$$&lt;/span&gt;&#xA;so i get &lt;span class=&quot;math-container&quot;&gt;$$p_+=\left(\dfrac{\langle 00| +\langle 11|}{2}\right)\left( \dfrac{|00\rangle+|11\rangle}{2}\right)=\dfrac{1}{4}+ \dfrac{1}{4}=\dfrac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2019-06-14T07:53:16.227" LastActivityDate="2019-06-14T07:53:16.227" Title="Quantum secret Sharing using GHZ state paper" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="6432" PostTypeId="1" AcceptedAnswerId="6466" CreationDate="2019-06-12T20:20:38.750" Score="4" ViewCount="119" Body="&lt;p&gt;I am wondering if there is a way to get advice\feedback here about the following: I am about to start a MS physics program. I am interested in quantum computing and my department has the option of pursuing a thesis as a graduation route. I am new to this topic and would like to see if I can get some suggestions - papers, books, topics, etc - to think about to be able to craft a project in quantum computing for a beginner like me that can in a two-year period scale into something with more insight in the topic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="26" LastEditDate="2019-06-17T12:04:06.647" LastActivityDate="2019-06-17T12:04:06.647" Title="Quantum Computing Project Inquiry" Tags="&lt;resource-request&gt;&lt;research&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2019-06-20T09:32:59.473" ContentLicense="CC BY-SA 4.0" />
  <row Id="6433" PostTypeId="1" AcceptedAnswerId="6434" CreationDate="2019-06-12T20:33:48.687" Score="2" ViewCount="58" Body="&lt;p&gt;I am getting confused as to how to perform gate operations using matrices and am hoping someone will help me walk through this example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say I want to perform a Pauli-X gate on the 3rd qubit in a 3-qubit system. That operation would be: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;U = I ⊗ I ⊗ X&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then say I have the state &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt; so after applying U the state would become &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;. I am trying to use Python and NumPy to calculate this but I believe I am missing something.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;i = np.array([[1, 0],&#xA;              [0, 1]])&#xA;&#xA;x = np.array([[0, 1],&#xA;              [1, 0]])&#xA;&#xA;state_0 = np.array([[1],&#xA;                    [0]])&#xA;state_1 = np.array([[0],&#xA;                    [1]])&#xA;&#xA;x_3 = np.kron(np.kron(i,i),x)&#xA;&#xA;v = np.kron(np.kron(state_0, state_0), state_1)&#xA;&#xA;print(x_3.dot(v))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This code outputs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[1]&#xA; [0]&#xA; [0]&#xA; [0]&#xA; [0]&#xA; [0]&#xA; [0]&#xA; [0]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I am unsure if this output is correct and if it is how would I see this as the state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;? Any clarifications would be very useful! Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="2879" LastEditDate="2019-06-12T21:04:28.027" LastActivityDate="2019-06-12T21:07:19.560" Title="Perform quantum gate operations using state vectors and matrices" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;quantum-information&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6434" PostTypeId="2" ParentId="6433" CreationDate="2019-06-12T21:07:19.560" Score="3" Body="&lt;p&gt;You can use the same tools you used to get this output to check that it is correct: the state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; would be represented as tensor product &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |0\rangle \otimes |0\rangle$&lt;/span&gt;, which in your Python notation would be &lt;code&gt;np.kron(np.kron(state_0, state_0), state_0)&lt;/code&gt;. This should give you the same column vector you got from running your code, with the first element 1 and the rest of them 0s.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-06-12T21:07:19.560" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6435" PostTypeId="1" CreationDate="2019-06-13T00:57:22.930" Score="7" ViewCount="149" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; be a projector and &lt;span class=&quot;math-container&quot;&gt;$Q = I-P$&lt;/span&gt; be its complement. How to find probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and unitaries &lt;span class=&quot;math-container&quot;&gt;$U_1, U_2$&lt;/span&gt; such that for any &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P\rho P + Q\rho Q = p U_1\rho U_1^\dagger + (1-p)U_2\rho U_2^\dagger$&lt;/span&gt;? (This is Nielsen and Chuang Exercise 11.20)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to spectral decompose &lt;span class=&quot;math-container&quot;&gt;$P = UU^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; columns with &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; being the rank of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. This doesn't get me anywhere since &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger$&lt;/span&gt; is not of the form of a unitary.&lt;/p&gt;&#xA;" OwnerUserId="7745" LastEditorUserId="5870" LastEditDate="2019-06-13T04:16:09.977" LastActivityDate="2019-06-13T17:29:26.393" Title="Quantum channel representation of projective measurement" Tags="&lt;measurement&gt;&lt;nielsen-and-chuang&gt;&lt;quantum-operation&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6436" PostTypeId="1" AcceptedAnswerId="6461" CreationDate="2019-06-13T03:19:25.203" Score="9" ViewCount="566" Body="&lt;p&gt;I'm trying to program a controlled gate as the figure below in Qiskit. Should it be sufficient to separate and control individually the Hadamard gates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fJVgh.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fJVgh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7746" LastEditorUserId="26" LastEditDate="2019-06-14T04:33:12.890" LastActivityDate="2019-06-14T13:16:18.000" Title="How to program a controlled Hadamard-Hadamard gate?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6438" PostTypeId="2" ParentId="6436" CreationDate="2019-06-13T05:09:57.417" Score="8" Body="&lt;p&gt;Yes, that notation means the Hadamard on the second qubit depends on the first qubit and the Hadamard on the third qubit depends on the first qubit. The gates aren't connected to each other in any way. &lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-06-13T05:09:57.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6439" PostTypeId="2" ParentId="6427" CreationDate="2019-06-13T05:37:28.140" Score="0" Body="&lt;p&gt;You can simply apply amplitude amplification to the unmarked states. Whereas you originally reflect around the marked states, now you simply reflect around the unmarked states.&lt;/p&gt;&#xA;" OwnerUserId="282" LastActivityDate="2019-06-13T05:37:28.140" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6440" PostTypeId="2" ParentId="6435" CreationDate="2019-06-13T06:25:58.607" Score="5" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is (ortho)projector, that is &lt;span class=&quot;math-container&quot;&gt;$P^2=P=P^\dagger$&lt;/span&gt;, then we can define unitary &lt;span class=&quot;math-container&quot;&gt;$U = I - 2P$&lt;/span&gt;. You can verify &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UU^\dagger = U^2 = (I-2P)(I-2P) = I-4P+4P = I&#xA;$$&lt;/span&gt;&#xA;Now we can express &lt;span class=&quot;math-container&quot;&gt;$P=\frac{1}{2}(I-U), Q=\frac{1}{2}(I+U)$&lt;/span&gt; and calculate &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P\rho P + Q\rho Q = \frac{1}{4}(I-U)\rho(I-U) + \frac{1}{4}(I+U)\rho(I+U)= &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{4}(\rho - U\rho - \rho U + U\rho U) + \frac{1}{4}(\rho + U\rho + \rho U + U\rho U)= \frac{1}{2}(\rho + U\rho U) = \frac{1}{2}(\rho + U\rho U^\dagger)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;In general case we can use the fact that the channel &lt;span class=&quot;math-container&quot;&gt;$\rho \rightarrow \sum_{k=1}^n P_k \rho P_k$&lt;/span&gt; is the composition of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; channels &lt;span class=&quot;math-container&quot;&gt;$\rho \rightarrow P_k \rho P_k + P_k^\perp \rho P_k^\perp$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k=1,..,n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-06-13T16:53:58.800" LastActivityDate="2019-06-13T16:53:58.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6441" PostTypeId="2" ParentId="6431" CreationDate="2019-06-13T06:47:19.677" Score="4" Body="&lt;p&gt;This question is actually entirely about the basics of measurement on a quantum system, and nothing to do with secret sharing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's state the measurement postulate of quantum mechanics as it applies to projective measurements:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A measurement is described by a set of projectors &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; satisfying&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\sum_iP_i=1$&lt;/span&gt;. If a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is being measured, the&#xA;  outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is obtained with probability&#xA;  &lt;span class=&quot;math-container&quot;&gt;$p_i=\langle\psi|P_i|\psi\rangle$&lt;/span&gt;, and if outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is obtained, the&#xA;  state after measurement is &lt;span class=&quot;math-container&quot;&gt;$P_i|\psi\rangle/\sqrt{p_i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So, all you need to know are the projectors. Giving an operator such as Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is one way of specifying the measurement as an operator decomposes into projectors onto the subspaces of different eigenvalues. e.g. &lt;span class=&quot;math-container&quot;&gt;$X=|+x\rangle\langle+x|-|-x\rangle\langle-x|$&lt;/span&gt;, so it says use projectors &lt;span class=&quot;math-container&quot;&gt;$P_+=|+x\rangle\langle+x|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_-=|-x\rangle\langle-x|$&lt;/span&gt; on a single qubit. If you're measuring multiple qubits, you pad all the other qubits with identity matrices. So a measurement in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis of qubit 2 means &lt;span class=&quot;math-container&quot;&gt;$1\otimes X\otimes 1$&lt;/span&gt;, which has projectors &lt;span class=&quot;math-container&quot;&gt;$1\otimes P_+\otimes 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1\otimes P_-\otimes 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-13T06:47:19.677" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6442" PostTypeId="2" ParentId="6435" CreationDate="2019-06-13T15:54:36.467" Score="3" Body="&lt;p&gt;I'll cover a slightly more general case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k=1,...,N$&lt;/span&gt; a complete set of orthogonal projectors: &lt;span class=&quot;math-container&quot;&gt;$\sum_k P_k=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_j P_k=\delta_{jk}P_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)=\sum_k P_k \rho P_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to find a set of unitaries &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_k$&lt;/span&gt; and probabilities &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)=\sum_\ell p_\ell\mathcal U_\ell\rho\,\mathcal U_\ell$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define the unitaries &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_k=\mathcal U_k^\dagger=I-2P_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k=1,...,N$&lt;/span&gt;. We then have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sum_k\mathcal U_k\rho\,\mathcal{U}_k &amp;amp;=N\rho-2\sum_k\{P_k,\rho\}+4\sum_k P_k\rho P_k \\&#xA;&amp;amp;=(N-4)\rho+4\sum_k P_k\rho P_k.&#xA;\end{align}&lt;/span&gt;&#xA;Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}\sum_k \mathcal U_k\rho\,\mathcal U_k+\frac{4-N}{4}\rho=\sum_k P_k\rho P_k.\tag A$$&lt;/span&gt;&#xA;Lets work out explicitly a few cases:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;&lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is the problem as originally stated (with &lt;span class=&quot;math-container&quot;&gt;$P_1=P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_2=Q$&lt;/span&gt;).&#xA;We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}(\mathcal U_1\rho\,\mathcal U_1+\mathcal U_2\rho\,\mathcal U_2)&#xA;+\frac{1}{2}\rho=P_1\rho P_1+P_2\rho P_2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt; case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}(\mathcal U_1\rho\,\mathcal U_1+\mathcal U_2\rho\,\mathcal U_2+\mathcal U_3\rho\,\mathcal U_3)&#xA;+\frac{1}{4}\rho&#xA;=P_1\rho P_1+P_2\rho P_2+P_3\rho P_3.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;span class=&quot;math-container&quot;&gt;$N=4$&lt;/span&gt; case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}\sum_{k=1}^4 \mathcal U_k\rho\,\mathcal U_k=\sum_{k=1}^4 P_k\rho P_k.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&lt;span class=&quot;math-container&quot;&gt;$N&amp;gt;4$&lt;/span&gt; case&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Interestingly, this method stops working for &lt;span class=&quot;math-container&quot;&gt;$N&amp;gt;4$&lt;/span&gt; (which of course does not mean that we cannot decompose these channels using unitaries, only that this particular decomposition method does not work anymore). More precisely, (A) still holds, but it's no longer a valid Kraus decomposition because &lt;span class=&quot;math-container&quot;&gt;$4-N&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-13T17:29:26.393" LastActivityDate="2019-06-13T17:29:26.393" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6443" PostTypeId="1" AcceptedAnswerId="6453" CreationDate="2019-06-13T16:11:03.647" Score="6" ViewCount="661" Body="&lt;p&gt;I have a question while reading the quantum fidelity definition in Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states#Proof_of_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fidelity of quantum states&lt;/a&gt;, at the end of the Definition section of quantum fidelity formula, it says Explicit expression for qubits. If rho  and sigma are both qubit states, the fidelity can be computed as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(\rho, \sigma)=\operatorname{tr}(\rho \sigma)+2 \sqrt{\operatorname{det}(\rho) \operatorname{det}(\sigma)}&#xA;$$&lt;/span&gt;&#xA;So I'm really confused about where this formula comes from. I tested several simple examples, it seems that the formula is not suitable to calculate the fidelity between two mixed states while the dimensions of the density matrices are not &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; (e.g. for the case both of the two matrices are diag(0.5,0,0,0.5), the fidelity calculated by this formula is 0.5 not 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if one of the density matrices is in pure state, it seems the result now is always correct even though the dimensions of the density matrices are bigger than &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm wondering how to prove this formula and is it always safe to use it while one of the density matrices is in pure state...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="7752" LastEditorUserId="55" LastEditDate="2021-04-26T15:41:27.723" LastActivityDate="2021-05-29T23:11:04.667" Title="Quantum fidelity simplified formula while both of the density matrices are single qubit states" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;fidelity&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6446" PostTypeId="2" ParentId="5973" CreationDate="2019-06-14T00:00:35.417" Score="4" Body="&lt;p&gt;I have a theory as for where the issue comes from (huge thanks to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1763/robin-kothari&quot;&gt;Robin&lt;/a&gt; for helping me figure it out!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover iteration consists of four steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply the oracle.&lt;/li&gt;&#xA;&lt;li&gt;Apply the Hadamard transform.&lt;/li&gt;&#xA;&lt;li&gt;Perform a conditional phase shift.&lt;/li&gt;&#xA;&lt;li&gt;Apply the Hadamard transform.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ConditionalPhaseFlip&lt;/code&gt; operation in the Q# code implements the third step: it gives a phase shift of -1 to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state (if you follow Q# code closely, this routine takes a marking oracle which marks the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and converts it to phase-flipping oracle which flips the phase of this state only).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This implementation differs from the description in Nielsen and Chuang, which says that each basis state &lt;em&gt;except&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; gets a phase shift of -1 (the difference is global phase of -1). When you use this Grover iteration as part of Grover search algorithm, this extra global phase has no effect on measurement outcomes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when you use this iteration as part of quantum counting algorithm, this global phase can actually be detected! Since phase estimation uses controlled versions of the iteration, the phase becomes relative instead of global, and starts affecting the computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's denote the Grover iteration as &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i (2 \pi - \theta)}$&lt;/span&gt; (with the correct number of solutions calculated as &lt;span class=&quot;math-container&quot;&gt;$M_c = N \sin^2 \frac{\theta}{2}$&lt;/span&gt;). The Grover iteration with an global phase of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$(-G)$&lt;/span&gt; will have eigenvalues multiplied by &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$-e^{i\theta}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-e^{i (2 \pi - \theta)}$&lt;/span&gt;. Given that &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi} = -1$&lt;/span&gt;, we can write them as &lt;span class=&quot;math-container&quot;&gt;$e^{i(\pi + \theta)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i (\pi - \theta)}$&lt;/span&gt;. When you feed the unitary &lt;span class=&quot;math-container&quot;&gt;$(-G)$&lt;/span&gt; into the quantum counting algorithm, you'll get &lt;span class=&quot;math-container&quot;&gt;$M_{-1} = N \sin^2 \frac{\theta + \pi}{2} = N \cos^2 \frac{\theta}{2}$&lt;/span&gt; - which is exactly the answer you're getting!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fix is a lot easier than figuring out what went wrong - just add a global phase of -1 to &lt;code&gt;ConditionalPhaseFlip&lt;/code&gt;. You can use &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.r&quot; rel=&quot;nofollow noreferrer&quot;&gt;R operation&lt;/a&gt; for that: &lt;code&gt;R(PauliI, 2.0 * PI(), register[0]);&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-06-14T00:00:35.417" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6447" PostTypeId="2" ParentId="4730" CreationDate="2019-06-14T00:31:00.813" Score="3" Body="&lt;p&gt;Looking at the implementation of &lt;code&gt;GroverPow&lt;/code&gt; only, it seems that the issue might be the same as in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5973/counting-in-q-number-of-solutions&quot;&gt;this question&lt;/a&gt;, though implemented in a slightly different way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This section of the code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ApplyToEachCA(X, inputQubits);&#xA;Controlled Z(Most(inputQubits), Tail(inputQubits));&#xA;ApplyToEachCA(X, inputQubits);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;implements conditional phase shift by flipping the phase only for the &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; state. This yields a global phase difference of -1 compared to Nielsen and Chuang presentation which flips phase of all states except for the &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; state. This is detected by phase estimation algorithm, so that quantum counting ends up reporting the number of solutions equal to &lt;span class=&quot;math-container&quot;&gt;$N - M$&lt;/span&gt; instead of just &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (I did the detailed math in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5973/counting-in-q-number-of-solutions/6446#6446&quot;&gt;my answer&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-06-14T00:31:00.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6448" PostTypeId="1" AcceptedAnswerId="6451" CreationDate="2019-06-14T04:50:34.120" Score="7" ViewCount="93" Body="&lt;p&gt;This may be a fairly basic question, but in Nielsen &amp;amp; Chuang, the following circuit is given for simulating &lt;span class=&quot;math-container&quot;&gt;$\exp\left(-i\Delta t Z_1 \otimes Z_2 \otimes Z_3\right)$&lt;/span&gt;: &lt;a href=&quot;https://i.stack.imgur.com/tDpUk.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tDpUk.png&quot; alt=&quot;klocal simulation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which uses an ancilla qubit initialized to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. But from messing around with different gate sequences, it seems like this can be done with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;CNOT_{1,2}CNOT_{1,3}e^{-i\Delta t Z_3}CNOT_{1,3}CNOT_{1,2}&#xA;\end{align}&lt;/span&gt;&#xA;or even &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;CNOT_{1,2}CNOT_{2,3}e^{-i\Delta t Z_3}CNOT_{2,3}CNOT_{1,2} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which doesn't require the ancilla and has two fewer CNOTs. Is there any advantage to using an ancilla qubit in this circuit?&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2019-06-14T07:26:49.600" Title="Simulating a 3-local Hamiltonian Term" Tags="&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6449" PostTypeId="1" CreationDate="2019-06-14T06:14:19.340" Score="8" ViewCount="98" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1003.3778&quot; rel=&quot;noreferrer&quot;&gt;Quantum Entanglement and Geometry — Andreas Gabriel (2010) — Sec: 2.3.4 ~p. 11&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Another basis for &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt;-dimensional matrices that &lt;strong&gt;has proven to be quite useful&lt;/strong&gt; in quantum information theory is the Weyl operator basis, which consists of &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; unitary and mutually orthogonal matrices &lt;span class=&quot;math-container&quot;&gt;$W_{m,n}$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$$W_{m,n}=\sum_{k=0}^{d-1}e^{\frac{2\pi i}{d}kn}|k\rangle\langle k+m|$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$0\leq m.n \leq d-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(k+m)$&lt;/span&gt; is understood to modulo &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$$U_{00}=\Bbb 1, U_{0,1}=\sigma_1, U_{1,0}=\sigma_3, U_{1,1}=i\sigma_2.$$&lt;/span&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It seems Weyl matrices are generalizations to the Pauli matrices. So how and where exactly are they useful? Do they have any special properties like Pauli matrices? And what motivated the definition of Weyl matrices?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Weyl matrices are only finite-dimensional; I suppose there must be an infinite dimensional &lt;em&gt;operator&lt;/em&gt; analogue to them such that the summation would be replaced by an integral?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-04-26T15:41:06.990" LastActivityDate="2021-04-26T15:41:06.990" Title="What is the motivation for Weyl matrices in quantum information theory?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6451" PostTypeId="2" ParentId="6448" CreationDate="2019-06-14T07:26:49.600" Score="6" Body="&lt;p&gt;Yes, in this special case the circuit will simplify as you suggest. The advantage of the circuit that was given is that it generalises more easily, and works for any &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; which has &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; eigenvalues. Here's a general form of the circuit for your reference:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/icnTg.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/icnTg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This essentially comes down to an issue of how you can reversibly compute a one-bit function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n\mapsto\{0,1\}$&lt;/span&gt; (the 0/1 answer conveys whether it's in the +1 or -1 eigenspace). You can guarantee to do this with &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; bits. Sometimes you can do it with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (basically if the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is balanced so that half the inputs give 0 answer and half give the 1 answer).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-14T07:26:49.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6452" PostTypeId="1" CreationDate="2019-06-14T07:48:30.130" Score="2" ViewCount="107" Body="&lt;p&gt;Since yesterday I'm trying to run on the new composer (&lt;a href=&quot;https://quantum-computing.ibm.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum-computing.ibm.com&lt;/a&gt;) both new experiments (never run before) and older experiments (that have been successfully run and completed some ago) on &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;, but they're stuck on &lt;code&gt;VALIDATING&lt;/code&gt; and never run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can successfully run experiments on other devices &lt;code&gt;ibmqx4&lt;/code&gt;, &lt;code&gt;ibmqx2&lt;/code&gt; and &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Issue is only with &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this depend on my account or on the device itself?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7758" LastActivityDate="2019-06-19T09:25:46.447" Title="Experiments stuck on VALIDATING ibmq_16_melbourne" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6453" PostTypeId="2" ParentId="6443" CreationDate="2019-06-14T07:54:24.297" Score="3" Body="&lt;p&gt;The general expression for the fidelity is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(\rho,\sigma)=\left(\text{Tr}\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right)^2=(\text{Tr}|\sqrt{\rho\sigma}|)^2.&#xA;$$&lt;/span&gt;&#xA;Assume &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices. Then &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho\sigma}$&lt;/span&gt; is also a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix which we assume to have eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt;. Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F=(|\lambda_1|+|\lambda_2|)^2=\lambda_1^2+\lambda_2^2+2|\lambda_1\lambda_2|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we also have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho\sigma)=\lambda_1^2+\lambda_2^2&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{det}(\rho\sigma)=\lambda_1^2\lambda_2^2,&#xA;$$&lt;/span&gt;&#xA;so &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\text{det}(\rho\sigma)}=|\lambda_1\lambda_2|$&lt;/span&gt;. So, that proves the relation specifically for &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices. As you stated, it generally does not hold for larger matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the special case of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; being pure, it does hold, but it's far easier simply to calculate &lt;span class=&quot;math-container&quot;&gt;$F=\langle\psi|\sigma|\psi\rangle=\text{Tr}(\rho\sigma)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="7752" LastEditDate="2019-06-14T11:09:13.800" LastActivityDate="2019-06-14T11:09:13.800" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6454" PostTypeId="1" CreationDate="2019-06-14T07:59:56.153" Score="2" ViewCount="77" Body="&lt;p&gt;Is there a way of eliminating a term of a superposition state?&#xA;Let's say I have the state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2}|00\rangle + \frac{1}{2}|01\rangle + \frac{1}{2}|10\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What operation would I do to eliminate the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;? And be left with only the terms &lt;span class=&quot;math-container&quot;&gt;$|01\rangle + |10\rangle$&lt;/span&gt;. I'm looking for a general solution, an idea, rather than one specific to this case.&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="26" LastEditDate="2019-06-14T13:45:00.300" LastActivityDate="2019-06-14T13:45:00.300" Title="Eliminating a term of a superposition state" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6455" PostTypeId="2" ParentId="6409" CreationDate="2019-06-14T08:17:09.857" Score="2" Body="&lt;p&gt;The state you've given, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=a|0\rangle+b|1\rangle$&lt;/span&gt; is a &lt;em&gt;pure&lt;/em&gt; state. It has not been decohered. Decoherence is a process which turns pure states into mixed states. We usually write these in terms of density matrices. A pure state can be written in this form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\langle\psi|=\left(\begin{array}{cc} |a|^2 &amp;amp; ab^\star \\ a^\star b &amp;amp; |b|^2 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;It is very much &lt;em&gt;not&lt;/em&gt; diagonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Decoherence (I'm going to use a particular form called dephasing) can alter this matrix, reducing the off-diagonal elements to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\left(\begin{array}{cc} |a|^2 &amp;amp; \gamma ab^\star \\ \gamma a^\star b &amp;amp; |b|^2 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$0\leq \gamma\leq 1$&lt;/span&gt;. So, when we talk about &lt;em&gt;coherence&lt;/em&gt;, people often mean comparing the product of the off-diagonal elements to the product of the diagonal elements (or some equivalent procedure). &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\gamma^2=\frac{\langle0|\rho|1\rangle\langle1|\rho|0\rangle}{\langle0|\rho|0\rangle\langle1|\rho|1\rangle}&#xA;$$&lt;/span&gt;&#xA;If the state is pure, and therefore has not been decohered, the two values are equal. The larger the difference, the more decoherence has occurred (because the coherence has been reduced).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-14T08:17:09.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6456" PostTypeId="2" ParentId="6413" CreationDate="2019-06-14T08:34:53.683" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I know that &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; can be decomposed mathematically as &lt;span class=&quot;math-container&quot;&gt;$b= c_1u_1 +&#xA;&amp;gt; \cdots + c_nu_n$&lt;/span&gt; since these eigenvectors form an orthonormal basis.&#xA;  Why only consider the effect on &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As you say, you know you can decompose &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in terms of the &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt;, so by linearity, if we know the effect on one basis state (which is pedagogically easier to describe), then we know the overall effect.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt;, not simply&#xA;  the identity matrix of dimension &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;? In which case the result after&#xA;  tensoring is a block matrix with &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_{0}/T}$&lt;/span&gt; on the main&#xA;  diagonal, and &lt;span class=&quot;math-container&quot;&gt;$0_n$&lt;/span&gt; elsewhere. Do I have this right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is sort of right - if the term &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_{0}/T}$&lt;/span&gt; didn't contain &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, you'd be fine. However, it does, so you have to include that in the sum over &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, so you're not just doing &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt; in isolation. As a simple example of this, imagine you were doing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{\tau}|\tau\rangle\langle\tau|\otimes |\tau\rangle\langle\tau|,&#xA;$$&lt;/span&gt;&#xA;this is certainly not the same thing as &lt;span class=&quot;math-container&quot;&gt;$1\otimes|\tau\rangle\langle\tau|$&lt;/span&gt; (after all, what is &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; at this point?). That is why the operator describes a controlled evolution. It  say &quot;if the first register is in the state &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;, apply the evolution &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_{0}/T}$&lt;/span&gt; on the second register&quot;. To reiterate, the key point is that both terms in the tensor product depend on &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;what is contained in register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; ? The state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{\lambda_j t_o}&#xA;&amp;gt; \rangle $&lt;/span&gt; seems to describe the superposition of registers &lt;span class=&quot;math-container&quot;&gt;$C,I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Indeed it does. It is crucial that the two registers are entangled, and you cannot consider just &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; in isolation. However, this is where it continues to help by just considering &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. In that case, the register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is separable from register &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. What that state &lt;em&gt;is&lt;/em&gt; looks horribly messy and hard to decipher. When I think about this calculation, as a first step, I find it easier to think about setting &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0\rangle$&lt;/span&gt; as a uniform superposition, just like you would in a 'normal' phase estimation procedure. Then your register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is in the state that is output from a normal phase estimation procedure, and it is clear that application of the (inverse) Fourier transform gives you the phase, in other words the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$|u_j\rangle$&lt;/span&gt; with high probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my alteration of &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0\rangle$&lt;/span&gt; is so obvious and simple, why don't they do that? The answer is it's an optimisation. The normal phase estimation protocol aims to maximise the probability of getting the right phase, whatever that phase may be. However, that's not the right figure of merit for the HHL algorithm (basically, because you're inverting eigenvalues, you need your small eigenvalues to be estimated more accurately than the larger ones), and the slightly different choice of &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0\rangle$&lt;/span&gt; aims to optimise the phase estimation procedure for that particular application.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-14T08:34:53.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6457" PostTypeId="2" ParentId="6413" CreationDate="2019-06-14T08:48:29.183" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;1) Are we not applying the conditional Hamiltonian evolution to &lt;span class=&quot;math-container&quot;&gt;$|\Psi_0 \rangle |b \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The operation &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau| \otimes e^{iA\tau t_0 / T}$$&lt;/span&gt;&#xA;is a controlled operation. You can read it as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\forall \tau \in [0, T-1]$&lt;/span&gt;, if the first register is in the state &lt;span class=&quot;math-container&quot;&gt;$\vert \tau \rangle$&lt;/span&gt;, apply &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_0 / T}$&lt;/span&gt;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This can be verified with the following property:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left( A \otimes B \right) \times \left( \vert a \rangle \otimes \vert b \rangle\right) = \left(A \times \vert a \rangle \right) \otimes \left( B \times \vert b \rangle\right)$$&lt;/span&gt;&#xA;where:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (resp. &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;) is a unitary operator on the space of &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt; (resp. &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\times$&lt;/span&gt; is the matrix-vector multiplication&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; is the kronecker product.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Coming back to the &quot;controlled Hamiltonian operation&quot;, if you apply the operator on a state &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi_0 \rangle \otimes \vert b \rangle$&lt;/span&gt; you end up with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;\left( \sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau| \otimes e^{iA\tau t_0 / T} \right) \times \left(\vert \Psi_0 \rangle \otimes \vert b \rangle\right) &#xA;&amp;amp;= \sum_{\tau = 0} ^{T - 1} \left(|\tau \rangle \langle \tau| \otimes e^{iA\tau t_0 / T}\right)  \times \left(\vert \Psi_0 \rangle \otimes \vert b \rangle\right) \\&#xA;&amp;amp;= \sum_{\tau = 0} ^{T - 1} \left(|\tau \rangle \langle \tau| \times \vert \Psi_0 \rangle \right) \otimes \left(e^{iA\tau t_0 / T} \times\vert b \rangle\right) \\&#xA;\end{split}&#xA;$$&lt;/span&gt;&#xA;The first part of the sum &lt;span class=&quot;math-container&quot;&gt;$\left(|\tau \rangle \langle \tau| \times \vert \Psi_0 \rangle \right)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi_0 \rangle$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi_0 \rangle = \vert \tau \rangle$&lt;/span&gt;, else it simplifies to the zero vector, which &quot;removes&quot; the effect of &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_0 / T}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi_0 \rangle \neq \vert \tau \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I know that &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; can be decomposed mathematically as &lt;span class=&quot;math-container&quot;&gt;$b= c_1u_1 + \cdots + c_nu_n$&lt;/span&gt; since these eigenvectors form an orthonormal basis. Why only consider the effect on &lt;span class=&quot;math-container&quot;&gt;$|u_j \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We could consider the effect on any other basis instead of the eigenbasis. But for the HHL algorithm, the controlled Hamiltonian simulation part is used in the Quantum Phase Estimation algorithm to estimate the eigenvalues of the simulated matrix (&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in your example). Considering another basis, even if it is possible, is not what will lead us to the solution which is the extraction of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to invert them afterwards.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;2)What is going on with the  &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt; portion of the sum in the conditional Hamiltionian evolution? In this answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2393/quantum-algorithm-for-linear-systems-of-equations-hhl09-step-2-what-is-p&quot;&gt;here&lt;/a&gt; , it&#xA;  is described &quot;[...] a control part. It means that the operation will be controlled by the state of the first quantum register (the register C as the exponent tells us)&quot;. I understand the &quot;gist&quot; of this statement but any reference to understand it more fully would be much appreciated.&#xA;   Edit: Is&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt;, not simply the identity matrix of dimension &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;? In which case the result after tensoring is a block matrix with &lt;span class=&quot;math-container&quot;&gt;$e^{iA\tau t_{0}/T}$&lt;/span&gt; on the main diagonal, and &lt;span class=&quot;math-container&quot;&gt;$0_n$&lt;/span&gt; elsewhere. Do I have this right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See above. The error you made in your reasoning here is that you studied one part of the sum independently of the other, which is not possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quick note: &lt;span class=&quot;math-container&quot;&gt;$\sum_{\tau = 0} ^{T - 1} |\tau \rangle \langle \tau|$&lt;/span&gt; &lt;strong&gt;alone&lt;/strong&gt; is the identity matrix of size &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;; you are right.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;3) After this step, a Fourier transform is applied to the register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, but at this point what is contained in register &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; ? The state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{\lambda_j t_o} \rangle $&lt;/span&gt; seems to describe the superposition of registers &lt;span class=&quot;math-container&quot;&gt;$C,I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Fourier transform is part of the Quantum Phase Estimation algorithm. I personally find easier to understand first all the details of the QPE algorithm and then viewing the first part of the HHL algorithm as the QPE algorithm with a specific unitary matrix. Doing this allows you to first untangle the mathematical complexity of the QPE algorithm, and then &quot;forget&quot; about this and focus on the mathematical complexity added by the state &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi_0\rangle$&lt;/span&gt; and the application of the controlled Hamiltonian simulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: @DaftWullie explains why &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi_0 \rangle$&lt;/span&gt; has such a complicated expression both in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6456/1386&quot;&gt;its answer to this question&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2462/1386&quot;&gt;a more detailed answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-06-14T09:49:06.693" LastActivityDate="2019-06-14T09:49:06.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6458" PostTypeId="1" AcceptedAnswerId="6459" CreationDate="2019-06-14T10:45:07.650" Score="12" ViewCount="1374" Body="&lt;p&gt;Is swap gate equivalent to just exchanging the wire of the two qubits?&lt;a href=&quot;https://i.stack.imgur.com/R2KYf.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R2KYf.png&quot; alt=&quot;like this&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;if yes why not just switching the wire whenever we want to apply a swap gate?&lt;/p&gt;&#xA;" OwnerUserId="7739" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-06-14T19:39:21.423" Title="Is swap gate equivalent to just exchanging the wire of the two qubits?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6459" PostTypeId="2" ParentId="6458" CreationDate="2019-06-14T11:08:40.500" Score="15" Body="&lt;p&gt;Yes, it is equivalent. That's a perfectly valid way to represent it in a quantum circuit diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, it depends what physical implementation you're talking about. If you have 'flying' qubits, then it is possible to just reorder them, or even simply relabel them without actively doing anything. However, many physical implementations of quantum computation use static qubits. That means one particular physical qubit is in a particular place. If you want to make it interact (e.g. perform controlled-not) with another qubit, they usually have to be next to each other. That means performing swap operations along some path, exchanging the states of the qubits so that the state that was on one physical qubit is now on a different one, where you need it to be.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-14T11:08:40.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6460" PostTypeId="2" ParentId="6454" CreationDate="2019-06-14T11:21:20.770" Score="1" Body="&lt;p&gt;If you've got&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \frac{1}{\sqrt{2}}|00\rangle+\frac{1}{2} \Big( |01\rangle + |10\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you want to suppress state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; using two ancillary qubits, you can&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;apply a negated Toffoli gate to an ancillary qubit &lt;code&gt;q[2]&lt;/code&gt; as target&lt;/li&gt;&#xA;&lt;li&gt;apply Hadamard to a second ancillary &lt;code&gt;q[3]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Toffoli &lt;span class=&quot;math-container&quot;&gt;$\mathbf{CCX}(q[2],q[3],q[0])$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbf{X}(q[3])$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbf{CCX}(q[2],q[3],q[1])$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and you'll obtain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_1\rangle = \frac{1}{\sqrt{2}}\Big( |01\rangle + |10\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simplyfing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z7BBl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z7BBl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general (if the state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; is not a simple superposition) you can use a negated Toffoli gate (or a series of &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; negated Toffoli gates for an input register of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits) to get the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; (or the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^n$&lt;/span&gt; for an input register of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits) to an ancillary qubit (or &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; ancillary qubits) and then suppress it to obtain the desired result (this depends on the result you want to obtain).&lt;/p&gt;&#xA;" OwnerUserId="7758" LastActivityDate="2019-06-14T11:21:20.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6461" PostTypeId="2" ParentId="6436" CreationDate="2019-06-14T13:16:18.000" Score="6" Body="&lt;p&gt;It seems like this gate is controlled on the top qubit (which I will call qubit 0) and performs a hadamard on both the other qubits (qubits 1 and 2) when the control is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. In this case it is equivalent to separte two controlled-hadamards: each controlled on qubit 0, with qubit 1 as the target for one and qubit 2 as the target for the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The controlled-hadamard can be implemented with &lt;code&gt;ch&lt;/code&gt;. The entire three qubit gate is then as follows.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3)&#xA;qc.ch(0,1)&#xA;qc.ch(0,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-14T13:16:18.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6462" PostTypeId="1" AcceptedAnswerId="6465" CreationDate="2019-06-14T15:03:24.860" Score="5" ViewCount="1991" Body="&lt;p&gt;I'm trying to implement the three qubit bit flip code in Qiskit. &#xA;Therefore, I need to get the result of a measure of two ancilla qubits, to deduce which gate I need to use do recover my logical qubit. I know how to get the result of a measure, at the end of a circuit with :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend_sim = Aer.get_backend('qasm_simulator')&#xA;job_sim = execute(qc, backend_sim, shots=1000)&#xA;result_sim = job_sim.result()&#xA;counts = result_sim.get_counts(qc)&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But, I don't know how to get the result of a measure into the circuit. Sorry if my question is stupid, I'm a beginner on Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GCdDO.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GCdDO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7762" LastActivityDate="2019-06-15T17:49:18.410" Title="Get result measurement into a circuit with Qiskit" Tags="&lt;qiskit&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6463" PostTypeId="2" ParentId="6458" CreationDate="2019-06-14T19:39:21.423" Score="6" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;why not just switching the wire whenever we want to apply a swap gate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If this is the crux of the question I think the main rationale here is to treat the swap gate as an actual gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only rarely see raw swap gates on their own in diagrams, typically I see them as part of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Fredkin_gate&quot; rel=&quot;noreferrer&quot;&gt;Fredkin Gate&lt;/a&gt;. Basically, by treating it as a gate rather than a crossing of wires, it makes it easier to understand how it can be &quot;controlled&quot; like any other gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But yes, an un-controlled swap gate could be implemented on classical bits in electrical wires by swapping the wires' positions.&lt;/p&gt;&#xA;" OwnerUserId="5843" LastActivityDate="2019-06-14T19:39:21.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6464" PostTypeId="1" CreationDate="2019-06-14T20:59:06.113" Score="4" ViewCount="329" Body="&lt;p&gt;I have multiple different operators in matrix form and I need to find their common eigenstates. The challenge is that the common eigenstate is in a superposition of multiple states and isn't just a single eigenvector. Can someone give me an idea of how to do this? How would I figure out what a common eigenstate in the form of a linear combination of vectors is for multiple matrices? For context, I am using Python and NumPy.&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="55" LastEditDate="2021-04-23T08:57:31.680" LastActivityDate="2021-04-23T08:57:31.680" Title="How to find a common eigenstate of commuting operators?" Tags="&lt;programming&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6465" PostTypeId="2" ParentId="6462" CreationDate="2019-06-15T03:20:01.087" Score="4" Body="&lt;p&gt;In Circuit Composer, you can use an if statement as shown below The circuit measures qubit 1 after a gate operation and, if it is 0, then applies an X gate to qubit 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[3];&#xA;creg c[3];&#xA;&#xA;x q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;if(c==0) x q[1]; # here where you can set it to trigger on c == 1&#xA;measure q[1] -&amp;gt; c[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1s6Ke.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1s6Ke.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Circuit yields a 1 for q[0] and a 0 for qubit 1 , because the X gate isn't applied due to the conditional. Hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: For syntax in qiskit, please look at the code below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(q, c)&#xA;qc.h(q)&#xA;qc.measure(q,c)&#xA;qc.x(q[0]).c_if(c, 0)&#xA;qc.measure(q,c)&#xA;qc.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It appears that you should use .c_if at the end of a certain operation to use conditionals.&lt;/p&gt;&#xA;" OwnerUserId="7764" LastEditorUserId="7764" LastEditDate="2019-06-15T17:49:18.410" LastActivityDate="2019-06-15T17:49:18.410" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6466" PostTypeId="2" ParentId="6432" CreationDate="2019-06-15T03:48:18.923" Score="4" Body="&lt;p&gt;If you are looking for a place to start, I probably start by asking you a few clarifying questions. Quantum Computation &amp;amp; Information is a broad field. I would say that it can primarily be viewed as a spectrum, similar to classical computing, from hardware up to algorithms. To get an idea of the hardware side, a great reference is &lt;a href=&quot;https://rsl.yale.edu/sites/default/files/files/RSL_Theses/jmcthesis.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jerry Chow's thesis&lt;/a&gt;. This paper is a great overview of the hardware implementation that is popular today, superconducting qubits. There are different implementations of quantum computers today, but the superconducting qubit architecture is the most popular (for the time being). On the upper end of algorithms, there are several papers from the 1990's by Peter Shor and John Preskill that would be useful. Shor devised the quantum algorithm for prime factorization that you may have heard a lot about, and both Shor and Preskill were influential in the development of Quantum Error Correction, the idea that with enough qubits that are of good enough quality, you can implement error correcting codes and get quantum computers to perform arbitrarily well. In the middle, I would say that you have programming of today's (primarily IBM's) quantum computers for near term applications. This programming is primarily done in python using &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit&lt;/a&gt;, a programming framework made by IBM. A general reference for the whole field would be &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang's book&lt;/a&gt; on the subject as a whole. Hopefully this is good enough to get you started. Let me know if you would like more detail/references on a certain area. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disclaimer: I have only been reading into quantum computing for about a year and half now, and certainly would not consider myself an expert.&lt;/p&gt;&#xA;" OwnerUserId="7764" LastActivityDate="2019-06-15T03:48:18.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6467" PostTypeId="1" CreationDate="2019-06-15T05:45:04.067" Score="5" ViewCount="170" Body="&lt;p&gt;The Peres-Horodecki criteria for a 2*2 state states that if the smallest eigenvalue of the partial transpose of the state is negative, it is entangled, else it is separable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://arxiv.org/abs/1411.4397&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; (page 4, left side), the following is an equivalent formulation to express the above criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the matrix in question looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;\rho_{00,00} &amp;amp; \rho_{00,01} &amp;amp; \rho_{00,10} &amp;amp; \rho_{00,11} \\&#xA;\rho_{01,00} &amp;amp; \rho_{01,01} &amp;amp; \rho_{01,10} &amp;amp; \rho_{01,11} \\&#xA;\rho_{10,00} &amp;amp; \rho_{10,01} &amp;amp; \rho_{10,10} &amp;amp; \rho_{10,11} \\&#xA;\rho_{11,00} &amp;amp; \rho_{11,01} &amp;amp; \rho_{11,10} &amp;amp; \rho_{11,11} \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following three determinants:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ W_2 = \begin{vmatrix}&#xA;\rho_{00,00} &amp;amp; \rho_{01,00} \\&#xA;\rho_{00,01} &amp;amp; \rho_{01,01} \\&#xA;\end{vmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$W_3 = \begin{vmatrix}&#xA;\rho_{00,00} &amp;amp; \rho_{01,00} &amp;amp; \rho_{00,10} \\&#xA;\rho_{00,01} &amp;amp; \rho_{01,01} &amp;amp; \rho_{00,11}  \\&#xA;\rho_{10,00} &amp;amp; \rho_{11,00} &amp;amp; \rho_{10,10}  \\&#xA;\end{vmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$W_4 = \begin{vmatrix}&#xA;\rho_{00,00} &amp;amp; \rho_{01,00} &amp;amp; \rho_{00,10} &amp;amp; \rho_{01,10} \\&#xA;\rho_{00,01} &amp;amp; \rho_{01,01} &amp;amp; \rho_{00,11} &amp;amp; \rho_{01,11}\\&#xA;\rho_{10,00} &amp;amp; \rho_{11,00} &amp;amp; \rho_{10,10} &amp;amp; \rho_{11,10}\\&#xA;\rho_{10,01} &amp;amp; \rho_{11,01} &amp;amp; \rho_{10,11} &amp;amp; \rho_{11,11}\\&#xA;\end{vmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that &lt;span class=&quot;math-container&quot;&gt;$W_4$&lt;/span&gt; is the determinant of the partial transpose of the matrix and &lt;span class=&quot;math-container&quot;&gt;$W_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W_2$&lt;/span&gt; are the first 3*3 and 2*2 elements of the partial transpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The condition is if &lt;span class=&quot;math-container&quot;&gt;$W_2 \geq 0$&lt;/span&gt; and (&lt;span class=&quot;math-container&quot;&gt;$W_3 &amp;lt; 0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$W_4 &amp;lt; 0$&lt;/span&gt;), then the state is entangled. If not, it is separable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these two equivalent? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, can this method be extended to ensure the smallest eigenvalue is greater than any &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is not necessarily 0?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="10480" LastEditDate="2021-03-09T18:48:16.813" LastActivityDate="2021-03-09T18:48:16.813" Title="Equivalent determinant condition for Peres-Horodecki criteria" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;density-matrix&gt;&lt;matrix-representation&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6468" PostTypeId="1" CreationDate="2019-06-15T07:59:54.060" Score="3" ViewCount="70" Body="&lt;p&gt;I'm referring to an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6431&quot;&gt;earlier question&lt;/a&gt;. It involves secret sharing based on the different measurement directions 3 people i.e  Alice Bob and Charlie do. Now there is a block in the referred paper which I want to understand in order to proceed further and here it goes assuming the GHZ state they share is &lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle=\dfrac{|000\rangle+|111\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose that Bob is dishonest and that he has managed to get a hold of Charlie’s&#xA;  particle as well as his own. He then measures the two particles and sends one of them on to Charlie. His object&#xA;  is to discover what Alice’s bit is, without any assistance&#xA;  from Charlie, and to do so in a way that cannot be detected. Alice has measured her particle in either the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;&#xA;  or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; direction, but Bob does not know which. He would&#xA;  like to measure the quantum state of his two-particle system, but because he does not know what measurement&#xA;  Alice made, he does not know whether to make his in the &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|00\rangle ± |11\rangle}{\sqrt{2}}$&lt;/span&gt;&#xA;   basis or in the &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|00\rangle ± i|11\rangle}{\sqrt{2}}$&lt;/span&gt; basis.&#xA;  Choosing at random he has a probability of &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; of making a mistake. If he chooses correctly, he will know, for&#xA;  valid combinations of measurement axes, what the result&#xA;  of Charlie’s measurement is from the result of his own,&#xA;  and this means he will then know what Alice’s bit is. For&#xA;  example, if Alice measured in the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; direction and found&#xA;  &lt;span class=&quot;math-container&quot;&gt;$| + x\rangle$&lt;/span&gt;, then the state Bob receives is &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt;. If&#xA;  Bob now measures in the &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|00\rangle \pm |11\rangle}{\sqrt{2}}$&lt;/span&gt; basis, he knows&#xA;  what the two- particle state is, and because&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}= \dfrac{|+x\rangle|+x\rangle + |-x\rangle|-x\rangle}{\sqrt{2}}$$&lt;/span&gt; Bob knows that Charlie’s measurement will produce a&#xA;  result identical to his&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The questions I have is &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do they accomplish the sharing of particles of this GHZ state? What particle is Alice given of this GHZ state I know it is given that the first particle but what does &quot;first&quot; mean?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It says Bob catches hold of Charlie's particle measures it and then sends to Charlie, but isn't Charlie already holding his particle when they decided to share the GHZ state or does Charlie get his particle after Bob measures both his and Charlie's particle?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As given if Bob receives &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt; then after measuring in the basis given he will get &lt;span class=&quot;math-container&quot;&gt;$p_{++}=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{--}=0$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$p_{++}=\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{--}=\dfrac{|00\rangle - |11\rangle}{\sqrt{2}}$&lt;/span&gt;, what does this have to do with the text that follows this measurement outcome?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-06-16T15:28:51.147" LastActivityDate="2019-06-16T15:28:51.147" Title="GHZ - measuring particles" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;cryptography&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6469" PostTypeId="2" ParentId="6464" CreationDate="2019-06-15T08:27:04.237" Score="4" Body="&lt;p&gt;Superposition is a linear combination of vectors &lt;em&gt;which is&lt;/em&gt; a single vector. It may not be equal to some basis vector (from computational basis, for example), but this is not a big deal in general.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for question, I suppose operators are normal (so we can apply the spectral theorem).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simplest case if operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; with multiplicity 1, then the corresponding eigenvector &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; will also be eigenvector for any commuting operator &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. &#xA;Since &lt;span class=&quot;math-container&quot;&gt;$Av=\lambda v$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$AB=BA$&lt;/span&gt; then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;ABv = BAv= B\lambda v \implies A(Bv) = \lambda (Bv) \implies Bv = \mu v&#xA;$$&lt;/span&gt;&#xA;Here we obtained that &lt;span class=&quot;math-container&quot;&gt;$Bv$&lt;/span&gt; is also eigenvector of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and since it has multiplicity 1 it must be collinear to &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;.&lt;br&gt;&#xA;So such eigenvector &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; will automatically be common eigenvector for a set of commuting with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general case &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; may not have eigenvalue with multiplicity 1. In this case &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has invariant subspaces (eigenspaces) &lt;span class=&quot;math-container&quot;&gt;$H_{\lambda_i}, \text{dim}H_{\lambda_i}&amp;gt;1$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$Av = \lambda_i v, \forall v \in H_{\lambda_i} $&lt;/span&gt;.They split space &lt;span class=&quot;math-container&quot;&gt;$H = H_{\lambda_1} \oplus ... \oplus H_{\lambda_k}$&lt;/span&gt;.&lt;br&gt;&#xA;Similarly to the simple case, we can show that if &lt;span class=&quot;math-container&quot;&gt;$AB=BA$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$H_{\lambda_i}$&lt;/span&gt; are also invariant for &lt;span class=&quot;math-container&quot;&gt;$B: B(H_{\lambda_i}) \subset H_{\lambda_i}$&lt;/span&gt;. Now we can consider restrictions of operator &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; on the subspaces &lt;span class=&quot;math-container&quot;&gt;$H_{\lambda_i}$&lt;/span&gt;. Every restriction has its own eigendecomposition. But every eigenspace of every such restriction of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; will be common eigenspace of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$H_{\lambda_i}$&lt;/span&gt; is eigenspace of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;br&gt;&#xA;Actually, if we take the intersection of eigendecompositions &lt;span class=&quot;math-container&quot;&gt;$\{H_{\lambda_i}\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{H_{\mu_i}\}$&lt;/span&gt; correspondingly for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; then we will obtain the decomposition of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; into common eigenspaces of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though it may not be that efficient to calculate intersection of all eigendecompositions for operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess we can just pick some random numbers &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; and find eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\sum_i r_i A_i$&lt;/span&gt;. With high probability it will be the common eigenvector for commuting operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-06-15T08:39:23.743" LastActivityDate="2019-06-15T08:39:23.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6470" PostTypeId="2" ParentId="120" CreationDate="2019-06-16T05:43:19.287" Score="1" Body="&lt;p&gt;The Quantum Reality group at the Centre for Quantum Technologies (National University of Singapore) &lt;a href=&quot;https://qreality.quantumlah.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qreality.quantumlah.org/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7771" LastActivityDate="2019-06-16T05:43:19.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6471" PostTypeId="2" ParentId="4527" CreationDate="2019-06-16T06:26:53.593" Score="2" Body="&lt;p&gt;At this early stage of quantum technology development, a useful starting point to understand the &quot;expectation of profitability&quot; is to look at the private markets (angel investing, venture capital, private equity, etc) in addition to public companies. Today there are 76 companies active in quantum computing, those were involved in 178 deals where 260 investors participated. The largest deal was for 350 Million USD, and, the median post-valuation 10 Million USD. As of June 15th, 2019, the total capital invested in quantum computing is 1.38 Billion USD, and there have been 11 exits. 2018 registered the higher deal count to date (24) and it was concentrated in venture capital allocations. In terms of industry verticals, there are around 15 active categories for the investments made in quantum computing, artificial intelligence is the second largest, followed by cybersecurity -but relatively unexploited opportunities are present in smaller niche verticals. Source: Morningstar, Inc.  &lt;/p&gt;&#xA;" OwnerUserId="7771" LastEditorUserId="7771" LastEditDate="2019-06-17T05:58:17.230" LastActivityDate="2019-06-17T05:58:17.230" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6472" PostTypeId="1" AcceptedAnswerId="6474" CreationDate="2019-06-16T07:02:13.633" Score="3" ViewCount="490" Body="&lt;h1&gt;Problem definition&lt;/h1&gt;&#xA;&lt;p&gt;I'm implementing a quantum circuit in qiskit for a Szegedy quantum walk, &lt;a href=&quot;https://arxiv.org/abs/1609.00173&quot; rel=&quot;nofollow noreferrer&quot;&gt;(reference, Fig 21.)&lt;/a&gt;. It uses two registers of dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt;) each one. The challenges I'm facing are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Multiple controlled gates (2 and 3 controls and targets like &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_{y}$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Hermitian conjugate of an operator (Dagger).&lt;/li&gt;&#xA;&lt;li&gt;Ancilla qubits, that increase the complexity of the circuit.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here is a main part of the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iNjGN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iNjGN.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, we have &lt;span class=&quot;math-container&quot;&gt;$K_{b_{2}}$&lt;/span&gt; controlled by zero and one controls.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ue1oy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ue1oy.png&quot; alt=&quot;This is the K_{b_{2} without dagger}&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Main questions&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How do I implement the controlled-dagger operator &lt;span class=&quot;math-container&quot;&gt;$K^{\dagger}_{b_{2}}$&lt;/span&gt;, of operator &lt;span class=&quot;math-container&quot;&gt;$K_{b_2}$&lt;/span&gt;? Does qiskit provide dagger operators of the principal gates? I have a little insight &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3809/what-is-the-purpose-of-the-tdg-gate-in-qiskit&quot;&gt;here&lt;/a&gt;. Should I apply tdg to all gates in &lt;span class=&quot;math-container&quot;&gt;$K_{b_{2}}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For multiple-controlled qubits operations, I base the construction of the multiple-controlled gates in the Nielsen&amp;amp;Chuang book, as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate&quot;&gt;Toffoli gates&lt;/a&gt;. So, we must use ancilla qubits. For &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; controls we use &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; ancilla qubits.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the following proposal correct?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1&gt;proposition&lt;/h1&gt;&#xA;&lt;p&gt;So, for &lt;span class=&quot;math-container&quot;&gt;$K_{b_{2}}$&lt;/span&gt;, I control individually all the gates as follows, is this approximation correct?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ox5Wb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ox5Wb.png&quot; alt=&quot;K_{b_{2}}&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I control the &lt;span class=&quot;math-container&quot;&gt;$R_{y}$&lt;/span&gt;  gate? I could not find a Controlled rotation around Y-axis only for Z axis (crz).&lt;/p&gt;&#xA;&lt;h1&gt;qiskit&lt;/h1&gt;&#xA;&lt;p&gt;I would define for each gate of the above figure, the &amp;quot;compute-copy-uncompute&amp;quot; method &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def kb2(qw, q0, q1, anc):&#xA;    qw.ccx(q0[0], q0[1], anc[0])&#xA;    qw.cry(np.pi/2, anc[0], q1[0])&#xA;    qw.ccx(q0[0], q0[1], anc[0])&#xA;    qw.ccx(q0[0], q0[1], anc[0])&#xA;    qw.ccx(anc[0], q1[0], anc[1])&#xA;    qw.cry(np.pi/2, anc[1], q1[1])&#xA;    qw.ccx(anc[0], q1[0], anc[1])&#xA;    qw.ccx(q0[0], q0[1], anc[0])&#xA;    qw.ccx(q0[0], q0[1], anc[0])&#xA;    qw.ccx(anc[0], q1[0], anc[1])&#xA;    qw.ch(anc[1], q1[1])&#xA;    qw.ccx(anc[0], q1[0], anc[1])&#xA;    qw.ccx(q0[0], q0[1], anc[0])&#xA;    &#xA;    #... and so on&#xA;    &#xA;    return kb2&#xA;&#xA;q0 = QuantumRegister(3, 'q0')&#xA;q1 = QuantumRegister(3, 'q1')&#xA;anc = QuantumRegister(2, 'a')&#xA;&#xA;qwcirc = QuantumCircuit(q0, q1, anc)&#xA;&#xA;qwcirc.x(q0[1]) # for 0-control&#xA;kb2(qwcirc, q0, q1, anc)&#xA;qwcirc.x(q0[1]) #for 0-control&#xA;&#xA;# Matplotlib Drawing&#xA;qwcirc.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I think half of the Toffoli's gates may be avoided...but I really hope to start a conversation. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="7746" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-06-17T07:25:27.070" Title="Implementing a complex circuit for a Szegedy quantum walk in qiskit" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6473" PostTypeId="1" AcceptedAnswerId="6484" CreationDate="2019-06-16T10:10:34.703" Score="1" ViewCount="161" Body="&lt;p&gt;Let's say we got a CX with a Hadamard gate on the control gate and any state at the target gate, will the target necessarily become a superposition of two states?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best.&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="26" LastEditDate="2019-06-16T15:36:06.727" LastActivityDate="2019-06-18T18:57:10.430" Title="CX gate with Hadamard" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6474" PostTypeId="2" ParentId="6472" CreationDate="2019-06-16T13:18:57.440" Score="2" Body="&lt;p&gt;This is an interesting question here.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How do I implement the controlled-dagger operator &lt;span class=&quot;math-container&quot;&gt;$K^{\dagger}_{b_{2}}$&lt;/span&gt;, of operator &lt;span class=&quot;math-container&quot;&gt;$K_{b_2}$&lt;/span&gt;? Does qiskit provide dagger operators of the principal gates? I have a little insight &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3809/what-is-the-purpose-of-the-tdg-gate-in-qiskit&quot;&gt;here&lt;/a&gt;. Should I apply tdg to all gates in &lt;span class=&quot;math-container&quot;&gt;$K_{b_{2}}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The dagger operation is quite simple to implement and can be seen as a recursive operation.&lt;/p&gt;&#xA;&lt;p&gt;The only requirement is that the dagger of each gate in your gateset is also in your gateset. This means that if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a gate in your gateset (i.e. a &amp;quot;primitive&amp;quot; gate), then &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; should also be present in your gateset.&lt;/p&gt;&#xA;&lt;p&gt;If this requirement is checked (and it is checked for IBM gateset, which is the answer to your second question), then here is a pseudo-algorithm using Python syntax implementing a generic dagger operation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def dagger(quantum_gate):&#xA;    if quantum_gate in gateset:&#xA;        return quantum_gate.dagger() # just returning a gate from the gateset.&#xA;    # else, quantum_gate is a sequence of other quantum gates (primitive or not)&#xA;    daggerized_gate = []&#xA;    for gate in reversed(quantum_gate):&#xA;        daggerized_gate.append(dagger(quantum_gate)) # recursive call&#xA;    return daggerized_gate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This algorithm is fully-generic: it works for every gates, even for controlled ones, provided the requirement is checked.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For multiple-controlled qubits operations, I base the construction of the multiple-controlled gates in the Nielsen&amp;amp;Chuang book, as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate&quot;&gt;Toffoli gates&lt;/a&gt;. So, we must use ancilla qubits. For &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; controls we use &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; ancilla qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There are several algorithms that implement a generic &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-controlled (controlled by &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits) &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. As far as I know, there are 3 distinct classes:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The algorithms requiering &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; ancilla qubits as you mention. These algorithms have the best gate-count and circuit-depth complexity.&lt;/li&gt;&#xA;&lt;li&gt;The algorithms requiering only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; ancilla qubit, at the expense of a bigger gate-count and circuit-depth.&lt;/li&gt;&#xA;&lt;li&gt;Hybrid algorithms between the 2 previous classes: they need more than one ancilla qubit but less than &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; and also have a gate complexity between the 2 previous classes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I don't have links right now, but will edit as soon as possible to provide you links to papers describing algorithms in the 3 previous classes.&lt;/p&gt;&#xA;&lt;p&gt;Note: if someone has access to some papers, please edit my answer if possible or leave the link in comments.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is the following proposal correct?&lt;/p&gt;&#xA;&lt;p&gt;So, for &lt;span class=&quot;math-container&quot;&gt;$K_{b_{2}}$&lt;/span&gt;, I control individually all the gates as follows, is this approximation correct?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ox5Wb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ox5Wb.png&quot; alt=&quot;K_{b_{2}}&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I control the &lt;span class=&quot;math-container&quot;&gt;$R_{y}$&lt;/span&gt;  gate? I could not find a Controlled rotation around Y-axis only for Z axis (crz).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is not an approximation: it is 100% correct. Controlling a composed-quantum gate is equivalent to controlling all the gates composing it (may be used recursively).&lt;/p&gt;&#xA;&lt;p&gt;About the implementation of the &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gate, you can implement it with the circuit given &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2144/1386&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sdiGz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sdiGz.png&quot; alt=&quot;Implementation of the controlled-Ry gate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For multiply-controlled &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates, you can apply this definition recursively.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;A quick observation&lt;/strong&gt;: you can remove the 3rd control from the last 2 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates. If the first 2 controls are verified, the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate will be applied only once to the last qubit, independently of the value of third control-qubit.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-06-17T07:25:27.070" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6475" PostTypeId="1" AcceptedAnswerId="6485" CreationDate="2019-06-16T15:53:32.987" Score="6" ViewCount="69" Body="&lt;p&gt;I have seen &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1999/why-can-the-discrete-fourier-transform-be-implemented-efficiently-as-a-quantum-c&quot;&gt;Why can the Discrete Fourier Transform be implemented efficiently as a quantum circuit?&lt;/a&gt;. This is not a duplicate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am familiar with the decomposition of the QFT from Nielsen&amp;amp;Chuang and Preskill's notes, and it requires to be able to perform n-different control phase gates.&#xA;If we only allow the smallest control-phase only we can still implement all the other ones as powers but we now need to use it exponentially many times. It seems that the speedup of the quantum fourier transform is based on allowing a particularly nice (albeit reasonable) gate set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I miss anything? Is there a way to decompose that circuit efficiently into a standard gate set (e.g. CNOT, H, P, and Paulis)?&lt;/p&gt;&#xA;" OwnerUserId="7775" LastEditorUserId="7775" LastEditDate="2019-06-23T11:46:28.710" LastActivityDate="2019-06-23T11:46:28.710" Title="Is the quantum Fourier transform efficient if only one control-phase is allowed in the gate set" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6476" PostTypeId="1" CreationDate="2019-06-16T16:47:01.167" Score="2" ViewCount="41" Body="&lt;p&gt;Based on the article given by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0506113&quot; rel=&quot;nofollow noreferrer&quot;&gt;J. L. Ball, I. Fuentes-Schuller, and F. P. Schuller, Phys. Lett. A 359, 550 (2006)&lt;/a&gt;&#xA;had used the following expression of von-Neumann entropy&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;S = - \operatorname { Tr } \left( \varrho  \log _ { 2 } \varrho \right) = \log _ { 2 } \left( \frac { \left| \gamma _ { B }  \right| ^ { \left( 2 \left| \gamma _ { B }  \right| ^ { 2 } \right) / \left( \left| \gamma _ { B }  \right| ^ { 2 } - 1 \right) } } { 1 - \left| \gamma _ { B } \right| ^ { 2 } } \right)&#xA;\end{equation}&lt;/span&gt;&#xA;where,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;| \gamma | ^ { 2 } \equiv \left| \beta _ { k } / \alpha _ { k } \right| ^ { 2 }&#xA;\end{equation}&lt;/span&gt;&#xA;provided with,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\varrho = | \overline { 0 } _ { - k } \overline { 0 } _ { k } \rangle \left\langle \overline { 0 } _ { k } \overline { 0 } _ { - k } |\right.&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}{\label{eq34}}&#xA;| \overline { 0 } \rangle = \sum _ { n = 0 } ^ { \infty } c _ { n } | n _ { k } n _ { - k } \rangle&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;c _ { 0 } = \sqrt { 1 - \left| \frac { \beta _ { k } } { \alpha _ { k } } \right| ^ { 2 } }&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;c _ { n } = \left( \frac { \beta _ { k } ^ { * } } { \alpha _ { k } ^ { * } } \right) ^ { n } c _ { 0 }&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to substitute by these expressions but without success. I appreciate your answers.&lt;/p&gt;&#xA;" OwnerUserId="5823" LastEditorUserId="10480" LastEditDate="2021-03-20T06:09:57.793" LastActivityDate="2021-03-20T06:09:57.793" Title="How to prove the following bosonic entanglement expression?" Tags="&lt;entanglement&gt;&lt;information-theory&gt;&lt;entropy&gt;&lt;entanglement-witness&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6477" PostTypeId="1" AcceptedAnswerId="6478" CreationDate="2019-06-16T17:06:39.953" Score="3" ViewCount="548" Body="&lt;p&gt;I want to implement amplitude amplification using Q#. I have the operation &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&#xA; that prepares my initial state and I need to compute &lt;span class=&quot;math-container&quot;&gt;$ A^{-1} $&lt;/span&gt; to implement the algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to do that in Q# (a keyword or operation)?&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="26" LastEditDate="2019-06-16T17:11:06.637" LastActivityDate="2019-06-16T17:44:58.090" Title="How to compute the inverse of an operation in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6478" PostTypeId="2" ParentId="6477" CreationDate="2019-06-16T17:33:59.133" Score="5" Body="&lt;p&gt;As given in the &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/techniques/operations-and-functions?view=qsharp-preview&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt;, if your operation is unitary, you can add the statement &lt;code&gt;adjoint auto;&lt;/code&gt; within the operation after the body block. This will generate the adjoint (which is the inverse for unitary).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, to use the inverse call &lt;code&gt;Adjoint A(parameters)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-06-16T17:33:59.133" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6479" PostTypeId="2" ParentId="6477" CreationDate="2019-06-16T17:44:58.090" Score="5" Body="&lt;p&gt;In the case that your operation can be represented by a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (this is typically the case if your operation doesn't use any measurements), you can indicate that by adding &lt;code&gt;is Adj&lt;/code&gt; to your operation's signature, letting the Q# compiler know that your operation is &lt;em&gt;adjointable&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Math as Math;&#xA;&#xA;/// # Summary&#xA;/// Prepares a qubit in a state representing a classical probability&#xA;/// distribution {p, 1 - p}.&#xA;/// # Description&#xA;/// Given a qubit in the |0⟩, prepares √p |0⟩ + √(1 - p) |1⟩&#xA;/// for a given probability p.&#xA;operation PrepareDistribution(probability : Double, target : Qubit) : Unit&#xA;is Adj {&#xA;    let rotationAngle = 2.0 * Math.ArcCos(Math.Sqrt(1.0 - probability));&#xA;    Ry(rotationAngle, target);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then call &lt;code&gt;Adjoint PrepareDistribution&lt;/code&gt; to &quot;undo&quot; the &lt;code&gt;PrepareDistribution&lt;/code&gt; operation. The &lt;code&gt;Adjoint&lt;/code&gt; keyword is an example of a Q# &lt;em&gt;functor&lt;/em&gt;, and tells Q# that you want the inverse operation. In this case, the Q# compiler will apply &lt;code&gt;Ry(-rotationAngle, target)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/quantum/language/type-model#functors&quot; rel=&quot;noreferrer&quot;&gt;Functors&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp?a_aid=learn-qc-granade&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Learn Quantum Computing with Python and Q#&lt;/em&gt;&lt;/a&gt; (chapter 6 covers the example above, future chapters will talk more about functors)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2019-06-16T17:44:58.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6480" PostTypeId="2" ParentId="6399" CreationDate="2019-06-16T18:01:53.627" Score="1" Body="&lt;p&gt;On question 2: the Wikipedia page should have included the SWAP gates as the last step. This is corroborated by the following statement (a few lines) under your picture on the Wikipedia page:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;With this notation, the action of the quantum Fourier transform can be expressed in a compact manner:&lt;span class=&quot;math-container&quot;&gt;$$QFT|x_1x_2\dots x_n⟩=\frac{1}{\sqrt{N}}(|0⟩+e^{2\pi i[0.x_n]}|1⟩)\otimes(|0⟩+e^{2\pi i[0.x_{n-1}x_n]}|1⟩)\otimes\dots\otimes(|0⟩+e^{2\pi i[0.x_1x_2\dots x_n]}|1⟩) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7460" LastActivityDate="2019-06-16T18:01:53.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6481" PostTypeId="1" CreationDate="2019-06-16T19:13:00.923" Score="1" ViewCount="49" Body="&lt;p&gt;I have recently been studying quantum computing specially the cryptographic aspects of it. The books I followed is Nielsen and Chuang, and a book named Quantum Computing Explained by David McMohan. The chapter that got me really interested in quantum computing was the superdense coding one. I was just curious to know if there are some projects or problems related to these topics which one can start doing. Can somebody give useful links for these topics?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-06-17T06:05:42.233" LastActivityDate="2019-06-17T06:05:42.233" Title="Superdense coding projects" Tags="&lt;resource-request&gt;&lt;superdense-coding&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6482" PostTypeId="2" ParentId="6473" CreationDate="2019-06-16T19:57:07.333" Score="1" Body="&lt;p&gt;If I am properly understanding what you are asking, then no. If for the control, we start with &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and apply a Hadamard to it, then we end with our control in an even mixture of &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; and therefore 50% of the time the CX gate will act like an X gate, and 50% of the time the CX gate will act like the Identity. The key now is looking for target states that act the same way under application of the X gate as application of the Identity. These states are the eigenstates of the X gate, so &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt;$&lt;/span&gt;. If the target input is in either the &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt;$&lt;/span&gt; state, then the target after the CX gate will NOT be in a superposition of two states.&lt;/p&gt;&#xA;" OwnerUserId="7764" LastEditorUserId="23" LastEditDate="2019-06-18T18:57:10.430" LastActivityDate="2019-06-18T18:57:10.430" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6483" PostTypeId="1" CreationDate="2019-06-16T20:48:30.177" Score="2" ViewCount="312" Body="&lt;p&gt;Does anyone know where I can find working Slack invite links to any of IBM's Slack pages? The Slack links on &lt;a href=&quot;https://quantum-computing.ibm.com/support&quot; rel=&quot;nofollow noreferrer&quot;&gt;this support page&lt;/a&gt; are all broken. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="7764" LastEditorUserId="26" LastEditDate="2019-06-17T05:55:58.100" LastActivityDate="2019-06-17T09:48:13.900" Title="IBM Slack links broken" Tags="&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6484" PostTypeId="2" ParentId="6473" CreationDate="2019-06-17T04:23:18.900" Score="1" Body="&lt;p&gt;Assuming your control is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to begin with. Then after application of Hadamard, the control is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|0\rangle + |1\rangle}{\sqrt 2}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now using this as control and applying &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the target, say &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|0\rangle|0\rangle + |1\rangle |1\rangle}{\sqrt 2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the system is entangled and is in a superposition of the states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Because it is entangled, it does not make sense to separately talk about the target state and ask if it is in superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure out the target, you will notice it is in a &lt;em&gt;classical mixture&lt;/em&gt; (not a quantum superposition) of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; represented as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}|0\rangle\langle0| + \frac{1}{2}|1\rangle\langle1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And looking at the outcome, you will see a basis state (I assume this is what you mean by simple state): &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so yes, on measuring you will see a simple state.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;A similar thing happens for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Any state that is not an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; will lead to some sort of entanglement as shown above. However, like @John Garmon said, if you use an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, say &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, on applying &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; the states becomes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|0\rangle|-\rangle - |1\rangle|-\rangle}{\sqrt 2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{|0\rangle - |1\rangle}{\sqrt 2} |-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the target state is not entangled, and is a 'simple' state with respect to the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle, |-\rangle$&lt;/span&gt; basis.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="2832" LastEditDate="2019-06-17T04:30:09.743" LastActivityDate="2019-06-17T04:30:09.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6485" PostTypeId="2" ParentId="6475" CreationDate="2019-06-17T06:47:52.500" Score="3" Body="&lt;p&gt;Talking about efficiency here isn't exactly a fair question: as you change n, the number of qubits in the Fourier transfer, you're changing the gate that you're talking about using (because the smallest phase will be something like controlled-&lt;span class=&quot;math-container&quot;&gt;$Z(\pi/2^n)$&lt;/span&gt;). After all, if I can do controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; when I have two qubits, why would I suddenly lose the ability to do controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; (and only be able to do controlled-&lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z}$&lt;/span&gt;) when I have 3 qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use a fixed gate set rather than changing it with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, then whichever phase you happen to use is only a finite overhead to convert back into the standard controlled-phase, and so the whole circuit remains efficient.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-17T06:47:52.500" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6486" PostTypeId="2" ParentId="6467" CreationDate="2019-06-17T06:56:19.657" Score="4" Body="&lt;p&gt;This is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Sylvester%27s_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Sylvester's Criterion&lt;/a&gt;. There's plenty of information available once you have the name. The linked wikipedia article contains a proof.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Strictly, Sylvester's Criterion requires that &lt;span class=&quot;math-container&quot;&gt;$W_2,W_3,W_4&amp;gt; 0$&lt;/span&gt; for the state to be positive under the partial transpose. However, for a density matrix, &lt;span class=&quot;math-container&quot;&gt;$W_2$&lt;/span&gt; is always positive semi-definite. This is because you could certainly define a density matrix of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cccc}&#xA;\rho_{00,00} &amp;amp; \rho_{01,00} &amp;amp; 0 &amp;amp; 0 \\&#xA;\rho_{00,10} &amp;amp; \rho_{01,01} &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;up to some rescaling. This has the same determinant &lt;span class=&quot;math-container&quot;&gt;$W_2$&lt;/span&gt; but is separable,&#xA; and hence unaffected by the partial transpose.&#xA;Hence, non-positivity is determined by looking at a violation caused by &lt;span class=&quot;math-container&quot;&gt;$W_3$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$W_4$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with a query in the comments that it is not immediately obvious that it is relevant for detecting negativity (I will continue to think about it...). If it &lt;em&gt;is&lt;/em&gt; a problem, we should be able to come up with a counter-example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method is easily extended to any smallest eigenvalue. Simply reduce the matrix by &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; times the appropriately sized identity matrix, shifting the min eigenvalue from &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;  to 0.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-06-17T12:00:23.963" LastActivityDate="2019-06-17T12:00:23.963" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6487" PostTypeId="2" ParentId="6483" CreationDate="2019-06-17T09:48:13.900" Score="3" Body="&lt;p&gt;There is a link on the &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit website&lt;/a&gt; to the public &lt;a href=&quot;https://qiskit.slack.com/join/shared_invite/enQtNjQ5OTc5ODM1ODYyLTBlMWY1ZGJiYmZkNjliZTY4MTViNTQ3NzI2ZmU2MzQxZjlhZDZlYTAzZTNlMDU0ZjVmNzEyMzY3OGE1Y2UyNjk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Slack&lt;/a&gt;. Here you can find channels for talking the various elements of Qiskit and also the IBM Q Experience.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-06-17T09:48:13.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6488" PostTypeId="1" AcceptedAnswerId="6490" CreationDate="2019-06-17T09:57:41.773" Score="1" ViewCount="172" Body="&lt;p&gt;In  Chapter 6 of &quot;Quantum Computation and Quantum Information&quot; Textbook by Nielsen and Chuang, Box 6.1 gives a circuit example of Quantum Search Algorithm done on a two-bit sized search space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Quantum Search Algorithm consists of an initial Hadamard Transformation on the two-bit input(2 wires), followed by iterations of the Grover Algorithm which itself contains a conditional phase-shift circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase shift operation, lets call it &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, when written in matrix form is given by:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S= 2|00\rangle \langle 00|-I$$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$S|00\rangle=|00\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$S|x\rangle=-|x\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x \neq 00$&lt;/span&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The sequence of gate operation on the input qubits are as such:&lt;br&gt;&#xA;(1) Apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on both the 1st and 2nd bit.&lt;br&gt;&#xA;(2) Apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on the 1st bit.&lt;br&gt;&#xA;(3) Apply C-NOT gate on the 1st bit with the 2nd bit as the control bit.&lt;br&gt;&#xA;(4) Do (2).&lt;br&gt;&#xA;(5) Do (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to use &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; as the input state for the phase shift hoping to get back &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;.&lt;br&gt;&#xA;However I got -&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; after the phase shift if I work out the math for such a gate sequence. These are my steps:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(1) &lt;span class=&quot;math-container&quot;&gt;$X_2|0\rangle_2 \otimes X_1|0\rangle_1 =|1\rangle_2|1\rangle_1$&lt;/span&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(2) &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_2 \otimes H_1|1\rangle_1 = |1\rangle_2 \otimes (\frac{1}{\sqrt&#xA;{2}} |0\rangle_1 - \frac{1}{\sqrt{2}}|1\rangle_1)$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(3) &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_2 \otimes X_1(\frac{1}{\sqrt{2}} |0\rangle_1 - \frac{1}{\sqrt {2}}|1\rangle_1) =|1\rangle_2 \otimes (\frac{1}{\sqrt{2}} |1\rangle_1 - \frac{1}{\sqrt {2}}|0\rangle_1) $&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(4) &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_2 \otimes H_1(\frac{1}{\sqrt{2}} |1\rangle_1 - \frac{1}{\sqrt {2}}|0\rangle_1)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$= |1\rangle_2 \otimes \left[\frac{1}{\sqrt{2}} (\frac{1}{\sqrt{2}} |0\rangle_1 - \frac{1}{\sqrt {2}}|1\rangle_1) - \frac{1}{\sqrt {2}}(\frac{1}{\sqrt{2}} |0\rangle_1 + \frac{1}{\sqrt {2}}|1\rangle_1)\right] = |1\rangle_2\otimes -|1\rangle_1 $&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(5) &lt;span class=&quot;math-container&quot;&gt;$-X_2|1\rangle_2 \otimes X_1|1\rangle_1 =-|0\rangle_2|0\rangle_1$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone find out whats my mistake? &lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2019-06-17T12:48:47.937" Title="Construction of Phase Shift Operation used in Quantum Search" Tags="&lt;mathematics&gt;&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6489" PostTypeId="1" AcceptedAnswerId="6492" CreationDate="2019-06-17T10:06:49.780" Score="5" ViewCount="198" Body="&lt;p&gt;I'm going through &lt;a href=&quot;https://drive.google.com/file/d/0BwtGcZsDGRhCTi1VMll0TGVhOTFoWGxHR1FyN2ExSEVEOTd3/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;some slides&lt;/a&gt; on the PPT/NPT criteria along with &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0702225&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horodecki's paper&lt;/a&gt;, and I'm kind of stuck. Let's take this slide:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UAs84.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UAs84.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, &lt;em&gt;why&lt;/em&gt; can we write a bipartite density matrix as &lt;span class=&quot;math-container&quot;&gt;$\sum_{ijkl}\rho_{kl}^{ij}|i\rangle\langle j|\otimes |k\rangle\langle l|$&lt;/span&gt;? What states are the index labels &lt;span class=&quot;math-container&quot;&gt;$i, j, k, l$&lt;/span&gt; referring to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, Horodecki says on page 21 that if a &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is separable then the new matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}^{T_B}$&lt;/span&gt; with matrix elements can be defined in some &lt;strong&gt;product basis&lt;/strong&gt; as &lt;span class=&quot;math-container&quot;&gt;$\langle m|\langle \mu |\rho_{AB}^{T_B}|n\rangle|\nu\rangle = \langle m|\langle \nu|\rho_{AB}|n\rangle|\mu\rangle$&lt;/span&gt;. I don't quite understand where they're getting this form from. What are &lt;span class=&quot;math-container&quot;&gt;$|m\rangle, |n\rangle, |\mu\rangle, |\nu\rangle$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="10480" LastEditDate="2021-03-09T18:50:18.633" LastActivityDate="2021-03-09T18:50:18.633" Title="Understanding the classification of quantum states based on partial transposition: representations of the bipartite density matrix" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6490" PostTypeId="2" ParentId="6488" CreationDate="2019-06-17T12:43:28.490" Score="2" Body="&lt;p&gt;You're right! Maybe this answer is still helpful / interesting for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are several sources for the Grover algorithm and the phase shift. In Nielsen and Chuang, you'll find that the circuit does something different than what the authors actually say on the previous page. Nevertheless, that does not change the final result. I would like to clarify this a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before I start a big calculation, let's summarize what the Grover algorithm is all about. &#xA;In the Grover algorithm, two elements are important. This is the oracle on the one hand and the conditional phase shift on the other hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to reduce the mathematical calculations to the minimum. Suppose we are looking for an element of four elements. The searched element is &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with a equal superposition over all states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_0\rangle=\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle+|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The oracle negates the amplitude of the searched element. Important the oracle recognizes a solution for the search problem, so the oracle does the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_1\rangle=\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle-|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, the Hadamard transform is used, as can be seen quite well on the circuit shown in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_2\rangle=\frac{1}{2}(H|00\rangle+H|01\rangle+H|10\rangle-H|11\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\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 \\ -|00\rangle+|01\rangle+|10\rangle-|11\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle-|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the conditional phase shift is applied, which means:&#xA;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle\rightarrow|00\rangle, |x\rangle\rightarrow -|x\rangle$&lt;/span&gt; therefore:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_3\rangle=\frac{1}{2}(|00\rangle-|01\rangle-|10\rangle+|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard-Transformation is to apply:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H|\psi_3\rangle=\frac{1}{2}(H|00\rangle-H|01\rangle-H|10\rangle+H|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now results in a calculation, which is very similar to the previous one, I abbreviate the times something and write only the result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}(4|11\rangle)=|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure the register at this point you will see state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; with 100% probability!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But lets get back to the circuit that you have analyzed. The quantum circuit does the following: &lt;span class=&quot;math-container&quot;&gt;$|00\rangle \rightarrow -|00\rangle, |x\rangle \rightarrow |x\rangle$&lt;/span&gt;&#xA;Now I apply this rule to this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_2\rangle=\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle-|11\rangle)$$&lt;/span&gt;&#xA;I get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_3\rangle=\frac{1}{2}(-|00\rangle+|01\rangle+|10\rangle-|11\rangle)$$&lt;/span&gt;&#xA;Now the Hadamard transformation has to be executed again:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H|\psi_3\rangle=\frac{1}{2}(-H|00\rangle+H|01\rangle+H|10\rangle-H|11\rangle)$$&lt;/span&gt;&#xA;If one calculates this now, one gets the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}(-4|11\rangle)=-|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, this means that the difference between the regulations is really just another sign. However, this does not matter in the measurement, since only the magnitude square of the amplitude plays a role.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, this is a bit strange in Nielsen and Chuang. Since the circuit shown there actually implements the last rule. You have also recognized that correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in a nutshell: Whether this &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\rightarrow|0\rangle, |x\rangle\rightarrow-|x\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\rightarrow-|0\rangle, |x\rangle\rightarrow|x\rangle$&lt;/span&gt; (at the phase shift operator) here is used is &quot;no matter&quot;. The difference is only the sign. Granted, if you look at Nielsen and Chuang's first pages on the Grover algorithm, then the real implementation is a bit confusing to the reader. But you analyzed the circuit absolutely correctly.&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="4974" LastEditDate="2019-06-17T12:48:47.937" LastActivityDate="2019-06-17T12:48:47.937" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6491" PostTypeId="1" AcceptedAnswerId="6498" CreationDate="2019-06-17T14:32:27.537" Score="6" ViewCount="147" Body="&lt;p&gt;The pure states of a qudit inhabit the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{CP}(d-1)$&lt;/span&gt; manifold.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it true that the pure states of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits live on the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{CP}(2^n-1)$&lt;/span&gt; manifold?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the answer to the first question is yes, then how do the sets of measurements on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and an &lt;span class=&quot;math-container&quot;&gt;$d=2^n$&lt;/span&gt; qudit compare? Intuitively, I feel like the latter should be bigger due to the locality issues. However, if we stick to a particular bases, there seem to be a one-to-one correspondence.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2019-06-17T14:50:48.783" LastActivityDate="2019-06-19T21:35:58.220" Title="$n$ qubit vs. a $d=2^n$ qudit states and measurements" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6492" PostTypeId="2" ParentId="6489" CreationDate="2019-06-17T15:39:48.880" Score="5" Body="&lt;p&gt;For &lt;em&gt;any&lt;/em&gt; orthonormal basis that you pick, call it &lt;span class=&quot;math-container&quot;&gt;$|e_i\rangle$&lt;/span&gt;, you can write a matrix in terms of that basis as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_{i,j}\rho_{i,j}|e_i\rangle\langle e_j|.&#xA;$$&lt;/span&gt;&#xA;When you're talking about a bipartite system, a sensible basis is one based on product states, usually the tensor product between two single-system orthonormal bases. So, you might write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|e_i\rangle=|n\rangle|\nu\rangle,&#xA;$$&lt;/span&gt;&#xA;splitting the sum over &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; into two sums, over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\nu$&lt;/span&gt;. Hence, you can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_{n,\nu,m,\mu}\rho_{n,\nu,m,\mu}|n\rangle\langle m|\otimes|\nu\rangle\langle\mu|.&#xA;$$&lt;/span&gt;&#xA;It just happens that they've chosen to change where the different indices are put.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the partial transpose, that is simply the definition of the partial transpose. It may not seem so familiar, but recall with the transpose does,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle e_i|\rho|e_j\rangle=\langle e_j|\rho^T|e_i\rangle.&#xA;$$&lt;/span&gt;&#xA;All the partial transpose does is that it &lt;em&gt;only&lt;/em&gt; switches the left and right indices for the second subsystem, &lt;em&gt;not&lt;/em&gt; the first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, this definition of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle n,\nu|\rho|m,\mu\rangle=\langle n,\mu|\rho^{T_B}|m,\nu\rangle&#xA;$$&lt;/span&gt;&#xA;is a general definition. It's not about whether &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is separable or not. The point is that if it &lt;em&gt;is&lt;/em&gt; separable, then &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; is still a valid quantum state. On the other hand, if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; were not separable, there is no reason why &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; need be a valid quantum state. In particular, it could have negative eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="26" LastEditDate="2019-06-17T17:23:02.790" LastActivityDate="2019-06-17T17:23:02.790" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6493" PostTypeId="1" CreationDate="2019-06-17T18:01:36.700" Score="6" ViewCount="139" Body="&lt;p&gt;As discussed &lt;a href=&quot;https://crypto.stackexchange.com/questions/8687/&quot;&gt;in this question&lt;/a&gt;, the expected security of 1024-bit RSA is 80-bits:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57_part1_rev3_general.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;NIST SP 800-57&lt;/a&gt; §5.6.1 p.62–64 specifies a correspondence between RSA modulus size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and expected security strength &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; in bits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Strength  RSA modulus size&#xA;  80        1024&#xA; 112        2048&#xA; 128        3072&#xA; 192        7680&#xA; 256       15360&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://en.wikipedia.org/wiki/IBM_Q_System_One&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, we now have a 20-qubit quantum computer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;IBM Q System One is a 20-&lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubit&lt;/a&gt; computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; If we tried to use a 20-qubit computer, e.g. IBM Q System One, to calculate the &lt;span class=&quot;math-container&quot;&gt;$\sim {2}^{80}$&lt;/span&gt; keys in the 1024-bit RSA keyspace, how long would it take?&lt;/p&gt;&#xA;" OwnerUserId="7429" LastEditorUserId="55" LastEditDate="2020-07-26T18:12:20.063" LastActivityDate="2020-07-26T18:12:20.063" Title="Calculating power of a quantum computer --- RSA" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;&lt;cryptography&gt;&lt;shors-algorithm&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6494" PostTypeId="1" AcceptedAnswerId="6495" CreationDate="2019-06-18T07:25:47.033" Score="5" ViewCount="187" Body="&lt;p&gt;In the paper &quot;Compiling basic linear algebra subroutines for quantum computers&quot; &#xA;&lt;a href=&quot;https://arxiv.org/abs/1902.10394&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, they discuss (page 2 bottom right) using the HHL algorithm to multiply a vector by a matrix. However, after having read the HHL09 paper, what is being estimated is the state &lt;span class=&quot;math-container&quot;&gt;$|x \rangle =  A^{-1} |b \rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A |x \rangle = |b \rangle$&lt;/span&gt; for some Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; of dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and vectors &lt;span class=&quot;math-container&quot;&gt;$b, x$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; are known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to use the HHL algorithm to compute &lt;span class=&quot;math-container&quot;&gt;$A |b \rangle$&lt;/span&gt; knowing &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. For instance, running the algorithm in reverse seems not possible (?), because not all steps in the algorithm are unitary. &lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="55" LastEditDate="2019-06-18T14:33:28.490" LastActivityDate="2019-06-20T08:02:25.170" Title="Using the HHL algorithm to compute $A |b \rangle$ instead of $A^{-1} |b \rangle$" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6495" PostTypeId="2" ParentId="6494" CreationDate="2019-06-18T07:56:14.213" Score="4" Body="&lt;p&gt;Note: the graphics have been generated with the LaTeX code available &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4073/1386&quot;&gt;here&lt;/a&gt;. Credits to @Niel de Beaudrap.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Yes it is possible!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The HHL algorithm can be schematically depicted as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lOnFJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lOnFJ.png&quot; alt=&quot;HHL algorithm drawing&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's split down the parts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The first part aims at computing an approximation of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H = A$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is hermitian, else &lt;span class=&quot;math-container&quot;&gt;$H = \begin{pmatrix} 0 &amp;amp; A \\ A^\dagger &amp;amp; 0 \end{pmatrix}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The second part invert these eigenvalues &lt;strong&gt;and&lt;/strong&gt; adds a phase proportional to these eigenvalues in front of your state (see the original HHL09 paper for the exact expression).&lt;/li&gt;&#xA;&lt;li&gt;The third part uncompute the first part, leaving you with a state like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j=1}^{N}\beta_j \vert u_j \rangle \left( \sqrt{1 - \frac{C^2}{\lambda_j^2}} \vert 0 \rangle + \frac{C}{\lambda_j}\vert 1 \rangle \right).&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The measure project the resulting state. If the measure succeed (measured value is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), then this means that your state is now&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j=1}^{N}\beta_j \vert u_j \rangle \frac{C}{\lambda_j}\vert 1 \rangle = \left(\sum_{j=1}^{N}C\frac{\beta_j}{\lambda_j} \vert u_j \rangle \right) \vert 1 \rangle&#xA;$$&lt;/span&gt;&#xA;which is the solution of the linear system considered.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Everything apart being equal, if you do not invert the eigenvalues in step 2, you will end up with a state like &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j=1}^{N}\beta_j \vert u_j \rangle \left( \sqrt{1 - C^2\lambda_j^2} \vert 0 \rangle + C\lambda_j\vert 1 \rangle \right).&#xA;$$&lt;/span&gt;&#xA;for step 3 and a result like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(C\sum_{j=1}^{N}\beta_j\lambda_j \vert u_j \rangle \right) \vert 1 \rangle&#xA;$$&lt;/span&gt;&#xA;if your measurement succeeded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the state you are looking for: the result of the operation &lt;span class=&quot;math-container&quot;&gt;$A\times b$&lt;/span&gt;, scaled by &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; in order to be of unit-norm.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-06-18T07:56:14.213" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6496" PostTypeId="1" CreationDate="2019-06-18T09:22:35.527" Score="14" ViewCount="312" Body="&lt;p&gt;Is there a known formula or a scaling behaviour for how many two-qubit gates are required to construct a general N-qubit unitary?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suppose there are several cases to consider:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Exact representation of the gates&lt;/li&gt;&#xA;&lt;li&gt;Approximate decompositions to a given accuracy&lt;/li&gt;&#xA;&lt;li&gt;Any subclass of unitaries that have more efficient decompositions&lt;/li&gt;&#xA;&lt;li&gt;With vs without ancillary qubits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; As a starting point, I know an optimal decomposition of a general two-qubit gate (into CNOT and single-qubit) and I consider single-qubit operations as &quot;free&quot; (they can be absorbed into the two-qubit gates, and for practical implementations they have lower error rates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; In Nielsen and Chuang they say that there always exists an &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; unitary that requires n-1 2-qubit gates. Are n-1 gates sufficient for a general &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; unitary?&lt;/p&gt;&#xA;" OwnerUserId="6076" LastEditorUserId="55" LastEditDate="2019-09-07T14:30:55.743" LastActivityDate="2020-05-27T17:04:52.613" Title="How many two-qubit gates are required to implement a general N-qubit unitary?" Tags="&lt;circuit-construction&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6497" PostTypeId="1" CreationDate="2019-06-18T09:28:07.900" Score="4" ViewCount="89" Body="&lt;p&gt;I am currently writing a script to automate the creation of parity curves for a 2 qubit bell state and then calculate fidelity and proving entanglement from that (inspired by &lt;a href=&quot;https://arxiv.org/abs/1712.07080&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper). It was going really well. I am able to run simulations perfectly for states 00 and its complement state 10 (getting fidelity values on ibmqx4 of roughly 0.7). Although, it then starts to get weird running states 11 and its complement 01. Although I haven't run state 01 on the real machine yet, the simulation of it runs perfectly. State 11 however, doesn't. As far as I understand 11 and 01 should output similar results. Here's a sample of my 01 states results. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;10,471&#xA;11,40 &#xA;00,43&#xA;01,440&#xA;10,490&#xA;11,51&#xA;00,54&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As you can see, a variety of states come out, allowing me to calculate parity. Running exactly the same code with state 11 instead gives&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;10,471&#xA;01,498&#xA;10,526&#xA;01,528&#xA;10,496&#xA;01,514&#xA;10,510&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which, obviously looks a lot more like a generic bell state with no rotation. The code used to set up the circuit and rotation for simulation is shown below. The math for theta, lam and phi for states 00 and 10 are taken from the paper mentioned above (on the second column of text on page 2). Math for states 11 and 01 are not on the paper but was worked out by my supervisor.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Set range for rotation &#xA;phi_range = np.linspace(0, np.pi, 128)&#xA;&#xA;for phi_value in phi_range:&#xA;    # inside the loop because putting it outside breaks it and makes it run &#xA;    # really really slow&#xA;    qr = QuantumRegister(2, name='qr')&#xA;    cr = ClassicalRegister(2, name='cr')&#xA;    bell = QuantumCircuit(qr, cr, name='bell')&#xA;&#xA;    # Set the details of the rotation&#xA;    if startingState == '00' or startingState == '10':&#xA;        theta = np.pi/2&#xA;        lam = -phi_value - np.pi/2&#xA;&#xA;    elif startingState == '01' or startingState == '11':&#xA;        theta = phi_value&#xA;        lam = 0 - np.pi/2&#xA;    else:&#xA;        raise ValueError('Setting rotation problems')&#xA;&#xA;    phi = -lam&#xA;&#xA;    # initializing the starting state of the circuit (done separately to &#xA;    # above for clarity)&#xA;    if startingState == '01':&#xA;        bell.x(qr[1])&#xA;    elif startingState == '10':&#xA;        bell.x(qr[0])&#xA;    elif startingState == '11':&#xA;        bell.x(range(2))&#xA;&#xA;    # this is the bell state code itself&#xA;    bell.h(qr[0])&#xA;    bell.cx(qr[0], qr[1])&#xA;&#xA;    bell.barrier()&#xA;    bell.u3(theta, lam, phi, qr)&#xA;    bell.barrier()&#xA;&#xA;    bell.measure(qr[0], cr[0])&#xA;    bell.measure(qr[1], cr[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have checked that this creates the correct circuit several times over, and again, it works for all states except 11. Can anyone work out why?&lt;/p&gt;&#xA;" OwnerUserId="7788" LastEditorUserId="55" LastEditDate="2021-04-23T08:57:26.877" LastActivityDate="2021-04-23T08:57:26.877" Title="Bell State 11 not working for parity curve" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;bell-experiment&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6498" PostTypeId="2" ParentId="6491" CreationDate="2019-06-18T13:38:56.537" Score="5" Body="&lt;p&gt;Without additional assumptions or context, there is no fundamental difference between an &quot;&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional qudit&quot; and &quot;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits&quot;. Any &quot;qudit system&quot; over &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; modes for some integer &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; can be thought of as a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Equivalently, an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system is nothing but a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional qudit system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The difference is in the fact that if you talk of qubit systems, there is an implicit assumption that you are going to &quot;prefer&quot; operations that act on few qubits at the same time (the precise meaning of this will strongly depend on the context).&#xA;In other words, if you are studying an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system, you are likely to be going to use an operatorial basis for the space of operators that is built out of products of single-qubit operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you have a &quot;&lt;em&gt;four-dimensional qudit system&lt;/em&gt;&quot;. The &quot;computational basis&quot; for this system will usually be written as &lt;span class=&quot;math-container&quot;&gt;$\{\lvert 1\rangle,\lvert 2\rangle,\lvert 3\rangle,\lvert 4\rangle\}$&lt;/span&gt;.&#xA;Nonetheless, you can simply &quot;reinterpret&quot; these by writing them in binary notation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert 1\rangle\to\lvert00\rangle,&#xA;\quad\lvert 2\rangle\to\lvert01\rangle,&#xA;\quad\lvert 3\rangle\to\lvert10\rangle,&#xA;\quad\lvert 4\rangle\to\lvert11\rangle.$$&lt;/span&gt;&#xA;Then, an operation that only makes first and second modes interfere corresponds to a &quot;local operation on the second qubit&quot;, and similarly for the other possible operations.&#xA;In a situation in which these kinds of &quot;local&quot; operations are natural, it is then also natural to introduce the notion of entanglement, which needs a notion of &quot;partiteness&quot; to make sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly, note that if you think of the possible states as those of a single &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional qudit, there is no notion of entanglement, only of correlations.&#xA;On the other hand, if you reinterpret the states as those of a number of qubits, then you can meaningfully talk of entanglement between the different modes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it's worth nothing that for practical purposes there &lt;em&gt;is&lt;/em&gt; a significant difference between &quot;&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional qudit&quot; and &quot;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits&quot;. You &lt;em&gt;could&lt;/em&gt; describe a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; interacting physical systems (say, interacting atoms) as possible states of a single qudit, but that would result in a very awkward formalism that would obscure the physically interesting aspects of the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addressing now more directly the raised points:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it true that the pure states of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits live on the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{CP}(2^n−1)$&lt;/span&gt; manifold?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As of above, yes. At a purely abstract level there is absolutely no difference between the two things.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If the answer to the first question is yes, then how do the sets of measurements on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and an &lt;span class=&quot;math-container&quot;&gt;$d=2^n$&lt;/span&gt; qudit compare? Intuitively, I feel like the latter should be bigger due to the locality issues. However, if we stick to a particular bases, there seem to be a one-to-one correspondence.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, what measurements you are going to use fully depends on what you are trying to model. If you think of the system as comprised of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, it is likely (though not necessary) that you are going to consider local measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To talk of how &quot;big&quot; a set of measurements is, you should first specify what kind of measurements you are considering. If you stick to projective measurements, then the maximum number of measurement outcomes will be &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; in both cases, the difference will be in how the projectors are built. For the qudit system you might consider a set of projectors of the form &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_k\equiv\lvert k\rangle\!\langle k\rvert$&lt;/span&gt;, while for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits the projectors might be written as products of two-outcome projective measurements &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_\ell^\pm$&lt;/span&gt;, projecting on one of the two possible states of the &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt;-th qubit.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-06-19T21:35:58.220" LastActivityDate="2019-06-19T21:35:58.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6499" PostTypeId="1" AcceptedAnswerId="12975" CreationDate="2019-06-18T13:44:28.427" Score="5" ViewCount="90" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Definition of k-distillability&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;For a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H=H_A\otimes H_B$&lt;/span&gt; and for an integer &lt;span class=&quot;math-container&quot;&gt;$k\geq 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-distillable if there exists a (non-normalized) state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in H^{\otimes k}$&lt;/span&gt; of Schimdt-rank at most &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; such that,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi|\sigma^{\otimes k}|\psi\rangle &amp;lt; 0, \sigma = \Bbb I\otimes T(\rho).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is distillable if it is &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; for some integer &lt;span class=&quot;math-container&quot;&gt;$k\geq 1.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://drive.google.com/file/d/0BwtGcZsDGRhCTi1VMll0TGVhOTFoWGxHR1FyN2ExSEVEOTd3/view&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I get the mathematical condition but don't really understand the motivation for &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-distillability in general, or more specifically the condition &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\sigma^{\otimes k}|\psi\rangle &amp;lt; 0$&lt;/span&gt;. Could someone explain where this comes from?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-01-02T11:56:26.490" LastActivityDate="2021-01-03T09:17:11.053" Title="Motivation for the definition of k-distillability" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;state-distillation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6500" PostTypeId="1" CreationDate="2019-06-18T15:30:59.693" Score="3" ViewCount="53" Body="&lt;p&gt;&lt;sup&gt;This is a sequel to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6499/motivation-for-the-definition-of-k-distillability&quot;&gt;Motivation for the definition of k-distillability&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Geometrical interpretation from the definition of 1-distillability&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The eigenstate &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of the partially transposed &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-distillable states will have Schmidt rank at most 2, i.e.,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle\langle\psi|=\sum_i\lambda_i^2|ii\rangle\langle ii|, \textit{ where } \sum_i\lambda_i^2=1\tag{17}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The constraint &lt;span class=&quot;math-container&quot;&gt;$\sum_i\lambda_i^2=1$&lt;/span&gt; gives rise to a geometric structure in arbitrary &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; dimensions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://drive.google.com/file/d/0BwtGcZsDGRhCTi1VMll0TGVhOTFoWGxHR1FyN2ExSEVEOTd3/view&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the definition of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-distillability (cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6499/motivation-for-the-definition-of-k-distillability&quot;&gt;here&lt;/a&gt;) we were talking about bipartite density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt;. In what sense is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; an &amp;quot;eigenstate&amp;quot; of a partially transposed &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-distillable state? Is for &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-distillable &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;'s the (non-normalized) state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in H$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\sigma|\psi\rangle &amp;lt; 0$&lt;/span&gt; &lt;em&gt;necessarily&lt;/em&gt; an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;? Also, can we prove that &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\sigma|\psi\rangle &amp;lt; 0$&lt;/span&gt; for &lt;em&gt;any&lt;/em&gt; eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I do not see how the fact that &amp;quot;the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of the partially transposed &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-distillable states &lt;strong&gt;will have a Schmidt rank at most 2&lt;/strong&gt;&amp;quot; is encapsulated within the statement &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|=\sum_i\lambda_i^2|ii\rangle\langle ii|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\sum_i\lambda_i^2=1$&lt;/span&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;As far as I understand, the Schmidt decomposition of a pure state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; of a composite system AB, considering an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle$&lt;/span&gt; for system A and &lt;span class=&quot;math-container&quot;&gt;$|i_B\rangle$&lt;/span&gt; for system B, is &lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \sum_i \lambda_i|i_A\rangle|i_B\rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are non-negative real numbers satisfying &lt;span class=&quot;math-container&quot;&gt;$\sum_i\lambda_i^2=1$&lt;/span&gt; known as &lt;em&gt;Schmidt co-efficients&lt;/em&gt;. Now the number of &lt;em&gt;non-zero&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;'s in the Schmidt decomposition is called Schmidt rank or Schmidt number.  So I don't quite understand the geometric constraint they're talking about; if the Schmidt rank is &lt;em&gt;at most&lt;/em&gt; 2, then we'd be restricted to only two cases i.e. &lt;span class=&quot;math-container&quot;&gt;$\lambda_1^2=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1^2+\lambda_2^2 = 1$&lt;/span&gt;...which aren't so interesting. Am I missing something?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2021-04-23T08:57:08.643" LastActivityDate="2021-04-23T08:57:08.643" Title="Geometric interpretation of 1-distillability" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;state-distillation&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6501" PostTypeId="1" AcceptedAnswerId="6502" CreationDate="2019-06-18T16:57:12.613" Score="7" ViewCount="638" Body="&lt;p&gt;I'm trying to understand the three qubits bit-flip code. I use the book of Phillip Kaye &lt;em&gt;An introduction to quantum computing&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this book he introduce the three qubits bit-flip code with this circuit :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w4MXt.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w4MXt.png&quot; alt=&quot;Three qubits bit-flip code from Phillip Kaye&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, I saw in &lt;em&gt;Quantum Error Correction for Beginners&lt;/em&gt; (&lt;a href=&quot;https://arxiv.org/pdf/0905.2794.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;), that they introduce the three qubits bit-flip code with an another circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mbg8X.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mbg8X.jpg&quot; alt=&quot;Three qubits bit-flip code from *Quantum Error Correction for Beginners*&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I ask myself, why do we need two more ancilla qubits in the second algorithm ? What do we earn with that ? &lt;/p&gt;&#xA;" OwnerUserId="7762" LastActivityDate="2019-12-12T13:29:49.007" Title="2 ways to do the three qubits bit-flip code" Tags="&lt;error-correction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6502" PostTypeId="2" ParentId="6501" CreationDate="2019-06-18T18:52:55.857" Score="4" Body="&lt;p&gt;Both circuits start by turning &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a |0\rangle + b|1\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a |000\rangle + b|111\rangle$&lt;/span&gt;, copying the 0/1 information onto two additional qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, for any pair of qubits in this state, either both are in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, or both are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Any superposition must be expressed only in terms of states that satisfy this condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives us a way to check up on whether everything is okay. We make a measurement that checks whether the 0/1 states of two neighbouring qubits are the same or different. We want it to give us only this information and no more, to ensure that preserves superpositions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each ancilla in the second circuit is there to perform this exact measurement. The two cnots that act on the ancilla, as well as the measurement gate itself, are all part of the measurement. Th measurement outputs &lt;code&gt;0&lt;/code&gt; when two qubits can be expressed as a superposition or mixture of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. It outputs &lt;code&gt;1&lt;/code&gt; if they must be expressed with &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this information, we can see if errors happened, and try to guess what they were. A corresponding correction operator can then be performed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first circuit seems like it could probably correct a bit flip on the first qubit. I'm not really sure what it is designed for, though.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-06-19T09:07:40.220" LastActivityDate="2019-06-19T09:07:40.220" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6503" PostTypeId="1" AcceptedAnswerId="6514" CreationDate="2019-06-18T21:41:27.413" Score="3" ViewCount="75" Body="&lt;p&gt;I was trying to see what IBM would do under the hood with a CCNOT gate. Something appears to be erroneous with the run.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c8OQx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c8OQx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit above should produce state 11100 with 100% probability, as confirmed by the visualizer (and the basic definition of the CCNOT). However both the simulator and the actual backend (ibmqx4) give all 1024 shots as 00000. Something is definitely not working right here.&lt;/p&gt;&#xA;" OwnerUserId="7701" LastEditorUserId="26" LastEditDate="2019-06-19T06:31:49.363" LastActivityDate="2019-06-19T07:46:00.940" Title="Bug in IBM backend?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6505" PostTypeId="1" AcceptedAnswerId="6512" CreationDate="2019-06-18T23:52:12.427" Score="1" ViewCount="700" Body="&lt;p&gt;For a controlled Z gate &lt;span class=&quot;math-container&quot;&gt;$CZ_{1,2,3}$&lt;/span&gt; acting on 3 qubits, which of the following is correct? If it is the first one then what is the difference between that and a CZ gate acting on qubits 1 and 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I − |1⟩⟨1| \otimes I \otimes (Z − I)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I − |1⟩⟨1| \otimes |1⟩⟨1| \otimes (Z − I)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="26" LastEditDate="2019-06-19T06:26:09.713" LastActivityDate="2019-06-19T06:33:30.507" Title="Controlled Z gate acting on 3 qubits in matrix form" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6506" PostTypeId="2" ParentId="6505" CreationDate="2019-06-19T00:31:54.143" Score="1" Body="&lt;p&gt;What do you mean by &lt;span class=&quot;math-container&quot;&gt;$CZ_{1,2,3}$&lt;/span&gt;? You should specify which ones are control and which ones are being acted on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a (useful such as for graph states) coincidence that for &lt;span class=&quot;math-container&quot;&gt;$CZ_{1,2}$&lt;/span&gt; you get the same result by interpreting either as the control and the other as being acted on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;-1\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is invariant under the action of permuting the tensor factors. That is by conjugating by the following matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but that is not generally true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CU_{1,2}$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; qubit acting as control and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; being acted on by the unitary 2 by 2 matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in that case. In total this would be the 4 by 4 unitary matrix (again in usual basis)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;u_{00}&amp;amp;u_{01}\\&#xA;0&amp;amp;0&amp;amp;u_{10}&amp;amp;u_{11}\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily see that in this general case, it matters which is the control and which is acted on. It is not invariant under exchange of factors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the first thing you wrote is the result of interpreting the first as the control and acting on the third. The second thing you wrote means you have two controls. Both 1 and 2 are controls in that case. Again acting on the third.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-19T00:31:54.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6507" PostTypeId="2" ParentId="6505" CreationDate="2019-06-19T00:36:06.000" Score="3" Body="&lt;p&gt;Assuming the first qubit is the control, and then there are three target qubits, the &lt;span class=&quot;math-container&quot;&gt;$CZZZ$&lt;/span&gt; gate would be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle\langle0| \otimes I \otimes I \otimes I + |1\rangle\langle1| \otimes Z \otimes Z \otimes Z$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, the first term projects out the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state of the control qubit and applies the identity to the targets in that case, and the second projects out the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and applies &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to each of the targets in that case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a &lt;span class=&quot;math-container&quot;&gt;$CCZ$&lt;/span&gt; gate (doubly-controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;), that's a little bit more complicated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I \otimes I - |1\rangle\langle1| \otimes |1\rangle\langle1|) \otimes I + |1\rangle\langle1| \otimes |1\rangle\langle1| \otimes Z$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second term projects out the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state of the two controls and applies the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; in that state; the first term projects out the other state combinations and applies the identity in that case.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2019-06-19T00:36:06.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6509" PostTypeId="1" CreationDate="2019-06-19T03:37:48.603" Score="3" ViewCount="36" Body="&lt;p&gt;I am trying to write a simple circuit to understand the process of finding the set of parameters such that the cost function of that circuit in question is minimized. For that I understand one has to have a readout bit in order to calculate the cost function. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read on papers that through a control gate one can achieve this. My question is the following: do I have to have control gates as in between each step of the circuit (between the gates), or can I just apply the control gates at the end of circuit? Also: why is not advantageous to only use a readout bit instead of multiple readout bits? &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="26" LastEditDate="2019-06-19T06:27:47.797" LastActivityDate="2019-06-19T06:27:47.797" Title="Understanding CNOT gate for indirect measurement" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6510" PostTypeId="1" CreationDate="2019-06-19T06:05:36.930" Score="1" ViewCount="100" Body="&lt;p&gt;I am using state vectors and operator matrices to test out my knowledge in a Python program. How would I represent the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; in Python? I want to then perform several operations in a matrix form on it. I am pretty sure NumPy arrays don't allow for irrational numbers and &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; has a coefficient of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; so I am unsure of how to represent this. Should I use fractions? I am new to QC and Python so if anyone has any good suggestions please help out! Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="26" LastEditDate="2019-06-19T06:29:19.340" LastActivityDate="2019-06-19T16:47:09.373" Title="How to represent $|+\rangle$ in Python?" Tags="&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6511" PostTypeId="1" CreationDate="2019-06-19T06:30:41.697" Score="3" ViewCount="57" Body="&lt;p&gt;Can you please help me to find an answer to this question: I am using qutip for the study of quantum systems. suppose I have calculated the solution of the master equation using the &lt;code&gt;mcsolve&lt;/code&gt; function and let it be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output = mcsolve(H,psi0,tlist,c_op_list,exp_op_list,ntraj) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I want to plot the expectation value points on the Bloch sphere, I can use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b.add_points(output.expect[0], output.expect[1], output.expect[2]) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But how can I add the states on the Bloch sphere? I am sorry if there is anything wrong in the way I have asked the question because I am new to the programming.&lt;/p&gt;&#xA;" OwnerUserId="7502" LastEditorUserId="7502" LastEditDate="2019-06-19T08:59:18.390" LastActivityDate="2019-06-19T08:59:18.390" Title="How to add states on the Bloch sphere from a master equation?" Tags="&lt;programming&gt;&lt;bloch-sphere&gt;&lt;qutip&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6512" PostTypeId="2" ParentId="6505" CreationDate="2019-06-19T06:33:30.507" Score="0" Body="&lt;p&gt;The difficulty is that the wording describing what you want is unclear. What your two stated options do is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I − |1⟩⟨1| \otimes I \otimes (Z − I)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a standard controlled-phase gate acting between qubits 1 and 3, doing nothing to qubit 2.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I − |1⟩⟨1| \otimes |1⟩⟨1| \otimes (Z − I)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a controlled-controlled-phase gate acting on all three qubits, so it applies a -1 phase if all three are in the &lt;span class=&quot;math-container&quot;&gt;$1\rangle$&lt;/span&gt; and leaves them unchanged otherwise. The symmetry of the system is perhaps better represented by writing it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I − 2|1⟩⟨1| \otimes |1⟩⟨1| \otimes |1⟩⟨1|.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-19T06:33:30.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6513" PostTypeId="1" CreationDate="2019-06-19T07:34:04.277" Score="4" ViewCount="89" Body="&lt;p&gt;The working of a quantum oracle is still not completely clear to me and I have a few questions: As I understand it, an oracle is a unitary quantum gate and must somehow differentiate between the eigenstates of the quantum register (the current state of which is a superposition of its eigenstates which are composites of the eigenstates of the cubits that make up the register) so that the amplitudes of some eigenstates can be increased or decreased. The differentiating criterion is given by some function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is mostly given to be two-valued.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question is: what is the domain of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;? Is this just the set of eigenstates of the quantum register? If so, then for the quantum algorithm to work, all data must somehow be in the register state. This encoding of external data (the haystack) into the states of the quantum register would seem to be a major challenge. How can this be done?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is it possible that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; somehow calls a classical function... but how, when?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is said that in e.g. Grover's algorithm the function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is called just once. But what does this mean if it somehow has to filter all the &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; eigenstates.&lt;/p&gt;&#xA;" OwnerUserId="7626" LastEditorUserId="26" LastEditDate="2019-06-20T06:44:52.363" LastActivityDate="2019-06-26T09:01:29.937" Title="Does an oracle use only the eigenstates of the quantum register?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6514" PostTypeId="2" ParentId="6503" CreationDate="2019-06-19T07:46:00.940" Score="2" Body="&lt;p&gt;I think you forgot to measure your quantum registers. The backends and the actual simulators always return the results read from the classical registers. Even if the simulator could return the amplitudes &lt;sup&gt;1&lt;/sup&gt;, the real backends cannot as we can't read the whole statevector. I guess this behaviour has been fixed in order to have a consistency between real hardware and simulators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Short solution&lt;/strong&gt;: add measurement gates at the end of your circuit.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; It depends on the simulation algorithm used. &lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-06-19T07:46:00.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6515" PostTypeId="2" ParentId="6452" CreationDate="2019-06-19T09:25:46.447" Score="1" Body="&lt;p&gt;Quite simply, it was broken but now it's fixed!&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-19T09:25:46.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6516" PostTypeId="1" AcceptedAnswerId="6517" CreationDate="2019-06-19T11:36:12.070" Score="3" ViewCount="96" Body="&lt;p&gt;What are the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits of the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$a\lvert 00\rangle+b\lvert11\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they &lt;span class=&quot;math-container&quot;&gt;$a'\vert0\rangle+b'\vert1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c'\vert0\rangle+d'\vert1\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are they measured, and what would be the outcome on each qubit?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="55" LastEditDate="2019-06-20T14:05:51.180" LastActivityDate="2019-06-20T14:05:51.180" Title="What are the two qubits in the state $a\lvert 00\rangle+b\lvert11\rangle$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6517" PostTypeId="2" ParentId="6516" CreationDate="2019-06-19T12:59:48.330" Score="3" Body="&lt;p&gt;You can't associate some pure states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; to the subsystems of the 2-qubit system in the entangled state (&lt;span class=&quot;math-container&quot;&gt;$a\vert 00\rangle+b\vert11\rangle, a\ne 0, b \ne 0$&lt;/span&gt; in our case). This is the definition of entanglement. You can verify that there is no vectors &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|x\rangle \otimes |y\rangle = a\vert 0\rangle \otimes |0\rangle+b\vert1\rangle \otimes |1\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we can associate mixed states to the subsystems of this entangled state. Mixed state is a probability distribution over pure states. Both mixed states in this case coincide and equal to &lt;span class=&quot;math-container&quot;&gt;$\{ |0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|b|^2\}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general method of calculating (mixed) state of a subsystem is via partial trace of density matrix. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our case &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{tr}_1((a|00\rangle + b|11\rangle)(\bar{a}\langle 00| + \bar{b}\langle11|)) = &#xA;|a^2|\cdot |0\rangle\langle0| + |b^2| \cdot |1\rangle\langle1|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the density matrix of the second qubit is &lt;span class=&quot;math-container&quot;&gt;$|a^2|\cdot |0\rangle\langle0| + |b^2| \cdot |1\rangle\langle1|$&lt;/span&gt;.&lt;br&gt;&#xA;Similarly for the 1st qubit. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-06-19T12:59:48.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6518" PostTypeId="2" ParentId="6510" CreationDate="2019-06-19T15:11:38.250" Score="1" Body="&lt;p&gt;You could either do a numerical approximation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1/math.sqrt(2)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but that would get evaluated to a floating point approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do a symbolic expression that is left unevaluated&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;1/sympy.sqrt(2)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symbolic results like this can be symbolically simplified with usual rules of mathematics without resorting to calculations with their floating point approximations. This addresses issues of the usual funny things that happen with numerical artifacts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you could do &lt;code&gt;sympy.sqrt(2)**2&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-19T15:11:38.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6519" PostTypeId="1" AcceptedAnswerId="8409" CreationDate="2019-06-19T16:42:58.393" Score="7" ViewCount="505" Body="&lt;p&gt;I understand the mathematical construction of the Choi-Jamiolkowski isomorphism aka channel-state duality. It all makes sense formally, yet I still struggle to grasp its physical (or quantum-informational) meaning. Does the isomorphism between quantum states and quantum channels in any sense establish some kind of connection relating the constitution (state) of systems to evolution (channel) of other systems?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/486968/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7802" LastEditorUserId="55" LastEditDate="2021-04-23T08:56:52.277" LastActivityDate="2021-04-23T08:56:52.277" Title="Does the Choi-Jamiolkowski isomorphism really establish a connection between kinematics and dynamics?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6520" PostTypeId="2" ParentId="6510" CreationDate="2019-06-19T16:47:09.373" Score="2" Body="&lt;p&gt;Just use &lt;code&gt;[0.5**0.5, 0.5**0.5]&lt;/code&gt;, or similarly &lt;code&gt;np.array([np.sqrt(0.5), np.sqrt(0.5)], dtype=np.complex128)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, the representation will be approximate instead of exact. Mainly that means you need to use approximate comparison methods like &lt;code&gt;np.allclose&lt;/code&gt; instead of &lt;code&gt;==&lt;/code&gt;. This is significantly less of a hassle than dealing with exact analytic representations, which will take thousands or millions of times longer to compute while ultimately not being any more informative.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-06-19T16:47:09.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6521" PostTypeId="2" ParentId="6501" CreationDate="2019-06-19T22:04:37.460" Score="3" Body="&lt;p&gt;The second circuit doesn't have to perform a quantum CCNOT operation (which in practice decomposes into a dozen other operations) and doesn't have to leave the code space (allowing it to be applied iteratively).&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-06-19T22:04:37.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6522" PostTypeId="2" ParentId="6476" CreationDate="2019-06-19T23:16:27.683" Score="1" Body="&lt;p&gt;We have,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;S &amp;amp;= - \operatorname { Tr } \left( \varrho  \log _ { 2 } \varrho \right) = \log _ { 2 } \left( \frac { \left| \gamma _ { B }  \right| ^ { \left( 2 \left| \gamma _ { B }  \right| ^ { 2 } \right) / \left( \left| \gamma _ { B }  \right| ^ { 2 } - 1 \right) } } { 1 - \left| \gamma _ { B } \right| ^ { 2 } } \right) = \log _ { 2 } \left( \frac { \gamma   ^ { \gamma  / \gamma -1 } } { 1 - \gamma  } \right) \\&amp;amp;= -  \left(\frac{\gamma}{1-\gamma} \log _ { 2 }\gamma + \log_{2}(1-\gamma) \right)&#xA;\end{aligned} \label{a} \tag{1}&#xA;\end{equation}&lt;/span&gt;&#xA;where we shortened our expressions by, &lt;span class=&quot;math-container&quot;&gt;$\gamma = \gamma_B^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand we believe that,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;S &amp;amp;= - \operatorname { Tr } \left( \varrho  \log _ { 2 } \varrho \right) = - \sum_{i=0}^{\infty} c_n^2 \log(c_n^2) = \sum_{i=0}^{\infty} \gamma^n(1-\gamma) \log_2\left(\gamma^n(1-\gamma)\right) \\&amp;amp;= \sum_{i=0}^{\infty} \gamma^n(1-\gamma) \left( &#xA;\log_2\ (\gamma^n)+\log_2(1-\gamma )\right) \\&amp;amp;= (1-\gamma ) \sum_{i=0}^{\infty} \gamma^n \log_2\ (\gamma^n)+ (1-\gamma ) \log_2 (1-\gamma ) \sum_{i=0}^{\infty} \gamma^n &#xA;\end{aligned} \label{b} \tag{2}&#xA;\end{equation}&lt;/span&gt;&#xA;Now, those sequences have the following closed form providing that, &lt;span class=&quot;math-container&quot;&gt;$|\gamma|&amp;lt;1$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;\sum_{n=0}^\infty \gamma^n = \frac1{1-\gamma} \\&#xA;\text{and},\\&#xA;\sum_{n=0}^\infty \gamma^n\log \gamma^n &amp;amp;= \sum_{n=0}^\infty \gamma^n n \log \gamma=\sum_{n=0}^\infty \gamma \gamma^{n-1} n \log \gamma =\log \gamma\left(\gamma\sum_{n=0}^\infty \left(\gamma^n\right)'\right) \\&amp;amp;= \log \gamma\cdot \frac \gamma{(1-\gamma)^2}=\log \gamma^{\gamma/(1-\gamma)^2}&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;It follows that we can subsitute these results in eq.(\ref{b}) to obtain eq.(\ref{a}) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/3268064/is-this-sequence-defined-correctly#3268071&quot;&gt;For reference&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5823" LastActivityDate="2019-06-19T23:16:27.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6523" PostTypeId="1" AcceptedAnswerId="6528" CreationDate="2019-06-19T23:17:05.077" Score="5" ViewCount="91" Body="&lt;p&gt;In the paper  &quot;Compiling basic linear algebra subroutines for quantum computers&quot; &lt;a href=&quot;https://arxiv.org/pdf/1902.10394.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, the introduction seems to imply that the subroutines covered will touch on matrix addition and multiplication, but the subroutines in question concern the product of matrix exponentials, and the sum of exponentials (i.e for A, B Hermitian, &lt;span class=&quot;math-container&quot;&gt;$e^{i(A+B)t}$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can it be inferred that after these results are achieved that there is some way to get &lt;span class=&quot;math-container&quot;&gt;$(A+B)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$e^{i(A+B)t}$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="7481" LastActivityDate="2019-10-11T05:06:42.033" Title="The possibility of recovering the matrix $A+B$ from $e^{i(A+B)t}$ for Hermitian $A,B$" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6524" PostTypeId="1" CreationDate="2019-06-20T00:49:46.280" Score="3" ViewCount="38" Body="&lt;p&gt;The full user guide &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/001-The_IBM_Q_Experience/001-Introducing_the_IBM_Q_Experience.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; states &quot;If you find any bugs, please report them with our bug tracker, accessible via the little bug icon in the lower right-hand corner of each page.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cvohI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cvohI.png&quot; alt=&quot;Wheres the bug icon?&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I was unable to find this bug icon. The arrow seen in the screenshot only returns you to the top of the page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I found a link under &quot;Documentation and Support&quot; for bug reports. However, the link brought me to a page that told me &quot;This invite link is no longer active.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QfGwO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QfGwO.png&quot; alt=&quot;Documentation and Support&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9bgJ8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9bgJ8.png&quot; alt=&quot;Slack invite link expired&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To conclude, I am trying to report a typo on the 'Introduction to Quantum Circuits'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6ajQb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6ajQb.png&quot; alt=&quot;Typo Correction&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://study.com/academy/lesson/how-to-find-a-column-vector.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example 1&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sharetechnote.com/html/Handbook_EngMath_Matrix_InnerProduct.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Inner Product Error&lt;/a&gt; - This is the same as a dot product right?&lt;/p&gt;&#xA;" OwnerUserId="7806" LastActivityDate="2019-06-20T00:49:46.280" Title="Bug report bug report?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2019-06-20T09:48:41.540" ContentLicense="CC BY-SA 4.0" />
  <row Id="6525" PostTypeId="1" AcceptedAnswerId="6553" CreationDate="2019-06-20T03:02:14.337" Score="4" ViewCount="152" Body="&lt;p&gt;I'm reading &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0512104&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linear Optics Quantum Computation: an Overview&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On page 16 we're given a matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = \begin{pmatrix}1-\sqrt{2}&amp;amp;\frac{1}{\sqrt{\sqrt{2}}}&amp;amp;\sqrt{\frac{3}{\sqrt 2}-2}\\\frac{1}{\sqrt{\sqrt 2}}&amp;amp;\frac{1}{2}&amp;amp;\frac{1}{2}-\frac{1}{\sqrt 2}\\\sqrt{\frac{3}{\sqrt{2}}-2}&amp;amp;\frac{1}{2}-\frac{1}{\sqrt 2}&amp;amp;\sqrt 2 - \frac{1}{2}\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this exercise:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What transformation does this implement on the input state &lt;span class=&quot;math-container&quot;&gt;$(\alpha|0\rangle+\beta|1\rangle+\gamma|2\rangle)|10\rangle$&lt;/span&gt;? What is the transformation if we measure &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; in modes &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;? This will be important later!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know that I should write states using the creation operator and &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and then let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; act on creation operators. Yet this approach does not seem to get me anywhere. &lt;/p&gt;&#xA;" OwnerUserId="7805" LastEditorUserId="26" LastEditDate="2019-06-20T06:41:24.580" LastActivityDate="2019-06-22T00:48:55.713" Title="Non-linear sign shift gate" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6526" PostTypeId="1" CreationDate="2019-06-20T04:41:24.460" Score="1" ViewCount="80" Body="&lt;p&gt;I started this &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;book&lt;/a&gt; on quantum computing (Nielsen and Chuang). I have gone through the first chapter but I need to really understand the concepts; what should I do? Should I cover some background topics or move to some other book. By the way, I have done Bachelors in Computer Science; I never studied quantum before but I started this book so I can start research on quantum algorithms.&lt;/p&gt;&#xA;" OwnerDisplayName="user2479" LastEditorUserId="26" LastEditDate="2019-06-20T05:59:40.313" LastActivityDate="2019-06-20T06:18:21.740" Title="Getting started with quantum computing from a computer science perspective" Tags="&lt;resource-request&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2019-06-20T08:06:24.543" ContentLicense="CC BY-SA 4.0" />
  <row Id="6527" PostTypeId="1" AcceptedAnswerId="6536" CreationDate="2019-06-20T05:33:09.383" Score="2" ViewCount="106" Body="&lt;p&gt;It may look a silly question but anybody of you knows what's: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(|0\rangle+|1\rangle)\otimes(|0\rangle+|1\rangle)$$&lt;/span&gt; (x: Kronecker operator)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(|0\rangle+|1\rangle)*(|0\rangle+|1\rangle)$$&lt;/span&gt; (*: vector multiplication operator)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;yielding?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="5870" LastEditDate="2019-06-20T10:10:05.543" LastActivityDate="2019-06-22T13:27:51.213" Title="Kronecker product and multiplication operation on qubit states" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6528" PostTypeId="2" ParentId="6523" CreationDate="2019-06-20T06:08:29.477" Score="4" Body="&lt;p&gt;Yes, see for instance this stack exchange question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6494/using-the-hhl-algorithm-to-compute-a-b-rangle-instead-of-a-1-b-rangle&quot;&gt;Using the HHL algorithm to compute &lt;span class=&quot;math-container&quot;&gt;$A|b\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$A^{−1}|b\rangle$&lt;/span&gt;&#xA;&lt;/a&gt;.&#xA;It is discussed that if you have access to an exponential &lt;span class=&quot;math-container&quot;&gt;$e^{iX \otimes H\tau}$&lt;/span&gt;, then you can implement &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&#xA;To see this, note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iX\otimes H \tau} |0\rangle |\psi\rangle&#xA;= (\mathbb{I} + i\tau X \otimes H + O(\tau^2)) |0\rangle |\psi\rangle&#xA;= |0\rangle |\psi\rangle + i\tau |1\rangle H|\psi\rangle + O(\tau^2).&#xA;$$&lt;/span&gt;&#xA;Now measure the first register. If the outcome is 1, then we get the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle H|\psi\rangle + O(\tau)$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; sufficiently small this approximates &lt;span class=&quot;math-container&quot;&gt;$H|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in your case, rather than summing &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, you could sum &lt;span class=&quot;math-container&quot;&gt;$X \otimes A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X\otimes B$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; the Pauli X gate. Then you can use the exponential &lt;span class=&quot;math-container&quot;&gt;$e^{iX \otimes (A+B)t}$&lt;/span&gt; to implement &lt;span class=&quot;math-container&quot;&gt;$A+B$&lt;/span&gt; using the above approach.&lt;/p&gt;&#xA;" OwnerUserId="282" LastEditorUserId="26" LastEditDate="2019-10-11T05:06:42.033" LastActivityDate="2019-10-11T05:06:42.033" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="6529" PostTypeId="1" AcceptedAnswerId="6582" CreationDate="2019-06-20T06:13:22.737" Score="2" ViewCount="335" Body="&lt;p&gt;Does anybody know how to explain briefly how to realize qubits (initialization, states transition, measurements,..) with superconducting Josephson junctions, say DC-SQUIDS?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="26" LastEditDate="2019-06-23T14:42:31.783" LastActivityDate="2019-07-01T01:17:23.867" Title="Physical realization of qubits with superconducting Josephson junctions" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6530" PostTypeId="2" ParentId="6526" CreationDate="2019-06-20T06:18:21.740" Score="1" Body="&lt;p&gt;Apart from the resources mentioned in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/linked/6526&quot;&gt;Linked&lt;/a&gt; threads, I recently came across a textbook that's very much like an &amp;quot;undergraduate version&amp;quot; of Nielsen and Chuang, and should be helpful for you to get started.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.crcpress.com/Elements-of-Quantum-Computation-and-Quantum-Communication/Pathak/p/book/9781466517912&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elements of Quantum Computation and Quantum Communication - Anirban Pathak&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;h3&gt;Preface:&lt;/h3&gt;&#xA;&lt;p&gt;This introductory textbook is written primarily for &lt;strong&gt;undergraduate students of physics, mathematics, computer science and other related disciplines&lt;/strong&gt;. It is also expected to be valuable to teachers as well as to researchers working in other domains, who are interested in obtaining an understanding of quantum computation and quantum communication. I used to offer a course on quantum information theory from 2002-2006. Later I offered a few short courses in different summer schools and workshops. This book is prepared mainly from those lectures. There are many excellent textbooks&#xA;on quantum information theory. However, most of those books are either&#xA;too technical for beginners or they are not complete. This was one of my&#xA;reasons for writing this book. But more importantly, every teacher has&#xA;his/her own way to present the subject and teachers are usually biased on&#xA;that. I belong to that class of biased teachers and this book is an initiative to present the subject in my way. Another fact that played a very important role in the present initiative is that there are engineering students who hardly know anything about quantum mechanics and there are physics students who do not know what a Turing machine is. But students from both groups are equally interested in quantum computing and often they join&#xA;the same course. Keeping both kinds of students in mind, this book aims&#xA;to give a brief idea of quantum computation and quantum communication&#xA;in a self-contained manner. It does not demand any prior knowledge of&#xA;quantum mechanics or computer science.(...)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-06-20T06:18:21.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6531" PostTypeId="2" ParentId="6494" CreationDate="2019-06-20T06:53:40.170" Score="3" Body="&lt;p&gt;Let's assume that you have a Hermitian matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\left(\begin{array}{cc} 0 &amp;amp; A^\dagger \\ A &amp;amp; 0 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; be the state that we want to apply &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to, extended to work on the space that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; acts on. So, our aim is to implement &lt;span class=&quot;math-container&quot;&gt;$H|b\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; be the standard Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix. If we implement a unitary evolution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=e^{-i X\otimes H\delta t},&#xA;$$&lt;/span&gt;&#xA;then the action of this on an input state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|b\rangle$&lt;/span&gt; can be expressed through a Taylor expansion, assuming &lt;span class=&quot;math-container&quot;&gt;$\delta t\|H\|\ll 1$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|0\rangle|b\rangle=|0\rangle|b\rangle-i\delta t |1\rangle(H|b\rangle)-\frac{\delta t^2}{2}|0\rangle(H^2|b\rangle)+\ldots.&#xA;$$&lt;/span&gt;&#xA;So, if we measure the ancilla qubit in the standard basis, then with probability &lt;span class=&quot;math-container&quot;&gt;$\delta t^2\|H|b\rangle\|^2$&lt;/span&gt;, we find the ancilla to be in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and the other register is in the desired state &lt;span class=&quot;math-container&quot;&gt;$H|b\rangle$&lt;/span&gt;, up to an accuracy &lt;span class=&quot;math-container&quot;&gt;$O(\delta t^2)$&lt;/span&gt; (coming from the &lt;span class=&quot;math-container&quot;&gt;$O(\delta t^4)$&lt;/span&gt; term in the Taylor expansion). If you don't get the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; answer to your measurement, then to accuracy &lt;span class=&quot;math-container&quot;&gt;$O(\delta t^2)$&lt;/span&gt;, you've stil got the original state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|b\rangle$&lt;/span&gt;, so you can just repeat until success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By that simple method, the overall error is very bad - you have to repeat &lt;span class=&quot;math-container&quot;&gt;$O(1/\delta t^2)$&lt;/span&gt; times so that the overall error becomes &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt;. I'm sure this could be improved by replacing the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; with a cycle operation on a larger dimensional Hilbert space. However, note that this method is very similar to part of the HHL algorithm (where they do the controlled-rotation from the phase estimation register onto an ancilla) and, at least there, it is claimed that it can be improved using amplitude amplification. So I assume (without having looked at the details) that something similar is possible here.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-06-20T08:02:25.170" LastActivityDate="2019-06-20T08:02:25.170" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6533" PostTypeId="2" ParentId="6513" CreationDate="2019-06-20T07:26:39.840" Score="4" Body="&lt;p&gt;The domain of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is all bitstrings of certain length, which corresponds to eigenstates of the register. The exact meaning of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; might vary - it could be a set of boolean values, like in SAT problem, or a set of colors assigned to vertices, like in graph coloring problem, or integers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The oracle has to encode the condition you're searching for as a quantum circuit - and yes, this is a challenge indeed. It is worth checking out other questions on Grover on this site, since a lot of them will consider oracle implementations (here are two that look the closest to your question at a glance: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6325/grover-algorithm-for-a-database-search-where-is-the-quantum-advantage/&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4440/whats-an-example-of-building-a-circuit-u-f-that-implements-a-simple-function/&quot;&gt;2&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Speaking of a SAT problem specifically, since it was mentioned in the comments, the oracle has to encode the logical constraints on the boolean values that the variables can take based on the specific formula you're given. Each AND clause is expressed as a controlled X gate; each OR clause is expressed as a 0-controlled X gate, followed by an X gate on the target (De Morgan's laws), and so on.  You can find an example of implementing an oracle for an instance of SAT problem in &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/tree/master/SolveSATWithGrover&quot; rel=&quot;nofollow noreferrer&quot;&gt;my tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-06-20T07:26:39.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6534" PostTypeId="1" AcceptedAnswerId="6535" CreationDate="2019-06-20T08:19:10.600" Score="2" ViewCount="79" Body="&lt;p&gt;I understand that, projecting &lt;span class=&quot;math-container&quot;&gt;$\lvert 00\rangle$&lt;/span&gt; on the Bell states would produce &lt;span class=&quot;math-container&quot;&gt;$\lvert\Phi^+\rangle$&lt;/span&gt;. Because,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT(H\lvert0\rangle \otimes \lvert0\rangle) = \frac{1}{\sqrt{2}}(\lvert00\rangle + \lvert11)\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can get other Bell states from &lt;span class=&quot;math-container&quot;&gt;$\lvert 01\rangle, \lvert10\rangle, \lvert 11\rangle$&lt;/span&gt;. However, I am having trouble understanding what would happen if I do the same for &lt;span class=&quot;math-container&quot;&gt;$\lvert ++\rangle$&lt;/span&gt;. Like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT(H\lvert+\rangle \otimes \lvert+\rangle) = ?&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2019-06-21T06:42:56.597" Title="Projecting $\lvert ++ \rangle$ on Bell Basis" Tags="&lt;measurement&gt;&lt;bell-experiment&gt;&lt;projection-operator&gt;&lt;hadamard&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6535" PostTypeId="2" ParentId="6534" CreationDate="2019-06-20T08:32:29.763" Score="5" Body="&lt;p&gt;The Hadamard gate is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2} \left(|0\rangle \langle 0 | + |0\rangle\langle 1| + |1\rangle \langle 0| - |1\rangle \langle 1|\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}\left(|0\rangle  + |1\rangle \right)$&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can work out that &lt;span class=&quot;math-container&quot;&gt;$H(|+\rangle) = |0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(H|+\rangle \otimes |+\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= CNOT(|0\rangle \otimes |+\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= |0\rangle \otimes |+\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also check that &lt;span class=&quot;math-container&quot;&gt;$H^2 = I$&lt;/span&gt; or that the Hadamard gate is both Unitary and Hermitian. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$H = H^\dagger$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H^\dagger = H^{-1}$$&lt;/span&gt;&#xA;So, &lt;span class=&quot;math-container&quot;&gt;$H = H^{-1}$&lt;/span&gt;, the Hadamard gate is its own inverse. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;What you have done is not projection of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to get the state &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle$&lt;/span&gt;, but you just applied the unitary that takes the computational basis to the Bell basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said in the comments, true, if you measure a state in a basis, you will get one of the basis vectors as outcomes with different probabilities. To see that, express the state in hand in the measurement basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For ex:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle = \frac{1}{\sqrt 2} (|\phi^+\rangle + |\phi^-\rangle)$$&lt;/span&gt; so you will get &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle$&lt;/span&gt; with 50% probability and &lt;span class=&quot;math-container&quot;&gt;$|\phi^-\rangle$&lt;/span&gt; with 50% probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, on expressing &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt; in the Bell basis as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2}(|\phi^+\rangle + |\psi^+\rangle)$$&lt;/span&gt; you get each of those states with 50% probability on measuring.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="2832" LastEditDate="2019-06-20T15:20:54.413" LastActivityDate="2019-06-20T15:20:54.413" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6536" PostTypeId="2" ParentId="6527" CreationDate="2019-06-20T08:39:56.277" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker product&lt;/a&gt; of the vectors will lead to&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle=\begin{pmatrix}1\\0\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle=\begin{pmatrix}0\\1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)\otimes(|0\rangle+|1\rangle)=|00\rangle+|01\rangle+|10\rangle+|11\rangle=\begin{pmatrix}1\\0\end{pmatrix}\otimes\begin{pmatrix}1\\0\end{pmatrix}+\begin{pmatrix}1\\0\end{pmatrix}\otimes\begin{pmatrix}0\\1\end{pmatrix}+\begin{pmatrix}0\\1\end{pmatrix}\otimes\begin{pmatrix}1\\0\end{pmatrix}+\begin{pmatrix}0\\1\end{pmatrix}\otimes\begin{pmatrix}0\\1\end{pmatrix}=\begin{pmatrix}1\\0\\0\\0\end{pmatrix}+\begin{pmatrix}0\\1\\0\\0\end{pmatrix}+\begin{pmatrix}0\\0\\1\\0\end{pmatrix}+\begin{pmatrix}0\\0\\0\\1\end{pmatrix}=\begin{pmatrix}1\\1\\1\\1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;While the vector multiplication (which I assume that is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dot_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vector inner product&lt;/a&gt;) is&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)*(|0\rangle+|1\rangle)=(|0\rangle+|1\rangle)^\dagger(|0\rangle+|1\rangle)=\langle0|0\rangle+\langle0|1\rangle+\langle1|0\rangle+\langle1|1\rangle=1+0+0+1=2.$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="2371" LastEditDate="2019-06-22T13:27:51.213" LastActivityDate="2019-06-22T13:27:51.213" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="6538" PostTypeId="1" AcceptedAnswerId="6545" CreationDate="2019-06-20T18:04:05.163" Score="4" ViewCount="269" Body="&lt;p&gt;I'm aware that this is basically a duplicate question, but I don't have any rep in this community so I can't comment on it, and I don't think I should &quot;answer&quot; that question with my own question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2255/no-cloning-theorem-and-distinguishing-between-two-non-orthogonal-quantum-states&quot;&gt;No-cloning theorem and distinguishing between two non-orthogonal quantum states&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Exercise 1.2: Explain how a device which, upon input of one of two non-orthogonal quantum states &lt;span class=&quot;math-container&quot;&gt;$|ψ⟩$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|ϕ⟩$&lt;/span&gt; correctly identified the state, could be used to build a device which cloned the states &lt;span class=&quot;math-container&quot;&gt;$|ψ⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|ϕ⟩$&lt;/span&gt;, in violation of the no-cloning theorem. Conversely, explain how a device for cloning could be used to distinguish non-orthogonal quantum states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The first part isn't quite trivial to me. Since the device can distinguish both &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; with certainty, they are effectively orthogonal states, and thus can be cloned when the device measures in the &quot;basis&quot; &lt;span class=&quot;math-container&quot;&gt;$\{|\psi\rangle,|\phi\rangle\}$&lt;/span&gt;. Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="7816" LastEditorUserId="23" LastEditDate="2019-06-21T06:53:03.843" LastActivityDate="2019-06-21T06:56:34.867" Title="Cloning quantum states with a device that distinguishes between two non-orthogonal quantum states" Tags="&lt;quantum-state&gt;&lt;no-cloning-theorem&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6539" PostTypeId="2" ParentId="6538" CreationDate="2019-06-20T19:48:48.977" Score="2" Body="&lt;p&gt;No, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; are non-orthogonal by assumption, they can't be &lt;em&gt;effectively&lt;/em&gt; (whatever this means) orthogonal. The device just gives us the answer &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; (you can think it returns label and destroys the input state), so we can prepare &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; separately (or many copies of it). It is that trivial. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-06-20T19:48:48.977" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6540" PostTypeId="1" CreationDate="2019-06-20T19:53:08.043" Score="4" ViewCount="611" Body="&lt;p&gt;Could and how quantum computing improve chess engines? Will it be able to think much faster and better than a classical chess computer? &lt;br/&gt;&#xA;Will a quantum computing chess engine be drastically better than current chess engines? &lt;br/&gt;&#xA;&lt;br/&gt;&#xA;I believe my question is different than &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5823/will-quantum-computers-be-able-to-solve-the-game-of-chess&quot;&gt;Will quantum computers be able to solve the game of chess?&lt;/a&gt; &lt;br/&gt;&#xA;From what I managed to understand, that question is talking about if a quantum computer will be able to tell who has 100% to win a game from a given position, and what are the moves to do that(?).&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;I might be wrong, but I think that quantum computer can search much faster than classical computer, &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{n})$&lt;/span&gt;, and quantum copmuter has advatanges against classical computer.&#xA;&lt;br/&gt;&#xA;Also, from the little I know, some chess engines have kind of tree of many games and a big database they use while playing against other chess engines. When some chess engines use kind of networking which has many computers running games and &quot;learning&quot; to make their Elo better to play against other chess engines.&#xA;&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;I'm more interested about if it could be possible to use a quantum computer's speed and its advantages against classical computer, to make a stronger chess engine with higher Elo than current chess engines. Could a quantum computer think better than a classical computer to win it in chess? &lt;br/&gt;&#xA;I am not interested about the question with a given chess position, who can force a checkmate.&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;I tried to make as clarified as I could, since I don't have knowledge with quantum computing and how to apply it in different ways.&lt;/p&gt;&#xA;" OwnerUserId="7818" LastEditorUserId="26" LastEditDate="2019-10-11T05:09:45.270" LastActivityDate="2020-09-05T09:23:03.583" Title="Could quantum computing improve chess engines?" Tags="&lt;algorithm&gt;&lt;speedup&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6542" PostTypeId="1" CreationDate="2019-06-21T02:28:55.267" Score="1" ViewCount="195" Body="&lt;p&gt;I have started using IBM's Q Experience and I am trying to obtain an access token in order to communicate with the REST API. I understand that I can use my API token to obtain authorization by sending an html post request to the API but I keep getting an error. Attached is  the code I am using as well as the output. I apologize if this is a simple syntax related issue by I can't seem to get around it. Thank you for your help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import requests&#xA;import pprint&#xA;&#xA;api_token = 'api token goes here'&#xA;&#xA;r = requests.post(url = 'https://quantumexperience.ng.bluemix.net/api/users/loginWithToken'&#xA;                  params = {'apiToken': '{}'.format(api_token)})&#xA;&#xA;r.json()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'error': {'status': 400, 'message': 'Generic error', 'code': 'GENERIC_ERROR'}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7820" LastEditorUserId="26" LastEditDate="2019-06-21T08:08:00.070" LastActivityDate="2019-06-21T08:08:00.070" Title="Having trouble communicating with the IBM Q Experience REST API" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6544" PostTypeId="2" ParentId="6534" CreationDate="2019-06-21T06:42:56.597" Score="3" Body="&lt;p&gt;The four Bell states are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Phi_{\pm}\rangle=(|00\rangle\pm|11\rangle)/\sqrt{2}\qquad |\Psi_{\pm}\rangle=(|01\rangle\pm|10\rangle)/\sqrt{2}.&#xA;$$&lt;/span&gt;&#xA;So, let's consider what happens then we try and measure in the Bell basis, i.e. project onto one of these four states. If we started with the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, then we can write it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle=\frac{1}{\sqrt{2}}(|\Phi_+\rangle+|\Phi_-\rangle).&#xA;$$&lt;/span&gt;&#xA;Hence, we would get the answers &lt;span class=&quot;math-container&quot;&gt;$|\Phi_{\pm}\rangle$&lt;/span&gt; each with probability &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine, instead, that your initial state is &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt;. You can write this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|++\rangle=\frac{1}{\sqrt{2}}(|\Phi_+\rangle+|\Psi_+\rangle),&#xA;$$&lt;/span&gt;&#xA;so when you measure it in the Bell basis, you get the answers &lt;span class=&quot;math-container&quot;&gt;$|\Phi_+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\Psi_+\rangle$&lt;/span&gt; with 50:50 probability.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-21T06:42:56.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6545" PostTypeId="2" ParentId="6538" CreationDate="2019-06-21T06:56:34.867" Score="2" Body="&lt;p&gt;Forget that you know that non-orthogonal states cannot be distinguished, as this is what you're trying to prove. It's like a proof by contradiction. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is talking about a &lt;em&gt;hypothetical&lt;/em&gt; device that could, if it existed, distinguish between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Assume it exists, and prove that it gives you cloning (I know which state I had because I could distinguish them, so I can make arbitrarily many copies). But that's in contradiction with no-cloning, so the hypothetical device must be impossible.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-21T06:56:34.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6546" PostTypeId="1" AcceptedAnswerId="6547" CreationDate="2019-06-21T10:50:02.903" Score="3" ViewCount="280" Body="&lt;p&gt;I have been reading a &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9602019.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; about perfect error correction codes, and when the circuit is described, the author uses some negative controlled gates, that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The gate is applied if the control is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and trivial operation is applied when the control is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consequently, it is the reverse operation that a regular controlled gate. The author represents such gates with an empty circle instead of the filled dot used for regular controlled gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how could one implement one of such negative controlled gates by using a standard controlled gate, that is, add some other gates to the controlled unitary so that its operation is reversed.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="491" LastEditDate="2020-07-17T23:23:34.183" LastActivityDate="2020-07-17T23:23:34.183" Title="How do you implement a negative controlled gate using the regular controlled gate?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6547" PostTypeId="2" ParentId="6546" CreationDate="2019-06-21T11:39:45.517" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I am wondering how could one implement one of such negative controlled gates by using a standard controlled gate, that is, add some other gates to the controlled unitary so that its operation is reversed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is addressed in Nielsen and Chuang's section 4.3 (~ p. 184, 10th edition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically,&lt;span class=&quot;math-container&quot;&gt;$$c_{|0\rangle}U_{AB} \equiv (X_A\otimes I_B)c_{|1\rangle}U_{AB}(X_A\otimes I_B),$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate does a basis transformation &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A\to|1\rangle_A$&lt;/span&gt; for you such that you can apply the required unitary and then transform back to the original basis using another &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RAsVv.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RAsVv.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the controlled gates we have been considering, conditional dynamics on the target&#xA;  qubit occurs if the control bits are set to &lt;em&gt;one&lt;/em&gt;. Of course, there is nothing special about one, and it is often useful to consider dynamics which occur conditional on the control bit being set to zero. For instance, suppose we wish to implement a two qubit gate in which the second (‘target’) qubit is flipped, conditional on the first (‘control’) qubit being set to zero. In Figure 4.11 we introduce a circuit notation for this gate, together with an equivalent circuit in terms of the gates we have already introduced. Generically we shall use the open circle notation to indicate conditioning on the qubit being set to zero, while a closed circle indicates conditioning on the qubit being set to one.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-06-21T11:50:27.640" LastActivityDate="2019-06-21T11:50:27.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6548" PostTypeId="1" CreationDate="2019-06-21T12:04:58.427" Score="0" ViewCount="70" Body="&lt;p&gt;A pure quantum state is a state which can be described by a single ket vector. A mixed quantum state is a statistical ensemble of pure states. When carriers transport from source to drain in a Field Effect Transistor, which state could describe it?&#xA;A pure state or a mixed state? &lt;/p&gt;&#xA;" OwnerUserId="7825" LastEditorUserId="7825" LastEditDate="2019-06-21T13:07:24.050" LastActivityDate="2019-06-21T13:07:24.050" Title="Which state describes carrier transport through channel? A mixed state or a pure state?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6549" PostTypeId="1" CreationDate="2019-06-21T13:29:25.797" Score="-4" ViewCount="158" Body="&lt;p&gt;Suppose you have a large collection of N numbered copper coins. However, one of them is nickel but looks exactly the same as the rest. How do you find out which number the nickel coin has?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Classical computer&lt;/strong&gt;: Try each of them in turn to see if it is magnetic, this takes on average N/2 tries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum computer&lt;/strong&gt;: Put them all in a bag together with a magnet on a string, shake a bit and pull out the magnet plus the nickel coin. If it doesn't work the first time try again. This takes only one or a few tries. The magnet interacts with all the coins at once.&lt;/p&gt;&#xA;" OwnerUserId="7626" LastEditorUserId="26" LastEditDate="2019-06-21T13:31:07.783" LastActivityDate="2019-10-11T05:12:42.193" Title="What about this metaphor for quantum computing?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2019-06-25T22:27:01.613" ContentLicense="CC BY-SA 4.0" />
  <row Id="6550" PostTypeId="2" ParentId="6208" CreationDate="2019-06-21T14:13:15.747" Score="3" Body="&lt;p&gt;Let me augment the discussion by adding some insight into the derivation of the estimate provided. This will give you a good understanding of when the result is an approximation and when it is precise. After the algorithm has run, we are left with the following state on the first register:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^{n}}\sum_{x=0}^{2^n - 1} \sum_{k=0}^{2^n - 1}e^{-\frac{2\pi i k}{2^n} \left ( i_{0} - 2^n \theta \right )}  |x\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$i_{0}$&lt;/span&gt; is the integer closest to &lt;span class=&quot;math-container&quot;&gt;$2^{n}\omega$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$i_{0} &amp;lt; 2^{n}\omega$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$2^{n}\omega = i_{0}-2^{n}\delta$&lt;/span&gt;). When measurement occurs, the axioms of quantum mechanics give you that the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$i_{0}$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{prob}(i_{0})=\frac{1}{2^{2n}} \left | \sum_{k=0}^{2^n-1} e^{2 \pi i \delta k} \right |^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that at the point you are asked to evaluate a finite geometrical series. We have the formula:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{k=0}^{n-1} ar^k= a \left(\frac{1-r^{n}}{1-r}\right),  (1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;valid only for &lt;span class=&quot;math-container&quot;&gt;$r\neq 1$&lt;/span&gt; . This is a key point in the whole discussion as for &lt;span class=&quot;math-container&quot;&gt;$\delta = 0$&lt;/span&gt; we simply end up adding &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{n}}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$2^{n}$&lt;/span&gt; times and so we get &lt;span class=&quot;math-container&quot;&gt;$\frac{(2^{n})^{2}}{2^{2n}}=1$&lt;/span&gt; (we do not use the formula). So in the case of &lt;span class=&quot;math-container&quot;&gt;$2^{n}\omega$&lt;/span&gt; being an integer, we have concluded that the probability of getting the exact value of the phase is 100%. If  &lt;span class=&quot;math-container&quot;&gt;$\delta\neq 0$&lt;/span&gt; we use the formula (1) and get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{prob}(i_{0})=\frac{1}{2^{2n}} \left | \frac{1- {e^{2 \pi i 2^n \delta}}}{1-{e^{2 \pi i \delta}}} \right |^2.(2)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now notice that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$4\left | \sin(x)) \right |^{2}=4\left | \frac{e^{-ix}-e^{ix}}{2i}\right |^{2}=\left | e^{-ix}-e^{ix} \right |^{2}=\left | 1-e^{2ix} \right |^{2}.(3)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using identity (3) we may rewrite (2) as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{prob}(i_{0})=\frac{1}{2^{2n}} \frac{\sin^{2}(\pi \delta 2^{n})}{\sin^{2}(\pi \delta)},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the definition of &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; we get (for &lt;span class=&quot;math-container&quot;&gt;$\delta \neq 0$&lt;/span&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{prob}(i_{0})=\frac{1}{2^{2n}} \frac{\sin^{2}(\pi (2^{n}\omega -i_{0}))}{\sin^{2}(\pi(\omega -\frac{i_{0}}{2^{n}}))},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is exactly the result you were looking for. With a bit more effort it is possible to show that in the case where &lt;span class=&quot;math-container&quot;&gt;$\delta \neq 0$&lt;/span&gt; the following holds&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{prob}(i_{0})\geqslant \frac{4}{\pi ^{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we may conclude with stating that for some special phases (such that &lt;span class=&quot;math-container&quot;&gt;$2^{n}\omega$&lt;/span&gt; is an integer) we can extract the exact value of the phase. However, in the general case where &lt;span class=&quot;math-container&quot;&gt;$2^{n}\omega$&lt;/span&gt; is not an integer, we get an approximation of the phase with a probability of at least &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{\pi ^{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7826" LastEditorUserId="7826" LastEditDate="2019-11-28T19:25:16.027" LastActivityDate="2019-11-28T19:25:16.027" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6552" PostTypeId="1" CreationDate="2019-06-22T00:14:56.193" Score="4" ViewCount="30" Body="&lt;p&gt;I am wondering if anyone in here has heard/read is involved in quantum codes applied to simulate plasmas? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that PPNL is working on that but have not actually seen/found any of their papers on the subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="434" LastEditDate="2019-06-24T17:29:51.497" LastActivityDate="2019-06-24T17:29:51.497" Title="Quantum Codes and Plasma Codes for Simulation Applications" Tags="&lt;simulation&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6553" PostTypeId="2" ParentId="6525" CreationDate="2019-06-22T00:48:55.713" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;I know that I should write states using the creation operator and &lt;span class=&quot;math-container&quot;&gt;$|00⟩$&lt;/span&gt;, and then let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; act on creation operators.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is exactly right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing the state in terms of creation operators gives &lt;span class=&quot;math-container&quot;&gt;$$(\alpha|0\rangle+\beta|1\rangle+\gamma|2\rangle)|10\rangle = \left(\alpha + \beta a_1^\dagger + \gamma a_1^\dagger a_1^\dagger\right)a_2^\dagger\left|000\right&amp;gt;.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know from page 10 that the unitary transformation matrix acts on the creation operators as &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a_l^\dagger\left|0\right&amp;gt;\rightarrow\sum_mU_{ml}a_m^\dagger\left|0\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That is, overall it gives &lt;span class=&quot;math-container&quot;&gt;$$\left(\alpha + \beta \sum_mU_{m1}a_m^\dagger + \gamma \sum_{m, l}U_{m1}U_{l1}a_m^\dagger a_l^\dagger\right)\sum_jU_{j2}a_j^\dagger\left|000\right&amp;gt;.$$&lt;/span&gt; The reason that this looks like a mess is simply because it is (at this point anyway) - 3 photons in 3 modes is considerably more complicated than 3 photons in 1 mode or 1 photon in 3 modes, so naively, the only option is to persevere and see what comes out the other end. Making use of the Reck decomposition (equation 15, which looks like &lt;span class=&quot;math-container&quot;&gt;$U = D^\dagger T^\dagger_{2, 1} T^\dagger_{3, 1} T^\dagger_{3, 2}$&lt;/span&gt; for 3 modes, as on page 15) can sometimes be used to make things easier to handle, but in this case, it doesn't particularly look like it would help. What might make it easier is splitting it into chunks, then taking the sum: So, taking the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; component, then the &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; component, then the &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; component and summing them together. The occasional term simplifies down a bit but overall, this (part) seems to be one of those questions where the purpose is to give the reader practise in doing these sorts of calculations, so actually writing it down here in this answer won't help that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for the latter part of the question, there is a bit of simplification that can be done. This lies in realising that the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is symmetric: &lt;span class=&quot;math-container&quot;&gt;$U^\dagger = U$&lt;/span&gt; and so, going 'backwards' is the same evolution as going 'forwards'. The above considers writing the output in terms of the input &lt;span class=&quot;math-container&quot;&gt;$\left(a_l^\dagger\left|0\right&amp;gt;\rightarrow\sum_mU_{ml}a_m^\dagger\left|0\right&amp;gt;\right)$&lt;/span&gt;. However, the input can also be written in terms of the output and we know both the input and two modes of the output, so we're only looking at outputs of the form &lt;span class=&quot;math-container&quot;&gt;$$(\alpha'|0\rangle+\beta'|1\rangle+\gamma'|2\rangle)|10\rangle = \left(\alpha' + \beta' a_1^\dagger + \gamma' a_1^\dagger a_1^\dagger\right)a_2^\dagger\left|000\right&amp;gt;.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, taking the &lt;span class=&quot;math-container&quot;&gt;$\alpha'$&lt;/span&gt; component gives that, the only single photon term that survives is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\alpha\left|010\right&amp;gt;$&lt;/span&gt; as the only possible way to go from an input of &lt;span class=&quot;math-container&quot;&gt;$a_2^\dagger$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$a_2^\dagger$&lt;/span&gt; is by the operation &lt;span class=&quot;math-container&quot;&gt;$U_{22}$&lt;/span&gt;. Similarly, the &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; term gives the only two photon term that survives as &lt;span class=&quot;math-container&quot;&gt;$$\left(U_{11}U_{22} + U_{12}U_{21}\right)\beta\left|110\right&amp;gt; = \left(\frac{1}{2}\left(1-\sqrt{2}\right) + \frac{1}{\sqrt{2}}\right)\beta\left|110\right&amp;gt; = \frac{1}{2}\beta\left|110\right&amp;gt;,$$&lt;/span&gt; corresponding to the possible transformations of &lt;span class=&quot;math-container&quot;&gt;$a_1^\dagger a_2^\dagger \rightarrow a_1^\dagger a_2^\dagger$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$\gamma'$&lt;/span&gt; term then gives &lt;span class=&quot;math-container&quot;&gt;$$\left(\left(1-\sqrt{2}\right)^2\frac{1}{2} + 2\left(1-\sqrt{2}\right)\frac{1}{\sqrt{2}}\right)\gamma\left|210\right&amp;gt; = -\frac{1}{2}\gamma\left|210\right&amp;gt;,$$&lt;/span&gt; giving the overall output if we measure &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt; in modes 2 and 3 as &lt;span class=&quot;math-container&quot;&gt;$$(\alpha|0\rangle+\beta|1\rangle-\gamma|2\rangle)|10\rangle,$$&lt;/span&gt; where the factor of 1/2 shows that the probability of obtaining this state is 1/4 and is then factored out for normalisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the former part of the question is fully calculated, then doing the latter part is a relatively simple matter of looking for the terms of the correct form, however, the above shows an easier way of performing this latter part without having to do the former and transforms a brute force 'calculate all the terms and look for the ones you want' into a much smaller combinatorics-type problem of 'what are the ways that this input can be transformed into this output?' and multiplying and summing the relevant matrix elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method is essentially an adaption of that used in e.g. Ralph's &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0112088v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Linear Optical CNOT Gate in the Coincidence Basis&lt;/a&gt;, which will hopefully offer more insight into what's happening.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-06-22T00:48:55.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6554" PostTypeId="1" AcceptedAnswerId="6563" CreationDate="2019-06-22T01:38:10.197" Score="4" ViewCount="380" Body="&lt;p&gt;I am looking for guidance in more generally how to developed n-bit gates in Cirq. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on a QNN paper and I need to develop a n-controlled gate to be able to measure the cost function of the circuit.  &lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2019-10-26T02:29:14.890" Title="N-Toffoli on Cirq" Tags="&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6555" PostTypeId="1" CreationDate="2019-06-22T02:12:34.413" Score="1" ViewCount="337" Body="&lt;p&gt;The current processors are limited by the speed of the electrons but quantum processors take advantage of the properties of subatomic particles. But the question is how to compare the processing power of these two processors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;How to compare the processing power of CPU and QPU to solve and calculate mathematical and cryptographical equations?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like an &quot;Intel Core i9 CPU&quot; vs &quot;IBM Q 5 Tenerife QPU&quot;?&lt;/p&gt;&#xA;" OwnerUserId="7429" LastEditorUserId="26" LastEditDate="2019-06-23T07:02:20.550" LastActivityDate="2019-06-23T07:02:20.550" Title="Comparing CPU to QPU In terms of processing power" Tags="&lt;classical-computing&gt;&lt;speedup&gt;&lt;ibm&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6556" PostTypeId="1" CreationDate="2019-06-22T02:45:00.907" Score="3" ViewCount="72" Body="&lt;p&gt;Does anybody of you know what are the two states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; of a qubit in a DC-SQUID (2 Josephson junctions in a loop)?&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="26" LastEditDate="2019-06-23T07:01:04.203" LastActivityDate="2019-06-23T07:01:04.203" Title="States of a qubit in a DC-SQUID" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6558" PostTypeId="1" CreationDate="2019-06-22T05:55:04.983" Score="3" ViewCount="111" Body="&lt;p&gt;I implemented the following circuit: &lt;a href=&quot;https://i.stack.imgur.com/SHa96.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SHa96.png&quot; alt=&quot;irc&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in measuring the expected energy of the circuit. I am using Cirq. I am wondering what are the next steps. Sorry if the question seems very basic, but I am not sure how to interpret the measurement gate to extract this energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cps2k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cps2k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2019-06-22T06:57:50.727" LastActivityDate="2019-06-22T06:57:50.727" Title="Measuring the expected energy of a quantum circuit" Tags="&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="6560" PostTypeId="1" CreationDate="2019-06-22T08:54:16.170" Score="2" ViewCount="81" Body="&lt;p&gt;I am an Electrical and Computer Engineering student from Egypt and was considering venturing into the realm of Quantum Computing. I really want to take part in the next info revolution and I have taken some online courses towards that end, but that is not enough, I believe. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking of having that education in Germany, because it is affordable, very excellent and close to home, or French Canada or The USA. However when I search for Masters or PhDs in the field I only get sham sites and I get that many universities have Quantum Computing interest and research groups but I can't find degrees or subspecialization or even individual courses that can aid in bridging the gap of knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So does anybody know any universities that offer such degrees or courses? &lt;/p&gt;&#xA;" OwnerUserId="7834" LastEditorUserId="2879" LastEditDate="2019-06-22T15:31:34.163" LastActivityDate="2019-06-22T15:31:34.163" Title="Are there any Quantum Computing degrees in Germany, Quebec, or The USA?" Tags="&lt;resource-request&gt;" AnswerCount="0" CommentCount="10" FavoriteCount="1" ClosedDate="2019-06-25T22:27:20.387" ContentLicense="CC BY-SA 4.0" />
  <row Id="6561" PostTypeId="1" CreationDate="2019-06-22T12:49:54.607" Score="3" ViewCount="242" Body="&lt;p&gt;What is the goal of Hamiltonian simulation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it going to simulate a quantum system on a classical computer or quantum computer or none of them?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the relationship between a quantum algorithm and the Hamiltonian simulation?&lt;/p&gt;&#xA;" OwnerUserId="7835" LastActivityDate="2019-09-12T14:25:49.743" Title="Hamiltonian simulation in quantum computation" Tags="&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6562" PostTypeId="1" AcceptedAnswerId="6578" CreationDate="2019-06-23T02:24:04.223" Score="4" ViewCount="272" Body="&lt;p&gt;First of all: thanks for reading again. I appreciate the feedback I have gotten from this community the past weeks as I started to feel ready to ask questions about quantum computing topics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying implement the following paper: &lt;a href=&quot;https://arxiv.org/abs/1509.04279&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1509.04279&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the ansatz represented the quantum circuit shown in Cirq's tutorial. I even tried to apply Farhi and Neven's method of gradient descent to see whether that could help find the minimal expected energy of the system. (It did not). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have gone back to the original paper by McClean et al. and they discuss about &lt;a href=&quot;https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;NM Algorithm&lt;/a&gt; to find the minimal energy of the system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is my question: how can it be possible to apply NM when you cannot have a given order a-priori. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here it is what I think I understand:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The objective function is the energy measurement operation from&#xA;Cirq's tutorial.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$x_1,...., x_n$&lt;/span&gt; are the gate parameters in each of the quantum gates for the circuit representing the ansatz. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So one of my questions would be how to frame the algorithm using Cirq's circuit to properly implement it to reproduce the results of the paper. I am unsure right now of how to use the measured energy as a way to calculate the adjustments necessary to the gate parameters to minimize the measured energy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also, how should I think about the objective function? Is it comparable to a cost function, or loss function, of the circuit in question? &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="55" LastEditDate="2021-04-23T08:56:41.217" LastActivityDate="2021-04-23T08:56:41.217" Title="How to implement NM Algorithm for Variational Quantum Eigensolver?" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;cirq&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6563" PostTypeId="2" ParentId="6554" CreationDate="2019-06-23T04:33:35.353" Score="7" Body="&lt;p&gt;This is actually very easy in Cirq. The &lt;code&gt;controlled_by&lt;/code&gt; method can be used to automatically make any given gate controlled by an arbitrary number of control qubits. Here is a simple example for creating an X gate with 5 controls:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;qb = [cirq.LineQubit(i) for i in range(6)]&#xA;&#xA;cnX = cirq.X.controlled_by(qb[0], qb[1], qb[2], qb[3], qb[4])&#xA;&#xA;circuit = cirq.Circuit()&#xA;circuit.append(cnX(qb[5]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="121" LastEditDate="2019-10-26T02:29:14.890" LastActivityDate="2019-10-26T02:29:14.890" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6564" PostTypeId="1" CreationDate="2019-06-23T07:16:52.270" Score="3" ViewCount="36" Body="&lt;p&gt;In the link provided researches utilize strong two-plasmon absorption in graphene nanoribbons to create a “square-root-of-swap”, could such a device be utilized to perform other quantum logic gates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link: &lt;a href=&quot;https://www.nature.com/articles/s41534-019-0150-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computing with graphene plasmons (Calafell &lt;em&gt;et al.&lt;/em&gt;, 2019)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7842" LastEditorUserId="26" LastEditDate="2019-06-23T07:29:24.430" LastActivityDate="2019-06-23T07:29:24.430" Title="How to perform quantum logic gates on plasmons?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;optical-quantum-computing&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6565" PostTypeId="1" CreationDate="2019-06-23T20:24:20.877" Score="2" ViewCount="35" Body="&lt;p&gt;(I am importing this question that I asked in Physics stack exchange)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the system formed by particle(microscopic or macroscopic)- environment coupling be described by &lt;span class=&quot;math-container&quot;&gt;$|ϕ\rangle\langleϕ|$&lt;/span&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In decoherence approach, to retrieve the classical properties, one focuses on &#xA;&lt;span class=&quot;math-container&quot;&gt;$Tr_a(|ϕ\rangle\langleϕ|)$&lt;/span&gt;. Where the subscript 'a' denotes a particular basis spanning the Hilbert space of the environment. The amplitudes associated with the states in this reduced density matrix are then interpreted as classical probabilities. I have a single questions with this approach in relation to the idea of retrieving classical dynamics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the particle is concerned, this consideration is with reference to only one of the observable associated with said particle. i.e. In the state &lt;span class=&quot;math-container&quot;&gt;$|Φ\rangle$&lt;/span&gt;, the entanglement involves the eigenstates of an observable of the environment on the one hand and the eigenstates of an observable of the particle on the other hand, and when one says that the particle's quantum coherence is approximately lost, it is only with reference to the eigenstates of the latter observable characterizing the particle. But for the claim 'classical physics has been retrieved' to be validated, one would expect a similar loss of coherence for all the physical quantities associated with the said particle. Which means, not just it's position(say) must be shown to apparently become classical, but also it's momentum, internal energy and other classical physical quantities that are associated with that particle. Is such a calculation possible within the decoherence approach? If so, how does one proceed? And does it work in the broadest generality possible(That is for all environment-system interaction and for all initial states)?&lt;/p&gt;&#xA;" OwnerUserId="7845" LastEditorUserId="23" LastEditDate="2019-06-23T20:54:48.620" LastActivityDate="2019-06-23T20:54:48.620" Title="Can decoherence account for suppression of interference in all basis?" Tags="&lt;decoherence&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6566" PostTypeId="1" AcceptedAnswerId="6577" CreationDate="2019-06-24T05:51:24.363" Score="2" ViewCount="296" Body="&lt;p&gt;It's perhaps a very silly question, but in what ways is it advantageous to use GridQubit vs LineQubits to develop quantum circuits? Specially to develop ansatz ? Are GridQubits Cirq's way of representing lattices or possibly surface codes?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-04-01T13:42:52.230" Title="GridQubit in Cirq vs LineQubit" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;cirq&gt;&lt;surface-code&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6567" PostTypeId="2" ParentId="6561" CreationDate="2019-06-24T06:59:28.387" Score="3" Body="&lt;p&gt;Hamiltonian simulation is usually talking about simulating a quantum system on another quantum system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, a &lt;em&gt;digital&lt;/em&gt; simulation would involve implementing the simulation on a quantum computer using, e.g. the gate model. In this setting, there are several different strategies, i.e. algorithms, which one can use to perform the simulation. These have different performance characteristics, such as the level of accuracy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This simulation is BQP-complete. That means it's the hardest sort of problem that a quantum computer can perform. This is because you can perform simulation on a quantum computer, and you can embed any arbitrary quantum computation in a Hamiltonian evolution.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-24T06:59:28.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6568" PostTypeId="2" ParentId="6566" CreationDate="2019-06-24T08:10:46.073" Score="1" Body="&lt;p&gt;Cirq defines qubits to be LineQubits or GridQubits, since these are common constructions in NISQ computers.&#xA;Qubits are commonly defined in lists (or generally iterables) for easy indexing in algorithms.&#xA;In simulation using either has no impact on your algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.GridQubit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq's documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;GridQubit is a qubit on a 2d square lattice.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5791" LastEditorUserId="5791" LastEditDate="2020-04-01T13:42:52.230" LastActivityDate="2020-04-01T13:42:52.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6569" PostTypeId="2" ParentId="6546" CreationDate="2019-06-24T09:36:16.340" Score="2" Body="&lt;p&gt;Let me work out here the more general case, in which you have a controlled operation but in which the &amp;quot;turned-off&amp;quot; and &amp;quot;turned-on&amp;quot; states are not necessarily &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\ketbra}[2]{\lvert #1\rangle\!\langle #2\rvert}\ket0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consider a generic controlled operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal U=\ketbra{\phi_1}{\phi_1}\otimes U_1+\ketbra{\phi_2}{\phi_2}\otimes U_2&#xA;\equiv \mathbb P_{\phi_1}\otimes U_1+\mathbb P_{\phi_2}\otimes U_2,$$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\ket{\phi_1},\ket{\phi_2}$&lt;/span&gt; arbitrary orthogonal states and &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_{\psi}$&lt;/span&gt; denotes the projector onto the state &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_{\psi}\equiv\ketbra\psi\psi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Define now the &amp;quot;inverse-controlled&amp;quot; operation &lt;span class=&quot;math-container&quot;&gt;$\tilde{\mathcal U}$&lt;/span&gt; defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tilde{\mathcal U}\equiv&#xA;\mathbb P_{\phi_2}\otimes U_1+\mathbb P_{\phi_1}\otimes U_2.$$&lt;/span&gt;&#xA;The question is whether you can implement &lt;span class=&quot;math-container&quot;&gt;$\tilde{\mathcal U}$&lt;/span&gt; by using only &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; and local operations.&lt;/p&gt;&#xA;&lt;p&gt;More specifically, it is easy to see that we can do this by only using local operations on the controlling qubit. To see this, let &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; be a single-qubit unitary, and consider the composition of &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; with two &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; on the first qubit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(V\otimes I)\mathcal U(V^\dagger\otimes I)=&#xA;(V\mathbb P_{\phi_1} V^\dagger)\otimes U_1+&#xA;(V\mathbb P_{\phi_2} V^\dagger)\otimes U_2.$$&lt;/span&gt;&#xA;We thus simply need a &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$V\mathbb P_{\phi_i}V^\dagger=\mathbb P_{\phi_{3-i}}$&lt;/span&gt;.&#xA;This is equivalent to asking for a &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  V\ket{\phi_1} &amp;amp;=\ket{\phi_2} \\&#xA;  V\ket{\phi_2} &amp;amp;=\ket{\phi_1}.&#xA;\end{align}&lt;/span&gt;&#xA;In the case &lt;span class=&quot;math-container&quot;&gt;$\ket{\phi_1}=\ket0, \ket{\phi_2}=\ket1$&lt;/span&gt; you recover &lt;span class=&quot;math-container&quot;&gt;$V=X$&lt;/span&gt;, while more in general you want an operation &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;  whose &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$V=\ketbra{\phi_1}{\phi_2}+\ketbra{\phi_2}{\phi_1}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-14T17:01:58.943" LastActivityDate="2020-07-14T17:01:58.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6570" PostTypeId="2" ParentId="6549" CreationDate="2019-06-24T09:37:40.267" Score="2" Body="&lt;p&gt;Why not uncover the quantum computer—open the box—to reveal the mechanism? Well, we can’t. If we “watch” the computation happen, we expose the quantum computer to an environment and this will break the computation. The kind of things a quantum computer needs to do requires complete isolation from the environment. Just like a magician’s trick, if we reveal the mechanism, the magic doesn’t happen.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don’t place your analogy at the level of explanation — place it at the level of the phenomenon. Let your analogy do the work of explanation for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bdw2I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bdw2I.png&quot; alt=&quot;Hope you find this useful&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you really want to explain quantum computing and its workings you will have to explain a little math, which hopefully isn’t too much for your audience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just keep in mind that the math won't fully help you understand how the mechanism works, it is simply just a better way of putting the concept of quantum computing and for a better understanding of the concept behind it. A good metaphor can be found in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3924&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7842" LastEditorUserId="26" LastEditDate="2019-10-11T05:12:42.193" LastActivityDate="2019-10-11T05:12:42.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6571" PostTypeId="1" CreationDate="2019-06-24T14:53:21.440" Score="-2" ViewCount="338" Body="&lt;p&gt;I have been using Qiskit over the last few weeks to run different programs. But right now, whenever I try to run any code, it gives me a 403 error stating that I am out of credits. I am creating a random walk simulation. &lt;/p&gt;&#xA;" OwnerUserId="7856" LastEditorUserId="409" LastEditDate="2019-06-26T08:59:36.957" LastActivityDate="2019-06-26T08:59:36.957" Title="What does it mean to get 403 error when running a code on Qiskit?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-07-12T12:32:44.417" ContentLicense="CC BY-SA 4.0" />
  <row Id="6572" PostTypeId="1" CreationDate="2019-06-24T15:03:12.057" Score="3" ViewCount="95" Body="&lt;p&gt;At first when I heard about entanglement, I thought &quot;Neat, so we can make a manipulation on our quantum computer here in such a way that can be interpreted as a binary output somewhere else, and have secure, instant communication of information across vast distance.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I read an article about the effect of quantum mechanics / computing on security and it was explained that we cannot manipulate the communicated information, we can just get the same random numbers from each end securely, which is still useful. So then my thinking was &quot;Ok, so no messages, but very secure crypto key exchanges, that's still cool..&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now I watch &lt;a href=&quot;https://youtu.be/6yaY4Fw-ovM?t=171&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video&lt;/a&gt; which at the time stamp linked suggested that we can manipulate one end and have that manipulation communicated at the other end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So will I one day be able to send &quot;Hello world&quot; through a near zero latency, perfectly secure entangled particle pair, or will I not?&lt;/p&gt;&#xA;" OwnerUserId="7857" LastEditorUserId="10480" LastEditDate="2021-03-20T06:09:29.830" LastActivityDate="2021-03-20T06:37:51.307" Title="Does entanglement allow communication of user specified information or not?" Tags="&lt;entanglement&gt;&lt;information-theory&gt;&lt;communication&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6575" PostTypeId="1" AcceptedAnswerId="6576" CreationDate="2019-06-24T18:14:55.040" Score="3" ViewCount="83" Body="&lt;p&gt;If our input &lt;span class=&quot;math-container&quot;&gt;$x \in \{0, 1\}^{n}$&lt;/span&gt; is given as a black box, we usually query an oracle as follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$O_{x}|i, b \rangle = (-1)^{b x_{i}} |i, b \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$i = \{1, 2, \cdots, n \}$&lt;/span&gt; is the index of the input we are querying. &lt;span class=&quot;math-container&quot;&gt;$x_{i}$&lt;/span&gt; is the value at that index. &lt;span class=&quot;math-container&quot;&gt;$b = \{0, 1\}$&lt;/span&gt; is an arbitrary Boolean value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we need the &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; register? Why can't we have a query of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$O_{x}|i \rangle = (-1)^{x_{i}} |i \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transformation is certainly unitary. Andrew Childs notes in his &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/teaching/w13/l14.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; that we can't distinguish between &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bar{x}$&lt;/span&gt; (bitwise complement of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;) if we exclude the &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; register. I don't see why this should be the case. &lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="119" LastEditDate="2019-06-26T17:17:42.480" LastActivityDate="2019-06-26T17:17:42.480" Title="Why is the second register needed to define bit flip quantum oracles in a way that distinguishes between complementary oracles?" Tags="&lt;algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6576" PostTypeId="2" ParentId="6575" CreationDate="2019-06-24T18:43:15.843" Score="4" Body="&lt;p&gt;Consider the last part of your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Why can't we have a query of the form&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$O_{x}|i \rangle = (-1)^{x_{i}} |i \rangle$$&lt;/span&gt;&#xA;  This transformation is certainly unitary. Andrew Childs notes [...] that we can't distinguish between &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bar{x}$&lt;/span&gt; (bitwise complement of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;) if we exclude the &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; register. I don't see why this should be the case.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle = \sum_k u_k \lvert k \rangle$&lt;/span&gt;. Then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*} O_x \lvert \psi \rangle &amp;amp; = \sum_k (-1)^{x_k} u_k \lvert k \rangle \\[2ex]&#xA;O_{\bar x} \lvert \psi \rangle &amp;amp; = \sum_k (-1)^{\bar x_k} u_k \lvert k \rangle \\&#xA; &amp;amp; = \sum_k (-1)^{1 + x_k} u_k \lvert k \rangle \\&#xA;&amp;amp; = \sum_k - (-1)^{x_k} u_k \lvert k \rangle \\&#xA;&amp;amp;= - O_x \lvert \psi \rangle. &#xA;\end{align*} $$&lt;/span&gt;&#xA;Because global phases (such as the factor difference between &lt;span class=&quot;math-container&quot;&gt;$O_{\bar x} \lvert \psi \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$- O_x \lvert \psi \rangle$&lt;/span&gt;) aren't detectable, it is impossible to distinguish between these two states. In fact, more properly speaking, they &lt;em&gt;are&lt;/em&gt; the same state &amp;mdash; and these two different vectors are just equivalent ways of representing it, as the differences they have do not correspond to any physical properties. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-06-24T20:29:07.577" LastActivityDate="2019-06-24T20:29:07.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6577" PostTypeId="2" ParentId="6566" CreationDate="2019-06-24T23:13:51.170" Score="5" Body="&lt;p&gt;When using a simulator, it doesn't really matter what kind of qubit you refer to. You can even mix-and-match the types. The type of qubit only becomes relevant when you intend to run on a device, because devices have qubits at specific locations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you wanted to run on Bristlecone, you would limit yourself to &lt;code&gt;GridQubit&lt;/code&gt; instances that actually appeared on the chip:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import cirq&#xA;&amp;gt;&amp;gt;&amp;gt; print(cirq.google.Bristlecone)&#xA;                                             (0, 5)────(0, 6)&#xA;                                             │         │&#xA;                                             │         │&#xA;                                    (1, 4)───(1, 5)────(1, 6)────(1, 7)&#xA;                                    │        │         │         │&#xA;                                    │        │         │         │&#xA;                           (2, 3)───(2, 4)───(2, 5)────(2, 6)────(2, 7)───(2, 8)&#xA;                           │        │        │         │         │        │&#xA;                           │        │        │         │         │        │&#xA;                  (3, 2)───(3, 3)───(3, 4)───(3, 5)────(3, 6)────(3, 7)───(3, 8)───(3, 9)&#xA;                  │        │        │        │         │         │        │        │&#xA;                  │        │        │        │         │         │        │        │&#xA;         (4, 1)───(4, 2)───(4, 3)───(4, 4)───(4, 5)────(4, 6)────(4, 7)───(4, 8)───(4, 9)───(4, 10)&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;(5, 0)───(5, 1)───(5, 2)───(5, 3)───(5, 4)───(5, 5)────(5, 6)────(5, 7)───(5, 8)───(5, 9)───(5, 10)───(5, 11)&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;         │        │        │        │        │         │         │        │        │        │&#xA;         (6, 1)───(6, 2)───(6, 3)───(6, 4)───(6, 5)────(6, 6)────(6, 7)───(6, 8)───(6, 9)───(6, 10)&#xA;                  │        │        │        │         │         │        │        │&#xA;                  │        │        │        │         │         │        │        │&#xA;                  (7, 2)───(7, 3)───(7, 4)───(7, 5)────(7, 6)────(7, 7)───(7, 8)───(7, 9)&#xA;                           │        │        │         │         │        │&#xA;                           │        │        │         │         │        │&#xA;                           (8, 3)───(8, 4)───(8, 5)────(8, 6)────(8, 7)───(8, 8)&#xA;                                    │        │         │         │&#xA;                                    │        │         │         │&#xA;                                    (9, 4)───(9, 5)────(9, 6)────(9, 7)&#xA;                                             │         │&#xA;                                             │         │&#xA;                                             (10, 5)───(10, 6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas if you were intending to run on an ion trap which arranged qubits into a line, you would be more likely to work in terms of &lt;code&gt;LineQubit&lt;/code&gt;s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another situation where you would use a &lt;code&gt;LineQubit&lt;/code&gt; is if you had an algorithm that only required linear nearest-neighbor connectivity, such as &lt;a href=&quot;https://arxiv.org/abs/1711.04789&quot; rel=&quot;noreferrer&quot;&gt;a chemistry algorithm based on an fswap network&lt;/a&gt;. You would define the circuit in terms of &lt;code&gt;LineQubit&lt;/code&gt;s and then use a placement pass to map the line onto the actual device, replacing &lt;code&gt;LineQubit&lt;/code&gt;s with &lt;code&gt;GridQubit&lt;/code&gt;s perhaps returned by &lt;code&gt;cirq.google.line_on_device&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; cirq.google.line_on_device(cirq.google.Bristlecone, 10)&#xA;(cirq.GridQubit(0, 5),&#xA; cirq.GridQubit(0, 6),&#xA; cirq.GridQubit(1, 6),&#xA; cirq.GridQubit(1, 7),&#xA; cirq.GridQubit(2, 7),&#xA; cirq.GridQubit(2, 8),&#xA; cirq.GridQubit(3, 8),&#xA; cirq.GridQubit(3, 9),&#xA; cirq.GridQubit(4, 9),&#xA; cirq.GridQubit(4, 10))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-06-24T23:13:51.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6578" PostTypeId="2" ParentId="6562" CreationDate="2019-06-24T23:37:09.590" Score="3" Body="&lt;p&gt;If you are looking for a more complete implementation of a quantum variational algorithm in the context of Cirq, I would recommend looking at the second example in the OpenFermion-Cirq &lt;a href=&quot;https://github.com/quantumlib/OpenFermion-Cirq/blob/master/examples/tutorial_4_variational.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;notebook found here&lt;/a&gt;.  It uses a custom ansatz for hydrogen in a minimal basis, but makes a bit more explicit all the required pieces.  Another good example, perhaps without the chemistry overhead, is the &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/qaoa.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;QAOA notebook&lt;/a&gt; written more generally for Cirq, and has some of the experimental considerations (such as finite sampling) included.  I realize these examples are not completely telling for all of your questions, but following each of the subroutines down their respective rabbit holes should allow you to see all of the pieces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to offer a word of caution however that the first example (and many others you will find) explores variational algorithms in a context that can be useful, but is not completely true to how one would experience it in an experiment and hence there are big caveats for evaluation of classical optimizers (like NM) in this setting.  In particular, it queries the objective function (which is the same as the energy or a cost / loss function in this case) essentially perfectly (close to achievable precision on the classical device) for negligible cost.  This lets one explore the parameter space and cost function surface, but is not informative as to the best optimizer to use in an experiment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that classical computers do arithmetic 1 digit at a time for floating point numbers (sometimes phrased as costing &lt;span class=&quot;math-container&quot;&gt;$\log(1/\epsilon)$&lt;/span&gt; for precision &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;) while readout from quantum computers costs you something more like &lt;span class=&quot;math-container&quot;&gt;$1/\epsilon^\alpha$&lt;/span&gt; in number of circuit repetitions, where usually for a near-term device &lt;span class=&quot;math-container&quot;&gt;$\alpha=2$&lt;/span&gt;, analogous to Monte Carlo scaling.  This means you can choose to pay more for additional precision in the readout, but the cost is steep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, practical optimizers for these problems need to tolerate heavy noise to be effective, often lumped into their own subcategories of optimizers for stochastic functions.  The original work used Nelder-Mead as a hack to avoid focusing on the classical part of the problem (the quantum experiment was the focus), however this was perhaps a mistake in hindsight. I would never recommend using it (or other optimizers which are for deterministic problems by design) for these problems in practice, especially in gearing up for a challenging experiment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering the case where one is gearing up for experiment, with real readout considerations, it's absolutely crucial to judge success based on expected experimental time, and not something intangible or missing information like &quot;number of iterations&quot;.  My practical recommendation at the moment would be to pair a reasonable, unbiased estimator of the gradient(such as that in the work by Farhi and Neven, the recent work by &lt;a href=&quot;https://arxiv.org/abs/1901.05374&quot; rel=&quot;nofollow noreferrer&quot;&gt;Napp and Harrow&lt;/a&gt;, or something like &lt;a href=&quot;https://en.wikipedia.org/wiki/Simultaneous_perturbation_stochastic_approximation&quot; rel=&quot;nofollow noreferrer&quot;&gt;simultaneous perturbation by stochastic approximation&lt;/a&gt;) with a decaying step size (sometimes called learning rate) that is adjusted for problem instances.  Tuning this decay and other method hyperparameters in a good way is crucial for success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If one merely wants to toy with the ansatz and problem without worrying about performance in experiment (where one assumes extremely accurate evaluations are possible in negligible time), the considerations are different and simple implementations that are already available are probably preferred.  For example, BFGS for local optimization and basin hopping using BFGS as the local optimizer if global search is of interest are probably good default choices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an additional note, it's important to remember that most quantum variational algorithms today will generally be non-convex optimizations.  As a result, having a good initial guess for the parameters is extremely important.  Also, random initialization (as one often does in machine learning) is fraught with difficulties that &lt;a href=&quot;https://www.nature.com/articles/s41467-018-07090-4&quot; rel=&quot;nofollow noreferrer&quot;&gt;we explored in some depth.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7863" LastActivityDate="2019-06-24T23:37:09.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6579" PostTypeId="1" CreationDate="2019-06-25T03:29:30.187" Score="3" ViewCount="81" Body="&lt;p&gt;I have been experimenting with slowing down the decay of qubits, and as a control, I implemented a circuit with just identity gates for comparison. However, when I implement such circuits in Qiskit, no matter how many identity gates I put, I get about the same fidelity each time. For example, I implemented the following two circuits with 10 identity gates and 20 identity gates in Qiskit and ran it using ibmqx4:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JOnGm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JOnGm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SL2Dc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SL2Dc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I get the the respective histograms of their fidelity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fHCVU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fHCVU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9K2dk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9K2dk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is obviously very weird. However, when I run the same thing in the composer on the IBM Quantum experience, I get the following histograms instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QjIIt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QjIIt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qYweV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qYweV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the results from the composer is more correct. Am I doing anything wrong, or is there a bug with the implementation of identity gates in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="7866" LastActivityDate="2019-06-25T03:29:30.187" Title="There seems to be a problem with the implementation of identity gates on Qiskit as compared to the circuit composer" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6580" PostTypeId="1" AcceptedAnswerId="6583" CreationDate="2019-06-25T04:27:57.937" Score="1" ViewCount="168" Body="&lt;p&gt;According to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1999/why-can-the-discrete-fourier-transform-be-implemented-efficiently-as-a-quantum-c/2002&quot;&gt;this answer by rrtucci&lt;/a&gt;, &#xA;I still cannot catch the spirit of QFT algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I would like to ask why are we using the Hadamard gate when computing the Fourier Transform?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, what is the main idea behind Hadamard Gate?&lt;/p&gt;&#xA;" OwnerUserId="5152" LastEditorUserId="10480" LastEditDate="2021-04-05T17:40:34.523" LastActivityDate="2021-04-05T17:40:34.523" Title="What is the intuition of using Hadamard gate in quantum fourier transform?" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6581" PostTypeId="2" ParentId="6572" CreationDate="2019-06-25T06:53:08.830" Score="4" Body="&lt;p&gt;An entangled quantum state, where one subsystem is held by each party, and there is no other communication, &lt;strong&gt;cannot&lt;/strong&gt; be used to achieve communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two classes of operation that one party could perform on their quantum system are unitaries and measurements.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A unitary performed on one quantum subsystem (Alice) does not change the other one (Bob), so that cannot give you communication&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A measurement performed on Alice's subsystem gives a random outcome. While that outcome is effectively communicated to Bob's subsystem, since Alice could not choose the outcome, she cannot choose what is communicated. Moreover, Bob needs to know what basis Alice used if he is to access that result, so she cannot use that choice to communicate anything.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, to be clear, there are other settings in which entanglement can be used to communicate information, such as superdense coding. This is where Alice manipulates her quantum system, and then physically sends her part of the quantum state to Bob (in the previous scenario, she kept hold of it the whole time). This gives you double the communication rate of a classical channel. Theoretically, the data can be transmitted at the speed of light (as can classical), giving you trivial latency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method can be perfectly secure (although it is not usually talked about in this context) in the sense that an eavesdropper cannot access the information that Alice encoded (because that can only be done if you can access both halves, but Bob never lets his half out of his possession). However, Eve would be able to scramble the message by manipulating Alice's qubit during transmission. Build in some authentication and it would probably be OK.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-06-25T07:01:19.947" LastActivityDate="2019-06-25T07:01:19.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6582" PostTypeId="2" ParentId="6529" CreationDate="2019-06-25T07:38:44.050" Score="2" Body="&lt;p&gt;I think the subject matter of supercondcuting qubits is rather broad and diverse, making it challenging to accurately capture it in a 'brief explanation'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that said, this &lt;a href=&quot;https://aip.scitation.org/doi/pdf/10.1063/1.5089550?class=pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent review&lt;/a&gt; (Krantz et al., Applied Physics Reviews &lt;strong&gt;6&lt;/strong&gt;, 021318 (2019)) - &quot;A Quantum Engineer's Guide to Superconducting Qubits&quot; (&lt;a href=&quot;https://arxiv.org/pdf/1904.06560.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1904.06560&lt;/a&gt;) from the MIT group may be a good place to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section II in the article is perhaps the most relevant to this question, as it describes several implementations of superconducting qubits, from the transmon and tunable transmon to flux qubits and fluxonium. The article further discusses, in sections IV and V, the state of the art in terms of control and readout. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article does not discuss charge- and phase-qubits, which were abandoned (for the most part) because of their higher sensitivity to noise and material losses.&lt;/p&gt;&#xA;" OwnerUserId="127" LastEditorUserId="127" LastEditDate="2019-07-01T01:17:23.867" LastActivityDate="2019-07-01T01:17:23.867" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6583" PostTypeId="2" ParentId="6580" CreationDate="2019-06-25T09:00:52.440" Score="5" Body="&lt;p&gt;The intuition, roughly speaking, is that the only way that you're going to get some difference between classical and quantum computing is if you are able to prepare qubits in a superposition. If you remain in a basis state the whole time, you just have a classical computation. So, you need superposition. Hadamard is the gate that prepares superpositions at the start of an algorithm, and it's the gate that, either by itself, or with the help of some phase gates in the Fourier transform, converts a superposition back into a basis state so that we can read it out at the end.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-25T09:00:52.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6584" PostTypeId="1" AcceptedAnswerId="6614" CreationDate="2019-06-25T09:26:29.177" Score="4" ViewCount="141" Body="&lt;p&gt;For my summer research internship I'm looking to randomized benchmark (RB) &lt;em&gt;non&lt;/em&gt;-Clifford gates for a single qubit. Since I found out that Qiskit ignis &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/ignis/randomized_benchmarking.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;allows for the RB of Clifford gates&lt;/a&gt;, naturally I thought I'd start there. However, the Ignis RB module doesn't seem to allow the RB of non-Clifford gates, or at least it doesn't seem like there's a straightforward way to modify it for non-Clifford gates simulation.  I wondering if anyone has any idea as to what modifications I could be making, or if there's any modules out there that could help me with what I want?&lt;/p&gt;&#xA;" OwnerUserId="7869" LastEditorUserId="23" LastEditDate="2019-06-25T10:59:13.853" LastActivityDate="2019-06-26T22:40:16.113" Title="How to do randomised benchmarking for non-Clifford gates on Qiskit?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6585" PostTypeId="1" CreationDate="2019-06-25T10:45:38.037" Score="3" ViewCount="47" Body="&lt;p&gt;I was reading a paper on Quantum Neural Networks where the authors discussed a new back propagation algorithm. They shared a schematic of the circuit. However, I am unable to understand how the proposed circuit can be derived from the equations derived. Can anybody shed some light?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper can be found here: &lt;a href=&quot;https://arxiv.org/pdf/1905.10912.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1905.10912.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vert\psi(x)\rangle = \prod_{j=1}^{2^N} x_j \vert j\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is the encoding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;  \hat{\mathcal{N}} \vert \psi\rangle = \, &amp;amp;e^{-i\hat{H}\delta t}\vert \psi \rangle \\&#xA;  = &amp;amp;e^{-i\hat{\sum\limits_{j=1}^{2^N} w_j \Xi_j}\delta t}\vert\psi\rangle\\&#xA;  =\,  &amp;amp;\prod_{j=1}^{2^N} e^{ - iw_j \Xi_j \delta t} \vert \psi\rangle\\&#xA;  =\,  &amp;amp;e^{ - iw_1 \Xi_1 \delta t} * e^{ - iw_2 \Xi_2 \delta t} \dots e^{ - iw_k \Xi_k  \delta t} \dots e^{ - iw_{2^N} \Xi_{2^N}  \delta t}\vert \psi\rangle. \\&#xA;\end{split}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above is the architecture where &lt;span class=&quot;math-container&quot;&gt;$w_{j}$&lt;/span&gt; represents the &lt;span class=&quot;math-container&quot;&gt;$i\,th$&lt;/span&gt; weight and the funny horizontal symbol is actually one of &lt;span class=&quot;math-container&quot;&gt;$\{I, \sigma_{x}, \sigma_{y}, \sigma_{z}\}$&lt;/span&gt;, the set of Identity and Pauli matrices, &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; is a small time interval under which the system is evolved, and &lt;span class=&quot;math-container&quot;&gt;$\hat{H}$&lt;/span&gt; is the Hamiltonian of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors go on to state each product term can be written as (example if the horizontal symbol was actually &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x}$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;  e^{ - i w \sigma_x \delta t} &amp;amp;= cos(w \delta t)I - i sin(w \delta t) \sigma_x \\ &#xA;  &amp;amp;= \left[\begin{smallmatrix} cos(w \delta t) &amp;amp;0 \\ 0 &amp;amp; cos(w \delta t) \end{smallmatrix}\right] + \left[\begin{smallmatrix} 0 &amp;amp;-i sin(w \delta t) \\ -i sin(w \delta t) &amp;amp; 0 \end{smallmatrix}\right] \\&#xA;  &amp;amp;= \left[\begin{smallmatrix} cos(w \delta t) &amp;amp;-i sin(w \delta t) \\ -i sin(w \delta t) &amp;amp; cos(w \delta t) \end{smallmatrix}\right] &#xA;\end{split}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They defined the loss function as below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;  \mathcal{L} &amp;amp;= (\langle\psi\vert  \hat{\mathcal{N}}^{\star} - \langle y\vert)*(\hat{\mathcal{N}}\vert\psi\rangle-\vert y\rangle)\\&#xA;  &amp;amp;=\langle\psi\vert  \hat{\mathcal{N}}^{\star} \hat{\mathcal{N}}\vert \psi\rangle - \langle y\vert\hat{\mathcal{N}}\vert\psi\rangle - \langle\psi\vert\hat{\mathcal{N}}^*\vert y\rangle+\langle y | y \rangle\\&#xA;  &amp;amp;= 2 -\langle y\vert\hat{\mathcal{N}}\vert\psi\rangle - \langle\psi\vert\hat{\mathcal{N}}^*\vert y\rangle&#xA;\end{split}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the training involves the following equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;  \frac{\partial  \mathcal{L}}{\partial w_k} &amp;amp;= -\langle y\vert\frac{\partial \hat{\mathcal{N}}}{\partial w_k}\vert\psi\rangle - \langle\psi\vert\frac{\partial \hat{\mathcal{N}}^*}{\partial w_k}\vert y\rangle; \\&#xA;  \frac{\partial \hat{\mathcal{N}}}{\partial w_k} &amp;amp;= e^{ - i\alpha_1 \Xi_1 \delta t} * e^{ - i\alpha_2 \Xi_2 \delta t} \dots (-i \Xi_k \delta t) \,e^{ - i\alpha_k \Xi_k  \delta t} \dots e^{ - i\alpha_n \Xi_n  \delta t};\\&#xA;  \frac{\partial \hat{\mathcal{N}}^*}{\partial w_k} &amp;amp;= e^{  i\alpha_1 \Xi_1 \delta t} * e^{ i\alpha_2 \Xi_2 \delta t} \dots (i \Xi_k \delta t) \,e^{  i\alpha_k \Xi_k  \delta t} \dots e^{  i\alpha_n \Xi_n  \delta t}.&#xA;\end{split}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, they came up with this schematic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CAdkU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CAdkU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody please explain how the circuit is derived from the equations?&lt;/p&gt;&#xA;" OwnerUserId="6207" LastEditorUserId="1386" LastEditDate="2019-06-25T11:12:46.333" LastActivityDate="2019-06-25T11:12:46.333" Title="How to derive a circuit from given equations?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;neural-network&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6586" PostTypeId="1" AcceptedAnswerId="6587" CreationDate="2019-06-25T11:36:23.723" Score="5" ViewCount="542" Body="&lt;p&gt;I am trying to implement Simon's algorithm which calls for a 2-to-1 mapping function that satisfies &lt;span class=&quot;math-container&quot;&gt;$f(x) = f(x⊕s)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for a simple way to code the oracle (using &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Cx$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; gates), ideally with an easy way to redefine &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7864" LastEditorUserId="55" LastEditDate="2019-06-26T15:36:37.363" LastActivityDate="2019-06-26T15:36:37.363" Title="Coding an oracle for Simon's algorithm" Tags="&lt;circuit-construction&gt;&lt;simons-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6587" PostTypeId="2" ParentId="6586" CreationDate="2019-06-25T11:50:07.227" Score="4" Body="&lt;p&gt;You could do something like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;assume the most significant bit of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;write a function that says &quot;if the most significant bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is 0, return &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. if the most significant bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is 1, return &lt;span class=&quot;math-container&quot;&gt;$x\oplus s$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is easily implemented because you start by doing a transversal set of cNOT gates to copy &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from the input register to the output register. Then, you simply do a bunch of controlled-not gates controlled off the most significant bit of the first register, targeting each of the qubits in the output register for which the corresponding bit of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is 1.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-25T11:50:07.227" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6588" PostTypeId="1" AcceptedAnswerId="6856" CreationDate="2019-06-25T14:54:57.433" Score="3" ViewCount="342" Body="&lt;p&gt;I read &lt;a href=&quot;https://pdfs.semanticscholar.org/650c/3fa2a231cd77cf3d882e1659ee14175c01d5.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the article of IBM&lt;/a&gt; on Quantum Volume, but I don't understand how to calculate the &lt;em&gt;effective error rate&lt;/em&gt;, and therefore the Quantum Volume. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone give an example of the calculation?&lt;/p&gt;&#xA;" OwnerUserId="7762" LastEditorUserId="55" LastEditDate="2019-06-26T15:39:13.167" LastActivityDate="2019-07-23T22:59:55.230" Title="How to calculate the quantum Volume?" Tags="&lt;quantum-volume&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6589" PostTypeId="2" ParentId="6572" CreationDate="2019-06-25T15:31:26.697" Score="3" Body="&lt;p&gt;You cannot directly send information using only entanglement like DaftWullie excellently explained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But here's what you can do&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Superdense coding&lt;/strong&gt;: a) pre-share 2 entangled qubits between you and a friend b) then by sending a single qubit you can send 2 classical bits&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Teleportation&lt;/strong&gt;: a) pre-share 2 entangled qubits between you and a friend b) when you want to send an arbitrary qubit you process it together with your entangled qubit then measure it and get two classical bits. c) send those classical bits to your friend and he will be able to recreate the arbitrary qubit you wanted to send. (You have to destroy the information in order ho send it that's why it's called teleportation)&lt;/li&gt;&#xA;&lt;li&gt;Use quantum cryptographic protocols like &lt;strong&gt;Quantum key distribution&lt;/strong&gt; to encode/decode messages sent over a classical channel.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7759" LastActivityDate="2019-06-25T15:31:26.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6590" PostTypeId="2" ParentId="6571" CreationDate="2019-06-25T16:27:55.493" Score="2" Body="&lt;p&gt;The 403 error is a http error - Forbidden. It's comming from the server that is giving you access to the quantum computer, not from the quantum computer its self.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using IBM Q Experience you shuld check out the &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/000-FAQ/000-Frequently_Asked_Questions.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;FAQ page&lt;/a&gt;. Regarding to credits it states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A User has a maximum of 15 credits, and these credits are replenished upon the greater of 24 hours or when your execution has run off the queue.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So you have probably consumed your allocated credits and the http server is rejecting your requests.&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="7759" LastEditDate="2019-06-26T07:29:23.823" LastActivityDate="2019-06-26T07:29:23.823" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6591" PostTypeId="1" AcceptedAnswerId="6623" CreationDate="2019-06-25T22:10:03.093" Score="1" ViewCount="104" Body="&lt;p&gt;I am attempting to implement a minimum spanning tree problem on the D wave quantum computing architecture. I have seen many graph problems implemented, such as a graph coloring example. There are also a variety of Traveling Salesman Tutorials available. What would be the best approach for making a functioning application of the MST on a D Wave system? Are there any related tutorials or examples to this problem other than the ones mentioned?&lt;/p&gt;&#xA;" OwnerUserId="7674" LastEditorUserId="2927" LastEditDate="2019-06-25T23:02:37.283" LastActivityDate="2019-06-27T16:54:10.670" Title="Minimum Spanning Tree on D Wave Processor" Tags="&lt;d-wave&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6593" PostTypeId="2" ParentId="6513" CreationDate="2019-06-26T09:01:29.937" Score="1" Body="&lt;p&gt;Assuming you have n qubits then the domain of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is all bit-strings &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. (&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; values)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To encode the data, in many cases, we start with the maximum superposition state. Which means each qubit is in an equal superposition of |0&gt; and |1&gt; so the entire system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is in a massive superposition of all possible states (the entire domain of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the case of Grover's algorithm in each iteration we call the oracle &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; and for the sub-states in which &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; the amplitudes are enhanced. The amplitudes are diminished for the states where &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;. By doing this over a number of iterations we are left a superposition that contains mostly states that satisfy &lt;span class=&quot;math-container&quot;&gt;$f(x) =1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The oracle does not call a classical function. It has to do computation in the quantum space.&lt;/p&gt;&#xA;" OwnerUserId="7759" LastActivityDate="2019-06-26T09:01:29.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6594" PostTypeId="1" AcceptedAnswerId="6596" CreationDate="2019-06-26T09:34:55.070" Score="1" ViewCount="233" Body="&lt;p&gt;at &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/latest/examples/and.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, the following code example is available:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; from dwave.system.samplers import DWaveSampler&#xA;&amp;gt;&amp;gt;&amp;gt; from dwave.system.composites import EmbeddingComposite&#xA;&amp;gt;&amp;gt;&amp;gt; sampler = DWaveSampler(endpoint='https://URL_to_my_D-Wave_system/', token='ABC-123456789012345678901234567890', solver='My_D-Wave_Solver')&#xA;&amp;gt;&amp;gt;&amp;gt; sampler_embedded = EmbeddingComposite(sampler)&#xA;&amp;gt;&amp;gt;&amp;gt; Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}&#xA;&amp;gt;&amp;gt;&amp;gt; response = sampler_embedded.sample_qubo(Q, num_reads=5000)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When looking at the results, they are grouped by sample solution, with a mention of the number of occurrences:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;gt;&amp;gt;&amp;gt; for datum in response.data(['sample', 'energy', 'num_occurrences']):   &#xA;...    print(datum.sample, &quot;Energy: &quot;, datum.energy, &quot;Occurrences: &quot;, datum.num_occurrences)&#xA;...&#xA;{'x1': 1, 'x2': 0, 'z': 0} Energy:  0.0 Occurrences:  1009&#xA;{'x1': 1, 'x2': 1, 'z': 1} Energy:  0.0 Occurrences:  1452&#xA;{'x1': 0, 'x2': 0, 'z': 0} Energy:  0.0 Occurrences:  1292&#xA;{'x1': 0, 'x2': 1, 'z': 0} Energy:  0.0 Occurrences:  1246&#xA;{'x1': 0, 'x2': 1, 'z': 0} Energy:  0.0 Occurrences:  1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After looking at the available samplers at &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/latest/overview/stack.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;, I changed the code to simulate the process with D-Wave's Dimod, and repeated this D-Wave's neal:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from dwave.system.samplers import DWaveSampler&#xA;from dwave.system.composites import EmbeddingComposite&#xA;import dimod&#xA;import neal&#xA;#sampler = DWaveSampler(endpoint='https://URL_to_my_D-Wave_system/',  token='ABC-123456789012345678901234567890', solver='My_D-Wave_Solver')&#xA;sampler = dimod.SimulatedAnnealingSampler()&#xA;# Note: also tried with neal: &#xA;# sampler = neal.SimulatedAnnealingSampler()&#xA;#sampler_embedded = EmbeddingComposite(sampler)&#xA;Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}&#xA;#response = sampler_embedded.sample_qubo(Q, num_reads=5000)&#xA;response = sampler.sample_qubo(Q, num_reads=500)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, my results are not binned:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for datum in response.data(['sample', 'energy', 'num_occurrences']):   &#xA;    print(datum.sample, &quot;Energy: &quot;, datum.energy, &quot;Occurrences: &quot;, datum.num_occurrences)    &#xA;({'x2': 0, 'x1': 0, 'z': 0}, 'Energy: ', 0.0, 'Occurrences: ', 1)&#xA;({'x2': 1, 'x1': 1, 'z': 1}, 'Energy: ', 0.0, 'Occurrences: ', 1)&#xA;({'x2': 1, 'x1': 1, 'z': 1}, 'Energy: ', 0.0, 'Occurrences: ', 1)&#xA;[497 similar lines removed]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question: how can I make sure my results are correctly binned*? &lt;br&gt;&#xA;OR: how should I properly port the given code to be able to simulate it without access to the actual D-Wave hardware?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*: I am not asking for a generic algorithm to create bins/histograms, I have those already. I am looking for a function of set of parameters from the D-Wave libraries, as I'm surprised by the different outcomes&lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="2794" LastEditDate="2019-06-26T10:57:36.327" LastActivityDate="2019-06-26T16:45:15.277" Title="How to get samples in &quot;bins&quot; from D-Wave's dimod?" Tags="&lt;simulation&gt;&lt;d-wave&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6596" PostTypeId="2" ParentId="6594" CreationDate="2019-06-26T10:55:36.963" Score="1" Body="&lt;p&gt;Old answer :&#xA;Maybe the answer mode differs using a different sampler. I have not tried but I know there is an option &quot;answer_mode&quot; in the sample_qubo method. If answer_mode='raw', you will have all responses not binned. If answer_mode='histogram', you should get them as bins. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;New answer : &#xA;Dimod does not use the answer_mode argument. To work it in your way, &#xA;you have to aggregate response:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Q = {('x1', 'x2'): 1, ('x1', 'z'): -2, ('x2', 'z'): -2, ('z', 'z'): 3}&#xA;&#xA;response = sampler.sample_qubo(Q, num_reads=500)&#xA;response = response.aggregate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you will have bins :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for datum in response.data(['sample', 'energy', 'num_occurrences']):   &#xA;    print(datum.sample, &quot;Energy: &quot;, datum.energy, &quot;Occurrences: &quot;, datum.num_occurrences)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This yields for me :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{'x1': 0, 'x2': 1, 'z': 0} Energy:  0.0 Occurrences:  134&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{'x1': 1, 'x2': 1, 'z': 1} Energy:  0.0 Occurrences:  123&lt;/p&gt;&#xA;&#xA;&lt;p&gt;{'x1': 0, 'x2': 0, 'z': 0} Energy:  0.0 Occurrences:  115&#xA;...&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2019-06-26T14:34:43.047" LastActivityDate="2019-06-26T14:34:43.047" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6598" PostTypeId="1" AcceptedAnswerId="6656" CreationDate="2019-06-26T12:46:10.790" Score="5" ViewCount="119" Body="&lt;p&gt;Suppose we are given a (univariate) polynomial &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; of degree &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, and we wish to determine if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is identically &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.  A standard way to do this is to use a classical PRG to randomly sample &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits, drawing a number &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; &lt;strong&gt;uniformly&lt;/strong&gt; from &lt;span class=&quot;math-container&quot;&gt;$[0,S]$&lt;/span&gt;; we can plug &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; to see if &lt;span class=&quot;math-container&quot;&gt;$P(r)=0$&lt;/span&gt;.  If we only perform the above test one time, we would be &quot;fooled&quot; into thinking the polynomial is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; when it's not only &lt;span class=&quot;math-container&quot;&gt;$d/S$&lt;/span&gt; times.  However, we can rinse and repeat &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times to amplify our success probability, and our probability of being &quot;fooled&quot; is at most &lt;span class=&quot;math-container&quot;&gt;$(d/S)^k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an alternative to drawing uniformly from &lt;span class=&quot;math-container&quot;&gt;$[0,S]$&lt;/span&gt;, we could also perform random circuit sampling on an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit random quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.  That is, we measure &lt;span class=&quot;math-container&quot;&gt;$U\vert 00\cdots0\rangle$&lt;/span&gt; for some fixed random quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For each sample, the output of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; will most definitely &lt;em&gt;not&lt;/em&gt; be uniformly distributed; it's more likely that most states are never sampled, a good number of states having a reasonable probability of being sampled, and a small number of states having a large probability of being sampled.  This is according to the Porter-Thomas distribution as I understand it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we were to sample &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times from a random quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, and use these &lt;span class=&quot;math-container&quot;&gt;$r_1,r_2,\cdots, r_k$&lt;/span&gt; as a test that a polynomial is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, what is our soundness probability?  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could it be more efficient to repeatedly sample &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits from the same random quantum quantum circuit to determine guesses &lt;span class=&quot;math-container&quot;&gt;$r_1,r_2,\cdots,r_k$&lt;/span&gt; drawn from the Porter-Thomas distribution determined by &lt;span class=&quot;math-container&quot;&gt;$U|00\cdots 0\rangle$&lt;/span&gt; than to repeatedly sample &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits at random to determine guesses &lt;span class=&quot;math-container&quot;&gt;$r_1,r_2,\cdots,r_k$&lt;/span&gt; drawn from the uniform distribution?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-07-01T17:55:22.367" LastActivityDate="2019-07-01T21:49:10.850" Title="Can we amplify BPP algorithms with a random quantum circuit?" Tags="&lt;complexity-theory&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6599" PostTypeId="5" CreationDate="2019-06-26T12:50:09.313" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2019-06-26T12:50:09.313" LastActivityDate="2019-06-26T12:50:09.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6600" PostTypeId="4" CreationDate="2019-06-26T12:50:09.313" Score="0" Body="For questions about quantum circuits having a small (polynomial) number of quantum gates; each gate is defined randomly.  Random quantum circuits may be implementable shortly, and be used in noisy, intermediate-scale quantum (NISQ) era.  Sampling from a random quantum circuit is likely to be classically hard." OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-06-27T21:02:44.093" LastActivityDate="2019-06-27T21:02:44.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6601" PostTypeId="1" AcceptedAnswerId="6602" CreationDate="2019-06-26T13:31:03.253" Score="1" ViewCount="88" Body="&lt;p&gt;Suppose that there is an ensemble with 60% of the states prepared in &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|a\rangle=\sqrt{\frac{2}{5}}|+\rangle-\sqrt{\frac{3}{5}}|-\rangle$$&lt;/span&gt;&#xA;and 40% in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|b\rangle=\sqrt{\frac{5}{8}}|+\rangle+\sqrt{\frac{3}{8}}|-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've considered two ways to calculate this. For the first, one could replace the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; and calculate the density matrix as usual in &lt;span class=&quot;math-container&quot;&gt;$0,1$&lt;/span&gt; base. Another possibility would be to calculate the density matrix in &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle,|-\rangle\}$&lt;/span&gt; basis and then to convert it into a corresponding &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; density matrix. My question, how would you proceed here?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure if both ways come to the same result?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The density matrix in &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle,|-\rangle\}$&lt;/span&gt; Base is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_a=\frac{2}{3}|+\rangle\langle+|-\frac{\sqrt{6}}{5}|+\rangle\langle-|-\frac{\sqrt{6}}{5}|-\rangle\langle+|+\frac{3}{5}|-\rangle\langle-|$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_b=\frac{5}{8}|+\rangle\langle+|+\frac{\sqrt{15}}{8}|+\rangle\langle-|+\frac{\sqrt{15}}{8}|-\rangle\langle+|+\frac{3}{8}|-\rangle\langle-|$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{2}{5}p_b+\frac{3}{5}p_a=\begin{pmatrix}\frac{49}{100}&amp;amp;\frac{5\sqrt{15}-12\sqrt{6}}{100}\\\frac{5\sqrt{15}-12\sqrt{6}}{100}&amp;amp;\frac{41}{100}\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question is, can one translate this density matrix &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle,|-\rangle\}$&lt;/span&gt; into the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; basis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or should one have started like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|a\rangle=\sqrt{\frac{2}{5}}|+\rangle-\sqrt{\frac{3}{5}}|-\rangle=\sqrt{\frac{2}{5}}\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)-\sqrt{\frac{3}{5}}\left(\frac{|0\rangle-|1\rangle}{\sqrt{2}}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then calculate the same for &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; and then the density matrix&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Then I would be interested, for this question, I did not want to open a new topic. Suppose we have the following density matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\begin{pmatrix}\frac{2}{5}&amp;amp;\frac{-i}{8}\\\frac{i}{8}&amp;amp;\frac{3}{5}\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the probability that the system is in state 0? I would say 2/5 so 40%, but according to the solution that is not true. So my question is why is not that true?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have found these tasks out of interest and try to work on them. But I wanted to get some advice from those present ...&lt;/p&gt;&#xA;" OwnerUserId="4974" LastEditorUserId="4974" LastEditDate="2019-06-26T14:36:03.430" LastActivityDate="2019-06-26T14:36:03.430" Title="What is the probability that measurement finds it in the $|0\rangle$ state?" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6602" PostTypeId="2" ParentId="6601" CreationDate="2019-06-26T13:47:05.673" Score="2" Body="&lt;p&gt;Let's call the two states &lt;span class=&quot;math-container&quot;&gt;$|a_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|a_2\rangle$&lt;/span&gt; to distinguish them. What you're saying is that the state has been prepared (to the best of our knowledge) as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\frac{3}{5}|a_1\rangle\langle a_1|+\frac{2}{5}|a_2\rangle\langle a_2|.&#xA;$$&lt;/span&gt;&#xA;The probability that you expect it to give you an answer &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; if you project in the standard basis is &lt;span class=&quot;math-container&quot;&gt;$\langle 0|\rho|0\rangle$&lt;/span&gt;. You can perform that calculation in whatever basis you want to!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would probably start by calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0|a_1\rangle=\frac{1}{\sqrt{2}}\sqrt{\frac{2}{5}}-\frac{1}{\sqrt{2}}\sqrt{\frac{3}{5}}=\frac{\sqrt{2}-\sqrt{3}}{\sqrt{10}}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0|a_2\rangle=\frac{1}{\sqrt{2}}\sqrt{\frac{5}{8}}-\frac{1}{\sqrt{2}}\sqrt{\frac{3}{8}}=\frac{\sqrt{5}-\sqrt{3}}{\sqrt{16}}&#xA;$$&lt;/span&gt;&#xA;Hence, the overall calculation is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{3}{5}\left(\frac{\sqrt{2}-\sqrt{3}}{\sqrt{10}}\right)^2+\frac{2}{5}\left(\frac{\sqrt{5}-\sqrt{3}}{\sqrt{16}}\right)^2&#xA;$$&lt;/span&gt;&#xA;If my hastily done maths is correct, this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}-\frac{12\sqrt{6}+5\sqrt{15}}{100}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Second question (really ought to be separate):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Assuming&lt;/em&gt; the matrix &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; that you give (might be better to use the standard notation, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, for a density matrix) is written in the standard basis, then the probability of finding it in the 0 state when measured in the standard basis is indeed &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{5}$&lt;/span&gt;. But that is not quite what your wording says (I don't know where the imprecision comes in). What you ask what is the probability that the system is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. This is different because measuring changes the state of the system. You measure it, and you find it to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with a certain probability. That's not the same as it being that state with a certain probability prior to the measurement. However the literal question probably isn't really answerable.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-26T13:47:05.673" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6603" PostTypeId="2" ParentId="6594" CreationDate="2019-06-26T14:27:41.143" Score="0" Body="&lt;p&gt;As cnada pointed out, the correct parameter for this is &quot;answer_mode&quot;. This parameter is not available for the simulated_annealing sampler. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per &lt;a href=&quot;https://dwave-systemdocs.readthedocs.io/en/latest/reference/samplers/generated/dwave.system.samplers.DWaveSampler.sample_qubo.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, samplers.DWaveSampler.sample_qubo() can take the set of parameters mentioned in &lt;a href=&quot;https://dwave-systemdocs.readthedocs.io/en/latest/reference/samplers/generated/dwave.system.samplers.DWaveSampler.parameters.html#dwave.system.samplers.DWaveSampler.parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;, including &quot;answer mode&quot;. As seen in &lt;a href=&quot;https://docs.ocean.dwavesys.com/projects/dimod/en/latest/reference/generated/dimod.reference.samplers.simulated_annealing.SimulatedAnnealingSampler.sample_qubo.html#dimod.reference.samplers.simulated_annealing.SimulatedAnnealingSampler.sample_qubo&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;, samplers.simulated_annealing.sample_qubo() can only take beta_range’, num_reads’, ‘num_sweeps’ &lt;a href=&quot;https://docs.ocean.dwavesys.com/projects/dimod/en/latest/reference/generated/dimod.reference.samplers.simulated_annealing.SimulatedAnnealingSampler.parameters.html#dimod.reference.samplers.simulated_annealing.SimulatedAnnealingSampler.parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;4&lt;/a&gt;. This does not include &quot;answer_mode&quot;. &lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="2794" LastEditDate="2019-06-26T16:45:15.277" LastActivityDate="2019-06-26T16:45:15.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6604" PostTypeId="1" CreationDate="2019-06-26T15:06:23.697" Score="2" ViewCount="342" Body="&lt;p&gt;I am trying to use Qiskit to write a code that uses QFT to add 2 numbers. I am referring to this paper:&#xA;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1742-6596/735/1/012083&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://iopscience.iop.org/article/10.1088/1742-6596/735/1/012083&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a few questions:&#xA;1) Is the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; rotation gate in this paper equivalent to the Controlled-U1 gate in Qiskit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Why does the value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; change?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) The program is supposed to add &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. Number &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is encoded as &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, represented by the zero vector &lt;span class=&quot;math-container&quot;&gt;$(1,0)$&lt;/span&gt; and the 1 vector &lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt;. When does number &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; come into play? It seems that they keep performing operations on number &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; until the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) Number &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is represented by &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$a_2$&lt;/span&gt;. And number &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; consists of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$b_2$&lt;/span&gt;, is that right?&lt;/p&gt;&#xA;" OwnerUserId="7856" LastEditorUserId="2927" LastEditDate="2019-06-30T16:57:47.010" LastActivityDate="2019-07-30T18:03:40.463" Title="Using Quantum Fourier Transform in adding two 2-bit numbers" Tags="&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6605" PostTypeId="1" CreationDate="2019-06-26T15:16:31.107" Score="1" ViewCount="168" Body="&lt;p&gt;How can I build a controlled version of the below matrix in qiskit?&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;e^{i\theta} &amp;amp;  0\\&#xA;0  &amp;amp;  e^{i\theta}&#xA;\end{pmatrix} = e^{i\theta}I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7732" LastEditorUserId="23" LastEditDate="2019-06-26T21:03:20.343" LastActivityDate="2019-06-26T21:03:20.343" Title="How can I build a controlled gate for this matrix in qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6606" PostTypeId="2" ParentId="6605" CreationDate="2019-06-26T15:22:17.677" Score="2" Body="&lt;p&gt;Simply implement the gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\theta} \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;on the control qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-26T15:22:17.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6607" PostTypeId="1" AcceptedAnswerId="6612" CreationDate="2019-06-26T16:18:00.343" Score="3" ViewCount="151" Body="&lt;p&gt;Suppose I have a quantum gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and it's a controlled gate. In particular, I have a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix formulation of the gate's action on 2 adjacent qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I make this work on an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To explain precisely what I mean, if I wanted to implement a controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate on a 3 qubit system where the first 2 bits have the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on them and the third qubit is kept the same, I would get the corresponding matrix by working out &lt;span class=&quot;math-container&quot;&gt;$U\otimes I$&lt;/span&gt;. However, I could not do any similar product to get the gate on 3 qubits in which the first bit is &quot;controlled&quot;, the second bit is kept the same and the third bit has &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I make the matrix which allows me to &quot;control&quot; the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;th bit and use &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; conditionally on the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th bit out of a bunch of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits?&lt;/p&gt;&#xA;" OwnerUserId="7881" LastActivityDate="2019-06-26T21:14:52.893" Title="How to create an $n$-qubit normally controlled gate?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6608" PostTypeId="1" AcceptedAnswerId="6610" CreationDate="2019-06-26T18:21:35.867" Score="3" ViewCount="667" Body="&lt;p&gt;IBM-Q states that the real devices available for public use have a set of &quot;basis&quot; gates consisting of u1,u2,u3 and CNOT. However in Qiskit the circuit can be built with many gates which are not directly one of these. For example the controlled u1 gate is an &quot;elementary operation&quot; in QISKit, but it is not a basis gate in for the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to have such a circuit be executed on a real device these gates must be decomposed into the device's basis gates. I &lt;em&gt;assume&lt;/em&gt; this is handled by the &lt;code&gt;compile&lt;/code&gt; function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way in QISKit to see the quantum circuit &lt;strong&gt;after&lt;/strong&gt; this step has taken place? &lt;/p&gt;&#xA;" OwnerUserId="7609" LastEditorUserId="7609" LastEditDate="2019-06-26T18:47:28.337" LastActivityDate="2019-06-26T19:14:21.360" Title="What does a quantum circuit look like after qiskit.compile() has been applied?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6610" PostTypeId="2" ParentId="6608" CreationDate="2019-06-26T19:14:21.360" Score="6" Body="&lt;p&gt;The function that handles this is &lt;code&gt;transpile()&lt;/code&gt;, which could be found in &lt;code&gt;qiskit.compiler&lt;/code&gt;. When you call &lt;code&gt;transpile(circuit, backend)&lt;/code&gt; it goes through the compilation process for the input circuit based on the backend you provide. It returns a new circuit that will be valid to run on the provided backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then view this new circuit just like you would with any circuit, either &lt;code&gt;print(circuit)&lt;/code&gt; or &lt;code&gt;circuit.draw()&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-06-26T19:14:21.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6611" PostTypeId="1" AcceptedAnswerId="6673" CreationDate="2019-06-26T21:11:07.097" Score="1" ViewCount="408" Body="&lt;p&gt;I am wanting to find the two qubit reduced density matrix on a 5 qubit system. I have the 5 qubit state in the form of a tensor product and I want to find the reduced density matrix of qubits 1 and 3. I have the following formula for the reduced density matrix for qubit 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;       \mathrm{Tr}_1\left|h\right&amp;gt;_{13}\left&amp;lt;h\right| = \sum_{i=0}^{1}\left&amp;lt;i|h\right&amp;gt;_{13}\left&amp;lt;h|i\right&amp;gt;&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am unsure of how to extract &lt;span class=&quot;math-container&quot;&gt;$\left|h\right&amp;gt;_{13}$&lt;/span&gt;  from the 5 qubit state. Please help!&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="26" LastEditDate="2019-10-10T09:13:22.873" LastActivityDate="2019-10-10T09:13:22.873" Title="Taking the two qubit reduced density matrix on a 5 qubit system" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6612" PostTypeId="2" ParentId="6607" CreationDate="2019-06-26T21:14:52.893" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; actually means the 4 by 4 matrix acting on both the control and the affected qubits. You are mixing up this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with the 2 by 2 block inside it. To avoid that from now on, just take &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be the 4 by 4 one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that that is clarified. Rearrange things with a swap.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the first is control and third is acted on you should do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I_2 \otimes S) (U \otimes I_2) (I_2 \otimes S)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a 4 by 4 unitary matrix that swaps two qubits. By it's positioning in &lt;span class=&quot;math-container&quot;&gt;$I_2 \otimes S$&lt;/span&gt; it is acting on qubits 2 and 3 in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(U \otimes I_2)$&lt;/span&gt; had the first as control and the second affected. By conjugating by this swap we changed the roles of second and third qubit. So the combined result has the first as control and the third affected.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-06-26T21:14:52.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6614" PostTypeId="2" ParentId="6584" CreationDate="2019-06-26T22:40:16.113" Score="1" Body="&lt;p&gt;Quite simply: it's on the to-do list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1510.02720&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a sneak peak of how it will be done.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-06-26T22:40:16.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6615" PostTypeId="1" AcceptedAnswerId="6619" CreationDate="2019-06-26T22:54:49.563" Score="5" ViewCount="219" Body="&lt;p&gt;I am trying to understand an argument that Matrix Inversion is BQP-complete for certain conditions on the matrix. This is explained &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; on page 39 (this paper is a primer to the HHL algorithm and gives some more detailed calculations, more detail about assumptions for people new to the subject).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Definition:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An algorithm solves matrix inversion if it has:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input: An &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt;-sparse matrix hermitian &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; of dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; specified using an oracle or via a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(\log N)$&lt;/span&gt;-time algorithm that returns the non-zero elements of a row. The singular values of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; lie between &lt;span class=&quot;math-container&quot;&gt;$\frac{1} {\kappa} $&lt;/span&gt; and 1, where &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; is the ration between the largest eigenvalue and the smallest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bit that equals one with probability &lt;span class=&quot;math-container&quot;&gt;$\langle x | M |x \rangle \pm \epsilon $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$M = |0 \rangle \langle 0 | \otimes I^{N/2}$&lt;/span&gt; corresponds to measuring the first qubit and &lt;span class=&quot;math-container&quot;&gt;$|x \rangle$&lt;/span&gt; is a normalised state proportional to &lt;span class=&quot;math-container&quot;&gt;$A^{-1} |b \rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|b \rangle = |0 \rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; be a quantum circuit acting on &lt;span class=&quot;math-container&quot;&gt;$n = logN$&lt;/span&gt; qubits which applies &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; two-qubit gates &lt;span class=&quot;math-container&quot;&gt;$U_1, \cdots U_T$&lt;/span&gt;. The initial state is given by &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle^{\otimes n}$&lt;/span&gt;, and the answer will be determined by measuring the first qubit of the final state. Adjoin an ancilla register of dimension &lt;span class=&quot;math-container&quot;&gt;$3T$&lt;/span&gt; and define a unitary operation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = \sum_{t-1}^{T}|t+1 \rangle \langle t| \otimes U_t + |t+T+1 \rangle \langle t+T| \otimes I $$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$ + |t+2T+1 \bmod 3T \rangle\langle t+2T| \otimes U^{\dagger}_{3T+1-t}.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author then writes: &quot;This operator has been chosen such that for &lt;span class=&quot;math-container&quot;&gt;$T+1 \leq t \leq 2T$&lt;/span&gt;, applying &lt;span class=&quot;math-container&quot;&gt;$U^t$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle |\psi \rangle$&lt;/span&gt; yields the output state &lt;span class=&quot;math-container&quot;&gt;$|t+1 \rangle \otimes U_t \cdots U_1 |\psi \rangle$&lt;/span&gt;. We can see this as the first &lt;span class=&quot;math-container&quot;&gt;$T+1$&lt;/span&gt; applications of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; return &lt;span class=&quot;math-container&quot;&gt;$|T+2 \rangle \otimes U_T \cdots U_1 |\psi \rangle$&lt;/span&gt; . We see from the second term of the definition for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that for the next &lt;span class=&quot;math-container&quot;&gt;$t'&amp;lt;T-1$&lt;/span&gt; applications, the action on the &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; register remains unchanged, while the ancillary variable is merely being incremented.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This last statement is quite a mouthful as the expression is very complicated. I am having difficulty seeing why this is true and any insights would be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="26" LastEditDate="2019-10-10T09:11:19.200" LastActivityDate="2019-10-10T09:11:19.200" Title="Showing that Matrix Inversion is BQP-complete - HHL Algorithm" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6616" PostTypeId="1" AcceptedAnswerId="6617" CreationDate="2019-06-26T23:47:10.790" Score="4" ViewCount="137" Body="&lt;p&gt;The standard method of implementing the one-bit Deutsch Oracle algorithm is to use two qbits, one as input &amp;amp; one as output (which allows you to write the non-reversible constant functions in a reversible way). However, I've heard there is a different way of implementing the one-bit Deutsch Oracle algorithm involving phases which only requires a single qbit; how is this done?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-10-10T09:08:41.003" LastActivityDate="2019-10-10T09:08:41.003" Title="Implementing the one-bit Deutsch Oracle algorithm using phase" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6617" PostTypeId="2" ParentId="6616" CreationDate="2019-06-27T00:17:36.003" Score="5" Body="&lt;h1&gt;Overview&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;To recap the one-bit Deutsch Oracle problem, there are four possible oracle functions: constant-0, constant-1, identity, and negation. The task is to determine whether the oracle function is constant (constant-0 &amp;amp; constant-1) or variable/balanced (identity &amp;amp; negation). You can do this using phases as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Rewrite the oracle function as &lt;span class=&quot;math-container&quot;&gt;$U_f|x\rangle=(-1)^{f(x)}|x\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Calculate &lt;span class=&quot;math-container&quot;&gt;$U_f|+\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measure in the &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle \}$&lt;/span&gt; basis; the oracle function is constant if the result is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and variable/balanced if the result is &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h1&gt;Rewriting the oracle functions&lt;/h1&gt;&#xA;&#xA;&lt;h2&gt;Constant-0&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = 0, f(1) = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|0\rangle = (-1)^{f(0)}|0\rangle = (-1)^0|0\rangle = 1|0\rangle = |0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|1\rangle = (-1)^{f(1)}|1\rangle = (-1)^0|1\rangle = 1|1\rangle = |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case &lt;span class=&quot;math-container&quot;&gt;$U_f = I$&lt;/span&gt;, the identity operator.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Constant-1&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = 1, f(1) = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|0\rangle = (-1)^{f(0)}|0\rangle = (-1)^1|0\rangle = -1|0\rangle = -|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|1\rangle = (-1)^{f(1)}|1\rangle = (-1)^1|1\rangle = -1|1\rangle = -|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We always multiply the phase by -1. For this we can use a rotation gate &lt;span class=&quot;math-container&quot;&gt;$U_f = R_y(2\pi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Identity&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = 0, f(1) = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|0\rangle = (-1)^{f(0)}|0\rangle = (-1)^0|0\rangle = 1|0\rangle = |0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|1\rangle = (-1)^{f(1)}|1\rangle = (-1)^1|1\rangle = -1|1\rangle = -|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if the input is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then we leave it alone, but if it's &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then we flip the phase. Sound familiar? Recall the phase-flip, or Z-gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$U_f = Z$&lt;/span&gt; for Identity.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Negation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = 1, f(1) = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|0\rangle = (-1)^{f(0)}|0\rangle = (-1)^1|0\rangle = -1|0\rangle = -|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f|1\rangle = (-1)^{f(1)}|1\rangle = (-1)^0|1\rangle = 1|1\rangle = |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case &lt;span class=&quot;math-container&quot;&gt;$U_f = XZX$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Calculating &lt;span class=&quot;math-container&quot;&gt;$U_f|+\rangle$&lt;/span&gt;&lt;/h1&gt;&#xA;&#xA;&lt;h2&gt;Constant-0&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I|+\rangle = |+\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Constant-1&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_y(2\pi)|+\rangle = -|+\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Identity&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z|+\rangle = |-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Negation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$XZX|+\rangle = XZ|+\rangle = X|-\rangle = -|-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Measurement&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It's pretty clear that if we measure in the &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle \}$&lt;/span&gt; basis, we'll get &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; when the oracle function is constant and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; when the oracle function is variable. Done.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Discussion&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;While this approach does have the benefit (for learners) of not requiring multiple qbits or a CNOT gate, the rewriting step seems more like &quot;cheating&quot; given the problem statement.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-06-28T21:03:59.953" LastActivityDate="2019-06-28T21:03:59.953" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6618" PostTypeId="1" CreationDate="2019-06-27T04:43:52.423" Score="3" ViewCount="143" Body="&lt;p&gt;I have been reading &lt;a href=&quot;https://arxiv.org/abs/1802.06002&quot; rel=&quot;nofollow noreferrer&quot;&gt;Farhi and Neven's paper&lt;/a&gt; on quantum neural networks on quantum circuits. I also found an example - albeit not ideal as pointed out by a couple of users - thank you - in  &lt;a href=&quot;https://www.cs.umd.edu/class/fall2018/cmsc657/projects/group_16.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From these sources I used Cirq to build the following circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/SHa96.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SHa96.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this circuit, and from reading Farhi et al., I added the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y9nyn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y9nyn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;The modifications: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A 5th qubit to be a readout bit (ancilla) to measure the predicted label of the readout bit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A Pauli-X gate to ensure the readout bit would be |1&gt; following Farhi's paper prior to start measuring the predicted label. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;N-bit toffoli gate to indirectly measure the ansatz to measure the effects of the &lt;span class=&quot;math-container&quot;&gt;$(\beta, \gamma)$&lt;/span&gt; in the circuit as these are changed.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hadamard layer before entering the operations shown in the picture above. I did this to be able to apply the optimization algorithm successfully; otherwise, without this first Hadamard layer, it will never converge.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Having a readout bit that can measure the ansatz, and following the QNN paper, one defines: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;loss&lt;span class=&quot;math-container&quot;&gt;$(\theta,z) = 1 - l(  )(\phi)$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P(\phi)$&lt;/span&gt; is the result of measuring the output of the readout bit as you change &lt;span class=&quot;math-container&quot;&gt;$\beta, \gamma$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; is the label of quantum bit. It turns out that for the purposes of implementation this relation can be stated as: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;loss&lt;span class=&quot;math-container&quot;&gt;$(\theta,z) \approx 1 - [(\phi)]^2$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have applied this technique to this circuit, and while for some cases the technique performs well, I see some instances this output: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4UBqF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4UBqF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plot on the left shows the loss function as parameters in circuit are variated; Plot on the right shows the state of readout bit under optimization process. Presumably, since the readout bit after X-gate is converted to |1&gt;, the minimization of the loss measured in this system will return the readout bit to this state. That said, if you find this assumption also questionable, please let me know. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it can get much worse: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ucAWt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ucAWt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, here are my questions: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Clearly the loss function shows something is not right with this setup. Granted, the circuit itself can be flawed, I for one I am not sure if acting Pauli-X on the readout bit and then n-toffoli gate was the right thing to do. That said, I am not sure about that after this results. How do you &quot;debug&quot; a circuit with this in mind? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As a general question, given that from this toy-model it is clear that one cannot willy-nilly apply QNN to any random circuit, what is the criteria, if any, Hamiltonian / random quantum circuit, must have to be worth applying this technique. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are there any better ways to extract information of the circuit for an optimization method than the n-toffoli approached I took? For example, I know it is a silly question, but can you illustrate how useful it can be to apply measurement gates to all the qubits? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose you are shown this picture of the circuit, how can one take the circuit layout and go back to the Hamiltonian for the circuit? I ask because I am both fascinated and a bit confused about how can the Ising, Hubbard-fermi, among many others, are represented by a hamiltonian that can also be expressed as a quantum circuit through an ansatz.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Just for reference, optimization algorithm I implemented is the one discussed on Farhi et al but with the modification of Adam to SGD. On a &lt;a href=&quot;https://arxiv.org/abs/1906.06329&quot; rel=&quot;nofollow noreferrer&quot;&gt; paper out of Google X&lt;/a&gt; last two weeks ago they shown it could successfully be applied for machine learning applications on both quantum circuits but also Tensor Networks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry for the long post. Thank you for reading, and thanks in advance for your feedback.&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2019-06-29T01:15:39.653" LastActivityDate="2019-06-29T01:15:39.653" Title="Quantum Optimization via Quantum Label Classification in Quantum Circuits" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;&lt;cirq&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6619" PostTypeId="2" ParentId="6615" CreationDate="2019-06-27T07:02:34.593" Score="4" Body="&lt;p&gt;Define the states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_t\rangle=\left\{\begin{array}{cc}&#xA;|t\rangle\otimes(U_{t-1}U_{t-2}\ldots U_1|\psi\rangle) &amp;amp; t=1,2,\ldots T \\&#xA;|t\rangle\otimes(U_{T}U_{T-1}\ldots U_1|\psi\rangle) &amp;amp; t=T+1,T+2,\ldots 2T \\&#xA;|t\rangle\otimes(U_{3T+1-t}U_{3T-t}\ldots U_1|\psi\rangle) &amp;amp; t=2T+1,2T+2,\ldots 3T&#xA;\end{array}\right.&#xA;$$&lt;/span&gt;&#xA;Now let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\frac{2}{T}\sum_{t=1}^{T}|t+1\rangle\langle t|\otimes U_t+|t+T+1\rangle\langle t+T|\otimes I+|t+2T+1\text{ mod }3T\rangle\langle t + 2T|\otimes U^\dagger_{3T+1-t}.&#xA;$$&lt;/span&gt;&#xA;You can verify that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi_t\rangle=|\psi_{t+1}\rangle&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$t=1,2,\ldots 3T-1$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi_{3T}\rangle=|\psi_1\rangle.&#xA;$$&lt;/span&gt;&#xA;So, basically, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts as a cyclic permutation through the states &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_t\rangle\}$&lt;/span&gt;. Act &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times, (i.e. apply &lt;span class=&quot;math-container&quot;&gt;$U^k$&lt;/span&gt;) and you go from any &lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi_{t+k}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you start in &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and enact any &lt;span class=&quot;math-container&quot;&gt;$U^k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=T,T+1,\ldots 2T-1$&lt;/span&gt;, you get an outcome for which the second register is the same,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{T}U_{T-1}\ldots U_1|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;This idea is hence that the &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; etc can be thought of as the individual unitaries of an arbitrary quantum computation of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; steps, and that this state is the overall output of the computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper then goes on to talk about implementing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=I-Ue^{-1/T},&#xA;$$&lt;/span&gt;&#xA;and it's &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; you're trying to calculate. Using a Taylor expansion, this would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A^{-1}=\sum_tU^te^{-t/T}&#xA;$$&lt;/span&gt;&#xA;So, this includes &lt;span class=&quot;math-container&quot;&gt;$t=T$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2T-1$&lt;/span&gt; with high (enough) probability, meaning that the act of the inversion effectively gives us the outcome of a quantum computation. If it can calculate the act of any quantum computer, the computation is at least as hard as the hardest thing a quantum computer can calculate, so the computation is BQP-hard. Since it can be completed on a quantum computer, the calculation is in BQP, and hence the overall classification is BQP-complete. &lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-27T07:02:34.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6620" PostTypeId="1" AcceptedAnswerId="6621" CreationDate="2019-06-27T12:43:47.180" Score="1" ViewCount="90" Body="&lt;p&gt;Note: This question is a follow up of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5058/approximating-unitary-matrices&quot;&gt;Approximating unitary matrices&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The decompositions provided in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5058/approximating-unitary-matrices&quot;&gt;Approximating unitary matrices&lt;/a&gt; are correct and worked for me without problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am now facing an issue: I want to try to optimise my circuit, and the method I want to use restricts the gate-set I can afford to use. The solution given in the previous post is no longer usable for me, because the gate-set I can use does not contain all the gates used in the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is the following: I need to approximate the following quantum gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$W = &#xA;\begin{pmatrix} &#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0\\&#xA;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{-1}{\sqrt{2}}&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;with the gate-set &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left\{ H, X, R_\phi, \text{C}R_\phi, R_z, \text{C}R_z, \text{C}X, \text{CC}X \right\}&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$R_\phi$&lt;/span&gt; defined as in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Phase_shift_(%7F&amp;#39;%22%60UNIQ--postMath-00000030-QINU%60%22&amp;#39;%7F)_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; the rotation around the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-axis and &lt;span class=&quot;math-container&quot;&gt;$\text{C}$&lt;/span&gt; being a control (i.e. &lt;span class=&quot;math-container&quot;&gt;$\text{CC}X$&lt;/span&gt; is the Toffoli gate, or double-controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As shown by @Craig Gidney in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5061/1386&quot;&gt;his answer&lt;/a&gt;, this boils down to implement a controlled-&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate with my gate-set, or equivalently a &lt;span class=&quot;math-container&quot;&gt;$R_y\left( \frac{\pi}{4} \right)$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would love to have an exact decomposition, that is why I already tested:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the following formula &#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = e^{i\alpha} R_z(\beta) R_y(\gamma) R_z(\lambda).$$&lt;/span&gt;&#xA;As I only need to implement &lt;span class=&quot;math-container&quot;&gt;$R_y\left( \frac{\pi}{4}\right)$&lt;/span&gt; I replaced &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; and searched for values of &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; that would result in a gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that I can implement easily with my gate-set. I did not succeed, but finding a solution to this alternative problem would solve my original problem as the equation above is equivalent to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_y(\gamma) = e^{-i\alpha} R_z(-\beta) U R_z(-\lambda)$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; is in my gate-set.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Trying to find a decomposition by playing with matrices, this approach did not work either, mostly because it was more random tries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I no exact decomposition exist, I will end up using an algorithm like Solovay-Kitaev or Group Leader Optimisation, but introducing errors in this gate is a real issue as it is used extensively in all the quantum circuit.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-06-27T12:55:43.737" Title="Approximating unitary matrices -- restricted gateset" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6621" PostTypeId="2" ParentId="6620" CreationDate="2019-06-27T12:55:43.737" Score="3" Body="&lt;p&gt;You would be better off trying to write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y(\pi/4)=e^{i\alpha}R_z(\beta)R_x(\gamma)R_z(\delta)=e^{i\alpha}R_z(\beta)HR_z(\gamma)HR_z(\delta)&#xA;$$&lt;/span&gt;&#xA;and solving for the parameters in there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, what you're essentially interested in is &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z}R_x(\pi/4)\sqrt{Z}^\dagger$&lt;/span&gt;, up to some possible phases. Hopefully that indicates what angles of rotation you're going to be wanting.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-27T12:55:43.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6622" PostTypeId="1" CreationDate="2019-06-27T14:50:37.827" Score="4" ViewCount="387" Body="&lt;p&gt;So I'm currently working on a little program to measure how long the coherence time of a qubit is. Basically the idea is to initialise a qubit with a X or H gate then stick in a varying amount of identity gates (as I haven't been able to find any sort of delay gate/function) and just see how many identity gates it takes before the state decoheres to something unrecognisable (adding another H gate on the end for T2 measurement). So 2 questions off that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there some sort of wait function or gate so I don't need to use Identity gates, as I know they will add more noise?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a way to measure the time taken to run on the circuit. Either the time per shot or a time taken running all the shots?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I know that result().get_data() has a time to run but that is the total time, including set up and all the other stuff, not the time just spent on processing the circuit itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And yes I do also know that the last calibration values for T1 and T2 are easily available, this is just for my own interest in doing it.&lt;/p&gt;&#xA;" OwnerUserId="7788" LastEditorUserId="55" LastEditDate="2021-04-23T08:56:35.327" LastActivityDate="2021-04-23T08:56:35.327" Title="Measuring Coherence Length for T1 and T2 values with IBMQ Experience" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;decoherence&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6623" PostTypeId="2" ParentId="6591" CreationDate="2019-06-27T16:54:10.670" Score="2" Body="&lt;p&gt;Well first you will have to specify the MST in a QUBO/Ising formulation. &lt;a href=&quot;https://arxiv.org/pdf/1302.5843.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;In this article showing formulations for different types of problems&lt;/a&gt;, section 8.1 is about the MST with a maximal degree constraint. &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1742-6596/681/1/012005/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; contains results of Spanning Tree calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have the formulation, you map it on the Chimera Graph if the hardware size is not limiting. Otherwise, one would try a divide and conquer approach to solve the optimization problem.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2019-06-27T16:54:10.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6624" PostTypeId="1" CreationDate="2019-06-27T17:22:23.247" Score="3" ViewCount="152" Body="&lt;p&gt;I am trying to find a nice way to represent the square root of an arbitrary single qubit unitary to implement Lemma 6.1 from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the Euler angles: &lt;span class=&quot;math-container&quot;&gt;$R_z(a)R_y(b)R_z(c) = \left(R_z\left(a'\right)R_y\left(b'\right)R_z\left(c'\right)\right)^2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a closed form expression that relates the angles &lt;span class=&quot;math-container&quot;&gt;$a',\, b',\, c'$&lt;/span&gt; to the angles &lt;span class=&quot;math-container&quot;&gt;$a,b,c$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried some simultaneous equations after I do the Euler angle exchange to have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_z(a)R_y(b)R_z(c) = R_z(a') [R_z(A)R_y(B)R_z(C)] R_z(c')$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A,B,C$&lt;/span&gt; can be related to &lt;span class=&quot;math-container&quot;&gt;$a,b,c$&lt;/span&gt; via some nasty expressions found eg. on p4 of &lt;a href=&quot;https://arxiv.org/abs/1812.09114&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But from there I cannot find a closed form expression for all of &lt;span class=&quot;math-container&quot;&gt;$a',b',c'$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like the sort of problem that must have been solved before - or at least it must be known whether a nice relation exists - but I cannot find work on it. Is it possible to go via quaternions or something?&lt;/p&gt;&#xA;" OwnerUserId="7883" LastEditorUserId="23" LastEditDate="2019-06-28T08:33:49.183" LastActivityDate="2019-06-28T09:16:02.420" Title="Calculate the square root of Euler angles" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6625" PostTypeId="2" ParentId="6624" CreationDate="2019-06-28T06:24:55.640" Score="1" Body="&lt;p&gt;If it were me, I'd go via the fact that you can describe any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=e^{i\alpha}e^{\theta\underline{n}\cdot\underline{\sigma}}.&#xA;$$&lt;/span&gt;&#xA;There are already questions on Stack Exchange about how to set up the relation between the Euler angles and this Bloch vector representation (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2513/the-general-form-of-unitary-operations-on-a-single-qubit&quot;&gt;this one&lt;/a&gt; gets you most of the way there). The point is that the square root is easy to take in this representation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{U}=e^{i\alpha/2}e^{\frac{\theta}{2}\underline{n}\cdot\underline{\sigma}}&#xA;$$&lt;/span&gt;&#xA;from which you can calculate the Euler angles. I doubt the relation is going to be particularly nice (as you can perhaps tell, because I'm not giving you the answer directly), except in exceptional circumstances such as when the rotation is about an axis of the form &lt;span class=&quot;math-container&quot;&gt;$(n_x,n_y,0)$&lt;/span&gt; (in which case you'll have &lt;span class=&quot;math-container&quot;&gt;$c=-a=c'=-a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b'=b/2$&lt;/span&gt;) &lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-28T06:24:55.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6627" PostTypeId="2" ParentId="6624" CreationDate="2019-06-28T09:16:02.420" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6625/23&quot;&gt;DaftWullie's answer&lt;/a&gt; certainly does the job but there are also other methods:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you can perform an eigendecomposition: for &lt;span class=&quot;math-container&quot;&gt;$$\Lambda = \begin{pmatrix}\lambda_+&amp;amp;0\\0&amp;amp;\lambda_-\end{pmatrix} = \begin{pmatrix}e^{i\phi_+}&amp;amp;0\\0&amp;amp;e^{i\phi_-}\end{pmatrix}$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$V = \begin{pmatrix}v_+&amp;amp;v_+\end{pmatrix},$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda_\pm$&lt;/span&gt; are the eigenvalues and &lt;span class=&quot;math-container&quot;&gt;$v_\pm$&lt;/span&gt; the corresponding eigenvectors, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$U = V\Lambda V^\dagger$&lt;/span&gt; and the square root of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$U = V\sqrt{\Lambda}V^\dagger$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is also unitary and &lt;span class=&quot;math-container&quot;&gt;$$\sqrt{\Lambda} = \begin{pmatrix}\sqrt{\lambda_+}&amp;amp;0\\0&amp;amp;\sqrt{\lambda_-}\end{pmatrix} = \begin{pmatrix}e^{\frac{1}{2}i\phi_+}&amp;amp;0\\0&amp;amp;e^{\frac{1}{2}i\phi_-}\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another method, adapted from &lt;a href=&quot;https://en.wikipedia.org/wiki/Square_root_of_a_2_by_2_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Wiki page&lt;/a&gt; is that, denoting &lt;span class=&quot;math-container&quot;&gt;$$U = \begin{pmatrix}\alpha&amp;amp;\beta\\-e^{i\varphi}\beta^*&amp;amp;e^{i\varphi}\alpha^*\end{pmatrix}$$&lt;/span&gt; for an arbitrary unitary (special unitary when &lt;span class=&quot;math-container&quot;&gt;$\varphi = 0, 2\pi$&lt;/span&gt;) transformation, which has determinant &lt;span class=&quot;math-container&quot;&gt;$e^{i\varphi}$&lt;/span&gt; and trace &lt;span class=&quot;math-container&quot;&gt;$\alpha+e^{i\varphi}\alpha^*$&lt;/span&gt;, a square root of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written as (when &lt;span class=&quot;math-container&quot;&gt;$\alpha+e^{i\varphi}\alpha^*+2e^{\frac{i}{2}\varphi}\neq0$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{\alpha+e^{i\varphi}\alpha^*+2e^{\frac{i}{2}\varphi}}}\left(U+e^{\frac{i}{2}\varphi}I_2\right) = \frac{1}{\sqrt{\alpha+e^{i\varphi}\alpha^*+2e^{\frac{i}{2}\varphi}}}\begin{pmatrix}\alpha+e^{\frac{i}{2}\varphi}&amp;amp;\beta\\-e^{i\varphi}\beta^*&amp;amp;e^{i\varphi}\alpha^*+e^{\frac{i}{2}\varphi}\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my (relatively limited) experience this is the simplest form I've seen and so, is the one I use most often.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-06-28T09:16:02.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6628" PostTypeId="1" AcceptedAnswerId="6743" CreationDate="2019-06-28T11:44:34.347" Score="2" ViewCount="114" Body="&lt;p&gt;Chapter 6.3 of &quot;Quantum Computation and Quantum Information 10th Anniversary Edition&quot; textbook by Nielsen and Chuang talks about using the Quantum Counting Algorithm to find the number of solutions to the Quantum Search Algorithm before actually implementing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a search space of size &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; number of solutions, the number of Grover iterations &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;  required to obtain the state of solutions is upper bounded by (Eqn 6.17):  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R \leq \lceil\frac{\pi}{4}\sqrt{2N/M}\space\rceil $$&lt;/span&gt;  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;At the last paragraph of this chapter, they stated that the angular error after the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; number of Grover iterations is at most &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$\pi/4(1+|\Delta\theta|/\theta)$&lt;/span&gt;&lt;/strong&gt;. I think that this means:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Delta\theta| R \leq |\Delta\theta|\lceil\frac{\pi}{4}\sqrt{2N/M}\space\rceil = \pi/4(1+|\Delta\theta|/\theta) $$&lt;/span&gt;   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta/2)=\frac{M}{2N}$&lt;/span&gt;, so I tried to use substitution in the attempt to get the stated angular error. This is what I got:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Delta\theta| R \leq |\Delta\theta| \space \lceil \frac{\pi}{4}\frac{1}{\sin(\theta/2)} \rceil $$&lt;/span&gt;   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can someone explain to me how to get the stated angular error?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="26" LastEditDate="2019-10-14T16:14:19.873" LastActivityDate="2019-10-14T16:14:37.640" Title="Angular Error associated with Quantum Search Algorithm" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6629" PostTypeId="1" AcceptedAnswerId="6630" CreationDate="2019-06-29T07:24:06.833" Score="3" ViewCount="662" Body="&lt;p&gt;I realize that fundamentally speaking quantum and classical computers might as well be apples and oranges, and that for very specific problems such as integer factorization with Shor's algorithm quantum computers blow conventional computers out of the water, but could a quantum computer run classical algorithms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, using a comparable classical computer, how would the calculation speed of a quantum computer running a classical algorithm compare to the calculation speed of the classical computer?&lt;/p&gt;&#xA;" OwnerUserId="7892" LastActivityDate="2019-06-29T09:42:48.160" Title="Can a quantum computer run classical algorithms?" Tags="&lt;classical-computing&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6630" PostTypeId="2" ParentId="6629" CreationDate="2019-06-29T09:42:48.160" Score="6" Body="&lt;p&gt;Quantum computers can run classical computations using exactly the same algorithms, and hence have the same running time in terms of scaling. For example, if you look at shor’s algorithm, a major component of that is modular exponentiation, but nobody ever draws the circuit because they just say “use the classical algorithm”.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of absolute running time, that is heavily hardware dependant so you can’t make comparisons so easily.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computers offer the possibility of other algorithms in addition to the classical ones that could be faster, but there’s no standard method for generating an improvement.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-06-29T09:42:48.160" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6631" PostTypeId="1" CreationDate="2019-06-29T14:13:53.470" Score="11" ViewCount="187" Body="&lt;p&gt;Suppose I want to obtain a gate sequence representing a particular 1 qubit unitary matrix.&#xA;The gate set is represented by a discrete universal set, e.g. Clifford+T gates or &lt;span class=&quot;math-container&quot;&gt;$\{T,H\}$&lt;/span&gt; gates.&#xA;A well known approach to solve the problem is to use Solovay-Kitaev (SK) algorithm.&#xA;I tried &lt;a href=&quot;https://github.com/cryptogoth/skc-python&quot; rel=&quot;noreferrer&quot;&gt;this implementation&lt;/a&gt; for SK algorithm. The resulting circuits are incredibly long (&lt;span class=&quot;math-container&quot;&gt;$l\sim 100-1000$&lt;/span&gt; gates for the Fowler distance &lt;span class=&quot;math-container&quot;&gt;$\epsilon \sim 0.01$&lt;/span&gt;, tolerance error for the basic approximation &lt;span class=&quot;math-container&quot;&gt;$\epsilon\sim 0.03$&lt;/span&gt;). Moreover the basic approximation (building a KD-tree) can take quite long time (although this might be due to somewhat slow Python code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand I wrote a very simple script that generates random sequences of gates and selects the best performing circuits. It works very fast and results in much shorter circuits with Fowler distances &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;lt; 10^{-4}-10^{-5}$&lt;/span&gt;. This should be more than sufficient for any realistic applications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, at this point I don't quite understand, what is practical significance of Solovay-Kitaev algorithm in this case (for 1 qubit operations)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the theoretical scaling of SK algorithm looks pretty good. The number of gates generated by SK algorithm to approximate any 1 qubit unitary grows as &lt;span class=&quot;math-container&quot;&gt;$l\sim\log^c(1/\delta)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is L2 approximation error. For random sampling there are no such guarantees. However on practice I'm not convinced that SK is very useful for 1 qubit case.&#xA;No doubts that in the case of large number of qubits random sampling will fail because of the curse of dimensionality. But it seems that SK algorithm also quickly becomes computationally unfeasible (&lt;span class=&quot;math-container&quot;&gt;$\#$&lt;/span&gt; of qubits &lt;span class=&quot;math-container&quot;&gt;$\geq 4$&lt;/span&gt;?). &lt;/p&gt;&#xA;" OwnerUserId="7896" LastEditorUserId="55" LastEditDate="2019-07-03T08:40:20.463" LastActivityDate="2021-02-11T13:42:02.737" Title="Sampling random circuits vs Solovay-Kitaev compiler" Tags="&lt;quantum-state&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;&lt;solovay-kitaev-algorithm&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6632" PostTypeId="1" CreationDate="2019-06-29T18:35:26.353" Score="3" ViewCount="76" Body="&lt;p&gt;The no-cloning theorem can be sharpened to give quantitative bounds on the fidelity with which an arbitrary quantum state can be copied. Is there a similar picture available for classical copying? This breaks down into two&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In classical physics, do there exist limitations on copying? For instance, I might speculate that it's possible to make copies of a classical state down to any desired resolution, but guess that some minimum amount of energy &lt;span class=&quot;math-container&quot;&gt;$E(n)$&lt;/span&gt; is required to copy &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of information, and that &lt;span class=&quot;math-container&quot;&gt;$E(n)$&lt;/span&gt; diverges as &lt;span class=&quot;math-container&quot;&gt;$n \to \infty$&lt;/span&gt; (probably &lt;span class=&quot;math-container&quot;&gt;$E(n)$&lt;/span&gt; is also dependent on other parameters such as temperature). Such a limit would presumably be closely related to &lt;a href=&quot;https://en.wikipedia.org/wiki/Landauer%27s_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Landauer's Principle&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;An actual classical system is just an approximation of a quantum system. So it seems natural to speculate that there's some way to quantify &quot;how far a system is from being classical&quot;, and bound the fidelity with which the system can copy information based on this measure. What is the key parameter here? Does it have to do with how big the Hilbert space for the &quot;environment&quot; is? Or with measures of decoherence?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A guess:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part of the problem is that I don't actually know how to formalize the notion of &quot;classical information&quot; in a quantum system. But here's a shot at something like (2). Define a classical copier to be an operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$V \otimes V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$H(e_i \otimes v) = e_i \otimes e_i$&lt;/span&gt; for some specified basis &lt;span class=&quot;math-container&quot;&gt;$e_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. One operates &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; by preparing the system so that the input is known to be collapsed to some &lt;span class=&quot;math-container&quot;&gt;$e_i \otimes v$&lt;/span&gt; before applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (by measuring some &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt;). Then it seems like one would quantify the limits of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as a copier in terms of how precisely the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; actually lines up with the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; (since in practice it's impossible to make them match up perfectly) and then applying the usual quantitative version of the no-cloning theorem.&lt;/p&gt;&#xA;" OwnerUserId="7716" LastEditorUserId="7716" LastEditDate="2019-06-30T16:42:46.083" LastActivityDate="2019-07-02T06:15:04.127" Title="Classical and quantum limits to classical copying?" Tags="&lt;classical-computing&gt;&lt;no-cloning-theorem&gt;&lt;classical-quantum&gt;&lt;cloning&gt;&lt;nonclassicality&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6633" PostTypeId="1" CreationDate="2019-06-29T19:33:25.217" Score="3" ViewCount="22" Body="&lt;p&gt;Synchronous Interactions Between Quantum and Macroscopic Systems&#xA;Lester Ingber&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This project calculates synchronous quantum systems and macroscopic systems with well-defined interactions.  I would like information about any other similar projects that might guide this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This project was mapped out in several publications, recently in&#xA;L. Ingber, ``Quantum calcium-ion interactions with EEG,'' Sci 1 (7), 1-21 (2018). [ URL &lt;a href=&quot;https://www.ingber.com/smni18_quantumCaEEG.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ingber.com/smni18_quantumCaEEG.pdf&lt;/a&gt; and &lt;a href=&quot;https://doi.org/10.3390/sci1010020&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.3390/sci1010020&lt;/a&gt; ]&#xA;which was performed with the help of XSEDE.org supercomputer resources from Feb 2013 through Dec 2018.  The Abstract is given below, and that Conclusion is the starting point of this project.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This project would use quantum computing in one or both contexts:&#xA;(a) to perform the optimization of the cost/objective function over the space of parameters defined by the SMNI model with EEG data as input.&#xA;(b) to propagate the Ca2+ wave function between EEG epochs in lock-step with the changing magnetic vector potential defined by highly synchronous neuronal firings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Background:&#xA;Previous papers have developed a statistical mechanics of neocortical interactions (SMNI) fit to short-term memory and EEG data.  Adaptive Simulated Annealing (ASA) has been developed to perform fits to such nonlinear stochastic systems.  An N-dimensional path-integral algorithm for quantum systems, qPATHINT, has been developed from classical PATHINT.  Both fold short-time propagators (distributions or wave functions) over long times.  Previous papers applied qPATHINT to two systems, in neocortical interactions and financial options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Objective:&#xA;In this paper the quantum path-integral for Calcium ions is used to derive a closed-form analytic solution at arbitrary time that is used to calculate interactions with classical-physics SMNI interactions among scales.  Using fits of this SMNI model to EEG data, including these effects, will help determine if this is a reasonable approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method:&#xA;Methods of mathematical-physics for optimization and for path integrals in classical and quantum spaces are used for this project.  Studies using supercomputer resources tested various dimensions for their scaling limits.  In this paper the quantum path-integral is used to derive a closed-form analytic solution at arbitrary time that is used to calculate interactions with classical-physics SMNI interactions among scales.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Results:&#xA;The mathematical-physics and computer parts of the study are successful, in that there is modest improvement of cost/objective functions used to fit EEG data using these models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conclusion:&#xA;This project points to directions for more detailed calculations using more EEG data and qPATHINT at each time slice to propagate quantum calcium waves, synchronized with PATHINT propagation of classical SMNI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&#xA;Lester Ingber&#xA;ingber@alumni.caltech.edu&lt;/p&gt;&#xA;" OwnerUserId="4350" LastActivityDate="2019-06-29T19:33:25.217" Title="Synchronous Interactions Between Quantum and Macroscopic Systems" Tags="&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6634" PostTypeId="1" AcceptedAnswerId="6647" CreationDate="2019-06-30T05:30:40.317" Score="4" ViewCount="394" Body="&lt;p&gt;I know this question has been answered &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3770/toffoli-gate-as-fanout&quot;&gt;here&lt;/a&gt;, but the answers leave some things confusing to me. When broken down (and used to calculate), the idea that the states are entangled doesn't seem to be right. I'm sure there is a mistake in my reasoning, but I'm not sure where. Here goes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say we take qubits in states &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b|1\rangle$&lt;/span&gt; and send them through a CNOT gate, which looks like this, the gate on the bottom being an XOR (that outputs 1 if the inputs are not the same binary value).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kHu5I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kHu5I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we use a fanout, which, according to other answers, leaves us with two qubits in state &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle + b|11\rangle$&lt;/span&gt;. The set of three qubits, before two are passed through the XOR gate, can be expressed as &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle\otimes|0\rangle + b|11\rangle\otimes|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we put this through the XOR gate, there is probability &lt;span class=&quot;math-container&quot;&gt;$a^2$&lt;/span&gt; that the qubit will be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; which would result in an output of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. This means that exiting the gate, the probability amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. There is probability &lt;span class=&quot;math-container&quot;&gt;$b^2$&lt;/span&gt; that the qubit will be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; so the probability amplitude of getting &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as the second ouput is &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. So our qubit is in state &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b|1\rangle$&lt;/span&gt;, a clone of the original state. We now have two qubits in this state, as the first one comes out of the first output unchanged. As far as I can tell, they are not entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, there is something wrong in this logic, I just don't know where. Could someone help me out?&lt;/p&gt;&#xA;" OwnerUserId="7902" LastEditorUserId="7902" LastEditDate="2019-06-30T17:51:50.967" LastActivityDate="2019-07-01T06:41:58.230" Title="Why can't a fanout be made with a CNOT gate?" Tags="&lt;quantum-gate&gt;&lt;no-cloning-theorem&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6635" PostTypeId="1" AcceptedAnswerId="6637" CreationDate="2019-06-30T07:45:17.900" Score="3" ViewCount="188" Body="&lt;p&gt;It appears to me that a &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22%E2%80%A2%22,%22%E2%80%A2%22,%22H%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22H%22]],%22init%22:[%22i%22,%22+%22,1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;ccH, ccX and ccH&lt;/a&gt; sequence is exactly equivalent to a &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,%22%E2%80%A2%22,%22H%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,%22%E2%80%A2%22,%22H%22]],%22init%22:[%22i%22,%22+%22,1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;cH, ccX and cH&lt;/a&gt; gate sequence. Is there any quick way to see/verify this?&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-06-30T11:47:42.860" Title="Is a ccH, ccX and ccH equivalent to a cH, ccX and cH sequence?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6636" PostTypeId="2" ParentId="6635" CreationDate="2019-06-30T11:31:37.823" Score="2" Body="&lt;p&gt;There is a way to simplify it down slightly - for some controlled unitary &lt;span class=&quot;math-container&quot;&gt;$C\left(U\right)=I\oplus U$&lt;/span&gt; and some arbitrary unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; (of the same dimension as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$$\left(I\otimes V\right).C\left(U\right).\left(I\otimes V^\dagger\right) = \begin{pmatrix}V&amp;amp;0\\0&amp;amp;V\end{pmatrix}\begin{pmatrix}I&amp;amp;0\\0&amp;amp;U\end{pmatrix}\begin{pmatrix}V^\dagger&amp;amp;0\\0&amp;amp;V^\dagger\end{pmatrix} = C\left(VUV^\dagger\right),$$&lt;/span&gt; so it's now clear that &lt;span class=&quot;math-container&quot;&gt;$\left[I\otimes C\left(H\right)\right].C\left(C\left(X\right)\right).\left[I\otimes C\left(H\right)\right] = C\left(C\left(H\right).C\left(X\right).C\left(H\right)\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Funnily enough, if instead of using &lt;span class=&quot;math-container&quot;&gt;$I\otimes V$&lt;/span&gt; in the above and instead used &lt;span class=&quot;math-container&quot;&gt;$C\left(V\right)$&lt;/span&gt;, we'd find that &lt;span class=&quot;math-container&quot;&gt;$$C\left(V\right).C\left(U\right).C\left(V^\dagger\right) = \begin{pmatrix}I&amp;amp;0\\0&amp;amp;V\end{pmatrix}\begin{pmatrix}I&amp;amp;0\\0&amp;amp;U\end{pmatrix}\begin{pmatrix}I&amp;amp;0\\0&amp;amp;V^\dagger\end{pmatrix} = C\left(VUV^\dagger\right)$$&lt;/span&gt; and so it's not just clear that &lt;span class=&quot;math-container&quot;&gt;\begin{align*}C\left(C\left(H\right)\right).C\left(C\left(X\right)\right).C\left(C\left(H\right)\right) &amp;amp;= C\left(C\left(H\right).C\left(X\right).C\left(H\right)\right) \\ &amp;amp;=\left[I\otimes C\left(H\right)\right].C\left(C\left(X\right)\right).\left[I\otimes C\left(H\right)\right]\end{align*}&lt;/span&gt; but the more general version &lt;span class=&quot;math-container&quot;&gt;$$\left(I\otimes V\right).C\left(U\right).\left(I\otimes V^\dagger\right) = C\left(V\right).C\left(U\right).C\left(V^\dagger\right)$$&lt;/span&gt; is also true, for any unitaries &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;My use of brackets in the control operation is maybe slightly more unusual, but hopefully it makes it more obvious what the operation is&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-06-30T11:31:37.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6637" PostTypeId="2" ParentId="6635" CreationDate="2019-06-30T11:42:42.427" Score="4" Body="&lt;p&gt;Start&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZKbAe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZKbAe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No control equals each control &lt;span class=&quot;math-container&quot;&gt;$\forall U : U = C(U) \cdot \bar{C}(U)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sozOZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sozOZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Opposite controls commute &lt;span class=&quot;math-container&quot;&gt;$\forall U, V : [C(U), \bar{C}(V)] = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bKMBj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bKMBj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No control equals each control &lt;span class=&quot;math-container&quot;&gt;$\forall U : U = C(U) \cdot \bar{C}(U)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hkl5F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hkl5F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Self-inverse operations self-cancel&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NOZM5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NOZM5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Done&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, for any &quot;V conjugated by U&quot; operation of the form &lt;span class=&quot;math-container&quot;&gt;$U_a \cdot C_b(V_a) \cdot  U_a^{-1}$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation can gain or lose any controls that &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; has without changing the circuit's effect.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-06-30T11:47:42.860" LastActivityDate="2019-06-30T11:47:42.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6638" PostTypeId="2" ParentId="6634" CreationDate="2019-06-30T13:10:26.923" Score="2" Body="&lt;p&gt;I'm a little confused about which gates operate on which qubits and how, but following the linked question, I think I understand that you are wondering why, given a single qubit in the state in &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle+b|1\rangle$&lt;/span&gt; and preparing two qubits in a state &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle+b|11\rangle$&lt;/span&gt; does not qualify as cloning the first bit, especially because the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on the second bit is exactly the same as that of the first bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important answer which must be stressed is that the second qubit is not so much a copy of the first qubit, as it is &lt;em&gt;entangled&lt;/em&gt; with the first qubit - they are &lt;em&gt;married&lt;/em&gt; together (in a non-classical way.)  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might be an oversimplification, but cloning is classical, entangling is quantum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best example of the difference between &lt;em&gt;cloning&lt;/em&gt; and &lt;em&gt;entangling&lt;/em&gt; that I can think of would be that Eve the eavesdropper can follow your scheme to &lt;em&gt;entangle&lt;/em&gt; qubits sent in a &lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;nofollow noreferrer&quot;&gt;BB84 channel&lt;/a&gt; between Alice and Bob, but she would not be able to deduce the secret key based on such entanglement, without getting noticed by Alice/Bob.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-06-30T13:10:26.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6639" PostTypeId="1" CreationDate="2019-06-30T15:11:49.213" Score="16" ViewCount="9329" Body="&lt;p&gt;I am a first-year undergraduate electrical engineering student. I want to study quantum computing and quantum AI in the future and also possibly work on building quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have finished Strang's &lt;em&gt;Introduction to Linear Algebra&lt;/em&gt; twice and Axler's &lt;em&gt;Linear Algebra Done Right&lt;/em&gt;. I have finished MIT OCW 6.041 Probability Course. I know Calculus 1, 2, and 3 and Differential Equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have 2 questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is my background sufficient for studying quantum computing?&lt;/li&gt;&#xA;&lt;li&gt;Where should I start/which materials do you suggest?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7904" LastEditorUserId="26" LastEditDate="2019-10-14T16:02:51.797" LastActivityDate="2021-05-03T16:09:47.280" Title="Is my background sufficient to start quantum computing?" Tags="&lt;resource-request&gt;" AnswerCount="10" CommentCount="7" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6640" PostTypeId="2" ParentId="6604" CreationDate="2019-06-30T15:34:17.810" Score="1" Body="&lt;p&gt;It appears that you are asking for details about the following circuit from the paper of Cherkas and Chivilikhin, that they describe as implementing the addition of two &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-bit numbers.  Although they don't say it, I believe this is (mod 4).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VvRGS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VvRGS.png&quot; alt=&quot;Quantum Fourier Transform-based Adder Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first application of &lt;span class=&quot;math-container&quot;&gt;$R_1$&lt;/span&gt; is controlled on the basis of &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt;, the second &lt;span class=&quot;math-container&quot;&gt;$R_2$&lt;/span&gt; is controlled on the basis of &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt;, and the third is controlled on &lt;span class=&quot;math-container&quot;&gt;$a_2$&lt;/span&gt;.  When we say we apply &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt;, we are applying either &lt;span class=&quot;math-container&quot;&gt;$R_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_2$&lt;/span&gt;.  Thus the angle of rotation is dependent on &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that the first number is &lt;span class=&quot;math-container&quot;&gt;$a=(a_1,a_2)$&lt;/span&gt; having the most significant bit be &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt; and the least significant bit &lt;span class=&quot;math-container&quot;&gt;$a_2$&lt;/span&gt;, while the second number is similarly &lt;span class=&quot;math-container&quot;&gt;$b=(b_1,b_2)$&lt;/span&gt;. That is, I think you fourth question is correct, but I'm not sure if your third question is the right understanding.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-06-30T15:34:17.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6641" PostTypeId="1" CreationDate="2019-06-30T15:50:25.747" Score="2" ViewCount="78" Body="&lt;p&gt;This question requires the knowledge of &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1090780704003696&quot; rel=&quot;nofollow noreferrer&quot;&gt;GRAPE&lt;/a&gt;. More info can be found &lt;a href=&quot;https://www.dropbox.com/s/0kgrph09ghy5p74/khaneja2005GRAPE.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and in this short &lt;a href=&quot;https://www.dropbox.com/s/huuhqwtvg1bx2ag/grape_june_2010_slides.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to modify the grape_unitary() function in &lt;a href=&quot;https://github.com/qutip/qutip/blob/master/qutip/control/grape.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;grape.py&lt;/a&gt; also to accommodate open quantum systems. One can use it to generate time varying fields for synthesising unitaries for them.&#xA;I have tried to run it for the same system as in this &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter notebook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I have run into a problem as to some sets of collapse operators give spurious overlap values.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The code seems to work well for the closed system, though it is slower than the original &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter notebook&lt;/a&gt;. &#xA;Here is the &#xA;&lt;a href=&quot;https://www.dropbox.com/sh/cag7q460a4macw6/AABxPWkpwQBfDv6pt4R2vNg5a?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;code&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;fsa.py is the file analogous to &lt;a href=&quot;https://github.com/qutip/qutip/blob/master/qutip/control/grape.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;grape.py&lt;/a&gt;. &#xA;tca.py is the example file (almost entirely based on this &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;notebook&lt;/a&gt; ) where I run it for a closed quantum system (as in the aforementioned &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;notebook&lt;/a&gt;).&#xA;otca.py, otca1.py and other otca*.py are files where I run them for various collapse operators.&#xA;tej_plotter.py is just a small python script file to save graphical representation of the final unitaries.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The explanation of the main idea is &lt;a href=&quot;https://www.dropbox.com/s/ris74oedclzm7vx/Qutip_open_grape.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. An updated version will be found &lt;a href=&quot;https://www.overleaf.com/read/bdtqzhgtdkdq&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array} {|r|r|}\hline file &amp;amp; output &amp;amp; collapse\  operator \\ \hline tca.py &amp;amp; copA0 &amp;amp; none \\ \hline otca.py &amp;amp; ocopA0 &amp;amp;  x \otimes y  \\ \hline otca1.py &amp;amp; o1copA0 &amp;amp;  x \otimes y , y \otimes z \\ \hline otca2.py &amp;amp; o2copA0 &amp;amp;  y \otimes z   \\ \hline otca3.py &amp;amp; o3copA0 &amp;amp; z \otimes x \\ \hline otca4.py &amp;amp; o4copA0 &amp;amp;  x \otimes y, z \otimes x \\ \hline otca5.py &amp;amp; o5copA0 &amp;amp;  y \otimes z,  z \otimes x \\ \hline otca6.py &amp;amp; o6copA0 &amp;amp;  x \otimes y , y \otimes z,  z \otimes x \\ \hline  \end{array}&lt;/span&gt;&#xA;I have also raised this as an &lt;a href=&quot;https://github.com/qutip/qutip/issues/1031&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt; on the QuTiP page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could this be fixed by redefining (generalising) _overlap(A, B) function in grape.py ?&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="26" LastEditDate="2019-10-14T16:08:41.310" LastActivityDate="2019-10-14T16:08:41.310" Title="Modifying GRAPE for open quantum systems" Tags="&lt;programming&gt;&lt;qutip&gt;&lt;open-quantum-systems&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6642" PostTypeId="2" ParentId="6639" CreationDate="2019-06-30T16:26:40.807" Score="1" Body="&lt;p&gt;The more you know about math, programming, quantum physics, etc. the better, but this field is new for everyone involved. We are all constantly learning so I guess you should do OK. Having said that, I would recommend you to develop your programming skills (Python is widely used in this realm) and start reading the stuff provided online by companies that are developing quantum computers such as IBM, Rigetti and D-Wave. That will get you started. Good luck.&lt;/p&gt;&#xA;" OwnerUserId="7804" LastEditorUserId="91" LastEditDate="2019-06-30T16:56:35.677" LastActivityDate="2019-06-30T16:56:35.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6643" PostTypeId="1" CreationDate="2019-06-30T17:35:30.387" Score="1" ViewCount="91" Body="&lt;p&gt;This is related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3770/toffoli-gate-as-fanout&quot;&gt;this&lt;/a&gt; but a little different, so bear with me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When is a fanout not violating the no-cloning theorem? It seems accepted that a fanout (or at least what seems to be one in my novice understanding of computing) can be used in certain instances despite this seemingly cloning the state, which I know is impossible. For example, in a CNOT gate, to use the XOR gate, which takes two inputs and outputs one, the top qubit must be duplicated. How is this possible?&lt;/p&gt;&#xA;" OwnerUserId="7902" LastEditorUserId="7902" LastEditDate="2019-06-30T21:52:34.587" LastActivityDate="2019-06-30T21:52:34.587" Title="When can a fanout be used without violating the no-cloning theorem?" Tags="&lt;no-cloning-theorem&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6644" PostTypeId="2" ParentId="6639" CreationDate="2019-06-30T22:00:13.890" Score="3" Body="&lt;p&gt;I would definitely say go for it. I have a lot less experience and math knowledge than you do, but I have been able to learn the basics. There is certainly some stuff that goes over my head, but I think you would be well prepared. The one area where you may need more study is logic and classical computer science. Having knowledge, even somewhat basic knowledge, here definitely helps. I started out with Chris Bernhardt's &lt;em&gt;Quantum Computing for Everyone&lt;/em&gt;. This may be too simple for you, but it gave me a good entry point. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, I think it's your interest and enthusiasm that matters most, so, if you're fascinated by the subject, pursue it! &lt;/p&gt;&#xA;" OwnerUserId="7902" LastActivityDate="2019-06-30T22:00:13.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6645" PostTypeId="2" ParentId="6639" CreationDate="2019-06-30T22:15:20.897" Score="16" Body="&lt;p&gt;I am working on a textbook that is currently in Early Access called &lt;a href=&quot;https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp&quot; rel=&quot;noreferrer&quot;&gt;Learn Quantum Computing with Python and Q#&lt;/a&gt;. It is intended for folks who want to learn how to program for a quantum computer, and learn the basics of how a quantum computer works along the way. Only knowledge prerequisites are programming in some language (Python helps but not really required) and the basics of Linear Algebra (multiple matrices and vectors sort of stuff). My co-author &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1978/chris-granade&quot;&gt;@chris-granade&lt;/a&gt; and I would love feedback on what is currently out on the forums associated with the book, and there are discount codes floating around for conferences and podcasts and such, hmu on dm and I can find one for ya!&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2019-06-30T22:15:20.897" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6646" PostTypeId="2" ParentId="6255" CreationDate="2019-06-30T23:35:02.980" Score="15" Body="&lt;h2&gt;Definitions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Denoting the Haar measure of some function &lt;span class=&quot;math-container&quot;&gt;$f\left(x\right)$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional unitaries as &lt;span class=&quot;math-container&quot;&gt;$\int_{\mathrm U\left(d\right)}f\left(x\right)d\mu\left(x\right)$&lt;/span&gt;, twirling some arbitrary channel &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; can be defined as the operation &lt;span class=&quot;math-container&quot;&gt;$\varepsilon \mapsto\int_{\mathrm U\left(d\right)}U^\dagger\varepsilon U dU$&lt;/span&gt;, which, when &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is acting on some density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$$\rho\mapsto\int_{\mathrm{U}(d)} U^{\dagger} \varepsilon\left(U \rho U^{\dagger}\right) U d U.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While the above applies to intergrating over the &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional unitary group, the same idea can be applied to (weighted) gatesets &lt;span class=&quot;math-container&quot;&gt;$\mathrm D_w$&lt;/span&gt;, consisting of elements of unitaries &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; along with associated probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; such that the weighted gate-set channel is &lt;span class=&quot;math-container&quot;&gt;$\mathcal U_{\mathrm D_w}:\rho\mapsto\sum_{U_i\in\mathrm D}p_iU_i\rho U_i^\dagger$&lt;/span&gt;. A special case of this are the unweighted gatesets &lt;span class=&quot;math-container&quot;&gt;$\mathrm D$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$p_i = \frac{1}{\left|\mathrm D\right|}\,\forall\, i$&lt;/span&gt;. This allows us to define the Twirling operation over a gateset as the operation &lt;span class=&quot;math-container&quot;&gt;$\varepsilon\mapsto\sum_{U_i\in\mathrm D}p_iU^\dagger_i\varepsilon U_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Pauli twirling operation is then defined as &lt;span class=&quot;math-container&quot;&gt;$\varepsilon\mapsto\sum_{P_i\in\mathrm P_n}p_iP_i\varepsilon P_i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathrm P_n$&lt;/span&gt; is the Pauli group over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, while the Clifford twirl can either be defined as &lt;span class=&quot;math-container&quot;&gt;$\varepsilon\mapsto\sum_{U_i\in\mathrm C_n}p_iU^\dagger_i\varepsilon U_i$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\varepsilon\mapsto\sum_{U_i\in\mathrm C_1^{\otimes n}}p_iU^\dagger_i\varepsilon U_i$&lt;/span&gt;.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Unitary Designs&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;There &lt;em&gt;is&lt;/em&gt; a difference between what these two twirls do and it lies in the theory of &lt;em&gt;unitary t-designs&lt;/em&gt;&lt;sup&gt;2&lt;/sup&gt;: a set &lt;span class=&quot;math-container&quot;&gt;$\mathrm D_w$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design if and only if &lt;span class=&quot;math-container&quot;&gt;$$\sum_{U\in \mathrm D}\left(U^\dagger\right)^{\otimes t}\otimes \left(U^T\right)^{\otimes t} = \int_{\mathrm U\left(d\right)}\left(V^\dagger\right)^{\otimes t}\otimes \left(V^T\right)^{\otimes t}\,dV$$&lt;/span&gt; and if &lt;span class=&quot;math-container&quot;&gt;$\mathrm D_w$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design, it's also a &lt;span class=&quot;math-container&quot;&gt;$\left(t-1\right)$&lt;/span&gt;-design for any positive integer &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. This is equivalent to the statement that &lt;span class=&quot;math-container&quot;&gt;$$\sum_{U \in D}(U)^{\otimes t} \rho\left(U^{\dagger}\right)^{\otimes t}=\int_{U(d)}(V)^{\otimes t} \rho\left(V^{\dagger}\right)^{\otimes t} d V,$$&lt;/span&gt; which gives the &lt;span class=&quot;math-container&quot;&gt;$t^{th}$&lt;/span&gt; statistical moment of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Using Schur's Lemma&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;For a pure state (density matrix) in 2 dimensions &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\int_{\mathrm U\left(d\right)} V\rho V^\dagger\,dV = \frac{1}{2}I$&lt;/span&gt; and so, this fully depolarises (i.e. maximally mixes) the state and as the single qubit Pauli twirl is also the depolarisation channel, the Pauli group is a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-design. However, by Schur's lemma, it's not a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-design. In other words, as explained in section IIA of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0611002&quot; rel=&quot;noreferrer&quot;&gt;Gross, Audenaert and Eisert&lt;/a&gt;, twirling essentially writes the state in terms of a sum of irreducible subspaces, which, for a 2D 2-design, are the symmetric &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\left(I+SWAP\right)$&lt;/span&gt; and antisymmetric &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\left(I-SWAP\right)$&lt;/span&gt; subspaces and this is &lt;em&gt;not&lt;/em&gt; what the Pauli twirl does. However, it &lt;em&gt;is&lt;/em&gt; what the Clifford twirl does. Furthermore, as shown both &lt;a href=&quot;https://arxiv.org/abs/1510.02769&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1510.02619&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, the Clifford group forms a 3-design.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Randomised Benchmarking&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This is useful and even relatively important from a quantum computing perspective when it comes to benchmarking - it turns out that &lt;a href=&quot;https://arxiv.org/abs/1208.0692&quot; rel=&quot;noreferrer&quot;&gt;local random circuits are approximate designs&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1605.00713&quot; rel=&quot;noreferrer&quot;&gt;can be created in polynomial time&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Vectorisation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This all relates to the papers linked in the question by the process of &lt;a href=&quot;https://en.wikipedia.org/wiki/Vectorization_(mathematics)&quot; rel=&quot;noreferrer&quot;&gt;vectorisation&lt;/a&gt; and the property that &lt;span class=&quot;math-container&quot;&gt;$|A B C\rangle \rangle=A \otimes C^T|B\rangle \rangle$&lt;/span&gt;, which when &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is written as a sum of Krauss operators gives &lt;span class=&quot;math-container&quot;&gt;$$\int_{\mathrm{U}(d)} U^{\dagger} \varepsilon\left(U \rho U^{\dagger}\right) U d U \mapsto\sum_{K} \int_{U(d)}\left(U^{\dagger} \otimes U^T\right) \cdot\left(K \otimes K^{*}\right) \cdot\left(U \otimes U^{*}\right)|\rho\rangle \rangle d U.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we then go a step further and start with a random state, we can effectively integrate over &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and repeat the vectorisation process to give &lt;span class=&quot;math-container&quot;&gt;$$\int_{\mathrm{U}(d)} U^{\dagger} \varepsilon\left(U \rho U^{\dagger}\right) U d U \mapsto\int_{U(d)} U^{\dagger} \otimes U^T \otimes U^T \otimes U^{\dagger} d U \sum_{K}\left|K \otimes K^* \right\rangle \rangle$$&lt;/span&gt; and we now have something that looks more like a 2-design.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, we've gone from twirling over some channel to an operation that looks something similar to 2-design acting on the vectorisation of the Krauss operator form of that channel and finally...&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The difference between Pauli and Clifford Twirls&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Rewriting &lt;span class=&quot;math-container&quot;&gt;$K = \sum_j|u_j^{\left(K\right)}\rangle\langle v_j^{\left(K\right)}|$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$K\otimes K^* = \sum_{j, l}|u_j^{\left(K\right)}\rangle|u_l^{*\left(K\right)}\rangle\langle v_j^{\left(K\right)}|\langle v_l^{*\left(K\right)}|$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$|K\otimes K^*\rangle\rangle = \sum_{j, l}| v_j^{\left(K\right)}\rangle| v_l^{*\left(K\right)}\rangle|u_j^{\left(K\right)}\rangle|u_l^{*\left(K\right)}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what's above, the Clifford twirl then permutes this to get &lt;span class=&quot;math-container&quot;&gt;$\sum_{j, l}|u_l^{*\left(K\right)}\rangle| v_j^{\left(K\right)}\rangle| v_l^{*\left(K\right)}\rangle|u_j^{\left(K\right)}\rangle$&lt;/span&gt;, sums the projections onto the symmetric and anti-symmetric subspaces and unpermutes again. Overall, information about the second statistical moment of the noise channel can be learned from repeated measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By comparison, the Pauli twirl generally doesn't do this. It does, in the case of a single qubit, at least give the diagonal elements of the Process matrix, as per &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0606161&quot; rel=&quot;noreferrer&quot;&gt;the paper they refer to&lt;/a&gt;, which happens to be the parameters they're looking for.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1 I'm not sure off the top of my head if there's a diffrerence between &lt;span class=&quot;math-container&quot;&gt;$\mathrm C_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm C_1^{\otimes n}$&lt;/span&gt;, although it seems clear that &lt;span class=&quot;math-container&quot;&gt;$\mathrm C_1^{\otimes n}\subset\mathrm C_n$&lt;/span&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2 Also known as &lt;em&gt;unitary k-designs&lt;/em&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="23" LastEditDate="2019-07-01T07:20:19.070" LastActivityDate="2019-07-01T07:20:19.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6647" PostTypeId="2" ParentId="6634" CreationDate="2019-07-01T06:41:58.230" Score="2" Body="&lt;p&gt;I think you agree that if you start with the state &lt;span class=&quot;math-container&quot;&gt;$(a|0\rangle+b|1\rangle)|0\rangle$&lt;/span&gt;, the cnot produces &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle+b|11\rangle$&lt;/span&gt;. The issue is why is the state of the first qubit not the same as &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle+b|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is &lt;em&gt;if you only look at that one qubit&lt;/em&gt; and &lt;em&gt;you only look in the standard, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis&lt;/em&gt;, then they do look the same. But those are two very restrictive assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if I look at the qubit in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle=(|0\rangle\pm|1\rangle)/\sqrt{2}$&lt;/span&gt; basis, then the original state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{a+b}{\sqrt{2}}|+\rangle+\frac{a-b}{\sqrt{2}}|-\rangle,&#xA;$$&lt;/span&gt;&#xA;so we get the answer &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\frac12|a+b|^2$&lt;/span&gt;. Meanwhile, our entangled state can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}|+\rangle(a|0\rangle+b|1\rangle)+\frac{1}{\sqrt{2}}|-\rangle(a|0\rangle-b|1\rangle),&#xA;$$&lt;/span&gt;&#xA;so we get the answer &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; on the first qubit with probability 1/2. They are different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, if you look at two qubits, let's return to the standard, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis. For two copies of the original state, the probability of finding them both in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; should be &lt;span class=&quot;math-container&quot;&gt;$|a|^4$&lt;/span&gt;, while for the entangled state it's just &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt;. Again, they're different.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-01T06:41:58.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6648" PostTypeId="2" ParentId="6632" CreationDate="2019-07-01T06:53:12.133" Score="2" Body="&lt;p&gt;You seem to be mixing two very different concepts here. Quantum cloning is talking about the absolute limits of what is theoretically possible in a perfect world. In this absolute theoretical limit, yes we can derive how well quantum cloning can work, and we also know that classical cloning is nominally perfect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is then a separate question of how well you can clone once you add in realistic sources of imperfection. Things like imperfect alignment of bases, decoherence .... These are certainly things you &lt;em&gt;could&lt;/em&gt; incorporate into a quantum description, although I'm not aware of whether anyone ever has. And you &lt;em&gt;could&lt;/em&gt; take it further and look at the classical limit of that. However, once you hit the actual classical limit, remember that there essentially is a &quot;preferred&quot; basis. You don't run into issues of misalignment because there only is one basis. And because you've implicitly got cloning built in, you've got many, many copies of data, rendering error correction incredibly effective, so decoherence is almost a non-issue as well. After all, if you copy a file one your computer, you get an exact copy, don't you?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, there are limits. The higher density try and store and manipulate data, the closer to single information carrying entities you get (e.g. small number of photons in a fibre optic cable), and you're closer to using quantum things. But that's just because we're greedy. You don't have to approach those limits, and we can choose to do things supremely robustly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also say that Landauer's principle is a bit misleading. It says that &lt;em&gt;if&lt;/em&gt; you're performing an irreversible operation, and &lt;em&gt;if&lt;/em&gt; you do it at a particular temperature, that has certain implications. However, computations don't need to be done irreversibly. They can be done reversibly, and then you're operating outside the regime that Landauer's principle can talk about.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-07-02T06:15:04.127" LastActivityDate="2019-07-02T06:15:04.127" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6649" PostTypeId="1" CreationDate="2019-07-01T08:00:05.063" Score="3" ViewCount="101" Body="&lt;p&gt;What is the difference between entangled states and separable states or electron spin-singlets?&lt;/p&gt;&#xA;" OwnerUserId="7361" LastEditorUserId="55" LastEditDate="2019-07-03T08:41:43.997" LastActivityDate="2019-07-03T08:41:43.997" Title="What is the difference between entangled and separable states or electron spin-singlets?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6650" PostTypeId="2" ParentId="6639" CreationDate="2019-07-01T08:10:01.437" Score="-1" Body="&lt;p&gt;Yes. We need to have an aptitude for the subject to learn. Seems, you have a keen desire to learn quantum physics based computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The future of the computing technology is quantum, the digital computing will be a past and will be known as dumb technology of 0's and 1's very soon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your interest for quantum computing is more than enough to go deep into the subject. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Go through the latest journals and research work on quantum computings. Nonetheless, the Springer publication books are also good for a self study. We could get a lot of other references too in these books.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Free previews of the few books are available online:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.springer.com/gp/book/9781846288869&quot; rel=&quot;nofollow noreferrer&quot;&gt;Explorations in Quantum Computing (Williams, Colin P.)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://www.springer.com/in/book/9783540407041&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing (Hirvensalo, Mika)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7913" LastEditorUserId="26" LastEditDate="2019-10-14T16:05:51.983" LastActivityDate="2019-10-14T16:05:51.983" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6651" PostTypeId="2" ParentId="6649" CreationDate="2019-07-01T08:30:12.417" Score="2" Body="&lt;p&gt;There could be a few things going on here. However, I think the fundamental issue is the tensor product that you write in the second expression. It implies an issue of &lt;em&gt;identification&lt;/em&gt;. Your second expression is effectively saying:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;there are two different positions at which I can create a fermion. Call them P1 and P2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;create a spin-up at P1 and a spin down at P2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This is quite a different thing from &quot;there are two spins, one up and one down, but I cannot distinguish which is which&quot;, corresponding to your first expression.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may need some further elaboration, but I don't want to overcomplicate it at this point, and I'll be guided by comments.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you want to write B using A's description, you need to have terms that look like both &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_{\uparrow}a^\dagger_{\downarrow}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_{\downarrow}a^\dagger_{\uparrow}$&lt;/span&gt; because you don't know which is which (that's a very vague hand-wavy description). Now, since electrons are fermions, they are antisymmetric. That shows how we have to combine those two terms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(a^\dagger_{\uparrow}a^\dagger_{\downarrow}-a^\dagger_{\downarrow}a^\dagger_{\uparrow})|0\rangle\otimes|0\rangle.&#xA;$$&lt;/span&gt;&#xA;Hopefully you can now see how that matches with the B description.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-07-01T14:26:21.250" LastActivityDate="2019-07-01T14:26:21.250" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6653" PostTypeId="2" ParentId="6639" CreationDate="2019-07-01T17:44:26.260" Score="1" Body="&lt;p&gt;I think it would be best if you start reading &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mike and Ike&lt;/a&gt;. Buy the hard copy. Go through the exercises. This would be sufficient to read the papers. The further reading section would provide starting points from where it would be suitable to enter the literature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the programming aspects best place to start is &lt;a href=&quot;https://github.com/qutip&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qutip&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="462" LastActivityDate="2019-07-01T17:44:26.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6654" PostTypeId="2" ParentId="6639" CreationDate="2019-07-01T19:19:47.023" Score="0" Body="&lt;p&gt;I would also recommend looking up &lt;a href=&quot;https://www.springer.com/gp/book/9783030239213&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jack Hidary's new book &quot;Quantum Computing: An Applied Approach&quot;&lt;/a&gt; which provides a very hands-on approach for learning the basics (and more).&lt;/p&gt;&#xA;" OwnerUserId="7864" LastActivityDate="2019-07-01T19:19:47.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6655" PostTypeId="1" CreationDate="2019-07-01T19:48:50.407" Score="4" ViewCount="741" Body="&lt;p&gt;It is very confusing how the CNOT gate can change the properties of the controlled qubit (possibly because I am still stuck in the classical programming mindset): &#xA;&lt;a href=&quot;https://i.stack.imgur.com/XlpCU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XlpCU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many books have explained the phenomenon using a &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix multiplication and tensor products to show how this happens. However, the math doesn't seem to agree because if I don't do the tensor product of the two qubits and instead just do the math separately by applying &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices to the top and bottom qubit based on what is happening and then tensor the two together in the end, the two methods don't agree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is (what is in my mind) a simple example to show the mathematical error: &lt;a href=&quot;https://i.stack.imgur.com/ruauW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ruauW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see from the bottom qubit. The &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in the very beginning obviously transforms the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The controlled dot doesn't do anything: it merely observes the bottom qubit in order to decide whether to apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate onto the top qubit. Thus, it does nothing to the bottom qubit. As everyone knows, all functions of quantum computing are inverses of each other. Hence, the 2 H gates cancel out. It thus makes no sense to me how the bottom qubit can be 100% off all the time when it should logically be &quot;On&quot; (and if we do out the matrices it will work out as such).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much for your help and I apologize if this question is basic.&lt;/p&gt;&#xA;" OwnerUserId="7903" LastEditorUserId="2927" LastEditDate="2019-07-01T20:57:37.317" LastActivityDate="2019-07-02T08:23:39.553" Title="How can a CNOT gate change the control qbit (e.g. in the Deutsch Oracle problem)?" Tags="&lt;entanglement&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6656" PostTypeId="2" ParentId="6598" CreationDate="2019-07-01T21:36:20.037" Score="1" Body="&lt;p&gt;In essence you are asking could it be more efficient to use non-uniform distribution (instead of uniform) to pick numbers &lt;span class=&quot;math-container&quot;&gt;$r_i$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$[0,S]$&lt;/span&gt; for testing. Quantum circuit here just encodes the distribution, essentially it has no other use.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, it depends on how we model our probability space for all polynomials. In some models it could be better to pick numbers closer to 0, in some others it's better to pick uniformly and in some models it's better to use some specific distribution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is really hard task to correctly define probability space for all polynomials (that will be &quot;uniform&quot; in some sense). Note that it's even impossible to define uniform distribution over real line compatible with standard Kolmogorov axioms of probability.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-07-01T21:49:10.850" LastActivityDate="2019-07-01T21:49:10.850" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6657" PostTypeId="1" CreationDate="2019-07-01T21:49:17.660" Score="2" ViewCount="52" Body="&lt;p&gt;As outlined in &lt;a href=&quot;https://www.nap.edu/catalog/25196/quantum-computing-progress-and-prospects&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Progress and Prospects&lt;/a&gt; published this year, on page 169-171 there is the diagram showing that we are at the 10's of qubits mark. Looking into the diagram further there is the statement prior that states ,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The first benchmark machine is the class of digital (gate-based)&#xA;  quantum computers containing around &lt;span class=&quot;math-container&quot;&gt;$2^{4}$&lt;/span&gt; qubits with average gate&#xA;  error rate better than 5 percent, which first became available in&#xA;  2017.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, when I look at &lt;a href=&quot;https://quantumcomputingreport.com/scorecards/qubit-count/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Report&lt;/a&gt; I find that there are a couple of companies past the 50+ qubit count to get to the next point. Is the report already outdated, or am I missing something?&lt;/p&gt;&#xA;" OwnerUserId="7867" LastActivityDate="2019-07-01T21:49:17.660" Title="I thought we had already passed this error and qubit threshold?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;physical-qubit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6658" PostTypeId="2" ParentId="6639" CreationDate="2019-07-02T00:27:27.703" Score="2" Body="&lt;p&gt;Understanding the basic theory of quantum computing should be within reach. If you understand linear algebra, then math will not be your stumbling block. Quantum mechanics shouldn't be either — while you do need to exploit some of its machinery, you do not need a deep understanding to get started. Most introductory QC resources will build up the essential ideas of superposition, measurement, unitary operators, and the concept of entanglement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Engineering quantum computers is another story. If you want to do that then you will need to know much more about quantum mechanics proper. But the basic theory of quantum computing should still come first. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're getting started, you should check out the on brilliant.org (brilliant.org/courses/quantum-computing, the first chapter is free). Full disclosure, I co-wrote this course out of frustration with the state of available QC learning options. It takes you from learning what a qubit is up to present-day realizations of quantum computing (hybrid classical/quantum approaches like VQE). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Along the way, you investigate quantum gates, build basic quantum information processing circuits (e.g. teleportation and superdense coding), see clear examples of quantum speedups, and understand the major classes of quantum algorithms. You learn the math, but it also has simulated quantum computer embedded in the course, so you can internalize what's going on. You'll also learn how to program quantum algorithms in Microsoft's Q# language and use it to build out a basic application in quantum chemistry.&lt;/p&gt;&#xA;" OwnerUserId="7923" LastActivityDate="2019-07-02T00:27:27.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6659" PostTypeId="2" ParentId="6655" CreationDate="2019-07-02T02:44:14.217" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;As everyone knows, all functions of quantum computing are inverses of&#xA;  each other. Hence, the 2 H gates cancel out.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum gates all have inverses, but the inverse of a gate is not necessarily the same gate, though Hadamard gates, which are the ones being most considered here, are their own inverse. I'm not sure if by &quot;2 H gates&quot; you mean the two gates before the CNOT in the smaller diagram, which are on different qubits, or the two &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes 2}$&lt;/span&gt; gates flanking the CNOT in the larger diagram. In the former case, there's no cancellation since they are on different qubits. In the other case, they don't cancel because there is the CNOT between them and matrix multiplication is non-commutative: since &lt;span class=&quot;math-container&quot;&gt;$AB \neq BA$&lt;/span&gt; is possible, you can't conclude &lt;span class=&quot;math-container&quot;&gt;$A^{-1}BA = A^{-1}AB = B$&lt;/span&gt;, and thus the two sets of Hadamards don't cancel out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that we know that they don't just cancel out, you can derive that a CNOT with &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes 2}$&lt;/span&gt; flankings actually together make another CNOT with swapped control and target qubits. First, here is the conceptually simple but really tedious matrix multiplication of that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix} \begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{bmatrix} \begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix} = \frac{1}{4}\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix} \begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1\end{bmatrix} = \begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{bmatrix}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$a\left|00\right&amp;gt; + b\left|01\right&amp;gt; + c\left|10\right&amp;gt; + d\left|11\right&amp;gt; = \begin{bmatrix} a \\ b \\ c \\ d \end{bmatrix}$&lt;/span&gt;, we see the original in the flank swaps the probability amplitudes of &lt;span class=&quot;math-container&quot;&gt;$\left|10\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt; (left qubit is control), while the new one swaps the amplitudes of &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt; (right qubit is control).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A harder but interesting and less tedious way to recognize this is through the symmetry of the controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate, as described in page 5 of &lt;a href=&quot;https://arxiv.org/pdf/1110.2998.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1110.2998.pdf&lt;/a&gt;. A controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate's control and target qubits are indistinguishable since the only probability amplitude in computational basis that changes is the sign flip of the probability amplitude of &lt;span class=&quot;math-container&quot;&gt;$\left|11\right&amp;gt;$&lt;/span&gt;. However, if one of the qubits in the controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; has Hadamards flanking it, they together are a CNOT with the Hadamard-flanked qubit being the target. Add the &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes 2}$&lt;/span&gt; on both sides to this CNOT and you have the &quot;control&quot; qubit of the controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate with a Hadamard behind and in front of it, and the &quot;target&quot; qubit with two on each side. The two Hadamards on each side for that qubit cancel out since there is nothing between them, so it ends up with a controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; with Hadamards behind and in front of what we previously noted as the control, but, since a controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; doesn't distinguish control and target, that is instead the target of a CNOT due to the Hadamards, and we have the switch.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastActivityDate="2019-07-02T02:44:14.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6660" PostTypeId="2" ParentId="6655" CreationDate="2019-07-02T04:23:18.760" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The controlled dot doesn't do anything: it merely observes the bottom qubit in order to decide whether to apply the  gate onto the top qubit. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;In the answer below, the qubit that appears first is the control qubit, it maps to the bottom qubit in your diagram, and the second one is the target qubit.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The CNOT gate works on two qubits at once. You can't think of it's operation separately on the first and second qubit, and you can't do the math using two separate &lt;span class=&quot;math-container&quot;&gt;$2*2$&lt;/span&gt; matrices. &lt;/li&gt;&#xA;&lt;li&gt;The definition of what CNOT does to a basis is this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(|00\rangle) = |00\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(|01\rangle) = |01\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(|10\rangle) = |11\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(|11\rangle) = |10\rangle$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sure, when you look at the definition of the basis, it seems like CNOT doesn't do anything to the first qubit, and only &lt;em&gt;observes&lt;/em&gt; the first and flips the second if necessary. But consider applying CNOT on a non-basis state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(|+\rangle |0\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=CNOT \left(\frac{|0\rangle + |1\rangle}{\sqrt 2}|0\rangle \right)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=CNOT \left(\frac{|00\rangle}{\sqrt 2} + \frac{|10\rangle}{\sqrt 2}\right)$$&lt;/span&gt;&#xA;Now, exploiting the linear property of quantum gates, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{|00\rangle + |11\rangle}{\sqrt 2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the first qubit is not in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state anymore, even though it was the qubit just being observed. It in fact does not have any pure representation. It has gotten entangled with the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So CNOT does infact effect the control qubit in the sense that it ties it up with outcomes of the target qubit. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Now, in your first example&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After applying &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on both qubits, you have &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on both qubits you have &lt;span class=&quot;math-container&quot;&gt;$|--\rangle$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\frac{|00\rangle - |01\rangle - |10\rangle + |11\rangle}{\sqrt 2}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying the CNOT on this qubit set, you have &#xA; &lt;span class=&quot;math-container&quot;&gt;$\frac{|00\rangle - |01\rangle - |11\rangle + |10\rangle}{\sqrt 2}$&lt;/span&gt; which you can factorise as &lt;span class=&quot;math-container&quot;&gt;$|+-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now applying the two &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;'s, you have &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;.&#xA;Hence the bottom qubit is 'off' and the top qubit is 'on'.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-07-02T04:23:18.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6661" PostTypeId="2" ParentId="6655" CreationDate="2019-07-02T08:23:39.553" Score="2" Body="&lt;p&gt;I am not sure what the second question is about, but in the first one you are probably inquiring about the concept of &quot;phase kickback&quot;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2565/why-does-the-phase-kickback-mechanism-work-in-the-quantum-phase-estimation-alg&quot;&gt;Why does the &amp;quot;Phase Kickback&amp;quot; mechanism work in the Quantum phase estimation algorithm?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-07-02T08:23:39.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6662" PostTypeId="1" CreationDate="2019-07-02T09:32:21.180" Score="1" ViewCount="570" Body="&lt;p&gt;I have an error when I use Quantum SVM kernel algorithm from Qiskit aqua.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code section with imports:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from datasets import *&#xA;import numpy as np&#xA;from qiskit_aqua.utils import split_dataset_to_data_and_labels&#xA;from qiskit_aqua.input import svminput&#xA;from qiskit_aqua import run_algorithm&#xA;from qiskit_aqua.utils import split_dataset_to_data_and_labels&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the error I obtain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ModuleNotFoundError: No module named 'qiskit_aqua'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7877" LastEditorUserId="55" LastEditDate="2021-04-09T09:00:34.517" LastActivityDate="2021-04-09T09:00:34.517" Title="import error :No module named 'qiskit_aqua'" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6663" PostTypeId="2" ParentId="6662" CreationDate="2019-07-02T09:39:47.453" Score="3" Body="&lt;p&gt;If your using the latest qiskit version then it is qiskit.aqua&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-07-02T09:39:47.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6664" PostTypeId="1" CreationDate="2019-07-02T10:39:25.693" Score="1" ViewCount="128" Body="&lt;p&gt;I have an error when I use Quantum SVM kernel algorithm from Qiskit aqua.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code section with imports:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.qobj import (QasmQobj, QobjExperimentHeader,&#xA;                         QasmQobjInstruction, QasmQobjExperimentConfig, QasmQobjExperiment,&#xA;                         QasmQobjConfig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the error I obtain:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImportError: cannot import name 'QasmQobj' from 'qiskit.qobj' &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7877" LastEditorUserId="23" LastEditDate="2019-07-02T13:24:09.140" LastActivityDate="2019-11-29T14:02:15.373" Title="Qiskit Aqua cannot import 'QasmQobj'" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6667" PostTypeId="2" ParentId="6664" CreationDate="2019-07-02T12:36:56.567" Score="1" Body="&lt;p&gt;With the information you provided in your question, I recommand you to try to reinstall qiskit from scratch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so, just execute&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;python -m pip install -U qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to execute your import statements after running this line, and it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you do not use the default &lt;code&gt;python&lt;/code&gt;, replace &lt;code&gt;python&lt;/code&gt; with the python executable you are using (e.g. &lt;code&gt;python3&lt;/code&gt;). If you are on linux, &lt;code&gt;which python&lt;/code&gt; will show you the executable hidden behind the &lt;code&gt;python&lt;/code&gt; command.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If your problem is still here, please provide the output of the following commands (should always be provided in questions related to issues with python libraries):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;python -V&#xA;python -m pip list&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-07-02T12:36:56.567" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="6668" PostTypeId="1" CreationDate="2019-07-02T15:11:56.947" Score="1" ViewCount="101" Body="&lt;p&gt;I was fiddling with the quantum circuit used for Deutsch's algorithm and I was led to a zero state as a result which is bizarre. I don't know how to explain this result. &lt;a href=&quot;https://i.stack.imgur.com/zrZD6.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zrZD6.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;***I'm using Nielsen and Chuang to study QC&lt;/p&gt;&#xA;" OwnerUserId="7943" LastEditorUserId="2879" LastEditDate="2019-07-02T21:36:00.723" LastActivityDate="2019-07-02T21:36:00.723" Title="What does a zero state combined state vector for 2 qubits mean?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6669" PostTypeId="1" CreationDate="2019-07-02T15:22:17.547" Score="1" ViewCount="56" Body="&lt;p&gt;Can the marked qubit be associated only with half of the register? I mean if I can ask the oracle if the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; low qubits from a &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubit register have a certain value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ask this to know if I can bit-append for example names and telephones into one register, so I can entangle the marked qubit with CNOT gates only with one half of register qubits which are the telephones, so when I seek a telephone the oracle amplifies the state associated with the qubit marked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There will be &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; states in the register initialized all to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; except the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; that are name-telephone equally with HADAMARD to get &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on the states' sumatory module.&lt;/p&gt;&#xA;" OwnerUserId="7933" LastEditorUserId="2879" LastEditDate="2019-07-02T17:50:51.447" LastActivityDate="2019-07-02T18:49:09.487" Title="Entangling marked qubit with part of the register in Grover's search" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6670" PostTypeId="2" ParentId="6668" CreationDate="2019-07-02T17:42:17.167" Score="1" Body="&lt;p&gt;The terms of expression &lt;em&gt;do not cancel out&lt;/em&gt; in the balanced function case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2} (|0\rangle|0 \oplus f(0)\rangle - |0\rangle|1 \oplus f(0)\rangle + |1\rangle|0 \oplus f(1)\rangle - |1\rangle|1 \oplus f(1)\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(0) \neq f(1)$&lt;/span&gt;, consider the first two terms (the only ones which can cancel with each other, since the state of the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;): the state of the second qubit in them is &lt;span class=&quot;math-container&quot;&gt;$|0 \oplus f(0)\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1 \oplus f(0)\rangle$&lt;/span&gt;, which are different states no matter what the value of &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will be helpful for you to consider the cases for &lt;span class=&quot;math-container&quot;&gt;$f(x) = x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1-x$&lt;/span&gt; separately to convince yourself that the cancellation doesn't happen.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-02T17:42:17.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6671" PostTypeId="2" ParentId="6669" CreationDate="2019-07-02T18:49:09.487" Score="1" Body="&lt;p&gt;On one hand, the oracle can use an arbitrary subset of the register qubits to decide whether it marks the state as the solution to the encoded problem. For example, if you're looking for any 4-qubit state with the first 2 qubits in state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, you can do a CCNOT with those qubits as controls and the marked qubit as target to implement this condition - you're not required to use the last 2 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you do nothing else in the oracle, you'll get an arbitrary answer that will fit the criteria; following the example from the previous paragraph, you'll get a random state of the form &lt;span class=&quot;math-container&quot;&gt;$|11??\rangle$&lt;/span&gt;. You probably want instead to have a mapping of the first pair of qubits to the second one, so that you'd get not only the key &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, but also the specific value that corresponds to it. In this case you'll need to encode it somehow, which will be reflected in the oracle and will ultimately entangle all register qubits with the marked qubit. Any qubits that are not entangled with the marked qubit have a chance to end up in a random state.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-02T18:49:09.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6672" PostTypeId="1" CreationDate="2019-07-02T21:02:17.967" Score="4" ViewCount="139" Body="&lt;p&gt;I'm trying to run a program in the Qiskit Notebook on the IBMQ Experience. I need to import some .py files that I've done in order to run my main program but the notebook won't accept .py files. I've tried uploading them (doesn't work, it loads forever) and also tried to write a .ipynb file and then change the name to .py but then the file disappeared. &lt;/p&gt;&#xA;" OwnerUserId="7945" LastActivityDate="2019-07-03T17:24:06.217" Title="How to upload .py file to new online Qiskit Notebook" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6673" PostTypeId="2" ParentId="6611" CreationDate="2019-07-03T03:01:31.080" Score="2" Body="&lt;p&gt;Doing a 5 to 2-qubit reduction is a little tedious, but we can illustrate how it works with a simpler example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a 3-qubit state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{ABC}\rangle$&lt;/span&gt; and boil it down to &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{BC}\rangle$&lt;/span&gt;, say&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\lvert\psi_{ABC}\rangle = \alpha\lvert 001\rangle + \beta\lvert 101\rangle + \gamma\lvert 011\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, the density operator for the state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi_{ABC}\rangle$&lt;/span&gt; is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\rho_{ABC} &amp;amp;= \lvert\psi_{ABC}\rangle\langle\psi_{ABC}\rvert \\&#xA;&amp;amp;= \left(\alpha\lvert 001\rangle + \beta\lvert 101\rangle + \gamma\lvert 011\rangle\right)\otimes\left(\alpha^*\langle 001\rvert + \beta^*\langle 101\rvert + \gamma^*\langle 011\rvert\right)&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expanding this out, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho_{ABC} &amp;amp;= \alpha^*\alpha \lvert 001\rangle\langle 001\rvert + \beta^*\alpha \lvert 001\rangle\langle 101\rvert + \gamma^*\alpha \lvert 001\rangle\langle 011\rvert \\&#xA;&amp;amp;+\alpha^*\beta \lvert 101\rangle\langle 001\rvert + \beta^*\beta \lvert 101\rangle\langle 101\rvert + \gamma^*\beta \lvert 101\rangle\langle 011\rvert \\&#xA;&amp;amp;+\alpha^*\gamma \lvert 011\rangle\langle 001\rvert + \beta^*\gamma \lvert 011\rangle\langle 101\rvert + \gamma^*\gamma \lvert 011\rangle\langle 011\rvert&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea of the reduced density operator is to trace over the particles that you don't care about. For example, to find &lt;span class=&quot;math-container&quot;&gt;$\rho_{BC}$&lt;/span&gt;, we would trace over particle A: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{BC} = \text{Tr}_{A}\left(\rho_{ABC}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before we write out the whole thing, in symbols the trace over &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_{A}\left(\rho_{ABC}\right) = \langle 0_A\rvert\rho_{ABC}\lvert 0_A\rangle + \langle 1_A\rvert\rho_{ABC}\lvert 1_A\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the trace will eliminate all terms where particle &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is not in the same state in the bra and ket. For example, the term &lt;span class=&quot;math-container&quot;&gt;$\beta\alpha^*\lvert101\rangle\langle001\rvert$&lt;/span&gt; will disappear. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Carrying out the process, the terms that survive in the reduced density operator are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\rho_{BC} &amp;amp;= \alpha^*\alpha \lvert 01\rangle\langle 01\rvert + &#xA;\gamma^*\alpha \lvert 01\rangle\langle 11\rvert \\&#xA;&amp;amp;+ &#xA;\beta^*\beta \lvert 01\rangle\langle 01\rvert +&#xA;\alpha^*\gamma \lvert 11\rangle\langle 01\rvert \\&#xA;&amp;amp;+ &#xA;\gamma^*\gamma \lvert 11\rangle\langle 11\rvert&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to further reduce to the &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; density operator, then just trace over &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\rho_B &amp;amp;= \text{Tr}_C \left(\rho_{BC}\right) \\&#xA;&amp;amp;= \langle 0_C\lvert\rho_{BC}\rvert 0_C\rangle +  \langle 1_C\lvert\rho_{BC}\rvert 1_C\rangle&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, all of the terms survive and the resulting density operator is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho_B &amp;amp;= \left(\alpha^*\alpha + \beta^*\beta\right)\lvert0\rangle\langle0\rvert  + \gamma^*\gamma\lvert 1\rangle\langle 1\rvert \\&#xA;&amp;amp; \gamma^*\alpha\lvert 0\rangle\langle 1\rvert+ \alpha^*\gamma\lvert 1\rangle\langle 0\rvert &#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(If we were being strict with notation, then we should really write &lt;span class=&quot;math-container&quot;&gt;$\lvert 1_A\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\lvert 1\rangle\otimes I^{\otimes 2}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I^{\otimes 2}$&lt;/span&gt; is the identity operator on the &lt;span class=&quot;math-container&quot;&gt;$BC$&lt;/span&gt; subspace. But we'll understand that when we write something like &lt;span class=&quot;math-container&quot;&gt;$\langle 1_A\rvert001\rangle$&lt;/span&gt; it really means &lt;span class=&quot;math-container&quot;&gt;$\left(\langle 1_A\rvert 0_A\rangle\right)\otimes\lvert 01\rangle = \lvert 01\rangle$&lt;/span&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$\langle 001\rvert 1_A\rangle = \left(\langle 0_A\rvert 1_A\rangle\right)\lvert01\rangle = 0$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="7923" LastEditorUserId="7923" LastEditDate="2019-07-03T03:51:40.017" LastActivityDate="2019-07-03T03:51:40.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6674" PostTypeId="2" ParentId="6631" CreationDate="2019-07-03T11:29:58.803" Score="8" Body="&lt;p&gt;The Solovay-Kitaev algorithm is not practical. It is very useful theoretically because it proves that once you have a &quot;dense&quot; set of quantum gates (i.e. a set with which you can approximate any other quantum gate) you can approximate up to an arbitrary precision and &lt;strong&gt;quickly&lt;/strong&gt; any quantum gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, the Solovay-Kitaev works as follow:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Fill the space of implementable quantum gates as much as possible. This is performed by creating quantum circuits with the gate-set considered and storing them in memory alongside the unitary evolution they implement. The goal of this step is to fill the space of implementable quantum gates such as, for any unitary matrix, there is a entry in the set at distance at most &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Recurse as explained in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0505030.pdf&quot; rel=&quot;noreferrer&quot;&gt;this article&lt;/a&gt; and when reaching the end of the recursion, find a circuit (pre-computed in step 1) that approximates sufficiently well the current unitary.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Some obervations:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Point 1 only need to be done once for each circuit arity. Once you finished point 1 for &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-qubit gates, you can just save the result on a hard-drive and reload it for the next approximation.&lt;/li&gt;&#xA;&lt;li&gt;Point 1 is &lt;strong&gt;VERY GREEDY&lt;/strong&gt; in computational resources. A quantum gate on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can be represented as a matrix in &lt;span class=&quot;math-container&quot;&gt;$SU(2^n)$&lt;/span&gt;, which is a space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^{2n} - 1$&lt;/span&gt;. Filling uniformly a space with such a dimension requires a &lt;strong&gt;HUGE&lt;/strong&gt; number of points (i.e. a huge number of quantum circuits).&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In order to perform point 2, one of the most efficient method (asymptotically-speaking) is to use nearest-neighbour algorithms. There exist a lot of algorithms (the most used being probably the KD-tree approach), and some of them are designed for high-dimensional data (see &lt;a href=&quot;https://stackoverflow.com/a/5773066/4810787&quot;&gt;this answer&lt;/a&gt; or &lt;a href=&quot;https://datascience.stackexchange.com/a/975&quot;&gt;this one&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But still, your search space (the circuits generated in point 1) &quot;suffer from the curse of dimensionality&quot; in the sense that its size grows really fast when the dimension increase. Even if you can search for a nearest-neighbour in &lt;span class=&quot;math-container&quot;&gt;$O(n\ln(n))$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is incredibly large here.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;During the recursion, a matrix decomposition needs to be performed. An efficient algorithm for the decomposition has been devised in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0505030.pdf&quot; rel=&quot;noreferrer&quot;&gt;this article&lt;/a&gt; for &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit gates (i.e. &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; matrices), but no efficient implementation exist for gates on &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; or more qubits: you end up diagonalising the unitary matrix you want to implement, which become quite costly when the unitary matrix becomes large.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To sum up:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Solovay-Kitaev algorithm has only a very little practical application for &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit gates, nearly no practical application for &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit gates and clearly no practical application for &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-qubit gates and above.&lt;/li&gt;&#xA;&lt;li&gt;Randomised approach can work way better and have a better scaling with respect to the number of qubits. You can also have a look at the Group Leader Optimisation Algorithm -- GLOA if you want to dig in this direction.&lt;/li&gt;&#xA;&lt;li&gt;The theoretical scaling of SK is very good with respect to precision, but exponential with respect to the size of the gate.&lt;/li&gt;&#xA;&lt;li&gt;In the case of large number of qubit, SK will fail or take days whereas the randomised approach might give you a decomposition with a low precision in seconds or minutes. As a side note, the randomised approach is trivial to parallelise, SK is not so easy (nearest-neighbour algorithms are hard to parallelise efficiently).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-07-03T11:29:58.803" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6675" PostTypeId="2" ParentId="6672" CreationDate="2019-07-03T17:24:06.217" Score="1" Body="&lt;p&gt;The file editor only uploads, downloads and displays .ipynb files. However, you can create additional files using notebooks. To see that they are there, you can use the &lt;code&gt;sys&lt;/code&gt; package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You won't be able to import from local .py files, but you can open them as a text file and do something like &lt;code&gt;eval&lt;/code&gt; their contents as a workaround.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-07-03T17:24:06.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6676" PostTypeId="1" AcceptedAnswerId="6678" CreationDate="2019-07-03T18:30:05.630" Score="2" ViewCount="221" Body="&lt;p&gt;Equation 7.71 of Nielsen and Chuang's &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; gives the Hamiltonian for a two level atom and single mode photons in a cavity as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H = \hbarωN + δZ + g(a^†σ_− + aσ_+)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ω$&lt;/span&gt; is the photon frequency, &lt;span class=&quot;math-container&quot;&gt;$δ = (ω_0 - ω)/2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$ω_0$&lt;/span&gt; the atomic transition frequency. &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is the Pauli Z matrix; g is a coupling constant; &lt;span class=&quot;math-container&quot;&gt;$a^†$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; are creation and annihilation operators for photons, and &lt;span class=&quot;math-container&quot;&gt;$σ_−$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$σ_+$&lt;/span&gt; are lowering and raising operators for the atomic energy levels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Neglecting the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; term (since it only contributes a fixed phase) and considering a single excitation in the (photon) field mode, this Hamiltonian is re-written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = -\begin{bmatrix}\delta&amp;amp;0&amp;amp;0\\0&amp;amp;\delta&amp;amp;g\\0&amp;amp;g&amp;amp;-\delta\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried but been unable to derive this Hamiltonian from equation 7.71 above. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in 7.71 should be a 2 x 2 matrix as Pauli matrices are 2 x 2. But here it is written as a 3 x 3 matrix. Can you please explain how this can be obtained? Thanks. &lt;/p&gt;&#xA;" OwnerUserId="7805" LastEditorUserId="23" LastEditDate="2019-07-03T19:46:18.967" LastActivityDate="2019-07-03T19:54:01.380" Title="Hamiltonian for Single-photon, Single-atom QED Cavity" Tags="&lt;nielsen-and-chuang&gt;&lt;optical-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6678" PostTypeId="2" ParentId="6676" CreationDate="2019-07-03T19:54:01.380" Score="2" Body="&lt;p&gt;While the Pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; matrix is a 2 x 2 matrix, there are more basis states that need to be considered, namely the &lt;em&gt;vacuum&lt;/em&gt;. The atomic basis states are &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;, representing the number of excitations in the atom (as it's only a two-level atom, there can't be more than 1 excitation) and this is what &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; acts on. Similarly, the number of excitations (i.e. photons) in the field forms another basis, denoted by &lt;span class=&quot;math-container&quot;&gt;$\left|N\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we're &lt;em&gt;only&lt;/em&gt; considering a cavity with a total of number of photons &lt;span class=&quot;math-container&quot;&gt;$\leq 1$&lt;/span&gt;, so the possible bases are, ordering the Hilbert space by &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_{\text{photons}}\otimes\mathcal H_{\text{atom}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;, \,\left|10\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt;, as all the other possible states have &lt;span class=&quot;math-container&quot;&gt;$&amp;gt; 1$&lt;/span&gt; photon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to go about figuring out what the Hamiltonian on this system looks like is to look at what each operator does to each state, where &lt;span class=&quot;math-container&quot;&gt;$N=aa^\dagger$&lt;/span&gt; is ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; acts on the 'atomic' Hilbert space as &lt;span class=&quot;math-container&quot;&gt;$\delta Z\left|0\right&amp;gt; = \delta\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta Z\left|1\right&amp;gt; = -\delta\left|1\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_+$&lt;/span&gt; acts on the same space as &lt;span class=&quot;math-container&quot;&gt;$\sigma_+\left|0\right&amp;gt; = \left|1\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_+\left|1\right&amp;gt; = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_-$&lt;/span&gt; acts as &lt;span class=&quot;math-container&quot;&gt;$\sigma_-\left|1\right&amp;gt; = \left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_-\left|0\right&amp;gt; = 0$&lt;/span&gt;. Similarly, on the photonic Hilbert space, &lt;span class=&quot;math-container&quot;&gt;$a\left|0\right&amp;gt; = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a\left|1\right&amp;gt; = \left|0\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a^\dagger\left|0\right&amp;gt; = \left|1\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a^\dagger\left|1\right&amp;gt; = \sqrt{2}\left|2\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result, the term involving &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; acts on the combined system as: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}g\left(a^\dagger\sigma_- + a\sigma_+\right)\left|00\right&amp;gt; &amp;amp;= 0\\&#xA;g\left(a^\dagger\sigma_- + a\sigma_+\right)\left|10\right&amp;gt; &amp;amp;= g\left|01\right&amp;gt;\\&#xA;g\left(a^\dagger\sigma_- + a\sigma_+\right)\left|01\right&amp;gt; &amp;amp;= g\left|10\right&amp;gt;\end{align*}$$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$\delta Z$&lt;/span&gt; term similarly gives &lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}\delta Z\left|00\right&amp;gt;&amp;amp;=\delta\left|00\right&amp;gt;\\\delta Z\left|10\right&amp;gt;&amp;amp;=\delta\left|10\right&amp;gt;\\\delta Z\left|01\right&amp;gt;&amp;amp;=-\delta\left|01\right&amp;gt;\end{align*}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing this in matrix form with the basis &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;, \,\left|10\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|01\right&amp;gt;$&lt;/span&gt; as above gives equation 7.76 as expected: &lt;span class=&quot;math-container&quot;&gt;$$H = \begin{bmatrix}\delta&amp;amp;0&amp;amp;0\\0&amp;amp;\delta&amp;amp;g\\0&amp;amp;g&amp;amp;-\delta\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;It does appear that I'm out in what I get for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; by a minus sign, but looking at equation 7.77, which has &lt;span class=&quot;math-container&quot;&gt;$U=e^{-iHt} = e^{-i\delta t}\left|00\rangle\langle00\right|+...$&lt;/span&gt; suggests that this is presumably a typo (in my version, anyway), unless there's something I'm missing.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-07-03T19:54:01.380" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6679" PostTypeId="1" CreationDate="2019-07-03T20:38:20.587" Score="4" ViewCount="106" Body="&lt;p&gt;In the paper, &lt;a href=&quot;https://arxiv.org/pdf/1804.03719.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Quantum algorithm implementations for beginners&quot;&lt;/a&gt; in the section XVII. QUANTUM SIMULATION OF THE TRANSVERSE ISING MODEL (page 54-58), the authors have plotted energy &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; vs magnetic field strength &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; using two circuits, one without entanglement and one with entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is two-fold:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why have only these circuits only  been used?&lt;/li&gt;&#xA;&lt;li&gt;What implementation changes can I make in the maxcut code using VQE to obtain the above graph? I am trying to change the RY package which is used in the code to change the circuit. In the paper fig 51.(c), the depth of the circuit is 1. Does that mean to increase the depth, I have to replicate the circuit in fig 51.(c) up to depth times? Can someone provide the code changes?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7949" LastEditorUserId="45" LastEditDate="2019-07-03T20:43:07.087" LastActivityDate="2019-07-03T20:43:07.087" Title="What implementation changes should be done in maxcut code using VQE?" Tags="&lt;entanglement&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6680" PostTypeId="1" CreationDate="2019-07-04T03:22:38.113" Score="1" ViewCount="120" Body="&lt;p&gt;I have been running some simple &quot;Hello Quantum World&quot; code and every time I try to run it on 4096 shots or 8192 shots, the results always show as if I ran the code on 1024 shots (or in the most recent case, nothing at all). Is this a bug? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have only been using the interface (as you can see). In this case, I ran a hadamard gate and then an x gate on 4096 shots. Notice how the shots are not written at all.&#xA;Also, I have run other code with just the hadamard gate and then a target gate on 4096 and 8192 shots, but the interface says I ran it on 1024.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kt4dJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kt4dJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7953" LastEditorUserId="7953" LastEditDate="2019-07-04T23:30:34.223" LastActivityDate="2019-07-04T23:30:34.223" Title="Number of Shots always 1024/or nothing (IBM q experience)" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6681" PostTypeId="1" AcceptedAnswerId="7065" CreationDate="2019-07-04T05:34:34.380" Score="11" ViewCount="293" Body="&lt;p&gt;I was looking at this &lt;a href=&quot;https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-845-quantum-complexity-theory-fall-2010/lecture-notes/MIT6_845F10_lec09.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture note&lt;/a&gt; where the author gives an oracle separation between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;. He hints at how &quot;standard diagonalisation techniques can be used to make this rigorous&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone detail a diagonalisation technique that ought to be used? There should intuitively be important differences between the ones used to put something outside classical complexity classes and the ones used to put something outside &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;. Specifically, given that Grover's algorithm is optimal, I am looking for a diagonalisation technique such that we can construct an oracle &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}^{A} \not\subseteq \mathsf{BQP}^{A}$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="124" LastEditDate="2019-08-21T11:49:54.520" LastActivityDate="2019-11-01T04:49:15.640" Title="Separating NP from BQP relative to an oracle" Tags="&lt;complexity-theory&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6684" PostTypeId="1" AcceptedAnswerId="6685" CreationDate="2019-07-04T09:14:06.653" Score="4" ViewCount="237" Body="&lt;p&gt;I was reading these &lt;a href=&quot;https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-845-quantum-complexity-theory-fall-2010/lecture-notes/MIT6_845F10_lec15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; from Prof. Aaronson about Watrous's &lt;strong&gt;MA&lt;/strong&gt; protocol for the group non-membership problem. At the end of the description, there's an approach to distinguish if Merlin cheated or not, to confirm that Marline sent a superposition &lt;span class=&quot;math-container&quot;&gt;$|H\rangle$&lt;/span&gt; over the subgroup &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. So Arthur takes whatever Merlin sends &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle$&lt;/span&gt;, randomly selects &lt;span class=&quot;math-container&quot;&gt;$y\in H$&lt;/span&gt;, and computes the superposition &lt;span class=&quot;math-container&quot;&gt;$\sum_{h'\in H'}|h'y\rangle$&lt;/span&gt; over the set &lt;span class=&quot;math-container&quot;&gt;$H'y$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But the way group multiplication done is by an oracle promising that its inputs are some superpositions over group elements. &lt;strong&gt;What if Merlin cheated by sending a  superposition of garbage encodings?&lt;/strong&gt; In this case, we must try to get rid of the components falling into garbage encoding.&lt;/p&gt;&#xA;&lt;p&gt;Then I realized it is not just that; if we ever want to compute a superposition over some artificial objects, it is almost inevitable to get your superposition with some components being non-sense encoding. There must (or better be) some way to sanitize the input, right?&lt;/p&gt;&#xA;&lt;p&gt;In classical computing we usually can easily solve this. In quantum computing, it seems to be not a &amp;quot;big-deal&amp;quot; as well, but I just can't figure this out.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To make it more specific, I might define some subset &lt;span class=&quot;math-container&quot;&gt;$E\subseteq \{0,1\}^n$&lt;/span&gt; to be the set of encodings that make sense, and &lt;span class=&quot;math-container&quot;&gt;$X:=\{0,1\}^n-E$&lt;/span&gt; to be the set of garbage encodings. Now given a n-qubit input quantum-mechanically &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb{C}^{\{0,1\}^n}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can always be represented as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|e\rangle+|x\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|e\rangle\in\mathbb{C}^E, |x\rangle\in\mathbb{C}^X$&lt;/span&gt;. Is it even possible to extract &lt;span class=&quot;math-container&quot;&gt;$|e\rangle$&lt;/span&gt; out of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I tried to deterministically do the check (in each branch separately), but then we will get something like,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{e\in E}c_e|e\rangle|garbage\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is still not the same as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|e\rangle=\sum_{e\in E}c_e|e\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4855" LastEditorUserId="2927" LastEditDate="2021-01-02T21:16:52.457" LastActivityDate="2021-01-02T21:16:52.457" Title="Quantum State Sanitizing" Tags="&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6685" PostTypeId="2" ParentId="6684" CreationDate="2019-07-04T18:17:24.070" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Then I realized it is not just that; if we ever want to compute a superposition over some artificial objects, it is almost inevitable to get your superposition with some components being non-sense encoding. There must (or better be) some way to sanitize the input, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But this is the point!  We &lt;strong&gt;asume&lt;/strong&gt; Merlin is powerful enough to prepare a uniform superposition of &lt;span class=&quot;math-container&quot;&gt;$|H\rangle$&lt;/span&gt; &lt;em&gt;without&lt;/em&gt; having non-sense encodings.  If &lt;em&gt;Arthur&lt;/em&gt; himself could do it easily, then Group Non-Membership would be in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; and not in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To make it more specific, I might define some subset &lt;span class=&quot;math-container&quot;&gt;$E\subseteq \{0,1\}^n$&lt;/span&gt; to be the set of encodings that make sense, and &lt;span class=&quot;math-container&quot;&gt;$X:=\{0,1\}^n-E$&lt;/span&gt; to be the set of garbage encodings. Now given a n-qubit input quantum-mechanically &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb{C}^{\{0,1\}^n}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can always be represented as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|e\rangle+|x\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|e\rangle\in\mathbb{C}^E, |x\rangle\in\mathbb{C}^X$&lt;/span&gt;. Is it even possible to extract &lt;span class=&quot;math-container&quot;&gt;$|e\rangle$&lt;/span&gt; out of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's certainly not likely to be &lt;em&gt;easily&lt;/em&gt; or &lt;em&gt;efficiently&lt;/em&gt; done, unless &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}\subseteq\mathrm{BQP}$&lt;/span&gt;.  For example, &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; could be the solutions to some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt; instance while &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; could be those that don't satisfy the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt;.  &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|e\rangle+|x\rangle$&lt;/span&gt; could be the uniform superposition over all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit strings.  If Arthur had an easy way to &quot;sanitize&quot; and extract &lt;span class=&quot;math-container&quot;&gt;$|e\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; then Arthur could solve &lt;span class=&quot;math-container&quot;&gt;$\mathsf{3SAT}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I tried to deterministically do the check (in each branch separately)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The protocol assumes that Merlin gives Arthur a uniform superposition of &lt;span class=&quot;math-container&quot;&gt;$|H\rangle$&lt;/span&gt;.  Arthur can perform &lt;em&gt;either&lt;/em&gt; the first test to determine if &lt;span class=&quot;math-container&quot;&gt;$y\in H'$&lt;/span&gt;, &lt;em&gt;or&lt;/em&gt; the second test to determine if &lt;span class=&quot;math-container&quot;&gt;$H=H'$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further to the comments, let's look at 4 different tests/situations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(a0)&lt;/strong&gt; Merlin sends &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$H'=H$&lt;/span&gt; and Arthur tests whether &lt;span class=&quot;math-container&quot;&gt;$x\not\in H'$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(a1)&lt;/strong&gt; Merlin sends &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; being a non-sense encoding, and Arthur tests whether &lt;span class=&quot;math-container&quot;&gt;$x\not\in H'$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(b0)&lt;/strong&gt; Merlin sends &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$H'=H$&lt;/span&gt; and Arthur tests whether &lt;span class=&quot;math-container&quot;&gt;$H'=H$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(b1)&lt;/strong&gt; Merlin sends &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle$&lt;/span&gt; with  &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; being a non-sense encoding, and Arthur tests whether &lt;span class=&quot;math-container&quot;&gt;$H'=H$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like you are worried about the &lt;strong&gt;(a1)&lt;/strong&gt; case - indeed, Arthur might be fooled into thinking that &lt;span class=&quot;math-container&quot;&gt;$x\not\in H$&lt;/span&gt; only because Merlin maliciously sent a non-sense encoding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt; as long as Arthur can do the &lt;strong&gt;(b)&lt;/strong&gt; tests sometimes, he has a chance of catching Merlin in a cheat.  The &lt;strong&gt;(b)&lt;/strong&gt; tests rely on the group-theoretic fact that Arthur, as weak as he is, can still create and Hadamard &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|H'\rangle+|1\rangle |H'y\rangle$&lt;/span&gt;, for a &lt;span class=&quot;math-container&quot;&gt;$y\in H$&lt;/span&gt; of Arthur's choice.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These &lt;strong&gt;(b)&lt;/strong&gt; tests suffice to make sure that Merlin did &lt;em&gt;not&lt;/em&gt; send a non-sense encoding, because if Merlin sent a non-sense encoding, then &lt;span class=&quot;math-container&quot;&gt;$\langle H'|H\rangle\le \epsilon$&lt;/span&gt;, and Arthur will measure &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; sometimes after Hadamarding &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|H'\rangle+|1\rangle |H'y\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a system is in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle|H'\rangle+|1\rangle|H'y\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle=|H'y\rangle$&lt;/span&gt;, then Hadamarding and measuring the left qubit will always return &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, because the right qubits representing &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H'y$&lt;/span&gt; &quot;destructively interfere.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But there's the group-theoretic fact that if &lt;span class=&quot;math-container&quot;&gt;$y\not\in H'$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|H'\rangle\ne|H'y\rangle$&lt;/span&gt;.  Then Hadamarding &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle|H'\rangle+|1\rangle|H'y\rangle)$&lt;/span&gt; will sometimes return &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in the left qubit, because the right qubits representing &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H'y$&lt;/span&gt; do not interfere.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-07-07T13:24:13.677" LastActivityDate="2019-07-07T13:24:13.677" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6686" PostTypeId="1" AcceptedAnswerId="6691" CreationDate="2019-07-05T02:47:36.373" Score="1" ViewCount="645" Body="&lt;p&gt;I am trying to understand the CRZ and CRY gates functions : what do they actually used for ? why we require a certain angle rotation around z or y Axis on a Qubit ? and what does it yield ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application : performing a CNX with Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def cnx(qc, *qubits):&#xA;  if len(qubits) &amp;gt;= 3:&#xA;    last = qubits[-1]&#xA;    #What's the goal of the next two lines ?&#xA;    qc.crz(np.pi/2, qubits[-2], qubits[-1])&#xA;    qc.cry(np.pi/2, 0, 0, qubits[-2],qubits[-1])&#xA;&#xA;    #Is this a recursive call to cnx ?&#xA;    cnx(qc,*qubits[:-2],qubits[-1])&#xA;&#xA;    #what there's this flip too ?&#xA;    qc.cry(-np.pi/2, 0, 0, qubits[-2], qubits[-1])&#xA;&#xA;    #what about this line ?&#xA;    cnx(qc,*qubits[:-2],qubits[-1])&#xA;&#xA;    #what about this line too?&#xA;    qc.crz(-np.pi/2,qubits[-2],qubits[-1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Please explain inline questions, in the context of the initial question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="2927" LastEditDate="2019-07-05T17:53:20.603" LastActivityDate="2019-07-05T17:53:20.603" Title="CRZ and CRY Gates" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6688" PostTypeId="1" CreationDate="2019-07-05T12:17:24.913" Score="1" ViewCount="245" Body="&lt;p&gt;I have an example with 6 qubits for names and 6 for telephones. I encoded their relation like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(ControlledOnInt(1, SetRegisterToInt(6, _)))(rnames, rtels);&#xA;(ControlledOnInt(3, SetRegisterToInt(2, _)))(rnames, rtels);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So there are only 2 registers states(tel-&gt;name) in a BD with 64 possible states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I ask the BD for a name from a telephone it works ok, 6 =&gt; 2 and 2 =&gt; 3 because only in these 2 values (6 and 2) the marked qbit entangled with telephones is One.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the important part is the oracle made with ControlledOnInt, and I need to know how does it, because I have my own Grovers in c++ and I want to know the details to make it, and also to learn what gates it uses and how it multiply the matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="7933" LastEditorUserId="2879" LastEditDate="2019-10-22T05:12:25.760" LastActivityDate="2019-10-22T05:12:25.760" Title="How does ControlledOnInt in Q# make it Grovers Oracle?" Tags="&lt;grovers-algorithm&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6689" PostTypeId="1" AcceptedAnswerId="6690" CreationDate="2019-07-05T13:24:59.907" Score="1" ViewCount="99" Body="&lt;p&gt;If I have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit system and a projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; such as &lt;span class=&quot;math-container&quot;&gt;$P_0 = \left|0\right&amp;gt;^{\otimes n}\left&amp;lt;0\right|^{\otimes n}$&lt;/span&gt; (as an example) on those qubits, &lt;strong&gt;is there an efficient way to implement the unitary &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta P}$&lt;/span&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the specific example given, there is a simple but inefficient implementation in terms of exponentials of Paulis: &lt;span class=&quot;math-container&quot;&gt;$$P_0 = \sum_{j\in\left\lbrace0, 1\right\rbrace^n}\bigotimes_{k=1}^nZ_k^{j_k},$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Z^1_k$&lt;/span&gt; is the Pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator on qubit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^0_k$&lt;/span&gt; is the identity on qubit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. That is, the given projector is the sum over all possible permutations of identity and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and identities all commute, this can then be written as &lt;span class=&quot;math-container&quot;&gt;$$U_{P_0} = \prod_{j\in\left\lbrace0, 1\right\rbrace^n}e^{-i\theta\bigotimes_{k=1}^nZ_k^{j_k}}.$$&lt;/span&gt; However, for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, this requires an exponential number of gates. Is there any way to improve upon this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Funnily enough, using e.g. the &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.73.58&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reck&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/1603.08788&quot; rel=&quot;nofollow noreferrer&quot;&gt;Clements&lt;/a&gt; scheme (in photonics), this appears to be trivial, as it's simply a phase on a single mode. However, to my knowledge, this doesn't count as it requires an expontial number of resources to recreate the evolution given by a unitary acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2020-06-16T13:27:57.320" Title="Efficient implementation of exponential of projector" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6690" PostTypeId="2" ParentId="6689" CreationDate="2019-07-05T15:21:06.300" Score="3" Body="&lt;p&gt;With auxiliary qubits, you could construct a gate that is controlled on the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits being &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to the auxiliary. This can be done with polynomially many gates and auxiliaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have that, you can apply contolled &lt;span class=&quot;math-container&quot;&gt;$e^{-i \theta}$&lt;/span&gt; on any of the original &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then do all the uncomputation.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2020-06-16T13:27:57.320" LastActivityDate="2020-06-16T13:27:57.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6691" PostTypeId="2" ParentId="6686" CreationDate="2019-07-05T15:40:44.203" Score="1" Body="&lt;p&gt;Quantum algorithms provide a computational speedup by orchestrating constructive &lt;em&gt;and&lt;/em&gt; destructive interference of the amplitudes.  It is as if there must be a &quot;minus&quot; sign somewhere in the matrices - otherwise we merely work in the classical world, and would not see a computational speedup. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider the following gates as controlled Pauli matrices:&lt;/p&gt;&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  CR_x&amp;amp;=&#xA;    \begin{pmatrix}&#xA;      1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;      0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;      0&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;      0&amp;amp;0&amp;amp;1&amp;amp;0&#xA;    \end{pmatrix} \\&#xA;\\&#xA;  CR_y&amp;amp;=&#xA;    \begin{pmatrix}&#xA;      1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;      0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;      0&amp;amp;0&amp;amp;0&amp;amp;-i\\&#xA;      0&amp;amp;0&amp;amp;i&amp;amp;0&#xA;    \end{pmatrix} \\\&#xA;\\&#xA; CR_z&amp;amp;=&#xA;    \begin{pmatrix}&#xA;      1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;      0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;      0&amp;amp;0&amp;amp;1&amp;amp;0\\&#xA;      0&amp;amp;0&amp;amp;0&amp;amp;-1&#xA;    \end{pmatrix} \,.&#xA;\end{align}&lt;/span&gt;&#xA;&#xA;&lt;p&gt;Clearly &lt;span class=&quot;math-container&quot;&gt;$CR_x$&lt;/span&gt; does not have a minus sign - nothing gets inverted.  &lt;span class=&quot;math-container&quot;&gt;$CR_x$&lt;/span&gt; corresponds to the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; gate; oOperating only with &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; gates does not provide any &lt;em&gt;quantum&lt;/em&gt; speedup - &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; gates can be implemented classically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not so, however, with &lt;span class=&quot;math-container&quot;&gt;$CR_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CR_z$&lt;/span&gt;.  For example, &lt;span class=&quot;math-container&quot;&gt;$CR_z$&lt;/span&gt; can be used to &quot;invert&quot; the probability amplitude of the marked states in Grover's algorithm.  The marked states, being inverted, will &lt;em&gt;destructively&lt;/em&gt; interfere with the unmarked states during the diffusion operation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a simple example, consider qubits &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\frac{1}{\sqrt{2}}|(|00\rangle+|11\rangle)$&lt;/span&gt;.  The &quot;target&quot; qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; only when the &quot;control&quot; qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CR_x|\psi\rangle=\frac{1}{\sqrt{2}}(|00\rangle+|10\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CR_y|\psi\rangle=\frac{1}{\sqrt{2}}(|00\rangle-i|10\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CR_z|\psi\rangle=\frac{1}{\sqrt{2}}|(|00\rangle-|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the &quot;control&quot; qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, the &quot;target&quot; qubit may have a phase of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-07-05T15:40:44.203" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6692" PostTypeId="1" AcceptedAnswerId="6698" CreationDate="2019-07-05T16:39:31.733" Score="4" ViewCount="270" Body="&lt;p&gt;Here's my circuit, trying to checkout the effect of measurement on the IBM Q circuit. Here you can see I do 2 different measurement at different time, and I hope to be able to see both results. However, I do not know how to do so.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EfuYx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EfuYx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(2)&#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q, c)&#xA;qc.h(q[0])&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q,c)&#xA;job_sim = execute(qc, backend=simulator, shots=1024)&#xA;counts_sim = job_sim.result().get_counts(qc)&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q,c)&#xA;job_sim2 = execute(qc, backend=simulator, shots=1024)&#xA;counts_sim2 = job_sim2.result().get_counts(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Can anyone tell me how do I extract all measurement results at different time from the same classical bits in one execution? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastActivityDate="2019-07-06T20:51:13.550" Title="How do I get out 2 measurements from the same execution on Qiskit?" Tags="&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6693" PostTypeId="2" ParentId="6688" CreationDate="2019-07-05T16:45:38.233" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.canon.controlledonint&quot; rel=&quot;nofollow noreferrer&quot;&gt;ControlledOnInt&lt;/a&gt; is a library function which applies a specified operation (in this case &lt;code&gt;SetRegisterToInt&lt;/code&gt;) to the target register only if the control register is in a state that encodes the given integer. Internally it does the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;convert the given integer to an array of bits (in little-endian format I think);&lt;/li&gt;&#xA;&lt;li&gt;applies X gate to each qubit that corresponds to a 0 bit in the notation of the integer;&lt;/li&gt;&#xA;&lt;li&gt;applies normally controlled version of the operation (apply operation if all control qubits are in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state) to the control and target registers;&lt;/li&gt;&#xA;&lt;li&gt;and applies X gate to each qubit that that corresponds to a 0 bit in the notation of the integer again to return control register to its starting state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-05T16:45:38.233" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6694" PostTypeId="1" CreationDate="2019-07-05T19:41:24.040" Score="1" ViewCount="59" Body="&lt;p&gt;I want to understand this Qiskit function (a function for creating the gate CNX with Python): more specifically i don't understand what's the rotations (Y and Z) over the qubits for ?&#xA;I added inline questions in the code below :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def cnx(qc, *qubits):&#xA; if len(qubits) &amp;gt;= 3:&#xA;  last = qubits[-1]&#xA;  #What's the goal of the next two lines ?&#xA;  qc.crz(np.pi/2, qubits[-2], qubits[-1])&#xA;  qc.cry(np.pi/2, 0, 0, qubits[-2],qubits[-1])&#xA;&#xA;  #Is this a recursive call to cnx ?&#xA;  cnx(qc,*qubits[:-2],qubits[-1])&#xA;&#xA;  #what's this flip yielding ?&#xA;  qc.cry(-np.pi/2, 0, 0, qubits[-2], qubits[-1])&#xA;&#xA;  #what about this line ?&#xA;  cnx(qc,*qubits[:-2],qubits[-1])&#xA;&#xA;  #what about this line too?&#xA;  qc.crz(-np.pi/2,qubits[-2],qubits[-1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thanks !&lt;/p&gt;&#xA;" OwnerUserId="7405" LastEditorUserId="7405" LastEditDate="2019-07-05T20:42:25.213" LastActivityDate="2019-07-05T20:42:25.213" Title="About a Qiskit Function" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6695" PostTypeId="1" AcceptedAnswerId="6711" CreationDate="2019-07-05T21:41:45.970" Score="2" ViewCount="668" Body="&lt;p&gt;I've already tried the approach in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6346&quot;&gt;this answer&lt;/a&gt;, but I'm getting this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQuantumExperience.IBMQuantumExperience.CredentialsError: error during login: License required. You need to accept the License from Web Platform. https://quantumexperience.ng.bluemix.net&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I've already accepted the terms, and have already successfully run two experiments using the Qiskit SDK, like the ones in the &lt;a href=&quot;https://qiskit.org/documentation/terra/executing_quantum_programs.html#executing-quantum-programs&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm suspecting &lt;code&gt;IBMQuantumExperience&lt;/code&gt;, and by extension &lt;a href=&quot;https://github.com/Qiskit/qiskit-api-py&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit-api-py&lt;/a&gt; might be out of date, superceded by &lt;a href=&quot;https://github.com/Qiskit/qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit&lt;/a&gt;. My question is then this: is it possible to check my remaining credits using the new library, and if so, how? If not, how else can I check my credits?&lt;/p&gt;&#xA;" OwnerUserId="5290" LastActivityDate="2019-07-08T14:10:56.540" Title="How do I check my remaining IBM Q credits?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6697" PostTypeId="1" AcceptedAnswerId="6714" CreationDate="2019-07-06T05:27:22.313" Score="0" ViewCount="618" Body="&lt;p&gt;I'm trying to create and run parallel execution using the instruction &lt;a href=&quot;https://medium.com/qiskit/qiskit-backends-what-they-are-and-how-to-work-with-them-fb66b3bd0463&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. However, when I implement it, it tells me that I shouldn't be using &lt;code&gt;compile&lt;/code&gt; anymore since&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;DeprecationWarning: qiskit.compile() is deprecated and will be removed in Qiskit Terra 0.9. Please use qiskit.compiler.transpile() to transform circuits and qiskit.compiler.assemble() to produce a runnable qobj.&#xA;    DeprecationWarning)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So how do I go about doing this using the new modules? Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the code in the link for creating parallel executions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit import Aer, compile&#xA;from qiskit.backends.jobstatus import JOB_FINAL_STATES&#xA;&#xA;n_qubits = 5&#xA;qc_list = []&#xA;for i in range(n_qubits):&#xA;    qr = QuantumRegister(n_qubits)&#xA;    cr = ClassicalRegister(n_qubits)&#xA;    qc = QuantumCircuit(qr, cr)&#xA;    qc.x(qr[i])&#xA;    qc.measure(qr, cr)&#xA;    qc_list.append(qc)&#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;qobj_list = [compile(qc, backend) for qc in qc_list]&#xA;job_list = [backend.run(qobj) for qobj in qobj_list]&#xA;&#xA;while job_list:&#xA;    for job in job_list:&#xA;        if job.status() in JOB_FINAL_STATES:&#xA;            job_list.remove(job)&#xA;            print(job.result().get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7598" LastActivityDate="2019-07-08T17:28:01.303" Title="Creating and running parallel circuits in Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6698" PostTypeId="2" ParentId="6692" CreationDate="2019-07-06T14:30:30.623" Score="2" Body="&lt;p&gt;Unfortunately this is not currently possible on the IBM devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you should really do is only have four classical channels and send your first two measurements to the first two classical channels, and the second two measurements to the second two classical channels. You then only execute the circuit once. However, you can try this and it still won't work because this can't yet be done on the IBM machines.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit:&lt;/strong&gt; a slightly more constructive answer is that you can achieve what you want using two extra qubits. The idea is to replace the first two measurements with CNOTs with the controls on your qubits and the target on the extra qubits. You can then measure all four qubits. The measurement of the extra qubits corresponds to your first set of measurements and the measurements of your original qubits corresponds to the second set of measurments.&lt;/p&gt;&#xA;" OwnerUserId="6076" LastEditorUserId="6076" LastEditDate="2019-07-06T20:48:50.133" LastActivityDate="2019-07-06T20:48:50.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6699" PostTypeId="2" ParentId="6692" CreationDate="2019-07-06T20:51:13.550" Score="1" Body="&lt;p&gt;When you measure, you choose a bit where the result should go. If you measure to the same bit multiple times, then the results of all but the last will not be recorded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the results you want, you'll need to declare more bits. For example, you could use a couple of two-bit classical registers: one for the first pair of bits, and the other for the second.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(2)&#xA;c1 = ClassicalRegister(2)&#xA;c2 = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q, c)&#xA;qc.h(q[0])&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q,c1)&#xA;job_sim = execute(qc, backend=simulator, shots=1024)&#xA;counts_sim = job_sim.result().get_counts(qc)&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q,c2)&#xA;job_sim2 = execute(qc, backend=simulator, shots=1024)&#xA;counts_sim2 = job_sim2.result().get_counts(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As the other answer notes, this will not currently run on real hardware. Only on simulators.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-07-06T20:51:13.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6700" PostTypeId="1" AcceptedAnswerId="6712" CreationDate="2019-07-07T01:48:01.123" Score="0" ViewCount="350" Body="&lt;p&gt;I am trying to run an execution on IBMQx2 where I can specify the physical qubits to which I apply gates. The execution without the &lt;code&gt;initial_layout&lt;/code&gt; runs fine, but the one with it keeps giving me either &lt;code&gt;&quot;statusCode&quot;:400,&quot;name&quot;:&quot;Q_OBJECT_NOT_VALID&quot;&lt;/code&gt; or &lt;code&gt;'Not enough qubits in CouplingGraph'&lt;/code&gt;. Here's the circuit that I use:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(5, 'q')&#xA;cr = ClassicalRegister(5)&#xA;qc = QuantumCircuit(qr, cr)&#xA;qc.h(qr[0])&#xA;qc.h(qr[1])&#xA;qc.h(qr[2])&#xA;qc.h(qr[3])&#xA;qc.h(qr[4])&#xA;qc.measure(qr, cr)&#xA;&#xA;coupling_map = [[0, 1], [0, 2], [1, 2], [3, 2], [3, 4], [4, 2]]&#xA;layout = {0: qr[0], 1: qr[1], 2: qr[2], 3: qr[3], 4: qr[4]}&#xA;#layout = {('qr', 0): ('q', 0), ('qr', 1): ('q', 1), ('qr', 2): ('q', 2), ('qr', 3): ('q', 3), ('qr', 4): ('q', 4)}&#xA;&#xA;job_exp = execute(qc, backend=backend, coupling_map=coupling_map, initial_layout=layout, shots=16384)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I use the first layout, it gives me, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;JobError: &quot;{'statusCode': 400, 'name': 'Q_OBJECT_NOT_VALID', 'message': 'Q-Object not valid.', 'code': 'Q_OBJECT_NOT_VALID'}&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;which I think may be caused by deprecated syntax or something, so I went on &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/terra/using_the_transpiler.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; to find what I hope is a more updated version of &lt;code&gt;initial_layout&lt;/code&gt;. It got worse: this seems to be even older, and with it another error,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;TranspilerError: 'Not enough qubits in CouplingGraph'`&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The problem persists whether I add &lt;code&gt;coupling_map&lt;/code&gt; in or not. Can anyone tell me how to fix this? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="7598" LastEditDate="2019-07-07T01:55:04.817" LastActivityDate="2019-07-08T15:20:38.903" Title="Problem with initial_layout on Qiskit/IBMQ: 'Not enough qubits in CouplingGraph'" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6701" PostTypeId="1" CreationDate="2019-07-07T04:42:14.560" Score="1" ViewCount="18" Body="&lt;p&gt;I have been reading this paper: &lt;a href=&quot;https://arxiv.org/abs/1906.01563v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1906.01563v1&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering: is it possible to use the idea behind quantum circuits to build classical Hamiltonians represented in the same way? &lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2019-07-07T04:42:14.560" Title="Ansatz Techniques to Multi-Body Physics Problems" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6702" PostTypeId="1" CreationDate="2019-07-07T20:40:58.733" Score="3" ViewCount="166" Body="&lt;p&gt;My question is about if there is any way to represent a circuit that take 3 inputs and applies a rotation gate on the third qubit if the first two qubits is similar (has the same state)?&lt;/p&gt;&#xA;" OwnerUserId="6098" LastEditorUserId="2927" LastEditDate="2019-07-07T20:42:45.847" LastActivityDate="2019-07-07T21:02:28.387" Title="control gate with 3 inputs, two control and rotation gate" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;quantum-control&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6703" PostTypeId="2" ParentId="6702" CreationDate="2019-07-07T20:56:19.653" Score="1" Body="&lt;pre&gt;&lt;code&gt; #This line creates the circuit instance&#xA; circuit = cirq.Circuit() &#xA;&#xA; #These lines creates the cubits you want to use from a given length&#xA; length = 3&#xA; qubits = [cirq.LineQubit(i) for i in range(length)]&#xA;&#xA; #Here you assign the control qubits (the first two) and then the target qubit&#xA; controlled_rotation_on_Z = cirq.Z.controlled_by(*qubits[:-1])&#xA; circuit.append(controlled_rotation_on_Z(qubits[-1]))&#xA;&#xA;Yielding the following circuit:&#xA;&#xA;0: ───@───&#xA;      │&#xA;1: ───@───&#xA;      │&#xA;2: ───Z───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is worth noting that it can be more than just 3 qubits. You can have N available qubits and you can develop a control gate, i.e. a Toffoli gate, that controls N-1 qubits and the very last qubit is the target qubit. So, it doesn't have to just rotation gates. Something to keep in mind. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at this question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6607/how-to-create-an-n-qubit-normally-controlled-gate?rq=1&quot;&gt;How to create an $n$-qubit normally controlled gate?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And there are more of these questions in the exchange. I personally asked a couple of weeks ago about an N-Toffoli gate and was helped out greatly by that answer!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2019-07-07T21:02:28.387" LastActivityDate="2019-07-07T21:02:28.387" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6704" PostTypeId="1" CreationDate="2019-07-07T21:08:31.757" Score="1" ViewCount="51" Body="&lt;p&gt;I am working on implementing a paper on QNNs. I have successfully been able to resize a MNIST digit to be able to meet the size of quantum circuit. But I am not clear of how to convert the resized image into a format that will allow me to use it to apply to this circuit to see how label classification works in this quantum circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any suggestions would be mostly appreciated. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2019-07-07T21:08:31.757" Title="Encoding Binary Data into Quantum Basis" Tags="&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6705" PostTypeId="2" ParentId="6628" CreationDate="2019-07-08T02:50:48.323" Score="1" Body="&lt;p&gt;In the last equation in the question above the left hand, and right hand - the &lt;span class=&quot;math-container&quot;&gt;$\Delta \theta$&lt;/span&gt; terms cancel, and the denominator &lt;span class=&quot;math-container&quot;&gt;$\sin^{2}(\theta)$&lt;/span&gt; term whose root is as you mentioned inverted (as it's in the denominator) to give the bound as the first equation in the question. See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1939/grovers-algorithm-why-do-we-floor&quot;&gt;related question for the floor operation&lt;/a&gt;,&lt;/p&gt;&#xA;" OwnerUserId="429" LastEditorUserId="26" LastEditDate="2019-10-14T16:14:37.640" LastActivityDate="2019-10-14T16:14:37.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6706" PostTypeId="1" CreationDate="2019-07-08T09:16:45.397" Score="1" ViewCount="42" Body="&lt;p&gt;This &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter notebook&lt;/a&gt; implements &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1090780704003696&quot; rel=&quot;nofollow noreferrer&quot;&gt;GRAPE&lt;/a&gt;&#xA;for the synthesisizing a CNOT gate.&#xA; More info can be found &lt;a href=&quot;https://www.dropbox.com/s/0kgrph09ghy5p74/khaneja2005GRAPE.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and in this short &lt;a href=&quot;https://www.dropbox.com/s/huuhqwtvg1bx2ag/grape_june_2010_slides.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation&lt;/a&gt;.&#xA;In the following &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter notebook&lt;/a&gt; at In[8] &lt;img src=&quot;https://i.stack.imgur.com/zd1n9.png&quot; alt=&quot;screenshot&quot;&gt;  &lt;a href=&quot;https://i.stack.imgur.com/zd1n9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&#xA;the starting guess for the control field is prepared as follows&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;generate  a vector of random numbers for each control field&lt;/li&gt;&#xA;&lt;li&gt;convolve it with another vector of length 10 (consisting of '1'). &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Why is there a need to convolve the field? &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1090780704003696&quot; rel=&quot;nofollow noreferrer&quot;&gt;GRAPE&lt;/a&gt; does not say anything about how one must generate the initial guess.&#xA;Also as side questions&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;why do it with a vector of ones?&lt;/li&gt;&#xA;&lt;li&gt;what is the reason behind choosing the value 2*np.pi*0.01 in the initial random generation step&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="462" LastEditorUserId="462" LastEditDate="2019-07-13T04:52:53.243" LastActivityDate="2019-07-13T04:52:53.243" Title="What is the need of convolution here?" Tags="&lt;qutip&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6707" PostTypeId="1" CreationDate="2019-07-08T10:43:54.977" Score="0" ViewCount="37" Body="&lt;p&gt;This question requires the knowledge of &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1090780704003696&quot; rel=&quot;nofollow noreferrer&quot;&gt;GRAPE&lt;/a&gt;. More info can be found &lt;a href=&quot;https://www.dropbox.com/s/0kgrph09ghy5p74/khaneja2005GRAPE.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and in this short &lt;a href=&quot;https://www.dropbox.com/s/huuhqwtvg1bx2ag/grape_june_2010_slides.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation&lt;/a&gt;.&#xA;In the following &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter notebook&lt;/a&gt; the result of this line&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;_overlap(result.U_f, U_f_numerical).real, abs(_overlap(result.U_f, U_f_numerical))**2&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(which is in the &quot;Test numerical integration of GRAPE pulse&quot;) the result obtained seems very low.&#xA;Why would the unitary obtained by the propagator function  &quot;U_f_numerical&quot; be so different from that derived from the cy_grape_unitary function &quot;result.U_f&quot;?&lt;br&gt;&#xA;They are both derived from &quot;result.H_t&quot;. I am saying that they seem to be different based on the low value &quot;0.11355125771393167&quot; of the _overlap function. I may be totally wrong about this. &#xA;I have raised this as an &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/issues/81&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="462" LastEditDate="2019-07-13T04:47:11.820" LastActivityDate="2019-07-13T04:47:11.820" Title="Different values of similar functions" Tags="&lt;qutip&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6708" PostTypeId="1" AcceptedAnswerId="6717" CreationDate="2019-07-08T10:51:07.620" Score="4" ViewCount="404" Body="&lt;p&gt;When interpreted geometrically, the second phase of the Grover's algorithm which corresponds to inversion about the mean is interpreted as reflection over the original state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you explain intuitively the relationship between those two?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2019-07-10T21:49:15.387" Title="Second reflection in the Grover's algorithm" Tags="&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6709" PostTypeId="1" CreationDate="2019-07-08T11:47:02.847" Score="1" ViewCount="39" Body="&lt;p&gt;This question requires the knowledge of &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S1090780704003696&quot; rel=&quot;nofollow noreferrer&quot;&gt;GRAPE&lt;/a&gt;. More info can be found &lt;a href=&quot;https://www.dropbox.com/s/0kgrph09ghy5p74/khaneja2005GRAPE.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and in this short &lt;a href=&quot;https://www.dropbox.com/s/huuhqwtvg1bx2ag/grape_june_2010_slides.pdf?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation&lt;/a&gt;.&#xA;In the following &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/blob/master/examples/control-grape-cnot.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter notebook&lt;/a&gt; is the analytical solution as in this image right?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/GxcAM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GxcAM.png&quot; alt=&quot;anal-grape-qutip&quot;&gt;&lt;/a&gt;&#xA;Because on trying (g = pi/ 4* T = 1/8) as in this figure &#xA;&lt;a href=&quot;https://i.stack.imgur.com/WqYQG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WqYQG.png&quot; alt=&quot;verify&quot;&gt;&lt;/a&gt;&#xA;I am unable to get the U = cnot() (the target unitary)&#xA;&#xA;I may have commited a mistake somewhere in the calculations. If so, I would be very much obliged if you would point it out to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have raised an &lt;a href=&quot;https://github.com/qutip/qutip-notebooks/issues/82&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="462" LastEditDate="2019-07-13T04:51:19.050" LastActivityDate="2019-07-13T04:51:19.050" Title="Is the analytical solution right?" Tags="&lt;qutip&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6710" PostTypeId="2" ParentId="5007" CreationDate="2019-07-08T12:48:36.940" Score="4" Body="&lt;p&gt;Posting an answer because I realised what my issue was:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I didn't realise then: When a density matrix is written in any basis, the diagonal elements correspond to the probabilities of the density matrix landing on the basis states of that basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if in some basis formed by vectors &lt;span class=&quot;math-container&quot;&gt;$|x_1\rangle, |x_2\rangle, |x_3\rangle, |x_4&#xA;\rangle$&lt;/span&gt;, my density matrix is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;a_{11} &amp;amp; a_{12} &amp;amp; a_{13} &amp;amp; a_{14} \\&#xA;a_{21} &amp;amp; a_{22} &amp;amp; a_{23} &amp;amp; a_{24} \\&#xA;a_{31} &amp;amp; a_{32} &amp;amp; a_{33} &amp;amp; a_{34} \\&#xA;a_{41} &amp;amp; a_{42} &amp;amp; a_{43} &amp;amp; a_{44} \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the probability of this state showing up as &lt;span class=&quot;math-container&quot;&gt;$|x_1\rangle \langle x_1|$&lt;/span&gt; when measured is &lt;span class=&quot;math-container&quot;&gt;$a_{11}$&lt;/span&gt;, as seen by the trace rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probability that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; gives &lt;span class=&quot;math-container&quot;&gt;$|x_1\rangle \langle x_1|$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$Tr(|x_1\rangle \langle x_1| \rho)$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$a_{11}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, in the above question, since the matrix is written in the &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_i\}$&lt;/span&gt; basis, &lt;span class=&quot;math-container&quot;&gt;$p_i'$&lt;/span&gt; is the probability of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; landing on &lt;span class=&quot;math-container&quot;&gt;$|\sigma_i\rangle$&lt;/span&gt;, and when multiplied and trace is taken, it results in the corresponding expression. Therefore, the intuition holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the '&lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; basis' is one in which the log matrix is diagonal.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-07-08T12:48:36.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6711" PostTypeId="2" ParentId="6695" CreationDate="2019-07-08T14:10:56.540" Score="0" Body="&lt;p&gt;You are correct that &lt;code&gt;IBMQuantumExperience&lt;/code&gt; is a deprecated library. Anything you wanted to use &lt;code&gt;IBMQuantumExperience&lt;/code&gt; to do you can now do through &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;qiskit-ibmq-provider&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your main question, the credit system is being removed in the future, so there is currently no way to check your remaining credits. The feature used to be in the old IBM Q Experience page, but since the new, beta version has been launched it no longer has that capability.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-08T14:10:56.540" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6712" PostTypeId="2" ParentId="6700" CreationDate="2019-07-08T15:20:38.903" Score="3" Body="&lt;p&gt;The &lt;code&gt;Q-Object not valid&lt;/code&gt; error you received is caused by the amount of &lt;code&gt;shots&lt;/code&gt; you set. The max &lt;code&gt;shots&lt;/code&gt; allowed is 8192. Since the amount of &lt;code&gt;shots&lt;/code&gt; you set (16384) is greater than the max amount of &lt;code&gt;shots&lt;/code&gt; allowed, you get that error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;TranspilerError&lt;/code&gt; is caused by the second format for &lt;code&gt;layout&lt;/code&gt;. When I tested your code with the second &lt;code&gt;layout&lt;/code&gt;, I received this error and a warning stating that the format being used for &lt;code&gt;initial_layout&lt;/code&gt; was being deprecated. So I would stick to the first format for &lt;code&gt;layout&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you change the amount of &lt;code&gt;shots&lt;/code&gt; to be &amp;lt;=8192 and use the first format for &lt;code&gt;layout&lt;/code&gt;, then I believe the code should run.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-08T15:20:38.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6713" PostTypeId="2" ParentId="6639" CreationDate="2019-07-08T16:35:35.157" Score="3" Body="&lt;p&gt;I am also an undergraduate hoping to start a career in quantum computing someday. I'm a physics student who became interested in the subject about a year ago, and these are some things that helped me build a foundation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of background, linear algebra is the only course that is essential for understanding the basics of the subject. The reason is that computation can be simplified as a series of matrices (called gates) acting on a particular vector (called the state). A course in quantum mechanics will be necessary for more advanced studies and many applications of quantum computing, but you are perfectly qualified to start learning the basics without such a course.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of resources, my advice is to start with something lighter than a textbook for your first introduction. I highly recommend the Microsoft Q# Support Docs, especially the &quot;Quantum Computing Concepts&quot; articles found &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. If you're looking to start programming, Q# will be very difficult to learn without background in C# and a &lt;a href=&quot;https://en.wikipedia.org/wiki/Functional_programming&quot; rel=&quot;nofollow noreferrer&quot;&gt;functional programming language&lt;/a&gt;, so it may not be the right language to start out on. It's nothing against the language, but it was hard for me since I had never used C# and had trouble reading the language-specific docs before my functional programming course. I personally have a lot of training in Python, so languages like &lt;a href=&quot;https://github.com/quantumlib/Cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google's Cirq&lt;/a&gt; or &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM's Qiskit&lt;/a&gt; were more natural choices for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you've gone through a few of those articles on the basics, that's when I would pick up a textbook. Someone has already mentioned &quot;Mike and Ike&quot; (&lt;a href=&quot;https://www.cambridge.org/core/books/quantum-computation-and-quantum-information/01E10196D0A682A6AEFFEA52D53BE9AE&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt;&lt;/a&gt; by Michael Nielsen and Isaac Chuang) which is one of the most highly regarded books on the subject. Another I'd like to mention is &lt;a href=&quot;https://www.cambridge.org/core/books/quantum-computer-science/66462590D10C8010017CF1D7C45708D7&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computer Science: An Introduction&lt;/em&gt;&lt;/a&gt; by N. David Mermin, which is pretty accessible for someone without a background in quantum mechanics, at least for a few chapters. No book is going to be right for everyone, so just try a few and see what makes sense for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My last piece of advice is to find a friend to work through material with or a professor to help walk you through particularly difficult topics. Something to remember throughout your academic career is that math, and related fields, is better with a guide. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="4616" LastActivityDate="2019-07-08T16:35:35.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6714" PostTypeId="2" ParentId="6697" CreationDate="2019-07-08T17:28:01.303" Score="4" Body="&lt;p&gt;Yes, &lt;code&gt;compile&lt;/code&gt; is deprecated in favor of &lt;code&gt;transpile&lt;/code&gt; and &lt;code&gt;assemble&lt;/code&gt;. For your code, using these two new functions would look something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Add to your import statements&#xA;from qiskit.compiler import transpile, assemble&#xA;&#xA;# After creating qc_list&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;transpiled_circs = transpile(qc_list, backend=backend)&#xA;qobjs = assemble(transpiled_circs, backend=backend)&#xA;job_info = backend.run(qobjs)&#xA;&#xA;# To get the results&#xA;for circ_index in range(len(transpiled_circs)):&#xA;    print(job_info.result().get_counts(transpiled_circs[circ_index]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;About the code&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qc_list&lt;/code&gt; is still a list of circuits. &lt;code&gt;transpiled_circs&lt;/code&gt; is a list of transpiled circuits from &lt;code&gt;qc_list&lt;/code&gt;. &lt;code&gt;qobjs&lt;/code&gt; is a single qobj with information for each circuit in &lt;code&gt;transpiled_circs&lt;/code&gt;. &lt;code&gt;job_info&lt;/code&gt; is job that is returned from &lt;code&gt;backend.run(qobjs)&lt;/code&gt; it is a single job object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;code&gt;job_info&lt;/code&gt; is a single job, the results for each circuit are located &lt;code&gt;job_info.result().get_counts()&lt;/code&gt;. You just need to provide &lt;code&gt;get_counts&lt;/code&gt; with a circuit to return the specific results for that circuit. That is what the for loop provides.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;About transpile and assemble&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;transpile&lt;/code&gt; takes in a &lt;code&gt;QuantumCircuit&lt;/code&gt; or list of &lt;code&gt;QuantumCircuits&lt;/code&gt; and runs through certain &lt;code&gt;PassManagers&lt;/code&gt; which optimize the circuit for the specific backend given. This can include rearranging gates, compressing sets of gates, deleting unnecessary gates, rearranging CX connections, etc. It returns a new circuit, or list of circuits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;assemble&lt;/code&gt; takes in a &lt;code&gt;QuantumCircuit&lt;/code&gt; of a list of &lt;code&gt;QuantumCircuits&lt;/code&gt; and compresses them into a &lt;code&gt;qobj&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source code for both functions can be found here: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/compiler/transpile.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;transpile&lt;/a&gt;,  &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/compiler/assemble.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;assemble&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-08T17:28:01.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6715" PostTypeId="1" CreationDate="2019-07-08T17:31:01.403" Score="1" ViewCount="79" Body="&lt;p&gt;I want to know the big difference, in terms of fabrication (circuit) between a charge Qubit and a Transmon, how is a Transmon less affected by noise ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="7405" LastActivityDate="2019-07-08T17:31:01.403" Title="Charge Qubit vs Transmon" Tags="&lt;physical-qubit&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6716" PostTypeId="1" CreationDate="2019-07-08T17:36:41.527" Score="2" ViewCount="134" Body="&lt;p&gt;Where I can read about protein folding on quantum computer (Qiskit will be ideal variant) with simple examples? Thanks&lt;/p&gt;&#xA;" OwnerUserId="6025" LastEditorUserId="55" LastEditDate="2021-04-12T15:24:14.483" LastActivityDate="2021-05-12T19:01:45.157" Title="Where I can read about protein folding on quantum computers with simple examples?" Tags="&lt;qiskit&gt;&lt;resource-request&gt;&lt;biology&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6717" PostTypeId="2" ParentId="6708" CreationDate="2019-07-09T03:45:30.773" Score="5" Body="&lt;p&gt;The Grover diffusion operator, the second phase of the algorithm, is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D = 2\left|s\right&amp;gt;\left&amp;lt;s\right| - I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\left|s\right&amp;gt; = \frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}\left|x\right&amp;gt;$&lt;/span&gt;, which is also known as the uniform superposition, or, in the case of the question, the &quot;original state&quot;. To see why this inverts over the mean, first notice that, for a given state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \sum_{x=0}^{N-1}a_x \left|x\right&amp;gt;$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|s\right&amp;gt;\langle s|\psi\rangle = (\frac{1}{N}\sum_{x=0}^{N-1}a_x)\sum_{x=0}^{N-1}\left|x\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, &lt;span class=&quot;math-container&quot;&gt;$(2\left|s\right&amp;gt;\left&amp;lt;s\right| - I)\left|\psi\right&amp;gt; = 2\left|s\right&amp;gt;\langle s|\psi\rangle - \left|\psi\right&amp;gt;$&lt;/span&gt;, for the probability amplitude for each &lt;span class=&quot;math-container&quot;&gt;$\left|x\right&amp;gt;$&lt;/span&gt;, gives double the mean value of all the probability amplitudes minus the original amplitude: inversion over the mean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;'s basic 2 projection minus identity structure is what makes it interpretable as a reflection over &lt;span class=&quot;math-container&quot;&gt;$\left|s\right&amp;gt;$&lt;/span&gt;: to see this intuitively, notice that if &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = a_s \left|s\right&amp;gt; + a_r \left|r\right&amp;gt;$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\langle s|r\rangle = 0$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; are orthogonal), then &lt;span class=&quot;math-container&quot;&gt;$D\left|\psi\right&amp;gt; = 2a_s \left|s\right&amp;gt; - a_s\left|s\right&amp;gt; - a_r \left|r\right&amp;gt; = a_s \left|s\right&amp;gt; - a_r \left|r\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first phase is also a reflection too in a slightly different manner. To negate only the target vector &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt;, the operator is of the form &lt;span class=&quot;math-container&quot;&gt;$I - 2\left|\omega\right&amp;gt;\left&amp;lt;\omega\right|$&lt;/span&gt;: the probability amplitude of states orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt; is left alone while the probability amplitude of &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt; is negated. This reversal means that, instead of being a reflection over &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt;, it is a reflection over the hyperplane orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can interpret both reflections together by creating a plane out of the orthogonal &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|s'\right&amp;gt; = \frac{1}{\sqrt{N - 1}} \sum_{x\neq\omega}\left|x\right&amp;gt;$&lt;/span&gt; (&lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm#/media/File:Grovers_algorithm_geometry.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia's diagram of this&lt;/a&gt; is excellent). Then the first phase is a reflection over &lt;span class=&quot;math-container&quot;&gt;$\left|s'\right&amp;gt;$&lt;/span&gt; and the second phase is a reflection over &lt;span class=&quot;math-container&quot;&gt;$\left|s\right&amp;gt;$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$\left|s\right&amp;gt;$&lt;/span&gt; is at an angle away from &lt;span class=&quot;math-container&quot;&gt;$\left|s'\right&amp;gt;$&lt;/span&gt; towards &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt;, then successive applications of the first and second phase will steer the state towards &lt;span class=&quot;math-container&quot;&gt;$\left|\omega\right&amp;gt;$&lt;/span&gt;. Using this reflection paradigm, you can with some effort derive the approximately &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4} \sqrt{N}$&lt;/span&gt; stopping point before the reflecting goes too far.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2019-07-10T21:49:15.387" LastActivityDate="2019-07-10T21:49:15.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6719" PostTypeId="1" CreationDate="2019-07-09T15:20:10.753" Score="1" ViewCount="112" Body="&lt;p&gt;If I want to to search 2 values with Grover's algorithm, it  outputs the same probability for both that is bigger that the no searched states that have the same lower percent. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use an oracle  matrix with all 1's in the diagonals except on the searched states that are -1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But suppose you are going to find the drink that you want.  For example, I like coke 57% , and pepsi 10%, the rest are 1%. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change the -1 in those two values in the oracle matrix for example to near 1.5 for coke and 0.5 for pepsi, it will output more probability from bigger to lower: coke module 0.57, pepsi module 0.39 and the others randomly to 0.13. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is it possible in real life to do this? I ask because I don't know how I can change it in Q# reflection.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/// Reflection `RM` about the marked state.&#xA;operation ReflectMarked (markedQubit : Qubit) : Unit {&#xA;    R1(PI(), markedQubit);&#xA;}&#xA;&#xA;/// Reflection about the |00…0〉 state.&#xA;/// A register of n qubits initially in the |00…0〉 state.&#xA;operation ReflectZero (databaseRegister : Qubit[]) : Unit {&#xA;&#xA;    let nQubits = Length(databaseRegister);&#xA;&#xA;    for (idxQubit in 0 .. nQubits - 1) {&#xA;        X(databaseRegister[idxQubit]);&#xA;    }&#xA;&#xA;    Controlled Z(databaseRegister[1 .. nQubits - 1], databaseRegister[0]);&#xA;&#xA;    for (idxQubit in 0 .. nQubits - 1) {&#xA;        X(databaseRegister[idxQubit]);&#xA;    }&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7933" LastEditorUserId="2879" LastEditDate="2019-08-02T18:32:40.793" LastActivityDate="2019-08-03T09:57:35.140" Title="Is it possible to change the oracle in Grover's search to ponderate probabilities in multiple values search?" Tags="&lt;quantum-state&gt;&lt;grovers-algorithm&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6720" PostTypeId="2" ParentId="4268" CreationDate="2019-07-09T16:49:32.037" Score="2" Body="&lt;p&gt;Here is another way to flip the phase of only |0...0⟩:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (ancilla = Qubit()){&#xA;    (ControlledOnInt(0, X))(register, ancilla); // Bit flips the ancilla to |1⟩ if register is |0...0⟩   &#xA;    Z(ancilla);                                 // Ancilla phase (and therefore whole register phase) becomes -1 if above condition is satisfied&#xA;    (ControlledOnInt(0, X))(register, ancilla); // Puts ancilla back in |0⟩  &#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5926" LastEditorUserId="2879" LastEditDate="2019-07-09T17:54:17.173" LastActivityDate="2019-07-09T17:54:17.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6721" PostTypeId="1" CreationDate="2019-07-10T08:07:47.047" Score="9" ViewCount="93" Body="&lt;p&gt;Assume, I'm using a system of qubits to simulate a fermionic system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm using the second-quantized formalism (e.g. orbitals in quantum chemistry), the anti-symmetric nature of the fermionic wave functions can be taken into account by means of the Jordan-Wigner or Brayi-Kitaev transformation. Roughly speaking, this gives a 1-to-1 correspondence between the physical (fermionic) and logical (bosonic) DOFs, with operators of certain locality. So, in terms of qubits resources, this is as efficient as can be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, could anyone please elaborate how the issue of the wave function anti-symmetry is typically resolved within the first-quantized approach? (In other words, when doing lattice simulations.)&lt;/p&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2019-07-10T08:07:47.047" Title="Anti-symmetrization on the lattice" Tags="&lt;simulation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6722" PostTypeId="1" CreationDate="2019-07-10T16:11:20.727" Score="1" ViewCount="633" Body="&lt;p&gt;What is this dedicated use of IBMQ_16_melbourne? I am trying to run a simulation but it is not running. Is there any way to run the simulations? When is the backend coming online again for normal users?&lt;/p&gt;&#xA;" OwnerUserId="8010" LastEditorUserId="26" LastEditDate="2019-12-15T03:04:40.960" LastActivityDate="2019-12-15T03:04:40.960" Title="IBM Quantum Experience: simulation not running on IBMQ_16_melbourne" Tags="&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6723" PostTypeId="1" AcceptedAnswerId="6725" CreationDate="2019-07-10T17:20:28.260" Score="3" ViewCount="299" Body="&lt;p&gt;I have just tried to apply &lt;code&gt;initialize&lt;/code&gt; function to a simple circuit. There is any way to display how is done internally the initialization circuit instead of a single block with label &quot;initialize&quot;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the output of the minimal working example you can find below:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;            ┌──────────────────────────────────┐&#xA;q2476_0: |0&amp;gt;┤0                                 ├&#xA;            │  initialize(0.70711,0,0,0.70711) │&#xA;q2476_1: |0&amp;gt;┤1                                 ├&#xA;            └──────────────────────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Minimal working example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import math&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;&#xA;desired_vector = [&#xA;   1 / math.sqrt(2) * complex(1, 0),&#xA;   0,&#xA;   0,&#xA;   1 / math.sqrt(2) * complex(1,0 )]&#xA;&#xA;q = QuantumRegister(2)&#xA;qc = QuantumCircuit(q)&#xA;qc.initialize(desired_vector, [q[0],q[1]])&#xA;&#xA;qc.draw(output='mpl')&#xA;print(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8011" LastActivityDate="2019-07-10T19:04:06.147" Title="Draw &quot;Initialize&quot; circuit as sequence of single gates" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6725" PostTypeId="2" ParentId="6723" CreationDate="2019-07-10T19:04:06.147" Score="3" Body="&lt;p&gt;There is a way, though it is pretty hacky. Going off of the code you provided:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.initialize(desired_vector, [q[0],q[1]]).gates_to_uncompute().draw()&#xA;qc.decompose().decompose().decompose().decompose().draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first line will provide gates that uncompute intialize. However it will only show up as Multiplex gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second line is what decomposes the Multiplex gates into familiar gates. You need one decompose() call for each Multiplex gate. In this scenario, you will see 4 Multiplex gates, so you need 4 decompose() calls.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: &lt;code&gt;initialize&lt;/code&gt; assumes the state is currently in the ground state. Because of this, the new circuit that is made will include a &lt;code&gt;reset&lt;/code&gt; on each qubit at the beginning of the circuit.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-10T19:04:06.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6726" PostTypeId="1" AcceptedAnswerId="6727" CreationDate="2019-07-10T19:05:47.563" Score="2" ViewCount="33" Body="&lt;p&gt;I saw on the site Brilliant.org a question witch is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Let's say I'm given a quantum wire, I measure it and find it charged &quot;on&quot;. If I come back some time later, what state should I measure?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the answer was: Charged &quot;on&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And they explain: &quot;If a quantum wire is measured to be &quot;charged&quot;, then for any following measurements of the same isolated quantum wire, we would expect to measure the same charge and observe the same state.&quot;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;My question is: doesn't the system evolves between the measurement at t=0 and t&gt;0, then the system would return in a combination states, so we don't expect the same state?? &#xA;(we can do the same experiment with a qubit)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8009" LastActivityDate="2019-07-10T19:49:59.057" Title="Measuring a quantum wire at t &gt; 0" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6727" PostTypeId="2" ParentId="6726" CreationDate="2019-07-10T19:49:59.057" Score="4" Body="&lt;p&gt;I think this question makes two assumptions: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the system does not evolve intentionally (i.e., no gates or measurements are performed on it), and&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;there is no noise that would cause the system to evolve in an unintended way.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Of course, if you change the state of the system by applying some gates, or if the system is noisy, this will not be the case.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-10T19:49:59.057" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6728" PostTypeId="1" CreationDate="2019-07-10T21:16:46.320" Score="2" ViewCount="307" Body="&lt;p&gt;I have a tensor product of a 5 qubit state &lt;span class=&quot;math-container&quot;&gt;$|h\rangle$&lt;/span&gt;. From this I want to calculate the probability of the 2nd qubit being in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Can someone show me how I can do this? I know I can use the Born rule but I am not sure how. For context I am using Python and NumPy.&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="10480" LastEditDate="2021-04-05T17:39:47.580" LastActivityDate="2021-04-05T17:39:47.580" Title="Find probability of a single qubit's measurement results from a 5 qubit state" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;probability&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6729" PostTypeId="1" CreationDate="2019-07-11T03:11:22.173" Score="8" ViewCount="1034" Body="&lt;p&gt;Given two mixed states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, the trace distance between the states is defined by &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^n |\lambda_i|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;'s are eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho - \sigma$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the definition of eigenvalues, but I don't have intuition on what the sum of eigenvalues represent, and why that signifies as a distance metric. What does distance between two states even mean? Where is trace distance used?&lt;/p&gt;&#xA;" OwnerUserId="8014" LastEditorUserId="55" LastEditDate="2020-05-13T23:37:49.490" LastActivityDate="2020-05-13T23:37:49.490" Title="What is intuition for the trace distance between quantum states?" Tags="&lt;quantum-state&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6731" PostTypeId="1" AcceptedAnswerId="6735" CreationDate="2019-07-11T09:28:16.873" Score="1" ViewCount="334" Body="&lt;p&gt;I read the &lt;a href=&quot;https://qiskit.org/documentation/terra/plotting_data_in_qiskit.html#state-plots&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; of qiskit and I can't understand the meaning of the city plot, like this: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/6ZBHa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6ZBHa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we need a 3D plot? Why can't we just use a 2D plot, where &lt;span class=&quot;math-container&quot;&gt;$ | 00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ | 01 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ |10 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ |11 \rangle$&lt;/span&gt; would lie on X-axis, and their amplitudes (or magnitudes) would lie along Y-axis?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does the intersection of  &lt;span class=&quot;math-container&quot;&gt;$ | 00 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ | 11 \rangle$&lt;/span&gt; show on such city plot?&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2019-07-11T14:47:46.943" LastActivityDate="2019-07-11T14:49:19.630" Title="The meaning of the city plot in Qiskit" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6732" PostTypeId="2" ParentId="6729" CreationDate="2019-07-11T09:28:56.500" Score="2" Body="&lt;p&gt;One way to understand the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace distance&lt;/a&gt; is to notice that it equals the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test&quot; rel=&quot;nofollow noreferrer&quot;&gt;(classical) trace distance&lt;/a&gt; (also referred to as &lt;em&gt;Kolmogorov distance&lt;/em&gt;, see &lt;a href=&quot;https://stats.stackexchange.com/q/411/82418&quot;&gt;this post&lt;/a&gt; for some information about it) maximised over all possible POVMs on the states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this, start from the following expression for the trace distance:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho,\sigma)\equiv\frac{1}{2}\mathrm{Tr}|\rho-\sigma|=\frac{1}{2}\max_U\mathrm{Tr}[ U(\rho-\sigma)],$$&lt;/span&gt;&#xA;where the maximum is taken over all unitaries &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being &lt;span class=&quot;math-container&quot;&gt;$\rho-\sigma$&lt;/span&gt; Hermitian, the maximum is achieved choosing the unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=\sum_{k:\lambda_k\ge0}\mathbb P(\lambda_k)-\sum_{k:\lambda_k&amp;lt;0}\mathbb P(\lambda_k)&#xA;=2\sum_{k:\lambda_k\ge0}\mathbb P(\lambda_k)-I,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathbb P(\lambda_k)\equiv|\lambda_k\rangle\!\langle\lambda_k|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho-\sigma$&lt;/span&gt;, and we exploited the fact that the eigenstates of an Hermitian operator form an orthonormal basis for the space. Defining the positive operator &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P\equiv \sum_{k:\lambda_k\ge0}\mathbb P(\lambda_k),$$&lt;/span&gt;&#xA;we thus see that &lt;span class=&quot;math-container&quot;&gt;$D(\rho,\sigma)=\mathrm{Tr}[P(\rho-\sigma)]$&lt;/span&gt; (and one can also show that such &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the positive operator that maximises this quantity while satisfying &lt;span class=&quot;math-container&quot;&gt;$P&amp;lt;I$&lt;/span&gt;), that is, the trace distance equals the sum of the positive eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho-\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This expression is nice because, being &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; a positive operator, it can be interpreted as a &lt;em&gt;measurement&lt;/em&gt;. It encodes one possible answer to some &lt;em&gt;question&lt;/em&gt; that can be asked to the states (read, an element of a POVM), and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(P\rho)$&lt;/span&gt; is the probability of getting this answer if the state is &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;We, therefore, conclude that &lt;span class=&quot;math-container&quot;&gt;$D(\rho,\sigma)$&lt;/span&gt; is the maximum difference between the probabilities of getting a given answer when asking a given question to both states. In other words, this tells us how &lt;em&gt;distinguishable&lt;/em&gt; the states are: it's the answer to the question &lt;em&gt;among all possible measurements that can be performed on the states, what is the one such that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; give maximally different answers?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Maximisation over Hermitians&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To see how the maximisation over Hermitian/positive operators is performed, consider an arbitrary Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;. Then, &lt;span class=&quot;math-container&quot;&gt;$Q=\sum_k q_k\mathbb P(q_k)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$q_k\in\mathbb R$&lt;/span&gt;, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}[Q(\rho-\sigma)]=\sum_{j,k} \lambda_j q_k |\langle \lambda_j|q_k\rangle|^2.$$&lt;/span&gt;&#xA;For a fixed set of eigenvalues &lt;span class=&quot;math-container&quot;&gt;$q_k$&lt;/span&gt;, it's clear that choosing &lt;span class=&quot;math-container&quot;&gt;$|q_k\rangle=|\lambda_k\rangle$&lt;/span&gt; gives the maximum value of the trace: &lt;span class=&quot;math-container&quot;&gt;$\sum_j \lambda_j q_j\equiv\langle \boldsymbol\lambda,\boldsymbol q\rangle$&lt;/span&gt;.&#xA;Without putting further restrictions on the Hermitian &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, we can get arbitrarily large values of this quantity. One way to work around this is to restrict to the Hermitians &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\|Q\|_2^2\equiv\operatorname{Tr}(Q^2)\le\|\rho-\sigma\|_2^2$&lt;/span&gt;. We can then get a maximum write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\max_{\text{Hermitians } Q:\|Q\|_2\le\|\rho-\sigma\|_2}\operatorname{Tr}[Q(\rho-\sigma)]=\sum_k\lambda_k^2=\|\rho-\sigma\|_2^2.$$&lt;/span&gt;&#xA;This way of restricting &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, however, does not give us an expression similar to the original trace distance. A better way is therefore here to simply impose &lt;span class=&quot;math-container&quot;&gt;$-1\le Q\le1$&lt;/span&gt;, that is, to impose the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; to satisfy  &lt;span class=&quot;math-container&quot;&gt;$-1\le q_k\le1$&lt;/span&gt;.&#xA;With this restriction, &lt;span class=&quot;math-container&quot;&gt;$\sum_k\lambda_k q_k$&lt;/span&gt; is maximised with the choice &lt;span class=&quot;math-container&quot;&gt;$q_k=\operatorname{sign}(\lambda_k)\equiv\lambda_k/|\lambda_k|$&lt;/span&gt;, and we conclude that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\max_{-1\le Q\le1}\operatorname{Tr}[Q(\rho-\sigma)]=\sum_k|\lambda_k|=2D(\rho,\sigma).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is telling us that the optimal measurement to distinguish the two states is one that collapses the states in the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$\rho-\sigma$&lt;/span&gt;, and assigns value &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; to the outcomes corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lambda_k&amp;gt;0$&lt;/span&gt; and value &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; to the outcomes corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lambda_k&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Maximisation over positive operators&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;If we instead impose the restriction &lt;span class=&quot;math-container&quot;&gt;$0\le Q\le 1$&lt;/span&gt;, the expression &lt;span class=&quot;math-container&quot;&gt;$\sum_k\lambda_k q_k$&lt;/span&gt; is maximised by the choice &lt;span class=&quot;math-container&quot;&gt;$q_k=(\lambda_k+|\lambda_k|)/2$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$q_k=\lambda_k$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\lambda_k\ge0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$q_k=0$&lt;/span&gt; otherwise).&#xA;This gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\max_{0\le Q\le1}\operatorname{Tr}[Q(\rho-\sigma)]=\sum_{k: \lambda_k\ge0}\lambda_k=\frac{1}{2}\sum_k|\lambda_k|=D(\rho,\sigma).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-07-11T17:00:12.347" LastActivityDate="2019-07-11T17:00:12.347" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6733" PostTypeId="1" AcceptedAnswerId="6815" CreationDate="2019-07-11T12:29:41.913" Score="6" ViewCount="3445" Body="&lt;p&gt;I am learning qiskit software and this term keeps popping up and I am unable to get a grasp on the technical definition given by wikipedia. For example, the functions state fidelity and process fidelity.&lt;/p&gt;&#xA;" OwnerUserId="7943" LastEditorUserId="55" LastEditDate="2019-07-11T13:03:20.307" LastActivityDate="2020-02-16T11:49:14.427" Title="What does fidelity mean?" Tags="&lt;qiskit&gt;&lt;fidelity&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6735" PostTypeId="2" ParentId="6731" CreationDate="2019-07-11T14:49:19.630" Score="4" Body="&lt;p&gt;A density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; on two qubits has 16 complex amplitudes (although not all are free variables due to constraints from normalization and Hermeticity), so the City plot is showing those amplitudes as well. The &lt;span class=&quot;math-container&quot;&gt;$|00\rangle\langle 11|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle\langle 00|$&lt;/span&gt; amplitudes shown are not going to directly impact your measurement if you were to measure in the Z basis, but would come into effect due to basis transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a simple example of these off diagonal elements, Think about a single qubit density matrix representing a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = |+\rangle\langle +| = \frac{1}{2}(|0\rangle + |1\rangle )(\langle 0| + \langle 1|) = \frac{1}{2}(|0\rangle\langle 0| + |1\rangle\langle 0| + |0\rangle\langle 1| + |1\rangle\langle 1|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When measured in the Z basis this state gives a 50% chance of 0 and a 50% chance of 1, which is identical to the mixed state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho ' = \frac{1}{2}(|0\rangle\langle 0| + |1\rangle\langle 1|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However in the X basis our &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state will always give an eigenvalue of 1, while the mixed state will give other results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, these off diagonal elements are important when checking the purity of a quantum state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho^2 = \rho$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this equation is satisfied then your state is pure, which is only possible due to the off diagonal elements in the density matrix.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2019-07-11T14:49:19.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6736" PostTypeId="2" ParentId="6729" CreationDate="2019-07-11T15:10:21.907" Score="7" Body="&lt;p&gt;&lt;strong&gt;Short answer.&lt;/strong&gt; The trace distance between two states more or less determines how distinguishable they are by any operational means. A trace distance of 0 means that they are indistinguishable (because they're equal); a trace distance of 2 indicates that they can be perfectly distinguished in principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long answer.&lt;/strong&gt; We will show how, from the objective of distinguishing states, we single out the trace distance as a quantity of interest.&lt;span class=&quot;math-container&quot;&gt;$\def\Tr{\mathrm{Tr}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that you have a (possibly mixed) quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. You know that it was prepared in one of two different ways: one of which yields the state &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;, and one of which yields the state &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;. So, you either have &lt;span class=&quot;math-container&quot;&gt;$\rho = \rho_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho = \rho_2$&lt;/span&gt;. You'd like to determine which is the case (and you don't mind destroying &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to do it). What can you do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anything you do will amount to performing some transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, and then performing some measurement. In fact, if you only care about guessing between two outcomes (and you don't mind the fact that you might accidentally guess the wrong outcome), you can reduce your distinguishing procedure to a standard basis measurement, if you use a sophisticated enough unitary. We can suppose that we guess &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; for the outcome &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; for the outcome &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. We can then ask what the probability of success is for the best possible procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we don't care about the exact circuit to perform this procedure, and only what the probability of success is, we can think of the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as just part of a sophisticated measurement procedure, and consider the two-valued projective measurement &lt;span class=&quot;math-container&quot;&gt;$\{ \Pi_1, \Pi_2 \}$&lt;/span&gt; given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \Pi_1&#xA;=&#xA;U \,\lvert 1 \rangle \! \langle 1 \rvert_a \,U^\dagger&#xA;=&#xA;\tfrac{1}{2}U \bigl(\mathbf 1 - Z_a\bigr) U^\dagger,&#xA;\qquad&#xA;\Pi_2&#xA;=&#xA;U\, \lvert 0 \rangle \! \langle 0 \rvert_a \,U^\dagger&#xA;=&#xA;\tfrac{1}{2}U \bigl(\mathbf 1 + Z_a\bigr) U^\dagger,&#xA;$$&lt;/span&gt;&#xA;and describe the distinguishing procedure as a &lt;span class=&quot;math-container&quot;&gt;$\{ \Pi_1, \Pi_2 \}$&lt;/span&gt; measurement.&#xA;Supposing that you were given &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; uniformly at random, what you want to maximise is then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;P&#xA;&amp;amp;=&#xA;\mathrm{Pr}\bigl[\rho_1\bigr]\,\mathrm{Pr}\bigl[\text{guess 1} \big| \rho_1 \bigr]&#xA;+&#xA;\mathrm{Pr}\bigl[\rho_2\bigr]\,\mathrm{Pr}\bigl[\text{guess 2} \big| \rho_2 \bigr] &#xA;\\[1ex]&amp;amp;=&#xA;\tfrac{1}{2}\Tr\bigl( \rho_1 \Pi_1 \bigr) + \tfrac{1}{2}\Tr\bigl( \rho_2 \Pi_2 \bigr)&#xA;\\[1ex]&amp;amp;=&#xA;\tfrac{1}{2}\Tr\bigl( \rho_1 \bigl[\tfrac{1}{2}U \bigl(\mathbf 1 - Z_a\bigr) U^\dagger\bigr]\bigr) + \tfrac{1}{2}\Tr\bigl( \rho_2 \bigl[\tfrac{1}{2}U \bigl(\mathbf 1 + Z_a\bigr) U^\dagger\bigr] \bigr)&#xA;\\[1ex]&amp;amp;=&#xA;\tfrac{1}{4}\Bigl[\Tr\bigl( \rho_1 \bigr) - \Tr\bigl( \rho_1 \bigl[U Z_a U^\dagger\bigr]\bigr) + \Tr\bigl( \rho_2 \bigr) + \Tr\bigl( \rho_2 \bigl[U  Z_a U^\dagger\bigr]\bigr)\Bigr].&#xA;\end{aligned}$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$E_U = U Z_a U^\dagger$&lt;/span&gt;: then using the fact that &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; are both density operators, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;P&#xA;&amp;amp;=&#xA;\tfrac{1}{4}\Bigl[2 - \Tr\bigl( \rho_1 E_U \bigr) + \Tr\bigl( \rho_2 E_U \bigr)\Bigr]&#xA;\\[1ex]&amp;amp;=&#xA;\tfrac{1}{2} + \tfrac{1}{4} \Tr\bigl( \bigl[\rho_2 - \rho_1\bigr] E_U \bigr).&#xA;\end{aligned}$$&lt;/span&gt;&#xA;We can think of &lt;span class=&quot;math-container&quot;&gt;$E_U$&lt;/span&gt; as an abstract observable which we measure on either &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;: it has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; because it is related to &lt;span class=&quot;math-container&quot;&gt;$Z_a$&lt;/span&gt; by a unitary transformation, and we associate the outcome &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; with a guess of &quot;1&quot; and the outcome &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; with a guess of &quot;2&quot;. Subject to this restriction, we want to consider the observable &lt;span class=&quot;math-container&quot;&gt;$E_U$&lt;/span&gt; which maximises the value of &lt;span class=&quot;math-container&quot;&gt;$\Tr( [\rho_2 - \rho_1] E_U )$&lt;/span&gt;; and by convexity, without loss of generality we can consider all operators &lt;span class=&quot;math-container&quot;&gt;$E_U$&lt;/span&gt; which have eigenvalues bounded within &lt;span class=&quot;math-container&quot;&gt;$[-1,+1]$&lt;/span&gt; and not just precisely &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;. However, this essentially characterises the trace norm, as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \max_{\lVert E \rVert \leqslant 1} \Tr\bigl( \bigl[\rho_2 - \rho_1\bigr] E \bigr) = \lVert  \rho_2 - \rho_1 \rVert_1 $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lVert M \rVert_1$&lt;/span&gt; is the trace norm (see e.g.&amp;nbsp;&lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/TQI/&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Theory of Quantum Information&lt;/em&gt;&lt;/a&gt;, Eqn.&amp;nbsp;(1.173)). You can grasp this on an intuitive level as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The maximisation problem on the left-hand side is essentially evaluating a large number of inner products of the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$[\rho_2 - \rho_1]$&lt;/span&gt; with the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In fact, if we consider the trace in the eigenbasis &lt;span class=&quot;math-container&quot;&gt;$|\eta_1\rangle,&#xA;   |\eta_2\rangle, \ldots$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;, we're just considering a sum of inner&#xA;products &lt;span class=&quot;math-container&quot;&gt;$\pm \langle \eta_k | (\rho_2 - \rho_1) | \eta_k \rangle$&lt;/span&gt;,&#xA;with a sign determined by the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\eta_k\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The operator &lt;span class=&quot;math-container&quot;&gt;$(\rho_2 - \rho_1)$&lt;/span&gt; has both positive and negative eigenvalues (assuming that it isn't the zero operator). The way in which we can attempt to maximise the value of the sum above is to choose &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; so that the positive eigenstates &lt;span class=&quot;math-container&quot;&gt;$|\eta_k\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; are also positive eigenstates of &lt;span class=&quot;math-container&quot;&gt;$(rho_2 - \rho_1)$&lt;/span&gt;, and the negative eigenstates of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; to the negative eigenstates of &lt;span class=&quot;math-container&quot;&gt;$(\rho_2 - \rho_1)$&lt;/span&gt;. The effect of this is that &lt;span class=&quot;math-container&quot;&gt;$(\rho_2 - \rho_1) E = \lvert \rho_2 - \rho_1 \rvert$&lt;/span&gt;, where the latter operator is what we get from exchanging the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$(\rho_2 - \rho_1)$&lt;/span&gt; with their absolute values.&lt;/li&gt;&#xA;&lt;li&gt;The trace of &lt;span class=&quot;math-container&quot;&gt;$\lvert \rho_2 - \rho_1 \rvert$&lt;/span&gt; then gives us the trace norm, &lt;span class=&quot;math-container&quot;&gt;$\lVert \rho_2 - \rho_1 \rVert_1$&lt;/span&gt;, as you describe it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;P&#xA;&amp;amp;=&#xA;\tfrac{1}{2} + \tfrac{1}{4} \lVert \rho_2 - \rho_1 \rVert_1,&#xA;\end{aligned}$$&lt;/span&gt;&#xA;so that the trace norm characterises how distinguishable &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; is from &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; by any operational procedure.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-07-11T17:14:15.280" LastActivityDate="2019-07-11T17:14:15.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6737" PostTypeId="2" ParentId="6722" CreationDate="2019-07-11T16:10:24.600" Score="1" Body="&lt;p&gt;First you will need a &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q experience&lt;/a&gt; account if you do not have one. Using the token listed under your profile you will import the IBMQ package, save your account, and execute the program on an available backend.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.save_account('MY_TOKEN', 'URL')&#xA;IBMQ.load_accounts(hub=None) #Run everytime to load your account info saved locally&#xA;IBMQ.backends() #Prints available backends&#xA;# Or select from least busy backend&#xA;from qiskit.providers.ibmq import least_busy&#xA;large_enough_devices = IBMQ.backends(filters=lambda x: x.configuration().n_qubits &amp;lt; 10 and&#xA;                                                   not x.configuration().simulator)&#xA;backend = least_busy(large_enough_devices)&#xA;print(&quot;The best backend is &quot; + backend.name())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now execute&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.monitor import job_monitor&#xA;shots = 1024        &#xA;max_credits = 3   &#xA;job_exp = execute(qc, backend=backend, shots=shots, max_credits=max_credits)&#xA;job_monitor(job_exp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(Where qc is a parameter accepting the quantum circuit to be executed)&#xA;Be sure to check the &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/basics/1_getting_started_with_qiskit.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit tutorials&lt;/a&gt; for and IBM Q experience to learn more. These backend servers are pretty much always available and you can check the status of them on the IBM Q experience with your account.&lt;/p&gt;&#xA;" OwnerUserId="7806" LastEditorUserId="7806" LastEditDate="2019-07-11T17:15:51.047" LastActivityDate="2019-07-11T17:15:51.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6738" PostTypeId="1" CreationDate="2019-07-11T16:26:38.350" Score="2" ViewCount="1015" Body="&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;qr   = QuantumRegister(3)&#xA;cr   = ClassicalRegister(3)&#xA;circ = QuantumCircuit(qr,cr)&#xA;&#xA;circ.h(qr[0])&#xA;circ.h(qr[1])&#xA;circ.h(qr[2])&#xA;&#xA;circ.measure(qr,cr)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;now &lt;strong&gt;cr[0]&lt;/strong&gt; maybe &lt;strong&gt;0&lt;/strong&gt; or &lt;strong&gt;1&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know or copy its value to another normal variable to use it in my calculation, something like &#xA;&lt;code&gt;if(cr[0]==0) cr_val=0 else cr_val=1&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8018" OwnerDisplayName="remon78eg" LastEditorUserId="162" LastEditDate="2019-07-11T17:42:01.023" LastActivityDate="2019-07-14T08:41:45.453" Title="Quantum Computing Qiskit - How to read data from classical registers" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6739" PostTypeId="1" AcceptedAnswerId="6741" CreationDate="2019-07-11T18:39:11.567" Score="4" ViewCount="26" Body="&lt;p&gt;What is the purpose of these quantum gates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They're appended to the circuit after the value has been computed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Axwmj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Axwmj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8019" LastActivityDate="2019-07-11T19:50:25.357" Title="What is the purpose of the last bits in the 2-qubit-operation Toffoli implementation?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6741" PostTypeId="2" ParentId="6739" CreationDate="2019-07-11T19:50:25.357" Score="4" Body="&lt;pre&gt;&lt;code&gt;In[13]:= H = 1/Sqrt[2]*{{1, 1}, {1, -1}};&#xA;T = {{1, 0}, {0, Exp[I*Pi/4]}};&#xA;CNOT = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}};&#xA;KroneckerProduct[IdentityMatrix[2], T].CNOT.&#xA;    KroneckerProduct[T,ConjugateTranspose[T]].CNOT // MatrixForm&#xA;&#xA;&#xA;{&quot;1&quot;, &quot;0&quot;, &quot;0&quot;, &quot;0&quot;},&#xA;{&quot;0&quot;, &quot;1&quot;, &quot;0&quot;, &quot;0&quot;},&#xA;{&quot;0&quot;, &quot;0&quot;, &quot;1&quot;, &quot;0&quot;},&#xA;{&quot;0&quot;, &quot;0&quot;, &quot;0&quot;, &quot;I&quot;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that red boxed region just serves to act as multiplication by &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; when the first two qubits are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what remains must be acting by &lt;span class=&quot;math-container&quot;&gt;$-i X$&lt;/span&gt; on the third qubit when both the first two are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact so it is, by assuming the first two qubits are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and computing the resulting &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; operator on the third qubit. That is the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; for the summand &lt;span class=&quot;math-container&quot;&gt;$P_1 \otimes P_1 \otimes U$&lt;/span&gt; when writing the full operator as &lt;span class=&quot;math-container&quot;&gt;$P_0 \otimes P_0 \otimes U_{00} + P_0 \otimes P_1 \otimes U_{01} \cdots$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plug into Mathematica again:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;H.PauliMatrix[1].ConjugateTranspose[T].&#xA;PauliMatrix[1].T.PauliMatrix[1].&#xA;ConjugateTranspose[T].PauliMatrix[1].T.H // MatrixForm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And it checks out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you didn't have the boxed part it would be &lt;span class=&quot;math-container&quot;&gt;$-iX$&lt;/span&gt; controlled on the first two, instead of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; controlled on the first two.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-07-11T19:50:25.357" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6742" PostTypeId="1" CreationDate="2019-07-11T22:53:39.620" Score="3" ViewCount="52" Body="&lt;p&gt;Calling cirq.Simulator().run(..) on your circuit to get an idea of how  it'd behave if you were to run on Google's (apparently) forthcoming real hardware is fine and dandy.  Is there a way to estimate how long it would take?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies if this is not a suitable question for QC.SE or I've missed something obvious!&lt;/p&gt;&#xA;" OwnerUserId="8004" LastActivityDate="2019-07-11T22:53:39.620" Title="Estimate run time of Cirq circuit on forthcoming Google quantum computer" Tags="&lt;cirq&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6743" PostTypeId="2" ParentId="6628" CreationDate="2019-07-12T05:45:27.070" Score="2" Body="&lt;p&gt;The angle of each rotation &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; obeys &lt;span class=&quot;math-container&quot;&gt;$0\leq \theta \leq \frac{\pi}{2}$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$0\leq \frac{\theta}{2} \leq \frac{\pi}{4}$&lt;/span&gt;. The Grover Iterations as we know, rotates our initial state vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;=cos(\theta/2) |\alpha\big&amp;gt; + sin(\theta/2)|\beta\big&amp;gt;$&lt;/span&gt;  by the angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; a few times, such that eventually &lt;span class=&quot;math-container&quot;&gt;$|\psi \big&amp;gt;$&lt;/span&gt; will be rotated to within an angle &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}\leq \frac{\pi}{4}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|\beta\big&amp;gt;$&lt;/span&gt; which is our desired state.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By using the Quantum Counting Algorithm to get an estimate of &lt;span class=&quot;math-container&quot;&gt;$\theta\approx\theta+\Delta\theta$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;$\approx M$&lt;/span&gt; which is the number of solutions, we introduced the error of &lt;span class=&quot;math-container&quot;&gt;$\Delta (\theta/2)$&lt;/span&gt; to our initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi \big&amp;gt;$&lt;/span&gt;. Since we know &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}\leq \frac{\pi}{4}$&lt;/span&gt;, the maximum error tied to our initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;$&lt;/span&gt; will be given as:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Maximum Initial Error} = \frac{\pi}{4} \times \frac{|\Delta(\theta/2)|}{\theta/2} = \frac{\pi}{4} \frac{|\Delta(\theta)|}{\theta}$$&lt;/span&gt;    &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Grover Iterations will then rotate &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;$&lt;/span&gt; close to &lt;span class=&quot;math-container&quot;&gt;$|\beta\big&amp;gt;$&lt;/span&gt;, with the maximum angular separation being &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; no matter what is the initial angle of &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta+\Delta\theta}{2}$&lt;/span&gt;. So the total angular deviation (accounting for the offset of &lt;span class=&quot;math-container&quot;&gt;$\Delta(\theta/2)$&lt;/span&gt; in the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;$&lt;/span&gt;) from &lt;span class=&quot;math-container&quot;&gt;$|\beta\big&amp;gt;$&lt;/span&gt; in this case is:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Total Angular Deviation} =\frac{\pi}{4}+\text{Maximum Initial Error}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is why we'll get &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}\big(1+\frac{|\Delta\theta|}{\theta}\big)$&lt;/span&gt; as compared to just &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt;. Please do input additional comments if any.       &lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="5253" LastEditDate="2019-07-12T05:53:22.787" LastActivityDate="2019-07-12T05:53:22.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6744" PostTypeId="2" ParentId="6728" CreationDate="2019-07-12T05:46:40.130" Score="2" Body="&lt;p&gt;So probability of the second qubit being in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is the probability of the 5 qubit system being in a state that has &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as the second qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So among all the 32 states, find the ones that have &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in the second qubit, which will be half of them, for example &lt;span class=&quot;math-container&quot;&gt;$|01100\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11111\rangle$&lt;/span&gt;.  Add up the corresponding probabilities, which is the absolute square of the amplitudes presented to you in vector form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example for a 3 qubit state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{matrix}&#xA;000 \\ 001 \\ 010 \\ 011 \\100  \\ 101 \\ 110  \\ 111 \\&#xA;\end{matrix}&#xA;\begin{bmatrix}&#xA;0   \\0.577 \\ 0 \\  0.577\\   0\\   0\\   0\\   0.577\\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above case, the probability that the second qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is probability that it will be in &lt;span class=&quot;math-container&quot;&gt;$|010\rangle, |011\rangle, |110\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;, which is &lt;span class=&quot;math-container&quot;&gt;$|0.577|^2 + |0.577|^2$&lt;/span&gt; which is 0.666.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-07-12T05:46:40.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6745" PostTypeId="2" ParentId="6738" CreationDate="2019-07-12T14:05:09.820" Score="0" Body="&lt;p&gt;if you want to excute the whole quantum algorithm again and again bases on the previous result then use while loop.&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="4206" LastEditDate="2019-07-12T20:37:08.867" LastActivityDate="2019-07-12T20:37:08.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6746" PostTypeId="2" ParentId="6733" CreationDate="2019-07-12T14:15:28.937" Score="5" Body="&lt;p&gt;Simply it is the distance (similarity measure) between two quantum states, for example the fidelity between &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is less than the fidelity between &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\big(|0\rangle + |1\rangle\big)$&lt;/span&gt;. or you can say it is the cosine of the smallest angle between two states, also called the cosine similarity&lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2019-07-12T14:15:28.937" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6747" PostTypeId="1" AcceptedAnswerId="6753" CreationDate="2019-07-12T14:56:54.693" Score="1" ViewCount="122" Body="&lt;p&gt;Strolling around I came across Craig Gidney's Blog and his awesome tool &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;. I proceeded to read &lt;a href=&quot;https://algassert.com/post/1703&quot; rel=&quot;nofollow noreferrer&quot;&gt;this interesting post of his&lt;/a&gt; where he alludes to the difference between actually measuring qubits in circuits and simply conditioning some part of the circuit to state of qubits. Long story short, he provides &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22inc9%22%5D%2C%5B%22%7Es0ae%22%5D%2C%5B1%2C%22Chance9%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22%7Em9ah%22%2C%22name%22%3A%22x2%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22inc9%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22inc9%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22%7E34ha%22%2C%22name%22%3A%22x8%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%7Em9ah%22%5D%2C%5B%22%7Em9ah%22%5D%2C%5B%22%7Em9ah%22%5D%2C%5B%22%7Em9ah%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22%7Egii%22%2C%22name%22%3A%22x32%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%7E34ha%22%5D%2C%5B%22%7E34ha%22%5D%2C%5B%22%7E34ha%22%5D%2C%5B%22%7E34ha%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22%7Ep9lg%22%2C%22name%22%3A%22x128%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%7Egii%22%5D%2C%5B%22%7Egii%22%5D%2C%5B%22%7Egii%22%5D%2C%5B%22%7Egii%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22%7Ehblb%22%2C%22name%22%3A%22x256%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%7Ep9lg%22%5D%2C%5B%22%7Ep9lg%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22%7E7m3k%22%2C%22name%22%3A%22x64%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%7Egii%22%5D%2C%5B%22%7Egii%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22%7Es0ae%22%2C%22name%22%3A%22x499%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22inc9%22%5D%2C%5B%22%7Em9ah%22%5D%2C%5B%22%7E34ha%22%5D%2C%5B%22%7E34ha%22%5D%2C%5B%22%7Egii%22%5D%2C%5B%22%7E7m3k%22%5D%2C%5B%22%7Ep9lg%22%5D%2C%5B%22%7Ehblb%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Quirk circuit&lt;/a&gt; to experiment with. There he has a gate that is called &quot;x499&quot; and my question is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I make this gate or any other of the input gates? (Those that feature an &quot;A&quot; or &quot;B&quot;) I have spent a good amount of time dragging and dropping and clicking around but I seem unable to figure this functionality out. (* ashamed *) If I drag it into my circuit, it will turn yellow and show something like &quot;input A needed&quot;.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2019-07-12T19:09:42.073" Title="How to use the input gates in Quirk" Tags="&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6748" PostTypeId="2" ParentId="6738" CreationDate="2019-07-12T15:04:26.923" Score="2" Body="&lt;p&gt;Answering based off of the extra clarity from your comments:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Wanting to calculate the decimal value of all &lt;code&gt;cr&lt;/code&gt; as opposed to the binary&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This can be done by using the Python built in function &lt;code&gt;int()&lt;/code&gt;. This function will return the integer value of the input in base 10 (decimal). So you can retrieve the &lt;code&gt;counts&lt;/code&gt; from the job by calling &lt;code&gt;job.result().get_counts(&amp;lt;circuit_name&amp;gt;)&lt;/code&gt;. This will return a dictionary with the keys being the output from the &lt;code&gt;ClassicalRegister&lt;/code&gt;s and the values being the number of times that output was measured. If you take the keys from &lt;code&gt;counts&lt;/code&gt; and input them into &lt;code&gt;int()&lt;/code&gt; then it will return each output as a decimal value.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Wanting to store values from &lt;code&gt;cr&lt;/code&gt; before the execute command&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;To my knowledge, there is no way to read the values from &lt;code&gt;cr&lt;/code&gt; before executing the circuit. The values are only populated into the ClassicalRegisters after measuring the circuit, which can only be done during the execution of the circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You say you want to store the values from &lt;code&gt;cr&lt;/code&gt; and reset the circuit and calculate again. This is possible, as you can just read the outputs you get from &lt;code&gt;counts&lt;/code&gt;, then do something to the circuit based on those results, and then run the circuit again. &lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-12T15:04:26.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6751" PostTypeId="1" CreationDate="2019-07-12T18:12:29.203" Score="1" ViewCount="182" Body="&lt;p&gt;given A and B share EPR pairs &lt;span class=&quot;math-container&quot;&gt;$ (|00⟩+|11⟩)/√2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;both are free to measure their own qubit with the following measurement settings&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A measures with &lt;span class=&quot;math-container&quot;&gt;$[ |0⟩, |1⟩ ]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;B measures with &lt;span class=&quot;math-container&quot;&gt;$[ sin(3π/8)|0⟩ + cos(3π/8)|1⟩, -sin(π/8)|0⟩ + cos(π/8)|1⟩]$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8028" LastEditorUserId="8028" LastEditDate="2019-07-15T11:45:53.330" LastActivityDate="2019-07-15T11:45:53.330" Title="given an EPR pair, how do I calculate expectation value?" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;experiment&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6752" PostTypeId="1" CreationDate="2019-07-12T18:55:33.530" Score="2" ViewCount="224" Body="&lt;p&gt;I am not sure how to find the following matrix (the inverse of Quantum Fourier Transform) in terms of elementary quantum gates? I am using Qiskit to implement it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dGEOw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dGEOw.png&quot; alt=&quot;Matrix for IQFT&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7856" LastActivityDate="2019-07-12T21:11:01.823" Title="How to decompose the Quantum Fourier Inverse matrix into elementary quantum gates?" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6753" PostTypeId="2" ParentId="6747" CreationDate="2019-07-12T19:09:42.073" Score="2" Body="&lt;p&gt;The input gates are in the bottom toolbox, near the center:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JnuPq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JnuPq.png&quot; alt=&quot;input gates&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you place an input gate in the same column as an arithmetic gate requiring that input, they will link together into a combined operation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PWHQz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PWHQz.png&quot; alt=&quot;arithmetic combo&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also precede the input-requiring gate with a classical setting of the value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2KPZU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2KPZU.png&quot; alt=&quot;classical arithmetic&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Separating the input and the target into separate boxes makes using arithmetic much more flexible than it otherwise would be. In an older version they were combined into a single gate, and it was just generally a giant hassle to get anything lined up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;x499&quot; gate in the circuit you linked is a custom gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0XT1L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0XT1L.png&quot; alt=&quot;image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, it is a &quot;Circuit Gate&quot; which was made by clicking the &quot;Make Gate&quot; button and then entering a range of the (at creation time of the gate) current circuit to include in the gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/giskr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/giskr.png&quot; alt=&quot;custom gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that there is in fact a series of custom gates in the before-last screenshot. Each is including a handful of copies of the previous one, in order to build up to many many applications of the &quot;apply Hadamard and controlled increment&quot; operation. This is a workaround for the fact that Quirk has no concept of a loop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be aware that custom gates are by far the weakest part of Quirk's user experience. They're clunky to make, impossible to delete without editing the URL, don't have large enough thumbnails... it's just something that I'd have to put 100 hours into to make it good and I haven't had the motivation.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-07-12T19:09:42.073" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6754" PostTypeId="2" ParentId="6752" CreationDate="2019-07-12T19:52:21.950" Score="2" Body="&lt;p&gt;Read the circuit for the QFT on 2 qubits and reverse and dagger everything&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(1 \otimes H)(Controlled(2,S_1^\dagger))(H \otimes 1)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For how: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4875/implementation-of-inverse-qft/4877#4877&quot;&gt;Implementation of inverse QFT?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This decomposition is &lt;span class=&quot;math-container&quot;&gt;$m=2$&lt;/span&gt; on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&lt;/a&gt; Note that &lt;span class=&quot;math-container&quot;&gt;$R_2 = S$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$1 \otimes H$&lt;/span&gt; to denote Hadamard on the second qubit. &lt;span class=&quot;math-container&quot;&gt;$H \otimes 1$&lt;/span&gt; for Hadamard on the first. &lt;span class=&quot;math-container&quot;&gt;$Controlled(2,S_1^\dagger)$&lt;/span&gt; for use qubit 2 as the control and assuming that apply &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; on the first qubit.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2019-07-12T21:11:01.823" LastActivityDate="2019-07-12T21:11:01.823" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6755" PostTypeId="1" AcceptedAnswerId="6794" CreationDate="2019-07-12T21:52:53.297" Score="2" ViewCount="510" Body="&lt;p&gt;I'm trying to build a new instruction for my circuit. This instruction needs both a controller qubit &lt;code&gt;qctl&lt;/code&gt; and an arbitrary register &lt;code&gt;qreg&lt;/code&gt;. When &lt;code&gt;qctl&lt;/code&gt; is set then the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1413/how-to-create-an-arbitrary-state-in-qiskit-for-a-local-qasm-simulator&quot;&gt;Qiskit's &lt;code&gt;initialize&lt;/code&gt; function&lt;/a&gt; is applied to &lt;code&gt;qreg&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original &lt;code&gt;Initialize&lt;/code&gt; gate (version 10.5) can be found &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/extensions/initializer.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the official documentation&lt;/a&gt; or locally at path: &lt;code&gt;/anaconda3/envs/&amp;lt;environment name&amp;gt;/lib/python3.7/site-packages/qiskit/extensions/initializer.py&lt;/code&gt;. It follows a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176v5&quot; rel=&quot;nofollow noreferrer&quot;&gt;particular procedure&lt;/a&gt; which consists of applying a sequence of RY and RZ gates in order to match the desired state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;copy the &lt;code&gt;Initialize&lt;/code&gt; instruction, naming it &lt;code&gt;ControlledInitialize&lt;/code&gt;;&lt;/li&gt;&#xA;&lt;li&gt;pass an additional single qubit register &lt;code&gt;qctl&lt;/code&gt; to &lt;code&gt;ControlledInitialize&lt;/code&gt;;&lt;/li&gt;&#xA;&lt;li&gt;change all RZ, RY gates with CRZ, CRY gates (the first one is already available, the second one have to be made from scratch).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h1&gt;The problem&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;It seems that I have passed &lt;code&gt;qctl&lt;/code&gt; register in the wrong way, in fact the below minimum example throws the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DAGCircuitError: '(qu)bit qctl[0] not found'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Minimum example&lt;/h3&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit import BasicAer, execute&#xA;&#xA;# copy here CRY and ControlledInitialize implementation&#xA;&#xA;desired_vector = [ 1 / math.sqrt(2), 0, 0, 1 / math.sqrt(2) ]&#xA;qctl = QuantumRegister(1, &quot;qctl&quot;)&#xA;qreg = QuantumRegister(2, &quot;qreg&quot;)&#xA;creg = ClassicalRegister(2, &quot;creg&quot;)&#xA;circuit = QuantumCircuit(qctl, qreg, creg)&#xA;&#xA;circuit.x(qctl)&#xA;circuit.controlled_initialize(qctl, desired_vector, qreg)&#xA;circuit.measure(qreg, creg)&#xA;&#xA;job = execute(circuit, BasicAer.get_backend('qasm_simulator'), shots=10000)&#xA;print('Counts: ', job.result().get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;The implementation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The whole code can be seen &lt;a href=&quot;https://github.com/incud/QuantumSnippets/blob/master/controlled_initialization.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here as .py&lt;/a&gt; and &lt;a href=&quot;https://github.com/incud/QuantumSnippets/blob/master/controlled_initialization.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here as Jupyter notebook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;CRZ, CRY gates&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;CRZ is a standard gate, you can use it with &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.extensions.standard.crz import CrzGate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;CRY is present &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/circuits/gates/controlled_ry_gates.html#cry&quot; rel=&quot;nofollow noreferrer&quot;&gt;in Aqua module as a function&lt;/a&gt; but not as a subclass of Gate class. You can easily derive the gate implementation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import CompositeGate&#xA;from qiskit.circuit import Gate&#xA;from qiskit.circuit import QuantumCircuit&#xA;from qiskit.circuit import QuantumRegister&#xA;from qiskit.circuit.decorators import _op_expand, _to_bits&#xA;from qiskit.extensions.standard.u3 import U3Gate&#xA;from qiskit.extensions.standard.cx import CnotGate&#xA;&#xA;class CryGate(Gate):&#xA;    &quot;&quot;&quot;controlled-rz gate.&quot;&quot;&quot;&#xA;&#xA;    def __init__(self, theta):&#xA;        &quot;&quot;&quot;Create new cry gate.&quot;&quot;&quot;&#xA;        super().__init__(&quot;cry&quot;, 2, [theta]) # 2 = number of qubits&#xA;&#xA;    def _define(self):&#xA;        &quot;&quot;&quot;&#xA;        self.u3(theta / 2, 0, 0, q_target)&#xA;        self.cx(q_control, q_target)&#xA;        self.u3(-theta / 2, 0, 0, q_target)&#xA;        self.cx(q_control, q_target)&#xA;        &quot;&quot;&quot;&#xA;        definition = []&#xA;        q = QuantumRegister(2, &quot;q&quot;)&#xA;        rule = [&#xA;            (U3Gate(self.params[0] / 2, 0, 0), [q[1]], []),&#xA;            (CnotGate(), [q[0], q[1]], []),&#xA;            (U3Gate(-self.params[0] / 2, 0, 0), [q[1]], []),&#xA;            (CnotGate(), [q[0], q[1]], [])&#xA;        ]&#xA;        for inst in rule:&#xA;            definition.append(inst)&#xA;        self.definition = definition&#xA;&#xA;    def inverse(self):&#xA;        &quot;&quot;&quot;Invert this gate.&quot;&quot;&quot;&#xA;        return CrzGate(-self.params[0])&#xA;&#xA;&#xA;@_to_bits(2)&#xA;@_op_expand(2)&#xA;def cry(self, theta, ctl, tgt):&#xA;    &quot;&quot;&quot;Apply crz from ctl to tgt with angle theta.&quot;&quot;&quot;&#xA;    return self.append(CryGate(theta), [ctl, tgt], [])&#xA;&#xA;&#xA;QuantumCircuit.cry = cry&#xA;CompositeGate.cry = cry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;ControlledInitialize instruction&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Any modification of original &lt;code&gt;Initialize&lt;/code&gt; instruction is denoted with &lt;code&gt;WATCH ME&lt;/code&gt; comment. Here an overview:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in &lt;code&gt;__init__&lt;/code&gt; I just save the single qubit control register;&lt;/li&gt;&#xA;&lt;li&gt;in &lt;code&gt;_define&lt;/code&gt;, &lt;code&gt;gates_to_uncompute&lt;/code&gt;, &lt;code&gt;multiplexer&lt;/code&gt; the temporary circuit built will have also &lt;code&gt;qctl&lt;/code&gt; register;&lt;/li&gt;&#xA;&lt;li&gt;in &lt;code&gt;_define&lt;/code&gt;, &lt;code&gt;gates_to_uncompute&lt;/code&gt;, &lt;code&gt;multiplexer&lt;/code&gt; any append function call is enriched with &lt;code&gt;qctl&lt;/code&gt; register in the list of qubits taken as second parameter;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;in &lt;code&gt;gates_to_uncompute&lt;/code&gt; just substitute &lt;code&gt;RYGate/RZGate&lt;/code&gt; with &lt;code&gt;CryGate/CrzGate&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class ControlledInitialize(Instruction):&#xA;&#xA;&quot;&quot;&quot;Complex amplitude initialization.&#xA;&#xA;Class that implements the (complex amplitude) initialization of some&#xA;flexible collection of qubit registers (assuming the qubits are in the&#xA;zero state).&#xA;&quot;&quot;&quot;&#xA;&#xA;def __init__(self, controlled_qubit, params):&#xA;    &quot;&quot;&quot;Create new initialize composite.&#xA;&#xA;    params (list): vector of complex amplitudes to initialize to&#xA;    &quot;&quot;&quot;&#xA;&#xA;    # WATCH ME: save controlled qubit register&#xA;    self.controlled_qubit = controlled_qubit&#xA;&#xA;    num_qubits = math.log2(len(params))&#xA;&#xA;    # Check if param is a power of 2&#xA;    if num_qubits == 0 or not num_qubits.is_integer():&#xA;        raise QiskitError(&quot;Desired statevector length not a positive power of 2.&quot;)&#xA;&#xA;    # Check if probabilities (amplitudes squared) sum to 1&#xA;    if not math.isclose(sum(np.absolute(params) ** 2), 1.0,&#xA;                        abs_tol=_EPS):&#xA;        raise QiskitError(&quot;Sum of amplitudes-squared does not equal one.&quot;)&#xA;&#xA;    num_qubits = int(num_qubits)&#xA;&#xA;    super().__init__(&quot;controlledinitialize&quot;, num_qubits, 0, params) # +1 per il controllo&#xA;&#xA;def _define(self):&#xA;    &quot;&quot;&quot;Calculate a subcircuit that implements this initialization&#xA;&#xA;    Implements a recursive initialization algorithm, including optimizations,&#xA;    from &quot;Synthesis of Quantum Logic Circuits&quot; Shende, Bullock, Markov&#xA;    https://arxiv.org/abs/quant-ph/0406176v5&#xA;&#xA;    Additionally implements some extra optimizations: remove zero rotations and&#xA;    double cnots.&#xA;    &quot;&quot;&quot;&#xA;    # call to generate the circuit that takes the desired vector to zero&#xA;    disentangling_circuit = self.gates_to_uncompute()&#xA;&#xA;    # invert the circuit to create the desired vector from zero (assuming&#xA;    # the qubits are in the zero state)&#xA;    initialize_instr = disentangling_circuit.to_instruction().inverse()&#xA;&#xA;    q = QuantumRegister(self.num_qubits, 'q')&#xA;    initialize_circuit = QuantumCircuit(self.controlled_qubit, q, name='init_def')&#xA;    for qubit in q:&#xA;        initialize_circuit.append(Reset(), [qubit])&#xA;&#xA;    # WATCH ME: cambiati registri&#xA;    temp_qubitsreg = [ self.controlled_qubit[0] ] + q[:]&#xA;    # initialize_circuit.append(initialize_instr, q[:])&#xA;    initialize_circuit.append(initialize_instr, temp_qubitsreg)&#xA;&#xA;    self.definition = initialize_circuit.data&#xA;&#xA;def gates_to_uncompute(self):&#xA;    &quot;&quot;&quot;&#xA;    Call to create a circuit with gates that take the&#xA;    desired vector to zero.&#xA;&#xA;    Returns:&#xA;        QuantumCircuit: circuit to take self.params vector to |00..0&amp;gt;&#xA;    &quot;&quot;&quot;&#xA;    q = QuantumRegister(self.num_qubits)&#xA;    # WATCH ME: aggiunto registro controlled_qubit&#xA;    circuit = QuantumCircuit(self.controlled_qubit, q, name='disentangler')&#xA;&#xA;    # kick start the peeling loop, and disentangle one-by-one from LSB to MSB&#xA;    remaining_param = self.params&#xA;&#xA;    for i in range(self.num_qubits):&#xA;        # work out which rotations must be done to disentangle the LSB&#xA;        # qubit (we peel away one qubit at a time)&#xA;        (remaining_param,&#xA;         thetas,&#xA;         phis) = ControlledInitialize._rotations_to_disentangle(remaining_param)&#xA;        # WATCH ME: Initialize._rotations_to_disentangle diventa ControlledInitialize._rotations_to_disentangle&#xA;&#xA;        # perform the required rotations to decouple the LSB qubit (so that&#xA;        # it can be &quot;factored&quot; out, leaving a shorter amplitude vector to peel away)&#xA;&#xA;        # WATCH ME: substitute RZ with CRZ&#xA;        # rz_mult = self._multiplex(RZGate, phis)&#xA;        rz_mult = self._multiplex(CrzGate, phis)&#xA;&#xA;        # WATCH ME: substitute RY with CRY&#xA;        # ry_mult = self._multiplex(RYGate, thetas)&#xA;        ry_mult = self._multiplex(CryGate, thetas)&#xA;&#xA;        # WATCH ME: cambiati registri&#xA;        temp_qubitsreg = [ self.controlled_qubit[0] ] + q[i:self.num_qubits]&#xA;        # circuit.append(rz_mult.to_instruction(), q[i:self.num_qubits])&#xA;        # circuit.append(ry_mult.to_instruction(), q[i:self.num_qubits])&#xA;        circuit.append(rz_mult.to_instruction(), temp_qubitsreg)&#xA;        circuit.append(ry_mult.to_instruction(), temp_qubitsreg)&#xA;&#xA;        print(&quot;Z: &quot;, phis, &quot; | Y: &quot;, thetas)&#xA;&#xA;    return circuit&#xA;&#xA;@staticmethod&#xA;def _rotations_to_disentangle(local_param):&#xA;    &quot;&quot;&quot;&#xA;    Static internal method to work out Ry and Rz rotation angles used&#xA;    to disentangle the LSB qubit.&#xA;    These rotations make up the block diagonal matrix U (i.e. multiplexor)&#xA;    that disentangles the LSB.&#xA;&#xA;    [[Ry(theta_1).Rz(phi_1)  0   .   .   0],&#xA;     [0         Ry(theta_2).Rz(phi_2) .  0],&#xA;                                .&#xA;                                    .&#xA;      0         0           Ry(theta_2^n).Rz(phi_2^n)]]&#xA;    &quot;&quot;&quot;&#xA;    remaining_vector = []&#xA;    thetas = []&#xA;    phis = []&#xA;&#xA;    param_len = len(local_param)&#xA;&#xA;    for i in range(param_len // 2):&#xA;        # Ry and Rz rotations to move bloch vector from 0 to &quot;imaginary&quot;&#xA;        # qubit&#xA;        # (imagine a qubit state signified by the amplitudes at index 2*i&#xA;        # and 2*(i+1), corresponding to the select qubits of the&#xA;        # multiplexor being in state |i&amp;gt;)&#xA;        (remains,&#xA;         add_theta,&#xA;         add_phi) = ControlledInitialize._bloch_angles(local_param[2 * i: 2 * (i + 1)])&#xA;        # WATCH ME: Initialize._bloch_angles diventa ControlledInitialize._bloch_angles&#xA;&#xA;        remaining_vector.append(remains)&#xA;&#xA;        # rotations for all imaginary qubits of the full vector&#xA;        # to move from where it is to zero, hence the negative sign&#xA;        thetas.append(-add_theta)&#xA;        phis.append(-add_phi)&#xA;&#xA;    return remaining_vector, thetas, phis&#xA;&#xA;@staticmethod&#xA;def _bloch_angles(pair_of_complex):&#xA;    &quot;&quot;&quot;&#xA;    Static internal method to work out rotation to create the passed in&#xA;    qubit from the zero vector.&#xA;    &quot;&quot;&quot;&#xA;    [a_complex, b_complex] = pair_of_complex&#xA;    # Force a and b to be complex, as otherwise numpy.angle might fail.&#xA;    a_complex = complex(a_complex)&#xA;    b_complex = complex(b_complex)&#xA;    mag_a = np.absolute(a_complex)&#xA;    final_r = float(np.sqrt(mag_a ** 2 + np.absolute(b_complex) ** 2))&#xA;    if final_r &amp;lt; _EPS:&#xA;        theta = 0&#xA;        phi = 0&#xA;        final_r = 0&#xA;        final_t = 0&#xA;    else:&#xA;        theta = float(2 * np.arccos(mag_a / final_r))&#xA;        a_arg = np.angle(a_complex)&#xA;        b_arg = np.angle(b_complex)&#xA;        final_t = a_arg + b_arg&#xA;        phi = b_arg - a_arg&#xA;&#xA;    return final_r * np.exp(1.J * final_t / 2), theta, phi&#xA;&#xA;def _multiplex(self, target_gate, list_of_angles):&#xA;    &quot;&quot;&quot;&#xA;    Return a recursive implementation of a multiplexor circuit,&#xA;    where each instruction itself has a decomposition based on&#xA;    smaller multiplexors.&#xA;&#xA;    The LSB is the multiplexor &quot;data&quot; and the other bits are multiplexor &quot;select&quot;.&#xA;&#xA;    Args:&#xA;        target_gate (Gate): Ry or Rz gate to apply to target qubit, multiplexed&#xA;            over all other &quot;select&quot; qubits&#xA;        list_of_angles (list[float]): list of rotation angles to apply Ry and Rz&#xA;&#xA;    Returns:&#xA;        DAGCircuit: the circuit implementing the multiplexor's action&#xA;    &quot;&quot;&quot;&#xA;    list_len = len(list_of_angles)&#xA;    local_num_qubits = int(math.log2(list_len)) + 1&#xA;&#xA;    q = QuantumRegister(local_num_qubits)&#xA;    # WATCH ME: aggiunto registro controlled_qubit&#xA;    circuit = QuantumCircuit(self.controlled_qubit, q, name=&quot;multiplex&quot; + local_num_qubits.__str__())&#xA;&#xA;    lsb = q[0]&#xA;    msb = q[local_num_qubits - 1]&#xA;&#xA;    # case of no multiplexing: base case for recursion&#xA;    if local_num_qubits == 1:&#xA;        temp_qubitsreg = [ self.controlled_qubit[0], q[0] ]&#xA;        circuit.append(target_gate(list_of_angles[0]), temp_qubitsreg)&#xA;        return circuit&#xA;&#xA;&#xA;    # calc angle weights, assuming recursion (that is the lower-level&#xA;    # requested angles have been correctly implemented by recursion&#xA;    angle_weight = scipy.kron([[0.5, 0.5], [0.5, -0.5]],&#xA;                              np.identity(2 ** (local_num_qubits - 2)))&#xA;&#xA;    # calc the combo angles&#xA;    list_of_angles = angle_weight.dot(np.array(list_of_angles)).tolist()&#xA;&#xA;    # recursive step on half the angles fulfilling the above assumption&#xA;    multiplex_1 = self._multiplex(target_gate, list_of_angles[0:(list_len // 2)])&#xA;    temp_qubitsreg =  [ self.controlled_qubit[0] ] + q[0:-1]&#xA;    circuit.append(multiplex_1.to_instruction(), temp_qubitsreg)&#xA;&#xA;    # attach CNOT as follows, thereby flipping the LSB qubit&#xA;    circuit.append(CnotGate(), [msb, lsb])&#xA;&#xA;    # implement extra efficiency from the paper of cancelling adjacent&#xA;    # CNOTs (by leaving out last CNOT and reversing (NOT inverting) the&#xA;    # second lower-level multiplex)&#xA;    multiplex_2 = self._multiplex(target_gate, list_of_angles[(list_len // 2):])&#xA;    temp_qubitsreg = [ self.controlled_qubit[0] ] + q[0:-1]&#xA;    if list_len &amp;gt; 1:&#xA;        circuit.append(multiplex_2.to_instruction().mirror(), temp_qubitsreg)&#xA;    else:&#xA;        circuit.append(multiplex_2.to_instruction(), temp_qubitsreg)&#xA;&#xA;    # attach a final CNOT&#xA;    circuit.append(CnotGate(), [msb, lsb])&#xA;&#xA;    return circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Qiskit version&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Latest version is used:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;qiskit.__qiskit_version__&#xA;&#xA;{'qiskit': '0.10.5',&#xA; 'qiskit-terra': '0.8.2',&#xA; 'qiskit-ignis': '0.1.1',&#xA; 'qiskit-aer': '0.2.1',&#xA; 'qiskit-ibmq-provider': '0.2.2',&#xA; 'qiskit-aqua': '0.5.2'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1874" LastActivityDate="2019-07-16T10:05:31.057" Title="Controlled-Initialize instruction" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6756" PostTypeId="1" AcceptedAnswerId="6762" CreationDate="2019-07-13T04:12:54.047" Score="0" ViewCount="49" Body="&lt;p&gt;The Swap test proof on page 8 of &lt;a href=&quot;https://sites.cs.ucsb.edu/~vandam/teaching/S05_CS290/week9.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://sites.cs.ucsb.edu/~vandam/teaching/S05_CS290/week9.pdf&lt;/a&gt; ends with this derivation:&lt;a href=&quot;https://i.stack.imgur.com/6Z0h8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6Z0h8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you add those inner products to get from &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}(2 + \langle \Psi, \varphi|\Psi, \varphi\rangle + \langle\varphi, \Psi|\Psi,\varphi\rangle)$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;to &#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} + \frac{1}{2} (|\Psi|\varphi\rangle|)^2 $&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2019-07-13T17:22:11.353" Title="How is inner product addition performed?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6757" PostTypeId="5" CreationDate="2019-07-13T05:07:08.417" Score="0" Body="&lt;p&gt;Following is taken from &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/oracles?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft oracles&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Often, such operations are defined using a classical function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n \rightarrow\{0,1\}^m$&lt;/span&gt; which takes an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit binary input and produces an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-bit binary output. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;One can also go through this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4625/what-exactly-is-an-oracle?rq=1&quot;&gt;question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="9006" LastEditDate="2020-05-02T21:29:30.763" LastActivityDate="2020-05-02T21:29:30.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6758" PostTypeId="4" CreationDate="2019-07-13T05:07:08.417" Score="0" Body="An oracle is a &quot;black box&quot; operation (function) that is used as an input to an another algorithm (for example Deutch-Jozsa, Grover etc.). A parameter or feature of the Oracle is infered by the algorithm." OwnerUserId="462" LastEditorUserId="9006" LastEditDate="2020-05-02T21:29:30.763" LastActivityDate="2020-05-02T21:29:30.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6759" PostTypeId="1" CreationDate="2019-07-13T05:21:39.063" Score="-1" ViewCount="71" Body="&lt;p&gt;Can I edit a program with python numpy and scipy and of course qiskit in the IBM Q experience, using code? (I am not interested in drugging gates) and I can't find the way to edit my own program &lt;/p&gt;&#xA;" OwnerUserId="8031" LastActivityDate="2019-07-16T09:23:35.880" Title="edit a program on IBM Q experience" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6760" PostTypeId="1" AcceptedAnswerId="6767" CreationDate="2019-07-13T12:03:53.003" Score="2" ViewCount="68" Body="&lt;p&gt;I'm doing the Q# quantum katas and I'm stuck on an oracle in the Deutsch-Josza algorithm katas. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|x\rangle=|x_0x_1\dots x_{n-1}\rangle$&lt;/span&gt; be a qubit array and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; be  bit string of &lt;span class=&quot;math-container&quot;&gt;$k\leq n$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-prefix of a bit string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_k(x)$&lt;/span&gt;, is the string obtained by cutting off everything except the first &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; bits. An oracle for a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is a unitary operator that performs the following transformation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$O_f|x\rangle|y\rangle=|x\rangle|y\oplus f(x)\rangle $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; represents sum modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; in this case is a single qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The task is to write an oracle for the following function&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(x)=\left( \bigoplus_{i=0}^{n-1}x_i \right) \oplus g(x,r)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$$ g(x,r)=\begin{cases}&#xA;1\quad \textrm{ if } P_k(x)=r\\&#xA;0\quad \textrm{ otherwise } &#xA;\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first term is easy to implement: just apply CNOT on &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; with |&lt;span class=&quot;math-container&quot;&gt;$x_k\rangle$&lt;/span&gt; as a control qubit for each &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, this way &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is flipped as many times as there are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s in the string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, which is equivalent to flipping if the sum modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second term is giving me more trouble. I defined the qubit array &lt;span class=&quot;math-container&quot;&gt;$|r\rangle$&lt;/span&gt; that contains the state equal to the bit string &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and another qubit array of the same length, &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; initially set to &lt;span class=&quot;math-container&quot;&gt;$|00\dots 0\rangle$&lt;/span&gt; and I perform the following operation for every &lt;span class=&quot;math-container&quot;&gt;$j=0,\dots k-1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CCNOT}|r_j\rangle|x_j\rangle|z_j\rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X\otimes X |r_j\rangle|x_j\rangle $$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CCNOT}|r_j\rangle|x_j\rangle|z_j\rangle $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X\otimes X |r_j\rangle|x_j\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this way the bit &lt;span class=&quot;math-container&quot;&gt;$|z_j\rangle$&lt;/span&gt; is flipped if and only if the state of &lt;span class=&quot;math-container&quot;&gt;$|r_j\rangle|x_j\rangle $&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|1\rangle$&lt;/span&gt;. After this I apply a multi controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate with control &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; and target &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;, the idea being that if &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; contains only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$P_k(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; are equal. The test fails, and I can't understand why. Could anybody help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        for(k in 0..Length(x)-1) //first term&#xA;        {&#xA;            CNOT(x[k],y);&#xA;        }&#xA;&#xA;        using(register = Qubit[Length(prefix)])&#xA;        {&#xA;            for(k in 0..Length(prefix)-1)           //copy the bit string prefix in a qubit array&#xA;            {                                       //01001... -&amp;gt; |01001..⟩&#xA;                if(prefix[k]==1)&#xA;                {&#xA;                    X(register[k]);&#xA;                }&#xA;            }&#xA;            using(z = Qubit[Length(prefix)])&#xA;            {&#xA;                for(k in 0..Length(prefix)-1)&#xA;                {&#xA;                    CCNOT(register[k],x[k],z[k]);  //flips the state of the qubit z[k] if register[k] and x[k] are equal&#xA;                    X(register[k]);                 //000 -&amp;gt; 000 -&amp;gt; 110 -&amp;gt; 111 -&amp;gt; 001&#xA;                    X(x[k]);                        //010 -&amp;gt; 010 -&amp;gt; 100 -&amp;gt; 100 -&amp;gt; 010&#xA;                    CCNOT(register[k],x[k],z[k]);  //100 -&amp;gt; 100 -&amp;gt; 010 -&amp;gt; 010 -&amp;gt; 100&#xA;                    X(x[k]);                        //110 -&amp;gt; 111 -&amp;gt; 001 -&amp;gt; 001 -&amp;gt; 111&#xA;                    X(register[k]);&#xA;                }&#xA;                Controlled X(z,y);&#xA;                for(k in 0..Length(prefix)-1)  //resets z&#xA;                {&#xA;                    if(M(z[k])==One)&#xA;                    {&#xA;                        X(z[k]);&#xA;                    }&#xA;                }&#xA;            }&#xA;            for(k in 0..Length(prefix)-1) //resets register&#xA;            {&#xA;                if(M(register[k])==One)&#xA;                {&#xA;                    X(register[k]);&#xA;                }&#xA;            }&#xA;        }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2019-07-13T12:18:37.237" LastActivityDate="2019-07-13T18:25:44.630" Title="Hamming with prefix oracle" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;q#&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6761" PostTypeId="1" AcceptedAnswerId="6763" CreationDate="2019-07-13T12:28:24.677" Score="0" ViewCount="71" Body="&lt;p&gt;I encountered the notion of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2$&lt;/span&gt; symmetry in an article. Can someone give a definition?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="10480" LastEditDate="2021-04-05T17:38:49.550" LastActivityDate="2021-04-05T17:38:49.550" Title="What is $\mathbb{Z}_2$ symmetry?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6762" PostTypeId="2" ParentId="6756" CreationDate="2019-07-13T13:19:54.410" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;    \Pr(\text{“0&quot;}) &amp;amp; =&#xA;    \frac{1}{4} ( 2 + \left\langle \psi , \phi \mid \phi, \psi \right\rangle + \left\langle \phi , \psi \mid \psi , \phi \right\rangle ) \\&#xA;    &amp;amp; = \frac{1}{4} ( 2 + \left\langle \psi \mid \phi \right\rangle \left\langle\phi \mid \psi\right\rangle + \left\langle \phi \mid \psi \right\rangle \left\langle\psi \mid \phi\right\rangle )\\&#xA;    &amp;amp; = \frac{1}{4} ( 2 + | \left\langle \psi \mid \phi \right\rangle |^2 + | \left\langle \phi \mid \psi \right\rangle|^2)\\&#xA;    &amp;amp; = \frac{1}{4} ( 2 + 2 | \left\langle \psi \mid \phi \right\rangle |^2 )\\&#xA;    &amp;amp; = \frac{1}{2} ( 1 + 1 | \left\langle \psi \mid \phi \right\rangle |^2 )\\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \left\langle \psi \mid \phi \right\rangle |^2 = | \left\langle \phi \mid \psi \right\rangle|^2&#xA;$$&lt;/span&gt;&#xA;Inside the norm squared, the 2 quantities inside are complex conjugates of each other. So they have the same norm squared.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="1978" LastEditDate="2019-07-13T17:22:11.353" LastActivityDate="2019-07-13T17:22:11.353" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6763" PostTypeId="2" ParentId="6761" CreationDate="2019-07-13T14:17:04.683" Score="3" Body="&lt;p&gt;There is an operator &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$P^2$&lt;/span&gt; is the identity and commutes with the Hamiltonians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case &lt;span class=&quot;math-container&quot;&gt;$P=\prod \sigma_x$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2$&lt;/span&gt;  because &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and the identity form a group isomorphic to the integers modulo 2 (odds and evens)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Identity corresponds to evens, &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; to odds. &lt;span class=&quot;math-container&quot;&gt;$P^2=1$&lt;/span&gt; corresponds to odd plus odd equals even.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there were some other operators commuting with the Hamiltonians, then would be some other kind of symmetry, not &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2$&lt;/span&gt;. But in this case, it is not that complicated.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2019-07-14T14:16:59.143" LastActivityDate="2019-07-14T14:16:59.143" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6764" PostTypeId="1" CreationDate="2019-07-13T15:03:26.690" Score="0" ViewCount="435" Body="&lt;p&gt;I want to do a feedforward on a quantum circuit using the simulator of Qiskit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, measure qubit_1 to bit 1 and do some operator on qubit_2 if the result of measuring qubit_1 is 0 and if the result is 0, then another operator. Then measure qubit 3 and do some operator on qubit_4 if the result of measuring qubit_3 is 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so far I know that I could use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;QuantumCurcuit.operator(Quantumregister[index]).c_if(classicalRegister, value)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the condition of c_if is depended on all value of all bit of classical register. I want to do feedforward depend on an individual bit just 0 or 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it is not the right way to solve the issue by adding another addition qubit to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and project it on the classical bit. Just to reset that bit to 0 again this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there any way to reset the classical register?&lt;/p&gt;&#xA;" OwnerUserId="4729" LastActivityDate="2019-08-14T07:02:45.353" Title="How to reset classical register on QISKit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6765" PostTypeId="1" AcceptedAnswerId="6772" CreationDate="2019-07-13T15:54:44.903" Score="1" ViewCount="76" Body="&lt;p&gt;Consider any data structure based on the binary search trees, e.g. set. Classical computers can make queries (insert, remove, test if element present), into this structure in &lt;span class=&quot;math-container&quot;&gt;$O(\log n)$&lt;/span&gt; time, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the quantum circuit representation, set data structure requires &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; wires to be implementable. The unitary matrices that represent queries on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; wires will have size &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt;. The boundary on the length of the gate sequence is &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3873/number-of-gates-required-to-approximate-arbitrary-unitaries&quot;&gt;Number of gates required to approximate arbitrary unitaries&lt;/a&gt;). Therefore, generally we won't be able to achieve classical &lt;span class=&quot;math-container&quot;&gt;$O(\log n)$&lt;/span&gt; query complexity, we will have even worse &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; is given for &lt;em&gt;arbitrary&lt;/em&gt; matrix. The question is: is it possible to implement the unitary matrices that represent set queries on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits with a gate sequence of &lt;span class=&quot;math-container&quot;&gt;$O(\log n)$&lt;/span&gt; length?&lt;/p&gt;&#xA;" OwnerDisplayName="user7988" LastEditorDisplayName="user7988" LastEditDate="2019-07-13T16:03:40.920" LastActivityDate="2019-07-14T06:25:36.860" Title="Is it possible to simulate any classical algorithm with the same efficiency on quantum computer?" Tags="&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6766" PostTypeId="2" ParentId="6751" CreationDate="2019-07-13T16:54:38.270" Score="1" Body="&lt;p&gt;The key to figuring out the probability of any measurement result is Born's rule, which says that if you have a state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle$&lt;/span&gt; the probability of observing measurement outcome &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right\rangle$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;    \Pr(\phi | \psi) = \left|\left\langle \phi | \psi \right\rangle \right|^2.&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;In the example you described, let's consider the probability with which Alice observes &lt;span class=&quot;math-container&quot;&gt;$\left|0\right\rangle$&lt;/span&gt; and Bob observes &lt;span class=&quot;math-container&quot;&gt;$\sin(3\pi / 8) \left| 0\right\rangle + \cos(3\pi / 8) \left| 1\right\rangle$&lt;/span&gt;. This outcome occurs with probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;     &amp;amp; \Pr(A=0,B=0|\text{EPR}) \\&#xA;     &amp;amp; \quad = \frac12\left|&#xA;         \sin(3\pi / 8) \left\langle 00 | 00 \right\rangle +&#xA;         \cos(3\pi / 8) \left\langle 01 | 00 \right\rangle +&#xA;         \sin(3\pi / 8) \left\langle 00 | 11 \right\rangle +&#xA;         \cos(3\pi / 8) \left\langle 01 | 11 \right\rangle&#xA;     \right|^2 \\&#xA;     &amp;amp; \quad = \frac12\left|&#xA;         \sin(3\pi / 8)&#xA;     \right|^2 \approx 0.85.&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;Here, we used that the four computational basis states &lt;span class=&quot;math-container&quot;&gt;$\left\{\left|00\right\rangle, \left|01\right\rangle, \left|10\right\rangle, \left|11\right\rangle \right\}$&lt;/span&gt; are all orthogonal to each other, so that the &lt;span class=&quot;math-container&quot;&gt;$\left\langle 00 | 00\right\rangle$&lt;/span&gt; is the only one that survives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability for each of the other three outcomes can be worked out in a similar fashion using Born's rule. &lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2019-07-13T16:54:38.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6767" PostTypeId="2" ParentId="6760" CreationDate="2019-07-13T17:13:59.453" Score="3" Body="&lt;p&gt;One problem is that you are resetting the &lt;span class=&quot;math-container&quot;&gt;$\left|z\right\rangle$&lt;/span&gt; register after applying the &lt;code&gt;Controlled X(z, y)&lt;/code&gt; operation. Right before you reset, your &lt;span class=&quot;math-container&quot;&gt;$\left|z\right\rangle$&lt;/span&gt; register is entangled with the other two registers, such that resetting in that way collapses any superposition on the &lt;span class=&quot;math-container&quot;&gt;$\left|x\right\rangle \left|y\right\rangle$&lt;/span&gt; registers. While that's not a problem if you only ever provide as input qubits in a computational basis state, the Deutsch–Jozsa algorithm uses inputs in states such as &lt;span class=&quot;math-container&quot;&gt;$\left|++\cdots+\right\rangle\left|-\right\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use this approach, you'll need to first &lt;em&gt;uncompute&lt;/em&gt; the information stored in &lt;span class=&quot;math-container&quot;&gt;$\left|z\right\rangle$&lt;/span&gt;.&#xA;Here, that means running the following loop over again after applying &lt;code&gt;Controlled X(z, y)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for(k in 0..Length(prefix)-1)&#xA;{&#xA;    CCNOT(register[k],x[k],z[k]);  //flips the state of the qubit z[k] if register[k] and x[k] are equal&#xA;    X(register[k]);                 //000 -&amp;gt; 000 -&amp;gt; 110 -&amp;gt; 111 -&amp;gt; 001&#xA;    X(x[k]);                        //010 -&amp;gt; 010 -&amp;gt; 100 -&amp;gt; 100 -&amp;gt; 010&#xA;    CCNOT(register[k],x[k],z[k]);  //100 -&amp;gt; 100 -&amp;gt; 010 -&amp;gt; 010 -&amp;gt; 100&#xA;    X(x[k]);                        //110 -&amp;gt; 111 -&amp;gt; 001 -&amp;gt; 001 -&amp;gt; 111&#xA;    X(register[k]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Doing so will deterministically return &lt;span class=&quot;math-container&quot;&gt;$\left|z\right\rangle$&lt;/span&gt; to the all-zeros state, without using measurement.&#xA;This is very common in quantum programming, and is why the Q# standard libraries include operations like &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.canon.applywithca&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ApplyWithCA&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastEditorUserId="2879" LastEditDate="2019-07-13T18:25:44.630" LastActivityDate="2019-07-13T18:25:44.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6768" PostTypeId="1" AcceptedAnswerId="6782" CreationDate="2019-07-13T22:19:53.150" Score="5" ViewCount="307" Body="&lt;p&gt;I'm trying to (understand and) solve this problem from Nielsen and Chuang's &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fW8K9.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fW8K9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the definition of Operation Elements: &lt;span class=&quot;math-container&quot;&gt;$\sum_{k} E_k \rho E_k^†$&lt;/span&gt; with  &lt;span class=&quot;math-container&quot;&gt;$E_k = \langle e_k|U|e_0 \rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$e_k$&lt;/span&gt; form the basis for the environment. But I'm not quite sure how this definition may be used to solve the problem above. &lt;/p&gt;&#xA;" OwnerUserId="7805" LastEditorUserId="55" LastEditDate="2021-02-19T18:32:15.397" LastActivityDate="2021-02-19T18:32:15.397" Title="Find the quantum operation corresponding to a given unitary evolution and projective measurement" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6769" PostTypeId="1" AcceptedAnswerId="6770" CreationDate="2019-07-14T01:48:59.967" Score="0" ViewCount="41" Body="&lt;p&gt;In the 10th Anniversary Edition of Nielsen and Chuang Quantum Computation and Quantum Information textbook, Chapter 6.7 talks about Black Box algorithm limits.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is given:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n \rightarrow \{0,1\}$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$F:\{X_0,X_1,X_2,....,X_{N-1}   \}\rightarrow \{0,1\}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\text{such that} \space F \space \text{is a boolean function,} \space X_k=f(k) \space and \space N=2^n-1$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is then mentioned that:  &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We say that a polynomial &lt;span class=&quot;math-container&quot;&gt;$p: R^N\rightarrow R$&lt;/span&gt; represents &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$p(X)=F(X)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$X \in \{0,1\}^N$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; denotes the real numbers). Such a polynomial &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; always exists, since we can explicitly construct a suitable candidate:&lt;br&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$p(X)=\sum_{Y\in \{0,1\}^N} F(Y)\prod_{k=0}^{N-1}[1-(Y_k-X_k)^2]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can someone explain this formula to me and whether the construction is a result of rigorous steps or by intuition? Will also be good if there are useful materials related to this for me to read.     &lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2019-07-14T03:39:22.607" Title="Minimum Multi-Degree Polynomials representing Boolean Functions" Tags="&lt;mathematics&gt;&lt;complexity-theory&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6770" PostTypeId="2" ParentId="6769" CreationDate="2019-07-14T03:39:22.607" Score="1" Body="&lt;p&gt;Plug in an arbitrary &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; into the formula.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at each summand for each particular &lt;span class=&quot;math-container&quot;&gt;$Y \in \{0,1\}^N$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$Y \neq X$&lt;/span&gt;, then there must be at least one index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$X_k \neq Y_k$&lt;/span&gt;. But both &lt;span class=&quot;math-container&quot;&gt;$Y_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_k$&lt;/span&gt; are only either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. So if they are not equal, then the difference must be either &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. Square that and you get &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if they are different. Then one of the terms in the product will be &lt;span class=&quot;math-container&quot;&gt;$1-1=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if &lt;span class=&quot;math-container&quot;&gt;$Y \neq X$&lt;/span&gt;, that particular summand is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only summand that remains is when &lt;span class=&quot;math-container&quot;&gt;$Y=X$&lt;/span&gt;. In that case each of the &lt;span class=&quot;math-container&quot;&gt;$1-(Y_k-X_k)^2$&lt;/span&gt; are equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. So the product of all of those still gives &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the result for that summand is &lt;span class=&quot;math-container&quot;&gt;$F(Y)=F(X)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Add together the summands for all the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and you get the only nonzero term, &lt;span class=&quot;math-container&quot;&gt;$F(X)$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$p(X)=F(X)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$X \in \{0,1\}^N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As desired, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; represents &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;. However, there may be simpler &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; that still do the same. This is just one of them. The one of smallest degree gives the notion of degree of a boolean function which is related to sensitivity and block sensitivity.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-07-14T03:39:22.607" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6771" PostTypeId="2" ParentId="6764" CreationDate="2019-07-14T05:26:41.433" Score="1" Body="&lt;p&gt;The &lt;code&gt;c_if&lt;/code&gt; in Qiskit only operates on a full classical register, following the &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenQASM spec&lt;/a&gt;. If you would like to condition on individual bits, you have to create a new &lt;code&gt;ClassicalRegister&lt;/code&gt; for each bit. Then you can condition on each bit separately.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2019-07-14T05:26:41.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6772" PostTypeId="2" ParentId="6765" CreationDate="2019-07-14T06:25:36.860" Score="1" Body="&lt;p&gt;Yes, any classical algorithm can be implemented as a quantum circuit with almost same efficiency.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At first, we make our algorithm reversible (just include input as part of the output). Then represent it as a classical logic circuit and then modify this circuit such that it will contain only reversible classical logical gates &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing#Logical_reversibility&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Reversible_computing#Logical_reversibility&lt;/a&gt;. Actually we can use only classical Toffoli gate since it's universal for classical reversible circuits. Finally reversible classical gates are simply translated to corresponding quantum gates. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-07-14T06:25:36.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6773" PostTypeId="2" ParentId="6738" CreationDate="2019-07-14T08:41:45.453" Score="0" Body="&lt;p&gt;I find two answers: (code tested and working)&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Answer (1) (read the register value before the execute command)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qiskit.IBMQ.disable_accounts()&#xA;IBMQ.enable_account('change to your api','change to your url')&#xA;#backend = qiskit.IBMQ.get_backend('ibmq_16_melbourne')&#xA;backend = qiskit.IBMQ.get_backend('ibmq_qasm_simulator')&#xA;&#xA;qr  = QuantumRegister  (4)# 1110&#xA;qq  = QuantumRegister  (4)# will set to 1110 dependin on cr read&#xA;cr  = ClassicalRegister(4)&#xA;cc  = QuantumCircuit(qr,qq,cr)&#xA;&#xA;cc.x(qr[1]);cc.x(qr[2]);cc.x(qr[3])# 1110&#xA;&#xA;#---the important code start:----------------------------------------&#xA;for i in range(4):&#xA;    cc.measure(qr[i],cr[0])#read qr to set qq depending on the read of the classical register value using (if) condition&#xA;    cc.reset(qq[i]) # qq[i] = 0&#xA;    cc.x(qq[i]).c_if(cr,1) # if(cr == 1): qq[i] = 1 , test the whole cr decimal value, it can hold {0 to (2^n)-1}&#xA;#---the important code end--------------------------------------------&#xA;&#xA;for i in range(4): cc.measure(qq[i],cr[i])#read qq&#xA;&#xA;job=qiskit.execute(cc,backend,shots=1024)&#xA;result=job.result()&#xA;counts=result.get_counts(cc)&#xA;print(counts) # {'1110': 1024}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;--- execute result ---&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'1110': 1024}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Answer (2) (read the register value after the execute command)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qiskit.IBMQ.disable_accounts()&#xA;IBMQ.enable_account('change to your api','change to your url')&#xA;#backend = qiskit.IBMQ.get_backend('ibmq_16_melbourne')&#xA;backend = qiskit.IBMQ.get_backend('ibmq_qasm_simulator')&#xA;&#xA;qr  = QuantumRegister  (4)# 1110&#xA;cr  = ClassicalRegister(4)&#xA;cc  = QuantumCircuit(qr,cr)&#xA;&#xA;cc.x(qr[1]);cc.x(qr[2]);cc.x(qr[3])# 1110&#xA;&#xA;for i in range(4): cc.measure(qr[i],cr[i])#read&#xA;&#xA;job=qiskit.execute(cc,backend,shots=1024)&#xA;result=job.result()&#xA;counts=result.get_counts(cc)&#xA;print(counts) # {'1110': 1024}&#xA;&#xA;#---the important code start:----------------------------------------&#xA;lAnswer = [(k[::-1],v) for k,v in counts.items()]&#xA;lAnswer.sort(key = lambda x: x[1], reverse=True)&#xA;Y = []&#xA;for k, v in lAnswer: Y.append( [ int(c) for c in k ] )&#xA;#---the important code end--------------------------------------------&#xA;&#xA;print(Y) # [[0, 1, 1, 1]]&#xA;&#xA;print(Y[0][0]) # 0&#xA;print(Y[0][1]) # 1&#xA;print(Y[0][2]) # 1&#xA;print(Y[0][3]) # 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;--- execute result ---&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'1110': 1024}&#xA;[[0, 1, 1, 1]]&#xA;0&#xA;1&#xA;1&#xA;1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8018" LastActivityDate="2019-07-14T08:41:45.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6774" PostTypeId="1" CreationDate="2019-07-14T10:01:03.437" Score="-2" ViewCount="257" Body="&lt;p&gt;Note: forcing a superposition qubit to collapses to 1, means cancel the other value 0 to get 1 appear&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question details step by step:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#If i have two qubits&#xA;Qr = QuantumRegister(1)&#xA;qr = QuantumRegister(1)&#xA;&#xA;#and two classical registers&#xA;Cr = ClassicalRegister(1)&#xA;cr = ClassicalRegister(1)&#xA;&#xA;#and one quantum circuit&#xA;cc = QuantumCircuit(Qr,qr,Cr,cr)&#xA;&#xA;#And put Qr in superposition state&#xA;cc.h(Qr[0])&#xA;&#xA;#And copy Qr to qr&#xA;cc.cx(Qr[0],qr[0])&#xA;&#xA;# How to force qr[0] to collapses to a certain needed value (say 1) ,&#xA;# and after measuring Qr[0] it gives the same qr[0] value (gives 1 too)&#xA;&#xA;#########################################################################&#xA;# need to do some tricks to force qr[0] to be 1&#xA;# (force it to be 1 by changing the probability of being 1 to high,&#xA;# not by changing the value of it to 1)&#xA;# and Qr[0] measuring also gives 1 (without doing any operations to it)&#xA;# all operations will done to qr[0] only&#xA;# we can add/use any new registers&#xA;#########################################################################&#xA;&#xA;# and after measuring , we have to found that Cr[0] == cr[0] == 1&#xA;cc.measure(Qr[0],Cr[0]) # Cr==1&#xA;cc.measure(qr[0],cr[0]) # cr==1&#xA;&#xA;&#xA;# who can do it? and how?&#xA;# or even increasing the probability of getting 1 like 90%:10% instead of 50%:50%&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Idea (1):&lt;/strong&gt; when we do &lt;strong&gt;h(Qr)&lt;/strong&gt;, it will be in &lt;strong&gt;superposition state&lt;/strong&gt;, it means it can be &lt;strong&gt;0&lt;/strong&gt; and changed to &lt;strong&gt;1&lt;/strong&gt; at any moment, i need some method to &lt;strong&gt;measure the probability&lt;/strong&gt; of being 1 at this moment, if it is &lt;strong&gt;high&lt;/strong&gt; then i do normal measure to &lt;strong&gt;catch&lt;/strong&gt; it, if it is &lt;strong&gt;low&lt;/strong&gt;, then i &lt;strong&gt;loop&lt;/strong&gt; doing another things &lt;strong&gt;and test the probability again&lt;/strong&gt; until it is &lt;strong&gt;changed to high&lt;/strong&gt;, then we can do &lt;strong&gt;normal measure to catch&lt;/strong&gt; and make it real, we will do this to &lt;strong&gt;all qubits one by one&lt;/strong&gt; till get all our outputs &lt;strong&gt;match the known outputs&lt;/strong&gt;, then our inputs will be the &lt;strong&gt;secret inputs&lt;/strong&gt; that we want to know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;in another words:&lt;/strong&gt; we want &lt;strong&gt;Qr&lt;/strong&gt; still in superposition but after excute it 1000 shots and measure it,we get 990 times 1 and 10 times 0 or &lt;strong&gt;{'0': 10, '1': 990}&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8018" LastEditorUserId="55" LastEditDate="2021-04-09T09:00:25.653" LastActivityDate="2021-04-09T09:00:25.653" Title="The most important quantum question , how to force a superposition qubit to collapses to an exact value?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ClosedDate="2019-08-01T17:03:33.127" ContentLicense="CC BY-SA 4.0" />
  <row Id="6775" PostTypeId="1" AcceptedAnswerId="6791" CreationDate="2019-07-14T11:25:56.153" Score="5" ViewCount="672" Body="&lt;p&gt;I'm trying to apply a time evolution algorithm for a physical system I'm trying to simulate on QISkit, however, in order to do that, I need to use the so-called Ising coupling gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I=\begin{pmatrix}&#xA;e^{ia} &amp;amp; 0 &amp;amp; 0 &amp;amp;0 \\&#xA;0 &amp;amp; e^{-ia} &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; e^{-ia} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{ia}&#xA;\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried performing rotations in the z-axis in both quits with the rz gate, also I've tried combining crz gates, as well as rzz and cu1 gates, but nothing seems to work. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest I could get was by implementing a zzz gate followed by a cu1 gate with oposite angle, however &lt;span class=&quot;math-container&quot;&gt;$[I]_{1,1}$&lt;/span&gt; still remains at 1, no phase detected by the Aer unitary simulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I implement this gate?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much in advance. &lt;/p&gt;&#xA;" OwnerUserId="8040" LastEditorUserId="26" LastEditDate="2019-10-27T09:33:41.070" LastActivityDate="2019-10-27T09:33:41.070" Title="How to create an Ising coupling gate with Qiskit?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6776" PostTypeId="1" CreationDate="2019-07-14T11:59:51.930" Score="2" ViewCount="92" Body="&lt;p&gt;I have the latest version of cplex (12.9) installed on my computer. I use it very well with Jupyter notebook, but in IBM Q Experience, I did not get way to call it. IBM Q Experience warns me that the cplex is not installed. Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&#xA;Parfait&lt;/p&gt;&#xA;" OwnerUserId="8042" LastActivityDate="2021-04-07T03:09:30.967" Title="How call from IBM Q Experience (Jupyter Notebook) cplex" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6777" PostTypeId="2" ParentId="6775" CreationDate="2019-07-14T12:23:34.483" Score="0" Body="&lt;p&gt;I guess what you may need is the Pauli operators:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/quantum_info/operators/pauli.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/quantum_info/operators/pauli.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/topics/engineering/pauli-operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/topics/engineering/pauli-operator&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8042" LastEditorUserId="26" LastEditDate="2019-10-27T09:33:19.837" LastActivityDate="2019-10-27T09:33:19.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6778" PostTypeId="2" ParentId="6774" CreationDate="2019-07-14T14:44:53.577" Score="1" Body="&lt;p&gt;i think you have done entaglment &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt; so when you measure the first qubit the second qubit forces to be collapses to the same state as the first qubit state. &lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2019-07-14T14:44:53.577" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="6779" PostTypeId="1" CreationDate="2019-07-14T15:31:24.693" Score="3" ViewCount="69" Body="&lt;p&gt;In this &lt;a href=&quot;https://arxiv.org/abs/1812.01041&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, QAOA on Maxcut shows symmetries that allow them to restrict their search space intervals. But how do they find such intervals knowing that in the original QAOA angles &lt;span class=&quot;math-container&quot;&gt;$\gamma,\beta$&lt;/span&gt; are set on the intervals &lt;span class=&quot;math-container&quot;&gt;$[0,2\pi], [0,\pi]$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="55" LastEditDate="2019-09-28T19:15:10.027" LastActivityDate="2019-09-28T19:15:10.027" Title="QAOA and symmetry effects on the angles" Tags="&lt;algorithm&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6780" PostTypeId="2" ParentId="6775" CreationDate="2019-07-14T15:33:51.500" Score="1" Body="&lt;p&gt;Conjugate by a CNOT, you'll see a controlled unitary of multiplying by &lt;span class=&quot;math-container&quot;&gt;$e^{\pm 2i a}$&lt;/span&gt; depending on which CNOT you do and an overall phase of &lt;span class=&quot;math-container&quot;&gt;$e^{\mp i a}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-07-14T15:33:51.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6782" PostTypeId="2" ParentId="6768" CreationDate="2019-07-14T19:07:24.277" Score="5" Body="&lt;p&gt;So, let the system be &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and the environment &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle 0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The given operation (which you can check is unitary, and incidentally happens to be the CNOT operation), is applied on &lt;span class=&quot;math-container&quot;&gt;$\rho \otimes |0\rangle \langle 0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(P_0 \otimes I + P_1 \otimes X)(\rho \otimes |0\rangle \langle 0|)(P_0 \otimes I + P_1 \otimes X)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you just expand it and multiply to get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_0 \rho P_0 \otimes |0\rangle \langle 0| + &#xA;P_0 \rho P_1 \otimes |0\rangle \langle 1| +&#xA;P_1 \rho P_0 \otimes |1\rangle \langle 0| +&#xA;P_1 \rho P_1 \otimes |1\rangle \langle 1| $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you trace out the environment, you're left with:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_0 \rho P_0 + P_1 \rho P_1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus the operator elements are &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2019-07-14T19:07:24.277" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6783" PostTypeId="2" ParentId="2724" CreationDate="2019-07-14T21:50:07.940" Score="3" Body="&lt;p&gt;I just found this now:&#xA;&lt;a href=&quot;https://brilliant.org/courses/quantum-computing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://brilliant.org/courses/quantum-computing/&lt;/a&gt;, I will start it today, at this moment I don't know how far I will go with the free subscription since I joined it following the link in the &lt;a href=&quot;https://cloudblogs.microsoft.com/quantum/2019/05/23/microsoft-brilliant-team-up-to-offer-quantum-curriculum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft Quantum blog post&lt;/a&gt; (where you can have more info about the content) .&lt;br&gt;&#xA;For late joiners and non campaign users only 2 chapters will be available for free.&lt;/p&gt;&#xA;" OwnerUserId="7961" LastEditorUserId="7961" LastEditDate="2019-07-14T22:33:22.690" LastActivityDate="2019-07-14T22:33:22.690" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6784" PostTypeId="1" AcceptedAnswerId="6792" CreationDate="2019-07-14T23:05:55.423" Score="5" ViewCount="1021" Body="&lt;p&gt;There seem to be two definitions of the Pauli group. In Nielsen and Chuang, the Pauli group on 1 qubit is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\mathcal{P}_1 = \{\pm I, \pm iI, \pm X, \pm iX, \pm Y, \pm iY, \pm Z, \pm iZ\} = \langle X, Y, Z\rangle.&#xA;\end{align*}&lt;/span&gt;&#xA;But in other references, such as &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.57.127&quot; rel=&quot;noreferrer&quot;&gt;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.57.127&lt;/a&gt;, &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\mathcal{P}_1 = \{\pm I, \pm X, \pm iY, \pm Z\} = \langle X, Z\rangle.&#xA;\end{align*}&lt;/span&gt;&#xA;The second definition makes more sense in the stabilizer formalism, since we usually only consider the action of Pauli strings of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. What bothers me is that by the second definition, the phase gate &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, which is an element of the Clifford group, results in&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;SXS^\dagger = Y \notin \mathcal{P}_1.&#xA;\end{align*}&lt;/span&gt;&#xA;I know that the prefactor &lt;span class=&quot;math-container&quot;&gt;$\pm i$&lt;/span&gt; somehow doesn't matter, but can someone justify it from a more mathematical/group-theoretical perspective?&lt;/p&gt;&#xA;" OwnerUserId="7745" LastActivityDate="2019-07-16T18:18:17.600" Title="Definition of the Pauli group and the Clifford group" Tags="&lt;pauli-gates&gt;&lt;clifford-group&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6785" PostTypeId="2" ParentId="6784" CreationDate="2019-07-14T23:23:40.657" Score="5" Body="&lt;p&gt;The difference in definitions is from either taking the unitary group or the &lt;a href=&quot;https://en.wikipedia.org/wiki/Projective_unitary_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;projective unitary group&lt;/a&gt;. That accounts for the constant prefactors of &lt;span class=&quot;math-container&quot;&gt;$\pm i$&lt;/span&gt; that are missing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In lieu of a tikz commutative diagram&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;lt;X,Y,Z&amp;gt; &amp;amp; \hookrightarrow &amp;amp;  U(2)\\&#xA;\downarrow &amp;amp; &amp;amp; \downarrow\\&#xA;&amp;lt;[X],[Z]&amp;gt; &amp;amp; \hookrightarrow &amp;amp; PU(2)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both of the inclusion arrows &lt;span class=&quot;math-container&quot;&gt;$H \hookrightarrow G$&lt;/span&gt;, you can form  normalizers &lt;span class=&quot;math-container&quot;&gt;$N_G (H)$&lt;/span&gt; which fit in between on each row.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2019-07-16T18:18:17.600" LastActivityDate="2019-07-16T18:18:17.600" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6786" PostTypeId="1" AcceptedAnswerId="6787" CreationDate="2019-07-15T03:28:33.063" Score="3" ViewCount="80" Body="&lt;p&gt;I'm studying the measurement in quantum computation. It's known that the trace is related to the expectation value and the probability of getting certain outcomes. However, when the trace is a complex value, how is it related to the probability or the counting number of outcomes in real world?&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="124" LastEditDate="2019-07-15T13:36:40.303" LastActivityDate="2019-07-15T13:36:40.303" Title="What's the probability of measuring outcomes give measurement observable $M$ and state $\rho$ when $\mathrm{Tr}\!\:(\!\!\;M\rho)$ is a complex value?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6787" PostTypeId="2" ParentId="6786" CreationDate="2019-07-15T05:12:51.683" Score="5" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(AB)$&lt;/span&gt; is always real and non-negative if &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; are positive semi-definite hermitian matrices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this note that &lt;span class=&quot;math-container&quot;&gt;$A = UDU^\dagger$&lt;/span&gt;, for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and diagonal matrix &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$d_{ii} \ge 0$&lt;/span&gt;.&lt;br&gt;&#xA;Then &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(AB) = \text{Tr}(UDU^\dagger B) = \text{Tr}(DU^\dagger B U).$&lt;/span&gt;&lt;br&gt;&#xA;But &lt;span class=&quot;math-container&quot;&gt;$B^\prime = U^\dagger B U$&lt;/span&gt; is also positive semi-definite and hermitian, therefore it has non-negative numbers on diagonal &lt;span class=&quot;math-container&quot;&gt;$b^\prime_{ii} \ge 0$&lt;/span&gt;. Now &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(DB^\prime) = \sum_i d_{ii}b^\prime_{ii} \ge 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-07-15T07:04:30.010" LastActivityDate="2019-07-15T07:04:30.010" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6788" PostTypeId="2" ParentId="6764" CreationDate="2019-07-15T07:01:37.220" Score="0" Body="&lt;p&gt;You dont have to reset classical registers they store the current measurment result of the quantum bits. I.e. the value of the classical register is not the matter what it matter is that the value they hold after the measurment.&lt;/p&gt;&#xA;" OwnerUserId="4206" LastActivityDate="2019-07-15T07:01:37.220" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6789" PostTypeId="2" ParentId="6768" CreationDate="2019-07-15T07:35:59.503" Score="3" Body="&lt;p&gt;As an alternative to the other answer (which is perfectly valid), we can use the formalism specified in the question. We're given a &lt;span class=&quot;math-container&quot;&gt;$U=P_0\otimes I+P_1\otimes X$&lt;/span&gt;. We know that the environment starts in state &lt;span class=&quot;math-container&quot;&gt;$|e_0\rangle=|0\rangle$&lt;/span&gt;. We need to establish an orthonormal basis for the environment, &lt;span class=&quot;math-container&quot;&gt;$|e_k\rangle$&lt;/span&gt;. In this case, it's straightforward as the environment is only two-dimensional:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|e_0\rangle=|0\rangle\qquad |e_1\rangle=|1\rangle.&#xA;$$&lt;/span&gt;&#xA;Now we can apply the formula &lt;span class=&quot;math-container&quot;&gt;$E_k=(I\otimes \langle e_k|)U(I\otimes |e_0\rangle)$&lt;/span&gt;. Note that I've added in some identity elements to make it clearer that the environment basis only applies to the second subsystem. Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(I\otimes |e_0\rangle)=P_0\otimes|0\rangle+P_1\otimes|1\rangle,&#xA;$$&lt;/span&gt;&#xA;and so we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_0=(I\otimes\langle 0|)(P_0\otimes|0\rangle+P_1\otimes|1\rangle)=P_0,&#xA;$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$E_1=P_1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-15T07:35:59.503" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6790" PostTypeId="2" ParentId="6774" CreationDate="2019-07-15T08:00:08.253" Score="1" Body="&lt;p&gt;You &lt;strong&gt;cannot&lt;/strong&gt; force a superposition to collapse in a particular direction. When you perform a measurement that removes a superposition, that 'collapse' is random, and you cannot choose which way it collapses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you &lt;em&gt;know&lt;/em&gt; what superposition you have, you can always convert it into any other state that you want to via unitary evolution (at which point you should not be using the 'collapse' terminology, which implies a non-unitary evolution).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading the comments, it seems that what you want to do is manipulate the probabilities with which the state collapses. This is better incorporated into the preparation procedure. Instead of performing a Hadamard rotation on the first qubit, perform a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-rotation of some angle &lt;span class=&quot;math-container&quot;&gt;$2\theta$&lt;/span&gt;. I think this is provided by a command called &lt;code&gt;ry&lt;/code&gt;. This will provide you with a state &lt;span class=&quot;math-container&quot;&gt;$\cos\theta|0\rangle+\sin\theta|1\rangle$&lt;/span&gt; so that when you apply the controlled-not gate, you'll have &lt;span class=&quot;math-container&quot;&gt;$\cos\theta|00\rangle+\sin\theta|11\rangle$&lt;/span&gt;. This means that when you measure, you'll get the answer 0 (on both qubits) with probability &lt;span class=&quot;math-container&quot;&gt;$\cos^2\theta$&lt;/span&gt;, and 1 with probability &lt;span class=&quot;math-container&quot;&gt;$\sin^2\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-15T08:00:08.253" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6791" PostTypeId="2" ParentId="6775" CreationDate="2019-07-15T08:20:10.840" Score="5" Body="&lt;p&gt;AHusain's &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6780/1837&quot;&gt;answer&lt;/a&gt; is absolutely correct, but perhaps lacks some detail. The circuit that you want to implement is&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1AazF.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1AazF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Basically, the key is to realise that you want to apply phase &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha}$&lt;/span&gt; to the basis elements &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$e^{-i\alpha}$&lt;/span&gt; otherwise. In other words, you care about the parity of the two bits. If you can compute that parity of the two bits somewhere, you can perform a phase gate on that output, then undo the computation. Controlled-not computes the parity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, I'm assuming that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_z(\alpha)=\left(\begin{array}{cc} e^{i\alpha} &amp;amp; 0 \\ 0 &amp;amp; e^{-i\alpha} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;This might be inconsistent with whatever definition you wish to use by a global phase or by a factor of 2 on the angle.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-15T08:20:10.840" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6792" PostTypeId="2" ParentId="6784" CreationDate="2019-07-15T09:31:37.543" Score="4" Body="&lt;p&gt;Note that the second definition actually doesn't make more sense in the context of the stabiliser formalism, as neither of &lt;span class=&quot;math-container&quot;&gt;$\pm i Y$&lt;/span&gt; have a +1 eigenspace. That means that you can only describe states which are stabilised by operators with two or more factors of &lt;span class=&quot;math-container&quot;&gt;$\pm i Y$&lt;/span&gt;. This is only enough to simulate real stabiliser circuits, which is what you're noticing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For that reason, I would use the first definition; and anyone whose work involves taking the Pauli operators first (which consist of &lt;span class=&quot;math-container&quot;&gt;$\mathbf 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, &lt;em&gt;and also&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;) and then generating a group from them will inevitably use the first definition, for the simple reason that this is the group &lt;span class=&quot;math-container&quot;&gt;$\langle X, Y, Z\rangle$&lt;/span&gt;. And because the operators &lt;span class=&quot;math-container&quot;&gt;$\mathbf 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; form an operator basis for the Hermitian operators on a single qubit, there are often very good theoretical reasons to include the operator &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; (in preference to &lt;span class=&quot;math-container&quot;&gt;$iY$&lt;/span&gt;) in one's analysis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It must be said that [&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.57.127&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. A &lt;strong&gt;57&lt;/strong&gt; (127), 1998&lt;/a&gt;] is not just any old article which uses the Pauli group, nor will the point I made above have escaped its author. The reason (I believe) why Gottesman didn't make the distinction there, that I am making now, is because his main interest in that article is in describing error correcting codes &amp;mdash; in which the scalar factors preceding the Pauli operators are in principle less important.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;To start with, many of the best liked and interesting codes &amp;mdash; from the 9-qubit code and the Steane &lt;span class=&quot;math-container&quot;&gt;$[\! [7,1,3]\! ]$&lt;/span&gt; code, to the toric code &amp;mdash; happen to be CSS codes, whose stabiliser groups  are generated by separate X and Z stabilisers; any stabiliser operators involving Y, will indeed have Y operators in pairs. So, &lt;em&gt;in practise&lt;/em&gt;, the point I made about &lt;span class=&quot;math-container&quot;&gt;$iY$&lt;/span&gt; not having a +1 eigenspace often doesn't come up. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Secondly, if one decides to just do a hand-wave and forget all scalars, then the important thing is not whether a state is a joint +1 eigenstate of the stabilisers, but just that the state is &lt;em&gt;some&lt;/em&gt; eigenstate of &lt;em&gt;all&lt;/em&gt; the stabilisers. Considering a stabiliser code, the important thing is that all of the states of the code have the same eigenvalues as each other. This second point gives rise to the notion of the Pauli Frame: the eigenvalues which the codespace has for the 'stabilisers', interpreted as a reference frame. The main thing is for the Pauli frame to be well-defined, and for it to change slowly enough to track how it is changing by stabiliser measurements. And if you're not actually responsible for realising a system to do so, but just want to explore the theory of quantum error correction codes itself, specific eigenvalues are largely a distraction. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The thing is, if you want to use the stabiliser formalism for a different purpose &amp;mdash; say, to efficiently simulate stabiliser circuits on standard basis states &amp;mdash; then you can't be quite so carefree with scalars: a collection of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit stabiliser generators define a specific basis in which the state will live, but flip some signs and you change which of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; states you are talking about. To perform the correct simulation, signs do matter here. Keeping track of them may be slightly tedious using the usual convention, but in the end it's important to do. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-07-15T13:35:32.943" LastActivityDate="2019-07-15T13:35:32.943" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6793" PostTypeId="2" ParentId="6759" CreationDate="2019-07-16T09:23:35.880" Score="2" Body="&lt;p&gt;You can't edit using python in the circuit composer. You can edit the &lt;code&gt;OpenQASM&lt;/code&gt; which can be found on the left-hand side of the composer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like to use Qiskit, this is also available through the Q Experience, you need to click on the Jupyter Notebooks. Here you can create circuits of your own, or modify the given examples.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-07-16T09:23:35.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6794" PostTypeId="2" ParentId="6755" CreationDate="2019-07-16T10:05:31.057" Score="1" Body="&lt;p&gt;This is occurring because you declare your definition rule on two registers, but the way nodes are added to the DAG, only &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/6706453bb6c30f9fc2bccdd81b2ffcc357deb397/qiskit/transpiler/passes/unroller.py#L78&quot; rel=&quot;nofollow noreferrer&quot;&gt;one register will be added&lt;/a&gt;. It is defined over both the QuantumRegister &lt;code&gt;&quot;q&quot;&lt;/code&gt; you define in the method, and also the register passed in to &lt;code&gt;self.params&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To fix this therefore you need to update your definition to work on only one register. For example, the first qubit could be the control and the other qubits can be initialised.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-07-16T10:05:31.057" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6795" PostTypeId="2" ParentId="6733" CreationDate="2019-07-16T11:04:01.173" Score="3" Body="&lt;p&gt;Qualitatively, fidelity is the measure of the distance between two quantum states. Fidelity equal to 1, means that two states are equal. &#xA;In the case of a density matrix, fidelity represents the overlap with a reference pure state. Fidelity equal to 1, means that the square of density matrix is equal to density matrix itself and equivalent to the pure reference state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like every distance in metric spaces, it is obtained by means of an inner product. The inner product of two states is the overlap. The square of that is the fidelity (in the same way that that distance is defined in Euclidean space). That is, &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi_1 | \psi_2 \rangle |^2$&lt;/span&gt;, also known as spectroscopic factor in some physics context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For mixed state is the equivalent operation, that is evaluation of the density matrix &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_1 | \rho_1 |\psi_1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This measure is particularly important because quantum devices are noisy devices, therefore the fidelity of a result respect to an exact solution represents the inverse of the noise.&lt;/p&gt;&#xA;" OwnerUserId="8053" LastEditorUserId="9006" LastEditDate="2020-02-16T11:49:14.427" LastActivityDate="2020-02-16T11:49:14.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6796" PostTypeId="1" CreationDate="2019-07-16T15:59:46.763" Score="2" ViewCount="80" Body="&lt;p&gt;I want to investigate the effect of the decoherence time on a qubit, and I followed the tutorial here. &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/002-The_Weird_and_Wonderful_World_of_the_Qubit/006-Decoherence.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/proxy/tutorial/full-user-guide/002-The_Weird_and_Wonderful_World_of_the_Qubit/006-Decoherence.html&lt;/a&gt;&#xA;But my results don't really match up with the expected values where more gates would result in a higher P(0). Does anyone know why that is?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    # t1.py&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute&#xA;&#xA;from qiskit import IBMQ&#xA;IBMQ.load_accounts()&#xA;print(&quot;Available backends:&quot;)&#xA;IBMQ.backends()&#xA;from qiskit.providers.ibmq import least_busy&#xA;&#xA;large_enough_devices = IBMQ.backends(filters=lambda x: x.configuration().n_qubits &amp;gt; 3 and not x.configuration().simulator)&#xA;backend = least_busy(large_enough_devices)&#xA;print(&quot;The best backend is &quot; + backend.name())&#xA;# Define the Quantum and Classical Registers&#xA;q = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;&#xA;# Build the circuits&#xA;pre = QuantumCircuit(q, c)&#xA;pre.x(q)&#xA;pre.barrier()&#xA;meas = QuantumCircuit(q, c)&#xA;meas.measure(q, c)&#xA;circuits = []&#xA;exp_vector = range(1,61)&#xA;for exp_index in exp_vector:&#xA;    middle = QuantumCircuit(q, c)&#xA;    for i in range(45*exp_index):&#xA;        middle.iden(q)&#xA;    circuits.append(pre + middle + meas)&#xA;&#xA;# Execute the circuits&#xA;&#xA;&#xA;shots = 1024&#xA;job = execute(circuits, backend, shots=shots, max_credits=10)&#xA;result = job.result()&#xA;&#xA;# Plot the result&#xA;exp_data = []&#xA;exp_error = []&#xA;for exp_index in exp_vector:&#xA;    data = result.get_counts(circuits[exp_index-1])&#xA;    try:&#xA;        p0 = data['0']/shots&#xA;    except KeyError:&#xA;        p0 = 0&#xA;    exp_data.append(p0)&#xA;    exp_error.append(np.sqrt(p0*(1-p0)/shots))&#xA;&#xA;plt.errorbar(exp_vector, exp_data, exp_error)&#xA;plt.xlabel('time [45*gate time]')&#xA;plt.ylabel('Pr(0)')&#xA;plt.grid(True)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ecCnv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ecCnv.png&quot; alt=&quot;Outputed graph&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8056" LastActivityDate="2019-07-20T19:05:34.373" Title="Measuring the effect of energy relaxation with IBMQ Experience" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6797" PostTypeId="2" ParentId="2667" CreationDate="2019-07-16T22:40:52.590" Score="4" Body="&lt;p&gt;I just found this: &lt;a href=&quot;https://brilliant.org/courses/quantum-computing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://brilliant.org/courses/quantum-computing/&lt;/a&gt;, I just did the intro but the remaining is very promising.&#xA;&lt;br&gt;&#xA;&lt;br&gt; In the end of the description:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Our focus is learning how to exploit the laws of quantum mechanics in&#xA;  order to compute. By the end, you'll know your way around the world of&#xA;  quantum information, have experimented with the ins and outs of&#xA;  quantum circuits, and have written your first 100 lines of quantum&#xA;  code — while remaining blissfully ignorant about detailed quantum&#xA;  physics.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7961" LastActivityDate="2019-07-16T22:40:52.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6798" PostTypeId="2" ParentId="6776" CreationDate="2019-07-17T00:11:19.763" Score="0" Body="&lt;p&gt;As answered on slack, this is not currently possible. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-07-17T00:11:19.763" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6799" PostTypeId="1" AcceptedAnswerId="6801" CreationDate="2019-07-17T22:07:19.650" Score="5" ViewCount="188" Body="&lt;p&gt;Is the statement in the question correct?&#xA;I would love to receive an explanation as to why it is or isn't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a computer science degree background and I am a beginner learning the fundamental of QC from scratch.&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2019-07-18T12:46:20.040" Title="A quantum computer that doesn't use entangled qubits has the same computational power as a classical one?" Tags="&lt;classical-computing&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6800" PostTypeId="1" AcceptedAnswerId="6805" CreationDate="2019-07-18T06:38:31.243" Score="4" ViewCount="395" Body="&lt;p&gt;In a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, how do I calculate the largest number &lt;span class=&quot;math-container&quot;&gt;$N(\epsilon, d)$&lt;/span&gt; of vectors &lt;span class=&quot;math-container&quot;&gt;$\{V_i\}$&lt;/span&gt; which satisfies the following properties. Here &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is small but finite compared to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&amp;lt;V_i|V_i&amp;gt; = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|&amp;lt;V_i|V_j&amp;gt;| \leq \epsilon, i \neq j$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some examples are as follows. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N(0, d)$&lt;/span&gt; = d&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N\left(\frac{1}{2}, 2\right)$&lt;/span&gt; = 3, this can be seen by explicit construction of vectors using the Bloch sphere.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N\left(\frac{1}{\sqrt{2}}, 2\right) = 6$&lt;/span&gt;, again using the same logic.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How do I obtain any general formula for &lt;span class=&quot;math-container&quot;&gt;$N(\epsilon, d)$&lt;/span&gt;. Even an approximate form for &lt;span class=&quot;math-container&quot;&gt;$N(\epsilon, d)$&lt;/span&gt; in the large &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; limit works fine for me.&lt;/p&gt;&#xA;" OwnerUserId="2669" LastEditorUserId="55" LastEditDate="2020-08-18T08:43:12.953" LastActivityDate="2020-08-18T08:43:12.953" Title="Maximum number of &quot;almost orthogonal&quot; vectors one can embed in Hilbert space" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;mub&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6801" PostTypeId="2" ParentId="6799" CreationDate="2019-07-18T06:42:25.093" Score="3" Body="&lt;p&gt;Assuming you are talking about starting from a &lt;em&gt;pure&lt;/em&gt; state, your statement is true. There are two steps to the proof:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Show that a system without entanglement can implement any classical computation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Show that a system that remains separable can be simulated by a classical computation, proving that there are no calculations it can implement that a classical computer cannot.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The first is straightforward. Every classical computation can be written as a classical reversible computation. The Toffoli gate (controlled-controlled-not) is universal for classical reversible computation, so any circuit can be entirely decomposed in terms of that. But Quantum computers can implement the Toffoli gate, so they can implement any classical computation, and the state of the system at any intermediate point must be the same as in the classical computation, and therefore separable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second is also reasonably straightforward. If we know that every qubit remains separable, then we can hold in memory just the set of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubit states, comprising &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; 2-element normalised complex vectors (as compared to the general case of a single &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; element normalised complex vector). Whatever set of gates we use to describe the computation will act on some finite number of qubits, say &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; at maximum (independent of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;). So each computational step requires the action of a &lt;span class=&quot;math-container&quot;&gt;$2^k\times 2^k$&lt;/span&gt; matrix, which we just have to apply to the appropriate set of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; separable states. We extract the separable states at the end, and continue. The total simulation time is &lt;span class=&quot;math-container&quot;&gt;$O(NM)$&lt;/span&gt; for a sequence of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; gates on a classical computer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-18T06:42:25.093" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6802" PostTypeId="2" ParentId="6800" CreationDate="2019-07-18T07:36:50.333" Score="3" Body="&lt;p&gt;This seems like it should be a known mathematical property of Hilbert spaces, but I can't immediately lay my hand on any such result. In lieu of that, this is very far from an answer to your question, but it perhaps indicates the difficulty of (some of) what you're asking...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, perhaps we can clarify your problem statement. I assume you mean&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle V_i|V_j\rangle|\leq\epsilon,i\neq j?&#xA;$$&lt;/span&gt;&#xA;This would be consistent with your statement that &lt;span class=&quot;math-container&quot;&gt;$N(1/\sqrt{2},2)=6$&lt;/span&gt; because here you're be talking about the eigenvectors of the X,Y and Z Pauli operators. But Since you have both &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, for example, their overlaps are 0, not &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming this is the statement that you wanted...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is the concept of &lt;a href=&quot;https://en.wikipedia.org/wiki/Mutually_unbiased_bases&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mutually Unbiased Bases&lt;/a&gt;. Essentially, this is attempting to evaluate &lt;span class=&quot;math-container&quot;&gt;$N(1/\sqrt{d},d)$&lt;/span&gt;. (Strictly, it is a lower bound.) In the case that &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the power of a prime, then there are &lt;span class=&quot;math-container&quot;&gt;$d+1$&lt;/span&gt; mutually unbiased bases, meaning a set of &lt;span class=&quot;math-container&quot;&gt;$d(d+1)$&lt;/span&gt; vectors. However, if &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; cannot be written in this form, there are only bounds on the number of bases. For example, &lt;span class=&quot;math-container&quot;&gt;$d=6$&lt;/span&gt;, an answer is suspected but not known.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, this doesn't rule out the possibility of getting the sort of limits you're after, but suggests that exact evaluation for arbitrary parameter values might be problematic. That said, you might want to clarify what you mean by the small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; limit - you've already given the answer for &lt;span class=&quot;math-container&quot;&gt;$\epsilon=0$&lt;/span&gt;, so that must be the small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; limit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might be able to get some mileage out of &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/12/2/025009&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. It's related to mutually unbiased bases, but gives some other bounds as well which might be adapted to your purposes.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-18T07:36:50.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6803" PostTypeId="1" AcceptedAnswerId="7074" CreationDate="2019-07-18T08:13:29.817" Score="3" ViewCount="451" Body="&lt;p&gt;I currently need to implement efficiently a quantum comparator, with one of the values that is known at generation-time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, I am searching for a quantum routine &lt;code&gt;compare(n, rhs)&lt;/code&gt; that will produce a circuit taking as input &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a quantum register &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt; of size &lt;code&gt;n&lt;/code&gt; that should be interpreted as a unsigned integer.&lt;/li&gt;&#xA;&lt;li&gt;a single qubit initialised to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; that will store the result of &lt;span class=&quot;math-container&quot;&gt;$a &amp;lt; rhs$&lt;/span&gt; at the end of the routine.&lt;/li&gt;&#xA;&lt;li&gt;at most one ancilla qubit, and preferably no ancilla qubit at all.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There are a lot of quantum comparators in the wild (for example &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0410184.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/pdf/1712.02630.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0008033.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[3]&lt;/a&gt;) but all of them are designed to compare values stored in two quantum registers, not one value from a quantum register and the other known at compile time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to modify &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0410184.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt; in order to be able to remove the need for the quantum register &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt;, but I ended up proving it was not possible (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5632/1386&quot;&gt;my question&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if I have no rigorous proof, I think a similar argument applies to &lt;a href=&quot;https://arxiv.org/pdf/1712.02630.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;. My &quot;intuition&quot; comes from the fact that in &lt;a href=&quot;https://arxiv.org/pdf/1712.02630.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;, both &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; are used to store intermediate results, which is impossible if we remove one of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0008033.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[3]&lt;/a&gt; is relatively easy to adapt. The only operation involving &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; is a controlled-Phase, so we can easily &quot;remove&quot; the control and just apply a Phase gate when the corresponding bit of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; (known at generation-time) is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Draper's adder (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0008033.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[3]&lt;/a&gt;) is nice on multiple points:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;No ancilla qubit needed.&lt;/li&gt;&#xA;&lt;li&gt;Only QFT and phase gates, which should be easy to implement on hardware.&lt;/li&gt;&#xA;&lt;li&gt;A depth in &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But an ideal implementation would also:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;have a number of gates that grows in &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;. Draper's adder is &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; because of the QFT.&lt;/li&gt;&#xA;&lt;li&gt;have more room for optimisation with respect to the number of gates / depth (for example a very low cost when the constant is &lt;span class=&quot;math-container&quot;&gt;$\vert 00000\rangle$&lt;/span&gt; or has a lot of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;be based on a logic/arithmetic approach like &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0410184.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/pdf/1712.02630.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;. One of the problem with Draper's adder is that it requires very precise rotations angle, and it is hard to compute the error introduced if one of the rotations is only approximated and not exact.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; do you know any paper that introduce an algorithm that may interest me, based on the lists above?&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-08-22T20:21:03.997" Title="Quantum comparator with one fixed input" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6804" PostTypeId="1" CreationDate="2019-07-18T09:02:02.610" Score="3" ViewCount="55" Body="&lt;p&gt;I'm studing how Quantum Metropolis Algorithm (QMA) works and I think that I've understood it. Generally, the basic Metropolis step for a gave hamiltonian at the inverse temperature &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is: 1) it starts with a initial state, 2) it changes it with a local random &quot;kick operator&quot;, 3) it uses quantum phase estimation for evaluate the energy gap beetwen the initial state and the new state, 4) it applies a controlled rotation (based on the energy gap) to rotate an ancilla qubit prepared in a computational base state, 5) and finally it mesures this state to accept/reject the proposal new state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, I ask confirms wether this vague explanation is correct or not. Then I'll ask you the main question: in many articles on QMA, authors add to the general explanation of the Algorithm also a part where they use Quantum Simulated Annealing (QSA). I understand that this procedure is useful to switch from an initial state with high temperature to a state with lower, but I can't understand why this process is necessary: this &quot;temperature correction&quot; has not already done by the QMA previus described?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe QSA is only an explanation of why QMA actually works...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="8063" LastActivityDate="2019-07-18T09:02:02.610" Title="Quantum Metropolis Algotithm: why is Quantum Simulated Annealing necessary?" Tags="&lt;qma&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6805" PostTypeId="2" ParentId="6800" CreationDate="2019-07-18T09:24:39.227" Score="3" Body="&lt;p&gt;There is no general exact formula for &lt;span class=&quot;math-container&quot;&gt;$N(\epsilon, d)$&lt;/span&gt; and some special cases (for example &lt;a href=&quot;https://en.wikipedia.org/wiki/SIC-POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;SIC-POVM&lt;/a&gt;) is an area of active research. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However there is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Welch_bounds&quot; rel=&quot;nofollow noreferrer&quot;&gt;Welch bound&lt;/a&gt; that gives &lt;span class=&quot;math-container&quot;&gt;$\epsilon^2 \ge \frac{n-d}{d(n-1)}, n=N(\epsilon, d)$&lt;/span&gt; and hence bounds &lt;span class=&quot;math-container&quot;&gt;$N(\epsilon, d)$&lt;/span&gt; from above.  &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-07-18T09:24:39.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6806" PostTypeId="2" ParentId="6799" CreationDate="2019-07-18T12:46:20.040" Score="2" Body="&lt;p&gt;The linked question in the comments is akin to &quot;can we efficiently simulate a quantum computer &lt;em&gt;without entanglement&lt;/em&gt;?&quot;, while the question of the OP is more akin to &quot;if we handicap a quantum computer to not use entanglement, is such a quantum computer &lt;em&gt;equivalent to&lt;/em&gt; a classical computer?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;@DaftWullie's great answer already shows that such a weakened quantum computer is equivalent up to a polynomial overhead to a classical &quot;reversible&quot; computer.  That is, he mentions that the Toffoli (&lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt;) gate is universal for classical reversible computation, much as a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gate is for classical irreversible computation.  Because as we know &lt;em&gt;all&lt;/em&gt; quantum gates are reversible, the OP's question can also be framed as &quot;is reversible computation equivalent to irreversible computation?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gate can efficiently realize a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gate; a little though shows that a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gate can efficiently realize a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gate.  &lt;em&gt;However&lt;/em&gt; there is some non-trivial overhead in converting an algorithm that uses irreversible computation to one that uses reversible computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, this &lt;a href=&quot;https://www.quantamagazine.org/a-new-approach-to-multiplication-opens-the-door-to-better-quantum-computers-20190424/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quanta magazine article&lt;/a&gt; describes how classical irreversible computation can &lt;em&gt;recursively&lt;/em&gt; perform operations, whereas the requirement of quantum/reversible computation to not delete information has hampered many quantum algorithms' ability to do such recursion.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Quanta article describes a breakthrough by Craig Gidney of using &quot;tail call recursion&quot; in reversible computation, which as I understand it would be applicable to many recursive processes; however, there may still be a non-zero overhead in making such computations.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Furthermore, there are some non-trivial applications of physical qubits that do not seem to absolutely &lt;em&gt;require&lt;/em&gt; entanglement - these also don't have a counterpart in the classical world.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the &lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;nofollow noreferrer&quot;&gt;BB84&lt;/a&gt; quantum key distribution protocol does not require the two parties Alice and Bob to share any entanglement.  Wiesner's &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_money&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum money&lt;/a&gt;, from which BB84 was developed, also does not require such entanglement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These topics are usually introduced in lectures in quantum information/quantum computation before introduction of Deutsch-Josza, Shor, etc. because they have no classical counterpart, and also do not have &quot;spooky action at a distance&quot; - i.e., entanglement.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-07-18T12:46:20.040" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6807" PostTypeId="1" AcceptedAnswerId="6811" CreationDate="2019-07-18T14:49:22.767" Score="3" ViewCount="167" Body="&lt;p&gt;I have a problem with the conditional Hamiltonian. In &lt;a href=&quot;https://arxiv.org/pdf/0811.3171.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the original article&lt;/a&gt; on HHL (p.3) they wrote that applying the conditional Hamiltonian correspond to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{\tau=0}^{T-1}|\tau\rangle\langle\tau|\otimes e^{2i\pi A\frac{\tau}{T}}$$&lt;/span&gt;&lt;br /&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$T=2^t$&lt;/span&gt; the number of qubits in the clock register.&lt;/p&gt;&#xA;&lt;p&gt;And I saw an implementation in &lt;a href=&quot;https://arxiv.org/pdf/1804.03719.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; (p.50), for a 2 qubits register they apply 2 gates &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi A/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What I don't understand, is that it doesn't correspond to the sum above which have 4 terms, but to this one (I change the index of the sum):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{\tau=1}^{2^{t-1}}|\tau\rangle\langle\tau|\otimes e^{2i\pi A\frac{\tau}{2^t}}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Did I miss something ?&lt;/p&gt;&#xA;" OwnerUserId="7762" LastEditorUserId="1859" LastEditDate="2020-11-21T18:22:23.037" LastActivityDate="2020-11-21T18:22:23.037" Title="Apply the conditional Hamiltonian evolution (HHL)" Tags="&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6809" PostTypeId="1" AcceptedAnswerId="6810" CreationDate="2019-07-18T23:17:31.373" Score="5" ViewCount="183" Body="&lt;p&gt;I was looking back over an old assignment and I came across a question I wasn't quite sure how to do the problem statement is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard rotation is an element of the group &lt;span class=&quot;math-container&quot;&gt;$U(2)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i) Find the global phase with which one needs to multiply the Hadamard gate to obtain an operation that is an element of the group &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ii) propose the evolution operator that implements this operation, that is, propose the suitable Hamiltonian and the duration for which it needs to be turned on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For (i) I think the answer was either due to this statement &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U(2)$&lt;/span&gt; is the group of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; unitary matrices or operators. In contrast to the elements &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, the determinant of the elements of the group &lt;span class=&quot;math-container&quot;&gt;$u ∈ U(2)$&lt;/span&gt; is not ﬁxed to unity. Each element &lt;span class=&quot;math-container&quot;&gt;$u∈U(2)$&lt;/span&gt; can be expressed in terms of an element of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$u = e^{i\alpha}g$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$g \in SU(2).$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=\begin{pmatrix}\tfrac{1}{\sqrt{2}} &amp;amp;\tfrac{1}{\sqrt{2}}\\\tfrac{1}{\sqrt{2}} &amp;amp;\tfrac{1}{-\sqrt{2}} \end{pmatrix}$$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$=e^{i \pi/2}\begin{pmatrix}\tfrac{e^{-i\pi/2}}{\sqrt{2}} &amp;amp;\tfrac{e^{-i\pi/2}}{\sqrt{2}}\\\tfrac{e^{-i\pi/2}}{\sqrt{2}} &amp;amp;\tfrac{e^{-i\pi/2}}{-\sqrt{2}} \end{pmatrix}$$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$=e^{i\pi/2}(\cos(\pi/2)-i\sin(\pi/2)(\tfrac{\sigma_x+\sigma_z}{\sqrt{2}}))$$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$=e^{\pi i /2}e^{-\pi i (\tfrac{\sigma_x+\sigma_z}{\sqrt{2}})/2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The right hand side is now being expressed as an element of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;. However given the following statement, Considering the determinant of the product of two n-by-n matrices &lt;span class=&quot;math-container&quot;&gt;$A and B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\det(AB) = \det A \det B$&lt;/span&gt;, and the determinant &lt;span class=&quot;math-container&quot;&gt;$\det(e^\alpha I )= e^{i2α}$&lt;/span&gt; we obtain the map from the elements of &lt;span class=&quot;math-container&quot;&gt;$U(2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$g=\tfrac{u}{\sqrt{\det(u)}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps it actually looking for that transformation instead &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for (ii) I know that &lt;span class=&quot;math-container&quot;&gt;$$U=e^{\tfrac{-i}{\hbar} \hat{H}t}.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and that we can use the Pauli operators to form our Hamiltonian, I know how to do it for the nontrivial term that would appear if we transformed as we did in (i) but I'm not sure how to do it for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="26" LastEditDate="2019-09-30T03:59:24.850" LastActivityDate="2019-09-30T03:59:24.850" Title="Finding a global phase that transform the Hadamard gate to an element of $SU(2)$ and propose an evoultion operator which implents the operation" Tags="&lt;mathematics&gt;&lt;unitarity&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6810" PostTypeId="2" ParentId="6809" CreationDate="2019-07-19T01:05:39.133" Score="4" Body="&lt;p&gt;You did more than you needed to in part i. You effectively did part ii already.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;g = \frac{u}{\sqrt{\det{u}}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is in &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, the phase you need to multiply by is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{\det{u}}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\det H = -1/2-1/2 = -1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to get in &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, you need to multiply &lt;span class=&quot;math-container&quot;&gt;$\sqrt{-1}=\pm i$&lt;/span&gt;. That is seen as the &lt;span class=&quot;math-container&quot;&gt;$e^{\pi i /2}$&lt;/span&gt; you see as the prefactor in the way you did it. You can use either &lt;span class=&quot;math-container&quot;&gt;$e^{\pm \pi i/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For ii, you can drop the prefactor and only consider&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \propto e^{-\pi i \frac{\sigma_x+\sigma_z}{2\sqrt{2}}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can match that exponent with &lt;span class=&quot;math-container&quot;&gt;$\frac{-it}{\hbar} H$&lt;/span&gt; in order to suggest &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-\pi i \frac{\sigma_x+\sigma_z}{2\sqrt{2}} = \frac{-it}{\hbar} H\\&#xA;\pi \frac{\sigma_x+\sigma_z}{2\sqrt{2}} = \frac{t}{\hbar} H\\&#xA;t H = \frac{\pi}{\sqrt{2}} (\frac{\hbar}{2} \sigma_x+\frac{\hbar}{2} \sigma_z)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can use &lt;span class=&quot;math-container&quot;&gt;$t=\frac{\pi}{\sqrt{2}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H=(\frac{\hbar}{2} \sigma_x+\frac{\hbar}{2} \sigma_z)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason for putting the Hamiltonian with &lt;span class=&quot;math-container&quot;&gt;$\frac{\hbar}{2} \sigma$&lt;/span&gt; terms is because this is the spin operator&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec{S} = \frac{\hbar}{2} \vec{\sigma}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course you could replace &lt;span class=&quot;math-container&quot;&gt;$t \to \lambda t$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H \to \frac{1}{\lambda} H$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, but if you do it with very small &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; like &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt;, then you will get unreasonably short time-scales for applying the evolution. You're not going to have precision control to only apply a signal for &lt;span class=&quot;math-container&quot;&gt;$10^{-30}$&lt;/span&gt; seconds.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-07-19T01:05:39.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6811" PostTypeId="2" ParentId="6807" CreationDate="2019-07-19T09:56:05.200" Score="4" Body="&lt;p&gt;Be careful! They don't apply &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi A/2}$&lt;/span&gt;. They apply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 0|\otimes I\otimes I+|1\rangle\langle 1| \otimes I\otimes e^{i\pi A}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I\otimes |0\rangle\langle 0|\otimes I+I\otimes |1\rangle\langle 1|\otimes e^{i\pi A/2},&#xA;$$&lt;/span&gt;&#xA;i.e. controlled versions of the gates, controlled off two different qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, consider the 4 possible values of the first two registers: &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. On the third register, these give you respectively, &lt;span class=&quot;math-container&quot;&gt;$I,e^{i\pi A/2},e^{i\pi A},e^{i3\pi A/2}$&lt;/span&gt;, as required.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-19T09:56:05.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6812" PostTypeId="1" CreationDate="2019-07-19T17:59:55.740" Score="3" ViewCount="135" Body="&lt;p&gt;Very often in the standard textbooks on quantum mechanics, one finds that the joint Hilbert space of two systems is given by the tensor product of the individual  Hilbert spaces. That is, if &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; are the Hilbert spaces associated with systems &lt;span class=&quot;math-container&quot;&gt;$S_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_2$&lt;/span&gt;, then the composite Hilbert space of the entire system is given by &lt;span class=&quot;math-container&quot;&gt;$H_{1} \otimes H_{2}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; is the tensor product as defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textbf{My question:}$&lt;/span&gt; Under what conditions can a direct sum of two Hamiltonians, &lt;span class=&quot;math-container&quot;&gt;$H_1 \oplus H_2$&lt;/span&gt;, be used to represent the  Hamiltonian in composite Hilbert space for the entire system?&lt;/p&gt;&#xA;" OwnerUserId="5806" LastEditorUserId="5806" LastEditDate="2019-07-21T05:48:44.773" LastActivityDate="2019-11-08T11:29:06.650" Title="Which representation describes the composite Hilbert space?" Tags="&lt;hamiltonian-simulation&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6813" PostTypeId="1" CreationDate="2019-07-20T00:00:36.423" Score="1" ViewCount="97" Body="&lt;p&gt;To find operation elements for the Amplitude Damping channel, Nielsen and Chuang (in Section 8.3.5 of my copy) use the action of a beamsplitter on an initial state &lt;span class=&quot;math-container&quot;&gt;$ \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;. The output of the beamsplitter is &lt;span class=&quot;math-container&quot;&gt;$\alpha|0_E0\rangle + \beta \cos\theta |0_E1\rangle + \beta \sin\theta|1_E0\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; denotes environment. They say after tracing out the environment we get &lt;span class=&quot;math-container&quot;&gt;$E_0\rho E_0^\dagger  + E_1\rho E_1^\dagger$&lt;/span&gt; where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_0 =\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-\gamma}\end{pmatrix}$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_1 =\begin{pmatrix} 0 &amp;amp; \sqrt{\gamma} \\ 0 &amp;amp; 0\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\gamma = \sin^2\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}tr_E(\rho^\prime) &amp;amp;= tr_E(\alpha^2|0_E\rangle \langle0_E|\otimes|0\rangle \langle0| + \beta^2 \cos^2\theta |0_E\rangle \langle0_E|\otimes|1\rangle \langle1| + \beta^2 \sin^2\theta|1_E\rangle \langle1_E|\otimes|0\rangle \langle0|) \\&amp;amp;= \alpha^2|0\rangle \langle0| + \beta^2 \cos^2\theta|1\rangle \langle1| + \beta^2 \sin^2\theta|0\rangle \langle0|\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach I tried:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle0_E|B|0_E\rangle = \alpha|0\rangle + \beta \cos\theta|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho^\prime = \alpha^2|0\rangle \langle0| + \beta^2 \cos^2\theta|1\rangle \langle1|$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and  &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 \\0 &amp;amp; \sqrt{1-\gamma}\end{pmatrix}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt;; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle1_E|B|0_E\rangle = \beta \sin\theta|0\rangle$&lt;/span&gt; with &#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho^\prime = \beta^2 \sin^2\theta|0\rangle \langle0|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_1 \rho E_1^\dagger= \begin{pmatrix}\beta^2\gamma &amp;amp; 0 \\0 &amp;amp; 0\end{pmatrix} = \begin{pmatrix}0 &amp;amp; \sqrt{\gamma} \\ 0 &amp;amp; 0 \end{pmatrix} \rho \begin{pmatrix}0 &amp;amp; 0 \\ \sqrt{\gamma} &amp;amp; 0 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I correct? If not, where am I wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a picture of the page for your reference:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uMTE5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uMTE5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7805" LastEditorUserId="23" LastEditDate="2019-07-20T11:45:18.820" LastActivityDate="2019-07-20T11:45:18.820" Title="Operation Elements for Amplitude Damping Channel" Tags="&lt;nielsen-and-chuang&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6814" PostTypeId="2" ParentId="6796" CreationDate="2019-07-20T11:44:52.487" Score="0" Body="&lt;p&gt;You may want to try this tutorial: &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/ignis/relaxation_and_decoherence.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/ignis/relaxation_and_decoherence.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-07-20T11:44:52.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6815" PostTypeId="2" ParentId="6733" CreationDate="2019-07-20T16:39:49.290" Score="5" Body="&lt;p&gt;It might be worth mentioning the physical motivation for these definitions and the concept of fidelity itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unlike the classical computers we all know and love, quantum computers are fundamentally analog machines. what that means practically is that the gates you apply when you run code on a real quantum computer are going to be parameterized by a real variable. For example, in superconducting qubits, applying a single-qubit gate means driving your qubit with a (typically microwave-range) pulse from an arbitrary waveform generator. The amplitude, frequency, and time-duration of that pulse are all real-valued parameters, and as such they're all subject to some amount of error. These so-called 'unitary' errors are a separate issue from the errors that result from your qubit interacting with the environment. You've applied a real quantum gate, and prepared a real, coherent quantum state, but neither the gate nor the state are ever going to be exactly the ones you intended. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's where measures of fidelity come in, as a way of keeping track of just how close you can expect to come on your actual, physical quantum computer to the circuits you are producing in code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a way, fidelity forms the essential link between the neat digital niceties of your high level implementation and the messy realities of the quantum hardware itself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That, at least, is how I understand it. I'd welcome any corrections.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following video gives some more specific examples of the same idea &lt;a href=&quot;https://www.youtube.com/watch?v=MtD1Z8MMrgY&quot; rel=&quot;noreferrer&quot;&gt;https://www.youtube.com/watch?v=MtD1Z8MMrgY&lt;/a&gt;, while this &lt;a href=&quot;https://entangledphysics.com/2019/06/24/quantum-fidelity-or-how-to-compare-quantum-states/&quot; rel=&quot;noreferrer&quot;&gt;article&lt;/a&gt; gives a pretty friendly, historically motivated explanation of the math involved.  &lt;/p&gt;&#xA;" OwnerUserId="8081" LastActivityDate="2019-07-20T16:39:49.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6816" PostTypeId="1" CreationDate="2019-07-20T17:40:52.143" Score="5" ViewCount="53" Body="&lt;p&gt;Does anyone know the solution of Exercise 6.14 of Nielsen and Cheung:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Prove that any classical counting algorithm with a probability at least&#xA;  3/4 for estimating &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; correctly to within an accuracy &lt;span class=&quot;math-container&quot;&gt;$c \sqrt{M}$&lt;/span&gt; for some constant &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;&#xA;  and for all values of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; must make &lt;span class=&quot;math-container&quot;&gt;$\Omega(N)$&lt;/span&gt; oracle calls.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The same result is also stated in Mosca's phd thesis in Table 2.5 but with no references where this is proved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mosca's phd thesis cites &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Ran Canetti, Guy Even, and Oded Goldreich. Lower bounds for sampling algorithms for estimating the average. Information Processing Letters, 1995.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Goldreich, Oded. &quot;A sample of samplers: A computational perspective on sampling.&quot; Studies in Complexity and Cryptography. Miscellanea on the Interplay between Randomness and Computation. Springer, Berlin, Heidelberg, 2011. 302-332.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but from those I see a complexity of &lt;span class=&quot;math-container&quot;&gt;$\Omega(M)$&lt;/span&gt; not &lt;span class=&quot;math-container&quot;&gt;$\Omega(N)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7318" LastEditorUserId="7318" LastEditDate="2019-07-20T17:58:26.580" LastActivityDate="2019-07-20T17:58:26.580" Title="complexity of classical counting algorithm" Tags="&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6817" PostTypeId="2" ParentId="6796" CreationDate="2019-07-20T19:05:34.373" Score="1" Body="&lt;p&gt;The devices are imperfect and also are periodically recalibrated. Any textual examples characterizing decoherence will probably &lt;em&gt;never&lt;/em&gt; match exactly what you encounter in running the same code live.&lt;/p&gt;&#xA;" OwnerUserId="7744" LastActivityDate="2019-07-20T19:05:34.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6818" PostTypeId="1" CreationDate="2019-07-20T19:13:15.657" Score="3" ViewCount="91" Body="&lt;p&gt;This question refers principally to the &lt;a href=&quot;https://arxiv.org/abs/1602.07674&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; where for a low-depth circuit QAOA, the output cannot be efficiently simulated classically. I am wondering how this kind of quantum supremacy matters for optimization. Any insights would be interesting here.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="55" LastEditDate="2019-09-28T19:15:51.980" LastActivityDate="2019-09-28T19:15:51.980" Title="How does the fact that the output of a quantum circuit cannot be efficiently simulated classically help for optimisation?" Tags="&lt;algorithm&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6819" PostTypeId="1" CreationDate="2019-07-21T05:12:01.383" Score="-1" ViewCount="268" Body="&lt;p&gt;I recently made a quantum circuit that uses 32 qubits and try to run it on &#xA;IBM Q Experience &lt;em&gt;qasm_simulator&lt;/em&gt; backend. But it always ends with &lt;code&gt;ERROR_RUNNING_JOB&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i retrieve the job and display the error, i only got &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;The following experiments failed:\n&quot;&#xA;  without any details.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How i can get more information about the error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is my qiskit version information:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'qiskit': None, 'qiskit-terra': '0.8.0', 'qiskit-ignis': '0.1.1', 'qiskit-aer': '0.2.0', 'qiskit-ibmq-provider': '0.2.2', 'qiskit-aqua': '0.5.2'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;According to @Bram suggestion i run &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$ pip install qiskit&#xA;Building wheels for collected packages: qiskit, qiskit-ibmq-provider&#xA;  Building wheel for qiskit (setup.py) ... error&#xA;  Complete output from command /home/userName/anaconda3/envs/quantum/bin/python -u -c &quot;import setuptools, tokenize;__file__='/tmp/pip-install-kavivdyx/qiskit/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))&quot; bdist_wheel -d /tmp/pip-wheel-eak_06_d --python-tag cp37:&#xA;  running bdist_wheel&#xA;&#xA;  ----------------------------------------&#xA;  Failed building wheel for qiskit&#xA;  Running setup.py clean for qiskit&#xA;  Building wheel for qiskit-ibmq-provider (setup.py) ... done&#xA;  Stored in directory: /home/userName/.cache/pip/wheels/0c/56/e7/b07b4d2f19fd4c5fff7fe334c72eb313fecf04fa693a7c558e&#xA;Successfully built qiskit-ibmq-provider&#xA;Failed to build qiskit&#xA;Installing collected packages: qiskit-terra, qiskit-aer, nest-asyncio, qiskit-ibmq-provider, pyscf, qiskit-chemistry, qiskit, more-itertools&#xA;  Found existing installation: qiskit-terra 0.8.0&#xA;    Uninstalling qiskit-terra-0.8.0:&#xA;      Successfully uninstalled qiskit-terra-0.8.0&#xA;  Found existing installation: qiskit-aer 0.2.0&#xA;    Uninstalling qiskit-aer-0.2.0:&#xA;      Successfully uninstalled qiskit-aer-0.2.0&#xA;  Found existing installation: qiskit-ibmq-provider 0.2.2&#xA;    Uninstalling qiskit-ibmq-provider-0.2.2:&#xA;      Successfully uninstalled qiskit-ibmq-provider-0.2.2&#xA;  Running setup.py install for qiskit ... done&#xA;  Found existing installation: more-itertools 6.0.0&#xA;    Uninstalling more-itertools-6.0.0:&#xA;      Successfully uninstalled more-itertools-6.0.0&#xA;Successfully installed more-itertools-5.0.0 nest-asyncio-1.0.0 pyscf-1.6.2 qiskit-0.11.0 qiskit-aer-0.2.3 qiskit-chemistry-0.5.0 qiskit-ibmq-provider-0.3.0 qiskit-terra-0.8.2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From this output i notice that &lt;code&gt;wheel&lt;/code&gt; was failed in build, does that cause any problems? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then run &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$conda list | grep qiskit&#xA;qiskit                    0.11.0                   pypi_0    pypi&#xA;qiskit-aer                0.2.3                    pypi_0    pypi&#xA;qiskit-aqua               0.5.2                    pypi_0    pypi&#xA;qiskit-chemistry          0.5.0                    pypi_0    pypi&#xA;qiskit-ibmq-provider      0.3.0                    pypi_0    pypi&#xA;qiskit-ignis              0.1.1                    pypi_0    pypi&#xA;qiskit-terra              0.8.2                    pypi_0    pypi&#xA;enter preformatted text here&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and run the following in IPython console &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;import qiskit&#xA;&amp;gt;&amp;gt;qiskit.__qiskit_version__&#xA;Out[2]: &#xA;{'qiskit': '0.11.0',&#xA; 'qiskit-terra': '0.8.2',&#xA; 'qiskit-ignis': '0.1.1',&#xA; 'qiskit-aer': '0.2.3',&#xA; 'qiskit-ibmq-provider': '0.3.0',&#xA; 'qiskit-aqua': '0.5.2'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i will send another job and wait for the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &#xA;The same error , ERROR_RUNNING_JOB, still occur, appear after the above update.&lt;/p&gt;&#xA;" OwnerUserId="8084" LastEditorUserId="55" LastEditDate="2020-08-15T06:43:34.720" LastActivityDate="2020-09-14T07:01:30.150" Title="ERROR_RUNNING_JOB with 32 qubit circuit running on ibmq_qasm_simulator backend" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6820" PostTypeId="2" ParentId="6812" CreationDate="2019-07-21T06:06:17.393" Score="0" Body="&lt;p&gt;What you are modelling when you use a tensor product is a space that can accommodate &lt;em&gt;tuples&lt;/em&gt; of basis states of different kinds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say you want to describe a three-level system. You can use a three-dimensional Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt; to accommodate the possible states of this system.&#xA;But what if you have &lt;em&gt;two&lt;/em&gt; three-level systems, each one of which can be in one of its three available states? In this case you have &lt;em&gt;nine&lt;/em&gt; possible basis states (&lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$02$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$21$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$22$&lt;/span&gt;), and thus need a nine-dimensional Hilbert space. As it happens, &lt;span class=&quot;math-container&quot;&gt;$\mathcal H\otimes\mathcal H$&lt;/span&gt; has just the right dimensions (you &lt;em&gt;could&lt;/em&gt; also use any other nine-dimensional Hilbert space, only it would make the notation more awkward when dealing with local operations).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, &lt;span class=&quot;math-container&quot;&gt;$\mathcal H\oplus\mathcal  H$&lt;/span&gt; is a six-dimensional space, with basis the union of the bases of the two copies of &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt; (see also &lt;a href=&quot;https://math.stackexchange.com/questions/1592074/direct-sum-and-basis-for-a-vector-space&quot;&gt;this post over at math.SE&lt;/a&gt;). You could write this basis as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{|0\rangle,|1\rangle,|2\rangle,|0'\rangle,|1'\rangle,|2'\rangle\},$$&lt;/span&gt;&#xA;denoting with &lt;span class=&quot;math-container&quot;&gt;$|i'\rangle$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th basis element of the second copy of &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, this does not describe a system that is obtained by combining multiple elementary systems. Rather, it can be used to describe how a high-dimensional system is &quot;composed&quot; of smaller-dimensional ones.&#xA;Indeed, one can always think of an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional Hilbert space as the direct sum of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; copies of one-dimensional spaces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The direct sum is, therefore, what you always do &quot;under the hood&quot; when you build up higher dimensional spaces from lower dimensional ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar reasoning applies to Hamiltonians or other operators. As an example, if you have a five-dimensional space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt;, and two operators &lt;span class=&quot;math-container&quot;&gt;$A_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_2$&lt;/span&gt; operating on three- and two-dimensional systems, respectively, then &lt;span class=&quot;math-container&quot;&gt;$A_1\oplus A_2$&lt;/span&gt; is a valid operator acting on states in &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt;. This represents an operation which does not correlate the first three and the last two modes (because of the block structure of &lt;span class=&quot;math-container&quot;&gt;$A_1\oplus A_2$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-08T11:29:06.650" LastActivityDate="2019-11-08T11:29:06.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6821" PostTypeId="1" AcceptedAnswerId="6825" CreationDate="2019-07-21T09:40:25.070" Score="4" ViewCount="294" Body="&lt;p&gt;The Hibert Schmidt norm &lt;span class=&quot;math-container&quot;&gt;$\mathrm {tr}(A^{\dagger}B)$&lt;/span&gt; works well for unitaries.&#xA;It has a value of one when the matrices are equal and less than one otherwise. But this norm is absolutely unsuitable for non-unitary matrices.&#xA;I thought maybe &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathrm{tr}(A^{\dagger}B)}{\sqrt{\mathrm{tr}(A^{\dagger}A)} \sqrt{\mathrm{tr}(B^{\dagger}B)}}$&lt;/span&gt; would be a good idea?&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="26" LastEditDate="2020-01-06T16:37:03.490" LastActivityDate="2020-03-09T10:10:43.470" Title="What would be an ideal fidelity measure to determine the closeness between two non unitary matrices?" Tags="&lt;fidelity&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6822" PostTypeId="5" CreationDate="2019-07-21T10:07:58.257" Score="0" Body="&lt;p&gt;Single qubit Hadamard gate transforms &lt;span class=&quot;math-container&quot;&gt;$\mid 0\rangle$&lt;/span&gt; state to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle=\frac{\mid 0\rangle + \mid 1\rangle}{\sqrt{2}}$&lt;/span&gt; state and &lt;span class=&quot;math-container&quot;&gt;$\mid 1\rangle$&lt;/span&gt; state to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle=\frac{\mid 0\rangle - \mid 1\rangle} {\sqrt{2}}$&lt;/span&gt; state and so, in matrix form, can be written as &lt;span class=&quot;math-container&quot;&gt;$$H = |+\rangle\langle 0|+|-\rangle\langle 1|= \frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;1 \\\ 1&amp;amp;-1\end{pmatrix}$$&lt;/span&gt;.&lt;a href=&quot;https://i.stack.imgur.com/MlVwz.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MlVwz.jpg&quot; alt=&quot;curcuit symbol for Hadamard gate&quot;&gt;&lt;/a&gt; taken from &lt;a href=&quot;https://www.kisspng.com/png-quantum-logic-gate-hadamard-matrix-hadamard-transf-4947412/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.kisspng.com/png-quantum-logic-gate-hadamard-matrix-hadamard-transf-4947412/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Hadamard gate can then be written as &lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n} = H\otimes H^{\otimes \left(n-1\right)}$$&lt;/span&gt; and is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; individual Hadamard gates acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; different qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info, one can visit &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard matrix&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_transform#Hadamard_gate_operations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard transform&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="2105" LastEditDate="2020-01-19T07:33:18.913" LastActivityDate="2020-01-19T07:33:18.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6823" PostTypeId="4" CreationDate="2019-07-21T10:07:58.257" Score="0" Body="Single qubit Hadamard gate transforms standard basis states (zero and one states) to their superpositions (plus and minus states)" OwnerUserId="462" LastEditorUserId="2105" LastEditDate="2020-01-19T07:31:55.760" LastActivityDate="2020-01-19T07:31:55.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6824" PostTypeId="2" ParentId="6818" CreationDate="2019-07-21T11:29:25.253" Score="2" Body="&lt;p&gt;In the article you mentioned it is said that classical algorithms can beat some cases of (quantum ) QAOA's as is proved in this &lt;a href=&quot;https://arxiv.org/abs/1505.03424&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;. So finding cases where quantum QAOA can still beat classical algorithms and can run on NISQ devices with low depth circuits is still exciting and promissing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The article uses plausible conjectures from complexity theory to show that there are choices of γ, β and cost function C for which the output of a quantum computer running the (p = 1) QAOA could not be mimicked with a classical device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum supremacy is not necessary for optimization problems but can it make more worthwhile. In a &lt;a href=&quot;https://www.nature.com/articles/s41598-019-43176-9.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent paper&lt;/a&gt; it is shown that you really can find quantum speedup using a few hundreds of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the mean time you can try solving optimization problems with Qiskit or pyQuil with some max-cut examples on my &lt;a href=&quot;https://github.com/BramDo/VQE-quantum-algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;github.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1773" LastEditDate="2019-07-21T13:25:24.803" LastActivityDate="2019-07-21T13:25:24.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6825" PostTypeId="2" ParentId="6821" CreationDate="2019-07-21T12:41:22.417" Score="7" Body="&lt;p&gt;When you ask about an 'ideal' fidelity measure, it assumes that there is one measure which inherently is the most meaningful or truest measure. But this isn't really the case.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For unitary operators, our analysis of the error used in approximating one unitary by another involves the distance induced by the &lt;strong&gt;operator norm&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$$ \bigl\lVert U - V \bigr\rVert_\infty := \max_{\substack{\lvert \psi\rangle \ne \mathbf 0}} \frac{\bigl \lVert (U - V) \lvert \psi \rangle \bigr\rVert_2}{\bigl \lVert \lvert \psi \rangle \bigr\rVert_2} $$&lt;/span&gt; That is, it is the greatest factor by which the Euclidean norm (or 2-norm) of a vector will be increased by the action of &lt;span class=&quot;math-container&quot;&gt;$(U - V)$&lt;/span&gt;: if the two operators are very nearly equal, this factor will be very small. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know you asked for norms on non-unitary matrices, but if a norm is useful for non-unitary matrices, you might hope that it would &lt;em&gt;also&lt;/em&gt; be useful for unitary matrices, and the point here is that the 'operator norm' is. It is also useful for (non-unitary) observables: for two Hermitian operators &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; &amp;mdash; representing evolution Hamiltonians, for instance, or measurement projectors &amp;mdash; the operator norm &lt;span class=&quot;math-container&quot;&gt;$\lVert E - F \rVert$&lt;/span&gt; conveys how similar &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; are in a way which directly relates to how easily you can operationally distinguish one from the other.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;On the other hand, for density operators &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, the best distance measure to describe how easily you can distinguish them is the &lt;strong&gt;trace norm&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$$\bigl\lVert \rho - \sigma \bigr\rVert_{\mathrm{tr}} := \mathrm{tr} \Bigl( \sqrt{(\rho - \sigma) ^2} \Bigr)$$&lt;/span&gt; which is the same as (in fact, it's just a fancy way of writing) the sum of the absolute values of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$(\rho - \sigma) $&lt;/span&gt;: if the two operators are very nearly equal, this sum will be very small. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, which norm you want to use to describe distances on operators, depends on what those operators are and what you would like to say about them. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="23" LastEditDate="2019-07-21T12:50:41.517" LastActivityDate="2019-07-21T12:50:41.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6826" PostTypeId="2" ParentId="6819" CreationDate="2019-07-21T13:41:31.457" Score="0" Body="&lt;p&gt;You're qiskit information shows 'qiskit': None. This should be 0.11 or smaller. Furthermore qiskit-ibmq-provider : 0.2.2 should be 0.3 for the latest version.&lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2019-07-21T13:41:31.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6828" PostTypeId="1" AcceptedAnswerId="6834" CreationDate="2019-07-21T16:54:03.077" Score="2" ViewCount="427" Body="&lt;p&gt;Exercise 8.21 of Nielsen and Chuang asks us to show that the operation elements for a harmonic oscillator (system) coupled to another harmonic oscillator (environment) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_k = \sum_n \sqrt{(^n_k)}\sqrt{(1-\gamma)^{n-k}\gamma^k} |n-k\rangle\langle n|$&lt;/span&gt;        (1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\gamma = 1- cos^2(\chi\Delta t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hamiltonian is &lt;span class=&quot;math-container&quot;&gt;$H = \chi(a^\dagger b+b^\dagger a)$&lt;/span&gt;   (2)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; should be found using &lt;span class=&quot;math-container&quot;&gt;$E_k = \langle k_b|U|0_b\rangle$&lt;/span&gt; where subscript b denotes environment, and &lt;span class=&quot;math-container&quot;&gt;$U = e^{-iH\Delta t}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question has been asked &lt;a href=&quot;https://physics.stackexchange.com/questions/489384/kraus-operators-for-two-interacting-harmonic-oscillators-problem-with-the-calcu&quot;&gt;here&lt;/a&gt; but has not been answered. The steps that I know:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;span class=&quot;math-container&quot;&gt;$\langle k_b| = \langle 0_b| \frac{b^k}{\sqrt{k!}}$&lt;/span&gt;   (3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E_k = \langle k_b|e^{-i\chi(a^\dagger b+b^\dagger a)\Delta t}|0_b\rangle = \langle 0_b|\frac{b^k}{\sqrt{k!}}  e^{-i\chi(a^\dagger b+b^\dagger a)\Delta t}|0_b\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \langle 0_b|\frac{b^k}{\sqrt{k!}} \sum_n \frac{[-i\chi \Delta t(a^\dagger b+b^\dagger a)]^n}{n!} |0_b\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \langle 0_b| \sum_n \sum_{k=0}^n \frac{b^k}{\sqrt{k!}}\frac{[-i\chi \Delta t(a^\dagger b+b^\dagger a)]^{n-k} [-i\chi \Delta t(a^\dagger b+b^\dagger a)]^k}{n!} |0_b\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \langle 0_b| \sum_n \sum_{k=0}^n \frac{1}{\sqrt{k!}}\frac{[-i\chi \Delta t(a^\dagger b+b^\dagger a)]^{n-k} [-i\chi \Delta t(a^\dagger b^2+bb^\dagger a)]^k}{n!} |0_b\rangle$&lt;/span&gt;     (4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Considering &lt;span class=&quot;math-container&quot;&gt;$b|0_b\rangle = 0$&lt;/span&gt;  the above becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \langle 0_b| \sum_n \sum_{k=0}^n \frac{1}{\sqrt{k!}}\frac{[-i\chi \Delta t(b^\dagger a)]^{n-k} [-i\chi \Delta t(bb^\dagger a)]^k}{n!} |0_b\rangle$&lt;/span&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;span class=&quot;math-container&quot;&gt;$[b,b^\dagger] = bb^\dagger - b^\dagger b = 1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$bb^\dagger = 1+ b^\dagger b$&lt;/span&gt; the above becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \langle 0_b| \sum_n \sum_{k=0}^n \frac{1}{\sqrt{k!}}\frac{[-i\chi \Delta t(b^\dagger a)]^{n-k} [-i\chi \Delta ta]^k}{n!} |0_b\rangle$&lt;/span&gt;   (5)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Binomial expansion is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(A + B)^n = \sum_{k=0}^n (^n_k) A^{n-k}B^k$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make notation simpler, setting &lt;span class=&quot;math-container&quot;&gt;$A = -i\chi \Delta t(b^\dagger a)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B = -i\chi \Delta ta$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(5) becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle 0_b| \frac{1}{\sqrt{k!}}\sum_n \frac{1}{n!(^n_k)} (A+B)^n |0_b\rangle$&lt;/span&gt;   (6).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple calculation gives &lt;span class=&quot;math-container&quot;&gt;$A+B = (-i\chi \Delta t)^n (b^\dagger +1)^n a^n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So (6) is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle 0_b| \frac{1}{\sqrt{k!}}\sum_n \frac{1}{n!(^n_k)} [(-i\chi \Delta t) (b^\dagger +1) a]^n |0_b\rangle$&lt;/span&gt;     (7)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point we should trace out the environment/b terms. I understand that we can write (7) as an exponential again, and get sines and cosine terms; but they will not be squared, as required by (1). I'd appreciate any help with this. Thanks. &lt;/p&gt;&#xA;" OwnerUserId="7805" LastEditorUserId="7805" LastEditDate="2019-07-21T23:26:28.333" LastActivityDate="2021-04-11T14:34:08.027" Title="Amplitude Damping of a Harmonic Oscillator" Tags="&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6829" PostTypeId="2" ParentId="6812" CreationDate="2019-07-21T19:14:42.720" Score="1" Body="&lt;p&gt;@glS gave a fine answer, but given who is asking, would be remiss to not answer with some functoriality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In section 4 of Twisted Equivariant Matter, the Dirac-Nambu space is defined. For a free fermion Hilbert space based on &lt;span class=&quot;math-container&quot;&gt;$(\mathcal{M},b)$&lt;/span&gt; with a symmetry &lt;span class=&quot;math-container&quot;&gt;$(G,\phi)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; encodes anti-linearity. Take &lt;span class=&quot;math-container&quot;&gt;$G=e$&lt;/span&gt; if you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{DN} \equiv \mathcal{M} \otimes \mathbb{C}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A choice of complex structure on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; gives a Hermitian structure on &lt;span class=&quot;math-container&quot;&gt;$H_{DN}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the particle-hole picture &lt;span class=&quot;math-container&quot;&gt;$H_{DN} = V \bigoplus \bar{V}$&lt;/span&gt; is the 1-particle and 1-hole.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amalgam of two systems is then the direct sum &lt;span class=&quot;math-container&quot;&gt;$H_{DN,1} \bigoplus H_{DN,2}$&lt;/span&gt;. This is easily visualized as one-particle or one-hole of different types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fock: On objects, send a vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\bigoplus_{i=0}^n \Lambda^i V$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$\Lambda (V \bigoplus W) \simeq \Lambda (V) \otimes \Lambda (W)$&lt;/span&gt;. This is because above was talking about free fermions, so that's why alternating not &lt;span class=&quot;math-container&quot;&gt;$Sym$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think as combine the systems as usual by tensor product, but when you apply the functor that gets you back to 1-particle/hole, you are picking out degree one summand which has a direct sum instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also like &lt;a href=&quot;http://math.ucr.edu/home/baez/photon/tensor.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://math.ucr.edu/home/baez/photon/tensor.htm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-07-21T19:14:42.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6830" PostTypeId="1" AcceptedAnswerId="6833" CreationDate="2019-07-21T21:46:30.077" Score="2" ViewCount="36" Body="&lt;p&gt;In the paper, &lt;em&gt;Quantum linear systems algorithms: a primer,&lt;/em&gt; available &lt;a href=&quot;https://arxiv.org/abs/1802.08227&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; page 23, the authors discuss encoding a vector in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R^n}$&lt;/span&gt; into qRAM. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$x \in \mathbb{R}^n$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$|x \rangle := ||x||_2^{-1}\sum_{i=1}^{n}x_i |i\rangle$&lt;/span&gt; be a quantum state on &lt;span class=&quot;math-container&quot;&gt;$\lceil logn \rceil$&lt;/span&gt; qubits. We would like to have an operation &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; that takes some finite precision representation of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, denoted &lt;span class=&quot;math-container&quot;&gt;$\tilde{x}$&lt;/span&gt;, and outputs the state &lt;span class=&quot;math-container&quot;&gt;$|x \rangle$&lt;/span&gt; along with &lt;span class=&quot;math-container&quot;&gt;$||x||_2$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, &lt;span class=&quot;math-container&quot;&gt;$f:\tilde{x} \mapsto |\: \widetilde{||x||_2} \rangle |x \rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\widetilde{||x||_2}$&lt;/span&gt; is a computational basis state encoding of the value of &lt;span class=&quot;math-container&quot;&gt;$||x||_2$&lt;/span&gt;. The author/s state, &lt;span class=&quot;math-container&quot;&gt;$\widetilde{||x||_2}$&lt;/span&gt; can be easily loaded into a computational register using CNOT gates. I'm not sure how this is achieved. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;, and a non-unit vector, say &lt;span class=&quot;math-container&quot;&gt;$(1,1,1)$&lt;/span&gt;. How can the norm of this vector be loaded into a register using CNOT gates?&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="7481" LastEditDate="2019-07-21T22:05:16.667" LastActivityDate="2019-07-22T07:07:08.867" Title="Loading the finite precision representation of the norm of a vector into a computational register using CNOT gates" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6831" PostTypeId="1" CreationDate="2019-07-22T04:46:43.797" Score="0" ViewCount="412" Body="&lt;p&gt;I am trying to run a circuit with 32 qubit on a local hpc (not IBM Q HPC) using &lt;code&gt;statevector_simulator&lt;/code&gt; backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but i got the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &quot;testQiskit11.py&quot;, line 156, in &amp;lt;module&amp;gt;&#xA;    backend = Aer.get_backend('statevector_simulator', max_memory_mb=65536)&#xA;  File &quot;/home/UserName/.conda/envs/quantum/lib/python3.7/site-packages/qiskit/providers/aer/aerprovider.py&quot;, line 37, in get_backend&#xA;    return super().get_backend(name=name, **kwargs)&#xA;  File &quot;/home/UserName/.conda/envs/quantum/lib/python3.7/site-packages/qiskit/providers/baseprovider.py&quot;, line 53, in get_backend&#xA;    raise QiskitBackendNotFoundError('No backend matches the criteria')&#xA;qiskit.providers.exceptions.QiskitBackendNotFoundError: 'No backend matches the criteria'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The part of the script that specify the backend and run the simulation is as follow:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend('statevector_simulator', max_memory_mb=65536)&#xA;backend.MAX_QUBIT_MEMORY=32&#xA;shots = 1024&#xA;job = execute(QCirc, backend)&#xA;result = job.result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8084" LastEditorUserId="8084" LastEditDate="2019-07-22T14:01:32.897" LastActivityDate="2020-08-15T16:08:00.720" Title="Qiskit No backend matches the criteria" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6832" PostTypeId="1" CreationDate="2019-07-22T06:32:08.157" Score="1" ViewCount="111" Body="&lt;p&gt;I am trying to simulate quantum teleportation on ProjectQ using simulaqron (enabling me to use quantum internet for teleportation) however I am not sure if my approach is right. In the working paper of simulaqron its written that programming via another backend like ProjectQ is very much possible. However when I am testing quantum teleporation I am not getting any output&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[Alice's code] followed by [Bob's code]&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  from projectq.ops import All, CNOT, H, Measure, Rz, X, Z&#xA;    from projectq import MainEngine&#xA;    from projectq.meta import Dagger, Control&#xA;    from cqc.pythonLib import CQCConnection, qubit&#xA;    import simulaqron&#xA;&#xA;def main():&#xA;&#xA;    with CQCConnection(&quot;Alice&quot;) as Alice:&#xA;        eng = MainEngine()&#xA;        c1, c2 = create_bell_pair(eng)&#xA;        tel1 = eng.allocate_qubit()&#xA;        Alice.sendQubit((c1, &quot;Bob&quot;))&#xA;        H | tel1&#xA;        CNOT | (tel1, c2)&#xA;        H | tel1&#xA;        Measure | tel1&#xA;        Measure | c2&#xA;        to_print = &quot;App {}: Measurement outcomes are: a={}, b={}&quot;.format(Alice.name, int(tel1), int(c2))&#xA;        print(&quot;|&quot; + &quot;-&quot; * (len(to_print) + 2) + &quot;|&quot;)&#xA;        print(&quot;| &quot; + to_print + &quot; |&quot;)&#xA;        print(&quot;|&quot; + &quot;-&quot; * (len(to_print) + 2) + &quot;|&quot;)&#xA;&#xA;        # Send corrections to Bob&#xA;        Alice.sendClassical(&quot;Bob&quot;, int(tel1), int(c2))&#xA;&#xA;&#xA;def create_bell_pair(eng):&#xA;    b1 = eng.allocate_qubit()&#xA;    b2 = eng.allocate_qubit()&#xA;&#xA;    H | b1&#xA;    CNOT | (b1, b2)&#xA;&#xA;    return b1, b2&#xA;&#xA;main()    &#xA;&#xA;// new file for bob&#xA;from projectq.ops import All, CNOT, H, Measure, Rz, X, Z&#xA;from projectq import MainEngine&#xA;from projectq.meta import Dagger, Control&#xA;from cqc.pythonLib import CQCConnection, qubit&#xA;import simulaqron&#xA;&#xA;#####################################################################################################&#xA;#&#xA;# main&#xA;#&#xA;def main():&#xA;&#xA;        # Initialize the connection&#xA;        with CQCConnection(&quot;Bob&quot;) as Bob:&#xA;&#xA;            # Make an EPR pair with Alice&#xA;            qB=Bob.recvQubit(c1, &quot;Alice&quot;)&#xA;&#xA;            # Receive info about corrections&#xA;            data=Bob.recvClassical()&#xA;            message=list(data)&#xA;            a=message[0]&#xA;            b=message[1]&#xA;&#xA;            # Apply corrections&#xA;            if b==1:&#xA;                    X | qB&#xA;            if a==1:&#xA;                    Z | qB&#xA;&#xA;            # Measure qubit&#xA;            Measure | qB&#xA;            to_print=&quot;App {}: Measurement outcome is:  {}&quot;.format(Bob.name,int(qB))&#xA;            print(&quot;|&quot;+&quot;-&quot;*(len(to_print)+2)+&quot;|&quot;)&#xA;            print(&quot;| &quot;+to_print+&quot; |&quot;)&#xA;            print(&quot;|&quot;+&quot;-&quot;*(len(to_print)+2)+&quot;|&quot;)&#xA;&#xA;##################################################################################################&#xA;main()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8089" LastEditorUserId="10480" LastEditDate="2021-01-31T20:37:04.840" LastActivityDate="2021-01-31T20:37:04.840" Title="How to integrate Simulaqron on ProjectQ" Tags="&lt;programming&gt;&lt;teleportation&gt;&lt;projectq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6833" PostTypeId="2" ParentId="6830" CreationDate="2019-07-22T06:59:28.357" Score="2" Body="&lt;p&gt;The issue is not about loading the norm of the vector - this can be taken into account automatically. Let me give an example. This is not a complete explanation of how the state preparation procedure works, but illustrates the point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that you want to make a state &lt;span class=&quot;math-container&quot;&gt;$\sum_ix_i|i\rangle$&lt;/span&gt;, up to normalisation, and let's assume you have a bound &lt;span class=&quot;math-container&quot;&gt;$x_i\leq\delta$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; and all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (you might argue this is as problematic to know as the normalisation, but that's another debate, and you can at least make some reasonable estimates often).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now imagine a matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\left(\sum_i|x_i\rangle\right)\langle 0|.&#xA;$$&lt;/span&gt;&#xA;You can embed this in a Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, using a structure like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\left(\begin{array}{cc} 0 &amp;amp; A \\ A^T &amp;amp; 0 \end{array}\right),&#xA;$$&lt;/span&gt;&#xA;and you can implement an evolution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-i\delta t X\otimes H}|0\rangle|0\rangle&#xA;$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\delta t\delta\ll 1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is the standard Pauli matrix, applied to some ancilla qubit), after which you measure the top qubit. If the answer is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, with high probability you've produced the state you want in the second register, and it is correctly normalised by virtue of the renormalisation that happens upon collapse of the wavefunction. If the answer is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you can just try again, and keep going until you're successful. If you &lt;em&gt;did&lt;/em&gt; actually want to compute the norm, you could simply estimate the probability of getting the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; answer in the above procedure, but for what you're talking about, you don't need to.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-07-22T07:07:08.867" LastActivityDate="2019-07-22T07:07:08.867" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6834" PostTypeId="2" ParentId="6828" CreationDate="2019-07-22T08:19:50.550" Score="2" Body="&lt;p&gt;The way that I approach the maths is very different from the way that you do it (I imagine it &lt;em&gt;can&lt;/em&gt; be approached as you're trying, it's just not how I think about it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I start by introducing &lt;span class=&quot;math-container&quot;&gt;$|n,m\rangle$&lt;/span&gt; as a basis denoting the excitation states of &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; respectively. We recognise that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; preserves &lt;span class=&quot;math-container&quot;&gt;$n+m$&lt;/span&gt;, so the whole thing decomposes into a bunch of subspaces determined by the total &lt;span class=&quot;math-container&quot;&gt;$n+m$&lt;/span&gt;. This has several consequences, but for one, it means that what we want to calculate is the amplitude&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle n-k,k|e^{-iH\Delta t}|n,0\rangle.&#xA;$$&lt;/span&gt;&#xA;So, we can focus specifically on the &lt;span class=&quot;math-container&quot;&gt;$n^{th}$&lt;/span&gt; subspace, which is described by an &lt;span class=&quot;math-container&quot;&gt;$(n+1)\times (n+1)$&lt;/span&gt; matrix of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_n=\chi\sum_{i=0}^{n-1}\sqrt{(i+1)(n-i)}(|i,n-i\rangle\langle i+1,n-i-1|+|i+1,n-i-1\rangle\langle i,n-i|).&#xA;$$&lt;/span&gt;&#xA;These are matrices you might recognise, being the spin-&lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt; rotation matrix &lt;span class=&quot;math-container&quot;&gt;$J_x$&lt;/span&gt;. Or, as in my case, you recognise it from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0309131&quot; rel=&quot;nofollow noreferrer&quot;&gt;perfect state transfer&lt;/a&gt;. Depending on where you recognise it from, and what level of detail you want the proof, it might be acceptable to quote the result&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle n-k,k|e^{-iH\Delta t}|n,0\rangle=\sqrt{\binom{n}{k}}\cos^{n-k}(\chi\Delta t)\sin^{k}(\chi\Delta).&#xA;$$&lt;/span&gt;&#xA;(I'm doing this from memory. I have the feeling there are suppose to be some phase factors like &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi k/2}$&lt;/span&gt;.) Or you might take the eigenvalues/eigenvectors of the matrix and prove it. I know they can be found &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405029v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but require manipulation of hypergeometric functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, there is a proof that doesn't require any hard maths, it's just a bit annoying. Consider a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, with a Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H'=\chi\sum_{i=1}^nX_i,&#xA;$$&lt;/span&gt;&#xA;and let &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; be a uniform superposition of all states where &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of those qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, with the rest in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. You can show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H'|\psi_i\rangle=\chi\sqrt{i(n-i+1)}|\psi_{i-1}\rangle+\chi\sqrt{(i+1)(n-i)}|\psi_{i+1}\rangle,&#xA;$$&lt;/span&gt;&#xA;Which is entirely equivalent to &lt;span class=&quot;math-container&quot;&gt;$H_n$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$|i,n-i\rangle$&lt;/span&gt;. So, if we can work out the evolution of &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;, evolving to &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt;, we're done! But this evolution is easy because it's actually just &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; independent qubits, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iH'\Delta t}|0\rangle^{\otimes n}=\left((\cos(\chi\Delta t)|0\rangle-i\sin(\chi\Delta t)\right)^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;We can rewrite this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=0}^n(-i)^k\sqrt{\binom{n}{k}}\cos^{n-i}(\chi\Delta t)\sin^i(\chi\Delta t)|\psi_i\rangle.&#xA;$$&lt;/span&gt;&#xA;The origin of the binomial term is the normalisation of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-22T08:19:50.550" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="6835" PostTypeId="2" ParentId="6831" CreationDate="2019-07-22T10:13:07.780" Score="1" Body="&lt;p&gt;You should probably read this tutorial to see how backend filtering works: &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/basics/2_the_ibmq_provider.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/basics/2_the_ibmq_provider.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Aer is a local simulator, so the amount of memory available is determined by the computer you are running it on.  Setting &lt;code&gt;MAX_QUBIT_MEMORY&lt;/code&gt; manually will do nothing but cause your computer to freeze if you do not have enough memory to support 32 qubits.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-07-22T10:13:07.780" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6836" PostTypeId="1" AcceptedAnswerId="6844" CreationDate="2019-07-22T13:17:36.957" Score="9" ViewCount="1111" Body="&lt;p&gt;I am doing self-study at the moment using primarily the book: Quantum Computing a Gentle Introduction by Eleanor Rieffel and Wolfgang Polak.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting through the earlier chapters and exercises went quite well (fortunately the earlier chapters had plenty of examples), however I got stuck on the 5th chapter on quantum circuits. Although I understand the concepts the authors present, perhaps due to a lack of examples, I have trouble applying said concepts to the exercises. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exercises I have trouble with (and where I can't find a solution or thorough/ introductory explanation for) are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\\$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Design a circuit for creating:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\left| W_n \right&amp;gt; = \frac{1}{\sqrt{n}}(\left| 0 \dots 001 \right&amp;gt; + \left| 0 \dots 010 \right&amp;gt; + \left| 0\dots 100 \right&amp;gt;) + \cdots + \left| 1\dots 000 \right&amp;gt;)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \dots 000 \right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And design a circuit for creating &quot;the Hardy state&quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{12}}(3\left| 00 \right&amp;gt; + \left| 01 \right&amp;gt; + \left| 10 \right&amp;gt; + \left| 11 \right&amp;gt;)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\\$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody point me in the right direction or refer me to some literature/ tutorials so I can grasp these kind of exercises better?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\\$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps a related question:&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6002/tips-and-tricks-for-constructing-circuits-to-generate-arbitrary-quantum-states&quot;&gt;Tips and tricks for constructing circuits to generate arbitrary quantum states&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8092" LastEditorUserId="8092" LastEditDate="2019-07-22T13:25:47.763" LastActivityDate="2019-07-23T18:04:43.063" Title="How to create quantum circuits from scratch" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6837" PostTypeId="1" AcceptedAnswerId="6838" CreationDate="2019-07-22T13:21:00.057" Score="0" ViewCount="595" Body="&lt;p&gt;What is the difference between 2 types of measurements depicted below? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7GBf0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7GBf0.png&quot; alt=&quot;Here I measure 2 qubits out of 4&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GQTxe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GQTxe.png&quot; alt=&quot;Here I measure all 4 qubits&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of unitary evolution, qubits are in superposition of states, and after measurement I get a set of probabilites for different states &lt;span class=&quot;math-container&quot;&gt;$(|0000\rangle...|0101\rangle...)$&lt;/span&gt; in both cases. Each set have different size: 4 for 2 qubit measurement and 16 for 4 qubit measurement. I'm confused with interpretation these results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I want to know, what is the probability of getting &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on the first and second qubits, what type of meashurement should I use?&lt;/p&gt;&#xA;" OwnerUserId="6071" LastActivityDate="2019-07-22T13:43:46.047" Title="Measurements in Qiskit" Tags="&lt;circuit-construction&gt;&lt;qiskit&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6838" PostTypeId="2" ParentId="6837" CreationDate="2019-07-22T13:43:46.047" Score="2" Body="&lt;p&gt;In the first circuit you only use 2 measurement gates on the first and second qubits. This means that the amount of outputs will behave similarly to a circuit that has only 2 qubits. If we were to list out all possible outputs, it would look like this: 0000, 0001, 0010, 0011. This is because the third and fourth qubits will always be 0, so you only have 2 qubits which can result in either 0 or 1. This equates to &lt;span class=&quot;math-container&quot;&gt;$2^2=4$&lt;/span&gt; amount of possible outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second circuit, you measure all 4 of the qubits. If we were to list out all possible outputs of a 4 qubit circuit, it would look like this: 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111. Since now all 4 qubits can be either 0 or 1, the amount of possible outputs you can have is &lt;span class=&quot;math-container&quot;&gt;$2^4=16$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The measurement gates should be used on any qubit that you want to know the value of. If you do not put a measurement gate on a qubit and run the circuit, that qubit's value will always result in 0. So if you only care about the probability of getting &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on the first two qubits, then your first circuit is fine. However, if you care about the probabilities of all 4 qubits, you would need to use your second circuit.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-22T13:43:46.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6839" PostTypeId="1" CreationDate="2019-07-22T14:33:58.103" Score="2" ViewCount="495" Body="&lt;p&gt;I was going through the Qiskit documentation to see if there was a way to represent a mixture of quantum states as a density matrix or otherwise. Is there a way to do it? If so, how?&lt;/p&gt;&#xA;" OwnerUserId="8093" LastEditorUserId="26" LastEditDate="2019-10-09T15:20:51.197" LastActivityDate="2019-10-09T15:20:51.197" Title="How to represent an ensemble of pure quantum states in Qiskit?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6840" PostTypeId="1" CreationDate="2019-07-22T16:23:27.733" Score="1" ViewCount="1130" Body="&lt;p&gt;I'm working on a &lt;a href=&quot;https://arxiv.org/pdf/1903.10949.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hybrid classical-quantum linear solver&lt;/a&gt;. For this, they make a loop on a quantum circuit (ie. below), and each time they change the value of the classical register and apply a X gate on the quantum register conditioned on the state of the classical register. &lt;a href=&quot;https://i.stack.imgur.com/053WY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/053WY.png&quot; alt=&quot;quantum circuit&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, I ask myself, is there a way to initialize the classical register ? &lt;/p&gt;&#xA;" OwnerUserId="7762" LastActivityDate="2020-11-05T12:51:55.040" Title="How to initialize classical register in Qiskit?" Tags="&lt;qiskit&gt;&lt;classical-quantum&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6841" PostTypeId="2" ParentId="6832" CreationDate="2019-07-22T16:56:29.403" Score="2" Body="&lt;p&gt;Be sure you have executed the command &quot;simulaqron set backend projectq&quot; in your shell, in order to set the projectq backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, in your Bob's code there is a reference to c1 which is undefined, in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;qB=Bob.recvQubit(c1, &quot;Alice&quot;)&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2019-07-22T16:56:29.403" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6842" PostTypeId="1" AcceptedAnswerId="6858" CreationDate="2019-07-22T17:15:37.977" Score="8" ViewCount="1250" Body="&lt;p&gt;I'm a newcomer to quantum computing and circuit construction, and I've been struggling to understand how to make a modular exponentiation circuit. From what I know, there are several papers on the matter (like Pavlidis, van Meter, Markov and Saeedi, etc.) but they are all so complicated and involve a lot of efficiency and optimization scheme that make it impossible for me to understand. When I read it in Nielsen and Chuang, specifically in Box 5.2 the author wrote them without any example, as if it is very easy to make (it probably is, but not for me).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, I've learned about the algorithm to do modular exponentiation using binary representation (it's simple enough at least this thing), but I don't know how to make a circuit out of it. Here's the picture I believe describing the process:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rtUhi.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rtUhi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how do I build those &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; circuit? Can anyone, for example, tell me how do things changed when say I went from &lt;span class=&quot;math-container&quot;&gt;$11^x (\mod{15})$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$7^x (\mod{21})$&lt;/span&gt;? I don't care if the circuit is not gonna be optimized and contain thousands of gates, but I want to at least understand the first step before going into more advanced stuffs like optimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastActivityDate="2020-11-24T01:18:05.560" Title="Is there a simple, formulaic way to construct a modular exponentiation circuit?" Tags="&lt;circuit-construction&gt;&lt;shors-algorithm&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6843" PostTypeId="1" CreationDate="2019-07-22T19:15:22.273" Score="1" ViewCount="339" Body="&lt;p&gt;I simulated the circuit below in qiskit and used the statevector simulator to extract the statevector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jm6xH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jm6xH.png&quot; alt=&quot;quantum circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting statevector that it gave me was: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;array([ 0.5+0.j, -0.5+0.j,  0.5+0.j,  0.5+0.j])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem here is that it is assigning a minus sign to the second component which is for the state |01&gt;, while it should actually assign the minus sign to the third component, which is for the state |10&gt;, so I was expecting to get instead:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;array([ 0.5+0.j, 0.5+0.j,  -0.5+0.j,  0.5+0.j])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help to clarify this. I was using qiskit for statevector simulation and need to check this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C. Pedro&lt;/p&gt;&#xA;" OwnerUserId="8094" LastEditorUserId="8094" LastEditDate="2019-07-22T19:22:45.750" LastActivityDate="2019-07-22T19:22:45.750" Title="Please help: get_statevector gives wrong result in qiskit" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6844" PostTypeId="2" ParentId="6836" CreationDate="2019-07-22T19:57:50.880" Score="7" Body="&lt;p&gt;As DaftWullie pointed out, the question about &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt; has an excellent collection of answers &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4350/1837&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Hardy state question (and a lot of other tasks like it), you can approach it as follows. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start with the &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;li&gt;Start by putting the first qubit &quot;in the right state&quot;, which is a state &lt;span class=&quot;math-container&quot;&gt;$(\alpha |0\rangle + \beta |1\rangle) \otimes |0...0\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are the relative weights of all basis states which start with 0 and with 1, respectively. For Hardy state specifically, two basis states start with 0: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{12}}(3\left| 00 \right&amp;gt; + \left| 01 \right&amp;gt;)$&lt;/span&gt; and two basis states start with 1: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{12}}(\left| 10 \right&amp;gt; + \left| 11 \right&amp;gt;)$&lt;/span&gt;; their relative weights are just the sums of squares of their amplitudes: &lt;span class=&quot;math-container&quot;&gt;$\frac{9}{12} + \frac{1}{12} = \frac{10}{12}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{12} + \frac{1}{12} = \frac{2}{12}$&lt;/span&gt;, respectively. So you'll need to put the first qubit in the state &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{\frac{10}{12}} |0\rangle + \sqrt{\frac{2}{12}} |1\rangle)$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gate.&lt;/li&gt;&#xA;&lt;li&gt;Continue by putting the second qubit in the right state, applying controlled &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates with the first qubit as the control. To get the first two terms right, you need to convert the term &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{10}{12}} |0\rangle \otimes |0\rangle$&lt;/span&gt; into the term &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{12}}(3\left| 00 \right&amp;gt; + \left| 01 \right&amp;gt;)$&lt;/span&gt;, which is the same as convert normal state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |0\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{10}}(3\left| 00 \right&amp;gt; + \left| 01 \right&amp;gt;)$&lt;/span&gt; without affecting the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \otimes |0\rangle$&lt;/span&gt; (note the renormalization when switching from terms of a larger expression to standalone states!) To do this, you can do a 0-controlled &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; with the first qubit as control and the second qubit as target.&lt;/li&gt;&#xA;&lt;li&gt;If you have more qubits, you will continue doing this, using more control qubits to make your rotations more and more specific.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; by Shende, Bullock and Markov if you want a more formal and less ad-hoc explanation.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-22T19:57:50.880" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6846" PostTypeId="1" CreationDate="2019-07-23T01:00:38.280" Score="2" ViewCount="373" Body="&lt;p&gt;I'm trying to familiarise myself with OpenPulse but I'm confused about a few things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mainly, I would like to be able to take the pulse sequences that comprise standard gates on an IBMQ device and modify those sequences, but I'm having trouble doing that. If I call &quot;backend.defaults().cmd_def&quot;, it brings up a list of Command objects that contain information about each gate's pulse sequence. However, &quot;backend.defaults().cmd_def[i].sequence&quot; is a list of PulseQobjInstructions. Is there a way to convert these lists of PulseQobjInstructions into pulse Schedule objects that operate on the correct channels and that I can simulate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, I'm a little confused why each PulseQobjInstruction seemingly contains many more pulses (U-channels) than just the basic rotations that make up a gate. Is it necessary to recalibrate all the U-channels whenever a Drive channel is modified?&lt;/p&gt;&#xA;" OwnerUserId="4841" LastEditorUserId="4841" LastEditDate="2019-07-23T14:14:23.313" LastActivityDate="2019-08-22T17:01:20.157" Title="OpenPulse: Modifying pulse sequence for basic gates" Tags="&lt;qiskit&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6847" PostTypeId="1" CreationDate="2019-07-23T01:22:15.097" Score="2" ViewCount="143" Body="&lt;p&gt;We know that word error rate (WER) rather than qubit error rate (QER) is used to evaluate the performance of quantum Turbo codes and quantum LDPC codes. In classical coding theory, when we are computing the WER, we can either calculate the erroneous whole codeword rate, or only calculate the erroneous information part rate (e.g., the system codes). In QECCs, I find that most people always calculate the erroneous whole codeword rate rather than the erroneous information part rate when computing the WER. I want to know that can we calculate the erroneous information part rate when computing the WER, just like the system codes in classical coding theory? Is it possible to do this? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8096" LastEditorUserId="55" LastEditDate="2021-01-25T11:58:09.157" LastActivityDate="2021-01-25T11:58:09.157" Title="The merit of quantum error correction codes" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6848" PostTypeId="2" ParentId="6840" CreationDate="2019-07-23T05:24:54.950" Score="0" Body="&lt;p&gt;You might find this section of the documentation helpful, it goes over initializing and using registers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/terra/quantum_circuits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/terra/quantum_circuits.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8081" LastActivityDate="2019-07-23T05:24:54.950" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6849" PostTypeId="1" AcceptedAnswerId="6850" CreationDate="2019-07-23T06:28:56.597" Score="2" ViewCount="48" Body="&lt;p&gt;Equation 1.31 in Quantum Computation and Quantum Information a textbook by Isaac Chuang and Michael Nielsen is as follows,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|\psi_2 \right&amp;gt; = \frac{1}{2}[\alpha(\left|0&#xA;\right&amp;gt;+\left|1&#xA;\right&amp;gt;)(\left|00\right&amp;gt;+\left|11\right&amp;gt;) + \beta(\left|0&#xA;\right&amp;gt;-\left|1&#xA;\right&amp;gt;)(\left|10\right&amp;gt;+\left|01\right&amp;gt;)]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The book claims that after rearranging terms we obtain equation 1.32 as follows&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|\psi_2\right&amp;gt;=\frac{1}{2}[\left|00\right&amp;gt;(\alpha\left|0\right&amp;gt;+\beta\left|1\right&amp;gt;)+\left|01\right&amp;gt;(\alpha\left|1\right&amp;gt;+\beta\left|0\right&amp;gt;)+\left|10\right&amp;gt;(\alpha\left|0\right&amp;gt;-\beta\left|1\right&amp;gt;)+\left|11\right&amp;gt;(\alpha\left|1\right&amp;gt;-\beta\left|0\right&amp;gt;)]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't know how to derive the second equation from the first. Can someone explain the steps please ?&lt;/p&gt;&#xA;" OwnerUserId="2605" LastActivityDate="2019-07-23T07:42:09.123" Title="Derive one equation from the other" Tags="&lt;tensor-product&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6850" PostTypeId="2" ParentId="6849" CreationDate="2019-07-23T07:42:09.123" Score="1" Body="&lt;p&gt;The tensor product is distributive, meaning that you can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2|\psi_2\rangle=\alpha|000\rangle+\alpha|100\rangle+\alpha|011\rangle+\alpha|111\rangle+\beta|010\rangle+\beta|001\rangle-\beta|110\rangle-\beta|101\rangle.&#xA;$$&lt;/span&gt;&#xA;Next you reorder the terms in the sum,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2|\psi_2\rangle=\alpha|000\rangle+\beta|001\rangle+\alpha|011\rangle+\beta|010\rangle+\alpha|100\rangle-\beta|101\rangle+\alpha|111\rangle-\beta|110\rangle.&#xA;$$&lt;/span&gt;&#xA;Again, we can use distributivity to group these terms together based on the state of the first two qubits&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2|\psi_2\rangle=|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),&#xA;$$&lt;/span&gt;&#xA;as required&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-23T07:42:09.123" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6851" PostTypeId="1" CreationDate="2019-07-23T08:23:05.947" Score="3" ViewCount="47" Body="&lt;p&gt;I am looking at the paper: &lt;a href=&quot;https://arxiv.org/abs/1412.4687&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulating Hamiltonian dynamics with a truncated Taylor series&lt;/a&gt; and I am explicitly interested in Eq (15) and (16). These read &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ ||PA |0\rangle |\psi \rangle - |0\rangle U_r |\psi \rangle||=\mathcal{O}(\delta) \tag{15}$$&lt;/span&gt; &#xA;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ ||\text{Tr}_\text{anc}(PA |0\rangle |\psi \rangle) - U_r |\psi\rangle  \langle\psi| U_r ||=\mathcal{O}(\delta) \tag{16}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I would like to understand how to rigorously argue that they are true which I struggle with because I am not very seasoned when it comes to handling complexity and Landau-notation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some context: &#xA;The authors present a new technique that allows them to approximate &lt;span class=&quot;math-container&quot;&gt;$U_r |\psi \rangle$&lt;/span&gt; by executing a circuit that acts like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$PA |0\rangle |\psi \rangle = |0\rangle \left(\frac{3}{s}\tilde{U}-\frac{4}{s^3} \tilde{U}\tilde{U}^{\dagger}\tilde{U} \right)|\psi \rangle \tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the two equations (15),(16)  hold under the assumption that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |s-2|=\mathcal{O}(\delta) \tag{2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ ||\tilde{U}-U_r||=\mathcal{O}(\delta) \tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I suppose the norm &lt;span class=&quot;math-container&quot;&gt;$||\bullet||$&lt;/span&gt; is the spectral norm of the operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I know how to do:&lt;/strong&gt; I am able to show that (3) implies that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\tilde{U}\tilde{U}^\dagger-\boldsymbol{1}||=\mathcal{O}(\delta) \tag{4}$$&lt;/span&gt; where I basically use that errors in unitaries only increase linearly which in turn I was able to prove from basic properties of the spectral norm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What I struggle with:&lt;/strong&gt; I want to apply (4) to (1) and replace &lt;span class=&quot;math-container&quot;&gt;$\tilde{U}\tilde{U}^{\dagger}$&lt;/span&gt; by the identity plus some error and go from there but I do not know how I can do arithmetic with the Landau symbol.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2019-07-23T08:23:05.947" Title="Estimating errors in Hamiltonian Simulation paper" Tags="&lt;mathematics&gt;&lt;complexity-theory&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6853" PostTypeId="2" ParentId="6846" CreationDate="2019-07-23T16:05:17.403" Score="1" Body="&lt;p&gt;Try using backend.defaults().pulse_library, and taking a SamplePulse object from there. If you want the samples of a SamplePulse you can just use my_pulse.samples&lt;/p&gt;&#xA;" OwnerUserId="7764" LastActivityDate="2019-07-23T16:05:17.403" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6854" PostTypeId="2" ParentId="6836" CreationDate="2019-07-23T17:58:46.973" Score="4" Body="&lt;p&gt;You can simplify &quot;produce a state&quot; problems by breaking them into three parts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare the collection of magnitudes you'll need, without worrying about phase or which state has which magnitude.&lt;/li&gt;&#xA;&lt;li&gt;Fix the phases.&lt;/li&gt;&#xA;&lt;li&gt;Fix the ordering.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Now consider the Hardy state. What are the magnitudes that we need to make? We need one instance of &lt;span class=&quot;math-container&quot;&gt;$3/\sqrt{12}$&lt;/span&gt; and three instances of instance of &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{12}$&lt;/span&gt;. We can make them one at a time, by having a &quot;remaining amplitude&quot; state that we keep splitting off of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with all the amplitude in one state with an excitation on the left, &lt;span class=&quot;math-container&quot;&gt;$\ell_0 |1000...00\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\ell_0=1$&lt;/span&gt;. What we want to do is move the excitation rightward while leaving behind the desired magnitudes. So to start we want to leave behind the magnitude &lt;span class=&quot;math-container&quot;&gt;$3/\sqrt{12}$&lt;/span&gt;. We can do that with a controlled &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta_0)$&lt;/span&gt; operation, where the control is the leftmost qubit and the target is the qubit just to its right. By picking just the right value for &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, this will result in the state &lt;span class=&quot;math-container&quot;&gt;$3/\sqrt{12}|1000...00\rangle + \ell_1 |1100...00\rangle$&lt;/span&gt;. We then CNOT the second qubit back onto the first qubit to get to &lt;span class=&quot;math-container&quot;&gt;$\ell_1|1000...00\rangle + 3/\sqrt{12} |0100...00\rangle$&lt;/span&gt;. Next we want to pull off &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{12}$&lt;/span&gt;. We perform another &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; controlled by the leftmost qubit followed by a backwards CNOT, but this time with the target is the qubit third from the left. By picking the perfect &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt; we will produce the state &lt;span class=&quot;math-container&quot;&gt;$\ell_2|1000...00\rangle + 3/\sqrt{12}|0100...00\rangle + 1/\sqrt{12} \ell_2 |0010...00\rangle$&lt;/span&gt;. And you just keep doing this until you've got all the amplitudes you need, conveniently addressed by individual qubits being excited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you want to fix any incorrect phases produced by the Y rotations. For the Hardy state this is easy, because all the phases are positive. In general you target each qubit position &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; with an &lt;span class=&quot;math-container&quot;&gt;$R_z(\phi_k)$&lt;/span&gt; operation with appropriately chosen &lt;span class=&quot;math-container&quot;&gt;$\phi_k$&lt;/span&gt; values, and that will get the phases right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we want to get the ordering right. The easiest way to do this is to have some extra qubits that are your output qubits and, for each of the qubits we've prepared so far and each of the output qubits, either add a CNOT between the two or don't. For example, if the state with amplitude &lt;span class=&quot;math-container&quot;&gt;$3/\sqrt{12}$&lt;/span&gt; is supposed to be a &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, then we need to CNOT from our leftmost qubit onto both of the output qubits. Then we need to uncompute the leftmost qubit by using a many-controlled NOT operation. There should be one control for each output qubit, and the control's type (qubit-must-be-on vs qubit-must-be-off) is determined by whether or not you toggled the qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying these steps produces an inefficient, but correct, circuit for creating a Hardy state. &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22~5j3p%22%5D%2C%5B%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22~m9ob%22%5D%2C%5B%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C%22~k7ho%22%5D%2C%5B%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22X%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%2C%22X%22%5D%2C%5B1%2C%22X%22%2C1%2C1%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C1%2C%22X%22%2C1%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance2%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C%22Amps2%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~5j3p%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%92%2C0.9486833%7D%2C%7B-0.9486833%2C%E2%88%9A%E2%85%92%7D%7D%22%7D%2C%7B%22id%22%3A%22~m9ob%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%94%2C%E2%88%9A%E2%85%93%7D%2C%7B-%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%94%7D%7D%22%7D%2C%7B%22id%22%3A%22~k7ho%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%C2%BD%2C%E2%88%9A%C2%BD%7D%2C%7B-%E2%88%9A%C2%BD%2C%E2%88%9A%C2%BD%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;You can open the circuit in Quirk&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22~5j3p%22%5D%2C%5B%22X%22%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22~m9ob%22%5D%2C%5B%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C%22~k7ho%22%5D%2C%5B%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22X%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%2C%22X%22%5D%2C%5B1%2C%22X%22%2C1%2C1%2C1%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C1%2C%22X%22%2C1%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C1%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%5D%2C%5B%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance%22%2C%22Chance2%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C%22Amps2%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~5j3p%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%92%2C0.9486833%7D%2C%7B-0.9486833%2C%E2%88%9A%E2%85%92%7D%7D%22%7D%2C%7B%22id%22%3A%22~m9ob%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%94%2C%E2%88%9A%E2%85%93%7D%2C%7B-%E2%88%9A%E2%85%93%2C%E2%88%9A%E2%85%94%7D%7D%22%7D%2C%7B%22id%22%3A%22~k7ho%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%C2%BD%2C%E2%88%9A%C2%BD%7D%2C%7B-%E2%88%9A%C2%BD%2C%E2%88%9A%C2%BD%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j0AhW.png&quot; alt=&quot;Simple preparation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to produce a state without using so much workspace, the task gets harder. But you can still follow the magnitudes then phases then ordering pattern. Also, there are cleverer ways to prepare magnitude sets that have nice patterns. For example, when only one amplitude is different from the others, one round of partial amplitude amplification may be enough to prepare the state.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-07-23T18:04:43.063" LastActivityDate="2019-07-23T18:04:43.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6855" PostTypeId="1" CreationDate="2019-07-23T20:31:07.087" Score="1" ViewCount="719" Body="&lt;p&gt;I am trying to implement the u3 controlled gate (able to rotate the qubit in any specified direction in 3 dimensions if the control is 1, for two qubits) using simpler gates. The simpler gates available are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X(), Y(), Z(), H(), K(), T() Single-qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rot_X(step), rot_Y(step), rot_Z(step) Single-qubit rotations with the angle (step⋅2π256)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT(q), CPHASE(q) Two-qubit gates with q (qubit) as target.&lt;/p&gt;&#xA;" OwnerUserId="8089" LastActivityDate="2019-07-23T20:31:07.087" Title="How to implement controlled u3 gate from Qiskit using simpler gates?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6856" PostTypeId="2" ParentId="6588" CreationDate="2019-07-23T22:59:55.230" Score="4" Body="&lt;p&gt;Here is an example of using Qiskit to benchmark quantum devices using the Quantum Volume metric. It generates the quantum volume model circuits, compiles them, runs them, and fits the result to find the volume.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source code for how the fitting is done is here:&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-ignis/blob/master/qiskit/ignis/verification/quantum_volume/fitters.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ignis/blob/master/qiskit/ignis/verification/quantum_volume/fitters.py&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2019-07-23T22:59:55.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6857" PostTypeId="2" ParentId="6847" CreationDate="2019-07-24T07:48:58.980" Score="2" Body="&lt;p&gt;From my own experience working with QLDPC codes and what I have gleamed from the literature, using the erroneous whole codeword rate for the computation of the WER is the de facto procedure to evaluate quantum LDPC code performance. This is broached with relative simplicity in &quot;Fifteen Years of Quantum LDPC Coding and&#xA;Improved Decoding Strategies&quot; (&lt;a href=&quot;https://doi.org/10.1109/ACCESS.2015.2503267&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1109/ACCESS.2015.2503267&lt;/a&gt;). I'm sceptical with regard to it being the sole metric for Quantum Turbo code performance assessment, as I'm fairly certain to have seen publications where the erroneous information (the erroneous content of the pre-encoded message) was used to study the quality of Quantum Turbo codes. Perhaps skimming through existing papers related to the latter codes might help in providing better insight than what I've been able to muster in this answer.  &lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2019-07-24T07:48:58.980" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6858" PostTypeId="2" ParentId="6842" CreationDate="2019-07-24T08:15:03.253" Score="3" Body="&lt;p&gt;Here's, surely, a very non-optimal way of doing it. Imagine we have a unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; which performs the operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V|x\rangle|y\rangle=|x\rangle|xy\text{ mod }N\rangle.&#xA;$$&lt;/span&gt;&#xA;We can deal with how &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; might work separately, but if you have that, we want to see how we can use it to calculate any &lt;span class=&quot;math-container&quot;&gt;$|x^{2^i}\text{ mod }N\rangle$&lt;/span&gt;. The trick is that if both inputs are &lt;span class=&quot;math-container&quot;&gt;$x^{2^j}\text{ mod }N$&lt;/span&gt;, then the output is &lt;span class=&quot;math-container&quot;&gt;$x^{2^{j+1}}\text{ mod }N$&lt;/span&gt;, so we only have to repeat this construction &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; times. For example, in the circuit below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lVeHX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lVeHX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Here, I've used the control-not to denote transversal application to achieve copying of one (effectively classical) register to another. This lets you do any of the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operations that you need, assuming that you know how to implement &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. Don't forget that, as part of a larger circuit, you have to 'uncompute' the data on any auxiliary registers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do we implement &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;? Let me give some of the components. Let &lt;span class=&quot;math-container&quot;&gt;$x=x_1x_2x_3\ldots x_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y=y_1y_2\ldots y_n$&lt;/span&gt; be the binary representations of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. The product &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt; is easy to calculate by long multiplication. For example, &lt;span class=&quot;math-container&quot;&gt;$x_iy_j$&lt;/span&gt; is a bit value (so there are never any carries from the multiplication steps) that is equivalent to applying the Toffoli (controlled-controlled-not) with &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_j$&lt;/span&gt; as the two inputs. So you can calculate &lt;span class=&quot;math-container&quot;&gt;$y_1x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y_2x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y_3x\ldots$&lt;/span&gt; on separate registers and then add them up. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Addition is another standard circuit. Imagine you want to add &lt;span class=&quot;math-container&quot;&gt;$x_1x_2\ldots x_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_1y_2\ldots y_n$&lt;/span&gt;. We need to have additional two registers: one for the output, one for the carry bit. The least significant bit of output is &lt;span class=&quot;math-container&quot;&gt;$x_n\oplus y_n$&lt;/span&gt;, which can be calculated with controlled-nots. The carry bit has value &lt;span class=&quot;math-container&quot;&gt;$z_n=x_ny_n$&lt;/span&gt;. The next output is &lt;span class=&quot;math-container&quot;&gt;$x_{n-1}\oplus y_{n-1}\oplus z_{n}$&lt;/span&gt;, which we can again do with controlled nots. The carry bit is a majority vote - are two or more of &lt;span class=&quot;math-container&quot;&gt;$x_{n-1},y_{n-1},z_n$&lt;/span&gt; value 1? One way to implement this is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VXCQz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VXCQz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;You can keep repeating this process bit by bit to compute the sum. Then, again, don't forget to uncompute all the ancillas.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-24T08:15:03.253" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6859" PostTypeId="2" ParentId="6847" CreationDate="2019-07-24T08:50:00.213" Score="1" Body="&lt;p&gt;To add some more insight regarding to the answer given before, I think that you confused when understanding the Word Error Rate as defined in &lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=4957637&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum serial turbo codes&lt;/a&gt;. In such paper, the authors describe the QBER as the fraction of logical qubits that have errors after the decoding, while saying that the WER is the probability that at least one qubit in the block is incorrectly decoded. In such description you undestood that such block refers to the whole codeword, but the authors are referring to the &lt;strong&gt;logical&lt;/strong&gt; qubit block, that is, the block of &lt;strong&gt;information&lt;/strong&gt; qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such thing can be seen more clearly when they describe the decoding algorithm in the paper, as such turbo decoder estimates the most probable &lt;strong&gt;logical&lt;/strong&gt; error coset &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathcal{L}}$&lt;/span&gt; that affects to the information qubits rather than the most probable physical error, that would be &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathcal{P}}$&lt;/span&gt;. Consequently, in the QTC paradigm at least, the WER refers to the figure of merit that you are looking for, and not to a WER that considers the estimation of the channel error, or the error that would affect the whole codeword sent through the depolarizing channel.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2019-07-24T08:50:00.213" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6860" PostTypeId="1" AcceptedAnswerId="7093" CreationDate="2019-07-24T09:21:03.233" Score="4" ViewCount="175" Body="&lt;p&gt;So I am preparing for an exam and stumbled upon this question which I am unable to answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem &lt;em&gt;Binary Integer Linear Programming&lt;/em&gt; tries to find a binary vector &lt;span class=&quot;math-container&quot;&gt;$\vec x=(x_1,x_2, ...,x_n)^T$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x \in \mathbb{F_2}$&lt;/span&gt; that maximizes the value of &lt;span class=&quot;math-container&quot;&gt;$\vec s * \vec b$&lt;/span&gt; under the constraint that &lt;span class=&quot;math-container&quot;&gt;$S\vec x = \vec b$&lt;/span&gt;. The values &lt;span class=&quot;math-container&quot;&gt;$\vec s \in \mathbb{F_2^n}, b\in \mathbb{F_2^n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S \in \mathbb{F_2^{n\times m}}$&lt;/span&gt; are given. &#xA;  Construct an Ising-Hamiltonian for the optimization problem.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Hint: Construct a Hamiltonian for the constraints, a hamiltonian for the maximization and construct a superposition with the fitting coefficients&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;While I do understand that the Ising Model can help us with optimization problems and I kinda figured out what my constraints and maximization function would look like, I do not know how I should construct a superposition and what it would be useful for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8105" LastActivityDate="2019-08-24T18:16:53.207" Title="How would I construct an Ising Hamiltonian for binary linear programming?" Tags="&lt;superposition&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6861" PostTypeId="1" CreationDate="2019-07-24T11:32:11.517" Score="3" ViewCount="44" Body="&lt;p&gt;Density Evolution is a simulative tool that models the behaviour of SPA (sum-product) decoders. It is useful because it enables the optimization of code designs  so that extensive simulations can be avoided and code constructions that approach the channel capacity can be found relatively quickly. It has been applied extensively in the framework of classical communications to find LDPC codes that approach the Shannon limits of channels very closely (&quot;&lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=905935&quot; rel=&quot;nofollow noreferrer&quot;&gt;On the Design of Low-Density Parity-Check Codes within 0.0045 dB of the Shannon Limit&lt;/a&gt;&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in applying this design optimization technique in the quantum paradigm, specifically to the work I am conducting on QLDPC codes. Although I'm fairly confident with regard to my understanding of density evolution itself and I believe I can transcend it (so to speak) to my QEC scenario, it would be of great aid to my research if I could get my hands on a small example or implemented version of the classical LDPC density evolution algorithm. I haven't been able to find much after a thorough web search, hence my posting of this question. In the absence of an example, I would also be grateful if I were to be directed towards publications regarding density evolution applied to LDPC codes.&lt;/p&gt;&#xA;" OwnerUserId="7855" LastEditorUserId="55" LastEditDate="2021-01-25T11:58:04.320" LastActivityDate="2021-01-25T11:58:04.320" Title="Density Evolution to Optimize QLDPC code design" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6862" PostTypeId="1" AcceptedAnswerId="6872" CreationDate="2019-07-24T12:00:44.547" Score="5" ViewCount="233" Body="&lt;p&gt;In his &lt;a href=&quot;https://www.scottaaronson.com/qclec/6.pdf&quot; rel=&quot;noreferrer&quot;&gt;lecture notes&lt;/a&gt; Scott Aaronson states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, consider the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit pure state &lt;span class=&quot;math-container&quot;&gt;$\frac{|00\rangle + |01\rangle + |10\rangle}{\sqrt{3}}$&lt;/span&gt;. We'll give the first qubit to Alice and the second to Bob. How does Bob calculate his density matrix? By picking some orthogonal basis for Alice's side. You can rewrite the state as &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{2}{3}}|0+\rangle + \sqrt{\frac{1}{3}}|10\rangle$&lt;/span&gt;, which lets you calculate Bob's density matrix as:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{2}{3}|+\rangle\langle+| + \frac{1}{3}|0\rangle\langle0| = \frac{2}{3} \begin{bmatrix} \frac{1}{2} &amp;amp; \frac{1}{2} \\ \frac{1}{2} &amp;amp; \frac{1}{2} \end{bmatrix} + \frac{1}{3} \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} = \begin{bmatrix} \frac{2}{3} &amp;amp; \frac{1}{3} \\ \frac{1}{3} &amp;amp; \frac{1}{3} \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In general, if you have a bipartite pure state, it'll look like&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i,j = 1}^N \alpha_{ij} |i\rangle|j\rangle = |\psi\rangle&#xA;$$&lt;/span&gt;&#xA;  And you can get Bob's local density matrix&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\rho_\text{Bob})_{j, j'} = \sum_i \alpha_{ij} \alpha_{ij'}^*&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I have two problems with this formulation.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I'm not sure how this generalizes to states with more qubits.&lt;/li&gt;&#xA;&lt;li&gt;These indices are making my head explode.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is there another way to go about this, perhaps in terms of outer products as Aaronson hints at with his example, which doesn't have these shortcomings? An example computation would also be very welcome.&lt;/p&gt;&#xA;" OwnerUserId="8107" LastActivityDate="2019-07-26T03:17:36.113" Title="What's an easy way to determine a local density matrix?" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6863" PostTypeId="2" ParentId="6840" CreationDate="2019-07-24T14:31:31.233" Score="2" Body="&lt;p&gt;Classical registers are typically used for capturing measurement results, and may also be used for conditionally applying quantum operation. See:&#xA;&lt;a href=&quot;https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the problem you described, one approach would be to have a classical program that iteratively: &#xA;1) defines and executes a quantum circuit on a quantum processor or simulator&#xA;2) reads the results from the classical registers for guidance in defining the circuit for the next iteration &lt;/p&gt;&#xA;" OwnerUserId="4863" LastActivityDate="2019-07-24T14:31:31.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6864" PostTypeId="1" CreationDate="2019-07-24T20:14:30.807" Score="2" ViewCount="53" Body="&lt;p&gt;I read &lt;a href=&quot;https://arxiv.org/pdf/1903.10949.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; on quantum linear solver based on the Neumann-Ulam method (&lt;a href=&quot;https://www.uzh.ch/cmsssl/physik/dam/jcr:ef32021d-9752-4a23-a310-35c879dbe49f/lec8.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is a lesson about it&lt;/a&gt;). But the article has not a lot of details. Therefore I don't understand what is the algorithm apart from the quantum walk.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does somebody have an implementation of it ? &lt;/p&gt;&#xA;" OwnerUserId="7762" LastActivityDate="2019-07-24T20:14:30.807" Title="Hybrid classical-quantum linear solver based on the Neumann-Ulam method" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6865" PostTypeId="1" AcceptedAnswerId="6866" CreationDate="2019-07-24T20:48:56.583" Score="2" ViewCount="119" Body="&lt;p&gt;I am reading the paper &quot;Quantum Amplitude Amplification and Estimation&quot;, available &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005055&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (pages 4 to 7 in particular). I will try to summarize my confusion over a statement on page &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a finite-dimensional Hilbert space representing the state space of a quantum system spanned by the orthonormal basis states &lt;span class=&quot;math-container&quot;&gt;${|x_i \rangle}_{i=1}^{n} \in H$&lt;/span&gt;. Every Boolean function &lt;span class=&quot;math-container&quot;&gt;$\chi: \mathbb{Z} \rightarrow \{0,1 \}$&lt;/span&gt; induces a partition of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; into a direct sum of two subspaces, a good subspace, and a bad subspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be any quantum algorithm that acts on &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and uses no measurements, with &lt;span class=&quot;math-container&quot;&gt;$|\Psi \rangle = A |0 \rangle$&lt;/span&gt;. Decompose &lt;span class=&quot;math-container&quot;&gt;$|\Psi \rangle = |\Psi_0 \rangle +  |\Psi_1 \rangle $&lt;/span&gt;, the projection of &lt;span class=&quot;math-container&quot;&gt;$|\Psi \rangle$&lt;/span&gt; into the bad subspace and the good subspace, respectively. Define &lt;span class=&quot;math-container&quot;&gt;$Q(A, \chi) = -AS_0A^{-1}S_{\chi}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S_\chi |y \rangle = -1^{\chi(y)} |y \rangle $&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$S_0$&lt;/span&gt; changes the sign of the amplitude iff the state is the zero state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt;. The operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is well-defined since we assume that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has no measurements, and therefore has an inverse. Note that equivalently, &lt;span class=&quot;math-container&quot;&gt;$S_0 = (I-2|0 \rangle \langle 0|)$&lt;/span&gt;. Define &lt;span class=&quot;math-container&quot;&gt;$a = \langle \Psi_1 | \Psi_1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{\pm} \rangle = \frac {1}{\sqrt{2}} (\frac {1}{\sqrt{a}} |\Psi_1 \rangle \pm \frac {i}{\sqrt{1-a}} |\Psi_0 \rangle)$&lt;/span&gt;, which is an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$H_{\Psi}$&lt;/span&gt;, the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$ |\Psi_0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Psi_1 \rangle$&lt;/span&gt;, with corresponding eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\pm}=e^{-i2\theta_a}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta_a$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$\sin^2{\theta_a}=a$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author then states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|\Psi \rangle = A|0 \rangle$&lt;/span&gt; can be expressed in the eigenvector basis as &lt;span class=&quot;math-container&quot;&gt;$|\Psi \rangle = A|0 \rangle = \frac{-i}{\sqrt{2}}(e^{i\theta_a}|\Psi_+ \rangle -e^{-i\theta_a}|\Psi_- \rangle)$&lt;/span&gt;, and after &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; applications of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$Q^j |\Psi \rangle = \frac {-i} {\sqrt{2}}(e^{i(2j+1)\theta_a} |\Psi_+ \rangle - e^{-i(2j+1)\theta_a}|\Psi_- \rangle)$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$ = \frac {1}{\sqrt{a}}\sin((2j+1)\theta_a) |\Psi_1 \rangle + \frac {1}{\sqrt{1-a}}\cos((2j+1)\theta_a) |\Psi_0 \rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;a&amp;lt;1$&lt;/span&gt;, then the probability of producing a good state upon measurement is given by &lt;span class=&quot;math-container&quot;&gt;$\sin^2((2j+1)\theta_a)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what happened to the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{a}}$&lt;/span&gt; in computing the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|\Psi_1 \rangle$&lt;/span&gt;? Is this a mistake or is there something simple I am missing?&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="23" LastEditDate="2019-07-24T22:05:08.203" LastActivityDate="2019-07-24T22:05:08.203" Title="Clarification of a portion of the paper Quantum Amplitude Amplification and Estimation" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6866" PostTypeId="2" ParentId="6865" CreationDate="2019-07-24T21:56:42.123" Score="2" Body="&lt;p&gt;The quantum state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_1\rangle$&lt;/span&gt; is not normalized to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Thus the probability &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;amp;\left|\frac{1}{\sqrt{a}}\sin((2j+1)\theta_a)|\Psi_1\rangle\right|^2\\&#xA;&amp;amp;=&#xA;\frac{|\langle\Psi_1|\Psi_1\rangle|}{a}&#xA;\left|\sin^2((2j+1)\theta_a)|\right|^2\\&#xA;&amp;amp;=&#xA;\sin^2((2j+1)\theta_a)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5370" LastActivityDate="2019-07-24T21:56:42.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6867" PostTypeId="1" CreationDate="2019-07-25T11:12:27.383" Score="3" ViewCount="159" Body="&lt;p&gt;I recently read in Section 7.5.2 of Quantum Computing: A Gentle Introduction by Eleanor Rieffel and Wolfgang Polak a section in which they criticize the view of quantum parallelism in quantum algorithms. Specifically they address the Bernstein-Vazirani problem from the point of view of N.D. Mermin in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0305088&quot; rel=&quot;nofollow noreferrer&quot;&gt;Copenhagen Computation: How I Learned to Stop Worrying and Love Bohr&lt;/a&gt;. I am still learning this topic so please correct me if I make mistakes below...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&#xA;The Bernstein-Vazirani subroutine has an oracle function &lt;span class=&quot;math-container&quot;&gt;$U_{f_a}$&lt;/span&gt; which takes input &lt;span class=&quot;math-container&quot;&gt;$\left| x_n \right&amp;gt;\left|y\right&amp;gt; \rightarrow \left| x_n \right&amp;gt;\left|y\oplus x \cdot u \right&amp;gt;$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; implies the Hamming distance of &lt;span class=&quot;math-container&quot;&gt;$x \land y$&lt;/span&gt; modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; (or as Mermin argued the inner product of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the initial explanation the authors present the solution &quot;in terms of quantum parallelism&quot;; they apply the Walsh-Hadamard and Hadamard gate to the &lt;span class=&quot;math-container&quot;&gt;$\left| x_n \right&amp;gt;\left|y\right&amp;gt;=\left| 0_n \right&amp;gt;\left| 1 \right&amp;gt;$&lt;/span&gt; respectively &lt;span class=&quot;math-container&quot;&gt;$H_n \otimes H$&lt;/span&gt; and input the, now in superposition, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-qubit registers into the &lt;span class=&quot;math-container&quot;&gt;$U_{f_a}$&lt;/span&gt; subroutine. After applying this oracle function the states are put through &lt;span class=&quot;math-container&quot;&gt;$H_n \otimes H$&lt;/span&gt; again returning &lt;span class=&quot;math-container&quot;&gt;$\left| a \right&amp;gt;$&lt;/span&gt; and the initial &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right&amp;gt;$&lt;/span&gt; respectively. All good so far...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\\$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Now what I find intuitive is that the &lt;span class=&quot;math-container&quot;&gt;$H_n$&lt;/span&gt; gate puts the register of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s in the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\displaystyle W\left| 1_n \right&amp;gt; = \frac{1}{\sqrt{2^n}}\sum_z(-1)^{1 \cdot z}\left| z \right&amp;gt;,$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and that the oracle function phase shifts all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits with &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i}=1$&lt;/span&gt; if a qubit is not shared between the input and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; (the inner product of the compared qubits &lt;span class=&quot;math-container&quot;&gt;$=0$&lt;/span&gt;), and with &lt;span class=&quot;math-container&quot;&gt;$e^{\pi i}=-1$&lt;/span&gt; if it is shared (inner product &lt;span class=&quot;math-container&quot;&gt;$=1$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the Walsh-Hadamard transformation on the register of &lt;span class=&quot;math-container&quot;&gt;$\left| 1_n \right&amp;gt;$&lt;/span&gt;, all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit states possible are being compared from which I infer that the term quantum parallelism comes &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; Comparable to the solution for the Deutsch problem in which through superpositions the entire function domain can be explored in one function call. By cleverly re-applying the Walsh-Hadamard transformation the non-trivial phase shift information can be extracted in the form of &lt;span class=&quot;math-container&quot;&gt;$\left| a \right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\\$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what I understand but don't know how to feel about: is that the authors argue that the function &lt;span class=&quot;math-container&quot;&gt;$U_{f_a}$&lt;/span&gt; is actually a series of &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt; gates that act upon the ancilla qubit if &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Due to the Walsh-Hadamard and Hadamard transformations before and after &lt;span class=&quot;math-container&quot;&gt;$U_{f_a}$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt; gates are inverted in the subroutine, thus, flipping the qubits in the &lt;span class=&quot;math-container&quot;&gt;$\left| x_n \right&amp;gt;$&lt;/span&gt; register where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason I do not know how to feel about this interpretation is that the authors emphasize that the &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt; flip interpretation is the &lt;strong&gt;right way&lt;/strong&gt; of looking at this algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of, it implies that the oracle function &lt;span class=&quot;math-container&quot;&gt;$U_{f_a}$&lt;/span&gt; must be fixed or somehow able to be adaptively computed. But more importantly, this interpretation somewhat rids itself of the interpretation of linear combinations of the states &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; i.e., apparently the &quot;&lt;strong&gt;right way&lt;/strong&gt;&quot; of looking at this algorithm is that Hadamard gates flip a &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt; and not that the initial states are put into a linear combination of the standard bases through which an exponentially increasing domain of a function can be sampled and cleverly interfered yielding the final solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, my question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TLDR;&lt;/strong&gt; How should you view a quantum algorithm as utilizing quantum parallelism, and what is defined to be the &quot;right way&quot; of interpreting quantum parallelism in such algorithms. &lt;/p&gt;&#xA;" OwnerUserId="8092" LastActivityDate="2019-07-26T06:59:45.733" Title="Is the intuition of quantum parallelism always correct?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;quantum-parallelism&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6868" PostTypeId="1" CreationDate="2019-07-25T17:05:20.083" Score="1" ViewCount="150" Body="&lt;p&gt;I was wondering after seeing ibmq_16_melbourne layout how it is possible to perform this circuit : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UgdiO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UgdiO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems when looking at ibm q computers that a qubits can at max target 3 qubits because the arrow representing connectivity between qubits (which mean the possible cnots) doesn't allow more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kXukn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXukn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how does the compiler map virtual qubits to physical quits in this case?&lt;/p&gt;&#xA;" OwnerUserId="8115" LastEditorUserId="434" LastEditDate="2019-07-25T20:09:07.150" LastActivityDate="2019-09-15T07:01:20.430" Title="How is it possible to perform a c-not on 4 qubits using the same control qubits on IBM Q computers?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6869" PostTypeId="1" AcceptedAnswerId="6874" CreationDate="2019-07-25T19:04:51.310" Score="7" ViewCount="1402" Body="&lt;p&gt;As per wikipedia, no-cloning theorem states that it is impossible to create an identical copy of an arbitrary unknown quantum state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But from which distribution is this unknown quantum state sampled from? What does the counterfeiter know about this distribution? What is the maximum probability that a counterfeiter could succeed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say if we randomly pick one of the 2 quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\big&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\big&amp;gt;$&lt;/span&gt; and give it to a counterfeiter (the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\big&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\big&amp;gt;$&lt;/span&gt; are fixed ahead of time and are known to the counterfeiter) . The counterfeiter could measure the given state in &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\big&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_0^\perp\big&amp;gt;$&lt;/span&gt; basis and forge with non-zero probability.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe success probability of a counterfeiter depends on the distribution on which the unknown state is sampled from. I would like to know for what distribution of states the no cloning theorem is applicable. &lt;/p&gt;&#xA;" OwnerUserId="8014" LastEditorUserId="8014" LastEditDate="2019-07-25T20:16:10.750" LastActivityDate="2019-07-26T07:33:36.093" Title="No-cloning theorem does not seem precise" Tags="&lt;no-cloning-theorem&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6870" PostTypeId="2" ParentId="6869" CreationDate="2019-07-25T19:47:01.553" Score="6" Body="&lt;p&gt;To keep the problem small, let's say 1 qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the original statement &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; could be any state &lt;span class=&quot;math-container&quot;&gt;$\alpha | 0 \rangle + \beta | 1 \rangle$&lt;/span&gt; for whatever &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; produce a well defined state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantifying over all so not a probabilistic statement. Say you uniformly draw over all possible states. It is impossible to guarantee that you have gotten &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \otimes | \psi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However if you give a probability distribution with smaller support, then it does become possible. Let's say you know the state is either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probabilities &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt; respectively. Then you could guarantee that you have gotten &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \otimes | \psi \rangle$&lt;/span&gt;. You just apply a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \otimes | 0 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further example, suppose the state is either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$| + \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; with probabilities &lt;span class=&quot;math-container&quot;&gt;$p-\epsilon_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1-p-\epsilon_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\epsilon_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\epsilon_2$&lt;/span&gt; respectively. Then you could use the same gate and it would still be likely to succeed because &lt;span class=&quot;math-container&quot;&gt;$\epsilon_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\epsilon_2$&lt;/span&gt; are so small.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could make a statement quantified like &lt;span class=&quot;math-container&quot;&gt;$\forall | \psi \rangle$&lt;/span&gt; in the support of a given probability distribution. Then it would depend on the distribution. If it was the first one, supported only on 2 states, then it would be possible to get &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \otimes | \psi \rangle$&lt;/span&gt;. But if it was the second it would be impossible to guarantee that result even if it would be quite likely.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-07-25T19:47:01.553" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6871" PostTypeId="2" ParentId="6867" CreationDate="2019-07-26T01:12:46.697" Score="3" Body="&lt;p&gt;So, this isn't a question with a single &quot;correct&quot; physical answer. In general, though I would say that the parallel nature of quantum algorithms is dramatically overplayed, especially in older literature and a lot of the popular science press. Remember that whatever parallelism is happening as your quantum state evolves, once you measure you're going to collapse all of that. Put another way, even if many worlds are involved in calculating your answer, in the end you're only going to have access to one of them. The trick to designing quantum algorithms is to find some feature of the problem that you can leverage to drive up the probability that the world you end up in is one with the right answer. The upshot of this is that you can take or leave parallelism as a matter of philosophical taste, or according to how useful it is to you grokking/designing a particular algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With that in mind I think it's fair to say that there are two main schools of thought about the role of parallelism in quantum computing. I'll call them &quot;Deutsch&quot; and &quot;Aaronson.&quot; The &quot;Deutsch&quot; way of thinking goes heavy on the implications of parallelism and has connections to the many-worlds picture of quantum mechanics. Faced with the power of something like Shor's Algorithm, a Deutsch would ask &quot;where&quot; the numbers are factored, if not in many interfering worlds. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An Aaronson, on the other hand, might take a more instrumental approach. In other words, if it works, go with it, but don't try to shoehorn the whole field into your favorite way of thinking. Quantum algorithms that show speed-up over their known classical counterparts tend to rely on a sort of synergy between the specifics of the problem and the idiosyncrasies of quantum. There's a sort of Rube-Goldberg flavor to the whole endeavor, where things work thanks to careful alignment of pieces and parts and a good bit of luck, rather than because they rely on a single conceptual resource like parallelism. Many algorithms don't necessarily fit best into the parallelism way of thinking. &lt;a href=&quot;https://www.youtube.com/watch?v=iTD_gIuFsdw&quot; rel=&quot;nofollow noreferrer&quot;&gt;Analog quantum simulators&lt;/a&gt;, for instance, or some of the algorithms being considered for benchmarking quantum supremacy like &lt;a href=&quot;https://arxiv.org/pdf/1608.00263.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;random circuit selection&lt;/a&gt;. In these cases you might be better off thinking about the benefits of running quantum software on its &quot;native&quot; hardware, or the classically confounding effects of entanglement respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, as far the the connection to many-worlds is concerned, as Scott Aaronson (in case it wasn't clear, the inspiration for this school of thought) noted in his excellent book &quot;Quantum Computing Since Democritus&quot;, one thing that everyone can agree on is that interference between amplitudes is a key computational resource for a quantum computer. If you want to imagine that that is happening in parallel worlds, then those worlds are interacting with each other, and don't really seem very separate.     &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="8081" LastActivityDate="2019-07-26T01:12:46.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6872" PostTypeId="2" ParentId="6862" CreationDate="2019-07-26T03:17:36.113" Score="4" Body="&lt;p&gt;For calculating a local density matrix or in other words taking a partial trace has a neat trick (IMHO):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Trick:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Write the state given in density matrix form, if not already. Which means if &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; is the state, the density matrix is &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle \langle \psi \vert$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Turn all the outer-products into inner-products for the dimensions &lt;strong&gt;you don't want&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle =\frac{|00\rangle + |01\rangle + |10\rangle}{\sqrt{3}}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle \langle \psi \vert =  \big(\frac{|00\rangle + |01\rangle + |10\rangle}{\sqrt{3}}\big)\big( \frac{\langle00| + \langle01| + \langle10\vert}{\sqrt{3}} \big) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\big( \frac{\vert00\rangle\langle00\vert+\vert00\rangle\langle01\vert+\vert00\rangle\langle10\vert+\vert01\rangle\langle00\vert+\vert01\rangle\langle01\vert+\vert01\rangle\langle10\vert+\vert10\rangle\langle00\vert+\vert10\rangle\langle01\vert+\vert10\rangle\langle10\vert}{3}\big)$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Since you want the state of 2nd system, you would turn all the outer-products for 1st system to inner-prodcuts(This implies all the terms of form, &lt;span class=&quot;math-container&quot;&gt;$\langle0\vert1\rangle=\langle1\vert0\rangle=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle0\vert0\rangle=\langle1\vert1\rangle=1$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2 = \big( \frac{1*\vert0\rangle\langle0\vert+1*\vert0\rangle\langle1\vert+0*\vert0\rangle\langle0\vert+1*\vert1\rangle\langle0\vert+1*\vert1\rangle\langle1\vert+0*\vert1\rangle\langle0\vert+0*\vert0\rangle\langle0\vert+0*\vert0\rangle\langle1\vert+1*\vert0\rangle\langle0\vert}{3}\big)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2 = \big( \frac{\vert0\rangle\langle0\vert+\vert0\rangle\langle1\vert+\vert1\rangle\langle0\vert+\vert1\rangle\langle1\vert+\vert0\rangle\langle0\vert}{3}\big)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2 = \big( \frac{2\vert0\rangle\langle0\vert+\vert0\rangle\langle1\vert+\vert1\rangle\langle0\vert+\vert1\rangle\langle1\vert}{3}\big)$$&lt;/span&gt;&#xA;Which is the state in the example you quote. &lt;strong&gt;&lt;em&gt;Now, this will become second nature when you become little experienced and you wouldnt even be doing all this algebra!&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Example on 3-qubit system:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I deliberately choose an state with 2 terms just to show the proof of principle, you can work out a complicated state if you wish so!,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \sqrt{\frac{2}{3}}\vert 011 \rangle + \sqrt{\frac{1}{3}}\vert100\rangle$$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \vert \psi \rangle \langle \psi \vert = &#xA;\frac{2}{3}\vert011\rangle\langle011\vert&#xA;+\frac{1}{3}\vert100\rangle\langle100\vert &#xA;+\frac{\sqrt{2}}{3}\vert011\rangle\langle100\vert &#xA;+\frac{\sqrt{2}}{3}\vert100\rangle\langle011\vert$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Lets say you want the state of 2nd qubit, turn all the outer-products for 1 and 3 qubit to inner-products.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2=\frac{2}{3}\langle0\vert0\rangle\vert1\rangle\langle1\vert\langle1\vert1\rangle&#xA;+\frac{1}{3}\langle1\vert1\rangle\vert0\rangle\langle0\vert\langle0\vert0\rangle&#xA;+\frac{\sqrt{2}}{3}\langle0\vert1\rangle\vert0\rangle\langle0\vert\langle1\vert0\rangle &#xA;+\frac{\sqrt{2}}{3}\langle1\vert0\rangle\vert0\rangle\langle0\vert\langle0\vert1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2 = \frac{2}{3}\vert0\rangle\langle0\vert + \frac{1}{3}\vert1\rangle\langle1\vert$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Explaination of trick:&lt;/strong&gt;&#xA;Trace on a single qubit state(in computational basis), &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is given by sum of diagonal elements,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho) = \sum_{i|i\in\{0,1\}}\langle i \vert\sigma\vert i\rangle.$$&lt;/span&gt;&#xA;Similarly for 2-qubit state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho) = \sum_{i,j |i,j\in\{0,1\} }\langle ij\vert\rho\vert ij\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, given this 2-qubit state if you want to know the local state of 1st qubit you would take a partial trace over 2nd qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr_2(\rho) = \sum_{j|j\in\{0,1\}}\langle j \vert\rho\vert j\rangle.$$&lt;/span&gt;&#xA;In above you can see that if there was an element of form &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle\langle1\vert,\vert1\rangle\langle0\vert$&lt;/span&gt; for 2nd qubit, they will go to zero while the terms of form &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle\langle0\vert,\vert1\rangle\langle1\vert$&lt;/span&gt; goes to 1, and hence the trick!&#xA;and if you want to know the local state of 2nd qubit you would take a partial trace over 1st qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr_1(\rho) = \sum_{i|i\in\{0,1\}}\langle i \vert\rho\vert i\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5746" LastActivityDate="2019-07-26T03:17:36.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6873" PostTypeId="2" ParentId="6867" CreationDate="2019-07-26T06:59:45.733" Score="4" Body="&lt;p&gt;Intuition is just that - intuition. It's is not an absolute of &quot;this is how it works&quot;, but rather something that helps you get some sort of intuition about what's happening. In that sense, there is no &quot;right&quot; or &quot;wrong&quot;. It's what helps &lt;em&gt;you&lt;/em&gt;. Different people understand things in different ways. You just have to be clear that every intuitive explanation has its limitations - they're rarely a complete description - and there's no substitute for actually doing the maths.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the quantum parallelism intuition is particularly useful because it is easily described even to a layman (which is what you want from intuition), which is why it has been over-played in the media. Its limitation is that it fails to explain why some algorithms get a speed-up and others don't - because it's not just about parallelism, but how you make the comparison at the end of the computation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-26T06:59:45.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6874" PostTypeId="2" ParentId="6869" CreationDate="2019-07-26T07:33:36.093" Score="9" Body="&lt;p&gt;The no-cloning theorem itself can be stated very precisely.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given an unknown pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that is drawn from a distribution&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\{p_i,|\phi_i\rangle\}$&lt;/span&gt; (known to the counterfeiter), it is impossible to create a perfect clone with unit probability&#xA;  unless &lt;em&gt;all&lt;/em&gt; the states are orthogonal,&#xA;  &lt;span class=&quot;math-container&quot;&gt;$\langle\phi_i|\phi_j\rangle=\delta_{ij}\ \forall\ i,j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Of course, as you say, there are strategies that either (i) succeed perfectly but with some probability of success less than 1, or (ii) always succeed but create the target state with some finite accuracy, as measured by the fidelity (F&amp;lt;1). In my experience, (ii) is the more common case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What these parameters are is highly dependant upon the distribution that the states are drawn from, and there's no universal answer. The sort of cases you will find that have been explicitly calculated include:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Universal cloning, where the distribution is uniform over all possible pure states of a fixed Hilbert space dimension.&lt;/li&gt;&#xA;&lt;li&gt;Equatorial cloning (this is my name for it, many in the literature use 'phase covariant cloning' but I find that misleading). The system to be cloned is a qubit, equally likely to be any pure state on a great circle (usually the equator) of the Bloch sphere, i.e. &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+e^{i\phi}|1\rangle)/\sqrt{2}$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$\phi\in[0,2\pi)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Phase covariant cloning (again, my name for it). A qubit state &lt;span class=&quot;math-container&quot;&gt;$\cos\theta|0\rangle+\sin\theta e^{i\phi}|1\rangle$&lt;/span&gt; for some arbitrary distribution &lt;span class=&quot;math-container&quot;&gt;$f(\theta)$&lt;/span&gt;, but still uniform over &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. In other words, the distribution is invariant under rotations around the z axis of the Bloch sphere.&lt;/li&gt;&#xA;&lt;li&gt;A discrete pair of non-orthogonal states.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can derive these success parameters for arbitrary numbers of clones, and you can even demand that different clones have different fidelities, and derive the optimal trade-off between them (full disclosure: I've worked on that quite a bit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should probably emphasise that what you want from cloning is highly dependant upon application. In a lot of theory, it is the simple fact that perfect cloning is impossible that is useful within other proofs. Figures of merit are only really relevant if you have a concrete scenario where you want to implement approximate cloning. I'm not aware of many. Note that, for example, it's not so useful in security proofs of e.g. quantum key distribution, because that might allow you to bound how well a particular class of strategies perform, but how do you know there aren't other strategies not included in your analysis?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-26T07:33:36.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6875" PostTypeId="1" CreationDate="2019-07-26T08:07:35.107" Score="8" ViewCount="1437" Body="&lt;p&gt;This is because if control qubit is in arbitrary state then how can it be made to control the CNOT gate? What is the interface between Control Qubit and CNOT Gate?&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-07-26T22:40:43.693" Title="How is CNOT gate physically implemented in IBM Q?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6876" PostTypeId="2" ParentId="6875" CreationDate="2019-07-26T22:40:43.693" Score="6" Body="&lt;p&gt;First of all let me welcome you to QCSE! I'm new myself. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;IBM operates superconducting qubits based on josephson junctions. The basic architecture of the chip can be visualized as a graph with qubits at the vertices and superconducting, microwave resonators as the edges. Their native two-qubit operation is something called a cross-resonance gate. Basically, the control qubit is driven at the transition frequency of the target qubit. This induces a coupling between the two that depends on the amplitude of the drive signal. By tuning this amplitude, you can obtain an effective hamiltonian that corresponds to the generator of the clifford group &lt;span class=&quot;math-container&quot;&gt;$[ZX]^{1/2}$&lt;/span&gt;. This, combined with single-qubit rotations, can give you a CNOT gate. For more details I'd recommend this &lt;a href=&quot;https://pdfs.semanticscholar.org/b039/771aedf0ef86523ec42347b2c65c5828ee62.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.    &lt;/p&gt;&#xA;" OwnerUserId="8081" LastActivityDate="2019-07-26T22:40:43.693" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6877" PostTypeId="2" ParentId="6842" CreationDate="2019-07-27T10:56:53.140" Score="2" Body="&lt;p&gt;The method of transversal copying by a CNOT is solid and you can stack up the building blocks for the quantum part of shor algorithm. However ad-hoc circuit synthesis based at a pattern of the function truth table could be efficiënt in some cases as described in &lt;a href=&quot;https://arxiv.org/abs/1310.6446&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv 1310.6446v2.&lt;/a&gt; First case is for factoring N=15 and base a = 2 with period r = 4. In exponential formulation we have &lt;span class=&quot;math-container&quot;&gt;$$f(x)=a^{x}\text{ mod }15&#xA;$$&lt;/span&gt; &#xA;With values&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BMwQO.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BMwQO.jpg&quot; alt=&quot;input x&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setup a truth table for input x between 0 and 3. Input x is represented by 2 qubits  x2 and x1. Output y is represented by 4 qubits y4,y3,y2,y1&#xA;For example if x = 2 then x2=1 and x1=0 then only y3 =1 so put a NOT on this line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A4Hyd.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A4Hyd.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore underlined entries in table 1 are the ones that are modified by a toffoli gate to get the right output in the circuit according the table 1.&#xA;We can use this module in the overall algorithm according to&#xA;&lt;a href=&quot;https://arxiv.org/pdf/0705.1398.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/0705.1398.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EBTqi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EBTqi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastEditorUserId="1773" LastEditDate="2019-07-27T13:29:03.893" LastActivityDate="2019-07-27T13:29:03.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6878" PostTypeId="1" CreationDate="2019-07-27T14:21:40.190" Score="7" ViewCount="143" Body="&lt;p&gt;I am reading about the phase damping quantum operation on page 384 of Nielsen &amp;amp; Chuang's &lt;em&gt;Quantum Computation and Quantum Information (10th Anniversary Edition)&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nielsen &amp;amp; Chuang derived the operation elements from an interaction model of two harmonic oscillators where only the first two levels &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are considered. Here's a clipping of the corresponding contents in the book: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Another way to derive the phase damping operation is to consider an interaction between two harmonic oscillators, in a manner similar to how amplitude damping was derived in the last section, but this time with the interaction Hamiltonian &lt;span class=&quot;math-container&quot;&gt;\begin{equation} \tag{8.126} &#xA;H = \chi a^\dagger a\left(b+b^\dagger\right),&#xA;\end{equation}&lt;/span&gt;&#xA;  Letting &lt;span class=&quot;math-container&quot;&gt;$U = \exp\left(-iH\Delta t\right)$&lt;/span&gt;, considering only the &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; states of the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; oscillator as our system, and taking the environment oscillator to initially be &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;, we find that tracing over the environment gives the operation elements &lt;span class=&quot;math-container&quot;&gt;$E_k = \left&amp;lt;k_b|U|0_b\right&amp;gt;$&lt;/span&gt;, which are &lt;span class=&quot;math-container&quot;&gt;\begin{equation} \tag{8.127}&#xA;E_0 = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-\lambda}\end{bmatrix}\end{equation}&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;\begin{equation} \tag{8.128}&#xA;E_1 = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{\lambda}\end{bmatrix},&#xA;\end{equation}&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda = 1-\cos^2\left(\chi\Delta t\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I just could not work out the calculations. Anybody can help me with the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1-\lambda}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\lambda}$&lt;/span&gt; terms?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually, when I attempted to derive the operation elements along this way, I got the very different answer: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, we know that if &lt;span class=&quot;math-container&quot;&gt;$[A,[A,B]]=[B,[A,B]]=0$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$e^{A+B}=e^A e^B e^{-[A,B]/2}$&lt;/span&gt;. So we have &lt;span class=&quot;math-container&quot;&gt;$$E_0=\langle 0_b| e^{-i\chi\Delta t a^\dagger a(b+b^\dagger)} |0_b\rangle&#xA;=\langle 0_b| e^{-i\chi\Delta t a^\dagger a b} e^{-i\chi\Delta t a^\dagger a b^\dagger}  |0_b\rangle e^{(\chi\Delta t a^\dagger a)^2/2}$$&lt;/span&gt;Now using &lt;span class=&quot;math-container&quot;&gt;$$e^{-i\chi\Delta t a^\dagger a b^\dagger}  |0_b\rangle = \sum_{n=0}^{\infty} \dfrac{(-i\chi\Delta t a^\dagger a)^n}{n!} (b^\dagger)^n |0_b\rangle = \sum_{n=0}^{\infty} \dfrac{(-i\chi\Delta t a^\dagger a)^n}{\sqrt{n!}} |n_b\rangle$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$\langle 0_b| e^{-i\chi\Delta t a^\dagger a b} = &#xA;\sum_{n=0}^{\infty} \langle 0_b| b^n \dfrac{(-i\chi\Delta t a^\dagger a)^n}{n!} =&#xA;\sum_{n=0}^{\infty} \langle n_b| \dfrac{(-i\chi\Delta t a^\dagger a)^n}{\sqrt{n!}} $$&lt;/span&gt; we are able to get &lt;span class=&quot;math-container&quot;&gt;$$E_0 = \sum_{n=0}^{\infty} \dfrac{(-i\chi\Delta t a^\dagger a)^{2n}}{n!} e^{(\chi\Delta t a^\dagger a)^2/2} = e^{-(\chi\Delta t a^\dagger a)^2/2}$$&lt;/span&gt; Following the same line, using &lt;span class=&quot;math-container&quot;&gt;$$\langle 1_b| e^{-i\chi\Delta t a^\dagger a b} = &#xA;\sum_{n=0}^{\infty} \langle 1_b| b^n \dfrac{(-i\chi\Delta t a^\dagger a)^n}{n!} =&#xA;\sum_{n=1}^{\infty} \langle n_b| \dfrac{(-i\chi\Delta t a^\dagger a)^{n-1}}{\sqrt{n!}} n$$&lt;/span&gt; we are to obtain &lt;span class=&quot;math-container&quot;&gt;$$E_1 = \sum_{n=0}^{\infty} \dfrac{(-i\chi\Delta t a^\dagger a)^{2n+1}}{n!} e^{(\chi\Delta t a^\dagger a)^2/2} = (-i\chi\Delta t a^\dagger a) e^{-(\chi\Delta t a^\dagger a)^2/2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, my answer will be &lt;span class=&quot;math-container&quot;&gt;$E_{0}=\left[\begin{array}{cc}{1} &amp;amp; {0} \\ {0} &amp;amp; {e^{-(\chi\Delta t)^2/2}}\end{array}\right]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{1}=\left[\begin{array}{cc}{0} &amp;amp; {0} \\ {0} &amp;amp; {-i\chi\Delta t e^{-(\chi\Delta t)^2/2}}\end{array}\right]$&lt;/span&gt;. What is the problem?&lt;/p&gt;&#xA;" OwnerUserId="8131" LastEditorUserId="23" LastEditDate="2019-12-18T20:49:27.580" LastActivityDate="2019-12-20T08:23:46.880" Title="Derive phase damping quantum operation" Tags="&lt;nielsen-and-chuang&gt;&lt;quantum-operation&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6879" PostTypeId="1" CreationDate="2019-07-27T14:52:12.450" Score="4" ViewCount="106" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be a hidden subgroup of &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; that is indistinguishable from subgroup &lt;span class=&quot;math-container&quot;&gt;$H^{\prime}$&lt;/span&gt; by quantum Fourier sampling. Now take a larger group &lt;span class=&quot;math-container&quot;&gt;$G_2$&lt;/span&gt; such that it contains &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;. Now if I do quantum Fourier sampling over &lt;span class=&quot;math-container&quot;&gt;$G_2$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt; are they still indistinguishable?&lt;/p&gt;&#xA;" OwnerUserId="8132" LastEditorUserId="7528" LastEditDate="2019-07-28T22:37:30.377" LastActivityDate="2019-07-28T22:37:30.377" Title="Hidden subgroup problem" Tags="&lt;quantum-fourier-transform&gt;&lt;fourier-sampling&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6880" PostTypeId="1" CreationDate="2019-07-27T22:11:23.003" Score="6" ViewCount="103" Body="&lt;p&gt;I would like to understand this image, of a &quot;payload preparation&quot; gate. A single H gate will create a superposition, while the phase will rotate 45 degrees. What does the second H gate do in this commonly used subcircuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rdErT.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rdErT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8133" LastActivityDate="2019-07-28T07:59:01.457" Title="How to understand a phase operation between 2 Hadamard gates?" Tags="&lt;quantum-gate&gt;&lt;teleportation&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6881" PostTypeId="2" ParentId="6880" CreationDate="2019-07-28T07:59:01.457" Score="2" Body="&lt;p&gt;&quot;Payload preperation gate&quot; is just a fancy name for preparing the message with a more clear setting with the probability of 85.4% ∣0⟩ and 14.6% ∣1⟩ in this case. The chance of being a zero is less than that of one. A standard example of teleportation gives a 50% chance, in that case it is not a clear 0 or 1.&#xA;The second H gate changes the relative phase of Alice between the 0 and 1 bit. Without the H gate it is 45 and with H gate it is 90 degrees. It does not really matter what sort of message you will give, it depends on what you want to show.&#xA;&lt;a href=&quot;https://www.oreilly.com/library/view/programming-quantum-computers/9781492039679/ch04.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum teleporation with a payload&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1773" LastActivityDate="2019-07-28T07:59:01.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6882" PostTypeId="1" AcceptedAnswerId="6885" CreationDate="2019-07-28T15:12:03.840" Score="5" ViewCount="982" Body="&lt;p&gt;I read &lt;a href=&quot;https://arxiv.org/pdf/1904.00102.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this article&lt;/a&gt; (Apendix III p.8) that for &lt;span class=&quot;math-container&quot;&gt;$A\in \mathcal{M}_2$&lt;/span&gt;, since the normalized Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}/\sqrt{2}$&lt;/span&gt; form an orthogonal matrix basis. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\frac{Tr(AI)I+Tr(AX)X+Tr(AY)Y+Tr(AZ)Z}{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand, where does the Trace coefficient come from ? &lt;/p&gt;&#xA;" OwnerUserId="7762" LastEditorUserId="55" LastEditDate="2020-11-24T18:58:41.510" LastActivityDate="2020-11-24T18:58:41.510" Title="How are arbitrary $2\times 2$ matrices decomposed in the Pauli basis?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6884" PostTypeId="1" AcceptedAnswerId="6886" CreationDate="2019-07-28T19:39:58.443" Score="1" ViewCount="245" Body="&lt;p&gt;The Knill-Laflamme condition for a stabilizer &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An error with Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{E_k\}$&lt;/span&gt; is correctable if either &lt;span class=&quot;math-container&quot;&gt;$$E^\dagger_kE_l\in\mathcal{M}\quad\forall\, k,l $$&lt;/span&gt; or there exists &lt;span class=&quot;math-container&quot;&gt;$M\in\mathcal{M}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\{M,E_k^\dagger E_k\}=0\quad\forall \,k $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But consider a unitary error &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U=I\in \mathcal{M}$&lt;/span&gt;. Does this mean that all unitary errors are always correctable by any stabilizer? It shouldn't, because for example Shor's code doesn't correct double bit flips. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2019-07-28T20:25:01.653" LastActivityDate="2019-07-28T20:30:56.897" Title="All unitary errors are correctable" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6885" PostTypeId="2" ParentId="6882" CreationDate="2019-07-28T20:12:53.857" Score="8" Body="&lt;p&gt;The Pauli matrices form an orthogonal basis of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}_2$&lt;/span&gt;, this vector space can be endowed with a scalar product called the Hilbert-Schmidt inner product&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle A,B\rangle=\mathrm{Tr}(A^\dagger B)$$&lt;/span&gt;&#xA;since the Pauli matrices anticommute, their product is traceless, and since they are Hermitian this implies that they are orthogonal with respect to that scalar product, hence the decomposition noticing they have norm &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; since their square is the identity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More explicitely, if &lt;span class=&quot;math-container&quot;&gt;$$A=\alpha X +\beta Y +\gamma Z+ \delta I $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}(AX)=\alpha \mathrm{Tr}(X^2)+\beta\mathrm{Tr}(XY)+\gamma\mathrm{Tr}(XZ)+\delta\mathrm{Tr}(X)=2\alpha $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and same for all the others&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2019-07-28T20:12:53.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6886" PostTypeId="2" ParentId="6884" CreationDate="2019-07-28T20:30:56.897" Score="4" Body="&lt;p&gt;If you only have one &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; (i.e., &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; can only take one value), and this &lt;span class=&quot;math-container&quot;&gt;$E_k=U$&lt;/span&gt; is unitary, then - as you point out in the comments - the first condition is always satisfied, and the error can be corrected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this also means that your &quot;error&quot; is the &lt;strong&gt;deterministic&lt;/strong&gt; application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. So after applying the &quot;error&quot; map, you just have to undo &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, because you &lt;strong&gt;know&lt;/strong&gt; which error has been applied.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you have several unitary errors &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; which occur with probability &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt;, the channel would be something like &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto p_k U_k\rho U_k^\dagger + q\rho$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is the probability that no error occurs.  Thus, we have &lt;span class=&quot;math-container&quot;&gt;$E_k=\sqrt{p_k}U_k$&lt;/span&gt;, and additionally &lt;span class=&quot;math-container&quot;&gt;$E_0=\sqrt{q}I$&lt;/span&gt;.  So if there are several unitary errors which can occur (or even just one error or no error), there is more than one &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt;, and the first condition need not be satisfied for all pairs &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$E_l$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-07-28T20:30:56.897" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6887" PostTypeId="1" AcceptedAnswerId="6894" CreationDate="2019-07-28T23:21:56.393" Score="3" ViewCount="333" Body="&lt;p&gt;I'm currently trying to specify an initial_layout for a circuit on a IBM Q device. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zmM5j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zmM5j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the device's topology I would like to use the less noisy qubits in order to have the best performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, I looked at how the circuit is transformed to fit the device topology by drawing the circuit returned by transpile :&lt;a href=&quot;https://i.stack.imgur.com/0bB6K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0bB6K.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that the compiler is using q0,q1 and q2 to run the circuit. So my first question is : How does the compiler chose which virtual qubits are mapped to which qubits ? I heard that it try to minimize the depth and the number of cnot used by choosing the most connected qubits in the graph but I've never found any info about that in the qiskit documentation. I then tried to specify a initial_layout to use q10,q9 and q8 to see if it improves performance:&lt;a href=&quot;https://i.stack.imgur.com/gU01j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gU01j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the drawing still show q0,q1 and q2 being used.  What am I missing ? &lt;/p&gt;&#xA;" OwnerUserId="8115" LastActivityDate="2019-07-29T14:08:23.250" Title="Chose how to map virtual qubits to physical qubits" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6888" PostTypeId="1" AcceptedAnswerId="6902" CreationDate="2019-07-29T00:24:20.643" Score="3" ViewCount="199" Body="&lt;p&gt;I am continuing my studies of the HHL algorithm &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. In applying the controlled rotation conditioned on the eigenvalues of the matrix, the authors use so called filter functions in order to filter out the portion of &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; that is in the ill-conditioned subspace of subspace of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, which the authors define as the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_j\geq \frac{1}{\kappa}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; is the condition number of the matrix defined to be the ratio &lt;span class=&quot;math-container&quot;&gt;$\lambda_{max} / \lambda_{min}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a controlled rotation, say controlled on state &lt;span class=&quot;math-container&quot;&gt;$|a \rangle |0 \rangle $&lt;/span&gt; with angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a \in \{0,1\} $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$R_{\theta} |a \rangle |0 \rangle = |a \rangle (cos(\theta) |0 \rangle + sin (\theta) |1 \rangle$&lt;/span&gt;) if &lt;span class=&quot;math-container&quot;&gt;$a=1$&lt;/span&gt;, and which does nothing otherwise. In this case we have that the 1-bit ancilla register is what is being &quot;rotated&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the HHL algorithm, we are left with a register S of the form &#xA;&lt;span class=&quot;math-container&quot;&gt;$|h(\tilde{\lambda_j}) \rangle : = \sqrt{1-f(\tilde{\lambda_k})^2 - g(\tilde{\lambda_k})^2} |$&lt;/span&gt; nothing &lt;span class=&quot;math-container&quot;&gt;$\rangle + f(\tilde{\lambda_k})|$&lt;/span&gt;well&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$g(\tilde{\lambda_k})|$&lt;/span&gt;ill&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt;, where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;nothing&quot; corresponds to no inversion taking place&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;well&quot; correspondins to a successful inversion&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;ill&quot; indicates that part of &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; is in the ill-conditioned subspace of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. The discussion section describes that formally we are transforming &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\sum_{j, \lambda_j &amp;lt; 1 / \kappa} \lambda_j^{-1}\beta_j |u_j \rangle | well \rangle + \sum_{j, \lambda_j \geq 1 / \kappa} \beta_j |u_j \rangle | ill \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors describe the register &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as being of dimension &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;. I'm not sure why the dimension is &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; as in my above description of a controlled rotation.&lt;/p&gt;&#xA;" OwnerUserId="7481" LastActivityDate="2019-07-31T08:54:09.780" Title="Understanding the filter functions in the HHL algorithm" Tags="&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6889" PostTypeId="1" AcceptedAnswerId="6891" CreationDate="2019-07-29T01:34:53.587" Score="0" ViewCount="145" Body="&lt;p&gt;One well-known fidelity is defined as &lt;span class=&quot;math-container&quot;&gt;$(Tr\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}})^2$&lt;/span&gt;. And for pure states, fidelity is always in the form &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi|\phi\rangle|^2$&lt;/span&gt;.&#xA;As we know, in the context of two-qubit quantum computation, we cannot tell the difference between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{ia}|\psi\rangle$&lt;/span&gt;(&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is real and perhaps &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; need to be a pure state). And the definitions of fidelity above are all modes of some complex values. So does that means the phase factor of quantum states is negligible in calculating the fidelity? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And could we generalize it to quantum operation and say that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, a unitary, cannot be distinguished from &lt;span class=&quot;math-container&quot;&gt;$e^{ia}U$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4178" LastActivityDate="2020-06-08T14:30:32.150" Title="Is phase factor negligible in fidelity of quantum states?" Tags="&lt;quantum-state&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6890" PostTypeId="1" AcceptedAnswerId="6893" CreationDate="2019-07-29T09:35:23.937" Score="3" ViewCount="125" Body="&lt;p&gt;I am reading the very basics about CSS codes in the Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On page 450 of this book is explained how the ancillas are used to detect a bit-flip error on the encoded data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider &lt;span class=&quot;math-container&quot;&gt;$C_2 \subset C_1$&lt;/span&gt; two classical linear error correcting codes, and we focus on &lt;span class=&quot;math-container&quot;&gt;$CSS(C_1,C_2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |x+C_2 \rangle = \frac{1}{\sqrt{|C_2|}} \sum_{y \in C_2} |x+y\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We assume this state has received bit-flip and phase errors described by &lt;span class=&quot;math-container&quot;&gt;$e_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e_2$&lt;/span&gt; respectively. Thus it becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle = \frac{1}{\sqrt{|C_2|}} \sum_{y \in C_2} (-1)^{(x+y).e_2}|x+y+e_1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the book says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;To detect where bit flips occurred it is convenient to introduce an&#xA;  ancilla containing sufficient qubits to store the syndrome for the&#xA;  code C1, and initially in the all zero state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.We use reversible&#xA;  computation to apply the parity matrix H1 for the code C1,taking &#xA;  &lt;span class=&quot;math-container&quot;&gt;$|x+y+e_1\rangle |0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|x+y+e_1\rangle |H_1(x+y+e_1)\rangle=|x + y + e \rangle |H_1e_1 \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My question is simply: How do we do the transformation &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow |H_1(x+y+e_1)\rangle$&lt;/span&gt; for the ancilla ? For me it would require to know &lt;span class=&quot;math-container&quot;&gt;$|H_1(x+y+e_1)\rangle$&lt;/span&gt; and then find the appropriate unitary to make the transformation &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow |H_1(x+y+e_1)\rangle$&lt;/span&gt;. But we are not supposed to know the state that is encoded and if we measure it we may destroy it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how can we know which transformation to apply to make: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow |H_1(x+y+e_1)\rangle$&lt;/span&gt; ? I don't understand the argument of reversible computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[edit] : I actually just thought about using CNOT between the qubits and the ancillas to first to &lt;span class=&quot;math-container&quot;&gt;$|x+y+e_1\rangle |0\rangle \rightarrow |x+y+e_1\rangle |x+y+e_1\rangle$&lt;/span&gt;. But then we need to apply &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; on the ancillas. But it is not a unitary operation so how can we do it on a quantum circuit ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2019-07-31T09:01:29.570" Title="Basics on CSS codes: manipulation of the ancillas to detect error" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6891" PostTypeId="2" ParentId="6889" CreationDate="2019-07-29T09:57:45.457" Score="2" Body="&lt;p&gt;You are correct in both assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A total phase on a qubit state &lt;span class=&quot;math-container&quot;&gt;$|{\psi}\rangle$&lt;/span&gt; is often referred to as the &lt;em&gt;global&lt;/em&gt; phase. Any measurement of a quantum state is the expectation value &lt;span class=&quot;math-container&quot;&gt;$\lambda_{M}$&lt;/span&gt; of some (Hermitian) observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\lambda_{M} = |\langle\psi|M|\psi\rangle|^{2}$&lt;/span&gt;. Because this is invariant to the global phase, there is no physical meaning to adding said global phase &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, and therefore it is often omitted.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also means, as you correctly observed, that such a phase can be omitted from a Unitary &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha}U$&lt;/span&gt; as well. Even more, we often restrict ourselves to only use elements from &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;; the group of unitary &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; matrices with &lt;span class=&quot;math-container&quot;&gt;$\det(U) = 1$&lt;/span&gt;; this is essentially the same as choosing a particular phase &lt;span class=&quot;math-container&quot;&gt;$\alpha_{1}$&lt;/span&gt; for the unitary (although not necessarily &lt;span class=&quot;math-container&quot;&gt;$\alpha_{1} = 0$&lt;/span&gt;!).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-08T14:30:32.150" LastActivityDate="2020-06-08T14:30:32.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6892" PostTypeId="1" CreationDate="2019-07-29T12:53:15.227" Score="2" ViewCount="88" Body="&lt;p&gt;I have a classical vector of size &lt;span class=&quot;math-container&quot;&gt;$2^{n}$&lt;/span&gt; (normalized) and I want to use this value as amplitude for my &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbits, in the canonical basis &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|00001\rangle$&lt;/span&gt; etc.&#xA;I want to use real feasible gates (&lt;span class=&quot;math-container&quot;&gt;$RX$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$RZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, Pauli gates, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$CRX$&lt;/span&gt; etc) starting from the &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a general algorithm for that? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More Precisely, I'm interested in the length of such circuit and the numbers of gates (in worst case) according to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea or reference on the subject? I'm a bit lost here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;best regards,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b&lt;/p&gt;&#xA;" OwnerUserId="8142" LastEditorUserId="434" LastEditDate="2019-07-29T13:48:48.343" LastActivityDate="2020-09-01T20:06:20.667" Title="quantum circuit with feasible gates for state preparation" Tags="&lt;circuit-construction&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6893" PostTypeId="2" ParentId="6890" CreationDate="2019-07-29T14:01:16.903" Score="1" Body="&lt;p&gt;Let's express this slightly differently. You need a unitary operation that implements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle|0\rangle\mapsto |x\rangle|H_1x\rangle.&#xA;$$&lt;/span&gt;&#xA;I'm not saying this is necessarily the best way of doing it (there will be far more insightful strategies), but you could certainly write this out for all possible values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. As such, you'd be able to write out the matrix operation corresponding to the unitary. The point is that this must work for every input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, not only for the &lt;span class=&quot;math-container&quot;&gt;$x+y+e_1$&lt;/span&gt; that is relevant to you at a specific moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you now want a more reasonable strategy to approach this calculation, just think about calculating a single bit of the ancilla, corresponding to a single row of the parity check matrix. What calculation is it you're actually performing? What does a 1 in the parity check matrix tell you? (bitwise addition of all the bits in &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; where the corresponding bit value in the row is 1). Controlled-not is great at performing bitwise addition between the two inputs, writing the output on the target qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's imagine the first row of the parity check matrix is &lt;span class=&quot;math-container&quot;&gt;$(1,0,1,1)$&lt;/span&gt;. There are 4 bit values, so we have &lt;span class=&quot;math-container&quot;&gt;$x=(x_1,x_2,x_3,x_4)$&lt;/span&gt;. Hence the inner product between the two just gives &lt;span class=&quot;math-container&quot;&gt;$x_1\oplus x_3\oplus x_4$&lt;/span&gt;. How do we compute this value with a quantum circuit?&lt;a href=&quot;https://i.stack.imgur.com/28fiL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/28fiL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-07-31T09:01:29.570" LastActivityDate="2019-07-31T09:01:29.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6894" PostTypeId="2" ParentId="6887" CreationDate="2019-07-29T14:08:23.250" Score="2" Body="&lt;p&gt;&lt;code&gt;transpile&lt;/code&gt; has a parameter called &lt;code&gt;optimization_level&lt;/code&gt;, which can be set to either 0, 1, 2, or 3. Depending on what &lt;code&gt;optimization_level&lt;/code&gt; is set to, the transpiler will apply a list of passes which alter or analyze the circuit in some way. By default, the &lt;code&gt;optimization_level&lt;/code&gt; is set to 1. You can view all of the passes that are applied to a circuit depending on that level &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/transpiler/preset_passmanagers&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the &lt;code&gt;initial_layout&lt;/code&gt;, I would try setting the layout to include the entire list of qubits in the device, and not just the ones that you will be changing. I believe this should make the circuit use the qubits you want.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-07-29T14:08:23.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6895" PostTypeId="1" AcceptedAnswerId="6896" CreationDate="2019-07-29T16:09:07.830" Score="3" ViewCount="98" Body="&lt;p&gt;I'm looking at the following lecture notes where we start with the circuit below for some state &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle_L$&lt;/span&gt; that picks up an error to become &lt;span class=&quot;math-container&quot;&gt;$E\vert\psi\rangle_L$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3pciJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3pciJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is later claimed in the notes that the syndrome extraction part of the circuit can be represented by the following operation on &lt;span class=&quot;math-container&quot;&gt;$E\vert\psi\rangle_L$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E|\psi\rangle_{L}|0\rangle_{A} \rightarrow \frac{1}{2}\left(I_{1} I_{2}+Z_{1} Z_{2}\right) E|\psi\rangle_{L}|0\rangle_{A}+\frac{1}{2}\left(I_{1}I_{2}-Z_{1} Z_{2}\right) E|\psi\rangle_{L}|1\rangle_{A}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one see this? I can write the Hadamard and the control &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; gates as 8x8 matrices but this seems like a tedious way to do it. The alternative is to express the control &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; gates using something like &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5181/4831&quot;&gt;this answer&lt;/a&gt;. However, I was unable to do it this way either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the question is - how do I see that the following line is true just by looking at the circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E|\psi\rangle_{L}|0\rangle_{A} \rightarrow \frac{1}{2}\left(I_{1} I_{2}+Z_{1} Z_{2}\right) E|\psi\rangle_{L}|0\rangle_{A}+\frac{1}{2}\left(I_{1}I_{2}-Z_{1} Z_{2}\right) E|\psi\rangle_{L}|1\rangle_{A}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2019-07-29T18:53:13.813" Title="Going from a circuit to the quantum state output of the circuit" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6896" PostTypeId="2" ParentId="6895" CreationDate="2019-07-29T18:53:13.813" Score="5" Body="&lt;p&gt;Let's represent controlled &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; gate in the projector formalism, as described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5181/4831&quot;&gt;this answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_AZ_1Z_2 = |0\rangle\langle0|_A I_1I_2 + |1\rangle\langle1|_A Z_1Z_2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This just tells you to apply identity gates to qubits 1 and 2 if the ancilla is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and to apply Z gates to qubits 1 and 2 if the ancilla is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state - which is the definition of the controlled gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's apply this to the state &lt;span class=&quot;math-container&quot;&gt;$\color{blue}{|+\rangle}_{A}E|\psi\rangle_{L}$&lt;/span&gt; (this is the state of the system after the first Hadamard gate of syndrome extraction):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_AZ_1Z_2 \big( \color{blue}{|+\rangle}_{A}E|\psi\rangle_{L} \big) = \big( \color{blue}{|0\rangle\langle0|}_A I_1I_2 + \color{blue}{|1\rangle\langle1|}_A Z_1Z_2 \big) \bigg( \frac{1}{\sqrt2}\color{blue}{(|0\rangle + |1\rangle)}_AE|\psi\rangle_{L} \bigg) = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{\sqrt2} \big( \color{blue}{|0\rangle}_A \otimes I_1I_2 E|\psi\rangle_{L} + \color{blue}{|1\rangle}_A \otimes Z_1Z_2 E|\psi\rangle_{L} \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, apply the last Hadamard gate to the ancilla; after that the state of the system becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt2} \big( \color{blue}{|+\rangle}_A \otimes I_1I_2 E|\psi\rangle_{L} + \color{blue}{|-\rangle}_A \otimes Z_1Z_2 E|\psi\rangle_{L} \big) = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{2} \big( \color{blue}{(|0\rangle + |1\rangle)}_A \otimes I_1I_2 E|\psi\rangle_{L} + \color{blue}{(|0\rangle - |1\rangle)}_A \otimes Z_1Z_2 E|\psi\rangle_{L} \big) = $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(after reordering the terms and grouping same ancilla states together)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{2} \color{blue}{|0\rangle}_{A} \otimes \left(I_{1} I_{2}+Z_{1} Z_{2}\right) E|\psi\rangle_{L} + \frac{1}{2} \color{blue}{|1\rangle}_{A} \otimes \left(I_{1}I_{2}-Z_{1} Z_{2}\right) E|\psi\rangle_{L}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is exactly the state you need to get.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-29T18:53:13.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6897" PostTypeId="1" CreationDate="2019-07-29T20:42:42.247" Score="3" ViewCount="41" Body="&lt;p&gt;I have been examining problems where gate timing is important. When implementing an identity gate, the issue of timing has resulted in a few verification experiments to compare the gate time to that of a u3(0,0,0) gate. According to the source code, the identity gate should be equivalent to a u3(0,0,0) gate; however, when comparing a series of identity operations via a Ramsey experiment to a series of u3(0,0,0) operations, they do not match up. It appears that the identity gate is approximately half the time of the u3 gate. While I have been able to verify the timing through experiments, my concern is that there seems to be a discrepancy between my experiments and the documentation. Can someone please verify my findings?&lt;/p&gt;&#xA;" OwnerUserId="8146" LastActivityDate="2019-07-29T20:42:42.247" Title="Identity Gate Timing Discrepancy" Tags="&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6898" PostTypeId="1" AcceptedAnswerId="6899" CreationDate="2019-07-30T14:35:56.333" Score="5" ViewCount="498" Body="&lt;p&gt;Suppose we have a stabilizer group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt;, the Knill-Laflamme condition for error correction states&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;An error with Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{E_k\}$&lt;/span&gt; is correctable if either &lt;span class=&quot;math-container&quot;&gt;$$E^\dagger_kE_l\in\mathcal{M}\quad\forall\, k,l $$&lt;/span&gt; or there exists &lt;span class=&quot;math-container&quot;&gt;$M\in\mathcal{M}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\{M,E_k^\dagger E_l\}=0\quad\forall \,k,l $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I really don't understand how either of these conditions being true helps us correct errors. Every source I can find then goes on and talks about if an error &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; occurs that anticommutes with some &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ME|\psi\rangle=-E|\psi\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so we measure &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and hence we can correct &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. But I fail to see how this is what the condition is talking about, &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; here seems to be some unitary and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; anticommutes with it, while the condition talks about Kraus operators and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; anticommuting with products of them, if the error of the condition occurs I expect a transformation like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=|\psi\rangle\langle \psi|\rightarrow\rho'=\sum_k E_k|\psi\rangle\langle\psi|E_k^\dagger $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which in general cannot be expressed as &lt;span class=&quot;math-container&quot;&gt;$E|\psi\rangle$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. Moreover, in this case I cannot see how &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; anticommuting with &lt;span class=&quot;math-container&quot;&gt;$E_k^\dagger E_k$&lt;/span&gt; helps us correcting the error, or for that matter how &lt;span class=&quot;math-container&quot;&gt;$E_k^\dagger E_l$&lt;/span&gt; being in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; helps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I see how the conditions allow us to detect and correct errors? &lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2019-07-30T17:38:23.973" LastActivityDate="2020-07-28T11:18:26.127" Title="Knill-Laflamme condition and requirements for error correction" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6899" PostTypeId="2" ParentId="6898" CreationDate="2019-07-30T15:16:04.227" Score="3" Body="&lt;p&gt;I believe that this is actually two separate questions; I'll try to explain the issue concerning errors as channels with multiple Kraus operators instead of unitaries first:&lt;/p&gt;&#xA;&lt;p&gt;You are correct in saying that errors, in general, are not unitary operations. Rather, they are quantum channels that most often have more than 1 Kraus operators. Consider, for instance, the dephasing channel, which has Kraus operators:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;A_{1} = (\sqrt{1-p}I, A_{2} = \sqrt{p}Z,&#xA;\end{equation}&lt;/span&gt;&#xA;i.e. some channel that does nothing with probability &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt; and applies a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation that is applied with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If we start with some pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;, after this channel we will have some statistical mixture &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$I|\psi\rangle\langle\psi|I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z|\psi\rangle\langle\psi|Z^{\dagger}$&lt;/span&gt;. How can we ever happen to correct this?&lt;/p&gt;&#xA;&lt;p&gt;The trick is, that we measure (for instance, by stabilizer measurement) if an error has happened. Lets say that we have entangled the qubit with another qubit (the &lt;em&gt;ancilla&lt;/em&gt;) in such a way that the ancilla is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state when a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; error/unitary has happened, whereas it is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state when nothing (i.e. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;) has happened. What does our state look like, &lt;strong&gt;before measurement?&lt;/strong&gt;. Well:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_{total} = (1-p)I|\psi\rangle\langle\psi|I \otimes |0\rangle_{anc} + pZ|\psi\rangle\langle\psi|Z^{\dagger} \otimes |1\rangle_{anc}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Now comes the trick:&lt;/strong&gt; we only measure the ancilla. Upon this measurement, our (data) qubit state &lt;em&gt;collapses&lt;/em&gt; to either &lt;span class=&quot;math-container&quot;&gt;$I|\psi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z|\psi\rangle$&lt;/span&gt;. By measuring the (possible) error, we have forced it to discretise itself into a &lt;strong&gt;unitary&lt;/strong&gt; error! If our code is actually well designed, we can now infer from only the ancilla measurements (called the &lt;em&gt;error syndrome&lt;/em&gt;) if, and what kind of error there happed.&lt;/p&gt;&#xA;&lt;p&gt;Now, on to the first part: we can always write any set of Kraus operators as a linear combination of unitaries; for simplicity we always use the Paulis. If our code can correct these Paulis, it can also correct any linear combination of these Paulis (because measuring if anything happened discretises the error into these Paulis. So we don't need to keep track of all possible (literally uncountably many) different Kraus operations, but only a (relatively) small discrete set of Paulis (or other unitaries if you want to)!&lt;/p&gt;&#xA;&lt;p&gt;Can we then correct all errors? No, unfortunately not. We can never, with one stabilizer code, correct for &lt;em&gt;all&lt;/em&gt; different Paulis, but only a subset &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, called the set of correctable errors. So if (at least) one of our Kraus operators can't be written as a linear combination of only elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, we can't correct for that Kraus operator.&lt;/p&gt;&#xA;&lt;p&gt;The conditions you use for QECC's are a bit finicky I believe; the first one is (somewhat) like the actual Knill-LaFlamme conditions, the other one only applies to the (subclass) of &lt;em&gt;stabilizer codes&lt;/em&gt; (although most people only consider these types of codes). Also, I don't think it matters very much concerning your confusion.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-07-28T11:18:26.127" LastActivityDate="2020-07-28T11:18:26.127" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="6900" PostTypeId="1" AcceptedAnswerId="6901" CreationDate="2019-07-30T22:54:58.067" Score="11" ViewCount="1723" Body="&lt;p&gt;Of course I am not implying that I am right and the no cloning theorem is wrong, but I am trying to figure out what is wrong with my reasoning and yet I couldn't find the mistake.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In physics, the no-cloning theorem states that it is impossible to create an identical copy of an arbitrary unknown quantum state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So we start with a standard qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with completely unknown state where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \alpha |0\rangle + \beta|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That qubit has probability &lt;span class=&quot;math-container&quot;&gt;$\alpha^2$&lt;/span&gt; of being &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and probability &lt;span class=&quot;math-container&quot;&gt;$\beta^2$&lt;/span&gt; of being 1 and if I understand the theory correctly it will not be possible to duplicate this qubit without knowing both  &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we plug this qubit along with a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; into a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; it seems to me that we end up with 2 identical qubits, each of them has probability &lt;span class=&quot;math-container&quot;&gt;$\alpha^2$&lt;/span&gt; of being &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and probability &lt;span class=&quot;math-container&quot;&gt;$\beta^2$&lt;/span&gt; of being 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the math:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT |\psi, 0\rangle = \\&#xA;CNOT [(\alpha |0\rangle + \beta|1\rangle)\otimes |0\rangle] = \\&#xA;\begin{bmatrix}1&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0\\0&amp;amp;&amp;amp;1&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;1\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;1&amp;amp;&amp;amp;0\end{bmatrix} \begin{pmatrix}\alpha\\\beta\end{pmatrix}\otimes \begin{pmatrix}1\\0\end{pmatrix} =\\&#xA;\begin{bmatrix}1&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0\\0&amp;amp;&amp;amp;1&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;1\\0&amp;amp;&amp;amp;0&amp;amp;&amp;amp;1&amp;amp;&amp;amp;0\end{bmatrix} \begin{pmatrix}\alpha\\0\\\beta\\0\end{pmatrix} =\\&#xA;\begin{pmatrix}\alpha\\0\\0\\\beta\end{pmatrix} = \alpha \begin{pmatrix}1\\0\\0\\0\end{pmatrix}+\beta \begin{pmatrix}0\\0\\0\\1\end{pmatrix}=\\&#xA;\alpha |00\rangle + \beta |11\rangle&#xA;$$&lt;/span&gt;&#xA;So the result becomes 2 exactly identical qubits, both have identical probabilities of being zero and identical probabilities of being one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I am sure  that the no-cloning theorem can't be wrong, I am asking what is wrong with my reasoning.  &lt;/p&gt;&#xA;" OwnerUserId="8157" LastEditorUserId="8157" LastEditDate="2019-07-31T17:12:11.963" LastActivityDate="2019-12-31T21:10:00.227" Title="Why isn't there a contradiction between the existence of CNOT gate/entanglement and the no-cloning theorem?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;no-cloning-theorem&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6901" PostTypeId="2" ParentId="6900" CreationDate="2019-07-30T23:36:00.327" Score="14" Body="&lt;p&gt;The cloning theorem requires that the result of the cloning is two &lt;em&gt;independent&lt;/em&gt; copies of the starting qubit, i.e., the state of the system in the end should be &lt;span class=&quot;math-container&quot;&gt;$\big(\alpha |0\rangle + \beta |1\rangle \big) \otimes \big(\alpha |0\rangle + \beta |1\rangle \big)$&lt;/span&gt;. This is not the state CNOT will give you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The qubits you get after applying CNOT as you described do not, in fact, gave identical probabilities of measuring 0 and 1: as soon as you measure the first qubit, the measurement result of the second qubits will always the measurement result of the first qubit! If you were able to actually clone the qubit, the measurement results of the second qubit would not depend on the results of measuring the first one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You can also browse &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/no-cloning-theorem&quot;&gt;other questions about no-cloing theorem&lt;/a&gt; to find different explanations.)&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-07-30T23:36:00.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6902" PostTypeId="2" ParentId="6888" CreationDate="2019-07-31T08:54:09.780" Score="2" Body="&lt;p&gt;Note that the ancilla qubit in your example has dimension 2, not 1, because it goes into a superposition of 2 basis states, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the HHL algorithm, you need an ancilla capable of recording the three options &quot;nothing&quot;, &quot;well&quot; and &quot;ill&quot;. As such, you need a Hilbert space of dimension 3 (also called a qutrit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it is true that in the equation you've written, it appears as if they're only using a two-dimension system spanned by &quot;well&quot; and &quot;ill&quot;, but that's just because you're only taking a snapshot of the process at a particular moment (presumably when you've post-selected on that ancilla not being in the &quot;nothing&quot; state, since that's part of the repeat until success procedure).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-31T08:54:09.780" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6903" PostTypeId="1" AcceptedAnswerId="6904" CreationDate="2019-07-31T08:59:29.433" Score="8" ViewCount="2625" Body="&lt;p&gt;The Gottesman-Knill theore states (from Nielsen and Chuang)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose a quantum computation is performed which involves only the following elements: state preparations in the computational basis, Hadamard gates, phase gates, controlled-NOT gates, Pauli gates, and measurements of observables in the Pauli group (which includes measurement in the computational basis as a special case), together with the possibility of classical control conditioned on the outcome of such measurements. Such a computation may be efficiently simulated on a classical computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How does this not render quantum computation largely useless? I understand that the Toffoli gate cannot be generated by the Clifford gates, but nonetheless there are important algorithms that do not use the Toffoli gate, for instance Shor's algorithm, Grover's algorithm, quantum teleportation and I'm sure many more. It seems to me that due to this theorem, we should be able to factor numbers in polynomial time using a classical computer, by simulating Shor's algorithm, or order finding specifically, yet Shor's algorithm is celebrated as one of the most important quantum advantages, so I guess this is not possible, but why?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="2927" LastEditDate="2020-02-01T00:29:34.020" LastActivityDate="2020-02-01T00:29:34.020" Title="Why doesn't the Gottesman-Knill theorem render quantum computing almost useless?" Tags="&lt;simulation&gt;&lt;nonclassicality&gt;&lt;gottesman-knill&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6904" PostTypeId="2" ParentId="6903" CreationDate="2019-07-31T09:30:49.753" Score="12" Body="&lt;p&gt;To my mind, this theorem is not very well stated in this form, if taken out of context. Where it says &quot;phase gates&quot;, this may be misleading. It means specifically just &lt;span class=&quot;math-container&quot;&gt;$S=\sqrt{Z}$&lt;/span&gt; and not what I think of as a phase gate, which can have an arbitrary phase (but they have very specifically introduced their terminology about 3 pages earlier). This is a key difference as it means that the Toffoli gate that is not the only one missing from this gate set. Most single-qubit gates are also missing. The most commonly cited example is the &lt;span class=&quot;math-container&quot;&gt;$T=\sqrt{S}$&lt;/span&gt; gate,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T=\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\pi/4} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Any efficient quantum algorithm (which doesn't have an efficient classical counterpart), such as Shor's algorithm, include a gate that is not in this set of gates. For example, Shor's algorithm includes the quantum Fourier transform (in that specific context, you'd probably use the semi-classical version) for which you have to implement phase gates with phases &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/16$&lt;/span&gt;... whose implementation cannot be efficiently simulated. (In the standard, not semi-classical, version, you need controlled-phase-gates with identical phases).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, a comment about a couple of your other examples is warranted:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;quantum teleportation: this is a specific method that achieves a particular quantum task using, and providing, specific resources (bell pair+2 bits of classical communication=transmission of one unknown qubit state). You might be able to simulate it on a classical computer (&lt;em&gt;if&lt;/em&gt; you had a good description of the input state), but the resources would be different. This is not a question about scaling properties of an algorithm, so the basic argument of the Gottesman-Knill theorem is irrelevant.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum search. Quantum search generally does include Toffoli gates. However, the point that I wanted to make here is that quantum search does not exhibit an exponential speed-up, but only a polynomial speed-up. So there's no problem doing a classical simulation of it with polynomial overhead. The Gottesman-Knill theorem is only relevant to rule out the possibility of an exponential (or, at least, super-polynomial) speedup over the classical case.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-31T09:30:49.753" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6906" PostTypeId="1" AcceptedAnswerId="6908" CreationDate="2019-07-31T15:59:14.833" Score="2" ViewCount="149" Body="&lt;p&gt;I am reading some quantum papers (In particular, &lt;a href=&quot;https://eprint.iacr.org/2017/1080.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt; page 34) . One of the theorem statement reads, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; &quot;For every CPTP operator M, we have that .... &quot; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that we usually apply unitary operations on quantum states. Is completely positive trace preserving (CPTP) operator same as unitary operator? What's the difference between them? What's the advantage of proving theorems for CPTP operators rather than unitary operators?&lt;/p&gt;&#xA;" OwnerUserId="8014" LastEditorUserId="8014" LastEditDate="2019-07-31T16:42:11.037" LastActivityDate="2019-07-31T18:36:20.383" Title="Are CPTP operators and unitary operators the same thing?" Tags="&lt;quantum-operation&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6907" PostTypeId="1" AcceptedAnswerId="6909" CreationDate="2019-07-31T18:21:44.750" Score="5" ViewCount="258" Body="&lt;p&gt;I have several (rather basic) questions on matrix representation of circuits and I would be very grateful to anyone that could clear up my confusion, thank you in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) When reading circuit diagrams I know that the input qubit goes in the left hand side. So If we are reading a circuit and it's gates go in the order a,b,c  does that mean when we want to write out its matrix representation we multiply the matrices in the order c,a,b . For example if we have a circuit which consists of a swap gate followed by a Hadamard gate on the second qubit , followed by a Hadamard gate on the first qubit , then to calculate it's matrix representation we would have to calculate it in the order &lt;span class=&quot;math-container&quot;&gt;$(H_1\otimes I)(I\otimes H_2)Swap$&lt;/span&gt;, correct ? (as this reflects the order of application of gates on the qubit state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)If we are given a gate &lt;span class=&quot;math-container&quot;&gt;$S=\begin{pmatrix}1 &amp;amp;0 \\0 &amp;amp;i \end{pmatrix}$&lt;/span&gt;, but it is on the top line of a two line circuit with a line connecting it to the second (In other words it's a control gate ), I know that the first qubit is the control and the second is the target but I'm unsure of how to write it , should it be &lt;span class=&quot;math-container&quot;&gt;$S=\begin{pmatrix}1 &amp;amp; 0 &amp;amp;0&amp;amp;0 \\ 0 &amp;amp;-i &amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;-i \end{pmatrix}$&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;or should it be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ S=\begin{pmatrix}1 &amp;amp; 0 &amp;amp;0&amp;amp;0 \\ 0 &amp;amp;1 &amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;-i&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;-i \end{pmatrix}$&lt;/span&gt;,&lt;/p&gt;&#xA;" OwnerUserId="6254" LastActivityDate="2019-07-31T20:45:44.407" Title="A basic question on circuits and matrix representation" Tags="&lt;circuit-construction&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6908" PostTypeId="2" ParentId="6906" CreationDate="2019-07-31T18:36:20.383" Score="4" Body="&lt;p&gt;Unitary operations are a subset of CPTP operations. You can think of a CPTP operation as the description of a unitary over a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1657/1837&quot;&gt;larger system&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The advantage of using CPTP maps is that you increase the generality of your statement. Think about, for example, a proof of the no-cloning theorem. People usually start talking about the input state, the target state, and an ancilla, so you want to achieve some rotation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|0\rangle|0\rangle\mapsto |0\rangle|0\rangle|a\rangle,\qquad|1\rangle|0\rangle|0\rangle\mapsto |1\rangle|1\rangle|b\rangle&#xA;$$&lt;/span&gt;&#xA;where the third system is any dimension. We then assume that the process is unitary over that whole space. This is equivalent to allowing a CPTP map on the first two systems. Why don't we just completely ignore the third system and only assume a unitary on the first two? Well, what use would our no-cloning theorem be if it turned out that by adding some extra ancillas, our proof was completely invalidated and that cloning were possible? You want to perform your proof using the full generality of what's available, which means not making any assumptions about availability of ancillas, for example.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-07-31T18:36:20.383" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6909" PostTypeId="2" ParentId="6907" CreationDate="2019-07-31T20:45:44.407" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;Yes, in the circuit the qubit &quot;enters&quot; to the left, and exits to the right, but when applying the gates to a state you must apply the one on the far left first, then the next and so on, so concretely you do write them down right to left, but it's just a consequence of writing the operator that we want to apply on the left of the vector, while our natural way of writing dictates a &quot;time direction&quot; left to right. As an example the following circuit&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mic5S.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mic5S.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;implements the operation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I\otimes \mathrm{CNOT})(\mathrm{CNOT}\otimes I)(H\otimes I\otimes I)|000\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;A controlled gate does nothing if the first qubit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and performs the gate if it is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, you can represent it this way&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CS}=|0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes S $$&lt;/span&gt;&#xA;         Hence in matrix form it would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CS}=\begin{pmatrix}&#xA;I&amp;amp;0\\0&amp;amp;S&#xA;\end{pmatrix} =\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;i&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2019-07-31T20:45:44.407" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6910" PostTypeId="1" AcceptedAnswerId="6920" CreationDate="2019-07-31T22:29:34.057" Score="2" ViewCount="235" Body="&lt;p&gt;Choi's theorem states that any completely positive map &lt;span class=&quot;math-container&quot;&gt;$\Phi(\cdot) : C^*_{n\times n} \rightarrow C^*_{m \times m}$&lt;/span&gt; can be expressed as &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho) = \sum_{j=1}^r F_j^\dagger \rho F_j$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$n \times m$&lt;/span&gt; matrices &lt;span class=&quot;math-container&quot;&gt;$F_j$&lt;/span&gt;. &#xA;In order for the map to be trace preserving one needs to have &lt;span class=&quot;math-container&quot;&gt;$\sum_j F_j F_j^\dagger = I_n$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is this trace preserving condition derived? I couldn't see it.&lt;/p&gt;&#xA;" OwnerUserId="8014" LastActivityDate="2019-08-01T14:10:53.357" Title="Trace preserving condition in Choi's thorem" Tags="&lt;density-matrix&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6911" PostTypeId="1" AcceptedAnswerId="6913" CreationDate="2019-07-31T22:59:33.860" Score="5" ViewCount="96" Body="&lt;p&gt;Complete Positive Trace Preserving Map (CPTP) operator is the most general operation that can be performed on a quantum system. This &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6906/are-cptp-operators-and-unitary-operators-the-same-thing&quot;&gt;post&lt;/a&gt; mentioned that a CPTP operator is nothing but a unitary operator on the system after adding few ancilla bits. I would like to know how to realize a given CPTP operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Choi's theorem states that any CPTP operator &lt;span class=&quot;math-container&quot;&gt;$\Phi(\cdot) : C^*_{n\times n} \rightarrow C^*_{m \times m}$&lt;/span&gt; can be expressed as &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho) = \sum_{j=1}^r F_j^\dagger \rho F_j$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$n \times m$&lt;/span&gt; matrices &lt;span class=&quot;math-container&quot;&gt;$F_j$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_j F_j F_j^\dagger = I_n$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this fact, can we come up with unitary operation corresponding to the given CPTP operator &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8014" LastEditorUserId="491" LastEditDate="2020-07-17T23:20:38.050" LastActivityDate="2020-07-17T23:20:38.050" Title="What is the unitary operator realizing a given CPTP operator" Tags="&lt;quantum-operation&gt;&lt;unitarity&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6912" PostTypeId="2" ParentId="6910" CreationDate="2019-07-31T23:27:14.557" Score="4" Body="&lt;p&gt;Recall that the trace is both linear and invariant under cyclic permutation of the operators&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{Tr}(\Phi(\rho))=\mathrm{Tr}\left(\sum_j F_j^\dagger \rho F_j\right)=\sum_j\mathrm{Tr}\left( F_j^\dagger \rho F_j\right)=\sum_j \mathrm{Tr}\left(F_jF_j^\dagger \rho \right)= \mathrm{Tr}\left(\sum_jF_jF_j^\dagger \rho \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can clearly see that if &lt;span class=&quot;math-container&quot;&gt;$\sum_jF_jF_j^\dagger=I$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\Phi(\rho))=\mathrm{Tr}(\rho)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. To prove the converse, suppose &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}(A\rho)=\mathrm{Tr}(\rho) $$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, this corresponds to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{ij}A_{ij}\rho_{ji}-\sum_i \rho_{ii}=0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By taking &lt;span class=&quot;math-container&quot;&gt;$\rho_{ij}=\delta_{ki}\delta_{lj}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A_{lk}-\delta_{lk}=0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thus &lt;span class=&quot;math-container&quot;&gt;$A=I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2019-07-31T23:27:14.557" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6913" PostTypeId="2" ParentId="6911" CreationDate="2019-07-31T23:38:15.067" Score="5" Body="&lt;p&gt;An isometry &lt;span class=&quot;math-container&quot;&gt;$U:S\rightarrow S\otimes E$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is your system and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is an environment, such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}_E(U\rho U^\dagger)=\Phi(\rho)$$&lt;/span&gt; is called a Stinespring dilation of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;. An easy way to construct a Stinespring dilation from the Kraus operators is to consider &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_E=\mathrm{span}\{|j\rangle\}_{j=1}^r$&lt;/span&gt; and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=\sum_j F_j^S\otimes|j\rangle^E $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it is easy to see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}_E(U\rho U^\dagger)= \mathrm{Tr}_E\left(\sum_jF_j\rho F_k^\dagger \otimes |j\rangle\langle k|\right)= \sum_jF_j\rho F_j^\dagger=\Phi(\rho)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but notice that since the set of Kraus operators for a channel is not unique, neither is the Stinespring dilation.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2020-05-26T09:24:26.790" LastActivityDate="2020-05-26T09:24:26.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6914" PostTypeId="2" ParentId="6002" CreationDate="2019-08-01T01:22:11.827" Score="0" Body="&lt;p&gt;To answer my own question after all this time …… The circuit &lt;span class=&quot;math-container&quot;&gt;$(H_1 \otimes H_2\otimes H_3)(I \otimes Z_2\otimes I)(I \otimes CNOT_{32})(CNOT_{21}\otimes I)(I \otimes H_2\otimes I)|000&amp;gt; $&lt;/span&gt; accomplishes the task , the reason being that we know we want a square root two out at the front hence the first Hadamard, it also allows us to begin building &lt;span class=&quot;math-container&quot;&gt;$|111&amp;gt;$&lt;/span&gt; we finish of building that with the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates then we want to change the sign so we apply a phase gate and finally three hadamards to get &lt;span class=&quot;math-container&quot;&gt;$|+++&amp;gt;,|---&amp;gt;$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|000&amp;gt;,|111&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6254" LastActivityDate="2019-08-01T01:22:11.827" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6915" PostTypeId="1" CreationDate="2019-08-01T02:04:19.823" Score="5" ViewCount="161" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6799/a-quantum-computer-that-doesnt-use-entangled-qubits-has-the-same-computational?noredirect=1&amp;amp;lq=1&quot;&gt;Many&lt;/a&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2674/is-entanglement-necessary-for-quantum-computation&quot;&gt;good&lt;/a&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5733/quantum-speedup-without-entanglement?rq=1&quot;&gt;questions&lt;/a&gt; on this site have explored how entanglement lies at the boundary between the quantum world and the classical. For example in computational speedups, or teleportation or superdense coding, at least two qubits are entangled in some form or another, and entanglement seems to be at the heart of, or required for, the quantum improvement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The no-cloning theorem, on the other hand, is a statement applicable to even a single qubit.  Nonetheless, there is no classical analogue of the no-cloning theorem, and yet the no-cloning theorem can be the basis for interesting applications of quantum mechanics/quantum information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two &quot;entanglement-free&quot; applications of the no-cloning theorem that come to immediate mind are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Weisner's &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_money&quot; rel=&quot;noreferrer&quot;&gt;quantum money&lt;/a&gt; scheme, which begat&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;noreferrer&quot;&gt;BB84&lt;/a&gt; quantum key distribution scheme.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Although there are &quot;entangled&quot; versions of the above (e.g. the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution#E91_protocol:_Artur_Ekert_.281991.29&quot; rel=&quot;noreferrer&quot;&gt;E91&lt;/a&gt; scheme), the &quot;entanglement-free&quot; versions are just as valid applications of qubits.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can qubits that are &lt;em&gt;not&lt;/em&gt; entangled and instead in a product state be used in other interesting applications, in a manner that does not seem to have a classical analogue?  &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If so, are the applications merely also a version of the no-cloning theorem, or is there some other aspect of quantum information theory at play?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-04-27T16:04:10.550" Title="In what ways can qubits be used for applications that do not require entanglement?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;&lt;no-cloning-theorem&gt;&lt;superdense-coding&gt;&lt;key-distribution&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6916" PostTypeId="2" ParentId="6915" CreationDate="2019-08-01T07:09:44.293" Score="4" Body="&lt;p&gt;Certainly not exhaustive, but to get the ball rolling...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible application is &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0025-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;blind quantum computation&lt;/a&gt;. In this, there is a user who wants to complete a computation, but only has the capability of producing single-qubit (non-entangled) states. These are sent to a server who can (locally) entangle them for the purposes of performing a measurement-based quantum computation. However, the trick is that the server never find out what computation is being performed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, it seems likely that any security-related protocol will be using the indistinguishability of non-orthogonal states to achieve part of that security, and hence you can relate it to no-cloning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moving away from security-related applications, one might think about quantum metrology. Usually, quantum metrology is referring to the enhancement in measurement achieved by using entangled states. However, think about a qubit whose energy gap between &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is affected by a magnetic field. If you prepare many qubits in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state, leave them for some time in the magnetic field, and then measure how many are in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state, you get a measurement of the magnetic field. This might almost be considered a classical technique, and is more or less the process that goes on inside e.g. MRI machines. This would not seem to have anything to do with no-cloning.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-01T07:09:44.293" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6917" PostTypeId="1" AcceptedAnswerId="6926" CreationDate="2019-08-01T07:22:26.477" Score="2" ViewCount="173" Body="&lt;p&gt;I understand that, according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;nofollow noreferrer&quot;&gt;amplitude amplification&lt;/a&gt;, I can amplify states according to a partition over the state space. However, suppose I want to amplify or de-amplify a specific portion of the state after putting it into a superposition, (e.g. I have &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2\sqrt(2)}\sum_{x=000}^{111}\left|x\right&amp;gt;$&lt;/span&gt; and I want to amplify/de-amplify &lt;span class=&quot;math-container&quot;&gt;$\left|000\right&amp;gt;$&lt;/span&gt;). Is this possible without amplitude amplification?&lt;/p&gt;&#xA;" OwnerUserId="5472" LastActivityDate="2019-08-02T07:33:29.437" Title="How to amplify a specific part of the quantum state" Tags="&lt;superposition&gt;&lt;amplitude-amplification&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6918" PostTypeId="1" CreationDate="2019-08-01T09:43:40.957" Score="0" ViewCount="110" Body="&lt;p&gt;How to increase the amplitude of a specific quantum state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If my quantum circuit produces the state &lt;span class=&quot;math-container&quot;&gt;$a|0000\rangle+b|0011\rangle$&lt;/span&gt;, how to make &lt;span class=&quot;math-container&quot;&gt;$b&amp;gt;a$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6098" LastEditorUserId="55" LastEditDate="2019-08-02T09:25:29.753" LastActivityDate="2019-08-02T09:25:29.753" Title="If I have a state $a|0000\rangle+b|0011\rangle$, how do you change it to make $b&gt;a$?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6919" PostTypeId="2" ParentId="6917" CreationDate="2019-08-01T10:25:00.160" Score="0" Body="&lt;p&gt;There is a method called &lt;em&gt;inversion about the mean&lt;/em&gt;, which is used in Grover's search algorithm (and many more algortihms). In Grover's search algorithm, the preferred outcome (e.g. what you are searching for) is a certain measurement outcome. To increase the possibility of this outcome (compared to other outcomes), the probability of this outcome (e.g. its amplitude) is increased through this 'inversion about the mean' method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially what it does, is flipping (through phase-inversion) a certain outcome's phase (in your case the &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; state)  about the mean of all the states. Then this outcome is further apart from the mean - updating all the states in some way that bring them close to the mean then can increase the amplitude of this outcome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A nice introduction can be found &lt;a href=&quot;http://akyrillidis.github.io/notes/quant_post_9&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but it doesn't have any graphical explanation. That can be found &lt;a href=&quot;https://pdfs.semanticscholar.org/fc9b/39d0a71fc32b9e0c292346e88a03df6d18ef.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here instead&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-08-01T10:25:00.160" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6920" PostTypeId="2" ParentId="6910" CreationDate="2019-08-01T11:01:38.523" Score="3" Body="&lt;p&gt;This is a slight variation of the ideas behind &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6912/55&quot;&gt;the other answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\Phi(\rho))=\operatorname{Tr}(\rho)$&lt;/span&gt; for all states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; (read, all positive trace-1 operators) is equivalent to &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\Phi(X))=\operatorname{Tr}(X)$&lt;/span&gt; holding for &lt;em&gt;all&lt;/em&gt; operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (essentially because any operator can be written as a linear combination of positive operators, and the trace operation is linear).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\sum_k A_k X A_k^\dagger$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\Phi(X))=\operatorname{Tr}(X)$&lt;/span&gt; is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}\left[X\left(\sum_k A_k^\dagger A_k\right) \right]=\operatorname{Tr}(X).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because this must hold for any operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, we can see what it amounts to for &lt;span class=&quot;math-container&quot;&gt;$X=\lvert i\rangle\!\langle j\rvert$&lt;/span&gt;.&#xA;Noting that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}[|i\rangle\!\langle j| B]=\langle j|B| i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}[|i\rangle\!\langle j|]=\delta_{ij}$&lt;/span&gt;, this gives us&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle i|\sum_k A_k^\dagger A_k |j\rangle=\delta_{ij}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is nothing but the componentwise version of &lt;span class=&quot;math-container&quot;&gt;$\sum_k A_k^\dagger A_k=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Note that here I used a slightly different notational convention for the Kraus decomposition than the one used in the original post. The reason is simply that I am more used to this one, but you might simply replace each &lt;span class=&quot;math-container&quot;&gt;$A_k\to A_k^\dagger$&lt;/span&gt; switch between the two conventions.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-08-01T14:10:53.357" LastActivityDate="2019-08-01T14:10:53.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6921" PostTypeId="1" AcceptedAnswerId="6924" CreationDate="2019-08-01T11:13:09.583" Score="0" ViewCount="203" Body="&lt;p&gt;Does the simulator of the IBM-Q supercomputer involves a CNOT gate error rate ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the main differences reasons in outcome between simulators and real backends in IBM-Q ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best,&lt;/p&gt;&#xA;" OwnerUserId="7405" LastActivityDate="2019-08-01T14:37:38.703" Title="Gate error in IBM-Q simulator vs real backend" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6922" PostTypeId="1" CreationDate="2019-08-01T13:21:49.827" Score="2" ViewCount="140" Body="&lt;p&gt;I have noticed that a few papers, such as &lt;a href=&quot;https://pdfs.semanticscholar.org/f917/bce4c341a6601dc4a4aa8a41452c6ee82054.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;, provide models two for typical noise that a qubit encounters during network transmission:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Λ is &lt;strong&gt;the dephasing channel&lt;/strong&gt;&lt;br /&gt;&#xA;Λ(ρ) = Pq(ρ) = qρ + (1 − q)ZρZ&lt;br /&gt;&#xA;&lt;em&gt;where ρ is a single qubit state, Z is the Pauli Z gate, and q ∈ [0, 1] is the noise parameter.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Λ is &lt;strong&gt;the depolarizing channel&lt;/strong&gt;&lt;br /&gt;&#xA;Λ(ρ) = Dq(ρ) = qρ + (1 − q)1/2&lt;br /&gt;&#xA;&lt;em&gt;where ρ is a single qubit state, 1/2 is a maximally mixed single-qubit state, and q ∈ [0, 1] is the noise parameter.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I would like to implement this in the SimulaQron program, but I don't really understand how to calculate the effect on the qubit. What exactly do I have to do to the qubit to apply this noise?&lt;/p&gt;&#xA;&lt;p&gt;Nor do I understand the value of q. My interpretation is that q would occasionally be 1, and occasionally be 0, to vary the effect on the qubit. However, if I change q probabilistically, doesn't that eliminate the point of modelling the noise?&lt;/p&gt;&#xA;" OwnerUserId="8173" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-08-01T13:43:43.940" Title="Implementing noise model in Quantum simulator" Tags="&lt;simulation&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6923" PostTypeId="2" ParentId="6922" CreationDate="2019-08-01T13:43:43.940" Score="2" Body="&lt;p&gt;It is important to realize that the depolarizing and dephasing channel (and pretty much any other noise model for that matter) &lt;strong&gt;do not represent unitary operations.&lt;/strong&gt; This means there is no unitary operation (that takes qubit states to qubit states) corresponding to these channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather, channels are more general: they map density operators to density operators. If you are not familiar with density operators (often denoted with &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;), I strongly advice you to first familiarize yourself with the concept. They are a framework that allows for the (more general than 'normal' or* &lt;em&gt;pure&lt;/em&gt; states, denoted with the ket notation:&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;) &lt;strong&gt;statistical mixtures&lt;/strong&gt;: a statistical mixture of actual pure qubit states. The population of the various pure states determines the density matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical noise channel creates statistical noise: therefore you need the density operator framework to describe these channels. As far as I am aware, the simulaqron software was not designed to account for density operators - it only works with pure states. This limits the possibility of simulating a quantum channel as a noise process significantly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only thing that would be possible tom simulate the dephasing channel is to gather statistics by repeating the same circuit over and over, but sometimes injecting a Z error (with probability &lt;span class=&quot;math-container&quot;&gt;$1-q$&lt;/span&gt;). (*see bottom note)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the depolarizing channel, a different but equivalent definition of this channel is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Lambda_{depo}(\rho) = (1-p)\rho + \frac{p}{3} X\rho X+ \frac{p}{3} Y\rho Y+ \frac{p}{3} Z\rho Z,&#xA;\end{equation}&lt;/span&gt;&#xA;so you could apply a random &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; with equal probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{p}{3}$&lt;/span&gt;, instead of only the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation as with the dephasing channel.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Note that it is customary to write the dephasing channel as &lt;span class=&quot;math-container&quot;&gt;$\Lambda_{deph}(\rho) = (1-p)\rho + p Z\rho Z$&lt;/span&gt;, so with the probabilities flipped compared to your definition.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-08-01T13:43:43.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6924" PostTypeId="2" ParentId="6921" CreationDate="2019-08-01T14:37:38.703" Score="0" Body="&lt;p&gt;The IBM Q simulator does not incorporate any error rates. The simulator is set to run in an &quot;ideal&quot; environment, so you do not see the affect of any noise or errors. It is possible to add a noise model to your simulation to have the run be closer to running on the real device, but by default this is not set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main difference between the outcomes from the simulator and the outcomes from the real devices are the effects of noise. The simulator will only ever give you your expected results, whereas the real devices will return some outcomes that are unexpected. The real devices are affected by gate errors, readout errors, general environment noise, and decoherence and relaxation of the qubits. All of these things contribute to the few unexpected outcomes from the real devices.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-08-01T14:37:38.703" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6925" PostTypeId="2" ParentId="6917" CreationDate="2019-08-01T14:42:26.623" Score="1" Body="&lt;p&gt;The probability amplitudes of a quantum system comprising of several qubits can be changed (amplified / de-amplified) with the application of suitable Rotation Gate. However, the sum of probabilities of collapsing to all possible states will remain unity, so if some states are getting amplified then others will get de-amplified. Is there any practical utility of such a gate or is it a hypothetical question?&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-08-01T14:42:26.623" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6926" PostTypeId="2" ParentId="6917" CreationDate="2019-08-02T07:33:29.437" Score="4" Body="&lt;p&gt;If you know, in advance, that the state you want to deamplify is specifically &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;, there are a couple of strategies that you could follow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, introduce an ancilla and perform the multi-controlled not, targeting the ancilla, where it is controlled off every qubit in the original state being in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. So, you'd be doing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{8}}\sum_x|x\rangle|0\rangle\mapsto \frac{1}{\sqrt{8}}\left(|000\rangle|1\rangle+\sum_{x\neq 000}|x\rangle|0\rangle\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to completely get rid of the &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; term, just measure your ancilla in the standard (0/1) basis. If you get the 0 answer, you've succeeded (here, this happens with probability 7/8). If you get the 1 answer, you've failed. You produce your state again and repeat until success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If all you want to do is decrease the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; rather than completely remove it, you can correspondingly increase your probability of success. A simple strategy is to apply the POVM/filtering operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; \alpha \end{array}\right)&#xA;$$&lt;/span&gt; &#xA;for &lt;span class=&quot;math-container&quot;&gt;$\alpha&amp;lt;1$&lt;/span&gt;. Afterwards, you'd repeat your multi-controlled-not operation to disentangle the ancilla.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These strategies are perhaps conceptually simpler to understand than amplitude amplification, and work well if the amplitude you're trying to de-amplify is small enough. However, if the amplitude you're trying to amplify is too small, you won't do any better than the scaling resulting from amplitude amplification, and you'd be much better off seeing if you can change the circuit that's producing your state so that you don't have so much of the &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; component in the first place. For instance, in your example, instead of applying &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes 3}$&lt;/span&gt;, you'd find a slightly more complicated circuit such as&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EFdRG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EFdRG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle=(\sqrt{3}|0\rangle+2|1\rangle)/\sqrt{7}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V|0\rangle=(|0\rangle+\sqrt{2}|1\rangle)/\sqrt{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-02T07:33:29.437" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6927" PostTypeId="2" ParentId="6918" CreationDate="2019-08-02T07:46:17.550" Score="3" Body="&lt;p&gt;Your question is rather unclear. Amplitude amplification is a specific algorithm that you can run, but it doesn't make any sense to apply it to the example state that you're giving.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You don't specify whether or not the parameters &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; are known. If they are, then the task is trivial. First, apply a controlled-not from qubit 3 to qubit 4, leaving you in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle(a|0\rangle+b|1\rangle)|0\rangle.&#xA;$$&lt;/span&gt;&#xA;Now apply a unitary on qubit 3 (e.g. a Y-rotation by some angle of your choosing), so that you change to a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle(c|0\rangle+d|1\rangle)|0\rangle.&#xA;$$&lt;/span&gt;&#xA;Then you apply controlled-not again to give the final state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle(c|00\rangle+d|11\rangle).&#xA;$$&lt;/span&gt;&#xA;However, I suppose this is not what you had in mind?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, I might infer that you're intending &lt;span class=&quot;math-container&quot;&gt;$a&amp;gt;b$&lt;/span&gt;, perhaps you don't know &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt;, but all you care about is changing the coefficients so that the amplitude of the 11 component is larger than that of the 00 component. In that case, it's even easier: apply Pauli X on both qubits 3 and 4. It'll convert you to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle(b|00\rangle+a|11\rangle),$$&lt;/span&gt;&#xA;satisfying those requirements.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-02T07:46:17.550" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6928" PostTypeId="1" CreationDate="2019-08-02T13:11:26.970" Score="3" ViewCount="99" Body="&lt;p&gt;What are the advantages and applications of using the resource theory approach in QIP ? What specific problems can be solved using in particular this approach ?&lt;/p&gt;&#xA;" OwnerUserId="7446" LastEditorUserId="55" LastEditDate="2021-01-21T11:10:49.320" LastActivityDate="2021-01-21T11:10:49.320" Title="Why is the resource theory approach used in quantum information processing?" Tags="&lt;models&gt;&lt;resource-theories&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2021-01-22T16:06:23.937" ContentLicense="CC BY-SA 4.0" />
  <row Id="6929" PostTypeId="1" CreationDate="2019-08-02T14:15:22.613" Score="2" ViewCount="156" Body="&lt;p&gt;I have some basic questions around the theorem giving quantum error correction conditions that give necessary &amp;amp; sufficient conditions to have an error correcting operation.&lt;/p&gt;&#xA;&lt;p&gt;The theorem is stated this way (page 436 of Nielsen &amp;amp; Chuang)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Let C be a quantum code, and let P be the projector onto C.&lt;/p&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;&#xA;is a quantum operation with operation elements &lt;span class=&quot;math-container&quot;&gt;${E_i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A necessary and&#xA;sufficient condition for the existence of an error-correction&#xA;operation &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; correcting &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; on C is that &lt;span class=&quot;math-container&quot;&gt;$PE_i^{\dagger}E_jP = \alpha_{ij} P$&lt;/span&gt;, for some&#xA;Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; of complex numbers.&lt;/p&gt;&#xA;&lt;p&gt;We call the operation elements&#xA;&lt;span class=&quot;math-container&quot;&gt;${E_i}$&lt;/span&gt; for the noise &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; errors,and if such an &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; exists we say that &lt;span class=&quot;math-container&quot;&gt;${E_i}$&lt;/span&gt;&#xA;constitutes a correctable set of errors.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So said differently, we have a noise map that act as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E(\rho) = \sum_i E_i(\rho) E_i^{\dagger}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the theorem given the projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; on the code space gives us relations that the noise Kraus operator must follow to ensure us we are able to correct the error.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;My questions&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question about the theorem itself:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I take the example of a 3 dimensional code space (the one for 3qb code). If I take the noise map allowing only single bit-flips, then the theorem will tell me that I can find a recovery operation.&lt;/p&gt;&#xA;&lt;p&gt;But if I considered double or 3 bits-flip then the theorem would tell me it is not possible ? Because 3qb code can only correct single errors. Am I correct with this statement (I would like to avoid to do big calculations I want to see if I understand well the things).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question about the proof&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;He does it in two steps : sufficient condition check and then necessary check. My question is for the sufficient condition.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Results he uses:&lt;/strong&gt;&#xA;He started to show that actually we can rewrite:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$N(\rho)=\sum_i F_i \rho F_i^{\dagger} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With: &lt;span class=&quot;math-container&quot;&gt;$F_i=\sum_k u_{i,k} F_k$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is the unitary matrix that diagonalise the matrix &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; in the statement of the theorem: &lt;span class=&quot;math-container&quot;&gt;$u^{\dagger}.\alpha.u=d$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;He also says that there exist a unitary &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$F_k P= \sqrt{d_kk} U_k P$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;And then he says that &lt;span class=&quot;math-container&quot;&gt;$F_k$&lt;/span&gt; acting on the code space changes the code space. The resulting code space has a projector:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_k = U_k P U_k^{\dagger}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How was he able to find this ? I agree with the result. We indeed have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall |\psi\rangle \in C, ~ P_k \left( F_k |\psi\rangle \right) = F_k |\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But how was he able to find that the projector was this one ??&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Other question&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;He assumes in the proof that &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is not necesseraly trace-preserving: why not. But that &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is trace preserving. Why would we have &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; trace preserving but not &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-08-04T08:28:05.920" Title="Questions about theorem and proof: &quot;Quantum error correction condition&quot;, Thm 10.1 Nielsen &amp; Chuang" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6930" PostTypeId="1" AcceptedAnswerId="6933" CreationDate="2019-08-02T18:14:05.520" Score="2" ViewCount="104" Body="&lt;p&gt;If I denote by &lt;span class=&quot;math-container&quot;&gt;$U^c$&lt;/span&gt; the controlled version of the quantum operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$U^c=|0\rangle \langle 0|\otimes \mathbb{1}+|1\rangle \langle 1|\otimes U$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I can first apply &lt;span class=&quot;math-container&quot;&gt;$U^c$&lt;/span&gt; and afterward measure the control qubit. &lt;/li&gt;&#xA;&lt;li&gt;Or I can first measure the control qubit and then apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; only if&#xA;the    measurement outcome was 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a trick to save qubits when performing quantum phase estimation.&#xA;I tried to sketch this with quantum logic gates - I am not sure if I did it right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VmtlO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VmtlO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I want to show that these two methods give the same result.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp;\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)U^c|\Psi\rangle\\&#xA;&amp;amp;= \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)(|0\rangle \langle 0|\otimes \mathbb{1}+|1\rangle \langle 1|\otimes U)|\Psi\rangle\\&#xA;&amp;amp;=\frac{1}{\sqrt{2}}(|0\rangle \langle 0|0\rangle\otimes 1 + |1\rangle \langle 1|0\rangle \otimes U +|0\rangle \langle 0|1\rangle\otimes 1 +|1\rangle \langle 1|1\rangle \otimes U)|\Psi\rangle\\&#xA;&amp;amp;=\frac{1}{\sqrt{2}}(|0\rangle \otimes 1 + |1\rangle \otimes U)|\Psi\rangle&#xA; \end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope my calculations are correct. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now I can say, this is the same as measuring the control qubit and if it is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle $&lt;/span&gt; I calculate &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \otimes U |\Psi\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8189" LastEditorUserId="2879" LastEditDate="2019-08-02T19:17:34.500" LastActivityDate="2019-08-02T19:39:47.040" Title="Sketch the quantum logic gates correctly and give a proof for the identity" Tags="&lt;quantum-gate&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6931" PostTypeId="2" ParentId="6719" CreationDate="2019-08-02T18:44:59.000" Score="2" Body="&lt;p&gt;This questions seems to be less about Q# implementation and more about the algorithm itself. It is not possible to implement the transformation you described, since it is not unitary. Consider an example for just 1 bit (to distinguish between Coke and Pepsi in your example): the matrix would have to be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = \begin{bmatrix} 1.5 &amp;amp; 0 \\ 0 &amp;amp; 0.5 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the condition of it being a unitary transformation is &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = I$&lt;/span&gt;, which clearly doesn't hold:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U^\dagger U = \begin{bmatrix} 2.25 &amp;amp; 0 \\ 0 &amp;amp; 0.25 \end{bmatrix} \neq \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix} = I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a transformation with a diagonal matrix to be unitary, all elements on the diagonal must have absolute values of 1, which is not the case for your example.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you have detailed information about which outcome you want to get with which probability, you can just prepare a superposition state that will give you these outcomes with these probabilities when measured, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$0.57|Coke\rangle + 0.1|Pepsi\rangle + \alpha \sum_{other\ drinks} |drink\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(here &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is a normalization coefficient that depends on the number of other drinks you consider).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can use the Q# library operation &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.preparation.preparearbitrarystate&quot; rel=&quot;nofollow noreferrer&quot;&gt;PrepareArbitraryState&lt;/a&gt; to do this.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="1978" LastEditDate="2019-08-02T18:50:12.220" LastActivityDate="2019-08-02T18:50:12.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6932" PostTypeId="1" CreationDate="2019-08-02T18:48:46.533" Score="1" ViewCount="176" Body="&lt;p&gt;I wonder if anyone might have some insight to Mosca’s Inequality &quot;Theorem&quot;. It states to when users need to be worried about quantum computers factoring traditional cryptography. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mosca’s theorem says, “We need to start worrying about the impact of quantum computers when the amount of time that we wish our data to be secure for (X) is added to the time it will take for our computer systems to transition from classical to post-quantum (Y) is greater than the time it will take for quantum computers to start breaking existing quantum-susceptible encryption protocols.” Or X + Y &gt; Z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m having a bit of a problem understanding it, and was hoping you might be able to help. I’m not sure why Y and X are additive. It seems to me that they could easily be concurrent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if X is 10 years and Y is 5 years and Z is 10 years…if I start now on Y, won’t I have the ability to fully protect my data in Y (i.e. in 5 years)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing my example, suppose I put a quantum-susceptible key around my critical data at 0 years. In 5 years (Y), I’ll be able to put a quantum-resistant key around that data. So in Y years my data is protected and we still have 5 years (time between Y and Z) to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few people I've asked said that it is due to the fact that Z might equal a quantum adversary scooping up the data right from the start, and hence if Z is less than X, you have a problem. But I still don't understand why Y can't be or isn't parallel to X and Z?&lt;/p&gt;&#xA;" OwnerUserId="8193" LastActivityDate="2019-08-02T18:48:46.533" Title="Clarifying Mosca's Inquality Theorem - parallel vs additive" Tags="&lt;cryptography&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6933" PostTypeId="2" ParentId="6930" CreationDate="2019-08-02T19:39:47.040" Score="3" Body="&lt;p&gt;These two circuits produce the same results - in both cases you'll get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |\psi\rangle$&lt;/span&gt; with 50% probability or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \otimes U|\psi\rangle$&lt;/span&gt; with 50% probability.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;But I don't think this is going to help you with the phase estimation algorithm. In quantum phase estimation application of &lt;span class=&quot;math-container&quot;&gt;$U^c$&lt;/span&gt; is followed by inverse Fourier transform before the measurement is done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take a look at how QPE works for the case of 1 control qubit if we know that the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; (i.e., the phase estimated is either 0 or 0.5). We can use the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to make our calculations more specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse QFT for 1 qubit is just the Hadamard gate, so the circuit for QPE looks as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dNnLr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dNnLr.png&quot; alt=&quot;Quantum phase estimation for Z gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check that the measurement result will be 0 if the second qubit starts in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and 1 if it starts in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state - which allows you to estimate the phase you're looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuits you started with give you a 50-50 chance of measuring 0 or 1 on the first qubit regardless of the starting state of the second qubit, and thus do not help you estimate the phase.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-02T19:39:47.040" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="6934" PostTypeId="2" ParentId="6719" CreationDate="2019-08-03T09:57:35.140" Score="1" Body="&lt;p&gt;As far as Grover's Search Algorithm is concerned, it will amplify each marked state to the maximum possible probability (which may not be 1) and then de-amplify to minimum value cyclically depending on the number of marked states and the number of iterations. However, if the initial probability of marked states is different then they will reach their maximum probability at different iterations of the algorithm.&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-08-03T09:57:35.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6935" PostTypeId="1" AcceptedAnswerId="7119" CreationDate="2019-08-03T13:33:34.283" Score="8" ViewCount="587" Body="&lt;p&gt;The Knill Laflamme QEC conditions are stated this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider a code space &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and its associated projector &lt;span class=&quot;math-container&quot;&gt;$P_C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider a noise acting on our system: &lt;span class=&quot;math-container&quot;&gt;$E(\rho)=\sum_a E_a \rho E_a^{\dagger}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A necessary &amp;amp; sufficient condition for the existence of an error correction operation correcting &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the Knill-Laflamme QEC condition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_C E_i^{\dagger} E_j P_C=\alpha_{ij} P_C $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\alpha_{ij}$&lt;/span&gt; are coefficient of an Hermitic matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For me this mathematical condition is a little &quot;abstract&quot;. I would be interested to have some feeling about what it means geometrically on the Hilbert space.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Nielsen &amp;amp; Chuang it seems to mean that the different errors &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; are associated with orthogonal subspace that preserve the orthogonality (two orthogonal vector of the code space will still be orthogonal after an error). But I don't understand why this is equivalent to Knill-Laflamme QEC condition.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2019-08-26T12:55:28.807" LastActivityDate="2019-11-29T17:29:13.710" Title="Intuition about Knill-Laflamme QEC conditions" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6936" PostTypeId="1" AcceptedAnswerId="6945" CreationDate="2019-08-03T22:31:43.203" Score="3" ViewCount="124" Body="&lt;p&gt;I am continuing to try and fully understand the argument why Matrix inversion is BQP-complete according to the proof given in the HHL paper &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and I have hit another snag. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6615/showing-that-matrix-inversion-is-bpq-complete-hhl-algorithm&quot;&gt;here&lt;/a&gt;, I got clarification about the operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; so-defined, where eventually we get for &lt;span class=&quot;math-container&quot;&gt;$A = I - U^{-1/T}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A^{-1} = \sum_{k \geq 0} U^k e^{-k/T}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U^{3T} = I$&lt;/span&gt;. The author then writes&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This (applying &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt;) can be interpreted as applying &lt;span class=&quot;math-container&quot;&gt;$U^t$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; a geometrically-distributed random variable. [...]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure why this statement is true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I understand, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is an operator that operates on two registers, one of size &lt;span class=&quot;math-container&quot;&gt;$3T$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the number of gates, and the other register of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; initialized to &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle ^{\otimes n}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; is a matrix consisting of a convergent series of powers of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; where the coefficients are exponentials. As &lt;span class=&quot;math-container&quot;&gt;$k \rightarrow \infty$&lt;/span&gt;, the powers of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are divided by such large exponentials that they vanish. I have reasoned why &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; is given by this sum since by left/right multiplying it by &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; we get a telescoping series where the only value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; that doesn't vanish is &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point of all this is that if we apply &lt;span class=&quot;math-container&quot;&gt;$U^t$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$T+1 \leq t \leq 2T$&lt;/span&gt;, then we will be left with a state &lt;span class=&quot;math-container&quot;&gt;$|t+1 \rangle U_1 \ldots U_T |0 \rangle ^{\otimes n}$&lt;/span&gt;, where the second register will correspond to applying the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates to our initial state. I do not understand the portion of this argument consisting of interpreting the application of &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; as a geometric random variable. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover the author/s state that measuring &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; in the range &lt;span class=&quot;math-container&quot;&gt;$T+1 \leq t \leq 2T$&lt;/span&gt; occurs with probability &lt;span class=&quot;math-container&quot;&gt;$\frac {e^{-2}}{1+e^{-2}+e^{-4}}$&lt;/span&gt;, and I am not sure how they got this. Any hints appreciated in order to understand this computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Working on this I find that the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$T+1 \leq t \leq 2T$&lt;/span&gt; should be something like : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\sum_{k=T+1}^{2T}(\sum_{j=0}^{\infty}e^{-(k+3j)/T}) )/ (\sum_{n=0}^{\infty}e^{-n/T}) = (\sum_{k=T+1}^{2T}e^{-k/T}(\frac{1}{1-e^{-3/T}}))/(\frac{1}{1-e^{-1/T}})&#xA;= (\frac{1}{1-e^{-3/T}})/(\frac{1}{1-e^{-1/T}}) \sum_{j=0}^{T-1} e^{-(j+T+1)/T} = (\frac{1}{1-e^{-3/T}})/(\frac{1}{1-e^{-1/T}}) e^{-(T+1)/T}(\frac{1 - e^{-1}}{1-e^{-1/T}})$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="7481" LastEditDate="2019-08-05T06:15:27.450" LastActivityDate="2019-08-05T09:04:57.847" Title="Matrix Inversion is BQP-complete proof in HHL and the probability of measuring $T+1 \leq t \leq 2T$" Tags="&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6937" PostTypeId="2" ParentId="6248" CreationDate="2019-08-04T05:20:04.890" Score="2" Body="&lt;p&gt;Let's take a look at the part of the diffusion operator between the columns of Hadamard gates. This part is supposed to perform a conditional phase shift, giving a phase of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; and leaving the rest of the basis states unmodified.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the first circuit, the bottom 3 wires are controls, wrapped in NOT gates, i.e., they are anti-controls: the operator applied on the 4th wire from the bottom only if each of the bottom 3 wires is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. The operator performed on the 4th wire in this case is described by this circuit (two of the three NOT gates in the middle cancel right away):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k81kD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k81kD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the transformations done by this circuit to a qubit in the starting state &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha |0\rangle + \beta |1\rangle \xrightarrow{\oplus} &#xA;  \beta |0\rangle + \alpha |1\rangle \xrightarrow{\text{H}}&#xA;  \beta |+\rangle + \alpha |-\rangle \xrightarrow{\oplus}&#xA;  \beta |+\rangle - \alpha |-\rangle \xrightarrow{\text{H}}&#xA;  \beta |0\rangle - \alpha |1\rangle \xrightarrow{\oplus}&#xA; -\alpha |0\rangle + \beta |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is exactly what we're looking for - a &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; phase applied to the &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For the second circuit, the bottom 3 wires are already anti-controls, so the circuit we need to apply to the top two wires is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rjZ7k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rjZ7k.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transformation is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\alpha |0\rangle + \beta |1\rangle) \otimes |-\rangle =&#xA;  \frac{1}{\sqrt2} (\alpha |0\rangle |0\rangle - \alpha |0\rangle |1\rangle + \beta |1\rangle |0\rangle - \beta |1\rangle |1\rangle \xrightarrow{\text{CNOT}_0} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt2} (\alpha |0\rangle \color{blue}{|1\rangle} - \alpha |0\rangle \color{blue}{|0\rangle} + \beta |1\rangle |0\rangle - \beta |1\rangle |1\rangle = &#xA;(\color{blue}{-} \alpha |0\rangle + \beta |1\rangle) \otimes |-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This transformation applies the same conditional phase shift to the bottom wire and does not modify the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state of the top wire, so it turns out to be equivalent to the first circuit.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-04T05:20:04.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6938" PostTypeId="2" ParentId="6929" CreationDate="2019-08-04T08:28:05.920" Score="1" Body="&lt;p&gt;The answers to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question about the theorem itself:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the conclusion you drew is correct. But I should give you this caveat: the dimension of the code space of the 3-qubit code is two, not three, since the code space is expanded by states &lt;span class=&quot;math-container&quot;&gt;$ \left|0_{L}\right\rangle \equiv|000\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \left|1_{L}\right\rangle \equiv|111\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question about the proof&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way he obtained the projector &lt;span class=&quot;math-container&quot;&gt;$ P_k $&lt;/span&gt;, I guess, was as follows. As you have mentioned, using polar decomposition, we can find a unitary &lt;span class=&quot;math-container&quot;&gt;$ U_k $&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$ F_{k} P=\sqrt{d_{kk}} U_{k} P $&lt;/span&gt;. The effect of operation element &lt;span class=&quot;math-container&quot;&gt;$ F_k $&lt;/span&gt; is to transform state &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$ F_k \rho F_k^\dagger $&lt;/span&gt;. But if &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt; is initially in the code space (i.e. &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt; has support entirely in the code space), then we can write &lt;span class=&quot;math-container&quot;&gt;$ F_k \rho F_k^\dagger $&lt;/span&gt; equivalently as &lt;span class=&quot;math-container&quot;&gt;$ F_k P \rho P F_k^\dagger $&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$ P $&lt;/span&gt; is the projector onto the code space and therefore does nothing when applied to &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt;. So, we can do the substitution and get &lt;span class=&quot;math-container&quot;&gt;$ F_k P \rho P F_k^\dagger = d_{kk} U_k P \rho P U_k^\dagger = d_{kk} U_k \rho U_k^\dagger $&lt;/span&gt;. So we can see that the effect of &lt;span class=&quot;math-container&quot;&gt;$ F_k $&lt;/span&gt; acting on density operator in the code space is to rotate it following some unitary (up to some normalization multiplicative factor) and we conclude that the rotated state is in the subspace defined by the rotated projector as well: &lt;span class=&quot;math-container&quot;&gt;$ P_{k}=U_{k} P U_{k}^{\dagger} $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Other question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because noise process &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is not generally trace-preserving. There are many cases this may occur. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious one is that involves measurement and information-extraction from the principal system, where with respect to different measurement outcomes &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, the system evolves (or collapses) into different states and is described by different quantum operations &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_m$&lt;/span&gt;. Although when summed up, &lt;span class=&quot;math-container&quot;&gt;$\sum_m \mathcal{E}_m(\rho)$&lt;/span&gt; is trace-preserving, for each specific &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; (in case you are informed of the measurement outcome and thus able to exclude other circumstances), &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_m(\rho)$&lt;/span&gt; might not be. Of course you can argue that why wouldn't I add another normalization factor to render &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_m(\rho)$&lt;/span&gt; equal to one again, the rightfulness to not do so is perhaps for mathematical convenience. You can refer to section 8.2.4 &lt;em&gt;Axiomatic approach to quantum operations&lt;/em&gt; in the same book and see that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(\mathcal{E}_m(\rho))$&lt;/span&gt; has the interpretation of the propability that this quantum operation occurs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's more, quite often, we are not able to correct all the possible errors from a noisy channel. For example, the bit-flip channel that flips each qubit of the three independently with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; as you mentioned. Mathematically, this channel is of course trace-preserving, but it also involves terms where more than one qubit is flipped and in that case error-correcting is impossible. Therefore, in this specific example non-trace-preserving operations are essential for us to focus on the situations where only one qubit is flipped: we just discard those higher oder terms and suppose that it is the right operation with theoretical significance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, though quite a mouthful of words here, the answer in conclusion: For mathematical convenience.&lt;/p&gt;&#xA;" OwnerUserId="8131" LastActivityDate="2019-08-04T08:28:05.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6940" PostTypeId="1" AcceptedAnswerId="6944" CreationDate="2019-08-04T12:05:06.087" Score="6" ViewCount="2944" Body="&lt;p&gt;I'm trying to implement the Variational Quantum Eigensolver in Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose, I have an operator &lt;span class=&quot;math-container&quot;&gt;$A = \sigma_1^z\sigma_2^z$&lt;/span&gt; acting on some two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. After a measurement I get a set of probabilities corresponding to  states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: How to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|A|\psi\rangle$&lt;/span&gt; using known set of probabilities?&lt;/p&gt;&#xA;" OwnerUserId="6071" LastEditorUserId="55" LastEditDate="2020-12-30T10:52:29.570" LastActivityDate="2020-12-30T10:52:29.570" Title="How to calculate an Expected Value of some operator acting on qubits?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;vqe&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6941" PostTypeId="1" CreationDate="2019-08-04T16:58:45.123" Score="5" ViewCount="1182" Body="&lt;p&gt;all. I am a high-school student who has recently familiarized himself with linear algebra and is looking to understand quantum computing. So, I bought the classic textbook &quot;Quantum Computation and Quantum Information&quot; by Nielsen and Chuang. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the book, I came across the problem: find the eigenvalues and eigenvectors of the Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started out with the Pauli-X matrix and correctly found its eigenvalues to be 1 and -1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I set about finding the eigenvectors (using the standard methods of linear algebra), however, I found that for an eigenvalue of 1, any scalar multiple of (1 1) would do, and for -1, it could be any scalar multiple of (-1 1). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So suppose that a qubit has a Hamiltonian of hωX (this is an example in the book). Its energy eigenvalues are hω and -hω, and its energy eigenstates are the same as the unit eigenvectors of X. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But based on the results of my above calculation, there are two options per eigenvalue. For hω they are &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(-|0\rangle -|1\rangle)$&lt;/span&gt;, and for -hω they are &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|0\rangle - |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(-|0\rangle + |1\rangle)$&lt;/span&gt;. For each case, aren't these states distinct? Are they both right? The textbook only acknowledges the first state in each case.&lt;/p&gt;&#xA;" OwnerUserId="8202" LastEditorUserId="2879" LastEditDate="2019-08-04T17:03:00.353" LastActivityDate="2019-08-04T20:57:20.993" Title="Can there be multiple energy eigenstates corresponding to the same eigenvalue of a Hamiltonian (Pauli-X)?" Tags="&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6942" PostTypeId="2" ParentId="6941" CreationDate="2019-08-04T17:08:16.490" Score="7" Body="&lt;p&gt;The quantum states that differ by a global phase (i.e., by a complex number multiple which has absolute value of 1) are considered the same quantum state, since they can not be distinguished using any operations or measurements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, the eigenstates for hω are &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-|+\rangle = \frac{1}{\sqrt2}(-|0\rangle -|1\rangle)$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$i|+\rangle = \frac{1}{\sqrt2}(i|0\rangle + i|1\rangle)$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;and any other state you can obtain from &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; by multiplying it by a complex number and normalizing it. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The convention is usually to pick coefficients so that the state has a real positive number as the first coefficient.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-04T17:08:16.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6943" PostTypeId="2" ParentId="6941" CreationDate="2019-08-04T20:57:20.993" Score="2" Body="&lt;p&gt;For your more general question in the title, the answer is yes. This is more of a lesson in linear algebra than in quantum computing. What you found out is that actually the set of eigenvectors of a matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; corresponding to a given eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; forms a vector subspace of the space upon which &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; acts, this is called the &lt;em&gt;eigenspace&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$E_\lambda$&lt;/span&gt;. As a matter of fact, if &lt;span class=&quot;math-container&quot;&gt;$A v_1=\lambda v_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Av_2=\lambda v_2$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$A(\alpha v_1+v_2)=\lambda(\alpha v_1+v_2)$&lt;/span&gt;, hence if &lt;span class=&quot;math-container&quot;&gt;$v_1,v_2\in E_\lambda$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\alpha v_1+v_2\in E_\lambda$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\alpha \in \mathbb{C}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you might ask, are there even cases where there are two different vectors &lt;span class=&quot;math-container&quot;&gt;$v_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_2$&lt;/span&gt; that are in the same eigenspace? Well you found a trivial one, where the eigenspace is one dimensional, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ E_{\pm1}=\mathrm{span}\left(\frac{1}{\sqrt{2}}(|0\rangle\pm|1\rangle)\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;they're one dimensional vector spaces, as as you noticed you can multiply the vector by any constant and it stays an eigenvector, but consider the matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ A=\begin{pmatrix}&#xA;0&amp;amp;1&amp;amp;0\\1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you still have the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, but now it's different as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$v_1=\begin{pmatrix}1\\1\\0&#xA;\end{pmatrix}v_2=\begin{pmatrix}0\\0\\1&#xA;\end{pmatrix} $$&lt;/span&gt;&#xA;are two &lt;em&gt;linearly independent&lt;/em&gt; eigenvectors with the same eigenvalue, meaning that in this case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ E_1=\mathrm{span}(v_1,v_2)$$&lt;/span&gt;&#xA;the eigenspace is two dimensional, all linear combination of these two is an eigenvector with eigenvalue one. In this case we say that the eigenvalue is &lt;em&gt;degenerate&lt;/em&gt;, specifically twofold degenerate or with degeneracy 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most extreme example if of course the identity matrix, which has only one eigenvalue, &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and the eigenspace is the whole vector space.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2019-08-04T20:57:20.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6944" PostTypeId="2" ParentId="6940" CreationDate="2019-08-05T05:21:47.577" Score="5" Body="&#xA;&#xA;&lt;p&gt;Qiskit currently supports measurements in the computational basis from Qiskit Terra and Aer, that is, returning &lt;code&gt;1&lt;/code&gt; if the qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and &lt;code&gt;0&lt;/code&gt; if the qubit is measured to be in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is relatively easy to perform a change of basis unitary to our quantum circuit just prior to measurement, in order to instead measure in the eigenbasis of an arbitrary operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First, we need to compute the eigendecomposition of our Hermitian observable &lt;span class=&quot;math-container&quot;&gt;$A|v_i\rangle=\lambda_i|v_i\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is Hermitian, we are always able to diagonalize &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in this eigenbasis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A = \sum_{i}\lambda_i |v_i\rangle \langle v_i|= U^\dagger \Lambda U$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\Lambda = \text{diag}(\lambda_1,\dots,\lambda_n)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary matrix composed of the eigenvectors down the columns.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Next, we apply the unitary operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the end of our quantum circuit, using &lt;code&gt;qc.unitary&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see why, note that &lt;span class=&quot;math-container&quot;&gt;$$\langle\psi|A|\psi\rangle = \langle\psi|U^\dagger \Lambda U|\psi\rangle = \langle\psi'|\Lambda|\psi'\rangle $$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = U|\psi\rangle.$&lt;/span&gt;  Since &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is diagonal, we have transformed the problem from one where we must perform a measurement in an arbitrary basis, to one where we simply measure in the computational basis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, we measure the state &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; in the computational basis using &lt;code&gt;qc.measure(q, c)&lt;/code&gt;, and execute the jobs to get the counts and probabilities &lt;span class=&quot;math-container&quot;&gt;$\mathbb{P}_i = |\langle i|\psi'\rangle|^2$&lt;/span&gt;. Using the previously computed eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, we can now reconstruct the expectation value:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi | A | \psi\rangle = \langle\psi'|\Lambda|\psi'\rangle = \sum_i \langle\psi'|i\rangle \langle i | \Lambda | i\rangle \langle i|\psi'\rangle = \sum_i \lambda_i \mathbb{P}_i$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For example,&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;shots = result.results[0].shots&#xA;counts = result.get_counts()&#xA;probs = sorted([(i, c/shots) for i, c in counts.items()])&#xA;P = np.float64(np.array(probs)[:, 1])&#xA;A_expectation = lambda @ p&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For a more high-level interface to coding and running variational quantum algorithms, you can also check out the PennyLane Python library, which has a Qiskit plugin available for using Qiskit simulators and IBM hardware as a backend.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a expectation values of arbitrary operators in PennyLane using qiskit looks like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import pennylane as qml&#xA;&#xA;dev = qml.device('qiskit.basicaer', wires=2)&#xA;# use 'qiskit.ibm' instead to run on hardware&#xA;&#xA;@qml.qnode(dev)&#xA;def circuit(x, y, z):&#xA;    qml.RX(x, wires=0)&#xA;    qml.RY(y, wires=1)&#xA;    qml.RZ(z, wires=0)&#xA;    qml.CNOT(wires=[0, 1])&#xA;    return qml.expval(qml.Hermitian(A, wires=[0, 1]))&#xA;&#xA;def cost(x, y, z):&#xA;    return (1-circuit(x, y, z))**2&#xA;&#xA;# optimization follows&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can use NumPy, TensorFlow, or PyTorch to do the optimization - check out some of the tutorials.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; I am one of the developers on PennyLane.&lt;/p&gt;&#xA;" OwnerUserId="371" LastActivityDate="2019-08-05T05:21:47.577" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6945" PostTypeId="2" ParentId="6936" CreationDate="2019-08-05T09:04:57.847" Score="3" Body="&lt;p&gt;I tend to find the bit about the geometric random variable a bit misleading. What they're trying to say is that if you apply &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|\psi\rangle$&lt;/span&gt; and you measure the first register, you'll get the answer &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; with a probability that goes like &lt;span class=&quot;math-container&quot;&gt;$e^{-t/T}$&lt;/span&gt; (approximately, assuming large &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;), and that's a geometric distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I think the calculation they actually perform is the following: (the wording suggests it's an exactly calculation, but I don't believe it is)&#xA;The probability of getting answer &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is, to leading order, &lt;span class=&quot;math-container&quot;&gt;$e^{-2t/T}$&lt;/span&gt;. Hence, the probability of getting an answer &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; in the range &lt;span class=&quot;math-container&quot;&gt;$T+1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2T$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{\sum_{t=T+1}^{2T}e^{-2t/T}}{\sum_{t=1}^{3T}e^{-2t/T}}&#xA;$$&lt;/span&gt;&#xA;where I have renormalised over all the possible outputs. If we do this as a sum over a geometric progression, you get the answer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{e^{-2}(1-e^{-2})}{1-e^{-6}}.&#xA;$$&lt;/span&gt;&#xA;The numerator and denominator have a common factor of &lt;span class=&quot;math-container&quot;&gt;$1-e^{-2}$&lt;/span&gt; leaving the answer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{e^{-2}}{1+e^{-2}+e^{-4}},&#xA;$$&lt;/span&gt;&#xA;as required.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-05T09:04:57.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6947" PostTypeId="2" ParentId="4149" CreationDate="2019-08-05T13:52:18.857" Score="3" Body="&lt;p&gt;A tensor is a multi-dimensional array. A vector is a 1d tensor, a matrix is a 2d tensor, and so forth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tensor contraction is a generalization of matrix multiplication. In matrix multiplication, you pair up the second axis of the first matrix with the first axis of the second matrix and sum over their pointwise product to produce new entries. A tensor contraction allows you to pick which axes get paired up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A tensor network is a configuration of tensors and contractions, drawn as a graph where the nodes are tensors and the contractions are edges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum circuits are a kind of tensor network. The gates are matrices (a specific kind of tensor) and the qubits are series of contractions (lines connecting the tensors). In some cases even the vertical lines in a circuit diagram (e.g. the line from a CNOT's control to its target) correspond to some sort of contraction, though circuit notation has strayed far enough from tensor network notation that this is not always the case.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-08-05T13:52:18.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6948" PostTypeId="1" CreationDate="2019-08-06T00:18:48.133" Score="2" ViewCount="100" Body="&lt;p&gt;Starting with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, I would like to understand how the probability values of 85.4% &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and 14.6% &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are derived from the payload circuit below?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ni4W5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ni4W5.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After applying the 45 degree phase gate, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KaMbF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KaMbF.png&quot; alt=&quot;afterphase&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And after applying the second Hadamard, I get the original &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; value. I am interested in the specific math operations involved in the matrix multiplications.&lt;/p&gt;&#xA;" OwnerUserId="8214" LastEditorUserId="2879" LastEditDate="2019-08-06T02:21:11.480" LastActivityDate="2019-08-06T08:11:47.527" Title="Explain matrix multiplication math operations of a Hadamard gate after a phase gate" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6949" PostTypeId="2" ParentId="6948" CreationDate="2019-08-06T02:36:59.773" Score="1" Body="&lt;p&gt;You can obtain the effect of this sequence of gates as the matrix product: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H T H |0\rangle = \frac{1}{\sqrt2} \begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix} \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\pi/4}\end{bmatrix} \frac{1}{\sqrt2} \begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix} \begin{bmatrix} 1 \\ 0\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you prefer Dirac notation you can apply the gates to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state in order:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle \xrightarrow{\text{H}} \frac{1}{\sqrt2}(|0\rangle + |1\rangle) \xrightarrow{\text{T}} \frac{1}{\sqrt2}(|0\rangle + e^{i\pi/4} |1\rangle) \xrightarrow{\text{H}} \frac{1}{2}\big(|0\rangle + |1\rangle + e^{i\pi/4} (|0\rangle - |1\rangle)\big) = \frac{1}{2}\big( 1 + e^{i\pi/4} \big)|0\rangle + \frac{1}{2}\big( 1 - e^{i\pi/4} \big)|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the probabilities of measuring 0 and 1 in this state, you have to simplify the amplitudes further using the fact that &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi/4} = \frac{1 + i}{\sqrt2}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(0) = \frac{|1 + e^{i\pi/4}|^2}{|1 + e^{i\pi/4}|^2 + |1 - e^{i\pi/4}|^2} = \frac{2 + \sqrt2}{(2 + \sqrt2) + (2 - \sqrt2)} = \frac{2+\sqrt2}{4} \approx 0.8536$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-08-06T08:11:47.527" LastActivityDate="2019-08-06T08:11:47.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6950" PostTypeId="1" CreationDate="2019-08-06T02:43:49.077" Score="0" ViewCount="162" Body="&lt;p&gt;Its a Problem from &#xA;Michael Nielsen quantum computation and quantum information &lt;/p&gt;&#xA;" OwnerUserId="8216" LastEditorUserId="2879" LastEditDate="2019-08-06T08:12:37.803" LastActivityDate="2019-08-08T12:47:53.110" Title="Prove that a C2(U) gate (for any single qubit unitary U) can be constructed using at most eight one-qubit gates, and six controlled- NOTs" Tags="&lt;quantum-gate&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ClosedDate="2019-09-04T21:17:12.463" ContentLicense="CC BY-SA 4.0" />
  <row Id="6951" PostTypeId="2" ParentId="7082" CreationDate="2019-08-06T07:49:44.227" Score="7" Body="&lt;p&gt;This is a little bit fiddly and non-obvious. If you start with the given Figure 4.8, and apply the construction of Figure 4.6, with &lt;span class=&quot;math-container&quot;&gt;$AXBXC=V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V^2=U$&lt;/span&gt;, then you'll have a circuit with 8 single-qubit unitaries and 8 controlled-nots, so you're almost there.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ESlHE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ESlHE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Note that we have a lot of freedom to move the phase gates around, so I'll move them like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BaNPG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BaNPG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Now, I'm going to move the 6th cNot forward, past cNots 4 and 5. To compensate, I'm going to have to add in extra cNots. This probably requires some further explanation. The third cNOT is computing the parity of the first two qubits (which is uncomputed by the 6th), so that cNots 4 and 5 are controlled off this parity. An alternative way of achieving this is using two cNots, with the same target, controlled off qubits 1 and 2 - if the two qubits are different, one &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is applied to the target. If the two are the same, an even number of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s are applied to the target, with the net effect being identity.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dLzzA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dLzzA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Now, notice that the dashed region is diagonal, and so we can commute it past any controls (i.e. anything else that acts on the top 2 qubits). I'll move it all the way to the end for simplicity. Then you should notice that there are two pairs of controlled-nots that cancel each other, leaving the final circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yvgPD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yvgPD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An essential set of identities in verifying the functioning of this circuit is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$AXBXB^\dagger XBXC=(VC^\dagger)B^\dagger(A^\dagger V)=V(ABC)^\dagger V=V^2=U$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-08-08T12:47:53.110" LastActivityDate="2019-08-08T12:47:53.110" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6952" PostTypeId="1" CreationDate="2019-08-06T10:59:57.667" Score="6" ViewCount="76" Body="&lt;p&gt;If I want to implement the measurement operation corresponding to filtering, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_1=\left(\begin{array}{cc}1 &amp;amp; 0 \\ 0 &amp;amp; \alpha \end{array}\right)\qquad M_2=\left(\begin{array}{cc}0 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-\alpha^2} \end{array}\right),&#xA;$$&lt;/span&gt;&#xA;how would I do that?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-06T10:59:57.667" Title="Implementation of filter operation" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6953" PostTypeId="2" ParentId="6952" CreationDate="2019-08-06T10:59:57.667" Score="4" Body="&lt;p&gt;These measreuements describe a non-projective measurement. We typically convert these into projective measurements by introducing ancilla qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, define a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|0\rangle=\alpha|0\rangle+\sqrt{1-\alpha^2}|1\rangle.&#xA;$$&lt;/span&gt;&#xA;Take the qubit that we want to measure, and introduce an ancilla in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Apply controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; controlled from your qubit to be measured, and targeting the ancilla. Finally, perform a standard, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, measurement on the ancilla qubit. Answers 0 and 1 correspond to implementing &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this explicitly, consider the possible inputs of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1\rangle$&lt;/span&gt;. Everything else will follow by linearity.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|0\rangle\mapsto |0\rangle|0\rangle\qquad |1\rangle|0\rangle\mapsto |1\rangle(\alpha|0\rangle+\sqrt{1-\alpha^2}|1\rangle).&#xA;$$&lt;/span&gt;&#xA;So, input &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; always returns &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (good since &lt;span class=&quot;math-container&quot;&gt;$M_1|0\rangle=|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2|0\rangle=0$&lt;/span&gt;), while &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; returns either &lt;span class=&quot;math-container&quot;&gt;$M_1|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$M_2\rangle$&lt;/span&gt; depending on the measurement result.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-06T10:59:57.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6954" PostTypeId="1" CreationDate="2019-08-06T13:37:46.227" Score="2" ViewCount="259" Body="&lt;p&gt;In Qiskit, I am trying to perform controlled-Swap (cswap) of two registers, but an error occurs:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit import execute, IBMQ, Aer&#xA;&#xA;c = ClassicalRegister(1)&#xA;ancilla = QuantumRegister( 1 )&#xA;phi = QuantumRegister(4, 'phi')&#xA;psi = QuantumRegister(4, 'psi')&#xA;qc = QuantumCircuit(ancilla, phi, psi, c)&#xA;qc.h(ancilla)&#xA;qc.swap(phi, psi)&#xA;qc.cswap(ancilla[0], phi, psi)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The swap works, exchanging each qubit of the first register (phi) with each qubit of the second register (psi), I expected that the cswap would work in the same way but the following error occurs: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.qiskiterror.QiskitError: &quot;QuantumRegister(4, 'phi') is not a tuple.A qubit should be formated as a tuple.&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5197/why-wont-qiskit-ccx-gate-accept-registers&quot;&gt;this answer&lt;/a&gt; but it didn't help&lt;/p&gt;&#xA;" OwnerUserId="6310" LastEditorUserId="285" LastEditDate="2019-08-07T12:03:28.770" LastActivityDate="2019-08-07T12:03:28.770" Title="Why does Qiskit swap gate accept registers, but cswap doesn't?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6955" PostTypeId="1" AcceptedAnswerId="6956" CreationDate="2019-08-06T16:15:21.107" Score="6" ViewCount="409" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is a CPTP map between hermitian operators on two Hilbert spaces, then we can find a set of operators &lt;span class=&quot;math-container&quot;&gt;$\{K_j\}_j$&lt;/span&gt; such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho)=\sum_j K_j\rho K_j^\dagger $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the same spirit as any density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be decomposed in a pure states ensemble&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\sum_k p_k |\psi_k\rangle\langle\psi_k| $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\sum_k p_k=1$&lt;/span&gt; and be intepreted as a classical statistical mixture of pure states, can I always find a Kraus decomposition such that &lt;span class=&quot;math-container&quot;&gt;$K_j= \sqrt{p_j} U_j$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U_j U_j^\dagger=\mathbb{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_j p_j=1$&lt;/span&gt; and interpret it as a classical statistical mixture of unitary evolutions?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="55" LastEditDate="2021-01-21T11:05:16.660" LastActivityDate="2021-01-21T11:05:16.660" Title="Can the Kraus decomposition always be chosen to be a statistical mixture of unitary evolutions?" Tags="&lt;quantum-operation&gt;&lt;unitarity&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6956" PostTypeId="2" ParentId="6955" CreationDate="2019-08-06T16:53:46.817" Score="9" Body="&lt;p&gt;You cannot always find such a Kraus decomposition. Notice that any CPTP map &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; which does have a decomposition as a probabilistic mixture unitaries is &lt;em&gt;unital&lt;/em&gt;, which is to say that it maps the identity to the identity, and in particular it maps the maximally mixed state to the maximally mixed state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal E(\tfrac{1}{d} \mathbf 1) = \tfrac{1}{d} \mathbf 1 . $$&lt;/span&gt; &#xA;This is true because &lt;span class=&quot;math-container&quot;&gt;$U \cdot \mathbf 1 \cdot U^\dagger = \mathbf 1$&lt;/span&gt; for each unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, and taking a mixture over several unitaries &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; does not change the result for the operator &lt;span class=&quot;math-container&quot;&gt;$\mathbf 1$&lt;/span&gt;.&#xA;But it is easy to find maps that don't have this property &amp;mdash; so for such maps, there is no interpretation as a probabilistic mixture of unitary processes.&#xA;For instance, the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal R$&lt;/span&gt; that resets a qubit to &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt; does not preserve the maximally mixed state on a qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal R(\rho) \,=\, \mathrm{tr}(\rho) \cdot \lvert 0 \rangle\!\langle 0 \rvert . $$&lt;/span&gt;&#xA;Of course, this map can be expressed using Kraus operators: for instance, you could take &lt;span class=&quot;math-container&quot;&gt;$K_0 = \lvert 0 \rangle\!\langle 0 \rvert$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$K_1 = \lvert 0 \rangle\!\langle 1 \rvert$&lt;/span&gt;, which would suffice for &lt;span class=&quot;math-container&quot;&gt;$\mathcal R(\rho) = K_0^{\phantom\dagger} \rho K_0^\dagger + K_1^{\phantom\dagger} \rho K_1^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edited to add:&lt;/em&gt; Following up on Norbert Schuh's comment below, not all &lt;em&gt;unital&lt;/em&gt; channels are mixtures of unitaries either. An example for qutrits can be found in John Watrous' &lt;em&gt;Theory of Quantum Information&lt;/em&gt; (which is &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;freely available online here&lt;/a&gt;), in Example&amp;nbsp;4.3:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{gathered}&#xA;\Phi(\rho) = A_1^{\phantom\dagger} \rho A_1^\dagger + A_2^{\phantom\dagger} \rho A_2^\dagger + A_3^{\phantom\dagger} \rho A_3^\dagger,&#xA;\\[1ex]&#xA;A_1 = \tfrac{1}{\sqrt 2}\mbox{$\scriptstyle\begin{bmatrix}&#xA;0 \!&amp;amp;\! 0 \!&amp;amp;\! 0&#xA;\\ 0 \!&amp;amp;\! 0 \!&amp;amp;\! 1&#xA;\\ 0 \!&amp;amp;\! -1 \!&amp;amp;\! 0&#xA;\end{bmatrix}$}\,,&#xA;\quad&#xA;A_2 = \tfrac{1}{\sqrt 2}\mbox{$\scriptstyle\begin{bmatrix}&#xA;0 \!&amp;amp;\! 0 \!&amp;amp;\! 1&#xA;\\ 0 \!&amp;amp;\! 0 \!&amp;amp;\! 0&#xA;\\ -1 \!&amp;amp;\! 0 \!&amp;amp;\! 0&#xA;\end{bmatrix}$}\,,&#xA;\quad&#xA;A_3 = \tfrac{1}{\sqrt 2}\mbox{$\scriptstyle\begin{bmatrix}&#xA;0 \!&amp;amp;\! 1 \!&amp;amp;\! 0&#xA;\\ -1 \!&amp;amp;\! 0 \!&amp;amp;\! 0&#xA;\\ 0 \!&amp;amp;\! 0 \!&amp;amp;\! 0&#xA;\end{bmatrix}$}\,.&#xA;\end{gathered}&#xA;$$&lt;/span&gt;&#xA;As Watrous observes, it is possible to show that this is an extreme point among the channels on a qutrit (&lt;em&gt;i.e.,&lt;/em&gt;&amp;nbsp;not a convex combination of &lt;em&gt;any&lt;/em&gt; other channels) by showing that the operators &lt;span class=&quot;math-container&quot;&gt;$A_j^\dagger A_k^{\phantom\dagger}$&lt;/span&gt; are a linearly independent set of operators; then as &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is not itself unitary, it isn't a mixture of unitaries either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Watrous also notes the following characterisation of channels which &lt;em&gt;are&lt;/em&gt; mixtures of unitaries:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Theorem&amp;nbsp;4.8&lt;/strong&gt; (paraphrased) &amp;mdash;&#xA;  Let &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; be a channel on a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;, characterised by a Stinespring dilation &lt;span class=&quot;math-container&quot;&gt;$$\Phi(\rho) = \mathrm{Tr}_{\mathcal Z}(A \rho A^\dagger)$$&lt;/span&gt; for some unitary embedding &lt;span class=&quot;math-container&quot;&gt;$A: \mathcal X \to \mathcal X \otimes \mathcal Z$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is a mixture of unitaries if and only if there exists a POVM &lt;span class=&quot;math-container&quot;&gt;$\{E_k\}_{k \in K}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt; with outcomes labeled by elements of some set &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, and some channels &lt;span class=&quot;math-container&quot;&gt;$\Psi_k$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k \in K$&lt;/span&gt;, such that&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ \rho = \sum_{k \in K} \Psi_k\bigl(\tilde \rho_k\bigr), $$&lt;/span&gt;&#xA;  where &lt;span class=&quot;math-container&quot;&gt;$\tilde \rho_k = \mathrm{Tr}_{\mathcal Z}\bigl(\bigl[\mathbf 1 \!\otimes\! E_k\bigr]\bigl[A \rho A^\dagger\bigr]\bigr)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That is to say: if (and only if) &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; can be characterised by an interaction of an input system &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; with an environment &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt;, in such a way that there is a way in principle that you could measure the environment and use the outcome to control a 'correction' operation to recover the original input, then &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is a mixture of unitaries.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-08-08T22:30:47.967" LastActivityDate="2019-08-08T22:30:47.967" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6957" PostTypeId="1" CreationDate="2019-08-06T21:02:38.143" Score="3" ViewCount="40" Body="&lt;p&gt;What do we mean by exciting a superconducting circuit--which represent a qubit, how they are get excited inside? how the two states of the qubit are represented in this circuit?&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2019-08-06T21:08:12.060" LastActivityDate="2019-08-06T21:08:12.060" Title="Excitation of a superconducting circuit" Tags="&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6958" PostTypeId="1" CreationDate="2019-08-07T04:42:09.120" Score="5" ViewCount="116" Body="&lt;p&gt;Superconducting qubits generally have frequencies within the range of 4 - 8 GHz. What design considerations give the upper and lower bounds for what is a feasible design. I.e, why can't they be higher or lower in frequency?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="55" LastEditDate="2019-09-19T20:42:15.677" LastActivityDate="2021-02-11T00:02:25.237" Title="What design considerations set the frequency bounds for superconducting qubits?" Tags="&lt;architecture&gt;&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6959" PostTypeId="1" AcceptedAnswerId="6961" CreationDate="2019-08-07T14:26:14.373" Score="4" ViewCount="326" Body="&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; trying to implement and test quantum subroutines on quantum simulators I run into multiple challenges:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantum simulation is a &lt;em&gt;very hard&lt;/em&gt; problem: a very low number of simulated qubits is supported&lt;/li&gt;&#xA;&lt;li&gt;The toolkit does not offer arithmetic operations, often not even a structure representing numbers, e.g., a &quot;quantum&quot; integer. The simulators work on basis of distinct qubits only.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Assuming I am interested in translating a classical subroutine into a quantum circuit. The translation can be done without the use of entanglement and thus it would be sufficient to simulate a reversible ciruit (hence remove the overhead of simulating superpositons). Merely testing for functionality of such a translation does not require quantum effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Looking for:&lt;/strong&gt; I am looking a tool(kit) that allows to construct and simulate reversible circuits for a large (a few thousands) number of (qu)bits. The toolkit should, if possible, allow the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(Classical) simulation of the circuit&lt;/li&gt;&#xA;&lt;li&gt;Definition of subroutines (functions)&lt;/li&gt;&#xA;&lt;li&gt;Definition of structures (e.g. array of (qu)bits to represent an integer)&lt;/li&gt;&#xA;&lt;li&gt;Support a gate set that allows to construct arbitrary operations, e.g., Toffoli (no need to create superpositions though)&lt;/li&gt;&#xA;&lt;li&gt;Predefined (reversible) arithmetic operations (optional)&lt;/li&gt;&#xA;&lt;li&gt;GUI representation of the circuits, drag and drop (optional)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would also be happy about a quantum simulator that allows to restrict to &quot;classical&quot; simualtion. Perhaps a quantum simulator is overkill and there are &quot;classical&quot; circuit construction tools that allow me to do this very easily (maybe VHDL?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; Can anyone point me to simulators for reversible circuits?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am aware of the extensive list of quantum simulators in &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantiki&lt;/a&gt;, and must admit, that I did not try all of them. However, I do have some experience with the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Microsoft &lt;a href=&quot;https://www.microsoft.com/en-us/research/project/language-integrated-quantum-operations-liqui/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Liquid&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Plenty example code&lt;/li&gt;&#xA;&lt;li&gt;can simulate &lt;span class=&quot;math-container&quot;&gt;$\approx 22$&lt;/span&gt; qubits (on my laptop)&lt;/li&gt;&#xA;&lt;li&gt;can restrict oneself to stabilizer circuits (Clifford group) for larger number of qubits, but that does not give me Toffoli gates :(&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Microsoft &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QSharp&lt;/a&gt;&lt;/em&gt; Programming Language&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;can simulate &lt;span class=&quot;math-container&quot;&gt;$&amp;lt; 30$&lt;/span&gt; qubits&lt;/li&gt;&#xA;&lt;li&gt;allows construction of structs; has integer/ floating-point representations&lt;/li&gt;&#xA;&lt;li&gt;predefined quantum arithmetic&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Simulator &lt;a href=&quot;http://iic.jku.at/eda/research/quantum_simulation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;University Linz&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;seems to allow to simulate larger number of qubits for certain problem&lt;/li&gt;&#xA;&lt;li&gt;poorly documented&lt;/li&gt;&#xA;&lt;li&gt;only (qu)bit level operations&lt;/li&gt;&#xA;&lt;li&gt;not actively developed&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;revkit/ cirkit &lt;a href=&quot;https://github.com/msoeken/revkit&quot; rel=&quot;nofollow noreferrer&quot;&gt;RevKit&lt;/a&gt;&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;apparently simulation for reversible circuits&lt;/li&gt;&#xA;&lt;li&gt;has a GUI representation of circuits&lt;/li&gt;&#xA;&lt;li&gt;did not actually get this to run (only the gui)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Drag an Drop &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GUI cuircit representation&lt;/li&gt;&#xA;&lt;li&gt;allows to defined functions&lt;/li&gt;&#xA;&lt;li&gt;works very well for small examples (great tool!)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;IBM &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt;&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GUI circuit representation&lt;/li&gt;&#xA;&lt;li&gt;allows to define structures and functions&lt;/li&gt;&#xA;&lt;li&gt;no predefined arithmetic operations, but sample code for addition/ multiplication etc available on githut&lt;/li&gt;&#xA;&lt;li&gt;simulation limited to &lt;span class=&quot;math-container&quot;&gt;$&amp;lt; 30$&lt;/span&gt; (qu)bits&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="7824" LastActivityDate="2019-08-07T16:15:47.027" Title="Reversible Circuit Simulation (for classical tests of quantum subroutines)" Tags="&lt;circuit-construction&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6960" PostTypeId="2" ParentId="4887" CreationDate="2019-08-07T14:34:12.747" Score="2" Body="&lt;p&gt;The answer is yes, you need &lt;span class=&quot;math-container&quot;&gt;$d_1 d_2$&lt;/span&gt; operators, as already pointed out in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4888/55&quot;&gt;the other answer&lt;/a&gt;. Here I'll show explicitly why this is the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi\in\mathrm{T}(\mathcal X,\mathcal Y)$&lt;/span&gt; be a CPTP operator sending maps in &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; into maps in &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt;. The spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt; have dimensions &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Short proof&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;The Kraus decomposition is essentially the spectral decomposition of the Choi operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; (or rather, one can always choose Kraus operators that are eigenvectors, up to &quot;unvectorisation&quot;, of the Choi), as shown for example in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6968/55&quot;&gt;this question&lt;/a&gt;. The Choi operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; is a linear operator in &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y\otimes\mathcal X$&lt;/span&gt;, which is a space of dimension &lt;span class=&quot;math-container&quot;&gt;$d_1 d_2$&lt;/span&gt;. Therefore, the maximum rank of &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$d_1d_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rank of a positive operator corresponds to the number of its non-zero eigenvalues, which in this case is the number of Kraus operators in the decomposition of the channel. You can thus see why the conclusion follows.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;Longer proof&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;This is a longer proof that doesn't need to introduce the notion of Choi operator (although we are of course using it under the hood).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Complete positivity means that any extension &lt;span class=&quot;math-container&quot;&gt;$\Phi\otimes I_n\in\mathrm{T}(\mathcal X\otimes\mathcal Z,\mathcal Y\otimes \mathcal Z)$&lt;/span&gt; is a positive map. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us write the action of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; on a generic operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in terms of its matrix elements as &lt;span class=&quot;math-container&quot;&gt;$[\Phi(X)]_{ij}=\Phi_{ijk\ell}X_{k\ell}$&lt;/span&gt; (this essentially amounts to be using the natural representation of the map).&#xA;The action of an extension &lt;span class=&quot;math-container&quot;&gt;$\Phi\otimes I_n$&lt;/span&gt; onto a generic map &lt;span class=&quot;math-container&quot;&gt;$Y\in\mathrm{Lin}(\mathcal X\otimes\mathcal Z)$&lt;/span&gt; then reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[(\Phi\otimes I_n)Y]_{ij}^{\alpha\beta}=\sum_{k\ell}\Phi_{ijk\ell} Y_{k\ell}^{\alpha\beta},\tag A$$&lt;/span&gt;&#xA;where I use &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; to denote the indices of &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt;.&#xA;This must hold true for any such operator &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The complete positivity implies that &lt;span class=&quot;math-container&quot;&gt;$(\Phi\otimes I_n)Y$&lt;/span&gt; must be a positive operator. Remembering that an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is positive &lt;em&gt;iff&lt;/em&gt; it can be written as &lt;span class=&quot;math-container&quot;&gt;$A_{ij}=\sum_k u^k_i\bar u^k_j$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sum_i u^k_i \bar u^\ell_i=\lambda_k\delta_{k\ell}$&lt;/span&gt;, upon some reflection we can see that this means that we can &quot;separate&quot; the matrix elements of our operator &lt;span class=&quot;math-container&quot;&gt;$(\Phi\otimes I_n)Y$&lt;/span&gt; as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[(\Phi\otimes I_n)Y]_{ij}^{\alpha\beta}=\sum_a A^a_{i\alpha} \bar A^a_{j\beta}\tag B$$&lt;/span&gt;&#xA;for some objects &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. This must hold true for any choice of positive operator &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, it must hold true for the positive operator with components &lt;span class=&quot;math-container&quot;&gt;$Y_{k\ell}^{\alpha\beta}=\delta_{\alpha k}\delta_{\beta \ell}$&lt;/span&gt; (which corresponds to the/a maximally entangled state).&#xA;With this choice, (B) becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_{ij\alpha\beta}=\sum_a A^a_{i\alpha} \bar A^a_{j\beta},$$&lt;/span&gt;&#xA;which you should recognise as the Kraus decomposition of the channel written in terms of the matrix elements.&#xA;The number of elements in this sum equals the rank of the operator sending second and fourth indices into first and third (which is nothing but the Choi operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;). This is a linear operator in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Lin}(\mathcal Y\otimes \mathcal X)$&lt;/span&gt;, and as such can have maximum rank equal to &lt;span class=&quot;math-container&quot;&gt;$\operatorname{dim}(\mathcal X)\operatorname{dim}(\mathcal Y)=d_1 d_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-02-05T11:17:09.367" LastActivityDate="2020-02-05T11:17:09.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6961" PostTypeId="2" ParentId="6959" CreationDate="2019-08-07T16:15:47.027" Score="4" Body="&lt;p&gt;One of the simulators in Microsoft Quantum Development Kit is &lt;a href=&quot;https://docs.microsoft.com/quantum/machines/toffoli-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli simulator&lt;/a&gt; which seems to do exactly what you want.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It supports a limited set of primitive gates (X, CNOT and Toffoli gates, as well as other gates when their effect is X or identity), measurements in the computational basis  and &lt;code&gt;DumpMachine&lt;/code&gt; to output the state of the simulator.&lt;/li&gt;&#xA;&lt;li&gt;It is a simulator for Q#, so all language features and libraries (including arithmetic) are available to it. The restriction on 30 simulatable qubits you mentioned comes not from Q# language itself but from the full-state simulator that is typically used with the Q# programs. Since Toffoli simulator doesn't create entanglement, it can simulate thousands of qubits - the default is 65k, but you can allocate more if you need.&lt;/li&gt;&#xA;&lt;li&gt;It is available with IQ# and from &lt;code&gt;qsharp&lt;/code&gt; Python package using &lt;code&gt;%toffoli&lt;/code&gt; magic command and &lt;code&gt;toffoli_simulate&lt;/code&gt; method, respectively.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can find examples of using it with Q# in &lt;a href=&quot;https://github.com/microsoft/Quantum/tree/master/Numerics&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Samples repository&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Full disclosure: I am part of the team working on Quantum Development Kit.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-07T16:15:47.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6962" PostTypeId="1" AcceptedAnswerId="11448" CreationDate="2019-08-07T17:54:47.043" Score="3" ViewCount="134" Body="&lt;p&gt;On &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;, it is stated that the Holevo quantity is an upper bound to the accessible information of a quantum state. In the scenario where Alice encodes classical information into a quantum state and sends it to Bob, the accessible information is the maximum of the mutual information between Alice and Bob's registers over all possible measurements that Bob makes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Classical_capacity&quot; rel=&quot;nofollow noreferrer&quot;&gt;classical capacity of a quantum channel&lt;/a&gt; also looks at the mutual information between Alice and Bob. The maximization of this mutual information is the Holevo quantity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand the difference in the two settings. In particular, why is the Holevo quantity only an upper bound in the first linked page but is equal to the maximum mutual information in the second linked page?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2019-08-07T18:07:52.587" LastActivityDate="2020-04-07T17:39:37.960" Title="Holevo quantity and mutual information" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6963" PostTypeId="1" CreationDate="2019-08-07T20:19:19.230" Score="-1" ViewCount="74" Body="&lt;p&gt;Qsharp have Rx Ry and Rz gates for rotation, but I need to apply a gate that leaves the Qbuit rotating continuosly like in Quirk spinning gates.&#xA;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%5Et%22%5D%2C%5B1%2C%22Chance%22%5D%2C%5B%22ZDetectControlReset%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22X%5Et%22%5D%2C%5B1%2C%22Chance%22%5D%2C%5B%22ZDetectControlReset%22%5D%5D%7D&lt;/a&gt;&#xA;This is because later I will entangled it with another Qbuit, so both will be rotating, to try to sincronize meseaures &lt;/p&gt;&#xA;" OwnerUserId="7933" LastEditorUserId="2879" LastEditDate="2019-08-07T21:15:57.640" LastActivityDate="2019-08-15T17:55:22.737" Title="How to make a time rotation in Qsharp like in Quirk spinning gates?" Tags="&lt;quantum-gate&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6964" PostTypeId="1" CreationDate="2019-08-07T21:24:43.410" Score="2" ViewCount="451" Body="&lt;p&gt;For example, the ibmqx2 computer has the most recent readout error of &lt;span class=&quot;math-container&quot;&gt;$4.40 \cdot 10^{-2}$&lt;/span&gt;. Does this mean per 1000 measurements, 44 faulty results exist?&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="1867" LastEditDate="2019-08-14T17:14:04.163" LastActivityDate="2019-08-14T17:14:04.163" Title="How do I interpret the readout error for a quantum computer?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;error-correction&gt;&lt;ibm-q-experience&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6965" PostTypeId="1" AcceptedAnswerId="6966" CreationDate="2019-08-07T21:52:19.520" Score="3" ViewCount="69" Body="&lt;p&gt;Suppose I have a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-bit estimate of &lt;span class=&quot;math-container&quot;&gt;$\theta \in (0, 2 \pi]$&lt;/span&gt;, say a register of qubits &lt;span class=&quot;math-container&quot;&gt;$|\tilde{\theta} \rangle = |z_1 \rangle \ldots |z_d \rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|z_i \rangle \in \{|0 \rangle, |1 \rangle \}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta \approx \sum_{i=1}^{d} z_i \pi /2^{i}$&lt;/span&gt;, and I wish to implement a transformation &#xA;&lt;span class=&quot;math-container&quot;&gt;$|\tilde{\theta}  \rangle |0 \rangle  \mapsto |\tilde{\theta} \rangle (cos(\theta) |0 \rangle + sin(\theta)|1 \rangle)$&lt;/span&gt; using a quantum circuit consisting of two-qubit gates which can be represented by the controlled unitary transformation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{c_i} = \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;				   0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;                   0 &amp;amp; 0 &amp;amp; cos(\pi / 2^i) &amp;amp; -sin(\pi / 2^i) \\&#xA;				   0 &amp;amp; 0 &amp;amp; sin(\pi / 2^i) &amp;amp; cos(\pi / 2^i) \\ \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to come up with a formula for how a sequence of these controlled operations would be applied to the ancilla qubit &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; (maybe more than a single qubit?) to result in an overall rotation by &lt;span class=&quot;math-container&quot;&gt;$\approx \theta $&lt;/span&gt; but I am not sure how to proceed. Any insights appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edited the matrix as in the answer.&lt;/p&gt;&#xA;" OwnerUserId="7481" LastEditorUserId="7481" LastEditDate="2019-08-08T03:02:40.340" LastActivityDate="2019-08-08T03:02:40.340" Title="Circuit for controlled rotations conditioned on a $d$ bit precision estimate of $\theta$ for $O(d)$ gates" Tags="&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6966" PostTypeId="2" ParentId="6965" CreationDate="2019-08-08T02:36:26.277" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{c_i}$&lt;/span&gt; should not have &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt; in it. That information is on the input. It is not in the gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{c_i} = \begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;\cos(\pi/2^i)&amp;amp;-\sin(\pi/2^i)\\&#xA;0&amp;amp;0&amp;amp;\sin(\pi/2^i)&amp;amp;\cos(\pi/2^i)\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this gate acts on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;'th qubit of &lt;span class=&quot;math-container&quot;&gt;$| \tilde{\theta} \rangle$&lt;/span&gt; and the target, this will give the appropriate controlled rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do all of &lt;span class=&quot;math-container&quot;&gt;$\tilde{\theta}$&lt;/span&gt; just do all these &lt;span class=&quot;math-container&quot;&gt;$U_{c_i}$&lt;/span&gt; on the appropriate pairs as described above. This is thanks to the fact that all of these operations are rotating along the same axis. You are just building up &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\prod_{i=1}^d R_z (\frac{z_i}{2^i}\pi) = R_z (\sum_{i=1}^d \frac{z_i \pi}{2^i}) = R_z (\tilde{\theta})$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-08-08T02:36:26.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6967" PostTypeId="1" CreationDate="2019-08-08T08:23:10.230" Score="0" ViewCount="105" Body="&lt;p&gt;I know that I can just use the &lt;span class=&quot;math-container&quot;&gt;$RZ$&lt;/span&gt; gate to replace the &lt;span class=&quot;math-container&quot;&gt;$PH$&lt;/span&gt; phase gate. But I need a way to implement the controlled phase gate &lt;span class=&quot;math-container&quot;&gt;$C-PH$&lt;/span&gt; this cannot just be replaced with a &lt;span class=&quot;math-container&quot;&gt;$CRZ$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="5791" LastActivityDate="2019-08-09T22:12:10.867" Title="How to do a $C-PH$ gate in google cirq" Tags="&lt;quantum-gate&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6968" PostTypeId="1" AcceptedAnswerId="6970" CreationDate="2019-08-08T12:00:34.083" Score="4" ViewCount="500" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi\in\mathrm T(\mathcal X,\mathcal Y)$&lt;/span&gt; be a CPTP map.&#xA;Any such channel admits a Kraus decomposition of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)=\sum_a A_a X A_a^\dagger,$$&lt;/span&gt;&#xA;for a set of operators &lt;span class=&quot;math-container&quot;&gt;$A_a\in\mathrm{Lin}(\mathcal X,\mathcal Y)$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$\sum_a A_a^\dagger A_a=I_{\mathcal X}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard way to prove this passes through the Choi representation &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; of the channel, showing that CP is equivalent to &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; being a positive operator, and therefore &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; admits a spectral decomposition with positive eigenvalues, and finally realise that the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; are essentially equivalent to the Kraus operators &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; (upon some reinterpretation of the indices). This is shown for example at pag. 83 (theorem 2.22) of Watrous' TQI book, and in some form also in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5816/55&quot;&gt;this other answer&lt;/a&gt; here, as well as in a slightly different formalism in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6960/55&quot;&gt;this other answer of mine&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What puzzles me about this is the following. The components in the spectral decomposition of the Choi operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; will also have to satisfy an additional property, one that I haven't seen discussed in this context: the orthogonality of the eigenvectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=\sum_a v_a v_a^\dagger$&lt;/span&gt;, then we also know that the vectors &lt;span class=&quot;math-container&quot;&gt;$v_a$&lt;/span&gt; are orthogonal. More specifically, we can always write &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=\sum_a p_a v_a v_a^\dagger$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$p_a\ge0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle v_a,v_b\rangle=\delta_{ab}$&lt;/span&gt;.&#xA;Remembering that here &lt;span class=&quot;math-container&quot;&gt;$v_a\in\mathcal Y\otimes\mathcal X$&lt;/span&gt;, these vectors are essentially the Kraus operators of the channel in the sense that &lt;span class=&quot;math-container&quot;&gt;$(v_a)_{\alpha i}=(A_a)_{\alpha i}$&lt;/span&gt; (using greek and latin letters to denote indices in &lt;span class=&quot;math-container&quot;&gt;$\mathcal Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;, respectively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The orthogonality of the &lt;span class=&quot;math-container&quot;&gt;$v_a$&lt;/span&gt; is thus equivalent to the fact that Kraus operators must satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}(A_a^\dagger A_b)\equiv \sum_{i\alpha}(A_a^*)_{\alpha i} (A_b)_{\alpha i}=p_a\delta_{ab}.\tag A$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this property doesn't seem to be usually remarked. Moreover, people often refer to Kraus operators that &lt;em&gt;do not&lt;/em&gt; satisfy this orthogonality condition. An example is the Kraus operators used for the dephasing channel in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4739/55&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is therefore as follows: should the property &lt;strong&gt;(A)&lt;/strong&gt; be considered as a necessary condition for a set &lt;span class=&quot;math-container&quot;&gt;$\{A_a\}_a$&lt;/span&gt; to be called a set of Kraus operators of a channel? Moreover, regardless of the terminology that one chooses to use, is there any advantage in choosing a &quot;Kraus decomposition&quot; for the channel that is made out of &lt;em&gt;orthogonal&lt;/em&gt; operators, rather than non-orthogonal ones?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-08-08T15:13:17.253" LastActivityDate="2019-08-08T15:13:17.253" Title="Do the Kraus operators of a CPTP channel need to be orthogonal?" Tags="&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6969" PostTypeId="2" ParentId="6968" CreationDate="2019-08-08T12:38:44.087" Score="0" Body="&lt;p&gt;To answer your two questions separately:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; The property &lt;strong&gt;(A)&lt;/strong&gt; is not a necessary condition for a set to be a Kraus decomposition. Your derivation is right - Kraus operators obtained from the eigenvectors of the Choi matrix (or the process matrix, for that matter), are &lt;em&gt;almost&lt;/em&gt; always orthogonal to each other. Almost, because if the Choi matrix is degenerate, you can find a non-orthogonal eigenbasis &lt;span class=&quot;math-container&quot;&gt;$\{c_{\lambda_{i}}\}$&lt;/span&gt; for an eigenspace &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$a.m. &amp;gt; 1$&lt;/span&gt;. This results in non-orthogonal Kraus operators as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; There is yet another option: Kraus operators may be linear combinations of each other (e.g. the operators in the other answer you linked). That also means that they never can all be orthogonal to each other. It also introduces some form of ambiguity, because there are then multiple ways to express the action of the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, the canonical way of expressing the dephasing channel is with Kraus operators &lt;span class=&quot;math-container&quot;&gt;$A_{1} = \sqrt{1-p}I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_{2} = \sqrt{p}Z$&lt;/span&gt; (which are, in fact, orthogonal). By limiting your answer to orthogonal Kraus operators, you omit this ambiguity.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-08-08T12:38:44.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6970" PostTypeId="2" ParentId="6968" CreationDate="2019-08-08T13:32:47.703" Score="7" Body="&lt;p&gt;There is an ambiguity in the choice of Kraus operators: If &lt;span class=&quot;math-container&quot;&gt;$\{E_a\}$&lt;/span&gt; is a set of Kraus operators for a channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;, so is &lt;span class=&quot;math-container&quot;&gt;$\{F_b\}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$F_b=\sum_a v_{ab} E_a$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$(v_{ab})$&lt;/span&gt; an isometry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, you can choose a &lt;span class=&quot;math-container&quot;&gt;$(v)$&lt;/span&gt; which diagonalizes the matrix &lt;span class=&quot;math-container&quot;&gt;$X_{ac}=\mathrm{tr}[E_a^\dagger E_b]$&lt;/span&gt;, in which case &lt;span class=&quot;math-container&quot;&gt;$\{F_b\}$&lt;/span&gt; satisfies your orthogonality property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is an ambiguity in the Kraus representation, and all such representations are called Kraus representations.  That's the way it is, without a condition (A). If you think condition (A) is good to have, then you should give it a different name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is likely that this representation has certain advantages, just as an eigenvalue decomposition.  Off the top of my head, it should e.g. mean that the different errors introduced by the different Kraus operators are orthogonal, so it should be a convenient representation in terms of error correction.  Also, it is one representation with the minimal number of Kraus operators.  I'm sure there are others.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-08-08T13:32:47.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6972" PostTypeId="1" AcceptedAnswerId="6976" CreationDate="2019-08-08T17:54:50.187" Score="0" ViewCount="34" Body="&lt;p&gt;I was wondering if the complete set of measurement operators for a state :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle=c_{00}|00\rangle+c_{01}|01\rangle+c_{10}|10\rangle+c_{11}|11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would be given by :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_0\otimes I=|00\rangle\langle00|+|01\rangle\langle01|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_1\otimes I=|10\rangle\langle10|+|11\rangle\langle11|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes P_0=|00\rangle\langle00|+|10\rangle\langle10|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes P_1=|01\rangle\langle01|+|11\rangle\langle11|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or would it be given by :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_0\otimes I=|00\rangle\langle00|+|01\rangle\langle01|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_1\otimes I=|10\rangle\langle10|+|11\rangle\langle11|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes P_0=|00\rangle\langle00|+|10\rangle\langle10|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I\otimes P_1=|01\rangle\langle01|+|11\rangle\langle11|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_0\otimes P_0=|00\rangle\langle00|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_1\otimes P_1=|11\rangle\langle11|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_0\otimes P_1=|01\rangle\langle01|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_1\otimes P_0=|10\rangle\langle10|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like it may be the second one by intuition as it seems to allow for more distinction between measurements but intuition is often misleading in mathematical contexts and I feel like I recall seeing the first one written somewhere. Could anyone clear this up for me please?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="434" LastEditDate="2019-08-08T18:37:40.430" LastActivityDate="2019-08-08T18:40:15.760" Title="The correct set of measurement operators on a mutiple qubit system" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6973" PostTypeId="2" ParentId="6903" CreationDate="2019-08-08T18:13:52.567" Score="4" Body="&lt;p&gt;Another way to think about this: To simulate what goes on in a quantum computer we have to do a lot of matrix math using &lt;span class=&quot;math-container&quot;&gt;$(2^N \times 2^N)$&lt;/span&gt; matrices&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;, and the action of (most) of the clifford gates can be actually be accomplished by applying some non-linear, low complexity matrix operation instead of a matrix multiplication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the Pauli-X gate, CNOT, and SWAP gates are both permutation matrices. If you think carefully about which qubits they act on, you don't have to do matrix math at all, you just copy and/or shuffle around the amplitudes of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; in a clever way. Similarly with Pauli-Z - you just negate a subset of your amplitudes and sidestep the matrix math. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But quantum computing is about more interesting operations than permutations, and the effects of gates involving rotation (&lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;) and ugly phases (&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;) don't have nice shortcuts. And for whatever we can't efficiently simulate, we expect the quantum computer to have an advantage.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;This is not the most efficient method, but the operations I'm describing can often perform multiplication by single-qubit clifford gate saturating the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(2^N)$&lt;/span&gt; lower bound on complexity for computing amplitudes of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit state, making these methods better than or equal to any other method available.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-08-08T18:13:52.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6974" PostTypeId="2" ParentId="6892" CreationDate="2019-08-08T18:34:41.157" Score="1" Body="&lt;p&gt;The task of how to perform &quot;Amplitude encoding&quot; - given &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt;, prepare &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_k x_k |k\rangle$&lt;/span&gt; - doesn't have a general answer. It could be accomplished by a depth-one circuit for a &quot;one-hot&quot; vector &lt;span class=&quot;math-container&quot;&gt;$x_k = \delta_i^k$&lt;/span&gt;. Or it could take an arbitrarily deep circuit to produce a set of amplitudes resembling a discretized gaussian  like &lt;span class=&quot;math-container&quot;&gt;$x_k \propto e^{-(\bar{x} - k)^2/\mu}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In earlier &quot;quantum machine learning&quot; algorithms, its usually proposed that this task will be accomplished by an &quot;oracle&quot; (i.e. black box) or aided by &quot;qRAM&quot;, neither of which represent a near-term or mainstream technology. A good reference to check out is &lt;a href=&quot;https://scottaaronson.com/papers/qml.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aaronson's critique&lt;/a&gt; on these types of devices and algorithms.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-08-08T18:34:41.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6975" PostTypeId="2" ParentId="6972" CreationDate="2019-08-08T18:39:58.620" Score="0" Body="&lt;p&gt;A valid measurement consists of operators &lt;span class=&quot;math-container&quot;&gt;$\{M_k\}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_k M^\dagger_k M_k = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need appropriate normalization factors in front for both cases but since &lt;span class=&quot;math-container&quot;&gt;$P_i^\dagger P_i = P_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_0 + P_1 = I$&lt;/span&gt;, they both do correspond to valid measurements. &lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2019-08-08T18:39:58.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6976" PostTypeId="2" ParentId="6972" CreationDate="2019-08-08T18:40:15.760" Score="2" Body="&lt;p&gt;There is no single set that is &quot;the&quot; complete set of measurement operators. You can have any set that you want so long as they add up to the identity. So, one such set is &lt;span class=&quot;math-container&quot;&gt;$P_0\otimes I, P_1\otimes I$&lt;/span&gt;, which describes measuring only qubit 1 in the standard basis, and there's &lt;span class=&quot;math-container&quot;&gt;$I\otimes P_0, I\otimes P_1$&lt;/span&gt; which describes only measuring qubit 2 in the standard basis, and there's also &lt;span class=&quot;math-container&quot;&gt;$P_0\otimes P_0, P_0\otimes P_1, P_1\otimes P_0, P_1\otimes P_1$&lt;/span&gt; which describes measuring both qubits in the standard basis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-08T18:40:15.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6978" PostTypeId="1" AcceptedAnswerId="6991" CreationDate="2019-08-09T02:28:07.680" Score="5" ViewCount="381" Body="&lt;p&gt;It's well known that, given an oracle for a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; from a very large set &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; (of order &lt;span class=&quot;math-container&quot;&gt;$N \gg 1$&lt;/span&gt;) to &lt;span class=&quot;math-container&quot;&gt;$\{0, 1\}$&lt;/span&gt;, Grover's algorithm can find an element of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; that maps to 1 with &lt;span class=&quot;math-container&quot;&gt;$\sim \sqrt{N}$&lt;/span&gt; oracle queries, whereas the best classical oracle search algorithm requires &lt;span class=&quot;math-container&quot;&gt;$\sim N$&lt;/span&gt; queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, it's often claimed that a quantum computing running Grover's algorithm could give useful speedups for many practical computational problems (since many such problems, e.g. numerical optimization, can be framed in this form).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But Grover's algorithm is a &quot;black-box&quot; algorithm that treats the oracle as the only method of getting any information at all about the solution to your problem. It completely ignores any possible correlations between the oracle's responses for different inputs, or any other &quot;structure&quot; behind the computation to be solved. Grover's algorithm therefore gives a square-root speedup over &lt;em&gt;completely naive, brute-force search&lt;/em&gt; of every possible solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it seems to me that (loosely speaking), most &quot;interesting&quot; or &quot;practical&quot; computational problems have enough structure that complete brute-force guessing is rarely the best classical approach. As a simple example, for numerically optimizing some complicated but differentiable function, gradient descent (plus some means of escaping from local minima) is typically vastly more efficient than random sampling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now an &lt;em&gt;exponential&lt;/em&gt; (classical) speedup over brute-force guessing is too much to hope for in general: if &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P} \neq \mathrm{NP}$&lt;/span&gt; (which is presumably the case), then there exist problems in NP that do not admit exponential (classical) improvements over brute-force guessing that work even in the worst case. But even NP-complete problems often admit heuristic algorithms that allow for efficient solutions &quot;in practice&quot;, e.g. they work for most problem instances. Even when this is not the case, my intuition is that most &quot;practical&quot; problems admit classical algorithms that provide an algebraic speedup over brute-force guessing that is better than square-root, at least for many problem instances. So my intuition is that for most &quot;practical&quot; problems, there's usually a heuristic classical algorithm that's more efficient than using Grover's algorithm for a square-root speedup over brute-force search.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my intuition correct? Are they many practical problems for which the best known classical algorithms deliver less than a square-root speedup over brute force guessing &quot;in practice&quot;? (I guess the somewhat sharper version of &quot;in practice&quot; means &quot;in the average case&quot;, but I'm also interested in less formal interpretations of &quot;in practice&quot; as well.) More bluntly, would a quantum computing running Grover's algorithm actually be that useful for many practical computational problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Strictly speaking, this is just a question about classical algorithms, but I think this is the right place to ask it, because people here are more likely to have thought about quantum speedups for these kind of problems.)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; The only type of problem for which I &lt;em&gt;wouldn't&lt;/em&gt; expect any classical algorithm to provide a significant improvement over brute-force search is one where the mathematical structure has been &lt;em&gt;deliberately&lt;/em&gt; chosen to be as complicated and obfuscated as possible. For example, inverting cryptographic hash functions or cracking a symmetric-key encryption algorithm like AES. This means that, ironically, the only type of math problem for which I can intuitively see Grover's algorithm delivering a clear quantum speedup is breaking symmetric-key encryption and hashes. (This is ironic because the main application for the &lt;em&gt;other&lt;/em&gt; most famous quantum algorithm, Shor's algorithm, is of course &lt;em&gt;also&lt;/em&gt; for breaking cryptography, although public-key rather than symmetric-key.)&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2019-08-12T01:05:39.943" Title="Are there many practical problems for which Grover's algorithm beats the best heuristic classical algorithm?" Tags="&lt;grovers-algorithm&gt;&lt;complexity-theory&gt;&lt;classical-computing&gt;&lt;speedup&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6979" PostTypeId="2" ParentId="6978" CreationDate="2019-08-09T04:44:54.267" Score="0" Body="&lt;p&gt;Grover Search Algorithm has complexity of O(√(N/n) oracle queries, where N is the total no. of elements in search space &amp;amp; n is the number of acceptable solutions. And is very useful for all problems where we do not know the structure or insight about the problem. Further, even if we know the structure / insight / domain information about the practical / real world problems, we still have to perform some search either random or deterministic, which may in turn benefit from Grover's Algorithm depending on the specific problem being solved. Therefore, even if an efficient algorithm (O(log(N))) exists in classical computation it can be made still more efficient by using Grover's Search. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, Quantum Oracles, in theory, can be implemented for any problem that can be solved using classical Digital Computation as all such logic can be implemented using reversible logic gates. Therefore, Oracle can be designed to incorporate the some structures like feasibility checks in constrained Numerical Optimization problem. Though Oracle will answer only in {0, 1}, but for which inputs it will give 1, can be designed in the Oracle by using the domain information. Thus, Grover search will find more applications in Real World Optimization Problems than in unsorted database search.&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-08-09T04:44:54.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6980" PostTypeId="2" ParentId="6915" CreationDate="2019-08-09T09:58:09.453" Score="5" Body="&lt;p&gt;One (obvious) application is the generation as &lt;em&gt;True Random Number Generators&lt;/em&gt;,&#xA;e.g. &lt;a href=&quot;https://www.idquantique.com/random-number-generation/products/quantis-random-number-generator/&quot; rel=&quot;noreferrer&quot;&gt;IDQ&lt;/a&gt;, or you can download some here &lt;a href=&quot;https://qrng.anu.edu.au/&quot; rel=&quot;noreferrer&quot;&gt;Free True Random Numbers&lt;/a&gt; (please do not use these for security relevant application).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to build such a TRNG, from a quantum circuit perspective, all you need is a single qubit, a Hadamard gate and a measurement. Although there might be more efficient ways to do it.&lt;/p&gt;&#xA;" OwnerUserId="7824" LastActivityDate="2019-08-09T09:58:09.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6981" PostTypeId="1" CreationDate="2019-08-09T12:54:12.290" Score="2" ViewCount="115" Body="&lt;p&gt;Suppose Alice wants to send Bob information. Each of them has been sent each of the qubits of the Bell state in advance. Suppose Alice has the first qubit and Bob has the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle = \frac{1}{\sqrt2} (|00\rangle + |11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Reference: Dense Coding Topic&lt;br&gt;&#xA;QUANTUM COMPUTING&lt;br&gt;&#xA;From Linear Algebra to Physical Realizations&lt;br&gt;&#xA;Mikio Nakahara&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q1) What are the individual qubits received by Alice and Bob?&#xA;Q2) If Alice wants to send her first qubit to Charles then is it possible to send her individual qubit? (or is it required to send complete &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;?)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="55" LastEditDate="2019-08-09T23:55:29.983" LastActivityDate="2019-08-09T23:55:29.983" Title="If Alice and Bob share a Bell state, can Alice send her individual qubit to a third party?" Tags="&lt;entanglement&gt;&lt;superdense-coding&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6982" PostTypeId="1" CreationDate="2019-08-09T13:48:28.677" Score="5" ViewCount="258" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi\in\mathrm T(\mathcal X,\mathcal Y)$&lt;/span&gt; be a CPTP map, and let &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; be its Choi representation.&#xA;As is well known, any such map can be written in a Kraus representation of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)=\sum_a p_a A_a X A_a^\dagger,\tag A$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_a\ge0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(A_a^\dagger A_b)=\delta_{ab}$&lt;/span&gt; (as mentioned for example in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6968/55&quot;&gt;this other question of mine&lt;/a&gt;). The positive numbers &lt;span class=&quot;math-container&quot;&gt;$p_a$&lt;/span&gt; appearing here can be seen to be the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way to directly relate the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$p_a$&lt;/span&gt; to some properties of the channel, or to how the channel acts on states?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-08-10T16:35:02.440" LastActivityDate="2019-08-12T08:35:08.143" Title="Do the eigenvalues of the Choi matrix have any direct physical interpretation?" Tags="&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6983" PostTypeId="2" ParentId="6981" CreationDate="2019-08-09T16:04:20.613" Score="3" Body="&lt;p&gt;Q1) The qubits in the &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; state are entangled - this means that (by definition) you can not represent the state of one of them individually without talking about the second one (mathematically this would be represented as tensor product of two single-qubit states). The best description of the individual qubits received by Alice and Bob is that each of them is part of this pair; this specifies their behavior when measured or transformed in the best possible way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q2) Note though that the entangled qubits remain separate entities, stored in separate physical objects. This means that they can be sent around (for example, as photons) individually. So Alice can send her qubit to Charles without also sending him the second part of the &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-09T16:04:20.613" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6984" PostTypeId="2" ParentId="6967" CreationDate="2019-08-09T22:03:08.673" Score="1" Body="&lt;p&gt;&lt;code&gt;cirq.ZPowGate(exponent=t/pi).controlled_by(control_qubit).on(target_qubit)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or equivalently&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;cirq.CZ(control_qubit, target_qubit)**(t / pi)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="119" LastEditDate="2019-08-09T22:12:10.867" LastActivityDate="2019-08-09T22:12:10.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6985" PostTypeId="1" CreationDate="2019-08-10T00:21:33.800" Score="10" ViewCount="197" Body="&lt;p&gt;Most quantum algorithms proposed, including Deutsch-Jozsa, Simon's, Bernstein-Vazirani etc,  involve querying an oracle. If I understand correctly, the speedups depend on the oracle being efficiently constructible. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, &lt;a href=&quot;https://arxiv.org/abs/1704.00690&quot; rel=&quot;noreferrer&quot;&gt;Bravyi et al&lt;/a&gt; proposed a quantum algorithm which essentially replaces the oracle in Bernstein-Vazirani with a grid-like 2D structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are some other examples of non-oracular versions of famous oracular problems? Also, is it known that the oracles are always efficiently constructible for the famous cases I mentioned?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2019-08-10T16:51:46.380" LastActivityDate="2019-08-12T02:05:53.077" Title="What are examples of non-oracular versions of famous oracular problems?" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;simons-algorithm&gt;&lt;oracles&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6986" PostTypeId="1" CreationDate="2019-08-10T10:02:45.103" Score="6" ViewCount="68" Body="&lt;p&gt;Why aren't non maximally entangled states produced and used in quantum key distribution schemes? What would be the advantage/disadvantage to use such states rather than maximally entangled ones?&lt;/p&gt;&#xA;" OwnerUserId="4235" LastEditorUserId="55" LastEditDate="2021-01-21T11:05:00.480" LastActivityDate="2021-01-21T12:39:57.580" Title="Non maximally entangled states for QKD" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;non-locality&gt;&lt;qkd&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="6987" PostTypeId="1" AcceptedAnswerId="13478" CreationDate="2019-08-10T19:16:52.440" Score="7" ViewCount="882" Body="&lt;p&gt;I recently read this &lt;a href=&quot;http://image-src.bcg.com/Images/BCG-Where-Will-Quantum-Computers-Create-Value-and-When-May2019_tcm9-220664.pdf&quot; rel=&quot;noreferrer&quot;&gt;report from BCG&lt;/a&gt;, which stated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For scientists trying to design a compound that will attach itself to,&#xA;  and modify, a target disease pathway, the critical first step is to&#xA;  determine the electronic structure of the molecule. But &lt;strong&gt;modeling the&#xA;  structure of a molecule of an everyday drug such as penicillin&lt;/strong&gt;, which&#xA;  has 41 atoms at ground state, &lt;strong&gt;requires a classical computer with some&#xA;  &lt;span class=&quot;math-container&quot;&gt;$10^{86}$&lt;/span&gt; bits&lt;/strong&gt;—more transistors than there are atoms in the observable&#xA;  universe. Such a machine is a physical impossibility. &lt;strong&gt;But for quantum&#xA;  computers&lt;/strong&gt;, this type of simulation &lt;strong&gt;is well within the realm of&#xA;  possibility, requiring a processor with 286 quantum bits&lt;/strong&gt;, or qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Along with this resource estimate for penicillin, I've also seen &lt;a href=&quot;https://venturebeat.com/2019/07/14/ibm-research-explains-how-quantum-computing-works-and-could-be-the-the-supercomputer-of-the-future/&quot; rel=&quot;noreferrer&quot;&gt;similar mentions&lt;/a&gt; of the number of qubits required to model the ground state of caffeine (160 qubits). Given that the above report offers no reference(s) (probably in the name of business intelligence) and much Internet searching and looking into the quantum chemistry literature has come up short, my question is: &lt;strong&gt;Where are these resource estimates coming from – is there a journal article that published these numbers?&lt;/strong&gt; I would really like to identify the methodology and assumptions used in making these estimates.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2019-08-10T19:22:07.283" LastActivityDate="2020-08-26T17:45:11.640" Title="Number of Qubits Required for Simulation of Caffeine and Penicillin Molecules" Tags="&lt;resource-request&gt;&lt;hamiltonian-simulation&gt;&lt;chemistry&gt;&lt;applications&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6988" PostTypeId="2" ParentId="6987" CreationDate="2019-08-11T00:01:44.347" Score="-1" Body="&lt;p&gt;They are just estimates. But they are not arbitrary estimates, but are based on a reference algorithm.&lt;/p&gt;&#xA;&lt;p&gt;For example, a simple algorithm for a particle:&#xA;Grover's algorithm is constructed with two qbits and can be used to find the correct answer to four quantum states of a particle, in a single step.&lt;/p&gt;&#xA;&lt;p&gt;Eventually, a scientific publication would be more accurate in saying: &amp;quot;We have simulated a caffeine molecule using 90 qbits, by the Y-Topological Algorithm.&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="8256" LastEditorUserId="8256" LastEditDate="2020-08-26T16:31:41.603" LastActivityDate="2020-08-26T16:31:41.603" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6989" PostTypeId="1" CreationDate="2019-08-11T06:15:07.030" Score="1" ViewCount="422" Body="&lt;p&gt;I am trying to run QSVM algorithm on the IBMQ backend devices using the API_TOKEN. Below is the snippet of the code that I am running. The code fails the validation test and throws an exception after it is submitted to the IBMQ backend.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import scipy&#xA;from scipy.linalg import expm&#xA;import matplotlib.pyplot as plt&#xA;from mpl_toolkits.mplot3d import Axes3D&#xA;from sklearn import datasets&#xA;from sklearn.model_selection import train_test_split&#xA;from sklearn.preprocessing import StandardScaler, MinMaxScaler&#xA;from sklearn.decomposition import PCA&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name&#xA;from qiskit.aqua.input import ClassificationInput&#xA;from qiskit.aqua import run_algorithm, QuantumInstance&#xA;from qiskit.aqua.algorithms import QSVM&#xA;from qiskit.aqua.components.feature_maps import SecondOrderExpansion&#xA;from qiskit.aqua import set_qiskit_aqua_logging&#xA;&#xA;from qiskit import IBMQ&#xA;IBMQ.save_account(API_TOKEN,overwrite=True)&#xA;_ = IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')&#xA;n = 24&#xA;&#xA;standardScalerObject = StandardScaler().fit(X_train)&#xA;sample_train = standardScalerObject.transform(X_train)&#xA;sample_test = standardScalerObject.transform(X_test)&#xA;&#xA;pca = PCA(n_components=n).fit(sample_train)&#xA;sample_train = pca.transform(sample_train)&#xA;sample_test = pca.transform(sample_test)&#xA;&#xA;# Scale to range -1 to 1&#xA;samples = np.append(sample_train,sample_test,axis=0)&#xA;minmax_scale = MinMaxScaler((-1,1)).fit(samples)&#xA;sample_train = minmax_scale.transform(sample_train)&#xA;sample_test = minmax_scale.transform(sample_test)&#xA;class_labels = [1,0]&#xA;label_train, label_test = y_train, y_test&#xA;training_size = len(y_train)&#xA;test_size = len(y_test)&#xA;sample_train_positive = np.empty((len(finalDrugTargetPair_positive),24))&#xA;sample_train_negative = np.empty((len(finalDrugTargetPair_negative),24))&#xA;count_pos,count_neg = 0,0&#xA;for i in range(len(y_train)):&#xA;    if y_train[i] == 1:&#xA;        sample_train_positive[count_pos] = sample_train[i]&#xA;        count_pos += 1&#xA;    else:&#xA;        sample_train_negative[count_neg] = sample_train[i]&#xA;        count_neg += 1&#xA;sample_test_positive = np.empty((len(finalDrugTargetPair_positive),24))&#xA;sample_test_negative = np.empty((len(finalDrugTargetPair_negative),24))&#xA;count_pos,count_neg = 0,0&#xA;for i in range(len(y_test)):&#xA;    if y_test[i] == 1:&#xA;        sample_test_positive[count_pos] = sample_train[i]&#xA;        count_pos += 1&#xA;    else:&#xA;        sample_test_negative[count_neg] = sample_train[i]&#xA;        count_neg += 1&#xA;print(sample_train_positive.shape)&#xA;print(sample_train_negative.shape)&#xA;training_input = {1:sample_train_positive,0:sample_train_negative}&#xA;test_input = {1:sample_test_positive,0:sample_test_negative}&#xA;feature_map = SecondOrderExpansion(feature_dimension=24, depth=2, entanglement='linear')&#xA;qsvm = QSVM(feature_map, training_input, test_input)&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;quantum_instance = QuantumInstance(backend, shots=512)&#xA;result = qsvm.run(quantum_instance)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Exception Message&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;W0811 05:38:26.500134 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIIZIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.501830 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIZIIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.503939 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIZIIIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.505864 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIZIIIIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.507203 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIIIIIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.508888 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIIIIIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.510094 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIIIIIIIZIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.511391 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIIIZIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.513397 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIIZIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.515936 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIZIIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.517422 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIZIIIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.519120 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIZIIIIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.521319 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIIIIIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.522609 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIIIIIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.524315 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIIIIIIZIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.525660 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIIZIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.526803 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIZIIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.528323 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIZIIIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.529316 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIZIIIIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.530683 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIIIIIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.532210 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIIIIIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.533475 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIIIIIZIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.535063 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIIZIZIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.536294 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIZIIZIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.538482 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIZIIIZIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.540581 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIIIIZIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.542438 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIIIIZIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.544407 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIIIIZIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.547164 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIIZIZIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.548890 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIZIIZIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.551091 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIIIZIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.552363 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIIIZIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.554009 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIIIZIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.555259 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIIZIZIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.557298 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIIZIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.558995 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIIZIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.560379 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIIZIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.561851 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IIZIZIIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.563276 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIIZIIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.566059 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIIZIIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.568841 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, IZIZIIIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.570071 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIIZIIIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:38:26.571298 140084711831424 pauli_expansion.py:136] Due to the limited entangler_map, ZIZIIIIIIIIIIIIIIIIIIIII is skipped.&#xA;W0811 05:42:36.945176 140080057583360 connectionpool.py:662] Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /quantum-computing-user-jobs/qObject-5d4faacc698fad00199197ac.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Credential=a0ee7e2f33ba42d08305f6d858999743%2F20190811%2Fus-east-standard%2Fs3%2Faws4_request&amp;amp;X-Amz-Date=20190811T054236Z&amp;amp;X-Amz-Expires=604800&amp;amp;X-Amz-SignedHeaders=host&amp;amp;X-Amz-Signature=9ab8b3610eef7344e55d7a375bafdf44454eb4aff50746c9996cf2c8cc06abf1&#xA;---------------------------------------------------------------------------&#xA;JobError                                  Traceback (most recent call last)&#xA;&amp;lt;ipython-input-13-265e7d718710&amp;gt; in &amp;lt;module&amp;gt;()&#xA;     15 quantum_instance = QuantumInstance(backend, shots=512)&#xA;     16 &#xA;---&amp;gt; 17 result = qsvm.run(quantum_instance)&#xA;     18 print(result)&#xA;     19 # ran_job = backend.jobs(limit=1)&#xA;&#xA;7 frames&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)&#xA;     62                 quantum_instance.set_config(**kwargs)&#xA;     63             self._quantum_instance = quantum_instance&#xA;---&amp;gt; 64         return self._run()&#xA;     65 &#xA;     66     @abstractmethod&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/algorithms/many_sample/qsvm/qsvm.py in _run(self)&#xA;    306 &#xA;    307     def _run(self):&#xA;--&amp;gt; 308         return self.instance.run()&#xA;    309 &#xA;    310     @property&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/algorithms/many_sample/qsvm/_qsvm_binary.py in run(self)&#xA;    127     def run(self):&#xA;    128         &quot;&quot;&quot;Put the train, test, predict together.&quot;&quot;&quot;&#xA;--&amp;gt; 129         self.train(self._qalgo.training_dataset[0], self._qalgo.training_dataset[1])&#xA;    130         if self._qalgo.test_dataset is not None:&#xA;    131             self.test(self._qalgo.test_dataset[0], self._qalgo.test_dataset[1])&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/algorithms/many_sample/qsvm/_qsvm_binary.py in train(self, data, labels)&#xA;     71         &quot;&quot;&quot;&#xA;     72         scaling = 1.0 if self._qalgo.quantum_instance.is_statevector else None&#xA;---&amp;gt; 73         kernel_matrix = self._qalgo.construct_kernel_matrix(data)&#xA;     74         labels = labels * 2 - 1  # map label from 0 --&amp;gt; -1 and 1 --&amp;gt; 1&#xA;     75         labels = labels.astype(np.float)&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/algorithms/many_sample/qsvm/qsvm.py in construct_kernel_matrix(self, x1_vec, x2_vec, quantum_instance)&#xA;    243                                     num_processes=aqua_globals.num_processes)&#xA;    244 &#xA;--&amp;gt; 245             results = self.quantum_instance.execute(circuits)&#xA;    246 &#xA;    247             if logger.isEnabledFor(logging.DEBUG):&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/quantum_instance.py in execute(self, circuits, **kwargs)&#xA;    209 &#xA;    210         result = run_qobjs(qobjs, self._backend, self._qjob_config, self._backend_options, self._noise_config,&#xA;--&amp;gt; 211                            self._skip_qobj_validation)&#xA;    212 &#xA;    213         if self._measurement_error_mitigation_fitter is not None:&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/aqua/utils/run_circuits.py in run_qobjs(qobjs, backend, qjob_config, backend_options, noise_config, skip_qobj_validation)&#xA;    364         results = []&#xA;    365         for job in jobs:&#xA;--&amp;gt; 366             results.append(job.result(**qjob_config))&#xA;    367 &#xA;    368     result = _combine_result_objects(results) if len(results) != 0 else None&#xA;&#xA;/usr/local/lib/python3.6/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in result(self, timeout, wait)&#xA;    252         if status is not JobStatus.DONE:&#xA;    253             raise JobError('Invalid job state. The job should be DONE but '&#xA;--&amp;gt; 254                            'it is {}'.format(str(status)))&#xA;    255 &#xA;    256         if not self._result:&#xA;&#xA;JobError: 'Invalid job state. The job should be DONE but it is JobStatus.ERROR'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also it would be a great help if someone can guide me so as to retrieve the accuracy and other statistics after the job is executed.&lt;/p&gt;&#xA;" OwnerUserId="8258" LastActivityDate="2019-08-11T06:15:07.030" Title="Job execution issue while using IBMQ Experience" Tags="&lt;qiskit&gt;&lt;error-correction&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="6990" PostTypeId="2" ParentId="6940" CreationDate="2019-08-11T10:08:36.137" Score="3" Body="&lt;p&gt;This can actually be easily done using the Qiskit Terra &lt;code&gt;qiskit.quantum.info.analysis.average.average_data&lt;/code&gt; function that takes the counts data returned by a backend and the desired observable defined by a dict, list, or ndarray.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The doc-string for that function actually has the ZZ your looking for as an example.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-08-11T10:08:36.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6991" PostTypeId="2" ParentId="6978" CreationDate="2019-08-12T01:05:39.943" Score="1" Body="&lt;p&gt;I found the answer in &lt;a href=&quot;https://www.scottaaronson.com/qclec/22.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these notes&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For an ​NP​-complete problem like CircuitSAT, we can be pretty confident that the Grover speedup is real, because no one has found any classical algorithm that’s even slightly better than brute force.  On the other hand, for more “structured” ​NP​-complete problems, we ​&lt;em&gt;do&lt;/em&gt;​ know exponential-time algorithms that are faster than brute force: for example, 3SAT is solvable in about &lt;span class=&quot;math-container&quot;&gt;$O(1.3​^n​)$&lt;/span&gt; time. So then the question becomes a subtle one, of whether Grover’s algorithm can be &lt;em&gt;​combined​&lt;/em&gt; with the best classical tricks that we know, to achieve a polynomial speedup even compared to a classical computer that uses the same tricks.  For many ​NP​-complete problems, the answer seems to be yes, but it need not be yes for all of them.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="551" LastActivityDate="2019-08-12T01:05:39.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6992" PostTypeId="1" CreationDate="2019-08-12T01:14:56.660" Score="3" ViewCount="257" Body="&lt;p&gt;I'm interested in deciding if an oracle is constant or not, but cannot guarantee that the non-constant oracles are balanced. The Deutsch-Jozsa seems like the obvious starting place, but handling the non-constant case deterministic(ie with probability 1) is evading me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just a clarification: I'm only interested in knowing if it is constant, not for what values it diverges. If there was some way of deciding whether the resulting superposition was in an eigenstate or not, that would suffice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Per my comments below, I don't see the reduce from general search to constancy checking. This is why I do not believe the optimality of Grover's search precludes a faster solution to my original problem. Perhaps such a floor would hold if the problem statement allowed oracles to refuse inputs, but I'm not interested in such a case.&lt;/p&gt;&#xA;" OwnerUserId="8259" LastEditorUserId="8259" LastEditDate="2019-08-15T22:07:52.410" LastActivityDate="2019-08-16T07:58:25.677" Title="Deutsch-Jozsa on non-balanced oracles" Tags="&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6993" PostTypeId="1" AcceptedAnswerId="6994" CreationDate="2019-08-12T06:28:03.140" Score="1" ViewCount="399" Body="&lt;p&gt;When setting up projects with Q# I used to start with the given &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quickstart?tabs=tabid-vscode&amp;amp;view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quick-Starting Guide&lt;/a&gt;. Following the tutorial I am able to setup the example problem and the program works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there seems to be some issues when trying to use the Q# Libraries, e.g., the Arithmetic libraries or Arrays. Consider the following minimal working example created from the tutorial:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Driver.cs&lt;/em&gt;&#xA;&lt;code&gt;&#xA;using Microsoft.Quantum.Simulation.Core;&#xA;using Microsoft.Quantum.Simulation.Simulators;&#xA;using System.Diagnostics;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;namespace Microsoft.Quantum.Numerics.Samples&#xA;{&#xA;    class Program&#xA;    {&#xA;        static void Main(string[] args)&#xA;        {&#xA;            using (var qsim = new QuantumSimulator())&#xA;            {&#xA;                RunAll.Run(qsim).Wait();&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Operation.qs&lt;/em&gt;&#xA;&lt;code&gt;&#xA;namespace Bell&#xA;{&#xA;    open Microsoft.Quantum.Canon;&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;    open Microsoft.Quantum.Arithmetic;  // Added this line&#xA;    operation HelloQ () : Unit {&#xA;        Message(&quot;Hello quantum world!&quot;);&#xA;        using ( (xQb, yQb) = (Qubit[5], Qubit[5]) ) // And this block&#xA;        {&#xA;            AddI(LittleEndian(xQb), LittleEndian(yQb));&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where only the line indicating the usage of the Microsoft.Quantum.Arithmetic library and the code block using the &lt;code&gt;AddI($\cdot$)&lt;/code&gt; operation (or function?) have been added to the tutorial code. This results in an error :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;error QS5022: No identifier with that name exists.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas I am sure that this is not a Q# issue, I do wonder if anybody stumbled upon a similar problem, or know how to fix that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Using any of the example code from GitHub, &lt;em&gt;all&lt;/em&gt; functionalities that I was able to add work without any problems. Using such a sample project I can just delete all the code and rewrite it, which works well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; While copy-paste-delete using sample projects is a viable approach to set up new projects, I do wonder what I am missing in the &quot;normal&quot; project setup?&lt;/p&gt;&#xA;" OwnerUserId="7824" LastEditorUserId="2879" LastEditDate="2019-08-12T08:06:42.380" LastActivityDate="2019-08-14T10:26:19.380" Title="Q#: How to setup a project correctly (on Linux, command line)?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="6994" PostTypeId="2" ParentId="6993" CreationDate="2019-08-12T08:05:01.893" Score="0" Body="&lt;p&gt;(I tried the fix in Visual Studio, but I'm pretty sure that will work with command line as well)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to add &lt;code&gt;Microsoft.Quantum.Numerics&lt;/code&gt; NuGet package reference to your project, as described &lt;a href=&quot;https://docs.microsoft.com/quantum/libraries/numerics/installation&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. That is the package in which &lt;code&gt;AddI&lt;/code&gt; is defined, and by default a newly created Q# project doesn't include this reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you copy an existing project from Numerics section of the samples, it will already include the reference to this package (see, for example, &lt;a href=&quot;https://github.com/microsoft/Quantum/blob/master/Numerics/CustomModAdd/CustomModAdd.csproj&quot; rel=&quot;nofollow noreferrer&quot;&gt;this .csproj file&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-12T08:05:01.893" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6995" PostTypeId="2" ParentId="6992" CreationDate="2019-08-12T08:12:54.753" Score="4" Body="&lt;p&gt;This is not so straightforward, I suspect. The issue is being able to distinguish between the constant case (e.g. every input gives output 0) and the case where only one input returns 1, and all others return 0. To distinguish these cases is essentially a Grover Search (the return of 1 being essentially a marked item that you want to search for the existence of), which takes a lot longer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my guess for how things would work is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;run a standard Deutsch-Jozsa a few times. If the answer is not 'constant' every time, you know your function was not constant. If the answer is 'constant' every time, you can estimate how much imbalance the function has (since it will be almost constant)&lt;/li&gt;&#xA;&lt;li&gt;run a Grover search for unknown numbers of marked items.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To be a bit more precise: You have an oracle the evaluates a function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n\mapsto\{0,1\}$&lt;/span&gt;. I'll denote the set of all possible functions of this form by &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;. You want to &lt;em&gt;always&lt;/em&gt; determine if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant or not. Hence, to be able to resolve this question, it is necessary to be also be able to resolve the question on any subset of possible functions &lt;span class=&quot;math-container&quot;&gt;$\lambda\subset\Lambda$&lt;/span&gt;. Clearly, if you know the set is &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; not &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;, you know &lt;em&gt;more&lt;/em&gt; so it must be easier (or, at least, no more difficult).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I'm going to make a particular choice for &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;: the constant function and any of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; functions which have exactly 1 output of 1. Now we can consider the action of evaluating the oracle as 'marking' an item, and our question for deciding if &lt;span class=&quot;math-container&quot;&gt;$f\in\lambda$&lt;/span&gt; is constant is the same as resolving whether the oracle marks 0 or 1 items (where the one marked item could be any). This is exactly the sort of decision problem that Grover's search is built to answer. I know it happens to tell you, as well, which item is marked, but that doesn't change things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, perhaps a stronger way to think about this is, instead, to let &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; be the verifier for an NP-complete problem such as 3-SAT. There is then a decision problem to resolve if there exists an &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt;. Since this is NP-complete and we believe NP&lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt; BQP, we believe, at the very least, that it will take super-polynomial time to resolve the question of whether &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant or not.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-08-16T07:58:25.677" LastActivityDate="2019-08-16T07:58:25.677" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="6996" PostTypeId="2" ParentId="6986" CreationDate="2019-08-12T08:24:26.237" Score="3" Body="&lt;p&gt;In schemes like E91, the idea behind using an entangled state is that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in a particular measurement basis (for both parties), the measurement outcomes are perfectly correlated but completely random (50:50 outcomes).&lt;/li&gt;&#xA;&lt;li&gt;you can perform a Bell test on the state to verify its nature.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Using a maximally entangled state gives you the property of the 50:50 outcomes (which you can see from the reduced density matrix having two eigenvalues of 1/2). You &lt;em&gt;could&lt;/em&gt; use a non-maximally entangled state and still get perfectly correlated outcomes, just with an imbalance in the probabilities. You could compensate for this later (e.g. privacy amplification) but it reduces the length of the key you manage to produce, so best avoided if you have a choice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, violating the bound on some Bell test is tricky. You want to give yourself the maximum chance of violating a Bell inequality. You can easily prove (Tsirelson's bound) that the maximally entangled state is the state that gives maximum violation of the CHSH inequality. This gives you the most overhead to work with given the potential presence of noise in the experiment. Again, provided your state does give violation of  Bell inequality, it doesn't &lt;em&gt;have&lt;/em&gt; to be maximal, but it will cost you in the rate of key generation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-12T08:24:26.237" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6997" PostTypeId="2" ParentId="6982" CreationDate="2019-08-12T08:35:08.143" Score="2" Body="&lt;p&gt;When I was doing some work on &lt;a href=&quot;https://arxiv.org/abs/0901.3626&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum cloning&lt;/a&gt; (so, slightly different applications to the channels you were asking about), I basically ended up setting up the Choi matrix as a description of the action that I'd like to achieve (perfect cloning), averaged over all possible inputs. In that case, the maximum eigenvalue tells you quite a lot - up to a scale factor of the size of the Hilbert space dimension of the input state, it gives you an upper bound on the fidelity that you can achieve that operation with. Moreover, if the maximal eigenvector is maximally entangled, that upper bound in the fidelity can be achieved (you can &lt;a href=&quot;http://arxiv.org/abs/1208.5574&quot; rel=&quot;nofollow noreferrer&quot;&gt;extend that condition&lt;/a&gt; to deal with degeneracy in the maximum eigenvalue).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-12T08:35:08.143" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="6998" PostTypeId="1" AcceptedAnswerId="7000" CreationDate="2019-08-12T13:07:38.687" Score="5" ViewCount="126" Body="&lt;p&gt;This statement can be found in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9702027&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vedral et al. 1997&lt;/a&gt;, eq. (1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, given a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, they claim that any operation on &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; involving local operations plus classical communication can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_k (A_k\otimes B_k)\rho_{AB}(A_k^\dagger\otimes B_k^\dagger)\tag A$$&lt;/span&gt;&#xA;for some operators &lt;span class=&quot;math-container&quot;&gt;$A_k, B_k$&lt;/span&gt;. This is a seminal result, used for example to &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801069&quot; rel=&quot;nofollow noreferrer&quot;&gt;prove the existence of bound entangled states&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't have any problem with the previous statement they make about general local operations being writable as &lt;span class=&quot;math-container&quot;&gt;$\Phi_{\mathrm{LGM}}(\rho)=\sum_{ij}(A_i\otimes B_j)\rho(A_i^\dagger \otimes B_j^\dagger)$&lt;/span&gt;, as any such &lt;span class=&quot;math-container&quot;&gt;$\Phi_{\mathrm{LGM}}$&lt;/span&gt; should be by definition writable as composition/tensor product of two local operations: &lt;span class=&quot;math-container&quot;&gt;$\Phi_{\mathrm{LGM}}=\Phi_A\otimes\Phi_B$&lt;/span&gt;, and then if &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_j$&lt;/span&gt; are the Kraus operators of &lt;span class=&quot;math-container&quot;&gt;$\Phi_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_B$&lt;/span&gt; we get the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when we allow classical communication it seems less obvious what a generic operation should look like. The Kraus decomposition of such a map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; would &lt;em&gt;a priori&lt;/em&gt; be written &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho_{AB})=\sum_k A_k \rho_{AB} A_k^\dagger$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A_k$&lt;/span&gt; acts nonlocally on &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;, but then I'm not sure how to translate the LOCC condition into a constraint for &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-27T12:31:04.903" LastActivityDate="2020-07-27T12:31:04.903" Title="Why can any LOCC operation be written as $\sum_k (A_k\otimes B_k)\rho(A_k^\dagger\otimes B_k^\dagger)$?" Tags="&lt;quantum-operation&gt;&lt;locc-operation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="6999" PostTypeId="2" ParentId="6993" CreationDate="2019-08-13T06:19:51.067" Score="1" Body="&lt;p&gt;According to the [Microsoft website][1], basically you create a new C#  project with language Q#. That should do the trick.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;math-container&quot;&gt;$ dotnet new console -lang Q# -o myApp&#xA;$&lt;/span&gt; cd MyApp&#xA;&lt;span class=&quot;math-container&quot;&gt;$ dotnet run&#xA;Update:&#xA;To add dependencies, such as nuGet, go to your project folder, open the terminal, and run this:&#xA;```&#xA;$&lt;/span&gt; dotnet add package Microsoft.Quantum.Numerics&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;  [1]: https://docs.microsoft.com/en-us/quantum/install-guide/csharp?view=qsharp-preview&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8263" LastEditorUserId="8263" LastEditDate="2019-08-14T10:26:19.380" LastActivityDate="2019-08-14T10:26:19.380" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7000" PostTypeId="2" ParentId="6998" CreationDate="2019-08-13T11:11:47.313" Score="3" Body="&lt;p&gt;The form (A) above is known as a &lt;strong&gt;&lt;em&gt;separable superoperator&lt;/em&gt;&lt;/strong&gt;.  The effect of any LOCC protocol can be described as a separable superoperator, or as a separable POVM&#xA;with POVM elements &lt;span class=&quot;math-container&quot;&gt;$N_i = A_i\otimes B_i$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be seen as follows (adapted from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804053&quot; rel=&quot;nofollow noreferrer&quot;&gt;this answer&lt;/a&gt; - I will focus on the POVM case, the superoperator is obtained by ignoring the final outcome of the POVM):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denote the parties by Alice and Bob. Without loss of generality, we can start with an action of Alice. Alice's first measurement has POVM elements &lt;span class=&quot;math-container&quot;&gt;$A_{i_1}\otimes I$&lt;/span&gt;.  Alice then communicates her outcome &lt;span class=&quot;math-container&quot;&gt;$i_1$&lt;/span&gt; to Bob.  Bob's subsequent measurement has elements &lt;span class=&quot;math-container&quot;&gt;$I\otimes A^{i_1}_{i_2}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$i_2$&lt;/span&gt; enumerates Bob's outcomes, and &lt;span class=&quot;math-container&quot;&gt;$A^{i_1}$&lt;/span&gt; indicates that Bob's POVM can depend on Alice's outcome.  The total POVM of both has then elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;N_{i_1,i_2}=A_{i_1}\otimes B^{i_1}_{i_2}\ ,&#xA;$$&lt;/span&gt;&#xA; which is a separable POVM &lt;span class=&quot;math-container&quot;&gt;$N_i=A_i\otimes B_i$&lt;/span&gt; with double index &lt;span class=&quot;math-container&quot;&gt;$i\equiv{i_1,i_2}$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, this can be iterated to an arbitrary number of rounds, and generalized to an arbitrary number of parties, and will always have POVM elements of the form &lt;span class=&quot;math-container&quot;&gt;$N_i=\otimes B_i\otimes \cdots$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conversely, not every separable POVM can be written as a LOCC POVM. A counterexample is given in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804053&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bennett &lt;em&gt;et al.&lt;/em&gt;, Quantum Nonlocality without Entanglement&lt;/a&gt;, &lt;a href=&quot;https://dx.doi.org/10.1103/PhysRevA.59.1070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. A. 59, 1070 (1999)&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-08-13T11:11:47.313" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7001" PostTypeId="1" CreationDate="2019-08-13T17:15:20.220" Score="5" ViewCount="57" Body="&lt;p&gt;No cloning theorem states that if a counterfeiter is given a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;$&lt;/span&gt; picked from a bunch of non-orthogonal states, then he cannot clone the state perfectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this seems far from useful for many applications. It doesn't rule out the chance that attacker is able to produce a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\big&amp;gt;$&lt;/span&gt; pretty close to &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;^{\otimes 2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We generally want to bound the fidelity (inner product) between attackers output state &lt;span class=&quot;math-container&quot;&gt;$|\phi\big&amp;gt;$&lt;/span&gt; and clone of input state &lt;span class=&quot;math-container&quot;&gt;$|\psi\big&amp;gt;^{\otimes 2}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, consider a set S of states &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_1\big&amp;gt;, |\psi_2\big&amp;gt;, |\psi_3\big&amp;gt;,\cdots |\psi_n\big&amp;gt;\}$&lt;/span&gt;. We pick a state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\big&amp;gt;$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; and give it to attacker. The attacker (a CPTP operator) produces a mixed state &lt;span class=&quot;math-container&quot;&gt;$|\rho_i\big&amp;gt;$&lt;/span&gt;. We want to have an upper bound on the expected fidelity &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i |\big&amp;lt;\psi_i^{\otimes 2}|\rho_i|\psi_i^{\otimes 2}\big&amp;gt;|$&lt;/span&gt; in terms of the given states S and the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. Are there any works which do this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The best counterfeiter (CPTP operator) could actually depend on the list of states S and the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. We would like to bound the advantage of this best counterfeiter (not just generic counterfeiters). &lt;/p&gt;&#xA;" OwnerUserId="8014" LastEditorUserId="8014" LastEditDate="2019-08-14T02:06:45.827" LastActivityDate="2019-08-14T07:50:22.350" Title="Bounding advantage of a 'no cloning theorem' counterfeiter" Tags="&lt;no-cloning-theorem&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7002" PostTypeId="2" ParentId="6964" CreationDate="2019-08-13T18:05:41.420" Score="1" Body="&lt;p&gt;According to [1]:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Readout error is the error in measuring qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You read the figure correctly (44 out of 1000 measurements fail on reading). Note there is yet another, though minor, error there: gate error. It is about errors in quantum gate operation, and is one 10th less than the error of measurement. So, actually there may occur more erroreus results than 44 in total due to the other type of error(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;a href=&quot;https://medium.com/@jonathan_hui/qc-quantum-programming-implementation-issues-51e3a146645e&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/@jonathan_hui/qc-quantum-programming-implementation-issues-51e3a146645e&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4280" LastActivityDate="2019-08-13T18:05:41.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7003" PostTypeId="1" AcceptedAnswerId="7009" CreationDate="2019-08-13T19:19:20.463" Score="2" ViewCount="238" Body="&lt;p&gt;A qubit is given in the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle = \cos\left(\dfrac{\theta}{2}\right)\left|0\right\rangle + &#xA;	e^{i\phi}\sin\left(\dfrac{\theta}{2}\right)\left|1\right\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's us start at &lt;span class=&quot;math-container&quot;&gt;$\left|0\right\rangle$&lt;/span&gt; and rotate about the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis &lt;span class=&quot;math-container&quot;&gt;$180^{\circ}$&lt;/span&gt; (we should end up at &lt;span class=&quot;math-container&quot;&gt;$\left|1\right\rangle$&lt;/span&gt;). Mathematically, it could be shown easily:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\theta = 180^{\circ}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi = 0^{\circ}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle = \cos\left(\dfrac{180}{2}\right)\left|0\right\rangle + &#xA;	e^{i(0)}\sin\left(\dfrac{180}{2}\right)\left|1\right\rangle\\&#xA;\left|\psi\right\rangle = \cos\left(90\right)\left|0\right\rangle + &#xA;	\sin\left(90\right)\left|1\right\rangle\\&#xA;\left|\psi\right\rangle = \left|1\right\rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let's use the rotation matrix instead. The matrix is given as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$R_x(\theta) \equiv e^{-i \theta \mathbb{X}/2} = \cos(\theta/2)\mathbb{I} -i\sin(\theta/2)\mathbb{X} = \begin{bmatrix} \cos(\theta/2) &amp;amp; -i\sin(\theta/2) \\ -i\sin(\theta/2) &amp;amp; \cos(\theta/2)\end{bmatrix}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I} = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbb{X} = \begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using &lt;span class=&quot;math-container&quot;&gt;$R_x(\theta)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_x(180) = \begin{bmatrix} \cos(180/2) &amp;amp; -i\sin(180/2) \\ -i\sin(180/2) &amp;amp; \cos(180/2)\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix}\\&#xA;R_x(180) = \begin{bmatrix}0 &amp;amp; -i\\ -i &amp;amp; 0\end{bmatrix}\begin{bmatrix}1\\0\end{bmatrix}\\&#xA;R_x(180) = \begin{bmatrix}0\\-i\end{bmatrix}\\&#xA;R_x(180) = -i\begin{bmatrix}0\\1\end{bmatrix}.&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, I feel that I am missing something. The vector obtained is correct but with a phase shift of &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am wondering why it is okay to let &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt; (if it is not correct, then what should be the value?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, I would like to know why the rotation matrix only have &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; but not &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2019-08-14T07:26:53.250" Title="Bloch Sphere - Rotation Matrix" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7004" PostTypeId="1" CreationDate="2019-08-13T22:43:25.860" Score="4" ViewCount="161" Body="&lt;p&gt;I'm a little confused about the terminology of measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So say that we have the single qubit state &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle=c_0|0\rangle+c_1|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we perform the projective measurement &lt;span class=&quot;math-container&quot;&gt;$P_0=|0\rangle\langle 0|$&lt;/span&gt;. Then we say that the probability of obtaining the measurement result &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\langle \phi|P_0|\phi \rangle$&lt;/span&gt;. So in this case we're talking about a possible state that can occur in the collapse of the wavefunction of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of P.O.V.M. measurement where we assume it's not a projective measurement, and we label the measurement operators &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; then we say that if the result of the measurement is &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; then we assume that the state sent by Alice was state-x. The probability of the measurement result &lt;span class=&quot;math-container&quot;&gt;$\langle\phi_j| E_i |\phi_j\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in this case, it seems as though we're talking about the measurement of an operator instead , but if &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; can be projective operator and in the case of a projective operator we're measuring the probability of the state collapsing into some state, then why does it seem like that's not what's happening in the more general case ?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="55" LastEditDate="2021-05-04T23:56:22.083" LastActivityDate="2021-05-04T23:56:22.083" Title="What is the relation between POVMs and projective measurements?" Tags="&lt;measurement&gt;&lt;projection-operator&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7005" PostTypeId="2" ParentId="7001" CreationDate="2019-08-13T23:14:15.640" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804001&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Optimal Cloning of Pure States&quot; by Werner, 1998&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although it really should be called &quot;optimal &lt;em&gt;heralded&lt;/em&gt; cloning&quot;, since &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%5Et%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22inc2%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22inc2%22%5D%2C%5B%22%E2%97%A6%22%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22H%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22X%22%2C%22X%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C%22X%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22H%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22%E2%97%A6%22%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22dec2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22dec2%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;it uses a post-selection step&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22X%5Et%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22inc2%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22inc2%22%5D%2C%5B%22%E2%97%A6%22%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22H%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22X%22%2C%22X%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%2C%5B%22X%22%2C%22X%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%5D%2C%5B%22H%22%2C1%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B%22%E2%97%A6%22%2C%22X%22%2C%22%E2%80%A2%22%2C%22%E2%97%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22dec2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22dec2%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PoKGX.png&quot; alt=&quot;Heralded cloning&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically it works by appending maximally mixed states and projecting the qubit+mixed system into the symmetric state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how the state on the left (bloch sphere pointing down-and-left) is turned into two down-and-left-but-slightly-shorter states on the right. The amount of shortening is consistent across all single-qubit input states.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-08-13T23:14:15.640" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7006" PostTypeId="2" ParentId="7004" CreationDate="2019-08-14T00:37:08.737" Score="3" Body="&lt;p&gt;POVMs are &lt;em&gt;more general&lt;/em&gt; than projective measurements. Thus, every projective measurement is also a POVM, by choosing &lt;span class=&quot;math-container&quot;&gt;$E_i=P_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-08-14T00:37:08.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7007" PostTypeId="1" CreationDate="2019-08-14T03:08:23.377" Score="1" ViewCount="265" Body="&lt;p&gt;I often see written &quot;and then we perform measurement in the standard computational basis&quot; but I'm a little fuzzy on what this means as it's never stated what type of measurement we're supposed to take. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly I know what the standard computational basis is and secondly I know that (usually) measurement is take using projective operators. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean is , say we're given some circuit with three qubits for instance and in the circuit at the end is written the measurement symbol on the first and second wire but not the last then how do we know what projective operators to use ( I'm assuming that we have to use a complete set of measurement operators to get a full measurement ). There is no one complete set of measurement operators it all depends on what type of measurement you want to perform so in this case should we  perform projective measurement on the end state with all of :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_0 \otimes P_0\otimes I\\&#xA;\vdots\\&#xA;P_1 \otimes P_1\otimes I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_0 \otimes P_0\otimes P_0\\&#xA;\vdots\\&#xA;P_1 \otimes P_1\otimes P_1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I would assume that we use the first given that the circuit requires measurement on just the first two but then what becomes of the third qubit if we don't project as we would in the second set I listed. Its wavefunction won't collapse if we don't measure it so do we just discard it if the measurement is not stated for it? Otherwise, what do we do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. A little bit of a side note but if we want to perform a measurement in say, for example, the bell basis, then do we just take the density operator of the 4 bell states and treat them as projection operators? &lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="55" LastEditDate="2019-08-14T20:30:18.003" LastActivityDate="2019-08-14T20:30:18.003" Title="Performing a measurement in the standard computational basis of a three qubit system on two qubits" Tags="&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7008" PostTypeId="2" ParentId="7007" CreationDate="2019-08-14T06:52:17.537" Score="2" Body="&lt;p&gt;Your first set of projectors is correct. There's a general rule - if you're not supposed to do anything to a particular qubit, that's described by the identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How you perform the projection is exactly what you would normally do. If &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a 3-qubit state, you calculate, for example, the probability of getting the 00 result:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{00}=\langle\psi|P_0\otimes P_0\otimes I|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;and the state after measurement is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{P_0\otimes P_0\otimes I|\psi\rangle}{\sqrt{p_{00}}}.&#xA;$$&lt;/span&gt;&#xA;You do not discard the third qubit. It does collapse somewhat - for example, had your initial state been &lt;span class=&quot;math-container&quot;&gt;$(|000\rangle+|111\rangle)/\sqrt2$&lt;/span&gt;, you get the 00 answer with probability 1/2, and the final state is &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that there are other, equivalent, ways of performing the same calculation. These have been discussed previously, although I can't immediately lay my hands on a suitable answer that demonstrates them.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-14T06:52:17.537" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7009" PostTypeId="2" ParentId="7003" CreationDate="2019-08-14T07:01:37.640" Score="2" Body="&lt;p&gt;Be careful with your choice of notation. You're using &lt;span class=&quot;math-container&quot;&gt;$(\theta,\phi)$&lt;/span&gt; to describe the input state, and you're using &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; as the angle of rotation. These two are different &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi=0$&lt;/span&gt; simply because you chose your initial state to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. (Actually, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; could be arbitrary, so you pick it to be 0 for simplicity.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It perhaps helps to think about a picture of the Bloch sphere. An arbitrary pure state (on the surface of the sphere) requires two parameters to describe it, &lt;span class=&quot;math-container&quot;&gt;$(\theta,\phi)$&lt;/span&gt;. An arbitrary rotation requires three parameters - an axis (which is two parameters, entirely equivalent to the &lt;span class=&quot;math-container&quot;&gt;$(\theta,\phi)$&lt;/span&gt; of the pure state), and an angle of rotation about that axis. Now, in your example, you have selected a fixed axes, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, and the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; you're using describes the angle of rotation about that axis. See, it's really incomparable to the other &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; you're using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you are correct that the &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; operation gives you the answer that you want only up to a global phase factor. But global phase factors make no difference, and can be neglected.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-08-14T07:26:53.250" LastActivityDate="2019-08-14T07:26:53.250" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7010" PostTypeId="2" ParentId="7004" CreationDate="2019-08-14T07:25:44.047" Score="2" Body="&lt;p&gt;In the case of projective measurements, we have a set of projectors &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt; satisfying the completeness relation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_iP_i=I.&#xA;$$&lt;/span&gt;&#xA;Note that this also means they satisfy &lt;span class=&quot;math-container&quot;&gt;$\sum_iP_i^\dagger P_i$&lt;/span&gt;, which I would argue is more relevant. If you have a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, then with probability &lt;span class=&quot;math-container&quot;&gt;$p_i=\langle\phi|P_i^\dagger P_i|\phi\rangle=\langle\phi|P_i|\phi\rangle$&lt;/span&gt;, you get outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. If you get outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, the state after measurement is &lt;span class=&quot;math-container&quot;&gt;$P_i|\phi\rangle/\sqrt{p_i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a general measurement, you have operators &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt; satisfying a completeness relation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_iM_i^\dagger M_i=I&#xA;$$&lt;/span&gt;&#xA;If you have a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, then with probability &lt;span class=&quot;math-container&quot;&gt;$p_i=\langle\phi|M_i^\dagger M_i|\phi\rangle$&lt;/span&gt;, you get outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. If you get outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, the state after measurement is &lt;span class=&quot;math-container&quot;&gt;$M_i|\phi\rangle/\sqrt{p_i}$&lt;/span&gt;. So you can see how projective measurements are a special case of general measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;POVMs use a slightly different formalism. They make the assumption that you are &lt;em&gt;only&lt;/em&gt; interested in the probability of measurement outcomes, and &lt;em&gt;not&lt;/em&gt; the state after measurement. So, they choose to set &lt;span class=&quot;math-container&quot;&gt;$E_i=M_i^\dagger M_i$&lt;/span&gt;, so they satisfy &lt;span class=&quot;math-container&quot;&gt;$\sum_iE_i=I$&lt;/span&gt;, and the probability of outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$p_i=\langle\phi|E_i|\phi\rangle$&lt;/span&gt;, but the formalism is deliberately chosen so you cannot answer the question of what the post-measurement state is.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-14T07:25:44.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7011" PostTypeId="2" ParentId="7001" CreationDate="2019-08-14T07:40:48.337" Score="2" Body="&lt;p&gt;There is not, generally, a universal result for which you simply plug numbers into a formula. However, there is a good strategy that results in an upper bound for the achievable fidelity, with conditions on when that maximum fidelity can be achieved. I use it quite extensively in these two papers: &lt;a href=&quot;https://arxiv.org/abs/0901.3626&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper1&lt;/a&gt;, &lt;a href=&quot;http://arxiv.org/abs/1208.5574&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper2&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, be aware that there are several different figures of merit that you could use. Your post seems to suggest that you're interested in the global fidelity, i.e. maximising the overlap of the output state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; with the overall target state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|\psi\rangle$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; was the state to be cloned. In that case, there is an &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804001&quot; rel=&quot;nofollow noreferrer&quot;&gt;optimal result&lt;/a&gt;, as stated by Craig Gidney in his answer (I &lt;em&gt;think&lt;/em&gt; that result is only for &quot;universal&quot; cloning where the set of possible input states is &lt;em&gt;any&lt;/em&gt; pure state of the correct dimension, with equal likelihood).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also the single-copy fidelity, where you want the density matrix of each individual qubit to have as large a fidelity as possible with a single copy of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. From my awareness, this is the more commonly studied case, although that's probably just because the global fidelity case is entirely solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the strategy that I suggest is to calculate the matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R=\sum_ip_i|\psi_i\rangle\langle\psi_i|^T\otimes |\psi_i\rangle\langle\psi_i|\otimes |\psi_i\rangle\langle\psi_i|.&#xA;$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; be the maximum eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; be the dimension of the Hilbert space spanned by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. Then the achievable global fidelity is bounded by &lt;span class=&quot;math-container&quot;&gt;$F\leq d\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want the single-copy fidelity, instead you'd use the matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R=\frac{1}{2}\sum_ip_i|\psi_i\rangle\langle\psi_i|^T\otimes\left( |\psi_i\rangle\langle\psi_i|\otimes I+I\otimes |\psi_i\rangle\langle\psi_i|\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In either case, you can decide if the bound can be achieved by looking at the corresponding eigenvector. If the maximum eigenvalue is unique and the eigenvector is maximally entangled across the partition of the first system and the other two, you can achieve the maximum. In the case where there is degeneracy, it is sufficient to find a mixture of those eigenstates such that the reduced density matrix on the first system is maximally mixed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't know about is what you can do if it turns out that the upper bound is not saturated - in all the standard cases, there's sufficient symmetry in the set of input states that the upper bound can be achieved.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-08-14T07:50:22.350" LastActivityDate="2019-08-14T07:50:22.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7012" PostTypeId="1" AcceptedAnswerId="7017" CreationDate="2019-08-14T08:17:15.267" Score="0" ViewCount="54" Body="&lt;p&gt;&lt;strong&gt;Question: how to dynamically assign qubits to variables?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;e.g., say I want to represent a matrix of qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$matrix := \{\vec{v_1}, \vec{v_2}, ..., \vec{v_r}\}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where each vector consists of &lt;span class=&quot;math-container&quot;&gt;$dim$&lt;/span&gt; many coefficients of each &lt;span class=&quot;math-container&quot;&gt;$bitlength$&lt;/span&gt; many qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(To the best of my knowledge) Q# only allows to initiate one-dimensional Qubit arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using ( allQubits = Qubit[rank * dim * bitlength] ) {&#xA;    // Some Code&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which leaves us with the task to assign a partition of that qubit array to variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see three ways of doing that, that first seems very messy, the other two I did not get to work:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remembering indices in the qubit array (this will be messy)&lt;/li&gt;&#xA;&lt;li&gt;Getting a representation of a three dimensional qubits array: &lt;span class=&quot;math-container&quot;&gt;$Qubit[rank][dim][bitlength]$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Getting a custom type of QubitVectors and getting an array of those.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Any solution is welcome, does not have to follow any of these approaches.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Lets start with a &lt;span class=&quot;math-container&quot;&gt;$Qubit[rank][dim][bitl]$&lt;/span&gt; array. Using the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.arrays.partitioned?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Partitioned&lt;/a&gt; function, one can split the &lt;em&gt;allQubits&lt;/em&gt; array into smaller parts, e.g., the qubits that represent a single vector.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Splits a given qubit array into chunks of length size&#xA;operation splitQubitArray( allQubits : Qubit[], chunkSize : Int ) : Qubit[][]&#xA;{   &#xA;    Fact(Length(allQubits) % chunkSize == 0, &quot;Qubit array can not be splitted into equally sized chunks&quot;);&#xA;    Fact(Length(allQubits) / chunkSize &amp;gt; 0, &quot;Qubit array length is smaller than chunk size.&quot;);&#xA;    let numChunks = Length(allQubits) / chunkSize;&#xA;    mutable arraySplit = new Int[numChunks];&#xA;    for (i in 0..(numChunks - 1))&#xA;    {&#xA;        set arraySplit w/= i &amp;lt;- chunkSize;&#xA;    }&#xA;    let res = Partitioned(arraySplit, allQubits);&#xA;    Fact(Length(res[numChunks]) == 0, &quot;Qubit array not split equally.&quot;);&#xA;    return res;&#xA;}&#xA;&#xA;// Split AllQubits into rank many parts.&#xA;// Each part contains dim * bitl many qubits.&#xA;mutable allVecQubits = splitQubitArray( allQubits, dim * bitl );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now we have a two dimensional array, where each entry of the first dimension represents a vector. One can split these further to get out a single vector variable, but I could not figure out how to put this into a iterable array...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mutable vec_1 = splitQubitArray(allVecQubits[0], rank);&#xA;mutable vec_2 = splitQubitArray(allVecQubits[1], rank);&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Option 3, the &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/type-model?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;type model&lt;/a&gt;: we define a type that contains a vector.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;newtype customVec = (Data : Qubit[][]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This leaves me with the problem that I am not able to initialize an array of that type...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mutable qbVectorArray = customVec[0]; // this does not work&#xA;mutable qbVectorArray = new customVec[0]; // this does not work&#xA;mutable qbVectorArray = customVec(new Qubit[][]); // this does not work&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As a note on the side: &#xA;I tried to consule the documentation in &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/expressions?view=qsharp-preview#copy-and-update-expressions&quot; rel=&quot;nofollow noreferrer&quot;&gt;copy-and-update expressions&lt;/a&gt; but could not figure out how to do this, if the custom type contains Qubits. Furthermore the webpage containing the &quot;update-and-reassign statements&quot; for Q# Arrays which is linked in the &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/type-model?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;type model&lt;/a&gt; page seems to be unavailable.&#xA;An example or guide on how to deal with custom types with Qubits would be very much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7824" LastEditorUserId="1978" LastEditDate="2019-08-14T17:13:28.443" LastActivityDate="2019-08-14T17:28:57.280" Title="Q#: dynamically assigning (or updating) multidimensional Qubit arrays" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7013" PostTypeId="1" AcceptedAnswerId="7014" CreationDate="2019-08-14T08:34:32.680" Score="4" ViewCount="565" Body="&lt;p&gt;I find in &lt;a href=&quot;https://github.com/Qiskit/ibmqx-user-guides/blob/master/rst/full-user-guide/000-FAQ/000-Frequently_Asked_Questions.rst&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; that&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;A User has a maximum of 15 credits, and these credits are replenished upon the greater of 24 hours or when your execution has run off the queue.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But what is credit? Is it necessary to deduct one credit when using IBMQ for one operation? Can I use for loop to run 100 times?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="8272" LastEditorUserId="27" LastEditDate="2019-08-14T17:13:46.313" LastActivityDate="2019-08-14T17:13:46.313" Title="What is the IBM Q credits?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7014" PostTypeId="2" ParentId="7013" CreationDate="2019-08-14T09:12:25.380" Score="1" Body="&lt;p&gt;Credits are a way of monitoring the queue, so that no one can add too many jobs to the queue at once, preventing other people from using the device. Depending on the length of your circuit, a variable number of credits will be used. For example, if you only have 10 gates in your circuit it may take 3 credits, but a circuit with 100 gates may take 4 or 5 credits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As stated in the answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6695/how-do-i-check-my-remaining-ibm-q-credits&quot;&gt;this question&lt;/a&gt; the credits system is being deprecated, so it won't be a concern for much longer.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-08-14T09:12:25.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7016" PostTypeId="1" CreationDate="2019-08-14T17:19:47.417" Score="2" ViewCount="41" Body="&lt;p&gt;In the context of stabilizer codes my lecturer writes that &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; is spanned by &lt;span class=&quot;math-container&quot;&gt;$\{|000\rangle,|001\rangle,|110\rangle\, |111 \rangle \}$&lt;/span&gt;. But I don't see how this spans the matrix as it's given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z_1\otimes Z_2 \otimes I= \begin {pmatrix} 1&amp;amp; 0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;0 \\0&amp;amp; 1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;0 \\0&amp;amp; 0&amp;amp;-1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;0 \\ 0&amp;amp; 0&amp;amp;0&amp;amp;-1&amp;amp;0&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;0 \\ 0&amp;amp; 0&amp;amp;0&amp;amp;0&amp;amp;-1&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;0  \\0&amp;amp; 0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;-1&amp;amp;&amp;amp;0&amp;amp;0  \\ 0 &amp;amp; 0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;&amp;amp;1 &amp;amp;0 \\ 0&amp;amp; 0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;&amp;amp;0&amp;amp;1 \end {pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I don't see how any linear combination of the given set can form all the elements of this matrix ?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastActivityDate="2019-08-15T10:29:32.197" Title="Why is $Z_1Z_2$ spanned by this set ? Surely it's too small?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7017" PostTypeId="2" ParentId="7012" CreationDate="2019-08-14T17:28:57.280" Score="2" Body="&lt;p&gt;One important thing to note is that arrays of &lt;code&gt;Qubit&lt;/code&gt; aren't special in Q#, such that a solution that allows for splitting an array of type &lt;code&gt;'T[]&lt;/code&gt; into &lt;code&gt;'T[][][]&lt;/code&gt; will also work for arrays of qubits such as what you get from a &lt;code&gt;using&lt;/code&gt; statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From that perspective, your solution is almost there already; you just need to generalize &lt;code&gt;splitQubitArray&lt;/code&gt; into a function that takes &lt;code&gt;'T&lt;/code&gt; instead, then you can call that with &lt;code&gt;'T&lt;/code&gt; being &lt;code&gt;Qubit[]&lt;/code&gt; instead of &lt;code&gt;Qubit&lt;/code&gt;.&#xA;Turning your operation into a function and adding a type parameter, we get the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Diagnostics;&#xA;&#xA;function Chunked&amp;lt;'T&amp;gt;(array : 'T[], chunkSize : Int) : 'T[][] {&#xA;    Fact(Length(array) % chunkSize == 0, &quot;Array can not be splitted into equally sized chunks&quot;);&#xA;    Fact(Length(array) / chunkSize &amp;gt; 0, &quot;Array length is smaller than chunk size.&quot;);&#xA;    let numChunks = Length(array) / chunkSize;&#xA;    let res = Partitioned(ConstantArray(numChunks, chunkSize), array);&#xA;    Fact(Length(res[numChunks]) == 0, &quot;Qubit array not split equally.&quot;);&#xA;    // Note that since Parititoned always returns&#xA;    // one more array than the length of the array&#xA;    // of chunk sizes, chop off the last element of its result.&#xA;    return Most(res);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This can then be used twice to turn an array of type &lt;code&gt;'T[]&lt;/code&gt; into an array of type &lt;code&gt;'T[][][]&lt;/code&gt; &lt;em&gt;for any&lt;/em&gt; element type &lt;code&gt;'T[]&lt;/code&gt;. For example, we can chunk an array of type &lt;code&gt;Int[]&lt;/code&gt; into a rank-three array of integers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Convert;&#xA;&#xA;function Example() : Unit {&#xA;    let rank3 = Chunked(Chunked(RangeAsIntArray(1.. 5 * 2 * 3), 2), 3);&#xA;    Message(&lt;span class=&quot;math-container&quot;&gt;$&quot;Rank-3 array: {rank3}&quot;);&#xA;    Message($&lt;/span&gt;&quot;Length(rank3) = {Length(rank3)}&quot;);&#xA;    Message(&lt;span class=&quot;math-container&quot;&gt;$&quot;Length(rank3[0]) = {Length(rank3[0])}&quot;);&#xA;    Message($&lt;/span&gt;&quot;Length(rank3[0][0]) = {Length(rank3[0][0])}&quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gives us as our output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Rank-3 array: [[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]],[[13,14],[15,16],[17,18]],[[19,20],[21,22],[23,24]],[[25,26],[27,28],[29,30]]]&#xA;Length(rank3) = 5&#xA;Length(rank3[0]) = 3&#xA;Length(rank3[0][0]) = 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In your example above, then, you could use this new function to make a rank-3 array of qubits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let qubitsAsRank3Array = Chunked(Chunked(allVecQubits), dim), bitlength);&#xA;let vec1 = qubitsAsRank3Array[0];&#xA;let vec1 = qubitsAsRank3Array[1];&#xA;// ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This example can be run online at: &lt;a href=&quot;https://mybinder.org/v2/gist/cgranade/e4a837dcb37a4e60f8e971cf1372a2ef/master&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mybinder.org/v2/gist/cgranade/e4a837dcb37a4e60f8e971cf1372a2ef/master&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2019-08-14T17:28:57.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7018" PostTypeId="1" AcceptedAnswerId="7026" CreationDate="2019-08-14T20:51:31.360" Score="3" ViewCount="164" Body="&lt;p&gt;Consider the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\!\langle\psi|$&lt;/span&gt; of a random pure state in an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional space (in other words, an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional qudit, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb C^N$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$\rho_{ij}=c_i \bar c_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The average value of the diagonal elements of such density matrix, &lt;span class=&quot;math-container&quot;&gt;$|c_i|^2$&lt;/span&gt;, can be seen to be &lt;span class=&quot;math-container&quot;&gt;$\mathbb E[\rho_{ii}]=1/N$&lt;/span&gt;, when sampling the states according to the uniform Haar random distribution (that is, for example, taking the states as a column of a random unitary matrix of the appropriate dimensions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems also natural that the average off-diagonal terms vanish: &lt;span class=&quot;math-container&quot;&gt;$\mathbb E[\rho_{ij}]=\mathbb E[c_i \bar c_j]=\mathbb E[c_i c_j]=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i&amp;lt;j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about &lt;span class=&quot;math-container&quot;&gt;$\mathbb E[\lvert c_i \bar c_j\rvert]$&lt;/span&gt;? Can anything be said in this case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick numerical experiment, plotting this average for different values of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; in loglog scale, gives the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rRUWo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rRUWo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which looks very much like a &lt;span class=&quot;math-container&quot;&gt;$C/N$&lt;/span&gt; behaviour for some constant &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The above plot can be obtained with the following python code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import qutip&#xA;import matplotlib.pyplot as plt&#xA;N = 200&#xA;state_sizes_list = [2, 5, 10, 20, 30, 50, 70, 100, 200, 300]&#xA;averages = []&#xA;for state_size in state_sizes_list:&#xA;  cij_samples = np.zeros(shape=N)&#xA;  for idx in range(N):&#xA;    ket = qutip.rand_ket_haar(N=state_size).full()&#xA;    cij_samples[idx] = np.abs(ket[0] * ket[1])&#xA;  averages.append(cij_samples.mean())&#xA;plt.loglog(state_sizes_list, averages, 'ro-')&#xA;plt.xlabel('N');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-08-16T10:45:41.073" LastActivityDate="2019-08-19T15:44:38.430" Title="What is the average value of $|c_i\bar c_j|$ for a random state $|\psi\rangle=\sum_i c_i|i\rangle$?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7019" PostTypeId="1" CreationDate="2019-08-15T02:03:42.237" Score="2" ViewCount="99" Body="&lt;p&gt;I have a question that's arose from reading &quot;Quantum computing explained&quot; by David McMahon. On page 212 there's an aspect of his description of the quantum Fourier transform which I don't understand . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;He writes that after the Hadamard gate has been applied to the zero'th qubit and then we apply the control phase gate where the zero'th qubit is the target and the first is the control that the state becomes :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I \otimes R_2|x_1&amp;gt;\otimes \tfrac{1}{\sqrt{2}}(|0\rangle +|1\rangle) = |x_1\rangle \otimes \tfrac{1}{\sqrt{2}}(|0\rangle +e^{2\pi i (0.j_0)}|1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have two questions regarding this :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The &lt;span class=&quot;math-container&quot;&gt;$R_2$&lt;/span&gt; gate is a control gate which changes the phase of the second qubit if the if the first is 1 and does nothing if it's zero. However here he rights that the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle $&lt;/span&gt; qubit is never affected by the control gate regardless of the state of the control qubit ? How can this be ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) I was under the impression that all control gates were of the form &lt;span class=&quot;math-container&quot;&gt;$P_0\otimes I+ P_1 \otimes \hat{A}$&lt;/span&gt; ( where &lt;span class=&quot;math-container&quot;&gt;$\hat{A}$&lt;/span&gt; is an observable ) if the first qubit was the control and the second was the target and they were of the form &lt;span class=&quot;math-container&quot;&gt;$I\otimes P_0+ \hat{A} \otimes P_1$&lt;/span&gt; , if the second was the control and the first was the target , yet here he writes &lt;span class=&quot;math-container&quot;&gt;$I \otimes R_2$&lt;/span&gt; Which I thought simply meant do nothing to the first but act on the second without their being any controls involved ? What's going on here ?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="1837" LastEditDate="2019-08-15T07:57:43.707" LastActivityDate="2019-09-14T08:00:36.693" Title="The control phase gate in Quantum fourier transform and the question it brings up regarding control gates in general" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;&lt;quantum-control&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7020" PostTypeId="1" CreationDate="2019-08-15T05:56:52.853" Score="3" ViewCount="116" Body="&lt;p&gt;I'm very confused about the tensor representation of Control gates. I had thought that all control gates were of the form &lt;span class=&quot;math-container&quot;&gt;$P_0 \otimes I+P_1\otimes \hat{A}$&lt;/span&gt;, where this does nothing to the first qubit and acts with the operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on the second, but that there was a conditional implication involved. And I thought that &lt;span class=&quot;math-container&quot;&gt;$I\otimes A$&lt;/span&gt; just meant that you act on the second and not the first but there was no implication of of conditionality? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please clear this up for me?&lt;/p&gt;&#xA;" OwnerUserId="6254" LastEditorUserId="55" LastEditDate="2019-08-19T11:13:32.593" LastActivityDate="2019-08-19T11:13:32.593" Title="Understanding how control gates are written in tensor notation" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7021" PostTypeId="2" ParentId="7019" CreationDate="2019-08-15T07:57:10.537" Score="1" Body="&lt;p&gt;You are correct that a controlled-gate should be written in the form &lt;span class=&quot;math-container&quot;&gt;$P_0\otimes I+P_1\otimes U$&lt;/span&gt; for a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. It certainly should &lt;strong&gt;not&lt;/strong&gt; be of the form &lt;span class=&quot;math-container&quot;&gt;$I\otimes U$&lt;/span&gt;. I don't have a copy of your textbook to hand, but could you perhaps have misread it? Perhaps the author meant &lt;span class=&quot;math-container&quot;&gt;$I\oplus U$&lt;/span&gt;, which is an alternative way of describing the matrix structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is, however, true that if either of the qubits is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, controlled-&lt;span class=&quot;math-container&quot;&gt;$R_2$&lt;/span&gt; does nothing. For example, if the target qubit is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then either (i) the control is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and so &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; was applied to the target. This leaves &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, or (ii) the control is in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$R_2$&lt;/span&gt; is applied to the target. But &lt;span class=&quot;math-container&quot;&gt;$R_2|0\rangle=|0\rangle$&lt;/span&gt; so, again, nothing happens.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-08-15T07:57:10.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7022" PostTypeId="2" ParentId="7020" CreationDate="2019-08-15T08:57:35.003" Score="2" Body="&lt;p&gt;The idea behind a controlled gate is that nothing (i.e. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;) is performed on the control qubit, but the action on the target qubit depends on the state of the control qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, you can't write the action on the target qubit as a unitary operation on only that qubit. That is to say, &lt;strong&gt;the controlled operation can not be of the form &lt;span class=&quot;math-container&quot;&gt;$I_{c} \otimes A_{t}$&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the different specific actions on the target qubit can be 'entangled' to the different states of the control qubit. This is exactly where your notation comes in. Consider the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; operation: if the control qubit's state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, we perform &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on the target qubit, and if the state is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we perform &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. This becomes:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CNOT = |0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes X,&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so in this case &lt;span class=&quot;math-container&quot;&gt;$P_{0} = |0\rangle\langle0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_{1} = |1\rangle\langle1|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that we always have &lt;span class=&quot;math-container&quot;&gt;$\sum_{i} P_{i} = I$&lt;/span&gt; if we sum over a whole basis. Therefore, the action on the control qubit, without any regard to the target qubit, is indeed always &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, i.e. nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: as an added note, keep in mind that these projector operators &lt;span class=&quot;math-container&quot;&gt;$P_{i}$&lt;/span&gt; can &lt;em&gt;never&lt;/em&gt; correspond to unitary operations.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-08-15T08:57:35.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7023" PostTypeId="1" AcceptedAnswerId="7073" CreationDate="2019-08-15T09:10:00.830" Score="0" ViewCount="70" Body="&lt;p&gt;Assume we have a density operator (Hermitian, PSD, with trace 1, where PSD means positive semi-definite) called A for a particle. &lt;span class=&quot;math-container&quot;&gt;$v_i$&lt;/span&gt; shows the i-th eigenvector of A and &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; shows the i-th eigenvalue. I assume that the elements of &lt;span class=&quot;math-container&quot;&gt;$|v_{i}|^2$&lt;/span&gt; form a probability distribution of the particle being in the state &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; shows the probability of happening the i-th state. Now if we omit the j-th row and column of A (called &lt;span class=&quot;math-container&quot;&gt;$A_{-j}$&lt;/span&gt;, is there any intuition behind the obtained matrix and its eigenvalues? &lt;/p&gt;&#xA;" OwnerUserId="7897" LastEditorUserId="8325" LastEditDate="2019-08-23T20:41:36.643" LastActivityDate="2019-08-23T20:41:36.643" Title="Is there any meaning for a density operator if we omit the j-th row and column in quantum mechanics?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7024" PostTypeId="1" CreationDate="2019-08-15T10:11:05.187" Score="4" ViewCount="47" Body="&lt;p&gt;I am researching how to speedup optimization problems using quantum algorithms.&#xA;Many such algoritms use the Euclidean norm of a vector. Hence, I tried to find a quantum algorithm that speedups the calculation of the Euclidean Norm, but with no success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you aware of any quantum algorithms for calculating the norm of the vector? If so, can you please provide a reference (Scientific paper, book) for that algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="8281" LastActivityDate="2019-08-15T10:11:05.187" Title="Are there any quantum algorithms to compute the norm of a vector, better than the classical version (O(d), where d is dimension)" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7025" PostTypeId="2" ParentId="7016" CreationDate="2019-08-15T10:29:32.197" Score="2" Body="&lt;p&gt;This is basically what DaftWullie said in the comments, with a bit of elaboration &amp;mdash;&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert #1 \rangle}\def\bra#1{\!\!\:\langle #1 \rvert}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt; operator when taken as an operation on 3 qubits, and &lt;span class=&quot;math-container&quot;&gt;$\{ \ket{000}, \ket{001}, \ket{110}, \ket{111} \}$&lt;/span&gt; is a set of &lt;span class=&quot;math-container&quot;&gt;$8 \times 1$&lt;/span&gt; column-vectors. There can't be any question of &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt; being spanned by the vectors, so the question you should ask in cases like this is what is actually meant. You seem to have interpreted this as a statement that &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt; is spanned by the &lt;em&gt;projectors&lt;/em&gt; onto those states &amp;mdash; that is, &lt;span class=&quot;math-container&quot;&gt;$\ket{000}\bra{000}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{001}\bra{001}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{110}\bra{110}$&lt;/span&gt;, and  &lt;span class=&quot;math-container&quot;&gt;$\ket{111}\bra{111}$&lt;/span&gt;. This isn't a bad first guess, but as these are each rank-1 projectors and &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt; is a rank-8 operator, as you say there aren't enough for this to hold. (Any unitary operator on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits cannot be expressed as fewer than &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; rank-1 projectors.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What your lecturer presumably meant is that &lt;em&gt;the space which is stabilised by&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt;, that is to say the +1 eigenspace of &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt;, is spanned by the vectors &lt;span class=&quot;math-container&quot;&gt;$\{ \ket{000}, \ket{001}, \ket{110}, \ket{111} \}$&lt;/span&gt;. We can see this is true because &lt;span class=&quot;math-container&quot;&gt;$\ket{00}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{11}$&lt;/span&gt; are the two-qubit it states which are stabilised by &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt;, and in the set of states above we are just taking the tensor product with linearly independent states of the third qubit. For instance, it would be as valid to say that the space stabilised by &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt; is spanned by the vectors &lt;span class=&quot;math-container&quot;&gt;$\{ \ket{00+}, \ket{00-}, \ket{11+}, \ket{11-} \}$&lt;/span&gt;, or indeed by the vectors  &lt;span class=&quot;math-container&quot;&gt;$\{ \ket{000}, \ket{00+}, \ket{111}, \ket{11-} \}$&lt;/span&gt; (though it would be unusual to see a spanning set such as the last one here, as it is not orthogonal).&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-08-15T10:29:32.197" CommentCount="0" CommunityOwnedDate="2019-08-15T12:20:58.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="7026" PostTypeId="2" ParentId="7018" CreationDate="2019-08-15T12:45:24.833" Score="4" Body="&lt;p&gt;The constant is &lt;span class=&quot;math-container&quot;&gt;$C = \frac{\pi}{4}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt;-dimensional vector composed of the real and imaginary parts of the coefficients of a normalized state vector is uniformly distributed on an &lt;span class=&quot;math-container&quot;&gt;$S^{2N-1}$&lt;/span&gt;. Thus the needed expectation value is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{C}{N} = \frac{\int_{S^{2N-1}}|(c_{1x} + i c_{1y}) (c_{2x} - i c_{2y})| d\mu(S^{2N-1})}{\mathrm{Vol}(S^{2N-1})}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Integrals of homogeneous functions over spheres can be traded by Gaussian integrals over the ambient Euclidean space the with proper normalizations; since the angular integrations are the same and we need only to normalize the different radial integrals. In our case we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{C}{N} = \frac{\int_{\mathbb{C}^N}|(c_{1x} + i c_{1y}) (c_{2x} - i c_{2y})| e^{-\sum_j|c_j|^2}\prod_j d\mathrm{Re}(c_j)d\mathrm{Im}(c_j)}{\int_{\mathbb{C}^N}(\sum_j|c_j|^2e^{-\sum_j|c_j|^2}\prod_j d\mathrm{Re}(c_j)d\mathrm{Im}(c_j)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The denominator is the unique symmetric polynomial of the same homogeneity degree as the numerator, thus gives rise to the same radial integration value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Gaussian integral in the numerator is decomposable to two types of integrals and in the one in the denominator denominator is a sum of N similar complex gaussian integrals, thus we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{C}{N} =\frac{\left(\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \sqrt{c_x^2 + c_y^2} e^{-c_x^2 - c_y^2}\right)^2 \left(\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} e^{-c_x^2 - c_y^2}\right)^{N-2}}{N \left(\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} (c_x^2 + c_y^2) e^{-c_x^2 - c_y^2}\right) \left(\int_{-\infty}^{\infty}\int_{-\infty}^{\infty} e^{-c_x^2 - c_y^2}\right)^{N-1}}= \frac{\pi}{4N}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In the above, the integrals can be solved in polar and cartesian coordinates yielding Gamma functions of intgral or half integral arumements)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Remark:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equivalence of the integration formulas is based on the following Dirac delta function limit representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \delta(y) = \lim_{\epsilon \rightarrow 0} \frac{1}{\sqrt{4\pi \epsilon}} e^{-\frac{-y^2}{4\epsilon}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a homogeneous function &lt;span class=&quot;math-container&quot;&gt;$f(x): \mathbb{R}^{2N} \rightarrow \mathbb{R}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(ax) = a^{\alpha} f(x)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denoting: &lt;span class=&quot;math-container&quot;&gt;$ r^2 = \sum_{j=1}^{2N} x_j^2$&lt;/span&gt;, the ratio of integrals:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\int_{\mathbb{R}^{2N}} f(x) \frac{e^{-\frac{r^2-1}{4\epsilon}}}{\sqrt{4\pi \epsilon}}d\mu_L(\mathbb{R}^{2N})}{\int_{\mathbb{R}^{2N}} r^{\alpha} \frac{e^{-\frac{r^2-1}{4\epsilon}}}{\sqrt{4\pi \epsilon}}d\mu_L(\mathbb{R}^{2N})}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is invariant under the scaling &lt;span class=&quot;math-container&quot;&gt;$x_j \rightarrow \sqrt{\frac{\epsilon}{\epsilon’}}x_j$&lt;/span&gt;, and the integral conserves its form with &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; replaced by &lt;span class=&quot;math-container&quot;&gt;$\epsilon’$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the ratio of integrals is independent of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. By taking the limit &lt;span class=&quot;math-container&quot;&gt;$\epsilon = \frac{1}{4}$&lt;/span&gt;, we get our Gaussian integral. By taking the limit &lt;span class=&quot;math-container&quot;&gt;$\epsilon \rightarrow 0$&lt;/span&gt;, we get a delta function concentrating the measure to the spherical shell:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$r^2=1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in the Euclidean space: &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^{2N}$&lt;/span&gt;, which the integral over the &lt;span class=&quot;math-container&quot;&gt;$2N-1$&lt;/span&gt; dimensional sphere.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="55" LastEditDate="2019-08-19T15:44:38.430" LastActivityDate="2019-08-19T15:44:38.430" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="7027" PostTypeId="1" AcceptedAnswerId="7059" CreationDate="2019-08-15T13:10:41.277" Score="1" ViewCount="146" Body="&lt;p&gt;I would like to display two histograms next to each other, using something like matplotlib's subplot function. This doesn't seem to work because plot_histogram() closes the figure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to show a figure that has been closed - see this &lt;a href=&quot;https://stackoverflow.com/questions/31729948/matplotlib-how-to-show-a-figure-that-has-been-closed&quot;&gt;post&lt;/a&gt;. I tried this approach but it doesn't work (see code below). Does anyone know how to do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;figs = []&#xA;for i in range(num):&#xA;    counts = result.get_counts(circuits[i])&#xA;    figs.append(plot_histogram(counts, title='here', bar_labels=True))&#xA;    print(counts)&#xA;plt.subplot(121)&#xA;new_fig = plt.figure()&#xA;new_mngr = new_fig.canvas.manager&#xA;new_mngr.canvas.figure = figs[0]&#xA;fig.set_canvas(new_mngr.canvas)&#xA;plt.show(fig)&#xA;&#xA;plt.subplot(122)&#xA;new_fig = plt.figure()&#xA;new_mngr = new_fig.canvas.manager&#xA;new_mngr.canvas.figure = figs[1]&#xA;fig.set_canvas(new_mngr.canvas)&#xA;plt.show(fig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8282" LastActivityDate="2019-08-19T14:08:22.073" Title="How to do subplots when plot_histogram etc. closes the figure" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7028" PostTypeId="2" ParentId="6963" CreationDate="2019-08-15T17:55:22.737" Score="4" Body="&lt;p&gt;Your question suggests you want to try an experiment that would only work if the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-communication_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no communication theorem&lt;/a&gt; wasn't a thing. So... just be aware of that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Quirk, the time-based gates are not continuously twisting the same qubit over time. Instead, every time a frame is drawn, the current time determines what the one thing the gate will do to the qubits is. When you see the state display to the right rotating, you are seeing a series of outputs that were operated on in slightly different ways (not one state being iteratively operated on and changed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such, the simplest way to emulate the time-based gates in Q# is to create an operation that include a time parameter, run simulations with a variety of time values, and look at the results.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-08-15T17:55:22.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7030" PostTypeId="1" AcceptedAnswerId="7034" CreationDate="2019-08-15T20:43:40.967" Score="3" ViewCount="97" Body="&lt;p&gt;Classically, we have the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamming_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamming Code&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Turbo_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Turbo Code&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reed-Solomon Code&lt;/a&gt;, etc.&#xA;I am interested in knowing the classes of quantum error-correcting codes. They don't have to be analogous to classical codes, just the different classes and categories out there. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="55" LastEditDate="2021-01-21T11:04:49.600" LastActivityDate="2021-01-21T11:04:49.600" Title="What are the Main Classes of Quantum Error-Correcting Codes?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7032" PostTypeId="2" ParentId="6868" CreationDate="2019-08-16T06:23:29.380" Score="1" Body="&lt;p&gt;You will need to use some trickery.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SWAP gates are the conceptually easiest method. For example, let's use qubit 5 as &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt;, and then 5, 6 and 9 as &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt;. Finally, let's use qubit 3 as &lt;span class=&quot;math-container&quot;&gt;$a_4$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the only difficult cnot is &lt;code&gt;cx(5,3)&lt;/code&gt;, between &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_4$&lt;/span&gt;, which cannot be implemented directly. So we could apply a SWAP gate between qubits 3 and 4, which swaps their states. Implementing &lt;code&gt;cx(4,3)&lt;/code&gt;, which is allowed by the device, then has much the same effect as &lt;code&gt;cx(5,3)&lt;/code&gt; would have. To complete the effect, a final SWAP is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since a SWAP is implemented using three cnot gates, the above process requires 7 cnots to reproduce the effect of just one. It would therefore be good to find a more efficient option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possibility is the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.cx(4,3)&#xA;qc.cx(5,4)&#xA;qc.cx(4,3)&#xA;qc.cx(5,4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The end effect of this is to perform &lt;code&gt;qc.cx(5,3)&lt;/code&gt;. It does this by making use of qubit 4. However, it does not matter what the state of qubit 4 was before the process is applied, and it leaves qubit 4 completely unchanged at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A further option could be to encode the state of &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; in many of the physical qubits on the device. For example, you could associate the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;/&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state of &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$|000000\rangle$&lt;/span&gt;/&lt;span class=&quot;math-container&quot;&gt;$|111111\rangle$&lt;/span&gt; states of qubits 1-6. Then a desired state &lt;span class=&quot;math-container&quot;&gt;$a |0\rangle+b|1\rangle$&lt;/span&gt; would be encoded as &lt;span class=&quot;math-container&quot;&gt;$a |000000\rangle+b|111111\rangle$&lt;/span&gt;. A cnot can then be applied between this logical qubit and any of the 8 qubits it is connected to (0 and 7-13).&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-08-16T06:23:29.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7033" PostTypeId="2" ParentId="6839" CreationDate="2019-08-16T07:44:11.553" Score="2" Body="&lt;p&gt;The short answer is: no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The long answer is that only pure states can be encoded in Qiskit. However, there are ways around this. For example, by &lt;a href=&quot;https://en.wikipedia.org/wiki/Purification_of_quantum_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;'purifying'&lt;/a&gt; the state. For example, suppose you wanted the mixture&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = p_0 |0\rangle\langle0| + p_+ |+\rangle\langle+|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do this by creating the entangled state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\psi = \sqrt{p_0} |00\rangle \sqrt{p_+} |1+\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this, each term represents a term from the desired mixed state. The state of the rightmost qubit in each term corresponds to one from the desired mixture. Each term has a unique state from an orthonormal basis on the left most qubit. The amplitude for each term is the square root of the corresponding probability from the mixture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given these properties, the reduced density matrix for the rightmost qubit behaves exactly as the desired mixed state. We just need to leave the leftmost qubit out of any gates we perform, and not measure it at the end.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-08-18T11:21:33.630" LastActivityDate="2019-08-18T11:21:33.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7034" PostTypeId="2" ParentId="7030" CreationDate="2019-08-16T08:04:26.027" Score="4" Body="&lt;p&gt;I would say the most important classes are concatenated codes, topological codes and LDPC codes. But it depends on how one defines 'classes', as one could also talk of CSS vs non-CSS, stabilizer vs subsystem. In any case, I'll explain my three chosen 'classes'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concatenated codes are used in cases where we know a code that has a finite code distance (and hence finite suppression of errors), but we want arbitrarily good error suppression. For a code with one logical qubit made out of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; physical qubits, we can increase suppression by using &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; physical qubits, then using &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; independent instances of the code to make &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; slightly improved logical qubits, and then using those to make another instance of the code. The end result is a single logical qubit, with better suppression than a single instance of the code could realize. This process can then be continued indefinitely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One problem with concatenated codes is that, once you invoke many levels of concatenation, the number of qubits involved in each syndrome measurement can get very large. Topological codes are therefore seen as a great alternative, since these allow the distance to be increased arbitrarily while keeping a constant number of involved in qubits for each syndrome measurement. For example, the surface code is based on a planar lattice of qubits. Syndrome meaurements involve only closely located qubits on the lattice. The code distance is the width of the lattice, and so can be made as large as desired. Topological codes also often allow efficient and effective decoding algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For both concatenated and topological codes, you often have to pay a high price in terms of how many physical qubits make a logical qubit. The best hope for finding ways around this may come from LDPC codes. This is a large and diverse class. It includes the topological codes, but there are also codes that have very different structure. This means that finding ways to decode, and also ways to implement the logical operations required for quantum computing, can be challenging.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-08-16T08:08:54.317" LastActivityDate="2019-08-16T08:08:54.317" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7035" PostTypeId="1" CreationDate="2019-08-16T08:22:45.170" Score="6" ViewCount="131" Body="&lt;p&gt;There is a famous &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0209131&quot; rel=&quot;noreferrer&quot;&gt;paper by Childs, et al&lt;/a&gt;, in which it is shown that a quantum algorithm can find the name of the exit node for a certain graph in a way that is exponentially faster than any classical algorithm. This speedup assumes an oracle that tells you which nodes are connected to a given node, as well as a labelling of the nodes that prevents the exit name being deduced without navigating the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper, a random labelling of the nodes is used. However, this will presumably prevent the efficient implementation of an oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any cases for which an efficient oracle is known, that allows for the exponential speedup?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2021-01-06T01:27:39.410" Title="Oracle for welded tree walk" Tags="&lt;algorithm&gt;&lt;oracles&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7037" PostTypeId="1" AcceptedAnswerId="7063" CreationDate="2019-08-16T16:06:52.107" Score="9" ViewCount="1016" Body="&lt;p&gt;I am trying to understand Grover's algorithm. I read that this algorithm is able to find an entry in an unsorted list in just &lt;span class=&quot;math-container&quot;&gt;$\sqrt N$&lt;/span&gt; steps, and needs only &lt;span class=&quot;math-container&quot;&gt;$\log N$&lt;/span&gt; space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand entanglement and superposition, and I also understand most parts of Shor's Algorithm. When it comes to Grover's algorithm, I often read that this algorithm uses an oracle. But as far as I understand, oracles do not really exist. They are used to describe hypothetical nondeterministic machines. But quantum computers do exist. The algorithm running on a real quantum computer will not really use a clairvoyant ghost who knows things nobody can know at this time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how does it work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not want to read scientific papers that deal with all the details. I just want a brief but correct overview.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's use an example: All 7 books about Harry Potter contain approximately 1 million words (&lt;span class=&quot;math-container&quot;&gt;$N = 1.000.000$&lt;/span&gt;). I want to know if the word &quot;teapot&quot; exists in one of the Harry Potter books, and if so, I want to get the position of at least one occurrence within the text.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the word doesn't exist in the text, it will take me 1 million comparisons on a normal computer, i.e. 1 million steps. Grover will need only &lt;span class=&quot;math-container&quot;&gt;$\sqrt N = 1000$&lt;/span&gt; steps to search through a list of &lt;span class=&quot;math-container&quot;&gt;$N = 1.000.000$&lt;/span&gt; unsorted words. How?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Addendum&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;(reaction to comments)&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not interested in an explanation about how the oracle works. I do not believe in fairies, elves or oracles. I believe in mathematics and physics. Oracles came into computer science when someone wanted to explain how nondeterministic machines like nondeterministic pushdown automatons will work. But nondeterministic machines do not exist in the real world. Even quantum computers aren't nondeterministic. So, there is no need to use fantasy beings with superpowers to explain quantum computers, since quantum computers do exist while wizards, magicians and oracles don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want is an explanation of grover's algorithm that uses only things that really exist in reality, i.e. quantum bits, superposition, entanglement, unitary operators etc. plus all the classic parts that still will be needed to sum up to the full algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And please use my Harry Potter example. If it's easier for you, let's assume that the word &quot;teapot&quot; exists exactly one times in the whole story, so that we know that there is exactly 1 needle in the haystack.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing that I do not understand, is this: How can the algorithm read all seven harry potter books (the complete haystack) and tell where exactly the word &quot;teapot&quot; is written using a number of steps that is proportional to the square root of the input length? How can the algorithm even read an input of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; items in a time proportional to &lt;span class=&quot;math-container&quot;&gt;$\sqrt N$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Addendum II&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I have learned form &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7037/grovers-algorithm-in-a-nutshell/7045#7045&quot;&gt;Norbert's Answer&lt;/a&gt; that Grover's Algorithm is unable to search for items in a database (like words in a list of words). So, what can it be used for? Norbert suggested, that Grover's Algorithm might give a square-root speed up for brute-force algorithms used to solve NP-Problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Travelling_salesman_problem&quot; rel=&quot;noreferrer&quot;&gt;Traveling Salesmen&lt;/a&gt; is a problem in NP. How can you use Grover's Algorithm to find the shortest path?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Traveling Salesman is not feasible, please use any other NP problem as an example, and please explain, how Grover's Algorithm can be used to solve it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I still want to have a brief explanation of Grover's Algorithm (i.e. &lt;strong&gt;Grover's algorithm in a nutshell&lt;/strong&gt;) but didn't get a sufficient answer yet.&lt;/p&gt;&#xA;" OwnerUserId="8294" LastEditorUserId="8294" LastEditDate="2019-08-18T07:33:07.663" LastActivityDate="2019-09-29T04:08:07.130" Title="Grover's algorithm in a nutshell" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="14" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="7038" PostTypeId="1" AcceptedAnswerId="7039" CreationDate="2019-08-16T22:29:15.530" Score="1" ViewCount="136" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Controlled_(cX_cY_cZ)_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; states that a controlled &lt;em&gt;U&lt;/em&gt; gate maps the basis states to the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  |00\rangle \mapsto |00\rangle\\&#xA;  |01\rangle \mapsto |01\rangle\\&#xA;  |10\rangle \mapsto |1 \rangle \otimes U |0 \rangle = |1 \rangle \otimes \left(u_{00}|0 \rangle + u_{10}|1 \rangle\right)\\ &#xA; |11\rangle \mapsto |1 \rangle \otimes U |1 \rangle = |1 \rangle \otimes \left(u_{01}|0 \rangle + x_{11} | 1 \rangle\right)$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering how was this mapping derived?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at &lt;em&gt;Nielsen and Chuang - Quantum Computation and Information 10&lt;span class=&quot;math-container&quot;&gt;$^{th}$&lt;/span&gt;&lt;/em&gt;; but I wasn't able to find the derivation process.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="55" LastEditDate="2019-08-18T14:55:18.847" LastActivityDate="2019-08-18T14:55:18.847" Title="How to derive the way a controlled $U$ gate acts on an input state?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7039" PostTypeId="2" ParentId="7038" CreationDate="2019-08-16T23:44:31.970" Score="4" Body="&lt;p&gt;It is not a derived mapping, it's the mathematical version of the definition of how a controlled gate works: it does nothing to the second qubit if the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and applies the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the second qubit if the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-08-16T23:44:31.970" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7040" PostTypeId="1" CreationDate="2019-08-17T06:46:21.323" Score="2" ViewCount="130" Body="&lt;p&gt;As per IBM's &lt;a href=&quot;https://qiskit.org/documentation/terra/summary_of_quantum_operations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; for quantum circuits, the general unitary operator is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{U}=\begin{bmatrix}\cos(\frac{\theta}{2})&amp;amp;-e^{i\lambda}\sin(\frac{\theta}{2})\\e^{i\phi}\sin(\frac{\theta}{2})&amp;amp;e^{i\phi+i\lambda}\cos(\frac{\theta}{2})\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a better understanding I was working out the algebra with the given constraints (&lt;span class=&quot;math-container&quot;&gt;$\hat{U}^{\dagger}\hat{U}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0\leq\theta\leq\pi$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$0\leq\phi\leq2\pi$&lt;/span&gt;), but I didn't find any step that required a constraint on the sign of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; (rows 1 and 2 of the second column, respectively) such that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is negative and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is positive.&#xA;That said, is it not true that the true general form is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{U}=\begin{bmatrix}\cos(\frac{\theta}{2})&amp;amp;\pm e^{i\lambda}\sin(\frac{\theta}{2})\\e^{i\phi}\sin(\frac{\theta}{2})&amp;amp;\mp e^{i\phi+i\lambda}\cos(\frac{\theta}{2})\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or am I missing some constraint?&lt;/p&gt;&#xA;" OwnerUserId="8295" LastEditorUserId="55" LastEditDate="2019-08-20T10:21:15.650" LastActivityDate="2019-08-20T10:21:15.650" Title="Does the general form of a unitary operator define strict signs for the second column?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7041" PostTypeId="1" CreationDate="2019-08-17T07:41:56.413" Score="3" ViewCount="910" Body="&lt;p&gt;When I perform &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; Hadamard &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates on a single qubit, why is the probability of getting &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; as the outcome 100%? Why is it not 50% 0 and 50% 1 &#xA; instead?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is the second &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate not putting the input from the first &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate into a superposition state?&lt;/p&gt;&#xA;" OwnerUserId="8296" LastEditorUserId="55" LastEditDate="2019-08-18T17:04:31.497" LastActivityDate="2019-08-19T22:47:19.523" Title="How do 2 Hadamard gates act on a single qubit?" Tags="&lt;quantum-gate&gt;&lt;superposition&gt;&lt;hadamard&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7042" PostTypeId="2" ParentId="7041" CreationDate="2019-08-17T09:49:26.060" Score="-1" Body="&lt;p&gt;An &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate doesn't always create superposition. It just rotates all statevectors by 45°. So, when you have a state that is colinear to a component of the vector basis, and you measure it, this state vector always will collapse to the basis vector to which it is colinear, and so you will measure this state with a probability of 100%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you rotate the vector by 45° (this is what the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; operator does). When you measure it now, it will collapse to both basis vectors with the same probability (i.e. 50%). So you will measure it as often as 0 as 1. This is what we call a superposition of both states. The qubit is not in one of both states, but exactly in between.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you rotate if again by 45°, which in sum gives 90°. If your original state was colinear to 1, then now it is colinear to 0 vice versa. When you measure it now, it can't do anything else but collapse to the basis vector to which it is colinear now. So, the probability to measure this new state (which is exactly the negation of the original state) is exactly 100%.&lt;/p&gt;&#xA;" OwnerUserId="8294" LastEditorUserId="55" LastEditDate="2019-08-19T11:08:49.377" LastActivityDate="2019-08-19T11:08:49.377" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7043" PostTypeId="1" AcceptedAnswerId="7046" CreationDate="2019-08-17T13:38:41.133" Score="6" ViewCount="190" Body="&lt;p&gt;The &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Diamond_norm&quot; rel=&quot;nofollow noreferrer&quot;&gt;diamond norm&lt;/a&gt; distance&lt;/strong&gt; between two operations is the maximum trace distance between their outputs for any input (including inputs entangled with qubits not being operated on).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it the case that the Diamond norm is subadditive under composition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Diamond}(U_1 U_2, V_1 V_2) \stackrel{?}{\leq} \text{Diamond}(U_1, V_1) + \text{Diamond}(U_2, V_2)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="124" LastEditDate="2019-08-19T16:10:05.933" LastActivityDate="2019-08-19T16:10:05.933" Title="Is the diamond norm subadditive under composition?" Tags="&lt;trace-distance&gt;&lt;diamond-norm&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7045" PostTypeId="2" ParentId="7037" CreationDate="2019-08-17T23:12:01.313" Score="4" Body="&lt;p&gt;As this seems a recurring question, let me repeat &lt;a href=&quot;https://physics.stackexchange.com/questions/467331/wheres-the-database-in-grovers-algorithm/467418#467418&quot;&gt;my answer from Physics.SE&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;This seems to be a common misunderstanding about Grover's algorithm.  It is not about querying a magically encoded database.  Rather, you have an efficiently computable function &lt;span class=&quot;math-container&quot;&gt;$f(x)\in\{0,1\}$&lt;/span&gt; and you want to find some &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$f(x_0)=1$&lt;/span&gt;.  Since you know how to realize &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; (i.e., you have a circuit), you can run &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; on a quantum computer and use Grover to find such an &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt;. This function can be seen as returning entries of a &amp;quot;database&amp;quot;, which is encoded in a specific function, though I don't particularly like this picture.&lt;/p&gt;&#xA;&lt;p&gt;The relevance is in the fact that a large number of interesting problems (namely, the class NP) are such that solutions might be hard to find, but they are easy to verify.  Thus, Grover gives a square-root speed-up on any brute-force method to solve such a problem (i.e., any method which does not make use of any special structural property of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Differently speaking, Grover's algorithm is &lt;em&gt;not&lt;/em&gt;, I repeat &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt;, about searching Harry Potter books or the like.  It is about speeding up finding solutions of unstructured NP problems (or problems where one does not know the structure), i.e. where the validity of a solution can be checked.  This is often called a &amp;quot;search problem&amp;quot;, but is has nothing to do with &amp;quot;databases&amp;quot; as we would usually think of them, and is thus &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; applicable to Harry Potter.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-08-18T00:18:32.513" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="7046" PostTypeId="2" ParentId="7043" CreationDate="2019-08-18T15:54:41.077" Score="5" Body="&lt;p&gt;For arbitrary linear super-operators &lt;span class=&quot;math-container&quot;&gt;$U_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_j\def\D{\mathrm{Diamond}} \def\Dn#1{\lVert #1 \rVert_\diamond}\def\le{\leqslant} $&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\def\D{\mathrm{Diamond}} \def\Dn#1{\lVert #1 \rVert_\diamond}\def\le{\leqslant} \begin{aligned}&#xA;\D(U_1 U_2, V_1 V_2)&#xA;&amp;amp;= \Dn{U_1 U_2 - V_1 V_2} &#xA;\\&amp;amp;\le \Dn{U_1 U_2 - V_1 U_2} + \Dn{V_1 U_2 - V_1 V_2} &#xA;\\&amp;amp;=  \Dn{(U_1 - V_1) U_2} + \Dn{V_1(U_2-V_2)} &#xA;\\&amp;amp;\le \Dn{U_1 - V_1} \Dn{U_2} + \Dn{V_1} \Dn{U_2 -  V_2}, &#xA;\end{aligned}$$&lt;/span&gt;&#xA;writing compositions by juxtaposition for brevity. &#xA;In the case that &lt;span class=&quot;math-container&quot;&gt;$U_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_j$&lt;/span&gt; are CPTP maps, we have &lt;span class=&quot;math-container&quot;&gt;$\Dn{U_j} = \Dn{V_j} = 1$&lt;/span&gt;, so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;\D(U_1 U_2, V_1 V_2)&#xA;&amp;amp;\le&#xA;\Dn{U_1 - V_1} \Dn{U_2} + \Dn{V_1} \Dn{U_2 -  V_2}&#xA;\\&amp;amp;= \Dn{U_1 - V_1} + \Dn{U_2 -  V_2}&#xA;\\&amp;amp;=&#xA;\D(U_1,V_1) + \D(U_2,V_2).\end{aligned}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-08-18T17:20:42.727" LastActivityDate="2019-08-18T17:20:42.727" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7047" PostTypeId="2" ParentId="7040" CreationDate="2019-08-18T16:07:58.687" Score="1" Body="&lt;p&gt;See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5201/55&quot;&gt;this other answer of mine&lt;/a&gt; for a full derivation of the general form of a unitary &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As shown there, unitary matrices (notice I'm not imposing a constraint on the determinant here) can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}e^{i\alpha_{11}}\cos\theta&amp;amp; e^{i\alpha_{12}}\sin\theta\\&#xA;e^{i\alpha_{21}}\sin\theta &amp;amp; e^{i\alpha_{22}}\cos\theta&#xA;\end{pmatrix},\tag A$$&lt;/span&gt;&#xA;with the parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha_{ij}$&lt;/span&gt; satisfying the condition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha_{11}-\alpha_{12}=\alpha_{21}-\alpha_{22}+\pi.\tag B$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are then many different ways to choose how to write these coefficients. This freedom mostly arises from the fact that a global phase change of the matrix doesn't change anything in the physics, and thus &lt;span class=&quot;math-container&quot;&gt;$U\simeq e^{i\phi}U$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$\phi\in\mathbb R$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One relatively standard way to fix a notation is to fix the determinant. In the above notation, this determinant reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$\det U=e^{i(\alpha_{11}+\alpha_{22})}$&lt;/span&gt;,&#xA;where I've used (B) and standard trigonometry to simplify the coefficients.&#xA;Imposing &lt;span class=&quot;math-container&quot;&gt;$\det U=1$&lt;/span&gt; thus corresponds to the constraint &lt;span class=&quot;math-container&quot;&gt;$\alpha_{11}+\alpha_{22}=0$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$2k\pi$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; integer of course, but nothing changes if we pick &lt;span class=&quot;math-container&quot;&gt;$k&amp;gt;0$&lt;/span&gt; here). Using this again in (B) then also implies &lt;span class=&quot;math-container&quot;&gt;$\alpha_{21}+\alpha_{12}=-\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this added constraint, the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; now reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}e^{i\alpha_{11}}\cos\theta&amp;amp; e^{i\alpha_{12}}\sin\theta\\&#xA;-e^{-i\alpha_{12}}\sin\theta &amp;amp; e^{-i\alpha_{11}}\cos\theta&#xA;\end{pmatrix}.$$&lt;/span&gt;&#xA;Equivalently, I can say that a general &lt;a href=&quot;https://en.wikipedia.org/wiki/Special_unitary_group#The_group_SU(2)&quot; rel=&quot;nofollow noreferrer&quot;&gt;SU(2)&lt;/a&gt; matrix has the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}x&amp;amp; y\\ -\bar y &amp;amp; \bar x\end{pmatrix},\tag C$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$x,y\in\mathbb C$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$|x|^2+|y|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if I want to describe a &lt;em&gt;general&lt;/em&gt; unitary matrix, and not just one with unit determinant, I can simply write &lt;span class=&quot;math-container&quot;&gt;$U=e^{i\phi}(e^{-i\phi}U)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\det U=e^{2i\phi}$&lt;/span&gt; (remember that the determinant of a unitary matrix is always a phase). Then, &lt;span class=&quot;math-container&quot;&gt;$\tilde U\equiv e^{-i\phi}U$&lt;/span&gt; has unit determinant (remember that &lt;span class=&quot;math-container&quot;&gt;$\det(\lambda U)=\lambda^2 \det U$&lt;/span&gt;), and can thus be written as per (C).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting the above results together, we conclude that a generic unitary matrix has the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\varphi}\begin{pmatrix}x &amp;amp; y\\ -\bar y&amp;amp; \bar x\end{pmatrix},\tag D$$&lt;/span&gt;&#xA;with the additional constraint &lt;span class=&quot;math-container&quot;&gt;$|x|^2+|y|^2=1$&lt;/span&gt;, and arbitrary phase &lt;span class=&quot;math-container&quot;&gt;$\varphi\in\mathbb R$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is nice about (D) is that it gives us a pretty straightforward recipe to figure out how the minuses and other phases should be placed: simply put out phases from the matrix in order to make it into a unit-determinant one, and then verify that what is left looks like (C).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying this to your example, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}\cos(\frac{\theta}{2})&amp;amp;-e^{i\lambda}\sin(\frac{\theta}{2})\\e^{i\phi}\sin(\frac{\theta}{2})&amp;amp;e^{i\phi+i\lambda}\cos(\frac{\theta}{2})\end{pmatrix}=&#xA;e^{i(\phi+\lambda)/2}&#xA;\begin{pmatrix}e^{-i(\phi+\lambda)/2}\cos(\frac{\theta}{2})&amp;amp;-e^{i(-\phi+\lambda)/2}\sin(\frac{\theta}{2})\\e^{i(\phi-\lambda)/2}\sin(\frac{\theta}{2})&amp;amp;e^{i(\phi+\lambda)/2}\cos(\frac{\theta}{2})\end{pmatrix},$$&lt;/span&gt;&#xA;which therefore looks like it should.&#xA;It is also worth noting here that this is &lt;em&gt;not&lt;/em&gt; a general parametrisation of a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitary matrix. Global phase aside, a general parametrisation involves &lt;em&gt;three&lt;/em&gt; parameters, not two. It is, however, a general parametrisation of unit determinant unitaries, identifying &lt;span class=&quot;math-container&quot;&gt;$U\sim e^{i\alpha}U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-08-18T16:07:58.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7048" PostTypeId="2" ParentId="7041" CreationDate="2019-08-18T17:06:10.863" Score="4" Body="&lt;p&gt;Most probably because your input state was &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard gate has the property that &lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt;, thus acting on an arbitrary input &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with the Hadamard gate twice in a row results in the output being identical to the input (that is, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-08-19T11:09:05.293" LastActivityDate="2019-08-19T11:09:05.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7049" PostTypeId="1" CreationDate="2019-08-18T18:29:51.247" Score="3" ViewCount="84" Body="&lt;p&gt;Scott Aaronson gives the &lt;a href=&quot;https://www.scottaaronson.com/qclec/23.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;outline&lt;/a&gt; of an algorithm to evaluate whether there exists a satisfying assignment for a given game tree. The idea is to use Grover's search recursively, for each level of the tree. He notes the following problem with this approach.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The problem is that, as the game tree gets deeper and deeper, the&#xA;  advantage of Grover’s algorithm over classical search ​seems​ to get&#xA;  weaker and weaker, for two reasons: first, the amplification that’s&#xA;  needed at each layer to prevent error buildup, and second, the&#xA;  constant factors, which multiply across the layers. Note that each&#xA;  layer actually needs to run Grover’s algorithm on the layer below it&#xA;  ​twice:​ &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Once to do &lt;span class=&quot;math-container&quot;&gt;$ |​x\rangle​ \rightarrow |​x\rangle​ |​f(​x​​)\rangle  $&lt;/span&gt;&lt;/li&gt;&#xA;  &lt;li&gt;And once to  uncompute    garbage.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;  &#xA;  &lt;p&gt;For this reason, the constant factor &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt;, in the&#xA;  running time of Grover’s algorithm, actually becomes &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt;, and  &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2} &amp;gt; 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand what garbage we are trying to uncompute here. Don't we need to perform some kind of a measurement after the first step which obviates the need to uncompute anything? Can someone explain this approach with a short example (perhaps a depth-2 or a depth-3 game tree)?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2019-08-19T03:02:19.273" LastActivityDate="2019-08-19T03:02:19.273" Title="Grover's algorithm for game tree" Tags="&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7050" PostTypeId="1" CreationDate="2019-08-18T20:42:15.417" Score="1" ViewCount="127" Body="&lt;p&gt;From what I read classical computing evolved so quickly because of the funding-applications cycle. Even though the cost to make denser IC's was increasing rapidly, the applications were also getting better and wider so people put lot more money. Thus they were able to scale well with Moore's law. We need to build such a cycle for Quantum computing since it won't happen naturally as we can't expect quantum supremacy to be the first step that draws a ton of money. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I was wondering how could I build applications for NISQ's or any basic few qubit systems practically implemented. For example what is the software that I can help build right now ? What kind of software are people looking for ? What has already been done and what can be done in next year or so ?  &lt;/p&gt;&#xA;" OwnerUserId="8306" LastActivityDate="2019-09-17T19:52:16.990" Title="Software for Quantum Computing" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;applications&gt;&lt;nisq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7051" PostTypeId="2" ParentId="6958" CreationDate="2019-08-19T00:57:06.300" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Superconducting qubits generally have frequencies within the range of 4 - 8 GHz. What design considerations give the upper and lower bounds for what is a feasible design. I.e., why can't they be higher or lower in frequency? [and from a comment]: &quot;... what about the lower bound?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The size of the components, their spacing, and materials determine a reasonable operating frequency range, while the minimum wavelength is twice the lattice spacing.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;From: &quot;&lt;a href=&quot;https://doi.org/10.1016/j.physrep.2017.10.002&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microwave photonics with superconducting quantum circuits&lt;/a&gt;&quot; (Nov 2017), by Xiu Gua, Anton Frisk Kockum, Adam Miranowicz, Yu-xi Liu, and Franco Nori:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;A basic requirement for the SQCs to function as artificial atoms is the anharmonicity of their energy-level spacing. Josephson junctions play an important role in SQCs because of the strong nonlinearity they provide, which is the key to making superconducting artificial atoms anharmonic.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;...&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;A Josephson junction is made of two superconducting electrodes, separated by a thin insulating film (with typical thickness of 1–3 nm) in a sandwich structure, giving rise to an intrinsic capacitance. Cooper pairs, formed by two bound electrons, with opposite spins, in the superconducting electrodes, can tunnel coherently through the insulating barrier one by one.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;...&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In a given SQC, we can thus select the two lowest-energy levels from the non-equally spaced energy spectrum. These two levels form a quantum bit (qubit) for quantum-information processing.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;When an ac voltage is applied to the two electrodes of the Josephson junction, the supercurrent &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is periodically modulated as &lt;span class=&quot;math-container&quot;&gt;$I=I_csin(ωt+ϕ)$&lt;/span&gt; with the Josephson frequency &lt;span class=&quot;math-container&quot;&gt;$ν=ω∕(2π)=2eV∕h$&lt;/span&gt;. This is called the ac Josephson effect. The energy &lt;span class=&quot;math-container&quot;&gt;$hv$&lt;/span&gt; equals the energy change of a Cooper pair transferred across the junction. The voltage applied to a Josephson junction is typically on the order of a few microvolts. Thus, SQCs are usually &lt;strong&gt;operating at frequencies in the microwave regime&lt;/strong&gt;.&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From: &quot;&lt;a href=&quot;https://arxiv.org/abs/1905.13641&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superconducting Qubits: Current State of Play&lt;/a&gt;&quot; (July 26 2019), by Morten Kjaergaard, Mollie E. Schwartz, Jochen Braumüller, Philip Krantz, Joel I-Jan Wang, Simon Gustavsson, and William D. Oliver, on page 5:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;... being only a few percent of the qubit level spacing&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\omega_q/2\pi \equiv \omega_{01}/2\pi \sim 5 \text{GHz}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For single-junction transmons (see Fig. 2(b)), this frequency is&#xA;  set by the size of the shunt capacitor and the critical current &lt;span class=&quot;math-container&quot;&gt;$I_c$&lt;/span&gt; of the Josephson junction, determined by design and fabrication parameters such as materials choice, junction area, and insulator thickness. Replacing the single Josephson junction by a superconducting loop with two junctions in parallel – a dc-SQUID – enables one to tune the effective critical current of the Josephson junction (and hence the qubit frequency) via a magnetic field applied to the dc-SQUID loop. The trade-off for this additional control knob is that the qubit becomes susceptible to magnetic flux noise.&#xA;  Transmon qubits can be coupled capacitively – either directly or as mediated by a resonator “bus” – which, in the natural eigenbasis of the transmon qubits, lead to a two-qubit interaction term ...&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator#Harmonic_oscillators_lattice:_phonons&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harmonic oscillators lattice: phonons&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;The form of the quantization depends on the choice of boundary conditions; for simplicity, we impose periodic boundary conditions, defining the &lt;span class=&quot;math-container&quot;&gt;$(N + 1)th$&lt;/span&gt; atom as equivalent to the first atom. Physically, this corresponds to joining the chain at its ends. The resulting quantization is&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$k=k_{n}={2n\pi \over Na}\quad {\hbox{for}}\ n=0,\pm 1,\pm 2,\ldots ,\pm {N \over 2}.$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The upper bound to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; comes from the &lt;strong&gt;minimum wavelength&lt;/strong&gt;, which is &lt;strong&gt;twice the lattice spacing&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, as discussed above.&quot;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additional Information:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wikipedia - &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Superconducting_quantum_computing#Technology&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superconducting quantum computing - technology&lt;/a&gt;&quot;, &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator#Hamiltonian_and_energy_eigenstates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamiltonian and energy eigenstates&lt;/a&gt;&quot; and &quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Anharmonicity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Anharmonicity&lt;/a&gt;&quot;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="278" LastActivityDate="2019-08-19T00:57:06.300" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7052" PostTypeId="2" ParentId="7050" CreationDate="2019-08-19T01:13:03.417" Score="1" Body="&lt;p&gt;You can participate in and contribute to open-source &lt;a href=&quot;https://github.com/Qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write tools to work with Qiskit and/or other development kits, e.g., my &lt;a href=&quot;https://github.com/jwoehr/qis_job&quot; rel=&quot;nofollow noreferrer&quot;&gt;qis_job&lt;/a&gt; which makes it easy to run a .qasm file right away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write your own toys! See my &lt;a href=&quot;https://github.com/jwoehr/quantum_yiqing&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum_yiqing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7744" LastEditorUserId="7744" LastEditDate="2019-08-19T01:55:22.630" LastActivityDate="2019-08-19T01:55:22.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7054" PostTypeId="1" AcceptedAnswerId="10210" CreationDate="2019-08-19T08:20:55.373" Score="5" ViewCount="152" Body="&lt;p&gt;Quantum depth-2 circuits can be efficiently simulated classically, as shown in Proposition 2 of &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0205133.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper. The following is a quote of the proof.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;After the first time step the quantum state of the circuit consists of&#xA;  a set of 2-qubit entangled states and possibly some 1-qubit states and&#xA;  thus the amplitudes of this state can be efficiently represented&#xA;  classically. We may consider the second computing step and the final&#xA;  measurement step as one single step in which a set of final&#xA;  measurements are performed in arbitrary 2-qubit bases. We pick a first&#xA;  measurement. It is simple to calculate the probabilities for the&#xA;  various outcomes since they depend on the state of no more than four&#xA;  qubits. We flip coins according to the outcome probabilities and fix&#xA;  the outcome. We replace the 4-qubit state by the post-measurement&#xA;  projected state consisting now of 2 qubits. We pick the next&#xA;  measurement and proceed similarly etc. If only a subset of these&#xA;  measured bits are required as output, the rest are simply discarded.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't understand the proof. I get how the first time step can be efficiently simulated as it only consists of disjoint one/two qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what about the second time-step? Why do the measurement outcomes depend on no more than four qubits? Why is it efficient to classically simulate measurement by an arbitrary two qubit basis? I'm not sure how we can simulate the conditional probabilities by putting in the projectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors also remark that adding another layer will break this simulation protocol. I’m not sure why that is the case.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="9006" LastEditDate="2020-03-17T08:19:10.553" LastActivityDate="2020-03-21T16:47:39.483" Title="Simulating depth-2 circuits" Tags="&lt;simulation&gt;&lt;complexity-theory&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="7055" PostTypeId="1" AcceptedAnswerId="7058" CreationDate="2019-08-19T09:23:21.500" Score="2" ViewCount="263" Body="&lt;p&gt;I'm trying to reproduce the results of this article &lt;a href=&quot;https://arxiv.org/abs/1801.03897&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1801.03897&lt;/a&gt;, using Qiskit and Xanadu PennyLane. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Particularly, this part with expected values of the Pauli operators:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Fv0kh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fv0kh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Ansatz circuit from the mentioned article&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZyiyV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZyiyV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get the same results for &lt;span class=&quot;math-container&quot;&gt;$\langle Z_0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 \rangle$&lt;/span&gt; but not for &lt;span class=&quot;math-container&quot;&gt;$\langle X_0X_1 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle Y_0Y_1 \rangle$&lt;/span&gt;.  I calculate expected values in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle Z_0 \rangle = P(q_0=0)-P(q_0=1),$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle Z_1 \rangle = P(q_0=0)-P(q_0=1).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for a product of the Pauli matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle X_0X_1 \rangle = [P(q_0=0)-P(q_0=1)]*[P(q_1=0)-P(q_1=1)],$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle Y_0Y_1 \rangle = [P(q_0=0)-P(q_0=1)]*[P(q_1=0)-P(q_1=1)],$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P(q_0=0)$&lt;/span&gt; is probability of getting qubit 0 in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(q_0=1)$&lt;/span&gt; is probability of getting qubit 0 in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Qiskit for &lt;span class=&quot;math-container&quot;&gt;$\langle X_0X_1 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle Y_0Y_1 \rangle$&lt;/span&gt; I use pre-measurement single-qubit rotations &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_x(-\pi/2)$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Help me understand, where I could make a mistake?&lt;/p&gt;&#xA;" OwnerUserId="6071" LastEditorUserId="371" LastEditDate="2020-08-18T08:56:07.010" LastActivityDate="2020-08-18T08:56:07.010" Title="Expected value of a product of the Pauli matrices in different bases" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;pauli-gates&gt;&lt;pennylane&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7058" PostTypeId="2" ParentId="7055" CreationDate="2019-08-19T12:57:39.563" Score="2" Body="&lt;p&gt;Your expressions for &lt;span class=&quot;math-container&quot;&gt;$\langle X_0X_1 \rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$\langle Y_0Y_1 \rangle$&lt;/span&gt; are correct under the assumption that the two qubits are independently random. In the case that they are correlated, these expressions will not yield the right answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because you have to think of &lt;span class=&quot;math-container&quot;&gt;$X_0X_1$&lt;/span&gt;, for example, as an operator in its own right, rather than just a combination of &lt;span class=&quot;math-container&quot;&gt;$X_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_1$&lt;/span&gt;. This combined operator has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; for any superposition of &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|--\rangle$&lt;/span&gt;, and eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; for any superposition of &lt;span class=&quot;math-container&quot;&gt;$|+-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-+\rangle$&lt;/span&gt;. The expectation value is therefore&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle X_0X_1 \rangle = P(q_0=0, q_1=0)+P(q_0=1, q_1=1)-P(q_0=0, q_1=1)-P(q_0=1, q_1=0).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-08-19T12:57:39.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7059" PostTypeId="2" ParentId="7027" CreationDate="2019-08-19T14:08:22.073" Score="1" Body="&lt;p&gt;&lt;em&gt;~Moved from comment to answer~&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If stopping &lt;code&gt;plot_histogram()&lt;/code&gt; from closing the figure will fix this issue, then there is a way to do just that. If you go into the qiskit code to &lt;code&gt;qiskit/visualization/counts_visualization.py&lt;/code&gt; you will find the &lt;code&gt;plot_histrogram()&lt;/code&gt; method. Near the end of this method, you will see the conditional statement &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if fig: &#xA;    plt.close(fig)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you comment that out, it should stop automatically closing the figure when you call &lt;code&gt;plot_histogram()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-08-19T14:08:22.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7060" PostTypeId="2" ParentId="7041" CreationDate="2019-08-19T16:07:12.540" Score="4" Body="&lt;p&gt;If you apply the same gate twice on a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; you will get out the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; if the hermitian of the gate is the same as the gate. In your case, you applied the Hadamard gate, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, twice on (presumably) the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, and so you got &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as your result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This happens because it is a requirement for quantum computing that gates be unitary. A unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is defined as a matrix where &lt;span class=&quot;math-container&quot;&gt;$$UU^\dagger = I$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is of course the identity matrix. Let's do &lt;span class=&quot;math-container&quot;&gt;$H^\dagger$&lt;/span&gt; real quick: that requires doing the transpose of the matrix (i.e., flipping the elements across the diagonal), and then the complex conjugate of each of the elements. There's no complex numbers in the matrix, so we don't need to worry about that - and doing the transpose just means flipping &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$H^\dagger = H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when you apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; twice to  your state, you are effectively doing &lt;span class=&quot;math-container&quot;&gt;$HH$&lt;/span&gt; - and it is a requirement that this come out to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is literally defined as a matrix where &lt;span class=&quot;math-container&quot;&gt;$$XI=X$$&lt;/span&gt;So here's what you are doing: &lt;span class=&quot;math-container&quot;&gt;$$HH|\psi\rangle $$&lt;/span&gt; and we know that &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt;, so you are doing &lt;span class=&quot;math-container&quot;&gt;$$I|\psi\rangle $$&lt;/span&gt; and we know that any thing multiplied by &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gives itself so you just get out &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this answers your question.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2019-08-19T22:47:19.523" LastActivityDate="2019-08-19T22:47:19.523" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7061" PostTypeId="2" ParentId="4576" CreationDate="2019-08-20T11:08:37.097" Score="2" Body="&lt;p&gt;I think that &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4579/124&quot;&gt;&lt;code&gt;ahelwer&lt;/code&gt;'s answer&lt;/a&gt; touches on some the ways that we think about the complexity of algorithms. However &amp;mdash; given that we don't literally have &quot;oracles&quot; in the real world which we wish to query, you might wonder why we would worry about query complexity, or the idea of oracles at all. I will try to give some perspective on this, and in particular to describe how you might try to think of ways to construct a &quot;Deutsch&amp;ndash;Josza oracle&quot; in a way that you don't feel as though you're cheating.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4589/124&quot;&gt;&lt;code&gt;Norbert Schuch&lt;/code&gt;&lt;/a&gt; points out, for the Deutsch problem which is the elementary case of Deutsch&amp;ndash;Josza, there's not much scope for insights, but I expect that your question about oracles applies more generally as well. That's what I'll speak to here.)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;An intuition about oracles&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The concept of an oracle is a way to allow ourselves to simplify how we talk about computational problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original application of the concept of an oracle was to consider &lt;em&gt;hypothetically&lt;/em&gt; what we could do if we could solve difficult problems, even impossible problems, without committing to how we could do it even in principle. But in computational complexity these days &amp;mdash; particularly in quantum computation, &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;in the cases of Deutsch&amp;ndash;Josza, Bernstein&amp;ndash;Vazirani, and other oracle problems &amp;mdash; the situation is different: the oracle describes a function which is the basis of the &lt;em&gt;problem&lt;/em&gt;. The fact that it is 'an oracle' is a way to structure how we describe the function which is at the centre of the problem: not that we must never contemplate how the function is computed, but that this information is simply not provided as part of the problem, and that we are not concerned with the time or other complexity associated with that function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we take this approach, we can actually obtain answers which are related to very difficult questions in computation. For instance, you may know that we do not know how to prove either &lt;strong&gt;P&lt;/strong&gt;&amp;nbsp;&amp;ne;&amp;nbsp;&lt;strong&gt;NP&lt;/strong&gt; or &lt;strong&gt;P&lt;/strong&gt;&amp;nbsp;=&amp;nbsp;&lt;strong&gt;NP&lt;/strong&gt;, but that we &lt;em&gt;can&lt;/em&gt; show that there are oracles &lt;em&gt;A&lt;/em&gt; such that we can show that &lt;strong&gt;P&lt;/strong&gt;&lt;sup&gt;&lt;em&gt;A&lt;/em&gt;&lt;/sup&gt;&amp;nbsp;&amp;ne;&amp;nbsp;&lt;strong&gt;NP&lt;/strong&gt;&lt;sup&gt;&lt;em&gt;A&lt;/em&gt;&lt;/sup&gt;. What the oracle &lt;em&gt;A&lt;/em&gt; does here is not help a computer (more precisely, a deterministic Turing machine or a nondeterministic Turing machine) to solve a problem &amp;mdash; it represents the problem which the computer must solve. The fact that we can show in some instances that &lt;strong&gt;P&lt;/strong&gt;&lt;sup&gt;&lt;em&gt;A&lt;/em&gt;&lt;/sup&gt;&amp;nbsp;&amp;ne;&amp;nbsp;&lt;strong&gt;NP&lt;/strong&gt;&lt;sup&gt;&lt;em&gt;A&lt;/em&gt;&lt;/sup&gt;, doesn't mean that &lt;strong&gt;P&lt;/strong&gt; is &lt;em&gt;really&lt;/em&gt; different from &lt;strong&gt;NP&lt;/strong&gt;: it just means that just using nondeterminism is really a significant resource for a model of computation to have &amp;mdash; it allows you to solve some problems efficiently, and there is no way generically to simulate nondeterminism efficiently on a deterministic computer. So if you want to solve the problem related to what &lt;em&gt;A&lt;/em&gt; computes, you absolutely would require some information about the structure of any function which could efficiently compute &lt;em&gt;A&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of the main things that oracles are about: they allow you to talk about ways that models of computation can or &lt;em&gt;cannot&lt;/em&gt; solve problems, when you are provided with limited information about the problem.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Using oracle algorithms to solve non-oracle problems&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The Deutsch&amp;ndash;Josza algorithm, or the Bernstein&amp;ndash;Vazirani algorithm, are in principles not algorithms which one performs for their own sake. (Well, not &lt;em&gt;really&lt;/em&gt; &amp;mdash; see the next Section.) They stand for &lt;em&gt;ways that you can solve a problem&lt;/em&gt;. What problems do they solve? They allow you to discover certain features of a function you're interested in &amp;mdash; whether it is constant/balanced, or what vector is associated in some scalar-valued linear function on vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What functions do you perform them on? &amp;mdash; You perform them on any function for which you are interested in the answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The description of these as &lt;em&gt;oracle-based algorithms&lt;/em&gt; is beside the point. The oracle problems basically allow you to know that, with an ideal quantum computer, you can solve the problem &lt;em&gt;even if you know extremely little about the function&lt;/em&gt;, provided that you can actually evaluate the function efficiently in practise. To actually evaluate such a function, of course you will need some description of how to do so, and so you have &lt;em&gt;more&lt;/em&gt; information than in the oracle setting; but that doesn't prevent you from using the same algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens when you have &lt;em&gt;more&lt;/em&gt; information than in the oracle setting, is that suddenly there are &lt;em&gt;other&lt;/em&gt; ways that you might be able to solve the problem. Specifically, it &lt;em&gt;might&lt;/em&gt; become possible to solve the problem efficiently &lt;em&gt;classically&lt;/em&gt;. (This is the same observation as with &lt;strong&gt;P&lt;/strong&gt;&lt;sup&gt;&lt;em&gt;A&lt;/em&gt;&lt;/sup&gt;&amp;nbsp;&amp;ne;&amp;nbsp;&lt;strong&gt;NP&lt;/strong&gt;&lt;sup&gt;&lt;em&gt;A&lt;/em&gt;&lt;/sup&gt;: it proves that there are problems which are in &lt;strong&gt;NP&lt;/strong&gt;, which any efficient deterministic algorithm would at least require &lt;em&gt;actual structural information&lt;/em&gt; to be able to solve &amp;mdash; so that when you provide a description of an efficiently computable function rather than an 'oracle', it is possible that the problem will be in &lt;strong&gt;P&lt;/strong&gt;.) It means that the quantum algorithm &lt;em&gt;might&lt;/em&gt; not have the same advantage over classical algorithms at solving the particular problem you present &amp;mdash; and in fact it may be that the classical approach is better (particularly with the devices we have at the moment).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, just because you have a quantum algorithm to solve something, doesn't mean that it is necessarily the &lt;em&gt;best&lt;/em&gt; way to solve something. This is certainly true of the Deutsch&amp;ndash;Josza algorithm: even in the oracle setting, using randomness is nearly just as good, and it's much better given that we don't have large reliable quantum computers yet! But then again...&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;&quot;Implementing&quot; an oracle&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The purpose of implementing the Deutsch&amp;ndash;Josza algorithm is the same as implementing &quot;&lt;em&gt;Hello,&amp;nbsp;World!&lt;/em&gt;&quot; &amp;mdash; not to solve a pressing unsolved problem, but to practise using a tool which you expect will be useful for doing other things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To practise coding, you should feel absolutely relaxed and comfortable with the &lt;em&gt;idea&lt;/em&gt; of implementing an oracle, and with the idea of the computer &lt;em&gt;evaluating&lt;/em&gt; the oracle. In principle, this is the point of what you want to do. Even if you are using a classical emulator, in which the classical computer is actually evaluating all branches of the superposition and so explicitly finding the answer to a problem in order to pretend that it is a quantum computer acting in a slightly more roundabout way, so be it &amp;mdash; you are practicing how to use a tool which may be useful for other things, and which one day won't be run on a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how should you go about implementing your oracle? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(i)&lt;/strong&gt; If you are really committed to the idea that you are just getting practise, you don't have to pretend that you are doing anything magical. Come up with just any way to implement the oracle function, even if it is blatantly obvious to the casual observer whether the result is constant or balanced. You're just trying to practise realising an algorithm &amp;mdash; don't worry that someone will accuse you of being an impostor, that you're pretending to cure cancer but are actually playing with Lego. You never &lt;em&gt;were&lt;/em&gt; pretending to cure cancer, and you &lt;em&gt;are&lt;/em&gt; playing with Lego by deliberate choice. Embrace that and just do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(ii)&lt;/strong&gt; If you want to be sure that you aren't cheating somehow (nor the emulator, nor the eventual quantum computer), try to find a way to construct your oracle so that it is difficult to tell whether it is balanced or constant. This itself is not necessarily easy to do. It would be natural to try to do this by describing a function &lt;span class=&quot;math-container&quot;&gt;$f(x) = g(x,r)$&lt;/span&gt; for some hidden parameter &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, but coming up with a function &lt;span class=&quot;math-container&quot;&gt;$g(x,r)$&lt;/span&gt; which is either constant or balanced for the evaluation of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, for any (or most?) values of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, and where it isn't obvious how to solve it classically, is non-trivial.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For instance, you could let &lt;span class=&quot;math-container&quot;&gt;$g(x,r) = x \cdot r$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x,r \in \{0,1\}^n$&lt;/span&gt;, and consider a circuit which straightforwardly evaluates &lt;span class=&quot;math-container&quot;&gt;$g(x,r)$&lt;/span&gt; on an auxiliary qubit. In this case, we would then know that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is either constant or balanced. However, the reason why we know this is because &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is obviously balanced if and only if &lt;span class=&quot;math-container&quot;&gt;$r \ne 0$&lt;/span&gt;, and we could tell that easily from the circuit construction.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is conceivable that the above construction could be elaborated / obfuscated somewhat, to obtain a construction which is guaranteed to evaluate either a constant function or a balanced function, and where which of these two occurs is not obvious or even difficult &amp;mdash; but I can't think of how, at the moment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Bear in mind that this actually be very difficult to do &amp;mdash; but if you can see a way to do it, it could be very worthwhile: &lt;a href=&quot;https://arxiv.org/abs/1704.00690&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bravyi, Gossett, and Koening&lt;/a&gt; did something like this for the Bernstein&amp;ndash;Vazirani problem, and it allowed them to show a small but &lt;em&gt;unconditional&lt;/em&gt; separation between quantum and classical complexity, which was one of the more interesting things to occur in quantum complexity in the past several years.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;TL;DR&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Don't sweat over the fact that you're 'evaluating' an oracle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you sweat over anything, only worry that an actual description of the function might make it possible to solve the same problem easily without a quantum computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If your motivation is  only to get practise with quantum programming, don't even worry about that. Save your worrying for worthier problems, like global warming. In the meantime enjoy playing with Legos while you build to something more.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-08-20T11:08:37.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7062" PostTypeId="1" AcceptedAnswerId="7122" CreationDate="2019-08-20T18:58:42.527" Score="7" ViewCount="265" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1804.10068&quot; rel=&quot;noreferrer&quot;&gt;Quantum Machine Learning for data scientists&lt;/a&gt;, Page 34 gives an algorithm to calculate the distance between two classifical vectors. As mentioned in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3965/how-can-i-calculate-the-inner-product-of-two-quantum-registers-of-different-size/3969#3969&quot;&gt;this question&lt;/a&gt;, it is not clear how the SwapTest is done and used to derive the distance. One answer from @cnada suggested that the swap is on the ancilla qubit only, per the original paper &lt;a href=&quot;http://arxiv.org/abs/1307.0411&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithms for supervised and unsupervised machine learning&lt;/a&gt;. However, the SwapTest was not designed on partial inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I try to adapt SwapTest (on Page 33 of &lt;a href=&quot;https://arxiv.org/abs/1804.10068&quot; rel=&quot;noreferrer&quot;&gt;Quantum Machine Learning for data scientists&lt;/a&gt;) to derive as follows (by updating formula 131 with a minus sign, per the same answer from @cnada above), but cannot find the distance from the measurement at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, initialize per DistCalc:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle =  \frac{1}{\sqrt{2}} (|0,a\rangle + |1,b\rangle) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\phi\rangle =  \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$&lt;/span&gt;&#xA;Also let:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi'\rangle =  \frac{1}{\sqrt{2}} (|a,0\rangle + |b,1\rangle) $$&lt;/span&gt;&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$\psi'$&lt;/span&gt; is a valid (normalized) qubit as it can be obtained by swapping qubits from &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, initialize per SwapTest:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | 0, \psi, \phi \rangle = \frac{1}{\sqrt{2Z}} (|a|| 0,0,a,0\rangle - |b|| 0,0,a,1\rangle +|a|| 0,1,b,0\rangle - |b|| 0,1,b,1\rangle   $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply Hadamard gate on first qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | 0, \psi, \phi \rangle = \frac{1}{2\sqrt{Z}} (|a|| 0,0,a,0\rangle + |a|| 1,0,a,0\rangle - |b|| 0,0,a,1\rangle -|b|| 1,0,a,1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+ |a|| 0,1,b,0\rangle+|a|| 1,1,b,0\rangle - |b|| 0,1,b,1\rangle - |b|| 1,1,b,1\rangle )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply Swap gate on the ancilla qubit of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; (before &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;) and the only qubit on &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; (after &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | 0, \psi, \phi \rangle = \frac{1}{2\sqrt{Z}} (|a|| 0,0,a,0\rangle + |a|| 1,0,a,0\rangle - |b|| 0,1,a,0\rangle -|b|| 1,1,a,0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+ |a|| 0,0,b,1\rangle+|a|| 1,0,b,1\rangle - |b|| 0,1,b,1\rangle - |b|| 1,1,b,1\rangle )  $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{\sqrt{2Z}} (|a|\frac{| 0 \rangle+| 1 \rangle}{\sqrt{2}}| 0 \rangle -&#xA;|b|\frac{| 0 \rangle+| 1 \rangle}{\sqrt{2}}| 1 \rangle)(| a,0 \rangle+| b,1 \rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply Hadamard on first qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{2Z}} (|a|| 0,0 \rangle -&#xA;|b|| 0,1 \rangle)(| a,0 \rangle+| b,1 \rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measure on first qubit to get probability in getting first qubit in &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \vert \frac{1}{\sqrt{2Z}} (|a|\langle 0| 0,0 \rangle -&#xA;|b|\langle 0| 0,1 \rangle)(| a,0 \rangle+| b,1 \rangle)]\vert^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2Z} \vert(|a||0 \rangle -&#xA;|b||1 \rangle)(| a,0 \rangle+| b,1 \rangle)\vert^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\vert\frac{|a||0 \rangle -&#xA;|b||1 \rangle}{\sqrt{Z}}\vert^2  \vert\frac{| a,0 \rangle+| b,1 \rangle}{\sqrt{2}}\vert^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=||\phi\rangle|^2||\psi'\rangle|^2 = 1$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is independent of the distance &lt;span class=&quot;math-container&quot;&gt;$|a - b|$&lt;/span&gt;=&lt;span class=&quot;math-container&quot;&gt;$||a||a\rangle - |b||b\rangle|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think about this is that in the SwapTest, both &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; if the swap is indeed done on the ancilla bit of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$|\langle a| b\rangle|=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything wrong in my derivation above?&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="55" LastEditDate="2021-05-22T12:03:33.743" LastActivityDate="2021-05-22T12:03:33.743" Title="Distance calcluation between two vectors" Tags="&lt;machine-learning&gt;&lt;swap-test&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7063" PostTypeId="2" ParentId="7037" CreationDate="2019-08-20T20:09:43.500" Score="4" Body="&lt;p&gt;I will attempt here to address the question of how Grover's algorithm would work, for the specific task of searching a target entry (let's say a &lt;em&gt;word&lt;/em&gt;) in a database of such entries (shall we call it a &lt;em&gt;book&lt;/em&gt;?).&#xA;There have already been plenty of discussions about the general structure of the algorithm (e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1385/55&quot;&gt;&lt;em&gt;Is there a layman's explanation for why Grover's algorithm works?&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1613/55&quot;&gt;&lt;em&gt;How does the Grover diffusion operator work and why is it optimal?&lt;/em&gt;&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4397/55&quot;&gt;&lt;em&gt;Why does Grover's search invert about the mean?&lt;/em&gt;&lt;/a&gt;), as well as how to use it to speed-up finding solutions to NP problems (e.g. &lt;a href=&quot;https://cstheory.stackexchange.com/a/38551/29288&quot;&gt;here&lt;/a&gt; you can find an explicit circuit to apply Grover to a specific 3SAT problem, and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5792/55&quot;&gt;here&lt;/a&gt; is a breakdown of the steps to apply Grover to a generic SAT problem, and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/176/55&quot;&gt;here&lt;/a&gt; is a discussion on how to make a SAT problem into an oracle), so I won't focus on these points here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The specific application of Grover to &lt;em&gt;database searching&lt;/em&gt; has also been discussed e.g. in (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2110/55&quot;&gt;&lt;em&gt;Grover's algorithm: where is the list?&lt;/em&gt;&lt;/a&gt;), (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5696/55&quot;&gt;&lt;em&gt;How is the Grover-Algorithm applied to a database?&lt;/em&gt;&lt;/a&gt;), (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1419/55&quot;&gt;&lt;em&gt;Does the oracle in Grover's algorithm need to contain information about the entirety of the database?&lt;/em&gt;&lt;/a&gt;) and (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2149/55&quot;&gt;&lt;em&gt;Grover's algorithm: what to input to Oracle?&lt;/em&gt;&lt;/a&gt;). &#xA;This answer will thus inevitably overlap with bits and pieces scattered around between those various posts.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Setup: the classical problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Consider the following classical problem. We have an indexed list of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; words. It is thus easy to retrieve a target word &lt;span class=&quot;math-container&quot;&gt;$w_x$&lt;/span&gt; given its index &lt;span class=&quot;math-container&quot;&gt;$x=1,...,N$&lt;/span&gt;. We want to find the index &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$w_0\equiv w_{x_0}$&lt;/span&gt; is some fixed target word.&#xA;Classically, being the database unsorted, there isn't much to do other than just try each &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; until &lt;span class=&quot;math-container&quot;&gt;$w_x$&lt;/span&gt; is found to be equal to &lt;span class=&quot;math-container&quot;&gt;$w_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt;&lt;/strong&gt; Here, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; represents the &lt;em&gt;index&lt;/em&gt; of an entry &lt;span class=&quot;math-container&quot;&gt;$w_x$&lt;/span&gt;. This means that what is usually denoted with &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; when discussing Grover's algorithm, becomes here &lt;span class=&quot;math-container&quot;&gt;$w_x$&lt;/span&gt; instead.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Querying the database&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Going quantum, the first thing we need to do is figure out how to handle the database.&#xA;Grover's algorithm requires as input a superposition state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|D\rangle=\frac{1}{\sqrt N}\sum_x |x,w_x\rangle\in\mathcal H_{\text{index}}\otimes \mathcal H_{\text{entry}},\tag A$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is the index of the corresponding &quot;word&quot; entry &lt;span class=&quot;math-container&quot;&gt;$|w_x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that generating (A) from a corresponding classical database is highly nontrivial, as it amounts to being able to query the (usually classical) database as if it was a quantum state. One possibility that has been put forward is to use a &quot;QRAM&quot; with input &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\equiv\sum_x |x\rangle$&lt;/span&gt; to &quot;load&quot; the database into a superposition (see e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2378/55&quot;&gt;this answer&lt;/a&gt;), but I don't think the actual feasibility of this is fully understood, as of yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyhow, for this answer, let's assume that this problem has somehow been solved. We can thus use a &lt;em&gt;query operator&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q$&lt;/span&gt; which implements the evolution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal Q|x,0\rangle\mapsto|x,w_x\rangle,$$&lt;/span&gt;&#xA;so that &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q|+,0\rangle=|D\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can equivalently write &lt;span class=&quot;math-container&quot;&gt;$|D\rangle$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|D\rangle=\sin\alpha|x_0,w_0\rangle+\cos\alpha|X_\perp\rangle,$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\alpha\in\mathbb R$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\alpha\equiv\arcsin(1/\sqrt N)$&lt;/span&gt;), where &lt;span class=&quot;math-container&quot;&gt;$|x_0,w_0\rangle$&lt;/span&gt; is the target index/word pair, and &lt;span class=&quot;math-container&quot;&gt;$|X_\perp\rangle$&lt;/span&gt; is everything else. We don't need to worry about what &lt;span class=&quot;math-container&quot;&gt;$|X_\perp\rangle$&lt;/span&gt; actually looks like, it is enough to know that it is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|x_0,w_0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Apply the oracle&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The next step is to apply the oracle operation. In this case this is pretty straightforward: we want to implement the mapping &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Orac}_{w_0}:|w\rangle\mapsto(-1)^{\delta_{w=w_0}}|w\rangle$&lt;/span&gt; on the &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_{\text{entry}}$&lt;/span&gt; register.&#xA;We can obtain this operation, for example, by using a pair of additional ancilla registers, and implementing &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Orac}_{w_0}$&lt;/span&gt; as the reversible version of the classical circuit implementing the mapping&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Orac}_{w_0}(|w\rangle\otimes|w_0\rangle\otimes |s\rangle)&#xA;\mapsto |w\rangle\otimes|w_0\rangle\otimes|s\oplus \delta_{w=w_0}\rangle.$$&lt;/span&gt;&#xA;Then, using as input &lt;span class=&quot;math-container&quot;&gt;$|s\rangle=|-\rangle\equiv\frac{1}{\sqrt2}(|0\rangle-|1\rangle)$&lt;/span&gt; gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Orac}_{w_0}(|w\rangle\otimes|w_0\rangle\otimes |-\rangle)&#xA;=(-1)^{\delta_{w=w_0}}&#xA;(|w\rangle\otimes|w_0\rangle\otimes|-\rangle),$$&lt;/span&gt;&#xA;so that we can just write &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Orac}_{w_0}|w\rangle=(-1)^{\delta_{w=w_0}}|w\rangle$&lt;/span&gt; without worrying about the extra registers.&#xA;Equivalently, we can write &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Orac}_{w_0}=I-2\mathbb P(|w_0\rangle)$&lt;/span&gt; (using the notation &lt;span class=&quot;math-container&quot;&gt;$\mathbb P(|\psi\rangle)\equiv|\psi\rangle\!\langle\psi\rvert$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this stage, the evolving state is thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi_1\rangle\equiv N^{-1/2}\sum_x(-1)^{\delta_{w_x,w_0}}|x,w_x\rangle,$&lt;/span&gt;&#xA;or equivalently,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_1\rangle=-\sin\alpha|x_0,w_0\rangle+\cos\alpha|X_\perp\rangle.$$&lt;/span&gt;&#xA;Something that will be useful in the next step is that we can also write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_1\rangle=\cos(2\alpha)|D\rangle+\sin(2\alpha)|D_\perp\rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|D_\perp\rangle\equiv -\cos(\alpha)|x_0,w_0\rangle + \sin(\alpha)|X_\perp\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Diffusion step&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The next step is to apply the &quot;diffusion operator&quot; &lt;span class=&quot;math-container&quot;&gt;$R_D\equiv 2|D\rangle\!\langle D|-I$&lt;/span&gt; in the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_{\text{index}}\otimes\mathcal H_{\text{entry}}$&lt;/span&gt;.&#xA;This operator is such that &lt;span class=&quot;math-container&quot;&gt;$R_D|D\rangle=|D\rangle$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$R_D=-1$&lt;/span&gt; on the rest of the space. Equivalently, &lt;span class=&quot;math-container&quot;&gt;$R_D|X\rangle=(-1)^{1-\delta_{X,D}}|X\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing this is actually a bit tricky, as it requires knowledge of &lt;span class=&quot;math-container&quot;&gt;$|D\rangle$&lt;/span&gt;, and therefore of the database.&#xA;The only way I can think of to do it is using &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal Q^\dagger$&lt;/span&gt;.&#xA;More specifically, we need &lt;span class=&quot;math-container&quot;&gt;$R_D=\mathcal QH^{(1)}\mathcal C^{(2)} H^{(1)}\mathcal Q^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H^{(1)}$&lt;/span&gt; is the Hadamard on the index register, and &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt; denotes the reversible version of a classical circuit mantaining the sign of &lt;span class=&quot;math-container&quot;&gt;$|\boldsymbol 0,\boldsymbol 0\rangle$&lt;/span&gt; and changing the sign of the rest of the basis states. Indeed, consider the action of such &lt;span class=&quot;math-container&quot;&gt;$R_D$&lt;/span&gt; on an input state:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the input is &lt;span class=&quot;math-container&quot;&gt;$|D\rangle$&lt;/span&gt;, then we have &lt;span class=&quot;math-container&quot;&gt;$\mathcal C^{(2)} H^{(1)}\mathcal Q^\dagger|D\rangle=\mathcal C^{(2)} H^{(1)}|+,\boldsymbol 0\rangle=\mathcal C^{(2)} |\boldsymbol 0,\boldsymbol 0\rangle = |\boldsymbol 0,\boldsymbol 0\rangle$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$R_D|D\rangle=|D\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If instead the input is some &lt;span class=&quot;math-container&quot;&gt;$|X\rangle$&lt;/span&gt; orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|D\rangle$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$R_D|X\rangle=\mathcal Q H^{(2)}\mathcal C^{(1)}\sum_{Y\neq(0,0)}|Y\rangle=-|X\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With this, we are pretty much done.&#xA;Applying &lt;span class=&quot;math-container&quot;&gt;$R_D$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\Psi_1\rangle$&lt;/span&gt; gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_2\rangle\equiv R_D|\Psi_1\rangle=&#xA;\cos(2\alpha)|D\rangle-\sin(2\alpha)|D_\perp\rangle&#xA;=\sin(3\alpha)|x_0,w_0\rangle+\cos(3\alpha)|X_\perp\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rest of the algorithm then proceeds as usual: we go back and repeat oracle and diffusion steps &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(\sqrt N)$&lt;/span&gt; times before measuring.&#xA;For further details about how the combined action of oracle and diffusion steps results in an effective rotation of &lt;span class=&quot;math-container&quot;&gt;$2\alpha$&lt;/span&gt; in state space you can have a look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5306/55&quot;&gt;this other answer of mine&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-08-20T20:15:31.070" LastActivityDate="2019-08-20T20:15:31.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7064" PostTypeId="2" ParentId="7037" CreationDate="2019-08-21T04:29:53.383" Score="2" Body="&lt;p&gt;From a software developer point of view, an Oracle is like a blackbox of function to be called. For the traveling salesman problem, if you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; cities, there are up to &lt;span class=&quot;math-container&quot;&gt;$m=\frac{n^2-n}{2}$&lt;/span&gt; direct routes between two cities, an Oracle can tell whether any subset of the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; routes is a valid path (visit each city exactly once) and the total path length is less than a given &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Even though classic method does call such naive Oracle directly, the best known algorithm requires &lt;span class=&quot;math-container&quot;&gt;$O(n^2 2^n)$&lt;/span&gt; operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now one can apply Grover‘s algorithm a few times. For the first time, classically find a path visiting each city at least once, let &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; be the length of this path. If Grover‘s algorithm succeeds, use the length of the found path as &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; for the next round. The total number of rounds shall be small (though I personally have not search diligently for a confirmation). Alternatively, one can at least use binary search of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Since there are at most &lt;span class=&quot;math-container&quot;&gt;$m^n$&lt;/span&gt; valid paths, we need at most &lt;span class=&quot;math-container&quot;&gt;$n\log{m}=O(n\log{n})$&lt;/span&gt; rounds. Each round takes &lt;span class=&quot;math-container&quot;&gt;$O(2^\sqrt{n})$&lt;/span&gt;, hence total cost is &lt;span class=&quot;math-container&quot;&gt;$O(2^\sqrt{n} n\log{n})$&lt;/span&gt;, still much smaller than the classic one. Additional analysis probably will reduce the number of rounds.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="8321" LastEditDate="2019-09-29T04:08:07.130" LastActivityDate="2019-09-29T04:08:07.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7065" PostTypeId="2" ParentId="6681" CreationDate="2019-08-21T11:47:59.290" Score="5" Body="&lt;p&gt;It seems to me that the diagonalisation arguments that can be used are only slightly different from a standard one, &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;such as can be found in these &lt;a href=&quot;https://courses.cs.washington.edu/courses/cse531/16wi/lectures/lect06.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes about the Baker&amp;ndash;Gill&amp;ndash;Solovay Theorem&lt;/a&gt; (&lt;em&gt;i.e.&lt;/em&gt;,&amp;nbsp;that there are oracles &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\mathsf P^A = \mathsf{NP}^A$&lt;/span&gt;  and also oracles &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\mathsf P^A \ne \mathsf{NP}^A$&lt;/span&gt;). Basically, you have to describe how to 'engineer' an adversarial input a little differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how we might use this approach to prove the existence of an oracle &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}^A \not\subseteq \mathsf{BQP}^A$&lt;/span&gt;. For any oracle &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, define a language&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ L_A = \Bigl\{ 1^n \;\Big\vert\; \exists z \in \{0,1\}^n : A(z,0) = (z,1)\Bigr\} . $$&lt;/span&gt;&#xA;It is clear that &lt;span class=&quot;math-container&quot;&gt;$L_A \in \mathsf{NP}^A$&lt;/span&gt; for the simple reason that a nondeterministic Turing machine can examine whether the input is of the form &lt;span class=&quot;math-container&quot;&gt;$1^n$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and then guess a string &lt;span class=&quot;math-container&quot;&gt;$z \in \{0,1\}^n$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$A(z,0) = (z,1)$&lt;/span&gt; if such &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; exists.&#xA;The goal is to show that &lt;span class=&quot;math-container&quot;&gt;$L_A$&lt;/span&gt; cannot be decided in polynomial time, with bounded error, by a uniform unitary circuit family, using the &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/2})$&lt;/span&gt; lower bound on the search problem.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$c,N &amp;gt; 0$&lt;/span&gt; be such that the search problem on oracles with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit inputs requires at least &lt;span class=&quot;math-container&quot;&gt;$c 2^{n/2}$&lt;/span&gt; oracle queries to decide correctly (with probability at least 2/3), for all &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; N$&lt;/span&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathbf C^{(1)}\!$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathbf C^{(2)}\!$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ldots$&lt;/span&gt; be an enumeration of all unitary oracle circuit families &lt;span class=&quot;math-container&quot;&gt;$\mathbf C^{(k)} \!= \{ C^{(k)}_n \}_{n \geqslant 0 }$&lt;/span&gt;, such that the gate-sequence of the circuit &lt;span class=&quot;math-container&quot;&gt;$C^{(k)}_n\!$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit inputs can be produced in time strictly less than &lt;span class=&quot;math-container&quot;&gt;$c 2^{n/2}$&lt;/span&gt;. (This time bound relates to the 'uniformity' condition, where we will be interested in circuits can be computed by a deterministic Turing machine in polynomial time &amp;mdash; a stronger condition than we impose here. The enumeration of these circuit families could be done, for instance, by representing them indirectly by the deterministic Turing machines &lt;span class=&quot;math-container&quot;&gt;$\mathbf T^{(k)}$&lt;/span&gt; which produce their gate sequences, and enumerating &lt;em&gt;those&lt;/em&gt;.) We enumerate the circuit families so that each circuit family occurs infinitely often in the enumeration.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;From the run-time bounds on the description of the gate sequence, it follows in particular that &lt;span class=&quot;math-container&quot;&gt;$C^{(k)}_n$&lt;/span&gt; has fewer than &lt;span class=&quot;math-container&quot;&gt;$c 2^{n/2}$&lt;/span&gt; gates for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, and in particular makes fewer than &lt;span class=&quot;math-container&quot;&gt;$c 2^{n/2}$&lt;/span&gt; queries to the oracle.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, consider the circuit &lt;span class=&quot;math-container&quot;&gt;$C^{(n)}_n\!$&lt;/span&gt;. From the lower bound on the search problem, we know that for &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; N$&lt;/span&gt; there are possible values of the oracle function &lt;span class=&quot;math-container&quot;&gt;$f: \{0,1\}^n \to \{0,1\}$&lt;/span&gt; evaluated by the oracle, such that with probability 2/3, the output produced by &lt;span class=&quot;math-container&quot;&gt;$C^{(n)}_n\!$&lt;/span&gt; on input &lt;span class=&quot;math-container&quot;&gt;$1^n$&lt;/span&gt; is not the correct answer to whether &lt;span class=&quot;math-container&quot;&gt;$\exists z \!\in\! \{0,1\}^n\!:\! f(z) \!=\! 1$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; N$&lt;/span&gt;, select such a function &lt;span class=&quot;math-container&quot;&gt;$f_n$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$C^{(n)}_n$&lt;/span&gt; &quot;fails&quot; in this way.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be an oracle which, on inputs of size &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; N$&lt;/span&gt;, evaluates &lt;span class=&quot;math-container&quot;&gt;$f_{\!\!\:n\!\:}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Having constructed &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in this way, each circuit family &lt;span class=&quot;math-container&quot;&gt;$\mathbf C^{(n)}$&lt;/span&gt; fails to correctly decide &lt;span class=&quot;math-container&quot;&gt;$L_A$&lt;/span&gt; with probability at least 2/3, for some &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; N$&lt;/span&gt; (and infinitely many such &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; in fact).&#xA;Then none of the circuit families &lt;span class=&quot;math-container&quot;&gt;$\mathbf C^{(k)}$&lt;/span&gt; correctly decide &lt;span class=&quot;math-container&quot;&gt;$L_A$&lt;/span&gt; with success probability bounded below by 2/3 on all inputs, so that &lt;span class=&quot;math-container&quot;&gt;$L_A$&lt;/span&gt; cannot be solved with such bounds by any uniform unitary circuit family constructible in time &lt;span class=&quot;math-container&quot;&gt;$p(n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, &lt;span class=&quot;math-container&quot;&gt;$L_A \notin \mathsf{BQP}^A$&lt;/span&gt;, from which it follows that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}^A \not\subseteq \mathsf{BQP}^A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-11-01T04:49:15.640" LastActivityDate="2019-11-01T04:49:15.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7067" PostTypeId="1" AcceptedAnswerId="7069" CreationDate="2019-08-21T18:07:32.740" Score="2" ViewCount="473" Body="&lt;p&gt;I have created a 9 qubit register:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(9)&#xA;c = ClassicalRegister(9)&#xA;qc = QuantumCircuit(q, c)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to measure only 1 of the register(let's suppose i want to measure the 5th register.) How do I implement the code?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.measure(q[register],c[register])&#xA;job = execute(qc,simulator,shots = 1000)&#xA;result = job.result()&#xA;counts = result.get_counts(qc)&#xA;print(&quot;\nTotal count for 0 and 1 are:&quot;,counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My code seems to measure all 9 registers. &lt;/p&gt;&#xA;" OwnerUserId="8334" LastEditorUserId="1386" LastEditDate="2019-08-22T07:05:35.350" LastActivityDate="2019-08-22T07:05:35.350" Title="qiskit - measure only 1 of the register out of n registers" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7069" PostTypeId="2" ParentId="7067" CreationDate="2019-08-21T18:31:09.663" Score="1" Body="&lt;p&gt;In qiskit, if there are classical bits that are not getting a value through a measurement gate, they will default to &lt;code&gt;'0'&lt;/code&gt;. Since you set your circuit up to have 9 classical bits, the &lt;code&gt;counts&lt;/code&gt; will always be bit strings of length 9, even though you are only measuring 1 qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To only measure one qubit, and have that be the only value in the resulting bit string, you need to only have one classical bit in your circuit. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(9)&#xA;c = ClassicalRegister(1) # Changed from 9 to 1&#xA;qc = QuantumCircuit(q, c)&#xA;qc.measure(q[register],c)&#xA;job = execute(qc,simulator,shots = 1000)&#xA;result = job.result()&#xA;counts = result.get_counts(qc)&#xA;print(&quot;\nTotal count for 0 and 1 are:&quot;,counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-08-21T18:31:09.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7071" PostTypeId="1" CreationDate="2019-08-22T03:36:26.743" Score="8" ViewCount="61" Body="&lt;p&gt;(Edited to make the argument and the question more precise)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An argument for quantum computational &quot;supremacy&quot; (specifically in &lt;a href=&quot;http://arxiv.org/abs/1504.07999&quot; rel=&quot;noreferrer&quot;&gt;Bremner &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt; and the &lt;a href=&quot;https://arxiv.org/abs/1608.00263&quot; rel=&quot;noreferrer&quot;&gt;Google paper&lt;/a&gt;) assumes that there exists a classical sampler that outputs a probability &lt;span class=&quot;math-container&quot;&gt;$q_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^{2^n}$&lt;/span&gt; that approximates an output probability &lt;span class=&quot;math-container&quot;&gt;$p_x$&lt;/span&gt; of a quantum device up to an additive error&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|p_z - q_z| \le \epsilon,$$&lt;/span&gt;&#xA;then uses Stockmeyer's counting to improve &lt;span class=&quot;math-container&quot;&gt;$q_x$&lt;/span&gt; to a multiplicative approximate &lt;span class=&quot;math-container&quot;&gt;$\tilde{q}_x$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|p_z - \tilde{q}_z| \le \frac{p_z}{\mathrm{poly}(n)}$$&lt;/span&gt;&#xA;using a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BPP^{NP}}$&lt;/span&gt; machine. This last step works only on a constant fraction of circuits i.e. on average, and relies on &quot;anti-concentration&quot;, a separate property of the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If multiplicatively approximate &lt;span class=&quot;math-container&quot;&gt;$p_x$&lt;/span&gt; is #P-hard on average, then the polynomial hierarchy collapses to the third level (known to contain &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BPP^{NP}}$&lt;/span&gt;) by the fact that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PH \subset P^{\#P}}$&lt;/span&gt;. Thus, we conclude that no such classical sampler exists because we don't believe in PH collapse.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following: we know that &lt;a href=&quot;https://arxiv.org/abs/0811.0898&quot; rel=&quot;noreferrer&quot;&gt;there exists a quantum circuit whose single output probability &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; is #P-complete to compute exactly (&quot;strongly simulate&quot;) yet the probabilities can be sampled efficiently (&quot;weakly simulate&quot;) on a classical computer&lt;/a&gt;. (In fact, this kind of quantum circuits are no more powerful than a BPP machine.) Is there anything close to a &quot;quantum supremacy&quot; argument (albeit there is nothing quantum here) that would apply to a worst-case hard problem that is nevertheless easy to approximate like this? My guess is that there can be none. But what exactly prevents this kind of argument? Is it the lack of anti-concentration, or worst-to-average case reduction, or something more general?&lt;/p&gt;&#xA;" OwnerUserId="343" LastEditorUserId="343" LastEditDate="2019-08-25T12:00:06.273" LastActivityDate="2019-08-25T12:00:06.273" Title="Strong vs weak simulations and the polynomial hierarchy collapse" Tags="&lt;complexity-theory&gt;&lt;quantum-advantage&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="7072" PostTypeId="1" CreationDate="2019-08-22T13:10:19.870" Score="2" ViewCount="108" Body="&lt;p&gt;I want to use Blender and Blender Python Scripts working with Qiskit.&#xA;(want to make 3D creations) (www.blender.org)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this ?&#xA;(because when I try to install Qiskit inside Blender Python, it doesn't work )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to make communication between Blender and Qiskit installed with Anaconda Python ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alain&lt;/p&gt;&#xA;" OwnerUserId="8340" LastActivityDate="2019-08-26T18:27:52.743" Title="Using Qiskit with Blender" Tags="&lt;qiskit&gt;&lt;games&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7073" PostTypeId="2" ParentId="7023" CreationDate="2019-08-22T19:02:10.557" Score="2" Body="&lt;p&gt;When you remove a column and corresponding row from a matrix, the eigenvalues and eigenvectors change according to this: &lt;a href=&quot;https://mathoverflow.net/questions/43514/how-do-eigenvectors-and-eigenvalues-change-when-we-remove-a-row-column-pair-of-a&quot;&gt;https://mathoverflow.net/questions/43514/how-do-eigenvectors-and-eigenvalues-change-when-we-remove-a-row-column-pair-of-a&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only additional thing I will say here is what the consequences would be in quantum mechanics (because the link I gave you is only for general Maths). The consequence would be that what you have may no longer be a density matrix, unless you adjust the rest of the row and columns to compensate for the elements that were taken out (because the sum of the diagonals has to equal 1, so unless the diagonal element deleted was a 0, then you will be affecting the sum of the diagonals when removing that element). If the matrix is no longer a density matrix, then it is no longer a quantum state, so you have to be careful.&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2019-08-22T19:02:10.557" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7074" PostTypeId="2" ParentId="6803" CreationDate="2019-08-22T20:21:03.997" Score="1" Body="&lt;p&gt;You can do this with two ancillae and &lt;span class=&quot;math-container&quot;&gt;$O(n \lg n)$&lt;/span&gt; operations by using the comparator from &lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1706.07884&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constant comparator uses two constant adders:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gijhr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gijhr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The constant adders are a recursive construction from &lt;a href=&quot;https://arxiv.org/abs/1611.07995&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1611.07995&lt;/a&gt; which uses an incrementer and a carry signal propagator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BnpFO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BnpFO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The incrementer uses a normal adder with same-sized input and target registers:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ghm61.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ghm61.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same-sized input/target adder can be done with no ancillae:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HFEWw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HFEWw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the carry propagation uses linear dirty ancillae:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hjjrS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hjjrS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're feeling really ambitious, you can remove at least one of the ancillae by using phasing operations in this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bhOae.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bhOae.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-08-22T20:21:03.997" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7076" PostTypeId="1" AcceptedAnswerId="7089" CreationDate="2019-08-22T22:18:50.613" Score="2" ViewCount="85" Body="&lt;p&gt;I have a state &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; that has an extractable Bell state and I want to write it as a Bell state, &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;, with a local unitary acting on one side. Basically I am trying to find a local unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that satisfies:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    |p\rangle = (U \otimes 1)|b\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; is a Bell state&#xA;&lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; is a known state with an extractable Bell state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know how to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial guess was &lt;span class=&quot;math-container&quot;&gt;$U \otimes 1 = |p \rangle \langle b|$&lt;/span&gt; but this isn't a unitary operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The known state &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; is in state vector form. I am using Python an NumPy for reference.&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="55" LastEditDate="2021-01-21T11:04:41.113" LastActivityDate="2021-01-21T11:04:41.113" Title="Find the local unitary that takes the bell state to a state phi that has an extractable bell state" Tags="&lt;quantum-state&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7077" PostTypeId="1" AcceptedAnswerId="7085" CreationDate="2019-08-22T22:36:08.057" Score="1" ViewCount="1032" Body="&lt;p&gt;How are 2 qubit Controlled Z gates (1 control / 1 target) typically implemented? Do we seek physical realizations of this gate, or have an alternate decomposition? &lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="8343" LastEditDate="2019-08-22T23:01:04.590" LastActivityDate="2019-08-23T17:43:33.877" Title="How is the Controlled Z Gate implemented?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7078" PostTypeId="1" CreationDate="2019-08-23T00:54:01.040" Score="3" ViewCount="119" Body="&lt;p&gt;You are given a source of an unknown qubit state. You make measurements in the computational basis, that is, your measurement is  &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle \langle0|,|1\rangle \langle 1|\}$&lt;/span&gt;. You observe that you see the outcome zero &lt;span class=&quot;math-container&quot;&gt;$30$&lt;/span&gt; times and the outcome one &lt;span class=&quot;math-container&quot;&gt;$70$&lt;/span&gt; times out of a hundred measurements. What is your estimate of the absolute value of the probability amplitude of  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;  in the superposition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8344" LastEditorUserId="55" LastEditDate="2020-06-13T18:07:30.140" LastActivityDate="2020-06-13T18:07:30.140" Title="Estimate of the absolute value of the probability amplitude of |0⟩ in the superposition" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="7079" PostTypeId="1" AcceptedAnswerId="7080" CreationDate="2019-08-23T07:28:46.643" Score="1" ViewCount="80" Body="&lt;p&gt;I have a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$${|\psi\rangle} = s {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)}\otimes{\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)}\otimes{\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)},$$&lt;/span&gt;&#xA;with the subindexes meaing the particle number (for some normalising factor &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;). How do we represent  a measurement of qubit 1 and 5 in the Bell basis, given that these two qubits are not adjacent?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="124" LastEditDate="2019-08-23T10:08:49.833" LastActivityDate="2019-08-23T10:58:30.340" Title="Representing a Bell measurement on non adjacent qubits" Tags="&lt;measurement&gt;&lt;notation&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7080" PostTypeId="2" ParentId="7079" CreationDate="2019-08-23T10:25:15.947" Score="3" Body="&lt;p&gt;The most direct way to do this using normal notation is to simply write the Bell projections using the same convention for subscripts:&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\langle#1\rvert}\def\idop{\mathbf 1}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA; \bra{\Phi^+}_{1,5} \;&amp;amp;=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{0}_5 \,+\, \bra{1}_1 \bra{1}_5\,\Bigr),&#xA;\\&#xA; \bra{\Phi^-}_{1,5} \;&amp;amp;=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{0}_5 \,-\, \bra{1}_1 \bra{1}_5\,\Bigr),&#xA;\\&#xA; \bra{\Psi^+}_{1,5} \;&amp;amp;=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{1}_5 \,+\, \bra{1}_1 \bra{0}_5\,\Bigr),&#xA;\\&#xA; \bra{\Psi^-}_{1,5} \;&amp;amp;=\; \tfrac{1}{\sqrt 2}\Bigl(\,\bra{0}_1\bra{1}_5 \,-\, \bra{1}_1 \bra{0}_5\,\Bigr).&#xA;\end{aligned}$$&lt;/span&gt;&#xA;It might not be immediately obvious why it makes sense to just 'decorate a bra with subscripts'. The idea is that for any qubit which is &lt;em&gt;not&lt;/em&gt; indicated in the subscripts, what we have in mind is that we take the tensor product with the identity. So, for example, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{alignat}{2}&#xA; \bra{0}_1\bra{0}_5  \;&amp;amp;:=\; &amp;amp;&amp;amp;\bra{0} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{0} \otimes \idop,&#xA;\\[1ex]&#xA; \bra{1}_1\bra{1}_5  \;&amp;amp;:=\; &amp;amp;&amp;amp;\bra{1} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{1} \otimes \idop,&#xA;\\[1ex]&#xA; \bra{\Phi^+}_{1,5} \;&amp;amp;:=\; \tfrac{1}{\sqrt 2}\Bigl(\,&amp;amp;&amp;amp;\bra{0} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{0} \otimes \idop&#xA;\\[-1.5ex]&amp;amp;&amp;amp;&amp;amp;+ \bra{1} \otimes \idop \otimes \idop \otimes \idop \otimes \bra{1} \otimes \idop\,\Bigr),&#xA;\end{alignat}$$&lt;/span&gt;&#xA;and so on. The advantage of writing things this way with the subscripts is that if you decompose an operator such as &lt;span class=&quot;math-container&quot;&gt;$\bra{\Phi^+}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\bra{\Psi^-}$&lt;/span&gt;, and so forth as a sum of tensor products, you can then compose it with other operators without having to write all of the identity tensor factors, so long as you only compose together operators acting on the same tensor factor. For instance:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;\bra{\Phi^+}_{1,5} \ket{\psi}&amp;amp;&#xA;\\[1ex]&#xA;= \tfrac{1}{\sqrt2}\Bigl[&amp;amp;&#xA;\bra{0}_1\bra{0}_5\ket{\psi} + \bra{1}_1 \bra{1}_5 \ket{\psi} \Bigr]&#xA;\\[2ex]&#xA;= \tfrac{\textstyle s}{\sqrt2}\Bigl[&amp;amp;&#xA;\bra{0}_1\bra{0}_5 {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)}&#xA;\\&amp;amp;+\bra{1}_1\bra{1}_5 {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)}\Bigr]&#xA;\\[1ex]&#xA;= \tfrac{\textstyle s}{\sqrt2}\Bigl[&amp;amp;&#xA; {\Bigl(\langle0|1\rangle_1|1\rangle_2-\langle0|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(\langle0|0\rangle_5|1\rangle_6-\langle0|1\rangle_5|0\rangle_6\Bigr)}&#xA;\\&amp;amp;+ {\Bigl(\langle1|1\rangle_1|1\rangle_2-\langle1|0\rangle_1|0\rangle_2\Bigr)\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)\Bigl(\langle1|0\rangle_5|1\rangle_6-\langle1|1\rangle_5|0\rangle_6\Bigr)}\Bigr]&#xA;\\[1ex]&#xA;= \tfrac{\textstyle s}{\sqrt2}\Bigl[&amp;amp;&#xA; {-|0\rangle_2\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)|1\rangle_6}&#xA; - {|1\rangle_2\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)|0\rangle_6}\Bigr]&#xA;\\[2ex]&#xA;= -\tfrac{\textstyle s}{\sqrt2}\Bigl(&amp;amp;&#xA; {|0\rangle_2|1\rangle_6 + |1\rangle_2|0\rangle_6\Bigr)&#xA;\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4}\Bigr).&#xA;\end{aligned}$$&lt;/span&gt;&#xA;Three things about this answer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;This calculation has effectively removed qubits 1 and 5 from the state &amp;mdash; we're basically describing a &lt;em&gt;destructive&lt;/em&gt; measurement. If we wanted to describe a projective measurement which doesn't destroy the qubits involved, we'd have to take a tensor product with the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+}_{1,5}$&lt;/span&gt;. We can certainly write out what that superposition would look like, simply by expanding &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+}_{1,5} = \tfrac{1}{\sqrt 2}\bigl[ \ket{0}_1 \ket{0}_5 + \ket{1}_1 \ket{1}_5 \bigr]$&lt;/span&gt;, and including this in the description of the post-measurement state. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I've moved the tensor factors of qubits 2 and 6 so that they are adjacent. It's not difficult to see that they are in a tensor product with qubits 3 and 4, in any case, and it doesn't matter if we change the order given that we're using the subscripts to keep track of which qubit is which &amp;mdash; just like listing some variables in different orders doesn't change what values those variables have. This allows us to see that after the measurement, the states of qubits 2 and 6 are in the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^+}$&lt;/span&gt; is the measurement result on qubits 1 and 5 was &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+}$&lt;/span&gt; (and similar things will happen for the other possible outcomes of the measurement).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Notice that the normalisation is affected. We would normally chose &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; so that the original vector had a norm of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, so for example &lt;span class=&quot;math-container&quot;&gt;$s = 1/2\sqrt{2}$&lt;/span&gt;. This new state has a leading factor of &lt;span class=&quot;math-container&quot;&gt;$s/\sqrt{2} = 1/4$&lt;/span&gt;, so it is not difficult to see that it is sub-normalised. Specifically, the vector here has norm &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, which corresponds to the fact that a Bell measurement on qubits 1 and 5 will produce the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Phi^+}$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/4 = (1/2)^2$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-08-23T10:58:30.340" LastActivityDate="2019-08-23T10:58:30.340" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="7081" PostTypeId="1" AcceptedAnswerId="7086" CreationDate="2019-08-23T13:34:04.857" Score="4" ViewCount="140" Body="&lt;p&gt;I'm actually searching two types of documents (could be the same):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A synthesis about all the main gap/problems that make the physical realisation of a quantum computer actually infeasible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Something more polemical that criticizes the point of view &quot;quantum computers arrive soon! They will break the actual instantiation of RSA&quot;, and&#xA;consider that there is no good reason to think there will be a quantum computer functional for cryptanalysis during this century.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure of the existence of 2), but I met so many physicists who are skeptical about the optimistic projection (4000 qubits in  one decade).&#xA;Maybe people here have heard about a such document? &lt;/p&gt;&#xA;" OwnerUserId="8348" LastEditorUserId="55" LastEditDate="2019-08-27T07:28:17.467" LastActivityDate="2019-08-27T07:28:17.467" Title="Looking for papers that are pessimistic about the feasibility of a quantum computer" Tags="&lt;resource-request&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7082" PostTypeId="1" CreationDate="2019-08-23T14:38:40.837" Score="3" ViewCount="827" Body="&lt;p&gt;This question refers to Nielsen and Chuang's Exercise 4.22: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Prove that a &lt;span class=&quot;math-container&quot;&gt;$C^2(U)$&lt;/span&gt; gate (for any single-qubit unitary U) can be&#xA;constructed using at most eight one-qubit gates, and six controlled-not gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pu2er.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pu2er.png&quot; alt=&quot;A relevant diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prove this, I decomposed all &lt;span class=&quot;math-container&quot;&gt;$C(V)$&lt;/span&gt; operations into &lt;span class=&quot;math-container&quot;&gt;$AXBXC$&lt;/span&gt; form and ended up with 9 single-qubit gates and 8 C-NOT gates. So I need to now get rid of one single-qubit gate and 2 C-NOT gates. To do the former, I changed the order of &lt;span class=&quot;math-container&quot;&gt;$V's$&lt;/span&gt; and got rid of 2 single-qubit gates with combining 2 pairs of single-qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example: as &lt;span class=&quot;math-container&quot;&gt;$C=R_z((\delta - \beta)/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A=R_z(\beta)R_y(\gamma/2)$&lt;/span&gt; &#xA;became &#xA;               &lt;span class=&quot;math-container&quot;&gt;$CA=R_z((\delta - \beta)/2)R_z(\beta)R_y(\gamma/2)$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kD3mS.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kD3mS.jpg&quot; alt=&quot;Reordering and combining gates picture&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the CNOT gates, I can't touch the 2 C-NOT operations on qubits 0 and qubit 1 because they are important for the functioning of &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt;. The only way then is to reduce the 4 CNOT gates that compose the 2 &lt;span class=&quot;math-container&quot;&gt;$C(V)$&lt;/span&gt; gates. I am encountering some difficulty here. Any help/hint will be appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;*This is not a homework question. I am self-studying from Nielsen and Chuang for an independent project.&lt;/p&gt;&#xA;" OwnerUserId="7943" LastEditorUserId="7372" LastEditDate="2019-08-28T11:12:20.783" LastActivityDate="2019-08-28T11:12:20.783" Title="How to reduce circuit elements of a decomposed $C^2(U)$ operation?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="7084" PostTypeId="1" CreationDate="2019-08-23T16:41:49.427" Score="3" ViewCount="194" Body="&lt;p&gt;These two kinds of qubits are both classified under &quot;charge qubits&quot;, looking for them, I always find the same circuit representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/N7ZGs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N7ZGs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Occasionally, I find one where there's a SQUID instead of the Josephson junction, but I don't think this is the difference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference?&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2019-08-23T16:41:49.427" Title="What is the difference between a cooper pair box and a transmon qubit?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7085" PostTypeId="2" ParentId="7077" CreationDate="2019-08-23T17:43:33.877" Score="1" Body="&lt;p&gt;On IBM QX architectures, the only entangling gate is the controlled not (CX), so controlled Z gates with control qubit &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and target qubit &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; are decomposed into &lt;span class=&quot;math-container&quot;&gt;$CZ^n_m = H_m CX^n_m H_m$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although this is QX-specific, it demonstrates a principle that will likely hold on any architecture -- That the general method is to use a similarity transform to rotate Z onto the most conducive rotation axis for the hardware, perform that rotation, and rotate Z back into place.&lt;/p&gt;&#xA;" OwnerUserId="8349" LastActivityDate="2019-08-23T17:43:33.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7086" PostTypeId="2" ParentId="7081" CreationDate="2019-08-23T17:45:47.497" Score="3" Body="&lt;p&gt;You can look up work by Gil Kalai, who is a longstanding and outspoken critic of quantum computing (his most recent essay: &lt;a href=&quot;https://arxiv.org/abs/1908.02499&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kalai, 2019&lt;/a&gt;). He often bases his view on assumptions that I entirely disagree with, but its a refreshing reminder that certain ideas are taken for granted in the industry, namely that NISQ computers will yield practical applications. Kalai's analyses and views aren't necessarily mainstream.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know of any comprehensive papers that address (2) but some example analyses looks into how quantum computers might impact Bitcoin and find that any impact is unlikely (&lt;a href=&quot;https://arxiv.org/pdf/1710.10377.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aggarwal, 2017&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1711/1711.04235.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tessler&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;With respect to cryptography, NIST is currently sponsoring the development of post-quantum cryptography standards that would possibly be secure against quantum attacks even if a large quantum computer were made available in the near term. Google has even begun implementing a variation of one of these protocols (HRSS) for key exchange. However, claims that a protocol is &quot;post-quantum&quot; should generally be taken with a grain of salt since its entirely unknown whether a method to break these protocols (classical or quantum) exists.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-08-23T17:45:47.497" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="7087" PostTypeId="2" ParentId="7072" CreationDate="2019-08-23T18:08:24.480" Score="1" Body="&lt;p&gt;Are you using Qiskit from within a conda virtual environment? If Blender isn't launched from within the same venv they may not be able to communicate (or share libraries). &lt;/p&gt;&#xA;" OwnerUserId="8350" LastActivityDate="2019-08-23T18:08:24.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7088" PostTypeId="1" CreationDate="2019-08-23T18:38:18.047" Score="2" ViewCount="158" Body="&lt;p&gt;I'm trying to implement an algorithm (&lt;a href=&quot;https://dl.acm.org/citation.cfm?id=1128034&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dl.acm.org/citation.cfm?id=1128034&lt;/a&gt;, basically a simple Grover Algorithm in which the oracle is made of a Fitness operator- some CNOT gates- and 2 adders) and when I try to simulate it on ibm_qasm_simulator I get the error: &#xA;&quot;Job resulted in the following QASM status(es): &lt;strong&gt;ERROR&lt;/strong&gt;.&quot;. If I export the qasm code and simulate it online, I got the following error: &lt;strong&gt;ERROR_TRANSPILING_JOB&lt;/strong&gt; but the original and transpiled code look identical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using qiskit 0.8.2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'qiskit': '0.11.1', &#xA;'qiskit-terra': '0.8.2', &#xA;'qiskit-ignis': '0.1.1', &#xA;'qiskit-aer': '0.2.3', &#xA;'qiskit-ibmq-provider': '0.3.1', &#xA;'qiskit-aqua': '0.5.3'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The QASM code, as generated by qiskit and modified a little bit to include the subcircuits is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;gate majority a,b,c&#xA;{&#xA;  cx c,b;&#xA;  cx c,a;&#xA;  ccx a,b,c;&#xA;}&#xA;gate unmaj a,b,c&#xA;{&#xA;  ccx a,b,c;&#xA;  cx c,a;&#xA;  cx a,b;&#xA;}&#xA;gate add4 a0,a1,a2,a3,b0,b1,b2,b3,cin,cout&#xA;{&#xA;  majority cin,b0,a0;&#xA;  majority a0,b1,a1;&#xA;  majority a1,b2,a2;&#xA;  majority a2,b3,a3;&#xA;  cx a3,cout;&#xA;  unmaj a2,b3,a3;&#xA;  unmaj a1,b2,a2;&#xA;  unmaj a0,b1,a1;&#xA;  unmaj cin,b0,a0;&#xA;}&#xA;gate adder8 aop0,aop1,aop2,aop3,aop4,aop5,aop6,aop7,bop0,bop1,bop2,bop3,bop4,bop5,bop6,bop7,carry0,carry1&#xA;{&#xA;    add4 aop0,aop1,aop2,aop3,bop0,bop1,bop2,bop3,carry0,carry1;&#xA;    add4 aop4,aop5,aop6,aop7,bop4,bop5,bop6,bop7,carry1,carry0;&#xA;}&#xA;&#xA;gate tof ctrl0,ctrl1,ctrl2,ctrl3,ctrl4,ctrl5,ctrl6,ctrl7,anc0,anc1,anc2,anc3,anc4,anc5,anc6,tgt&#xA;{&#xA;    ccx ctrl0,ctrl1,anc0;&#xA;    ccx ctrl2,anc0,anc1;&#xA;    ccx ctrl3,anc1,anc2;&#xA;    ccx ctrl4,anc2,anc3;&#xA;    ccx ctrl5,anc3,anc4;&#xA;    ccx ctrl6,anc4,anc5;&#xA;    ccx ctrl7,anc5,anc6;&#xA;    cx anc6,tgt;&#xA;    ccx ctrl7,anc5,anc6;&#xA;    ccx ctrl6,anc4,anc5;&#xA;    ccx ctrl5,anc3,anc4;&#xA;    ccx ctrl4,anc2,anc3;&#xA;    ccx ctrl3,anc1,anc2;&#xA;    ccx ctrl2,anc0,anc1;&#xA;    ccx ctrl0,ctrl1,anc0;&#xA;}&#xA;&#xA;qreg ireg[4];&#xA;qreg freg[9];&#xA;qreg mreg[8];&#xA;qreg carryreg[2];&#xA;qreg oreg[1];&#xA;qreg ancilla[3];&#xA;creg reg[9];&#xA;h ireg[0];&#xA;h ireg[1];&#xA;h ireg[2];&#xA;h ireg[3];&#xA;x mreg[1];&#xA;x mreg[2];&#xA;x mreg[4];&#xA;x mreg[5];&#xA;x mreg[6];&#xA;x mreg[7];&#xA;barrier ireg[0],ireg[1],ireg[2],ireg[3],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],freg[8],mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],carryreg[0],carryreg[1],oreg[0],ancilla[0],ancilla[1],ancilla[2];&#xA;adder8 mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],carryreg[0],carryreg[1];&#xA;barrier ireg[0],ireg[1],ireg[2],ireg[3],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],freg[8],mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],carryreg[0],carryreg[1],oreg[0],ancilla[0],ancilla[1],ancilla[2];&#xA;x freg[7];&#xA;cx freg[7],oreg[0];&#xA;x freg[7];&#xA;barrier ireg[0],ireg[1],ireg[2],ireg[3],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],freg[8],mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],carryreg[0],carryreg[1],oreg[0],ancilla[0],ancilla[1],ancilla[2];&#xA;reset mreg[0];&#xA;reset mreg[1];&#xA;x mreg[1];&#xA;reset mreg[2];&#xA;reset mreg[3];&#xA;x mreg[3];&#xA;reset mreg[4];&#xA;reset mreg[5];&#xA;reset mreg[6];&#xA;reset mreg[7];&#xA;barrier ireg[0],ireg[1],ireg[2],ireg[3],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],freg[8],mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],carryreg[0],carryreg[1],oreg[0],ancilla[0],ancilla[1],ancilla[2];&#xA;adder8 mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],carryreg[0],carryreg[1];&#xA;reset mreg[0];&#xA;reset mreg[1];&#xA;reset mreg[2];&#xA;reset mreg[3];&#xA;reset mreg[4];&#xA;reset mreg[5];&#xA;reset mreg[6];&#xA;reset mreg[7];&#xA;barrier ireg[0],ireg[1],ireg[2],ireg[3],freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],freg[8],mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],mreg[7],carryreg[0],carryreg[1],oreg[0],ancilla[0],ancilla[1],ancilla[2];&#xA;h freg[0];&#xA;x freg[0];&#xA;h freg[1];&#xA;x freg[1];&#xA;h freg[2];&#xA;x freg[2];&#xA;h freg[3];&#xA;x freg[3];&#xA;h freg[4];&#xA;x freg[4];&#xA;h freg[5];&#xA;x freg[5];&#xA;h freg[6];&#xA;x freg[6];&#xA;h freg[7];&#xA;x freg[7];&#xA;h freg[8];&#xA;x freg[8];&#xA;h freg[8];&#xA;tof freg[0],freg[1],freg[2],freg[3],freg[4],freg[5],freg[6],freg[7],mreg[0],mreg[1],mreg[2],mreg[3],mreg[4],mreg[5],mreg[6],freg[8];&#xA;x freg[0];&#xA;h freg[0];&#xA;x freg[1];&#xA;h freg[1];&#xA;x freg[2];&#xA;h freg[2];&#xA;x freg[3];&#xA;h freg[3];&#xA;x freg[4];&#xA;h freg[4];&#xA;x freg[5];&#xA;h freg[5];&#xA;x freg[6];&#xA;h freg[6];&#xA;x freg[7];&#xA;h freg[7];&#xA;h freg[8];&#xA;x freg[8];&#xA;h freg[8];&#xA;measure freg[0] -&amp;gt; reg[0];&#xA;measure freg[1] -&amp;gt; reg[1];&#xA;measure freg[2] -&amp;gt; reg[2];&#xA;measure freg[3] -&amp;gt; reg[3];&#xA;measure freg[4] -&amp;gt; reg[4];&#xA;measure freg[5] -&amp;gt; reg[5];&#xA;measure freg[6] -&amp;gt; reg[6];&#xA;measure freg[7] -&amp;gt; reg[7];&#xA;measure freg[8] -&amp;gt; reg[8];&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2759" LastActivityDate="2019-08-23T18:38:18.047" Title="Error ERROR_TRANSPILING_JOB when trying to simulate the circuit" Tags="&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7089" PostTypeId="2" ParentId="7076" CreationDate="2019-08-23T23:58:38.753" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|p \rangle = ((aI + bZ + cX + dZX) \otimes 1) | \Phi^+ \rangle = a | \Phi^+ \rangle + b | \Phi^- \rangle + c | \Psi^+\rangle + d | \Psi^- \rangle\\&#xA;(aI+bZ+cX+dZX)(\bar{a}I+\bar{b}Z+\bar{c}X+\bar{d}XZ) = 1\\&#xA;a = \langle \Phi^+ | p \rangle\\&#xA;b = \langle \Phi^- | p \rangle\\&#xA;c = \langle \Psi^+ | p \rangle\\&#xA;d = \langle \Psi^- | p \rangle\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll leave the rest to you.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-08-23T23:58:38.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7090" PostTypeId="1" AcceptedAnswerId="7092" CreationDate="2019-08-24T11:13:52.163" Score="2" ViewCount="92" Body="&lt;p&gt;If we have a physical qubit with energy eigenstates &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with energy separation &lt;span class=&quot;math-container&quot;&gt;$\Delta E$&lt;/span&gt; its Hamiltonian in the absence of any interaction is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=\hbar\frac{\Delta E}{2}\sigma_z $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the time evolution operator is &lt;span class=&quot;math-container&quot;&gt;$U=e^{-iHt/\hbar}$&lt;/span&gt;, so why doesn't a qubit left to itself not just continuously rotate in the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; direction? And if it does, how is this not a problem? It seems to me that after some time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, a &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; gate will be applied whether we want it or not!&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2019-08-24T11:20:05.407" LastActivityDate="2019-08-25T13:20:36.947" Title="Why don't qubits continuously rotate in the $z$ direction due to free time evolution?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7092" PostTypeId="2" ParentId="7090" CreationDate="2019-08-24T11:47:30.243" Score="3" Body="&lt;p&gt;It does, unless you have a way to tune your Hamiltonian such that &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; becomes zero. Since a tunable Hamiltonian is something you usually want in a quantum computer implementation, this should not be a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this term is non-switchable, it just means that the basis in which you are working is continuously rotating, and you have to keep track of that and implement your &quot;active&quot; gates in a correspondingly rotated basis, or exactly at the time when the evolution due to your Hamiltonian has cancelled out. (Essentially, this is like working in the interaction picture.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(By the way, it is debatable if you should call this &quot;in the absence of any interaction&quot;, since this level splitting can very well seen as some type of interaction, and will in many cases depend on some external parameter.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2019-08-24T11:47:30.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7093" PostTypeId="2" ParentId="6860" CreationDate="2019-08-24T18:16:53.207" Score="3" Body="&lt;p&gt;The word &lt;a href=&quot;https://en.wikipedia.org/wiki/Superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;superposition&lt;/a&gt; had many meanings long before the phrase &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum superposition&lt;/a&gt; became popular.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A linear super-position of A and B is just &quot;A + cB&quot; where c is a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have your binary optimization problem that has to be solved, for example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H_problem = b1*b2 - b1*b3 + 2*b2*b4.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you have a constraint such as &quot;b1*b2 = 1&quot; which can be converted into a binary optimization problem because minimizing:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H_constraint =  (b1*b2 - 1)^2&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is the same as satisfying the constraint &quot;b1*b2 = 1&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the final Hamiltonian will be a linear superposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H = H_problem + c*H_constraint, where c &gt; 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal is for the minimum of H to be the minimum of H_problem, and to also satisfy the constraint. Now notice that if the constraint is not satisfied, we don't have a minimum, because we will be adding a positive number, making the energy higher. If H_problem is not minimized, then clearly H is not minimized because one of the terms in H can be made lower by minimizing H_problem. So overall, H will only be minimized if both:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;H_problem is minimized, and&lt;/li&gt;&#xA;&lt;li&gt;H_constraint is minimized (i.e. the constraint is satisfied).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can now convert this into Ising model by turning all binary variables from b={0,1} to sigma_z={-1,1}.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&#xA;It seems you've been thinking about quantum information for too long now, and now when you see &quot;superposition&quot; you immediately think (|0&gt; + |1&gt;)/sqrt(2). But superposition had another meaning long before quantum information became popular.&lt;/p&gt;&#xA;" OwnerUserId="8325" LastActivityDate="2019-08-24T18:16:53.207" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7094" PostTypeId="2" ParentId="1620" CreationDate="2019-08-25T05:24:40.847" Score="6" Body="&lt;p&gt;Let me first answer the general question how to get a reasonably tight Lieb-Robinson (LR) speed when you are facing a generic locally interacting lattice model, and then I'll come back to the 1D XY model in your question, which is very special to be exactly solvable.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;General Method&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The method to obtain the tightest bound to date (for a generic short-range interacting model) is introduced in Ref1=&lt;a href=&quot;https://arxiv.org/abs/1908.03997&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1908.03997&lt;/a&gt;. The basic idea is that the norm of the unequal time commutator &lt;span class=&quot;math-container&quot;&gt;$\|[A_X(t),B_Y(0)]\|$&lt;/span&gt; between arbitrary local operators can be upper bounded by the solution to a set of first order linear differential equations living on the &lt;strong&gt;&lt;em&gt;commutativity graph&lt;/em&gt;&lt;/strong&gt; of the model. The commutativity graph, as introduced in Sec.II A of Ref1, can be easily drawn from the model Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$\hat{H}$&lt;/span&gt;, and is designed to reflect the commutation relations between different local operators presented in &lt;span class=&quot;math-container&quot;&gt;$\hat{H}$&lt;/span&gt;. In translation invariant systems, this set of differential equations can be easily solved by a Fourier transform, and an upper bound of the LR speed can be calculated from the largest eigenfrequency &lt;span class=&quot;math-container&quot;&gt;$\omega_{\max}(i\vec{\kappa})$&lt;/span&gt; using Eq.(31) of &lt;a href=&quot;https://arxiv.org/abs/1908.03997&quot; rel=&quot;noreferrer&quot;&gt;Ref1&lt;/a&gt;. In the following I'll apply this method to the 1D XY model as a pedagogical example. For simplicity, I'll focus on the time-independent and translation invariant case &lt;span class=&quot;math-container&quot;&gt;$|B_n|=B&amp;gt;0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|J_n|=J&amp;gt;0$&lt;/span&gt; (the resulting bound doesn't depend on signs of &lt;span class=&quot;math-container&quot;&gt;$B_n,J_n$&lt;/span&gt;). For the translation non-invariant, time-dependent case, you can either solve the differential equation numerically (which is an easy computational task for systems of thousands of sites), or you can use an overall upper bound &lt;span class=&quot;math-container&quot;&gt;$|J_n(t)|\leq J,~|B_n(t)|\leq B$&lt;/span&gt; and proceed to use the method below (but this slightly compromises tightness compared to the numerical method).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First we draw the commutativity graph, as below. Each operator in the Hamiltonian~(&lt;span class=&quot;math-container&quot;&gt;$X_{n}X_{n+1}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y_nY_{n+1}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_n$&lt;/span&gt;) is represented by a vertex, and we link two vertices if and only if the corresponding operators don't commute (or, in the current case, anti-commute). &#xA;&lt;a href=&quot;https://i.stack.imgur.com/R36FJ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R36FJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then write down the differential equations Eq.(10) of &lt;a href=&quot;https://arxiv.org/abs/1908.03997&quot; rel=&quot;noreferrer&quot;&gt;Ref1&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;  \dot{\bar{\gamma}}_{\alpha,n}&amp;amp;=&amp;amp;J[\bar{\gamma}_{\alpha,n-1}(t)+\bar{\gamma}_{\alpha,n+1}(t)]+B[\bar{\gamma}_{3,n}(t)+\bar{\gamma}_{3,n+1}(t)],~~\alpha=1,2,\nonumber\\&#xA;  \dot{\bar{\gamma}}_{3,n}&amp;amp;=&amp;amp;J\sum_{\alpha=1,2}[\bar{\gamma}_{\alpha,n-1}(t)+\bar{\gamma}_{\alpha,n}(t)].&#xA;  \end{eqnarray}&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Fourier transforming the above equation, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;  \frac{d}{dt}\begin{pmatrix}&#xA;    \bar{\gamma}_{1,k}\\&#xA;    \bar{\gamma}_{2,k}\\&#xA;    \bar{\gamma}_{3,k}&#xA;    \end{pmatrix}=\begin{pmatrix}&#xA;      2J\cos k &amp;amp; 0 &amp;amp; B(1+e^{ik})\\&#xA;      0   &amp;amp; 2J\cos k &amp;amp; B(1+e^{ik})\\&#xA;      J(1+e^{-ik}) &amp;amp; J(1+e^{-ik}) &amp;amp; 0\\&#xA;    \end{pmatrix}\begin{pmatrix}&#xA;    \bar{\gamma}_{1,k}\\&#xA;    \bar{\gamma}_{2,k}\\&#xA;    \bar{\gamma}_{3,k}&#xA;    \end{pmatrix}.&#xA;  \end{equation}&lt;/span&gt;&#xA;The eigenfrequencies are &lt;span class=&quot;math-container&quot;&gt;$2J\cos k,J\cos k\pm \sqrt{(J\cos k)^2+2BJ(1+\cos k)}$&lt;/span&gt;. The LR speed is given by Eq.(31) of &lt;a href=&quot;https://arxiv.org/abs/1908.03997&quot; rel=&quot;noreferrer&quot;&gt;Ref1&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$v_{\text{LR}}\leq \min_{\kappa&amp;gt;0}\frac{\omega_{\max}(i\kappa)}{\kappa}  =\mathcal{Z}_{\frac{B}{2J}}J,$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\label{eq:vLRFHWy}&#xA;\mathcal{Z}_y\equiv \min_{\kappa&amp;gt;0}\frac{\cosh\kappa+\sqrt{\cosh^2\kappa+4y(1+\cosh\kappa)}}{\kappa}.&#xA;  \end{equation}&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Note: This bound diverges when &lt;span class=&quot;math-container&quot;&gt;$B/J\to \infty$&lt;/span&gt;, while the physical information propagation speed stays finite. We can get rid of this problem by using the method in Sec. VI of &lt;a href=&quot;https://arxiv.org/abs/1908.03997&quot; rel=&quot;noreferrer&quot;&gt;Ref1&lt;/a&gt;. The result is &lt;span class=&quot;math-container&quot;&gt;$v_{\text{LR}}\leq 4\mathcal{X}_0 J$&lt;/span&gt; in this limit, where  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}_y$&lt;/span&gt; is defined as the solution to the equation &lt;span class=&quot;math-container&quot;&gt;$x\mathrm{arcsinh}(x)=\sqrt{x^2+1}+y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Velocity bounds for some classic models&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The above method is completely general. In case you are interested in more, I listed the velocity bounds for some classic models in the following table, obtained in a similar way. Notice that the LR velocity &lt;span class=&quot;math-container&quot;&gt;$v_{\text{LR}}$&lt;/span&gt; is upper bounded by the smallest of the all the expressions listed (so in different parameter regions different expressions should be used). The function &lt;span class=&quot;math-container&quot;&gt;$F(J_x,J_y,J_z)$&lt;/span&gt; is defined as the largest root of &lt;span class=&quot;math-container&quot;&gt;$x^3-(J_xJ_y+J_xJ_z+J_yJ_z)x-2J_xJ_yJ_z=0.$&lt;/span&gt; All parameters are assumed positive (just take absolute value for the negative cases). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{|c|l|}&#xA;    \hline&#xA;\text{Model}   &amp;amp; v_{\text{LR}} \\ \hline&#xA;     d\text{-dimensional TFIM} &amp;amp; 2\mathcal{X}_0\sqrt{dJh}= 3.02\sqrt{dJh}  \\&#xA;       \hat{H}= J\sum_{\langle mn\rangle}  X_m X_{n}+h\sum_n Z_n  &amp;amp; 4\mathcal{X}_{\frac{d-1}{d}}dJ \leq 8.93 d J    \\&#xA;                             &amp;amp;  4\mathcal{X}_0dh = 6.04 d h  \\ \hline&#xA;    d\text{-dimensional Fermi-Hubbard}   &amp;amp; 2 \mathcal{X}_{\frac{3U}{4dJ}}dJ  \\&#xA;        \hat{H}=J\sum_{\langle mn\rangle, s=\uparrow,\downarrow} (a^\dagger_{m,s}a_{n,s}+\mathrm{H.c.})                      &amp;amp; 8\mathcal{X}_{\frac{d-1}{d}}dJ\leq 17.9 d J            \\&#xA;                 ~~+U \sum_n a^\dagger_{n\uparrow}a_{n\uparrow}a^\dagger_{n\downarrow}a_{n\downarrow} &amp;amp; \mathcal{Z}_{U/J}J~(d=1)  \\ \hline&#xA;\text{1D Heisenberg XYZ}   &amp;amp; 4\mathcal{X}_0 F(J_x,J_y,J_z)  \\&#xA;\hat{H}=\sum_n (J_x X_n X_{n+1}+J_y Y_n Y_{n+1}+J_z Z_n Z_{n+1}) &amp;amp; 34.6 \max\{J_x,J_y\}\\ \hline&#xA;\end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for how good these bounds are, I haven't investigated in general, but for the 1D TFIM at critical point &lt;span class=&quot;math-container&quot;&gt;$J=h$&lt;/span&gt;, exact solution gives &lt;span class=&quot;math-container&quot;&gt;$v_{\text{LR}}=2J$&lt;/span&gt;, while the above bound gives &lt;span class=&quot;math-container&quot;&gt;$2\mathcal{X}_0J\approx 3.02 J$&lt;/span&gt;. Similarly, at the &lt;span class=&quot;math-container&quot;&gt;$U=0$&lt;/span&gt; point of FH and the &lt;span class=&quot;math-container&quot;&gt;$J_x=J_y,J_z=0$&lt;/span&gt; point of Heisenberg XYZ, the above bound are all larger than exact solution by a factor of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}_0\approx 1.50888$&lt;/span&gt;. [Actually at these special points the latter two are equivalent to decoupled chains of TFIM, as can be directly judged from their commutativity graph.]&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Tighter bound for 1D XY by mapping to free fermions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now let's talk more about the 1D XY model. As you noticed, it's exactly solvable by mapping to free fermions:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{H}=\sum_nB_n(a_n^\dagger a_n-1/2)+\sum_n J_n(a_n^\dagger a_{n+1}+\mathrm{H.c.}). $$&lt;/span&gt;&#xA;For general &lt;span class=&quot;math-container&quot;&gt;$B_n(t),J_n(t)$&lt;/span&gt; you need to solve the free-fermion problem numerically, but let me mention two special cases that are analytically tractable.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B_n(t)=B,J_n(t)=J$&lt;/span&gt; are fixed and translation invariant. Then the exact solution is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}\label{eq:aisigmat}&#xA;   a_{n}(t)&amp;amp;=&amp;amp;\frac{1}{\sqrt{2\pi}}\int_{-\pi}^\pi \tilde{a}_{k}e^{-i2Jt\cos k }e^{ikx}d k\nonumber\\&#xA;   &amp;amp;=&amp;amp;\sum_{m}\mathcal{J}_{|n-m|}(2Jt) a_{m}(0),&#xA; \end{eqnarray}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{J}_{|n-m|}(2Jt)$&lt;/span&gt; is the Bessel function of order &lt;span class=&quot;math-container&quot;&gt;$|n-m|$&lt;/span&gt;. So the LR speed is  &lt;span class=&quot;math-container&quot;&gt;$\color{red}{v^{\text{XY}}_{\text{LR}}=2J}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B_n,J_n$&lt;/span&gt; are fixed in time but are completely random (quenched disorder). Then due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Many_body_localization&quot; rel=&quot;noreferrer&quot;&gt;many-body localization&lt;/a&gt; (or Anderson localization in the fermion picture), information don't propagate in this system, so &lt;span class=&quot;math-container&quot;&gt;$v_{\text{LR}}=0$&lt;/span&gt;. More rigorously, in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0703209&quot; rel=&quot;noreferrer&quot;&gt;arXiv:quant-ph/0703209&lt;/a&gt;, the following bound is proved for disordered case:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[A_X(t),B_Y(0)]\leq \mathrm{const.}~ t ~e^{-d_{XY}/\xi},$$&lt;/span&gt;&#xA;with a decelerating, logarithmic light cone &lt;span class=&quot;math-container&quot;&gt;$d_{XY}=\xi \ln t$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8352" LastActivityDate="2019-08-25T05:24:40.847" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="7095" PostTypeId="2" ParentId="7090" CreationDate="2019-08-25T13:20:36.947" Score="2" Body="&lt;p&gt;They are always rotating in the lab reference frame, but most quantum algorithms take a rotating reference frame to simply things, so that a z rotation only happens when you want it to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rotating reference frame spins along with the natural spinning rate of each qubit, so in general in can spin at different rates for different qubits.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2019-08-25T13:20:36.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7096" PostTypeId="1" CreationDate="2019-08-26T11:55:45.690" Score="-2" ViewCount="98" Body="&lt;p&gt;I have a matrix &lt;span class=&quot;math-container&quot;&gt;$M= \begin{pmatrix} a - ib &amp;amp;  0 \\ 0  &amp;amp;  a + ib \end{pmatrix}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are real numbers and &lt;span class=&quot;math-container&quot;&gt;$i = \sqrt{-1}$&lt;/span&gt;. I need to represent this matrix in terms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;the quantum logic gates&lt;/a&gt;. Is the following representation valid&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}  M = a \mathbb{I} - ib \sigma_Z, \end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where   &lt;span class=&quot;math-container&quot;&gt;$ \mathbb{I} $&lt;/span&gt;  and  &lt;span class=&quot;math-container&quot;&gt;$\sigma_Z$&lt;/span&gt; are the identity matrix and Pauli-z gate, respectively. Can this be implemented in a lab?&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="55" LastEditDate="2019-08-27T07:14:57.603" LastActivityDate="2019-08-28T09:15:22.243" Title="Is $M = a \mathbb{I} - ib \sigma_Z$ a valid representation in terms of logic gates?" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7097" PostTypeId="2" ParentId="7072" CreationDate="2019-08-26T18:27:52.743" Score="2" Body="&lt;pre&gt;&lt;code&gt;import sys&#xA;sys.exec_prefix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will show the path of python used by blender. Rename this &lt;code&gt;python&lt;/code&gt; folder to something else. Now blender will automatically use the python version in windows path. Make sure that your Python runs in command prompt when you type &lt;code&gt;python&lt;/code&gt;. If it doesn't, type &lt;code&gt;environment variables&lt;/code&gt; in search and add python.exe to the path variable. Restart command prompt if &lt;code&gt;python&lt;/code&gt; opens up python interpreter, blender will too.&lt;/p&gt;&#xA;" OwnerUserId="7467" LastActivityDate="2019-08-26T18:27:52.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7098" PostTypeId="1" CreationDate="2019-08-26T19:58:33.283" Score="1" ViewCount="1138" Body="&lt;p&gt;I successfully installed qiskit,&#xA;yet am unable to load my account in the Jupyter notebook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each time I load my account in Jupyter notebook here is the response I get&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;RequestsApiError: 401 Client Error: Unauthorized for url:&#xA;  &lt;a href=&quot;https://auth.quantum-computing.ibm.com/api/users/loginWithToken&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://auth.quantum-computing.ibm.com/api/users/loginWithToken&lt;/a&gt;.&#xA;  LOGIN_FAILED, Error code: LOGIN_FAILED.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What causes this?&lt;/p&gt;&#xA;" OwnerUserId="8369" LastEditorUserId="55" LastEditDate="2021-05-21T09:22:18.917" LastActivityDate="2021-05-21T09:22:18.917" Title="Loading Qiskit account in the Jupyter notebook gives RequestsApiError error" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7099" PostTypeId="1" CreationDate="2019-08-26T21:45:20.287" Score="3" ViewCount="419" Body="&lt;p&gt;I have the state vector &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; made up of 4 qubits. Say system A is made up of the first and second qubits while system B is made up of qubits 3 and 4. I want to find the reduced density matrix of system A. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know I could separately extract qubits 1,2 and 3,4 into their own state vectors then find their density matrices and compute the reduced density matrix for system A.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to figure out how to do this without having to extract and separate the systems. First I would find the density matrix of &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; and then do a partial trace with respect to system B. I am not sure how to do the partial trace of system B since the system contains 2 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me figure this out? I am using Python and NumPy for reference.&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="55" LastEditDate="2021-02-05T20:12:07.120" LastActivityDate="2021-05-17T06:47:26.257" Title="How to find the reduced density matrix of a four-qubit system?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7101" PostTypeId="2" ParentId="7099" CreationDate="2019-08-27T00:19:50.837" Score="1" Body="&lt;p&gt;Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/Partial_trace&quot; rel=&quot;nofollow noreferrer&quot;&gt;entry&lt;/a&gt; has a nice description of the partial trace and how to compute it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case the partial trace of &lt;span class=&quot;math-container&quot;&gt;$M=|p\rangle\langle p|$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can be computed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B(M) = \text{Tr}_B\bigg(\sum_{k,l} M_{k,l} \otimes |k\rangle\langle l| \bigg) = \sum_{k} M_{k,k}&#xA;$$&lt;/span&gt;&lt;br&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$k,l \in \{00,01,10,11\}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those &lt;span class=&quot;math-container&quot;&gt;$M_{k,l}$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; submatrices of the &lt;span class=&quot;math-container&quot;&gt;$16 \times 16$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. What kind  of submatrices depends on the actual encoding. In the big-endian encoding – where the matrix row order corresponds to &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle, |0001\rangle, ... , |1111\rangle$&lt;/span&gt; – matrix &lt;span class=&quot;math-container&quot;&gt;$M_{k,l}$&lt;/span&gt; has element in the position &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt; that equals to an element in the position &lt;span class=&quot;math-container&quot;&gt;$(k,l)$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt;-th block of the big matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. So the resulting sum is actually equivalent to a matrix whose elements are traces of &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; blocks of the matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Partial trace over the first subsystem A in the big-endian encoding is easier – it's just the sum of 4 blocks from the diagonal.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-08-27T00:19:50.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7102" PostTypeId="2" ParentId="7098" CreationDate="2019-08-27T08:57:21.477" Score="2" Body="&lt;p&gt;This is normally caused by incorrect credentials being used. To fix this you can generate a new API key and update your saved credentials to use this instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do this by navigating to &lt;a href=&quot;https://quantum-computing.ibm.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com&lt;/a&gt; and getting your API key from the &lt;code&gt;My Account&lt;/code&gt; section. In a notebook then run &lt;code&gt;IBMQ.save_account('YOUR API KEY', overwrite=True)&lt;/code&gt;. This will remove any incorrect credentials from your system and then the login should work.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-08-27T08:57:21.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7103" PostTypeId="2" ParentId="6935" CreationDate="2019-08-27T08:57:53.353" Score="5" Body="&lt;p&gt;Let me begin by reformulating the Knill-Laflamme Theorem, looking at it from a different angle might help in making the matter a little less abstract. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Knill-Laflamme Theorem for the conditions of quantum error correction can be stated as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; be a quantum error correcting code defined as a subspace of the n-dimensional Hilbert space, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2^{\otimes n}$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E} \subset \mathbb{C}^{2^n\times2^n}$&lt;/span&gt; be a set of errors. Then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}$&lt;/span&gt; can correct &#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$$\langle\psi_i|E_a^\dagger E_b|\psi_j\rangle = c_{ab}\delta_{ij} ,$$&lt;/span&gt;&#xA;where {&lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;} is a base of the subspace that defines the code &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C} \subset \mathcal{H}_2^{\otimes n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$E_b$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\in \mathcal{E}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By itself, the above statement provides information about the degeneracy of the code. By computing all the possible outputs of parameter &lt;span class=&quot;math-container&quot;&gt;$c_{ab}$&lt;/span&gt; (this can be done by randomly selecting a basis vector of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, and setting &lt;span class=&quot;math-container&quot;&gt;$i=j$&lt;/span&gt;.), placing them in a matrix &lt;span class=&quot;math-container&quot;&gt;$C_{ab}$&lt;/span&gt;, and then computing its rank, we can determine if &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is degenerate or non-degenerate. If &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(C_{ab}) &amp;lt; max$&lt;/span&gt;, the quantum code is degenerate, which means different errors from an error set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; map to the same syndrome and cause the same error effect on the codeword, thus, being reversible via the same recovery operation.  If &lt;span class=&quot;math-container&quot;&gt;$C_{ab}$&lt;/span&gt; is full rank, each error &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; in the error set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; maps to a unique error syndrome. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Placing the matter of degeneracy aside, the following corollary of the Theorem might help in understanding the meaning of the Theorem itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any code &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; defined as a subspace of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2^{\otimes n}$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is capable of correcting all the errors in a set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E} \subset \mathcal{C}^{2^n\times2^n}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; will be able to correct all the errors within the linear span of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially what this corollary tells us is that if a quantum error correcting code can correct all the errors in the set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, it will also be able to correct all the possible linear combinations of the elements within that set. If we now consider that the Pauli matrices define a basis for the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2\times2}$&lt;/span&gt;  space, then the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-fold Pauli group will form a base for the n-dimensional subspace &lt;span class=&quot;math-container&quot;&gt;$(\mathbb{C}^{2\times2})^{\otimes n} = \mathbb{C}^{2^n\times2^n}$&lt;/span&gt;. This last statement, means that all the matrices in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n\times2^n}$&lt;/span&gt; can be expressed as linear combinations of the elements of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-fold Pauli group, which by the above corollary gives us the groundbreaking condition that to design good quantum error correcting codes we must needs only consider errors that are elements of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-fold Pauli group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this approach to the Theorem aids in understanding its utility and importance. &lt;/p&gt;&#xA;" OwnerUserId="7855" LastEditorUserId="26" LastEditDate="2019-11-29T17:29:13.710" LastActivityDate="2019-11-29T17:29:13.710" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7104" PostTypeId="2" ParentId="7096" CreationDate="2019-08-27T13:54:42.553" Score="1" Body="&lt;p&gt;For this matrix to be a unitary, you need, as Neil mentioned, that &lt;span class=&quot;math-container&quot;&gt;$a^{2} + b^{2} = 1$&lt;/span&gt;. If that is the case, then the matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a rotational matrix along the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis. In other words (and how it shows on the wikipedia page you linked), it is a phase gate &lt;span class=&quot;math-container&quot;&gt;$R_{\phi}$&lt;/span&gt;, or also known as &lt;span class=&quot;math-container&quot;&gt;$R_{z}(\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since a global phase can always be omitted, we can write:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;M = \begin{bmatrix}a - ib &amp;amp; 0 \\ 0 &amp;amp; a + ib\end{bmatrix} = (a - ib)\begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \frac{a + ib}{a - ib}\end{bmatrix} = (a - ib)\begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \frac{a^{2} - b^{2} - 2iab}{a^{2} + b^{2}}\end{bmatrix} \hat{=} \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; a^{2} - b^{2} - 2iab\end{bmatrix},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\hat{=}$&lt;/span&gt; indicates that it has the same action on a qubit (this is the global phase, practically). So from that you can easily compute the &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$2\tan(\frac{b}{a})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="434" LastEditDate="2019-08-27T21:03:26.973" LastActivityDate="2019-08-27T21:03:26.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7106" PostTypeId="1" CreationDate="2019-08-27T18:50:20.103" Score="3" ViewCount="76" Body="&lt;p&gt;I earlier posted I question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7079/representing-a-bell-measurement-on-non-adjacent-qubits/7080?noredirect=1#comment10751_7080&quot;&gt;Representing a Bell measurement on non adjacent qubits&lt;/a&gt; for which I got an excellent answer. Now I want to build upon that and do further analysis which is where I am stuck. So here it goes. Consider the original state as &lt;span class=&quot;math-container&quot;&gt;$${|\psi\rangle} = s {\Bigl(|0\rangle_1|1\rangle_2-|1\rangle_1|0\rangle_2\Bigr)}\otimes{\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)}\otimes{\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)},$$&lt;/span&gt; which is being shared by 3 parties where Alice get particle &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;, Bob gets &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, Charlies gets &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;. Now the sharing protocol is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First, Alice performs a local unitary operation randomly&#xA;on one of her two qubits 1 and 6, say, on qubit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then she performs a Bell-state measurement on&#xA;qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; and announces publicly her measurement outcome.&#xA;After this, Bob and Charlie perform Bell-state measurements&#xA;on their qubits, respectively, and record the&#xA;measurement outcomes.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If Bob and Charlie collaborate,&#xA;according to their Bell-state measurement outcomes and Alice’s&#xA;public announcement of the Bell-state measurement on&#xA;qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;, they can deduce the exact local unitary operation&#xA;that Alice performed on qubit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For example, if Bob’s and&#xA;Charlie’s outcomes are respectively &lt;span class=&quot;math-container&quot;&gt;$|\psi^{-}\rangle_{23}$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$|\phi^{+}\rangle_{45}$&lt;/span&gt;, since&#xA;the state Alice prepared initially in qubits &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\psi^{-}\rangle_{34}$&lt;/span&gt;,&#xA;then from Eq.7, they can know that qubits &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; have&#xA;projected to &lt;span class=&quot;math-container&quot;&gt;$|\phi^{+}\rangle_{25}$&lt;/span&gt;&#xA;after Alice’s Bell-state measurement on&#xA;qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;. Since both the initial states of the qubit pair&#xA;&lt;span class=&quot;math-container&quot;&gt;$(1,2)$&lt;/span&gt; and the initial states of the qubit pair &lt;span class=&quot;math-container&quot;&gt;$(5,6)$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|\psi^{-}\rangle$&lt;/span&gt;, respectively, and Bob and Charlie know Alice’s Bell-state&#xA;measurement outcome on qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\phi^{+}\rangle_{16}$&lt;/span&gt; and&#xA;they have already deduced the state &lt;span class=&quot;math-container&quot;&gt;$|\phi^{+}\rangle_{25}$&lt;/span&gt; of qubits &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;,&#xA;then from Eq. &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; they can determine that the local unitary&#xA;the operation performed by Alice is &lt;span class=&quot;math-container&quot;&gt;$u_4$&lt;/span&gt;, that is, the secret message is the two classical bits “11.”&#xA;What I have understood is, let's say the original state is &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$${|\psi\rangle} = s {\Bigl(|0\rangle_1|1\rangle_2-|1\rangle_1|0\rangle_2\Bigr)}\otimes{\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)}\otimes{\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)},$$&lt;/span&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now alice performs say &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on his qubit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, so the new state is&#xA;${|\psi\rangle} = s {\Bigl(|1\rangle_1|1\rangle_2-|0\rangle_1|0\rangle_2\Bigr)}\otimes{\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)}\otimes{\Bigl(|0\rangle_5|1\rangle_6-|1\rangle_5|0\rangle_6\Bigr)},$$ &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice measures say the state &lt;span class=&quot;math-container&quot;&gt;$ |\psi^+\rangle_{16}$&lt;/span&gt; , and tells both Bob Charlie. Now after his measurement Bob and Charlie receive the reduced state &#xA;&lt;span class=&quot;math-container&quot;&gt;$${|\psi\rangle} = s {}{\Bigl(|0\rangle_3|1\rangle_4-|1\rangle_3|0\rangle_4\Bigr)}\otimes{\Bigl(|0\rangle_2|0\rangle_5+|1\rangle_2|1\rangle_5\Bigr)},$$&lt;/span&gt; &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, here things becoming complicated for me while reading, what happens when Bob measures &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle_{34}$&lt;/span&gt; and Charlie measures &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle_{25}$&lt;/span&gt;. I am not able to understand the language the point &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$u_3(|\Psi^-\rangle_{ab}) \otimes |\Psi^-\rangle_{cd}$&lt;/span&gt;= &lt;span class=&quot;math-container&quot;&gt;$ |\Phi^+\rangle_{ab} \otimes |\Psi^-\rangle_{cd} = |\Phi^-\rangle_{ac}|\Psi^+\rangle_{bd} - |\Psi^+\rangle_{ac}|\Phi^-\rangle_{bd}- |\Psi^-\rangle_{ac}|\Phi^+\rangle_{bd} + |\Phi^+\rangle_{ac}|\Psi^-\rangle_{bd}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$u_3=|1\rangle\langle 0|+ |0\rangle\langle 1|$&lt;/span&gt;. I understand all the operators except this equation and the theoretical explaination. Can somebody explain it in a simple manner?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2021-01-07T10:59:45.260" LastActivityDate="2021-01-07T11:56:16.350" Title="Determining the quantum secret" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7108" PostTypeId="2" ParentId="2536" CreationDate="2019-08-28T05:31:41.103" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How is D-Wave's Pegasus architecture different from the Chimera architecture?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See: &quot;&lt;a href=&quot;https://arxiv.org/abs/1901.07636&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pegasus: The second connectivity graph for large-scale quantum annealing hardware&lt;/a&gt;&quot; (Jan 22 2019), by Nike Dattani (Harvard), Szilard Szalay (Wigner Research Centre), and Nick Chancellor (Durham). Figures were made with their open source software &lt;a href=&quot;https://github.com/HPQC-LABS/PegasusDraw&quot; rel=&quot;nofollow noreferrer&quot;&gt;PegasusDraw&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;The 128 qubits of the first commercial quantum annealer (D-Wave One, released in 2011) were connected[by a graph called Chimera (first defined publicly in 2009 [1]), which is rather easy to describe: A 2D array of &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; graphs, with one ‘side’ of each &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; being connected to the same corresponding side on the &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; cells directly above and below it, and the other side being connected to the same corresponding side on the &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; cells to the right and left of it (see Figure 1). The qubits can couple to up to 6 other qubits, since each qubit couples to 4 qubits within its &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; unit cell, and to 2 qubits in the &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; cells above and below it, or to the left and right of it. All commercial quantum annealers built to date follow this graph connectivity, with just larger and larger numbers of &lt;span class=&quot;math-container&quot;&gt;$K_{4,4}$&lt;/span&gt; cells (see Table 1).&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{lc}&#xA;&amp;amp;\text{Array of }K_{4,4}\text{ cells} &amp;amp; \text{Total # of qubits} \\&#xA;\text{D-Wave One} &amp;amp; 4 \times 4 &amp;amp; 128 \\&#xA;\text{D-Wave Two} &amp;amp;  8 \times 8 &amp;amp; 512 \\&#xA;\text{D-Wave 2X} &amp;amp;  12 \times 12 &amp;amp; 1152 \\&#xA;\text{D-Wave 2000Q} &amp;amp;  16 \times 16 &amp;amp; 2048&#xA;\end{array}&#xA;$$&lt;/span&gt;&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\text{Table I: Chimera graphs in all commercial quantum&#xA;annealers to date.}$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In 2018, D-Wave announced the construction of a (not yet commercial) quantum annealer with a greater connectivity than Chimera offers, and a program (NetworkX) which allows users to generate certain Pegasus graphs. However, no explicit description of the graph connectivity in Pegasus has been published yet, so we have had to apply the process of reverse engineering to determine it, and the following section describes the algorithm we have established for generating Pegasus.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;[1]&lt;/code&gt; H. Neven, V. S. Denchev, M. Drew-Brook, J. Zhang, W. G. Macready, and G. Rose, NIPS 2009 Demonstration: Binary Classification using Hardware Implementation of Quantum Annealing, Tech. Rep. (2009).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Cyrxt.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cyrxt.jpg&quot; alt=&quot;Chimera vs. Pegasus&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few dozen illustrations in that paper, verified by Kelly Boothby of D-Wave, I don't want to overquote; I believe I've covered the gist of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few points:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Every qubit is associated with 6 indices: (x, y, z, i, j, k).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The degree of the vertices (which is 15) has increased by a factor of 2.5 when compared to the degree of Chimera (which is 6), except the cells at the boundary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Pegasus' non-planarity expands on the number of binary optimization problems that cannot yet be solved in polynomially time on a D-Wave.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;All quadratization gadgets for single cubic terms which require one auxiliary qubit, can be embedded onto Pegasus with no further auxiliary qubits because Pegasus contains &lt;span class=&quot;math-container&quot;&gt;$K_4$&lt;/span&gt;, which means that all three logical qubits and the auxiliary qubit can be connected in&#xA;any way, without any minor-embedding.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;See also: &quot;&lt;a href=&quot;https://arxiv.org/abs/1901.04405&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quadratization in discrete optimization and quantum mechanics&lt;/a&gt;&quot;, (Jan 14 2019), by Nike Dattani. GitHub &lt;a href=&quot;https://github.com/HPQC-LABS/Book_About_Quadratization&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="278" LastActivityDate="2019-08-28T05:31:41.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7110" PostTypeId="2" ParentId="7096" CreationDate="2019-08-28T08:57:20.273" Score="1" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an operator, and &lt;span class=&quot;math-container&quot;&gt;$A^2=\mathbb{I}$&lt;/span&gt;, then you can show that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-ixA}=\cos(x)\mathbb{I}-i\sin(x)A $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just write down &lt;span class=&quot;math-container&quot;&gt;$e^{-ixA}$&lt;/span&gt; as a series and separate the even and odd indices. Since &lt;span class=&quot;math-container&quot;&gt;$\sigma_z^2=\mathbb{I}$&lt;/span&gt;, provided that &lt;span class=&quot;math-container&quot;&gt;$a^2+b^2=1$&lt;/span&gt; (hence this transformation is a valid quantum gate) then you can write in polar coordinates &lt;span class=&quot;math-container&quot;&gt;$a=\cos(\theta)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b=\sin(\theta)$&lt;/span&gt;, and your gate is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-i\theta\sigma_x} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is clearly a rotation around the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis in the Bloch sphere. As others have mentioned is &lt;span class=&quot;math-container&quot;&gt;$a^2+b^2\neq 1$&lt;/span&gt; then this isn't a quantum gate, as it is not unitary.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastEditorUserId="5125" LastEditDate="2019-08-28T09:15:22.243" LastActivityDate="2019-08-28T09:15:22.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7111" PostTypeId="1" CreationDate="2019-08-28T11:12:02.670" Score="1" ViewCount="106" Body="&lt;p&gt;I want to know whether I can have a operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; which commutes with four other operators &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$M_3$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$M_4$&lt;/span&gt; (for instance, drawing the operators &lt;span class=&quot;math-container&quot;&gt;$M_j$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\{H,I,X,Y\}$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When can we tell that such an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; exists?&lt;/p&gt;&#xA;" OwnerUserId="4575" LastEditorUserId="55" LastEditDate="2020-07-26T18:09:31.490" LastActivityDate="2020-07-26T18:09:31.490" Title="Can one operator commute with four other operators?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7112" PostTypeId="1" AcceptedAnswerId="7113" CreationDate="2019-08-28T11:36:31.913" Score="3" ViewCount="84" Body="&lt;p&gt;I am stuck with this exercice of Nielsen and Chuang:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$S = \langle g1,... ,gl \rangle $&lt;/span&gt;.Show that &lt;span class=&quot;math-container&quot;&gt;$−I$&lt;/span&gt; is not an element of S if and only if &lt;span class=&quot;math-container&quot;&gt;$g^2_j = I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;,and &lt;span class=&quot;math-container&quot;&gt;$g_j \neq − I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a subgroup of &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; the set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is that if I consider:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S=\langle X, -X \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the two properties: &lt;span class=&quot;math-container&quot;&gt;$g^2_j = I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;,and &lt;span class=&quot;math-container&quot;&gt;$g_j \neq − I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;span class=&quot;math-container&quot;&gt;$X*(-X)=-X^2=-I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus it is a counter example of the property I should show. So I guess there is something I miss here but I don't get what...&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="26" LastEditDate="2019-10-14T16:19:20.353" LastActivityDate="2019-10-14T16:19:20.353" Title="Exercise 10.34 of Nielsen and Chuang : $-I$ not element of stabilizer group iff $g_j^2=I$ and $g_j \neq I$ where $g_j$ generators" Tags="&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7113" PostTypeId="2" ParentId="7112" CreationDate="2019-08-28T14:13:30.463" Score="4" Body="&lt;p&gt;Consulting my local copy of Nielsen &amp;amp; Chuang (10th anniversary edition, p.&amp;nbsp;457), the complete statement of the exercise is pretty much exactly as you have given it:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Exercise 10.34.&lt;/strong&gt; Let &lt;span class=&quot;math-container&quot;&gt;$\langle g_1, \ldots, g_l \rangle$&lt;/span&gt;. Show that &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; is not an element of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$g_j^2 = I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$g_j \ne - I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Reading the text as though I were learning the material for the first time, the context does not seem to impose many further restrictions. It is clear from context that each &lt;span class=&quot;math-container&quot;&gt;$g_j$&lt;/span&gt; is meant to be a Pauli operator (an element of &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; in the notation of Chapter&amp;nbsp;10) &amp;mdash; and, just plausibly (but not very explicitly), we could suppose that the operators &lt;span class=&quot;math-container&quot;&gt;$g_j$&lt;/span&gt; are meant to commute with one another. But:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Without the explicit constraint that the operators commute, we could reasonably consider &lt;span class=&quot;math-container&quot;&gt;$\langle X, Z \rangle$&lt;/span&gt; to be another counterexample, which contains the element &lt;span class=&quot;math-container&quot;&gt;$-I = ZXZX$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Even supposing that we restrict ourselves to abelian subgroups of &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt;, the preceding text does not require that the generators &lt;span class=&quot;math-container&quot;&gt;$g_j$&lt;/span&gt; be linearly independent operators, &lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;in this case that &lt;span class=&quot;math-container&quot;&gt;$g_j \ne - g_k$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j,k$&lt;/span&gt;. This allows you to obtain the counterexample &lt;span class=&quot;math-container&quot;&gt;$\langle X, -X \rangle$&lt;/span&gt; as you have done.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Worse, it is not enough to simply check pairs of generators to see whether they are proportional to one another: the group &lt;span class=&quot;math-container&quot;&gt;$\langle X\!\otimes\!X, Y\!\otimes\!Y, Z\!\otimes\!Z \rangle$&lt;/span&gt; has independent generators and &lt;em&gt;linearly&lt;/em&gt; independent generators, but still include &lt;span class=&quot;math-container&quot;&gt;$-I = (X\!\otimes\!X)(Y\!\otimes\!Y)(Z\!\otimes\!Z)$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I would propose that the exercise should be re-worded as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Exercise 10.34 &amp;thinsp;(&amp;thinsp;&lt;em&gt;revised&lt;/em&gt;&amp;nbsp;).&lt;/strong&gt; Let &lt;span class=&quot;math-container&quot;&gt;$\langle g_1, \ldots, g_l \rangle$&lt;/span&gt; be a commutative subgroup of &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt;. Show that &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; is not an element of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$g_j^2 = I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, and no product of any &lt;em&gt;subset&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\{g_1, \ldots, g_l\}$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It might seem as though the final condition (on subsets of the generators) rather gives the game away. However, from the fact that we are requiring that &lt;span class=&quot;math-container&quot;&gt;$g_j^2 = I$&lt;/span&gt;, we are essentially considering the Pauli group as a non-abelian group which contains elements of order &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and order &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;: from the very elementary starting point taken by Nielsen and Chuang, it is perhaps a useful exercise to take the time to show that in an abelian group whose generators all have order &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, then every element &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is characterised by a subset of generators which you use exactly once in a product to obtain &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;. To people familiar with group theory (or whose prejudices are sufficiently steeped in computer science that they quickly leap to thinking about bit-vectors anyway), it is clear that the second condition amounts to saying the &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; is not generated by any product of generators &amp;mdash; but we should recall that the target audience also includes physicists who might not see these things as quickly, as they have likely been pre-occupied mostly with solving differential equations or coding up numerical simulations before encountering Nielsen and Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This revised version of Exercise 10.34 is thus a relatively elementary exercise which gets you to think of subgroups of the Pauli group in which every element has order 2, getting you ready to think about them in terms of bit-vectors. It could be that this is actually be what Nielsen and Chuang originally intended. Whether or not this is the case, however, it is also the smallest modification of the exercise that I can think of which makes it correct.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-08-28T14:13:30.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7116" PostTypeId="2" ParentId="7111" CreationDate="2019-08-29T07:09:26.023" Score="2" Body="&lt;p&gt;If an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; it already must be trivial (&lt;span class=&quot;math-container&quot;&gt;$A = c I, c\in \mathbb{C}$&lt;/span&gt;). One way to prove this is to note that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; also commutes with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$Z = \frac{1}{2}i(YX - XY)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; trivially commutes with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$I, X, Y, Z$&lt;/span&gt;, which is Pauli basis of all operators, then &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; commutes with any other operator, hence it must be trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general case you can have any number of commuting operators since all diagonal operators commute, as was pointed out by Norbert Schuch.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-08-29T07:29:34.517" LastActivityDate="2019-08-29T07:29:34.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7117" PostTypeId="1" CreationDate="2019-08-29T07:41:36.717" Score="6" ViewCount="967" Body="&lt;p&gt;I have ran an experiment in one of the IBM processors and the work has finished. However, I can not obtain the data as histograms or counts in the qiskit notebook because the experiment was concluded while I was logged off and therefore now I would need to run the full script again. That is, I would need to run the experiment again. My question is if there is some way to access the results in the notebook without this requirement. I know that the histograms are stored in the section &quot;results&quot; but I specifically want to work with them in the notebook. Thank you. &lt;/p&gt;&#xA;" OwnerUserId="8388" LastEditorUserId="26" LastEditDate="2019-11-24T14:16:41.173" LastActivityDate="2020-04-21T10:59:13.433" Title="Access results from an experiment without having to run the script again" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7118" PostTypeId="2" ParentId="7117" CreationDate="2019-08-29T07:58:52.790" Score="3" Body="&lt;p&gt;First, set up your provider&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From this you can access a list of all your jobs with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;provider.circuits.client.get_status_jobs()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Each job is recorded as a dictionary. One of the keys is 'id', which is the job id. To extract this for the first job on the list, for example, use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job_id = provider.circuits.client.get_status_jobs()[0]['id']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job_info = provider.circuits.client.get_job(job_id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To get a JSON which contains all the information about the job, including the results. The counts data for the first circuit in the job, for example, can be found at&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job_info['qObjectResult']['results'][0]['data']['counts']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Though note that the strings will be hex strings rather than bit strings, and so will need conversion.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-09-02T11:05:00.433" LastActivityDate="2019-09-02T11:05:00.433" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="7119" PostTypeId="2" ParentId="6935" CreationDate="2019-08-29T11:28:53.837" Score="7" Body="&lt;p&gt;We can try to geometrically interpret the Knill&amp;ndash;Laflamme conditions on a code-space &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt;, as follows.&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\langle#1\rvert}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Images of the code-space under an error operation&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;First, consider any &lt;em&gt;individual&lt;/em&gt; error operator &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt;: this is a Kraus operator of some transformation of the system, and so is not necessarily even unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any input pure state &lt;span class=&quot;math-container&quot;&gt;$\ket\psi \in C$&lt;/span&gt; and for an arbitrary operator &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt;, the vector &lt;span class=&quot;math-container&quot;&gt;$E_j \ket{\psi}$&lt;/span&gt; will represent some distorted image of the input state. You might wonder whether different states &lt;span class=&quot;math-container&quot;&gt;$\ket\psi \in \mathcal C$&lt;/span&gt; could be affected in different ways: specifically, whether some vectors &lt;span class=&quot;math-container&quot;&gt;$E_j \ket\psi$&lt;/span&gt; will have different norms for various states &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;. The Knill&amp;ndash;Laflamme condition indicates that this isn't possible: as &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal C} E_{\!\!\:j}^\dagger E_{\!\!\:j}^{\phantom\dagger} \!P_{\mathcal C} = \alpha_{\!\!\:j,j} P_{\mathcal C}$&lt;/span&gt; for some scalar &lt;span class=&quot;math-container&quot;&gt;$\alpha_{\!\!\:j,j}$&lt;/span&gt; (which we can show is a non-negative real), it follows that &lt;span class=&quot;math-container&quot;&gt;$\lVert E_j \ket\psi \rVert^2 = \alpha_{\!\!\:j,j}$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\ket\psi \in \mathcal C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So: for any set of errors &lt;span class=&quot;math-container&quot;&gt;$\{E_j\}_j$&lt;/span&gt; satisfying the Knill&amp;ndash;Laflamme conditions, each error &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; produces some faithful image of the original code-space &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt; &amp;mdash; &lt;em&gt;i.e.&lt;/em&gt;,&amp;nbsp;proportional to a unitary transformation on &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt;, even if &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; is not itself proportional to a unitary.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Images of the code-space under different error operations&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Next, consider how these images of the code-space compare for two different error operators &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt;, and under what conditions we can hope to recover a state which have been affected by one of the errors.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In some cases &amp;mdash; as with distinct single-qubit Pauli operators on a code with distance 3 or greater &amp;mdash; the subspace &lt;span class=&quot;math-container&quot;&gt;$E_{\!\!\:j}\!\: \mathcal C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k \mathcal C$&lt;/span&gt; will be orthogonal to one another, and therefore perfectly distinguishable. In particular, we would then have &lt;span class=&quot;math-container&quot;&gt;$E_j\ket\psi \perp E_k\ket\varphi$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$\ket\psi,\ket\varphi \in \mathcal C$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$P_{\mathcal C} E_{\!\!\:j}^\dagger E_{\!\!\:k}^{\phantom\dagger}\!\!\: P_{\mathcal C} = 0$&lt;/span&gt;. If all of the error operators &lt;span class=&quot;math-container&quot;&gt;$\{E_j\}_{j}$&lt;/span&gt; are 'orthogonal' in this sense, there would then be no problem to correct the errors: we could simply perform a measurement of which of the subspaces &lt;span class=&quot;math-container&quot;&gt;$E_r \!\: \mathcal C$&lt;/span&gt; we were in, and then perform a unitary transformation which maps &lt;span class=&quot;math-container&quot;&gt;$E_r \!\:\mathcal C \mapsto \mathcal C$&lt;/span&gt;. This corresponds to the case where &lt;span class=&quot;math-container&quot;&gt;$\alpha_{j,k} = 0$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$j \ne k$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;However, it is also possible (for instance, in a degenerate code as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/7103/124&quot;&gt;Patrick Fuentes indicates in his answer&lt;/a&gt;) to have errors &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; in which &lt;span class=&quot;math-container&quot;&gt;$E_{\!\!\:j}\!\: \mathcal C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k \mathcal C$&lt;/span&gt; are not orthogonal: the unit vectors in those subspaces may have non-zero overlap, or the two subspaces may even be the same. In this case, the only hope for us to be able to correct the error is&#xA;that &amp;mdash; to the extent that the effect of &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; on the&#xA;code-space cannot be distinguished &amp;mdash; the two images in a sense &lt;em&gt;agree&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean by this is: suppose that you had a state &lt;span class=&quot;math-container&quot;&gt;$\ket\psi \in \mathcal C$&lt;/span&gt; which (unbeknownst to you) was affected by the error &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt;, yielding the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi'} = E_j \ket{\psi}$&lt;/span&gt;. Suppose that you then tried to determine whether it was affected instead by the error &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt;, by measuring whether the state was in the space &lt;span class=&quot;math-container&quot;&gt;$E_k \mathcal C$&lt;/span&gt;. In general, this would disturb the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi'}$&lt;/span&gt;. However, if &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi'}$&lt;/span&gt;  collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi''} = E_k \ket{\psi}$&lt;/span&gt;, there would be no problem: you could simply correct the state as though &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; had happened, and thereby recover &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what is guaranteed by the Knill&amp;ndash;Laflamme conditions: that for any state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} \in \mathcal C$&lt;/span&gt;, the projection of &lt;span class=&quot;math-container&quot;&gt;$E_{\!\!\:j}\!\: \ket{\psi}$&lt;/span&gt; onto &lt;span class=&quot;math-container&quot;&gt;$E_k \mathcal C$&lt;/span&gt; will be proportional to &lt;span class=&quot;math-container&quot;&gt;$E_k \ket{\psi}$&lt;/span&gt;. Furthermore, that the constant of proportionality &lt;span class=&quot;math-container&quot;&gt;$\alpha_{j,k}$&lt;/span&gt; involved is the same for all &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} \in \mathcal C$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus, the Knill&amp;ndash;Laflamme conditions imply that, to the extent that we cannot perfectly distinguish the effects of &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; on the entire subspace &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt;, the effects of &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; on &lt;em&gt;individual states in &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt;&lt;/em&gt; are also indistinguishable, so that we cannot confuse one error &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; for another error &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; plus some transformation on the original encoded state.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;In summary&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The Knill&amp;ndash;Laflamme conditions on a set of error operators &lt;span class=&quot;math-container&quot;&gt;$\{E_j\}_j$&lt;/span&gt; on a code-space &lt;span class=&quot;math-container&quot;&gt;$\mathcal C$&lt;/span&gt; indicate that the effect of any one error &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; affects the entire space a uniform way (rescaling it uniformly and transforming it unitarily otherwise); and that to the extent that the effects of two errors &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; cannot be operationally distinguished from one another, their effect on the code-space is the same as one another, so that you can measure which error occurred and then correct the state as though that error actually is the one that did occur.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-08-29T13:39:24.850" LastActivityDate="2019-08-29T13:39:24.850" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="7120" PostTypeId="1" AcceptedAnswerId="7158" CreationDate="2019-08-29T13:04:55.050" Score="5" ViewCount="79" Body="&lt;p&gt;I am trying to understand &quot;Stabilizer codes construction&quot; in Nielsen &amp;amp; Chuang (page 465). Below, we're working in a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A stabilizer group &lt;span class=&quot;math-container&quot;&gt;$S=\langle g_1,...,g_{n-k} \rangle \subseteq G_n$&lt;/span&gt; is a commuting subgroup of Pauli operators such that &lt;span class=&quot;math-container&quot;&gt;$-I \notin S$&lt;/span&gt;. Below, we suppose that the operators &lt;span class=&quot;math-container&quot;&gt;$g_j$&lt;/span&gt; are independent, in which case the stabilised space &lt;span class=&quot;math-container&quot;&gt;$V_S$&lt;/span&gt; has dimension &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt; generators, from their representation in terms of bit-vectors, it is easy to see that we can always find some &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; additional independent generators. However, how can we be sure that we can always find &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; additional &lt;em&gt;commuting&lt;/em&gt; generators?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="124" LastEditDate="2019-08-29T14:46:10.387" LastActivityDate="2019-09-02T09:47:55.740" Title="Given $n-k$ stabiliser generators, how can we find an additional $k$ commuting generators?" Tags="&lt;nielsen-and-chuang&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="7121" PostTypeId="1" AcceptedAnswerId="7132" CreationDate="2019-08-29T21:06:57.103" Score="2" ViewCount="46" Body="&lt;p&gt;All the entanglement I've see is between 2 parties that have the same number of qubits. Is it possible to have entanglement where each party has a different number of qubits? Is it possible to have entanglement between 3 parties?&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="55" LastEditDate="2021-01-07T10:59:18.367" LastActivityDate="2021-01-07T10:59:18.367" Title="Is it possible to have entanglement with different sized parties or with more than 2 parties?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7122" PostTypeId="2" ParentId="7062" CreationDate="2019-08-30T00:26:44.377" Score="3" Body="&lt;p&gt;The problem is that you applied a Swap gate when you should have applied a CSWAP, and so you never entangled the readout qubit with your query states (as a result the readout qubit will always return a &quot;0&quot;, which makes sense because the net effect of &lt;span class=&quot;math-container&quot;&gt;$HH|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$I|0\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing your derivation starting from just after the first Hadamard, we apply a &lt;strong&gt;CSWAP&lt;/strong&gt; gate on the ancilla qubit of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; (before &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;) and the only qubit on &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; (after &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rightarrow \frac{1}{2\sqrt{Z}} (|a|| 0,0,a,0\rangle + |a|| 1,0,a,0\rangle - |b|| 0,0,a,1\rangle -|b|| 1,1,a,0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+ |a|| 0,1,b,0\rangle+|a|| 1,0,b,1\rangle - |b|| 0,1,b,1\rangle - |b|| 1,1,b,1\rangle )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rearranging before applying the Hadamard:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rightarrow \frac{1}{2\sqrt{Z}} (|a|(|0\rangle + |1\rangle) |0,a,0\rangle - |b|(|0\rangle + |1\rangle) |1,b,1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ + (|a|| 0,1,b,0\rangle +|a|| 1,0,b,1\rangle - |b|| 0,0,a,1\rangle -|b|| 1,1,a,0\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now apply a Hadamard to the first qubit and group by the state of the first qubit (you only need to work out the amplitude for the first qubit being in &quot;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&quot;, and normalization will tell us the amplitude for being in &quot;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&quot;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rightarrow \frac{1}{\sqrt{2Z}} |0\rangle \lbrack 2 |a| |0,a,0\rangle - |b| |0,a,1\rangle + |a| |1,b,0\rangle - 2|b| |1,b,1\rangle + |a||0,b,1\rangle -|b||1,a,0\rangle\rbrack + \cdots$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{\sqrt{2Z}} |0\rangle \lbrack (|0,a\rangle + |1,b\rangle ) (|a| |0\rangle - |b| |1\rangle )  + (|a| |0\rangle - |b| |1\rangle )(|a,0\rangle + |b,1\rangle )  \rbrack + \cdots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check that this is on the correct track because it has the form of the &quot;symmetric&quot; combination of swapped states that provides the amplitude for a &quot;0&quot; readout  in the SWAP test (equation 127 from your first ref):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}|0\rangle (|\psi\rangle|\phi\rangle + |\phi\rangle|\psi\rangle) + \cdots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though in this case you need to account for the fact that you only &lt;em&gt;partially&lt;/em&gt; swapped the registers of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, which is why the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; states remain in the third slot for both parts of the superposition. Then from this simpler expression you can continue with the derivation of the ordinary SWAP test to find that the readout probability for &quot;0&quot; is directly related to Euclidean distance.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-08-30T00:26:44.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7124" PostTypeId="1" CreationDate="2019-08-30T09:28:36.750" Score="0" ViewCount="190" Body="&lt;p&gt;I have a 2 qubits system, maximally entangled, and I performed measurement on one of the qubit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(2)&#xA;c = ClassicalRegister(1)&#xA;qc = QuantumCircuit(q, c)&#xA;###create Bell State Qubit########&#xA;qc.h(q[1])&#xA;qc.cx(q[1],q[0])&#xA;### Perform Measurement ##########&#xA;qc.measure(q[0],c)&#xA;job = execute(qc,simulator,shots = 1000)&#xA;result = job.result()&#xA;counts = result.get_counts(qc)&#xA;print(&quot;\nTotal count for 0 and 1 are:&quot;,counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Before measurement, the state of the 2 qubit is &lt;span class=&quot;math-container&quot;&gt;$|00&amp;gt;+|11&amp;gt;/\sqrt(2)$&lt;/span&gt;. After obtaining the measurement result, I measured another qubit. I expected the 2nd qubit to collapse to either 1 of the 2 states(&lt;span class=&quot;math-container&quot;&gt;$|0&amp;gt;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1&amp;gt;$&lt;/span&gt;) after measurement, but the result shows it is still in the superposition state. How do I renormalise the qubit state after measurement?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.measure(q[1],c)&#xA;job = execute(qc,simulator,shots=1000)&#xA;result = job.result()&#xA;counts = result.get_counts(qc)&#xA;print(&quot;\n Total count for 0 and 1 are:,counts&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8334" LastEditorUserId="55" LastEditDate="2021-01-22T11:10:51.567" LastActivityDate="2021-02-21T12:03:20.327" Title="Qiskit - Renormalize the qubit after measurement" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7125" PostTypeId="1" AcceptedAnswerId="7126" CreationDate="2019-08-30T11:34:23.510" Score="2" ViewCount="130" Body="&lt;p&gt;Below I created a circuit and applied several gates to it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 4&#xA;&#xA;qubits = QuantumRegister(n, name='q')&#xA;ansilla = QuantumRegister(n - 1, name='ans')&#xA;&#xA;circuit = QuantumCircuit(qubits, ansilla)&#xA;&#xA;# I step&#xA;circuit.ccx(qubits[0], qubits[1], ansilla[0])&#xA;&#xA;# II step&#xA;for i in range(2, n - 1):&#xA;    circuit.ccx(qubits[i], ansilla[i-2], ansilla[i-1])&#xA;&#xA;&#xA;# III step&#xA;circuit.cx(ansilla[-1], qubits[-1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I draw a visualization with &lt;code&gt;circuit.draw()&lt;/code&gt; I got the following diagram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CYdab.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CYdab.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It draws &lt;code&gt;III step&lt;/code&gt; before &lt;code&gt;II&lt;/code&gt; step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it a bug or how can I overcome this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use qiskit version=0.8.2&lt;/p&gt;&#xA;" OwnerUserId="6134" LastActivityDate="2019-09-05T10:36:24.013" Title="Why qiskit changed the order of gated applied to a circuit" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7126" PostTypeId="2" ParentId="7125" CreationDate="2019-08-30T11:42:52.347" Score="1" Body="&lt;p&gt;Why does it do it? I don't know.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I do know is that it isn't a problem when the circuit is run. Step II and step III are applied to completely different sets of qubits. As such, it does not matter which is done first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you nevertheless want to stop it happening, &lt;code&gt;circuit.draw(justify='none')&lt;/code&gt;. If that ever doesn't work for any reason, you can put a &lt;code&gt;circuit.barrier()&lt;/code&gt; operation between the steps. This will stop the compiler doing whatever it is doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since this behaviour is obvious not intended, please consider &lt;a href=&quot;https://github.com/qiskit/qiskit-terra/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;filing an issue&lt;/a&gt; so that it can be fixed.&lt;/p&gt;&#xA;" OwnerUserId="409" LastEditorUserId="409" LastEditDate="2019-09-05T10:36:24.013" LastActivityDate="2019-09-05T10:36:24.013" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7127" PostTypeId="1" CreationDate="2019-08-30T11:52:42.793" Score="2" ViewCount="68" Body="&lt;p&gt;It is a proven and well-known fact that length-4 cycles are detrimental to the performance of classical LDPC codes. This is due to the fact that such short cycles impair the decoding algorithm (Sum Product or Belief Propagation over the code Tanner Graph), reducing its convergence threshold and negatively impacting its performance. For this reason, numerous algorithms and LDPC code construction techniques that minimize the presence of these short cycles (i.e maximize the code girth) have been devised.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the Quantum realm, Quantum LDPC codes are designed based on the Stabilizer formalism, which allows us to construct QLDPC codes by making use of existing classical LDPC codes, albeit following specific criteria to select the aforementioned existing classical codes. They are also decoded based on implementations of the SPA or BPA over the associated Tanner graphs. Therefore, it is intuitive to assume, without considering the specifics of a quantum framework, that length-4 cycles will also have a negative impact on the performance of QLDPC codes based solely on what is known from classical communications. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now consider how QLDPC codes, or their quantum parity check matrices more precisely, are constructed (I will employ the CSS construction method as it is the most common): &lt;span class=&quot;math-container&quot;&gt;$$ H_Q = (H_z|H_x) =&#xA;\begin{pmatrix} H_z^{'} &amp;amp;0 \\&#xA;    0 &amp;amp;H_x^{'} \end{pmatrix}, $$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$ H_z = \begin{pmatrix} H_z^{'} \\ 0 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ H_x = \begin{pmatrix} 0 \\ H_x^{'} \end{pmatrix}$&lt;/span&gt;. In the construction shown above, &lt;span class=&quot;math-container&quot;&gt;$H_z'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_x'$&lt;/span&gt; are the parity check matrices of two classical LDPC codes &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt;, chosen so that &lt;span class=&quot;math-container&quot;&gt;$C_1^\perp \in C_2$&lt;/span&gt; is fulfilled, where &lt;span class=&quot;math-container&quot;&gt;$C_1^\perp$&lt;/span&gt; is the dual of the classical LDPC code &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In essence, the Quantum PCM of a QLDPC code is constructed based on the classical PCMs of two classical LDPC codes. Thus, we are faced with a &quot;double whammy&quot;-like scenario:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;On the one hand, the QPCM is built from two different parity check matrices that will inevitably have some length-4 cycles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In addition, the symplectic representation employed in Quantum error correction automatically induces more length-4 cycles. This stems from the fact that the generators of the code must commute in order to satisfy the symplectic criterion, which ensures the resulting code is applicable in a quantum environment.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Based on what I have mentioned up to this point, it would seem reasonable to assume that minimizing or even eliminating all the length-4 cycles from the PCM of a QLDPC code would undoubtedly improve performance. However, based on the work I am conducting on QLDPC codes and results I have garnered, it appears as if less length-4 cycles is not always better. In other words, there seems to be a &quot;sweet spot&quot; value of length-4 cyles at which performance of QLDPC codes peaks and increasing or decreasing the amount of cycles at that point worsens said performance. I am not entirely certain as to why this happens, but I believe an argument could be made for the presence of at least a minimum number of short cycles in the QPCM of a QLDPC code (they might aid in spreading information over the entire decoding graph which could then be exploited by the decoding algorithm due to its iterative nature).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to ascertain if pursuing methods to determine or establish a threshold of length-4 cycles that optimizes code performance is a worth-while research endeavour. I would be greatful for insights, opinions or experiences others may have had in this field. I would also be thankful if I could be directed towads publications that may discuss this topic (I recall reading a paper that mentioned the importance of having length-4 cycles in decoding graphs by I have not been able to find it).&lt;/p&gt;&#xA;" OwnerUserId="7855" LastEditorUserId="55" LastEditDate="2021-01-05T11:37:30.057" LastActivityDate="2021-01-05T11:37:30.057" Title="The importance of length-4 cycles in Quantum LDPC codes" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7128" PostTypeId="2" ParentId="7124" CreationDate="2019-08-30T13:52:34.057" Score="0" Body="&lt;p&gt;It looks like you are using the simulator, so adding a &lt;code&gt;reset&lt;/code&gt; on the qubit you want to renormalize would work. The &lt;code&gt;reset&lt;/code&gt; operation sets a qubit back to the ground state, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. You would call this like any other operation: &lt;code&gt;circuit.reset(&amp;lt;qubits&amp;gt;)&lt;/code&gt;. &lt;em&gt;Note: This will not work on the real devices.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you think it is still in superposition after the measurement, applying another H-Gate would fix that as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you plan to continue using the simulator, applying the &lt;code&gt;reset&lt;/code&gt; might be the better option as you will always be sure, no matter what, that that qubit is back in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-08-30T13:52:34.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7129" PostTypeId="1" AcceptedAnswerId="7131" CreationDate="2019-08-30T14:15:32.183" Score="1" ViewCount="609" Body="&lt;p&gt;For example, I have some circuit&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After operations:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.h(0)&#xA;circuit.cx(0, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;probability amplitudes of the qubits will change. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I can estimate them by measuring qubits a bunch of times and normalizing the &lt;code&gt;counts&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = execute(circuit, backend, shots=1000).result()&#xA;counts  = result.get_counts(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But is there a way to directly obtain true amplitudes? Yeah, it's impossible in real life, but I hope the information is contained under the hood of &lt;code&gt;qiskit&lt;/code&gt; for education purposes.&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2019-08-30T14:58:14.303" LastActivityDate="2019-08-30T17:25:11.290" Title="How to obtain qubit's amplitude in qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7130" PostTypeId="2" ParentId="7125" CreationDate="2019-08-30T16:55:21.383" Score="1" Body="&lt;p&gt;The reason this happens is that the sort order is not guaranteed for the diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's a matter of network theory. &lt;a href=&quot;https://networkx.github.io/documentation/latest/reference/algorithms/generated/networkx.algorithms.dag.topological_sort.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;networkx&lt;/code&gt;&lt;/a&gt; is the toolkit used for the DAG (Distributed Acyclic Graph) into which circuits are decomposed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example, it doesn't matter to the computation which operation occurs first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it matters, the order displayed is guaranteed correct.&lt;/p&gt;&#xA;" OwnerUserId="7744" LastActivityDate="2019-08-30T16:55:21.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7131" PostTypeId="2" ParentId="7129" CreationDate="2019-08-30T17:25:11.290" Score="5" Body="&lt;p&gt;You can get these &quot;true amplitudes&quot; through the use of the &lt;code&gt;statevector_simulator&lt;/code&gt; within Aer. If you execute the circuit on the &lt;code&gt;statevector_simulator&lt;/code&gt; backend, it will return a statevector for the circuit. This statevector, when normalized, will return the theoretical probabilities of each state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's take the circuit you posted as an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(2)&#xA;circuit.h(0)&#xA;circuit.cx(0, 1)&#xA;&#xA;# Retrieve the statevector_simulator backend&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;result = execute(circuit, backend, shots=1000).result()&#xA;&#xA;# Get the statevector from result().&#xA;statevector = result.get_statevector(circuit)&#xA;&#xA;# Normalize statevector to receive the true probabilities.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The statevector will be in the form of a list, with each entry representing a possible state. In this example, the statevector would be returned as &lt;code&gt;[0.70710678+0.j 0.        +0.j 0.        +0.j 0.70710678+0.j]&lt;/code&gt;. This can be read as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;State &lt;code&gt;00&lt;/code&gt; probability = 0.70710678+0.j (which is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;State &lt;code&gt;01&lt;/code&gt; probability = 0&lt;/li&gt;&#xA;&lt;li&gt;State &lt;code&gt;10&lt;/code&gt; probability = 0&lt;/li&gt;&#xA;&lt;li&gt;State &lt;code&gt;11&lt;/code&gt; probability = 0.70710678+0.j (which is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which, when normalized would give you a 50% probability of the state &lt;code&gt;00&lt;/code&gt; and a 50% probability of the state &lt;code&gt;11&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-08-30T17:25:11.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7132" PostTypeId="2" ParentId="7121" CreationDate="2019-08-30T20:31:59.557" Score="2" Body="&lt;p&gt;Sure! Look up &lt;a href=&quot;https://en.wikipedia.org/wiki/Multipartite_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;multipartite entanglement&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of an entangled system among &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional qudits is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;GHZ state&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\mathrm{GHZ}\rangle\equiv\frac{1}{\sqrt d}\sum_{k=1}^d \lvert \underbrace{k,k,...,k}_n\rangle&#xA;\equiv \frac{1}{\sqrt d}\sum_{k=1}^d \bigotimes_{j=1}^n \lvert k\rangle.$$&lt;/span&gt;&#xA;You can think of this as a generalisation of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell state&lt;/a&gt;, which you might have heard of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another notorious genuinely multipartite entangled state is a &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; state&lt;/a&gt;. In the simplest case of three qubits this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|W\rangle=\frac{1}{\sqrt 3}(|001\rangle+|010\rangle+|100\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Entanglement between systems of different dimensions is also possible. For example, if you have a qubit and a qutrit, you can consider a state such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt2}\left[|0\rangle\otimes\frac{1}{\sqrt3}\left(|0\rangle+|1\rangle+|2\rangle\right)&#xA;+ |1\rangle\otimes\frac{1}{\sqrt2}(|0\rangle-|1\rangle)\right].$$&lt;/span&gt;&#xA;A context in which you commonly encounter states with entanglement/correlation between a low-dimensional and a high-dimensional degree of freedom is for example a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_walk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum walk&lt;/a&gt; (though one doesn't usually study the entanglement properties of the produced states when dealing with these).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-08-30T20:31:59.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7133" PostTypeId="1" AcceptedAnswerId="7135" CreationDate="2019-08-30T23:47:55.237" Score="1" ViewCount="370" Body="&lt;p&gt;I am trying to figure out the intuitive meaning behind the eigenvalues and eigenvectors of a reduced density matrix. I understand that of a density matrix- the eigenvalues are the probability the state will be measured in the corresponding pure state eigenvector. What about a reduced density matrix? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to figure out why all eigenvalues of a reduced density matrix having two-fold degeneracy is a sufficient condition for entanglement. Any insight here would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="7734" LastEditorUserId="55" LastEditDate="2020-08-20T08:04:51.983" LastActivityDate="2020-08-20T08:04:51.983" Title="Intuitive meaning of the eigenvalues and eigenvectors of a reduced density matrix" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7134" PostTypeId="1" CreationDate="2019-08-31T15:09:17.840" Score="1" ViewCount="81" Body="&lt;p&gt;I am learning the stabilizer code through Nielsen &amp;amp; Chuang which give the following hypothesis to have correctable error for stabilizer codes:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let S be the stabilizer for a stabilizer code C(S). Suppose &lt;span class=&quot;math-container&quot;&gt;${E_j}$&lt;/span&gt; is a&#xA;  set of operators in &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\forall (j,k) E^{\dagger}_j E_k \notin N(S) - S$&lt;/span&gt;. Then, &lt;span class=&quot;math-container&quot;&gt;$\{E_i\}$&lt;/span&gt; is a correctable set of errors for &lt;span class=&quot;math-container&quot;&gt;$C(S)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; is the normalizer of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; which is also equal to the centralizer &lt;span class=&quot;math-container&quot;&gt;$Z(S)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with this statement after having gone through the proof but the initial condition is a little abstract for me. I would like to have intuition of what it means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is why I looked at &lt;a href=&quot;https://en.wikipedia.org/wiki/Stabilizer_code#Stabilizer_error-correction_conditions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Stabilizer_code#Stabilizer_error-correction_conditions&lt;/a&gt; which seems to give a nice way to interpret it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, they say that the condition as given in Nielsen &amp;amp; Chuang, are equivalent to  say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An error &lt;span class=&quot;math-container&quot;&gt;$E \in \{E_j\} \subset G_n$&lt;/span&gt; (the n-Pauli group) is :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;correctable if it anti-commutes with at least one of the generators&lt;/li&gt;&#xA;&lt;li&gt;correctable and commutes with all the generator &lt;span class=&quot;math-container&quot;&gt;$\Leftrightarrow$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$E \in S$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Which means that an error is correctable if it is NOT in &lt;span class=&quot;math-container&quot;&gt;$Z(S)-S$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However I do not understand why the two proposition are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion, my questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the physical intuition behind the abstract condition &lt;span class=&quot;math-container&quot;&gt;$\forall (j,k), E^{\dagger}_j E_k \notin N(S) - S$&lt;/span&gt; ?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is the one given by the wikipedia page, then &lt;strong&gt;why is the wikipedia definition equivalent to the one in N&amp;amp;Chuang ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2019-08-31T16:16:17.583" LastActivityDate="2019-08-31T16:16:17.583" Title="Stabilizer error correction condition" Tags="&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="7135" PostTypeId="2" ParentId="7133" CreationDate="2019-08-31T16:21:08.413" Score="6" Body="&lt;p&gt;The interesting quantity of a density matrix (reduced or not) is its rank, that is, the number of non-zero eigenvalues it has. Rank 1 means the state is pure which can also be seen from the density matrix that takes the form of a projection on a single state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=|\psi\rangle\langle\psi|.$$&lt;/span&gt;&lt;br&gt;&#xA;Higher rank density matrix implies the state is mixed. The eigenvectors associated with the different eigenvalues &lt;span class=&quot;math-container&quot;&gt;$p_1,p_2,...$&lt;/span&gt; are the pure states in this mixture&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=p_1|\psi_1\rangle\langle\psi_1|+p_2|\psi_2\rangle\langle\psi_2|+\ldots$$&lt;/span&gt;&lt;br&gt;&#xA;(When some of the eigenvalues are degenerate the eigenvectors are somewhat arbitrary but the statement is essentially the same.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why multiple non-zero eigenvalues (they don't have to be degenerate) in the reduced state imply entanglement? Because this implies that the reduced state is mixed and (assuming the unreduced state was pure) this can only happen if the unreduced state was entangled.&#xA;If it is not clear why it is the case, I encourage you to learn about the Schmidt decomposition. &lt;/p&gt;&#xA;" OwnerUserId="8288" LastEditorUserId="23" LastEditDate="2019-08-31T21:58:41.303" LastActivityDate="2019-08-31T21:58:41.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7136" PostTypeId="2" ParentId="7111" CreationDate="2019-08-31T16:54:18.360" Score="2" Body="&lt;p&gt;In general, the answer is that you need to find the irreducible representation (irrep) structure of the algebra generated by &lt;span class=&quot;math-container&quot;&gt;$\{M_1,M_2,...\}$&lt;/span&gt;. This will tell you what the commutant of the algebra looks like (commutant = {all operators that commute with all operators of the algebra}) . Then you can pick &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; from the commutant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many cases the irrep of the algebra is trivial, like when the generators act irreducibly on the whole space (example: &lt;span class=&quot;math-container&quot;&gt;$\{X,Y\}$&lt;/span&gt; acting on the space of a qubit) . Then the commutan is just the operators proportional to the identity.  Another simple case is when all &lt;span class=&quot;math-container&quot;&gt;$\{M_1,M_2,...\}$&lt;/span&gt; commute with each other. Then you just need to simultaneously diagonalize them and the commutant is all operators that act arbitrarily on the degenerate sectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the general case the irrep structure is hard to find. There are numerical algorithms out there that can do the job. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am working on an algorithm that can find the irrep structure without numerics (if the irreps are not too complicated that is, but one can also run it numerically). &lt;/p&gt;&#xA;" OwnerUserId="8288" LastActivityDate="2019-08-31T16:54:18.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7137" PostTypeId="1" CreationDate="2019-08-31T23:21:15.650" Score="0" ViewCount="527" Body="&lt;p&gt;I'm trying to plot a histogram of my code but when I run&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;plot_histogram(results.get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;it gives me a traceback error.&lt;/p&gt;&#xA;&lt;p&gt;This is what I had before calling the histogram function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;-result = execute(circuit, backend = simulator).result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and thereafter when I try to plot it by typing&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;-plot_histogram(results.get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;it doesn't work.&lt;/p&gt;&#xA;" OwnerUserId="8404" LastEditorUserId="45" LastEditDate="2020-09-29T07:19:32.517" LastActivityDate="2020-09-29T07:19:32.517" Title="Qiskit plot_histogram and count not working" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-09-29T09:06:48.347" ContentLicense="CC BY-SA 4.0" />
  <row Id="7138" PostTypeId="1" AcceptedAnswerId="7143" CreationDate="2019-09-01T02:55:45.017" Score="3" ViewCount="279" Body="&lt;p&gt;From my understanding, the oracle function in Grover's algorithm is used as a way to check for the desired outcome. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have looked at &lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/blob/2a5559bbd1b98fee7cf316bfd2fa86e427a4ef5d/algorithms/grover_algorithm.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; example which implements the Exactly-1 3-SAT problem and the oracle function follows some rules which only returns True for the correct solution. I have also looked at &lt;a href=&quot;https://community.qiskit.org/textbook/ch3/3.6.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; which looks for two marked states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second example it looks like the exact solution is given to the oracle which I don't understand as I thought we are supposed to be searching for the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering if I am misinterpreting this and also how an oracle function can be created if we don't know the rules (like a maze)?&lt;/p&gt;&#xA;" OwnerUserId="8405" LastEditorUserId="26" LastEditDate="2019-09-29T09:32:07.483" LastActivityDate="2019-09-29T09:32:07.483" Title="In Grover's Algorithm, does the exact solution need to be given to the oracle?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7139" PostTypeId="1" CreationDate="2019-09-01T04:00:15.160" Score="2" ViewCount="82" Body="&lt;p&gt;I am trying to prove the following relation related to the Quantum Fourier Transform:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{y=0}^{N-1}e^{2\pi i\frac{x}{N}y} = \begin{cases}0 &amp;amp; \text{if } x\neq 0\mod N \\ N &amp;amp; \text{if } x=0\mod N\end{cases}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could not find the proof anywhere. What are the possible ways to proceed?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="55" LastEditDate="2019-09-05T09:12:01.397" LastActivityDate="2019-09-05T09:12:01.397" Title="How do I prove that $\sum_{y=0}^{N-1}e^{2\pi i xy/N}=N\delta_{x,0}$?" Tags="&lt;mathematics&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7140" PostTypeId="1" CreationDate="2019-09-01T06:55:17.660" Score="0" ViewCount="53" Body="&lt;p&gt;Consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}e^{2\pi i\frac{x_1}{N}j}\left|j\right&amp;gt;_h\left|j\right&amp;gt;_t.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above entangled state, what is the probability of getting &lt;span class=&quot;math-container&quot;&gt;$|j\rangle_t$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; belongs to &lt;span class=&quot;math-container&quot;&gt;$\left\lbrace 0, 1, 2, \ldots, N-1\right\rbrace$&lt;/span&gt;? The 1st &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits are &lt;span class=&quot;math-container&quot;&gt;$|j\rangle_h$&lt;/span&gt; and 2nd m qubits &lt;span class=&quot;math-container&quot;&gt;$|j\rangle_t$&lt;/span&gt;. We are measuring 2nd &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits here.&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="55" LastEditDate="2019-09-11T21:44:06.283" LastActivityDate="2019-09-11T21:44:06.283" Title="What is the probability of measuring $|j\rangle$ with $j\in\{0, 1, 2, ... N-1\}$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="7141" PostTypeId="1" CreationDate="2019-09-01T07:55:28.310" Score="1" ViewCount="103" Body="&lt;p&gt;consider a 2 qubit entangled state (&lt;span class=&quot;math-container&quot;&gt;$\sqrt 3/2)\left|00\right&amp;gt; + (1/2)\left|11\right&amp;gt;$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q1) Is the above  entangled state a valid one?&#xA;q2) If valid then What is the probability of measuring the second qubit as &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="8249" LastEditDate="2019-09-01T08:22:08.583" LastActivityDate="2019-09-03T04:20:23.600" Title="Measuring a single qubit in 2 bit entangled state" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7142" PostTypeId="1" CreationDate="2019-09-01T08:17:39.510" Score="2" ViewCount="233" Body="&lt;p&gt;I try to follow the calculation from IBMQ experience regrading of Entanglement and Bell test which they derive the value of question as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;C=\langle A B\rangle-\left\langle A B^{\prime}\right\rangle+\left\langle A^{\prime} B\right\rangle+\left\langle A^{\prime} B^{\prime}\right\rangle&#xA;\end{equation}&lt;/span&gt;&#xA; where ; &lt;span class=&quot;math-container&quot;&gt;$\langle A B\rangle= p_{++}+p_{--}-p_{+-}-p_{-+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A , A'$&lt;/span&gt; is Alice's basis, &lt;span class=&quot;math-container&quot;&gt;$B, B'$&lt;/span&gt; is Bob's basis of measurement&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the choice of the basis they chose is following this &lt;span class=&quot;math-container&quot;&gt;$A = Z, A' = X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B = W, B' = V$&lt;/span&gt; where&#xA;&lt;a href=&quot;https://i.stack.imgur.com/S4n8c.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S4n8c.png&quot; alt=&quot;The Bell test with quantum correlations&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/onVh9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/onVh9.png&quot; alt=&quot;The required measurements for the CHSH experiment&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then they have &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\langle Z W\rangle=\langle Z V\rangle=\langle X W\rangle=\frac{1}{\sqrt{2}},\langle X V\rangle=-\frac{1}{\sqrt{2}}&#xA;\end{equation}&lt;/span&gt;&#xA;so that &lt;span class=&quot;math-container&quot;&gt;$|C| = 2\sqrt{2}$&lt;/span&gt; which greater than &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, they do this experiment on the real device and obtain the following value&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3hzwH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3hzwH.png&quot; alt=&quot;Example result&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is if following their choice of basis then &lt;span class=&quot;math-container&quot;&gt;$\langle AB' \rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\langle ZV' \rangle$&lt;/span&gt; but from their calculation, it can be seen that &lt;span class=&quot;math-container&quot;&gt;$\langle AB' \rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\langle XV' \rangle$&lt;/span&gt; which seem to agree with above value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is supposed to be right and wrong in this calculation and how can I know theoretically which basis is supposed to have a minus sign from this choice of basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note : the link to reference will redirect to another page &#xA;&lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/introduction-to-quantum-circuits?page=5cae705d35dafb4c01214bc5&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/support/guides/introduction-to-quantum-circuits?page=5cae705d35dafb4c01214bc5&lt;/a&gt;&#xA;from that page --&gt; Introduction to Quantum Circuits --&gt; Entanglement and Bell Tests&#xA;Sorry for the inconvenience. &lt;/p&gt;&#xA;" OwnerUserId="4729" LastEditorUserId="55" LastEditDate="2019-09-02T18:15:54.633" LastActivityDate="2019-09-02T18:15:54.633" Title="In the CHSH inequality, how can I know which term is supposed to have the minus sign?" Tags="&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7143" PostTypeId="2" ParentId="7138" CreationDate="2019-09-01T08:18:29.720" Score="4" Body="&lt;p&gt;The first example you're looking at is closer to the process of building an oracle for practical applications than the second one. The oracle circuit has to encode the Boolean formula for a specific instance of the problem you're trying to solve, and not the known solutions themselves. When you encode the oracle, you don't know the answer to the problem, but you do know the formula that describes the problem instance and create an oracle based on this knowledge.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tag &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/grovers-algorithm&quot;&gt;grovers-algorithm&lt;/a&gt; has a lot of discussions on oracle implementations, since this is probably one of the most confusing topics about the Grover's algorithm - you might want to check them out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for more examples of building oracles for SAT problems given only the SAT formula, you can find them in &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/tree/master/SolveSATWithGrover&quot; rel=&quot;nofollow noreferrer&quot;&gt;my tutorial&lt;/a&gt; (for a different flavor of SAT problem, but the logic of the steps that have to be done to convert a formula into an oracle is more or less the same for all problems).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-01T08:18:29.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7144" PostTypeId="1" CreationDate="2019-09-01T15:15:14.007" Score="3" ViewCount="75" Body="&lt;p&gt;I am confused by a property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the N&amp;amp;Chuang it is said that an &lt;span class=&quot;math-container&quot;&gt;$[n,k,2t+1]$&lt;/span&gt; stabilizer code is able to correct up to &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors. But for me if the code has distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; it should be able to correct up to &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, the distance of a quantum code is defined as the minimal weight of an element in &lt;span class=&quot;math-container&quot;&gt;$Z(S)-S$&lt;/span&gt; (uncorrectable errors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then, if my error has a weight &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt;, it is not in &lt;span class=&quot;math-container&quot;&gt;$Z(S)-S$&lt;/span&gt; and I will be able to correct it ?&#xA;Thus an &lt;span class=&quot;math-container&quot;&gt;$[n,k,d]$&lt;/span&gt; code is able to correct up to &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt; error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where is my mistake ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2019-09-03T07:54:14.977" Title="Link between distance of a stabilizer code and number of errors it is able to correct" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7145" PostTypeId="1" CreationDate="2019-09-01T16:31:22.330" Score="5" ViewCount="153" Body="&lt;p&gt;My question simply is the following: is there any interests in building arithmetic circuits such as adders or multiplier on a quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asking this because it seems that classical computers are way better at doing arithmetic operations, so even if a quantum algorithm needs to do some arithmetics, wouldn't it be better to let a classical computer handle this part and then return the results to the quantum computer so it can then continue to run the algorithm? &lt;/p&gt;&#xA;" OwnerUserId="8115" LastEditorUserId="55" LastEditDate="2019-09-05T10:41:56.527" LastActivityDate="2019-09-05T10:41:56.527" Title="What is the point of building arithmetic circuits in a quantum computer?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;quantum-advantage&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7146" PostTypeId="1" AcceptedAnswerId="7159" CreationDate="2019-09-01T16:45:02.470" Score="1" ViewCount="429" Body="&lt;p&gt;For computation, I use &lt;code&gt;N&lt;/code&gt; working qubits and &lt;code&gt;M&lt;/code&gt; ancilla qubits.  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qubits = QuantumRegister(N, name='q')&#xA;ancilla = QuantumRegister(M, name='anc')&#xA;circuit = QuantumCircuit(qubits, ancilla)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then at the end of a program to get state vector I do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = execute(circuit, Aer.backend, shots=shots).result()&#xA;return result.get_statevector(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Because of ancilla qubits are usually used for computation/uncomputation steps it means that the end states of them are &lt;span class=&quot;math-container&quot;&gt;$|0..0 \rangle$&lt;/span&gt; (at least in some cases) and I am not interested in them due to unnessasary information about &lt;code&gt;M&lt;/code&gt; ancilla qubits contained in &lt;code&gt;get_statevector(circuit)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to get state vector so it will show amplitudes only for &lt;code&gt;N&lt;/code&gt; working qubit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an idea to solve this equation to find &lt;span class=&quot;math-container&quot;&gt;$S_N$&lt;/span&gt; (state vector of &lt;code&gt;N&lt;/code&gt; working qubits): &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ S_N \otimes I_M = S_{M+N}$$&lt;/span&gt;&#xA;but probably &lt;code&gt;qiskit&lt;/code&gt; can do it internally.&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2019-09-01T20:42:14.823" LastActivityDate="2019-09-13T14:23:47.763" Title="How to get amplitudes only for chosen qubits?" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7147" PostTypeId="1" CreationDate="2019-09-01T17:28:30.573" Score="6" ViewCount="1553" Body="&lt;p&gt;I was wondering why IBM's computer were using U1 and U2 gates as part of there basis gates since as I understood, they are particular cases of the U3 gate. Why not just use U3 gate instead ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="8115" LastActivityDate="2019-09-02T22:17:48.517" Title="Why use U2 and U1 gate in IBM quantum computers?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7149" PostTypeId="2" ParentId="7062" CreationDate="2019-09-01T22:58:24.577" Score="5" Body="&lt;p&gt;Thanks for the answers from @forky40. I accept it as the right answer, but do want to provide a complete derivation as follows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Same as in the original question) First, initialize per DistCalc:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle =  \frac{1}{\sqrt{2}} (|0,a\rangle + |1,b\rangle) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\phi\rangle =  \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$&lt;/span&gt;&#xA;Also let:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi'\rangle =  \frac{1}{\sqrt{2}} (|a,0\rangle + |b,1\rangle) $$&lt;/span&gt;&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$\psi'$&lt;/span&gt; is a valid (normalized) qubit as it can be obtained by swapping qubits from &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Same as in the original question) Now, initialize per SwapTest:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | 0, \psi, \phi \rangle = \frac{1}{\sqrt{2Z}} (|a|| 0,0,a,0\rangle - |b|| 0,0,a,1\rangle +|a|| 0,1,b,0\rangle - |b|| 0,1,b,1\rangle   $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Same as in the original question) Apply Hadamard gate on first qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2\sqrt{Z}} (|a|| 0,0,a,0\rangle + |a|| 1,0,a,0\rangle - |b|| 0,0,a,1\rangle -|b|| 1,0,a,1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+ |a|| 0,1,b,0\rangle+|a|| 1,1,b,0\rangle - |b|| 0,1,b,1\rangle - |b|| 1,1,b,1\rangle )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Updated as suggested by @forky40) Apply Control-Swap gate on the ancilla qubit of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; (before &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;) and the only qubit on &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; (after &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;) with the first qubit as the control bit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$  \frac{1}{2\sqrt{Z}} (|a|| 0,0,a,0\rangle + |a|| 1,0,a,0\rangle - |b|| 0,0,a,1\rangle -|b|| 1,1,a,0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+ |a|| 0,1,b,0\rangle+|a|| 1,0,b,1\rangle - |b|| 0,1,b,1\rangle - |b|| 1,1,b,1\rangle )  $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{\sqrt{2Z}} (|a|\frac{| 0 \rangle+| 1 \rangle}{\sqrt{2}}| 0,a,0 \rangle -&#xA;|b|\frac{| 0 \rangle+| 1 \rangle}{\sqrt{2}}| 1,b,1 \rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+\frac{1}{2\sqrt{Z}} ( - |b|| 0,0,a,1\rangle -|b|| 1,1,a,0\rangle+ |a|| 0,1,b,0\rangle+|a|| 1,0,b,1\rangle )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply Hadamard on first qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{2Z}} (|a|| 0,0,a,0 \rangle -|b|| 0,1,b,1 \rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+\frac{1}{2\sqrt{2Z}} ( - |b|| 0,0,a,1\rangle - |b|| 1,0,a,1\rangle -|b|| 0,1,a,0\rangle+|b|| 1,1,a,0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$+ |a|| 0,1,b,0\rangle+ |a|| 1,1,b,0\rangle+|a|| 0,0,b,1\rangle -|a|| 1,0,b,1\rangle )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measure on first qubit to get probability in getting first qubit in &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \vert \frac{1}{\sqrt{2Z}} (|a|| 0,a,0 \rangle -&#xA;|b|| 1,b,1 \rangle)  +\frac{1}{2\sqrt{2Z}} ( - |b|| 0,a,1\rangle  -|b|| 1,a,0\rangle&#xA;+ |a|| 1,b,0\rangle+ |a|| 0,b,1\rangle )  \vert^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{8Z} \vert(|a|(2|0,a,0 \rangle +&#xA;|1,b,0 \rangle+|0,b,1\rangle)-|b|(2| 1,b,1 \rangle+| 0,a,1 \rangle+|1,a,0\rangle)\vert^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider qubits before and after &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, there are four combinations. Hence the probability is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{8Z}(|a|^2(2^2+1+1) + |b|^2 (2^2+1+1) $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ -|a||b|(\langle 0,b,1|0,a,1\rangle+\langle 0,a,1|0,b,1\rangle)&#xA; -|a||b| (\langle 1,b,0|1,a,0\rangle+\langle 1,a,0|1,b,0\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{8Z}(6(|a|^2+|b|^2)-2|a||b|\langle a|b \rangle -2|a||b|\langle b|a \rangle) = \frac{1}{8Z}(6Z-4|a||b|\langle a|b \rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{3}{4} - \frac{|a||b|}{2Z}\langle a|b \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, the probability can be rewritten to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4Z} \vert(|a|(|0,\psi' \rangle + |\psi,0\rangle)&#xA;-|b|(| 1,\psi' \rangle+| \psi,1\rangle)\vert^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{4} \vert(|\phi,\psi' \rangle + |\psi,\phi\rangle)\vert^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{4} (\langle \phi,\psi'|\phi,\psi' \rangle + \langle \psi,\phi |\psi,\phi\rangle + &#xA;\langle \phi,\psi'|\psi,\phi \rangle + \langle \psi,\phi |\phi,\psi'\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi,\phi\rangle = \frac{1}{\sqrt{2Z}}(|a|(|0,a,0\rangle+|1,b,0\rangle)-|b|(|0,a,1\rangle+|1,b,1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi,\psi'\rangle = \frac{1}{\sqrt{2Z}}(|a|(|0,a,0\rangle+|0,b,1\rangle)-|b|(|1,a,0\rangle+|1,b,1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \phi,\psi'|\psi,\phi\rangle = \langle \psi,\phi|\phi,\psi'\rangle = \frac{1}{2Z}(|a|^2+|b|^2-2|a|b|\langle a|b \rangle)=\frac{1}{2}-\frac{1}{Z}|a|b|\langle a|b \rangle$$&lt;/span&gt;&#xA;Hence the probability is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}(1+1+2(\frac{1}{2}-\frac{1}{Z}|a|b|\langle a|b \rangle)=\frac{3}{4} - \frac{|a||b|}{2Z}\langle a|b \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{3}{4} - \frac{|a||b|}{2Z}\langle a|b \rangle=\frac{1}{2}+\frac{Z-2|a||b|\langle a|b \rangle}{4Z}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}+\frac{|a|^2 \langle a|a \rangle + |b|^2 \langle b|b \rangle -2|a||b|\langle a|b \rangle}{4Z}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}+\frac{||a||a \rangle - |b||b \rangle|^2}{4Z}=\frac{1}{2}+\frac{|a-b|^2}{4Z}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-09-01T22:58:24.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7150" PostTypeId="2" ParentId="7145" CreationDate="2019-09-01T23:03:20.570" Score="1" Body="&lt;p&gt;Quantum arithmetic circuits are useful in implementing &quot;oracles&quot; in various general quantum algorithms. For example, if we want to apply Grover's algorithm to solve a real Traveler's salesman problem, we need to implement the &quot;oracle&quot; inside the quantum circuit. Of course, in this case, we still need the conventional computer to prepare the quantum circuits according to the specific Traveler's salesman problem, including how cities are connected and weights are assigned to roads.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-09-01T23:03:20.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7151" PostTypeId="2" ParentId="7139" CreationDate="2019-09-01T23:14:52.097" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$f(y)=e^{2\pi i \frac{x}{N}y}, Y=\sum_{y=0}^{N-1}f(y)$&lt;/span&gt;. Clearly &lt;span class=&quot;math-container&quot;&gt;$f(0)=f(N)=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$x = 0\mod N$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$f(y)=1$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$Y=N$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$x\not= 0 \mod N$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$f(1)\not=1$&lt;/span&gt;.&#xA;Now &lt;span class=&quot;math-container&quot;&gt;$f(1)Y=\sum_{y=1}^{N}f(x) = Y - f(0) + f(N) = Y$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$Y(f(1)-1)=0$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$f(1)\not=1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$Y=0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-09-01T23:14:52.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7152" PostTypeId="2" ParentId="7141" CreationDate="2019-09-01T23:20:21.737" Score="2" Body="&lt;p&gt;It is valid, as &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; are the two computational basis states and the amplitudes are normalized &lt;span class=&quot;math-container&quot;&gt;$(\frac{\sqrt{3}}{2})^2+(\frac{1}{2})^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of measuring the second qubit as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{3}{4}$&lt;/span&gt;. BTW, as the result of the measurement, the first qubit will be also in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; due to the entanglement. &lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-09-01T23:20:21.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7153" PostTypeId="2" ParentId="7138" CreationDate="2019-09-01T23:32:11.057" Score="1" Body="&lt;p&gt;Nielsen and Chuang's book made a very good point about the problem to solve using Grover's algorithm: it is easy to recognize a solution but difficult to find one. As a practical example, it is much easier to determine whether a very large number between &lt;span class=&quot;math-container&quot;&gt;$10^{10^{10}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$10^{10^{11}}$&lt;/span&gt; is prime or not, than to find a prime number in this range (FYI, the largest known prime has &lt;span class=&quot;math-container&quot;&gt;$24,862,048$&lt;/span&gt; digits).&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="8321" LastEditDate="2019-09-02T15:07:56.143" LastActivityDate="2019-09-02T15:07:56.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7154" PostTypeId="2" ParentId="7144" CreationDate="2019-09-02T06:26:15.020" Score="3" Body="&lt;p&gt;This question applies equally to classical codes, and is perhaps easier to understand in that context. Consider, for example, the 5-bit repetition code. The code words are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;00000\qquad 11111&#xA;$$&lt;/span&gt;&#xA;Clearly, the distance &lt;span class=&quot;math-container&quot;&gt;$d=5$&lt;/span&gt; because it takes 5 bit flips to convert from one code word to the other. Now, let's imagine some errors have happened. We look at our bits and read&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;11101&#xA;$$&lt;/span&gt;&#xA;What has happened? It's actually ambiguous. Either our codeword was 00000 and errors have happened on bits 1,2,3,5 or the codeword was 11111 and there was a single error on bit 4. With the underlying assumption that errors are unlikely, we will always resolve the  ambiguity by assuming it was the most likely error sequence, i.e. the one consisting of fewest errors. So, even if it were the case that 4 errors had happened, we have no way of knowing that. We'd perform the wrong correction. So, when is correction successful? If the number of errors leaves us closer to our original codeword than the other codeword. In other words, if &lt;span class=&quot;math-container&quot;&gt;$d=2t+1$&lt;/span&gt;, then we can correct for &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors. In this specific case, &lt;span class=&quot;math-container&quot;&gt;$t=2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-02T06:26:15.020" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7155" PostTypeId="2" ParentId="7139" CreationDate="2019-09-02T06:34:51.207" Score="1" Body="&lt;p&gt;The case of &lt;span class=&quot;math-container&quot;&gt;$x=0\text{ mod }N$&lt;/span&gt; is straightforward - each term in the sum is &lt;span class=&quot;math-container&quot;&gt;$e^0=1$&lt;/span&gt; and there are &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; terms in the sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$x\neq 0$&lt;/span&gt;, there are a number of ways you could do this. I tend to use the sum of a geometric progression:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{r=0}^{N-1}a^r=\frac{a^N-1}{a-1},&#xA;$$&lt;/span&gt;&#xA;assuming &lt;span class=&quot;math-container&quot;&gt;$a\neq 1$&lt;/span&gt;. Hence, if we let &lt;span class=&quot;math-container&quot;&gt;$a=e^{2\pi ix/N}$&lt;/span&gt;, the sum is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{e^{2\pi ix}-1}{e^{2\pi ix/N}-1}=0.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-02T06:34:51.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7156" PostTypeId="2" ParentId="7145" CreationDate="2019-09-02T06:41:55.790" Score="2" Body="&lt;p&gt;Remember that quantum computers contain, as a subset, the classical logic gates. So your assertion that &quot;classical computer are way better at doing arithmetic operations&quot; is not entirely clear. Unless you mean that the current state of the art quantum computers are not as good as classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, I can think of two reasons why we might want to implement simple arithmetic on a quantum computer:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;it might be that the algorithms are more efficient. As I said, classical computation is a subset. So, we have something else as well, and if we're smart, perhaps we can improve the algorithms using that something extra.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if you want to use the result of the calculation within part of a larger computation. You cannot just farm this out to a classical computer due to linearity. Fine, if the QC is guaranteed to be in a basis state &lt;span class=&quot;math-container&quot;&gt;$|a\rangle|b\rangle|0\rangle$&lt;/span&gt; then you might think you could prepare &lt;span class=&quot;math-container&quot;&gt;$|a\rangle|b\rangle|a\oplus b\rangle$&lt;/span&gt; by computing &lt;span class=&quot;math-container&quot;&gt;$a\oplus b$&lt;/span&gt; and just making the state. But if any of the registers are in a superposition, you would be unable to read all the values, and unable to prepare a suitable superposition. The calculation has to be done within the quantum computer to preserve the linearity of the operation. It might be defined on computational basis states, but must work just as well for superpositions.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-02T06:41:55.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7157" PostTypeId="2" ParentId="7142" CreationDate="2019-09-02T06:51:40.930" Score="3" Body="&lt;p&gt;The fact is that it doesn't matter. So long as one of the four terms has the minus sign on it, you'll get a suitable test. Yes, there seems to be some inconsistency with labelling the different cases, but it's not a big deal - nothing physically changes if you swap which measurement basis you call &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and which you call &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; for example; you're still doing the same experiment. Obviously in this case you want to calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle ZW\rangle+\langle ZV\rangle+\langle XW\rangle-\langle XV\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-02T06:51:40.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7158" PostTypeId="2" ParentId="7120" CreationDate="2019-09-02T07:02:58.620" Score="2" Body="&lt;p&gt;The way that I tend to think about it is to write out the &lt;span class=&quot;math-container&quot;&gt;$(n-k)\times 2n$&lt;/span&gt; binary matrices specifying the generators. The first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of each row are the locations of Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrices, while the second &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; are the locations of the Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; matrices.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G=\left(\begin{array}{c|c} G_x &amp;amp; G_z \end{array}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, imagine we introduce a new stabilizer &lt;span class=&quot;math-container&quot;&gt;$g=(x|z)$&lt;/span&gt;. It is linearly independent if &lt;span class=&quot;math-container&quot;&gt;$G\cdot G^t\equiv 0\text{ mod }2$&lt;/span&gt;. Also, it commutes if &lt;span class=&quot;math-container&quot;&gt;$G\cdot (z|x)^T\equiv 0\text{ mod }2$&lt;/span&gt;. In other words, we're looking for a vector that satisfies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{c|c} G_x &amp;amp; G_z \\ G_z &amp;amp; G_x \end{array}\right)\cdot g\equiv 0\text{ mod }2.&#xA;$$&lt;/span&gt;&#xA;Hence, we simply seek a member of the Null Space, modulo 2, of the big matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example: Think of the 3-bit majority vote. It has stabilizers &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2Z_3$&lt;/span&gt;. We can perform the necessary computation with Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;NullSpace[{{1, 1, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 1, 1}}, Modulus -&gt; 2]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We get two possible answers (note, however, that these do not mutually commute): &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2Z_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_1X_2X_3$&lt;/span&gt;. Note, of course, that we can reduce the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; terms by removing products of stabilizers, returning something like &lt;span class=&quot;math-container&quot;&gt;$Z_1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-09-02T09:47:55.740" LastActivityDate="2019-09-02T09:47:55.740" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7159" PostTypeId="2" ParentId="7146" CreationDate="2019-09-02T09:19:35.470" Score="3" Body="&lt;p&gt;I think that the &lt;code&gt;statevector_simulator&lt;/code&gt; will always return the statevector for all the qubits in the circuit. You can however add snapshots over a subset of qubits, so you could add this right at the end of your circuit and use the information you get from that instead.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.extensions.simulator import snapshot&#xA;qc.snapshot(&quot;one_qubit&quot;, qubits=[0])&#xA;qc.snapshot(&quot;many_qubits&quot;, qubits=[0,2])&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;result = execute(qc, backend).result()&#xA;&#xA;snapshots = result.data()['snapshots']['statevector'].items()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-09-02T09:19:35.470" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="7160" PostTypeId="2" ParentId="7146" CreationDate="2019-09-02T09:41:26.617" Score="1" Body="&lt;p&gt;If I can be sure that all ancilla qubits are in &lt;span class=&quot;math-container&quot;&gt;$ | 0...0 \rangle$&lt;/span&gt; then that their state vector is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix} &#xA;1 \\&#xA;0 \\&#xA;... \\&#xA;0  &#xA;\end{bmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$2^M\times 1$&lt;/span&gt; dimension. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I can take the first &lt;span class=&quot;math-container&quot;&gt;$2^N $&lt;/span&gt; elements out of &lt;code&gt;result.get_statevector(circuit)&lt;/code&gt; to find the state vector of working qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's just a partial solution.&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="6134" LastEditDate="2019-09-13T14:23:47.763" LastActivityDate="2019-09-13T14:23:47.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7161" PostTypeId="1" AcceptedAnswerId="7163" CreationDate="2019-09-02T15:04:40.220" Score="4" ViewCount="347" Body="&lt;p&gt;I'm having trouble understanding how the measurement on &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axes can be interpreted in terms of the Bloch sphere representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1wJkLm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1wJkLm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the state can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$∣⟩=\cos(/2)|0⟩+\exp(i)\sin(/2)|1⟩,$$&lt;/span&gt;&#xA;and that to make a measurement we use the squared modulus of the inner product of the basis vector and the state vector.&#xA;For example, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$|⟨0|⟩|^2$&lt;/span&gt;&#xA;for a &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking in terms of the Bloch sphere, it is clear that a rotation by an angle &lt;span class=&quot;math-container&quot;&gt;$$&lt;/span&gt; would not affect a &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; measurement, and this is easy to prove mathematically.&#xA;But this should also be the case for a &lt;span class=&quot;math-container&quot;&gt;$$&lt;/span&gt; rotation on a &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; measurement, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I try to prove it mathematically, I get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|⟨+|⟩|^2 = \frac{1}{\sqrt2}|(\cos(/2)+\exp(i)\sin(/2)|^2 &#xA;\\= \frac{1}{\sqrt2}|(\cos(/2)+\cos()\sin(/2)+i \sin()\sin(/2)|^2,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which then can be written in the form of &lt;span class=&quot;math-container&quot;&gt;$a^2 + b^2$&lt;/span&gt; where &#xA;&lt;span class=&quot;math-container&quot;&gt;$a=\cos(/2)+\cos()\sin(/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b = \sin()\sin(/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$$&lt;/span&gt; affects the probability of a &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; measurement. I know I must be doing something wrong but what is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also don't understand why x gate is a rotation around the x axis and not the y axis ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for your answer.&lt;/p&gt;&#xA;" OwnerUserId="8115" LastEditorUserId="55" LastEditDate="2019-09-02T18:02:08.650" LastActivityDate="2019-09-02T18:02:08.650" Title="How are measurements on $Z$ and $X$ axes interpreted in the Bloch sphere?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7162" PostTypeId="1" AcceptedAnswerId="7169" CreationDate="2019-09-02T16:36:11.703" Score="3" ViewCount="185" Body="&lt;p&gt;First of all, let me come out and say that I know very little about Quantum Computing (QC), even though it's a subject which fascinates me. I'd say I'm generally aware of the basic principles (with a lot of misconceptions thrown in, quite probably), but not naive enough to think I have a firm grasp of them, so please go easy on me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also know little about the Lattice-Boltzmann Method as my day to day at work involves using Navier-Stokes based commercial solvers for our commercial Computational Fluid Dynamics (CFD) work, and that's what I was taught in my integrated Masters. I've only briefly checked out a couple of open-source LBM codes while at work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, from what little understanding I have of both these topics, and from the following explanation of the LBM method - &lt;a href=&quot;http://feaforall.com/creating-cfd-solver-lattice-boltzmann-method/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Everything you need to know about the Lattice Boltzmann Method&lt;/a&gt; - is it plausible to assume that this method would be inherently more suitable to implement in a QC CFD code, or am I just erroneously conflating the role that probability plays in both these topics?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards,&lt;/p&gt;&#xA;" OwnerUserId="8342" LastActivityDate="2019-09-03T08:46:42.307" Title="Would the Lattice Boltzmann Method be more suitable for QC CFD than Navier-Stokes?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7163" PostTypeId="2" ParentId="7161" CreationDate="2019-09-02T17:53:19.843" Score="5" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; angles are not equivalent in the Bloch sphere. First, they have different ranges -- one is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; and the other is &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. More importantly, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is a rotation around a fixed axis, &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, while &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is a rotation around a non-fixed axis that is moving with &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$\phi=0$&lt;/span&gt; this axis is &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi/2$&lt;/span&gt;  it is &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and for every other &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; it is everything in between in the &lt;span class=&quot;math-container&quot;&gt;$x-y$&lt;/span&gt; plane.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If pictorially we associate the probability of outcome to depend on the angle of the state's vector with the axis of measurement (the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis is the 0,1 measurement for example), then rotations &lt;em&gt;around&lt;/em&gt; the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis should not affect the probabilities of 0,1 outcomes, and that's why the &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; angle does not change this measurement. &#xA;We cannot say the same about rotations by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; since it depends on the axis of rotation. In special cases though, for example if you set &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi/2$&lt;/span&gt;, then the axis of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; rotation is &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, then you should expect the +,- measurements along the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis not to depend on the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (set  &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi/2$&lt;/span&gt; and with basic trigo your equations should be telling you that). &lt;/p&gt;&#xA;" OwnerUserId="8288" LastActivityDate="2019-09-02T17:53:19.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7165" PostTypeId="2" ParentId="7137" CreationDate="2019-09-02T20:10:55.590" Score="1" Body="&lt;p&gt;Looking at the code without the example it looks like you missed an &quot;s&quot; on the result variable. &lt;code&gt;plot_histogram(results.get_counts(circuit))&lt;/code&gt; should work.&lt;/p&gt;&#xA;" OwnerUserId="302" LastActivityDate="2019-09-02T20:10:55.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7166" PostTypeId="2" ParentId="7147" CreationDate="2019-09-02T20:34:57.303" Score="15" Body="&lt;p&gt;There is not anything that you cant do with U3 so ideally there is no reason for U1 and U2. Eventually, as the transpilers gets better we may remove them and just have U3 and CNOT.  So why did we make U1 and U2? It is because of the hardware. The U1 is done using a frame change (see &lt;a href=&quot;https://arxiv.org/abs/1612.00858&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1612.00858&lt;/a&gt;) which means they are done in software (gate time is zero). U2 is a single &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; gate with a pre and post frame change (gate time is one unit of single-qubit gates). The one we calibrate is a &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; rotation around the x-axis and choose the pre and post to get the definition of U2. The U3 is three frame changes and two-single qubit gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why you would use them is the error rate. For the U1 the erorr rate is not measurable (so let us say it is zero). The error for the U3 is twice that of the U2. So if you want a better fidelity (ignoring spectator qubit errors - these are errors from parallel operations or spectator qubits being in a state that is not zero) you want to minimize the number of gates with errors so a circuit of just U1 will be better than one using U3. &lt;/p&gt;&#xA;" OwnerUserId="302" LastEditorUserId="302" LastEditDate="2019-09-02T22:17:48.517" LastActivityDate="2019-09-02T22:17:48.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7167" PostTypeId="2" ParentId="7141" CreationDate="2019-09-03T04:20:23.600" Score="2" Body="&lt;p&gt;Regarding Q2, lets take the case of making a measurement on first qubit, then the probability of finding first qubit is 0.75 in |0&gt; and 0.25 in |1&gt; (explanation given in  answer @czwang). Now say, the first qubit is found to be in |0&gt; post measurement then the probability of second qubit to be in |0&gt; is ONE and if the first qubit is found in |1&gt; post measurement, then the probability of the second qubit to be in |0&gt; is ZERO. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you first perform the measurement on second qubit then the probability of second qubit to be in |0&gt; is 0.75.&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-09-03T04:20:23.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7168" PostTypeId="2" ParentId="7144" CreationDate="2019-09-03T07:54:14.977" Score="1" Body="&lt;p&gt;From my understanding of the concept, the weight of an error &lt;span class=&quot;math-container&quot;&gt;$E \in G_n$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; represents the n-fold Pauli group, is defined as the number of terms in the tensor product that are not equal to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; (the identity operator). Therefore, according to this definition, error sequences of weight &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; correspond to sequences that have errors in &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; of a stabilizer code is defined as the minimum weight of an element that belongs to the set defined as the centralizer minus the stabilizer: &lt;span class=&quot;math-container&quot;&gt;$Z(S) - S$&lt;/span&gt;. This set contains all the elements that commute with &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; but don't actually belong to &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. The Pauli operators that belong to &lt;span class=&quot;math-container&quot;&gt;$Z(S) - S$&lt;/span&gt; are such that &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;\psi_i|E_a|\psi_j&amp;gt;\neq c_{a}\delta_{ij}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$E_a \in [Z(s) - S]$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, based on our definition of distance, a stabilizer code will be able to correct &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors if the error set &lt;span class=&quot;math-container&quot;&gt;$\mathbb{E}$&lt;/span&gt; used for recovery includes all Pauli operators of weights &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; or less. The definition given for distance implies that the criterion for error correction &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;\psi_i|E_a^{\dagger}E_b|\psi_j&amp;gt; =c_{ab}\delta{ij}$&lt;/span&gt; will be fulfilled by Pauli operators of weight &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; or less, provided that &lt;span class=&quot;math-container&quot;&gt;$d \geq 2t + 1$&lt;/span&gt;. Thus if &lt;span class=&quot;math-container&quot;&gt;$d=2t+1$&lt;/span&gt;, the stabilizer code will be able to correct &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors.&lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2019-09-03T07:54:14.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7169" PostTypeId="2" ParentId="7162" CreationDate="2019-09-03T08:46:42.307" Score="2" Body="&lt;p&gt;If I understand correctly, the Lattice Boltzmann Method computes the probability density on a lattice. It doesn't consider sampling from that probability distribution. So, from a very remote perspective, both methods are computing some quantity over a lattice using some finite-difference approximations of differential operators. From this perspective, LBM doesn't involve more or less probability. Therefore, both equations should be equally suitable for implementing on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They may have different challenges, though, because of the different operators they involve (I can't comment on that, as I haven't read in-depth any works that proposed quantum CFD).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computers would have an edge in problems where it is hard to sample such a probability distribution. For example, the evolution of a quantum Hamiltonian can lead to a probability distribution that is (believed to be) hard to sample from using a classical computer but easily implemented with a quantum one (e.g. see &lt;a href=&quot;https://arxiv.org/abs/1908.08069&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;; it is very technical but the introduction seems accessible to non-experts).&lt;/p&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2019-09-03T08:46:42.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7170" PostTypeId="1" CreationDate="2019-09-03T10:19:32.123" Score="0" ViewCount="125" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}e^{2\pi i x j  \left/ {\phantom\vert\!\!} N \right.}\,\left|j\right\rangle_h\left|j\right\rangle_t$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a valid state we should have sum of probabilities = 1. However, when I compute the sum of the squares of the amplitudes of this state, I get zero. Am I making a mistake?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="124" LastEditDate="2019-09-05T14:29:26.967" LastActivityDate="2019-09-05T14:29:26.967" Title="Is $\frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}e^{2\pi ixj \left/\phantom\vert\!{N} \right.}|j\rangle |j\rangle$ a valid entangled quantum state?" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7171" PostTypeId="1" AcceptedAnswerId="7174" CreationDate="2019-09-03T19:36:18.777" Score="0" ViewCount="176" Body="&lt;p&gt;It is possible to use &lt;code&gt;cirq.simulate&lt;/code&gt; and then the &lt;code&gt;final_state&lt;/code&gt; keyword to get the final wavefunction of the circuit, however, the circuit that I am trying to simulate is very large, and the simulation seems to take a long time. Thus, I was wondering if there was a function that would allow me to find the probability of measuring the specific state that I'm interested in, rather than calculating the entire wavefunction (in turn hopefully helping to speed up the program).&lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2019-09-04T00:28:43.673" Title="Is there a function that returns the probability of measuring a particular state in Cirq?" Tags="&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7173" PostTypeId="2" ParentId="7170" CreationDate="2019-09-04T00:15:40.317" Score="5" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \frac{1}{\sqrt{N}}\sum_{j=0}^{N-1}e^{2\pi&#xA;i\frac{x_1}{N}j}\left|j\right&amp;gt;_h\left|j\right&amp;gt;_t$&lt;/span&gt; to be normalized. It must satisfy &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi|\psi\right&amp;gt; = 1$&lt;/span&gt;. Let's check, &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi|\psi\right&amp;gt; = \frac{1}{N}\sum_{j=0}^{N-1}e^{-2\pi&#xA;i\frac{x_1}{N}j}\left&amp;lt;j\right|_h\left&amp;lt;j\right|_t\sum_{j=0}^{N-1}e^{2\pi&#xA;i\frac{x_1}{N}j}\left|j\right&amp;gt;_h\left|j\right&amp;gt;_t$&lt;/span&gt;. Assuming the &lt;span class=&quot;math-container&quot;&gt;$\left|j\right&amp;gt;_i$&lt;/span&gt; states are orthonormal, then &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi|\psi\right&amp;gt; = \frac{1}{N}N = 1$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8420" LastActivityDate="2019-09-04T00:15:40.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7174" PostTypeId="2" ParentId="7171" CreationDate="2019-09-04T00:28:43.673" Score="1" Body="&lt;p&gt;Cirq's simulator is a state vector simulator, which cannot be told to focus on the amplitude of a specific output state or combination of output states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some tensor network based simulators can get benefit from focusing on a specific output state, but there isn't such a simulator in Cirq.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-09-04T00:28:43.673" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7175" PostTypeId="1" AcceptedAnswerId="7179" CreationDate="2019-09-04T01:15:04.990" Score="0" ViewCount="75" Body="&lt;p&gt;Say I want to measure a photon in state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{\sqrt 2}{2}|0\rangle-\dfrac{\sqrt 2}{2}|1\rangle$&lt;/span&gt; in the measurement basis &lt;span class=&quot;math-container&quot;&gt;$[|i\rangle,|-i\rangle]$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8421" LastEditorUserId="55" LastEditDate="2019-09-05T10:59:39.497" LastActivityDate="2019-09-05T10:59:39.497" Title="Is measuring real qubit states in a complex basis such as $|0\rangle\pm i|1\rangle$ possible?" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7176" PostTypeId="1" CreationDate="2019-09-04T03:17:06.990" Score="-2" ViewCount="44" Body="&lt;p&gt;Suppose Alice has 2 qubit entangled state and wants to send 1st qubit to Bob. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;q1) Now what is left with Alice? Both 1st and 2nd qubits or only 2nd qubit?&#xA;q2) Does the overall composite quantum system be in the same entangled state as with Alice initially? &lt;/p&gt;&#xA;" OwnerUserId="8249" LastActivityDate="2019-09-04T13:53:56.193" Title="What is the state after entangled qubit transfer?" Tags="&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7177" PostTypeId="2" ParentId="7170" CreationDate="2019-09-04T03:45:02.363" Score="2" Body="&lt;p&gt;Another approach is &lt;span class=&quot;math-container&quot;&gt;$\exp(ix) = \cos x + i\sin x$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\left|\cos x + i\sin x\right| = \sqrt{\left(\cos x + i\sin x\right)\left(\cos x - i\sin x\right)} = \sqrt{\cos^2x + \sin^2x} = 1$&lt;/span&gt;. so each term in &lt;span class=&quot;math-container&quot;&gt;$|ψ⟩$&lt;/span&gt; has coefficient amplitude &lt;span class=&quot;math-container&quot;&gt;$1/√N$&lt;/span&gt;, so sum of square of all the terms &lt;span class=&quot;math-container&quot;&gt;$N\times(1/√N)^2 =1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8120" LastEditorUserId="23" LastEditDate="2019-09-04T20:54:18.297" LastActivityDate="2019-09-04T20:54:18.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7178" PostTypeId="1" CreationDate="2019-09-04T04:17:07.457" Score="-1" ViewCount="68" Body="&lt;p&gt;Suppose Alice has the following state&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle = \frac{1}{\sqrt2} (|10\rangle + |11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If Alice transfers 1st qubit to Bob then is this the resultant composite system state after transfer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2} (|01\rangle + |11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="8249" LastEditDate="2019-09-04T07:21:05.267" LastActivityDate="2019-09-04T13:39:43.787" Title="What is the resultant composite quantum state after the transfer?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7179" PostTypeId="2" ParentId="7175" CreationDate="2019-09-04T07:46:38.850" Score="4" Body="&lt;p&gt;Yes, it is possible, same way as it is possible to measure a state with complex amplitudes in a basis with real amplitudes (say, a &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; state in the &lt;span class=&quot;math-container&quot;&gt;$[|0\rangle, |1\rangle]$&lt;/span&gt; basis). Either way, the probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and getting measurement result corresponding to basis state &lt;span class=&quot;math-container&quot;&gt;$|a_i\rangle$&lt;/span&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$P_i = |\langle a_i| \psi \rangle|^2$&lt;/span&gt; - since you're taking absolute value of the amplitude before squaring it, it doesn't matter whether the value &lt;span class=&quot;math-container&quot;&gt;$\langle a_i| \psi \rangle$&lt;/span&gt; is complex or real - the probability will still be a real number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your example, the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$| i \rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$| - \rangle$&lt;/span&gt; state is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_i = |\langle -| i \rangle|^2 = \big|\frac12 \big(\langle0| - \langle1|\big)\big(|0\rangle + i|1\rangle\big) \big|^2 = \big|\frac12 \big( \langle0|0\rangle - i \langle1|1\rangle\big)\big|^2 = \\ = \frac14|1-i|^2 = \frac14 \cdot (\sqrt2)^2 = \frac12$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-04T07:46:38.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7180" PostTypeId="2" ParentId="7178" CreationDate="2019-09-04T13:39:43.787" Score="1" Body="&lt;p&gt;It seems like you are saying that when Alice sends/teleports her qubit to Bob, the first (left) qubit &quot;becomes&quot; the second (right) qubit.  It's like you want to relabel the left (Bob) qubit with the right (Alice) qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the states that Alice and Bob have are already a product state and the qubits are not entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Alice's first (left) qubit is not in superposition - it is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and her second qubit is superposition in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If she sends her first (left) qubit to Bob, then Bob has a qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; while Alice maintains the right qubit in superposition &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The net is that up to the relabeling, the resulting qubit system is still &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|10\rangle+|11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-09-04T13:39:43.787" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="7181" PostTypeId="2" ParentId="7176" CreationDate="2019-09-04T13:53:56.193" Score="1" Body="&lt;p&gt;As for &lt;strong&gt;Q1:&lt;/strong&gt; - Presumably you mean she &quot;sends&quot; her first qubit to Bob by teleporting it  to Bob.  By the no-cloning theorem, if Alice sends her first qubit to Bob, she cannot have possession of both the first qubit and the second qubit.  She only has possession of the second qubit.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for &lt;strong&gt;Q2:&lt;/strong&gt; - After teleportation, the overall composite system is in the same entangled state.  A difference is presumably that if Alice had possession of both qubits initially she could have performed controlled operations on the qubits (e.g. the first qubit can control a rotation of the second qubit); now Alice and Bob may be causally separated, and Alice and Bob can only locally act on their respective qubits.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-09-04T13:53:56.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7182" PostTypeId="1" AcceptedAnswerId="7183" CreationDate="2019-09-04T15:30:25.960" Score="3" ViewCount="1205" Body="&lt;p&gt;The following statement is causing an error in Qiskit Version 0.9.0: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error Message: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQAccountError: 'IBM Q Experience v1 credentials found. Please update your accounts and programs by following the instructions here:\nhttps://github.com/Qiskit/qiskit-ibmq-provider#updating-to-the-new-ibm-q-experience'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The display of the account finformation from the stored location is working OK and matches the API key: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(str(IBMQ.stored_account())) &#xA;&#xA;{'token': '94....051', 'url': 'https://auth.quantum-computing.ibm.com/api'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When using the provider = IBMQ.load_account(&quot;94....051&quot;), the authentication  completed normally. I've already tried to manually delete the registry with rm ~/.qiskit/qiskitrc, or by using the IBMQ.delete_account() command, or by doing the IBMQ.update_account(), as well as doing a refresh of the token. The error persist at the the load_account() function.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Versions used: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.9.0&#xA;{'qiskit-terra': '0.9.0', 'qiskit-ignis': '0.2.0', 'qiskit-aqua': '0.6.0', 'qiskit': '0.12.0', 'qiskit-aer': '0.3.0', 'qiskit-ibmq-provider': '0.3.2'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8427" LastActivityDate="2019-09-04T15:38:37.180" Title="IBMQ.load_account from stored ACCOUNT is failing on Qiskit 0.9.0" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7183" PostTypeId="2" ParentId="7182" CreationDate="2019-09-04T15:38:37.180" Score="3" Body="&lt;p&gt;This error means that old credentials are still in use on your disk. Try getting a new API key from &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;the website&lt;/a&gt; and then running &lt;code&gt;IBMQ.save_account('APIKEY', overwrite=True)&lt;/code&gt;. This should overwrite the existing old credentials with new ones.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-09-04T15:38:37.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7185" PostTypeId="2" ParentId="7078" CreationDate="2019-09-04T20:48:29.803" Score="1" Body="&lt;p&gt;I got the answer 0.547&#xA;I got this through the square root of 30/100. as the probability of ket 0 to ket 1 as a fraction. &lt;/p&gt;&#xA;" OwnerUserId="8344" LastActivityDate="2019-09-04T20:48:29.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7186" PostTypeId="2" ParentId="7117" CreationDate="2019-09-05T08:14:00.720" Score="3" Body="&lt;p&gt;You can get a previous result by grabbing the corresponding job from the backend you sent it to:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_BLAH')&#xA;&#xA;#if you know the job ID&#xA;job = backend.retrieve_job('JOB_ID')&#xA;&#xA;# if not, get the last 10 jobs on backend&#xA;jobs = backend.jobs()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="332" LastEditorUserId="5955" LastEditDate="2020-04-21T10:59:13.433" LastActivityDate="2020-04-21T10:59:13.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7188" PostTypeId="1" AcceptedAnswerId="8389" CreationDate="2019-09-05T13:59:11.317" Score="1" ViewCount="215" Body="&lt;p&gt;I'd like to better understand the Max-Cut algorithm from the &lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/blob/master/optimization/max_cut.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit tutorials&lt;/a&gt;. Particularly, the run_algorithm function inputs. The inputs are two dictionaries, but I can't find any documentation or explanation as to why these dictionaries are structured the way they are. Example from the tutorial:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;algorithm_cfg = {&#xA;    'name': 'ExactEigensolver',&#xA;}&#xA;&#xA;params = {&#xA;    'problem': {'name': 'ising'},&#xA;    'algorithm': algorithm_cfg&#xA;}&#xA;result = run_algorithm(params,algo_input)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why is the 'problem' key in the params dictionary labeled with 'Ising'? Why bother including the 'problem' entry if the algorithm is an exact eigensolver? For non-exact eigensolver algorithms, why would the algorithm need to know it's mapping to an Ising model if also_input already has the qubit operator mapping? I'm confused about these hyper parameters and can't seem to find resources/explanations for them. Please help!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are great tutorials solving interesting problems with qiskit, but all the approaches are how to solve one specific problem using one specific algorithm. For example, the max-cut tutorial doesn't use the QAOA, but it should be able to solve the problem just as well as VQE which is used. Are there no tutorials/resources on the general use of qiskit Aqua algos? (e.g. how to implement each algorithm, explanations on the required inputs, what happens to the underlying quantum computing structure, and the math behind it?)&lt;/p&gt;&#xA;" OwnerUserId="8420" LastEditorUserId="55" LastEditDate="2019-09-28T19:14:30.747" LastActivityDate="2019-10-03T01:46:25.630" Title="How to understand run_algorithm() inputs in qiskit" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7189" PostTypeId="1" AcceptedAnswerId="7190" CreationDate="2019-09-05T15:22:29.343" Score="2" ViewCount="304" Body="&lt;p&gt;Sorry if this question sounds too basic. But I can't find a word for those quantum gates than can be reversed (exchanging the target qubit with the control qubit) and still performs the same operation. Such as the &lt;code&gt;CPhase&lt;/code&gt; or the &lt;code&gt;SQSWAP&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think they can be called &quot;reversibles&quot;, because that means another  thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="6017" LastEditorUserId="55" LastEditDate="2021-03-10T11:42:26.570" LastActivityDate="2021-03-10T11:42:26.570" Title="What is the name for quantum gates that can be reversed?" Tags="&lt;quantum-gate&gt;&lt;notation&gt;" AnswerCount="4" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7190" PostTypeId="2" ParentId="7189" CreationDate="2019-09-05T15:42:43.827" Score="7" Body="&lt;p&gt;symmetric?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, can be used in other contexts, but it is the right word for this context because what you're talking about is something that's invariant under swap. Perhaps the first time you use it, one should clarify with the phrase &quot;symmetric under exchange of the inputs&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-05T15:42:43.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7192" PostTypeId="2" ParentId="7189" CreationDate="2019-09-05T15:58:36.840" Score="2" Body="&lt;p&gt;All quantum gates are reversible, in the sense that they always admit an inverse which is a quantum gate as well. This comes from the fact that quantum gates are (usually) required to be &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;unitary&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you probably meant to ask is how you call gates &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U^2=I$&lt;/span&gt;. If you assume &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, that is &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U=UU^\dagger=I$&lt;/span&gt;, then this is equivalent to the condition &lt;span class=&quot;math-container&quot;&gt;$U^\dagger =U$&lt;/span&gt;. Such gates are called &lt;a href=&quot;https://en.wikipedia.org/wiki/Hermitian_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hermitian&lt;/a&gt; (or symmetric when they are real).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If, instead, you are referring to gates whose action is invariant under exchange of the inputs, then that can mean gates &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|a,b\rangle=U|b,a\rangle$&lt;/span&gt; for all one-qubit states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. This essentially means that the two middle columns of the matrix (in the standard choice of canonical basis) are the same. Yet another possible interpretation is that the matrix is required to have the same description when exchanging both the two input qubits and the two output qubits. This amounts to asking for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to commute with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Swap_(SWAP)_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;swap operation&lt;/a&gt;: &lt;span class=&quot;math-container&quot;&gt;$[U,\mathrm{SWAP}]=0$&lt;/span&gt;. You can compute explicitly the form of these matrices, but I don't think there is any universally accepted special name for these sorts of operations.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-09-05T16:27:28.423" LastActivityDate="2019-09-05T16:27:28.423" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="7193" PostTypeId="2" ParentId="7189" CreationDate="2019-09-05T16:36:58.640" Score="-1" Body="&lt;p&gt;One might consider this to be  equivalent to the definition of a &lt;em&gt;unitary transformation&lt;/em&gt;.&#xA;All quantum gates are reversible, thus all quantum gates are unitary. &lt;/p&gt;&#xA;" OwnerUserId="8133" LastActivityDate="2019-09-05T16:36:58.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7194" PostTypeId="1" CreationDate="2019-09-05T16:48:13.070" Score="2" ViewCount="167" Body="&lt;p&gt;In the most simple example I can think of, we have:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;a linear operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, which is also a 2 x 2 matrix.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;a vector &lt;span class=&quot;math-container&quot;&gt;$|v_i⟩$&lt;/span&gt;, which can be considered a 2 x 1 matrix. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;If we see an example of an operation such as &lt;span class=&quot;math-container&quot;&gt;$A|v_i⟩$&lt;/span&gt;, which is an operation on the vector. Are we, in all cases, to consider this equivalent to a simple matrix multiplication? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any other considerations to be aware of? This is fascinating stuff, thanks for considering this simple problem. &lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="7460" LastEditDate="2019-09-07T22:07:37.117" LastActivityDate="2019-09-09T19:04:53.340" Title="Are all operations simply matrix multiplication?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7196" PostTypeId="2" ParentId="7194" CreationDate="2019-09-06T00:31:22.453" Score="1" Body="&lt;p&gt;I think all unitary operations can be thought of as matrix multiplication, but something like a measurement is non-unitary, and looks like a partial trace over the density matrix, so there is a bit more going on there.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2019-09-06T00:31:22.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7197" PostTypeId="1" CreationDate="2019-09-06T01:11:03.800" Score="5" ViewCount="114" Body="&lt;p&gt;We know that the current quantum computers are noisy/error-prone. They are susceptible to gate errors (single qubit and multi-qubit), decoherence (relaxation and dephasing), readout error, etc. I want to know what is/are the underlying physical reason(s) behind each type of error. Answer for one type of qubit (say, superconducting qubit) is perfectly okay. &lt;/p&gt;&#xA;" OwnerUserId="4722" LastEditorUserId="55" LastEditDate="2019-09-10T08:21:08.727" LastActivityDate="2019-11-07T21:16:07.900" Title="What are the physical reasons behind noise/errors in quantum computers?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;physical-qubit&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7198" PostTypeId="1" CreationDate="2019-09-06T05:08:48.847" Score="2" ViewCount="85" Body="&lt;p&gt;Consider physical systems such as electrons in metals, or Bose-Einstein condensates, or any crystal, which are realised in the real three-dimensional space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we want to simulate these systems on a quantum simulator, then we have to arrange our qubits in 3d.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to do that on IBMQ Experience?&lt;/p&gt;&#xA;" OwnerUserId="8365" LastEditorUserId="55" LastEditDate="2019-09-07T13:57:12.353" LastActivityDate="2019-09-07T13:57:12.353" Title="Can we simulate quantum many-body systems with IBMQ Experience?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7199" PostTypeId="2" ParentId="7198" CreationDate="2019-09-06T23:29:54.350" Score="2" Body="&lt;p&gt;To simulate a 3D material, the material's structure will need to be somewhat understood. That way the structure can be mapped to the qubit connectivity. Notice in this &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/5_using_the_transpiler.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; the qubits and their connections to each other are represented in graphs. The 3D material to be simulated can be put into a graph that will then be mapped to the qubit graph and the connections weighted according the physical interaction in the 3d material. This will probably be a very large circuit, but that doesn't mean it's not worth looking into!&lt;/p&gt;&#xA;" OwnerUserId="8420" LastActivityDate="2019-09-06T23:29:54.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7200" PostTypeId="1" CreationDate="2019-09-07T19:17:33.137" Score="1" ViewCount="21" Body="&lt;p&gt;how a single Pauli z-gate (on particular qubit) on the highest order qubit realize square well potential?&#xA;How upon acting same gate on the second highest qubit, realize double square well potential?&#xA;Can you provide some physical intuition and mathematics regarding this?&#xA;This question is regarding paper by Andrew T. Sornborger titled 'Quantum Simulation Of Tunneling in Small System ',  &lt;a href=&quot;https://www.nature.com/articles/srep00597&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/srep00597&lt;/a&gt; .&lt;/p&gt;&#xA;" OwnerUserId="8365" LastActivityDate="2019-09-07T19:17:33.137" Title="Quantum Simulation Of Tunneling in Small System" Tags="&lt;simulation&gt;&lt;universal-gates&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7201" PostTypeId="1" AcceptedAnswerId="7202" CreationDate="2019-09-07T21:40:54.287" Score="2" ViewCount="69" Body="&lt;p&gt;In the &quot;Superposition&quot; Microsoft quantum katas (&lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/master/Superposition/ReferenceImplementation.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/QuantumKatas/blob/master/Superposition/ReferenceImplementation.qs&lt;/a&gt;) the solution for Task 7 looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// ------------------------------------------------------&#xA;// Task 7. All Bell states&#xA;// Inputs:&#xA;//      1) two qubits in |00⟩ state (stored in an array of length 2)&#xA;//      2) an integer index&#xA;// Goal: create one of the Bell states based on the value of index:&#xA;//       0: |Φ⁺⟩ = (|00⟩ + |11⟩) / sqrt(2)&#xA;//       1: |Φ⁻⟩ = (|00⟩ - |11⟩) / sqrt(2)&#xA;//       2: |Ψ⁺⟩ = (|01⟩ + |10⟩) / sqrt(2)&#xA;//       3: |Ψ⁻⟩ = (|01⟩ - |10⟩) / sqrt(2)&#xA;&#xA;operation AllBellStates_Reference (qs : Qubit[], index : Int) : Unit is Adj {&#xA;H(qs[0]);&#xA;CNOT(qs[0], qs[1]);&#xA;&#xA;// now we have |00⟩ + |11⟩ - modify it based on index arg&#xA;if (index % 2 == 1) {&#xA;    // negative phase&#xA;    Z(qs[1]);&#xA;}&#xA;if (index / 2 == 1) {&#xA;    X(qs[1]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And my alternative solution looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;// Task 7. All Bell states &#xA;// Inputs: &#xA;//      1) two qubits in |00⟩ state (stored in an array of length 2) &#xA;//      2) an integer index &#xA;// Goal: create one of the Bell states based on the value of index: &#xA;//    0: |Φ⁺⟩ = (|00⟩ + |11⟩) / sqrt(2) &#xA;//    1: |Φ⁻⟩ = (|00⟩ - |11⟩) / sqrt(2) &#xA;//    2: |Ψ⁺⟩ = (|01⟩ + |10⟩) / sqrt(2) &#xA;//    3: |Ψ⁻⟩ = (|01⟩ - |10⟩) / sqrt(2)&#xA;&#xA;operation AllBellStates (qs : Qubit[], index : Int) : Unit &#xA;{&#xA;H(qs[0]);&#xA;CNOT(qs[0], qs[1]);&#xA;&#xA;if (index == 0){ &#xA;} elif(index == 1) {&#xA;    Z(qs[0]);&#xA;} elif(index == 2){&#xA;    X(qs[0]);&#xA;} elif(index == 3){&#xA;    X(qs[0]);&#xA;    Z(qs[1]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;}&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Yet BOTH solutions pass the unit tests&lt;/strong&gt;. How is that possible, since the X-gate and Z-gate operators are being applied to the &lt;strong&gt;other&lt;/strong&gt; qubit in the pair?&#xA;Could the unit test logic be incorrect?&lt;/p&gt;&#xA;" OwnerUserId="8440" LastEditorUserId="8440" LastEditDate="2019-09-12T03:16:33.983" LastActivityDate="2019-09-12T03:16:33.983" Title="How do these alternative Q# algorithms produce the same set of Bell states?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7202" PostTypeId="2" ParentId="7201" CreationDate="2019-09-07T22:01:48.863" Score="3" Body="&lt;p&gt;The unit test logic is correct, no worries there! One of the really neat things about the four Bell states is that you can transform between each using single-qubit operations.&#xA;For example, consider the Bell state &lt;span class=&quot;math-container&quot;&gt;$\left|\Phi^{+}\right\rangle = \frac{1}{\sqrt{2}} \left(\left|00\right\rangle + \left|11\right\rangle\right)$&lt;/span&gt;. Flipping the first qubit with an &lt;code&gt;X&lt;/code&gt; instruction transforms the state of your qubits to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} \left(\left|10\right\rangle + \left|01\right\rangle\right)$&lt;/span&gt;, while flipping the second qubit with &lt;code&gt;X(qs[1])&lt;/code&gt; transforms your qubits into the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} \left(\left|01\right\rangle + \left|10\right\rangle\right)$&lt;/span&gt;. Since addition is commutative (that is, &lt;span class=&quot;math-container&quot;&gt;$a + b = b + a$&lt;/span&gt;), these two states are equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, even though &lt;code&gt;X(qs[0])&lt;/code&gt; and &lt;code&gt;X(qs[1])&lt;/code&gt; are very different instructions, they do the same thing in the special case of the Bell state &lt;span class=&quot;math-container&quot;&gt;$\left|\Phi^{+}\right\rangle$&lt;/span&gt;.&#xA;In the same way, &lt;code&gt;Z(qs[0])&lt;/code&gt; and &lt;code&gt;Z(qs[1])&lt;/code&gt; do the same thing to &lt;span class=&quot;math-container&quot;&gt;$\left|\Phi^{+}\right\rangle$&lt;/span&gt;.&#xA;Another way of thinking of why this is is that the quantum programs &lt;code&gt;ApplyToEach(X, qs)&lt;/code&gt; and &lt;code&gt;ApplyToEach(Z, qs)&lt;/code&gt; do &lt;em&gt;nothing&lt;/em&gt; to qubits in the state &lt;span class=&quot;math-container&quot;&gt;$\left|\Phi^{+}\right\rangle$&lt;/span&gt;, similarly to how &lt;code&gt;Z(q)&lt;/code&gt; does nothing when &lt;code&gt;q&lt;/code&gt; is in the state |0⟩.&#xA;If you're interested, there's a beautiful mathematical framework known as the &lt;em&gt;stabilizer formalism&lt;/em&gt; for helping to track these kinds of symmetries of quantum states.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2019-09-07T22:01:48.863" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7203" PostTypeId="1" AcceptedAnswerId="7206" CreationDate="2019-09-09T05:08:01.983" Score="4" ViewCount="158" Body="&lt;p&gt;I am trying to implement the Deutsch oracle in classical computer, using direction from this &lt;a href=&quot;https://www.microsoft.com/en-us/research/video/quantum-computing-computer-scientists/&quot; rel=&quot;nofollow noreferrer&quot;&gt;talk&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is this slide where they show how the CNOT gate modify 2 Hadamard transformed Qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nfZNV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nfZNV.png&quot; alt=&quot;slide showing the math of cnot gate action on 2 hadamard transformed qubits&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I understand the math, I'm having trouble implementing the last part, where the resulting tensor product is factored into 2 qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\frac{1}{2}&#xA;\begin{pmatrix}&#xA;1\\&#xA;-1\\&#xA;1\\&#xA;-1&#xA;\end{pmatrix}&#xA;=&#xA;\begin{pmatrix}&#xA;\frac{1}{\sqrt2}\\&#xA;\frac{1}{\sqrt2}\\&#xA;\end{pmatrix} &#xA;\otimes &#xA;\begin{pmatrix}&#xA;\frac{1}{\sqrt2}\\&#xA;\frac{-1}{\sqrt2}\\&#xA;\end{pmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the talk, they say the control qubit is supposed to stay the same, so it is simple to derive the target qubit. However, in this case, the control qubit is modified, while the target qubit is not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So should I implement this by using 2 different calculation for each case (control/target qubit stay the same)? If so, how do I choose which calculation to use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or is there a better way to do this, using just a single calculation?&lt;/p&gt;&#xA;" OwnerUserId="8463" LastEditorUserId="55" LastEditDate="2019-09-09T13:36:45.550" LastActivityDate="2019-10-02T09:42:18.110" Title="How to factor the output of a CNOT acting on the input $|-,+\rangle$" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7204" PostTypeId="2" ParentId="7203" CreationDate="2019-09-09T06:57:10.917" Score="2" Body="&lt;p&gt;If you have already got, mathematically, to the point of having the vector &lt;span class=&quot;math-container&quot;&gt;$(1,-1,1,-1)/2$&lt;/span&gt;, you don't have to worry about the action of the controlled-not any more. You've already done that! All you have to do is factor the answer. Personally, I usually find the answer quite difficult to see when expressed in this way. Once you've got the answer you can easily verify that it's the right thing, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, I would tend to write out the kets:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|00\rangle-|01\rangle+|10\rangle-|11\rangle)/2.&#xA;$$&lt;/span&gt;&#xA;You can start by grouping the terms on the first qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle(|0\rangle-|1\rangle)+|1\rangle(|0\rangle-|1\rangle),&#xA;$$&lt;/span&gt;&#xA;where we recognise that the second qubit is in the same state in both parts, so this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|0\rangle+|1\rangle)(|0\rangle-|1\rangle)/2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let me come back to the question about the action of the controlled-not, because even if you've already taken care of the maths, the conceptual aspect that you're asking about is hugely important in the context of quantum algorithms. Yes, the controlled-not should always be thought of as &quot;do nothing if the control is 0, and flip the target if the control is 1&quot;, and in that sense, it sounds as if the control should never change. If the control was classical, it would never change. This should make sense because that description we've given is very much based on a classical intuition of what an input is like. But weird stuff can happen when you input a superposition. As you've observed, you get this effect, called 'phase kick-back', where the change ought to happen on the target (from a classical perspective), but actually it changes the control. You still get there by arguing very carefully in the standard way. You don't have to do anything special, and the answer will just come out. It's just that you do actually have to do the maths, and can't just hand-wave.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-09T06:57:10.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7205" PostTypeId="2" ParentId="4104" CreationDate="2019-09-09T12:39:40.943" Score="3" Body="&lt;p&gt;&lt;strong&gt;A Different Way Of Looking At Linear Algebra&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tensor Networks provide a different way of looking at linear algebra particularly within the context of tensor space systems. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum Circuits Are Just Products of Vectors and Operators&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum circuit is inherently a tensor space system as when we have multiple qubits we must think of the whole circuit with all of the qubits in mind, in a tensor product vector space of all the state spaces of the individual qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum circuit can be understood as a product of linear operators on some quantum state and here lies the power of tensor networks. These diagrams provide a visual way of understanding these products which also allows for visual manipulation in a rigorous way allowing one to desgin algorithms in a novel way or look at information problems in a new light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A Visual Way to Understand Linear Algebra Problems&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the power of tensor networks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I invite you to check out this document which really goes through these ideas I am motivating &lt;a href=&quot;https://arxiv.org/pdf/1603.03039.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1603.03039.pdf&lt;/a&gt;, particularly how quantum teleportation can be thought of as a tensor network.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="4373" LastEditDate="2019-09-09T12:45:41.907" LastActivityDate="2019-09-09T12:45:41.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7206" PostTypeId="2" ParentId="7203" CreationDate="2019-09-09T15:54:11.153" Score="2" Body="&lt;p&gt;There are really two different questions here.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;How can you figure out that a given output can be written as tensor product of two vectors?&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is equivalent to asking: &lt;em&gt;how do you figure out whether an output is separable?&lt;/em&gt; For pure states, which is what you are considering, this is rather easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your specific case (two qubits), you might simply notice that if &lt;span class=&quot;math-container&quot;&gt;$\psi=\psi^A\otimes \psi^B$&lt;/span&gt; then there must be some specific relations between its elements. More specifically, in your notation, you should have &lt;span class=&quot;math-container&quot;&gt;$$\psi_2/\psi_1=\psi_4/\psi_3=\psi^B_2/\psi^B_1,\tag A$$&lt;/span&gt;&#xA;assuming &lt;span class=&quot;math-container&quot;&gt;$\psi_1,\psi_3,\psi^B_1\neq0$&lt;/span&gt; (you should be able to work out the special cases with zeros without much difficulty).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this way you get the value of &lt;span class=&quot;math-container&quot;&gt;$\psi^B_2/\psi^B_1$&lt;/span&gt;, which is enough to know the full &lt;span class=&quot;math-container&quot;&gt;$\psi^B$&lt;/span&gt; remembering that it must a normalised vector.&#xA;You can similarly work out the &lt;span class=&quot;math-container&quot;&gt;$\psi^A$&lt;/span&gt; vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If condition (A) is not satisfied, then you know that the output cannot be written as a product state, i.e. does not admit this kind of tensor product decomposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more general technique to check for separability of pure states is to compute the &lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_of_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement entropy&lt;/a&gt;, which is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_entropy&quot; rel=&quot;nofollow noreferrer&quot;&gt;Von Neumann entropy&lt;/a&gt; of the reduced states.&#xA;Given a pure bipartite state &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij}$&lt;/span&gt; (I'm using the notation &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\equiv\sum_{ij}\psi_{ij}|i,j\rangle$&lt;/span&gt; and then identifying &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij}$&lt;/span&gt;), the associated density matrix is &lt;span class=&quot;math-container&quot;&gt;$\rho_{ijk\ell}\equiv\psi_{ij}\bar\psi_{k\ell}$&lt;/span&gt;, and the reduced density matrix is &lt;span class=&quot;math-container&quot;&gt;$\rho_{ik}=\sum_j \rho_{ijkj}$&lt;/span&gt;, which then reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho_{ik}=\sum_j \psi_{ij}\bar \psi_{kj}.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the output being separable, you have &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij}=a_i b_j$&lt;/span&gt; for some (normalised) vectors &lt;span class=&quot;math-container&quot;&gt;$a_i,b_j$&lt;/span&gt;, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho_{ik}=a_i \bar a_k$&lt;/span&gt;, whose entropy is zero. As it turns out, the Von Neumann entropy is zero &lt;em&gt;if and only if&lt;/em&gt; the (pure) state is separable, and therefore this method gives you a definitive answer about the separability.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;Why is the first qubit changed if the CNOT changes only the second one?&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The simple answer is that the statement &quot;&lt;em&gt;with the CNOT the control qubit is supposed to stay the same&lt;/em&gt;&quot; is only true in the computational basis.&#xA;Indeed, as an example, by simply applying local Hadamard operations on the two qubits you can convert a CNOT into a CNOT in which control and target qubits are inverted. How to do this is shown for example in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate#Behaviour_in_the_Hadamard_transformed_basis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-09-09T15:54:11.153" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="7207" PostTypeId="2" ParentId="7194" CreationDate="2019-09-09T16:35:25.533" Score="3" Body="&lt;p&gt;The question is a bit vague (in other equivalent representations of QM applying operators can have nothing to do with linear algebra) so I will answer with respect to the  specific example given of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} | v \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you've chosen to represent your states and operators as vectors in finite-dimensional Hilbert space, then you can describe the corresponding as matrices and vectors in terms of the elements of those matrices, eg:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbf{A} := A_{ij}\\&#xA;|v\rangle := v_i \\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$i,j = 1, \dots, 2^n$&lt;/span&gt; then yes, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} | v \rangle $&lt;/span&gt; will produce a new column vector &lt;span class=&quot;math-container&quot;&gt;$c_j = \sum_i A_{ij} v_i$&lt;/span&gt; and the previous answer said as much. However, there's a more interesting an efficient way to do this! Suppose we know that &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; operates on only a size-k subset of the qubits that &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is defined over and that we redefine how we index our operator and state so that they're &lt;em&gt;tensors&lt;/em&gt; over two-dimensional axes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbf{A} := A_{i_1,i_2,\cdots, i_{2k}}\\&#xA;|v\rangle := v_{i_1,\cdots,i_n} \\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$i_m \in \{0, 1\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2k \leq n$&lt;/span&gt;. This is certainly allowed because &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; each have the same number of elements, just arranged in different ways to make computation easier. In certain cases, this allows us to calculate the action of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; more efficiently. For example if &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; is a permutation matrix, then computing &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} | v \rangle $&lt;/span&gt; is equivalent to shuffling some of the dimensions of &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; and requires &lt;strong&gt;no multiplication at all&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt;. I give a worked example of this kind of operation at the end of this post.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, I'll note that simulations of Clifford circuits (wherein &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} \in \{H, CNOT, S\}$&lt;/span&gt; for example and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is generated by a similar such circuit) uses what is essentially a lookup table to compute &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} | v \rangle$&lt;/span&gt;. This method also uses minimal linear algebra which is what allows simulations of those kinds of circuits to be very efficient.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Worked example&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$X^{(j)}$&lt;/span&gt;, the Pauli-X operator on the j-th qubit. The procedure to compute &lt;span class=&quot;math-container&quot;&gt;$X^{(j)}|v\rangle$&lt;/span&gt; is as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Initialize &lt;span class=&quot;math-container&quot;&gt;$\phi := v_{\cdots i_{j-1} ,0 ,i_{j+1} \cdots}$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$v_{\cdots i_{j-1} ,0, i_{j+1} \cdots} \rightarrow v_{\cdots i_{j-1} ,1 ,i_{j+1} \cdots}$&lt;/span&gt; (&quot;swap&quot; the amplitudes of &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; representing &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_j$&lt;/span&gt; with the amplitudes representing &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_j$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$v_{\cdots i_{j-1} ,1, i_{j+1} \cdots} \rightarrow \phi$&lt;/span&gt; (do another &quot;swap&quot;, but this time use the amplitudes that we saved in step (1) that would have been overwritten otherwise)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; In practice, this process has a lot of memory overhead and requires an exponential number of read/write operations. But often that's still better than doing matrix multiplication which can require polynomial-of-exponential resources to do the same thing.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2019-09-09T19:04:53.340" LastActivityDate="2019-09-09T19:04:53.340" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7208" PostTypeId="1" CreationDate="2019-09-09T18:40:51.597" Score="0" ViewCount="150" Body="&lt;p&gt;My understanding is that any unitary matrix must have its inverse be equal to its conjugate transpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the pauli x gate as shown here: &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0&amp;amp;1\\1&amp;amp;0\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is its own inverse which is equal, of course, to its own conjugate transpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, isn't it also true that neither of these form an identity matrix? &#xA;And isn't this a requirement for being considered unitary? &lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="55" LastEditDate="2021-01-05T11:38:39.287" LastActivityDate="2021-01-05T11:38:39.287" Title="Should a Pauli $X$ matrix equal the identity matrix to be unitary?" Tags="&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;&lt;unitarity&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7209" PostTypeId="2" ParentId="7208" CreationDate="2019-09-09T19:21:51.033" Score="3" Body="&lt;p&gt;No, the matrix, its inverse or its conjugate transpose don't have to equal the identity matrix to be unitary (that would make the class of unitary matrices rather restricted).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of unitary matrix is that its conjugate transpose should equal its inverse, i.e., &lt;span class=&quot;math-container&quot;&gt;$U U^\dagger = U^\dagger U = I$&lt;/span&gt;. You can check that this is indeed the case for the Pauli X matrix.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-09T19:21:51.033" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="7212" PostTypeId="1" AcceptedAnswerId="7213" CreationDate="2019-09-10T15:30:36.803" Score="2" ViewCount="989" Body="&lt;pre&gt;&lt;code&gt;result = execute(circuit, backend=simulator)&#xA;plot_histogram(result.get_counts(circuit))&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used the above code to plot a histogram for a simple entanglement circuit. I got the error mentioned below. I am running the code in google collab.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AttributeError: 'AerJob' object has no attribute 'get_counts'&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2019-09-11T00:16:28.067" Title="AttributeError: 'AerJob' object has no attribute 'get_counts'" Tags="&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7213" PostTypeId="2" ParentId="7212" CreationDate="2019-09-10T15:55:13.337" Score="2" Body="&lt;p&gt;This should fix your problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = execute(circuit, backend=simulator).result()&#xA;plot_histogram(result.get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5157" LastActivityDate="2019-09-10T15:55:13.337" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7214" PostTypeId="2" ParentId="7212" CreationDate="2019-09-10T15:59:18.510" Score="0" Body="&lt;p&gt;I solved this problem by modifying the code to ...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;counts=result.get_counts(circuit)&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I am using a variable counts to store the output, I am able to plot it but unable to execute the code in the question. Entire code goes like this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.tools.visualization import plot_histogram&#xA;circuit.h(qr[0])&#xA;circuit.cx(qr[0], qr[1])&#xA;circuit.measure(qr,cr)&#xA;circuit.draw(output='mpl')&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;result = execute(circuit, backend=simulator)&#xA;counts=result.get_counts(circuit)&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2019-09-10T15:59:18.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7215" PostTypeId="1" AcceptedAnswerId="12753" CreationDate="2019-09-10T16:06:22.087" Score="5" ViewCount="61" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801069&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horodecki, Horodecki and Horodecki (1998), &lt;em&gt;Mixed-state entanglement and distillation: is there a ``bound'' entanglement in nature?&lt;/em&gt;&lt;/a&gt;, the authors remark in the conclusions (beginning of pag. 4, emphasis mine):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So, one is now faced with the problem similar&#xA;  to the initial one, i.e., &lt;strong&gt;&lt;em&gt;are the inseparable states with positive partial transposition nonlocal?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In other words, the question is whether inseparable states which have a positive partial transpose can (or must?) exhibit nonlocal correlations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was an open question in 1998. Has it been answered in the meantime, or were there developments in this direction?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-03-09T18:45:13.367" LastActivityDate="2021-03-09T18:45:13.367" Title="Are inseparable states with positive partial transposition nonlocal?" Tags="&lt;entanglement&gt;&lt;non-locality&gt;&lt;nonclassicality&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7216" PostTypeId="1" AcceptedAnswerId="7220" CreationDate="2019-09-10T16:17:22.290" Score="0" ViewCount="73" Body="&lt;p&gt;I need a way to add scalar values to a quantum string. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say if &#xA;&lt;span class=&quot;math-container&quot;&gt;$| v \rangle = |1 1 0 \rangle + |1 0 1 \rangle$&lt;/span&gt;  then &lt;span class=&quot;math-container&quot;&gt;$|v \rangle + 5 = |1 0 1 1 \rangle + |1 1 0 0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a known method to do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't want tot express 5 as a qubit string in order to save qubits.&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="55" LastEditDate="2020-07-26T18:09:19.833" LastActivityDate="2020-07-26T18:09:19.833" Title="How to add scalar to quantum string" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7217" PostTypeId="2" ParentId="7216" CreationDate="2019-09-10T16:57:57.910" Score="-1" Body="&lt;p&gt;I don't know the answer to this question but I will try to put my thoughts. Why do you want to add a number to a state? A state is unknown untill it is measured. and in your equation the sum of squares of probabilities is 2, how could that be possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A classical 5 means 101 which means presence, absence, presence of electrons(not electron or photon). Another doubt I got is, we use classical gates to add scalars and quantum gates for quantum operations, how can we do both in one equation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;May be unless we measure the state we cannot add 5.&lt;/p&gt;&#xA;" OwnerUserId="8330" LastActivityDate="2019-09-10T16:57:57.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7218" PostTypeId="2" ParentId="7216" CreationDate="2019-09-10T17:30:43.020" Score="1" Body="&lt;p&gt;There are definitely ways to do this; the first one I could find is described in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0008033v1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Thomas Draper (page 6).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-10T17:30:43.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="7219" PostTypeId="1" AcceptedAnswerId="8275" CreationDate="2019-09-10T18:50:43.770" Score="3" ViewCount="164" Body="&lt;p&gt;In a recent &lt;a href=&quot;https://arxiv.org/pdf/1909.02479.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, the authors quote an &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9904023.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;older work&lt;/a&gt; of Bennett, Shor and others and make the following statement&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;While  entanglement assistance can increase achievable rates for classical point-to-point channels in the zero-error and one-shot setting, it comes as a surprise that entanglement does not provide any advantage in the asymptotic setting with vanishing error.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, in the abstract of the Bennett paper which is cited, it says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Prior entanglement between sender and receiver, which exactly doubles the classical capacity of anoiseless quantum channel, can increase the classical capacity of some noisy quantum channels by an arbitrarily large constant factor depending on the channel&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My questions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I thought that the noisy channel coding theorem states that in the asymptotic limit, one has either zero error (if the rate was smaller than the capacity) or arbitrarily large error (if the rate was larger than the capacity). What is the asymptotic limit with vanishingly small error?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Why does the increased classical capacity by a constant factor due to entanglement not change anything in this limit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: While the answer given by Serwyn is an excellent and correct one, I had a misunderstanding in the question. Essentially, Bennett et. al are talking about quantum channels in the second quote whereas the first quote is about classical channels only. &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2019-11-28T21:36:25.760" LastActivityDate="2019-11-28T21:36:25.760" Title="Why does entanglement not increase the classical capacity of a channel?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;communication&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7220" PostTypeId="2" ParentId="7216" CreationDate="2019-09-10T20:11:52.897" Score="2" Body="&lt;p&gt;Generally you have to perform the addition modulo some constant; you can't grab another qubit if you need to overflow. Code for modular addition of a constant is available in the &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/master/Standard/src/Arithmetic/Increment.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;Increment.qs&lt;/a&gt; file in the Q# standard library, in the &lt;code&gt;IncrementByInteger&lt;/code&gt; operation. Check out the documentation &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.arithmetic.incrementbyinteger?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4265" LastActivityDate="2019-09-10T20:11:52.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="7221" PostTypeId="2" ParentId="7212" CreationDate="2019-09-11T00:16:28.067" Score="1" Body="&lt;p&gt;Execute returns a job instance. The job has a result, job.result(), and you get counts from the results, ie job.result().get_counts()&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-09-11T00:16:28.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8221" PostTypeId="1" CreationDate="2019-09-11T03:15:59.333" Score="4" ViewCount="3023" Body="&lt;p&gt;What is the difference between these frameworks or languages? What are the pros and cons of each of these? Do you know any similar framework/platform/language that gives some more advantages?&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="55" LastEditDate="2020-11-03T17:16:41.420" LastActivityDate="2020-11-03T17:16:41.420" Title="Overview of Cirq, qiskit, q#, ibmq(circuit board), other" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;q#&gt;&lt;cirq&gt;" AnswerCount="3" CommentCount="1" ClosedDate="2019-09-19T21:01:43.603" ContentLicense="CC BY-SA 4.0" />
  <row Id="8222" PostTypeId="2" ParentId="8221" CreationDate="2019-09-11T07:37:26.893" Score="1" Body="&lt;p&gt;In my opinion, at the moment, qiskit is the most suitable one for learning and teaching.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a basic introductory material (we have used it in 14 two-day or three-day workshops), I recommend the following repo: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://gitlab.com/qkitchen/basics-of-quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gitlab.com/qkitchen/basics-of-quantum-computing&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the link to workshops: &lt;a href=&quot;https://qsoftware.lu.lv/index.php/workshops/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qsoftware.lu.lv/index.php/workshops/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5208" LastEditorUserId="5208" LastEditDate="2019-09-11T08:03:14.763" LastActivityDate="2019-09-11T08:03:14.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8223" PostTypeId="2" ParentId="7219" CreationDate="2019-09-11T07:45:34.110" Score="2" Body="&lt;p&gt;I will try to succinctly answer your first question given that I possess little knowledge regarding entanglement assistance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shannon's capacity theorem (the noisy channel coding theorem) states that for any code &lt;span class=&quot;math-container&quot;&gt;$\mathbf{C}$&lt;/span&gt; of code rate &lt;span class=&quot;math-container&quot;&gt;$R \leq C$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; represents the channel capacity, an encoding and decoding scheme of rate &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; with a probability of error &lt;span class=&quot;math-container&quot;&gt;$P_e &amp;lt; \epsilon$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;, will exist. This probability of error will be vanishingly small only if the block length of the code is sufficiently large, i.e &lt;span class=&quot;math-container&quot;&gt;${n\rightarrow\infty}$&lt;/span&gt; leads to &lt;span class=&quot;math-container&quot;&gt;$\epsilon\rightarrow0$&lt;/span&gt;. Analogously, if &lt;span class=&quot;math-container&quot;&gt;$R&amp;gt;C$&lt;/span&gt; then the error probability goes to &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt; as the block length of the code increases, i.e &lt;span class=&quot;math-container&quot;&gt;$$\lim_{n\to\infty}P_e = \frac{1}{2}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the asymptotic limit that defines when communications over a channel occur with an error probability &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;lt; 0$&lt;/span&gt; is the channel capacity. The condition of having a vanishingly small error probability will be determined by the block length of the code (for a null error probability you would need an infinite block length).&lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2019-09-11T07:45:34.110" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8224" PostTypeId="1" AcceptedAnswerId="8225" CreationDate="2019-09-11T08:51:18.337" Score="4" ViewCount="117" Body="&lt;p&gt;I'm working through Quantum Computing for Computer Scientists (Yanofsky &amp;amp; Mannucci, 2008), and am getting a little confused about &lt;strong&gt;Observables&lt;/strong&gt;. From what I understand an observable is a question represented by a hermitian matrix. But that's as far as it goes. When we &lt;strong&gt;use&lt;/strong&gt; an observable to make a &lt;strong&gt;measurement&lt;/strong&gt; we obtain a real result, which can change the state space &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. There is mention in the book that &quot;after an observation&quot; (presumably after a measurement is taken) then the result should be an eigenvalue, and the state of the system should collapse into the state which is the eigenvector corresponding to that eigenvalue.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Then, in example 4.3.1 on p.126 the authors use the observable&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\Omega=\begin{bmatrix}-1&amp;amp;-i\\i&amp;amp;1\end{bmatrix},$$&lt;/span&gt;&#xA;  which they state has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_1=-\sqrt{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2=\sqrt{2}$&lt;/span&gt;, with corresponding eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle=[-0.923i,-0.382]^T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle=[-0.382,0.923i]^T$&lt;/span&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;It goes on to say &quot;now, let us suppose that afer an observation of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=\frac{1}{2}[1,1]^T$&lt;/span&gt;, the actual value observed is &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt;. The system has &quot;collapsed&quot; from &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm finding it difficult to understand this. Do the authors mean to perform a measurement, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Omega|\Psi\rangle=\begin{bmatrix}-1&amp;amp;-i\\i&amp;amp;1\end{bmatrix}\frac{1}{2}\begin{bmatrix}1\\1\end{bmatrix}=&#xA;\begin{bmatrix}&#xA; -\frac{i}{2}-\frac{1}{2} \\&#xA; \frac{i}{2}+\frac{1}{2} \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then how have we observed &lt;span class=&quot;math-container&quot;&gt;$\lambda_1=\sqrt{2}$&lt;/span&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I've got the wrong end of the stick because the authors say &quot;now, let us &lt;strong&gt;suppose&lt;/strong&gt; that after an observation...,&quot; so maybe there is no calculation to be made, but it's very confusing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody help me understand this?&lt;/p&gt;&#xA;" OwnerUserId="8328" LastEditorUserId="26" LastEditDate="2019-09-30T03:45:17.640" LastActivityDate="2019-09-30T03:45:17.640" Title="Help in understanding an exercise on observable / measurement" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8225" PostTypeId="2" ParentId="8224" CreationDate="2019-09-11T09:53:46.190" Score="5" Body="&lt;p&gt;When you give an observable, such as &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;, that is used to define the measurement basis. It is not something that you would usually use to directly perform calculations (you can, and for &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices, we often do, as I'll detail below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, you want to take your observable, &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;, and find the eigenvalues and eigenvectors. More specifically, you want projectors onto the different eigenspaces (this distinction is important if your matrix has degeneracy). So, we take&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_1=|e_1\rangle\langle e_1|,\qquad P_2=|e_2\rangle\langle e_2|.&#xA;$$&lt;/span&gt;&#xA;In a sense, the eigenvalues are irrelevant, and hence so is &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;. Our outcome is a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Phi_i\rangle=P_i|\Psi\rangle,&#xA;$$&lt;/span&gt;&#xA;up to normalisation (for rank 1 projectors, as here, the renormalised version is just &lt;span class=&quot;math-container&quot;&gt;$|e_i\rangle$&lt;/span&gt;), and the probability of getting outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\langle\Phi_i|\Phi_i\rangle$&lt;/span&gt;. Note that you have to explicitly describe the branching outcomes (here, two different possibilities, with different probabilities). One simple calculation such as a matrix multiplication can't give you that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it turns out that you &lt;em&gt;can&lt;/em&gt; use the matrix &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; directly if you want. This is because, by completeness,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_iP_i=I,&#xA;$$&lt;/span&gt;&#xA;and we know that &lt;span class=&quot;math-container&quot;&gt;$\Omega=\sqrt{2}(-P_1+P_2)$&lt;/span&gt;. Hence, we can rearrange for &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_1=\frac{1}{2}(I-\Omega/\sqrt{2}),&#xA;$$&lt;/span&gt;&#xA;and we can perform the same calculation as previously without having directly calculated the eigenvectors first. There's always a trick like this for &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices. For &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrices, you'd probably have to describe each of your projectors as a polynomial in &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; up to a power &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt;, which is why we don't usually do this for anything other than &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices - it just gets more messy.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-11T09:53:46.190" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8226" PostTypeId="2" ParentId="8221" CreationDate="2019-09-11T11:40:02.937" Score="3" Body="&lt;p&gt;I would suggest to start with &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; as it offers a drag-and-drop circuit model. Furthermore, Quirk offers some subroutines such as basic arithmetic operation (on integers) and allows to easily define new subroutines. (All drag an drop!) It can simulate up to 17 (?) qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you want to go beyond an &quot;easy&quot; circuit representation I suggest &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsofts Q#&lt;/a&gt;. It features everything from a (complete) quantum simulation (up to about 30 qubits), to stabilizer circuits or a Toffoli-simulators with 1000s of (qu)bits.&#xA;In my opinion the documentation is a little messy, but you get great support from the developers in case you have any questions. Q# also offers libraries for arithmetic operation (integers and (!) floating-point numbers). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, as @Abuzer mentioned, &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; is a good starting point to. It offers a circuit representation as well as a code representation. I am not aware of any arithmetic libraries, but the there exist community implementations on Github. Actually, I believe Qiskit has the biggest &quot;community&quot;, so you ll likely find help on the web if you run into troubles. Qiskit also offers different simulators to perform a complete quantum simulation or just subset-models.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to have a very rough overview over some (personal) pros/cons of simulations, you can read here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6959/reversible-circuit-simulation-for-classical-tests-of-quantum-subroutines&quot;&gt;Disclaimer: I asked this question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7824" LastActivityDate="2019-09-11T11:40:02.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8227" PostTypeId="1" AcceptedAnswerId="8228" CreationDate="2019-09-11T13:35:27.263" Score="3" ViewCount="259" Body="&lt;p&gt;There's an exercise in Nielsen &amp;amp; Chuang asking us to show that if some third party intercepts Alice's qubit she's sending to Bob while attempting to transmit (2 bits of) classical information, then this third party can't actually infer anything about the information she's trying to communicate. Effectively, this comes down to showing that &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|E_A \otimes I_B|\psi\rangle$&lt;/span&gt; is the same whenever &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is any of the Bell states and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is a positive operator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is simple to show, but I wonder if this is an incomplete concept, since it supposedly requires &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; to be a positive operator. If we just check one of them:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle\Phi^+|E \otimes I|\Phi^+\rangle = \langle 00 + 11|E \otimes I|00 + 11 \rangle = \langle 0|E|0 \rangle\langle 0|0 \rangle + \langle 0|E|1 \rangle\langle 0|1 \rangle + \langle 1|E|0 \rangle\langle 1|0 \rangle + \langle 1|E|1 \rangle\langle 1|1 \rangle = \langle 0|E|0 \rangle + \langle 1|E|1 \rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the same for each Bell state. Couldn't &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; just be Hermitian and we would obtain the same result?&lt;/p&gt;&#xA;" OwnerUserId="7816" LastEditorUserId="55" LastEditDate="2019-09-11T14:15:20.407" LastActivityDate="2019-09-11T14:23:33.937" Title="Eavesdropping in superdense coding: why can't the third party infer anything about the message?" Tags="&lt;communication&gt;&lt;superdense-coding&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8228" PostTypeId="2" ParentId="8227" CreationDate="2019-09-11T13:46:16.453" Score="4" Body="&lt;p&gt;Mathematically, this has nothing to do with the positivity of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. It doesn't really have anything to do with &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; at all - it's a property of the Bell states themselves (you've probably not got there yet, but they have the same reduced density matrices). I presume the reason for specifying the positivity of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; in the question is to help you make the connection with the allowed operators that an eavesdropper could perform, such as measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Incidentally, don't forget about normalisation factors. There's probably a factor of 1/2 missing from your final answer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-11T13:46:16.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8229" PostTypeId="2" ParentId="8227" CreationDate="2019-09-11T14:23:33.937" Score="3" Body="&lt;p&gt;This happens for any maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; and operator &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, a maximally entangled state is, by definition, one whose partial trace is the maximally mixed one. Writing &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle\equiv\sum_{ij}\psi_{ij}|ij\rangle$&lt;/span&gt;, this means that &lt;span class=&quot;math-container&quot;&gt;$\sum_i \psi_{ij}\bar\psi_{kj}=\delta_{ik}/D$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; the dimension of each space (&lt;span class=&quot;math-container&quot;&gt;$D=2$&lt;/span&gt; in your case).&#xA;Thus you have (assume repeated indices are summed):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle\Psi|E\otimes I|\Psi\rangle=\bar \psi_{ij} E_{ik} \psi_{kj}=\frac{1}{D}\delta_{ik}E_{ik}=\frac{1}{D}\mathrm{Tr}(E).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-09-11T14:23:33.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8230" PostTypeId="2" ParentId="7140" CreationDate="2019-09-11T18:10:20.210" Score="1" Body="&lt;p&gt;Given your clarification in your comments (you might want to update your question to add these assumptions), I believe it is a valid entangled state of &lt;span class=&quot;math-container&quot;&gt;$2m$&lt;/span&gt; qubits. If you are measuring the second set of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits &lt;span class=&quot;math-container&quot;&gt;$|j\rangle_t$&lt;/span&gt; in the computational basis, you will get the measurement result of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (for &lt;span class=&quot;math-container&quot;&gt;$k \in \{0,\ldots,N-1\}$&lt;/span&gt;) with probability &lt;span class=&quot;math-container&quot;&gt;$$|\frac{1}{\sqrt{N}} e^{2\pi i \frac{x_1}{N} k}|^2=\frac{1}{N} e^{2\pi i \frac{x_1}{N} k} e^{-2\pi i \frac{x_1}{N} k} =\frac{1}{N},$$&lt;/span&gt; and the first &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits &lt;span class=&quot;math-container&quot;&gt;$|j\rangle_h$&lt;/span&gt; also in state &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt;, which gives &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; upon measurement.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-09-11T18:10:20.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8231" PostTypeId="1" CreationDate="2019-09-11T21:23:06.540" Score="4" ViewCount="79" Body="&lt;p&gt;Given a product state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AC} = \rho_A\otimes \rho_C$&lt;/span&gt;, what can we say about the structure of states &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABC}$&lt;/span&gt; that are extensions of &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}\otimes \rho_C$&lt;/span&gt;? By extension I mean that &lt;span class=&quot;math-container&quot;&gt;$\text{tr}_B\rho_{ABC} = \rho_A \otimes \rho_C$&lt;/span&gt;, and I am not assuming that &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABC}$&lt;/span&gt; is pure. Ideally, I would know the most general form any such extension can take on. Less ambitiously, I'd like to know any general properties such extension states must have. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The closest related work to this question which I have found concerns the structure of states satisfying &lt;span class=&quot;math-container&quot;&gt;$I(A:C|B)=0$&lt;/span&gt;. Work by Hayden, Jozsa, Petz and Winter (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0304007&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0304007&lt;/a&gt;) shows that whenever &lt;span class=&quot;math-container&quot;&gt;$I(A:C|B)=0$&lt;/span&gt;, there's a way to split up the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B = \oplus_i \mathcal{H}_{b_L^i}\otimes \mathcal{H}_{b_R^i}$&lt;/span&gt; such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{ABC} = \sum_i q_i \rho_{Ab_L^i}\otimes \rho_{b_R^iC}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which in particular gives that &lt;span class=&quot;math-container&quot;&gt;$\rho_{AC}$&lt;/span&gt; is separable. They also obtain as a corollary that &lt;span class=&quot;math-container&quot;&gt;$\rho_{AC}$&lt;/span&gt; separable implies the existence of an extension such that &lt;span class=&quot;math-container&quot;&gt;$I(A:C|B)=0$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is not addressed directly by the Hayden et al. result however as I am interested 1) in product states specifically, and 2) I'd like to know what general form the extensions are constrained to given that AC is product, rather than about the existence of an extension with a certain property. &lt;/p&gt;&#xA;" OwnerUserId="8468" LastEditorUserId="26" LastEditDate="2019-09-29T15:32:34.943" LastActivityDate="2019-09-29T15:32:34.943" Title="Extensions of product states" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8232" PostTypeId="1" CreationDate="2019-09-11T21:56:24.707" Score="2" ViewCount="41" Body="&lt;p&gt;I remember reading a paper that described how a quantum circuit on a large amount of qubits can be simulated by doing many runs on a smaller quantum computer. They used techniques from tensor networks. I believe it was published in PRL somewhere after 2018, but I haven't been able to find it again.&#xA;It is not this paper: &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.121.250501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Computational Speedups Using Small Quantum Devices (Dunjko &lt;em&gt;et al.&lt;/em&gt;, 2018)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know which paper I'm talking about it, or have I simply dreamt up the existence of this paper?&lt;/p&gt;&#xA;" OwnerUserId="5998" LastEditorUserId="26" LastEditDate="2019-09-29T10:24:21.990" LastActivityDate="2019-09-29T10:24:21.990" Title="Paper concerning distributing quantum computation on many small quantum computers" Tags="&lt;resource-request&gt;&lt;tensor-networks&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8233" PostTypeId="2" ParentId="1542" CreationDate="2019-09-11T21:59:51.753" Score="3" Body="&lt;p&gt;Here is a way to think about the role of entanglement in quantum codes which I think is complementary to Felix Hubers response. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that we take a maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle_{RQ}$&lt;/span&gt; and record the &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; system into some quantum error-correcting code. Suppose the code records &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; into subsystems &lt;span class=&quot;math-container&quot;&gt;$S_1,S_2,S_3$&lt;/span&gt; such that erasure of any one subsystem can be corrected for (I've taken a simple example, but generalizations are possible). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, there is an entropic way of thinking about the error correction conditions (as compared to the more algebraic Knill-Laflamme conditions). Specifically, if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(R:S_3) = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it follows that &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; can be recovered from &lt;span class=&quot;math-container&quot;&gt;$S_1S_2$&lt;/span&gt;. See for example &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0112106&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0112106&lt;/a&gt; for a nice presentation of this fact. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this entropic approach to error correction there are fairly direct routes to understanding entanglement in codes. For instance, we can prove that, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(S_1S_2:S_3) \geq 2\log d_R$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as follows. First we write out this mutual information in terms of its definition,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(S_1S_2:S_3) = S(S_1S_2) + S(S_3) - S(S_1S_2S_3)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We'll introduce a purifying system &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, so that the state on &lt;span class=&quot;math-container&quot;&gt;$RS_1S_2S_3X$&lt;/span&gt; is pure. Then using purity we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(S_1S_2:S_3) = S(S_3XR) + S(S_3) - S(XR)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that since we can recover &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$S_1S_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I(R:S_3X)=I(R:X)=0$&lt;/span&gt;. Using this in the above&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(S_1S_2:S_3) = S(S_3|X) + S(S_3)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we can bound the right hand side here below by &lt;span class=&quot;math-container&quot;&gt;$2 \log d_R$&lt;/span&gt;. The intuition behind how we can do this is that &lt;span class=&quot;math-container&quot;&gt;$S_3$&lt;/span&gt; is ``significant'' in the sense that there is a set of shares (say &lt;span class=&quot;math-container&quot;&gt;$S_1$&lt;/span&gt;) which itself reveals no information about &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, but together with &lt;span class=&quot;math-container&quot;&gt;$S_3$&lt;/span&gt; allows &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; to be recovered. Given this, we expect &lt;span class=&quot;math-container&quot;&gt;$S_3$&lt;/span&gt; must carry &lt;span class=&quot;math-container&quot;&gt;$2\log d_R$&lt;/span&gt; of entropy, since transferring it can be used to establish &lt;span class=&quot;math-container&quot;&gt;$2\log d_R$&lt;/span&gt; worth of entanglement. A similar intuition appears in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0608223&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0608223&lt;/a&gt;. More precisely we consider the quantity &lt;span class=&quot;math-container&quot;&gt;$I(R:S_1S_3) - I(R:S_1)$&lt;/span&gt;, which some basic manipulations reveal&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(R:S_1S_3) - I(R:S_1) = S(S_3|S_1) + S(S_3|XS_2) \leq S(S_3) + S(S_3|X)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then we notice &lt;span class=&quot;math-container&quot;&gt;$I(R:S_1S_3) \geq 2\log d_R$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$S_1S_3$&lt;/span&gt; allows recovery of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, while &lt;span class=&quot;math-container&quot;&gt;$I(R:S_1)=0$&lt;/span&gt; by the entropic error correction condition. This lower bounds &lt;span class=&quot;math-container&quot;&gt;$S(S_3) + S(S_3|X)$&lt;/span&gt; and so lower bounds &lt;span class=&quot;math-container&quot;&gt;$I(S_1S_2:S_3)$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="8468" LastEditorUserId="26" LastEditDate="2019-09-29T15:33:34.030" LastActivityDate="2019-09-29T15:33:34.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8234" PostTypeId="2" ParentId="8221" CreationDate="2019-09-12T04:39:25.433" Score="3" Body="&lt;p&gt;I am definitely biased (writing &lt;a href=&quot;https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp?a_aid=learn-qc-kaiser&amp;amp;a_bid=ee23f338&quot; rel=&quot;nofollow noreferrer&quot;&gt;a book on quantum computing with Python and Q#&lt;/a&gt;), but I am a Pythonista and love using Q#. The design of the language is good for long term quantum computing development; it allows you to think more at the algorithmic level, not at the assembly level as many other quantum programming languages are targeting. It has a Jupyter kernel so I can use it like I do most of my Python development, is open source, great editor integration, and has some great libraries that mean you don't have to re-implement things over and over again. It also is inter-operable with Python so I can call into it from my regular Python code. For resources, check out the book in early access (if you want a discount code, hit me up on &lt;a href=&quot;https://twitter.com/crazy4pi314&quot; rel=&quot;nofollow noreferrer&quot;&gt;twitter&lt;/a&gt;), try &lt;a href=&quot;https://qsharp.community/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qsharp.community&lt;/a&gt;, the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas&quot; rel=&quot;nofollow noreferrer&quot;&gt;katas&lt;/a&gt;, or the &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;! And as with any open source project, get involved! Making pull requests and file issues are some of the fastest ways I find to learn a new language or package :)&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2019-09-12T04:39:25.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8235" PostTypeId="1" CreationDate="2019-09-12T04:49:36.607" Score="2" ViewCount="1104" Body="&lt;p&gt;Inner product: how similar the vectors are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Outer product: ???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For inner product I can find this explanation.&#xA;&quot;The inner product of two vectors therefore yields just a number. As we'll see, we can interpret this as a measure of how similar the vectors are.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other usage on inner product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, what about outer product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why use outer product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only thing I can find &quot;we can write any matrix purely in terms of outer products&quot;&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="26" LastEditDate="2019-09-29T09:03:55.023" LastActivityDate="2019-10-29T08:03:45.723" Title="Why use inner and outer product?" Tags="&lt;mathematics&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8236" PostTypeId="1" CreationDate="2019-09-12T06:12:22.843" Score="3" ViewCount="306" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I previously asked &lt;a href=&quot;https://physics.stackexchange.com/questions/501145/validity-of-the-derivation-of-time-energy-uncertainty-principle/501166#501166&quot;&gt;this question&lt;/a&gt;, in which I'm trying to better understand &lt;a href=&quot;https://physics.stackexchange.com/a/53804/58382&quot;&gt;this joshphysics's derivation&lt;/a&gt; of an interpretation of the time-energy uncertainty principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the gist of what I get is (from the answers and the chatroom) within &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;nofollow noreferrer&quot;&gt;interpretations of quantum mechanics&lt;/a&gt; which say the measurement is &lt;a href=&quot;https://physics.stackexchange.com/questions/156533/why-isnt-transformation-caused-by-measurement-unitary&quot;&gt;non-unitary&lt;/a&gt; one can definitely make the case that the derivation cannot be applied to all situations (in fact I feel the application is quite limiting).   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it seems intuitive to me (after chatroom discussion) with a quasi-classical measuring apparatus and the Copenhagen interpretation enables one to circumvent my objection? (And also enables one to apply it to cases involving a measurement - see related/objection).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The below is a labyrinth of positions one can take on this argument. And I feel there are &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; ways out (way &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; or way &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;)of this maze. I'm asking for which way is better? (See Questions for what I mean by &quot;better&quot;)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Math and Context&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The proof (I questioned)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's begin with Joshphysics's answer:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let a quantum system with Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be given.  Suppose the system occupies a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle$&lt;/span&gt; determined by the Hamiltonian evolution.  For any observable &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; we use the shorthand&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \langle \Omega \rangle = \langle \psi(t)|\Omega|\psi(t)\rangle.  &#xA;$$&lt;/span&gt;&#xA;  One can show that (see eq. 3.72 in Griffiths QM)&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \sigma_H\sigma_\Omega\geq\frac{\hbar}{2}\left|\frac{d\langle \Omega\rangle}{dt}\right|&#xA;$$&lt;/span&gt;&#xA;  where &lt;span class=&quot;math-container&quot;&gt;$\sigma_H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_\Omega$&lt;/span&gt; are standard deviations&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \sigma_H^2 = \langle H^2\rangle-\langle H\rangle^2, \qquad \sigma_\Omega^2 = \langle \Omega^2\rangle-\langle \Omega\rangle^2&#xA;$$&lt;/span&gt;&#xA;  and angled brackets mean expectation in &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle$&lt;/span&gt;.  It follows that if we define&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \Delta E = \sigma_H, \qquad \Delta t = \frac{\sigma_\Omega}{|d\langle\Omega\rangle/dt|}&#xA;$$&lt;/span&gt;&#xA;  then we obtain the desired uncertainty relation&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \Delta E \Delta t \geq \frac{\hbar}{2}&#xA;$$&lt;/span&gt;&#xA;  It remains to interpret the quantity &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt;.  It tells you the approximate amount of time it takes for the expectation value of an observable to change by a standard deviation provided the system is in a pure state.  To see this, note that if &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt; is small, then in a time &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt; we have&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;  |\Delta\langle\Omega\rangle| =\left|\int_t^{t+\Delta t} \frac{d\langle \Omega\rangle}{dt}\,dt\right| \approx \left|\frac{d\langle \Omega\rangle}{dt}\Delta t\right| = \left|\frac{d\langle \Omega\rangle}{dt}\right|\Delta t = \sigma_\Omega&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Before I go on about my objection. Let me let you know it's basic premise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Basic premise&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The measurement is cannot be modelled as a unitary transformation.&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ |a \rangle + |b \rangle \to |a \rangle $$&lt;/span&gt;&#xA;  Cannot be done by a unitary transformation and I thought I was vindicated &#xA;  in this &lt;a href=&quot;https://physics.stackexchange.com/questions/156533/why-arent-transformations-caused-by-measurements-unitary&quot;&gt;post&lt;/a&gt;. Which is why the common referral of the measurement as  &quot;non-unitary&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The Objection&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;joshphysics's answer makes use of &lt;a href=&quot;https://en.wikipedia.org/wiki/Heisenberg_picture#Equivalence_of_Heisenberg&amp;#39;s_equation_to_the_Schr%C3%B6dinger_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heisenberg's equation of motion&lt;/a&gt;&#xA;  which rely on &lt;strong&gt;unitarity&lt;/strong&gt;. I am not aware of a derivation of&#xA;  Heisenberg's equation of motion which is applicable during a&#xA;  non-unitary process (for example the measurement). &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;See the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;'nd equation in his derivation. This clearly relies on&#xA;  &quot;Heisenberg's equation.&quot; Further the whole notion of getting a &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt; is only dimensionally true and not true even as an approximate (if this objection holds).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;One way out: is your calling something velocity which has the same&#xA;  dimensions of velocity but is not the time derivative of position. But&#xA;  that is fundamentally wrong! (and abused in that case).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Another way out: is to claim that there is a kind of continuity&#xA;  argument but I was under the impression the measurement is a&#xA;  discontinuous process. So this one will fail.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The third way out: is to limit the physical scope of the applicability&#xA;  of the this derivation. For example, one cannot use this derivation to&#xA;  say the time between &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; subsequent measurements cannot be taken to&#xA;  &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Perhaps it can (pushing it's limitations) tell you some kind of&#xA;  energy cost involved between &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; subsequent measurements. But that&#xA;  would be at the price of presupposing &quot;the time between &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; subsequent&#xA;  measurements cannot be taken to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;&quot; as one would have assume that&#xA;  between 2 measurements unitarity must reign and the time interval cannot be taken to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So far so good?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I was on board with the third way out. In fact, any interpretation of&#xA;  quantum mechanics which uses the language &quot;collapse of the wave&#xA;  function.&quot; I am under the impression will be sympathetic to my&#xA;  misunderstanding to say the least. Taken from &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt;,&#xA;         The existence of the wave function collapse is required in&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;the Copenhagen interpretation&lt;/li&gt;&#xA;  &lt;li&gt;the objective collapse interpretations&lt;/li&gt;&#xA;  &lt;li&gt;the transactional interpretation&lt;/li&gt;&#xA;  &lt;li&gt;the von Neumann interpretation in which consciousness causes&#xA;  collapse.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The fourth way out (?)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now, another user in the chat is of the opinion my objection is&#xA;  non-sensical (at least thats the impression I get) and upon conversing&#xA;  it seems he has a fourth way to bypass my objection!&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The fourth way: In this fourth way one stops the basic premise of&#xA;  my objection which is the measurement being a non-unitary process! In&#xA;  fact this is convincingly done with:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&quot;A measurement is an interaction between a measuring apparatus which&#xA;  is (quasi-)classical and a quantum system You can model this, it's in&#xA;  Landau's QM section 7, I don't want to quote the whole thing, but this&#xA;  wave function collapsing business is pretty straightforward there&#xA;  without all the woo&quot;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In fact, he claims to be a Copenhagen-ist but doesn't like the words&#xA;  &quot;collapse of the wave-function.&quot; &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The fourth way out does manage to circumvent (if not completely&#xA;  destroy) my objection and also enables one to use this derivation in&#xA;  far more many many situations I previously see as unfathomable for&#xA;  example: the time between &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; measurements cannot be taken to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In fact, I'm under the opinion the number of physical experiments the &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;'rd way out&#xA;  enables you to do are under &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; (?). But the &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;'th way is clearly&#xA;  superior in this metric (?). A better question might be where does it not apply?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More about way &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For those who are shocked that Landau was on board with way &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; and (fairly) demanding evidence before investing time for an entire section &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; of Landau's QM. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;See page 6 of the file (page &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; of .pdf) of &lt;a href=&quot;http://www.johnboccio.com/research/quantum/notes/bell.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; where he argues why one should take way-out &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;’...It is in principle impossible ... to formulate the basic concepts&#xA;  of quantum mechanics without using classical mechanics.’ (LL2)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;’...The possibility of a quantitative description of the motion of an&#xA;  electron requires the presence also of physical objects which obey&#xA;  classical mechanics to a sufficient degree of accuracy.’ (LL2)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;’...the ’classical object’ is usually called apparatus and its&#xA;  interaction with the electron is spoken of as measurement. However, it&#xA;  must be emphasized that we are here not discussing a process ... in&#xA;  which the physicist-observer takes part. By measurement, in quantum&#xA;  mechanics, we understand any process of interaction between classical&#xA;  and quantum objects, occurring apart from and independently of any&#xA;  observer. The importance of the concept of measurement in quantum&#xA;  mechanics was elucidated by N Bohr.’ (LL2)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The quotes go on ... The above is only the beginning (In fact the .pdf is a condensed version  of &quot;pure gold&quot;)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At some risk (I'm not sure if the person who exposed me to way &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;&#xA;  would agree this paper does justice to their arguments):&#xA;  &lt;a href=&quot;https://arxiv.org/abs/1406.5178&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1406.5178&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;To be fair a different version of way &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; has been asked on this site:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/144325/unitarity-and-measurement?rq=1&quot;&gt;https://physics.stackexchange.com/questions/144325/unitarity-and-measurement?rq=1&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Where the answer-er response ends with:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&quot;Why not let the final state be in a superposition also, as quantum&#xA;  mechanics requires? The alive cat is not aware of the dead cat,&#xA;  because the Schrödinger equation is linear.&quot;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;For a non-absurd association of the same words above:&#xA;  &lt;a href=&quot;https://www.youtube.com/watch?v=gNAw-xXCcM8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=gNAw-xXCcM8&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;(In light of this let me just say my question is not about the&#xA;  plausibility of the Unitary of the measurement but it's about if&#xA;  assumed can one assume this and push the number of physical situations&#xA;  this derivation is applicable to?)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is a unitary measurement compatible with broadening the usage of the time-energy uncertainity principle&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Also Landau states: &quot;From section &lt;span class=&quot;math-container&quot;&gt;$44$&lt;/span&gt; of Landau, the &lt;span class=&quot;math-container&quot;&gt;$\Delta E$&lt;/span&gt; in&#xA;  the time-uncertainty relation is the difference &quot;between two exactly&#xA;  measured values of the energy &lt;span class=&quot;math-container&quot;&gt;$E +\varepsilon$&lt;/span&gt; at two different&#xA;  instants, and not the uncertainty in the value of the energy at a&#xA;  given instant&quot; (for a system of two parts with energies &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and&#xA;  measuring apparatus energy &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;)&quot;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;I added this part so it didn't seem like I was skipping any logic. I'm&#xA;  sure Landau would have only said that if he felt his book justified&#xA;  the case.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Is this &quot;fourth way&quot; plausible? Can someone tell me an explicit case where if I assume this circumvention is indeed true what are the physical cases the this &quot;quasi-classical measuring apparatus and the Copenhagen interpretation&quot; seem to work for that the original objection stops (way &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;)? (I do mention one but am under-confident if it is right)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S: I feel this post &lt;strong&gt;was&lt;/strong&gt; self-contained but to do justice to way &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; I had to link it off.  Please do not hesitate to contact me if you feel this question can be improved? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/502221/does-the-copenhagen-interpretation-quasi-classical-apparatus-allow-one-to&quot;&gt;Cross-posted on PSE.SE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2019-11-07T11:11:25.897" LastActivityDate="2019-11-07T11:11:25.897" Title="Does the Copenhagen interpretation (+ &quot;quasi-classical measuring apparatus&quot;) allow one to bypass a derivation's objection?" Tags="&lt;measurement&gt;&lt;interpretations&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8237" PostTypeId="2" ParentId="8235" CreationDate="2019-09-12T06:48:23.200" Score="2" Body="&lt;p&gt;This sort of &quot;why?&quot; is a deeply personal matter that depends on what you're willing to accept as a starting point. Ultimately, you might try to push it back to &quot;why is the world the way it is? &quot; for which I don't think there's a satisfactory answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not pushing it quite so far, I choose to start from the theory of Quantum Mechanics itself (so this says nothing about the real world, it just happens that the theory is an incredibly good fit for what we see in the world around us).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The theory of Quantum Mechanics is based upon a set of assumptions/postulates. There is no real &quot;why?&quot; behind these, we just accept them as fact and derive the consequences. I would state the first of these as:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Quantum states are described by unit vectors in a Hilbert space.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Right there, built in, is a Hilbert space, the key property being that it has an inner product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next two are, loosely,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;The probability amplitude for two independent events both happening is equal to the product of the probability amplitudes for those two events.&lt;/li&gt;&#xA;  &lt;li&gt;The probability amplitude either of two (apparently) mutually exclusive events happening is the sum of their probability amplitudes.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Put together, this essentially describes that transformation from one state to another using matrix multiplication (and combined with the first postulate imposes that it's a unitary matrix). So, to me, the root cause is matrix multiplication (which is computed using the inner product). One particularly natural way for expressing the matrices, as you say, is using the outer product. To my mind, it is useful in several ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;spectral decomposition (which also leads you towards projectors, as required for measurements)&lt;/li&gt;&#xA;&lt;li&gt;unitaries describe basis transformations. The outer product represents that nicely as &quot;this orthonormal basis transforms into that orthonormal basis&quot;. This is particularly important in the quantum information/computation context. At the theory level, we don't care about how a particular quantum gate works. All we care about is how inputs are transformed into outputs.&lt;/li&gt;&#xA;&lt;li&gt;Once you start taking the trace, there's a very tight connection between inner products and outer products.&lt;/li&gt;&#xA;&lt;li&gt;there is a mathematical distinction between an operator and its representation as a matrix. When talking about the operator, you pretty much &lt;em&gt;have&lt;/em&gt; to use the outer product.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-12T06:48:23.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8238" PostTypeId="1" AcceptedAnswerId="8248" CreationDate="2019-09-12T06:53:29.517" Score="9" ViewCount="550" Body="&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disclaimer:&lt;/strong&gt; I am a software engineer who is curious about quantum computing. Although I understand some basic concepts, theory and math behind it, I am by no means experienced in this domain.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am doing some preliminary research on the state of quantum software development. Part of my research is to evaluate Microsoft's QDK and some of its samples (written in Q#).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand, certain optimization problems (the traveling salesman sort) may be tackled by first reducing them as QUBO or Ising problems and then solving them via quantum annealing or VQE algorithms. Part of this process is finding out the Hamiltonian and solving Schrodinger's equation. This is my understanding, kindly correct me if wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QDK's &lt;a href=&quot;https://github.com/microsoft/Quantum/tree/master/samples/simulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamiltonian simulation samples&lt;/a&gt; have examples for Ising and Trotter–Suzuki based simulations. But recently 1Qbit has released a &lt;a href=&quot;http://openqemist.1qbit.com/docs/vqe_microsoft_qsharp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE-based solution&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: do all the methods listed above (VQE, Ising, Trotter–Suzuki) do the same thing? That is, estimate ground state energy of a given system? For example, do the H2 simulation examples based on &lt;a href=&quot;http://openqemist.1qbit.com/docs/vqe_microsoft_qsharp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE&lt;/a&gt; and &lt;a href=&quot;https://github.com/microsoft/Quantum/tree/master/samples/simulation/h2/command-line&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trotter–Suzuki&lt;/a&gt; pretty much do the same thing in different ways? If so, which method should be preferred?&lt;/p&gt;&#xA;" OwnerUserId="8493" LastEditorUserId="2879" LastEditDate="2019-11-15T17:56:52.747" LastActivityDate="2019-11-15T17:56:52.747" Title="Ground state energy estimation - VQE vs. Ising vs. Trotter–Suzuki" Tags="&lt;algorithm&gt;&lt;q#&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8239" PostTypeId="1" AcceptedAnswerId="8240" CreationDate="2019-09-12T08:06:15.297" Score="3" ViewCount="60" Body="&lt;p&gt;The following general master equation (from this paper &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/15/11/113008&quot; rel=&quot;nofollow noreferrer&quot;&gt;'Dynamical quantum correlations of Ising models on arbitrary lattice and their resilience to decoherence'&lt;/a&gt;) describes the various types of decoherence relevant to trapped ions, Rydberg atoms and condensed matter systems &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\dot{\rho} = i \mathscr{H}(\rho) - \mathscr{L}_{ud}(\rho)-\mathscr{L}_{du}(\rho)-\mathscr{L}_{el}(\rho)~~~~~~~~~~~~~(1)&#xA;\end{equation}&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$$\mathscr{H}(\rho) = [\mathcal{H},\rho],\\&#xA;\mathscr{L}_{ud}(\rho) = \frac{\Gamma_{ud}}{2}\sum_{j}(\hat{\sigma}^{+}_j\hat{\sigma}^{-}_{j}\rho + \rho \hat{\sigma}^{+}_{j}\hat{\sigma}^{-}_{j}-2\hat{\sigma}^{-}_{j}\rho \hat{\sigma}^{+}_{j})\\&#xA;\mathscr{L}_{du}(\rho) = \frac{\Gamma_{ud}}{2}\sum_{j}(\hat{\sigma}^{+}_j\hat{\sigma}^{-}_{j}\rho + \rho \hat{\sigma}^{+}_{j}\hat{\sigma}^{-}_{j}-2\hat{\sigma}^{-}_{j}\rho \hat{\sigma}^{+}_{j})\\&#xA;\mathscr{L}_{el}(\rho) = \frac{\Gamma_{el}}{8}\sum_{j}(2\rho-2\hat{\sigma_j^z}\rho\hat{\sigma}_j^z)&#xA;$$&lt;/span&gt;&#xA;The first term involving a commutator describes coherent evolution due to the Ising interaction,&#xA;and the various terms having subscripts ‘ud’, ‘du’ and ‘el’ correspond respectively to&#xA;spontaneous relaxation, spontaneous excitation and dephasing. Equation (1) has the formal solution &lt;span class=&quot;math-container&quot;&gt;$\rho(t) = \mathscr{U}(t)\rho(0)$&lt;/span&gt;, with &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathscr{U}(t) = \text{exp}[-t(i\mathscr{H + \mathscr{L}_{ud}+\mathscr{L}_{du} + \mathscr{L}_{el})}]~~~~~~~~~~~~~~~~~(2)$$&lt;/span&gt; An immediate simplification follows from the observation that &lt;span class=&quot;math-container&quot;&gt;$$[\mathscr{L}_{el}, \mathscr{H}] = [\mathscr{L}_{el},\mathscr{L}_{du}] = [\mathscr{L}_{el}, \mathscr{L}_{ud}] = 0~~~~~~~~~~~~~~~~~~(3)$$&lt;/span&gt;&#xA;That the last two commutators vanish is less obvious than the firsts, but physically it has a very clear meaning: spontaneous relaxation/excitation on a site &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; causes the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;'th spin to have a well defined value of &lt;span class=&quot;math-container&quot;&gt;$\sigma^{z}_j$&lt;/span&gt;, and thus to be unentangled with the rest of the system. Since the dephasing jump operator &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}_{j}^{z}$&lt;/span&gt; changes the relative phase between the states &lt;span class=&quot;math-container&quot;&gt;$| \sigma_{j}^{z} = \pm 1 \rangle$&lt;/span&gt;, whether spontaneous relaxation/excitation occurs before or after a dephasing event only affects the sign of the overall wave function, which is irrelevant. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As a result, we can write &lt;span class=&quot;math-container&quot;&gt;$$\mathscr{U}(t) = e^{-t\mathscr{L}_{el}}e^{-t(i\mathscr{H} + \mathscr{L}_{ud} + \mathscr{L}_{du})}~~~~~~~~~~~~~~(4)$$&lt;/span&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: I might be missing something simple, but can anyone see why equation (2) reduces to equation (4) as result of the commutativity in equation (3)? &lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2021-01-05T11:38:26.523" LastActivityDate="2021-01-05T11:38:26.523" Title="General Master Equation with Decoherence Query" Tags="&lt;decoherence&gt;&lt;research&gt;&lt;correlations&gt;&lt;open-quantum-systems&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8240" PostTypeId="2" ParentId="8239" CreationDate="2019-09-12T09:51:43.960" Score="2" Body="&lt;p&gt;It's fundamentally similar to/the same as &lt;a href=&quot;https://en.wikipedia.org/wiki/Baker%E2%80%93Campbell%E2%80%93Hausdorff_formula#The_Zassenhaus_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Baker–Campbell–Hausdorff (BCH)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, in quantum physics, this is most often used (or at least taught) with commuting Hamiltonians: &lt;span class=&quot;math-container&quot;&gt;$$e^{-i\left(H_1+H_2\right)t} = \sum_{n=1}^\infty\frac{\left(-it\right)^n}{n!}\left(H_1+H_2\right)^n = e^{-iH_1t}e^{-iH_2t}e^{\frac{1}{2}\left[H_1, H_2\right]t^2}\cdots$$&lt;/span&gt; where the terms of order &lt;span class=&quot;math-container&quot;&gt;$e^{t^3}$&lt;/span&gt; and higher (represented by '&lt;span class=&quot;math-container&quot;&gt;$\cdots$&lt;/span&gt;') all involve the commutator &lt;span class=&quot;math-container&quot;&gt;$\left[H_1, H_2\right]$&lt;/span&gt;, so if &lt;span class=&quot;math-container&quot;&gt;$\left[H_1, H_2\right] = 0$&lt;/span&gt;, this becomes &lt;span class=&quot;math-container&quot;&gt;$$e^{-i\left(H_1+H_2\right)t} = e^{-iH_1t}e^{-iH_2t} .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, as this is a general mathematical result in Lie algebra (and not at all specific to Hamiltonians), if &lt;span class=&quot;math-container&quot;&gt;$$[\mathscr{L}_{el}, \mathscr{H}] = [\mathscr{L}_{el},\mathscr{L}_{du}] = [\mathscr{L}_{el}, \mathscr{L}_{ud}] = 0,$$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$$[\mathscr{L}_{el}, \mathscr{H}+\mathscr{L}_{du}+\mathscr{L}_{ud}] = 0$$&lt;/span&gt; and we can write &lt;span class=&quot;math-container&quot;&gt;\begin{align*}\mathscr{U}(t)\rho &amp;amp;= \exp[-t(i\mathscr{H + \mathscr{L}_{ud}+\mathscr{L}_{du} + \mathscr{L}_{el})}]\rho \\ &amp;amp;= \exp[-t(i\mathscr{H + \mathscr{L}_{ud}+\mathscr{L}_{du}) -\mathscr{L}_{el}t}]\rho \\ &amp;amp;= \exp[-t(i\mathscr{H + \mathscr{L}_{ud}+\mathscr{L}_{du})]\exp[-\mathscr{L}_{el}t}]\exp[\frac{1}{2}\left[i\mathscr H + \mathscr L_{ud} + \mathscr L_{du}, \mathscr L_{el}\right]t^2]\cdots\rho \\ &amp;amp;= \exp[-t(i\mathscr{H + \mathscr{L}_{ud}+\mathscr{L}_{du})]\exp[-\mathscr{L}_{el}t}]\rho\end{align*}&lt;/span&gt; and as this is true &lt;span class=&quot;math-container&quot;&gt;$\forall\,\rho$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$$\mathscr{U}(t) = e^{-t\mathscr{L}_{el}}e^{-t(i\mathscr{H} + \mathscr{L}_{ud} + \mathscr{L}_{du})} = e^{-t(i\mathscr{H} + \mathscr{L}_{ud} + \mathscr{L}_{du})}e^{-t\mathscr{L}_{el}}$$&lt;/span&gt; (again, due to the same commutation relation, where &lt;span class=&quot;math-container&quot;&gt;$e^{-t\mathscr{L}_{el}}$&lt;/span&gt; is doesn't matter). While this may initally look and feel weird as Master equations are superoperators, the underlying maths remains fundamentally unchanged as per e.g. &lt;a href=&quot;https://arxiv.org/abs/1408.3056&quot; rel=&quot;nofollow noreferrer&quot;&gt;Machnes and Plenio&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-09-12T09:51:43.960" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8241" PostTypeId="2" ParentId="2651" CreationDate="2019-09-12T13:55:53.000" Score="4" Body="&lt;p&gt;The ZX-calculus is a graphical language for dealing with linear maps of qubits, and it can in particular represent any state of qubits. Basically, ZX-diagrams are tensor networks, but there is an additional set of rewrite rules that allows you to manipulate them graphically. On the &lt;a href=&quot;https://en.wikipedia.org/wiki/ZX-calculus#Diagram_rewriting&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page&lt;/a&gt; you can find an example of how to prove that a certain quantum circuit indeed implements a GHZ-state. &lt;a href=&quot;https://arxiv.org/abs/1203.6242&quot; rel=&quot;nofollow noreferrer&quot;&gt;It has also been used&lt;/a&gt; to reason about Measurement-Based Quantum Computing, because it allows you to straightforwardly reason about graph states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://github.com/Quantomatic/pyzx&quot; rel=&quot;nofollow noreferrer&quot;&gt;PyZX&lt;/a&gt; (disclaimer: I am a lead developer) we use automated graph rewriting to reason and prove results with ZX-diagrams involving thousands of vertices, and we can visualize circuits and states on dozens of qubits.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2019-09-12T13:55:53.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8242" PostTypeId="2" ParentId="6561" CreationDate="2019-09-12T14:25:49.743" Score="3" Body="&lt;p&gt;If we have a certain quantum system which is in a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and has a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, then if we look at the state after a time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; it will have evolved to &lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle = e^{it H}|\psi\rangle$&lt;/span&gt;. The goal of Hamiltonian simulation is to answer some questions about &lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle$&lt;/span&gt; given a (usually simple) input state &lt;span class=&quot;math-container&quot;&gt;$|psi\rangle$&lt;/span&gt;, Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was the original problem suggested by Feynman where quantum computers could reasonably do better than classical computers, as a quantum computer can naturally represent the unitary evolution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This raises another question: Why would one want to do Hamiltonian simulation?&#xA;There are many reasons, but generally, if we can efficiently do Hamiltonian simulation (for instance on a quantum computer), then we can study directly how structures at the smallest scales (such as atoms or molecules, but also certain properties of Quantum Field Theory) interact and evolve. This is important to the field of quantum chemistry where one for instance wants to know how the physical structure of a molecule evolves trough time. At a larger scale it could also prove useful to for instance pharmaceutical companies who can then directly simulate the effect of their drugs on the cells in our bodies (although this is very much pie in the sky at the moment).&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2019-09-12T14:25:49.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8243" PostTypeId="2" ParentId="5485" CreationDate="2019-09-12T14:36:08.450" Score="1" Body="&lt;p&gt;The trick is that if we have a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; with diagonalization &lt;span class=&quot;math-container&quot;&gt;$H=UDU^\dagger$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$e^{it H} = U e^{it D} U^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, if you have a Hamiltonian that is a product of Pauli's &lt;span class=&quot;math-container&quot;&gt;$H = \sigma_1\otimes\cdots\otimes \sigma_n$&lt;/span&gt;, (where for simplicity we assume &lt;span class=&quot;math-container&quot;&gt;$\sigma_i \neq I$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;) then we can diagonalise &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = (\sigma'_1\otimes\cdots\otimes \sigma'_n) Z\otimes\cdot\otimes Z (\sigma'_1\otimes\cdots\otimes \sigma'_n)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{it H} = (\sigma'_1\otimes\cdots\otimes \sigma'_n) e^{it Z\otimes\cdot\otimes Z} (\sigma'_1\otimes\cdots\otimes \sigma'_n) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since Pauli matrices are easy to implement on a quantum computer, and we already know how to do &lt;span class=&quot;math-container&quot;&gt;$e^{it Z\otimes Z}$&lt;/span&gt;, we are then done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Hamiltonian is a sum of Pauli products, then there is no general simple solution, but you can use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_product_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lie product formula&lt;/a&gt; truncated to some large number of terms to reduce it to the above problem.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2019-09-12T14:36:08.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8244" PostTypeId="1" AcceptedAnswerId="8370" CreationDate="2019-09-12T15:34:44.623" Score="5" ViewCount="792" Body="&lt;p&gt;I've noticed that Q# favors Little Endian. Meaning that most operations are designed for this type of encoding. &#xA;Is is it the same with Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="26" LastEditDate="2019-09-29T10:25:12.370" LastActivityDate="2021-05-18T08:11:20.720" Title="Big Endian vs. Little Endian in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8245" PostTypeId="1" AcceptedAnswerId="8246" CreationDate="2019-09-12T18:30:26.930" Score="1" ViewCount="91" Body="&lt;p&gt;I'm trying to do &lt;a href=&quot;https://www.cs.cmu.edu/~odonnell/quantum18/weekly-work-3.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;exercise 3 of this quantum course&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice and Bob prepare an EPR pair in the Bell + state. They each take one qubit home. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suddenly, Alice decides she wishes to convey one of 4&#xA;messages to Bob; in other words, she wants to convey a classical string &lt;span class=&quot;math-container&quot;&gt;$uv \in \{00, 01, 10, 11\}$&lt;/span&gt; to Bob.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice does the following in the privacy of her own home: First, if &lt;span class=&quot;math-container&quot;&gt;$u = 1$&lt;/span&gt;, she applies a NOT gate to her qubit (else if &lt;span class=&quot;math-container&quot;&gt;$u = 0$&lt;/span&gt; she does nothing here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, if &lt;span class=&quot;math-container&quot;&gt;$v = 1$&lt;/span&gt;, she applies a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate to her qubit (else if &lt;span class=&quot;math-container&quot;&gt;$v = 0$&lt;/span&gt;, she does nothing here). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, she walks to Bob’s house and silently hands him her qubit.&#xA;Show that by measuring in a proper basis, Bob can determine the message that Alice wants to send.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My solution so far:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure both in the standard computational basis you can tell that if the bits are different, the first digit that Alice wants to send is 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem I have is how to tell that Alice applied the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate, while at the same time getting a 0-1 (apart from the phase that the gate added).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These being all the possible cases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$1/\sqrt{2} \left| 00 \right&amp;gt; - 1/\sqrt{2} \left| 11 \right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$1/\sqrt{2} \left| 00 \right&amp;gt; + 1/\sqrt{2} \left| 11 \right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$1/\sqrt{2} \left| 10 \right&amp;gt; - 1/\sqrt{2} \left| 01 \right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$1/\sqrt{2} \left| 10 \right&amp;gt; + 1/\sqrt{2} \left| 01 \right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think I am missing some extra bit of info? Bob should not be supposed to use an extra ancilla qubit to do a CNOT with the one that Alice gives him so that he makes 3 measurements (1 for +-, 1 for the first and one for the second bit), because it's just 2&lt;sup&gt;2&lt;/sup&gt; cases. 2 measurements should suffice with the qubits that already exist but I am confused on how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="8391" LastEditorUserId="26" LastEditDate="2019-09-29T10:09:13.080" LastActivityDate="2019-09-29T10:09:13.080" Title="How to decode 2-bit message from 2 entangled qubits?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8246" PostTypeId="2" ParentId="8245" CreationDate="2019-09-12T18:47:29.517" Score="3" Body="&lt;p&gt;This procedure is referred to as superdense coding protocol; you can find a lot of detailed explanations of it, starting with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt;. If you want a hint before getting a full explanation...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Effectively you need to distinguish the four Bell states. You can always do this with 100% accuracy, since all the states are orthogonal to each other. To do that, you need to find a unitary transformation which will convert these states to the four 2-qubit basis states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. It might be easier to start thinking about converting the 2-qubit basis states to Bell states and then inverting that transformation.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-12T18:47:29.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8247" PostTypeId="1" CreationDate="2019-09-12T22:30:49.043" Score="2" ViewCount="117" Body="&lt;p&gt;I am on Ch.1 of the Mike &amp;amp; Ike book. On page 18, the text shows an X gate that essentially flips the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; amplitudes. The text shows the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix but it doesn't show those for alpha and beta. I think the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is [1,0] and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is [0,1], but I don't think that was ever defined or explained anywhere?&#xA;I don't understand this excerpt from the text:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Notice that the action of the NOT gate is to take the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and replace it by the state corresponding to the first column of the matrix &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. Similarly, the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is replaced by the sate corresponding to the second column of the matrix &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Can someone show me what matrixes are multiplied to make this flip happen? I would accept hand drawings! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the same question for the H and the CNOT gates - the matrices are shown on pages 19 and 21, but not the multiplication of matrices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm refreshing on linear algebra, so please excuse me! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for any help or guidance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yogesh&lt;/p&gt;&#xA;" OwnerUserId="8500" LastEditorUserId="26" LastEditDate="2019-09-29T09:54:04.717" LastActivityDate="2019-09-29T09:54:04.717" Title="Can someone show the linear algebra calculations for X, H, and CNOT gates?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8248" PostTypeId="2" ParentId="8238" CreationDate="2019-09-13T00:05:16.080" Score="9" Body="&lt;p&gt;In each of the examples you mentioned, the task breaks very roughly down into two steps: finding a Hamiltonian that describes the problem in terms of qubits, and finding the ground state energy of that Hamiltonian. From that perspective, the Jordan–Wigner transform is a way to find a qubit Hamiltonian corresponding to a given fermionic Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have your problem specified in terms of a qubit Hamiltonian, there's (again, very roughly) two families of approaches to finding a ground state energy. With variational approaches, you prepare states from a family of states called an &lt;em&gt;ansatz&lt;/em&gt;, then estimate the expectation value of the Hamiltonian for each different input state, and minimize. To get each expectation value, you can do something like break the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; up into a sum &lt;span class=&quot;math-container&quot;&gt;$H = \sum_i h_i H_i$&lt;/span&gt;, where each &lt;span class=&quot;math-container&quot;&gt;$h_i$&lt;/span&gt; is a real number and each &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; is a Hamiltonian that's easier to estimate the expectation value of, such as a Pauli operator. You can then estimate &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle$&lt;/span&gt; by estimating each &lt;span class=&quot;math-container&quot;&gt;$\langle H_i \rangle$&lt;/span&gt; in turn.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other broad approach is to turn your energy estimation problem into a frequency estimation problem by evolving an input state under the qubit Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; that represents your problem. As you note in your question, this implicitly uses the Schrodinger equation &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle = e^{-i H t} |\psi(0)\rangle$&lt;/span&gt;. In the special case that &lt;span class=&quot;math-container&quot;&gt;$|\psi(0)\rangle$&lt;/span&gt; is the ground state (say, as the result of an adiabatic preparation), then this gives you that &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle = e^{-i E t} |\psi(0)\rangle$&lt;/span&gt;; that is, a global phase about your initial state. Since global phases are unobservable, you can use the phase kickback trick (see Chapter 7 of my book once it's posted for more details) to make that global phase into a local phase. From there, as you vary &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, the ground state energy appears as a frequency that you can learn using phase estimation. Phase estimation itself comes in two broad flavors (there's a bit of a theme here...), namely quantum and iterative phase estimation. In the first case, you use extra qubits to read out the phase into a quantum register, which is very helpful if you want to do further quantum processing of that energy. In the second case, you use one additional qubit to do classical measurements with phase kickback, letting you reuse your copy of the ground state. At that point, learning &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; from your classical measurements is a classical stats problem that you can solve in a number of different ways, such as with Kitaev's algorithm, maximum likelihood estimation, Bayesian inference, robust phase estimation, random walk phase estimation, or many others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That then leaves the problem of how to evolve under &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. That's where techniques like Trotter–Suzuki come in. Using the Trotter–Suzuki decomposition, you break &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; into a sum of terms that are each easy to simulate (that can be the same as the the decomposition you would use for VQE, but need not be), then rapidly switch between simulating each term. There's many other simulation algorithms out there, such as qubitization, but Trotter–Suzuki is a great place to start.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the plethora of different techniques, then, would you choose VQE over phase estimation or vice versa? That comes down to what kinds of quantum resources you want to use to solve your problem. At a very very high level, VQE tends to generate a very large number of quantum circuits that are each pretty shallow. By contrast, phase estimation uses quantum programs that dramatically reduce the amount of data you need by using coherent evolution (again roughly, this is the difference between Heisenberg-limited precision and the &quot;standard quantum limit,&quot; which is neither standard, quantum, nor a limit — but I digress). The downside is that phase estimation can use more qubits and deeper quantum programs. Understanding that trade-off is a large part of where tools like the trace simulator and resources estimator provided with the Quantum Development Kit come in. There's a lot out there, and being able to write up concrete implementations of each is now we can understand where each technique is most helpful.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2019-09-13T00:05:16.080" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8249" PostTypeId="1" AcceptedAnswerId="8250" CreationDate="2019-09-13T03:06:13.540" Score="2" ViewCount="879" Body="&lt;p&gt;I started by assuming two antipodal states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|(\theta,\psi)\rangle = \cos\dfrac{\theta}{2}|0\rangle + \sin\dfrac{\theta}{2}e^{i\psi}|1\rangle\\&#xA;|(\theta+\pi,\psi+\pi)\rangle= \cos\dfrac{\theta+\pi}{2}|0\rangle + \sin\dfrac{\theta+\pi}{2}e^{i(\psi+\pi)}|1\rangle&#xA;$$&lt;/span&gt;&#xA;and then try to take the inner product of them. However, the math doesn't check out (as in the result I get &lt;span class=&quot;math-container&quot;&gt;$\ne0$&lt;/span&gt;). What is wrong with my deduction?&lt;/p&gt;&#xA;" OwnerUserId="8421" LastEditorUserId="26" LastEditDate="2019-10-14T19:58:32.783" LastActivityDate="2019-10-15T00:17:18.060" Title="How to prove that antipodal points on the Bloch sphere are orthogonal?" Tags="&lt;mathematics&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8250" PostTypeId="2" ParentId="8249" CreationDate="2019-09-13T04:20:08.800" Score="2" Body="&lt;p&gt;In spherical coordinates antipodal point to &lt;span class=&quot;math-container&quot;&gt;$(\theta,\psi)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(\theta+\pi,\psi)$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$(\theta+\pi,\psi+\pi)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-09-13T04:20:08.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8251" PostTypeId="2" ParentId="8247" CreationDate="2019-09-13T06:03:42.287" Score="4" Body="&lt;p&gt;A quantum bit can be represented by a two-level quantum mechanical system, and described by a state vector in two-dimensional Hilbert space. Traditionally, Dirac, or bra-ket notation has been used to represent them. The two computational basis states are therefore often written as |0〉 and |1〉 (pronounced: 'ket 0' and 'ket 1' respectively). A pure qubit state is a linear superposition of the two states. This means that such a qubit can be represented as:&#xA;                |ψ〉 = α|0〉 + β |1〉  or as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} α \\ β  \end{bmatrix}$&lt;/span&gt;&#xA;where α and β are probability amplitudes and are in general complex numbers. When a qubit is measured in the standard basis, the probability that the outcome is |0〉 is &lt;span class=&quot;math-container&quot;&gt;$|α|^2$&lt;/span&gt; and the probability that the outcome is |1〉 is &lt;span class=&quot;math-container&quot;&gt;$|β|^2$&lt;/span&gt;. As the absolute squares of the amplitudes represent probabilities, therefore α and β are constrained by the following equation:&#xA;                &lt;span class=&quot;math-container&quot;&gt;$|α|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|β|^2$&lt;/span&gt; = 1&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X is  &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;|ψ'〉 = X|ψ〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{bmatrix}\begin{bmatrix} α \\ β  \end{bmatrix} = \begin{bmatrix} 0*α + 1*β \\  1*α + 0*β  \end{bmatrix} = \begin{bmatrix} β \\  α  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now |0〉 is &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and |1〉 is &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 \\ 1  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;|1〉 = X|0〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{bmatrix}\begin{bmatrix} 1 \\ 0  \end{bmatrix} = \begin{bmatrix} 0*1 + 1*0 \\  1*1 + 0*0  \end{bmatrix} = \begin{bmatrix} 0 \\  1  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;|0〉 = X|1〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{bmatrix}\begin{bmatrix} 0 \\ 1  \end{bmatrix} = \begin{bmatrix} 0*0 + 1*1 \\  1*0 + 0*1  \end{bmatrix} = \begin{bmatrix} 1 \\  0  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for H = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;|ψ'〉 = H|ψ〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}  \end{bmatrix}\begin{bmatrix} α \\ β  \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{α + β}{\sqrt{2}} \\  \frac{α - β}{\sqrt{2}}  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now |0〉 is &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and |1〉 is &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 \\ 1  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;H|0〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}  \end{bmatrix}\begin{bmatrix} 1 \\ 0  \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}}*1 + \frac{1}{\sqrt{2}}*0 \\  \frac{1}{\sqrt{2}}*1  -\frac{1}{\sqrt{2}}*0  \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\  \frac{1 }{\sqrt{2}}  \end{bmatrix}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt;[|0〉 + |1〉] &lt;/p&gt;&#xA;&#xA;&lt;p&gt;H|1〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}  \end{bmatrix}\begin{bmatrix} 0 \\ 1  \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}}*0 + \frac{1}{\sqrt{2}}*1 \\  \frac{1}{\sqrt{2}}*0  -\frac{1}{\sqrt{2}}*1  \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\  -\frac{1 }{\sqrt{2}}  \end{bmatrix}$&lt;/span&gt; =&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt;[|0〉 - |1〉]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT is a two qubit gate so matrix representation is 4 X 4 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT= &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and lets define |&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;〉 = (α|0〉 + β|1〉) ⊗ ( б|0〉 + η|1〉) = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \alpha_1 \\ \alpha_2 \\ \alpha_3 \\ \alpha_4  \end{bmatrix}$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|α|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|β|^2$&lt;/span&gt; = 1 and &lt;span class=&quot;math-container&quot;&gt;$|б|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|η|^2$&lt;/span&gt; = 1 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;|&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;〉 = &lt;span class=&quot;math-container&quot;&gt;$α_1|00〉 + α_2|01〉 + α_3|10〉 + α_4|11〉	$&lt;/span&gt;&lt;br&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|α_1|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|α_2|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|α_3|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|α_4|^2$&lt;/span&gt; = 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$α_1 = α ⊗ б$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$α_2 = α ⊗ η$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$α_3 = β ⊗ б$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$α_4 = β ⊗ η$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;|&lt;span class=&quot;math-container&quot;&gt;$\phi'$&lt;/span&gt;〉 = CNOT|&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;〉 = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \end{bmatrix}\begin{bmatrix} \alpha_1 \\ \alpha_2 \\ \alpha_4 \\ \alpha_4  \end{bmatrix} = \begin{bmatrix} \alpha_1 \\ \alpha_2 \\ \alpha_3 \\ \alpha_3   \end{bmatrix} = \begin{bmatrix} \alpha_1 \\ \alpha_2 \\ \alpha_4 \\ \alpha_4  \end{bmatrix} = \begin{bmatrix} α ⊗ б \\ α ⊗ η \\  β ⊗ б \\ β ⊗ η   \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when α = 1, there is no change in the state of second qubit, however, when β = 1 then the state of second qubit is flipped. It is easy to understand when α, β, б and η are either 0 or 1 but not otherwise. CNOT gate is one of the fundamental entangling gates. so if you have difficulty then I can elaborate further. I hope it helps...&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-09-13T06:03:42.287" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8252" PostTypeId="1" CreationDate="2019-09-13T06:55:21.223" Score="2" ViewCount="85" Body="&lt;p&gt;Coherent state and squeezed states can be swapped why cloning coherent states can't be perfect to clone we obtain &lt;span class=&quot;math-container&quot;&gt;$$|\cos(|z|)b\rangle \otimes |\sin(|z|)b\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we set &lt;span class=&quot;math-container&quot;&gt;$|z| = \pi/4$&lt;/span&gt; then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|b\rangle \otimes |0\rangle = |b/\sqrt 2\rangle \otimes |b/\sqrt 2\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is imperfect cloning is there a way to perfectly clone?&lt;/p&gt;&#xA;" OwnerUserId="8499" LastEditorUserId="26" LastEditDate="2019-09-29T10:03:35.957" LastActivityDate="2019-09-29T10:03:35.957" Title="Is their a way to perfectly clone coherent state and squeezed states?" Tags="&lt;quantum-state&gt;&lt;cloning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8253" PostTypeId="2" ParentId="8231" CreationDate="2019-09-13T07:14:26.577" Score="2" Body="&lt;p&gt;The general form of all possible extensions is incredibly general. Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\sum_ip_i|\psi_i\rangle\langle\psi_i|,\qquad \rho_C=\sum_jq_j|\phi_j\rangle\langle\phi_i|,&#xA;$$&lt;/span&gt;&#xA;but remember that there are generally many choices for such a decomposition. Now, we could create a pure state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\left(\sum_i\sqrt{p_i}|\psi_i\rangle_A|i\rangle_{B_1}\right)\left(\sum_j\sqrt{q_j}|j\rangle_{B_2}|\phi_j\rangle_C\right)|0\rangle_D.&#xA;$$&lt;/span&gt;&#xA;(I wonder if there are even more options if there are commensurate sets of values for &lt;span class=&quot;math-container&quot;&gt;$\sqrt{p_iq_j}$&lt;/span&gt;.)&#xA;Now, you can have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{ABC}=\text{Tr}_D\left(U_{B_1B_2D}|\Psi\rangle\langle\Psi|U_{B_1B_2D}^\dagger\right),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U_{B_1B_2D}$&lt;/span&gt; is a unitary acting over the two &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; parts, &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;, and some auxiliary system &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; does not act on &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, the extension is a pure state. For example, if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the identity, there's a lot of bipartite entanglement between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; and between &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;, but no entanglement between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. I assume varying &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gives you some control over entropies such as those conditioned on &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (but I haven't tried it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the other extreme of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you can swap systems &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, which essentially leaves you with a form &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABC}=\rho_A\otimes\rho_B\otimes \rho_C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have no idea what implications this has for entropies and the like.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-13T07:14:26.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8254" PostTypeId="2" ParentId="8252" CreationDate="2019-09-13T16:38:04.630" Score="3" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no-cloning theorem&lt;/a&gt; states that an unknown quantum state cannot be copied exactly --- so this rules out any algorithm that attempts to produce perfect copies of an arbitrary quantum state (including squeezed and coherent states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you note, however, the no-cloning theorem does not rule out the production of approximate quantum state clones. &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.94.240503&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andersen et al.&lt;/a&gt; introduced the most-optimal scheme for cloning of Gaussian states --- their algorithm produces a clone with fidelity of 65% to the original state (the proven optimum possible is &lt;span class=&quot;math-container&quot;&gt;$f=2/3$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit they use in their algorithm is here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KVOmT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KVOmT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and can be implemented using &lt;a href=&quot;https://strawberryfields.readthedocs.io&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strawberry Fields&lt;/a&gt; like so:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# state to be cloned&#xA;Coherent(0.7+1.2j) | q[0]&#xA;&#xA;# 50-50 beamsplitter&#xA;BS = BSgate(pi/4, 0)&#xA;&#xA;# symmetric Gaussian cloning scheme&#xA;BS | (q[0], q[1])&#xA;BS | (q[1], q[2])&#xA;MeasureX | q[1]&#xA;MeasureP | q[2]&#xA;Xgate(scale(q[1], sqrt(2))) | q[0]&#xA;Zgate(scale(q[2], sqrt(2))) | q[0]&#xA;&#xA;# after the final beamsplitter, modes q[0] and q[3]&#xA;# will contain identical approximate clones of the&#xA;# initial state Coherent(0.1+0j)&#xA;BS | (q[0], q[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can check out the &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/algorithms/gaussian_cloning.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gaussian cloning&lt;/a&gt; tutorial in the Strawberry Fields documentation for more information.&lt;/p&gt;&#xA;" OwnerUserId="371" LastActivityDate="2019-09-13T16:38:04.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8255" PostTypeId="2" ParentId="8244" CreationDate="2019-09-15T01:45:48.157" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Note that the bits are labelled from right to left. So cr[0] is the one to the furthest right, and so on. As an example of this, here's an 8 qubit circuit with a Pauli X&#xA;on only the qubit numbered 7, which has its output stored to the bit numbered 7.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-appendix/qiskit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-appendix/qiskit.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7744" LastEditorUserId="15119" LastEditDate="2021-05-18T08:11:20.720" LastActivityDate="2021-05-18T08:11:20.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8257" PostTypeId="2" ParentId="8236" CreationDate="2019-09-15T22:48:42.603" Score="3" Body="&lt;p&gt;There are a lot of comments and objections in the question, too many in fact to go through them all. I will try to address some of the points that I think hide misconceptions, to hopefully give a clearer idea of what's going on.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;About &quot;&lt;em&gt;interpretations of QM in which the measurement is non-unitary&lt;/em&gt;&quot;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The non-unitarity of the measuring process is &lt;em&gt;not&lt;/em&gt; a matter of interpretations. The mapping between a state and a post-measurement state is non-unitary, period. Interpretations, by definition, do not change any predictions of a theory, and thus won't change this fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be clear, this remains true even if one somehow &quot;explains&quot; at exactly what point, and due to what process, the non-unitarity of the measurement process &quot;happens&quot; (e.g. due to some &lt;a href=&quot;https://en.wikipedia.org/wiki/Objective-collapse_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;collapse model&lt;/a&gt;, or if one adheres to the view that the non-unitarity of measurement is an effective description of a unitary process in which some of the information is neglected, &lt;a href=&quot;https://en.wikipedia.org/wiki/Objective-collapse_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;à la Zurek&lt;/a&gt;). This is because any such model would essentially explain how/why the mapping&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle\mapsto|\psi_i\rangle\tag A$$&lt;/span&gt;&#xA;happens with probability &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi_i|\psi\rangle|^2$&lt;/span&gt;. However, the mapping (A) &lt;em&gt;will&lt;/em&gt; remain non-unitary, regardless of such explanations, even though one might be able to explain the non-unitarity as arising from some other principle/axiom/mechanism.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All this is to say that the statement &quot;&lt;em&gt;derivation X cannot be applied to Y due to interpretations of the measurement process&lt;/em&gt;&quot; is nonsense. Nonetheless, it &lt;em&gt;is&lt;/em&gt; true that the quoted derivation cannot be applied &quot;&lt;em&gt;to all situations&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The derivation cannot be applied in &quot;&lt;em&gt;all situations&lt;/em&gt;&quot;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Sure: it can be applied in all and only the situations in which the derivation applies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The derivation under consideration is nothing but Heisenberg's uncertainty relation for a pair of operators &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt;, in the form &lt;span class=&quot;math-container&quot;&gt;$\sigma_A \sigma_B\ge |\langle[A,B]\rangle|/2$&lt;/span&gt;, in the special case &lt;span class=&quot;math-container&quot;&gt;$A=\Omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B=H$&lt;/span&gt;, plus some additional definitions and algebraic manipulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this is telling us is that if, &lt;em&gt;at any given moment &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;&lt;/em&gt;, we compute &lt;span class=&quot;math-container&quot;&gt;$\sigma_\Omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_H$&lt;/span&gt; (which will require multiple repetitions of the experiment, as each experiment will produce a single sample from the underlying distributions, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_\Omega$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\sigma_H$&lt;/span&gt; are the variances of such distributions), we'll find the relation &lt;span class=&quot;math-container&quot;&gt;$\sigma_H\sigma_\Omega\ge|\partial_t\langle\Omega\rangle|/2$&lt;/span&gt; to bew satisfied. Again, note that to actually observe this, you would need to perform the same exact experiment multiple times, and then measure the relevant quantities all at the same time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; (and probably also at some future time &lt;span class=&quot;math-container&quot;&gt;$t+\epsilon$&lt;/span&gt; to compute the time-derivative of &lt;span class=&quot;math-container&quot;&gt;$\langle\Omega\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, you can think of this relation as telling you what you would observe if, at any given point of the (unitary evolution), you were somehow able to know the values of the relevant variances and expectation values (which you cannot, but you can simulate the situation by doing many measurements repeating the experiment). This is, therefore, a statement about the values of the expected variances at any given point of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, notice how the argument holds for any state, not just pure ones (although the interpretation of time provided in &lt;a href=&quot;https://physics.stackexchange.com/a/53804/58382&quot;&gt;joshphysics' answer&lt;/a&gt; might not). This means that it doesn't care about whether measurements were performed at some point in the past of the considered instant of time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. The only thing that matters is the state of the system at the time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&#xA;Note that you can also model measurement processes as (non-unitary) maps applied to the state. For example, measuring a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in the computational basis can be modelled as the mapping&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho\mapsto\mathcal E(\rho)\equiv\sum_k \operatorname{Tr}(\rho P_k)P_k,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P_k\equiv|k\rangle\!\langle k|$&lt;/span&gt;. This still produces a state, on which you can apply the uncertainty realtion.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;But we use Heisenberg's equation to obtain the result!&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;True. So I guess to be more precise, the statement refers to the relation between &lt;span class=&quot;math-container&quot;&gt;$\sigma_\Omega,\sigma_H$&lt;/span&gt; at a given time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, and the rate of increment of &lt;span class=&quot;math-container&quot;&gt;$\langle\Omega\rangle$&lt;/span&gt; at the time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. &lt;em&gt;This increment refers to the rate of increment of &lt;span class=&quot;math-container&quot;&gt;$\langle\Omega\rangle$&lt;/span&gt; between some &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t+\epsilon$&lt;/span&gt; when the state evolves unitarity in between the two times.&lt;/em&gt;&#xA;In other words, to compute it, you need to measure &lt;span class=&quot;math-container&quot;&gt;$\langle \Omega\rangle$&lt;/span&gt; at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, and then measure &lt;span class=&quot;math-container&quot;&gt;$\langle\Omega\rangle$&lt;/span&gt; at time &lt;span class=&quot;math-container&quot;&gt;$t+\epsilon$&lt;/span&gt; (and by this I mean that you repeat the measurement &lt;em&gt;without&lt;/em&gt; measuring at &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, but this time only measuring at &lt;span class=&quot;math-container&quot;&gt;$t+\epsilon$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-09-29T10:52:11.627" LastActivityDate="2019-09-29T10:52:11.627" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="8258" PostTypeId="1" AcceptedAnswerId="8259" CreationDate="2019-09-16T12:31:55.010" Score="0" ViewCount="104" Body="&lt;p&gt;I have a hard time getting the exact difference between concepts of superposed and mixed states. Is it possible to represent the second one on the Bloch sphere, to show the main difference?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="55" LastEditDate="2019-09-16T21:44:59.843" LastActivityDate="2019-09-16T21:44:59.843" Title="Can a mixed state be represented on a Bloch sphere?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8259" PostTypeId="2" ParentId="8258" CreationDate="2019-09-16T15:38:21.587" Score="3" Body="&lt;p&gt;Yes. A pure, superposed, state corresponds to a point on the surface of the sphere. A mixed state corresponds to a point &lt;em&gt;inside&lt;/em&gt; the sphere. The closer to the centre, the more mixed the state is.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-16T15:38:21.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8260" PostTypeId="1" AcceptedAnswerId="8261" CreationDate="2019-09-16T19:06:24.063" Score="1" ViewCount="111" Body="&lt;p&gt;Let H be the Hadamard operator.&#xA; &lt;span class=&quot;math-container&quot;&gt;$$ H = (\left| 0 \right&amp;gt; \left&amp;lt; 0 \right| + \left| 0 \right&amp;gt; \left&amp;lt; 1 \right| + \left| 1 \right&amp;gt; \left&amp;lt; 0 \right| -\left| 1 \right&amp;gt; \left&amp;lt; 1 \right| )$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;prove that &lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n} \left| 0 \right&amp;gt;^{\otimes n} = \frac{1}{\sqrt{2^n}} \sum_{i=0}^{2^n -1} \left| i \right&amp;gt;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, it is evident that this works for &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, because we know that.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \left| 0 \right&amp;gt;^{\otimes 2} = \left| 0 \right&amp;gt; \otimes \left| 0 \right&amp;gt; = \left| 00 \right&amp;gt; $$&lt;/span&gt;&#xA;Then.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H^{\otimes2}\left| 00 \right&amp;gt; = (\left| 0 \right&amp;gt; \left&amp;lt; 0 \right| + \left| 0 \right&amp;gt; \left&amp;lt; 1 \right| + \left| 1 \right&amp;gt; \left&amp;lt; 0 \right| -\left| 1 \right&amp;gt; \left&amp;lt; 1 \right| )(\left| 0 \right&amp;gt; \left&amp;lt; 0 \right| + \left| 0 \right&amp;gt; \left&amp;lt; 1 \right| + \left| 1 \right&amp;gt; \left&amp;lt; 0 \right| -\left| 1 \right&amp;gt; \left&amp;lt; 1 \right| )\left| 00 \right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes2}\left| 00 \right&amp;gt; = \frac{1}{2}(\left&amp;lt; 00 \right|\left| 00 \right&amp;gt;\left| 00 \right&amp;gt; + \left&amp;lt; 00 \right|\left| 00 \right&amp;gt;\left| 01 \right&amp;gt; + \left&amp;lt; 00 \right|\left| 00 \right&amp;gt;\left| 10 \right&amp;gt; + \left&amp;lt; 00 \right|\left| 00 \right&amp;gt;\left| 11 \right&amp;gt;)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes2}\left| 00 \right&amp;gt; = \frac{1}{2}(\left| 00 \right&amp;gt; + \left| 01 \right&amp;gt; + \left| 10 \right&amp;gt; + \left| 11 \right&amp;gt;) = \frac{1}{2}\sum^{3}_{i=0}\left| i \right&amp;gt; = \frac{1}{\sqrt{2^2}}\sum^{2^2 -1}_{i=0}\left| i \right&amp;gt; $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I do not know how to prove that it works for &lt;span class=&quot;math-container&quot;&gt;$n = k + 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any clue is very welcome, thank you in advance for your time and advice. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information about &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;bra-ket&lt;/a&gt; notation, or the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_(H)_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard&lt;/a&gt; operator you can consult those links. &lt;/p&gt;&#xA;" OwnerUserId="8528" LastEditorUserId="2879" LastEditDate="2019-09-16T20:17:38.303" LastActivityDate="2019-09-16T21:35:28.137" Title="Prove by induction $H^{\otimes n} \left| 0 \right&gt;^{\otimes n} = \frac{1}{\sqrt{2^n}} \sum_{i=0}^{2^n -1} \left| i \right&gt;$" Tags="&lt;hadamard&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8261" PostTypeId="2" ParentId="8260" CreationDate="2019-09-16T20:13:52.053" Score="1" Body="&lt;p&gt;To do the step of the induction, you assume that you've already proven that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes k} \left| 0 \right&amp;gt;^{\otimes k} = \frac{1}{\sqrt{2^k}} \sum_{i=0}^{2^k -1} \left| i \right&amp;gt;$$&lt;/span&gt; (note the appropriate normalization factor). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you have to consider &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes k+1} \left| 0 \right&amp;gt;^{\otimes k+1}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes k+1} \left| 0 \right&amp;gt;^{\otimes k+1} = \big( H^{\otimes k} \left| 0 \right&amp;gt;^{\otimes k} \big) \otimes \big( H|0\rangle \big) = \big(\frac{1}{\sqrt{2^k}} \sum_{i=0}^{2^k -1} \left| i \right&amp;gt; \big) \otimes \frac{1}{\sqrt2}(|0\rangle + |1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you open the brackets, you'll get &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=0}^{2^k -1} \big( | i \rangle \otimes |0\rangle + | i \rangle \otimes |1\rangle \big)$&lt;/span&gt;, which is exactly &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=0}^{2^{k+1} -1} | i \rangle$&lt;/span&gt; (you'll see it if you write out the binary representations of the sum elements).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-16T20:13:52.053" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8262" PostTypeId="2" ParentId="8260" CreationDate="2019-09-16T21:35:28.137" Score="0" Body="&lt;p&gt;As pointed out in the comments, induction is not necessary here. You can simply notice that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}|0\rangle^{\otimes n}\equiv\bigotimes_nH|0\rangle=\bigotimes_n|+\rangle\equiv|+\rangle^{\otimes n}\equiv|\underbrace{+,+,...,+}_n\rangle,\tag A$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\equiv\frac{1}{\sqrt2}(|0\rangle+|1\rangle)$&lt;/span&gt;, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|+\rangle^{\otimes n}=\frac{1}{2^{n/2}}\sum_{i=0}^{2^n-1}|i\rangle.\tag B$$&lt;/span&gt;&#xA;At the last step we are observing that &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes n}$&lt;/span&gt; is a balanced sum over all bitstrings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, which we can write as in the RHS, in which we identify &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with the bitstring equal to the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th integer in binary notation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Another way is to observe that the matrix elements of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; equal &lt;span class=&quot;math-container&quot;&gt;$\sqrt2 H_{ij}=(-1)^{ij}$&lt;/span&gt;.&#xA;From this one can derive the matrix elements of &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(H^{\otimes n})_{I,J}=\prod_{k=1}^n (H)_{i_k,j_k}=2^{-n/2}\prod_{k=1}^n (-1)^{i_k j_k}&#xA;=2^{-n/2}(-1)^{\sum_k i_k j_k}\equiv 2^{-n/2}(-1)^{I\odot J},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I\equiv(i_1,...,i_n), J\equiv (j_1,...,j_n)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$I\odot J\equiv\sum_k i_k j_k$&lt;/span&gt;. In other words, &lt;span class=&quot;math-container&quot;&gt;$I,J$&lt;/span&gt; are bitstrings with components &lt;span class=&quot;math-container&quot;&gt;$i_k,j_k\in\{0,1\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, we can see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}|0\rangle^{\otimes n}=\sum_I (H^{\otimes n})_{I,\underbrace{(0,...,0)}_{\equiv J}} |I\rangle&#xA;=2^{-n/2}\sum_I (-1)^{I\cdot \boldsymbol 0}|I\rangle&#xA;=2^{-n/2}\sum_I |I\rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sum_I |I\rangle$&lt;/span&gt; is here just another way to write &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=0}^{2^n-1}|i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-09-16T21:35:28.137" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8263" PostTypeId="1" CreationDate="2019-09-16T21:36:32.740" Score="3" ViewCount="68" Body="&lt;p&gt;Say I have a quantum register consisting of two qubits like this &lt;span class=&quot;math-container&quot;&gt;$\left| -,0\right&amp;gt;$&lt;/span&gt; which as a vector would be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(1, 0, -1, 0)$&lt;/span&gt;. If I only started with this vector, would it possible using only the vector formulation to find the two qubits that make it up ie. &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt; = \frac{1}{\sqrt{2}}(1, -1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt; = (1, 0)$&lt;/span&gt;? How would that be done in a general case where we only have a vector &lt;span class=&quot;math-container&quot;&gt;$(v_{1},v_{2}, ....v_{n})$&lt;/span&gt; and we know it consists of &lt;span class=&quot;math-container&quot;&gt;$log_{2}(n)$&lt;/span&gt;  qubits?&lt;/p&gt;&#xA;" OwnerUserId="8530" LastEditorUserId="55" LastEditDate="2019-09-16T21:49:08.843" LastActivityDate="2019-09-17T06:53:31.190" Title="Can I find the states of individual qubits in a quantum register using only linear algebra?" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8264" PostTypeId="1" AcceptedAnswerId="8268" CreationDate="2019-09-17T01:12:01.907" Score="1" ViewCount="57" Body="&lt;p&gt;I'd like to run the optimizations from Qiskit's level 3 transpiler pass on some example programs for benchmarking, but when I try to include the Collect2qBlocks() and ConsolidateBlocks() passes I get an error. The code below is based on the example &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level3.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.compiler import transpile&#xA;from qiskit.transpiler import PassManager&#xA;from qiskit.transpiler.passes import Unroller, Optimize1qGates, CommutativeCancellation, CXCancellation, Depth, FixedPoint, Collect2qBlocks, ConsolidateBlocks&#xA;&#xA;circ = QuantumCircuit.from_qasm_file(&quot;example.qasm&quot;)&#xA;&#xA;basis_gates = ['u1', 'u2', 'u3', 'cx']&#xA;_unroll = Unroller(basis_gates)&#xA;_depth_check = [Depth(), FixedPoint('depth')]&#xA;def _opt_control(property_set):&#xA;    return not property_set['depth_fixed_point']&#xA;_opt = [Collect2qBlocks(), ConsolidateBlocks(),&#xA;        Unroller(basis_gates),  # unroll unitaries&#xA;        Optimize1qGates(), CommutativeCancellation()]&#xA;pm = PassManager()&#xA;pm.append(_unroll)&#xA;pm.append(_depth_check + _opt, do_while=_opt_control)&#xA;circ = pm.run(circ)&#xA;print(circ.count_ops())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This seems to run fine if I exclude the Collect2qBlocks() and ConsolidateBlocks() passes, but when I include them I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &quot;test_qiskit.py&quot;, line 19, in &amp;lt;module&amp;gt;&#xA;    circ = pm.run(circ)&#xA;  File &quot;/usr/local/lib/python3.7/site-packages/qiskit/transpiler/passmanager.py&quot;, line 146, in run&#xA;    dag = self._do_pass(pass_, dag, passset.options)&#xA;  File &quot;/usr/local/lib/python3.7/site-packages/qiskit/transpiler/passmanager.py&quot;, line 183, in _do_pass&#xA;    pass_.run(FencedDAGCircuit(dag))&#xA;  File &quot;/usr/local/lib/python3.7/site-packages/qiskit/transpiler/passes/collect_2q_blocks.py&quot;, line 59, in run&#xA;    these_qubits = sorted(nd.qargs)&#xA;TypeError: '&amp;lt;' not supported between instances of 'QuantumRegister' and 'QuantumRegister'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Am I invoking the methods incorrectly? I have the most recent version of Qiskit available on pip. Please let me know if you have any advice, thanks.&lt;/p&gt;&#xA;" OwnerUserId="8532" LastActivityDate="2019-09-18T12:58:27.227" Title="Question on using the Collect2qBlocks() and ConsolidateBlocks() optimizations" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8265" PostTypeId="2" ParentId="8263" CreationDate="2019-09-17T06:53:31.190" Score="3" Body="&lt;p&gt;Here's a simple method that will work on any state that is not entangled with other qubits. It's also pretty efficient; it's the method used by the amplitude displays in Quirk.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find the index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; of any one of the largest magnitude entries in the vector. In your case this would be index 0 or index 2. Technically any non-zero entry will do, but if you aren't being perfectly precise then picking the largest will reduce numerical error.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Split &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; into the &quot;included in my subsystem&quot; part and the &quot;excluded from my subsystem&quot; part. For example the index &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt; splits into the index pair &lt;span class=&quot;math-container&quot;&gt;$(k_i, k_e) = (1, 0)$&lt;/span&gt; whereas the index 0 would split into (0, 0).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$w_{r}$&lt;/span&gt; be the vector formed by holding &lt;span class=&quot;math-container&quot;&gt;$k_i=r$&lt;/span&gt; fixed while you vary &lt;span class=&quot;math-container&quot;&gt;$k_e$&lt;/span&gt; over all possible exterior values and tale the corresponding amplitude in the state vector. For example, you hold the 1 in (1, 0) constant while iterating the other. So you need to look up (1, 0) which is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and (1, 1) which is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$w_{k_i}$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$(-1, 0)$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$v = w_{k_i} / |w_{k_i}|$&lt;/span&gt; be the renormalized vector. This is the state vector of the subsystem, up to global phase. Note that in our case it equals &lt;span class=&quot;math-container&quot;&gt;$-|0\rangle$&lt;/span&gt;, which is in fact one of the qubit states (up to global phase).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;[Optional] Verify. If &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; is actually the subsystem vector, then all &lt;span class=&quot;math-container&quot;&gt;$w_r$&lt;/span&gt; should be parallel to &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;. You can check this by checking that &lt;span class=&quot;math-container&quot;&gt;$|\sum_r \langle v | w_r\rangle | = 1$&lt;/span&gt;. If it's not, the internal and external states are entangled.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-09-17T06:53:31.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8266" PostTypeId="2" ParentId="7050" CreationDate="2019-09-17T19:52:16.990" Score="0" Body="&lt;p&gt;Just in case you want to try writing code for quantum computers using something from the Lisp family of languages instead of Python, which is used by most people in this field, I wrote a GNU Guile (Scheme) to QASM2 toy compiler called &lt;a href=&quot;https://github.com/PESchoenberg/g2q&quot; rel=&quot;nofollow noreferrer&quot;&gt;g2q&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7804" LastActivityDate="2019-09-17T19:52:16.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8268" PostTypeId="2" ParentId="8264" CreationDate="2019-09-18T12:58:27.227" Score="1" Body="&lt;p&gt;Answering my question, as per the comments above. The solution was installing the latest version of qiskit. To get 0.12.0, I needed to 'pip uninstall' qiskit and then 'pip install' it again.&lt;/p&gt;&#xA;" OwnerUserId="8532" LastActivityDate="2019-09-18T12:58:27.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8269" PostTypeId="1" AcceptedAnswerId="8271" CreationDate="2019-09-19T00:43:41.580" Score="1" ViewCount="495" Body="&lt;p&gt;I am using QAOA to solve the max-cut problem. On my machine, 10 qubits already takes a minute or two to simulate. I'm hoping that the ibmq-qasm-simulator could simulate 32 qubits faster than my laptop would. Here's my code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After loading in my IBMQ token and such...&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;optimizer = COBYLA()&#xA;# Simulate using IBM's cloud service&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;quantum_instance = QuantumInstance(backend, shots=1)&#xA;&#xA;part_array = part.values&#xA;w = calc_w(part_array)  # Calculate pairwise distances between points&#xA;&#xA;# Execute algorithm&#xA;qubit_ops, offset = max_cut.get_max_cut_qubitops(w)&#xA;qaoa = QAOA(qubit_ops, optimizer, p)&#xA;result = qaoa.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;While the code runs a message in red (like a warning but without &quot;Warning:&quot;) displays saying, &quot;The skip Qobj validation does not work for IBMQ provider. Disable it.&quot; How do I do what this message is asking?&lt;/p&gt;&#xA;" OwnerUserId="8420" LastEditorUserId="55" LastEditDate="2019-09-28T19:15:27.823" LastActivityDate="2019-09-28T19:15:27.823" Title="Backend Warning: The skip Qobj validation does not work for IBMQ provider. Disable it" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8270" PostTypeId="2" ParentId="4975" CreationDate="2019-09-19T10:24:24.260" Score="18" Body="&lt;p&gt;You can build your gate with &lt;strong&gt;Operator&lt;/strong&gt; and &lt;strong&gt;unitary&lt;/strong&gt; function e.g:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;from qiskit.quantum_info.operators import Operator&#xA;&#xA;controls = QuantumRegister(2)&#xA;circuit = QuantumCircuit(controls)&#xA;&#xA;cx = Operator([&#xA;    [1, 0, 0, 0],&#xA;    [0, 0, 0, 1],&#xA;    [0, 0, 1, 0],&#xA;    [0, 1, 0, 0]&#xA;])&#xA;circuit.unitary(cx, [0, 1], label='cx')&#xA;&#xA;Output:&#xA;         ┌──────────┐&#xA;q0_0: |0&amp;gt;┤0         ├&#xA;         │  unitary │&#xA;q0_1: |0&amp;gt;┤1         ├&#xA;         └──────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is identical to:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.cx(controls[0], controls[1])&#xA;&#xA;Output:&#xA;&#xA;q0_0: |0&amp;gt;──■──&#xA;         ┌─┴─┐&#xA;q0_1: |0&amp;gt;┤ X ├&#xA;         └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For more info look Qiskit tutorials: &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/4_custom_gate_noise.html&quot; rel=&quot;noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/simulators/4_custom_gate_noise.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8116" LastEditorUserId="8116" LastEditDate="2020-07-23T07:55:51.877" LastActivityDate="2020-07-23T07:55:51.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8271" PostTypeId="2" ParentId="8269" CreationDate="2019-09-19T14:14:28.550" Score="3" Body="&lt;p&gt;There is a parameter when instantiating a &lt;code&gt;QuantumInstance()&lt;/code&gt; called &lt;code&gt;skip_qobj_validation&lt;/code&gt;. This parameter is set to &lt;code&gt;True&lt;/code&gt; by default. When creating the QuantumInstance, you can set it to False, and that will get rid of the warning.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q_instance = QuantumInstace(skip_qobj_validation=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-09-19T14:14:28.550" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8272" PostTypeId="1" CreationDate="2019-09-19T14:14:42.370" Score="2" ViewCount="115" Body="&lt;p&gt;I tried to follow the HHL tutorial. Since the 8x8 problem is not realistically simulable (I stopped after a few minutes), I tried to make it run on another backend, starting on the easiest example:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;params = {&#xA;    'problem': {&#xA;        'name': 'linear_system'&#xA;    },&#xA;    'algorithm': {&#xA;        'name': 'HHL'&#xA;    },&#xA;    'eigs': {&#xA;        'expansion_mode': 'suzuki',&#xA;        'expansion_order': 2,&#xA;        'name': 'EigsQPE',&#xA;        'num_ancillae': 3,&#xA;        'num_time_slices': 50&#xA;    },&#xA;    'reciprocal': {&#xA;        'name': 'Lookup'&#xA;    }&#xA;}&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;&#xA;matrix = [[1, 0], [0, 2]]&#xA;vector = [1, 4]&#xA;params['input'] = {&#xA;    'name': 'LinearSystemInput',&#xA;    'matrix': matrix,&#xA;    'vector': vector&#xA;}&#xA;&#xA;result = run_algorithm(params, backend = backend)&#xA;print(&quot;solution &quot;, np.round(result['solution'], 5))&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I use&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;run_algorithm(params, backend = BasicAer.get_backend('qasm_simulator'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It take a bit of time (30 seconds) but it works. However with 'ibmq_16_melbourne', it runs without any sign of ever stopping (close to an hour now). It doesn't seem to be queud or something, because it consume 20% of my processor and the quantum-computing.ibm.com page says I have no result pending. I tried to restart everything already.&#xA;Can you help me and guess what is happening ?&#xA;Thank you very much&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've observed that the circuit generated by Aqua to use HHL on a diagonal matrix of size 2 has a depth of 29 000 . So it explains why the simulation is taking so damn long. This is much much bigger than what it should be. The tutorial (which i was running) says the the depth of the generated circut is 129. (I was running the exact same code). I suppose there was some change in the library after the tutorial was done. So my guess is there is some bug in HHL that makes it create a lagrely oversized circuit.&lt;/p&gt;&#xA;" OwnerUserId="8550" LastEditorUserId="8550" LastEditDate="2019-09-30T14:28:30.010" LastActivityDate="2019-09-30T14:28:30.010" Title="Running HHL tutorial on real backend" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8273" PostTypeId="2" ParentId="2177" CreationDate="2019-09-19T21:02:38.467" Score="8" Body="&lt;p&gt;Qiskit's &lt;strong&gt;QuantumCircuit&lt;/strong&gt; has &lt;strong&gt;mct&lt;/strong&gt; method to build multiple-control Toffoli gate with several modes: basic, basic-dirty-ancilla, advanced, noancilla. For instance Toffoli gate with 3 control qubits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;&#xA;controls = QuantumRegister(3, &quot;c_qb&quot;)&#xA;target = QuantumRegister(1, &quot;t_qb&quot;)&#xA;circuit = QuantumCircuit(controls, target)&#xA;&#xA;circuit.mct(controls, target[0], None, mode='advanced')&#xA;&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c_qb_0: |0&amp;gt;──────■────────■────────────────■──────────────────────────────────■──────────────────────────────────■────────────────────&#xA;                 │      ┌─┴─┐            ┌─┴─┐                                │                                  │                    &#xA;c_qb_1: |0&amp;gt;──────┼──────┤ X ├──────■─────┤ X ├──────■────────■────────────────┼─────────────────■────────────────┼────────────────────&#xA;                 │      └───┘      │     └───┘      │      ┌─┴─┐            ┌─┴─┐             ┌─┴─┐            ┌─┴─┐                  &#xA;c_qb_2: |0&amp;gt;──────┼─────────────────┼────────────────┼──────┤ X ├──────■─────┤ X ├──────■──────┤ X ├──────■─────┤ X ├──────■───────────&#xA;           ┌───┐ │-pi/4 ┌───┐┌───┐ │pi/4 ┌───┐┌───┐ │-pi/4 ├───┤┌───┐ │pi/4 ├───┤┌───┐ │-pi/4 ├───┤┌───┐ │pi/4 ├───┤┌───┐ │-pi/4 ┌───┐&#xA;t_qb_0: |0&amp;gt;┤ H ├─■──────┤ H ├┤ H ├─■─────┤ H ├┤ H ├─■──────┤ H ├┤ H ├─■─────┤ H ├┤ H ├─■──────┤ H ├┤ H ├─■─────┤ H ├┤ H ├─■──────┤ H ├&#xA;           └───┘        └───┘└───┘       └───┘└───┘        └───┘└───┘       └───┘└───┘        └───┘└───┘       └───┘└───┘        └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8116" LastActivityDate="2019-09-19T21:02:38.467" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8274" PostTypeId="1" AcceptedAnswerId="8278" CreationDate="2019-09-19T22:23:16.397" Score="2" ViewCount="718" Body="&lt;p&gt;I already know how to do that for Z, Y, and H gates. How can I make a controlled sqrt-of-NOT gate? I mean the controlled version of the gate described &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Square_root_of_NOT_gate_(%E2%88%9ANOT)&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6083" LastEditorUserId="55" LastEditDate="2019-09-21T12:03:35.850" LastActivityDate="2020-08-20T05:08:16.377" Title="How to implement the controlled square root of NOT gate on the IBM Q composer?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8275" PostTypeId="2" ParentId="7219" CreationDate="2019-09-20T08:17:15.463" Score="2" Body="&lt;p&gt;In my understanding, the key part for entanglement to increase capacity is to have a suboptimal channel.&#xA;Suppose the input of you channel can take value in the set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, and note &lt;span class=&quot;math-container&quot;&gt;$G(X)$&lt;/span&gt; the graph where nodes are possible inputs and there is an edge between to inputs if the range of their corresponding output is overlapping, i.e. When going through the channel they may become the same output. In a one-shot, error free communication scheme, you can't use two linked edge. So the maximum capacity is defined by the size of the maximum independent set of &lt;span class=&quot;math-container&quot;&gt;$G(X)$&lt;/span&gt;. However you may have a really good channel with large &lt;span class=&quot;math-container&quot;&gt;$|X|$&lt;/span&gt; and low collision probabilities, but maybe only two independent inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Quantum entenglement you can somehow relax this condition and use some possible imputs that you couldn't use before, with 0 error probability! The exact scheme and conditions are described in &lt;a href=&quot;https://arxiv.org/pdf/0911.5300.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/0911.5300.pdf&lt;/a&gt; (Cubitt, Leung, Matthews and Winter)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it is the same tool that one can use with classical long block coding. In that case using for exemple Polar Coding (long blocks), you can get arbitrarily low error and capacity arbitrarily close to theoretical maximum capacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum entanglement increases 0-error, one shoot capacity only in case of an imperfect channel. It permits to uses ressources that couldn't be used otherwise. But that's also what assympotic long block coding does, so once you use let say Polar Coding, you have no &quot;unperfect ressource&quot; to improve with quantum entanglement anymore.&lt;/p&gt;&#xA;" OwnerUserId="8550" LastEditorUserId="8550" LastEditDate="2019-09-20T10:03:37.773" LastActivityDate="2019-09-20T10:03:37.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8276" PostTypeId="1" CreationDate="2019-09-20T09:45:06.983" Score="2" ViewCount="101" Body="&lt;p&gt;I would like to know if it is possible to recreate or simulate a cryptographic encryption algorithm like DES or AES using the quantum computing platform Qiskit from IBM?&lt;/p&gt;&#xA;" OwnerUserId="8554" LastEditorUserId="26" LastEditDate="2019-09-29T10:19:35.430" LastActivityDate="2019-09-29T10:19:35.430" Title="Is it possible to simulate or replicate a cryptographic algorithm using Qiskit?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8278" PostTypeId="2" ParentId="8274" CreationDate="2019-09-20T18:10:04.897" Score="3" Body="&lt;p&gt;Here's &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;one decomposition&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22Z%5E-%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3V4hJ.png&quot; alt=&quot;sqrt cnot decomp&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It was made by decomposing a controlled S (which is easier to think about because it only phases; it's diagonal) and then converting the basis of the target by conjugating with Hadamards.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22Z%5Et%22%2C%22Z%5Et%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22Z%5E-t%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;generalizes in-place&lt;/a&gt; to any &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}^{2t}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22Z%5Et%22%2C%22Z%5Et%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22Z%5E-t%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gkHtB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-09-20T18:10:04.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8280" PostTypeId="1" AcceptedAnswerId="8294" CreationDate="2019-09-21T03:01:30.913" Score="3" ViewCount="260" Body="&lt;p&gt;When creating multi-bit quantum and classical registers, what is the ordering of MSB to LSB? For instance, I created a quantum register via&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;qr = qiskit.QuantumRegister(2, name='qr')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is &lt;code&gt;qr[1]&lt;/code&gt; the MSB, or is it &lt;code&gt;qr[0]&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For an example of why I'm asking, please review the following:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;qr = qiskit.QuantumRegister(2, name='qr')&#xA;cr = qiskit.ClassicalRegister(2, name='cr')&#xA;qc = qiskit.QuantumCircuit(qr, cr)&#xA;&#xA;# Result should be Bell state (|00&amp;gt;+|11&amp;gt;)/sqrt(2)&#xA;qc.h(qreg[0])&#xA;qc.cx(qreg[0], qreg[1])&#xA;&#xA;# Result should be state |00&amp;gt;&#xA;qc.cx(qreg[0], qreg[1])&#xA;qc.h(qreg[0])&#xA;&#xA;# Result should be state |10&amp;gt;&#xA;qc.x(qreg[0])&#xA;&#xA;qc.measure(qreg, creg)&#xA;qc.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lpr4o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lpr4o.png&quot; alt=&quot;quantum circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end here I expect the quantum register to be in the state &lt;code&gt;|10&amp;gt;&lt;/code&gt;, but the histogram below shows the state &lt;code&gt;|01&amp;gt;&lt;/code&gt;. This indicates to me the MSB is the right-most bit, but I don't understand why the authors would do that. Is there some fundamental misunderstanding in my approach?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Also the example is a bit convoluted--I initialized a Bell state because that's what the input to my circuit will be, but the same result happens with just the NOT gate on &lt;code&gt;qr[0]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SMCwY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SMCwY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8560" LastEditorUserId="55" LastEditDate="2021-05-18T09:58:37.120" LastActivityDate="2021-05-18T18:56:43.757" Title="In Qiskit, when creating multi-bit quantum and classical registers, what is the ordering of MSB to LSB?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8282" PostTypeId="2" ParentId="2407" CreationDate="2019-09-21T18:06:03.733" Score="1" Body="&lt;p&gt;Your question can in parts be seen as a notational issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notation &lt;span class=&quot;math-container&quot;&gt;$[[n,k,d]]_D$&lt;/span&gt; is often (but not always) reserved for codes is of stabilizer type. As the paper by Calderbank et al shows, qubit stabilizer codes are equivalent to additive self-orthogonal GF(4)^n classical codes. This construction generalizes, see Refs. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0508070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ketkar et al.&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005008&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ashikhmin and Knill&lt;/a&gt;. Here, the dimension of the code is &lt;span class=&quot;math-container&quot;&gt;$D^k$&lt;/span&gt; for quDits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some authors use &lt;span class=&quot;math-container&quot;&gt;$((n,K,d))_D$&lt;/span&gt; to denote (stabilizer and non-stabilizer) codes that have dimension &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is then not necessarily a power of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9703002&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rains et al. &lt;/a&gt; were the first to construct a &lt;span class=&quot;math-container&quot;&gt;$((5,6,2))$&lt;/span&gt; code that is of non-stabilizer type, and which is provably better than any stabilizer code on five qubits: in comparison, the best one has parameters &lt;span class=&quot;math-container&quot;&gt;$[[5,2,2]]$&lt;/span&gt;, and is thus of dimension &lt;span class=&quot;math-container&quot;&gt;$2^2 = 4 &amp;lt; 6$&lt;/span&gt;. You'll find more examples for non-additive quantum codes in &lt;a href=&quot;https://arxiv.org/abs/0709.1780&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yu et al.&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0701065&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smolin et al.&lt;/a&gt;, and &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9703016&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grassl and Beth&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2192" LastActivityDate="2019-09-21T18:06:03.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8283" PostTypeId="1" AcceptedAnswerId="8288" CreationDate="2019-09-21T22:01:49.353" Score="4" ViewCount="192" Body="&lt;p&gt;I'm struggling with understanding a bit of basic quantum mechanics math that I was hoping someone could clarify. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have two states such as these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the right way to go about showing whether they're indistinguishable or not? I know that because these two states differ by a relative phase change that they're not the same. Should I substitute in an alternate basis like &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; for the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and then take measurements? Is showing that they're not orthogonal enough to show that they are either the same state (if they're not orthogonal) or different states (if they are orthogonal)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8568" LastEditorUserId="26" LastEditDate="2019-09-29T07:11:26.747" LastActivityDate="2019-09-29T07:11:26.747" Title="How to show whether two states are indistinguishable or not by measuring in a different basis?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8284" PostTypeId="1" AcceptedAnswerId="8343" CreationDate="2019-09-22T15:46:07.290" Score="3" ViewCount="307" Body="&lt;p&gt;It is my understanding that, given a quantum computer with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and a way to apply &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; single- and 2-qubit gates, quantum supremacy experiments&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Initialize the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits into the all-zero's ket &lt;span class=&quot;math-container&quot;&gt;$|000\cdots\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Generate a random unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; gates&lt;/li&gt;&#xA;&lt;li&gt;Apply the quantum gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to these qubits, e.g. produce the state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=U|000\cdots\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measure &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; to produce an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit classical string&lt;/li&gt;&#xA;&lt;li&gt;Measure some property the sampled string, such as a cross-entropy, and determine if quantum supremacy is achieved based on the sampled string, as compared to, say, the uniform distribution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This can be repeated multiple times.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Would a claim of quantum supremacy require applying &lt;em&gt;the same&lt;/em&gt; random unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; each time, for each sample?  Or is there a different pseudo-random &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; for each sample?  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I think I'm reading that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is broken up into a set of pseudo-random single-qubit gates, followed by a set of 2-qubit gates.  Are either or both of these fixed, or do they change for each sample?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="26" LastEditDate="2019-09-28T16:21:38.877" LastActivityDate="2019-09-28T18:34:24.903" Title="Do quantum supremacy experiments repeatedly apply the same random unitary?" Tags="&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8285" PostTypeId="1" AcceptedAnswerId="8289" CreationDate="2019-09-22T17:11:00.827" Score="3" ViewCount="89" Body="&lt;p&gt;I am referring to Exercise 7.18 of &quot;Quantum Computing and Information 10th Anniversary Edition&quot; by Nielsen and Chuang. The exercise wants me to show that the time evolution operator related to Rabi Oscillation is given by Eqn(7.77):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = e^{-iHt}\\= e^{-i\delta t}|00\rangle \langle 00| +(\cos(\Omega t)+i\frac{\delta}{\Omega}\sin(\Omega t))|01\rangle \langle 01| + \\(\cos(\Omega t)-i\frac{\delta}{\Omega}\sin(\Omega t))|10\rangle \langle 10|-i\frac{g}{\Omega}\sin\left(\Omega t\right)(|01\rangle \langle 10|+|10\rangle \langle 01|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; given as Eqn(7.76):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=-\begin{pmatrix} \delta&amp;amp;0&amp;amp;0\\0&amp;amp;\delta&amp;amp;g\\0&amp;amp;g&amp;amp;-\delta\end{pmatrix}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to work this out by splitting &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; into the sum of two parts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{-1}=-\begin{pmatrix} \delta&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix}=-H_{1}\\H_{-2}=-\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;\delta&amp;amp;g\\0&amp;amp;g&amp;amp;-\delta\end{pmatrix}=-H_{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$H_{-1}H_{-2}=0$&lt;/span&gt; and by the &lt;em&gt;Baker-Campbell-Hausdorff (BCH) Formulae&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$U = e^{-it(H_{-1}+H_{-2})}=e^{-itH_{-1}}e^{-itH_{-2}}=e^{itH_{1}}e^{itH_{2}}$&lt;/span&gt;. I then introduced &lt;span class=&quot;math-container&quot;&gt;$\Omega=\sqrt{\delta^2+g^2}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\big(\frac{H_{2}}{\Omega}\big)^2=\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}$&lt;/span&gt;. So now &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written as such:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=e^{itH_{1}}e^{it\Omega\frac{H_{2}}{\Omega}}\\&#xA;=\bigg[\sum_{m=0}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m}+\sum_{m=0}^{\infty} \frac{(-1)^m}{(2m+1)!}(it H_{1})^{2m+1}\bigg]\times \\ \bigg[\sum_{n=0}^{\infty} \frac{(-1)^n}{(2n)!}(it H_{2})^{2n}+\sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)!}(it H_{2})^{2n+1}\bigg]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are four terms in the above multiplication so I'll list down each of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^{\infty}\sum_{m=0}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m} \frac{(-1)^n}{(2n)!}(it H_{2})^{2n}\\ =\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}(it H_{2})^{2n}+\sum_{n=0}^{\infty}\sum_{m=1}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m} \frac{(-1)^n}{(2n)!}(it H_{2})^{2n}\\ =\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}(it H_{2})^{2n}+\sum_{m=1}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^{\infty}\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m)!}(it H_{1})^{2m}\frac{(-1)^n}{(2n+1)!}(it H_{2} )^{2n+1}=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)!}(it H_{2} )^{2n+1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^{\infty}\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1})^{2m+1}\frac{(-1)^n}{(2n)!}(it H_{2} )^{2n}=\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1} )^{2m+1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;\&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^{\infty}\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1} )^{2m+1}\frac{(-1)^n}{(2n+1)!}(it H_{2} )^{2n+1}=\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding the right side of each of the four terms, I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}(it\Omega \frac{H_{2}}{\Omega})^{2n}+\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)!}(it\Omega \frac{H_{2}}{\Omega})^{2n+1}\\+\sum_{m=1}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m}+\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1} )^{2m+1}&#xA;\\=\cos(\Omega t)\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}+i\frac{\sin(\Omega t)}{\Omega}\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;\delta&amp;amp;g\\0&amp;amp;g&amp;amp;-\delta\end{pmatrix} \\+\sum_{m=1}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m}+\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1} )^{2m+1} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The major problem here is the 2nd last term. The term that is supposed to sum to cosine starts with &lt;span class=&quot;math-container&quot;&gt;$m=1$&lt;/span&gt;. If I were to force the summation over &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; to start from 0, it looks like the final form of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has to subtract an Identity Matrix from it. Even so, the sign of some of the terms seem different than what is given by Eqn(7.77). But what troubles me most is the summation over &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. Is anyone patient enough to look through it and point out whats going on?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="23" LastEditDate="2019-09-22T19:27:57.887" LastActivityDate="2019-09-23T11:55:49.757" Title="Time Evolution Operator of Rabi Oscillations" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8286" PostTypeId="1" CreationDate="2019-09-23T02:16:41.967" Score="2" ViewCount="212" Body="&lt;p&gt;How do I learn Q#? What languages should I know prior to learning Q#? How do I get started with quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="8580" LastEditorUserId="26" LastEditDate="2019-09-29T07:12:06.137" LastActivityDate="2019-09-29T07:12:06.137" Title="How do I start as a quantum computing programmer?" Tags="&lt;programming&gt;&lt;resource-request&gt;&lt;q#&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8287" PostTypeId="1" AcceptedAnswerId="8291" CreationDate="2019-09-23T03:52:52.370" Score="0" ViewCount="108" Body="&lt;p&gt;When I evaluate the following equation using &lt;span class=&quot;math-container&quot;&gt;$U = ZX$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a = 0, b = 0$&lt;/span&gt; [for Bell state], I am getting LHS not equal to RHS.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Before describing the protocol, let us first review the teleportation protocol and introduce the notation used in the paper. In general, Bell states are of the following form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|B_{xy}\rangle = \frac{1}{\sqrt 2}(|0,x\rangle + (-1)^y|1, x\oplus 1\rangle),\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$x, y \in \{0, 1\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; represents addition modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. The relationship between Bell states and classical bits can be defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|B_{xy}\rangle \leftrightarrow xy, x, y \in \{0,1\} \tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For any qubit &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and any single-qubit unitary operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, a general teleportation equation, based on an initial Bell state &lt;span class=&quot;math-container&quot;&gt;$|B_{ab}\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a, b \in \{0, 1\}$&lt;/span&gt;, shared between the two users, can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\boxed{|\varphi\rangle_1 \otimes (I\otimes U)|B_{ab}\rangle_{2,3} = \frac{1}{2}\sum_{\mathrm{x\in\{0,1\}}}\sum_{\mathrm{x\in\{0,1\}}}(-1)^{b.x}|B_{x,y}\rangle_{1,2}\otimes UZ^{y\oplus b}X^{x\oplus a}|\varphi\rangle} \tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X = (|0\rangle\langle 1| + |1\rangle\langle 0|)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z = (|0\rangle\langle 0| - |1\rangle\langle 1|)$&lt;/span&gt; and the subscripts denote different systems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1907.04438&quot; rel=&quot;nofollow noreferrer&quot;&gt;Paper Reference&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-09-29T09:52:15.543" Title="Evaluate the following teleportation equation for $U = ZX$ and $a = 0, b = 0$" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8288" PostTypeId="2" ParentId="8283" CreationDate="2019-09-23T06:26:17.170" Score="4" Body="&lt;p&gt;If you wish to distinguish two states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, you can only guarantee to do this if &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\phi\rangle=0$&lt;/span&gt;. You do this by measuring in a basis defined by the two states (alternatively, you apply a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi\rangle=|0\rangle,\qquad U|\phi\rangle=|1\rangle,&#xA;$$&lt;/span&gt;&#xA;and then measure in the standard &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, provided &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi|\phi\rangle|\neq 1$&lt;/span&gt;, you can distinguish the states with some non-zero probability. There are a couple of different strategies that you can follow depending on how you want to interpret the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, to succeed with maximum probability, construct the operator &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|-|\phi\rangle\langle\phi|$&lt;/span&gt;, and construct two projectors &lt;span class=&quot;math-container&quot;&gt;$P_+$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_-$&lt;/span&gt; which project onto the positive and negative eigenspaces of that operator. When you measure using the projectors &lt;span class=&quot;math-container&quot;&gt;$P_{\pm}$&lt;/span&gt;, if you get the + answer, assume you had &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, while if you get the - answer, assume you had &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. This is known as the Helstrom measurement, and you can show it has the maximum success probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you don't want there to be any ambiguity in the result (thinking it was &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; when it was actually &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, you can use a POVM. Define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_1=p|\psi^\perp\rangle\langle\psi^\perp|,\qquad E_2=p|\phi^\perp\rangle\langle\phi^\perp|,\qquad E_3=1-E_1-E2.&#xA;$$&lt;/span&gt;&#xA;The states &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi^\perp\rangle$&lt;/span&gt; are orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; respectively. You must choose the parameter &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; to be as large as possible, but such that &lt;span class=&quot;math-container&quot;&gt;$E_3$&lt;/span&gt; has no negative eigenvalues. When you measure with these, if you get answer &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt;, you definitely did not have &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, hence you definitely had &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Similarly, if you got answer 2, you definitely had &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. However, if you get answer 3, this corresponds to a &quot;not sure&quot; answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of orthogonal states, such as your example, all these strategies are equivalent and have a probability of success of 1. You can describe the strategy either as &quot;measure in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis&quot; or &quot;apply Hadamard and measure in the standard (&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;) basis&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-23T06:26:17.170" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8289" PostTypeId="2" ParentId="8285" CreationDate="2019-09-23T06:41:45.420" Score="4" Body="&lt;p&gt;You seem to be overcomplicating this somewhat!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are right to split it up into the two terms &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;. So, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-i(H_1+H_2)t}=e^{-iH_1t}e^{-iH_2t}.&#xA;$$&lt;/span&gt;&#xA;Now, straightforwardly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iH_1t}=I+(e^{-i\delta t}-1)|00\rangle\langle 00|.&#xA;$$&lt;/span&gt;&#xA;Next, we need to think about the &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_2t}$&lt;/span&gt; term. Of course, it maps &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. So, we only have to think about the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt;. In this subspace, we have &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta Z+gX=(g,0,\delta)\cdot\vec{\sigma},&#xA;$$&lt;/span&gt;&#xA;using the Pauli matrices. Now we can use the formula we're given (except that the formula in my version of N&amp;amp;C is incorrect, with sin and cos swapped. this is in the &lt;a href=&quot;http://www.michaelnielsen.org/qcqi/errata/errata/errata.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;errata list&lt;/a&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\vec{n}\cdot\vec{\sigma}}=\cos(\Omega t)+i\sin(\Omega t)\frac{\delta Z+gX}{\Omega},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Omega=\sqrt{\vec{n}\cdot\vec{n}}=\sqrt{\delta^2+g^2}$&lt;/span&gt;. So, overall, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iH_2t}=|00\rangle\langle 00|+\cos(\Omega t)(|01\rangle\langle 01|+|10\rangle\langle 10|)-i\frac{\sin(\Omega t)}{\Omega}\left(\delta (|01\rangle\langle 01|-|10\rangle\langle 10|)+g(|01\rangle\langle 10|+|10\rangle\langle 01|)\right).&#xA;$$&lt;/span&gt;&#xA;I think, overall, this gives slightly different signs to those in equation 7.77.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-23T06:41:45.420" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8290" PostTypeId="1" AcceptedAnswerId="8295" CreationDate="2019-09-23T08:07:58.373" Score="2" ViewCount="150" Body="&lt;p&gt;I am new to the quantum world and wondering the bounds of which the technology is at the current state of the art: specifically in computing prime numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to, if possible, create a project that seeks to find Mersenne prime numbers (see &lt;a href=&quot;https://www.mersenne.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Mersenne_prime&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for more info).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there have been an &lt;a href=&quot;https://phys.org/news/2013-03-quantum-algorithm-prime.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;algorithm(s)&lt;/a&gt; proposed for finding primes, but are there any actual languages I can make use of at the current state of the art? I have &lt;a href=&quot;https://www.rigetti.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;access&lt;/a&gt; to a QPU/Lattices using the &lt;a href=&quot;http://docs.rigetti.com/en/stable/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;pyquil&lt;/a&gt; language but haven't seen anything in the documentation that does this (at least in English I understand).&lt;/p&gt;&#xA;" OwnerUserId="8570" LastEditorUserId="26" LastEditDate="2019-10-14T10:20:51.683" LastActivityDate="2019-10-14T10:20:51.683" Title="Newbie Project: Calculate a Mersenne Prime with Quantum Computing" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;rigetti&gt;&lt;pyquil&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8291" PostTypeId="2" ParentId="8287" CreationDate="2019-09-23T08:35:05.227" Score="2" Body="&lt;p&gt;There's a mistake. It's incorrect even for &lt;span class=&quot;math-container&quot;&gt;$a=0,b=0,U=I$&lt;/span&gt;. In this case the correct formula is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle \otimes |B_{00}\rangle = \frac{1}{2} \bigg(|B_{00}\rangle \otimes |\phi\rangle + |B_{01}\rangle \otimes Z|\phi\rangle + |B_{10}\rangle \otimes X|\phi\rangle + |B_{11}\rangle \otimes XZ|\phi\rangle\bigg)&#xA;$$&lt;/span&gt;&#xA;but their formula swaps &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; in the last term. &#xA;It looks like if we swap &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; terms in their formula then it will be correct (I checked on the computer). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct formula is with the swapped &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; terms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle \otimes (I \otimes U)|B_{ab}\rangle = \frac{1}{2} \bigg(\sum_{x \in \{0,1\}}\sum_{y \in \{0,1\}} (-1)^{b\cdot x}|B_{xy}\rangle \otimes UX^{x\oplus a}Z^{y\oplus b}|\phi\rangle\bigg)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used Julia programming language to check this. Note that both sides of equality are linear on &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, so we can check it only for &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi = 1$&lt;/span&gt;. Also both sides are linear on &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, so we can check equality only for &lt;span class=&quot;math-container&quot;&gt;$I, X, Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$XZ$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using LinearAlgebra&#xA;&#xA;const ⊗ = kron&#xA;const ⊕(x,y) = (x+y) % 2&#xA;&#xA;const Z = zeros(2,2) + [1 0; 0 -1]&#xA;const X = zeros(2,2) + [0 1; 1 0]&#xA;const Id = zeros(2,2) + I&#xA;&#xA;function basis(x)&#xA;  return Id[:,x+1]&#xA;end&#xA;&#xA;function bell(x,y)&#xA;  ret = zeros(4)    &#xA;  ret += basis(0) ⊗ basis(x)&#xA;  ret += (-1)^y * basis(1) ⊗ basis(x ⊕ 1)&#xA;  ret /= sqrt(2)&#xA;  return ret&#xA;end&#xA;&#xA;function check()&#xA;  for a=0:1, b=0:1, ϕ=0:1, U in [Id, X, Z, X*Z]&#xA;    lhs = basis(ϕ) ⊗ ( (Id ⊗ U) * bell(a,b) )&#xA;    rhs = zeros(8)&#xA;    for x=0:1, y=0:1&#xA;      rhs += (-1)^(b*x) * bell(x,y) ⊗ (U * X^(x⊕a) * Z^(y⊕b) * basis(ϕ))&#xA;    end&#xA;    rhs /= 2&#xA;    err = norm(lhs - rhs)    &#xA;    println(err)&#xA;  end  &#xA;end&#xA;&#xA;check()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this check is numerical, though one can also try to use symbolic math packages, like SymPy. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-09-24T14:44:54.933" LastActivityDate="2019-09-24T14:44:54.933" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8292" PostTypeId="2" ParentId="8285" CreationDate="2019-09-23T11:41:09.873" Score="1" Body="&lt;p&gt;In the first summation for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}(it\Omega \frac{H_{2}}{\Omega})^{2n}=\cos(\Omega t)\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}(\text{This is wrong})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}(it\Omega \frac{H_{2}}{\Omega})^{2n}=\begin{pmatrix} 1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix}+\cos(\Omega t)\begin{pmatrix} 0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}(\text{This is correct})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mentioned that &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; starts summing from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; so I will force it to sum from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, which in this case indeed I have to subtract an Identity Matrix. This will result in an exponential of &lt;span class=&quot;math-container&quot;&gt;$H_{1}$&lt;/span&gt; subtract an Identity whereby the steps will look like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{m=1}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m}+\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1} )^{2m+1}\\=\sum_{m=0}^{\infty} \frac{(-1)^m}{(2m)!}(it H_{1})^{2m}+\sum_{m=0}^{\infty}\frac{(-1)^m}{(2m+1)!}(it H_{1} )^{2m+1}-\begin{pmatrix} 1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}\\=\begin{pmatrix} e^{i\delta t}&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}-\begin{pmatrix} 1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;1\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding everything up including the &lt;span class=&quot;math-container&quot;&gt;$sin(\Omega t)$&lt;/span&gt; term will give the correct expression except for maybe some sign issues.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="5253" LastEditDate="2019-09-23T11:55:49.757" LastActivityDate="2019-09-23T11:55:49.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8293" PostTypeId="2" ParentId="8286" CreationDate="2019-09-23T11:52:13.820" Score="-2" Body="&lt;p&gt;I'm not familiar with q#, but I have used &lt;a href=&quot;https://qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit&lt;/a&gt; extensively. Qiskit is a python package supported by IBM, so obviously you need to know python. There are many tutorials and instructive Jupyter notebooks on the qiskit syntax and even some basic quantum mechanics. A &lt;a href=&quot;https://community.qiskit.org/textbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit based textbook&lt;/a&gt; was just released. I haven't read it yet, but maybe you'll find it useful. Lastly, linear algebra is the language of qubits. You will want to have a solid understanding of linear algebra.&lt;/p&gt;&#xA;" OwnerUserId="8420" LastActivityDate="2019-09-23T11:52:13.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8294" PostTypeId="2" ParentId="8280" CreationDate="2019-09-23T15:25:12.393" Score="1" Body="&lt;p&gt;Pulling from another question (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8244/big-endian-vs-little-endian-in-qiskit&quot;&gt;Big Endian vs. Little Endian in Qiskit&lt;/a&gt;) and their documentation (&lt;a href=&quot;https://qiskit.org/textbook/ch-appendix/qiskit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-appendix/qiskit.html&lt;/a&gt;), it appears that the register is intentionally labeled right-to-left so that integers are intuitively represented. Consider your example, where you applied X(qr[0]):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ |00\rangle \rightarrow |01\rangle $&lt;/span&gt;, which is &amp;quot;1&amp;quot; as an integer. &lt;span class=&quot;math-container&quot;&gt;$1 = 2^0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There example used X(qr[7]) on an 8 qubit register:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ |00000000\rangle \rightarrow |10000000\rangle = 32 = 2^7 $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="15119" LastEditDate="2021-05-18T08:11:16.167" LastActivityDate="2021-05-18T08:11:16.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8295" PostTypeId="2" ParentId="8290" CreationDate="2019-09-23T15:37:18.957" Score="3" Body="&lt;p&gt;It's likely that this algorithm hasn't yet been implemented in QISKit / Q# / pyquil etc. It's also important to note that you would not be discovering new Mersenne primes with a quantum computer - the &lt;a href=&quot;https://arxiv.org/pdf/1302.6245.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper referenced&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We propose a quantum circuit that creates a pure state corresponding to the quantum superposition of all prime numbers less than &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits of the register.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Even with new quantum computers, this might only amount to &lt;span class=&quot;math-container&quot;&gt;$ 2^{73} $&lt;/span&gt;, at best. And, there's no guarantee that these quantum computers will have the required coherence times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't mean that it would be a waste to implement this algorithm - any contribution to a quantum programming language (QISKit / Q# / pyquil) is welcomed! But this algorithm won't be beating classical computers anytime soon.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-09-23T15:37:18.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8296" PostTypeId="2" ParentId="8286" CreationDate="2019-09-23T16:04:39.993" Score="3" Body="&lt;p&gt;To get started with quantum computing in general, you need to start by learning some of the theory behind it - unlike classical programming, you don't have any intuition about what is going on from your previous experiences, so jumping right into programming might be a bit too steep. There are a lot of resources out there to help you with this, you might want to check out other questions tagged with &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/resource-request&quot;&gt;resource-request&lt;/a&gt; or the &lt;a href=&quot;https://github.com/desireevl/awesome-quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Awesome Quantum Computing list&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For Q#, here are the resources you might want to start with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://docs.microsoft.com/quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;Official documentation&lt;/a&gt;, including a &lt;a href=&quot;https://docs.microsoft.com/quantum/concepts/&quot; rel=&quot;nofollow noreferrer&quot;&gt;brief review of quantum computing concepts&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Microsoft/QuantumKatas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas&lt;/a&gt; - self-paced programming exercises and tutorials designed to accompany a course on quantum computing theory. Each kata consists of a set of exercises of increasing complexity for you to solve and a behind-the-scenes testing harness which checks whether your code is correct, providing you immediate feedback, so I believe they are a great way to learn (&lt;em&gt;disclaimer: I am the primary maintainer of the Quantum Katas project&lt;/em&gt;).&lt;br&gt;&#xA;The existing katas cover a nice set of introductory topics, and we are working on more tutorials bridging the gap between &quot;not knowing anything about quantum computing&quot; and &quot;knowing enough to solve first exercises&quot; - check back in two-three weeks :-)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/ebraminio/awesome-qsharp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Awesome Q# list&lt;/a&gt; lists a variety of other resources, including blogs, videos, standalone tutorials and even a book!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Finally, I don't think it's as important what programming language you know before learning Q# as just knowing some programming language. C# and Python come to mind first, since they both allow to run Q# from them (you'll need a classical program to invoke quantum code), but you don't need them to start solving the katas.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-09-23T16:04:39.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8297" PostTypeId="2" ParentId="8286" CreationDate="2019-09-23T16:26:50.840" Score="4" Body="&lt;p&gt;Probably the first big reference I would highlight is &lt;a href=&quot;https://qsharp.community/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qsharp.community&lt;/a&gt;. Its a community org where we work on projects and collecting learning materials for Q#. Contributions are always welcome, so just make a PR on a repo or hop on the &lt;a href=&quot;https://gitter.im/qsharp-community/community&quot; rel=&quot;nofollow noreferrer&quot;&gt;gitter&lt;/a&gt; and say hi!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll also add that I am working on a textbook that is currently in Early Access called &lt;a href=&quot;https://bit.ly/qsharp-book&quot; rel=&quot;nofollow noreferrer&quot;&gt;Learn Quantum Computing with Python and Q#&lt;/a&gt;. It is intended for folks who want to learn how to program for a quantum computer, and learn the basics of how a quantum computer works along the way. Only knowledge prerequisites are programming in some language (Python helps but not really required) and a bit of linear algebra (multiple matrices and vectors sort of stuff). My co-author @chris-granade and I would love feedback on what is currently out on the forums associated with the book, and there are discount codes floating around for conferences and podcasts and such, hmu and I can help find one for ya!&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2019-09-23T16:26:50.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8298" PostTypeId="2" ParentId="6317" CreationDate="2019-09-23T18:30:29.407" Score="4" Body="&lt;p&gt;&lt;strong&gt;We should generally think of QASM as agnostic to timing&lt;/strong&gt;. Time is not represented anywhere in a quantum circuit diagram. The wires between circuit operations simply represent a quantum state. I could move the CNOTs as far to the right as I want in your diagram, or generally modify any spacing between any operations however I like, and the circuits would be exactly equivalent. It's analogous to beads on a multi-chain necklace. The necklace is only different when we add new operations, or change the order of operations. For this reason, it's perfectly acceptable for the printed QASM output to be &quot;misleading&quot; about timing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Time is a lower level construct. IBM's OpenPulse framework is the system for which asking these kinds of questions is more defined. Nonetheless, your questions do have answers.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;How does scheduling work on IBM devices?&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;If you would like to see some concrete code, IBM backends follow a scheduling procedure similar to what is implemented in this PR as the &lt;code&gt;&quot;as_late_as_possible&quot;&lt;/code&gt; (ALAP) method: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/2650&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/2650&lt;/a&gt; (It will be merged once a constraint on the backend is relaxed.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In words, this scheduling procedure is roughly to reverse the circuit, schedule operations greedily, and then reverse again. This ALAP scheduling can improve fidelity by maximizing the time that qubits remain in the ground state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Keep in mind that IBM does &lt;strong&gt;not&lt;/strong&gt; promise to schedule circuits this way. It is totally up to the respective backend/provider to decide how they want to schedule QASM operations. If the backends added an extra 10ns delay between every operation, that is totally within their right. Only in OpenPulse can you expect any real guarantee about the timing of the program execution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming scheduling &lt;em&gt;does&lt;/em&gt; happen as described, let's think about how your circuit will be scheduled. Since qubits 0 and 1 are separate from qubit 3, as late as possible and as soon as possible scheduling is identical: it's just greedily scheduled. (I don't think the ending time is aligned.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your example would be more interesting if we add a global (across qubits 0, 1, 3) measure. The measure will be scheduled across all qubits at the same time. Then, ALAP is indeed different than ASAP. The timing would be:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CNOT q0 q1 @ t=0&#xA;CNOT q0 q1 @ t=758ns&#xA;MEASURE q0 q1 q3 @ t=1516ns&#xA;(solve for the H times backwards)&#xA;H q3 @ t=1156ns&#xA;H q3 @ t=1276ns&#xA;H q3 @ t=1396ns&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I said circuits are timing agnostic, but we can use barriers to make &lt;em&gt;requests&lt;/em&gt; to the compiler to add timing constraints. Barriers are pragmas (info for the compiler), not operations. It depends on the compiler to actually respect your request. If you want the Hadamards to be aligned with the CNOTs, you could use barriers:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = ClassicalRegister(14, 'c')&#xA;circ = QuantumCircuit(q, c)&#xA;circ.cx(q[1], q[0])&#xA;circ.h(q[3])&#xA;circ.barrier(q[0], q[3])&#xA;&#xA;circ.cx(q[1], q[0])&#xA;circ.h(q[3])&#xA;circ.barrier(q[0], q[3])&#xA;&#xA;circ.h(q[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, given that the compiler listens to your request and still uses the ALAP scheduling method, the first H would play at t=(758-120)ns=638ns, the second would play at t=(1516-120)ns=1396ns, and the third would play at t=1516ns. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Answers to questions&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;1) The first H and the first CNOT both play at t=0, the remaining H are scheduled with no extra delays (i.e. at t=120ns and t=140ns).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) There are a couple ways. You could try to calculate the circuit runtime using &lt;code&gt;backend.properties()&lt;/code&gt; and adding up &lt;code&gt;gate_length&lt;/code&gt;s if they are provided. If you have access to an OpenPulse enabled device, you can checkout the scheduler branch I linked and check the &lt;code&gt;duration&lt;/code&gt; property on the resulting schedule. There has also been discussion to add this as a circuit feature: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/2749&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/2749&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) If I understand correctly, I think this goes back to the idea that timing is not acknowledged by &lt;code&gt;QuantumCircuit&lt;/code&gt;s or by QASM -- it doesn't get translated or represented.&lt;/p&gt;&#xA;" OwnerUserId="7755" LastActivityDate="2019-09-23T18:30:29.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8299" PostTypeId="1" AcceptedAnswerId="8307" CreationDate="2019-09-23T18:59:08.363" Score="-2" ViewCount="187" Body="&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(2,'qr')&#xA;cr = ClassicalRegister(2,'cr')&#xA;circ = QuantumCircuit(qr,cr)&#xA;&#xA;circ.x(qr[0])&#xA;circ.measure(qr,cr)&#xA;&#xA;provider = IBMQ.get_provider(group = 'open')&#xA;backends = provider.get_backend(['ibmqx2', 'ibmq_16_melbourne', 'ibmq_vigo', 'ibmq_ourense'])&#xA;job = execute(circ, backend=backends, shots=1024) &#xA;job_monitor(job, interval = 5)&#xA;&#xA;result = job.result()&#xA;counts = result.get_counts(circ)&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I run my quantum code on more than one backend at the same time?&lt;/p&gt;&#xA;" OwnerUserId="8586" LastEditorUserId="26" LastEditDate="2019-09-29T10:42:34.007" LastActivityDate="2019-09-29T10:42:34.007" Title="Running jobs on different backends at the same time" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8300" PostTypeId="1" CreationDate="2019-09-24T04:09:39.637" Score="3" ViewCount="686" Body="&lt;p&gt;I have tried it with decomposing controlled S then conjugating with H gate. But I want to construct it using a minimum number of gates.&lt;/p&gt;&#xA;" OwnerUserId="8548" LastEditorUserId="55" LastEditDate="2020-05-29T07:38:59.680" LastActivityDate="2020-08-25T06:46:10.710" Title="How can we construct a square root of NOT gate in Qiskit and IBMQ circuit composer using universal gates?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8301" PostTypeId="2" ParentId="8300" CreationDate="2019-09-24T08:10:12.487" Score="0" Body="&lt;p&gt;Use &lt;code&gt;u3&lt;/code&gt; function and rotate by an angle of 90 degrees.&lt;/p&gt;&#xA;" OwnerUserId="4206" LastEditorUserId="26" LastEditDate="2019-09-29T10:15:43.433" LastActivityDate="2019-09-29T10:15:43.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8302" PostTypeId="1" CreationDate="2019-09-24T10:31:24.900" Score="1" ViewCount="118" Body="&lt;p&gt;I've been reading &lt;a href=&quot;https://arxiv.org/abs/1701.02691&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; in order to understand how to implement a VQE on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equation 38 involves the imaginary part of &#xA;&lt;span class=&quot;math-container&quot;&gt;$ \langle\psi_0 |V_k^{j\dagger}(t)O_iU(t)|\psi_0\rangle $&lt;/span&gt; and they show the circuit (figure 3) for finding it. I don't understand how this circuit works and why it finds the imaginary part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate if someone could explain each part of the circuit or forward me to a source which explains this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, why is the measurement of the ancilla qubit happening in the Y basis and why is the &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi/2)$&lt;/span&gt; gate making sure that the measurement is in the Y basis? &lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="26" LastEditDate="2019-09-29T09:28:19.707" LastActivityDate="2019-09-29T09:28:19.707" Title="Variational Quantum Eigensolver (VQE) - Question about finding the imaginary part of measurement" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8304" PostTypeId="1" AcceptedAnswerId="8306" CreationDate="2019-09-24T10:34:03.283" Score="2" ViewCount="139" Body="&lt;p&gt;I have executed an experiment using IBMQ and receive a &lt;code&gt;Result&lt;/code&gt; object.&#xA;I am writing the ASCII repr of the result with &lt;code&gt;f.write(res)&lt;/code&gt; into a file and see a line like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Result(backend_name='ibmq_16_melbourne', backend_version='1.1.0',...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I reconstruct the Result object from that line? Which methods do I have to call?&lt;/p&gt;&#xA;" OwnerUserId="8592" LastEditorUserId="26" LastEditDate="2019-09-29T09:08:25.007" LastActivityDate="2019-09-29T09:08:25.007" Title="How to unpickle a Result object returned by an IBMQ experiment?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8305" PostTypeId="2" ParentId="8304" CreationDate="2019-09-24T11:20:19.483" Score="1" Body="&lt;p&gt;You could recreate the object by reading the parameters and then creating a new result object &lt;code&gt;result = Result(parameters)&lt;/code&gt;. You can see the method that does this &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/97cf6771378df9f132a88e27ed4e21586aa1befb/qiskit/result/result.py#L27&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have access to the account that submitted the job you can also simply retrieve the job from the backend again using &lt;code&gt;get_job()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-09-24T11:20:19.483" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8306" PostTypeId="2" ParentId="8304" CreationDate="2019-09-24T12:51:03.720" Score="3" Body="&lt;p&gt;I found a solution:&#xA;to serialise instead of &lt;code&gt;print(res)&lt;/code&gt; I need to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(res.to_dict())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To load the serialized string (eg. &lt;code&gt;line&lt;/code&gt; from a file)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dict = eval(line)&#xA;res = Result.from_dict(dict)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;all of the above with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.result import Result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8592" LastEditorUserId="55" LastEditDate="2019-09-24T14:17:42.923" LastActivityDate="2019-09-24T14:17:42.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8307" PostTypeId="2" ParentId="8299" CreationDate="2019-09-24T13:36:19.777" Score="1" Body="&lt;p&gt;You would need to send a job to each backend you want to run on. For example, if you wanted to send to &lt;code&gt;ibmqx2&lt;/code&gt; and &lt;code&gt;ibmq_ourense&lt;/code&gt; you could execute code similar to this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend_1 = provider.get_backend('ibmqx2')&#xA;backend_2 = provider.get_backend('ibmq_ourense')&#xA;&#xA;job_1 = execute(circuit, backend_1)  # Sends a job to run on ibmqx2&#xA;job_2 = execute(circuit, backend_2)  # Sends a job to run on ibmq_ourense&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can then get the results from each job normally:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result_1 = job_1.result().get_counts(circuit)&#xA;result_2 = job_2.result().get_counts(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-09-24T13:36:19.777" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8308" PostTypeId="1" AcceptedAnswerId="8309" CreationDate="2019-09-25T05:59:51.417" Score="1" ViewCount="187" Body="&lt;p&gt;I have a circuit where I only use 3 qubits but need to utilize hundreds of classical registers. My questions are: what is the maximum number of classical bits on the current IBM Qs? What is the quantum computer with the highest number of classical bits right now that is available for researchers and the public?&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="7598" LastEditDate="2020-07-12T07:31:21.340" LastActivityDate="2020-07-12T07:31:21.340" Title="How many classical registers are there on (IBM) quantum computers?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8309" PostTypeId="2" ParentId="8308" CreationDate="2019-09-25T07:18:01.623" Score="1" Body="&lt;p&gt;As far as I am aware you can have as many &lt;code&gt;ClassicalRegister&lt;/code&gt;s as you need, assuming they fit in the memory of the classical device controlling the Quantum Computer. I would suggest trying to reuse them if possible if you are concerned about this!&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-09-25T07:18:01.623" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8310" PostTypeId="1" CreationDate="2019-09-25T08:08:54.547" Score="3" ViewCount="58" Body="&lt;p&gt;Is there a quantum algorithm allowing to determine the state with the highest probability of occurring (i.e. highest square amplitude), more efficiently than repeatedly measuring and estimating a histogram?&lt;/p&gt;&#xA;" OwnerUserId="8598" LastEditorUserId="55" LastEditDate="2019-09-28T16:44:28.400" LastActivityDate="2019-09-28T16:44:28.400" Title="Is there a quantum algorithm allowing to efficiently determine the state with the highest probability of occurring?" Tags="&lt;algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8312" PostTypeId="2" ParentId="8310" CreationDate="2019-09-25T09:28:04.950" Score="1" Body="&lt;p&gt;Yes. It is, for instance, part of Grover's algorithm and to be precise it is the 'Amplitude Amplification' part. &lt;span class=&quot;math-container&quot;&gt;$2| \psi \rangle \langle \psi | - I$&lt;/span&gt;, which will increase the amplitudes by&#xA;their difference from the average&lt;/p&gt;&#xA;" OwnerUserId="2561" LastActivityDate="2019-09-25T09:28:04.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8313" PostTypeId="2" ParentId="2688" CreationDate="2019-09-25T10:09:44.537" Score="1" Body="&lt;p&gt;I think your confusion starts at the point where you refer to 'amplitude of the qubit'. The amplitude of a qubit is constant and always 1. When you measure it, you will always get a quantity of &quot;1&quot;. Basically, this is the Bloch sphere: the qubit can point to any point on the surface of the sphere, so it has radius (amplitude) of 1. Amplitude amplification does not apply to this aspect but applies on another level.&#xA;The qubit in general has a state that is a linear combination of the base states: &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;. The coefficients &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are the amplitudes of the base states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, respectively. And because the 'amplitude of the qubit' is always 1 the condition &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2=1$&lt;/span&gt; must hold.&#xA;If we apply an amplitude magnification to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and, for instance favor the base state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then this process should result in an increase of &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; and, consequently, to a decrease in &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2561" LastActivityDate="2019-09-25T10:09:44.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8314" PostTypeId="2" ParentId="8308" CreationDate="2019-09-25T10:45:44.333" Score="1" Body="&lt;p&gt;Why do you need so many classical registers? One usually only uses them to catch the measurement at the end of the quantum algorithm; one for every qubit. If you do repeated measurements and intend to store statistics in separate classical registers, then you can better repeat the whole experiment. There is also on option to keep individual result of every single experiment (memory=true). Your quantum code is part of a larger whole where you mix classical and quantum computing. In the classical code (probably python) you can store any amount of data in standard facilities like lists.&lt;/p&gt;&#xA;" OwnerUserId="2561" LastActivityDate="2019-09-25T10:45:44.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8315" PostTypeId="1" AcceptedAnswerId="8316" CreationDate="2019-09-25T13:04:02.610" Score="-1" ViewCount="51" Body="&lt;p&gt;Let A has quantum memories &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; and B has quantum memories &lt;span class=&quot;math-container&quot;&gt;$M_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_4$&lt;/span&gt; capable of holding one qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 Bell states are shared among A &amp;amp; B in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First Bell state &lt;span class=&quot;math-container&quot;&gt;$|B_{00}\rangle$&lt;/span&gt; has been shared among &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_3$&lt;/span&gt;. &#xA;Second Bell state &lt;span class=&quot;math-container&quot;&gt;$|B_{00}\rangle $&lt;/span&gt; has been shared among &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_4$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume all calculations are in Bell basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate the Bell states of A[&lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt;] and B[&lt;span class=&quot;math-container&quot;&gt;$M_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_4$&lt;/span&gt;]?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="26" LastEditDate="2019-09-29T07:14:17.083" LastActivityDate="2019-09-29T07:14:17.083" Title="Find the Bell States of A and B in the following scenario" Tags="&lt;entanglement&gt;&lt;bell-experiment&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8316" PostTypeId="2" ParentId="8315" CreationDate="2019-09-25T15:46:59.157" Score="3" Body="&lt;p&gt;Simply start by writing out everything&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|B_{00}\rangle_{13}|B_{00}\rangle_{24}=\frac12\left(|00\rangle_{13}|00\rangle_{24}+|00\rangle|11\rangle+|11\rangle|00\rangle+|11\rangle|11\rangle\right)&#xA;$$&lt;/span&gt;&#xA;Let me rearrange each of these terms&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12\left(|00\rangle_{12}|00\rangle_{34}+|01\rangle|01\rangle+|10\rangle|10\rangle+|11\rangle|11\rangle\right).&#xA;$$&lt;/span&gt;&#xA;Now you can use the fact that the Bell states form a basis to rewrite each of those terms, although maybe it helps to notice that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle_{12}|00\rangle_{34}+|11\rangle|11\rangle=|B_{00}\rangle|B_{00}\rangle+|B_{01}\rangle|B_{01}\rangle&#xA;$$&lt;/span&gt;&#xA;Hence, we get a final answer of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12\left(|B_{00}\rangle|B_{00}\rangle+|B_{01}\rangle|B_{01}\rangle+|B_{10}\rangle|B_{10}\rangle+|B_{11}\rangle|B_{11}\rangle\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-25T15:46:59.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8317" PostTypeId="1" CreationDate="2019-09-25T16:48:11.080" Score="-1" ViewCount="1208" Body="&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; bits there are &lt;span class=&quot;math-container&quot;&gt;$2^4=16$&lt;/span&gt; combinations. How many combinations can you have with &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits (assuming they are all superimposed)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per &lt;a href=&quot;https://www.youtube.com/watch?v=JhHMJCUmq28&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, the argument is that if a qubit can hold more information when it's measurement(probability) is collapsed to give a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (assuming measurement is without errors). For a superimposed qubit holding two values at the same time depending on how it has been encoded i.e. as per the parallel measurement (probably in a quantum gate) we could get &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$|01\rangle $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$11\rangle$&lt;/span&gt;. I am seeing this as if observed in parallelism 4 qubits would yield a combination (&lt;span class=&quot;math-container&quot;&gt;$2^8$&lt;/span&gt;) of 8 classical bits (i.e. n qubits having  &lt;span class=&quot;math-container&quot;&gt;$2^{n+n}$&lt;/span&gt; number of combinations in parallel). Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="8605" LastEditorUserId="26" LastEditDate="2019-09-29T09:24:58.770" LastActivityDate="2019-09-29T16:45:02.427" Title="How many combinations can 'n' qubits have?" Tags="&lt;quantum-state&gt;&lt;superposition&gt;" AnswerCount="4" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8319" PostTypeId="2" ParentId="8317" CreationDate="2019-09-25T17:59:52.717" Score="1" Body="&lt;p&gt;Well, it's still &lt;span class=&quot;math-container&quot;&gt;$2^4 = 16$&lt;/span&gt; I believe. The point of superposition is that these 16 combinations can encode 16 inputs, and with something called &quot;quantum parallelism&quot; they can be calculated simutaneously. Even though they don't give out all &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; results simultaneouly, the result can be manipulated in various ways to give you what you need while drastically reduce the running time, compare to a similar process done on a classical computer.&lt;/p&gt;&#xA;" OwnerUserId="7598" LastActivityDate="2019-09-25T17:59:52.717" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8321" PostTypeId="2" ParentId="8317" CreationDate="2019-09-26T06:10:32.757" Score="2" Body="&lt;p&gt;This depends on precisely what you mean by &quot;combinations&quot;. Let's go back to just one qubit to be clear. For one qubit, there are two classical states, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. These are really the only things you can count. Of course, as a qubit, you are allowed &lt;em&gt;any&lt;/em&gt; superposition of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha|0\rangle+\beta|1\rangle,\qquad |\alpha|^2+|\beta|^2=1.&#xA;$$&lt;/span&gt;&#xA;This is a continuum of possibilties that you cannot count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for four qubits, there are &lt;span class=&quot;math-container&quot;&gt;$2^4=16$&lt;/span&gt; classical states, &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle, |0001\rangle,\ldots,|1111\rangle$&lt;/span&gt;, and this is the only thing you can really count. Again, because it's a quantum system, you can have an arbitrary superposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x\in\{0,1\}^4}c_x|x\rangle,\qquad\sum_{x\in\{0,1\}^4}|c_x|^2=1,&#xA;$$&lt;/span&gt;&#xA;but it is also a continuum of possibilities that you cannot count.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-26T06:10:32.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8322" PostTypeId="2" ParentId="8302" CreationDate="2019-09-27T08:46:50.213" Score="1" Body="&lt;p&gt;Measurements cannot produce an imaginary result. So if you want to measure an imaginary part, you need a suitable transformation before you measure. I haven't looked into the details of the mentioned operations but I'm sure that is what they do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the last part of your question: the operation &lt;span class=&quot;math-container&quot;&gt;$R_x (\pi /2)$&lt;/span&gt; can be visualized on the Bloch sphere by a quarter clockwise turn around the x-axis. How does this help? If you start with Y-basis vectors (one pointing to the right and the other pointing to the left on the Bloch sphere) above operation transforms them to the Z-axis basis vectors (one pointing up and the other pointing down). So then the standard (Z-basis) measurement is able to distinguish the original Y-basis vectors.&lt;/p&gt;&#xA;" OwnerUserId="2561" LastActivityDate="2019-09-27T08:46:50.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8323" PostTypeId="2" ParentId="8317" CreationDate="2019-09-27T09:17:15.563" Score="1" Body="&lt;p&gt;As other have said, you can see 4 qubits as having either 16 different combinations, or as continuum-many superpositions of these combinations. (Continuum-many means &quot;the cardinality of the real numbers&quot;) However you can also ask about the dimension of the space, whcich is a different notion of size.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A single qbit is described by a vector in a 2-dimensional Hilbert space, so that you need 2 complex numbers to describe it. Equivalently, you need 4 real numbers.&#xA;However, since the norm of the qubit has to be 1, you in fact only need 3 real numbers. But also a global phase is irrelevent ! So only 2 real numbers are needed to describe a qubit. That's why you can position it on the Bloch sphere, which is a real two dimensional space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With 4 qubits you're in a Hilbert space of dimension 2*4 = 8. Hence you need at first glance 16 real numbers. But in fact, considering that a global phase doesn't matter and the norm must be 1, you only need 14 real dimensions to describe it.&lt;/p&gt;&#xA;" OwnerUserId="8550" LastEditorUserId="8550" LastEditDate="2019-09-27T13:07:48.670" LastActivityDate="2019-09-27T13:07:48.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8325" PostTypeId="1" CreationDate="2019-09-27T15:13:53.767" Score="2" ViewCount="190" Body="&lt;p&gt;I am using QAOA to solve maxcut problem. It takes a very long time to simulate 10 qubits and I never get the results. Is there a way to simulate faster for larger qubit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;seed = 50&#xA;&#xA;cobyla = COBYLA()&#xA;cobyla.set_options(maxiter=250)&#xA;qaoa = QAOA(qubitOp, cobyla, 3)&#xA;qaoa.random_seed = seed&#xA;&#xA;quantum_instance = QuantumInstance(backend=backend,seed_transpiler=seed,skip_qobj_validation=False)&#xA;&#xA;result = qaoa.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8586" LastEditorUserId="55" LastEditDate="2019-09-28T19:12:19.587" LastActivityDate="2019-10-02T20:16:30.607" Title="QAOA Maxcut for larger qubits" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8326" PostTypeId="1" CreationDate="2019-09-27T18:05:12.787" Score="8" ViewCount="917" Body="&lt;p&gt;I need to make a general implementation of Shor's algorithm that factors, at least, N = 15. I have been able to perform an implementation that works in simulators, with ProjectQ, but when running it on a real quantum computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have decided to try it using Qiskit. Currently, I'm trying to find the first implementations in Qiskit, to see if it's possible to do what I want because I already doubt it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried, among others, whit &lt;a href=&quot;https://github.com/ttlion/ShorAlgQiskit&quot; rel=&quot;noreferrer&quot;&gt;these implementations&lt;/a&gt;. Also with IBM's &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/algorithms/single_sample/shor/shor.py&quot; rel=&quot;noreferrer&quot;&gt;own implementation&lt;/a&gt;. But either they use too many qubits 4n+2, which for N = 15 would be 18 qubits, and the public quantum computer with more qubits has only 14, or they use several measurements in the same qubit, which is not supported by IBM quantum computers. Now, I just want to know if it is possible to do what I want with current computers and how. I have read many papers, but their conclusions and methods are not supported by the current publicly available quantum computers, or the maximum N that they can factor is less than 15.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance. Greetings.&lt;/p&gt;&#xA;" OwnerUserId="8626" LastEditorUserId="8626" LastEditDate="2019-09-29T19:39:41.353" LastActivityDate="2020-08-05T06:56:38.713" Title="Is it possible to run a general implementation Shor's algorithm on a real IBM quantum computer at least for N = 15?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8327" PostTypeId="2" ParentId="8284" CreationDate="2019-09-27T19:58:42.107" Score="2" Body="&lt;p&gt;In the Sycamore paper linked in the comments, in the description of FIG. 4, the authors state:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;...For each &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, each instance is sampled with &lt;span class=&quot;math-container&quot;&gt;$N_s$&lt;/span&gt; between 0.5 M and 2.5 M... For &lt;span class=&quot;math-container&quot;&gt;$m=20$&lt;/span&gt;, obtaining 1M samples on the quantum processor takes 200 seconds, while an equal fidelity classical sampling would take 10,000 years on 1M cores, and verifying the fidelity would take millions of years.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thus, it is clear that the authors of the Sycamore paper repeatedly apply the same unitary each time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking about it now this makes sense, you would need to sample more than once to be able to accurately estimate the fidelity of your samples.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-09-27T19:58:42.107" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8328" PostTypeId="1" CreationDate="2019-09-27T20:13:39.047" Score="1" ViewCount="87" Body="&lt;p&gt;If someone wanted to pinpoint the seminal reference on the subject of quantum computing, what would it be?  Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8616" LastEditorUserId="26" LastEditDate="2019-09-29T06:59:58.830" LastActivityDate="2019-09-29T06:59:58.830" Title="What is the seminal reference for quantum computing?" Tags="&lt;resource-request&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-10-01T21:56:48.007" ContentLicense="CC BY-SA 4.0" />
  <row Id="8329" PostTypeId="1" CreationDate="2019-09-27T21:13:34.437" Score="4" ViewCount="376" Body="&lt;p&gt;How can I create a custom gate in qiskit that is plotted using latex formatting (or another type of formatting)? For example the following code generates a circuit diagram&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit import Gate&#xA;&#xA;qc = QuantumCircuit(1, 1)&#xA;qc.append(Gate(name=r'X_t', num_qubits=1, params=[]), [0])&#xA;qc.measure([0, ], [0,])&#xA;qc.draw(output='latex', interactive=False, filename='test.png')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The custom gate is labelled as X_t, but I want the name to be formatted as an X with subscript t. I tried variations as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.append(Gate(name=r'&lt;span class=&quot;math-container&quot;&gt;$X_t$&lt;/span&gt;', num_qubits=1, params=[]), [0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but that does not work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: reported on github as well &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/3171&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8627" LastEditorUserId="8627" LastEditDate="2019-09-30T09:34:51.770" LastActivityDate="2019-09-30T12:09:15.713" Title="How to plot custom gate labels in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8330" PostTypeId="1" CreationDate="2019-09-27T22:00:42.467" Score="3" ViewCount="235" Body="&lt;p&gt;Let&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$        \rho = \begin{bmatrix} .7738 &amp;amp; -.0556 \\ -.0556 &amp;amp; .0040 \end{bmatrix} , &#xA;        \sigma = \begin{bmatrix} .9454 &amp;amp; -.2273 \\ -.2273 &amp;amp; .0546 \end{bmatrix} \\$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is an operator of mixed states and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is a density operator from a pure state. I can calculate entropy of them individually. But can I calculate the relative entropy between them? I am not sure about what it would mean. Anyways, considering the definition of relative entropy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\rho || \sigma) = \mathrm{tr}(\rho  \log (\rho)) - \mathrm{tr}(\rho \log ( \sigma))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that I can calculate the entropy of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; from it's eigenvalues. But here I can't use the eigenvalue approach, can I? I have to take the logarithm I think. But there is no logarithm for &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; in matlab. What can I do in this sort of cases?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2021-01-05T11:38:00.517" LastActivityDate="2021-01-05T11:38:00.517" Title="How do I compute the Relative Entropy between pure and mixed states?" Tags="&lt;density-matrix&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8332" PostTypeId="2" ParentId="8328" CreationDate="2019-09-28T00:11:23.927" Score="2" Body="&lt;p&gt;&lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; by Nielsen and Chuang.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2019-09-28T00:11:23.927" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8333" PostTypeId="1" CreationDate="2019-09-28T06:48:31.543" Score="0" ViewCount="35" Body="&lt;p&gt;Just to report that the notebook &quot;&lt;a href=&quot;https://quantum-computing.ibm.com/jupyter/tutorial/fundamentals/4_quantum_circuit_properties.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Properties&lt;/a&gt;&quot; under the Tutorial uses a circuit named &lt;code&gt;qc2&lt;/code&gt; but afterwards the sample code still uses the &lt;code&gt;qc&lt;/code&gt; circuit rather than &lt;code&gt;qc2&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8629" LastEditorUserId="26" LastEditDate="2019-09-29T06:57:39.860" LastActivityDate="2019-09-29T06:57:39.860" Title="Quantum Circuit Properties typo (documentation bug?)" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8334" PostTypeId="1" CreationDate="2019-09-28T07:07:15.787" Score="-1" ViewCount="90" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XuRqd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XuRqd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When running my code, sometimes I find this &lt;code&gt;524 Server Error: Origin Time-out for url&lt;/code&gt; and then my code stop. The error is in &lt;code&gt;job_monitor&lt;/code&gt;? And how can I solve it?&lt;/p&gt;&#xA;" OwnerUserId="8272" LastEditorUserId="26" LastEditDate="2019-10-09T06:37:42.857" LastActivityDate="2019-10-09T06:37:42.857" Title="What is ''524 Server Error''?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8335" PostTypeId="2" ParentId="8333" CreationDate="2019-09-28T11:02:09.527" Score="3" Body="&lt;p&gt;Great to see you are engaging with the tutorials! I have had a look and I think this is deliberate, I believe that &lt;code&gt;qc2&lt;/code&gt; is only introduced to demonstrate one type of circuit. The notebook then goes on to create circuits &lt;code&gt;qc3&lt;/code&gt; and &lt;code&gt;qc4&lt;/code&gt; to demonstrate other concepts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you find any other bugs please report them to the &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;Git repo&lt;/a&gt; by creating a new &lt;code&gt;Issue&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-09-28T11:02:09.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8336" PostTypeId="2" ParentId="8329" CreationDate="2019-09-28T11:06:56.083" Score="1" Body="&lt;p&gt;I don't think that this is currently possible with Qiskit, could you please add this as an &lt;code&gt;Enhancement&lt;/code&gt; to the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub repo&lt;/a&gt;? This is done by creating an &lt;code&gt;Issue&lt;/code&gt; and then selecting that it is an &lt;code&gt;Enhancement&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-09-28T11:06:56.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8337" PostTypeId="1" AcceptedAnswerId="8377" CreationDate="2019-09-28T14:23:48.683" Score="11" ViewCount="668" Body="&lt;p&gt;I was recently going through the paper titled &lt;a href=&quot;https://drive.google.com/file/d/19lv8p1fB47z1pEZVlfDXhop082Lc-kdD/view&quot; rel=&quot;noreferrer&quot;&gt;&quot;Quantum supremacy using a programmable superconducting processor&quot;&lt;/a&gt; by NASA Ames Research Centre and the Google Quantum AI team (note that the paper was originally posted on the &lt;a href=&quot;https://ntrs.nasa.gov/search.jsp?R=20190030475&quot; rel=&quot;noreferrer&quot;&gt;NASA NTRS&lt;/a&gt; but later removed for unknown reasons; here's the &lt;a href=&quot;https://www.reddit.com/r/Physics/comments/d7s3ov/quantum_supremacy_using_a_programmable/&quot; rel=&quot;noreferrer&quot;&gt;Reddit discussion&lt;/a&gt;). It believe they're referring to &quot;quantum supremacy&quot; in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/68/26&quot;&gt;&quot;quantum ascendency&quot;&lt;/a&gt; sense. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In their 54 qubit &lt;strong&gt;Sycamore&lt;/strong&gt; processor, they created a 53 qubit quantum circuit using a random selection of gates from the set &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X}, \sqrt{Y}, \sqrt{W}\}$&lt;/span&gt; in the following pattern:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fMIXS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fMIXS.png&quot; alt=&quot;FIG 3.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;sup&gt;&lt;strong&gt;FIG 3. Control operations for the quantum supremacy circuits. a,&lt;/strong&gt; Example quantum circuit instance used in our&#xA;  experiment. Every cycle includes a layer each of single- and two-qubit gates. The single-qubit gates are chosen randomly from &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt X, \sqrt Y, \sqrt W\}$&lt;/span&gt;. The sequence of two-qubit gates are chosen according to a tiling pattern, coupling each qubit sequentially to&#xA;  its four nearest-neighbor qubits. The couplers are divided into four subsets (ABCD), each of which is executed simultaneously&#xA;  across the entire array corresponding to shaded colors. Here we show an &lt;strong&gt;intractable sequence&lt;/strong&gt; (repeat ABCDCDAB); we also&#xA;  use different coupler subsets along with a &lt;strong&gt;simplifiable sequence&lt;/strong&gt; (repeat EFGHEFGH, not shown) that can be simulated on a&#xA;  classical computer. &lt;strong&gt;b,&lt;/strong&gt; Waveform of control signals for single- and two-qubit gates.&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They also show some plots in FIG 4, apparently proving their claim of quantum supremacy. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YNhrr.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YNhrr.png&quot; alt=&quot;FIG 4.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;sup&gt;&lt;strong&gt;FIG. 4. Demonstrating quantum supremacy. a,&lt;/strong&gt; Verification of benchmarking methods. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; values for patch, elided, and full verification circuits are calculated from measured bitstrings and the corresponding probabilities predicted by classical simulation. Here, the two-qubit gates are applied in a &lt;strong&gt;simplifiable tiling&lt;/strong&gt; and sequence such that the full circuits can be simulated out to &lt;span class=&quot;math-container&quot;&gt;$n = 53, m = 14$&lt;/span&gt; in a reasonable amount of time. Each data point is an average over 10 distinct quantum circuit instances that differ in their single-qubit gates (for &lt;span class=&quot;math-container&quot;&gt;$n = 39, 42, 43$&lt;/span&gt; only 2 instances were simulated). For each &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, each instance is sampled with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;s between &lt;span class=&quot;math-container&quot;&gt;$0.5 M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2.5 M$&lt;/span&gt;. The black line shows predicted &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; based on single- and two-qubit gate and measurement errors. The close correspondence between all four curves, despite their vast differences in complexity, justifies the use of elided circuits to estimate fidelity in the supremacy regime. &lt;strong&gt;b,&lt;/strong&gt; Estimating &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; in the quantum supremacy regime. Here, the two-qubit gates are applied in a &lt;strong&gt;non-simplifiable tiling&lt;/strong&gt; and sequence for which it is much harder to simulate. For the largest&#xA;  elided data (&lt;span class=&quot;math-container&quot;&gt;$n = 53$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, total &lt;span class=&quot;math-container&quot;&gt;$N_s = 30 M$&lt;/span&gt;), we find an average &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB} &amp;gt; 0.1\%$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$5\sigma$&lt;/span&gt; confidence, where &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; includes both systematic and statistical uncertainties. The corresponding full circuit data, not simulated but archived, is expected to show similarly significant fidelity. For &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, obtaining &lt;span class=&quot;math-container&quot;&gt;$1M$&lt;/span&gt; samples on the quantum processor takes 200 seconds, while an equal fidelity classical sampling would take 10,000 years on &lt;span class=&quot;math-container&quot;&gt;$1M$&lt;/span&gt; cores, and verifying the fidelity would take millions of years.&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h3&gt;Question:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Why did they specifically choose the gate set &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X}, \sqrt{Y}, \sqrt{W}\}$&lt;/span&gt;? &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(X+Y)/\sqrt 2$&lt;/span&gt; as per the &lt;a href=&quot;https://drive.google.com/file/d/1-7_CzhOF7wruqU_TKltM2f8haZ_R3aNb/view&quot; rel=&quot;noreferrer&quot;&gt;supplementary material&lt;/a&gt;. Also, why are they using randomly generated circuits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/5322/marsl&quot;&gt;@Marsl&lt;/a&gt; says &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8284/do-quantum-supremacy-experiments-repeatedly-apply-the-same-random-unitary?noredirect=1&amp;amp;lq=1#comment11003_8284&quot;&gt;here&lt;/a&gt; that: &quot;In case you are confused by the need for a &lt;strong&gt;random&lt;/strong&gt; unitary, it needs to be random in order to avoid that the classical sampler trying to reproduce the right prob. distribution can &lt;em&gt;adapt to the particular unitary&lt;/em&gt;. Basically, if I wanted build a classical sampling algorithm that solves the problem for any unitary you hand over to me (or a description of the circuit), then the randomness assures that my sampler has to be &quot;general-purpose&quot;, I have to design it such that it works well for any instance!&quot; It not clear to me what they mean by &quot;adapt&quot;-ing to some particular unitary in this context.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Sequel(s):&lt;/strong&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8341/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 2): simplifiable and intractable tilings&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8342/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 3): sampling&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-30T01:41:39.833" LastActivityDate="2019-11-05T18:43:31.080" Title="Understanding Google's “Quantum supremacy using a programmable superconducting processor” (Part 1): choice of gate set" Tags="&lt;quantum-gate&gt;&lt;superconducting-quantum-computing&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8338" PostTypeId="5" CreationDate="2019-09-28T16:24:30.733" Score="0" Body="&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Main Paper: &lt;a href=&quot;https://drive.google.com/file/d/19lv8p1fB47z1pEZVlfDXhop082Lc-kdD/view&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Supremacy Using a Programmable&#xA;Superconducting Processor&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Supplementary Material: &lt;a href=&quot;https://drive.google.com/file/d/1-7_CzhOF7wruqU_TKltM2f8haZ_R3aNb/view&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supplementary information for “Quantum supremacy using a programmable superconducting processor”&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-29T06:53:45.377" LastActivityDate="2019-09-29T06:53:45.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8339" PostTypeId="4" CreationDate="2019-09-28T16:24:30.733" Score="0" Body="A 54-qubit superconducting quantum processor by Google Quantum AI which is claimed to have been used to demonstrate quantum computational supremacy. " OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-29T06:54:29.830" LastActivityDate="2019-09-29T06:54:29.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8340" PostTypeId="2" ParentId="8310" CreationDate="2019-09-28T16:42:24.303" Score="0" Body="&lt;p&gt;It looks like you want an algorithm that, given a state of the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\alpha|\ge|\beta|$&lt;/span&gt;, gives back &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability greater than &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think this is possible.&#xA;Indeed, say such a mapping &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; existed. This &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; must be such that the probability of finding &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\psi)$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[\mathbb P_0\mathcal E(\psi)]$&lt;/span&gt;, is greater than &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$|\alpha|\ge|\beta|$&lt;/span&gt;, while at the same time &#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[\mathbb P_1\mathcal E(\psi)]\ge |\beta|^2$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$|\beta|\ge|\alpha|$&lt;/span&gt;.&#xA;In other words, this map would have to satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned}&#xA;\mathrm{Tr}[\mathbb P_0\mathcal E(\psi)]&amp;amp;\ge |\alpha|^2,\quad\text{if }|\alpha|\ge1/2\\&#xA;\mathrm{Tr}[\mathbb P_0\mathcal E(\psi)]&amp;amp;\le |\alpha|^2,\quad\text{if }|\alpha|\le1/2.&#xA;\end{aligned}&lt;/span&gt;&#xA;Note that I'm using the shorthand notation &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_\psi\equiv|\psi\rangle\!\langle\psi|$&lt;/span&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider how such a &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; would have to act on the input &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|0\rangle$&lt;/span&gt;. The only way to satisfy the above relations is to have &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\psi)=\mathcal E(\mathbb P_0)=\mathbb P_0$&lt;/span&gt;, and similarly &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\mathbb P_1)=\mathbb P_1$&lt;/span&gt;. But this, by linearity, fully characterises &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;, forcing it to equal the identity operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, no, you cannot have an algorithm which magically amplifies the amplitude of the state with the largest probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this argument relies on the fact that &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; &lt;em&gt;cannot&lt;/em&gt; contain knowledge about the state to be amplified. If you instead ask for an algorithm which amplifies the amplitude of a target state, then this is possible, and it's called amplitude amplification, as has already been mentioned in the other answers.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-09-28T16:42:24.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8341" PostTypeId="1" AcceptedAnswerId="8351" CreationDate="2019-09-28T16:55:09.953" Score="8" ViewCount="676" Body="&lt;p&gt;In Google's 54 qubit &lt;strong&gt;Sycamore&lt;/strong&gt; processor, they created a 53 qubit quantum circuit using a random selection of gates from the set &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X}, \sqrt{Y}, \sqrt{W}\}$&lt;/span&gt; in the following pattern:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fMIXS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fMIXS.png&quot; alt=&quot;FIG 3.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;sup&gt;&lt;strong&gt;FIG 3. Control operations for the quantum supremacy circuits. a,&lt;/strong&gt; Example quantum circuit instance used in our&#xA;  experiment. Every cycle includes a layer each of single- and two-qubit gates. The single-qubit gates are chosen randomly from &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt X, \sqrt Y, \sqrt W\}$&lt;/span&gt;. The sequence of two-qubit gates are chosen according to a tiling pattern, coupling each qubit sequentially to&#xA;  its four nearest-neighbor qubits. The couplers are divided into four subsets (ABCD), each of which is executed simultaneously&#xA;  across the entire array corresponding to shaded colors. Here we show an &lt;strong&gt;intractable sequence&lt;/strong&gt; (repeat ABCDCDAB); we also&#xA;  use different coupler subsets along with a &lt;strong&gt;simplifiable sequence&lt;/strong&gt; (repeat EFGHEFGH, not shown) that can be simulated on a&#xA;  classical computer. &lt;strong&gt;b,&lt;/strong&gt; Waveform of control signals for single- and two-qubit gates.&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They also show some plots in FIG 4, apparently proving their claim of quantum supremacy. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YNhrr.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YNhrr.png&quot; alt=&quot;FIG 4.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;sup&gt;&lt;strong&gt;FIG. 4. Demonstrating quantum supremacy. a,&lt;/strong&gt; Verification of benchmarking methods. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; values for patch, elided, and full verification circuits are calculated from measured bitstrings and the corresponding probabilities predicted by classical simulation. Here, the two-qubit gates are applied in a &lt;strong&gt;simplifiable tiling&lt;/strong&gt; and sequence such that the full circuits can be simulated out to &lt;span class=&quot;math-container&quot;&gt;$n = 53, m = 14$&lt;/span&gt; in a reasonable amount of time. Each data point is an average over 10 distinct quantum circuit instances that differ in their single-qubit gates (for &lt;span class=&quot;math-container&quot;&gt;$n = 39, 42, 43$&lt;/span&gt; only 2 instances were simulated). For each &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, each instance is sampled with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;s between &lt;span class=&quot;math-container&quot;&gt;$0.5 M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2.5 M$&lt;/span&gt;. The black line shows predicted &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; based on single- and two-qubit gate and measurement errors. The close correspondence between all four curves, despite their vast differences in complexity, justifies the use of elided circuits to estimate fidelity in the supremacy regime. &lt;strong&gt;b,&lt;/strong&gt; Estimating &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; in the quantum supremacy regime. Here, the two-qubit gates are applied in a &lt;strong&gt;non-simplifiable tiling&lt;/strong&gt; and sequence for which it is much harder to simulate. For the largest&#xA;  elided data (&lt;span class=&quot;math-container&quot;&gt;$n = 53$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, total &lt;span class=&quot;math-container&quot;&gt;$N_s = 30 M$&lt;/span&gt;), we find an average &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB} &amp;gt; 0.1\%$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$5\sigma$&lt;/span&gt; confidence, where &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; includes both systematic and statistical uncertainties. The corresponding full circuit data, not simulated but archived, is expected to show similarly significant fidelity. For &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, obtaining &lt;span class=&quot;math-container&quot;&gt;$1M$&lt;/span&gt; samples on the quantum processor takes 200 seconds, while an equal fidelity classical sampling would take 10,000 years on &lt;span class=&quot;math-container&quot;&gt;$1M$&lt;/span&gt; cores, and verifying the fidelity would take millions of years.&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do the terms &lt;strong&gt;simplifiable tiling&lt;/strong&gt; and &lt;strong&gt;non-simplifiable (intractable) tiling&lt;/strong&gt; mean in this context? They're calling the sequence  &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCDCDAB}$&lt;/span&gt; intractable whereas they're calling &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGHEFGH}$&lt;/span&gt;. It's not clear what they mean by that. What are the terms &lt;span class=&quot;math-container&quot;&gt;$\mathrm{A, B, C, D}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{E, F, G, H}$&lt;/span&gt; anyway? I mean, I understand that they're two-qubit gates (couplers), but are the gates &lt;span class=&quot;math-container&quot;&gt;$\{\mathrm{A, B, C, D}\}$&lt;/span&gt; &lt;em&gt;different&lt;/em&gt; from the gates &lt;span class=&quot;math-container&quot;&gt;$\{\mathrm{E, F, G, H}\}$&lt;/span&gt; or do they mean that they're the same gates arranged in a different sequence? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also which exact types of 2-qubit gates can be used in this case? Can I replace all of A, B, C, D (or E, F, G, H) by CNOT gates? Or are only specific categories of two-qubit gates allowed? If yes, what are those?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Prequel(s)&lt;/strong&gt;:&lt;/sup&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8337/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 1): choice of gate set&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Sequel(s)&lt;/strong&gt;:&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8342/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 3): sampling&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-28T17:11:50.960" LastActivityDate="2020-02-23T14:24:37.363" Title="Understanding Google's “Quantum supremacy using a programmable superconducting processor” (Part 2): simplifiable and intractable tilings" Tags="&lt;quantum-gate&gt;&lt;superconducting-quantum-computing&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8342" PostTypeId="1" AcceptedAnswerId="8344" CreationDate="2019-09-28T16:56:13.670" Score="5" ViewCount="552" Body="&lt;p&gt;In Google's 54 qubit &lt;strong&gt;Sycamore&lt;/strong&gt; processor, they created a 53 qubit quantum circuit using a random selection of gates from the set &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X}, \sqrt{Y}, \sqrt{W}\}$&lt;/span&gt; in the following pattern:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fMIXS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fMIXS.png&quot; alt=&quot;FIG 3.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;sup&gt;&lt;strong&gt;FIG 3. Control operations for the quantum supremacy circuits. a,&lt;/strong&gt; Example quantum circuit instance used in our&#xA;  experiment. Every cycle includes a layer each of single- and two-qubit gates. The single-qubit gates are chosen randomly from &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt X, \sqrt Y, \sqrt W\}$&lt;/span&gt;. The sequence of two-qubit gates are chosen according to a tiling pattern, coupling each qubit sequentially to&#xA;  its four nearest-neighbor qubits. The couplers are divided into four subsets (ABCD), each of which is executed simultaneously&#xA;  across the entire array corresponding to shaded colors. Here we show an &lt;strong&gt;intractable sequence&lt;/strong&gt; (repeat ABCDCDAB); we also&#xA;  use different coupler subsets along with a &lt;strong&gt;simplifiable sequence&lt;/strong&gt; (repeat EFGHEFGH, not shown) that can be simulated on a&#xA;  classical computer. &lt;strong&gt;b,&lt;/strong&gt; Waveform of control signals for single- and two-qubit gates.&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They also show some plots in FIG 4, apparently proving their claim of quantum supremacy. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YNhrr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YNhrr.png&quot; alt=&quot;FIG 4.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;sup&gt;&lt;strong&gt;FIG. 4. Demonstrating quantum supremacy. a,&lt;/strong&gt; Verification of benchmarking methods. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; values for patch, elided, and full verification circuits are calculated from measured bitstrings and the corresponding probabilities predicted by classical simulation. Here, the two-qubit gates are applied in a &lt;strong&gt;simplifiable tiling&lt;/strong&gt; and sequence such that the full circuits can be simulated out to &lt;span class=&quot;math-container&quot;&gt;$n = 53, m = 14$&lt;/span&gt; in a reasonable amount of time. Each data point is an average over 10 distinct quantum circuit instances that differ in their single-qubit gates (for &lt;span class=&quot;math-container&quot;&gt;$n = 39, 42, 43$&lt;/span&gt; only 2 instances were simulated). For each &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, each instance is sampled with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;s between &lt;span class=&quot;math-container&quot;&gt;$0.5 M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2.5 M$&lt;/span&gt;. The black line shows predicted &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; based on single- and two-qubit gate and measurement errors. The close correspondence between all four curves, despite their vast differences in complexity, justifies the use of elided circuits to estimate fidelity in the supremacy regime. &lt;strong&gt;b,&lt;/strong&gt; Estimating &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB}$&lt;/span&gt; in the quantum supremacy regime. Here, the two-qubit gates are applied in a &lt;strong&gt;non-simplifiable tiling&lt;/strong&gt; and sequence for which it is much harder to simulate. For the largest&#xA;  elided data (&lt;span class=&quot;math-container&quot;&gt;$n = 53$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, total &lt;span class=&quot;math-container&quot;&gt;$N_s = 30 M$&lt;/span&gt;), we find an average &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\mathrm{XEB} &amp;gt; 0.1\%$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$5\sigma$&lt;/span&gt; confidence, where &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; includes both systematic and statistical uncertainties. The corresponding full circuit data, not simulated but archived, is expected to show similarly significant fidelity. For &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, obtaining &lt;span class=&quot;math-container&quot;&gt;$1M$&lt;/span&gt; samples on the quantum processor takes 200 seconds, while an equal fidelity classical sampling would take 10,000 years on &lt;span class=&quot;math-container&quot;&gt;$1M$&lt;/span&gt; cores, and verifying the fidelity would take millions of years.&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In FIG 4 caption there's this sentence: &quot;For &lt;span class=&quot;math-container&quot;&gt;$m = 20$&lt;/span&gt;, obtaining 1M samples on the quantum processor takes 200 seconds, while an equal&#xA;fidelity classical sampling would take 10,000 years on 1M cores, and verifying the fidelity would take millions of years&quot;. What does &quot;obtaining samples&quot; mean in this context? Are they saying that in 200 seconds their quantum processor executed the circuit 1M times (as in 1M &quot;shots&quot;) and they consequently measured the output state vector 1M times? Or something else?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More importantly, I don't really understand the overall claim in the paper. Is the paper (FIG 4 caption) saying that for some random unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (over 53 qubits and 20 cycles), a classical computer would take 10,000 years to calculate the resultant state vector &lt;span class=&quot;math-container&quot;&gt;$|\Psi_U\rangle$&lt;/span&gt;?  As far as I understand, determining the final state vector is simply matrix multiplication that scales as &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(n^3)$&lt;/span&gt; (in this context, &lt;span class=&quot;math-container&quot;&gt;$n=2^{\text{total number of qubits}}$&lt;/span&gt;) in general (or lesser, depending on the algorithm used). Is it claiming that a classical computer would take 10,000 years to perform that matrix multiplication, and so using a quantum computer would be more efficient in this case?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Prequel(s)&lt;/strong&gt;:&lt;/sup&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8337/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 1): choice of gate set&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8341/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 2): simplifiable and intractable tilings&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;strong&gt;Related:&lt;/strong&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8284/do-quantum-supremacy-experiments-repeatedly-apply-the-same-random-unitary/8327&quot;&gt;Do quantum supremacy experiments repeatedly apply the same random unitary?&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-30T01:42:17.997" LastActivityDate="2019-09-30T01:42:17.997" Title="Understanding Google's “Quantum supremacy using a programmable superconducting processor” (Part 3): sampling" Tags="&lt;quantum-gate&gt;&lt;superconducting-quantum-computing&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8343" PostTypeId="2" ParentId="8284" CreationDate="2019-09-28T16:59:46.517" Score="3" Body="&lt;p&gt;Generally speaking, to prove quantum supremacy, you don't &lt;em&gt;need&lt;/em&gt; to sample several times from the same unitary/circuit/output probability distribution. If you extract even a single sample from the output probability distribution of a circuit which you know is extremely hard to simulate classically, then you already achieved something that you couldn't do (efficiently) classically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because these are &lt;em&gt;sampling problems&lt;/em&gt;. Such problems are not about estimating some property of some output probability distribution, but rather simply about the sampling itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The caveat in this is that, in practice, just observing one output state from a given circuit wouldn't look all that great an achievement. In other words, one needs to gather enough &quot;circumstantial evidence&quot; to manage to convince most people that the claim is solid and legit. This often includes actually retrieving some statistical features of the distribution, which allows checking that the distribution was indeed the intended one. It is, however, important to realise that the problem is &lt;em&gt;not&lt;/em&gt; that of computing such features, but rather only that of &lt;em&gt;sampling&lt;/em&gt; from the underlying probability distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion, to more directly address some of the points raised: &lt;em&gt;one&lt;/em&gt; unitary sampled &lt;em&gt;once&lt;/em&gt; is, &lt;em&gt;in principle&lt;/em&gt;, enough. But one wants to gather enough evidence to make the claim as solid as possible, and for this it is useful to do things like estimating properties of the experimental output distribution.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-09-28T18:34:24.903" LastActivityDate="2019-09-28T18:34:24.903" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8344" PostTypeId="2" ParentId="8342" CreationDate="2019-09-28T17:16:11.643" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does &quot;obtaining samples&quot; mean in this context?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The same thing it means in a more classical context. Consider the probability distribution of the possible outcomes of a (possibly biased) coin flip. &lt;em&gt;Sampling&lt;/em&gt; from this probability distributions means to flip the coin once and record the result (head or tail). If you sample many times, you can retrieve better and better estimates of the underlying probability distribution, fully characterising it in the limit of infinite samples collected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the context of quantum supremacy experiments, the sampling refers to the probability distribution at the output of the circuit/experiment. Given a circuit modelled by a unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt;, fixing an input state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, and fixing a measurement choice (say the computational basis), you get a probability distribution over the possible outputs: &lt;span class=&quot;math-container&quot;&gt;$p_{\boldsymbol j}\equiv|\langle \boldsymbol j|\mathcal U|\psi_i\rangle|^2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\boldsymbol j\rangle\equiv|j_1,...,j_n\rangle$&lt;/span&gt;  denotes a possible output state (a possible sequence of ones and zeros).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sampling from the circuit then means to sample from this &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol p$&lt;/span&gt;; to repeat the same experiment multiple times and record the outcomes.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;re they saying that in 200 seconds their quantum processor executed the circuit 1M times (as in 1M &quot;shots&quot;) and they consequently measured the output state vector 1M times? Or something else?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sort of. They are not &quot;measuring the output state vector&quot;, as that would require to do tomography of the output state. Rather, if the output state &lt;span class=&quot;math-container&quot;&gt;$|\psi_o\rangle$&lt;/span&gt; expands in the computational basis as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_o\rangle=\sum_{\boldsymbol j}c_{\boldsymbol j}|\boldsymbol j\rangle,$$&lt;/span&gt;&#xA;what they are doing is observing which of the &lt;span class=&quot;math-container&quot;&gt;$|\boldsymbol j\rangle$&lt;/span&gt; comes out of the experiment, and &quot;writing down&quot; the sequence of such observed events.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the paper (FIG 4 caption) saying that for some random unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (over 53 qubits and 20 cycles), a classical computer would take 10,000 years to calculate the resultant state vector &lt;span class=&quot;math-container&quot;&gt;$|\Psi_U\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, as per the above, not quite. They are &lt;em&gt;not&lt;/em&gt; calculating &lt;span class=&quot;math-container&quot;&gt;$|\Psi_U\rangle$&lt;/span&gt;, but rather only &lt;em&gt;sampling&lt;/em&gt; from its associated probability distribution. To actually compute the state would require tomography, which would be even harder (indeed, I'm not sure about the specific result underlying this experiment, but in other similar scenarios one can show that not even a quantum computer can reconstruct efficiently the output state). Retrieving the output state is a harder task than just sampling from it.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the overarching claim of the paper that a classical computer would not be able to &quot;calculate&quot; the theoretical noise-free &quot;probability distribution&quot; by simple matrix multiplication (in any reasonable time-frame)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Indeed, these quantum supremacy experiments rely on such classical hardness results. Actually, it is not even that you can prove that classical computers cannot efficiently &lt;em&gt;compute&lt;/em&gt; the output probability distribution of these IQP circuits, but rather that they cannot even &lt;em&gt;sample&lt;/em&gt; from these probability distributions. You might try to have a look at the references in Appendix VII (page S8) of &lt;a href=&quot;https://arxiv.org/abs/1709.06678&quot; rel=&quot;noreferrer&quot;&gt;Neill et al.&lt;/a&gt; for the relevant papers and results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;em&gt;sampling&lt;/em&gt; from a distribution is a much easier task than computing it. To understand this, consider the trivial example of sampling from the output distribution of a &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt;-qubit circuit which solely consists of Hadamard gates applied at each qubit. In this case, the output probability distribution is the uniform distribution: each output configuration &lt;span class=&quot;math-container&quot;&gt;$|\boldsymbol j\rangle$&lt;/span&gt; is equally likely. &lt;em&gt;Sampling&lt;/em&gt; from such a thing is trivial: just have your classical computer draw &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; random bits and you're done. However, &lt;em&gt;computing&lt;/em&gt; the probability distribution would require to store &lt;span class=&quot;math-container&quot;&gt;$2(2^{50}-1)\sim 2\times 10^{15}$&lt;/span&gt; real numbers, which while still doable, is clearly much harder.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now imagine what happens in a less trivial example in which there are actual non-trivial entangling gates in the circuit: to compute the output state you will need to perform a number of operations on these giant-dimensional vectors &lt;span class=&quot;math-container&quot;&gt;${}^{(1)}$&lt;/span&gt;. On the other hand, the quantum device solves the sampling task naturally: you just look at the output of the device.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As far as I understand, determining the final state vector is simply matrix multiplication that scales as &lt;span class=&quot;math-container&quot;&gt;$O(n^3)$&lt;/span&gt; (in this context, &lt;span class=&quot;math-container&quot;&gt;$n=2\times\text{total number of qubits}$&lt;/span&gt;) in general (or lesser, depending on the algorithm used). Is it claiming that a classical computer would take 10,000 years to perform that matrix multiplication, and so using a quantum computer would be more efficient in this case?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They are. I mean, you say &quot;just &lt;span class=&quot;math-container&quot;&gt;$n^3$&lt;/span&gt;&quot;, but this means to operate with vectors of dimension &lt;span class=&quot;math-container&quot;&gt;$\sim(2^{50})^3\sim 2^{150}\sim 10^{45}$&lt;/span&gt;. Try to create a list of this dimension with your preferred programming language and see how fast your laptop crashes! They mention in page 5 in the paper how they managed to use a &lt;span class=&quot;math-container&quot;&gt;$250 \mathrm{TB}$&lt;/span&gt; device to store up just to &lt;span class=&quot;math-container&quot;&gt;$43$&lt;/span&gt; qubits, which I think shows quite well the hardness of the task. Mind you, one can use other data types to store this kind of states, e.g. exploiting the sparseness of the states, and this is why, as mentioned in the caption you transcribed, the number of cycles increase the hardness. At each cycle, the state is spanning larger and larger sections of the Hilbert space, thus becoming less sparse and making it harder to use tricks to simulate the behaviour of the system.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I guess I'm confused about what they really mean by &quot;classical sampling&quot; as compared to &quot;Sycamore sampling&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&quot;Classical sampling&quot; means that you have a program that gives you a sequence of configurations (length-&lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; bitstrings) &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol j$&lt;/span&gt; according to the correct probability distribution. &quot;Sycamore sampling&quot; means that they are using their physical device to achieve this, and thus do not need to bother with computing anything, but instead just need to observe the output of their device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More explicitly, suppose you have a &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit circuit. Three samples from the output probability distributions could be the following three bitstrings:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$10111, 11111, 00010.$$&lt;/span&gt;&#xA;Being able to produce these three bitstrings is &lt;em&gt;not&lt;/em&gt; the same as being able to produce the set of &lt;span class=&quot;math-container&quot;&gt;$2^5-1$&lt;/span&gt; real numbers that are the probabilities of each occurrence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you write as &quot;Sycamore sampling&quot;, is exactly the same thing. The problem is still that of producing a number of samples such as the above ones. But now you don't need a classical computer to run an algorithm to produce them, using directly the quantum device instead. This will evolve a quantum system in some way, and then you measure the qubits at the end and you find, for each experimental run, a configuration of five bits.&#xA;You repeat the experiment three times, and you get three samples like the above ones.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;(1) Note that, for the sake of exposition, I might be giving the impression here that to solve the sampling problem classically one needs to compute and store in memory the full probability distribution. While this is the naive way to do it, there are better ways. The computational complexity results rule out more generally that the sampling is classically hard, and make no reference to actually computing the probability distribution.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-09-28T18:46:39.750" LastActivityDate="2019-09-28T18:46:39.750" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="8345" PostTypeId="2" ParentId="8317" CreationDate="2019-09-28T18:50:40.390" Score="1" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8319/26&quot;&gt;&lt;strong&gt;@D. Tran&lt;/strong&gt;'s answer&lt;/a&gt; and for anyone out there (just in case),  &lt;a href=&quot;https://www.quora.com/What-exactly-is-a-qubit-and-how-does-it-work&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; did it for me. &lt;br&gt;&lt;br&gt;The first mistake I made was that I kept on thinking superimposed qubits could only hold &lt;code&gt;0s&lt;/code&gt; and &lt;code&gt;1s&lt;/code&gt; as pairs (&lt;em&gt;2 states&lt;/em&gt;) i.e. say for &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt; qubits I thought it was equivalent of ##-##-## (e.g. &lt;em&gt;01-11-01&lt;/em&gt; which is just &lt;span class=&quot;math-container&quot;&gt;$2^{n+n}$&lt;/span&gt; combinations at max) but it turned out a superimposed qubit can represent  multiple states and each of these can be represented by complex numbers on a &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;.&lt;br&gt;&lt;br&gt;The second thing that got me confused again was that I thought because &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits could store all combinations (&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;)  for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits at once (from the video in the question's &lt;strong&gt;EDIT&lt;/strong&gt;), it meant this was the limit of  &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and thus I was trying so hard to relate the confusion and the mistake. &lt;br&gt;&lt;br&gt;&lt;br&gt;At least now that I am aware qubits can represent multiple states which can employ &quot;quantum parallelism&quot; to store all combinations of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical bits I'd argue a single qubit &lt;strong&gt;can&lt;/strong&gt; be used to represent information for more complex-numbers/digits while a bit can only represent a binary digit.&lt;/p&gt;&#xA;" OwnerUserId="8605" LastEditorUserId="8605" LastEditDate="2019-09-29T16:45:02.427" LastActivityDate="2019-09-29T16:45:02.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8346" PostTypeId="5" CreationDate="2019-09-28T19:13:30.277" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-09-28T19:13:30.277" LastActivityDate="2019-09-28T19:13:30.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8347" PostTypeId="4" CreationDate="2019-09-28T19:13:30.277" Score="0" Body="For questions about the Quantum Approximate Optimization Algorithm (QAOA), first introduced in Farhi, Goldstone, Gutmann 2014 (https://arxiv.org/abs/1411.4028)." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-09-28T19:13:30.277" LastActivityDate="2019-09-28T19:13:30.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8348" PostTypeId="1" AcceptedAnswerId="8423" CreationDate="2019-09-28T21:44:33.077" Score="4" ViewCount="217" Body="&lt;p&gt;The Sycamore paper from Google notes that Sycamore is a &lt;span class=&quot;math-container&quot;&gt;$54$&lt;/span&gt;-qubit quantum processor, but for their experiments only &lt;span class=&quot;math-container&quot;&gt;$53$&lt;/span&gt; qubits were working.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;bad&quot; qubit was on the edge of the array.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this just good fortune?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, if the &quot;bad&quot; qubit were in the middle of the array, would that have made processing more difficult?  How many Sycamore processors are made at any given time?  Are they fabricated on a wafer as an integrated circuit? Do they pick-and-choose the Sycamore chip with the best performing array of qubits?  etc.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="26" LastEditDate="2019-09-29T16:48:26.067" LastActivityDate="2019-10-30T18:44:28.970" Title="Location of &quot;bad&quot; qubits on Sycamore" Tags="&lt;architecture&gt;&lt;google-sycamore&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8349" PostTypeId="2" ParentId="8329" CreationDate="2019-09-29T02:49:41.777" Score="2" Body="&lt;p&gt;The problem seems to stem from the &lt;code&gt;utf8tolatex&lt;/code&gt; parsing in the &lt;code&gt;pylatexenc.latexencode&lt;/code&gt; package, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/visualization/latex.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;line 370 here&lt;/a&gt;.  Use of this function is not yet depreciated, but it is &lt;a href=&quot;https://pylatexenc.readthedocs.io/en/latest/latexencode/#pylatexenc.latexencode.utf8tolatex&quot; rel=&quot;nofollow noreferrer&quot;&gt;discouraged&lt;/a&gt;, and it has the unfortunate behavior of escaping the underscore, changing &lt;code&gt;'X_t'&lt;/code&gt; to &lt;code&gt;'X{\\_}t'&lt;/code&gt; (this is already inserted into the latex source in a math environment, so no need for &lt;code&gt;$...$&lt;/code&gt;).  A flag to disable this parsing and pass the string directly to &lt;code&gt;\\gate{%s}&lt;/code&gt; would be very nice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the mpl plots have a style dict kwarg structure, so that you can arbitrarily change the default name mapping with a JSON style sheet. Unfortunately, the latex plots ignore these style sheets and the mapping is hardcoded, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/visualization/latex.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;e.g. line 384&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as I can tell, right now there's no way to accomplish what you want without running off your own branch.  That is, unless anybody knows a trick to get &lt;code&gt;utf8tolatex&lt;/code&gt; to stop escaping the underscore.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-09-29T03:00:36.180" LastActivityDate="2019-09-29T03:00:36.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8350" PostTypeId="1" CreationDate="2019-09-29T13:11:42.243" Score="8" ViewCount="282" Body="&lt;p&gt;Google's Sycamore paper describes achieving quantum supremacy on a &lt;span class=&quot;math-container&quot;&gt;$53$&lt;/span&gt;-qubit quantum computer.  The layout of Sycamore is &lt;span class=&quot;math-container&quot;&gt;$n=6\times 9=54$&lt;/span&gt; nearest neighbors, with one qubit nonfunctional.  They apply &lt;span class=&quot;math-container&quot;&gt;$m=20$&lt;/span&gt; total cycles in their experiment; each cycle is a random single-qubit rotation &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X},\sqrt{Y},\sqrt{W}\}$&lt;/span&gt; followed by a two-qubit tile of their Sycamore-specific gate, similar to an &lt;span class=&quot;math-container&quot;&gt;$\mathrm{iSWAP}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Alibaba had previously indicated that such size quantum computers are simulatable classically on a supercomputer.  See, e.g. &lt;a href=&quot;https://arxiv.org/abs/1805.01450&quot; rel=&quot;noreferrer&quot;&gt;Classical Simulation of Intermediate-Size Quantum Circuits&#xA;&lt;/a&gt; by Chen, et al., which states: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...by successfully simulating quantum supremacy circuits of size &lt;span class=&quot;math-container&quot;&gt;$9×9×40$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$10×10×35$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$11×11×31$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$12×12×27$&lt;/span&gt;, we give evidence that noisy random circuits with realistic physical parameters may be simulated classically.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Was the random quantum circuit on Sycamore specifically designed to make Alibaba's (or others) approach of classical simulation difficult?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did Google close a hole in Alibaba's work?  Or am I misreading some aspect of the work?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-09-29T16:34:06.597" LastActivityDate="2021-02-20T23:01:10.117" Title="Number of qubits to achieve quantum supremacy?" Tags="&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8351" PostTypeId="2" ParentId="8341" CreationDate="2019-09-29T14:17:10.397" Score="8" Body="&lt;p&gt;TL/DR: The two-qubit gates are going by the moniker &amp;quot;Sycamore gates&amp;quot; in the paper, and it appears that they would ideally want to explore more of the &lt;span class=&quot;math-container&quot;&gt;$(\phi, \theta)$&lt;/span&gt; phase-space but for their purposes (of quantum supremacy) their current Sycamore gate is sufficient.  The pattern of gates &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCDCDAB}$&lt;/span&gt; was chosen to avoid &amp;quot;wedges&amp;quot; and maximize/optimize entanglement.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The two-qubit Sycamore gates are described in the Supplementary Information paper for example on pp. 13 and 14.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o9aCs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o9aCs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;See FIG. S10 above, wherein the gates are described as an &lt;span class=&quot;math-container&quot;&gt;$\mathsf{iSWAP}$&lt;/span&gt; (imaginary swap) combined with a small phase for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CZ}$&lt;/span&gt; (controlled Z).  They put their Sycamore gates (green stars) closer to &lt;span class=&quot;math-container&quot;&gt;$\mathsf{iSWAP}$&lt;/span&gt;'s on their phase diagram of FIG. S10(c). &lt;strong&gt;I think&lt;/strong&gt; the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state is unchanged, the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; state are swapped and multiplied by &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, and the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; will see a &lt;span class=&quot;math-container&quot;&gt;$30^\circ$&lt;/span&gt; phase shift.&lt;/p&gt;&#xA;&lt;p&gt;Further, page 26 of the Supplementary Information states &amp;quot;The former sequence [e.g., the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCDCDAB}$&lt;/span&gt; sequence] makes SFA simulation harder by facilitating prompt transfer of entanglement created at promising circuit cuts into the bulk of each circuit partition.&amp;quot; Here SFA is the Schrodinger/Feynman hybrid simulation algorithm.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TpHnm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TpHnm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Supplementary Information paper, especially FIG. S22 above, notes that the formation of what is called a &amp;quot;wedge&amp;quot; of gates acting on qubits that are separated/partitioned with the SFA algorithm may not efficiently increase entanglement, and may be more efficiently simulatable.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/49igR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/49igR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Reviewing FIG. S21's illustration of the qubits toggled with the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCDCDAB}$&lt;/span&gt; pattern and comparing them to the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGH}$&lt;/span&gt; sequence above, the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGH}$&lt;/span&gt; pattern includes a number of these &amp;quot;wedges&amp;quot; for less entanglement/more efficient simulation.  That is, I think we can say that the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGH}$&lt;/span&gt; pattern of gates has a simpler Schmidt decomposition.  The &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCD}$&lt;/span&gt; gates have a different wallpaper group/packing density than the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGH}$&lt;/span&gt; gates. (I'm sorry I forgot the right group-theoretical way to say what I mean).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Comment #39 from Craig Gidney on &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4608#comments&quot; rel=&quot;nofollow noreferrer&quot;&gt;this SO blog post&lt;/a&gt; provides more context on the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCD}$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGH}$&lt;/span&gt; circuits.&lt;/p&gt;&#xA;&lt;p&gt;From Craig:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The supremacy paper mentions “verification circuits” [i.e., &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EFGH}$&lt;/span&gt; circuits], which are circuits that are identical to the supremacy circuits [i.e., &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ABCD}$&lt;/span&gt; circuits] except the verification circuits use a slightly different ordering of the two qubit gates. This ordering introduces a weakness that can be exploited to perform simulation much more efficiently.&lt;/p&gt;&#xA;&lt;p&gt;The verification circuits were not originally intended to be verification circuits. They were intended to be the actual supremacy circuits. We didn’t know the ordering was so important; someone just picked something that looked reasonable. It was only after we collected the experimental data for these circuits that the weakness was noticed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;To me, the claim of supremacy is &lt;em&gt;made stronger&lt;/em&gt; by having switched over to the &lt;span class=&quot;math-container&quot;&gt;$ABCD$&lt;/span&gt; circuits &lt;em&gt;during&lt;/em&gt; the experiment, at least because &lt;em&gt;more confidence&lt;/em&gt; is achieved when the fidelity of the verification circuits &lt;em&gt;were&lt;/em&gt; actually verified to be on-line in FIG. 4.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-02-23T14:24:37.363" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8352" PostTypeId="1" AcceptedAnswerId="8365" CreationDate="2019-09-29T14:44:41.487" Score="6" ViewCount="1210" Body="&lt;p&gt;Many sources seem to loosely use the terms &quot;relaxation&quot;, &quot;dephasing&quot;, and &quot;decoherence&quot; interchangeably, while others seem to treat certain of them as special cases of another terms, but I can't find any statements that explictly distinguish them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me, &quot;decoherence&quot; refers to the process of a pure-state density operator evolving into a mixed state, typically via the off-diagonal entries of the density matrix in some semiclassical &quot;pointer basis&quot; decaying to zero via uncontrolled interactions with the environment. I beleive that &quot;relaxation&quot; and &quot;dephasing&quot; are special cases of decoherence, but what are their definitions (as contrasted with general decoherence)?&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2019-09-30T06:34:27.090" Title="What is the difference between relaxation, dephasing, and decoherence?" Tags="&lt;decoherence&gt;&lt;terminology&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8353" PostTypeId="2" ParentId="8350" CreationDate="2019-09-29T17:56:09.387" Score="0" Body="&lt;p&gt;From the paper you refer, it turns out that the possible simulation of quantum circuit is made for certain type of circuits: simplificable ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From another post [1] I observed the Google's supremacy was achieved on non-simplificable, so called intractable sequence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to answer the question, whether Alibaba's approach was made difficult: yes - definitively that was the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8342/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;Understanding Google&amp;#39;s “Quantum supremacy using a programmable superconducting processor” (Part 3): sampling&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're right, only my source post and Google's paper speak about simplificable vs. intractable in the sense I was thinking:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Here we show an intractable sequence (repeat ABCDCDAB); we also use different coupler subsets along with a simplifiable sequence (repeat EFGHEFGH, not shown) that can be simulated on a classical computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(take from Google's paper, fig.3 figure text.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Here, the two-qubit gates are applied in a non-simplifiable tiling and sequence for which it is much harder to simulate.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(take from Google's paper, fig.4 figure text.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Another points I found:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alibaba calculates only one amplitude of the signal. All amplitudes of 50 qubits would have taken 16 petabytes, but they used only one peta in their whole experiment, so they did not actually simulate all, as Google guys tried.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google used different algorithms and their classical power ended in 40 qubits size. As I understand this Alibaba guys went here beyond, but needed to compromise the amount of data simulated. Google guys made it through another algorithm to get 'amplitudes of individual bitstrings', only that they stopped, as the amount of expected time went out of their hands.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Situation:&lt;/strong&gt; Alibaba got one amplitude and Google got an estimate of time for all amplitudes.&lt;/p&gt;&#xA;" OwnerUserId="4280" LastEditorUserId="4280" LastEditDate="2019-09-29T20:29:24.057" LastActivityDate="2019-09-29T20:29:24.057" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8354" PostTypeId="2" ParentId="8308" CreationDate="2019-09-29T21:08:26.300" Score="1" Body="&lt;p&gt;The problem with your circuit is not the number of classical bits. There is no practical limit to those. The circuit that you have drawn will not run because you are doing repeated measurements on a single qubit. This is not supported on any IBM machine currently available (this would require new control electronics for operating the qubits).&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2019-09-29T21:08:26.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8355" PostTypeId="1" AcceptedAnswerId="8356" CreationDate="2019-09-29T22:11:43.573" Score="3" ViewCount="163" Body="&lt;p&gt;For example in Deutsch's Algorithm, we apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; respectively. I have seen the notation this result in the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|0\rangle+|1\rangle)(|0\rangle-|1\rangle)$$&lt;/span&gt;&#xA;However, it is unclear to me how exactly I should read this. From my understanding, the result should be the outer product of &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1/\sqrt{2} \\ -1/\sqrt{2}\end{pmatrix}$&lt;/span&gt;, but then I would expect to see a bra vector like so: &lt;span class=&quot;math-container&quot;&gt;$\langle x \mid$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how should I read a notation like:  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle (|0\rangle+|0\rangle)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8638" LastEditorUserId="26" LastEditDate="2019-09-30T03:42:59.623" LastActivityDate="2019-09-30T16:09:21.657" Title="Notation question: How would one read $|0\rangle (|0\rangle+|0\rangle)$?" Tags="&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8356" PostTypeId="2" ParentId="8355" CreationDate="2019-09-30T00:23:08.677" Score="6" Body="&lt;p&gt;As a starting point, the state &lt;span class=&quot;math-container&quot;&gt;$\Psi = \frac{\vert 0 \rangle + \vert 1 \rangle}{\sqrt{2}}$&lt;/span&gt; is a superposition of states &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;, both with amplitude &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt;, indicating both states are equally likely to be measured.  The critical point to understand is that &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; are orthogonal basis elements, so &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; doesn't reduce in the way you indicated (consider the analogous unit vector &lt;span class=&quot;math-container&quot;&gt;$\frac{x+y}{\sqrt{2}}$&lt;/span&gt; in a Euclidean coordinate system).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, it's important to note that the sum of the square of the amplitudes always equals one because the magnitude of each amplitude squared represents the probability that we would observe that state if a measurement was taken.  In other words, measurement will cause &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; to collapse to state &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\left(\frac{1}{\sqrt{2}} \right)^2=\frac{1}{2}$&lt;/span&gt;, and the same for &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;.  So &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle + \vert 0 \rangle$&lt;/span&gt; is not physical, since measuring &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is not physically realistic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you see two kets next to each other this implies a tensor product, i.e. &lt;span class=&quot;math-container&quot;&gt;$\vert i \rangle \vert j \rangle$&lt;/span&gt; implies &lt;span class=&quot;math-container&quot;&gt;$\vert i \rangle \otimes \vert j \rangle$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|0\rangle+|1\rangle)(|0\rangle-|1\rangle)$&lt;/span&gt; is a shorthand way of writing &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}\left(\vert 0 \rangle \otimes \vert 0 \rangle + \vert 1 \rangle \otimes \vert 0 \rangle - \vert 0 \rangle \otimes \vert 1 \rangle - \vert 1 \rangle \otimes \vert 1 \rangle \right).$$&lt;/span&gt;&#xA;You can see that this is properly normalized since &lt;span class=&quot;math-container&quot;&gt;$\sum \limits_i p_i = 4(\frac{1}{2})^2 =1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reducing this to vector representations, if we take the vector representation &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle \equiv \begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle \equiv \begin{bmatrix}0 \\ 1\end{bmatrix}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$$\vert 0 \rangle \otimes \vert 0 \rangle = \begin{bmatrix} 1 \\0\\0\\0 \end{bmatrix}, \;\; \vert 1 \rangle \otimes \vert 0 \rangle = \begin{bmatrix} 0 \\0\\1\\0 \end{bmatrix}, \;\; \vert 0 \rangle \otimes \vert 1 \rangle = \begin{bmatrix} 0 \\1\\0\\0 \end{bmatrix}, \;\; \vert 1 \rangle \otimes \vert 1 \rangle = \begin{bmatrix} 0 \\0\\0\\1 \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final point, since you mentioned outer products, in bra-ket notation outer products are indicated by a ket to the left of a bra, e.g. &lt;span class=&quot;math-container&quot;&gt;$\vert i \rangle \langle j \vert$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the final paragraph opened the door to outer products, it might be helpful to clarify that notion as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where a ket represents a basis vector, a bra represents a dual vector (sometimes referred to as a covector).  In this context, for an arbitrary basis vector, the corresponding dual vector is the conjugate transpose of the basis vector.  For &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;, as defined above (conventionally known as the computational basis), this simply gives &lt;span class=&quot;math-container&quot;&gt;$$\langle 0 \vert = \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix}, \;\;\; \langle 1 \vert = \begin{bmatrix} 0 &amp;amp; 1 \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any orthonormal set of basis vectors, orthonormality is characterized by the inner product &lt;span class=&quot;math-container&quot;&gt;$$\langle j \vert k \rangle = \delta_{jk},$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\delta_{jk}$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_delta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker delta&lt;/a&gt;.  For any complete orthonormal set of basis vectors, completeness is characterized by the outer product &lt;span class=&quot;math-container&quot;&gt;$$\sum \limits_j \vert j \rangle \langle j \vert = I,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix with appropriate dimensions. Using this, you can readily confirm that both the computational basis and the basis used in Deutsch's algorithm are both orthonormal and complete.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-09-30T16:09:21.657" LastActivityDate="2019-09-30T16:09:21.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8359" PostTypeId="5" CreationDate="2019-09-30T03:47:20.350" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-30T03:47:20.350" LastActivityDate="2019-09-30T03:47:20.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8360" PostTypeId="4" CreationDate="2019-09-30T03:47:20.350" Score="0" Body="In quantum information, the diamond norm is a distance metric between quantum operations. (Wikipedia)" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-09-30T03:47:20.350" LastActivityDate="2019-09-30T03:47:20.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8361" PostTypeId="1" AcceptedAnswerId="8362" CreationDate="2019-09-30T03:54:04.090" Score="2" ViewCount="53" Body="&lt;p&gt;I was reading the &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/4_quantum_circuit_properties.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit tutorial&lt;/a&gt; on circuit properties and there is a section (Unitary Factors) which states that even though an example circuit is made of 12 qubits, it may not need 12 qubits to run. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original circuit: &lt;a href=&quot;https://raw.githubusercontent.com/Qiskit/qiskit-iqx-tutorials/7b19bc411cf4787ae0f7dac322bd6aef306b8053/qiskit/fundamentals/images/depth_1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mnUFy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mnUFy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The layers of the circuit: &lt;a href=&quot;https://raw.githubusercontent.com/Qiskit/qiskit-iqx-tutorials/7b19bc411cf4787ae0f7dac322bd6aef306b8053/qiskit/fundamentals/images/tensor_factors_1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5ldMf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ldMf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is stated that: &lt;em&gt;We can see that at the end of the computation there are three independent sets of qubits. Thus, our 12 qubit computation is actual two two qubit calculations and a single eight qubit computation.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am struggling to understand where in this diagram it is illustrating that we only need two 2 qubit calculations and one 8 qubit calculation.&lt;/p&gt;&#xA;" OwnerUserId="8405" LastEditorUserId="26" LastEditDate="2019-09-30T04:09:12.310" LastActivityDate="2019-09-30T06:12:03.960" Title="n-qubit circuit run with &gt; n qubits?" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8362" PostTypeId="2" ParentId="8361" CreationDate="2019-09-30T06:12:03.960" Score="2" Body="&lt;p&gt;Look at the picture of layer #9. It tells you explicitly how to group the qubits. There's a pair (q0,q5), another pair (q3,q8) and the rest of the qubits (q1,q2,q4,q6,q7,q9,q10,11). To see the relevance, look back to the circuit. Start with qubits 0 and 5. You can see that there's a two-qubit gate between them, but there are no two-qubit gates going from one of those to any other qubit. So qubits 0 and 5 will be in a product state from everything else (assuming they start in a product state), and you can perform that part of the computation independently from everything else. The same is true for the qubit pair 3 and 8.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-30T06:12:03.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8363" PostTypeId="2" ParentId="8330" CreationDate="2019-09-30T06:20:25.760" Score="3" Body="&lt;p&gt;As @NorbertSchuch said in a comment, matlab has a function for taking the logarithm of a matrix: logm. In general, there is a standard method for calculating the function &lt;span class=&quot;math-container&quot;&gt;$f(\sigma)$&lt;/span&gt; of a matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. You first diagonalise the matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma=UDU^\dagger,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is diagonal. We then say&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(\sigma)=Uf(D)U^\dagger,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$f(D)$&lt;/span&gt; simply involves calculating the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; on just the diagonal elements of the matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note this means that in your particular case, since &lt;span class=&quot;math-container&quot;&gt;$\sigma=|\psi\rangle\langle\psi|$&lt;/span&gt; corresponds to a pure state, one of the eigenvalues is 0, so unless &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is an identical pure state, the answer you get will be &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-30T06:20:25.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8364" PostTypeId="1" CreationDate="2019-09-30T06:30:25.087" Score="1" ViewCount="20" Body="&lt;p&gt;In Gottesman's introduction, it writes&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A code that corrects t errors is said to have distance 2t + 1, because it takes 2t + 1 single-qubit changes to get from one codeword to another.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Other reviews have slight different definitions but I think they are all equivalent. I am still new to QEC...and a little confused about how these &lt;span class=&quot;math-container&quot;&gt;$2t+1$&lt;/span&gt; single-qubit changes take place during quantum error correction..Could anyone give a more detailed explanation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4178" LastActivityDate="2019-09-30T06:30:25.087" Title="Distance and number of corrected errors in quantum error correction" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2019-09-30T07:34:06.277" ContentLicense="CC BY-SA 4.0" />
  <row Id="8365" PostTypeId="2" ParentId="8352" CreationDate="2019-09-30T06:34:27.090" Score="5" Body="&lt;p&gt;Decoherence is the very general term  which, more or less, is anything resulting in a loss of purity during the evolution of a system. Sometimes, when people are being a bit non-specific, they might be thinking of a particular type of decoherence such as dephasing (or perhaps depolarising) when they use the term decoherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Relaxation and dephasing are two very special cases of decoherence. In relaxation, we generally think of the qubits as being two-level systems where one level (say &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) is at a higher energy than the other (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;). Over time, there is the tendency of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to 'relax' back to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. If you want to visualise this, think of the Bloch Sphere. The action of the relaxation map is to contract the sphere towards to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; point (so &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; stays as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;). This is Figure 8.14 in Nielsen and Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dephasing is the same as &quot;Z noise&quot;. This is the process that tends to reduce the off-diagonal entries of the density matrix, basically defining the &quot;pointer basis&quot;. To visualise the effect on the Bloch sphere, it's a contraction of the sphere where every point moves towards the Z axis (every point on the Z axis is preserved). It's figure 8.9 in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Their proper definitions can be given mathematically as Lindblad operators. The main equation is 8.134 in Nielsen and Chuang, with the operators (effectively) being defined in 8.96 (dephasing) and 8.108 (relaxation, also referred to as amplitude damping)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-09-30T06:34:27.090" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8366" PostTypeId="2" ParentId="8329" CreationDate="2019-09-30T12:09:15.713" Score="2" Body="&lt;p&gt;There is not a way to have the latex drawer do the subscript currently. As ChainedSymmetry pointed out the use of pylatexenc prevents that because it will escape or convert the underscore and symbols to their latex equivalents. This was added because when we first added custom gates support to the drawer people had issues with passing things like &lt;code&gt;custom_gate&lt;/code&gt; to the drawer it would make the 'g' a subscript (see &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/2246&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/2246&lt;/a&gt; ). While I still think this is a sane default for people, I agree we probably should add a flag to disable the conversion to the draw() functions, so I quickly wrote up a patch for that here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/3172&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/3172&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said the &lt;code&gt;mpl&lt;/code&gt; drawer should work fine in the meantime for your second example with the label &lt;code&gt;name=r'$X_t$'&lt;/code&gt;. That should tell matplotlib to use math mode when rendering the gates name and use a subscript.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2019-09-30T12:09:15.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8367" PostTypeId="2" ParentId="8334" CreationDate="2019-09-30T14:33:33.903" Score="1" Body="&lt;p&gt;This error code means there was a time-out waiting for a response from the server. It could have been caused by a blip in the network. I would try running the same code again, and seeing if you consistently get this error. If not, then I would not worry, as you are unlikely to see it again. &lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-09-30T14:33:33.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8368" PostTypeId="1" CreationDate="2019-09-30T15:10:18.837" Score="8" ViewCount="61" Body="&lt;p&gt;I reading the paper &lt;a href=&quot;https://eprints.soton.ac.uk/403232/1/07515170.pdf&quot; rel=&quot;noreferrer&quot;&gt;EXIT-Chart Aided Quantum Code Design&#xA;Improves the Normalised Throughput&#xA;of Realistic Quantum Devices&lt;/a&gt;, which proposes the use of QTCs in order to do quantum error correction for realistic quantum devices whose error model can be approximated by asymmetric depolarizing channels. Before presenting the error correcting methods, the authors present a discussion on the entanglement assisted hashing bound as a function of the asymmetry presented in the channel, which can be formulated as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$C_Q^{EA} = 1 + (1-p)\log_2(1-p)+p_x\log_2(p_x)+p_y\log_2(p_y)+p_z\log_2(p_z) + \theta E_{max}$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p=p_x+p_y+p_z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta\in[0,1]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{max}$&lt;/span&gt; is the maximum entanglement consumption.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At a first glance, the expression does not differ much from the EA hashing bounds of symmetric depolarizing channels, but a further observation of it presents the doubt I have about the topic. If one takes a look to the figures 5b, 5c or 5d of the paper, one can see that for channels presenting asymmetries, there are codes using entanglement-assistance with rates that do not present a noise limit &lt;span class=&quot;math-container&quot;&gt;$p^*$&lt;/span&gt; for their performance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know if I am getting this correctly, but does that mean that we can construct codes that are error free? Does that mean that quantum information using such methods would be perfect?&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-01-05T11:37:42.613" LastActivityDate="2021-01-05T11:37:42.613" Title="Entanglement-assisted hashing bound for asymmetric depolarizing channels" Tags="&lt;entanglement&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;information-theory&gt;&lt;communication&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8369" PostTypeId="1" AcceptedAnswerId="8371" CreationDate="2019-09-30T17:10:29.583" Score="12" ViewCount="3368" Body="&lt;p&gt;I just started studying IBM Qiskit, and cannot find details about the barrier method on the QuantumCircuit class. It is shown in the circuit drawing, but I never heard about it after reading quantum computing text books. Is it a unitary gate? If so, how is it defined? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="26" LastEditDate="2019-10-09T06:34:51.647" LastActivityDate="2021-04-03T22:30:52.173" Title="What is a &quot;barrier&quot; in Qiskit circuits?" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8370" PostTypeId="2" ParentId="8244" CreationDate="2019-09-30T17:40:55.143" Score="5" Body="&lt;p&gt;Qiskit uses little-endian for both classical bit ordering and qubit ordering.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For classical bits:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A 3-bit classical register &lt;code&gt;creg&lt;/code&gt; with value &lt;code&gt;abc&lt;/code&gt; has &lt;code&gt;creg[0]=c&lt;/code&gt;, &lt;code&gt;creg[1]=b&lt;/code&gt;, &lt;code&gt;creg[2]=a&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;For qubits:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ordering is with respect to the tensor-product structure of the state space. So a 3-qubit quantum register &lt;code&gt;qreg&lt;/code&gt; with wave-function &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |A\otimes B\otimes C\rangle$&lt;/span&gt; has &lt;code&gt;qreg[0]&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$= |C\rangle$&lt;/span&gt;, &lt;code&gt;qreg[1]&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$= |B\rangle$&lt;/span&gt;, &lt;code&gt;qreg[2]&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$= |A\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly for representing unitary matrices of a circuit. &lt;span class=&quot;math-container&quot;&gt;$U = U_A \otimes U_B \otimes U_C$&lt;/span&gt; would have &lt;span class=&quot;math-container&quot;&gt;$U_C$&lt;/span&gt; acting on &lt;code&gt;qreg[0]&lt;/code&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_B$&lt;/span&gt; acting on &lt;code&gt;qreg[1]&lt;/code&gt; and &lt;code&gt;U_A&lt;/code&gt; acting on &lt;code&gt;qreg[2]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2019-09-30T17:40:55.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8371" PostTypeId="2" ParentId="8369" CreationDate="2019-09-30T18:05:42.140" Score="18" Body="&lt;p&gt;You won't find the barrier in quantum computing textbooks because it isn't a standard primitive of quantum information theory like unitary gates and quantum circuits.&lt;/p&gt;&#xA;&lt;p&gt;The barrier acts as a directive for circuit compilation to separate pieces of a circuit so that any optimizations or re-writes are constrained to only act between barriers (and if there are no barriers they act on the whole circuit).&#xA;This only comes into play when using the &lt;code&gt;transpile&lt;/code&gt; or &lt;code&gt;execute&lt;/code&gt; functions in Qiskit (&lt;code&gt;execute&lt;/code&gt; includes a transpile step).&lt;/p&gt;&#xA;&lt;p&gt;Below is an example, and you can find more examples in these Qiskit tutorial notebooks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/4_quantum_circuit_properties.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum circuit properties&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/5_using_the_transpiler.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using the transpiler&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If a circuit has several 1-qubit gates in a row acting on the same qubit these can be combined into a single 1-qubit gate. If you explicitly want to prevent this sort of behaviour you can place a barrier between them.&lt;/p&gt;&#xA;&lt;p&gt;Create a 1-qubit circuit with several gates&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, transpile&#xA;&#xA;qr = QuantumRegister(1)&#xA;circuit1 = QuantumCircuit(qr)&#xA;circuit1.u1(0.2, qr[0])&#xA;circuit1.u2(0.1,0.2, qr[0])&#xA;circuit1.u3(0.1, 0.2, 0.3, qr[0])&#xA;circuit1.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This circuit is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;         ┌─────────┐┌─────────────┐┌─────────────────┐&#xA;q0_0: |0&amp;gt;┤ U1(0.2) ├┤ U2(0.1,0.2) ├┤ U3(0.1,0.2,0.3) ├&#xA;         └─────────┘└─────────────┘└─────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If we transpile it, these gates are combined using the default settings&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit1t = transpile(circuit1)&#xA;circuit1t.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The returned circuit is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;         ┌───────────────────────────┐&#xA;q0_0: |0&amp;gt;┤ U3(1.6629,0.6018,0.43905) ├&#xA;         └───────────────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now if we want to avoid the gates being combined we could add barriers:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(1)&#xA;circuit2 = QuantumCircuit(qr)&#xA;circuit2.u1(0.2, qr[0])&#xA;circuit2.barrier(qr)&#xA;circuit2.u2(0.1,0.2, qr[0])&#xA;circuit2.barrier(qr)&#xA;circuit2.u3(0.1, 0.2, 0.3, qr[0])&#xA;circuit2.draw()&#xA;&#xA;         ┌─────────┐ ░ ┌─────────────┐ ░ ┌─────────────────┐&#xA;q1_0: |0&amp;gt;┤ U1(0.2) ├─░─┤ U2(0.1,0.2) ├─░─┤ U3(0.1,0.2,0.3) ├&#xA;         └─────────┘ ░ └─────────────┘ ░ └─────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case transpiling wont change the circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit2t = transpile(circuit2)&#xA;circuit2t.draw()&#xA;         ┌─────────┐ ░ ┌─────────────┐ ░ ┌─────────────────┐&#xA;q1_0: |0&amp;gt;┤ U1(0.2) ├─░─┤ U2(0.1,0.2) ├─░─┤ U3(0.1,0.2,0.3) ├&#xA;         └─────────┘ ░ └─────────────┘ ░ └─────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8650" LastEditorUserId="4947" LastEditDate="2021-04-03T22:30:52.173" LastActivityDate="2021-04-03T22:30:52.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8372" PostTypeId="2" ParentId="8235" CreationDate="2019-09-30T18:12:42.947" Score="4" Body="&lt;p&gt;Outer product is a mapping operator. You can use it to define quantum gates, just sum up outer products of desired output and input basis vectors. For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert{0}\rangle\rightarrow\vert{1}\rangle,\vert{1}\rangle\rightarrow\vert{0}\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert{1}\rangle\langle{0}\vert+\vert{0}\rangle\langle{1}\vert=\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;In general, you can define an operator (gate) as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\sum_{n} \vert{v_i}\rangle\langle{u_i}\vert&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;${u_i}$&lt;/span&gt; are input and &lt;span class=&quot;math-container&quot;&gt;${v_i}$&lt;/span&gt; output basis vectors. In short, outer products can be used to construct operators.&lt;/p&gt;&#xA;" OwnerUserId="8651" LastEditorUserId="8651" LastEditDate="2019-10-29T08:03:45.723" LastActivityDate="2019-10-29T08:03:45.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8373" PostTypeId="1" CreationDate="2019-09-30T22:14:31.110" Score="0" ViewCount="141" Body="&lt;p&gt;Can anyone help me to find the mean value of the &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/conventions/gates.html#displacement&quot; rel=&quot;nofollow noreferrer&quot;&gt;displacement operator&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$$D(\alpha) = \exp( \alpha a^\dagger -\alpha^* a)$$&lt;/span&gt; for a &lt;a href=&quot;https://strawberryfields.readthedocs.io/en/latest/conventions/states.html#coherent-state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coherent State&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\left|\beta\right&amp;gt; = D\left(\beta\right)\left|0\right&amp;gt;$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8655" LastEditorUserId="26" LastEditDate="2019-10-09T06:35:46.707" LastActivityDate="2019-10-09T06:35:46.707" Title="What is the mean value of displacement operator for the coherent state?" Tags="&lt;quantum-state&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8374" PostTypeId="1" AcceptedAnswerId="8410" CreationDate="2019-10-01T13:29:22.533" Score="10" ViewCount="245" Body="&lt;p&gt;I am interested how quantum computing can contribute to the development of artificial intelligence, I did some searching, but could not find much. Does somebody have an idea (or speculations)? &lt;/p&gt;&#xA;" OwnerUserId="8654" LastEditorUserId="26" LastEditDate="2019-10-09T06:41:08.410" LastActivityDate="2019-11-13T02:43:06.623" Title="Can quantum computing contribute to the development of artificial intelligence?" Tags="&lt;machine-learning&gt;&lt;applications&gt;&lt;artificial-intelligence&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8375" PostTypeId="2" ParentId="8337" CreationDate="2019-10-01T18:18:05.797" Score="2" Body="&lt;p&gt;This answer only addresses the part about the necessity of the randomness of the circuit because I am by no means familiar with the physical implementation of the qubits at Google and what kind of constraints these impose on the implementation of certain gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, for the randomness: Consider the &lt;em&gt;problem&lt;/em&gt; of sampling from the output distribution of a quantum circuit. An &lt;em&gt;instance&lt;/em&gt; of this problem is specified by one particular circuit. Of course, many of these instances might be extremely easy to solve for a general purpose classical sampler. Explicitly, take for example Clifford circuits for which we know we could build a poly-time sampler that could actually solve all these instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; In fact, having thought about this a bit more, I believe that a single instance of any problem is always trivial to solve: You can just &quot;hard-code&quot; the right solution into your algorithm/Turing machine and it would then run in constant time (a single step) and return the right thing but of course would fail on any other instance. Thus, while we might intuitively speak about particular circuits being harder than others, this does not really make sense from a rigorous point of view.&#xA; (Here, it might help to think about more conventional problems that people look at in complexity-theory like Satisfiability or whatnot.) &#xA;But even for a big chunk of instances, you might still find some pattern in them, that allows you to solve all these &lt;em&gt;but not all instances&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However, solving &lt;em&gt;a problem&lt;/em&gt;&lt;/strong&gt; means designing a general purpose algorithm/machine that solves all instances but of course asserting whether this criterion was met might be difficult. Thus, a nice way to pose &lt;em&gt;the task&lt;/em&gt; that ought to be achieved by a sampler (be it quantum or classical) is sampling from the output distribution of a &lt;em&gt;random&lt;/em&gt; instance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, if you cannot know which instance you will have to solve beforehand, then you have to prepare for all. To illustrate this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a competition where everyone hands in as a project their classical computer program for this task. There is simply no way you could ever exploit any particular structure in the circuit that you need to sample from because your are only told which instance you need to solve &lt;em&gt;after&lt;/em&gt; handing in the project. Then the judges assess all submissions based on how well they do on some instance they have drawn randomly. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Facing this competition, the only thing you can do classically is just simulating the quantum circuit which of course takes exponential resources.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="5322" LastEditDate="2019-10-02T17:26:52.140" LastActivityDate="2019-10-02T17:26:52.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8376" PostTypeId="1" AcceptedAnswerId="8380" CreationDate="2019-10-01T19:57:14.283" Score="3" ViewCount="60" Body="&lt;p&gt;Consider the Deutsch-Jozsa, algorithm, which first initializes the state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle^{\otimes n} | 1 \rangle$&lt;/span&gt;, creates a superposition using the the Hadamard gate and the &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to get into the state: &lt;span class=&quot;math-container&quot;&gt;$$\sum_x (-1)^{f(x)} |x \rangle (|0 \rangle - | 1 \rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So far I can follow.&#xA;What I don't understand is the step where we we apply the Hadamard gate to the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, which gives (ignoring the last qubit)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2^n}} \sum_{x=0}^{2^n-1} (-1)^{f(x)} \left [ \sum_{y=0}^{2^n-1} (-1)^{x \cdot y} |y\rangle \right ].$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I prove that applying the Hadamard to the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sum_x (-1)^{f(x)} | x \rangle$&lt;/span&gt; gives the above sum?&lt;/p&gt;&#xA;" OwnerUserId="8638" LastEditorUserId="2927" LastEditDate="2021-04-27T22:59:48.860" LastActivityDate="2021-04-27T22:59:48.860" Title="Analysis of the second Hadamard in the Detusch-Jozsa Algorithm" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8377" PostTypeId="2" ParentId="8337" CreationDate="2019-10-01T22:12:45.207" Score="4" Body="&lt;p&gt;While a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8341/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;follow-up question&lt;/a&gt; asks for the motivation behind the &lt;em&gt;two-qubit&lt;/em&gt; gates used in Sycamore, this question focuses on the random nature of the &lt;em&gt;single qubit&lt;/em&gt; operations used in Sycamore, that is, the gates &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X},\sqrt{Y},\sqrt{W}=(X+Y)/\sqrt{2}\}$&lt;/span&gt; applied to each of the &lt;span class=&quot;math-container&quot;&gt;$53$&lt;/span&gt; qubits between each of the two-qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Although I agree with @Marsl that these gates were likely relatively easy to realize with the transmon qubits used in Sycamore, I suspect that there is a little more to the story.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt;, page 26 of the Supplementary Information notes that although &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Y}$&lt;/span&gt; belong to the Clifford group, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{W}$&lt;/span&gt; does not.  I believe &lt;span class=&quot;math-container&quot;&gt;$\sqrt{W}$&lt;/span&gt; was added, at least partly, because it is &lt;em&gt;not&lt;/em&gt; a member of the Clifford group.  This may help to avoid the pitfalls of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gottesman%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman-Knill theorem&lt;/a&gt;, which says that circuits consisting of only normalizers of the Pauli group &lt;span class=&quot;math-container&quot;&gt;$(I,X,Y,Z)$&lt;/span&gt; are efficiently simulatable.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, for example, if &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z}$&lt;/span&gt; were used as opposed to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{W}$&lt;/span&gt;, then the claim of quantum supremacy would have to overcome the implications of easy simulatability in view of Gottesman-Knill.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Furthermore&lt;/strong&gt;, I believe at least three single-qubit gates are needed to help support the claim of quantum supremacy.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example further review of page 26 of the Supplemental Information states that although the first cycle randomly chooses among the &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; gates, subsequent cycles never use the same gates used in the immediately preceding cycle.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's hard to scramble a Rubik's cube by giving two half-twists to the same face twice in a row. Similarly their circuit used for quantum supremacy is chosen randomly from all of the &lt;span class=&quot;math-container&quot;&gt;$3^n2^{nm}$&lt;/span&gt; such words on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; cycles of single- and two-qubit gates.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-05T18:43:31.080" LastActivityDate="2019-11-05T18:43:31.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8378" PostTypeId="1" AcceptedAnswerId="8384" CreationDate="2019-10-01T23:59:36.167" Score="8" ViewCount="148" Body="&lt;p&gt;I'm trying to understand if there is some sort of formula or procedural way to determine if a vector is separable or entangled – aka whether or not a vector of size &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; could be represented by the tensor product of two vectors of size &lt;span class=&quot;math-container&quot;&gt;$\sqrt{m}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I understand that the following 9-dimensional vector is separable because it can be represented as a tensor product of two 3-dimensional vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;       \begin{pmatrix}&#xA;              0 \\&#xA;              \frac{1}{2} \\&#xA;              \frac{1}{2} \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              \frac{1}{2} \\&#xA;              \frac{1}{2} \\&#xA;       \end{pmatrix}&#xA;       =&#xA;       \begin{pmatrix}&#xA;              \frac{1}{\sqrt{2}} \\&#xA;              0 \\&#xA;              \frac{1}{\sqrt{2}} \\&#xA;       \end{pmatrix}&#xA;       \otimes &#xA;       \begin{pmatrix}&#xA;              0 \\&#xA;              \frac{1}{\sqrt{2}} \\&#xA;              \frac{1}{\sqrt{2}} \\&#xA;       \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas the following 9-dimensional vector can't be represented as the tensor product of two 3-dimensional vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;       \begin{pmatrix}&#xA;              \frac{1}{2} \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              0 \\&#xA;              \frac{1}{2} \\&#xA;       \end{pmatrix}&#xA;       \neq&#xA;       \begin{pmatrix}&#xA;              a_0 \\&#xA;              a_1 \\&#xA;              a_2 \\&#xA;       \end{pmatrix}&#xA;       \otimes &#xA;       \begin{pmatrix}&#xA;              b_0 \\&#xA;              b_1 \\&#xA;              b_2 \\&#xA;       \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm looking for a computational way of determining if a vector is separable or entangled. Thanks for your help! Let me know if I can clarify anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also – just a little disclaimer – I'm pretty new to all this, so sorry if this is a beginner question or if I got some of the math wrong.&lt;/p&gt;&#xA;" OwnerUserId="8663" LastActivityDate="2019-10-09T06:43:32.017" Title="Is there an algorithm for determining if a given vector is separable or entangled?" Tags="&lt;mathematics&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8379" PostTypeId="1" AcceptedAnswerId="8386" CreationDate="2019-10-02T00:04:54.083" Score="2" ViewCount="215" Body="&lt;p&gt;I am having trouble understanding the following step. From:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{trace}\left(\sum_z |z\rangle\langle z| \rho_A |z\rangle\langle z|  \times \log( \sum_z |z\rangle\langle z| \sum_x |\langle x|z \rangle |^2 \langle x | \rho_A | x \rangle)\right) \\&#xA;= \sum_z \langle z | \rho_A | z \rangle \times \log(\sum_x |\langle x|z \rangle |^2 \langle x | \rho_A | x \rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; is a quantum density operator, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are quantum measurement operators, which of course would have to be hermitian. I think the line of reasoning is that those &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; are orthogonal to each other. So essentially it would be like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{trace}(\text{diagonal matrix} \times \log(\text{another diagonal matrix}))$$&lt;/span&gt; So the trace would simply be the sum of the diagonal elements. But I don't know how to argue about the orthogonality of them. What would be a good approach to go?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-12-21T09:58:05.413" LastActivityDate="2020-12-21T09:58:05.413" Title="Trace of Hermitian Operator and Operator Function" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8380" PostTypeId="2" ParentId="8376" CreationDate="2019-10-02T02:24:58.713" Score="5" Body="&lt;p&gt;If you look at the formula you want to prove term-by-term, you'll notice that the sum and the &lt;span class=&quot;math-container&quot;&gt;$(-1)^f(x)$&lt;/span&gt; part is the same in both formulas; you just need to show that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n} |x\rangle = \frac{1}{\sqrt{2^n}} \left( \sum_{y=0}^{2^n-1} (-1)^{x \cdot y} |y\rangle \right )$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can either show this strictly by induction (similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8260/prove-by-induction-h-otimes-n-left-0-right-otimes-n-frac1-sqrt&quot;&gt;this question&lt;/a&gt; but accounting for the fact that &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; can have both &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; bits which contribute different signs to the term).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can just look at it: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is a sequence of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states, so applying a Hadamard gate to each of them will produce all possible sequences of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s to serve as &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;s. The sign before each &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; term is defined as follows: minus signs only appear when you apply Hadamard to a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; bit of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and you consider a term &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; which has a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; bit in the corresponding position. The coefficient &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x \cdot y}$&lt;/span&gt; accumulates from counting such positions for the given &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; and multiplying the signs.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-10-02T02:24:58.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8381" PostTypeId="1" AcceptedAnswerId="8383" CreationDate="2019-10-02T02:55:01.050" Score="2" ViewCount="164" Body="&lt;p&gt;I'm studying Quantum Computing: A Gentle Introduction. On page 33, Section 3.1.2, after defining tensor product with 3 properties (distribution over addition on both left and right, scalar on both sides), it says all element of &lt;span class=&quot;math-container&quot;&gt;$V \otimes W$&lt;/span&gt; have form &lt;span class=&quot;math-container&quot;&gt;$|v_1\rangle \otimes |w_1\rangle +|v_2\rangle \otimes |w_2\rangle +\ldots+|v_k\rangle \otimes |w_k\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the minimum of the dimensions of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$k+1$&lt;/span&gt; dimensions (and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; dimensions), why the basis &lt;span class=&quot;math-container&quot;&gt;$|v_{k+1}\rangle$&lt;/span&gt; is not used? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, in the classic Quantum computing and quantum information textbook, section 2.1.7, formula 2.46, it also uses a single index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$(A\otimes B)(\sum_i a_i|v_i\rangle \otimes |w_i\rangle).$$&lt;/span&gt; I thought it should be &lt;span class=&quot;math-container&quot;&gt;$$(A\otimes B)(\sum_&#xA;{i,j} a_{i,j}|v_i\rangle \otimes |w_j\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything deeper to explain that a single index with a subset of bases is sufficient?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="26" LastEditDate="2019-10-09T06:47:54.527" LastActivityDate="2019-10-09T06:47:54.527" Title="Understanding the action of operators on vectors in tensor product spaces" Tags="&lt;mathematics&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8382" PostTypeId="2" ParentId="8378" CreationDate="2019-10-02T03:47:00.263" Score="1" Body="&lt;p&gt;Here is a possible, though expensive, way. First, find all prime factors of the dimension d of your vector. In your example, the dimension is 9, and the only prime factor is 3. Next for each prime factor &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, try a tensor product of a vector of dimension p and another vector of dimension &lt;span class=&quot;math-container&quot;&gt;$d/p$&lt;/span&gt;. Then you need to solve &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; quadratic equations with &lt;span class=&quot;math-container&quot;&gt;$p+d/p$&lt;/span&gt; variables to ensure the tensor product holds, you also need two additional quadratic equations to ensure unit vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When your vectors are sparse, i.e., with lots of zeros, it might be easy to trace out variables that must be zero first. In your second example, &lt;span class=&quot;math-container&quot;&gt;$a_0, b_0$&lt;/span&gt; cannot be zero due to &lt;span class=&quot;math-container&quot;&gt;$a_0 b_0=\frac{1}{2}$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$b_1=b_2=0$&lt;/span&gt; to satisfy the second and third entries. Later when considering the last entry, you will find &lt;span class=&quot;math-container&quot;&gt;$b_2$&lt;/span&gt; cannot be zero, hence there is no solution. In your first example, you can determine the two zero entries and solve the rest by solving the equations.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="26" LastEditDate="2019-10-09T06:43:32.017" LastActivityDate="2019-10-09T06:43:32.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8383" PostTypeId="2" ParentId="8381" CreationDate="2019-10-02T04:22:51.233" Score="4" Body="&lt;p&gt;The reason is relatively straightforward.  Consider an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; dimensional vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; with basis &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert v_1 \rangle,...,\vert v_m \rangle \rbrace$&lt;/span&gt;, and an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensional vector space &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; with basis &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert w_1 \rangle,...,\vert w_n \rangle \rbrace$&lt;/span&gt;.  As your intuition suggests, we can naturally express any element &lt;span class=&quot;math-container&quot;&gt;$A \in V \otimes W$&lt;/span&gt; in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A = \sum \limits_{j=1}^{m} \sum \limits_{k=1}^n  \lambda_{jk} \vert v_j \rangle \otimes \vert w_k \rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda_{jk}$&lt;/span&gt; are scalar coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason we can express &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\text{min}(m,n)$&lt;/span&gt; terms is that we can group the set of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; vectors &lt;span class=&quot;math-container&quot;&gt;$\lambda_{jk} \vert v_j \rangle$&lt;/span&gt; into a new set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; vectors &lt;span class=&quot;math-container&quot;&gt;$\vert a_k \rangle$&lt;/span&gt; given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert a_k \rangle=\sum \limits_{j=1}^m \lambda_{jk} \vert v_j \rangle,$$&lt;/span&gt; which gives an expression for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with one index in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; terms as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\sum \limits_{k=1}^n \vert a_k \rangle \otimes \vert w_k \rangle.$$&lt;/span&gt;&#xA;We can do the same to express &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; terms by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A = \sum \limits_{j=1}^m \vert v_j \rangle \otimes \vert b_j \rangle, \;\;\;\; \vert b_j \rangle = \sum \limits_{k=1}^n \lambda_{jk} \vert w_k \rangle,$$&lt;/span&gt;&#xA;showing that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can always be expressed in &lt;span class=&quot;math-container&quot;&gt;$\text{min}(m,n)$&lt;/span&gt; terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, to show that the &lt;span class=&quot;math-container&quot;&gt;$mn$&lt;/span&gt; elements &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert v_j \rangle \otimes \vert w_k \rangle \rbrace$&lt;/span&gt; form a basis in &lt;span class=&quot;math-container&quot;&gt;$V \otimes W$&lt;/span&gt;, we still need to show that these elements are linearly independent.  That proof is not so easy (or concise). I would refer you to &lt;em&gt;Linear Algebra via Exterior Products&lt;/em&gt; by Winitzki, section 1.7.3, if you want that level of rigor. &lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-02T12:59:18.367" LastActivityDate="2019-10-02T12:59:18.367" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8384" PostTypeId="2" ParentId="8378" CreationDate="2019-10-02T09:15:37.797" Score="7" Body="&lt;p&gt;Imagine you have a vector that can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\sum_{i=0}^{d_A-1}\sum_{j=0}^{d_B-1}c_{ij}|i\rangle|j\rangle.&#xA;$$&lt;/span&gt;&#xA;The coefficients can be arranged as a &lt;span class=&quot;math-container&quot;&gt;$d_A\times d_B$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, with the elements &lt;span class=&quot;math-container&quot;&gt;$c_{ij}$&lt;/span&gt; (in your special case, you're talking about setting &lt;span class=&quot;math-container&quot;&gt;$d_A=d_B=\sqrt{m}$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you calculate &lt;span class=&quot;math-container&quot;&gt;$\rho_A=CC^\dagger$&lt;/span&gt;, this is known as the &lt;em&gt;reduced density matrix&lt;/em&gt; of subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. If the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is separable, then &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; corresponds to a pure state. Otherwise, it is mixed. Separability can be detected using a quantity known as the mixedness, effectively the condition &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho_A^2)=1$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is not separable (i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; is mixed), it is entangled.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-10-02T12:10:24.210" LastActivityDate="2019-10-02T12:10:24.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8385" PostTypeId="2" ParentId="7203" CreationDate="2019-10-02T09:42:18.110" Score="1" Body="&lt;p&gt;I don't think you can factor. There are many cases where the result of the gate will produce a combined CNOT output (4 numbers) that cannot be factored. I think most states between two qbits is entangled from our perspective. So you cannot trust in factoring. Instead, the four products remain in memory while your program writes the data to both of your inputs so that they now share the memory in different ways. Then when you apply the Hadamard to the lines after the CNOT, it actually operates on the 4 numbers as a whole to obtain the observed results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know the answer yet, but I am looking at the exact same problem and I think I know  what you mean. I am seeing a connection between Cayley-Dickson constructions (complex numbers of high dimension) and probability states and manipulations. Gates also look like multiplications by (hyper) complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you write a Cayley-Dickson calculator with tensor functions you can model the rotations of single gate manipulations.&#xA;But I am also having trouble getting the CNOT gate to work. I suspect it is just a simple Cayley Dickson number something like this: 1/sqrt(4)*(1-i+j-k) or something simple like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT works for me when producing a tensor and flipping the complex side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm working on some code to do this here: &lt;a href=&quot;https://metacpan.org/source/PEASWORTH/Tangle-0.01&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://metacpan.org/source/PEASWORTH/Tangle-0.01&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8666" LastActivityDate="2019-10-02T09:42:18.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8386" PostTypeId="2" ParentId="8379" CreationDate="2019-10-02T11:55:26.840" Score="2" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; are orthogonal to each other, then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\log(\sum_z |z\rangle\langle z| \cdot b_z) = \sum_z |z\rangle\langle z| \cdot \log(b_z)&#xA;$$&lt;/span&gt;&#xA;So &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{trace}(\sum_z |z\rangle\langle z| \cdot a_z \cdot \log(\sum_{z^\prime} |z^\prime\rangle\langle z^\prime| \cdot b_{z^\prime})) &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\mathrm{trace}(\sum_z \sum_{z^\prime} |z\rangle\langle z| \cdot |z^\prime\rangle\langle z^\prime| \cdot a_z \cdot \log(  b_{z^\prime})) &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \mathrm{trace}(\sum_z |z\rangle\langle z|a_z\cdot \log(b_z)) = \sum_z a_z\cdot \log(b_z)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="26" LastEditDate="2019-10-09T06:45:54.673" LastActivityDate="2019-10-09T06:45:54.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8387" PostTypeId="2" ParentId="8325" CreationDate="2019-10-02T20:16:30.607" Score="3" Body="&lt;p&gt;There are a few ways to speed up this execution in Aqua. One way in the case of noiseless simulation is to use SLSQP instead of Cobyla, which we've noticed empirically seems to converge faster in noiseless environments. Another is to set &lt;code&gt;skip_qobj_validation=True&lt;/code&gt; in the &lt;code&gt;QuantumInstance&lt;/code&gt; init. I would start with these two and see how they do. QAOA in general can be tricky because the initial values can have a big impact on the execution time, and a graph as large as 10 nodes can have many singular values (saddle points). If you enable logging in Aqua, you can see whether the bottleneck is the circuit simulation or the number of iterations before convergence.&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2019-10-02T20:16:30.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8388" PostTypeId="1" AcceptedAnswerId="8391" CreationDate="2019-10-02T22:17:14.487" Score="1" ViewCount="66" Body="&lt;p&gt;Given that classical physics emerges from quantum physics on a macroscopic scale, and all quantum operators are unitary, how are we able to perform non-unitary operations (such as setting a register to zero) in classical computation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that unitarity must be preserved because information leaks to the environment as heat. However if this is the case, it begs a second question, why can quantum computers not 'simply' leak information to the environment as a hack to allow non-unitary transformations?&lt;/p&gt;&#xA;" OwnerUserId="5174" LastEditorUserId="26" LastEditDate="2019-10-09T06:49:38.523" LastActivityDate="2019-10-09T06:49:38.523" Title="How can classical computations be non-unitary?" Tags="&lt;classical-computing&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8389" PostTypeId="2" ParentId="7188" CreationDate="2019-10-03T01:46:25.630" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/aqua/optimization/max_cut_and_tsp.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;That tutorial&lt;/a&gt; was recently updated. In it you'll find a more familiar way to declare and execute algorithms. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ee = ExactEigensolver(qubitOp, k=1)&#xA;result = ee.run()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;problem&lt;/code&gt; section of the older &lt;em&gt;declarative&lt;/em&gt; form of Aqua execution (which is gradually being moved away from) is a way for the Aqua UI to display a list of algorithms applicable to a user-selected &quot;problem.&quot; It doesn't add anything here.&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2019-10-03T01:46:25.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8390" PostTypeId="1" CreationDate="2019-10-03T05:06:03.463" Score="2" ViewCount="194" Body="&lt;p&gt;I found &lt;a href=&quot;https://www.quantum-inspire.com/kbase/hadamard/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The Hadamard gate can also be expressed as a 90º rotation around the Y-axis, followed by a 180º rotation around the X-axis. So &lt;span class=&quot;math-container&quot;&gt;$H=XY^{1/2}H = X Y^{1/2}H=XY^{1/2}$&lt;/span&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can everything in QM be explained with degrees instead of matrices and vectors?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="55" LastEditDate="2021-01-03T11:09:16.150" LastActivityDate="2021-01-03T11:09:16.150" Title="Can everything in QM be described with degrees instead of matrices and vectors?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;hadamard&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8391" PostTypeId="2" ParentId="8388" CreationDate="2019-10-03T05:30:22.773" Score="3" Body="&lt;p&gt;Quantum computers &lt;em&gt;can&lt;/em&gt; leak information to the environment in order to perform non-unitary transformations. The problem is that this irreversibly entangles the computer's state with the environment, i.e. it is equivalent to measuring the qubits that were leaked. This will collapse the state of the computer and prevent the interference effects that are needed if you want to do a quantum computation that's not secretly just a classical computation.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-10-03T05:30:22.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8392" PostTypeId="1" CreationDate="2019-10-03T05:59:37.133" Score="2" ViewCount="64" Body="&lt;p&gt;Let's say 1000 years from now powerful quantum computers are still a matter of fiction and no useful calculations can be carried out using them. Would this mean that the entire industry of quantum computers was a waste of time? Or did any useful innovations come out of the industry despite there being no quantum computers as of yet?&lt;/p&gt;&#xA;" OwnerUserId="8674" LastEditorUserId="26" LastEditDate="2019-10-09T06:54:47.513" LastActivityDate="2019-10-09T06:54:47.513" Title="Would all quantum computing research be for naught if a powerful enough quantum computer is never built?" Tags="&lt;applications&gt;&lt;research&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8393" PostTypeId="1" CreationDate="2019-10-03T08:19:37.670" Score="6" ViewCount="228" Body="&lt;p&gt;I'm trying to show/convince myself the following statement is correct (I haven't been able to find any similar posts):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;There is no reversible quantum operation that transforms any input state to a state orthogonal to it.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see how this could be true based on the operation being unitary and that you could likely find some input state that isn't transformed into an orthogonal state. Is there a simple way to show/prove this? My unsuccesful approach has been:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be some unitary transformation/operation,&#xA;and &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; some input state decomposed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle=\lambda_1|0\rangle + \lambda_2|1\rangle + \lambda_1|2\rangle + \cdots + \lambda_n|n\rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$$\lambda_1 \lambda_1+\lambda_2 \lambda_2+\cdots+\lambda_n\lambda_n=1,$$&lt;/span&gt; and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|x\rangle = \langle x|U^\dagger$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to show that there exists an input state &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\langle x|U^\dagger|x\rangle = 0$&lt;/span&gt; isn't true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried to make use of the properties of unitary matrices but haven't had much luck.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any assistance or suggestions on alternative approaches on how to show this would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8675" LastEditorUserId="55" LastEditDate="2020-02-04T12:10:19.797" LastActivityDate="2020-02-04T12:10:19.797" Title="Is there a quantum operation whose output is always orthogonal to the input?" Tags="&lt;quantum-operation&gt;&lt;unitarity&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8394" PostTypeId="2" ParentId="8393" CreationDate="2019-10-03T08:37:51.543" Score="4" Body="&lt;p&gt;This is easiest to show by contradiction, so lets suppose that there exists an operation &lt;code&gt;TransformToOrthogonal&lt;/code&gt; that maps the state of its input qubits to an orthogonal state. Reversible quantum operations can be simulated using unitary operators, so we can simulate &lt;code&gt;TransformToOrthogonal&lt;/code&gt; by a matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger = $&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is also normal (that is, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; commutes with its transpose, &lt;span class=&quot;math-container&quot;&gt;$UU^T - U^T U= 0$&lt;/span&gt;), so that we can use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral theorem&lt;/a&gt; to decompose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; into eigenvalues and eigenvectors,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;    U = \sum_i \lambda_i |\psi_i\rangle\langle\psi_i|.&#xA;$$&lt;/span&gt;&#xA;At this point, we're almost at the contradiction; consider what happens if you input qubits that are in one of the eigenstates &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2019-10-03T08:37:51.543" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8395" PostTypeId="2" ParentId="8392" CreationDate="2019-10-03T09:59:02.793" Score="3" Body="&lt;p&gt;On the practical side:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A lot of work is currently going into getting small scale quantum computers to work, and this involves fundamental understanding and manipulation of small quantum systems, be it ions, photons or whatever else. I can only imagine what other uses we would be able to find for having a better grasp on handling these fundamental systems. A side of effect of the industry of quantum computers is also that a lot of research and development is going into for instance cryogenic cooling. If this means that cooling to low temperatures becomes cheaper or easier this could have a multitude of benefits in other areas. The same holds for any other technology being developed for quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the theoretical side:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are of course the &quot;quantum-inspired&quot; algorithms that run on classical computers, but would perhaps have been hard to come up with without thinking about these problems trough the lens of a quantum computer (see for instance the work by Ewin Tang on dequantizing certain quantum algorithms). Beyond that I think the concepts of BQP and related complexity classes helps to have a more clear idea in complexity theory of which problems are hard, and exactly how hard they are. And to paraphrase Scott Aaronson, if the future does not contain large scale quantum computers, then this raises the very interesting question of &lt;em&gt;why&lt;/em&gt;? What would have stopped us from achieving this? Are there some theoretical boundaries that prevent us from doing so? Because that would certainly be a very interesting topic of research.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2019-10-03T09:59:02.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8396" PostTypeId="2" ParentId="8390" CreationDate="2019-10-03T10:05:49.300" Score="1" Body="&lt;p&gt;The state of single qubit can be described as a point on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;. All the allowed transformations of a single qubit can then be described as rotations on the Bloch sphere. Unfortunately, bigger quantum systems can no longer be described as fitting on a sphere like geometry. As a result, this idea of considering transformations as rotations does not hold for all quantum systems.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2019-10-03T10:05:49.300" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8397" PostTypeId="2" ParentId="8373" CreationDate="2019-10-03T10:12:23.043" Score="1" Body="&lt;p&gt;So you want to calculate &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\beta |D\left(\alpha\right)|\beta\right&amp;gt;$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\left|\beta\right&amp;gt;$&lt;/span&gt; is a coherent state and &lt;span class=&quot;math-container&quot;&gt;$D\left(\alpha\right)$&lt;/span&gt; is the displacement operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way of doing this is to take &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\beta |D\left(\alpha\right)|\beta\right&amp;gt; = \left&amp;lt;0|D^\dagger\left(\beta\right) D\left(\alpha\right)D\left(\beta\right)|0\right&amp;gt;$&lt;/span&gt; and write this in terms of the exponential of creation and annihilation operators &lt;span class=&quot;math-container&quot;&gt;$D(\alpha) = \exp( \alpha a^\dagger -\alpha^* a)$&lt;/span&gt;, which I'll denote as &lt;span class=&quot;math-container&quot;&gt;$D(\alpha) = \exp(Y)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, note that &lt;span class=&quot;math-container&quot;&gt;$D^\dagger(\beta) = \exp( \beta^* a -\beta a^\dagger) = D\left(-\beta\right) = \exp(-X)$&lt;/span&gt; and from here, we can use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Baker%E2%80%93Campbell%E2%80%93Hausdorff_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Baker–Campbell–Hausdorff formula&lt;/a&gt;. In this case, &lt;span class=&quot;math-container&quot;&gt;$$\left[X,Y\right] = \left[\beta a^\dagger -\beta^* a,\alpha a^\dagger -\alpha^* a\right] = \beta\alpha^*\left[a, a^\dagger\right] - \beta^*\alpha\left[a, a^\dagger\right] = \beta\alpha^* - \beta^*\alpha$$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\left[a, a^\dagger\right] = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;span class=&quot;math-container&quot;&gt;$\beta\alpha^* - \beta^*\alpha$&lt;/span&gt; is just a constant, this commutes with both &lt;span class=&quot;math-container&quot;&gt;$\beta a^\dagger -\beta^* a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha a^\dagger -\alpha^* a$&lt;/span&gt; and so, all the higher order terms in BCH are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gives that &lt;span class=&quot;math-container&quot;&gt;$e^{-X}e^Y = e^{-X+Y-\frac{1}{2}\left[X, Y\right]}$&lt;/span&gt; and further that &lt;span class=&quot;math-container&quot;&gt;$$e^{-X}e^Ye^X = e^{-X+Y-\frac{1}{2}\left[X, Y\right] + X + \frac{1}{2}\left[-X+Y-\frac{1}{2}\left[X, Y\right],X\right]} = e^{Y - \left[X, Y\right]}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While this still looks complicated, &lt;span class=&quot;math-container&quot;&gt;$\left[X, Y\right] = \beta\alpha^* - \beta^*\alpha$&lt;/span&gt; is still a constant, so we can rewrite this as &lt;span class=&quot;math-container&quot;&gt;$$\left&amp;lt;0|e^{-X}e^Ye^X|0\right&amp;gt;  = \left&amp;lt;0|e^{-\left[X, Y\right]}e^Y|0\right&amp;gt; = e^{-\left[X, Y\right]}\left&amp;lt;0|e^Y|0\right&amp;gt;.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At this point, we can write &lt;span class=&quot;math-container&quot;&gt;$e^Y\left|0\right&amp;gt; = D\left(\alpha\right)\left|0\right&amp;gt; = e^{-\frac{1}{2}\left|\alpha\right|^2}e^{\alpha a^\dagger}\left|0\right&amp;gt;$&lt;/span&gt; (&lt;a href=&quot;https://en.wikipedia.org/wiki/Baker%E2%80%93Campbell%E2%80%93Hausdorff_formula#Application_in_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;which can also be shown using BCH&lt;/a&gt;) to get &lt;span class=&quot;math-container&quot;&gt;$$\left&amp;lt;\beta |D\left(\alpha\right)|\beta\right&amp;gt; = e^{-\beta\alpha^* + \beta^*\alpha}\left&amp;lt;0|e^{-\frac{1}{2}\left|\alpha\right|^2}e^{\alpha a^\dagger}|0\right&amp;gt; = e^{-\beta\alpha^* + \beta^*\alpha - \frac{1}{2}\left|\alpha\right|^2}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-10-03T10:12:23.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8398" PostTypeId="1" AcceptedAnswerId="8422" CreationDate="2019-10-03T11:32:37.647" Score="2" ViewCount="75" Body="&lt;p&gt;A Pauli channel is defined as a convex combination of Pauli operators, i.e. &lt;span class=&quot;math-container&quot;&gt;$\epsilon_{\text{Pauli}} (\rho)=\sum_{j} q_j\sigma_j\rho \sigma_j$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$0 \leq q_j \leq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_j q_j=1$&lt;/span&gt;. Now, I want to transmit firstly a pure state qubit through it, and then a Bell state. How do I start working on this?&lt;/p&gt;&#xA;" OwnerUserId="8027" LastEditorUserId="26" LastEditDate="2019-10-09T06:57:43.400" LastActivityDate="2019-10-09T06:57:43.400" Title="The solution when we transmit a qubit through a Pauli channel?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8399" PostTypeId="1" CreationDate="2019-10-03T12:56:58.777" Score="-3" ViewCount="142" Body="&lt;p&gt;I'm prepared to explore quantum computing which is completely new to me.  Searching for a while on the Internet, I found IBM Qiskit which is an Open Source software necessitated for Quantum Computing.  Also, I found the following documentation;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;a href=&quot;https://medium.com/qiskit/hello-quantum-2c1c00fe830c&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hello Quantum: Taking your first steps into quantum computation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Installing Qiskit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) &lt;a href=&quot;https://www.youtube.com/playlist?list=PLOFEBzvs-Vvp2xg9-POLJhQwtVktlYGbY&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coding with Qiskit&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#notable-changes&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit 0.12&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) &lt;a href=&quot;https://qiskit.org/documentation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit API documentation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;6) &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit IQX Tutorials&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before starting I expect to know whether I need a quantum computer for my exploration?  Or a classic computer, a desktop PC, can do the job?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please shed me some light?  Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="8678" LastEditorUserId="26" LastEditDate="2019-10-09T07:14:46.667" LastActivityDate="2019-10-15T13:20:40.340" Title="Exploring quantum computing with Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ClosedDate="2019-10-08T14:34:16.727" ContentLicense="CC BY-SA 4.0" />
  <row Id="8400" PostTypeId="2" ParentId="8390" CreationDate="2019-10-03T13:06:47.927" Score="0" Body="&lt;p&gt;Short answer: Yes, except for measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There two postulates in play here:&lt;br&gt;&#xA;1- the evolution of a closed QM system can always be described by a unitary matrix.&lt;br&gt;&#xA;2- measurement operators (observable operator) are always hermitian&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hermitian operators can't (always) be described as a rotation in any space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unitary operators can always be considered as rotation around some axis since they always preserve the inner products. However the dimensions of the space where the rotation happens increases as the dimension of the system increase:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;operation on 1 qubit is a rotation on the 2D surface of a 3D sphere (Bloch sphere).  &lt;/li&gt;&#xA;&lt;li&gt;operation on m qubits is a rotation on the &lt;span class=&quot;math-container&quot;&gt;$2^{m+1}$&lt;/span&gt; − 2 dimensions surface of some &lt;span class=&quot;math-container&quot;&gt;$2^{m+1}$&lt;/span&gt; − 1 sphere.  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Which makes this visualization (degrees of rotation) not very helpful when applied to a multi-qubit system.&lt;/p&gt;&#xA;" OwnerUserId="8647" LastEditorUserId="26" LastEditDate="2019-10-09T06:52:27.690" LastActivityDate="2019-10-09T06:52:27.690" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="8401" PostTypeId="2" ParentId="8399" CreationDate="2019-10-03T13:22:02.347" Score="1" Body="&lt;p&gt;IBM's Qiskit consists of multiple components. Qiskit terra provides you the tools for building quantum circuits. You can either run these circuits on an actual quantum device on IBMQ Experience which is a free cloud-based Quantum computer service.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can run your circuit on Qiskit Aer; another Qiskit component. This component simulates the circuit on your classical device to obtain results. plus it provides you with the tools to visualize the quantum state in multiple ways (Bloch sphere, unitary, state vector...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the end of the day, your computation is limited by either the number of the qubits available on the different IBMQ devices or your computer's ability to simulate a quantum circuit. Either way, for learning and exploration this should be enough. &lt;/p&gt;&#xA;" OwnerUserId="8647" LastEditorUserId="26" LastEditDate="2019-10-15T13:20:40.340" LastActivityDate="2019-10-15T13:20:40.340" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8402" PostTypeId="2" ParentId="8393" CreationDate="2019-10-03T16:15:52.247" Score="3" Body="&lt;p&gt;Every unitary matrix can be diagonalized as &lt;span class=&quot;math-container&quot;&gt;$U=S^\dagger \Lambda S$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is unitary and &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is diagonal and contains the eigenvalues (&lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;) of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. So you can consider instead &lt;span class=&quot;math-container&quot;&gt;$$\langle x \vert U \vert x \rangle=\langle x \vert S^\dagger \Lambda S \vert x \rangle = 0.$$&lt;/span&gt;  Defining &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde x \rangle \equiv S \vert x \rangle$&lt;/span&gt;, you only have to convince yourself that there always exists a state &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde x \rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\langle \tilde x \vert \Lambda \vert \tilde x \rangle = \sum \limits_i \lambda_{i}\tilde x_i^\ast \tilde x_i \ne 0.$$&lt;/span&gt;&#xA;That should be pretty easy to see in this form.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-03T16:57:29.360" LastActivityDate="2019-10-03T16:57:29.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8403" PostTypeId="1" AcceptedAnswerId="8404" CreationDate="2019-10-04T02:32:57.340" Score="2" ViewCount="59" Body="&lt;p&gt;A source constantly produces a stream of photons in one of the following states&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi_1\rangle=\dfrac{1}{\sqrt2}(a|00\rangle+ b|01\rangle+c|10\rangle+d|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi_2\rangle=\dfrac{1}{\sqrt2}(b|00\rangle+ a|01\rangle+d|10\rangle+ c|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d$&lt;/span&gt; are some (valid) scalar values &lt;strong&gt;you know beforehand&lt;/strong&gt; and &lt;span class=&quot;math-container&quot;&gt;$a\ne b\ne c\ne d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are only sent the first qubit and have no access to the second qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to design a measurement (on the first qubit) that allow yout to tell whether the source is producing &lt;span class=&quot;math-container&quot;&gt;$|\varphi_1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\varphi_2\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume you can measure as many times as you want.&lt;/p&gt;&#xA;" OwnerUserId="8421" LastEditorUserId="26" LastEditDate="2019-10-09T06:58:14.250" LastActivityDate="2019-10-09T06:58:14.250" Title="How to design a measurement that distinguishes the following pair of two-qubit states?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8404" PostTypeId="2" ParentId="8403" CreationDate="2019-10-04T05:23:56.187" Score="4" Body="&lt;p&gt;Write down the two reduced density matrices of the single qubits that you have access to. Apply the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4172/1837&quot;&gt;Helstrom measurement&lt;/a&gt; (there are several descriptions of this on the site already).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that, in this case, the two reduced density matrices are the same. That means that you cannot tell them apart. More explicitly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi_2\rangle=(I\otimes X)|\varphi_1\rangle&#xA;$$&lt;/span&gt;&#xA;The only different between the two states is on the second qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-10-04T07:19:35.250" LastActivityDate="2019-10-04T07:19:35.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8405" PostTypeId="2" ParentId="8393" CreationDate="2019-10-04T07:15:20.020" Score="4" Body="&lt;p&gt;The existing answers have quite an elegant idea behind them. However, my concern is that they don't seem to allow for the introduction of an ancilla. If we introduced an ancilla in a fixed state, and applied a unitary across the two systems, then it &lt;em&gt;could&lt;/em&gt; be that all the eigenvectors are entangled across the two subsystems, and the basic argument wouldn't apply since we'd only be trying to make an argument about a separable input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that I would approach such a calculation (I'll do it only for a single qubit here. That's sufficient to make the necessary argument, but you could extend it to any Hilbert space if you wanted). Let &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; be the Choi map of our operation. This means that, for an input state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, the output state would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{\psi}=2\text{Tr}_1(|\psi\rangle\langle\psi|^T\otimes I\cdot\Phi).&#xA;$$&lt;/span&gt;&#xA;This is successful if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}((I-|\psi\rangle\langle\psi|)\rho_{\psi})=1.&#xA;$$&lt;/span&gt;&#xA;Now, we need this to be true for all possible input states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\cos\frac{\theta}{2}|0\rangle+\sin\frac{\theta}{2}e^{i\phi}|0\rangle$&lt;/span&gt;, so the average over all possible input states must also be 1. In other words, we want&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2\pi}\int_0^{2\pi}d\phi\int_0^{\pi}\sin\theta d\theta\ \text{Tr}\left(|\psi\rangle\langle\psi|^T\otimes(I-|\psi\rangle\langle\psi|)\Phi\right)=1.&#xA;$$&lt;/span&gt;&#xA;If we work this out, it means that we require&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\left(M\Phi\right)=1&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\left(\begin{array}{cccc}&#xA;\frac{1}{3} &amp;amp; 0 &amp;amp; 0 &amp;amp; -\frac{1}{3} \\&#xA;0 &amp;amp; \frac{2}{3} &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \frac{2}{3} &amp;amp; 0 \\&#xA;-\frac13 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac13&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;So, what's the best choice of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;? It's an eigenvector of maximum eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. But the maximum eigenvalue is &lt;span class=&quot;math-container&quot;&gt;$\frac23$&lt;/span&gt;, meaning that it is impossible to achieve &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(M\Phi)&amp;gt;\frac23$&lt;/span&gt;, and hence it is impossible to give an orthogonal output for all possible single-qubit input states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By way of contrast, if we restrict to just real states (i.e. &lt;span class=&quot;math-container&quot;&gt;$\phi=0$&lt;/span&gt;), the maximum eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is larger that 1, which leaves open the possibility for creating an orthogonal state, which we know is possible just by applying Pauli-&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. This corresponds with &lt;span class=&quot;math-container&quot;&gt;$\Phi=(I\otimes Y)|B_{00}\rangle\langle B_{00}|(I\otimes Y)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-04T07:15:20.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8409" PostTypeId="2" ParentId="6519" CreationDate="2019-10-04T18:36:55.667" Score="5" Body="&lt;p&gt;Mathematically it is a relationship between a bipartite linear operator vector space &lt;span class=&quot;math-container&quot;&gt;$L(X\otimes Y)$&lt;/span&gt; and a &lt;em&gt;superoperator&lt;/em&gt; vector space &lt;span class=&quot;math-container&quot;&gt;$C(X): L(X)\to L(Y)$&lt;/span&gt; (maps of linear operators to linear operators). Bipartite density matrices are contained in the former, and quantum channels in the latter. The real &quot;physical&quot; meaning of the isomorphism for quantum information theory is that a superoperator is a valid quantum channel if and only if its Choi-state is a valid density matrix. You can read more about properties of the Choi-representation (and other representations of quantum channels) in my &lt;a href=&quot;https://arxiv.org/abs/1111.6950&quot; rel=&quot;nofollow noreferrer&quot;&gt;review article [1]&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also has several quantum computing applications outside of quantum information theory. The most common two are probably&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantum process tomography&lt;/li&gt;&#xA;&lt;li&gt;Gate teleportation (especially in measurement based quantum computing)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Matthew Leiffer has a &lt;a href=&quot;http://mattleifer.info/2011/08/01/the-choi-jamiolkowski-isomorphism-youre-doing-it-wrong/&quot; rel=&quot;nofollow noreferrer&quot;&gt;good blog post [2]&lt;/a&gt; which describes point 2 (and talks more generally about the Choi-Jamiolkowski isomorphism in the context of some of his research on conditional states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For point 1. If if one wants to experimentally reconstruct a description of a quantum channel they basically need to reconstruct the Choi-matrix representation of the channel. This is typically done by preparing a tomographically complete set of input states (states that span the input state space), and perform a tomographyically complete set of measurements (measurements with outcomes projectors that span the output state space) and use the resulting probabilities to reconstruct the description of the channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the point of view of measurement probabilities, the &quot;channel&quot; is indistinguishable from a bipartite &quot;state&quot; that we would have performed state tomography on, and so we can reconstruct the description as if we were simply reconstructing a bipartite density matrix using state tomography (there are some subtleties concerning the trace preserving property which I won't get into). You can see an example of process tomography in this Qiskit Ignis &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/ignis/6b_process_tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial notebook [3]&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The is also another way to do process tomography called &lt;em&gt;Ancilla assisted process tomography [4]&lt;/em&gt; which is a physical implementation of the Choi-Jamiolkowski isomorphism. You could prepare a maximally entangled bell state, send half of it through the channel to be investigated (and do nothing to the other half), and then perform state tomography of the full output to directly reconstruct the Choi-state for the unknown channel. This is rarely used in practice as it is typically less accurate than the standard method due to errors in preparing the maximally entangled input state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Quant. Inf. Comp. 15, 0579-0811 (2015) &lt;a href=&quot;https://arxiv.org/abs/1111.6950&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1111.6950 [quant-ph]&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] &lt;a href=&quot;http://mattleifer.info/2011/08/01/the-choi-jamiolkowski-isomorphism-youre-doing-it-wrong/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mattleifer.info/2011/08/01/the-choi-jamiolkowski-isomorphism-youre-doing-it-wrong/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/ignis/6b_process_tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit-iqx-tutorials/qiskit/advanced/ignis/6b_process_tomography.ipynb&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[4] Physical Review Letters 90, 193601 (2003), &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303038&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0303038&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8650" LastEditorUserId="26" LastEditDate="2019-10-11T05:02:44.257" LastActivityDate="2019-10-11T05:02:44.257" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8410" PostTypeId="2" ParentId="8374" CreationDate="2019-10-04T19:13:05.443" Score="7" Body="&lt;p&gt;Much of the research on quantum algorithms that may have applications to AI is centered on quantum machine learning (QML). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;While I'd argue there are quite a few hypothetical reasons that QML could be used in machine learning some time in the future, QML research is in its infancy relative to classical machine learning research and its practical benefits aren’t quite clear. Here’s a broad overview of some general themes that appear to be emerging:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;We know that QML can provide algorithmic speedups.&lt;/strong&gt; Much of the work in QML has been based on the &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; (also known as the quantum linear system algorithm). While somewhat controversial, the speedups of QML algorithms based on the HHL algorithm were originally thought to be exponential (given some quite severe caveats, see &lt;a href=&quot;https://www.scottaaronson.com/papers/qml.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Aaronson and &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/papers/linear.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;another&lt;/a&gt; by Childs). Now, however, the speedups are generally believed to be polynomial (in many cases) due to the assumptions made in developing many QML algorithms and dequantization arguments (see &lt;a href=&quot;https://arxiv.org/abs/1807.04271&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1811.00414&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). For a nice overview, see this &lt;a href=&quot;https://www.quantamagazine.org/teenager-finds-classical-alternative-to-quantum-recommendation-algorithm-20180731/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quanta article&lt;/a&gt;. Also note that some of the caveats discussed in the links above have been addressed by refinements to the HHL algorithm. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;It's unclear to what extent quantum information enhances or limits model representations.&lt;/strong&gt; When developing a machine learning model, one of the central goals is to generate a learned representation (e.g. the parameters of a model) that enables us to make accurate predictions. An interesting question in this respect is whether using qubits to generate a learned representation offers any advantage over the standard (classical) representations currently being generated. Intuitively, quantum representations may have advantages for certain problems that inherently involve quantum effects, such as molecular simulation. As far as I know, whether such advantages actually exist and extend to problems that are purely classical is an open question.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;The linearity of quantum mechanics represents a challenge to developing certain kinds of QML approaches.&lt;/strong&gt; Many classical machine learning algorithms benefit heavily from non-linear functions (think of the sigmoid or hyperbolic tangent activation functions sometimes used in neural networks). Quantum mechanics is necessarily linear (if I remember correctly, in his book &lt;a href=&quot;https://www.scottaaronson.com/democritus/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computing Since Democritus&lt;/em&gt;&lt;/a&gt;, Aaronson notes that if quantum mechanics were non-linear then &lt;span class=&quot;math-container&quot;&gt;$\mathbf{P}=\mathbf{NP}$&lt;/span&gt;). Given that most contemporary AI is powered by 'deep learning' approaches (that mostly means neural networks), it's unclear to what extent our current classical approaches can simply be translated into some quantum version. I suspect that this problem is not insurmountable and that we may yet find clever ways to build QML algorithms that are both efficient and have many of the benefits of existing approaches that exploit non-linearities (along with other benefits, perhaps). Already, quantum machine learning research has revealed new insights into a variety of machine learning problems; the Quanta article above provides one clear example.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Like their classical counterparts, QML algorithms will require regularization.&lt;/strong&gt; It's been argued that some existing QML algorithms would massively overfit the data, severely limiting generalizability (for example, Peter Wittek notes the issue &lt;a href=&quot;https://peterwittek.com/understanding-quantum-svms.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; while discussing quantum support vector machines). In classical machine learning, to ensure the ability of a model to generalize, we usually make use of some kind of &lt;a href=&quot;https://en.wikipedia.org/wiki/Regularization_%28mathematics%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;regularization&lt;/a&gt; technique. I haven't yet seen any research around a QML approach to regularization; perhaps someone else can comment on whether such approaches have been proposed. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;There's certainly more that could be discussed relating to this question and, to be transparent, I wouldn't count myself as an expert today. I hope more answers roll in but, until then, perhaps the information above can provide some context around what I would suggest the answer to your question is: &lt;strong&gt;We don't know, yet&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2019-11-13T02:43:06.623" LastActivityDate="2019-11-13T02:43:06.623" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8411" PostTypeId="1" CreationDate="2019-10-04T22:59:44.357" Score="1" ViewCount="114" Body="&lt;p&gt;What is the cost of implementing the Quantum Fourier transform (QFT) in a classical computer? We know we require at least &lt;span class=&quot;math-container&quot;&gt;$\log{n}$&lt;/span&gt; depth quantum circuits to do a QFT in a quantum computer, with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; being the number of input qubits. Is there a similar result for classical computers?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="26" LastEditDate="2019-10-09T07:17:16.577" LastActivityDate="2019-10-09T07:17:16.577" Title="What is the cost of implementing the Quantum Fourier transform in a classical computer?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;simulation&gt;&lt;quantum-fourier-transform&gt;&lt;space-complexity&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2021-03-22T07:19:39.983" ContentLicense="CC BY-SA 4.0" />
  <row Id="8412" PostTypeId="1" AcceptedAnswerId="8414" CreationDate="2019-10-05T01:10:31.703" Score="1" ViewCount="54" Body="&lt;pre&gt;&lt;code&gt;operation Task12 (queryRegister : Qubit[], target : Qubit, pattern : Int[]) : Unit {&#xA;&#xA;    body (...) {&#xA;        using (c = Qubit[Length(queryRegister)]) {&#xA;&#xA;           ApplyToEachA(X, c);&#xA;&#xA;            for (i in 0..Length(queryRegister) - 1) {&#xA;&#xA;                if (pattern[i] == 0) {&#xA;                    CNOT(queryRegister[i], c[i]);&#xA;                } elif (pattern[i] == 1)  {&#xA;                    X(c[i]);&#xA;                    CNOT(queryRegister[i], c[i]);&#xA;                }&#xA;            }&#xA;&#xA;            Controlled X(c, target);&#xA;            // ResetAll(c);&#xA;        }&#xA;    }&#xA;&#xA;    adjoint auto;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to uncomment that ResetAll(c) line as I believe the right thing to do is to return the system the qubits in the same state as they were borrowed. But somehow the adjoint auto gives an error to the ResetAll(c) line. Will my code work just fine without the Reset line?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation Task12 (queryRegister : Qubit[], target : Qubit, pattern : Int[]) : Unit {&#xA;&#xA;        body (...) {&#xA;            using (c = Qubit[Length(queryRegister)]) {&#xA;&#xA;                within {&#xA;&#xA;                    ApplyToEachA(X, c);&#xA;&#xA;                    for (i in 0..Length(queryRegister) - 1) {&#xA;&#xA;                        if (pattern[i] == 0) {&#xA;                            CNOT(queryRegister[i], c[i]);&#xA;                        } elif (pattern[i] == 1)  {&#xA;                            X(c[i]);&#xA;                            CNOT(queryRegister[i], c[i]);&#xA;                        }&#xA;                    }&#xA;                }&#xA;&#xA;                apply {&#xA;&#xA;                    Controlled X(c, target);&#xA;                }&#xA;            }&#xA;        }&#xA;&#xA;        adjoint auto;&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Will this work? I don't have the driver file of this code, hence have to rely completely off the error detection of vscode. Thanks for help.&lt;/p&gt;&#xA;" OwnerUserId="8695" LastEditorUserId="26" LastEditDate="2019-10-09T07:18:22.003" LastActivityDate="2019-10-09T07:19:05.603" Title="ResetAll with adjoint auto" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8413" PostTypeId="1" CreationDate="2019-10-05T04:32:36.563" Score="1" ViewCount="50" Body="&lt;p&gt;I know just the basics of quantum computer i.e. superposition, entanglement, gates and few other kinds of stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the question is it possible to transfer a trained machine learning model from IBM Q(don't much about quantum algorithms) to AWS, GCP or Azure? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes will it have the same accuracy that we get IBM Q?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes how to do that?&lt;/p&gt;&#xA;" OwnerUserId="8693" LastEditorUserId="8693" LastEditDate="2019-10-05T18:14:01.523" LastActivityDate="2019-10-05T18:14:01.523" Title="Transfer trained machine learning model" Tags="&lt;ibm-q-experience&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8414" PostTypeId="2" ParentId="8412" CreationDate="2019-10-05T04:51:04.600" Score="2" Body="&lt;p&gt;Yes, removing the ResetAll will prevent your code from running. Q# assumes that released qubits are in the 00..0 state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One option is uncomputation - essentially, applying the adjoint of the operations you've applied. For instance,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9esGI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9esGI.png&quot; alt=&quot;Uncomputation example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first two ancilla qubits are left unchanged by the last operation, but the last qubit has been modified and is dependent on &lt;span class=&quot;math-container&quot;&gt;$x_1, x_2, x_3 $&lt;/span&gt;. In your case, you'd want to apply the adjoints of your operations in reverse order (&lt;span class=&quot;math-container&quot;&gt;$U_a U_b CX U_b^{\dagger} U_a^{\dagger}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U_a U_b$&lt;/span&gt; are arbitrary unitaries and &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; is the CNOT gate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q# has &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/statements?view=qsharp-preview#conjugations&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;conjugation&lt;/em&gt; functionality&lt;/a&gt; that may be useful in your case! &lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="26" LastEditDate="2019-10-09T07:19:05.603" LastActivityDate="2019-10-09T07:19:05.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8415" PostTypeId="1" AcceptedAnswerId="8419" CreationDate="2019-10-05T08:08:35.003" Score="1" ViewCount="66" Body="&lt;p&gt;I'm told that the input register is in little-endian format. But the vscode gives me error telling me that it is wrong argument for QFT even after using a suitable converter. Am I missing something here?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    operation Task31 (qs : Qubit[]) : Unit {&#xA;        X(qs[Length(qs)-1]);&#xA;        ApplyReversedOpBE(QFT, qs);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8695" LastEditorUserId="26" LastEditDate="2019-10-09T06:44:14.050" LastActivityDate="2019-10-09T06:44:14.050" Title="Unable to recognise little-endian format" Tags="&lt;q#&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8416" PostTypeId="1" AcceptedAnswerId="8439" CreationDate="2019-10-05T10:09:31.763" Score="8" ViewCount="202" Body="&lt;p&gt;It is known that every state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-level system (or if you prefer, qudits living in a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional Hilbert space) can be mapped into elements of &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^{d^2-1}$&lt;/span&gt; through the mapping provided by the &lt;em&gt;Bloch representation&lt;/em&gt;, by writing it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{1}{d}\left(I+\sum_{k=1}^{d^2-1} c_k \sigma_k\right),$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_k\}$&lt;/span&gt; traceless Hermitian matrices satisfying &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\sigma_j\sigma_k)=d\delta_{jk}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_k\in\mathbb R$&lt;/span&gt;.&#xA;We can then consider the mapping &lt;span class=&quot;math-container&quot;&gt;$f:\rho\mapsto f(\rho)\equiv\boldsymbol c\in\mathbb R^{d^2-1}$&lt;/span&gt;.&#xA;One can also show that the set of all states maps into a compact set in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^{d^2-1}$&lt;/span&gt;, and furthermore characterise the boundary of this set in &quot;spherical coordinates&quot;, as shown for example in &lt;a href=&quot;https://physics.stackexchange.com/a/425101/58382&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, as shown for example &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5603/55&quot;&gt;in the answers to this question&lt;/a&gt;, the purity of a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; translates into the norm of &lt;span class=&quot;math-container&quot;&gt;$f(\rho)$&lt;/span&gt; (i.e. its distance from the origin): &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\rho^2)=(1+\|f(\rho)\|^2)/d$&lt;/span&gt;.&#xA;It follows that if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure, that is &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\rho^2)=1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\|f(\rho)\|=\sqrt{d-1}$&lt;/span&gt;. &lt;em&gt;This means that the set of pure states is a subset of the hypersphere &lt;span class=&quot;math-container&quot;&gt;$S^{d^2-2}\subseteq\mathbb R^{d^2-1}$&lt;/span&gt; with radius &lt;span class=&quot;math-container&quot;&gt;$\sqrt{d-1}$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the pure states &lt;em&gt;do not&lt;/em&gt; cover this hypersphere: the boundary of the set of states is &lt;em&gt;not&lt;/em&gt; comprised of pure states (see e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6009/55&quot;&gt;this question&lt;/a&gt;), and many (most) elements on &lt;span class=&quot;math-container&quot;&gt;$S^{d^2-2}$&lt;/span&gt; do not correspond to physical states. This tells us that the set of pure states does &lt;em&gt;not&lt;/em&gt; lie on a hypersphere in the Bloch representation (which must obviously be true, as we know that the set of pures has a much smaller dimension).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But then again, this does not (I think?) rule out the possibility that the set of pure states lies on &lt;em&gt;some&lt;/em&gt; lower-dimensional hypersphere &lt;span class=&quot;math-container&quot;&gt;$S^{2d-3}$&lt;/span&gt; embedded in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^{d^2-1}$&lt;/span&gt;. Is this the case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-26T11:57:03.617" LastActivityDate="2020-07-26T11:57:03.617" Title="Do pure qudit states lie on a hypersphere in the Bloch representation?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8417" PostTypeId="1" CreationDate="2019-10-05T11:35:09.520" Score="3" ViewCount="98" Body="&lt;p&gt;I need to do some popularization of science for an event, and I would like to talk about the &quot;best&quot; applications of quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there is code-breaking (Shor algorithm), simulation of quantum systems, deep learning, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like an example that talks to the public. I think I have read at some point that we could be using chemistry simulation simulating drugs on computers. So basically the concept of drugs would enter in the simulation era.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I haven't found source easily on this again I would like to check if it is science fiction or it is true we could do it by simulating large molecules (because if it is true it would be for my perspective the best application of quantum computer by far).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am also interested in other nice applications of quantum computing &quot;not too abstract&quot; if you have ideas or sources on them.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="26" LastEditDate="2019-10-08T21:44:15.233" LastActivityDate="2019-10-08T21:44:15.233" Title="Applications of quantum computing for science popularization" Tags="&lt;applications&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8418" PostTypeId="2" ParentId="8417" CreationDate="2019-10-05T12:58:38.840" Score="4" Body="&lt;p&gt;There is good reason to believe that quantum computers will eventually play an important role in drug discovery.  Perhaps the best way to show that it's not science fiction is to talk about the startups forming that are focused on QC-enabled drug discovery.  The companies that I know of that fit this description are&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.proteinqure.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ProteinQure&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumsimulations.de/&quot; rel=&quot;nofollow noreferrer&quot;&gt;HQS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://gtn.ai/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GTN&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://qulab.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qulab&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://riverlane.io/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Riverlane&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2019-10-05T12:58:38.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8419" PostTypeId="2" ParentId="8415" CreationDate="2019-10-05T15:07:10.380" Score="3" Body="&lt;p&gt;You'll need to cast your qubit array as type &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.arithmetic.littleendian?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;LittleEndian&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let LEArray = LittleEndian(qs);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A good example of this is in the QuantumKatas under &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/8621795b0d8e2005ff7037f814718669b84697e8/PhaseEstimation/ReferenceImplementation.qs#L81&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Phase Estimation&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-10-05T15:07:10.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8422" PostTypeId="2" ParentId="8398" CreationDate="2019-10-06T02:22:41.867" Score="1" Body="&lt;p&gt;Let's say &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; is the pure state qubit and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; is the bell state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; through the Pauli channel depends on which of the Pauli gates (which of the &lt;span class=&quot;math-container&quot;&gt;$\sigma_j$&lt;/span&gt;) you want acting on it. Once you choose this (call it &lt;span class=&quot;math-container&quot;&gt;$\sigma_a$&lt;/span&gt;), apply &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; Identity operators to it on either side until it's the same size as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, then just do the matrix multiplication: &lt;span class=&quot;math-container&quot;&gt;$q_a\sigma_a \rho \sigma_a$&lt;/span&gt;, where the &lt;span class=&quot;math-container&quot;&gt;$\sigma_a$&lt;/span&gt; are both implicitly including enough identity matrices to make them the same size as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Bell state will involve two qubits, so you can choose up to &lt;em&gt;two&lt;/em&gt; Pauli operators (&lt;span class=&quot;math-container&quot;&gt;$\sigma_b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_c$&lt;/span&gt;) that will act on it. You take the result of the previous matrix multiplication and do another matrix multiplication. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can fill in more details, but it is starting to feel like I'm doing homework for you so let's see if you can follow what I've written and if you have follow-up questions in the comments I can modify my answer.&lt;/p&gt;&#xA;" OwnerUserId="5518" LastActivityDate="2019-10-06T02:22:41.867" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8423" PostTypeId="2" ParentId="8348" CreationDate="2019-10-06T02:42:49.843" Score="3" Body="&lt;p&gt;When I visited the Google Hardware Lab, they were extremely secretive about everything. It is unlikely anyone will be able to answer this question except for the narrow range of Google Hardware Lab employees, and the ones I know are not very open about what Google is doing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I can do is answer what a different superconducting-qubit hardware company (D-Wave) does. When I did the D-Wave tour, I was shown a &quot;wafer&quot; which was an NxN array of 2000Q chips. So I was looking at &lt;span class=&quot;math-container&quot;&gt;$N\times N\times2048$&lt;/span&gt; qubits. Each of these chips will have defects in random places. Some might have bad qubits only on an edge, some might have bad qubits in the middle, etc. &lt;strong&gt;Therefore, it is probably just good fortune that they published a paper where the bad qubit was in a convenient location&lt;/strong&gt;. This hopefully answers your first question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next you ask if a bad qubit in the middle would make processing more difficult and I think the answer is yes, because middle qubits are connected to more qubits, so there's more potential gate operations which are affected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know how many Sycamore processors are made at any given time, you'll probably need an answer from someone at the Google Hardware Lab, but D-Wave gets a new &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; array of 2000Q chips every week, where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is about 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they fabricated on a wafer? D-Wave's ones are, and likely Google does the same. They are all making super-conducting qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do they pick-and-choose the Sycamore chip with the best performance? Probably the answer is &quot;yes&quot; because you say the bad qubit was on an edge, and the chances of that seem less likely than it being in the middle. Furthermore, it is unlikely that they had much motivation to choose a &quot;random&quot; chip or a &quot;bad&quot; chip rather than a &quot;good&quot; one. The company is interested in making profits, so I don't see the motivation to choose a more &quot;fair&quot; chip for a publication.&lt;/p&gt;&#xA;" OwnerUserId="5518" LastActivityDate="2019-10-06T02:42:49.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8424" PostTypeId="1" CreationDate="2019-10-06T12:24:42.203" Score="5" ViewCount="146" Body="&lt;p&gt;Are there quantum algorithms for Prolog (SLD resolution - unification and depth-first-search) or for automated theorem proving in general (negation, resolution, and SAT)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually automated theorem proving involves SAT problem for the negation of the initial statement and there is some better (but no exceptionally better) algorithms for that, e.g. &lt;a href=&quot;https://cstheory.stackexchange.com/questions/36428/do-any-quantum-algorithms-improve-on-classical-sat&quot;&gt;Do any quantum algorithms improve on classical SAT?&lt;/a&gt;. But maybe there are some new ideas, some holistic approaches that involve the parallel search available on quantum computers? Google is of no help (&quot;automated theorem proving quantum algorithm&quot; no any result).&lt;/p&gt;&#xA;" OwnerUserId="1326" LastEditorUserId="55" LastEditDate="2020-09-23T12:21:47.233" LastActivityDate="2020-09-23T12:21:47.233" Title="Quantum algorithms for Prolog or automated theorem proving?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8427" PostTypeId="1" AcceptedAnswerId="8565" CreationDate="2019-10-06T21:20:11.143" Score="5" ViewCount="1771" Body="&lt;p&gt;I was skimming through the &lt;a href=&quot;https://www.inverse.com/article/59507-full-quantum-supremacy-paper&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google quantum supremacy paper&lt;/a&gt; but got stuck on this section:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For a given circuit, we collect the measured bit-strings &lt;span class=&quot;math-container&quot;&gt;$\{x_i\}$&lt;/span&gt; and compute the linear XEB fidelity [24-26, 29], which is the mean of the simulated probabilities of the bit strings we measured:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F}_{\text{XEB}} = 2^n\langle P(x_i)\rangle - 1 \tag {1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits, &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; computed for the ideal quantum circuit, and the average is over observed bitstrings. Intuitively, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\text{XEB}$&lt;/span&gt; is correlated with how often we sample high probability bitstrings. When there are no errors in the quantum circuit, sampling the probability distribution will produce &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\text{XEB} = 1$&lt;/span&gt;. On the other hand, sampling from the uniform distribution will give &lt;span class=&quot;math-container&quot;&gt;$\langle P(x_i)\rangle_i = 1/2^n$&lt;/span&gt; and produce &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_\text{XEB} = 0$&lt;/span&gt;. Values of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{XEB}$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; correspond to the probability that no error has occurred while running the circuit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{XEB} = 1$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; are sampled from the correct distribution then &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt; P(x_i) \right&amp;gt;_i$&lt;/span&gt; must be &lt;span class=&quot;math-container&quot;&gt;$2^{1-n}$&lt;/span&gt; (for any quantum circuit). That seems to restrict the output probability distributions of all quantum circuits to rather high entropy distributions. This is not what I would have expected for any kind of computation. Is this correct?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; computed for the ideal quantum circuit, then how can &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt; P(x_i) \right&amp;gt;_i$&lt;/span&gt; equal &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; when the bitstrings &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; are sampled from the uniform distribution? This is the result we would see if &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; had been &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; (i.e. the probability mass function for the uniform distribution), but it is explicitly stated that &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; computed for the ideal quantum circuit. Intuitively it seems to me more reasonable to assume that &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt; P(x_i) \right&amp;gt;_i$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; sampled from the uniform distribution would be much closer to zero, because if &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; concentrates much of its probability mass to a relatively low number of bitstrings (as I would assume computation to do) then &lt;span class=&quot;math-container&quot;&gt;$P(x_i) = 0$&lt;/span&gt; for almost all bitstrings from the uniform distribution.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can the value of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{XEB}$&lt;/span&gt; correspond to &amp;quot;the probability that no error has occurred while running the circuit&amp;quot;? This sounds so simple/simplistic to me that it's hard to believe.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; 2019-10-23: The article &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum supremacy using a programmable superconducting processor&lt;/a&gt; has now been published in Nature, and the Supplementary Information is available there.&lt;/p&gt;&#xA;&lt;p&gt;Having read section IV (XEB Theory) of the Supplemental Information I'd like to adjust my questions as follows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Subsection C (Two limiting cases) derives this fact from the properties of probability distributions of the Porter-Thomas&#xA;shape. The derivation looks correct to me. The answer here seems to be that my intuition (that the output distribution would be relatively low entropy) was simply wrong.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subsection C also contains this passage: &amp;quot;[Suppose] bitstrings &lt;span class=&quot;math-container&quot;&gt;$q_i$&lt;/span&gt; are sampled from the uniform distribution. In this case &lt;span class=&quot;math-container&quot;&gt;$P(q_i) = 1/D$&lt;/span&gt; [where &lt;span class=&quot;math-container&quot;&gt;$D = 2^n$&lt;/span&gt;] for every i and &lt;span class=&quot;math-container&quot;&gt;$F_{XEB} = 0$&lt;/span&gt;.&amp;quot; I see this as very problematic since the main text of the article makes the claim that &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; computed for the ideal quantum circuit&amp;quot;. How can these two statements be reconciled?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Subsection V (Quantifying errors) contains a lengthy discussion of this. I can't say I understand it in full, but I'll give it the benefit of a doubt for now.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So, in summary, my question is now: &lt;strong&gt;The main article states that &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; computed for the ideal quantum circuit&amp;quot;. However, Supplementary Information section IV.C seems to argue that if the &amp;quot;qubits are in the maximally mixed state&amp;quot; (i.e. the quantum computer doesn't work) then &amp;quot;the estimator [&lt;span class=&quot;math-container&quot;&gt;$F_{XEB}$&lt;/span&gt;] yields zero fidelity&amp;quot; since &lt;span class=&quot;math-container&quot;&gt;$P(x_i) = 1/2^n$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in this case. But then, in this case, &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is clearly the probability of sampling bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; from the non-ideal empirical distribution. Isn't this a contradiction?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As I see it either &lt;span class=&quot;math-container&quot;&gt;$F_{XEB}$&lt;/span&gt; is computed such that &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; being sampled from the ideal quantum circuit, or it is computed such that &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; being sampled from the empirical non-ideal distribution. It can't be both. Which is it?&lt;/p&gt;&#xA;" OwnerUserId="8704" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-10-24T14:23:20.937" Title="Quantum Supremacy: Some questions on cross-entropy benchmarking" Tags="&lt;experiment&gt;&lt;entropy&gt;&lt;quantum-advantage&gt;&lt;google-sycamore&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8428" PostTypeId="1" CreationDate="2019-10-07T04:02:03.347" Score="1" ViewCount="74" Body="&lt;p&gt;I was going through a paper in which protocol said that the party computes modulo 'd' sum of other party secrets directly. It was not mentioned that the computation is classical. Can I assume that it was done classically? Am I wrong?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="26" LastEditDate="2019-10-08T21:41:17.763" LastActivityDate="2019-10-08T21:41:17.763" Title="Can quantum computer perform classical computation?" Tags="&lt;classical-computing&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2019-10-08T14:35:02.060" ContentLicense="CC BY-SA 4.0" />
  <row Id="8429" PostTypeId="2" ParentId="8428" CreationDate="2019-10-07T06:13:29.730" Score="1" Body="&lt;p&gt;Yes, assume it's classical.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, unless the protocol requires you to start computing it on superpositions. In that case, you'd have to perform the calculation on a quantum computer, although you can still use the reversible version of the classical algorithm on that quantum computer (because quantum computers can implement any classical computation, you just have to embed it in a reversible form first).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-07T06:13:29.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8430" PostTypeId="2" ParentId="8427" CreationDate="2019-10-07T19:06:31.613" Score="2" Body="&lt;p&gt;As an initial matter, I think the Supplementary Information (linked in some other answers on this sight) has a significant amount of discussion on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{XEB}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I understand it (misunderstandings are my own):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;There is indeed a concentration of outputs from a random quantum circuit, away from a state wherein the square of the coefficients of each basis is &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;.  It's clear that sampling from a random quantum circuit will never output a string &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; when the amplitude &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; - that is, if, after application of the quantum circuit, we have &lt;span class=&quot;math-container&quot;&gt;$\alpha|x_i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha=0$&lt;/span&gt;, then sampling will never output &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;.  Instead, sampling from a state so produced leads to the &quot;Porter-Thomas&quot; distribution, about which I don't know much.  That is, &lt;em&gt;if&lt;/em&gt; you were to sample a string from a state generated from a random quantum circuit, and &lt;em&gt;if&lt;/em&gt; you were to, then, calculate the squared amplitude of sampling said string from said quantum circuit, &lt;em&gt;then&lt;/em&gt; the expected squared amplitude is &lt;span class=&quot;math-container&quot;&gt;$2/2^n$&lt;/span&gt;, and not &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I think in the uniform distribution, &lt;span class=&quot;math-container&quot;&gt;$P(x_i)=1/2^n$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, but if we get &lt;em&gt;any&lt;/em&gt; string from the random quantum circuit, there's good odds that that string is &lt;em&gt;more likely&lt;/em&gt; to be seen from the random quantum circuit than from the uniform distribution.  For &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; that are in the &quot;shadow&quot; of the speckle, you would never sample them.  As I understand it, classical simulation does not generate all &lt;span class=&quot;math-container&quot;&gt;$2^{53}$&lt;/span&gt; coefficients; instead, classical simulation looks at the string output of the random circuit and asks whether the squared coefficient of that basis is greater than &lt;span class=&quot;math-container&quot;&gt;$1/2^{53}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Upon review, I think that the average fidelity &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{XEB}$&lt;/span&gt; of a sample of strings wherein there was at least one randomly-introduced &lt;em&gt;single&lt;/em&gt; Pauli-error (bit-flip/phase-shift) is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.  That is, if we were to sample a string from such a circuit that has a hidden Pauli-error somewhere within, and calculate the probability of obtaining that string with that circuit, the expected probability so calculated would be &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;.  Thus, if we were to say that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{XEB}=0.9$&lt;/span&gt;, I believe this means that 90% of the runs of the quantum circuit were totally error-free, while 10% had at least one error.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;At one of Martinis' presentations on Google's plans for quantum supremacy, an audience member asked about a quantum sampler beating the uniform distribution; Aaronson commented that generating an output away from the uniform distribution is &lt;em&gt;necessary&lt;/em&gt; to establish quantum supremacy, regardless of whether it's &lt;em&gt;sufficient&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-10-13T12:40:01.387" LastActivityDate="2019-10-13T12:40:01.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8431" PostTypeId="1" CreationDate="2019-10-08T02:29:43.983" Score="4" ViewCount="514" Body="&lt;p&gt;I know for instance I can derive a cccX gate using 2 Toffoli gates on 5 qubit wire or ccccX with 3 Toffoli gates and 7 qubits and so on. you will notice the depth is increasing as the number of control qubits increase, that is for every additional c, there are 2 additional qubits. Is there a better way I can derive these multiple controlled x gate using fewer resources (gates and qubits)?&lt;/p&gt;&#xA;" OwnerUserId="8714" LastEditorUserId="26" LastEditDate="2019-10-08T21:31:17.480" LastActivityDate="2020-07-28T00:53:18.703" Title="Is there a way to develop a multiple controlled X or Z gate on Qiskit without using ancillary qubits?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8435" PostTypeId="1" CreationDate="2019-10-08T16:33:04.127" Score="3" ViewCount="69" Body="&lt;p&gt;Say, we have a &lt;span class=&quot;math-container&quot;&gt;$\require{mhchem}\ce{^87Rb}$&lt;/span&gt; atom having an electric dipole transition on the &lt;span class=&quot;math-container&quot;&gt;$D_{1}$&lt;/span&gt; line and we have two hyperfine ground states, one on &lt;span class=&quot;math-container&quot;&gt;$F = 1$&lt;/span&gt; and one on &lt;span class=&quot;math-container&quot;&gt;$F = 2$&lt;/span&gt; level. So, we take two pair of states &lt;span class=&quot;math-container&quot;&gt;$|F=2, m=-2\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |F=1, m = -1\rangle$&lt;/span&gt; as the ground state. The details on this can be found &lt;a href=&quot;https://arxiv.org/abs/1212.6063&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I need to find time evolution of the probability of being in the initial state  &lt;span class=&quot;math-container&quot;&gt;$$|\Psi(0)\rangle \equiv | 1, -1 \rangle \otimes | 0 \rangle_{\text{cav}}.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand how to define the initial state in QuTiP. I have gone through the paper 'QuTiP: An open-source Python framework for the dynamics of open quantum systems' by J.R. Johansson, P.D. Nation, Franco Nori. I have found few examples such as cavity in its ground state which  coupled to a qubit in a balanced superposition of its ground and excited state &lt;span class=&quot;math-container&quot;&gt;$$|\Psi(0)\rangle=\left(|0\rangle_{c}|0\rangle_{q}+|0\rangle_{c}|1\rangle_{q}\right) / \sqrt{2}$$&lt;/span&gt; and atom in excited state &lt;span class=&quot;math-container&quot;&gt;$$|\Psi(0)\rangle=\operatorname{tensor}(\text { fock }(\mathrm{N}, 0), \text { fock }(2,1)).$$&lt;/span&gt; But I am still not able to understand how to define the initial state &lt;span class=&quot;math-container&quot;&gt;$|\Psi(0)\rangle \equiv | 1, -1 \rangle \otimes | 0 \rangle_{\text{cav}} $&lt;/span&gt; in QuTiP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone please help me understand this?&lt;/p&gt;&#xA;" OwnerUserId="8716" LastEditorUserId="8716" LastEditDate="2019-10-09T09:52:46.410" LastActivityDate="2019-10-09T09:52:46.410" Title="How to define initial state $\rvert \Psi(0) \rangle \equiv \rvert 1, -1 \rangle \otimes \rvert 0 \rangle_{\text{cav}} $ of a system in QuTiP?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;qutip&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8436" PostTypeId="1" AcceptedAnswerId="8438" CreationDate="2019-10-08T21:52:08.217" Score="2" ViewCount="104" Body="&lt;p&gt;I am still confused when I am trying to use the &lt;a href=&quot;https://quantum-computing.ibm.com/composer&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q composer&lt;/a&gt; to reproduce some quantum circuits I found in different papers, and I am wondering if it is because there are &lt;strong&gt;two ways&lt;/strong&gt; to represent a multi-qubit state in a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The multi-qubit state &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle$&lt;/span&gt; can be represented in a quantum circuit by&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;putting the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; qubit (left)  on top, and the &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; one below, or by&lt;/li&gt;&#xA;&lt;li&gt;putting the &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; qubit (right) on top, and the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; one below.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is that correct?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The convention of putting on top of the circuit the qubit that is the furthest to the &lt;strong&gt;left&lt;/strong&gt; on the state, is called &lt;strong&gt;big-endian&lt;/strong&gt;, while&lt;/li&gt;&#xA;&lt;li&gt;The convention of putting on top of the circuit the qubit that is the furthest to the &lt;strong&gt;right&lt;/strong&gt; on the state, is called &lt;strong&gt;little-endian&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is that correct?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/composer&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q composer&lt;/a&gt; is putting the on top of the circuit the qubit that is the furthest to the &lt;strong&gt;right&lt;/strong&gt; on the state, meaning it is using the &lt;strong&gt;little-endian&lt;/strong&gt; representation of multi-qubit states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Is that correct?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="4121" LastEditorUserId="26" LastEditDate="2019-10-09T06:30:55.967" LastActivityDate="2019-10-09T06:30:55.967" Title="Is IBM Q composer using little-endian representation for multi-qubit states?" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8437" PostTypeId="2" ParentId="6839" CreationDate="2019-10-08T23:51:06.763" Score="0" Body="&lt;p&gt;Qiskit does have a density matrix class. See:&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/quantum_info/states/densitymatrix.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit-terra/qiskit/quantum_info/states/densitymatrix.py&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also see &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/test/python/quantum_info/states/test_densitymatrix.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for some usage examples like initializing from a pure state, adding, subtracting, etc.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="26" LastEditDate="2019-10-09T15:13:21.433" LastActivityDate="2019-10-09T15:13:21.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8438" PostTypeId="2" ParentId="8436" CreationDate="2019-10-09T06:28:22.377" Score="1" Body="&lt;p&gt;IBM Q Experience and Qiskit both use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Endianness#Little-endian&quot; rel=&quot;nofollow noreferrer&quot;&gt;little-endian&lt;/a&gt; format. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The multi-qubit state &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle$&lt;/span&gt; can be represented in a quantum&#xA;  circuit by&lt;/p&gt;&#xA;  &#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;putting the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; qubit (left)  on top, and the &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; one below, or by&lt;/li&gt;&#xA;  &lt;li&gt;putting the &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; qubit (right) on top, and the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; one below.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;Is that correct?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. The IBM Q Composer uses convention 1.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;The convention of putting on top of the circuit the qubit that is the furthest to the &lt;strong&gt;left&lt;/strong&gt; on the state, is called &lt;strong&gt;big-endian&lt;/strong&gt;,&#xA;  while&lt;/li&gt;&#xA;  &lt;li&gt;The convention of putting on top of the circuit the qubit that is the furthest to the &lt;strong&gt;right&lt;/strong&gt; on the state, is called&#xA;  &lt;strong&gt;little-endian&lt;/strong&gt;.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;Is that correct?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. The point being that the qubits are numbered starting from the top (i.e., &lt;code&gt;q[0]&lt;/code&gt;, &lt;code&gt;q[1]&lt;/code&gt;, &lt;code&gt;q[2]&lt;/code&gt;,...).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/composer&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q composer&lt;/a&gt; is putting the on top of the circuit the qubit&#xA;  that is the furthest to the &lt;strong&gt;right&lt;/strong&gt; on the state, meaning it is&#xA;  using the &lt;strong&gt;little-endian&lt;/strong&gt; representation of multi-qubit states.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;em&gt;Is that correct?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Correct.&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-10-09T06:28:22.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8439" PostTypeId="2" ParentId="8416" CreationDate="2019-10-09T11:36:00.963" Score="3" Body="&lt;p&gt;Upon some reflection, the answer is that no, they most definitely do not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to see this is to observe that there are &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt; orthogonal directions in the Bloch representation (&lt;em&gt;i.e.&lt;/em&gt; orthogonal Hermitian traceless operators) containing pure states. This means that that the pure states are not contained in any linear subspace of dimension less than &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt;, and thus in particular cannot be contained in any lower-dimensional hypersphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, given any orthogonal basis of Hermitian traceless operators &lt;span class=&quot;math-container&quot;&gt;$\{\boldsymbol\sigma_j\}_{j=1}^{d^2-1}$&lt;/span&gt;, and any versor &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathbf n}\in\mathbb R^{d^2-1}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\|\hat{\mathbf n}\|=1$&lt;/span&gt;, there are always pure states in the direction &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol\sigma_{\hat{\mathbf n}}\equiv\hat{\mathbf n}\cdot\boldsymbol\sigma$&lt;/span&gt; (this follows from the fact that the operator norm satisfies &lt;span class=&quot;math-container&quot;&gt;$\|\boldsymbol\sigma_{\hat{\mathbf n}}\|&amp;gt;0$&lt;/span&gt; and the characterisation in spherical coordinates explained e.g. &lt;a href=&quot;https://physics.stackexchange.com/a/425101/58382&quot;&gt;here&lt;/a&gt;).&#xA;It follows that there cannot be less than &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt; elements of &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^{d^2-1}$&lt;/span&gt; whose span contains the set of pure states.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;A concrete example: three-level systems&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;Consider a generic pure state of a three-level system:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\cos\alpha|0\rangle+e^{i\phi}\sin\alpha \cos\beta |1\rangle+e^{i\theta}\sin\alpha\sin\beta|2\rangle,$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta,\phi,\theta\in\mathbb R$&lt;/span&gt;.&#xA;Let us also use the standard operatorial basis for this space (the matrices used at the bottom of &lt;a href=&quot;https://physics.stackexchange.com/a/425101/58382&quot;&gt;this answer&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z^{(1)}=\sqrt{\frac{3}{2}}\begin{pmatrix}1 &amp;amp; 0&amp;amp;0 \\ 0 &amp;amp; -1&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix},&#xA;\quad&#xA;Z^{(2)}=\sqrt{\frac{3}{6}}\begin{pmatrix}1 &amp;amp; 0&amp;amp;0 \\ 0 &amp;amp; 1&amp;amp;0\\0&amp;amp;0&amp;amp;-2\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X^{(12)}=\sqrt{\frac{3}{2}}\begin{pmatrix}0 &amp;amp; 1&amp;amp;0 \\ 1 &amp;amp; 0&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix},&#xA;\quad&#xA;X^{(13)}=\sqrt{\frac{3}{2}}\begin{pmatrix}0 &amp;amp; 0&amp;amp;1 \\ 0 &amp;amp; 0&amp;amp;0\\1&amp;amp;0&amp;amp;0\end{pmatrix},&#xA;\quad&#xA;X^{(23)}=\sqrt{\frac{3}{2}}\begin{pmatrix}0 &amp;amp; 0&amp;amp;0 \\ 0 &amp;amp; 0&amp;amp;1\\0&amp;amp;1&amp;amp;0\end{pmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;Y^{(12)}=\sqrt{\frac{3}{2}}\begin{pmatrix}0 &amp;amp; -i&amp;amp;0 \\ i &amp;amp; 0&amp;amp;0\\0&amp;amp;0&amp;amp;0\end{pmatrix},&#xA;\quad&#xA;Y^{(13)}=\sqrt{\frac{3}{2}}\begin{pmatrix}0 &amp;amp; 0&amp;amp;-i \\ 0 &amp;amp; 0&amp;amp;0\\i&amp;amp;0&amp;amp;0\end{pmatrix},&#xA;\quad&#xA;Y^{(23)}=\sqrt{\frac{3}{2}}\begin{pmatrix}0 &amp;amp; 0&amp;amp;0 \\ 0 &amp;amp; 0&amp;amp;-i\\0&amp;amp;i&amp;amp;0\end{pmatrix}.&#xA;\end{align}&lt;/span&gt;&#xA;Then, the surface covered by the pure states in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^8$&lt;/span&gt; has the following parametrisation:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{cases}&#xA;\langle Z^{(1)}\rangle&amp;amp;=\sqrt{3/2} (\cos^2\alpha-\sin^2\alpha\cos^2\beta),\\&#xA;\langle Z^{(2)}\rangle&amp;amp;=\sqrt{3/6} [\cos^2\alpha+\sin^2\alpha(\cos^2\beta-2\sin^2\beta)],\\\hline&#xA;\langle X^{(12)}\rangle&amp;amp;=\sqrt{3/2}\sin(2\alpha)\cos\beta \cos\phi,\\&#xA;\langle X^{(13)}\rangle&amp;amp;=\sqrt{3/2}\sin(2\alpha)\sin\beta \cos\theta,\\&#xA;\langle X^{(23)}\rangle&amp;amp;=\sqrt{3/2}\sin^2(\alpha)\sin(2\beta) \cos(\phi-\theta),\\\hline&#xA;\langle Y^{(12)}\rangle&amp;amp;=\sqrt{3/2}\sin(2\alpha)\cos\beta \sin\phi,\\&#xA;\langle Y^{(13)}\rangle&amp;amp;=\sqrt{3/2}\sin(2\alpha)\sin\beta \sin\theta,\\&#xA;\langle Y^{(23)}\rangle&amp;amp;=\sqrt{3/2}\sin^2(\alpha)\sin(2\beta) \sin(\phi-\theta).\tag A&#xA;\end{cases}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To easily check that these points do indeed lie on a hypersphere (which we also know from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6047/55&quot;&gt;this answer&lt;/a&gt; must have a radius of &lt;span class=&quot;math-container&quot;&gt;$\sqrt2$&lt;/span&gt;), just run the following snippet in Mathematica:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$Assumptions = Element[{\[Alpha], \[Beta], \[Theta], \[Phi]}, Reals];&#xA;&#xA;expvalZ1[\[Alpha]_, \[Beta]_, \[Phi]_:0, \[Theta]_:0] = Sqrt[3/2]*(Cos[\[Alpha]]^2 - Sin[\[Alpha]]^2*Cos[\[Beta]]^2); &#xA;expvalZ2[\[Alpha]_, \[Beta]_, \[Phi]_:0, \[Theta]_:0] = Sqrt[3/6]*(Cos[\[Alpha]]^2 + Sin[\[Alpha]]^2*(Cos[\[Beta]]^2 - 2*Sin[\[Beta]]^2)); &#xA;expvalX12[\[Alpha]_, \[Beta]_, \[Phi]_, \[Theta]_:0] = Sqrt[3/2]*Sin[2*\[Alpha]]*Cos[\[Beta]]*Cos[\[Phi]]; &#xA;expvalX13[\[Alpha]_, \[Beta]_, \[Phi]_:0, \[Theta]_] = Sqrt[3/2]*Sin[2*\[Alpha]]*Sin[\[Beta]]*Cos[\[Theta]]; &#xA;expvalX23[\[Alpha]_, \[Beta]_, \[Phi]_, \[Theta]_] = Sqrt[3/2]*Sin[\[Alpha]]^2*Sin[2*\[Beta]]*Cos[\[Phi] - \[Theta]]; &#xA;expvalY12[\[Alpha]_, \[Beta]_, \[Phi]_, \[Theta]_:0] = Sqrt[3/2]*Sin[2*\[Alpha]]*Cos[\[Beta]]*Sin[\[Phi]]; &#xA;expvalY13[\[Alpha]_, \[Beta]_, \[Phi]_:0, \[Theta]_] = Sqrt[3/2]*Sin[2*\[Alpha]]*Sin[\[Beta]]*Sin[\[Theta]]; &#xA;expvalY23[\[Alpha]_, \[Beta]_, \[Phi]_, \[Theta]_] = Sqrt[3/2]*Sin[\[Alpha]]^2*Sin[2*\[Beta]]*Sin[\[Phi] - \[Theta]];&#xA;&#xA;Simplify[Total[(#1[\[Alpha], \[Beta], \[Phi], \[Theta]]^2 &amp;amp; ) /@ {expvalZ1, expvalZ2, expvalX12, expvalX13, expvalX23, expvalY12, expvalY13, expvalY23}]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, what sort of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-dimensional surface in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^8$&lt;/span&gt; is this?&#xA;I don't know a full answer to this, but if it was a hypersphere, then the sections would look like lower-dimensional hyperspheres (e.g. plotting only in two dimensions should result in a series of circles). This is most definitely not the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, for completeness, here is what some of the sections look like (I will again use Mathematica for the plotting):&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;&lt;span class=&quot;math-container&quot;&gt;$Z^{(1)}, Z^{(2)}$&lt;/span&gt; section&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;These coordinates only depend on the &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; parameters. It follows that the full space is contained in a sort of &quot;tubular region&quot; with the following triangular 2D section:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ParametricPlot[{expvalZ1[\[Alpha], \[Beta]], &#xA;  expvalZ2[\[Alpha], \[Beta]]}, {\[Alpha], 0, Pi}, {\[Beta], 0, Pi}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IOFBY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IOFBY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So again, most definitely &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; what a hypersphere would look like.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Two-dimensional &lt;span class=&quot;math-container&quot;&gt;$X^{(ij)}$&lt;/span&gt; sections&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The two-dimensional sections obtained using two of the three available &lt;span class=&quot;math-container&quot;&gt;$X^{(ij)}$&lt;/span&gt; coordinates look like ellipses when varying &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; for fixed &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi$&lt;/span&gt; (with the principal axes varying with &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi$&lt;/span&gt;). Interestingly, if we instead vary &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi$&lt;/span&gt; for fixed &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt;, the sections look instead like rectangles.&#xA;I won't include the plots, but you can use the following code to show these sections:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Manipulate[&#xA; ParametricPlot[{expvalX12[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalX13[\[Alpha], \[Beta], \[Theta], \[Phi]]}, {\[Alpha], 0, &#xA;   Pi}, {\[Beta], 0, Pi}, PerformanceGoal -&amp;gt; &quot;Quality&quot;, &#xA;  PlotRange -&amp;gt; {{-2, 2}, {-2, 2}}],&#xA; {{\[Theta], 0}, 0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}, {{\[Phi], 0}, &#xA;  0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}]&#xA;&#xA;Manipulate[&#xA; ParametricPlot[{expvalX12[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalX13[\[Alpha], \[Beta], \[Theta], \[Phi]]}, {\[Theta], 0, &#xA;   Pi}, {\[Phi], 0, Pi}, PerformanceGoal -&amp;gt; &quot;Quality&quot;, &#xA;  PlotRange -&amp;gt; {{-2, 2}, {-2, 2}}],&#xA; {{\[Alpha], 0}, 0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}, {{\[Beta], 0},&#xA;   0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Three-dimensional &lt;span class=&quot;math-container&quot;&gt;$X^{(ij)}$&lt;/span&gt; section&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;This is where it starts to look pretty cool.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we vary &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi$&lt;/span&gt; fixed, we get this nice 3D shape (sorry for the poor quality, SE doesn't allow more than 2MB for images):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Manipulate[&#xA; ParametricPlot3D[{expvalX12[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalX13[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalX23[\[Alpha], \[Beta], \[Theta], \[Phi]]}, {\[Alpha], 0, &#xA;   Pi}, {\[Beta], 0, Pi}, PerformanceGoal -&amp;gt; &quot;Quality&quot;, &#xA;  PlotRange -&amp;gt; Evaluate[{{-#, #}, {-#, #}, {-#, #}} &amp;amp;@Sqrt@2]],&#xA; {{\[Theta], 0}, 0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}, {{\[Phi], 0}, &#xA;  0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}, ControlPlacement -&amp;gt; Right]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/40NTg.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/40NTg.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing the values of &lt;span class=&quot;math-container&quot;&gt;$\phi,\theta$&lt;/span&gt; mostly just changes the scales of the surface, without modifying its structure.&#xA;Here is a better quality, still picture of this surface:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/efwwj.png&quot; width=&quot;400&quot; &gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$Y^{(ij)}$&lt;/span&gt; sections have pretty much the same structure, modulo changing the values of &lt;span class=&quot;math-container&quot;&gt;$\phi,\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yea, in conclusion, definitely not a hypersphere.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;PS:&#xA;For anyone that wants to see how the pure states move in the overall &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;-dimensional surface, you can use the following code to see the point corresponding to the given state in the &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; sections at the same time, changing the values of the &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta,\theta,\phi$&lt;/span&gt; parameters (the blue dot represents the state for the given values of the parameters):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pointOnXSection[\[Alpha]_, \[Beta]_, \[Theta]_, \[Phi]_] := \&#xA;{expvalX12[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalX13[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalX23[\[Alpha], \[Beta], \[Theta], \[Phi]]};&#xA;pointOnYSection[\[Alpha]_, \[Beta]_, \[Theta]_, \[Phi]_] := \&#xA;{expvalY12[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalY13[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalY23[\[Alpha], \[Beta], \[Theta], \[Phi]]};&#xA;pointOnZSection[\[Alpha]_, \[Beta]_, \[Theta]_, \[Phi]_] := \&#xA;{expvalZ1[\[Alpha], \[Beta], \[Theta], \[Phi]], &#xA;   expvalZ2[\[Alpha], \[Beta], \[Theta], \[Phi]]};&#xA;Manipulate[&#xA; GraphicsRow[{&#xA;   Show[&#xA;    ParametricPlot3D[&#xA;     pointOnXSection[\[Alpha], \[Beta], \[Theta], \[Phi]], {\[Alpha], &#xA;      0, Pi}, {\[Beta], 0, Pi}, PerformanceGoal -&amp;gt; &quot;Quality&quot;, &#xA;     PlotRange -&amp;gt; Evaluate[{{-#, #}, {-#, #}, {-#, #}} &amp;amp;@Sqrt@2], &#xA;     AxesLabel -&amp;gt; {1, 2, 3}, ImageSize -&amp;gt; 400, &#xA;     PlotStyle -&amp;gt; Directive[Opacity@0.7], RotationAction -&amp;gt; &quot;Clip&quot;],&#xA;    Graphics3D[{Blue, PointSize@0.03, &#xA;      Point@pointOnXSection[dot\[Alpha], &#xA;        dot\[Beta], \[Theta], \[Phi]]}]&#xA;    ],&#xA;   Show[&#xA;    ParametricPlot3D[&#xA;     pointOnYSection[\[Alpha], \[Beta], \[Theta], \[Phi]], {\[Alpha], &#xA;      0, Pi}, {\[Beta], 0, Pi}, PerformanceGoal -&amp;gt; &quot;Quality&quot;, &#xA;     PlotRange -&amp;gt; Evaluate[{{-#, #}, {-#, #}, {-#, #}} &amp;amp;@Sqrt@2], &#xA;     AxesLabel -&amp;gt; {1, 2, 3}, ImageSize -&amp;gt; 400, &#xA;     PlotStyle -&amp;gt; Directive[Opacity@0.7], RotationAction -&amp;gt; &quot;Clip&quot;],&#xA;    Graphics3D[{Blue, PointSize@0.03, &#xA;      Point@pointOnYSection[dot\[Alpha], &#xA;        dot\[Beta], \[Theta], \[Phi]]}]&#xA;    ],&#xA;   Show[&#xA;    ParametricPlot[&#xA;     pointOnZSection[\[Alpha], \[Beta], \[Theta], \[Phi]], {\[Alpha], &#xA;      0, Pi}, {\[Beta], 0, Pi}, PerformanceGoal -&amp;gt; &quot;Quality&quot;, &#xA;     PlotRange -&amp;gt; Evaluate[{{-#, #}, {-#, #}} &amp;amp;@Sqrt@2], &#xA;     AxesLabel -&amp;gt; {1, 2, 3}, ImageSize -&amp;gt; 300, &#xA;     PlotStyle -&amp;gt; Directive[Opacity@0.7]],&#xA;    Graphics[{Blue, PointSize@0.03, &#xA;      Point@pointOnZSection[dot\[Alpha], &#xA;        dot\[Beta], \[Theta], \[Phi]]}]&#xA;    ]&#xA;   }, ImageSize -&amp;gt; 800],&#xA; {{\[Theta], 0}, 0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;}, {{\[Phi], 0}, &#xA;  0, Pi, 0.01, Appearance -&amp;gt; &quot;Labeled&quot;},&#xA; {{dot\[Alpha], 0, &quot;\[Alpha]&quot;}, 0, Pi, 0.01, &#xA;  Appearance -&amp;gt; &quot;Labeled&quot;}, {{dot\[Beta], 0, &quot;\[Beta]&quot;}, 0, Pi, 0.01, &#xA;  Appearance -&amp;gt; &quot;Labeled&quot;},&#xA; ControlPlacement -&amp;gt; Right]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-01T17:58:49.740" LastActivityDate="2020-06-01T17:58:49.740" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8440" PostTypeId="1" CreationDate="2019-10-09T13:19:27.167" Score="4" ViewCount="43" Body="&lt;p&gt;What was the first paper/who was the first person to phrase anyon theory in terms of tensor categories?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going through Wilczek's book on fractional statistics, some of the reprinted papers anticipate such a formulation, but I am looking for the historically first paper(s) which seriously uses tensor category language.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it Kitaev?&lt;/p&gt;&#xA;" OwnerUserId="8727" LastEditorUserId="26" LastEditDate="2019-10-09T13:33:44.080" LastActivityDate="2019-10-09T13:33:44.080" Title="History of anyon theory, braidings and tensor categories" Tags="&lt;mathematics&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;&lt;history&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8441" PostTypeId="1" CreationDate="2019-10-09T16:42:06.150" Score="7" ViewCount="2227" Body="&lt;p&gt;I think there can't be a computer running software without having a clock signal.&lt;/p&gt;&#xA;&lt;p&gt;A fast classical computer has a clock rate between 4 to 5 GHz.&lt;/p&gt;&#xA;&lt;p&gt;If quantum computers are so much faster they must have a clock rate which is a multiple of this.&lt;/p&gt;&#xA;&lt;p&gt;Is this true?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;:&#xA;I started programming Q# and I think I now understand. (For those who want to know).&#xA;The quantum computer itself does not have a clock rate.&#xA;But because a quantum computer always has a classical computer connected to it, there is always the clock rate of the classical computer.&lt;/p&gt;&#xA;" OwnerUserId="8661" LastEditorUserId="8661" LastEditDate="2021-04-06T15:28:26.177" LastActivityDate="2021-04-06T15:28:26.177" Title="Does a quantum computer have a clock signal and if yes how big is it?" Tags="&lt;classical-computing&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8442" PostTypeId="2" ParentId="8441" CreationDate="2019-10-09T17:34:08.080" Score="4" Body="&lt;p&gt;There's no straightforward equivalent of the concept of &lt;a href=&quot;https://en.wikipedia.org/wiki/Clock_rate&quot; rel=&quot;nofollow noreferrer&quot;&gt;clock rate&lt;/a&gt; in quantum computing. Quantum computers are supposed to produce &lt;em&gt;algorithmic&lt;/em&gt; speedups only for very specific categories of problems. In simple words, quantum algorithms can be represented by quantum circuits which are basically a sequence of quantum gates. To give you an idea of how quantum gates are applied, I'll quote &lt;a href=&quot;https://cstheory.stackexchange.com/a/37196&quot;&gt;Peter Shor's answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Consider an ion trap. The ions represent qubits by using one electronic state as a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and another as a &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;. A quantum gate is performed by applying a &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; unitary matrix to two of these ions. This is done by shining a sequence of laser pulses on the ions. It's not a physical device into which two ions are input, in which they interact, and out of which the ions come with their states changed. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Such laser pulses are applied at certain intervals of time. You &lt;em&gt;might&lt;/em&gt; consider that rate to be a &lt;strong&gt;clock cycle rate&lt;/strong&gt; of some sort. However, you can't immediately map it to a classical notion of &quot;how many instructions are performed per clock cycle?&quot;, as &lt;em&gt;quantum instructions&lt;/em&gt; (i.e., the state evolution of qubits induced by a single layer of simple quantum gates) can't directly be compared to classical instructions (e.g., bit shifting). So, your statement: &quot;If quantum computers are so much faster they must have a clock rate which is a multiple of this.&quot; isn't quite right. In some sense, they might even have lower clock rates (say, 100 MHz) but perform a greater number of &lt;em&gt;effective&lt;/em&gt; (classical) instructions per clock cycle (i.e., per contemporary set of laser pulses). Note that this notion of clock cycle rate will be lower bounded by the decoherence times of the qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More importantly, even here, just like in classical computing, the clock cycle rate isn't the only factor determining the performance. Furthermore, it wouldn't make sense to compare the clock cycle rates of different architectures, say ion trap quantum computers with superconducting quantum computers. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-10-09T17:51:23.070" LastActivityDate="2019-10-09T17:51:23.070" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="8443" PostTypeId="2" ParentId="8441" CreationDate="2019-10-09T17:43:23.140" Score="6" Body="&lt;p&gt;Quantum computing does not promise computational speed-ups due to faster clock rates.&#xA;Rather, the speed-ups are &lt;em&gt;algorithmic&lt;/em&gt;. This means that, to achieve the same task (for suitable tasks that allow for this speed-up), &lt;em&gt;quantum computers would need a smaller number of operations&lt;/em&gt; to produce an answer.&#xA;These speed-ups exist even if each &quot;single operation&quot; takes the same time in a quantum computer as it does classically.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-10-09T18:33:51.377" LastActivityDate="2019-10-09T18:33:51.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8444" PostTypeId="1" AcceptedAnswerId="8478" CreationDate="2019-10-09T20:10:24.797" Score="4" ViewCount="297" Body="&lt;p&gt;I am new to quantum computing and I am having trouble understanding the notation used for input/output qubits in quantum gates. I will use the CNOT gate as an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In several (most) references I've seen, the CNOT operation is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT: &lt;span class=&quot;math-container&quot;&gt;$$|x⟩|y⟩ \to |x⟩|x \oplus y\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with the following circuit representation:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1hgpc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1hgpc.png&quot; alt=&quot;CNOT Gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This input/output qubit notation seems to work well when the CNOT is being used in classical reversible computation, or when &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; are strictly qubits in the standard basis that are not in superposition: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle \to |00\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|01\rangle \to |01\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|10\rangle \to |11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|11\rangle \to |10\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, as described by the definition/circuit: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first qubit remains unchanged: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle \to |x\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second qubit flips when the first qubit is equal to 1: &lt;span class=&quot;math-container&quot;&gt;$$|y⟩ \to |x\oplus y⟩.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if the input qubits &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; do not strictly align with the standard basis, the input/output notation seems rather strange to me (actually, extremely confusing to be honest). For instance, if &lt;span class=&quot;math-container&quot;&gt;$|x⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; are qubits aligned with the Hadamard basis as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle = |+\rangle = \frac{1}{\sqrt2} (|0\rangle + |1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|y\rangle = |-\rangle = \frac{1}{\sqrt 2} (|0\rangle - |1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the CNOT operation will result in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|+-\rangle \to |--\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; changed from &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, when the notation seems to say it should have stayed the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, if the output bits end up entangled, then my output result can't really be represented as &lt;span class=&quot;math-container&quot;&gt;$|x⟩|x \oplus y\rangle = |x\rangle \otimes |x \oplus y\rangle$&lt;/span&gt; because I can't describe that final state as two separate qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, my question(s) is (are):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Am I supposed to know that the input &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and output &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; do not have to be the same in value or even an independent value in the case when it's entangled? &lt;/li&gt;&#xA;&lt;li&gt;Is this notation is only valid for when &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; are orthonormal qubits in the standard basis?&lt;/li&gt;&#xA;&lt;li&gt;Is this just poor notation in general and I should try to avoid it? &lt;/li&gt;&#xA;&lt;li&gt;If so, why is it so common across quantum computing references, and is there a better way to express this?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8731" LastEditorUserId="2927" LastEditDate="2019-10-09T20:56:44.063" LastActivityDate="2019-10-14T21:18:28.023" Title="Input and output qubit notation in quantum gates" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8445" PostTypeId="2" ParentId="8444" CreationDate="2019-10-09T20:55:20.947" Score="2" Body="&lt;p&gt;Initially &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|x\oplus y\rangle$&lt;/span&gt; is a perfectly valid state.  The first qubit is in &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and the second qubit is in &lt;span class=&quot;math-container&quot;&gt;$|x\oplus y\rangle$&lt;/span&gt; - that is, the second qubit is entangled with the first qubit.  As you study other algorithms you might grok that we can have a state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|f(x)\rangle$&lt;/span&gt; for some function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; - the first register might be a number of qubits and the second register might also be a number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As to the nature of your question, by &quot;aligning the qubits in the Hadamard basis&quot; you are implicitly putting a Hadamard gate in front of both registers.  The gate-level notation would have to be adjusted to include the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate in front of each qubit, and then the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; gate between the first and second qubits.  Does that help in understanding?  The standard basis is also called the &quot;computational basis,&quot; perhaps for a reason.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Dirac bra-ket notation has some intuitive challenges but it &lt;em&gt;should&lt;/em&gt; be learned to be able to speak a common language with others.  Based on the effort you put into your question it seems like you do understand it.  The Dirac notation makes learning about inner- and outer-products that much easier.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="26" LastEditDate="2019-10-09T20:57:55.300" LastActivityDate="2019-10-09T20:57:55.300" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8446" PostTypeId="1" AcceptedAnswerId="8448" CreationDate="2019-10-09T21:23:39.860" Score="2" ViewCount="93" Body="&lt;p&gt;I cobbled together a few programs with Qiskit several months back which worked fine on both the BasicAer simulators and the actual IBMQ computers. However, when I tried to revisit them recently, executing on the actual quantum computers ran into issues because no computers would appear in IBMQ.backends(). After testing, it seems that while I can save an account (and I have successfully overwritten my old accounts with a new API key), loading accounts runs into an issue and throws the following error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;ConnectionError: Couldn't connect to IBMQ server: error during login: License required. You need to accept the License from Web Platform. &lt;a href=&quot;https://quantumexperience.ng.bluemix.net&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net&lt;/a&gt;&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, the link redirects me to the new website and I've accepted the most recent license agreement there. The closest &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/issues/122&quot; rel=&quot;nofollow noreferrer&quot;&gt;answer&lt;/a&gt; I've found seems to indicate that I need to manually input a new URL, but it doesn't actually provide what that URL is. Instead it suggests copying it from a button that I can't find at the linked page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm barking up the wrong tree with the solution to my error, I'd love if someone could set me straight. If I'm on the right track, where in the world do I find the new URL?&lt;/p&gt;&#xA;" OwnerUserId="8734" LastActivityDate="2019-10-09T22:58:08.060" Title="When I load a saved account, I get a license-agreement error (links to old website)" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8447" PostTypeId="1" CreationDate="2019-10-09T22:15:27.507" Score="4" ViewCount="488" Body="&lt;p&gt;We know that the Pauli matrices are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_x = \begin{bmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}, \sigma_y = \begin{bmatrix}0 &amp;amp; -i \\ i &amp;amp; 0\end{bmatrix}, \sigma_z = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering what would these matrices would represent in the physical world. I know that they can measure quantum state and get certain results. Would I be wrong if I assume that &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; measures the Diagonal polarization of a photon or &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; represents the measurement of vertical/horizontal polarization of a photon?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2019-10-12T17:19:48.643" Title="Physical Interpretation of Pauli Matrices as Polarization Check" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;measurement&gt;&lt;pauli-gates&gt;&lt;photonics&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8448" PostTypeId="2" ParentId="8446" CreationDate="2019-10-09T22:58:08.060" Score="1" Body="&lt;p&gt;If you have defintely accepted the license agreement then the case is usually the credentials haven't updated locally. Try generating a new API token on the website and then run :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.delete_account()&#xA;IBMQ.save_account(APITOKEN, overwrite=True)&#xA;IBMQ.load_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This should clear up anything that could possibly still be around linked to your old credentials and replace it with credentials to point to the new API.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-10-09T22:58:08.060" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8449" PostTypeId="2" ParentId="8447" CreationDate="2019-10-09T23:57:03.383" Score="1" Body="&lt;p&gt;I see the heart of your question. I'd like to clarify a bit, before answering your question though. Matrices (aka operators) do not measure quantum states--they operate on them. Specifically, they project the state into the matrix's eigenvectors. We can then measure that projected state in a particular basis that may be the same or different than what the quantum state was projected into. But, those are technical details...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A photon does not quite capture the whole picture. Let's see why not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you were to use photon polarization to ''visualize'' the Pauli matrices, &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; would represent the up and down possibilities and basis while &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; would be right and left. It gets a little tricky with &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt; because we need a third dimension for polarization. As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/55/gls&quot;&gt;gIS&lt;/a&gt; pointed out, &lt;a href=&quot;https://en.wikipedia.org/wiki/Circular_polarization&quot; rel=&quot;nofollow noreferrer&quot;&gt;circular polarization&lt;/a&gt; can be paired with &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt;. Specifically, the right- and left-handed circular polarizations would be paired with &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very standard way to ''visualize'' the Pauli matrices is with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;. It's a unit sphere with a vector pointing from the center to a point on the sphere. The z-axis of the sphere is paired with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;; the x-axis is paired with &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;; and, the y-axis is paired with &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt;. This &lt;a href=&quot;https://www.youtube.com/watch?v=dZ5oWfdTJ4g&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt; from IBM can explain it better it a bit further and gives some nice images of the Bloch sphere.&lt;/p&gt;&#xA;" OwnerUserId="8420" LastEditorUserId="8420" LastEditDate="2019-10-10T13:33:55.460" LastActivityDate="2019-10-10T13:33:55.460" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8450" PostTypeId="2" ParentId="6325" CreationDate="2019-10-10T03:39:29.843" Score="1" Body="&lt;p&gt;Grover's algorithm is a (quantum-)circuit-SAT solver. I suppose it could also be a literal black box solver, but it would only work with black boxes that don't decohere your entangled input state, and I'm having trouble believing that such things exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know why Grover or anyone else ever called it a database search algorithm. You can of course give it a circuit that implements a set membership test, with some of the inputs hardwired to the key you're looking up and the rest representing the output value, and call it a database search. But you could do the same thing with a classical SAT solver and no one calls them database search algorithms to my knowledge. And for Grover (or classical SAT solvers) to be competitive on this type of problem, the &quot;database&quot; has to be fundamentally unindexable, which means it's too large to be indexable, which means it isn't actually stored anywhere, which makes it in my opinion not a database (and not data).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finding an efficient circuit implementing a given function is an important and interesting problem, but it's also incredibly broad; it includes much of what's called computer science. I don't see what can be said about it in the context of Grover's algorithm that wouldn't apply equally in any other context. Grover's algorithm just takes an optimized circuit once you've found it and evaluates it about √N times. The circuit does need to be reversible, making it somewhat different from the usual classical circuits, but that's still not directly related to Grover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary, I think that people don't talk about finding the oracle circuit because it's not actually related to the quantum algorithm (despite Grover's paper's title) and because it's such a complex and far-reaching topic that no treatment could do it justice anyway.&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2019-10-10T03:39:29.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8451" PostTypeId="2" ParentId="6325" CreationDate="2019-10-10T07:03:48.173" Score="3" Body="&lt;p&gt;Grover's algorithm does not have an advantage when searching an unordered database, because encoding the oracle into a circuit requires &lt;span class=&quot;math-container&quot;&gt;$\tilde \Omega(n)$&lt;/span&gt; operations. You can prove this with a simple circuit counting argument. If the circuit had size  &lt;span class=&quot;math-container&quot;&gt;$O(n^{0.99})$&lt;/span&gt; then there would be fewer distinct circuits than distinct oracles. So the actual operational complexity is &lt;span class=&quot;math-container&quot;&gt;$\tilde \Omega(n^{1.5})$&lt;/span&gt;, even though the query complexity is &lt;span class=&quot;math-container&quot;&gt;$O(n^{0.5})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grover's algorithm only has an advantage when the thing you are searching over is abstract, like possible solutions to a SAT problem, as opposed to literally stored in hardware somewhere, like a database.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-10-10T07:03:48.173" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8452" PostTypeId="1" CreationDate="2019-10-10T08:08:10.083" Score="3" ViewCount="97" Body="&lt;p&gt;In almost all research on (universal) quantum computation the common models assumed from the outset are either the quantum circuit model with unitary gates, the measurement-based one-way model or the adiabatic model - all of which are (polynomially) equivalent in computational power and employ the idealization of pure states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as an alternative, one can consider quantum computation models based on mixed states and general superoperators (quantum operations/channels given by CPTP maps, not necessarily unitary) as gates. This possibility had for example been studied by Tarasov around 2000. Of course any mixed state can be purified in a larger state space (additional qubits) and any CPTP map obtained via a unitary acting on the larger space by tracing out these ancilla qubits, but the generalized view might have its own merits for scalable quantum information processing due to the present obstacles with decoherence/noise for the standard (unitary) approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theoretical considerations based on “open quantum computation” might lead to new quantum algorithms or insights into other physical implementations. Why is most of science and industry focused on the strict model with unitary gates and delicate pure states - while the obvious alternative seems to be entirely neglected? Does the problem with the second approach merely boil down to insufficient control over non-unitary gates or am I missing something more fundamental?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/507391/58382&quot;&gt;&lt;strong&gt;&lt;em&gt;Cross-posted on physics.SE&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7802" LastEditorUserId="55" LastEditDate="2019-10-12T18:52:48.080" LastActivityDate="2019-10-13T05:47:22.620" Title="Why do quantum computation models based on open quantum systems receive so little attention?" Tags="&lt;architecture&gt;&lt;models&gt;&lt;open-quantum-systems&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8454" PostTypeId="1" CreationDate="2019-10-10T12:22:20.550" Score="4" ViewCount="280" Body="&lt;p&gt;I would like to prepare an initial state for variational quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The initial state should include the following states: &lt;span class=&quot;math-container&quot;&gt;$|000\rangle, |010\rangle, |100\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I prepare this initial state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;FYI, I referred to &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.210501&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&#xA;In this paper, the circuit creates &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, the Hamiltonian I want to solve is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = - \frac{1}{2} \varepsilon \sum_{i=1}^{N} Z_i + \frac{1}{4} V \sum_{i,j=1}^N(X_iXj - Y_iY_j) \;,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is the coefficients and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of quits.&lt;/p&gt;&#xA;" OwnerUserId="8673" LastEditorUserId="26" LastEditDate="2019-10-10T13:37:44.290" LastActivityDate="2019-10-10T18:09:56.390" Title="How to prepare an initial state for variational quantum algorithms?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8455" PostTypeId="2" ParentId="8390" CreationDate="2019-10-10T16:43:16.420" Score="2" Body="&lt;p&gt;In principle, yes, you can always do it. The Bloch representation can be generalised to arbitrary dimensions, and you can always parametrise states in it by their &quot;angle coordinates&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you can write an arbitrary 3-modes pure state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\cos\alpha|0\rangle + e^{i\theta}\sin\alpha\cos\beta|1\rangle+e^{i\phi}\sin\alpha\sin\beta|2\rangle,$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta,\theta,\phi\in\mathbb R$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be noted, however, that things get much with spaces of dimension larger than &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. For example, it's harder to interpret arbitrary unitary gates as &lt;em&gt;rotations&lt;/em&gt; in this larger space. By this, I mean that even if it is always true that for any given unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; there is some (and in general an infinity of) Hermitians &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}=U$&lt;/span&gt; at some time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, whether these should be considered &quot;rotations&quot; is arguable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the one hand, if you represent &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as a point in the Bloch representation (you can always do this because the Bloch representation associates a point to any Hermitian matrix, even though this point will in general fall outside of the region representing the set of physical states), then you can think of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as the &quot;axis&quot; of the rotation, as the direction associated with this point will be fixed by the rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, in general &lt;span class=&quot;math-container&quot;&gt;$t\mapsto e^{-iHt}$&lt;/span&gt; is not a rotation, in the sense that it doesn't &quot;loop back&quot; as rotations do in the Bloch sphere. By this I mean that in general there is no &lt;span class=&quot;math-container&quot;&gt;$t&amp;gt;0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}=I$&lt;/span&gt;, which is what you would expect from a rotation. An easy example of this is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H\equiv \begin{pmatrix}\alpha&amp;amp;0&amp;amp;0\\0&amp;amp;\beta&amp;amp;0\\0&amp;amp;0&amp;amp;\gamma\end{pmatrix},\quad\alpha,\beta,\gamma\in\mathbb R.$$&lt;/span&gt;&#xA;Then, &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}=\mathrm{diag}(e^{-i\alpha t},e^{-i\beta t},e^{-i\gamma t})$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$e^{-iH t}=I$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$e^{-i\alpha t}=e^{-i\beta t}=e^{-i\gamma t}=1$&lt;/span&gt;, which aren't simultaneously satisfiable for incommensurable &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta,\gamma$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-10T16:43:16.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8456" PostTypeId="2" ParentId="8454" CreationDate="2019-10-10T18:09:56.390" Score="3" Body="&lt;p&gt;To prepare this state specifically, start with &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and apply H to the 0th and 1st qubits, yielding &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{4} (|000\rangle + |010\rangle + |100\rangle + |110\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, we can apply the Toffoli gate to the 0th and 1st qubit with the 2nd qubit as the target, yielding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{4} (|000\rangle + |010\rangle + |100\rangle + |111\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, apply a CNOT with 2nd qubit as control and 0th and 1st qubits as targets, yielding:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{4} (|000\rangle + |010\rangle + |100\rangle + |001\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As desired.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;More talk on state prep&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because your Hamiltonian is relatively simple, both Trotterization and Variational Quantum Eigensolvers (VQEs) could work. I'll refer to the &lt;a href=&quot;https://arxiv.org/pdf/1304.3061.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE&lt;/a&gt;, because it talks more about quantum state prep, specifically:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a quantum state is characterized by an exponentially&#xA;  large number of parameters, it cannot be prepared with&#xA;  a polynomial number of operations. The set of efficiently&#xA;  preparable states are therefore characterized by polynomially many parameters, and we choose a particular set&#xA;  of ansatz states of this type. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically, especially for quantum chem algorithms with complex ansatzes, we need efficient state preparation algorithms that are parametrized with a polynomial number of parameters. This is still an active area of research and especially important for Trotterization/VQEs/Qubitization, etc.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-10-10T18:09:56.390" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8457" PostTypeId="2" ParentId="8441" CreationDate="2019-10-10T20:59:41.623" Score="1" Body="&lt;p&gt;Quantum computers can be seen as &quot;quantum accelerators&quot; attached to a classical computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The application of quantum gates is a problem of sending signals to the quantum device/accelerator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classical aspect of signal sending is clocked by the classical computer. The speed of the quantum machine is determined:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;relatively: to the worst case complexity of executing the algorithm on the classical machine instead of the quantum one (imagine using a CPU instead of the quantum accelerator)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;exactly: time needed to run the algorithm on the quantum accelerator&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The latter depends on the &quot;gate times&quot; of the accelerator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, a quantum computer is clocked in multiple ways:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;by the clock of the classical one controlling the quantum accelerator&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;by the unit of time needed to apply the quantum gate on the accelerator&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;However, the clock speed does not play a significant role to why quantum machines seem for particular algorithms more powerful.&lt;/p&gt;&#xA;" OwnerUserId="8592" LastActivityDate="2019-10-10T20:59:41.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8458" PostTypeId="1" AcceptedAnswerId="9601" CreationDate="2019-10-10T21:05:24.443" Score="3" ViewCount="176" Body="&lt;p&gt;IBM announced a 53 qubit chip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will the advertised chip be available for non-paying users, or only to IBM clients?&lt;/p&gt;&#xA;" OwnerUserId="8592" LastActivityDate="2020-01-20T17:13:35.127" Title="IBM 53 qubit cloud access" Tags="&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8459" PostTypeId="2" ParentId="8458" CreationDate="2019-10-11T01:27:04.410" Score="1" Body="&lt;p&gt;I'm not sure if official information has been released yet, though it will likely have a mix of research and industry applications, considering IBM's previous policies (&lt;a href=&quot;https://www.ibm.com/quantum-computing/network/researchers&quot; rel=&quot;nofollow noreferrer&quot;&gt;research&lt;/a&gt;, &lt;a href=&quot;https://www.ibm.com/quantum-computing/network/overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;industry&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-10-11T01:27:04.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8460" PostTypeId="1" CreationDate="2019-10-11T04:14:33.463" Score="1" ViewCount="91" Body="&lt;p&gt;I used the following code. Can anyone say what that error is about?&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.circuits.gates import mct&#xA;q = QuantumRegister(32)&#xA;c = ClassicalRegister(11)&#xA;qc = QuantumCircuit(q,c)&#xA;ite = 5 #number of iteration&#xA;&#xA;#initialization&#xA;qc.h(q[0:11])&#xA;qc.x(q[22])&#xA;qc.h(q[22])&#xA;qc.barrier()&#xA;&#xA;for i in range(ite):&#xA;#oracle part&#xA;    ccheck(0,1,11)&#xA;    ccheck(0,2,12)&#xA;    ccheck(0,3,13)&#xA;    ccheck(0,4,14)&#xA;    ccheck(0,5,15)&#xA;    ccheck(0,6,16)&#xA;    ccheck(0,7,17)&#xA;    ccheck(0,8,18)&#xA;    ccheck(0,9,19)&#xA;    ccheck(0,10,20)&#xA;    qc.mct([q[11],q[12],q[13], q[14],q[15],q[16], q[17],q[18],q[19], q[20]], q[29] , [q[21], q[22], q[23], q[24], q[25], q[26], q[27], q[28]], mode='basic') &#xA;    iccheck(0,10,20)&#xA;    iccheck(0,9,19)&#xA;    iccheck(0,8,18)&#xA;    iccheck(0,7,17)&#xA;    iccheck(0,6,16)&#xA;    iccheck(0,5,15)&#xA;    iccheck(0,4,14)&#xA;    iccheck(0,3,13)&#xA;    iccheck(0,2,12)&#xA;    iccheck(0,1,11)&#xA;    qc.barrier()&#xA;#diffusion part&#xA;    qc.h(q[0:11])&#xA;    qc.barrier()&#xA;    qc.x(q[0:11])&#xA;    qc.barrier()&#xA;    qc.h(q[10])&#xA;    qc.mct([q[0],q[1],q[2], q[3],q[4],q[5], q[6],q[7],q[8], q[9]], q[10] , [q[21], q[22], q[23], q[24], q[25], q[26], q[27], q[28]], mode='basic')&#xA;    qc.h(q[10])&#xA;    qc.barrier()&#xA;    qc.x(q[0:11])&#xA;    qc.barrier()&#xA;    qc.h(q[0:11])&#xA;    qc.barrier()&#xA;&#xA;qc.measure(q[0:11], c[0:11])&#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;job = execute(qc, backend, shots=10000)&#xA;result = job.result()&#xA;count =result.get_counts()&#xA;print(count)&#xA;qc.draw(output='mpl')&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="26" LastEditDate="2019-10-11T04:58:20.870" LastActivityDate="2019-10-11T04:58:20.870" Title="'ERROR: QasmSimulator: Circuit cannot be run using available methods.'" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="8462" PostTypeId="1" AcceptedAnswerId="8465" CreationDate="2019-10-11T19:40:04.943" Score="5" ViewCount="529" Body="&lt;p&gt;The Multiple-Control Toffoli (mct) gate takes as input: &#xA; 1. a register containing the control qubits, &#xA; 2. the target qubits and &#xA; 3. a register containing ancilla qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how many ancilla qubits I need to pass in for a number of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; controll qubits.&#xA;I've seen examples and used mct gates with 4 control qubits and 2 ancillas so I know the number of ancillas is not &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; like suggested &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate&quot;&gt;in this answer&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a strict dependency meaning for 10 control qubits you need 5 ancillas or does the implementation adapt to the number or ancillas that are passed in?&lt;/p&gt;&#xA;" OwnerUserId="7759" LastActivityDate="2019-10-12T14:33:41.413" Title="How many ancilla qubits to use with Multiple-Control Toffoli (mct) gate in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8463" PostTypeId="1" AcceptedAnswerId="8637" CreationDate="2019-10-11T20:59:39.747" Score="7" ViewCount="209" Body="&lt;p&gt;In the answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4005/what-exactly-is-random-circuit-sampling/4006#4006&quot;&gt;this question&lt;/a&gt; about random circuits, James Wootton states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One way to see how well we [fully explore the Hilbert space] is to focus on just randomly producing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit states. These should be picked &lt;strong&gt;uniformly from all possible states&lt;/strong&gt;, and not be biased towards the tiny set of states that it is easy for us to produce or write down. This can be done by running a random circuits of sufficient circuit depth. The number of gates for this thought to be efficient (i.e. polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;), though I'm not sure if this is proven or is just a widely held conjecture. (Emphasis added).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The Google Sycamore team ran a cycle of &lt;span class=&quot;math-container&quot;&gt;$m=20$&lt;/span&gt; repetitions of random single- and 2-qubit gates on &lt;span class=&quot;math-container&quot;&gt;$n=53$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can there be a claim that Sycamore was able to prepare a state &lt;em&gt;drawn uniformly at random&lt;/em&gt; from the Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^{53}$&lt;/span&gt;?&lt;/strong&gt;  That is, with the gate sets of Sycamore, are we getting far enough away from the &lt;span class=&quot;math-container&quot;&gt;$|000\cdots 0\rangle$&lt;/span&gt; initial state to be uniformly random?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Certainly a simple counting argument is sufficient to show that there are &lt;em&gt;many&lt;/em&gt; states in the Hilbert space that would never be achieved, or are even &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-close to being acheived, by only &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; repetitions of the Sycamore gate-set; however, can we say that the states that &lt;em&gt;could be&lt;/em&gt; achieved by &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; such repetitions are uniformly distributed within the Hilbert space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect the answer is most assuredly &quot;yes&quot;, the Sycamore repetition is sufficient to uniformly explore the entirety of the Hilbert space, much as only &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; dovetail shuffles are sufficient to randomly shuffle a deck of cards.  However, in the setting of a Hilbert space, can this conjecture be placed on any theoretical footing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I think this question is independent of the claim of &lt;em&gt;supremacy&lt;/em&gt;.  Even if the circuit wasn't deep enough to fully and uniformly explore all corners of the Hilbert space, it may be difficult/impossible for a classical computer to compute any such state produced by Sycamore.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-10-12T14:19:43.917" LastActivityDate="2019-10-31T23:59:38.017" Title="Are 20 repetitions of Sycamore's one- and 2-qubit gates sufficient to produce a uniformly random state?" Tags="&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8464" PostTypeId="2" ParentId="8447" CreationDate="2019-10-12T11:23:09.497" Score="2" Body="&lt;p&gt;Your understanding is correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the theory of photon polarization, the parametrization of the Bloch sphere (or its surfave) has  traditionally another name. On the wikipedia page for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Jones_calculus&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jones calculus&lt;/a&gt; (the parametrization of the Bloch sphere surface), you'll find a table for the correspondence between kets and polarizations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize, eigenstates of the Pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma_Z$&lt;/span&gt; can be seen as the horizonal and vertical polariations (commonly written as &lt;span class=&quot;math-container&quot;&gt;$|H\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|V\rangle$&lt;/span&gt;), &#xA;eigenstates of &lt;span class=&quot;math-container&quot;&gt;$\sigma_X$&lt;/span&gt; correspond to diagonal and anti-diagonal polarizations, and eigenstates of &lt;span class=&quot;math-container&quot;&gt;$\sigma_Y$&lt;/span&gt; correspond to the left and right-handed polarizations of light.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus a measurement corresponding to &lt;span class=&quot;math-container&quot;&gt;$\sigma_X$&lt;/span&gt; can be seen as putting a beamsplitter in front of the light path, that splits the light into the horizontal and vertical polarization components. (You can also put a polarization &lt;em&gt;filter&lt;/em&gt;, but as such filter measurements are destructive, the post-measurement will be different. And because of that, destructive measurements technically don't quite correspond to the Pauli's. Do it with beamsplitters instead of filters, and the analogy is fine again.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, you can always choose a different basis (by a unitary transformation). Just make sure that choice made gives the correct commutation relations between the Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: A similar concept to the Jones vector, but which also covers the interior of the Bloch Ball, are the so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/Stokes_parameters#Relationship_to_Hermitian_operators_and_quantum_mixed_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stokes parameters&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2192" LastEditorUserId="2192" LastEditDate="2019-10-12T17:19:48.643" LastActivityDate="2019-10-12T17:19:48.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8465" PostTypeId="2" ParentId="8462" CreationDate="2019-10-12T14:33:41.413" Score="3" Body="&lt;p&gt;I found out the number of ancillas is minimum &lt;span class=&quot;math-container&quot;&gt;$n-2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this line in the Qiskit source code of mct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if len(ancillary_qubits) &amp;lt; len(control_qubits) - 2:&#xA;    raise AquaError('Insufficient number of ancillary qubits.')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7759" LastActivityDate="2019-10-12T14:33:41.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8466" PostTypeId="2" ParentId="2603" CreationDate="2019-10-12T22:53:23.043" Score="3" Body="&lt;p&gt;Thinking about the theoretical capabilities of quantum computers has led to important insights on the theory of classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One example is the proof that the (classical) complexity class &lt;strong&gt;PP&lt;/strong&gt; is closed under intersection. While there was already a purely classical proof due to Beigel, Reingold, and Spielman, there exists a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0412187&quot; rel=&quot;nofollow noreferrer&quot;&gt;simpler proof&lt;/a&gt; that uses concepts from quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more impressive example is the classical recommendation algorithms (&lt;a href=&quot;https://arxiv.org/abs/1807.04271&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1811.00414&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1811.04909&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;) discovered by Ewin Tang and collaborators, which were inspired by the quantum Kerendis-Prakash algorithm. These algorithms were genuinely new, and might not have been discovered without the inspiration of the quantum algorithm.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2019-10-12T22:53:23.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8467" PostTypeId="2" ParentId="8452" CreationDate="2019-10-12T23:02:27.113" Score="1" Body="&lt;p&gt;I know this isn't really what you're thinking of with your question, but &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurement-based quantum computing&lt;/a&gt; is pretty well studied. Under the many-worlds interpretation, the system counts as open for that protocol, because every time you perform a measurement you're becoming entangled with the system.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2019-10-13T05:47:22.620" LastActivityDate="2019-10-13T05:47:22.620" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8468" PostTypeId="1" AcceptedAnswerId="8471" CreationDate="2019-10-13T01:15:06.540" Score="8" ViewCount="450" Body="&lt;p&gt;Say we had a Hadamard-like gate with the -1 in the first entry instead of the last.  Let's call it &lt;span class=&quot;math-container&quot;&gt;$H^1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = \begin{bmatrix}1&amp;amp;1\\1&amp;amp;-1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^1 = \begin{bmatrix}-1&amp;amp;1\\1&amp;amp;1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my maths it's a unitary matrix, so it's a valid quantum gate that does the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^1|0\rangle = \left(\frac{-|0\rangle+|1\rangle}{\sqrt{2}}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^1|1\rangle = \left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are similar to the true Hadamard gate, but with the sign flipped on the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; instead of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was the choice of the Hadamard as we know it an arbitrary decision like the right hand rule?  Or is there a mathematical or historical reason for it?&lt;/p&gt;&#xA;" OwnerUserId="8520" LastEditorUserId="26" LastEditDate="2019-10-14T04:20:24.967" LastActivityDate="2019-10-14T04:20:24.967" Title="Could the Hadamard gate have been constructed differently with similar characteristics?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;history&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8469" PostTypeId="1" AcceptedAnswerId="8470" CreationDate="2019-10-13T02:41:04.137" Score="3" ViewCount="209" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\def\braket#1#2{\langle#1|#2\rangle}\def\bra#1{\langle#1|}\def\ket#1{|#1\rangle}$&lt;/span&gt;&#xA;When using Grover's algorithm to invert a function &lt;span class=&quot;math-container&quot;&gt;$f\colon \{0,1\}^m \rightarrow \{0,1\}$&lt;/span&gt;, an ancilla bit is used in order to &quot;flip the sign&quot; of basis vectors &lt;span class=&quot;math-container&quot;&gt;$\ket{i_0}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(i_0) = 1$&lt;/span&gt;. In many expositions that I've seen, the ancilla bit is omitted afterwards because we don't touch it again. I'm wondering why we are able to do this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9605034.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[BBHT96]&lt;/a&gt;, they say that the action of a single Grover iteration (assuming a single satisfying assignment) is to map&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$k\ket{i_0}+l\sum_{i \neq i_0} \ket{i}$$&lt;/span&gt;&#xA;to &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left(\frac{N-2}{N}k+\frac{2(N-1)}{2}l\right)\ket{i_0} + \left(\frac{N-2}{N}l-\frac{2}{N}k\right)\sum_{i \neq i_0} \ket{i} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I'm wondering why it isn't actually a map to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left(\frac{N-2}{N}k\ket{1}+\frac{2(N-1)}{2}l\ket{0}\right)\ket{i_0} + \left(\frac{N-2}{N}l\ket{0}-\frac{2}{N}k\ket{1}\right)\sum_{i \neq i_0} \ket{i}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which I think is what we get if we keep track of the ancilla qubit rather than forgetting about it. Note that these are both normalized states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason that I think this ought to matter is that if we measure the state after a Grover iteration, the probability of observing &lt;span class=&quot;math-container&quot;&gt;$\ket{i_0}$&lt;/span&gt; would, if I understand partial measurements correctly, be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left(\frac{N-2}{N}k\right)^2 + \left(\frac{2(N-1)}{2}l\right)^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;rather than what they have, which is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left(\frac{N-2}{N}k+\frac{2(N-1)}{2}l\right)^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume  something I've written above is wrong, but I'm not sure what. Why are we able to forget about this bit in general? Why do we even expect this to yield a normalized state - I know it does here, but why ought it?&lt;/p&gt;&#xA;" OwnerUserId="8758" LastEditorUserId="55" LastEditDate="2021-01-03T11:09:04.867" LastActivityDate="2021-01-03T11:09:04.867" Title="Why can we forget about the ancilla bit in Grover's algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8470" PostTypeId="2" ParentId="8469" CreationDate="2019-10-13T02:53:13.593" Score="5" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\def\braket#1#2{\langle#1|#2\rangle}\def\bra#1{\langle#1|}\def\ket#1{|#1\rangle}$&lt;/span&gt; &#xA;I was being silly :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sign change that happens is in some sense either associated with the &lt;span class=&quot;math-container&quot;&gt;$\ket{a}$&lt;/span&gt; or with the ancilla qubit. By taking the ancilla qubit to be (say) &lt;span class=&quot;math-container&quot;&gt;$\left(\frac{\ket{0}-\ket{1}}{\sqrt{2}}\right)$&lt;/span&gt;, upon XORing with &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; we get a sign change that we can stick onto the state qubits and leave the oracle qubits untouched. More formally,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\ket{a}\left(\frac{\ket{0}-\ket{1}}{\sqrt{2}}\right) \mapsto \ket{a}\left(\frac{\ket{1}-\ket{0}}{\sqrt{2}}\right) = (-\ket{a})\left(\frac{\ket{0}-\ket{1}}{\sqrt{2}}\right).$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can forget about the ancilla qubit because it literally doesn't change and is the same everywhere. &lt;/p&gt;&#xA;" OwnerUserId="8758" LastEditorUserId="55" LastEditDate="2019-10-13T11:38:50.663" LastActivityDate="2019-10-13T11:38:50.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8471" PostTypeId="2" ParentId="8468" CreationDate="2019-10-13T05:03:15.090" Score="6" Body="&lt;p&gt;The Hadamard gate has close ties to the discrete Fourier transform.  Consider the DFT for an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-level system:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert j \rangle = \frac{1}{\sqrt{N}} \sum\limits_{k=0}^{N-1} e^{\frac{i2 \pi  j k}{N}} \vert k \rangle.$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; this is simply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert j \rangle = \frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix} \, \vert k \rangle = H \vert k \rangle.$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; applied to &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; qubits in parallel, this generalizes naturally to a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional DFT, &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes d}$&lt;/span&gt;.  In this sense, the sign convention of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; clearly aligns with its function as a unitary DFT matrix.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The choice of sign for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; also aligns, less directly, to the conventional &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis of the Lie algebra &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{su}_2$&lt;/span&gt;.  For example, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; plays a part in the spectral decomposition of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X = H Z H,$$&lt;/span&gt;&#xA;noting that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is both unitary and Hermitian.  That &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; contains both the eigenvectors and dual-eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, with eigenvalues in &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; can be a useful property.  &lt;span class=&quot;math-container&quot;&gt;$H^1$&lt;/span&gt;, as defined in the question, would swap the position of the eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-13T07:46:47.250" LastActivityDate="2019-10-13T07:46:47.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8472" PostTypeId="2" ParentId="8468" CreationDate="2019-10-13T11:35:22.123" Score="3" Body="&lt;p&gt;You can easily check that &lt;span class=&quot;math-container&quot;&gt;$H^1=XHX$&lt;/span&gt;, which is another way to say that &lt;span class=&quot;math-container&quot;&gt;$H^1$&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; modulo swapping &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that it &lt;em&gt;is&lt;/em&gt; a different gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, it is &quot;equivalent&quot; in the sense that, given an arbitrary circuit given as a sequence of gates &lt;span class=&quot;math-container&quot;&gt;$\prod_k U_k$&lt;/span&gt;, if you swap all the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s, all the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates will become &lt;span class=&quot;math-container&quot;&gt;$H^1$&lt;/span&gt; gates (and vice versa).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-13T11:35:22.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8473" PostTypeId="1" AcceptedAnswerId="8480" CreationDate="2019-10-13T16:51:03.880" Score="3" ViewCount="145" Body="&lt;p&gt;Take the Bell state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(|00\rangle +|11\rangle\right) $$&lt;/span&gt;&#xA;and measure the first qubit with respect to some axis &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_1$&lt;/span&gt; on the Bloch sphere, i.e. measure the observable&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vec{n}_1\cdot \vec{\sigma}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_1$&lt;/span&gt; is normalized and &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}$&lt;/span&gt; is the vector of Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, measure the second qubit with respect to a different axis &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the probability of equal measurement outcomes as a function of the two axes &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_1,\vec{n}_2$&lt;/span&gt;, or, say, as a function of the angle between the axes?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read somewhere that the right answer is &lt;span class=&quot;math-container&quot;&gt;$p(\text{same outcome})=\cos^2\left(\frac{\theta}{2}\right)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is  the angle between the axes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am looking for an easy way to obtain this result, or any kind of intuition. I believe I am capable of just carrying out the full-blown calculation myself. In fact, I started but it is very tedious and does not seem to provide me with any intuition about the geometry that's happening here.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="55" LastEditDate="2019-10-16T14:12:31.593" LastActivityDate="2019-10-16T14:12:31.593" Title="Probability of equal outcomes measuring a Bell state in the directions $\vec{n}_1,\vec{n}_2$" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8474" PostTypeId="2" ParentId="8473" CreationDate="2019-10-13T18:42:10.747" Score="1" Body="&lt;p&gt;Intuitively, you can rotate &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis has two antipodal points &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_1$&lt;/span&gt; have two antipodal points &lt;span class=&quot;math-container&quot;&gt;$|b_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b_1\rangle$&lt;/span&gt;. Now the Bell state can be rewritten as &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|b_0b_0\rangle+|b_1b_1\rangle)$&lt;/span&gt;. Now in this new basis, the calculation shall be much easier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be precise, please clarify your notation first. What is your &lt;span class=&quot;math-container&quot;&gt;$\vec{n}_1$&lt;/span&gt;? Is it an axis or unitary operator? In Quantum Computation and Quantum Information,  section 4.2, an axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; is defined as three dimensional real unit vector. Only a rotation around the axis, not the axis itself, becomes an unitary operator. Apparently, the two antipodal points are eigenvectors for any such unitary operator since these two points do not move under rotation. Again, with this understanding of axis, you can always rotate &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_1$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis by first rotating it around &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$X-Y$&lt;/span&gt; plane and then around &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="8321" LastEditDate="2019-10-13T23:08:25.380" LastActivityDate="2019-10-13T23:08:25.380" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8475" PostTypeId="1" CreationDate="2019-10-13T21:25:30.540" Score="2" ViewCount="23" Body="&lt;p&gt;I'm curious if there's any consensus on this question among actual practitioners, but please feel free to close it if it's hopelessly opinion-based (since we've only taken baby steps toward the experimental demonstration of scalable QEC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard presentation of quantum error correction presents &quot;manual&quot; error correction. In that case, the (macroscopic/classical/fully decohered) operator repeatedly measures the ancilla qubits to determine which error syndromes (if any) occurred in the data qubits to which they're coupled, and then applies to the data qubits whichever unitary operations are necessary to correct those errors. But it's also possible to &quot;automate&quot; the error correction by having the ancillas control controlled unitaries that correct the errors automatically (cf. Mermin's Intro to Quantum Computing pg. 106). This keeps the error-correction almost completely unitary, although not quite (because the ancillas need to be reset to the reference state for the next round of error correction, and in a closed system this reset operation requires a measurement followed by an operation contingent on the measurement result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is successful &quot;manual&quot; or &quot;automated&quot; error correction considered easier to achieve, based on our current capabilities? I can think of an argument for either:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Manual error correction requires shallower quantum circuits, and might therefore require less time to perform, thereby reducing the amount of time for errors to occur.&lt;/li&gt;&#xA;&lt;li&gt;Automated error correction is &quot;more unitary&quot; and requires fewer measurements, i.e. fewer controlled interactions between the system and the environment. This might allow the experimental designers to keep the system better physically isolated during the computation, thereby reducing uncontrolled environmental interactions that cause errors. (On the other hand, even if this is the case, then the need to repeatedly measure the ancilla qubits might eliminate that advantage in practice.)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="551" LastActivityDate="2019-10-13T21:25:30.540" Title="Is manual or automated error correction more practically promising in the near term?" Tags="&lt;measurement&gt;&lt;error-correction&gt;&lt;experiment&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8477" PostTypeId="1" AcceptedAnswerId="8499" CreationDate="2019-10-14T03:09:35.843" Score="4" ViewCount="480" Body="&lt;p&gt;I'm trying to solve the following question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Prove that one way to compute &lt;span class=&quot;math-container&quot;&gt;$\mathrm Tr_B$&lt;/span&gt; is to assume that someone has measured system&#xA;  &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in any orthonormal basis but does not tell you the measurement outcome.&quot;&#xA;  - &quot;An Introduction to Quantum Computing&quot; by Phillip Kaye.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_B$&lt;/span&gt;, represents the partial trace with respect to some subsystem in say a bipartite system &lt;span class=&quot;math-container&quot;&gt;$H_A \otimes H_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have some reasoning behind it, but I don't see this as a proof. For example if we have say if we have &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle, |\phi_2\rangle \in H_A \otimes H_B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle = |a_1\rangle \otimes |b_1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\phi_2\rangle = |a_2\rangle \otimes |b_2\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle\langle\phi_2| = |a_1\rangle\langle a_2| \otimes |b_1\rangle\langle b_2|$&lt;/span&gt;, and if someone were to measure the system &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle\langle\phi_2|$&lt;/span&gt; becomes the zero operator if &lt;span class=&quot;math-container&quot;&gt;$ |b_1\rangle \neq |b_2\rangle$&lt;/span&gt;. Since the &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; component of the &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; has already collapsed only the operators on &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; that don't change the state, i.e. where &lt;span class=&quot;math-container&quot;&gt;$|b_1\rangle = |b_2\rangle$&lt;/span&gt; make sense. But since the info from &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; was discarded we haven't learned anything about &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt;, so the result is just &lt;span class=&quot;math-container&quot;&gt;$(\langle b_1 ||b_2\rangle)(|a_1\rangle\langle a_2|)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I kind of see how this becomes the partial trace, since &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_B(|b_1\rangle \langle b_2|) = \langle b_1 ||b_2\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am looking for hints about how to extend this to a proof, or to fill in any gaps in my understanding.&lt;/p&gt;&#xA;" OwnerUserId="8765" LastEditorUserId="55" LastEditDate="2019-10-16T14:14:50.457" LastActivityDate="2019-10-16T14:28:00.760" Title="Prove that the partial trace is equivalent to measuring and discarding" Tags="&lt;measurement&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8478" PostTypeId="2" ParentId="8444" CreationDate="2019-10-14T04:03:23.887" Score="3" Body="&lt;p&gt;I think I understand where you're getting tripped up.  When considering this portion of a circuit,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KlKb8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KlKb8.png&quot; alt=&quot;quantum_circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;it seems contradictory that both &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; is unchanged by &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle = \vert +- \rangle \rightarrow \vert -- \rangle = \vert \psi_2 \rangle$&lt;/span&gt;.  It turns out that this is not a contradiction, but it is unintuitive (a frequent theme in QM).  I will try to clarify what's happening mathematically, then answer your questions explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You seem to be clear on what's happening on the left side&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_1 \rangle = \vert xy \rangle = \frac{1}{2} \left(\vert 0 \rangle + \vert 1 \rangle \right) \left( \vert 0 \rangle - \vert 1 \rangle \right),$$&lt;/span&gt;&#xA;but if anything is fuzzy here, I went through the interpretation of this specific basis in a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8356/8623&quot;&gt;previous answer&lt;/a&gt;.  To state the obvious, &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle$&lt;/span&gt; is defined by the tensor product of the states on the data register, &lt;span class=&quot;math-container&quot;&gt;$\text{q}_{dat}$&lt;/span&gt;, and the target register, &lt;span class=&quot;math-container&quot;&gt;$\text{q}_{tar}$&lt;/span&gt;, to the right of &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;, just as &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle$&lt;/span&gt; is to the left of &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A critical observation is that the tensor product of the subspace of &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle$&lt;/span&gt; corresponding to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\text{q}_{dat}$&lt;/span&gt; and the subspace of &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle$&lt;/span&gt; corresponding to &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \oplus y \sqrt{2} \rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\text{q}_{tar}$&lt;/span&gt; must have magnitude 0, &lt;em&gt;i.e.&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lambda \vert 0 \rangle \otimes \vert 1 \oplus y \sqrt{2} \rangle = 0,$$&lt;/span&gt;&#xA;and &lt;em&gt;vice versa&lt;/em&gt;.  Hopefully there is no confusion here as this is required by the assumption that if &lt;span class=&quot;math-container&quot;&gt;$x = 0$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\text{q}_{dat}$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$x \ne 1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\text{q}_{tar}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accordingly, the tensor product for &lt;span class=&quot;math-container&quot;&gt;$\psi_2$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_2 \rangle = \frac{1}{2} \left(\, \vert 0 \rangle \vert 0 \oplus y \sqrt{2} \rangle + \vert 1 \rangle \vert 1 \oplus y \sqrt{2} \rangle \,\right).$$&lt;/span&gt;&#xA;The symbol &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; in this context indicates addition modulo 2, &lt;em&gt;e.g.&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \oplus 1 \rangle = \vert 0 \rangle$&lt;/span&gt;, which leads to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_2 \rangle = \frac{1}{2} \left[\, \vert 0 \rangle \left(\, \vert 0 \rangle - \vert 1 \rangle \, \right)+ \vert 1 \rangle \left( \, \vert 1 \rangle - \vert 0 \rangle &#xA; \, \right) \, \right].$$&lt;/span&gt;&#xA;Carrying this through gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_2 \rangle = \frac{1}{2} \left(\, \vert 00 \rangle + \vert 11 \rangle - \vert 01 \rangle - \vert 10 \rangle \, \right).$$&lt;/span&gt;&#xA;Finally it's readily seen that the preceding equation factors into&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_2 \rangle = \frac{1}{2} \left( \, \vert 0 \rangle - \vert 1 \rangle \, \right) \, \left( \, \vert 0 \rangle - \vert 1 \rangle \, \right) = \vert -- \rangle,$$&lt;/span&gt;&#xA;as desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As alluded to by Mark S, this problem is very closely related to the Deutsch and Deutsch-Jozsa algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer your questions explicitly:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;By definition, the input &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; and the output &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; on the data register of &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; are the same.  As shown above, this is not in contradiction with &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle = \vert -- \rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The notation is agnostic to orthonormality of vectors.&lt;/li&gt;&#xA;&lt;li&gt;This notation is very efficient for these types of problems.  You should try to get more comfortable with it.  If you study or work in this space for long, it will soon become second nature.&lt;/li&gt;&#xA;&lt;li&gt;N/A&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-14T21:18:28.023" LastActivityDate="2019-10-14T21:18:28.023" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8479" PostTypeId="2" ParentId="8477" CreationDate="2019-10-14T06:59:44.230" Score="3" Body="&lt;p&gt;Let me give you the structure for how you go about answering this question. Let &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; be the pure state shared between Alice and Bob. Bob measures his system in an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|\phi_i\rangle\}$&lt;/span&gt;. Thus, Bob gets an answer &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, and the overall system is left in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle|\phi_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, Alice does not know which result Bob got, all she knows is that with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; she has the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;. Thus, what is the density matrix that she uses to describe her system?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, you want to explicitly calculate what &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; are based on &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt;. This gives you an explicit expression for Alice's density matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, you want to compare this to the partial trace. Remember that when you trace over one subsystem, you can use any orthonormal basis that you want, so we'll pick &lt;span class=&quot;math-container&quot;&gt;$\{|\phi_i\rangle\}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B(|\Psi\rangle\langle\Psi|)=\sum_i(I\otimes\langle\phi_i|)|\Psi\rangle\langle\Psi|(I\otimes|\phi_i\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-14T06:59:44.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8480" PostTypeId="2" ParentId="8473" CreationDate="2019-10-14T07:14:42.890" Score="4" Body="&lt;p&gt;You can calculate the probability of a given answer &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; to each measurement by evaluating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle B|\frac{I+(-1)^{\eta_1}\vec{n}_1\cdot\vec{\sigma}}{2}\otimes\frac{I+(-1)^{\eta_2}\vec{n}_2\cdot\vec{\sigma}}{2}|B\rangle&#xA;$$&lt;/span&gt;&#xA;Thus, the probability of equal measurement outcomes is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle B|\left(\frac{I+\vec{n}_1\cdot\vec{\sigma}}{2}\otimes\frac{I+\vec{n}_2\cdot\vec{\sigma}}{2}+\frac{I-\vec{n}_1\cdot\vec{\sigma}}{2}\otimes\frac{I-\vec{n}_2\cdot\vec{\sigma}}{2}\right)|B\rangle.&#xA;$$&lt;/span&gt;&#xA;This simplifies to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle B|\left(\frac{I+\vec{n}_1\cdot\vec{\sigma}\otimes\vec{n}_2\cdot\vec{\sigma}}{2}\right)|B\rangle.&#xA;$$&lt;/span&gt;&#xA;I can also write this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12+\frac12\text{Tr}\left(|B\rangle\langle B|\vec{n}_1\cdot\vec{\sigma}\otimes\vec{n}_2\cdot\vec{\sigma}\right),&#xA;$$&lt;/span&gt;&#xA;with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|B\rangle\langle B|=\frac14(X\otimes X-Y\otimes Y+I+Z\otimes Z).&#xA;$$&lt;/span&gt;&#xA;So, the calculation that we want is all products of Pauli matrices. They are traceless unless the product is identity. That gives us an easy way to pick out terms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12+\frac12(n_1^Xn_2^X-n_1^Yn_2^Y+n_1^Zn_2^Z).&#xA;$$&lt;/span&gt;&#xA;This is not &lt;em&gt;quite&lt;/em&gt; the result you were expecting because of a negative sign (unless your bases have no &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-component, as would be the typical case of a Bell test, for example), so you cannot write it in terms of the angle between the two vectors. If you want to do that, then you should use the Bell state &lt;span class=&quot;math-container&quot;&gt;$|B_{11}\rangle=(|01\rangle-|10\rangle)/\sqrt{2}$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$|B_{11}\rangle\langle B_{11}|=\frac12(I-Z\otimes Z-X\otimes X-Y\otimes Y)$&lt;/span&gt;, and hence we find that the probability of getting equal results is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12\left(1-\vec{n}_1\cdot\vec{n}_2\right).&#xA;$$&lt;/span&gt;&#xA;If the angle between the two vectors is &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, then this is &lt;span class=&quot;math-container&quot;&gt;$\frac12(1-\cos\theta)=\sin^2\frac{\theta}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want some sort of intuition, think of the Bell state as performing a teleportation. (Mathematically, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_1(|\psi\rangle\langle\psi|\otimes I \cdot|B\rangle\langle B|)=\frac12|\psi\rangle\langle\psi|^T$&lt;/span&gt; on the second qubit.) So, it's like the first state being teleported through to the second state, where the inner product is calculated.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-10-15T06:08:17.087" LastActivityDate="2019-10-15T06:08:17.087" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8481" PostTypeId="1" CreationDate="2019-10-14T10:02:22.117" Score="1" ViewCount="550" Body="&lt;p&gt;I am a Swiss student and have 2 years left at school. In these 2 years, I have to do a special piece of work on a specific subject. I decided to do it on quantum computers. For this, I have to find a question to answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would gladly take in any feedback, propositions or problem to solve about quantum physics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some things to take into consideration :&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It should be under the form of a problem that needs some thinking to be solved. I just have to show the way I tackled it and I should propose a solution to it.&lt;/li&gt;&#xA;&lt;li&gt;It shouldn't need some very advanced knowledge of quantum physics. I am a high school student and not a university expert&lt;/li&gt;&#xA;&lt;li&gt;I do know about programming. I am pretty good at python and I know about basic algorithms.&lt;/li&gt;&#xA;&lt;li&gt;I am documenting myself: I am currently reading the documentation of the IBM Q Experience. I am also considering to buy a couple of &lt;a href=&quot;https://fivebooks.com/best-books/quantum-computing-chris-bernhardt/&quot; rel=&quot;nofollow noreferrer&quot;&gt;these books (books 1-3)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I hope you will be able to propose something. If you need any further information to help, feel free to ask.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="26" LastEditDate="2019-10-14T10:14:57.253" LastActivityDate="2019-10-16T06:35:17.120" Title="Ideas for school-level project on quantum computing" Tags="&lt;algorithm&gt;&lt;research&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8482" PostTypeId="1" CreationDate="2019-10-14T14:49:25.833" Score="4" ViewCount="84" Body="&lt;p&gt;Used &lt;a href=&quot;https://pypi.org/project/memory-profiler/&quot; rel=&quot;nofollow noreferrer&quot;&gt;memory-profiler&lt;/a&gt; to check why I get memory spikes in what I though were small circuits. The circuit itself is constructed using &lt;code&gt;qiskit.aqua.algorithms.single_sample.shor.shor.Shor&lt;/code&gt;, the backend ended up being &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt; with the default number of shots (1024).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The results:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Line #    Mem usage    Increment   Line Contents&#xA;================================================&#xA;   302    180.6 MiB    180.6 MiB       @profile&#xA;   303                                 def _shors_period_finder(self, job_descriptor: ShorJobDescriptor, fleet: QFleet, shots=None):&#xA;   ...    ...            ...&#xA;   310    180.6 MiB      0.0 MiB           shor = Shor(N=9, a=4)&#xA;   311    324.0 MiB    143.4 MiB           circ = shor.construct_circuit(measurement=True)&#xA;   ...    ...            ...&#xA;   315    326.1 MiB      2.0 MiB           qcomp = fleet.get_best_backend(circ.n_qubits, job_descriptor.allow_simulator)&#xA;   ...    ...            ...&#xA;   324    668.9 MiB    342.9 MiB           job = execute(circ, backend=qcomp, shots=shots if shots else 1024)&#xA;   ...    ...            ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why am I getting the memory spike on line &lt;code&gt;324&lt;/code&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is a &lt;code&gt;(9,4)&lt;/code&gt; Shor circuit really 143.4MB? Am I using the wrong &lt;code&gt;Shor&lt;/code&gt; object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or am I just optimistic about the circuits I can construct without this volume of overhead?&lt;/p&gt;&#xA;" OwnerUserId="8770" LastEditorUserId="26" LastEditDate="2019-10-14T15:59:11.807" LastActivityDate="2019-10-14T15:59:11.807" Title="`execute()` hangs and eats memory" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8483" PostTypeId="2" ParentId="8249" CreationDate="2019-10-14T19:38:17.953" Score="4" Body="&lt;p&gt;In the most widespread convention, the Bloch sphere uses &lt;span class=&quot;math-container&quot;&gt;$\theta = 0$&lt;/span&gt; radians latitude to indicate the north pole &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt; to refer to the south pole &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi/2$&lt;/span&gt; to refer to the equator, which includes the superpositions &lt;span class=&quot;math-container&quot;&gt;$(1+i)/\sqrt 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(1-i)/\sqrt 2$&lt;/span&gt; as well as &lt;span class=&quot;math-container&quot;&gt;$i|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-i|1\rangle$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If two great circles are distinct and intersect at a given point they will intersect exactly one other time at the opposite point on the sphere and such that a ray passing through both points will also pass through the center of the sphere.  Given this, the difference in latitude between one point and the equator will be of equal magnitude but opposite sign relative to the other, with the equator being at &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;.  As such, the latitude of the antipode to &lt;span class=&quot;math-container&quot;&gt;$(\theta,\psi)$&lt;/span&gt; will be &lt;span class=&quot;math-container&quot;&gt;$\pi-\theta$&lt;/span&gt;.  As there are &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; radians of longitude to a sphere, the opposite of a given longitude with be &lt;span class=&quot;math-container&quot;&gt;$\pi+\psi$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This being the case, coordinates for the antipode &lt;span class=&quot;math-container&quot;&gt;$(\theta,\psi)$&lt;/span&gt;  is &lt;span class=&quot;math-container&quot;&gt;$(\pi-\theta,\pi+\psi)$&lt;/span&gt;.  Trigonometric identities will be sufficient for the rest.&lt;/p&gt;&#xA;" OwnerUserId="8774" LastEditorUserId="8774" LastEditDate="2019-10-15T00:17:18.060" LastActivityDate="2019-10-15T00:17:18.060" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8484" PostTypeId="1" CreationDate="2019-10-15T03:56:19.157" Score="3" ViewCount="80" Body="&lt;p&gt;I’m starting an engineering degree in computer systems and I’m starting to get really interested in quantum computing. First of all, I don’t know where or how to start and I would really like to learn about this. Second and last I think I have a good level of English but I would really like to give all this information and manuals to my friends and professors so it surely would be awesome to have information in Spanish too. &lt;/p&gt;&#xA;" OwnerUserId="8775" LastEditorUserId="26" LastEditDate="2019-10-16T15:22:26.470" LastActivityDate="2019-10-16T15:22:26.470" Title="Resources in Spanish to start learning quantum computing and quantum programming (Qiskit)" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8485" PostTypeId="2" ParentId="8484" CreationDate="2019-10-15T08:56:55.060" Score="4" Body="&lt;p&gt;Check out the resources on &lt;a href=&quot;https://community.qiskit.org/education/#textbook&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt; especially the textbook as that starts from the very fundamentals and works up. There are also &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/tree/master/qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorials&lt;/a&gt; to teach you about the basics of quantum computing and work up to very complex topics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for resources in Spanish, if you join the qiskit &lt;a href=&quot;https://join.slack.com/t/qiskit/shared_invite/enQtNjQ5OTc5ODM1ODYyLTc2YWJhOWViZDA2OWI5N2EyMjIxN2YwODM5MWQyN2Q3MjczOGRlMDU4MzMxMWE5MzZjMzEzYzM3MmJiMzU5MzU&quot; rel=&quot;nofollow noreferrer&quot;&gt;Slack community&lt;/a&gt; there is a channel #spain where they discuss quantum computing in Spanish.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-10-15T08:56:55.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8486" PostTypeId="1" CreationDate="2019-10-15T11:13:06.000" Score="4" ViewCount="73" Body="&lt;p&gt;I’m studying the paper &lt;em&gt;Expressive power of tensor-network factorizations for probabilistic modeling&lt;/em&gt; by Glasser et al. In equation S6 (page 2 of supplementary material, excerpt of paper figure below) it is claimed that a 2-local unitary &lt;span class=&quot;math-container&quot;&gt;$\rm U$&lt;/span&gt; may be split into a contraction of two 1-local gate tensors through a singular value decomposition (SVD). How this is done, however, is not clear to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nbwLF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nbwLF.jpg&quot; alt=&quot;Excerpt of paper&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In tensor notation, the entries of a unitary &lt;span class=&quot;math-container&quot;&gt;$\rm U$&lt;/span&gt; acting on two qudits may be written &lt;span class=&quot;math-container&quot;&gt;$U^{ij}_{kl}$&lt;/span&gt;, with the first upper and lower index referring to the first qudit, and the second upper and lower index referring to the second qudit. Splitting &lt;span class=&quot;math-container&quot;&gt;$\rm U$&lt;/span&gt; into a contraction of two 1-local gate tensors &lt;span class=&quot;math-container&quot;&gt;$\rm A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rm B$&lt;/span&gt; would mean that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U^{ij}_{kl}=\sum_\alpha A^{i\alpha}_kB^j_{l\alpha}\tag{1}$$&lt;/span&gt;&#xA;or, equivalently&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rm U}=\sum_\alpha{\rm A}^{\kern-0.085em\alpha}\otimes{\rm B}_\alpha\tag{2}$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\rm A$&lt;/span&gt; acting on the first qudit and &lt;span class=&quot;math-container&quot;&gt;$\rm B$&lt;/span&gt; acting on the second.&#xA;Now, when &lt;span class=&quot;math-container&quot;&gt;$\rm U$&lt;/span&gt; is decomposed into &lt;span class=&quot;math-container&quot;&gt;$\rm C\Sigma\rm D^\dagger$&lt;/span&gt;, we have in tensor notation that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U^{ij}_{kl}=\sum_{\gamma\delta}\sigma_{\gamma\delta}C^{ij}_{\gamma\delta}(D^\dagger)^{\gamma\delta}_{kl}.\tag{3}$$&lt;/span&gt;&#xA;This is much different from the first decomposition, as &lt;span class=&quot;math-container&quot;&gt;$\rm C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rm D$&lt;/span&gt; still act on both qudits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody explain how the decomposition should be carried out so as to arrive at eq. 1 or 2?&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="2687" LastEditDate="2019-10-16T12:19:09.863" LastActivityDate="2019-10-16T12:19:09.863" Title="How to split a 2-local unitary operator through singular value decomposition?" Tags="&lt;mathematics&gt;&lt;tensor-networks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8487" PostTypeId="1" CreationDate="2019-10-15T15:33:53.093" Score="3" ViewCount="37" Body="&lt;p&gt;I knew that we usually use circuit instead of Turing machine in Quantum computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a deterministic Turing machine one has transition rules,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta: Q\times\Gamma\rightarrow Q\times\Gamma\times\{\pm 1, 0\},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Q, \Gamma$&lt;/span&gt; are set of states and symbols respectively. In the quantum Turing machine, we instead have,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta:Q\times\Gamma\rightarrow\mathbb{C}^{Q\times\Gamma\times\{\pm1,0\}}.&#xA;$$&lt;/span&gt;&#xA;Suppose all that needed for the induced evolution &lt;span class=&quot;math-container&quot;&gt;$U_\delta$&lt;/span&gt; being unitary. However, I feel tremendously obstructed when trying to construct even a toy example. Then I realize one difference between quantum circuit family and Turing machine when manipulating the computation is the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When constructing a quantum circuit, one could decide which qubit to act on, this decision is a classical advice that is precomputed before the quantum computating even started. When constructing a quantum Turing machine, we need to make sure that even the arrangement of gates must obeys the unitary property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, if we would like to apply &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-local &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on a tape. Say, suppose the configuration in computational basis after truncated infinitely long tape is &lt;span class=&quot;math-container&quot;&gt;$|n,q\rangle|x_0,x_1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n,q,x_i$&lt;/span&gt; represents the current pointer location, state, and value of 2 cells on the tape. We would like to maps it to &lt;span class=&quot;math-container&quot;&gt;$|n,q\rangle U|x_0,x_1\rangle$&lt;/span&gt;, but unfortunately we could only apply our basic gate on &lt;span class=&quot;math-container&quot;&gt;$n,q, x_n$&lt;/span&gt;. In the circuit paradigm, we might use a trick that swaps information between &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; to perform multi-qubit gates. So we might say,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Let &lt;span class=&quot;math-container&quot;&gt;$(q,s)\in Q=Q_L\times \Gamma$&lt;/span&gt; composed of &quot;logical state&quot; and a dummy register state. Write computational basis as &lt;span class=&quot;math-container&quot;&gt;$|n,q,s,x_0,x_1\rangle$&lt;/span&gt; and we starts at &lt;span class=&quot;math-container&quot;&gt;$|0,q,s,x_0,x_1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Interchange &lt;span class=&quot;math-container&quot;&gt;$s,x_n$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|0,q,s,x_0,x_1\rangle\mapsto|n,q,x_0,s,x_1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Logical flip the pointer bit, &lt;span class=&quot;math-container&quot;&gt;$|n,q,s,x_0,x_1\rangle\mapsto|\lnot n,q,s,x_0,x_1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Perform &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-local operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$s,x_n$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|1,q,s,x_0,x_1\rangle\mapsto|1,q\rangle U|s,x_1\rangle|x_0\rangle.$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Swap back everything as prevously done, &lt;span class=&quot;math-container&quot;&gt;$|1,q,s,x_0,x_1\rangle\mapsto|0,q,x_0,s,x_1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But we cannot do this directly on quantum Turing machine, it is because we must also guarantee that the way we arrange these rules mentioned above should induce a unitary evolution.&#xA;Even to simulate a classical Turing machine is non-trivial because though without superposition, in order to preserve unitary property, &lt;strong&gt;you need to permute classical states instead of making straight transition logic&lt;/strong&gt;. I understand that quantum circuit is usually more used in the context of quantum computation, but at this stage even manipulating really simple rules are quite painful, in the above example, I even have to construct the states to transition cyclicly just to preserve unitary property.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If we would like to instantiate classical arrangements of quantum gates in a quantum Turing machine, is there better ways, perhaps more expressive, to constuct them explicitly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4855" LastEditorUserId="55" LastEditDate="2020-09-23T12:21:33.370" LastActivityDate="2020-09-23T12:21:33.370" Title="Explicit Construction of Classical Rules in Quantum Turing Machine" Tags="&lt;complexity-theory&gt;&lt;quantum-turing-machine&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8488" PostTypeId="2" ParentId="8481" CreationDate="2019-10-15T15:54:20.357" Score="0" Body="&lt;p&gt;I would say you could start with the basic implementation of gates. For example, adding two binary numbers is trivial in classical digital circuits. Try to think about how could you solve that with a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On this line, you could think of what things are easy in the classical world and would be difficult to do in the quantum world.&lt;/p&gt;&#xA;" OwnerUserId="8782" LastActivityDate="2019-10-15T15:54:20.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8489" PostTypeId="2" ParentId="8481" CreationDate="2019-10-15T16:53:39.047" Score="2" Body="&lt;p&gt;I'll reiterate on my earlier answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5800/2879&quot;&gt;What can be a mini research project based on Grover's algorithm or the Deutsch Jozsa algorithm?&lt;/a&gt;: I think &quot;Applying Grover's search algorithm to solve problem X&quot; is a great topic for a small (or not-so-small) project.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It is a very well-known algorithm (well, at least it is featured in the writings about quantum computing very frequently).&lt;/li&gt;&#xA;&lt;li&gt;The problem you're trying to solve is very simple to explain to somebody who is not familiar with the topic, so it is an easy presentation start.&lt;/li&gt;&#xA;&lt;li&gt;You can make the project as extensive as you want (or have time to), depending on the problem you choose, and even for the same problem, since there are a lot of things you can explore within a project: &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the algorithm itself, &lt;/li&gt;&#xA;&lt;li&gt;the implementation nuances and high-level behavior (see &lt;a href=&quot;https://github.com/microsoft/GHC19-GroverSearch&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example&lt;/a&gt; I did for a recent workshop), &lt;/li&gt;&#xA;&lt;li&gt;picking an interesting problem to solve and implementing an oracle for it,&lt;/li&gt;&#xA;&lt;li&gt;optimizing the oracle to make it possible to simulate a small instance of a problem on 30-ish qubits,&lt;/li&gt;&#xA;&lt;li&gt;estimating the resources necessary to run the algorithm on a larger instance, &lt;/li&gt;&#xA;&lt;li&gt;counting the number of solutions to the problem instead of finding a solution (&quot;quantum counting&quot;), etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-10-15T16:53:39.047" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8490" PostTypeId="1" AcceptedAnswerId="8496" CreationDate="2019-10-15T19:38:26.913" Score="3" ViewCount="56" Body="&lt;p&gt;So starting with an &lt;em&gt;up&lt;/em&gt; particle:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \uparrow \rangle =  \begin{bmatrix}&#xA;    1 \\&#xA;    0 \\&#xA;    \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;My understanding is that you can measure &lt;span class=&quot;math-container&quot;&gt;$\lvert \uparrow \rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and have a 50% chance of getting &lt;span class=&quot;math-container&quot;&gt;$\lvert \leftarrow \rangle$&lt;/span&gt; and a 50% chance of getting &lt;span class=&quot;math-container&quot;&gt;$\lvert \rightarrow \rangle$&lt;/span&gt; where:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \rightarrow \rangle =  \begin{bmatrix}&#xA;    \frac{1}{\sqrt{2}} \\&#xA;    \frac{1}{\sqrt{2}}&#xA;    \end{bmatrix}&#xA;\text{ and }&#xA;\lvert \leftarrow \rangle =  \begin{bmatrix}&#xA;    \frac{1}{\sqrt{2}} \\&#xA;    \frac{-1}{\sqrt{2}}&#xA;    \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;but you could also &lt;em&gt;operate&lt;/em&gt; in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; which would be the equivalent of passing it though a &lt;code&gt;NOT&lt;/code&gt; gate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X \cdot \lvert \uparrow \rangle =  &#xA;\begin{bmatrix}&#xA;    0 &amp;amp; 1 \\&#xA;    1 &amp;amp; 0 \\&#xA;    \end{bmatrix}&#xA;\cdot&#xA;\begin{bmatrix}&#xA;    1 \\&#xA;    0 \\&#xA;\end{bmatrix} = \begin{bmatrix}&#xA;    0 \\&#xA;    1 \\&#xA;\end{bmatrix} = \lvert \downarrow \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read that measuring qubit spin is more or less equivalent to measuring the orientation of a photon which can be done by passing it through polarized filters. If the photon is measured to be in one orientation and then is measured in a different orientation it has a certain probability of &lt;em&gt;snapping&lt;/em&gt; to be in that other direction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this example, that would be equivalent to measuring an &lt;em&gt;up&lt;/em&gt; qubit in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. But how does &lt;em&gt;operating&lt;/em&gt; in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; come into the equation? I understand the mathematical effect it has, but what does this mean for the physical qubit? Is it also being passed through a filter and how is that different from measuring?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8663" LastEditorUserId="55" LastEditDate="2020-07-26T18:09:08.697" LastActivityDate="2020-07-26T18:09:08.697" Title="What's the difference between observing in a given direction and operating in that same direction?" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8491" PostTypeId="2" ParentId="2004" CreationDate="2019-10-16T00:58:08.260" Score="0" Body="&lt;p&gt;Grover's algorithm can be used to solve any numerical optimization problem faster than brute-force search, because any optimization problem can be formulated as a search problem (where you are searching for a function output greater/less than some fixed &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; within each run, and you repeat for a logarithmic number of runs using binary search to home into the optimal &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;): &lt;a href=&quot;https://epubs.siam.org/doi/abs/10.1137/040605072?journalCode=sjope8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://epubs.siam.org/doi/abs/10.1137/040605072?journalCode=sjope8&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, Grover's algorithm is the best-known quantum algorithm for many difficult optimization problems (such as NP-complete ones) that don't have much structure that is amenable to a classical algorithm cleverer than brute-force search: &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-540-78773-0_67&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://link.springer.com/chapter/10.1007/978-3-540-78773-0_67&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2019-10-16T00:58:08.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8492" PostTypeId="2" ParentId="4263" CreationDate="2019-10-16T01:05:57.963" Score="3" Body="&lt;p&gt;The Kerenidis-Prakash algorithm &lt;em&gt;was&lt;/em&gt; groundbreaking, until Ewin Tang fixed the ground back up: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.quantamagazine.org/teenager-finds-classical-alternative-to-quantum-recommendation-algorithm-20180731/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quanta Magazine: Major Quantum Computing Advance Made Obsolete by Teenager&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="26" LastEditDate="2019-10-16T15:25:25.007" LastActivityDate="2019-10-16T15:25:25.007" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8493" PostTypeId="1" CreationDate="2019-10-16T06:09:55.287" Score="1" ViewCount="1052" Body="&lt;p&gt;Does anybody have any other comparisons between a universal quantum computer and a classical computer that might shed some light into how their performance compares?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is what I've been able to come up with, so far.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I am an electrical engineer and have been learning about quantum computing for the last year, and I can hardly believe what I read and hear. It is becoming clearer to me, but it's a very difficult subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is there so much fuss about quantum computing? I will attempt here to show that a 19 qubit quantum computer could match the performance of a 200 petaflops IBM supercomputer, and also how its performance improves with more qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This discussion assumes that all of these qubits are what are termed 'logical qubits'. That is, they are fully error-corrected and have infinite 'coherence' times. These types of qubits are a LONG way off. Contemporary 2019 qubits are short-lived.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, the state of a quantum computer is defined by a vector of length 2^n complex values where n is the number of qubits in that quantum computer. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 qubit -&gt; 2 values in the state vector&lt;br/&gt;&#xA;2 qubits -&gt; 4 values in the state vector&lt;br/&gt;&#xA;3 qubits -&gt; 8 values in the state vector&lt;br/&gt;&#xA;... ...&lt;br/&gt;&#xA;16 qubits -&gt; 65,536 values in the state vector&lt;br/&gt;&#xA;... ...&lt;br/&gt;&#xA;100 qubits -&gt; 1,267,650,600,228,229,401,496,703,205,376 values in the state vector&lt;br/&gt;&#xA;... ...&lt;br/&gt;&#xA;and so on.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The square of any one of the values in the state vector list indicates the probability that this particular list number (index) will be observed at the output of the quantum computer when the MEASURE logic gate (see below) is finally applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To program the quantum computer, a person will apply what are called 'quantum logic gates' or just 'gates' to the system in order to achieve the processing that they desire. Some of the names of the 'gates' are Hadamard, CNOT, Pauli-X, and MEASURE (the last one applied).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When a programmer starts to manipulate the quantum computer, the state of the qubits is initialized and the first value in the state vector list is set equal to 'one' and all of the other values are set equal to 'zero'. If the MEASURE gate were applied now then the output would always read 0b0...00000 since the probability of observing that first list number is 100%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of the programmer is usually to apply the necessary quantum logic 'gates' in such a way that the 100% list value moves from list entry number 0b0...00000 to some other list entry number, and that number is what the scientists have been waiting for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each logic gate takes less than one microsecond to complete, and what each gate does is to modify all of the 2^n current state vector values in order to create (evolve to) the next state vector list. This is equivalent to a 2^n by 2^n matrix multiplied with the 2^n current state vector. This is 2^n * 2^n = 2^2n multiply/accumulate (MAC) operations in one microsecond.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A contemporary IBM supercomputer allegedly has 200 petaflops of performance. If we let one FLOP (floating-point operation) equal one MAC (multiply/accumulate) operation then the IBM classical computer can do 200*10^15 MACS/sec * 10^-6 sec = 200*10^9 MACs in one quantum computer gate time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, equating the quantum computer to the IBM supercomputer's performance (for one quantum gate time):&#xA;2^2n = 200*10^9&#xA;or&#xA;n = 18.7 qubits (19 qubits) in order for a quantum computer to match the MAC performance of an IBM 200 petaflop supercomputer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is really amazing, and assuming that this is generally correct then each additional qubit means a 4x increase in MAC performance. Scientists are talking about applications requiring 500 qubits. It's going to be interesting.&lt;/p&gt;&#xA;" OwnerUserId="8788" LastEditorUserId="8788" LastEditDate="2019-10-19T20:51:52.543" LastActivityDate="2019-10-19T20:51:52.543" Title="Quantum computer vs. supercomputer performance" Tags="&lt;classical-computing&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="7" ClosedDate="2019-10-19T17:46:48.033" ContentLicense="CC BY-SA 4.0" />
  <row Id="8494" PostTypeId="2" ParentId="8481" CreationDate="2019-10-16T06:35:17.120" Score="0" Body="&lt;p&gt;Perhaps you can build a device that simply demonstrates one of the characteristics of a single qubit, and that is the ability to program its 'superposition' probability amplitudes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy way to visualize this is by a simple coin toss or a coin spin on a table. Think of the coin as being in 'superposition' while it's in the air (or when it's spinning on the table). When you perform a quantum computer MEASURE gate on the coin - by letting it land or by waiting until it stops spinning - the system reveals its answer (&quot;heads&quot; or &quot;tails&quot; as we say here in California).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you start with a normal coin, the probability of it landing heads or tails is 50%(heads)+50%(tails). With a qubit, you can change its probabilities to anything you desire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a project, perhaps you could figure out how to make a model of this and have its probabilities adjustment be a knob (Arduino?) or something mechanical. Quantum computers use microwave pulses and magnetic fields to control their qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whatever you decide to do, learning quantum computing takes a lot of effort. It sounds like you have the ability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have fun!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bob&lt;/p&gt;&#xA;" OwnerUserId="8788" LastActivityDate="2019-10-16T06:35:17.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8495" PostTypeId="2" ParentId="8486" CreationDate="2019-10-16T10:44:59.667" Score="3" Body="&lt;p&gt;If I understand what you are asking for (I don't know much about tensor networks), both equations are singular value decompositions of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, just with respect to different indices (and in the latter case highlighting the singular values, which in the first equation is &quot;hidden&quot; in &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two things to notice here. First of all, given an arbitrary matrix &lt;span class=&quot;math-container&quot;&gt;$A_{ij}$&lt;/span&gt; you can write its SVD as (assuming summation over repeated indices, and without paying attention to whether indices are above or below the tensors):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A_{ij}= s_k B^k_i \bar C^k_j,\tag1$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B^k_i \bar B^\ell_i=\delta_{k\ell}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C^k_j \bar C^\ell_j=\delta_{k\ell}$&lt;/span&gt;.&#xA;But another way to write the SVD is to &quot;hide&quot; the singular values in the matrices in the decomposition, thus writing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A_{ij}=D^k_i \bar E^k_j,\tag2$$&lt;/span&gt;&#xA;where now &lt;span class=&quot;math-container&quot;&gt;$D_i^k \bar D_i^\ell=s_k \delta_{k\ell}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_i^k \bar E_i^\ell=s_k \delta_{k\ell}$&lt;/span&gt;.&#xA;You can always do this, being the singular values ensured to be non-negative. The connection between the objects in (2) and (1) is that &lt;span class=&quot;math-container&quot;&gt;$D_i^k\equiv\sqrt{s_k} B_i^k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_j^k\equiv \sqrt{s_k} C^k_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another point is that, if you have a tensor with more than two indices, there are multiple ways to apply the SVD. You can choose any way to separate the set of indices of the tensor in two groups, and then apply the SVD between these two groups.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you can think of &lt;span class=&quot;math-container&quot;&gt;$U^{ij}_{kl}$&lt;/span&gt; as a matrix &quot;sending the indices &lt;span class=&quot;math-container&quot;&gt;$(k,l)$&lt;/span&gt; into the indices &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt;&quot; (hopefully you know what this means formally), which is what you are doing in your second equation (also note that there is need to use two intermediate indices as you are doing, one is enough)/&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can think of &lt;span class=&quot;math-container&quot;&gt;$U^{ij}_{kl}$&lt;/span&gt; as &quot;sending &lt;span class=&quot;math-container&quot;&gt;$(j,l)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(i,k)$&lt;/span&gt;&quot;, which gives you the SVD as in your first equation. Note that uou can also do other things here: e.g. separate &lt;span class=&quot;math-container&quot;&gt;$(i,l)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(j,k)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-16T10:44:59.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8496" PostTypeId="2" ParentId="8490" CreationDate="2019-10-16T11:00:43.250" Score="4" Body="&lt;p&gt;In general, &quot;&lt;em&gt;operating on a state with an observable&lt;/em&gt;&quot; does not have direct physical meaning (i.e. you cannot think of it as evolving the state doing something to it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does have physical meaning, is applying a &lt;em&gt;unitary&lt;/em&gt; operation to a state. Every unitary operator corresponds to a physical operation that you can (in principle) implement, transforming (reversibly) states into other states according to some rule.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the particular case of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, you &lt;em&gt;can&lt;/em&gt; actually think of it as an evolution, because &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is &lt;em&gt;both&lt;/em&gt; Hermitian (thus an observable) and unitary (thus an evolution). What this evolution means physically depends on the implementation. If you are dealing with the polarisation of a photon, it can be representing the action of a phase shifter, which rotates the polarisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it's important to distinguish between &quot;&lt;em&gt;acting on a state with the evolution &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;&lt;/em&gt;&quot; and &quot;&lt;em&gt;measuring the state with the observable &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;&lt;/em&gt;&quot;. To &quot;measure &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;&quot; means physically to apply a measurement which makes the state collapse into one of the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. This involves doing something like acting on the state with a Hadamard gate and then measuring in the computational basis, so you can see how this is rather different than evolving with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-16T11:00:43.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8497" PostTypeId="1" AcceptedAnswerId="8498" CreationDate="2019-10-16T13:39:27.440" Score="2" ViewCount="273" Body="&lt;p&gt;Consider the simplified code below. The code creates a quantum circuit and a simplified noise model.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to simulate this circuit using the noise model I get error message that the simulation fails.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have noticed that I get this when I supply &lt;code&gt;basis_gates&lt;/code&gt; to the &lt;code&gt;NoiseModel&lt;/code&gt; function, and when I remove &lt;code&gt;basis_gates&lt;/code&gt; from &lt;code&gt;NoiseModel&lt;/code&gt; it works. But if I do that Qiskit is not simulating the actual circuit that I want but a transpiled version of the actual circuit that I want to simulate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import execute, QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;from qiskit.providers.aer import QasmSimulator&#xA;from qiskit.tools.visualization import plot_histogram&#xA;&#xA;# Qiskit Aer noise module imports&#xA;from qiskit.providers.aer.noise import NoiseModel&#xA;from qiskit.providers.aer.noise.errors import pauli_error&#xA;&#xA;# System Specification&#xA;n_qubits = 2&#xA;circ = QuantumCircuit(n_qubits, n_qubits)&#xA;&#xA;# Test Circuit&#xA;circ.h(0)&#xA;circ.rx(np.pi/4,1)&#xA;circ.cz(0,1)&#xA;circ.rz(np.pi,0)&#xA;circ.measure(range(n_qubits), range(n_qubits))&#xA;&#xA;# Basis gates&#xA;basis_gates = ['id', 'h', 'rx', 'rz', 'cz']&#xA;&#xA;# Example error probabilities&#xA;p = 0.05&#xA;&#xA;# QuantumError objects&#xA;error_gate1 = pauli_error([('X',p), ('I', 1 - p)])&#xA;error_gate2 = error_gate1.tensor(error_gate1)&#xA;&#xA;# Add errors to noise model&#xA;noise_bit_flip = NoiseModel(basis_gates)&#xA;noise_bit_flip.add_all_qubit_quantum_error(error_gate1, [&quot;h&quot;, &quot;rx&quot;,&quot;rz&quot;])&#xA;noise_bit_flip.add_all_qubit_quantum_error(error_gate2, [&quot;cz&quot;])&#xA;&#xA;print(noise_bit_flip)&#xA;&#xA;# Backend&#xA;simulator = QasmSimulator()&#xA;&#xA;# Run the noisy simulation&#xA;job = execute(circ, simulator,&#xA;              basis_gates = noise_bit_flip.basis_gates,&#xA;              noise_model = noise_bit_flip)&#xA;result_bit_flip = job.result()&#xA;counts_bit_flip = result_bit_flip.get_counts(0)&#xA;&#xA;# Plot noisy output&#xA;plot_histogram(counts_bit_flip)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2136" LastActivityDate="2019-10-16T14:06:20.510" Title="Implementing noise model in Qiskit using arbitrary basis gates" Tags="&lt;qiskit&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8498" PostTypeId="2" ParentId="8497" CreationDate="2019-10-16T14:06:20.510" Score="2" Body="&lt;p&gt;If you call &lt;code&gt;execute&lt;/code&gt; with the parameter &lt;code&gt;optimization_level&lt;/code&gt; set to 0, qiskit will not perform any circuit optimizations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your call should therefore be &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(circ, simulator,&#xA;              optimization_level=0,&#xA;              noise_model = noise_bit_flip)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The optimization level can be 0-3 inclusive depending on how much optimization you would like terra to perform. By default optimization level 1, which performs some light optimization, is chosen.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-10-16T14:06:20.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8499" PostTypeId="2" ParentId="8477" CreationDate="2019-10-16T14:28:00.760" Score="2" Body="&lt;p&gt;Consider a bipartite state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_{ij}\psi_{ij}|i\rangle\otimes|j\rangle$&lt;/span&gt;.&#xA;In the following, I will work directly on the matrix elements of the objects involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tracing out the second space amounts to the following mapping&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\psi_{ij}\rightarrow \rho_{ii'}\equiv\sum_j \psi_{ij}\bar\psi_{i'j}.\tag A$$&lt;/span&gt;&#xA;Now forget about the partial trace, and consider what happens when you measure the second system in the computational basis. You will get the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th outcome with probability &lt;span class=&quot;math-container&quot;&gt;$p_j\equiv\sum_i |\psi_{ij}|^2$&lt;/span&gt;, and the post-measurement state will be some &lt;span class=&quot;math-container&quot;&gt;$\phi^{(j)}$&lt;/span&gt; with indices &lt;span class=&quot;math-container&quot;&gt;$\phi_i^{(j)}=\frac{1}{\sqrt{p_j}}\psi_{ij}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So now we need to find a way to define an object which contains the information about all the possible post-measurement states with their associated probabilities. This is the &quot;discarding measurement information&quot; part.&#xA;As it turns out, mapping ket vectors to density matrices makes this very easy, as probabilistic mixtures of states are simply weighted sums of density matrices.&#xA;We therefore map each &lt;span class=&quot;math-container&quot;&gt;$\phi^{(j)}$&lt;/span&gt; into the corresponding density matrix,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\phi^{(j)}_i\rightarrow\rho^{(j)}_{ii'}\equiv \phi^{(j)}_i\bar\phi^{(j)}_{i'}&#xA;=\frac{1}{p_j}\psi_{ij}\bar\psi_{i'j},$$&lt;/span&gt;&#xA;and now to &quot;forget&quot; about what state was measured, we simply sum these density matrices with the relative probabilities, which gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_j p_j\rho^{(j)}_{ii'}=\sum_j \psi_{ij}\bar\psi_{i'j},$$&lt;/span&gt;&#xA;which, as you might notice, is the same as (A).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-16T14:28:00.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8500" PostTypeId="2" ParentId="2603" CreationDate="2019-10-16T16:29:55.730" Score="2" Body="&lt;p&gt;Executing a NISQ-device in a manner that asymptotically outperforms a classical computer invalidates the Extended &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Church-Turing Thesis&lt;/a&gt; (ECT).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Voluminous tomes written about the (non-extended) Church-Turing Thesis, with implications for branches of philosophy such as the philosophy of mind.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fact that the ECT was not only falsifiable but also is likely &lt;em&gt;false&lt;/em&gt; merely by virtue of the existence of a NISQ-device reliably preparing a highly entangled state in high-enough dimension, I think likewise has some rather profound philosophical implications.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's rare that guiding philosophical principals can be falsified in a laboratory.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-10-19T12:50:26.193" LastActivityDate="2019-10-19T12:50:26.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8501" PostTypeId="1" AcceptedAnswerId="8503" CreationDate="2019-10-16T19:05:41.247" Score="3" ViewCount="68" Body="&lt;p&gt;Assume that a density matrix is given in its eigenbasis as &lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_{k}\lambda_k |k \rangle \langle k|.$$&lt;/span&gt; On page 19 of &lt;a href=&quot;https://arxiv.org/pdf/1405.4878.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, it states that the &lt;em&gt;Quantum Fisher Information&lt;/em&gt; is given as &lt;span class=&quot;math-container&quot;&gt;$$F_{Q}[\rho,A] = 2 \sum_{k,l}\frac{(\lambda_k-\lambda_l)^2}{\lambda_k + \lambda_l}|\langle k|A|l\rangle|^2$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: I might be missing something simple but can anyone see why, as stated in the paper, for pure states it follows that &lt;span class=&quot;math-container&quot;&gt;$$F_{Q}[\rho,A] = 4(\Delta A)^2?$$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any assistance. &lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2021-01-03T11:07:51.017" LastActivityDate="2021-01-03T11:07:51.017" Title="Quantum Fisher information for pure states query" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;&lt;quantum-fisher-information&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8503" PostTypeId="2" ParentId="8501" CreationDate="2019-10-16T23:19:40.657" Score="4" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\lambda_0 = 1$&lt;/span&gt; and the rest are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F_Q [\rho,A] = 2 \sum_{k,l} \frac{(\lambda_k-\lambda_l)^2}{\lambda_k + \lambda_l} | \langle k |A| l \rangle |^2\\&#xA;= 2 \sum_{k=0,l \neq 0} \frac{(1-0)^2}{1 + 0} | \langle 0 |A| l \rangle |^2 + 2 \sum_{k\neq 0,l = 0} \frac{(0-1)^2}{0 + 1} | \langle k |A| 0 \rangle |^2\\&#xA;= 4 \sum_{l \neq 0} | \langle l |A| 0 \rangle |^2\\&#xA;= 4 \sum_{l \neq 0} \langle 0 |A| l \rangle \langle l |A| 0 \rangle\\&#xA;= 4 \langle 0 |A \bigg( \sum_{l \neq 0} | l \rangle \langle l | \bigg) A| 0 \rangle\\&#xA;= 4 \langle 0 |A \bigg( \mathbb{I} - |0\rangle\langle 0| \bigg) A| 0 \rangle\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-10-16T23:19:40.657" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8504" PostTypeId="1" AcceptedAnswerId="13848" CreationDate="2019-10-17T03:30:55.553" Score="4" ViewCount="49" Body="&lt;p&gt;Density functional theory is based on the Hohenberg-Kohn (HK) theorems and aims to compute the ground-state many-body wavefunction of a physical material and/or molecules.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To put it simply, the HK theorems show that there is a unique one-to-one mapping between a many-body Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; (like you'd encounter in quantum chemistry or in the solid-state), and the electron density &lt;span class=&quot;math-container&quot;&gt;$\rho(\mathbf{r})$&lt;/span&gt;. This relationship is quite surprising, especially since you reduce the information of the wavefunction &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$3N$&lt;/span&gt; variables to a function of just &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The catch here is that extracting information from &lt;span class=&quot;math-container&quot;&gt;$\rho(\mathbf{r})$&lt;/span&gt; is quite difficult, and you can only really do it exactly if you know the exchange-correlation functional term &lt;span class=&quot;math-container&quot;&gt;$\frac{\delta E_{xc}[\rho]}{\delta \rho(\mathbf{r})}$&lt;/span&gt;, but no one knows what this functional looks like exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Do we know anything about the computational complexity of evaluating the exchange-correlation functional in either the classical or quantum computing cases?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2260" LastActivityDate="2020-09-20T20:24:08.027" Title="Do we know anything about the computational complexity of the exchange-correlation functional?" Tags="&lt;chemistry&gt;&lt;solid-state&gt;&lt;many-body-systems&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8505" PostTypeId="1" AcceptedAnswerId="8509" CreationDate="2019-10-17T08:43:46.387" Score="4" ViewCount="576" Body="&lt;p&gt;I would like to prepare the following initial state for variational quantum algorithms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sin\theta_1 \sin\theta_2 \sin\theta_3 |000\rangle + \sin\theta_1 \sin\theta_2 \cos\theta_3 |001\rangle + \sin\theta_1 \cos\theta_2 |010\rangle + \cos\theta_1 |100 \rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I make a circuit for this state from scratch?&#xA;Or is there any library to find a circuit to make this state such as Cirq or Qiskit? &lt;/p&gt;&#xA;" OwnerUserId="8673" LastEditorUserId="55" LastEditDate="2019-10-18T18:23:35.850" LastActivityDate="2019-10-20T16:57:38.977" Title="How to prepare a specific initial state of three qubits?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;cirq&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8506" PostTypeId="2" ParentId="8505" CreationDate="2019-10-17T10:22:48.000" Score="5" Body="&lt;p&gt;You can initialize a quantum state by using the &lt;code&gt;QuantumCircuit.initialize()&lt;/code&gt; function. For example, to initialize a circuit into the state |1&gt;, we can perform the initialization as follows :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vector = [0,1]&#xA;qr = QuantumRegister(1)&#xA;qc = QuantumCircuit(qr)&#xA;&#xA;qc.initialize(vector, [qr[0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There is more detail about how to use it in this &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/ebbf9100cab1ea3b21365ab34fdfb81c31b11bd3/qiskit/fundamentals/7_summary_of_quantum_operations.ipynb&quot; rel=&quot;noreferrer&quot;&gt;tutorial&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-10-17T10:22:48.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8507" PostTypeId="1" CreationDate="2019-10-17T14:20:24.183" Score="5" ViewCount="126" Body="&lt;p&gt;I am interested in learning more about the following: would it be possible for me to simulate a molecule consisting of copper ions through a quantum circuit? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if so, can that circuit allow me to measure the decoherence time of that molecule?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's an open-ended question, so any books, research papers, etc, would be much appreciated it.&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="26" LastEditDate="2019-10-20T17:28:26.757" LastActivityDate="2019-10-20T17:28:26.757" Title="Developing quantum circuits for specific quantum chemistry configurations" Tags="&lt;circuit-construction&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8508" PostTypeId="1" CreationDate="2019-10-17T14:32:06.973" Score="4" ViewCount="101" Body="&lt;p&gt;I'm trying to prove that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle j_2|\langle j_1| U(|0\rangle\!\langle0|\otimes\rho)U^\dagger|j_2\rangle|j_1\rangle&#xA;=\operatorname{Tr}(M_j\rho)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the density operator, &lt;span class=&quot;math-container&quot;&gt;$M_j=\frac{1}{2}|\psi_j\rangle\!\langle\psi_j|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = a|0\rangle\langle 0|+b|1\rangle \langle 1|$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$M = \frac{1}{2}|0\rangle\langle 0|+ \frac{1}{2}|1\rangle\langle 1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I got :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}(M_j\rho) = \mathrm{Tr}(\frac{1}{2} (a|0\rangle\langle 0|+b|1\rangle \langle 1|)) = \frac{1}{2}ab$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated &lt;span class=&quot;math-container&quot;&gt;$(|0⟩⟨0|\otimes \rho)$&lt;/span&gt; as well (a matrix of 4x4)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vert 0 \rangle \langle 0 \vert \otimes \rho =   &#xA;              \begin{pmatrix}&#xA;1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1/2 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp;0\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not sure though how to continue from here and apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the matrix.&lt;/p&gt;&#xA;" OwnerUserId="8793" LastEditorUserId="23" LastEditDate="2019-10-22T21:30:40.147" LastActivityDate="2019-10-22T21:30:40.147" Title="Proving $\langle j_2|\langle j_1| U(|0\rangle\!\langle0|\otimes\rho)U^\dagger|j_2\rangle|j_1\rangle =\operatorname{Tr}(M_j\rho)$" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8509" PostTypeId="2" ParentId="8505" CreationDate="2019-10-17T15:18:35.980" Score="4" Body="&lt;p&gt;If you call initialize in this case, you will be specifying a general state in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^8$&lt;/span&gt;. However what you have is more specialized. For example only having 4 nonzero amplitudes. So the call to initialize won't know this a priori. So it won't realize the initialization circuit can be decomposed easily. Or at least it will need to do some extra simplification steps before realizing this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to change &lt;span class=&quot;math-container&quot;&gt;$\sin$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos$&lt;/span&gt; from your state. You can fix this by changing the angles with appropriate angle redefinitions. &lt;span class=&quot;math-container&quot;&gt;$\theta \to \frac{\pi}{2}-\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \psi_1 \rangle = (\mathrm{R}(\theta_1) \otimes I_4) | 0 0 0 \rangle = \cos \theta_1 | 0 0 0 \rangle + \sin \theta_1 | 1 0 0 \rangle\\&#xA;| \psi_2 \rangle = (\mathrm{CR}(0,\theta_2) \otimes I_2) | \psi_1 \rangle = \cos \theta_1 \cos \theta_2 | 0 0 0 \rangle + \cos \theta_1 \sin \theta_2 | 0 1 0 \rangle + \sin \theta_1 | 1 0 0 \rangle\\&#xA;| \psi \rangle = \mathrm{CCR}(00,\theta_3) | \psi_2 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{R}(\theta)$&lt;/span&gt; is to indicate a 2 by 2 rotation matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{CR}(0,\theta)$&lt;/span&gt; is to indicate controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{R}(\theta)$&lt;/span&gt; on the second index but controlled on 0 instead of 1 on the first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{CCR}(00,\theta)$&lt;/span&gt; is to indicate controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{R}(\theta)$&lt;/span&gt; on the third index but controlled on 00 instead of 11 on the first two.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to fix the angles and get the controls back to normal from here.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="26" LastEditDate="2019-10-20T16:57:38.977" LastActivityDate="2019-10-20T16:57:38.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8510" PostTypeId="2" ParentId="8507" CreationDate="2019-10-17T17:07:53.447" Score="6" Body="&lt;p&gt;Since Google is one of, if not the, industry leaders in molecular simulation with quantum computers, their published work is a reasonable benchmark for what's presently within reach.  As you probably know, a few years ago Google &lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.6.031007&quot; rel=&quot;noreferrer&quot;&gt;reported&lt;/a&gt; (&lt;a href=&quot;https://ai.googleblog.com/2016/07/towards-exact-quantum-description-of.html&quot; rel=&quot;noreferrer&quot;&gt;commentary&lt;/a&gt;) successful electronic structure calculations for a Hydrogen atom, favoring the variational quantum eigensolver approach.  A lot has happened since then, but I haven't noticed much recently from Google on VQE (though &lt;a href=&quot;https://riverlane.io/news/accelerating-quantum-chemistry&quot; rel=&quot;noreferrer&quot;&gt;others&lt;/a&gt; are still actively working on VQE).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most recent &lt;a href=&quot;https://arxiv.org/pdf/1902.02134.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; from Google uses phase estimation performed on a quantum walk to simulate &lt;a href=&quot;https://en.wikipedia.org/wiki/FeMoco&quot; rel=&quot;noreferrer&quot;&gt;FeMoco&lt;/a&gt;.  This simulation requires &lt;span class=&quot;math-container&quot;&gt;$8 \times 10^{10}$&lt;/span&gt; Toffoli gates (best case) and about three million qubitweeks of state distillation (a 700x improvement over the previous approach).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an unsatisfactory answer, but obviously the complexity of Copper ions lies somewhere between a Hydrogen atom (feasible) and FeMoco (not yet feasible), though I'm not sure how to quantify where it falls in that spectrum.  The recent Google paper has an up-to-date list of references for further reading on the topic.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-17T17:50:35.870" LastActivityDate="2019-10-17T17:50:35.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8511" PostTypeId="1" CreationDate="2019-10-17T19:02:55.577" Score="9" ViewCount="1343" Body="&lt;p&gt;I am having some trouble understanding why a SWAP test would work. I meant I read that and understood the concepts as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If the two input states are equal, the output register always results&#xA;in a state of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; outcome will be obtained when applying a READ to this register. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;However, as the two inputs become increasingly more different, the&#xA;probability of READing a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; outcome in the output register decreases&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;But my question is why?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I meant how can a third qubit being &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; assure us about the probabilities of them being the same or different? It could only tell us if they are swapped or not.&lt;/p&gt;&#xA;" OwnerUserId="8796" LastEditorUserId="55" LastEditDate="2021-05-11T10:56:17.850" LastActivityDate="2021-05-11T10:56:17.850" Title="How and why does swap test works?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;swap-test&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8513" PostTypeId="2" ParentId="8511" CreationDate="2019-10-17T21:10:05.223" Score="8" Body="&lt;h2&gt;What that cSWAP test does (and doesn't) do&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The important thing about the controlled-SWAP test is that what it does &lt;em&gt;isn't&lt;/em&gt; just to SWAP, or to not SWAP, the two inputs. The controlled-SWAP test involves a control qubit which is in a &lt;em&gt;superposition&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}\def\bra#1{\langle#1\rvert}\ket{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;: that is, we measure the first qubit of the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{cSWAP} \,\Bigl(\ket{+} \otimes \ket{\alpha} \otimes \ket{\beta}\Bigr)$$&lt;/span&gt;&#xA;in the basis &lt;span class=&quot;math-container&quot;&gt;$\ket{+}, \ket{-}$&lt;/span&gt;; or to put it in a different way, we measure the first qubit of the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \bigl(H \otimes \mathbf 1 \otimes \mathbf 1\bigr)\,\mathrm{cSWAP}\,\bigl(H \otimes \mathbf 1 \otimes \mathbf 1\bigr) \,\Bigl(\ket{0} \otimes \ket{\alpha} \otimes \ket{\beta}\Bigr)$$&lt;/span&gt;&#xA;in the standard basis, to obtain information about how similar &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta}$&lt;/span&gt; are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we do this? Because what this does is to measure &lt;em&gt;how symmetric&lt;/em&gt; the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha} \otimes \ket{\beta}$&lt;/span&gt; is.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The cSWAP test as a simulated two-qubit measurement&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The SWAP operator is Hermitian: that is, it has eigenvalues &amp;pm;1. Obviously, any state of the form &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha} \otimes \ket{\alpha}$&lt;/span&gt; is a +1 eigenstate: these span a space of dimension 3, which is spanned by &lt;span class=&quot;math-container&quot;&gt;$\ket{0}\ket{0}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{1}\ket{1}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\ket{+}\ket{+}$&lt;/span&gt; &amp;mdash; or, equivalently, &lt;span class=&quot;math-container&quot;&gt;$\ket{00}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{11}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\tfrac{1}{\sqrt 2}\bigl(\ket{01} + \ket{10}\bigr)$&lt;/span&gt;. The remaining state orthogonal to this space is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ket{\Psi^-} = \tfrac{1}{\sqrt 2}\bigl(\ket{01} - \ket{10}\bigr)$$&lt;/span&gt;&#xA;which, up to scalar factors, we can equivalently write as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ket{\Psi^-} \propto \tfrac{1}{\sqrt 2}\bigl(\ket{\alpha}\ket{\alpha^\perp} - \ket{\alpha^\perp}\ket{\alpha}\bigr) \,.$$&lt;/span&gt;&#xA;What the controlled-SWAP test does is to simulate a measurement of &lt;span class=&quot;math-container&quot;&gt;$\bigl\{ \Pi_{\textrm{sym}}, \ket{\Psi^-}\!\bra{\Psi^-} \bigr\}$&lt;/span&gt; on the two qubits, where &lt;span class=&quot;math-container&quot;&gt;$\Pi_{\textrm{sym}}$&lt;/span&gt; is the projector onto the span of all symmetric states &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}\ket{\alpha}$&lt;/span&gt; described above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, the cSWAP test simulates measurement of the SWAP operator as an &lt;em&gt;observable&lt;/em&gt; (as opposed to a unitary transformation). The SWAP operator has eigenvalues &amp;pm;1, after all &amp;mdash; in principle, we can measure the two qubits to see whether they are (or they collapse to) a +1 eigenstate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that the cSWAP test does this is by using cSWAP in place of SWAP, to realise a phase kick, from the two qubits acted on up to the control.&#xA;For the eigenstates of SWAP, this records the eigenvalue in the phase of the control; performing a Hadamard then converts this information into a &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; (for symmetric states) or a &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; (for the antisymmetric state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^-}$&lt;/span&gt;). More generally, it collapses the target states either to the symmetric subspace, or the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^-}$&lt;/span&gt;.&#xA;The procedure is literally performing a measurement of how symmetric (or antisymmetric) the state is, and producing the result &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; with some probability accordingly.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The maximum probability of failing the cSWAP test&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Considering the procedure in this way, it's easy to see that the maximum probability of obtaining the outcome &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt; is 0.5: this is the probability of the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}\ket{\alpha^\perp}$&lt;/span&gt; collapsing to the antisymmetric state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^-} \propto \tfrac{1}{\sqrt 2}\bigl(\ket{\alpha}\ket{\alpha^\perp} - \ket{\alpha^\perp}\ket{\alpha}\bigr)$&lt;/span&gt;, upon measurement.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-10-18T08:40:20.633" LastActivityDate="2019-10-18T08:40:20.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8514" PostTypeId="2" ParentId="8511" CreationDate="2019-10-18T07:37:57.163" Score="7" Body="&lt;p&gt;The key to understanding many quantum protocols and circuits is in the following circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NPdxT.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NPdxT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is especially true in the case where &lt;span class=&quot;math-container&quot;&gt;$U^2=I$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt;. You can readily calculate that if the input, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, of the second qubit has an amplitude &lt;span class=&quot;math-container&quot;&gt;$\alpha_+$&lt;/span&gt; for being supported on the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, then at the end of the algorithm, the probability of the first qubit being in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state is &lt;span class=&quot;math-container&quot;&gt;$|\alpha_+|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, consider the case of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; being swap. Swapping twice is certainly the identity, so swap has &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; eigenvalues. You'll also agree that two copies of the same state, when swapped, are the same as the input, so they correspond to a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalue.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}\cdot|\psi\rangle|\psi\rangle=|\psi\rangle|\psi\rangle&#xA;$$&lt;/span&gt;&#xA;The more different the two input states, the greater the difference between the input and the output of the swap, i.e. the less support there is on the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace there is, and the more likely you are to get the 1 outcome on measurement:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle|\phi\rangle=\frac{1}{2}(|\psi\rangle|\phi\rangle+|\phi\rangle|\psi\rangle)+\frac{1}{2}(|\psi\rangle|\phi\rangle-|\phi\rangle|\psi\rangle)&#xA;$$&lt;/span&gt;&#xA;In the equation above, I've split the input state into two terms: those from the symmetric (+1 eigenvalue) subspace and those from the antisymmetric (-1 eigenvalue) subspace. The lengths of the two vectors convey the probability amplitudes for being found in either subspace.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-10-18T09:39:18.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8515" PostTypeId="1" AcceptedAnswerId="8516" CreationDate="2019-10-18T12:41:39.357" Score="3" ViewCount="49" Body="&lt;p&gt;On page 1 of &lt;a href=&quot;https://arxiv.org/abs/1908.05047&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; it states that the QFI (&lt;em&gt;Quantum Fisher Information&lt;/em&gt;) for pure states &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{Q}(\psi) = \sum_{i,j=1}^n\text{Tr}(X_iX_j\psi)-\text{Tr}(X_i \psi)\text{Tr}(X_j \psi)~~~~~~~~~~(3)$$&lt;/span&gt;&#xA;Further down it states: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is clear from Eq. (3) that if the generators are chosen from the Pauli group such that there are no stabilizers of the form &lt;span class=&quot;math-container&quot;&gt;$\pm X_i$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-X_iX_j$&lt;/span&gt;, then the QFI of the stabilizer state is equal to the number of stabilizers of the form &lt;span class=&quot;math-container&quot;&gt;$X_iX_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How does this conclusion follows from equation (3)? What I get as a start is that if &lt;span class=&quot;math-container&quot;&gt;$X_iX_j$&lt;/span&gt; are stabilizers then &lt;span class=&quot;math-container&quot;&gt;$$\sum_{i,j=1}^n[\text{Tr}(X_iX_j\psi)-\text{Tr}(X_i \psi)\text{Tr}(X_j \psi)] = \sum_{i,j=1}^n[1-\text{Tr}(X_i \psi)\text{Tr}(X_j \psi)]$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2021-01-03T11:07:33.830" LastActivityDate="2021-01-03T11:07:33.830" Title="Stabilizer state QFI lower limit query" Tags="&lt;pauli-gates&gt;&lt;stabilizer-state&gt;&lt;quantum-fisher-information&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8516" PostTypeId="2" ParentId="8515" CreationDate="2019-10-18T12:47:33.287" Score="4" Body="&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; (this is denoting the density matrix, even though it's a pure state) can be described as a sum of all the products of the stabilizers. We are promised that &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt; is not in the stabilizer, so &lt;em&gt;every&lt;/em&gt; term in the sum of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, when multiplied by &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt;, returns a tensor product of terms that is not just identity. Hence, it has zero trace. Thus, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(X_i\psi)=0$&lt;/span&gt;, and you are just left with &lt;span class=&quot;math-container&quot;&gt;$\sum 1$&lt;/span&gt;, where the sum is taken over all stabilizers of the form &lt;span class=&quot;math-container&quot;&gt;$X_iX_j$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-18T12:47:33.287" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8517" PostTypeId="1" CreationDate="2019-10-18T14:57:05.257" Score="4" ViewCount="126" Body="&lt;p&gt;I'm new to Quantum Error Correction, and I have a question on Shor's Code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have a protected subspace, &lt;span class=&quot;math-container&quot;&gt;$V \subset \mathbf{C}^2\otimes \cdots \otimes \mathbf{C}^2$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$V=\operatorname{span}\{|0_{l}\rangle, |1_{L}\rangle.$&lt;/span&gt; We also consider Pauli basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{C}^2\otimes \cdots \otimes \mathbf{C}^2$&lt;/span&gt; of 9 copies, and constructed as follows: Take the basis of &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; consisting of: &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray} \nonumber&#xA;X=\begin{pmatrix}&#xA;0 &amp;amp; 1\\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}, &#xA;Y= \begin{pmatrix}&#xA;0 &amp;amp; i \\&#xA;-i &amp;amp; 0&#xA;\end{pmatrix}, Z=\begin{pmatrix}&#xA;1 &amp;amp; 0\\ &#xA;0 &amp;amp; -1&#xA;\end{pmatrix} &amp;amp; \text{and} &amp;amp;  1_2. &#xA;\end{eqnarray}&lt;/span&gt;&#xA;We list the 1-Paulis as &lt;span class=&quot;math-container&quot;&gt;$U_1,\cdots ,U_{28}.$&lt;/span&gt; &#xA;Define the error map as &lt;span class=&quot;math-container&quot;&gt;$\mathscr{E}:M_{2^9}\rightarrow M_{2^9}$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\mathscr{E}(X)=\frac{1}{28}\sum_{i=1}^{28}U_iXU_i^*$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\mathscr{E}$&lt;/span&gt; is completely positive and trace preserving. How do we say that it satisfies the Knill Laflamme Theorem and thus ensure the existence of a recovery operator? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://math.stackexchange.com/q/3399751/173147&quot;&gt;Cross-posted on math.SE&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8801" LastEditorUserId="55" LastEditDate="2021-01-02T11:57:20.940" LastActivityDate="2021-01-02T11:57:20.940" Title="Shor's Code: Understanding how it satisfies Knill Laflamme Theorem" Tags="&lt;error-correction&gt;&lt;optical-quantum-computing&gt;&lt;quantum-optics&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8518" PostTypeId="1" CreationDate="2019-10-19T08:30:19.263" Score="6" ViewCount="215" Body="&lt;p&gt;I have recently listened to a talk on quantum computing and was fascinated to learn about IBM Q Experience. Between the explanations in the User Guide and in Nielsen's book, I came to the following question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why does a controlled gate not act as a measurement?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FD1sc.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FD1sc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the common example of creating a Bell pair, we first bring a two qubit state from &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle = |00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} (|00\rangle + |10\rangle)$&lt;/span&gt; with a Hadamard gate. So far so good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But now we flip the second qubit only if the first is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This turns the state of the two-qubit system into &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}} (|00\rangle + |11\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does that work without measuring the state of the first qubit?&lt;/p&gt;&#xA;" OwnerUserId="8161" LastActivityDate="2019-10-19T19:43:27.733" Title="Why does a controlled gate not constitute a measurement?" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8519" PostTypeId="2" ParentId="8493" CreationDate="2019-10-19T09:08:22.697" Score="1" Body="&lt;p&gt;Quantum computers are not just the &quot;conventional computer killer&quot; or a speedy replacement for the conventional computers as you might have assumed in your question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, some classical tasks that are well suited to quantum computers. They run them really well in a much lesser time. This is because they are able to crunch large numbers using a small number of operations as you have discussed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this is not the only use case. The real strength of the quantum computers is to perform the tasks that are quite impossible to achieve on traditional computers. Considering the the most modest example, you cannot generate a truly random number on any conventional hardware. That's why they are called as Pseudo Random Number Generators. However for a quantum computer it is an astonishingly simple process. Similarly when we try to emulate natural processes (e.g behavior of subatomic particles) with traditional bits it not only lacks perfection but also computationally expensive. It is very convinient to perform such computations on a quantum computer as underlying physical objects representing qubits somehow &lt;em&gt;do the math&lt;/em&gt; for you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, quantum computers are not a complete replacement for traditional computers (not just yet) but they help us broadening the kinds of problems tractable within computing. &lt;/p&gt;&#xA;" OwnerUserId="8796" LastActivityDate="2019-10-19T09:08:22.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8520" PostTypeId="2" ParentId="8518" CreationDate="2019-10-19T15:01:05.787" Score="0" Body="&lt;p&gt;A mechanistic way of looking at it that is sure to infuriate any genuine physicists in the discussion :) is that a CNOT is two supercooled transmons interacting as described in the &lt;a href=&quot;https://arxiv.org/abs/1809.03452&quot; rel=&quot;nofollow noreferrer&quot;&gt;Open Pulse&lt;/a&gt; documentation and that the mystical &quot;observation&quot; does not occur until there is an interaction outside that environment.&lt;/p&gt;&#xA;" OwnerUserId="7744" LastActivityDate="2019-10-19T15:01:05.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8521" PostTypeId="2" ParentId="8518" CreationDate="2019-10-19T19:36:29.693" Score="4" Body="&lt;p&gt;How it works depends on the choice of quantum system used for computation.  For any choice of quantum system, the common theme is that &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; does not collapse the wavefunction, i.e. force a choice between &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;, while a measurement does.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example (oversimplified here) uses a non-linear Kerr medium to create a &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; gate with two photons acting as qubits.  In this case a Hadamard gate (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;) is created with phase shifters (slabs of transparent media with index of refraction &lt;span class=&quot;math-container&quot;&gt;$\ne 1$&lt;/span&gt;) and beam splitters (partially silvered glass), which produce the superposition of states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Kerr effect is a change in refractive index based on the presence of an electric field in the Kerr medium, and when two photons pass through a Kerr medium they can experience cross-phase modulation.  In other words the atoms in the Kerr medium mediate an interaction between the two photons (qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The upshot is that the system can be tuned such that the Kerr medium acts as the gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K = \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \end{bmatrix}.$$&lt;/span&gt;&#xA;With access to &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; gate (&lt;span class=&quot;math-container&quot;&gt;$U_c$&lt;/span&gt;) is simply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_c = (I \otimes H) K (I \otimes H) = \begin{bmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{bmatrix}.$$&lt;/span&gt;&#xA;In this manner the &lt;span class=&quot;math-container&quot;&gt;$U_c$&lt;/span&gt; gate is implemented without collapsing the wavefunction.  Conversely, when a photon interacts with a photon detector (measurement) it is absorbed and converted to current or voltage, collapsing the wavefunction and forcing it to choose one definite state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As noted above, this is an oversimplified explanation.  Since you already have Nielsen and Chuang, you can see a much more rigorous treatment of this example in Section 7.4.2, as well as constructions  of &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; in the context of ion traps (7.6.3) and nuclear magnetic resonance (7.7.3).&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-19T19:43:27.733" LastActivityDate="2019-10-19T19:43:27.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8522" PostTypeId="1" CreationDate="2019-10-19T21:22:40.797" Score="5" ViewCount="155" Body="&lt;p&gt;I would like to know if there's an analog for Schmidt rank that can tell me if a two-qubit unitary is entangling?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a parametrized two-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U^{(2)}(\theta)$&lt;/span&gt;. I would like to know a test to tell the degree of entanglement this gate produces, ideally as a function of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, given the following matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ A =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; e^{i\theta} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -e^{i\theta} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the test should tell me that that &lt;span class=&quot;math-container&quot;&gt;$A \propto Z \otimes R_z(\theta)$&lt;/span&gt; is &lt;strong&gt;not&lt;/strong&gt; entangling. But given the matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; e^{-i\theta} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\theta} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;the test should tell me that &lt;span class=&quot;math-container&quot;&gt;$B = CR_z(\theta)$&lt;/span&gt; &lt;strong&gt;is&lt;/strong&gt; entangling (provided &lt;span class=&quot;math-container&quot;&gt;$\theta \neq 0$&lt;/span&gt;). In the best case, the test would yield some degree of entanglement as a function of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; though such a metric may depend on the initial state instead of just the gate...&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="26" LastEditDate="2019-10-20T17:16:24.543" LastActivityDate="2019-10-20T18:38:47.150" Title="How to check if a two-qubit gate is entangling?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8523" PostTypeId="1" AcceptedAnswerId="8533" CreationDate="2019-10-20T11:58:22.907" Score="4" ViewCount="80" Body="&lt;p&gt;Given the Hermitian Pauli group products &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Omega_{a,b}=\{\pm 1,\pm i\}_{a,b}\cdot \{I,X,Y,Z\}_{a,b}^{\otimes n}&#xA;$$&lt;/span&gt;&#xA;composed of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 2x2 pauli matrices &lt;span class=&quot;math-container&quot;&gt;$(I,X,Y,Z)$&lt;/span&gt; in tensor product, such that they span a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; matrix space, and &lt;span class=&quot;math-container&quot;&gt;$a,b=0,1,\cdots , 2^n-2, 2^n-1$&lt;/span&gt;, does there exist a reference for their matrix index representation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Omega_{a,b} = \sum_{k=0}^{2^n-1}\sum_{l=0}^{2^n-1}A_{a,b,k,l}\left|k\right&amp;gt;\left&amp;lt;l\right|&#xA;$$&lt;/span&gt;&#xA;to find the complex coefficients &lt;span class=&quot;math-container&quot;&gt;$A_{a,b,k,l}$&lt;/span&gt;, where I write them using bras and kets, and matrix multiplication&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Omega_{a,b}\Omega_{g,h}=f_{a,b,g,h,u,v}\Omega_{u,v}&#xA;$$&lt;/span&gt;&#xA;to find the complex structure constants &lt;span class=&quot;math-container&quot;&gt;$f_{a,b,g,h,u,v}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen references, such as &lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph229/notes/chap7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ZX&lt;/a&gt;, that use &lt;span class=&quot;math-container&quot;&gt;$\Omega_{a,b}\approx Z^aX^b$&lt;/span&gt; notation, but those representations are never scaled by complex values to ensure they are Hermitian, nor have I seen an explicit matrix index representation for them.&lt;/p&gt;&#xA;" OwnerUserId="8812" LastEditorUserId="26" LastEditDate="2019-10-20T16:58:54.190" LastActivityDate="2019-10-21T06:57:55.723" Title="Matrix Index and multiplication rules for Hermitian Pauli group products" Tags="&lt;mathematics&gt;&lt;error-correction&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8524" PostTypeId="1" CreationDate="2019-10-20T17:15:03.743" Score="3" ViewCount="59" Body="&lt;p&gt;I'm trying to understand an entanglement swapping derivation provided in &lt;a href=&quot;https://physics.bgu.ac.il/COURSES/QuantumMechCohen/Contributions/jarondl.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this PDF&lt;/a&gt; (pages 2 - 3)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several things about this process that I don't understand, and I was hoping someone could clarify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Are the CNOT and Hadamard gates applied with respect to the &lt;span class=&quot;math-container&quot;&gt;$A_c$&lt;/span&gt; bit? If so, am I correct in this math (starting from the same joint state given in the PDF)?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{2}(|0_C0_{Ac}\rangle + |1_C1_{Ac}\rangle) \otimes (|0_A0_{B}\rangle + |1_A1_{B}\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{2}(|0_C0_{Ac}0_A0_B\rangle + |0_C0_{Ac}1_A1_B\rangle + |1_C1_{Ac}0_A0_B\rangle + |1_C1_{Ac}1_A1_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying CNOT using &lt;span class=&quot;math-container&quot;&gt;$Ac$&lt;/span&gt; as control bit and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as target:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CNOT}|\psi\rangle = \frac{1}{2}(|0_C0_{Ac}0_A0_B\rangle + |0_C0_{Ac}1_A1_B\rangle + |1_C1_{Ac}1_A0_B\rangle + |1_C1_{Ac}0_A1_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying Hadamard onto &lt;span class=&quot;math-container&quot;&gt;$Ac$&lt;/span&gt; bit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{H}.\mathrm{CNOT}|\psi\rangle = \frac{1}{2}(|0_C\rangle\otimes\frac{1}{\sqrt{2}}(|0_{Ac}\rangle + |1_{Ac}\rangle)\otimes|0_A0_B\rangle + |0_C\rangle\otimes\frac{1}{\sqrt{2}}(|0_{Ac}\rangle + |1_{Ac}\rangle)\otimes|1_A1_B\rangle + |1_C\rangle\otimes\frac{1}{\sqrt{2}}(|0_{Ac}\rangle - |1_{Ac}\rangle)\otimes|1_A0_B\rangle + |1_C\rangle\otimes\frac{1}{\sqrt{2}}(|0_{Ac}\rangle - |1_{Ac}\rangle)\otimes|0_A1_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Grouping and factoring, I end up with the following, which is different from the PDF derivation (and I'm not sure why):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{H}.\mathrm{CNOT}|\psi\rangle = \frac{1}{2\sqrt{2}}|0_{Ac}0_A\rangle \otimes (|0_{C}0_B\rangle + |1_{C}1_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$+ \frac{1}{2\sqrt{2}}|0_{Ac}1_A\rangle \otimes (|0_{C}1_B\rangle + |1_{C}0_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$+ \frac{1}{2\sqrt{2}}|1_{Ac}0_A\rangle \otimes (|0_{C}0_B\rangle - |1_{C}1_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$+ \frac{1}{2\sqrt{2}}|1_{Ac}1_A\rangle \otimes (|0_{C}1_B\rangle - |1_{C}0_B\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this final answer, as I understand it, if Alice has bits &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;, then Carol and Bob have the entangled bell state &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;; if Alice has &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, then Carol and Bob have entangled bell state &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;; if Alice has &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;, then Carol and Bob have entangled bell state &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt;, and lastly, if Alice has bits &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;, then Carol and Bob have entangled bell state &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is the general idea here that we're teleporting Carol's bit across Alice's entangled bits to then end up entangling Carol and Bob?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8568" LastEditorUserId="26" LastEditDate="2019-10-20T17:20:51.053" LastActivityDate="2019-10-20T17:20:51.053" Title="Understanding shared Bell states from quantum entanglement" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8525" PostTypeId="1" AcceptedAnswerId="8526" CreationDate="2019-10-20T18:14:46.250" Score="2" ViewCount="513" Body="&lt;p&gt;As I understand it, you can transform the different Bell states into one another by applying various gates. Wikipedia has the Bell states written out as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VDFMR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VDFMR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And says that you can generate bell states 2, 3, and 4 from bell state 1 by applying Pauli gates as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y7hOH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y7hOH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the Z gate simply flips the sign in the middle, so I can see how applying that to bell state 1 generates bell state 2. &lt;strong&gt;However, I don't get how applying the X/CNOT gate to bell state 1 generates bell state 3.&lt;/strong&gt; Shouldn't the output of that be &lt;span class=&quot;math-container&quot;&gt;$|00 \rangle + |10 \rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|01 \rangle + |10 \rangle$&lt;/span&gt;, since the control qubit is 0 in the first half?&lt;/p&gt;&#xA;" OwnerUserId="8568" LastEditorUserId="26" LastEditDate="2019-10-20T18:30:04.967" LastActivityDate="2019-10-20T18:30:04.967" Title="Transforming the first Bell state into the other Bell states" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8526" PostTypeId="2" ParentId="8525" CreationDate="2019-10-20T18:26:24.130" Score="5" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; is not equivalent to a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; gate. The former is a 1-qubit gate whereas the 2nd is a 2-qubit gate (in essence, a &lt;strong&gt;controlled&lt;/strong&gt;-&lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt;). The &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; basically flips the state of qubit B i.e., &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_B\to|1\rangle_B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\to|0\rangle_B$&lt;/span&gt;, and does not depend on the state of qubit A. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-10-20T18:26:24.130" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8527" PostTypeId="2" ParentId="8522" CreationDate="2019-10-20T18:38:47.150" Score="4" Body="&lt;p&gt;The metric you're looking for is known as &lt;strong&gt;entangling power&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some references:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.89.012324&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entangling power of two-qubit gates on mixed states (Guan &lt;em&gt;et al.&lt;/em&gt;, 2014)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1751-8121/aad7cb/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entangling power of two-qubit unitary operations (Yi Shen &amp;amp; Lin Chen, 2018)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I will expand on this later. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-10-20T18:38:47.150" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8528" PostTypeId="1" AcceptedAnswerId="8529" CreationDate="2019-10-20T18:40:50.500" Score="6" ViewCount="168" Body="&lt;p&gt;For the &lt;span class=&quot;math-container&quot;&gt;$|W_3\rangle=\frac{1}{\sqrt{3}}(|001\rangle+|010\rangle+|100\rangle)$&lt;/span&gt;, what does W stand for? Does it refer to an author name? Anyone knows a reference? Thanks&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="55" LastEditDate="2019-10-22T10:35:34.423" LastActivityDate="2019-10-22T10:35:34.423" Title="What does W stand for in the W entangled state?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;resource-request&gt;&lt;history&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8529" PostTypeId="2" ParentId="8528" CreationDate="2019-10-21T00:37:51.517" Score="5" Body="&lt;p&gt;Apparently &lt;span class=&quot;math-container&quot;&gt;$\vert W \rangle$&lt;/span&gt; was first reported (and the naming convention first adopted) by Dür, Vidal and Cirac in this &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005115&quot; rel=&quot;nofollow noreferrer&quot;&gt;preprint&lt;/a&gt; on May 26, 2000 (version 1 of 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is supported by the footnote on page 4 of this &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9908073&quot; rel=&quot;nofollow noreferrer&quot;&gt;preprint&lt;/a&gt; on June 25, 2000 (version 3 of 3, this footnote did not appear in the earlier versions), which states (in part)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Very recently Dürr [&lt;em&gt;sic&lt;/em&gt;], Vidal, and Cirac (LANL eprint quantph/0005115)&#xA;  have found a tripartite pure state of 3 qubits which is stochastically&#xA;  incomparable with the GHZ state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Dür, Vidal and Cirac don't explicitly ascribe any special significance to the notational choice &lt;span class=&quot;math-container&quot;&gt;$\vert W \rangle$&lt;/span&gt;, so it seems that only the authors could say with any confidence whether &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; has any significance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; The lead author's first initial is W. (for Wolfgang), which is plausible motivation for the notation &lt;span class=&quot;math-container&quot;&gt;$\vert W \rangle$&lt;/span&gt;, but I'm not aware of any evidence to support this.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-22T00:47:34.923" LastActivityDate="2019-10-22T00:47:34.923" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8531" PostTypeId="1" CreationDate="2019-10-21T05:50:06.480" Score="4" ViewCount="92" Body="&lt;p&gt;I am new to the field of quantum algorithms. It is well known that quantum algorithms offer a speedup over classical algorithms in some problems. Regarding the problems in which quantum algorithms offer a speed up, I need to know the problems that don't yet have a quantum algorithm for them. Is there any kind of website that offers such problems that need quantum algorithms?&lt;/p&gt;&#xA;" OwnerUserId="8817" LastEditorUserId="26" LastEditDate="2019-10-21T13:15:36.717" LastActivityDate="2019-10-21T13:15:36.717" Title="Open problems in quantum algorithms" Tags="&lt;algorithm&gt;&lt;resource-request&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8532" PostTypeId="2" ParentId="8508" CreationDate="2019-10-21T06:46:08.160" Score="3" Body="&lt;p&gt;In the following I'm assuming you're talking about a two-qubit system. You don't explicitly say, but I infer from the calculation you're showing. If not, this can all be generalised easily enough...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would start by writing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle j_2|\langle j_1| U(|0\rangle\!\langle0|\otimes\rho)U^\dagger|j_2\rangle|j_1\rangle=\text{Tr}\left(U(|0\rangle\!\langle0|\otimes\rho)U^\dagger|j_2\rangle\langle j_2|\otimes|j_1\rangle\langle j_1|\right).&#xA;$$&lt;/span&gt;&#xA;If it's not clear to you why that's correct, work backwards - when you take the trace you can sum over any orthonormal basis. Just pick any basis such that &lt;span class=&quot;math-container&quot;&gt;$|j_2\rangle|j_1\rangle$&lt;/span&gt; is a member of that basis, so all other elements are orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I can use the cyclic properties of the trace to move the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\left((|0\rangle\!\langle0|\otimes\rho)U^\dagger|j_2\rangle\langle j_2|\otimes|j_1\rangle\langle j_1|U\right)&#xA;$$&lt;/span&gt;&#xA;Next, define &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=U^\dagger|j_2\rangle|j_1\rangle$&lt;/span&gt;, so this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\left((|0\rangle\!\langle0|\otimes\rho)|\Psi\rangle\langle \Psi|\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I can perform the trace by first applying the partial trace on the first qubit, and then the trace on the second qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\text{Tr}_1\left((|0\rangle\!\langle0|\otimes\rho)|\Psi\rangle\langle \Psi|\right)=\text{Tr}\left(\rho\cdot\text{Tr}_1\left((|0\rangle\!\langle0|\otimes I)|\Psi\rangle\langle \Psi|\right)\right).&#xA;$$&lt;/span&gt;&#xA;So, if we define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\text{Tr}_1\left((|0\rangle\!\langle0|\otimes I)|\Psi\rangle\langle \Psi|\right),&#xA;$$&lt;/span&gt;&#xA;then the answer is expressed as &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(M\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, we can certainly write (without knowing anything more about it) that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\alpha|0\rangle|\phi_0\rangle+\beta|1\rangle|\phi_1\rangle,&#xA;$$&lt;/span&gt;&#xA;for an arbitrary pair of single-qubit states &lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle,|\phi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;, which would mean that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=|\alpha|^2|\phi_0\rangle\langle\phi_0|.&#xA;$$&lt;/span&gt;&#xA;If you want it to be the more specific form given in the question (&lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2=\frac12$&lt;/span&gt;), then you need more information about &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-21T06:46:08.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8533" PostTypeId="2" ParentId="8523" CreationDate="2019-10-21T06:57:55.723" Score="4" Body="&lt;p&gt;If you write &lt;span class=&quot;math-container&quot;&gt;$Z^aX^b$&lt;/span&gt;, there's an implicit &quot;add a phase &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; to make it Hermitian if necessary&quot;, although I guess there are a couple of different conventions you might use the determine the sign used. So long as you're clear about the convention it doesn't really matter because you've got the extra &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; freedom to add in to adjust for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for an explicit matrix index representation,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_{a,b,k,l}=i^{a\cdot b}(-1)^{a\cdot k}\delta_{b\oplus l=k}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is the kronecker delta. Here I've chosen a slightly different convention for introducing the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; which makes the representation easier to write down: wherever there's a pair &lt;span class=&quot;math-container&quot;&gt;$ZX$&lt;/span&gt;, assume it's &lt;span class=&quot;math-container&quot;&gt;$iZX=Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to work out the effect of the product of two terms, you could do it long-hand, but I think it's easier to work it our with the Pauli operators first and translate it back:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z^aX^bZ^gX^h=(-1)^{b\cdot g}Z^aZ^gX^bX^h=(-1)^{b\cdot g}Z^{a\oplus g}X^{b\oplus h}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-21T06:57:55.723" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8534" PostTypeId="2" ParentId="8517" CreationDate="2019-10-21T07:13:32.007" Score="2" Body="&lt;p&gt;Strictly, what you have to calculate is that for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0_L|U_iU_j|1_L\rangle=0&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0_L|U_iU_j|0_L\rangle=\langle 1_L|U_iU_j|1_L\rangle.&#xA;$$&lt;/span&gt;&#xA;(I've ignored the Hermitian conjugate because all the single-qubit errors are Hermitian.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously there's a lot of work involved in calculating all &lt;span class=&quot;math-container&quot;&gt;$28^2$&lt;/span&gt; cases of &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt;. You can at least simplify this by using symmetry - there's permutation invariance within blocks of three qubits and between blocks of three qubits. This means that you can reduce your work to two sets of cases: (i) two Pauli errors on the same block of 3 qubits (of which there are &lt;span class=&quot;math-container&quot;&gt;$9^2$&lt;/span&gt; cases, but we can take the two errors to be on the first two qubits, or two on the first, reducing to &lt;span class=&quot;math-container&quot;&gt;$3+3^2$&lt;/span&gt; cases) and (ii) one Pauli error on each of 3 qubits (of which there are &lt;span class=&quot;math-container&quot;&gt;$9^2$&lt;/span&gt; cases, but we can assume the errors are on the first qubit of each block, reducing to &lt;span class=&quot;math-container&quot;&gt;$3^2$&lt;/span&gt; cases). 21 error combinations is a much more tolerable calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could I also recommend finding out about the stabilizer formalism as applied to error correcting codes? This places the calculation in a completely different light which is much more convenient.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-21T07:13:32.007" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8535" PostTypeId="1" CreationDate="2019-10-21T09:38:22.930" Score="2" ViewCount="62" Body="&lt;p&gt;Suppose in &quot;near future&quot; that we have quantum computers with thousands of qubits that can run Grover, HHL, and so on. Then, can we hope in the &quot;near future&quot; to have some web application that will run quantum algorithms in real-time?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose Google or IBM with their quantum computers have a web application. A client sends a request on this application, therefore a classical computer analyses the request and detects an inversion of a huge matrix (that satisfied the HHL conditions). Then the classical computer sends the matrix to the quantum computer that solves instantly the problem with the HHL algorithms and returns the result to the classical computer. Finally, the classical computer sends back the result to the client. All this in a few milliseconds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this example possible or will we have only applications like on the IBMQ that take some hours to be handled?&lt;/p&gt;&#xA;" OwnerUserId="7762" LastEditorUserId="55" LastEditDate="2019-10-22T10:37:20.997" LastActivityDate="2019-10-22T10:37:20.997" Title="Can we hope in the near future to have web apps running quantum algorithms in real-time?" Tags="&lt;applications&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8536" PostTypeId="1" CreationDate="2019-10-21T09:45:57.923" Score="5" ViewCount="111" Body="&lt;p&gt;&lt;strong&gt;Entanglement in Algorithms&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most algorithms in quantum computing find their strength in making use of entanglement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in evaluating the amount of entanglement generated within an algorithm, maybe even being able to think of knowing how this information changes for different numbers of runs of the algorithm or if the algorithm is run on different numbers of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How would one best do this?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My thoughts are to calculate the density matrix of the computational qubits at every time step and to find the von Neumann entropy of this multipartite state and work from there but it appears that there are many different kinds of entanglement measures useful for different kinds of situations&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0504163.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt; [1]&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take Shor's factoring algorithm for example. How would you go about calculating the entanglement at each time step? I have found two approaches thus far, &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0510042.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt; which takes into account mixed states using the notion of a &lt;em&gt;Groverian measure&lt;/em&gt; and &lt;a href=&quot;https://www.hpl.hp.com/techreports/2005/HPL-2005-215.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[3]&lt;/a&gt; which makes use of standard von Neumann entropy.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="55" LastEditDate="2021-01-02T11:56:59.620" LastActivityDate="2021-01-02T11:56:59.620" Title="How to measure entanglement in an algorithm?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;shors-algorithm&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8537" PostTypeId="1" CreationDate="2019-10-21T13:56:00.990" Score="2" ViewCount="116" Body="&lt;p&gt;&lt;em&gt;I have already asked this question on &lt;a href=&quot;https://www.reddit.com/r/QuantumComputing/comments/dk8lsk/cirq_any_interesting_introductory_level_example&quot; rel=&quot;nofollow noreferrer&quot;&gt;reddit.com/r/QuantumComputing&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cirq supports to create quantum circuits composed by qubits having 2D grid structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have been preparing educational materials to teach the basics of quantum computing and quantum programming tools. I am looking for an interesting and &lt;strong&gt;very basic level example&lt;/strong&gt; using 2D grid of qubits. It should not be more complex than superdense coding or quantum teleportation but still have some fun.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any example or do you have any idea?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;We have used Qiskit until now, and we plan to include the examples by pyQuil and Cirq. Having some good motivation would be pedagogically reasonable when including them, as we would ask the user to install and learn more than one platform.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="5208" LastActivityDate="2019-10-21T13:56:00.990" Title="Cirq: Any interesting introductory level example using 2D grid of qubits?" Tags="&lt;cirq&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8538" PostTypeId="1" AcceptedAnswerId="8540" CreationDate="2019-10-21T16:11:00.507" Score="3" ViewCount="1631" Body="&lt;p&gt;I'm struggling to understand the process of how to decompose a unitary transform into two-level unitary matrices. I've been trying to understand the process as detailed in &lt;a href=&quot;https://arxiv.org/abs/1210.7366&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1210.7366&lt;/a&gt;, but I don't get where those 2x2 matrices in the individual two-level matrices are coming from, or what P actually is. If anyone could walk me through a numerical example of decomposing for example, a 4x4 matrix into two-level unitary matrices, that'd be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8568" LastEditorUserId="26" LastEditDate="2019-10-21T16:15:31.727" LastActivityDate="2019-10-21T23:14:46.920" Title="How to decompose a unitary transform into two-level unitary matrices?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8539" PostTypeId="2" ParentId="8538" CreationDate="2019-10-21T20:15:25.940" Score="3" Body="&lt;p&gt;Their approach is more advanced than the simple one, described in the book &quot;Quantum Computation and Quantum Information&quot; by M. Nielsen and I. Chuang, section 4.5.1. It's better to understand it first. Basically we are just making zeros under diagonal step by step, where each step is the multiplication by some two-level unitary. Hence there are only &lt;span class=&quot;math-container&quot;&gt;$d(d-1)/2$&lt;/span&gt; steps needed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the linked paper, &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is just a permutation of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; numbers &lt;span class=&quot;math-container&quot;&gt;$\{1,2,..,d\}$&lt;/span&gt; represented as a tuple &lt;span class=&quot;math-container&quot;&gt;$(j_1, j_2, .. ,j_d)$&lt;/span&gt;. For a fixed &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; we can take two consecutive numbers &lt;span class=&quot;math-container&quot;&gt;$j_k,j_{k+1}$&lt;/span&gt;  from the tuple &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; by picking &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; from the set &lt;span class=&quot;math-container&quot;&gt;$\{1,2,..,d-1\}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-10-21T20:15:25.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8540" PostTypeId="2" ParentId="8538" CreationDate="2019-10-21T23:14:46.920" Score="4" Body="&lt;p&gt;The basic idea is to multiply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the left with &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitaries until the identity is obtained. This method provides a sequence of gates &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U_1\cdots U_n U=I$&lt;/span&gt;, which then gives you the decomposition of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; unitaries: &lt;span class=&quot;math-container&quot;&gt;$U=U_1^\dagger \cdots U_n^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, suppose you start with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix}1/2&amp;amp;\frac{1}{2\sqrt3}&amp;amp;\sqrt{2/3}\\-1/2&amp;amp;\sqrt3/2&amp;amp;0\\1/\sqrt2&amp;amp;1/\sqrt6&amp;amp;-1/\sqrt3\end{pmatrix}.$$&lt;/span&gt;&#xA;We start by finding a matrix which only mixes first and third row of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, with the goal of annihilating the &lt;span class=&quot;math-container&quot;&gt;$(3,1)$&lt;/span&gt; element.&#xA;In general, a matrix &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; mixing only first and third column of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}* &amp;amp; 0 &amp;amp; * \\ 0 &amp;amp;1&amp;amp;0\\ *&amp;amp;0&amp;amp;*\end{pmatrix}.$$&lt;/span&gt;&#xA;To send &lt;span class=&quot;math-container&quot;&gt;$U_{31}$&lt;/span&gt; to zero essentially amounts to finding parameters &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$aU_{11}+b U_{31}=0$&lt;/span&gt;, which gives &lt;span class=&quot;math-container&quot;&gt;$a=-b U_{31}/U_{11}$&lt;/span&gt; (the case &lt;span class=&quot;math-container&quot;&gt;$U_{11}=0$&lt;/span&gt; can be handled separately). You then put the resulting &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; in the third row of &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;, and then adjust the rest of the parameters in &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; in order to make it into a unitary. This results in the following &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_1=\begin{pmatrix}&#xA;1/\sqrt3 &amp;amp; 0 &amp;amp; \sqrt{2/3}\\&#xA;0 &amp;amp; 1 &amp;amp; 0\\&#xA;-\sqrt{2/3} &amp;amp; 0 &amp;amp; 1/\sqrt3&#xA;\end{pmatrix}.$$&lt;/span&gt;&#xA;Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_1 U = \begin{pmatrix}\sqrt3/2 &amp;amp; 1/2 &amp;amp; 0 \\ -1/2 &amp;amp; \sqrt3/2 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; -1\end{pmatrix}.$$&lt;/span&gt;&#xA;In this case we were lucky in that we obtained two zeros in one step, but this is only due to this particular choice of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. You now need to find some &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; which only mixes the first two rows of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, that is, a matrix with the structure&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}* &amp;amp; * &amp;amp; 0 \\ * &amp;amp;*&amp;amp;0\\ 0&amp;amp;0&amp;amp;1\end{pmatrix}.$$&lt;/span&gt;&#xA;To send to zero the &lt;span class=&quot;math-container&quot;&gt;$(2,1)$&lt;/span&gt; element of &lt;span class=&quot;math-container&quot;&gt;$U_1 U$&lt;/span&gt; we can use (again, focus on coefficients that send to zero the elements in the first column of &lt;span class=&quot;math-container&quot;&gt;$U_1U$&lt;/span&gt;, and put them in the second row of &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt;, then filling out the rest to make &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; unitary):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_2=\begin{pmatrix}-\sqrt3/2 &amp;amp; 1/2 &amp;amp; 0 \\ 1/2 &amp;amp; \sqrt3/2 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix},$$&lt;/span&gt;&#xA;so that finally&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_2U_1 U=\begin{pmatrix}-1&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0\\0&amp;amp;0&amp;amp;-1\end{pmatrix}.$$&lt;/span&gt;&#xA;Notice how some of the signs in the resulting matrix are wrong. This is because I didn't put much care in the signs of the matrices &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;. Following the more accurate prescription given in the paper (note how they also include the determinants in the expressions, and take care of the cases with complex numbers) you will always obtain the identity at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, it might be interesting to note that this is essentially the &lt;a href=&quot;https://en.wikipedia.org/wiki/LU_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;LU decomposition&lt;/a&gt; applied to the special case of a unitary matrix.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-21T23:14:46.920" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8541" PostTypeId="2" ParentId="8536" CreationDate="2019-10-22T07:38:39.617" Score="3" Body="&lt;p&gt;This is not much of an answer, but is probably too long for a comment...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't believe that there's a canonical way of doing this. You'd be best off understanding why you're asking the question, and what you want to get out of it. From there, you tailor how you're going to measure it. But multipartite entanglement is a really messy problem, even just for pure states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me give an example of how messy and confusing it can be. There is a paper about &quot;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9802037&quot; rel=&quot;nofollow noreferrer&quot;&gt;the power of one clean qubit&lt;/a&gt;&quot; which introduces a computational model that is known as DQC1. One of the first questions asked about this computation was &quot;is there any entanglement?&quot; Not even how much, just a simple yes or no. Originally, it was concluded that there is no entanglement is this system because they looked at one particular bipartition of the qubits (the most obvious one), and there was no entanglement across that bipartition (I'm not sure if this is explicitly stated anywhere, but this is how it has been read by many). However, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505213&quot; rel=&quot;nofollow noreferrer&quot;&gt;later studies&lt;/a&gt; looked more in-depth at other bipartitions and found the existence of entanglement there.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-22T07:38:39.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8542" PostTypeId="1" AcceptedAnswerId="8555" CreationDate="2019-10-22T14:34:42.300" Score="6" ViewCount="207" Body="&lt;p&gt;Quantum computing refers (occasionally implicitly) to a &quot;&lt;a href=&quot;http://quantumcomputing.stackexchange.com/questions/1410/&quot;&gt;computational basis&lt;/a&gt;&quot;.&#xA;Some texts posit that such a basis may arise from a physically &quot;natural&quot; choice.&#xA;Both &lt;a href=&quot;https://math.stackexchange.com/questions/604391/&quot;&gt;mathematics&lt;/a&gt; and &lt;a href=&quot;https://physics.stackexchange.com/questions/122538/&quot;&gt;physics&lt;/a&gt; require meaningful notions to be invariant under a change of basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I wonder whether the computational complexity of a problem (say, the &lt;a href=&quot;https://en.wikipedia.org/wiki/QMA#The_local_Hamiltonian_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;k&lt;/em&gt;-local Hamiltonian&lt;/a&gt;) depends on the basis of the &lt;em&gt;n&lt;/em&gt;-qubit tensor product space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n}$&lt;/span&gt; be what is (&lt;a href=&quot;http://mathoverflow.net/questions/76176/&quot;&gt;wrongly&lt;/a&gt;) called the &quot;canonical&quot; one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, it seems that the &quot;definition&quot; for a Hamiltonian to &lt;strong&gt;act nontrivially&lt;/strong&gt; only on &lt;em&gt;k&lt;/em&gt; of the &lt;em&gt;n&lt;/em&gt; qubits fails the sanity check of invariance under a change of basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit for clarification:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U \in SU(2^n,\mathbb{C})$&lt;/span&gt; be an arbitrary change of basis of the full Hilbert space and &lt;span class=&quot;math-container&quot;&gt;$H = A_{2^k} \otimes I_{2^{n-k}}$&lt;/span&gt; be a Hamiltonian that acts nontrivially only the first &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits. Then &lt;span class=&quot;math-container&quot;&gt;$U^\dagger H U$&lt;/span&gt; might not be of the same form as &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; only acting on &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;" OwnerUserId="8824" LastEditorUserId="8824" LastEditDate="2019-10-23T02:50:50.640" LastActivityDate="2019-10-24T14:03:26.727" Title="Is quantum complexity basis-invariant?" Tags="&lt;complexity-theory&gt;&lt;non-locality&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8543" PostTypeId="1" AcceptedAnswerId="8556" CreationDate="2019-10-22T21:42:34.990" Score="8" ViewCount="341" Body="&lt;p&gt;How can I demonstrate on the exponential part equality of the Hadamard matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H=\frac{X+Z}{\sqrt2}\equiv\exp\left(i\frac{\pi}{2}\frac{X+Z}{\sqrt2}\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, how can I demonstrate on:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\exp(i(\pi/2)M) \equiv M$&lt;/span&gt;  for any matrix whose &lt;strong&gt;eigenvalues&lt;/strong&gt; are all &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and that such matrices uniquely satisfy &lt;span class=&quot;math-container&quot;&gt;$M^2=I$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Actually, I tried a guess: since the &lt;strong&gt;eigenvalues&lt;/strong&gt; are all &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; - are real - so the matrix is Hermitian, and since  &lt;span class=&quot;math-container&quot;&gt;$M^2=I$&lt;/span&gt; so the matrix is Unitary, then this relation &lt;span class=&quot;math-container&quot;&gt;$\exp(i(π/2)M) \equiv M$&lt;/span&gt; is valid)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://community.qiskit.org/textbook/chEx/Ex2.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://community.qiskit.org/textbook/chEx/Ex2.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="491" LastEditDate="2020-07-26T12:12:11.163" LastActivityDate="2020-07-26T12:12:11.163" Title="How do I prove that the Hadamard satisfies $H\equiv e^{i\pi H/2}$?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;pauli-gates&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8544" PostTypeId="2" ParentId="8542" CreationDate="2019-10-22T21:53:37.057" Score="4" Body="&lt;p&gt;This is a partial answer addressing only what I know: Stoquastic Hamiltonians in the Monte Carlo sign problem. The TLDR is, &lt;strong&gt;yes, complexity may depend on the choice of basis.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;em&gt;stoquastic&lt;/em&gt; Hamiltonian is one that has non-positive off-diagonal matrix&#xA;elements in the standard basis. This class of Hamiltonians was quite famously studied first &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0606140&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the world-line Monte Carlo method, one tries to estimate the quantum partition function &lt;span class=&quot;math-container&quot;&gt;$Z=\text{Tr}(e^{-\beta H})$&lt;/span&gt; for inverse temperature &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; by cutting it into many pieces and sampling from it. This is done by writing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-\beta H}=(e^{-\beta H/m})^m$$&lt;/span&gt;&#xA;The trace can now be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(e^{-\beta H})=\sum_i \langle i |e^{-\beta H})|i\rangle =\sum_{i_1,i_2,\dots,i_m}\langle i_1 |e^{-\beta H/m})|i_2\rangle\langle i_2 |\dots \langle i_m |e^{-\beta H/m})|i\rangle=\sum_J a_J&#xA;$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; are basis vectors of canonical/computational/standard basis and &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; is a shorthand for the index set &lt;span class=&quot;math-container&quot;&gt;$i_1,i_2,\dots,i_m$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How does this relate to stoquasticity you might ask.&lt;/strong&gt;&#xA;Well, on the right hand side, I have written a big sum of terms I called &lt;span class=&quot;math-container&quot;&gt;$a_J$&lt;/span&gt; that one can easily sample from using standard Monte Carlo methods just like one would estimate an integral via Monte Carlo sampling. However, in order for this to work, the summands should be positive! otherwise one samples from a quasi-probability distribution (i.e. a non-positive distribution).&#xA;Positivity of the summands is ensured for stoquastic Hamiltonians since to first order &lt;span class=&quot;math-container&quot;&gt;$e^{-\beta H}=1-\beta H$&lt;/span&gt; and the sums involve only products of certain entries of this matrix. However, non-stoquastic Hamiltonians exhibit what is famously known as the &lt;strong&gt;Monte Carlo sign problem&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be rather self-evident now, that this is a problem of choosing the right basis: Prominently, in the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; there is no problem since &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is diagonal. However, finding the eigenbasis or other sign-problem free bases was shown to be NP-complete already for 3-local Hamiltonians.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to learn more, I suggest you take a look at these two papers addressing the Monte Carlo sign problem and how to alleviate it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1906.02309&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv.org/abs/1906.02309&lt;/a&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1802.03408&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv.org/abs/1802.03408&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2019-10-22T21:53:37.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8545" PostTypeId="2" ParentId="8543" CreationDate="2019-10-22T22:23:58.337" Score="4" Body="&lt;p&gt;Hint: Consider the series expansion of the exponential in the case of matrices &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; that satisfy &lt;span class=&quot;math-container&quot;&gt;$M^2=-1$&lt;/span&gt; (in your case &lt;span class=&quot;math-container&quot;&gt;$M=i \frac{X+Z}{\sqrt(2)}$&lt;/span&gt;. You should find something akin to Euler's formula which renders the proof trivial.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2019-10-22T22:23:58.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8546" PostTypeId="1" CreationDate="2019-10-22T23:00:19.013" Score="3" ViewCount="62" Body="&lt;p&gt;The circuit for Kitaev phase estimation is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/N29DI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/N29DI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By varying &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, we are able to determine &lt;span class=&quot;math-container&quot;&gt;$\sin(2 \pi M \phi_k)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos (2 \pi M \phi_k)$&lt;/span&gt; from sampling the circuit and calculating the probabilities of different outputs of the first qubit (&lt;span class=&quot;math-container&quot;&gt;$\phi_k$&lt;/span&gt; is a real number, with &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi  i \phi_k}$&lt;/span&gt; being the eigenvalue corresponding to &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\xi_k\rangle$&lt;/span&gt;). This makes sense, except, the paper I'm reading says we have to take measurements with &lt;strong&gt;different values of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;&lt;/strong&gt; to get maximum precision for our algorithm's output. Why is this the case? &lt;/p&gt;&#xA;" OwnerUserId="4907" LastActivityDate="2019-10-22T23:00:19.013" Title="Why must we take multiple measurements for different values of $M$?" Tags="&lt;algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8547" PostTypeId="1" CreationDate="2019-10-22T23:24:31.930" Score="3" ViewCount="57" Body="&lt;p&gt;When I try to put an Ry gate into my circuit in cirq, I get an error saying that it only takes one argument.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import numpy as np&#xA;q = cirq.LineQubit(0)&#xA;cirq.Circuit(cirq.Ry(np.pi / 2, q))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;TypeError: Ry() takes 1 positional argument but 2 were given&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-10-24T14:00:18.010" LastActivityDate="2019-10-24T14:00:18.010" Title="cirq.Ry complains that it needs one argument" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8548" PostTypeId="2" ParentId="8547" CreationDate="2019-10-22T23:24:31.930" Score="2" Body="&lt;p&gt;&lt;code&gt;cirq.Ry&lt;/code&gt; is a method that, given an angle, returns a gate. You then apply the gate to a qubit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cirq.Ry(angle).on(qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or, equivalently but a bit more confusingly:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cirq.Ry(angle)(qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-10-22T23:35:08.617" LastActivityDate="2019-10-22T23:35:08.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8549" PostTypeId="2" ParentId="8427" CreationDate="2019-10-23T11:11:31.180" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;That seems to restrict the output probability distributions of all quantum circuits to rather high entropy distributions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The output of a typical randomly chosen quantum circuit &lt;em&gt;is&lt;/em&gt; rather high entropy. That doesn't mean you can't construct circuits that have low entropy outputs (you can), it just means that picking random gates is a bad strategy for achieving that goal.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;how can i P(x_i) equal 1/2^n when the bitstrings x_i are sampled from the uniform distribution?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How could it equal anything else? The probabilities of the target distribution have to add up to one, and you're picking each element 1/2^n of the time. For example, if there was a single element with all the probability, you'd score 0 * (2^n - 1)/2^n  + 1/2^n = 1/2^n. You always score 1/2^n on average when picking randomly.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can the value of F_XEB correspond to &quot;the probability that no error has occurred while running the circuit&quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When the paper says &quot;the probability that no error occurs&quot;, what it means is &quot;In the systemwide depolarizing error model, which is a decent approximation to the real physical error model at least for random circuits, the linear xeb score corresponds to the probability of sampling from the correct distribution instead of the uniform distribution.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Physically, it is obviously not the case that either a single error happens or no error happens. For example, every execution of the circuit is going to have some amount of over-rotation or under-rotation error due to imperfect control. But that's all very complicated. To keep things simple you can model the performance of the system as if your errors were from simpler models, such as each gate have a probability of introducing a Pauli error or such as you either sample from the correct distribution or the uniform distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simplified models actually do a decent job of predicting system performance, particularly on random circuits. For example, consider the way the fidelity decays as the number of qubits and number of layers are increased. The fidelity decay curve from the paper matches what you would predict if every operation had some fixed probability of introducing a Pauli error.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-10-23T11:11:31.180" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8550" PostTypeId="2" ParentId="8543" CreationDate="2019-10-23T13:35:02.057" Score="6" Body="&lt;p&gt;For questions like this, the conventional physics notation is easier to work with than the QIT gate notation.  Define &lt;span class=&quot;math-container&quot;&gt;$\vec \sigma = (\sigma_1,\sigma_2,\sigma_3)$&lt;/span&gt; to represent the three Pauli matrices&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_1 = X = \begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix}, \;\;\; \sigma_2 = Y = \begin{bmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{bmatrix}, \;\;\;&#xA;\sigma_3 = Z = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}.$$&lt;/span&gt;&#xA;The Pauli matrices form a basis for the Lie algebra &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{su}_2$&lt;/span&gt;, and the corresponding Lie group elements, &lt;span class=&quot;math-container&quot;&gt;$U \in SU(2)$&lt;/span&gt;, are given by the exponential map&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = e^{i\, \vec \phi \, \cdot \vec \sigma}, \;\;\; \vec \phi \in \mathbb{R}^3.$$&lt;/span&gt;&#xA;Define the vector &lt;span class=&quot;math-container&quot;&gt;$\vec \phi$&lt;/span&gt; by a magnitude &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat \phi = (\phi_1,\phi_2,\phi_3)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\vec \phi = \alpha \hat \phi$&lt;/span&gt;.  Simple multiplication shows that &lt;span class=&quot;math-container&quot;&gt;$(\vec \phi \cdot \vec \sigma)^2 = \alpha^2$&lt;/span&gt;.  With this relationship, the Taylor expansion of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; works out very nicely.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = \sum \limits_{i=0}^\infty \frac{i^n}{n!} \, (\vec \phi \cdot \vec \sigma)^n = \sum \limits_{j=0}^\infty \frac{(-1)^j}{(2j)!} \alpha^{2j} + i \hat \phi \cdot \vec \sigma \sum \limits_{j=0}^\infty \frac{(-1)^j}{(2j + 1)!} \, \alpha^{2j+1}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=I \, \cos \alpha + i \hat \phi \cdot \vec \sigma \sin \alpha = \begin{bmatrix} \cos \alpha + i \phi_3 \sin \alpha &amp;amp;&amp;amp; (\phi_2 + i \phi_1) \sin \alpha \\ (-\phi_2 + i \phi_1) \sin \alpha &amp;amp;&amp;amp; \cos \alpha - i \phi_3 \sin \alpha  \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With this formula it's simple to find the group element corresponding to given Lie algebra parameters. In the case of your specific question &lt;span class=&quot;math-container&quot;&gt;$\alpha = \tfrac{\pi}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat \phi = (\tfrac{1}{\sqrt{2}}, 0, \tfrac{1}{\sqrt{2}})$&lt;/span&gt;.  Plugging this in gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_{x+z} = \begin{bmatrix} \frac{i}{\sqrt{2}} &amp;amp;&amp;amp; \frac{i}{\sqrt{2}} \\ \frac{i}{\sqrt{2}} &amp;amp;&amp;amp; -\frac{i}{\sqrt{2}} \end{bmatrix} = \frac{i(X + Z)}{\sqrt{2}}.$$&lt;/span&gt;&#xA;In the underlying question from qiskit, &lt;span class=&quot;math-container&quot;&gt;$\equiv$&lt;/span&gt; is defined as equivalence modulo global phase, so, as desired, the result equals &lt;span class=&quot;math-container&quot;&gt;$\tfrac{X+Z}{\sqrt{2}}$&lt;/span&gt; up to a global phase of &lt;span class=&quot;math-container&quot;&gt;$e^{i\frac{\pi}{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The more general question of determining what other Lie algebra parameterizations share this property (apart from trivial solutions, which are given by multiples of the identity) reduces to finding solutions to the equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i \vec \phi \, \cdot \, \vec \sigma} = e^{i \theta} \, \hat \phi \cdot \vec \sigma \; (\text{mod} \; \theta).$$&lt;/span&gt;&#xA;This requires &lt;span class=&quot;math-container&quot;&gt;$\cos \alpha = 0$&lt;/span&gt;, which means vectors solving this equation will have &lt;span class=&quot;math-container&quot;&gt;$\alpha = \pm \tfrac{\pi}{2}$&lt;/span&gt;. From there it's relatively straightforward to see that solutions take the form of vectors with &lt;span class=&quot;math-container&quot;&gt;$\alpha = \pm \frac{\pi}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{\pm i \frac{\pi}{2} \hat \phi \, \cdot \, \vec \sigma} = \pm i \, \hat \phi \cdot \vec \sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-07-26T01:41:00.717" LastActivityDate="2020-07-26T01:41:00.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8551" PostTypeId="1" CreationDate="2019-10-23T14:03:14.947" Score="13" ViewCount="482" Body="&lt;p&gt;As I understand from &lt;a href=&quot;https://www.ibm.com/blogs/research/2019/10/on-quantum-supremacy/&quot; rel=&quot;noreferrer&quot;&gt;this IBM post&lt;/a&gt; both the IBM and Google teams have independently built 53-qubit processors. What is the significance of the number 53? It is purely coincidental, or is there a deeper reason why both team have the same number of qubits?&lt;/p&gt;&#xA;" OwnerUserId="2758" LastEditorUserId="55" LastEditDate="2019-10-23T18:43:32.913" LastActivityDate="2019-11-05T18:15:09.850" Title="Why do the IBM and Google processors both have 53 qubits?" Tags="&lt;physical-qubit&gt;&lt;quantum-advantage&gt;&lt;ibm&gt;&lt;google-sycamore&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8552" PostTypeId="1" AcceptedAnswerId="8714" CreationDate="2019-10-23T14:15:25.860" Score="6" ViewCount="329" Body="&lt;p&gt;I understand that both have 53 qubit devices, yet it is Google that has &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5.pdf&quot; rel=&quot;noreferrer&quot;&gt;demonstrated&lt;/a&gt; quantum supremacy (although IBM &lt;a href=&quot;https://www.ibm.com/blogs/research/2019/10/on-quantum-supremacy/&quot; rel=&quot;noreferrer&quot;&gt;refutes&lt;/a&gt; this!). I'm not sure if this is true but it seems like IBM cannot replicate the quantum circuits and measurements that Google has managed on their device. Please correct me if this assumption is wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reading the Google paper, the following line was significant&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Our largest random quantum circuits have 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%.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That fidelity seems pretty good given that you've gone through so many gates. The data on IBM is a bit sketchy but &lt;a href=&quot;https://www.ibm.com/blogs/research/2019/03/power-quantum-device/&quot; rel=&quot;noreferrer&quot;&gt;this table&lt;/a&gt; seems to suggest that even their IBM-Q System One has 2-qubit gates with an average error of 1.69%. So after 400 odd gates, the fidelity drops below 0.1%. And that's not including the single qubit gates or the measurement at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this the ace card that allows Google to demonstrate what they did? Have they out-engineered IBM in producing high fidelity gates or does the advantage come from something else?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2019-10-23T14:22:26.267" LastActivityDate="2019-11-08T03:23:54.947" Title="Why does Google's quantum processor outperform IBM's?" Tags="&lt;quantum-advantage&gt;&lt;ibm&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8553" PostTypeId="1" AcceptedAnswerId="8571" CreationDate="2019-10-23T14:31:51.010" Score="3" ViewCount="318" Body="&lt;p&gt;In Qiskit it is possible to specify noise models to apply to simulations. This allows noise to be defined for certain operations, like measurement or each type of gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it also possible to change the noise for different parts of the circuit. Such as turning noise on only for specific parts of the circuit?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2019-10-25T19:34:48.930" Title="How to selectively apply noise in Qiskit simulations?" Tags="&lt;qiskit&gt;&lt;simulation&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8554" PostTypeId="1" AcceptedAnswerId="8557" CreationDate="2019-10-23T15:48:21.673" Score="19" ViewCount="4219" Body="&lt;p&gt;Google recently announced that &lt;a href=&quot;https://www.nature.com/articles/d41586-019-03213-z&quot; rel=&quot;noreferrer&quot;&gt;they have achieved &quot;Quantum Supremacy&quot;&lt;/a&gt;: &quot;that would be practically impossible for a classical machine.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this mean that they have definitely proved that &lt;strong&gt;BQP ≠ BPP&lt;/strong&gt; ? And if that is the case, what are the implications for &lt;strong&gt;P ≠ NP&lt;/strong&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="4636" LastEditorUserId="55" LastEditDate="2019-10-23T18:43:04.363" LastActivityDate="2019-11-05T18:41:51.697" Title="What does Google's claim of &quot;Quantum Supremacy&quot; mean for the question of BQP vs BPP vs NP?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;quantum-advantage&gt;&lt;bqp&gt;&lt;google-sycamore&gt;" AnswerCount="2" CommentCount="10" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8555" PostTypeId="2" ParentId="8542" CreationDate="2019-10-23T16:19:23.910" Score="4" Body="&lt;p&gt;The computational basis is &quot;natural&quot; in the sense that it provides a practical representation of measurement outcomes.  Other bases are also &quot;natural&quot; for other tasks, and bases cannot be interchanged aribtrarily if such a change impacts the underlying tensor structure of the system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example the Bell states form a basis in four dimensional Hilbert space representing two maximally entangled qubits.  Bell states are not bilinear combinations of computational basis states, so we cannot simply choose to represent separable states over the Bell basis, or entangled states over the computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What seems to be missing from your assumptions is a recognition that the tensor product structure over the computational basis is of fundamental importance because it comports with measurement outcomes - our only connection to the quantum realm.  In other words, the computational basis for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system, &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle$&lt;/span&gt;, is a tensor product space of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_0 \rangle = \vert b_0 \rangle \otimes \vert b_1 \rangle \otimes ... \otimes \vert b_{n-1} \rangle \in (\mathbb{C}^2)^{\otimes n},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vert b_i \rangle \in \mathbb{C}^2$&lt;/span&gt;.&#xA;A transformation that preserves the tensor structure of &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle$&lt;/span&gt;, &lt;em&gt;i.e.&lt;/em&gt; does not induce entanglement, takes the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = U_0 \otimes U_1 \otimes , ... , \otimes U_{n-1} \in U(2)^{\otimes n} \subset U(2^n).$$&lt;/span&gt;&#xA;Hamiltonians of this form are regularly employed in both theory and practice, where any given &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; can act trivially or non-trivially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, generally in practice only a discrete set of single qubit transformations are available.  By the &lt;em&gt;Solovay-Kitaev theorem&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; can be approximated to precision &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$\Theta(\log^c(\tfrac{1}{\epsilon}))$&lt;/span&gt; gates from a fixed discrete set, where &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is a constant between 1 and 2 (as far as I know its exact value is still an open problem).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When multilevel gates are applied to the system to induce entanglement, we still need to be able to track the relationship back to the tensor structure of &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle$&lt;/span&gt;.  For sufficiently large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, applying an arbitrary &lt;span class=&quot;math-container&quot;&gt;$SU(2^n)$&lt;/span&gt; transformation to &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle$&lt;/span&gt; amounts to complete decoherence of the system because any meaningful description of the wavefunction is lost (&lt;em&gt;i.e.&lt;/em&gt;, breaking &lt;span class=&quot;math-container&quot;&gt;$SU(2^n)$&lt;/span&gt; down into a Tensor Network representation, discussed below, becomes intractable.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such transformations need to be applied in very rigorous and non-trivial ways.  As Carlton Caves said &quot;Hilbert space is a big place,&quot; and it's easy to get lost.  Notice, for example, that the space of linear transformations spanned by &lt;span class=&quot;math-container&quot;&gt;$U(2^n)$&lt;/span&gt; is exponentially larger than that of &lt;span class=&quot;math-container&quot;&gt;$U(2)^{\otimes n}$&lt;/span&gt;, &lt;em&gt;e.g.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$U(2^n)$&lt;/span&gt; has real dimension &lt;span class=&quot;math-container&quot;&gt;$2^{2n}$&lt;/span&gt;, whereas &lt;span class=&quot;math-container&quot;&gt;$U(2)^{\otimes n}$&lt;/span&gt; has real dimension &lt;span class=&quot;math-container&quot;&gt;$4n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, low energy systems can only access a relatively small portion of the full Hilbert space because physically realistic states are heavily constrained by locality.  Tensor networks are a good example of a class of approaches to managing this challenge by limiting the description of a system to physically realistic regions of Hilbert space (see, &lt;em&gt;e.g.&lt;/em&gt; section 3.3 &lt;a href=&quot;https://arxiv.org/abs/1306.2164&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-23T21:09:52.080" LastActivityDate="2019-10-23T21:09:52.080" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8556" PostTypeId="2" ParentId="8543" CreationDate="2019-10-23T18:28:21.937" Score="9" Body="&lt;p&gt;First of all, note that the statement, as written, is wrong (or rather, it is correct only as long as the &quot;&lt;span class=&quot;math-container&quot;&gt;$\equiv$&lt;/span&gt;&quot; symbol is taken to mean &quot;&lt;em&gt;equal up to a phase&lt;/em&gt;&quot;). An easy way to see it is by computing the determinant of &lt;span class=&quot;math-container&quot;&gt;$H=e^{i\pi H/2}$&lt;/span&gt;, which gives &lt;span class=&quot;math-container&quot;&gt;$-1=1$&lt;/span&gt; (using &lt;span class=&quot;math-container&quot;&gt;$\det[\exp(A)]=\exp[\operatorname{Tr}(A)] $&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(H)=0$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, assume &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is any matrix satisfying &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt; (note that we don't even need to assume that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has a specific dimension). Then, &lt;span class=&quot;math-container&quot;&gt;$\exp(i\alpha A)=\cos(\alpha)I + i\sin(\alpha)A$&lt;/span&gt; (you can see this by expanding the exponential in power series as shown in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8550/55&quot;&gt;another answer&lt;/a&gt;, or using directly the formula &lt;span class=&quot;math-container&quot;&gt;$\exp(A)=\cos(A)+i\sin(A)$&lt;/span&gt;, which also works for matrices).&#xA;It follows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\pi A/2}=i A.$$&lt;/span&gt;&#xA;Your formula is a special case of this. You can check that, given any direction &lt;span class=&quot;math-container&quot;&gt;$\hat{\mathbf n}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\hat{\mathbf n}|=1$&lt;/span&gt;, denoting with &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol\sigma_i$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th Pauli matrix, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\hat{\mathbf n}\cdot\boldsymbol \sigma)^2=I,$$&lt;/span&gt;&#xA;thus the conclusion follows.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, because you also referenced the eigenvalues, note that &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$A=PDP^{-1}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; invertible and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; diagonal with &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; elements. See &lt;a href=&quot;https://math.stackexchange.com/a/898184/173147&quot;&gt;this answer on math.SE&lt;/a&gt; for a proof.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="124" LastEditDate="2019-10-24T23:07:41.703" LastActivityDate="2019-10-24T23:07:41.703" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8557" PostTypeId="2" ParentId="8554" CreationDate="2019-10-23T18:39:08.497" Score="15" Body="&lt;p&gt;Google's paper/results are kind of sideways to questions in computational complexity about the relation between &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BPP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; (and even further from questions about whether &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}\ne\mathrm{NP}$&lt;/span&gt;).  It's more as if Google &lt;em&gt;relies on&lt;/em&gt; the hypothesis that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BPP}\ne\mathrm{BQP}$&lt;/span&gt; as evidence that their quantum computer performs a task many orders of magnitude faster than a classical computer could.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Google performed a sampling task on their quantum computer, that they have strong theoretical reasons to believe is not easily performed on a classical computer.  If we say that these complexity classes live in some idealized platonic universe, then Google's results don't shed any light about the difficulty of proving whether or not they are equal to one another - because Google's paper &lt;em&gt;assumes&lt;/em&gt; that they are not equal to one another.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What Google's paper &lt;em&gt;does&lt;/em&gt; do, is provide evidence that the hypothesis that &lt;a href=&quot;https://cstheory.stackexchange.com/questions/7528/extended-church-turing-thesis&quot;&gt;&quot;a probabilistic Turing machine can efficiently simulate any realistic model of computation&quot;&lt;/a&gt; is incorrect.  They have prepared and maintained coherence &lt;strong&gt;&lt;em&gt;of a state of their choosing&lt;/em&gt;&lt;/strong&gt; in a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^{53}$&lt;/span&gt;.  As Aaronson &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4317&quot; rel=&quot;nofollow noreferrer&quot;&gt;argues&lt;/a&gt;, is akin to the Wright Flyer providing evidence that &quot;heavier-than-air human-controlled powered flight is impossible&quot; is incorrect.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-05T18:41:51.697" LastActivityDate="2019-11-05T18:41:51.697" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8558" PostTypeId="1" AcceptedAnswerId="8564" CreationDate="2019-10-23T20:48:02.857" Score="2" ViewCount="592" Body="&lt;p&gt;I'm  trying to understand &lt;a href=&quot;https://physics.stackexchange.com/a/213168&quot;&gt;the following derivation of decomposing a controlled &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt; (phase) gate into a combination of CNOTs and single qubit gates&lt;/a&gt;, but there's one main thing about the process that I'm not following and that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the effect that the CNOT gate is having on &lt;span class=&quot;math-container&quot;&gt;$|\psi_{mn} \rangle$&lt;/span&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought that CNOT simply flipped the target bit if the control qubit was 1, but in that answer, it doesn't seem like the CNOT is having this effect at all. The arbitrary state just seems to be staying the same (in the first example where they show the effect of CNOT on &lt;span class=&quot;math-container&quot;&gt;$|\psi_{mn} \rangle$&lt;/span&gt;)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then in the full derivation later in the post, the CNOT seems to be removing parts of the phases from the qubits? I don't quite understand that either. &lt;/p&gt;&#xA;" OwnerUserId="8568" LastEditorUserId="55" LastEditDate="2019-10-24T09:58:32.060" LastActivityDate="2019-10-24T09:58:32.060" Title="Decomposing a controlled phase gate into CNOTs" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8559" PostTypeId="1" CreationDate="2019-10-24T04:18:51.430" Score="1" ViewCount="47" Body="&lt;p&gt;I was wondering if the multi-prime factoring problem can be solved in a hybrid approach using DWave (to factor) and Shor's algorithm (in Qiskit)? Please let me know your thoughts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8837" LastEditorUserId="26" LastEditDate="2019-10-24T13:52:33.030" LastActivityDate="2019-10-24T13:52:33.030" Title="Suggestions for hybrid factoring algorithm on DWave and Qiskit" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;shors-algorithm&gt;&lt;d-wave&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8560" PostTypeId="2" ParentId="8554" CreationDate="2019-10-24T05:22:56.507" Score="3" Body="&lt;p&gt;Paraphrasing &lt;a href=&quot;https://twitter.com/RichFelker/status/1187016837202173952&quot; rel=&quot;nofollow noreferrer&quot;&gt;some tweets on the matter earlier&lt;/a&gt;, the result is rather underwhelming because it plays on a discrepancy between what they mean by quantum supremacy (QS) and what people tend to think QS means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I find most people think QS is supposed to mean, and what I assumed it meant until a month or so ago, was that there exists a computable problem (in the CTT sense of computation) and an actual quantum computer, such that, at some scales, the problem is tractable on the quantum computer but intractable on all classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem the Google QC folks have demonstrated is not computation in the CTT sense. It is a physical process of sampling that involves computations as part of the process, and as with any physical process, it can be simulated approximately by computation. They have good reason to believe (proof? I'm not sure but it should reasonably be assumed true by default anyway) that computation to similate the process is going to be intractably slow. This is not surprising at all. It's a fundamental consequence of quantum mechanics that &lt;strong&gt;lots&lt;/strong&gt; of physical processes will have that property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's not to say it's entirely uninteresting. There are likely useful applications of the sampling problem they implemented, and as I understand it, it provides examples of large classes of physical systems which are not amenable to efficient computational simulation. But it has nothing to do with whether or how soon a QC will be able to compete with a (classical, CTT) computer solving computable problems.&lt;/p&gt;&#xA;" OwnerUserId="2874" LastEditorUserId="55" LastEditDate="2019-10-24T09:37:12.827" LastActivityDate="2019-10-24T09:37:12.827" CommentCount="19" ContentLicense="CC BY-SA 4.0" />
  <row Id="8563" PostTypeId="2" ParentId="8542" CreationDate="2019-10-24T08:04:20.347" Score="4" Body="&lt;p&gt;I give this second answer to address a misconception that might be lurking in the question and to look at the local Hamiltonian problem: I am not entirely convinced by my answer and happy to hear what others have to say about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, is first and foremost a Hermitian operator on the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=(\mathbb{C}^2)^{\otimes n}$&lt;/span&gt;, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H: \mathcal{H}\to \mathcal{H}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider for example the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=Z\otimes I$&lt;/span&gt; acting on two qubit. This is an &lt;strong&gt;operator&lt;/strong&gt; not a matrix: For example the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator acting on the first qubit can be represented by the Pauli &lt;strong&gt;matrix&lt;/strong&gt; everyone is familiar with but in order to do so, you have to (implicitly) pick the computational basis. Otherwise, this operator &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; just maps certain vectors to certain vectors. The notion of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-locality here (in this case &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-locality), I believe, exists completely separately from the concept of a basis. That also means, that for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that you want to conjugate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; with, you simply get a &lt;strong&gt;different&lt;/strong&gt; Hamiltonian! (Of course, once you write down &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as a matrix in some basis, the  conjugation by unitary &lt;em&gt;matrices&lt;/em&gt; corresponds to a basis change)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the local Hamiltonian problem is essentially about finding the smallest eigenvalue but formulated as a decision problem. It is a computational problem and thus we need to resort to picking a basis for our Hilbert space. &lt;strong&gt;Note that the decision problem would be trivial if you knew the eigenbasis of the Hamiltonian! Thus, it is entire clear again that the complexity of this computational problem is related to the choice of basis, but this is independent of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-locality.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="5322" LastEditDate="2019-10-24T14:03:26.727" LastActivityDate="2019-10-24T14:03:26.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8564" PostTypeId="2" ParentId="8558" CreationDate="2019-10-24T09:56:44.277" Score="2" Body="&lt;p&gt;In the linked post, &lt;span class=&quot;math-container&quot;&gt;$|\psi_{mn}\rangle$&lt;/span&gt; is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{mn}\rangle = a_{00}|0_m 0_n\rangle + a_{10}|1_m 0_n\rangle + a_{01}|0_m 1_n\rangle + a_{11}|1_m 1_n\rangle,&#xA;$$&lt;/span&gt;&#xA;and the action of a CNOT operating between &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th qubit is written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{CNOT}^{(m,n)}|\psi_{mn}\rangle = a_{00}|0_m 0_n\rangle + a_{10}|1_m 0_n\rangle + a_{11}|0_m 1_n\rangle + a_{01}|1_m 1_n\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note how the last two coefficients are swapped in the second expression, so the expressions are not identical.&#xA;Here, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}^{(m,n)}$&lt;/span&gt; denotes a CNOT having the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th qubit as control and the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th one as target, so its action on the basis states is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathrm{CNOT}^{(m,n)}|0_m 0_n\rangle &amp;amp;= |0_m 0_n\rangle, \\&#xA;\mathrm{CNOT}^{(m,n)}|1_m 0_n\rangle &amp;amp;= |1_m 0_n\rangle, \\&#xA;\mathrm{CNOT}^{(m,n)}|1_m 1_n\rangle &amp;amp;= |0_m 1_n\rangle, \\&#xA;\mathrm{CNOT}^{(m,n)}|0_m 1_n\rangle &amp;amp;= |1_m 1_n\rangle.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-10-24T09:56:44.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8565" PostTypeId="2" ParentId="8427" CreationDate="2019-10-24T14:23:20.937" Score="3" Body="&lt;p&gt;After some further consideration I think it's quite clear that the only probability mass function evaluated in the computation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{\text{XEB}}$&lt;/span&gt; is that of the classically computed ideal distribution, denoted &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; in the main paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads me to the conclusion that the phrasing of the following excerpt from section IV.C of the Supplemental Information (and especially the part underlined in red) is a bit unfortunate/misleading:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TfZlw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TfZlw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just because the empirically measured bitstrings are coming from the uniform distribution doesn't mean that &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is suddenly &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt;, as it goes into the calculation of the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{\text{XEB}}$&lt;/span&gt;, is still the probability of sampling bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; from the classically computed ideal distribution. This is in general not &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct reasoning is that the fact that &lt;span class=&quot;math-container&quot;&gt;$\langle P(x_i)\rangle_i$&lt;/span&gt; will be &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; (and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}_{\text{XEB}} = 0$&lt;/span&gt;) when bitstrings &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; are sampled from the uniform distribution follows from the definitions of expectation and probability mass function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of expected value is the following sum&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle P(x_i)\rangle_i = \sum_{i=1}^{2^n} P(x_i) p_i&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is the probability of bitstring &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; being sampled from the classically computed ideal quantum circuit, &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; is the probability of &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; being sampled from the non-ideal empirical distribution, and the sum runs over all possible bitstrings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When bitstrings are coming from the uniform distribution &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; will always be &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; so can be broken out of the sum:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle P(x_i)\rangle_i = \frac{1}{2^n} \sum_{i=1}^{2^n} P(x_i)&#xA;$$&lt;/span&gt;&#xA;When you sum any probability mass function (of which &lt;span class=&quot;math-container&quot;&gt;$P(x_i)$&lt;/span&gt; is one example) over all the possible outcomes you by definition get 1, and thus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle P(x_i)\rangle_i = \frac{1}{2^n}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8704" LastActivityDate="2019-10-24T14:23:20.937" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8566" PostTypeId="1" AcceptedAnswerId="8569" CreationDate="2019-10-24T15:22:43.307" Score="9" ViewCount="1329" Body="&lt;p&gt;Is VQE a class of algorithms or a specific algorithm? For example, is QAOA a VQE or is VQE an algorithm distinct from QAOA that solves the same class of problems?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If VQE is a specific algorithm, what are its defining features that distinguish it from other algorithms such as QAOA?&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="4943" LastEditDate="2019-10-24T19:06:52.553" LastActivityDate="2019-10-25T08:09:09.250" Title="Is VQE a class of algorithms or a specific algorithm?" Tags="&lt;algorithm&gt;&lt;qaoa&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8567" PostTypeId="1" CreationDate="2019-10-24T22:48:05.937" Score="5" ViewCount="92" Body="&lt;p&gt;I'm doing a practice assignment where I'm asked to identify specific features of the Grover Search Algorithm's second operator (picture in post, further on &quot;&lt;span class=&quot;math-container&quot;&gt;$Us$&lt;/span&gt;&quot;), which mirrors the system relative to the &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; vector, defined as the equal-weighted sum of the input parameter's subspace basis vectors (definition below). Naturally, this only concerns the contents of a single iteration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|s\rangle=H|0\rangle^{\otimes n}=\frac{1}{2^{n/2}}\sum_{x=0}^{2^n-1}|x\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operator is defined by the following scheme, which I have, for reference, built in the Quirk QC simulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T1rYq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T1rYq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has the following proposed features (which I need to verify as &lt;strong&gt;true&lt;/strong&gt; or &lt;strong&gt;false&lt;/strong&gt;):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The Hadamard and NOT gates applied to the qubits 1 and 2 (further on &lt;span class=&quot;math-container&quot;&gt;$|C_I\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|C_{II}\rangle$&lt;/span&gt;) in succession map the &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; vector onto the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; vector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Hadamard and NOT gates applied to the qubits 1 and 2 (further on &lt;span class=&quot;math-container&quot;&gt;$|C_I\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|C_{II}\rangle$&lt;/span&gt;) in succession map the &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; vector onto the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; vector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The CNOT gate (with &lt;span class=&quot;math-container&quot;&gt;$C_I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_{II}$&lt;/span&gt; as controls) affects only the &lt;span class=&quot;math-container&quot;&gt;$|11C_{III}\rangle$&lt;/span&gt; vector.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The CNOT gate multiplies the &lt;span class=&quot;math-container&quot;&gt;$|11C_{III}\rangle$&lt;/span&gt; vector by &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and does not affect other vectors.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Hadamard, then the NOT gate applied to &lt;span class=&quot;math-container&quot;&gt;$C_I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_{II}$&lt;/span&gt; maps &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; onto &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; component in the system vector is thus multiplied by &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; while components orthogonal to it are unaffected.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The NOT gate on &lt;span class=&quot;math-container&quot;&gt;$C_{III}$&lt;/span&gt; multiplies the system vector by &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, thus the system vector is reflected relative to &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The NOT gate on the &lt;span class=&quot;math-container&quot;&gt;$C_{III}$&lt;/span&gt; qubit is unnecessary.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My perspective:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first two points, I &lt;em&gt;don't fully grasp&lt;/em&gt; the concept of the mapping described here. However, it should be noted that by definition, as far as I understand, the Hadamard transformation on either side of the scheme is to allow the &quot;&lt;span class=&quot;math-container&quot;&gt;$Us$&lt;/span&gt;&quot; operator to function as a reflection relative to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For (3) and (4), while I have maintained the original wording, I understand the question misnames the CCNOT gate as CNOT - I'm not sure how important this distinction is, other than technically referring to two different types of gates. Both of these are true if only the controlled vector is affected, which &lt;em&gt;I believe to be correct&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe (5) is &lt;em&gt;incorrect&lt;/em&gt; as, by definition, &quot;&lt;span class=&quot;math-container&quot;&gt;$Us$&lt;/span&gt;&quot; is a reflection relative to &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;. Because of this definition, I believe (6) is &lt;em&gt;correct&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe (7) is &lt;em&gt;incorrect&lt;/em&gt; because it changes the outcome of the &quot;&lt;span class=&quot;math-container&quot;&gt;$Us$&lt;/span&gt;&quot; operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding of quantum computing is severely limited at the moment, so I'm hoping that I'll be able to gain some much-needed intuition by having my logic here fact-checked. &lt;/p&gt;&#xA;" OwnerUserId="8849" LastEditorUserId="26" LastEditDate="2019-10-25T16:18:33.063" LastActivityDate="2019-10-25T16:18:33.063" Title="Exact functions of a single-iteration Grover Search Algorithm's operators" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;&lt;quirk&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8568" PostTypeId="1" CreationDate="2019-10-25T06:04:30.130" Score="5" ViewCount="47" Body="&lt;p&gt;There is a huge gap between basic physical laws and predicting many particle systems from first principles. It will be so amazing if we can predict most properties of many particle systems (from mass of an atomic nuleus to density/conductivy/bandgap of a material to properties of any small or big molecule) from first principles with high precision at low cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Google's desclared &quot;quantum supremacy&quot; news I hear that they can be applied to computational physics too. But from &quot;Quantum simulator&quot; in Wikipedia, I feel that this still only applies to a very narrow types of problems , and we still can never close the gap to amazingness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the current research advance and is there a hope to close the gap?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: The question is more a physics question, but physics site doesn't accept this type of question so I moved it here.&lt;/p&gt;&#xA;" OwnerUserId="8853" LastEditorUserId="8853" LastEditDate="2019-10-27T00:17:30.213" LastActivityDate="2019-10-27T00:17:30.213" Title="What is the current research status in simulating many-particle systems from first principles?" Tags="&lt;simulation&gt;" AnswerCount="0" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8569" PostTypeId="2" ParentId="8566" CreationDate="2019-10-25T08:09:09.250" Score="10" Body="&lt;p&gt;I view QAOA as an algorithm for solving (approximately) a special class of problems, namely combinatorial problems and VQE as a possible subroutine to QAOA (but not necessarily as in the case of MaxCut). Let me explain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The VQE - Variational Quantum Eigensolver - solves the problem of approximating the smallest eigenvalue of some Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; which we usually just call Hamiltonian. As a byproduct, we also obtain a classical description of the approximate ground state. It does so by classically varying over efficiently preparable ansatz states &lt;span class=&quot;math-container&quot;&gt;$|\psi(\theta)\rangle$&lt;/span&gt; and a quantum subroutine determines the expectation value &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mu=\langle \psi (\theta)|H|\psi(\theta)\rangle$$&lt;/span&gt; by a sampling procedure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In QAOA (Quantum Approximate Optimization Algorithm), your cost function (or Hamiltonian if you will) is given by &lt;span class=&quot;math-container&quot;&gt;$H=\sum_i C_i(z)$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$C_i(z)$&lt;/span&gt; are operators diagonal in the computational basis. Importantly, the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is thus the computational basis and &lt;strong&gt;one of the computational eigenstates encodes the solution to the problem&lt;/strong&gt;! This, is not the case in VQE! &#xA;So how does QAOA procece? On a high level, without going into too many details, it procedes very similarly to VQE:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Optimize over variational parameters in some ansatz state. The state is called &lt;span class=&quot;math-container&quot;&gt;$|\gamma, \beta \rangle$&lt;/span&gt; in QAOA and it ought to minimize/maximize the expectation value&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \gamma, \beta|H|\gamma, \beta\rangle$$&lt;/span&gt;&#xA;&lt;strong&gt;In this step, VQE can be used as a subroutine&lt;/strong&gt; as this is precisely the task VQE can achieve (finding good parameters &lt;span class=&quot;math-container&quot;&gt;$\beta, \gamma$&lt;/span&gt;) but it might not be necessary. In the original QAOA paper, the authors argued, that for particular instances of MaxCut (i.e. some particular classes of graphs), an efficient classical optimization method exists, that is, they could optimize over the ansatz state without ever preparing it (no quantum device involved)!&lt;/li&gt;&#xA;&lt;li&gt;Here, we necessarily go quantum (here you need a quantum device): &lt;strong&gt;Prepare&lt;/strong&gt; the optimized ansatz state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{opt} \rangle$&lt;/span&gt; over and over again and measure it in the computational basis until you statistically converged enough to be able to pick the right computational basis state encoding the solution with high probability. (Note that because of the previous optimization routine, the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{opt} \rangle$&lt;/span&gt; should have a large overlap with the eigenstate to the smallest eigenvalue which I stress once again is one of the basis vectors of the computational basis)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;How is QAOA approximate you might ask now: Well, depending on how much computational resources you are willing to invest into finding good parameters, your &lt;span class=&quot;math-container&quot;&gt;$|\psi_{opt} \rangle$&lt;/span&gt; might vary in quality. A bad quality state might not be close enough fidelity-wise to the eigenstate one is looking for. So the algorithm is approximate in the sense, that it tries to find a trade-off in the optimization procedure between optimization rounds and fidelity of the optimized state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, that QAOA is just one possible application of VQE and there are many more, first and foremost quantum chemistry problems!&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2019-10-25T08:09:09.250" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8570" PostTypeId="1" AcceptedAnswerId="12759" CreationDate="2019-10-25T17:16:05.913" Score="5" ViewCount="105" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1604.00501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cavalcanti and Skrzypczyk (2017)&lt;/a&gt;, section IIA, pag. 3, while introducing the idea of &lt;em&gt;quantum steering&lt;/em&gt;, the authors introduce the idea of &lt;strong&gt;&lt;em&gt;Local Hidden State model&lt;/em&gt;&lt;/strong&gt; as following (emphasis mine):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A LHS model refers to the situation where &lt;strong&gt;&lt;em&gt;a source sends a classical message &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; to one of the parties, say Alice, and a corresponding quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_\lambda$&lt;/span&gt; to the other party, Bob&lt;/em&gt;&lt;/strong&gt;. Given that Alice decides to apply measurement &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, the variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; instructs Alice’s measurement device to output the result a with probability &lt;span class=&quot;math-container&quot;&gt;$p(a|x, \lambda)$&lt;/span&gt;. Additionally it is also considered that the classical message &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; can be chosen according to a distribution &lt;span class=&quot;math-container&quot;&gt;$\mu(\lambda)$&lt;/span&gt;. Bob does not have access to the classical variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, so the final assemblage he observes is composed by the elements&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\sigma_{a|x}=\int d\lambda \mu(\lambda)p(a|x,\lambda)\rho_\lambda.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm struggling to grasp the general picture here.&#xA;Isn't this equivalent to saying that Alice and Bob share a state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_\lambda |\lambda\rangle\!\langle\lambda|\otimes \rho_\lambda,$$&lt;/span&gt;&#xA;for some choice of a computational basis &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; for Alice? &#xA;In particular, it's the wording that &quot;the source sends &lt;strong&gt;&lt;em&gt;a classical message&lt;/em&gt;&lt;/strong&gt; to Alice&quot; that confuses me. What is a &quot;classical message&quot; here? Do we just mean that Alice is not allowed to perform measurements or operations that probe the coherence between different states &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt;, for some choice of computational basis that was chosen beforehand?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-12-20T22:22:15.503" LastActivityDate="2020-12-20T22:22:15.503" Title="Understanding the idea of &quot;local hidden state model&quot;" Tags="&lt;communication&gt;&lt;non-locality&gt;&lt;steering&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8571" PostTypeId="2" ParentId="8553" CreationDate="2019-10-25T19:34:48.930" Score="4" Body="&lt;p&gt;Yes you can: When you build a noise model the noise is defined with respect to the name &lt;em&gt;or label&lt;/em&gt; of gate objects, so you can use the &lt;em&gt;label&lt;/em&gt;to create multiple versions of a single gate but reference different errors in a noise model (&lt;em&gt;NB: the transpiler strips away label information when it unrolls a gate not in the basis gates set&lt;/em&gt;).&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Selective noise on standard gates&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;For example: Suppose I wanted to create two version of a XGate gate.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.extensions import XGate&#xA;from qiskit.providers.aer.noise import NoiseModel, errors&#xA;&#xA;x_gate = XGate()  # regular X gate&#xA;x1_gate = XGate(label=&quot;x1&quot;)  # first labelled X gate &#xA;x2_gate = XGate(label=&quot;x2&quot;)  # second labelled X gate&#xA;&#xA;x1_error = errors.depolarizing_error(0.1, 1)&#xA;x2_error = errors.depolarizing_error(0.01, 1)&#xA;&#xA;noise_model = NoiseModel()&#xA;noise_model.add_all_qubit_quantum_error(x1_error, x1_gate.label)&#xA;noise_model.add_all_qubit_quantum_error(x2_error, x2_gate.label)&#xA;noise_model.add_basis_gates(['x'])&#xA;print(noise_model)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This makes the noise model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NoiseModel:&#xA;  Basis gates: ['cx', 'id', 'u3', 'x']&#xA;  Instructions with noise: ['x2', 'x1']&#xA;  All-qubits errors: ['x1', 'x2']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Notice the line &lt;code&gt;noise_model.add_basis_gates(['x'])&lt;/code&gt;, since we added a label that isn't recognised as a &lt;em&gt;standard&lt;/em&gt; basis gate, we have to tell the noise model that &lt;code&gt;x&lt;/code&gt; should be in our basis gates (&lt;em&gt;Aside: I hope to streamline this a bit in future versions&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now to use this in a circuit I could have:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3, 3)&#xA;qc.append(x_gate, [0])  # regular noise-free x gate&#xA;qc.append(x1_gate, [1])  # noisy x1 gate&#xA;qc.append(x2_gate, [2])  # noisy x2 gate&#xA;qc.measure([0, 1, 2], [0, 1, 2])&#xA;&#xA;result = execute(qc, Aer.get_backend('qasm_simulator'),&#xA;                 basis_gates=basis_gates,&#xA;                 noise_model=noise_model).result()&#xA;result.get_counts(0)&#xA;&#xA;# Returns something like:&#xA;&#xA;{'101': 40, '111': 980, '011': 4}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So we can see that we have different noise for all 3 X gates.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Selective noise on arbitrary unitary gates&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You can use this to build noisy or ideal versions of any standard gate, and for custom gates using the &lt;code&gt;unitary&lt;/code&gt; gate object. Below I will do same example but with the X gates applied as a unitary matrix using the same labels for the noise model. Note that I need to add &lt;code&gt;'unitary'&lt;/code&gt; to the noise model basis gates so that the unitaries aren't converted into &lt;code&gt;u3&lt;/code&gt; gates:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.extensions import UnitaryGate&#xA;&#xA;x_mat = XGate().to_matrix()&#xA;&#xA;qc = QuantumCircuit(3, 3)&#xA;qc.unitary(x_mat, [0], label='x')&#xA;qc.unitary(x_mat, [1], label='x1')&#xA;qc.unitary(x_mat, [2], label='x2')&#xA;qc.measure([0, 1, 2], [0, 1, 2])&#xA;&#xA;# We need to add unitary to noise model basis gates&#xA;noise_model.add_basis_gates('unitary')&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;result = execute(qc, Aer.get_backend('qasm_simulator'),&#xA;                 basis_gates=basis_gates,&#xA;                 noise_model=noise_model).result()&#xA;result.get_counts(0)&#xA;&#xA;# Returns something like&#xA;&#xA;{'101': 37, '111': 983, '011': 4}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Selective noise on reset and measurement&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;You can also make ideal / noisy measurements or resets using the above trick with a custom gate before measurement or after reset. Eg:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Make a noisy measure instruction&#xA;from qiskit.extensions import IdGate&#xA;tmp = QuantumCircuit(1, 1)&#xA;tmp.append(IdGate(label='noise_meas'), [0])&#xA;tmp.measure(0, 0)&#xA;noise_meas = tmp.to_instruction()  # convert tmp circuit to instruction&#xA;&#xA;# Create a noise model&#xA;noise_model = NoiseModel()&#xA;meas_error = errors.depolarizing_error(0.1, 1)&#xA;noise_model.add_all_qubit_quantum_error(meas_error, 'noise_meas')&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;# Example circuit&#xA;circuit = QuantumCircuit(2, 2)&#xA;circuit.measure([0], [0])&#xA;circuit.append(noise_meas, [1], [1])&#xA;&#xA;result = execute(circuit, Aer.get_backend(&quot;qasm_simulator&quot;),&#xA;                 basis_gates=basis_gates,&#xA;                 noise_model=noise_model).result()&#xA;result.get_counts(0)&#xA;&#xA;# Returns something like&#xA;{'10': 55, '00': 969}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3&gt;Selective noise with basic_device_noise_model&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Finally a comment on using this with basic device noise model. This is a little tricky but can be done. The problem is that if you are not building a noise model from scratch (and so choosing your own labels) the &lt;em&gt;standard&lt;/em&gt; unlabelled gates &lt;code&gt;u1,u2,u3,cx&lt;/code&gt; will be the noisy gates, and you can add custom labels for the ideal u1, u2, u3, cx gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;The transpiler will always convert gates to the noisy u3 etc (eg x-&gt;u3)&lt;/em&gt; So  if you want ideal x you must insert as u3 gate, because all labels of x gates will get unrolled to the noisy u3.&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2019-10-25T19:34:48.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8572" PostTypeId="1" CreationDate="2019-10-26T09:03:28.637" Score="2" ViewCount="31" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;So I came across &lt;a href=&quot;https://physics.stackexchange.com/questions/345402/how-is-conditional-probability-handled-in-quantum-mechanics&quot;&gt;a question&lt;/a&gt; on conditional probability in quantum mechanics:  There's an interesting comment which tells why this does not work for &quot;the non-commutative case&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering, however, since there are more than operators in quantum mechanics one could ask about their relation. For example, there is time which is a parameter. It seems straightforward to compute the conditional probability of an outcome given the time was say &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; by (for example):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P( A|T_1) = |\langle x_A, t_1 | \psi, t_1 \rangle|^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; denotes the event of say measuring the position at a &lt;span class=&quot;math-container&quot;&gt;$x = x_a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; represents the time being say &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; and let pre-measurement state be &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;. But what if one swaps things as:    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(T_1|A) = \frac{| \langle x_a, t_1| \psi, t_1\rangle |^2}{\int_{t_{A-}}^{t_{A+}} | \langle x_a, t| \psi, t\rangle |^2 dt}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This something I figured out here: &lt;a href=&quot;https://physics.stackexchange.com/a/510248/150174&quot;&gt;Physics SE: Conditional probability between parameter and operator in quantum mechanics&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How does this change if we update the question to multiple measurements. For example what is the probability of &lt;span class=&quot;math-container&quot;&gt;$P(A|T_1)$&lt;/span&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$P(B|T_2)$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$T_2 &amp;gt; T_1$&lt;/span&gt; as the time evolution of the wave-function to see &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; depends on the outcome A) - here &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can be different observable's outcomes? How is this related to probability of the times being &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are observed? &lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2021-01-02T11:56:53.723" LastActivityDate="2021-01-02T11:56:53.723" Title="Conditional probability between parameter and operator in quantum mechanics?" Tags="&lt;mathematics&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8573" PostTypeId="1" CreationDate="2019-10-26T11:30:34.707" Score="3" ViewCount="204" Body="&lt;p&gt;Per &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm#Algebraic_proof_of_correctness&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, in Grover's algorithm the probability of observing search string &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; after &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; iterations is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|\begin{bmatrix}\langle \omega | \omega \rangle &amp;amp;\langle \omega | s \rangle\end{bmatrix} (U_sU_\omega )^r \begin{pmatrix} 0 \\ 1\end{pmatrix}\right|^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to derive this expression? Shouldn't it just have been &lt;span class=&quot;math-container&quot;&gt;$|\langle \omega |(U_sU_\omega)^r|s\rangle|^2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2019-10-31T00:58:49.310" LastActivityDate="2019-11-06T21:53:58.393" Title="Probability of observing search string $\omega$ after $r$ iterations" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="8574" PostTypeId="1" AcceptedAnswerId="8605" CreationDate="2019-10-26T11:41:24.463" Score="6" ViewCount="192" Body="&lt;p&gt;In the context of &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm#Algorithm_steps&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt;, the diffusion operator is defined as &lt;span class=&quot;math-container&quot;&gt;$U_s = 2|s\rangle \langle s| - I$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|s\rangle\equiv |+\rangle^{\otimes n}$&lt;/span&gt;. What is the significance of the term &quot;diffusion&quot;? Does it refer to some physical phenomena?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2019-10-26T23:03:15.010" LastActivityDate="2019-10-30T12:43:46.023" Title="Significance of the term &quot;diffusion&quot; in Grover's diffusion operator" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8575" PostTypeId="1" CreationDate="2019-10-26T21:12:15.067" Score="4" ViewCount="68" Body="&lt;p&gt;Presumably quantum mechanics really is the way the universe works, and it appears we don't really understand where the boundary between quantum mechanical phenomena like interference end and classical phenomena begin, but presumably it is not a discrete transition but rather a smooth transition from quantum to classical. Therefore, shouldn't there be computers which are intermediate between &quot;fully quantum&quot; and &quot;fully classical&quot; devices? and might have some intermediate speed-up over fully classical?&lt;/p&gt;&#xA;" OwnerUserId="8877" LastActivityDate="2019-10-27T07:36:40.967" Title="If classical physics emerges in some limit of quantum mechanics, shouldn't there be intermediate classical-quantum computers?" Tags="&lt;classical-computing&gt;&lt;nonclassicality&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8576" PostTypeId="2" ParentId="8574" CreationDate="2019-10-26T23:41:10.380" Score="2" Body="&lt;p&gt;The operator was named &quot;diffusion transform&quot; in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9605043&quot; rel=&quot;nofollow noreferrer&quot;&gt;the original Grover's paper&lt;/a&gt; (see second column of pag. 3) but no explanation is given for the terminology there (and I don't know whether it was &quot;common&quot; at the time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can think of Grover's algorithm as a repeated application of an operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal U=-\mathcal S_i\mathcal S_t$&lt;/span&gt; that is the product of two reflections, the first with respect to the target state, and the second one with respect to the initial state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal S_t\equiv 2|t\rangle\!\langle t| - I,&#xA;\qquad&#xA;\mathcal S_i\equiv 2|i\rangle\!\langle i| - I,$$&lt;/span&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|t\rangle$&lt;/span&gt; are initial and target states. These operators satisfy by construction &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_t|t\rangle=|t\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_t|t_\perp\rangle=-|t_\perp\rangle$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\langle t_\perp|t\rangle=0$&lt;/span&gt;, and similarly for &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To connect this with the more common notation used in expositions of Grover's algorithm, just use &lt;span class=&quot;math-container&quot;&gt;$|i\rangle=|+\rangle^{\otimes n}$&lt;/span&gt; as the initial state. Then, &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_t$&lt;/span&gt; is what is often (e.g. in the Wikipedia page) written as &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_i$&lt;/span&gt; is the &lt;em&gt;diffusion operator&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible rationale for naming &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_i$&lt;/span&gt; a &quot;diffusion operator&quot; is that, of the two operators, it is the one that changes the probability of measuring the target. Indeed, for any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\langle t|\mathcal S_t|\psi\rangle|^2=|\langle t|\psi\rangle|^2.$$&lt;/span&gt;&#xA;You can, therefore, picture the action of &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; as being comprised of one operation (&lt;span class=&quot;math-container&quot;&gt;$\mathcal S_t$&lt;/span&gt;) that only changes the phases of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; without really moving it closer to the target, and another &lt;em&gt;diffusion operation&lt;/em&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mathcal S_i$&lt;/span&gt;) that moves the state towards &lt;span class=&quot;math-container&quot;&gt;$|t\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be fair though, this interpretation only makes sense if you are just looking at the probability of finding the evolving state to be &lt;span class=&quot;math-container&quot;&gt;$|t\rangle$&lt;/span&gt; at every step. One could make the same exact argument but looking at the probability of finding &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; on the initial state, and then we would conclude that &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_t$&lt;/span&gt; should be called &quot;diffusion operator&quot; rather than &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_i$&lt;/span&gt;. Ultimately, the algorithm is entirely symmetric in the way the two reflections act, so I wouldn't read too much into the way the terminology &quot;diffusion operator&quot; is used in this context.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-10-29T15:01:17.433" LastActivityDate="2019-10-29T15:01:17.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8577" PostTypeId="1" AcceptedAnswerId="8579" CreationDate="2019-10-27T01:31:00.280" Score="3" ViewCount="88" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801069&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horodecki et al. (1998)&lt;/a&gt;, to prove that distillability implies having a negative partial transpose (being NPT). The authors use the fact that &quot;&lt;strong&gt;&lt;em&gt;a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is NPT if and only if &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes N}$&lt;/span&gt; is&lt;/em&gt;&lt;/strong&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; being &quot;NPT&quot; means here that that the operator &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; with matrix elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\rho^{T_B})_{ij,k\ell}\equiv\langle ij|\rho^{T_B}|k\ell\rangle=\langle i\ell|\rho|kj\rangle\equiv \rho_{i\ell,kj},$$&lt;/span&gt;&#xA;is not positive (and therefore not a state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is taken in the paper as an elementary fact, and not explicitly proven. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;How can we prove that &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; is not positive if and only if &lt;span class=&quot;math-container&quot;&gt;$(\rho^{\otimes n})^{T_B}$&lt;/span&gt; isn't&lt;/em&gt;&lt;/strong&gt;?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-03-09T22:06:15.790" LastActivityDate="2021-03-09T22:06:15.790" Title="Why is $\rho$ NPT if and only if $\rho^{\otimes N}$ is NPT?" Tags="&lt;entanglement&gt;&lt;partial-transpose&gt;&lt;state-distillation&gt;&lt;ppt-criterion&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8578" PostTypeId="2" ParentId="8575" CreationDate="2019-10-27T01:47:23.767" Score="0" Body="&lt;p&gt;All quantum computers now are partly classical. The experiment is set up using classical math libraries like Numpy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think your instinctive &quot;ur-question&quot;, i.e., &quot;is there really a clear line?&quot;, is a good one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As time goes by (as the song goes) the line will no doubt get very blurry. Or perhaps better put, our understanding of concepts like &quot;classical&quot; and &quot;quantum&quot; will be transformed by our interaction with these devices.&lt;/p&gt;&#xA;" OwnerUserId="7744" LastActivityDate="2019-10-27T01:47:23.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8579" PostTypeId="2" ParentId="8577" CreationDate="2019-10-27T02:24:01.123" Score="4" Body="&lt;p&gt;The short answer is that &lt;span class=&quot;math-container&quot;&gt;$(\rho^{\otimes N})^{T_B}=(\rho^{T_B})^{\otimes N}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More explicitly, if &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_{ii'jj'}\rho_{ii',jj'}|i\rangle\!\langle i'|\otimes |j\rangle\!\langle j'|$&lt;/span&gt;, then we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^{\otimes N}=\sum_{I I' JJ'}\rho_{II',JJ'}\bigotimes_{k=1}^N \Big(|i_k\rangle\!\langle i_k'|\otimes |j_k\rangle\!\langle j_k'|\Big),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I\equiv(i_1,...,i_N)$&lt;/span&gt; and same for &lt;span class=&quot;math-container&quot;&gt;$I',J,J'$&lt;/span&gt;.&#xA;Alternatively, we can write this state highlighting the bipartite structure still present in &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes N}$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^{\otimes N}=&#xA;\sum_{I I' JJ'}\rho_{II',JJ'}&#xA;\left(\bigotimes_{k=1}^N |i_k\rangle\!\langle i_k'|\right)&#xA;\otimes&#xA;\left(\bigotimes_{k=1}^N |j_k\rangle\!\langle j_k'|\right).$$&lt;/span&gt;&#xA;The partial transpose operator then acts on it as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(\rho^{\otimes N})^{T_B} =&#xA;\sum_{I I' JJ'}\rho_{II',JJ'}&#xA;\left(\bigotimes_{k=1}^N |i_k\rangle\!\langle i_k'|\right)&#xA;\otimes&#xA;\left(\bigotimes_{k=1}^N |j_k'\rangle\!\langle j_k|\right).\end{align}&lt;/span&gt;&#xA;In short, this means that the partial transpose effectively operates by changing &lt;span class=&quot;math-container&quot;&gt;$\rho_{II',JJ'}\to \rho_{II',J'J}$&lt;/span&gt;.&#xA;But the coefficients &lt;span class=&quot;math-container&quot;&gt;$\rho_{II',JJ'}$&lt;/span&gt; also have a known structure, given by the tensor product operation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{II',JJ'}=\prod_{k=1}^N \rho_{i_k i_k',j_k j_k'},$$&lt;/span&gt;&#xA;and the coefficients on the RHS of this expression are exactly what you would get computing explicitly the matrix elements of &lt;span class=&quot;math-container&quot;&gt;$(\rho^{T_B})^{\otimes N}$&lt;/span&gt;, thus the result follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(\rho^{T_B})^{\otimes N} &amp;amp;=&#xA;\left(\sum_{ii',jj'}\rho_{ii',jj'}\big(|i\rangle\!\langle i'|\otimes|j'\rangle\!\langle j|\big)\right)^{\otimes N}\\&#xA;&amp;amp;=&#xA;\sum_{II'JJ'}\rho_{II',JJ'}&#xA;\bigotimes_{k=1}^N \Big(|i_k\rangle\!\langle i_k'|\otimes |j_k'\rangle\!\langle j_k|\Big) \\&#xA;&amp;amp;\simeq \sum_{II'JJ'}\rho_{II',JJ'}&#xA;\left(\bigotimes_{k=1}^N |i_k\rangle\!\langle i_k'|\right)&#xA;\otimes&#xA;\left(\bigotimes_{k=1}^N |j_k'\rangle\!\langle j_k|\right)&#xA;=(\rho^{\otimes N})^{T_B}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-10-27T16:07:54.110" LastActivityDate="2019-10-27T16:07:54.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8580" PostTypeId="2" ParentId="8575" CreationDate="2019-10-27T07:36:40.967" Score="2" Body="&lt;p&gt;You're presumably thinking of a spectrum with classical mechanics at one end and quantum mechanics at another, with some hazy &quot;classical-quantum&quot; in between. That's not a great way to think about it. Classical mechanics is more of a practical &lt;em&gt;approximation&lt;/em&gt; of quantum mechanics under certain conditions (cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Classical_limit&quot; rel=&quot;nofollow noreferrer&quot;&gt;classical limit&lt;/a&gt;), as per the &lt;a href=&quot;https://en.wikipedia.org/wiki/Correspondence_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;correspondence principle&lt;/a&gt;. Even in &lt;a href=&quot;https://en.wikipedia.org/wiki/Semiclassical_physics&quot; rel=&quot;nofollow noreferrer&quot;&gt;semiclassical physics&lt;/a&gt;, one part of the system is approximated to be classical (say external electromagnetic fields), as it's a pretty good working approximation anyway, while for the other part the precision of quantum mechanics is required (e.g. electrons in an electromagnetic field). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There certainly are &quot;semiclassical methods&quot; of computation that provide speedup over regular classical computation but are, in theory, slower than full-fledged quantum computation. For instance, the Fourier sampling in Shor's algorithm for factorization on a quantum computer can be carried out in a semiclassical way by using the “classical” (macroscopic) signal resulting from measuring one bit to determine the type of measurement carried out on the next bit, and so forth (cf. &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.76.3228&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. Lett. &lt;strong&gt;76&lt;/strong&gt;, 3228&lt;/a&gt;). However, this is quite different from your mental image of computers working in some &lt;em&gt;transition regime&lt;/em&gt; between classical and quantum physics. In essence, it's just that for some part of the computation we're using classical techniques while for others we're using the speedup of quantum algorithms. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-10-27T07:36:40.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8583" PostTypeId="1" AcceptedAnswerId="8591" CreationDate="2019-10-27T09:30:13.167" Score="6" ViewCount="130" Body="&lt;p&gt;Let us consider &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Ising_(YY)_coupling_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli YY coupling&lt;/a&gt; gate of the following form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;YY_\phi=&#xA;\left(\begin{matrix}&#xA;  \cos(\phi) &amp;amp; 0 &amp;amp; 0 &amp;amp; i \sin(\phi) \\&#xA;  0 &amp;amp; \cos(\phi) &amp;amp; -i \sin(\phi) &amp;amp; 0 \\&#xA;  0 &amp;amp; -i \sin(\phi) &amp;amp; \cos(\phi) &amp;amp; 0 \\&#xA;  i \sin(\phi) &amp;amp; 0 &amp;amp; 0 &amp;amp; \cos(\phi)&#xA;\end{matrix}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to use this gate but I struggle rewriting it as product of unitaries representing the basic universal quantum gates (&lt;span class=&quot;math-container&quot;&gt;$Rz(\phi)$&lt;/span&gt;, CNOT, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{8}$&lt;/span&gt; gate).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A textbook by Nielsen &amp;amp; Chuang provides some gate identities allowing to write them (page 185, (4.32)-(4.39)) but YY is not listed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to match this form using by trial and error but there was always at least one sign that was wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone give some hints how to factor it out into usable gates or maybe provide a reference with circuit which implements this gate?&lt;/p&gt;&#xA;" OwnerUserId="8883" LastEditorUserId="26" LastEditDate="2019-10-27T17:44:04.760" LastActivityDate="2019-10-28T07:49:43.087" Title="How to factor Ising YY coupling gate into product of basic gates?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8585" PostTypeId="1" AcceptedAnswerId="8594" CreationDate="2019-10-27T19:00:37.650" Score="6" ViewCount="146" Body="&lt;p&gt;I've been  trying to figure this out for a while and I'm totally lost.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My goal is to show that for two density operators &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, that &lt;span class=&quot;math-container&quot;&gt;$$||p^{\otimes n} - q^{\otimes n}|| \leq n ||p-q||$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I have constructed a weak inductive hypothesis over n to get &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||p^{\otimes (n-1)} - q^{\otimes (n-1)}|| \leq (n-1) ||p-q||$$&lt;/span&gt;&#xA;However, I'm having a great deal of difficulty manipulating my tensor products on the LHS to be able to use my IH.  What first steps can be taken?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The norm being used here is the trace norm.&lt;/p&gt;&#xA;" OwnerUserId="8889" LastEditorUserId="26" LastEditDate="2019-10-27T19:30:36.017" LastActivityDate="2019-10-30T08:46:44.037" Title="Prove that $\|p^{\otimes n} - q^{\otimes n}\| \leq n \|p-q\|$ for density operators $p,q$" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;&lt;tensor-product&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8586" PostTypeId="1" CreationDate="2019-10-27T22:47:51.423" Score="8" ViewCount="79" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\def\braket#1#2{\langle#1|#2\rangle}\def\bra#1{\langle#1|}\def\ket#1{|#1\rangle}$&lt;/span&gt; &#xA;In &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;noreferrer&quot;&gt;MW05&lt;/a&gt; the authors demonstrate so-called &quot;in-place&quot; amplitude amplification for QMA, exhibiting a method for Arthur to amplify his success probability without requiring any increase in the size of Merlin's witness state. Call the original machine &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and the amplified machine &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the input, the original machine is  &lt;span class=&quot;math-container&quot;&gt;$M(x,w)$&lt;/span&gt; and the amplified machine  is &lt;span class=&quot;math-container&quot;&gt;$M'(x,w)$&lt;/span&gt;. The approach of MW05 does not guarantee that a witness state that was in the accepting set for &lt;span class=&quot;math-container&quot;&gt;$M(x,\cdot)$&lt;/span&gt; (i.e. that made &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; accept input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with probability exceeding, say, &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt;)  is still in the accepting set for &lt;span class=&quot;math-container&quot;&gt;$M'(x, \cdot)$&lt;/span&gt; (i.e. those states that make &lt;span class=&quot;math-container&quot;&gt;$M'(x, \cdot)$&lt;/span&gt; accept with amplified probability). I explain why I think that it's actually not possible to make their method do this below the line. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Q: Is there a way to perform amplification of QMA machines without increasing the length of Merlin's witness and while also guaranteeing that all initially valid witnesses for a given input stay valid witnesses for this input?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Without explaining too much context and using their notation, the issue that seems to arise is that MW05 first proves that their approach works for states that are eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;. This is good enough for completeness because if there's a state that accepts with probability &lt;span class=&quot;math-container&quot;&gt;$p \geq a$&lt;/span&gt; then there's an eigenvector with success probability at least &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. However, I don't think this can be used to show that any &quot;good&quot; witness also accepts w.h.p. after amplification. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general a &quot;good&quot;  witness &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;.  will be some linear combination of eigenvectors &lt;span class=&quot;math-container&quot;&gt;$\sum_j \alpha_j\ket{\psi_j}$&lt;/span&gt;, some of which are &quot;good&quot; and have acceptance probability &lt;span class=&quot;math-container&quot;&gt;$\geq a$&lt;/span&gt; and others of which are &quot;bad&quot; and have acceptance probability &lt;span class=&quot;math-container&quot;&gt;$\leq b$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; be the set of &quot;good&quot; witness eigenvectors. Then, once we amplify, our success probability is roughly (for &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; large enough I guess) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{j \in S} |\alpha_j|^2(1-2^{-r}).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general &lt;span class=&quot;math-container&quot;&gt;$\sum_{j \in S} |\alpha_j|^2$&lt;/span&gt; isn't &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; so we're in trouble. In the worst case of witness eigenvectors, we can even construct a &quot;good&quot; witness &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; that after &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;-rounds of amplification accepts with probability roughly &lt;span class=&quot;math-container&quot;&gt;$\frac{a-b}{1-b}(1-2^{-r}) \leq \frac{1}{2}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$(a,b) = (\frac{2}{3}, \frac{1}{3})$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="8758" LastEditorUserId="55" LastEditDate="2019-10-28T10:14:42.427" LastActivityDate="2019-10-28T10:14:42.427" Title="Better &quot;In-Place&quot; Amplification of QMA" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8587" PostTypeId="1" CreationDate="2019-10-27T23:59:16.030" Score="4" ViewCount="127" Body="&lt;p&gt;I was wondering if anyone had a sample code for running a general MILP problem. I saw some coding for some very specific problems and I thought they were kind of far away from what we needed.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{minimize } \, D^TX+E^TY \, \text{ s.t. }\\&#xA;AX + BY + C \le 0 \\&#xA;x_i \ge 0 \\&#xA;y_i \in \mathbb{Z}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If anyone has already started generalizations or would like to start I would love to be a part of that. I also tried to get on Slack but was unable to, could anyone help me with that?&lt;/p&gt;&#xA;" OwnerUserId="8892" LastEditorUserId="10480" LastEditDate="2021-01-22T21:26:54.540" LastActivityDate="2021-01-22T21:26:54.540" Title="General mixed integer linear programming problem with quantum computers" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;resource-request&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8588" PostTypeId="1" CreationDate="2019-10-28T04:15:15.657" Score="1" ViewCount="32" Body="&lt;p&gt;How do I get from equation 1.31 to equation 1.32? It seems like some terms are changing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/94aFM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/94aFM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8897" LastEditorUserId="26" LastEditDate="2019-10-28T08:22:40.477" LastActivityDate="2019-10-28T08:22:40.477" Title="Clarification of bra-ket notation" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;tensor-product&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2019-10-28T08:54:28.090" ContentLicense="CC BY-SA 4.0" />
  <row Id="8589" PostTypeId="1" CreationDate="2019-10-28T04:59:13.177" Score="1" ViewCount="63" Body="&lt;p&gt;Some countries like India are using standalone electronic voting machines (EVM) for elections. They are not interconnected, use no power cables (run on battery), no wireless cards and are secure because after every voter votes he can tally his vote by looking at a printed paper slip (on The Voter Verifiable Paper Audit Trail (VVPAT) Unit) which has his/her candidate and party symbol displayed for 7 seconds and no one can take this paper slips out of the machine. If an attack happens on the EVM machine then votes counted on the machine won't get tallied with manual paper slips.&#xA;Theoretically, we go for quantum voting because classical voting is based on Prime Factorization, Discrete Log Problem which can be broken by Shor's Algorithm. But can quantum voting machines (if developed) have any practical advantage over the EVM?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="26" LastEditDate="2019-10-28T08:30:19.187" LastActivityDate="2019-10-28T08:30:19.187" Title="Can Quantum Voting Machine replace Electronic Voting Machine (EVM) in future?" Tags="&lt;classical-computing&gt;&lt;applications&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8590" PostTypeId="2" ParentId="5921" CreationDate="2019-10-28T05:55:24.667" Score="6" Body="&lt;p&gt;In the paper I called it the Burnside decomposition, but it looks like the standard name is the Wedderburn decomposition.  That might simply have been a mistake in terminology on my part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, there are two good ways to get the summands to be &lt;span class=&quot;math-container&quot;&gt;$V \otimes V^*$&lt;/span&gt;.  (Of course they are closely related.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) You can interpret &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; as an associative algebra.  In this case, the theorem is that &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; is a direct sum of matrix algebras, one for each irrep &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;.  You can identify the vector space of operators on &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$V \otimes V^*$&lt;/span&gt;.  This interpretation motivates the terminology which is sometimes used that &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is the &quot;column space&quot; and &lt;span class=&quot;math-container&quot;&gt;$V^*$&lt;/span&gt; is the &quot;row space&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You can interpret &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}[G]$&lt;/span&gt; as a bimodule with both a left and right &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; action.   In this case each summand can be read as &lt;span class=&quot;math-container&quot;&gt;$V_{\text{left}} \otimes V^*_{\text{right}}$&lt;/span&gt;.   By definition &lt;span class=&quot;math-container&quot;&gt;$G_\text{left}$&lt;/span&gt; acts trivially on &lt;span class=&quot;math-container&quot;&gt;$V^*_{\text{right}}$&lt;/span&gt; and vice versa, so that each of the two tensor factors is the multiplicity space for the opposite action.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The bimodule picture also shows up in other cases such as Schur-Weyl duality. In the case of Schur-Weyl duality, both &lt;span class=&quot;math-container&quot;&gt;$\text{GL}(V)$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$U(V)$&lt;/span&gt; if you want to be quantum) and &lt;span class=&quot;math-container&quot;&gt;$S_n$&lt;/span&gt; act on &lt;span class=&quot;math-container&quot;&gt;$V^{\otimes n}$&lt;/span&gt;.  You again get this cool decomposition into summands &lt;span class=&quot;math-container&quot;&gt;$M_\lambda \otimes V_\lambda$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$M_\lambda$&lt;/span&gt; is an irrep of &lt;span class=&quot;math-container&quot;&gt;$S_n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$V_\lambda$&lt;/span&gt; is an irrep of &lt;span class=&quot;math-container&quot;&gt;$\text{GL}(V)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$U(V)$&lt;/span&gt;, and each tensor factor is the multiplicity space of the action of the other group.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-10-28T18:41:12.247" LastActivityDate="2019-10-28T18:41:12.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8591" PostTypeId="2" ParentId="8583" CreationDate="2019-10-28T07:49:43.087" Score="2" Body="&lt;p&gt;I did it like this (no promises that it's minimal!):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7AOBo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7AOBo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;Basically, I realised that by swapping the second and last rows and columns of your target matrix (achieved using the first and last controlled-nots in the circuit), you get something this is very nearly of the form &lt;span class=&quot;math-container&quot;&gt;$I\otimes R_x(\phi)$&lt;/span&gt;, except that one of the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; blocks would need to have the angle &lt;span class=&quot;math-container&quot;&gt;$-\phi$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. I used a controlled phase gate and the relation &lt;span class=&quot;math-container&quot;&gt;$ZR_x(\phi)Z=R_x(-\phi)$&lt;/span&gt; to change the angle of that block. Then it was a case of rewriting it into the specified gate set.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-28T07:49:43.087" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8592" PostTypeId="1" AcceptedAnswerId="8596" CreationDate="2019-10-28T08:10:41.373" Score="5" ViewCount="269" Body="&lt;p&gt;I am trying to implement the following circuit &lt;a href=&quot;https://i.stack.imgur.com/eWtAC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eWtAC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and my code is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mxCpZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mxCpZ.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above circuit has size 5 and depth 3. My question is, how can I run the circuit parallelly. I mean, the gate &lt;code&gt;circuit.cx(qr[0], qr[1])&lt;/code&gt; and gate &lt;code&gt;circuit.cx(qr[2], qr[3])&lt;/code&gt; will be run at the same time and the total running time is dominated by the depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a related question in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6697/creating-and-running-parallel-circuits-in-qiskit&quot;&gt;Creating and running parallel circuits in Qiskit&lt;/a&gt;. However, in that question, the author tries to run several independent experiments rather than run the gates in a circuit parallelly.&lt;/p&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="26" LastEditDate="2019-10-28T09:08:30.283" LastActivityDate="2019-10-28T12:04:39.503" Title="How to parallelly run a quantum circuit on IBMQ?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8593" PostTypeId="1" CreationDate="2019-10-28T09:48:12.233" Score="5" ViewCount="425" Body="&lt;p&gt;Beginners question, so please stay on the beginner's level with possible answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know very well what a qubit, superposition, and entanglement is. Also, I am familiar with several physical realizations so to speak of qubits and entanglement and their lifetime, coherence factors, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, I don't understand how a &quot;computation&quot; inside e.g. 1 or 2 qubits actually runs. And when I understand it correctly multiple &quot;computations&quot; may run in parallel?  How to imagine this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot find texts that essentially explain this.&lt;/p&gt;&#xA;" OwnerUserId="8904" LastEditorUserId="55" LastEditDate="2019-10-30T15:40:22.333" LastActivityDate="2019-10-30T15:40:22.333" Title="Can I imagine quantum computers as working via parallel computing?" Tags="&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8594" PostTypeId="2" ParentId="8585" CreationDate="2019-10-28T10:26:53.130" Score="7" Body="&lt;p&gt;Hint: To make your induction work, write &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\eqalign{p^{\otimes n} - q^{\otimes n} &amp;amp; = &amp;amp; \left(p^{\otimes(n-1)}\otimes p \right)-\left(q^{\otimes (n-1)} \otimes q\right)\\&#xA;&amp;amp; = &amp;amp; \left(p^{\otimes(n-1)}-q^{\otimes (n-1)} \right)\otimes p+\left(q^{\otimes (n-1)} \right) \otimes (p-q)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, use triangle inequality and finally the fact that your norm is the trace norm, i.e. you will need &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(A\otimes B) = \text{Tr}(A) \text{Tr}(B)$&lt;/span&gt;. Then, note that &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q^{\otimes (n-1)}$&lt;/span&gt; are density operators with have unit trace by definition.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="121" LastEditDate="2019-10-30T08:46:44.037" LastActivityDate="2019-10-30T08:46:44.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8596" PostTypeId="2" ParentId="8592" CreationDate="2019-10-28T12:04:39.503" Score="6" Body="&lt;p&gt;Qiskit implements a transpiler which optimizes the circuits that you provide. This means it modifies the circuit so that it can be run on the backend and also optimizes it so that anything that can possibly be run in parallel is done so. To run with the maximum level of optimization you can run &lt;code&gt;execute(circuit, optimization_level=3)&lt;/code&gt;. There is more information about the transpiler &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/5_using_the_transpiler.ipynb&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you would like even finer control of when things are executed you can create a Pulse Schedule. There is more information about this &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/terra/5_pulse_schedules.ipynb&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-10-28T12:04:39.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8597" PostTypeId="1" AcceptedAnswerId="8598" CreationDate="2019-10-28T14:37:17.220" Score="2" ViewCount="118" Body="&lt;p&gt;So I was wondering about the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can encode an algorithm in position &lt;span class=&quot;math-container&quot;&gt;$\hat x$&lt;/span&gt; in quantum mechanics.&#xA;However, in QFT position is not an operator it becomes a parameter &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone expressed concern that quantum field theory (QFT) will become relevant in the scale-up when creating a quantum computer and thus one should be careful about the second quantization of operators?&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2021-01-02T11:56:48.380" LastActivityDate="2021-01-02T11:56:48.380" Title="Could second quantisation and QFT become a problem when scaling up quantum computers?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8598" PostTypeId="2" ParentId="8597" CreationDate="2019-10-28T17:04:25.497" Score="2" Body="&lt;p&gt;QFT (more specifically QED) is already at the heart of quantum computation.  Second quantization formalism is used even in constructing toy models for quantum computers (&lt;em&gt;see e.g.&lt;/em&gt;, Section 7.3.2 of Nielsen and Chuang).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many of the rapid advances in superconducting quantum processors over the past decade can be attributed to the introduction of circuit Quantum Electrodynamics (cQED, introduced &lt;a href=&quot;https://rsl.yale.edu/sites/default/files/physreva.69.pdf.cavity_quantum_electro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/cond-mat/0407325&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, &lt;a href=&quot;https://rsl.yale.edu/sites/default/files/files/RSL_Theses/SchusterThesis.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;full exposition&lt;/a&gt;, &lt;a href=&quot;https://cs269q.stanford.edu/lectures/lecture11.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt;), and the closely related introduction of the transmon (&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0703002&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).  As suggested by the nomenclature these architectures are built on QED rather than non-relativistic QM.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2019-10-28T17:04:25.497" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8599" PostTypeId="2" ParentId="8585" CreationDate="2019-10-28T20:10:45.200" Score="8" Body="&lt;p&gt;Marsl is correct, and his &quot;hint&quot; is really more a sketch of a solution than a hint.  Rather than viewing the question or its solution as just formal algebra, you can also approach his same solution more conceptually.  The conceptual reasoning is really identical to the algebra, just phrased differently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can rely on the following two facts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Trace norm is a type of distance between states; in particular it satisfies the triangle inequality.  Sometimes it is called trace distance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Since trace norm represents distinguishability of states, it satisfies the relation &lt;span class=&quot;math-container&quot;&gt;$\mathrm{dist}(p \otimes r,q \otimes r) = \mathrm{dist}(p,q)$&lt;/span&gt;.   In other words, Alice's state &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and Bob's state &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; become no more and no less distinguishable if you also give Alice and Bob each a copy of another state &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.  You are allowed to have a copy of the state &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; in your brain if you are asked to distinguish &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the argument is that using (1) and (2), you can get from &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; copies of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; copies of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, &lt;em&gt;i.e.&lt;/em&gt;, from &lt;span class=&quot;math-container&quot;&gt;$p^{\otimes n}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q^{\otimes n}$&lt;/span&gt;, by replacing the states one by one.  You thus get an upper bound of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times &lt;span class=&quot;math-container&quot;&gt;$\mathrm{dist}(p,q)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-10-28T23:05:56.283" LastActivityDate="2019-10-28T23:05:56.283" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8600" PostTypeId="2" ParentId="8573" CreationDate="2019-10-29T05:49:58.270" Score="3" Body="&lt;p&gt;The mapping scheme set up by the author in this section is different from that of normal unitary operations.  In the context of this equation, the author is referring to the (non-unitary) action of &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; on a particular two dimensional subspace of the full Hilbert space, specifically on the plane defined by the (non-orthogonal, non-complete) basis vectors &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert \omega \rangle, \vert s \rangle \rbrace$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The action of &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; in this basis is shown to be &lt;span class=&quot;math-container&quot;&gt;$$U_s U_\omega = \begin{bmatrix} 1 &amp;amp; \frac{2}{\sqrt{N}} \\ \frac{-2}{\sqrt{N}} &amp;amp; 1- \frac{4}{N} \end{bmatrix},$$&lt;/span&gt; which is clearly not unitary.  &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; refers to this specific action in both the referenced equation and the following discussion.   In this context, &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; is an element of &lt;span class=&quot;math-container&quot;&gt;$SL(2, \mathbb{R})$&lt;/span&gt;, and the system is set up geometrically such that &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; effects rotations within the plane spanned by &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert \omega \rangle, \vert s \rangle \rbrace$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The mapping for the action of &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_s U_\omega : a \vert \omega \rangle + b \vert s \rangle \mapsto \begin{bmatrix} \vert \omega \rangle &amp;amp; \vert s \rangle \end{bmatrix} U_s U_\omega \begin{bmatrix} a \\ b \end{bmatrix},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} \vert \omega \rangle &amp;amp; \vert s \rangle \end{bmatrix}$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$N \times 2$&lt;/span&gt; matrix.  The author uses this mapping to rotate &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde s \rangle$&lt;/span&gt; (the latter designation introduced here for clarity) according to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert s \rangle = 0 \vert \omega  \rangle + 1 \vert s \rangle \xrightarrow{(U_s U_\omega)^r} \begin{bmatrix} \vert \omega \rangle &amp;amp; \vert s \rangle \end{bmatrix} (U_s U_\omega)^r \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \vert \tilde s \rangle, $$&lt;/span&gt;&#xA;where the transformed vector, &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde s \rangle$&lt;/span&gt;, is &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; rotated by &lt;span class=&quot;math-container&quot;&gt;$(U_s U_\omega)^r$&lt;/span&gt; within the desired plane.  The inner product of the rotated vector &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde s \rangle$&lt;/span&gt; with the dual vector of the marked state &lt;span class=&quot;math-container&quot;&gt;$\vert \omega \rangle$&lt;/span&gt; is evaluated, using the Jordan normal form provided in the article, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \omega \vert \tilde s \rangle = \begin{bmatrix} \langle \omega \vert \omega \rangle &amp;amp; \langle \omega \vert s \rangle \end{bmatrix} U_s U_\omega \begin{bmatrix} 0 \\ 1 \end{bmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \begin{bmatrix} 1 &amp;amp; \frac{1}{\sqrt{N}} \end{bmatrix} \begin{bmatrix} -i &amp;amp; i \\  e^{i t} &amp;amp; e^{-i t} \end{bmatrix} \begin{bmatrix} e^{i \, 2rt} &amp;amp; 0 \\ 0 &amp;amp; e^{-i \, 2rt} \end{bmatrix} \left( \tfrac{i}{2 \cos{t}} \right) \begin{bmatrix} e^{-i t} &amp;amp; -i \\ -e^{i t} &amp;amp; -i \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\langle \omega \vert s \rangle = \tfrac{1}{\sqrt{N}}$&lt;/span&gt; from earlier in the article and &lt;span class=&quot;math-container&quot;&gt;$t \equiv \arcsin \tfrac{1}{\sqrt{N}}$&lt;/span&gt;.  Carrying through the multiplication leads to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \omega \vert \tilde s \rangle = \tfrac{1}{2\cos t} \left(\tfrac{1}{\sqrt{N}}(e^{i(2rt+t)}+e^{-i(2rt+t)}) - i (e^{i\,2rt}-e^{-i\,2rt}) \right)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\tfrac{1}{\cos t} \left(\sin t \cos(2rt+t) + \sin 2rt \right).$$&lt;/span&gt;&#xA;Using the angle sum identity for &lt;span class=&quot;math-container&quot;&gt;$\cos(2rt+t)$&lt;/span&gt; gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \omega \vert \tilde s \rangle = \tfrac{1}{\cos t} \left( \sin t (\cos t \cos 2rt - \sin t \sin 2rt ) + \sin 2rt \right)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\sin t \cos 2rt + \sin 2rt \left( \tfrac{1-\sin{}^2t}{\cos t} \right) = \sin ((2r+1)t),$$&lt;/span&gt;&#xA;which is the identity the author was working towards.  The probability of observing &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; after &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; iterations is then simply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \langle \omega \vert \tilde s \rangle \vert^2 = \sin{}^2((2r+1)t),$$&lt;/span&gt;&#xA;as desired.  Note, however, that in this case the norm on the LHS could be replaced by parentheses, since the derivation above shows that &lt;span class=&quot;math-container&quot;&gt;$\langle \omega \vert \tilde s \rangle$&lt;/span&gt; is guaranteed to be real.  This is not surprising since the operator in the relevant plane is in &lt;span class=&quot;math-container&quot;&gt;$SL(2,\mathbb{R})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While not directly responsive to the question, there is some interesting group/representation theory underpinning the math above.  Without going into detail, it seems worth noting that &lt;span class=&quot;math-container&quot;&gt;$\vert \text{Tr}(U_s U_\omega) \vert &amp;lt;2$&lt;/span&gt; implies that &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; is elliptic and therefore conjugate to a rotation, and that &lt;span class=&quot;math-container&quot;&gt;$SL(2,\mathbb{R}) \cong SU(1,1) \cong Sp(2,\mathbb{R})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-10-30T21:53:50.413" LastActivityDate="2019-10-30T21:53:50.413" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8601" PostTypeId="1" CreationDate="2019-10-29T06:23:06.093" Score="1" ViewCount="98" Body="&lt;p&gt;So let's say there are &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; experimentalists who have density matrix systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. They both agree that for the experiment they need identical density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \rho_B$&lt;/span&gt; which is a mixed state. My question is how do they agree upon &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \rho_B$&lt;/span&gt;? (Like the classical probabilities might be approximately the same but not exact) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean if they do a measurement they change the density matrix and get a pure state. They can't use Noether's theorem of energy for time invariance as the measurement is immune to that since the measurement can have different outcomes to the same initial condition (Born rule). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now one can argue that the production of the density matrices uses some kind Noether invariant for example it would mean they that they were created at spatially different locations but are the same due construction invariance. However, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can still say his measurement of the invariant is correct versus the measurement of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;? (where the invariant is the net momentum)&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Is there an algorithm to count how many &quot;eigenvalues&quot; / quantify how much information &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; disagree upon? &lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2020-12-21T23:51:06.050" LastActivityDate="2020-12-21T23:51:06.050" Title="About production and disagreements between density matrices" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8603" PostTypeId="2" ParentId="8601" CreationDate="2019-10-29T13:04:06.377" Score="3" Body="&lt;p&gt;There are a few strategies/arguments one might make.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, density matrices often represent an individual's state of knowledge rather than some absolute state. To that end, if two experimentalists aim to produce the same state, and have the same level of uncertainty in their equipment: random number generators, basis choice etc., then their descriptions of their outcomes are identical, and those would be the best descriptions anyone could give them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may not feel entirely satisfied with that answer, so I have another idea which may be a little more convincing: tell each experiemntalist to make their own maximally entangled state of two systems. Then take one of those systems as their density matrix. It should be a maximally entangled state. This has certain advantages about being basis independent, and not involving any randomness. However, there's still the issue of experimental inaccuracy and not quite producing a maximally entangled state. I think there will always be something like that that you can't really deal with if you don't accept my first comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One possible route would be to consider random states. If you create a large enough random state, then subsystems of it are almost certainly maximally entangled (that's a very crude paraphrasing. It's a sort of result that Andreas Winter made a lot of use of, so that's probably where you can find a better statement.) Random states, and that sort of result, are likely to be quite robust against experimental imperfections.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-10-29T13:04:06.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8604" PostTypeId="1" CreationDate="2019-10-29T13:13:34.200" Score="5" ViewCount="44" Body="&lt;p&gt;In &lt;a href=&quot;https://youtu.be/nqlA9YxMZwI?t=984&quot; rel=&quot;nofollow noreferrer&quot;&gt;this talk&lt;/a&gt;, and the corresponding slides &lt;a href=&quot;https://pdfs.semanticscholar.org/b7b8/d21bbcb9005afde18f44aeb637e59bbf5292.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;on page 24/44&lt;/a&gt;, Brandao talks about the max eigenvalue problem which is: Given a Hermitian  &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, approximate its largest eigenvalue. (Note that this is basically the problem of finding the ground state energy for Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$-H$&lt;/span&gt;) He then suggests the following algorithm to solve this problem with a quantum computer:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare the Gibbs state &lt;span class=&quot;math-container&quot;&gt;$\rho=e^{\beta H}/\text{tr}(e^{\beta H})$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Cool down the system, i.e. take the limit &lt;span class=&quot;math-container&quot;&gt;$\beta \to \infty$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I can see, how in this limit, the Gibbs state tends to the ground state of &lt;span class=&quot;math-container&quot;&gt;$-H$&lt;/span&gt;, i.e. the maximum eigenvalue state of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; since in the eigenbasis with eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; given by &lt;span class=&quot;math-container&quot;&gt;$E_1\geq E_2 \geq \dots \geq E_n$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho=e^{\beta H}/\text{tr}(e^{\beta H})&amp;amp;=\frac{1}{\sum_{i=1}^n e^{\beta E_i}}\text{diag}(e^{\beta E_1}, \dots,e^{\beta E_n} )\\&#xA;&amp;amp;=\frac{1}{1+\sum_{i=2}^n e^{\beta (E_i-E_1)}}\text{diag}(1, e^{\beta (E_2-E_1)} \dots,e^{\beta (E_n-E_1)} )\\&#xA;&amp;amp; \overset{\beta\to\infty}{\to} \text{diag}(1, 0, \dots, 0)&#xA;\end{align}&lt;/span&gt;&#xA;and thus the state ends up in the pure state &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi_{max}\rangle \langle \psi_{max}|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\psi_{max}\rangle $&lt;/span&gt; is the eigenstate to the maximum eigenvalue &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So far, so good. Now, I have two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Brandao has on his slides the result that cooling down to &lt;span class=&quot;math-container&quot;&gt;$\beta = O(\log (n) /\delta)$&lt;/span&gt; one can approximate the max eigenvalue to precision &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;. How do you derive this? Does one need to solve &lt;span class=&quot;math-container&quot;&gt;$|E_1-\text{tr}(\rho H)|&amp;lt;\delta$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;li&gt;In this abstract algorithm, how does one actually get the eigenvalue from the cooled down Gibbs state? One still has to measure the system somehow as far as I understand.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-10-29T13:13:34.200" Title="Max eigenvalue algorithm via annealing starting from Gibbs state" Tags="&lt;algorithm&gt;&lt;annealing&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8605" PostTypeId="2" ParentId="8574" CreationDate="2019-10-29T14:29:24.627" Score="6" Body="&lt;p&gt;I had forwarded this question to Dr. Lov Grover and received the following response.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I guess inversion about average is a better name for the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{W}\mathbb I_0\mathrm{W}$&lt;/span&gt;&#xA;transformation. When I initially did the algorithm, I called this the&#xA;diffusion transform because I was familiar with classical diffusion&#xA;and this is what this transform accomplished - it drove an equal&#xA;probability from any state to every other state (at least initially).&lt;/p&gt;&#xA;&lt;p&gt;Later on, I realized this was the same as the Householder&#xA;transformation in Linear Algebra. There probably exist more&#xA;applications in that direction (e.g. using quantum computing to&#xA;implement given rotations in optimization) but I have not pursued&#xA;them.&lt;/p&gt;&#xA;&lt;p&gt;Best wishes, &lt;br&gt;Lov&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; he means &lt;strong&gt;classical diffusion&lt;/strong&gt; in &lt;a href=&quot;https://en.wikipedia.org/wiki/Diffusion#Random_walk_(random_motion)&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; (random walk) sense. It's still not exactly clear what he means by &amp;quot;drove an equal probability from any state to every other state&amp;quot;; if anyone can decipher it, let me know in a comment!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updates&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Ahh! You computer scientists don't understand much of that language, unfortunately.&lt;/p&gt;&#xA;&lt;p&gt;The physical idea is to scatter the particle rapidly, then apply a potential function, that attracts the particle to the T state - a potential function is just a phase rotation &amp;amp; the IAA is the diffusion transform.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;IAA = Inversion about average&lt;/p&gt;&#xA;&lt;p&gt;For the relation between rotation and accumulation see any QM text under Schrödinger equation. I wrote a paper on that - &lt;a href=&quot;https://link.springer.com/article/10.1007/s12043-001-0128-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;From Schrödinger’s equation to the quantum search algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The cited paper actually addresses the physical motivation for the diffusion transform! You may access a preprint version of the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0109116&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. It looks like a phenomenal paper that gives us glimpses into how Grover thought of and designed his flagship algorithm. It's interesting to note that the motivation for the search algorithm was mostly from physics (Grover wasn't a computer scientist), and by the same token it's unfortunate that none of the quantum computing textbooks, as far as I know, mention this aspect of the algorithm.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-10-30T12:43:46.023" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8606" PostTypeId="1" AcceptedAnswerId="8687" CreationDate="2019-10-29T21:28:06.870" Score="3" ViewCount="199" Body="&lt;p&gt;Suppose we have an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, and a register &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; in an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda=1$&lt;/span&gt;.  Repeatedly applying &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; does not affect &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; - that is, &lt;span class=&quot;math-container&quot;&gt;$\langle\lambda|U^r|\lambda\rangle=1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$r\in \mathbb{Z}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However suppose we have another register &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt;, which is only &quot;close to&quot; the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt;.  That is, suppose we have a state &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\langle\lambda|\mu\rangle=1-\delta$&lt;/span&gt;, for some small &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;.  I believe repeated applications of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; will eventually scramble &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt; beyond recognition.  But, with respect to &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;, how quickly does this scrambling take place?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How much do we have to know about &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle\lambda|\mu\rangle$&lt;/span&gt; to be able to say anything about how big &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; has to be before &lt;span class=&quot;math-container&quot;&gt;$\langle\mu|U^r|\mu\rangle\lt 1/3$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think this is akin to asking for more spectral properties of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.  Do we need to know about other eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to answer how big &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; has to be before &lt;span class=&quot;math-container&quot;&gt;$\langle\mu|U^r|\mu\rangle\lt 1/3$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we are able to prepare two separate registers, both initially &quot;close to&quot; an eigenstate, we can apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; many times to the second register, and do a SWAP test between the first register &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt; and the second register &lt;span class=&quot;math-container&quot;&gt;$U^r|\mu\rangle$&lt;/span&gt;.  If the SWAP test fails then we know that &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; was large enough to scramble &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this is a natural question that comes about from thinking of the BBBV theorem, but I'm not sure, and my only intuition is that if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is more &quot;connected&quot; then &lt;span class=&quot;math-container&quot;&gt;$U^r$&lt;/span&gt; acts rapidly to scramble &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-11-06T12:41:04.400" Title="If a state is only &quot;close to&quot; an eigenstate of an operator, how many applications of the operator does it take to scramble the state?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8607" PostTypeId="2" ParentId="4126" CreationDate="2019-10-29T21:32:57.247" Score="7" Body="&lt;p&gt;To fix what we are talking about, I think you mean&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} \quad&#xA;S = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{pmatrix} \quad&#xA;T = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; \exp(i\pi/4) \end{pmatrix} = &#xA;\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; \frac{1+i}{\sqrt{2}} \end{pmatrix}.$$&lt;/span&gt;&#xA;If these are your matrices, then no, you can't make gate set 1 from gate set 2.  Let's look at these gates in superoperator form, &lt;em&gt;i.e.&lt;/em&gt;, as matrices acting on density matrices, so that we ignore global phase as we should.  Then all of the entries of the superoperator forms of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, call them &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt;, lie in the field of Gaussian rationals &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Q}(i)$&lt;/span&gt;.  In other words, the entries of these matrices are complex numbers whose real and imaginary parts are rational numbers.  The same is true of the controlled &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate.  Two other quantum maps or superoperators that are important for the question are ancilla creation and qubit discard (or partial trace), and both of these also have all entries in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Q}(i)$&lt;/span&gt;.  This property is also preserved when you either tensor or compose superoperators to make a circuit out of gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The superoperator form &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt; of the gate &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; does not have entries in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Q}(i)$&lt;/span&gt;.   The field of definition for those numbers is instead &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Q}(i,\sqrt{2})$&lt;/span&gt;. Thus &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt; is unreachable by a finite circuit of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$cS$&lt;/span&gt; gates (and creation and destruction of ancillas).   Although as you note, the Solovay-Kitaev theorem says that every gate under the sun, or at least every gate with efficiently computable matrix entries, can be efficiently approximated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't entirely know what you mean in your description of gate set 3.  However, I think that in any reasonable interpretation of that gate set, the same argument applies.  Certainly if you take the gate set verbatim and ignore the fact that it only produces real matrices, then something sharper happens; in superoperator form, it only produces rational matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, where you say that you could also accept creating any new phase gate, in fact, the only phase gates that are reachable using gate set 2 are those that are powers of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, although you have to do a bit more work than to trap the superoperator matrix entries in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Q}(i)$&lt;/span&gt;.  In fact the superoperator entries of the gate 2 set or any circuit made from it are all Gaussian integers, elements of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}[i]$&lt;/span&gt;, except for a global denominator to make the superoperator trace-preserving.   The only Gaussian integers that lie on the unit circle are &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pm i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-10-29T21:32:57.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8608" PostTypeId="1" AcceptedAnswerId="8609" CreationDate="2019-10-29T23:05:08.207" Score="4" ViewCount="497" Body="&lt;p&gt;I came here after reading about the announcement regarding the Sycamore processor and Google's Quantum Supremacy claim. I am hung up on several key things and I am hoping that I could find those answers here, or at least direction to the answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I am trying to make sense of the comparison, i.e. Sycamore is a 53-qubit processor (54 but 1 is not functional). One the paper itself (doi: 10.1038/s41586-019-1666-5) figure caption 4, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;... hereas an equal-fidelity classical sampling would take 10,000 years on &lt;strong&gt;a million cores&lt;/strong&gt;, and verifying the fidelity would take millions of years&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I assume this &lt;strong&gt;a million cores&lt;/strong&gt; refers to IBM Summit at Oak Ridge, right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My actual questions revolve around the power consumption. I assume it takes a lot of power to use that &lt;strong&gt;a million cores&lt;/strong&gt; to simulate quantum state; how much power did the Sycamore consume to perform the same task? In other words, how much power did the Sycamore use along with its other auxiliary/peripheral devices for that span of 200 seconds vs. how much power theoretically Summit would use in the span of 2.5 days (IBM's counter-claim) if not 10,000 years (Google's claim)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second question with regard to power consumption, given power consumed as percent fraction, how much power does Sycamore consume, how much goes to the dilution refrigerator?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you! &lt;/p&gt;&#xA;" OwnerUserId="8920" LastEditorUserId="26" LastEditDate="2019-10-30T03:30:05.963" LastActivityDate="2019-10-30T19:56:07.863" Title="Making sense of the Sycamore's computing prowess - power consumption" Tags="&lt;quantum-advantage&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8609" PostTypeId="2" ParentId="8608" CreationDate="2019-10-30T03:13:55.720" Score="7" Body="&lt;p&gt;They say in Section X.H of &lt;a href=&quot;https://static-content.springer.com/esm/art%3A10.1038%2Fs41586-019-1666-5/MediaObjects/41586_2019_1666_MOESM1_ESM.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the supplement&lt;/a&gt; that the Summit supercomputer has a power capacity of 14 megawatts.  They compare that to their own setup.  Their power consumption is mainly their dilution fridge, which they say is about 10 kilowatts plus about another 10 for chilled water for its supporting equipment.  Their own supporting PCs and other electronics is about 3 kilowatts, they say.   They give themselves a total power budget of 26 kilowatts, tops.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would say that the comparison is so one-sided that a precise estimate seems a bit silly. Maybe you could reduce the estimate with free chilled water if the experiment were done in Alaska.  Or maybe you could up the estimate by including the electricity to heat lunch for the coauthors.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Addendum:&lt;/strong&gt; I guess there is a more serious answer based on the second question in the post, and related to my joke second paragraph.  Aizan asks how much power Sycamore itself consumes, vs all of the other equipment around it.  Indeed, most of the power consumption of the comparison Summit supercomputer in Oak Ridge is from the core activity of the computer itself, from the trillions of transistors and wires between them as they carry electrical current.  Moreover, carrying current is unavoidable when a classical electronic computer changes state.   Some of the power budget might go to air condition the computer and the data center to release all of the computer's heat to the outside.  That is a serious extra power requirement that can be called peripheral, but it is not the main power cost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, all of the listed power budget for the Sycamore process is for peripheral equipment, especially but not only the dilution refrigerator. For several reasons, the power consumption of the Sycamore chip itself is negligible.  One reason is that the Sycamore is only 53 qubits, which for this question is a lot like 53 bits.  (How much power do you need for an old Z80 chip?)  Another reason is more interesting:  In a natural sense, a perfect quantum circuit always operates at zero temperature and never draws any power!  Unitary quantum circuits are reversible, both in the sense of computation and in the sense of physics.  In the sense of physics, that means that no heat is generated and no energy is wasted.   This was indeed part of the original motivation for quantum computers in the old papers of Feynman, at a time when people could only vaguely guess that the same model might also lead to superior algorithms.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-10-30T19:56:07.863" LastActivityDate="2019-10-30T19:56:07.863" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8610" PostTypeId="2" ParentId="8606" CreationDate="2019-10-30T04:55:54.510" Score="2" Body="&lt;p&gt;You certainly need to know all the other eigenvectors and eigenvalues. It's also important to know &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt; and the nature of the operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Say, if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, then the eigenvectors form an orthonormal set and their eigenvalues have modulus &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. It's easy to resolve &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle$&lt;/span&gt; along these orthonormal vectors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be concrete, suppose the orthonormal eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$|\lambda_1\rangle, |\lambda_2\rangle, \ldots, |\lambda_n\rangle$&lt;/span&gt;, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$c_1, c_2, \ldots, c_n$&lt;/span&gt;. Now consider &lt;span class=&quot;math-container&quot;&gt;$\langle\lambda_1|\mu\rangle = 1 - \delta$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\delta \in \mathbb R^+$&lt;/span&gt;). Contrary to your intuition, if &lt;span class=&quot;math-container&quot;&gt;$c_1 = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|c_2|, \ldots, |c_n| = 1$&lt;/span&gt;, then after each application of the operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle\lambda_1|\mu\rangle$&lt;/span&gt; remains constant i.e, &lt;span class=&quot;math-container&quot;&gt;$1-\delta$&lt;/span&gt;. Repeated applications of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; would not &lt;em&gt;necessarily&lt;/em&gt; scramble it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, in general, &lt;span class=&quot;math-container&quot;&gt;$\langle \lambda_1|U^r|\mu\rangle$&lt;/span&gt; is not necessarily real and it doesn't make sense to directly compare it with a real number like &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;. Though, &lt;span class=&quot;math-container&quot;&gt;$|\langle \lambda_1|U^r|\mu\rangle|$&lt;/span&gt; will always remain constant for a unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\forall r \in \Bbb N$&lt;/span&gt;), as all the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; have a magnitude of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle = a_1|\lambda_1\rangle + a_2|\lambda_2\rangle + \ldots a_n|\lambda_n\rangle$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$a_i \in \Bbb C$&lt;/span&gt;), the value of &lt;span class=&quot;math-container&quot;&gt;$\langle \mu|U^r|\mu\rangle$&lt;/span&gt; would very much depend on the exact values of &lt;span class=&quot;math-container&quot;&gt;$c_1, c_2, \ldots, c_n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase shift (&lt;span class=&quot;math-container&quot;&gt;$R_\phi$&lt;/span&gt;) gate has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}$&lt;/span&gt; corresponding to eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle = |1\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say &lt;span class=&quot;math-container&quot;&gt;$|\mu\rangle = \frac{1|0\rangle + 99|1\rangle}{\sqrt{1^2+99^2}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\langle 1|\mu\rangle| = \frac{99}{\sqrt {1^2+99^2}}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\therefore U^r|\mu\rangle = \frac{1|0\rangle + 99e^{ir\phi}|1\rangle}{\sqrt{1^2+99^2}}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\implies \langle 1|U^r|\mu\rangle = \frac{99 e^{ir\phi}}{\sqrt {1^2+99^2}}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\implies |\langle 1|U^r|\mu\rangle| = \frac{99 }{\sqrt {1^2+99^2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the magnitude of &lt;span class=&quot;math-container&quot;&gt;$\langle \lambda|U^r|\mu\rangle$&lt;/span&gt; clearly remains constant, irrespective of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. Though, it certainly might pick up a phase factor upon each application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$$\langle \mu |U^r|\mu\rangle = \frac{1^2+99^2e^{ir\phi}}{1^2+99^2}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless you take the magnitude it's not possible to compare this with &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;, and even then the value very much depends on &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. Notice that if &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle \mu |U^r|\mu\rangle$&lt;/span&gt; remains &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; irrespective of how large &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is. If &lt;span class=&quot;math-container&quot;&gt;$\phi = \pi$&lt;/span&gt;, the magnitude keeps flipping between &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\frac{1^2-99^2}{1^2+99^2}|$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; increases, without ever reaching below &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-10-30T06:34:24.583" LastActivityDate="2019-10-30T06:34:24.583" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="8612" PostTypeId="1" CreationDate="2019-10-30T09:26:02.730" Score="2" ViewCount="145" Body="&lt;p&gt;We are using an open account.&#xA;We can not load the account even when we use the code on new notebook.&#xA;The error message is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;TypeError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-3-217ef0eaf621&amp;gt; in &amp;lt;module&amp;gt;&#xA;      6 from qiskit.visualization import *&#xA;      7 # Loading your IBM Q account(s)&#xA;----&amp;gt; 8 provider = IBMQ.load_account()&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/ibmqfactory.py in load_account(self)&#xA;    152 &#xA;    153         # Check for valid credentials.&#xA;--&amp;gt; 154         credentials_list = list(discover_credentials().values())&#xA;    155 &#xA;    156         if not credentials_list:&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/credentials/__init__.py in discover_credentials(qiskitrc_filename)&#xA;     61     for display_name, (reader_function, kwargs) in readers.items():&#xA;     62         try:&#xA;---&amp;gt; 63             credentials = reader_function(**kwargs)&#xA;     64             logger.info('Using credentials from %s', display_name)&#xA;     65             if credentials:&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/credentials/configrc.py in read_credentials_from_qiskitrc(filename)&#xA;     65         if 'verify' in single_credentials.keys():&#xA;     66             single_credentials['verify'] = bool(single_credentials['verify'])&#xA;---&amp;gt; 67         new_credentials = Credentials(**single_credentials)&#xA;     68         credentials_dict[new_credentials.unique_id()] = new_credentials&#xA;     69 &#xA;&#xA;TypeError: __init__() missing 1 required positional argument: 'url' &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there any fundamental problem about the accounts?&lt;/p&gt;&#xA;" OwnerUserId="8928" LastEditorUserId="55" LastEditDate="2019-10-30T17:17:51.607" LastActivityDate="2019-10-30T17:17:51.607" Title="Error on loading account with qiskit: &quot;TypeError: __init__() missing 1 required positional argument: 'url'&quot;" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8613" PostTypeId="2" ParentId="8593" CreationDate="2019-10-30T12:01:58.203" Score="5" Body="&lt;p&gt;As I suggest in the comments, I don't think that it is going to help you to understand quantum computation in terms of parallelism. To illustrate why, I will describe a simple two-qubit computation, in which &amp;mdash; if you were absolutely adamant  &amp;mdash; you could claim there is computation happening in parallel; but which I would suggest does not in any meaningful sense.&#xA;&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{\lvert#1\rangle}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the following circuit, acting on some standard basis state &lt;span class=&quot;math-container&quot;&gt;$\ket{x}\ket{y}$&lt;/span&gt; provided as input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/mvlq8.png&quot; width=&quot;256&quot; alt=&quot;Circuit illustrating control-target inversion of a CNOT gate using Hadamards&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To smooth the analysis slightly for those who haven't seen a lot of quantum computation, let's consider how we could most easily represent the effects of these operations on some states.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The middle gate, which is a &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; gate (&quot;controlled-not&quot;), performs the following transformation of standard basis states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{CNOT} \ket{x}\ket{y} = \ket{x}\ket{y \!\oplus\! x}$$&lt;/span&gt;&#xA;and performs the &lt;em&gt;same&lt;/em&gt; transformation, independently, on each term of a superposition of standard basis states. This aspect of performing things independently on individual terms is what is sometimes described as the 'parallel' behaviour of quantum computation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The gates surrounding the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; gate in the circuit are Hadamard gates,&#xA;&lt;span class=&quot;math-container&quot;&gt;$ H = \tfrac{1}{\sqrt 2}\bigl[\begin{smallmatrix} 1 &amp;amp; \phantom- 1 \\ 1 &amp;amp; -1 \end{smallmatrix}\bigr], $&lt;/span&gt;&#xA;which we may describe as performing the following transformation on standard basis states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{x} \;\xrightarrow{\;H\;}\; \tfrac{1}{\sqrt 2}\Bigl( \ket{0} + (-1)^x \ket{1} \Bigr) .$$&lt;/span&gt;&#xA;On pairs of standard basis states, we may represent the effect of Hadamards on both qubits by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ket{x}\ket{y} \;\xrightarrow{\;H \otimes H\;}\; \tfrac{1}{2}\Bigl( \ket{00} + (-1)^y \ket{01} + (-1)^x \ket{10} + (-1)^{x \oplus y} \ket{11}\Bigr); $$&lt;/span&gt;&#xA;and because the Hadamard gate is self-inverse, we also have the reverse transformation of states,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \tfrac{1}{2}\Bigl( \ket{00} + (-1)^y \ket{01} + (-1)^x \ket{10} + (-1)^{x \oplus y} \ket{11}\Bigr) \;\xrightarrow{\;H \otimes H\;}\; \ket{x}\ket{y}. $$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So: given these observations, let's take a look at what happens when we perform the circuit illustrated above on an input state &lt;span class=&quot;math-container&quot;&gt;$\ket{x}\ket{y}$&lt;/span&gt;: reading off transformations of the state, time-step by time-step, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;&amp;amp;&#xA;    \ket{x}\ket{y}&#xA;\\[1ex]&amp;amp;\xrightarrow{\;H \otimes H \;} &#xA;    \tfrac{1}{2}\Bigl( \ket{00} + (-1)^{y} \ket{01} + (-1)^x \ket{10} + (-1)^{x \oplus y} \ket{11}\Bigr)&#xA;\\[1ex]&amp;amp;\xrightarrow{\;\mathrm{CNOT} \;} &#xA;    \tfrac{1}{2}\Bigl( \ket{00} + (-1)^{y} \ket{01} + (-1)^x \ket{11} + (-1)^{x \oplus y} \ket{10}\Bigr)&#xA;\\&amp;amp;\qquad\qquad=&#xA;    \tfrac{1}{2}\Bigl( \ket{00} + (-1)^{y} \ket{01} + (-1)^{x\oplus y} \ket{10} + (-1)^{x} \ket{11}\Bigr)&#xA;\\&amp;amp;\qquad\qquad=&#xA;    \tfrac{1}{2}\Bigl( \ket{00} + (-1)^{y} \ket{01} + (-1)^{(x\oplus y)} \ket{10} + (-1)^{(x\oplus y) \oplus y} \ket{11}\Bigr)&#xA;\\[1ex]&amp;amp;\xrightarrow{\;H \otimes H \;} &#xA;    \ket{x \!\oplus\! y}\ket{y}.&#xA;\end{align}$$&lt;/span&gt;&#xA;In the middle of the computation, we have a superposition of standard basis states, and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; can be said to be operating independently on each of them. But if we were to describe this as &quot;parallel computation&quot;, you should ask yourself:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the data that the computation is acting on?&lt;/li&gt;&#xA;&lt;li&gt;What is the output of these 'parallel' processes?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It seems to me that the standard basis terms that the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; is 'acting' on, aren't data at all: they do not &lt;em&gt;individually&lt;/em&gt; correspond to any information about the input state. Furthermore, information about &lt;em&gt;individual&lt;/em&gt; terms in the computation aren't represented in the output. It is customary &amp;mdash; and in some contexts, essentially correct &amp;mdash; to describe the terms in the superposition as representing &lt;em&gt;random&lt;/em&gt; bits (or bit-strings), and you could say that it is on this random information that the process acts in parallel; but this 'randomness' does not in any way affect the output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What this example demonstrates is that quantum computation allows information to be stored in different ways (using different orthogonal bases) of a single-qubit or multi-qubit system, and that the way in which operations act on these different bases is determined by &amp;mdash; but may have qualitatively different features from &amp;mdash; the way it acts on the standard basis. It's possible to describe parts of computation as acting 'in parallel over different possibilities', but such descriptions shouldn't be taken too seriously, because the 'parallelism' is one that one cannot directly exploit, any more than you can exploit the similar 'parallelism' that exists in randomised algorithms.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-10-30T12:01:58.203" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8614" PostTypeId="2" ParentId="8612" CreationDate="2019-10-30T13:54:35.093" Score="2" Body="&lt;p&gt;This was an error but it should now be fixed. If this happens again in future, the work around is to remove that line and use &lt;code&gt;IBMQ.enable_account(my_token)&lt;/code&gt; instead.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2019-10-30T14:53:26.983" LastActivityDate="2019-10-30T14:53:26.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8616" PostTypeId="2" ParentId="3793" CreationDate="2019-10-30T17:56:07.197" Score="4" Body="&lt;p&gt;Here is a more general view of your question that might offer some clarity:   An operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; is called &lt;em&gt;normal&lt;/em&gt; if it commutes with its adjoint, &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger = A^\dagger A$&lt;/span&gt;. Equivalently, any operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; decomposes as &lt;span class=&quot;math-container&quot;&gt;$A = B + iC$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; are self-adjoint, and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is normal if and only if &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; commute. This means that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; are simultaneously measurable, which means that you can interpret &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as a complex-valued measurable.  In conclusion, normal operators are the same as complex-valued measurables.   If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is self-adjoint, that is the real-valued special case; if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is unitary, that is the circle-valued special case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is any function from the complex numbers &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; to itself and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is normal, then the usually inevitable definition of &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt; is through spectral decomposition. &lt;em&gt;I.e.&lt;/em&gt;, you should replace each eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$f(\lambda)$&lt;/span&gt; and let its eigenvector stay put.  In this vast generality, this concept goes back to von Neumann.   To be sure, there could also be other definitions of &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt;, but another definition is usually only credible when it agrees with the spectral definition.  For instance, if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; has a power series whose domain of convergence contains the spectrum of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, for instance &lt;span class=&quot;math-container&quot;&gt;$f(z) = e^z$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt; can also be defined by a power series --- but you get the same answer as the spectral definition.  A more fun case is the absolute value &lt;span class=&quot;math-container&quot;&gt;$|A|$&lt;/span&gt;, which doesn't have a good power series.   The spectral definition says, duh, just replace each &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$|\lambda|$&lt;/span&gt;.  This agrees with the more creative-looking formula &lt;span class=&quot;math-container&quot;&gt;$|A| = \sqrt{A^\dagger A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With fractional powers, the problem that you run into is that the scalar fractional power function &lt;span class=&quot;math-container&quot;&gt;$f(z) = z^\alpha$&lt;/span&gt; is multivalued in the complex plane, unless the exponent &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is an integer.  The paradox doesn't actually lie with operators, but just with complex numbers.   Just as &lt;span class=&quot;math-container&quot;&gt;$z^{1/2}$&lt;/span&gt; naturally has two values when &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is a general complex number, &lt;span class=&quot;math-container&quot;&gt;$A^{1/2}$&lt;/span&gt; naturally has many values when &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a general normal (or unitary) operator.  (In fact more than two, since you can make a separate binary choice for each eigenvalue.)  The standard solution in complex analysis, which is often more of a convention than truly a solution to anything, is to resolve &lt;span class=&quot;math-container&quot;&gt;$f(z) = z^\alpha$&lt;/span&gt; to a single-valued function using a branch cut.  If you do that, then &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt; becomes a well-defined single-valued function as well, again assuming that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is normal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you use the formula &lt;span class=&quot;math-container&quot;&gt;$z^\alpha = e^{\alpha \ln z}$&lt;/span&gt;, and if you use the standard branch cut for logarithm and apply the result to the SWAP gate, then I think you get exactly the answer that you gave.  The SWAP gate has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; thrice and eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; once, and you are indeed moving the non-trivial eigenvalue in a counterclockwise arc around the unit circle from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This answer, which can be motivated by abstract mathematics, also has a nice property for quantum control, which might be your real motivation here.   Namely, it is a shortest geodesic in the space of unitaries, a path where the Hamiltonian evolution does the least work.  You can always use the &lt;span class=&quot;math-container&quot;&gt;$z^\alpha = e^{\alpha \ln z}$&lt;/span&gt; formula together with the standard branch cut for the logarithm to achieve this.  The main wrinkle is that if you do not care about global phase as you shouldn't, then you can adjust the global phase of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to optimize for the best geodesic.  But that would not improve the particular solution that you found for SWAP.   Another wrinkle is that there are two shortest geodesics between &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; on the unit circle, so that there is more than one optimal geodesic from the identity operator to a unitary operator with &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-10-30T17:56:07.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8617" PostTypeId="2" ParentId="8348" CreationDate="2019-10-30T18:44:28.970" Score="3" Body="&lt;p&gt;Although it doesn't explicitly say it in the paper from Google, the diagrams in the paper are missing a qubit along the top edge. Most likely this is the &quot;bad&quot; qubit that wasn't used. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/mpDyQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mpDyQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4jMy3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4jMy3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8934" LastActivityDate="2019-10-30T18:44:28.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8618" PostTypeId="1" AcceptedAnswerId="8621" CreationDate="2019-10-30T19:33:00.437" Score="2" ViewCount="107" Body="&lt;p&gt;According to &lt;a href=&quot;http://www-inst.eecs.berkeley.edu/~cs191/fa08/lectures/lecture17.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these lecture notes&lt;/a&gt; from Berkeley, the Extended Church-Turing Thesis (ECT) asserts that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...any &quot;reasonable&quot; model of computation can be &lt;strong&gt;&lt;em&gt;efficiently&lt;/em&gt;&lt;/strong&gt; simulated on a standard model such as a Turing Machine or a Random Access Machine or a cellular automaton. (Emphasis added).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Google is claiming that, by preparing and sampling from a highly-entangled random state in a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^{53}$&lt;/span&gt;, they are marching towards quantum supremacy.  As intimated by, for example, Aaronson &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4317&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, a successful demonstration of sampling from a large-enough Hilbert space with a high-enough fidelity will indeed invalidate the Extended Church-Turing Thesis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There seems to be at least two challenges to this claim.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Random circuit sampling (even from a Hilbert space of high-enough dimension) does not constitute a demonstration of quantum supremacy, because random circuit sampling does not correspond to &quot;classic&quot; applications of quantum computing (such as Shor's algorithm), or does not appear to be a &quot;computation&quot; in the sense of an action performed by a computer.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Even granting that random circuit sampling &lt;em&gt;does&lt;/em&gt; constitute a demonstration of quantum supremacy, it's not clear that the Efficient Church-Turing Thesis requires any &lt;em&gt;physical instantiation&lt;/em&gt; of a hypothetical quantum device, and the &quot;reasonable&quot; model of computation only needs to be a purely platonic description of different complexity classes.  Thus the ECT is only invalidated if one were to prove, e.g., that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}\ne\mathrm{BPP}$&lt;/span&gt; or something similar.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question: &lt;strong&gt;&lt;em&gt;Why can we say that the ECT falls with a successful demonstration of random circuit sampling from a large enough Hilbert space?&lt;/em&gt;&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, what are the rejoinders to the above positions?  Are there other potential faults in the logic connecting random circuit sampling to the negation of the ECT?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-10-31T15:30:34.827" LastActivityDate="2019-10-31T15:30:34.827" Title="How does successfully sampling from a random quantum circuit invalidate the Extended Church-Turing Thesis?" Tags="&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8620" PostTypeId="1" AcceptedAnswerId="8622" CreationDate="2019-10-30T21:11:28.810" Score="4" ViewCount="185" Body="&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;em&gt;This has been cross-posted to &lt;a href=&quot;https://cstheory.stackexchange.com/questions/45776/how-exactly-is-solving-the-random-circuit-sampling-problem-a-computation-in-the&quot;&gt;CS Theory SE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP} \neq \mathsf{BPP}$&lt;/span&gt;, then we can say with &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8621/26&quot;&gt;reasonable certainty&lt;/a&gt; that Google's random sampling experiment falsifies the Extended Church Turing thesis. However, in a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8560/26&quot;&gt;related thread&lt;/a&gt;, a user raised the objection that the random circuit sampling problem might not be a computation in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis#Statement_in_Church&amp;#39;s_and_Turing&amp;#39;s_words&quot; rel=&quot;nofollow noreferrer&quot;&gt;Church Turing sense&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;@glS: Decision problems, computable functions, etc. are equivalent, so whichever form you like. Sampling is not even a function, much less a computable one. It's a physical process outside the scope of computing/functions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could someone elaborate on this apparent discrepancy? Can the random circuit sampling problem indeed be framed in terms of computable functions and effective calculability or a decision problem, as the CT thesis requires?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="55" LastEditDate="2020-09-23T12:20:07.123" LastActivityDate="2020-09-23T12:20:07.123" Title="How exactly is solving the random circuit sampling problem a computation in the Church-Turing thesis sense?" Tags="&lt;complexity-theory&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;google-sycamore&gt;&lt;church-turing-thesis&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8621" PostTypeId="2" ParentId="8618" CreationDate="2019-10-30T21:17:54.037" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A computational task doesn't have to have or be an application in order to be part of a valid model.  If you claim that you can run a mile faster than I can, your four-minute mile doesn't have to be profitable employment in order to count.  On the other hand, the random sampling demonstration with Sycamore certainly is an action of some kind performed by a computer.   It is sort-of the same thing as (but much more sophisticated than) a computer algorithm to random-sort a list of numbers.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;CS theorists have lived for decades with artificial complexity classes that they can't prove are different from P, or for that matter BPP.   PSPACE is a vast complexity class that has to be bigger than P, but no one can prove that.  But it isn't considered a realistic complexity class.   For that matter the logicians who came before the CS theorists, including Church and Turing themselves, could and did define computation classes that they know are different from the Church-Turing standard of computability.   It is Turing's own theorem (one of them anyway) that the class RE, recursively enumerable, is larger than R, recursive or computable.   The Church-Turing thesis says that all realistic computability roads lead to the same Rome, namely R.  The fact that you can also define something bigger like RE doesn't disprove that thesis.  Any version of Church-Turing is about what is realistic, not about what you can define.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;(Actually more 2.) The ECT says that all roads of polynomial computability also lead to the same Rome, P or BPP.  In this case people cannot prove as much.  In fact, even faith in ECT ultimately depends on the open conjecture that P and BPP are equal.  BQP ≠ BPP is another thing that people can't prove, because they are both sandwiched between P and PSPACE and no one can prove that P ≠ PSPACE either.  (In fact it's worse than that, there are major results on how &lt;em&gt;not&lt;/em&gt; to prove that P ≠ PSPACE.) But that's okay, we can still believe these things based on evidence even if we can't prove them.  Everyone also believes that there are infinitely many twin primes, etc.  The relation between the quantum supremacy demo and ECT comes down to whether you believe that there is an efficient classical algorithm for what the Sycamore chip does.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-10-30T21:17:54.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8622" PostTypeId="2" ParentId="8620" CreationDate="2019-10-30T21:43:25.473" Score="3" Body="&lt;p&gt;The Church-Turing thesis is not in and of itself a rigorous concept, but rather a judgment on rigorous concepts of computability.   As such, it's negotiable.  The language in Rosser's 1939 expository paper about provability and computability is biased towards deterministic algorithms.  There is an important simplifying theorem here: If you only care about what is ever computable, then you don't need randomness or quantum randomness, because you can simulate them using exponentially more time.  Like many simplifying results, it can be taken in the wrong way.  It meant that in the 1930s, back when mainly logicians were defining what was computable at all, randomized algorithms were not yet on their radar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you extend your thinking to the Extended Church-Turing thesis, then you should also extend your scope to randomized computation.  You have no choice, because even if an algorithm answers a deterministic question (like whether a number is prime), the method of calculation could be randomized (like Miller-Rabin or ECPP). And then it's not very natural to demand that the answer be deterministic even if the solution doesn't have to be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, you're free to be a stickler in your personal interpretation of ECT, because it's not a rigorous concept.  You're free to say that Google's quantum supremacy gets a bronze medal in its fight against ECT, but not a gold medal, because it doesn't answer a deterministic question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you could be even more of a stickler and say that none of this counts because quantum computing isn't deterministic.  Then I would say that I believe this reactionary version ECT after all --- a TM with a linear tape is polynomially equivalent to one with a 2D tape, etc.  But I would also say that that's not the right question.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-10-30T21:43:25.473" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="8623" PostTypeId="2" ParentId="8573" CreationDate="2019-10-31T02:21:14.540" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8600/55&quot;&gt;Another answer&lt;/a&gt; already addressed how the specific expression in the OP means and how to derive it.&#xA;Here I'll show another way to derive the same result (very similar to the derivation &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5306/55&quot;&gt;in this other answer on another question&lt;/a&gt;, though with different notation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the notation &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_\psi\equiv|\psi\rangle\!\langle\psi|$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$U_s\equiv 2\mathbb P_s-I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_\omega\equiv I-2\mathbb P_\omega$&lt;/span&gt;,&#xA;and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_s U_\omega=-I+2(\mathbb P_s+\mathbb P_\omega)-4\mathbb P_s\mathbb P_\omega.\tag{AA}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the decomposition of &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; in a basis containing &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|s\rangle=\sin\alpha |\omega\rangle+\cos\alpha e^{i\phi}|\omega_\perp\rangle,\tag{A}$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$\alpha,\phi\in\mathbb R$&lt;/span&gt;, and with &lt;span class=&quot;math-container&quot;&gt;$|\omega_\perp\rangle$&lt;/span&gt; a state orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;${}^{(1)}$&lt;/span&gt;. The state &lt;span class=&quot;math-container&quot;&gt;$|\omega_\perp\rangle$&lt;/span&gt; here is uniquely determined by &lt;span class=&quot;math-container&quot;&gt;$|s\rangle,|\omega\rangle$&lt;/span&gt;, and the orthogonality requirement.&#xA;Expanding the various elements of (AA) we then have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I=\mathbb P_\omega + \mathbb P_{\omega_\perp} + \mathbb P_\perp,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbb P_s=\sin^2(\alpha)\,\mathbb P_\omega + \cos^2(\alpha)\mathbb P_{\omega_\perp} + \sin\alpha\cos\alpha(e^{-i\phi}|\omega\rangle\!\langle\omega_\perp|+e^{i\phi}|\omega_\perp\rangle\!\langle\omega|),$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbb P_s\mathbb P_\omega=\sin^2(\alpha) \mathbb P_\omega + \sin\alpha\cos\alpha e^{i\phi}|\omega_\perp\rangle\!\langle\omega|,$$&lt;/span&gt;&#xA;where we defined &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_\perp$&lt;/span&gt; as the projector onto the space orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\omega_\perp\rangle$&lt;/span&gt;.&#xA;Putting everything together we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_s U_\omega&#xA;= -\mathbb P_\perp + \cos(2\alpha)(\mathbb P_\omega+\mathbb P_{\omega_\perp})&#xA;+\sin(2\alpha)(e^{-i\phi}|\omega\rangle\!\langle\omega_\perp|-e^{i\phi}|\omega_\perp\rangle\!\langle\omega|).\tag B$$&lt;/span&gt;&#xA;This is telling us that &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; is really a rotation matrix in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|\omega\rangle,|\omega_\perp\rangle\}$&lt;/span&gt; (which we should have expected from it being a product of two reflections), and acts trivially (modulo minus sign) on the rest of the space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume to be working on states in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|\omega\rangle,|\omega_\perp\rangle\}$&lt;/span&gt; (which contains &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; by definition of &lt;span class=&quot;math-container&quot;&gt;$|\omega_\perp\rangle$&lt;/span&gt;), we can then ignore the &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_\perp$&lt;/span&gt; term.&#xA;We can furthermore ease the notation by relabeling &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle\to|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\omega_\perp\rangle\to|1\rangle$&lt;/span&gt;. Then, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_s U_\omega =&#xA;\begin{pmatrix}\cos(2\alpha) &amp;amp; e^{-i\phi}\sin(2\alpha) \\&#xA;-e^{i\phi}\sin(2\alpha) &amp;amp; \cos(2\alpha)\end{pmatrix}\in\mathrm{SU}(2)\tag C$$&lt;/span&gt;&#xA;Note that all of this, going from (AA) to (C), doesn't have that much to do with Grover's algorithm or anything quantum: we are simply showing how the product of two reflections with respect to vectors with internal angle &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, amounts to a rotation by an angle of &lt;span class=&quot;math-container&quot;&gt;$2\alpha$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conclusion is now at hand: &lt;span class=&quot;math-container&quot;&gt;$U_s U_\omega$&lt;/span&gt; is a rotation matrix in this space. From this observation, it is not hard to see that the matrix powers can be written as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(U_s U_\omega)^r = \begin{pmatrix}\cos(2r\alpha) &amp;amp; e^{-i\phi}\sin(2r\alpha) \\&#xA;-e^{i\phi}\sin(2r\alpha) &amp;amp; \cos(2r\alpha)\end{pmatrix}.$$&lt;/span&gt;&#xA;Finally,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(U_s U_\omega)^r \begin{pmatrix}\sin\alpha \\ e^{i\phi}\cos\alpha\end{pmatrix}&#xA;= \begin{pmatrix}\sin((2r+1)\alpha) \\ e^{i\phi}\cos((2r+1)\alpha)\end{pmatrix}.$$&lt;/span&gt;&#xA;The final probability after &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; steps is therefore &lt;span class=&quot;math-container&quot;&gt;$\sin^2((2r+1)\alpha)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An interesting observation is that at no point in all of this we are using the fact that the dynamic happens in a high-dimensional space. Indeed, we could have identified &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle\sim|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\omega_\perp\rangle\sim|1\rangle$&lt;/span&gt; from the beginning and thought in terms of the evolution of a single qubit, and no generality would have been lost. In other words, Grover's algorithm really only involves an evolution in an effective two-dimensional space.&#xA;You can then visualise what's going on in the Bloch sphere, and if you do that you find the state evolving along the geodesic path connecting initial and target point (which can also be understood as due to the fact that Grover's algorithm is indeed nothing but a discretisation of such geodesic path).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://math.stackexchange.com/a/3424934/173147&quot;&gt;this answer on math.SE&lt;/a&gt; for a different way to prove this result.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${}^{(1)}$&lt;/span&gt;&#xA;&lt;sup&gt;I &lt;em&gt;could&lt;/em&gt; write this decomposition more explicitly, being &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; in the OP a specific state (the balanced superposition over all states). However, I don't want to use properties of this particular &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, in order to make the result hold equally for any choice of &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-06T21:53:58.393" LastActivityDate="2019-11-06T21:53:58.393" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8625" PostTypeId="1" CreationDate="2019-10-31T04:58:20.250" Score="1" ViewCount="425" Body="&lt;p&gt;The m level n-particle state &lt;span class=&quot;math-container&quot;&gt;$|X_{N}\rangle$&lt;/span&gt;  is defined as&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\boxed{|X_{N}\rangle = \frac{1} {m^\frac{n-1}{2}}\sum_{\sum_{k=0}^{n-1} j_k \mathrm{mod}\ m \ = \ 0}|j_{0}\rangle |j_{1}\rangle ....|j_{n-1}\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can this state be prepared?&lt;/p&gt;&#xA;" OwnerUserId="8249" LastEditorUserId="55" LastEditDate="2019-11-12T11:56:53.250" LastActivityDate="2019-11-12T11:56:53.250" Title="How to generate a superposition of m-level n-particle states $|j_{0} ,j_{1}, ....,j_{n-1}\rangle$ with $\sum_{k=0}^{n-1} j_k \mathrm{mod}\ m \ = \ 0$?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8626" PostTypeId="2" ParentId="6088" CreationDate="2019-10-31T05:06:45.807" Score="4" Body="&lt;p&gt;I will address the first two parts based on what I understood so far.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;strong&gt;extended Church–Turing thesis&lt;/strong&gt; or &lt;strong&gt;(classical) complexity-theoretic Church–Turing thesis&lt;/strong&gt; states that &amp;quot;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Probabilistic_Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;probabilistic Turing machine&lt;/a&gt; can efficiently simulate any realistic model of computation.&amp;quot;, whereas the &lt;strong&gt;quantum extended Church–Turing thesis&lt;/strong&gt; or &lt;strong&gt;quantum complexity-theoretic Church–Turing thesis&lt;/strong&gt; states &amp;quot;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum Turing machine&lt;/a&gt; can efficiently simulate any realistic model of computation.&amp;quot;. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis#Variations&quot; rel=&quot;nofollow noreferrer&quot;&gt;key point&lt;/a&gt; being:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If BQP is shown to be a strict superset of BPP, it would invalidate the complexity-theoretic Church–Turing thesis. In other words, there would be efficient quantum algorithms that perform tasks that do not have efficient probabilistic algorithms. This would not, however, invalidate the original Church–Turing thesis, since a quantum computer can always be simulated by a Turing machine, but it would invalidate the classical complexity-theoretic Church–Turing thesis for efficiency reasons.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A &lt;strong&gt;quantum Church-Turing thesis&lt;/strong&gt; such as &amp;quot;A quantum Turing machine can simulate any realistic model of computation&amp;quot; would not be essentially different from the &lt;strong&gt;original Church-Turing thesis&lt;/strong&gt; which states &amp;quot;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;classical Turing machine&lt;/a&gt; can simulate any realistic model of computation&amp;quot;, because without efficiency considerations they're equivalent. A classical Turing machine can certainly simulate a quantum Turing machine, although not necessarily efficiently, and vice-versa.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-10-31T05:06:45.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8627" PostTypeId="2" ParentId="8625" CreationDate="2019-10-31T06:29:28.197" Score="5" Body="&lt;p&gt;To get you started, the &lt;span class=&quot;math-container&quot;&gt;$m = 2$&lt;/span&gt; (qubit) case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start with n qubits all in the 0 state. Apply Hadamard gates to the first n-1 qubits. Apply n-1 controlled nots, each one controlled by a different one of the hadamarded qubits, and each targeting the nth qubit (the one we didn’t hadamard).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's an example circuit for &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rzQiX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rzQiX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To understand how this works, recall how a controlled-not functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pb6eD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pb6eD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if after applying the Hadamard gates we have the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2^{n-1}}}\sum_{x\in\{0,1\}^{n-1}}|x\rangle|0\rangle,&#xA;$$&lt;/span&gt;&#xA;then after all the controlled-nots I'm suggesting, the final bit is in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x_1\oplus x_2\oplus x_3\oplus\ldots \oplus x_{n-1}.&#xA;$$&lt;/span&gt;&#xA;The overall parity of the final &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit string is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x_1\oplus x_2\oplus x_3\oplus\ldots \oplus x_{n-1}\oplus (x_1\oplus x_2\oplus x_3\oplus\ldots \oplus x_{n-1})=0,&#xA;$$&lt;/span&gt;&#xA;as required.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As ChainedSymmetry pointed out, the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-dimensional generalisation is near-identical. You apply a gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\mapsto \frac{1}{\sqrt{m}}\sum_{i=0}^{m-1}|i\rangle&#xA;$$&lt;/span&gt;&#xA;on the first &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; spins. The controlled from each of these spins, targeting the &lt;span class=&quot;math-container&quot;&gt;$n^{th}$&lt;/span&gt; spin, you apply a generalisation of the controlled-not of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|j\rangle|k\rangle\mapsto|j\rangle|-j+k\text{ mod }m\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-11-02T07:27:35.130" LastActivityDate="2019-11-02T07:27:35.130" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="8628" PostTypeId="2" ParentId="8625" CreationDate="2019-10-31T06:50:00.503" Score="3" Body="&lt;p&gt;For the general case, &lt;span class=&quot;math-container&quot;&gt;$m&amp;gt;2$&lt;/span&gt;, do what DaftWullie said, except apply gates corresponding to the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-point &lt;a href=&quot;https://en.wikipedia.org/wiki/DFT_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;DFT matrix&lt;/a&gt; instead of the Hadamard gate (which is the 2-point DFT matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit Per Request&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;span class=&quot;math-container&quot;&gt;$m=3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt; use a gate (&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;) corresponding to the 3-point DFT matrix instead of the Hadamard gate to effect the transformation &lt;span class=&quot;math-container&quot;&gt;$\vert j \rangle =\tfrac{1}{\sqrt{3}} \sum \limits_{n=0}^2 e^{\frac{i 2 \pi jk}{k}} \vert k \rangle$&lt;/span&gt;.  Define &lt;span class=&quot;math-container&quot;&gt;$\omega \equiv e^{\frac{i 2\pi}{3}} = -\tfrac{1}{2} + i\tfrac{\sqrt{3}}{2}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is explicitly &#xA;&lt;span class=&quot;math-container&quot;&gt;$$M = \frac{1}{\sqrt{3}} \begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; \omega &amp;amp; \omega^2 \\ 1 &amp;amp; \omega^2 &amp;amp; \omega \end{bmatrix}$$&lt;/span&gt;&#xA;(note that &lt;span class=&quot;math-container&quot;&gt;$\omega^4=\omega$&lt;/span&gt;). The relevant circuit is almost identical to DaftWullie's except &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is replaced with &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and the computational basis now has three states.  Any other changes are superficial to aid the explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ge8xV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ge8xV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that &lt;span class=&quot;math-container&quot;&gt;$M \vert 0 \rangle = \tfrac{1}{\sqrt{3}}(\vert 0 \rangle + \vert 1 \rangle + \vert 2 \rangle)$&lt;/span&gt;, so trivially&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_0 \rangle= \tfrac{1}{3}(\vert 0 \rangle + \vert 1 \rangle + \vert 2 \rangle)\otimes (\vert 0 \rangle + \vert 1 \rangle + \vert 2 \rangle) \otimes \vert 0 \rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application of &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; between the bottom two registers gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{CNOT} (\tfrac{1}{\sqrt{3}}(\vert 0 \rangle + \vert 1 \rangle + \vert 2 \rangle) \otimes \vert 0 \rangle)=\tfrac{1}{3}(\vert 0 \rangle + \vert 1 \rangle + \vert 2 \rangle) \otimes (\vert 0 \oplus 0 \rangle + \vert 0 \oplus 1 \rangle + \vert 0 \oplus 2 \rangle),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is addition modulo 3.  This gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert\psi_1 \rangle = \tfrac{1}{3\sqrt{3}}(\vert 0 \rangle + \vert 1 \rangle + \vert 2 \rangle)\otimes (\vert 00 \rangle + \vert 01 \rangle + \vert 02 \rangle + \vert 10 \rangle + \vert 11 \rangle + \vert 12 \rangle + \vert 20 \rangle + \vert 21 \rangle + \vert 22 \rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; process is repeated between the first and third register to get to &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle$&lt;/span&gt; and arrive at the desired result&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_2 \rangle = \tfrac{1}{3 \sqrt{3}} \sum \limits_{p,q,r=0}^2 \vert p \, q \,  r \rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-11-02T14:33:24.650" LastActivityDate="2019-11-02T14:33:24.650" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8630" PostTypeId="2" ParentId="6088" CreationDate="2019-10-31T14:34:14.600" Score="2" Body="&lt;p&gt;Regarding the &quot;&lt;em&gt;quantum&lt;/em&gt; (non-extended) Church-Turing Thesis,&quot; I think this asserts that there is no physical process, like a quasar or some other astronomical woo, that we know could produce a steady supply of qubits all in the same state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, with the property that &lt;span class=&quot;math-container&quot;&gt;$\beta^2=\Omega_C$&lt;/span&gt;, that is, &lt;a href=&quot;https://en.wikipedia.org/wiki/Chaitin%27s_constant&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chaitin's halting probability&lt;/a&gt;.  We can also say classically that there is no magic coin that we know lands heads with probability precisely &lt;span class=&quot;math-container&quot;&gt;$\Omega_C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, after recent proofs that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NEEXP}\subset\mathrm{MIP^*}$&lt;/span&gt; (multi-prover interactive proofs with entangled provers), there is some indication that perhaps two God-like entities that are able to share an infinite amount of entanglement can convince a mere mortal of some undecidable proposition, maybe even in only a polynomial amount of time! See &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4233&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; I think.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-10-31T14:34:14.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8631" PostTypeId="2" ParentId="6088" CreationDate="2019-10-31T15:46:05.290" Score="4" Body="&lt;p&gt;Taking the questions head on.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm not sure that original references are very much the point, although &lt;a href=&quot;https://physics.aps.org/featured-article-pdf/10.1103/PhysRevLett.107.120501&quot; rel=&quot;nofollow noreferrer&quot;&gt;there are some&lt;/a&gt;.  It's not a hard question.  The statement is that realistic polynomial time equals what a quantum computer (if you want to be rigorous, say a QTM) can do in polynomial time.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The question has been answered many times in QCSE that a quantum computer can be simulated by a classical computer with exponential overhead.  Therefore, without the &quot;extended&quot; part, meaning limits on computation time, quantum computability is the same as classical computability.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I read Deutsch's paper differently.  He argues that quantum mechanics disproves the classical extended Church-Turing thesis, and his quote basically states that there should be &lt;em&gt;some&lt;/em&gt; realistic or &quot;physical&quot; ECT.  But I think that his paper conservatively does not say what the true version of ECT should be, only that it should be at least as much as what a quantum computer can do.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;All that said, my own view is that when you see a revolution in science, you don't usually need or get another one of the exact same kind.  In other words, even when scientists (as a group) get a fundamental question wrong on the first try, they usually get it right on the second or third try.  I think that quantum computers are realistic in principle, but I have never seen any good argument for some fantastic new thing afterwards that is even more powerful than quantum computers. It's hard to call that impossible, but only because there is no way to argue against the unforseeable.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-10-31T15:55:26.707" LastActivityDate="2019-10-31T15:55:26.707" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8632" PostTypeId="2" ParentId="8620" CreationDate="2019-10-31T16:01:13.170" Score="3" Body="&lt;p&gt;In the framing of the question (which I believe to be asked in good faith), there seems to be at least two objections.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampling from a set of strings is not clearly a function, and&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Sampling is a physical process, outside of computation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Initially, with regard to the first objection, I assert that sampling &lt;em&gt;is&lt;/em&gt; a function, as a search problem.  For example, as noted by Ryan O'Donnell in &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4317#comment-1819915&quot; rel=&quot;nofollow noreferrer&quot;&gt;comment #13&lt;/a&gt;, we can think of sampling as akin to searching for a set of strings that have an expected probability sufficiently &lt;span class=&quot;math-container&quot;&gt;$\gt 1/2^n$&lt;/span&gt; of being sampled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To me this has a similar feel to the following:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Given a set of strings &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^*$&lt;/span&gt;, suppose we wish to uniformly sample from the strings, with a probability, say, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.  We can do this by searching for a set of strings such that a hash of the strings is &lt;span class=&quot;math-container&quot;&gt;$\le p$&lt;/span&gt; (for a hash with nice enough properties.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;With regard to the second objection, I assert that the process of sampling from a random quantum circuit, although a physical process, is not outside of computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Martinis likes to relate sampling to speckle patterns - that is, to shining a light through fractured glass and determining where the peaks of coherent light may lie.  This is clearly a &quot;physical process.&quot;  However, a difference between a quantum computer performing the task and a laser shown through glass is that the quantum computer is &lt;em&gt;programmable&lt;/em&gt; to perform the said task, whereas the crushed glass does not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, a quantum computer is able to prepare and sample from a state &lt;em&gt;of someone's choosing.&lt;/em&gt;  Although a physical process, I assert that it meets the definition of a &lt;em&gt;computation&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="26" LastEditDate="2019-10-31T16:08:01.107" LastActivityDate="2019-10-31T16:08:01.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8634" PostTypeId="1" AcceptedAnswerId="8636" CreationDate="2019-10-31T17:18:42.060" Score="4" ViewCount="251" Body="&lt;p&gt;Quick question on the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entanglement in Graph States&lt;/a&gt;. On page 14. a definition of a graph state: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$|+\rangle=\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;. Let&#xA;  &lt;span class=&quot;math-container&quot;&gt;$G=(V,E)$&lt;/span&gt; be a graph. The graph state &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt; that corresponds to&#xA;  the graph &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is the pure state with vector &lt;span class=&quot;math-container&quot;&gt;$$|G\rangle =&#xA; \prod_{\{a,b\}\in E}U_{ab}|+\rangle^{V} $$&lt;/span&gt; where&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$U_{ab}|+\rangle^a|+\rangle^b =&#xA; \frac{1}{\sqrt{2}}(|0\rangle^a|+\rangle^b+|1\rangle^a|-\rangle^b)~~~~~(*)$$&lt;/span&gt; is&#xA;  maximally entangled (Bell state).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why is (*) stated as being a maximally entangled Bell state, this does not seem to correspond to any of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;four maximally entangled Bell states&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, as an example, on page 37, it states &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This is easily seen by applying Hadamard unitaries &lt;span class=&quot;math-container&quot;&gt;$H^{V\setminus a}$&lt;/span&gt; to all&#xA;  but one qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in the GHZ state, which yields the star graph state&#xA;  with &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; as the central qubit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/noR2u.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/noR2u.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we start with an empty graph, with vertices representing states &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, then how would Hadamard operations which are local on each qubit site going to produce an entangled state? Why are they not using the above definition, using &lt;span class=&quot;math-container&quot;&gt;$U_{ab}|+\rangle$&lt;/span&gt;,  to define the GHZ state?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="2032" LastEditDate="2019-11-01T10:19:14.410" LastActivityDate="2019-11-01T10:19:14.410" Title="Query on paper on entanglement in graph states" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;graph-states&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8636" PostTypeId="2" ParentId="8634" CreationDate="2019-10-31T18:16:34.387" Score="5" Body="&lt;p&gt;The state of Equation * is &lt;em&gt;local unitary equivalent&lt;/em&gt; to all of the four Bell states. That is, there exists a unitary matrix of tensor-product structure &lt;span class=&quot;math-container&quot;&gt;$V_a \otimes V_b$&lt;/span&gt;, such that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{ab}|+\rangle\otimes |+\rangle = V_a \otimes V_b \frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of its entanglement properties, Equation * is completely equivalent to the Bell state. You can check this for pure bipartite states by looking at the eigenvalues of its reduced density matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Page 37 again refers to local unitary equivalence, where a tensor product of Hadamards on all but one qubit maps the GHZ state to the star graph state.&#xA;Again, both states have the same entanglement properties.&lt;/p&gt;&#xA;" OwnerUserId="2192" LastEditorUserId="23" LastEditDate="2019-10-31T23:22:14.497" LastActivityDate="2019-10-31T23:22:14.497" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8637" PostTypeId="2" ParentId="8463" CreationDate="2019-10-31T23:59:38.017" Score="2" Body="&lt;p&gt;In fact, you would need an astronomical circuit depth in order to get close to a uniformly random state, or even close to a randomly chosen probability distribution on the &lt;span class=&quot;math-container&quot;&gt;$2^{53}$&lt;/span&gt; outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a first estimate, consider how many different distributions you need in order to be within 1/8 of the total variation distance of any distribution on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; outputs.   There is special formula that the TVD ball of radius &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, in the space of these distributions, has volume &lt;span class=&quot;math-container&quot;&gt;$r^{N-1}\binom{2N-2}{N-1}$&lt;/span&gt; times the volume of the entire simplex of distributions.    Recall also the elementary inequality &lt;span class=&quot;math-container&quot;&gt;$\binom{2N-2}{N-1} &amp;lt; 4^{N-1}$&lt;/span&gt;.   Therefore, to get within a TVD distance of &lt;span class=&quot;math-container&quot;&gt;$\frac18$&lt;/span&gt; of even half of the space of measures on the simplex, you need at least &lt;span class=&quot;math-container&quot;&gt;$2^{N-2}$&lt;/span&gt; examples.   Recall also that &lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt; is exponential in the number of qubits.  The result is a doubly exponential lower bound for the number of needed circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other side, technically speaking there are infinitely many random circuits of any given depth, because a 2-qubit gate has continuous parameters.  However, there is some finite set of gates that comes close to all of the 2-qubit gates.  Skipping over some calculation, the end result is that unitary operators that you can make with circuits of depth &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is well-approximated by &lt;span class=&quot;math-container&quot;&gt;$2^{\mathrm{poly}(n,d)}$&lt;/span&gt; distinct examples, which is only singly exponential with a polynomial exponent, rather than doubly exponential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if circuits of any reasonable size don't produce a randomly chosen distribution, small circuits might still produce states or distributions with the same &lt;em&gt;features&lt;/em&gt; as one that is actually randomly chosen.  For many natural types of features, such as the spectrum of probabilities of the individual outcomes, that is exactly what happens. The approximate &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design property is a related standard, and is much weaker than actually achieving a uniformly random distribution on outputs or anything close to it.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-10-31T23:59:38.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8638" PostTypeId="1" CreationDate="2019-11-01T01:50:36.000" Score="0" ViewCount="137" Body="&lt;p&gt;&lt;strong&gt;I am not a scientist, so that's why I've come here...to hopefully find out if this would be possible.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so I started learning about quantum entanglement and I stumbled upon an idea for instant data transmission through space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The idea is fairly basic, &#xA;because quantum entangled particles are dependent on each other to create 1 shared state...(I think) we could separate two entangled particles and then modify one to create an instant change on the other particle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This change would be read and computed as binary code 1-0-0-1-1-0-1-0 for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the best way i can explain my theory, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.imgur.com/VJuSICN.jpg&quot; alt=&quot;example&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply put as one question, is instant data transmission possible in this way? Or at least faster than light (laser arrays)?&lt;/p&gt;&#xA;" OwnerUserId="8949" LastEditorUserId="26" LastEditDate="2019-11-01T10:31:54.870" LastActivityDate="2019-11-02T08:04:46.993" Title="Faster than light data transmission using entanglement" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2019-11-02T08:04:15.840" ContentLicense="CC BY-SA 4.0" />
  <row Id="8639" PostTypeId="1" AcceptedAnswerId="8703" CreationDate="2019-11-01T01:56:47.290" Score="3" ViewCount="122" Body="&lt;p&gt;Does IBM compute a measurement error mitigation calibration matrix that can be accessed from its device properties or somewhere else? Or does the user have to do that every time?&lt;/p&gt;&#xA;" OwnerUserId="8950" LastEditorUserId="2293" LastEditDate="2020-08-17T02:52:59.143" LastActivityDate="2020-08-17T02:52:59.143" Title="Existing measurement error mitigation" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8640" PostTypeId="1" AcceptedAnswerId="8641" CreationDate="2019-11-01T06:06:07.850" Score="1" ViewCount="548" Body="&lt;p&gt;Tried executing &lt;code&gt;plot_histogram(result.get_counts(circuit))&lt;/code&gt;&#xA;where result has the job result and circuit is the Quantum circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But an attribute error hits every time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError: 'function' object has no attribute 'get_counts'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried going through the qiskit tutorial documentation, but couldn't help myself with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can somebody point out what's wrong here?&lt;/p&gt;&#xA;" OwnerUserId="8953" LastEditorUserId="26" LastEditDate="2019-11-01T10:28:24.103" LastActivityDate="2019-11-01T10:28:24.103" Title="Attribute error in Qiskit" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8641" PostTypeId="2" ParentId="8640" CreationDate="2019-11-01T08:50:51.087" Score="1" Body="&lt;p&gt;It sounds like maybe one of the calls is missed. To get results you need to run&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend('qasm_simulator')&#xA;job = execute(circ, backend)&#xA;result = job.result()&#xA;plot_histogram(result.get_counts(circuit)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-01T08:50:51.087" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8642" PostTypeId="2" ParentId="8638" CreationDate="2019-11-01T08:55:55.193" Score="3" Body="&lt;p&gt;No, you cannot use this for faster than light communication. The two typical ways that people think this &lt;em&gt;could&lt;/em&gt; work are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice measures her qubit in a fixed basis, creating an instantaneous change in Bob's qubit. This is true, but the measurement outcome is random. Alice has no control over what measurement outcome she gets, so no &lt;em&gt;information&lt;/em&gt; is transmitted in that protocol.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice chooses a measurement basis, and that choice is the bit she tries to communicate. Bob's qubit is instantaneously updated, but he has no way do determine what basis she used.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Either way, there's no way around it.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-01T08:55:55.193" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8643" PostTypeId="2" ParentId="8634" CreationDate="2019-11-01T09:03:58.170" Score="4" Body="&lt;p&gt;Felix Huber's answer is correct, but I thought I'd fill in a few more details.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You've written the two-qubit state of (&lt;span class=&quot;math-container&quot;&gt;$\star$&lt;/span&gt;) as &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle|+\rangle+|1\rangle|-\rangle)/\sqrt{2}$&lt;/span&gt;. Notice that if you apply a Hadamard to the second qubit, you change it to  &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle|0\rangle+|1\rangle|1\rangle)/\sqrt{2}$&lt;/span&gt;, a Bell state. The point is that from the perspective of entanglement, you cannot change how much entanglement is there by applying unitaries on individual qubits, so (&lt;span class=&quot;math-container&quot;&gt;$\star$&lt;/span&gt;) must be just as entangled as a Bell state. We say that it's equivalent up to local unitaries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The GHZ case is very similar. The way I find it easiest to think about this case is to start with the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes 7}$&lt;/span&gt; state, before we apply controlled-phases, and split up the central qubit of the star:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle|+\rangle^{\otimes 6}+|1\rangle|+\rangle^{\otimes 6}).&#xA;$$&lt;/span&gt;&#xA;Now, we apply the controlled-phase gate 6 times, each time controlled by the central qubit. So, if that qubit is 0, nothing happens. If that qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is applied on all the other qubits. But &lt;span class=&quot;math-container&quot;&gt;$Z|+\rangle=|-\rangle$&lt;/span&gt;, so we're left with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle|+\rangle^{\otimes 6}+|1\rangle|-\rangle^{\otimes 6}).&#xA;$$&lt;/span&gt;&#xA;This is locally equivalent to a GHZ state because if we apply Hadamards to those 6 non-central qubits, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle|0\rangle^{\otimes 6}+|1\rangle|1\rangle^{\otimes 6}).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-01T09:03:58.170" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8644" PostTypeId="1" AcceptedAnswerId="8646" CreationDate="2019-11-01T11:09:07.550" Score="3" ViewCount="219" Body="&lt;p&gt;I'm confused about what precisely is the difference between Grover's Algorithm and Amplitude Amplification. I've heard some sources say they are different algorithms and others say they are the same thing. As I currently understand it,&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt; you are searching for a state &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; (or multiple states) marked by an oracle, and you find this by applying Grover iterations that comprise of phase inversion &lt;span class=&quot;math-container&quot;&gt;$I-2|\omega\rangle\langle \omega|$&lt;/span&gt; and mean inversion &lt;span class=&quot;math-container&quot;&gt;$I-2|s\rangle\langle s|$&lt;/span&gt; in alternation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amplitude Amplification&lt;/a&gt;, you have a projection operator P that projects you on to a &quot;good&quot; subspace, which seems to essentially boil down to marking a set of states. Then you have an operator &lt;span class=&quot;math-container&quot;&gt;$S_P = 1 - 2P$&lt;/span&gt; that does phase inversion on those states and &lt;span class=&quot;math-container&quot;&gt;$S_\psi = 1 - 2|\psi\rangle\langle \psi|$&lt;/span&gt; which seems to invert about your initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So is the difference that in AA you are starting in an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and in Grover's you set &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to be the uniform superposition state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;? Are there other important differences I am missing?&lt;/p&gt;&#xA;" OwnerUserId="4841" LastActivityDate="2019-11-01T19:56:39.980" Title="What is the difference between Grover's and Amplitude Amplification?" Tags="&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8645" PostTypeId="1" AcceptedAnswerId="8648" CreationDate="2019-11-01T11:35:46.643" Score="7" ViewCount="1557" Body="&lt;p&gt;I've just gotten started with Nielsen and Chuang's text, and I'm a little stuck. They mention that theoretically, it would be possible to store an infinite amount of information in the state of a single qubit. I'm not sure I completely comprehend this.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I rationalized it: You take all the information you want to store, put it in binary form, and make it the real component of &lt;span class=&quot;math-container&quot;&gt;$\alpha $&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; (the coefficients of the computational basis states). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I'm not sure if I've understood it right, but since it's still fuzzy in my head it would be great to get some kind of ELI5 explanation or possibly a more detailed picture of how this would, even theoretically, be possible.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apologies if the question doesn't meet standards. I'm new to the forum and would be open to feedback regarding asking questions or answering them.&lt;/p&gt;&#xA;" OwnerUserId="8955" LastEditorUserId="55" LastEditDate="2020-12-21T23:51:00.210" LastActivityDate="2020-12-23T16:09:25.470" Title="How can infinite information be theoretically encoded or stored in a single qubit?" Tags="&lt;quantum-state&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8646" PostTypeId="2" ParentId="8644" CreationDate="2019-11-01T11:55:33.440" Score="4" Body="&lt;p&gt;Grover's algorithm is a special case of the amplitude amplification algorithm where the number of &lt;em&gt;good entries&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-item database is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In a nutshell:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In the Grover's algorithm &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiki page&lt;/a&gt; that you linked, the keyword is &amp;quot;&lt;strong&gt;unique&lt;/strong&gt;&amp;quot;. Given &lt;span class=&quot;math-container&quot;&gt;$f:\{0, \ldots, N-1\} \to \{0, 1\}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; &lt;strong&gt;for exactly one&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (say &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;), Grover's algorithm amplifies the quantum state corresponding to &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. Amplitude amplification is the generalized version that can amplify the quantum states corresponding to &lt;strong&gt;multiple entries&lt;/strong&gt;, given their output is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;em&gt;both&lt;/em&gt; the algorithms you begin with a uniform superposition state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{\sqrt N}\sum_{k=0}^{N-1}|k\rangle$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of database entries (cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification#Applications&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). No difference there.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The amplitude amplification algorithm calls the &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_subspace&quot; rel=&quot;nofollow noreferrer&quot;&gt;subspace&lt;/a&gt; (of the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;) of strings &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;'s for which output of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; as the &lt;em&gt;good subspace&lt;/em&gt;. They are just dividing the entire Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; into two mutually orthogonal subspaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_0$&lt;/span&gt;, just like in Grover's algorithm, but there the &lt;em&gt;good subspace&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; was single-dimensional i.e., corresponding to the unique marked state &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Upon further reading, it appears &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0005055&quot; rel=&quot;nofollow noreferrer&quot;&gt;Brassard &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt; (2000) generalized &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9605043&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's original algorithm (1997)&lt;/a&gt; in more ways than one, and were the first to coin the term &lt;em&gt;quantum amplitude amplification&lt;/em&gt;. For a quick summary, refer to the &lt;strong&gt;concluding remarks&lt;/strong&gt; section on pages 25-26.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-11-01T19:56:39.980" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="8647" PostTypeId="2" ParentId="8645" CreationDate="2019-11-01T12:21:05.000" Score="6" Body="&lt;p&gt;&lt;strong&gt;Highly Relevant&lt;/strong&gt;: &lt;a href=&quot;https://physics.stackexchange.com/a/3791&quot;&gt;(Physics SE) Informational capacity of qubits and photons&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Here's how I rationalized it: You take all the information you want to store, put it in binary form, and make it the real component of &lt;span class=&quot;math-container&quot;&gt;$\alpha $&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; (the coefficients of the computational basis states).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes, and then if you could then prepare a qubit precisely in the &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;, in some sense you would be storing infinite information in a single qubit.&lt;/p&gt;&#xA;&lt;p&gt;Though, the drawback is, firstly it's not possible to prepare quantum states that precisely in practice due to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/94/26&quot;&gt;noise&lt;/a&gt; and other engineering limitations. Secondly, even if you managed to do that, you wouldn't be able to recover that information by measuring the qubit, as qubits immediately collapse to one of their basis states (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; being the standard basis states).&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;encoding infinite information&amp;quot; idea is funny because it's certainly possible to claim that hypothetically &lt;em&gt;if&lt;/em&gt; you can produce radio waves with frequency an integer multiple of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; or any other non-recurring, non-terminating irrational number for that matter that has unlimited decimal places, you are storing infinite information in that radio wave. It doesn't mean that the information is useful or practically retrievable!&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="14237" LastEditDate="2020-12-23T16:09:25.470" LastActivityDate="2020-12-23T16:09:25.470" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8648" PostTypeId="2" ParentId="8645" CreationDate="2019-11-01T16:13:32.497" Score="12" Body="&lt;p&gt;I'm not sure what passage in Nielsen and Chuang you have in mind and I see all of this differently.   I don't see any need to believe that it is &quot;theoretically&quot; possible store an infinite amount of information in a qubit.   My answer to the paradox is that amplitudes aren't stored information.  A qubit does not know its amplitudes any more than a randomized bit knows the chance that it is a 1.   If the bit has 0.637 chance of being 1, that does not mean that 0.637 has been stored anywhere.  The size of the bit's brain is exactly one bit; it can only tell you 0 or 1 if you ask it the one question that it can answer.   Now a qubit can answer any one out of a continuous family of binary questions; but it can still only answer &lt;em&gt;one&lt;/em&gt; such question in the sense that that completely determines its posterior state for future questions.  A qubit is still too small to give a clean answer to any question with more than two answers, and it certainly does not have room to store decimal expansions of numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To reiterate, quantum amplitudes are similar to classical probabilities.  They are statistical features that are not directly stored by the systems that obey the statistics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Holevo-Nayak theorem says that n qubits cannot store any more than n classical bits.  That's the real answer to the question of how a qubit can encode or store infinite information, &quot;theoretically&quot; or otherwise.  Answer:  It can't.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-11-02T16:46:49.253" LastActivityDate="2019-11-02T16:46:49.253" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="8649" PostTypeId="1" CreationDate="2019-11-01T16:20:00.617" Score="3" ViewCount="645" Body="&lt;p&gt;I am a computer engineer and have recently started understanding quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still struggling to wrap my head around some concepts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One such query is the following -&#xA;It is said that during the computation the qubits exist in the multiple states with some probability until it is measured. Once the act of measurement is done all the probabilities collapse and one answer is the output. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what I am not able to get my head around is, how are we sure that this collapsed answer is the right answer?&#xA;Since the superposition states are probabilistic in nature, there is a probability (though slim) of a wrong answer being output too. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also since we cannot see or measure the intermediate superposition states we do not know which state has the highest probability. So how do we make quantum computer output the right answer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would highly appreciate someone to guide me through this. &lt;/p&gt;&#xA;" OwnerUserId="8822" LastEditorUserId="8822" LastEditDate="2019-11-02T03:47:30.197" LastActivityDate="2019-11-04T18:41:24.187" Title="How do quantum states collapse to the right answer?" Tags="&lt;algorithm&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8650" PostTypeId="2" ParentId="3932" CreationDate="2019-11-01T19:16:24.850" Score="2" Body="&lt;p&gt;Initially let's consider some registers and operators.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The register &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt;, which encodes superpositions of states of the cube (e.g. a permutation of the cube &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;);&lt;/li&gt;&#xA;&lt;li&gt;The operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, which acts on &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt; to map the all-0's ket &lt;span class=&quot;math-container&quot;&gt;$\vert 00\cdots 0\rangle$&lt;/span&gt; to the uniform superposition over all &lt;span class=&quot;math-container&quot;&gt;$\Vert G\Vert$&lt;/span&gt; states;&lt;/li&gt;&#xA;&lt;li&gt;The register &lt;span class=&quot;math-container&quot;&gt;$\vert B\rangle=\vert b_1\rangle\vert b_2\rangle\cdots\vert b_k\rangle$&lt;/span&gt;, which encodes superpositions of a set of Singmaster moves to be applied to a given position (e.g., superpositions of words of Singmaster moves of length &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;);&lt;/li&gt;&#xA;&lt;li&gt;The operators &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V^{-1}$&lt;/span&gt;, which act on &lt;span class=&quot;math-container&quot;&gt;$\vert B\rangle$&lt;/span&gt; to map the all-0's ket &lt;span class=&quot;math-container&quot;&gt;$\vert 00\cdots 0\rangle$&lt;/span&gt; to the uniform superposition of all &lt;span class=&quot;math-container&quot;&gt;$18^k$&lt;/span&gt; words of Singmaster moves of length &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (and vice-versa); and&lt;/li&gt;&#xA;&lt;li&gt;The (controlled) operator &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, which applies Singmaster move &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; to to a given cube position.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt; is in the uniform superposition over all elements of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt; is in an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, and repeated applications of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; will not be kicked back to affect &lt;span class=&quot;math-container&quot;&gt;$\vert B\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NIUkA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NIUkA.png&quot; alt=&quot;Circuit that does not change the state&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, &lt;span class=&quot;math-container&quot;&gt;$V^{-1}$&lt;/span&gt; should return &lt;span class=&quot;math-container&quot;&gt;$\vert B\rangle$&lt;/span&gt; in the above circuit to the all-zeroes ket &lt;span class=&quot;math-container&quot;&gt;$\vert 00\cdots 0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, as noted by @DaftWullie, if &lt;span class=&quot;math-container&quot;&gt;$\vert u\rangle$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; in an eigenstate, then a difference between &lt;span class=&quot;math-container&quot;&gt;$\vert u \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho^k \vert u\rangle$&lt;/span&gt; builds up &lt;em&gt;very rapidly&lt;/em&gt; - I believe a speed at which this difference builds up  depends &lt;em&gt;precisely&lt;/em&gt; on the mixing properties of the operator of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, if we are able to prepare a state &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt; that is &lt;em&gt;perturbed&lt;/em&gt; from the uniform distribution, such that &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt; is not an eigenstate, then repeated applications of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; &lt;em&gt;will&lt;/em&gt; rapidly build a difference, and &lt;span class=&quot;math-container&quot;&gt;$V^{-1}\vert B\rangle$&lt;/span&gt; may not be the all-zeroes ket.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/areiz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/areiz.png&quot; alt=&quot;Revised circuit showing better approach&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we had a function &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt; and an answer qubit &lt;span class=&quot;math-container&quot;&gt;$\vert C\rangle$&lt;/span&gt; that determines, say, whether some hash &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^{\log_2 \Vert G\Vert}\mapsto (0,1)$&lt;/span&gt; of the Rubik's cube position is less than some threshold &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;, and we use this &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; to control a rotation of &lt;span class=&quot;math-container&quot;&gt;$\vert A\rangle$&lt;/span&gt;, then &lt;em&gt;I believe&lt;/em&gt; that &lt;span class=&quot;math-container&quot;&gt;$V^{-1}\vert B\rangle$&lt;/span&gt; in the circuit above will &lt;em&gt;not&lt;/em&gt; read the all-zeros ket, and instead will likely deviate from the all-zeroes ket in a manner depending only on &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; and the mixing time of the Rubik's cube group with the Singmaster generating set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, I expect measurement of &lt;span class=&quot;math-container&quot;&gt;$\vert B\rangle$&lt;/span&gt; in the above circuit will read &lt;span class=&quot;math-container&quot;&gt;$\vert 00000\cdots000101101\rangle$&lt;/span&gt;  or something similar, where &lt;strong&gt;the index of the first &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; depends solely on the mixing time and the threshold &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-30T20:17:35.107" LastActivityDate="2019-11-30T20:17:35.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8651" PostTypeId="1" AcceptedAnswerId="11866" CreationDate="2019-11-01T20:41:28.377" Score="5" ViewCount="150" Body="&lt;p&gt;Are there any distributed consensus protocols which make use of quantum phenomena for improved performance? For example, symmetry breaking with a shared quantum state.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2020-05-05T22:01:35.230" Title="Entanglement and distributed consensus" Tags="&lt;entanglement&gt;&lt;quantum-networks&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8652" PostTypeId="1" AcceptedAnswerId="8654" CreationDate="2019-11-01T20:50:33.007" Score="4" ViewCount="134" Body="&lt;p&gt;An instructional quantum computing article I'm reading (&lt;a href=&quot;https://quantum.country/search#how-to-reflect-about-the-s-and-E-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;How the quantum search algorithm works&lt;/a&gt;) states that the following circuit takes &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle\vert 0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$−\vert x\rangle\vert 0\rangle$&lt;/span&gt;, when &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; is anything other than &lt;span class=&quot;math-container&quot;&gt;$\vert 00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HkD1V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HkD1V.png&quot; alt=&quot;Reflecting across the all 0 state&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: how can an operation (-Z gate) on the target qubit (the bottom one) affect the control qubits (the top 4 ones)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would expect the result of this circuit, when &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is anything other than &lt;span class=&quot;math-container&quot;&gt;$\vert 0000\rangle$&lt;/span&gt;, to be &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle(−\vert 0\rangle)$&lt;/span&gt;. I understand that, algebraically, &lt;span class=&quot;math-container&quot;&gt;$(x)(-y)$&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$-xy$&lt;/span&gt;, but intuitively, looking at this circuit, I don't see how those top 4 qubits would be affected by something happening to the bottom qubit. (I know, intuition doesn't have much place in quantum mechanics.) My hunch is that entanglement is at play.&lt;/p&gt;&#xA;" OwnerUserId="8959" LastEditorUserId="2927" LastEditDate="2019-11-02T13:27:21.040" LastActivityDate="2019-11-02T13:38:26.503" Title="How does a single-qubit gate affect other qubits?" Tags="&lt;entanglement&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8653" PostTypeId="1" CreationDate="2019-11-01T21:40:18.880" Score="4" ViewCount="221" Body="&lt;p&gt;I am attempting to mitigate measurement error while running on one of IBM's real devices and am doing so by passing CompleteMeasFitter into &lt;code&gt;measurement_error_mitigation_cls&lt;/code&gt; in QuantumInstance. However, when I run the program, I receive the following error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.aqua.aqua_error.AquaError: 'The qubit mapping of circuits are different. &#xA;Currently, we only support single mapping.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I can see that the problem is coming from &lt;code&gt;get_measured_qubits_from_qobj&lt;/code&gt; in &lt;code&gt;measurment_error_mitigation.py&lt;/code&gt;. After a few iterations, the &lt;code&gt;measured_qubits&lt;/code&gt; and &lt;code&gt;qubit_mapping&lt;/code&gt; are not equal. I figured that the problem could be arising from the transpiler since the default optimization level is 1, meaning it will optimize based on connectivity. So, I tried changing &lt;code&gt;optimization_level&lt;/code&gt; to 0 in quantum instance in hopes that &lt;code&gt;qubit_mapping&lt;/code&gt; and measured_qubit will not be different, but have not had any luck. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I go about fixing this problem?&lt;/p&gt;&#xA;" OwnerUserId="8961" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:37.913" LastActivityDate="2020-08-17T02:53:37.913" Title="Problem with measurement error mitigation using VQE" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;vqe&gt;&lt;error-mitigation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8654" PostTypeId="2" ParentId="8652" CreationDate="2019-11-02T05:35:18.533" Score="4" Body="&lt;p&gt;The phase of -1 generated on the ancilla is just a &lt;a href=&quot;https://physics.stackexchange.com/a/329648/199113&quot;&gt;global phase&lt;/a&gt;. You can shift it to any qubit &lt;a href=&quot;https://physics.stackexchange.com/a/329648/199113&quot;&gt;without affecting the statistics&lt;/a&gt; of the system. Nothing to do with entanglement.&lt;/p&gt;&#xA;&lt;p&gt;Quantum mechanics is a mathematical framework that describes reality &lt;strong&gt;insofar that it predicts the correct observable statistics&lt;/strong&gt; of a system. Shifting around a global phase factor from one qubit to another doesn't cause any deviation in the observable statistics and thus, they're all equivalent quantum states of the 5 qubits, &lt;strong&gt;mathematically as well as physically&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;&lt;span class=&quot;math-container&quot;&gt;$$-(|x\rangle\otimes |0\rangle) \equiv |x\rangle \otimes (-|0\rangle) \equiv (-|x\rangle)\otimes|0\rangle$$&lt;/span&gt;&lt;/h2&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;As you're beginning to learn quantum computing you'll soon also hit another &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2565/why-does-the-phase-kickback-mechanism-work-in-the-quantum-phase-estimation-alg&quot;&gt;conceptual block&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Though your question doesn't ask about it, I'll briefly point out a couple of things. For some reason people seem to believe that state of control qubits should not change when a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate is applied. The actual statement is that &lt;em&gt;only&lt;/em&gt; the standard basis states &lt;span class=&quot;math-container&quot;&gt;$|\{0, 1\}^c\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; being the number of control qubits) remain unaffected by controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;p&gt;If the control qubits are in a state that is different from one of the standard basis states, then theoretically their state could very well be affected. Moreover, as Niel de Beaudrap beautifully illustrates &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2572/26&quot;&gt;here&lt;/a&gt;, you should not attach too much significance to the standard basis!&lt;/p&gt;&#xA;&lt;p&gt;The phenomenon is known as &lt;strong&gt;phase kickback mechanism&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If we apply a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate to &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt; (an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;; &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi_k}$&lt;/span&gt; being the eigenvalue), &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt; is unchanged, and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0| + e^{i\phi_k}|1\rangle\langle 1|$&lt;/span&gt; is applied to the &lt;em&gt;control&lt;/em&gt; qubit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iNmiH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iNmiH.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For a detailed explanation, check &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2568/26&quot;&gt;DaftWullie's answer&lt;/a&gt; and the subsequent discussion in the comments.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-11-02T06:18:41.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8655" PostTypeId="2" ParentId="8645" CreationDate="2019-11-02T12:27:22.680" Score="2" Body="&lt;p&gt;Here is another way to think about it. &#xA;You can, in principle, store an infinite amount of information into a qubit, &lt;em&gt;in the sense that you might need arbitrarily many bits to exactly pinpoint its state&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is not as weird or surprising as one could think. You can make the same argument about a (classical) probability distributions.&#xA;Given any amount of information, I can always find a way to encode it into a probability distribution over a bit.  For example, given &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; bits of classical information in the form of a bitsring &lt;span class=&quot;math-container&quot;&gt;$\equiv(x_1,...,x_N)$&lt;/span&gt;, just define &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as the number having that bitstring as binary decomposition, and then use a probability distribution with &lt;span class=&quot;math-container&quot;&gt;$p_0=x 2^{-M}$&lt;/span&gt; for a big enough &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. &#xA;&#xA;&#xA;&lt;p&gt;About the matter of &lt;em&gt;retrieving&lt;/em&gt; the information &quot;stored&quot; this way, you find in both classical and quantum case that there is no way to do that &lt;em&gt;with a single measurement&lt;/em&gt;. In other words, the more information you want to retrieve from a probability distribution, the more you need to sample from it. Holevo's theorem essentially tells you that quantum mechanics doesn't give any advantages over the classical case in this task.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-02T13:00:51.130" LastActivityDate="2019-11-02T13:00:51.130" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8656" PostTypeId="2" ParentId="8649" CreationDate="2019-11-02T12:33:13.953" Score="2" Body="&lt;p&gt;I see maybe three questions here:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given an efficient (quantum) algorithm, how is it that the efficient algorithm will give the correct answer with high probability?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given an efficient (quantum) algorithm, how do we &lt;em&gt;know&lt;/em&gt; that the efficient algorithm will give the correct answer with high probability?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Upon executing our efficient quantum algorithm, how can we be sure that the probabilistic answer so achieved is correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Regarding the &lt;strong&gt;first&lt;/strong&gt; question, this is answered in the comments.  The quantum algorithm choreographs the probability amplitudes to interfere constructively to the correct answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the &lt;strong&gt;second&lt;/strong&gt; question, many algorithms are proved both efficient and  correct with high probability, but indeed there are some quantum algorithms and heuristics that we are &lt;em&gt;not&lt;/em&gt; sure will give a correct answer in an efficient amount of time.  For example, as I understand it the &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum adiabatic algorithm&lt;/a&gt; or the &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum approximate optimization algorithm&lt;/a&gt; in many cases &lt;em&gt;lack&lt;/em&gt; a proof that an answer will be provided in an efficient amount of time.  That is, although the correct answer may eventually be given with high-enough probability, it is unknown whether the answer will be given in a short-enough amount of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the &lt;strong&gt;third&lt;/strong&gt; question, for very many problems of interest, we hope a quantum algorithm will give an answer to a problem in the so-called &lt;span class=&quot;math-container&quot;&gt;$\mathrm{TFNP}$&lt;/span&gt; class of problems (see comments).  The implication is that if our quantum computer provides one answer, we can &lt;em&gt;test&lt;/em&gt; that answer on our classical computer to determine whether the answer is correct.  For example, the oft-repeated quip that quantum computers have used Shor's algorithm to successfully factor &lt;span class=&quot;math-container&quot;&gt;$21$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$3\times 7$&lt;/span&gt; &lt;em&gt;&quot;with high probability&quot;&lt;/em&gt; has a joke hidden therein.  Namely, the quantum computer successfully determined that &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; is a factor of &lt;span class=&quot;math-container&quot;&gt;$21$&lt;/span&gt; with high probability, or that &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; is a factor of &lt;span class=&quot;math-container&quot;&gt;$21$&lt;/span&gt; with high probability, and we can classically check that &lt;span class=&quot;math-container&quot;&gt;$21=3\times 7$&lt;/span&gt;.  The same could be said for any problem in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{TFNP}$&lt;/span&gt; that also happens to have an efficient quantum algorithm - e.g. problems in the so-called so-called &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; complexity class.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt;, interestingly there are indeed some problems that have an &lt;em&gt;efficient&lt;/em&gt; quantum algorithm to find a putative answer, but likely do not have an &lt;em&gt;efficient&lt;/em&gt; classical verification algorithm that can verify the putative answer.  For example, determining certain properties of mathematical &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;nofollow noreferrer&quot;&gt;knots&lt;/a&gt; falls into this category, as does, for example, Google's approach to quantum supremacy, and there are indeed issues about the classical verification of the output of such algorithms - but I don't think that's the direction the OP was going.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-02T17:32:22.317" LastActivityDate="2019-11-02T17:32:22.317" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8657" PostTypeId="2" ParentId="8652" CreationDate="2019-11-02T13:38:26.503" Score="3" Body="&lt;p&gt;This is not an attempt to answer the question directly, but might help with the intuition. They key point is that multi-qubit gates can propagate the effect of a single-qubit rotation to other qubits. So, there's the technicality of &lt;em&gt;what&lt;/em&gt; effect is propagated that I'll leave to other answers, but just to convince you that it &lt;em&gt;can&lt;/em&gt; propagate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a very simple circuit of two qubits. We apply the sequence SWAP - single-qubit rotation on qubit 2 - SWAP. I hope you'll agree that the net effect of this is simply that the single-qubit rotation is actually applied to the first qubit, not the second. So, it's all about those multi-qubit gates...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-02T13:38:26.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8658" PostTypeId="1" CreationDate="2019-11-02T20:44:11.460" Score="3" ViewCount="187" Body="&lt;p&gt;What information can we get out about the eigenvalues of a reduced density matrix knowing the eigenvalues of the original matrix?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, it can be proved that if all the eigenvalues of a density matrix are positive, then the eigenvalues of the reduced density matrix are positive too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1742-6596/36/1/014/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;From here,&lt;/a&gt; it looks like knowing all the eigenvalues is a hard problem, but what information can we possibly obtain? Information about the determinant perhaps?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2020-12-21T23:50:55.453" LastActivityDate="2020-12-21T23:50:55.453" Title="What can we know about the eigenvalues of a reduced density matrix knowing the eigenvalues of the original matrix?" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8659" PostTypeId="1" AcceptedAnswerId="8660" CreationDate="2019-11-03T12:22:14.197" Score="3" ViewCount="601" Body="&lt;p&gt;By the classic theory of computation, every classic gate can be build with NAND operation, for example XOR (&quot;the classic CNOT&quot;) is build by net of NANDs,&#xA;I saw that the quantum analogue for NAND can be build with CCNOT gate (Toffoli gate) and that is indeed a universal gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question\request is can you please draw me a quantum circuit that express CNOT using universal CCNOT gate?&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="55" LastEditDate="2019-11-07T11:14:15.467" LastActivityDate="2019-11-07T11:14:15.467" Title="How to build a CNOT out of universal CCNOT gates?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8660" PostTypeId="2" ParentId="8659" CreationDate="2019-11-03T12:57:47.513" Score="2" Body="&lt;p&gt;CNOT is a Boolean function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^2\to\{0,1\}^2$&lt;/span&gt; that eats two input bits and spits two output bits. As &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate#Universality_and_Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; explains, Toffoli gates require some ancillary (extra) qubits to do emulate any Boolean function. In this case, just one extra qubit will do the job. As MarkS mentioned in the comments, set one of the control qubits of the Toffoli gate to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (that is now your ancilla qubit), and you're done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit will be no different than any ordinary circuit diagram of a Toffoli. You can play with it yourself on &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22]],%22init%22:[1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; (the top qubit is the ancilla).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22]],%22init%22:[1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kxn7n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wondering why this method works, have a look at the &lt;a href=&quot;https://i.stack.imgur.com/tEJMb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;truth table&lt;/a&gt; of the Toffoli. Note that if the first bit is set at 1, the reduced truth table for the other two bits will basically match the &lt;a href=&quot;https://i.stack.imgur.com/mwGBE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;CNOT's table&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-03T13:26:44.367" LastActivityDate="2019-11-03T13:26:44.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8661" PostTypeId="1" CreationDate="2019-11-03T12:59:14.253" Score="4" ViewCount="236" Body="&lt;p&gt;I would like to add noise to existing gates in Cirq, i.e. to define something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NewGate = cirq.Gate(qubit) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;followed by &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cirq.DepolarizingChannel(p).on(qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="8979" LastEditorUserId="55" LastEditDate="2019-11-07T11:24:43.507" LastActivityDate="2019-11-07T23:29:30.057" Title="How to add noise to existing gates in Cirq?" Tags="&lt;cirq&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8662" PostTypeId="1" AcceptedAnswerId="8674" CreationDate="2019-11-04T00:23:44.520" Score="27" ViewCount="7297" Body="&lt;p&gt;I have heard a few times that one way of describing quantum computers is that they essentially use the computing power of their counterparts in alternate realities that they access through superposition. My first question is, of course, &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;is this actually an accurate description of how quantum computers work, or just a misrepresentation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Also, if it were to be assumed true and taken literally, then presumably all the possible outcomes of any given computation done would be experienced by each of these alternate realities. I have a few questions regarding the implications of this:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Would it be correct to say that our universe essentially &quot;spawns&quot; these alternate realities to use for each computation, or that they all exist simultaneously in a higher dimension and only come into contact via the initiation of superposition by each computer at the same time?&lt;/li&gt;&#xA;&lt;li&gt;Would it be possible to create contact between universes via this connection? I'd expect that, if it was, it would be entirely random, and so not only would not cause any information transfer, it also would be completely undetectable, because the deviations would be within the expected probabilities of error rates - but is there any way to circumvent this?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8984" LastEditorUserId="55" LastEditDate="2019-11-07T11:01:39.283" LastActivityDate="2021-04-16T17:30:13.797" Title="Effects of quantum computing on parallel universes" Tags="&lt;superposition&gt;&lt;quantum-parallelism&gt;&lt;interpretations&gt;" AnswerCount="4" CommentCount="6" FavoriteCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="8663" PostTypeId="2" ParentId="8662" CreationDate="2019-11-04T01:19:52.227" Score="22" Body="&lt;p&gt;Regarding your first question, you are essentially asking about the validity of a position taken by David Deutsch - a founder of quantum computing!  For example, in his book 'The Fabric of Reality', Deutsch states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;When Shor’s algorithm has factorized a number, using &lt;span class=&quot;math-container&quot;&gt;$10^{500}$&lt;/span&gt; or so times the computational resources that can be seen to be present, where was the number factorized?  There are only about &lt;span class=&quot;math-container&quot;&gt;$10^{80}$&lt;/span&gt; atoms in the entire visible universe, an utterly minuscule number compared with &lt;span class=&quot;math-container&quot;&gt;$10^{500}$&lt;/span&gt;.  So if the visible universe were the extent of physical reality, physical reality would not even remotely contain the resources required to factorize such a large number.  Who did factorize it, then? How, and where, was the computation performed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The implication is that the number was factored in the &lt;em&gt;multiverse&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;em&gt;there are some issues with Deutsch's position&lt;/em&gt; that others have pointed out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, quantum computers can’t seem to access &lt;strong&gt;all&lt;/strong&gt; of the multiverse to efficiently solve &lt;strong&gt;any&lt;/strong&gt; problem - they still seem to have limitations!  Aaronson, I believe in his book 'Quantum Computing Since Democritus', notes that Deutsch's arguments about multiple universes working together would apply equally well to problems in the so-called &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP\:Complete}$&lt;/span&gt; complexity class.  However, quantum computers likely &lt;em&gt;cannot&lt;/em&gt; efficiently solve such problems.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we &quot;use the computing power of their counterparts in alternate realities that they access through superposition,&quot; as espoused by Deutsch, then the computing power so-granted is still very limited - and then the question becomes why can the interacting universes within the multiverse allow us to factor large integers efficiently but not allow all other problems in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; to be solved efficiently?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because the above question is not clearly answerable, the idea that the multiverse works together to factor a large number is maybe incomplete...&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2019-11-04T18:50:26.860" LastActivityDate="2019-11-04T18:50:26.860" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8664" PostTypeId="2" ParentId="8658" CreationDate="2019-11-04T08:15:01.093" Score="3" Body="&lt;p&gt;I cannot answer the question completely. But we can have look at some of the edge cases. &#xA;For the case of a bipartite pure system with the same number of qubits on both sides, nothing can be said about the eigenvalues of a reduced system from the eigenvalues of the full system. This is because any density matrix can be purified using this setup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now on the other hand if the full system is in the maximally mixed state then its reduced density matrices are also maximally mixed. So, in this case, we know all the eigenvalues of the reduced density matrices. &lt;/p&gt;&#xA;" OwnerUserId="2663" LastActivityDate="2019-11-04T08:15:01.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8665" PostTypeId="1" CreationDate="2019-11-04T08:44:15.933" Score="5" ViewCount="183" Body="&lt;p&gt;First of all, since I am not a specialist, sorry if this question does not make sense. But, I can't resist to ask as I have not found any direct information while googling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope some of you know/remember the &lt;a href=&quot;https://en.wikipedia.org/wiki/Eternity_II_puzzle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eternity II puzzle&lt;/a&gt;. According to its Wikipedia page, it has still not been solved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my &quot;simple&quot; question(s): (1a) &lt;strong&gt;Could quantum computing help in solving that particular problem?&lt;/strong&gt; (1b) Is this puzzle a problem within the scope of what QC can do faster? If yes, (2) could we already write an algorithm to solve it, even if the required hardware is not yet available? (3) What would be required hardware, and (4) how far is it from today's Google Sycamore processor?&lt;/p&gt;&#xA;" OwnerUserId="4121" LastEditorUserId="26" LastEditDate="2019-11-04T08:51:47.373" LastActivityDate="2019-11-04T08:51:47.373" Title="Could quantum computing help solving the Eternity II puzzle?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;research&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8666" PostTypeId="2" ParentId="8662" CreationDate="2019-11-04T13:14:46.643" Score="7" Body="&lt;p&gt;In the many worlds interpretation (MWI) reality consists of a structure called the multiverse that looks like a collection of slightly interacting parallel universes in some circumstances:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Deutsch, David. &quot;The structure of the multiverse.&quot; Proceedings of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences 458.2028 (2002): 2911-2923. &#xA;  [&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0104033&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0104033&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the MWI each system exists in multiple instances. Some of those instances are identical to one another in the sense that any measurement you could perform on them can't tell them apart. These correspond to elements of a superposition that are in the same state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. You can write this state as &lt;span class=&quot;math-container&quot;&gt;$1/2|\psi\rangle+1/2|\psi\rangle$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$1/3|\psi\rangle+2/3|\psi\rangle$&lt;/span&gt; or any other combination of numbers that add up to 1. A collection of instances in the same state can evolve to be in multiple different states, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \to \tfrac{1}{\sqrt{2}}|\psi\rangle + \tfrac{1}{\sqrt{2}}|\alpha\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no fact of the matter about which instances in the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; have ended up in the state &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; because the instances in the same state can't be distinguished from one another by any measurement. So changing a superposition involves changing the state of some of the instances so that there are multiple different versions of the system. This process doesn't spawn the existence of new instances.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interference that takes place in a quantum computation combines the information in the different instances to produce a single state with the correct outcome with some probability large enough to make the computation worth doing. Since the intermediate states are all combined to produce a single answer it's not the case that there is one version that receives messages from the other versions. Rather there is a process that uses all those versions to produce a correct answer. You can't copy information between different versions of a system because the process of copying information out of a system in a superposition produces decoherence that prevents interference:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Zurek, Wojciech H. &quot;Wave-packet collapse and the core quantum postulates: Discreteness of quantum jumps from unitarity, repeatability, and actionable information.&quot; Physical Review A 87.5 (2013): 052111.&#xA;  [&lt;a href=&quot;https://arxiv.org/abs/1212.3245&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1212.3245&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Interference is the process that puts information about all of the different versions into a single version so trying to copy information between different versions of the same system is forbidden by the laws of physics.&lt;/p&gt;&#xA;" OwnerUserId="1788" LastEditorUserId="26" LastEditDate="2019-11-04T16:55:05.363" LastActivityDate="2019-11-04T16:55:05.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8667" PostTypeId="2" ParentId="8661" CreationDate="2019-11-04T13:27:46.240" Score="4" Body="&lt;p&gt;One simple way to do it is by defining a composite gate, like this:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyGateThenDepolarize(cirq.SingleQubitGate):&#xA;    def _decompose_(self, qubits):&#xA;        q = qubits[0]&#xA;        return [MyGate.on(q), cirq.depolarize(p).on(q)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want a depolarizing gate on every qubit at the end of every moment, you can do a noisy simulation:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cirq.sample(circuit, noise=cirq.depolarize(p))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or get a noisy version of the circuit:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit = circuit.with_noise(cirq.depolarize(p))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you specifically want a noise model that depolarizes the one gate, you can define a custom noise model that does that:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class MyGateDepolarizingNoiseModel(cirq.NoiseModel):&#xA;    def noisy_operation(self, op):&#xA;        if isinstance(op.gate, MyGate):&#xA;            return [op, cirq.depolarize(p).on(op.qubits[0])]&#xA;        return op&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here's a test confirming that it works:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;def test_custom_noise_model():&#xA;    p = 0.1&#xA;&#xA;    class MyGate(cirq.Gate):&#xA;        def _num_qubits_(self):&#xA;            return 1&#xA;        def _decompose_(self, qubits):&#xA;            return cirq.X(*qubits)&#xA;&#xA;    class MyGateDepolarizingNoiseModel(cirq.NoiseModel):&#xA;        def noisy_operation(self, op):&#xA;            if isinstance(op.gate, MyGate):&#xA;                return [op, cirq.depolarize(p).on(op.qubits[0])]&#xA;            return op&#xA;&#xA;    a, b = cirq.LineQubit.range(2)&#xA;    c = cirq.Circuit(&#xA;        MyGate().on(a),&#xA;        cirq.X.on(b),&#xA;        cirq.measure(a, key='a'),&#xA;        cirq.measure(b, key='b'),&#xA;    )&#xA;    results = cirq.sample(&#xA;        c,&#xA;        noise=MyGateDepolarizingNoiseModel(),&#xA;        repetitions=1000)&#xA;    assert sum(results.data['a']) &amp;lt; 1000  # yes depolarized&#xA;    assert sum(results.data['b']) == 1000  # not depolarized&#xA;&#xA;    print(results.data['a'].value_counts())&#xA;    # 1    942&#xA;    # 0     58&#xA;    # Name: a, dtype: int64&#xA;&#xA;    print(results.data['b'].value_counts())&#xA;    # 1    1000&#xA;    # Name: b, dtype: int64&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2019-11-07T23:29:30.057" LastActivityDate="2019-11-07T23:29:30.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8669" PostTypeId="1" AcceptedAnswerId="8671" CreationDate="2019-11-04T15:37:34.713" Score="3" ViewCount="150" Body="&lt;p&gt;In Martinis' recent Caltech &lt;a href=&quot;https://www.youtube.com/watch?v=FklMpRiTeTA&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; on the Sycamore paper, he appears to make much of the fact that FIG. 4 of the paper show straight-line fidelity - that is, the fidelity decreases log-linearly with an increase in the number of qubits, and an increase in the depth (number of gates) of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe a position of Martinis is that the &lt;em&gt;scientific&lt;/em&gt; value of Sycamore, which is independent of the claims of supremacy, is that errors can be modeled &lt;em&gt;collectively&lt;/em&gt; as &lt;em&gt;digital Pauli errors&lt;/em&gt;, and further these errors are independently distributed and don't cluster.  This seems to conflict with, for example, Kalai's objection to quantum computing that errors collude and coordinate with increasing qubit count/depth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Martinis notes that &quot;high school probability&quot; can be used to model the decrease in fidelity with an increase in qubit count/gate count.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But what is this &quot;high school probability&quot; that Martinis refers to?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If I were to model insertion of errors into a large-depth circuit, I might decide, with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, to insert a randomly selected Pauli error (bit-flip and/or phase shift) between any two gates.  The probability would be independent of the depth/qubit count of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this &quot;Poisson-process&quot; of error-insertion similar to the high school probability to which Martinis refers?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="26" LastEditDate="2019-11-05T09:56:22.743" LastActivityDate="2019-11-05T09:56:22.743" Title="Can we conclude that errors on Sycamore are Poisson-distributed Pauli errors?" Tags="&lt;mathematics&gt;&lt;error-correction&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8670" PostTypeId="2" ParentId="8649" CreationDate="2019-11-04T16:34:36.893" Score="-1" Body="&lt;p&gt;Technically, there is no way to determine with perfect accuracy, and the same applies to any event. Everything that happens in our universe involves interactions between quantum states, and therefore is probabilistic. When we do a simple math calculation in our minds or on a calculator, there is always a small chance that the &quot;wrong&quot; answer will be produced by unlikely though possible quantum events. Every observation we make is under this influence as well. In essence, there won't be any difference in error rates among classical vs. quantum computers, ignoring mechanical failures and decoherence interference. Any calculation done by any computer, whether it's classical, quantum, or even a brain, will only provide an answer according to certain probabilities, and even our observation of that answer will follow the same probabilistic functions, so there is technically a) no way to know for certain whether an answer is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the likelihood of any computation being influenced by external quantum events is so astronomically low that we can assume, &lt;em&gt;beyond a reasonable doubt&lt;/em&gt;, the accuracy of any given computation - including those done by a quantum computer. Ignoring external factors, all computations follow the probabilistic rules which they are privy to, and the correct answer will usually be the result, because the likelihood of the quantum events which compose the computation behaving outside the expected probability is close to zero.&lt;/p&gt;&#xA;" OwnerUserId="8984" LastEditorUserId="8984" LastEditDate="2019-11-04T16:47:53.240" LastActivityDate="2019-11-04T16:47:53.240" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8671" PostTypeId="2" ParentId="8669" CreationDate="2019-11-04T17:57:09.433" Score="4" Body="&lt;p&gt;The model's accuracy is purely empirical observation. The error trend (Fig 4, or 41:50 in the video) demonstrates that the error of the system (cross entropy fidelity with respect to simulated results) is tracked closely by the &quot;high school probability&quot; model he mentions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way this basic model would work is to assume 1- and 2-qubit gate errors are Markovian (time-independent) and also occur independently of other qubits' behavior and then take the product of all the fidelities of gates acting on a single qubit as its total error at measurement time. So if I have the circuit &lt;span class=&quot;math-container&quot;&gt;$X(q_0) CNOT(q_0, q_1) X(q_0)$&lt;/span&gt; with an X-gate fidelity of 95% and a CNOT fidelity of 90%, I might say the total error (before applying measurement error) on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$.95 \times .90 \times .95 = 82\%$&lt;/span&gt; and the error on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$90\%$&lt;/span&gt;. This probably isn't the exact way they implemented this but it captures how you can might predict the fidelity of the full circuit &lt;em&gt;assuming that qubit errors occur independently&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This seems to conflict with, for example, Kalai's objection to quantum computing that errors collude and coordinate with increasing qubit count/depth.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That objection is probably still valid in general. Since this model's performance was an empirical observation using the results of a specific family of circuits, the validity of such a model won't necessarily generalize to more complicated circuits. Its likely that there will be types of circuits for which correlated errors contribute significantly to the output accuracy.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2019-11-04T17:57:09.433" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8672" PostTypeId="2" ParentId="8649" CreationDate="2019-11-04T18:32:12.003" Score="2" Body="&lt;p&gt;Some algorithms do have deterministic answers or a high probability of getting the correct answer when implemented. For example, Deutsch's algorithm (&lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Jozsa&lt;/a&gt;) which tells us with certainty whether a function is constant or balanced. On the other hand, however, you have &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's search&lt;/a&gt;. Grover's has a high probability of giving you the correct answer but it is not definite. The more iterations of Grover's that are done in a circuit, the higher the probability of the correct answer appearing. It's really about trusting the mathematics. If you were to implement these algorithms by hand and work out the math (and use Born's Rule of squaring the coefficients of states to find that state's probability) you'll find that you will arrive at the correct answer or you will see that the correct answer has a high probability of appearing (relative to the other states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you're interested in a book for starting out, I highly suggest:&#xA;Quantum Computation and Quantum Information by Nielson and Chuang.&lt;/p&gt;&#xA;" OwnerUserId="8995" LastEditorUserId="26" LastEditDate="2019-11-04T18:41:24.187" LastActivityDate="2019-11-04T18:41:24.187" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8673" PostTypeId="2" ParentId="8551" CreationDate="2019-11-04T18:51:36.830" Score="1" Body="&lt;p&gt;I'm sure that this has something to do with quantum decoherence or &quot;noise&quot; which is caused when more qubits are added. It's likely that they are both at the frontlines of research so 53 qubits are the best that they can do given the hardware that they have access to. As they add more qubits it gets tougher to compute and prompts them to find some suitable method to reduce this noise through &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum error correction&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8995" LastEditorUserId="26" LastEditDate="2019-11-05T03:36:22.850" LastActivityDate="2019-11-05T03:36:22.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8674" PostTypeId="2" ParentId="8662" CreationDate="2019-11-04T20:49:51.557" Score="14" Body="&lt;p&gt;&lt;strong&gt;Question 1&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This description lies somewhere between the two extremes of a theory and mysticism, depending on how amiable one is to the concept.  David Deutsch is vocal proponent of the former, Lee Smolin of the latter (he categorizes it as &amp;quot;Mystical Realism&amp;quot;).&lt;/p&gt;&#xA;&lt;p&gt;The general idea was initiated by one of John Wheeler's PhD students, Hugh Everett III, in his 1957 &lt;a href=&quot;https://www.pbs.org/wgbh/nova/manyworlds/pdf/dissertation.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;doctoral thesis&lt;/a&gt;, which introduced &lt;em&gt;relative state functions&lt;/em&gt; and provided the mathematical foundation for what is commonly known as the many-worlds interpretation (MWI).&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0143121359&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Beginning of Infinity&lt;/a&gt; David Deutsch defines &lt;em&gt;quantum computation&lt;/em&gt; as &amp;quot;Computation in which the flow of information is not confined to a single history.&amp;quot;  This definition is consistent with his expressed belief that MWI is a testable theory and the only theory with any power to explain the operation of quantum computers (&lt;a href=&quot;https://royalsocietypublishing.org/doi/abs/10.1098/rspa.1985.0070&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; - note that Deutsch takes issue with the label MWI).&lt;/p&gt;&#xA;&lt;p&gt;Deutsch is highly regarded and was the first to explicitly describe a universal quantum computer (&lt;a href=&quot;https://royalsocietypublishing.org/doi/abs/10.1098/rspa.1985.0070&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;ibid.&lt;/em&gt;&lt;/a&gt;).  However,&#xA;MWI is a minority view, and many other thought leaders disagree with his stance in this regard (see, &lt;em&gt;e.g.&lt;/em&gt;, Peter Shor's comment to Mark S's answer below).  Another notable thinker, Richard Feynman, commented with regard to MWI, &amp;quot;It's possible, but I'm not very happy with it&amp;quot; (&lt;a href=&quot;https://link.springer.com/article/10.1007/BF02650179&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;To answer your question explicitly, it's not clear whether or not this is an accurate description.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question 2&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;At a fundamental level, Everett describes the situation in his &lt;a href=&quot;https://www.pbs.org/wgbh/nova/manyworlds/pdf/dissertation.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;thesis&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;...from the standpoint of our theory, it is not so much the&#xA;system which is affected by an observation as the observer, who&#xA;becomes correlated to the system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Feynman expanded on this point of view (&lt;a href=&quot;https://link.springer.com/article/10.1007/BF02650179&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;),&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;...that many-world picture says that the wave function &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is what's&#xA;real, and damn the torpedos if there are so many variables, &lt;span class=&quot;math-container&quot;&gt;$N^R$&lt;/span&gt;. All&#xA;these different worlds and every arrangement of configurations are all&#xA;there just like our arrangement of configurations, we just happen to&#xA;be sitting in this one.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Deutsch has further refined the concept considerably over the years in both scientific papers (&lt;em&gt;e.g.&lt;/em&gt;, early: &lt;a href=&quot;https://link.springer.com/article/10.1007/BF00670071&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://royalsocietypublishing.org/doi/abs/10.1098/rspa.1985.0070&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;; recent: &lt;a href=&quot;https://arxiv.org/abs/1508.02048&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;) and popular science books (&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/014027541X&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;4&lt;/a&gt;, &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0143121359&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;5&lt;/a&gt;).  He generally speaks of an infinite variety of universes within the multiverse, some proportion of which align with each other in particular instances.&lt;/p&gt;&#xA;&lt;p&gt;In that sense, your second statement is closer to MWI.  From what I understand, I think it would be more accurate to say the universes &amp;quot;doing the computation&amp;quot; were identical at the point of state preparation and branch on measurement.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question 3&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Contact in the form of &amp;quot;message sending&amp;quot; between universes is prohibited by special relativity.  As stated by Everett (page 98-99 of his &lt;a href=&quot;https://www.pbs.org/wgbh/nova/manyworlds/pdf/dissertation.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;thesis&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Only the totality of these observer states, with their diverse&#xA;knowledge, contains complete information about the original&#xA;object-system state - but there is no possible communication between&#xA;the observers described by these separate states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If I understand Deutsch correctly, there is a possibility of some form of directed interference that would allow &amp;quot;an observer to 'feel' himself split into two branches&amp;quot; (experiment proposed &lt;a href=&quot;https://link.springer.com/article/10.1007/BF00670071&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), but message sending between the two branches is still prohibited.  Apparently, classification of MWI as interpretation or theory (under conventional scientific methodology) depends largely on the viability of this experiment, or one very similar.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1:&lt;/strong&gt; Revised after reading Everett and Deutsch more carefully.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2:&lt;/strong&gt; I recently learned that Sean Carroll (CalTech physicist and prolific writer) is also an advocate for the Everett formulation of quantum mechanics.  He makes his case in &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/B07NTYJJDX&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Something Deeply Hidden&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2021-04-16T17:30:13.797" LastActivityDate="2021-04-16T17:30:13.797" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8675" PostTypeId="2" ParentId="8551" CreationDate="2019-11-04T21:44:00.170" Score="17" Body="&lt;p&gt;It's just a coincidence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can speak from personal recollection on the Google side. Google originally intended to use a 72 qubit chip (Bristlecone) where qubits were essentially directly connected to each other. They then switched to an architecture where qubits were connected indirectly via a coupler. The coupler requires a control line, so this increased the number of wires per qubit. The fridge was only setup for so many wires, so the total number of qubits was reduced to 54 to fit. Then one of the qubits didn't work, so it was excluded from the experiment leaving 53.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That being said, an underlying reason that you would expect slightly-more-than-50 qubits to be a common target is that that's roughly the number of qubits where the wavefunction becomes so large that it can't be directly stored on modern supercomputers.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-11-04T21:44:00.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8676" PostTypeId="2" ParentId="8551" CreationDate="2019-11-04T21:58:22.927" Score="2" Body="&lt;p&gt;My guess is that this is an example of co-opetition, i.e. collaborative competition. Number of qubits is just a single characteristic of a quantum processor, but there are a lot more, like tolerance, topology, etc. Also this characteristic is the only one that most people understand. Thus it's not reasonable to put all the resources on the increasing just this number (or use some shady marketing). It's better to be aligned and invest into the overall performance of a chip. Until a breakthrough, of course.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-11-05T18:15:09.850" LastActivityDate="2019-11-05T18:15:09.850" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8677" PostTypeId="2" ParentId="5028" CreationDate="2019-11-05T03:33:18.730" Score="2" Body="&lt;p&gt;Every time you run a code on one of IBM's Q.computers, you'll need to validate your access token which you can find in your IBM Q experience dashboard under the user category.&#xA;In case, you've done it beforehand but still doesn't seem to work, make sure to delete all your previous account details using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.delete_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then try regenerating a new access token, save the credentials and run again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you could try reading the tutorials in IBM Q experience portal&lt;/p&gt;&#xA;" OwnerUserId="8953" LastActivityDate="2019-11-05T03:33:18.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8679" PostTypeId="1" AcceptedAnswerId="8680" CreationDate="2019-11-05T06:10:10.310" Score="-3" ViewCount="104" Body="&lt;p&gt;Today I(z) walked into an elevator and did not press the key to the floor to which I wanted to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As there were 2 other people x and y who had pressed the keys 2 and 3 respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to go to the 2nd floor but nither x or y knew about it, so using a quantum computer or circuit how can x or y deduce whether I want to go to there floor or the probabilities of me going to 2nd or the 3rd floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we transform the question to ask what is the probability of z exiting on every floor, Please suggest?&lt;/p&gt;&#xA;" OwnerUserId="9003" LastEditorUserId="9003" LastEditDate="2019-11-05T08:00:18.910" LastActivityDate="2019-11-06T17:02:32.677" Title="The Elevator Problem" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2019-11-05T15:12:30.383" ContentLicense="CC BY-SA 4.0" />
  <row Id="8680" PostTypeId="2" ParentId="8679" CreationDate="2019-11-05T08:43:31.920" Score="2" Body="&lt;p&gt;Any &quot;person&quot; (x or y) can obtain the state of z using the quantum circuit consisting of CNOT and Hadamard gates and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate; the circuit is actually a simplified version of quantum teleportation; let x be in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, that is he wants to go to the floor 2 (state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; means floor 3). Applying CNOT to z (control qubit) and x entangles z and x, and then you need to apply Hadamard gate to z and measure it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, x already contains the initial state of z; if you measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you need to apply &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate to x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either way in the end x contains the initial state of z while the state of z is destroyed by measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more details see &lt;a href=&quot;https://www.youtube.com/watch?v=X5NylvbqY44&quot; rel=&quot;nofollow noreferrer&quot;&gt;Prof. Vazirani's lecture&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="26" LastEditDate="2019-11-06T17:02:32.677" LastActivityDate="2019-11-06T17:02:32.677" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="8681" PostTypeId="1" AcceptedAnswerId="8684" CreationDate="2019-11-05T09:18:26.520" Score="4" ViewCount="79" Body="&lt;p&gt;The Appendix to a recent paper &lt;a href=&quot;https://arxiv.org/abs/1908.05047&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Graph States as a Resource for Quantum Metrology&lt;/em&gt;&lt;/a&gt; states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We model an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit graph state &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; undergoing iid dephasing via &lt;span class=&quot;math-container&quot;&gt;$$G&#xA; \to G^{\text{dephasing}} =&#xA; \sum_{\vec{k}}p^{k}(1-p)^{n-k}Z_{\vec{k}}GZ_{\vec{k}}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is&#xA;the probability that a qubit undergoes a phase flip. This effectively&#xA;maps the graph state onto the orthonormal basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{Z_{\vec{k}}|G\rangle\}_{\vec{k}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Is it clear why this expression is given in this form (in particular what does the &lt;span class=&quot;math-container&quot;&gt;$Z_{\vec{k}}$&lt;/span&gt; denote and how do we know that &lt;span class=&quot;math-container&quot;&gt;$\{Z_{\vec{k}}|G\rangle\}_{\vec{k}}$&lt;/span&gt; is an orthonormal basis)?&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;These might be trivial questions but I am new to this area hence some of the conventions I am still unfamiliar with.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="10480" LastEditDate="2021-01-22T21:07:59.550" LastActivityDate="2021-01-22T21:07:59.550" Title="Dephasing in graph states" Tags="&lt;quantum-gate&gt;&lt;decoherence&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8682" PostTypeId="1" AcceptedAnswerId="8683" CreationDate="2019-11-05T12:42:46.517" Score="5" ViewCount="883" Body="&lt;p&gt;I am trying to build a circuit for quantum teleportation. On the simulator, everything runs fine and according to expectations, however, I am not able to run the algorithm on the real quantum processor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ERROR_RUNNING_JOB&lt;/code&gt; is returned without any other explanation. I tried to implement two different circuits, the first one with controlled X and Z gates, the second one with gates X and Z are controlled by a value in the classical register. Please find both circuits below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kXXXS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kXXXS.png&quot; alt=&quot;Circuit with IFs&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Wi3Cc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wi3Cc.png&quot; alt=&quot;Circuit with &amp;quot;normal&amp;quot; controlled X and Z gates&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2019-11-07T11:20:25.217" LastActivityDate="2019-11-07T11:20:25.217" Title="Trying to build a circuit for quantum teleportation on IBMQ I get ERROR_RUNNING_JOB error" Tags="&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8683" PostTypeId="2" ParentId="8682" CreationDate="2019-11-05T13:11:40.813" Score="7" Body="&lt;p&gt;The issue is that you are applying operations after measurement gates and this is currently not available on the real hardware. I think the hardware also does not support reset operations mid-way through a circuit at the moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way forward is to keep running this on the simulator or try to find a different way of expressing the circuit such that it avoids these features.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-05T13:11:40.813" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8684" PostTypeId="2" ParentId="8681" CreationDate="2019-11-05T13:27:24.087" Score="4" Body="&lt;p&gt;Imgine that there is a bit string &lt;span class=&quot;math-container&quot;&gt;$\vec{k}\in\{0,1\}^n$&lt;/span&gt;. We use this to specify sites (bit value 1) where an error has occurred, and sites (bit value 0) where no error has occurred. The number of 1s in the bit string is &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. The probability of this particular error arising is then &lt;span class=&quot;math-container&quot;&gt;$p^k(1-p)^{n-k}$&lt;/span&gt; because there are &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; sites with an error and &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt; sites with no error. The error is decribed as &lt;span class=&quot;math-container&quot;&gt;$Z_{\vec{k}}$&lt;/span&gt;, i.e. specifying which qubits (bit values 1) the Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s are applied to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for why &lt;span class=&quot;math-container&quot;&gt;$Z_{\vec{k}}|G\rangle$&lt;/span&gt; are all orthogonal, consider the inner product of two:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle G|Z_{\vec{k}}Z_{\vec{l}}|G\rangle&#xA;$$&lt;/span&gt;&#xA;Now, we can write the graph state as &lt;span class=&quot;math-container&quot;&gt;$U|+\rangle^{\otimes n}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; corresponds to the set of controlled-phase gaes that entangle the system. Phase gates commute with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$U^\dagger Z_{\vec{k}}=Z_{\vec{k}}U^\dagger$&lt;/span&gt;,&#xA;so this means that the inner product is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle+|^{\otimes n}Z_{\vec{k}}Z_{\vec{l}}|+\rangle^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;Provided &lt;span class=&quot;math-container&quot;&gt;$\vec{l}\neq\vec{k}$&lt;/span&gt;, this is clearly 0 because there is at least one site where there is an inner product &lt;span class=&quot;math-container&quot;&gt;$\langle+|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-05T13:27:24.087" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8685" PostTypeId="1" CreationDate="2019-11-05T13:33:28.177" Score="3" ViewCount="90" Body="&lt;p&gt;I have a secret say &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. I have a dealer &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; and three participants &lt;span class=&quot;math-container&quot;&gt;$A, B, C$&lt;/span&gt;. I want to share this secret &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; in such a way that the participation of all &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; is essential to reconstruct the secret. Now for creating the shares, I use some classical sharing algorithms and create shares &lt;span class=&quot;math-container&quot;&gt;$s_A,s_B,s_C$&lt;/span&gt;. Now how do I distribute these shares among the participants quantum mechanically using qudits? What I thought is the following steps. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, let the basis be &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle,.....,|d-1\rangle\}.$&lt;/span&gt; Now since each of the participant &lt;span class=&quot;math-container&quot;&gt;$A, B, C$&lt;/span&gt; has his/her share, one of them starts the reconstruction process by first preparing a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and taking its Fourier transform, so I get &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle_1=\sum_{y=0}^{d-1}|y\rangle_1$$&lt;/span&gt;Now the next step is to initialize two &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; states and perform the CNOT gate on them with the first qudit as the control, so to get  &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle_2=\sum_{y=0}^{d-1}|y\rangle_1|y\rangle_2|y\rangle_3$$&lt;/span&gt;After this step we perform the Quantum Fourier transformation on all the particles to get  &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle_3=\sum_{y=0}^{d-1}\sum_{k_1=0}^{d-1}\sum_{k_2=0}^{d-1}\sum_{k_3=0}^{d-1}\omega^{(k_1+k_2+k_3)y}|k_1\rangle_1|k_2\rangle_2|k_3\rangle_3$$&lt;/span&gt; &#xA;Now since the summation is finite i rearrange the terms to get &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle_3=\sum_{k_1=0}^{d-1}\sum_{k_2=0}^{d-1}\sum_{k_3=0}^{d-1}\sum_{y=0}^{d-1}\omega^{(k_1+k_2+k_3)y}|k_1\rangle_1|k_2\rangle_2|k_3\rangle_3$$&lt;/span&gt;&#xA;With &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=0}^{d-1}\omega^i=0$&lt;/span&gt;, we have the condition that the state left after this operation will be subject to the condition that &lt;span class=&quot;math-container&quot;&gt;$k_1+k_2+k_3=0\;mod\;d$&lt;/span&gt; , we will have  &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle_3=\sum_{k_1=0}^{d-1}\sum_{k_2=0}^{d-1}\sum_{k_3=0}^{d-1}|k_1\rangle_1|k_2\rangle_2|k_3\rangle_3$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;now after preparing this state each participant &lt;span class=&quot;math-container&quot;&gt;$A,B,C$&lt;/span&gt; applies a transformation &lt;span class=&quot;math-container&quot;&gt;$U_{s_B},U_{s_A},U_{s_C}$&lt;/span&gt; which gives the state as &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle_3=\sum_{k_1=0}^{d-1}\sum_{k_2=0}^{d-1}\sum_{k_3=0}^{d-1}|k_1+s_A\rangle_1|k_2+s_B\rangle_2|k_3+ s_C\rangle_3$$&lt;/span&gt; &#xA;After peparing this state the state is returned by the participants to the dealer who measures state for the shares and if it is right then announces the result/secret. Now my questions are: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(i) Even though this is a very preliminary effort, can somebody tell me whether can we can actually do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(ii) My second question is if this is possible then can we improve this scheme to achieve the condition for the detection of a fraudulent participant?&#xA;Can somebody help??&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2019-11-06T09:18:03.907" LastActivityDate="2019-11-07T02:52:44.780" Title="Secret sharing though quantum operations" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;circuit-construction&gt;&lt;cryptography&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8686" PostTypeId="2" ParentId="8662" CreationDate="2019-11-05T14:06:43.003" Score="1" Body="&lt;p&gt;The multiverse is not commonly accepted as the right description of reality and is just one of many interpretations of what exactly happens at the moment of the &quot;wave function collapse&quot;. &#xA;The multiverse is in its core just an idea to preserve determinism in nature by the argument: If you know in which exact universe you are, you can trace back every particle back to its original position at the big bang.&#xA;This is not true in reality as quantum mechanics is inherently unpredictable (Copenhagen interpretation) or in the multiverse (we don't know in which universe we are).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if there are no multiverses then your entire question becomes pointless.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the use in quantum mechanics (and therefore in quantum computers), it is probably more useful to understand how interference of wavefunctions works and interpret the computation in a quantum computer as constructive or destructive interference.&lt;/p&gt;&#xA;" OwnerUserId="9009" LastEditorUserId="26" LastEditDate="2019-11-05T14:10:07.733" LastActivityDate="2019-11-05T14:10:07.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8687" PostTypeId="2" ParentId="8606" CreationDate="2019-11-05T19:11:14.773" Score="2" Body="&lt;p&gt;Given the constraints of the problem, we have for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; unitary,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\newcommand{\ketbra}[1]{\lvert#1\rangle\!\langle #1\rvert}&#xA;\newcommand{\ket}[1]{\lvert#1\rangle}&#xA;\newcommand{\bra}[1]{\langle#1\rvert}&#xA;\newcommand{\sqoverlap}[2]{|\langle #1|#2\rangle|^2}&#xA;U=\ketbra{\lambda}+\sum_k e^{i\varphi_k}\ketbra{\lambda_k},$$&lt;/span&gt;&#xA;for some orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{\ket\lambda\}\cup\{\ket{\lambda_k}\}_k$&lt;/span&gt; and phases &lt;span class=&quot;math-container&quot;&gt;$\varphi_k\in\mathbb R$&lt;/span&gt;.&#xA;Given a target &lt;span class=&quot;math-container&quot;&gt;$\ket\mu$&lt;/span&gt;, the expectation value of &lt;span class=&quot;math-container&quot;&gt;$U^r$&lt;/span&gt; equals&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \bra\mu U^r\ket\mu=\sqoverlap{\mu}{\lambda} +&#xA;  \underbrace{&#xA;    \sum_k  e^{ir\varphi_k} \sqoverlap{\mu}{\lambda_k}&#xA;  }_{\equiv F_r}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note also that the normalisation of &lt;span class=&quot;math-container&quot;&gt;$\ket\mu$&lt;/span&gt; implies &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \sqoverlap\mu\lambda +&#xA;  \sum_k |\langle\mu|\lambda_k\rangle|^2 = 1&#xA;$$&lt;/span&gt;&#xA;The problem here is clearly in how to handle &lt;span class=&quot;math-container&quot;&gt;$F_r\in\mathbb C$&lt;/span&gt;, which has a pretty nasty behaviour: as a function of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, it oscillates wildly in the complex plane. Without any constraint on the possible &lt;span class=&quot;math-container&quot;&gt;$\ket{\lambda_k}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi_k$&lt;/span&gt;, or on the total dimension of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, pretty much any shape is possible (and here I cannot not link &lt;a href=&quot;https://youtu.be/-qgreAUpPwM&quot; rel=&quot;nofollow noreferrer&quot;&gt;this beautiful video by 3Blue1Brown&lt;/a&gt;). Just to give a mental picture of what I mean, here are two examples of what you can get when you plot &lt;span class=&quot;math-container&quot;&gt;$r\mapsto F_r$&lt;/span&gt; for randomly sampled phases and overlaps, for a six-dimensional &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9ZwHG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9ZwHG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JC07P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JC07P.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;The black dots correspond to the integer values of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, the blue line gives the value of &lt;span class=&quot;math-container&quot;&gt;$F_r$&lt;/span&gt; for the real values in-between, and the red circle has radius &lt;span class=&quot;math-container&quot;&gt;$1-\sqoverlap{\mu}{\lambda}$&lt;/span&gt;. Only values of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$100$&lt;/span&gt; are shown.&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Plotting even more points (all &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; between &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$10^3$&lt;/span&gt;), we see that the circle is essentially filled:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rmSPx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rmSPx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is telling us that, in the general case, all we can say about &lt;span class=&quot;math-container&quot;&gt;$F_r$&lt;/span&gt; is that it satisfies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  |F_r|\le1-\sqoverlap\mu\lambda.&#xA;$$&lt;/span&gt;&#xA;Now, to get the probability of finding the initial state &lt;span class=&quot;math-container&quot;&gt;$\ket\mu$&lt;/span&gt; unchanged after &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; applications of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we need to study the quantity &#xA;&lt;span class=&quot;math-container&quot;&gt;$|\langle\mu|U^r|\mu\rangle|=\big|\sqoverlap\mu\lambda+F_r\big|$&lt;/span&gt;.&#xA;When &lt;span class=&quot;math-container&quot;&gt;$\sqoverlap\mu\lambda\ge1/2$&lt;/span&gt; we know that &lt;span class=&quot;math-container&quot;&gt;$|F_r|\le\sqoverlap\mu\lambda$&lt;/span&gt;, and we thus have the bound&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  (2\sqoverlap{\mu}{\lambda}-1)^2 \le |\langle\mu|U^r|\mu\rangle|^2 \le 1,\quad \forall r.&#xA;$$&lt;/span&gt;&#xA;On the other hand, when the initial squared overlap is smaller than &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, we can have &lt;span class=&quot;math-container&quot;&gt;$F_r=-\sqoverlap\mu\lambda$&lt;/span&gt;, and thus we get the trivial bound &lt;span class=&quot;math-container&quot;&gt;$|\langle\mu|U^r|\mu\rangle|\in[0,1]$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Putting the two cases together, if we plot the possible values of &lt;span class=&quot;math-container&quot;&gt;$|\langle\mu|U^r|\mu\rangle|^2$&lt;/span&gt; as a function of &lt;span class=&quot;math-container&quot;&gt;$p\equiv\sqoverlap\mu\lambda$&lt;/span&gt; we get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pzEfp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pzEfp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The interesting conclusion is that we &lt;em&gt;can&lt;/em&gt; say something about the possible probabilities of a state remaining unchanged after a number of applications of the same unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;em&gt;provided that the initial overlap between the state and one of the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is big enough&lt;/em&gt;.&#xA;Let me remark a few other things here:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;There is no loss of generality in our initial assumption that the eigenvalue of some &lt;span class=&quot;math-container&quot;&gt;$\ket\lambda$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. We can repeat the same identical argument by just taking an arbitrary eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{i\varphi}$&lt;/span&gt;, by only replacing each instance of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U e^{-i\varphi}$&lt;/span&gt;. Most notably, &lt;em&gt;this does not affect the final result on &lt;span class=&quot;math-container&quot;&gt;$|\langle\mu|U^r|\mu\rangle|$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\sqoverlap\mu\lambda=1-\delta$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\delta\ge0$&lt;/span&gt; small, then the bound can be simplified to &lt;span class=&quot;math-container&quot;&gt;$|\langle\mu|U^r|\mu\rangle|^2\ge 1-4\delta$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because we are not putting any constraint on &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; other than the initial overlap &lt;span class=&quot;math-container&quot;&gt;$\sqoverlap\mu\lambda$&lt;/span&gt;, we can also understand this result as telling us about the probability of &lt;span class=&quot;math-container&quot;&gt;$\ket\mu$&lt;/span&gt; being unchanged upon a &lt;em&gt;single&lt;/em&gt; application of a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, or more generally about the probability of &lt;span class=&quot;math-container&quot;&gt;$\ket\mu$&lt;/span&gt; being unchanged upon arbitrary applications of arbitrary unitaries all having an eigenvector close enough to &lt;span class=&quot;math-container&quot;&gt;$\ket\mu$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Mathematica code to generate the plots of &lt;span class=&quot;math-container&quot;&gt;$F_r$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dim = 5;&#xA;probs = 0.8 * # / Total @ # &amp;amp; @ RandomReal[{0, 1}, dim];&#xA;phases = RandomReal[{0, 2 Pi}, dim];&#xA;otherFactor[probs_, phases_, r_] := Total[Exp[I r phases] probs];&#xA;Show[&#xA; ParametricPlot[ReIm@otherFactor[probs, phases, r], {r, 0, 100}, &#xA;  PlotPoints -&amp;gt; 60, MaxRecursion -&amp;gt; 10, &#xA;  PlotRange -&amp;gt; ConstantArray[{-.9, .9}, 2]],&#xA; Graphics[{ &#xA;   Point@Table[ReIm@otherFactor[probs, phases, r], {r, 1, 100}],&#xA;   Thick, Red, Circle[{0, 0}, 0.8]&#xA;   }]&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-06T12:41:04.400" LastActivityDate="2019-11-06T12:41:04.400" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="8688" PostTypeId="2" ParentId="8659" CreationDate="2019-11-05T22:32:56.517" Score="2" Body="&lt;p&gt;CNOT is more simple gate than Toffoli (CCNOT). Actually, CCNOT is realized with six CNOT gates (see Wikipedia link above for a CCNOT circuit). Additionally, CNOT is relized physically on a quantum computer. To sum up, direct usage of CNOT is better because it enable the quantum circuit to be more simple. &lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-05T22:32:56.517" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8689" PostTypeId="2" ParentId="8682" CreationDate="2019-11-05T22:46:43.133" Score="1" Body="&lt;p&gt;Thanks for help, it works. Here is a changed circuit and results on IBM Q (Vigo processor). Just note that q-bit &lt;span class=&quot;math-container&quot;&gt;$0.5|0\rangle + \sqrt {0.75}|1\rangle$&lt;/span&gt; is teleported from q-bit &lt;code&gt;q0&lt;/code&gt; to &lt;code&gt;q2&lt;/code&gt;. Angle in Ry gate is &lt;span class=&quot;math-container&quot;&gt;$2\pi/3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LrkRJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LrkRJ.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;, &lt;a href=&quot;https://i.stack.imgur.com/bTYST.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bTYST.png&quot; alt=&quot;Results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2019-11-06T09:38:40.850" LastActivityDate="2019-11-06T09:38:40.850" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8692" PostTypeId="1" AcceptedAnswerId="8713" CreationDate="2019-11-06T05:51:27.370" Score="0" ViewCount="351" Body="&lt;p&gt;I have tried to program &lt;strong&gt;universal quantum computer simulator&lt;/strong&gt; in MatLab.&#xA;Please find a code here: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.mathworks.com/matlabcentral/fileexchange/73035-quantum-computer-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mathworks.com/matlabcentral/fileexchange/73035-quantum-computer-simulator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can be this code used as a good simulator of quantum computer?&#xA;Thanks for answer.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:49:30.530" LastActivityDate="2020-04-30T21:49:30.530" Title="Can my MatLab code be used as a good simulator of a quantum computer?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;simulation&gt;&lt;matlab&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8693" PostTypeId="1" CreationDate="2019-11-06T06:27:09.353" Score="3" ViewCount="214" Body="&lt;p&gt;I still don't understand what makes the Deutsch algorithm faster in a quantum computer. Why is it not same as in a classical computer? But this algorithm is just mathematics. All gates can be represented in a matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, can someone explain this to me? What parts of this algorithm are better in a quantum computer, assuming only this Deutsch algorithm?&lt;/p&gt;&#xA;" OwnerUserId="9029" LastEditorUserId="55" LastEditDate="2019-11-06T22:08:18.943" LastActivityDate="2020-08-06T00:36:35.497" Title="Why is the Deutsch algorithm faster on a quantum computer?" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8694" PostTypeId="1" AcceptedAnswerId="8700" CreationDate="2019-11-06T08:57:33.393" Score="8" ViewCount="369" Body="&lt;p&gt;I have been going through Cirq's &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/tutorial.html#background-variational-quantum-algorithms&quot; rel=&quot;noreferrer&quot;&gt;VQE background tutorial&lt;/a&gt; and after examining the Ansatz it seems to me that the only layer that actually affects the final measurement is the rot_x_layer. The other layers simply act on the phases and therefore seem to have no impact on the final measurement probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D,%7B%22id%22:%22X%5Eft%22,%22arg%22:%220.1%22%7D],[%22Chance%22,%22Chance%22,%22Chance%22,%22Chance%22,%22Chance%22,%22Chance%22,%22Chance%22,%22Chance%22,%22Chance%22],[%22Chance9%22],[%22Amps9%22],[],[],[],[],[1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.3%22%7D,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.3%22%7D,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.3%22%7D,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.3%22%7D,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.3%22%7D,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.3%22%7D],[%22%E2%80%A2%22,1,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,%22%E2%80%A2%22,1,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,%22%E2%80%A2%22,1,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,1,%22%E2%80%A2%22,1,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,1,1,%22X%22,1,1,%22X%22],[1,1,1,1,%22%E2%80%A2%22,1,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,1,1,%22X%22,1,1,%22X%22],[1,1,1,1,1,%22%E2%80%A2%22,1,1,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[%22X%22,%22X%22],[%22%E2%80%A2%22,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[%22X%22,%22X%22],[1,%22X%22,%22X%22],[1,%22%E2%80%A2%22,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,%22X%22,%22X%22],[1,1,1,%22X%22,%22X%22],[1,1,1,%22%E2%80%A2%22,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,1,%22X%22,%22X%22],[1,1,1,1,%22%E2%80%A2%22,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,1,1,1,1,%22%E2%80%A2%22,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[1,1,1,1,1,1,1,%22%E2%80%A2%22,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%220.7%22%7D],[%22Chance9%22]]%7D&quot; rel=&quot;noreferrer&quot;&gt;replicated&lt;/a&gt; the example using Quirk and the displays seem to confirm my suspicion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally I've come across a &lt;a href=&quot;https://www.cs.umd.edu/class/fall2018/cmsc657/projects/group_16.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; on QAOA that also outlines a solution with a different Ansatz and the Hamiltonian they use though, is slightly different in that the sigma that multiplies the external field h has an x on top instead of a z.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a mistake on Cirq's tutorial or am I missing something fundamental in here?&lt;/p&gt;&#xA;" OwnerUserId="7322" LastActivityDate="2019-11-06T18:15:37.547" Title="Is there a mistake in the VQE Ansatz in Cirq's tutorial?" Tags="&lt;cirq&gt;&lt;qaoa&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8695" PostTypeId="1" AcceptedAnswerId="8696" CreationDate="2019-11-06T10:35:50.410" Score="3" ViewCount="196" Body="&lt;p&gt;When I execute the following circuit, I expect that in both classical registers, the content is identical.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(1)&#xA;c = ClassicalRegister(2)&#xA;circuit = QuantumCircuit(q, c)&#xA;circuit.h(q[0])&#xA;circuit.measure(q[0], c[0])&#xA;circuit.measure(q[0], c[1])&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots=100)&#xA;result = job.result()&#xA;counts = result.get_counts(circuit)&#xA;&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the results are &lt;code&gt;{'01': 44, '00': 56}&lt;/code&gt;, however I expect &lt;code&gt;{'11': 44, '00': 56}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run the same circuit in the IBM Quantum Experience with the same simulator, I get the expected results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do I miss?&lt;/p&gt;&#xA;" OwnerUserId="5461" LastEditorUserId="55" LastEditDate="2019-11-08T17:16:03.410" LastActivityDate="2019-11-08T17:16:03.410" Title="In qiskit, doing 2 subsequent measurements of a Hadamard gate on the same qubit always gives 0 on the 2nd one" Tags="&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8696" PostTypeId="2" ParentId="8695" CreationDate="2019-11-06T11:01:26.253" Score="7" Body="&lt;p&gt;When I run your code on the most recent version of qiskit I get the expected results &lt;code&gt;{'11': 55, '00': 45}&lt;/code&gt;. It could be the case therefore that you are running an older version of qiskit and this has been fixed recently. I would suggest updating your version using &lt;code&gt;pip install --upgrade qiskit&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-06T11:01:26.253" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8697" PostTypeId="2" ParentId="8693" CreationDate="2019-11-06T11:18:18.797" Score="2" Body="&lt;p&gt;On a classical computer, you can recycle memory, so there is no need for storing all intermediate results. The main source of the higher performance of quantum computers is the possibility to do an operation with all different values you can store in n q-bits register at once. However, this is not a case always. For example, the evaluation of Boolean function parity has the same complexity both on a classical and quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2019-11-06T15:36:52.990" LastActivityDate="2019-11-06T15:36:52.990" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8698" PostTypeId="5" CreationDate="2019-11-06T11:49:26.127" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2019-11-06T11:49:26.127" LastActivityDate="2019-11-06T11:49:26.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8699" PostTypeId="4" CreationDate="2019-11-06T11:49:26.127" Score="0" Body="For questions about the Variational Quantum Eigensolver, a quantum/classical hybrid algorithm that can be used to find eigenvalues of a (often large) matrix H. When this algorithm is used in quantum simulations, H is typically the Hamiltonian of some system. In this hybrid algorithm, a quantum subroutine is run inside of a classical optimization loop." OwnerUserId="45" LastEditorUserId="13991" LastEditDate="2021-04-14T16:00:48.973" LastActivityDate="2021-04-14T16:00:48.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8700" PostTypeId="2" ParentId="8694" CreationDate="2019-11-06T13:34:35.063" Score="6" Body="&lt;p&gt;You're right in the sense that the cost unitary, which is composed of all the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; gates does not affect the underlying probabilities of measuring a specific state &lt;strong&gt;by itself&lt;/strong&gt;, however when we apply the &lt;strong&gt;mixer&lt;/strong&gt; (the layer of &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt; gates), the probabilities are changed, due to these added phases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's look at a basic example, to convince you that changing phases, then applying another layer of gates (like &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;) can in fact change the probabilities of the measurement outcomes!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the system of one qubit in an even superposition, where we apply an &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate (which is just the square root of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate), then apply a &lt;span class=&quot;math-container&quot;&gt;$Rx(\theta)$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Rightarrow \ Rx(\theta) S \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} \ = \ \frac{1}{\sqrt{2}} Rx(\theta) \begin{pmatrix} 1 \\ i \end{pmatrix} \ = \ \frac{1}{\sqrt{2}}\begin{pmatrix} \cos \theta/2 &amp;amp; -i\sin \theta/2 \\ -i\sin \theta/2 &amp;amp; \cos \theta/2 \end{pmatrix} \begin{pmatrix} 1 \\ i \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Rightarrow \frac{1}{\sqrt{2}} \begin{pmatrix} \cos \theta/2 \ + \ \sin \theta/2 \\ i(\cos \theta/2 \ - \ \sin \theta/2) \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the probability of measuring each of the outcomes is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Pr}(0) \ = \ \frac{1}{2}(\cos \theta/2 \ + \ \sin \theta/2)^2$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Pr}(1) \ = \ \frac{1}{2}(\cos \theta/2 \ - \ \sin \theta/2)^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most cases, these are not equal! Thus, this is a concrete example of a time when we apply some kind of phase, then a non-commuting mixer, and the probabilities of the different measurement outcomes are changed!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider what happens if we didn't apply the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Rightarrow \ Rx(\theta) \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \ = \ \frac{1}{\sqrt{2}} Rx(\theta) \begin{pmatrix} 1 \\ 1 \end{pmatrix} \ = \ \frac{1}{\sqrt{2}}\begin{pmatrix} \cos \theta/2 &amp;amp; -i\sin \theta/2 \\ -i\sin \theta/2 &amp;amp; \cos \theta/2 \end{pmatrix} \begin{pmatrix} 1 \\ 1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Rightarrow \ \frac{1}{\sqrt{2}} \begin{pmatrix} \cos \theta/2 \ - \ i\sin \theta/2 \\ \cos \theta/2 \ - \ i\sin \theta/2 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the probabilities are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Pr}(0) \ = \ \frac{1}{2} (\cos \theta/2 \ - \ i\sin \theta/2)(\cos \theta/2 \ + \ i\sin \theta/2) \ = \ \frac{1}{2} (\sin^2 \theta/2 \ + \ \cos^2 \theta/2) \ = \ \frac{1}{2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Pr}(1) \ = \ \frac{1}{2} (\cos \theta/2 \ - \ i\sin \theta/2)(\cos \theta/2 \ + \ i\sin \theta/2) \ = \ \frac{1}{2} (\sin^2 \theta/2 \ + \ \cos^2 \theta/2) \ = \ \frac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So they don't change, no matter what we set &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you still don't believe me, let's run a simulation &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22Z%5E%C2%BD%22%5D%2C%5B%22Rxft%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;in Quirk&lt;/a&gt;!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22Z%5E%C2%BD%22%5D%2C%5B%22Rxft%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t1k0U.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Look at how the probabilities change with different values of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;! It's pretty cool!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now look what happens &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22Rxft%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;without the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22Rxft%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uvq8y.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is no change in the probabilities, thus we require the change in phase for something interesting to happen!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT (IMPORTANT)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The tutorial seems to apply the mixer before the cost unitary, which is strange. To my understanding QAOA should be cost, then mixer, especially if the circuit depth is only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="4907" LastEditDate="2019-11-06T18:15:37.547" LastActivityDate="2019-11-06T18:15:37.547" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8702" PostTypeId="1" AcceptedAnswerId="8704" CreationDate="2019-11-06T19:03:25.247" Score="6" ViewCount="643" Body="&lt;p&gt;I'm trying to follow the instructions here &lt;a href=&quot;https://qiskit.org/documentation/getting_started.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/getting_started.html&lt;/a&gt;. It says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The default backend for qiskit.visualization.circuit_drawer() or&#xA;  QuantumCircuit.draw() is the text backend. However, depending on your&#xA;  local environment you may want to change these defaults to something&#xA;  better suited for your use case. This is done with the user config&#xA;  file. By default the user config file should be located in&#xA;  ~/.qiskit/settings.conf and is a .ini file.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't see this config file anywhere. Can anyone tell me how I can find the location of this file in order to make the change from the text based plotter to the nicer plotter? &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-08-31T11:45:44.457" LastActivityDate="2020-11-27T22:14:27.867" Title="What is the location of the Qiskit config file?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8703" PostTypeId="2" ParentId="8639" CreationDate="2019-11-06T19:37:19.153" Score="1" Body="&lt;p&gt;The user has to create the error mitigation calibration matrix for their experiments. You could always just create the matrix for the subset of qubits you are experimenting on if you are sending your experiment to a larger device.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-11-06T19:37:19.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8704" PostTypeId="2" ParentId="8702" CreationDate="2019-11-06T19:57:26.517" Score="7" Body="&lt;p&gt;If you are working in Windows, the default location should be &lt;code&gt;C:\Users\[user]\.qiskit&lt;/code&gt;, which might be hidden by default. Create a text file in that folder named &lt;code&gt;settings.conf&lt;/code&gt; and set it up how you like.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example by default&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qc = QuantumCircuit(2)&#xA;qc.h(0)&#xA;qc.x(1)&#xA;qc.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;produces&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WDVnW.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WDVnW.png&quot; alt=&quot;text drawer circuit output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;code&gt;settings.conf&lt;/code&gt; in the folder referenced above, containing the two lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[default]&#xA;circuit_drawer=mpl&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;the same code produces&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4NcZS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4NcZS.png&quot; alt=&quot;mpl drawer circuit output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="5955" LastEditDate="2019-11-06T20:33:08.163" LastActivityDate="2019-11-06T20:33:08.163" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8705" PostTypeId="2" ParentId="8685" CreationDate="2019-11-07T02:52:44.780" Score="3" Body="&lt;p&gt;There is one main key point in the description of your question:  Is &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; meant to be a classical secret or a quantum secret?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is meant to be a classical secret, then the answer is yes, but there is not really much quantum in the positive answer.   If &lt;span class=&quot;math-container&quot;&gt;$s_A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s_B$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$s_C$&lt;/span&gt; are all &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-state digits, then there is a simple construction that works in which &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is also a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-state digit.  (There is also a simple argument that you cannot make &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; any larger than this.)  Namely, you should choose &lt;span class=&quot;math-container&quot;&gt;$s_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_B$&lt;/span&gt; uniformly and independently at random, and the then choose &lt;span class=&quot;math-container&quot;&gt;$s_C$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$s = s_A + s_B + s_C$&lt;/span&gt; in the abelian group &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}/d$&lt;/span&gt;.  If you want to make this look quantum, then you can, because you store a digit in a qudit.  You can turn &lt;span class=&quot;math-container&quot;&gt;$s_A$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|s_A\rangle$&lt;/span&gt;, etc.  Then you are free to measure all three and take their sum, or just measure their sum.  The problem with this answer is that you did more than necessary to share the secret.  You only used the qudits as classical digits of the same size.  This is like taking a million-dollar luxury car to the supermarket when you could have done the exact same thing with a \$5,000 used car.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say instead that &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is meant to be a quantum secret &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;.   Then first of all, your language for extracting the secret is not correct.  If the dealer measures everything to gain the secret, then the result cannot be a quantum state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, because everything has been measured and all quantum superposition is then gone.  Moreover, the shares must be entangled for this to work, so they are not separate states &lt;span class=&quot;math-container&quot;&gt;$|s_A\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|s_B\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|s_C\rangle$&lt;/span&gt;, but rather a joint state &lt;span class=&quot;math-container&quot;&gt;$|s_{ABC}\rangle$&lt;/span&gt;.  To extract &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, the dealer must carefully apply some unitary operator to the joint state to get out &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; as a piece of some larger state, without measuring &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So let's say those are the rules.  We can go back and borrow a different concept from classical secret-sharing.   Namely, instead of 3 parties we may have &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; parties.  Instead of saying that we need all of the parties together to learning everything and with any fewer we know nothing, we can have the weaker condition that for some &lt;span class=&quot;math-container&quot;&gt;$t &amp;lt; \ell$&lt;/span&gt;, any set of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; or fewer parties cannot say anything about the secret.   Then there is a remarkable fact that a quantum secret-sharing with these rules is exactly the same thing as a quantum error-correcting code (QECC) of length &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-state qudits, with minimum error distance &lt;span class=&quot;math-container&quot;&gt;$t+1$&lt;/span&gt;.  Classical error correction is in a natural sense dual to classical secret-sharing.    Quantum error correction turns out to be a self-dual problem that is the same as quantum secret-sharing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take the original question in its quantum form, the question becomes finding a QECC of length 3 with &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-state qudits and minimum distance 3.   I don't think that any such code exists that can store any non-trivial information, although I would have to do some review to remember how to prove that.  I don't even expect there to be such a code with minimum distance 2 (so that only each individual party has no glimpse of the secret) if you want to the secret to have as many as &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; states when &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;.   I can check this in the special class of additive codes, and I can say non-rigorously that additive codes are sometimes optimal.   However, if the parameters are &lt;span class=&quot;math-container&quot;&gt;$\ell = 3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$t = 2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; an odd integer, then I think that there is an additive QECC of this type.   We can assume that &lt;span class=&quot;math-container&quot;&gt;$d=p$&lt;/span&gt; is prime (because otherwise we can factor &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and make separate codes).   Then we can choose three non-zero exponents &lt;span class=&quot;math-container&quot;&gt;$s,t,u \in \mathbb{Z}/p$&lt;/span&gt; that sum to zero, and we can make a quantum code that stores one qudit using the quantum parity checks &lt;span class=&quot;math-container&quot;&gt;$X \otimes X \otimes X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^s \otimes Z^t \otimes Z^u$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-11-07T02:52:44.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8706" PostTypeId="2" ParentId="8693" CreationDate="2019-11-07T10:21:31.377" Score="3" Body="&lt;p&gt;Deutsch's algorithm is not faster on a quantum computer, Deutsch's algorithm is only possible on a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;A classical computer cannot perform Deutsch's algorithm, it can only simulate Deutsch's algorithm.  Forget about speed, more fundamental is that we are performing a type of computation that can never be performed, in any amount of time, by any classical system.&lt;/p&gt;&#xA;&lt;p&gt;Consider the case of two possible evaluations, &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt;.  In any classical computation these evaluations are mutually exclusive.  We can design a classical system that evaluates &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; probabilistically to &lt;strong&gt;simulate&lt;/strong&gt; Deutsch's algorithm, but any given evaluation is either &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt;. Evaluating one means we did not evaluate the other.&lt;/p&gt;&#xA;&lt;p&gt;In contrast, Deutsch's algorithm is not evaluating &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; with some probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt;, this is only the outcome that we can simulate classically.  In Deutsch's algorithm the two evaluations &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; exist simultaneously (in superposition) and interfere with each other.&lt;/p&gt;&#xA;&lt;p&gt;I suggest forgetting about performance until you have a very clear understanding of the fundamental difference between a quantum algorithm and a classical simulation of a quantum algorithm.  In other words, until you have convinced yourself that Deutsch's algorithm can never be performed by a classical computer.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-08-06T00:36:35.497" LastActivityDate="2020-08-06T00:36:35.497" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8707" PostTypeId="5" CreationDate="2019-11-07T11:02:43.593" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-07T11:02:43.593" LastActivityDate="2019-11-07T11:02:43.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8708" PostTypeId="4" CreationDate="2019-11-07T11:02:43.593" Score="0" Body="For questions about interpretations of quantum mechanics, e.g. Copenhagen, many-worlds, etc." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-07T11:02:43.593" LastActivityDate="2019-11-07T11:02:43.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8709" PostTypeId="1" AcceptedAnswerId="8711" CreationDate="2019-11-07T13:02:55.623" Score="9" ViewCount="305" Body="&lt;p&gt;Consider the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace distance between two quantum states&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma$&lt;/span&gt;, defined via&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho,\sigma)=\frac12\operatorname{Tr}|\rho-\sigma|,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|A|\equiv\sqrt{A^\dagger A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are one-qubit states, the trace distance can be understood as the Euclidean distance between the Bloch representations of the two states. Indeed, if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{I+ \vec r\cdot \vec \sigma}{2},&#xA;\qquad&#xA;\sigma=\frac{I+ \vec s\cdot \vec \sigma}{2},$$&lt;/span&gt;&#xA;then &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}|\rho-\sigma|=\frac12\operatorname{Tr|}(\vec r-\vec s)\cdot\vec\sigma|=|\vec r- \vec s|$&lt;/span&gt;, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho,\sigma)=\frac12|\vec r-\vec s|.$$&lt;/span&gt;&#xA;This works because &lt;span class=&quot;math-container&quot;&gt;$\vec\sigma$&lt;/span&gt; are the Pauli matrices, which have the property that &lt;span class=&quot;math-container&quot;&gt;$\vec r\cdot\vec \sigma$&lt;/span&gt; has always eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm|\vec r|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Is there a similar geometric interpretation for the trace-distance of more general states?&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can always write states in their Bloch representation as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{I+\vec r\cdot\vec \sigma}{N},$$&lt;/span&gt;&#xA;however this &lt;span class=&quot;math-container&quot;&gt;$\vec\sigma$&lt;/span&gt; is not a vector of Pauli matrices anymore, but rather a more general orthogonal basis of Hermitian traceless operators (a canonical choice for these operators is used &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6358/55&quot;&gt;in this answer&lt;/a&gt;). Still, there might be a suitable basis to represent the states in which such geometrical picture works.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-04-24T08:36:49.670" LastActivityDate="2021-04-24T08:36:49.670" Title="Does the trace distance have a geometric interpretation?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8710" PostTypeId="2" ParentId="12" CreationDate="2019-11-07T19:07:42.120" Score="0" Body="&lt;p&gt;Here is my code for simulation of a quantum computer in MatLab: &lt;a href=&quot;https://www.mathworks.com/matlabcentral/fileexchange/73035-quantum-computer-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.mathworks.com/matlabcentral/fileexchange/73035-quantum-computer-simulator&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-07T19:07:42.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8711" PostTypeId="2" ParentId="8709" CreationDate="2019-11-07T19:20:42.637" Score="7" Body="&lt;p&gt;There is a geometric interpretation that you certainly can take seriously, but the geometry that you get is not as clean as you might have hoped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Trace distance between operator states is an example of a Banach norm on a vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;.  The rules for such a norm are that &lt;span class=&quot;math-container&quot;&gt;$||v|| &amp;gt; 0$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$0 \ne v \in V$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$||\lambda v|| = |\lambda|\cdot||v||$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; as scalar, and &lt;span class=&quot;math-container&quot;&gt;$||w+v|| \le ||v||+||w||$&lt;/span&gt;.   (There is also the condition that Cauchy sequences converge.  This is automatic for any norm in finite dimensions and also happens to be true for density operators on an infinite-dimensional Hilbert space.)  Any Banach norm can be thought of as a geometry of some kind.   The norm &lt;span class=&quot;math-container&quot;&gt;$||v||$&lt;/span&gt; can be thought as the length of &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;; &lt;span class=&quot;math-container&quot;&gt;$||v-w||$&lt;/span&gt; can be thought of as the distance from &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, i.e., it makes &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; a metric space; and the unit ball of the norm is some convex body that is analogous to the unit ball in Euclidean geometry.   However, general Banach norm doesn't usually come from an inner product.  When it doesn't, the unit ball isn't round and the geometry that you get isn't Euclidean.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The norm and metric in this case are defined on density operators with trace 1.  This is not technically a vector space; it is a translate of the vector space of density operators with trace 0.  You have to be careful about that in calculations, but this is close enough for our purposes.  For a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-state qudit, this vector space has dimension &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt;.  When &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, as you say, the unit ball of the norm is a round ball and the geometry is Euclidean.  When &lt;span class=&quot;math-container&quot;&gt;$d &amp;gt; 2$&lt;/span&gt;, first of all the Bloch ball itself is replaced by a more complicated state region of positive semi-definite operators with trace 1.   Both the state region itself and the unit ball of the trace norm are somewhat nondescript convex bodies.  Since they are invariant under conjugation by &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;, they have enough symmetry to have an unambiguous center point; but they don't have enough symmetry to be round.  They are not smooth convex bodies and they are not polytopes with corners either.  Rather, they have ridges of several different dimensions and otherwise they are smooth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is in fact an accompanying Euclidean geometry on density operators given by the Hilbert-Schmidt norm, but the trace norm is not that.  The fact that the two norms are equivalent in the Bloch ball for qubits is a coincidence induced by symmetry.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can get a simplified picture if you restrict to diagonal density operators. Diagonal density operators are equivalent to probability distributions, and in this case the trace distance is also called total variation distance.   In this restricted geometry, the state region and the unit ball of trace distance are both polytopes.  The state region is a simplex with &lt;span class=&quot;math-container&quot;&gt;$d+1$&lt;/span&gt; corners, while the unit ball of trace distance is a more complicated polytope with &lt;span class=&quot;math-container&quot;&gt;$d^2+d$&lt;/span&gt; corners.  For instance if you have a classical trit, the state region is an equilateral triangle and the unit ball of trace distance is a regular hexagon with three sides parallel to those of the triangle.  Since every density operator is diagonal in some basis, geometric slices representing the states of a classical digit are a helpful glimpse of the larger geometry of states of a qudit.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-11-07T19:20:42.637" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8712" PostTypeId="2" ParentId="7197" CreationDate="2019-11-07T21:16:07.900" Score="1" Body="&lt;p&gt;Quantum computers are susceptible to these errors/noise because of physical disturbances. An example of this is if some molecule in the surrounding air were to bump or approach the qubit it would transfer some kinetic energy and maybe affect the state. Another example is if a qubit interferes with any adjacent qubit, if they &quot;bump&quot; into one another their wavefunctions can constructively or destructively interfere to give an odd result. This reason is why adding more qubits into the system greatly increases the noise. There's much higher chances of a qubit &quot;spilling over&quot; onto another one because there's more energy contained. These are some of the reasons why quantum systems are super-cooled and kept in a vacuum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that I like to imagine it physically is sort of like the quantum &quot;egg carton&quot; or &lt;a href=&quot;https://physics.aps.org/story/v3/st7&quot; rel=&quot;nofollow noreferrer&quot;&gt;ions trapped in an optical lattice&lt;/a&gt;. The qubits are stuck in those craters but as you add more it becomes harder to keep them from interacting with other ones. Hence placing more qubits into these craters and conducting large amounts of operations increases the probability of error.&lt;/p&gt;&#xA;" OwnerUserId="8995" LastActivityDate="2019-11-07T21:16:07.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8713" PostTypeId="2" ParentId="8692" CreationDate="2019-11-07T22:59:21.900" Score="2" Body="&lt;p&gt;After using the simulator, I am very impressed!  From what I can tell, it has everything necessary to be universal.  I will likely be using this quite a bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To test drive it, I implemented a simple 3-qubit Fourier transform and applied it to a set of random initial states, then compared the result to the well known 3-qubit unitary DFT (&lt;code&gt;dft&lt;/code&gt;) applied to the same set of states.  The code I ran is below, and the results agreed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a few quirks, but they are relatively minor.  For example, several design constraints led me (for the sake of simplicity) to make the circuit &quot;upside down&quot; and invert the initial register tensor product rather than bit-swap at the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This made me interested in attempting to build out a simulation of Shor's algorithm based on this library.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; circ=fourier_3bit&#xA;&#xA;circ = &#xA;&#xA;  3×6 string array&#xA;&#xA;    &quot;I&quot;    &quot;I&quot;    &quot;.&quot;    &quot;I&quot;    &quot;.&quot;    &quot;H&quot;&#xA;    &quot;I&quot;    &quot;.&quot;    &quot;&quot;     &quot;H&quot;    &quot;S&quot;    &quot;I&quot;&#xA;    &quot;H&quot;    &quot;S&quot;    &quot;T&quot;    &quot;I&quot;    &quot;I&quot;    &quot;I&quot;&#xA;&#xA;&amp;gt;&amp;gt; dft=fourier_3bit_mtx&#xA;&#xA;dft =&#xA;&#xA;   0.3536 + 0.0000i   0.3536 + 0.0000i   0.3536 + 0.0000i   0.3536 + 0.0000i   0.3536 + 0.0000i   0.3536 + 0.0000i   0.3536 + 0.0000i   0.3536 + 0.0000i&#xA;   0.3536 + 0.0000i   0.2500 + 0.2500i   0.0000 + 0.3536i  -0.2500 + 0.2500i  -0.3536 + 0.0000i  -0.2500 - 0.2500i   0.0000 - 0.3536i   0.2500 - 0.2500i&#xA;   0.3536 + 0.0000i   0.0000 + 0.3536i  -0.3536 + 0.0000i   0.0000 - 0.3536i   0.3536 + 0.0000i   0.0000 + 0.3536i  -0.3536 + 0.0000i   0.0000 - 0.3536i&#xA;   0.3536 + 0.0000i  -0.2500 + 0.2500i   0.0000 - 0.3536i   0.2500 + 0.2500i  -0.3536 + 0.0000i   0.2500 - 0.2500i   0.0000 + 0.3536i  -0.2500 - 0.2500i&#xA;   0.3536 + 0.0000i  -0.3536 + 0.0000i   0.3536 + 0.0000i  -0.3536 + 0.0000i   0.3536 + 0.0000i  -0.3536 + 0.0000i   0.3536 + 0.0000i  -0.3536 + 0.0000i&#xA;   0.3536 + 0.0000i  -0.2500 - 0.2500i   0.0000 + 0.3536i   0.2500 - 0.2500i  -0.3536 + 0.0000i   0.2500 + 0.2500i   0.0000 - 0.3536i  -0.2500 + 0.2500i&#xA;   0.3536 + 0.0000i   0.0000 - 0.3536i  -0.3536 + 0.0000i   0.0000 + 0.3536i   0.3536 + 0.0000i   0.0000 - 0.3536i  -0.3536 + 0.0000i   0.0000 + 0.3536i&#xA;   0.3536 + 0.0000i   0.2500 - 0.2500i   0.0000 - 0.3536i  -0.2500 - 0.2500i  -0.3536 + 0.0000i  -0.2500 + 0.2500i   0.0000 + 0.3536i   0.2500 + 0.2500i&#xA;&#xA;&amp;gt;&amp;gt; regs=initializeRegisters(v1,v2,v3)&#xA;&#xA;regs =&#xA;&#xA;   0.0000 - 0.2804i&#xA;  -0.2349 + 0.0000i&#xA;   0.0000 + 0.5541i&#xA;   0.4643 + 0.0000i&#xA;   0.2029 + 0.0000i&#xA;   0.0000 - 0.1700i&#xA;  -0.4009 + 0.0000i&#xA;   0.0000 + 0.3359i&#xA;&#xA;&amp;gt;&amp;gt; regs_rev=initializeRegisters(v3,v2,v1)&#xA;&#xA;regs_rev =&#xA;&#xA;   0.0000 - 0.2804i&#xA;   0.2029 + 0.0000i&#xA;   0.0000 + 0.5541i&#xA;  -0.4009 + 0.0000i&#xA;  -0.2349 + 0.0000i&#xA;   0.0000 - 0.1700i&#xA;   0.4643 + 0.0000i&#xA;   0.0000 + 0.3359i&#xA;&#xA;&amp;gt;&amp;gt; dft*regs&#xA;&#xA;ans =&#xA;&#xA;   0.0111 + 0.1555i&#xA;  -0.4009 + 0.2265i&#xA;   0.3923 - 0.5422i&#xA;   0.3405 - 0.3100i&#xA;  -0.1511 + 0.0381i&#xA;  -0.1343 - 0.1412i&#xA;   0.0346 - 0.0478i&#xA;  -0.0921 - 0.1717i&#xA;&#xA;&amp;gt;&amp;gt; quantumComputer(circ,[1 2 3],regs_rev)&#xA;&#xA;ans =&#xA;&#xA;   0.0111 + 0.1555i&#xA;  -0.4009 + 0.2265i&#xA;   0.3923 - 0.5422i&#xA;   0.3405 - 0.3100i&#xA;  -0.1511 + 0.0381i&#xA;  -0.1343 - 0.1412i&#xA;   0.0346 - 0.0478i&#xA;  -0.0921 - 0.1717i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wg1bH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wg1bH.jpg&quot; alt=&quot;Probability Dist&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-11-07T23:14:28.790" LastActivityDate="2019-11-07T23:14:28.790" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8714" PostTypeId="2" ParentId="8552" CreationDate="2019-11-08T03:23:54.947" Score="1" Body="&lt;p&gt;Both IBM and Google unveiled 53-qubit processors. At this time, only Google published performance metrics such as 1- and 2-qubit gate errors. Until IBM publishes similar metrics we simply cannot even tell whether &lt;code&gt;Google's processor outperforms IBM's&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we can tell is that the connectivity of the two processors is different - Google's Sycamore processor has nearest-neighbor connectivity on a rectangular grid, while &lt;a href=&quot;https://www.ibm.com/blogs/research/2019/09/quantum-computation-center/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM's Rochester&lt;/a&gt; processor has a reduced connectivity on what appears to be an edge-centered hexagonal lattice. It will be interesting to see how the different connectivities play out with regards to performance benchmarks, such as &lt;a href=&quot;https://arxiv.org/pdf/1811.12926.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum volume&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With regards to universality, an issue that was raised in the comments, Section VII.F in the &lt;a href=&quot;https://static-content.springer.com/esm/art%3A10.1038%2Fs41586-019-1666-5/MediaObjects/41586_2019_1666_MOESM1_ESM.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;supplement of the Google paper&lt;/a&gt; shows that the gate-set used in the experiment is universal:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The proof consists of two parts. First, we show that&#xA;  the CZ gate can be obtained as a composition of two&#xA;  fSim gates and single-qubit rotations. Second, we outline&#xA;  how the well-known proof that the H and T gates are&#xA;  universal for SU(2) [56] can be adapted for X1/2 and&#xA;  W1/2&#xA;  . The conclusion follows from the fact that the gate&#xA;  set consisting of the CZ gate and SU(2) is universal [57].&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;To the extent that universality means &quot;the processor uses a universal gate set&quot;, the Google processor is universal. If however, you rather define universality to require a fault-tolerant quantum processor, then no currently existing device can be considered as universal.&lt;/p&gt;&#xA;" OwnerUserId="127" LastActivityDate="2019-11-08T03:23:54.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8715" PostTypeId="1" CreationDate="2019-11-08T04:57:02.060" Score="2" ViewCount="199" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let's say I know my experimentalist friend has been measuring the eigenvalues of a physical system. I can see the &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; measurements are noted in a sheet of paper and I  assume the dimensionality of the Hamiltonian to be &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. I also note the dimensions of eigenvalues of that of energy. I see non-unique eigenvalues and (randomly) guess an eigen-operator &lt;span class=&quot;math-container&quot;&gt;$\hat O$&lt;/span&gt; was measured in between the measurements ,i.e, a measurement of operator &lt;span class=&quot;math-container&quot;&gt;$\hat O$&lt;/span&gt; was done after every eigenenergy measurement. I would like to guess the Hamiltonian of the system.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Now, my question how to quantify this probability of a reasonable guess of the Hamiltonian (any strategy is allowed including the one given below) of it being  particular dimension &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; given &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; measurements as correct ? I would prefer if one included degerate Hamiltonians in their calculations (if possible)? &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Why it's a difficult problem&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This only means to show the probabilistic nature of the problem. We will think of this in terms of eigen-energies primarily other formulation will require another layer of probability. Now: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let, us write a variable Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is a counting system adopted which avoids redundancy . From the eigenvalue equation for energy:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_j |\lambda_i  \rangle= \tilde  \lambda_i|\lambda_i  \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the spectral theorem I can reconstruct a particular Hamiltonian, see:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_j=  \sum_{i} \tilde \lambda_i |\lambda_i \rangle \langle \lambda_i|  $$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we include degeneracies in the argument after measuring &lt;span class=&quot;math-container&quot;&gt;$\tilde \lambda_\alpha$&lt;/span&gt; one can conclude:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{\partial}{\partial \tilde \lambda_\alpha} H_j=  \sum_{\kappa} |\lambda_\kappa \rangle \langle \lambda_\kappa| $$&lt;/span&gt; &#xA;How does one conclude this? When one measures a particular eigenvalue and assumes a degenerate &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \tilde \lambda_\alpha \to  \sum_{\kappa}^M |\lambda_\kappa \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: all degeneracies obey: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_j |\lambda_\kappa  \rangle= \tilde  \lambda_\alpha|\lambda_\kappa \rangle $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Non-uniqueness&lt;/strong&gt;: given the same eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\tilde  \lambda_\alpha$&lt;/span&gt; cannot one distinguish between &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$H_\delta = H_j - |\tilde  \lambda_\alpha \rangle \langle \tilde  \lambda_\alpha |$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2020-08-20T08:05:32.390" LastActivityDate="2021-05-17T11:05:15.537" Title="Quantify the probability in guessing the Hamiltonian?" Tags="&lt;dynamics&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8716" PostTypeId="1" CreationDate="2019-11-08T05:05:32.593" Score="2" ViewCount="33" Body="&lt;p&gt;My experiments show that the runtime of actually applying the measurement filter matrices to circuit execution results is much slower for tensored mitigation than ordinary mitigation. Tensored mitigation quickly becomes almost intractable as circuit gets larger.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought since tensored mitigation only accounts for local measurement errors, it would be faster to compute the matrices as well as applying them to circuit results? I am using measurement mitigation as described &#xA;&lt;a href=&quot;https://quantum-computing.ibm.com/jupyter/tutorial/advanced/ignis/4_measurement_error_mitigation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8950" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:56.093" LastActivityDate="2020-08-17T02:53:56.093" Title="Tensored vs ordinary measurement mitigation runtime" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;error-mitigation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8717" PostTypeId="1" AcceptedAnswerId="8723" CreationDate="2019-11-08T05:29:09.003" Score="2" ViewCount="273" Body="&lt;p&gt;&lt;a href=&quot;http://www.scottaaronson.com/blog/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aaronson's blog&lt;/a&gt; notably states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Quantum computers would not solve hard search problems&#xA;  instantaneously by simply trying all the possible solutions at once.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is this a statement of a law, as in, is there some no-go theorem that prevents this, or is this a statement about what we know, that is, it's possible in theory, but we have not found an algorithm that does this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: &#xA;People are pointing out that the word 'simply' carries the meaning of the popular science explanations, whereby once the quantum state contains all the possible amplitudes, then the computer tells us the one we're looking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the first part seems manifestly possible to me. It's not hard to create a quantum state who's amplitudes do represent all the possibilities at once. So what if we drop the word 'simply' from his statement. Is there some complicated mechanism that can cancel out all the other possibilities?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems like as long as 1) Every gate is unitary and 2) Every measurement is Hermitian, it's a valid quantum circuit. And the task is to determine that to-be-specified complicated mechanism.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why isn't this an active area of research?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1867" LastEditDate="2019-11-09T01:59:03.700" LastActivityDate="2019-11-12T06:17:07.830" Title="Is quantum parallel search impossible?" Tags="&lt;algorithm&gt;&lt;models&gt;&lt;quantum-parallelism&gt;" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="8718" PostTypeId="1" CreationDate="2019-11-08T08:57:35.917" Score="8" ViewCount="84" Body="&lt;p&gt;Reduced graph states are characterized as follows (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;from page 46 of this paper&lt;/a&gt;): Let &lt;span class=&quot;math-container&quot;&gt;$A \subseteq V$&lt;/span&gt; be a subset of vertices of a graph &lt;span class=&quot;math-container&quot;&gt;$G = (V,E)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B = V\setminus A$&lt;/span&gt; the complement of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. The reduced state &lt;span class=&quot;math-container&quot;&gt;$\rho_{G}^{A}:= \mathrm{tr}_{B}(|G\rangle\langle G|)$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$$\rho^{A}_{G} = \frac{1}{2^{|A|}}\sum_{\sigma \in \mathcal{S_{A}}}\sigma,~~~~~~~~~~~~~~~~~~(1)$$&lt;/span&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_{A}:=\{ \sigma \in \mathcal{S}| \text{supp}(\sigma) \subseteq A \}$&lt;/span&gt; denotes the subgroup of stabilizer elements &lt;span class=&quot;math-container&quot;&gt;$\sigma \in \mathcal{S}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt; with support on the set of vertices within &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\rho_{G}^{A}$&lt;/span&gt; is up to some factor a projection, i.e. &lt;span class=&quot;math-container&quot;&gt;$$(\rho_{G}^{A})^2 = \frac{|\mathcal{S}_{A}|}{2^{|A|}}\rho_{G}^{A}~~~~~~~~~~~~~~~~~~~(2)$$&lt;/span&gt;It projects onto the subspace in &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}^{A}$&lt;/span&gt; spanned by the vectors &lt;span class=&quot;math-container&quot;&gt;$$|\mathbf{\Gamma}'B'\rangle_{G[A]} = \sigma_{z}^{\mathbf{\Gamma}'B'}|G[A]\rangle~~~~~~~(B' \subseteq B)~~~~~~~~~(3)$$&lt;/span&gt;where &lt;span class=&quot;math-container&quot;&gt;$G[A] = G\setminus B$&lt;/span&gt; is the subgraph of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; induced by &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\Gamma}':=\mathbf{\Gamma}^{AB}$&lt;/span&gt; denotes the &lt;span class=&quot;math-container&quot;&gt;$|A| \times |B|-$&lt;/span&gt;off diagonal sub-matrix of the adjacency matrix &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\Gamma}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; that represents the edges between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\begin{pmatrix}&#xA;\mathbf{\Gamma}_{A} &amp;amp; \mathbf{\Gamma}_{AB} \\&#xA;\mathbf{\Gamma}^{T}_{AB} &amp;amp; \mathbf{\Gamma}_{B}&#xA;\end{pmatrix} = \mathbf{\Gamma}.&#xA;\end{align}&lt;/span&gt;&#xA;In this basis, &lt;span class=&quot;math-container&quot;&gt;$\rho_{G}^{A}$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$$\rho_{G}^{A} = \frac{1}{2^{|B|}}\sum_{B' \subseteq B}| \mathbf{\Gamma}' B' \rangle_{G[A]} \langle \mathbf{\Gamma}'B'|.~~~~~~~~~~~~~(4)$$&lt;/span&gt;&#xA;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;The results of equation (1) and (2) are understood. I'm trying to understand the motivation for defining the basis states &lt;span class=&quot;math-container&quot;&gt;$| \mathbf{\Gamma}' B' \rangle_{G[A]}$&lt;/span&gt; as shown in equation (3). As I understand, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\Gamma} B' $&lt;/span&gt; in the exponent of equation (3), is some string in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^{|B'|}$&lt;/span&gt;. In this way they would show that there are sufficient permutations of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\Gamma}' B'$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$B' \subseteq B$&lt;/span&gt;, to produce orthogonal states &lt;span class=&quot;math-container&quot;&gt;$| \mathbf{\Gamma}' B' \rangle_{G[A]}$&lt;/span&gt; which spans a subspace of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}^{A} \subseteq (\mathbb{C})^V$&lt;/span&gt;. Explicitly how is the term '| &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\Gamma}' B' \rangle_{G[A]}$&lt;/span&gt;' defined?  I don't really understand why the exponent is chosen as &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\Gamma} B'$&lt;/span&gt; in to begin with to characterize the basis states?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="10480" LastEditDate="2021-01-22T21:06:46.937" LastActivityDate="2021-01-22T21:06:46.937" Title="Query on Reduced Graph States" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;graph-states&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8719" PostTypeId="1" CreationDate="2019-11-08T10:35:04.417" Score="1" ViewCount="61" Body="&lt;p&gt;I am running a VQE calculation running from a cluster using nohup.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, some of my jobs keep hanging with 'creating' and therefore my VQE is not converging/not working.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, at the same time, a subset of my jobs are still running.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please, can you help me diagnose the problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a selection of Job IDs of the 63 (at present) hanging jobs:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;5dc539d363f7360011c42a62&#xA;&#xA;5dc51254ac8b9a0011fb486d&#xA;&#xA;5dc51254ac8b9a0011fb486d&#xA;&#xA;5dc51254ac8b9a0011fb486d&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9063" LastEditorUserId="26" LastEditDate="2019-11-16T17:37:24.143" LastActivityDate="2019-11-16T17:37:24.143" Title="Many jobs hanging after creating" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8720" PostTypeId="1" CreationDate="2019-11-08T11:50:53.737" Score="1" ViewCount="424" Body="&lt;p&gt;Recently I've got a new machine and had to start over again (Qiskit installation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As this was not my first time in creating a Qiskit environment on Anaconda, I was able to work out the errors. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But someone starting afresh will have trouble mitigating errors. And hence would like to find out the stable Python version!&lt;/p&gt;&#xA;" OwnerUserId="9061" LastEditorUserId="26" LastEditDate="2019-11-16T16:40:12.397" LastActivityDate="2019-11-16T16:40:12.397" Title="How do I find out which stable Python version Qiskit will be compatible to?" Tags="&lt;qiskit&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8721" PostTypeId="2" ParentId="8720" CreationDate="2019-11-08T13:53:41.643" Score="2" Body="&lt;p&gt;The python version that is supported by Qiskit is supported is written in the documentation &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; - &lt;code&gt;Qiskit supports Python 3.5 or later.&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-08T13:53:41.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8722" PostTypeId="2" ParentId="8717" CreationDate="2019-11-08T14:23:16.873" Score="3" Body="&lt;p&gt;The statement is meant to get in front of any misconceptions, for example by the science press, about how quantum computers operate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not a &quot;no-go&quot; in the sense of a theorem, nor do I believe many researchers have spent much time considering a possible algorithm that &quot;&lt;em&gt;simply&lt;/em&gt; tries all possible solutions at once.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe it's meant to say that quantum computers achieve a speedup through means such as, especially, constructive and destructive interference, as opposed to &quot;&lt;em&gt;simply&lt;/em&gt; trying all the possible solutions at once.&quot;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-11-08T14:23:16.873" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8723" PostTypeId="2" ParentId="8717" CreationDate="2019-11-09T04:24:17.340" Score="6" Body="&lt;p&gt;The point is that free parallel computation or cloning of your existence is a wholesale misinterpretation of the concept of quantum superposition.   Quantum states are analogous to probability distributions.  If you &lt;em&gt;might&lt;/em&gt; wash the dishes or you &lt;em&gt;might&lt;/em&gt; wash the floor and you flip a coin to decide which one, then no one takes that to mean that you will wash both of them in parallel.  Quantum superposition is the same sort of thing, except with complex-valued amplitudes rather than real-valued probabilities.  That fact leads to some amazing effects and extra computational power --- but it's still statistics, not replication.   In that sense, quantum algorithms are much more similar to randomized algorithms than to parallel computation.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To address the amended version of the question, there is a &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9711070.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;fundamental result&lt;/a&gt; that Grover's algorithm is optimal for unstructured search, i.e., a search whose predicate &lt;span class=&quot;math-container&quot;&gt;$f(x) = \text{yes}$&lt;/span&gt; is given by a black-box algorithm.   Grover's algorithm gives you only a quadratic speedup, which means that unstructured search still takes exponential time, just with a better exponent.  Thus, with the black-box assumption, free parallel search is provably impossible for a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if the predicate is given by a white-box algorithm, then you can't even prove that something as good as free parallel search is classically impossible, because this is exactly the question &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; vs &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;.  There is a more specific conjecture that with a bad enough predicate your only option is exhaustive search or similar; it is a version of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_time_hypothesis&quot; rel=&quot;nofollow noreferrer&quot;&gt;exponential time hypothesis&lt;/a&gt;.  I think that reasonable people in QC believe the same exponential time hypothesis for quantum computing too, except for the square root that you get from Grover's algorithm.  (Or, if I can't speak for reasonable people, I tend to believe it.)&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-11-12T06:17:07.830" LastActivityDate="2019-11-12T06:17:07.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8724" PostTypeId="1" CreationDate="2019-11-09T06:23:27.373" Score="2" ViewCount="83" Body="&lt;p&gt;There are tools like qutip helping you to simulate a given Hamiltonian. However, I am wondering is there any tool/library or something that takes e.g. a graph (G, V, E) of qubits and resonators, and returns a Hamiltonian. It does not have to be graph though, it can be anything, simply returning &quot;approximated Hamiltonian&quot; from the circuit.  &lt;/p&gt;&#xA;" OwnerUserId="9070" LastEditorUserId="26" LastEditDate="2019-11-16T16:39:07.793" LastActivityDate="2019-11-16T16:39:07.793" Title="Is there any tool for generating Hamiltonian for circuit-QED?" Tags="&lt;resource-request&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8725" PostTypeId="1" AcceptedAnswerId="8726" CreationDate="2019-11-09T12:43:20.377" Score="9" ViewCount="2282" Body="&lt;p&gt;Is it possible to decompose a hermitian and unitrary matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; into the sum of the Pauli matrix Kronecker products? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I have a matrix 16x16 and want it to be decomposed into something like &lt;span class=&quot;math-container&quot;&gt;$$A =\sum_{i,j,k,l}h_{ijkl}\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l$$&lt;/span&gt;&#xA;I can't find any clear explanation how it can be done.&#xA;I found only this for two-dimentional case:&#xA;&lt;a href=&quot;https://michaelgoerz.net/notes/decomposing-two-qubit-hamiltonians-into-pauli-matrices.html&quot; rel=&quot;noreferrer&quot;&gt;https://michaelgoerz.net/notes/decomposing-two-qubit-hamiltonians-into-pauli-matrices.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6071" LastEditorUserId="55" LastEditDate="2020-06-04T15:01:58.207" LastActivityDate="2020-06-04T15:01:58.207" Title="Can arbitrary matrices be decomposed using the Pauli basis?" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;pauli-gates&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="9" ClosedDate="2019-11-12T23:03:02.730" ContentLicense="CC BY-SA 4.0" />
  <row Id="8726" PostTypeId="2" ParentId="8725" CreationDate="2019-11-09T13:49:16.983" Score="11" Body="&lt;p&gt;For any matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; we can write &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A =\sum_{i,j,k,l}h_{ijkl}\cdot \frac{1}{4}\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l,&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;h_{ijkl} = \frac{1}{4}\text{Tr}\big((\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l)^\dagger \cdot A\big) = \frac{1}{4}\text{Tr}\big((\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l) \cdot A\big) &#xA;$$&lt;/span&gt;&#xA;This is because 256 matrices &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}\sigma_i\otimes\sigma_j\otimes\sigma_k\otimes\sigma_l$&lt;/span&gt; form an orthonormal basis in the linear space of all &lt;span class=&quot;math-container&quot;&gt;$16 \times 16$&lt;/span&gt; matrices under Hilbert-Schmidt inner product given by &lt;span class=&quot;math-container&quot;&gt;$( A,B) = \text{Tr}(B^\dagger A)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$e_i$&lt;/span&gt; then any element of a Hilbert space can be written as &lt;span class=&quot;math-container&quot;&gt;$v = \sum_i (v,e_i)e_i$&lt;/span&gt;. That's it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If dimension is not power of 2, then it's impossible, of course. But there are generalizations of Pauli matrices &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices&lt;/a&gt;. So the similar formula can be written.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-11-09T14:55:31.027" LastActivityDate="2019-11-09T14:55:31.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8727" PostTypeId="1" CreationDate="2019-11-09T14:32:25.717" Score="2" ViewCount="102" Body="&lt;p&gt;If we apply Hadamard gate 2 times on a qubit &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then we will get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&#xA;So there must be something else which is unique for both &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; which is constant even in superposition. What is it?&lt;/p&gt;&#xA;" OwnerUserId="9029" LastEditorUserId="55" LastEditDate="2019-11-09T15:11:59.683" LastActivityDate="2019-11-09T18:00:25.793" Title="What is the difference between superposition of $|0\rangle$ and superposition of $|1\rangle$ at physical level?" Tags="&lt;physical-qubit&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8728" PostTypeId="2" ParentId="8725" CreationDate="2019-11-09T14:47:44.877" Score="9" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{{\boldsymbol #1}}&#xA;\newcommand{\tildebssigma}{\tilde{\bs\sigma}}&#xA;\newcommand{\bssigma}{{\bs\sigma}}$&lt;/span&gt;Yes, products of Pauli matrices form a basis for the set of Hermitian matrices (of dimensions that are powers of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, fix an integer &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$N\equiv 2^n$&lt;/span&gt;, define &lt;span class=&quot;math-container&quot;&gt;$\bssigma\equiv(\sigma_x,\sigma_y,\sigma_y)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\tildebssigma\equiv (I,\sigma_x,\sigma_y,\sigma_y)$&lt;/span&gt;.&#xA;Moreover, let &lt;span class=&quot;math-container&quot;&gt;$J\in\{0,1,2,3\}^{n}$&lt;/span&gt; be a tuple of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; integers with each &lt;span class=&quot;math-container&quot;&gt;$J_i\in\{0,1,2,3\}$&lt;/span&gt;.&#xA;Consider the matrices of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tildebssigma_J\equiv\prod_{k=1}^n \tildebssigma^{(k)}_{J_k},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\tildebssigma_j^{(k)}$&lt;/span&gt; denotes the Pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\tildebssigma_j$&lt;/span&gt; applied on the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th qubit.&#xA;You can check that these are all Hermitians. Moreover, &lt;span class=&quot;math-container&quot;&gt;$\tildebssigma_J$&lt;/span&gt; is traceless for all &lt;span class=&quot;math-container&quot;&gt;$J\neq(0,...,0)$&lt;/span&gt; (for which &lt;span class=&quot;math-container&quot;&gt;$\tildebssigma_{(0,...,0)}=I$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;span class=&quot;math-container&quot;&gt;$4^n=N^2$&lt;/span&gt; matrices of this form (one for each possible choice of &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;), and for any pair of tuples &lt;span class=&quot;math-container&quot;&gt;$J,K$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\tildebssigma_J\tildebssigma_K)=N\delta_{JK}$&lt;/span&gt;.&#xA;Moreover, the space of Hermitian &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrices also has dimension &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt;. It follows that &lt;span class=&quot;math-container&quot;&gt;$\{\tildebssigma_J\}_J$&lt;/span&gt; is a basis for this space. Explicitly, you can decompose an arbitrary Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H=\frac{1}{N}\sum_J \operatorname{Tr}(\tildebssigma_J H)\tildebssigma_J.$$&lt;/span&gt;&#xA;Note that the coefficients in any such expansion are always &lt;em&gt;real&lt;/em&gt;. This is not by chance. Indeed,  being more careful, we should state that the set of &lt;em&gt;real&lt;/em&gt; linear combinations of products of Pauli matrices give the set of Hermitian matrices (notice that if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is Hermitian then &lt;span class=&quot;math-container&quot;&gt;$\alpha A$&lt;/span&gt; is Hermitian iff &lt;span class=&quot;math-container&quot;&gt;$\alpha\in\mathbb R$&lt;/span&gt;, so this is not surprising).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More general matrices can be generated if we allow for complex coefficients in the expansion.&#xA;Indeed, note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{I+Z}{2}=\begin{pmatrix}1&amp;amp;0 \\ 0 &amp;amp; 0\end{pmatrix},&#xA;\qquad \frac{I-Z}{2}=\begin{pmatrix}0&amp;amp;0 \\ 0 &amp;amp; 1\end{pmatrix}, \\&#xA;\frac{X+iY}{2}=\begin{pmatrix}0 &amp;amp; 1 \\ 0 &amp;amp; 0\end{pmatrix}&#xA;\qquad&#xA;\frac{X-iY}{2}=\begin{pmatrix}0 &amp;amp; 0 \\ 1 &amp;amp; 0\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Therefore the complex span of Pauli matrices can be used to generate arbitrary &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices. This then translates into the same result for arbitrary &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional spaces, as if &lt;span class=&quot;math-container&quot;&gt;$\mathcal V\equiv\{v_k\}$&lt;/span&gt; is a basis for &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, then the sets of tensor products of elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal V$&lt;/span&gt; form a basis for &lt;span class=&quot;math-container&quot;&gt;$V^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a special instance of the more general fact that any matrix can be decomposed uniquely as sum of a Hermitian and a skew-Hermitian matrix, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\frac{A+A^\dagger}{2}+i\frac{A-A^\dagger}{2i},$$&lt;/span&gt;&#xA;and the fact that products of Pauli matrices give you a basis for the set of Hermitian matrices.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-11T09:57:06.367" LastActivityDate="2019-11-11T09:57:06.367" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8729" PostTypeId="1" AcceptedAnswerId="8735" CreationDate="2019-11-09T15:22:30.170" Score="7" ViewCount="231" Body="&lt;p&gt;In &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;noreferrer&quot;&gt;these lecture notes by Scott Aaronson&lt;/a&gt;, the author states the following (towards the end of the document, just before the &lt;em&gt;Linearity&lt;/em&gt; section):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;There's actually another phenomenon with the same &quot;Goldilocks&quot; flavor, which was observed by Bill Wootters -- and this leads to my third reason why amplitudes should be complex numbers. Let's say we choose a quantum state &lt;span class=&quot;math-container&quot;&gt;$$\sum_{i=1}^N \alpha_i |i\rangle$$&lt;/span&gt;&#xA;  uniformly at random (if you're a mathematician, under the Haar measure). And then we measure it, obtaining outcome &lt;span class=&quot;math-container&quot;&gt;$\lvert i\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha_i|^2$&lt;/span&gt;. The question is, &lt;strong&gt;&lt;em&gt;will the resulting probability vector also be distributed uniformly at random in the probability simplex? It turns out that if the amplitudes are complex numbers, then the answer is yes. But if the amplitudes are real numbers or quaternions, then the answer is no!&lt;/em&gt;&lt;/strong&gt; (I used to think this fact was just a curiosity, but now I'm actually using it in a paper I'm working on...)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Numerically, I can see that this seems to be the case. Indeed, using &lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt; as an example, if I generate random elements in the sphere, and look at the resulting distribution of the &lt;em&gt;squares&lt;/em&gt; of the coordinates, I get the picture below on the left, while doing the same with complex coefficients (that is, with random states), I get the one on the right:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(* sampling wiht real coefficients *)&#xA;#/Norm@# &amp;amp; /@ RandomReal[{-1, 1}, {10000, 3}] // Graphics3D[{Point[#^2]}] &amp;amp;&#xA;(* sampling with complex coefficients *)&#xA;RandomUnitary[m_] := Orthogonalize @ Function@ Map[&#xA;    Function[#[[1]] + I * #[[2]]], #, {2}&#xA;] @ RandomReal[NormalDistribution[0, 1], {m, m, 2}];&#xA;Table[First @ RandomUnitary @ 3, 10000] // Abs[#]^2 &amp;amp; // Graphics3D[{Point[#]}] &amp;amp;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/B0l3b.png&quot; width=&quot;300&quot;&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/SZMME.png&quot; width=&quot;300&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice how different for example the edge are.&#xA;Sampling with real coefficients clearly gives a much denser distribution towards the edges of the simplex.&#xA;Plotting the associated histograms shows clearly that the real coefficients do not give a uniform distribution, while the complex ones do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this the case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-09T18:27:34.860" LastActivityDate="2019-11-10T04:20:33.683" Title="Why is the probability vector of a uniformly random state $\sum_i\alpha_i|i\rangle$ uniformly random only if $\alpha_i\in\mathbb C$?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8731" PostTypeId="2" ParentId="8727" CreationDate="2019-11-09T18:00:25.793" Score="3" Body="&lt;p&gt;Much as in CMOS we almost always equate a low voltage with binary zero, and high voltage with binary one, and a classical &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt; gate as implementing the truth-table by adjusting voltages to be consistent, we have similar requirements in quantum computing to call &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;, and the Hadamard gate acting on it in the manner you described.  We could have a convention of low-voltage being one and high-voltage being zero; we would have to adjust how we implement &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt; appropriately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The polarity of photons is straightforward to visualize as qubits.  If we settle on what we mean by &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt; with respect to the polarity of photons, then a Hadamard gate would be the one that rotates the polarity appropriately.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-11-09T18:00:25.793" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8734" PostTypeId="1" AcceptedAnswerId="8746" CreationDate="2019-11-09T23:58:28.197" Score="0" ViewCount="67" Body="&lt;p&gt;I want to get a large collection of quantum circuits that matter to practitioners in quantum computing. I want a get many complete quantum circuits. For example, 1 million QASM files.&#xA;However, I could not readily find a large dataset.&#xA;Are there any places I could find it?&lt;/p&gt;&#xA;" OwnerUserId="9078" LastEditorUserId="9078" LastEditDate="2019-11-10T04:13:54.697" LastActivityDate="2019-11-12T08:31:30.033" Title="How to get a large collection of quantum circuits that are valuable to practitioners?" Tags="&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2019-11-12T23:04:55.453" ContentLicense="CC BY-SA 4.0" />
  <row Id="8735" PostTypeId="2" ParentId="8729" CreationDate="2019-11-10T04:12:47.287" Score="3" Body="&lt;p&gt;We can begin this question by comparing two small cases, a qubit with a &quot;rebit&quot;, the  latter being a qubit confined to real amplitudes.   The set of pure state of a rebit  makes a great circle in the Bloch sphere, say a vertical circle.  The corresponding measure on the probability interval is given by projecting uniform measure on the circle onto the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis, i.e., a diameter of the circle.  If you draw a picture of this, it leaps out at you that of course it's not uniform, because the circle is parallel to its diameter at the middle, but angled near the poles.  If we parametrize the projection interval as &lt;span class=&quot;math-container&quot;&gt;$[-1,1]$&lt;/span&gt;, which is different from the probability parametrization &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt; but convenient here, then the projected density is the same as the arc length integrand for a circle, namely it is &lt;span class=&quot;math-container&quot;&gt;$\frac{dz}{\pi\sqrt{1-z^2}}$&lt;/span&gt;.  Just as the geometry suggests, the density goes to infinity at the endpoints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you repeat this same thinking for the Bloch sphere of a qubit, then you see a coincidence that has been celebrated for a very long time.  Borrowing from spherical coordinates, let &lt;span class=&quot;math-container&quot;&gt;$z = \cos \theta$&lt;/span&gt;.  Then a latitude band at a polar angle of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; of height &lt;span class=&quot;math-container&quot;&gt;$dz$&lt;/span&gt; is tilted to give you its area a factor of &lt;span class=&quot;math-container&quot;&gt;$1/(\sin \theta)$&lt;/span&gt;, but its radius is &lt;span class=&quot;math-container&quot;&gt;$\sin \theta$&lt;/span&gt; rather than 1.  The factors cancel! The area of the band is always &lt;span class=&quot;math-container&quot;&gt;$2\pi dz$&lt;/span&gt;, independent of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, and the projection onto the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis is indeed uniform measure on the probability interval.   I said that this has been celebrated for a long time, but I didn't say how long.  In geometric form, it was first published by Archimedes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the argument only works for the Bloch sphere &lt;em&gt;surface&lt;/em&gt;, i.e., for pure states.  For mixed states, the middle of a ball is always fatter than its ends, so uniform measure does not project to uniform measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another case that does not work is a qubit with quaternionic amplitudes, which I guess you could call a &quot;ququbit&quot;.   The analogue of a Bloch sphere in this case is a 4-sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^5$&lt;/span&gt;.  The beautiful coincidence of Archimedes is now wrecked because the polar regions are too small rather than too large as in the case of a circle.   The tilt still gives you a factor of &lt;span class=&quot;math-container&quot;&gt;$1/(\sin \theta)$&lt;/span&gt;, but a radius of &lt;span class=&quot;math-container&quot;&gt;$\sin \theta$&lt;/span&gt; now gives you a factor of &lt;span class=&quot;math-container&quot;&gt;$(\sin \theta)^3$&lt;/span&gt; in the 3-dimensional volume, to give you a total answer proportional to &lt;span class=&quot;math-container&quot;&gt;$(\sin \theta)^2$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$(1-z^2)dz$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You might still wonder how this is going to work for higher-dimensional qudits.  There are various ways to argue this.  Some of them (like the moment map interpretation in symplectic geometry) are so elegant that they give you a uniform measure coincidence that is vastly more general than the original question; but these arguments tend to pull in more advanced mathematics (like symplectic geometry).  One good argument relies on a pair of algorithms, which are valuable tricks in computer software, for generating either a uniformly random point in the unit sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n$&lt;/span&gt; or the regular simplex subtended by the standard basis in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the former case, you should choose each coordinate of a vector using Gaussian measure proportional to &lt;span class=&quot;math-container&quot;&gt;$\exp(-x^2)$&lt;/span&gt;, and then rescale the total vector to have Euclidean length 1.  This works because the joint density is proportional to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \exp(-x_1^2 - x_2^2 - \cdots - x_n^2),$$&lt;/span&gt;&#xA;which is constant on concentric sphere surfaces.  Similarly, to get a uniformly random point on the simplex of non-negative vectors with coordinate sum 1, you should choose each coordinate with exponential measure &lt;span class=&quot;math-container&quot;&gt;$\exp(-x)$&lt;/span&gt;, and now rescale to make the coordinate sum 1.  This time the joint density is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \exp(-x_1 - x_2 - \cdots - x_n),$$&lt;/span&gt;&#xA;which is constant on parallel simplices in the positive orthant &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n_{\ge 0}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let &lt;span class=&quot;math-container&quot;&gt;$n = 2d$&lt;/span&gt; and interpret &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^d$&lt;/span&gt;, and look at what happens when you choose each complex coordinate &lt;span class=&quot;math-container&quot;&gt;$z = x+iy$&lt;/span&gt; using Gaussian measure &lt;span class=&quot;math-container&quot;&gt;$\exp(-x^2-y^2)$&lt;/span&gt; in the complex plane.  If &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is an amplitude, the corresponding probability is &lt;span class=&quot;math-container&quot;&gt;$p = |z|^2 = x^2 + y^2 = r^2$&lt;/span&gt;.  To convert the measure from &lt;span class=&quot;math-container&quot;&gt;$z \in \mathbb{C}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$p \in \mathbb{R}_{\ge 0}$&lt;/span&gt;, we project onto a radial ray and then square the radius.  To do this competently, we need to remember infinitesimal length and area factors from calculus.  We get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \exp(-x^2-y^2)\, dx\, dy = \exp(-r^2)\, r\, dr\, d\theta. $$&lt;/span&gt;&#xA;That extra factor of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; (remember that the length of a circle is proportional to its radius) is crucial given that &lt;span class=&quot;math-container&quot;&gt;$dp = 2r\,dr$&lt;/span&gt;. It means that if we ditch &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and substitute &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, we get a density of &lt;span class=&quot;math-container&quot;&gt;$\exp(-p)\, dp$&lt;/span&gt; for the distribution of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion, if we pass from a vector of complex amplitudes in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^d$&lt;/span&gt; to its corresponding real vector of probabilities in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}_{\ge 0}^d$&lt;/span&gt;, then Gaussian measure&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \exp(-|z_1|^2-|z_2|^2- \cdots - |z_d|^2)$$&lt;/span&gt;&#xA;projects to exponential measure&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \exp(-p_1-p_2- \cdots - p_d).$$&lt;/span&gt;&#xA;Thus the algorithm to generate a uniformly random point in the unit sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^d$&lt;/span&gt; matches the algorithm to generate a uniformly random point in the standard simplex in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}_{\ge 0}^d$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-11-10T04:20:33.683" LastActivityDate="2019-11-10T04:20:33.683" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8737" PostTypeId="1" AcceptedAnswerId="8738" CreationDate="2019-11-10T22:27:23.517" Score="1" ViewCount="144" Body="&lt;p&gt;I tried to measure quantum state with a quantum state tomography. However, I encountered a situation when two different quantum states had the same density matrix. In particular, these states were &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle + \frac{1+i}{2}|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1-i}{2}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; Is there any possibility how to distinguish these two states (or any other two states with the same density matrix) with quantum state tomography?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-10T23:59:34.237" Title="How to distinguish two states with same density matrix using a quantum state tomography?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;tomography&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8738" PostTypeId="2" ParentId="8737" CreationDate="2019-11-10T23:54:49.120" Score="3" Body="&lt;p&gt;There isn't. A density matrix encodes all the knowledge available about a state, therefore if two states are described by the same density matrix, they are indistinguishable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ket vectors differing by only a global phase have always the same density matrix, and represent the same physical state.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-10T23:59:34.237" LastActivityDate="2019-11-10T23:59:34.237" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8739" PostTypeId="2" ParentId="8737" CreationDate="2019-11-10T23:57:55.510" Score="5" Body="&lt;p&gt;The question presupposes a misconception that the vector form of a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; exists independently of its density operator form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;, which is often described as secondary.  In reality, the density operator of a state is all that truly exists --- and even then, it only exists as statistical information.  In fact, you can construct quantum mechanics using density operators &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as the primary model of states.  The formalism for this is similar to the Heisenberg picture of quantum mechanics, in which operators evolve over time.  In a Heisenberg-type picture, you don't strictly need Hilbert spaces at all at first, you can define everything with abstract &quot;operators&quot;.  You can introduce a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; later as an algebra representation of all of the operators.  You can also introduce vector states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; later as a simplified formalism for operator states that happen to have the form &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi\rangle\langle\psi|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastActivityDate="2019-11-10T23:57:55.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8740" PostTypeId="2" ParentId="8724" CreationDate="2019-11-11T03:27:53.950" Score="1" Body="&lt;p&gt;Not sure if this answers your question directly, but Docplex, which is IBM's Decision Optimization CPLEX Modeling for Python is capable of generating an Ising hamiltonian from a cost function. Take a look at this qiskit &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/aqua/optimization/docplex.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8707" LastActivityDate="2019-11-11T03:27:53.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8741" PostTypeId="1" CreationDate="2019-11-11T03:35:21.167" Score="5" ViewCount="156" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\def\braket#1#2{\langle#1|#2\rangle}\def\bra#1{\langle#1|}\def\ket#1{|#1\rangle}$&lt;/span&gt; &#xA;In &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;nofollow noreferrer&quot;&gt;MW05&lt;/a&gt; the authors demonstrate so-called &quot;in-place&quot; amplitude amplification for QMA, exhibiting a method for Arthur to amplify his success probability without requiring any increase in the size of Merlin's witness state. Because QMA is a language of classical bitstrings, this in some sense amplification with a classical input and quantum witness. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an analogue of Mariott-Watrous amplification for when the input is quantum? To me it seems like naively pushing it through fails for the following reason:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the classical case, if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the input and &lt;span class=&quot;math-container&quot;&gt;$A(x,\ket{w})$&lt;/span&gt; is the verifier, then Marriott-Watrous amplification relies being able to apply &lt;span class=&quot;math-container&quot;&gt;$A_x := A(x, \cdot)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_x^{\dagger}$&lt;/span&gt; many times. This is fine because even if we modify &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; throughout the course of computing &lt;span class=&quot;math-container&quot;&gt;$A_x$&lt;/span&gt;, we can just prepare a copy in advance so that we always have &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; accessible to us. However, if the input is instead an arbitrary quantum state &lt;span class=&quot;math-container&quot;&gt;$\ket{x}$&lt;/span&gt;, no-cloning forbids us from doing this. As such, we may corrupt &lt;span class=&quot;math-container&quot;&gt;$\ket{x}$&lt;/span&gt; over the course of computation and all bets are off.&lt;/p&gt;&#xA;" OwnerUserId="8758" LastEditorUserId="55" LastEditDate="2020-12-21T09:57:41.330" LastActivityDate="2021-01-13T22:02:32.510" Title="Marriott-Watrous style amplification with a quantum input" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8742" PostTypeId="1" CreationDate="2019-11-11T16:14:40.357" Score="5" ViewCount="325" Body="&lt;p&gt;I was reading the CSS ( Steane Code) from the Nielsen &amp;amp; Chuang book. It asked in Ex. 10.27 to prove that:  suppose &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$[n,k_1]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[n,k_2]$&lt;/span&gt;classical linear codes such that &lt;span class=&quot;math-container&quot;&gt;$C_2\subset C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp$&lt;/span&gt; both correct &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors. Codes defined by &lt;span class=&quot;math-container&quot;&gt;$$|x+C_2\rangle\equiv \dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}|x+y+v\rangle $$&lt;/span&gt; and parametrized by &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; are equivalent to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CSS}(C_1, C_2)$&lt;/span&gt; in the sense that they have the same error-correcting properties. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt for this was let the corrupted state be for the bit flip case: &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}|x+y+v+e_1\rangle$$&lt;/span&gt; now proceeding on the lines of the code &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CSS}(C_1,C_2)$&lt;/span&gt;, I apply the Parity matrix &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt;  for &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt;,  on the ancilla to obtain &lt;span class=&quot;math-container&quot;&gt;$$ \dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}|x+y+v+e_1\rangle|H_1e_1\rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H_1(x+y+v)=0$&lt;/span&gt;. so i get the position of the flipped qubit by inspecting the position where &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; occurs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now for the phase flip case here is my try &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).e_2}|x+y+v\rangle $$&lt;/span&gt; now I apply the Hadamard gate on the qubit to obtain &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{|C_2|2^n}}\sum_z\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).e_2}(-1)^{(x+y+v).z}|z\rangle $$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \dfrac{1}{\sqrt{|C_2|}2^n}\sum_z\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).(e_2+z)}|z\rangle$$&lt;/span&gt;&#xA;Now let &lt;span class=&quot;math-container&quot;&gt;$e_2+z=z'$&lt;/span&gt;, we get &lt;span class=&quot;math-container&quot;&gt;$$ \dfrac{1}{\sqrt{|C_2|2^n}}\sum_z\sum_{y\in C_2}(-1)^{u.y}(-1)^{(x+y+v).z'}|z'+e\rangle$$&lt;/span&gt;, proceeding from here the final step that I got was &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{2^n/|C_2|}}\sum_{z'+u\in C_2^{\perp}}(-1)^{(x+v)z'}|z'+e_2\rangle$$&lt;/span&gt;, Now is this correct, if so how do I proceed, and what should be the answer?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="7460" LastEditDate="2019-11-27T11:59:33.037" LastActivityDate="2019-11-27T11:59:33.037" Title="Nielsen &amp; Chuang Exercise Question on CSS code" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8743" PostTypeId="1" CreationDate="2019-11-11T22:29:19.537" Score="0" ViewCount="34" Body="&lt;p&gt;I'm new to IBM Quantum Experience. When I initially create a circuit using the composer, all is well, but when I save the circuit and open it again, the composer window is blank - no gates or wires. I have tried it under Safari, Chrome, and Firefox on a MacBook Pro running 10.11.6 and on an iPad. I have tried disabling content blockers. Java, JavaScript, and Flash are all updated and enabled.&lt;/p&gt;&#xA;" OwnerUserId="9094" LastActivityDate="2019-11-11T22:29:19.537" Title="IBM Circuit Composer pane is blank" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8744" PostTypeId="1" AcceptedAnswerId="8747" CreationDate="2019-11-12T00:19:46.233" Score="0" ViewCount="54" Body="&lt;p&gt;For example, backend.properties() returns following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'last_update_date': '2019-11-11T07:16:13+00:00',&#xA; 'backend_name': 'ibmq_essex',&#xA; 'general': [],&#xA; 'qubits': ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is the above time UTC or local time(although in Essex it is the same value)?&lt;/p&gt;&#xA;" OwnerUserId="9095" LastEditorUserId="26" LastEditDate="2019-11-16T16:45:10.220" LastActivityDate="2019-11-16T16:45:10.220" Title="What is the time zone for the time returned by backend.properties()?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8745" PostTypeId="2" ParentId="8742" CreationDate="2019-11-12T00:56:35.287" Score="3" Body="&lt;p&gt;I am not following all of the calculations in your post (for one thing because your first displayed equation does not mention &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt;), but I know why the goal of the exercise is true.  In fact it is true for any code at all, not just a CSS code.  If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C} \subseteq \mathcal{H}_\text{qubit}^{\otimes n}$&lt;/span&gt; is any code, then you get an equivalent code &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}'$&lt;/span&gt; if you apply a separate unitary operator to each of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.  After all, the definition of the error properties does not depend on a choice of basis for each for the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits; who is to say whether the code &quot;is&quot; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}'$&lt;/span&gt; before you have chosen qubit bases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case at hand, translation by your vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is equivalent to applying a flip operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in each position &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x_k = 1$&lt;/span&gt;.  So this is just applying independent unitaries (either &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;) for each of the qubits.  In fact you can check the error properties in a particularly explicit way, since &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is a Pauli operator.  Applying &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to the code in some position amounts to replacing the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; errors with &lt;span class=&quot;math-container&quot;&gt;$-Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-Z$&lt;/span&gt; and keeping &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; just itself; you can see this from whether they commute or anti-commute.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a nifty corollary that applies to all additive codes, not just CSS codes.  Namely, an additive code is normally defined by demanding that a set of commuting parity check operators all report the value &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.  However, you get an equivalent code if you use &lt;em&gt;any&lt;/em&gt; mutual eigenspace of the parity check operators.  In fact, if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C} \subseteq \mathcal{H}_\text{qubit}^{\otimes n}$&lt;/span&gt; is an additive code, then the outer Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_\text{qubit}^{\otimes n}$&lt;/span&gt; is partitioned into equivalent codes.&lt;/p&gt;&#xA;" OwnerUserId="8880" LastEditorUserId="8880" LastEditDate="2019-11-12T01:09:17.697" LastActivityDate="2019-11-12T01:09:17.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8746" PostTypeId="2" ParentId="8734" CreationDate="2019-11-12T08:31:30.033" Score="0" Body="&lt;p&gt;I would recommend this paper: &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.03719&lt;/a&gt;. You can find there information on algorithms and how to deal with noise and errors in quantum circuits. Moreover, it can help you to &quot;generate bunch of QASM files&quot; implementing algorithms presented there.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-12T08:31:30.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8747" PostTypeId="2" ParentId="8744" CreationDate="2019-11-12T09:11:44.227" Score="0" Body="&lt;p&gt;The time you are looking at there, &lt;code&gt;last_update_time&lt;/code&gt;, shows when the properties dict was last updated, so you can see whether it is a recent dict or an older one. This is why you are getting the same value for multiple backends.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This time is set &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/blob/4cd1bf1980e79efac4eef07fe6937334c497d7fc/qiskit/providers/ibmq/api/rest/backend.py#L61&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and so it shows the local date and time with the UTC offset, +0:00 in this case. All the times returned for the different properties are in UTC.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2019-11-12T10:10:50.393" LastActivityDate="2019-11-12T10:10:50.393" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8748" PostTypeId="1" CreationDate="2019-11-12T11:45:02.570" Score="3" ViewCount="68" Body="&lt;p&gt;Given a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} \approx \mathbb{C}^{d}$&lt;/span&gt; (i.e. a qudit system) if I have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; identical copies of a mixed state I can use Schur-Weyl duality to decompose the state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho^{\otimes N} = \left( U \rho_0 U^{\dagger} \right)^{\otimes N} = \bigoplus_{\lambda \in \mathcal{Y}_{N,d} } p_{\lambda,N} \left( U^{(\lambda)} \rho_{0,\lambda} U^{(\lambda) \dagger}  \otimes \frac{I_{m_\lambda}}{m_\lambda}  \right)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}_{N,d}$&lt;/span&gt; is the set of Young diagrams with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; boxes and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; rows and &lt;span class=&quot;math-container&quot;&gt;$U^{(\lambda)}$&lt;/span&gt; are irreps of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SU}(d)$&lt;/span&gt;, see, e.g., &lt;a href=&quot;https://arxiv.org/abs/1506.03542&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for an explanation and an application in quantum information.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that it is possible to obtain a closed formula for the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_{\lambda,N}$&lt;/span&gt;, as detailed in &lt;a href=&quot;https://aip.scitation.org/doi/10.1063/1.527958&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, which if I understand correctly should be equivalent to use formulas for group characters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I want to find the irreps &lt;span class=&quot;math-container&quot;&gt;$U^{(\lambda)}$&lt;/span&gt; and the states &lt;span class=&quot;math-container&quot;&gt;$\rho_{0,\lambda}$&lt;/span&gt;. This should be equivalent to finding the so-called &quot;Schur transform&quot;, a task for which a quantum algorithm exists, see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407082&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0601001&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Bacon, Chuang and Harrow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am still in the process of understanding and learning the maths, but in the meantime I am here to ask:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;do you know of any available (classical) implementation of this (even if it's not efficient)? I.e. some algorithm that given &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; gives all the &lt;span class=&quot;math-container&quot;&gt;$U^{(\lambda)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{0,\lambda}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;is there some relevant reference where somebody &lt;strong&gt;explicitly&lt;/strong&gt; computes this Schur-Weyl decomposition for a system that is &lt;strong&gt;not&lt;/strong&gt; qubits (ideally with applications in quantum information)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="350" LastEditorUserId="55" LastEditDate="2020-12-21T09:57:35.710" LastActivityDate="2020-12-21T09:57:35.710" Title="How to construct Schur-Weyl decomposition of independent and identically distributed mixed qudit states?" Tags="&lt;mathematics&gt;&lt;resource-request&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8749" PostTypeId="1" AcceptedAnswerId="8750" CreationDate="2019-11-12T13:34:54.633" Score="4" ViewCount="384" Body="&lt;p&gt;I have the following matrix which I have to translate into Dirac's notations.&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{array}{cccccccc}&#xA; \frac{1}{2} \left(q_0+q_3\right){}^2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_0-q_3\right){}^2 \\&#xA; 0 &amp;amp; \frac{1}{2} \left(q_1+q_2\right) \left(q_0+q_3\right) &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1-q_2\right) \left(q_0-q_3\right) &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1+q_2\right) \left(q_0+q_3\right) &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1-q_2\right) \left(q_0-q_3\right) &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1+q_2\right){}^2 &amp;amp; \frac{1}{2} \left(q_1-q_2\right){}^2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1-q_2\right){}^2 &amp;amp; \frac{1}{2} \left(q_1+q_2\right){}^2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1-q_2\right) \left(q_0-q_3\right) &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1+q_2\right) \left(q_0+q_3\right) &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{1}{2} \left(q_1-q_2\right) \left(q_0-q_3\right) &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_1+q_2\right) \left(q_0+q_3\right) &amp;amp; 0 \\&#xA; \frac{1}{2} \left(q_0-q_3\right){}^2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{2} \left(q_0+q_3\right){}^2 \\&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is diagonal and would be very nice if someone could help me. :)&lt;/p&gt;&#xA;" OwnerUserId="8027" LastEditorUserId="55" LastEditDate="2020-12-21T09:56:54.990" LastActivityDate="2020-12-21T09:56:54.990" Title="Does anyone has some code for Mathematica or Python to convert a diagonal matrix into Dirac (bra-ket) notation?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8750" PostTypeId="2" ParentId="8749" CreationDate="2019-11-12T14:18:00.100" Score="3" Body="&lt;p&gt;Let's define the kets,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ket0 = {{1},{0}};ket1 = {{0},{1}};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function produces input from a string,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;f[x_?StringQ] := ToExpression[StringJoin[&quot;ket&quot;,x]];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function produces the diagonal matrix  corresponding to a string &quot;000&quot;,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;matrixFunc[x_]:= KroneckerProduct@@ f/@ StringPartition[x,1] . &#xA;ConjugateTranspose[KroneckerProduct@@ f/@ StringPartition[x,1] ] ;&#xA;&#xA;matrixFunc[&quot;0001&quot;];&#xA;&#xA;A = RandomReal[1,{8,8}];M (* = INPUT MATRIX*);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This function gives the coefficient corresponding to the string (say) &quot;001&quot;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;overlap[x_?StringQ]:= Tr[matrixFunc[x] .A];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;All possible permutations in lexical (dictionary) order for comparison,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;allkets = StringJoin/@ Tuples[{&quot;0&quot;,&quot;1&quot;},3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9102" LastActivityDate="2019-11-12T14:18:00.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8752" PostTypeId="1" AcceptedAnswerId="8754" CreationDate="2019-11-12T16:44:23.017" Score="1" ViewCount="108" Body="&lt;p&gt;I want to make a 2 qubit circuit such that the non-unitary program will transform the regular basis in the way that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0 0\rangle \to |00\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0 1\rangle \to |01\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle \to |01\rangle$&lt;/span&gt; (the only one that affected)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle \to |11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way I think of doing it, is after measuring the circuit I will change the classical outcomes so it will fit the transformation, for example in the classic way I would code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if c[0]==1 &amp;amp; c[1]==0&#xA;       c[0]==0&#xA;       c[1]==1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I didn&lt;span class=&quot;math-container&quot;&gt;`&lt;/span&gt;t find a way to write it in Qiskit language, please help.&lt;/p&gt;&#xA;" OwnerUserId="4524" LastEditorUserId="26" LastEditDate="2019-11-17T06:03:22.830" LastActivityDate="2019-11-17T06:03:22.830" Title="Trying to make irreversable operation in the quantum circuit" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8753" PostTypeId="1" CreationDate="2019-11-12T17:54:30.923" Score="2" ViewCount="52" Body="&lt;p&gt;We know that the symbol of a quantum gate like &quot;x gate&quot;, &quot;z gate&quot; is an abstraction notation.&#xA;For example, the Not-gate in classical computer is composed of 2 transistors.&#xA;How can we know quantum gate's exact circuit implementation?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2019-11-12T17:54:30.923" Title="What is quantum gate's correponding circuit implementation?" Tags="&lt;quantum-gate&gt;&lt;random-quantum-circuit&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2019-11-12T23:09:07.243" ContentLicense="CC BY-SA 4.0" />
  <row Id="8754" PostTypeId="2" ParentId="8752" CreationDate="2019-11-12T19:15:05.130" Score="3" Body="&lt;p&gt;I tried to implement your transformation on IBM Q. Here is the result:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7BbWF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7BbWF.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Input is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; in this case. You can set input values by application of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates on q-bits &lt;span class=&quot;math-container&quot;&gt;$|q0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that this circuit run on a simulator only as reset gate has not been implemented on real IBM Q quantum hardware. But it is possible to simply measure &lt;span class=&quot;math-container&quot;&gt;$|q2\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q3\rangle$&lt;/span&gt;. In that case your transformation become reversible.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-12T19:15:05.130" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8755" PostTypeId="2" ParentId="8720" CreationDate="2019-11-13T13:42:32.510" Score="2" Body="&lt;p&gt;If you're just trying to figure out which specific versions a released version of qiskit works with we document that in the trove classifiers in the package metadata for that release, see: &lt;a href=&quot;https://pypi.org/project/qiskit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pypi.org/project/qiskit/&lt;/a&gt; on the bottom left under &quot;Programming Language&quot;. The meta-package there and all the individual elements have the same metadata in the package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you're trying to answer the question more generally outside of a specific released package, then Qiskit strives to support all currently supported versions of python. For right now that's &gt;=3.5. It will be &gt;=3.6 in September 2020 when the upstream python community drops support for python 3.5. The problem with python 3.8 right now though is that new version updates do not happen in a vacuum and can't happen instantly. Python 3.8 was released less than 1 month ago and the entire python ecosystem is working to both make sure code is updated to work with the new version (because new python versions are never 100% compatible) and push out releases with binary wheels that support the new version (because all packages with compiled extensions need to be rebuilt for new versions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For qiskit this is also true, there are several patches to add python 3.8 support to multiple elements already &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/3268&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit/qiskit-terra#3268&lt;/a&gt; &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/pull/428&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit/qiskit-aer#428&lt;/a&gt; &lt;a href=&quot;https://github.com/Qiskit/qiskit-ignis/pull/298&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit/qiskit-ignis#298&lt;/a&gt; but until this week we weren't even in a place where we could install all of qiskit's upstream dependencies on python 3.8 (and some are still missing, but it's not blocking testing). The difficulties with python 3.8 right now are just a temporary blip that is happening right now because new release is so recent. Things will likely all be sorted within the next month and won't be a problem again (well at least for another 12-18 months when python 3.9 is released)&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2019-11-13T13:42:32.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8756" PostTypeId="1" CreationDate="2019-11-13T17:09:29.590" Score="3" ViewCount="131" Body="&lt;p&gt;I have been reading about secret sharing schemes, and they regularly come up with a line that says 'that a person upon receiving a state measures the state in one of the basis say the computational basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt; or the Hadamard basis &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle+|1\rangle}{\sqrt{2}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle-|1\rangle}{\sqrt{2}}$&lt;/span&gt;. Now what I don't understand is suppose I have state say &lt;span class=&quot;math-container&quot;&gt;$$\alpha|0\rangle+\beta|1\rangle$$&lt;/span&gt; that I get from someone and that someone will give me the secret when I 'measure' the state in the right Basis.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Now If I chose the standard basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt; what will be the result I will get? If I measure with respect of the projection operator &lt;span class=&quot;math-container&quot;&gt;$\langle 0|$&lt;/span&gt; I get &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and If I measure with respect of the projection operator &lt;span class=&quot;math-container&quot;&gt;$\langle 1|$&lt;/span&gt; I get &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I measure with respect to the Hadamard basis &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle+|1\rangle}{\sqrt{2}}$&lt;/span&gt; I get &lt;span class=&quot;math-container&quot;&gt;$\dfrac{\alpha+\beta}{\sqrt{2}}$&lt;/span&gt;&#xA;and if i measure with respect &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle-|1\rangle}{\sqrt{2}}$&lt;/span&gt; I get  &lt;span class=&quot;math-container&quot;&gt;$\dfrac{\alpha-\beta}{\sqrt{2}}$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;My first question basically means just selecting a Basis wouldn't serve the cause, because the basis themselves involve different projection operators and hence different operators. can somebody explain this concept?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Suppose I have a state &lt;span class=&quot;math-container&quot;&gt;$\omega|0\rangle$&lt;/span&gt; and I measure in the standard basis then I either get a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; depending on the projection operator chosen. So does that mean that &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; has nothing to do with the result?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2019-11-13T18:22:06.490" LastActivityDate="2019-11-13T18:33:51.323" Title="What does &quot;measuring a state&quot; mean?" Tags="&lt;measurement&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8757" PostTypeId="2" ParentId="8756" CreationDate="2019-11-13T18:33:35.137" Score="6" Body="&lt;p&gt;Look like a lot of misunderstanding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure a state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; in computational basis, the state collapses either to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. In Quantum Information we say that we measured state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, or simply we measured &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. There is no chance to know &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; from the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you measure a state in Hadamard basis, the state collapses either to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle =\dfrac{|0\rangle+|1\rangle}{\sqrt{2}}$&lt;/span&gt; or to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \dfrac{|0\rangle-|1\rangle}{\sqrt{2}}$&lt;/span&gt;, and we say we measured either &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-11-13T18:33:35.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8758" PostTypeId="2" ParentId="8756" CreationDate="2019-11-13T18:33:51.323" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Now If I chose the standard basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt; what will be the result I will get? If I measure with respect of the projection operator &lt;span class=&quot;math-container&quot;&gt;$\langle 0|$&lt;/span&gt; I get &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and If I measure with respect of the projection operator &lt;span class=&quot;math-container&quot;&gt;$\langle 1|$&lt;/span&gt; I get &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is wrong.&#xA;First of all, arguably the most natural kind of measurement in QM consists in choosing a basis and having the state collapse in that basis. For example, if you have a single qubit, you can &quot;measure in the computational basis&quot;, which makes the state collapse in either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with some probabilities.&#xA;You can think of measurements as the types of &quot;questions&quot; you can ask to a state. If you ask the system whether it's in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the state will collapse into one of these possibilities. You could instead ask whether the state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle-|1\rangle$&lt;/span&gt;, and that will make the state collapse into of the elements of this other basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you write &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, what you are saying is that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a state which, if you measure it in the computational basis (that is, the basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt;), will be found in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;. If you take many copies of this state and measure it in the computational basis every time, you will get sometimes one result and sometimes the other (unless of course &lt;span class=&quot;math-container&quot;&gt;$\alpha=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\alpha=1$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also worth noting that when I say &quot;&lt;em&gt;you get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&lt;/em&gt;&quot;, what I mean is that you can have two different experimental outcomes, and you associate these two experimental outcomes with the labels &quot;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&quot; and &quot;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&quot;. How this association is made depends on the context and is at least partially a matter of convention. For example, if you are talking about a photon's polarisation, you can decide that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; means &quot;horizontal polarisation&quot; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; means &quot;vertical polarisation&quot;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose I have a state ω|0⟩ and I measure in the standard basis then I either get a 0 or 1 depending on the projection operator chosen. So does that mean that ω has nothing to do with the result?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In the bra-ket formalism, states are defined up to multiplication by complex scalars. This means that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda|\psi\rangle$&lt;/span&gt; represent the same physical state for any &lt;span class=&quot;math-container&quot;&gt;$\lambda\in\mathbb C$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-13T18:33:51.323" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8759" PostTypeId="1" CreationDate="2019-11-13T19:24:20.180" Score="-1" ViewCount="154" Body="&lt;p&gt;I've implemented Grover's search algorithm in qiskit, and I'd like to pass in an input to run through the circuit. How is that done?&lt;/p&gt;&#xA;" OwnerUserId="9113" LastEditorUserId="23" LastEditDate="2019-11-19T22:25:30.800" LastActivityDate="2019-11-19T22:25:30.800" Title="How do you pass input to a circuit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2019-11-19T22:31:26.083" ContentLicense="CC BY-SA 4.0" />
  <row Id="8760" PostTypeId="1" AcceptedAnswerId="8770" CreationDate="2019-11-13T23:07:22.187" Score="3" ViewCount="128" Body="&lt;p&gt;Let's say I have more than one qbits &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|1\rangle$&lt;/span&gt; and I want to perform a &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on both of them. I know the matrix representation for the Hadamard on a single qbit is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I represent the qbits with the vector &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0\end{bmatrix}$$&lt;/span&gt; I think that the representation for a two qbit Hadamard is the tensor &lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt; giving&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0\end{bmatrix} = \frac{1}{2} \begin{bmatrix} 1 \\ -1 \\ 1 \\ -1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which feels correct as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} &#xA;&amp;amp;= \\ \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1 \end{bmatrix} \otimes \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ -1 \end{bmatrix} &#xA;&amp;amp;= \\ \frac{1}{2} \begin{bmatrix} 1 \\ -1 \\ 1 \\ -1 \end{bmatrix}&#xA;\end{align} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But is this actually correct? And how does it (or is it possible to?) generalize to different gate compositions like &lt;span class=&quot;math-container&quot;&gt;$H \otimes CNOT$&lt;/span&gt;? Does it scale to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbits?&lt;/p&gt;&#xA;" OwnerUserId="5289" LastEditorUserId="55" LastEditDate="2019-11-14T18:22:59.420" LastActivityDate="2019-11-14T18:22:59.420" Title="What is the matrix representation for $n$-qubit gates?" Tags="&lt;density-matrix&gt;&lt;matrix-representation&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8761" PostTypeId="2" ParentId="8759" CreationDate="2019-11-14T04:08:11.163" Score="1" Body="&lt;p&gt;It would be helpful to get a code sample, but from how you've phrased the question, the circuit assumes that the register is originally initialized to the &lt;span class=&quot;math-container&quot;&gt;${|00..0\rangle }$&lt;/span&gt; state. You'll need to initialize the register into the uniform superposition of all states, and then your Grover's algorithm should work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*full disclosure - it would be super helpful to have more context in your question. &lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-11-14T04:08:11.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8762" PostTypeId="2" ParentId="8760" CreationDate="2019-11-14T06:16:04.490" Score="2" Body="&lt;p&gt;What you are looking for is &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Kronecker_product&lt;/a&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a column-vector can be considered as a matrix with the size &lt;span class=&quot;math-container&quot;&gt;$n \times 1$&lt;/span&gt;, so the Kronecker product rule also applies.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-11-14T06:16:04.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8763" PostTypeId="1" AcceptedAnswerId="8791" CreationDate="2019-11-14T06:46:24.370" Score="4" ViewCount="64" Body="&lt;p&gt;System 1: This has a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;System 2: This has a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$N'$&lt;/span&gt;, with the condition that &lt;span class=&quot;math-container&quot;&gt;$N' \ll N$&lt;/span&gt;. We want to simulate system 1 using the system 2, and so we use a &quot;nearly orthogonal&quot; basis of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; vectors to &quot;span&quot; the Hilbert space, with the vectors satisfying the following relations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle V_i | V_i \rangle = 1,  \quad |\langle V_i | V_j \rangle| \leq \epsilon \,  \forall \, i \neq j.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is a small number and can be adjusted so as to create the basis of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; vectors in the System 2's space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we know that if we probe these two systems using &lt;span class=&quot;math-container&quot;&gt;$N'$&lt;/span&gt; number of operators then one can easily distinguish between these two systems, e.g. using &lt;span class=&quot;math-container&quot;&gt;$N'$&lt;/span&gt; number of operations. However say if &lt;span class=&quot;math-container&quot;&gt;$N = 10^{23}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N' = 10^5$&lt;/span&gt;, it isn't feasible to use &lt;span class=&quot;math-container&quot;&gt;$10^5$&lt;/span&gt;- point correlation functions. So we look for simpler observables to distinguish between the two systems. Which observable(s) / series of operations can demonstrate whether System 2 has a smaller Hilbert space? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, let's say the system we want to understand is a gas at a temperature &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and is our System 1. What exactly goes wrong if we try to simulate it using a smaller Hilbert space, i.e. System 2? Do laws of thermodynamics hold?&lt;/p&gt;&#xA;" OwnerUserId="2669" LastActivityDate="2019-11-16T07:32:18.840" Title="What goes wrong if I try to simulate a system with a larger Hilbert space with a smaller Hilbert space?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8765" PostTypeId="2" ParentId="8759" CreationDate="2019-11-14T11:09:17.060" Score="1" Body="&lt;p&gt;To give you an example, at the last Qiskit Camp I was part of a team that implemented some Groverian Iterations in an Algorithm which as an input took positions on a complete graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The repository is &lt;a href=&quot;https://github.com/rowanshah/Quantum-Approach-To-Rendezvous-Problem-Using-Qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we want to encode for example two walkers on the graph below, since it has 4 vertices we require 2 qubits to encode the position of each walker. Thus our input will be some state using these 4 qubits.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pFGwD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pFGwD.png&quot; alt=&quot;The setting for the problem.&quot;&gt;&lt;/a&gt;&#xA;In our case we Hadamarded over all the qubits to distribute the walkers over the whole graph evenly before iteration. This you could say was our state preparation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Take Home Message&lt;/strong&gt;&#xA;Think about how to encode your problem in terms of qubits. This will then allow you to think about what your algorithm is going to act on and so what your input will be and what registers you need and so on.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastActivityDate="2019-11-14T11:09:17.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8766" PostTypeId="1" CreationDate="2019-11-14T12:08:04.130" Score="4" ViewCount="138" Body="&lt;p&gt;I am experimenting with concepts in Quantum Computing and I have landed on using entangled Qubits to perform certain actions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is this: is it possible to have (let's say) 3 entangled Qubits in a system. If it is, then how much information is retrievable/usable when only 2 of these Qubits are measured? The application I am thinking of is using 2 of the 3 Qubits for a one-time access code and then the 3rd becomes useless (and almost automatically gets locked out).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realise my mathematics is basic but it is the application I am curious about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="9123" LastEditorUserId="55" LastEditDate="2019-11-14T18:03:19.997" LastActivityDate="2019-11-15T14:02:34.290" Title="Is it possible to have entanglement between more than two qubits?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8767" PostTypeId="1" AcceptedAnswerId="8788" CreationDate="2019-11-14T15:01:29.747" Score="2" ViewCount="124" Body="&lt;p&gt;I am new to the quantum world and it's computing. But it accidentally hit in my mind that DWave built a quantum computer with 2000 qubits which can be use to simulate the whole observable universe or to simulate whole brain for finding what out about consciousness. And the future plan of Dwave is to build a quantum computer with 5000 qubits, which is a lot higher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently Google made a quantum computer and claims to have achieved quantum supremacy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what is the problem with running the experiment, which can solve the centuries-old problem using quantum computer with 2000 qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="9125" LastEditorUserId="55" LastEditDate="2020-12-21T09:56:50.147" LastActivityDate="2020-12-21T09:56:50.147" Title="What is the problem in demonstrating quantum supremacy?" Tags="&lt;physical-qubit&gt;&lt;quantum-advantage&gt;&lt;d-wave&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8768" PostTypeId="2" ParentId="8766" CreationDate="2019-11-14T15:01:41.097" Score="4" Body="&lt;p&gt;Here is a circuit for preparation of state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ydVA1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ydVA1.png&quot; alt=&quot;GHZ state&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here one for state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}(|001\rangle + |010\rangle+ |100\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KA5dr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KA5dr.png&quot; alt=&quot;W state&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2019-11-15T14:02:34.290" LastActivityDate="2019-11-15T14:02:34.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8769" PostTypeId="1" AcceptedAnswerId="8789" CreationDate="2019-11-14T16:37:59.750" Score="4" ViewCount="93" Body="&lt;p&gt;Given that operator &lt;span class=&quot;math-container&quot;&gt;$S_M$&lt;/span&gt;, which consists entirely of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; Pauli operators, is a stabilizer of some graph state &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; i.e. the eigenvalue equation is given as &lt;span class=&quot;math-container&quot;&gt;$S_MG = G$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper &lt;a href=&quot;https://arxiv.org/abs/1908.05047&quot; rel=&quot;nofollow noreferrer&quot;&gt;'Graph States as a Resource for Quantum Metrology'&lt;/a&gt; (page 3) it states that the expectation value is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle S_M \rangle &amp;amp;= \text{Tr}(e^{i\frac{\theta}{2}\sum_{i=0}^{n}X_i}S_M e^{-i\frac{\theta}{2}\sum_{i=0}^{n}X_i}G) \\&#xA; &amp;amp;= \text{Tr}(e^{i \theta \sum_{i=0}^{n}X_i}G).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that they are working in the Heisenberg picture and the above equations imply that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_M e^{-i\frac{\theta}{2}\sum_{i=0}^{n}X_i} = (S_M e^{-i\frac{\theta}{2}\sum_{i=0}^{n}X_i})^{\dagger} = e^{i\frac{\theta}{2}\sum_{i=0}^{n}X_i^\dagger}S_{M}^{\dagger} = e^{i\frac{\theta}{2}\sum_{i=0}^{n}X_i}S_{M},$$&lt;/span&gt;&#xA;but in order to do this I assumed that &lt;span class=&quot;math-container&quot;&gt;$S_M e^{-i\frac{\theta}{2}\sum_{i=0}^{n}X_i}$&lt;/span&gt;&#xA;is Hermitian. We only know that &lt;span class=&quot;math-container&quot;&gt;$S_M$&lt;/span&gt; is Hermitian and unitary (being Pauli operators) and  &lt;span class=&quot;math-container&quot;&gt;$e^{-i\frac{\theta}{2}\sum_{i=0}^{n}X_i}$&lt;/span&gt; is unitary. What am I missing that allows the above simplification?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any help. &lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2020-12-07T11:56:03.120" LastActivityDate="2020-12-07T11:56:03.120" Title="Expectation Value of Stabilizer" Tags="&lt;entanglement&gt;&lt;pauli-gates&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8770" PostTypeId="2" ParentId="8760" CreationDate="2019-11-14T18:22:27.067" Score="2" Body="&lt;p&gt;In general, given two matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; of dimensions &lt;span class=&quot;math-container&quot;&gt;$n_1\times n_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m_1\times m_2$&lt;/span&gt;, respectively, their tensor product &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; can be represented using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker product&lt;/a&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(A\otimes B)_{n_1 m_1,n_2m_2}=A_{n_1,n_2}B_{m_1, m_2}.$$&lt;/span&gt;&#xA;The indices on the left hand side are a standard way to enumerate the integers from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n_1 m_1$&lt;/span&gt; and from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n_2 m_2$&lt;/span&gt;. This is what you already observed in the case of &lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt;, where two &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices become one &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix, whose elements are the product of elements of the two copies of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-14T18:22:27.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8775" PostTypeId="1" CreationDate="2019-11-14T21:40:25.330" Score="3" ViewCount="91" Body="&lt;p&gt;Recently, I saw this article, &lt;a href=&quot;https://arxiv.org/pdf/1905.07047.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical and Quantum Bounded Depth Approximation Algorithms&lt;/a&gt; where the author discusses the limitations of QAOA relative to classical approaches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, they state in the discussion:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;More generally, however, the results here point to a pattern. It seems like the QAOA is simply&#xA;  a way of writing a quantum circuit which does something similar to a very simple classical algorithm: initialize spins&#xA;  in some configuration and then update spins depending on those around it. For a one-step version of the algorithm,&#xA;  the update is usually very simple: if the spins around it apply a strong enough force to the given spin, then it changes&#xA;  in a way to increase the objective function. To the extent that the QAOA works, it seems that it works because&#xA;  the classical algorithm works; &lt;strong&gt;there does not seem to be any general explanation in the literature as to why such a&#xA;  quantum circuit should be better than such a classical algorithm.&lt;/strong&gt;&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Caveat: I'm just coming to understand QAOA. That said, from my reading of the paper, it seems that the 'local' QAOA approaches discussed don't yield better approximation bounds than the comparable classical heuristics. Indeed, the authors appear to indicate that classical approaches may be better in some respects given the additional guarantees they can offer. Of course, QAOA can be applied to multiple optimization problems, so this may not be generalizable. Further, even the global QAOA doesn't appear to do much better – with classical approaches still offering better approximation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, my question is: &lt;strong&gt;Given our current understanding of quantum algorithms and the approaches they enable, can quantum approaches (like QAOA) yield provably better approximation bounds than classical algorithmic approaches on optimization problems?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any specific example of a quantum approach with a known better approximation bound would be great; even better would be a complexity argument demonstrating that a quantum model of computation can enable better approximation than classical models. &lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="26" LastEditDate="2019-11-26T20:04:33.370" LastActivityDate="2019-11-26T20:04:33.370" Title="Quantum algorithms, combinatorial optimization, and approximation bounds" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8776" PostTypeId="1" AcceptedAnswerId="8793" CreationDate="2019-11-14T22:16:50.953" Score="3" ViewCount="537" Body="&lt;p&gt;In finance, a &lt;strong&gt;European call&lt;/strong&gt; gives the buyer the right to buy some underlying asset such as a stock at some pre-determined strike price at a specific expiration date. The &lt;strong&gt;Black-Scholes equation&lt;/strong&gt; is a fairly simple formula that can be easily written in Python for classical computing to value financial derivatives like the call option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the link below, IBM's cross-displinary quantum package for &lt;strong&gt;Python&lt;/strong&gt;, &lt;strong&gt;Qiskit Aqua&lt;/strong&gt;, seems to use qubits to price a European call option instead. Could someone give me a walk-through of what the code is doing line by line and how it compares to a classical Python code for pricing a European call? Are there any theoretical or numerical differences between classical and quantum pricing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/finance/components/uncertainty_problems/european_call_expected_value.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/finance/components/uncertainty_problems/european_call_expected_value.py&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, is there an article being used as the source for the above Python script? My guess is that it's this one, but not sure since I don't yet have a background in matching quantum code with quantum formulas: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&quot;Towards Pricing Financial Derivatives with an IBM Quantum Computer&quot;&lt;/em&gt;&#xA;&lt;a href=&quot;https://arxiv.org/pdf/1904.05803.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1904.05803.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9006" LastEditDate="2020-01-10T14:14:53.620" LastActivityDate="2020-05-04T03:54:28.033" Title="Quantum pricing of financial derivatives (call option) in Qiskit Aqua" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8778" PostTypeId="1" AcceptedAnswerId="8782" CreationDate="2019-11-14T23:18:14.313" Score="2" ViewCount="118" Body="&lt;p&gt;I am starting to see alot of classical quantitative problems such as linear regression being represented in quantum math, which suggests that almost anything based on frequentist statistics could be upgraded to the fancy 'braket' notation found in quantum math, in the same way that Bayesian interpretations of classical math models are currently abundant on the side line.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ignoring the fact that anyone without a Masters in physics does not have the background to grasp or make a career out of quantum programming applied to their own discipline, at least what fundamental tenets, principles and approaches, beyond just the qubit and circuitry theory, would help with the practical translation of existing classical math and Python code to their quantum counterparts? and is there a forseeable demand in this sort of work, assuming that the quantumification of maths and code for some antiquated problem specific to some discipline at least generates a small speed-up over classical formulas and code?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any holistic sources that discuss the impending migration from the classical to quantum paradigm math-wise would be great as well&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="26" LastEditDate="2019-11-16T16:35:02.027" LastActivityDate="2019-11-21T20:01:49.330" Title="Translating classical math and code, to quantum math and code" Tags="&lt;programming&gt;&lt;mathematics&gt;&lt;classical-quantum&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8779" PostTypeId="2" ParentId="8778" CreationDate="2019-11-14T23:59:45.647" Score="3" Body="&lt;p&gt;At least currently, most of the translations being made are in extraordinarily specialized areas - for example, quantum chemistry / computational chemistry. A lot of the math involves mapping domain math to quantum computers - &lt;em&gt;ab initio&lt;/em&gt; molecular simulations need to map their traditional annihilation/creation operators to the X, Y, Z gates in quantum computers (&lt;a href=&quot;https://arxiv.org/abs/1001.3855&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1001.3855&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There likely will be demand for people who are able to effectively create new domain-specific quantum algorithms / apply existing quantum algorithms to solve new problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A big point is that &lt;strong&gt;quantum computers will not be stronger at all operations!&lt;/strong&gt; We will likely not need to mitigate over much common classical code; instead, quantum computers will act as accelerators for specific operations (much like GPUs for graphical operations).&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="26" LastEditDate="2019-11-21T20:01:49.330" LastActivityDate="2019-11-21T20:01:49.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8780" PostTypeId="1" CreationDate="2019-11-15T00:06:10.653" Score="2" ViewCount="52" Body="&lt;p&gt;The &lt;a href=&quot;http://www2.lns.mit.edu/~avinatan/research/matrix.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Harrow-Hassidim-Lloyd (HHL) algorithm&lt;/a&gt; for quantum matrix inversion (linear algebra) bridges classical math to quantum math and has been adopted for quantumizing many classical applications, such as linear regression and deep neural networks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since solving a system of linear equations can alternatively be solved with optimization algorithms to attain an equivalent solution, how has the progress been with developing quantum versions of simple gradient-based and gradient-free algorithms used in classical optimization (e.g. gradient descent, coordinate descent, other gradient-free heuristics)? I've only come across quantum annealing so far. Some explanation of linked research articles or Python code would be nice.&lt;/p&gt;&#xA;" OwnerUserId="9118" LastActivityDate="2019-11-15T00:06:10.653" Title="Quantum Optimization algorithms" Tags="&lt;optimization&gt;&lt;classical-quantum&gt;&lt;semidefinite-programming&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8781" PostTypeId="1" AcceptedAnswerId="8784" CreationDate="2019-11-15T00:48:36.953" Score="3" ViewCount="70" Body="&lt;p&gt;The idea of a qubit being able to exist for several values between 0 and 1 (superposition) makes it sound like it can do alot for probabilistic math problems, but for one task that comes instantly to mind, probabilistic sampling, or random number generation from a target probability distribution, how would the quantum version of doing this be implemented, and where exactly does superposition kick in? For this task, does superposition get its edge due to it capturing the entire distribution all at once somehow? And are other quantum properties like entanglement also being exploited. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides sampling,  the usage of quantum to map and pre-emptively evaluate all possible outcomes for a utility, reward or loss function, for example, all seem to be related somehow, but I still can’t see what role superposition is playing in these sort of probabilistic tasks mathematically, compared to the binary 0 (false/off/no) and 1 (true/on/yes) classical case, which itself doesn’t invoke some correspondence to the task at hand either.&lt;/p&gt;&#xA;" OwnerUserId="9118" LastActivityDate="2019-11-15T04:16:58.733" Title="What does superposition do for quantum probabilistic sampling?" Tags="&lt;mathematics&gt;&lt;superposition&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8782" PostTypeId="2" ParentId="8778" CreationDate="2019-11-15T01:13:45.713" Score="2" Body="&lt;p&gt;Bra-ket notation is not necessarily tied to &quot;quantum math,&quot; it's simply a convenient notation in many circumstances.  It may seem intimidating at first, but once you understand the basics (ket = vector, bra = covector) it's straightforward to grasp, as long as you have a solid understanding of Linear Algebra.  If you are shaky on Linear Algebra, different notation is unlikely to help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum algorithms on the other hand are entirely different.  These involve deep insights that may span several fields (particularly Math, CS and Physics), and I doubt that understanding them is easy for anybody (including physicists).  Anybody from one of these three fields will certainly have a head start, but anyone with a STEM background and sufficient motivation should be able to learn the material.  &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt; cite &quot;mathematical maturity&quot; as the key prerequisite.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once the hardware is available to run meaningful quantum algorithms, I have no doubt that demand will vastly exceed supply of people capable of applying quantum algorithms to domain specific tasks.  There is, however, a fair amount of uncertainty as to when that day will come.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't really know any references that match your request well, but you might find John Preskill's keynote address on &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;nofollow noreferrer&quot;&gt;NISQ era quantum computing&lt;/a&gt; helpful.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2019-11-15T01:13:45.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8783" PostTypeId="1" AcceptedAnswerId="12030" CreationDate="2019-11-15T01:40:37.270" Score="3" ViewCount="80" Body="&lt;p&gt;Are there, any journals out there that have been steadily publishing, or are dedicated to, research on existing or new and innovative quantum &lt;em&gt;algorithms&lt;/em&gt;? Generalist titles are fine, but they can also be field-specific.&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="26" LastEditDate="2019-11-16T15:16:04.937" LastActivityDate="2020-05-15T07:16:23.843" Title="Academic journals dedicated to quantum algorithms" Tags="&lt;resource-request&gt;&lt;research&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8784" PostTypeId="2" ParentId="8781" CreationDate="2019-11-15T04:04:34.130" Score="4" Body="&lt;p&gt;Classical computers are inherently deterministic, so they either generate &lt;a href=&quot;https://en.wikipedia.org/wiki/Pseudorandom_number_generator&quot; rel=&quot;nofollow noreferrer&quot;&gt;pseudorandom numbers&lt;/a&gt;, or use an external physical process with statistically random noise to generate random numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computers are inherently probabilistic, so generating true random numbers is very natural for them.  Quantum random number generators are already on the market (&lt;em&gt;e.g.&lt;/em&gt;, &lt;a href=&quot;https://www.idquantique.com/random-number-generation/overview/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IDQ&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cjMIZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cjMIZ.png&quot; alt=&quot;Quantum_RNG&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;generates 0 or 1 on &lt;span class=&quot;math-container&quot;&gt;$c_0$&lt;/span&gt;, both with probability 0.5.  Using &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; quantum and classical registers configured identical to those above would randomly generate a number between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the circuit above, the Hadamard gate (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;) transforms the qubit from a known state &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; to a superposition of states described by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H \vert 0 \rangle = \frac{\vert 0 \rangle + \vert 1 \rangle}{\sqrt{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the Hadamard gate was removed, &lt;em&gt;i.e.&lt;/em&gt; no superposition, there would be no randomness in the output since the measurement would read &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; every time (apart from noise).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More complicated circuits can be built to do more interesting sampling tasks, but I'm not sure what you are looking for specifically.  This &lt;a href=&quot;http://www.mit.edu/~aram/talks/10-NEC-sample-print.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;talk&lt;/a&gt; goes into more detail on the subject.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are new to quantum computing, you might need to work through a good textbook on the subject (the standard text is &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielson and Chuang&lt;/a&gt;) before any of this will make much sense.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-11-15T04:16:58.733" LastActivityDate="2019-11-15T04:16:58.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8785" PostTypeId="2" ParentId="4179" CreationDate="2019-11-15T06:21:57.917" Score="0" Body="&lt;p&gt;We can physically realise Quantum Randomness using Quantum Random Number Generators which harness quantum randomness through various processes such as boson sampling. When you look at a physical implementation of Quantum Randomness from Quantum Circuits, Hadamard transforms on Qubits would be an interesting approach. In addition, we can try techniques such as Bernoulli Trials or Quantum Oracles for realising Quantum Randomness from deterministic quantum circuits. Random Sampling of deterministic circuit is a recommended approach in this regard. Please find an interesting research concept note in this area.&#xA;&lt;a href=&quot;http://www.hri.res.in/~iwqi12/iwqi12_talks/Poster_Akshata.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.hri.res.in/~iwqi12/iwqi12_talks/Poster_Akshata.pdf&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2019-11-15T06:21:57.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8786" PostTypeId="1" CreationDate="2019-11-15T06:24:48.153" Score="-3" ViewCount="99" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0vhWK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0vhWK.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I have 150 or more credits?&#xA;I mean I want to have '150/150 credits'.&lt;/p&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="26" LastEditDate="2019-11-16T15:00:54.640" LastActivityDate="2019-11-16T15:00:54.640" Title="How to get more credits?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2019-11-16T15:00:28.127" ContentLicense="CC BY-SA 4.0" />
  <row Id="8787" PostTypeId="1" CreationDate="2019-11-15T06:32:47.460" Score="2" ViewCount="44" Body="&lt;p&gt;I'm John and I have a question which I have been thinking about. I'm studying quantum information, especially, quantum error-correcting codes. When I learned some types of quantum codes (e.g. 5 qubits code or quantum Hamming code), I thought the following condition is also a necessary condition for quantum codes, but I have no idea to prove it. Could anyone prove it although it might be false?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathbb{P}=\{P_1,...,P_n\}$&lt;/span&gt; be a projection measurement, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits codeword and &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; a unitary operator which represents an error (&lt;span class=&quot;math-container&quot;&gt;$i=1,...,m$&lt;/span&gt;:position of error). Then, the condition is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\forall k_1,k_2\in \{1,...,n\}, \forall i\in \{1,...,m\},\mathrm{Tr}(P_{k_1}U_i\rho U_i^\dagger)\neq 0 \land \mathrm{Tr}(P_{k_2}U_i\rho U_i^\dagger)\neq 0\\ \Rightarrow \frac{P_{k_1}U_i\rho U_i^\dagger P_{k_1}}{\mathrm{Tr}(P_{k_1}U_i\rho U_i^\dagger)}=\frac{P_{k_2}U_i\rho U_i^\dagger P_{k_2}}{\mathrm{Tr}(P_{k_2}U_i\rho U_i^\dagger)}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9136" LastEditorUserId="55" LastEditDate="2020-12-07T11:55:59.130" LastActivityDate="2020-12-07T11:55:59.130" Title="About a necessary condition for quantum error correcting codes" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8788" PostTypeId="2" ParentId="8767" CreationDate="2019-11-15T06:44:38.027" Score="3" Body="&lt;p&gt;D-Wave's 2000Q is a quantum annealer, not a circuit-based quantum computer like Google's Sycamore.  The qubits in D-Wave's system are much noisier, less controlled and perform a fundamentally different type of computation compared to Google and IBM's circuit-based quantum computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave's current system cannot simulate the observable universe or the human brain.  What led you to believe this?  Despite the large number of qubits, noise and lack of control prevent their present system from any hope of demonstrating quantum supremacy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to John Preskill (&lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...as of now we don't have a convincing theoretical argument or&#xA;  persuasive experimental evidence indicating that quantum annealers can&#xA;  really speed up the time to solution compared to the best classical&#xA;  hardware running the best algorithms for the same problems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2019-11-15T06:44:38.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8789" PostTypeId="2" ParentId="8769" CreationDate="2019-11-15T07:18:26.113" Score="1" Body="&lt;p&gt;The way that I approach the calculation is quite different. I think of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\frac{\theta}{2}\sum_n X_i}=\prod_ne^{i\frac{\theta}{2}X_i}.&#xA;$$&lt;/span&gt;&#xA;So, this means that you can consider the term&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\frac{\theta}{2}\sum_n X_i}S_Me^{-i\frac{\theta}{2}\sum_n X_i}&#xA;$$&lt;/span&gt;&#xA;on a qubit-by-qubit basis. You'll have terms like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\frac{\theta}{2}X}Ze^{-i\frac{\theta}{2}X},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; might be replaced by &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; (doesn't make any difference to the forthcoming analysis). Recall that &lt;span class=&quot;math-container&quot;&gt;$e^{i\frac{\theta}{2}X}=\cos\frac{\theta}{2} I+i\sin\frac{\theta}{2} X$&lt;/span&gt;. This lets us use the anti-commutation of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z(\cos\frac{\theta}{2} I-i\sin\frac{\theta}{2} X)=(\cos\frac{\theta}{2} I+i\sin\frac{\theta}{2} X)Z.&#xA;$$&lt;/span&gt;&#xA;This means that our per-qubit term has become&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\frac{\theta}{2}X}Ze^{-i\frac{\theta}{2}X}=e^{i\frac{\theta}{2}X}e^{i\frac{\theta}{2}X}Z=e^{i\theta X}Z.&#xA;$$&lt;/span&gt;&#xA;So, overall we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\left(e^{i\theta\sum_n X_i}S_MG\right),&#xA;$$&lt;/span&gt;&#xA;at which point we just use that &lt;span class=&quot;math-container&quot;&gt;$S_MG=G$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-15T07:18:26.113" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8790" PostTypeId="2" ParentId="8787" CreationDate="2019-11-15T07:30:47.080" Score="1" Body="&lt;p&gt;I don't believe that this is true (at least without further qualifiers). If I'm correctly understanding what you're trying to convey, I think we can essentially simplify this statement to asking whether there can exists a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and two projectors &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$P_1|\psi\rangle\neq P_2|\psi\rangle$$&lt;/span&gt; (ignoring normalisation for simplicity). If so, your statement is false.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; be a state that is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Then we can choose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_1=\frac{1}{2}(|\psi\rangle+|\phi\rangle)(\langle\psi|+\langle\phi|),\qquad P_2=\frac{1}{2}(|\psi\rangle-|\phi\rangle)(\langle\psi|-\langle\phi|)&#xA;$$&lt;/span&gt;&#xA;Now if you want to start imposing specific properties of syndrome measurements for error correcting codes, that might be a different story... (even then, you might want to distinguish between non-degenerate codes and degenerate codes. Without much thought, I &lt;em&gt;guess&lt;/em&gt; your statement is true for syndrome measurements on a non-degenerate code).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-15T07:30:47.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8791" PostTypeId="2" ParentId="8763" CreationDate="2019-11-15T08:02:56.613" Score="4" Body="&lt;p&gt;This is a neat idea. However, having individual overlaps being small isn't sufficient in a quantum system. For example, imagine the set of overlaps&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle V_1|V_N\rangle=0,\qquad \langle V_1|V_n\rangle=\langle V_N|V_n\rangle=\epsilon \quad \forall n=2,\ldots,N-1, \langle V_n|V_m\rangle=0 \quad \forall n,m=2,\ldots,N-2&#xA;$$&lt;/span&gt;&#xA;Remember that these are supposed to be simulating orthogonal states, so starting from &lt;span class=&quot;math-container&quot;&gt;$|V_1\rangle$&lt;/span&gt;, you should never be able to get to &lt;span class=&quot;math-container&quot;&gt;$|V_N\rangle$&lt;/span&gt;. Now consider the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{n=2}^{N-1}|V_n\rangle\langle V_n|,&#xA;$$&lt;/span&gt;&#xA;evolving the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iHt}|V_1\rangle.&#xA;$$&lt;/span&gt;&#xA;The evolution occurs in a 3-dimensional subspace spanned by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|V_1\rangle, |\Psi\rangle=\frac{1}{\sqrt{N-2}}P\sum_{n=2}^{N-2}|V_n\rangle, |V_N\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; represents the projection onto the subspace orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|V_1\rangle,|V_N\rangle$&lt;/span&gt; and normalisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$\langle \Psi|H|V_1\rangle=\langle \Psi|H|V_N\rangle\sim\epsilon\sqrt{N}$&lt;/span&gt; (I'm not calculating this carefully here), and we can calculate other similar terms so that the Hamiltonian in this 3-dimensional subspace becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\approx\left(\begin{array}{ccc}&#xA;N\epsilon^2 &amp;amp; \sqrt{N}\epsilon &amp;amp; N\epsilon^2 \\&#xA;\sqrt{N}\epsilon &amp;amp; 1 &amp;amp; \sqrt{N}\epsilon \\&#xA;N\epsilon^2 &amp;amp; \sqrt{N}\epsilon &amp;amp; \sqrt{N}\epsilon&#xA;\end{array}\right),&#xA;$$&lt;/span&gt;&#xA;where the matrix it's supposed to be simulating is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{ccc} 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;For large &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, these are &lt;strong&gt;very&lt;/strong&gt; different. For example, the first matrix can almost perfectly transfer the state &lt;span class=&quot;math-container&quot;&gt;$|V_1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|V_N\rangle$&lt;/span&gt; in time &lt;span class=&quot;math-container&quot;&gt;$\pi/(1+2N\epsilon^2)$&lt;/span&gt;, and this is something you could easily measure for reasonable choices of, say &lt;span class=&quot;math-container&quot;&gt;$|V_1\rangle=|0\rangle^{\otimes N'}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|V_N\rangle=|1\rangle^{\otimes N'}$&lt;/span&gt; because to detect that the state is no longer in &lt;span class=&quot;math-container&quot;&gt;$|V_1\rangle$&lt;/span&gt;, it would be sufficient to perform a simple magnetisation measurement, or similar.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-11-16T07:32:18.840" LastActivityDate="2019-11-16T07:32:18.840" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8792" PostTypeId="2" ParentId="8786" CreationDate="2019-11-15T08:21:56.357" Score="2" Body="&lt;p&gt;The point of the credits system is to make access to the devices fair so that everyone can take a turn at using them. You cannot get that number of credits as it would mean you could add a lot of jobs to the queue, slowing down response times for everyone else. I don't think there is any simple way to increase the number of credits you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest running jobs on the simulator if you need to run that many credits worth of jobs, as simulator jobs don't use up any credits.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-15T08:21:56.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8793" PostTypeId="2" ParentId="8776" CreationDate="2019-11-15T08:27:12.587" Score="2" Body="&lt;p&gt;There are tutorials for a lot of the Qiskit Aqua functions kept in the tutorials repository, and I think &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/4e76af1f26af57f3a1112318e5c611c52cf960de/qiskit/advanced/aqua/finance/simulation/european_call_option_pricing.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; talks about the finance problem you are interested in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of these tutorials are also available on the &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt; where you can run them in a browser.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-15T08:27:12.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8794" PostTypeId="1" CreationDate="2019-11-15T10:32:58.230" Score="4" ViewCount="409" Body="&lt;p&gt;I understand that the partial trace is a linear map, a completely positive map and a trace-preserving map. However, I have no idea how to define a quantum channel with the partial trace because partial trace depends on an index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;(i.e. &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_i(\rho)$&lt;/span&gt;). Intuitively, the index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is random, but then I don't know how to define a map that represents the partial trace. Could anyone teach me the definition of a quantum channel using the partial trace?&lt;/p&gt;&#xA;" OwnerUserId="9136" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:45.500" LastActivityDate="2021-05-17T09:08:51.360" Title="How to define a quantum channel for the partial trace?" Tags="&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8795" PostTypeId="2" ParentId="8794" CreationDate="2019-11-15T11:23:04.627" Score="5" Body="&lt;p&gt;The first and foremost thing to realize is that the partial trace over a density matrix is indeed a linear CPTP map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;, but it is not a map from any &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}^{n\times n} \rightarrow \mathcal{C}^{n\times n}$&lt;/span&gt; (i.e. to `itself' - the same dimension), but rather to a density operator space with a lower dimension: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}^{n\times n} \rightarrow \mathcal{C}^{m\times m}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m &amp;lt; n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For this reason, some of the common representations are not really usable; representations of a map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; like the Choi matrix or the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-matrix are often only used for maps that preserve the dimension.&lt;/p&gt;&#xA;&lt;p&gt;However, if you are familiar with Kraus operators, they do offer a very straightforward representation. A partial trace over some index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; can be seen as the following operation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;tr_{i} \big[\rho\big] = \sum_{j} \Big(I^{\otimes i-1}\otimes \langle{j}|\otimes I^{\otimes n-i}\Big) \rho \Big(I^{\otimes i-1}\otimes |{j}\rangle\otimes I^{\otimes n-i}\Big)&#xA;\end{equation}&lt;/span&gt;&#xA;That is, if I want to trace out the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th qubit of some system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits described by &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, I sum over an entire basis &lt;span class=&quot;math-container&quot;&gt;$\{|j\rangle \}$&lt;/span&gt; on that qubit, and I do nothing (i.e. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, the identity operator) on all other &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;This representation allows us to obtain a straightforward Kraus representation of the map:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;A_{j} = I^{\otimes i-1}\otimes \langle{j}|\otimes I^{\otimes n-i},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is an operation that acts trivially on the first &lt;span class=&quot;math-container&quot;&gt;$i-1$&lt;/span&gt; qubits and last &lt;span class=&quot;math-container&quot;&gt;$n-i$&lt;/span&gt; qubits, and only acts nontrivially on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th qubit. Note that the Kraus operator is not square, which reflects the fact that the linear map is from a space of higher dimension to a space of lower dimension.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, note that we are free to choose what basis we use for &lt;span class=&quot;math-container&quot;&gt;$\{|j\rangle \}$&lt;/span&gt;; the computational basis is often used. This reflects the fact that a set of Kraus operators for a map is not unique.&lt;/p&gt;&#xA;&lt;p&gt;Generalization to tracing out more qubits is easily done by either applying the single-qubit trace in succession, or by replacing the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operator of the specific qubit by a ket state as well - an important thing to notice here is that one needs to sum over the entire basis of the combined qubits that are being traced out. (That means that to trace out &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits there are &lt;span class=&quot;math-container&quot;&gt;$2^{k}$&lt;/span&gt; Kraus operators associated with that map.)&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-11-24T22:02:20.133" LastActivityDate="2020-11-24T22:02:20.133" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8797" PostTypeId="1" AcceptedAnswerId="8798" CreationDate="2019-11-15T13:14:18.673" Score="3" ViewCount="155" Body="&lt;p&gt;The problem of quantum simulation can be formulated as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Given a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; ( &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; hermitian matrix acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits), a time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; and maximum simulation error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, the goal is to find an algorithm that approximates &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$ || U - e^{-iHt}|| \leq \epsilon $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$ e^{-iHt}$&lt;/span&gt; is the ideal evolution and &lt;span class=&quot;math-container&quot;&gt;$|| \cdot ||$&lt;/span&gt; is the spectral norm.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was wondering, how can you compare the result of your algorithm with an &lt;strong&gt;ideal evolution&lt;/strong&gt;? It would make sense, if this ideal evolution could be calculated analytically, but I think it's rarely the case. This &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; could be also given by an oracle, but in a real world scenario we just cannot use such an approach. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how can you actually compare the result of your approach with something, that cannot be efficiently obtained (in fact, if it could be obtained efficiently, then the whole idea of designing other algorithm to approximate this result doesn't make sense anymore).&lt;/p&gt;&#xA;" OwnerUserId="2098" LastActivityDate="2019-11-15T14:58:50.370" Title="How is the precision of a quantum simulation algorithm actually proved?" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8798" PostTypeId="2" ParentId="8797" CreationDate="2019-11-15T14:58:50.370" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;how can you compare the result of your algorithm with an ideal evolution?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You cannot and you do not need to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you said, computing &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; is intractable for most of the interesting cases. If it was not, chemistry simulations would be easy, solving the Schrödinger equation too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The thing you can do though is to prove that your algorithm will, for a (potentially restricted) set of Hamiltonians, output a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that satisfy the condition &lt;span class=&quot;math-container&quot;&gt;$||U - e^{-iHt}|| \leqslant \epsilon$&lt;/span&gt;. You do not compare the output of your algorithm with the ideal evolution, you prove that your algorithm is guaranteed to return a result that satisfy the condition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are more familiar with computer science, these are &lt;a href=&quot;https://en.wikipedia.org/wiki/Precondition&quot; rel=&quot;nofollow noreferrer&quot;&gt;pre&lt;/a&gt;/&lt;a href=&quot;https://en.wikipedia.org/wiki/Postcondition&quot; rel=&quot;nofollow noreferrer&quot;&gt;post&lt;/a&gt;-conditions. &#xA;Applied to the definition of Hamiltonian simulation you gave:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pre-conditions are:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The matrix given should be Hermitian.&lt;/li&gt;&#xA;&lt;li&gt;The matrix given should be of size &lt;span class=&quot;math-container&quot;&gt;$\left( 2^n, 2^n \right)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n \in \mathbb{N}^*$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$t \in \mathbb{R}$&lt;/span&gt; (note that I did not excluded negative times, it might be an error from my side).&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\epsilon \in \mathbb{R}^*_+$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;li&gt;Post-conditions are:&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a quantum circuit composed of quantum gates.&lt;/li&gt;&#xA;&lt;li&gt;The unitary matrix &quot;implemented&quot; by &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; satisfy &lt;span class=&quot;math-container&quot;&gt;$||U - e^{-iHt}|| \leqslant \epsilon$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any algorithm that solve the Hamiltonian Simulation problem should, &lt;strong&gt;when the pre-conditions are checked&lt;/strong&gt; (i.e. the user gave correct inputs), return a result that verify the post-conditions above.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-11-15T14:58:50.370" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8799" PostTypeId="1" AcceptedAnswerId="9661" CreationDate="2019-11-15T15:48:38.707" Score="1" ViewCount="154" Body="&lt;p&gt;In Nielsen and Chuang Quantum Computation and Quantum Information book section 1.5.1 describing the Stern-Garlach experiment, it says: &quot;Hydrogen atoms contain a proton and an orbiting electron. You can think of this electron as a little 'electric current' around the proton. This electric current causes the atom to have a magnetic field;&quot; I thought the view of an electron orbiting the nucleus is outdated, replaced by the model of a probabilistic cloud around the nucleus in modern quantum physics view.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anyone help me to understand the relationship between the two views today? (I majored in computer science, without much formal education in modern physics.) Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="26" LastEditDate="2019-11-16T14:53:13.307" LastActivityDate="2020-01-26T19:14:55.927" Title="Atom magnetic moment caused by orbiting electron" Tags="&lt;physical-qubit&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8800" PostTypeId="1" AcceptedAnswerId="8801" CreationDate="2019-11-15T16:25:21.660" Score="0" ViewCount="1262" Body="&lt;p&gt;When I try to install Qiskit using Pip install Qiskit I get the error as shown in the attached snapshot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help will be highly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LdpmD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LdpmD.png&quot; alt=&quot;Qiskit install error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9141" LastEditorUserId="26" LastEditDate="2019-11-16T14:51:18.840" LastActivityDate="2019-11-16T14:51:18.840" Title="Problem in installing Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8801" PostTypeId="2" ParentId="8800" CreationDate="2019-11-15T18:45:05.770" Score="1" Body="&lt;p&gt;This issue is within the &lt;code&gt;pyscf&lt;/code&gt; package that is required by qiskit. It says &lt;a href=&quot;https://sunqm.github.io/pyscf/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; that this error may occur with certain versions of python, and I have seen it commonly coming up with python 3.8. There are some workarounds in that link, but if you have nothing forcing you to use python 3.8, I would suggest downgrading to the next newest version before that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been running on python 3.7.5 (which you should be able to install by simply specifying &lt;code&gt;python=3.7&lt;/code&gt; when creating a new anaconda environment) and I do not see this error.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-11-15T18:45:05.770" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8802" PostTypeId="1" AcceptedAnswerId="8803" CreationDate="2019-11-15T19:28:58.137" Score="1" ViewCount="47" Body="&lt;p&gt;Suppose you had an &quot;analog&quot; quantum computer, where a register would store a wavefunction &lt;span class=&quot;math-container&quot;&gt;$\psi(x)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a continuous variable (with &lt;span class=&quot;math-container&quot;&gt;$0\leq x\leq 1$&lt;/span&gt;, say). Instead of gates, you would somehow apply unitary operators to the wavefunction. In this context, it seems to me that the QFT would essentially be equivalent to changing to the momentum basis, &lt;span class=&quot;math-container&quot;&gt;$\psi(k)$&lt;/span&gt;. This could be done by using a different physical apparatus to measure the state of the register, and wouldn't require the actual application of any unitary operators to the wavefunction. Could there be a similar result for a qubit register which could be measured in two different non-commuting bases? If not, why?&lt;/p&gt;&#xA;" OwnerUserId="9144" LastActivityDate="2019-11-15T21:40:13.787" Title="Can a QFT be implemented as a physical change of the measurement basis?" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8803" PostTypeId="2" ParentId="8802" CreationDate="2019-11-15T21:40:13.787" Score="2" Body="&lt;p&gt;Yes, you can in principle do any measurement as a direct physical operation. The real obstacle is to come up with a way of actually doing it in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basis states of QFT-ish measurement span every qubit in the register. This means that whatever physical mechanism you are using must be merging together information as large as the register. But physics is local, and your measurement is not, implying you need to build up your big information-merging measurement out of many local interactions. That set of local interactions will probably be isomorphic to quantum gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, you can do a QFT-ish measurement on photons by putting a diffraction grating between them and the detectors... but isn't putting down the grating just a ultimately roundabout way of applying a gate before measuring?&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-11-15T21:40:13.787" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8804" PostTypeId="1" AcceptedAnswerId="8805" CreationDate="2019-11-15T22:39:25.447" Score="3" ViewCount="242" Body="&lt;p&gt;I have seen two similar proofs of the no-cloning theorem. They assume (to the contrary) that there exists a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U |\psi\rangle |0 \rangle = | \psi \rangle | \psi \rangle$&lt;/span&gt;, For any possible &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. The proof does not seem to rule out the case that there exists a specific &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that can clone only the specific state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt;. Discussion of the no-cloning theorem implies that there cannot be a specific &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, which can only clone a certain state, even when the proof only proves that there cannot be a general &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; which can clone any state. Is there a proof of this specific case somewhere? Or maybe I am missing something from the original proof. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I am referencing the one in Nielsen and Chuang which ends with the contradicition that &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | \phi \rangle = \langle \psi | \phi \rangle^2$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="9149" LastEditorUserId="9149" LastEditDate="2019-11-20T04:48:42.763" LastActivityDate="2019-11-20T04:48:42.763" Title="Premise of the proof of the No-Cloning Theorem" Tags="&lt;nielsen-and-chuang&gt;&lt;no-cloning-theorem&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8805" PostTypeId="2" ParentId="8804" CreationDate="2019-11-15T22:47:02.560" Score="7" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;The proof does not seem to rule out the case that there exists a specific U that can clone only the specific state |ψ⟩.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's because you &lt;em&gt;can&lt;/em&gt; clone specific states. Cloning is only impossible if the set of possible input states includes a pair of states that are not orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is a circuit that performs &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩ \to |\psi⟩|\psi⟩$&lt;/span&gt; as long as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is promised to be exactly &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or exactly &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and never anything else:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ID8QP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ID8QP.png&quot; alt=&quot;just a cnot&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="26" LastEditDate="2019-11-16T14:44:45.150" LastActivityDate="2019-11-16T14:44:45.150" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8806" PostTypeId="2" ParentId="8799" CreationDate="2019-11-16T09:13:31.120" Score="0" Body="&lt;p&gt;Yes. It is outdated, however, to explain something without sounding too abstract the old stationary orbiting solutions come handy. &lt;/p&gt;&#xA;" OwnerUserId="9070" LastActivityDate="2019-11-16T09:13:31.120" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8807" PostTypeId="2" ParentId="8804" CreationDate="2019-11-16T09:20:38.637" Score="0" Body="&lt;p&gt;The real missing keyword in the stating the theorem is &quot;arbitrary unknown state&quot;! If you have some information about &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, i.e. specific state, then perhaps you can reconstruct that state!&lt;/p&gt;&#xA;" OwnerUserId="9070" LastEditorUserId="26" LastEditDate="2019-11-16T14:45:05.303" LastActivityDate="2019-11-16T14:45:05.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8808" PostTypeId="1" CreationDate="2019-11-16T10:06:45.163" Score="3" ViewCount="401" Body="&lt;p&gt;Given two sets of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; uniformly random binary bitstrings of size &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, such as &lt;span class=&quot;math-container&quot;&gt;$$(x_0,x_1,...,x_m) \space \forall x_i \in \{0,1\}.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One generated from a quantum device and the other generated by random uniform in Python. Knowing that quantum is really random and classical is pseudo-random, is there any statistical test to distinguish which one is classical and which one quantum?&lt;/p&gt;&#xA;" OwnerUserId="9070" LastEditorUserId="26" LastEditDate="2019-11-16T14:41:59.447" LastActivityDate="2019-11-19T09:35:41.813" Title="How to distinguish quantum random from classical random?" Tags="&lt;quantum-state&gt;&lt;quantum-advantage&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8809" PostTypeId="2" ParentId="8808" CreationDate="2019-11-16T11:40:12.560" Score="2" Body="&lt;p&gt;Depends on what pseudorandom generator Python is using; if the pseudorandom generator is cryptographically secure, then it is computationally impossible to distinguish whether a bit string is generated by the pseudorandom generator or is truly random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, &quot;truly random&quot; quantum generator may fail classical randomness tests, because real-world quantum random number generation does not automatically guaranty uniformity (and requires some randomness extractor, quantum or classical, to make the output bit string computationally indistinguishable from uniform).&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-11-16T11:40:12.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8810" PostTypeId="1" CreationDate="2019-11-16T17:08:47.633" Score="2" ViewCount="29" Body="&lt;p&gt;I have to test a simulator with a high number of random stabilizer circuits. &#xA;One way to create random stabilizer circuits is to generate random graph states and convert those to circuits, this, however, will always yield optimized circuits (in particular the entanglement gates will be optimized).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a systematical way to generate randomized unoptimized stabilizer circuits? Can this algorithm take the starting state into account i.e. if the simulation will always start from &lt;span class=&quot;math-container&quot;&gt;$$|+\rangle = \left(\bigotimes\limits_{i=0}^{n-1} H_i \right)|0\rangle \ ?$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="9157" LastEditorUserId="26" LastEditDate="2019-11-16T17:25:08.233" LastActivityDate="2019-11-16T17:25:08.233" Title="How to randomly generate unoptimized stabilizer circuits?" Tags="&lt;stabilizer-code&gt;&lt;random-quantum-circuit&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8811" PostTypeId="1" CreationDate="2019-11-16T17:09:06.220" Score="2" ViewCount="62" Body="&lt;p&gt;I've been meaning to implement Grover's Algorithm for the 3-bit case, wherein I need to implement a CCCNOT gate. How can this be done efficiently (i.e. as few Toffoli and/or CNOT as possible)? &lt;/p&gt;&#xA;" OwnerUserId="9156" LastActivityDate="2019-11-16T17:09:06.220" Title="How would one implement a 4-qubit CCCNOT gate (equivalent to controlled-Toffoli)?" Tags="&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2019-11-19T20:47:02.703" ContentLicense="CC BY-SA 4.0" />
  <row Id="8812" PostTypeId="2" ParentId="8808" CreationDate="2019-11-16T18:34:37.453" Score="2" Body="&lt;p&gt;The idea behind pseudo-random number generators is to generate random numbers using the software, which is convenient and cost-effective. The pseudo-random number generators are one-way functions so if you know the seed you can predict their subsequent values but you cannot determine the sequence of values if you do not know the seed. Quantum randomness is physical randomness or the so-called true randomness. Mathematically, they both have the same statistical properties; provided large number of values are sampled from both of them. Thus, a well designed pseudo-random number generator would be as random as Physical (True) Quantum random number generators, so if you do not know the seed, you will not be able to distinguish them. The advantage of Physical (True) Quantum random number generators is that you cannot guess their values in any case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the pseudo-random number generator is not well designed then you can identify patterns in it like the infamous RANDU routine (&lt;a href=&quot;https://en.wikipedia.org/wiki/Randomness_tests&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Randomness_tests&lt;/a&gt;), which fails randomness tests.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice, physical source of randomness is often XORed with pseudo-random numbers to pass the randomness test. You may refer to &lt;a href=&quot;https://en.wikipedia.org/wiki/Random_number_generation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Random_number_generation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8120" LastActivityDate="2019-11-16T18:34:37.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8814" PostTypeId="1" AcceptedAnswerId="8815" CreationDate="2019-11-17T00:10:18.633" Score="5" ViewCount="290" Body="&lt;p&gt;In Nielsen and Chuang Quantum Computation and Quantum Information book section 2.2.6, a POVM of three elements are used to measure a single qubit in order to know for sure whether the state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; if the first two measurement results are obtained, and do not infer the state when the third result is obtained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: is it physically realizable to measure three possible results from a single qubit? I thought you can only get n bit of information measuring n qubits. Three outcomes is more than one bit.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="55" LastEditDate="2021-03-12T19:45:37.677" LastActivityDate="2021-03-12T19:45:37.677" Title="Are three POVM measurements on a single qubit physically realizable?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8815" PostTypeId="2" ParentId="8814" CreationDate="2019-11-17T02:31:23.400" Score="7" Body="&lt;p&gt;Three outcomes amounts to more than one bit if the outcomes are all deterministic, and give you information about the original qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But suppose I have a coin (that is either heads or tails). I roll a dice, and if it comes 1 through 5, I tell you &quot;H&quot; or &quot;T&quot;, depending on what the coin is. If it comes up 6, I tell you &quot;6&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are three outcomes, but on average, you're only getting &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{6}$&lt;/span&gt; of a bit of information about the coin with each trial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're indeed getting more than one bit of information about the symbol I tell you, but if you get a &quot;6&quot;, it doesn't tell you anything about my coin. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the way that Nielsen and Chuang's POVM works. You either learn &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, or a third outcome (call it &quot;6&quot;) that doesn't tell you anything about the qubit. &lt;/p&gt;&#xA;" OwnerUserId="1765" LastActivityDate="2019-11-17T02:31:23.400" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8816" PostTypeId="1" AcceptedAnswerId="8826" CreationDate="2019-11-17T11:33:53.273" Score="1" ViewCount="141" Body="&lt;p&gt;What does the notation &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; mean and how does it relate to the notation  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;? Does &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; have some connection to the one found in Shroedinger's equation? &lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9118" LastEditDate="2019-11-17T23:05:28.613" LastActivityDate="2019-11-17T23:05:28.613" Title="What does $\lvert \psi \rangle$ mean?" Tags="&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8817" PostTypeId="1" AcceptedAnswerId="8819" CreationDate="2019-11-17T12:01:37.673" Score="2" ViewCount="44" Body="&lt;p&gt;If &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;quantum physics is a refinement of classical physics, and&lt;/li&gt;&#xA;&lt;li&gt;quantum computing is a refinement of classical computing, and&lt;/li&gt;&#xA;&lt;li&gt;classical computers use bits (binary digits) whereas quantum computers use qubits&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;then are binary states (0,1) a significant and pervasive construct underpinning the theory of classical &lt;em&gt;physics&lt;/em&gt; as opposed to quantum physics?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="26" LastEditDate="2019-11-18T07:44:07.100" LastActivityDate="2019-11-19T09:44:11.200" Title="Are binary states (bits) pervasive in classical physics?" Tags="&lt;classical-computing&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8818" PostTypeId="1" AcceptedAnswerId="8842" CreationDate="2019-11-17T12:51:48.167" Score="4" ViewCount="72" Body="&lt;p&gt;Ewin Tang says to not expect exponential speed-ups from quantum machine learning using &lt;strong&gt;low-dimensional data&lt;/strong&gt; because, in such cases, quantum analogues of classical algorithms will &lt;em&gt;not&lt;/em&gt; provide outperformance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What then is the definition of low-dimensional data exactly in classical machine learning for an array with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; rows and &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; columns? Can such an array even be considered high-dimensional, and if so, in which direction (&lt;span class=&quot;math-container&quot;&gt;$N\gg K$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$K\gg N$&lt;/span&gt;)? Or does high-dimensionality require that the array possess a third dimension (&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; &lt;em&gt;and&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9118" LastEditDate="2019-11-17T18:42:28.053" LastActivityDate="2019-11-18T23:59:40.810" Title="Low-dimensional data and quantum machine learning" Tags="&lt;speedup&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8819" PostTypeId="2" ParentId="8817" CreationDate="2019-11-17T13:57:18.280" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum computing is &lt;em&gt;not&lt;/em&gt; a refinement of classical computing; it's simply a different paradigm of computing aimed at solving specific categories of problems more efficiently. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum computing doesn't necessarily require qubits (cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Variations_of_the_qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qudit&lt;/a&gt;); that's just a theoretical and experimental convenience. In fact, &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-variable_quantum_information&quot; rel=&quot;nofollow noreferrer&quot;&gt;continuous-variable quantum computing&lt;/a&gt; seems to be a hot research area these days.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As for the broader question of whether the universe is 'discrete' or 'quantizable', you might find the concepts of &lt;a href=&quot;https://en.wikipedia.org/wiki/Digital_physics&quot; rel=&quot;nofollow noreferrer&quot;&gt;digital physics&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Bit-string_physics&quot; rel=&quot;nofollow noreferrer&quot;&gt;bit string physics&lt;/a&gt; interesting. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-17T14:09:08.173" LastActivityDate="2019-11-17T14:09:08.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8820" PostTypeId="1" CreationDate="2019-11-17T13:59:24.003" Score="9" ViewCount="217" Body="&lt;p&gt;Consider an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt;. How much do we understand about the probability distribution of the fidelity of &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; with a tensor product &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha \rangle = \lvert \alpha_1 \rangle \lvert \alpha_2 \rangle \cdots \lvert \alpha_n \rangle$&lt;/span&gt; of Haar-random pure states &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha_j \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that the mean fidelity will be &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; (taking fidelity to be measured in units of probability, &lt;em&gt;i.e.&lt;/em&gt;,&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$F(\lvert\alpha\rangle,\lvert\psi\rangle) = \lvert \langle \alpha \vert \psi \rangle \rvert^2$&lt;/span&gt;). For instance, we can consider the fidelity instead of  &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt;, subject to a tensor product of Haar-random single-qubit unitaries, with the state &lt;span class=&quot;math-container&quot;&gt;$\lvert 00\cdots0 \rangle$&lt;/span&gt;. It seems to me that, up to phases, the Haar-random unitaries on &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; will in effect randomise the weights of the components of &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; over the standard basis. The expected fidelity with any particular standard basis state would then be the same over all standard basis states, &lt;em&gt;i.e.&lt;/em&gt;&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;What bounds we can describe on the probability, that the fidelity will will differ much from &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; (either in absolute or relative error) &amp;mdash; without making any assumptions about the amount of entanglement or any other features of &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="26" LastEditDate="2019-11-17T21:27:18.707" LastActivityDate="2021-04-24T17:08:25.693" Title="On the distribution of the fidelity of a random product state with an arbitrary many-qubit state" Tags="&lt;quantum-state&gt;&lt;fidelity&gt;&lt;haar-distribution&gt;&lt;product-states&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8821" PostTypeId="5" CreationDate="2019-11-17T14:01:37.817" Score="0" Body="" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-11-17T14:01:37.817" LastActivityDate="2019-11-17T14:01:37.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8822" PostTypeId="4" CreationDate="2019-11-17T14:01:37.817" Score="0" Body="Having to do with continuous distributions, which are 'uniform' in the sense of being invariant under some relevant symmetry. In the case of quantum information theory, this usually relates to unitarily invariant distributions on single-qubit states, many-qubit states, single-qubit unitary transformations, or many-qubit unitary transformations." OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-11-17T14:01:37.817" LastActivityDate="2019-11-17T14:01:37.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8823" PostTypeId="5" CreationDate="2019-11-17T14:05:24.180" Score="0" Body="" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-11-17T14:05:24.180" LastActivityDate="2019-11-17T14:05:24.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8824" PostTypeId="4" CreationDate="2019-11-17T14:05:24.180" Score="0" Body="Having to do with problems which are primarily concerned with some state, which is a tensor product of states on each of its smallest subsystems, and where this represents a significant restriction on the problem (e.g., if it would be more common to consider an arbitrary state)." OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-11-17T15:51:23.550" LastActivityDate="2019-11-17T15:51:23.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8825" PostTypeId="1" AcceptedAnswerId="8828" CreationDate="2019-11-17T16:25:26.883" Score="0" ViewCount="67" Body="&lt;p&gt;Is it &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; as usually depicted on the Bloch sphere?  In other words, is it the angle projected on the &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt;-plane or is it the one on a plane that intersects the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis of the Bloch sphere?  How could I have answered this myself?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ocIv3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ocIv3.png&quot; alt=&quot;bloch sphere&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9165" LastActivityDate="2019-11-17T19:43:51.870" Title="Which angle is estimated by the phase estimation algorithm?" Tags="&lt;bloch-sphere&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8826" PostTypeId="2" ParentId="8816" CreationDate="2019-11-17T17:12:20.447" Score="8" Body="&lt;p&gt;The notation &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt;, &lt;em&gt;etc.&lt;/em&gt; just indicates that the thing in question is a vector. Furthermore, it is extremely common that the following things are also intended (in that one really should say if any of these things do not hold):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; is a column vector.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; is &lt;strong&gt;not&lt;/strong&gt; the zero vector. &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; has complex coefficients (and in particular its not necessarily restricted to real coefficients).&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; has unit Euclidean norm.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Such a vector is usually called a &lt;em&gt;state-vector&lt;/em&gt;, or sometimes a &lt;em&gt;(pure) state&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbol &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; in particular, like a bold-face &lt;span class=&quot;math-container&quot;&gt;$\mathbf v$&lt;/span&gt; in the context of vector algebra, is often used just as a generic choice of symbol or variable. It does relate to the wave function &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; in Schrödinger's equation, in that the wave function &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; can be interpreted as a state vector in a very large vector space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notation of putting &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; in asymmetrical brackets (technically, a &quot;ket&quot;: one reads &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt;  either as &quot;psi&quot; or &quot;ket-psi&quot; by convention) is a part of Dirac notation. There is a corresponding dual object &lt;span class=&quot;math-container&quot;&gt;$\langle \psi \rvert = \lvert \psi \rangle^\dagger$&lt;/span&gt; called a &quot;bra&quot; (we read &lt;span class=&quot;math-container&quot;&gt;$\langle \psi \rvert$&lt;/span&gt; as &quot;bra-psi&quot;), and when you multiply a bra and a ket, you evaluate an inner product (or a &quot;bracket&quot;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \bigl( \langle \alpha \rvert \bigr)  \bigl( \lvert \psi \rangle \bigr) = \langle \alpha \vert \psi \rangle = \langle \alpha, \psi \rangle.$$&lt;/span&gt;&#xA;Thus, you'd often see the normalisation condition on state vectors written as &lt;span class=&quot;math-container&quot;&gt;$\langle \psi \vert \psi \rangle = 1$&lt;/span&gt;. You will often see people talk about some state vectors &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert \beta \rangle$&lt;/span&gt;  being orthogonal: this can be denoted by &lt;span class=&quot;math-container&quot;&gt;$\langle \alpha \vert \beta \rangle = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The symbols &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert 1 \rangle$&lt;/span&gt; are a (very frequently occurring) special case. They indicate standard basis vectors, usually of &lt;span class=&quot;math-container&quot;&gt;$\mathbb C^2$&lt;/span&gt;, which have a 1 in one position and 0 everywhere else, and which are orthogonal to one another:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \lvert 0 \rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \qquad\lvert 1 \rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}.  $$&lt;/span&gt;&#xA;Elsewhere in mathematics, these might be written instead as &lt;span class=&quot;math-container&quot;&gt;$\mathbf e_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf e_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It's reasonably common to consider such vectors indexed by other integers, &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$\lvert 2 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert 3 \rangle$&lt;/span&gt;, &lt;em&gt;etc.&lt;/em&gt;: these are then standard basis vectors &lt;span class=&quot;math-container&quot;&gt;$\mathbf e_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathbf e_3$&lt;/span&gt;, &lt;em&gt;etc.&lt;/em&gt; in a vector space of dimension greater than 2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is also common to see vectors indexed by binary strings, &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$\lvert 001 \rangle$&lt;/span&gt;: this is a standard basis state of a system consisting of multiple qubits, in this case identified with the Kronecker product &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle \otimes  \lvert 0 \rangle \otimes \lvert 1 \rangle = \mathbf e_0 \otimes  \mathbf e_0 \otimes  \mathbf e_1 =:  \mathbf e_{001}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is also common to see vectors indexed by elements of an arbitrary (though usually finite) set, &lt;em&gt;e.g.&lt;/em&gt;&amp;nbsp;&lt;span class=&quot;math-container&quot;&gt;$\lvert v \rangle$&lt;/span&gt; for a vertex &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; of some graph &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. This is just a standard basis vector in some vector space, indexed by (the elements of) the set in question. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More generally, it is very very common to write &lt;span class=&quot;math-container&quot;&gt;$\lvert \text{(expression)} \rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\text{(expression)}$&lt;/span&gt; is some variable or formula on variables ranging over some set. This just represents a standard basis vector which is being indexed by that expression. For instance, to take an arbitrary example, for &lt;span class=&quot;math-container&quot;&gt;$x,y, z\in \mathbb Z_8$&lt;/span&gt;, we may write &lt;span class=&quot;math-container&quot;&gt;$\lvert z{+} xy \rangle =: \mathbf e_{z{+}xy} $&lt;/span&gt; (a standard basis state of a vector space of dimension eight, indexed by elements of &lt;span class=&quot;math-container&quot;&gt;$\mathbb Z_8$&lt;/span&gt;), in which case we should understand from context that &quot;&lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt;&quot; is the addition operation in the ring of the integers modulo 8, and &quot;&lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt;&quot; is the product of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in that same number system.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are more special cases in Dirac notation, which might not be the most sensible notation from a general point of view (they are the equivalent of &quot;irregular verbs&quot;) but which are in heavy use and which are useful shorthand:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert + \rangle$&lt;/span&gt; represents the specific state &lt;span class=&quot;math-container&quot;&gt;$\tfrac1{\sqrt 2}(\lvert 0 \rangle + \lvert 1 \rangle)$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert - \rangle$&lt;/span&gt; represents the specific state &lt;span class=&quot;math-container&quot;&gt;$\tfrac1{\sqrt 2}(\lvert 0 \rangle - \lvert 1 \rangle)$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generalising the correspondence above with the symbols &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; in the kets, and the idea that you can have expressions in your kets, the symbol &lt;span class=&quot;math-container&quot;&gt;$\lvert \pm \rangle$&lt;/span&gt; represents either one (or the set of both) of the two state vectors &lt;span class=&quot;math-container&quot;&gt;$\tfrac1{\sqrt 2}(\lvert 0 \rangle \pm \lvert 1 \rangle)$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Physicists often put arrows in their kets: for example, &lt;span class=&quot;math-container&quot;&gt;$\lvert \uparrow \rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$\lvert \downarrow \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lvert \rightarrow \rangle$&lt;/span&gt;, &#xA;&lt;span class=&quot;math-container&quot;&gt;$\lvert \nearrow \rangle$&lt;/span&gt;, and others generally refer to spin states or polarisations in physical systems, where the arrow literally refers to some spacial orientation. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In general, you can put pretty much any symbol in a bra or a ket that you like, and it will be immediately understood to refer to some state or functional. Because of the conventions above, this can allow you to quickly import some meaning which the symbols might have in a closely related context. (Though you should choose your notation carefully and explain it if it is not in very common usage.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully this clarifies some of what's going on with the notation.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2019-11-17T18:33:07.450" LastActivityDate="2019-11-17T18:33:07.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8827" PostTypeId="1" CreationDate="2019-11-17T19:06:01.783" Score="1" ViewCount="26" Body="&lt;p&gt;In classical optimization problems, some objective function's surface serves as a landscape for finding its minimum through minimization algorithms. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of your typical U-shaped objective surface (e.g. the squared loss function), consider instead a W-shaped surface, implying two pockets where one pocket must contain the global minimum, while the other only holds a local minimum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum annealing, in contrast to classical simulated annealing, has an additional ability to evaluate both pockets of the W-shape concurrently, from what I understand based on 'parallel universes' or quantum &lt;em&gt;parallel&lt;/em&gt; computation that classical, &lt;em&gt;sequential&lt;/em&gt; optimization can't. How much of this ability is due to superposition, entanglement and teleportation? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(It seems to me like superposition and entanglement both contribute to overall parallelizing behavior, but with one being an option reserved for certain applications, outside of, or such as, quantum annealing.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone also go into detail about the maths/circuitry behind this process, of how quantum annealing is designed to jump between or parallelize the optimizer in two or more different locations of the objective surface at once? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A referral to a Python package that demonstrates quantum annealing would be good too.&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="26" LastEditDate="2019-11-17T21:23:53.633" LastActivityDate="2019-11-17T21:23:53.633" Title="Entanglement and teleportation in quantum annealing and parallel computation" Tags="&lt;entanglement&gt;&lt;teleportation&gt;&lt;annealing&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8828" PostTypeId="2" ParentId="8825" CreationDate="2019-11-17T19:43:51.870" Score="5" Body="&lt;p&gt;Neither.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase estimation algorithm does not estimate a property of a qubit state (and the angles &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; in your question are exactly that - a property of a given qubit state). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather, it estimates the eigenvalue of a given unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that corresponds to the given eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; - the angle &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; in the following equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|\psi\rangle = e^{2i\pi\alpha}|\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia article on phase estimation&lt;/a&gt; has more details on the algorithm.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-11-17T19:43:51.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8829" PostTypeId="2" ParentId="8814" CreationDate="2019-11-17T20:13:25.597" Score="1" Body="&lt;p&gt;Thanks Peter for the clarification about information vs. outcomes. I accept his answer to acknowledge that, and want to add the possible construction of such measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same book section 2.2.8, a general method is described. In this case, one can add two qubits prepared as &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, apply a unitary on the three qubits and measure the two ancillary ones to get classic value 0, 1, or 3. Clearly to get 3 outcomes upon measurements, we do need at least two qubits to be measured. However, we already know the two ancillary ones, the measurements do not give new information about the ancillary ones.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-11-17T20:13:25.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8830" PostTypeId="1" AcceptedAnswerId="8831" CreationDate="2019-11-17T20:53:56.953" Score="5" ViewCount="789" Body="&lt;p&gt;Superdense encoding allows us to transmit the information of two classical bits using a single qubit with a pre-shared Bell state qubit pair. We can duplicate the construct to transmit &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; classical bits using &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. My question is: can we do better by using fewer qubits by leveraging multiqubit entanglement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Superdense coding applies &lt;span class=&quot;math-container&quot;&gt;$I, X, Z, XZ$&lt;/span&gt; operator on a single qubit to get &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; different outcomes. For &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, if we can only apply these four operators on individual qubits, then &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; combinations are possible. Given &lt;span class=&quot;math-container&quot;&gt;$4^n=2^{2n}$&lt;/span&gt;, one can only get information of &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; classical bits. I know it's a big &quot;if&quot;. Is that assumption correct since Pauli group forms a basis for all operators?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry I am a beginner in this subject and am not clear about many concepts yet. Also apologize if the answer is already embedded in some earlier thread. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="55" LastEditDate="2019-11-18T10:16:07.680" LastActivityDate="2019-11-18T10:16:07.680" Title="Can superdense coding be made more efficient?" Tags="&lt;communication&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8831" PostTypeId="2" ParentId="8830" CreationDate="2019-11-17T22:14:55.787" Score="5" Body="&lt;p&gt;No, you can't send more than 2 bits per transmitted qubit. &lt;a href=&quot;https://algassert.com/2016/05/29/ultra-dense-coding-allows-ftl.html&quot; rel=&quot;noreferrer&quot;&gt;Ultradense Coding would allow FTL Signalling&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic problem is that, if either teleportation or superdense coding was slightly more efficient, iteratively nesting them inside of each other would allow you to send more encoded qubits than the number of physical qubits you sent. Suppose you could ultradense code 3 bits into 1 sent qubit. Send 2 ultradense qubits, equivalent to 6 bits, but use those 6 bits to power teleportation of 3 qubits, which are actually ultradense coding 9 bits, which are teleporting 4 qubits, which are coding 12 bits, which are teleporting 6 qubits, which are coding 18 bits, teleporting 9 qubits, coding 27 bits, teleporting 13 qubits, coding 39 bits, ... you get the idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Throw an error detecting code on top, and the receiver can just guess at the initial teleportation bits and see if it worked. This would presumably allow them to receive the message before you even send it, which is clearly a problem.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-11-17T22:14:55.787" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8832" PostTypeId="1" AcceptedAnswerId="8835" CreationDate="2019-11-18T01:01:18.057" Score="5" ViewCount="140" Body="&lt;p&gt;This is a follow-up question to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8760/what-is-the-matrix-representation-for-n-qubit-gates&quot;&gt;a previous question I had&lt;/a&gt;, where the correct answer was to use the Kronecker product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given, for example, a vector representing two qbits &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0 \\ 1 \\ 0 \\ 0\end{bmatrix}$$&lt;/span&gt; is there an algorithm to decompose it into two vectors &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}1 \\ 0\end{bmatrix}$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0 \\ 1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, does this generalize to N qubits? I suspect the procedure doesn't scale well computationally (hence the entire point of quantum computing) but I'm still curious to know whether and what form the algorithm may take.&lt;/p&gt;&#xA;" OwnerUserId="5289" LastEditorUserId="26" LastEditDate="2019-11-18T15:15:54.293" LastActivityDate="2019-11-19T17:06:10.760" Title="How to efficiently calculate the inverse of a Kronecker product?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8833" PostTypeId="1" AcceptedAnswerId="8834" CreationDate="2019-11-18T03:04:53.897" Score="2" ViewCount="119" Body="&lt;p&gt;Say I have some qubit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;. If I apply some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, I get &lt;span class=&quot;math-container&quot;&gt;$U |q\rangle$&lt;/span&gt;; great. I can also think of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as a change-of-basis matrix that maps the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt; basis to the &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle, U|1\rangle$&lt;/span&gt; basis. If I just decide to measure the original &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; in that new basis, then all of my very limited knowledge about all of this would lead me to believe I get &lt;span class=&quot;math-container&quot;&gt;$U|q\rangle$&lt;/span&gt;. So is there any actual difference between the two situations? This seems like a well-known or obvious thing but I really don't know.&lt;/p&gt;&#xA;" OwnerUserId="9168" LastActivityDate="2019-11-18T05:54:22.413" Title="Difference between unitary transformations and measurement" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8834" PostTypeId="2" ParentId="8833" CreationDate="2019-11-18T05:54:22.413" Score="2" Body="&lt;p&gt;Application of a unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on a state &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; really leads to a new state &lt;span class=&quot;math-container&quot;&gt;$U|q\rangle$&lt;/span&gt;. What you get after a measurement is a one particular outcome of &lt;span class=&quot;math-container&quot;&gt;$U|q\rangle$&lt;/span&gt; state because the measurement leads to colapse of the state wave function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you repeat measurement many times you will get probability distribution of possible outcomes of the quantum state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another difference is a reversability. While transformation of the quantum state is always reversible because the unitary matrix can be always inverted, the measurement is irreversible because of the wave function colapse. To reconstruct the quantum state you need to do many measurements of same state in different basis and employ so-called quantum tomography.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-18T05:54:22.413" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8835" PostTypeId="2" ParentId="8832" CreationDate="2019-11-18T07:22:37.500" Score="5" Body="&lt;p&gt;You specifically ask about qubits, so I'll keep it to that. Imagine you have a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\sum_{x\in\{0,1\}^n}a_x|x\rangle.&#xA;$$&lt;/span&gt;&#xA;You can choose to look at each qubit. I'll take the first qubit for the sake of simplicity. We have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=|0\rangle\sum_{y\in\{0,1\}^{n-1}}a_{0y}|y\rangle+|1\rangle\sum_{y\in\{0,1\}^{n-1}}a_{1y}|y\rangle&#xA;$$&lt;/span&gt;&#xA;which we can equally well think of as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=c_0|0\rangle|\phi_0\rangle+c_1|1\rangle|\phi_1\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\langle\phi_0|\phi_0\rangle=\langle\phi_1|\phi_1\rangle=1$&lt;/span&gt;. If it happens that &lt;span class=&quot;math-container&quot;&gt;$\langle\phi_0|\phi_1\rangle=e^{i\gamma}$&lt;/span&gt;, then this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=(c_0|0\rangle+c_1e^{i\gamma}|1\rangle)|\phi_0\rangle,&#xA;$$&lt;/span&gt;&#xA;which is now in its separable form, as desired. You keep repeating this qubit-by-qubit. Of course, as the number of qubits, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, increases, you're dealing with exponentially many coefficients, so the calculation is not efficient, although it is procedurally straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of actually performing the computation, it may be easier to rely on the partial trace, which is built in to many packages. You'd calculate, for example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1=\text{Tr}_{2,3,\ldots N}|\psi\rangle\langle\psi|,&#xA;$$&lt;/span&gt;&#xA;the reduced density matrix on the first qubit. If &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}\rho_1^2=1$&lt;/span&gt;, then this state is separable. Moreover, &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; is a rank 1 projector, and the state that it projects onto is the separable decomposition of that qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-11-19T17:06:10.760" LastActivityDate="2019-11-19T17:06:10.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8836" PostTypeId="1" AcceptedAnswerId="8838" CreationDate="2019-11-18T11:37:10.417" Score="1" ViewCount="138" Body="&lt;p&gt;I have the following code, which runs properly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.converters import *&#xA;&#xA;ghz2 = QuantumCircuit(5, 5)&#xA;ghz2.h(2)&#xA;ghz2.cx(2, 1)&#xA;ghz2.cx(1, 0)&#xA;ghz2.cx(2, 3)&#xA;ghz2.cx(3, 4)&#xA;&#xA;&#xA;ghz_dag = circuit_to_dag(ghz2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I access properties of this dag? For instance, I would like to get all the 2-qubit gates using the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/passes/collect_2q_blocks.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;collect 2qubit gates method&lt;/a&gt; (the output is supposed to be a dictionary) or simply draw the DAG but again, dag_drawer(ghz_dag) throws up an error (&lt;code&gt;'MultiDiGraph' object has no attribute 'number_of_selfloops'&lt;/code&gt;) even though, that's done in an example &lt;a href=&quot;https://medium.com/qiskit/terra-0-7-better-visualization-compilation-memorization-895b05b7197f&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this is just a Python usage question but how does one access the properties of the DAG? &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="26" LastEditDate="2019-11-18T12:17:12.130" LastActivityDate="2019-11-18T14:23:50.770" Title="How does one get the attributes of a circuit from its DAG in qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8837" PostTypeId="1" AcceptedAnswerId="8915" CreationDate="2019-11-18T13:14:44.733" Score="0" ViewCount="63" Body="&lt;p&gt;I am new to quantum computing and I wanted to do a project for one of my classes where I study a specific algorithm from the field and then insert parallelism in it so it can be executed more efficiently on a cluster i.e., high-performance computing (HPC) system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would appreciate any suggestions which algorithm should I pursue to implement, as well as any resources available to study its background. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="9174" LastEditorUserId="26" LastEditDate="2019-11-18T15:11:40.610" LastActivityDate="2019-11-25T07:10:28.253" Title="Which algorithm in quantum computing can be implemented for a HPC system?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8838" PostTypeId="2" ParentId="8836" CreationDate="2019-11-18T14:23:50.770" Score="3" Body="&lt;p&gt;Properties of the DAG are simply accessed using dot notation. For example, if you would like to get all the two qubit gates you would do &lt;code&gt;dag.twoQ_gates()&lt;/code&gt; which returns a list of the two qubit gates present in the dag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code you have linked to is a transpiler pass. This is a method that looks over the dag to identify some property or to perform some optimization. It stores variables to the property set, &lt;code&gt;self.property_set&lt;/code&gt;. There is more information about using the transpiler &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/5_using_the_transpiler.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-18T14:23:50.770" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8839" PostTypeId="1" CreationDate="2019-11-18T15:19:59.113" Score="1" ViewCount="76" Body="&lt;p&gt;I'm a Politecnico di Torino student currently enrolled - and close to graduate - in Electronics and Communications engineering. As such, I know the basics of analog electronics, digital electronics, signal processing and of course anything that has to do with communications, especially TCP/IP on all levels, even physical. I like the theory of information and signal modulation, and I also like higher levels in TCP/IP, knowing some basic algorithms and protocols; I'm not new to this. Furthermore, I hate analyzing analog circuits, but I love digital electronics and LTI systems theory (including discrete analysis like Z-transform of signals, FFT, etc). Along with this, I have a strong personal background on operating systems and programming (mainly C/C++; but I also have a big experience in higher-level languages). My initial thought was to engage with &lt;strong&gt;embedded systems&lt;/strong&gt; as my MSc, in order to strengthen my knowledge in OSes (since I'm not used to real-time ones) and find a mix between my hobby, programming, and something that has to do with telecommunications, signal analysis, or anyways low-level computer stuff (for example, I love memory management and CPU arch, and I'd love to learn more about them). So, why not, this sounds like a good mix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've recently discovered that one of our free-choice exams includes, weirdly, an introduction to Quantum Information, Quantum Computing, and Teleportation at the Bachelor's level. I was selected for this and I will start the lectures next semester. I still have no idea how the whole thing works, but the concept of quantum computing seems extremely interesting to me, right now. In case I end up loving this course, I think I'd be wanting to do something about quantum computing in my future Ph.D. program if I ever get to get into one.&#xA;At this point, I got some choices: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;MSc in Computer/Electronic Engineering with Embedded Systems path&lt;/em&gt; - I think this would be good especially for getting to know into details how these systems work on a low level, how classical architectures work before heading to a hypothetical quantum computing background&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;MSc in Physics of Complex Systems&lt;/em&gt; - this one is very interesting because it provides a lot of statistical inference, statistical quantum mechanics, and some quantum information theory backgrounds&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;MSc in Computer Engineering, Cyber Security path&lt;/em&gt; - this one could be interesting if I want to operate with the security of quantum systems - I saw that, in telecommunications, there is something called a &quot;quantum key sharing&quot;; I'm not sure what it is, but sounds cool.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;MSc in Computer Engineering, Software Engineering path&lt;/em&gt; - interesting, but I'm not sure how good this could be.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;MSc in Data Science and Engineering&lt;/em&gt; - could be pretty cool, but I'm not sure how this could help with QC.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Do these courses make sense? In case they do, which one could be the best? I'm very interested in computer architecture and in telecommunications, and also in reverse engineering memory management, and data structures. One thing I absolutely love is working with bits, especially when it's about manipulating memory or also bitmasks, and I also am amazed and very interested in probability when it's applied to signals (power spectral densities and that stuff), and in general statistical inference. I hate purely analog circuits analysis because, to me, they have lots of inconsistencies and I'm not good at re-modeling circuits from different points of view, let alone all the awful approximations that are often taken for granted in these courses. I also love physics, especially electromagnetism, and stochastic processes-based physical theories, so Physics of Complex Systems could be interesting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What do you think? Do any of these make sense?&#xA;I could also switch university, but quantum computing courses at MSc level are extremely rare and they're usually found in mostly Physics and Technology courses, and furthermore, it would be a great problem with funding, but I suppose I could make some more sacrifices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am really sorry for my long post and I hope this is the right subsite, and I hope this wasn't already asked (couldn't really think anything about it, especially with these courses). For any suggestions, thank you in advance! I would really appreciate any tips. Have a good day!&lt;/p&gt;&#xA;" OwnerUserId="8999" LastEditorUserId="26" LastEditDate="2019-11-18T15:50:24.583" LastActivityDate="2019-11-18T15:50:24.583" Title="Could any of these university courses be a good MSc for a quantum computing future job/research?" Tags="&lt;research&gt;" AnswerCount="0" CommentCount="9" ClosedDate="2019-11-19T22:33:56.817" ContentLicense="CC BY-SA 4.0" />
  <row Id="8841" PostTypeId="2" ParentId="8794" CreationDate="2019-11-18T18:10:02.887" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\on}[1]{{\operatorname{#1}}}$&lt;/span&gt;The basic answer is to just write, for a given bipartite state &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)\equiv\operatorname{Tr}_B(X)$&lt;/span&gt;. This defines a quantum channel which acts on the input as a partial trace. You can check that this does indeed qualify as a quantum channel etc.&lt;/p&gt;&#xA;&lt;p&gt;A misconception that might have led you to ask this question can be found in your saying that &amp;quot;&lt;em&gt;I have no idea how to define a quantum channel with the partial trace because partial trace depends on an index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_i(\rho)$&lt;/span&gt;). Intuitively, the index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is random, but then I don't know how to define a map that represents the partial trace&lt;/em&gt;. This is wrong. The index used to denote the partial trace represents which space is being traced out. It is &lt;em&gt;not&lt;/em&gt; &amp;quot;random&amp;quot;, but rather is something that has to be decided when the operation is defined. For example, for a bipartite system, you can always define the partial trace with respect to either of the two subspace, thus getting two different, if related, maps.&lt;/p&gt;&#xA;&lt;p&gt;Another way to interpret the question is: &amp;quot;&lt;em&gt;What does the partial trace map look like in one of the common quantum channel representations?&lt;/em&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;em&gt;&lt;strong&gt;A note on notation:&lt;/strong&gt;&lt;/em&gt; I'll use here &lt;a href=&quot;https://en.wikipedia.org/wiki/Einstein_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Einstein's summation notation&lt;/a&gt; (though using only lower indices) for repeated indices, as well as numbers instead of letters to represent indices. This is because I believe it makes it easier to see the structure of some expressions. Furthermore, I will sometimes use primed indices when an index represents an element in a &lt;em&gt;dual&lt;/em&gt; vector space (i.e. it corresponds to a bra). For example, I'll write the matrix elements of a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\rho_{11'}$&lt;/span&gt;. For a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, I will write &lt;span class=&quot;math-container&quot;&gt;$\sigma=\sigma_{12,1'2'}|1\rangle\!\langle 1'|\otimes|2\rangle\!\langle2'|$&lt;/span&gt;, where &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&amp;quot; and &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;&amp;quot; correspond to kets in first and second space, while &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$1',2'$&lt;/span&gt;&amp;quot; correspond to bras in the same spaces.&#xA;Whenever suitable, I will include both the expression in operatorial form and the explicit base-dependent one with indices.&#xA;&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Natural representation&lt;/h1&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Natural representation in general)&lt;/strong&gt;&lt;/em&gt; Given an arbitrary channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, denote with &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; its &lt;em&gt;natural representation&lt;/em&gt;. You can think of this as the linear map that acts on states via their vectorisations. Fixing a canonical basis, we can write &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; explicitly through its matrix components as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K(\Phi)\on{vec}(X) = \on{vec}(\Phi(X)), \qquad&#xA;[\Phi(X)]_{11'}=K(\Phi)_{11',22'}X_{22'}.$$&lt;/span&gt;&#xA;One thing to notice at this point is that what the &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&amp;quot; and &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;&amp;quot; indices represent does not really matter at this point. If &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is bipartite, then &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;&amp;quot; is an index denoting an element of a bipartite space, and so it might be written as something like &lt;span class=&quot;math-container&quot;&gt;$2=(2_1 2_2)$&lt;/span&gt;, or directly &lt;span class=&quot;math-container&quot;&gt;$2\sim 23$&lt;/span&gt;, as I will do in the following. However, the natural representation is still possible, regardless of what the input and output spaces actually are.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Natural representation of partial trace)&lt;/strong&gt;&lt;/em&gt; In the case of &lt;span class=&quot;math-container&quot;&gt;$\Phi=\on{Tr}_B$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; denotes here the second space), the input &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; has a bipartite structure, and so we can write its matrix elements as &lt;span class=&quot;math-container&quot;&gt;$X_{12,1'2'}$&lt;/span&gt;, while the output does not have a tensor product structure (or at least we are not considering this structure here).&#xA;We can then write the action of the partial trace in the natural representation as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[\operatorname{Tr}_B(X)]_{11'}=K(\operatorname{Tr}_B)_{11',232'3'}X_{232'3'}.$$&lt;/span&gt;&#xA;From the definition of partial trace, we know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$[\operatorname{Tr}_B(X)]_{11'}=&#xA;\sum_\alpha X_{1\alpha1' \alpha}\equiv X_{1\alpha 1'\alpha}.$&lt;/span&gt;&#xA;For the two expressions to be consistent, you then need the partial trace to have the following natural representation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  K(\on{Tr}_B)_{11',232'3'} = \delta_{12}\delta_{1'2'}\delta_{33'}. \tag A&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Alternative expression)&lt;/strong&gt;&lt;/em&gt;&#xA;We can get an expression with less floating indices by reasoning directly in terms of the operatorial relations: as pointed out before, we must have&#xA;&lt;span class=&quot;math-container&quot;&gt;$K(\on{Tr}_B)\on{vec}(X) = \on{vec}(\on{Tr}_B(X))$&lt;/span&gt;. But we can also observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\on{vec}(\on{Tr}_B(X))&#xA;= \sum_{i,j,\alpha} |i,j\rangle X_{i\alpha,j\alpha}&#xA;= \left(\sum_\alpha I\otimes\langle \alpha|\otimes I\otimes\langle \alpha|\right)\on{vec}(X),$$&lt;/span&gt;&#xA;and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K(\on{Tr}_B) = \sum_\alpha (I\otimes\langle \alpha|\otimes I\otimes\langle \alpha|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Kraus representation&lt;/h1&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Natural vs Kraus representation)&lt;/strong&gt;&lt;/em&gt; Write the Kraus decomposition of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\sum_a A_a X A_a^\dagger \equiv A_a X A_a^\dagger.$&lt;/span&gt;&#xA;I will use &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&amp;quot; to index the Kraus operators, to distinguish the associated &amp;quot;auxiliary space&amp;quot; from indices denoting Hilbert space components. I will also not give any meaning to whether an index is raised or not (i.e. &lt;span class=&quot;math-container&quot;&gt;$A_a\equiv A^a$&lt;/span&gt;), as the meaning of the indices will be obvious from the context.&#xA;The relation between this and the natural representation (again using non-bipartite notation for now) is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K(\Phi) = \sum_a A_a\otimes \bar A_a, \qquad&#xA;K(\Phi)_{11',22'}=A^a_{12} \bar A^a_{1'2'}.$$&lt;/span&gt;&#xA;In the case of the partial trace, the input space (the index &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;&amp;quot; here) has a bipartite structure while the output one doesn't, so the components of the &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; operators are written as &lt;span class=&quot;math-container&quot;&gt;$A^a_{1,23}$&lt;/span&gt; etc.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Kraus repr of partial trace)&lt;/strong&gt;&lt;/em&gt; Using the previous result about the natural representation of the partial trace, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\delta_{12}\delta_{1'2'}\delta_{33'}=A^a_{1,23}\bar A^a_{1',2'3'},$$&lt;/span&gt;&#xA;which means that &lt;span class=&quot;math-container&quot;&gt;$A^a_{1,23}=\delta_{12}B^a_3$&lt;/span&gt; for some object &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$B^a_3 \bar B^a_{3'}=\delta_{33'}.\tag{Y}$$&lt;/span&gt;&#xA;There are many equivalent choices for such an object. What we can observe is that (Y) can be understood as the orthonormality relation between a set of vectors, where &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;&amp;quot; indexes the vectors and &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&amp;quot; is used for the components. This means that for (Y) to be possible, the auxiliary space in which the &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&amp;quot; indices live must have dimension greater than or equal to the dimension of the space of the index &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;&amp;quot; (because you cannot have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; orthogonal vectors in a space of dimension &lt;span class=&quot;math-container&quot;&gt;$&amp;lt; n$&lt;/span&gt;).&#xA;We can then take the dimensions to be equal, which makes &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; a unitary operator with respect to its two indices. Because unitary matrices are all and only those whose rows (columns) form an orthonormal system for the space, and can freely choose which basis to use, the easier choice is to use the computational basis, which means that &lt;span class=&quot;math-container&quot;&gt;$B^a_3=\delta_{a3}$&lt;/span&gt;.&#xA;It is trivial to check that this choice satisfies (Y), and therefore produces the correct Kraus operators.&#xA;We conclude that the most natural (or &lt;em&gt;a&lt;/em&gt; natural choice) for the Kraus operators of the partial trace is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_a = I\otimes\langle a|,&#xA; \qquad&#xA;A^a_{1,23} = \delta_{12}\delta_{a3}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h1&gt;Choi representation&lt;/h1&gt;&#xA;&lt;p&gt;This is straightforward from our analysis of the natural representation.&#xA;Indeed, the Choi operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; as the same matrix components as the natural representation &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt;, up to some rearrangement. More specifically,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi)_{12,1'2'} = K(\Phi)_{11',22'}.$$&lt;/span&gt;&#xA;It then follows from (A) that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi)_{123,1'2'3'} = \delta_{12}\delta_{1'2'}\delta_{33'}.$$&lt;/span&gt;&#xA;Equivalently, as an operator, this reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi) = |m\rangle\!\langle m|\otimes I,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|m\rangle\equiv \sum_i|i,i\rangle\!\langle i,i|$&lt;/span&gt; is the maximally entangled state (modulo normalisation).&lt;/p&gt;&#xA;&lt;p&gt;If you want to then represent this operator as a matrix, in the simplest case of all spaces being two-dimensional, you find a matrix that is the same as the density matrix of the Bell state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle+|11\rangle$&lt;/span&gt;, upon replacing &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; with the two-dimensional identity, and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; zero matrix. More explicitly:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(&#xA;\begin{array}{cccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The fact that the &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; is a square matrix while &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; isn't is not a coincidence. The Choi is a square matrix for &lt;em&gt;any&lt;/em&gt; map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, while the natural representation is only square when input and output spaces have the same dimensions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;sup&gt;The Mathematica code to generate the above matrix is the following:&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SparseArray[{{i_, j_} :&amp;gt; 1 /; With[&#xA;       {iList = IntegerDigits[i - 1, 2, 3], &#xA;        jList = IntegerDigits[j - 1, 2, 3]},&#xA;       And[&#xA;        iList[[1]] == iList[[2]],&#xA;        jList[[1]] == jList[[2]],&#xA;        iList[[3]] == jList[[3]]&#xA;        ]]}, {8, 8}] // Normal // TeXForm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-17T09:08:51.360" LastActivityDate="2021-05-17T09:08:51.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8842" PostTypeId="2" ParentId="8818" CreationDate="2019-11-18T20:46:46.203" Score="3" Body="&lt;h2&gt;The Context&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The algorithm Ewin Tang originally &lt;a href=&quot;https://arxiv.org/abs/1807.04271&quot; rel=&quot;nofollow noreferrer&quot;&gt;examined and dequantized&lt;/a&gt; was the &lt;a href=&quot;https://arxiv.org/abs/1603.08675&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum recommendation system algorithm&lt;/a&gt; by Kerenidis &amp;amp; Prakash. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many QML algorithms, including the quantum recommendation system algorithm, exploit the quantum linear systems algorithm (QLSA), which was &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;posted on arXiv&lt;/a&gt; in 2008 by Harrow, Hassidim, and Lloyd (that's why it's also sometimes known as the HHL algorithm). The QLSA algorithm solves a quantum linear system of equations (i.e. the input is quantum information) via matrix inversion. Formally, given a matrix &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} \in \mathbb{R}^{N \times N}$&lt;/span&gt; and a vector &lt;span class=&quot;math-container&quot;&gt;$\vec{b} \in \mathbb{R}^N$&lt;/span&gt;, the task is to solve for &lt;span class=&quot;math-container&quot;&gt;$\vec{x} \in \mathbb{R}^N$&lt;/span&gt; in the system &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} \vec{x}=\vec{b}$&lt;/span&gt;. Note that the original QLSA didn't include a data loading or measurement procedure (important when considering its complexity). &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;About Speed&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The QLSA outputs a solution with complexity &lt;span class=&quot;math-container&quot;&gt;$O(d^4\kappa^2\log N/\epsilon)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the density of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; is the magnitude of the ratio of the largest to smallest eigenvalues of the matrix (i.e. &lt;span class=&quot;math-container&quot;&gt;$\kappa = \vert\lambda_{\max}/\lambda_{\min}\vert$&lt;/span&gt;), and &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is the precision.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Focusing on &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt;, we can define them in layman's terms as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the maximum number of non-zero entries among the rows of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; is the magnitude of the ratio between the largest and smallest eigenvalues of the matrix &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Over the years, several improvements have been made to the QLSA – so this complexity can be considered higher than what is theoretically possible.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;And on Dimensionality...&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;First off, we typically talk about the dimensionality of a data matrix in terms of its columns – that is, an &lt;span class=&quot;math-container&quot;&gt;$m\times n$&lt;/span&gt; matrix would be high dimensional &lt;span class=&quot;math-container&quot;&gt;$n \gg m$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the number of rows (samples) and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of columns (features). You could think of this in the context of the QLSA where &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; is the data matrix for a linear regression. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd argue that Tang is making a general statement about algorithmic complexity. Specifically, that you need a large input (matrix) to get a meaningful speedup up, just given the complexity of the algorithm and a comparable classical approach like Gaussian elimination (which is &lt;span class=&quot;math-container&quot;&gt;$O(N^3)$&lt;/span&gt;) or one of Tang's dequantized (classical) algorithms, which (as I understand them) end up having polynomial complexity, though the polynomials are of quite high order(s) on some term(s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, another point is that given the polynomial terms &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$\log N / \epsilon$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is relatively small and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; are large, the latter are going to have a greater influence on the complexity.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2019-11-18T23:59:40.810" LastActivityDate="2019-11-18T23:59:40.810" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8843" PostTypeId="1" CreationDate="2019-11-19T00:28:16.723" Score="2" ViewCount="366" Body="&lt;p&gt;I’m trying to get a Quantum Fourier Transform working with the rest of a compiled version of Shor’s algorithm, attempting to factor &lt;span class=&quot;math-container&quot;&gt;$N=21$&lt;/span&gt;.&#xA;In the following image, there’s an initialization phase (before the first vertical line), then a compiled version of modular exponentiation with base 4 up to the second vertical line (based on &lt;a href=&quot;https://i.stack.imgur.com/bOaAn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, figure 5), followed by QFT. The output of modular exponentiation seems correct (the output of that module matches the truth table in &lt;a href=&quot;https://i.stack.imgur.com/bOaAn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; (table V), which gives &lt;span class=&quot;math-container&quot;&gt;$f(4, 21, x) = 4^x \bmod 21)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the output of QFT gives a pretty much flat distribution over &lt;code&gt;[q3…q7]&lt;/code&gt;. This is slightly involved, but I’d appreciate any tips over where I may be going wrong. Happy to provide my code, etc.&#xA;￼&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bOaAn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bOaAn.png&quot; alt=&quot;Circuit Diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bOaAn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; Simplified Factoring Algorithms for Validating Small-Scale Quantum Information Processing Technologies, Gamel &amp;amp; James, 2013, &lt;a href=&quot;https://arxiv.org/abs/1310.6446v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1310.6446v2&lt;/a&gt; (edited) &lt;/p&gt;&#xA;" OwnerUserId="9180" LastEditorUserId="26" LastEditDate="2019-11-19T13:20:06.493" LastActivityDate="2020-02-06T08:23:51.430" Title="Implementing QFT for Shor's Algorithm" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8844" PostTypeId="1" AcceptedAnswerId="8845" CreationDate="2019-11-19T06:53:14.863" Score="2" ViewCount="150" Body="&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit.tools.visualization import matplotlib_circuit_drawer as drawer&#xA;from qiskit import Aer&#xA;from qiskit import execute&#xA;import numpy as np&#xA;%matplotlib inline&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the code cell that I am trying to implement. The error is in the second line.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Error--&amp;gt; ImportError: cannot import name 'matplotlib_circuit_drawer'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using Google Colab to execute the code. How to solve this?&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="26" LastEditDate="2019-11-19T13:18:11.947" LastActivityDate="2019-11-19T13:18:11.947" Title="ImportError: cannot import name 'matplotlib_circuit_drawer'" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8845" PostTypeId="2" ParentId="8844" CreationDate="2019-11-19T07:23:46.490" Score="2" Body="&lt;p&gt;&lt;code&gt;qiskit.tools.visualization&lt;/code&gt; has been moved to &lt;code&gt;qiskit.visualization&lt;/code&gt; and &lt;code&gt;matplotlib_circuit_drawer&lt;/code&gt; has been removed. Instead of using it, try using &lt;code&gt;qiskit.visualization.circuit_drawer()&lt;/code&gt; with the appropriate arguments. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So in this case it should be &lt;code&gt;qiskit.visualization.circuit_drawer(my_circuit, output='mpl', filename='my_circuit.png')&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5771" LastEditorUserId="5955" LastEditDate="2019-11-19T08:38:56.483" LastActivityDate="2019-11-19T08:38:56.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8846" PostTypeId="2" ParentId="8832" CreationDate="2019-11-19T08:52:29.123" Score="2" Body="&lt;p&gt;Consider an arbitrary vector &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v\equiv(v_i)_{i=1}^N\in\mathbb C^{nm}$&lt;/span&gt; of length &lt;span class=&quot;math-container&quot;&gt;$n m$&lt;/span&gt; (if you care only about qubits, just fix &lt;span class=&quot;math-container&quot;&gt;$n=m=2$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v$&lt;/span&gt; to have an &lt;span class=&quot;math-container&quot;&gt;$(n,m)$&lt;/span&gt; partition means that we can write it as &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v=\boldsymbol u\otimes \boldsymbol w$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol u\in\mathbb C^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol w\in\mathbb C^m$&lt;/span&gt;.&#xA;If this is the case, then the components of &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v$&lt;/span&gt; must be related to those of &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol u,\boldsymbol w$&lt;/span&gt; via&#xA;&lt;span class=&quot;math-container&quot;&gt;$$v_{ij}=u_i w_j. \tag A$$&lt;/span&gt;&#xA;The first thing to notice is that the tensor product operation &lt;span class=&quot;math-container&quot;&gt;$(\boldsymbol u,\boldsymbol w)\mapsto\boldsymbol v$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; injective. In particular, for any &lt;span class=&quot;math-container&quot;&gt;$\lambda\in\mathbb C$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$(\lambda \boldsymbol u)\otimes \boldsymbol w=\boldsymbol u\otimes(\lambda \boldsymbol w)$&lt;/span&gt;, and thus given a separable &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v$&lt;/span&gt; we can only recover its &quot;reduced vectors&quot; up to their individual norms and phase factors.&#xA;&#xA;Because we are interested in quantum states, this means that we don't need to worry about neither the normalisation nor the phase of the vectors &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol u,\boldsymbol w$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A remarkable property of (A) is that, for any pair of indices &lt;span class=&quot;math-container&quot;&gt;$j\neq j'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$v_{ij}/v_{ij'}=w_j/w_{j'}$&lt;/span&gt;, where, you might notice, the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; index does not appear on the right-hand side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This property characterises separable vectors: check that &lt;span class=&quot;math-container&quot;&gt;$v_{ij}/v_{ij'}$&lt;/span&gt; does not depend on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j,j'$&lt;/span&gt;, and if so, define &lt;span class=&quot;math-container&quot;&gt;$w_i\equiv v_{i1}/v_{ij}$&lt;/span&gt;, where we are using the fact that &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol w$&lt;/span&gt; is defined up to normalisation to assume &lt;span class=&quot;math-container&quot;&gt;$w_1=1$&lt;/span&gt; (when some of the elements &lt;span class=&quot;math-container&quot;&gt;$v_{ij}$&lt;/span&gt; we might not be able to assume this, but those cases are usually trivial to handle separately).&#xA;Once you have &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol w$&lt;/span&gt;, you can find &lt;span class=&quot;math-container&quot;&gt;$u_i$&lt;/span&gt; by simply computing &lt;span class=&quot;math-container&quot;&gt;$v_{ij}/w_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v=(1,1,2,2)^T$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$v_{11}=v_{12}=1, \qquad v_{21}=v_{22}=2,$$&lt;/span&gt;&#xA;and thus &lt;span class=&quot;math-container&quot;&gt;$v_{12}/v_{11}=v_{22}/v_{21}=1$&lt;/span&gt;. You can thus define &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol w=(1,1)$&lt;/span&gt;. You then compute &lt;span class=&quot;math-container&quot;&gt;$u_1=v_{11}/w_1=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$u_2=v_{21}/w_1=2$&lt;/span&gt;, which tells you that &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol u=(1,2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v=(0,1,0,0)^T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=m=2$&lt;/span&gt;, then by definition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$v_{11}=v_{21}=v_{22}=0 \qquad\text{and}\qquad v_{12}=1.$$&lt;/span&gt;&#xA;Because &lt;span class=&quot;math-container&quot;&gt;$v_{11}=0$&lt;/span&gt;, we cannot use directly the procedure above, but the fact that &lt;span class=&quot;math-container&quot;&gt;$v_{2j}=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; tells you immediately that &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol u=(1,0)$&lt;/span&gt;, and then finding &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol v$&lt;/span&gt; is easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for how numerically efficient this particular method is, I'm not so sure. The main problem is that all these divisions will be prone to numerical instability for small values of the amplitudes. Methods that are based on computing entropies might work better, but I'm not sure.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-19T08:52:29.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8847" PostTypeId="2" ParentId="8808" CreationDate="2019-11-19T09:35:41.813" Score="1" Body="&lt;p&gt;In general, you cannot distinguish between the two. Both classical and quantum mechanics can produce arbitrary probability distributions, so there simply isn't enough information to distinguish between the two if that's all you have access to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A setting in which observable differences can be observed is when locality is taken into account. If the probability distribution is obtained by spatially separated parties interacting with two parts of an entangled system, then the produced correlations in the observed statistics can be measurably incompatible with classical mechanics (see Bell's inequalities and such).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-19T09:35:41.813" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8848" PostTypeId="2" ParentId="8817" CreationDate="2019-11-19T09:44:11.200" Score="1" Body="&lt;p&gt;Qubits are the quantum states that carry the smallest amount of &quot;quantum information&quot;: the simplest possible quantum states you can imagine. They are pervasive for this reason, just like bits in classical physics are pervasive because they are the basic unit of information. We use bits all the times simply because we find it convenient to build things (e.g. coputers) in such a way that we can model their behaviour in terms of bits. Underlying the simplified models, physical reality is much more complex than that though: inside your computers that are transistors carrying &quot;continuous&quot; amounts of currents and voltages, and describing the whole thing in terms of bits is only an extremely useful way to simplify how the whole thing works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One caveat is that there is a sense in which &quot;qubits&quot; are more natural in quantum mechanics than &quot;bits&quot; are in classical physics. Indeed, elementary particles often have intrinsic degrees of freedom that seem to be genuine two-dimensional systems (qubits). There isn't anything like this in classical physics that I know of. But then again, one could argue that even talking about elementary particles in quantum mechanics is only a &quot;simplified model useful for descriptions&quot;. &lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-19T09:44:11.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8849" PostTypeId="1" AcceptedAnswerId="8851" CreationDate="2019-11-19T09:51:08.250" Score="13" ViewCount="3344" Body="&lt;p&gt;When explaining a &lt;em&gt;quantum&lt;/em&gt; algorithm, many revert to 'circuit-speak' by drawing a diagram of how qubits split off into transformations and measurements, however, rarely if not never would someone explaining a &lt;em&gt;classical&lt;/em&gt; math algorithm revert to its representation in binary circuits. I would understand that this is because transforms and such don't exist in the binary world, but:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doesn't this unnecessary focus on the computational details relating to &lt;em&gt;computing&lt;/em&gt;-computing, rather than the mathematical/statistical/optimization problem that the circuitry merely only underlies, detract from the main problem/application at hand? Is the classical mindset just that intuitive and aligned to general human thought, that quantum circuits, on the other hand, will remain to be a standard explanation strategy?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="26" LastEditDate="2019-11-19T12:33:17.460" LastActivityDate="2020-10-22T16:50:54.130" Title="Quantum circuits explain algorithms, why didn't classical circuits?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8850" PostTypeId="1" CreationDate="2019-11-19T10:23:00.767" Score="3" ViewCount="431" Body="&lt;p&gt;I found some examples of implementing the oracle when the marked state is &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;.&#xA;But how can we know what gate we should use inside of the oracle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JV4e0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JV4e0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Besides, for the part implementation, the example shows like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7vDMl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7vDMl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, it should be &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle 0|-I$&lt;/span&gt;, but how can it be realized by X gates and controlled-Z gate?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="26" LastEditDate="2019-11-19T13:17:11.017" LastActivityDate="2021-05-22T00:04:30.560" Title="In Grover, how to implement oracle and amplification using Qiskit?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8851" PostTypeId="2" ParentId="8849" CreationDate="2019-11-19T13:10:58.143" Score="17" Body="&lt;p&gt;You might find this analogy helpful: the development of quantum algorithms is &lt;em&gt;still&lt;/em&gt; in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Booth&amp;#39;s_multiplication_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Booth's multiplication algorithm&lt;/a&gt; stage; we haven't quite reached &lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamic_programming&quot; rel=&quot;noreferrer&quot;&gt;dynamic programming&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Backtracking&quot; rel=&quot;noreferrer&quot;&gt;backtracking&lt;/a&gt;. You'll find that most textbooks explain the Booth's algorithm using the following circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3cmLy.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3cmLy.jpg&quot; alt=&quot;Multiplier circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That &lt;em&gt;is&lt;/em&gt; in fact, the method in which the multiplication logic is implemented in most modern processors (with some minor modifications depending on the version). However, this kind of representation quickly becomes tedious when you move to on algorithmic techniques like looping and recursion which may involve multiple multiplication and division steps, among others. It would be crazy for textbooks to explain more advanced algorithms using hardware-level implementations like this. Not to mention that the basic hardware circuitries vary with the processor. If you've ever done &lt;a href=&quot;https://en.wikipedia.org/wiki/Assembly_language&quot; rel=&quot;noreferrer&quot;&gt;assembly language programming&lt;/a&gt; this should resonate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical algorithm textbooks like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Introduction_to_Algorithms&quot; rel=&quot;noreferrer&quot;&gt;CLRS&lt;/a&gt; evade this problem by framing the algorithms without any particular processor in mind. The basic algorithmic procedures like addition, multiplication, looping, etc. are all considered as black boxes. If you're interested to see the processor-specific implementation of a CLRS algorithm you could certainly write it up in some high-level language like C and then &lt;a href=&quot;https://www.geeksforgeeks.org/convert-cc-code-to-assembly-language/&quot; rel=&quot;noreferrer&quot;&gt;convert it to assembly&lt;/a&gt;. Fortunately, compilers do that tedious conversion on our behalf! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the interesting part is that the basic building blocks of quantum algorithms are not addition or multiplication as such, but rather operations like &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;Fourier transform&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;noreferrer&quot;&gt;amplitude amplification&lt;/a&gt;. Quantum algorithms are largely framed in terms of these basic transformations that are very easy to visualize using quantum circuits (at least, if we're using the gate model). It's really much more about convenience and much less about intuition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rest assured that if a textbook ever states a generalized quantum equivalent of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Dijkstra's algorithm&lt;/a&gt; it wouldn't be showing you all the gates required to implement it, but rather in terms of the elementary quantum operations whose hardware implementations would largely vary depending on the quantum processor you're using.  The bottom line is that we're still in the assembly language stage of quantum computing. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="9399" LastEditDate="2019-12-07T14:59:56.857" LastActivityDate="2019-12-07T14:59:56.857" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8852" PostTypeId="2" ParentId="8849" CreationDate="2019-11-19T14:15:39.263" Score="7" Body="&lt;p&gt;The state of quantum computing technology is still in its infancy, so implementation details are generally important when considering quantum algorithms. Number of gates, number of operations, types of gates (&lt;em&gt;e.g.&lt;/em&gt; Clifford vs. non-Clifford) are often necessary information to evaluate the feasibility and value of a quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many cases quantum algorithms are still being optimized, and there are often competing approaches with different trade-offs being considered and iterated.  As a result, even publications describing very complex algorithms often include circuit diagrams implementing novel functions to improve efficiency (&lt;em&gt;e.g.&lt;/em&gt;  &lt;a href=&quot;https://arxiv.org/abs/1902.02134&quot; rel=&quot;noreferrer&quot;&gt;Fig. 1: controlled SELECT&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum circuit model is also one of the more intuitive ways to depict quantum computations.  Quantum circuits are a restricted form of tensor networks (&lt;em&gt;see e.g.&lt;/em&gt; &lt;a href=&quot;https://arxiv.org/abs/1708.00006&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;), which are often used more broadly in both physics and classical computing (particularly in machine learning).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Microsoft seems to be one of the leaders in terms of developing the level of abstraction of quantum computation that you seem to be referring to, embodied in Q#.  However, effective abstraction is not always straightforward or necessarily more intuitive (&lt;em&gt;see e.g.&lt;/em&gt; &lt;a href=&quot;https://devblogs.microsoft.com/qsharp/qubits-in-qsharp/&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-11-19T14:52:27.367" LastActivityDate="2019-11-19T14:52:27.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8853" PostTypeId="2" ParentId="8715" CreationDate="2019-11-19T15:35:35.963" Score="0" Body="&lt;p&gt;This is my attempt. Let's say the list looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\dots$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are numbers. The variables (unknowns) are the Hamiltonian and the energy eigenvectors&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with the following tricks: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We assume &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (number of measurements) is a large number. This enables us to &lt;a href=&quot;https://en.wikipedia.org/wiki/Regression_toward_the_mean&quot; rel=&quot;nofollow noreferrer&quot;&gt;say&lt;/a&gt; the distribution observed &lt;span class=&quot;math-container&quot;&gt;$\{ M \}$&lt;/span&gt; is the most probable distribution*.&lt;/li&gt;&#xA;&lt;li&gt;By *most probable we mean the expectation empirically is the most probable expectation value to be measured. For example the expectation is: &lt;span class=&quot;math-container&quot;&gt;$$ \langle H \rangle = \frac{m_1 \lambda_1 + m_2 \lambda_2 + \dots + m_n \lambda_n}{M}$$&lt;/span&gt;  &lt;/li&gt;&#xA;&lt;li&gt;Where we count the frequency of the of a particular eigenvalues with&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \lambda_k$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m_i$&lt;/span&gt;. Hence, for a particular eigenvalue&#xA;&lt;span class=&quot;math-container&quot;&gt;$m_i$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Obviously intermediary measurements are being done otherwise the same energy eigenvalue would be on the list. We will assume the observable used (to change the state) was &lt;span class=&quot;math-container&quot;&gt;$\hat O$&lt;/span&gt; with kets &lt;span class=&quot;math-container&quot;&gt;$|o_i \rangle$&lt;/span&gt;. Then the probability of the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; arriving through that particular state (with no degeneracy)&lt;span class=&quot;math-container&quot;&gt;$| \lambda_k \rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$$ P_i( \lambda_k ) = | \langle o_i | \lambda_k \rangle |^2 = \frac{m_k}{M}$$&lt;/span&gt; Do note: the eigenvector is essentially not known.&lt;/li&gt;&#xA;&lt;li&gt;We use the following trick (from statistical mechanics) of multinomial theorem: &lt;span class=&quot;math-container&quot;&gt;$$ (a_1+a_2 +a_3 + \dots +a_M )^M = \sum \frac{M!}{b_1!b_2! \dots b_M!} {a_1}^{b_1}{a_2}^{b_2} \dots {a_n}^{b_n}$$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;Now choosing &lt;span class=&quot;math-container&quot;&gt;$b_j \to m_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_j \to P(\lambda_j)$&lt;/span&gt;. We should get a coefficient of the probability of obtaining our particular distribution which is: &lt;span class=&quot;math-container&quot;&gt;$$ P_i(\{M \}) = \frac{M!}{m_1!m_2! \dots m_M!}  $$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;Using point (&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;) the probability obtained is the most probable distribution. Hence, by varying the eigenkets claim the correct eigenkets would maximize the below: &lt;span class=&quot;math-container&quot;&gt;$$   P_i(\{ M \}) = \max P_i(\{ M' \}) \implies \frac{M!}{m_1!m_2! \dots m_M!} = \max  \prod_k \frac{M!}{(M | \langle o_i | \lambda_k \rangle |^2)!} $$&lt;/span&gt;&#xA;Taking log and maximising will work as well.&lt;/li&gt;&#xA;&lt;li&gt;It should be possible to talk about a mix of eigenkets such as &lt;span class=&quot;math-container&quot;&gt;$| o_k \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$| o_i \rangle$&lt;/span&gt;, etc (using density matrices). It should also be possible consider variations of degenerate eigenvalues (in a similar style shown in the question). Again one would have to consider which outcome maximizes the probability.&lt;/li&gt;&#xA;&lt;li&gt;Once, one has the eigenkets one can use the spectral theorem to write the Hamiltonian. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="5045" LastEditDate="2019-11-24T09:35:11.297" LastActivityDate="2019-11-24T09:35:11.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8854" PostTypeId="1" CreationDate="2019-11-19T18:36:23.437" Score="-1" ViewCount="82" Body="&lt;p&gt;The qubit is able to take on multiple states at once, unlike the bit. This property I know is superposition, but is this property perpetual (always on) or optional (controlled to be on or off only when needed by an algorithm, such that when not needed, the qubit reverts to, or takes on the disguise of, a bit)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and how does perpetual/optional superposition play into the notion of quantum parallelism: Does the qubit always execute parallel computations and incapable of a uni-sequential workflow, or can it be controlled to execute tasks in parallel only when the algorithm deems it necessary? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, &lt;strong&gt;what is the difference or connection between superposition and quantum parallelism&lt;/strong&gt; and &lt;strong&gt;are these properties always active&lt;/strong&gt; in a quantum algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;optional&lt;/em&gt;: Circuit diagrams that demonstrate example comparisons of &quot;superposition/parallelism on&quot; and &quot;superposition/parallelism off&quot; can be included as long as each item (line, gate and symbol) is annotated as a bullet point list.)&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9118" LastEditDate="2019-11-19T18:46:16.387" LastActivityDate="2019-11-19T22:57:13.593" Title="Can quantum parallelism be turned on and off?" Tags="&lt;superposition&gt;&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8855" PostTypeId="2" ParentId="8849" CreationDate="2019-11-19T19:14:45.987" Score="7" Body="&lt;p&gt;In classical computing, both circuit diagrams and pseudo-code are used to explain algorithms. The choice between circuits and pseudo-code depends on the context. If the goal is to explain a highly optimized implementation of an algorithm on &lt;a href=&quot;https://en.wikipedia.org/wiki/Field-programmable_gate_array&quot; rel=&quot;noreferrer&quot;&gt;FPGA&lt;/a&gt;, a circuit diagram is probably more suitable. For example, see this paper on &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-540-45238-6_26&quot; rel=&quot;noreferrer&quot;&gt;AES implementation on FPGA&lt;/a&gt;. Pedagogical explanation of &lt;a href=&quot;https://en.wikipedia.org/wiki/Advanced_Encryption_Standard&quot; rel=&quot;noreferrer&quot;&gt;AES&lt;/a&gt; uses pseudo-code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly in quantum computing, if one wants to explain a highly optimized &lt;a href=&quot;https://arxiv.org/abs/1709.06648&quot; rel=&quot;noreferrer&quot;&gt;implementation of a modular adder&lt;/a&gt;, they resort to showing circuit diagrams. Papers focused on more high-level quantum algorithms frequently contain no quantum circuit diagrams and use pseudo-code instead. A good example of such a paper is &lt;a href=&quot;https://arxiv.org/pdf/0811.3171.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithm for linear systems of equations&lt;/a&gt;. If you look through papers referenced at &lt;a href=&quot;http://quantumalgorithmzoo.org/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Algorithm Zoo&lt;/a&gt;, you will find many that have no circuit diagrams in them. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that many people get the impression that 'circuit-speak' is so common because quantum computing is taught from the ground up. Quantum circuits are one of the first concepts many get exposed to when learning quantum computing. &lt;/p&gt;&#xA;" OwnerUserId="5445" LastActivityDate="2019-11-19T19:14:45.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8856" PostTypeId="2" ParentId="8854" CreationDate="2019-11-19T19:49:30.333" Score="1" Body="&lt;p&gt;'Quantum parallelism' is a common misconception - sure, the quantum computer does compute in a 'parallel' fashion, but really the power of quantum computing emerges from &lt;a href=&quot;https://www.askamathematician.com/2011/02/q-how-does-quantum-computing-work/&quot; rel=&quot;nofollow noreferrer&quot;&gt;constructive / destructive interference&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wanted, you could absolutely make a quantum computer behave in a classical format: constantly measure the qubits and correct if necessary. For example, if you had a qubit in &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} (|0\rangle + | 1 \rangle) $&lt;/span&gt; and desired a classical bit of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you can measure, and apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; if the qubit measured resolves to a &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="9006" LastEditDate="2019-11-19T22:57:13.593" LastActivityDate="2019-11-19T22:57:13.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8857" PostTypeId="2" ParentId="5073" CreationDate="2019-11-19T22:11:32.227" Score="3" Body="&lt;p&gt;This feature is now available using the &lt;code&gt;snapshot&lt;/code&gt; function of Qiskit Aer. Snapshots can be added to the circuit and the values are then returned in the results object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an example of how you can create a circuit, add a snapshot to it and then get the result:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;qc = QuantumCircuit(2)&#xA;qc.h(0)&#xA;qc.snapshot('1')             # add a snapshot with the key '1'&#xA;qc.h(0)                      # add more gates after the snapshot&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;result = execute(qc, backend).result()&#xA;snapshots = result.data()['snapshots']['statevector']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;snapshots&lt;/code&gt; now contains a dictionary where the keys are the names given to the snapshots, and the values are an array of state vectors associated with that key. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this example it is&lt;code&gt;{'1': [[[0.7071067811865476, 0.0], [0.7071067811865475, 0.0], [0.0, 0.0], [0.0, 0.0]]]}&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-19T22:11:32.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8858" PostTypeId="1" AcceptedAnswerId="8861" CreationDate="2019-11-20T05:44:16.313" Score="0" ViewCount="62" Body="&lt;p&gt;This is going to look like homework because it is from a self-inflected Coursera course. I have already found the answer by trial and error but I want to clear my logic. (Coz I'm not getting sleep otherwise and I can't ask the question in Coursera without revealing too much and ruining the quiz for others.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hGVAF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hGVAF.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead of doing the long math here I used the online calculator: here’s a &lt;a href=&quot;https://www.symbolab.com/solver/complex-numbers-calculator/%5Cfrac%7B1%7D%7B%5Csqrt%7B%5Cleft%7C-%5Cfrac%7B%5Cleft(1%2B%5Csqrt%7B3%7Di%5Cright)%7D%7B4%5Csqrt%7B2%7D%7D%5Cright%7C%5E%7B2%7D%2B%5Cleft%7C%5Cfrac%7B%5Cleft(1-%5Csqrt%7B3%7Di%5Cright)%7D%7B4%5Csqrt%7B2%7D%7D%5Cright%7C%5E%7B2%7D%2B%5Cleft%7C-%5Cfrac%7B%5Cleft(1-%5Csqrt%7B3%7Di%5Cright)%7D%7B4%5Csqrt%7B2%7D%7D%5Cright%7C%5E%7B2%7D%2B%5Cleft%7C-%5Cfrac%7B%5Cleft(1%2B%5Csqrt%7B3%7Di%5Cright)%7D%7B4%5Csqrt%7B2%7D%7D%5Cright%7C%5E%7B2%7D%7D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TzT4y.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TzT4y.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once again online calculator to help : &lt;a href=&quot;https://www.symbolab.com/solver/complex-numbers-calculator/%5Cleft%7C%5Cleft(%5Cfrac%7B1%2B%5Csqrt%7B3%7Di%7D%7B4%7D-%5Cfrac%7B1-%5Csqrt%7B3%7Di%7D%7B4%7D%5Cright)%5Cright%7C%5E%7B2%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result comes out as 3/4 but the expected answer is set as 1/2.&#xA;Can anyone help? I might be missing something very simple.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Edit&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The complete solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}|\phi| = {(1+ \sqrt{3}i) \over 4\sqrt{2}}(|+\rangle +|-\rangle)|0\rangle+{(1- \sqrt{3}i)\over 4\sqrt{2}}(|+\rangle + |-\rangle)|1\rangle \\ + {(1- \sqrt{3}i) \over 4\sqrt{2}}(|+\rangle-|-\rangle)|0\rangle+{(1+ \sqrt{3}i) \over 4\sqrt{2}}(|+\rangle - |-\rangle)|1\rangle\end{aligned}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By dropping the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; combinations we are left with &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}|\phi| = {(1+ \sqrt{3}i) \over 4\sqrt{2}}|-\rangle|0\rangle-{(1- \sqrt{3}i) \over 4\sqrt{2}}\rangle|1\rangle+{(1- \sqrt{3}i) \over 4\sqrt{2}}|-\rangle|0\rangle-{(1+ \sqrt{3}i) \over 4\sqrt{2}}|-\rangle|1\rangle\end{aligned}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where I was wrong to not solve it even further.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi| = ({(1+ \sqrt{3}i) \over 4\sqrt{2}}-{(1- \sqrt{3}i) \over 4\sqrt{2}})|-\rangle|0\rangle+({(1- \sqrt{3}i) \over 4\sqrt{2}}-{(1+ \sqrt{3}i) \over 4\sqrt{2}})|-\rangle|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi| = {\sqrt{3}i \over 2\sqrt{2}}|-\rangle|0\rangle-{\sqrt{3}i \over 2\sqrt{2}}|-\rangle|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, we normalize this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi| = {({\sqrt{3}i \over 2\sqrt{2}}|-\rangle|0\rangle-{\sqrt{3}i \over 2\sqrt{2}}|-\rangle|1\rangle) \over \sqrt {{\left|\sqrt{3}i \over 2\sqrt{2}\right|^2}+{\left|\sqrt{3}i \over 2\sqrt{2}\right|^2}}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi| = {2\sqrt{3} \over 3} . {\sqrt{3}i \over 2\sqrt{2}}|-\rangle|0\rangle-{2\sqrt{3} \over 3}.{\sqrt{3}i \over 2\sqrt{2}}|-\rangle|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi| = {1 \over \sqrt{2}}|-\rangle|0\rangle-{1 \over \sqrt{2}}|-\rangle|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the probably of second qubit: &lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle)$&lt;/span&gt; when the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; is :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi| = {\left ({1 \over \sqrt{2}}\right )}^2 = \frac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9193" LastEditorUserId="26" LastEditDate="2019-11-27T13:20:10.613" LastActivityDate="2019-11-27T13:20:10.613" Title="Beginners doubt: calculating probability of one qubit based on other in a 2 qubit system" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8859" PostTypeId="1" CreationDate="2019-11-20T05:48:19.700" Score="3" ViewCount="68" Body="&lt;p&gt;What areas of research in NISQ algorithms have heavy focus? I'm interested in quantum chemistry algorithms because of previous work (e.g. VQEs), and I'd love to learn more about other near-term algorithms that are being explored.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="8343" LastEditDate="2019-11-20T15:53:23.257" LastActivityDate="2019-11-21T11:56:20.873" Title="Active areas of research for NISQ algorithms" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;research&gt;&lt;nisq&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8860" PostTypeId="2" ParentId="8858" CreationDate="2019-11-20T06:16:09.250" Score="1" Body="&lt;p&gt;There is no long math, and you need not online calculators. When you simply omit &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state of the first qubit after the measurement, the resulting 2-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\Phi\rangle$&lt;/span&gt; is &lt;em&gt;unnormalized&lt;/em&gt;. You just need to factor out the state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; of the first qubit and &lt;em&gt;normalize&lt;/em&gt; the remaining state of the second qubit before obtaining the final answer.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2019-11-20T06:21:11.823" LastActivityDate="2019-11-20T06:21:11.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8861" PostTypeId="2" ParentId="8858" CreationDate="2019-11-20T06:16:57.917" Score="2" Body="&lt;p&gt;In the line immediately before Step 2, you have like terms that can be combined. Combine these, &lt;em&gt;then&lt;/em&gt; renormalize the vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recognize that your misstep lies in the properties of the amplitude. Generally, for some &lt;span class=&quot;math-container&quot;&gt;$a, b$&lt;/span&gt; components and &lt;span class=&quot;math-container&quot;&gt;$x, y$&lt;/span&gt; separation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a + bi|^2 \neq |x + yi|^2 + |(a - x) + (b - y)i|^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, the like terms aren't combined, so we're combining the probabilities of the individual terms, which doesn't hold.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-11-20T06:16:57.917" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8862" PostTypeId="1" AcceptedAnswerId="8863" CreationDate="2019-11-20T06:32:28.413" Score="4" ViewCount="845" Body="&lt;p&gt;I have read some of the other decomposition questions &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4975/how-do-i-build-a-gate-from-a-matrix-on-qiskit&quot;&gt;here&lt;/a&gt; however still don't understand how to do it manually. The matrix I wish to decompose is the following for 2 qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M=\frac{1}{\sqrt2}\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp;  0&amp;amp; i\\ &#xA;0 &amp;amp;  1&amp;amp; i &amp;amp; 0\\ &#xA;0 &amp;amp; i &amp;amp; 1 &amp;amp; 0\\ &#xA;i &amp;amp;  0&amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have used the Qiskit circuit decompose to find that it corresponds to the following image, but I don't understand how that was done.&lt;a href=&quot;https://i.stack.imgur.com/DFav6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DFav6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also Qiskit is only able to decompose for up to 2 qubits. My application for the matrix expands beyond 2 qubits and I would also like to know how to decompose for more.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help on the step by step process of decomposition would be appreciated as well as any insight on multiple qubit decomposition :)&lt;/p&gt;&#xA;" OwnerUserId="8405" LastEditorUserId="55" LastEditDate="2019-11-26T10:40:23.747" LastActivityDate="2019-11-26T10:40:23.747" Title="How to decompose this two-qubit unitary matrix to the standard gate set?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8863" PostTypeId="2" ParentId="8862" CreationDate="2019-11-20T07:36:33.183" Score="6" Body="&lt;p&gt;I found paper &lt;a href=&quot;https://arxiv.org/pdf/1501.06911.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum Circuits for Isometries&lt;/a&gt; to be a useful reference on the topic. It describes several methods for decomposing multi-qubit unitaries into CNOT gates and qubit unitaries and also gives several references to earlier related works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is also a &lt;a href=&quot;https://github.com/Q-Compiler/UniversalQCompiler&quot; rel=&quot;noreferrer&quot;&gt;Mathematica package&lt;/a&gt; that implements algorithms described in the mentioned paper. If you don't have Mathematica you can still probably run it using &lt;a href=&quot;https://www.wolfram.com/engine/&quot; rel=&quot;noreferrer&quot;&gt;Wolfram Engine&lt;/a&gt; and &lt;a href=&quot;https://github.com/WolframResearch/WolframLanguageForJupyter&quot; rel=&quot;noreferrer&quot;&gt;Wolfram Language for Jupyter&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For decomposition of two-qubit unitaries with minimal CNOT count &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308033&quot; rel=&quot;noreferrer&quot;&gt;quant-ph/0308033&lt;/a&gt; is a good reference.&lt;/p&gt;&#xA;" OwnerUserId="5445" LastActivityDate="2019-11-20T07:36:33.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8864" PostTypeId="1" CreationDate="2019-11-20T08:18:07.420" Score="-1" ViewCount="134" Body="&lt;p&gt;What will happen if the two qubits in Bell state for a 2-qubit system, &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(\left|00\right\rangle+\left|11\right\rangle)$&lt;/span&gt; are simultaneously measured at the same instant? Two scenarios: Qubits are measured in the same states or different states. Has anyone tried to measure the qubits experimentally in IBM-Q? What is the answer from Quantum Mechanics?&lt;/p&gt;&#xA;" OwnerUserId="8120" LastEditorUserId="26" LastEditDate="2019-11-20T16:22:15.490" LastActivityDate="2019-11-20T16:22:15.490" Title="Bell state: simultaneous measurement of two entangled qubits" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8865" PostTypeId="2" ParentId="8864" CreationDate="2019-11-20T08:24:10.783" Score="3" Body="&lt;p&gt;In theory, there is no difference between this and measuring one qubit and then the other. One way of thinking about this is from the perspective of inertial frames of reference in special relativity - for two separated parties, there is no global definition of simultaneous. Different observers can observe different orderings of space-like separated events. While this is not strictly built in to quantum mechanics, it does respect that structure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-20T08:24:10.783" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8866" PostTypeId="2" ParentId="8864" CreationDate="2019-11-20T12:26:51.710" Score="1" Body="&lt;p&gt;I tried to prepare and measure this Bell state on IBM Q. There is a low probablity, around few percent, that you measure states &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. But this is caused by a thermal noise and spontaneous break of the entangled state.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-20T12:26:51.710" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8867" PostTypeId="1" CreationDate="2019-11-20T12:40:06.203" Score="1" ViewCount="94" Body="&lt;p&gt;Recently, I used the transpile() function with the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level3.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;level 3 preset pass manager&lt;/a&gt; to compile a very long and complex circuit on a real device coupling map. I was curious to see how much the depth of the circuit would increase due to the inevitable swaps. The result was quite strange, the depth of the transpiled circuit was an order of magnitude lower than the original circuit.&lt;/p&gt;&#xA;&lt;p&gt;When I drew the transpiled circuit I found that it was composed of some strange multi-qubit gates labeled as 'unitary' (see picture below), while most of the two-qubits gates from the original circuit were gone.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9AFj7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9AFj7.png&quot; alt=&quot;unitary&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was wondering what these unitaries could mean.&lt;/p&gt;&#xA;" OwnerUserId="9200" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-11-20T15:54:56.263" Title="Strange circuit with multi-qubit 'unitary' gates after transpiler with optimization level 3" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8868" PostTypeId="1" AcceptedAnswerId="8870" CreationDate="2019-11-20T13:11:49.877" Score="2" ViewCount="241" Body="&lt;p&gt;In IBM Q-Experience how can I upload a data file that I intend to read from the python code?&lt;/p&gt;&#xA;" OwnerUserId="9201" LastActivityDate="2019-11-20T13:30:54.013" Title="Data file read/write from within IBM Q-Experience Jupyter notebook" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8869" PostTypeId="2" ParentId="8849" CreationDate="2019-11-20T13:21:12.117" Score="2" Body="&lt;p&gt;&lt;strong&gt;There are no classical registers in quantum computing&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In classical computers you can have a well defined &amp;quot;current state at a given time&amp;quot; (stored notably in CPU registers and DRAM memory in modern systems), and this state changes with time (each CPU clock) in a controlled way.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, it is easier to map sequential description of an algorithm back to classical real hardware. For example, a classical algorithm might be described sequentially as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a = b + c&#xA;d = 2 * a&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and in a classical computer this might actually be implemented in two separate steps:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a CPU clock happens&lt;/li&gt;&#xA;&lt;li&gt;one ADD instruction that stores the intermediate result to a register that represent &lt;code&gt;a&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;a CPU clock happens&lt;/li&gt;&#xA;&lt;li&gt;one MUL instruction which stores the final result to a register that represnts &lt;code&gt;d&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;a CPU clock happens&lt;/li&gt;&#xA;&lt;li&gt;...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In quantum computing however, you cannot save the &amp;quot;intermediate state of a computation&amp;quot; and operate on it in a later step: you set up the inputs  and the circuit, and information flows in a single indivisible step to the sensor device at the end of the circuit which makes a probabilistic reading.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, unless we are treating quantum circuits as black boxes between classical registers, sequential algorithm descriptions don't make much sense.&lt;/p&gt;&#xA;&lt;p&gt;It is this fact that makes quantum computers much harder to program.&lt;/p&gt;&#xA;&lt;p&gt;So a more likely useful description of quantum computing looks more like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Combinational_logic&quot; rel=&quot;nofollow noreferrer&quot;&gt;combinatorial logic blocks&lt;/a&gt; (i.e. blocks with no registers and therefore no state) in hardware description languages such as Verilog and VHDL, which are just textual descriptions of a graph of circuits.&lt;/p&gt;&#xA;&lt;p&gt;For example, in a Verilog combinatorial block, when you say:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a = b + c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;it doesn't mean &amp;quot;on the next clock cycle of the algorithm, the register &lt;code&gt;a&lt;/code&gt; will be worth &lt;code&gt;b + c&lt;/code&gt;&amp;quot; like in say C or Python.&lt;/p&gt;&#xA;&lt;p&gt;It rather means:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;a&lt;/code&gt; is a wire,&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;b&lt;/code&gt; is a wire&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;c&lt;/code&gt; is a wire&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;+&lt;/code&gt; is an adding circuit with &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt; as inputs and &lt;code&gt;a&lt;/code&gt; as output&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Therefore, as soon as &lt;code&gt;b&lt;/code&gt; or &lt;code&gt;c&lt;/code&gt; change, &lt;code&gt;a&lt;/code&gt; also &amp;quot;immediately&amp;quot; changes. With &amp;quot;immediately&amp;quot; in quotes because in practice electrons do take some time to move, and so we can't take the clock smaller than this propagation time.&lt;/p&gt;&#xA;&lt;p&gt;A &amp;quot;propagation time&amp;quot; analogue is also present in quantum computers, where each experiment takes some time to finish, and the faster that time, the faster you can rerun the experiment to reduce uncertitude of the result.&lt;/p&gt;&#xA;&lt;p&gt;Of course, for any maximum input size, you could make one huge combinatorial circuit that implements that algorithm. But in classical computing we don't do that because silicon is expensive to design and produce, so it is much more economical to design a circuit that solves a wider range of problems than a huge specialized circuit, even if each problem is solved a bit less fast.&lt;/p&gt;&#xA;&lt;p&gt;In quantum computers, you don't have a choice. Unless you can use a divide and conquer style algorithm to generate smaller subproblems (which generally implies a P problem which might not be so interesting to a quantum computer), you just need a minimum number of qubits and gates for each given algorithm.&lt;/p&gt;&#xA;" OwnerUserId="4243" LastEditorUserId="4243" LastEditDate="2020-10-22T16:50:54.130" LastActivityDate="2020-10-22T16:50:54.130" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8870" PostTypeId="2" ParentId="8868" CreationDate="2019-11-20T13:30:54.013" Score="3" Body="&lt;p&gt;If you go to the Qiskit Notebooks section, you will see this button &lt;a href=&quot;https://i.stack.imgur.com/m5jHD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m5jHD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you click import you can chose to upload the file from your computer into IQX.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-20T13:30:54.013" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8871" PostTypeId="2" ParentId="8867" CreationDate="2019-11-20T13:41:04.387" Score="1" Body="&lt;p&gt;The point of the transplier is not only to map circuits to backends, but also to optimize the circuit to reduce the number of gates it contains so that the results you receive will (hopefully) be better. This is done through a series of optimizations, provided by things called transpiler passes. There is more information about them &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/terra/4_transpiler_passes_and_passmanager.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary&lt;/a&gt; in this case is  quantum gate which can be represented by a matrix. You could try calling &lt;code&gt;to_matrix()&lt;/code&gt; on this gate so you can see what action it is performing. It may have been formed by combining several gates into one. The &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; labels show which qubits it is acting on.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-20T13:41:04.387" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8872" PostTypeId="1" CreationDate="2019-11-20T14:14:05.163" Score="0" ViewCount="79" Body="&lt;p&gt;I recently attended a seminar where a professor of quantum cryptography told the audience that one quantum qubit can theoretically store &quot;infinite information&quot;. I was very intrigued by this statement, and me being an absolute novice in this domain, do not have the means of verifying the validity of his statement. My questions are as follows: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;ol&gt;&#xA;  &lt;li&gt;Can we really compute the distance &lt;span class=&quot;math-container&quot;&gt;$|x - y| &amp;lt; \epsilon$&lt;/span&gt; using a quantum qubit? If so, can anyone throw light on how this is done? &lt;/li&gt;&#xA;  &lt;li&gt;Also, if not, how far along are we in actually computing this quantity? &lt;/li&gt;&#xA;  &lt;li&gt;Can we measure if quantum computers approximate this quantity better (or worse?) than classical computers?&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot in advance! &lt;/p&gt;&#xA;" OwnerUserId="8989" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:39.770" LastActivityDate="2020-11-24T14:22:39.770" Title="How close are we in achieving computation over reals using quantum qubits?" Tags="&lt;models&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-11-21T13:05:30.787" ContentLicense="CC BY-SA 4.0" />
  <row Id="8873" PostTypeId="1" AcceptedAnswerId="8874" CreationDate="2019-11-20T14:38:45.667" Score="1" ViewCount="46" Body="&lt;p&gt;If an individual or commercial enterprise resorts to renting quantum computing power on the cloud, wouldn't the company who owns and hosts the quantum computer be able to see/monitor/eavesdrop on the electronic transmissions that their customers make, causing privacy concerns? And about adoption, first of all, how has the business and usage statistics of renting cloud services been for supercomputers anyway?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About error correction, How would the user be able to verify the reliability of the estimates and solutions returned by the superconductor they are renting, given how the current state of the technology is widely known to lack error correction mechanisms, or is that just a misconception?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="26" LastEditDate="2019-11-20T15:52:55.610" LastActivityDate="2019-11-20T16:33:52.163" Title="Renting quantum on the cloud: data privacy, adoption and error correction" Tags="&lt;error-correction&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8874" PostTypeId="2" ParentId="8873" CreationDate="2019-11-20T15:20:47.420" Score="1" Body="&lt;p&gt;These are two separate questions, so I will (try to) answer them separately as well.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Concerning the (reduction of) privacy in remote or cloud computing.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Without any alterations, the instructions for a quantum computation that is to be run on a remote computer can be seen by that remote computer. That is to say, if you want to conceal the computations that you want to perform (be it the &lt;em&gt;type&lt;/em&gt; of computations or the &lt;em&gt;input&lt;/em&gt; to said operation), this is not possible using this approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a parallel to be made to classical remote computation: there exist methods to hide/encrypt the input parameters to some remote computation, which is known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Homomorphic_encryption&quot; rel=&quot;nofollow noreferrer&quot;&gt;Homomorphic encryption&lt;/a&gt;. This can be used to hide the input parameters of the quantum computation as well, in principle.&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To conceal the &lt;strong&gt;&lt;em&gt;type&lt;/em&gt;&lt;/strong&gt; of computation that you want to perform, is a much more challenging task. There is no way of doing this in classical computation that I know of, but there is a method that can be used in quantum computing.&#xA;For this to work, you need to have a quantum channel to the remote machine (i.e. an internet-type link over which you can send &lt;strong&gt;qu&lt;/strong&gt;bits). This method is known as &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0025-3.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;blind quantum computing&lt;/a&gt;, and is very much in an active area of research.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Concerning error correction, or the lack thereof&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;You are right in saying that current quantum computers have too few qubits to perform active reliable error correction. This is true for both local and remote quantum computers. However, the answers of most computations that quantum computers perform are relatively easy to test: they are hard to compute, but easy to assert. This means that one just tests the answer returned by the remote machine and through that determines the reliability of the remote machine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, there exist types of computations that are less affected by the current noise levels of qubits; see for instance &lt;a href=&quot;https://arxiv.org/pdf/1509.04279.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE's&lt;/a&gt;. These types of algorithms are more readily implemented on current hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt; &lt;em&gt;I believe that this is the case, I am not an expert on the matter.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2019-11-20T16:33:52.163" LastActivityDate="2019-11-20T16:33:52.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8876" PostTypeId="2" ParentId="8843" CreationDate="2019-11-20T18:52:07.457" Score="2" Body="&lt;p&gt;The comment made by arriopolis is correct.  The output registers of these compiled circuits are important for synthesizing the circuit, but not particularly interesting to measure.  As you saw already, those measurements just match the truth tables they were designed to match.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The QFT and measurements intended for this circuit are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wRroy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wRroy.png&quot; alt=&quot;Fig. 5 Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives the probability distributions&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nPcIr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nPcIr.png&quot; alt=&quot;Fig. 5 Histogram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If the code implementing any of this would be helpful to anyone, just let me know in the comments.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The significance of these probability distributions is that they match the expectations of theory for analogous registers of a general implementation of Shor's algorithm.  The authors show how this works in detail in Section V, along with proposed uses including quantifying entanglement capacity and noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The punchline is that these distributions match the diagonal elements of a reduced density matrix, tracing over the output register to get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_p \equiv \text{tr}_o(\vert \phi_p \rangle \langle \phi_p \vert).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are tabulated for this particular case in Table XI (it's clear &lt;em&gt;a priori&lt;/em&gt; that &lt;span class=&quot;math-container&quot;&gt;$p=3$&lt;/span&gt;). Note that the authors' intent to represent binary numbers in the registers by integers was made clear earlier in the section.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the circuit above is only an intermediate step towards the authors' aim of substantial simplification of a complex circuit.  For example, the composite density matrix for this circuit, which is a necessary step in getting to Table XI, has dimension &lt;span class=&quot;math-container&quot;&gt;$2^8 \times 2^8$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Noting that 5 qubits are used to represent three values (1, 4, and 16) on the output register, the authors use a &lt;span class=&quot;math-container&quot;&gt;$\text{log}_4$&lt;/span&gt; map to synthesize the much improved circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M7VAk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M7VAk.png&quot; alt=&quot;Fig. 6 Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which remarkably has the same probability distribution on the input register (&lt;em&gt;i.e.&lt;/em&gt; matches the same row in Table XI) and maintains the &lt;span class=&quot;math-container&quot;&gt;$\text{log}_4$&lt;/span&gt; map between output registers.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-11-20T19:10:42.493" LastActivityDate="2019-11-20T19:10:42.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8877" PostTypeId="1" CreationDate="2019-11-20T20:42:53.190" Score="1" ViewCount="39" Body="&lt;p&gt;OpenQasmReader was added in &lt;a href=&quot;https://github.com/microsoft/Quantum/pull/58&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/Quantum/pull/58&lt;/a&gt;. I can't find this code on the latest clone of the aforementioned repository. Going through the commits, I found that it had been de-referenced in the &lt;a href=&quot;https://github.com/microsoft/Quantum/pull/235/files&quot; rel=&quot;nofollow noreferrer&quot;&gt;README&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2019-11-20T20:42:53.190" Title="Where is OpenQasmReader in Q#?" Tags="&lt;q#&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8878" PostTypeId="2" ParentId="8877" CreationDate="2019-11-20T20:42:53.190" Score="1" Body="&lt;p&gt;OpenQasmReader was moved to &lt;a href=&quot;https://github.com/qsharp-community/qsharp-integrations&quot; rel=&quot;nofollow noreferrer&quot;&gt;another repository&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2019-11-20T20:42:53.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8879" PostTypeId="2" ParentId="1631" CreationDate="2019-11-20T21:51:05.373" Score="2" Body="&lt;p&gt;Entanglement is a quantum physical phenomenon, demonstrated in practical experiments, mathematically modeled in quantum mechanics. We can come up with several creative speculations of what it is (philosophically), but at the end of the day we just have to accept it and trust the math.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a statistics point of view we can think of it as a complete correlation (1 or -1) between two random variables (the qubits). We may not know any these variables outcome beforehand, but once we measure one of them, due to the correlation, the other will be previsible.&#xA;I recently wrote an &lt;a href=&quot;https://thomasvilhena.com/2019/11/quantum-computing-for-programmers&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; on how quantum entanglement is handled by a quantum computing simulator, wich you may find helpful as well.&lt;/p&gt;&#xA;" OwnerUserId="9207" LastActivityDate="2019-11-20T21:51:05.373" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8881" PostTypeId="2" ParentId="2151" CreationDate="2019-11-21T00:25:42.750" Score="5" Body="&lt;p&gt;The most recent quantum machine learning textbook is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.springer.com/gp/book/9783319964232&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Schuld and Petruccione (2018). &lt;em&gt;Supervised Learning with Quantum Computers&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while a nice companion to Nielsen and Chuang for introductory quantum maths is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/B9780123838742000011&quot; rel=&quot;noreferrer&quot;&gt;&lt;strong&gt;Marinescu and Marinescu (2011). &lt;em&gt;Classical and Quantum Information&lt;/em&gt;&lt;/strong&gt;,&#xA;Chapter 1: Preliminaries&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9118" LastEditDate="2019-11-21T00:41:02.577" LastActivityDate="2019-11-21T00:41:02.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8882" PostTypeId="1" AcceptedAnswerId="8884" CreationDate="2019-11-21T09:13:03.253" Score="1" ViewCount="462" Body="&lt;p&gt;I have the really odd problem when it comes to plotting Bloch spheres using QuTip. Plotting state vectors works perfectly fine e.g.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qutip import *&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;b = Bloch()&#xA;s = Qobj([[1],[0]])&#xA;b.add_states(s)&#xA;b.show()    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But when I try to plot points on the Bloch sphere using QuTiP&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qutip import *&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;b = Bloch()&#xA;pnt = [1,1,1]&#xA;b.add_points(pnt)&#xA;b.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the following error message&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/matplotlib/backends/backend_macosx.py&quot;, line 80, in _draw&#xA;    self.figure.draw(renderer)&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/matplotlib/artist.py&quot;, line 38, in draw_wrapper&#xA;    return draw(artist, renderer, *args, **kwargs)&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/matplotlib/figure.py&quot;, line 1709, in draw&#xA;    renderer, self, artists, self.suppressComposite)&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/matplotlib/image.py&quot;, line 135, in _draw_list_compositing_images&#xA;    a.draw(renderer)&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/matplotlib/artist.py&quot;, line 38, in draw_wrapper&#xA;    return draw(artist, renderer, *args, **kwargs)&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py&quot;, line 292, in draw&#xA;    reverse=True)):&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/axes3d.py&quot;, line 291, in &amp;lt;lambda&amp;gt;&#xA;    key=lambda col: col.do_3d_projection(renderer),&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py&quot;, line 545, in do_3d_projection&#xA;    ecs = (_zalpha(self._edgecolor3d, vzs) if self._depthshade else&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py&quot;, line 847, in _zalpha&#xA;    rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))&#xA;  File &quot;&amp;lt;__array_function__ internals&amp;gt;&quot;, line 6, in broadcast_to&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/numpy/lib/stride_tricks.py&quot;, line 182, in broadcast_to&#xA;    return _broadcast_to(array, shape, subok=subok, readonly=True)&#xA;  File &quot;/Users/turbotanten/anaconda3/lib/python3.7/site-packages/numpy/lib/stride_tricks.py&quot;, line 127, in _broadcast_to&#xA;    op_flags=['readonly'], itershape=shape, order='C')&#xA;ValueError: operands could not be broadcast together with remapped shapes [original-&amp;gt;remapped]: (0,4) and requested shape (2,4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried using different matplotlib backends like TkAgg without any success. I don't know how to fix this problem.&lt;/p&gt;&#xA;" OwnerUserId="2136" LastEditorUserId="26" LastEditDate="2019-11-21T16:27:59.110" LastActivityDate="2019-11-21T16:27:59.110" Title="Can't plot points on the Bloch sphere (QuTip)" Tags="&lt;programming&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8883" PostTypeId="1" AcceptedAnswerId="8891" CreationDate="2019-11-21T10:09:35.707" Score="4" ViewCount="190" Body="&lt;p&gt;In Cirq, quantum circuit consists of moments, which in turn consists of operations. This is different from Qiskit/OpenQASM, which doesn’t have the concept of moments. What is the design philosophy behind the moment-based quantum circuit? What are the advantages and disadvantages of it? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a result of moments, one can insert operations in different moments using different insert strategies. It seems to me the earliest insert strategy is always preferred, which is the same as Qiskit/OpenQASM. What are the use cases for different insert strategies?&lt;/p&gt;&#xA;" OwnerUserId="7474" LastEditorUserId="26" LastEditDate="2019-11-21T16:27:45.543" LastActivityDate="2019-11-21T19:36:52.833" Title="Moments-based quantum circuit in Cirq" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8884" PostTypeId="2" ParentId="8882" CreationDate="2019-11-21T10:56:00.777" Score="1" Body="&lt;p&gt;I found a solution to my problem here &lt;a href=&quot;https://github.com/qutip/qutip/issues/1027&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qutip/qutip/issues/1027&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently plotting points on the Bloch sphere does not work with Matplotlib v3.1.0.&#xA;So I had to downgrade to v.3.0.3 for it to work!&lt;/p&gt;&#xA;" OwnerUserId="2136" LastActivityDate="2019-11-21T10:56:00.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8886" PostTypeId="1" CreationDate="2019-11-21T15:03:05.023" Score="0" ViewCount="77" Body="&lt;p&gt;I'm looking for an entrypoint to learning about quantum computing to which I'm exposed only by popular science articles and some qiskit materials so far. I understand that it's entirely possible that I'm insulated from the underlying math and implementation details, but I'm not interested in that. Considering my background is in classical programming, mostly imperative languages, what's a good book or set of other materials to get me started but with a view to eventually go deep?&lt;/p&gt;&#xA;" OwnerUserId="9215" LastEditorUserId="26" LastEditDate="2019-11-21T16:25:08.693" LastActivityDate="2019-11-21T16:25:08.693" Title="Intro to quantum computing for programmers" Tags="&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2019-11-25T21:31:47.420" ContentLicense="CC BY-SA 4.0" />
  <row Id="8887" PostTypeId="2" ParentId="8886" CreationDate="2019-11-21T15:22:06.013" Score="6" Body="&lt;p&gt;I don't think I agree - you really do need a grasp of quantum computing mechanics (including the math) in order to do any programming&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TLDR&lt;/strong&gt;: Quantum computers are so specialized and the software is so close to the physical realization that you need an understanding of the math of quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Here's my logic&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With classical computers, we have a large workforce of programmers who don't understand the physical implementation of bits, the semiconducting gates, etc. But, that's because the physical realization has been heavily abstracted away - we think in data structures that are far removed from bit realizations. So, they don't need to think of primitive logic gates when programming, as compilers already bring it to the bit level.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum computers, we don't have these far off abstractions yet - we barely can achieve 50+ qubits (with so-so error correction), so an understanding of the underlying mechanics of qubits is critical. &lt;strong&gt;Programming a quantum computer is modifying individual qubits with gates, so you need to understand how the gates affect qubits.&lt;/strong&gt; Also, quantum computers aren't meant for general computing - they're meant for tough, math heavy problems (like machine learning, molecular simulation, cryptography). &lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2019-11-21T15:22:06.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8888" PostTypeId="1" AcceptedAnswerId="8890" CreationDate="2019-11-21T16:02:43.137" Score="1" ViewCount="90" Body="&lt;p&gt;Could someone guide me on how to create my own &lt;code&gt;qiskit.result.models.ExperimentResultData&lt;/code&gt; object? I would simply like to create an object with some self-created dict of counts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Creating &lt;code&gt;qiskit.result.models.ExperimentalResults&lt;/code&gt; object is somehow easy, since by calling it from &lt;code&gt;qiskit.result.models.ExperimentResults&lt;/code&gt;, I simply pass the required attributes. But somehow I was not able to figure out how to do the same with &lt;code&gt;qiskit.result.models.ExperimentResultData&lt;/code&gt;, which should be passed as &quot;data&quot; attribute to &lt;code&gt;qiskit.result.models.ExperimentalResults&lt;/code&gt; object.&lt;/p&gt;&#xA;" OwnerUserId="9216" LastEditorUserId="5955" LastEditDate="2019-11-21T17:04:56.867" LastActivityDate="2019-11-21T17:04:56.867" Title="qiskit - Creating your own ExperimentResultData object" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8889" PostTypeId="1" CreationDate="2019-11-21T16:31:53.167" Score="2" ViewCount="343" Body="&lt;p&gt;If I consider &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle + b|01\rangle +c|10\rangle +d|11\rangle$&lt;/span&gt; as a valid two-qubit system, what is the probability of measuring the first qubit in state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0⟩+|1⟩)$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the probability of measuring the first qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|a|^2 + |b|^2$&lt;/span&gt;, but I couldn't figure out how it works here. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="9218" LastEditorUserId="55" LastEditDate="2019-11-22T14:50:18.727" LastActivityDate="2019-11-22T14:50:18.727" Title="Probability of measuring the first qubit in the state $\frac{1}{\sqrt 2}(|0⟩+|1⟩)$ in a two-qubit state" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8890" PostTypeId="2" ParentId="8888" CreationDate="2019-11-21T16:59:21.800" Score="1" Body="&lt;p&gt;You should be able to do this by simply creating an instance of the class. This can be done as follows &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.validation import base&#xA;raw_counts = {'0x0': 4, '0x2': 10}&#xA;data = models.ExperimentResultData(counts=base.Obj(**raw_counts))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are lot of examples of how to do this in the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/0caab4a3ec1f8ced437be59d1e77657922771392/test/python/result/test_result.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;testing file&lt;/a&gt; for these classes.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-11-21T16:59:21.800" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8891" PostTypeId="2" ParentId="8883" CreationDate="2019-11-21T19:36:52.833" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the design philosophy behind the moment-based quantum circuit? What are the advantages and disadvantages of it?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The basic idea is that we wanted to give users more control over what will actually happen on hardware. Whether or not two gates are run in parallel is really important information when dealing with noise (e.g. it determines total runtime), so it's important for users to be able to determine-whether that's happening and also control-if that's happening.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The philosophy of giving more control isn't limited to moments. Cirq also requires users to specify specific qubits (no implicit placement), and to use the native gateset of whatever device they are targeting (no implicit decomposition). The important thing is that you should be able to have a clear concrete idea of what will actually happen on the device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cirq also has the concept of a &quot;schedule&quot;, which has even more control over timing. But ironically we've found that users don't want to use it, and programmers don't like consuming it. So we're actually cutting that next version.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The list-of-moments structure seems to be a nice sweet spot in terms of flexibility, ease of production, and ease of consumption. You can certainly put the abstraction boundary in other places, but that's where we've found ourselves pulled towards.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It seems to me the earliest insert strategy is always preferred&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's a good rule of thumb, which is why it's the default. But it's not always optimal. For example, hardware may perform best when circuits are stratified into layers of single-qubit gates and layers of two-qubit gates (but never a layer with both single and two qubit gates). So even if you can move a single qubit operation earlier, that may result in it being in the same layer as two qubit operations. Moving it would not be a fatal mistake, the circuit would still run, but it might be slightly noisier. There are lots of &quot;little things&quot; like that when dealing with hardware.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-11-21T19:36:52.833" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8893" PostTypeId="1" AcceptedAnswerId="8894" CreationDate="2019-11-21T21:23:34.287" Score="7" ViewCount="393" Body="&lt;p&gt;Why is the order reversed on measurement?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import(&#xA;  QuantumCircuit,&#xA;  execute,&#xA;  Aer)&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;# Use Aer's qasm_simulator&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;&#xA;# Create a Quantum Circuit acting on the q register&#xA;circuit = QuantumCircuit(3, 3)&#xA;&#xA;# Add a X gate on qubit 0&#xA;circuit.x(0)&#xA;&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 1&#xA;circuit.cx(0, 1)&#xA;&#xA;circuit.barrier()&#xA;# Map the quantum measurement to the classical bits&#xA;circuit.measure([0,1,2], [0,1,2])&#xA;&#xA;# Execute the circuit on the qasm simulator&#xA;job = execute(circuit, simulator, shots=1000)&#xA;&#xA;# Grab results from the job&#xA;result = job.result()&#xA;&#xA;# Returns counts&#xA;counts = result.get_counts(circuit)&#xA;print(&quot;\nTotal count:&quot;,counts)&#xA;&#xA;# Draw the circuit&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Got result:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Total count for 00 and 11 are: {'011': 1000}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But I'm expecting '110'.&lt;/p&gt;&#xA;" OwnerUserId="9223" LastEditorUserId="9223" LastEditDate="2019-11-21T22:40:26.010" LastActivityDate="2021-04-27T19:04:42.357" Title="Why is the order reversed on measurement?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8894" PostTypeId="2" ParentId="8893" CreationDate="2019-11-21T22:39:40.450" Score="6" Body="&lt;p&gt;I still run into this issue too. If you consider &lt;span class=&quot;math-container&quot;&gt;$|q0\rangle$&lt;/span&gt; to be the most significant bit (MSB) you have to map it to the most significant classical bit as well, which is in your case a bit no. 2. Or you can flip your quatnum circuit upside down and then &lt;span class=&quot;math-container&quot;&gt;$|q0\rangle$&lt;/span&gt; become the least significant bit (LSB) and the measurement will meet your expectation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A code&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.measure([0,1,2], [0,1,2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is valid in case &lt;span class=&quot;math-container&quot;&gt;$|q0\rangle$&lt;/span&gt; is LSB and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.measure([0,1,2], [2,1,0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;in case &lt;span class=&quot;math-container&quot;&gt;$|q0\rangle$&lt;/span&gt; is MSB.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that the reason for this arrangement is simply a convention, so you can choose whether &lt;span class=&quot;math-container&quot;&gt;$|q0\rangle$&lt;/span&gt; is MSB or LSB and set the measurement procedure accordingly.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-21T22:39:40.450" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8895" PostTypeId="2" ParentId="5215" CreationDate="2019-11-21T23:30:31.353" Score="2" Body="&lt;p&gt;I will try to give an answer from complexity theory's point of view. This question should be asked in cs.stackexchange by the way. The Deutsch-Jozsa problem has an efficient algorithm on quantum computation and on a classical probabilistic Turing machine, so it is in &lt;strong&gt;BQP&lt;/strong&gt; and &lt;strong&gt;BPP&lt;/strong&gt;. There is no result that says: if you show a problem &lt;em&gt;A&lt;/em&gt; in &lt;strong&gt;BQP&lt;/strong&gt; and not in &lt;strong&gt;P&lt;/strong&gt;, then &lt;strong&gt;P&lt;/strong&gt; is different from &lt;strong&gt;BQP&lt;/strong&gt;. Thus, in order to prove &lt;strong&gt;P&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\ne$&lt;/span&gt; &lt;strong&gt;BQP&lt;/strong&gt;, first consider the probabilistic part of &lt;strong&gt;P&lt;/strong&gt; which is &lt;strong&gt;BPP&lt;/strong&gt; [since complexity theorist believe that &lt;strong&gt;P&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$=$&lt;/span&gt; &lt;strong&gt;BPP&lt;/strong&gt; and it is better to compare a a probabilistic version of &lt;strong&gt;P&lt;/strong&gt; with the quantum world of &lt;strong&gt;P&lt;/strong&gt;, which is &lt;strong&gt;BQP&lt;/strong&gt;] then according to complexity's theorist, they say that you need to prove something very hard like: &lt;strong&gt;P&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\ne$&lt;/span&gt; &lt;strong&gt;PSPACE&lt;/strong&gt; to work on this &lt;strong&gt;BBP&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$ \ne$&lt;/span&gt; &lt;strong&gt;BQP&lt;/strong&gt;, here is a part of the answer by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8618/how-does-successfully-sampling-from-a-random-quantum-circuit-invalidate-the-exte/8621#8621&quot;&gt;Greg Kuperberg&lt;/a&gt; says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;BQP&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\ne$&lt;/span&gt; &lt;strong&gt;BPP&lt;/strong&gt; is another thing that people can't prove, because they are both sandwiched between &lt;strong&gt;P&lt;/strong&gt; and &lt;strong&gt;PSPACE&lt;/strong&gt; and no one can prove that &lt;strong&gt;P&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$ \ne $&lt;/span&gt; &lt;strong&gt;PSPACE&lt;/strong&gt; either. (In fact it's worse than that, there are major results on how not to prove that &lt;strong&gt;P&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\ne$&lt;/span&gt; &lt;strong&gt;PSPACE&lt;/strong&gt;.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How is it that Deutsch-Jozsa has a probabilistic polynomial running time? Here for this &lt;a href=&quot;https://arxiv.org/abs/1508.05027&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, it states the following in page 2:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the Deutsch-Jozsa problem has an efficient solution on a classical probabilistic Turing machine [8, 9]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1899" LastEditorUserId="55" LastEditDate="2019-11-22T07:57:28.540" LastActivityDate="2019-11-22T07:57:28.540" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8896" PostTypeId="2" ParentId="8889" CreationDate="2019-11-22T00:02:39.307" Score="3" Body="&lt;p&gt;Given an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, if it is expressed in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1410/55&quot;&gt;computational basis&lt;/a&gt; as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_k c_k |k\rangle$&lt;/span&gt;, then it will give the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th result (when measuring in the computational basis) with probability &lt;span class=&quot;math-container&quot;&gt;$|c_k|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that here by &quot;computational basis&quot; I simply mean the measurement basis under consideration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you consider another type of measurement, corresponding to a different basis, say &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}_k$&lt;/span&gt;, then to figure out the outcome probabilities in this new basis you need to express &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in terms of the &lt;span class=&quot;math-container&quot;&gt;$|u_k\rangle$&lt;/span&gt;. Say that doing this you get something of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_k d_k |u_k\rangle.$$&lt;/span&gt;&#xA;That means that the outcome corresponding to &lt;span class=&quot;math-container&quot;&gt;$|u_k\rangle$&lt;/span&gt; is obtained with probability &lt;span class=&quot;math-container&quot;&gt;$|d_k|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you start with a description of the state in the &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; basis, and want to switch to a description in terms of the &lt;span class=&quot;math-container&quot;&gt;$|u_k\rangle$&lt;/span&gt; one, you simply need to compute the inner products &lt;span class=&quot;math-container&quot;&gt;$\langle u_k|\psi\rangle=d_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, given a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, the probability of finding it in a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$|\langle\phi|\psi\rangle|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is, however, a slightly more general way to do measurements, that doesn't (necessarily) involve a full collapse of the state. You can ask questions of the form &quot;&lt;em&gt;is the state in a given subspace?&lt;/em&gt;&quot;. For example, you can ask whether a state is in one of first &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; (or any other subset of) computational basis states. You model this situation by using a projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; that projects onto the required basis, and the associated measurement probability is then given by &lt;span class=&quot;math-container&quot;&gt;$\|P|\psi\rangle\|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking as an example your specific case, you have a bipartite state expressed in terms of the computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$&lt;/span&gt; with coefficients &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d$&lt;/span&gt;. Let's call this state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&#xA;You are asking about the probability of the state being found in the subspace &lt;span class=&quot;math-container&quot;&gt;$\{|+,0\rangle, |+,1\rangle\}$&lt;/span&gt;. To compute this probability you therefore write down the projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P = |+,0\rangle\!\langle +,0| + |+,1\rangle\!\langle +,1|&#xA;\equiv |+\rangle\!\langle +| \otimes I_2,$$&lt;/span&gt;&#xA;and you compute &lt;span class=&quot;math-container&quot;&gt;$\|P|\psi\rangle\|^2$&lt;/span&gt;.&#xA;Equivalently, you just rewrite &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; expressing the first qubit in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis, and then sum the probabilities of finding it in either &lt;span class=&quot;math-container&quot;&gt;$|+,u\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+,v\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\{|u\rangle,|v\rangle\}$&lt;/span&gt; the basis chosen for the second qubit (it doesn't matter which one is used).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-22T14:28:14.123" LastActivityDate="2019-11-22T14:28:14.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8898" PostTypeId="1" AcceptedAnswerId="9300" CreationDate="2019-11-22T01:27:33.227" Score="4" ViewCount="140" Body="&lt;p&gt;Many scientific programmers get by fine without having a computer science background, i.e. they don't need to know the machinery behind the prevailing paradigm of 0's and 1's (bits), let alone basic logic, to code. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this lack of awareness of &lt;em&gt;classical&lt;/em&gt; computing's inner workings, what are stand-out concepts from classical computing that every aspiring &lt;em&gt;quantum&lt;/em&gt; programmer should know?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="1386" LastEditDate="2019-12-03T10:06:27.413" LastActivityDate="2019-12-22T23:55:11.577" Title="What concepts from classical computing are vital for quantum programmers?" Tags="&lt;programming&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8900" PostTypeId="1" CreationDate="2019-11-22T05:32:42.030" Score="8" ViewCount="1684" Body="&lt;p&gt;DiVincenzo criteria for quantum communication mentions flying qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. The ability to interconvert stationary and flying qubits&#xA;b. The ability to faithfully transmit flying qubits between specified locations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what exactly is a flying qubit, and how is it related to and different from a normal qubit?&#xA;Please help understand more.&#xA;I am undertaking Delft University's course in EdX on Quantum Internet and Quantum Computers.&lt;/p&gt;&#xA;" OwnerUserId="9227" LastEditorUserId="4501" LastEditDate="2021-02-03T15:36:16.340" LastActivityDate="2021-02-03T15:36:16.340" Title="What is a flying qubit?" Tags="&lt;communication&gt;&lt;terminology&gt;&lt;history&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8901" PostTypeId="1" CreationDate="2019-11-22T05:49:57.107" Score="3" ViewCount="68" Body="&lt;p&gt;Recently there has been interest in understanding the out of time order correlation function (OTOC) &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;, which essentially compares the overlap of two operators &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; acting on a state in two different ways&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; onto a quantum state, wait a time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, then apply &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, then reverse time to &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt; and apply &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This correlation function then takes the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F=\langle W_t^{\dagger} V^{\dagger} W_t V \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Roughly speaking, &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; tells you how quickly interactions make the initially commuting &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; stop commuting.&lt;/p&gt;&#xA;&lt;p&gt;Preparing the state of (1) above is straightforward, you just apply the operators one after another. However (2) is challenging, because one has to reverse the direction of time.&lt;/p&gt;&#xA;&lt;p&gt;The most obvious way to implement (2) is to reverse time through changing the sign of the entire Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H \rightarrow -H$&lt;/span&gt;, which effectively reverses the time evolution. Needless to say, this is very tricky in dissipative/open systems, as you can only reverse the sign of a select &lt;em&gt;part&lt;/em&gt; of the Hamiltonian, not &lt;em&gt;all&lt;/em&gt; of it.&lt;/p&gt;&#xA;&lt;p&gt;My question is the following: &lt;strong&gt;is it meaningful to think about OTOCs in the interaction picture?&lt;/strong&gt; I ask because it is often the case in experiment (e.g. NMR Hahn echo experiments) that you can reverse the sign of the interaction Hamiltonian but not the full Hamiltonian. What does the OTOC tell you with respect to time evolution in the interaction picture?&lt;/p&gt;&#xA;&lt;p&gt;More concretely,  say you have the following spin Hamiltonian&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = H_0 + g \sum_i \mathbf{S}_i\cdot \mathbf{B}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; is some unknown function of the spin operators.&lt;/p&gt;&#xA;&lt;p&gt;Assume that you can change the sign of the magnetic field &lt;span class=&quot;math-container&quot;&gt;$\mathbf{B}$&lt;/span&gt; at will, like in NMR. Is there anything interesting about the resulting OTOC in this case? Or does it not have any of the useful properties of &amp;quot;true&amp;quot; OTOCs?&lt;/p&gt;&#xA;" OwnerUserId="2260" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:36.060" LastActivityDate="2020-11-24T14:22:36.060" Title="Out-of-time-order correlation function in the interaction picture?" Tags="&lt;correlations&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8902" PostTypeId="2" ParentId="8900" CreationDate="2019-11-22T09:18:11.800" Score="10" Body="&lt;h2&gt;Preliminary - The DiVincenzo criteria for a 'normal' quantum computer&lt;/h2&gt;&#xA;&lt;p&gt;The DiVincenzo criteria, as originally proposed by DiVincenzo, are &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; criteria that he originally proposed in his seminal &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0002077&quot; rel=&quot;nofollow noreferrer&quot;&gt;2000 paper&lt;/a&gt;. In this paper, he proposed &lt;em&gt;five&lt;/em&gt; criteria, which are widely considered to be &lt;strong&gt;the&lt;/strong&gt; five (sufficient &lt;em&gt;and&lt;/em&gt; necessary) criteria that any physical quantum computer should meet.&lt;/p&gt;&#xA;&lt;p&gt;As you are doing the TUD quantum crypto course, you are familiar with the concept of a quantum internet. The five DiVincenzo criteria are not sufficient for quantum computer(s) connected over a quantum internet; they come up short in the communication part. For this, two more criteria (nr. &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;) have been 'added'. They were also proposed by DiVincenzo in his paper, but in a separate section.&lt;/p&gt;&#xA;&lt;p&gt;I have met people who, by using the term 'The DiVincenzo criteria', refer to only the first five criteria and others who use it to refer to all seven collectively. I tend to view the first five as regarding to &lt;em&gt;stationary qubits&lt;/em&gt;, and the latter two as regarding to &lt;em&gt;flying qubits&lt;/em&gt; and make the distinction by using this view, but please view that as my personal opinion.&lt;/p&gt;&#xA;&lt;h2&gt;The latter two criteria&lt;/h2&gt;&#xA;&lt;p&gt;Criteria &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; have to do with communication between different quantum computers or nodes. To exchange (quantum) information between two nodes, one needs to have a carrier of this quantum information. &lt;strong&gt;This is exactly what a flying qubit should be: a qubit that can be freely send from one node to the other.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first extra criterium prescribes that the information encoded in a qubit within the quantum computer (often referred to as the &lt;em&gt;stationary&lt;/em&gt; qubit in this context) should be reliably transferred to a flying qubit. Additionally, an obtained flying qubit's information needs to be reliably transferred back to a stationary qubit as well.&lt;/p&gt;&#xA;&lt;p&gt;The second extra criterium prescribes that such a flying qubit should be reliably send from one node to another. This is a daunting task if you consider that the nodes might be (geographically) very far apart (&lt;span class=&quot;math-container&quot;&gt;$&amp;gt; 50$&lt;/span&gt;km). The coherence of the flying qubit needs to be preserved over this scale, possibly (likely) with the use of error correction.&lt;/p&gt;&#xA;&lt;h2&gt;Properties of a flying qubit when compared to a stationary qubit&lt;/h2&gt;&#xA;&lt;p&gt;A flying qubit should, just as a stationary qubit, be able to reliably store quantum information. However, there are some important distinctions.&#xA;First and foremost, flying qubits have a more restricted use case than stationary ones - they are only used to propagate the information between macroscopic distances, whereas stationary qubits are used to not only store information, but also to perform calculations with.&lt;/p&gt;&#xA;&lt;p&gt;So to compare:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Stationary qubits need to:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Be able to store quantum information reliably on a timescale of &lt;span class=&quot;math-container&quot;&gt;$\sim ms$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform calculations: various gates/operations need to be reliably performed on them. This includes an operation that moves/converts the information to a flying qubit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Be able to be measured/read out reliably.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Be able to be highly entangled.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Flying qubits, however, need to:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Be send over macroscopic distances while keeping their encoded (quantum) information intact.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Be operational on a macroscopic temperature scale (i.e. about room temperature).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform only one single operation reliably: converting into stationary qubits.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Be able to be entangled.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Therefore, there are some important distinctions between the two. To summarize in what I believe is their defining distinctions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stationary qubits need to be reliably calculated with.&lt;/li&gt;&#xA;&lt;li&gt;Flying qubits need to be reliably transmitted over macroscopic distances.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Physical implementation of a flying qubit&lt;/h2&gt;&#xA;&lt;p&gt;There exist myriad different implementations of stationary qubits that all have their advantages and disadvantages; it is still an open question what the final 'go to' stationary qubit design (if any) will be.&#xA;For flying qubits, there is one clear design which is the most promising: the photon. The photon travels very fast, and has a straightforward two-level system (namely, its polarization). Also, this polarization can be conserved at higher temperatures. Note that other encodings of the qubit into the photon are also possible, for instance the time-bin encoding.&lt;/p&gt;&#xA;&lt;p&gt;Note that it is highly unlikely that stationary and flying qubits will be based on the same physical principle or design. That is to say, stationary qubits will most likely be based on an entirely different physical phenomenon than stationary qubits (e.g. Ion traps, superconducting qubits/transmons, quantum dots, other confined electron systems etc. for stationary qubits.) There are, however, designs for a quantum computer (with stationary qubits) based on the use of photons; only time will tell what actual implementation of stationary and flying qubits will prevail.&lt;/p&gt;&#xA;&lt;h2&gt;Current implementations of flying qubits&lt;/h2&gt;&#xA;&lt;p&gt;As an interesting sidenote, in the context of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum key distribution&lt;/a&gt;, flying qubits are used in the key distillation. However, for these types of protocols to work, often only a subset of all possible qubit states need to be transferred (often this are the eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators); this reduces the complexity of the flying qubits. Note that for a general quantum internet this reduction needs to be omitted.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-02-03T09:59:19.310" LastActivityDate="2021-02-03T09:59:19.310" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8904" PostTypeId="1" AcceptedAnswerId="8906" CreationDate="2019-11-22T13:59:58.510" Score="2" ViewCount="330" Body="&lt;p&gt;I am trying to understand how CNOT or X gate can be explained by even more basic gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I went through these 2 links that explained the relation, but for my understanding, I am trying to prove it by matrix form. And yes I am clearly disabled in mathematics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Link:&lt;a href=&quot;https://arxiv.org/pdf/1110.2998.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;&#xA;Link:&lt;a href=&quot;https://towardsdatascience.com/introduction-to-quantum-programming-a19aa0b923a9&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jKkVc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jKkVc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's take the case where first Qbit(Q1) is the control and the second Qbit(Q2) is the target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the articles, CNOT can be explained by &lt;span class=&quot;math-container&quot;&gt;$(I\times H)\cdot Z\cdot(I\times H)$&lt;/span&gt;. where X is matrix multiplication and (.) refers to dot product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I went on to first convert all of them to the matrix&#xA;Step 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left(\begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; 1\end{bmatrix}\times{1\over\sqrt2}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix}\right)\cdot\begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; -1\end{bmatrix}\cdot\left(\begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; 1\end{bmatrix}\times{1\over\sqrt2}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have my doubts if this understanding itself is correct but let's continue hoping it is.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\left({1\over\sqrt2}\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1 \end{bmatrix}\right)\cdot\begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; -1\end{bmatrix}\cdot\left({1\over\sqrt2}\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1 \end{bmatrix}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this approach look right? if so, how should I approach further? if not what am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I even tried to take a smaller bit to solve and tried to solve this: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X = H\cdot Z \cdot H$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 1:&#xA;&lt;span class=&quot;math-container&quot;&gt;$X = {1\over\sqrt2}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix}\cdot \begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; -1\end{bmatrix} \cdot {1\over\sqrt2}\begin{bmatrix}1 &amp;amp; 1\\1 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 2:&#xA;&lt;span class=&quot;math-container&quot;&gt;$X = {1\over2}\begin{bmatrix} 1*1 &amp;amp; 1*0 \\ 1*0 &amp;amp; -1*-1\end{bmatrix}\cdot \begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 3:&#xA;&lt;span class=&quot;math-container&quot;&gt;$X = {1\over2}\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix}\cdot \begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 4:&#xA;&lt;span class=&quot;math-container&quot;&gt;$X = {1\over2}\begin{bmatrix} 1*1 &amp;amp; 0*1 \\ 0*1 &amp;amp; 1*-1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step 5:&#xA;&lt;span class=&quot;math-container&quot;&gt;$X = {1\over2}\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;once again, this is not Pauli-X gate, so I must be doing something stupid.&#xA;Please help and guide me.&lt;/p&gt;&#xA;" OwnerUserId="9193" LastEditorUserId="26" LastEditDate="2019-11-23T04:40:19.837" LastActivityDate="2019-11-23T04:40:19.837" Title="How to translate CNOT gate by Hadamard and Pauli Z gate in matrix form?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8905" PostTypeId="1" CreationDate="2019-11-22T14:27:49.923" Score="3" ViewCount="46" Body="&lt;p&gt;I am reading through the following article: &lt;a href=&quot;https://arxiv.org/abs/1312.2579&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1312.2579&lt;/a&gt;&#xA;and I really struggle to understand anything of the section &quot;D. The standard graph-coloring method&quot; on page 7 and &quot;E. The band-coloring method&quot; on page 8 as well. I've been through plenty of articles that say they use this method, but I am having a hard time understanding anything that is done here. If someone here has any idea, it would be really appreciated if a walkthrough could be provided.&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="26" LastEditDate="2019-11-23T04:39:24.987" LastActivityDate="2019-11-23T04:39:24.987" Title="Graph coloring to reduce the number of qubits in VQE" Tags="&lt;graph-states&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8906" PostTypeId="2" ParentId="8904" CreationDate="2019-11-22T16:17:10.673" Score="3" Body="&lt;p&gt;I think you have a slight misunderstanding of what the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate in the screenshot you attached is. It is, in fact, &lt;strong&gt;not&lt;/strong&gt; a &lt;em&gt;Z&lt;/em&gt; gate, but a (2-qubit) &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; or controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. gate, also referred to as a controlled-phase gate (because the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation is a flip of the phase of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; gate is a lot like the &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; gate, however, it performs a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation on the second qubit, but only if the state of the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. If the first is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state it performs nothing (i.e. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operation) on the second qubit instead.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more technical terms, we can write thus:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CZ = |0\rangle \langle0| \otimes I + |1\rangle \langle1| \otimes Z.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;(I \otimes H) CZ(I\otimes H) = |0\rangle \langle0| \otimes HIH + |1\rangle \langle1| \otimes HZH.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can simplify the &lt;span class=&quot;math-container&quot;&gt;$HIH$&lt;/span&gt; term easily: &lt;span class=&quot;math-container&quot;&gt;$HIH = HH = I$&lt;/span&gt;, from the properties of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&#xA;The &lt;span class=&quot;math-container&quot;&gt;$HZH$&lt;/span&gt; term is actually equal to &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;HZH &amp;amp;= \frac{1}{2}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix}\begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix}\\&#xA;&amp;amp;= \frac{1}{2}\begin{bmatrix}1 &amp;amp; -1 \\ 1 &amp;amp; 1\end{bmatrix}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix} \\&#xA;&amp;amp;= \frac{1}{2}\begin{bmatrix}0 &amp;amp; 2 \\ 2 &amp;amp; 0\end{bmatrix}\\&#xA;&amp;amp;= \begin{bmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix} = X.&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;So we can write:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;(I \otimes H) CZ(I\otimes H) = |0\rangle \langle0| \otimes HIH + |1\rangle \langle1| \otimes HZH = |0\rangle \langle0| \otimes I + |1\rangle \langle1| \otimes X.&#xA;\end{equation}&lt;/span&gt;&#xA;That is to say, an operation that performs the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation on the second qubit if the first qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state (and nothing if the first qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state). This is, of course, exactly the &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; gate which we are looking for.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-11-22T16:17:10.673" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8908" PostTypeId="1" CreationDate="2019-11-22T18:05:26.490" Score="5" ViewCount="1071" Body="&lt;p&gt;I'm interested in quantum computing, specifically in “quantum machine learning” (QML). I'm going to start my masters program in computer science and have previous experience in classical machine learning. I'd like to learn quantum mechanics generally but focus on quantum algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read about &lt;a href=&quot;https://medium.com/xanaduai/training-quantum-neural-networks-with-pennylane-pytorch-and-tensorflow-c669108118cc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit and Pennylane&lt;/a&gt;, but I'm unsure where to look next. Could you recommend books, courses, and papers to gain background into QML? My goal is to use Qiskit and Pennylane to develop QML algorithms in NISQ systems for data science and big data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question - can we use quantum computing to develop Bayesian deep learning models (Gaussian processes, bayesian quantum circuits) for data science and big data? Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="9226" LastEditorUserId="26" LastEditDate="2019-11-25T14:12:22.997" LastActivityDate="2020-01-25T11:19:22.737" Title="Pennylane and Qiskit for quantum machine learning" Tags="&lt;programming&gt;&lt;resource-request&gt;&lt;machine-learning&gt;&lt;nisq&gt;&lt;pennylane&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="8909" PostTypeId="2" ParentId="8908" CreationDate="2019-11-22T21:57:24.717" Score="4" Body="&lt;p&gt;Have a look at these for quantum machine learning:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.springer.com/gp/book/9783319964232&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Supervised learning with quantum computers&lt;/em&gt;&lt;/a&gt; by Schuld and Petruccione (2018)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;nofollow noreferrer&quot;&gt;An introduction to quantum machine learning&lt;/a&gt; by the same authors of the textbook above&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.nature.com/articles/nature23474&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum machine learning&lt;/a&gt; published in &lt;em&gt;Nature&lt;/em&gt; 2017 by some experts in the field: Wittek, Rebentrost, Lloyd, et al&lt;/li&gt;&#xA;&lt;li&gt;Video presentations by &lt;a href=&quot;https://www.youtube.com/watch?v=uf_BRg5ovtg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dr. Schuld&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=EKWGLERVLuc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dr. Wittek&lt;/a&gt; on quantum machine learning&lt;/li&gt;&#xA;&lt;li&gt;Quantum bayesian deep learning for Qiskit is discussed&#xA;&lt;a href=&quot;https://www.youtube.com/watch?v=7CKqbIoxYGA&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9118" LastEditDate="2019-11-24T18:32:27.283" LastActivityDate="2019-11-24T18:32:27.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8910" PostTypeId="2" ParentId="8862" CreationDate="2019-11-23T06:16:15.640" Score="2" Body="&lt;p&gt;You can found some interesting approaches to decomposing gates also here: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9503016&lt;/a&gt; (&lt;em&gt;Elementary gates for quantum computation&lt;/em&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-11-23T06:16:15.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8911" PostTypeId="2" ParentId="8742" CreationDate="2019-11-23T17:58:05.977" Score="1" Body="&lt;p&gt;We can proceed by applying the parity check matrix &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp$&lt;/span&gt; on the ancilla, which would become &lt;span class=&quot;math-container&quot;&gt;$\vert H_2(z'+e_2)\rangle =\vert H_2(z'+u + e_2 -u)\rangle =\vert H_2(e_2-u)\rangle$&lt;/span&gt;. Measuring the ancilla gives us &lt;span class=&quot;math-container&quot;&gt;$H_2(e_2-u)$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; is known. we then know &lt;span class=&quot;math-container&quot;&gt;$H_2 e_2$&lt;/span&gt;, and in turn &lt;span class=&quot;math-container&quot;&gt;$e_2$&lt;/span&gt;.&#xA;After correcting the now bit flip &lt;span class=&quot;math-container&quot;&gt;$e_2$&lt;/span&gt;, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{2^n/\vert C_2\vert}}\sum_{z'+u\in C_2^{\perp}}(-1)^{(x+v)z'}|z'\rangle \label{eq:1}\tag{$\star$}$$&lt;/span&gt;&#xA;We then re-apply Hadamard gates to each qubit of &lt;span class=&quot;math-container&quot;&gt;$\eqref{eq:1}$&lt;/span&gt;, which is equivalent to applying Hadamard gates to the state on the final line of the question &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{2^n/\vert C_2\vert}}\sum_{z'+u\in C_2^{\perp}}(-1)^{(x+v)z'}|z'+e_2\rangle$$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$e_2=0$&lt;/span&gt;. Hadamard gates are self-inverse, so we get back &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u\cdot y}(-1)^{(x+y+v)\cdot 0}\vert x+y+v\rangle $$&lt;/span&gt; which is the original encoded state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{|C_2|}}\sum_{y\in C_2}(-1)^{u\cdot y}\vert x+y+v\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7460" LastEditorUserId="7460" LastEditDate="2019-11-23T18:08:45.270" LastActivityDate="2019-11-23T18:08:45.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8912" PostTypeId="1" AcceptedAnswerId="8934" CreationDate="2019-11-23T18:36:43.253" Score="7" ViewCount="218" Body="&lt;p&gt;I noticed that approaches for finding quantum algorithms the hidden subgroup problem for both Abelian groups (&lt;span class=&quot;math-container&quot;&gt;$(\Bbb Z_n\times \Bbb Z_n, +)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(\Bbb R, +)$&lt;/span&gt;, etc.) and non-Abelian finite groups like the dihedral group and symmetric group often use &lt;a href=&quot;https://en.wikipedia.org/wiki/Representation_theory&quot; rel=&quot;noreferrer&quot;&gt;representation theory&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why is this the case? How's it helpful?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What are some resources for where I can learn sufficient representation theory to at least get started with understanding such algorithms? (I'm not in a position to read a heavy grad-level math textbook on representation theory.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-11-25T16:05:20.750" Title="Why does representation theory often arise in the context of quantum algorithms for the hidden subgroup problem?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;resource-request&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8913" PostTypeId="2" ParentId="8908" CreationDate="2019-11-23T22:37:12.927" Score="2" Body="&lt;p&gt;Since quantum machine learning with NISQ hardware is such a relatively new field, it is still very highly research driven, and a lot of the potential is still being determined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make these new research implementations more accessible, we've begun building implementations over at &lt;a href=&quot;https://pennylane.ai/qml&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pennylane.ai/qml&lt;/a&gt;. Interesting ones include:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_QGAN.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Generative Adversarial Networks with Cirq + TensorFlow&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_state_preparation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;State preparation with Rigetti Forest + PyTorch&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_doubly_stochastic.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Doubly stochastic gradient descent&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_vqls.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Linear Solver&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_qaoa_maxcut.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QAOA for MaxCut&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_variational_classifier.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum variational classifier&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These implementations are executable, and can be downloaded as Python scripts or Jupyter notebooks. Our goal is to keep regularly adding new implementations and demos (the repository behind the website is also open-source at &lt;a href=&quot;https://github.com/XanaduAI/qml&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/XanaduAI/qml&lt;/a&gt;, so anyone can contribute demos).&lt;/p&gt;&#xA;" OwnerUserId="371" LastActivityDate="2019-11-23T22:37:12.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8914" PostTypeId="1" CreationDate="2019-11-24T03:17:53.223" Score="4" ViewCount="174" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$q=e^{2 \pi i/3}$&lt;/span&gt;, the set of &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; vectors (&lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left(&#xA;\begin{array}{ccc}&#xA; 0 &amp;amp; 1 &amp;amp; -1 \\&#xA; 0 &amp;amp; 1 &amp;amp; -q \\&#xA; 0 &amp;amp; 1 &amp;amp; -q^2 \\&#xA; -1 &amp;amp; 0 &amp;amp; 1 \\&#xA; -q &amp;amp; 0 &amp;amp; 1 \\&#xA; -q^2 &amp;amp; 0 &amp;amp; 1 \\&#xA; 1 &amp;amp; -1 &amp;amp; 0 \\&#xA; 1 &amp;amp; -q &amp;amp; 0 \\&#xA; 1 &amp;amp; -q^2 &amp;amp; 0 \\&#xA;\end{array}&#xA;\right)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;forms a SIC-POVM (symmetric, informationally complete, positive operator-valued measure), as noted in eq. (1) of &lt;a href=&quot;https://arxiv.org/abs/1109.6514&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1109.6514&lt;/a&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would similarly like to have a 16-vector counterpart for &lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt; (to use for entanglement detection--per &lt;a href=&quot;https://arxiv.org/abs/1805.03955&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03955&lt;/a&gt;). (There is clearly a huge amount of interesting related literature on such topics, but an attempt of mine to find an explicit d=4 counterpart somewhere within it has so far not been successful.)&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="55" LastEditDate="2020-08-22T05:57:34.913" LastActivityDate="2020-08-22T05:57:34.913" Title="Give an explicit example of a $d = 4$ SIC-POVM" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;tomography&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8915" PostTypeId="2" ParentId="8837" CreationDate="2019-11-24T07:49:24.687" Score="2" Body="&lt;p&gt;If I understand you correctly, your goal is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;To choose some quantum algorithm (your question is: which algorithm would be good?)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Instead of running the quantum algorithm on a real quantum computer, you want to run a simulation of a quantum computer on a classical computer to simulate the execution of the quantum algorithm. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You want to optimize your classical simulator to make efficient use of the special capabilities offered by a High Performance Cluster (e.g. parallelism) and demonstrate that the simulation runs faster.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If so, it really does not matter which quantum algorithm you choose, as long as it involves many qubits and many gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are probably best off choosing some very well-known algorithm that is well described in the literature, e.g. Grover or Shor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your simulation will involve multiplying very large matrices with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more qubits, the larger the matrices. The growth is exponential: if you have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits, you will be multiplying &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The more gates, the more multiplications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will make life easier on yourself if you assume the qubits are perfect (no noise, no errors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the main point of your exercise is to parallelize some code for an HPC, it probably doesn't matter that the simulation is less realistic.&lt;/p&gt;&#xA;" OwnerUserId="4733" LastEditorUserId="4733" LastEditDate="2019-11-25T07:10:28.253" LastActivityDate="2019-11-25T07:10:28.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8917" PostTypeId="1" AcceptedAnswerId="8919" CreationDate="2019-11-24T10:02:43.203" Score="7" ViewCount="185" Body="&lt;p&gt;I have already posed the question on &lt;a href=&quot;https://math.stackexchange.com/questions/3448100/probability-estimate-in-classical-deutsch-josza-problem&quot;&gt;Math SE&lt;/a&gt; but I hope that people from QC community can help. I am starting studying QC, but first, I want to understand the classical view of algorithms. So in the following my question:&lt;/p&gt;&#xA;&lt;p&gt;Here is the description of Deutsch-Jozsa problem: Let &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n↦\{0,1\}$&lt;/span&gt; be a function promised to be either constant or balanced ('balanced' means that f outputs as many &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;'s as &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s). Imagine that you try &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; inputs (out of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; available) and consistently find the same output. What is the probability that the function is actually constant? &lt;a href=&quot;https://community.qiskit.org/textbook/ch-algorithms/deutsch-jozsa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;This link&lt;/a&gt; gives an answer as &lt;span class=&quot;math-container&quot;&gt;$1-1/2^{k-1}$&lt;/span&gt;. I am not able to reproduce this result and I have a prior question: how can the result not depend on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;? Obtaining 5 equal results has a very different meaning if &lt;span class=&quot;math-container&quot;&gt;$n=10$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$n=100$&lt;/span&gt; isn't it?&lt;/p&gt;&#xA;" OwnerUserId="9243" LastEditorUserId="2927" LastEditDate="2021-04-27T23:02:23.713" LastActivityDate="2021-04-27T23:02:23.713" Title="Probability estimate in classical Deutsch-Jozsa problem" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8918" PostTypeId="2" ParentId="8917" CreationDate="2019-11-24T11:22:35.937" Score="3" Body="&lt;p&gt;Indeed, the formula assumes that &lt;span class=&quot;math-container&quot;&gt;$n=\infty$&lt;/span&gt;, and is approximately correct if &lt;span class=&quot;math-container&quot;&gt;$2^n \gg k$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-11-24T11:22:35.937" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8919" PostTypeId="2" ParentId="8917" CreationDate="2019-11-24T12:17:18.220" Score="5" Body="&lt;p&gt;Yes, it will depend on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; because sampling &lt;em&gt;with replacement&lt;/em&gt; is assumed in &lt;a href=&quot;https://math.stackexchange.com/a/3227185&quot;&gt;the proof&lt;/a&gt;, which doesn't make sense if &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is finite. Intuitively, if a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; really is balanced, and first output corresponding to certain random input is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then the probability that the second output corresponding to some other random input will be the same is less than &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; (if &lt;span class=&quot;math-container&quot;&gt;$n &amp;lt; \infty$&lt;/span&gt;). The formula you state only gives a lower bound which is approached as &lt;span class=&quot;math-container&quot;&gt;$n\to\infty$&lt;/span&gt;. In general, &lt;span class=&quot;math-container&quot;&gt;$k=2^{n-1}+1$&lt;/span&gt; inputs is sufficient to prove whether &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant or balanced, assuming it's guaranteed to be one of the two. As explained in the linked answer, without assuming replaceability, a tighter lower bound would have been &lt;span class=&quot;math-container&quot;&gt;$$\frac{2\binom{2^{n-1}}{k}}{\binom{2^{n}}{k}} = 1-\prod_{i=1}^{k-1} \left(\frac{2^{n-1}-i}{2^n-i}\right).$$&lt;/span&gt; Notice that this becomes equivalent to your formula for &lt;span class=&quot;math-container&quot;&gt;$n\to\infty$&lt;/span&gt; i.e., &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lim_{n\to\infty} 1-\prod_{i=1}^{k-1} \left(\frac{2^{n-1}-i}{2^n-i}\right) = 1 - \frac{1}{2^{k-1}}.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps even better bounds can be found depending on the specific nature of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;; I'll think about it. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-24T13:48:49.980" LastActivityDate="2019-11-24T13:48:49.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8920" PostTypeId="2" ParentId="8914" CreationDate="2019-11-24T13:35:11.097" Score="3" Body="&lt;p&gt;You can find it here &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0310075&quot; rel=&quot;nofollow noreferrer&quot;&gt;Symmetric Informationally Complete Quantum Measurements&lt;/a&gt; or here &lt;a href=&quot;https://arxiv.org/abs/0910.5784&quot; rel=&quot;nofollow noreferrer&quot;&gt;SIC-POVMs: A new computer study&lt;/a&gt;, in the appendix B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a single fiducial vector &lt;span class=&quot;math-container&quot;&gt;$v = (a_1,a_2,a_3,a_4)^T \in \mathbb{C}^4$&lt;/span&gt; it's pretty easy to write down all SIC-POVM vectors. They are just &lt;span class=&quot;math-container&quot;&gt;$C^kS^lv$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k,l \in \{0..3\}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; are &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Construction:_The_clock_and_shift_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;clock and shift matrices&lt;/a&gt; given by &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i \\&#xA;\end{pmatrix}, ~~~&#xA;S = \begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$C^kS^lv = (a_{1-l},i^ka_{2-l},(-1)^ka_{3-l},(-i)^ka_{4-l})^T$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a_0 = a_4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a_{-1} = a_3$&lt;/span&gt;, etc.&lt;br&gt;&#xA;Note that a phase of any SIC-POVM vector doesn't matter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update 2&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple formula for all 16 vectors can be found &lt;a href=&quot;https://arxiv.org/abs/1103.2030&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, eq (32)&lt;br&gt;&#xA;The non-normalized fiducial vector is just &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left( \begin{array}{c} &#xA;\sqrt{2+\sqrt{5}} \\ &#xA;1 \\&#xA;1 \\&#xA;1&#xA;\end{array} \right)&#xA;$$&lt;/span&gt;&#xA;but we must change the matrices &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; to correctly generate 16 vectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C = e^{i\pi/4}\begin{pmatrix}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;-i &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i \\&#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;\end{pmatrix}, ~~~&#xA;S = e^{i\pi/4}\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ &#xA;-i &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-11-25T18:58:30.233" LastActivityDate="2019-11-25T18:58:30.233" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="8921" PostTypeId="1" AcceptedAnswerId="8922" CreationDate="2019-11-24T14:40:37.187" Score="3" ViewCount="684" Body="&lt;p&gt;I know that there are papers (cf. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205115&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0205115&lt;/a&gt;) out there which prove that the Toffoli gate by itself is not enough for universal quantum computation, but I haven't had the time to go through the whole proof. Could someone give me the crux of the proof or the intuition for this?&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-11-24T14:57:24.953" Title="Why is the Toffoli gate not sufficient for universal quantum computation?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8922" PostTypeId="2" ParentId="8921" CreationDate="2019-11-24T14:57:24.953" Score="9" Body="&lt;p&gt;The Toffoli gate is just a permutation. If you start in a known basis state, application of a Toffoli just changes it into another basis state, one that you can easily calculate classically (after all, it’s a decision based on looking at 3 bit values). Repeating that doesn’t change anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make it universal, you need to add something like Hadamard which introduces superposition.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-24T14:57:24.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8923" PostTypeId="1" CreationDate="2019-11-25T04:48:47.583" Score="4" ViewCount="91" Body="&lt;p&gt;Is it possible to tell Qiskit to execute a parameterized gate where the parameter varies between shots? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say, for whatever reason, I'd like to speed up the dephasing of a qubit during a run. I can accomplish this by explicating implementing the dephasing Kraus operators by using an &lt;span class=&quot;math-container&quot;&gt;$R_x(\phi)$&lt;/span&gt; gate, a controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate and an ancilla qubit. However, this adds a decent amount of complexity, and thus error, to my circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more clever way to do it is to add an &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; gate into the circuit, where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is drawn from a normal distribution and thus varies shot to shot. This would mean the circuit would need to be reassembled from the parameterized transpilation each shot, which makes me think it's probably not possible. But I wanted to ask just in case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can always do a series of single shot experiments, but I believe the backend (not to mention other users) might have an issue with me submitting thousands of single shot jobs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is there any way to implement a circuit which has a parameter which varies from shot to shot?&lt;/p&gt;&#xA;" OwnerUserId="7701" LastActivityDate="2020-09-28T16:39:07.063" Title="Vary parameter between shots" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8924" PostTypeId="1" CreationDate="2019-11-25T06:05:15.473" Score="4" ViewCount="42" Body="&lt;p&gt;I am going through different types of attacks that eve can perform on the quantum channel. I came across the intercept-resend attack and measure-resend attack. What is the difference between the two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to my view,&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;measurement attack - Eve measures the particles going from Alice to Bob as in BB84 protocol&lt;/li&gt;&#xA;&lt;li&gt;intercept-resend - Eve can apply a unitary operation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Am I correct?&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="26" LastEditDate="2019-11-25T13:45:35.417" LastActivityDate="2019-11-25T13:45:35.417" Title="What is the difference between intercept-resend attack and measure-resend attack?" Tags="&lt;cryptography&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8925" PostTypeId="1" AcceptedAnswerId="8926" CreationDate="2019-11-25T10:44:02.407" Score="0" ViewCount="46" Body="&lt;p&gt;I'm searching for a good quantum algorithm to approximate &lt;a href=&quot;http://mathworld.wolfram.com/ChaitinsConstant.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chaitin's Constant&lt;/a&gt;. Any references/resources will do?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: This number is &lt;a href=&quot;https://en.wikipedia.org/wiki/Chaitin%27s_constant#Uncomputability&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncomputable&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="26" LastEditDate="2019-11-25T13:25:43.087" LastActivityDate="2019-11-25T13:25:43.087" Title="Algorithm to approximate Chaitin's Constant?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8926" PostTypeId="2" ParentId="8925" CreationDate="2019-11-25T11:03:48.773" Score="3" Body="&lt;p&gt;Any quantum algorithm to approximate Chaitin's constant (or any other number) will also yield a classical algorithm to approximate that same number, just by simulating the quantum computer. (It won't be a &lt;em&gt;great&lt;/em&gt; classical algorithm, but it's still an algorithm.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Chaitin's constant provably doesn't admit such a classical algorithm, it also doesn't admit a quantum algorithm either. &lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2019-11-25T11:03:48.773" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8927" PostTypeId="1" AcceptedAnswerId="8928" CreationDate="2019-11-25T11:56:03.647" Score="2" ViewCount="55" Body="&lt;p&gt;I am a beginner in quantum computing. Please consider the following scenario:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose Alice wants to send &#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{N}}\sum_{j=0,1,2,..N-1} |j\rangle$&lt;/span&gt; to Bob. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eve has intercepted the state and want to do the following operation - add his &lt;span class=&quot;math-container&quot;&gt;$|0_{\text{Eve}}\rangle$&lt;/span&gt; and get &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N}}\sum_{j=0,1,2,..N-1} |j\rangle |0_{\text{Eve}}\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next he wants to apply apply Unitary Transformation &lt;span class=&quot;math-container&quot;&gt;$$U|j\rangle|0_{\text{Eve}}\rangle = |j\rangle|j\rangle$$&lt;/span&gt; and convert the state to &lt;span class=&quot;math-container&quot;&gt;$|0_{\text{Eve}}\rangle$&lt;/span&gt; and get &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N}}\sum_{j=0,1,2,..N-1} |j\rangle |j\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does such unitary operation/transformation exist?&lt;/strong&gt; if no is it because conflicting no-cloning theorem that you cannot copy a state as it is?&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="55" LastEditDate="2020-07-26T18:19:45.547" LastActivityDate="2020-07-26T18:19:45.547" Title="Can Eve perform this operation?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;no-cloning-theorem&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8928" PostTypeId="2" ParentId="8927" CreationDate="2019-11-25T12:46:15.660" Score="1" Body="&lt;p&gt;It does exist. It's basically the controlled-not gate generalised to higher dimensional systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important thing to realise is that means that the bit that Bob ends up with will be highly entangled with what Eve has, and that will have significant observable consequences. As part of a cryptographic protocol, for exampe, Bob could detect that Eve is doing this before sending any sensitive informaiton.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-25T12:46:15.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8929" PostTypeId="2" ParentId="8927" CreationDate="2019-11-25T12:58:54.727" Score="1" Body="&lt;p&gt;Please be careful with your notation; don't get confused with the number of qubits that are in &lt;span class=&quot;math-container&quot;&gt;$|0_{Eve}\rangle$&lt;/span&gt; (I'm not necessarily saying that you are - just mentioning this as a precaution). Since the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{N}}\sum_{j \in 0,1,2....N-1}|j\rangle$&lt;/span&gt; that Alice wants to send is a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state with &lt;span class=&quot;math-container&quot;&gt;$N=2^{n}$&lt;/span&gt;, Alice needs to send &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits to Bob - possibly via Eve. Therefore, the state &lt;span class=&quot;math-container&quot;&gt;$|0_{Eve}\rangle$&lt;/span&gt; that you describe is a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that copies the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt;-qubit unitary that you describe is possible, but on the presumption that Eve knows exactly what Alice will send. Then, a series of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; gates from the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit  to the &lt;span class=&quot;math-container&quot;&gt;$(i+n)$&lt;/span&gt;th qubit will suffice - it will copy any state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; in the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit to the second &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, thereby obtaining the total state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle \otimes |j\rangle$&lt;/span&gt;. By linearity, it also copies a superposition of different &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt;-states.  So we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U_{copy} = \sum_{i\in \{1,2...n\}}CX^{(i,i+n)},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$CX^{(i,i+n)}$&lt;/span&gt; is the CNOT operation with qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; as the control qubit and qubit &lt;span class=&quot;math-container&quot;&gt;$(i+n)$&lt;/span&gt; as the target qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A unitary that copies any state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if Eve does not know what state Alice sends, there is no unitary that will perform the task (of copying a unknown &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; into the second &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits). The proof of impossibility is straightforward via the condition that the operation needs to be linear; for a proof see a proof of the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no cloning theorem&lt;/a&gt;, which applies here.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2019-11-25T13:46:25.880" LastActivityDate="2019-11-25T13:46:25.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8930" PostTypeId="1" AcceptedAnswerId="8952" CreationDate="2019-11-25T13:25:14.487" Score="5" ViewCount="436" Body="&lt;p&gt;In &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; by Nielsen and Chuang, the authors introduce operator sum representation in Section 8.2.3. They denote the evolution of a density matrix, when given an environment, is the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon (\rho) = \mathrm{tr}_{\text{env}} [U(\rho\otimes \rho_{\text{env}})U^\dagger]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where you are essentially taking the trace to discard the environment of the unitary evolution of the entire system. What I don't understand is how the operator sum representation is equivalent (Equations 8.9 and 8.11 in N&amp;amp;C)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon (\rho) = \sum_k \langle \mathbf{e}_k|U[\rho \otimes |\mathbf{e}_0\rangle \langle \mathbf{e}_0|]U^\dagger|\mathbf{e}_k\rangle = \sum_k E_k\rho E_k^\dagger$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this equation, I take &lt;span class=&quot;math-container&quot;&gt;$|\mathbf{e}_k\rangle$&lt;/span&gt; to represent the basis of the system and U to be a 4 x 4 unitary matrix governing the evolution. How is this equivalent to the first equation where you discard the trace? It seems like the second equation (equation 8.9 in N&amp;amp;C) above would yield a scalar quantity. What does this equation mean? I understand the first equation where you take the partial trace, but how does partial trace relate to the 2nd and 3rd equations? I'm a relative beginner in this field.&lt;/p&gt;&#xA;" OwnerUserId="9254" LastEditorUserId="55" LastEditDate="2021-02-19T18:30:30.310" LastActivityDate="2021-02-19T18:30:30.310" Title="How is the partial trace related to the operator sum representation?" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;partial-trace&gt;&lt;kraus-representation&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ClosedDate="2021-02-20T20:27:10.817" ContentLicense="CC BY-SA 4.0" />
  <row Id="8931" PostTypeId="2" ParentId="8930" CreationDate="2019-11-25T13:33:41.537" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|e_k\rangle$&lt;/span&gt; is the basis of the &lt;em&gt;environment&lt;/em&gt;. Taking the sum of projections onto an orthonormal basis of one subsystem is the definition of the partial trace over that subsystem.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-25T13:33:41.537" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8932" PostTypeId="5" CreationDate="2019-11-25T14:12:32.997" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-25T14:12:32.997" LastActivityDate="2019-11-25T14:12:32.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8933" PostTypeId="4" CreationDate="2019-11-25T14:12:32.997" Score="0" Body="PennyLane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations." OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-25T14:12:32.997" LastActivityDate="2019-11-25T14:12:32.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8934" PostTypeId="2" ParentId="8912" CreationDate="2019-11-25T16:05:20.750" Score="4" Body="&lt;p&gt;Two classical texts for the representation theory of finite groups are the books of &lt;a href=&quot;https://books.google.co.il/books?hl=en&amp;amp;lr=&amp;amp;id=w6PDAgAAQBAJ&amp;amp;oi=fnd&amp;amp;pg=PR13&amp;amp;dq=Hamermesh%20group%20theory&amp;amp;ots=KyJzwkFwpd&amp;amp;sig=AhIw_k1bib1lg7g1wA_pLNBeqKc&amp;amp;redir_esc=y#v=onepage&amp;amp;q=Hamermesh%20group%20theory&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamermesh &lt;/a&gt; and &lt;a href=&quot;https://books.google.co.il/books?hl=en&amp;amp;lr=&amp;amp;id=9mT1BwAAQBAJ&amp;amp;oi=fnd&amp;amp;pg=PA3&amp;amp;ots=hS5zMhyfmp&amp;amp;sig=rf3o5UcnJEHt1s9DSEgJ6jwRJc4&amp;amp;redir_esc=y#v=onepage&amp;amp;q&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Serre&lt;/a&gt;. These books however lack chapters on Fourier analysis needed for the quantum computation applications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a more modern text for finite group representations which includes a chapter on Fourier analysis, please see the lecture notes by: &lt;a href=&quot;http://users.metu.edu.tr/sozkap/513-2013/Steinberg.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Steinberg&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for a fast introduction, quite sufficient for the quantum computation applications, there are very concise texts: in &lt;a href=&quot;https://members.ift.uam-csic.es/ealvarez/amm.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Enrique Alvarez lecture notes&lt;/a&gt; (Chapter 9, in first reading one can skip the representation theory of &lt;span class=&quot;math-container&quot;&gt;$S_N$&lt;/span&gt; and  study the 17 pages 79-95 only), and in chapter 2 of the &lt;a href=&quot;https://people.math.ethz.ch/~wilthoma/rep_theory/master.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; by Willwacher.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since these concise resources also lack the subject of Fourier analysis, you can read the 5 pages of  chapter 3 of &lt;a href=&quot;http://www.cse.cuhk.edu.hk/~syzhang/course/QC13/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shengyu Zhang&lt;/a&gt; quantum computing course giving an introduction to the group theory needed for the hidden subgroup problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the hidden subgroup problem, we are given a function &lt;span class=&quot;math-container&quot;&gt;$f: G \rightarrow S$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a finite set) which is invariant on the cosets of some subgroup &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;; i.e., &lt;span class=&quot;math-container&quot;&gt;$f(g) = f(gh), \,\, h\in H$&lt;/span&gt;; and we want to identify the subgroup &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Representation theory appears because every function on a finite group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; can be written as a linear combination of the matrix elements of its irreducible representations; and we need to identify the representations appearing in the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. We do so by preparing a state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_G |g, f(g)\rangle$$&lt;/span&gt;&#xA;(This state is efficiently preparable, when there is an efficient oracle for the computation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;). If we measure the second register, we are left with a uniformly weighted combination of group elements belonging to the coset corresponding to the measured values of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_H |ch\rangle$$&lt;/span&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is any element in this coset).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be an irreducible representation of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a matrix function of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; of dimension &lt;span class=&quot;math-container&quot;&gt;$d_{\rho} \times d_{\rho}$&lt;/span&gt;; the quantum Fourier transform, transforms a group vector &lt;span class=&quot;math-container&quot;&gt;$|g\rangle$&lt;/span&gt; to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{\rho \in \hat{G}} \sum_{i=1}^{d_{\rho}}\sum_{j=1}^{d_{\rho}}\sqrt{\frac{d_{\rho}}{|G|}} \rho(g)_{ij} |i, j, \rho\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\hat{G}$&lt;/span&gt; is the set of irreducible representations, (which is in a one to one correspondence with the conjugacy classes of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to appreciate the role of the Fourier transform, please consider the case of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_N =  \{ z_0, …, z_{N-1}\}$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_N$&lt;/span&gt; is Abelian all its irreducible representations are one dimensional given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_m (z_n) = e^{\frac{2 \pi i mn}{N}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the kernel of the usual Fourier transform. &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the representation index and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the group element index. We know that if we perform a Fourier transform of the function &lt;span class=&quot;math-container&quot;&gt;$\rho_m$&lt;/span&gt;, we get a peaked function at &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; by which we identifiy the representation &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the general case when we measure the &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; register in  &lt;span class=&quot;math-container&quot;&gt;$|i, j, \rho\rangle$&lt;/span&gt;, we get with a high probability a representation appearing in &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, thus by repeating the experiment, we get with a high probability all representations having &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in their kernel and we can identify &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as their mutual kernel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see the following &lt;a href=&quot;https://arxiv.org/abs/0812.0380v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0812.0380v1&lt;/a&gt;  work by Childs and Dam reviewing cases where the above standard method and other improved methods lead to efficient hidden subgroup identification in the non-Abelian cases.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2019-11-25T16:05:20.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8935" PostTypeId="1" AcceptedAnswerId="8938" CreationDate="2019-11-25T16:43:56.760" Score="6" ViewCount="602" Body="&lt;p&gt;Qiskit Aqua has a module that implements the HHL algorithm:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/single_sample/hhl/hhl.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/single_sample/hhl/hhl.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one draw the implemented circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;* EDIT *&lt;/strong&gt; &#xA;I'm working with an example from the github.  I modified it as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#&#xA;# Example from &#xA;# https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/aqua/linear_systems_of_equations.ipynb&#xA;#&#xA;&#xA;&#xA;from qiskit.aqua import run_algorithm&#xA;from qiskit.aqua.input import LinearSystemInput&#xA;from qiskit.quantum_info import state_fidelity&#xA;from qiskit.aqua.algorithms.classical import ExactLSsolver&#xA;import numpy as np&#xA;&#xA;&#xA;params = {&#xA;    'problem': {&#xA;        'name': 'linear_system'&#xA;    },&#xA;    'algorithm': {&#xA;        'name': 'HHL'&#xA;    },&#xA;    'eigs': {&#xA;        'expansion_mode': 'suzuki',&#xA;        'expansion_order': 2,&#xA;        'name': 'EigsQPE',&#xA;        'num_ancillae': 3,&#xA;        'num_time_slices': 50&#xA;    },&#xA;    'reciprocal': {&#xA;        'name': 'Lookup'&#xA;    },&#xA;    'backend': {&#xA;        'provider': 'qiskit.BasicAer',&#xA;        'name': 'statevector_simulator'&#xA;    }&#xA;}&#xA;&#xA;# The 2 x 2 System to solve &#xA;#&#xA;&#xA;&#xA;matrix = [[1, 0], [0, 2]]&#xA;vector = [1, 4]&#xA;params['input'] = {&#xA;    'name': 'LinearSystemInput',&#xA;    'matrix': matrix,&#xA;    'vector': vector&#xA;}&#xA;&#xA;&#xA;# Run the HHL Algorithm&#xA;result = run_algorithm(params)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;result&lt;/code&gt; is the following:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'probability_result': 0.024629684664855277,&#xA; 'output': array([0.46919178+0.00000000e+00j, 0.8830963 -6.70000184e-15j]),&#xA; 'solution': array([1.05859322-8.03148712e-15j, 1.99244701-3.02331663e-14j]),&#xA; 'matrix': array([[1, 0],&#xA;        [0, 2]]),&#xA; 'vector': array([1, 4]),&#xA; 'circuit_info': {'size': 28870,&#xA;  'depth': 28820,&#xA;  'width': 7,&#xA;  'qubits': 7,&#xA;  'bits': 0,&#xA;  'factors': 1,&#xA;  'operations': {'u3': 6011,&#xA;   'u1': 8021,&#xA;   'cx': 14066,&#xA;   'barrier': 700,&#xA;   'u2': 6,&#xA;   'cu3': 42,&#xA;   'x': 24}&#xA;  }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;HHL.construct_circuit(result.circuit_info).draw()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but that resulted in&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;NameError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-13-4cf1b322ed4c&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 HHL.construct_circuit(result.circuit_info).draw()&#xA;&#xA;NameError: name 'HHL' is not defined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it may very well be that I didn't import something or that I just don't understand the syntax for the HHL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how should I form the instructions to generate the circuit?   (I'm not very good at python so if this question is trivial, I do apologize.)   I checked the qiskit documentation but I couldn't understand it well.  It didn't give an explicit example so if there's something I need to learn to be able to do this, please let me know.  Thank you for your time.&lt;/p&gt;&#xA;" OwnerUserId="9258" LastEditorUserId="26" LastEditDate="2019-11-26T12:06:04.517" LastActivityDate="2020-10-08T16:37:27.547" Title="How to draw Qiskit's HHL algorithm as a circuit?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8936" PostTypeId="1" AcceptedAnswerId="8956" CreationDate="2019-11-25T17:19:38.903" Score="5" ViewCount="97" Body="&lt;p&gt;I want to build a circuit that performs the following operation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_f = \left(\begin{array}{cccccccccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; \vdots\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; \vdots \\&#xA;\vdots &amp;amp; &amp;amp; &amp;amp; \ddots &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; \vdots \\&#xA;\vdots &amp;amp; &amp;amp; &amp;amp; &amp;amp; 0 &amp;amp; 1 &amp;amp; &amp;amp; &amp;amp; &amp;amp; \vdots \\&#xA;\vdots &amp;amp; &amp;amp; &amp;amp; &amp;amp; 1 &amp;amp; 0 &amp;amp; &amp;amp; &amp;amp; &amp;amp; \vdots \\&#xA;\vdots &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; \ddots &amp;amp; &amp;amp; &amp;amp; \vdots \\&#xA;\vdots &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;\vdots &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; \dots &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;but I don't know the equivalent gate combination, and I have never seen such a matrix on any book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am curious about how one could build this circuit, and generally, given a matrix, if there is any general procedure of decomposing it in gates or deriving the circuit.&lt;/p&gt;&#xA;" OwnerUserId="6245" LastEditorUserId="26" LastEditDate="2019-11-25T19:07:08.017" LastActivityDate="2019-11-26T19:08:32.760" Title="How to construct a circuit to perform this operation? Is there a general way of getting a circuit from a matrix?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8938" PostTypeId="2" ParentId="8935" CreationDate="2019-11-25T19:12:17.480" Score="6" Body="&lt;p&gt;You can draw the circuit using &lt;code&gt;construct_circuit().draw()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the tutorial you are talking about, if you scroll down to the 4x4 randomly generated section that uses &lt;code&gt;params5&lt;/code&gt; you can run &lt;code&gt;print(hhl.construct_circuit())&lt;/code&gt;, after the line &lt;code&gt;hhl = HHL.init_params(params5, algo_input)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may take a little while to complete but it should eventually print out ASCII art of the circuit. Other drawing options can be configured using &lt;code&gt;.draw()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NB this isn't to say that you can't draw any of the other circuits, if you follow the way the HHL object is created in this section you can draw any of the configurations specified by the params. For example, you could draw the circuit you are creating using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.input import LinearSystemInput&#xA;from qiskit.aqua.algorithms.single_sample import HHL&#xA;algo_input = LinearSystemInput(matrix=matrix, vector=vector)&#xA;hhl = HHL.init_params(params, algo_input)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2019-11-25T20:37:07.737" LastActivityDate="2019-11-25T20:37:07.737" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8940" PostTypeId="2" ParentId="8914" CreationDate="2019-11-25T20:27:47.193" Score="4" Body="&lt;p&gt;As indicated by Danylo in his anwser, eq. (32) in &lt;a href=&quot;https://arxiv.org/abs/1103.2030&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv: 1103.2030&lt;/a&gt;&#xA;presents the sixteen vectors (&quot;ignoring overall phases and normalisation&quot;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left(&#xA;\begin{array}{cccc}&#xA; x &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA; x &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\&#xA; x &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\&#xA; x &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \\&#xA; i &amp;amp; x &amp;amp; 1 &amp;amp; -i \\&#xA; i &amp;amp; x &amp;amp; -1 &amp;amp; i \\&#xA; -i &amp;amp; x &amp;amp; 1 &amp;amp; i \\&#xA; -i &amp;amp; x &amp;amp; -1 &amp;amp; -i \\&#xA; i &amp;amp; i &amp;amp; x &amp;amp; -1 \\&#xA; i &amp;amp; -i &amp;amp; x &amp;amp; 1 \\&#xA; -i &amp;amp; i &amp;amp; x &amp;amp; 1 \\&#xA; -i &amp;amp; -i &amp;amp; x &amp;amp; -1 \\&#xA; i &amp;amp; 1 &amp;amp; -i &amp;amp; x \\&#xA; i &amp;amp; -1 &amp;amp; i &amp;amp; x \\&#xA; -i &amp;amp; 1 &amp;amp; i &amp;amp; x \\&#xA; -i &amp;amp; -1 &amp;amp; -i &amp;amp; x \\&#xA;\end{array}&#xA;\right),&#xA;\end{equation}&lt;/span&gt;&#xA;where &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;x=\sqrt{2+\sqrt{5}}.&#xA;\end{equation}&lt;/span&gt;&#xA;These form &quot;a set of 16 SIC-vectors covariant under the Heisenberg group&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To now normalize the vectors we need to multiply them by &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{5+\sqrt{5}}}$&lt;/span&gt;.  The resultant sixteen vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;  satisfy the desired relation &#xA;(&lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\langle\psi_i||\psi_j\rangle|^2 = \frac{d \delta_{ij}+1}{d+1}, i,j=1,2,\ldots, d^2  ,&#xA;\end{equation}&lt;/span&gt;&#xA;given in eq. (7) in &lt;a href=&quot;https://arxiv.org/abs/1805.03955&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv: 1805.03955&lt;/a&gt;, giving us the explicit set requested in the question.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="26" LastEditDate="2019-11-26T12:17:10.153" LastActivityDate="2019-11-26T12:17:10.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8941" PostTypeId="1" CreationDate="2019-11-25T23:55:06.240" Score="1" ViewCount="77" Body="&lt;p&gt;I am currently trying to understand HHL by implementing a very inefficient Qiskit simulation script that performs HHL on an arbitrary hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and a vector &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because I am currently only attempting to understand the higher-level workings of the HHL algorithm itself, I am cheating and just using Qiskit simulator features to implement the operators &lt;span class=&quot;math-container&quot;&gt;$e^{iAt/T}$&lt;/span&gt; and to 'prepare' &lt;span class=&quot;math-container&quot;&gt;$|b&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I am trying to get it to work on two examples: the HHL example &lt;a href=&quot;https://cnls.lanl.gov/~baertschi/QCA/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and the problem done in &lt;a href=&quot;https://arxiv.org/abs/1110.2232v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. It works as expected on the former, but not on the latter. This makes me wonder if i am correctly implementing the operators &lt;span class=&quot;math-container&quot;&gt;$e^{iAt/T}$&lt;/span&gt; used in the QPE section of HHL.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is whether I am implementing &lt;span class=&quot;math-container&quot;&gt;$e^{iAt/T}$&lt;/span&gt; correctly or not.&#xA;I have written a function that takes a hermitian matrix, exponentiates it using the &lt;a href=&quot;https://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.linalg.expm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy function expm&lt;/a&gt;, adds a control to this matrix, and then turns it into an operator using the Qiskit Operator function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this function return the intended unitary operator, &lt;span class=&quot;math-container&quot;&gt;$e^{iAt/T}$&lt;/span&gt;? If it is ill-conceived, why?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info.operators import Operator&#xA;from scipy.linalg import expm&#xA;&#xA;def hermitian_to_controlled_U(hermitian_matrix,T):&#xA;    U_matrix = expm(2j*pi*hermitian_matrix/T)&#xA;&#xA;    # add control&#xA;    M0 = np.asarray([[1,0],\&#xA;                     [0,0]])&#xA;    M1 = np.asarray([[0,0],\&#xA;                     [0,1]])&#xA;    I = np.eye(np.shape(hermop)[0])&#xA;    controlled_U_matrix = np.kron(M0,I)+np.kron(M1,U_matrix)&#xA;&#xA;    controlled_U_gate = Operator(controlled_U_matrix)&#xA;&#xA;    return controlled_U_gate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="26" LastEditDate="2019-11-26T12:05:20.357" LastActivityDate="2019-11-26T12:05:20.357" Title="Exponentiating Hermitian Matrix for use in QPE/HHL" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8943" PostTypeId="1" CreationDate="2019-11-26T00:21:34.267" Score="2" ViewCount="62" Body="&lt;p&gt;I am really puzzled when it comes to the construction of a stabilizer code. By that, I mean how to come up with the subgroup &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and the matrix generators &lt;span class=&quot;math-container&quot;&gt;$M= \{M_1, M_2, \cdots, M_{n-k}\}$&lt;/span&gt;? In classical error correcting codes, there is a generator matrix &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; where each row is linearly independent and from there, you can find the codewords.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though stabilizer code deals with operators rather the state itself, what is the process?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found this that might be relatable:&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7120/given-n-k-stabiliser-generators-how-can-we-find-an-additional-k-commuting-g&quot;&gt;Given $n-k$ stabiliser generators, how can we find an additional $k$ commuting generators?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="7528" LastEditDate="2019-11-26T20:33:08.757" LastActivityDate="2019-11-26T20:33:08.757" Title="The process behind constructing a Stabilizer Code?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8944" PostTypeId="2" ParentId="8935" CreationDate="2019-11-26T05:07:32.123" Score="2" Body="&lt;p&gt;The credit for this answer goes to met927 in the previous post.  So please upvote that answer instead of this one.  met927's response answered my question.  Not setting up some of the parameters to make system draw faster was my error.  So thank you met927 for responding quickly and answering my question!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is a snippet that one can run quite quickly (less than a minute). &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;###########################################################&#xA;#&#xA;#&#xA;# met927's response incorporated into the github example&#xA;#&#xA;#&#xA;###########################################################&#xA;&#xA;&#xA;from qiskit.aqua import run_algorithm&#xA;from qiskit.aqua.input import LinearSystemInput&#xA;from qiskit.aqua.algorithms.single_sample import HHL&#xA;&#xA;import numpy as np&#xA;&#xA;# System to solve&#xA;# A  = [[1.5, 0.5], [0.5, 1.5]]&#xA;# b =  [2, 2]&#xA;&#xA;matrix = [[1.5, 0.5], [0.5, 1.5]]&#xA;vector = [2, 2]&#xA;&#xA;params = {&#xA;    'problem': {&#xA;        'name': 'linear_system'&#xA;    },&#xA;    'algorithm': {&#xA;        'name': 'HHL'&#xA;    },&#xA;    'eigs': {&#xA;        'expansion_mode': 'suzuki',&#xA;        'expansion_order': 2,&#xA;        'name': 'EigsQPE',&#xA;        'num_ancillae': 3,&#xA;        'num_time_slices': 50&#xA;    },&#xA;    'reciprocal': {&#xA;        'name': 'Lookup'&#xA;    },&#xA;    'backend': {&#xA;        'provider': 'qiskit.BasicAer',&#xA;        'name': 'statevector_simulator'&#xA;    }&#xA;}&#xA;&#xA;params['input'] = {&#xA;    'name': 'LinearSystemInput',&#xA;    'matrix': matrix,&#xA;    'vector': vector&#xA;}&#xA;&#xA;params['algorithm'] = {&#xA;    'truncate_powerdim': False,&#xA;    'truncate_hermitian': False&#xA;}&#xA;params['reciprocal'] = {&#xA;    'name': 'Lookup',&#xA;    'negative_evals': True&#xA;}&#xA;params['eigs'] = {&#xA;    'expansion_mode': 'suzuki',&#xA;    'expansion_order': 2,&#xA;    'name': 'EigsQPE',&#xA;    'negative_evals': False,&#xA;    'num_ancillae': 1,&#xA;    'num_time_slices': 70&#xA;}&#xA;params['initial_state'] = {&#xA;    'name': 'CUSTOM'&#xA;}&#xA;params['iqft'] = {&#xA;    'name': 'STANDARD'&#xA;}&#xA;params['qft'] = {&#xA;    'name': 'STANDARD'&#xA;}&#xA;&#xA;&#xA;# Prep the input&#xA;algo_input = LinearSystemInput(matrix=matrix, vector=vector)&#xA;&#xA;# Run the HHL algorithm&#xA;hhl = HHL.init_params(params, algo_input)&#xA;&#xA;# Draw the circuit&#xA;print(hhl.construct_circuit())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It draws an ascii circuit.    I just wanted to know how to get the routine to draw the circuit.  Thanks again met927.&lt;/p&gt;&#xA;" OwnerUserId="9258" LastActivityDate="2019-11-26T05:07:32.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8945" PostTypeId="1" AcceptedAnswerId="8946" CreationDate="2019-11-26T07:32:20.220" Score="3" ViewCount="413" Body="&lt;p&gt;Suppose I share two Bell states among two participants Alice and Bob in the following manner :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$  |\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) $$&lt;/span&gt;&#xA;Now suppose Alice has qubits &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; and Bob has &lt;span class=&quot;math-container&quot;&gt;$(2,3)$&lt;/span&gt;. I want to find out the density matrices corresponding to Alice, Bob, and combined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first case should I calculate &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;, what should be done, in case there was only one Bell pair shared between Alice and Bob, I would have done &lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = \mathrm{Trace}_B(\rho)$$&lt;/span&gt; can this be generalized when there are more than one Bell pair shared in the sense that I have shared?&#xA;Can somebody help?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="26" LastEditDate="2019-11-26T12:04:20.143" LastActivityDate="2019-11-27T21:59:40.643" Title="Density matrix of a product of Bell states" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8946" PostTypeId="2" ParentId="8945" CreationDate="2019-11-26T08:43:17.457" Score="3" Body="&lt;p&gt;Yes, the overall density matrix shared between Alice and Bob is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;. To get the desnity matrix of either Alice or Bob, you should calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B|\psi\rangle\langle\psi|\qquad\text{Tr}_A|\psi\rangle\langle\psi|&#xA;$$&lt;/span&gt;&#xA;respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in this particular case, the calculation is much simply. Let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; be the Bell pair such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=|\phi_{12}\rangle|\phi_{34}\rangle.&#xA;$$&lt;/span&gt;&#xA;Because there's a separable partition between (1,2) and (3,4), this is not changed by the partial trace. Thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B|\psi\rangle\langle\psi|=\left(\text{Tr}_2|\phi\rangle\langle\phi|\right)\otimes \left(\text{Tr}_3|\phi\rangle\langle\phi|\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You imply that you know how to do the partial trace for a single Bell state. The answer is &lt;span class=&quot;math-container&quot;&gt;$I/2$&lt;/span&gt;. So, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B|\psi\rangle\langle\psi|=\frac{1}{4}I\otimes I,&#xA;$$&lt;/span&gt;&#xA;the maximally mixed state of two qubits. Similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_A|\psi\rangle\langle\psi|=\left(\text{Tr}_1|\phi\rangle\langle\phi|\right)\otimes \left(\text{Tr}_4|\phi\rangle\langle\phi|\right)=\frac{1}{4}I\otimes I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-26T08:43:17.457" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="8947" PostTypeId="1" CreationDate="2019-11-26T09:35:52.097" Score="-4" ViewCount="109" Body="&lt;p&gt;I have composed the gate with IBM Q Experience, but I do not know how to set the answer.&lt;br&gt;&#xA;Please tell me how to set it?&lt;/p&gt;&#xA;" OwnerUserId="9242" LastEditorUserId="26" LastEditDate="2019-11-30T11:48:02.950" LastActivityDate="2019-11-30T11:48:02.950" Title="Bernstein-Vazirani algorithm in IBM Q Experience" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2019-12-02T12:06:29.800" ContentLicense="CC BY-SA 4.0" />
  <row Id="8948" PostTypeId="2" ParentId="8936" CreationDate="2019-11-26T10:25:56.880" Score="3" Body="&lt;p&gt;I investigated your gate for three different cases:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1) one q-bit:&lt;/strong&gt; in this case the &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is simply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2) two q-bits:&lt;/strong&gt; state &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and conversely, otherwise q-bits are unchanged, so the gate implements q-bits swap&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;3) three or more q-bits:&lt;/strong&gt; gate &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; act like this: state &lt;span class=&quot;math-container&quot;&gt;$|011...1\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$|100...0\rangle$&lt;/span&gt; and conversely. These states are mutually inverse, i.e. to obtain the second one from the first one, it is sufficient to negate all q-bits. The same is true for obtaining the first state from the second one. In all other cases q-bits are unchanged. Thus it is necessary to introduce an indicator that a quantum register is either in state &lt;span class=&quot;math-container&quot;&gt;$|011...1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|100...0\rangle$&lt;/span&gt;. The indicator can be Boolean function &lt;span class=&quot;math-container&quot;&gt;$f = \bar{q_0}q_1...q_{n-1} + q_0\bar{q_1}...\bar{q}_{n-1}$&lt;/span&gt;. It returns &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; for states &lt;span class=&quot;math-container&quot;&gt;$|100...0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|011...1\rangle$&lt;/span&gt;, otherwise it returns &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Note, that ancilla q-bits are needed. After calculation of the indicator, the result is stored in ancilla bit, other ancillas are uncomputed and CNOT gates controlled by the result of the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; are applied on q-bits &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt;...&lt;span class=&quot;math-container&quot;&gt;$|q_{n-1}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please find here a figure of a circuit implementing case 3) for three q-bits. Its expansion for more q-bits is straighforward. Note that I tested the circuit on IBM Q simulator and it works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jntAr.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jntAr.jpg&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2019-11-26T11:20:48.913" LastActivityDate="2019-11-26T11:20:48.913" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8949" PostTypeId="1" AcceptedAnswerId="8951" CreationDate="2019-11-26T10:47:27.897" Score="3" ViewCount="481" Body="&lt;p&gt;I've recently started reading about quantum computing and I apologize in advance if this is (and I think it probably is) a very simple question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've created the following circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Am6Sg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Am6Sg.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I understand this circuit. It sends qubit 1 through the Hadamard gate to give it a 50/50 chance of being 0 or 1. The C-NOT gate means, if &lt;code&gt;q[1]&lt;/code&gt; is 0 then &lt;code&gt;q[0]&lt;/code&gt; remains 0 and if &lt;code&gt;q[1]&lt;/code&gt; is 1 then &lt;code&gt;q[0]&lt;/code&gt; has a not gate applied to make it 1. Therefore, the two qubits are entangled. It does the same to entangle &lt;code&gt;q[1]&lt;/code&gt; and &lt;code&gt;q[2]&lt;/code&gt; and for that reason, when the three are measured it is always 000 or 111 with a 50/50 chance of each. (I may not have understood this part well so if this is wrong, please verify my misunderstanding).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've been fiddling with a similar circuit by adding a Hadamard gate to the third qubit at the beginning which is this circuit producing the below result.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Eg6SX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Eg6SX.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zn5rW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zn5rW.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand how those are the four possible results so please can someone explain how this circuit works. Many thanks&lt;/p&gt;&#xA;" OwnerUserId="9263" LastEditorUserId="26" LastEditDate="2019-11-26T12:38:59.853" LastActivityDate="2019-11-26T12:43:57.937" Title="Explanation of output produced by the following quantum circuit" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8950" PostTypeId="2" ParentId="8949" CreationDate="2019-11-26T12:18:36.843" Score="3" Body="&lt;p&gt;Yes you are absolutely right with your understanding but here is the game:&#xA;All the Qubits are starting with the &lt;strong&gt;|0&gt;&lt;/strong&gt; i.e. &lt;strong&gt;value 0&lt;/strong&gt; until the &lt;strong&gt;Hadamard&lt;/strong&gt; gate is applied. The Hadamard gates just makes the probability of the Qubit being &lt;strong&gt;0 or 1&lt;/strong&gt; to be &lt;strong&gt;50-50&lt;/strong&gt; i.e &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|\mathbf{0}&amp;gt; + \frac{1}{\sqrt{2}}|\mathbf{1}&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now in the second example you applied &lt;strong&gt;H gate&lt;/strong&gt; to &lt;strong&gt;q1&lt;/strong&gt; and &lt;strong&gt;q2&lt;/strong&gt; which gave them the probability of being &lt;strong&gt;0 or 1&lt;/strong&gt; to be &lt;strong&gt;50-50&lt;/strong&gt;. So, lets see all the &lt;strong&gt;possible initial states of the Qubits and their values as outputs on measurement&lt;/strong&gt; first:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;State 1:&lt;/em&gt;&lt;/strong&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;q0 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;0&lt;/strong&gt;---  |&lt;/li&gt;&#xA;&lt;li&gt;q1 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;0&lt;/strong&gt;---  | &lt;/li&gt;&#xA;&lt;li&gt;q2 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;0&lt;/strong&gt;---  |&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Final Output:&lt;/em&gt; &lt;strong&gt;000&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;State 2:&lt;/em&gt;&lt;/strong&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;q0 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;1&lt;/strong&gt;---  |&lt;/li&gt;&#xA;&lt;li&gt;q1 |&lt;strong&gt;1&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;1&lt;/strong&gt;---  | &lt;/li&gt;&#xA;&lt;li&gt;q2 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;1&lt;/strong&gt;---  |&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Final Output:&lt;/em&gt; &lt;strong&gt;111&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;State 3:&lt;/em&gt;&lt;/strong&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;q0 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;0&lt;/strong&gt;---  |&lt;/li&gt;&#xA;&lt;li&gt;q1 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;0&lt;/strong&gt;---  | &lt;/li&gt;&#xA;&lt;li&gt;q2 |&lt;strong&gt;1&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;1&lt;/strong&gt;---  |&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Final Output:&lt;/em&gt; &lt;strong&gt;100&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;em&gt;State 4:&lt;/em&gt;&lt;/strong&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;q0 |&lt;strong&gt;0&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;1&lt;/strong&gt;---  |&lt;/li&gt;&#xA;&lt;li&gt;q1 |&lt;strong&gt;1&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;1&lt;/strong&gt;---  | &lt;/li&gt;&#xA;&lt;li&gt;q2 |&lt;strong&gt;1&lt;/strong&gt;&gt; ---OUTPUT : &lt;strong&gt;0&lt;/strong&gt;---  |&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Final Output:&lt;/em&gt; &lt;strong&gt;011&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I hope this helps. Please specify if you are still having trouble in understanding. &lt;/p&gt;&#xA;" OwnerUserId="9183" LastEditorUserId="9183" LastEditDate="2019-11-26T12:43:57.937" LastActivityDate="2019-11-26T12:43:57.937" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8951" PostTypeId="2" ParentId="8949" CreationDate="2019-11-26T12:26:55.703" Score="5" Body="&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$H | 0 \rangle = | + \rangle = \frac{1}{\sqrt{2}}(| 0 \rangle + | 1 \rangle)$&lt;/span&gt;.&#xA;So, after the two Hadamard gates the state will be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| 0 \rangle \otimes H| 0 \rangle \otimes H| 0 \rangle = \frac{1}{2} | 0 \rangle \otimes (| 0 \rangle + | 1 \rangle)\otimes (| 0 \rangle + | 1 \rangle) =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{2} (| 000 \rangle + | 001 \rangle + | 010 \rangle + | 011 \rangle)&#xA;$$&lt;/span&gt;&#xA;Now after the application of those two CNOT gates the state will be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} (| 000 \rangle + | 001 \rangle + | 111 \rangle + | 110 \rangle)&#xA;$$&lt;/span&gt;&#xA;The last histogram confirms this (in the 00000 representation the state of q[0] is the far right symbol)&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-11-26T12:26:55.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8952" PostTypeId="2" ParentId="8930" CreationDate="2019-11-26T12:44:15.447" Score="4" Body="&lt;p&gt;I think it helps here to write things explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)=\operatorname{Tr}_E[U(\rho\otimes|\mathbf e_0\rangle\!\langle\mathbf e_0|)U^\dagger]$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pick a basis for the environment in which &lt;span class=&quot;math-container&quot;&gt;$|\mathbf e_0\rangle$&lt;/span&gt; is the first element. Note that here &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary matrix in a bipartite system. The operator &lt;em&gt;before&lt;/em&gt; taking the partial trace has matrix elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  [U(\rho\otimes|\mathbf e_0\rangle\!\langle\mathbf e_0|)U^\dagger]_{ij,k\ell} =&#xA;  \sum_{\alpha,\gamma} U_{ij,\alpha 0} \rho_{\alpha\gamma} (U^\dagger)_{\gamma0,k\ell} =&#xA;  \sum_{\alpha,\gamma} U_{ij,\alpha0}\bar U_{k\ell,\gamma0} \rho_{\alpha\gamma}.&#xA;$$&lt;/span&gt;&#xA;Now notice that the partial trace amounts here to make &lt;span class=&quot;math-container&quot;&gt;$j=\ell$&lt;/span&gt; and sum over &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; (because in this notation the indices &lt;span class=&quot;math-container&quot;&gt;$i,k$&lt;/span&gt; refer to the system while &lt;span class=&quot;math-container&quot;&gt;$j,\ell$&lt;/span&gt; to the environment), so that we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  [\mathcal E(\rho)]_{ik} =&#xA;  \sum_j [U(\rho\otimes|\mathbf e_0\rangle\!\langle\mathbf e_0|)U^\dagger]_{ij,kj} =&#xA;  \sum_{\alpha\gamma j} U_{ij,\alpha0}\bar U_{kj,\gamma0}\rho_{\alpha\gamma}.&#xA;$$&lt;/span&gt;&#xA;Notice how this is already essentially an operator sum representation: defining &lt;span class=&quot;math-container&quot;&gt;$(E_{j})_{i\alpha}\equiv U_{ij,\alpha0}$&lt;/span&gt;, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[\mathcal E(\rho)]_{ik}=\sum_j (E_j)_{i\alpha} (\bar E_j)_{k\gamma}\rho_{\alpha\gamma} = \left[\sum_j E_j \rho E^\dagger_j\right]_{ik}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-11-26T13:44:33.313" LastActivityDate="2019-11-26T13:44:33.313" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8953" PostTypeId="1" CreationDate="2019-11-26T14:04:16.393" Score="2" ViewCount="113" Body="&lt;p&gt;Suppose I share three Bell states among two participants Alice and Bob and Charlie in the following manner:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$  |\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) $$&lt;/span&gt;&#xA;I want to find out the density matrix for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; whos has qubits &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; the others have say &lt;span class=&quot;math-container&quot;&gt;$(2,3)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(5,6)$&lt;/span&gt;. So I first calculate &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; and then take the trace over the particles &lt;span class=&quot;math-container&quot;&gt;$(2356)$&lt;/span&gt;, Since this is a long computation, we can just notice that the terms whose inner product will be involved are &lt;span class=&quot;math-container&quot;&gt;$$\langle0000|\rho|0000\rangle,\langle0100|\rho|0100\rangle, \langle1000|\rho|1000\rangle,\langle1100|\rho|1100\rangle,\langle0011|\rho|0011\rangle,\langle0111|\rho|0111\rangle,\langle1011|\rho|1011\rangle,\langle1111|\rho|1111\rangle,$$&lt;/span&gt; the result I get on calculating this is &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{2\left(|0\rangle_1|0\rangle_4\langle0|_1\langle0|_4+|0\rangle_1|1\rangle_4\langle0|_1\langle1|_4+|1\rangle_1|0\rangle_4\langle1|_1\langle0|_4+|1\rangle_1|1\rangle_4\langle1|_1\langle1|_4\right)}{8}=\dfrac{\mathbb{I}\otimes \mathbb{I}}{4} $$&lt;/span&gt; Is this correct? What does this density matrix say about the information that the players have about each others particles?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:28.537" LastActivityDate="2020-11-24T14:22:28.537" Title="Does partial tracing a system with three shared Bell states give the identity?" Tags="&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8954" PostTypeId="1" CreationDate="2019-11-26T14:40:37.593" Score="3" ViewCount="57" Body="&lt;p&gt;In Boson Sampling as first proposed by Aaronson and Arkhipov in &lt;a href=&quot;https://arxiv.org/abs/1011.3245&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv.org/abs/1011.3245&lt;/a&gt;, the interferometer is made up of phase shifters and beamsplitters. As these gates are universal, drawing the interferometer at random (just like in Google's random circuit sampling) gives rise to an approximately Haar-random &lt;span class=&quot;math-container&quot;&gt;$m \times m$&lt;/span&gt; unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on the single photon subspace of the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-mode Fock states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder whether one could also perform BosonSampling with a single beamsplitter. If I understand correctly, a later paper by Aaronson and Bouland &lt;a href=&quot;https://arxiv.org/abs/1310.6718&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv.org/abs/1310.6718&lt;/a&gt; shows that a single non-trivial beamsplitter, say a 50:50 beamsplitter, is universal on the single-photon subspace &lt;strong&gt;omitting any extra phaseshifters&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is thus to confirm whether I could equally well just draw a sufficiently long (how long?) sequence of 50:50 beamsplitters and make up the interferometer in BosonSampling just out of these?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This  claim to me seems very suprising, as I would intuitively think that one needs phaseshifters to get all unitaries, thus I would like to confirm this.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastActivityDate="2019-11-26T14:40:37.593" Title="Boson Sampling with a single beamsplitter" Tags="&lt;quantum-advantage&gt;&lt;universal-gates&gt;&lt;optical-quantum-computing&gt;&lt;boson-sampling&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8955" PostTypeId="2" ParentId="8953" CreationDate="2019-11-26T15:25:28.570" Score="3" Body="&lt;p&gt;The result is correct. You can see it in the other way. You have three two-qubit subsystems &lt;span class=&quot;math-container&quot;&gt;$A = \{1,2\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B = \{3,4\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C = \{5,6\}$&lt;/span&gt;. The whole state is the product state on those three subsystems, i.e. the whole density matrix is &lt;span class=&quot;math-container&quot;&gt;$\rho_A \otimes \rho_B \otimes \rho_C$&lt;/span&gt;. Product state means there are absolutely no correlations between the states on subsystems. Hence you can fully ignore the &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; subsystem if you are interested only in the state on &lt;span class=&quot;math-container&quot;&gt;$D = \{1,4\}$&lt;/span&gt;. Also since &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = \rho_{A} \otimes \rho_{B}$&lt;/span&gt; then it must be &lt;span class=&quot;math-container&quot;&gt;$\rho_D = \rho_1 \otimes \rho_4$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2019-11-26T15:25:28.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8956" PostTypeId="2" ParentId="8936" CreationDate="2019-11-26T19:08:32.760" Score="3" Body="&lt;p&gt;This operation leaves all computational basis states unchanged, except for the &lt;span class=&quot;math-container&quot;&gt;$|0111\dots111\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1000\dots000\rangle$&lt;/span&gt; states, which it exchanges.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first thing to do is to make those two states differ in only one bit position. This can be done by applying CNOT operations controlled by one of the differing bit positions targeting all other differing bit positions. We'll do a CNOT from the leftmost bit to all other bits, resulting in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0111\dots111\rangle \rightarrow |0111\dots111\rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|1000\dots000\rangle \rightarrow |1111\dots111\rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now our states differ in only one bit position. The operation that swaps these two states while affecting no others is a CC..CCNOT controlled by all of the bit positions where the bits are the same (with a control type matching that bit) and targeting the differing bit position.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then repeat the CNOTs from earlier in order to return to the original basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final circuit looks like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NMlfQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NMlfQ.png&quot; alt=&quot;CXXXX XCCCC CXXXX&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this circuit may be upside down, depending on your bit ordering convention.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can check it has the right matrix by &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22QFT4%22],[%22inputA4%22,1,1,1,%22+=A4%22],[%22X%22,%22X%22,%22X%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22X%22,%22X%22,%22X%22,%22%E2%80%A2%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;using Quirk's output display and the state channel duality&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22QFT4%22],[%22inputA4%22,1,1,1,%22+=A4%22],[%22X%22,%22X%22,%22X%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22X%22,%22X%22,%22X%22,%22%E2%80%A2%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/adxmK.png&quot; alt=&quot;matrix shown via state channel duality&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-11-26T19:08:32.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8957" PostTypeId="1" AcceptedAnswerId="8959" CreationDate="2019-11-26T19:25:57.750" Score="2" ViewCount="40" Body="&lt;p&gt;I am implementing a simulation of &lt;a href=&quot;https://en.wikipedia.org/wiki/Simon%27s_problem#Simon&amp;#39;s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simon's Algorithm&lt;/a&gt;, and am at the part of applying the second n-qbit Hadamard transformation, &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt;, to the first of the two n-qbit registers, leaving the second unchanged. I am wondering if I can implement this step as applying the operation &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n} \otimes I$&lt;/span&gt; (Kronecker product) to the combined state of the two registers. I want to do this because after the oracle, the two registers are entangled and cannot be represented as a tensor product of the states of each register (is my understanding correct here?).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am wondering if the following is true&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(H^{\otimes n} \otimes I)|x⟩|y⟩ = H^{\otimes n}|x⟩ \otimes I|y⟩ = H^{\otimes n}|x⟩ \otimes |y⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or more generally is the following true of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;kronecker&lt;/a&gt;/&lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor&lt;/a&gt; product?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(A \otimes B) |x⟩|y⟩ = A|x⟩ \otimes B|y⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7960" LastEditorUserId="26" LastEditDate="2019-11-26T20:00:22.757" LastActivityDate="2019-11-26T20:00:22.757" Title="Simon's Algorithm - How to simulate second Hadamard operation on first register?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8958" PostTypeId="1" AcceptedAnswerId="8968" CreationDate="2019-11-26T19:32:34.523" Score="4" ViewCount="531" Body="&lt;p&gt;Is there any paper or article about the performance of the noise model using &lt;code&gt;basic_device_noise_model()&lt;/code&gt;? For example, like the noise model in the code below.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;device = IBMQ.get_backend('ibmq_16_melbourne')&#xA;properties = device.properties()&#xA;noise_model = noise.device.basic_device_noise_model(properties)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I used that model to test some short-depth circuits and the results are pretty good actually. But I do not think IBM provide any paper or similar thing in the documentation or tutorial about this part. I wonder how they valid their model.&lt;/p&gt;&#xA;" OwnerUserId="9095" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:22.760" LastActivityDate="2020-11-24T14:22:22.760" Title="How good is basic_device_noise_model() simulating the noise in the quantum computer?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8959" PostTypeId="2" ParentId="8957" CreationDate="2019-11-26T19:59:03.460" Score="1" Body="&lt;p&gt;Yes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor product of two linear maps&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$S: V \to X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T: W \to Y$&lt;/span&gt; is the linear map &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S \otimes T: V \otimes W \to X \otimes Y \ni (v \otimes w) \mapsto S(v) \otimes T(w).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-11-26T19:59:03.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8960" PostTypeId="1" CreationDate="2019-11-26T21:29:27.417" Score="3" ViewCount="153" Body="&lt;p&gt;&lt;strong&gt;The question:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt;, and a codespace &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{code}\subset \mathcal{H}$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=\mathcal{H}_{code}\oplus\mathcal{H}_\perp$&lt;/span&gt;. I know that for all &lt;span class=&quot;math-container&quot;&gt;$\psi,\phi\in \mathcal{H}_{code}$&lt;/span&gt;, and for all &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}_A=\mathcal{O}_A\otimes \mathcal{I}_B$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle\phi|[\mathcal{O}_A,\mathcal{O}]|\psi\rangle =0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know what I can conclude about the operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}$&lt;/span&gt; from this. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Some thoughts:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Without the projection into the codespace, we could conclude that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}=\mathcal{O}_B$&lt;/span&gt;. With the projection, the most general thing I can think to write down that satisfies the constraint is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{O}=\mathcal{O}_B + \Pi_\perp \mathcal{O}'\Pi_\perp$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for any operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}'$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Pi_\perp$&lt;/span&gt; projects onto &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_\perp$&lt;/span&gt;. There may be a more general expression, however. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The most related statements I have found occur in the context of operator algebra quantum error correction. For instance (see for instance &lt;a href=&quot;https://journals.aps.org/prx/pdf/10.1103/PhysRevX.7.021022&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill and Pastawski&lt;/a&gt;, theorem 1) the condition to correct a noise channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(\cdot)=\sum_k N_k(\cdot )N_k^\dagger$&lt;/span&gt; with respect to an algebra &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt; is that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[X,\Pi N_k^\dagger N_l \Pi]=0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for all &lt;span class=&quot;math-container&quot;&gt;$X\in \mathcal{A}$&lt;/span&gt; and all Kraus operators &lt;span class=&quot;math-container&quot;&gt;$N_l,N_k$&lt;/span&gt;. This looks like my condition if I took &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}_A$&lt;/span&gt; to be a logical operator. This has lead me to study von Neumann algebras and the theory of operator algebra quantum error correction, but so far this has not been fruitful in answering my original question. &lt;/p&gt;&#xA;" OwnerUserId="8468" LastEditorUserId="26" LastEditDate="2019-11-27T02:06:17.947" LastActivityDate="2019-12-02T14:22:22.700" Title="Implications of commuting within the code space" Tags="&lt;mathematics&gt;&lt;error-correction&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8961" PostTypeId="1" CreationDate="2019-11-27T05:10:02.023" Score="4" ViewCount="166" Body="&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;How would a quantum computer calculate a definite integral (without resorting to approximations) of a function? &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Motivation&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;According to a &lt;a href=&quot;https://physics.stackexchange.com/questions/433329/using-a-time-like-boundary-as-a-computer&quot;&gt;post&lt;/a&gt; of mine (in the context of classical field theory) seems to make the following premises:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;One can always infer the value of a field at a point.&lt;/li&gt;&#xA;&lt;li&gt;There can exist a Robinson Boundary Condition.&lt;/li&gt;&#xA;&lt;li&gt;This (Klien-Gordon) field obeys Lorentz transformations. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The conclusion seems to be:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Using classical calculations and the Robin boundary condition I show&#xA;  that one calculate the anti-derivative of a function within time &lt;span class=&quot;math-container&quot;&gt;$2X$&lt;/span&gt;&#xA;  (I can compute an integral below) &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{2 \alpha}{\beta} e^{ \frac{\alpha}{\beta}X} \int_0^{X}   e^{-&#xA; \frac{\alpha}{\beta}\tau}  \tilde f_0(\tau) d \tau$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f_0$&lt;/span&gt; is an arbitrary function whose integral above converges.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Note: It is unclear to me how a quantum computer would stimulate a classical field in a way which would tell you the definite integral?&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:18.967" LastActivityDate="2020-11-24T14:22:18.967" Title="Using quantum computers to calculate definite integrals?" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8962" PostTypeId="1" CreationDate="2019-11-27T05:52:22.400" Score="0" ViewCount="56" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5173/submitting-jobs-to-ibm-devices-without-python&quot;&gt;This answer&lt;/a&gt; states that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Once it is submitted, your job will be in queue. You will have to request by GET this job ID to get the answer from the backend.&#xA;  The GET URL is: &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/api/Jobs/execution_id&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/api/Jobs/execution_id&lt;/a&gt;.&#xA;  You will get another JSON answer (put it in a &lt;code&gt;r_json&lt;/code&gt; variable). If it has the &lt;code&gt;qasms&lt;/code&gt; item, see if &lt;code&gt;r_json['qasms'][0]&lt;/code&gt; has a &lt;code&gt;result&lt;/code&gt; item and you will get the result of the submission. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But when I download it with python, I got a HTML but not JSON.&#xA;When I open this URL in Chrome, I just enter &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question I meet is there are too many circuit need to run (19200 circuit). But One task can take 64 circuit. (When I try 96 circuit, it fail) So I have to create 300 tasks. Download these result one by one is not easy, so I want a URL.&#xA;If someone can tell me how to download 300 results quickly or how to run more circuit in &lt;strong&gt;One&lt;/strong&gt; task. It also really helpful. Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="55" LastEditDate="2019-11-27T10:45:03.203" LastActivityDate="2019-11-27T10:45:03.203" Title="What is the URL of the result?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8963" PostTypeId="1" CreationDate="2019-11-27T10:41:05.923" Score="1" ViewCount="37" Body="&lt;p&gt;Suppose I prepare a Bell state &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle$&lt;/span&gt;, and distribute the product state &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle_{12}|\beta_{00}\rangle_{34}|\beta_{00}\rangle_{56}$&lt;/span&gt; without telling them which state I prepared, with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; having qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; having &lt;span class=&quot;math-container&quot;&gt;$2,6$&lt;/span&gt;, C having &lt;span class=&quot;math-container&quot;&gt;$3,5$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I calculate the individual density matrices for &lt;span class=&quot;math-container&quot;&gt;$A, B, C$&lt;/span&gt; which comes out to be &lt;span class=&quot;math-container&quot;&gt;$\dfrac{\mathbb{I}\otimes\mathbb{I}}{4}$&lt;/span&gt; for each implying no one has the information about the complete state he/she has since the density matrix is completely mixed. My first question is, is this correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, say I want to calculate the entropy of the entire system, and then the entropy for each subsystem &lt;span class=&quot;math-container&quot;&gt;$A, B, C$&lt;/span&gt;. The entropy of each system can be seen to be &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; by looking at the eigenvalues of the partial density matrices of &lt;span class=&quot;math-container&quot;&gt;$A, B, C$&lt;/span&gt;. Suppose I now tell them what state I shared, will the entropy of the entire system and the subsystem change? What if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; measures his particles &lt;span class=&quot;math-container&quot;&gt;$1,4$&lt;/span&gt;, then will the entropy change?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:15.013" LastActivityDate="2020-11-24T14:22:15.013" Title="Entropy of a shared state as measured by the individual parties" Tags="&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8964" PostTypeId="2" ParentId="8953" CreationDate="2019-11-27T11:10:30.720" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What does this density matrix say about the information that the players have about each others particles?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Nothing, if no further assumptions are made on the initial state. If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; share a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, a reduced state &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; doesn't say anything about the information that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has about &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;'s state.&#xA;Indeed, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can have any state as far as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; knows: any shared state of the form &lt;span class=&quot;math-container&quot;&gt;$\rho^A\otimes \sigma$&lt;/span&gt; is compatible with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;'s knowledge, for any state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If on the other hand Alice knows that the initial state is pure, then knowing that their share of the state is &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can infer the entropy of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;'s state, because &lt;span class=&quot;math-container&quot;&gt;$S(\rho^A)=S(\rho^B)$&lt;/span&gt;. Nothing else can be said though, as any local operation applied to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; will not change &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;'s outcomes.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-27T11:10:30.720" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8965" PostTypeId="2" ParentId="8963" CreationDate="2019-11-27T11:27:32.190" Score="1" Body="&lt;p&gt;The entropy of a system depends on your state of knowledge about it. If you know that a state is pure, then its entropy is zero. If you &quot;tell &lt;span class=&quot;math-container&quot;&gt;$A,B,C$&lt;/span&gt; that the overall shared state is pure&quot;, then they know as much and will, therefore, say that the entropy of the overall state is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; (note that this is essentially a tautological statement). However, for them &lt;em&gt;measure&lt;/em&gt; that the overall state is indeed pure, they need to be able to do nonlocal measurements. If they can only do local measurements, then as far as they are concerned their state is indistinguishable from &lt;span class=&quot;math-container&quot;&gt;$\rho^A\otimes\rho^B\otimes \rho^C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Stated differently, you can think of the entropy of a system as a property of the way it's being measured. If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; measures only their state, they will associate to the measured state an entropy &lt;span class=&quot;math-container&quot;&gt;$S(\rho^A)$&lt;/span&gt;, and this regardless of whatever it's been done by the other parties. Even if you give &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; full knowledge about the shared state, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; still will only be able to measure the entropy &lt;span class=&quot;math-container&quot;&gt;$S(\rho^A)$&lt;/span&gt; with only their share of the state.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-11-27T11:27:32.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8966" PostTypeId="1" AcceptedAnswerId="8967" CreationDate="2019-11-27T14:17:27.253" Score="0" ViewCount="70" Body="&lt;p&gt;I have successfully run &lt;code&gt;bit_flip_error&lt;/code&gt; in Qiskit by function &lt;code&gt;pauli_error&lt;/code&gt;, but I can not find how to implement a &lt;code&gt;kraus_error&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;pauli_error&lt;/code&gt; works as follows: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pauli_error([('X', p_reset), ('I', 1 - p_reset)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;kraus_error&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="26" LastEditDate="2019-11-28T04:34:25.240" LastActivityDate="2019-11-28T04:34:25.240" Title="How can I implement a kraus_error in qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8967" PostTypeId="2" ParentId="8966" CreationDate="2019-11-27T15:00:19.267" Score="1" Body="&lt;p&gt;I believe you can implement it a similar way you implemented the &lt;code&gt;pauli_error&lt;/code&gt;, just with different parameter input. You need to pass in a &lt;code&gt;(list[matrix]): Kraus matrices&lt;/code&gt;. The &lt;code&gt;kraus_error&lt;/code&gt; method is defined &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/blob/stable/qiskit/providers/aer/noise/errors/standard_errors.py#L32&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. You should be able to import it from the same module you import &lt;code&gt;pauli_error&lt;/code&gt; from: &lt;code&gt;qiskit.providers.aer.noise.errors.standard_errors&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-11-27T15:00:19.267" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8968" PostTypeId="2" ParentId="8958" CreationDate="2019-11-27T16:52:52.207" Score="9" Body="&lt;p&gt;There is no specific paper for this, though information on the model can be found in the Qiskit Aer API documentation and is based on the research of IBMQ quantum computing group. As examples you can read some of the following papers for more information about errors in IBMQ devices:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1410.6419&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1410.6419&lt;/a&gt; -- The Methods section at the end has a summary of gate calibration and readout error characterization&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1603.04821&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1603.04821&lt;/a&gt; -- Described types of errors which occur in the way IBMQ devices implement the CNOT gate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h2&gt;TL,DR&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This noise model is a greatly simplified approximate error model and you should not expect it to exactly reproduce errors from a real device.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is because the model is derived from a very small set of parameters which are obtained from device calibration experiments. For example: For gates errors are derived from a single &lt;code&gt;gate_error&lt;/code&gt; parameter along with the gate length and the &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; relaxation time constants for the qubits involved. General 1 and 2 qubit error maps are described by 4x4 matrix and 16x16 complex matrices (CPTP Choi-matrix), which require a lot more than the given parameters to specify in general. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;More details&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To summarize the documentation the basic noise model consists of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Single qubit readout errors&lt;/li&gt;&#xA;&lt;li&gt;Single qubit gate errors on u1, u2, u3 gatese&lt;/li&gt;&#xA;&lt;li&gt;Two-qubit gate errors on cx.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I'll go into more detail below for each case&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Readout Errors&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Readout errors are based on two parameters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The probability of recording an outcome as 0 given it was actually 1&lt;/li&gt;&#xA;&lt;li&gt;The probability of recording an outcome as 1 given it was actually 0&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This assumes readout error are not correlated between qubits for multi-qubit measurements. It also means that measure errors are purely classical (no back action on qubit state), which is accurate for the case where measurements occur at the end of a circuit (which they must currently for actual devices). In practice these errors are quite a good approximation for the readout errors of IBMQ devices.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Gate errors&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The 1 and 2-qubit gate errors are derived from following parameters:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The length of the specific gate&lt;/li&gt;&#xA;&lt;li&gt;The &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; relaxation time values for each qubit in the gate&lt;/li&gt;&#xA;&lt;li&gt;A &lt;code&gt;gate_error&lt;/code&gt; parameter obtained from 1 or 2-qubit randomized benchmarking&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;gate_error&lt;/code&gt; represents the overall error of the gate as is defined as &lt;span class=&quot;math-container&quot;&gt;$1 - F$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is the average gate fidelity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gate error model assumes this error is described by an error channel &lt;span class=&quot;math-container&quot;&gt;$\cal{E} = \cal{E}_{\text{depol}} \circ \cal{E}_{\text{relax}}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\cal{E}_{\text{depol}}$&lt;/span&gt; is a n-qubit depolarizing-error channel and &lt;span class=&quot;math-container&quot;&gt;$\cal{E}_{\text{relax}}$&lt;/span&gt; is a tensor product of 1-qubit thermal relaxation error channels on each qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main limitations/approximations of this model are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It approximates all non-relaxation gate errors as depolarizing errors (so there are no coherent errors)&lt;/li&gt;&#xA;&lt;li&gt;Errors are only applied to gates, so it does not automatically include relaxation errors on idle qubits&lt;/li&gt;&#xA;&lt;li&gt;It does not include any non-local errors such as cross-talk&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The thermal relaxation error channel used is very standard and a good model for relaxation errors during gates, so if gate error is completely due to &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; relaxation (we call this &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;-limited) the model is very good. If gate error is only partially due to to relaxation then it becomes much more approximate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In practice this model is quite good for 1-qubit gate errors where error rates are quite low and close to being &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;-limited, but it will not be for CNOT gates which are not &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; limited. CNOT gates also tend to have higher levels of cross-talk errors which are not captured in this model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another limitation is if you circuit has a lot of idle qubits (qubits not participating in a gate during any point in time) it will underestimate &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; relaxation errors unless you add idle (&lt;code&gt;&quot;id&quot;&lt;/code&gt;) gates to those qubits. This is partially a limitation of thee quantum circuit format (since it has no notion of gate scheduling) and is something I hope to address in future updates to Qiskit Aer.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;References&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Sources: The Qiskit Aer API documentation and source code, and myself (I wrote the code in question).&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2019-11-27T16:52:52.207" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8969" PostTypeId="1" CreationDate="2019-11-27T17:15:09.190" Score="3" ViewCount="183" Body="&lt;p&gt;I was reading a paper titled &quot;&lt;a href=&quot;https://arxiv.org/abs/1811.12420&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using a Recurrent Neural Network to Reconstruct Quantum Dynamics of a Superconducting Qubit from Physical Observations&lt;/a&gt;&quot; and was confused about a stochastic master equation governing the evolution of the single-qubit system. According to the paper, they are denoting the non-unitary evolution of a superconducting qubit. The equation in question is the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;d \rho_{t}=\underbrace{\left(i\left[H_{R}, \rho_{t}\right]+\mathcal{L}\left[\sqrt{\frac{\gamma}{2}} \sigma_{Z}\right] \rho_{t}\right)}_{\text {dissipative evolution }} d t+\underbrace{\sqrt{\eta} \mathcal{H}\left[\sqrt{\frac{\gamma}{2}} \sigma_{Z}\right] \rho_{t}}_{\text {backaction }} d w_{t}&#xA;$$&lt;/span&gt;&#xA;In this case, &lt;span class=&quot;math-container&quot;&gt;$H_{\mathrm{R}}=\frac{\hbar \Omega_{R}}{2} \sigma_{X}$&lt;/span&gt;, &quot;describes a microwave drive at the qubit transition frequency which induces unitary evolution of the qubit state characterized by the Rabi frequency &lt;span class=&quot;math-container&quot;&gt;$\Omega_R$&lt;/span&gt;.&quot; I understand and was able to implement (in MATLAB) the first half of the dissipative evolution, &lt;span class=&quot;math-container&quot;&gt;$i[H_R,p_T]$&lt;/span&gt;, as this is fairly simple; however, what do the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; mean? The paper describes &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; as &quot;the Lindblad superoperator describing the qubit dephasing induced by the measurement of strength &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt;&quot;; however I have little idea as to what this means. What exactly does this mean and, if possible, what are methods of encoding this computationally (in something like MATLAB or python)&lt;/p&gt;&#xA;" OwnerUserId="9254" LastEditorUserId="9254" LastEditDate="2019-11-27T22:49:24.573" LastActivityDate="2019-11-27T22:49:24.573" Title="What is &quot;Lindblad Superoperator&quot; in Stochastic Master Equation" Tags="&lt;programming&gt;&lt;density-matrix&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8970" PostTypeId="2" ParentId="8947" CreationDate="2019-11-27T21:01:25.970" Score="1" Body="&lt;p&gt;I think this should help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.measure([0,1,2,3], [0,1,2,3,4,5])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;for 4 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The secret number = '1001' for the circuit below: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt; the xor gates &quot;cx&quot; in qbit 0 and 3 are because it is 1 on the first and last bit of the secret number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ktYVt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ktYVt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And after that simulate (to get the answer):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CqTUq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CqTUq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I've helped.&lt;/p&gt;&#xA;" OwnerUserId="9277" LastEditorUserId="45" LastEditDate="2019-11-29T00:39:37.250" LastActivityDate="2019-11-29T00:39:37.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8971" PostTypeId="2" ParentId="8945" CreationDate="2019-11-27T21:59:40.643" Score="0" Body="&lt;p&gt;One can perhaps guess the answer without full calculation. Noting that &quot;tracing&quot; intuitively means losing information, then, if you A is maximally entangled with B, then you lose information about B (or A) then you end up with no information about A. That is basically how qubits lose information to the environment (here B is like an environment for A). &lt;/p&gt;&#xA;" OwnerUserId="9070" LastActivityDate="2019-11-27T21:59:40.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8972" PostTypeId="1" CreationDate="2019-11-27T22:32:29.720" Score="3" ViewCount="993" Body="&lt;p&gt;I tried to follow the web instructions to load Qiskit, including VC++ 2017 Redistributable, but I get many errors upon installation.  The gist seems to be that VC++ 2017 wasn't found.  Some results coped below - any suggestions?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;=========================================================&#xA;.&#xA;.&#xA;.&#xA;  Building wheel for qiskit-aer (setup.py) ... error&#xA;  ERROR: Command errored out with exit status 1:&#xA;.&#xA;.&#xA;.&#xA;.&#xA;  --------------------------------------------------------------------------------&#xA;  -- Trying &quot;Ninja (Visual Studio 15 2017 Win64 v141)&quot; generator&#xA;  --------------------------------&#xA;  ---------------------------&#xA;  ----------------------&#xA;  -----------------&#xA;  ------------&#xA;  -------&#xA;  --&#xA;  Not searching for unused variables given on the command line.&#xA;  CMake Error: CMake was unable to find a build program corresponding to &quot;Ninja&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.&#xA;.&#xA;.&#xA;.&#xA;.&#xA;  ----------------------------------------&#xA;  ERROR: Failed building wheel for qiskit-aer&#xA;  Running setup.py clean for qiskit-aer&#xA;  Building wheel for qiskit-terra (setup.py) ... error&#xA;  ERROR: Command errored out with exit status 1:&#xA;.&#xA;.&#xA;.&#xA;.&#xA;    scikit-build could not get a working generator for your system. Aborting build.&#xA;&#xA;Building windows wheels for Python 3.8 requires Microsoft Visual Studio 2017.&#xA;Get it with &quot;Visual Studio 2017&quot;:&#xA;&#xA;  https://visualstudio.microsoft.com/vs/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9278" LastEditorUserId="55" LastEditDate="2020-07-07T12:50:36.700" LastActivityDate="2020-07-07T12:50:36.700" Title="Qiskit installation failing: VC++ 2017 not found" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8973" PostTypeId="1" CreationDate="2019-11-28T00:47:01.530" Score="2" ViewCount="62" Body="&lt;p&gt;After reading some with regard to the quantum computing gates and the comparison to classic gates it seems that the quantum computer, at least for the time being, is not viewed as a programmable element of a &quot;hardware circuit&quot; but more as a hardware device that combines functions, as in what is termed in &quot;classical computing&quot; ASSP - application-specific signal processors. Is this view right?&lt;/p&gt;&#xA;" OwnerUserId="9261" LastEditorUserId="26" LastEditDate="2019-11-28T12:15:47.543" LastActivityDate="2019-11-28T12:15:47.543" Title="Are quantum gates analogous to ASSPs in classical computing?" Tags="&lt;quantum-gate&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="8974" PostTypeId="1" CreationDate="2019-11-28T02:34:09.417" Score="0" ViewCount="75" Body="&lt;p&gt;Just need some clarification: Results derived as the output of &quot;running&quot; a &quot;quantum circuit&quot; constructed from &quot;quantum gates&quot; are distributed in a certain way, based on the design, and the multiple possible outputs have a distribution with the desired one having the highest probability of occurrence. By using more qubits the &quot;signal to noise&quot; ratio may be improved (by using the appropriate implementation of the &quot;quantum circuit&quot;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is my interpretation right or I am missing some key components?&lt;/p&gt;&#xA;" OwnerUserId="9261" LastEditorUserId="26" LastEditDate="2019-11-28T04:01:31.480" LastActivityDate="2019-11-28T08:36:22.663" Title="Is this interpretation of quantum circuits right?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="8976" PostTypeId="1" AcceptedAnswerId="8985" CreationDate="2019-11-28T05:29:26.923" Score="4" ViewCount="102" Body="&lt;p&gt;I am trying to prove that the &lt;span class=&quot;math-container&quot;&gt;$|S_{n}\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-lateral rotationally invariant, where &lt;span class=&quot;math-container&quot;&gt;$|S_{n}\rangle$&lt;/span&gt; is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|S_{n}\rangle=\sum_{S \in P_{n}^{n}} (-)^{\tau(S)}|S\rangle\equiv\sum_{S \in P_{n}^{n}} (-)^{\tau(S)}|s_{0}s_{1}.....s_{n-1}\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensional qudit state on Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H_{n}$&lt;/span&gt; is the superposition of its computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle\}, i\in\{0,1,2,...,n-1\}$&lt;/span&gt;. Here, &lt;span class=&quot;math-container&quot;&gt;$|S_n\rangle$&lt;/span&gt; is a state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such particles on &lt;span class=&quot;math-container&quot;&gt;$H_{n}^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider now another basis &lt;span class=&quot;math-container&quot;&gt;$|i'\rangle$&lt;/span&gt; connected with the computational&#xA;basis by a unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|i\rangle=\sum_{j} U_{ji}|i'\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, in this new basis, the state &lt;span class=&quot;math-container&quot;&gt;$|S_{n}\rangle$&lt;/span&gt; takes the same form up to a global phase factor &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. That is,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|S_{n}\rangle=e^{i\phi}\sum_{M \in P_{n}^{n}} (-)^{\tau(M)}|M'\rangle \equiv e^{i\phi}\sum_{M \in P_{n}^{n}} (-)^{\tau(M)}|m_{0}'m_{1}'...m_{n-1}'\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$P_{n}^{n} = \{x_{0}x_{1}x_{2}...x_{n-1}|x_{0},x_{1},x_{2},...,x_{n-1 }\in Z_{n}, \forall j \neq k, x_{j} \neq x_{k}\}$&lt;/span&gt; and the phase factor is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\phi} = \det(U).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|S_{n}\rangle=\sum_{S \in P_{n}^{n}} (-)^{\tau(S)}\sum_{m_{0}=0}^{n-1}U_{m_{0},s_{0}}|m_{0}'\rangle\otimes...\otimes\sum_{m_{n-1}=0}^{n-1}U_{m_{n-1},s_{n-1}}|m_{n-1}'\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\left[\sum_{M \in P_{n}^{n}} + \sum_{M \not\in P_{n}^{n}}\right]\left[\sum_{S \in P_{n}^{n}} (-)^{\tau(S)}U_{m_{0},s_{0}}U_{m_{1},s_{1}}...U_{m_{n-1},s_{n-1}}\right]|M\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\left[\sum_{M \in P_{n}^{n}} + \sum_{M \not\in P_{n}^{n}}\right]det(U_{m_{j}, s_{i}})|M\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.... continued&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here how &lt;span class=&quot;math-container&quot;&gt;$\left[\sum_{S \in P_{n}^{n}} (-)^{\tau(S)}U_{m_{0},s_{0}}U_{m_{1},s_{1}}...U_{m_{n-1},s_{n-1}}\right]= det(U_{m_{j}, s_{i}})$&lt;/span&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please provide a reference if you have any. I have a basic idea about unitary transformations and their matrix representations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\tau(S)$&lt;/span&gt;, named inverse number, is defined as the number of transpositions of pairs of elements of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; that must be composed to place the elements in canonical order, &lt;span class=&quot;math-container&quot;&gt;$012 · · · n − 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="55" LastEditDate="2019-11-28T12:10:38.877" LastActivityDate="2019-11-28T17:00:48.430" Title="Prove that the state $\sum_{S\in P_n}(-)^{\tau(S)}|S\rangle$ is invariant up to a phase when changing the basis" Tags="&lt;mathematics&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8977" PostTypeId="1" CreationDate="2019-11-28T06:14:04.323" Score="9" ViewCount="115" Body="&lt;p&gt;We know that solving a hidden subgroup problem over a non-commutative group is a long standing problem in quantum computing even for groups like &lt;span class=&quot;math-container&quot;&gt;$D_{2n}$&lt;/span&gt; (alternatively can be written as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_n \rtimes \mathbb{Z}_2$&lt;/span&gt;) for general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.   What are some families &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; for which this can be done?   &lt;/p&gt;&#xA;" OwnerUserId="8132" LastEditorUserId="8132" LastEditDate="2019-12-03T10:24:47.833" LastActivityDate="2019-12-03T10:24:47.833" Title="Status of hidden shift and hidden subgroup problems" Tags="&lt;algorithm&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8978" PostTypeId="1" CreationDate="2019-11-28T06:24:57.467" Score="4" ViewCount="365" Body="&lt;p&gt;There are many different physical implementations of qubits: NMR, spin qubit, N color center in diamond, superconducting qubit, trapped ions, photonics quantum computing, topological qubit, etc. However, superconducting qubits is currently the most popular approach, adopted by IBM, Google, Rigetti, Intel, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the advantages of superconducting qubits over other implementations, such as trapped ions? As far as I know, trapped ions qubits have higher gate fidelity and it doesn't require low temperature. Is scalability the main advantage of superconducting qubits over other implementations? &lt;/p&gt;&#xA;" OwnerUserId="7474" LastEditorUserId="55" LastEditDate="2019-11-28T12:23:13.523" LastActivityDate="2019-12-02T10:07:47.740" Title="Why are superconducting qubits the most popular approach to build a quantum computer?" Tags="&lt;physical-qubit&gt;&lt;architecture&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8979" PostTypeId="1" CreationDate="2019-11-28T07:11:43.820" Score="3" ViewCount="151" Body="&lt;p&gt;What are the infrastructures needed to build a cloud quantum computing service like IBM Q Experience? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems this is not a trivial task. IQX has been running for more than 3 years and yet it is taking ages for Google to come up with one.&lt;/p&gt;&#xA;" OwnerUserId="7474" LastActivityDate="2019-11-28T16:31:23.813" Title="How to put a quantum computer on the cloud?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8980" PostTypeId="2" ParentId="8974" CreationDate="2019-11-28T08:36:22.663" Score="2" Body="&lt;p&gt;Yes, when you run an algorithm, often specified as a sequence of gates, you get different results according to some probability distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming we are talking about an error-free computation (this is where, in this field, we use the terminology &quot;noise&quot; which is distinct from the &quot;noise&quot; of &quot;signal to noise ratio&quot;), then most algorithms that you will currently find are designed in such a way that as the size of the input increases (and you therefore use more qubits), the success probability tends to 1 (increasing signal to noise ratio, to use your terminology). However, for a fixed input, you cannot always just throw more qubits at the problem and somehow magically expect to improve the probability of the correct outcome. (That said, some algorithms such as phase estimation do work like that.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, what you can do is exactly what you'd do with probabilistic classical computation: repeat the computation many times and perform a majority vote for the answer. You &lt;em&gt;could&lt;/em&gt; do this in parallel, using more qubits, but you can also do it sequentially, and not use any extra qubits at all.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-28T08:36:22.663" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8981" PostTypeId="2" ParentId="8973" CreationDate="2019-11-28T08:36:33.233" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;(...) depending on what you attempt to compute you &quot;design&quot; your circuit - this is what is called ASSP (Application Specific Signal Processor) where the input is Signal which are processed by the Circuit (processor) to create the processed output - the measure gate. [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8974/is-this-interpretation-of-quantum-circuits-right#comment12316_8974&quot;&gt;Source&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Reading the question more carefully and after your clarification in the comments, I think it has some merit. It is indeed the case that quantum gates are not fully programmable in most architectures; the gate array (quantum circuit) has to be designed according to the specific algorithm and specific problem we're trying to solve (what you call ASSP), which certainly is a nuisance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, note that in Google's latest architectures like the Sycamore, the gates are indeed &lt;a href=&quot;https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;fully programmable&lt;/a&gt; (at least, that's their claim), as is expected of a general-purpose quantum computer. I'm not sure what your impression of &quot;programming&quot; quantum gates is, but it's like manipulating a sequence of laser or microwave pulses on qubits in ion-trap and superconducting architectures respectively. See &lt;a href=&quot;https://cstheory.stackexchange.com/questions/37195/what-does-a-tangible-quantum-gate-look-like/37196#37196&quot;&gt;Peter Shor's answer&lt;/a&gt; for a nice explanation. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-28T12:12:32.367" LastActivityDate="2019-11-28T12:12:32.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8982" PostTypeId="2" ParentId="8973" CreationDate="2019-11-28T09:21:34.310" Score="1" Body="&lt;p&gt;Today many people believe that programming means coding on some language like python; this is not true. The early classical computers were programmed by inserting junctions which connect logical elements of an electronic scheme, and this is also programming.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe modern programmable quantum computers are programmed like that: a programmer is given a certain number of gates, and allowed ways to connect the gates; his task is to connect the gates to implement some algorithm.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-11-28T09:21:34.310" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="8983" PostTypeId="2" ParentId="8976" CreationDate="2019-11-28T14:55:39.157" Score="2" Body="&lt;p&gt;Let unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts as a permutation &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\sigma} = (\sigma_1, \sigma_2,..,\sigma_n) $&lt;/span&gt; on the standard basis. That is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U |i \rangle = | \sigma_i \rangle&#xA;$$&lt;/span&gt;&#xA;for every &lt;span class=&quot;math-container&quot;&gt;$i \in \{0,1,..,n-1\}$&lt;/span&gt;.&lt;br&gt;&#xA;Now if &lt;span class=&quot;math-container&quot;&gt;${\boldsymbol{\rho}} = (\rho_1, \rho_2,..,\rho_n)$&lt;/span&gt; is some permutation, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^{\otimes n} | \boldsymbol{\rho}\rangle = U^{\otimes n} | \rho_1 \rho_2..\rho_n\rangle = | \sigma_{\rho_1} \sigma_{\rho_2}..\sigma_{\rho_n}\rangle = | (\sigma\rho)_1 (\sigma\rho)_2 ..(\sigma\rho)_n \rangle = | \boldsymbol{\sigma\rho}\rangle &#xA;$$&lt;/span&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\sigma\rho}$&lt;/span&gt; is  the composition of permutations &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\sigma}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\rho}$&lt;/span&gt;.&lt;br&gt;&#xA;Now note that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$(-1)^{\tau(\boldsymbol{\sigma\rho})} = (-1)^{\tau(\boldsymbol{\sigma})}(-1)^{\tau(\boldsymbol{\rho})} &#xA;$$&lt;/span&gt;&#xA;Finally&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^{\otimes n} | S_n \rangle &#xA;= U^{\otimes n} \sum_{\rho \in Sym_n}(-1)^{\tau(\boldsymbol{\rho})}| \boldsymbol{\rho}\rangle &#xA;= \sum_{\rho \in Sym_n}(-1)^{\tau(\boldsymbol{\rho})}| \boldsymbol{\sigma\rho} \rangle &#xA;= &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=(-1)^{\tau(\boldsymbol{\sigma})} \sum_{\rho \in Sym_n}(-1)^{\tau(\boldsymbol{\sigma\rho})}| \boldsymbol{\sigma\rho} \rangle &#xA;= (-1)^{\tau(\boldsymbol{\sigma})} | S_n \rangle = \text{det}(U)| S_n \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the proof for every unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; see the DaftWullie's answer.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-11-28T17:00:48.430" LastActivityDate="2019-11-28T17:00:48.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8984" PostTypeId="2" ParentId="8979" CreationDate="2019-11-28T15:14:04.847" Score="2" Body="&lt;p&gt;To have a cloud computing quantum service you need to automate all layers and communication between layers in the quantum system stack:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MwV7m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MwV7m.png&quot; alt=&quot;Full quantum system&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;: &quot;&lt;a href=&quot;https://ieeexplore.ieee.org/abstract/document/7927104&quot; rel=&quot;nofollow noreferrer&quot;&gt;The engineering challenges in quantum computing&lt;/a&gt;&quot; by Almudever et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am sure Google would be able to do this, but for now they are not focusing on this. This gives them the advantage to put all their efforts into proof of concept experiments such as the quantum supremacy demo.&lt;/p&gt;&#xA;" OwnerUserId="9282" LastEditorUserId="26" LastEditDate="2019-11-28T16:31:23.813" LastActivityDate="2019-11-28T16:31:23.813" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="8985" PostTypeId="2" ParentId="8976" CreationDate="2019-11-28T16:17:21.533" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; be two permutations, i.e. lists of length &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; containing some ordering of the elements 0 to &lt;span class=&quot;math-container&quot;&gt;$d-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What we want to calculate is &lt;span class=&quot;math-container&quot;&gt;$\langle \rho|U^{\otimes d}|S\rangle$&lt;/span&gt;. If we can show that this is &lt;span class=&quot;math-container&quot;&gt;$(-1)^{\tau(\rho)}$&lt;/span&gt; up to a global phase, then we know not only that those elements come through the calculation correctly, but by normalisation, it must be that all states not of the form &lt;span class=&quot;math-container&quot;&gt;$|\rho\rangle$&lt;/span&gt; have 0 amplitude.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \rho|U^{\otimes d}|S\rangle=\sum_{\sigma}(-1)^{\tau(\sigma)}\prod_{i=0}^{d-1}U_{\rho_i,\sigma_i}$$&lt;/span&gt;&#xA;Let us change the order that we do the product, so the first element we take as &lt;span class=&quot;math-container&quot;&gt;$\rho_i=0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\rho_i=1$&lt;/span&gt; etc. So, this expression becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{\sigma}(-1)^{\tau(\sigma)}\prod_{i=0}^{d-1}U_{i,(\rho^{-1}\sigma)_i}.&#xA;$$&lt;/span&gt;&#xA;Next, we change the order that we take the sum over permutations (since the set of objects we're summing over is unchanged by the permutation &lt;span class=&quot;math-container&quot;&gt;$\rho^{-1}$&lt;/span&gt;).&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{\sigma}(-1)^{\tau(\rho\sigma)}\prod_{i=0}^{d-1}U_{i,\sigma_i}.&#xA;$$&lt;/span&gt;&#xA;Next, we use &lt;span class=&quot;math-container&quot;&gt;$\tau(\rho\sigma)=\tau(\rho)\tau(\sigma)$&lt;/span&gt;, so we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(-1)^{\tau(\rho)}\left(\sum_{\sigma}(-1)^{\tau(\sigma)}\prod_{i=0}^{d-1}U_{i,\sigma_i}\right).&#xA;$$&lt;/span&gt;&#xA;The term in brackets is a standard way of writing &lt;span class=&quot;math-container&quot;&gt;$\text{det}(U)$&lt;/span&gt;. See, for example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Determinant#n_%C3%97_n_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;. Just to complete the argument in terms of what we had to prove, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, so its determinant has modulus 1, i.e. &lt;span class=&quot;math-container&quot;&gt;$\text{det}(U)$&lt;/span&gt; just contributes a global phase.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-11-28T16:17:21.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8986" PostTypeId="1" CreationDate="2019-11-28T16:57:59.253" Score="1" ViewCount="51" Body="&lt;p&gt;I saw a video in which a guy from IBM was explaining (very generally) quantum computing, it's difference with classical computing etc. &#xA;The talk was not technical at all, it was intended for a broad audience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At some point he told that, if we need to represent our position on the planet with only one bit, we could only tell for example if we are on the North or South hemisphere, but with a qubit we could tell exactly where we where.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;He did this example to explain the difference in how much information can a bit and a qubit contain and to give a little idea of what a superposition is (I think).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From what I know a qubit has more than one state, but when I read it I can only have one or zero, so why this example was made? From what I can understand a qubit can hold more information but I can't read it, so basically it's useless.&lt;/p&gt;&#xA;" OwnerUserId="9285" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:07.643" LastActivityDate="2020-11-24T14:22:07.643" Title="Clarification on the information content of a qubit" Tags="&lt;quantum-state&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-11-28T17:31:07.037" ContentLicense="CC BY-SA 4.0" />
  <row Id="8987" PostTypeId="1" CreationDate="2019-11-28T21:06:12.597" Score="2" ViewCount="219" Body="&lt;p&gt;When I access IBM Q backend with qiskit code, an error occurs. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ &#xA;&#xA;qt = 'xxxxxxxxx'&#xA;&#xA;IBMQ.save_account(qt)&#xA;IBMQ.load_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error message is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;JSONDecodeError                           Traceback (most recent call last)&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in obtain_token(self, config)&#xA;    135             response.raise_for_status()&#xA;--&amp;gt; 136             self.data_credentials = response.json()&#xA;    137         except (requests.HTTPError, ValueError) as ex:&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)&#xA;    896                     pass&#xA;--&amp;gt; 897         return complexjson.loads(self.text, **kwargs)&#xA;    898 &#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)&#xA;    353             parse_constant is None and object_pairs_hook is None and not kw):&#xA;--&amp;gt; 354         return _default_decoder.decode(s)&#xA;    355     if cls is None:&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/json/decoder.py in decode(self, s, _w)&#xA;    338         &quot;&quot;&quot;&#xA;--&amp;gt; 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())&#xA;    340         end = _w(s, end).end()&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)&#xA;    356         except StopIteration as err:&#xA;--&amp;gt; 357             raise JSONDecodeError(&quot;Expecting value&quot;, s, err.value) from None&#xA;    358         return obj, end&#xA;&#xA;JSONDecodeError: Expecting value: line 1 column 1 (char 0)&#xA;&#xA;During handling of the above exception, another exception occurred:&#xA;&#xA;ApiError                                  Traceback (most recent call last)&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqsingleprovider.py in _authenticate(cls, credentials)&#xA;     94 &#xA;---&amp;gt; 95     def _discover_remote_backends(self):&#xA;     96         &quot;&quot;&quot;Return the remote backends available.&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/ibmqconnector.py in __init__(self, token, config, verify)&#xA;    103         self.req = Request(token, config=config, verify=verify)&#xA;--&amp;gt; 104 &#xA;    105     def _check_backend(self, backend_name):&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in __init__(self, token, config, verify, retries, timeout_interval)&#xA;    216                                       proxy_urls=self.proxy_urls,&#xA;--&amp;gt; 217                                       ntlm_credentials=self.ntlm_credentials)&#xA;    218 &#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in __init__(self, token, config, verify, proxy_urls, ntlm_credentials)&#xA;     67         if token:&#xA;---&amp;gt; 68             self.obtain_token(config=self.config)&#xA;     69         else:&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/api/utils.py in obtain_token(self, config)&#xA;    137         except (requests.HTTPError, ValueError) as ex:&#xA;--&amp;gt; 138             raise ApiError('error during login: %s' % str(ex))&#xA;    139 &#xA;&#xA;ApiError: error during login: Expecting value: line 1 column 1 (char 0)&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;ConnectionError                           Traceback (most recent call last)&#xA;&amp;lt;ipython-input-9-2e30fdf423aa&amp;gt; in &amp;lt;module&amp;gt;&#xA;     11 IBMQ.stored_accounts()&#xA;     12 &#xA;---&amp;gt; 13 IBMQ.load_accounts()&#xA;     14 #IBMQ.enable_account(qt)&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqprovider.py in load_accounts(self, **kwargs)&#xA;    197 &#xA;    198     def disable_accounts(self, **kwargs):&#xA;--&amp;gt; 199         &quot;&quot;&quot;Disable accounts in the current session, subject to optional filtering.&#xA;    200 &#xA;    201         The filter kwargs can be `token`, `url`, `hub`, `group`, `project`.&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqprovider.py in _append_account(self, credentials)&#xA;    277         &quot;&quot;&quot;&#xA;    278         return all(getattr(credentials, key_, None) == value_ for&#xA;--&amp;gt; 279                    key_, value_ in filter_dict.items())&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqsingleprovider.py in __init__(self, credentials, ibmq_provider)&#xA;     50         self.credentials = credentials&#xA;     51         self._api = self._authenticate(self.credentials)&#xA;---&amp;gt; 52         self._ibm_provider = ibmq_provider&#xA;     53 &#xA;     54         # Populate the list of remote backends.&#xA;&#xA;/usr/local/oss/anaconda3/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqsingleprovider.py in _authenticate(cls, credentials)&#xA;    101         &quot;&quot;&quot;&#xA;    102         ret = OrderedDict()&#xA;--&amp;gt; 103         configs_list = self._api.available_backends()&#xA;    104         for raw_config in configs_list:&#xA;    105             try:&#xA;&#xA;ConnectionError: Couldn't connect to IBMQ server: error during login: Expecting value: line 1 column 1 (char 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I solve this problem ?&lt;/p&gt;&#xA;" OwnerUserId="9288" LastEditorUserId="26" LastEditDate="2019-11-29T13:57:28.867" LastActivityDate="2020-07-10T06:22:52.630" Title="Couldn't connect to IBMQ server" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8988" PostTypeId="2" ParentId="8987" CreationDate="2019-11-29T00:47:29.343" Score="2" Body="&lt;p&gt;You added an &quot;s&quot; in the final.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IBMQ.load_account&lt;strong&gt;s&lt;/strong&gt;()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The right way is: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;IBMQ.load_account()&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope I could have helped.&lt;/p&gt;&#xA;" OwnerUserId="9277" LastEditorUserId="9277" LastEditDate="2019-11-29T01:14:14.083" LastActivityDate="2019-11-29T01:14:14.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8989" PostTypeId="1" CreationDate="2019-11-29T04:49:41.433" Score="1" ViewCount="68" Body="&lt;p&gt;I don't understand this &quot;trapped ion (qubit implemented by the internal state of trapped ions)&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One qubit implemented by the internal state of trapped ions (plural)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Consider an ion trap. The ions represent qubits by using one electronic state as a |0⟩ and another as a |1⟩&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are these ions states physically? &lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="26" LastEditDate="2019-11-29T13:53:11.730" LastActivityDate="2019-11-29T13:53:11.730" Title="How can one trapped ion physically represent quantum states?" Tags="&lt;quantum-state&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8990" PostTypeId="2" ParentId="8989" CreationDate="2019-11-29T10:29:26.623" Score="2" Body="&lt;p&gt;The ion states are the different energy states of the ion. These different energy states can be denoted with the total&#xA;spin of the ion and the phonon levels of the ion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we look at a Helium atom which has two electrons the total spin can be S = 0 if the electrons are in the following spin state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(\uparrow \downarrow-\downarrow \uparrow)&#xA;$$&lt;/span&gt;&#xA;or the total spin can be S=1 if the electrons are in one of the following three states &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\downarrow \downarrow&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(\uparrow \downarrow+\downarrow \uparrow)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\uparrow \uparrow&#xA;$$&lt;/span&gt;&#xA;The phonon levels represent motional states of the atom. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Often two ion energy states with a different total spin and 0 phonons are chosen as the qubit &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="9282" LastActivityDate="2019-11-29T10:29:26.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8993" PostTypeId="1" CreationDate="2019-11-29T19:45:08.403" Score="2" ViewCount="70" Body="&lt;p&gt;I'm picturing the control equipment on the inside of an ISS wall with the part that needs being cold being on the outer side.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I imagine this has been considered and if so, was the idea rejected for some particular reason?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: It this is off topic please let me know and I'll delete it and post it on a hardware forum.&lt;/p&gt;&#xA;" OwnerUserId="9298" LastActivityDate="2020-04-29T03:06:55.727" Title="Mightn't the cost of a quantum computer be lowered by building it on earth sans cooler and then using it in the frigid vacuum of space?" Tags="&lt;architecture&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8994" PostTypeId="1" CreationDate="2019-11-29T20:01:19.220" Score="4" ViewCount="90" Body="&lt;p&gt;Where does QEC fit in the larger picture of the execution of a fault tolerant quantum algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For QEC, there is an initial preparation of the qubit state and the ancillary qubits; then a &quot;noisy channel&quot;; then a check and error correcting. It seems the algorithm would be the noisy channel, but then the final checking and correcting stage would project the state back to its original state negating any the algorithm did. I'm missing something essential here.&lt;/p&gt;&#xA;" OwnerUserId="8420" LastEditorUserId="26" LastEditDate="2019-11-30T11:30:55.500" LastActivityDate="2019-12-07T07:04:04.367" Title="Where does error correction go in a quantum algorithm?" Tags="&lt;algorithm&gt;&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="8995" PostTypeId="2" ParentId="2203" CreationDate="2019-11-30T04:56:45.770" Score="3" Body="&lt;p&gt;Content wise very similar course but different name &lt;strong&gt;Quantum Information Science I&lt;/strong&gt; (three parts - part 1, 2, and 3) and &lt;strong&gt;Quantum Information Science II&lt;/strong&gt;  were $49 per course as verified certified learning outcome - a series of 3 courses + 1 more extra course on edX. Now the course has been taken down; at least no more new enrollments, and MITx Pro is offering it for \$2250 + \$2250 = \$4500. This is 20 times higher for the same course. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see there would be a number of other MOOCs coming soon. One such is from St Petersberg State University - Introduction to Quantum Computing, but the English version is very poor in quality of content compared to the Russian version on Coursera. However, there is a course from TU Delft on edX, and also one from Keio University at FutureLearn. These options could be looked at; same content but at lower price.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I am coming up with a course on Udemy and also maybe on Coursera with IBM Qiskit open network free version. Stay tuned for it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit-2: Adding edX course links cited above. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum Information Science I&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1.1) Quantum Information Science I, Part 1 &lt;a href=&quot;https://www.edx.org/course/quantum-information-science-i-part-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.edx.org/course/quantum-information-science-i-part-1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;1.2) Quantum Information Science I, Part 2 &lt;a href=&quot;https://www.edx.org/course/quantum-information-science-i-part-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.edx.org/course/quantum-information-science-i-part-2&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;1.3) [Quantum Information Science I, Part 3  &lt;a href=&quot;https://www.edx.org/course/quantum-information-science-i-part-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.edx.org/course/quantum-information-science-i-part-3&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Quantum Information Science II: Advanced quantum algorithms and information theory&lt;/strong&gt;&#xA;&lt;a href=&quot;https://www.edx.org/course/quantum-information-science-ii-advanced-quantum-al&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.edx.org/course/quantum-information-science-ii-advanced-quantum-al&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9302" LastEditorUserId="9302" LastEditDate="2020-01-03T04:07:30.877" LastActivityDate="2020-01-03T04:07:30.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8996" PostTypeId="1" AcceptedAnswerId="9032" CreationDate="2019-11-30T05:15:27.907" Score="1" ViewCount="87" Body="&lt;p&gt;Has anyone used or considered color-space and color superposition for Qutrit work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A classical color-sphere has black and white at its poles, a grey scale as its axis, pure spectral colors as a color-wheel around its equator, and every possible mixed color inside or on the surface of this color space. This is a qutrit-like space analogous to a Bloch Sphere as a qubit space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3E0CL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3E0CL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Research validating superposition of colors as a Qubit (if not a Qutrit) Computing basis-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.aps.org/articles/v9/135&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://physics.aps.org/articles/v9/135&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9301" LastEditorUserId="9301" LastEditDate="2019-12-02T00:30:23.687" LastActivityDate="2019-12-02T14:59:01.793" Title="Color-Space as Effective and Intuitive Qutrit Physical Realization?" Tags="&lt;physical-realization&gt;&lt;qutrit&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-12-06T23:49:30.800" ContentLicense="CC BY-SA 4.0" />
  <row Id="8998" PostTypeId="1" CreationDate="2019-11-30T07:19:54.930" Score="-1" ViewCount="101" Body="&lt;p&gt;Suppose Alice needs to transmit a bit of information about something which happened just before &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt; to Bob who is light years away from Alice. Entangled pairs of qubits, &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt; + \left|11\right&amp;gt;$&lt;/span&gt; (after normalising) is being created at the midpoint of Alice and Bob and shared. There exists a time &lt;span class=&quot;math-container&quot;&gt;$t = -T$&lt;/span&gt; such that the half entangled pair created at &lt;span class=&quot;math-container&quot;&gt;$t = -T$&lt;/span&gt; reaches Alice and Bob at &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt;. Assume that there is a setup with Bob which creates some sort of interference of the qubits he receives. Now, if the required bit to transmit is 0, Alice does nothing. However, if the required bit to transmit is 1, Alice does a measurement of the qubits (half the entangled pairs) which she receives from time &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt;. It means that if Alice gets a 0, the corresponding qubit which Bob has is 0 (similarly with 1). Now, this means that Alice has information of Bob's qubit and the interference stops at &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt;. If Bob keeps seeing interference after &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt;, it means that the bit was 0. If Bob sees that the interference stops at &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt;, the bit was 1. It looks like information got transmitted faster that the speed of light. Can someone please explain why this is wrong?&lt;/p&gt;&#xA;" OwnerUserId="8602" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:03.560" LastActivityDate="2020-11-24T14:22:03.560" Title="Does this setup violate relativity?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="8999" PostTypeId="2" ParentId="8998" CreationDate="2019-11-30T07:43:39.173" Score="2" Body="&lt;p&gt;Bob does not &quot;see&quot; the interference in the sense you assume. To &quot;see&quot; the interference (actually the states of his qubits) Bob needs to measure the qubits, and the measurement gives Bob no information whether Alice measured her qubits or not.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-11-30T07:43:39.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9000" PostTypeId="2" ParentId="8998" CreationDate="2019-11-30T15:18:52.747" Score="2" Body="&lt;p&gt;&quot;Assume that there is a setup with Bob which creates some sort of interference of the qubits he receives.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think you need to be more specific on this point. From Bob's perspective his qubit is simply a mixed state in the computational basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_B=\frac{1}{2}|0\rangle\langle 0|+\frac{1}{2}|1\rangle\langle1|$$&lt;/span&gt;&#xA;so he will not be able to perceive any interference effects.&lt;/p&gt;&#xA;" OwnerUserId="5238" LastEditorUserId="26" LastEditDate="2019-11-30T16:20:45.253" LastActivityDate="2019-11-30T16:20:45.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9001" PostTypeId="1" CreationDate="2019-11-30T16:29:24.227" Score="4" ViewCount="77" Body="&lt;p&gt;Could you please give a direction/reference towards realising the following using any set of realisable quantum gates&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\boxed{|S_{n}\rangle = \frac{1} {\sqrt{n!}} \sum_{S\in P_n^{n}} ( \,-1) \,^{\Gamma(S)}|s_{0}\rangle |s_{1}\rangle ....|s_{n-1}\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$P_n^{n}$&lt;/span&gt; is the set of all permutations of &lt;span class=&quot;math-container&quot;&gt;$Z_n := \{0,1,··· ,n−1\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a permutation (or sequence) in the form &lt;span class=&quot;math-container&quot;&gt;$S = s_0 s_1 ···s_{n−1}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\Gamma(S)$&lt;/span&gt;, named inverse number, is defined as the number of transpositions of pairs of elements of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; that must be composed to place the elements in canonical order, &lt;span class=&quot;math-container&quot;&gt;$012 · · · n−1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9304" LastActivityDate="2020-04-27T13:04:21.387" Title="How to generate the following $n$-level $n$-particle singlet state?" Tags="&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9002" PostTypeId="1" CreationDate="2019-11-30T17:47:07.353" Score="-2" ViewCount="157" Body="&lt;p&gt;Please, be patient with my question &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I already read that there is a heuristic that makes superposition a fact of reality.  In addition, this superposition,  when observed, it has a state of 0 or 1. Furthermore, quantum programming is done on our workstation and executed on remote quantum hardware. Finally, the use of Hadamard gates was able to create a superposition.  Therefore, I'm curious to know if the superposition really is real or is it an assumption? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Edit note: I started this question with Toffoli. However, my question is about Hadamard gate.&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="5986" LastEditorUserId="5986" LastEditDate="2019-12-01T15:45:06.457" LastActivityDate="2019-12-01T15:45:06.457" Title="Is quantum superposition state a truth or an assumption?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;physical-qubit&gt;&lt;superposition&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9003" PostTypeId="2" ParentId="8960" CreationDate="2019-11-30T18:09:53.347" Score="2" Body="&lt;p&gt;I have some ideas&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Since &lt;span class=&quot;math-container&quot;&gt;$[\mathcal{O}^\dagger_A, \mathcal{O}] = - [\mathcal{O}_A, \mathcal{O}^\dagger]^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O} = (\mathcal{O}+\mathcal{O}^\dagger)/2 + (\mathcal{O}-\mathcal{O}^\dagger)/2$&lt;/span&gt; you can solve it only for self-adjoint operators &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}=\mathcal{O}^\dagger$&lt;/span&gt;. And even more, you can consider only real self-adjoint  operators &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O} = \mathcal{O}^\dagger = \mathcal{O}^T$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You can rewrite your equation as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\big( \mathcal{O} \cdot [E_{\psi\phi}, \mathcal{O}_A]\big) = 0,~~ E_{\psi\phi} = |\psi\rangle\langle \phi|&#xA;$$&lt;/span&gt;&#xA;hence it must be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\big( \mathcal{O} \cdot [\Pi X \Pi, \mathcal{O}_A]\big) = 0&#xA;$$&lt;/span&gt;&#xA;for every operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;.&lt;br&gt;&#xA;Also the last equation means that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}^\dagger$&lt;/span&gt; is orthogonal to the subspace &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}\{[\Pi X \Pi, \mathcal{O}_A]\}$&lt;/span&gt; in the operator space with the Hilbert-Schmidt inner product on it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the last characterization it's not hard to show that there is a counterexample to your guess of a general formula. Let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = |v\rangle_A|w\rangle_B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{code} = \{\lambda |\phi\rangle, \lambda \in \mathbb{C}\}$&lt;/span&gt;, i.e. it's 1-dimensional and generated by a product state. In this case &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Pi X \Pi = \chi |\phi\rangle\langle\phi| = \chi |v\rangle\langle v| \otimes |w\rangle\langle w|&#xA;$$&lt;/span&gt; &#xA;So &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;[\Pi X \Pi, \mathcal{O}_A \otimes I_B] = [\chi |v\rangle\langle v|, \mathcal{O}_A ] \otimes |w\rangle\langle w|&#xA;$$&lt;/span&gt;&#xA;The last expression is not equal to zero only if &lt;span class=&quot;math-container&quot;&gt;$[\chi |v\rangle\langle v|, \mathcal{O}_A ] \neq 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's easy to see that if &lt;span class=&quot;math-container&quot;&gt;$[M,E_{11}]=0$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$n \times n$&lt;/span&gt; matrix and &lt;span class=&quot;math-container&quot;&gt;$E_{11}$&lt;/span&gt; is a matrix with a single non-zero element in the &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt; position, then it must be &lt;span class=&quot;math-container&quot;&gt;$m_{12}=m_{13}=...=m_{1n}=0, m_{21}=m_{31}=...=m_{n1}=0$&lt;/span&gt; (and vice versa). So dimension of the subspace &lt;span class=&quot;math-container&quot;&gt;$\text{span}\{[M,E_{11}]\}$&lt;/span&gt; equals to &lt;span class=&quot;math-container&quot;&gt;$2(n-1)$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$d_A = \text{dim}\mathcal{H}_A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$d_B = \text{dim}\mathcal{H}_B$&lt;/span&gt;. We have that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{dim} \big( \text{span} \{ [\Pi X \Pi, \mathcal{O}_A \otimes I_B] \} \big) = 2(d_A-1)&#xA;$$&lt;/span&gt;&#xA;So dimension of the subspace of solutions &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}$&lt;/span&gt; must be &lt;span class=&quot;math-container&quot;&gt;$d_A^2d_B^2 - 2(d_A-1)$&lt;/span&gt;&lt;br&gt;&#xA;But your general formula gives no more than &lt;span class=&quot;math-container&quot;&gt;$d_B^2 + (d_Ad_B-1)^2$&lt;/span&gt; dimensional subspace. If &lt;span class=&quot;math-container&quot;&gt;$d_B=2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d_A&amp;gt;2$&lt;/span&gt; it's just not enough.  &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-12-02T14:22:22.700" LastActivityDate="2019-12-02T14:22:22.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9004" PostTypeId="2" ParentId="9002" CreationDate="2019-11-30T18:37:05.940" Score="4" Body="&lt;p&gt;Whether or not quantum superposition is a &quot;truth&quot;, is a philosophical question. Quantum theory is simply an axiomatic mathematical model of the universe that happens to give correct experimental predictions (at least, for a fairly broad range) for several physical phenomena. It certainly might be possible to come up with a different mathematical model of the universe (though, &lt;a href=&quot;https://physics.stackexchange.com/questions/154614/are-there-any-proposed-alternatives-to-quantum-mechanics-as-there-are-alternativ&quot;&gt;the prospects&lt;/a&gt; look bleak) that would &lt;em&gt;not&lt;/em&gt; require quantum superposition to explain such physical phenomena. In that sense, you can definitely call it an assumption. Every &lt;a href=&quot;https://en.wikipedia.org/wiki/Axiomatic_system&quot; rel=&quot;nofollow noreferrer&quot;&gt;axiomatic system&lt;/a&gt; begins with assumptions (i.e., the axioms) after all! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wondering &lt;em&gt;which&lt;/em&gt; basic &lt;a href=&quot;https://en.wikipedia.org/wiki/Mathematical_formulation_of_quantum_mechanics#Postulates_of_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;axiom of quantum mechanics&lt;/a&gt; implies quantum superposition, it's this: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Each physical system is associated with a (topologically) separable complex &lt;strong&gt;Hilbert space&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; with inner product &lt;span class=&quot;math-container&quot;&gt;$\langle \phi|\psi\rangle$&lt;/span&gt;. Rays (that is, subspaces of complex dimension 1) in &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; are associated with quantum states of the system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If you've taken some introductory courses in linear algebra you should be aware that the &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Hilbert_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert space&lt;/a&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;vector space&lt;/a&gt; whose elements can be written as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Superposition_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear &lt;em&gt;superposition&lt;/em&gt;&lt;/a&gt; of its &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space#Basis_and_dimension&quot; rel=&quot;nofollow noreferrer&quot;&gt;basis elements&lt;/a&gt;. Quantum superposition is just that; a quantum state can be written in terms of linear superpositions of the other (basis) quantum states. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-11-30T22:16:06.180" LastActivityDate="2019-11-30T22:16:06.180" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9006" PostTypeId="2" ParentId="8993" CreationDate="2019-12-01T03:00:12.947" Score="1" Body="&lt;p&gt;Space-based cryogenic cost must become cheaper than Earth-based cryogenic cost and cheaper than classical computation emulating quantum computation. Earth application IO datalink and general space operations cost must fall as well. Mass space colonization will help.&lt;/p&gt;&#xA;" OwnerUserId="9301" LastActivityDate="2019-12-01T03:00:12.947" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9007" PostTypeId="2" ParentId="9002" CreationDate="2019-12-01T03:02:10.447" Score="3" Body="&lt;p&gt;[Can't comment and so, writing an answer]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As @Sanchayan aptly pointed the theoretical/mathematical arguments which could indicate that superposition is not just an assumption. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple more thoughts: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You're right in observing that the superposition collapses to 0 or 1 when observed and that's expected due to the collapse of the wave function. A quick way to check if superposition exists could be to see if it's symptoms are observable - interference (destructive/constructive) as an example. You could verify this by running Grover's search algorithm. You'd see how select amplitudes are amplified while others are diminished. We could make a case here that this extends support for superposition being real.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It's unclear what you mean by &quot;quantum programming is done on our workstation and executed on remote quantum hardware&quot;. When we write a quantum program on our workstation, it's just a blueprint of an &quot;experiment&quot; that we would like the quantum hardware to perform. Once that information is received by the hardware, it sets up the experiment (initializing qubits), manipulates the qubits (using gates - which might result in superposition, entanglement and/or interference in due course) and finally measures the outcome (collapse of the superposition) and then reports it to our workstation. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When you mention, &quot;the use of Toffoli gates was able to create a superposition&quot;, is that a question? Technically, any state which is not a pure basis state (|0&gt; and |1&gt;) could be termed as a superposition since then it would be a free point on the bloch sphere apart from the poles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8852" LastActivityDate="2019-12-01T03:02:10.447" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9009" PostTypeId="1" AcceptedAnswerId="9010" CreationDate="2019-12-01T09:25:34.527" Score="4" ViewCount="63" Body="&lt;p&gt;I am a beginner at QC. I was going through the basics of multi-qubits I encountered a state &lt;span class=&quot;math-container&quot;&gt;$|2\rangle|3\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want clarification on the following points:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can I write &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|10\rangle = |1\rangle|0\rangle$&lt;/span&gt; always?&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$|2\rangle = |10\rangle = |1\rangle|0\rangle$&lt;/span&gt;, Can I write &lt;span class=&quot;math-container&quot;&gt;$|2\rangle|3\rangle = |10\rangle|11\rangle = |1011\rangle$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Assume &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in computational basis.&#xA;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{bmatrix}&#xA;    1 \\&#xA;0&#xA;\end{bmatrix}$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{bmatrix}&#xA;    0 \\&#xA;1&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="8620" LastEditDate="2019-12-01T09:51:25.240" LastActivityDate="2019-12-01T09:53:13.430" Title="How should I interpret $|2\rangle|3\rangle$?" Tags="&lt;tensor-product&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9010" PostTypeId="2" ParentId="9009" CreationDate="2019-12-01T09:53:13.430" Score="3" Body="&lt;p&gt;Your interpretation is right. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, or vector &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}0\\0\\1\\0\end{bmatrix}$&lt;/span&gt; in Hilbert space representing two q-bits system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2)Yes, it is possible as well. The first two q-bits in in state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and last two q-bits in state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, hence the state of all four q-bits is &lt;span class=&quot;math-container&quot;&gt;$|1011\rangle$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; (eleven!) in decimal but I would recommend to avoid writing decimal numbers in this case as they can be confused with binary numbers easily.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-01T09:53:13.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9011" PostTypeId="1" AcceptedAnswerId="9016" CreationDate="2019-12-01T12:57:41.767" Score="2" ViewCount="242" Body="&lt;p&gt;How do I measure the first qubit of an entangled vector, say&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA; 1  \\&#xA; -1 \\&#xA; 0  \\&#xA; 0 \\&#xA; \end{pmatrix}&lt;/span&gt;&#xA;is what I get on the end of Deutsch's algorithm. If I get it right, I should now measure the first qubit in this 2-qubit register. How can I do it?&lt;/p&gt;&#xA;" OwnerUserId="9292" LastEditorUserId="55" LastEditDate="2019-12-03T12:07:32.057" LastActivityDate="2019-12-06T14:47:53.127" Title="How to measure one of the qubits in a two-qubit register?" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;models&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9012" PostTypeId="1" CreationDate="2019-12-01T13:35:13.930" Score="3" ViewCount="304" Body="&lt;p&gt;Consider the modified version of the Traveling Salesman Problem where you are searching for a path of length less than some &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. We can solve this problem using Grover's search where we encode each one of the possible paths as a quantum state and then search for the ones that have length less than &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The oracle for this problem is supposed to add the weights of the edges in the given path, check if the total weight is less than &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; and output 1 if it is the case. How can one construct an oracle for this problem? Is there a practical implementation? How and where to encode the weights of the edges?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="8757" LastEditDate="2020-08-04T07:03:44.893" LastActivityDate="2020-08-04T07:03:44.893" Title="Grover's search for solving TSP" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9013" PostTypeId="2" ParentId="8820" CreationDate="2019-12-01T14:10:29.750" Score="0" Body="&lt;p&gt;The required fidelity &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;  is a function of the Cartesian product of the single &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state space: &lt;span class=&quot;math-container&quot;&gt;$CP^{2^n-1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; copies of  a single qubit state space: &lt;span class=&quot;math-container&quot;&gt;$CP^{1} \cong S^2$&lt;/span&gt;.  The statistics of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;  is computed for a sample space drawn uniformly from the state space regarded as a probability space with respect to its Fubini-Study measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An explicit expression of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is given in coordinates, and the assumption of the average: &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;F&amp;gt; = \frac{1}{2^n}$&lt;/span&gt; is validated by a direct integration.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, the probability density function of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is computed again by a direct integration (and found to be a  &lt;a href=&quot;https://en.wikipedia.org/wiki/Beta_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;beta distribution&lt;/a&gt; with parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha = 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta = 2^n-1$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The computation results are compared to a numerical experiment with &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, the required probability is explicitly computed from the density function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can parametrize the complex projective space &lt;span class=&quot;math-container&quot;&gt;$CP^{N-1}$&lt;/span&gt;, almost everywhere with the coordinates &lt;span class=&quot;math-container&quot;&gt;$ \mathbb{C}^{N-1} \ni \mathbf{\zeta} = \{[\zeta_1, . . ., \zeta_{N-1}]^t\}$&lt;/span&gt;. A random &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional normalized vector corresponding to the point &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\zeta}$&lt;/span&gt; is given by (as a column vector):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle  = \frac{[1, \zeta _1,.,.,., \zeta _{N-1}]^t}{\sqrt{1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta} }}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(We will eventually take &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;). The Fubini-Study volume element is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&#xA;(The prefactor serves for normalizing the volume to a unit mass).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following integral identities are valid:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\int_{CP^{N-1}} \frac{\zeta_k } {(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta})} = 0$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\int_{CP^{N-1}} \frac{\bar{\zeta}_k } {(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta})} = 0$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\int_{CP^{N-1}} \frac{1} {(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta})} = \frac{1}{N}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\int_{CP^{N-1}} \frac{\zeta_k\bar{\zeta}_l } {(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta})} = \frac{1}{N}\delta_{kl}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Fubini-Study volume element is invariant with respect to the following unitary transformation realized non-linearly on the coordinates:&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$U \in U(N)$&lt;/span&gt; be given in the following block form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U  = \begin{bmatrix}&#xA;a &amp;amp; \mathbf{b}^t\\ &#xA;\mathbf{c} &amp;amp; D&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is a scalar, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; dimensional column vectors and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$N-1\times N-1$&lt;/span&gt; matrix).&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1\\ \mathbf{\zeta} \end{bmatrix} \rightarrow  \begin{bmatrix} 1\\ \mathbf{\zeta}'  \end{bmatrix} = (a + \mathbf{b}^t \zeta)\, U \begin{bmatrix} 1\\ \mathbf{\zeta} \end{bmatrix}$$&lt;/span&gt;&#xA;The first factor is a multiplier (cocycle).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th single qubit complex projective line can be parametrized almost everywhere by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\alpha_k(z_k, \bar{z}_k)\rangle  = \frac{[1, z_k]^t}{\sqrt{1+\bar{z_k} z_k }}$$&lt;/span&gt;&#xA;And the corresponding volume element:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$d{\mu}_{CP^{1}}(z_k, \bar{z}_k) = \frac{1}{\pi}\frac{dz_k d\bar{z_k}}{(1+\bar{z_k} z_k)^2}$$&lt;/span&gt;&#xA;Denoting by &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; the natural mapping from the power set of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{n} = \{0, .,.,., n-1\}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{2^n}$&lt;/span&gt;: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(x) = \sum_{k \in x} 2^k$$&lt;/span&gt;&#xA;and using the shorthand notation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$z^{ f(x) } = \prod_{ k\in x } z_k$$&lt;/span&gt;&#xA;(with the convention &lt;span class=&quot;math-container&quot;&gt;$\zeta_0 = z_0 = 1$&lt;/span&gt;)&#xA;Tensoring the single qubit vectors and performing the inner product, we get: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\mathbf{\zeta},  z_0, ., ., .  z_{n-1}, \mathbf{\bar{\zeta}}, \bar{z}_0, ., ., .  \bar{z}_{n-1})= \frac{|\sum_{x \in \mathcal{P}(\mathbb{Z}_{n})} \zeta_{f(x)} \bar{z}^{f(x)} |^2}{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta}) \prod_{k \in \mathbb{Z}_{n}} (1+\bar{z_k} z_k)}$$&lt;/span&gt;&#xA;The average of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is computed by means of the following integral:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&amp;lt;F&amp;gt; = \int_{CP^{2^n-1}} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta}}) \prod_{k=0}^{N-1} d{\mu}_{CP^{1}}(z_k, \bar{z}_k) F(\mathbf{\zeta},  z_0, ., ., .  z_{n-1}, \mathbf{\bar{\zeta}}, \bar{z}_0, ., ., .  \bar{z}_{n-1})$$&lt;/span&gt;&#xA;Expanding the numerator of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;, we get a quadratic polynomial in &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\zeta}, \mathbf{\bar{\zeta}}$&lt;/span&gt;. Using the integration formulas, only &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; terms survive, each contributing &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n}$&lt;/span&gt;. Thus, we are left with:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&amp;lt;F&amp;gt; = \frac{1}{2^n} \prod_{k=0}^{N-1} d{\mu}_{CP^{1}}(z_k, \bar{z}_k) \frac{\sum_{x \in \mathcal{P}(\mathbb{Z}_{n})} z^{f(x)} \bar{z}^{f(x)} }{ \prod_{k \in \mathbb{Z}_{n}} (1+\bar{z_k} z_k)}$$&lt;/span&gt;&#xA;The numerator factors to the denominator, and we are left with a product of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; normalized volumes of &lt;span class=&quot;math-container&quot;&gt;$CP^1$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;,&#xA;Thus&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&amp;lt;F&amp;gt; = \frac{1}{2^n}$$&lt;/span&gt;&#xA;Given the explicit expression of the function &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;  on a probability space; its probability density function can be written as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_F(y) = \int_{CP^{2^n-1}} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta}}) \prod_{k=0}^{N-1} d{\mu}_{CP^{1}}(z_k, \bar{z}_k) \delta(F(\mathbf{\zeta},  z_0, ., ., .  z_{n-1}, \mathbf{\bar{\zeta}}, \bar{z}_0, ., ., .  \bar{z}_{n-1}) – y)$$&lt;/span&gt;&#xA;We observe that the numerator of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; can be written as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}1 &amp;amp; \bar{\mathbf{\zeta}}\end{bmatrix}&#xA;\begin{bmatrix}1 \\ \mathbf{z}\end{bmatrix}&#xA;\begin{bmatrix}1 &amp;amp; \bar{\mathbf{z}}\end{bmatrix}&#xA;\begin{bmatrix}1 \\ \mathbf{\zeta}\end{bmatrix}$$&lt;/span&gt;&#xA;The interior matrix (depending on &lt;span class=&quot;math-container&quot;&gt;$\mathbf{z}$&lt;/span&gt; only) is of unit rank; thus it can be diagonalized by a unitary transformation to a matrix of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathrm{diag }\begin{bmatrix} 1+ \mathbf{z}^{\dagger} \mathbf{z}, &amp;amp; 0, &amp;amp; 0, &amp;amp; ... \end{bmatrix}$$&lt;/span&gt;&#xA;(Please notice that the scalar cocycles cancel between the numerator and the denominator and the Fubini-Study measure is invariant under the transformation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As mentioned above, the nonvanishing first element just factors out to the denominator depending on &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. Thus,  we are left with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; integrations on the normalized volumes of &lt;span class=&quot;math-container&quot;&gt;$CP^1$&lt;/span&gt; giving an overall result of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; with respect to the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; integration. As for the &lt;span class=&quot;math-container&quot;&gt;$\zeta$&lt;/span&gt; dependent terms, we are left with only one term of  &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 &amp;amp; \bar{\mathbf{\zeta}}\end{bmatrix} \begin{bmatrix}1 \\ \mathbf{\zeta}\end{bmatrix}$&lt;/span&gt;, which can be taken the first, i.e., &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, thus the delta function term becomes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\delta(\frac{1}{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})}-y)$$&lt;/span&gt;&#xA;Performing the standard manipulations on the delta function, we obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2y^{\frac{3}{2}}(1-y)^{\frac{1}{2}}}\delta(\sqrt{\mathbf{\zeta}^{\dagger} \mathbf{\zeta}}-\sqrt{\frac{1-y}{y}})$$&lt;/span&gt;&#xA;The constraint is a spherical surface of dimension &lt;span class=&quot;math-container&quot;&gt;$2N-3$&lt;/span&gt; inside  &lt;span class=&quot;math-container&quot;&gt;$CP^{N-1}$&lt;/span&gt; and radius &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{1-y}{y}}$&lt;/span&gt;&#xA;Using the surface area formula for a &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; sphere of unit radius:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_{n-1} = \frac{n \pi^{\frac{n}{2}}}{\Gamma(\frac{n}{2}+1)}$$&lt;/span&gt;&#xA;We arrive at:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ p_F(y) = \frac{1}{2y^{\frac{3}{2}}(1-y)^{\frac{1}{2}}} \frac{(2N-2) \pi^{N-1}}{\Gamma(N)} \left(\sqrt{\frac{1-y}{y}}\right)^{2N-3} \frac{(N-1)!}{\pi^{N-1}} y^N  = (N-1)(1-y)^{N-2}$$&lt;/span&gt;&#xA;Which is just the beta distribution, with the parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha = 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta = 2^n-1$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus,  for the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit case, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ p_F(y) = = (2^n-1)(1-y)^{2^n-2}$$&lt;/span&gt;&#xA;A numerical experiment was performed with &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt;  with &lt;span class=&quot;math-container&quot;&gt;$10^6$&lt;/span&gt; draws. The following figure compares the computed probability density function to the experiment's histogram:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MNl9G.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MNl9G.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the probability density function, we get asymptotically for n&gt;&gt;1 and &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;&amp;gt;\frac{1}{2^n}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Pr}(y&amp;gt;\frac{1}{2^n}+\epsilon) = e^{-2^n\epsilon}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2019-12-01T15:36:24.850" LastActivityDate="2019-12-01T15:36:24.850" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9014" PostTypeId="1" AcceptedAnswerId="9026" CreationDate="2019-12-01T15:08:33.423" Score="4" ViewCount="459" Body="&lt;p&gt;I would like to do a quantum tomography on two q-bit state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, I successfully did so for one q-bit based on Nielsen-Chuang. They advise to use this formula for one q-bit density operator estimation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho = \frac{\text{tr}(\rho)I+\text{tr}(X\rho)X+\text{tr}(Y\rho)Y+\text{tr}(Z\rho)Z}{2}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where for example &lt;span class=&quot;math-container&quot;&gt;$\text{tr}(X\rho)$&lt;/span&gt; can be estimated as a sum of eigenvalues coresponding to eigenvectors of an observable &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; divided by total number of observations. Or in other words, a quantum state is measured in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis and eigenvalues (-1 and +1) are assigned to respective outcome of the measurement. Similarly, this is done for observables &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. Clearly &lt;span class=&quot;math-container&quot;&gt;$\text{tr}(\rho)=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, Nielsen and Chuang proposed generalization of quantum state tomography for more q-bits. Density operator is estimated by this formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho=\sum_{\vec{v}}\frac{\text{tr}(\sigma_{v_1}\otimes\sigma_{v_2}...\otimes\sigma_{v_n}\rho)\sigma_{v_1}\otimes\sigma_{v_2}...\otimes\sigma_{v_n}}{2^n}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where sigmas are Pauli matices &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and identity matrix &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. Vector &lt;span class=&quot;math-container&quot;&gt;$\vec{v}; v_{i}\in \{0,1,2,3\}$&lt;/span&gt;; specifies which Pauli matrices are combined in Kronecker product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case of two q-bits, obeservables in estimator above are Kronecker product of two Pauli matrices. I realized that their eigenvector as very often Bell states. For example, observable &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt; is an exception as it has eigenvectors coresponding to basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) In case eigenvectors of a observable coresponds to Bell states, I would measure a quantum state in Bell basis. Am I right?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) How to measure in case an observable is in shape &lt;span class=&quot;math-container&quot;&gt;$I\otimes \sigma$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sigma\otimes I$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is some Pauli matrix? Does it mean that I should measure only one q-bit?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2019-12-02T13:44:31.497" LastActivityDate="2020-07-31T08:43:44.293" Title="Quantum tomography on two qubits" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9015" PostTypeId="1" CreationDate="2019-12-01T15:13:51.730" Score="5" ViewCount="96" Body="&lt;p&gt;Just like other classical and quantum key distribution protocols, BB84 is vulnerable to &amp;quot;man&amp;quot;-in-the-middle attacks, where Eve pretends to be Bob to Alice, and Eve pretends to be Alice to Bob. The countermeasure against this potential &amp;quot;man&amp;quot;-in-the-middle attack is to implement authentication and data integrity checks on the Alice-Bob classical channel. &lt;sup&gt;[1] [2] [4] [5]&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is: what authentication protocol should we use for BB84 and other QKD protocols?&lt;/p&gt;&#xA;&lt;p&gt;I can think of the following candidates:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We could use pre-shared keys as suggested in [1]. But that feels problematic to me for two reasons.&lt;/p&gt;&#xA;&lt;p&gt;1.1. The whole point of having a key distribution protocol is to avoid the need for pre-shared keys. If the pre-shared key is ever leaked, authentication and hence the QKD protocol itself is compromised.&lt;/p&gt;&#xA;&lt;p&gt;1.2. A client can only connect to a server if the client and server already have agreed on a pre-shared key. In many use cases (e.g. web browser connecting to a web server) this is a very unreasonable requirement.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Start with a pre-shared key for the first key agreement. But during that first key agreement, generate some extra key bits that are used for authentication during the next key agreement, etc. This is suggested in [3] and [6]. However, if one of the devices loses its state (e.g. due to a power cycle or field replacement after a failure) we have to revert back to the first pre-shared key. Thus, the first pre-shared key will always be a vector of attack.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In classical key distribution protocols problem, both 1.1 and 1.2 are solved by using authentication protocols such as RSA or DSA that rely on PKI and on the use of certificates and trusted CAs. However, we cannot use RSA or DSA for QKD authentication because both RSA and DSA are quantum-unsafe (they assume discrete logs are hard).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So, to reiterate my question in another way, is there an authentication protocol that achieves both of the following goals?&lt;/p&gt;&#xA;&lt;p&gt;A. It allows a client to authenticate any server without assuming that the client and server have a pre-shared key.&lt;/p&gt;&#xA;&lt;p&gt;B. It is quantum-safe.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;&lt;b&gt;References&lt;/b&gt;:&#xA;&lt;/sup&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;[1] [Is quantum key distribution safe against MITM attacks too?](https://crypto.stackexchange.com/questions/2719/is-quantum-key-distribution-safe-against-mitm-attacks-too#2721)&#xA;&lt;/sup&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;[2] Van Meter, Rodney. Quantum Networking (Networks and Telecommunications). Wiley. Kindle Edition. Section 5.2: &quot;A true man-in-the-middle attack is foiled by (and explains the need for) authentication and data integrity checks on the classical channel.&quot;&#xA;&lt;/sup&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;[3] Reis, André. Quantum Key Distribution Post Processing - A study on the Information Reconciliation Cascade Protocol. Section 1.1 footnote: &quot;Specially important, those [extra key] bits can be used to generate Message Authentication Codes for future QKD executions to extend the length of the shared key&quot;&#xA;&lt;/sup&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;[4] Reis, André. Quantum Key Distribution Post Processing - A study on the Information Reconciliation Cascade Protocol. Section 2.2: &quot;the classical phase uses a public classical authenticated channel (using Digital Signatures or Message Authentication Codes)&quot;&#xA;&lt;/sup&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;[5] ETSI GS QKD 002 V1.1.1 &quot;Quantum Key Distribution; Use Cases&quot;. Section 4.1.2: &quot;Quantum key distribution, too, requires authentication of the parties to rule out man-in-the-middle attacks. This is done by public discussion on the classical channel which uses a message authentication primitive to guarantee message integrity.&quot;&#xA;&lt;/sup&gt;&#xA;&lt;p&gt;&#xA;&lt;sup&gt;&#xA;[6] ETSI GS QKD 002 V1.1.1 &quot;Quantum Key Distribution; Use Cases&quot;. Section 4.1.3: &quot;In QKD, a small fraction of the continuously generated key can be used for information theoretically secure message&#xA;authentication, but when a link is taken into operation, a pre-distributed initial secret is necessary to authenticate the&#xA;public channel before the first quantum keys become available. This is comparable to digital signature schemes, where&#xA;the public key (mostly in the form of identity certificates) of the sender, or the public key of a trusted third party, when&#xA;transitive trust relations are applied, must be pre-distributed (e.g. with the web browser). Insofar the necessity of a&#xA;pre-distributed secret constitutes no principal disadvantage of information theoretically secure authentication schemes,&#xA;as opposed to signature based or MAC based authentication systems, as this is claimed e.g. in [i.21].&quot;&#xA;&lt;/sup&gt;&#xA;" OwnerUserId="4733" LastEditorUserId="4733" LastEditDate="2020-09-29T17:20:10.543" LastActivityDate="2020-09-29T17:20:10.543" Title="What authentication protocol to use for BB84 and other QKD protocols?" Tags="&lt;cryptography&gt;&lt;key-distribution&gt;&lt;bb84&gt;&lt;qkd&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9016" PostTypeId="2" ParentId="9011" CreationDate="2019-12-01T15:53:54.733" Score="4" Body="&lt;p&gt;To measure, observe that you are simply projecting a quantum state onto some basis set of vectors. First, I will note that this state is not normalized. Let us first define the following quantum state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_i\rangle = \begin{pmatrix}1\\-1\\0\\0\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, calculating the corresponding probability yields:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\langle \psi_i|\psi_i\rangle|^2 = (1)(1) + (-1)(-1) = 2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to normalize this state, we will simply divide by &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;. Thus, we obtain the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\-1\\0\\0\end{pmatrix}.$$&lt;/span&gt;&#xA;We now wish to measure this state in the standard basis, and so we wish to project the state onto the set of basis vectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We will now calculate the probability amplitude of the state collapsing to each of those states. That is, we wish to calculate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle00|\psi\rangle\\=\frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;0&amp;amp;0&amp;amp;0\end{pmatrix}\begin{pmatrix}1\\-1\\0\\0\end{pmatrix}\\=\frac{1}{\sqrt{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle01|\psi\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}0&amp;amp;1&amp;amp;0&amp;amp;0\end{pmatrix}\begin{pmatrix}1\\-1\\0\\0\end{pmatrix}\\=-\frac{1}{\sqrt{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And although it is trivial to see that the amplitudes of the two remaining states will be zero, I will include the calculations for completeness:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle10|\psi\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}0&amp;amp;0&amp;amp;1&amp;amp;0\end{pmatrix}\begin{pmatrix}1\\-1\\0\\0\end{pmatrix}\\=0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle11|\psi\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}0&amp;amp;0&amp;amp;0&amp;amp;1\end{pmatrix}\begin{pmatrix}1\\-1\\0\\0\end{pmatrix}\\=0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And so we see that the probability of obtaining the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; states are 0.5 each, and so measurement of the first qubit must yield the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. To see what would happen if you measured the second qubit, simply sample the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; states once according to the aforementioned probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; In response to a comment left on this answer, I have added the following note.&#xA;If you have the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \alpha_0|0\rangle + ... + \alpha_N|N\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;then the &lt;em&gt;probability amplitude&lt;/em&gt; of obtaining a component of the state, &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, is given by &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_i|\psi\rangle$&lt;/span&gt;. Consequently, the &lt;em&gt;probability&lt;/em&gt; of measuring a value associated with &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi_i|\psi\rangle|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5157" LastEditorUserId="5157" LastEditDate="2019-12-06T14:47:53.127" LastActivityDate="2019-12-06T14:47:53.127" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9017" PostTypeId="1" CreationDate="2019-12-01T17:45:29.413" Score="0" ViewCount="49" Body="&lt;p&gt;I came across a &quot;new&quot; type of quantum computer - photonic quantum computing. Is this type of technology of interest here? You may read about an example &lt;a href=&quot;https://medium.com/hackernoon/an-interactive-tutorial-on-quantum-programming-327da388f859&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I wonder how many types of quantum computers are now researched? Any good summary of these technologies?&lt;/p&gt;&#xA;" OwnerUserId="9261" LastEditorUserId="26" LastEditDate="2019-12-01T17:54:14.883" LastActivityDate="2019-12-01T17:54:14.883" Title="How many types of quantum computers are currently being researched?" Tags="&lt;resource-request&gt;&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="0" CommentCount="7" ClosedDate="2019-12-02T01:22:37.693" ContentLicense="CC BY-SA 4.0" />
  <row Id="9018" PostTypeId="1" AcceptedAnswerId="9019" CreationDate="2019-12-01T18:06:13.160" Score="1" ViewCount="123" Body="&lt;p&gt;I am struggling with the density matrix for diagonally polarized photons. Can I think of diagonally polarized photons as a mixture of vertically and horizontally polarized photons?&lt;/p&gt;&#xA;" OwnerUserId="9314" LastEditorUserId="26" LastEditDate="2019-12-01T18:18:14.390" LastActivityDate="2019-12-01T18:18:14.390" Title="Density matrix for a diagonally polarized photon" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9019" PostTypeId="2" ParentId="9018" CreationDate="2019-12-01T18:17:11.130" Score="2" Body="&lt;p&gt;Yes, you can write a diagonally polarized state as a linear &lt;em&gt;superposition&lt;/em&gt; of horizontally and vertically polarized states (&quot;mixture&quot; isn't the right term though; it's still a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1365/whats-the-difference-between-a-pure-and-mixed-quantum-state&quot;&gt;pure state&lt;/a&gt;). For instance, the &lt;span class=&quot;math-container&quot;&gt;$45^{\circ}$&lt;/span&gt; diagonally polarized state &lt;span class=&quot;math-container&quot;&gt;$\lvert \nearrow \rangle$&lt;/span&gt; may be expressed as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert \nearrow \rangle = \frac{1}{\sqrt 2} \lvert \rightarrow \rangle + \frac{1}{\sqrt 2}\lvert \uparrow \rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; of this state can be written as &lt;span class=&quot;math-container&quot;&gt;$\lvert\nearrow\rangle\langle \nearrow\rvert$&lt;/span&gt; (cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2347/density-matrices-for-pure-states-and-mixed-states&quot;&gt;this&lt;/a&gt;); try calculating the matrix notation by yourself. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-12-01T18:17:11.130" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9021" PostTypeId="1" CreationDate="2019-12-02T00:36:48.627" Score="1" ViewCount="417" Body="&lt;p&gt;When I type this: &lt;code&gt;IBMQ.load_account()&lt;/code&gt;, I am getting this error. What does this mean, and how can I rectify it?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;NameError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-2-beb09c0bf764&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 IBMQ.load_account()&#xA;&#xA;NameError: name 'IBMQ' is not defined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9320" LastEditorUserId="26" LastEditDate="2019-12-02T10:19:36.470" LastActivityDate="2020-11-03T15:01:05.730" Title="Can't access IBMQ (NameError: name 'IBMQ' is not defined)" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9022" PostTypeId="1" CreationDate="2019-12-02T05:55:21.223" Score="3" ViewCount="58" Body="&lt;p&gt;I am a beginner at QC, currently going through a &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.94.022333&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; on Quantum Anonymous Voting. Please clarify the orthogonal property described in the following scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; voters &lt;span class=&quot;math-container&quot;&gt;$V_{0}, V_{1}, V_{2}, ..., V_{n-1}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$V_{0}$&lt;/span&gt; is preparing the following state and distributes &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; particles to other &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; players keeping 1st particle with itself.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\boxed{|S_{n}\rangle = \frac{1} {\sqrt{n!}} \sum_{S\in P_n^{n}} ( \,-1) \,^{\Gamma(S)}|s_{0}\rangle |s_{1}\rangle ....|s_{n-1}\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$P_n^{n}$&lt;/span&gt; is the set of all permutations of &lt;span class=&quot;math-container&quot;&gt;$Z_n := \{0,1,··· ,n−1\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a permutation (or sequence) in the form &lt;span class=&quot;math-container&quot;&gt;$S = s_0 s_1 ···s_{n−1}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\Gamma(S)$&lt;/span&gt;, named inverse number, is defined as the number of transpositions of pairs of elements of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; that must be composed to place the elements in canonical order, &lt;span class=&quot;math-container&quot;&gt;$012 · · · n−1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Consider the following security attack&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume there are &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; dishonest voters, &lt;span class=&quot;math-container&quot;&gt;$V_{i_{0}}, V_{i_{1}, V_{i_{2}}},...,V_{i_{l-1}}$&lt;/span&gt;. They first intercept some transmitted particles, entangle them with an auxiliary system prepared in advance and then return the operated particles to honest voters. The state of the whole composite system is denoted by &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. To elude the detection, it is required that all measurements outcomes should be distinct when measuring each particle held by honest voter in the Fourier basis, and thus &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; should be in the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\boxed{|\psi\rangle =  \sum_{S\in P_n^{n-l}} \frac{( \,-1) \,^{\Gamma(S)} F^{\otimes(n-l)} |S\rangle}{\sqrt{|P_n^{n-l}|}}\otimes |u_{S}\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$S=s_{0}s_{j_{0}}...s_{j_{n-l-2}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|u_{S}\rangle$&lt;/span&gt; are the states of composite system of &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; particles and auxiliary system, &lt;span class=&quot;math-container&quot;&gt;$P_{n}^{n-l}=\{x_{0}x_{1}...x_{n-l-1}| x_{0},x_{1},...,x_{n-l-1} \in Z_{n} \}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|P_n^{n-l}| = \frac{n!}{l!}$&lt;/span&gt; is its size. &lt;span class=&quot;math-container&quot;&gt;$P_n^{n-l}$&lt;/span&gt; can be divided into &lt;span class=&quot;math-container&quot;&gt;$\frac{n!}{(n-1)!l!}$&lt;/span&gt; subsets, each one corresponding to the set of all the &#xA;(n-1)! permutations of a &lt;span class=&quot;math-container&quot;&gt;$n-l$&lt;/span&gt; combination of &lt;span class=&quot;math-container&quot;&gt;$Z_{n}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Any two states &lt;span class=&quot;math-container&quot;&gt;$|u_{S_{0}}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|u_{S_{1}}\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$S_{0} \in P_{n}^{n-l,w_{0}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S_{1} \in P_{n}^{n-l,w_{1}}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$w_{0} \neq w_{1}$&lt;/span&gt; should be orthogonal to each other, ie., &lt;span class=&quot;math-container&quot;&gt;$\langle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$u_{S_{0}} | u_{S_{1}}$$\rangle$&lt;/span&gt; = 0. if not the honest voters cannot deterministically know subset &lt;span class=&quot;math-container&quot;&gt;$P_{n}^{n-l,w}$&lt;/span&gt; in which the honest voters announce the correct measurement outcomes to avoid being detected.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want clarification on above highlighted sentence about orthogonality. If possible please help me with an example. &lt;/p&gt;&#xA;" OwnerUserId="9304" LastEditorUserId="26" LastEditDate="2019-12-03T16:53:42.393" LastActivityDate="2019-12-03T16:53:42.393" Title="Please clarify the following orthogonal property (quantum anonymous voting)" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9023" PostTypeId="2" ParentId="9021" CreationDate="2019-12-02T09:38:49.390" Score="1" Body="&lt;p&gt;Please check you have &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt; installed. You can do this by running &lt;code&gt;pip show qiskit-ibmq-provider&lt;/code&gt; in a terminal. If this returns a warning that it isn't installed, you can then install it using the command &lt;code&gt;pip install qiskit-ibmq-provider&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then go back to your code and make sure you have the statement &lt;code&gt;from qiskit import IBMQ&lt;/code&gt; before this line of code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That should take care of things.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="9322" LastEditDate="2019-12-03T07:50:03.013" LastActivityDate="2019-12-03T07:50:03.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9024" PostTypeId="2" ParentId="8978" CreationDate="2019-12-02T10:07:47.740" Score="3" Body="&lt;p&gt;By coincidence, &lt;a href=&quot;https://arstechnica.com/science/2019/11/quantum-computings-also-rans-and-their-fatal-flaws/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article just came out on Ars Technica&lt;/a&gt; which might answer some of your questions. (This is not an endorsement of everything written in that article. But the author basically asked, and researched, the same question that you're asking.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The TL;DR answer is that superconducting qubits are manufactured and allow for better control over other technologies.&lt;/p&gt;&#xA;" OwnerUserId="1790" LastActivityDate="2019-12-02T10:07:47.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9025" PostTypeId="1" AcceptedAnswerId="9028" CreationDate="2019-12-02T11:16:24.423" Score="5" ViewCount="526" Body="&lt;p&gt;I am very new to quantum computing and I have recently started to experiment with &lt;code&gt;qiskit&lt;/code&gt; module in python, by following tutorials and implementing simple algorithms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I constructed the quantum circuit described on this page: &lt;a href=&quot;https://community.qiskit.org/textbook/ch-algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit teleportation&lt;/a&gt; And got same results that were expected:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/80KuB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/80KuB.png&quot; alt=&quot;Teleportation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;my results:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wRQbF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wRQbF.png&quot; alt=&quot;results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which are apparently expected results, since &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;we will always measure 0 from Bob's qubit because we started off with&#xA;  |0⟩&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, if I apply NOT Gate at the start of q0, I still get the exact same results. Is my understanding of algorithm wrong? Shouldnt I be getting q2 as 1 after applying the NOT gate at start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as q&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;circuit = q.QuantumCircuit(3, 3)&#xA;&#xA;# entangle cubit 1 &amp;amp; 2&#xA;&#xA;circuit.h(1)&#xA;&#xA;circuit.cx(1, 2)&#xA;&#xA;# apply CNOT to qubit we want to send&#xA;circuit.cx(0, 1)&#xA;&#xA;circuit.h(0)&#xA;&#xA;circuit.measure([0,1], [0,1])&#xA;&#xA;circuit.cx(1, 2)&#xA;&#xA;circuit.cz(0, 2)&#xA;&#xA;print(circuit)&#xA;&#xA;backend = q.Aer.get_backend('qasm_simulator')&#xA;job = q.execute(circuit, backend, shots=1024)&#xA;result = job.result()&#xA;&#xA;counts = result.get_counts(circuit)&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Outcomes when NOT gate is inserted at the start of q0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ik8QI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ik8QI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9325" LastEditorUserId="26" LastEditDate="2019-12-03T15:59:29.653" LastActivityDate="2019-12-03T15:59:29.653" Title="Understanding quantum teleportation algorithm from qiskit tutorials" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="9026" PostTypeId="2" ParentId="9014" CreationDate="2019-12-02T11:38:14.053" Score="5" Body="&lt;h2&gt;Preliminary&lt;/h2&gt;&#xA;&lt;p&gt;I would like to rewrite the equation that you have in a slightly different manner. Since a density matrix can be written as a matrix, we can also write it down as a linear combination of elements from a basis for the space of density matrices. We can use essentially any basis to do this, but some are preferred: most notably, the Pauli basis. For a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit system, we use the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit Pauli group &lt;span class=&quot;math-container&quot;&gt;$$^{1} \mathcal{P}^{2} = \big(\frac{1}{\sqrt{2}}\{I,X,Y,Z\}\big)^{\otimes 2};$$&lt;/span&gt; the two-fold tensor product of the four Pauli matrices.&lt;/p&gt;&#xA;&lt;p&gt;Then, we can simply expand any density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho = \sum_{P_{i} \in \mathcal{P}^{2}}p_{i}P_{i},&#xA;\end{equation}&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$p_{i} = \mathrm{tr}\big[P_{i}\rho\big]$&lt;/span&gt; the 'coefficent' of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; along &lt;span class=&quot;math-container&quot;&gt;$P_{i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The goal of quantum state tomography is then to determine the coefficients &lt;span class=&quot;math-container&quot;&gt;$\{p_{i}\}$&lt;/span&gt;, thereby characterizing &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; fully. Note that we can also try to expand &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in any other basis for the space of density matrices, we then get different coefficient &lt;span class=&quot;math-container&quot;&gt;$\{p_{i}\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Determining the coefficients &lt;span class=&quot;math-container&quot;&gt;$\{p_{i}\}$&lt;/span&gt;&lt;/h2&gt;&#xA;&lt;p&gt;The coefficients &lt;span class=&quot;math-container&quot;&gt;$\{p_{i}\}$&lt;/span&gt; are readily determined by the fact that a measurement of an observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has an expectation value &lt;span class=&quot;math-container&quot;&gt;$\langle A,\rho \rangle = \mathrm{tr}\big[A\rho\big]$&lt;/span&gt;. Therefore, multiple measurements of the same observable will give information to calculate these expectation values.&lt;/p&gt;&#xA;&lt;h2&gt;The first question&lt;/h2&gt;&#xA;&lt;p&gt;The Bell states are four states that together span the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit Hilbert space. However, the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit density matrix space is spanned by &lt;span class=&quot;math-container&quot;&gt;$4^{2}$&lt;/span&gt; elements; so to be able to perform the expansion of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we need &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; linearly independent observables. You can think of this mathematically like this:&lt;/p&gt;&#xA;&lt;p&gt;The four Bell states &lt;span class=&quot;math-container&quot;&gt;$\{|\Psi_{+}\rangle,|\Psi_{-}\rangle, |\Phi_{+}\rangle, |\Phi_{-}\rangle\}$&lt;/span&gt; allow us to determine the expectation values for the four observables &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{+}\rangle\langle\Psi_{+}|,|\Psi_{-}\rangle\langle\Psi_{-}|,|\Phi_{+}\rangle\langle\Phi_{+}|$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$|\Phi_{-}\rangle\langle\Phi_{-}|$&lt;/span&gt;. However, you are 'missing' the &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; cross-products that together with these four observables span the entire density matrix space. Essentially, you are only determining the diagonal elements of the density matrix expressed in the Bell basis. To determine the off-diagonal elements you need to estimate the eigenvalues of the other observables somehow, which requires some less-than straightforward operations.&lt;/p&gt;&#xA;&lt;h2&gt;The second question&lt;/h2&gt;&#xA;&lt;p&gt;To determine the expectation values for an observable &lt;span class=&quot;math-container&quot;&gt;$I \otimes P$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$P \not = I$&lt;/span&gt;, one can indeed 'just' measure the second qubit in the corresponding eigenbasis to &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, and leaving the other qubit unaffected (essentially tracing out this qubit). Note that if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is also &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, the expectation value (of &lt;span class=&quot;math-container&quot;&gt;$I \otimes I$&lt;/span&gt;) will be equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; by definition.&lt;/p&gt;&#xA;&lt;p&gt;However, there is a method that can be used to infer the expectation values of these observables from other measurement outcomes. As an example, note that the observable &lt;span class=&quot;math-container&quot;&gt;$ZZ = Z \otimes Z$&lt;/span&gt; has four eigenstates, two of which are a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate (&lt;span class=&quot;math-container&quot;&gt;$|00\rangle \&amp;amp; |11\rangle$&lt;/span&gt;) and two of which are a &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstate (&lt;span class=&quot;math-container&quot;&gt;$|01\rangle \&amp;amp; |01\rangle$&lt;/span&gt;).&#xA;Measureing the &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; observable &lt;span class=&quot;math-container&quot;&gt;$N_{\text{tot}}$&lt;/span&gt; times will give counts &lt;span class=&quot;math-container&quot;&gt;$N_{00}, N_{01}, N_{10}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N_{11}$&lt;/span&gt; which together should add up to &lt;span class=&quot;math-container&quot;&gt;$N_{tot}$&lt;/span&gt;. The expectation value for observable &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; can now be estimated:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\mathrm{tr}\big[(ZZ)\rho\big] =&amp;amp; (+1)\mathrm{tr}\big[|00\rangle\langle00|\rho\big] + (+1)\mathrm{tr}\big[|11\rangle\langle11|\rho\big] + \\&#xA;&amp;amp; (-1)\mathrm{tr}\big[|01\rangle\langle01|\rho\big] + (-1)\mathrm{tr}\big[|10\rangle\langle10|\rho\big] \\&#xA;\simeq&amp;amp; +\frac{N_{00}}{N_{\text{tot}}} +\frac{N_{11}}{N_{\text{tot}}} - \frac{N_{01}}{N_{\text{tot}}} - \frac{N_{10}}{N_{\text{tot}}}.&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is based on the fact that &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; can be expanded into its &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstates: &lt;span class=&quot;math-container&quot;&gt;$ZZ = |00\rangle\langle00| + |11\rangle\langle11| - |01\rangle\langle01| - |10\rangle\langle10|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, the observable &lt;span class=&quot;math-container&quot;&gt;$I\otimes Z = IZ$&lt;/span&gt; can too be expanded into its eigenspaces. The thing is, the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstates of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) are both &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstates of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. Therefore, the previously 'measured' eigenstates for &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; can be used to determine the expectation value for &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt; as well. The states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; are now the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstates, whereas &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; are now the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstates; we can thus approximate the expectation value for &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathrm{tr}\big[IZ\rho\big] \simeq +\frac{N_{00}}{N_{\text{tot}}} +\frac{N_{10}}{N_{\text{tot}}} - \frac{N_{01}}{N_{\text{tot}}} - \frac{N_{11}}{N_{\text{tot}}}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The expectation value for &lt;span class=&quot;math-container&quot;&gt;$ZI$&lt;/span&gt; can be determined in a similar manner from the same measurement outcomes, keeping track of the new eigenvalues for all states.&lt;/p&gt;&#xA;&lt;p&gt;Since all states are &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstates of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, and therefore also those of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operators, we can use a similar technique to determine &lt;span class=&quot;math-container&quot;&gt;$IX, XI, IY \ \&amp;amp; \ YI$&lt;/span&gt;. This means that instead of performing &lt;span class=&quot;math-container&quot;&gt;$4^{2}$&lt;/span&gt; different measurements &lt;span class=&quot;math-container&quot;&gt;$N_{\mathrm{tot}}$&lt;/span&gt; times, we only need to perform &lt;span class=&quot;math-container&quot;&gt;$3^{n}$&lt;/span&gt; different measurements. This technique also works for a higher number of qubits, which brings down the cost of QST somewhat.&lt;/p&gt;&#xA;&lt;h2&gt;Final notes&lt;/h2&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt; Please note that I have omitted the term &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{n}}$&lt;/span&gt; from the expansion of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. This means that I have implicitly assumed the Pauli basis to be the &lt;em&gt;normalized&lt;/em&gt; Pauli basis: &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}\big[P_{i}P_{j}\big] = \delta_{ij}$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$\delta_{ij}$&lt;/span&gt; the Kronecker delta), instead of &lt;span class=&quot;math-container&quot;&gt;$2^{n}\delta_{ij}$&lt;/span&gt;. If you wish to use the normal Pauli basis, you have to include the factor of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{n}}$&lt;/span&gt; in the expansion.&lt;/p&gt;&#xA;&lt;p&gt;Note that using a normalized basis does help in some occasions (for instance, here it clears up the notation a bit.) However, you also lose some important properties, most notably that these normalized matrices do not form a group under multiplication anymore.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-07-31T08:43:44.293" LastActivityDate="2020-07-31T08:43:44.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9027" PostTypeId="1" CreationDate="2019-12-02T12:38:01.897" Score="1" ViewCount="67" Body="&lt;p&gt;I have the following problem: I want to create a q# operation for generating a random integer from 1 to max and return the generated number. What algorithm do I need? What does the q# code look like? I am very new to quantum computing so sorry if this is a simple question!&lt;/p&gt;&#xA;" OwnerUserId="9326" LastEditorUserId="26" LastEditDate="2019-12-03T16:00:22.577" LastActivityDate="2019-12-05T01:53:49.323" Title="How to create a q# operation to generate a random number from 1 to max?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9028" PostTypeId="2" ParentId="9025" CreationDate="2019-12-02T12:44:10.427" Score="5" Body="&lt;p&gt;Your circuit does not measure &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; qubit after teleportation; I guess that is why teleportation of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; qubit is shown incorrectly. &lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2019-12-02T13:02:35.393" LastActivityDate="2019-12-02T13:02:35.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9029" PostTypeId="1" CreationDate="2019-12-02T13:34:15.710" Score="5" ViewCount="142" Body="&lt;p&gt;After reading about quantum computers, for a high school research paper, a few questions arose concerning quantum logic gates. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;At first, it seems that quantum logic gates are in essence various forms of electromagnetic radiation that can change the energies of quantum particles, such as electrons, so that the pertaining quantum states change accordingly, although is this assertion correct?&lt;/li&gt;&#xA;&lt;li&gt;Moreover, if quantum gates are fundamentally described as EM-waves, then why are multiple steps of quantum gates in a quantum circuit required to manipulate the qubits; wouldn't it be easier to send a few EM-wave to the selected qubits so the desired quantum states are directly acquired, without using intermediate steps?&lt;/li&gt;&#xA;&lt;li&gt;Or would this be possible, but is it more effective to break up a certain problem into smaller steps through utilizing quantum gates? &lt;/li&gt;&#xA;&lt;li&gt;Lastly, if one wants to apply a quantum gate to four exemplary qubits, does this imply that each of those four qubits requires to be individually manipulated by the same quantum gate? In other words, send four identical EM-waves to each of the four qubits. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hopefully, these questions are clearly formulated and do not cause any ambiguities. By the way, even though mathematics is a profound component of understanding quantum computing, I would rather prefer a more intuitive or casual explanation instead of mathematical expressions, since I simply do not possess the required mathematical abilities. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt;: Fortunately I am acquainted with the Dirac notation of quantum states, such as &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4^{0.5}} (|00\rangle + |01\rangle + |10\rangle + |11\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="26" LastEditDate="2019-12-03T16:23:11.937" LastActivityDate="2019-12-03T16:23:11.937" Title="Why are multiple quantum gates, in a quantum circuit, used?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9031" PostTypeId="2" ParentId="9029" CreationDate="2019-12-02T14:50:33.957" Score="4" Body="&lt;p&gt;I think you would benefit from realizing that quantum gates are an abstraction of the actual operations that we perform on qubits. Just as a qubit is an abstraction (a mathematical model to describe the state of a two-level quantum mechanical system) a quantum (logical) gate is a mathematical construct that we use in the study of quantum algorithms &amp;amp; quantum information science.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way we &lt;em&gt;implement&lt;/em&gt; these mathematical constructs varies. As you may be aware, there are multiple physical systems on which we &lt;em&gt;implement&lt;/em&gt; the mathematical abstraction that is the qubit.&#xA;This can be an electron's spin (which is either up or down, i.e. restricted to two levels), but there are myriad other physical implementations of qubits. If you are not familiar with the concept of spin, just think of it as an intrinsic rotation of the electron along an axis through its north- and south-pole. This can either be anti-clockwise (up) or clockwise (down).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;At first it seems that quantum logic gates are in essence various forms of electromagnetic radiation that can change the energies of quantum particles, such as electrons, so that the pertaining quantum states change accordingly, although is this assertion correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The physical implementation of a quantum logic gate strongly depends on the physical implementation of the qubit which we are concerning. For qubits based on an electron's spin this implementation might indeed be by using electromagnetic waves, but other systems definitely do not always use EM waves. Moreover, electron-spin-qubits are also often operated on by applying a voltage to a conducting material very close to the electron. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The currently most used implementation of a qubit, the transmon qubit, is addressed by applying EM radiation (in the X-ray-regime). A transmon is essentially an altered LC-circuit, (a circuit with a capacitor (dutch: condensator) and an inductor (dutch: spoel).) The LC circuit is altered so that it only has two available quantum states, which are the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Moreover, if quantum gates are fundamentally described as EM-waves, then why are multiple steps of quantum gates in a quantum circuit required to manipulate the qubits, wouldn't it be easier to send a few EM-wave to the selected qubits so the desired quantum states are directly acquired, without using intermediate steps?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;There exist literally uncountable many operations that one can perform on a qubit, so it is virtually impossible to be able to implement all of them explicitly. However, if you restrict yourself to a (relatively small) subset of all operation, you can approach every possible gate very, very well. (Such a subset, by the way, is called an &lt;em&gt;universal gate set&lt;/em&gt;). It is much, much easier to engineer only an implementation of a subset of all the quantum gates.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Or would this be possible, but is it more effective to break up a certain problem into smaller steps through utilizing quantum gates?&#xA;  Essentially, yes. In both engineering and study of algorithms it helps tremendously to limit to a subset. This is not to say that this is without problems though. The subset that you use might be different than for instance I - so to implement your hypothetical algorithm on my hypothetical quantum computer we might need to translate your 'code' or 'instructions' to something that my quantum computer can read. Since you're familiar with computer programming, you might see this as the usage of different, non-compatible assembly languages. In quantum computing, we often call these translation steps 'transpilation'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sometimes it is indeed more useful to think of some very elaborate quantum operation as something on its own, instead of a series of smaller, easier gates. A clear example is the quantum Fourier transform, which uses many smaller gates 'under the hood', but still has a clear defined action. A high-level quantum programmer might want to use the quantum Fourier transform as-is in his or her code, whereas the an implementation on actual hardware will need to be 'dumbed down' to all its smaller parts - this process is known as 'compilation'.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Lastly, if one wants to apply a quantum gate to four exemplary qubits, does this imply that each of those four qubits requires to be individually manipulated by the same quantum gate? In other words, send four identical EM-waves to each of the four qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In a quantum computer, we want to be able to control separate qubits separately. That is to say, maybe we want to flip one qubit, without affecting the other. For this individual control, different qubits are addressed by different operations. For instance, two electron-spin qubits are addressed by applying a voltage to two different physical 'things' - that way, you know that you apply the gate to only the qubit you want. When gates are implemented using EM radiation, different qubits are addressed by EM radiation of different wavelength - the qubits only couple to the EM radiation with the 'correct' wavelength. So to apply the same gate to different qubits means to physically doing separate things.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in our mathematical abstraction (not considering the implementations) the order of application of gates do not matter if they are on separate qubits. For instance, if we have four qubits and we want to perform a bit-flip on all of them, this is represented by the operation &lt;span class=&quot;math-container&quot;&gt;$XXXX$&lt;/span&gt; - the bit-flip or &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation on all four separate qubits. However, this does need to be performed in parallel. Performing nothing on a qubit is denoted by the &lt;em&gt;Identity&lt;/em&gt; or &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operation. So flipping only the first qubit is the operation &lt;span class=&quot;math-container&quot;&gt;$XIII$&lt;/span&gt;. Then flipping only the second is denoted by the operation &lt;span class=&quot;math-container&quot;&gt;$IXII$&lt;/span&gt;, etc.&#xA;So the succession of operations &lt;span class=&quot;math-container&quot;&gt;$XIII$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$IXII$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$IIXI$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$IIIX$&lt;/span&gt; will indeed give the operation &lt;span class=&quot;math-container&quot;&gt;$XXXX$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2019-12-02T15:02:03.177" LastActivityDate="2019-12-02T15:02:03.177" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9032" PostTypeId="2" ParentId="8996" CreationDate="2019-12-02T14:59:01.793" Score="2" Body="&lt;p&gt;Let me for starters address your last comment:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Research validating superposition of colors as a Qubit (if not a Qutrit) Computing basis-&#xA;  &lt;a href=&quot;https://physics.aps.org/articles/v9/135&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://physics.aps.org/articles/v9/135&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This has absolutely nothing to do with the problem at hand. That paper talks about how to generate photons with two frequencies, it has nothing to do with how states can be represented with colour encoding.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;You can use RGB encoding to map elements of &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^3$&lt;/span&gt; to a single color. This can be useful if for example you are dealing with a state in which you have a two-dimensional system (a qubit) interacting with an high-dimensional one. An example of such a system are vector vortex beams, which are states of light in which the polarization is entangled with the orbital angular momentum, and therefore the polarization state depends on the position in the transverse propagation plane (unfortunately, the only example of this kind of RGB encoding actually being used that I know of is as of yet unpublished).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding using this kind of thing to represent the state of a qutrit, I guess you can do it, but I don't know how useful it would be.&#xA;The idea is that given a qutrit state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle+\gamma|2\rangle$$&lt;/span&gt;&#xA;you can represent it as a Bloch sphere attached to each element of another Bloch sphere. One way to do this (other choices are possible) is to have the first Bloch sphere represent the state of the qubit in the space spanned by &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the projector onto the two remaining modes, and the second Bloch sphere represent the state you get after post-selecting on the &lt;span class=&quot;math-container&quot;&gt;$|2\rangle,|3\rangle$&lt;/span&gt; modes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, this means that you are rewriting the state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle =&#xA; \alpha |0\rangle + \left(\sqrt{|\beta|^2+|\gamma|^2}\right) e^{i\arg\beta}&#xA;    \left[&#xA;      \underbrace{\frac{|\beta|}{\sqrt{|\beta|^2+|\gamma|^2}}}_{\equiv \beta'}|1\rangle +&#xA;      \underbrace{\frac{\gamma e^{-i\arg \beta}}{\sqrt{|\beta|^2+|\gamma|^2}}}_{\equiv \gamma'}|2\rangle&#xA;    \right].&#xA;$$&lt;/span&gt;&#xA;We then use &lt;span class=&quot;math-container&quot;&gt;$c_0\equiv \alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_1\equiv\sqrt{|\beta|^2+|\gamma|^2}e^{i\arg\beta}$&lt;/span&gt; as amplitudes of our &quot;first qubit&quot;, and &lt;span class=&quot;math-container&quot;&gt;$\beta',\gamma'$&lt;/span&gt; as amplitudes of the &quot;second qubit&quot;.&#xA;It should be noticed that there are some caveat in doing this. For example, when &lt;span class=&quot;math-container&quot;&gt;$\alpha=1$&lt;/span&gt;, the amplitudes in the second sphere are undefined (although this is not that much of a problem, as it's quite common to have this sort of situation when using nonlinear coordinates).&#xA;Intuitively, the first Bloch sphere encodes the probability of the state being found in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and the relative phase between &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, while the second Bloch sphere encodes the relative probability of finding &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; and their relative phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you do this, you can represent the state as a pair of Bloch spheres, one attached to the point on the first one. If you represent the point on the second Bloch sphere with an RGB encoding, this amounts to representing the state of the qutrit as a coloured point on a sphere.&#xA;Just for fun, I implemented this in Mathematica to see what would come out. If you evaluate the following code (which requires &lt;a href=&quot;https://github.com/szhorvat/MaTeX&quot; rel=&quot;nofollow noreferrer&quot;&gt;MaTeX&lt;/a&gt; to be installed on your system, but if you don't the only thing you lose are the labels on the Bloch sphere):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;fromSphericalCoordinates[{rr_, \[Theta]\[Theta]_, \[Phi]\[Phi]_}] := &#xA;  With[{r = Abs@rr, \[Theta] = Abs@\[Theta]\[Theta], \[Phi] = &#xA;     Abs@\[Phi]\[Phi]}, Which[&#xA;    \[Theta] == 0, {0, 0, 1},&#xA;    \[Theta] == Pi, {0, 0, -1},&#xA;    Not[0 &amp;lt; \[Theta] &amp;lt; \[Pi]], &#xA;    fromSphericalCoordinates[{r, Mod[\[Theta], Pi], \[Phi]}],&#xA;    True, FromSphericalCoordinates[{r, \[Theta], \[Phi]}]&#xA;    ]];&#xA;colorizePointOnSphere[pt_] := RGBColor[(pt + 1)/2];&#xA;&#xA;stateToBlochCoordinates[ket_List] := {&#xA;   2 Re[Conjugate@ket[[1]]*ket[[2]]],&#xA;   2 Im[Conjugate@ket[[1]]*ket[[2]]],&#xA;   Abs[ket[[1]]]^2 - Abs[ket[[2]]]^2&#xA;   };&#xA;&#xA;qutritStateToDoubleSpherePoints[ket_List] := &#xA;  With[{normalizedState = &#xA;     Chop[# E^(-I Arg@First@#)] &amp;amp;@Normalize@ket},&#xA;   With[{&#xA;     firstQubit = {normalizedState[[1]], &#xA;       Sqrt[1 - normalizedState[[1]]^2] E^(&#xA;        I Arg@normalizedState[[2]])},&#xA;     secondQubit = # E^(-I Arg@First@#) &amp;amp;@&#xA;        Normalize@normalizedState[[{2, 3}]] // Chop&#xA;     },&#xA;    {stateToBlochCoordinates@firstQubit, &#xA;     stateToBlochCoordinates@secondQubit}&#xA;    ]];&#xA;&#xA;&#xA;qutritStateToColouredSphere[ket_List] := &#xA;  With[{pts = qutritStateToDoubleSpherePoints@ket},&#xA;   Graphics3D[{PointSize@0.05,&#xA;     colorizePointOnSphere@Last@pts,&#xA;     Point@First@pts&#xA;     }]&#xA;   ];&#xA;&#xA;Get[&quot;https://raw.githubusercontent.com/lucainnocenti/QM/master/\&#xA;BlochSphere.m&quot;]&#xA;Manipulate[&#xA; Column@{qutritStateToDoubleSpherePoints@{Cos[\[Theta]1], &#xA;       Sin[\[Theta]1] Cos[\[Theta]2] E^(I \[Phi]1), &#xA;       Sin[\[Theta]1] Sin[\[Theta]2] E^(&#xA;        I (\[Phi]1 + \[Phi]2))}, #} &amp;amp;@&#xA;  Show[{&#xA;    Graphics3D[{QBlochSphere[]}, ImageSize -&amp;gt; 600],&#xA;    qutritStateToColouredSphere@{Cos[\[Theta]1], &#xA;      Sin[\[Theta]1] Cos[\[Theta]2] E^(I \[Phi]1), &#xA;      Sin[\[Theta]1] Sin[\[Theta]2] E^(I (\[Phi]1 + \[Phi]2))}&#xA;    }, Axes -&amp;gt; True, AxesLabel -&amp;gt; {x, y, z}, Boxed -&amp;gt; False],&#xA; {{\[Theta]1, 0}, 0, Pi/2.001, 0.001, Appearance -&amp;gt; &quot;Labeled&quot;},&#xA; {{\[Theta]2, 0}, 0, Pi/2.001, 0.001, Appearance -&amp;gt; &quot;Labeled&quot;},&#xA; {{\[Phi]1, 0}, -Pi, Pi, 0.001, Appearance -&amp;gt; &quot;Labeled&quot;},&#xA; {{\[Phi]2, 0}, -Pi, Pi, 0.001, Appearance -&amp;gt; &quot;Labeled&quot;}, &#xA; ControlPlacement -&amp;gt; Right&#xA; ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you the following interactive interface to explore how different qutrits would be represented:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DWj0b.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DWj0b.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think that this would be a particularly useful way to represent states. Directly showing a small Bloch sphere at every point of the big Bloch sphere would probably be a better idea.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-12-02T14:59:01.793" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9033" PostTypeId="1" CreationDate="2019-12-02T15:10:23.983" Score="1" ViewCount="135" Body="&lt;p&gt;I have been trying to implement a ripple carry adder using qsikit in IBM Q Experience. I was able to implement full carry adder but I am having trouble with ripple carry adder. I am able to add 100 + 001 or 100 + 010 etc fine however when i try to perform 100+100 i get rubbish output. Here's my implementation in qsikit&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def storeValues(x, y):&#xA;    circuit = QuantumCircuit((len(x)*3)+1,len(x)+1)&#xA;    for i in range(0, len(x)):&#xA;        if x[i] == &quot;1&quot;:&#xA;            circuit.x(i)&#xA;    for j in range(0, len(y)):&#xA;        if y[j] == &quot;1&quot;:&#xA;            circuit.x(len(x)+j)&#xA;    return circuit&#xA;&#xA;def fullAdder(input1, input2, carryin, carryout, circuit):&#xA;    circuit.ccx(input1, input2, carryout)&#xA;    circuit.cx(input1, input2)&#xA;    circuit.ccx(input2, carryin, carryout)&#xA;    circuit.cx(input2, carryin)&#xA;    circuit.cx(input1, input2)&#xA;&#xA;x = '10'&#xA;y = '10'&#xA;circuit = storeValues(x, y)&#xA;for i in range(len(x)):&#xA;    fullAdder(i, len(x)+i, len(x)+len(y)+i, len(x)+len(y)+i+1, circuit)&#xA;    circuit.barrier()&#xA;&#xA;for i in range(len(x)+1):&#xA;    circuit.measure([(len(x)*2)+i], [i])&#xA;#circuit.draw()&#xA;simulator = Aer.get_backend(&quot;qasm_simulator&quot;)&#xA;result = execute(circuit, backend=simulator, shots=1).result()&#xA;print(list(result.get_counts().keys())[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's a circuit diagram &lt;a href=&quot;https://i.stack.imgur.com/SCwHq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SCwHq.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not understand why using Cout as Cin for another full adder is causing problems!&lt;/p&gt;&#xA;" OwnerUserId="9329" LastEditorUserId="26" LastEditDate="2019-12-03T16:00:42.640" LastActivityDate="2019-12-03T16:00:42.640" Title="Ripple Adder using Full Adder" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2019-12-05T09:25:47.373" ContentLicense="CC BY-SA 4.0" />
  <row Id="9034" PostTypeId="1" CreationDate="2019-12-02T16:48:58.367" Score="3" ViewCount="115" Body="&lt;p&gt;I've playing around with a binary classification problem with a dataset of size 1000 examples and 5 features. I'm using the VQC algorithm from the Qiskit package the that uses a feature map and a parametrized variational circuit. The algorithm has a &lt;code&gt;.train()&lt;/code&gt; ( most examples use &lt;code&gt;run()&lt;/code&gt; as well)  method that implements the optimization loop to find the optimal parameters of the variational form and accepts as argument a minibatch size parameter. I'm using the SPSA optimizer, how does batching work in this environment? Does it use a batch of examples to estimate the cost and update the parameters after the batch has been processed like in mini-batch stochastic gradient?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also wanted to execute the learning phase of the VQC on the IBMQ experience platform. Taking into account that most real backend on the IBMQ accept a number of 75 experiments, i.e number of circuits to execute within a submitted job, I've thought that setting mini-batch size to the number of maximum experiments would be reasonable, although I know Aqua handles and manages jobs (splitting, waiting for results) at higher level, so you could set it to any number.&lt;/p&gt;&#xA;" OwnerUserId="5166" LastEditorUserId="26" LastEditDate="2019-12-03T16:01:14.307" LastActivityDate="2019-12-03T16:01:14.307" Title="How does batching work in the optimizer loop of the VQC algorithm in Qiskit Aqua?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9035" PostTypeId="1" CreationDate="2019-12-02T17:18:03.280" Score="9" ViewCount="1363" Body="&lt;p&gt;I have a computer science background, and I'm interested in studying '&lt;em&gt;quantum algorithms&lt;/em&gt;' and anything that is related like '&lt;em&gt;quantum complexity&lt;/em&gt;'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to have all important resources that is needed to study &lt;em&gt;quantum algorithms&lt;/em&gt;. For example, textbooks, papers, surveys. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there are any resources for algorithms like Shor's algorithm, then please could you also share these. There are multiple of textbooks and papers, so can you specify the good one for computer science background. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://www.youtube.com/watch?v=Mye5uaGq5no&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt; by John Watrous is really good for an introduction to quantum algorithms.&lt;/p&gt;&#xA;" OwnerUserId="9016" LastEditorUserId="55" LastEditDate="2019-12-03T15:14:54.873" LastActivityDate="2020-11-08T22:48:10.090" Title="Resources to study quantum algorithms and quantum complexity" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;complexity-theory&gt;" AnswerCount="6" CommentCount="2" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="9036" PostTypeId="2" ParentId="9035" CreationDate="2019-12-02T17:30:32.017" Score="2" Body="&lt;p&gt;There is a &lt;a href=&quot;https://community.qiskit.org/textbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt; that starts from scratch and teaches you all the fundamental concepts of quantum computing, including quantum algorithms. I would also recommend the &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/tree/master/qiskit/fundamentals&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorials&lt;/a&gt; as these are written in python so should accessible to Computer Scientists. There are also further tutorials on things such as &lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/blob/41dfb73df77595c5d5078164ddecfd915e24897b/awards/teach_me_quantum_2018/intro2qc/8.Shor&amp;#39;s%20algorithm.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When learning I also found there were lots of useful videos about specific topics on YouTube.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-02T17:30:32.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9037" PostTypeId="2" ParentId="9035" CreationDate="2019-12-02T18:06:11.967" Score="6" Body="&lt;p&gt;For complexity theory, &lt;a href=&quot;https://www.youtube.com/watch?v=fc12NHko8sw&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' CSSQI 2012 lectures&lt;/a&gt; are the best resource I found so far. &lt;a href=&quot;https://arxiv.org/abs/0804.3401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;'s the corresponding review paper. He approaches the subject in a fairly rigorous manner which is a great thing if you like clarity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could also follow Scott Aaronson's &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=3943&quot; rel=&quot;nofollow noreferrer&quot;&gt;undergraduate lectures&lt;/a&gt; and his 2013 book &lt;a href=&quot;https://www.cambridge.org/us/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computing-democritus#KC913ZrlGKlyMFTd.97&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computing Since Democritus&lt;/em&gt;&lt;/a&gt; in parallel for a more intuitive although slightly hand-wavy approach. &lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-21T15:03:21.600" LastActivityDate="2019-12-21T15:03:21.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9038" PostTypeId="1" CreationDate="2019-12-02T18:19:56.390" Score="4" ViewCount="121" Body="&lt;p&gt;Consider the function &lt;span class=&quot;math-container&quot;&gt;$f:\{0, 1\}^3\to\{0, 1\}^2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$f(x, y, z) = (x \oplus y, y \oplus z)$&lt;/span&gt;. How would you construct its standard unitary representation?&lt;/p&gt;&#xA;" OwnerUserId="9332" LastEditorUserId="26" LastEditDate="2019-12-03T16:32:25.510" LastActivityDate="2019-12-03T16:32:25.510" Title="How to construct the unitary representation of the function $f(x, y, z) = (x \oplus y, y \oplus z)$?" Tags="&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9039" PostTypeId="2" ParentId="9038" CreationDate="2019-12-02T18:38:51.353" Score="6" Body="&lt;p&gt;There’s not exactly a standard way of doing it. The first thing you have to do is make the transformation unitary. The way that’s guaranteed to work is to introduce 2 extra qubits. However that’s not necessary in this case. Instead, the circuit is very simple: controlled not controlled from y targeting z, followed by controlled not controlled from x and targeting y.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is for the function &lt;span class=&quot;math-container&quot;&gt;$g : \{ 0,1 \}^3 \to \{0,1\}^3$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;g(x,y,z)=(x,x\oplus y , y \oplus z)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="434" LastEditDate="2019-12-02T22:21:32.840" LastActivityDate="2019-12-02T22:21:32.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9040" PostTypeId="1" CreationDate="2019-12-02T19:14:29.673" Score="2" ViewCount="215" Body="&lt;p&gt;Over the years I encountered different explanations of quantum computing advantage over classical computers. But I am not sure which explanations are in fact valid and which are not. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum computer utilizes parallelism&lt;/strong&gt;. It tries to arrive to the solution by multiple ways in parallel, which saves the time needed to find the right way.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum computer can leap to the correct solution.&lt;/strong&gt; It can tunnel through potential barriers on the solution landscape to a global maximum or minimum.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum computer can go back and forward in time, repeating the calculation with different data.&lt;/strong&gt; It is claimed that if the result is wrong, the quantum computer in a sense &quot;reverts time&quot;, discarding the result and repeats the calculation with different options using the same time interval.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum computer can manipulate quantities of information below 1 bit independently.&lt;/strong&gt; For instance, if you have 100 variables 1/100 of a bit each, on classical computer you still need 100 bits to store them all, while on quantum computer you can store all these variables in 1 bit.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quantum computer utilizes faster-than-light speed to transfer quantum information during calculation.&lt;/strong&gt; It is claimed that quantum information can be transferred faster than light unlike classical information.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please tell me, which of these interpretations are correct and which are not.&lt;/p&gt;&#xA;" OwnerUserId="9334" LastActivityDate="2019-12-05T05:21:05.617" Title="Interpretations of quantum computing power" Tags="&lt;quantum-advantage&gt;&lt;interpretations&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2019-12-05T09:25:02.267" ContentLicense="CC BY-SA 4.0" />
  <row Id="9041" PostTypeId="2" ParentId="9040" CreationDate="2019-12-02T19:54:10.987" Score="6" Body="&lt;p&gt;1 and 2 have elements of truth, but are only partially correct, with big caveats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 and 5 are complete nonsense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can choose to read 4 the right way to make some sense out of it, but it doesn’t contribute to the computational speed of any algorithms.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-02T19:54:10.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9042" PostTypeId="2" ParentId="9035" CreationDate="2019-12-02T22:29:46.597" Score="3" Body="&lt;p&gt;I would like to add some more sources:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps the most well-known source is the book &quot;Quantum Computation and Quantum Information&quot; by Nielsen &amp;amp; Chuang. Even though the scope of the book is broader than just quantum algorithms, it is well-structured so there is no need to dig through unrelated topics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another source is Ronald de Wolf's lecture notes, which you can find &lt;a href=&quot;https://homepages.cwi.nl/~rdewolf/qcnotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.  As these are updated every year, they are a bit more up-to-date than Nielsen &amp;amp; Chuang's book.&lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2019-12-02T22:29:46.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9043" PostTypeId="2" ParentId="9035" CreationDate="2019-12-02T23:04:24.380" Score="3" Body="&lt;p&gt;I found this overview of quantum algorithms and their implementation (for majority of them) on IBM Q Experience quite useful: &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.03719&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-02T23:04:24.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9044" PostTypeId="1" AcceptedAnswerId="9045" CreationDate="2019-12-02T23:44:47.407" Score="3" ViewCount="452" Body="&lt;p&gt;I can't seem to find anything, but this seems like something that should be possible.&lt;/p&gt;&#xA;" OwnerUserId="9338" LastEditorUserId="26" LastEditDate="2019-12-03T16:25:50.720" LastActivityDate="2020-10-25T05:41:15.563" Title="Is there a way to output a circuit from Qiskit to the IBM Q Experience circuit composer?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9045" PostTypeId="2" ParentId="9044" CreationDate="2019-12-03T04:50:29.187" Score="4" Body="&lt;p&gt;You can convert a qiskit circuit to QASM using &lt;code&gt;circuit.qasm()&lt;/code&gt;. You can copy this and then there's an &quot;Import OpenQASM&quot; button on the initial circuit composer page:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YW7v9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YW7v9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you can paste the QASM into a tab of the composer itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SswRE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SswRE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="5955" LastEditDate="2019-12-03T07:49:27.777" LastActivityDate="2019-12-03T07:49:27.777" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9046" PostTypeId="1" CreationDate="2019-12-03T07:30:07.153" Score="6" ViewCount="113" Body="&lt;p&gt;Self reducibility is when search version of the problems in a language reduce to decision versions of the same problems. NP-complete problems are self reducible. Are QCMA complete problems self reducible?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="2927" LastEditDate="2019-12-04T19:34:41.700" LastActivityDate="2020-01-20T14:34:13.693" Title="Self reducibility of QCMA problems" Tags="&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9047" PostTypeId="1" AcceptedAnswerId="9048" CreationDate="2019-12-03T09:03:03.377" Score="2" ViewCount="400" Body="&lt;p&gt;If I act a CNOT gate on quantum circuit:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;qc = QuantumCircuit(2, 2)&#xA;qc.cx(0, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;it means that qubit_0 is the control qubit, and qubit_1 is the target qubit.&#xA;And if I switch 0 and 1, it means that qubit_1 is the control qubit, and qubit_0 is the target qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I remember that the CNOT gate is a one-direction gate, which means that one of the case would be the same as the other one but with some hadamard gates acting before and after it on the real device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what I would like to ask is that:&lt;br&gt;&#xA;&quot;How can I specify which is the one that would not act other gates when executing on the real device.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had also checked for the coupling_map:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend.configuration().coupling_map&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it returns both [0, 1] and [1, 0]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure which is the one that won't act other hadamard gates, or is the real devices of IBMQ now support both kinds of CNOT operation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, (I'm guessing) the smaller index would be the control qubit?&lt;/p&gt;&#xA;" OwnerUserId="8083" LastEditorUserId="26" LastEditDate="2019-12-03T16:24:29.287" LastActivityDate="2019-12-03T16:24:29.287" Title="How to specify the CNOT gate direction (control qubit to target qubit) in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9048" PostTypeId="2" ParentId="9047" CreationDate="2019-12-03T10:13:09.683" Score="2" Body="&lt;p&gt;What you are asking here is a valid question, but it does depend on what backend you are using. The CNOT gate, when implemented on real hardware, is generally only implementable in one direction betweem any two pair of qubits, especially for transmon qubits (i.e. the types of qubits IBM uses).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, simulators and emulators generally do not hold this constraint. Moreover, general quantum computing on a higher abstraction level also benefits from being able to apply these entangling gates in both directions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To this end, one can indeed reverse the direction of a CNOT gate by change both qubits to the Hadamard basis before application of the CNOT gate, and back from the Hadamard basis to the computational basis after the application of the CNOT gate. It is a good exercise to assert this for yourself; a straightforward way to check this is by writing out the matrix multiplications that form this operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The coupling map that you have obtained does indicate that you have either used a simulator backend, or that you have used a physical backend where these bi-directional CNOT gates are possible. After checking the updated &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q website&lt;/a&gt;, I just realized that there are now indeed physical backends that do posses these gates. They are indicated by bi-directional arrows between the qubits (i.e. circles) if you click on the backends to show the diagrams.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-12-03T10:13:09.683" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9049" PostTypeId="1" AcceptedAnswerId="9054" CreationDate="2019-12-03T10:28:55.437" Score="5" ViewCount="366" Body="&lt;p&gt;I have read the following &lt;a href=&quot;https://arxiv.org/abs/1801.03897&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper by Dumitrescu et al.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make a Unitary Coupled Cluster (UCC) ansatz, one prepares with the following equation.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \psi_{\rm{UCC}} \rangle = U(\theta)|\mathrm{HF}\rangle&#xA;$$&lt;/span&gt;&#xA;Here, &lt;span class=&quot;math-container&quot;&gt;$U(\theta) = \exp[ T(\theta) - T^{\dagger}(\theta) ]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{HF}\rangle$&lt;/span&gt; is the Hartree-Fock state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me consider a simple system where &lt;span class=&quot;math-container&quot;&gt;$T(\theta) = \theta a_0^{\dagger}a_1$&lt;/span&gt;. Then one obtains &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;U(\theta) &amp;amp;= \exp[ \theta(a_0^{\dagger}a_1 - a_1^{\dagger}a_0) ] \;. \\&#xA;&amp;amp;= \exp[ i(\theta/2) (X_0Y_1 - X_1Y_0) ]&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, one applies Jordan-Wigner transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I can understand but hereafter how can I make a circuit?&#xA;Should I expand and calculate &lt;span class=&quot;math-container&quot;&gt;$U(\theta)|\mathrm{HF}\rangle$&lt;/span&gt; with Baler-Campbell-Hausdorff formula or something?&lt;/p&gt;&#xA;" OwnerUserId="8673" LastEditorUserId="26" LastEditDate="2019-12-03T17:15:38.103" LastActivityDate="2019-12-03T19:59:41.427" Title="How to prepare Unitary Coupled Cluster ansatz for VQE in a circuit?" Tags="&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9050" PostTypeId="2" ParentId="9038" CreationDate="2019-12-03T11:19:08.443" Score="1" Body="&lt;p&gt;A good way to start is to have a look at the truth table of the function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{ccccc}&#xA; x &amp;amp; y &amp;amp; z &amp;amp; \text{out1} &amp;amp; \text{out2} \\\hline&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An interesting feature you might notice from this is that each output &lt;span class=&quot;math-container&quot;&gt;$(o_1,o_2)$&lt;/span&gt; occurs exactly twice. This tells you that a single ancilla is enough to make this into a unitary mapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To build this mapping, you simply need to add a third output to each input &lt;span class=&quot;math-container&quot;&gt;$(x,y,z)$&lt;/span&gt;, taking care to assign different outcomes whenever two triples &lt;span class=&quot;math-container&quot;&gt;$(x,y,z)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(x',y',z')$&lt;/span&gt; are assigned the same value by &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. &#xA;Clearly, there are multiple ways to do this (more precisely, there are &lt;span class=&quot;math-container&quot;&gt;$2^4$&lt;/span&gt; ways to do it). Once this assignment is done, the unitary transformation you are looking for is the corresponding permutation matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example would be the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6130/55&quot;&gt;this other answer&lt;/a&gt; to a similar problem.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-12-03T11:19:08.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9051" PostTypeId="1" CreationDate="2019-12-03T13:16:21.960" Score="1" ViewCount="124" Body="&lt;p&gt;Evidently the Bloch Sphere is used as a graphical representation for any single qubit system, although what does it mean at an intuitive level? Moreover, the manipulation of qubits still seems unclear, regarding certain aspects. Hence I've attempted to concretely list my questions and preferably non-mathematical answers are desired. Thanks in advance and I look forward to hearing from you soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bloch Sphere related&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Since quantum states always contain two possible states: &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then why does the Bloch Sphere depict three separate axes, namely Z, X, and, Y. What is the meaning of each axis?&lt;/li&gt;&#xA;&lt;li&gt;Why would it be relevant to represent a quantum state via the three-axis if the quantum state possesses merely twee possible states? &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum operations related&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Apparently an infinite number of quantum operations are possible on a qubit, even though it seems only a few quantum logic gates exist to manipulate a qubit in a fixed and predetermined way. What is meant by an infinite amount of quantum operations and what is a quantum operation (perhaps to merely alter the complex coefficients or change the phase of a qubit)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If it's true that quantum algorithms can use destructive and constructive interference for destroying states en amplifying certain states, then how are the specific quantum states selected to for example destructively interfere, and others to constructively interfere. In passing, I do comprehend the concept of interference, however which parts of qubits interfere with one another to amplify and eliminate particular quantum states?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is the phase of a qubit only of importance for inducing destructive and constructive interference, if so, which gates are used for modifying the phase of one or more qubits? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Entanglement&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A quantum register could implement, for instance, 12 qubits, would it be possible to create different groups of entangled qubits, e.g. 6 - 4 - 2 (three separate entangled qubit pairs). Furthermore, does measuring one qubit of an entangled group of qubits result in a total collapse of all the qubits' superpositions or could still a few quantum states remain in superpositions while certain other states have collapsed?  &lt;/li&gt;&#xA;&lt;li&gt;Are entanglement and interference always used together during quantum computations?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I am not fully acquainted with the required mathematics of quantum computing, apart from the Dirac notation.&lt;/p&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="26" LastEditDate="2019-12-03T16:21:09.697" LastActivityDate="2019-12-03T16:21:09.697" Title="Bloch sphere and quantum operations" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="5" ClosedDate="2019-12-03T17:45:37.340" ContentLicense="CC BY-SA 4.0" />
  <row Id="9052" PostTypeId="2" ParentId="9051" CreationDate="2019-12-03T15:28:14.597" Score="1" Body="&lt;p&gt;I hinted in the comments of your previous question that the answers to the above questions have a shared basis for an answer, and since you're already asking about that too I guess you have found that: the Bloch sphere. The Bloch sphere is a method of visualizing the state of a qubit. However, to really understand this visualization, you really need to use some mathematics.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The state of a qubit&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of a qubit, in its most general form, can be written in ket notation as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle = \alpha |0\rangle + \beta |1\rangle&#xA;\end{equation}&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; &lt;strong&gt;complex&lt;/strong&gt; numbers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are not familiar with complex number, I strongly advise you to get acquainted with them (for instance by watching &lt;a href=&quot;https://www.youtube.com/watch?v=NaL_Cb42WyY&amp;amp;list=PLucNEDEq4z_AdqV1ii0vmH0clNhYPI4lK&quot; rel=&quot;nofollow noreferrer&quot;&gt;this amazing video&lt;/a&gt; on youtube), but for now you can think of them as a kind of 'two-dimensional number'. The best way to conceptualize that is to think of them as some point in the &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt;-plane. They have two separate defining parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The distance to the origin, commonly referred to as their &lt;em&gt;magnitude&lt;/em&gt; or modulus or absolute value. We write the magnitude of a complex number &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|z|$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The angle they make with the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis, commonly referred to as their &lt;em&gt;phase&lt;/em&gt;. We write the phase of a complex number &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$arg(z)$&lt;/span&gt;, and we often denote it with the letter &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The important thing to realize is that these two parameters are independent of each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reasons that I wont go into here, there is another constraint on &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;: their moduli squared together should add up to unity: &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^{2} + |\beta|^{2} = 1$&lt;/span&gt;. Moreover, we only care about the phase difference between &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, which we call the relative phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This culminates in us writing the state of a qubit as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle = \cos(\theta)|0\rangle + e^{i\phi}\sin(\theta)|1\rangle.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\theta \in [0,\pi)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi \in [0, 2\pi)$&lt;/span&gt;. This can be mapped to a sphere with radius &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the angle between the point on the sphere and the north pole (e.g. the latitude of a point on earth), and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is the angle of the point in the &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt;-plane (e.g. the longitude of a point on earth).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We map all possible states of the qubit on a sphere, which is a surface (mind you, the state of the qubit is &lt;strong&gt;on&lt;/strong&gt; the sphere, not in!). This surface is a &lt;span class=&quot;math-container&quot;&gt;$2D$&lt;/span&gt; structure so can be parametrized by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; parameters (in our case, &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Operation on qubits&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Apparently an infinite number of quantum operations are possible on a qubit, even though it seems only a few quantum logic gates exist to manipulate a qubit in a fixed and predetermined way. What is meant by an infinite amount of quantum operations and what is a quantum operation (perhaps to merely alter the complex coefficients or change the phase of a qubit)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;An operation or gate on a qubit is the tranformation of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; of a qubit to some other state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt;. Since these states are defined by continuous parameters, there are an infinite number of different mappings or operations. Thus, there are an infinite number of gates possible. Luckily, we don't need all of them for sensible quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If it's true that quantum algorithms can use destructive and constructive interference for destroying states en amplifying certain states, then how are the specific quantum states selected to for example destructively interfere, and others to constructively interfere. In passing, I do comprehend the concept of interference, however which parts of qubits interfere with one another to amplify and eliminate particular quantum states?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is a though question, and can only be really answered by very precise mathematical description. In principle, it is the task of the quantum algorithm to invoke this interference in such a manner that certain states get more likely to be measured.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the phase of a qubit only of importance for inducing destructive and constructive interference, if so, which gates are used for modifying the phase of one or more qubits?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Again, this is a though question. you need a very thorough understanding of the role of the phase in a qubit's state description. In essence, the fact that the qubit has a phase makes it a quantum bit instead of a classical (statistical) bit. In one sense all the phase does is help in the interference, but in the same sense one could say that quantum computing is all about said interference.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A quantum register could implement, for instance, 12 qubits, would it be possible to create different groups of entangled qubits, e.g. 6 - 4 - 2 (three separate entangled qubit pairs). Furthermore, does measuring one qubit of an entangled group of qubits result in a total collapse of all the qubits' superpositions or could still a few quantum states remain in superpositions while certain other states have collapsed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, there can exist such subgroups of underlying entangled pairs. Moreover, the measurement of a qubit that is entangled with other qubits will always collapse some entanglement, but not necessarily all 'entanglement'. So the remaining qubits might still be entangled with each other. The measured qubit, however, will be completely disentangled from all other qubits; we say the qubit to be in a &lt;em&gt;separable&lt;/em&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are entanglement and interference always used together during quantum computations?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Without elaborating very much, I would say that they are not on the 'same level' within the concepts of quantum computation, and I would therefore say that they are not strictly 'used together'. However, entanglement and interference both play a necessary role in quantum computations.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Final sidenote&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;This many subquestions in one post is generally unfavourable. Please try to ask them separate posts next time.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2019-12-03T15:28:14.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9053" PostTypeId="2" ParentId="9035" CreationDate="2019-12-03T16:14:48.257" Score="3" Body="&lt;p&gt;Related threads:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1680/good-introductory-material-on-quantum-computational-complexity-classes&quot;&gt;Good introductory material on quantum computational complexity classes&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1926/does-a-study-guide-exist-that-starts-from-a-purely-cs-background-and-advances&quot;&gt;Does a study guide exist that starts from a &amp;quot;purely CS background&amp;quot; and advances towards &amp;quot;making a new quantum programming language&amp;quot;?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1367/programming-quantum-computers-for-non-physics-majors&quot;&gt;Programming quantum computers for non-physics majors&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2261/resources-for-quantum-algorithm-basics&quot;&gt;Resources for quantum algorithm basics&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6230/what-are-the-basics-needed-to-learn-quantum-computing&quot;&gt;What are the basics needed to learn quantum computing?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2082/are-there-any-organised-resources-available-from-where-i-can-begin-my-quantum-co&quot;&gt;Are there any organised resources available from where I can begin my quantum computing studies?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5234/resources-for-learning-quantum-computing-from-an-undergraduate-physics-perspecti&quot;&gt;Resources for learning quantum computing from an undergraduate physics perspective&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2724/what-would-be-an-informative-introduction-to-quantum-computing-software&quot;&gt;What would be an informative introduction to quantum computing software?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6639/1859&quot;&gt;Is my background sufficient to start quantum computing?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="1859" LastEditDate="2020-11-08T00:23:28.810" LastActivityDate="2020-11-08T00:23:28.810" CommentCount="0" CommunityOwnedDate="2019-12-03T16:14:48.257" ContentLicense="CC BY-SA 4.0" />
  <row Id="9054" PostTypeId="2" ParentId="9049" CreationDate="2019-12-03T19:59:41.427" Score="2" Body="&lt;p&gt;You can create the unitary gate for operator &lt;span class=&quot;math-container&quot;&gt;$U(\theta)=e^{-i\frac{\theta}{2}Z_{0}Z{1}}$&lt;/span&gt; using two &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; operations and single rotation gate &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2q48g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2q48g.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For operators which contain different tensor products of Pauli matrices beside the product of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; you have to change basis using appropriate unitary transformation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$R_y(-\frac{\pi}{2})$&lt;/span&gt; changes &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, and &lt;span class=&quot;math-container&quot;&gt;$R_{x}(\frac{\pi}{2})$&lt;/span&gt; changes &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis.&#xA;For example for operator &lt;span class=&quot;math-container&quot;&gt;$U(\theta)=e^{-i\frac{\theta}{2}X_{0}X{1}}$&lt;/span&gt; you have  the following cirquit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DXPXO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DXPXO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6071" LastActivityDate="2019-12-03T19:59:41.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9055" PostTypeId="1" CreationDate="2019-12-04T01:31:10.363" Score="3" ViewCount="226" Body="&lt;p&gt;Given the GHZ state wrt n = 3: &lt;span class=&quot;math-container&quot;&gt;$\frac{|000⟩ + |111⟩}{\sqrt{2}}$&lt;/span&gt;, I'm trying to understand how the principle of monogamy of entanglement manifests here. I came across &lt;a href=&quot;https://www.scottaaronson.com/qclec/10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this explanation&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let’s say that Alice, Bob, and Charlie hold random bits, which are either all 0 or all 1&#xA;  (so, they’re classically correlated). If all three of them get together, they can see that their bits are&#xA;  correlated, and the same is true if only two of them are together.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;But now suppose the three players share a GHZ state. With all three of them, they can&#xA;  see that the state is entangled, but what if Charlie is gone? Can Alice and Bob see that they’re entangled&#xA;  with each other?&#xA;  No. To see this, observe that by the No-Communication Theorem, Charlie could’ve measured&#xA;  without Alice and Bob knowing. But if he did, then Alice and Bob would clearly have classical&#xA;  correlation only: either both 0’s (if Charlie got the measurement outcome 0) or both 1 (if Charlie got 1). From this it follows that Alice and Bob have only classical correlation regardless of whether Charlie&#xA;  measured or not.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've been trying to make sense of this for a while now and I'm at my wit's end. ANY help is appreciated, thanks!&lt;/p&gt;&#xA;" OwnerUserId="9360" LastEditorUserId="55" LastEditDate="2020-11-24T14:22:00.297" LastActivityDate="2020-11-24T14:22:00.297" Title="Understanding the monogamy of entanglement with respect to GHZ States" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9056" PostTypeId="2" ParentId="9055" CreationDate="2019-12-04T03:31:44.097" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let’s say that Alice, Bob, and Charlie hold random bits, which are either all or all (so, they’re classically correlated). If all three of them get together, they can see that their bits are correlated, and the same is true if only two of them are together.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If Alice, Bob, and Charlie all have either the bits &lt;span class=&quot;math-container&quot;&gt;$\{1_A, 1_B, 1_C\}$&lt;/span&gt; or the bits &lt;span class=&quot;math-container&quot;&gt;$\{0_A, 0_B, 0_C\}$&lt;/span&gt;, upon multiple measurements, Bob and Charlie will notice that their bits are always the same as Alice's bits. This is the classical &quot;correlation&quot; Aaronson mentions.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But now suppose the three players share a GHZ state. With all three of them, they can see that the state is entangled (...)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;A GHZ state allows for non-classical (or quantum) correlations. If Alice, Bob, and Charlie are together, then with some measurements they can detect some non-trivial correlations; this concept is well explained &lt;a href=&quot;https://physics.stackexchange.com/a/110277&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;but what if Charlie is gone? Can Alice and Bob see that they’re entangled with each other? No. To see this, observe that by the No-Communication Theorem, Charlie could’ve measured without Alice and Bob knowing. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;If Charlie measured his qubit then depending on whether he gets &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_C$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_C$&lt;/span&gt;, the remaining composite state of Alice and Bob's qubits would be either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle_{AB}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle_{AB}$&lt;/span&gt; respectively. This is clear from the definition of the GHZ state i.e., &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\mathrm{GHZ}_3\rangle = \frac{|00\rangle_{AB} |0\rangle_C + |11\rangle_{AB}|1\rangle_C}{\sqrt 2}.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But if he did, then Alice and Bob would clearly have classical correlation only: either both ’s (if Charlie got the measurement outcome) or both (if Charlie got). From this it follows that Alice and Bob have only classical correlation regardless of whether Charlie measured or not&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As the post-measurement composite state of Alice and Bob's qubits would be either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A|0\rangle_B$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A|1\rangle_B$&lt;/span&gt;, the resulting correlation becomes trivial. If Alice's qubit is measured to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A$&lt;/span&gt; then Bob's qubit would be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_B$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_B$&lt;/span&gt; respectively and vice-versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, even if say Charlie didn't measure his qubit, if Alice measures her qubit to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A$&lt;/span&gt;), Bob's qubit will also be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_B$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_B$&lt;/span&gt;). This is again a trivial classical correlation between Alice and Bob. The fact of the matter is that to observe some non-trivial correlations you need to determine the joint statistics of Alice, Bob &lt;em&gt;and&lt;/em&gt; Charlie. Pairwise statistics will only show you trivial classical correlations. The magic of entanglement only manifests in the three-body measurement statistics for the GHZ state! &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In the GHZ case, we noticed that the effects of entanglement are only observable in the three-qubit statistics and not in the pairwise statistics. Mathematically, &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement#Testing_a_system_for_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;it can be shown&lt;/a&gt; that in the GHZ state there is no pairwise entanglement at all (from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement#Reduced_density_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;reduced density matrix&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;). The &quot;Monogamy of Entanglement&quot; part is a bit of a non-sequitur, indeed. Aaronson states the example of the &lt;span class=&quot;math-container&quot;&gt;$|W_3\rangle$&lt;/span&gt; where no two qubits are pairwise &quot;maximally entangled&quot; but are entangled &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement#Entanglement_measures&quot; rel=&quot;nofollow noreferrer&quot;&gt;to some degree&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://i.stack.imgur.com/rcibum.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rcibum.jpg&quot; alt=&quot;Borromean Rings&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point is that, in a three-qubit state, it is theoretically impossible for more than one pair of qubits to be &lt;a href=&quot;https://physics.stackexchange.com/a/170516&quot;&gt;maximally entangled&lt;/a&gt;. The &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{GHZ}_3\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|W_3\rangle$&lt;/span&gt; states are simply examples of this; the interesting fact being that the &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{GHZ}_3\rangle$&lt;/span&gt; state as a whole is maximally entangled although no two qubits are pairwise maximally entangled. Thus, it is analogous to &lt;a href=&quot;https://en.wikipedia.org/wiki/Borromean_rings&quot; rel=&quot;nofollow noreferrer&quot;&gt;Borromean rings&lt;/a&gt; which consist of three topological circles which are linked but where removing any one ring leaves the other two unconnected.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="2927" LastEditDate="2019-12-04T19:33:00.790" LastActivityDate="2019-12-04T19:33:00.790" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9057" PostTypeId="1" CreationDate="2019-12-04T03:49:09.923" Score="3" ViewCount="121" Body="&lt;p&gt;While writing &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9056&quot;&gt;this answer&lt;/a&gt; I was wondering whether the analogy of the nature of entanglement in the GHZ state with &lt;a href=&quot;https://en.wikipedia.org/wiki/Borromean_rings&quot; rel=&quot;nofollow noreferrer&quot;&gt;Borromean rings&lt;/a&gt; is more than a mere analogy (cf. &lt;a href=&quot;https://www.scottaaronson.com/qclec/10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson's lecture&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question in my mind basically is: can quantum entanglement, at least for the finite-dimensional cases, be expressed in terms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Knot_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;knot theory&lt;/a&gt;? Has there been any approach in this direction? If yes, then I suppose it would be a nice way to visualize qubit entanglements in various scenarios. &lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-12-28T07:55:20.277" Title="Can quantum entanglement be expressed in terms of knot theory?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;resource-request&gt;&lt;research&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9058" PostTypeId="1" AcceptedAnswerId="9062" CreationDate="2019-12-04T04:01:38.077" Score="4" ViewCount="108" Body="&lt;p&gt;I have an amplitude damping channel, denoted as a superoperator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; with operator elements&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{matrix}&#xA;		E_1=\begin{pmatrix}&#xA;		1 &amp;amp;  0 \\ &#xA;		0 &amp;amp;  \sqrt{1-r} &#xA;		\end{pmatrix},\quad&#xA;		E_2=\begin{pmatrix}&#xA;		0 &amp;amp;  \sqrt{r} \\ &#xA;		0 &amp;amp;  0 &#xA;		\end{pmatrix}&#xA;		\end{matrix}&lt;/span&gt;&#xA;I am confused that how to explicitly obtain the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes 2}$&lt;/span&gt; in matrix form?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am trying to understand what is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes 2}(\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho=1/2|00\rangle\langle 00|+1/2|11\rangle\langle 11|$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="26" LastEditDate="2019-12-05T13:32:51.223" LastActivityDate="2019-12-05T13:32:51.223" Title="How to obtain the tensor-product of two quantum operations (superoperators) explicitly?" Tags="&lt;quantum-operation&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9059" PostTypeId="1" AcceptedAnswerId="9060" CreationDate="2019-12-04T09:24:29.937" Score="1" ViewCount="92" Body="&lt;p&gt;As a developer myself, I still do not understand what can be done so far with services like &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2019/12/introducing-amazon-braket/&quot; rel=&quot;nofollow noreferrer&quot;&gt;AWS BRAKET&lt;/a&gt; or &lt;a href=&quot;https://www.ibm.com/quantum-computing/technology/experience&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM CLOUD QUANTUM COMPUTING&lt;/a&gt;.&#xA;Can someone explain me the practical purpose of it in the present? Or is it mostly a PR move to create hype?&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="9363" LastEditorUserId="5955" LastEditDate="2019-12-04T10:00:24.037" LastActivityDate="2019-12-04T10:01:36.153" Title="What can be done so far with cloud quantum computing?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9060" PostTypeId="2" ParentId="9059" CreationDate="2019-12-04T10:01:36.153" Score="2" Body="&lt;p&gt;They are resources to help people get started with learning about quantum computing. They are also useful to help further research as services such as IBM Q Experience provide access to real quantum computers, and so people can conduct research using them. &lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-04T10:01:36.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9061" PostTypeId="1" CreationDate="2019-12-04T13:52:05.150" Score="4" ViewCount="72" Body="&lt;p&gt;Gil Kalai &lt;a href=&quot;https://gilkalai.wordpress.com/2013/01/01/symplectic-geometry-quantization-and-quantum-noise/&quot; rel=&quot;nofollow noreferrer&quot;&gt;often speaks&lt;/a&gt; of the apparent connection between &lt;a href=&quot;https://en.wikipedia.org/wiki/Symplectic_geometry&quot; rel=&quot;nofollow noreferrer&quot;&gt;symplectic geometry&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Geometric_quantization&quot; rel=&quot;nofollow noreferrer&quot;&gt;geometric quantization&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_noise&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum noise&lt;/a&gt;. He is known to describe one of his focus areas as: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(...) properties and models of quantum noise which do not enable quantum fault tolerance believed to be crucial for building quantum computers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm somewhat aware of the basic notions of symplectic geometry and geometric quantization, but could someone give me a basic outline of how this relates to quantum noise and fault tolerance?&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-12-04T13:52:05.150" Title="How's quantum noise and fault-tolerance related to symplectic geometry and geometric quantization?" Tags="&lt;mathematics&gt;&lt;noise&gt;&lt;fault-tolerance&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9062" PostTypeId="2" ParentId="9058" CreationDate="2019-12-04T14:44:39.400" Score="3" Body="&lt;p&gt;I guess that what you're after is&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\mathcal{E}^{\otimes 2}&#xA;$&lt;/span&gt;&#xA;is defined by the 4 operator elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_1\otimes E_1,E_1\otimes E_2,E_2\otimes E_1,E_2\otimes E_2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply this to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1+r^2}{2}|00\rangle\langle 00|+\frac{(1-r)^2}{2}|11\rangle\langle 11|+\frac{r(1-r)}{2}(|01\rangle\langle|01|+|10\rangle\langle 10|).&#xA;$$&lt;/span&gt; &#xA;An important check is that this still has trace 1.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-04T14:44:39.400" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9063" PostTypeId="1" CreationDate="2019-12-04T17:53:47.160" Score="3" ViewCount="88" Body="&lt;p&gt;How many iterations are needed in Grover’s quantum search for finding one out of M marked items in a database containing N items (for 1 &amp;lt; M &amp;lt; N/2)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would have thought we just reduce the size of the search space to M and then calculate the probability? But then does that mean the size of the overall database does not matter here?&lt;/p&gt;&#xA;" OwnerUserId="9332" LastEditorUserId="55" LastEditDate="2019-12-05T09:33:13.963" LastActivityDate="2019-12-07T04:41:27.220" Title="How many iterations does Grover’s search need to find one out of $M$ marked items?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9064" PostTypeId="1" AcceptedAnswerId="9065" CreationDate="2019-12-04T18:22:24.173" Score="5" ViewCount="471" Body="&lt;p&gt;I'm trying to use Qiskit's built in transpiler passes to do the following. I would like to take a quantum circuit and allocate the logical qubits to physical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/37f0cd4/qiskit/advanced/terra/4_transpiler_passes_and_passmanager.ipynb&quot; rel=&quot;noreferrer&quot;&gt;tutorial&lt;/a&gt; doesn't really explain how to do this. I would like to use one of the preset passes (&lt;code&gt;TrivialLayout&lt;/code&gt;, &lt;code&gt;DenseLayout&lt;/code&gt;, etc) to get this allocation. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.compiler import transpile&#xA;from qiskit.transpiler import PassManager, passes &#xA;from qiskit.test.mock import FakeMelbourne # NB will need to install dev requirements&#xA;&#xA;&quot;&quot;&quot; This is the circuit we are going to look at&quot;&quot;&quot;&#xA;qc = QuantumCircuit(13, 13)&#xA;qc.h(3)&#xA;qc.cx(0,6)&#xA;qc.h(1)&#xA;qc.cx(6,0)&#xA;qc.cx(0,1)&#xA;qc.cx(3,1)&#xA;qc.h(3)&#xA;qc.cx(3,0)&#xA;qc.measure_all()&#xA;&#xA;backend = FakeMelbourne() &#xA;properties = backend.properties() &#xA;coupling_map = backend.configuration().coupling_map&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output of the program should be a dictionary or something that gives tells me which physical qubit each logical qubit is mapped to. How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2019-12-04T18:30:14.147" LastActivityDate="2020-02-28T07:17:58.760" Title="Getting a layout for qubits in Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9065" PostTypeId="2" ParentId="9064" CreationDate="2019-12-04T20:06:18.003" Score="6" Body="&lt;p&gt;Try replacing the last three lines of the code you posted with&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;backend = IBMQ.get_provider(hub='ibm-q').get_backend('ibmq_16_melbourne')&#xA;new_circ_lv0 = transpile(qc, backend=backend, optimization_level=0)&#xA;plot_circuit_layout(new_circ_lv0, backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and add the necessary import statements (&lt;code&gt;plot_circuit_layout&lt;/code&gt; is in &lt;code&gt;qiskit.visualization&lt;/code&gt;).  This should give you the mapping from your logical qubits to physical qubits on &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;, with optimization level 0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q5YY4.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q5YY4.png&quot; alt=&quot;physical qubits&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information, &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/5_using_the_transpiler.ipynb&quot; rel=&quot;noreferrer&quot;&gt;this tutorial&lt;/a&gt; will probably be more helpful for this task than the one you linked.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2019-12-04T20:15:42.583" LastActivityDate="2019-12-04T20:15:42.583" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9066" PostTypeId="2" ParentId="9063" CreationDate="2019-12-04T20:08:22.400" Score="4" Body="&lt;p&gt;R iterations where &lt;span class=&quot;math-container&quot;&gt;$(2R+1)\theta\approx\pi/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin\theta=\sqrt{M/N}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your question, how do you “just reduce the size of the search space”?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-04T20:08:22.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9067" PostTypeId="1" CreationDate="2019-12-04T22:42:33.603" Score="2" ViewCount="894" Body="&lt;p&gt;After lightly reading into quantum algorithms and the hardware of quantum computers, I subsequently started wondering how a quantum computer is programmed so it executes the desired quantum algorithm correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Cornering preliminary knowledge, this is what I know currently:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A quantum computer is at the highest level of abstraction controlled&#xA;by a classical computer.&lt;/li&gt;&#xA;&lt;li&gt;The classical computer processes input data from a user and passes this on to Qubit control- and measuring devices.&lt;/li&gt;&#xA;&lt;li&gt;Next, the qubit control- and measuring devices are able to manipulate and measure the desired qubits.&lt;/li&gt;&#xA;&lt;li&gt;Lastly, the quantum plane which is a partially isolated quantum register that contains all the required qubits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Would the hardware structure of a quantum computer, that I asserted&#xA;above, be correct?&lt;/li&gt;&#xA;&lt;li&gt;And how is a classically written quantum code, such as Qiskit, able to instruct the quantum computer to run a certain quantum algorithm (where the algorithm is simply comprised of quantum logic 'gates' that cleverly manipulate the qubits)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;PS: I've tried to limit the number of questions and keep the questions coherent.&lt;/p&gt;&#xA;" OwnerUserId="9313" LastEditorUserId="26" LastEditDate="2019-12-05T15:15:58.843" LastActivityDate="2019-12-05T18:29:34.877" Title="How is a quantum computer programmed?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9068" PostTypeId="1" CreationDate="2019-12-04T23:31:11.470" Score="2" ViewCount="62" Body="&lt;p&gt;Is backend.defaults().cmd_def and backend.defaults().pulse_library kept updated regularly? Is this the correct place to pull the best calibrated pulses for the standard gates? I am working on a project now and find I get substantially different results running on OpenQASM vs. OpenPulse as well as running the same pulse schedule a week apart. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7701" LastActivityDate="2019-12-04T23:31:11.470" Title="OpenPulse: Where to get current pulse definitions for standard gates?" Tags="&lt;qiskit&gt;&lt;qasm&gt;&lt;openpulse&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9069" PostTypeId="2" ParentId="9027" CreationDate="2019-12-05T01:31:47.830" Score="1" Body="&lt;p&gt;With Q# you can generate random numbers in two ways: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Using a classical pseudorandom number generator, which is exactly the same that a classical language like Python does when you use the library &lt;code&gt;random&lt;/code&gt;. As Mariia Mykhailova says in the comments, Q# has a built-in operation RandomInt that does exactly this: &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.math.randomint&quot; rel=&quot;nofollow noreferrer&quot;&gt;RandomInt&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using a quantum operation that uses measurements on qubits to extract random bits to build a random number. Unfortunately, right now Q# is not yet compatible with any real quantum hardware, so to implement this method you will need to use a classical simulator of a quantum computer that ultimately will implement a classical pseudorandom function like in (1). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, since you're new in quantum computing and you want to learn, choosing (2), even if at the end is just a convoluted version of (1), makes sense for pedagogical purposes. So let's see how to implement (2) using Q# and Python.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;a)&lt;/strong&gt; First we need to create a Q# file (Operation.qs) to obtain random bits from measuring qubits. To see how you have a nice tutorial &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quickstarts/qrng?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Your Q# code should look like this:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;namespace Quantum {&#xA;      open Microsoft.Quantum.Intrinsic;&#xA;      operation QuantumRandomNumberGenerator() : Result {&#xA;          using(q = Qubit())  { &#xA;              H(q);&lt;br&gt;&#xA;              let r = M(q); &#xA;              Reset(q);&#xA;              return r;&#xA;          }&#xA;      }&#xA;   }&lt;/code&gt; &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;b)&lt;/strong&gt; Secondly we need to create a Python file (in the same folder than the .qs file) that is going to build an integer by calling the quantum operation defined above several times. The code is the following (comments inside the code):&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/906d9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/906d9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Text code: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qsharp &#xA;from Quantum import QuantumRandomNumberGenerator&#xA;bit_string = []&#xA;max = 50&#xA;for i in range(0, max.bit_length()):&#xA;    bit_string.append(QuantumRandomNumberGenerator.simulate()) &#xA;number = int(&quot;&quot;.join(str(x) for x in bit_string), 2)&#xA;print(number)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now if you execute this Python code in the terminal (supposing you have all the dependencies correctly installed) the following message should appear in the command promt:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Preparing Q# environment...&#xA;33&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My random number was 33.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="9366" LastEditorUserId="9366" LastEditDate="2019-12-05T01:53:49.323" LastActivityDate="2019-12-05T01:53:49.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9070" PostTypeId="1" AcceptedAnswerId="9072" CreationDate="2019-12-05T03:58:59.237" Score="3" ViewCount="606" Body="&lt;p&gt;Can we generate quantum random numbers through Qiskit? &#xA;I want to try the random number generator without using optics or noise.&lt;/p&gt;&#xA;" OwnerUserId="9367" LastEditorUserId="26" LastEditDate="2019-12-05T13:34:46.107" LastActivityDate="2019-12-05T13:34:46.107" Title="Quantum random number generator" Tags="&lt;algorithm&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9072" PostTypeId="2" ParentId="9070" CreationDate="2019-12-05T07:57:17.390" Score="4" Body="&lt;p&gt;Hadamard Gates together with Quantum Bloom Filters and a Verifiable Random Functions can prove to be a simple but elegant implementation of Quantum Algorithmic Randomness. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This technique can be seen as a way to reduce the dimensionality of high-dimensional data; high-dimensional input items can be reduced to low-dimensional versions while preserving relative distances between items. While we reduce the dimensionality from a high dimensional data the elements of order are replaced by entropies of randomness. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can generate Quantum Random Numbers in IBM QIS Kit by implementing a Hadamard Gate. The Hadamard gate is the simplest method for generating a random bit in a qubit. It generates a quantum state which is a superposition of a 0 and a 1, with equal probability. If you then attempt to measure that qubit the quantum state collapses into either a 0 or a 1 with equal probability, generating a single random bit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Execute n Hadamard (H) gates, either on the same or distinct qubits, measure the qubit state after executing each H gate, and you have n-bits of random number. Please find a sample code from IBM QIS Kit for executing a Hadamard gate through a register with a specific backend. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit&#xA;from qiskit import execute&#xA;from qiskit import IBMQ&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.providers.ibmq import least_busy&#xA;IBMQ.load_accounts()&#xA;IBMQ.backends()&#xA;backend = least_busy(IBMQ.backends(simulator=False))&#xA;%%qiskit_job_status&#xA;q = QuantumRegister(2)&#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q, c)&#xA;qc.h(q[0])&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q, c)&#xA;job_exp = execute(qc, backend=backend, shots=1024, max_credits=3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2019-12-05T07:57:17.390" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9073" PostTypeId="1" AcceptedAnswerId="9084" CreationDate="2019-12-05T08:54:06.130" Score="5" ViewCount="629" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/alakS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/alakS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/29lCI.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/29lCI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is the error rate pointed by the arrow defined? How did you get it?&#xA;thanks!&lt;/p&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2019-12-05T21:26:30.013" Title="What does the error rate on the IBMQ website mean？" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9074" PostTypeId="1" CreationDate="2019-12-05T10:14:15.910" Score="0" ViewCount="63" Body="&lt;p&gt;Where I can find the previous Quantum-Experiment tutorial for beginners?&#xA;(the one that was under &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/qstage/#/account&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/qstage/#/account&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="9371" LastEditorUserId="26" LastEditDate="2019-12-05T13:33:40.707" LastActivityDate="2019-12-05T16:57:06.230" Title="Find the Q-Experiment tutorial for beginner" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9075" PostTypeId="2" ParentId="8994" CreationDate="2019-12-05T11:21:55.817" Score="1" Body="&lt;p&gt;Based on what I've understood from your question, I think the interpretation of the noisy channel as the quantum algorithm may be causing unnecessary confusion. QEC should be present in the fault tolerant computing paradigm as a background operation capable of guaranteeing that qubits retain coherence of their quantum states for practical amounts of time. As such, in terms of how you lay out the notion, the quantum algorithm that is being executed can't exactly be associated to the quantum channel. The channel is essentially the conglomerate of error mechanisms (decoherence etc.) by which quantum states are corrupted. Thus, what QEC does is ensure that the qubits the algorithm is working with are in the correct quantum states. You can think of it as a background process or black box that is always running to ensure that the quantum algorithm will not fail due to the incorrectness of its basic information units (the qubits themselves). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Naturally, the follow up to this question is how can QEC correct these quantum states when the implementation of quantum codes is based on quantum gates, which suffer from the aforementioned mechanisms themselves. This leads to a debate over which QECC family (turbo, LDPC, polar...) is better suited for this purpose, but this begins to deviate from the topic of the question.&lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2019-12-05T11:21:55.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9076" PostTypeId="1" AcceptedAnswerId="9077" CreationDate="2019-12-05T12:14:52.553" Score="1" ViewCount="184" Body="&lt;p&gt;I have been running a variational circuit optimizing the parameters on the &quot;melbourne&quot; device. The system launches multiple jobs in parallel, and only gets the jobs accepted that my credit allows. The remainder get queued with the following message: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;FAILURE: Can not get job id, Resubmit the qobj to get job id.Error: 403 &#xA;Client Error: Forbidden for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs?&#xA;access_token=.... Your credits to run jobs are not enough, Error code: 3458.&quot; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is normal, and it continues till the program runs till completion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, I have encountered a new error that actually halts the program and throws the error shown below (520 Server Error). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why is this happening?&lt;/li&gt;&#xA;&lt;li&gt;What can I do against it?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;FAILURE: Can not get job id, Resubmit the qobj to get job id.Error: 403 Client Error: Forbidden for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs?access_token=.... Your credits to run jobs are not enough, Error code: 3458.&#xA;Traceback (most recent call last):&#xA;  File &quot;file.py&quot;, line 307, in &amp;lt;module&amp;gt;&#xA;QSVMsetup(featuremap)&#xA;  File &quot;file.py&quot;, line 284, in QSVMsetup&#xA;training_result = svm.train(df_train_test_x_Q, df_train_test_y_Q, quantum_instance)&#xA;  File &quot;vqc.py&quot;, line 437, in train&#xA;gradient_fn=grad_fn  # func for computing gradient&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/algorithms/adaptive/vq_algorithm.py&quot;, line 118, in find_minimum&#xA;gradient_function=gradient_fn)&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/components/optimizers/spsa.py&quot;, line 131, in optimize&#xA;max_trials=self._max_trials, **self._options)&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/components/optimizers/spsa.py&quot;, line 182, in _optimization&#xA;cost_minus = obj_fun(theta_minus)&#xA;  File &quot;/home/user/ibm/vqc_mod_v10.py&quot;, line 476, in _cost_function_wrapper&#xA;predicted_probs, predicted_labels = self._get_prediction(self._batches[batch_index], theta)&#xA;  File &quot;/home/user/ibm/vqc_mod_v10.py&quot;, line 348, in _get_prediction&#xA;results = self._quantum_instance.execute(list(circuits.values()))&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/quantum_instance.py&quot;, line 312, in execute&#xA;self._skip_qobj_validation, self._job_callback)&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/aqua/utils/run_circuits.py&quot;, line 343, in run_qobj&#xA;logger.info(&quot;Backend status: {}&quot;.format(backend.status()))&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/providers/ibmq/ibmqbackend.py&quot;, line 112, in status&#xA;api_status = self._api.backend_status(self.name())&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/providers/ibmq/api_v2/clients/account.py&quot;, line 64, in backend_status&#xA;return self.client_api.backend(backend_name).status()&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/providers/ibmq/api_v2/rest/backend.py&quot;, line 58, in status&#xA;response = self.session.get(url).json()&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/requests/sessions.py&quot;, line 546, in get&#xA;return self.request('GET', url, **kwargs)&#xA;  File &quot;/home/user/.local/lib/python3.6/site-packages/qiskit/providers/ibmq/api_v2/session.py&quot;, line 166, in request&#xA;raise RequestsApiError(ex, message) from None&#xA;qiskit.providers.ibmq.api_v2.exceptions.RequestsApiError: 520 Server Error: Origin Error for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/devices/ibmq_16_melbourne/queue/status?access_token=...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="5955" LastEditDate="2019-12-05T12:49:14.533" LastActivityDate="2019-12-05T12:49:14.533" Title="IBM Q experience - error code 520" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9077" PostTypeId="2" ParentId="9076" CreationDate="2019-12-05T12:48:32.793" Score="2" Body="&lt;p&gt;This is likely because the Melbourne device is currently offline for upgrades, it should be back up in around 2 weeks. If you join the Slack workspace, linked from the &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit website&lt;/a&gt; and then join the &lt;code&gt;#ibm-q-systems&lt;/code&gt; channel you can get updates about all the devices and when they will be taken offline.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-05T12:48:32.793" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9078" PostTypeId="5" CreationDate="2019-12-05T13:38:03.320" Score="0" Body="" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-05T13:38:03.320" LastActivityDate="2019-12-05T13:38:03.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9079" PostTypeId="4" CreationDate="2019-12-05T13:38:03.320" Score="0" Body="It is a language for specifying pulse level control (i.e. control of the continuous-time dynamics) of a general quantum device independent of the specific hardware implementation. [arXiv:1809.03452]" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-05T13:38:03.320" LastActivityDate="2019-12-05T13:38:03.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9080" PostTypeId="2" ParentId="9074" CreationDate="2019-12-05T16:57:06.230" Score="1" Body="&lt;p&gt;All the tutorials are now on the &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience website&lt;/a&gt;. They are in the form of Jupyter Notebooks to help you learn about programming with Qiskit. There are also some additional materials if you click the &lt;code&gt;?&lt;/code&gt; button, such as links to documentation about how to get started using the composer.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-05T16:57:06.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9081" PostTypeId="2" ParentId="9067" CreationDate="2019-12-05T18:29:34.877" Score="6" Body="&lt;p&gt;Let us look at each observation and question in perspective. Before delving deep into the questions, please let me share a few reference architecture diagrams on the components of a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Hto8a.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hto8a.png&quot; alt=&quot;Quantum Computing Component Model&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to review the mentioned observations and understandings from a practical implementation vantage point. When we consider the quantum realm in its entirety, there is a finite and fundamental thermodynamic limit between the forces and fields of quantum physics and classical physics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We cannot say that a quantum computer is at the highest level of abstraction controlled by a classical computer. A quantum computer is a physical realisation of a quantum Turing machine supported by quantum mechanical processes which are modelled as physical qubits and abstracted as logical qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is an interface between quantum mechanical processes and classical computer processes. Through this interface, input data from a a classical computing device can be fed into a quantum circuit. This quantum circuit can help us to realise a set of quantum gates which helps us to create a quantum register necessary for quantum circuitry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum Circuits are constructed from Quantum Registers which are devised from various types of universal, special purpose and custom built qubits. The logical quibits can create different permutations and combinations of physical qubit manifestations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum register is a type of circuit construction from logical qubits. Perhaps we will devise more diverse forms of circuits such as quantum stack machines, quantum memories etc. in the near future. The following diagram depicts how quantum circuits function in the physical circuitry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IljT0.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IljT0.jpg&quot; alt=&quot; Reference Architecture for Quantum Algorithm Implementations &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Questions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the hardware structure of a quantum computer, that I asserted above, be correct?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are various hardware models and architectures for quantum computers. One of the early model is based on Nuclear Magnetic Resonance. Adiabatic Optimisation process based Quantum Annealing Computer is built by DWave. Superconducting Qubit based Universal Quantum Computer is the model implemented by IBM. Intel is implementing Silicon based Quantum Computers. China is building Photonics based Quantum Computers. Microsoft is pioneering a topological quantum computing model. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We cannot say all of them follows the same exact hardware components and models for a quantum computer. However IBM has put forward an interesting model for the super conducting chip based quantum computing model. Please find it below. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LEPbw.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LEPbw.jpg&quot; alt=&quot;IBM Superconducting Quantum Computing Model &quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And how is a classically written quantum code, such as Qiskit, able to instruct the quantum computer to run a certain quantum algorithm (where the algorithm is simply comprised of quantum logic 'gates' that cleverly manipulate the qubits)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe you must have got a clear idea of how a Quantum Algorithm can be implemented in a Quantum Programming Paradigm like QIS Kit from IBM and PyQuil like a language by Rigetti or Q# by Microsoft by seeing the first architecture diagram. Every general purpose Quantum Computer has been implemented wit a Quantum Compiler + Quantum Runtime and a Quantum Arithmetic Unit and a Quantum Memory in the conventions of classical Von Neuman Computer Architecture. They will be supported by Quantum Processor with specific instruction sets and Quantum error correcting codes as part of the instrumentation layer. They will be supported by the Quantum Processors and Quantum Chips. If you connect to IBM Q on IBM Bluemix you can see the topology of quantum processors for various quantum computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope I could address some of your questions. Looking forward to further discussions.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2019-12-05T18:29:34.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9082" PostTypeId="1" AcceptedAnswerId="9085" CreationDate="2019-12-05T18:52:30.107" Score="2" ViewCount="113" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The counterpart of a NOT gate is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Controlled_NOT_gate#Operation&quot; rel=&quot;nofollow noreferrer&quot;&gt;CNOT&lt;/a&gt; gate. They make use of ancilla qubits to achieve this. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Given an arbitrary non-unitary transformation what are the minimum number of ancilla qubits required to make a transformation unitary? (Any bounds will do as well)&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2020-11-24T14:21:55.153" LastActivityDate="2020-11-24T14:21:55.153" Title="Minimum number of ancilla qubits required to make a transformation unitary?" Tags="&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9083" PostTypeId="2" ParentId="9082" CreationDate="2019-12-05T20:09:06.020" Score="4" Body="&lt;p&gt;For a classical function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n\rightarrow\{0,1\}^m$&lt;/span&gt;, there is always a reversibile implementation (and hence corresponding unitary implementation) on &lt;span class=&quot;math-container&quot;&gt;$n+m$&lt;/span&gt; bits. There &lt;em&gt;could&lt;/em&gt; be one on as few as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits depending on the function. For example, when you say that controlled not is the reversible implementation of not (it corresponds to the upper bound), not is itself reversible and hence unitary, corresponding to the lower bound.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your question asks more generally about a non-unitary transformation. You may be interested in the following questions/answers:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5165/1837&quot;&gt;Extending a square matrix to a unitary matrix&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5167/1837&quot;&gt;What are the constraints on a matrix that allow it to be &amp;quot;extended&amp;quot; into a unitary?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Essentially, if it can be extended, yo only need one qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-12-06T07:10:20.940" LastActivityDate="2019-12-06T07:10:20.940" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9084" PostTypeId="2" ParentId="9073" CreationDate="2019-12-05T21:26:30.013" Score="8" Body="&lt;p&gt;Readout error: do a bunch (1000's) of experiments preparing the qubit in either the 0 state or the 1 state and then immediately measuring the qubit state after each preparation. Two types of readout errors can occur: prepared 1 --&gt; measured 0, and prepared 0 --&gt; measured 1. The reported readout error is the average of the rate of those two errors (e.g. if the first occurred on 2% of trials and the second occurred on 1% of trials, then the total error rate would be 1.5% or 0.015.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Single-qubit U2 error rate: this is measured using randomized benchmarking (see &lt;a href=&quot;https://arxiv.org/abs/1109.6887&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1109.6887&lt;/a&gt;), in which sequences of gates (specifically Clifford gates) are applied with the goal of taking the qubit on a random walk among certain points on the Bloch sphere and returning it to the 0 state it started in. As the number of gates in the sequence is increased, the chance of returning to zero drops exponentially and eventually saturates near 50%.  The gate error rate is extracted from the fit to this exponential decay.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT error rate: two-qubit randomized benchmarking; same idea as for single-qubit errors, but now the gates are two-qubit Clifford gates.&lt;/p&gt;&#xA;" OwnerUserId="535" LastActivityDate="2019-12-05T21:26:30.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9085" PostTypeId="2" ParentId="9082" CreationDate="2019-12-06T10:22:54.667" Score="2" Body="&lt;p&gt;The procedure I use e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9050/55&quot;&gt;in this answer&lt;/a&gt; works in the general case as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The minimum number of ancillae that you need depends on how much &quot;non-injective&quot; the function is.&#xA;By this I mean that, given a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, the property that matters is the number of elements in the preimages of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$|f^{-1}(y)|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f^{-1}(y)\equiv\{x : f(x)=y\}$&lt;/span&gt;.&#xA;More specifically, you need to look at the greatest such number:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I\equiv \max_{y\in\operatorname{im} f} |f^{-1}(y)|,$$&lt;/span&gt;&#xA;where the maximum is taken over all elements in the image of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&#xA;Then, the necessary and sufficient number of ancillary qubits required to make the operation unitary (i.e. to make &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; bijective) is &lt;span class=&quot;math-container&quot;&gt;$\lceil\log_2 I\rceil$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lceil x\rceil$&lt;/span&gt; denotes the smallest integer greater than &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is simple: you are looking for a function &lt;span class=&quot;math-container&quot;&gt;$\tilde f$&lt;/span&gt; which extends &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and is injective. For this to be the case you need the set of inputs that all go to the same output to now &quot;become distinguishable&quot;. This means that given any &lt;span class=&quot;math-container&quot;&gt;$y\in\operatorname{im}(f)$&lt;/span&gt; for which there are &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; elements in &lt;span class=&quot;math-container&quot;&gt;$f^{-1}(y)$&lt;/span&gt;, &#xA;call them &lt;span class=&quot;math-container&quot;&gt;$x_1,...,x_\ell$&lt;/span&gt;, the extension &lt;span class=&quot;math-container&quot;&gt;$\tilde f$&lt;/span&gt; must instead give &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; different outputs &lt;span class=&quot;math-container&quot;&gt;$y_1,...,y_\ell$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is just a generic way to build an injective function out of a generic function, but now we need something more: we want &lt;span class=&quot;math-container&quot;&gt;$\tilde f$&lt;/span&gt; to also be such that &lt;em&gt;partial tracing the ancillary qubits&lt;/em&gt; gives back the original function. This means that all the additional outputs must be in the form of ancillary qubits, which converts the question into: &quot;&lt;em&gt;what is the smallest number of ancillary qubits I need to get an injective function?&lt;/em&gt;&quot; To answer this you need only focus on the &quot;least injective output&quot;, as if there are enough ancillary modes to separate &lt;span class=&quot;math-container&quot;&gt;$\max_y f^{-1}(y)$&lt;/span&gt; then they are also enough to make the whole function injective. The number of qubits required to have &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; distinct modes is the smallest &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$2^n\ge I$&lt;/span&gt;, hence the result &lt;span class=&quot;math-container&quot;&gt;$n=\lceil\log_2 I\rceil$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should note that there is nothing quantum about this: it is just a result about the number of ancillary bits required to make a classical operation reversible.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-12-06T10:22:54.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9086" PostTypeId="1" AcceptedAnswerId="9088" CreationDate="2019-12-06T11:17:16.573" Score="1" ViewCount="50" Body="&lt;p&gt;Let's say I have a ket which is a momentum eigenket &lt;span class=&quot;math-container&quot;&gt;$| p \rangle$&lt;/span&gt; and then I measure the position and obtain &lt;span class=&quot;math-container&quot;&gt;$|x' \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | p \rangle = \int | x \rangle \langle x | p \rangle dx  \to | x' \rangle $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is what is the minimum number of ancilla qubits required to simulate this transformation unitarily? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: Since the cardinality of kets involved here is &lt;span class=&quot;math-container&quot;&gt;$\aleph_1$&lt;/span&gt; I am unaware how to implement &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9085/5045&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="55" LastEditDate="2020-11-24T14:21:52.217" LastActivityDate="2020-11-24T14:21:52.217" Title="Minimum number of ancilla qubits to unitarily simulate a measurement?" Tags="&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9088" PostTypeId="2" ParentId="9086" CreationDate="2019-12-06T12:17:18.777" Score="4" Body="&lt;p&gt;While talking about knowing the position &lt;em&gt;exactly&lt;/em&gt; is a nice theoretical ideal, in practice, you cannot do that. You'll really be asking: &quot;In which 'bin' of width &lt;span class=&quot;math-container&quot;&gt;$\delta x$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; spans from &lt;span class=&quot;math-container&quot;&gt;$x_{\min}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x_{\max}$&lt;/span&gt; is the particle confined to?&quot;. This means that there's &lt;span class=&quot;math-container&quot;&gt;$(x_{\max}-x_{\min})/\delta x$&lt;/span&gt; bins, and so you basically need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\log_2\left((x_{\max}-x_{\min})/\delta x\right)&#xA;$$&lt;/span&gt;&#xA;qubits to represent that information. Hence, this is the number of ancillas you would need.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-06T12:17:18.777" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9089" PostTypeId="1" CreationDate="2019-12-06T15:06:15.037" Score="5" ViewCount="472" Body="&lt;p&gt;A density matrix is defined as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum p_i |\psi_i \rangle \langle \psi_i|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the dimensionality of each &lt;span class=&quot;math-container&quot;&gt;$|\psi_i \rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, why does it take &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; dimensions to represent a density matrix? (In both cases ignore the reduction in the number of dimensions due to normalization.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess once you write to declare that a density matrix is written in terms of the outer product of pure states with themselves, you just look at the number of dimensions used to represent those, but my question is more in the flavor of:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does it take (around) &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; dimensions to represent all possible convex combinations of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensional systems?&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2020-11-24T14:21:40.043" LastActivityDate="2021-04-12T12:29:08.940" Title="Why are $d^2$ dimensions required to describe a density matrix?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9090" PostTypeId="2" ParentId="9089" CreationDate="2019-12-06T19:17:47.647" Score="8" Body="&lt;p&gt;It appears that you have some confusion regarding the basic notions of density operators and &quot;dimension&quot;. Why &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; dimensions &quot;are required to describe&quot; a density matrix isn't the right question to ask; density matrices &lt;em&gt;are&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; dimensional objects in the same sense that vectors in &lt;span class=&quot;math-container&quot;&gt;$\Bbb R^3$&lt;/span&gt; are 3-dimensional (i.e., the cardinality of any basis set of &lt;span class=&quot;math-container&quot;&gt;$\Bbb R^3$&lt;/span&gt; is 3). By convention, the &lt;a href=&quot;https://math.stackexchange.com/a/2452453&quot;&gt;dimensionality of a vector&lt;/a&gt; refers to the space of which the vector is a member. Or did you mean the minimum number of  parameters needed specify a density matrix uniquely? More on that later. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the axioms of quantum mechanics is that to every quantum system there is associated a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_space#Separable_spaces&quot; rel=&quot;nofollow noreferrer&quot;&gt;separable&lt;/a&gt; complex Hilbert space &lt;span class=&quot;math-container&quot;&gt;$(\mathcal{H}, +, \cdot, \langle \cdot|\cdot\rangle)$&lt;/span&gt;. The states of the system are all &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Completely_positive_map&quot; rel=&quot;nofollow noreferrer&quot;&gt;positive&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_class&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace-class&lt;/a&gt; &lt;strong&gt;linear maps&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho:\mathcal{H}\to \mathcal{H}$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\rho) = 1$&lt;/span&gt;. A &lt;strong&gt;quantum state&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is called a pure state if&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exists \psi\in \mathcal{H}: \forall \alpha \in \mathcal{H}: \rho(\alpha) = \frac{\langle \psi|\alpha \rangle}{\langle \psi|\psi\rangle}\psi.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To each pure state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; you can assign an element &lt;span class=&quot;math-container&quot;&gt;$\psi \in \mathcal{H}$&lt;/span&gt; but the correspondence isn't one-to-one even if you restrict to pure states and impose the normalization condition (for instance, elements of the Hilbert varying by a global phase factor have essentially the same pure state). The take-home point is that it's wrong to refer to &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; as the pure state itself; a correction perhaps would be that a pure state can be given by an element &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; of the Hilbert space, only up to &lt;em&gt;arbitrary rescaling&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\rho(\cdot)_\psi : \mathcal{H}\to\mathcal{H}$&lt;/span&gt; is in fact the following &lt;a href=&quot;https://en.wikipedia.org/wiki/Operator_(mathematics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear operator&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho(\cdot)_\psi = \frac{\langle \psi|\cdot\rangle}{\langle \psi|\psi\rangle}\psi = \frac{|\psi\rangle\langle\psi|}{\langle \psi|\psi\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which &lt;a href=&quot;https://math.stackexchange.com/a/1757905/568976&quot;&gt;follows from the fact&lt;/a&gt; that &lt;span class=&quot;math-container&quot;&gt;$\mathcal H\otimes \mathcal H\simeq \mathcal H\otimes \mathcal H^*$&lt;/span&gt; (cf. &lt;a href=&quot;https://physics.stackexchange.com/a/249870/199113&quot;&gt;this answer&lt;/a&gt;). Once you choose an &lt;a href=&quot;https://math.stackexchange.com/a/751007&quot;&gt;ordered&lt;/a&gt; basis, it can written down as a matrix as well. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is what introductory textbooks call the &quot;&lt;strong&gt;density operator&lt;/strong&gt;&quot; for a pure state, which is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Endomorphism&quot; rel=&quot;nofollow noreferrer&quot;&gt;endomorphism&lt;/a&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; (a &lt;strong&gt;linear map&lt;/strong&gt; from &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; and not merely an element of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;; this I believe was the root of your confusion). As you should know from your linear algebra classes: the dimension of space of linear maps between two vector spaces (say &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;) is &lt;span class=&quot;math-container&quot;&gt;$\dim(V)\times \dim(W)$&lt;/span&gt; (cf. &lt;a href=&quot;https://math.stackexchange.com/a/2037879&quot;&gt;proof&lt;/a&gt;), it is clear that the dimension of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; (w.r.t the space of such linear maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\to\mathcal{H}$&lt;/span&gt;) is &lt;span class=&quot;math-container&quot;&gt;$\dim(H)\times \dim(H) = d \times d = d^2$&lt;/span&gt;. In infinite-dimensional cases things get a &lt;a href=&quot;https://math.stackexchange.com/questions/4483/matrix-of-infinite-dimension&quot;&gt;bit murkier&lt;/a&gt; but we leave that to the field of &lt;a href=&quot;https://math.stackexchange.com/a/109067&quot;&gt;functional analysis&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Coming to &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix#Pure_and_mixed_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;mixed states&lt;/a&gt;, they're simply classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Statistical_ensemble_(mathematical_physics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;ensembles&lt;/a&gt; of pure states (encoding the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2354/26&quot;&gt;lack of knowledge of the experimenter&lt;/a&gt;) and it can be shown from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Compact_operator_on_Hilbert_space#Spectral_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral theorem&lt;/a&gt; that every mixed state can be represented as a non-unique countable &lt;a href=&quot;https://en.wikipedia.org/wiki/Convex_combination&quot; rel=&quot;nofollow noreferrer&quot;&gt;convex combination&lt;/a&gt; of pure states &lt;span class=&quot;math-container&quot;&gt;$^{\dagger\dagger}$&lt;/span&gt; i.e., &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\text{mixed}} = \sum_i p_i\rho_{\psi_i}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Introductory physics and quantum computing texts tend to write this as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\text{mixed}} = \sum_i p_i|\psi_i\rangle\langle\psi_i|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with suitable normalization, but I do not find that notation particularly elegant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, to answer your main question, linear operators &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\to\mathcal{H}$&lt;/span&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space#Linear_maps_and_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;form a vector space structure&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(\mathcal{H})$&lt;/span&gt; and there exists a natural addition and scalar multiplication on that space. Clearly, the dimension is preserved upon a linear combination of &lt;span class=&quot;math-container&quot;&gt;$\dim^2(\mathcal{H})$&lt;/span&gt; dimensional linear operators &lt;span class=&quot;math-container&quot;&gt;$\rho_{\psi_i}$&lt;/span&gt; by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space#Alternative_formulations_and_elementary_consequences&quot; rel=&quot;nofollow noreferrer&quot;&gt;closure property&lt;/a&gt; of vector spaces (vector spaces are are closed under addition and scalar multiplication).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We need to be careful about the terminology here: when you say that the dimension of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt;, it's actually referring to the dimension of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(\mathcal{H})$&lt;/span&gt; i.e. the vector space of &lt;em&gt;all&lt;/em&gt; linear maps from &lt;span class=&quot;math-container&quot;&gt;$\mathcal{\mathcal{H}}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; without any additional constraints. However, when you only allow convex combinations, the set of such &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; s no longer has a vector space structure (cf. &lt;a href=&quot;https://physics.stackexchange.com/a/121367/199113&quot;&gt;Moretti's answer&lt;/a&gt;); it's merely a convex set embedded in a vector space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, when you impose the conditions of positivity (&lt;a href=&quot;https://math.stackexchange.com/questions/561636/show-that-a-positive-operator-on-a-complex-hilbert-space-is-self-adjoint&quot;&gt;self-adjointness&lt;/a&gt;, which is a &lt;a href=&quot;https://physics.stackexchange.com/a/307125&quot;&gt;basis-independent&lt;/a&gt; concept) and unit trace, the dimension (number of complex parameters) needed to specify &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; then reduces to &lt;span class=&quot;math-container&quot;&gt;$$\underbrace{\frac{d^2-d}{2}}_{\text{off-diagonal terms}} + \underbrace{(d-1)}_{\text{diagonal terms}}.$$&lt;/span&gt; That is, &lt;span class=&quot;math-container&quot;&gt;$(d^2-d)/2$&lt;/span&gt; complex numbers are needed to specify the off-diagonal terms (the elements of a self-adjoint matrix are anti-symmetric about the diagonal) and only &lt;span class=&quot;math-container&quot;&gt;$(d-1)$&lt;/span&gt; complex numbers are needed to specify the real diagonal terms (as the trace is constant). In this sense, the dimension of the &quot;space&quot; of density operators is &lt;span class=&quot;math-container&quot;&gt;$d(d+1)/2-1$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt;. In colloquial language, it still makes sense to call it &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; after all, because we usually call any &lt;span class=&quot;math-container&quot;&gt;$m\times n$&lt;/span&gt; matrix as &lt;span class=&quot;math-container&quot;&gt;$mn$&lt;/span&gt;-dimensional, and you'll represent density operators as &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; matrices anyway,  but it's useful to know the subtleties. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt;: Not every quantum state can be represented by a density operator (cf. &lt;a href=&quot;https://physics.stackexchange.com/users/206691/chiral-anomaly&quot;&gt;Chiral Anomaly&lt;/a&gt;'s &lt;a href=&quot;https://physics.stackexchange.com/questions/483053/why-cant-every-quantum-state-be-expressed-as-a-density-matrix-operator&quot;&gt;answer&lt;/a&gt; on Physics SE). &#xA;&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;span class=&quot;math-container&quot;&gt;$^{\dagger\dagger}$&lt;/span&gt;: From &lt;a href=&quot;https://en.wikipedia.org/wiki/Krein%E2%80%93Milman_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Krein-Milman&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Carath%C3%A9odory%27s_theorem_(convex_hull)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Carathéodory&lt;/a&gt;'s theorems it can be further shown that any state is a convex combination of at most &lt;span class=&quot;math-container&quot;&gt;$(\dim \mathcal H)^2$&lt;/span&gt; pure states. Spectral theorem gives an even stronger result, namely that any state is a convex combination of at most &lt;span class=&quot;math-container&quot;&gt;$\dim \mathcal H$&lt;/span&gt; pure states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle\langle \psi_i|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; are pairwise orthogonal unit vectors. For an elaborate discussion check &lt;a href=&quot;https://bookstore.ams.org/surv-223&quot; rel=&quot;nofollow noreferrer&quot;&gt;the recent monograph&lt;/a&gt; titled &lt;em&gt;Alice and Bob Meet Banach: The Interface of Asymptotic Geometric Analysis and Quantum Information Theory&lt;/em&gt; by Guillaume Aubrun and Stanisław J. Szarek (chapters 1-2).&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-08T07:57:39.883" LastActivityDate="2019-12-08T07:57:39.883" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="9091" PostTypeId="1" AcceptedAnswerId="9092" CreationDate="2019-12-06T19:41:52.013" Score="2" ViewCount="161" Body="&lt;p&gt;I try to solve problems from &lt;a href=&quot;http://issc.uj.ac.za/downloads/problems/QCProblems.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Problems in Quantum Computing&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I stuck with problem #3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/18nga.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/18nga.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sigma_2 = \begin{pmatrix}&#xA;0 &amp;amp; -i\\&#xA;i &amp;amp; 0&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;Then: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ -i \frac{\phi}{2}\sigma_2 = \begin{pmatrix}&#xA;0 &amp;amp; -\frac{\phi}{2}\\&#xA;\frac{\phi}{2} &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exp\begin{pmatrix}&#xA;0 &amp;amp; -\frac{\phi}{2}\\&#xA;\frac{\phi}{2} &amp;amp; 0&#xA;\end{pmatrix} = \begin{pmatrix}&#xA;1 &amp;amp; \exp(-\frac{\phi}{2})\\&#xA;\exp(\frac{\phi}{2}) &amp;amp; 1&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I multiply the result of the last calculation with &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;1 \\&#xA;0 &#xA;\end{pmatrix}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;0 \\&#xA;1 &#xA;\end{pmatrix}$&lt;/span&gt; I can't get &lt;span class=&quot;math-container&quot;&gt;$\psi_1(\phi)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\psi_2(\phi)$&lt;/span&gt;. I get some unnormalised state like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 \\&#xA;\exp(\frac{\phi}{2}) &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it mean that the definition of the problem is not correct?&lt;/p&gt;&#xA;" OwnerUserId="6134" LastEditorUserId="55" LastEditDate="2019-12-16T10:39:56.700" LastActivityDate="2020-01-16T09:25:31.503" Title="How to get specific state applying $e^{-i\phi \sigma_2/2}$ to $|0\rangle$ or $|1\rangle$?" Tags="&lt;mathematics&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9092" PostTypeId="2" ParentId="9091" CreationDate="2019-12-06T20:16:58.093" Score="4" Body="&lt;p&gt;Your mistake is computing exponent of matrix; use the formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exp(i\theta\sigma_2)=\cos(\theta)\cdot I+i\cdot \sin(\theta)\cdot\sigma_2$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="26" LastEditDate="2019-12-06T20:18:24.630" LastActivityDate="2019-12-06T20:18:24.630" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9093" PostTypeId="2" ParentId="9091" CreationDate="2019-12-06T23:42:50.057" Score="6" Body="&lt;p&gt;A matrix function &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt; for normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is defined as follows&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;f(A)=\sum_{i=1}^{n}f(\lambda_i)v_iv_i^T&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i}$&lt;/span&gt; is an eigenvalue and &lt;span class=&quot;math-container&quot;&gt;$v_{i}$&lt;/span&gt; is coresponding eigenvector (note: transposed vector &lt;span class=&quot;math-container&quot;&gt;$v_{i}$&lt;/span&gt; is a row vector).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In your case:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$f(A) = \mathrm{e}^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A = -i\frac{\phi}{2}\sigma_{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-09T16:55:30.227" LastActivityDate="2020-01-09T16:55:30.227" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9094" PostTypeId="1" CreationDate="2019-12-07T01:40:33.007" Score="1" ViewCount="151" Body="&lt;p&gt;If &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits&lt;/strong&gt; together provide the states 00, 01, 11 or 10 simultaneously which represent &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; probabilities&lt;/strong&gt; in total, how many probabilities do &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits represent? Does the formula for this somehow express quadratic/exponential speed-up?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastActivityDate="2019-12-07T08:51:13.887" Title="How many probabilities does the number of qubits represent?" Tags="&lt;quantum-state&gt;&lt;speedup&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9095" PostTypeId="2" ParentId="9094" CreationDate="2019-12-07T02:17:12.537" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits have &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; basis states, and &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; probabilities (to be in each of basis states).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question &quot;does the number of probabilities express the exponential speed-up ?&quot; does not make sense to me. &lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-07T02:17:12.537" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9096" PostTypeId="1" AcceptedAnswerId="9097" CreationDate="2019-12-07T03:33:01.013" Score="3" ViewCount="120" Body="&lt;p&gt;I'm trying to make a quantum computing mod for a game, (apologies if the notation is wrong I'm new to QM).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say I have 2 qubits that are both&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0⟩ + |1⟩)$&lt;/span&gt; and I put them through a CNOT gate. The result would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A \otimes B = \begin{pmatrix}&#xA;\frac{1}{\sqrt{2}}\\&#xA;\frac{1}{\sqrt{2}}&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;\frac{1}{\sqrt{2}}\\&#xA;\frac{1}{\sqrt{2}}&#xA;\end{pmatrix}&#xA;= \begin{pmatrix}&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CNOT}_{\text{matrix}}  (A \otimes B) = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}&#xA;\end{pmatrix}=&#xA;\begin{pmatrix}&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}\\&#xA;\frac{1}{2}&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which I don't believe is an entangled system. Thus, would it in theory be possible to get something in terms of the |0⟩ and |1⟩ for each individual particle? For example, express the individual states&#xA;of qubit 1 and 2 in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha|0⟩ + \beta|1⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(And if so, how would I determine this?)&lt;/p&gt;&#xA;" OwnerUserId="9390" LastEditorUserId="26" LastEditDate="2019-12-07T09:46:13.373" LastActivityDate="2019-12-07T21:01:53.220" Title="Non-entangled two qubit system get information about the individual particle states after CNOT" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9097" PostTypeId="2" ParentId="9096" CreationDate="2019-12-07T04:17:17.647" Score="1" Body="&lt;p&gt;Correct, the final state is not an entangled state. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1/2(|00&amp;gt; + |01&amp;gt; + |10&amp;gt; + |11&amp;gt;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Therefore it represents a tensor product of two qubits' state.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1/sqrt(2)(|0&amp;gt; + |1&amp;gt;) &amp;lt;tensorproduct_symbol&amp;gt; 1/sqrt(2)(|0&amp;gt; + |1&amp;gt;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For both qubits, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;alpha = beta = 1/sqrt(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This wouldn't have been possible if the qubits were entangled. &lt;/p&gt;&#xA;" OwnerUserId="8852" LastActivityDate="2019-12-07T04:17:17.647" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9098" PostTypeId="2" ParentId="9063" CreationDate="2019-12-07T04:41:27.220" Score="0" Body="&lt;p&gt;At the cost of over-simplifying:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part of your question, Grover's search helps in marking the &lt;code&gt;M&lt;/code&gt; items in the whole database. You're still searching a whole database of &lt;code&gt;N&lt;/code&gt; items. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The beauty in this implementation is that when we measure, the probability of finding these &lt;code&gt;M&lt;/code&gt; items is higher than all the other non-marked items in the database. &lt;/p&gt;&#xA;" OwnerUserId="8852" LastActivityDate="2019-12-07T04:41:27.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9099" PostTypeId="2" ParentId="9096" CreationDate="2019-12-07T05:36:07.933" Score="2" Body="&lt;p&gt;The fastest way I know to check if a given qubit is not entangled is to check if all its conditioned-on-others states are parallel. A conditioned-on-others state is a subset of your state vector where the other qubits are equal to some specific value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the first two entries in your column vector are the state of one qubit conditioned on the other being 0. The last two entries are the state of that same qubit conditioned on the other being 1. Notice that the first two entries (as a vector) are parallel to the second two entries (as a vector). Their dot product's magnitude is equal to the product of their magnitudes. (In this case it's easy to see they're parallel because they're literally identical.) Therefore that qubit is separable. Its state is equal to the first two entries (or the second two entries; doesn't matter) after normalization up to some irrelevant global phase factor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Amps1%22%5D%2C%5B%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B%22Amps1%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk's amplitude displays perform this extraction when applied to a subset of the wires:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Amps1%22%5D%2C%5B%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B%22Amps1%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eoWK0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/467017368f0d1498278485d178aa93154a067160/cirq/linalg/transformations.py#L375&quot; rel=&quot;nofollow noreferrer&quot;&gt;the python code in Cirq that performs this subwavefunction extraction&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-12-07T05:36:07.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9100" PostTypeId="2" ParentId="8994" CreationDate="2019-12-07T07:04:04.367" Score="0" Body="&lt;p&gt;In an algorithm, there is no noisy channel per se. There are faulty gates causing errors each time they are applied. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it's not completely disconnected, as you could model each faulty gate followed by an error on the output qubit(s) of the gate. This error model is the equivalent of a noisy channel. It would act on single qubits for single qubit gates, while actin on 2 qubits for 2 qubit gates (possibly showing correlated errors).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The job of QECC in a faul tolerant design is to correct for errors on qubit gates while keeping in mind that doing so requires some more possibly faulty gates. &lt;/p&gt;&#xA;" OwnerUserId="9393" LastActivityDate="2019-12-07T07:04:04.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9101" PostTypeId="2" ParentId="9094" CreationDate="2019-12-07T07:22:08.443" Score="2" Body="&lt;p&gt;The speed up is not expressed by the exponentially many basis states that a quantum system can be in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The speedup comes from being able to recombine the probability amplitudes associated to the these basis states so that a measurement can output the correct result of the computation with sufficiently high probability. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the exponentially many basis states accessible alone would make up for the speedup then any algorithm would be speedup by a quantum computer. And that's not the case.  &lt;/p&gt;&#xA;" OwnerUserId="9393" LastActivityDate="2019-12-07T07:22:08.443" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9102" PostTypeId="2" ParentId="9094" CreationDate="2019-12-07T07:54:03.153" Score="2" Body="&lt;p&gt;Sometimes, mainly in popular articles and books, it is stated that &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can be in all &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible zero-one combinations simultaneously (the superposition of these combinations) and any calculation on this register is done with all these combinations. This is used as an explanation for speed-up brings by a quantum computer. However, this is misunderstanding. If you want to use this explanation, you have to add that it is necessary to repeat an algorithm run many times and as a result you lose some of the speed-up. But this is still not precise explanation. You have to use laws of a quantum mechanics to explain this preciselly. Unfortunately there is no precise and at the same time &quot;popular&quot; explanation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionlly, the reason behind the speed-up is different for different algorithms. The scale of the speed-up is also different. It is for example quadratic for Monte Carlo simulation or database search (Grover algorithm) and exponential for solving linear equations (HHL algorithm) or integer factorization (Shor algorithm). Moreover, there are algorithms bringing no speed-up in comparison with a classical computer (e.g. binary function parity evaluation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: to be precise about HHL algorithm, it brings exponential speed-up only in case we are looking for value &lt;span class=&quot;math-container&quot;&gt;$x^TMx$&lt;/span&gt; for some operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a solution of &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2019-12-07T08:51:13.887" LastActivityDate="2019-12-07T08:51:13.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9103" PostTypeId="2" ParentId="2597" CreationDate="2019-12-07T10:35:10.410" Score="1" Body="&lt;p&gt;Quantum Walk may not perform in optimal ways over a conventional and determinisitc binary tree data structure. In a quantum walk experimental setup, the coin will not follow a binomial distribution. Construction of a quantum superposition based index for a tree data structure would be a better model. In one of the most popular implementations, a quantum walk involves a coin flip followed by a bit shift operator. The quantum walk involves a rotation of the coin space followed by the conditional shift operator.  The quantum walk begins to differ from the classical walk from the initial epochs onwards. This asymmetry arises because the Hadamard coin treats the two directions |left⟩ and |right⟩ differently. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aGDUH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aGDUH.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum walk propagates quadratically faster than the classical walk. the quantum walk spreads faster, at a rate proportional to the number of steps, instead of the square root of the number of steps as in the classical case, a quadratic speed up. An interesting addition to this model is to consider quantum logical states for the coin flipping experiment. The solution is to make the coin quantum too, and give it a unitary twist instead of a random toss. The quantum coin keeps track of which way you arrived at your location, allowing you to retrace your steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shenvi showed that a quantum walk could search an unsorted database with a quadratic speed up. The first quantum algorithm for this problem is due to Grover, using a different method to obtain the same quadratic speed up. A classical search of an unsorted database potentially has to check all N entries in the database, and on average has to check at least half. A quantum search only needs to make √N queries, though the queries ask for many answers in superposition. The quantum walk search algorithm sort of works backwards, starting in a uniform superposition over the whole database, and converging on the answer as the quantum walk proceeds. Quantum walks are reversible: a quantum walk running backwards is also a quantum walk. A quantum walk travels through all the paths in superposition, and the quantum interference between different paths allows the quantum walker to figure out which way is forward right up to the exit, which it finds in time proportional to the width of the network. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence a better and scalable quantum walk implementation would be to using the combination of a Quantum Grover Search, Quantum Bloom Filter and a Quantum Superposition based Merkel Tree or a graph isomorphism based data structure. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;References&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.math.uwaterloo.ca/~anayak/papers/MagniezNRS07.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Search Over a Quantum Walk&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/pdf/1611.02238.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Equivalence of Szegedy’s and Coined Quantum Walks&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/pdf/1502.04567.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover Search with Lackadaisical Quantum Walks&lt;/a&gt;, &lt;a href=&quot;https://www.cse.iitk.ac.in/users/amitks/quantum/shruti_kshitij_report.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Walks and their applications&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0210064&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Walk Search Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="4501" LastEditDate="2019-12-07T10:43:05.280" LastActivityDate="2019-12-07T10:43:05.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9104" PostTypeId="2" ParentId="9046" CreationDate="2019-12-07T11:49:42.437" Score="6" Body="&lt;p&gt;&lt;em&gt;self-reducible&lt;/em&gt; is a term regarding function class, such as &lt;span class=&quot;math-container&quot;&gt;$\mathsf{FNP}$&lt;/span&gt;, which is &lt;em&gt;slightly different&lt;/em&gt; from what I am going to talk about, namely a witness-finding procedure for some quantum complexity classes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the question regarding whether we have a procedure of finding a witness of a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QCMA}$&lt;/span&gt; instance or not. &#xA;The short answer is not known. &#xA;However, we did know that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PreciseQCMA}$&lt;/span&gt; has such a witness-finding procedure! &#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PreciseQCMA}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$=\mathsf{NP^{PP}}$&lt;/span&gt;, see [&lt;a href=&quot;https://arxiv.org/abs/1704.01514&quot; rel=&quot;nofollow noreferrer&quot;&gt;MN17&lt;/a&gt;] and [&lt;a href=&quot;https://arxiv.org/abs/1805.11139&quot; rel=&quot;nofollow noreferrer&quot;&gt;GSSSY18&lt;/a&gt;]) is a variant of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QCMA}$&lt;/span&gt; such that the gap between the acceptance probability of YES case and NO case is at least inverse-exponential. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Recall the witness-finding procedure for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;, i.e. Claim 1. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Claim 1.&lt;/strong&gt; There exists a &lt;span class=&quot;math-container&quot;&gt;$\sf P^{NP}$&lt;/span&gt; protocol to find a witness of an&#xA;  instance in a &lt;span class=&quot;math-container&quot;&gt;$\sf NP$&lt;/span&gt; language.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P^{NP}}$&lt;/span&gt; protocol is as below: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Given an instance &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in a language &lt;span class=&quot;math-container&quot;&gt;$\cal L\in \mathsf{NP}$&lt;/span&gt;, we can ask whether it is in YES case or not. &lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is indeed in YES case, then we can fix the first bit of the witness to be &lt;span class=&quot;math-container&quot;&gt;$w_1=0$&lt;/span&gt;, and write it as an instance &lt;span class=&quot;math-container&quot;&gt;$x\circ w_1$&lt;/span&gt; in a new language &lt;span class=&quot;math-container&quot;&gt;$\cal L'$&lt;/span&gt;. Again, we can ask whether &lt;span class=&quot;math-container&quot;&gt;$x\circ w_1$&lt;/span&gt; is in YES case or not. &lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$x\circ w_1$&lt;/span&gt; is in YES case, then we know there exists a witness starting from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;; otherwise, we know there exists a witness starting from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;li&gt;Repeat &lt;em&gt;Step 1&lt;/em&gt; and &lt;em&gt;Step 2&lt;/em&gt; inductively, we can find a witness of an instance in &lt;span class=&quot;math-container&quot;&gt;$\cal L$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(n)$&lt;/span&gt; queries where &lt;span class=&quot;math-container&quot;&gt;$|x|=n$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The language &lt;span class=&quot;math-container&quot;&gt;$\cal L'$&lt;/span&gt; consists of all &lt;span class=&quot;math-container&quot;&gt;$x\circ w'$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$w'$&lt;/span&gt; is the prefix of a correct witness. Hence, if &lt;span class=&quot;math-container&quot;&gt;$\cal L' \subseteq \mathsf{C}$&lt;/span&gt;, then the procedure above is a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P^C}$&lt;/span&gt; protocol. &#xA;It is easy to see that &lt;span class=&quot;math-container&quot;&gt;$\cal L' \subseteq \mathsf{NP}$&lt;/span&gt; since a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; verifier is powerful enough to reject a &lt;span class=&quot;math-container&quot;&gt;$x\circ w'$&lt;/span&gt; instance if &lt;span class=&quot;math-container&quot;&gt;$x\circ w'\notin\cal L'$&lt;/span&gt;. &#xA;We complete proof for the existence of a witness-finding procedure for &lt;span class=&quot;math-container&quot;&gt;$\sf NP$&lt;/span&gt; with an explicit construction. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now let us do the same thing for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QCMA}$&lt;/span&gt;. Note that there is a gap of acceptance probability between YES case and NO case, namely for a promise problem &lt;span class=&quot;math-container&quot;&gt;$(\cal L_{yes},\cal L_{no}) \in \sf QCMA$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$\cal L_{yes} \cup \cal L_{no} \subsetneq \{0,1\}^*$&lt;/span&gt;. &#xA;Back to the witness-finding procedure of &lt;span class=&quot;math-container&quot;&gt;$\sf QCMA$&lt;/span&gt;, we obtain &lt;span class=&quot;math-container&quot;&gt;$(\cal L',\{0,1\}^* \setminus \cal L') \not\in \sf QCMA$&lt;/span&gt; due to the gap issue just mentioned. Further details can be found in Remark 3.7 in [&lt;a href=&quot;https://arxiv.org/abs/1805.11139&quot; rel=&quot;nofollow noreferrer&quot;&gt;GSSSY18&lt;/a&gt;]. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about &lt;span class=&quot;math-container&quot;&gt;$\sf PreciseQCMA$&lt;/span&gt;? Fortunately, we can show Claim 2 below which is a lemma (proven in my paper with collaborators, see [&lt;a href=&quot;https://arxiv.org/abs/1912.11611&quot; rel=&quot;nofollow noreferrer&quot;&gt;GLK19&lt;/a&gt;]). &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Claim 2.&lt;/strong&gt; There exists a &lt;span class=&quot;math-container&quot;&gt;$\sf P^{PreciseQCMA}$&lt;/span&gt; protocol to find a witness of an&#xA;  instance in a &lt;span class=&quot;math-container&quot;&gt;$\sf PreciseQCMA$&lt;/span&gt; language.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Notice the acceptance probability of an instance in a language &lt;span class=&quot;math-container&quot;&gt;$\cal L$&lt;/span&gt; in a &lt;span class=&quot;math-container&quot;&gt;$\sf QCMA$&lt;/span&gt;-type complexity class, such as &lt;span class=&quot;math-container&quot;&gt;$\sf QCMA$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sf PreciseQCMA$&lt;/span&gt;, requires only inverse-exponential accuracy. &#xA;The reason is that the total number of gates for preparing a witness and the verification circuit is at most &lt;span class=&quot;math-container&quot;&gt;${\rm poly}(n)$&lt;/span&gt;. &#xA;Also, the gap of acceptance probability between YES case and NO case is inverse-exponentially small, so it is not hard to conclude that &lt;span class=&quot;math-container&quot;&gt;$(\cal L', \{0,1\}^* \setminus \cal L') \in \sf PreciseQCMA$&lt;/span&gt;. It completes the proof of Claim 2. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Could we say anything more about complexity classes with a quantum witness? &#xA;By the Solovay-Kitaev theorem, preparing any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum state with inverse-polynomial accuracy requires an exponentially long local gates sequence. Hence, a polynomial-time classical algorithm with the help of a &lt;span class=&quot;math-container&quot;&gt;$\sf QMA$&lt;/span&gt;-type class oracle cannot find a quantum witness naively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, the gap &lt;span class=&quot;math-container&quot;&gt;$c-s$&lt;/span&gt; between YES case and NO case of such a &lt;span class=&quot;math-container&quot;&gt;$\sf QMA$&lt;/span&gt;-type class is also crucial. Otherwise, the oracle might not be able to decide whether &lt;span class=&quot;math-container&quot;&gt;$x\circ w'$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;${\sf QMA}(c,s)$&lt;/span&gt; or not. With the help of quantum queries (such as superpositions) to an oracle, we might have a &lt;span class=&quot;math-container&quot;&gt;${\sf BQP}^{{\sf QMA}(c,s)}$&lt;/span&gt; protocol for finding a witness, but it requires non-trivial new ideas. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we still can say something now about &lt;span class=&quot;math-container&quot;&gt;${\sf QMA}(c,s)$&lt;/span&gt; with a very tiny &lt;span class=&quot;math-container&quot;&gt;$c-s$&lt;/span&gt; gap. Let &lt;span class=&quot;math-container&quot;&gt;$\sf ExactQMA$&lt;/span&gt; be a variant of &lt;span class=&quot;math-container&quot;&gt;${\sf QMA}(c,s)$&lt;/span&gt; with an inverse-doubly-exponential gap &lt;span class=&quot;math-container&quot;&gt;$c-s \geq 2^{-2^{{\rm poly}(n)}}$&lt;/span&gt;, also &lt;span class=&quot;math-container&quot;&gt;$\sf ExactQMA_1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$c=1$&lt;/span&gt;. &#xA;Then by the same reasoning used in Claim 2, we obtain Claim 3: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Claim 3.&lt;/strong&gt; There exists a &lt;span class=&quot;math-container&quot;&gt;$\sf ExactQMA_1$&lt;/span&gt; protocol to find a witness of an&#xA;  instance in a &lt;span class=&quot;math-container&quot;&gt;$\sf ExactQMA_1$&lt;/span&gt; language. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The protocol that we obtain essentially is a &lt;span class=&quot;math-container&quot;&gt;$\sf BQPSPACE^{ExactQMA_1}$&lt;/span&gt; protocol, since an exponential-length local gates sequence (i.e. an exponential-length bit string) that acts on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is even enough to prepare any quantum state within inverse-doubly-exponential accuracy. &#xA;Note that &lt;span class=&quot;math-container&quot;&gt;${\sf ExactQMA_1} = {\sf PSPACE}$&lt;/span&gt; [&lt;a href=&quot;https://arxiv.org/abs/1012.4427&quot; rel=&quot;nofollow noreferrer&quot;&gt;IKW10&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1604.01384&quot; rel=&quot;nofollow noreferrer&quot;&gt;FL16&lt;/a&gt;], &lt;span class=&quot;math-container&quot;&gt;${\sf BQPSPACE} = {\sf PSPACE}$&lt;/span&gt; [&lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/Papers/SpaceBoundedQuantumComplexity.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wat99&lt;/a&gt;] and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE}^{\mathsf{PSPACE}}=\mathsf{PSPACE}$&lt;/span&gt;, we obtain &lt;span class=&quot;math-container&quot;&gt;${\sf BQPSPACE^{ExactQMA_1}} \subseteq {\sf ExactQMA_1}$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1777" LastEditorUserId="1777" LastEditDate="2020-01-20T14:34:13.693" LastActivityDate="2020-01-20T14:34:13.693" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9106" PostTypeId="1" CreationDate="2019-12-07T16:49:28.533" Score="2" ViewCount="156" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XH52Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XH52Y.png&quot; alt=&quot;Two representations of the same circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am wondering why this &quot;Quantum Teleportation Algorithm&quot; from &lt;a href=&quot;https://youtu.be/mMwovHK2NrE&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit - Programming on Quantum Computers Ep 5&lt;/a&gt; is represented differently when I draw it (on the left in the image above) compared to when they draw it (on the right in the image above), i.e. my result has only one &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; line and the result from the video has separate lines for &lt;span class=&quot;math-container&quot;&gt;$c_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would assume that this is something that was simply changed in development of Qiskit, but then I am wondering why they would make this change.&lt;br&gt;&#xA;Again, my assumption would be that there are no controlled gates on classical bits but only links from the quantum register to the classical register, hence, it is not needed to display separate lines.&lt;/p&gt;&#xA;" OwnerUserId="9399" LastActivityDate="2019-12-07T17:10:56.367" Title="Why is there only one line for the classical register?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9107" PostTypeId="2" ParentId="9106" CreationDate="2019-12-07T17:10:56.367" Score="4" Body="&lt;p&gt;This can be done by passing a style to the drawer, setting the &lt;code&gt;cregbundle&lt;/code&gt; to be &lt;code&gt;False&lt;/code&gt; as the default is &lt;code&gt;True&lt;/code&gt;. For example, given the circuit &lt;code&gt;qc&lt;/code&gt; we can draw all the classical registers as follows :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qc.draw(output='mpl', filename='no_bundle.png', style={'cregbundle': False})&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it is worth noting that only the &lt;code&gt;mpl&lt;/code&gt; drawer supports setting things using a style dictionary like this.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-07T17:10:56.367" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9108" PostTypeId="1" AcceptedAnswerId="9109" CreationDate="2019-12-07T19:14:44.567" Score="5" ViewCount="377" Body="&lt;p&gt;Suppose I have the following circuit where q0 and q1 are measured one after the other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ReJ4h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ReJ4h.png&quot; alt=&quot;Circuit diagram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The simulation results state that the state 00 occurs 75% of the time, and the state 11 occurs 25% of the time. But if you measure both at the same time, you get 00 and 11 50% of the time each.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my calculations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;           \frac{1}{\sqrt{2}} \\&#xA;           \frac{1}{\sqrt{2}} \\&#xA;         \end{bmatrix} \otimes &#xA;\begin{bmatrix}&#xA;           1 \\&#xA;           0 \\&#xA;         \end{bmatrix} = &#xA;\begin{bmatrix}&#xA;           \frac{1}{\sqrt{2}} \\&#xA;           0 \\&#xA;\frac{1}{\sqrt{2}}\\ &#xA;0&#xA;         \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA;           1, 0, 0, 0 \\&#xA;0, 1, 0, 0 \\&#xA;0, 0, 0, 1 \\&#xA;0, 0, 1, 0 \\&#xA;         \end{bmatrix}&#xA;\begin{bmatrix}&#xA;           \frac{1}{\sqrt{2}} \\&#xA;           0 \\&#xA;\frac{1}{\sqrt{2}}\\ &#xA;0&#xA;         \end{bmatrix}&#xA;= &#xA;\begin{bmatrix}&#xA;           \frac{1}{\sqrt{2}} \\&#xA;           0 \\&#xA;0 \\&#xA;\frac{1}{\sqrt{2}}\\ &#xA;         \end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now have an entangled state. First H gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(H \otimes I) \begin{bmatrix}&#xA;           \frac{1}{\sqrt{2}} \\&#xA;           0 \\&#xA;0 \\&#xA;\frac{1}{\sqrt{2}}&#xA;         \end{bmatrix} = $&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA;\frac{1}{2} \\&#xA;\frac{1}{2} \\&#xA;\frac{1}{2} \\&#xA;-\frac{1}{2}&#xA;         \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2nd H gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(H \otimes I)&#xA;\begin{bmatrix}&#xA;\frac{1}{2} \\&#xA;\frac{1}{2} \\&#xA;\frac{1}{2} \\&#xA;-\frac{1}{2}&#xA;         \end{bmatrix} = &#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} \\&#xA;0 \\&#xA;0 \\&#xA;\frac{1}{\sqrt{2}}&#xA;         \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus there should be a 50-50 chance of the final state either being 00 or 11, but how come measuring the results one after the other changes it?&lt;/p&gt;&#xA;" OwnerUserId="9390" LastEditorUserId="55" LastEditDate="2019-12-11T14:42:43.977" LastActivityDate="2019-12-11T14:42:43.977" Title="Why does measuring one qubit after the other in this entangled system alter the result?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9109" PostTypeId="2" ParentId="9108" CreationDate="2019-12-07T19:56:13.520" Score="9" Body="&lt;p&gt;If the simulator is saying that state 00 occurs 75% of the time then the simulator has a bug. Reordering measurements can't make certain outcomes more likely in that way. It would violate the no communication theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B1%2C%22H%22%5D%2C%5B1%2C%22Measure%22%5D%2C%5B%22Measure%22%5D%2C%5B%22Chance2%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P2ADc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-12-07T19:56:13.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9110" PostTypeId="2" ParentId="9096" CreationDate="2019-12-07T21:01:53.220" Score="0" Body="&lt;p&gt;Your end state is not entangled. As you have written, the state vector after the gate is the same as the one before the gate. And your starting state is obviously not entangled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the rest of your question, what would be the 'something' you are looking for in terms of 0's and 1's?&lt;/p&gt;&#xA;" OwnerUserId="9393" LastActivityDate="2019-12-07T21:01:53.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9111" PostTypeId="2" ParentId="9108" CreationDate="2019-12-07T23:27:59.240" Score="3" Body="&lt;p&gt;Just some notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) A symbol for tensor product is &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt;, so I edited your answer so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) After CNOT, you do not have to calculate firstly tensor product &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$I \otimes H$&lt;/span&gt; (by the way, you calculated &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$I \otimes H$&lt;/span&gt; in step you denoted 2nd H) and simply use &lt;span class=&quot;math-container&quot;&gt;$H \otimes H$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) Regarding your comment &quot;two Hadamards gate do nothing&quot;. They in fact change basis you measure in from z-basis to x-basis. However, if you measure your state proudced by Hadamard and CNOT (this is called Bell &lt;span class=&quot;math-container&quot;&gt;$\beta_{00}$&lt;/span&gt; state) in both bases then you get same results. But please bear in mind that in case of another measured states, the result with and without &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;s could be different.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-07T23:27:59.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9112" PostTypeId="1" CreationDate="2019-12-08T08:47:25.580" Score="1" ViewCount="75" Body="&lt;p&gt;Say Alice wants to transmit a 10-bit key. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the BB84 protocol, if we assume that Alice and Bob use the same basis to encode and decode 6 qubits (and different ones for the other 4), then what would be the maximum and minimum bits they might agree on? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would the minimum number be 6 because they use the same basis 6 times and the maximum be 10? (in case Bob measures the same value even when using a different basis)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, since they disagree on the basis 4 times, are there &lt;span class=&quot;math-container&quot;&gt;$2^4$&lt;/span&gt; possible runs of this protocol possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Extension: How would one go about doing the above analysis for B92?&lt;/p&gt;&#xA;" OwnerUserId="9332" LastEditorUserId="9332" LastEditDate="2019-12-08T08:54:02.727" LastActivityDate="2020-05-07T07:05:55.820" Title="BB84 and B92 protocols: what is maximum and minimum bits that Alice and Bob might agree on?" Tags="&lt;key-distribution&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9113" PostTypeId="1" AcceptedAnswerId="9114" CreationDate="2019-12-08T13:24:08.077" Score="3" ViewCount="916" Body="&lt;p&gt;I have some difficulty with understanding no-cloning theorem. Simply speaking, according to the theorem, it is not possible to copy a quantum state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, CNOT gate can be used as so-called fan-out gate which purpose is to copy one qubit to another one, previously in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that these two facts negate each other. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; How is no-cloning theorem compatible with the fact that fan-out gate works?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2021-05-02T09:22:37.227" LastActivityDate="2021-05-02T09:22:37.227" Title="How is the no-cloning theorem compatible with the fact that fan-out gates work?" Tags="&lt;quantum-gate&gt;&lt;no-cloning-theorem&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9114" PostTypeId="2" ParentId="9113" CreationDate="2019-12-08T14:49:45.100" Score="11" Body="&lt;p&gt;By &quot;copying a quantum state&quot;, we mean that we cannot take&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi⟩|0⟩=\alpha|00⟩+\beta|10⟩$$&lt;/span&gt;&#xA;into&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi⟩|\psi⟩=(\alpha|0⟩+\beta|1⟩)(\alpha|0⟩+\beta|1⟩)=\alpha^2|00⟩+\alpha\beta|01⟩+\beta\alpha|10⟩+\beta^2|11⟩$$&lt;/span&gt;&#xA;for arbitrary single qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩=\alpha|0⟩+\beta|1⟩$&lt;/span&gt;. Notice that this resulting two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩|\psi⟩$&lt;/span&gt; is still separable. &lt;br/&gt;&lt;br/&gt;&#xA;But in the case of CNOT gate, it takes &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩|0⟩$&lt;/span&gt; to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT|\psi⟩|0⟩=CNOT(\alpha|00⟩+\beta|10⟩)=\alpha|00⟩+\beta|11⟩.$$&lt;/span&gt;&#xA;As you can see, the results are different. The resulting two-qubit state from CNOT is now entangled (not separable).&lt;br/&gt;&lt;br/&gt;&#xA;CNOT gate does not copy qubit states; rather it creates entanglement between them.&lt;/p&gt;&#xA;" OwnerUserId="9405" LastActivityDate="2019-12-08T14:49:45.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9115" PostTypeId="1" AcceptedAnswerId="9125" CreationDate="2019-12-08T16:45:30.707" Score="2" ViewCount="315" Body="&lt;p&gt;I'm new to quantum computing, so apologize if my question seems obvious.&lt;/p&gt;&#xA;&lt;p&gt;Say we have a state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; and we want to measure it in the computational basis. From what I've been able to understand so far is that, when we make a measure in the computational basis, we obtain a classical bit with a certain probability. For instance if: &lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle\phantom{}  = \alpha|0\rangle+\beta|1\rangle$$&lt;/span&gt; then, once we measure, we obtain &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and obtain &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where I truly get lost is when I am asked to measure a state in another basis. For instance, let's say that I am asked to measure &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; in the following basis: &lt;span class=&quot;math-container&quot;&gt;$$\{|\alpha\rangle, |\alpha_{\bot}\rangle\}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{\pi}{4}$&lt;/span&gt;. I am totally lost here, as I don't know what &lt;span class=&quot;math-container&quot;&gt;$|\alpha&amp;gt;$&lt;/span&gt; is. It's a vector of 2 components, I guess. Intuitively, I would have said that &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle = \alpha|0\rangle$&lt;/span&gt;, but I am honestly not sure. Even if that is true, I have no idea what &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{\bot}\rangle$&lt;/span&gt; would be like. Could you help me out to clarify this, please?&lt;/p&gt;&#xA;&lt;p&gt;PS: I don't have a background in physics. I have one in Computer Science. I'm discovering quantum computing on my free time&lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="1859" LastEditDate="2020-11-21T18:24:25.600" LastActivityDate="2020-11-21T18:24:25.600" Title="Measuring in an arbitrary basis" Tags="&lt;measurement&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9116" PostTypeId="1" AcceptedAnswerId="9117" CreationDate="2019-12-08T17:13:27.467" Score="0" ViewCount="111" Body="&lt;p&gt;How does a controlled R gate look like (matrixwise)?&#xA;And how to generate CCR, CCCR and so on?&lt;/p&gt;&#xA;" OwnerUserId="9292" LastActivityDate="2019-12-08T17:28:50.373" Title="Controlled phase shift gate" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9117" PostTypeId="2" ParentId="9116" CreationDate="2019-12-08T17:28:50.373" Score="2" Body="&lt;p&gt;I found the &lt;a href=&quot;https://www.quantiki.org/wiki/quantum-gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;answer&lt;/a&gt; and it seems like for a gate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{bmatrix}&#xA;x_{00}   &amp;amp; x_{10}\\&#xA;x_{00}   &amp;amp; x_{11}&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;its controlled variant would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CU=\begin{bmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; x_{00} &amp;amp; x_{01} \\  &#xA;0 &amp;amp; 0 &amp;amp; x_{10} &amp;amp; x_{11} &#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence for R, which is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R(\theta) =  \begin{bmatrix} &#xA;1 &amp;amp; 0\\ &#xA;0 &amp;amp; e^{i \theta} \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CR would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CR(\theta)=\begin{bmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\  &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i \theta} &#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S.: Please, correct me if I'm wrong.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9292" LastActivityDate="2019-12-08T17:28:50.373" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9118" PostTypeId="2" ParentId="9115" CreationDate="2019-12-08T18:03:14.930" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|#1⟩}$&lt;/span&gt;&#xA;Let's assume the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi}$&lt;/span&gt; is written in an arbitrary basis, say &lt;span class=&quot;math-container&quot;&gt;$(\ket{a},\ket{b})$&lt;/span&gt;, as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi} = \alpha \ket{a} + \beta \ket{b}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are complex coefficients&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denoting the eigenvalues of the basis as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; respectively, according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Max_Born&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born&lt;/a&gt;'s rule of measurement, there is a probability &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt; of measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b|^2$&lt;/span&gt; of measuring B.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a state &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha_{\perp}}$&lt;/span&gt; is its orthogonal state. Writing the states as vectors, the two vectors are orthogonal. It is true that in a Euclidean vector space of dimension &lt;span class=&quot;math-container&quot;&gt;$n \geq 3$&lt;/span&gt; (3D space, if you will), a vector has infinitely many orthogonal vectors. In the case of a 1-qubit state, however, we're actually in the &lt;span class=&quot;math-container&quot;&gt;$n = 2$&lt;/span&gt; case! In geometric terms, we're in 2D space. This means that we actually have only two vectors that are orthogonal to the vector in question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To know which one to choose, we have to refer to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt; representation of 1-qubit bases. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FMxma.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FMxma.png&quot; alt=&quot;Bloch sphere, named after physicist Felix Bloch&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Bloch sphere, two orthogonal vectors are colinear. To find an orthogonal vector of another vector in order to form a basis, we just take the vector obtained by central symmetry. For instance, in the above figure, if we take &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; defined by the angles &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; as the vector, the other vector &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_{\perp}}$&lt;/span&gt; will be defined by the angles &lt;span class=&quot;math-container&quot;&gt;$\theta + \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi + \pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now as to what &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{\pi}{4}$&lt;/span&gt;, I believe it means a vector with &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{4}$&lt;/span&gt;, as the &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; angle is just responsible for a phase constant and does not affect measurement. In short, pick any vector with &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{4}$&lt;/span&gt;, then find its orthogonal vector by central symmetry. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've only very rarely encountered this notation however and find it very confusing, especially for an introductory text in quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The section below is meant to prepare you for the same notation you just encountered in a different context, so as to prevent you from confusing the two.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Usually, quantum circuits have registers of width not bound to 1 qubit. While there is no ambiguity in the case of 1 qubit, the following notations can be used in the case of multi-qubit registers (in order of decreasing explicitness), where we choose the binary representation of the number &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; as the state of a 3-qubit register.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{1} \otimes \ket{0} \otimes \ket{1}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{101}_3$&lt;/span&gt;, the subscript denoting the width of the register&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{5}_3$&lt;/span&gt;, where we switch to decimal base&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{5}$&lt;/span&gt;, where we forego the width of the register&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; which we chose arbitrarily before, can actually be any positive (unsigned) integer representable with 3 qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 1-qubit numbers, a basis has 2 elements (in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;).&#xA;For 2-qubit numbers, the basis has 4 elements (in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$\ket{00}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{01}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{10}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{11}$&lt;/span&gt;).&#xA;For &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit numbers, the basis has &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the aforementioned bases can also be written with the notation conventions as:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{2}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{3}$&lt;/span&gt;, in the case of &lt;span class=&quot;math-container&quot;&gt;$n = 2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ldots$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{2^n - 1}$&lt;/span&gt;, in the general case&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9408" LastActivityDate="2019-12-08T18:03:14.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9119" PostTypeId="1" AcceptedAnswerId="9131" CreationDate="2019-12-08T19:50:13.090" Score="3" ViewCount="49" Body="&lt;p&gt;I'm writing a Q# program and I'm calling an operation defined in the program that outputs a &lt;code&gt;Result&lt;/code&gt; (&lt;code&gt;One&lt;/code&gt; or &lt;code&gt;Zero&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;output = QuantumOperation.Run(sim).Result;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to convert now &lt;code&gt;output&lt;/code&gt; to a &lt;code&gt;bool&lt;/code&gt; within C#, but I don't know how.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One way to go around this is to change the output of &lt;code&gt;QuantumOperation&lt;/code&gt; to be a &lt;code&gt;bool&lt;/code&gt; and transforming the result at the end of the operation with &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.convert.resultasbool?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ResultAsBool(result)&lt;/code&gt;&lt;/a&gt;. However, I want to maintain the output of the operation to be a &lt;code&gt;Result&lt;/code&gt;. So ideally the conversion should happen within the C# host code.&lt;/p&gt;&#xA;" OwnerUserId="9366" LastActivityDate="2019-12-09T17:56:42.040" Title="How can I transform a Result into a Bool in Q# + C# environment?" Tags="&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9120" PostTypeId="1" CreationDate="2019-12-08T20:41:38.690" Score="4" ViewCount="69" Body="&lt;p&gt;As far as I know after minimization I have to obtain a value &lt;span class=&quot;math-container&quot;&gt;$E_{0}\le \frac{\langle \psi (\theta)|H|\psi (\theta)\rangle}{\langle \psi (\theta)|\psi (\theta)\rangle}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$E_{0}$&lt;/span&gt; - eigenvalue of ground state for hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Sometimes the algorithm give the value close to &lt;span class=&quot;math-container&quot;&gt;$E_{0}$&lt;/span&gt;, but far more often I get values lower than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I use hardwave efficient ansatz for initial state generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hamiltonian consists of Pauli-strings &lt;span class=&quot;math-container&quot;&gt;$H=\sum_{ijkl}\sigma_i\sigma_j\sigma_k\sigma_l$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For parameters optimization I use &quot;COBYLA&quot; and &quot;Nelder-Mead&quot; methods.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could it be that the ansatz produce a state space which is not large enough?&lt;/p&gt;&#xA;" OwnerUserId="6071" LastEditorUserId="6071" LastEditDate="2019-12-09T06:50:41.830" LastActivityDate="2019-12-09T23:29:21.387" Title="How to explain that I get a value lower than the smallest possible through minimization procedure in VQE?" Tags="&lt;quantum-state&gt;&lt;optimization&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9121" PostTypeId="2" ParentId="9115" CreationDate="2019-12-08T22:18:43.100" Score="1" Body="&lt;p&gt;In simple words, measuring in another basis than computational one means that you express a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; like a linear combination of two vectors different from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An example of another basis is x-basis (or Hadamard basis). In this case, base vectors are &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\-1\end{pmatrix}$&lt;/span&gt;. To measure in this basis, you firstly have put Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; before a measurement in a quantum circuit. Your result will be again vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. As a result, you are able to express &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; like a combination of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, it is possible to measure in many different basis, however, firstly you have to find a circuit transforming the basis to a computational one and to apply it before measuring.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="7706" LastEditDate="2020-09-06T06:07:37.427" LastActivityDate="2020-09-06T06:07:37.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9122" PostTypeId="1" AcceptedAnswerId="9142" CreationDate="2019-12-09T02:28:14.853" Score="3" ViewCount="72" Body="&lt;p&gt;I'm working on the following exercise:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;Show how a classical probabilistic transition on an M -state system can be simulated&#xA;  by a quantum algorithm by adding an additional M -state ‘ancilla’ system, applying a&#xA;  unitary operation to the joint system, and then measuring and discarding the ancilla&#xA;  system.&quot;&#xA;  - &quot;An Introduction to Quantum Computing&quot; by Phillip Kaye.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I am wondering if my attempt below is correct, and if not, if I could have a hint how to go about correcting it.&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My interpretation of the exercise is that I only need to show an example of a super-operator that represents a classical probabilistic transition and not showing this is true in general (although, I am curious how to go about showing this in general). In addition, the classical system needs to be represented by a stochastic matrix that cannot be represented by any unitary (e.g. for stochastic matrix &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\nexists U$&lt;/span&gt; (unitary) s.t. &lt;span class=&quot;math-container&quot;&gt;$S_{(i,j)} = |U_{(i,j)}|^2$&lt;/span&gt;), else we wouldn't need to use a &quot;super-operator&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where a super-operator is: &lt;span class=&quot;math-container&quot;&gt;$\rho \mapsto Tr_B(\rho \otimes |0...0\rangle\langle0...0|)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the ancillary system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a 2-state classical probabilistic system (to make the math simple) represented as qubits: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt;, represented as a vector w.r.t. the standard basis as &lt;span class=&quot;math-container&quot;&gt;$[1, 0]^t, [0, 1]^t$&lt;/span&gt; respectively. Then add an ancilla, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to construct two elements of a 4-state system : &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |2\rangle = |10\rangle$&lt;/span&gt; represented as tensors w.r.t. the standard basis as &lt;span class=&quot;math-container&quot;&gt;$[1, 0, 0, 0]^t, [0,0,1,0]^t$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define the unitary operator on the joint-system:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = \begin{pmatrix}&#xA;\lambda_{11} &amp;amp; \lambda_{12} &amp;amp; \lambda_{13} &amp;amp; \lambda_{14}\\&#xA;\lambda_{21} &amp;amp; \lambda_{22} &amp;amp; \lambda_{23} &amp;amp; \lambda_{24}\\&#xA;\lambda_{31} &amp;amp; \lambda_{32} &amp;amp; \lambda_{33} &amp;amp; \lambda_{34}\\&#xA;\lambda_{41} &amp;amp; \lambda_{42} &amp;amp; \lambda_{43} &amp;amp; \lambda_{44}\\&#xA;\end{pmatrix},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming the classical system starts in the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Call the initial 2-state system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and the ancilla as &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Applying the super-operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}_B(U|00\rangle\langle 00|U^\dagger) = \begin{pmatrix}&#xA;|\lambda_{11}|^2 + |\lambda_{21}|^2 &amp;amp; \lambda_{11}\lambda_{31}^* + \lambda_{21}\lambda_{41}^* \\&#xA; \lambda_{31}\lambda_{11}^* + \lambda_{41}\lambda_{21}^*&amp;amp; |\lambda_{31}|^2 + |\lambda_{41}|^2 \\&#xA;\end{pmatrix} = \rho_0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, for &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}_B(U|10\rangle\langle 10|U^\dagger) = \begin{pmatrix}&#xA;|\lambda_{13}|^2 + |\lambda_{23}|^2 &amp;amp; \lambda_{13}\lambda_{33}^* + \lambda_{23}\lambda_{43}^* \\&#xA; \lambda_{33}\lambda_{13}^* + \lambda_{43}\lambda_{23}^*&amp;amp; |\lambda_{33}|^2 + |\lambda_{43}|^2 \\&#xA;\end{pmatrix} = \rho_1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the part I am dubious about:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The transition: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \mapsto |1\rangle$&lt;/span&gt; is represented by the (0,1) entry of the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; (or the component &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 1|)$&lt;/span&gt; and the transition: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \mapsto |0\rangle$&lt;/span&gt; is represented by the (0,0) entry of &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; (or the component &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the system started in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;:&#xA; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \mapsto |0\rangle$&lt;/span&gt; is represented by the (1,0) entry of the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; and the transition: &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \mapsto |1\rangle$&lt;/span&gt; is represented by the (1,1) entry of &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the system being simulated is classical super-positions aren't considered as inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus this super operator w.r.t. the unitary operator above, represents the 2 x 2 stochastic matrix (as long as the entries in each column sum to 1)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA;|\lambda_{11}|^2 + |\lambda_{21}|^2 &amp;amp; \lambda_{33}\lambda_{13}^* + \lambda_{43}\lambda_{23}^*  \\&#xA; \lambda_{13}\lambda_{33}^* + \lambda_{23}\lambda_{43}^*&amp;amp; |\lambda_{33}|^2 + |\lambda_{43}|^2 \\&#xA;\end{pmatrix} = S$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus to represent the trivial transition matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S = \begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 \\&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;where entry (i,j) represents the probability of transitioning from j to i (so the columns need to sum to 1), which can't be represented by any 2 x 2 unitary&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can make &lt;span class=&quot;math-container&quot;&gt;$U = \begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;\end{pmatrix}$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update (all parts of the exercise) part (c) is the question asked above&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZIyJ0.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZIyJ0.jpg&quot; alt=&quot;All parts of the problem&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8765" LastEditorUserId="8765" LastEditDate="2019-12-10T18:49:44.030" LastActivityDate="2019-12-12T09:04:35.067" Title="Simulating Classical Probabilistic Transitions with superoperators" Tags="&lt;density-matrix&gt;&lt;quantum-operation&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9123" PostTypeId="1" CreationDate="2019-12-09T03:54:54.203" Score="2" ViewCount="45" Body="&lt;p&gt;I use HPC hardware and AI software to forecast stock market prices in real time. My system is running into hardware and operating system limitations so I am wondering if it would be productive to experiment with a quantum computer. If anyone has any experience or expertise using a quantum computer for finance, please share your ideas and expertise. Thanks. Daro&lt;/p&gt;&#xA;" OwnerUserId="9414" LastActivityDate="2019-12-10T22:05:48.410" Title="Are there realistic applications to predictive analysis of complex systems now handled by AI?" Tags="&lt;artificial-intelligence&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9124" PostTypeId="2" ParentId="9112" CreationDate="2019-12-09T06:35:15.233" Score="1" Body="&lt;p&gt;I’m not exactly sure what is meant by “the bits they agree on”, but I would interpret it slightly differently to you. If Alice and Bob don’t agree on the same basis, they discard those bits, so they have a maximum of 6. If everything works perfectly, all 6 bits should be equal. Of course, in the real world, there are experimental imperfections and it could be that as few as 0 agree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I’m also unsure why you’re counting the number of “possible runs” of the protocol. But I suppose I would count the number of possible basis choices. I forget if we’re talking about a 4-state or 6-state protocol here (2 bases or 3 bases) so let k be the number of bases. Each of the agreeing rounds has k different ways it could have occurred. The non-agreeing rounds have k(k-1) different ways the bases could have been chosen. This means that overall there are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\binom{10}{6}k^6(k(k-1))^4$$&lt;/span&gt;&#xA;different ways that result in the described situation. That’s out of the &lt;span class=&quot;math-container&quot;&gt;$k^{20}$&lt;/span&gt; different choices overall.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-09T06:35:15.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9125" PostTypeId="2" ParentId="9115" CreationDate="2019-12-09T07:36:10.027" Score="3" Body="&lt;p&gt;You're happy with the concept of measuring in the computational basis, so stick with that for now. Measuring in another basis simply means applying a unitary before the measurement. Unitaries are basis transformations, meaning they change some basis, say &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle,|\alpha^\perp\rangle$&lt;/span&gt; into another basis such as  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt;. Indeed, we can deliberately construct unitaries in this way:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=|0\rangle\langle\alpha|+|1\rangle\langle\alpha^\perp|&#xA;$$&lt;/span&gt;&#xA;For example, if we started with an initial state &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt;, then applying &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; converts if to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and so when you measure it, you definitely get answer &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, corresponding the the original state having definitely been in the state &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the notation of what &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; means: remember that the text inside the ket, in this case &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, is an arbitrary label that doesn't mean anything unless you ascribe a meaning to it. So it's just there to denote &quot;some state&quot;, presumably a one-qubit state from this context. So, that implicitly means an arbitrary &lt;em&gt;normalised&lt;/em&gt; vector such as &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;. It could be a bit confusing to have &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; appear in both the label and one of the amplitudes but that's why, personally, I wouldn't ever make the label &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;. Now it &lt;em&gt;might&lt;/em&gt; be that whatever source you're using has ascribed a particular meaning to the concept &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt;. Since you're talking about it being an angle, I'm guessing it means &lt;span class=&quot;math-container&quot;&gt;$\cos\alpha|0\rangle+\sin\alpha|1\rangle$&lt;/span&gt;, but that would be highly source dependent because I could just as easily imagine a source using &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\alpha}{2}|0\rangle+\sin\frac{\alpha}{2}|1\rangle$&lt;/span&gt; or even &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+e^{i\alpha}|1\rangle)/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, the meaning of &lt;span class=&quot;math-container&quot;&gt;$|\alpha^\perp\rangle$&lt;/span&gt; is pretty clear: a state that or orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt;. For a qubit that means it has to be (up to a global phase) &lt;span class=&quot;math-container&quot;&gt;$\beta^\star|0\rangle-\alpha^\star|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-09T07:36:10.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9126" PostTypeId="1" CreationDate="2019-12-09T13:30:13.680" Score="3" ViewCount="66" Body="&lt;p&gt;Consider a classical channel &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}$&lt;/span&gt; which takes every input alphabet &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; to output alphabet &lt;span class=&quot;math-container&quot;&gt;$y\in Y$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$P(y|x)_{Y|X}$&lt;/span&gt;. It is stated in many papers that even if the sender and receiver share entangled quantum states (or even no-signalling resources like a Popescu-Rohrlich box), they cannot increase the asymptotic capacity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the proof of this statement?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A half-answer to this question is in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9904023.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this work&lt;/a&gt;, where the authors comment&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;By itself, prior entanglement between sender and receiver confers no&#xA;  ability to transmit classical information, nor can it increase the&#xA;  capacity of a classical channel above what it would have been without&#xA;  the entanglement. This follows from the fact that local manipulation&#xA;  of one of two entangled subsystems cannot influence the expectation of&#xA;  any local observable of the other subsystem&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, this is a little mysterious to me since it is known (&lt;a href=&quot;https://arxiv.org/pdf/0911.5300.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt;) that in other regimes (one shot, zero error, etc.), entanglement between the sender and receiver can be used to boost the capacity of a classical channel. However, all these advantages die away in the case where one uses the channel &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times and &lt;span class=&quot;math-container&quot;&gt;$n\rightarrow\infty$&lt;/span&gt;. Why is this so?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2019-12-09T13:30:13.680" Title="Proof that quantum entanglement does not increase the asymptotic capacity of classical channel" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9127" PostTypeId="1" AcceptedAnswerId="9128" CreationDate="2019-12-09T13:32:26.610" Score="2" ViewCount="83" Body="&lt;p&gt;Say, I have a specific scheme, &#xA;&lt;a href=&quot;https://i.stack.imgur.com/hzCTH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hzCTH.png&quot; alt=&quot;Fourier&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I need to specify inputs for controlled R logical gate, which here is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R(\theta)=\begin{bmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\  &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{\frac{2 \pi i}{2\theta}} &#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that is for the case when the first qbit is the control and the second is the operand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand, how I can do it matrixwise, that is, making a matrix that'd use certain qbit of a register as &lt;strong&gt;control&lt;/strong&gt; line and another as the &lt;strong&gt;resulting&lt;/strong&gt; one, leaving everything else as is. &#xA;I mean, it's okay, if I have a 2 lines where I just put the qregister in the gate and it works. But this is somewhat harder. How should I change the matrix represenation to specify the gate's inputs and outputs?&lt;/p&gt;&#xA;" OwnerUserId="9292" LastActivityDate="2019-12-09T15:53:42.597" Title="How do I apply a controlled gate to specific qbits in the register?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;simulation&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9128" PostTypeId="2" ParentId="9127" CreationDate="2019-12-09T14:18:27.470" Score="1" Body="&lt;p&gt;The action of any controlled gate is to do nothing (i.e. apply the identity operation) if the control qubit is in &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; and apply an operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the target when the control is in &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;. All other qubits in the system are also left untouched (i.e. apply the identity operation). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the subscripts &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; for the control qubit and target qubit. The gate looks like this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ I_1\otimes I_2\otimes... \otimes\vert 0\rangle\langle 0\vert_c \otimes... \otimes\ I_t\ \otimes...\otimes I_n \ \ +\ \ I_1\otimes I_2\otimes... \otimes\vert 1\rangle\langle 1\vert_c \otimes... \otimes\ U_t\ \otimes...\otimes I_n$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In matrix form, this is just&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}1&amp;amp;0\\ 0&amp;amp;1\end{pmatrix}_1\otimes \begin{pmatrix}1 &amp;amp; 0\\ 0&amp;amp;1 \end{pmatrix}_2 \otimes ... \otimes\begin{pmatrix}1 &amp;amp; 0\\ 0&amp;amp;0 \end{pmatrix}_c \otimes ... \otimes\begin{pmatrix}1 &amp;amp; 0\\ 0&amp;amp;1 \end{pmatrix}_t\otimes... \otimes \begin{pmatrix}1 &amp;amp; 0\\ 0&amp;amp;1 \end{pmatrix}_n \\&#xA;+ \begin{pmatrix}1&amp;amp;0\\ 0&amp;amp;1\end{pmatrix}_1\otimes \begin{pmatrix}1 &amp;amp; 0\\ 0&amp;amp;1 \end{pmatrix}_2 \otimes ... \otimes\begin{pmatrix}0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix}_c \otimes ... \otimes\begin{pmatrix}u_{11} &amp;amp; u_{12}\\ u_{21}&amp;amp; u_{22} \end{pmatrix}_t\otimes... \otimes \begin{pmatrix}1 &amp;amp; 0\\ 0&amp;amp;1 \end{pmatrix}_n $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A simple example to help is when you only have two qubits, &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; corresponds to the first qubit and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; corresponds to the second qubit. Then you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ I\otimes \vert 0\rangle\langle 0\vert + U\otimes \vert 1\rangle\langle 1\vert.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix form is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; u_{11} &amp;amp; 0 &amp;amp; u_{12}\\&#xA;0&amp;amp; 0&amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; u_{21} &amp;amp; 0 &amp;amp; u_{22}&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5669" LastEditorUserId="5669" LastEditDate="2019-12-09T15:53:42.597" LastActivityDate="2019-12-09T15:53:42.597" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9129" PostTypeId="1" CreationDate="2019-12-09T15:00:16.727" Score="2" ViewCount="103" Body="&lt;p&gt;I find looking at physical processes through the lens of quantum information science rather interesting. I know of a few applications of it: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;quantum computation;&lt;/li&gt;&#xA;&lt;li&gt;solid state (tensor network approach);&lt;/li&gt;&#xA;&lt;li&gt;cosmology (information exchange with black holes).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Can you provide any other examples? Maybe in high energy physics or even other sciences? &lt;/p&gt;&#xA;" OwnerUserId="9424" LastEditorUserId="55" LastEditDate="2020-08-20T08:05:50.120" LastActivityDate="2020-08-20T08:05:50.120" Title="What are some examples of applications of quantum information to other sciences?" Tags="&lt;applications&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9130" PostTypeId="1" CreationDate="2019-12-09T17:50:22.387" Score="1" ViewCount="85" Body="&lt;p&gt;I am trying to wrap my head around Simon's algorithm and I am trying to solve a question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fK4nI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fK4nI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the solution that I have come up with. Please correct me if I am wrong.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/X0eYk.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X0eYk.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9425" LastActivityDate="2019-12-09T17:50:22.387" Title="Simon's algorithm example" Tags="&lt;simons-algorithm&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2019-12-15T03:10:48.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="9131" PostTypeId="2" ParentId="9119" CreationDate="2019-12-09T17:56:42.040" Score="4" Body="&lt;p&gt;Q# type &lt;code&gt;Result&lt;/code&gt; is represented by C# class &lt;code&gt;Microsoft.Quantum.Simulation.Core.Result&lt;/code&gt;; in particular, it has constants &lt;code&gt;Result.Zero&lt;/code&gt; and &lt;code&gt;Result.One&lt;/code&gt; that you can compare the return of your operation to.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using Microsoft.Quantum.Simulation.Core;&#xA;&#xA;boolOutput = (QuantumOperation.Run(sim).Result == Result.One);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-12-09T17:56:42.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9132" PostTypeId="1" AcceptedAnswerId="9136" CreationDate="2019-12-09T18:21:40.590" Score="0" ViewCount="81" Body="&lt;p&gt;Ok, I understand the difference between quantum bits and classical bits. But, unfortunately, all explanations on the Internet stop at this point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is what I understand that happens:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A particle is rotating randomly;&lt;/li&gt;&#xA;&lt;li&gt;A measurement is made to know the probability of being a 1 or a 0;&lt;/li&gt;&#xA;&lt;li&gt;Using a quantum gate one will know if it is 1 or 0;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But how is this different from a classical calculation? How do they use the &quot;superposition&quot; to make many trials instead of just some?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not get the point were it gets faster than classical computers, once in the end the spin is converted to 1 or 0. &lt;/p&gt;&#xA;" OwnerUserId="9426" LastEditorUserId="55" LastEditDate="2020-11-24T14:21:29.133" LastActivityDate="2020-11-24T14:21:29.133" Title="How do qubits use the &quot;superposition&quot; to make many trials instead of just some?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9133" PostTypeId="1" CreationDate="2019-12-09T20:53:10.307" Score="0" ViewCount="111" Body="&lt;p&gt;I ve beeen trying to use the qiskit package from spyder IDE inisde anaconda (Python version 3.7) but when i try to acces my account I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; runfile('H:/Python Projects/QComputing/account_save.py', wdir='H:/Python Projects/QComputing')&#xA;[{'token': 'MYTOKEN', 'url': 'https://quantumexperience.ng.bluemix.net/api'}]&#xA;&#xA;runfile('H:/Python Projects/QComputing/account_save.py', wdir='H:/Python Projects/QComputing')&#xA;[{'token': 'MYTOKEN', 'url': 'https://quantumexperience.ng.bluemix.net/api'}]&#xA;Traceback (most recent call last):&#xA;&#xA;  File &quot;&amp;lt;ipython-input-5-c4b9a517fa2c&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;&#xA;    runfile('H:/Python Projects/QComputing/account_save.py', wdir='H:/Python Projects/QComputing')&#xA;&#xA;  File &quot;C:\Users\Admin\Anaconda3\envs\QComputing\lib\site-packages\spyder_kernels\customize\spydercustomize.py&quot;, line 827, in runfile&#xA;    execfile(filename, namespace)&#xA;&#xA;  File &quot;C:\Users\Admin\Anaconda3\envs\QComputing\lib\site-packages\spyder_kernels\customize\spydercustomize.py&quot;, line 110, in execfile&#xA;    exec(compile(f.read(), filename, 'exec'), namespace)&#xA;&#xA;  File &quot;H:/Python Projects/QComputing/account_save.py&quot;, line 14, in &amp;lt;module&amp;gt;&#xA;    qsk.IBMQ.load_accounts()&#xA;&#xA;  File &quot;C:\Users\Admin\Anaconda3\envs\QComputing\lib\site-packages\qiskit\providers\ibmq\ibmqprovider.py&quot;, line 199, in load_accounts&#xA;    self._append_account(credentials)&#xA;&#xA;  File &quot;C:\Users\Admin\Anaconda3\envs\QComputing\lib\site-packages\qiskit\providers\ibmq\ibmqprovider.py&quot;, line 279, in _append_account&#xA;    single_provider = IBMQSingleProvider(credentials, self)&#xA;&#xA;  File &quot;C:\Users\Admin\Anaconda3\envs\QComputing\lib\site-packages\qiskit\providers\ibmq\ibmqsingleprovider.py&quot;, line 52, in __init__&#xA;    self._api = self._authenticate(self.credentials)&#xA;&#xA;  File &quot;C:\Users\Admin\Anaconda3\envs\QComputing\lib\site-packages\qiskit\providers\ibmq\ibmqsingleprovider.py&quot;, line 103, in _authenticate&#xA;    .format(ex)) from root_exception&#xA;&#xA;ConnectionError: Couldn't connect to IBMQ server: error during login: Expecting value: line 1 column 1 (char 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I run only the following commands: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as qsk&#xA;print(qsk.IBMQ.stored_accounts())&#xA;qsk.IBMQ.load_accounts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and i have already created an account(with account save command). I have tried closing the antivirus software. Any ideas? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="9428" LastEditorUserId="26" LastEditDate="2019-12-16T18:43:03.513" LastActivityDate="2019-12-16T18:43:03.513" Title="QISKit Connection" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9134" PostTypeId="2" ParentId="9133" CreationDate="2019-12-09T21:46:11.913" Score="1" Body="&lt;p&gt;Try to run this code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;&#xA;IBMQ.save_account('your_api_token')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And for access:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()# without the 's'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9277" LastEditorUserId="9277" LastEditDate="2019-12-09T21:52:56.650" LastActivityDate="2019-12-09T21:52:56.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9135" PostTypeId="1" AcceptedAnswerId="9141" CreationDate="2019-12-09T21:51:18.173" Score="1" ViewCount="188" Body="&lt;p&gt;I know that SWAP2 (swaps 2 qubits) gate looks like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;SWAP2=\begin{bmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\  &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and SWAP3 gate looks like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;SWAP3=\begin{bmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The question is, how do I generate SWAP of N qubits, SWAPN?&lt;br&gt;&#xA;I need this for my Fourier transform algorithm.&lt;/p&gt;&#xA;" OwnerUserId="9292" LastEditorUserId="55" LastEditDate="2019-12-10T16:58:09.477" LastActivityDate="2019-12-10T16:58:09.477" Title="How to generate a SWAP of $N$ qubits?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9136" PostTypeId="2" ParentId="9132" CreationDate="2019-12-09T23:01:59.753" Score="1" Body="&lt;p&gt;&lt;strong&gt;Point 1:&lt;/strong&gt; A qubit (a particle in your words) is not rotated randomly but its rotation depends on gate acting on it. For example Hadamard gate produces a qubit with same probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; while &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is equivalent of classical NOT gate. Sequence of gates rotate qubit as intended for particular calculation. This sequence is callled quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Point 2:&lt;/strong&gt; Yes, measurement is done at the end of every algorithm to get probability distribution of a result. Based on this probability distribution you can infer a final result you are looking for. How to do this depends on particular algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Point 3:&lt;/strong&gt; No, quantum gates are used for calculation, not for measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Difference from classical calculations:&lt;/strong&gt; Quantum computing is based on effects described by a quantum mechanics, so it is inherently probabilistic instead of deterministic. As a result, some algorithm can run faster and more efficient (e.g. Shor algorithm for integer factorization).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Superposition and trials&lt;/strong&gt;: Superposition means that a qubit is in many different states simultaneously until it is measured. To get a probability distribution of those states you have to run algorithm many times to get enough samples for a statistics. You can repeat the algorithm as many times as you want. However, for some algorithms it is enough to run it only once to get desired result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Last question on speed-up:&lt;/strong&gt; The reason for speed-up comes from probabilistic nature of a quantum computer and completely different computing paradigm used in comparison with classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recomend reading this site: &lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/user-guide?section=5dcb2b45330e880045abccb0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/support/guides/user-guide?section=5dcb2b45330e880045abccb0&lt;/a&gt;&#xA;I think it can help you to learn more about quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-09T23:01:59.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9137" PostTypeId="2" ParentId="9120" CreationDate="2019-12-09T23:29:21.387" Score="4" Body="&lt;p&gt;The proof of the variational theorem (the theorem that the ground state energy is the lowest possible energy you can get from &lt;span class=&quot;math-container&quot;&gt;$\frac{\langle \psi|H|\psi\rangle}{  \langle \psi | \psi \rangle}$&lt;/span&gt;) is very simple: &lt;a href=&quot;https://en.wikipedia.org/wiki/Variational_method_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Variational_method_(quantum_mechanics)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you get a lower energy, it means you don't actually have &lt;span class=&quot;math-container&quot;&gt;$\frac{\langle \psi|H|\psi\rangle}{  \langle \psi | \psi \rangle}$&lt;/span&gt;. For example if the quantum hardware doesn't give you &lt;span class=&quot;math-container&quot;&gt;$H|\psi\rangle$&lt;/span&gt; but instead gives you &lt;span class=&quot;math-container&quot;&gt;$H|\psi\rangle + \epsilon |\psi\rangle $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is some non-zero error, then when you plug everything into the proof of the variational theorem you may find that you are no longer guaranteed to always get energies equal to or higher than the ground state energy.&lt;/p&gt;&#xA;" OwnerUserId="9429" LastActivityDate="2019-12-09T23:29:21.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9138" PostTypeId="2" ParentId="8972" CreationDate="2019-12-09T23:44:07.440" Score="2" Body="&lt;p&gt;You are probably using Python 3.8. Qiskit only works with Python 3.5, 3.6 and 3.7 - &lt;a href=&quot;https://pypi.org/project/qiskit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here for details&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In most cases using Python 3.7 is enough, but if you get another error: &lt;code&gt;TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType&lt;/code&gt; you can try the below part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After downgrading to Python 3.7.3 and pip 19.1.1 it still gave an error - it could not resolve a path to VC++ 2017 Redistributable for &lt;code&gt;fastdtw&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me it worked to hack it like this:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find where you have instaleed &lt;code&gt;vcruntime140.dll&lt;/code&gt;. I found a copy in &lt;code&gt;%USERPROFILE%\Anaconda3\envs\&amp;lt;&amp;lt;environment_name&amp;gt;&amp;gt;\vcruntime140.dll&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Open the file &lt;code&gt;%USERPROFILE%\Anaconda3\envs\&amp;lt;&amp;lt;environment_name&amp;gt;&amp;gt;\Lib\site-packages\setuptools\msvc.py&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Edit the function &lt;code&gt;def VCRuntimeRedist(self)&lt;/code&gt; to return the path to &lt;code&gt;vcruntime140.dll&lt;/code&gt; (don't forget to escape the &lt;code&gt;\&lt;/code&gt;s)&lt;/li&gt;&#xA;&lt;li&gt;run &lt;code&gt;pip install qiskit&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="7759" LastEditDate="2020-01-05T19:28:30.777" LastActivityDate="2020-01-05T19:28:30.777" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9139" PostTypeId="2" ParentId="9135" CreationDate="2019-12-10T07:13:06.093" Score="6" Body="&lt;p&gt;Depends on what you mean by SWAPN, that is what qubits are swapped. Your SWAP3 gate in Dirac notation is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle\langle 000|+|001\rangle\langle100|+|010\rangle\langle010|+|011\rangle\langle110|+|100\rangle\langle001|+|101\rangle\langle101|+|110\rangle\langle011|+|111\rangle\langle111|$$&lt;/span&gt;&#xA;that is the first and third qubits are swapped; assuming SWAPN means swapping first and N-th qubit, write SWAPN in Dirac notation and then convert it to matrix notation. &lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-10T07:13:06.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9141" PostTypeId="2" ParentId="9135" CreationDate="2019-12-10T09:00:43.933" Score="2" Body="&lt;p&gt;&quot;SWAPN&quot; isn't something that would be universally understood. But you say you want it for your Fourier Transform algorithm, so by that, I interpret that what you want is: SWAP2(1,N).SWAP2(2,N-1).SWAP2(3,N-2)...., i.e. the pairwise swap between opposite qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It depends on context as to what it is you &lt;em&gt;actually&lt;/em&gt; want to write down. For implementing in some sort of quantum circuit, the decompostion into pairwise swaps, as I've just given it, is probably ideal. Your question seems to imply that you want a matrix. In which case,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAPN}=\sum_{x\in\{0,1\}^N}|x\rangle\langle x^R|,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$x^R$&lt;/span&gt; is just the bit string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, reversed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, there is a reason why you rarely see the swap gates explicitly written out at the end of the Fourier transform: they're rarely necessary. In many algorithms, you simply measure the qubits at the end. It's much easier to reorder the classical values of the outcomes after the measurement than the quantum state before the measurement. Even if you're not measuring, you're typically doing a sequence like: inverse Fourier transform - diagonal operator - Fourier transform (for example, HHL algorithm). So, you can get rid of the swaps at the end of the IQFT and the start of the QFT by cancelling them and just reordering the elements of the diagonal operator. Since this is usually associated with some sort of classical calculation, it's easily incorporated there.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-10T09:00:43.933" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9142" PostTypeId="2" ParentId="9122" CreationDate="2019-12-10T09:10:08.267" Score="2" Body="&lt;p&gt;With further understanding coming from the expanded question, I'm entirely revising my answer, but the original version is kept below in case it's useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The point, clearly, is to show how to simulate a probabilistic classical computation. So, we will store a classical distribution by using a diagonal density matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_ip_i|i\rangle\langle i|.&#xA;$$&lt;/span&gt;&#xA;For any stochastic matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S=\sum_{i,j}s_{ij}|i\rangle\langle j|,&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\sum_is_{ij}=1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, we want to be able to create a new distribution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho'=\sum_jq_j|j\rangle\langle j|&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$q_j=\sum_ip_is_{ji}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can do this by introducing two ancillas each of dimension &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (note, this is a diversion from what the question asked), initially in state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and by applying a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that acts as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|i\rangle|0\rangle|0\rangle=\sum_{j}\sqrt{s_{ji}}|j\rangle|i\rangle|j\rangle.&#xA;$$&lt;/span&gt;&#xA;It should be obvious that the state is correctly normalised, and that different values of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; yield orthogonal states, which are the necessary conditions for being able to define such a unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the unitary, we evolve&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\rightarrow U\rho U^\dagger=\sum_{i,j,k}p_i\sqrt{s_{ji}s_{ki}}|j\rangle\langle k|\otimes |i\rangle\langle i|\otimes |j\rangle\langle k|.&#xA;$$&lt;/span&gt;&#xA;If we trace out the two ancillas (equivalently, measure and forget), this forces &lt;span class=&quot;math-container&quot;&gt;$j=k$&lt;/span&gt;, and we get the answer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i,j}p_is_{ji}|j\rangle\langle j|,&#xA;$$&lt;/span&gt;&#xA;as desired.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I've not entirely understood how you're trying to argue this, so let me convey how I would go about answering it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine your system is in a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. You want to implement a classical probabilistic transformation on it, which I would interpret as meaning &quot;with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, implement the unitary &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=0,1,\ldots M-1$&lt;/span&gt;.&quot;. We do this by introducing an &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;-level ancilla, initially in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. I'm now going to describe a two-step process (although these two steps should be combined). First, implement a unitary on the ancilla that performs the conversion&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\rightarrow\sum_{i=0}^{M-1}\sqrt{p_i}|i\rangle.&#xA;$$&lt;/span&gt;&#xA;Second, implement the unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=0}^{M-1}|i\rangle\langle i|\otimes U_i,&#xA;$$&lt;/span&gt;&#xA;where the ancilla is the control and the original system is the target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we now measure the ancilla system, we get answer &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, and the original system is in the state &lt;span class=&quot;math-container&quot;&gt;$U_i\rho U_i^\dagger$&lt;/span&gt;. Hence, if we forget the measurement result, we would have to describe the whole thing as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i p_iU_i\rho U_i^\dagger,&#xA;$$&lt;/span&gt;&#xA;which has had the unitaries &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; applied according to a classical probability distribution. If you select the unitaries to be permutation matrices, that describes classical probabilistic transitions, if I'm understanding the term as intended.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-12-11T10:41:48.570" LastActivityDate="2019-12-11T10:41:48.570" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9143" PostTypeId="1" CreationDate="2019-12-10T10:03:06.460" Score="3" ViewCount="136" Body="&lt;p&gt;I saw that qiskit was just incorporated in a trapped ion device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I transpiled my circuit to 2 backends: ibm superconducting device and aqt trapped ion device.&#xA;I noticed that for ibm, the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is transpiled into &lt;span class=&quot;math-container&quot;&gt;$U_3(\pi,0,\pi)$&lt;/span&gt;, whereas for aqt it is &lt;span class=&quot;math-container&quot;&gt;$R_x(-\pi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since both objectives of them are to take &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, why do they use a different quantum gate to do that?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, for the aqt device, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate &lt;span class=&quot;math-container&quot;&gt;$= R_y(\pi/2)R_x(\pi)$&lt;/span&gt;.&#xA;I was wondering, why are the two representations equal?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2019-12-10T17:01:33.920" LastActivityDate="2020-05-15T04:57:27.810" Title="Why can different technology transpile the quantum gate to different representations?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9145" PostTypeId="2" ParentId="9123" CreationDate="2019-12-10T22:05:48.410" Score="1" Body="&lt;p&gt;I am afraid that under current state of development, quantum computers cannot be massively deployed in finance industry. However, the area is developing rapidly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find some overview of possible quantum computers application in finance here: &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S2405428318300571&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/science/article/pii/S2405428318300571&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-10T22:05:48.410" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9147" PostTypeId="1" AcceptedAnswerId="9151" CreationDate="2019-12-10T22:44:50.530" Score="5" ViewCount="212" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Purity_(quantum_mechanics)&quot; rel=&quot;noreferrer&quot;&gt;purity of a state&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\tr}{\operatorname{Tr}}\tr(\rho^2)$&lt;/span&gt;, which is known to equal &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another quantity that can be used to quantify how close a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is to be pure is its &lt;a href=&quot;https://en.wikipedia.org/wiki/Rank_(linear_algebra)&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;rank&lt;/em&gt;&lt;/a&gt;. This equals the number of nonzero eigenvalues in the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, or equivalently, the minimum number of pure states that need to be mixed to obtain &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;Again, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure &lt;em&gt;iff&lt;/em&gt; its matrix rank is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider now two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. Their having the same rank clearly does not imply that they have the same purity. A trivial example of this is given by &lt;span class=&quot;math-container&quot;&gt;$\rho=I/2$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma=(1/2-\epsilon)|0\rangle\!\langle0| + (1/2+\epsilon)|1\rangle\!\langle 1|,$$&lt;/span&gt;&#xA;for small enough &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is however less trivial to see whether &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; having the same purity implies their having the same rank. If these were generic matrices, it would not be true, but it might hold for unit-trace Hermitian operators. Is this the case?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can see that it is for two-dimensional matrices: if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; have same purity, that means that &lt;span class=&quot;math-container&quot;&gt;$p^2+(1-p)^2=q^2 + (1-q)^2$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; one of the two eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, respectively. But in this case &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; having different rank means that one of the two (say &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;) has full-rank while the other one has rank &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. This would mean that &lt;span class=&quot;math-container&quot;&gt;$q=1$&lt;/span&gt; (or, equivalently, &lt;span class=&quot;math-container&quot;&gt;$q=0$&lt;/span&gt;), while &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;p&amp;lt;1$&lt;/span&gt;. But then the condition on the purity would become &lt;span class=&quot;math-container&quot;&gt;$p^2+(1-p)^2=1$&lt;/span&gt;, which clearly cannot be satisfied for &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;p&amp;lt;1$&lt;/span&gt; (a nice geometrical way to see it is that the solutions of this equation are the intersection of the unit circle in 2D and the line &lt;span class=&quot;math-container&quot;&gt;$x+y=1$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What about the more general case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-12-11T15:39:45.063" Title="Do states with the same purity always have the same rank?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9148" PostTypeId="2" ParentId="9132" CreationDate="2019-12-10T22:48:34.220" Score="0" Body="&lt;p&gt;Quantum computing is a different paradigm than classical computing. Data exists as probabilities that one amplifies with repeated operations until the value of the solution emerges. The static data values of classical computing is not assumed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Though I am working on a method to encode information with qubits that has similar properties to a classically encoded information. Reducing the noise in a computation should simplify programming.&lt;/p&gt;&#xA;" OwnerUserId="9414" LastActivityDate="2019-12-10T22:48:34.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9149" PostTypeId="2" ParentId="9129" CreationDate="2019-12-10T22:55:47.070" Score="2" Body="&lt;p&gt;You can model just about any physical or information system with a quantum computer. But you need to ask yourself (1) if the system demands enough computational power (processors) to justify the extra cost, (2) whether the problem solution is reasonable to receive per the delays inherent in sharing a scarce resource (time), and (3) whether your budget permits using a quantum computer (dollars).&lt;/p&gt;&#xA;" OwnerUserId="9414" LastActivityDate="2019-12-10T22:55:47.070" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9150" PostTypeId="1" CreationDate="2019-12-11T01:00:57.923" Score="0" ViewCount="85" Body="&lt;p&gt;I am just new to the concepts of entanglement entropy and how it is used to measure the entanglement in systems. I want to know the role of entanglement entropy in quantum information, in general.&lt;/p&gt;&#xA;" OwnerUserId="8817" LastEditorUserId="55" LastEditDate="2020-11-22T16:58:06.173" LastActivityDate="2020-11-22T16:58:06.173" Title="Entanglement entropy's role in quantum information" Tags="&lt;entanglement&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9151" PostTypeId="2" ParentId="9147" CreationDate="2019-12-11T01:09:57.377" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \begin{pmatrix}&#xA;a &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1-a &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix}\\&#xA;\sigma = \begin{pmatrix}&#xA;b &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; c &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1-b-c\\&#xA;\end{pmatrix}\\&#xA;Tr (\rho^2 ) = 2 a^2 - 2a + 1\\&#xA;Tr (\sigma^2 ) = b^2 + c^2 + (1-b-c)^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's pick &lt;span class=&quot;math-container&quot;&gt;$a=1/2$&lt;/span&gt; so &lt;span class=&quot;math-container&quot;&gt;$2a^2-2a+1=\frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;b=\frac{2}{3}\\&#xA;c=\frac{1}{6}\\&#xA;1-b-c=\frac{1}{6}\\&#xA;Tr (\sigma^2) = \frac{4}{9} + \frac{1}{36} + \frac{1}{36}\\&#xA;= \frac{16}{36} + \frac{1}{36} + \frac{1}{36}\\&#xA;= \frac{1}{2}\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2019-12-11T01:09:57.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9152" PostTypeId="1" CreationDate="2019-12-11T02:05:55.587" Score="0" ViewCount="58" Body="&lt;p&gt;So I have the following code&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qgan = QGAN(real_data, bounds, num_qubits, batch_size, num_epochs, snapshot_dir=None)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with num qubits being defined as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;num_qubits = [2, 2]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it is outputting the following error on the qgan line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;operands could not be broadcast together with shapes (9,) (2,)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect this is due to the fact that it is currently configured to handle a 2 dimensional data set with two columns but I am attempting to feed a 2 dimensional data set with 9 columns. How do I allow the qgan to support 9 columns?&lt;/p&gt;&#xA;" OwnerUserId="9444" LastEditorUserId="55" LastEditDate="2020-11-22T16:57:54.260" LastActivityDate="2020-11-22T16:57:54.260" Title="Number of columns mismatch" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9153" PostTypeId="1" AcceptedAnswerId="9155" CreationDate="2019-12-11T10:23:23.037" Score="3" ViewCount="70" Body="&lt;p&gt;So this might be a dumb question, but I have trouble finding any information on the physical aspect of quantum computers. &#xA;Online you can find only pictures of big bulky things said to be quantum computers and searching for quantum circuits only results in descriptions of equations for quantum operations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want to know is what is the quantum version of classical PCBs, are they also made on silicon wafers or is it a different material and method altogether?&lt;/p&gt;&#xA;" OwnerUserId="9448" LastEditorUserId="26" LastEditDate="2019-12-15T13:41:03.160" LastActivityDate="2019-12-15T13:41:03.160" Title="How are physical quantum chips made?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9154" PostTypeId="1" AcceptedAnswerId="9241" CreationDate="2019-12-11T10:47:19.377" Score="3" ViewCount="112" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://arxiv.org/abs/1909.05820&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1909.05820&lt;/a&gt; the authors introduce several Hamiltonians. For example they define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_G = A^\dagger \left( \mathbb{I} - \vert b \rangle \langle b \vert \right) A&#xA;$$&lt;/span&gt;&#xA;in equation (4), where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a complex-weighted sum of unitary matrices and &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; a quantum state prepared with the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (that will appear later in the question): &lt;span class=&quot;math-container&quot;&gt;$U\vert 0 \rangle = \vert b \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This Hamiltonian is depicted as the &quot;global&quot; Hamiltonian and is defined such as its expectation value when the system is in the state &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle x \vert H \vert x \rangle = \langle x \vert \left[ A^\dagger \left( \mathbb{I} - \vert b \rangle \langle b \vert \right) A \right]\vert x \rangle = \langle \psi \vert \left( \mathbb{I} - \vert b \rangle \langle b \vert \right) \vert \psi \rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle = A \vert x \rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I may be wrong, but I think this expectation value can be interpreted as the &quot;part&quot; of &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; that is in the subspace orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors also define a &quot;local&quot; Hamiltonian:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_L = A^\dagger U \left( \mathbb{I} - \frac{1}{n} \sum_{j=1}^n \vert 0_j \rangle \langle 0_j \vert \otimes \mathbb{I}_{\bar{j}} \right) U^\dagger A&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary matrix &quot;preparing&quot; &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_\bar{j}$&lt;/span&gt; is the identity operation on all qubits except the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: is there a interpretation of the formula for &lt;span class=&quot;math-container&quot;&gt;$H_L$&lt;/span&gt; as I wrote above for &lt;span class=&quot;math-container&quot;&gt;$H_G$&lt;/span&gt;? I particularly need help for the interpretation of the sum, I would tend to say it is a projection on all the states that have their &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th qubit in the &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; state, but I am not sure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: after more research, &lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_vqls.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this notebook&lt;/a&gt; gave me a re-formulation of one of the terms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{n} \sum_{j=1}^n \vert 0_j \rangle \langle 0_j \vert \otimes \mathbb{I}_\bar{j} = P = \frac{1}{2} \left( \mathbb{I} + \frac{1}{n}\sum_{j=1}^n Z_j \right)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Z_j$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; Pauli matrix applied to the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th qubit, qubit indexes starting with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;NOTE: the question is open, i.e. a possible answer could be &quot;I am pretty sure there is no easy interpretation of that thing&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2019-12-11T15:04:35.430" LastActivityDate="2019-12-17T14:59:36.087" Title="Interpretation of specific Hamiltonian operator" Tags="&lt;mathematics&gt;&lt;notation&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9155" PostTypeId="2" ParentId="9153" CreationDate="2019-12-11T10:53:58.373" Score="3" Body="&lt;p&gt;It depends on the architecture. Superconducting quantum  chips (currently the most popular architecture) are indeed fabricated on Silicon wafers. There's a nice schematic in &lt;a href=&quot;https://arxiv.org/abs/1901.08042&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1901.08042&lt;/a&gt;. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/NrDlj.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NrDlj.jpg&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-12-11T10:53:58.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9156" PostTypeId="1" CreationDate="2019-12-11T11:10:58.097" Score="-2" ViewCount="48" Body="&lt;p&gt;I want to know what happens to the time complexity in terms of big O analysis &lt;/p&gt;&#xA;" OwnerUserId="9449" LastActivityDate="2019-12-11T11:18:06.597" Title="How does number of shots (number of times the computation is repeated) affects time complexity" Tags="&lt;ibm-q-experience&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2019-12-15T03:10:24.797" ContentLicense="CC BY-SA 4.0" />
  <row Id="9157" PostTypeId="2" ParentId="9156" CreationDate="2019-12-11T11:18:06.597" Score="3" Body="&lt;p&gt;Number of shots tells you how many times you repeat algorithm run. It is not connected with a complexity of algorithm itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Running time of simulation depends on number of shots linearly, so something what you can call &quot;total complexity&quot; is given by complexity of an algorithm multiplied by number of shots.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-11T11:18:06.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9159" PostTypeId="2" ParentId="9147" CreationDate="2019-12-11T14:26:48.713" Score="4" Body="&lt;p&gt;The &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9151/55&quot;&gt;other answer&lt;/a&gt; already gave a counterexample.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From a geometrical point of view, the question is about the intersection of hyperplanes with hyperspheres. Indeed, the purity of a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$(p_i)_i$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i^2=\|\boldsymbol p\|^2$&lt;/span&gt;, whereas these are probabilities and therefore also constrained by &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The set of probabilities for states of purity &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt; is therefore given by the intersection between the hypersphere with radius &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, and the hyperplane &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i=1$&lt;/span&gt; (with the additional constraint that &lt;span class=&quot;math-container&quot;&gt;$0\le p_i\le 1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;).&#xA;Let us denote the hyperplane &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i=1$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; dimensions as &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt;, and with &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_N(r)\subseteq\mathbb R^N$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$(N-1)$&lt;/span&gt;-sphere with radius &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.&#xA;Fixing &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, there are states with purity &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and rank &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; whenever &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_r(C)$&lt;/span&gt; intersects &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt;. This doesn't happen for all values of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. For example, for the smallest possible purity, &lt;span class=&quot;math-container&quot;&gt;$C^2=1/N$&lt;/span&gt;, there is a single point of intersection between &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_N(C)$&lt;/span&gt;, and no smaller-dimensional hypersphere of radius &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; intersects &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a visualisation of this for &lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt;, showing &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_3(2/3)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/AaMyB.png&quot; width=&quot;400&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see from this that for the purity &lt;span class=&quot;math-container&quot;&gt;$C^2=(2/3)^2$&lt;/span&gt;, we cannot have states with rank smaller than &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;. Indeed, we can go further and say that states with rank &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;3$&lt;/span&gt; are only possible when the purity &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt; is greater than or equal to &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; (consistently with AHusain's answer).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generalising this, we find that states with rank &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and purity &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt; exist whenever &lt;span class=&quot;math-container&quot;&gt;$C^2\ge1/r$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get two states with the same purity and different rank in dimension &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, it is therefore sufficient to choose a purity &lt;span class=&quot;math-container&quot;&gt;$C^2\in[1/2,1)$&lt;/span&gt;. To find a rank-&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; probability vector &lt;span class=&quot;math-container&quot;&gt;$(p,1-p)$&lt;/span&gt; with this purity we then need to solve &lt;span class=&quot;math-container&quot;&gt;$p^2+(1-p)^2=C^2$&lt;/span&gt;, which has solutions &lt;span class=&quot;math-container&quot;&gt;$2p=1\pm \sqrt{2C^2-1}$&lt;/span&gt;. Note how this has solutions in &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt; only for &lt;span class=&quot;math-container&quot;&gt;$C^2\in [1/2,1]$&lt;/span&gt;. We then need to only take another point in the intersection &lt;span class=&quot;math-container&quot;&gt;$S_3(C)\cap \mathcal P_3$&lt;/span&gt; that does not sit on one the planes &lt;span class=&quot;math-container&quot;&gt;$p_1=0,p_2=0,p_3=0$&lt;/span&gt;, and we get an example of a rank-3 state with same purity as a rank-2 one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally speaking, I think the important observation is that, while states with the same purity all sit at the same distance from the origin of probability space, the distance from the origin of the hyperplanes &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_N$&lt;/span&gt; ranges from &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt N$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. It is therefore clear that if we are looking for states with purity &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt;, these must have distance &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; from the origin, and therefore cannot also sit on a plane &lt;span class=&quot;math-container&quot;&gt;$\mathcal P_n$&lt;/span&gt; (i.e. correspond to states with rank &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) unless &lt;span class=&quot;math-container&quot;&gt;$C\ge 1/\sqrt n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-12-11T15:39:45.063" LastActivityDate="2019-12-11T15:39:45.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9161" PostTypeId="1" AcceptedAnswerId="9162" CreationDate="2019-12-11T15:24:06.443" Score="3" ViewCount="1138" Body="&lt;p&gt;when I tried to execute task in &quot;Jupiter notebook&quot; in the IBM Q experience (the browser), &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend=IBMQ.get_backend(name ='ibmqx2')&#xA;job4Cal=execute(qc,backend,shots=8192)&#xA;job_monitor(job8Cal, monitor_async=True)&#xA;&#xA;Calresult = job4Cal.result()&#xA;job8Cal.job_id()&#xA;&#xA;counts=Calresult.get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and I got the message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-4-2bc4021cab83&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 backend=IBMQ.get_backend(name ='ibmqx2')&#xA;      2 job4Cal=execute(qc,backend,shots=8192)&#xA;      3     #job_monitor(job8Cal, monitor_async=True)&#xA;      4 &#xA;      5 Calresult = job4Cal.result()&#xA;&#xA;AttributeError: 'IBMQFactory' object has no attribute 'get_backend&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How to fix this problem\error?&lt;/p&gt;&#xA;" OwnerUserId="4524" LastActivityDate="2019-12-11T15:31:50.513" Title="How to fix an error: AttributeError: 'IBMQFactory' object has no attribute 'get_backend'" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9162" PostTypeId="2" ParentId="9161" CreationDate="2019-12-11T15:31:50.513" Score="9" Body="&lt;p&gt;The IBMQ provider has been updated so that you now have to retrieve a provider before you can get a backend. This can be done like this :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_provider = IBMQ.get_provider()&#xA;my_backend  = my_provider.get_backend('ibmq_qasm_simulator')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You may also need to update your credentials, which can be done using &lt;code&gt;IBMQ.update_account()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information please see the &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider&quot; rel=&quot;noreferrer&quot;&gt;README&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-11T15:31:50.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9163" PostTypeId="1" CreationDate="2019-12-11T15:55:59.153" Score="1" ViewCount="40" Body="&lt;p&gt;Although the architecture of a quantum computer depends on the implemented qubit system, I still wonder what the general structure of hardware parts would be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evidently, a quantum computer isn't merely comprised of qubits, so probably multiple devices must be required to realize the existence of a physical quantum computer. Which devices would that be and what is the pertaining purpose of each component. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case certain helpful sources are available for finding such data, I would gladly like to receive a reference then. A schematic or primitive blueprint would also be highly appreciated. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance. &lt;/p&gt;&#xA;" OwnerUserId="9313" LastActivityDate="2019-12-11T15:55:59.153" Title="What are the general hardware components of a universal quantum gate computer?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9164" PostTypeId="2" ParentId="9122" CreationDate="2019-12-11T16:44:01.693" Score="0" Body="&lt;p&gt;Suppose you want to obtain a transition matrix sending &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; inputs into &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can then start with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; orthonormal vectors of length &lt;span class=&quot;math-container&quot;&gt;$MK$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; the dimension of the ancillary space (note that you can always think of such an orthonormal set of vectors as a subset of columns of some larger unitary matrix, like it is done in the question).&#xA;Denote the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th such vector with &lt;span class=&quot;math-container&quot;&gt;$v^{(n)}$&lt;/span&gt;, whose components are written as &lt;span class=&quot;math-container&quot;&gt;$v^{(n)}_{mk}$&lt;/span&gt;, where indexes the different outputs and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is a coordinate in the ancillary space (in the original post we have &lt;span class=&quot;math-container&quot;&gt;$N=M=K=2$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the transition matrix &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$M\times N$&lt;/span&gt; matrix defined elementwise by &lt;span class=&quot;math-container&quot;&gt;$S_{mn}=\sum_{k=1}^K |v^{(n)}_{mk}|^2$&lt;/span&gt;.&#xA;The columns of this matrix always sum up to one, but the rows only do when &lt;span class=&quot;math-container&quot;&gt;$N=MK$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-12-12T09:04:35.067" LastActivityDate="2019-12-12T09:04:35.067" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9165" PostTypeId="1" AcceptedAnswerId="9166" CreationDate="2019-12-11T16:51:04.897" Score="5" ViewCount="75" Body="&lt;p&gt;I've been working through Grovers algorithm. I've read many times that &lt;span class=&quot;math-container&quot;&gt;$*^1H^{\otimes n}(2|0\rangle \langle0| - \mathcal{I})H^{\otimes n}$&lt;/span&gt;  is equivalent to &lt;span class=&quot;math-container&quot;&gt;$*^22|\psi\rangle \langle\psi| - \mathcal{I}$&lt;/span&gt;. I did verify that &lt;span class=&quot;math-container&quot;&gt;$*^2$&lt;/span&gt; turns &lt;span class=&quot;math-container&quot;&gt;$\sum_x \alpha_x |x\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\sum_x(-\alpha_x+2\bar\alpha)$&lt;/span&gt; but could not do the step before that of getting from &lt;span class=&quot;math-container&quot;&gt;$*^1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$*^2$&lt;/span&gt; and I haven't seen that explained anywhere where this operation is discussed. I'd be grateful for a hint on how to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to calculate &lt;span class=&quot;math-container&quot;&gt;$(H^{\otimes n}(2|0\rangle \langle0| - \mathcal{I})H^{\otimes n})(\sum_x \alpha_x |x\rangle)$&lt;/span&gt; but only got to &lt;span class=&quot;math-container&quot;&gt;$\sum_x \alpha_x (\frac{1}{N} \sum_y \sum_z (-1)^{x\cdot y+y\cdot z+\delta_{y0}})|x\rangle$&lt;/span&gt; and didn't come up with any simplifications for that expression.&lt;/p&gt;&#xA;" OwnerUserId="9450" LastEditorUserId="26" LastEditDate="2019-12-21T15:15:18.137" LastActivityDate="2019-12-21T15:15:18.137" Title="Why, in Grover's algorithm, $H^{\otimes n}(2|0\rangle\! \langle0| - \mathcal{I})H^{\otimes n}=2|\psi\rangle \!\langle\psi| - \mathcal{I}$?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9166" PostTypeId="2" ParentId="9165" CreationDate="2019-12-11T17:10:24.447" Score="4" Body="&lt;p&gt;If you just multiply out your first equation, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2H^{\otimes n}|0\rangle\langle 0|H^{\otimes n}-H^{\otimes n}IH^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;If we write &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=H^{\otimes n}|0\rangle$&lt;/span&gt;, then this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2|\psi\rangle\langle \psi|-H^{\otimes n}IH^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$IH^{\otimes n}=H^{\otimes n}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}H^{\otimes n}=I$&lt;/span&gt;, this just returns your second equation,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2|\psi\rangle\langle \psi|-I.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-11T17:10:24.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9167" PostTypeId="2" ParentId="9143" CreationDate="2019-12-11T18:17:52.920" Score="4" Body="&lt;p&gt;A particular gate's implementation is intrinsically tied to the underlying architecture. A U3 gate on IBM's superconducting backends is just a combination of 3 rotations alternatively around just two axes (for example rotate around X-axis, then Y-axis and then again X-axis; there are several other combinations to choose from). In fact this is the most general way in which you could take one point on a bloch sphere to any other point on it. In essence, that's what a U3 gate's signature means.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to answer why this implementation of rotation varies on different backengs, here are my thoughts: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We'd like to keep the noise minimal while making any of those rotations. You might want to read more about how a Z gate is implemented on IBM's superconducting systems (It's virtually free of any noise). I'm not so well-wersed with Trapped-Ion device's transpiled code so can't comment on it's optimality. &lt;/li&gt;&#xA;&lt;li&gt;I believe it could also have something to do with keeping gate abstractions intuitive enough for programmers which might give rise to different signatures for different backends. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8852" LastActivityDate="2019-12-11T18:17:52.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9168" PostTypeId="1" AcceptedAnswerId="9169" CreationDate="2019-12-11T18:54:15.553" Score="3" ViewCount="684" Body="&lt;p&gt;Not sure if this is a stupid question, but can quantum chips be spied on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I heard that quantum particles(?) can be &quot;entangled&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So is it possible that a chip manufacturer (who wishes to spy) can pretty much entangle all the particles on the chip so that what ever processing goes on inside that chip is mirrored miles away by the spy manufacturer?&lt;/p&gt;&#xA;" OwnerUserId="9454" LastEditorUserId="26" LastEditDate="2019-12-13T18:31:48.393" LastActivityDate="2020-05-09T18:02:10.797" Title="Can quantum chips be spied on?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9169" PostTypeId="2" ParentId="9168" CreationDate="2019-12-11T19:15:14.150" Score="7" Body="&lt;p&gt;Quantum states are highly unstable and subject to noise, so with current levels of technology it is unlikely that this entanglement would last for any useful amount of time. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let's assume that you have two entangled fault-tolerant qubits (one owned by a malicious manufacturer), and that they are in superposition (in the Z-basis):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}} (|01\rangle + |10\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the first qubit is owned by the manufacturer. These are perfectly anti-correlated, meaning that a measurement of 0 on the first qubit causes the second to be measured as 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This may seem promising if you are a nefarious manufacturer; however the moment the user mesures their qubit, they collapse the superposition and the two qubits are no longer entangled, you have two separated states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the user's computer and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in the manufacturers. You cannot bring them back into superposition without some interaction between the two qubits again.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum computations are repeated many times to get the expected value. With this scheme you get only one of the (probably millions of) repeats.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And as @Sanchayan Dutta mentions, the choice of basis is important (this is what we communicate classically in teleportation), if the user were to rotate their measurement basis randomly before performing the measurement, the manufacturer would be unaware of this. The manufacturer's qubit would be in an eigenstate of the basis, but if they then chose to measure using the Z basis, it would collapse into an eigenstate of that basis.&lt;/p&gt;&#xA;" OwnerUserId="9453" LastEditorUserId="9453" LastEditDate="2019-12-11T19:22:58.507" LastActivityDate="2019-12-11T19:22:58.507" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9170" PostTypeId="1" CreationDate="2019-12-11T19:22:52.533" Score="-1" ViewCount="62" Body="&lt;p&gt;So, I'm really trying my best to understand how &lt;strong&gt;quantum computers&lt;/strong&gt; work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how I think they work:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is a set of &lt;strong&gt;qubits&lt;/strong&gt;;&lt;/li&gt;&#xA;&lt;li&gt;Then an &lt;strong&gt;algorithm&lt;/strong&gt; is put in action by the use of &lt;strong&gt;quantum gates&lt;/strong&gt; that &lt;strong&gt;entangle&lt;/strong&gt; these qubits and &lt;strong&gt;rotate&lt;/strong&gt; them in a way to produce &lt;strong&gt;equal probabilities&lt;/strong&gt; for each case (like for example in a &lt;strong&gt;big list of items&lt;/strong&gt;);&lt;/li&gt;&#xA;&lt;li&gt;At this moment the way I visualize things is like a &lt;strong&gt;series of ball spheres&lt;/strong&gt; that &lt;strong&gt;individually&lt;/strong&gt; act as layers that have some information relative to each case, but &lt;strong&gt;combined&lt;/strong&gt; they are like a &lt;strong&gt;single ball sphere&lt;/strong&gt; that has &lt;strong&gt;more information on it&lt;/strong&gt; (something like &lt;strong&gt;photoshop layers&lt;/strong&gt;, but in 3d);&lt;/li&gt;&#xA;&lt;li&gt;Until this point everything seems like something that I could build in a &lt;strong&gt;classic computer&lt;/strong&gt;, the difference is that in everything I read it is told to me that &lt;strong&gt;quantum computers&lt;/strong&gt; do not go through &lt;strong&gt;all of the possibilities&lt;/strong&gt;, but &lt;strong&gt;only some&lt;/strong&gt;, as they are &lt;strong&gt;probabilistic&lt;/strong&gt;. Ok, but if the &lt;strong&gt;probabilities&lt;/strong&gt; start by being equal to each case, how can one find the &lt;strong&gt;right cases&lt;/strong&gt;?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;I read that it is by the use of &lt;em&gt;phase&lt;/em&gt; and &lt;em&gt;interference&lt;/em&gt;, and this is where there is &lt;em&gt;lack of information&lt;/em&gt; and where I stop to understand &lt;em&gt;how quantum computers work&lt;/em&gt;&lt;/strong&gt;;&lt;/li&gt;&#xA;&lt;li&gt;And then, in the end, &lt;strong&gt;qubits are collapsed so we get actual values in ones and zeros&lt;/strong&gt; coming from &lt;strong&gt;those previous probabilities&lt;/strong&gt;;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Please, try to explain with simple terms and examples like I just did, more than this will be like what's out there, complicated and not useful, or to simple and repetitive.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's about time someone explains quantum computing in simple ways. Why complicate what's not so complicated? If one is unable to explain how things work, and sometimes people actually working on the field, how can this technology progress? Still, I will appreciate any efforts to help me understand this technology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to use formulas and functions go ahead, but please, completely explain what they do...&lt;/p&gt;&#xA;" OwnerUserId="9426" LastActivityDate="2019-12-11T22:19:40.450" Title="What is the diference between classic probabilities and quantum probabilities?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2019-12-12T00:12:13.703" ContentLicense="CC BY-SA 4.0" />
  <row Id="9171" PostTypeId="2" ParentId="9170" CreationDate="2019-12-11T21:46:10.453" Score="1" Body="&lt;p&gt;It is not very easy to explain how a quantum computer works. Your question is very broad. It can take even whole book to explain everything you want to know clearly, so this forum is probably not the best place to do so.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend reading this book: &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/B07GPRBYVC&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hidden In Plain Sight 10: How To Program A Quantum Computer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am self learner in quantum computing and this book helped me much to understand basics. It cost only $1.2 in Kindle format.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2019-12-11T22:19:40.450" LastActivityDate="2019-12-11T22:19:40.450" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9172" PostTypeId="1" AcceptedAnswerId="9191" CreationDate="2019-12-12T06:16:06.273" Score="3" ViewCount="158" Body="&lt;p&gt;I do not understand the error correction process that uses quantum codes for amplitude damping channel. I will take three bit-flip code for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The logical state of a three bit-flip code is &#xA;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle_L=|000\rangle$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$|1\rangle_L=|111\rangle$&lt;/span&gt; with stabilizers &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2, Z_2Z_3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The amplitude damping channel on three qubits &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes 3}$&lt;/span&gt; has Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{E_0^{\otimes 3},E_0E_1^{\otimes 2},E_0E_1E_0,E_0^{\otimes 2}E_1,E_1^{\otimes 3},E_1E_0^{\otimes 2},E_1E_0E_1,E_1^{\otimes 2}E_0\}$&lt;/span&gt;,&#xA;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{matrix}&#xA;	E_0=\begin{pmatrix}&#xA;	1 &amp;amp;  0 \\ &#xA;	0 &amp;amp;  \sqrt{1-r} &#xA;	\end{pmatrix},&#xA;E_1=\begin{pmatrix}&#xA;	1 &amp;amp;  \sqrt{r} \\ &#xA;	0 &amp;amp;  0 &#xA;	\end{pmatrix}.&#xA;	\end{matrix}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|111\rangle$&lt;/span&gt; and error &lt;span class=&quot;math-container&quot;&gt;$E_1E_0^2$&lt;/span&gt; will transform &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{r}(1-r)|011\rangle$&lt;/span&gt;. By measuring the stabilizers &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2, Z_2Z_3$&lt;/span&gt;, I can find the first qubit is flipped. So I use &lt;span class=&quot;math-container&quot;&gt;$X_1$&lt;/span&gt; to recover.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is that &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;the state could only be corrected back to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{r}(1-r)|111\rangle$&lt;/span&gt; after the recovery, can &lt;span class=&quot;math-container&quot;&gt;$\sqrt{r}(1-r)$&lt;/span&gt; be recognized as the fidelity? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if I write the initial state in density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=|111\rangle\langle 111|$&lt;/span&gt; and &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;\mathcal{E}^{\otimes 3}(\rho)&amp;amp;=E_0^3 \rho (E_0^3)^\dagger+E_1E_0^2 \rho (E_1E_0^2)^\dagger+\cdots \\&amp;amp;= r^3|000\rangle\langle 000|+r(1-r)^2|011\rangle\langle 011|+\cdots.&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;How to perform projective measurements to obtain error syndromes and correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[5,1,3]$&lt;/span&gt; code can correct one arbitrary error but amplitude damping errors will occur on all &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; qubits, does that mean &lt;span class=&quot;math-container&quot;&gt;$[5,1,3]$&lt;/span&gt; code will have bad performance for amplitude damping errors?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="9275" LastEditDate="2019-12-12T11:31:10.917" LastActivityDate="2019-12-13T13:46:30.073" Title="Quantum error correction using bit-flip code for the amplitude damping channel" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9173" PostTypeId="2" ParentId="9168" CreationDate="2019-12-12T06:25:33.070" Score="3" Body="&lt;p&gt;Yes, and no. (Helpful answer, I know)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you rely on buying the entire package from a single supplier, then yes. This doesn’t need to have anything to do with quantum at all. A quantum computation starts and ends with normal classical bits on a normal classical computer. If that was supplied as part of the package, it can easily have some malware built in that transmits all those classical inputs and outputs, which is sufficient for the supplier to entirely replicate everything the user got.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you’re willing to separate the components a little, you can get something far, far stronger. Let’s say that, as a user, I can supply my own classical computer that I am confident is free from tampering, and I can produce my own single-qubit quantum states. I can perform a protocol called “blind quantum computation” to interact with the quantum computer. Even if the quantum computer part is completely compromised and untrustworthy, they learn essentially nothing about the computation you’re running beyond some basic property of how large the computation is. This was originally designed so that you don’t even have to own the quantum computer yourself. You can leave it with the manufacturer, who can continue to be as naughty with it as they want, and they still learn nothing!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-12T06:25:33.070" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9174" PostTypeId="2" ParentId="9172" CreationDate="2019-12-12T09:38:04.420" Score="2" Body="&lt;p&gt;Firstly, I'm presuming that when you write &lt;span class=&quot;math-container&quot;&gt;$E_0^3$&lt;/span&gt; it corresponds to &lt;span class=&quot;math-container&quot;&gt;$E_0^{q_1} \otimes E_0^{q_2} \otimes E_0^{q_3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;In question 2. you've written out how the Superoperator of the Kraus operators acts on the density matrix, In 1. we should also assume that this is the case, and the pre-factor of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{r}(1-r)$&lt;/span&gt; is a probability amplitude, so measuring with the stabilisers will collapse the state into &lt;span class=&quot;math-container&quot;&gt;$|011\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\sqrt{r}(1-r)$&lt;/span&gt;. So the state recovered after applying the corrective measurement has fidelity = 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;To perform a projective measurement, we just need to write out the measurement operator, &lt;span class=&quot;math-container&quot;&gt;$M = |\psi\rangle\langle\psi|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; is the measurement outcome, e.g. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |000\rangle$&lt;/span&gt; and the expectation value for this measurement is: &lt;span class=&quot;math-container&quot;&gt;$\langle\rho\rangle = \textrm{Trace}(M\rho)$&lt;/span&gt;. If the measurement outcome &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; is obtained, the state after measurement is &lt;span class=&quot;math-container&quot;&gt;$\frac{M\rho M}{\textbf{Trace}(M\rho)}$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;All qubits will be subject to amplitude damping errors, and within a certain time can be expected to have relaxed into the ground state. This time is called &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; time, and the trick is to do the stabiliser measurements before this time has elapsed. The stabiliser measurements are not performed at the end of the computation, but during it, and they project the logical qubits onto the `codespace' (like in Q1. where the qubits after measurement are in the &lt;span class=&quot;math-container&quot;&gt;$|011\rangle$&lt;/span&gt; state). &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9453" LastActivityDate="2019-12-12T09:38:04.420" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9175" PostTypeId="1" AcceptedAnswerId="9177" CreationDate="2019-12-12T13:28:47.803" Score="5" ViewCount="264" Body="&lt;p&gt;I know a three-qubit bit-flip code has a common encoding circuit as follows,&#xA;&lt;a href=&quot;https://i.stack.imgur.com/U8Sz8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U8Sz8.png&quot; alt=&quot;encoding circuit of the three-qubit bit-flip code&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, as in page 35 in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9705052.pdf&quot; rel=&quot;noreferrer&quot;&gt;Gottesman&lt;/a&gt;'s paper, the encoding circuit can also be constructed through stabilizer generators. He illustrated the encoding circuit of the &lt;span class=&quot;math-container&quot;&gt;$[5,1,3]$&lt;/span&gt; code, whose stabilizer generators are &lt;span class=&quot;math-container&quot;&gt;$g_1=Y_1Z_2Z_4Y_5$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_2=X_2Z_3Z_4X_5$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_3=Z_1Z_2X_3X_5$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_4=Z_1Z_3Y_4Y_5$&lt;/span&gt;. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/eT0E8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eT0E8.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think the encoding circuit of three-qubit bit-flip code can also be constructed by its stabilizer generators &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2Z_3$&lt;/span&gt; as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K6wIg.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K6wIg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in this way the circuit is different from the one in the first picture and I do not think this is right.&lt;/p&gt;&#xA;" OwnerUserId="9275" LastActivityDate="2021-05-07T13:21:22.030" Title="Quantum circuit for a three-qubit bit-flip code" Tags="&lt;circuit-construction&gt;&lt;error-correction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9176" PostTypeId="2" ParentId="6501" CreationDate="2019-12-12T13:29:49.007" Score="3" Body="&lt;p&gt;The second circuit applies a stabilizer formalism. A three qubits bit-flip code has stabilizer generators &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2Z_3$&lt;/span&gt;. You can find the circuit in page 473 in Nielsen and Chuang's book - &lt;em&gt;quantum computation and quantum information&lt;/em&gt;. I also have a question about the circuit of three qubits bit-flip code. I would be appreciated if you take a look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9175/quantum-circuit-for-a-three-qubit-bit-flip-code&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9275" LastActivityDate="2019-12-12T13:29:49.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9177" PostTypeId="2" ParentId="9175" CreationDate="2019-12-12T13:54:47.283" Score="4" Body="&lt;p&gt;You can actually, most of the time, prepare an encoded qubit state by using the stabilizers; you can also do this for the bit-flip code.&lt;/p&gt;&#xA;&lt;p&gt;I have intentionally left the above sentence a little vague, because there are some very important subtleties. To really understand these subtleties, a good understanding of stabilizer codes is strongly preferred. If you don't feel comfortable enough with the subject, I advice you to read the first half of &lt;a href=&quot;https://arxiv.org/abs/0904.2557&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman's updated introduction&lt;/a&gt; on the subject instead of his thesis, which has outdated terminology and symbols and might feel a little more convoluted.&lt;/p&gt;&#xA;&lt;h2&gt;Preparing code states through stabilizer measurement&lt;/h2&gt;&#xA;&lt;p&gt;The general idea behind 'using' the stabilizers to encode a codestate into a set of (data) qubits is that you perform the stabilizer measurements to project the state of said data qubits to the eigenspaces of the stabilizer generators. To perform these stabilizer measurements, one makes use of an ancilla qubit. In your second picture (on the &lt;span class=&quot;math-container&quot;&gt;$[5,1,3]$&lt;/span&gt; code), this is the qubit labeled &lt;span class=&quot;math-container&quot;&gt;$|c\rangle$&lt;/span&gt;. &lt;strong&gt;It is not a data qubit.&lt;/strong&gt; Actually, in that picture, only four of the five data qubits are depicted.&lt;/p&gt;&#xA;&lt;p&gt;The text that I linked has a clear explanation on how to perform these measurements. The general idea behind these measurements is that we measure only the ancilla; the measurement outcomes are then associated with the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspaces of the stabilizer generators.&lt;/p&gt;&#xA;&lt;p&gt;In your last picture, you show three qubits, which I expect you to mean to be the three data qubits of the bit-flip code. Therefore, there is no ancilla in play here, and this is not a correct picture. You should add one extra qubit, prepare that in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state, and then perform a controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation to the first and second data qubit. Upon measurement of the ancilla in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis, you will have mapped to either subspace of the &lt;span class=&quot;math-container&quot;&gt;$Z_{1}Z_{2}I_{3}$&lt;/span&gt; generator. I refer to the aforementioned text for further explanation (I can repeat that here but I think you can really benefit from reading that text).&lt;/p&gt;&#xA;&lt;h2&gt;Does this process, in general, give us any encoded state?&lt;/h2&gt;&#xA;&lt;p&gt;Another subtlety lies in the fact that this method of 'mapping to the codespace' does not give us any way of knowing &lt;em&gt;which&lt;/em&gt; codestate we end up with. &lt;strong&gt;All we have done is map to the codespace.&lt;/strong&gt; There even is a minute probability that the original state on our data qubits was perfectly orthogonal to the codespace; mathematically speaking we then end up with the null vector. In general, this will not happen often if the initial state of the qubits is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;, because for most codes that state is part of some codestate. (Of course, for the bit-flip code it exactly &lt;em&gt;is&lt;/em&gt; a codestate, usually labeled as the logical &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state).&lt;/p&gt;&#xA;&lt;p&gt;The important thing to realize is that if we want to encode some single-quibit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of only &lt;strong&gt;one&lt;/strong&gt; of the data qubits into the corresponding codestate on all data qubits, stabilizer measurements are &lt;strong&gt;not&lt;/strong&gt; the way to go to perform this for general states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="104" LastEditDate="2021-05-07T13:21:22.030" LastActivityDate="2021-05-07T13:21:22.030" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9178" PostTypeId="2" ParentId="9168" CreationDate="2019-12-12T13:59:57.623" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;So is it possible that a chip manufacturer (who wishes to spy) can pretty much entangle all the particles on the chip so that what ever processing goes on inside that chip is mirrored miles away by the spy manufacturer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, not really. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The big reason this can't be done is that quantum entanglement doesn't allow for communication. Suppose that there's a particle A in New York, and a particle B in London, and that the particles A and B are entangled. Then, if I manipulate particle A, this will have no observable effects whatsoever on particle B. The people in London will have no idea what I'm doing in New York.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This fact is called the &lt;a href=&quot;https://en.m.wikipedia.org/wiki/No-communication_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no-communication theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, that's not to say that it's &lt;em&gt;impossible&lt;/em&gt; for a chip manufacturer to spy on the users of the chip. For example, the manufacturer could put in a hidden radio transmitter. But they can't spy by means of entanglement. &lt;/p&gt;&#xA;" OwnerUserId="8960" LastActivityDate="2019-12-12T13:59:57.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9179" PostTypeId="1" CreationDate="2019-12-12T15:28:42.907" Score="1" ViewCount="227" Body="&lt;p&gt;I'm doing an implementation/tutorial of the iterative phase estimation algorithm (IPEA) and have a problem. My Hamiltonian is a diagonal matrix &lt;span class=&quot;math-container&quot;&gt;$H = \begin{pmatrix} E_1 &amp;amp; 0 \\ 0 &amp;amp; E_2\end{pmatrix}$&lt;/span&gt;, I want to estimate both eigenvalues. When I do it instead of &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; the estimated value is 0, and instead of &lt;span class=&quot;math-container&quot;&gt;$E_2$&lt;/span&gt; the estimated value is &lt;span class=&quot;math-container&quot;&gt;$E_2 - E_1$&lt;/span&gt;. Is it possible that when I call &lt;code&gt;H.evolve(t=1)&lt;/code&gt;&#xA;method  it doesn't create a circuit for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{-iHt}$&lt;/span&gt;, but instead, creates a circuit for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{-i\hat{H}t}$&lt;/span&gt; , where &lt;span class=&quot;math-container&quot;&gt;$\hat{H} = \begin{pmatrix}0 &amp;amp; 0 \\  0 &amp;amp; E_2 - E_1\end{pmatrix}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, if I have &lt;span class=&quot;math-container&quot;&gt;$H = \begin{pmatrix} E_1 &amp;amp; 0 \\ 0 &amp;amp; E_2\end{pmatrix}$&lt;/span&gt;, what should do the &lt;code&gt;H.evolve(t=1)&lt;/code&gt; method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a) Create a circuit for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{-iHt}$&lt;/span&gt; unitary operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;b) Create a circuit for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{-i\hat{H}t}$&lt;/span&gt; unitary operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the &lt;a href=&quot;https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/iterative_phase_estimation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to my tutorial&lt;/a&gt; and the short version of it is presented here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the tutorial I am writing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;E_1, E_2 = (0, random())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and it finds &lt;span class=&quot;math-container&quot;&gt;$E_2$&lt;/span&gt;, because when &lt;span class=&quot;math-container&quot;&gt;$E_1 = 0$&lt;/span&gt;,   &lt;span class=&quot;math-container&quot;&gt;$E_2 = E_2 - E_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here in the following code, this line is changed:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;E_1, E_2 = (random(), random())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the algorithm estimates &lt;span class=&quot;math-container&quot;&gt;$E_2 - E_1$&lt;/span&gt; value instead of &lt;span class=&quot;math-container&quot;&gt;$E_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from random import random&#xA;from qiskit import *&#xA;from qiskit.aqua.operators import WeightedPauliOperator, MatrixOperator&#xA;from qiskit.aqua.operators.op_converter import to_matrix_operator&#xA;from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;q = QuantumRegister(1)&#xA;a = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;&#xA;&#xA;def simple_hamiltonian_operator(E_1, E_2):&#xA;    &quot;&quot;&quot;&#xA;    Creates 0.5*(E_1 + E_2)*I + 0.5*(E_1 - E_2)*Z pauli sum&#xA;    that will be our &quot;simple&quot; Hamiltonian operator. The corresponding&#xA;    matrix for Hamiltonian is [[E_1, 0], [0, E_2]].&#xA;&#xA;    &quot;&quot;&quot;&#xA;    pauli_dict = {&#xA;        'paulis': [{&quot;coeff&quot;: {&quot;imag&quot;: 0.0, &quot;real&quot;: 0.5 * (E_1 - E_2)}, &quot;label&quot;: &quot;Z&quot;},&#xA;                   {&quot;coeff&quot;: {&quot;imag&quot;: 0.0, &quot;real&quot;: 0.5 * (E_1 + E_2)}, &quot;label&quot;: &quot;I&quot;}&#xA;                   ]&#xA;    }&#xA;    return WeightedPauliOperator.from_dict(pauli_dict)&#xA;&#xA;&#xA;E_1, E_2 = (random(), random())&#xA;print(&quot;We want to estimate E_2 = {}&quot;.format(E_2))&#xA;&#xA;H = simple_hamiltonian_operator(E_1, E_2)&#xA;print(&quot;The Hamiltonian in matrix form:&quot;)&#xA;print(to_matrix_operator(H).dense_matrix)&#xA;&#xA;t = 1&#xA;H_circuit = H.evolve(evo_time=t, quantum_registers=q)&#xA;H_circuit.data.__delitem__(-1) # deleting a barrier at the end of circuit&#xA;&#xA;# control version of the circuit&#xA;control_H = get_controlled_circuit(H_circuit, a[0])&#xA;&#xA;num_bits_estimate = 10&#xA;phase = 0&#xA;for k_precision in reversed(range(num_bits_estimate)):&#xA;    # Create a Quantum Circuit acting on the q register&#xA;    k_circ = QuantumCircuit(q, a, c)&#xA;&#xA;    # (1) |1&amp;gt; eigenstate initialization&#xA;    k_circ.x(q[0])&#xA;&#xA;    # (2) Initial Hadamard gate applied on ancillary qubit.&#xA;    k_circ.h(a[0])&#xA;&#xA;    # (3) The control Hamiltonian applied on the qubits where control qubit is the ancillary qubit.&#xA;    for order in range(2 ** k_precision):&#xA;        k_circ += control_H&#xA;&#xA;    # (4) The phase gate and final Hadamard gate on ancillary qubit.&#xA;    phase_shift = 2 * np.pi * phase * 2 ** k_precision&#xA;    k_circ.u1(-phase_shift, a[0])&#xA;    k_circ.h(a[0])&#xA;&#xA;    # (5) Measurement of ancillary qubit (findig the bit)&#xA;    k_circ.measure(a[0], c[0])&#xA;&#xA;    # (6) executing on Quantum Computer and finding a bit from the phase&#xA;    job = execute(k_circ, backend, shots=1000)&#xA;    result = job.result()&#xA;    counts = result.get_counts()&#xA;    value = int(max(counts, key=counts.get))&#xA;&#xA;    # (7) phase after this iteration&#xA;    phase += value / 2 ** (k_precision + 1)&#xA;&#xA;# obtaining E_2 from the estimated phase&#xA;if E_2 &amp;gt; E_1:&#xA;    eigenvalue = 2 * np.pi * (1 - phase) / t&#xA;else:&#xA;    eigenvalue = -2 * np.pi * phase / t&#xA;&#xA;print(&quot;Eigenvalue of Hamiltonian that we want to estimate: E_2 = &quot; + str(E_2))&#xA;print(&quot;Meanwhile, E_2 - E_1 = {}&quot;.format(E_2 - E_1))&#xA;print(&quot;Estimated eigenvalue of Hamiltonian: &quot; + str(eigenvalue))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9006" LastEditDate="2019-12-15T09:36:09.930" LastActivityDate="2019-12-15T09:36:09.930" Title="A question about qiskit's WeightedPauliOperator.evolve method for IPEA (IQPE) implementation" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9180" PostTypeId="1" CreationDate="2019-12-12T17:21:20.710" Score="4" ViewCount="247" Body="&lt;p&gt;I'm working on a teleport protocol and I need to open the matrix of each operator, however, there's a CZ gate between q0 and q2 at the end of it and I don't know how to write the matrix for it and operate in the state.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ShoI0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ShoI0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the protocol, really basic, and the CZ is the last one.&lt;/p&gt;&#xA;" OwnerUserId="9461" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-12-14T19:39:58.020" Title="How do I write the matrix for a CZ gate operating on nonadjacent qubits?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9181" PostTypeId="1" AcceptedAnswerId="9182" CreationDate="2019-12-12T19:10:41.913" Score="2" ViewCount="122" Body="&lt;p&gt;Suppose I had 3 entangled qubits and I wanted to apply a SWAP gate on the first and third qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because it's entangled I can't decompose it into individual states, and because the qubits are not adjacent I can't simply take a Kronecker product with an identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I go about creating the matrix for applying this transformation? Also is there a generalization for swapping 2 arbitrary qubits in an n qubit system?&lt;/p&gt;&#xA;" OwnerUserId="9390" LastEditorUserId="55" LastEditDate="2020-04-29T13:23:11.507" LastActivityDate="2020-04-29T13:23:11.507" Title="SWAP gate on 2 qubits in 3 entangled qubit system" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9182" PostTypeId="2" ParentId="9181" CreationDate="2019-12-12T20:28:17.923" Score="4" Body="&lt;p&gt;Gates don't depend on states they act on. So it doesn't matter if the state is entangled or not. The gate you've described (let's call it &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) acts on a standard basis by this rules &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U |0x0\rangle =  |0x0\rangle&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U |0x1\rangle =  |1x0\rangle&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U |1x0\rangle =  |0x1\rangle&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U |1x1\rangle =  |1x1\rangle&#xA;$$&lt;/span&gt;&#xA;for each &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can write this matrix as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\sum_{x=0}^1 \big(|0x0\rangle\langle 0x0 |+|1x0\rangle\langle 0x1 |+|0x1\rangle\langle 1x0 |+|1x1\rangle\langle 1x1 | \big) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= |0\rangle\langle 0| \otimes I \otimes |0\rangle\langle 0| + |1\rangle\langle 0| \otimes I \otimes |0\rangle\langle 1| +  |0\rangle\langle 1| \otimes I \otimes |1\rangle\langle 0| +  |1\rangle\langle 1| \otimes I \otimes |1\rangle\langle 1| &#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-12-12T20:39:41.750" LastActivityDate="2019-12-12T20:39:41.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9183" PostTypeId="2" ParentId="23" CreationDate="2019-12-12T20:45:54.307" Score="2" Body="&lt;p&gt;Yes, a classical computer can simulate a quantum computer in terms of computational efficiency but it would be limited up to 23 qubits till 2005-2006 using IBM Bluegene supercomputer cluster at Forschungszentrum Juelich in Germany. However, the latest update as per 2017 is a world record of 46 qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.fz-juelich.de/SharedDocs/Pressemitteilungen/UK/EN/2017/2017-12-15-world-record-juelich-researchers-simulate-quantum-computer.html?nn=2070042&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;World Record: Quantum Computer with 46 Qubits simulated&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jülich, 15 December - Scientists from the Jülich Supercomputing Centre have set a new world record. Together with researchers from Wuhan University and the University of Groningen, they successfully simulated a quantum computer with 46 quantum bits – or qubits – for the first time. For their calculations, the scientists used the Jülich supercomputer JUQUEEN as well as the world’s fastest supercomputer Sunway TaihuLight at China’s National Supercomputing Center in Wuxi.&lt;/p&gt;&#xA;" OwnerUserId="9302" LastActivityDate="2019-12-12T20:45:54.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9184" PostTypeId="2" ParentId="9180" CreationDate="2019-12-12T21:01:10.930" Score="1" Body="&lt;p&gt;What you need is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;SWAP q[1] and q[2]&lt;/li&gt;&#xA;&lt;li&gt;Do CZ on q[0] and q[1] (note that we have q[2] in it right now)&lt;/li&gt;&#xA;&lt;li&gt;SWAP q[1] and q[2]&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;In terms of matrices, all you need is to multiply 3 8x8 matrices. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope it will help.&lt;/p&gt;&#xA;" OwnerUserId="9424" LastActivityDate="2019-12-12T21:01:10.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9185" PostTypeId="2" ParentId="9180" CreationDate="2019-12-12T21:52:39.863" Score="5" Body="&lt;p&gt;Consider that a control qubit is &lt;span class=&quot;math-container&quot;&gt;$q_k$&lt;/span&gt; and a target qubit is &lt;span class=&quot;math-container&quot;&gt;$q_{k+n}$&lt;/span&gt; and you want to apply operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the target qubit. Denote &lt;span class=&quot;math-container&quot;&gt;$N=2^{n+1}$&lt;/span&gt;. Then matrix representation of this controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CU=&#xA;\begin{pmatrix}&#xA;I_{\frac{N}{2}} &amp;amp; O_{\frac{N}{2}} \\&#xA;O_{\frac{N}{2}} &amp;amp; I_{\frac{N}{4}} \otimes U \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case &lt;span class=&quot;math-container&quot;&gt;$U=Z=\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{pmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, so the matrix representation of operator &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$q_{2}$&lt;/span&gt; controlled by &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-12T21:52:39.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9186" PostTypeId="1" CreationDate="2019-12-12T22:12:58.067" Score="3" ViewCount="22" Body="&lt;p&gt;Unification &lt;a href=&quot;https://en.wikipedia.org/wiki/Unification_(computer_science)&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Unification_(computer_science)&lt;/a&gt; is the most important algorithm for symbolic computation and automatic theorem proving - essentially - it allows to find the candidate formulas that can be used for performing the next steps of inference (be it resolution in the backward chaining or other algorithms in the forward chaining). My question is - are the quantum algorithms for the unification? Google gives nothing, but I guess that there are algorithms and some perspective but different terms are used and Google can not match such research.&lt;/p&gt;&#xA;" OwnerUserId="1326" LastActivityDate="2019-12-12T22:12:58.067" Title="Quantum algorithms for the first-order and higher-order unification problem (finding substitution)" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9187" PostTypeId="1" CreationDate="2019-12-13T05:36:44.740" Score="1" ViewCount="27" Body="&lt;p&gt;I am working on translating a computing method I developed to model complex non-linear systems with classical computational methods into a form that is natural to quantum computing. The technique involves creating probability filters as data in order to describe the desired solution. Encoding data and program in this manner permits rapidly finding a solution to a complex real-world problem that fits a set of desirable conditions. For example, I have used this methodology to find the most highly probable stock price at a given point in time. Does anyone have any experience they can share in encoding &quot;non-linear probability logic&quot; in quantum computational style? I am having trouble finding examples of this kind of computation method.&lt;/p&gt;&#xA;" OwnerUserId="9414" LastEditorUserId="55" LastEditDate="2021-04-01T14:36:57.023" LastActivityDate="2021-04-01T14:36:57.023" Title="Methods for encoding non-linear probabilities as data" Tags="&lt;circuit-construction&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9188" PostTypeId="2" ParentId="9180" CreationDate="2019-12-13T07:13:58.533" Score="3" Body="&lt;p&gt;You can write the controlled-phase gate, as applied to just those two qubits, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I\otimes I-2|1\rangle\langle 1|\otimes |1\rangle\langle 1|.&#xA;$$&lt;/span&gt;&#xA;If you want these to act on qubits 1 and 3, then you need to apply identity, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, on the second qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I\otimes I\otimes I-2|1\rangle\langle 1|\otimes I\otimes |1\rangle\langle 1|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-13T07:13:58.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9189" PostTypeId="2" ParentId="9175" CreationDate="2019-12-13T12:45:17.583" Score="2" Body="&lt;p&gt;I think this circuit performed by generators &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_3$&lt;/span&gt; works.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/syUoI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/syUoI.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|0\rangle$&lt;/span&gt;, it can have the logical state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;; and when &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|1\rangle$&lt;/span&gt; the logical state is &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9275" LastActivityDate="2019-12-13T12:45:17.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9190" PostTypeId="1" AcceptedAnswerId="9193" CreationDate="2019-12-13T13:04:08.193" Score="5" ViewCount="399" Body="&lt;p&gt;I realized that QASM supports custom gates. However, when I tried to create the gate, transpiling error appeared both on simulator and real quantum processor. I suspect that IBM has not implemented this functionality fully yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does anybody (maybe from IBM) know when IBM will provide users with possibility to use custom gates?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2019-12-13T22:34:25.467" LastActivityDate="2019-12-13T22:34:25.467" Title="Custom gates on IBM Q" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9191" PostTypeId="2" ParentId="9172" CreationDate="2019-12-13T13:46:30.073" Score="3" Body="&lt;p&gt;Before starting, I should probably emphasise that, although useful for the practice of working through the maths of quantum error correction on a relatively simple case, amplitude damping combined with the repetition code is a really bad thing to be thinking about. This is because, if there's an error, and they you apply a syndrome measurement, so that you detect there's one bit that is different from the other two, then you &lt;em&gt;know&lt;/em&gt; that your initial state was &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; because under amplitude damping noise, &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; never changes. This means that your syndrome measurement, if it detects an error, constitutes a measurement on your encoded qubit. It destroys any of the coherence you were trying to protect!&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Because of the issue described above, this question doesn't make the sort of sense you'd like it to. However, remember that there are measurements going on. When you measure, you get a probability of getting a given outcome, and the output state is renormalised. At this point, it is usually the probability of success that is evaluated (sum of the probabilities for measurement outcomes which are successful in correcting the error) rather than a fidelity.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How you perform the measurement has nothing to do with the state. Perhaps you feel unfamiliar with the formalism because it's applied to a density matrix rather than a pure state. Still, it's a sequence of applying unitaries (&lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto U\rho U^\dagger$&lt;/span&gt;) and projections (probability &lt;span class=&quot;math-container&quot;&gt;$p_i=\text{Tr}(P_i\rho)$&lt;/span&gt; and output state &lt;span class=&quot;math-container&quot;&gt;$P_i\rho P_i/p_i$&lt;/span&gt;).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not the issue that the errors &lt;em&gt;could&lt;/em&gt; apply to all 5 qubits that's the problem. You should still think about these errors as an independent probability &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; of the amplitude damping error acting on each qubit (if it's in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state) and &lt;span class=&quot;math-container&quot;&gt;$(1-r)$&lt;/span&gt; of not happening. So, there's a case of no error with probability &lt;span class=&quot;math-container&quot;&gt;$(1-r)^5$&lt;/span&gt; and 5 cases of just one error happening, each of probability &lt;span class=&quot;math-container&quot;&gt;$r(1-r)^4$&lt;/span&gt;. All of these are cases that can be corrected by the 5-qubit code. So, the idea is that provided &lt;span class=&quot;math-container&quot;&gt;$(1-r)^5+5r(1-r)^4&amp;gt;(1-r)$&lt;/span&gt;, it is less likely that there's a error on the logically encoded qubit than there would have been on a single qubit with no encoding. That makes it a worthwhile procedure.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-13T13:46:30.073" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9192" PostTypeId="1" AcceptedAnswerId="9194" CreationDate="2019-12-13T14:40:36.353" Score="4" ViewCount="154" Body="&lt;p&gt;With reference to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9014/quantum-tomography-on-two-qubits&quot;&gt;question on how to do quantum tomography on two qubits&lt;/a&gt;, I would like to ask you for help again. I tried to do the tomography on state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\psi=\frac{1}{2}\begin{pmatrix}1 \\ i \\-1 \\-i\end{pmatrix}\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This state can be prepared by application of &lt;span class=&quot;math-container&quot;&gt;$HX$&lt;/span&gt; on first qubit and &lt;span class=&quot;math-container&quot;&gt;$SH$&lt;/span&gt; on second one, both qubits were in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; at the beginning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do measurement of the state by the tomography, I evaluated eigenvectors of all observables present in two qubits tomogaphy and created measuring circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a list of observables, their eigenvectors and respective eigenvalues (please note that I omitted normalization in majority of cases because of simplicity):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Y$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$X\otimes Y$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; i\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; -i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$X\otimes Z$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Y\otimes X$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; -i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; i\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Z$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; -i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; i\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -i\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Z\otimes X$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Y$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; -i &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; i\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -i\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; i &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$I\otimes X$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$I\otimes Y$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; -i &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -i\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; i\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; i &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$I\otimes Z$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$X\otimes I$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Y\otimes I$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; -i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -i\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; i\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; i &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Observable &lt;span class=&quot;math-container&quot;&gt;$Z\otimes I$&lt;/span&gt;:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then I realized that basis generated by eigenvectors of observables are repeating (note that I &quot;invented&quot; names for some basis for easier referencing further):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;z-basis: &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I\otimes Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z\otimes I$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Bell basis: &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Y$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&quot;Imaginary&quot; Bell basis: &lt;span class=&quot;math-container&quot;&gt;$X\otimes Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y\otimes X$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&quot;A&quot; basis: &lt;span class=&quot;math-container&quot;&gt;$X\otimes Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X\otimes I$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&quot;B&quot; basis: &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y\otimes I$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&quot;C&quot; basis: &lt;span class=&quot;math-container&quot;&gt;$Z\otimes X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I\otimes X$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;&quot;D&quot; basis: &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I\otimes Y$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;After that I created for each basis a circuit for measuring in the basis, or in other words the circuit for converting basis states to z-basis ones. These circuits are here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Bell basis&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WIJpO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WIJpO.png&quot; alt=&quot;Bell basis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Imaginary Bell basis&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/OOo3n.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OOo3n.png&quot; alt=&quot;Imaginary Bell basis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;A basis&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yMR4d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yMR4d.png&quot; alt=&quot;A basis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;B basis&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZZTd8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZZTd8.png&quot; alt=&quot;B basis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;C basis&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/294ef.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/294ef.png&quot; alt=&quot;C basis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;D basis&lt;/em&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aCg6E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aCg6E.png&quot; alt=&quot;D basis&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having this I created a map between basis states and z-basis and assigned each state in z-basis either value -1 or 1 in the following way&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{matrix}&#xA;\mathrm{observable} &amp;amp; -1 &amp;amp; 1\\&#xA;X\otimes X &amp;amp; |11\rangle, |10\rangle &amp;amp; |00\rangle, |01\rangle\\&#xA;Y\otimes Y &amp;amp; |11\rangle, |00\rangle &amp;amp; |10\rangle, |01\rangle\\&#xA;Z\otimes Z &amp;amp; |01\rangle, |10\rangle &amp;amp; |00\rangle, |11\rangle\\&#xA;X\otimes Y &amp;amp; |01\rangle, |10\rangle &amp;amp; |00\rangle, |11\rangle\\&#xA;X\otimes Z &amp;amp; |10\rangle, |11\rangle &amp;amp; |01\rangle, |00\rangle\\&#xA;Y\otimes X &amp;amp; |11\rangle, |10\rangle &amp;amp; |00\rangle, |01\rangle\\&#xA;Y\otimes Z &amp;amp; |10\rangle, |11\rangle &amp;amp; |01\rangle, |00\rangle\\&#xA;Z\otimes X &amp;amp; |10\rangle, |11\rangle &amp;amp; |01\rangle, |00\rangle\\&#xA;Z\otimes Y &amp;amp; |10\rangle, |11\rangle &amp;amp; |01\rangle, |00\rangle\\&#xA;I\otimes X &amp;amp; |10\rangle, |01\rangle &amp;amp; |11\rangle, |10\rangle\\&#xA;I\otimes Y &amp;amp; |10\rangle, |01\rangle &amp;amp; |11\rangle, |00\rangle\\&#xA;I\otimes Z &amp;amp; |01\rangle, |11\rangle &amp;amp; |10\rangle, |00\rangle\\&#xA;X\otimes I &amp;amp; |10\rangle, |01\rangle &amp;amp; |00\rangle, |11\rangle\\&#xA;Y\otimes I &amp;amp; |10\rangle, |01\rangle &amp;amp; |11\rangle, |00\rangle\\&#xA;Z\otimes I &amp;amp; |10\rangle, |11\rangle &amp;amp; |00\rangle, |01\rangle\\&#xA;\end{matrix}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I calculated a density operator estimation and did spectral decomposition of that I really obtained state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; among eigenstates and its respective eigenvalue was the highest one. However, there was also one negative eigenvalue. So, as the density operator is a positive one, it seems that there is some mistake in my calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum it all up:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I calculated eigenvalues and eigenvectors of all observables&lt;/li&gt;&#xA;&lt;li&gt;I created circuits for measuring a quantum state in bases given by eigenvectors obtained in the first step&lt;/li&gt;&#xA;&lt;li&gt;I assigned each eigenvector its &quot;mirror&quot; in z-basis after measuring by circuits from step 2&lt;/li&gt;&#xA;&lt;li&gt;I prepared state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;I did a measurement of state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; in all bases obtained in step 1 with help of circuits from step 2&lt;/li&gt;&#xA;&lt;li&gt;Based on measured probabilities, I calculated estimation of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(A\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an observable  &lt;/li&gt;&#xA;&lt;li&gt;Then, I calculated estimation of density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Finnaly, I found eigenvalues and eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. State &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; should be one of eigenvectors, its respective eigenvalue should be close to 1 as pure state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; was measured.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I did all calculations in MatLab and I used matrix representation of quantum gates to simulate both state preparation and measurement in different bases, so the calculations are exact and there is no noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question: is my above described approach right?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I really appreciate any help. Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2019-12-13T23:04:44.640" LastActivityDate="2019-12-13T23:04:44.640" Title="Problem with quantum tomography on two qubits" Tags="&lt;measurement&gt;&lt;tomography&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9193" PostTypeId="2" ParentId="9190" CreationDate="2019-12-13T15:34:05.687" Score="7" Body="&lt;p&gt;This is possible by using Composite Gates in Qiskit. With composite gates, you can create a circuit of gates, turn that circuit into an Instruction, and attach it to a new circuit which will perform the gates that were within your old circuit. Here is an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;qc = QuantumCircuit(2, name='bell')&#xA;qc.h(0)&#xA;qc.cx(0, 1)&#xA;custom_gate = qc.to_instruction()&#xA;&#xA;new_circ = QuantumCircuit(2)&#xA;&#xA;# Append custom gate. The parameters are the Instruction you made, and the qubits you will use with it&#xA;new_circ.append(custom_gate, [0, 1])&#xA;&#xA;print(new_circ)&#xA;&#xA;'''&#xA;This is the output&#xA;        ┌───────┐&#xA;q_0: |0&amp;gt;┤0      ├&#xA;        │  bell │&#xA;q_1: |0&amp;gt;┤1      ├&#xA;        └───────┘&#xA;'''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;to_instruction()&lt;/code&gt; method from &lt;code&gt;QuantumCircuit&lt;/code&gt; turns your circuit into an instruction which can then be appended to another circuit in the future. It appears as a single gate on the new circuit, which you can name to make it more organized. When the new circuit is executed, it will run this composite gate, which will make it run through the bell state code we set earlier.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more information about composite gates, you can go to this &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/terra/1_advanced_circuits.ipynb&quot; rel=&quot;noreferrer&quot;&gt;tutorial&lt;/a&gt; and scroll down to the &quot;Composite Gates&quot; section&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-12-13T15:34:05.687" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9194" PostTypeId="2" ParentId="9192" CreationDate="2019-12-13T15:53:40.683" Score="3" Body="&lt;p&gt;I find it a little tough to understand your calculations directly. I am especially confused by the circuit diagrams in your question; why they are there and what you are using them for.&lt;/p&gt;&#xA;&lt;p&gt;If you are performing calculations on theoretical data (without noise), then I feel you can make do with an easier approach for quantum state tomography. As per my answer on your previous question (that you linked to in this question), the idea behind QST is to reconstruct a unknown state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; from the expectation values of a set of measurement observables.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When I calculated a density operator estimation and did spectral decomposition of that I really obtained state ψ among eigenstates and its respective eigenvalue was the highest one. However, there was also one negative eigenvalue. So, as the density operator is a positive one, it seems that there is some mistake in my calculation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What exactly do you mean by 'I really obtained the state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; among eigenstates (of what?) and its respective eigenvalue was the highest one (among whose)?&lt;/p&gt;&#xA;&lt;p&gt;Do you mean that the estimated density operator that you obtained had more than one nonzero eigenvalues? If you are just performing exact calculations with matrices, this should not be the case. (If you are incorporating statistical noise into your calculations then this will definitely happen).&lt;/p&gt;&#xA;&lt;p&gt;Negative eigenvalues can occur in your estimation of the density matrix if there is statistical noise. This will occur in actual experiments, so people have been addressing it for quite some time now. &lt;a href=&quot;https://arxiv.org/abs/1106.5458&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; offers a way of combating negative eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;Now, if you are performing your calculations solely on pure states &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi\rangle\langle\psi|$&lt;/span&gt; and if you are calculating the expectation value for an observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\langle M\rangle = \rm{Tr}\big[M\rho\big] = \langle\psi|M|\psi\rangle,&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then reconstructing &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; via the equation&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\hat{\rho}= \sum_{P_{i}\in\mathcal{P}^{2}}\rm{Tr}\big[P_{i}\rho\big]P_{i},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}^{2}$&lt;/span&gt; the two-qubit Pauli group,&#xA;should be a perfect reconstruction and therefore give only one nonzero eigenvalue. So then it would indicate an error in your calculations.&lt;/p&gt;&#xA;&lt;p&gt;If you can add some information on how exactly you are performing these calculations (are you doing them by hand, by code, are you actually simulating the quantum circuits etc.) then I might be able to help more. Please feel free to contact me directly.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-12-13T15:53:40.683" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9195" PostTypeId="1" AcceptedAnswerId="9196" CreationDate="2019-12-13T19:58:07.290" Score="1" ViewCount="412" Body="&lt;p&gt;Below is the code that I am trying to execute on Google Colab using Qiskit.&#xA;I'll also paste the error that I am getting. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend('qasm_simulator')&#xA;# create Quantum Register called &quot;qr&quot; with 4 qubits&#xA;qr = QuantumRegister(4, name=&quot;qr&quot;)&#xA;# create Quantum Register called &quot;cr&quot; with 4 qubits&#xA;cr = ClassicalRegister(4, name=&quot;cr&quot;)&#xA;# Creating Quantum Circuit called &quot;qc&quot; involving your Quantum Register &quot;qr&quot;&#xA;# and your Classical Register &quot;cr&quot;&#xA;qc = QuantumCircuit(qr, cr, name=&quot;solve_linear_sys&quot;)        &#xA;&#xA;# Initialize times that we get the result vector &#xA;n0 = 0&#xA;n1 = 0&#xA;&#xA;for i in range(10):&#xA;    #Set the input|b&amp;gt; state&quot;&#xA;    qc.x(qr[2])&#xA;&#xA;    #Set the phase estimation circuit&#xA;    qc.h(qr[0])&#xA;    qc.h(qr[1]) &#xA;    qc.u1(pi, qr[0])&#xA;    qc.u1(pi/2, qr[1])&#xA;    qc.cx(qr[1], qr[2])&#xA;&#xA;    #The quantum inverse  Fourier transform &#xA;    qc.h(qr[0])&#xA;    qc.cu1(-pi/2, qr[0], qr[1])&#xA;    qc.h(qr[1])&#xA;&#xA;    #R（lamda^-1） Rotation&#xA;    qc.x(qr[1])&#xA;    qc.cu3(pi/16, 0, 0, qr[0], qr[3])&#xA;    qc.cu3(pi/8, 0, 0, qr[1], qr[3])   &#xA;&#xA;    #Uncomputation&#xA;    qc.x(qr[1])&#xA;    qc.h(qr[1])&#xA;    qc.cu1(pi/2, qr[0], qr[1])&#xA;    qc.h(qr[0])&#xA;&#xA;    qc.cx(qr[1], qr[2])&#xA;    qc.u1(-pi/2, qr[1])&#xA;    qc.u1(-pi, qr[0])&#xA;&#xA;    qc.h(qr[1]) &#xA;    qc.h(qr[0])&#xA;&#xA;    # To measure the whole quantum register&#xA;    qc.measure(qr[0], cr[0])&#xA;    qc.measure(qr[1], cr[1])&#xA;    qc.measure(qr[2], cr[2])&#xA;    qc.measure(qr[3], cr[3])&#xA;&#xA;    job = execute(qc, backend=backend, shots=8192,)&#xA;    result = job.result()&#xA;&#xA;    # Get the sum og all results&#xA;    n0 = n0 + result.get_data(&quot;solve_linear_sys&quot;)['counts']['1000']&#xA;    n1 = n1 + result.get_data(&quot;solve_linear_sys&quot;)['counts']['1100']&#xA;&#xA;    # print the result&#xA;    print(result)&#xA;#     print(result.get_data(qc))&#xA;    plot_histogram(result.get_counts())&#xA;&#xA;&#xA;#     Reset the circuit&#xA;    qc.reset(qr)&#xA;&#xA;    # calculate the scale of the elements in result vectot and print it.&#xA;    p = n0/n1&#xA;    print(n0)&#xA;    print(n1)&#xA;    print(p)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Error&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-15-0331fdb77f03&amp;gt; in &amp;lt;module&amp;gt;()&#xA;     54 &#xA;     55     # Get the sum og all results&#xA;---&amp;gt; 56     n0 = n0 + result.get_data(&quot;solve_linear_sys&quot;)['counts']['1000']&#xA;     57     n1 = n1 + result.get_data(&quot;solve_linear_sys&quot;)['counts']['1100']&#xA;     58 &#xA;&#xA;AttributeError: 'Result' object has no attribute 'get_data'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Has the item get_data been removed?&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="26" LastEditDate="2019-12-15T15:23:08.450" LastActivityDate="2019-12-15T15:23:08.450" Title="AttributeError: 'Result' object has no attribute 'get_data'" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9196" PostTypeId="2" ParentId="9195" CreationDate="2019-12-13T20:52:07.167" Score="3" Body="&lt;p&gt;I believe &lt;code&gt;result.get_data()&lt;/code&gt; was renamed to just &lt;code&gt;result.data()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/stable/0.11/qiskit/result/result.py#L57&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is the source code for the method&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2019-12-13T20:52:07.167" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9198" PostTypeId="2" ParentId="9168" CreationDate="2019-12-14T08:45:51.983" Score="0" Body="&lt;p&gt;Yes, you can in principle spy on a computation - albeit using more subtle/gentle methods than entangling everything -, but you can prevent it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The setting is that of a client who whishes to perform a computation on a server. If nothing specific is done, the server will know the computation being performed (ie the algorithm) because you will send a sequence of commands to it. It might also spy on you data (easy if the information is classical, harder if it is quantum, but not impossible). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically, delegated quantum computation is not blind to a malicious server. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But you can prevent it using blind delegated quantum computing schemes. These schemes use measurement based calculus to prevent the server from learning anything from the algorithm being done and the data it ia applied to - except the length of the compuation and the size of data. One scheme for doing so is BFK09 &lt;a href=&quot;https://arxiv.org/abs/0807.4154&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0807.4154&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can improve on this result by adding verification. That is you prevent a malicious server to fiddle with the compuation as you verify it is doing the right job (in case he doesn't comply with your instructions, you'll catch him with high probability).&lt;/p&gt;&#xA;" OwnerUserId="9393" LastEditorUserId="9393" LastEditDate="2019-12-14T21:48:43.200" LastActivityDate="2019-12-14T21:48:43.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9199" PostTypeId="1" CreationDate="2019-12-14T13:03:48.493" Score="1" ViewCount="239" Body="&lt;p&gt;A physical qubit, for example, an electron with energy level (ground state and excited state) represents a simple quantum system. I was curious whether a physical system is a basis for&#xA;mathematically representing qubit in 2D space?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why not a qubit state be in 3D Hilbert space? Is there a mathematical formulation for this even though an equivalent quantum system doesn't exist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I don't have a formal background in physics or mathematics, this question came to mind when I started reading about quantum computation.&lt;/p&gt;&#xA;" OwnerUserId="8697" LastEditorUserId="26" LastEditDate="2019-12-15T01:24:16.820" LastActivityDate="2019-12-15T01:24:16.820" Title="Why a single qubit is a state in 2D Hilbert space and not 3D or higher?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9200" PostTypeId="2" ParentId="9199" CreationDate="2019-12-14T14:22:12.980" Score="3" Body="&lt;p&gt;A two-dimensional Hilbert space is very different from two spatial dimensions. In particular, two spatial directions (up/down and left/right) are described by two real parameters. A two-dimensional Hilbert space corresponds to two &lt;em&gt;complex&lt;/em&gt; parameters, i.e. 4 real parameters. That said, quantum states have a constraint (normalisation) which means that there are effectively only three relevant parameters. This is why, if we want to visualise a qubit, we use something called the Bloch sphere in three spatial dimensions.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-14T14:22:12.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9201" PostTypeId="1" CreationDate="2019-12-14T15:42:01.740" Score="2" ViewCount="349" Body="&lt;p&gt;For IBMQ device based on superconducting technology, when we transpile the circuit, it is decomposed of U1,U2,U3 and CNOT gates, which are its native gates.&#xA;However for trapped ion device, its native gates are rx,ry,rxx and ms gate.&#xA;Why do the 2 technologies choose different native gates?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="26" LastEditDate="2019-12-14T16:40:58.267" LastActivityDate="2019-12-14T16:40:58.267" Title="Why qiskit superconducting device native gates different from that of trapped ion device?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9202" PostTypeId="2" ParentId="9201" CreationDate="2019-12-14T16:37:18.767" Score="4" Body="&lt;p&gt;The choice of gates is entirely dependent on the types of interactions that occur in the different architectures. The cross resonance gate used by IBM generates the ZX interaction you want (plus other stuff) that leads to a CNOT. Trapped ions have XX type interactions that give rise to Molmer Sorensen gates. For single qubit gates it depends on what driving terms you have available to rotate your qubits on the Bloch sphere. The U gates on IBM devices are just combinations of X(pi/2) pulses and Z rotations that get done in software. So the only drive channel one needs is an X drive.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-12-14T16:37:18.767" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9203" PostTypeId="2" ParentId="6722" CreationDate="2019-12-14T16:41:24.450" Score="1" Body="&lt;p&gt;The device is currently undergoing planned maintenance to update the control electronics. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-12-14T16:41:24.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9204" PostTypeId="1" AcceptedAnswerId="9216" CreationDate="2019-12-14T18:31:16.650" Score="36" ViewCount="11492" Body="&lt;p&gt;According to the &lt;a href=&quot;https://www.newscientist.com/article/2227387-quantum-computer-sets-new-record-for-finding-prime-number-factors/&quot; rel=&quot;noreferrer&quot;&gt;New Scientist News&lt;/a&gt;, the &lt;a href=&quot;https://www.zapatacomputing.com/&quot; rel=&quot;noreferrer&quot;&gt;Zapata team&lt;/a&gt; is able to factor 1,099,551,473,989 into its factors 1,048,589 and 1,048,601.&lt;/p&gt;&#xA;&lt;p&gt;According to the New Scientist:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A quantum computing start-up company called Zapata has worked with IBM to develop a new way to factor large numbers, using it on the largest number that has been factored with a quantum computer so far...&lt;/p&gt;&#xA;&lt;p&gt;The future success of the algorithm used could have big implications&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is this new algorithm?&lt;/li&gt;&#xA;&lt;li&gt;How many q-bits are required to factor 1,099,551,473,989?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4866" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2019-12-17T14:07:04.790" Title="The algorithm of the new quantum factoring record 1,099,551,473,989" Tags="&lt;algorithm&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="9205" PostTypeId="1" AcceptedAnswerId="9208" CreationDate="2019-12-14T18:36:59.500" Score="1" ViewCount="171" Body="&lt;p&gt;I was checking the limits of shots in IBMQ at the time of execution of the circuit so I was getting this error message &lt;code&gt;Job Status: job incurred error&lt;/code&gt; at &lt;code&gt;shots = 9000&lt;/code&gt; what does it mean is there any limit at the no. of shots or it just some module failure &lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="26" LastEditDate="2019-12-14T19:45:29.417" LastActivityDate="2019-12-15T01:15:54.650" Title="Job Status: job incurred error" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9206" PostTypeId="2" ParentId="9204" CreationDate="2019-12-14T18:50:12.060" Score="12" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is this new algorithm?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's the &lt;a href=&quot;https://arxiv.org/abs/1808.08927&quot; rel=&quot;noreferrer&quot;&gt;Variational Quantum Factoring&lt;/a&gt; algorithm that the team put up on arXiv last year. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How many q-bits are required to factor 1,099,551,473,989?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Doesn't seem like they've published that yet, but you should be able to estimate the upper bound from FIG. 1 of the paper; the scaling is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(n_m)$&lt;/span&gt; when classical preprocessing is used. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jpDGo.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jpDGo.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-15T01:11:01.217" LastActivityDate="2019-12-15T01:11:01.217" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9207" PostTypeId="2" ParentId="9204" CreationDate="2019-12-14T22:29:54.313" Score="12" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How many q-bits are required to factor 1,099,551,473,989?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They preprocessed down to three qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JSe4s.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JSe4s.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-12-14T22:29:54.313" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9208" PostTypeId="2" ParentId="9205" CreationDate="2019-12-15T01:15:54.650" Score="2" Body="&lt;p&gt;The limit for shots on devices is 8192. For simulators it is much higher. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-12-15T01:15:54.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9209" PostTypeId="1" CreationDate="2019-12-15T02:54:05.573" Score="2" ViewCount="403" Body="&lt;p&gt;I am trying to run multiple circuits in parallel using the documentation &lt;a href=&quot;https://qiskit.org/documentation/api/qiskit.providers.aer.QasmSimulator.html?highlight=qasm%20simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. My codes are:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit.quantumregister import QuantumRegister&#xA;from qiskit.circuit.classicalregister import ClassicalRegister&#xA;from qiskit import Aer, execute&#xA;from qiskit.providers.aer.backends import QasmSimulator&#xA;&#xA;def apply_measurement(circ):&#xA;    c = ClassicalRegister(len(circ.qubits), 'c')&#xA;    meas = QuantumCircuit(circ.qregs[0], c)&#xA;    meas.barrier(circ.qubits)&#xA;    meas.measure(circ.qubits,c)&#xA;    qc = circ+meas&#xA;    return qc&#xA;&#xA;qr = QuantumRegister(4)&#xA;circ = QuantumCircuit(qr)&#xA;for i in range(4):&#xA;    for j in range(i+1,4):&#xA;        circ.cx(i,j)&#xA;&#xA;qc = apply_measurement(circ)&#xA;circuits = [qc for i in range(3)]&#xA;num_shots = int(1e6)&#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;backend_options = {'method': 'automatic','max_parallel_threads':1,'max_parallel_experiments':1,'max_parallel_shots':1}&#xA;noiseless_qasm_result = execute(circuits, backend, shots=num_shots, backend_options=backend_options).result()&#xA;print(noiseless_qasm_result)&#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;backend_options = {'method': 'automatic','max_parallel_threads':1,'max_parallel_experiments':3,'max_parallel_shots':1}&#xA;noiseless_qasm_result = execute(circuits, backend, shots=num_shots, backend_options=backend_options).result()&#xA;print(noiseless_qasm_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where I am running three copies of the same circuit. I did not see any changes in the &lt;code&gt;result&lt;/code&gt; object obtained, nor is there any runtime improvement. Both take about 10 seconds. What should be the proper way to run those three circuits in parallel?&lt;/p&gt;&#xA;" OwnerUserId="8950" LastActivityDate="2019-12-15T03:36:13.923" Title="How to use parallel executions of circuits?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9210" PostTypeId="2" ParentId="9209" CreationDate="2019-12-15T03:36:13.923" Score="2" Body="&lt;p&gt;Try changing your &lt;code&gt;max_parallel_threads&lt;/code&gt; value to more than 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quoting from the &lt;a href=&quot;https://qiskit.org/documentation/api/qiskit.providers.aer.QasmSimulator.html?highlight=qasm%20simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;code&gt;max_parallel_threads&lt;/code&gt; (int): Sets the maximum number of CPU cores&#xA;  used by OpenMP for parallelization. If set to 0 the maximum will be&#xA;  set to the number of CPU cores (Default: 0).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;code&gt;max_parallel_experiments&lt;/code&gt; (int): Sets the maximum number of qobj&#xA;  experiments that may be executed in parallel up to the&#xA;  max_parallel_threads value. If set to 1 parallel circuit execution&#xA;  will be disabled. If set to 0 the maximum will be automatically set to&#xA;  max_parallel_threads (Default: 1).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8852" LastActivityDate="2019-12-15T03:36:13.923" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9213" PostTypeId="1" CreationDate="2019-12-15T05:34:53.603" Score="0" ViewCount="62" Body="&lt;p&gt;Quantum gates rotate qbit around bloch sphere? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or quantum gates rotate bloch sphere around qbit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;The simplest quantum gates are the Paulis: X, Y and Z. Their action is to perform a half rotation of the Bloch sphere around the x, y and z axes.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does it means?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastActivityDate="2019-12-15T05:57:30.733" Title="Quantum gates rotate qbit around bloch sphere? Or quantum gates rotate bloch sphere around qbit?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9214" PostTypeId="2" ParentId="9213" CreationDate="2019-12-15T05:57:30.733" Score="1" Body="&lt;p&gt;Bloch sphere represent states of a qubit. Rotating Bloch sphere means rotating (states of) qubit.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-15T05:57:30.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9216" PostTypeId="2" ParentId="9204" CreationDate="2019-12-15T09:31:44.460" Score="38" Body="&lt;p&gt;The claimed new quantum factoring record is &lt;span class=&quot;math-container&quot;&gt;$n=a(a+b)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$a=1048589=2^{20}+13$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b=12$&lt;/span&gt;. It could well be that the form &lt;span class=&quot;math-container&quot;&gt;$n=a(a+b)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0\le b\le12$&lt;/span&gt; (or other small upper bound for &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;) defines all the sizable numbers the new record-claiming method can factor (with the indicated &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubits on the hardware at hand and the ∼30% success rate, based on the &lt;a href=&quot;https://i.stack.imgur.com/JSe4s.png&quot; rel=&quot;noreferrer&quot;&gt;picture&lt;/a&gt; in that &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9207/2545&quot;&gt;answer&lt;/a&gt;). Such &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; are scarce: their proportion near &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; thins out as &lt;span class=&quot;math-container&quot;&gt;$6.5/\sqrt n+\mathcal o(1/\sqrt n)$&lt;/span&gt; &lt;sup&gt;[*]&lt;/sup&gt;. The method lacks generality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Further, the factor &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; of such &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is effortlessly found using &lt;a href=&quot;https://en.wikipedia.org/wiki/Fermat%27s_factorization_method&quot; rel=&quot;noreferrer&quot;&gt;Fermat's factorization method&lt;/a&gt; (exposed in a &lt;a href=&quot;http://www.bibnum.education.fr/sites/default/files/texte_fermat.pdf#page=4&quot; rel=&quot;noreferrer&quot;&gt;fragment of letter&lt;/a&gt; likely to Mersenne circa 1643). If &lt;span class=&quot;math-container&quot;&gt;$n=a(a+b)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0\le b\le2\sqrt a$&lt;/span&gt; (a much larger class of integers), only the first step of Fermat's factoring is required (for all except very small &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;): compute &lt;span class=&quot;math-container&quot;&gt;$r=\bigl\lceil\sqrt{4n}\,\bigr\rceil$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$a=(r-\sqrt{r^2-4n})/2$&lt;/span&gt;. That's enough to factor &lt;strong&gt;1099551473989&lt;/strong&gt; by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://i.stack.imgur.com/JSe4s.png&quot; rel=&quot;noreferrer&quot;&gt;picture&lt;/a&gt; and that &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9206/2545&quot;&gt;other answer&lt;/a&gt; refer to Eric R. Anschuetz, Jonathan P. Olson, Alán Aspuru-Guzik, Yudong Cao's &lt;a href=&quot;https://arxiv.org/pdf/1808.08927&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Variational Quantum Factoring&lt;/em&gt;&lt;/a&gt; (&lt;a href=&quot;https://arxiv.org/abs/1808.08927&quot; rel=&quot;noreferrer&quot;&gt;arXiv:808.08927&lt;/a&gt;, Aug 2018). That reduces factorization to a combinatorial problem with number of unknowns proportional to the bit length of the factors. I find nothing suggesting the preprocessing makes that sublinear in the general case, and conclude that Variational Quantum Factoring is exponential in the bit length of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, thus essentially pointless since we have sub-exponential algorithms for factorization on classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar stunts of stretching to artificially large numbers what an experimental setup allows have already been pulled. Take the record of &lt;strong&gt;143&lt;/strong&gt;=11×13 by Nanyang Xu, Jing Zhu, Dawei Lu, Xianyi Zhou, Xinhua Peng, and Jiangfeng Du in &lt;a href=&quot;https://arxiv.org/abs/1111.3726&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Quantum Factorization of 143 on a Dipolar-Coupling Nuclear Magnetic Resonance System&lt;/em&gt;&lt;/a&gt; (&lt;a href=&quot;https://doi.org/10.1103/PhysRevLett.108.130501&quot; rel=&quot;noreferrer&quot;&gt;Physical Review Letters&lt;/a&gt;, 2012). Their experimental technique factors an integer product of two odd exactly-4-bit integers (thus with two unknown bits per factor). The scarcity of primes in range [8,15] makes 143 the only product of two distinct primes that the technique can factor. Their experimental setup iteratively minimizes a function with a 2-bit input. This achievement (I'm &lt;em&gt;not&lt;/em&gt; joking up to this point) has been stretched, without new experiment AFAIK, to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;56153&lt;/strong&gt;=233×241 by Nikesh S. Dattani and Nathaniel Bryans, &lt;em&gt;Quantum factorization of 56153 with only 4 qubits&lt;/em&gt; (&lt;a href=&quot;https://arxiv.org/abs/1411.6758&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1411.6758&lt;/a&gt;, 2014)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;4088459&lt;/strong&gt;=2017×2027, by Avinash Dash, Deepankar Sarmah, Bikash K. Behera, and Prasanta K. Panigrahi, &lt;em&gt;Exact search algorithm to factorize large biprimes and a triprime on IBM quantum computer&lt;/em&gt; (&lt;a href=&quot;https://arxiv.org/abs/1805.10478&quot; rel=&quot;noreferrer&quot;&gt;arXiv:1805.10478&lt;/a&gt;, May 2018) &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;383123885216472214589586724601136274484797633168671371&lt;/strong&gt;=618970019642690137449562081×618970019642690137449562091 by myself (&lt;a href=&quot;https://crypto.stackexchange.com/a/59796/555&quot;&gt;crypto.SE&lt;/a&gt;, June 2018), using the technique of the above paper.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[*]&lt;/sup&gt; Proof: for each &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, there are &lt;span class=&quot;math-container&quot;&gt;$13$&lt;/span&gt; values of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; leading to &lt;span class=&quot;math-container&quot;&gt;$13$&lt;/span&gt; values of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of the form &lt;span class=&quot;math-container&quot;&gt;$n=a(a+b)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0\le b\le12$&lt;/span&gt;. For large enough &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; there are no two &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt; leading to the same &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&lt;sup&gt;[#]&lt;/sup&gt;. When we increase &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; increases by &lt;span class=&quot;math-container&quot;&gt;$2n+1$&lt;/span&gt;. Taking the inverse, the density of squares near large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\displaystyle\frac1{2\sqrt n}+\mathcal o(\sqrt n)$&lt;/span&gt;. Thus the density of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of the form &lt;span class=&quot;math-container&quot;&gt;$a(a+b)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0\le b\le12$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\displaystyle\frac{13}{2\sqrt n}+\mathcal o(1/\sqrt n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;[#]&lt;/sup&gt; Auxiliary proof: Assume &lt;span class=&quot;math-container&quot;&gt;$a(a+b)=a'(a'+b')$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$0\le b\le12$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0\le b'\le12$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$c=2a-b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c'=2a'-b'$&lt;/span&gt;. It comes &lt;span class=&quot;math-container&quot;&gt;$(c-b)(c+b)/4=(c'-b')(c'+b')/4$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$c^2-b^2=c'^2-b'^2$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$c^2-c'^2=b^2-b'^2$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$|(c-c')(c+c')|\le144$&lt;/span&gt;, thus for &lt;span class=&quot;math-container&quot;&gt;$c\ge72$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c'\ge72$&lt;/span&gt; the only solution is &lt;span class=&quot;math-container&quot;&gt;$c=c'$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$b=b'$&lt;/span&gt;. Thus for &lt;span class=&quot;math-container&quot;&gt;$a\ge42$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a'\ge42$&lt;/span&gt; the only solution is &lt;span class=&quot;math-container&quot;&gt;$a=a'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b=b'$&lt;/span&gt;. The bound on &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; can be further lowered.&lt;/p&gt;&#xA;" OwnerUserId="2545" LastEditorUserId="2545" LastEditDate="2019-12-17T06:34:24.000" LastActivityDate="2019-12-17T06:34:24.000" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9217" PostTypeId="1" AcceptedAnswerId="9218" CreationDate="2019-12-15T10:06:33.067" Score="0" ViewCount="452" Body="&lt;p&gt;I am new in quantum computing. I was going through the user guide of IBM Q so I was just trying to run the python code they have provided at the end of this page &lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/user-guide?page=5ddb06595d640300671cc615&quot; rel=&quot;nofollow noreferrer&quot;&gt;enter link description here&lt;/a&gt; while runnig the code this error pop up &quot; run() got an unexpected keyword argument 'seed' &quot; I don't know what this 'seed' parameter do please help me to solve this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case feeling lazy to find the code in given link I have put the code blow&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; # example_u3.py&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer&#xA;&#xA;# Define the Quantum and Classical Registers&#xA;q = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;&#xA;# Build the circuits&#xA;circuits = []&#xA;middle = QuantumCircuit(q, c)&#xA;meas = QuantumCircuit(q, c)&#xA;meas.barrier()&#xA;meas.measure(q, c)&#xA;exp_vector = range(0,50)&#xA;exp_theta = []&#xA;theta = 0.0&#xA;for exp_index in exp_vector:&#xA;    delta_theta = 2*np.pi/len(exp_vector)&#xA;    theta = theta + delta_theta&#xA;    exp_theta.append(theta)&#xA;    middle.u3(delta_theta,0,0,q)&#xA;    circuits.append(middle + meas)&#xA;&#xA;# Execute the circuits&#xA;shots = 1024&#xA;job = execute(circuits, backend = Aer.get_backend('qasm_simulator'), shots=shots, seed=8)&#xA;result = job.result()&#xA;&#xA;# Plot the result&#xA;exp_data = []&#xA;exp_error = []&#xA;for exp_index in exp_vector:&#xA;    data = result.get_counts(circuits[exp_index])&#xA;    try:&#xA;        p0 = data['0']/shots&#xA;    except KeyError:&#xA;        p0 = 0&#xA;    exp_data.append(p0)&#xA;    exp_error.append(np.sqrt(p0*(1-p0)/shots))&#xA;&#xA;plt.errorbar(exp_theta, exp_data, exp_error)&#xA;plt.xlabel('theta')&#xA;plt.ylabel('Pr(0)')&#xA;plt.grid(True)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="26" LastEditDate="2019-12-15T12:18:31.100" LastActivityDate="2019-12-15T22:45:33.120" Title="run() got an unexpected keyword argument 'seed'" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9218" PostTypeId="2" ParentId="9217" CreationDate="2019-12-15T10:18:16.467" Score="5" Body="&lt;p&gt;The &lt;code&gt;seed&lt;/code&gt; parameter has been split into two parameters - &lt;code&gt;seed_simulator&lt;/code&gt; and &lt;code&gt;seed_transplier&lt;/code&gt;. These ensure that if you run the simulator or transplier respectively you will recieve the same results every time, which is good for replicability. If this is not a property you need, you can remove this paramter all together so that the line reads&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(circuits, backend=Aer.get_backend('qasm_simulator'), shots=shots)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2019-12-15T22:45:33.120" LastActivityDate="2019-12-15T22:45:33.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9219" PostTypeId="1" AcceptedAnswerId="9237" CreationDate="2019-12-15T15:20:50.240" Score="0" ViewCount="168" Body="&lt;p&gt;Why doesn't Qiskit visualization work on Python IDLE 3.X like &lt;code&gt;circuits.draw()&lt;/code&gt;, &lt;code&gt;plot_histogram()&lt;/code&gt; and &lt;code&gt;plot_bloch_vector()&lt;/code&gt;? Is there any way to make visualization module work on Python IDLE 3.X?&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="6180" LastEditDate="2019-12-16T16:26:09.220" LastActivityDate="2019-12-16T23:01:57.640" Title="How to use Qiskit visualization in Python IDLE 3.X (Python 3.X 64-bit)?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-12-17T21:08:43.320" ContentLicense="CC BY-SA 4.0" />
  <row Id="9220" PostTypeId="1" CreationDate="2019-12-15T17:04:52.250" Score="-1" ViewCount="71" Body="&lt;p&gt;From my circuits in ibm q the final output is given by only a single qbit Which gives state |ψ⟩&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Tell me a combination of gates to do the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If  |ψ⟩ = |0⟩&#xA; Then output |0⟩&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If |ψ⟩=α|0⟩+β|1⟩&#xA;  Then output |1⟩&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If |ψ⟩=|1⟩&#xA;  Then output |1⟩&lt;/p&gt;&#xA;" OwnerUserId="9495" LastEditorUserId="55" LastEditDate="2020-07-26T18:08:56.177" LastActivityDate="2020-07-26T18:08:56.177" Title="Which gate combination should I use?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2019-12-28T18:33:34.010" ContentLicense="CC BY-SA 4.0" />
  <row Id="9221" PostTypeId="2" ParentId="9220" CreationDate="2019-12-15T17:46:24.407" Score="0" Body="&lt;p&gt;In first and last case you don't need to apply any gate directly measure the qubit you will get desire answer but in the second case you can't get |1⟩ state because your |ψ⟩ is in superposition of |0⟩, |1⟩. If you try to measure the |ψ⟩ you will get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;. The code below shows your second case.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as q&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;circuit = q.QuantumCircuit(2,1) &#xA;circuit.h(0)&#xA;circuit.measure([0],[0])&#xA;job = execute(circuit, backend = Aer.get_backend('qasm_simulator'), shots=1024)&#xA;result = job.result()&#xA;counts = result.get_counts(circuit)&#xA;print(counts)&#xA;circuit.draw()&#xA;plot_histogram([counts], legend=['Device'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or you can do it like this with little manipulation.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as q&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;circuit = q.QuantumCircuit(2,1) &#xA;circuit.x(0)&#xA;circuit.h(0)&#xA;circuit.h(0)&#xA;circuit.measure([0],[0])&#xA;job = execute(circuit, backend = Aer.get_backend('qasm_simulator'), shots=1024)&#xA;result = job.result()&#xA;counts = result.get_counts(circuit)&#xA;print(counts)&#xA;circuit.draw()&#xA;plot_histogram([counts], legend=['Device'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="9006" LastEditDate="2019-12-15T19:35:30.853" LastActivityDate="2019-12-15T19:35:30.853" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9222" PostTypeId="1" CreationDate="2019-12-15T18:30:31.593" Score="3" ViewCount="206" Body="&lt;p&gt;I take as a starting point Watrous's celebrated &lt;a href=&quot;https://arxiv.org/abs/cs/0009002&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; defining the Quantum Merlin-Arthur (QMA) class.   He provides a protocol for Arthur to test whether an element &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; in a group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; with generating set &lt;span class=&quot;math-container&quot;&gt;$\langle g_1,g_2,\cdots, g_k\rangle$&lt;/span&gt;.  Merlin gives Arthur a quantum state &lt;span class=&quot;math-container&quot;&gt;$\vert\mathcal{H'}\rangle$&lt;/span&gt; that is alleged to be a pure state corresponding to the uniform superposition over all elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\mathcal H'\rangle = \frac{1}{\sqrt{|\mathcal H|}}\sum_{a\in&#xA; \mathcal{H}} |a\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Arthur must test that Merlin really &lt;em&gt;did&lt;/em&gt; provide such a state &lt;span class=&quot;math-container&quot;&gt;$\vert\mathcal{H'}\rangle$&lt;/span&gt;.  He does this by initially performing &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; iterations of a controlled multiplication of &lt;span class=&quot;math-container&quot;&gt;$\vert\mathcal{H'}\rangle$&lt;/span&gt; by elements known to be in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;, and testing that the control register reverts back to &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; after Hadamarding.  Watrous states that as long as we can post-select upon measuring &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; in the control register, the state &lt;span class=&quot;math-container&quot;&gt;$\vert \mathcal{H'}\rangle$&lt;/span&gt; &quot;will in fact be changed (by quantum magic!) to one that is invariant under right multiplication by elements in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to these &lt;a href=&quot;https://www.cs.cmu.edu/~odonnell/quantum15/&quot; rel=&quot;nofollow noreferrer&quot;&gt;notes&lt;/a&gt; from O'Donnell, it might suffice to uniformly choose &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; generators &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\langle g_1,g_2,\cdots, g_k\rangle$&lt;/span&gt;.  That is, if initially &lt;span class=&quot;math-container&quot;&gt;$\vert \mathcal{H'}\rangle=\sum_{g\in\mathcal{G}}a_g\vert g\rangle$&lt;/span&gt;, then upon multiplying by &lt;span class=&quot;math-container&quot;&gt;$z_1$&lt;/span&gt; and post-selecting &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; on the control register for the first of the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; iterations, our state is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert \mathcal{H'}\rangle=\sum_{g\in\mathcal{G}}a_g\vert g\rangle + a_g\vert gz_1\rangle;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;upon multiplying by &lt;span class=&quot;math-container&quot;&gt;$z_2$&lt;/span&gt; and post-selecting &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; on the control register for the second iteration, our state is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert \mathcal{H'}\rangle=\sum_{g\in\mathcal{G}}a_g\vert g\rangle + a_g\vert  gz_1\rangle+a_g\vert gz_2\rangle+a_g\vert gz_1z_2\rangle;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, &lt;span class=&quot;math-container&quot;&gt;$\vert \mathcal{H'}\rangle$&lt;/span&gt; may initially correspond to a &lt;em&gt;singleton&lt;/em&gt; state such as the state &lt;span class=&quot;math-container&quot;&gt;$\vert e \rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt; is the identity of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;.  Our probability of post-selecting &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; in the control register appears to increase with each iteration - it may start off low, at &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;, then with &quot;quantum magic,&quot; increase to greater and greater than &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\vert\mathcal{H'}\rangle$&lt;/span&gt; includes most elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;, then settle close to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\vert\mathcal{H'}\rangle$&lt;/span&gt; is finally right-invariant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If we did start off with such a singleton state &lt;span class=&quot;math-container&quot;&gt;$\vert\mathcal{H'}\rangle=\vert e\rangle$&lt;/span&gt;, how many such iterations must we do to be able to post-select a state that is exponentially close to being right-invariant under elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;, and what is our probability of successfully post-selecting such a state?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In his wonderful &lt;a href=&quot;https://www.youtube.com/watch?v=D1cZbRvBMqY&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; from 2012 at about the 25 minute mark, Watrous proposes that &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; should be linear or at best quadratic in &lt;span class=&quot;math-container&quot;&gt;$\log \Vert \mathcal{H}\Vert$&lt;/span&gt; and mentions that the generators should be &quot;cube generators&quot; having nice properties according to computational group theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the case of starting off in a singleton state such as &lt;span class=&quot;math-container&quot;&gt;$\vert e\rangle$&lt;/span&gt;, can we learn anything about the properties of the specific set of generators &lt;span class=&quot;math-container&quot;&gt;$\langle g_1,g_2,\cdots, g_k\rangle$&lt;/span&gt; by post-selecting to try and build our own uniform superposition?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-01-23T21:47:07.750" LastActivityDate="2020-08-08T01:40:04.730" Title="On the probability of preparing of a uniform superposition by performing a controlled-multiplication and post-selecting $0$" Tags="&lt;mathematics&gt;&lt;complexity-theory&gt;&lt;qma&gt;&lt;postselection&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9224" PostTypeId="1" AcceptedAnswerId="9226" CreationDate="2019-12-15T20:02:25.373" Score="2" ViewCount="393" Body="&lt;p&gt;I have tried to plot a histogram for the multiple circuits for the code given below. I think I have done it correctly but don't know why it's not working. Please help me out. If possible please solve it for the Bloch sphere also &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# quantum_phase_bloch.py&#xA;import numpy as np&#xA;from qiskit.visualization import plot_histogram&#xA;from qiskit.tools.monitor import job_monitor&#xA;from matplotlib import style&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer&#xA;from qiskit.tools.visualization import plot_bloch_vector&#xA;&#xA;# Define the Quantum and Classical Registers&#xA;q = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;&#xA;# Build the circuits&#xA;pre = QuantumCircuit(q, c)&#xA;pre.h(q)&#xA;pre.barrier()&#xA;&#xA;meas_x = QuantumCircuit(q, c)&#xA;meas_x.barrier()&#xA;meas_x.h(q)&#xA;meas_x.measure(q, c)&#xA;&#xA;meas_y = QuantumCircuit(q, c)&#xA;meas_y.barrier()&#xA;meas_y.s(q).inverse()&#xA;meas_y.h(q)&#xA;meas_y.measure(q, c)&#xA;&#xA;meas_z = QuantumCircuit(q, c)&#xA;meas_z.barrier()&#xA;meas_z.measure(q, c)&#xA;&#xA;bloch_vector = ['x', 'y', 'z']&#xA;exp_vector = range(0, 2)&#xA;circuits = []&#xA;print(len(exp_vector))&#xA;for exp_index in exp_vector:&#xA;    middle = QuantumCircuit(q, c)&#xA;    phase = 2*np.pi*exp_index/(len(exp_vector)-1)&#xA;    middle.u1(phase, q)&#xA;    circuits.append(pre + middle + meas_x)&#xA;    circuits.append(pre + middle + meas_y)&#xA;    circuits.append(pre + middle + meas_z)&#xA;print(len(circuits))&#xA;&#xA;# Execute the circuit&#xA;job = execute(circuits, backend = Aer.get_backend('qasm_simulator'), shots=1024)&#xA;result = job.result()&#xA;&#xA;# trying to plot histogram &#xA;counts = []&#xA;# count = np.zeros([0])&#xA;&#xA;for x in range(len(circuits)):&#xA;#     count[x] = result.get_counts(circuits[x])&#xA;    count = result.get_counts(circuits[x])&#xA;    counts.append(count)&#xA;&#xA;plot_histogram(counts , legend=['1','2','3','4','5','6'])&#xA;print(counts)    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="26" LastEditDate="2019-12-16T14:12:02.027" LastActivityDate="2019-12-16T14:12:02.027" Title="How to plot histogram or Bloch sphere for multiple circuits?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9225" PostTypeId="2" ParentId="9168" CreationDate="2019-12-15T20:23:47.827" Score="-1" Body="&lt;p&gt;No,It is impossible to copy the quantum information according to &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;No-cloning theorem&lt;/a&gt;. If anyone try to copy or measure the states of qubits the previous information will be lost.So no one can spy. This is the backbone of the Quantum-cryptography&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="8527" LastEditDate="2020-05-09T18:02:10.797" LastActivityDate="2020-05-09T18:02:10.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9226" PostTypeId="2" ParentId="9224" CreationDate="2019-12-15T22:54:56.533" Score="3" Body="&lt;p&gt;No output shows for your code as you have a line underneath the call to &lt;code&gt;plot_histogram()&lt;/code&gt;. This should be the last line of the section in the Jupyter notebook if you would like the image to be displayed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to run your code by removing the final line (&lt;code&gt;print(counts)&lt;/code&gt;) and it displayed the histogram below.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FOMHR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FOMHR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-15T22:54:56.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9227" PostTypeId="1" CreationDate="2019-12-16T07:55:58.980" Score="0" ViewCount="91" Body="&lt;p&gt;I know this forum is for more technical questions...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As my interest is in music, I was thinking about the nature of analog and digital mediums. And I just thought, for some reason, we have 'Quantum Home Computers', (which I don't know if happens) would we have to encode all existing audio formats? And if for some reason we couldn't, would we need a quantum to digital to analog converter? How would sound work on Quantum Computers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dumb questions, I don't want to waste any of your time with, but how would audio work on quantum computers as a whole? &lt;/p&gt;&#xA;" OwnerUserId="9500" LastEditorUserId="55" LastEditDate="2020-08-20T08:07:30.950" LastActivityDate="2020-08-20T08:07:30.950" Title="Will there be quantum to digital converters in the same way we need digital to analog converters to communicate between the 2 mediums?" Tags="&lt;applications&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9228" PostTypeId="2" ParentId="9220" CreationDate="2019-12-16T08:38:42.703" Score="3" Body="&lt;p&gt;As you've specified it, given a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, there is no deterministic strategy that can fulfil all three conditions that you specify.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you imply that what you actually have is a unitary procedure &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to create &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle=|\psi\rangle$&lt;/span&gt;. This means that you can, in fact, do what you ask. It's called amplitude amplification. Basically, the Grover iterator that you need is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^\dagger ZUZ,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is the standard Pauli Z matrix. You haven't specified if &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is a known or unknown parameter. If it's known, you just need to run the thing &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; times where &lt;span class=&quot;math-container&quot;&gt;$(2R+1)\theta\approx\pi/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin\theta=\beta$&lt;/span&gt; to at least get close. If you don't know &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, there's a version of the protocol which includes phase estimation, which helps you do the job.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-16T08:38:42.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9229" PostTypeId="1" CreationDate="2019-12-16T15:38:14.027" Score="3" ViewCount="42" Body="&lt;p&gt;Different qubit technologies exist and for each, operations are implemented differently. My question is what the typical times are for the standard gates (single qubit rotations, Hadamard, CNOT, T, Toffoli, etc.) for the most common qubit technologies? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, as quantum technology advances, improvements are expected in qubit coherence times among other things. Is there a limit and if so, what is it, on the gate times of above? &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2019-12-16T15:38:14.027" Title="Gate times for different qubit technologies" Tags="&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9230" PostTypeId="1" AcceptedAnswerId="9232" CreationDate="2019-12-16T15:56:07.710" Score="3" ViewCount="131" Body="&lt;p&gt;Many works on quantum algorithms, including &lt;a href=&quot;https://doi.org/10.1103/PhysRevA.100.012305&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;, mention&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;a compiled version of (Shor's factoring) algorithm&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's a compiled quantum algorithm?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sub&gt;Meta: and is it worth to create a tag for that? I don't have the required rep.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="2545" LastActivityDate="2019-12-16T18:14:44.517" Title="What's a compiled quantum algorithm?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9231" PostTypeId="1" CreationDate="2019-12-16T16:41:34.467" Score="3" ViewCount="136" Body="&lt;p&gt;Here are two different IBM quantum online devices,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6KX2V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6KX2V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SjrDp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SjrDp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both of them have the 5 qubits and the same architectures.&#xA;But why do they have different error rate?&#xA;What's the different between them?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="26" LastEditDate="2019-12-16T18:31:14.377" LastActivityDate="2019-12-16T21:59:54.403" Title="Why IBM devices have the same number of qubit and the same architecture, but the error rates are different?" Tags="&lt;ibm-q-experience&gt;&lt;architecture&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9232" PostTypeId="2" ParentId="9230" CreationDate="2019-12-16T17:17:57.417" Score="4" Body="&lt;p&gt;The Nature paper &lt;a href=&quot;https://www.nature.com/articles/nature12290&quot; rel=&quot;nofollow noreferrer&quot;&gt;Oversimplifying quantum factoring&lt;/a&gt; explains the concept well. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;All experimental realizations of Shor’s algorithm to date have relied on a further optimization, that of “compiling” the algorithm. This means employing the observation that different bases &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in the modular exponentiation lead to different periods of the function &lt;span class=&quot;math-container&quot;&gt;$a^x \bmod N$&lt;/span&gt;. Some of the periods are both short and lead to a factorization of the composite &lt;span class=&quot;math-container&quot;&gt;$pq$&lt;/span&gt;. [&lt;a href=&quot;https://arxiv.org/abs/1301.7007&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv:1301.7007&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For instance, in &lt;a href=&quot;https://www.nature.com/articles/nphoton.2012.259&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; the authors claim having done the factorization of &lt;span class=&quot;math-container&quot;&gt;$21$&lt;/span&gt; using Shor's algorithm. But the catch is that they had to use the fact that &lt;span class=&quot;math-container&quot;&gt;$21 = 3 \times 7$&lt;/span&gt; to choose an &quot;easy&quot; base &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. So it's not factorization of &lt;span class=&quot;math-container&quot;&gt;$21$&lt;/span&gt; in the true sense; they only &lt;em&gt;verified&lt;/em&gt; the factors. Thus, the qubits needed drastically reduced from &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; (i.e., &lt;span class=&quot;math-container&quot;&gt;$2 + (3/2)\log N$&lt;/span&gt;, per &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0601097&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zalka&lt;/a&gt;) to only &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits! The compilation procedure was also implemented for the &lt;a href=&quot;https://www.nature.com/articles/414883a&quot; rel=&quot;nofollow noreferrer&quot;&gt;2001 factorization&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is absolutely crucial to note the following comment by &lt;a href=&quot;https://arxiv.org/abs/1301.7007&quot; rel=&quot;nofollow noreferrer&quot;&gt;Smolin &lt;em&gt;et al.&lt;/em&gt;&lt;/a&gt; here.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Of course this should not be considered a serious demonstration of Shor’s algorithm. It does, however, illustrate the danger in “compiled” demonstrations of Shor’s algorithm. To varying degrees,&#xA;  all previous factorization experiments have benefited from this artifice. While there is no objection to having a classical compiler help design a quantum circuit (indeed, probably all quantum computers will function in this way), it is not legitimate for a compiler to know the answer to the problem being solved. To even call such a procedure compilation is an abuse of language.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-16T18:14:44.517" LastActivityDate="2019-12-16T18:14:44.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9233" PostTypeId="2" ParentId="9231" CreationDate="2019-12-16T18:29:54.160" Score="9" Body="&lt;p&gt;They have different error rates because they are two different physical devices! This relates to the manufacturing processes of these chips. Every device is unique and will have its own fingerprint meaning its own error rate. Of course this is not something that manufactures do on purpose, but a side effect of making these qubit devices. It’s very difficult to make two quantum chips completely identical!&lt;/p&gt;&#xA;" OwnerUserId="2136" LastActivityDate="2019-12-16T18:29:54.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9235" PostTypeId="2" ParentId="9231" CreationDate="2019-12-16T21:59:54.403" Score="3" Body="&lt;p&gt;I would add that thermic noise, radiocative background (mainly cosmic rays) can play role in different error rate as those noise sources are different for each quantum processor. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, as a user of IBM Q, you probably know that quantum processors are sometimes under maintenance. Since each processor is maintained in different time, their runtime is also different and this can influence error rate as well.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-16T21:59:54.403" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9236" PostTypeId="1" AcceptedAnswerId="9239" CreationDate="2019-12-16T22:15:55.577" Score="2" ViewCount="145" Body="&lt;p&gt;It is well known that any operation on a quantum computer is described with a unitary matrix (a quantum gate) because quantum computing is reversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Only non-reversible operation is a measurement of a qubit. Therefore, I would expect that the measurement can be described by a non-unitary matrix (or even by matrix that is not invertible).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A result of the measurement should be a probability distribution of all possible states of measured qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; How does a matrix representing measurement of qubit(s) look like?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-17T04:11:31.817" Title="Matrix representation of a measurement" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9237" PostTypeId="2" ParentId="9219" CreationDate="2019-12-16T23:01:57.640" Score="1" Body="&lt;p&gt;These functions don't automatically display their output, unless you are running the code in a Jupyter notebook. I would recommend you switch over to using a Jupyter notebook if you can (you can do this inside the &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt;) as this will display all the plots for you, as long as the calls to these functions are the last line of the cell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not possible, you can display the circuit using ASCII art by calling &lt;code&gt;print(circuit.draw())&lt;/code&gt; or saving it to a file using &lt;code&gt;circuit.draw(output='mpl', filename='circuit.png')&lt;/code&gt;. As for the other plotting methods, these return matplotlib images so you should be able to see them by doing &lt;code&gt;plt.show()&lt;/code&gt; or save the figure by doing&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bloch = plot_bloch_vector()&#xA;bloch.savefig('bloch.png')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2019-12-16T23:01:57.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9238" PostTypeId="2" ParentId="9236" CreationDate="2019-12-17T01:39:46.773" Score="1" Body="&lt;p&gt;These are called observables, which are unitary hermitian matrices whose eigenvectors are the possible outcomes of the measurement. For example, the observable of the standard computational basis is the Pauli Z operator, and the observable of the sign basis is the Pauli X operator.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-12-17T01:39:46.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9239" PostTypeId="2" ParentId="9236" CreationDate="2019-12-17T03:54:01.230" Score="3" Body="&lt;p&gt;There is no single matrix representing measurement. Projective measurements are represented by a set of orthogonal projectors. For example, measurement of a single qubit in the standard basis is represented by projectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\pi_0=\begin{pmatrix}&#xA;1 &amp;amp;0\\&#xA;0 &amp;amp;0&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\pi_1=\begin{pmatrix}&#xA;0 &amp;amp;0\\&#xA;0 &amp;amp;1&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a qubit was initially in state with density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, then the post-measurement density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho'=\sum_{i=0}^1\pi_i\rho\pi_i$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, probability distribution of possible measurement outcomes can be obtained only by multiple measurements on an ensemble of identical systems; a single measurement gives no information about probabilities of possible measurement outcomes.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2019-12-17T04:11:31.817" LastActivityDate="2019-12-17T04:11:31.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9241" PostTypeId="2" ParentId="9154" CreationDate="2019-12-17T14:59:36.087" Score="2" Body="&lt;p&gt;To start with, let's look at &lt;span class=&quot;math-container&quot;&gt;$$\mathbb I - \frac{1}{n} \sum_{j=1}^n \vert 0_j \rangle \langle 0_j \vert \otimes \mathbb{I}_\bar{j} =\mathbb I -  P.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can rewrite &lt;span class=&quot;math-container&quot;&gt;$$\mathbb I = \frac{1}{n}\sum_{j=1}^n\mathbb I = \frac{1}{n}\sum_{j=1}^n\left(\left|0_j\rangle\langle 0_j\right| + \left|1_j\rangle\langle 1_j\right|\right)\otimes \mathbb I_\bar j$$&lt;/span&gt; to get &lt;span class=&quot;math-container&quot;&gt;$$\mathbb I - P = \frac{1}{n}\sum_{j=1}^n\left|1_j\rangle\langle 1_j\right|\otimes \mathbb I_{\bar j}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a normalised sum of projectors &lt;span class=&quot;math-container&quot;&gt;$$\mathbb I - P =\frac{1}{n}\sum_{j=1}^n\mathbb P_{1,j}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_{1, j}$&lt;/span&gt; projects the &lt;span class=&quot;math-container&quot;&gt;$j^{\text{th}}$&lt;/span&gt; qubit into state &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$\mathbb I - P$&lt;/span&gt; gives the proportion of qubits in state &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;, or more accurately, the expectation value of &lt;span class=&quot;math-container&quot;&gt;$\mathbb I-P$&lt;/span&gt; with respect to some state gives the expected proportion of qubits to return &lt;span class=&quot;math-container&quot;&gt;$'1'$&lt;/span&gt; when that state is measured. Equivalently, the expectation value of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the expected proportion of qubits to return &lt;span class=&quot;math-container&quot;&gt;$'0'$&lt;/span&gt; when measured.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;span class=&quot;math-container&quot;&gt;$U\left|0\right&amp;gt; = \left|b\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U\left(\mathbb I - P\right)U^\dagger$&lt;/span&gt; does with &lt;span class=&quot;math-container&quot;&gt;$\left|b\right&amp;gt;$&lt;/span&gt; what &lt;span class=&quot;math-container&quot;&gt;$\mathbb I - P$&lt;/span&gt; does with &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, the difficulty now is that &lt;span class=&quot;math-container&quot;&gt;$\left|b\right&amp;gt;$&lt;/span&gt; can presumably be an entangled state, so explaining this in terms of &quot;expectation value of the proportion of qubits returning &lt;span class=&quot;math-container&quot;&gt;$'1'$&lt;/span&gt; upon measurement&quot; isn't quite so straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, &lt;strong&gt;asking the question 'are you measuring the state &lt;span class=&quot;math-container&quot;&gt;$\left|b\right&amp;gt;$&lt;/span&gt;?', &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;x|H_L|x\right&amp;gt;$&lt;/span&gt; is the expectation value of the proportion of qubits that would return 'no'.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative way of thinking about it that might make more sense in this context is by realising that if &lt;span class=&quot;math-container&quot;&gt;$A\left|x\right&amp;gt; = \left|b\right&amp;gt; = U\left|0\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U^\dagger A\left|x\right&amp;gt; = \left|0\right&amp;gt;$&lt;/span&gt; and so we arrive back at &lt;strong&gt;the expectation value of the proportion of qubits returning &lt;span class=&quot;math-container&quot;&gt;$'1'$&lt;/span&gt; upon measurement of &lt;span class=&quot;math-container&quot;&gt;$U^\dagger A\left|x\right&amp;gt;$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2019-12-17T14:59:36.087" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9242" PostTypeId="1" AcceptedAnswerId="9278" CreationDate="2019-12-18T10:22:13.850" Score="3" ViewCount="200" Body="&lt;p&gt;My questions are probably more about details but the answer will help me to precisely understand the mathematical structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are related to page 14 of &lt;a href=&quot;https://www-m5.ma.tum.de/foswiki/pub/M5/Allgemeines/MichaelWolf/QChannelLecture.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this pdf&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Mathematical context&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have &lt;span class=&quot;math-container&quot;&gt;$H=H_A \otimes H_B$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$d = \mathrm{min}(\dim(H_A), \dim(H_B))$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We call &lt;span class=&quot;math-container&quot;&gt;$|\Omega\rangle = \frac{1}{\sqrt{d}} \sum_i |ii \rangle$&lt;/span&gt; the maximally entangled state.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First question:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For me this state is ill-defined in general. If &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; represent the same physical system (a qubit for example), then it is well defined because if I choose &lt;span class=&quot;math-container&quot;&gt;$|i\rangle = | 0 \rangle$&lt;/span&gt; for the first system, then as the second one is the same, I know that &lt;span class=&quot;math-container&quot;&gt;$|ii\rangle = |00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the two systems are different, for example, a qubit and a harmonic oscillator how do I know how to choose the kets?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could have (first space = qubit, second one = harmonic oscillator):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Omega\rangle = \frac{1}{\sqrt{2}} \left(|+0\rangle + |-1\rangle \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Omega\rangle = \frac{1}{\sqrt{2}} \left(|00\rangle + |11\rangle \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you agree with me that &lt;span class=&quot;math-container&quot;&gt;$|\Omega\rangle$&lt;/span&gt; is an ill-defined state in general? But maybe that it doesn't matter for practical purposes? One of the confusion it gives me is the property that any maximal entangled state is of the form &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I} \otimes U | \Omega \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; being unitary. How to prove it properly if &lt;span class=&quot;math-container&quot;&gt;$|\Omega \rangle$&lt;/span&gt; is ill-defined ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can take a basis &lt;span class=&quot;math-container&quot;&gt;$\{ U_i \}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}_d(\mathbb{C})$&lt;/span&gt; composed of &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; unitary matrices orthogonal with respect to the Hilbert-Schmidt scalar product on matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the family &lt;span class=&quot;math-container&quot;&gt;$\left( U_i \otimes \mathbb{I} \right)| \Omega \rangle$&lt;/span&gt; is composed of &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; orthonormal vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the document, he says that it is a basis of entangled states of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^d \otimes \mathbb{C}^d $&lt;/span&gt;.&#xA;I agree that it matches in terms of dimensions, but why is it a basis of this space precisely? For example, could we say as well it is a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{d^2}$&lt;/span&gt;? In short: is there something to understand in his statement or not really?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2019-12-18T10:47:58.880" LastActivityDate="2019-12-21T16:27:42.813" Title="Maximally entangled state definition, and orthonormal basis of maximally entangled state" Tags="&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9243" PostTypeId="1" AcceptedAnswerId="9379" CreationDate="2019-12-18T15:06:26.033" Score="2" ViewCount="246" Body="&lt;p&gt;In Chapter 6 of &quot;Quantum Computation and Quantum Information&quot; Textbook by Nielsen and Chuang, Exercise 6.12:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Exercise 6.12: (Alternative Hamiltonian for quantum search) Suppose:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$H=|x\rangle\langle ψ|+|ψ\rangle\langle x|$$&lt;/span&gt;&#xA;  (1) Show that it takes time &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(1)$&lt;/span&gt; to rotate from the state &lt;span class=&quot;math-container&quot;&gt;$|ψ\rangle$&lt;/span&gt; to the state &#xA;  &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, given an evolution according to the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;br/&gt;&#xA;  (2) Explain how a quantum simulation of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; may be performed, and determine the number of oracle calls your simulation technique requires to obtain the solution with high probability.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(1) It is ease to get the answer for the first (1) part of the question:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-itH}=e^{-it(|x\rangle\langleψ|+|ψ\rangle\langle x|)}=e^{-it(λ_1|m_1\rangle\langle m_1|+λ_2|m_2\rangle\langle m_2|)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$λ_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$λ_2$&lt;/span&gt; - eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$λ_{1,2} = α±1,$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$α = \langle x|ψ\rangle=1/\sqrt{N}$&lt;/span&gt; and eigenvalues&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$m_1=\frac{1}{\sqrt{2(1+α)}}(|x\rangle+|ψ\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$m_2=\frac{1}{\sqrt{2(1-α)}}(|x\rangle-|ψ\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;therefore &lt;span class=&quot;math-container&quot;&gt;$e^{-itH}=(e^{-it(α+1)}-1)|m_1\rangle\langle m_1|+(e^{-it(α-1)}-1)|m_2\rangle\langle m_2|+1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-itH}|ψ\rangle=e^{-itα}(-i\sin(t)|x\rangle+\cos(t)|ψ\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in order to have &lt;span class=&quot;math-container&quot;&gt;$e^{-itH}|ψ\rangle=|x\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; should be equal to &lt;span class=&quot;math-container&quot;&gt;$$t=\pi/2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;(2)&lt;/strong&gt; Unfortunately i was unable to find an answer to the second part of the question. Could anybody help me?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is well-known how the quantum simulation of the several Hamiltonian can be performed. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=|x\rangle\langle x|+|ψ\rangle\langle ψ|$&lt;/span&gt; the quantum simulation exist in the Nielsen and Chuang Textbook - page 258 paragraph 6.2 and in the article of &lt;em&gt;Farhi and Gutmann An analog analogue of a digital quantum computation.&lt;/em&gt; &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.57.2403&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. A, 57(4):2403–2406, 1998&lt;/a&gt; &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9612026&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv e-print quant-ph/9612026&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=2iα(|x\rangle\langle ψ|-|ψ\rangle\langle x|)$&lt;/span&gt; the quantum simulation described in the article of &lt;em&gt;Stephen A. Fenner&#xA;An intuitive Hamiltonian for quantum search&lt;/em&gt; &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0004091&quot; rel=&quot;nofollow noreferrer&quot;&gt;May 2000 ArXiv&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=|x\rangle\langle ψ|+|ψ\rangle\langle x|)$&lt;/span&gt; I found only the general description of the possibility to use it in the quantum search &lt;em&gt;Generalized Quantum Search Hamiltonian. Joonwoo Bae, Younghun Kwon.&lt;/em&gt; &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0110020&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0110020&lt;/a&gt; and didn't find the answer how the quantum simulation can be performed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can anybody have an ideas how the last Hamiltonian can be simulated using Oracle quantum gate?&lt;/p&gt;&#xA;" OwnerUserId="9545" LastEditorUserId="23" LastEditDate="2019-12-21T11:32:53.437" LastActivityDate="2020-01-04T13:21:30.040" Title="Nielsen and Chuang, Exercise 6.12: How to simulate the specific Hamiltonian in the search algorithm by the Oracle gates?" Tags="&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9244" PostTypeId="1" AcceptedAnswerId="9245" CreationDate="2019-12-18T15:47:58.477" Score="7" ViewCount="1281" Body="&lt;p&gt;I am new to Quantum Computing. I would really appreciate if some one could offer me some ideas, suggestions and/or useful references to solve the following problem about &lt;strong&gt;realizing an arbitrary operator by a quantum circuit&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I start with a general two-qubit operator &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; (which corresponds to a 4 by 4 unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in the computational basis), what is the strategy to &#xA;&lt;strong&gt;(1)&lt;/strong&gt; decompose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; into the basic gates, such as the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate, the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, and the single-qubit rotational gates (&lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;); &lt;strong&gt;(2)&lt;/strong&gt; design the corresponding quantum circuit to realize this two-qubit operator &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; (either with ancillary qubits or not)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, what is the strategy &lt;strong&gt;(1)&lt;/strong&gt; to convert the following &lt;em&gt;unitary&lt;/em&gt; matrix (two-qubit operator &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; in the computational basis &lt;span class=&quot;math-container&quot;&gt;$\{ |00\rangle, \ |01\rangle, \ |10\rangle, \ |10\rangle \}$&lt;/span&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U= \begin{pmatrix}&#xA;a &amp;amp; b &amp;amp; c &amp;amp; d \\ &#xA;b^{\ast} &amp;amp; f &amp;amp; g &amp;amp; h \\ &#xA;c^{\ast} &amp;amp; g^{\ast} &amp;amp; i &amp;amp; j \\ &#xA;d^{\ast} &amp;amp; h^{\ast} &amp;amp; j^{\ast} &amp;amp; k&#xA;\end{pmatrix} \ ,&#xA;\end{align}&lt;/span&gt;&#xA;into the basic gates (e.g., &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gates); and &lt;strong&gt;(2)&lt;/strong&gt; to realize the unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in a quantum circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9548" LastActivityDate="2019-12-19T17:46:22.680" Title="How to transform e.g., a 4 by 4 unitary matrix into a quantum circuit" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9245" PostTypeId="2" ParentId="9244" CreationDate="2019-12-18T17:14:59.703" Score="8" Body="&lt;p&gt;A universal method to decompose 2-qubit unitaries into primitive gates is sometimes referred to as &quot;Krauss-Cirac decomposition&quot;. Here are several sources:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0308006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Quantum Circuits for General Two-Qubit Gates&lt;/a&gt; by Vatan and Williams,&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0011050.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Creation of Entanglement Using a Two–Qubit Gate&lt;/a&gt; by Kraus and Cirac.&lt;/li&gt;&#xA;&lt;li&gt;“Explorations in Quantum Computing” by Williams, chapter 2.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;For gates on multiple qubits, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8862/how-to-decompose-this-two-qubit-unitary-matrix-to-the-standard-gate-set/8863&quot;&gt;this question&lt;/a&gt; offers several more sources.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2019-12-19T17:46:22.680" LastActivityDate="2019-12-19T17:46:22.680" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9246" PostTypeId="1" CreationDate="2019-12-18T17:17:34.233" Score="2" ViewCount="240" Body="&lt;p&gt;I tried implementing quantum phase estimation in qiskit, however, I'm not getting the expected results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I choose a controlled &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of, I implemented inverse QFT operation (basically a rewrite of the textbook version in a way that I understand better) :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def qft_dagger(circ, q, n):&#xA;    &quot;&quot;&quot;n-qubit inverse QFT on q in circ.&quot;&quot;&quot;&#xA;    for i in range(n-1,-1,-1):&#xA;        for m in range(n-i,1,-1):&#xA;            circ.cu1(-2*math.pi/2**m, q[i+m-1], q[i])&#xA;        circ.h(q[i])&#xA;        circ.barrier()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, the n-qubit hadamard operation :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def n_hadamard(circ, q, n):&#xA;    &quot;apply n qubits hadamard in circ on q&quot;&#xA;    for i in range(n):&#xA;        circ.h(q[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then a function to initiate state vector :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def build_state_vector(circ, inp, s):&#xA;    &quot;build state vector in circ from inp a binary string&quot;&#xA;    for i, e in enumerate(inp):&#xA;        if e == '1':&#xA;            circ.x(s[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then, the code of my experiment goes as follow :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;nancilla = 3&#xA;theta = 0.78&#xA;q = QuantumRegister(nancilla, 'q')&#xA;s = QuantumRegister(1, 's')&#xA;c = ClassicalRegister(nancilla, 'c')&#xA;&#xA;qpe = QuantumCircuit(q, s, c)&#xA;&#xA;build_state_vector(qpe, '1', s)&#xA;&#xA;# Applying hadammard on ancilla&#xA;n_hadamard(qpe, q, nancilla)&#xA;&#xA;for i in range(nancilla):&#xA;    #Applying U^(2^(n-j)) on qubit j &#xA;    qpe.cu1(2*math.pi*theta*2**(nancilla-i-1), q[i], s[0])&#xA;&#xA;# Applying inverse QFT&#xA;qft_dagger(qpe, q, nancilla)&#xA;&#xA;for i in range(nancilla):&#xA;    qpe.measure(q[i],c[i])&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;shots = 2**17&#xA;results = execute(qpe, backend=backend, shots=shots).result()&#xA;answer = results.get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For instance, here, I get as a result 0.25 when I should get 0.75. When increasing the number of ancilla qubits, the result don't get better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like there is something wrong in my implementation, but I have looked at every part separately and I can't tell what is wrong.&lt;/p&gt;&#xA;" OwnerUserId="9551" LastEditorUserId="5955" LastEditDate="2019-12-18T18:06:48.910" LastActivityDate="2020-01-07T08:49:41.717" Title="Quantum Phase Estimation implementation" Tags="&lt;qiskit&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9247" PostTypeId="1" AcceptedAnswerId="9248" CreationDate="2019-12-18T17:48:50.210" Score="4" ViewCount="167" Body="&lt;p&gt;I understand that CNOT and Toffoli (CCNOT) gates are not universal for quantum computation since they (alone) cannot create superposition. Moreover, it is totally possible to perform a CNOT operation where the control qubit is in superposition, &lt;span class=&quot;math-container&quot;&gt;$\alpha\vert 0 \rangle + \beta\vert 1 \rangle$&lt;/span&gt;, and target qubit to be &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is can we have a control qubit to be in superposition while using CCNOT, something like the following?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gpIiv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gpIiv.png&quot; alt=&quot;Toffoli Gate containing superposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If yes, what will be the values for &lt;span class=&quot;math-container&quot;&gt;$p, q, $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;?&#xA;If not, why not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The related material I found are &lt;a href=&quot;https://cs.stackexchange.com/questions/289/universality-of-the-toffoli-gate&quot;&gt;universality of the toffoli gate&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4895/cnot-gate-control-qubit-is-in-superposition&quot;&gt;CNOT in superposition&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2019-12-18T18:47:19.870" Title="Can Toffoli operate on a qubit in superposition?" Tags="&lt;quantum-gate&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9248" PostTypeId="2" ParentId="9247" CreationDate="2019-12-18T18:37:47.390" Score="7" Body="&lt;p&gt;Control qubit can be in superposition, why not? This is how entangled qubits are created. But the circuit you have drawn does not entangle qubits, it actually does not change qubit states at all, and &lt;span class=&quot;math-container&quot;&gt;$|p\rangle = \alpha| 0 \rangle + \beta| 1 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|q\rangle=|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|r\rangle=|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be more interesting if the input value of the 2nd qubit was &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;; then the 2nd output value &lt;span class=&quot;math-container&quot;&gt;$|q\rangle=|1\rangle$&lt;/span&gt;, but there is no separated &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|r\rangle$&lt;/span&gt; output values, instead you have 2-qubit entangled state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|pr\rangle=\alpha|00\rangle + \beta|1 1 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2019-12-18T18:47:19.870" LastActivityDate="2019-12-18T18:47:19.870" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9249" PostTypeId="1" CreationDate="2019-12-18T22:03:22.760" Score="3" ViewCount="42" Body="&lt;p&gt;In eqs. (33), (43)-(46), (56) of their paper, &quot;Separable Decompositions of Bipartite Mixed States&quot; &lt;a href=&quot;https://arxiv.org/abs/1708.05336&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1708.05336&lt;/a&gt;, Li and Qiao present a number of formulas pertinent to testing the separability of certain states. In particular, in eq. (54), they state that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Pi_{\mu=1}^3 \mathcal{E}_{\mu}(A) \leq \frac{1}{27}, \hspace{.1in} \Pi_{\nu=1}^3 \mathcal{E}_{\nu}(B) \leq (\frac{2}{27})^2,&#xA;\end{equation}&lt;/span&gt;&#xA;is required for separability of  certain &lt;span class=&quot;math-container&quot;&gt;$2 \times 4$&lt;/span&gt; states,&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; correponds to qubits and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to ququarts. There doesn't seem to be an explicit formula for qutrits, say &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, however (although some peripheral discussions). Some manipulations of mine--of which I am not fully convinced--lead me to suspect the value &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{128}$&lt;/span&gt;, but I would like to be more confident of its correctness, or if not, the proper alternative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After eq. (33), Li and Qiao note that &quot;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{\mu} (A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{\nu} (B)$&lt;/span&gt; are the means of the squares of the components along the unit directions &lt;span class=&quot;math-container&quot;&gt;$\vec{u}_{\mu} \in \mathcal{S}_l^{(A)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{v}_{\nu} \in \mathcal{S}_l^{(B)}$&lt;/span&gt;, respectively, and &lt;span class=&quot;math-container&quot;&gt;$\tau_{\mu}$&lt;/span&gt; are the singular values of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, preceding this they write: &quot;[W]e define the average of the squares of the components along the directions &lt;span class=&quot;math-container&quot;&gt;$\vec{u}_{\mu} \in \mathcal{S}^{(A)}_{l}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{v}_{\nu} \in \mathcal{S}^{(B)}_{l}$&lt;/span&gt; as follows&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathcal{E}_{\mu}(A) \equiv \sum_{i=1}^L p_i |\vec{u}_{\mu} \cdot \vec{r}_i|^2 \; ,\; \mathcal{E}_{\nu}(B) \equiv \sum_{i=1}^L p_i |\vec{v}_{\nu} \cdot \vec{s}_i|^2 \; .&quot;&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another background passage reads: &quot;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T} = (\vec{u}_1,\cdots,\vec{u}_{N^2-1}) \Lambda_{\tau} (\vec{v}_1, \cdots, \vec{v}_{M^2-1})^{\mathrm{T}}$&lt;/span&gt; be the singular value decomposition of the correlation matrix &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Lambda_{\tau}$&lt;/span&gt; has rank &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;, then we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathcal{T} = \sum_{\mu =1}^l \tau_{\mu} \vec{u}_{\mu}\vec{v}_{\mu}^{\,\mathrm{T}} \; . \label{Singular-tau-def}&#xA;\end{equation}&lt;/span&gt;&#xA;For the &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; nonzero values of &lt;span class=&quot;math-container&quot;&gt;$\tau_{\mu}$&lt;/span&gt;, the corresponding singular vectors &lt;span class=&quot;math-container&quot;&gt;$\{\vec{u}_1,\cdots,\vec{u}_l\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\vec{v}_1,\cdots,\vec{v}_l\}$&lt;/span&gt; span two &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;-dimensional subspaces in Bloch vector space: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_l^{(A)} \equiv \mathrm{span}\{\vec{u}_1,\cdots,\vec{u}_l\} \subseteq \mathcal{S}_{N^2-1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_l^{(B)} \equiv \mathrm{span} \{\vec{v}_1,\cdots,\vec{v}_l\} \subseteq \mathcal{S}_{M^2-1}$&lt;/span&gt;.&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition,&#xA;&quot;the corresponding decomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; can be read from equations (63) and (64), where &lt;span class=&quot;math-container&quot;&gt;$p_1=p_2=p_3=p_4=1/4$&lt;/span&gt;, and the Bloch vectors for &lt;span class=&quot;math-container&quot;&gt;$\rho_i^{(A,B)}$&lt;/span&gt; are&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\vec{r}_1 =&#xA;\begin{pmatrix}&#xA;\alpha_1 \\&#xA;-\alpha_2 \\&#xA;-\alpha_3&#xA;\end{pmatrix}\; , \; \vec{r}_2 =&#xA;\begin{pmatrix}&#xA;-\alpha_1 \\&#xA;-\alpha_2 \\&#xA;\alpha_3&#xA;\end{pmatrix}\; , \;&#xA;\vec{r}_3 =&#xA;\begin{pmatrix}&#xA;-\alpha_1 \\&#xA;\alpha_2 \\&#xA;-\alpha_3&#xA;\end{pmatrix}\; , \;&#xA;\vec{r}_4 =&#xA;\begin{pmatrix}&#xA;\alpha_1 \\&#xA;\alpha_2 \\&#xA;\alpha_3&#xA;\end{pmatrix} \; , \label{Example-I-detail-1}\\&#xA;\vec{s}_1 =&#xA;\begin{pmatrix}&#xA;\beta_1 \\&#xA;-\beta_2 \\&#xA;-\beta_3&#xA;\end{pmatrix}\; , \;&#xA;\vec{s}_2 =&#xA;\begin{pmatrix}&#xA;-\beta_1 \\&#xA;-\beta_2 \\&#xA;\beta_3&#xA;\end{pmatrix}\; , \;&#xA;\vec{s}_3 =&#xA;\begin{pmatrix}&#xA;-\beta_1 \\&#xA;\beta_2 \\&#xA;-\beta_3&#xA;\end{pmatrix}\; , \;&#xA;\vec{s}_4 =&#xA;\begin{pmatrix}&#xA;\beta_1 \\&#xA;\beta_2 \\&#xA;\beta_3&#xA;\end{pmatrix} \; . \label{Example-I-detail-2}&quot;.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, some command of the authors' detailed (and rather challenging, it seems to me) argument would seem to be needed to successfully address the question.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="55" LastEditDate="2020-11-22T16:58:14.257" LastActivityDate="2020-11-22T16:58:14.257" Title="Find the qutrit analogue of certain qubit and ququart formulas of Li and Qiao for testing separability" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;qudit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9250" PostTypeId="2" ParentId="9244" CreationDate="2019-12-18T22:45:28.600" Score="2" Body="&lt;p&gt;Every 2x2 unitary matrix can be decomposed to a matrix product of four matrices expresing rotations and phase shifts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every controlled operator (i.e. two qubit gate) can be decomposed to product of three single qubit gates acting on target qubit and two CNOT gates. Single qubit gates can be again decomposed to rotations and phase shifts are mentioned above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case your 4x4 matrix can be writen as Kronecker product of two 2x2 matrices, you can again apply decomposition from the first paragraph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on these theorems, you can rewrite any two qubit operators in terms of CNOTs and single qubits rotations and phase shifts. All these gates are available on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see details how to do so in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elementary gates for quantum computing&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-18T22:45:28.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9251" PostTypeId="2" ParentId="5775" CreationDate="2019-12-19T08:09:33.730" Score="1" Body="&lt;p&gt;You are absolutely right. The picture in the right section correspond to the picture in the left section up to the unimportant global phase factor (-1). This fact mentioned in the Exercise 6.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Box 6.1 use only one Grover iteration, so that &lt;span class=&quot;math-container&quot;&gt;$|ψ\rangle$&lt;/span&gt; after this Grover iteration will be rotated to the (-&lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;) instead of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; as in the general Grover algorithm. But this does not has any impact to the final result because the probability to find an &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; use the amplitude squire.  &lt;/p&gt;&#xA;" OwnerUserId="9545" LastActivityDate="2019-12-19T08:09:33.730" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9252" PostTypeId="1" AcceptedAnswerId="9346" CreationDate="2019-12-19T08:20:04.680" Score="0" ViewCount="75" Body="&lt;p&gt;I am trying to better understand the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the difference between Intraphoton Entanglement and Interphoton Entanglement?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am new in this field and i want to proceed some work on swapping of Intraphoton Entanglement to Interphoton Entanglement.&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="55" LastEditDate="2020-07-27T12:27:44.060" LastActivityDate="2020-07-27T12:27:44.060" Title="What is the difference between &quot;intraphoton&quot; and &quot;interphoton&quot; entanglement?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;photonics&gt;&lt;orbital-angular-momentum&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9253" PostTypeId="1" AcceptedAnswerId="9259" CreationDate="2019-12-19T11:11:21.997" Score="1" ViewCount="104" Body="&lt;p&gt;Theoretically and for sure physically (I know the quantum physics behind it) I know something about it. But not that much. That's why I ask the question here. I'm very interested. The only answer to it made it already much clearer, though not into detail, of course. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, as anyone of you knows, G**gle succeeded in quantum supremacy. Which is to say they built a quantum computer (QC) that did the given job about one and a half billion (&lt;span class=&quot;math-container&quot;&gt;$2^{73}?$&lt;/span&gt;) times as fast as a classical computer (CC).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While being zillions [or more;)] times faster in executing programs [or algorithms(?)], I think, for example, the conditions under which you can use a QC are different than those of a CC, which is why I ask this question. You (maybe very very far away in the future, if Nature still exists then) can't make them very small and portable, for example. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are the programs and programming, in other words, the jobs to be ordered, be different? I assume yes because of the fact that the QC is superfast in &lt;strong&gt;making&lt;/strong&gt; (instead of &lt;strong&gt;calculating&lt;/strong&gt;) zillions (or even still more) different permutations of whatever kind of objects (like a randomly made permutations of bits, like in the G&lt;strong&gt;gle experiment case). I've heard QC's can be used in meteorology, but (as a side question) in what way is there a question of permutations? More generally, for what kind of jobs are QC's designed or programmed to make such permutations? Or is my assumption that a QC can **only&lt;/strong&gt; make permutations wrong?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have some more thoughts about this?&lt;/p&gt;&#xA;" OwnerUserId="9555" LastEditorUserId="9555" LastEditDate="2019-12-20T05:54:52.320" LastActivityDate="2019-12-20T05:54:52.320" Title="What is the difference between classical and quantum computers as well as computing (permuting) itself?" Tags="&lt;experiment&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9254" PostTypeId="1" CreationDate="2019-12-19T11:33:59.403" Score="0" ViewCount="131" Body="&lt;p&gt;Does anyone has (or is aware of) a solution to Nielsen's QCQI 4.36 exercise: construct a circuit to add two-qubit numbers x and y modulo 4 vs &lt;span class=&quot;math-container&quot;&gt;$|x,y\rangle \rightarrow |x, x+y \mod 4\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9556" LastEditorUserId="55" LastEditDate="2020-11-22T16:57:16.657" LastActivityDate="2020-11-22T16:57:16.657" Title="Quantum adder mod 4" Tags="&lt;quantum-gate&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2019-12-21T09:22:15.303" ContentLicense="CC BY-SA 4.0" />
  <row Id="9255" PostTypeId="2" ParentId="9254" CreationDate="2019-12-19T13:10:53.853" Score="3" Body="&lt;p&gt;The trick is to break down, bit by bit, what the calculation is that you need. You'll see on the right-hand side of the circuit, I've stated what the outcomes need to be. Hopefully, you also recognise some of those outputs (particularly the top qubit), so that rapidly starts to formulate the circuit...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0zmv8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0zmv8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-19T13:10:53.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9256" PostTypeId="2" ParentId="9242" CreationDate="2019-12-19T14:57:49.433" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;For me this state is ill-defined in general&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's not &quot;ill-defined&quot;, just not &lt;em&gt;uniquely&lt;/em&gt; defined. If the dimensions are different you can indeed define different inequivalent states that all have the same right to be called &quot;maximally entangled&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the &quot;maximally entangled state&quot; is not fully characterised even in the case in which the dimensions are the same: you can define it as &lt;span class=&quot;math-container&quot;&gt;$\sum_i |u_i,v_i\rangle$&lt;/span&gt; for every pair of orthonormal bases &lt;span class=&quot;math-container&quot;&gt;$(u_i)_i, (v_i)_i$&lt;/span&gt; for the two spaces. Usually when these states are used this &quot;undefinedness&quot; does not matter (think e.g. of the definition of the Choi matrix using maximally entangled states). &#xA;Although it is true that when the dimensions are the same these states can all be mapped one into the other via local operations, which is not the case for &quot;maximally entangled states&quot; in spaces with different dimensions.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2019-12-19T14:57:49.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9257" PostTypeId="1" CreationDate="2019-12-19T15:28:39.147" Score="-1" ViewCount="330" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8yohC.jpg&quot; alt=&quot;state “0”&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/ehkKe.jpg&quot; alt=&quot;state “1”&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/4FTif.jpg&quot; alt=&quot;state of qubit&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hello,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am uncertain; however, today at a toy museum, I might have captured a qubit on a classical computing structure, “ a broken 90-marble abacus,” as shown in the attached photos above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not use it correctly, but if we set the first photo to be the state “0”, then the next one is “1”. You may say the third photo shows 0.5, but you can also say that it is a bit closer to 0 or 1. Thus, while we observe this purple marble positioned between 0 and 1, we cannot tell if it moves to 0 or 1 until we measure its displacement. Therefore, I wonder if it can be said that the classical limit of qubit emerged on classical computer in this third photo? Its probability of being 0 or 1 is fifty-fifty.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The picture below gives a further explanation with a chart of marble A's location. In abacus computing, the states of A are limited to four states, namely, resting at 0 or 1, or moving toward 0 or 1. A cannot rest between 0 and 1. Abacus computing is observed by taking two photographs during its sequence giving two locations of A. When taking the first shot, we can know A's location and not sure if it is moving or resting. Then we take a second shot and know how it moves. After all, we can tell or predict its outcome 0 or 1. Thus, when we observe the initial location of A, this is the state of the classical limit of qubit, which has fifty-fifty probability of becoming 0 or 1, until secondary observation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This concept can be extended to tossing coin or tumbling dice. If the observer is unable to predict those outcomes by observing those motions, the observer can tell only classical probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ryoji&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aWwMH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aWwMH.png&quot; alt=&quot;eabacus observation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5712" LastEditorUserId="5712" LastEditDate="2020-01-21T02:44:03.963" LastActivityDate="2020-01-21T02:44:03.963" Title="Can a classical limit of qubit emerge on a classical computer?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2019-12-19T23:12:20.350" ContentLicense="CC BY-SA 4.0" />
  <row Id="9258" PostTypeId="2" ParentId="9257" CreationDate="2019-12-19T17:59:47.097" Score="2" Body="&lt;p&gt;A computer that may be visualized in this simple way, like abacus with moving marbles, where the  locations of the marbles are continuous, including 0.5, is called an &quot;analog computer&quot; and it is a different, and much simpler, thing than a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What may be changed continuously in a quantum computers aren't the observable locations (or voltages) themselves but the probability amplitudes for each configuration. When it comes to allowed values of each qubit, each of them may still be just 0 or 1 and nothing in between. However, the quantum computer allows each qubit to be indeterminate, having some probability to be 0 and some probability to be 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, each of the &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; configuration of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits may be given some probability that is independent from others. And quantum mechanics makes it more juicy. It's not just probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1 \dots 2^N$&lt;/span&gt;, that specify the state of the quantum computer at the moment. Instead, it's complex numbers, the probability amplitudes, &lt;span class=&quot;math-container&quot;&gt;$c_i$&lt;/span&gt; related to &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$p_i=|c_i|^2$&lt;/span&gt;, that are needed to describe the state of the quantum computer at a given moment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An operation performed by the quantum computer is some particular linear transformation (given by a matrix, &lt;span class=&quot;math-container&quot;&gt;$2^N \times 2^N$&lt;/span&gt;) of these &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; complex numbers. This calculation involving &lt;span class=&quot;math-container&quot;&gt;$2^N \times 2^N$&lt;/span&gt; continuous numbers could be simulated by a complicated classical computer with lots of memory and representation for the continuous numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this operation that looks complicated in the simulation is achieved by the quantum computer's step that is basically comparably difficult to an operation of a classical computer with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; single bits that just maps some bits to a simple function of the neighbors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum computer doesn't allow &quot;any&quot; operation with the matrices to be done and it doesn't allow the complex numbers to be measured. Instead, just the bits themselves, with results either 0 or 1, may be measured by the quantum computer. So the class of quantum computers or quantum simulations is &quot;more special&quot; than the class of operations done on a classical computer with &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; complex numbers. But despite this restriction, the quantum computer is capable of doing some things much more quickly than the classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A usable quantum compouter was first built by Google and, at least according to some precise definitions of the term, has achieved &quot;quantum supremacy&quot; which means quickly doing a calculation that could only be done very slowly at the world's fastest classical computers.&lt;/p&gt;&#xA;" OwnerUserId="5659" LastEditorUserId="5659" LastEditDate="2019-12-19T18:09:50.693" LastActivityDate="2019-12-19T18:09:50.693" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="9259" PostTypeId="2" ParentId="9253" CreationDate="2019-12-19T19:35:58.007" Score="1" Body="&lt;p&gt;I would be careful with so-called &quot;quantum supremacy&quot;. This term means that there are some tasks where quantum computers are faster than classical ones. However, a speed-up is different for different task, e.g. quantum algorithms allow exponential speed-up of integer factoring (Shor algorithm) or calculating values of &lt;span class=&quot;math-container&quot;&gt;$x^{T}Mx$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a solution of &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; (HHL algorithm) but speed-up for searching (Grover algorithm) is only quadratic. Moreover, there are some tasks where quantum computers bring no speed-up (e.g. binary function parity evaluation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding your question on programming. Quantum computers are based on different paradigm than classical ones. Programming of quantum computers can be done via languages like Qiskit or Q#, which are more or less same as classical programming languages like C++. However, underlying circuity of quantum computers are totally different from classical ones.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding question on application in meteorology. Currently I know about none but principialy it could be possible as atmosphere is a stochastic system and quantum computers can simulate those. &lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-19T19:35:58.007" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9260" PostTypeId="2" ParentId="9227" CreationDate="2019-12-19T22:52:02.083" Score="1" Body="&lt;p&gt;First of all we have to solve a problem with storing information in a quantum form. Currently, researches work on so-called quantum RAM (qRAM) to allow a quantum computer have a bigger memory than registers in a quantum processor. Details are discussed here: &lt;a href=&quot;https://arxiv.org/pdf/0708.1879.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Random Access Memory&lt;/a&gt;. This would expand capabilities of quantum computers and make them more similar to classical computers in terms of architecture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the issue with storing a data will be solved, we can start to think how to encode an audio data in a quantum form and how to operate with them. Of course, there will have to be a converters from a quantum data to classical ones in order to use them for playing sounds (or showing pictures on screen etc). So, you are right, a converter similar to A/D and D/A converters would be needed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are interested in using quantum computers for audio processing, you would like this book: &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/B07G8PHHRZ&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mastering Quantum Computing with IBM QX: Explore the world of quantum computing using the Quantum Composer and Qiskit&lt;/a&gt;. There is a chapter dealing with using a quantum computer for producing tones via MIDI.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-19T22:52:02.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9262" PostTypeId="2" ParentId="6878" CreationDate="2019-12-20T08:23:46.880" Score="2" Body="&lt;p&gt;I am by no means an expert in this sort of calculation, but I think I (mostly) agree with you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I divided the calculation up slightly differently, which simplified things notationally. Firstly, I considered the input &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A|0\rangle_B$&lt;/span&gt;. Clearly, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; acting on this is just 0, so this state doesn't evolve. So, the lop-left element of &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; is 1, and that of &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; is 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I considered the input &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A|0\rangle_B$&lt;/span&gt;. We know that &lt;span class=&quot;math-container&quot;&gt;$a^\dagger a$&lt;/span&gt; will always just return &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_A$&lt;/span&gt;, so we only need to consider the evolution of the second system, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-i\chi\Delta t(b+b^\dagger)}|0\rangle_B.&#xA;$$&lt;/span&gt;&#xA;We can then follow your strategy for the calculation (I've only gone through the &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; case) to find the bottom-right element is &lt;span class=&quot;math-container&quot;&gt;$e^{-\Delta t^2\chi^2/2}$&lt;/span&gt;. (Digression: if I assume the b operators are fermionic, then &lt;span class=&quot;math-container&quot;&gt;$b+b^\dagger$&lt;/span&gt; is basically just the Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix on a qubit. &lt;em&gt;Then&lt;/em&gt; you recover the formula that's given.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What at first glance seems confusing is why you should only consider &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt;. Surely, there are also &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; for all natural numbers &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;? Of course, they will all be of the same form as &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; up to some constant of proportionality. Let's assume&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_k=\alpha_k|1\rangle\langle 1|&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$k\geq 1$&lt;/span&gt;. Then the relevant terms of the Master equation look like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_k\frac12 E_k^\dagger E_k\rho+\frac12\rho E_k^\dagger E_k-E_k\rho E_k^\dagger=\frac12 \beta|1\rangle\langle 1|\rho+\frac12 \beta\rho|1\rangle\langle 1|-\beta|1\rangle\langle 1|\rho|1\rangle\langle 1|.&#xA;$$&lt;/span&gt;&#xA;This is entirely equivalent to the action of a single operator &lt;span class=&quot;math-container&quot;&gt;$E_1'=\sqrt{\beta}|1\rangle\langle 1|$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\beta=\sum_k\alpha_k^2$&lt;/span&gt;. Moreover, by the fact that the map will be trace preserving, I don't need to bother actually calculating &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;. I know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\beta+\langle 1|E_0|1\rangle^2=1.&#xA;$$&lt;/span&gt;&#xA;(At least this part is consistent with what N&amp;amp;C is telling us.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-20T08:23:46.880" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9263" PostTypeId="2" ParentId="4104" CreationDate="2019-12-20T10:45:19.943" Score="1" Body="&lt;p&gt;By treating a quantum circuit as a network model, the network model can be optimized the order of the calculation by making a contract between tensor and tensor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it is definitely important to learn TN for future qc. &lt;/p&gt;&#xA;" OwnerUserId="9564" LastActivityDate="2019-12-20T10:45:19.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9264" PostTypeId="1" AcceptedAnswerId="9288" CreationDate="2019-12-20T11:10:43.977" Score="9" ViewCount="184" Body="&lt;p&gt;Quantum teleportation is a reasonably well-defined physical process, whereby a quantum state is transferred between two separated entities that already share an entangled state. It's been demonstrated experimentally, and applications have been dreamed up. My question is: does this phenomenon occur &quot;naturally&quot; at all? Or is it in the category of things that, to the best of our knowledge, have only ever happened as a result of human ingenuity?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I leave open the question of how exact the state transfer should be. Examples where teleportation explains something interesting about a system's behaviour would be ideal.)&lt;/p&gt;&#xA;" OwnerUserId="8338" LastActivityDate="2019-12-23T11:46:33.170" Title="Is quantum teleportation a natural phenomenon?" Tags="&lt;teleportation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9265" PostTypeId="1" AcceptedAnswerId="9266" CreationDate="2019-12-20T11:39:16.600" Score="3" ViewCount="124" Body="&lt;p&gt;Elements of the Pauli group are the n-Pauli matrices with &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pm i$&lt;/span&gt; on front of them. They all commute or anti-commute between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Clifford group are element that preserve the n-Pauli group under conjugation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a link between the result of the Gottesman Knill theorem, and somehow the fact that if you only use gates in the Clifford group you can simplify the circuit using commutation and anti-commutation rules from the n-Pauli group.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I didn't go into the proof of this theorem, I just would like to see if there is a handwavy but intuitive way to understand it.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2019-12-20T11:46:25.807" Title="Intuitive link between clifford group and gottesman-knill theorem" Tags="&lt;pauli-gates&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9266" PostTypeId="2" ParentId="9265" CreationDate="2019-12-20T11:46:25.807" Score="3" Body="&lt;p&gt;Yes, absolutely. That's very much the root of the whole thing. You start with a state from a particular class: a stabilizer state, i.e. one which can be described by a bunch of projectors &lt;span class=&quot;math-container&quot;&gt;$(I+K)/2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is from the Pauli Group. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To determine how the state evolves under the action of the circuit, you only need to know how the circuit acts on the elements &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. Since gates in the Clifford group preserve the Pauli group, that just says those tensor products of Paulis map into some other tensor product of Paulis (and, importantly, we case easily tell what that update is), and so we can easily describe the outcome of the computation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-20T11:46:25.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9267" PostTypeId="1" AcceptedAnswerId="9277" CreationDate="2019-12-20T13:54:53.570" Score="0" ViewCount="111" Body="&lt;p&gt;How do we represent a qubit &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; and put in a superposition (in dirac)?&lt;/p&gt;&#xA;" OwnerUserId="9567" LastEditorUserId="7528" LastEditDate="2019-12-21T09:37:24.823" LastActivityDate="2019-12-21T09:37:24.823" Title="Represent qubit in a superposition" Tags="&lt;quantum-gate&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="0" ClosedDate="2019-12-21T13:50:07.467" ContentLicense="CC BY-SA 4.0" />
  <row Id="9268" PostTypeId="1" AcceptedAnswerId="9275" CreationDate="2019-12-20T14:34:19.373" Score="1" ViewCount="526" Body="&lt;p&gt;I am new to Qiskit and I am trying to implement some very simple 1-qubit gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to initialize the state of the qubit (to 0 and then to 1) and then apply the gate and print the new state of the qubit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def I(input):&#xA;&#xA;  q = QuantumRegister(1) &#xA;  c = ClassicalRegister(1)&#xA;  qc = QuantumCircuit(q, c)&#xA;&#xA;  if input == '1': #if input = 1, initialize the qubit to 1&#xA;     qc.x(q[0])&#xA;&#xA;  qc.iden(q[0] )&#xA;&#xA;  qc.measure( q[0], c[0])&#xA;&#xA;&#xA;  backend = Aer.get_backend('statevector_simulator')&#xA;  result = qiskit.execute(qc, backend=backend, shots=1).result()&#xA;  output = result.data(qc)&#xA;&#xA;  return output&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And I call the function like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print('\nResults for the Iden gate')&#xA;for input in ['0','1']:&#xA;print('    Input',input,'gives output',I(input))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the output of all this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Results for the Iden gate&#xA;Input 0 gives output {'statevector': [[1.0, 0.0], [0.0, 0.0]], 'counts': {'0x0': 1}}&#xA;Input 1 gives output {'statevector': [[0.0, 0.0], [1.0, 0.0]], 'counts': {'0x1': 1}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know that the data() function returns the Instruction object, a list of Qubits objects and a list of classical bits with the order they added.&#xA;So here the second list is the list with the qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when the qubit is '0', shouldn't it return a list with all 0? I am not sure about the meaning of the output.&lt;/p&gt;&#xA;" OwnerUserId="9569" LastActivityDate="2019-12-21T09:38:31.983" Title="Print data() with statevector and qasm simulator - Qiskit" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9269" PostTypeId="2" ParentId="9267" CreationDate="2019-12-20T14:36:34.100" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is not in superposition, it is simply state 1. After measurement you will get 1 with 100 % probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, generaly, qubit can be represented as &lt;span class=&quot;math-container&quot;&gt;$|q\rangle = a|0\rangle + b|1\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$a,b \in \mathbb{C}$&lt;/span&gt;. So, you can think of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as a superposition with &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning second question, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix}0\\1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-20T14:36:34.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9270" PostTypeId="1" CreationDate="2019-12-20T16:28:54.260" Score="10" ViewCount="189" Body="&lt;p&gt;Consider two noisy quantum channels (CPTP maps), &lt;span class=&quot;math-container&quot;&gt;$\Phi_1^A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_2^A$&lt;/span&gt;, acting on a system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Suppose that for any &lt;em&gt;pure state&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;\in \mathcal H_A$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F\big(\psi, \Phi_1^A(\psi)\big) \geq F\big(\psi, \Phi_2^A(\psi)\big)&#xA;\tag{1}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$F(\psi, \Phi(\psi))= \big&amp;lt;\psi\big|\Phi\big(\left| \psi \right&amp;gt;\left&amp;lt; \psi \right|\big) \big|\psi \big&amp;gt;$&lt;/span&gt; is the fidelity between the initial state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi \right&amp;gt;$&lt;/span&gt; and the final state obtained after sending &lt;span class=&quot;math-container&quot;&gt;$\left|\psi \right&amp;gt;$&lt;/span&gt; through the channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: does Eq. (1) imply that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F_e\big(\rho^A,\Phi^A_1\big) \geq F_e\big(\rho^A,\Phi^A_2\big)&#xA;\tag{2}&#xA;$$&lt;/span&gt;&#xA;for any density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt;?&#xA;Here, &lt;span class=&quot;math-container&quot;&gt;$F_e$&lt;/span&gt; denotes the &lt;em&gt;entanglement fidelity&lt;/em&gt;, defined as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$F_e(\rho^A, \Phi^A) = \big&amp;lt;\phi^{AB}\big|\big(\Phi^A\otimes I^B\big)\big(\left| \phi^{AB} \right&amp;gt;\left&amp;lt; \phi^{AB} \right|\big) \big|\phi^{AB}\big&amp;gt;, $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;^{AB} \in \mathcal H_A \otimes \mathcal H_B$&lt;/span&gt; is a purification of the state &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; to a system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. In other words, for any pure state &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;^{AB} \in \mathcal H_A \otimes\mathcal H_B $&lt;/span&gt;, does Eq. (1) imply that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F\big(\phi^{AB}, (\Phi_1^A\otimes I^B)(\phi^{AB})\big) \geq F\big(\phi^{AB}, (\Phi_2^A\otimes I^B)(\phi^{AB})\big)?&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe that the answer to the question is yes, but I haven't found a way to prove it. The answer is certainly yes when &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; is a pure state (i.e. when &lt;span class=&quot;math-container&quot;&gt;$\left|\phi\right&amp;gt;^{AB}$&lt;/span&gt; is a product state) because &lt;span class=&quot;math-container&quot;&gt;$F_e(\left|\psi\right&amp;gt;\left&amp;lt;\psi\right|,\Phi) = F(\psi,\Phi(\psi))$&lt;/span&gt;. I've tried numerically searching for mixed states that violate the inequality (2) for a few simple choices of &lt;span class=&quot;math-container&quot;&gt;$\Phi_{1,2}$&lt;/span&gt;. For instance, taking &lt;span class=&quot;math-container&quot;&gt;$\Phi_1$&lt;/span&gt; as the amplitude-damping channel and &lt;span class=&quot;math-container&quot;&gt;$\Phi_2$&lt;/span&gt; as the depolarizing channel (with error rates chosen so that (1) is satisfied), I was not able to find a &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; that violates (2). This suggests that (1) implies (2) at least for these particular channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To summarize, I'm looking for a proof that (1) implies (2), or else a counterexample showing that (1) does not imply (2). Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9568" LastEditorUserId="55" LastEditDate="2020-11-22T16:57:09.657" LastActivityDate="2020-11-22T16:57:09.657" Title="Does higher channel fidelity imply higher entanglement fidelity?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;fidelity&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9271" PostTypeId="2" ParentId="9267" CreationDate="2019-12-20T18:19:21.857" Score="3" Body="&lt;p&gt;In your question, there is missing a key ingredient, which is: a superposition in which basis? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All pure (quantum) states are representable with only one non-zero coefficient in its native basis, and all pure states can be represented as a superposition in a different basis. Answer of @Martin Vesely gives you intuition how to represent &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in a computational basis (which is its native basis). However, if you select a different basis set &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_1\rangle, |\psi_2\rangle\}$&lt;/span&gt;, you can describe your state as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle  = \alpha_1 |\psi_1\rangle + \alpha_2|\psi_2\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha_k = \langle\psi_k|1\rangle$&lt;/span&gt;, i.e. the overlap of your state with the basis that you're expanding in. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, select &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis (&lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle = \frac{1}{\sqrt{2}}(|0\rangle\pm|1\rangle)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \frac{1}{\sqrt{2}}(|+\rangle -|-\rangle)$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$\langle \pm|1\rangle = \frac{1}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same thinking you can apply to higher dimensional quantum states, with the difference, that you will have more basis elements (equal to dimensionality of the Hilbert space).  &lt;/p&gt;&#xA;" OwnerUserId="563" LastActivityDate="2019-12-20T18:19:21.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9272" PostTypeId="1" AcceptedAnswerId="9276" CreationDate="2019-12-20T20:16:31.330" Score="5" ViewCount="117" Body="&lt;p&gt;The state vector is exponential in size, so we can manipulate an exponential quantity of information with a linear quantity of gates. However, this doesn't give us general exponential speedup because we can only extract &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of information from an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qbit system via measurement. How powerful would quantum computers be if we could actually directly access the state vector, though? Would they be equivalent in power to a nondeterministic TM?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="26" LastEditDate="2019-12-21T15:18:09.880" LastActivityDate="2019-12-21T15:18:09.880" Title="How powerful would quantum computers be if we had direct access to the full state vector?" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9273" PostTypeId="1" AcceptedAnswerId="9274" CreationDate="2019-12-20T21:49:57.140" Score="2" ViewCount="61" Body="&lt;p&gt;The repetition code encodes &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle  = \alpha \vert 0 \rangle + \beta \vert 1 \rangle \rightarrow \vert \psi \rangle  = \alpha \vert 000 \rangle + \beta \vert 111 \rangle$&lt;/span&gt; using the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KXrCc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KXrCc.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$$t_0: \vert \psi \rangle  = (\alpha \vert 0 \rangle + \beta \vert 1 \rangle) \otimes \vert 0 \rangle \otimes \vert 0 \rangle = \alpha \vert 000 \rangle + \beta \vert 100 \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$t_1: \vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 110 \rangle$$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$t_2: \vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 111 \rangle$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am wondering what is the operator used from &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt;?&#xA;I understand that an XOR was applied there to get the desired output but what is the explicit operator (gate-wise or matrix-wise) used?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, I tried &lt;span class=&quot;math-container&quot;&gt;$U = \mathbb{I} \otimes \mathbb{X} \otimes \mathbb{I}$&lt;/span&gt; and applied it to &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; which resulted in &lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \alpha \vert 010 \rangle + \beta \vert 110 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2019-12-21T08:04:56.853" Title="Repetition code encoder circuit" Tags="&lt;entanglement&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9274" PostTypeId="2" ParentId="9273" CreationDate="2019-12-20T22:26:30.643" Score="4" Body="&lt;p&gt;Operator applied from &lt;span class=&quot;math-container&quot;&gt;$t_{0}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$t_{1}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$CNOT \otimes I$&lt;/span&gt;, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U_1=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;As a CNOT gate produces a entangled quantum state, it is not possible to express it as Kronecker product &lt;span class=&quot;math-container&quot;&gt;$I \otimes X$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your operator &lt;span class=&quot;math-container&quot;&gt;$I \otimes X \otimes I$&lt;/span&gt; means that negation &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is applied on &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; and identical operator &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is applied on &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q_2\rangle$&lt;/span&gt; always. There is no connection established between &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This operation changes your input qubits to &lt;span class=&quot;math-container&quot;&gt;$\alpha|000\rangle + \beta|110\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operation from &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$t_2$&lt;/span&gt; is decribed by following matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U_2=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application of &lt;span class=&quot;math-container&quot;&gt;$U_2U_{1}$&lt;/span&gt; leads to state &lt;span class=&quot;math-container&quot;&gt;$\alpha|000\rangle + \beta|111\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2019-12-21T08:04:56.853" LastActivityDate="2019-12-21T08:04:56.853" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9275" PostTypeId="2" ParentId="9268" CreationDate="2019-12-20T23:43:38.537" Score="2" Body="&lt;p&gt;The return from &lt;code&gt;result.data(qc)&lt;/code&gt; is information about the result of running the circuit &lt;code&gt;qc&lt;/code&gt;. In your example, there are 2 pieces of information returned - the statevector and the counts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The statevector is a way of describing the state of the qubit, and the result contains the statevector from the end of the circuit. Each of the arrays in the overall array corresponds to a coefficient in front of one of the basis states, the first element is the real part and the second is the imaginary. So, for your &lt;code&gt;Input 0&lt;/code&gt; this statevector is saying at the end of the circuit the qubit was in the state&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$(1+0i)\vert 0 \rangle + (0+0i)\vert 1 \rangle$&lt;/span&gt;, which is the same as saying the qubit is in the &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The counts is saying how many times each output occurred in the results, so for &lt;code&gt;Input 0&lt;/code&gt; 0x0 (aka 0) was the result once, which can be seen from the &lt;code&gt;1&lt;/code&gt;. This field is mainly used with the &lt;code&gt;qasm_simulator&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2019-12-21T09:38:31.983" LastActivityDate="2019-12-21T09:38:31.983" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9276" PostTypeId="2" ParentId="9272" CreationDate="2019-12-21T00:09:22.617" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;How powerful would quantum computers be if we could actually directly access the state vector, though?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Extremely powerful! Having direct state access to the state vectors would be equivalent to having a black box that takes a quantum circuit of your choice as input and tells you any amplitude of your choice to (say) polynomially many bits of precision. The relevant complexity class, in this case, is &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:P#psharpp&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}^{\#\mathsf{P}}$&lt;/span&gt;&lt;/a&gt; (&lt;a href=&quot;https://cs.stackexchange.com/questions/42725/proof-of-p-textp-ppp&quot;&gt;= &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}^{\mathsf{PP}}$&lt;/span&gt;&lt;/a&gt;) i.e., you'll get a polynomial-time machine with a &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:Symbols#sharpp&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\#\mathsf{P}$&lt;/span&gt;&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Oracle_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;oracle&lt;/a&gt;. This follows from the fact that computing quantum amplitudes is a &lt;a href=&quot;https://en.wikipedia.org/wiki/%E2%99%AFP-complete&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\#\mathsf{P}$&lt;/span&gt;-complete&lt;/a&gt; problem (see eg. &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.144.7852&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bernstein-Vazirani&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9812056&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fenner-Green-Homer-Pruim&lt;/a&gt;). You'll find a summary &lt;a href=&quot;https://ocw.mit.edu/courses/mathematics/18-405j-advanced-complexity-theory-spring-2016/projects/MIT18_405JS16_QuantumCompt.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (PDF). Thanks to Prof. Scott Aaronson for providing me the wonderful references. Nevertheless, this implies such a quantum computer would be able to solve all problems in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Polynomial_hierarchy&quot; rel=&quot;nofollow noreferrer&quot;&gt;polynomial hierarchy&lt;/a&gt; and by extension all problems in &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:N#np&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;&lt;/a&gt; and &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:C#conp&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{coNP}$&lt;/span&gt;&lt;/a&gt;, as well as all problems in &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:P#pp&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PP}$&lt;/span&gt;&lt;/a&gt;, while an ordinary quantum computer is supposed to efficiently solve only &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:B#bqp&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;&lt;/a&gt; problems. You might find the following diagram useful. &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; is the region shaded in green.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://slideplayer.com/slide/677280/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OtcMHm.jpg&quot; alt=&quot;https://slideplayer.com/slide/677280/&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Would they be equivalent in power to a non-deterministic TM?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://complexityzoo.uwaterloo.ca/File:Really-important-inclusions.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A88Oam.png&quot; alt=&quot;https://complexityzoo.uwaterloo.ca/File:Really-important-inclusions.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:P#ppp2&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}^{\mathsf{PP}}$&lt;/span&gt;&lt;/a&gt; contains &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:P#ph&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PH}$&lt;/span&gt;&lt;/a&gt; (by &lt;a href=&quot;https://en.wikipedia.org/wiki/Toda%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toda's theorem&lt;/a&gt;), and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}^{\mathsf{PP}}$&lt;/span&gt; in turn is contained in &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:P#pspace&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE}$&lt;/span&gt;&lt;/a&gt;. Both &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PH}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE}$&lt;/span&gt; are describable in terms of polynomial-time &lt;a href=&quot;https://en.wikipedia.org/wiki/Alternating_Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;alternating Turing machines&lt;/a&gt; &lt;sup&gt;1, 2&lt;/sup&gt;. Thus, such a machine with &quot;direct state access&quot; would indeed be as powerful as a polynomial-time non-deterministic Turing machine (in particular, a polynomial-time alternating Turing machine). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1: &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PH}$&lt;/span&gt; is the set of decision problems solvable in polynomial time on an alternating Turing machine with &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; alternations starting in an existential (respectively, universal) state.&lt;/sup&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;2: &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE}$&lt;/span&gt; is the set of problems decidable by an alternating Turing machine in polynomial time, sometimes called &lt;span class=&quot;math-container&quot;&gt;$\mathsf{APTIME}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AP}$&lt;/span&gt;. (&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PSPACE} = \mathsf{AP}$&lt;/span&gt; due to &lt;a href=&quot;https://dl.acm.org/citation.cfm?doid=322234.322243&quot; rel=&quot;nofollow noreferrer&quot;&gt;[CKS81]&lt;/a&gt;.)&lt;/sup&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&#xA;There's another related concept that you might find interesting. If you have a quantum computer that allows non-collapsing measurements along with intermediate collapsing measurements, then you then get a &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:P#pdqp&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{PDQP}$&lt;/span&gt;&lt;/a&gt; machine which can efficiently solve the &lt;a href=&quot;https://en.wikipedia.org/wiki/Graph_isomorphism_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph Isomorphism&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice_problem#Closest_vector_problem_(CVP)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Approximate Shortest Vector&lt;/a&gt; problems, unlike ordinary quantum computers. It can also search an unstructured &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-element list in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(N^{1/3})$&lt;/span&gt; time (but no faster than &lt;span class=&quot;math-container&quot;&gt;$\Omega(N^{1/4})$&lt;/span&gt;, and hence it cannot solve &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-hardness&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-hard&lt;/a&gt; problems). For reference, check out &lt;a href=&quot;https://arxiv.org/abs/1412.6507&quot; rel=&quot;nofollow noreferrer&quot;&gt;The space &quot;just above&quot; BQP&lt;/a&gt; by Aaronson &lt;em&gt;et al.&lt;/em&gt; (2014).&#xA;&lt;/sup&gt;&#xA;&lt;sup&gt;&#xA;It can be shown that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PDQP}$&lt;/span&gt; does &lt;em&gt;not&lt;/em&gt; contain &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; relative to an oracle. Also, while &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PDQP}$&lt;/span&gt; machines can solve problems in &lt;a href=&quot;https://complexityzoo.uwaterloo.ca/Complexity_Zoo:S#szk&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathsf{SZK}$&lt;/span&gt;&lt;/a&gt; in polynomial-time, it cannot efficiently solve all problem in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;. Hence, such a machine would be less powerful than a non-deterministic Turing machine.&#xA;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-21T14:32:01.307" LastActivityDate="2019-12-21T14:32:01.307" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9277" PostTypeId="2" ParentId="9267" CreationDate="2019-12-21T00:42:48.100" Score="3" Body="&lt;p&gt;How about I approach your question from computer science perspective. A &lt;em&gt;bit&lt;/em&gt; can be only &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. A &lt;em&gt;qubit&lt;/em&gt; can be only &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, or only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, or a combination (superposition) of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We denote a zero bit as &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and zero qubit as &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;. We also denote a bit of value one as &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and a qubit of value one as &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;.&#xA;Keep in mind that &lt;span class=&quot;math-container&quot;&gt;$$\vert 0 \rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \text{and } \vert 1 \rangle = \begin{bmatrix}0\\1\end{bmatrix}.$$&lt;/span&gt;&#xA;The question now is how to represent superposition?&#xA;It is simple: it will be a combination of &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;. Formally, a single-qubit &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is given as &lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert \alpha \vert^2 + \vert \beta \vert^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; denotes the probability of getting &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; denotes the probability of getting &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$\alpha = 0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\beta = 1$&lt;/span&gt;, hence, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = 0 \times \vert 0 \rangle + 1 \times \vert 1 \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle =  \vert 1 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means our qubit will always be &quot;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&quot; or &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; (&lt;em&gt;i.e.,&lt;/em&gt; our single-qubit collapses to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; 0% of the time and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; 100% of the time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How about we make &lt;span class=&quot;math-container&quot;&gt;$\alpha = \dfrac{1}{\sqrt{2}}$&lt;/span&gt;, then, &lt;span class=&quot;math-container&quot;&gt;$\beta = \dfrac{1}{\sqrt{2}}$&lt;/span&gt;, hence, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \dfrac{1}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$$&lt;/span&gt;&#xA;So, when we measure our single-qubit, it collapses to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; 50% of the time and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; 50% as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, performing a measurement on a qubit destroys its superposition (&lt;em&gt;i.e.,&lt;/em&gt; the qubit will behave as a bit after measurement, it could be only 0 or only 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, you should have a look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_(H)_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard Gate&lt;/a&gt; which takes a qubit and turns it into superposition.&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2019-12-21T00:42:48.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9278" PostTypeId="2" ParentId="9242" CreationDate="2019-12-21T00:49:03.720" Score="2" Body="&lt;p&gt;Let's say that you're working in the energy eigenbasis of a quantum harmonic oscillator &lt;sup&gt;&lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt;&lt;/sup&gt; and label the basis states as &lt;span class=&quot;math-container&quot;&gt;$\{|0⟩_H,|1⟩_H,|2⟩_H,…\}$&lt;/span&gt;, and you have the basis &lt;span class=&quot;math-container&quot;&gt;$\{|0⟩_Q,|1⟩_Q\}$&lt;/span&gt; for your qubit. &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$\text{min}(,2)=2$&lt;/span&gt; in this case. Then say you choose the basis &lt;span class=&quot;math-container&quot;&gt;$$\{|0_Q0_H⟩,|0_Q2_H⟩,|1_Q0_H⟩,|1_Q2_H⟩\}$$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2\otimes \Bbb C^2$&lt;/span&gt;. Or you could choose the &lt;span class=&quot;math-container&quot;&gt;$$\{|0_Q+_H⟩,|0_Q−_H⟩,|1_H+_Q⟩,|1_H−_H⟩\}$$&lt;/span&gt; basis, where &lt;span class=&quot;math-container&quot;&gt;$|+⟩=\frac{1}{\sqrt 2}(|0⟩+|1⟩)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|−⟩=\frac{1}{\sqrt 2}(|0⟩+|1⟩)$&lt;/span&gt;. Both are fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A valid &lt;span class=&quot;math-container&quot;&gt;$|\Omega⟩$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0_Q+_H⟩+|1_Q−_H⟩)$&lt;/span&gt;. Another valid &lt;span class=&quot;math-container&quot;&gt;$|\Omega⟩$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0_Q0_H⟩+|1_Q2_H⟩)$&lt;/span&gt;. Both the &lt;span class=&quot;math-container&quot;&gt;$|\Omega⟩$&lt;/span&gt;'s are perfectly good examples of maximally mixed states! I'm not sure &quot;how do I know how to choose the kets?&quot; is the right question. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You're right that any maximally entangled state can be constructed by applied local unitaries on some (non-unique) &lt;span class=&quot;math-container&quot;&gt;$|\Omega⟩$&lt;/span&gt;. &quot;Ill-defined&quot; is not the right term here; it's just &quot;non-uniquely defined&quot;. The point is that &lt;em&gt;any&lt;/em&gt; maximally mixed state is of the form &lt;span class=&quot;math-container&quot;&gt;$(I\otimes U)|\Omega⟩$&lt;/span&gt; and can be expressed as &lt;em&gt;some&lt;/em&gt; (constrained) combination of (non-unique) basis states of &lt;em&gt;some&lt;/em&gt; (non-unique) subspace &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^d\otimes \Bbb C^d$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps you were confused because you were thinking &lt;span class=&quot;math-container&quot;&gt;$|\Omega\rangle$&lt;/span&gt; is some unique state. That's certainly not the case! The description of &lt;span class=&quot;math-container&quot;&gt;$|\Omega⟩$&lt;/span&gt; simply provides the mathematical structure that we expect of a legitimate maximally entangled state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The author writes &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^d \otimes \Bbb C^d$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^{d^2}$&lt;/span&gt; in order to emphasize that a basis is being determined for a composite system. Of course, there exists an isomorphism between the two. The idea is to choose a subspace of a common dimension for both &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;.  I do not think there's any other deeper reason for why the author chooses to write &lt;span class=&quot;math-container&quot;&gt;$\Bbb{C}^{d}\otimes \Bbb{C}^d$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^{d^2}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;&lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt;: In general, the Hilbert space for a quantum harmonic oscillator is infinite-dimensional i.e. &lt;span class=&quot;math-container&quot;&gt;$L^2(\Bbb R)$&lt;/span&gt; and things get complicated. Keyl &lt;em&gt;et al.&lt;/em&gt; apparently have a paper (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0212014&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:quant-ph/0212014&lt;/a&gt;) on this topic.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-21T16:27:42.813" LastActivityDate="2019-12-21T16:27:42.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9279" PostTypeId="2" ParentId="2722" CreationDate="2019-12-21T16:47:43.330" Score="3" Body="&lt;p&gt;Aaronson and Christiano proved the security of their scheme in an oracle model, where they assume the verifier has access to a membership oracle to some subspace &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. In order to turn this into actual quantum money, it is &quot;sufficient&quot; to implement &quot;such an oracle&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would one do that? And what is &quot;such an oracle&quot;? Well, the simplest question is to implement the oracle as a bank which would answer queries for you, that is, to implement private quantum money. If someone would manage to create a classical program they could give you, such that whatever you could learn from inspecting the program you could also learn just by querying it, this would constitute a full blown black box. This is the notion of Virtual Black Box (VBB), and it is known to be impossible under a variety of assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, a weaker notion is required. AC tried an ad-hoc approach, where they suggested a specific subspace obfuscator (a sufficiently large list of random low degree polynomials which vanish on the hidden subspace), which were famously broken shortly after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In a yet to be published work, Mark Zhandry has shown how an appropriate obfuscator could be constructed under the assumption of indistinguishability obfuscators and the existence of one way bijections (&lt;a href=&quot;https://www.youtube.com/watch?v=AmgkSdhK4K8&quot; rel=&quot;nofollow noreferrer&quot;&gt;cf. chapter 5&lt;/a&gt;), which is considerably milder than the black box assumption but is still quite stronger than, say, one way functions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the state of the art for AC's construction is that it can be made public under the assumption of indistinguishability obfuscation (and one way bijections).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: After reading the comment I realized that I've missed some of the nuance on the question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In ACs scheme &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is a basis for the vector space used to construct the money state. &lt;span class=&quot;math-container&quot;&gt;$S_r$&lt;/span&gt; is a membership oracle for that space and its dual. The basis itself is no longer required for verification. Yes, holding on to r allows to create many bills with identical serial numbers, though don't understand their incentive to do so. Also note that in the AC schemes, a small amount of identical bills (linear in the security parameter) suffices to learn how to create infinitely many identical bills without ever being told &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; (because if you measure, say &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; random vectors from an &lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt;-dimensional space, you get a spanning set with overwhelming probability).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, as far as I understand, neither of the two schemes you mentioned allows for users to know how many coins were minted without trusting the mint.&lt;/p&gt;&#xA;" OwnerUserId="9575" LastEditorUserId="9575" LastEditDate="2019-12-22T13:44:57.630" LastActivityDate="2019-12-22T13:44:57.630" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="9280" PostTypeId="1" AcceptedAnswerId="9285" CreationDate="2019-12-21T18:06:02.510" Score="9" ViewCount="239" Body="&lt;p&gt;I've read in the Nielsen's, Chuang's &quot;Quantum Computation and Quantum Information&quot;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Classical simulation begins with the realization that in solving a simple differential equation such as &lt;span class=&quot;math-container&quot;&gt;$dy/dt = f(y)$&lt;/span&gt;, to first order, it is known that &lt;span class=&quot;math-container&quot;&gt;$y(t + \Delta t) \approx y(t) + f (y)\Delta t$&lt;/span&gt;. Similarly, the quantum case is concerned with the solution of &lt;span class=&quot;math-container&quot;&gt;$id|\psi \rangle/dt = H|\psi \rangle$&lt;/span&gt;, which, for a time-independent &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, is just &lt;span class=&quot;math-container&quot;&gt;$$|\psi(t)\rangle = e^{-iHt}|\psi(0)\rangle.\ \ \ \ \ \ (4.96)$$&lt;/span&gt;&#xA;  Since H is usually extremely difficult to exponentiate (it may be sparse, but it is also&#xA;  exponentially large), a good beginning is the first order solution &lt;span class=&quot;math-container&quot;&gt;$|\psi(t + \Delta t)\rangle \approx (I − iH \Delta t)|\psi(t)\rangle$&lt;/span&gt;. This is tractable, because for many Hamiltonians &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; it is straightforward to compose quantum gates to efficiently approximate &lt;span class=&quot;math-container&quot;&gt;$I − iH \Delta t$&lt;/span&gt;. However, such first order solutions are generally not very satisfactory.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Efficient approximation of the solution to Equation (4.96), to high order, is possible for many classes of Hamiltonian. For example, in most physical systems, the Hamiltonian can be written as a sum over many local interactions. Specifically, for a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; particles,&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ H = \sum_{k=1}^L H_k,\ \ \ \ \ \ \ (4.97)$$&lt;/span&gt;&#xA;  where each &lt;span class=&quot;math-container&quot;&gt;$H_k$&lt;/span&gt; acts on at most a constant c number of systems, and L is a polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. For example, the terms &lt;span class=&quot;math-container&quot;&gt;$H_k$&lt;/span&gt; are often just two-body interactions such as &lt;span class=&quot;math-container&quot;&gt;$X_i X_j$&lt;/span&gt; and one-body Hamiltonians such as &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt;. [...] &lt;strong&gt;The important point is that although &lt;span class=&quot;math-container&quot;&gt;$e^{−iHt}$&lt;/span&gt; is difficult to compute, &lt;span class=&quot;math-container&quot;&gt;$e^{−iH_kt}$&lt;/span&gt; acts on a much smaller subsystem, and is straightforward to approximate, using quantum circuits.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This may be a silly question, but I'm stuck with this one. Does the difficulty of obtaining &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; lies only in its size? Both &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_kt}$&lt;/span&gt; can be seen as matrices (of course, the first one is immensely larger than the latter one) and a Taylor series can be used to approximate both of them. This in turn boils down to just making a number of multiplications of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (with different coefficients standing by the consecutive matrices). So, it makes sense for a sparse matrix to be easier to obtain, because we just don't have to do a number of multiplications, which would at the end give 0. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two things that come to my mind. First of which is a divide-and-conquer approach, where obtainment of &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_kt}$&lt;/span&gt; is simple and all &quot;small&quot; results are combined to get a big one. In fact, I think that Trotterization is this kind of approach. The second thing is a guess, that maybe &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_kt}$&lt;/span&gt; can be computed in some different way, than using Taylor series (it's a really wild guess)?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="2098" LastEditDate="2019-12-23T17:16:26.867" LastActivityDate="2019-12-23T17:16:26.867" Title="Where does precisely the dificulty in exponentiating a Hamiltonian $H$ in the quantum simulation problem lay?" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9281" PostTypeId="1" CreationDate="2019-12-21T18:54:09.747" Score="2" ViewCount="97" Body="&lt;p&gt;Is it possible to write a Q# teleportation code which returns a qubit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="8487" LastEditDate="2020-04-12T15:28:24.113" LastActivityDate="2020-04-12T15:28:24.113" Title="Is it possible to write a Q# teleportation code which returns a qubit?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;&lt;q#&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9282" PostTypeId="1" AcceptedAnswerId="9298" CreationDate="2019-12-21T20:09:10.090" Score="4" ViewCount="123" Body="&lt;p&gt;To find the state of a qubit on the &lt;em&gt;Bloch sphere&lt;/em&gt; we use the following formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle=\mathrm{cos}\frac{\theta}{2}|0\rangle+\mathrm{e}^{i\phi}\mathrm{sin}\frac{\theta}{2}|1\rangle&#xA;\end{equation}&lt;/span&gt;&#xA;Is there any built-in function/operation for that in Q#? If not, how to implement this formula in the Q# code? I'm interested in both preparing a qubit in this state given the two angles, and finding the angles given a qubit in some unknown state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="2879" LastEditDate="2019-12-22T19:22:14.563" LastActivityDate="2019-12-22T19:39:27.693" Title="What is the corresponding code for finding the state of a qubit on the Bloch sphere?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;&lt;q#&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9283" PostTypeId="2" ParentId="8799" CreationDate="2019-12-21T20:09:29.873" Score="0" Body="&lt;p&gt;I chatted with my physicist friend. If I understand him correctly, the modern view certainly uses the probabilistic cloud description. However this does not contradict with the motion of electrons which causes orbiting current (and momentum), as long as the motion does not change the probabilistic distribution. In other words, we cannot view each electron with a deterministic orbit, but the whole probabilistic cloud can move around the nucleus without changing the distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please feel free to correct this understanding. Thanks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Happy holidays.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2019-12-21T20:09:29.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9284" PostTypeId="1" AcceptedAnswerId="9293" CreationDate="2019-12-21T20:19:51.527" Score="1" ViewCount="145" Body="&lt;p&gt;I saw a tutorial on this long ago, but lost it. I know that the Pauli-Z operator compiles to Rz, but how? Here are the steps I remember:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we have to solve for &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_(quantum_mechanics)#Schr%C3%B6dinger_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schrodinger equation for time-independent Hamiltonians&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(t) = e^{-iHt}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's weird to have a matrix in an exponent, so we use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_function#Computation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Taylor series expansion of the exponential function&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^x = \sum_{n=0}^{n=\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which gives us:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) = e^{-iHt} =&#xA;\sum_{n=0}^{n=\infty} \frac{(-iHt)^n}{n!} =&#xA;1 + (-iHt) + \frac{(-iHt)^2}{2!} + \frac{(-iHt)^3}{3!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trigonometric_functions#Power_series_expansion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Taylor series expansions for sine and cosine&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know there's some way of rewriting &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; in terms of sine and cosine, then I need to get to Rz:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rz =&#xA;\begin{bmatrix}&#xA;e^{-i \frac{\theta}{2}} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i \frac{\theta}{2}}&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the steps I'm missing? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-12-21T22:28:07.190" LastActivityDate="2019-12-22T16:53:15.193" Title="Compiling the Pauli-Z operator to the Rz operator for Hamiltonian simulation" Tags="&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9285" PostTypeId="2" ParentId="9280" CreationDate="2019-12-21T20:48:48.307" Score="7" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: Hamiltonian simulation does not just mean &quot;exponentiating &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&quot;. It means finding a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that &lt;em&gt;approximates&lt;/em&gt; the matrix exponentiation &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt;. More importantly, the size of the Hamiltonian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; isn't the key concern here. The &lt;strong&gt;gate complexity&lt;/strong&gt; (or &lt;strong&gt;query complexity&lt;/strong&gt;, in case the Hamiltonian is described as an oracle) of matrix exponentiation is. Simulating arbitrary matrix exponentiations using quantum circuits is computationally very expensive. By imposing specific restrictions on the structure of the local interaction &lt;span class=&quot;math-container&quot;&gt;$H_k$&lt;/span&gt; matrices (like, &lt;span class=&quot;math-container&quot;&gt;$H_k$&lt;/span&gt; can act on at most constant &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; number of systems), the complexity of the simulation can be reduced.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Definitions&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The basic goal of the Hamiltonian simulation problem, given a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; Hermitian matrix acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits), is to find an algorithm that approximates &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$||U - e^{-iHt}|| \leq \epsilon$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; is the ideal evolution and &lt;span class=&quot;math-container&quot;&gt;$||.||$&lt;/span&gt; is the operator norm (aka spectral norm)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||A|| := \mathrm{max}_{|\psi\rangle\neq 0}\frac{||A|\psi\rangle||}{|||\psi\rangle||},$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$||\psi\rangle|| = \sqrt{\langle \psi|\psi\rangle}$&lt;/span&gt; is the usual Euclidean norm of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The key that determines the hardness of this problem is not so much the &lt;em&gt;size&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; but rather the gate complexity&lt;/strong&gt; (gate complexity and time complexity are more or less proportional). In order for the Hamiltonian simulation to be &lt;em&gt;efficient&lt;/em&gt;, we need &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be approximable by a quantum circuit containing &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(n)$&lt;/span&gt; gates. Most Hamiltonians &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; do not satisfy this criterion and are thus not efficiently simulable (you may ask for the proof for this as a separate question if you're curious!).  &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Commuting Hamiltonians&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Fortunately, most physically occurring Hamiltonians can indeed be simulated efficiently. A very special case is the class of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local Hamiltonians - these Hamiltonians can be expressed as &lt;span class=&quot;math-container&quot;&gt;$H = \sum_{j=1}^{m} H_j$&lt;/span&gt;  where each &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt; acts non-trivially on at most &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-qubits. We generally assume that &lt;span class=&quot;math-container&quot;&gt;$m \leq \binom{n}{k} = \mathcal{O}(n^k)$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is supposed to be a constant, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be proved from the &lt;a href=&quot;https://en.wikipedia.org/wiki/Solovay%E2%80%93Kitaev_theorem&quot; rel=&quot;noreferrer&quot;&gt;Solovay-Kitaev theorem&lt;/a&gt; that each of the individual &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt; operators can be simulated efficiently (cf. Ashley Montanaro's &lt;a href=&quot;https://people.maths.bris.ac.uk/~csxam/teaching/aqit2016/lecturenotes.pdf&quot; rel=&quot;noreferrer&quot;&gt;lecture notes&lt;/a&gt;). Now if the &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt;'s commute we have &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exp(-iHt) = \exp(-i(\sum_{j=1}^m H_j)) = \prod_{j=1}^{m}\exp(-iH_jt).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here it can also be shown that for any &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; there exists a quantum algorithm that approximates the operator &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; to within &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; in &lt;strong&gt;time &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(m \ \mathrm{polylog}(m/\epsilon))$&lt;/span&gt;&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Non-Commuting Hamiltonians&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;However, this technique does &lt;em&gt;not&lt;/em&gt; work for non-commuting Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt;'s since the formula &lt;span class=&quot;math-container&quot;&gt;$e^{-i(A+B)t} = e^{-iAt}e^{-iBt}$&lt;/span&gt; does not hold for non-commuting matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. But the Lie-Trotter product formula comes to our rescue, which says&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; be Hermitian matrices such that &lt;span class=&quot;math-container&quot;&gt;$||A|| \leq K$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$||B|| \leq K$&lt;/span&gt;, for some real &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$e^{-iA}e^{-iB} = e^{-i(A+B)} + \mathcal{O}(k^2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Applying this formula multiple times, for any Hermitian matrices &lt;span class=&quot;math-container&quot;&gt;$H_1, H_2, \ldots$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$||H_j|| \leq K \leq 1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-iH_1}e^{-iH_2}\ldots e^{-iH_m} = e^{-i(H_1+\ldots + H_m)} + \mathcal{O}(m^3K^2).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, there is a universal constant &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; such that if &lt;span class=&quot;math-container&quot;&gt;$r \geq Cm^3(Kt)^2/\epsilon$&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||e^{-iH_1t/r}e^{-iH_2t/r}\ldots e^{-iH_mt/r}|| \leq \epsilon/r.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, for any such &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||(e^{-iH_1t/r}e^{-iH_2t/r}\ldots e^{-iH_mt/r})^r - e^{-i(H_1 + \ldots + H_m)}|| \leq \epsilon$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;follows from the lemma which states that if &lt;span class=&quot;math-container&quot;&gt;$(U_i), (V_i)$&lt;/span&gt; are sequences of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; unitary operators satisfying &lt;span class=&quot;math-container&quot;&gt;$||U_i - V_i||$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$1\leq i \leq m$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$||U_m\ldots U_1 - V_m\ldots V_1||\leq m\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given this result, any &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local Hamiltonian can be simulated simply by simulating the evolution of each term for time &lt;span class=&quot;math-container&quot;&gt;$t/r$&lt;/span&gt; to high enough accuracy and concatenating the individual simulations. Larger the &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, more accurate the simulation. This can be formalized as &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be a Hamiltonian which can be written as the sum of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; terms &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt;, each acting non-trivially on &lt;span class=&quot;math-container&quot;&gt;$k = \mathcal{O}(1)$&lt;/span&gt; qubits and satisfying &lt;span class=&quot;math-container&quot;&gt;$||H_j|| \leq K$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. Then, for any &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, there exists a quantum circuit which approximates the operator &lt;span class=&quot;math-container&quot;&gt;$e^{−iHt}$&lt;/span&gt; to within &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; in &lt;strong&gt;time &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(m^3(Kt)^2/\epsilon)$&lt;/span&gt;, up to polylogarithmic factors&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$t^2$&lt;/span&gt; dependency can be further lowered, and the complexity can be improved to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(mkt)$&lt;/span&gt;. You're right that there are other techniques of Hamiltonian simulation like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_simulation#Taylor_Series&quot; rel=&quot;noreferrer&quot;&gt;Taylor series&lt;/a&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\frac{t\log^2(t/\epsilon)}{\log \log \frac{t}{\epsilon}}$&lt;/span&gt;)) and &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_simulation#Quantum_Walk&quot; rel=&quot;noreferrer&quot;&gt;quantum walk&lt;/a&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\frac{t}{\sqrt{\epsilon}})$&lt;/span&gt;). With the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_signal_processing&quot; rel=&quot;noreferrer&quot;&gt;quantum signal processing&lt;/a&gt; algorithm it is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(t + \log \frac{1}{\epsilon})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;References&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Spring 2016: &lt;a href=&quot;https://people.maths.bris.ac.uk/~csxam/teaching/aqit2016/&quot; rel=&quot;noreferrer&quot;&gt;Advanced Quantum Information Theory&lt;/a&gt; by Ashley Montanaro (University of Bristol)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Wikipedia: &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_simulation&quot; rel=&quot;noreferrer&quot;&gt;Hamiltonian Simulation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Andrew Childs' &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/qa/&quot; rel=&quot;noreferrer&quot;&gt;lecture note&lt;/a&gt; and &lt;a href=&quot;https://www.cs.umd.edu/~amchilds/talks/hamiltonian.pdf&quot; rel=&quot;noreferrer&quot;&gt;slides&lt;/a&gt; on quantum simulation  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1712.06349&quot; rel=&quot;noreferrer&quot;&gt;Understanding Quantum Algorithms via Query Complexity (2017)&lt;/a&gt; by Andris Ambainis&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0804.3401&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computational Complexity (2008)&lt;/a&gt; by John Watrous&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-21T21:22:06.010" LastActivityDate="2019-12-21T21:22:06.010" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9286" PostTypeId="2" ParentId="9284" CreationDate="2019-12-21T22:24:48.060" Score="1" Body="&lt;p&gt;So, you have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) = e^{-iHt} =&#xA;\sum_{n=0}^{n=\infty} \frac{(-iHt)^n}{n!} =&#xA;1 + (-iHt) + \frac{(-iHt)^2}{2!} + \frac{(-iHt)^3}{3!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which expands to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) =&#xA;1 - i(Ht) - \frac{(Ht)^2}{2!} + \frac{i(Ht)^3}{3!} + \frac{(Ht)^4}{4!} - \frac{i(Ht)^5}{5!} - \frac{(Ht)^6}{6!} \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that raising &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; to different powers follows the cycle &lt;span class=&quot;math-container&quot;&gt;$1 \rightarrow -i \rightarrow -1 \rightarrow i \rightarrow 1$&lt;/span&gt;. Note also that for &lt;span class=&quot;math-container&quot;&gt;$H = \sigma_z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H^2 = \mathbb{I}$&lt;/span&gt;, the identity matrix. Thus the above series becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) =&#xA;1 - i(Ht) - \frac{t^2}{2!} + \frac{iHt^3}{3!} + \frac{t^4}{4!} - \frac{iHt^5}{5!} - \frac{t^6}{6!} \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall the Taylor series expansions of sine and cosine:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can extract &lt;span class=&quot;math-container&quot;&gt;$\cos(x)$&lt;/span&gt; from the &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; series directly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) = \cos(t) -iHt + \frac{iHt^3}{3!} - \frac{iHt^5}{5!} + \frac{iHt^7}{7!} + \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From which it's easy to extract &lt;span class=&quot;math-container&quot;&gt;$\sin(x)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) = \cos(t) - iH \left( t - \frac{t^3}{3!} + \frac{t^5}{5!} - \frac{t^7}{7!} + \ldots \right) = \cos(t) - iH\sin(t)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now multiply both sides of the equation by the identity matrix and expand &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix}U(t) = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix} \left( \cos(t) - i \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}\sin(t) \right)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) =&#xA;\begin{bmatrix}\cos(t) &amp;amp; 0 \\ 0 &amp;amp; \cos(t)\end{bmatrix} - \begin{bmatrix} i\sin(t) &amp;amp; 0 \\ 0 &amp;amp; -i\sin(t) \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) = \begin{bmatrix}\cos(t) - i\sin(t) &amp;amp; 0 \\ 0 &amp;amp; \cos(t) + i\sin(t)\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recall the identity for Euler's formula:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{ix} = \cos(x) + i\sin(x)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we finally have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(t) = e^{-iHt} = \begin{bmatrix} e^{-it} &amp;amp; 0 \\ 0 &amp;amp; e^{it} \end{bmatrix} = Rz(2t)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2019-12-21T23:02:20.130" LastActivityDate="2019-12-21T23:02:20.130" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9287" PostTypeId="1" AcceptedAnswerId="9294" CreationDate="2019-12-22T01:14:50.723" Score="2" ViewCount="153" Body="&lt;p&gt;Here's the Rz matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rz(\theta) =&#xA;\begin{bmatrix}&#xA;e^{-i\theta/2} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\theta/2}&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it, Rz rotates around the Z axis on the Bloch sphere. Since &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; are both on the Bloch sphere X-Y plane, it seems you should be able to rotate between them; however, I can't figure out a value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; to do that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I misunderstanding how the rotation gates work, or is there just a solution I'm not seeing?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-12-25T06:13:10.607" Title="Can you use Rz to flip from $|+\rangle$ to $|-\rangle$?" Tags="&lt;quantum-gate&gt;&lt;bloch-sphere&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9288" PostTypeId="2" ParentId="9264" CreationDate="2019-12-22T01:37:26.647" Score="4" Body="&lt;p&gt;Quantum teleportation has been suggested to be possible to occur in photosynthetic reaction centers. &lt;a href=&quot;https://doi.org/10.1007/BF03166259&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1007/BF03166259&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And it could in principle be occuring all the time through photochemistry in biology. Though to no real purpose, however, a related purposeful effect is the avian compass which(is hypothesized) to operate through quantum effects.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And more recently teleportation was demonstrated in a small molecule photosynthetic mimic. &lt;a href=&quot;https://doi.org/10.1038/s41557-019-0332-8&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1038/s41557-019-0332-8&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry if there are paywalls.&lt;/p&gt;&#xA;" OwnerUserId="9579" LastActivityDate="2019-12-22T01:37:26.647" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9289" PostTypeId="2" ParentId="9287" CreationDate="2019-12-22T02:01:32.357" Score="2" Body="&lt;p&gt;If you use &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt;, you get the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rz(\pi)\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} =&#xA;\begin{bmatrix}&#xA;e^{-i \pi/2} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i \pi/2}&#xA;\end{bmatrix}&#xA;\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} =&#xA;\begin{bmatrix}&#xA;-i &amp;amp; 0 \\&#xA;0 &amp;amp; i&#xA;\end{bmatrix}&#xA;\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} =&#xA;-i\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is equal to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; under the global phase &lt;span class=&quot;math-container&quot;&gt;$-i = e^{-i\pi/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2019-12-22T02:01:32.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9290" PostTypeId="2" ParentId="9284" CreationDate="2019-12-22T05:38:01.497" Score="2" Body="&lt;p&gt;The Euler's formula for Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{ix\sigma_i} = \cos(x)I + i\sin(x)\sigma_i$$&lt;/span&gt;&#xA;Applying it to &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{ix\sigma_z} = \cos(x)I + i\sin(x)\sigma_z$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(t) = e^{-i\sigma_zt} = \begin{bmatrix} e^{-it} &amp;amp; 0 \\ 0 &amp;amp; e^{it} \end{bmatrix} = R_z(2t)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-22T05:38:01.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9291" PostTypeId="2" ParentId="9287" CreationDate="2019-12-22T05:56:21.147" Score="1" Body="&lt;p&gt;Just think where &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; states on the Bloch sphere (&lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mX4eD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mX4eD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-22T05:56:21.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9292" PostTypeId="2" ParentId="9287" CreationDate="2019-12-22T07:33:22.633" Score="1" Body="&lt;p&gt;On IBM Q the Rz gate is defined as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Rz(\theta) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you put &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt; then the matrix turns to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Rz(\pi) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\pi}&#xA;\end{pmatrix}&#xA;=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix}&#xA;=Z&#xA;\end{equation}&lt;/span&gt;&#xA;Hence &lt;span class=&quot;math-container&quot;&gt;$Rz(\pi)|+\rangle = |-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can rewrite your matrix as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Rz(\theta) =&#xA;\begin{pmatrix}&#xA;\mathrm{e}^{-i\frac{\theta}{2}} &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\frac{\theta}{2}}&#xA;\end{pmatrix}&#xA;=&#xA;\mathrm{e}^{-i\frac{\theta}{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence the only difference is a global phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, Rz gate matrix as defined on IBM Q seems to more convinient as you do not have to deal with a global phase coeficient.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-22T07:33:22.633" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9293" PostTypeId="2" ParentId="9284" CreationDate="2019-12-22T08:06:05.520" Score="1" Body="&lt;p&gt;There are certain misconceptions apparent from your question, and I'll attempt to clear those first.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It's not &lt;em&gt;weird&lt;/em&gt; to have matrices in the exponent. They arise very naturally when studying linear differential equations of the form &lt;span class=&quot;math-container&quot;&gt;$\frac{dx(t)}{dt} = ax(t)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a real or complex variable. Such differential equations have &lt;em&gt;unique&lt;/em&gt; solutions of the form &lt;span class=&quot;math-container&quot;&gt;$ke^{at}x(0)$&lt;/span&gt;. Now if you have a &lt;em&gt;system&lt;/em&gt; of differential equations like &lt;span class=&quot;math-container&quot;&gt;$\mathbf{x}'(t) = \mathbf{A}(t)\mathbf{x}(t) := (x_1'(t) \ \ldots \ x_n'(t))^T = \mathbf{A}(t)(x_1(t) \ \ldots \ x_n(t))$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbf A$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix of real or complex coefficients, we &lt;em&gt;suppose&lt;/em&gt; that the solution is of the form &lt;span class=&quot;math-container&quot;&gt;$\mathbf x(t) = e^{\mathbf At}\mathbf x(0)$&lt;/span&gt; and then go forth and prove that it is indeed the &lt;em&gt;correct&lt;/em&gt; and &lt;em&gt;unique&lt;/em&gt; solution iff &lt;span class=&quot;math-container&quot;&gt;$e^\mathbf{A}$&lt;/span&gt; is &lt;em&gt;defined&lt;/em&gt; as &lt;span class=&quot;math-container&quot;&gt;$$\sum_{m=0}^{\infty}\frac{\mathbf{A}^m}{m!}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And no wonder, Schrödinger's equation is a linear (partial) &lt;em&gt;differential equation&lt;/em&gt; that dictates the evolution of quantum states! Are you beginning to see the link now? Things can be made more rigorous here but I'd probably refer you to a differential equations textbook instead.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Be very careful regarding the application of power series. The series expansion you wrote for &lt;span class=&quot;math-container&quot;&gt;$e^x$&lt;/span&gt; only holds for real and complex &lt;em&gt;numbers&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. A matrix isn't a number! The point is, the exponential of a matrix is &lt;em&gt;defined&lt;/em&gt; as a power series because real functions can be &quot;lifted&quot; to square matrix functions (cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_function#Extending_scalar_function_to_matrix_functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix function&lt;/a&gt;). To emphasize, &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; is &lt;em&gt;defined&lt;/em&gt; as &lt;span class=&quot;math-container&quot;&gt;$\sum_{m=0}^{m=\infty} \frac{(-iHt)^m}{m!}$&lt;/span&gt; and is not a Taylor expansion in the usual sense&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll give you a quick idea of how the &lt;em&gt;definition&lt;/em&gt; of matrix exponentials &lt;span class=&quot;math-container&quot;&gt;$e^{\mathbf{A}}$&lt;/span&gt; is motivated from the study of linear differential equations. Consider the linear ordinary differential equation system&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d}{dt}\mathbf{y}(t) = \mathbf{A} \mathbf {y}(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A}$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$k\times k$&lt;/span&gt; matrix and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{y}(t)$&lt;/span&gt; is the column vector &lt;span class=&quot;math-container&quot;&gt;$(y_1(t),\ldots , y_k(t))^T$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here &lt;span class=&quot;math-container&quot;&gt;$$\frac{d^2}{dt^2}\mathbf y(t)=\frac{d}{dt}\mathbf A\mathbf y(t)=\mathbf A\frac{d}{dt}\mathbf y(t)=\mathbf A^2\mathbf y(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and by induction, you can show that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d^n}{dt^n}\mathbf y(t)=\mathbf A^n\mathbf y(t).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By application of &lt;a href=&quot;https://en.wikipedia.org/wiki/Taylor%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Taylor's theorem&lt;/a&gt; about &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf y(t)=\sum_{n=0}^\infty\left.\frac{d^n}{dt^n}\mathbf y(t)\right|_{t=0}\frac{t^n}{n!}=\sum_{n=0}^\infty\mathbf A^n\mathbf y(0)\frac{t^n}{n!}=\sum_{n=0}^\infty\frac{(\mathbf At)^n}{n!}\mathbf y(0).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the term &lt;span class=&quot;math-container&quot;&gt;$\sum_{n=0}^\infty\frac{(\mathbf At)^n}{n!}$&lt;/span&gt; is &lt;em&gt;labelled&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$e^{\mathbf{A}t}$&lt;/span&gt;. So strictly speaking (reiterating what I said before), &lt;span class=&quot;math-container&quot;&gt;$\sum_{n=0}^\infty\frac{(\mathbf At)^n}{n!}$&lt;/span&gt; is not the &quot;Taylor expansion&quot; of &lt;span class=&quot;math-container&quot;&gt;$e^{\mathbf{A}t}$&lt;/span&gt; but rather its &lt;em&gt;defintion&lt;/em&gt;. This is a subtle point but is absolutely necessary to keep in mind to avoid misconceptions. Most people who do not find matrix exponentials &quot;intuitive&quot; are really stuck at this point. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Diagonal matrices like Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; have some nice properties. Firstly, a matrix like &lt;span class=&quot;math-container&quot;&gt;$\mathbf{A} = \mathrm{diag}(a_1, \ldots, a_n)$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; independent eigenvectors &lt;span class=&quot;math-container&quot;&gt;$e_1, \ldots, e_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; eigenvalues &lt;span class=&quot;math-container&quot;&gt;$a_1, \ldots, a_n$&lt;/span&gt;. Moreover, &lt;span class=&quot;math-container&quot;&gt;$$\mathbf{A}^m = \mathrm{diag}^m(a_1,\ldots , a_n) = \mathrm{diag}(a_1^m,\ldots, a_n^m)$$&lt;/span&gt; which you can prove by induction. From the above you should be able to see that &lt;span class=&quot;math-container&quot;&gt;$$e^{\mathbf{A}} = \sum_{m=0}^{\infty} \frac{\mathbf{A}^m}{m!} = \mathrm{diag}(\sum_{m=0}^{\infty} \frac{a_1^m}{m!},\ldots,\sum_{m=0}^{\infty}\frac{a_n^m}{m!}) =\mathrm{diag}(e^{a_1}, \ldots, e^{a_n}).$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; matrix is &lt;span class=&quot;math-container&quot;&gt;$\mathrm{diag}(1, -1)$&lt;/span&gt; and thus, &lt;span class=&quot;math-container&quot;&gt;$-iZt = \mathrm{diag}(-it, it)$&lt;/span&gt;. And from the above discussion it is clear that &lt;span class=&quot;math-container&quot;&gt;$$e^{-iZt} = \mathrm{diag}(e^{-it}, e^{it}) = \begin{bmatrix}e^{-it} &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp; e^{it}\end{bmatrix},$$&lt;/span&gt; which matches your description of &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2} = t$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\theta = 2t$&lt;/span&gt;, and so &lt;span class=&quot;math-container&quot;&gt;$e^{-iZt} = R_z(\theta = 2t)$&lt;/span&gt;. The Hamiltonian simulation would be equivalent to performing a rotation about the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis (of the Bloch sphere) by an angle of &lt;span class=&quot;math-container&quot;&gt;$\theta = 2t$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alternatively, for diagonal matrices, matrix functions &lt;span class=&quot;math-container&quot;&gt;$f(\mathbf{A}) $&lt;/span&gt; can be directly &lt;em&gt;defined&lt;/em&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mathrm{diag}(f(a_1), \ldots, f(a_n)))$&lt;/span&gt; instead of going via the power series definition (cf. &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_function#Diagonalizable_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;diagonalizable matrices&lt;/a&gt;). This is the reason why I had &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9284/compiling-the-pauli-z-operator-to-the-rz-operator-for-hamiltonian-simulation/9293#comment12812_9284&quot;&gt;earlier mentioned&lt;/a&gt; that it's possible to directly write down  &lt;span class=&quot;math-container&quot;&gt;$e^{-iZt} = \text{diag}(e^{-it}, e^{it}) = R_z(\theta = 2t)$&lt;/span&gt; without even invoking the Taylor series.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The decomposition into sines and cosines and invoking of &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Euler's formula&lt;/a&gt; were unnecessary in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9286&quot;&gt;your answer&lt;/a&gt;. Diagonal and &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_exponential#Diagonalizable_case&quot; rel=&quot;nofollow noreferrer&quot;&gt;diagonalizable&lt;/a&gt; matrices make things much simpler and that is often the case in quantum mechanics as we mostly deal with &lt;a href=&quot;https://math.stackexchange.com/q/363421&quot;&gt;Hermitian matrices&lt;/a&gt; (note that &lt;em&gt;all&lt;/em&gt; Hamiltonian operators &lt;a href=&quot;https://physics.stackexchange.com/a/132131&quot;&gt;are Hermitian&lt;/a&gt;). For infinite-dimensional operators, diagonalization manifests in form of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral theorem&lt;/a&gt;.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Matrix exponentials (&lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_map_(Lie_theory)&quot; rel=&quot;nofollow noreferrer&quot;&gt;exponential maps&lt;/a&gt;) play a crucial role in the study of &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lie groups&lt;/a&gt; and in translating them to &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_algebra&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lie algebras&lt;/a&gt;. They're not merely some weird and ugly series expansion formulae, but are deeply rooted in &lt;a href=&quot;https://en.wikipedia.org/wiki/Differential_geometry&quot; rel=&quot;nofollow noreferrer&quot;&gt;differential geometry&lt;/a&gt; and can be &lt;a href=&quot;https://math.stackexchange.com/q/999515&quot;&gt;visualized nicely&lt;/a&gt; in those terms.  More on that some other day!&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This answer became a bit lengthier than usual, but I hope that I at least managed to somewhat convince you as to why it's &lt;em&gt;not weird&lt;/em&gt; to have matrices in exponents. :)&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-22T16:53:15.193" LastActivityDate="2019-12-22T16:53:15.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9294" PostTypeId="2" ParentId="9287" CreationDate="2019-12-22T09:20:15.400" Score="2" Body="&lt;p&gt;The more elegant approach is to view &lt;span class=&quot;math-container&quot;&gt;$R_z(\phi)$&lt;/span&gt; as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_map&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear transformation&lt;/a&gt; acting on the basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi/2}|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$e^{-i\phi/2}|1\rangle$&lt;/span&gt; by the transformation. As, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt 2}(|0\rangle +|1\rangle)$&lt;/span&gt; it'd be mapped to &lt;span class=&quot;math-container&quot;&gt;$R_z(\phi)|+\rangle = \frac{1}{\sqrt 2}(e^{i\phi/2}|0\rangle + e^{-i\phi/2}|1\rangle)$&lt;/span&gt;. Now the question is, for what value of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; (if at all), &lt;span class=&quot;math-container&quot;&gt;$R_z|+\rangle$&lt;/span&gt; coincides with &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \frac{1}{\sqrt 2}(|0\rangle - |1\rangle)$&lt;/span&gt;. As global phase factors are irrelevant in quantum mechanics, you just need to check for what value of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; (if at all) the coefficients of the basis vectors are in &lt;em&gt;proportion&lt;/em&gt; i.e.,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{e^{i\phi/2}}{e^{-i\phi/2}} = \frac{1}{-1} \implies e^{i\phi} = -1 \implies e^{i\phi} = e^{i\pi} \implies \phi = \pi$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;assuming &lt;span class=&quot;math-container&quot;&gt;$\phi \in [0, 2\pi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, the Bloch sphere visualization (as in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9291&quot;&gt;@kludg's answer&lt;/a&gt;) makes it even more evident. You can clearly see that a anti-clockwise rotation of &lt;span class=&quot;math-container&quot;&gt;$\phi = \pi$&lt;/span&gt; (180 degrees) about the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; - &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; axis) takes the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state to the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;https://i.stack.imgur.com/mX4eD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mX4eD.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;P.S&lt;/strong&gt;: I used &lt;span class=&quot;math-container&quot;&gt;$R_z(\phi)$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; in order to match the convention in the above diagram.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-25T06:13:10.607" LastActivityDate="2019-12-25T06:13:10.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9295" PostTypeId="1" CreationDate="2019-12-22T09:48:19.233" Score="4" ViewCount="175" Body="&lt;p&gt;How to rigorously prove that finite Hamiltonians (for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit systems), in general, are not efficiently&lt;sup&gt;&lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt;&lt;/sup&gt; simulable (in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_simulation#Problem_statement&quot; rel=&quot;noreferrer&quot;&gt;Hamiltonian simulation&lt;/a&gt; sense) using &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(n)$&lt;/span&gt; number of quantum gates?&lt;/p&gt;&#xA;" OwnerUserId="26" LastActivityDate="2019-12-22T12:19:21.277" Title="Proof that most Hamiltonian evolutions are not efficiently approximable by quantum circuits" Tags="&lt;mathematics&gt;&lt;resource-request&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9296" PostTypeId="2" ParentId="9295" CreationDate="2019-12-22T12:19:21.277" Score="4" Body="&lt;p&gt;Perhaps not absolutely rigorous, but....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We know that the vast majority of unitaries require exponentially large circuits. So, define &lt;span class=&quot;math-container&quot;&gt;$H=i\ln U$&lt;/span&gt;. The vast majority of these Hamiltonians take exponentially long to simulate. While there is ambiguity in taking the log, it doesn’t matter how you choose to resolve that ambiguity because they are all “bad”.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2019-12-22T12:19:21.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9297" PostTypeId="2" ParentId="9281" CreationDate="2019-12-22T18:01:21.623" Score="2" Body="&lt;p&gt;I think the code example closest to what you're looking for is &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/master/Teleportation/Tasks.qs#L82&quot; rel=&quot;nofollow noreferrer&quot;&gt;task 1.4 of the Teleportation kata&lt;/a&gt; which gives the learner three qubits (the message qubit and the pair of qubits that Alice and Bob will entangle and share before teleportation) and asks them to transform the Bob's qubit into the message state. You'll notice that the &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/master/Teleportation/Tests.qs#L80&quot; rel=&quot;nofollow noreferrer&quot;&gt;test for this task&lt;/a&gt; doesn't check any classical values - it checks that the state of Bob's qubit is the same as the state in which the message qubit was prepared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q# doesn't allow to allocate a new qubit inside an operation and return it, so you'll need to allocate your input and output qubits before the teleportation.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-12-22T18:01:21.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9298" PostTypeId="2" ParentId="9282" CreationDate="2019-12-22T19:39:27.693" Score="5" Body="&lt;p&gt;&lt;strong&gt;Prepare a qubit in state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\mathrm{cos}\frac{\theta}{2}|0\rangle+\mathrm{e}^{i\phi}\mathrm{sin}\frac{\theta}{2}|1\rangle$&lt;/span&gt;, given the angles &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start with a qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, as is customary for Q#. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can use one of the general library operations to prepare the state, such as &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.preparation.preparearbitrarystate&quot; rel=&quot;noreferrer&quot;&gt;PrepareArbitraryState&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Or you can easily do it yourself using a sequence two gates:  &#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry&quot; rel=&quot;noreferrer&quot;&gt;Ry(&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;)&lt;/a&gt; will transform the qubit from the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\cos\frac{\theta}{2}|0\rangle+\sin\frac{\theta}{2}|1\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1&quot; rel=&quot;noreferrer&quot;&gt;R1(&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;)&lt;/a&gt; will further transform that state into the state you need.&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Figure out the angles &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, given a qubit in some unknown state.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not possible to do in Q#, unless you're willing to do some hacks that will not work on a quantum device. Since real quantum systems don't allow you to peek into their state to get their exact coefficients, Q# doesn't allow you to do this on language level either. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you're running a program on a full-state simulator, you can work around this and use &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpmachine&quot; rel=&quot;noreferrer&quot;&gt;DumpMachine&lt;/a&gt; function to output the qubit state and then analyze it. Here is an example of such output for state &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle = \frac{1}{\sqrt2}|0\rangle - \frac{i}{\sqrt2}|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# wave function for qubits with ids (least to most significant): 0&#xA;∣0❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]&#xA;∣1❭:     0.000000 + -0.707107 i  ==     ***********          [ 0.500000 ]    ↓    [ -1.57080 rad ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Given the complex amplitudes of the state, you can figure out &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2019-12-22T19:39:27.693" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9299" PostTypeId="1" AcceptedAnswerId="9309" CreationDate="2019-12-22T23:45:50.917" Score="2" ViewCount="139" Body="&lt;p&gt;I'm running this program (essentially a two bit random number generator) on &lt;strong&gt;ibmqx2&lt;/strong&gt; in IBM Q Experience. The backend matters. Other machines give unexpected results, but the graph looks different for other backends. So far &lt;strong&gt;ibmqx2&lt;/strong&gt; has been a good choice because a) it produces results that are far from the expected outcome and b) it produces results that are consistent run over run.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;gate nG0 ( param ) q  {&#xA; h q;&#xA;}&#xA;&#xA;qreg q[2];&#xA;creg c[2];&#xA;&#xA;h q[0];&#xA;h q[1];&#xA;measure q[0] -&amp;gt; c[0];&#xA;measure q[1] -&amp;gt; c[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I always get results with the following shape. Note that &quot;11&quot; is a full ten points higher than &quot;10&quot;. That happens almost every run. Any idea what's going on?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/15tKW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/15tKW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9583" LastEditorUserId="9583" LastEditDate="2019-12-23T00:30:00.917" LastActivityDate="2019-12-24T04:08:19.103" Title="Simple program produces consistently skewed results in IBM Q Experience" Tags="&lt;ibm-q-experience&gt;&lt;experiment&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9300" PostTypeId="2" ParentId="8898" CreationDate="2019-12-22T23:55:11.577" Score="4" Body="&lt;p&gt;I take your statement that programmers &quot;don't need to know the machinery behind the prevailing paradigm&quot; to mean that most scientific programmers need not know how a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gate is realized, with, say, a set of &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; or so transistors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, probably a concept that is fundamental in quantum computing, that can be understood by anyone familiar with logical operations like &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{OR}$&lt;/span&gt;, etc. is that of &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;reversible computing&lt;/a&gt;.  For example quantum computing logical gates &lt;em&gt;must&lt;/em&gt; be reversible, and gates like &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; etc. are ruled out.  Information is lost in such gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, gates like &lt;span class=&quot;math-container&quot;&gt;$\mathsf{XNOR}$&lt;/span&gt; are still allowed in quantum computing (because they are reversible, and the input could be recovered.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because information cannot be erased in quantum circuits, it becomes difficult, though not impossible, to program recursive subroutines with reversible gates.  See e.g. this &lt;a href=&quot;https://www.quantamagazine.org/a-new-approach-to-multiplication-opens-the-door-to-better-quantum-computers-20190424/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quanta article&lt;/a&gt; on the problems of recursion in quantum computing, and the recent breakthrough of Gidney.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2019-12-22T23:55:11.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9301" PostTypeId="1" AcceptedAnswerId="9307" CreationDate="2019-12-23T02:57:51.917" Score="6" ViewCount="1309" Body="&lt;p&gt;Having just studied the two formulations of quantum mechanics, it makes me wonder why the decision was used to use Heisenberg's &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Matrix Mechanics&lt;/a&gt; and not Schrödinger's &lt;a href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wave Mechanics&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know the two are equivalent. I also know that analog forms of quantum computing such as quantum annealing and adiabatic quantum computation use different formulations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was it because that was what Deutsch, Shor, et al. used? Is it because it fits conveniently into a circuit model of quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="4693" LastEditorUserId="4693" LastEditDate="2019-12-24T00:01:55.987" LastActivityDate="2019-12-29T23:20:35.557" Title="Why does quantum computing generally use Heisenberg's Matrix Mechanics instead of Schrödinger's Wave Mechanics?" Tags="&lt;mathematics&gt;&lt;history&gt;&lt;foundations&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9302" PostTypeId="1" CreationDate="2019-12-23T03:18:21.020" Score="1" ViewCount="162" Body="&lt;p&gt;I ran into a problem of how to extract circuit depth from Cirq circuit object. In Cirq circuits consist of a list of Moments. Number of moments is not equal to the circuit depth in general case.&#xA;I might be missing something, but I looked into documentation and source code and still wasn't able to find it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I am wondering if there is a simple way to extract circuit depth?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is one of the main circuit properties, it is very strange why it is not implemented directly. For example in Qiskit there are methods &lt;code&gt;qc.depth()&lt;/code&gt; and &lt;code&gt;qc.count_ops()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7896" LastEditorUserId="26" LastEditDate="2019-12-23T22:39:43.317" LastActivityDate="2019-12-23T22:39:43.317" Title="Computing circuit depth in Cirq" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9303" PostTypeId="2" ParentId="9299" CreationDate="2019-12-23T05:10:40.443" Score="1" Body="&lt;p&gt;Each quantum processor has specific so-called error rate and a little bit different type of noise caused by specific conditions the processor runs in. Therefore, results produced by same circuits can be different on different quantum processors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, there is apparently a bias caused by some external factors specific for ibmqx2. You can try to run your program after ibmqx2 recalibration which occurs in regular intervals (ask IBM Q support when a next maintanance is planned). After that, results can be more correct, i.e. closer to uniform distribution. &lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-23T05:10:40.443" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9304" PostTypeId="2" ParentId="9302" CreationDate="2019-12-23T07:55:40.223" Score="3" Body="&lt;p&gt;On hardware, the number of moments is the relevant metric. That is why cirq focuses on that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute circuit depth in cirq, create a new circuit using just the operations. It defaults to packing them as tightly as possible, so the number of moments will be the depth.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;depth = len(cirq.Circuit(my_circuit.all_operations()))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-12-23T07:55:40.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9305" PostTypeId="2" ParentId="9301" CreationDate="2019-12-23T08:31:48.463" Score="1" Body="&lt;p&gt;The quantum circuit model does not use the Heisenberg picture of quantum mechanics. Also, what is &quot;Dirac's Matrix Mechanics&quot;? Quantum computing widely uses Dirac's bra-ket notation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum circuit model considers how state vectors of qubits are transformed by quantum gates which follows the Schrödinger picture of quantum mechanics.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;PS: Maybe I need to say more. The difference between Schrödinger and Heisenberg pictures of QM is totally unrelated to the difference between differential equation and matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I have a qubit&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle=\begin{pmatrix}&#xA;1\\&#xA;0&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;and apply Hadamard gate to it; as a result, the state of the qubit changes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1\\&#xA;0&#xA;\end{pmatrix}\rightarrow\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1&amp;amp;1\\&#xA;1&amp;amp;-1&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;1\\&#xA;0&#xA;\end{pmatrix}&#xA;=\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1\\&#xA;1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;This is Schrödinger way of thinking, and it is used in Quantum Computing without saying it explicitly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Heisenberg picture of QM is &lt;strong&gt;very&lt;/strong&gt; different; It goes as follows: suppose I have &lt;span class=&quot;math-container&quot;&gt;$S_z$&lt;/span&gt; spin operator,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_z=\frac{\hbar}{2}\sigma_z=\frac{\hbar}{2}\begin{pmatrix}&#xA;1&amp;amp;0\\&#xA;0&amp;amp;-1&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;and apply Hadamard gate to it:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_z\rightarrow\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1&amp;amp;1\\&#xA;1&amp;amp;-1&#xA;\end{pmatrix}S_z&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1&amp;amp;1\\&#xA;1&amp;amp;-1&#xA;\end{pmatrix}=\frac{\hbar}{2}&#xA;\begin{pmatrix}&#xA;0&amp;amp;1\\&#xA;1&amp;amp;0&#xA;\end{pmatrix}=S_x&#xA;$$&lt;/span&gt;&#xA;That is, Hadamard gate transforms &lt;span class=&quot;math-container&quot;&gt;$S_z$&lt;/span&gt; operator to &lt;span class=&quot;math-container&quot;&gt;$S_x$&lt;/span&gt; operator (or transforms &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; Pauli matrix to &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; Pauli matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is Heisenberg way of thinking; I'm not sure it suits well to quantum circuit model.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2019-12-23T14:14:42.707" LastActivityDate="2019-12-23T14:14:42.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9306" PostTypeId="2" ParentId="9301" CreationDate="2019-12-23T09:30:17.733" Score="4" Body="&lt;p&gt;Semantics aside, I’m assuming that your question is essentially “why do we use a matrix formulation of quantum mechanics rather than a continuous variable/differential equation/integral formulation” (I may be wrong and would welcome clarification) and nothing to do with the interaction picture and the like, which some other answers seem to be touching upon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Largely, we use the bra-ket notation of Dirac, so we might write quantities such as &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\phi\rangle$&lt;/span&gt;. These are very abstract entities. You can choose to &lt;em&gt;represent&lt;/em&gt; these abstract entities using either a vector/matrix formalism of an integral formalism. It doesn't matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we typically choose to use vectors just because it tends to make the maths easier. Vectors have, somewhat more obviously, properties such as orthogonality built into them, so I don't end up evaluating integrals all the time. Particularly when I want to talk about a two-level system, I &lt;em&gt;could&lt;/em&gt; describe it using two continuous functions &lt;span class=&quot;math-container&quot;&gt;$\psi_0(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\psi_1(x)$&lt;/span&gt;, but it's just overkill.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sort of problem that I studied as an undergraduate would talk, for example, about the infinite square well. You'd be given some initial state &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, and asked what it looks like at some later time. Perhaps you have to evaluate the probability that the particle is on the right-hand side of the well. By far the quickest way of doing this is to decompose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x)=\sum_n\alpha_n\psi_n(x),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\psi_n(x)$&lt;/span&gt; are the stationary states of energy &lt;span class=&quot;math-container&quot;&gt;$E_n$&lt;/span&gt;. The &lt;em&gt;only&lt;/em&gt; thing I really care about is the discrete set of values &lt;span class=&quot;math-container&quot;&gt;$\alpha_n$&lt;/span&gt;, which are most conveniently stored as a vector. Then the solution would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_n\alpha_ne^{-iE_nt}\psi_n(x).&#xA;$$&lt;/span&gt;&#xA;Next, I decompose the state of being on the right-hand side of the well as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_n\beta_n\psi_n(x).&#xA;$$&lt;/span&gt;&#xA;The probability that the final state is on that side is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left|\sum_n\beta_n^\star\alpha_ne^{-iE_nt}\right|^2.&#xA;$$&lt;/span&gt;&#xA;The only integrals that I need to do are to evaluate the &lt;span class=&quot;math-container&quot;&gt;$\alpha_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta_n$&lt;/span&gt;. The rest of the calculation is more easily done using orthogonality/linearity properties which are all present in the integral form, but are harder to see. So you very quickly start abstracting away from the integral form and are naturally led towards linear algebra.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2019-12-23T17:48:37.687" LastActivityDate="2019-12-23T17:48:37.687" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9307" PostTypeId="2" ParentId="9301" CreationDate="2019-12-23T11:21:16.410" Score="6" Body="&lt;h2&gt;Quantum computing, in general, does &lt;em&gt;not&lt;/em&gt; use Heisenberg's matrix mechanics or Dirac's interaction picture.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;I suggest that you &lt;em&gt;carefully&lt;/em&gt; read the Wikipedia page on &lt;a href=&quot;https://en.wikipedia.org/wiki/Schr%C3%B6dinger_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;dynamical pictures&lt;/a&gt;. The differences between the &lt;a href=&quot;https://en.wikipedia.org/wiki/Heisenberg_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heisenberg picture&lt;/a&gt;, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dynamical_pictures#Schr%C3%B6dinger_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schrödinger picture&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Interaction_picture&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirac (interaction) picture&lt;/a&gt; are well summarized in the following chart. The development of matrix mechanics, as a mathematical formulation of quantum mechanics, is attributed to Werner Heisenberg, Max Born, and Pascual Jordan.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F6TZz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F6TZz.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the widely used &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit model&lt;/a&gt; of quantum computing, the qubit states evolve in time as per &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_(quantum_mechanics)#Schr%C3%B6dinger_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Schrödinger equation &lt;span class=&quot;math-container&quot;&gt;$|\Psi_s(t)\rangle = e^{-iH_st}|\Psi_s(0)\rangle$&lt;/span&gt;&lt;/a&gt; (by application of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum gates&lt;/a&gt;) while the observables are constant (note that observables in quantum mechanics are defined in terms of &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;positive operator-valued measures&lt;/a&gt;). For details, read &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_circuit#Quantum_computations&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; section. So your claim that quantum computing (or quantum information theory for that matter) uses Heisenberg's matrix mechanics, is incorrect. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I presume your confusion arose because you saw matrices all around in quantum computing textbooks and thought they use some kind of &quot;matrix mechanics&quot;, but in reality, Heisenberg's matrix mechanics is something completely different i.e., it's an algebraic approach to quantum mechanics using mathematical devices like &lt;a href=&quot;https://en.wikipedia.org/wiki/Ladder_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;ladder operators&lt;/a&gt;. Moreover, in Heisenberg's matrix mechanics quantum states remain constant while the operators evolve (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9305&quot;&gt;kludg's answer&lt;/a&gt; for an example). Nevertheless, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9306&quot;&gt;DaftWullie's answer&lt;/a&gt; explains why matrices are preferable to using continuous-wave functions for low-dimensional finite systems like qubits in quantum computing if that's what you were confused about.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nearly 100 years ago, &lt;a href=&quot;https://en.wikipedia.org/wiki/John_von_Neumann&quot; rel=&quot;nofollow noreferrer&quot;&gt;von Neumann&lt;/a&gt; had already fairly rigorously shown &lt;a href=&quot;https://physics.stackexchange.com/questions/173219&quot;&gt;the equivalence&lt;/a&gt; (under certain reasonable assumptions cf. &lt;a href=&quot;https://physics.stackexchange.com/a/485802&quot;&gt;this&lt;/a&gt;) among all the three pictures with his &lt;a href=&quot;https://plato.stanford.edu/entries/qt-nvd/#2.1&quot; rel=&quot;nofollow noreferrer&quot;&gt;separable Hilbert space formulation&lt;/a&gt; of quantum mechanics (which really underpins all of modern quantum mechanics and quantum information theory); the three pictures differ only by a basis change with respect to time-dependency. It's just that one picture might be more useful than another in certain contexts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rotation of state vectors in the Hilbert space is easier to visualize than evolving observables and that's one of the reasons why the Schrödinger picture preferred in introductory approaches to quantum mechanics. And, in general, quantum computing just deals with &quot;toy&quot; systems from quantum mechanics i.e., finite-dimensional qubit or qudit systems, whereas very high-dimensional or infinite-dimensional systems are much more prevalent in the real-world (though, there are exceptions like &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-variable_quantum_information&quot; rel=&quot;nofollow noreferrer&quot;&gt;continous variable quantum information&lt;/a&gt; that makes use of physical observables like the strength of electromagnetic fields whose values belong to continuous intervals).&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2019-12-29T23:20:35.557" LastActivityDate="2019-12-29T23:20:35.557" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9309" PostTypeId="2" ParentId="9299" CreationDate="2019-12-24T04:08:19.103" Score="4" Body="&lt;p&gt;It seems like the skew is indeed high on qubit 0. I ran a single Hadamard followed by measure on this qubit, and see about 13% skew. The other qubits on this device seem fine (less than 2% skew).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is probably an error on the backend's discriminator (i.e. manifesting as high readout error). To see this, you can try applying readout error mitigation (&lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/ignis/4_measurement_error_mitigation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;code for this exists in Qiskit Ignis&lt;/a&gt;). When I do this, the skew is completely gone.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FvIc7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FvIc7.png&quot; alt=&quot;Q0 on ibmqx2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be fixed on the backend. Thanks for reporting.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2019-12-24T04:08:19.103" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9310" PostTypeId="1" CreationDate="2019-12-24T06:19:54.137" Score="2" ViewCount="171" Body="&lt;p&gt;Does unit testing on real quantum computers make sense as any observation in the quantum system can cause the system to loose its superposition state?&lt;/p&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="8487" LastEditDate="2020-04-12T15:27:13.020" LastActivityDate="2020-04-12T15:27:13.020" Title="Unit testing for quantum programs?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9312" PostTypeId="2" ParentId="9310" CreationDate="2019-12-24T10:14:54.500" Score="2" Body="&lt;p&gt;From what I know, no testing framework exists yet for quantum computing. I searched approximately one year ago for one and did not find anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this does not mean you can't test!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below are the methods I ended up using when I saw that no specialised testing framework for quantum computing was out there in the wild.&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;&lt;em&gt;Unitary simulation&lt;/em&gt;&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;This method can only be used for &lt;strong&gt;small&lt;/strong&gt; circuits. It uses &lt;span class=&quot;math-container&quot;&gt;$2^{2n + 8 + 1}$&lt;/span&gt; octets of memory, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; being the number of qubits used by the circuit. With 8Go of RAM, you can use this method up to &lt;span class=&quot;math-container&quot;&gt;$\approx 11$&lt;/span&gt; qubits. A computer with 32Go of RAM can go up to &lt;span class=&quot;math-container&quot;&gt;$\approx 12$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;1. Circuits given by unitary matrices (no ancilla)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Imagine that some quantum algorithm requires me to implement the operation &lt;span class=&quot;math-container&quot;&gt;$e^{-iZ\otimes F t}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; Pauli &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; gate and &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; a known Hermitian matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I implemented this gate with a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; &lt;strong&gt;that does not need any ancilla qubit&lt;/strong&gt; and I now want to check that my implementation implements correctly (maybe up to a given error) &lt;span class=&quot;math-container&quot;&gt;$e^{-iZ\otimes Ft}$&lt;/span&gt;. As the quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is assumed to act on a small number of qubits (remember, circuits are assumed &lt;strong&gt;small&lt;/strong&gt; in this section), I can use a little linear algebra to compute the unitary matrix that &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; implements. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hopefully, some frameworks already implement the linear algebra part. For example qiskit has a &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/blob/master/qiskit/providers/aer/backends/unitary_simulator.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary simulator&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final test code would look like this in pseudo-code (as it is not specialised to one testing framework nor to one quantum computing framework):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;&#xA;qubit_number = 5&#xA;absolute_error_tol = 1e-3&#xA;relative_error_tol = 1e-3&#xA;&#xA;qcirc = get_quantum_circuit(qubit_number)&#xA;implemented_unitary = unitary_simulator(qcirc).get_unitary()&#xA;expected_unitary = numpy.zeros((2**qubit_number, 2**qubit_number),&#xA;                               dtype=numpy.complex)&#xA;&#xA;assert numpy.allclose(&#xA;    implemented_unitary,&#xA;    expected_unitary,&#xA;    atol=absolute_error_tol,&#xA;    rtol=relative_error_tol&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2&gt;2. Circuit given by unitary matrices (with ancillas)&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;To test quantum circuits that require ancilla qubits, you should &quot;separate&quot; the ancillas from the meaningful qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I assume that all the ancillas are pushed to the end, i.e. the last qubits are all ancillas. For example: &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle \vert v(x) \rangle \vert a \rangle$&lt;/span&gt;. If it is not the case, you will need to change the indexing of the example program at the end of this section according to your quantum register layout.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now that there are ancillas we have something else to check: are &lt;strong&gt;all&lt;/strong&gt; the ancillas returned to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; at the end of my quantum circuit? In other words, the action of my quantum circuit on the ancillas must be the identity matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The pseudo-code for this kind of quantum circuits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;&#xA;qubit_number = 5&#xA;ancillas_number = 3&#xA;absolute_error_tol = 1e-3&#xA;relative_error_tol = 1e-3&#xA;&#xA;qcirc = get_quantum_circuit(qubit_number, ancillas_number)&#xA;implemented_unitary = unitary_simulator(qcirc).get_unitary()&#xA;expected_unitary = numpy.zeros((2**qubit_number, 2**qubit_number),&#xA;                               dtype=numpy.complex)&#xA;&#xA;# The implemented_unitary is a matrix of size&#xA;# (2**(qubit_number + ancillas_number), 2**(qubit_number + ancillas_number))&#xA;# whereas the expected_unitary is of size&#xA;# (2**(qubit_number), 2**(qubit_number)). In order to compare the&#xA;# 2 matrices, we should &quot;upgrade&quot; the expected_unitary with identity matrices.&#xA;expected_unitary = numpy.kron(expected_unitary, numpy.identity(2**ancillas_number))&#xA;&#xA;assert numpy.allclose(&#xA;    implemented_unitary,&#xA;    expected_unitary,&#xA;    atol=absolute_error_tol,&#xA;    rtol=relative_error_tol&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h1&gt;Statevector simulation&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;For simulable circuits. It uses &lt;span class=&quot;math-container&quot;&gt;$2^{n + 4 + 1}$&lt;/span&gt; octets of memory, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; being the number of qubits used by the circuit. With 8Go of RAM you can use this method up to &lt;span class=&quot;math-container&quot;&gt;$\approx 27$&lt;/span&gt; qubits. A computer with 32Go of RAM can go up to &lt;span class=&quot;math-container&quot;&gt;$\approx 29$&lt;/span&gt; qubis. Qiskit's online simulator &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt; can go up to &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;1. Circuit given by unitary matrix that use a lot of ancillas&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The unitary matrix simulation method is usefull, but cannot be used for medium-sized and large quantum circuits because of its large memory footprint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the tested quantum circuit has a lot of &quot;garbage&quot; qubits (i.e. ancillas), a little trick can allow us to test it, even if the quantum circuit needs &lt;span class=&quot;math-container&quot;&gt;$n + a &amp;gt; 20$&lt;/span&gt; qubits (where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the number of ancilla qubits and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of &quot;interesting&quot; qubits, i.e. the total number of qubits minus the number of ancillas).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is the following: as ancilla qubits should be given in the &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; state and returned to the same state, the input space of your quantum circuit is reduced from &lt;span class=&quot;math-container&quot;&gt;$2^{n+a}$&lt;/span&gt; (the number of input states possible when counting the ancilla qubits) to &lt;span class=&quot;math-container&quot;&gt;$2^{n}$&lt;/span&gt; (the number of input states really possible as ancillas should always be given in &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;).&#xA;This means that if &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is sufficiently small, you can simulate the action of your quantum circuit on all the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible input states, and verify that the output state is correct (ancillas back to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;, &quot;interesting&quot; qubits in the expected state, ...).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute the expected state of your &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &quot;interesting&quot; qubits, you have 2 ways:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Construct the unitary matrix of size &lt;span class=&quot;math-container&quot;&gt;$\left( 2^n, 2^n \right)$&lt;/span&gt; that represent the expected evolution performed by your quantum circuit and apply it to the input quantum state.&lt;/li&gt;&#xA;&lt;li&gt;Compute &quot;by hand&quot; the expected output quantum state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For this kind of test, here is the pseudo code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;&#xA;qubit_number = 5&#xA;ancillas_number = 3&#xA;absolute_error_tol = 1e-3&#xA;relative_error_tol = 1e-3&#xA;&#xA;qcirc = get_quantum_circuit(qubit_number, ancillas_number)&#xA;&#xA;# The unitary matrix that your circuit should implement.&#xA;# Replace initialisation with your unitary matrix.&#xA;reduced_evolution = numpy.zeros((2**qubit_number, 2**qubit_number),&#xA;                                dtype=numpy.complex)&#xA;&#xA;for state in range(2**qubit_number):&#xA;    # If state = 10 (base 10), do:&#xA;    # 10 -&amp;gt; 8+2 -&amp;gt; 1010 (base 2) -&amp;gt; |1010&amp;gt; -&amp;gt; vector of size 16 with zeros everywhere&#xA;    #                                         except in the 10th entry where there is a 1.&#xA;    qstate = integer_state_to_vector(state)&#xA;    expected_qstate = reduced_evolution @ qstate # matrix-vector multiplication&#xA;&#xA;    computed_qstate = simulate(qcirc, input_state=qstate).get_statevector()&#xA;    # The compute_qstate is a vector of 2^{qubit_number + ancillas_number} complex values.&#xA;    # It should be the tensor product between expected_qstate and |0...0&amp;gt; (ancilla qubits&#xA;    # should be reverted to |0&amp;gt; at the end).&#xA;    ancilla_state_full_zero = numpy.zeros((2**ancilla_state, ), dtype=numpy.complex)&#xA;    ancilla_state_full_zero[0] = 1.0&#xA;&#xA;    assert numpy.allclose(&#xA;        numpy.kron(expected_qstate, ancilla_state_full_zero),&#xA;        computed_qstate,&#xA;        atol=absolute_error_tol,&#xA;        rtol=relative_error_tol,&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Footnote&lt;/strong&gt;: I think I missed some things, I will come back to this answer as soon as I have more time. Do not hesitate to ask me questions if something is not explained enough.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2019-12-24T10:14:54.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9313" PostTypeId="1" AcceptedAnswerId="9315" CreationDate="2019-12-24T16:47:13.257" Score="4" ViewCount="374" Body="&lt;p&gt;I want to write matrix representation of qubit swap algorithm, but I seem to be stuck.&#xA;Here is the circuit I am trying to calculate using linear algebra:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/U5MTs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/U5MTs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially &lt;span class=&quot;math-container&quot;&gt;$q_0 = |0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 &amp;amp; 0\end{pmatrix}^T$&lt;/span&gt; while &lt;span class=&quot;math-container&quot;&gt;$q_1 = |1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 &amp;amp; 1\end{pmatrix}^T$&lt;/span&gt; and at the end of measurement I should be getting opposite outcomes. I know that to apply first &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate I should first do Kronecker product on the two vectors and than multiply it by &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; matrix, but I cant figure out what needs to be done next, particularly how to apply second &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; to my quantum state (control bit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, target bit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="9325" LastEditorUserId="9006" LastEditDate="2019-12-25T07:26:10.860" LastActivityDate="2019-12-25T07:26:10.860" Title="Representing qubit swap using linear algebra" Tags="&lt;matrix-representation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9314" PostTypeId="2" ParentId="9313" CreationDate="2019-12-24T17:46:24.887" Score="1" Body="&lt;p&gt;The Swap gate is represented by the matrix &lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix} 1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\end{bmatrix}&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lqCYy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lqCYy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Example from book &lt;strong&gt;Quantum Computing: An Applied Approach&lt;/strong&gt; by Jack Hidary&lt;/p&gt;&#xA;" OwnerUserId="4693" LastActivityDate="2019-12-24T17:46:24.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9315" PostTypeId="2" ParentId="9313" CreationDate="2019-12-24T20:22:43.320" Score="5" Body="&lt;p&gt;Here, what you need to do is to understand writing CNOT gate based on the control qubit. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Your &lt;strong&gt;first CNOT gate&lt;/strong&gt; has qubit 1 as control and qubit 2 as target. So, what this means is the second qubit will not be flipped until qubit 1 is set to zero. I am going to use computational basis for this &lt;span class=&quot;math-container&quot;&gt;$CNOT_1\left|00\right&amp;gt; = \left|00\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT_1\left|01\right&amp;gt; = \left|01\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT_1\left|10\right&amp;gt; = \left|11\right&amp;gt;$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$CNOT_1\left|11\right&amp;gt; = \left|10\right&amp;gt;$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT_1 = \left[\begin{matrix}1 &amp;amp; 0 &amp;amp;0 &amp;amp;0\\ 0 &amp;amp; 1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0\end{matrix}\right]$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Your &lt;strong&gt;second CNOT gate&lt;/strong&gt; has qubit 1 as target and qubit 2 as control. Thus, until qubit 2 is set to 1, qubit 1 will not flipped. Again, using the computational basis &lt;span class=&quot;math-container&quot;&gt;$CNOT_2\left|00\right&amp;gt; = \left|00\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT_2\left|01\right&amp;gt; = \left|11\right&amp;gt;$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT_2\left|10\right&amp;gt; = \left|10\right&amp;gt;$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$CNOT_2\left|11\right&amp;gt; = \left|01\right&amp;gt;$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT_2 = \left[\begin{matrix}1 &amp;amp; 0 &amp;amp;0 &amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0\\ 0 &amp;amp; 1&amp;amp;0&amp;amp;0\end{matrix}\right]$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Your &lt;strong&gt;third CNOT&lt;/strong&gt; gate is &lt;span class=&quot;math-container&quot;&gt;$CNOT_1$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;What you can do to get the SWAP gate is apply these CNOT gates in the order they were applied. &lt;/p&gt;&#xA;" OwnerUserId="2598" LastActivityDate="2019-12-24T20:22:43.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9316" PostTypeId="1" AcceptedAnswerId="9356" CreationDate="2019-12-24T21:53:36.250" Score="4" ViewCount="141" Body="&lt;p&gt;I would like some help on what should be a simple computation that I'm failing to see through to the end. Suppose I have a qubit which can be in the state &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt;. I will choose some unitary basis &lt;span class=&quot;math-container&quot;&gt;$|a\rangle, |b\rangle$&lt;/span&gt;, and measure the qubit -- if I get &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; I will guess the state was &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;, and if I get &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; I will guess the state was &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;. My probability of success is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S = p|\langle a|v \rangle|^2 + (1-p)|\langle b | w \rangle|^2$$&lt;/span&gt;&#xA;What I want is to maximize this probability. I can think of &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; as functions of some parameter and apply calculus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S' = p 2 \Re(\langle a' | v \rangle \langle v | a \rangle) + (1-p)2\Re(\langle b' | w\rangle \langle w | b\rangle)$$&lt;/span&gt;&#xA;If we're setting this to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; we can ignore the factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\langle a | a \rangle = 1$&lt;/span&gt;, differentiating we obtain &lt;span class=&quot;math-container&quot;&gt;$\Re\langle a' | a \rangle = 0$&lt;/span&gt;, and similarly &lt;span class=&quot;math-container&quot;&gt;$\Re\langle b'|b \rangle = 0$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Writing for now &lt;span class=&quot;math-container&quot;&gt;$v = v_a a + v_b b$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$\langle v|a \rangle = \overline{v_a}$&lt;/span&gt;. Hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Re(\langle a'|v\rangle \langle v|a \rangle) = \Re(v_a \overline{v_a} \langle a'|a \rangle + \overline{v_a}v_b \langle a'|b \rangle)$$&lt;/span&gt;&#xA;but since &lt;span class=&quot;math-container&quot;&gt;$v_a \overline{v_a} = |v_a|^2$&lt;/span&gt; is real and &lt;span class=&quot;math-container&quot;&gt;$\langle a' | a \rangle$&lt;/span&gt; is purely imaginary the first term dies and we obtain &lt;span class=&quot;math-container&quot;&gt;$\Re(\overline{v_a}v_b \langle a'|b \rangle)$&lt;/span&gt;. A similar computation goes for &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, and in the end we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$0 = S'/2 = \Re(p \overline{v_a}v_b \langle a'|b \rangle + (1-p) w_a \overline{w_b} (-\overline{\langle a'|b \rangle}))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I used &lt;span class=&quot;math-container&quot;&gt;$\langle b'|a \rangle = - \overline{\langle a'|b \rangle}$&lt;/span&gt; which is obtained by differentiating the relation &lt;span class=&quot;math-container&quot;&gt;$\langle a | b \rangle = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is where I get stuck. It feels like I need to combine these terms somehow so some kind of cancellation between the &lt;span class=&quot;math-container&quot;&gt;$\langle a'|b \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$- \overline{\langle a'|b \rangle}$&lt;/span&gt; terms happen, but I don't see how to do it. Any help is greatly appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I realize now we can use &lt;span class=&quot;math-container&quot;&gt;$w_a \overline{w_b} = \overline{\overline{w_a}w_b}$&lt;/span&gt; to obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p \Re(\overline{v_a}v_b \langle a'|b \rangle) = (1-p) \Re(\overline{w_a}w_b \langle a'|b \rangle)$$&lt;/span&gt; where I can ignore the conjugate over everything on the right hand side since we're taking the real part.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(What I wrote previously after this did not make sense)&lt;/p&gt;&#xA;" OwnerUserId="9168" LastEditorUserId="55" LastEditDate="2020-11-11T21:38:00.830" LastActivityDate="2020-11-11T21:38:00.830" Title="Finding the optimal projective measurement to distinguish between two pure states" Tags="&lt;quantum-state&gt;&lt;state-discrimination&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9317" PostTypeId="2" ParentId="9313" CreationDate="2019-12-24T23:28:03.997" Score="1" Body="&lt;p&gt;I would add that there is also a Hadamard gate applied on a second qubit, so you will get states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, both with a probability 50 %.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix representatation of your circuit is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CNOT_1CNOT_2CNOT_1(I\otimes H)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To implement only swap gate, you should remove the Hadamard gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that I used notation &lt;span class=&quot;math-container&quot;&gt;$CNOT_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT_2$&lt;/span&gt; introduced by Purva Thakre&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-24T23:28:03.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9318" PostTypeId="2" ParentId="9310" CreationDate="2019-12-25T02:23:35.130" Score="0" Body="&lt;p&gt;IBM offers online access to their quantum computer to test quantum programs. Here is the link: &lt;a href=&quot;https://www.ibm.com/quantum-computing/technology/experience&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/quantum-computing/technology/experience&lt;/a&gt;. You can use the portal to check your programs by running them on an actual quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="9126" LastEditorUserId="9126" LastEditDate="2019-12-25T03:34:27.183" LastActivityDate="2019-12-25T03:34:27.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9319" PostTypeId="1" CreationDate="2019-12-25T02:54:59.107" Score="4" ViewCount="73" Body="&lt;p&gt;I know this does vary to some extent from implementation to implementation, but I'm looking for broad 'classes' of noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I know a very common source of noise/error is the environment - things like thermal noise, and another common source is issues with gate fidelity. Is there any sort of comprehensive list of broad classes of error like this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any reference here would be greatly appreciated if the list is too long for a single answer.&lt;/p&gt;&#xA;" OwnerUserId="91" LastActivityDate="2019-12-25T02:54:59.107" Title="What types of noise are there?" Tags="&lt;resource-request&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9320" PostTypeId="1" AcceptedAnswerId="9324" CreationDate="2019-12-25T05:10:07.270" Score="5" ViewCount="709" Body="&lt;p&gt;In Chapter 6 of &quot;Quantum Computation and Quantum Information&quot; textbook by Nielsen and Chuang, Exercise 6.5 p.255:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We have an oracle gate &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit (&lt;span class=&quot;math-container&quot;&gt;$2^n=N$&lt;/span&gt; searching items),&#xA;   and we would like to construct new oracle gate &lt;span class=&quot;math-container&quot;&gt;$O'$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; qubit (&lt;span class=&quot;math-container&quot;&gt;$2^{n+1}=2N$&lt;/span&gt; searching items) using oracle gate &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; and extra bit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; so that new oracle gate &lt;span class=&quot;math-container&quot;&gt;$O'$&lt;/span&gt; should mark an item only if it is solution for the oracle gate &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; and extra bit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The exact question in the Nielsen and Chuang textbook as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A &lt;em&gt;new augmented&lt;/em&gt; oracle &lt;span class=&quot;math-container&quot;&gt;$O'$&lt;/span&gt; is constructed which marks an item only&#xA;  if it is a solution to the search problem and the extra bit is set to zero.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Exercise 6.5: Show that the augmented oracle &lt;span class=&quot;math-container&quot;&gt;$O'$&lt;/span&gt; may be constructed using one&#xA;  application of &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;, and elementary quantum gates, using the extra qubit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;Possible not very good solutions:&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I3HNY.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I3HNY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with this solution is related to the fact that it requires to open up an Oracle gate &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; in order to &quot;control&quot; it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody have an idea of how to construct gate &lt;span class=&quot;math-container&quot;&gt;$O'$&lt;/span&gt; using &quot;pure&quot; gate &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; without &quot;open up&quot; them? &lt;/p&gt;&#xA;" OwnerUserId="9545" LastEditorUserId="26" LastEditDate="2019-12-25T06:39:43.180" LastActivityDate="2020-07-14T00:33:06.967" Title="Nielsen and Chuang, Exercise 6.5: How to simulate oracle for n+1 qubits using one oracle gate for n qubits and one extra qubit?" Tags="&lt;grovers-algorithm&gt;&lt;nielsen-and-chuang&gt;&lt;oracles&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9321" PostTypeId="2" ParentId="9320" CreationDate="2019-12-25T08:50:34.770" Score="0" Body="&lt;p&gt;I don't think it's possible. I think that was the authors idea - to apply controlled &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;&#xA;(despite the fact it's impossible to control black boxed unitaries &lt;a href=&quot;https://arxiv.org/abs/1309.7976&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1309.7976&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Craig Gidney answer suggests, we actually can control unknown black boxes if they just permute a known basis. Though we need to use an ancilla.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2019-12-25T15:59:05.783" LastActivityDate="2019-12-25T15:59:05.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9322" PostTypeId="1" AcceptedAnswerId="9323" CreationDate="2019-12-25T10:38:24.110" Score="0" ViewCount="88" Body="&lt;p&gt;While reading &quot;Quantum Computation and Quantum Information&quot; (by Nielsen and Chuang) I came across this line &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A little thought shows that if we apply &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;&lt;/strong&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle (\dfrac{\vert 0 \rangle - \vert 1 \rangle}{\sqrt{2}})$&lt;/span&gt;&#xA;  then we obtain the state &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(x)} \vert x \rangle (\dfrac{\vert 0 \rangle - \vert 1 \rangle}{\sqrt{2}})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Which was mentioned when explaining Deutsch's problem, where &lt;span class=&quot;math-container&quot;&gt;$\vert x, y \rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$\vert x, y \oplus f(x) \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering, is this statement true for all unitary operations? Or is it limited to Deutsch's problem?&lt;/p&gt;&#xA;" OwnerUserId="9325" LastEditorUserId="7528" LastEditDate="2019-12-27T07:22:51.227" LastActivityDate="2019-12-27T07:22:51.227" Title="Understanding how unitary operation changes state of system" Tags="&lt;nielsen-and-chuang&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9323" PostTypeId="2" ParentId="9322" CreationDate="2019-12-25T11:25:27.573" Score="4" Body="&lt;p&gt;It is limited to matrix &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; which maps &lt;span class=&quot;math-container&quot;&gt;$|x,y\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|x,y\oplus f(x)\rangle$&lt;/span&gt;, and the little thought is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_f|x,-\rangle=\frac{1}{\sqrt{2}}(|x,0\oplus f(x)\rangle-|x,1\oplus f(x)\rangle)=$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\begin{cases}&#xA;|x,-\rangle &amp;amp; \text{if }f(x)=0\\&#xA;-|x,-\rangle &amp;amp; \text{if }f(x)=1&#xA;\end{cases}=(-1)^{f(x)}|x,-\rangle$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}$&lt;/span&gt; or generally &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-25T11:25:27.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9324" PostTypeId="2" ParentId="9320" CreationDate="2019-12-25T12:31:24.887" Score="8" Body="&lt;p&gt;The simplest solution is to use an ancilla in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. Swap that ancilla for the oracle's output qubit, conditioned on the control qubit being false, before and after applying the oracle. Since toggling the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state has no effect, this deactivates the oracle when the control is set.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's this technique applied to &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22QFT7%22%5D%2C%5B1%2C%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%2B%3DA7%22%5D%2C%5B%22Swap%22%2C%22%E2%97%A6%22%2C%22Swap%22%5D%2C%5B1%2C1%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B%22Swap%22%2C%22%E2%97%A6%22%2C%22Swap%22%5D%2C%5B1%2C1%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22-%3DA7%22%5D%2C%5B1%2C%22QFT%E2%80%A07%22%5D%5D%2C%22init%22%3A%5B%22%2B%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;a simple comparison oracle&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22QFT7%22%5D%2C%5B1%2C%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%2B%3DA7%22%5D%2C%5B%22Swap%22%2C%22%E2%97%A6%22%2C%22Swap%22%5D%2C%5B1%2C1%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B%22Swap%22%2C%22%E2%97%A6%22%2C%22Swap%22%5D%2C%5B1%2C1%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22-%3DA7%22%5D%2C%5B1%2C%22QFT%E2%80%A07%22%5D%5D%2C%22init%22%3A%5B%22%2B%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/95Ncw.png&quot; alt=&quot;ancilla solution&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're not allowed to use an ancilla, I'm not sure how to make it work unless you have access to the square root of the oracle. The best I know how to do is to have the controlled oracle bitflip &lt;em&gt;and phaseflip&lt;/em&gt; the target. Or to bitflip the target but have a 90 degree phase kickback onto the control for satisfying inputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT7%22%5D%2C%5B%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%2B%3DA7%22%5D%2C%5B%22%E2%80%A2%22%2C%22H%22%5D%2C%5B1%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B%22%E2%80%A2%22%2C%22H%22%5D%2C%5B1%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22%E2%80%A2%22%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22H%22%5D%2C%5B%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22-%3DA7%22%5D%2C%5B%22QFT%E2%80%A07%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yZbr2.png&quot; alt=&quot;bit flip and phase flip&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22QFT7%22%5D%2C%5B1%2C%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%2B%3DA7%22%5D%2C%5B1%2C1%2C%22Z%5E%C2%BD%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22H%22%5D%2C%5B1%2C1%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22H%22%5D%2C%5B1%2C1%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C1%2C%22Z%5E-%C2%BD%22%5D%2C%5B1%2C1%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%5EA%3CB%22%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B%22%5EA%3CB%22%2C%22%E2%80%A2%22%2C1%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B%22Z%5E%C2%BD%22%5D%2C%5B%22%5EA%3CB%22%2C%22%E2%80%A2%22%2C1%2C%22inputA3%22%2C1%2C1%2C%22inputB2%22%5D%2C%5B1%2C%22inputA7%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22-%3DA7%22%5D%2C%5B1%2C%22QFT%E2%80%A07%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DnHGl.png&quot; alt=&quot;bit flip and kickback&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Summary Update - simple solution with ancilla&lt;/strong&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ipUx3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ipUx3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="9545" LastEditDate="2020-01-02T10:08:41.240" LastActivityDate="2020-01-02T10:08:41.240" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9325" PostTypeId="2" ParentId="9320" CreationDate="2019-12-25T13:41:45.303" Score="0" Body="&lt;p&gt;After some ideas of @Craig Gidney probably i found the following simple solution:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IFi6p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IFi6p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9545" LastActivityDate="2019-12-25T13:41:45.303" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9326" PostTypeId="1" AcceptedAnswerId="9330" CreationDate="2019-12-25T16:24:18.423" Score="5" ViewCount="171" Body="&lt;p&gt;It is well known that a quantum computer is reversible. This means that it is possible to derive an input quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; from an output &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; of an algorithm described by a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; simply by applying transpose conjugate to &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, i.e. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi_0\rangle = U^\dagger|\psi_1\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In article &lt;a href=&quot;https://arxiv.org/abs/1712.10057&quot; rel=&quot;nofollow noreferrer&quot;&gt;Arrow of Time and its Reversal on IBM Quantum Computer&lt;/a&gt; an algorithm for a time reversal and going back to an input data &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; is proposed. Steps of the algorithm are following:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply a forward time unitary evolution &lt;span class=&quot;math-container&quot;&gt;$U_\mathrm{nbit}|\psi_0\rangle = |\psi_1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply an operator &lt;span class=&quot;math-container&quot;&gt;$U_\psi$&lt;/span&gt; to change &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi_1^*\rangle$&lt;/span&gt;, where the new state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1^*\rangle$&lt;/span&gt; is complex conjugate to &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply an operator &lt;span class=&quot;math-container&quot;&gt;$U_R$&lt;/span&gt; to get &quot;time-reversed&quot; state &lt;span class=&quot;math-container&quot;&gt;$|R\psi_1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Finally, apply again &lt;span class=&quot;math-container&quot;&gt;$U_\mathrm{nbit}$&lt;/span&gt; to obtain the input state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;According to the paper, the algorithm described above simulates reversal of the time arrow. Or in other words, it simulates a random quantum fluctuation causing a time reversal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, when the algorithm is run on a quantum computer, it returns back to initial state but without application of an inverse to each algorithm step. The algorithm simply goes forward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why it is not possible to say that an application of &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; on output of algorithm &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is reversal of time arrow in general case?&lt;/li&gt;&#xA;&lt;li&gt;It is true that above described algorithm returns a quantum computer to an initial state but it seems that the algorithm simply goes forward. So where I can see the a reversal of time arrow?&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The authors of the articles have found out that when a number of qubit involved in the time reversal algorithm is increasing, the effect of time reversal diminishes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How is it possible to reverse time for few qubits and concurently to preserve flowing of time in forward direction for another qubits?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does this mean that time flows differently for different qubits?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;When do the qubits return to commnon time frame to be possible to use them in another calculation?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2019-12-25T19:13:14.897" LastActivityDate="2019-12-30T20:44:06.077" Title="Reversal of time arrow on IBM Q" Tags="&lt;ibm-q-experience&gt;&lt;experiment&gt;&lt;research&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9327" PostTypeId="5" CreationDate="2019-12-25T16:28:21.877" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2019-12-25T16:28:21.877" LastActivityDate="2019-12-25T16:28:21.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9328" PostTypeId="4" CreationDate="2019-12-25T16:28:21.877" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2019-12-25T16:28:21.877" LastActivityDate="2019-12-25T16:28:21.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9329" PostTypeId="1" AcceptedAnswerId="9332" CreationDate="2019-12-25T18:08:09.917" Score="3" ViewCount="461" Body="&lt;p&gt;It is well known that in Bayesian learning, applying Bayes' theorem requires knowledge on how the data is distributed, and this usually requires either expensive integrals or some sampling mechanism, and, using Bayesian machine learning, (instead of Frequentist) has a significant computation cost that is required to perform the Bayesian inferences, and it could be solved with quantum computers, do you think there is a speedup using Bayesian machine learning algorithms in NISQ machines like IBM Q?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are &lt;a href=&quot;https://medium.com/xanaduai/training-quantum-neural-networks-with-pennylane-pytorch-and-tensorflow-c669108118cc&quot; rel=&quot;nofollow noreferrer&quot;&gt;libraries available&lt;/a&gt; for QML using Qiskit and PennyLane with TensorFlow.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, Pycm4, Zhusuan, and Edward 2.0 will have TensorFlow backend&#xA;So, I am actually interested in &quot;Quantum Bayesian machine learning&quot;&#xA;I am about to start a master program in CS.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it a good idea to work/research in Bayesian QML using TensorFlow with Qiskit, PennyLane, and PyMC4 in order to run bayesian machine learning algorithms in IBM Q?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it have any useful approach to data science?&lt;/p&gt;&#xA;" OwnerUserId="9226" LastEditorUserId="9226" LastEditDate="2019-12-26T17:58:22.257" LastActivityDate="2019-12-26T19:04:24.053" Title="Quantum speedup in Bayesian machine learning on NISQ computers" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;machine-learning&gt;&lt;bayesian-learning&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9330" PostTypeId="2" ParentId="9326" CreationDate="2019-12-25T19:10:23.707" Score="2" Body="&lt;p&gt;Of course if we have unitary evolution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_1\rangle = U|\psi_0\rangle$$&lt;/span&gt;&#xA;then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_0\rangle = U^\dagger|\psi_1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not read the paper, but evidently the authors do something different, based on the following: the Schrödinger equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$i\hbar\frac{\partial\Psi}{\partial t}=\hat{H}\Psi$$&lt;/span&gt;&#xA;changes its form if we substitute &lt;span class=&quot;math-container&quot;&gt;$t\rightarrow -t$&lt;/span&gt; to complex conjugate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-i\hbar\frac{\partial\Psi}{\partial t}=\hat{H}\Psi$$&lt;/span&gt;&#xA;and its solution is also complex conjugate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So time reversal is antiunitary operator &lt;span class=&quot;math-container&quot;&gt;$U_RK$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U_R$&lt;/span&gt; is unitary and &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is complex conjugation.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2019-12-25T19:10:23.707" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9331" PostTypeId="1" CreationDate="2019-12-26T04:28:08.987" Score="0" ViewCount="99" Body="&lt;p&gt;Can I create a function in qiskit which receive a quantum register as an argument, and/or returns a quantum register?&#xA;In the example below, I created a quantum register, and a quantum circuit which works on it in the main function. I deliver this register to a function called &quot;test&quot; which chooses a random state for this register, but when I perform a measurement in the main function, it seems like the original state was not effected by the operation of the function since the measurement gives:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;counts:&#xA;{'000': 1024}&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can any one explain this? Is there a correct way to do so? &#xA;Thanks&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;#######################################################################&#xA;def test(n, QP, CP):&#xA;&#xA;    QC_B = QuantumCircuit(QP, CP)&#xA;&#xA;    # choose a random state&#xA;    for i in range(n):&#xA;        if (np.random.randint(2) == 1):&#xA;            QC_B.x(QP[i])&#xA;        else:&#xA;            QC_B.iden(QP[i])&#xA;    QC_B.barrier()&#xA;&#xA;    simulator = Aer.get_backend('qasm_simulator')&#xA;    result = execute(QC_B, simulator)&#xA;&#xA;    return QP&#xA;&#xA;&#xA;#######################################################################&#xA;def main():&#xA;&#xA;    N = 3&#xA;    Q = QuantumRegister(N)&#xA;    C = ClassicalRegister(N)&#xA;    QC_A = QuantumCircuit(Q, C)&#xA;&#xA;    # ... &#xA;    # ... QC_A perform some operations on Q...&#xA;    # ... &#xA;&#xA;    QC_A.iden(Q)&#xA;    Q = test(N, Q, C)&#xA;&#xA;    QC_A.measure(Q, C)&#xA;&#xA;    simulator = Aer.get_backend('qasm_simulator')&#xA;    # Execute and get counts&#xA;    result = execute(QC_A, simulator).result()&#xA;    counts = result.get_counts(QC_A)&#xA;    print(&quot;counts: &quot;)&#xA;    print(counts)&#xA;    return&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8031" LastEditorUserId="8031" LastEditDate="2019-12-26T08:51:00.150" LastActivityDate="2019-12-26T08:51:00.150" Title="deliver a quantum register to/from a function in qiskit" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9332" PostTypeId="2" ParentId="9329" CreationDate="2019-12-26T09:57:56.403" Score="5" Body="&lt;p&gt;As far as I know, there are four possibilities for having a quantum advantage in Bayesian machine learning: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gaussian processes&lt;/strong&gt;: there is a known quantum speed-up for Gaussian processes that you can easily test on IBM Q [1,2]. The idea is to use HHL (quantum algorithm for matrix inversion) in order to compute the inverse of the kernel matrix, which is used to estimate the mean and variance estimators of your Gaussian process. It provides a exponential speed-up in the best case (sparse kernel matrix), and polynomial (quadratic) in the worst. The experiments in [2] show limited advantage for NISQ, but it is worth considering when we will have bigger devices.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;MAP inference&lt;/strong&gt; for mixture models of distributions in the exponential family: there is another speed-up for the Expectation-Maximization (EM) algorithm used for MAP inference (maximum likelihood with a prior) [6]. More precisely, the quantum algorithm is exponentially faster in the number of training point than classical EM. The caveat is that it requires to encode the data in a QRAM, which is not really NISQy (requires a lot of qubits and a fast algorithm to perform this encoding) &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Energy-based model&lt;/strong&gt;: there is also a lot of work on quantum energy-based model [3-5], which you could argue are Bayesian in spirit. The general idea of energy-based models is to find the parameters &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; of the probability distribution &lt;span class=&quot;math-container&quot;&gt;$$p(x |\theta)=\frac{1}{Z_{\theta}}e^{-\beta E(x, \theta)}$$&lt;/span&gt;&#xA;that fits your data the best. In classical energy-based model, &lt;span class=&quot;math-container&quot;&gt;$E(x, \theta)$&lt;/span&gt; is a number, usually given by the classical Ising model &lt;span class=&quot;math-container&quot;&gt;$$E(x, \theta)=\sum_{ij} \theta_{ij} x_i x_j$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_{\theta}$&lt;/span&gt; is a normalization factor that is in general very hard to compute. In the quantum case, we replace the probability distribution by a density matrix &lt;span class=&quot;math-container&quot;&gt;$$\rho(\theta)=\frac{1}{Z_{\theta}} e^{-\beta H(\theta)}$$&lt;/span&gt; and the energy function by a Hermitian matrix: &lt;span class=&quot;math-container&quot;&gt;$$H(\theta)=\sum_{ij} \theta_{ij} \hat{\sigma}^z_i \hat{\sigma}^z_j + \sum_i \hat{\sigma}^x_i,$$&lt;/span&gt; taking advantage of both thermal and quantum fluctuations in the generative process. &#xA;[3] introduced the idea and showed examples of speed-ups on toy models, while [4] and [5] are example on how you can train such a generative model on NISQ devices.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bayesian inference&lt;/strong&gt;: the previous examples are not exactly quantum Bayesian inference as you probably imagined it in your question (computing the explicit posterior distribution by approximating the partition function---i.e. the expansive integral---on a quantum computer). The thing is that for energy-based model, computing the partition function exactly is &lt;em&gt;#P-Hard&lt;/em&gt; in general and &lt;em&gt;NP-Hard&lt;/em&gt; for local Hamiltonians (a simpler class of energy-based models), so non-tractable even for a quantum computer. However, a quantum speed-up is possible for additive approximations of the partition function, as explained in &lt;a href=&quot;http://fernandobrandao.org/madridfernandobrandao.pdf?LMCL=PVhv3b&quot; rel=&quot;nofollow noreferrer&quot;&gt;those slides&lt;/a&gt;. But I don't know any paper that explicitly does that in the context of Bayesian machine learning.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;I am about to start a master program in CS Is it a good idea to work/research in Bayesian QML using TensorFlow with Qiskit, PennyLane, and PyMC4 in order to run Bayesian machine learning algorithms in IBM Q?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I think so. Reproducing [2] or [4] using Pennylane (with a Qiskit backend) can be a very good exercise to learn quantum computing. If you want to do research on the subject, it would be better to do your master's thesis in a group with people who work in that area (look at the authors of the papers I've cited). Doing it alone (or with a pure-CS Professor) would be very challenging.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Zhao et al., &lt;a href=&quot;https://arxiv.org/abs/1803.10520&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithms for training Gaussian Processes&lt;/a&gt;, Phys. Rev. A, 2018&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Zhao et al., &lt;a href=&quot;https://arxiv.org/abs/1806.11463&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bayesian Deep Learning on a Quantum Computer&lt;/a&gt;, Quantum Machine Intelligence, 2018&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] Amin et al., &lt;a href=&quot;https://arxiv.org/abs/1601.02036&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Boltzmann Machines&lt;/a&gt;, Phys. Rev. X, 2016&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[4] Verdon et al., &lt;a href=&quot;https://arxiv.org/abs/1712.05304&quot; rel=&quot;nofollow noreferrer&quot;&gt;A quantum algorithm to train neural networks using low-depth circuits&lt;/a&gt;, arXiv, 2017&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[5] Verdon et al., &lt;a href=&quot;https://arxiv.org/abs/1910.02071&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Hamiltonian-Based Models &amp;amp;&#xA;the Variational Quantum Thermalizer Algorithm&lt;/a&gt;, arXiv, 2019&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[6] Kerenidis et al., &lt;a href=&quot;https://arxiv.org/abs/1908.06657&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Expectation-Maximization for Gaussian Mixture Models&lt;/a&gt;, arXiv, 2019&lt;/p&gt;&#xA;" OwnerUserId="8545" LastEditorUserId="45" LastEditDate="2019-12-26T19:04:24.053" LastActivityDate="2019-12-26T19:04:24.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9334" PostTypeId="1" AcceptedAnswerId="9336" CreationDate="2019-12-27T00:59:03.387" Score="3" ViewCount="79" Body="&lt;p&gt;On some backends, measuring the same expected value twice to the same classical register always leaves that classical register in the &quot;1&quot; state. I don't know if these results will hold over time, but when I ran the following code the outcome was striking.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[2];&#xA;creg c[1];&#xA;&#xA;measure q[1] -&amp;gt; c[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This program should always produce &quot;0&quot; in a simulator and generally produce &quot;0&quot; in a real device. Instead, the results are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Always/Mostly &quot;0&quot;&lt;/strong&gt;  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ibmq_qasm_simulator &lt;/li&gt;&#xA;&lt;li&gt;ibmq_essex&lt;/li&gt;&#xA;&lt;li&gt;ibmq_burlington&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Always &quot;1&quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;ibmqx2  &lt;/li&gt;&#xA;&lt;li&gt;ibmq_16_melbourne   &lt;/li&gt;&#xA;&lt;li&gt;ibmq_ourense  &lt;/li&gt;&#xA;&lt;li&gt;ibmq_vigo&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;As a programmer, I think writes should be independent and the last write should win unless I explicitly allow some kind of quantum fuzziness.&lt;/p&gt;&#xA;" OwnerUserId="9583" LastEditorUserId="9583" LastEditDate="2019-12-27T05:03:46.840" LastActivityDate="2019-12-27T15:41:37.010" Title="Writing twice to same classical register -&gt; 1 for some backends in IBM Q Experience" Tags="&lt;ibm-q-experience&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9335" PostTypeId="1" CreationDate="2019-12-27T05:17:26.323" Score="6" ViewCount="631" Body="&lt;p&gt;I am introduced to ancilla qubits which are usually initialized to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;. It seems that an ancilla qubit is equivalent to the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; bit in classical computing as it will evaluate to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; 100% of the time. My question is that can I conclude &lt;strong&gt;any&lt;/strong&gt; qubit will &lt;strong&gt;always&lt;/strong&gt; be in superposition regardless of the probabilities of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle + 0\vert 1 \rangle = \vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0\vert 0 \rangle + \vert 1 \rangle = \vert 1 \rangle$&lt;/span&gt;? How about physically, are qubits prepared according to some procedure that differ if it will be initialized to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; or in superposition?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9271/7528&quot;&gt;this&lt;/a&gt; is a related comment but it doesn't answer my question regarding if the process of physically preparing qubits different from non-entangled qubits vs entangled ones.&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="7528" LastEditDate="2019-12-27T18:53:33.823" LastActivityDate="2020-01-09T00:24:36.337" Title="Is a qubit always in superposition?" Tags="&lt;quantum-state&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9336" PostTypeId="2" ParentId="9334" CreationDate="2019-12-27T06:50:54.067" Score="3" Body="&lt;p&gt;Your expectation here is correct. &lt;code&gt;c[0]&lt;/code&gt; should be 0 (well, modulo some small readout errors). The difference between backends is just due to a software bug on some of them. This will get fixed, thanks for reporting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, it is important to note that on current IBM devices, there is a constraint that all measurements are done simultaneously. So both qubits are measured and the state of &lt;code&gt;q[0]&lt;/code&gt; and &lt;code&gt;q[1]&lt;/code&gt; are determined independently and simultaneously. Then the first value will get written to &lt;code&gt;c[0]&lt;/code&gt; followed by the second value. So the final result you see should be the state of &lt;code&gt;q[0]&lt;/code&gt; in your program. (I just wanted to clarify that the &lt;em&gt;readouts&lt;/em&gt; are not serialized here, but the classical write operations are). &lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="2503" LastEditDate="2019-12-27T15:41:37.010" LastActivityDate="2019-12-27T15:41:37.010" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9337" PostTypeId="1" AcceptedAnswerId="9452" CreationDate="2019-12-27T09:25:11.560" Score="2" ViewCount="100" Body="&lt;p&gt;I am trying to understand how to achieve the &lt;em&gt;syndrome extraction operator&lt;/em&gt; matrix in quantum repetition code (if it even exists). It is given that the syndrome is defined &lt;a href=&quot;https://www2.physics.ox.ac.uk/sites/default/files/ErrorCorrectionSteane06.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here (page 4)&lt;/a&gt; as: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;[perform] controlled-nots from the first and second received qubits to&#xA;  the first ancilla qubit, then from the first and third received qubits&#xA;  to the second ancilla bit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;First of all, are the ancilla qubits entangled with &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I have understood so far. Given &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle = \alpha \vert x_1, x_2, x_3\rangle + \beta \vert \overline{x_1}, \overline{x_2}, \overline{x_3}\rangle$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\overline{x_{i}} = x_i + 1 \quad (\text{mod }2)$&lt;/span&gt;), we can define an operator &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S: \alpha \vert x_1, x_2, x_3\rangle + \beta \vert \overline{x_1}, \overline{x_2}, \overline{x_3}\rangle \rightarrow \underbrace{\vert x_1 \oplus x_2\rangle}_{\text{1$^{\text{st}}$ ancilla qubit}} \underbrace{\vert x_1 \oplus x_3\rangle}_{\, \text{ 2$^{\text{nd}}$ ancilla qubit}},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or equivalently as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S: \alpha \vert x_1, x_2, x_3\rangle + \beta \vert \overline{x_1}, \overline{x_2}, \overline{x_3}\rangle \rightarrow \underbrace{\vert \overline{x_1} \oplus \overline{x_2}\rangle}_{\text{1$^{\text{st}}$ ancilla qubit}} \underbrace{\vert \overline{x_1} \oplus \overline{x_3}\rangle}_{\, \text{ 2$^{\text{nd}}$ ancilla qubit}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will yield the ancilla values corresponding to the following states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;		\text{State$\qquad~~$}  &amp;amp; \text{$~~~~$Ancilla qubits}\\&#xA;		\alpha \vert 000\rangle + \beta \vert 111\rangle &amp;amp;\qquad\qquad \vert 00\rangle\\&#xA;		\alpha \vert 100\rangle + \beta \vert 011\rangle &amp;amp;\qquad\qquad \vert 11\rangle\\&#xA;		\alpha \vert 010\rangle + \beta \vert 101\rangle &amp;amp;\qquad\qquad \vert 10\rangle\\&#xA;		\alpha \vert 001\rangle + \beta \vert 110\rangle &amp;amp;\qquad\qquad \vert 01\rangle\\&#xA;		\alpha \vert 110\rangle + \beta \vert 001\rangle &amp;amp;\qquad\qquad \vert 01\rangle\\&#xA;		\alpha \vert 101\rangle + \beta \vert 010\rangle &amp;amp;\qquad\qquad \vert 10\rangle\\&#xA;		\alpha \vert 011\rangle + \beta \vert 100\rangle &amp;amp;\qquad\qquad \vert 11\rangle\\&#xA;		\alpha \vert 111\rangle + \beta \vert 000\rangle &amp;amp;\qquad\qquad \vert 00\rangle\\\\&#xA;	\end{align*}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I perform such operation using a matrix?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="55" LastEditDate="2020-11-11T21:37:39.033" LastActivityDate="2020-11-11T21:37:39.033" Title="Syndrome extraction operator as matrix?" Tags="&lt;error-correction&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9338" PostTypeId="2" ParentId="9335" CreationDate="2019-12-27T09:52:26.440" Score="7" Body="&lt;p&gt;Superposition is a basis dependent concept.  Namely the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states are commonly said &lt;strong&gt;not&lt;/strong&gt; to be superposition states exactly because one of the two coefficients in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt; basis expansion is zero.  However, using the x-basis representation, &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt; one finds &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = (|+\rangle + |-\rangle)/\sqrt(2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = (|+\rangle - |-\rangle)/\sqrt(2)$&lt;/span&gt;, which are superposition states with both coefficients non-zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qubits naturally prepare themselves in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state if one waits long enough (much longer than the T1 time) as it is the ground state of the system.  To get any other state one must apply gates to the qubit that rotate the state to the desired position on the Bloch sphere.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-12-27T09:52:26.440" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9339" PostTypeId="1" CreationDate="2019-12-27T14:35:39.600" Score="5" ViewCount="344" Body="&lt;p&gt;Even though this seems to be a much asked basic question, I couldn't find a reputed answer to this:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Implement a 3-qubit Toffoli gate using 3-qubit Fredkin gates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The best I could do was using 4 gates to give&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bo1ZW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bo1ZW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can we use less than 4 gates?&lt;/li&gt;&#xA;&lt;li&gt;In the above circuit how to get rid of the garbage values?(I have heard they are bad for interference)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I am new to quantum computing so please correct me if I am asking something that doesn't make sense.&lt;/p&gt;&#xA;" OwnerUserId="9603" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-01-09T00:27:10.977" Title="Can a Toffoli gate be implemented using Fredkin gates?" Tags="&lt;circuit-construction&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9340" PostTypeId="1" CreationDate="2019-12-27T16:30:54.167" Score="6" ViewCount="149" Body="&lt;p&gt;I have heard about the diamond norm, and from what I understood it is a &quot;nice&quot; tool to quantify quality of quantum gates in the NISQ era. I would like to know a little more before going in detail in the litterature.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question are the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is it considered as a good tool to quantify quality of quantum gates? Why this tool and not another one?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What are the nice properties this tool has? I have seen in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7043/is-the-diamond-norm-subadditive-under-composition&quot;&gt;Is the diamond norm subadditive under composition?&lt;/a&gt; that it is subbaditive which make the tool useful to  bound the diamond norm of a full algorithm given the diamond norm of each gate. Are there other some useful properties? I guess this question will be related somehow to the previous one. I tried to find this information in literature, but unfortunately all papers I read just give the definition and the diamond norm and a way to compute it numerically.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="8776" LastEditDate="2019-12-29T16:43:54.747" LastActivityDate="2019-12-29T16:43:54.747" Title="What are the &quot;nice&quot; properties of the diamond norm and why is it used?" Tags="&lt;fidelity&gt;&lt;nisq&gt;&lt;diamond-norm&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9341" PostTypeId="2" ParentId="9339" CreationDate="2019-12-27T17:50:09.153" Score="7" Body="&lt;p&gt;It's not possible to implement a Toffoli using only Fredkin gates, because Fredkin gates preserve the number of 1s in the state while Toffolis do not.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2019-12-27T17:50:09.153" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9342" PostTypeId="1" AcceptedAnswerId="9343" CreationDate="2019-12-27T20:40:12.410" Score="3" ViewCount="1179" Body="&lt;p&gt;Inspired by a question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9339/toffoli-using-fredkin&quot;&gt;Toffoli using Fredkin&lt;/a&gt;, I tried to do &quot;inverse&quot; task, i.e. to implement Fredkin gate (or controlled swap). In the end I implemented it with three Toffoli gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, I started with swap gate without control qubit which is implemented with CNOTs followingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8Bl6F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Bl6F.png&quot; alt=&quot;Swap gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I realized that I need control qubit, or in other words that I have to control each CNOT gate. As controlled CNOT is Toffoli gate (CCNOT gate), I came to this circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dJDq8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dJDq8.png&quot; alt=&quot;Fredking gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As matrix representation of Toffoli gate controlled by qubits &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CCNOT_{01} =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;matrix of Toffoli gate controlled by qubits &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q_2\rangle$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CCNOT_{02} =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and finnaly, matrix of Fredking gate is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;F =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$F=CCNOT_{01} CCNOT_{02} CCNOT_{01}$&lt;/span&gt;, the circuit is designed corectly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunatelly, implementation of Toffoli gate requires many CNOT gates and single qubit rotation gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question: Is this implementation of Fredkin gate the most efficient one?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-01-09T00:39:10.037" LastActivityDate="2020-01-09T00:39:10.037" Title="How to implement a Fredkin gate using Toffoli and CNOTs?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9343" PostTypeId="2" ParentId="9342" CreationDate="2019-12-27T21:38:11.557" Score="3" Body="&lt;p&gt;Based on paper &lt;a href=&quot;https://pdfs.semanticscholar.org/4774/7792a7b13028e47c9daa2259f77d264a27a8.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Five Two-Bit Quantum Gates are Sucient to Implement the&#xA;Quantum Fredkin Gate&lt;/a&gt; provided by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/491/norbert-schuch&quot;&gt;Norbert Schuch&lt;/a&gt;, I realized that there is a more efficient implementation in terms of number of gates. Here is a result:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5K6yT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5K6yT.png&quot; alt=&quot;Fredkin Gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix of CNOT acting on &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; controlled by &lt;span class=&quot;math-container&quot;&gt;$|q_2\rangle$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CNOT_{2}=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be verified that &lt;span class=&quot;math-container&quot;&gt;$(I \otimes CNOT_2)CCNOT(I \otimes CNOT_2)$&lt;/span&gt; is matrix describing Fredkin gate.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-27T21:38:11.557" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9344" PostTypeId="1" AcceptedAnswerId="9349" CreationDate="2019-12-28T05:38:53.850" Score="7" ViewCount="1060" Body="&lt;p&gt;When I run this program on &lt;strong&gt;ibmqx2&lt;/strong&gt; (the backend matters) in IBM Q Experience, the results are interesting. Essentially, the program measures the error rate on &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; after fiddling with &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;gate nG0 ( param ) q  {&#xA;  h q;&#xA;}&#xA;&#xA;qreg q[2];&#xA;creg c[1];&#xA;&#xA;ry(pi) q[1];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Unexpectedly, the value of &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; depends on the angle of rotation around y-axis for &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt;. Here are typical runs of 8 192 shots on ibmqx2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Lf4vE.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lf4vE.png&quot; alt=&quot;Error rate of q[0] vs ry() rotation of q[1]&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;ry() q[1]   Error rate q[0]     Expected error rate q[0]&#xA;0            0.940%             ~1%&#xA;pi/4         9.351%             ~1%&#xA;pi/2        30.273%             ~1%     &#xA;3pi/4       52.209%             ~1%&#xA;pi          60.742%             ~1%     &#xA;5pi/4       51.941%             ~1%&#xA;3pi/2       30.518%             ~1%&#xA;7pi/4        9.509%             ~1%&#xA;2pi          0.684%             ~1%&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;A few notes:  &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; operations are optimized away in the transpiled code.&lt;/li&gt;&#xA;&lt;li&gt;Don't forget that we're operating on &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; and measuring &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt;. These qubits should be completely independent. Changes to &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; shouldn't impact &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The error rate is above 50% from &lt;span class=&quot;math-container&quot;&gt;$\frac{3}{4}\pi$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{4}\pi$&lt;/span&gt;. That suggests that application of &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; does not just destabilize the system, it causes that &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; favors the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;li&gt;Changing &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt; also demonstrates the problem. Changing &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; makes the problem to go away.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9583" LastEditorUserId="9006" LastEditDate="2019-12-28T17:42:53.420" LastActivityDate="2019-12-28T17:42:53.420" Title="Changing one qubit causes changes in another independent qubit on ibmqx2 in IBM Q Experience" Tags="&lt;ibm-q-experience&gt;&lt;experiment&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9345" PostTypeId="2" ParentId="9150" CreationDate="2019-12-28T07:27:50.163" Score="1" Body="&lt;p&gt;Considering your question is not specific, you can take a look at Chapters 10 (classical entropy) and 11 (quantum entropy) of &lt;a href=&quot;https://arxiv.org/abs/1106.1445&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum entanglement entropy as we know it comes from classical Shannon theory. Claude Shannon introduced entropy in order to quantify information. You can read his paper &lt;a href=&quot;http://people.math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2598" LastEditorUserId="2598" LastEditDate="2019-12-31T06:12:21.443" LastActivityDate="2019-12-31T06:12:21.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9346" PostTypeId="2" ParentId="9252" CreationDate="2019-12-28T07:41:21.560" Score="2" Body="&lt;p&gt;&lt;strong&gt;Intraphoton entanglement&lt;/strong&gt; uses the degrees of freedom from one photon only to create entanglement. So, here either &lt;a href=&quot;https://www.ncbi.nlm.nih.gov/pubmed/10990969&quot; rel=&quot;nofollow noreferrer&quot;&gt;polarization and linear momentum&lt;/a&gt; or &lt;a href=&quot;https://www.nature.com/articles/nphys919&quot; rel=&quot;nofollow noreferrer&quot;&gt;polarization and angular momentum&lt;/a&gt; can be used to create entanglement. &lt;strong&gt;Interphoton entanglement&lt;/strong&gt; is the entanglement created between 2 spatially separated photons. So, naturally latter is less stable than former. For this reason, &lt;a href=&quot;https://arxiv.org/abs/0909.0425&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; used former as a resource to create latter. &lt;/p&gt;&#xA;" OwnerUserId="2598" LastEditorUserId="2598" LastEditDate="2019-12-28T21:05:58.723" LastActivityDate="2019-12-28T21:05:58.723" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9347" PostTypeId="2" ParentId="9057" CreationDate="2019-12-28T07:55:20.277" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;nofollow noreferrer&quot;&gt;In this paper&lt;/a&gt;, the authors used Knot theory to define what they call 'Path Model Representation'. In a later section they convert this representation to qubits by switching to binary. &lt;/p&gt;&#xA;" OwnerUserId="2598" LastActivityDate="2019-12-28T07:55:20.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9348" PostTypeId="2" ParentId="9344" CreationDate="2019-12-28T13:27:46.297" Score="6" Body="&lt;p&gt;This was a readout crosstalk error that has now been resolved. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2019-12-28T13:27:46.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9349" PostTypeId="2" ParentId="9344" CreationDate="2019-12-28T13:30:21.213" Score="12" Body="&lt;p&gt;Thanks for pointing this out! It turns out that this device was mis-calibrated in a way that was leading to that behavior. We just fixed the calibrations, so the problem should be gone now. I apologize for the trouble, and we will try to update our routine calibrations to detect and prevent this problem from coming up in the future :-).&lt;/p&gt;&#xA;" OwnerUserId="535" LastActivityDate="2019-12-28T13:30:21.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9350" PostTypeId="2" ParentId="6102" CreationDate="2019-12-28T18:52:30.837" Score="3" Body="&lt;p&gt;You will need to know how long it takes for each gate of the circuit to be performed. Then the decoherence error rate is simply &lt;span class=&quot;math-container&quot;&gt;$$e^{t_{gate}/t_{decoherence}}$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="9626" LastActivityDate="2019-12-28T18:52:30.837" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9351" PostTypeId="1" AcceptedAnswerId="9354" CreationDate="2019-12-29T03:39:25.403" Score="3" ViewCount="99" Body="&lt;p&gt;I noticed that stabilizer codes and additive quantum codes are equivalent, but why?&#xA;I am confused at the word &quot;additive&quot; since the operation of stabilizer genertors is multiplication.&lt;/p&gt;&#xA;" OwnerUserId="9275" LastActivityDate="2019-12-29T14:17:42.087" Title="Why stabilizer codes are named additive quantum codes?" Tags="&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9352" PostTypeId="1" AcceptedAnswerId="9416" CreationDate="2019-12-29T11:23:24.360" Score="5" ViewCount="137" Body="&lt;p&gt;I'm trying to study the book: Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning, and would like some help with Exercise 4.12:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1D3mE.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1D3mE.png&quot; alt=&quot;Loop Equation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The relevant equations are as follows:&lt;a href=&quot;https://i.stack.imgur.com/w5BrE.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w5BrE.png&quot; alt=&quot;Yanking 4.6&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kCSKs.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kCSKs.png&quot; alt=&quot;Yanking 4.8&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/DEYJd.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DEYJd.png&quot; alt=&quot;Yanking 4.9&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an aside, I would really appreciate it if anyone knows where to find the solutions of this book. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="2832" LastEditDate="2019-12-29T11:53:21.537" LastActivityDate="2020-01-04T14:35:10.870" Title="Diagrammatic Quantum Reasoning: Proving the loop equation using yanking equations" Tags="&lt;mathematics&gt;&lt;zx-calculus&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9353" PostTypeId="2" ParentId="9352" CreationDate="2019-12-29T12:41:05.990" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;Replace in the diagram in exercise 4.12 the triangles with the corresponding bending wires. &lt;/li&gt;&#xA;&lt;li&gt;It seems that the resulting diagram is like the second identity in 4.9, but with two added straight horizontal wires. (The diagram is rotated, but that doesn't matter.) Apply this identity.&lt;/li&gt;&#xA;&lt;li&gt;The resulting diagram is a cap with added straight wires. It is permitted to straighten the wire.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Another way using yanking out crossings:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start from the given diagram. Rotate the bottom bending with the cup in 3D around the vertical axis , until it the diagrams looks like the last diagram in 4.6. That is equal to a straight wire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope the rewrite process I described is clear.&lt;/p&gt;&#xA;" OwnerUserId="8776" LastEditorUserId="8776" LastEditDate="2019-12-31T15:20:59.740" LastActivityDate="2019-12-31T15:20:59.740" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9354" PostTypeId="2" ParentId="9351" CreationDate="2019-12-29T13:54:26.167" Score="3" Body="&lt;p&gt;A stabilizer code is also called an additive code, because it is closed under the sum of its elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The namesake is described on page 33 of &quot;Stabilizer Codes and Quantum Error Correction&quot; (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9705052.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, additive quantum codes are the quantum version of additive codes found in coding theory.&lt;/p&gt;&#xA;" OwnerUserId="8776" LastEditorUserId="8776" LastEditDate="2019-12-29T14:17:42.087" LastActivityDate="2019-12-29T14:17:42.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9355" PostTypeId="2" ParentId="7" CreationDate="2019-12-29T16:36:17.213" Score="2" Body="&lt;p&gt;I think that there are many interesting answers to your question, but I would like to point out what I personally find the most mesmerizing consequence of quantum theory to cryptography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the most fascinating quantum phenomena that has no classical counterpart is &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no cloning&lt;/a&gt;. This essentially means that if you don't have enough information about some quantum state, then you can't prepare more copies of it.&#xA;This could be seen (informally) as a restatement of the uncertainty principle: if you could prepare two perfect copies of a system you know nothing about, then nothing prevents you from measuring each copy in a different basis, thereby obtaining knowledge of two mutually unbiased properties (e.g., if you could perfectly copy an electron, then you could measure its momentum in one copy and its position in the other).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No cloning is usually a huge pain. For example, consider e.g. the &lt;a href=&quot;https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test&quot; rel=&quot;nofollow noreferrer&quot;&gt;Miller-Rabin algorithm for primality testing&lt;/a&gt;. This is a randomized algorithm, which means that every time you run it it plays out a little differently. Given a prime number, this algorithm will always tell you that it is a prime. Given a composite number, it will still tell you some of the times that it is prime. However, one can prove that his happens with probability which is less than &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;. This implies that if you run the algorithm &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times on a composite number the probability that it will tell you that it is prime each and every time is at most &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;. This process is called &lt;em&gt;amplification&lt;/em&gt;, and the underlying assumption is that we can always repeat the algorithm. While trivial classically, this assumption does not generally hold in the quantum realm, as the input state might be measured and thus irreversibly destroyed. &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;nofollow noreferrer&quot;&gt;It was shown by Marriot and Watrous&lt;/a&gt; that BQP algorithms can still be amplified this way, but the way to do so is highly non-trivial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you might have expected, now comes the &quot;lemons to lemonade&quot; stage. Because if cloning states is impossible, might we leverage that to our advantage, say, in order to design things that we don't want people to make copies of, such as money?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amazingly, this idea predates most of quantum computation and information. As early as 1968, Steve Wiesner proposed applying no-cloning to implement money that is physically impossible to forge. More amazingly, his construction is extremely simple and only requires the ability to apply local Hadamard gates (and consequentially, the money is encoded into a completely separable state). Unfortunately, as the story goes, it seems that Wiesner was not able to publish his breakthrough for more than a decade.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The applications of no-cloning has since been extended greatly, and there is ongoing research of very natural further problems such as &lt;a href=&quot;https://arxiv.org/abs/1203.4740&quot; rel=&quot;nofollow noreferrer&quot;&gt;public quantum money&lt;/a&gt; (in Wiesner's scheme, only who created the money can verify it. This merits the question: is it able to make money that anyone can verify but no one could forge) (&lt;a href=&quot;https://arxiv.org/abs/1004.5127&quot; rel=&quot;nofollow noreferrer&quot;&gt;see also&lt;/a&gt;), &lt;a href=&quot;https://arxiv.org/abs/1110.5353&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum copy protection&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0210062&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncloneable encryption&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1609.09047&quot; rel=&quot;nofollow noreferrer&quot;&gt;one time signature tokens&lt;/a&gt;, etc.. These are all fascinating primitives which are classically impossible, but might be possible using quantum computation (under some mild computational assumptions). The current state of the art is that almost all such constructions either rely on strong (or just irregular) assumptions, or on the existence of some unrealistic oracle. But keep in mind that these questions are relatively new, and the research involving them is very active!&lt;/p&gt;&#xA;" OwnerUserId="9575" LastActivityDate="2019-12-29T16:36:17.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9356" PostTypeId="2" ParentId="9316" CreationDate="2019-12-29T18:39:58.887" Score="1" Body="&lt;p&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\PP}{\mathbb{P}}$&lt;/span&gt;Given an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$\ket a$&lt;/span&gt;, let us write the corresponding density matrix/projector as &lt;span class=&quot;math-container&quot;&gt;$\PP_a$&lt;/span&gt;.&#xA;Any such density matrix can be decomposed using a basis of Hermitian traceless operators (think the Bloch sphere representation for qubits) as &lt;span class=&quot;math-container&quot;&gt;$\PP_a\equiv 1/2(I + \sum_i a_i\sigma_i)$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; the three Pauli matrices.&#xA;The overlap &lt;span class=&quot;math-container&quot;&gt;$|\langle a|v\rangle|^2$&lt;/span&gt; between two states reads, in this formalism, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\PP_a\PP_v)=\frac12(1 + \mathbf a\cdot \mathbf v)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathbf a,\mathbf v$&lt;/span&gt; are the vectors representing the states in the Bloch representation (Bloch sphere for qubits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Defining &lt;span class=&quot;math-container&quot;&gt;$S=S(\mathbf a)$&lt;/span&gt; as per the OP, we then have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  2S = p\left(1+ \mathbf a\cdot \mathbf v\right) + (1-p)\left(1- \mathbf a\cdot \mathbf  w\right) \\&#xA;  = 1 + \mathbf a\cdot(p\mathbf v - (1-p)\mathbf w).&#xA;$$&lt;/span&gt;&#xA;We want to maximise this quantity with respect to &lt;span class=&quot;math-container&quot;&gt;$\mathbf a\in\mathbb R$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\|\mathbf a\|=1$&lt;/span&gt;. An easy way is to impose the gradient &lt;span class=&quot;math-container&quot;&gt;$\nabla S$&lt;/span&gt; be proportional to &lt;span class=&quot;math-container&quot;&gt;$\nabla(\|\mathbf a\|^2-1)=2\mathbf a$&lt;/span&gt; (that is, to use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lagrange_multiplier&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lagrange multiplier method&lt;/a&gt;). An even easier way is to notice that, given an arbitrary (real) vector &lt;span class=&quot;math-container&quot;&gt;$\mathbf x$&lt;/span&gt;, the quantity &lt;span class=&quot;math-container&quot;&gt;$\mathbf a\cdot\mathbf x$&lt;/span&gt; is maximised for &lt;span class=&quot;math-container&quot;&gt;$\mathbf a\simeq\mathbf x$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We conclude that the maximum of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is achieved when&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf a = N[p\mathbf v-(1-p)\mathbf w],$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N\in\mathbb R$&lt;/span&gt; ensures the normalisation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that, if &lt;span class=&quot;math-container&quot;&gt;$\langle v|w\rangle=0$&lt;/span&gt;, you have &lt;span class=&quot;math-container&quot;&gt;$\mathbf w=-\mathbf v$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$2S=1+\mathbf a\cdot\mathbf v$&lt;/span&gt;, which gives &lt;span class=&quot;math-container&quot;&gt;$S_{\max}=1$&lt;/span&gt; for the choice &lt;span class=&quot;math-container&quot;&gt;$\mathbf a=\mathbf v$&lt;/span&gt;. This is of course what we should expect: orthogonal states can be reliably distinguished via suitable choice of measurement.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2019-12-30T16:58:33.900" LastActivityDate="2019-12-30T16:58:33.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9357" PostTypeId="1" AcceptedAnswerId="9364" CreationDate="2019-12-30T18:15:17.867" Score="-3" ViewCount="85" Body="&lt;p&gt;Getting this warning, help me understand this&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;C:\Users\XYZ\Anaconda3\lib\site-packages\qiskit\providers\models\backendconfiguration.py:337: UserWarning: &lt;code&gt;dt&lt;/code&gt; and &lt;code&gt;dtm&lt;/code&gt; now have units of seconds(s) rather than nanoseconds(ns).&#xA;  warnings.warn('&lt;code&gt;dt&lt;/code&gt; and &lt;code&gt;dtm&lt;/code&gt; now have units of seconds(s) rather '  &quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="9660" LastEditorUserId="9660" LastEditDate="2019-12-30T19:15:59.763" LastActivityDate="2020-01-01T09:12:49.897" Title="Help me understand this warning while running qiskit command IBMQ.load_account()" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-01-01T10:28:25.253" ContentLicense="CC BY-SA 4.0" />
  <row Id="9358" PostTypeId="1" CreationDate="2019-12-30T20:44:42.943" Score="2" ViewCount="53" Body="&lt;p&gt;How is a state of a qubit measured physically on a quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="9660" LastEditorUserId="2927" LastEditDate="2019-12-30T21:37:21.697" LastActivityDate="2019-12-30T21:37:21.697" Title="How are states of a qubit measured in a quantum computer?" Tags="&lt;measurement&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-01-01T22:38:13.007" ContentLicense="CC BY-SA 4.0" />
  <row Id="9359" PostTypeId="2" ParentId="9358" CreationDate="2019-12-30T21:03:24.250" Score="2" Body="&lt;p&gt;It depends on technology used for a qubit implementation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, here is an explanation provided by IBM Q team:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We must perform the qubit measurements in a way that does not destroy the qubit quantum state. One method is to weakly couple each qubit to a microwave resonator whose resonance characteristics depend on the state of the qubit. Once the qubit operations are completed in your score, you can measure the qubits by sending a microwave tone to their resonators and analyzing the signal it reflects back. The phase and amplitude of this reflected signal will be different depending on the qubit state. These signals in the resonator are boosted via a chain of amplifiers inside of our dilution refrigerator, including a quantum-limited amplifier at 15 mK, and a high-electron mobility transistor amplifier at 4 K.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Source link: &lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/user-guide?section=5dcb2c01330e880045abccb1#general-questions-about-the-ibm-q-experience&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q - Frequently asked questions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2019-12-30T21:03:24.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9360" PostTypeId="1" CreationDate="2019-12-31T08:22:09.950" Score="3" ViewCount="373" Body="&lt;p&gt;Is it possible to use Qiskit in Julia language? Or is there any wrapper that can be used to call the package from Julia language?&lt;/p&gt;&#xA;" OwnerUserId="9665" LastActivityDate="2020-01-01T14:32:46.393" Title="Qiskit in Julia language?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9361" PostTypeId="2" ParentId="9360" CreationDate="2019-12-31T20:48:18.597" Score="5" Body="&lt;p&gt;Using &lt;a href=&quot;https://github.com/JuliaPy/PyCall.jl&quot; rel=&quot;nofollow noreferrer&quot;&gt;PyCall&lt;/a&gt; it is possible to use arbitrary Python packages (such as Qiskit) in Julia and use the Python functions. At least, this is what PyCall advertises to be able. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you describe has been done before: &lt;a href=&quot;https://github.com/Roger-luo/quantum-benchmarks/blob/master/bin/utils/info.jl&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; is an example on GitHub.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, you would need to do this (I haven't tried this out myself):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using PyCall&#xA;qiskit = pyimport(&quot;qiskit&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Qiskit recommends using Jupyter. Jupyter includes Julia, so it would be convenient to use this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did a search for a native Julia qiskit wrapper, but I did not found one.&lt;/p&gt;&#xA;" OwnerUserId="8776" LastEditorUserId="8776" LastEditDate="2020-01-01T14:32:46.393" LastActivityDate="2020-01-01T14:32:46.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9363" PostTypeId="1" CreationDate="2020-01-01T00:38:10.853" Score="0" ViewCount="43" Body="&lt;p&gt;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 &lt;a href=&quot;https://github.com/Danielgb23/ic_comp_quantica&quot; rel=&quot;nofollow noreferrer&quot;&gt;project&lt;/a&gt; (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?&lt;/p&gt;&#xA;" OwnerUserId="9644" LastActivityDate="2020-01-01T00:38:10.853" Title="Opportunities in quantum computing for an undergrad" Tags="&lt;resource-request&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-01-01T22:47:31.473" ContentLicense="CC BY-SA 4.0" />
  <row Id="9364" PostTypeId="2" ParentId="9357" CreationDate="2020-01-01T09:12:49.897" Score="2" Body="&lt;p&gt;This is just a warning to let you know that the API has changed for the backend configurations such as &lt;a href=&quot;https://qiskit.org/documentation/api/qiskit.providers.models.PulseBackendConfiguration.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;PulseBackendConfiguration&lt;/a&gt;. The &lt;code&gt;dt&lt;/code&gt; (qubit drive channel timestep) and &lt;code&gt;dtm&lt;/code&gt; (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.&lt;/p&gt;&#xA;" OwnerUserId="1790" LastActivityDate="2020-01-01T09:12:49.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9365" PostTypeId="1" CreationDate="2020-01-01T18:26:48.753" Score="7" ViewCount="249" Body="&lt;p&gt;Say I have a quantum circuit of &lt;span class=&quot;math-container&quot;&gt;$w+1$&lt;/span&gt; qubits with a permutation gate (mapping computational basis states to computational basis states) that does the permutation &lt;span class=&quot;math-container&quot;&gt;$(i, i+1)(i+4, i+5)$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$w+1$&lt;/span&gt; qubits if &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is odd and the permutation &lt;span class=&quot;math-container&quot;&gt;$(i+1, i+2)(i+3, i+4)$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is even, for some fixed &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in the range &lt;span class=&quot;math-container&quot;&gt;$1 \leq i \leq 2^W -2$&lt;/span&gt;. Is it possible to decompose the &lt;span class=&quot;math-container&quot;&gt;$(w+1)$&lt;/span&gt;-qubit permutation gate into some &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;-qubit permutation gates, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SWAP}$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NOT}$&lt;/span&gt;s? How? (Ideally, I'd like to avoid using &lt;span class=&quot;math-container&quot;&gt;$\mathrm{SWAP}$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NOT}$&lt;/span&gt;s due to certain implementation issues.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think it should be possible because of Lemma &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; in the appendix of the paper &#xA;&lt;a href=&quot;https://pdfs.semanticscholar.org/37a7/4db564dfb23297a70e2665af35056024956e.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Generating the group of reversible logic gates (Vos, Ra &amp;amp; Storme, 2002)&lt;/a&gt; (PDF):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The subgroup of exchangers &lt;span class=&quot;math-container&quot;&gt;$\mathbf{E}_w$&lt;/span&gt;, augmented with the &lt;span class=&quot;math-container&quot;&gt;$\text{NOT}$&lt;/span&gt; gate and the &lt;span class=&quot;math-container&quot;&gt;$\text{CONTROLLED}^{w−2}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\text{NOT}$&lt;/span&gt; gate, generates the group of even simple control gates. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;but I'm not sure how to construct the circuit.&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="26" LastEditDate="2020-01-02T05:48:52.397" LastActivityDate="2020-01-07T17:24:26.990" Title="Decomposing a $(w+1)$-qubit permutation gate into $w$-qubit permutation gates, SWAPs and NOTs" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9366" PostTypeId="1" AcceptedAnswerId="9367" CreationDate="2020-01-01T20:59:35.073" Score="1" ViewCount="52" Body="&lt;p&gt;In N&amp;amp;Chuang, on page 368 is written the following theorem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; satisfies axioms A1,A2,A3 if and only if&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho)=\sum_k E_k \rho E_k^{\dagger}$$&lt;/span&gt;&#xA;  Where &lt;span class=&quot;math-container&quot;&gt;$\sum_k E_k^{\dagger} E_k \leq I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The axiom A2 is convex linearity, the axiom A3 is CP, the axiom A1 is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Axiom A1: &lt;span class=&quot;math-container&quot;&gt;$0 \leq Tr(\mathcal{E}(\rho)) \leq 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Shouldn't be added in the theorem: &lt;span class=&quot;math-container&quot;&gt;$\sum_k E_k^{\dagger} E_k \geq 0$&lt;/span&gt; as well to ensure the fact the trace can never be negative ? So in the end we would have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$0 \leq \sum_k E_k^{\dagger} E_k \leq I$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2021-02-20T16:24:28.937" LastActivityDate="2021-02-20T16:24:28.937" Title="Kraus decomposition for non trace preserving operation: shouldn't we have $0 \leq \sum_k E_k^{\dagger} E_k \leq I$" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9367" PostTypeId="2" ParentId="9366" CreationDate="2020-01-01T21:56:44.347" Score="3" Body="&lt;p&gt;It's true for any matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; that &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A\ge 0$&lt;/span&gt;.&#xA;It's because &lt;span class=&quot;math-container&quot;&gt;$(A^\dagger A v,v)=(Av, Av)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$(,)$&lt;/span&gt; is the inner product and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; is any vector.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-01-01T21:56:44.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9368" PostTypeId="1" CreationDate="2020-01-01T23:37:50.357" Score="4" ViewCount="178" Body="&lt;p&gt;Let's consider &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; a density matrix. I introduce a space &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and an entangled state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; (the purification) so that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\tr}{\operatorname{Tr}}\rho_A = \tr_B(|\Psi\rangle \langle \Psi |_{AB}) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's consider another purification of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;: a vector &lt;span class=&quot;math-container&quot;&gt;$|\widetilde{\Psi}\rangle$&lt;/span&gt;. By definition we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = \tr_{B}(|\widetilde{\Psi}\rangle \langle \widetilde{\Psi} |_{AB})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have read that those two states are indeed purification of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; if and only if:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\widetilde{\Psi}\rangle = I_A \otimes U_B |\Psi\rangle_{AB} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the sufficient part, but I don't see why it would be necessary for &lt;span class=&quot;math-container&quot;&gt;$ |\widetilde{\Psi}\rangle$&lt;/span&gt; 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)&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-01-03T17:51:02.583" LastActivityDate="2020-01-03T18:02:00.147" Title="Why do purifications only differ by a local unitary?" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9369" PostTypeId="2" ParentId="9368" CreationDate="2020-01-02T01:44:34.903" Score="2" Body="&lt;p&gt;It is due to Schmidt decomposition. For some &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_{AB} \in H_A \otimes H_B$&lt;/span&gt;, there exists a decomposition in terms of the orthonormal basis (Schmidt bases) of system A and B. &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are the Schmidt coefficients calculated from &lt;span class=&quot;math-container&quot;&gt;$Tr_B(|\psi\rangle \langle\psi|_{AB})$&lt;/span&gt; whose eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\lambda^2_i$&lt;/span&gt;. Given below is the Schmidt decomposition, {&lt;span class=&quot;math-container&quot;&gt;$|a_i\rangle$&lt;/span&gt;} are the eigenvectors of system A and {&lt;span class=&quot;math-container&quot;&gt;$|b_i\rangle$&lt;/span&gt;} are the eigenvectors of system B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_{AB} = \sum_i \lambda_i |a_i\rangle |b_i\rangle $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i \geq 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_i \lambda^2_i =1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 {&lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;} should remain fixed in both decompositions. Because we want to preserve {&lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;}, eigenvalues of system B should be preserved i.e a unitary applied only to system B while identity is applied to A i.e. &lt;span class=&quot;math-container&quot;&gt;$I_A\otimes U_B$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In conclusion, when the partial trace on system B is done, then this change does not show up in the final purification.  &lt;/p&gt;&#xA;" OwnerUserId="2598" LastActivityDate="2020-01-02T01:44:34.903" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9370" PostTypeId="1" CreationDate="2020-01-02T02:49:06.890" Score="4" ViewCount="94" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|x\right&amp;gt;\xrightarrow{\mathbb H^{\otimes n}}\frac{1}{\sqrt{2^n}}\sum_{x=0}^{2^n-1}\left|x\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x·y}$&lt;/span&gt; that gets multiplied with each part of the superposition like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2^n}}\sum_{x=0}^{2^n-1}\left|x\right&amp;gt;\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&amp;gt;$$&lt;/span&gt;&#xA;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x.y = x_0y_0\oplus x_1y_1\oplus x_2y_2\oplus\ldots\oplus x_{n-1}y_{n-1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't quite understand where this &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x·y}$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any intuition on this would be extremely helpful!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Jozsa Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9678" LastEditorUserId="23" LastEditDate="2020-01-10T09:30:21.670" LastActivityDate="2020-01-10T09:30:21.670" Title="Why do multi-bit hadamards expands to what they do?" Tags="&lt;deutsch-jozsa-algorithm&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9371" PostTypeId="1" CreationDate="2020-01-02T04:09:12.050" Score="3" ViewCount="52" Body="&lt;p&gt;In the Bernstein Vazirani algorithm, the problem is to find &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$f(x) = s \times x $&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$f : \{0,1 \}^n \to \{0 , 1 \} $&lt;/span&gt;. The literature says that the classical randomized algorithms also requires &lt;span class=&quot;math-container&quot;&gt;$ \Omega ( n)$&lt;/span&gt; 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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="9681" LastEditorUserId="8776" LastEditDate="2020-01-02T10:09:21.067" LastActivityDate="2020-01-02T10:09:21.067" Title="Probabilistic query complexity lower bound for Bernstein-Vazirani problem" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9372" PostTypeId="1" AcceptedAnswerId="9378" CreationDate="2020-01-02T04:25:37.230" Score="4" ViewCount="1599" Body="&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q= QuantumRegister(3)&#xA;c= ClassicalRegister(3)&#xA;qc= QuantumCircuit(q, c)&#xA;qc.measure(q,c)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I noticed that &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6462/get-result-measurement-into-a-circuit-with-qiskit&quot;&gt;this question&lt;/a&gt; had a similar question and they transformed the statement &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if(c[0]==0) qc.x(q[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;into &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(q[0]).c_if(c[0], 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, I want to have multiple quantum operations conditioned on the if statement&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if c[0]==1 and c[1]==1:&#xA;    qc.x(q[0])&#xA;    qc.x(q[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;can this work with &quot;c_if&quot;? &lt;/p&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="8776" LastEditDate="2020-01-02T09:21:45.860" LastActivityDate="2020-01-02T10:28:37.067" Title="How to implement if statement based on measurement results in qiskit?" Tags="&lt;qiskit&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9373" PostTypeId="2" ParentId="9370" CreationDate="2020-01-02T08:24:08.213" Score="4" Body="&lt;p&gt;Your first formula is not correct. The correct formula for Hadamard gates for the arbitrary &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; from the calculational basis is (it can be proved by induction):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}|x\rangle=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}{(-1)^{x\cdot y}}|y\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$x\cdot y=x_0y_0\oplus x_1y_1\oplus x_2y_2\oplus ...\oplus x_ny_n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0\rangle$&lt;/span&gt; then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$x\cdot y =0\cdot y = 0$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&#xA;in this case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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=$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same way it can be proved that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n}H^{\otimes n}|x\rangle=|x\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9545" LastEditorUserId="9545" LastEditDate="2020-01-02T09:58:01.777" LastActivityDate="2020-01-02T09:58:01.777" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9374" PostTypeId="2" ParentId="9371" CreationDate="2020-01-02T08:53:38.740" Score="2" Body="&lt;p&gt;I would typically write &lt;span class=&quot;math-container&quot;&gt;$s\cdot x$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$s\times x$&lt;/span&gt;. However, that's a minor thing. The important issue here is that &lt;span class=&quot;math-container&quot;&gt;$s\in\{0,1\}^n$&lt;/span&gt;. It has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits. However, each time you perform the classical function evaluation, you &lt;em&gt;only&lt;/em&gt; get one bit of information, because &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; only has one bit of output (Note that even if you phrase it as a reversible computation, although &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; bits may be involved, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits, it's going to take you at least &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; queries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(The obvious strategy to ensure that you &lt;em&gt;only&lt;/em&gt; need &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; queries is to choose the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; inputs which each consist of &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; 0s and one 1 (in the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; different positions), so that the evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is a different bit of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; each time.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-02T08:53:38.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9375" PostTypeId="1" AcceptedAnswerId="9525" CreationDate="2020-01-02T09:46:24.800" Score="3" ViewCount="351" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1904.05803&quot; rel=&quot;nofollow noreferrer&quot;&gt;Towards Pricing Financial Derivatives with an IBM Quantum Computer&lt;/a&gt;, page 6, figure 3(a).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho=&#xA;\begin{pmatrix}&#xA;0.6407 &amp;amp; 0.3288 \\&#xA;0.3288 &amp;amp; 0.3593&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The largest eigenvalue of the matrix is 0.8576 with respective eigenvector &lt;span class=&quot;math-container&quot;&gt;$(0.8347; 0.5508)^T$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To search for that, the authors proposed following cicuit&#xA;&lt;a href=&quot;https://i.stack.imgur.com/10E09.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/10E09.png&quot; alt=&quot;Circuit in article&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that gates denoted by -1.57 and -0.79 are &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T^\dagger$&lt;/span&gt; respecitvelly. They act on &quot;bottom&quot; qubit and they are controlled by &quot;top&quot; qubit&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; operators implement operator &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{2\pi i \rho}$&lt;/span&gt; and its powers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the article, results after measurement should be these:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kk8fU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kk8fU.png&quot; alt=&quot;Article result&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that pink bars are results obtained on simulator, while blue ones on IBMQX2 processor&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on these results, the authors concluded that the largest eigenvalue is approximated by value &lt;span class=&quot;math-container&quot;&gt;$0.111_2$&lt;/span&gt; (0.875 in decimal which is close to actual value 0.8576).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to replicate their results with this circuit on IBM Q:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wrN7L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wrN7L.png&quot; alt=&quot;My circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: please find a code in QASM at the end of the question to see parameters of gates&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I received these results on IBM Q simulator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hAuvL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hAuvL.png&quot; alt=&quot;My results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to my results, the largest eigenvalue should be zero which does not make sense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, my questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Where I did a mistake in circuit implementation? My circuit and the author's seems to be the same.&lt;/li&gt;&#xA;&lt;li&gt;Why the qubit &lt;span class=&quot;math-container&quot;&gt;$|q_3\rangle$&lt;/span&gt; is initialized by gates &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; with parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; equal to 1.00 and 0.33, respectively? I would expect only gate &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\theta = 1.1665$&lt;/span&gt; as this gate produce the eigenvector &lt;span class=&quot;math-container&quot;&gt;$(0.8347; 0.5508)^T$&lt;/span&gt;. However, replacement of &lt;span class=&quot;math-container&quot;&gt;$Ry(1.00)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz(0.33)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$Ry(1.1665)$&lt;/span&gt; does not change resulting histogram significantly.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is a QASM code of my circuit&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[4];&#xA;creg c[4];&#xA;&#xA;h q[0];&#xA;h q[1];&#xA;h q[2];&#xA;ry(1.00) q[3];&#xA;rz(0.33) q[3];&#xA;cu3(1.6,-1.12,2.03) q[2],q[3];&#xA;cu3(2.23,0.51,3.65) q[1],q[3];&#xA;cu3(0.8,-4.53,-1.39) q[0],q[3];&#xA;h q[0];&#xA;cu1(-pi/2) q[0],q[1];&#xA;cu1(-pi/4) q[0],q[2];&#xA;h q[1];&#xA;cu1(-pi/2) q[1],q[2];&#xA;h q[2];&#xA;measure q[3] -&amp;gt; c[3];&#xA;measure q[2] -&amp;gt; c[2];&#xA;measure q[1] -&amp;gt; c[1];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-06T05:55:44.903" LastActivityDate="2020-01-13T22:25:28.003" Title="Cannot replicate results in article on pricing financial derivatives on IBM Q" Tags="&lt;ibm-q-experience&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9376" PostTypeId="5" CreationDate="2020-01-02T10:00:10.887" Score="0" Body="&lt;p&gt;The tag should be used for questions related to application of a quantum computing in finance. Examples: calculation financial risk measures (e.g. CVaR), porfolio optimization, financial product pricing etc. The tag can be used for quantum algorithm connected with statistical methods used in finance as well, e.g. quantum principal component analysis, time series analysis etc.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-02T19:19:34.097" LastActivityDate="2020-01-02T19:19:34.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9377" PostTypeId="4" CreationDate="2020-01-02T10:00:10.887" Score="0" Body="Used for application of quantum algorithms in finance industry." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-02T19:19:41.110" LastActivityDate="2020-01-02T19:19:41.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9378" PostTypeId="2" ParentId="9372" CreationDate="2020-01-02T10:28:37.067" Score="4" Body="&lt;p&gt;AFAIK, what you want can't be run on the hardware right now. See &lt;a href=&quot;https://github.com/Qiskit/qiskit-textbook/issues/119&quot; rel=&quot;nofollow noreferrer&quot;&gt;this github issue&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you can do this in the simulators. If, for example, &lt;code&gt;c[0]&lt;/code&gt; and &lt;code&gt;c[1]&lt;/code&gt; make up a two-bit classical register &lt;code&gt;c&lt;/code&gt;, you can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(q[0]).c_if(c,3)&#xA;qc.x(q[1]).c_if(c,3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1790" LastActivityDate="2020-01-02T10:28:37.067" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9379" PostTypeId="2" ParentId="9243" CreationDate="2020-01-02T11:23:34.007" Score="2" Body="&lt;p&gt;I assume this is not what was intended, but here's one method:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You already know that you can approximately make &lt;span class=&quot;math-container&quot;&gt;$H'=2i\alpha(|x\rangle\langle\psi|-|\psi\rangle\langle x|)$&lt;/span&gt; by using products of terms such as &lt;span class=&quot;math-container&quot;&gt;$e^{i\delta|x\rangle\langle x|}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\delta|\psi\rangle\langle \psi|}$&lt;/span&gt;. So, we &lt;em&gt;could&lt;/em&gt; simply convert &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|}}.&#xA;$$&lt;/span&gt;&#xA;So, let's consider just the exponent:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\pi/2|\psi\rangle\langle \psi|}H'e^{-i\pi/2|\psi\rangle\langle \psi|}.&#xA;$$&lt;/span&gt;&#xA;The term &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi/2|\psi\rangle\langle \psi|}$&lt;/span&gt; has the effect&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\pi/2|\psi\rangle\langle \psi|}|\psi\rangle=i|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;while it has no effect on any other (orthogonal) state. If we ignore terms of &lt;span class=&quot;math-container&quot;&gt;$O(\alpha)$&lt;/span&gt;, we can neglect the overlap between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\pi/2|\psi\rangle\langle \psi|}|x\rangle\approx|x\rangle.&#xA;$$&lt;/span&gt;&#xA;Hence, the transformation on &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H'\rightarrow2i\alpha(-i|x\rangle\langle\psi|-i|\psi\rangle\langle x|)=2\alpha(|x\rangle\langle\psi|+|\psi\rangle\langle x|),&#xA;$$&lt;/span&gt;&#xA;exactly as we need (to &lt;span class=&quot;math-container&quot;&gt;$O(\alpha^2)$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-02T11:23:34.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9380" PostTypeId="1" CreationDate="2020-01-02T12:34:52.883" Score="2" ViewCount="349" Body="&lt;p&gt;Trying quantum teleportation in&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-textbook/blob/master/content/ch-algorithms/teleportation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-textbook/blob/master/content/ch-algorithms/teleportation.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Succesful runs in 'qasm_simulator', but when switching to IBMQBackend('ibmqx2') I get IBMQJobFailError&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hfLua.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hfLua.png&quot; alt=&quot;see circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9648" LastActivityDate="2020-01-02T15:14:19.170" Title="Qubit measurement is followed by instructions. Error code: 7006" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2020-01-02T17:18:07.293" ContentLicense="CC BY-SA 4.0" />
  <row Id="9382" PostTypeId="2" ParentId="9380" CreationDate="2020-01-02T14:36:17.890" Score="2" Body="&lt;p&gt;The error is caused by appending gates onto qubits following a measurement. On qubit 1 and qubit 0, you attach a &lt;code&gt;cx&lt;/code&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-01-02T14:36:17.890" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9383" PostTypeId="2" ParentId="8441" CreationDate="2020-01-02T14:43:31.463" Score="0" Body="&lt;p&gt;I would also like to bring up the classical concepts of &lt;a href=&quot;https://en.wikipedia.org/wiki/Combinational_logic&quot; rel=&quot;nofollow noreferrer&quot;&gt;combinatorial logic&lt;/a&gt; vs &lt;a href=&quot;https://en.wikipedia.org/wiki/Sequential_logic&quot; rel=&quot;nofollow noreferrer&quot;&gt;sequential logic&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sequencial logic is the opposite. Its internal state gets update with every clock tick.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8849/quantum-circuits-explain-algorithms-why-didnt-classical-circuits/8869#8869&quot;&gt;Quantum circuits explain algorithms, why didn&amp;#39;t classical circuits?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4243" LastActivityDate="2020-01-02T14:43:31.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9384" PostTypeId="2" ParentId="9380" CreationDate="2020-01-02T15:14:19.170" Score="0" Body="&lt;p&gt;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.&#xA;I encountered the same problem, see solution &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8682/trying-to-build-a-circuit-for-quantum-teleportation-on-ibmq-i-get-error-running&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-02T15:14:19.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9385" PostTypeId="1" CreationDate="2020-01-02T15:49:34.337" Score="6" ViewCount="60" Body="&lt;p&gt;A quantum computer running Shor's algorithm would be famously useful for &lt;em&gt;de&lt;/em&gt;crypting 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 &lt;em&gt;encrypting&lt;/em&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm &lt;em&gt;not&lt;/em&gt; talking about &quot;physics-based&quot; quantum encryption schemes like quantum key distribution (discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7/how-is-quantum-cryptography-different-from-cryptography-used-nowadays&quot;&gt;here&lt;/a&gt;) or other schemes that require transmitting a coherent quantum state over a quantum channel. I'm talking about more traditional &quot;mathematics-based&quot; encryption schemes, in which one or both parties have a quantum &lt;em&gt;computer&lt;/em&gt; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This question is inspired by Scott Aaronson's comments &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4447#comment-1827236&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4447#comment-1827239&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; on his blog. Apparently people regularly claim that quantum &lt;em&gt;computers&lt;/em&gt; (not QKD) could be useful for &lt;em&gt;en&lt;/em&gt;cryption, but Prof. Aaronson has never understood why.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-01-03T05:11:48.307" LastActivityDate="2020-01-03T05:11:48.307" Title="Could quantum computers be useful for sending encrypted information over a classical channel?" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;communication-complexity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9386" PostTypeId="1" CreationDate="2020-01-02T16:05:15.030" Score="2" ViewCount="139" Body="&lt;p&gt;Is it possible to make a quantum &lt;a href=&quot;https://en.wikipedia.org/wiki/Monty_Hall_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Monty Hall problem&lt;/a&gt; where the quantum computer wins the game always?&lt;/p&gt;&#xA;" OwnerUserId="9687" LastEditorUserId="9006" LastEditDate="2020-01-02T19:19:20.403" LastActivityDate="2020-09-30T20:20:22.497" Title="Monty Hall Problem in Quantum Computing" Tags="&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ClosedDate="2020-10-02T22:30:05.707" ContentLicense="CC BY-SA 4.0" />
  <row Id="9387" PostTypeId="2" ParentId="9385" CreationDate="2020-01-02T16:07:23.610" Score="5" Body="&lt;p&gt;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 &quot;proof&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;probably hard to solve&quot; part is probably still hard for a quantum computer. But you &lt;em&gt;could&lt;/em&gt; 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 &lt;em&gt;quantum&lt;/em&gt; computer. This suggests the &lt;em&gt;possibility&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-02T16:07:23.610" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9388" PostTypeId="2" ParentId="9386" CreationDate="2020-01-02T16:16:17.297" Score="1" Body="&lt;p&gt;In case you were able to design an oracle for right door identification (I am not sure how to do so), you would apply &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-02T16:16:17.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9389" PostTypeId="1" CreationDate="2020-01-02T18:23:40.273" Score="2" ViewCount="172" Body="&lt;p&gt;If one has two qubits in arbitrary stats and wishes to apply a controlled version of some global phase gate &lt;span class=&quot;math-container&quot;&gt;$P(\varphi) = \begin{pmatrix} e^{i\varphi} &amp;amp; 0 \\ 0 &amp;amp; e^{i\varphi} \end{pmatrix}$&lt;/span&gt; one should obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\xrightarrow{\text{CP}}&#xA;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), &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This example shows that in contrast to global phase gate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; which doesn't produce any measurable changes in a qubit state, the controlled version of it (&lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt;) makes measurable changes in the state of a system of qubits. So it is ok if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is ignored, but it is not ok if &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; is ignored (what is happening in the presented code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code where I use &lt;code&gt;qiskit.aqua.operators.common.evolution_instruction&lt;/code&gt; method, where because of (how I understand) ignoring the global phase gate, the &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; gate wasn't obtained (the &lt;code&gt;print(qc.qasm())&lt;/code&gt; command shows no gate is added to the circuit):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import *&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;from qiskit.aqua.operators.common import evolution_instruction&#xA;&#xA;phase = np.pi&#xA;pauli_dict = {'paulis': [{&quot;coeff&quot;: {&quot;imag&quot;: 0.0, &quot;real&quot;: phase}, &quot;label&quot;: &quot;I&quot;}]}&#xA;identity = WeightedPauliOperator.from_dict(pauli_dict)&#xA;&#xA;pauli_list = identity.reorder_paulis()&#xA;instruction = evolution_instruction(pauli_list, evo_time=1, num_time_slices=1, controlled=True)&#xA;&#xA;q = QuantumRegister(2)&#xA;qc_temp = QuantumCircuit(q)&#xA;qc_temp.append(instruction, q)&#xA;qc = qc_temp.decompose()&#xA;&#xA;print(qc.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Possible consequences: when I tried to implement IPEA algorithm for &lt;span class=&quot;math-container&quot;&gt;$H = \begin{pmatrix} E_1 &amp;amp; 0 \\ 0 &amp;amp; E_2 \end{pmatrix}$&lt;/span&gt; Hamiltonian I was estimating &lt;span class=&quot;math-container&quot;&gt;$E_2 - E_1$&lt;/span&gt; instead of estimating &lt;span class=&quot;math-container&quot;&gt;$E_2$&lt;/span&gt; eigenvalue. This problem was reported &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9179/a-question-about-qiskits-weightedpaulioperator-evolve-method-for-ipea-iqpe-im&quot;&gt;here&lt;/a&gt;. Problems may arise also for other quantum algos that use PEA as a subroutine (like HHL algo).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this a problem/bug? Are there alternatives to &lt;code&gt;qiskit evolution_instruction method&lt;/code&gt; that don't ignore phase gates (or Pauli I operator)?&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="55" LastEditDate="2020-06-04T15:05:31.080" LastActivityDate="2021-03-01T17:01:35.210" Title="Pauli I in eoh procedure doesn't become a global phase gate in qiskit evolution_instruction method. Possible consequences" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9390" PostTypeId="2" ParentId="9389" CreationDate="2020-01-02T19:23:38.383" Score="0" Body="&lt;p&gt;It seems that this is not a problem/bug. In case the global phase gate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is applied in non-controlled form, final matrix for two qubits (&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is acting on second qubit) is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;I \otimes P =&#xA;\begin{pmatrix}&#xA;P &amp;amp; O \\&#xA;O &amp;amp; P \\&#xA;\end{pmatrix}&#xA;=\mathrm{e}^{i\phi}I&#xA;\end{equation}&lt;/span&gt;&#xA;So, &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; acts as global phase gate and the phase &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\phi}$&lt;/span&gt; can be ignored.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, matrix of controlled &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is as follows&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CP =&#xA;\begin{pmatrix}&#xA;I &amp;amp; O \\&#xA;O &amp;amp; P \\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;Hence, &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; is no longer global phase gate but it prepares entangled state.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-02T19:23:38.383" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9391" PostTypeId="1" CreationDate="2020-01-02T20:28:20.243" Score="2" ViewCount="217" Body="&lt;p&gt;If I have either of the following states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I check to see whether they are entangled or not? I have seen people say that the state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi_1\right\rangle$&lt;/span&gt; is entangled because &quot;there are correlations between the three qubits&quot;, but I can't find what this really means.&lt;/p&gt;&#xA;" OwnerUserId="9678" LastEditorUserId="55" LastEditDate="2020-01-10T16:14:59.547" LastActivityDate="2020-01-10T16:14:59.547" Title="How to identify entanglement in a given pure state?" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9392" PostTypeId="2" ParentId="9391" CreationDate="2020-01-02T23:00:25.677" Score="3" Body="&lt;p&gt;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 &lt;strong&gt;un-entangled&lt;/strong&gt; state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is one that can be written in the following way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \ = \ \displaystyle\bigotimes_n |\psi_n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|\psi_n\rangle$&lt;/span&gt; is the state of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-th qudit, whatever you want. In the case of an &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;-level discrete quantum system, we can write each &lt;span class=&quot;math-container&quot;&gt;$|\psi_n\rangle$&lt;/span&gt; as a normalized linear combination of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; &lt;strong&gt;orthogonal&lt;/strong&gt; basis vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_n\rangle \ = \ \displaystyle\sum_{d} c^n_d |d\rangle \ \ \ \text{with} \ \ \ \displaystyle\sum_d |c^n_d|^2 \ = \ 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of a qubit, &lt;span class=&quot;math-container&quot;&gt;$D \ = \ 2$&lt;/span&gt; and we have &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as our basis states. We thus expand &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \ = \ \displaystyle\bigotimes_n \displaystyle\sum_{d} c^n_d |d\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When we expand our tensor product, we will get a linear combination of &lt;span class=&quot;math-container&quot;&gt;$D^N$&lt;/span&gt; different state vectors, each with some unknown coefficient. In general, for the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th term of the sum, our coefficient &lt;span class=&quot;math-container&quot;&gt;$c_j$&lt;/span&gt; is given by a product of &lt;span class=&quot;math-container&quot;&gt;$D^N$&lt;/span&gt; different values of &lt;span class=&quot;math-container&quot;&gt;$c^n_d$&lt;/span&gt; (I'm not going to do the explicit expansion for the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th term in the case of a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-level quantum system, I don't even want to do the binomial expansion for a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-level system):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we already know &lt;span class=&quot;math-container&quot;&gt;$c_j$&lt;/span&gt;, as we know &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$c_j$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c_j \ = \ \langle j | \psi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th basis vector in the expansion. Thus, all we have to do is solve the system of &lt;span class=&quot;math-container&quot;&gt;$D^N$&lt;/span&gt; equations for &lt;span class=&quot;math-container&quot;&gt;$D^N$&lt;/span&gt; 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!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this was slightly confusing an abstract, let's work through a basic example, and prove that the maximally entangled qubit Bell state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \ = \ \frac{|00\rangle \ + \ |11\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is in fact entangled using the outlined method. Our goal is to write &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as a tensor product of two individual state vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \ = \ \frac{|00\rangle \ + \ |11\rangle}{\sqrt{2}} \ = \ (a|0\rangle \ + \ b|1\rangle) \ \otimes \ (c|0\rangle \ + \ d|1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, since each of our basis vectors are orthogonal, we can equate the components to get a system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ac \ = \ \frac{1}{\sqrt{2}}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ad \ = \ 0$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$bc \ = \ 0$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$bd \ = \ \frac{1}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rearranging, we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d \ = \ \frac{1}{\sqrt{2} b} \ \ \ \text{and} \ \ \ a \ = \ \frac{1}{\sqrt{2} c}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ad \ = \ \frac{1}{2bc} \ = \ 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi_n\rangle$&lt;/span&gt; as a discrete sum of basis states, but as a continuous integral over a continuum:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_n\rangle \ = \ \displaystyle\int \psi_n(x) |x\rangle dx$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We then have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \ = \ \displaystyle\int \ ... \ \displaystyle\int \psi(x_1, \ ..., \ x_n) \displaystyle\bigotimes_n |x_n\rangle \ dx_1 \ ... \ dx_n$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, analogous to the discrete case, we know the function &lt;span class=&quot;math-container&quot;&gt;$\psi(x_1, \ ..., \ x_n)$&lt;/span&gt;. Thus, in the un-entangled case, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\displaystyle\prod_n \psi_n(x_n) \ = \ \psi(x_1, \ ..., \ x_n)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of finding discrete components, our goal is to find a collection of functions &lt;span class=&quot;math-container&quot;&gt;$\psi_j(x_j)$&lt;/span&gt;, such that the product of all these functions gives us the general &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;. If we can't do this, then our state is entangled. As an example, consider the function:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\psi(x, \ y) \ = \ x \ + \ y \ + \ xy$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We want to find &lt;span class=&quot;math-container&quot;&gt;$\psi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\psi_2$&lt;/span&gt; such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\psi_1(x) \psi_2(y) \ = \ x \ + \ y \ + \ xy$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$\psi_2(y)$&lt;/span&gt; is a function of &lt;strong&gt;only&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, we can't have &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; present in any of the terms. We quickly realize that this is impossible, as the only way to get rid of the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in the first term is if &lt;span class=&quot;math-container&quot;&gt;$\psi_1(x) \ = \ ax$&lt;/span&gt;, but this would mean that the second term contains &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \ = \ \displaystyle\int \displaystyle\int (x \ + \ y \ + \ xy) |x, \ y\rangle dx dy$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;must be entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After writing this answer, I came across &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2263/how-do-i-show-that-a-two-qubit-state-is-an-entangled-state&quot;&gt;this question&lt;/a&gt;, 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. &lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="4907" LastEditDate="2020-01-03T03:30:04.673" LastActivityDate="2020-01-03T03:30:04.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9393" PostTypeId="1" AcceptedAnswerId="9395" CreationDate="2020-01-03T05:49:12.523" Score="1" ViewCount="91" Body="&lt;p&gt;I have been going through the original HHL paper (2009), and I see that they call a linear system of equations &quot;well behaved&quot; / &quot;well-conditioned&quot;, if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\lambda| \in \left[\frac{1}{\kappa}, 1\right]$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="542" LastActivityDate="2020-01-03T08:13:53.360" Title="HHL Algorithm: Relation between Eigenvalues and condition number" Tags="&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9394" PostTypeId="2" ParentId="9391" CreationDate="2020-01-03T06:49:17.980" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-03T06:49:17.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9395" PostTypeId="2" ParentId="9393" CreationDate="2020-01-03T08:13:53.360" Score="2" Body="&lt;p&gt;In the HHL algorithm, they are solving a linear system &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;. This is achieved by embedding &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; into a Hermitian matrix such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\left(\begin{array}{cc} 0 &amp;amp; A \\ A^\dagger &amp;amp; 0 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has singular values &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm\lambda$&lt;/span&gt;. So to all intents and purposes, they are the same thing in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt; has eigenvalues (to be determined by phase estimation) that do not loop past any &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; boundaries so there's never any ambiguity. i.e. you want &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;t\lambda&amp;lt;\pi$&lt;/span&gt; for all singular values &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;. The second issue is that the main part of the algorithm essentially calculates &lt;span class=&quot;math-container&quot;&gt;$1/\lambda$&lt;/span&gt;, which is bad news if we've identified &lt;span class=&quot;math-container&quot;&gt;$\lambda=0$&lt;/span&gt;, so we want to ensure that our phase estimation procedure is accurate enough to be able to detect that the eigenvalues are not 0.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-03T08:13:53.360" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9396" PostTypeId="1" AcceptedAnswerId="9397" CreationDate="2020-01-03T08:24:55.260" Score="-1" ViewCount="341" Body="&lt;p&gt;The Hadamard gate is a unitary gate, but how does the matrix times its own conjugate transpose actually result in the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; matrix? I am currently looking at it as a scalar, 0.707..., multiplied by the matrix of ones and negative one.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H=\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="9006" LastEditDate="2020-01-03T21:50:42.973" LastActivityDate="2020-01-04T21:59:37.440" Title="Why is a Hadamard gate unitary?" Tags="&lt;quantum-state&gt;&lt;unitarity&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9397" PostTypeId="2" ParentId="9396" CreationDate="2020-01-03T11:08:29.487" Score="4" Body="&lt;p&gt;The Hadamard gate is described by this matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H=\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;Conjugate transpose of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is again &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Hence we have to check if &lt;span class=&quot;math-container&quot;&gt;$HH$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Multiplication goes as follows (&lt;span class=&quot;math-container&quot;&gt;$h_{ij}$&lt;/span&gt; denotes elements of resulting matrix):&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$h_{11} = 1\cdot1 + 1\cdot1 = 2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$h_{12} = 1\cdot 1 + 1\cdot (-1) = 0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$h_{21} = 1 \cdot1 + (-1) \cdot 1= 0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$h_{21} = 1 \cdot1 + (-1)\cdot (-1) = 2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;HH=\frac{1}{\sqrt{2}}\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;2 &amp;amp; 0 \\&#xA;0 &amp;amp; 2&#xA;\end{pmatrix}&#xA;=&#xA;\frac{1}{2}&#xA;\begin{pmatrix}&#xA;2 &amp;amp; 0 \\&#xA;0 &amp;amp; 2&#xA;\end{pmatrix}&#xA;=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;=I.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="124" LastEditDate="2020-01-04T21:59:37.440" LastActivityDate="2020-01-04T21:59:37.440" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9398" PostTypeId="2" ParentId="9389" CreationDate="2020-01-03T15:22:26.433" Score="0" Body="&lt;p&gt;What does the &lt;code&gt;print(qc.qasm())&lt;/code&gt; yield for you?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is what I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q2[2];&#xA;Controlled-Evolution^1 q2[0],q2[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7744" LastActivityDate="2020-01-03T15:22:26.433" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9399" PostTypeId="2" ParentId="9389" CreationDate="2020-01-03T15:31:39.427" Score="0" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import qiskit_version&#xA;print(qiskit_version)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7744" LastActivityDate="2020-01-03T15:31:39.427" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9400" PostTypeId="2" ParentId="9368" CreationDate="2020-01-03T15:41:21.097" Score="5" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\vert#1\rangle}$&lt;/span&gt;&#xA;First, write &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\tilde\psi}$&lt;/span&gt; in their Schmidt decomposition:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\ket\psi &amp;amp;= \sum \lambda_i \ket{a_i}\ket{b_i}\ , \\&#xA;\ket{\tilde\psi} &amp;amp; = \sum \tilde\lambda_i \ket{\tilde a_i}\ket{\tilde b_i}\ .&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Let us assume for simplicty that the &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are non-degenerate.&#xA;Since they both have the same reduced density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;, we have that &lt;span class=&quot;math-container&quot;&gt;$\lambda_i=\tilde \lambda_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{a_i}=\ket{\tilde a_i}$&lt;/span&gt;.  Now construct &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\ket{\tilde b_i}=U\ket{b_i}$&lt;/span&gt; -- this is possible since both are orthogonal bases.  Then, we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{\tilde\psi} = (I\otimes U)\ket{\psi}&#xA;$$&lt;/span&gt;&#xA;-- that is, given two arbitrary purifications of the same &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;, we have shown they are related by a unitary on the purifying system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In case some &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are degenerate, the Schmidt decomposition is not unique - you want to choose it such that &lt;span class=&quot;math-container&quot;&gt;$\ket{a_i}=\ket{\tilde a_i}$&lt;/span&gt; also for the degenerate &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;, which is always possible, since the degenerate eigenvectors must span the same subspace.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Another note: In principle, the purifying system can be larger than the Schmidt rank; in that case, the action of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is only fixed on the subspace spanned by the Schmidt vectors on B.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="5870" LastEditDate="2020-01-03T17:14:18.600" LastActivityDate="2020-01-03T17:14:18.600" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9403" PostTypeId="2" ParentId="9368" CreationDate="2020-01-03T18:02:00.147" Score="2" Body="&lt;p&gt;Another way to see this is remembering that the density matrix of a bipartite pure state is essentially its covariance matrix, in the sense that if a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; has components &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\!\langle\psi|$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\rho=\psi\psi^\dagger$&lt;/span&gt; (where we are thinking of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; as a matrix, so that &lt;span class=&quot;math-container&quot;&gt;$(\psi\psi^\dagger)_{ij}=\sum_\ell \psi_{i\ell}\bar\psi_{j\ell}$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that, if &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; are pure states corresponding to the same density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, as matrices they satisfy &lt;span class=&quot;math-container&quot;&gt;$\psi\psi^\dagger=\phi\phi^\dagger=\rho$&lt;/span&gt;. This implies that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;singular value decomposition&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; must have both singular values and left principal components in common, that is, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \psi = \sum_k s_k \mathbf u_k \mathbf v_k^*, \\&#xA;  \phi = \sum_k s_k \mathbf u_k \mathbf w_k^*,&#xA;$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$s_k\ge0$&lt;/span&gt; (whose square equal the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;) and orthonormal sets of vectors &lt;span class=&quot;math-container&quot;&gt;$\{\mathbf u_k\}_k,\{\mathbf v_k\}_k,\{\mathbf w_k\}_k$&lt;/span&gt;, and with &lt;span class=&quot;math-container&quot;&gt;$\mathbf v^*$&lt;/span&gt; denoting the dual of &lt;span class=&quot;math-container&quot;&gt;$\mathbf v$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to the notation with ket vectors (that is, considering again the vectorifications of &lt;span class=&quot;math-container&quot;&gt;$\psi,\phi$&lt;/span&gt;), we can see that the above equation is equivalent to the statement about purifications differing only by local unitaries.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-03T18:02:00.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9404" PostTypeId="1" AcceptedAnswerId="9405" CreationDate="2020-01-03T18:21:53.813" Score="1" ViewCount="629" Body="&lt;p&gt;If I have the following state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{1}{\sqrt{2}}\left(\left(\frac{1+i}{\sqrt{2}} \right)\left| 0 \right&amp;gt; + \left| 1\right&amp;gt;\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I find the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; values of this qubit on the Bloch sphere?&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="26" LastEditDate="2020-01-09T02:05:55.307" LastActivityDate="2020-01-09T11:21:49.587" Title="How can I find the $\theta$ and $\phi$ values of a qubit on the Bloch sphere?" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9405" PostTypeId="2" ParentId="9404" CreationDate="2020-01-03T18:54:18.600" Score="2" Body="&lt;p&gt;See below:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left| \varphi \right&amp;gt;=\frac{1}{\sqrt{\sqrt{2}}}\left(\left(\frac{1+i}{\sqrt{2}} \right)\left| 0 \right&amp;gt; + \left| 1\right&amp;gt;\right)&#xA;=&#xA;\frac{1+i}{\sqrt{\sqrt{2}}}\left(\frac{1}{\sqrt{2}}\left| 0 \right&amp;gt; + \frac{1}{\sqrt{2}}\frac{1-i}{\sqrt{2}} \left| 1\right&amp;gt;\right)&#xA;=&#xA;\frac{1+i}{\sqrt{\sqrt{2}}}\left(\cos(\pi/4)\left| 0 \right&amp;gt; + \sin(\pi/4) e^{-i\pi/4} \left| 1\right&amp;gt;\right)&#xA;=&#xA;C\left(\cos(\theta/2)\left| 0 \right&amp;gt; + \sin(\theta/2) e^{i\phi} \left| 1\right&amp;gt;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$\theta = \pi/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi=-\pi/4$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9545" LastEditorUserId="542" LastEditDate="2020-01-04T05:29:56.797" LastActivityDate="2020-01-04T05:29:56.797" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9406" PostTypeId="1" AcceptedAnswerId="9407" CreationDate="2020-01-03T22:54:43.927" Score="3" ViewCount="73" Body="&lt;p&gt;I just learned from the existence of the theoretical &lt;a href=&quot;https://en.wikipedia.org/wiki/Lieb-Robinson_bounds&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lieb-Robinson bound&lt;/a&gt;, 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;nofollow noreferrer&quot;&gt;BB84&lt;/a&gt; (quantum key distribution)?&lt;/p&gt;&#xA;" OwnerUserId="5324" LastEditorUserId="55" LastEditDate="2020-11-11T21:37:30.450" LastActivityDate="2020-11-11T21:37:30.450" Title="Does the Lieb-Robinson bound constrain the speed of entanglement information transmission?" Tags="&lt;communication&gt;&lt;bb84&gt;&lt;faster-than-light&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9407" PostTypeId="2" ParentId="9406" CreationDate="2020-01-04T07:18:00.220" Score="4" Body="&lt;p&gt;Entanglement does not transmit information, as follows from the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-communication_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;No-communication theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-01-04T07:18:00.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9408" PostTypeId="1" CreationDate="2020-01-04T08:23:12.853" Score="6" ViewCount="157" Body="&lt;p&gt;When you enter the field of quantum communications, you run at some point into the concept of superdense coding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there is no real benefit - if you need to send two photons, you can encode two bits classically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://math.stackexchange.com/q/3494458/173147&quot;&gt;Cross-posted on math.SE&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9704" LastEditorUserId="55" LastEditDate="2020-11-11T21:37:11.463" LastActivityDate="2020-11-12T06:42:29.630" Title="What is the practical interest of superdense coding?" Tags="&lt;communication&gt;&lt;superdense-coding&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9409" PostTypeId="1" CreationDate="2020-01-04T09:37:10.540" Score="3" ViewCount="48" Body="&lt;p&gt;Can the state of a qubit affect its energy? Please elaborate on your answer&lt;/p&gt;&#xA;" OwnerUserId="9707" LastActivityDate="2020-01-06T08:11:12.567" Title="Does the energy of a qubit change when it undergoes a collapse?" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9410" PostTypeId="1" CreationDate="2020-01-04T10:26:10.727" Score="-3" ViewCount="113" Body="&lt;p&gt;I need to find the coordinate  and ϕ values of the quantum state on the bloch sphere&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{1+i}{\sqrt{3}} \left| 0 \right&amp;gt; + {\sqrt{\frac{1}{3}}} \left| 1\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-11-10T17:35:47.610" LastActivityDate="2020-11-10T17:35:47.610" Title="what are the angles , and ϕ values of the following quantum state?" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-01-06T18:00:23.037" ContentLicense="CC BY-SA 4.0" />
  <row Id="9411" PostTypeId="2" ParentId="9410" CreationDate="2020-01-04T11:05:05.377" Score="2" Body="&lt;p&gt;You have normalized state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\alpha|0\rangle + \beta|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, write the state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\frac{\alpha}{|\alpha|}\left({|\alpha|}|0\rangle + \frac{\beta|\alpha|}{\alpha}|1\rangle\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The factor &lt;span class=&quot;math-container&quot;&gt;$$\frac{\alpha}{|\alpha|}$$&lt;/span&gt; is a global phase and not important. Now you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\cos{\frac{\theta}{2}}=|\alpha|$$&lt;/span&gt;&#xA;which gives the value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sin{\frac{\theta}{2}}e^{i\phi}=\frac{\beta|\alpha|}{\alpha}$$&lt;/span&gt;&#xA;which gives the value of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-01-04T11:05:05.377" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9412" PostTypeId="2" ParentId="9408" CreationDate="2020-01-04T12:26:25.387" Score="6" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; prior to actual communication.&lt;br&gt;&#xA;Even if it's you who generate the entangled pair and share the entangled photon &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; you could do it way before the time when you need to send the second photon that carry the actual information. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-01-04T12:54:58.197" LastActivityDate="2020-01-04T12:54:58.197" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9413" PostTypeId="1" AcceptedAnswerId="9450" CreationDate="2020-01-04T12:54:40.760" Score="4" ViewCount="501" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found some proposals how to implement qRAM, e.g. &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But my understanding is that the device is highly experimental nowadays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my questions are those:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does anybody know about progress in this field? Some links to articles of state-of-art implementation of qRAM will be highly appreciated.&lt;/li&gt;&#xA;&lt;li&gt;What about IBM Q? Do we have an opportunity to use qRAM on IBM Q computer in foreseeable future (i.e. few years)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2020-01-09T02:22:07.900" LastActivityDate="2020-01-09T02:22:07.900" Title="What is the state of the art on Quantum Random Access Memories?" Tags="&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;architecture&gt;&lt;research&gt;&lt;quantum-memory&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-01-09T13:33:07.593" ContentLicense="CC BY-SA 4.0" />
  <row Id="9414" PostTypeId="1" CreationDate="2020-01-04T13:03:02.747" Score="0" ViewCount="117" Body="&lt;p&gt;If we measure the first qubit and obtain &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, what does the second qubit collapses to?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{1}{\sqrt{2}} \left| 00 \right&amp;gt; + {\frac{i}{2}} \left| 01\right&amp;gt; - {\frac{1}{2}} \left| 11\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-11-10T17:36:25.307" LastActivityDate="2020-11-10T17:36:25.307" Title="Qubit measurement of the state $\frac{1}{\sqrt2}|00\rangle+\frac{i}{2}|01\rangle-\frac{1}{2}|11\rangle$" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9415" PostTypeId="2" ParentId="9243" CreationDate="2020-01-04T13:21:30.040" Score="0" Body="&lt;p&gt;Probably i found an additional solution:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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)}$$&lt;/span&gt;&#xA;where we put the calculation basis through &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the last exponent  express the rotation on the Bloch sphere around vector &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{1-\alpha^2},0,\alpha)$&lt;/span&gt;.&#xA;It means that Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; express the same rotation on the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On other hand &#xA;&lt;span class=&quot;math-container&quot;&gt;$$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)}$$&lt;/span&gt;&#xA;where we see rotation around the same vector &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{1-\alpha^2},0,\alpha)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means that Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be simulated by using &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; can be simulated by using products of terms such as &lt;span class=&quot;math-container&quot;&gt;$e^{i\delta|x\rangle\langle x|}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\delta|\psi\rangle\langle \psi|}$&lt;/span&gt; (see Nielsen and Chuang Textbook p258)&lt;/p&gt;&#xA;" OwnerUserId="9545" LastActivityDate="2020-01-04T13:21:30.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9416" PostTypeId="2" ParentId="9352" CreationDate="2020-01-04T14:35:10.870" Score="3" Body="&lt;p&gt;Here is the solution. The trick is to use &quot;the only connectivity matters&quot; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/O8Rm2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O8Rm2.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2832" LastActivityDate="2020-01-04T14:35:10.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9417" PostTypeId="2" ParentId="9414" CreationDate="2020-01-04T15:32:29.010" Score="2" Body="&lt;p&gt;If first qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; there is no other possibility than second qubit to be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as well since probability of state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; is zero. Hence probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in second qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In case first qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; there are two possibe results: &#xA;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;. Since probability of state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; and probability of state &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;, conditional probabilities that second qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt; and that it is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;This is about probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in computational basis, regarding quantum state of second qubit before its measurement, please refer to Shai Dashe comment:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Hint: note that &lt;span class=&quot;math-container&quot;&gt;$|\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-04T15:41:29.627" LastActivityDate="2020-01-04T15:41:29.627" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9418" PostTypeId="1" CreationDate="2020-01-04T15:39:05.720" Score="6" ViewCount="313" Body="&lt;p&gt;In Nielsens and Chuangs book, they present a way to implement a reversible version of any classical algorithm (section 3.2.5).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, they use Fredkin and other simple reversible gates to implement a circuit doing &lt;span class=&quot;math-container&quot;&gt;$(x, 0, 0, y) \rightarrow (x, f(x), g(x), y)$&lt;/span&gt; by first copying &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to the second register and then using the Fredkin gate equivalent of the classical algorithm to take the second register (now &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;) and the ancilla bits in the third register to &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; and some garbage &lt;span class=&quot;math-container&quot;&gt;$g(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then they use &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates to add &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; to the last register, resulting in &lt;span class=&quot;math-container&quot;&gt;$(x, f(x), g(x), y \oplus f(x))$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that it is now important to uncompute the &lt;span class=&quot;math-container&quot;&gt;$g(x)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$(x, 0, 0, y\oplus f(x))$&lt;/span&gt; using the inverse of the Fredkin gate implementation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am wondering if the following would also work:&#xA;Take &lt;span class=&quot;math-container&quot;&gt;$(x,0,y)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(f(x), g(x), y)$&lt;/span&gt; using the Fredkin equivalent of the classical algorithm. Then use &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates to go to &lt;span class=&quot;math-container&quot;&gt;$(f(x),g(x),y\oplus f(x))$&lt;/span&gt; and then do the uncomputation step as before to get &lt;span class=&quot;math-container&quot;&gt;$(x, 0, y\oplus f(x))$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9450" LastEditorUserId="2105" LastEditDate="2020-01-04T19:11:33.530" LastActivityDate="2020-01-04T19:51:35.100" Title="Uncomputation in quantum implementation of a classical algorithm" Tags="&lt;circuit-construction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9419" PostTypeId="2" ParentId="9418" CreationDate="2020-01-04T19:06:34.920" Score="5" Body="&lt;p&gt;Nielsen and Chuang book may be confusing; I will try to explain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any classical algorithm can be presented as a circuit consisting of &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$AND$&lt;/span&gt; gates; this means that if we can make quantum gates computing &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$AND$&lt;/span&gt;, and make fanout, we can run any classical algorithm on quantum computer. &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; is reversible and we have quantum &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; gate; many quantum gates can serve as fanout; the only problem is &lt;span class=&quot;math-container&quot;&gt;$AND$&lt;/span&gt; because it is irreversible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Figure 3.16 in the book shows how configure Fredkin (CSWAP) gate for computing &lt;span class=&quot;math-container&quot;&gt;$AND$&lt;/span&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pjAgq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pjAgq.png&quot; alt=&quot;and&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see that we have computed garbage function &lt;span class=&quot;math-container&quot;&gt;$g(x,y)=\bar{x}y$&lt;/span&gt; and we must uncompute it. Note that &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; here have no relation to &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; ancilla that will be used later in the chapter; it is better to denote here &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt;, and think of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as of 2 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To uncompute &lt;span class=&quot;math-container&quot;&gt;$g(x_1,x_2)=\bar{x}_1x_2$&lt;/span&gt; we need one more qubit denoted by &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in the book; usually it is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; qubit; using &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; with qubit &lt;span class=&quot;math-container&quot;&gt;$f(x)=x_1x_2$&lt;/span&gt; as a control qubit we map &lt;span class=&quot;math-container&quot;&gt;$y\rightarrow y\oplus f(x)$&lt;/span&gt; and apply second Fredkin gate (which is self-reversed) to obtain&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;on input: &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;on output:&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y\oplus f(x)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and we are done, and we used &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits to do the job.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;PS: If you want to understand things better:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=R2hyQhjHxrs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=R2hyQhjHxrs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=5hLpvy6Mja0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=5hLpvy6Mja0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-01-04T19:51:35.100" LastActivityDate="2020-01-04T19:51:35.100" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9420" PostTypeId="2" ParentId="9409" CreationDate="2020-01-05T06:45:01.970" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, assume we have a qubit with a Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=E|1\rangle\langle 1|.&#xA;$$&lt;/span&gt;&#xA;For any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, we have an average energy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bar E=\langle\psi|H|\psi\rangle=E|\beta|^2.&#xA;$$&lt;/span&gt;&#xA;If we measure this qubit in the standard, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, we get:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;answer &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;. Afterwards, the system is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and has energy 0.&lt;/li&gt;&#xA;&lt;li&gt;answer &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;. Afterwards, the system is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and has energy &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So, you can see that the average energy is &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2\times 0+|\beta|^2\times E=E|\beta|^2$&lt;/span&gt;, which is unchanged from the original state. Sometimes you gain energy, sometimes you lose energy, but on average it stays the same.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-01-06T08:11:12.567" LastActivityDate="2020-01-06T08:11:12.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9421" PostTypeId="1" CreationDate="2020-01-05T09:38:42.050" Score="5" ViewCount="239" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9714" LastEditorUserId="55" LastEditDate="2020-01-10T15:27:57.667" LastActivityDate="2020-01-10T15:27:57.667" Title="How to implement the CCH gate in quantum computers available in clouds?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9425" PostTypeId="1" CreationDate="2020-01-05T15:15:19.530" Score="2" ViewCount="205" Body="&lt;p&gt;I want to compute the POVM &lt;span class=&quot;math-container&quot;&gt;$E_{(\theta, \phi)}$&lt;/span&gt; of the measure which gives the probability of a qubit state lying over the surface of Bloch sphere, with angles &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi$&lt;/span&gt;. How can I handle this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Dividing the surface area through the volume of Bloch sphere seems not to be a solution because it gives and absurd result of 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I start?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;_____EDIT____________&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For clarification, I will write down the full statement of the problem:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Find the POVM &lt;span class=&quot;math-container&quot;&gt;$E_{(\theta, \phi)}$&lt;/span&gt;  of the measure which determines the probability that the state of a qubit is on the surface of the Bloch sphere with polar angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and azimuthal &lt;span class=&quot;math-container&quot;&gt;$\phi,$&lt;/span&gt; the relation of completeness being fulfilled in this case:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$\int d^{2} \Omega E_{(\theta, \phi)}=\mathbb{I}$$&lt;/span&gt;&#xA;  Is that a projective measure? Prove also that:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$p(\theta, \phi)=\operatorname{Tr}\left[E_{(\theta, \phi)} \rho\right]=\frac{1}{4 \pi}(1+\boldsymbol{r} \cdot \boldsymbol{\Omega})$$&lt;/span&gt;&#xA;  with &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; being the state's Bloch vector and &lt;span class=&quot;math-container&quot;&gt;$\Omega=(\sin \theta \cos \phi, \sin \theta \sin \phi, \cos \theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Explain why the only determination of the maximum of &lt;span class=&quot;math-container&quot;&gt;$p(\theta, \phi)$&lt;/span&gt; allows tomography the state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was trying to use the pure state &lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{2}\left( \mathbb{I}+\vec{\Omega } \cdot \vec{\sigma} \right)$&lt;/span&gt; as a operator measure for the mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho '$&lt;/span&gt; but can't obtain the factor &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4\pi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this update clears up your doubts&lt;/p&gt;&#xA;" OwnerUserId="9716" LastEditorUserId="9716" LastEditDate="2020-01-06T09:54:31.780" LastActivityDate="2020-06-04T11:01:55.237" Title="What is the probability of a single qubit state lying over the surface of Bloch sphere?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9427" PostTypeId="2" ParentId="9246" CreationDate="2020-01-05T19:38:04.153" Score="1" Body="&lt;p&gt;3 things I see from your implementation of inverse QFT:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;SWAP gates are missing prior to applying Hadamard gates and cu1 gates.&lt;/li&gt;&#xA;&lt;li&gt;The Hadamard gate should come first before cu1 gates.&lt;/li&gt;&#xA;&lt;li&gt;The angles of cu1 gates, how I understand inverse QFT, should be different.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Here is inverse QFT that worked for me with not touching other parts of the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def qft_dagger(circ, q, n):&#xA;    &quot;&quot;&quot;n-qubit inverse QFT on q in circ.&quot;&quot;&quot;&#xA;    # SWAP gates&#xA;    for i in range(n//2):&#xA;        circ.swap(q[i], q[n - i - 1])&#xA;&#xA;    for i in reversed(range(n)):&#xA;        circ.h(q[i])&#xA;        for m in reversed(range(i)):&#xA;            circ.cu1(-2*np.pi/2**(i - m + 1), q[i], q[m])&#xA;        circ.barrier()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For 0.75 I obtained: 011,&#xA;    0.875: 111,&#xA;    0.5: 001,&#xA;    0.25: 010.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info see Figure 5.1. from the M.A. Nielsen and I.L. Chuang's &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;book&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YRAfM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YRAfM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shows the circuit for QFT without SWAP gates. From the book &quot;Not shown are swap gates at the end of the circuit which reverse the order of the qubits&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse QFT should be the same gates but in reversed order with their daggered versions. Note that &lt;span class=&quot;math-container&quot;&gt;$H^{\dagger} = H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$u1^{\dagger} (\lambda) = u1(-\lambda)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt; in the book corresponds to &lt;span class=&quot;math-container&quot;&gt;$R_k = u1(2 \pi / 2^{k})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-01-07T08:49:41.717" LastActivityDate="2020-01-07T08:49:41.717" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9428" PostTypeId="1" CreationDate="2020-01-05T21:16:11.803" Score="2" ViewCount="185" Body="&lt;p&gt;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(&lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/&lt;/a&gt;) 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://quantumexperience.ng.bluemix.net/api/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumexperience.ng.bluemix.net/api/&lt;/a&gt; to &lt;a href=&quot;https://api.quantum-computing.ibm.com/api&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://api.quantum-computing.ibm.com/api&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9713" LastActivityDate="2020-06-21T09:26:33.953" Title="IBM Quantum Experience API Without QISKit" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9429" PostTypeId="2" ParentId="9428" CreationDate="2020-01-06T00:33:24.783" Score="1" Body="&lt;p&gt;So Qiskit (qiskit.org) already does everything you are looking for. If you need to access the API directly then the IBMQ account connector (&lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ibmq-provider&lt;/a&gt;) is a good starting point in lieu of formal documentation. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-01-06T00:33:24.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9430" PostTypeId="2" ParentId="9425" CreationDate="2020-01-06T04:48:31.927" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, but not both.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many measurements along different axes will give you full information about the qubit, but that involves more than one POVM. Look up &quot;state tomography&quot;.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2020-01-06T04:48:31.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9431" PostTypeId="1" AcceptedAnswerId="9446" CreationDate="2020-01-06T06:09:42.553" Score="3" ViewCount="158" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9720" LastEditorUserId="26" LastEditDate="2020-01-07T12:57:24.653" LastActivityDate="2020-01-20T04:55:08.083" Title="What is the best way to get into and learn quantum computing for a 14 year old?" Tags="&lt;resource-request&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9432" PostTypeId="1" AcceptedAnswerId="9438" CreationDate="2020-01-06T06:46:10.457" Score="3" ViewCount="561" Body="&lt;p&gt;To implement a stabilizer code I need to measure stabilizer generators, as shown in Fig. 10.16 in Nielsen &amp;amp; Chuang. Is there a way for controlled multiqubit gates in qiskit?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8AeHx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8AeHx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="1859" LastEditDate="2020-09-19T09:44:25.633" LastActivityDate="2020-09-19T17:48:46.863" Title="How to implement controlled multiqubit gates in qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9433" PostTypeId="2" ParentId="9421" CreationDate="2020-01-06T07:47:47.107" Score="5" Body="&lt;p&gt;Assuming you've got Toffoli and single-qubit rotations, you can implement the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Oka7n.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oka7n.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This basically works because if either of the controls is not &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the Toffoli does nothing and the two single-qubit unitaries cancel each other. Whereas, if both controls are &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, then the net gate on the target qubit is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-06T07:47:47.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9435" PostTypeId="2" ParentId="9425" CreationDate="2020-01-06T10:48:53.913" Score="1" Body="&lt;p&gt;I find the wording and notation of the question you've been given a bit odd. I &lt;em&gt;think&lt;/em&gt; you've taken the correct strategy, and the factor of &lt;span class=&quot;math-container&quot;&gt;$4\pi$&lt;/span&gt; in the question doesn't make any sense to me either. I guess it should just be a 2.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-06T10:48:53.913" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9436" PostTypeId="1" AcceptedAnswerId="9437" CreationDate="2020-01-06T10:58:22.587" Score="2" ViewCount="44" Body="&lt;p&gt;A generalized measurement can be defined as follow:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a set of operators &lt;span class=&quot;math-container&quot;&gt;$\{M_m \}$&lt;/span&gt; such that, given an initial quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, we have the state after measurement being:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle \rightarrow \frac{M_m |\psi\rangle}{\langle \psi | M_m^{\dagger}M_m |\psi\rangle} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability to find the outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is: &lt;span class=&quot;math-container&quot;&gt;$p(m)=\langle \psi | M_m^{\dagger}M_m |\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U |\psi \rangle |0 \rangle = \sum_m M_m |\psi \rangle |m \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: how to prove that this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is indeed a unitary ? I guess we also have to define its action on other states than &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the ancillary system, but how to do it ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2020-01-10T15:44:20.340" Title="Generalized measurement interpreted as entanglement unitary + measurement. Why is it indeed a unitary?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9437" PostTypeId="2" ParentId="9436" CreationDate="2020-01-06T11:07:58.243" Score="2" Body="&lt;p&gt;It is not necessary to define the action of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;The right-hand side simplifies to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_m\langle\psi|M_m^\dagger M_m|\phi\rangle=\langle\psi|\phi\rangle&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-06T11:07:58.243" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9438" PostTypeId="2" ParentId="9432" CreationDate="2020-01-06T13:37:29.280" Score="3" Body="&lt;h2&gt;A general controlled unitary&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$CU$&lt;/span&gt; denote the 'controlled' version of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CU = |0\rangle\langle0|\otimes I_{t} + |1\rangle\langle1|\otimes U_{t},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the operation acts on a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{c}\otimes \mathcal{H}_{t}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; denoting the control qubit and &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; denoting the target qubits (in your case, the data qubits). I have added a subscript &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; in the equation as well to indicate this subsystem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally, to implement &lt;span class=&quot;math-container&quot;&gt;$CU$&lt;/span&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8862/how-to-decompose-this-two-qubit-unitary-matrix-to-the-standard-gate-set/8863#8863&quot;&gt;this previous question&lt;/a&gt; or the &lt;a href=&quot;https://arxiv.org/pdf/1501.06911.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper referred to&lt;/a&gt; in an answer there.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Shortcut for stabilizer readout&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;However, there is a shortcut for the unitary you describe: we can write &lt;span class=&quot;math-container&quot;&gt;$U = U_{i}^{\otimes n}$&lt;/span&gt;, where each &lt;span class=&quot;math-container&quot;&gt;$U_{i}$&lt;/span&gt; is a single-qubit unitary (In your case, all &lt;span class=&quot;math-container&quot;&gt;$U_{i}$&lt;/span&gt; are either &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;); we can always write the unitary like this when concerning stabilizer codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can rewrite &lt;span class=&quot;math-container&quot;&gt;$CU$&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CU = \prod_{i \in n}|0\rangle\langle 0| \otimes I_{i} + |1\rangle\langle 1| \otimes U_{i}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is to say, we can replace the entire multi-qubit controlled unitary by the succession of controlled version of all individual &lt;span class=&quot;math-container&quot;&gt;$U_{i}$&lt;/span&gt;'s.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That means for you that you can apply a controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;) operation to every different data qubit, from your ancilla. Of course the controlled &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operation need not be actually performed.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Implementation on physical hardware&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A planar implementation of the Steane code can be found in the picture in box 1 on page 3 of &lt;a href=&quot;https://arxiv.org/pdf/1612.07330.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;; each of the &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; faces is a stabilizer (e.g. an ancilla qubit), so the drawn vertices are in fact not actual connections between qubits.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Sidenote on implementing stabilizer error correction on current-gen hardware&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-01-10T15:51:18.837" LastActivityDate="2020-01-10T15:51:18.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9439" PostTypeId="1" CreationDate="2020-01-06T14:04:22.253" Score="5" ViewCount="131" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}$&lt;/span&gt; gates. As we know, the increase of the number of operations brings errors. How can this procedure then decrease the overall error rate?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="26" LastEditDate="2020-01-06T16:30:59.833" LastActivityDate="2020-01-06T16:30:59.833" Title="Why does quantum error correction work?" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9440" PostTypeId="2" ParentId="9439" CreationDate="2020-01-06T14:13:28.513" Score="5" Body="&lt;p&gt;Quantum error correction concerns errors that happen on qubits; it does not provide any protection against errors in operations on those qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;strong&gt;This is indeed a very though issue.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer is, in short, what is collectively known as &lt;em&gt;fault-tolerance&lt;/em&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It has been proven that, taking enough precaution, one can correct errors quicker than they arise: &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;noreferrer&quot;&gt;The threshold theorem&lt;/a&gt;. 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 &lt;a href=&quot;https://arxiv.org/abs/0904.2557&quot; rel=&quot;noreferrer&quot;&gt;the introduction by Gottesman&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-01-06T14:13:28.513" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9441" PostTypeId="2" ParentId="9439" CreationDate="2020-01-06T15:37:03.597" Score="-5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9414" LastActivityDate="2020-01-06T15:37:03.597" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9442" PostTypeId="1" AcceptedAnswerId="9464" CreationDate="2020-01-06T16:37:55.963" Score="4" ViewCount="172" Body="&lt;p&gt;I am reading  &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1208/1208.0928.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fowler et al's paper on the surface code.&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|{0}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|{1}\rangle$&lt;/span&gt;, but not how to initialize in an arbitrary superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Appendix B he shows that after the measurements in the circuit below, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/O6nsx.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O6nsx.jpg&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the middle two qubits are in the one of the following four states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eMhSS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eMhSS.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&#xA;Can they also be in a superposition of one of these states?&lt;/p&gt;&#xA;" OwnerUserId="9282" LastEditorUserId="9282" LastEditDate="2020-01-06T17:38:15.703" LastActivityDate="2020-01-09T01:35:15.390" Title="Logical qubit initialization for the surface code" Tags="&lt;error-correction&gt;&lt;surface-code&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9443" PostTypeId="1" AcceptedAnswerId="9453" CreationDate="2020-01-06T16:43:37.830" Score="3" ViewCount="206" Body="&lt;p&gt;I know the definition of projective measurement, generalized measurement, POVM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the usage of generalized measurement for the reason that it can model experiments &quot;easier&quot; (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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &amp;amp; projective measurement.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Would you agree with me if I say that POVM is just an &lt;strong&gt;axiomatic&lt;/strong&gt; way to define statistics of measurement. There is nothing much to understand/overthink.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the sense, we ask the minimal mathematical properties that our measurement operator must fullfil with respect to statistical behavior which is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;they are semidefinite positive (to have positive probabilities)&lt;/li&gt;&#xA;&lt;li&gt;they sum up to identity (to have probability summing up to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;and we relate our measurement operator with the physics: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(m)=\mathrm{Tr}(E_m \rho)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the outcome, &lt;span class=&quot;math-container&quot;&gt;$E_m$&lt;/span&gt; the associated POVM.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-08-22T07:57:08.477" LastActivityDate="2020-08-22T07:57:08.477" Title="Why are POVMs useful? Are they just an axiomatic way to define measurement?" Tags="&lt;measurement&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9444" PostTypeId="1" AcceptedAnswerId="9447" CreationDate="2020-01-06T17:12:42.747" Score="5" ViewCount="204" Body="&lt;p&gt;With reference to question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9421/ways-to-implement-cch-gate&quot;&gt;how to implement CCH gate&lt;/a&gt; I easily realized that CH gate can be implemented with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}$&lt;/span&gt; gates and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; followingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yO3M9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yO3M9.png&quot; alt=&quot;My circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{4}$&lt;/span&gt; for first &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gate and &lt;span class=&quot;math-container&quot;&gt;$\theta = -\frac{\pi}{4}$&lt;/span&gt; for second one.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I put &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CH}$&lt;/span&gt; gate implemented on IBM Q to circuit, a transpiled circuit has this form:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xmO9V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xmO9V.png&quot; alt=&quot;Transpiled circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; gate with respective parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems to me that the second circuit is unnecessary complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any reason why to implement &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CH}$&lt;/span&gt; gate in such way or am I missing something?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2020-01-07T19:07:12.913" LastActivityDate="2020-01-11T13:43:28.707" Title="Why is implementation of controlled Hadamard on IBM Q so complex?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9445" PostTypeId="2" ParentId="9442" CreationDate="2020-01-06T17:36:30.193" Score="1" Body="&lt;p&gt;You can initialize a qubit to any arbitrary state by gate &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; (abbreviation used on IBM Q):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3(\theta,\phi,\lambda)=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda} \sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\lambda+\phi)} \cos(\theta/2) &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible to prepare any multi-qubit quantum state by a method described in this paper: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of Quantum States Using Uniformly Controlled Rotations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, the arbitrary states is probably that generated by Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Regarding measurement in your circuit:&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-06T17:36:30.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9446" PostTypeId="2" ParentId="9431" CreationDate="2020-01-06T17:44:51.650" Score="4" Body="&lt;p&gt;I would recommend getting started by looking at the &lt;a href=&quot;https://qiskit.org/education/&quot; rel=&quot;noreferrer&quot;&gt;Qiskit website&lt;/a&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.youtube.com/results?search_query=quantum+computing+explained&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-01-06T17:44:51.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9447" PostTypeId="2" ParentId="9444" CreationDate="2020-01-06T19:04:25.950" Score="4" Body="&lt;p&gt;Summarization based on discussion with user &lt;em&gt;met927&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Transpiled circuit form depends on used backend - it is different for simulator and real quantum processor:&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On simulator, the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CH}$&lt;/span&gt; gate is transpiled to the circuit shown above&lt;/li&gt;&#xA;&lt;li&gt;On real quantum processor, the gate is implemented with two &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U2}$&lt;/span&gt; gates and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; (i.e. like in the first figure in the answer)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overall, the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CH}$&lt;/span&gt; gate implementation on IBM Quantum is efficient.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-01-11T13:43:28.707" LastActivityDate="2020-01-11T13:43:28.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9448" PostTypeId="2" ParentId="9370" CreationDate="2020-01-06T23:00:15.940" Score="1" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x\cdot y}$&lt;/span&gt; terms come from the matrix elements of &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this, start from considering the matrix elements of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. You can check that they can be written as &lt;span class=&quot;math-container&quot;&gt;$H_{ij}=(-1)^{ij}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$i,j\in\{0,1\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix elements of &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; are indexed by &lt;em&gt;tuples&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; binary numbers, that is, writing &lt;span class=&quot;math-container&quot;&gt;$I\equiv (i_1,...,i_n), J\equiv(j_1,...,j_n)$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(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},$$&lt;/span&gt;&#xA;where in the last step we used the same notation as in the OP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I'm ignoring the normalisation factors here, so just add back the &lt;span class=&quot;math-container&quot;&gt;$1/2^{n/2}$&lt;/span&gt; factors around as needed.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-06T23:00:15.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9449" PostTypeId="1" CreationDate="2020-01-07T03:11:11.477" Score="3" ViewCount="190" Body="&lt;p&gt;Sorry that I keep asking questions for the same subject. It is driving me crazy.&lt;/p&gt;&#xA;&lt;p&gt;I have followed the [5,1,3] stabilizer code circuit designed by &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9705052.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman&lt;/a&gt; in page 35 in his paper (also illustrated in my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9175/quantum-circuit-for-a-three-qubit-bit-flip-code&quot;&gt;another question&lt;/a&gt;). This code has four stabilizer generators &lt;span class=&quot;math-container&quot;&gt;$XZZXI$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$IXZZX$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$XIXZZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZXIXZ$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The following is a minimal working example in which I only draw the stabilizer generator &lt;span class=&quot;math-container&quot;&gt;$IXZZX$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;&#xA;encoded = QuantumRegister(5,'encoded')&#xA;stab = QuantumRegister(4,'stab')&#xA;syndr = ClassicalRegister(4, 'syndr')&#xA;five = QuantumCircuit(encoded)&#xA;fiveS = QuantumCircuit(encoded, stab, syndr)&#xA;&#xA;#----------------------------------encode----------------------------------&#xA;five.h(encoded[0])&#xA;five.h(encoded[1])&#xA;five.h(encoded[2])&#xA;five.h(encoded[3])&#xA;&#xA;&#xA;five.z(encoded[0])&#xA;five.z(encoded[3])&#xA;&#xA;five.cz(encoded[0],encoded[1])&#xA;five.cz(encoded[0],encoded[3])&#xA;five.cy(encoded[0],encoded[4])&#xA;&#xA;five.cz(encoded[1],encoded[2])&#xA;five.cz(encoded[1],encoded[3])&#xA;five.cx(encoded[1],encoded[4])&#xA;&#xA;five.cz(encoded[2],encoded[0])&#xA;five.cz(encoded[2],encoded[1])&#xA;five.cx(encoded[2],encoded[4])&#xA;&#xA;five.cz(encoded[3],encoded[0])&#xA;five.cz(encoded[3],encoded[2])&#xA;five.cy(encoded[3],encoded[4])&#xA;&#xA;five.barrier()&#xA;&#xA;#-------------------stabilizer generator IXZZX------------------------------&#xA;fiveS.h(stab[1])&#xA;fiveS.cx(stab[1],encoded[1])&#xA;fiveS.cz(stab[1],encoded[2])&#xA;fiveS.cz(stab[1],encoded[3])&#xA;fiveS.cx(stab[1],encoded[4])&#xA;fiveS.h(stab[1])&#xA;&#xA;fiveS.measure(stab,syndr)&#xA;&#xA;#----------------circuit visualization--------------------&#xA;#%matplotlib inline&#xA;#(five+fiveS).draw(output='mpl')&#xA;&#xA;counts = execute( five+fiveS, Aer.get_backend('qasm_simulator'), shots=10000).result().get_counts()&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Measuring stabilizer generators should return &lt;span class=&quot;math-container&quot;&gt;$0000$&lt;/span&gt; but instead I get half &lt;span class=&quot;math-container&quot;&gt;$0000$&lt;/span&gt; and half &lt;span class=&quot;math-container&quot;&gt;$0010$&lt;/span&gt; (Same results returns when measuring &lt;span class=&quot;math-container&quot;&gt;$XIXZZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZXIXZ$&lt;/span&gt;). Where am I wrong?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Question updated&lt;/h2&gt;&#xA;&lt;p&gt;I tried to add all qubits in one quantum register and produce one quantum circuit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;&#xA;stab = QuantumRegister(9,'stab')&#xA;syndr = ClassicalRegister(4, 'syndr')&#xA;five = QuantumCircuit(stab, syndr)&#xA;&#xA;#----------------------------------encode----------------------------------&#xA;five.h(stab[0])&#xA;five.h(stab[1])&#xA;five.h(stab[2])&#xA;five.h(stab[3])&#xA;&#xA;&#xA;five.z(stab[0])&#xA;five.z(stab[3])&#xA;&#xA;five.cz(stab[0],stab[1])&#xA;five.cz(stab[0],stab[3])&#xA;five.cy(stab[0],stab[4])&#xA;&#xA;five.cz(stab[1],stab[2])&#xA;five.cz(stab[1],stab[3])&#xA;five.cx(stab[1],stab[4])&#xA;&#xA;five.cz(stab[2],stab[0])&#xA;five.cz(stab[2],stab[1])&#xA;five.cx(stab[2],stab[4])&#xA;&#xA;five.cz(stab[3],stab[0])&#xA;five.cz(stab[3],stab[2])&#xA;five.cy(stab[3],stab[4])&#xA;&#xA;five.barrier()&#xA;&#xA;#-------------------stabilizer generator IXZZX------------------------------&#xA;five.h(stab[6])&#xA;five.cx(stab[6],stab[1])&#xA;five.cz(stab[6],stab[2])&#xA;five.cz(stab[6],stab[3])&#xA;five.cx(stab[6],stab[4])&#xA;five.h(stab[6])&#xA;&#xA;five.measure(stab[5],syndr[0])&#xA;five.measure(stab[6],syndr[1])&#xA;five.measure(stab[7],syndr[2])&#xA;five.measure(stab[8],syndr[3])&#xA;&#xA;#----------------circuit visualization--------------------&#xA;#%matplotlib inline&#xA;#five.draw(output='mpl')&#xA;&#xA;counts = execute( five, Aer.get_backend('qasm_simulator'), shots=10000).result().get_counts()&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, the same happens. The following are my running results.&lt;a href=&quot;https://i.stack.imgur.com/USDku.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/USDku.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-10-11T21:38:55.233" Title="Simulation for the [5,1,3] stabilizer code in Qiskit" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9450" PostTypeId="2" ParentId="9413" CreationDate="2020-01-07T05:44:49.587" Score="3" Body="&lt;p&gt;According to comment provided by user &lt;em&gt;gIS&lt;/em&gt;, there was no progress in implementing qRAM as proposed in &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;the paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, some additional information on qRAM physical implementation can be found on this forum &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1195/state-of-the-art-in-quantum-memory?rq=1&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="26" LastEditDate="2020-01-09T02:21:37.987" LastActivityDate="2020-01-09T02:21:37.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9452" PostTypeId="2" ParentId="9337" CreationDate="2020-01-07T07:39:06.593" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;First of all, are the ancilla qubits entangled with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, depending on what the state is. Let's say you started with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha|000\rangle+\beta|111\rangle,&#xA;$$&lt;/span&gt;&#xA;but it has experienced an error of &lt;span class=&quot;math-container&quot;&gt;$(\cos\theta I+i\sin\theta X)$&lt;/span&gt; on the first qubit. So, your state becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta(\alpha|000\rangle+\beta|111\rangle)+i\sin\theta(\alpha|100\rangle+\beta|011\rangle).&#xA;$$&lt;/span&gt;&#xA;When you perform syndrome extraction, you'll get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta(\alpha|000\rangle+\beta|111\rangle)|00\rangle+i\sin\theta(\alpha|100\rangle+\beta|011\rangle)|11\rangle.&#xA;$$&lt;/span&gt;&#xA;This state has entanglement between the computational qubits register and the ancilla register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;How can I perform such operation using a matrix?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As for what the matrix &lt;em&gt;is&lt;/em&gt;, I strongly recommend against performing such calculations. Once you're up to 5 qubits, you're talking a &lt;span class=&quot;math-container&quot;&gt;$32\times 32$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I calculated this in Mathematica using&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cNOT[i_, j_] := &#xA; IdentityMatrix[32] + &#xA;  KroneckerProduct[IdentityMatrix[2^(i - 1)], {{0, 0}, {0, 1}}, &#xA;   IdentityMatrix[2^(j - i - 1)], {{-1, 1}, {1, -1}}, &#xA;   IdentityMatrix[2^(5 - j)]]&#xA;TeXForm[cNOT[1, 4].cNOT[1, 5].cNOT[2, 4].cNOT[3, 5]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(the first 3 qubits are the system qubits, and qubits 4&amp;amp;5 are the ancillas) giving the answer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(&#xA;\begin{array}{cccccccccccccccccccccccccccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can then verify the calculation that I showed before:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;initial = {\[Alpha], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &#xA;   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \[Beta], 0, 0, 0};&#xA;witherror = &#xA; KroneckerProduct[{{Cos[\[Theta]], I Sin[\[Theta]]}, {I Sin[\[Theta]],&#xA;      Cos[\[Theta]]}}, IdentityMatrix[2^4]].initial&#xA;U.witherror&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-07T07:39:06.593" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9453" PostTypeId="2" ParentId="9443" CreationDate="2020-01-07T07:59:24.723" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; instead of having to calculate &lt;span class=&quot;math-container&quot;&gt;$M_i^\dagger M_i$&lt;/span&gt; first.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-07T07:59:24.723" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9454" PostTypeId="2" ParentId="9421" CreationDate="2020-01-07T09:30:38.700" Score="3" Body="&lt;p&gt;A brute force solution :). You can also obtain CCH via qiskit's basic gates with help of &lt;code&gt;get_controlled_circuit&lt;/code&gt; method.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit&#xA;&#xA;q_reg = QuantumRegister(3, 'q')&#xA;qc_h = QuantumCircuit(q_reg)&#xA;qc_ch = QuantumCircuit(q_reg)&#xA;qc_cch = QuantumCircuit(q_reg)&#xA;&#xA;qc_h.h(q_reg[0])&#xA;&#xA;qc_ch += get_controlled_circuit(qc_h, q_reg[1])&#xA;&#xA;qc_cch += get_controlled_circuit(qc_ch, q_reg[2])&#xA;&#xA;print(qc_cch.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that it may be not the optimal gate set for representing the &lt;span class=&quot;math-container&quot;&gt;$CCH$&lt;/span&gt; gate, because &lt;code&gt;get_controlled_circuit&lt;/code&gt;, how I understand, doesn't optimize the obtained gate set. Also, just info, &lt;span class=&quot;math-container&quot;&gt;$H = u2(0, \pi)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$u2$&lt;/span&gt; is one of the basis gates of qiskit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;u2(\phi, \lambda) = \frac{1}{\sqrt{2}} &#xA;\begin{pmatrix}&#xA;1 &amp;amp; -e^{i \lambda} \\&#xA;e^{i\phi} &amp;amp; e^{i(\phi + \lambda)}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-01-07T09:30:38.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9455" PostTypeId="1" AcceptedAnswerId="9460" CreationDate="2020-01-07T13:00:52.423" Score="3" ViewCount="120" Body="&lt;p&gt;I originally posted this question on the Physics StackExchange site (see here), but I realized it would be better suited on this one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm trying to understand the diagrams used in the following &lt;a href=&quot;https://arxiv.org/abs/1810.07207&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;. 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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If someone could also explain to me the relationship between the Figure 1 in the above paper and Figure 1 of &lt;a href=&quot;https://arxiv.org/abs/1208.0928&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, I think it would help makes things clearer.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2020-01-08T08:11:15.017" Title="Understanding surface code diagrams" Tags="&lt;error-correction&gt;&lt;surface-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9456" PostTypeId="1" CreationDate="2020-01-07T17:07:24.343" Score="1" ViewCount="39" Body="&lt;p&gt;The descriptions of the BICONF information reconciliation protocol in the literature appear to be inconsistent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, some descriptions (e.g. [2], [3]) explicitly say that Bob should &lt;em&gt;also&lt;/em&gt; run BINARY on the &lt;strong&gt;complementary&lt;/strong&gt; bits subset if the parity differs on the &lt;strong&gt;chosen&lt;/strong&gt; bits subset.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Should I or should I not &lt;em&gt;also&lt;/em&gt; run BINARY on the complementary bits subset? In other words, which of the two conflicting descriptions is correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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)?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;(*) = 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Tomohiro Sugimoto and Kouichi Yamazaki. A study on secret key reconciliation protocol &quot;cascade&quot;. IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences, E83-A(10), 2000.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] JesusMartinez-Mateo,ChristophPacher,MomtchilPeev,AlexCiurana,andVicenteMartin. Demystifying the Information Reconciliation Protocol Cascade. arXiv:1407.3257 [quant-ph], Jul 2014. &lt;a href=&quot;https://arxiv.org/pdf/1407.3257.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1407.3257.pdf&lt;/a&gt; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] André Reis. Quantum Key Distribution Post Processing - A study on the Information Reconciliation Cascade Protocol, July 2019. &lt;a href=&quot;https://repositorio-aberto.up.pt/bitstream/10216/121965/2/347567.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://repositorio-aberto.up.pt/bitstream/10216/121965/2/347567.pdf&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[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. &lt;a href=&quot;https://link.springer.com/content/pdf/10.1007%2F3-540-48285-7_35.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://link.springer.com/content/pdf/10.1007%2F3-540-48285-7_35.pdf&lt;/a&gt;   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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[5] Shengli Liu. Information-Theoretic Secret Key Agreement, Feb 2002. &lt;a href=&quot;https://pure.tue.nl/ws/files/1977072/200210541.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pure.tue.nl/ws/files/1977072/200210541.pdf&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="4733" LastEditorUserId="26" LastEditDate="2020-01-08T15:43:51.277" LastActivityDate="2020-01-08T15:43:51.277" Title="In the BICONF information reconciliation protocol for QKD: should I also run BINARY on the complementary bits subset?" Tags="&lt;cryptography&gt;&lt;key-distribution&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9457" PostTypeId="2" ParentId="9365" CreationDate="2020-01-07T17:24:26.990" Score="3" Body="&lt;p&gt;Consider some simpler cases, &lt;span class=&quot;math-container&quot;&gt;$(j,j+1)$&lt;/span&gt; for general &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. Then you can do you want with plugging in &lt;span class=&quot;math-container&quot;&gt;$j=i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$j=i+1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$j=i+3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j=i+4$&lt;/span&gt; and concatenating the circuits appropriately and then simplifying.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how to do &lt;span class=&quot;math-container&quot;&gt;$(j,j+1)$&lt;/span&gt;? That is conjugate to &lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt;, so just consider that for now.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt; would be NOT but controlled on making sure all the higher places are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The conjugation that takes you between &lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(j,j+1)$&lt;/span&gt; is the circuit that does addition of &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; modulo &lt;span class=&quot;math-container&quot;&gt;$2^{w+1}$&lt;/span&gt;. Reduce that to addition of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; modulo &lt;span class=&quot;math-container&quot;&gt;$2^{w+1}$&lt;/span&gt; repeated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2020-01-07T17:24:26.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9458" PostTypeId="1" AcceptedAnswerId="9459" CreationDate="2020-01-07T23:27:26.543" Score="3" ViewCount="85" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what I've tried running:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.jupyter import *&#xA;backend = P[1].get_backend('ibmq_poughkeepsie')&#xA;%qiskit_backend_overview&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns a ZeroDivisionError.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've also tried calling backend_monitor(backend), but returns a TypeError, saying that 'module' object is not callable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="7666" LastActivityDate="2020-01-08T00:32:17.557" Title="Is qiskit_backend_monitor magic function depricated?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9459" PostTypeId="2" ParentId="9458" CreationDate="2020-01-08T00:32:17.557" Score="6" Body="&lt;p&gt;The &lt;code&gt;%qiskit_backend_overview&lt;/code&gt; magic is not deprecated and has seen updates for the most recent 0.11.0 release: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/tools/jupyter/backend_overview.py&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/tools/jupyter/backend_overview.py&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did test it with the latest version qiskit 0.14.1 locally and it still works fine for me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TnE8y.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TnE8y.png&quot; alt=&quot;backend overview&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5baaV.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5baaV.png&quot; alt=&quot;backend monitor&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the graphical jupyter backends aren't working for you for whatever reason there are always the python functions from &lt;code&gt;qiskit.tools&lt;/code&gt; that do the same thing just without any of the graphical output. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3TP75.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3TP75.png&quot; alt=&quot;backend monitor function&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-01-08T00:32:17.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9460" PostTypeId="2" ParentId="9455" CreationDate="2020-01-08T08:11:15.017" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;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)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s, acting on the 4 vertices that that square touches. Similarly for the cyan squares with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators. So, every vertex in the bulk of the system is touched by 4 stabilizers, 2 with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s and 2 with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s. On the edge, some of those squares are replaced by lines, i.e. pairs of terms.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They can twist and turn. Logical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is any continuous line of Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s going from top to bottom, with arbitrary twists and turns. Similarly for &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s going from left to right.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation on a single qubit, that commutes with all the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-type stabilizers. It commutes with all the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizers that do not act on that site. However, it anti-commutes with the two &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizers which touch that site. So, they put a red dot on the corresponding two mustard yellow squares.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you do multiple operations, red dots add up modulo 2. So, if I do two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$ZZZZ$&lt;/span&gt; if the two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s act on two of the sites that &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s act on)&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;think&lt;/em&gt; (without having spent a long time carefully checking) that the two lattices are rotated by &lt;span class=&quot;math-container&quot;&gt;$45^{\circ}$&lt;/span&gt; relative to each other, and that lets them have different boundary terms.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-08T08:11:15.017" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9461" PostTypeId="2" ParentId="9442" CreationDate="2020-01-08T15:28:49.453" Score="2" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if it weren't logical qubits, we can easily write down a circuit that would accomplish this (left-hand circuit, which has output &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|\psi\rangle$&lt;/span&gt;). 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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/arETD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/arETD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-08T15:28:49.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9462" PostTypeId="1" CreationDate="2020-01-08T16:54:47.107" Score="1" ViewCount="59" Body="&lt;p&gt;I have problem to simplify the quantum system states on bloch sphere to get &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; values,&#xA;My question is not duplicated!&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{1+i}{\sqrt{3}} \left| 0 \right&amp;gt; + {\sqrt{\frac{1}{3}}} \left| 1\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9715" LastEditorUserId="26" LastEditDate="2020-01-09T02:02:22.317" LastActivityDate="2020-01-09T02:02:22.317" Title="Simplify the system to find the $\theta$, $\phi$ on bloch sphere" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="6" ClosedDate="2020-01-08T17:28:46.350" ContentLicense="CC BY-SA 4.0" />
  <row Id="9463" PostTypeId="1" AcceptedAnswerId="9465" CreationDate="2020-01-08T18:50:07.887" Score="4" ViewCount="145" Body="&lt;p&gt;Suppose that we have one-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that maps &#xA;&lt;span class=&quot;math-container&quot;&gt;$$  \left| 0 \right&amp;gt; \longmapsto \frac{1}{\sqrt{2}} \left| 0 \right&amp;gt; + {\frac{1+i}{2}} \left| 1\right&amp;gt; $$&lt;/span&gt;&#xA;and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$  \left| 1 \right&amp;gt; \longmapsto {\frac{1-i}{2}} \left| 0 \right&amp;gt; - \frac{1}{\sqrt{2}} \left| 1\right&amp;gt; $$&lt;/span&gt;&#xA;What is &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-01-09T11:14:56.023" LastActivityDate="2020-01-10T09:44:32.823" Title="What unitary gate produces these quantum states from the computational basis?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9464" PostTypeId="2" ParentId="9442" CreationDate="2020-01-08T19:06:00.940" Score="4" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; you do transversal initialization (initialize all physical qubits to the desired state, then turn on the stabilizers).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle$&lt;/span&gt; you do topological initialization using &lt;a href=&quot;https://arxiv.org/abs/1609.04673&quot; rel=&quot;nofollow noreferrer&quot;&gt;twists&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$T|+\rangle$&lt;/span&gt; states and other states with nice state distillation protocols, you do &lt;em&gt;noisy low code distance&lt;/em&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1410.7808&quot; rel=&quot;nofollow noreferrer&quot;&gt;A magic state's fidelity can be superior to the operations that created it&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1812.01238&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient magic state factories with a catalyzed |CCZ&gt; to 2|T&gt; transformation&lt;/a&gt; for the state of the art.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For other single qubit states, you approximate them using a series of operations. Read &lt;a href=&quot;https://arxiv.org/abs/1404.5320&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient synthesis of universal Repeat-Until-Success circuits&#xA;&lt;/a&gt; for the state of the art.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-01-09T01:35:15.390" LastActivityDate="2020-01-09T01:35:15.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9465" PostTypeId="2" ParentId="9463" CreationDate="2020-01-08T19:29:26.663" Score="7" Body="&lt;p&gt;Firstly simply rewrite probability amplitudes of returned states as columns of a matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = &#xA;\begin{pmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1-i}{2} \\&#xA;\frac{1+i}{2} &amp;amp; -\frac{1}{\sqrt{2}}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;Now do some algebra&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; \frac{1-i}{\sqrt{2}} \\&#xA;\frac{1+i}{\sqrt{2}} &amp;amp; -1&#xA;\end{pmatrix}&#xA;=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; \mathrm{e}^{-i\frac{\pi}{4}} \\&#xA;\mathrm{e}^{i\frac{\pi}{4}} &amp;amp; -1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a quantum gate called &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U2}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U2}(\phi,\lambda)=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; -\mathrm{e}^{i\lambda} \\&#xA;\mathrm{e}^{i\phi} &amp;amp; \mathrm{e}^{i(\phi+\lambda)}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;span class=&quot;math-container&quot;&gt;$\phi=\frac{\pi}{4}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda = \frac{3}{4}\pi$&lt;/span&gt; you have a resut since &lt;span class=&quot;math-container&quot;&gt;$\phi+\lambda =\pi$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i(\phi+\lambda)} = \mathrm{e}^{i\pi} = -1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-\mathrm{e}^{i\lambda}=-\mathrm{e}^{i\frac{3}{4}\pi} = -\frac{-1+i}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion: &lt;span class=&quot;math-container&quot;&gt;$U=\mathrm{U2}\big(\frac{\pi}{4},\frac{3}{4}\pi\big)$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-08T19:29:26.663" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9466" PostTypeId="1" AcceptedAnswerId="9467" CreationDate="2020-01-08T20:09:56.317" Score="0" ViewCount="635" Body="&lt;p&gt;In last time there is a lot of questions how to find &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; for particular state on Bloch sphere. I think that it would be useful to solve one example to stop stream of very similar questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is how to find &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; on Bloch sphere?&#xA;Please demonstrate calculation on this quantum state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{1+i}{\sqrt{3}} \left| 0 \right&amp;gt; + {\sqrt{\frac{1}{3}}} \left| 1\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-01-09T00:32:08.643" LastActivityDate="2020-01-09T05:49:49.320" Title="Find coordinates $\theta$ and $\phi$ on the Bloch sphere of a given qubit state" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="8" ClosedDate="2020-01-09T11:23:03.650" ContentLicense="CC BY-SA 4.0" />
  <row Id="9467" PostTypeId="2" ParentId="9466" CreationDate="2020-01-08T20:09:56.317" Score="0" Body="&lt;p&gt;Generally, a quantum state can be expressed in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi\rangle = \cos\frac{\theta}{2}|0\rangle + \mathrm{e}^{i\phi}\sin\frac{\theta}{2}|1\rangle&#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; are coordinates on Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the particular state in question, we firstly have to get rid of complex amplitude before &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; after multiplication. They remain same (for the state in question probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in z-basis is &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;, respectively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, the global phase is a complex number with absolute value 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our paritucar case I multiplied &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-\frac{\pi}{4}}$&lt;/span&gt; &lt;em&gt;(hence global phase is &lt;span class=&quot;math-container&quot;&gt;$-\frac{\pi}{4}$&lt;/span&gt;)&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;={\sqrt{\frac{2}{3}}} \left| 0 \right&amp;gt; + \frac{1-i}{\sqrt{2}}\frac{1}{\sqrt{3}} \left| 1\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-i\frac{\pi}{4}}$&lt;/span&gt;, apparently &lt;span class=&quot;math-container&quot;&gt;$\phi = -\frac{\pi}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theta can be calculated from &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\theta}{2} = \sqrt{\frac{2}{3}}$&lt;/span&gt;. Hence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2\arccos\sqrt{\frac{2}{3}} = 1.2310.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can verify &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; with sine&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2\arcsin\sqrt{\frac{1}{3}} = 1.2310.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion: &lt;span class=&quot;math-container&quot;&gt;$\theta = 1.2310$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi = -\frac{\pi}{4}$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9404/how-can-i-find-the-theta-and-phi-values-of-a-qubit-on-the-bloch-sphere&quot;&gt;Another numerical example on Bloch sphere coordinates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-09T05:49:49.320" LastActivityDate="2020-01-09T05:49:49.320" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9468" PostTypeId="2" ParentId="9335" CreationDate="2020-01-09T00:24:36.337" Score="2" Body="&lt;p&gt;Yes, any state can always be described as a coherent superposition of some other set of states. &quot;&lt;em&gt;Being in a superposition&lt;/em&gt;&quot; is not a property of just a quantum state, but rather a property of a quantum state &lt;em&gt;relative to some basis&lt;/em&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-09T00:24:36.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9469" PostTypeId="1" AcceptedAnswerId="9482" CreationDate="2020-01-09T02:19:45.727" Score="1" ViewCount="80" Body="&lt;p&gt;I'm looking into this paper from DiCarlo's group &lt;a href=&quot;https://arxiv.org/abs/1612.08208&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scalable quantum circuit and control for a superconducting surface code&lt;/a&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does it? Maybe that's not even required, if it really isn't, why? &lt;/p&gt;&#xA;" OwnerUserId="9740" LastEditorUserId="9006" LastEditDate="2020-01-09T05:52:28.987" LastActivityDate="2020-01-10T13:40:39.473" Title="How does Surface-17 tell apart Z errors on Db and Dc?" Tags="&lt;error-correction&gt;&lt;superconducting-quantum-computing&gt;&lt;surface-code&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9471" PostTypeId="1" CreationDate="2020-01-09T07:30:22.030" Score="3" ViewCount="280" Body="&lt;p&gt;I am using Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I made two quantum circuits to generate &lt;span class=&quot;math-container&quot;&gt;$\cos\theta|00\rangle + \sin\theta|00\rangle$&lt;/span&gt; for VQE calculations as follows.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eX5ux.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eX5ux.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9iMri.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9iMri.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Run time or something?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8673" LastEditorUserId="8673" LastEditDate="2020-01-12T04:09:56.640" LastActivityDate="2020-10-10T16:35:36.630" Title="What is a better ansatz for VQE?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9472" PostTypeId="2" ParentId="9469" CreationDate="2020-01-09T07:51:39.487" Score="1" Body="&lt;p&gt;Distinguishing &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; errors is easy. &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors anti-commute with the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizers, and so when you perform a measurement of &lt;em&gt;those&lt;/em&gt; parity checks, you get and answer '1'. Similarly, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; errors give you a '1' answer only on the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-type parity checks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, note that, in the bulk (i.e. not on the edges), you &lt;em&gt;never&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error occurred somewhere, you don't have to apply the same &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to correct for it. Any sequence of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-09T07:51:39.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9474" PostTypeId="2" ParentId="9404" CreationDate="2020-01-09T11:21:49.587" Score="3" Body="&lt;p&gt;In last time there is a lot of questions how to find &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; for this particular state on Bloch sphere: &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{1+i}{\sqrt{3}} \left| 0 \right&amp;gt; + {\sqrt{\frac{1}{3}}} \left| 1\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will try to demonstrate how to do so in more details in comparison with previous answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally, a quantum state can be expressed in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi\rangle = \cos\frac{\theta}{2}|0\rangle + \mathrm{e}^{i\phi}\sin\frac{\theta}{2}|1\rangle&#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; are coordinates on Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the particular state in question, we firstly have to get rid of complex amplitude before &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; after multiplication. They remain same (for the state in question probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in z-basis is &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;, respectively).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, the global phase is a complex number with absolute value 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In our paritucar case I multiplied &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-\frac{\pi}{4}}$&lt;/span&gt; &lt;em&gt;(hence global phase is &lt;span class=&quot;math-container&quot;&gt;$-\frac{\pi}{4}$&lt;/span&gt;)&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;={\sqrt{\frac{2}{3}}} \left| 0 \right&amp;gt; + \frac{1-i}{\sqrt{2}}\frac{1}{\sqrt{3}} \left| 1\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-i\frac{\pi}{4}}$&lt;/span&gt;, apparently &lt;span class=&quot;math-container&quot;&gt;$\phi = -\frac{\pi}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Theta can be calculated from &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\theta}{2} = \sqrt{\frac{2}{3}}$&lt;/span&gt;. Hence&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2\arccos\sqrt{\frac{2}{3}} = 1.2310.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can verify &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; with sine&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2\arcsin\sqrt{\frac{1}{3}} = 1.2310.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion: &lt;span class=&quot;math-container&quot;&gt;$\theta = 1.2310$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi = -\frac{\pi}{4}$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-09T11:21:49.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9475" PostTypeId="1" AcceptedAnswerId="9476" CreationDate="2020-01-09T16:25:14.253" Score="-3" ViewCount="39" Body="&lt;p&gt;I have two vectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a=\begin{pmatrix}&#xA;{1} &amp;amp; {1} &amp;amp; {1} \&#xA;\end{pmatrix} \\&#xA;b=\begin{pmatrix}&#xA;{1} &amp;amp; {2} &amp;amp; {k} \&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;These vectors should be orthogonal. What is value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9715" LastEditorUserId="55" LastEditDate="2020-11-10T17:36:21.380" LastActivityDate="2020-11-10T17:36:21.380" Title="What value of K parameter of the following two vectors?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-01-10T18:30:21.867" ContentLicense="CC BY-SA 4.0" />
  <row Id="9476" PostTypeId="2" ParentId="9475" CreationDate="2020-01-09T16:26:34.787" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left\langle a| b \right\rangle=&#xA;\begin{pmatrix}&#xA;{1} &amp;amp; {1} &amp;amp; {1} \&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;{1} &amp;amp; {2} &amp;amp; {k} \&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;Since the two vectors are orthogonal,so the inner product of them is zero:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;0=1+2+k \\&#xA;k=-3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9700" LastActivityDate="2020-01-09T16:26:34.787" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9477" PostTypeId="1" AcceptedAnswerId="9499" CreationDate="2020-01-09T18:13:01.913" Score="2" ViewCount="116" Body="&lt;p&gt;I'm making my way through several neural network examples and libraries.  Landing on this &lt;a href=&quot;https://www.youtube.com/watch?v=IHZwWFHWa-w&quot; rel=&quot;nofollow noreferrer&quot;&gt;nugget&lt;/a&gt;, in creating a basic NN for character recognition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an equivalent quantum NN for this and are there examples I can begin working with?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My interest here is in how a parallel quantum system can be more efficient with training data over its non-quantum counterpart. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bUqdz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bUqdz.png&quot; alt=&quot;3Blue1Brown Series&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9744" LastActivityDate="2020-01-12T13:38:36.407" Title="Is there a quantum neural network &quot;hello world&quot; for character recognition (convolutional neural networks)?" Tags="&lt;algorithm&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9478" PostTypeId="1" CreationDate="2020-01-10T02:37:29.067" Score="2" ViewCount="52" Body="&lt;p&gt;I tried installing Forest openfermion by&#xA;&lt;code&gt;pip install forestopenfermion&lt;/code&gt; and I got the following long error message (cut):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Building wheels for collected packages: scipy&#xA;  Building wheel for scipy (setup.py) ... error&#xA;  ERROR: Command errored out with exit status 1:&#xA;   command: /Users/michelle/anaconda/envs/py3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'/private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-install-7odaoj4r/scipy/setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'/private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-install-7odaoj4r/scipy/setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d /private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-wheel-8zcv76y9 --python-tag cp37&#xA;       cwd: /private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-install-7odaoj4r/scipy/&#xA;  Complete output (1015 lines):&#xA;  lapack_opt_info:&#xA;  lapack_mkl_info:&#xA;  customize UnixCCompiler&#xA;    FOUND:&#xA;      libraries = ['mkl_rt', 'pthread']&#xA;      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']&#xA;      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]&#xA;      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']&#xA;&#xA;    FOUND:&#xA;      libraries = ['mkl_rt', 'pthread']&#xA;      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']&#xA;      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]&#xA;      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']&#xA;&#xA;  Running from scipy source directory.&#xA;  non-existing path in 'scipy/integrate': 'quadpack.h'&#xA;  Splitting linalg.interpolative Fortran source files&#xA;  blas_opt_info:&#xA;  blas_mkl_info:&#xA;  customize UnixCCompiler&#xA;    FOUND:&#xA;      libraries = ['mkl_rt', 'pthread']&#xA;      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']&#xA;      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]&#xA;      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']&#xA;&#xA;    FOUND:&#xA;      libraries = ['mkl_rt', 'pthread']&#xA;      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']&#xA;      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]&#xA;      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']&#xA;&#xA;  non-existing path in 'scipy/sparse': 'sparsetools/sparsetools_impl.h'&#xA;  non-existing path in 'scipy/sparse': 'sparsetools/bsr_impl.h'&#xA;  non-existing path in 'scipy/sparse': 'sparsetools/csc_impl.h'&#xA;  non-existing path in 'scipy/sparse': 'sparsetools/csr_impl.h'&#xA;  non-existing path in 'scipy/sparse': 'sparsetools/other_impl.h'&#xA;  running bdist_wheel&#xA;  running build&#xA;  running config_cc&#xA;  unifing config_cc, config, build_clib, build_ext, build commands --compiler options&#xA;  running config_fc&#xA;  unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options&#xA;  running build_src&#xA;  build_src&#xA;  building py_modules sources&#xA;  creating build&#xA;  creating build/src.macosx-10.9-x86_64-3.7&#xA;  creating build/src.macosx-10.9-x86_64-3.7/scipy&#xA;  building library &quot;dfftpack&quot; sources&#xA;  building library &quot;fftpack&quot; sources&#xA;  building library &quot;mach&quot; sources&#xA;  building library &quot;quadpack&quot; sources&#xA;  building library &quot;odepack&quot; sources&#xA;  building library &quot;dop&quot; sources&#xA;  building library &quot;fitpack&quot; sources&#xA;  building library &quot;fwrappers&quot; sources&#xA;  building library &quot;odrpack&quot; sources&#xA;  building library &quot;minpack&quot; sources&#xA;  building library &quot;rootfind&quot; sources&#xA;  building library &quot;superlu_src&quot; sources&#xA;  building library &quot;arpack_scipy&quot; sources&#xA;  building library &quot;sc_c_misc&quot; sources&#xA;  building library &quot;sc_cephes&quot; sources&#xA;  building library &quot;sc_mach&quot; sources&#xA;  building library &quot;sc_amos&quot; sources&#xA;  building library &quot;sc_cdf&quot; sources&#xA;  building library &quot;sc_specfun&quot; sources&#xA;  building library &quot;statlib&quot; sources&#xA;  building extension &quot;scipy.cluster._vq&quot; sources&#xA;  building extension &quot;scipy.cluster._hierarchy&quot; sources&#xA;  building extension &quot;scipy.fftpack._fftpack&quot; sources&#xA;  creating build/src.macosx-10.9-x86_64-3.7/scipy/fftpack&#xA;  creating build/src.macosx-10.9-x86_64-3.7/scipy/fftpack/src&#xA;  conv_template:&amp;gt; build/src.macosx-10.9-x86_64-3.7/scipy/fftpack/src/dct.c&#xA;  conv_template:&amp;gt; build/src.macosx-10.9-x86_64-3.7/scipy/fftpack/src/dst.c&#xA;  f2py options: []&#xA;  f2py: scipy/fftpack/fftpack.pyf&#xA;  Reading fortran codes...&#xA;    Reading file 'scipy/fftpack/fftpack.pyf' (format:free)&#xA;  Line #86 in scipy/fftpack/fftpack.pyf:&quot;       /* Single precision version */ &quot;&#xA;    crackline:2: No pattern for line&#xA;  Post-processing...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And so on... &lt;strong&gt;Could somebody help me? Thanks!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9749" LastEditorUserId="23" LastEditDate="2020-02-02T09:28:44.290" LastActivityDate="2020-02-02T09:28:44.290" Title="Error during Forest openfermion installation" Tags="&lt;rigetti&gt;&lt;pyquil&gt;&lt;openfermion&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9479" PostTypeId="1" AcceptedAnswerId="9480" CreationDate="2020-01-10T07:33:03.800" Score="4" ViewCount="250" Body="&lt;p&gt;I noticed that in page 427 in Nielsen &amp;amp; Chuang's book &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt;&lt;/a&gt;, quantum error correction is possible because errors can be discretized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other hand, the master equation in the Lindblad form in the following seems describes errors continuously occurring on qubits, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I want to say that &lt;strong&gt;&quot;errors can be discretized&quot; is one of the basis that &quot;quantum error correction is possible&quot;&lt;/strong&gt;. But then I found errors described by the master equation can also be corrected and these errors seems like continuous errors to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is if the bold sentence is wrong or the errors described by the master equation are actually discrete errors?&lt;/p&gt;&#xA;" OwnerUserId="9275" LastEditorUserId="9006" LastEditDate="2020-01-10T14:12:36.317" LastActivityDate="2020-01-10T14:12:36.317" Title="What kind of errors does the master equation in the Lindblad form describe, continuous errors or discrete errors?" Tags="&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9480" PostTypeId="2" ParentId="9479" CreationDate="2020-01-10T07:59:53.957" Score="6" Body="&lt;p&gt;The errors that are described by the Master equation are continuous errors. The action of error correction is to discretize those errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, dephasing noise can be described by the Master equation. The net effect is that an initial state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is transformed into&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\mapsto (1-p)\rho+pZ\rho Z,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is a function of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, imagine that you are protecting against such errors by using a majority vote in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis. We encode as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\alpha|+++\rangle+\beta|---\rangle&#xA;$$&lt;/span&gt;&#xA;so &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\langle \psi|$&lt;/span&gt;. 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, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z_1\rho Z_1$&lt;/span&gt; etc. So, it has been discretized and you only have to think about Pauli errors.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-10T07:59:53.957" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9481" PostTypeId="2" ParentId="9463" CreationDate="2020-01-10T08:12:44.780" Score="4" Body="&lt;p&gt;Just to expand on the detail of &lt;em&gt;why&lt;/em&gt; writing out the columns works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start by writing the action of the unitary:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;U|0\rangle=\frac{1}{\sqrt{2}}|0\rangle+\frac{1+i}{2}|1\rangle \\&#xA;U|1\rangle=\frac{1-i}{2}|0\rangle-\frac{1}{\sqrt{2}}|1\rangle&#xA;\end{align*}&lt;/span&gt;&#xA;Before proceeding, it's always worth checking that both sides are correctly normalised. In this case, they are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take the inner product of each equation with &lt;span class=&quot;math-container&quot;&gt;$\langle 0|$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0|U|0\rangle=\frac{1}{\sqrt{2}}\qquad\langle 0|U|1\rangle=\frac{1-i}{2}&#xA;$$&lt;/span&gt;&#xA;Similarly, using &lt;span class=&quot;math-container&quot;&gt;$\langle 1|$&lt;/span&gt;, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 1|U|0\rangle=\frac{1+i}{2}\qquad\langle 1|U|1\rangle=-\frac{1}{\sqrt{2}}.&#xA;$$&lt;/span&gt;&#xA;So, these identify all four matrix elements, which you can just insert:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left(\begin{array}{cc}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1-i}{2} \\ \frac{1+i}{2} &amp;amp; -\frac{1}{\sqrt{2}}&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;(I should say that I always get muddled between the two off-diagonal elements. So I have to stop and think about, for example, &lt;span class=&quot;math-container&quot;&gt;$\langle 0|U|1\rangle$&lt;/span&gt;, and which element is selected by doing the inner product &lt;span class=&quot;math-container&quot;&gt;$\left(\begin{array}{cc}1 &amp;amp; 0\end{array}\right)U\left(\begin{array}{c} 0 \\ 1 \end{array}\right)$&lt;/span&gt;: top row, right-hand column.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't forget to check that your answer is reasonable by verifying &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger=I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="9006" LastEditDate="2020-01-10T09:44:32.823" LastActivityDate="2020-01-10T09:44:32.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9482" PostTypeId="2" ParentId="9469" CreationDate="2020-01-10T13:40:39.473" Score="0" Body="&lt;p&gt;I have added the layout from the paper.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Z error on Db will fire Xb and Xa. A Z error on Dc will fire Xa.&#xA;Thus these two are distinguishable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a X error occurs on Dc this will fire Zb. This can be corrected by applying X on Dc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5vAj6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5vAj6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9282" LastActivityDate="2020-01-10T13:40:39.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9483" PostTypeId="2" ParentId="9436" CreationDate="2020-01-10T15:44:20.340" Score="1" Body="&lt;p&gt;A matrix/operator is unitary &lt;em&gt;if and only if&lt;/em&gt; it sends orthonormal bases into orthonormal bases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, to check whether &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, it is enough to check that it sends a &lt;em&gt;subset&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, say &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts on a two-qubit system as &lt;span class=&quot;math-container&quot;&gt;$U|00\rangle=|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|10\rangle=|11\rangle$&lt;/span&gt;.&#xA;This does &lt;em&gt;not&lt;/em&gt; mean that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, but it &lt;em&gt;does&lt;/em&gt; mean that it can trivially be made into a unitary. You just need to define its action of the rest of the space (here &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;) so that the overall action is unitary. A trivial way to do it here can be &lt;span class=&quot;math-container&quot;&gt;$U|01\rangle=|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|11\rangle=|10\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-10T15:44:20.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9484" PostTypeId="1" AcceptedAnswerId="9545" CreationDate="2020-01-10T21:46:03.993" Score="2" ViewCount="261" Body="&lt;p&gt;Happened on some code, which I was hoping would run out of the box. However fails on the import&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.translators.ising import max_cut&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.translators.ising import max_cut&#xA;ModuleNotFoundError: No module named 'qiskit.aqua.translators'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7439" LastEditorUserId="7439" LastEditDate="2020-01-10T22:12:23.757" LastActivityDate="2020-01-15T04:58:44.770" Title="max_cut in qiskit aqua" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9485" PostTypeId="1" AcceptedAnswerId="9486" CreationDate="2020-01-10T22:15:46.233" Score="3" ViewCount="148" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the problem (it's in French, I did my best to translate):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Alice and Bob are separated by a distance of &lt;span class=&quot;math-container&quot;&gt;$2L$&lt;/span&gt;. Suppose that Charlie is in the middle, i.e. he's at a distance &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; from Alice and at a distance &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; from Bob. Charlie produces two entangled pairs in the state &lt;span class=&quot;math-container&quot;&gt;$\left| B_{00} \right&amp;gt;_{12}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| B_{00} \right&amp;gt;_{34}$&lt;/span&gt;. Therefore, there are 4 bits called &lt;span class=&quot;math-container&quot;&gt;$1,2,3,4$&lt;/span&gt;. Charlie keeps in his lab the particles &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; and sends particles &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; to Alice and Bob. Now, Charlie makes a measure in the Bell basis on particles &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; that he kept in his lab. Which are the possible results (with probabilities) of the measure in Charlie's Lab? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Here's my approach&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Before the measure, we know that the initial state is : &lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; = \left| B_{00} \right&amp;gt;_{12} \otimes \left| B_{00} \right&amp;gt;_{34}$$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2} \left( \left| 0 \right&amp;gt;_{1} \otimes \left| 00 \right&amp;gt;_{23} \otimes \left| 0 \right&amp;gt;_{4} + \left| 0 \right&amp;gt;_{1} \otimes \left| 01 \right&amp;gt;_{23} \otimes \left| 1 \right&amp;gt;_{4} + \left| 1 \right&amp;gt;_{1} \otimes \left| 10 \right&amp;gt;_{23} \otimes \left| 0 \right&amp;gt;_{4} + \left| 1 \right&amp;gt;_{1} \otimes \left| 11 \right&amp;gt;_{23} \otimes \left| 1 \right&amp;gt;_{4}     \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, given that I know that &lt;span class=&quot;math-container&quot;&gt;$$\left| 00 \right&amp;gt;_{23} = \frac{1}{\sqrt{2}}(\left| B_{00} \right&amp;gt;_{23} + \left| B_{10} \right&amp;gt;_{23})$$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$$\left| 01 \right&amp;gt;_{23} = \frac{1}{\sqrt{2}}(\left| B_{01} \right&amp;gt;_{23} + \left| B_{11} \right&amp;gt;_{23})$$&lt;/span&gt;, 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):&lt;span class=&quot;math-container&quot;&gt;$$ \left| \psi \right&amp;gt; =\frac{1}{2\sqrt{2}} \left| B_{00} \right&amp;gt;_{23} \otimes (\left| 00 \right&amp;gt;_{14} + \left| 11 \right&amp;gt;_{14}) + \frac{1}{2\sqrt{2}} \left| B_{10} \right&amp;gt;_{23} \otimes (\left| 00 \right&amp;gt;_{14} - \left| 11 \right&amp;gt;_{14}) + \frac{1}{2\sqrt{2}} \left| B_{01} \right&amp;gt;_{23} \otimes (\left| 01 \right&amp;gt;_{14} + \left| 10 \right&amp;gt;_{14}) + \frac{1}{2\sqrt{2}} \left| B_{11} \right&amp;gt;_{23} \otimes (\left| 01 \right&amp;gt;_{14} - \left| 10 \right&amp;gt;_{14})$$&lt;/span&gt; which reduces to: &lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; =\frac{1}{2} \left| B_{00} \right&amp;gt;_{23} \otimes \left| B_{00} \right&amp;gt;_{14} + \frac{1}{2} \left| B_{01} \right&amp;gt;_{23} \otimes \left| B_{01} \right&amp;gt;_{14} + \frac{1}{2} \left| B_{10} \right&amp;gt;_{23} \otimes \left| B_{10} \right&amp;gt;_{14} + \frac{1}{2} \left| B_{11} \right&amp;gt;_{23} \otimes \left| B_{11} \right&amp;gt;_{14}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$\left| B_{00} \right&amp;gt;_{23} \otimes \left| B_{00} \right&amp;gt;_{14}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\left| B_{01} \right&amp;gt;_{23} \otimes \left| B_{01} \right&amp;gt;_{14}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\left| B_{10} \right&amp;gt;_{23} \otimes \left| B_{10} \right&amp;gt;_{14}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \left| B_{11} \right&amp;gt;_{23} \otimes \left| B_{11} \right&amp;gt;_{14}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the probability of measuring each state is &lt;span class=&quot;math-container&quot;&gt;$p=\frac{1}{4}$&lt;/span&gt;. I found this without using Born's rule. I used the fact that in another state, such as &lt;span class=&quot;math-container&quot;&gt;$\left| \phi \right&amp;gt;=\alpha\left| 0 \right&amp;gt; + \beta\left| 1 \right&amp;gt;$&lt;/span&gt;, the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right&amp;gt;$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;(and the idea is the same for &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right&amp;gt;$&lt;/span&gt;). 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?&lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="55" LastEditDate="2020-07-27T12:27:18.437" LastActivityDate="2020-07-27T12:27:18.437" Title="Problem involving entanglement swapping" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;teleportation&gt;&lt;entanglement-swapping&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9486" PostTypeId="2" ParentId="9485" CreationDate="2020-01-11T06:35:01.787" Score="1" Body="&lt;p&gt;Judging from your computations, the Bell states are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|B_{00}\rangle = |\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|B_{10}\rangle = |\Phi^-\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|B_{01}\rangle = |\Psi^+\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|B_{11}\rangle = |\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-01-11T06:40:13.440" LastActivityDate="2020-01-11T06:40:13.440" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9487" PostTypeId="1" CreationDate="2020-01-11T09:07:40.013" Score="1" ViewCount="122" Body="&lt;p&gt;In &lt;a href=&quot;https://ieeexplore.ieee.org/abstract/document/1490730&quot; rel=&quot;nofollow noreferrer&quot;&gt;A New Quantum Inspired Genetic Algorithma&lt;/a&gt; a lookup table is used to decide the Qubit rotation. But how the lookup table is used is not briefed.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know how it is done ?&lt;/p&gt;&#xA;&lt;p&gt;An example is shown below.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\delta\theta$&lt;/span&gt; is chosen equal to &lt;span class=&quot;math-container&quot;&gt;$\pi/25$&lt;/span&gt;. The following table gives the value of the rotation angle in function of &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta$&lt;/span&gt; and the bit's value in the best solution.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Table 1. Lookup table of the rotation angle}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array} {|c|c|c|c|}\hline \boldsymbol\alpha &amp;amp; \boldsymbol\beta &amp;amp; \textbf{Reference bit value} &amp;amp; \textbf{Angle} \\ \hline &amp;gt;0 &amp;amp; &amp;gt;0 &amp;amp; 1 &amp;amp; +\delta\theta \\ \hline &amp;gt;0 &amp;amp; &amp;gt;0 &amp;amp; 0 &amp;amp; -\delta\theta \\ \hline &amp;gt;0 &amp;amp; &amp;lt;0 &amp;amp; 1 &amp;amp; -\delta\theta \\ \hline &amp;gt;0 &amp;amp; &amp;lt;0 &amp;amp; 0 &amp;amp; +\delta\theta \\ \hline &amp;lt;0 &amp;amp; &amp;gt;0 &amp;amp; 1 &amp;amp; -\delta\theta \\ \hline &amp;lt;0 &amp;amp; &amp;gt;0 &amp;amp; 0 &amp;amp; +\delta\theta \\ \hline &amp;lt;0 &amp;amp; &amp;lt;0 &amp;amp; 1 &amp;amp; +\delta\theta \\ \hline &amp;lt;0 &amp;amp; &amp;lt;0 &amp;amp; 0 &amp;amp; -\delta\theta \\ \hline  \end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="23" LastEditDate="2020-08-25T16:38:42.880" LastActivityDate="2020-08-25T16:38:42.880" Title="How to read a Qubit rotation lookup table?" Tags="&lt;mathematics&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9488" PostTypeId="2" ParentId="9485" CreationDate="2020-01-11T09:08:54.397" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho_{23}$&lt;/span&gt; on those qubits from the total density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_{1234}=|\psi\rangle \langle\psi|$&lt;/span&gt;, i.e. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{23} = \text{Tr}_{14}(\rho_{1234})&#xA;$$&lt;/span&gt;&#xA;Density matrix carry all information that is need to predict measurements outcomes.&lt;br&gt;&#xA;Since in this case &lt;span class=&quot;math-container&quot;&gt;$$\rho_{23} = \frac{1}{4}I$$&lt;/span&gt;&#xA;the Bell measurement outcomes must be equiprobable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute partial trace &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_{14}(\rho_{1234})$&lt;/span&gt; note that the state &lt;span class=&quot;math-container&quot;&gt;$\rho_{1234}$&lt;/span&gt; is disentangled relative to the decomposition &lt;span class=&quot;math-container&quot;&gt;$H_{12} \otimes H_{34}$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_{1234} = \rho_{12} \otimes \rho_{34}$&lt;/span&gt;. &#xA;So it must be &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&#xA;Though, of course, partial trace could be computed directly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-01-11T10:47:50.437" LastActivityDate="2020-01-11T10:47:50.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9490" PostTypeId="1" CreationDate="2020-01-11T14:09:18.273" Score="2" ViewCount="47" Body="&lt;p&gt;I'm learning quantum error correction by myself and I want to know the relation between block codes and surface codes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other hand, I find that surface codes are popular in recent papers. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My questions are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Which one are more promising in quantum error correction? and further in constructing fault-tolerant quantum computers?&lt;/li&gt;&#xA;&lt;li&gt;How many ancilla qubits are needed now approximataly for a computable logical qubit?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9275" LastActivityDate="2020-01-13T09:13:33.307" Title="Block codes with better parameters vs. surface codes, which need less ancilla qubits?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;surface-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9491" PostTypeId="1" AcceptedAnswerId="9492" CreationDate="2020-01-11T15:21:25.900" Score="1" ViewCount="98" Body="&lt;p&gt;Is it possible to get the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; (amplitudes) of a qubit in Qiskit, i.e. not only probabilities after measurement but complete quantum state?&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="9006" LastEditDate="2020-01-11T15:40:11.793" LastActivityDate="2020-01-11T16:00:06.963" Title="Is it possible to get the $\alpha$ and $\beta$ (amplitudes) of a qubit in Qiskit?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9492" PostTypeId="2" ParentId="9491" CreationDate="2020-01-11T16:00:06.963" Score="4" Body="&lt;p&gt;This can be done using the &lt;code&gt;statevector_simulator&lt;/code&gt; 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 &lt;code&gt;qasm_simulator&lt;/code&gt;, only your circuit shouldn't have measurement gates at the end. There is more information about this simulator in &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/8fb0e08bbace67518e5074e6734ecbd4f75d0d75/qiskit/advanced/aer/1_aer_provider.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-01-11T16:00:06.963" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9493" PostTypeId="1" CreationDate="2020-01-11T18:54:15.507" Score="3" ViewCount="130" Body="&lt;p&gt;Suppose there is a Q# operation as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation Op () : Bool {&#xA;&#xA;    let result = CSharpMethod ();&#xA;    return result&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;CSharpMethod ()&lt;/code&gt; is a defined method in the Driver class as follows:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static bool CSharpMethod () {&#xA;    // ...&#xA;    // return a boolean value&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So my question is how to call a method of a C# class inside a Q# operation and handle its returned value?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8487" LastActivityDate="2020-01-11T20:22:17.747" Title="How to invoke a C# method inside a Q# operation?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9494" PostTypeId="2" ParentId="9493" CreationDate="2020-01-11T20:22:17.747" Score="3" Body="&lt;p&gt;Q# operations are compiled into C# classes. To define a C# implementation for a Q# operation, you will need to do the following steps:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define a Q# operation with empty or intrinsic body &lt;code&gt;CSharpMethod&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Define a C# class that implements the abstract class into which your Q# operation gets compiled, something like &lt;code&gt;public class CSharpMethod_Impl : CSharpMethod&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Define method called &lt;code&gt;Body&lt;/code&gt; in that class that does the actual computation that you need and returns the result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This is a very hacky thing to do, so you might want to follow an example of operation &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/master/utilities/Common/Utils.qs#L16&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;GetOracleCallsCount&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/master/utilities/Common/CounterSimulator.cs#L95&quot; rel=&quot;nofollow noreferrer&quot;&gt;its C# implementation&lt;/a&gt; to see the exact pieces that have to be in place for it to work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also see &lt;a href=&quot;https://stackoverflow.com/questions/58784924/how-to-write-c-sharp-implementation-for-a-q-operation-with-intrinsic-body&quot;&gt;this question&lt;/a&gt; on StackOverflow that tries to do a similar thing.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-01-11T20:22:17.747" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9495" PostTypeId="1" AcceptedAnswerId="9498" CreationDate="2020-01-11T23:10:51.023" Score="1" ViewCount="175" Body="&lt;p&gt;I studied the &lt;code&gt;OPENQASM 2.0&lt;/code&gt; spec a few times but failed to find a way to include my own libraries. Have I missed anything?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Right now, the only way is to use &lt;code&gt;include &quot;qelib1.inc&quot;&lt;/code&gt; 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 &lt;code&gt;qelib1.inc&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="9006" LastEditDate="2020-01-12T07:27:08.040" LastActivityDate="2020-01-12T11:53:41.943" Title="OPENQASM: How to include my own libraries" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9496" PostTypeId="1" CreationDate="2020-01-12T00:55:52.010" Score="2" ViewCount="96" Body="&lt;p&gt;In C# it is possible to have:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void Fun (int n = 0){&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then the following method call examples will be compiled:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Fun()&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Fun(10)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So I wonder whether or not such a useful facility is available in creating Q# operations with optional parameters?&lt;/p&gt;&#xA;" OwnerUserId="8487" LastActivityDate="2020-01-14T21:02:22.650" Title="Is it possible to create a Q# operation with optional parameters?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9497" PostTypeId="2" ParentId="9496" CreationDate="2020-01-12T01:40:21.057" Score="2" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-01-12T01:40:21.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9498" PostTypeId="2" ParentId="9495" CreationDate="2020-01-12T11:53:41.943" Score="2" Body="&lt;p&gt;According to the openqasm spec the include statement will insert the contents of the files with the name relative to the current working directory:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst#language&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst#language&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're using qiskit-terra as your parser this should work unless you name the local file &quot;qelib1.inc&quot;. 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 &lt;code&gt;qelib1.inc&lt;/code&gt;: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/qasmlexer.py#L131-L163&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/qasmlexer.py#L131-L163&lt;/a&gt; If you're using openqasm with another parser that parser should implement the same behavior (for example see: &lt;a href=&quot;https://github.com/libtangle/qasm-rust/blob/master/src/lib.rs#L188-L244&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/libtangle/qasm-rust/blob/master/src/lib.rs#L188-L244&lt;/a&gt; for how it's implemented in qasm-rust).&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-01-12T11:53:41.943" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9499" PostTypeId="2" ParentId="9477" CreationDate="2020-01-12T13:38:36.407" Score="1" Body="&lt;p&gt;I don't think a hello world really exists here. You can have different points of view or goals here. I will give references.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first one is speeding up parts of the algorithm with a quantum version &lt;a href=&quot;https://arxiv.org/abs/1911.01117&quot; rel=&quot;nofollow noreferrer&quot;&gt;(here is an example reference)&lt;/a&gt;. But here, we assume a perfect hardware.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another one is to apply it to &lt;a href=&quot;https://arxiv.org/abs/1810.03787&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum many-body systems&lt;/a&gt;. The interesting point here is to have less parameters/weights to work on your problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, &lt;a href=&quot;https://arxiv.org/abs/1912.08278&quot; rel=&quot;nofollow noreferrer&quot;&gt;using transfer leaning for instance&lt;/a&gt;, and apply a parameterized quantum circuit where its input correspond to the output of a classical NN. For this one, there exists an implementation &lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_quantum_transfer_learning.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-01-12T13:38:36.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9500" PostTypeId="1" AcceptedAnswerId="9505" CreationDate="2020-01-12T14:24:15.480" Score="-3" ViewCount="894" Body="&lt;p&gt;I refer to &lt;a href=&quot;https://www.illinoisscience.org/2019/04/diy-guide-building-a-quantum-computer/&quot; rel=&quot;nofollow noreferrer&quot;&gt;A DIY Guide to Building a Quantum Computer&lt;/a&gt; and &lt;a href=&quot;https://phys.org/news/2019-09-advance-noise-cancelling-quantum.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Researchers advance noise cancelling for quantum computers&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With my friends, I would like to build our simplified quantum computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are also keen to reduce the noise, so my question: &lt;strong&gt;is there some quick and easy way to reduce noise?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="9006" LastEditDate="2020-01-12T17:59:57.920" LastActivityDate="2020-01-19T07:29:45.360" Title="Building a DIY quantum computer - how to reduce a noise?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;noise&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9502" PostTypeId="1" AcceptedAnswerId="9503" CreationDate="2020-01-12T16:41:10.487" Score="2" ViewCount="50" Body="&lt;p&gt;I have experimented a bit with Grover's Algorithm, and I wanted to search for the states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dAd12.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dAd12.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9633" LastEditorUserId="9006" LastEditDate="2020-01-12T18:05:11.823" LastActivityDate="2020-01-12T18:21:12.993" Title="Negating amplitude in amplitude amplification when second qubit is 0 not working" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9503" PostTypeId="2" ParentId="9502" CreationDate="2020-01-12T18:14:04.803" Score="2" Body="&lt;p&gt;It seems that there is a missing &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}$&lt;/span&gt; gates on qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. I used this Grover algoritm shape:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HrC6m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HrC6m.png&quot; alt=&quot;Grover operator&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 1: controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; is replaced by &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; and Hadamards on both sides.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 2: put your Oracle instead of dashed line.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 3: you do not have to measure &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-12T18:21:12.993" LastActivityDate="2020-01-12T18:21:12.993" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9504" PostTypeId="1" CreationDate="2020-01-12T19:31:38.990" Score="3" ViewCount="174" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;zero state&lt;/code&gt; then the probability of finding the second qubit in &lt;code&gt;zero state&lt;/code&gt; will be &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is calculated through some computations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="55" LastEditDate="2020-01-13T10:26:17.870" LastActivityDate="2020-01-20T10:10:41.440" Title="What is the property of any entangled pair of qubits?" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9505" PostTypeId="2" ParentId="9500" CreationDate="2020-01-12T19:57:08.203" Score="3" Body="&lt;p&gt;I read the article and it seems too rudimentary to provide a manual how to build a quantum computer home. It also contain some &amp;quot;half-truth&amp;quot; about quantum computers, e.g.:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is true for some tasks but not for all. There are some problems that quantum computer cannot solve faster than classical computer.&lt;/p&gt;&#xA;&lt;p&gt;Regarding the noise:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Quotes from the second article:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt; But please do not feel discouradged and continue to study quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-01-12T19:57:08.203" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9506" PostTypeId="1" CreationDate="2020-01-12T20:37:05.573" Score="1" ViewCount="67" Body="&lt;p&gt;In the released Q# documentation by Microsoft available at: &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/machines/full-state-simulator?view=qsharp-preview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Development Kit Full State Simulator&lt;/a&gt;, it is written &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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 &lt;code&gt;OMP_NUM_THREADS&lt;/code&gt; to a small number. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So I wonder how to do that as I couldn't find the solution of fixing &lt;code&gt;OMP_NUM_THREADS&lt;/code&gt; to a small number in their documentation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;Following is the snippet of the my code which does the main job:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mutable numberOfObservedZeros = 0;&#xA;&#xA;for (i in 1..firstLoop){&#xA;&#xA;    for (j in 1..secondLoop){&#xA;&#xA;        Set (qubit,Zero);&#xA;&#xA;        Ry (0.3141, qubit);&#xA;        R1 (0.0, qubit); &#xA;&#xA;        if (M(qubit) == Zero){&#xA;             set numberOfObservedZeros += 1;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;firstLoop&lt;/code&gt; and &lt;code&gt;secondLoop&lt;/code&gt; are passed to the operation containing the above block of code.&lt;/p&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="8487" LastEditDate="2020-01-12T20:58:25.383" LastActivityDate="2020-01-12T20:58:25.383" Title="How to reduce the length of Q# programs execution time?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="0" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="9507" PostTypeId="1" AcceptedAnswerId="9726" CreationDate="2020-01-12T21:43:49.257" Score="6" ViewCount="648" Body="&lt;p&gt;Recently a pre-print of article &lt;a href=&quot;https://arxiv.org/abs/1805.10928&quot; rel=&quot;noreferrer&quot;&gt;Efficient quantum algorithm for solving travelling salesman problem: An IBM quantum experience&lt;/a&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that a minimization algorithm introduced in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;noreferrer&quot;&gt;A Quantum Algorithm for Finding the Minimum&lt;/a&gt; is employed to find an actual soulution of TSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Briefly, the proposed algorithm work as follows:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly a matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; containing distances among &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; cities (i.e. element &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt; is distance from city &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; to city &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;) is converted to matrix &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; which elements are &lt;span class=&quot;math-container&quot;&gt;$b_{ij} = \mathrm{e^{i a_{ij}}}$&lt;/span&gt; in order to represent distances among cities as a phase. Note that &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt; are normalized on interval &lt;span class=&quot;math-container&quot;&gt;$(0;2\pi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, for each city a diagonal matrix &lt;span class=&quot;math-container&quot;&gt;$U^{(i)}$&lt;/span&gt; is constructed. An element &lt;span class=&quot;math-container&quot;&gt;$u^{(i)}_{jj} = b_{ij}$&lt;/span&gt; i.e. a distance from city &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; to city &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then a final operator &lt;span class=&quot;math-container&quot;&gt;$U = U^{(1)}\otimes U^{(2)} \otimes \dots \otimes U^{(N)}$&lt;/span&gt; is constructed. The matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is constructed, &lt;span class=&quot;math-container&quot;&gt;$(N-1)!$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$N^N$&lt;/span&gt; diagonal elements contain length of all possible Hamiltonian cycles in TSP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each Hamiltonian cycle can be represented wiht eigenvector obtained followingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \otimes_{j} |i(j) - 1\rangle&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$j \in \{1\dots N\}$&lt;/span&gt; and function &lt;span class=&quot;math-container&quot;&gt;$i(j)$&lt;/span&gt; returns city &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; we traveled to &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; from. For example, consider four cities and cycle &lt;span class=&quot;math-container&quot;&gt;$1 \rightarrow 2 \rightarrow 3\rightarrow 4\rightarrow 1$&lt;/span&gt;. In this case&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$i(1) - 1 = 4 - 1 = 3$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|3_{10}\rangle = |11\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$i(2) - 1 = 1 - 1 = 0$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|0_{10}\rangle = |00\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$i(3) - 1 = 2 - 1 = 1$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|1_{10}\rangle = |01\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$i(4) - 1 = 3 - 1 = 2$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|2_{10}\rangle = |10\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hence &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |11 00 01 10\rangle$&lt;/span&gt;. Multiplication &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt; returns lenght of the Hamiltonian cycle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This setting allows to use phase estimation to get lenght of a cycle. Setting respective &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; as an input to phase estimation leads after inverse Fourier transform to obtaining lenght of the cycle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So far, I understand everything. However, the authors proposed:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We get the phases in form of binary output from&#xA;  phase estimation algorithm, then we can easily perform&#xA;  the quantum algorithm for finding the minimum [10] to find the minimum cost and the corresponding route that&#xA;  is to be taken for that particular cost.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that [10] is the second article I mentioned above.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the complexity of minimum finding is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; we get quadratic speed-up for TSP solving, so complexity of TSP would be &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{(N-1)!})$&lt;/span&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But to prepare all cycles in advance will take &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}((N-1)!)$&lt;/span&gt; time unless there is a faster algorithm for permutation generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Where does the speed-up come from if we need to have all Hamiltonian cycles in TSP listed in advance?&lt;/li&gt;&#xA;&lt;li&gt;Is there a quantum algorithm for preparing all permutation of set &lt;span class=&quot;math-container&quot;&gt;$\{1 \dots N\}$&lt;/span&gt; faster than on classical computer?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: since the paper is a pre-print there are some mistakes, e.g. &lt;span class=&quot;math-container&quot;&gt;$d+c-a-b$&lt;/span&gt; in equation (8) should be d-c+a-b. Figure S1 is not completed, moreover, there is a more efficient way how to implement &lt;span class=&quot;math-container&quot;&gt;$\mathrm{C-U^{(i)}}$&lt;/span&gt; gate (avoiding Toffolis).&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-12T22:00:53.797" LastActivityDate="2020-02-03T11:04:35.277" Title="Travelling salesman problem on quantum computer" Tags="&lt;speedup&gt;&lt;optimization&gt;&lt;phase-estimation&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9508" PostTypeId="1" CreationDate="2020-01-12T22:23:11.537" Score="3" ViewCount="65" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="4693" LastActivityDate="2020-01-12T22:23:11.537" Title="What are quantum inspired algorithms?" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9509" PostTypeId="2" ParentId="9504" CreationDate="2020-01-13T06:47:44.153" Score="3" Body="&lt;p&gt;Suppose you have 2-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{AB}$&lt;/span&gt;. Entangled or not, you can always write it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle_{AB}=a_0|0\rangle_A|\psi_0\rangle_{B}+a_1|1\rangle_A|\psi_1\rangle_{B}$$&lt;/span&gt;&#xA;If you measure qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then the qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt;, and you can compute the probability of qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; being in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|\langle 0|\psi_0\rangle|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the probability tells you nothing about possible entanglement of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{AB}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have an unknown state, there is no way to tell whether the state is entangled or not by doing a single measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a known state, you can detect entanglement by computing &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0204041&quot; rel=&quot;nofollow noreferrer&quot;&gt;concurrence&lt;/a&gt;. For a pure state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle =a_{00}|00\rangle+a_{01}|01\rangle+a_{10}|10\rangle+a_{11}|11\rangle$$&lt;/span&gt;&#xA;concurrence is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$C(|\psi\rangle)=2|a_{00}a_{11}-a_{01}a_{10}|$$&lt;/span&gt;&#xA;If concurrence is zero, the state is not entangled, otherwise it is entangled.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-01-17T19:12:16.820" LastActivityDate="2020-01-17T19:12:16.820" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9511" PostTypeId="2" ParentId="9490" CreationDate="2020-01-13T09:13:33.307" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="7855" LastActivityDate="2020-01-13T09:13:33.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9512" PostTypeId="1" CreationDate="2020-01-13T09:45:11.333" Score="4" ViewCount="256" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The answer for Julia: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9360/qiskit-in-julia-language&quot;&gt;Qiskit in Julia language?&lt;/a&gt; is related but not the same. I have edited the question for C#, JavaScript and Lua specifically.&lt;/p&gt;&#xA;" OwnerUserId="7474" LastEditorUserId="7474" LastEditDate="2020-01-13T15:15:10.457" LastActivityDate="2021-03-06T20:02:10.293" Title="Use Qiskit in other programming languages (C#, JavaScript and Lua)" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9513" PostTypeId="1" AcceptedAnswerId="9549" CreationDate="2020-01-13T14:49:46.573" Score="1" ViewCount="160" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \psi \right\rangle = \frac{\sqrt{2}}{2} (\left| 00 \right\rangle + \left| 11 \right\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the ratio in a 2-qubits system should be 50%, but what about &lt;span class=&quot;math-container&quot;&gt;$n=100$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To improve the clarity of the question I would ask, how do you interpret this kind of graph?&lt;a href=&quot;https://i.stack.imgur.com/ig5Vx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ig5Vx.png&quot; alt=&quot;Product = a state that can be decomposed uniquely by a tensorr product. Entangled = it&amp;#39;s own defition.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where Product = a state that can be decomposed uniquely by a tensor product. Entangled = it's own defition.&#xA;Is this a true picture of what's going on in an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system or not? &lt;/p&gt;&#xA;" OwnerUserId="9238" LastEditorUserId="55" LastEditDate="2020-11-10T17:36:18.073" LastActivityDate="2020-11-10T17:36:18.073" Title="How many $n$-qubit states are entangled?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="9514" PostTypeId="2" ParentId="9504" CreationDate="2020-01-13T14:52:16.873" Score="3" Body="&lt;p&gt;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 &lt;em&gt;separable&lt;/em&gt; state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When two qubits are &lt;strong&gt;not&lt;/strong&gt; entangled, the state of the one qubit can be described without any knowledge of the state of the other qubit. Mathematically we can write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle_{AB,\mathrm{sep}} = |\psi\rangle_{A}|\phi\rangle_{B}.&#xA;\end{equation}&lt;/span&gt;&#xA;That is to say, the first qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{A}$&lt;/span&gt;, and the second qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle_{B}$&lt;/span&gt;; 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 &lt;em&gt;separable&lt;/em&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Entangled&lt;/em&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\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},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;meaning that when the first qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle_{A}$&lt;/span&gt;, we know the second qubit to be in state &lt;span class=&quot;math-container&quot;&gt;$|\phi_{1}\rangle_{B}$&lt;/span&gt;, and likewise for &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle_{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_{2}\rangle_{B}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$|\phi_{1}\rangle_{B} = |\phi_{2}\rangle_{B}$&lt;/span&gt; we end up with just a separable state &lt;span class=&quot;math-container&quot;&gt;$\big(a_{1}|\psi_{1}\rangle_{A} + a_{2}|\psi_{2}\rangle_{A}\big)|\phi_{2}\rangle_{B}$&lt;/span&gt;. So, our general expression gives us an entangled state whenever this is not the case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\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},&#xA;\end{equation}&lt;/span&gt;&#xA;when &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle_{A} \not= |\psi_{2}\rangle_{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_{1}\rangle_{B} \not= |\phi_{2}\rangle_{B}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, when &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_{0}|\psi_{1}\rangle = 0 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \langle\phi_{0}|\phi_{1}\rangle = 0$&lt;/span&gt; (they are orthogonal to each other) we have what we call a &lt;em&gt;maximally entangled state.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-01-20T10:10:41.440" LastActivityDate="2020-01-20T10:10:41.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9515" PostTypeId="1" AcceptedAnswerId="9521" CreationDate="2020-01-13T15:11:18.200" Score="1" ViewCount="217" Body="&lt;p&gt;I want to realize this error correction circuit.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1ytis.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1ytis.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do that, I created a circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ho9YT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ho9YT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I cannot execute on real hardware.&#xA;How can I create a circuit to realize this correction on real hardware?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2020-01-13T18:37:41.187" Title="How to realize this quantum error correction circuit on real hardware?" Tags="&lt;qiskit&gt;&lt;error-correction&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9516" PostTypeId="2" ParentId="9515" CreationDate="2020-01-13T15:24:35.137" Score="1" Body="&lt;p&gt;AFAIK, this is impossible on IBM's current hardware. See this github issue: &lt;a href=&quot;https://github.com/Qiskit/qiskit-textbook/issues/119&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-textbook/issues/119&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1790" LastActivityDate="2020-01-13T15:24:35.137" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9517" PostTypeId="2" ParentId="9515" CreationDate="2020-01-13T15:31:19.633" Score="2" Body="&lt;p&gt;I don't think that this will be possible on real current quantum hardware. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/8fb0e08bbace67518e5074e6734ecbd4f75d0d75/qiskit/advanced/aer/3_building_noise_models.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;This tutorial&lt;/a&gt; teaches you how to build a noise model.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-01-13T15:31:19.633" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9519" PostTypeId="1" CreationDate="2020-01-13T17:06:55.020" Score="1" ViewCount="65" Body="&lt;p&gt;What would be the outcome of this circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/A1z1U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A1z1U.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9777" LastActivityDate="2020-01-13T18:07:17.083" Title="What is the outcome of this circuit?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9520" PostTypeId="2" ParentId="9519" CreationDate="2020-01-13T17:19:21.530" Score="4" Body="&lt;p&gt;The outcome is &lt;span class=&quot;math-container&quot;&gt;$-i\left| 11 \right\rangle&#xA;$&lt;/span&gt;. Here is how I obtained it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| 01 \right\rangle \xrightarrow{\text{X}}&#xA;\left| 11 \right\rangle \xrightarrow{\text{Y}}&#xA;-i\left| 10 \right\rangle  \xrightarrow{\text{CNOT}}&#xA;-i\left| 11 \right\rangle  \xrightarrow{\text{SWAP}}&#xA;-i\left| 11 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate changes 0 to 1, and 1 to 0:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X \left| 0 \right\rangle = \left| 1 \right\rangle &#xA;\qquad&#xA;X \left| 1 \right\rangle = \left| 0 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate also changes 0 to 1, and 1 to 0, but also changes the phase of the qubit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y \left| 0 \right\rangle = i\left| 1 \right\rangle &#xA;\qquad&#xA;Y \left| 1 \right\rangle = -i\left| 0 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT changes the second qubit if the first qubit is in &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right\rangle$&lt;/span&gt; state and does nothing if the first qubit is in &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT \left| 00 \right\rangle = \left| 00 \right\rangle &#xA;\qquad&#xA;CNOT \left| 01 \right\rangle = \left| 01 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT \left| 10 \right\rangle = \left| 11 \right\rangle&#xA;\qquad&#xA;CNOT \left| 11 \right\rangle = \left| 10 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SWAP gate changes the qubits, first qubit's state becomes the state of the second qubit and vice versa:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;SWAP \left| 00 \right\rangle = \left| 00 \right\rangle &#xA;\qquad&#xA;SWAP \left| 01 \right\rangle = \left| 10 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;SWAP \left| 10 \right\rangle = \left| 01 \right\rangle&#xA;\qquad&#xA;SWAP \left| 11 \right\rangle = \left| 11 \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-01-13T18:07:17.083" LastActivityDate="2020-01-13T18:07:17.083" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="9521" PostTypeId="2" ParentId="9515" CreationDate="2020-01-13T18:37:41.187" Score="1" Body="&lt;p&gt;You can simply control &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates with qubits &lt;span class=&quot;math-container&quot;&gt;$q3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q4$&lt;/span&gt;. You DO NOT have to measure them firstly and then use classical bits for controlling. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason is that in quantum computing, controling some qubit with other qubits or with their measured results in classical register is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, you can implement the algorithm on real quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-13T18:37:41.187" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9522" PostTypeId="1" AcceptedAnswerId="9527" CreationDate="2020-01-13T18:40:46.273" Score="4" ViewCount="74" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9633" LastActivityDate="2020-01-13T23:16:58.643" Title="Logical Explanation behind second reflection in Grover's algorithm" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9524" PostTypeId="2" ParentId="9471" CreationDate="2020-01-13T19:01:01.250" Score="2" Body="&lt;p&gt;If you have one parameter (one &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;) 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if you are obtaining the second circuit with two parameters (two different &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zRnd5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zRnd5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; corresponds to one &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is the value that VQE obtains depending on  &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. For VQE this optimization is like &quot;crossing the street perpendicularly&quot; (the shortest way). You are restricting VQE in 1D space (You are restricting VQE &quot;to cross the street only perpendicularly&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now Imagine parabolic cylinder in 3D space:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UohWA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UohWA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; correspond to two &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; parameters and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is the value that VQE obtains depending on the two &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;s. Now you are giving freedom to VQE optimization to choose from a broad range of &quot;paths&quot; for finding to way to the minimal value. For example, now VQE can choose not the shortest path to the minimum (it may not &quot;cross the street perpendicularly&quot;, it may &quot;cross the street at an angle&quot; XD).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, this is just my intuition.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-01-13T21:50:39.680" LastActivityDate="2020-01-13T21:50:39.680" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9525" PostTypeId="2" ParentId="9375" CreationDate="2020-01-13T21:23:21.660" Score="2" Body="&lt;p&gt;One thing that I noticed. If cu3 gate from &lt;span class=&quot;math-container&quot;&gt;$q[2]$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q[0]$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then the cu3 from &lt;span class=&quot;math-container&quot;&gt;$q[2]$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q[0]$&lt;/span&gt; should be &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cu3(1.6, -1.12, 2.03) q[2] q[3]&#xA;&#xA;cu3(1.6, -1.12, 2.03) q[1] q[3]&#xA;cu3(1.6, -1.12, 2.03) q[1] q[3]&#xA;&#xA;cu3(1.6, -1.12, 2.03) q[0] q[3]&#xA;cu3(1.6, -1.12, 2.03) q[0] q[3]&#xA;cu3(1.6, -1.12, 2.03) q[0] q[3]&#xA;cu3(1.6, -1.12, 2.03) q[0] q[3]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And obtained a different result via IBM's 'qasm simulator':&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'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}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the sum of '1111' and '0111' outcomes is maximum (here 506 from 1024 measurements) as was obtained in the paper.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-01-13T22:25:28.003" LastActivityDate="2020-01-13T22:25:28.003" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9526" PostTypeId="1" CreationDate="2020-01-13T21:36:51.627" Score="1" ViewCount="68" Body="&lt;p&gt;Suppose there are two quits called &lt;code&gt;q1&lt;/code&gt; and &lt;code&gt;q2&lt;/code&gt;. They are in two different superposition states. If we represent their states on the Bloch sphere surface, &lt;code&gt;q1&lt;/code&gt; is located at &lt;code&gt;point_1&lt;/code&gt; and &lt;code&gt;q2&lt;/code&gt; is placed at &lt;code&gt;point_2&lt;/code&gt;. Please note that &lt;code&gt;point_1&lt;/code&gt; is different from &lt;code&gt;point_2&lt;/code&gt; and we know where &lt;code&gt;point1&lt;/code&gt; and &lt;code&gt;point2&lt;/code&gt; are. Now, my question consists of two parts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How to make &lt;code&gt;q1&lt;/code&gt; and &lt;code&gt;q2&lt;/code&gt; entangled?&lt;/li&gt;&#xA;&lt;li&gt;After making them entangled, how to check if they are entangled indeed?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="8487" LastEditDate="2020-01-13T21:45:33.760" LastActivityDate="2020-01-13T21:45:33.760" Title="How to know if any two arbitrary qubits are entangled?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ClosedDate="2020-01-14T23:12:29.913" ContentLicense="CC BY-SA 4.0" />
  <row Id="9527" PostTypeId="2" ParentId="9522" CreationDate="2020-01-13T23:16:58.643" Score="3" Body="&lt;p&gt;An application of the reflection operator change each amplitude of a basis state &lt;span class=&quot;math-container&quot;&gt;$ |i\rangle$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \alpha_i \rightarrow- \alpha_i + 2 \langle\alpha\rangle\ $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$ \langle\alpha\rangle\ $&lt;/span&gt; is the average of all amplitudes. &#xA;It follows the oracle which is use to &quot;mark&quot; the seeked elements &lt;span class=&quot;math-container&quot;&gt;$ |i\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say for instance that you have 8 elements, so you work on 3 qubits and you want to output &lt;span class=&quot;math-container&quot;&gt;$ |011\rangle$&lt;/span&gt; with high probability. At the beginning, each basis state has &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{8}$&lt;/span&gt; probability to be measured as their amplitude are &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{8}}$&lt;/span&gt;.&#xA;The oracle first will mark &lt;span class=&quot;math-container&quot;&gt;$ |011\rangle$&lt;/span&gt;, so its amplitude will be &lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{\sqrt{8}} = -\frac{1}{2\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the amplitude of &lt;span class=&quot;math-container&quot;&gt;$ |011\rangle$&lt;/span&gt; after the reflection operator becomes &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ - (-\frac{1}{2\sqrt{2}}) + 2\langle\alpha\rangle\ = \frac{5}{4\sqrt{2}} $$&lt;/span&gt;&#xA;while others will have a new amplitude:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ - (\frac{1}{2\sqrt{2}}) + 2*\frac{3}{8\sqrt{2}} = \frac{1}{4\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you square those amplitudes, then &lt;span class=&quot;math-container&quot;&gt;$ |011\rangle$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$\frac{25}{32} \approx 0.78 &amp;gt; \frac{1}{8}$&lt;/span&gt; probability to be measured, while another state will have &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{32}$&lt;/span&gt; probability to be measured. You see the probability of the solution to be outputed increased while non-solutions less likely to be.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-01-13T23:16:58.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9529" PostTypeId="1" AcceptedAnswerId="9530" CreationDate="2020-01-14T10:57:34.540" Score="0" ViewCount="125" Body="&lt;p&gt;Consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right&amp;gt;=\frac{i}{\sqrt{3}} \left| 0 \right&amp;gt; + \sqrt{\frac{2}{3}} \left| 1\right&amp;gt;.&#xA;$$&lt;/span&gt;&#xA;What is the probability of qubit system when measured in the state &lt;span class=&quot;math-container&quot;&gt;$\left| + \right&amp;gt;$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-01-17T11:32:13.723" LastActivityDate="2020-01-17T11:32:13.723" Title="How to compute the probability of finding a given state in the $|+\rangle$ state?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9530" PostTypeId="2" ParentId="9529" CreationDate="2020-01-14T11:09:15.553" Score="3" Body="&lt;p&gt;It is known that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| 0 \right\rangle = \frac{1}{\sqrt{2}} \left( \left| + \right\rangle + \left| - \right\rangle \right)&#xA;\qquad&#xA;\left| 1 \right\rangle = \frac{1}{\sqrt{2}} \left( \left| + \right\rangle - \left| - \right\rangle \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By substituting in the initial state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \varphi \right\rangle = \frac{i}{\sqrt{3}}\left| 0 \right\rangle + \frac{\sqrt{2}}{\sqrt{3}}\left| 1 \right\rangle = &#xA;\frac{i + \sqrt{2}}{\sqrt{6}} \left| + \right\rangle + &#xA;\frac{i - \sqrt{2}}{\sqrt{6}} \left| - \right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the probability to measure the qubit in the &lt;span class=&quot;math-container&quot;&gt;$\left| + \right\rangle$&lt;/span&gt; state is equal to &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{i + \sqrt{2}}{\sqrt{6}}\right|^2 = 0.5$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-01-14T11:09:15.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9531" PostTypeId="1" AcceptedAnswerId="9532" CreationDate="2020-01-14T11:10:16.260" Score="1" ViewCount="216" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Reflection:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/S7X7A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/S7X7A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probabilities:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/swxC3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/swxC3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9633" LastEditorUserId="9006" LastEditDate="2020-01-14T22:29:09.850" LastActivityDate="2020-01-14T22:29:09.850" Title="Grover diffusion operator for a 3 qubit system" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9532" PostTypeId="2" ParentId="9531" CreationDate="2020-01-14T13:45:10.250" Score="1" Body="&lt;p&gt;It seems that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; gates should not be in your circuit. Here is Grover algorithm for 3 qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hwIqj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hwIqj.png&quot; alt=&quot;Grover algorithm - 3 qubits&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put your Oracle instead of dashed line. The Oracle should have three inputs &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;, output should be on qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; after &lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-14T22:28:26.340" LastActivityDate="2020-01-14T22:28:26.340" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9533" PostTypeId="2" ParentId="2310" CreationDate="2020-01-14T14:45:34.870" Score="3" Body="&lt;p&gt;Here is an implementation of a circuit producing state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{3}}(|00\rangle + |01\rangle + |10\rangle)$&lt;/span&gt; on IBM Q:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5yfIG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5yfIG.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\theta = 1.2310$&lt;/span&gt;&lt;/em&gt; for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{4}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta = -\frac{\pi}{4}$&lt;/span&gt; for first and second &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; prepares qubit in superposition &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle = \sqrt{\frac{2}{3}}|0\rangle + \frac{1}{\sqrt{3}}|1\rangle$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}$&lt;/span&gt; gates on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; implements controlled Hadamard gate. When &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;  the Hadamard acts on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; thanks to negation &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt;. This happens with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt;. Since Hadamard turns &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, i.e. equally distributed superposition, final states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; can be measured with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;. When &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, controled Hadamard does not act and state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; is measured. Since &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; is measured also with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-14T14:45:34.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9534" PostTypeId="1" CreationDate="2020-01-14T16:25:59.833" Score="5" ViewCount="218" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2021-02-23T10:00:20.033" Title="Stabilizer circuit synthesis via Clifford gates" Tags="&lt;circuit-construction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9535" PostTypeId="1" CreationDate="2020-01-14T19:05:15.327" Score="2" ViewCount="109" Body="&lt;p&gt;I'm writing a 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.&#xA;Here's the code and the circuit together with the result it outputs:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FgGFe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FgGFe.png&quot; alt=&quot;Output&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import (QuantumCircuit, execute, Aer, IBMQ)&#xA;import math&#xA;import random &#xA;from qiskit.visualization import plot_histogram&#xA;import qiskit&#xA;&#xA;variables = 3&#xA;clausules = 2&#xA;treball = variables - 2&#xA;temp = clausules - 1&#xA;total = variables + clausules + treball + temp&#xA;&#xA;&#xA;funcio = [['0', '-1', '-2'], ['0', '1', '2']]&#xA;&#xA;pro_vars = []&#xA;pro_vals = []&#xA;&#xA;# Process input&#xA;for i in range(len(funcio)):&#xA;    pro_vars.append([])&#xA;    pro_vals.append([])&#xA;&#xA;    for j in range(len(funcio[i])):&#xA;&#xA;        if funcio[i][j][0] == '-':&#xA;            pro_vals[i].append(0)&#xA;            pro_vars[i].append(int(funcio[i][j][1]))&#xA;&#xA;        else:&#xA;            pro_vals[i].append(1)&#xA;            pro_vars[i].append(int(funcio[i][j]))&#xA;&#xA;#Quantum algorithm&#xA;opt_iter = 1#int(math.pi / 4 * math.sqrt(2**variables))&#xA;&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;&#xA;circuit = QuantumCircuit(variables + clausules + treball + temp + 1, variables)&#xA;&#xA;# Qubit inicialization&#xA;for i in range(variables):&#xA;    circuit.h(i)&#xA;&#xA;circuit.h(total)&#xA;circuit.x(total)&#xA;&#xA;def grover():&#xA;&#xA;    #Set work qubits to state 0&#xA;    for i in range(variables, variables + treball):&#xA;        circuit.reset(i)&#xA;&#xA;&#xA;    #Oracle&#xA;    for i in range(clausules):&#xA;        for j in range(3):&#xA;&#xA;            if (pro_vals[i][j] == 0):&#xA;                circuit.x(int(pro_vars[i][j]))&#xA;&#xA;        control = circuit.qbit_argument_conversion(range(variables))&#xA;&#xA;        work = circuit.qbit_argument_conversion(range(variables, variables + treball))&#xA;&#xA;        target = circuit.qbit_argument_conversion(variables + treball + i)&#xA;&#xA;        circuit.barrier()&#xA;        circuit.OR(control, target[0], work)&#xA;        circuit.barrier()&#xA;&#xA;        for k in range(treball):&#xA;&#xA;                circuit.reset(variables + k)    &#xA;&#xA;&#xA;        for j in range(len(pro_vars[i])):&#xA;&#xA;            if pro_vals[i][j] == 0:&#xA;                circuit.x(pro_vars[i][j])    &#xA;&#xA;    circuit.ccx(variables + treball, variables + treball + 1, variables + treball + clausules)&#xA;&#xA;    for i in range(0, temp - 1):&#xA;        control1 = variables + treball + 2 + i&#xA;        control2 = variables + treball + clausules + i&#xA;        targetf = control2 + 1&#xA;        circuit.ccx(control1,control2, targetf)&#xA;&#xA;    circuit.cx(total - 1, total)&#xA;    circuit.barrier()&#xA;&#xA;    #Grover diffusion operator&#xA;    for i in range(variables):&#xA;        circuit.h(i)&#xA;        circuit.x(i)&#xA;&#xA;    circuit.h(variables-1)&#xA;&#xA;    circuit.ccx(0,1,variables)&#xA;&#xA;    for i in range(0,variables-3):&#xA;        circuit.ccx(i+2, variables + i, variables + 1 + i)&#xA;        t1 = variables + 1 + i&#xA;    circuit.cx(2 * (variables - 1) - 1, variables - 1)&#xA;    circuit.barrier()&#xA;    circuit.h(variables-1)    &#xA;    circuit.barrier()&#xA;    for i in range(variables):&#xA;        circuit.x(i)&#xA;        circuit.h(i)&#xA;&#xA;&#xA;for i in range(opt_iter):&#xA;    grover()        &#xA;&#xA;circuit.measure(range(variables), range(variables))    &#xA;&#xA;job = execute(circuit, simulator, shots=1024)&#xA;result = job.result()&#xA;counts = result.get_counts(circuit)&#xA;&#xA;print(&quot;function: &quot;, funcio)&#xA;&#xA;plot_histogram(counts)&#xA;&#xA;#circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xmTHo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xmTHo.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9788" LastEditorUserId="9788" LastEditDate="2020-01-14T22:29:07.680" LastActivityDate="2020-01-14T22:29:07.680" Title="Grover's algorithm for 3SAT problem gives erroneous results" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;ibm&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9536" PostTypeId="1" AcceptedAnswerId="9543" CreationDate="2020-01-14T20:09:53.313" Score="7" ViewCount="477" Body="&lt;p&gt;Observing the violation of Bell inequalities, be it &lt;a href=&quot;https://journals.aps.org/ppf/abstract/10.1103/PhysicsPhysiqueFizika.1.195&quot; rel=&quot;noreferrer&quot;&gt;in their original formulation&lt;/a&gt;, or in the nowadays more commonly used &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;noreferrer&quot;&gt;CHSH formulation&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there scenarios in which Bell nonlocality can be observed &lt;em&gt;without&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-11-10T17:36:11.070" LastActivityDate="2020-11-10T17:36:11.070" Title="Are there Bell-like violations that can be observed without collecting statistics?" Tags="&lt;resource-request&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9538" PostTypeId="2" ParentId="9496" CreationDate="2020-01-14T21:02:22.650" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;newtype FunOptions = (&#xA;   N : Int,&#xA;   SomeOtherOption : Double[]&#xA;);&#xA;&#xA;function DefaultFunOptions() : FunOptions {&#xA;    return (0, [0.0]);&#xA;}&#xA;&#xA;function Fun(options : FunOptions) : Double {&#xA;    // do something using options::N and options::SomeOtherOption&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This lets you call &lt;code&gt;Fun&lt;/code&gt; by using the &lt;code&gt;w/&lt;/code&gt; to provide optional arguments as you see fit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let w = Fun(DefaultFunOptions());&#xA;let x = Fun(DefaultFunOptions() w/ N &amp;lt;- 10);&#xA;let y = Fun(DefaultFunOptions() w/ SomeOtherOption &amp;lt;- [0.1, 0.2]);&#xA;let z = Fun(DefaultFunOptions() w/ N &amp;lt;- 42 w/ SomeOtherOption &amp;lt;- [0.1, 0.2]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;TrainingOptions&lt;/code&gt; UDT was first introduced at &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/pull/187&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/QuantumLibraries/pull/187&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-01-14T21:02:22.650" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9539" PostTypeId="2" ParentId="9536" CreationDate="2020-01-14T21:22:37.070" Score="1" Body="&lt;p&gt;Original paper: &lt;a href=&quot;https://arxiv.org/abs/0712.0921&quot; rel=&quot;nofollow noreferrer&quot;&gt;Going beyond Bell's theorem&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Papers by Mermin:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.physics.smu.edu/scalise/P5382fa15/Mermin1990a.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum mysteries revisited&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1802.10119.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hidden variables and the two theorems of John Bell&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;We can give a non-probabilistic proof that local hidden variables theories are incompatible with Quantum Mechanics.&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proof:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose we have 3-qubit GHZ state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|GHZ\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle)$$&lt;/span&gt;&#xA;For visibility sake think of a qubit as of a spin &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; particle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can measure spin in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; directions; &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; direction means Hadamard basis &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; direction means &lt;span class=&quot;math-container&quot;&gt;$\{\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle), \frac{1}{\sqrt{2}}(|0\rangle-i|1\rangle)\}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, Quantum Mechanics predicts that if we measure 2 qubits in &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; direction and 1 qubit in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; direction, each qubit's measurement outcome is &lt;span class=&quot;math-container&quot;&gt;$50\% / 50\%$&lt;/span&gt; random, but there is strong correlation: the outcomes of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; measurements determine the outcome of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; measurement; namely, if &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; measurements are identical, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; measurement is &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, otherwise &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;. Following Einstein's &quot;elements of reality&quot; concept, it means that each qubit has deterministic &quot;instructions&quot; how to behave if measured in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; direction, and the set of legal instructions for all 3 qubits in GHZ experiment is limited.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the 1st cited Mermin paper, the legal instructions are (first line &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; measurement, second line &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; measurement):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; ---  -++  +-+  ++-  -++  ---  ++-  +-+&#xA; ---  -++  +-+  ++-  +--  +++  --+  -+-&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It now turns out that if we apply legal instructions approach to measuring all 3 qubits in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; direction, the only possible outcomes are &lt;span class=&quot;math-container&quot;&gt;$|---\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-++\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+-+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|++-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, quantum mechanics predicts that the only possible outcomes are &lt;span class=&quot;math-container&quot;&gt;$|+++\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+--\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-+-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|--+\rangle$&lt;/span&gt;, because&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|GHZ\rangle = \frac12(|+++\rangle+|+--\rangle+|-+-\rangle+|--+\rangle)$$&lt;/span&gt;&#xA;and we have no overlap with legal instructions (hidden variables) approach.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-01-21T14:05:18.940" LastActivityDate="2020-01-21T14:05:18.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9540" PostTypeId="2" ParentId="6201" CreationDate="2020-01-15T01:34:14.270" Score="3" Body="&lt;p&gt;Have you tried the Bloch Sphere Playground Application? It just might be what you are looking for. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://javafxpert.github.io/grok-bloch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch Sphere Playground Application&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://javafxpert.github.io/grok-bloch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://javafxpert.github.io/grok-bloch/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4963" LastActivityDate="2020-01-15T01:34:14.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9541" PostTypeId="1" CreationDate="2020-01-15T01:45:16.243" Score="3" ViewCount="50" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm searching for good quantum computing illustration packages or frameworks for visually teaching various aspects of QC that are interactive in nature? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some other examples are the Bloch Sphere Playground and the Quantum State Sphere Playground. (links below)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My preference is for interactive vehicles like &quot;Immersive Math&quot; when it comes to explaining linear algebra concepts visually and interactively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QUIRK&lt;/strong&gt;: - &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/quirk&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;OReilly QC&lt;/strong&gt;: - &lt;a href=&quot;https://oreilly-qc.github.io/#&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://oreilly-qc.github.io/#&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Immersive Math&lt;/strong&gt;: - &lt;a href=&quot;http://immersivemath.com/ila/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://immersivemath.com/ila/index.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bloch Sphere Playground&lt;/strong&gt;: &lt;a href=&quot;https://javafxpert.github.io/grok-bloch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://javafxpert.github.io/grok-bloch/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Quantum State Sphere Playground&lt;/strong&gt;: &lt;a href=&quot;https://javafxpert.github.io/quantum-state-spheres/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://javafxpert.github.io/quantum-state-spheres/&lt;/a&gt;  &lt;/p&gt;&#xA;" OwnerUserId="4963" LastEditorUserId="5955" LastEditDate="2020-01-15T12:49:37.500" LastActivityDate="2020-01-15T12:49:37.500" Title="Does anyone have any really good quantum computing illustration packages or frameworks for visually teaching various aspects of QC?" Tags="&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9543" PostTypeId="2" ParentId="9536" CreationDate="2020-01-15T03:56:17.330" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there scenarios in which Bell nonlocality can be observed without such averages, that is, in a single-shot scenario?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a single-shot experiment to work, you need a game with an outcome that has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Bayes_factor&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bayes factor&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can have game where entangled strategies have a 100% success rate, such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_pseudo-telepathy&quot; rel=&quot;nofollow noreferrer&quot;&gt;mermin-peres game&lt;/a&gt;, but the Bayes factor of that game is not infinity because the classical strategy has a success rate of 8/9 &gt; 0.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-01-19T21:17:27.707" LastActivityDate="2020-01-19T21:17:27.707" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9544" PostTypeId="1" AcceptedAnswerId="9546" CreationDate="2020-01-15T04:09:59.413" Score="1" ViewCount="129" Body="&lt;p&gt;Can qubit be inside Bloch Sphere, i.e. its length is less than 1?&lt;br&gt;&#xA;If yes, how we represent that state since we have only parameter for angles and not the length (norm) of the vector?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="55" LastEditDate="2020-01-16T12:10:07.270" LastActivityDate="2020-01-16T12:10:07.270" Title="Can a qubit be in the inside of the Bloch Sphere?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9545" PostTypeId="2" ParentId="9484" CreationDate="2020-01-15T04:58:44.770" Score="1" Body="&lt;p&gt;It seems that docplex class also was moved to from qiskit.optimization.ising import docplex&lt;/p&gt;&#xA;" OwnerUserId="8042" LastActivityDate="2020-01-15T04:58:44.770" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9546" PostTypeId="2" ParentId="9544" CreationDate="2020-01-15T05:43:30.020" Score="3" Body="&lt;p&gt;Mixed states are represented by vectors inside Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose you have mixed state with density matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=q|\psi\rangle\langle\psi| + (1-q)|\phi\rangle\langle\phi|$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; are pure states with vectors &lt;span class=&quot;math-container&quot;&gt;$\overset{\rightarrow}{r_{\psi}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\overset{\rightarrow}{r_{\phi}}$&lt;/span&gt; on Bloch sphere, and &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;q&amp;lt;1$&lt;/span&gt;; then the vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\overset{\rightarrow}{r_{\rho}}=q\overset{\rightarrow}{r_{\psi}}+(1-q)\overset{\rightarrow}{r_{\phi}}$$&lt;/span&gt;&#xA;inside Bloch sphere represents mixed state with density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Geometrically, &lt;span class=&quot;math-container&quot;&gt;$\overset{\rightarrow}{r_{\rho}}$&lt;/span&gt; is a point on the line connecting points &lt;span class=&quot;math-container&quot;&gt;$\overset{\rightarrow}{r_{\psi}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\overset{\rightarrow}{r_{\phi}}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-01-15T05:43:30.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9547" PostTypeId="2" ParentId="9544" CreationDate="2020-01-15T07:32:54.337" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-15T07:32:54.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9548" PostTypeId="2" ParentId="9536" CreationDate="2020-01-15T07:56:00.117" Score="3" Body="&lt;p&gt;I believe you're thinking of the all-versus-nothing proofs based on GHZ states. You start with a state such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle)&#xA;$$&lt;/span&gt;&#xA;and you select at random one of the four measurements to implement: &lt;span class=&quot;math-container&quot;&gt;$X\otimes X\otimes X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X\otimes Y\otimes Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y\otimes X\otimes Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y\otimes Y\otimes X$&lt;/span&gt;. Assuming every one of these can be implemented perfectly every time, you must always get the answer -1 (just calculate &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi|M|\Psi\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is one of the measurement operators) for any of the measurements with two &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;s, and +1 for the &lt;span class=&quot;math-container&quot;&gt;$XXX$&lt;/span&gt; measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if the outcomes are associated with a local hidden variable model, this outcome is impossible. Let &lt;span class=&quot;math-container&quot;&gt;$x_i\in\{-1,1\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_i\in\{-1,1\}$&lt;/span&gt; be the hidden variables associated with the outcomes of measuring &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; respectively on qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. The local hidden variable model, however, says that answer must be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(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.&#xA;$$&lt;/span&gt;&#xA;A local hidden variable model is incompatible with always getting the predicted set of quantum answers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; runs, there's a probability of &lt;span class=&quot;math-container&quot;&gt;$1/4^n$&lt;/span&gt; that the local hidden variable version gives all the expected quantum answer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-15T07:56:00.117" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9549" PostTypeId="2" ParentId="9513" CreationDate="2020-01-15T10:09:30.327" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is shown in &lt;a href=&quot;https://physics.stackexchange.com/a/268853/58382&quot;&gt;this answer on physics.SE&lt;/a&gt;. &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.65.064304&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; might also be of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://math.stackexchange.com/a/1872332/173147&quot;&gt;this post on math.SE&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another less rigorous argument could be to observe that separable states are always infinitesimally close to entangled out: given an arbitrary separable pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\otimes|\phi\rangle$&lt;/span&gt;, take &lt;span class=&quot;math-container&quot;&gt;$|u\rangle,|v\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle\equiv\langle u|\psi\rangle=\langle v|\phi\rangle=0$&lt;/span&gt;. Then, the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{1+\epsilon^2}}\left[|\Psi\rangle+\epsilon(|u\rangle\otimes|v\rangle)\right]$$&lt;/span&gt;&#xA;is entangled for all &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt; and can be made to be infinitesimally close to &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. 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. &lt;a href=&quot;https://golem.ph.utexas.edu/category/2010/08/the_difference_between_measure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-01-15T10:25:50.363" LastActivityDate="2020-01-15T10:25:50.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9550" PostTypeId="1" AcceptedAnswerId="9551" CreationDate="2020-01-15T12:44:03.770" Score="4" ViewCount="401" Body="&lt;p&gt;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. &#xA;A widely known example being the &lt;a href=&quot;https://arxiv.org/abs/1202.5822&quot; rel=&quot;nofollow noreferrer&quot;&gt;LCU method&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am currently facing the problem of &quot;how should I decompose my non-unitary matrix?&quot;. I want to decompose as a sum of unitary matrices (in the best world ever, easy to implement unitary matrices) the following matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \begin{pmatrix}&#xA;0        &amp;amp; \cdots{} &amp;amp; \cdots{} &amp;amp; \cdots{} &amp;amp; \cdots{} &amp;amp; 0       \\&#xA;\vdots{} &amp;amp;          &amp;amp;          &amp;amp;          &amp;amp;          &amp;amp; \vdots{}\\&#xA;\vdots{} &amp;amp;          &amp;amp;          &amp;amp;          &amp;amp;          &amp;amp; \vdots{}\\&#xA;0        &amp;amp;          &amp;amp;          &amp;amp;          &amp;amp;          &amp;amp; \vdots{}\\&#xA;1        &amp;amp; 0        &amp;amp; \cdots{} &amp;amp; \cdots{} &amp;amp; \cdots{} &amp;amp; 0       \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;which is obviously non-unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I started by restricting myself to the Pauli matrices (+ identity) because I know that these unitary matrices are easy to implement. &#xA;I found the following decomposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \frac{1}{2^{n}} (\mathbb{X} - i \mathbb{Y})^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, so it is linear in the size of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. &#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First question&lt;/strong&gt;: 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (instead of the linear behaviour I have now).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second question&lt;/strong&gt;: do you have any ideas about how modifying the gate set will affect the number of summed unitary matrices in the decomposition? &lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2020-01-15T14:37:39.470" Title="Non-unitary matrix decomposition as a sum of unitary matrices" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9551" PostTypeId="2" ParentId="9550" CreationDate="2020-01-15T13:54:53.787" Score="7" Body="&lt;p&gt;All tensor products of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Pauli operators &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}$&lt;/span&gt; (that is &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; combinations) form an orthogonal basis for the vector space of &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we not fix the unitary basis, then there are a lot of other options, of course. For example, your matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a linear combination of 2 unitaries:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \frac{1}{2}\begin{pmatrix}&#xA;0        &amp;amp; 0 &amp;amp; 0 &amp;amp; \cdots{}  &amp;amp; 1       \\&#xA;0 &amp;amp; 1 &amp;amp;  0       &amp;amp;           &amp;amp; \vdots{}\\&#xA;0 &amp;amp; 0 &amp;amp;  \ddots       &amp;amp;           &amp;amp; \vdots{}\\&#xA;\vdots{}        &amp;amp;  &amp;amp;         &amp;amp; 1         &amp;amp; 0\\&#xA;1        &amp;amp; \cdots  &amp;amp;  \cdots{}&amp;amp; 0  &amp;amp; 0       \\&#xA;\end{pmatrix} + &#xA;\frac{1}{2}\begin{pmatrix}&#xA;0        &amp;amp; 0 &amp;amp; 0 &amp;amp; \cdots{}  &amp;amp; -1       \\&#xA;0 &amp;amp; -1 &amp;amp;  0       &amp;amp;           &amp;amp; \vdots{}\\&#xA;0 &amp;amp; 0 &amp;amp;  \ddots       &amp;amp;           &amp;amp; \vdots{}\\&#xA;\vdots{}        &amp;amp;   &amp;amp;          &amp;amp; -1         &amp;amp; 0\\&#xA;1        &amp;amp; \cdots  &amp;amp;  \cdots{}&amp;amp; 0  &amp;amp; 0       \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;  &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-01-15T14:37:39.470" LastActivityDate="2020-01-15T14:37:39.470" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9552" PostTypeId="1" AcceptedAnswerId="9554" CreationDate="2020-01-15T15:31:54.457" Score="0" ViewCount="64" Body="&lt;p&gt;I would like to check if state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle =  \cos{\theta}|0\rangle + i \sin{\theta}|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is properly defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But when I calculated &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | \psi \rangle$&lt;/span&gt; is get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos^2{\theta} - \sin^2{\theta}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so I am facing sin and cos. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is wrong in my calculation?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-01-16T12:09:22.343" LastActivityDate="2020-01-16T12:09:22.343" Title="How can I check if the following are possible states of a qubit?" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9553" PostTypeId="2" ParentId="9500" CreationDate="2020-01-15T19:46:43.273" Score="2" Body="&lt;p&gt;The source of noise in your system, and how to reduce it, is really dependent on the quantum computing architecture you're pursuing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However there do exist other architectures which are more easily amateur accessible, though they all have their drawback(hence no real commercial adoption)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nitrogen Vacancy centers in diamond provide you a fairly easy to manipulate and read out qubit. For a basic setup see: &lt;a href=&quot;https://arxiv.org/pdf/1708.00418&quot; rel=&quot;nofollow noreferrer&quot;&gt;Little bits of diamond:&#xA;Optically detected magnetic resonance of nitrogen-vacancy centers&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://arxiv.org/pdf/1011.1382&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing with NMR&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm sure there are some other easily accessible architectures, but I'm not so familiar with them.&lt;/p&gt;&#xA;" OwnerUserId="9579" LastEditorUserId="9006" LastEditDate="2020-01-19T07:29:45.360" LastActivityDate="2020-01-19T07:29:45.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9554" PostTypeId="2" ParentId="9552" CreationDate="2020-01-15T22:22:56.610" Score="2" Body="&lt;p&gt;Standard inner product on space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{n}$&lt;/span&gt; is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle a|b \rangle = \sum_{i=1}^{n} a_{i}b_{i}^{\dagger},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$b^{\dagger}$&lt;/span&gt; is complex conjugate (i.e. for &lt;span class=&quot;math-container&quot;&gt;$x \in \mathbb{C}$&lt;/span&gt;: if &lt;span class=&quot;math-container&quot;&gt;$x = x_{re} + ix_{im}$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$x^{\dagger} = x_{re} - ix_{im}$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case &lt;span class=&quot;math-container&quot;&gt;$a_{1} = \cos(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_{2} = i\sin(\theta)$&lt;/span&gt;. Since you are interested in product &lt;span class=&quot;math-container&quot;&gt;$\langle a|a \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a_{1}^{\dagger} = \cos(\theta)$&lt;/span&gt; because it is a real number and &lt;span class=&quot;math-container&quot;&gt;$a_{2}^\dagger = -i\sin(\theta)$&lt;/span&gt; you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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 &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively you can use normalization condition &lt;span class=&quot;math-container&quot;&gt;$|a|^2+|b|^2 = 1$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|a|^2 = |\cos(\theta)|^2 = \cos^{2}(\theta)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|b|^2 = |i\sin(\theta)|^2 = |i|^2|\sin^{2}(\theta)| = 1^2\cdot \sin^{2}(\theta)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And again you have &lt;span class=&quot;math-container&quot;&gt;$\cos^{2}(\theta) + \sin^{2}(\theta) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overall, your  quatum state is properly defined.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-15T22:22:56.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9555" PostTypeId="1" AcceptedAnswerId="9557" CreationDate="2020-01-15T22:28:21.057" Score="3" ViewCount="445" Body="&lt;p&gt;I am currently reading the paper quantum principal component analysis from Seth Lloyd's article &lt;a href=&quot;https://arxiv.org/abs/1307.0401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Principal Component Analysis&lt;/a&gt; There is the following equation stated.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose that on is presented with &lt;em&gt;n&lt;/em&gt; copies of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. A simple trick allows one to apply the unitary transformation &lt;span class=&quot;math-container&quot;&gt;$e^{-i\rho t}$&lt;/span&gt; to any density matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; up to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th order in &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\label{eq1}\tag{1}&#xA;\text{tr}_pe^{-iS\Delta t}\rho\otimes\sigma e^{iS\Delta t} &amp;amp;= \left(\cos^2\Delta t\right)\sigma + \left(\sin^2 \Delta t\right)\rho - i\sin\Delta t\left[\rho, \sigma\right] \\&#xA;&amp;amp;= \sigma - i\Delta t\left[\rho, \sigma\right] + \mathcal O\left(\Delta t^2\right)&#xA;\end{align}&lt;/span&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$\text{tr}_p$&lt;/span&gt; is the partial trace over the first variable and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the swap operator. &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a sparse matrix and so &lt;span class=&quot;math-container&quot;&gt;$e^{-iS\Delta t}$&lt;/span&gt; can be performed efficiently [6-9]. Repeated application of \eqref{eq1}&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I know from the qiskit website, that we can express &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\gamma B}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\cos(\gamma)I + i\sin(\gamma)B $&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; being some real number and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is an involutory matrix. Can someone explain me why there is only a single &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and no &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(\cos^2\triangle t)\sigma$&lt;/span&gt; and a single &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and no &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;  in &lt;span class=&quot;math-container&quot;&gt;$(\sin^2\triangle t)\rho$&lt;/span&gt;? Is it because of the partial trace?&lt;/p&gt;&#xA;&lt;p&gt;Any intuition or approach is welcome. Many thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="9785" LastEditorUserId="55" LastEditDate="2020-07-26T19:00:46.313" LastActivityDate="2020-07-26T19:00:46.313" Title="Quantum Principal Component analysis by Seth Lloyd" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;machine-learning&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9556" PostTypeId="1" AcceptedAnswerId="9559" CreationDate="2020-01-15T23:02:07.393" Score="2" ViewCount="513" Body="&lt;p&gt;So suppose you want to do a Shor algorithm on an arbitrary number of qubits using an arbitrary &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; (the base number in the periodic function &lt;span class=&quot;math-container&quot;&gt;$a^x \mod c$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; ( 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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and 4 qubits &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; using Toffolli gates but I don't know how I can code something that does it automatically for given &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. I also wonder how would you do it for a higher number of qubits. Any help, reading material or pointers on that?&lt;/p&gt;&#xA;" OwnerUserId="9644" LastEditorUserId="9006" LastEditDate="2020-01-16T05:51:17.730" LastActivityDate="2020-01-16T08:30:49.957" Title="How to make a Shor's algorithm for an arbitrary number of qubits with Qiskit on a IBM machine?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9557" PostTypeId="2" ParentId="9555" CreationDate="2020-01-16T07:26:23.093" Score="4" Body="&lt;p&gt;As you say, start by expanding &lt;span class=&quot;math-container&quot;&gt;$e^{-iS\Delta t}=\cos(\Delta t)I-i\sin(\Delta t)S$&lt;/span&gt;, so you'd be calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\cos(\Delta t)I-i\sin(\Delta t)S)\rho\otimes\sigma(\cos(\Delta t)I+i\sin(\Delta t)S).&#xA;$$&lt;/span&gt;&#xA;If you multiply out all the terms, then the &lt;span class=&quot;math-container&quot;&gt;$\cos^2(\Delta t)$&lt;/span&gt; comes from the two &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; terms, leaving you with &lt;span class=&quot;math-container&quot;&gt;$\rho\otimes\sigma$&lt;/span&gt;. If you trace out the first term, you're left with &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, &lt;span class=&quot;math-container&quot;&gt;$S(\rho\otimes\sigma)S=\sigma\otimes\rho$&lt;/span&gt;, so if you trace out the first system, you're left with &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's actually the cross-terms that are the trickier ones. Take, for example, &lt;span class=&quot;math-container&quot;&gt;$S(\rho\otimes\sigma)$&lt;/span&gt;. If I try to trace out the first system, I have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sum_{i,j,k}|j\rangle\langle k|\langle i,j|S\rho\otimes\sigma|i,k\rangle&amp;amp;=\sum_{i,j,k}|j\rangle\langle k|\langle j,i|\rho\otimes\sigma|i,k\rangle \\&#xA;&amp;amp;=\sum_{i,j,k}|j\rangle\langle k|\langle j|\rho|i\rangle\langle i|\sigma|k\rangle \\&#xA;&amp;amp;=\sum_{j,k}|j\rangle\langle k|\langle j|\rho\sigma|k\rangle \\&#xA;&amp;amp;=\rho\sigma.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-01-17T12:17:41.123" LastActivityDate="2020-01-17T12:17:41.123" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9558" PostTypeId="2" ParentId="9552" CreationDate="2020-01-16T07:51:27.450" Score="1" Body="&lt;p&gt;You asked &quot;What is wrong in my calculation?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that your mistake is in forgetting that  &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | = \cos{\theta}\langle 0| - i \sin{\theta}\langle 1|$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\cos{\theta}\langle 0| + i \sin{\theta}\langle 1|$&lt;/span&gt; (because &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; when you take the complex conjugate).&lt;/p&gt;&#xA;" OwnerUserId="1790" LastActivityDate="2020-01-16T07:51:27.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9559" PostTypeId="2" ParentId="9556" CreationDate="2020-01-16T08:30:49.957" Score="2" Body="&lt;p&gt;Maybe &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0205095.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; can help you, that's what the implementation in Qiskit is based on. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Otherwise looking at the &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/single_sample/shor/shor.html#Shor&quot; rel=&quot;nofollow noreferrer&quot;&gt;implementation of Shor's algorithm in Qiskit itself&lt;/a&gt; might be insightful. The circuit for the algorithm is constructed in the method &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/single_sample/shor/shor.html#Shor.construct_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;construct_circuit&lt;/code&gt;&lt;/a&gt; and can be visualized with this snippet. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.algorithms import Shor&#xA;a, N = 2, 3&#xA;shor = Shor(N, a)&#xA;circuit = shor.construct_circuit()&#xA;print(circuit.draw())  # or circuit.draw(output='mpl') for a nicer looking diagram ;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Warning: the circuit is huge and takes a long time to plot for large &lt;code&gt;N&lt;/code&gt;!&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-01-16T08:30:49.957" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9561" PostTypeId="1" CreationDate="2020-01-16T10:23:23.660" Score="1" ViewCount="139" Body="&lt;p&gt;In the &lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/gate-overview&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gates Glossary&lt;/a&gt; of IBM Quantum Experience it states&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;H gate &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The H or Hadamard gate rotates the states |0⟩ and |1⟩ &#xA;  to |+⟩ and |−⟩, respectively. It is useful for making superpositions. As a Clifford gate, it is useful for moving&#xA;  information between the x and z bases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;Clifford gate&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;classical&quot; programmer that struggles with the basics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;for(i = 1; i &amp;lt;= N; i++) Sum += i;&lt;/code&gt; over terms like &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^n$&lt;/span&gt; which look very alien to me.&lt;/p&gt;&#xA;" OwnerUserId="9173" LastEditorUserId="55" LastEditDate="2020-10-09T06:57:53.100" LastActivityDate="2020-10-09T06:57:53.100" Title="What are the $|+\rangle$ and $|-\rangle$ states?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9562" PostTypeId="2" ParentId="9561" CreationDate="2020-01-16T11:01:44.073" Score="4" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$|+⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-⟩$&lt;/span&gt; are states given by the following decomposition in the Z-basis:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;|+⟩ &amp;amp;=  \frac{1}{\sqrt{2}} \Big(|0⟩ + |1⟩\Big)\\&#xA;|-⟩ &amp;amp;=  \frac{1}{\sqrt{2}} \Big(|0⟩ - |1⟩\Big)&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The terms Z-basis and X-basis refer to the two pair of states &lt;span class=&quot;math-container&quot;&gt;$\{|0⟩,|1⟩\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|+⟩,|-⟩\}$&lt;/span&gt; respectively, which are eigenstates of the two Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; (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. &#xA;The Hadamard gate is just given by this matrix in the Z basis&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1\\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;which converts the state &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|+⟩$&lt;/span&gt; and the state &lt;span class=&quot;math-container&quot;&gt;$|1⟩$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|-⟩$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;circuit model&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9772" LastEditorUserId="9772" LastEditDate="2020-01-16T11:35:05.127" LastActivityDate="2020-01-16T11:35:05.127" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9563" PostTypeId="1" CreationDate="2020-01-16T11:30:53.377" Score="2" ViewCount="70" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\Ket}[1]{\left|#1\right&amp;gt;}$&lt;/span&gt;&#xA;If we have the superposition &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\displaystyle \sum \dfrac{1}{2^n} \Ket x \Ket{ f(x)} \Ket 0 \Ket y \Ket{g(y)} \Ket 0 \Ket {\delta_{x,y}} ,$$&lt;/span&gt; here &lt;span class=&quot;math-container&quot;&gt;$\delta_{x,y} = 1 $&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$f(x) = g(y)$&lt;/span&gt;, else &lt;span class=&quot;math-container&quot;&gt;$\delta_{x,y}=0$&lt;/span&gt;. I want to copy &lt;span class=&quot;math-container&quot;&gt;$\delta_{x,y}$&lt;/span&gt; to qubit &lt;span class=&quot;math-container&quot;&gt;$\Ket 0$&lt;/span&gt; by some ways so that it becomes superpositon&#xA; &lt;span class=&quot;math-container&quot;&gt;$$\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 ,$$&lt;/span&gt;&#xA;means that &lt;span class=&quot;math-container&quot;&gt;$\delta_x = 1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; collides with some &lt;span class=&quot;math-container&quot;&gt;$g(y)$&lt;/span&gt;, and so does &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. After that, apply Grover's algorithm on the first half and second half to find &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; that collides, in &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/4})$&lt;/span&gt; time complexity. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any way to copy like this?   &lt;/p&gt;&#xA;" OwnerUserId="9801" LastEditorUserId="55" LastEditDate="2020-11-10T17:36:06.233" LastActivityDate="2020-11-10T17:36:06.233" Title="Can we apply Grover to meet-in-the-middle attack?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9564" PostTypeId="1" AcceptedAnswerId="9565" CreationDate="2020-01-16T11:31:47.577" Score="3" ViewCount="114" Body="&lt;p&gt;I am given fixed quantum states &lt;span class=&quot;math-container&quot;&gt;$\rho_X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_Y$&lt;/span&gt; and some function of the form &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(N_{X\rightarrow Y}(\rho_X)\sigma_Y)$&lt;/span&gt;. I would like to maximize this function over all completely positive trace preserving maps &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}$&lt;/span&gt;. What is the way to solve such an optimization?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I notice that my problem is linear in &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}$&lt;/span&gt; so I was wondering if there could even be an analytical solution to this? &lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-01-16T17:01:08.670" Title="Optimizing over quantum channels" Tags="&lt;quantum-operation&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9565" PostTypeId="2" ParentId="9564" CreationDate="2020-01-16T15:00:37.317" Score="6" Body="&lt;p&gt;For the specific linear function you are interested in, the solution turns out to be trivial: you can take the channel to be &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}(\rho) = \operatorname{Tr}(\rho) |\psi\rangle\langle \psi|$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; being an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\sigma_Y$&lt;/span&gt; having the largest possible eigenvalue. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(N_{X\rightarrow Y}) = \sum_{a,b} N_{X\rightarrow Y}(|a\rangle\langle b|) \otimes |a\rangle\langle b|,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; range over the standard basis states of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. It is the case that &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}$&lt;/span&gt; is a channel (i.e., is completely positive and trace preserving) if and only if &lt;span class=&quot;math-container&quot;&gt;$J(N_{X\rightarrow Y})$&lt;/span&gt; is positive semidefinite and obeys the linear constraint&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{Tr}_{Y}(J(N_{X\rightarrow Y})) = \mathbb{1}_X.&#xA;$$&lt;/span&gt;&#xA;For any real-valued linear function of &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}$&lt;/span&gt;, there will always exist a Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; for which the value of this linear function is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{Tr}(H J(N_{X\rightarrow Y})).&#xA;$$&lt;/span&gt;&#xA;The resulting semidefinite program looks like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\text{maximize} \quad &amp;amp; \operatorname{Tr}(H P) \\[1mm]&#xA;\text{subject to} \quad &amp;amp; \operatorname{Tr}_{Y}(P) = \mathbb{1}_X\\[1mm]&#xA;&amp;amp; P \in \mathrm{Pos}(Y\otimes X),&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pos}(Y\otimes X)$&lt;/span&gt; refers to the set of all positive semidefinite operators acting on &lt;span class=&quot;math-container&quot;&gt;$X\otimes Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like all semidefinite programs, this one has a dual formulation, which is as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\text{minimize} \quad &amp;amp; \operatorname{Tr}(Q)\\[1mm]&#xA;\text{subject to} \quad &amp;amp; \mathbb{1}_Y \otimes Q - H \in \mathrm{Pos}(Y\otimes X)\\[1mm]&#xA;&amp;amp; Q \in \mathrm{Herm}(X),&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Herm}(X)$&lt;/span&gt; is the set of all Hermitian operators acting on &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a specific choice of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in mind, you can solve this optimization problem numerically. I recommend CVX for MATLAB for this purpose.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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), &lt;span class=&quot;math-container&quot;&gt;$N_{X\rightarrow Y}$&lt;/span&gt; can be shown to be optimal if and only if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{Tr}_{Y}(H J(N_{X\rightarrow Y}))&#xA;$$&lt;/span&gt;&#xA;is a Hermitian operator and satisfies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbb{1}_Y \otimes \operatorname{Tr}_{Y}(H J(N_{X\rightarrow Y})) - H \in \mathrm{Pos}(Y\otimes X).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2020-01-16T17:01:08.670" LastActivityDate="2020-01-16T17:01:08.670" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9566" PostTypeId="1" AcceptedAnswerId="9568" CreationDate="2020-01-16T19:00:05.710" Score="4" ViewCount="524" Body="&lt;p&gt;I guess, I understood simple Deutsch Algorithm (if unary function is balanced or constant) as described here: &lt;a href=&quot;http://akyrillidis.github.io/notes/quant_post_8&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to quantum computing: The Deutsch algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could someone please point me to an implementation for the same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Kind of answering the question: I guess my issue was: I was trying to find &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; 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:&#xA;we had function: &lt;span class=&quot;math-container&quot;&gt;$x \rightarrow f(x)$&lt;/span&gt;&#xA;But this is not reversible, so we wanted to implement black box with function: &lt;span class=&quot;math-container&quot;&gt;$|x, y\rangle \rightarrow |x, f(x) \oplus y\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is what this translates to four possible functions:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$f(x) \oplus y = 0 \oplus y = y$&lt;/span&gt;, So, black box doesn't do anything&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$f(x) \oplus y = 1 \oplus y = \bar{y}$&lt;/span&gt;&#xA;So, black box simply negate the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) &lt;span class=&quot;math-container&quot;&gt;$f(x) = \bar{x}$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$f(x) \oplus y = \bar{x} \oplus y$&lt;/span&gt; (which is also &lt;span class=&quot;math-container&quot;&gt;$\overline{x \oplus y}$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we can implement it in two ways:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Option 1:&lt;/em&gt; for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;: not it twice so that finally we get &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&#xA;for &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;: when &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is notted once, at that point use it as control to CNOT &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and output that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Option 2:&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is outputted as it is.&#xA;For &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; take &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as control and CNOT it. Then NOT it.&#xA;Here CNOT gives &lt;span class=&quot;math-container&quot;&gt;$x \oplus y$&lt;/span&gt;, and when we NOT it we get &lt;span class=&quot;math-container&quot;&gt;$\overline{(x \oplus y)}$&lt;/span&gt; which is same as &lt;span class=&quot;math-container&quot;&gt;$\bar{x} \oplus y$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) &lt;span class=&quot;math-container&quot;&gt;$f(x) = x:$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; simply CNOT it with &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, using &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as control.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I verified it (on IBM Q Experience) and it seems to be working. :-)&#xA;I see that in all 4 implementation it is possible to not change &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; at all. But yet, when we measure it, it's value is changing!!! I guess I still have to turn my head around that.&lt;/p&gt;&#xA;" OwnerUserId="9804" LastEditorUserId="9006" LastEditDate="2020-01-18T08:40:50.663" LastActivityDate="2020-03-06T18:45:43.563" Title="Implementing four oracles for the Deutsch Algorithm (preferably on IBM Q Experience)" Tags="&lt;ibm-q-experience&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9567" PostTypeId="1" CreationDate="2020-01-16T20:44:38.963" Score="2" ViewCount="378" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; dotnet iqsharp install&#xA;Could not execute because the specified command or file was not found.&#xA;Possible reasons for this include:&#xA;  * You misspelled a built-in dotnet command.&#xA;  * You intended to execute a .NET Core program, but dotnet-iqsharp does not exist.&#xA;  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading and I hope you can help me.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="9006" LastEditDate="2020-01-17T05:52:10.867" LastActivityDate="2020-11-06T18:05:25.730" Title="Problems with Q# installing" Tags="&lt;q#&gt;" AnswerCount="2" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="9568" PostTypeId="2" ParentId="9566" CreationDate="2020-01-16T22:40:29.390" Score="1" Body="&lt;p&gt;An oracle &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is actually &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; gate (or a negation). The circuit implementing the oracle is following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5Tlxl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Tlxl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is input and qubit &lt;span class=&quot;math-container&quot;&gt;$q_{1}$&lt;/span&gt; is output. Firstly &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; is applied on &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt;. This negate the qubit, however, we want to have an output on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;. Therefore, we apply &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; which in this setting &quot;copy&quot; the &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt; to output &lt;span class=&quot;math-container&quot;&gt;$q_{1}$&lt;/span&gt;. After that the second &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; returns state of &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; back to preserve input value here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; 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 &quot;copy&quot; can be somehow misleading because it is not possible to copy quantum state. But application of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; leads to entanglement between qubits and therefore &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; behave in same way; they have same value.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-16T22:40:29.390" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9570" PostTypeId="2" ParentId="9566" CreationDate="2020-01-17T18:31:58.593" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/users/267841/chris-granade&quot;&gt;@cgranade&lt;/a&gt; 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 &lt;a href=&quot;https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp?a_aid=learn-qc-granade&amp;amp;a_bid=ee23f338&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing with Python and Q#&lt;/a&gt;. You can find the code samples for the book in the repo &lt;a href=&quot;https://github.com/crazy4pi314/learn-qc-with-python-and-qsharp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. In particular, the oracles look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace DeutschJozsa {&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;&#xA;    operation ZeroOracle(control : Qubit, target : Qubit) : Unit {&#xA;    }&#xA;&#xA;    operation OneOracle(control : Qubit, target : Qubit) : Unit {&#xA;        X(target);&#xA;    }&#xA;&#xA;    operation IdOracle(control : Qubit, target : Qubit) : Unit {&#xA;        CNOT(control, target);&#xA;    }&#xA;&#xA;    operation NotOracle(control : Qubit, target : Qubit) : Unit {&#xA;        X(control);&#xA;        CNOT(control, target);&#xA;        X(control);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2020-01-17T18:31:58.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9571" PostTypeId="1" CreationDate="2020-01-17T21:07:51.877" Score="3" ViewCount="233" Body="&lt;p&gt;This question has been asked here: &quot;&lt;a href=&quot;https://math.stackexchange.com/questions/2472474/problem-2-2-in-nielsen-chuang-properties-of-the-schmidt-number&quot;&gt;Problem 2.2 in Nielsen &amp;amp; Chuang - Properties of the Schmidt number&lt;/a&gt;&quot;,&#xA;but no answer has been provided there yet, thus I move it here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is stated below. This is problem 2.2 (not exercise 2.2) in Nielsen &amp;amp; Chuang (Page 117 in the newest version).&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle $&lt;/span&gt; is a pure state of a composite system with components &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, such that: &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \alpha \rvert \phi \rangle + \beta \rvert \gamma \rangle$$&lt;/span&gt;&#xA;  Prove that:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{Sch}(\psi) \geq | \operatorname{Sch}(\phi) - \operatorname{Sch}(\gamma)|$$&lt;/span&gt;&#xA;  where &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Sch}(x)$&lt;/span&gt; is the Schmidt number of the pure state labeled &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The link above provide some attempts, but not quite succeed. Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-01-20T12:43:36.073" LastActivityDate="2020-09-18T16:30:04.367" Title="Problem 2.2 in Nielsen &amp; Chuang - Properties of the Schmidt number" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9572" PostTypeId="2" ParentId="9566" CreationDate="2020-01-17T23:36:27.470" Score="1" Body="&lt;p&gt;I &lt;a href=&quot;https://github.com/1ucian0/qiskit-presentations/blob/master/2019-06-20_Techsauce_workshop/techsauce19.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;implemented&lt;/a&gt; them as a &quot;subcircuit&quot; so it looks &quot;hidden&quot; from the &quot;outside&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;constant 0:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input = QuantumRegister(1, name='input')&#xA;temp = QuantumRegister(1, name='temp')&#xA;constant0 = QuantumCircuit(input, temp, name='oracle')&#xA;oracle = constant0.to_instruction()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;identity:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input = QuantumRegister(1, name='input')&#xA;temp = QuantumRegister(1, name='temp')&#xA;identity = QuantumCircuit(input, temp, name='oracle')&#xA;identity.cx(input, temp)&#xA;oracle = identity.to_instruction()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;inverts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input = QuantumRegister(1, name='input')&#xA;temp = QuantumRegister(1, name='temp')&#xA;invert = QuantumCircuit(input, temp, name='oracle')&#xA;invert.cx(input, temp)&#xA;invert.x(temp)&#xA;oracle = identity.to_instruction()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;constant 1:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;input = QuantumRegister(1, name='input')&#xA;temp = QuantumRegister(1, name='temp')&#xA;constant1 = QuantumCircuit(input, temp, name='oracle')&#xA;constant1.x(temp)&#xA;oracle = constant1.to_instruction()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So you can add the oracle in the algorithm like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(2)&#xA;cr = ClassicalRegister(1)&#xA;circuit = QuantumCircuit(qr, cr)&#xA;circuit.x(qr[1]);&#xA;circuit.h(qr)&#xA;circuit.append(oracle, [qr[0], qr[1]])&#xA;circuit.h(qr[0])&#xA;circuit.measure(qr[0], cr[0]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And you can run it like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;counts = execute(circuit, backend=local_simulator).result().get_counts()&#xA;if '1' in counts:&#xA;    print('BALANCED')&#xA;elif '0' in counts:&#xA;    print('CONSTANT')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-01-17T23:36:27.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9573" PostTypeId="2" ParentId="9566" CreationDate="2020-01-18T00:18:14.780" Score="3" Body="&lt;p&gt;I think this snippet from &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/deutsch.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq's Deutsch's algorithm example&lt;/a&gt; (disclosure: I am its author) should be fairly easy to understand:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def make_oracle(q0, q1, secret_function):&#xA;    &quot;&quot;&quot; Gates implementing the secret function f(x).&quot;&quot;&quot;&#xA;&#xA;    # coverage: ignore&#xA;    if secret_function[0]:&#xA;        yield [CNOT(q0, q1), X(q1)]&#xA;&#xA;    if secret_function[1]:&#xA;        yield CNOT(q0, q1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In the code, &lt;code&gt;secret_function[i]&lt;/code&gt; is the value of &lt;span class=&quot;math-container&quot;&gt;$f(i)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(0) = f(1) = 0$&lt;/span&gt;, nothing happens so the &lt;code&gt;q1&lt;/code&gt; maintains its initial value of &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(0) = f(1) = 1$&lt;/span&gt;, the sequence &lt;code&gt;CNOT(q0, q1), X(q1), CNOT(q0, q1)&lt;/code&gt; is applied, which is the same as just &lt;code&gt;X(q1)&lt;/code&gt; no matter the value of &lt;code&gt;q0&lt;/code&gt;, which means &lt;code&gt;q1&lt;/code&gt; is flipped to &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(0) = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1) = 1$&lt;/span&gt;, then only &lt;code&gt;CNOT(q0, q1)&lt;/code&gt; is applied, which means the input is passed through (i.e., &lt;code&gt;q1&lt;/code&gt; is effectively assigned the value of &lt;code&gt;q0&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(0) = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1) = 0$&lt;/span&gt;, then &lt;code&gt;CNOT(q0, q1), X(q1)&lt;/code&gt; is applied, which means the inputs are exchanged after passing through (i.e., &lt;code&gt;q1&lt;/code&gt; is assigned the opposite of the value of &lt;code&gt;q0&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you ask about the IBM Quantum Experience, you can produce the four oracle functions as follows in Qiskit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Pick a secret function.&#xA;secret = [random.randint(0, 1) for _ in range(2)]&#xA;def append_oracle(ciruit, secret):&#xA;    if secret[0]:&#xA;        circuit.cx(0, 1)&#xA;        circuit.x(1)&#xA;    if secret[1]:&#xA;        circuit.cx(0, 1)&#xA;&#xA;# Create the Deutsch algorithm circuit.&#xA;circuit = QuantumCircuit(2, 1)&#xA;circuit.x(1)&#xA;circuit.barrier()&#xA;circuit.h(0)&#xA;circuit.h(1)&#xA;circuit.barrier()&#xA;append_oracle(circuit, secret)&#xA;circuit.barrier()&#xA;circuit.h(0)&#xA;circuit.measure(0, 0)&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can of course set &lt;code&gt;secret = [&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt;&lt;code&gt;,&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt;&lt;code&gt;]&lt;/code&gt; explicitly to each of the four possible combinations of &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; to output the circuit you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can easily create these using the circuit composer if that's what you want to do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = f(1) = 0$&lt;/span&gt; (constant):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HQGKy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HQGKy.png&quot; alt=&quot;f(0) = f(1) = 0&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = 0, f(1) = 1$&lt;/span&gt; (balanced):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WT17W.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WT17W.png&quot; alt=&quot;f(0) = 0, f(1) = 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = 1, f(1) = 0$&lt;/span&gt; (balanced):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/PFIG3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PFIG3.png&quot; alt=&quot;f(0) = 1, f(1) = 0&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(0) = f(1) = 1$&lt;/span&gt; (constant):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vfbDp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vfbDp.png&quot; alt=&quot;f(0) = f(1) = 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You can of course simplify this last circuit by removing the two &lt;code&gt;CNOT&lt;/code&gt;s.)&lt;/p&gt;&#xA;" OwnerUserId="1790" LastEditorUserId="1790" LastEditDate="2020-03-06T18:45:43.563" LastActivityDate="2020-03-06T18:45:43.563" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9575" PostTypeId="2" ParentId="9571" CreationDate="2020-01-18T09:33:24.930" Score="1" Body="&lt;p&gt;Following your attempt we have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;| \phi \rangle &amp;amp;= \sum_i \phi_i | a_i^{\phi} \rangle | b_i^{\phi} \rangle\\&#xA;| \gamma \rangle &amp;amp;= \sum_i \gamma_i | a_i^{\gamma} \rangle | b_i^{\gamma} \rangle,&#xA;\end{align*}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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},&#xA;$$&lt;/span&gt;&#xA;where &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{\phi \phi} \equiv \operatorname{tr}_B(| \phi \rangle \langle \phi |) = \sum_i \phi_i^2 | a_i^{\phi} \rangle  \langle a_i^{\phi} | \\&#xA;\rho_{\gamma \gamma} \equiv \operatorname{tr}_B(| \gamma \rangle \langle \gamma |) = \sum_i \gamma_i^2 | a_i^{\gamma} \rangle  \langle a_i^{\gamma} | &#xA;\\&#xA;\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} | \\&#xA;\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} |.&#xA;$$&lt;/span&gt;&#xA;Now observe that for the following subspace of the first subsystem&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_\alpha = \text{span}\{| a_1^{\phi} \rangle, | a_2^{\phi} \rangle, ... ;  | a_1^{\gamma} \rangle, | a_2^{\gamma} \rangle, ... \}&#xA;$$&lt;/span&gt;&#xA;we have that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&#xA;Thus &lt;span class=&quot;math-container&quot;&gt;$\rho(H_\alpha^\perp)=0$&lt;/span&gt;, which means that &lt;span class=&quot;math-container&quot;&gt;$\text{rank}(\rho)\leq \text{dim}(H_\alpha)$&lt;/span&gt;. Hence &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Sch}(\psi) \leq \text{Sch}(\phi) + \text{Sch}(\gamma)&#xA;$$&lt;/span&gt;&#xA;This is just a triangle inequality. To obtain the necessary just apply the above inequality to &lt;span class=&quot;math-container&quot;&gt;$\alpha \rvert \phi \rangle = |\psi\rangle  - \beta \rvert \gamma \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta \rvert \gamma \rangle = |\psi\rangle  - \alpha \rvert \phi \rangle $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-01-18T09:33:24.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9576" PostTypeId="1" AcceptedAnswerId="9965" CreationDate="2020-01-18T11:15:15.517" Score="4" ViewCount="479" Body="&lt;p&gt;I am trying to find application of a quantum computing in finance. So far I found these papers:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1807.03890&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computing for finance: Overview and prospects&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1811.03975&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computational finance: quantum algorithm for portfolio optimization&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1805.10928&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient quantum algorithm for solving travelling salesman problem: An IBM quantum experience&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1904.05803&quot; rel=&quot;nofollow noreferrer&quot;&gt;Towards Pricing Financial Derivatives with an IBM Quantum Computer&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1805.00109&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computational finance: Monte Carlo pricing of financial derivatives&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1806.06893&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Risk Analysis&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1907.03044&quot; rel=&quot;nofollow noreferrer&quot;&gt;Credit Risk Analysis using Quantum Computers&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is: do you know about other possible application of quantum computing in finance, banking, companies finanace management or general business area?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-20T05:27:04.910" LastActivityDate="2020-02-27T13:25:28.447" Title="Quantum computing in finance - list of articles" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9577" PostTypeId="1" AcceptedAnswerId="9578" CreationDate="2020-01-18T12:18:39.880" Score="0" ViewCount="1438" Body="&lt;p&gt;I need to know how can I find eigenvalues and eigenvectors for a quantum gate, for example &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="9006" LastEditDate="2020-01-19T00:06:24.613" LastActivityDate="2020-01-19T00:06:24.613" Title="How to find eigenvalues and eigenvector for a quantum gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ClosedDate="2020-01-24T18:30:17.347" ContentLicense="CC BY-SA 4.0" />
  <row Id="9578" PostTypeId="2" ParentId="9577" CreationDate="2020-01-18T13:00:22.777" Score="5" Body="&lt;p&gt;First you need eigenvalues;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X=\begin{pmatrix} 0&amp;amp;1 \\ 1&amp;amp;0\end{pmatrix}$$&lt;/span&gt; so you need to solve equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{vmatrix}0-\lambda &amp;amp;1 \\ 1 &amp;amp;0-\lambda\end{vmatrix}=0$$&lt;/span&gt; or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lambda^2-1=0$$&lt;/span&gt;&#xA;which gives eigenvalues&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lambda_{1,2}=\pm 1$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is Hermitian, eigenvalues are real.&#xA;Now you can find eigenvectors;&#xA;for example, for the first eigenvector &lt;span class=&quot;math-container&quot;&gt;$|v\rangle=a|0\rangle+b|1\rangle$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X\begin{pmatrix}a \\ b \end{pmatrix}=\lambda_1\begin{pmatrix}a \\ b \end{pmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{cases}&#xA;0\cdot a +1\cdot b=a\\&#xA;1\cdot a +0\cdot b=b&#xA;\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which gives &lt;span class=&quot;math-container&quot;&gt;$a=b$&lt;/span&gt;; after normalization, &lt;span class=&quot;math-container&quot;&gt;$a=b=\frac{1}{\sqrt{2}}$&lt;/span&gt;, and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|v\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)=|+\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-01-18T13:00:22.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9579" PostTypeId="1" AcceptedAnswerId="9581" CreationDate="2020-01-18T16:02:12.077" Score="3" ViewCount="179" Body="&lt;p&gt;In Quantum Computation and Quantum Information by Isaac Chuang and Michael Nielsen, section 8.2.3, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}=\sum_{k}E_k\rho E_k^{\dagger}$&lt;/span&gt; gives the operator-sum representation. In general, it requires &lt;span class=&quot;math-container&quot;&gt;$\sum_k E_k E_k^{\dagger}\leq I$&lt;/span&gt;. 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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="55" LastEditDate="2020-01-21T10:11:53.293" LastActivityDate="2020-01-21T10:11:53.293" Title="What does it mean &quot;less than identity&quot; in the operator sum representation?" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9581" PostTypeId="2" ParentId="9579" CreationDate="2020-01-18T17:12:29.457" Score="9" Body="&lt;p&gt;Matrix inequalities of the form &lt;span class=&quot;math-container&quot;&gt;$A\ge B$&lt;/span&gt; should be read as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A-B\ge 0\ ,&#xA;$$&lt;/span&gt;&#xA;which in turn means that all eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A-B$&lt;/span&gt; are larger or equal than zero.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the given case, &lt;span class=&quot;math-container&quot;&gt;$M\le I$&lt;/span&gt; means that all eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; are smaller or equal than one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that this convention for &lt;span class=&quot;math-container&quot;&gt;$\ge$&lt;/span&gt; used on matrices depends on the field.  In other fields, &quot;&lt;span class=&quot;math-container&quot;&gt;$\ge0$&lt;/span&gt;&quot; might refer to a component-wise property, and &lt;span class=&quot;math-container&quot;&gt;$\succeq0$&lt;/span&gt; might be used for positivity of the eigenvalues.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-01-18T17:12:29.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9582" PostTypeId="1" AcceptedAnswerId="9583" CreationDate="2020-01-18T18:47:32.697" Score="2" ViewCount="147" Body="&lt;p&gt;Let a quantum register of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; be in the following state, expressed in the computational basis for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; = \sum_{i=0}^{2^n-1} \alpha_i \left| i \right&amp;gt;, \forall i \in \{0, 1, ..., 2^n-1\}, \alpha_i \in \mathbb{C}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Additionally, the normalization condition states that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{i=0}^{2^n-1}|\alpha_i|^2 = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How many real-valued coefficients would it take to express these &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex-valued coefficients (the probability amplitudes of the register's quantum state)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^{n+1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The correct answer, it seems, is however &lt;span class=&quot;math-container&quot;&gt;$2(2^n-1)$&lt;/span&gt;, as stated in the &lt;a href=&quot;https://slideshare.net/DavidCian/week3-ap3421-2019part1&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; I am following, on slide 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (express a modulus using all of the other modulus values) instead of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just can't find an explanation to the correct answer.&lt;/p&gt;&#xA;" OwnerUserId="9408" LastEditorUserId="55" LastEditDate="2020-01-20T12:49:14.067" LastActivityDate="2020-01-20T13:01:22.453" Title="How many real-valued coefficients does it take to specify an $n$-qubit state?" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9583" PostTypeId="2" ParentId="9582" CreationDate="2020-01-18T19:30:22.640" Score="3" Body="&lt;p&gt;You can also rephase. So that gets rid of 1 more real dimension. That is quotient by &lt;span class=&quot;math-container&quot;&gt;$\psi ~ e^{i \theta} \psi$&lt;/span&gt;. Caution: unlike normalization where you are taking a subset, instead you are identifying many points into one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle = \sum_{i=0}^{2^{n}-1} \alpha_i | i \rangle$&lt;/span&gt;&#xA;There are identifications &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \equiv z | \psi \rangle$&lt;/span&gt;. Rescaling &lt;span class=&quot;math-container&quot;&gt;$|z|$&lt;/span&gt; means changing the normalization and rescaling by &lt;span class=&quot;math-container&quot;&gt;$\frac{z}{|z|}$&lt;/span&gt; is the rephasing by &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta}$&lt;/span&gt; mentioned already.&#xA;So suppose &lt;span class=&quot;math-container&quot;&gt;$\alpha_0 \neq 0$&lt;/span&gt;, then we can pick a represetative of the equivalence class of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; by letting &lt;span class=&quot;math-container&quot;&gt;$z = \frac{1}{\alpha_0}$&lt;/span&gt;, then we get &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \equiv | 0 \rangle + \sum_{i=1}^{2^n-1} \frac{\alpha_i}{\alpha_0} | i \rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt; complex numbers to specify by giving all the values of &lt;span class=&quot;math-container&quot;&gt;$\frac{\alpha_i}{\alpha_0}$&lt;/span&gt;.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$\alpha_0 = 0$&lt;/span&gt;, then repeat the same trick with &lt;span class=&quot;math-container&quot;&gt;$\alpha_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\alpha_2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\alpha_0 \neq 0$&lt;/span&gt; etc is made by specifying &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt; complex numbers. They all glue together into one manifold that has complex dimension &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt; or real dimension &lt;span class=&quot;math-container&quot;&gt;$2(2^n-1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take the construction section in &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_projective_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia: Complex Projective Space&lt;/a&gt; and substitute &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; there is &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; here. There it was states in a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{n+1}$&lt;/span&gt; but you want &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n}$&lt;/span&gt;. Above I give you the coordinate chart &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\sum Re(\alpha_i)^2 + Im(\alpha_i)^2 = 1$&lt;/span&gt; but then you still have to do a quotient by phase to get rid of one more real dimension.&lt;/p&gt;&#xA;" OwnerUserId="434" LastEditorUserId="434" LastEditDate="2020-01-18T21:50:14.163" LastActivityDate="2020-01-18T21:50:14.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9585" PostTypeId="2" ParentId="9577" CreationDate="2020-01-19T00:04:58.733" Score="2" Body="&lt;p&gt;I would like to add general case for single qubit gate. Let us assume that our gate is described by unitary matrix &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{pmatrix}&#xA;u_{11} &amp;amp; u_{12} \\&#xA;u_{21} &amp;amp; u_{22}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eigenvalues are roots of so-called characteristic equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|U-\lambda I|=0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{vmatrix}&#xA;u_{11} - \lambda &amp;amp; u_{12} \\&#xA;u_{21} &amp;amp; u_{22} -\lambda&#xA;\end{vmatrix}&#xA;=&#xA;(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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Solving this quadratic equation gives you eigenvalues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary then &lt;span class=&quot;math-container&quot;&gt;$|\lambda|=1$&lt;/span&gt;. Additionally, if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is Hermitian (i.e. &lt;span class=&quot;math-container&quot;&gt;$u_{21} = u_{12}^\star$&lt;/span&gt;) then &lt;span class=&quot;math-container&quot;&gt;$\lambda \in \mathbb{R}$&lt;/span&gt; hence &lt;span class=&quot;math-container&quot;&gt;$\lambda \in \{-1;1\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have eigenvalues, you can calculate eigenvectors by solving equation &lt;span class=&quot;math-container&quot;&gt;$Ux =\lambda x$&lt;/span&gt;. Vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; should be normalized with its Euclidian norm, i.e. &lt;span class=&quot;math-container&quot;&gt;$x := \frac{x}{|x|}$&lt;/span&gt;. Obviously the normalized vector fulfil &lt;span class=&quot;math-container&quot;&gt;$Ax=\lambda x $&lt;/span&gt; as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for practical purposes I would recommend using MatLab or its free version Octave. &#xA;You can use function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; [V D] = eig(U); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is matrix which eigenvectors and eigenvalues you are look for, &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is matrix containing all eigenvectors and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is diagonal matrix having eigenvalues on its diagonal. Note that element &lt;span class=&quot;math-container&quot;&gt;$d_{ii}$&lt;/span&gt; is connected to vector &lt;span class=&quot;math-container&quot;&gt;$v_{i}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-19T00:04:58.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9586" PostTypeId="1" CreationDate="2020-01-19T05:49:57.927" Score="2" ViewCount="328" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="9006" LastEditDate="2020-01-19T07:35:29.120" LastActivityDate="2020-01-19T07:35:29.120" Title="IBM qiskit vs Microsoft QDK" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;q#&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-01-23T18:17:33.883" ContentLicense="CC BY-SA 4.0" />
  <row Id="9587" PostTypeId="1" AcceptedAnswerId="9588" CreationDate="2020-01-19T12:52:14.087" Score="0" ViewCount="85" Body="&lt;p&gt;Is this now deprecated or moved? I've been looking for it. It was in &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry.aqua_extensions.components.variational_forms import UCCSD&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7439" LastEditorUserId="9006" LastEditDate="2020-01-19T16:32:48.297" LastActivityDate="2020-01-19T16:32:48.297" Title="UCCSD in qiskit deprecated?" Tags="&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9588" PostTypeId="2" ParentId="9587" CreationDate="2020-01-19T12:55:49.287" Score="1" Body="&lt;p&gt;No, it wasn't removed, it's here: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/chemistry/components/variational_forms/uccsd.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/chemistry/components/variational_forms/uccsd.py&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2020-01-19T12:55:49.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9589" PostTypeId="1" AcceptedAnswerId="9592" CreationDate="2020-01-19T14:02:34.433" Score="0" ViewCount="113" Body="&lt;p&gt;I am persuing some older code as below    &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)&#xA;...&#xA;qubitOp = ferOp.mapping(map_type='parity', threshold=0.000001)&#xA;qubitOp = qubitOp.two_qubit_reduced_operator(num_particles)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but am getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError: 'WeightedPauliOperator' object has no attribute 'two_qubit_reduced_operator'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Any suggestions for how to fix. I am using qiskit version:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qiskit                             0.14.1&#xA;qiskit-aer                         0.3.4&#xA;qiskit-aqua                        0.6.2&#xA;qiskit-ibmq-provider               0.4.5&#xA;qiskit-ignis                       0.2.0&#xA;qiskit-terra                       0.11.1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7439" LastActivityDate="2020-01-19T15:52:10.167" Title="More broken older Qiskit code" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9590" PostTypeId="2" ParentId="4783" CreationDate="2020-01-19T15:00:09.467" Score="1" Body="&lt;p&gt;I think there's some confusion here, so I'll try to explain the principle of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;QKD&lt;/a&gt; (Quantum Key Distribution) instead. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice generates the key, a binary string of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (probably a random string): &lt;span class=&quot;math-container&quot;&gt;$k = b_n b_{n-1} \ldots b_1$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice chooses &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bases: &lt;span class=&quot;math-container&quot;&gt;$\forall i \in \{1, \ldots, n\}, B_i \in \{X,Z\}$&lt;/span&gt;. Here, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; denote the respective Pauli gates, in matrix form &lt;span class=&quot;math-container&quot;&gt;$X = \begin{pmatrix} 0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bob also chooses &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bases: &lt;span class=&quot;math-container&quot;&gt;$\forall i \in \{1, \ldots, n\}, \widetilde{B_i} \in \{X,Z\}$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice sends over the key bit by bit over a quantum channel. If she chose the computational basis, she sends a qubit in state &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right&amp;gt;$&lt;/span&gt; for a classical bit in state &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and a qubit in state &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right&amp;gt;$&lt;/span&gt; for a classical bit in state &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. If she choses basis &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, she sends a qubit in state &lt;span class=&quot;math-container&quot;&gt;$\left| + \right&amp;gt;$&lt;/span&gt; for a classical bit in state &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and a qubit in state &lt;span class=&quot;math-container&quot;&gt;$\left| - \right&amp;gt;$&lt;/span&gt; for a classical bit in state &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Bob receives the qubits and measures them in the bases he chose beforehand, obtaining the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; as measurement results, which he equates to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in classical terms.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$m \leq n$&lt;/span&gt; bases.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob have obtained a key of length &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; by keeping only the bits where they chose the same basis.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But what if Eve is eavesdropping? She can do the same thing as Bob, choose &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bases, intercept and measure the qubits. When Alice and Bob have chosen the same basis, two cases can happen:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;She gets lucky and chooses the same basis as both Alice and Bob. In this case, she has intercepted one bit correctly and undetected.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;should&lt;/em&gt; be the same whether they actually &lt;em&gt;are&lt;/em&gt; the same. If not, they know someone tampered with their channel and that they haven't exchanged the key correctly.&lt;/p&gt;&#xA;" OwnerUserId="9408" LastActivityDate="2020-01-19T15:00:09.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9591" PostTypeId="1" CreationDate="2020-01-19T15:35:10.877" Score="2" ViewCount="38" Body="&lt;p&gt;I've recently performed certain analyses (&lt;a href=&quot;https://arxiv.org/abs/2001.01232&quot; rel=&quot;nofollow noreferrer&quot;&gt;Archipelagos of Total Bound and Free Entanglement&lt;/a&gt;) pertaining to eq. (50) in &#xA;&lt;a href=&quot;https://arxiv.org/pdf/1708.05336.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Separable Decompositions of Bipartite Mixed States&lt;/a&gt;  , that is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} \label{rhoAB}&#xA;\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),&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;where &lt;span class=&quot;math-container&quot;&gt;$t_{\mu} \neq 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$t_{\mu} \in \mathbb{R}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\nu}$&lt;/span&gt; are SU(2) and SU(4) generators, respectively.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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  &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; matrices (&lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;'s).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;wide open&quot; and not &quot;bias&quot; matters, if possible.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If there is possible ambiguity (which I presently suspect) perhaps good practice should dictate that the specific ordering employed be explicitly identified.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="9006" LastEditDate="2020-01-19T16:34:36.370" LastActivityDate="2020-01-19T16:34:36.370" Title="Are there different orderings of the fifteen SU(4) generators in common use?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;unitarity&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9592" PostTypeId="2" ParentId="9589" CreationDate="2020-01-19T15:52:10.167" Score="3" Body="&lt;p&gt;The chemistry sample in the README on the qiskit-aqua repo shows how to do this now:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;from qiskit.aqua.operators import Z2Symmetries&#xA;&#xA;# Use PySCF, a classical computational chemistry software&#xA;# package, to compute the one-body and two-body integrals in&#xA;# molecular-orbital basis, necessary to form the Fermionic operator&#xA;driver = PySCFDriver(atom='H .0 .0 .0; H .0 .0 0.735',&#xA;                    unit=UnitsType.ANGSTROM,&#xA;                    basis='sto3g')&#xA;molecule = driver.run()&#xA;num_particles = molecule.num_alpha + molecule.num_beta&#xA;num_spin_orbitals = molecule.num_orbitals * 2&#xA;&#xA;# Build the qubit operator, which is the input to the VQE algorithm in Aqua&#xA;ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)&#xA;map_type = 'PARITY'&#xA;qubitOp = ferOp.mapping(map_type)&#xA;qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)&#xA;num_qubits = qubitOp.num_qubits&#xA;&#xA;...&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-01-19T15:52:10.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9593" PostTypeId="2" ParentId="9587" CreationDate="2020-01-19T15:58:38.883" Score="1" Body="&lt;p&gt;qiskit-aqua is the github repo in the link above. Chemistry is in the qiskit-aqua repo under qiskit.chemistry so&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;from qiskit.chemistry.components.variational_forms import UCCSD&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-01-19T15:58:38.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9594" PostTypeId="2" ParentId="9431" CreationDate="2020-01-20T04:55:08.083" Score="-2" Body="&lt;p&gt;In all honesty, I think quantum computing is a really, really bad place to start if your interested in computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's much more like being a &quot;mathematician&quot; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Learn to program on a classical computer first. And if you're interested in physics, why not start with learning how to do &quot;physics&quot; like things first. For instance, you could program a videogame like &lt;a href=&quot;http://cwestify.com/games/slime-volleyball/&quot; rel=&quot;nofollow noreferrer&quot;&gt;slime volleyball&lt;/a&gt; and add all sorts of realistic physics models. (Maybe nonelastic interactions? Air friction? You name it!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are really thinking of going the &quot;physics track,&quot; that means a life in the world of &quot;academia,&quot; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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):&#xA;&quot;Algebra 2&quot;(basically matrices and imaginary numbers), (skip trig &amp;amp; geometry, but learn what sin(x), cos(x), and e^ix are), calculus, differential equations, then some of &quot;modern physics&quot; (learn to solve schodingers equation &amp;amp; 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 &quot;theoretical programming&quot;, topics like what P and NP are, what's big(O) notation? Only after that can you try to tackle a &quot;quantum computing&quot; problem, at the minimum. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2020-01-20T04:55:08.083" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9595" PostTypeId="2" ParentId="9582" CreationDate="2020-01-20T13:01:22.453" Score="1" Body="&lt;p&gt;The only thing that is physical about a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is its square overlaps with other states. In other words, given an arbitrary complete basis &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}_k$&lt;/span&gt;, what matter are the overlaps &lt;span class=&quot;math-container&quot;&gt;$p_k=|\langle u_k|\psi\rangle|^2$&lt;/span&gt;, and these are interpreted as outcome probabilities and must therefore be normalised as &lt;span class=&quot;math-container&quot;&gt;$\sum_k p_k=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tells you two things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The global phase of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; doesn't matter: changing &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\to e^{i\phi}|\psi\rangle$&lt;/span&gt; doesn't affect the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt;. This means that one less degree of freedom is needed to characterise the state.&lt;/li&gt;&#xA;&lt;li&gt;The normalisation condition on the probabilities must always be satisfied, thus removing another degree of freedom.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;If the state is &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional, then it amounts to &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional qudits is &lt;span class=&quot;math-container&quot;&gt;$2(N-1)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-20T13:01:22.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9597" PostTypeId="1" CreationDate="2020-01-20T13:56:47.070" Score="5" ViewCount="256" Body="&lt;p&gt;Is there anything practical that can be done with a single qubit? And by &quot;practical,&quot; I mean a problem that can be solved or information that can be stored. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2020-05-02T02:56:11.733" Title="Is there anything practical that can be done with a single qubit?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9598" PostTypeId="2" ParentId="8458" CreationDate="2020-01-20T13:59:28.490" Score="0" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.technologyreview.com/f/614346/ibms-new-53-qubit-quantum-computer-is-the-most-powerful-machine-you-can-use/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT Technology Review&lt;/a&gt; reports that the new computer will be made available for researchers and companies through the Internet (which TR annoyingly calls &quot;the cloud&quot;), so my guess is that there is only a single machine. &lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2020-01-20T13:59:28.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9599" PostTypeId="1" AcceptedAnswerId="9600" CreationDate="2020-01-20T14:15:06.057" Score="0" ViewCount="119" Body="&lt;p&gt;Suppose I want to put a qubit whose initial state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to the final state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac{2}{3}}|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Well, in that case, the unitary matrix that performs such operation is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = \frac{1}{\sqrt{3}}\begin{pmatrix}1&amp;amp;-\sqrt{2}\\ \sqrt{2} &amp;amp; 1  \end{pmatrix}$$&lt;/span&gt;&#xA;So the question is, how can I build a quantum circuit with the usual quantum gates (X, Y, Z, etc) which reproduces this behavior?&lt;/p&gt;&#xA;" OwnerUserId="9716" LastActivityDate="2020-01-20T14:38:46.540" Title="How can I build up an arbitrary quantum circuit given a certain unitary matrix operation?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;unitarity&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9600" PostTypeId="2" ParentId="9599" CreationDate="2020-01-20T14:38:46.540" Score="0" Body="&lt;p&gt;You can use &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; (y-rotation gate). Its general matrix is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Ry(\theta) =&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\sin(\theta/2) \\&#xA;\sin(\theta/2) &amp;amp; \cos(\theta/2)&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the gate on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, you get a state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2) = \frac{1}{\sqrt{3}}$&lt;/span&gt; and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2\arccos\Big(\frac{1}{\sqrt{3}}\Big) = 1.910633.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can validate that such setting of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; gets your matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-20T14:38:46.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9601" PostTypeId="2" ParentId="8458" CreationDate="2020-01-20T17:13:35.127" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-01-20T17:13:35.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9602" PostTypeId="1" CreationDate="2020-01-20T18:20:45.687" Score="1" ViewCount="40" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For toss two: Of the four binary results of toss one, I will choose either 00 or 11.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9826" LastEditorUserId="9006" LastEditDate="2020-01-23T22:32:48.650" LastActivityDate="2020-01-23T22:32:48.650" Title="Can two intrinsic angular momentum directions (spin) be used for future entanglement after collapse?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-01-23T18:17:16.443" ContentLicense="CC BY-SA 4.0" />
  <row Id="9603" PostTypeId="1" AcceptedAnswerId="9604" CreationDate="2020-01-20T18:57:18.407" Score="2" ViewCount="72" Body="&lt;p&gt;After stumbling upon this recent news article: &lt;a href=&quot;https://newatlas.com/quantum-computing/quantum-teleportation-computer-chips&quot; rel=&quot;nofollow noreferrer&quot;&gt;Information teleported between two computer chips for the first time&lt;/a&gt; (which references a &quot;Nature Physics&quot; publication &lt;a href=&quot;https://www.nature.com/articles/s41567-019-0727-x&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chip-to-chip quantum teleportation and multi-photon entanglement in silicon&lt;/a&gt;)...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;...with quantum teleportation, information appears to break that speed limit&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;... I've been wondering what this specific break-through means for the state of quantum teleportation, if anything. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quotes above would appear to imply that information &lt;em&gt;can&lt;/em&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="308" LastActivityDate="2020-01-20T19:15:46.823" Title="Quantum teleportation between two computer chips, how relevant?" Tags="&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9604" PostTypeId="2" ParentId="9603" CreationDate="2020-01-20T19:15:46.823" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-01-20T19:15:46.823" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9606" PostTypeId="2" ParentId="9597" CreationDate="2020-01-21T02:59:20.427" Score="13" Body="&lt;p&gt;Some select examples of single qubit technology that has been used for decades:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Atomic_clock&quot; rel=&quot;noreferrer&quot;&gt;Atomic clocks&lt;/a&gt; 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.)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nuclear_magnetic_resonance&quot; rel=&quot;noreferrer&quot;&gt;NMR Spectroscopy&lt;/a&gt; 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.) &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Hardware_random_number_generator#Quantum_random_properties&quot; rel=&quot;noreferrer&quot;&gt;Quantum Random Number Generators&lt;/a&gt; use measurement of single qubits in superposition. (You can by machines that use polarisation of light to do this, for example.)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Interferometry&quot; rel=&quot;noreferrer&quot;&gt;Interferometers&lt;/a&gt; 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.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Possible future uses (nowhere near exhaustive or unbiased):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Coherent measurement for binary classification (see, e.g., &lt;a href=&quot;https://www.nature.com/articles/srep01800&quot; rel=&quot;noreferrer&quot;&gt;Quantum Data Gathering&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Quantum metrology for estimating phases (see, e.g., &lt;a href=&quot;https://quantum-journal.org/papers/q-2017-09-06-27/&quot; rel=&quot;noreferrer&quot;&gt;Quantum metrology with full and fast control&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Pedagogy (We'll never stop learning quantum starting with qubits. Having access to precision controlled single qubits would be useful in teaching.)&lt;/li&gt;&#xA;&lt;li&gt;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.)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4407" LastActivityDate="2020-01-21T02:59:20.427" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9607" PostTypeId="1" CreationDate="2020-01-21T07:22:01.123" Score="1" ViewCount="517" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9846" LastEditorUserId="55" LastEditDate="2020-07-26T18:08:37.600" LastActivityDate="2020-07-26T18:08:37.600" Title="Measuring T1 and T2 constants on IBM Q" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9608" PostTypeId="1" CreationDate="2020-01-21T10:45:45.130" Score="2" ViewCount="232" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's not too hard to translate into pyQuil and then to Qiskit from there, but a direct way would be much easier.&lt;/p&gt;&#xA;" OwnerUserId="9849" LastEditorUserId="23" LastEditDate="2020-02-02T09:28:12.173" LastActivityDate="2020-02-06T09:41:36.270" Title="Openfermion to qiskit" Tags="&lt;qiskit&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;openfermion&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9609" PostTypeId="1" AcceptedAnswerId="9612" CreationDate="2020-01-21T12:21:52.230" Score="3" ViewCount="156" Body="&lt;p&gt;Google's article &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum supremacy using a programmable superconducting processor&lt;/a&gt; states that the processor &quot;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%.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where are the gates physically located? In the diagram, the qubits are the crosses and the qubits are the couplers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RjXSG.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RjXSG.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9482" LastEditorUserId="9006" LastEditDate="2020-01-21T13:48:34.500" LastActivityDate="2020-01-22T13:26:11.480" Title="Where are the physical gates in the Google processor?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9610" PostTypeId="1" AcceptedAnswerId="9613" CreationDate="2020-01-21T13:29:54.873" Score="5" ViewCount="177" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; be the number we're trying to factor. In Shor's algorithm, the top register then has &lt;span class=&quot;math-container&quot;&gt;$2 \lceil\log_2(N)\rceil+1$&lt;/span&gt; qubits, while the bottom register (the ancilla qubits) has &lt;span class=&quot;math-container&quot;&gt;$\lceil\log_2(N)\rceil$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is stated in my &lt;a href=&quot;https://www.slideshare.net/DavidCian/week5-ap3421-2019part1&quot; rel=&quot;noreferrer&quot;&gt;lecture notes&lt;/a&gt; on slide 25.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe I have an approximate understanding of Shor's algorithm: the end result on the top register, &lt;span class=&quot;math-container&quot;&gt;$\left| x_{\text{final}} \right&amp;gt;$&lt;/span&gt;, is such that &lt;span class=&quot;math-container&quot;&gt;$\frac{x_{\text{final}}}{T} = \frac{s}{r}$&lt;/span&gt; for some integer &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. In the aforementioned equation, &lt;span class=&quot;math-container&quot;&gt;$T=2^{2 \lceil \log_2(N) \rceil + 1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the oracle's (modular exponentiation) period.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The end result of the bottom (ancillary) register is the result of the modular exponentiation: &lt;span class=&quot;math-container&quot;&gt;$\left| f(x) + y \right&amp;gt; = \left| f(x) \right&amp;gt; = \left| a^x \mod N \right&amp;gt;$&lt;/span&gt;. The largest result possible is &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt;, for which you require &lt;span class=&quot;math-container&quot;&gt;$\lceil \log_2(N - 1) \rceil$&lt;/span&gt; qubits, so it makes sense that the size of the bottom register is &lt;span class=&quot;math-container&quot;&gt;$\lceil\log_2(N)\rceil$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not however understand the choice of the size of the top register.&lt;/p&gt;&#xA;" OwnerUserId="9408" LastActivityDate="2020-01-21T19:25:21.263" Title="Why is the size of the top register for Shor's algorithm chosen as it is?" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9611" PostTypeId="1" AcceptedAnswerId="9618" CreationDate="2020-01-21T13:41:17.947" Score="2" ViewCount="232" Body="&lt;p&gt;Consider Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}, \mathcal{Y}$&lt;/span&gt;. For any quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{\mathcal{X}\rightarrow \mathcal{Y}}$&lt;/span&gt;, the bipartite Choi state &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal{E}) \in L(\mathcal{Y}\otimes\mathcal{X})$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$J(\mathcal{E}) = (\mathcal{E}\otimes I)\sum_{a,b} \vert a\rangle\langle b\vert\otimes\vert a\rangle\langle b\vert$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is also possible to show (see &lt;a href=&quot;https://cs.uwaterloo.ca/~watrous/LectureNotes/CS766.Fall2011/05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for example) that the trace preserving condition of the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is equivalent to the following condition on its Choi state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_\mathcal{Y}J(\mathcal{E}) = I_\mathcal{X} \tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof is easy - it relies on noticing that the trace preserving condition implies that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\vert a\rangle\langle b\vert) = \delta_{a,b}$&lt;/span&gt; due to the trace preserving condition. Meanwhile, positive-semidefiniteness of &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal{E})$&lt;/span&gt; corresponds to complete positivity of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal{E})$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(J(\mathcal{E})) = 1$&lt;/span&gt; (in addition to positive semidefiniteness) give us any condition on the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;?  &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2021-03-05T11:05:39.543" LastActivityDate="2021-03-05T11:05:39.543" Title="What does a &quot;Choi state&quot; where we relax the partial trace condition represent?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9612" PostTypeId="2" ParentId="9609" CreationDate="2020-01-21T15:14:45.157" Score="4" Body="&lt;p&gt;In relating quantum computing to classical computing there may be a small conceptual hurdle that needs to be overcome.  Although a classical &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; or an &lt;span class=&quot;math-container&quot;&gt;$\mathsf{H}$&lt;/span&gt; gate used in quantum computing most often is a little more subtle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt; 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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Accordingly the &quot;1,113 single-qubit gates, 430 two-qubit gates&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-01-22T13:26:11.480" LastActivityDate="2020-01-22T13:26:11.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9613" PostTypeId="2" ParentId="9610" CreationDate="2020-01-21T19:25:21.263" Score="7" Body="&lt;p&gt;In a nutshell, the number of qubits in the top register directly corresponds to the number of bits of precision to which &lt;span class=&quot;math-container&quot;&gt;$x/T$&lt;/span&gt; approximates &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;, and we need enough precision to be able to determine &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; given &lt;span class=&quot;math-container&quot;&gt;$x/T$&lt;/span&gt;. For example, if &lt;span class=&quot;math-container&quot;&gt;$s=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is large, then we cannot afford to confuse &lt;span class=&quot;math-container&quot;&gt;$1/r$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$1/(r+1)$&lt;/span&gt;, say.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more detail, think about any two fractions &lt;span class=&quot;math-container&quot;&gt;$a/b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c/d$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$a/b\not=c/d$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; are both positive integers that are less than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Because these are integers, and because &lt;span class=&quot;math-container&quot;&gt;$ad\not=bc$&lt;/span&gt;, we find that the difference between them satisfies the following inequality:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Bigl| \frac{a}{b} - \frac{c}{d} \Bigr| = \frac{|ad-bc|}{bd} &amp;gt; \frac{1}{N^2}.&#xA;$$&lt;/span&gt;&#xA;So, if &lt;span class=&quot;math-container&quot;&gt;$x/T$&lt;/span&gt; is an approximation to &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt; that is good to &lt;span class=&quot;math-container&quot;&gt;$2\lceil\log(N)\rceil + 1$&lt;/span&gt; bits of precision, the error of this approximation will be less than half of &lt;span class=&quot;math-container&quot;&gt;$1/N^2$&lt;/span&gt;, so the approximation has to be closer to &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt; than it is to any other fraction of a different value having a denominator smaller than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (and of course the continued fraction algorithm will allow us to find &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$1/r$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$1/(r+1)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; close to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-01-21T19:25:21.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9614" PostTypeId="1" AcceptedAnswerId="9615" CreationDate="2020-01-21T20:45:19.510" Score="2" ViewCount="577" Body="&lt;p&gt;This is part of Simon Algorithm (Initial state + some Oracle function)&#xA;There is a post that explains how to interpret circuits (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2299/how-to-interpret-a-quantum-circuit-as-a-matrix&quot;&gt;How to interpret a quantum circuit as a matrix?&lt;/a&gt;), but I'm not sure how to apply to the following circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/30Bxt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/30Bxt.png&quot; alt=&quot;Circuit built with IMB plataform&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first part, both Hadamard to first and second qubit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M_1 = H \otimes H \otimes I  \otimes I$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, first Controlled NOT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I apply a matrix to the first and second qubit if I have &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; that is a 16x16 matrix.&#xA;I know I could have applied &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to the first qubit and then do a tensor product with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; (third qubit), and the result, multiply by &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;. But then I have the second &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; which is applied to the first qubit and 4th qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Symbol &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; is a tensor product.&lt;/p&gt;&#xA;" OwnerUserId="9797" LastEditorUserId="9006" LastEditDate="2020-01-21T22:39:48.363" LastActivityDate="2020-04-21T15:51:38.077" Title="How to interpret a 4 qubit quantum circuit as a matrix?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9615" PostTypeId="2" ParentId="9614" CreationDate="2020-01-21T22:38:03.700" Score="4" Body="&lt;p&gt;&lt;em&gt;Note: &lt;span class=&quot;math-container&quot;&gt;$I_k$&lt;/span&gt; is unit matrix and &lt;span class=&quot;math-container&quot;&gt;$O_k$&lt;/span&gt; is the zero matrix of order &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; in the following text.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First step of the algorithm is &lt;span class=&quot;math-container&quot;&gt;$H \otimes H \otimes I_2 \otimes I_2$&lt;/span&gt; as you mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A controlled gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits between the control qubit and the target qubit can expressed as a matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CU_{n} =&#xA;\begin{pmatrix}&#xA;I_{\frac{N}{2}} &amp;amp; O_{\frac{N}{2}} \\&#xA;O_{\frac{N}{2}} &amp;amp; I_{\frac{N}{4}} \otimes U&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$N = 2^{n + 2}$&lt;/span&gt; (you can check that for &lt;span class=&quot;math-container&quot;&gt;$n=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U=X$&lt;/span&gt; you will get CNOT matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how to apply this on CNOT acting on &lt;span class=&quot;math-container&quot;&gt;$q_{2}$&lt;/span&gt; and controlled with &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt;. In this case &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U=X$&lt;/span&gt;. Hence &lt;span class=&quot;math-container&quot;&gt;$N=2^{1+2}=8$&lt;/span&gt; and CNOT in the second step of algorithm can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CX_{1} =&#xA;\begin{pmatrix}&#xA;I_{4} &amp;amp; O_{4} \\&#xA;O_{4} &amp;amp; I_{2} \otimes X&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that there is a &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gate on qubit &lt;span class=&quot;math-container&quot;&gt;$q_{3}$&lt;/span&gt;, so the second step of the algoritm can be written as &lt;span class=&quot;math-container&quot;&gt;$CX_{1} \otimes I_{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Third step is CNOT gate with two qubits between control and target qubits (&lt;span class=&quot;math-container&quot;&gt;$N=2^{2+2} = 16$&lt;/span&gt;) hence its matrix is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CX_{2} =&#xA;\begin{pmatrix}&#xA;I_{8} &amp;amp; O_{8} \\&#xA;O_{8} &amp;amp; I_{4} \otimes X&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fourth step is simply &lt;span class=&quot;math-container&quot;&gt;$I_2 \otimes CNOT \otimes I_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fifth step is &lt;span class=&quot;math-container&quot;&gt;$I_2 \otimes CX_{1}$&lt;/span&gt; (i.e. similarly as in the second step but matrices in Kronecker product are switched).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-21T15:51:38.077" LastActivityDate="2020-04-21T15:51:38.077" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9616" PostTypeId="2" ParentId="9607" CreationDate="2020-01-22T00:06:25.567" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In magnetic resonance T2 is commonly measured by generating a spin coherence, and refocusing at progressively longer times then measuring a spin echo. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum gate language that would be: prepare in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, Hadamard gate, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate, Hadamard gate, measure. And progressively add identity operations between the &lt;span class=&quot;math-container&quot;&gt;$H-X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X-H$&lt;/span&gt;. Alternatively you can add progressively more &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates and only measure at the odd numbered ones. Though I suppose the latter method would introduce gate errors into your measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And T1 in magnetic resonance is usually measured by an inversion recovery: so prepare qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, invert with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and measure at progressively longer delays by using identity operations as delays. &lt;/p&gt;&#xA;" OwnerUserId="9579" LastEditorUserId="9006" LastEditDate="2020-01-24T05:46:57.823" LastActivityDate="2020-01-24T05:46:57.823" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9618" PostTypeId="2" ParentId="9611" CreationDate="2020-01-22T11:43:53.863" Score="2" Body="&lt;p&gt;It is exactly what you say: A &quot;Choi state&quot; 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 &quot;success probability&quot; when implementing the CP map via the isomorphism - if you wish, it rescales the trace of all output states &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)$&lt;/span&gt; by a constant factor. (Note that deviating from the local trace condition &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_Y J = I$&lt;/span&gt;, but keeping the total trace &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr} J =1$&lt;/span&gt;, implies that there will be inputs with outputs with trace &lt;em&gt;larger&lt;/em&gt; than one.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-01-22T11:43:53.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9620" PostTypeId="1" CreationDate="2020-01-22T14:25:54.547" Score="1" ViewCount="85" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know where can I find such values for the IBM quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="6180" LastEditDate="2020-01-22T14:48:32.197" LastActivityDate="2020-01-22T15:36:11.097" Title="IBM quantum computers gate delay values" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9621" PostTypeId="2" ParentId="9620" CreationDate="2020-01-22T15:16:03.087" Score="3" Body="&lt;p&gt;The length of all backend basis gates is available from &lt;code&gt;backend.properties().gate_length&lt;/code&gt;. For example&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;properties = backend.properties()&#xA;id_gate_length_qo = properties.gate_length('id', 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9863" LastActivityDate="2020-01-22T15:16:03.087" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9622" PostTypeId="2" ParentId="9620" CreationDate="2020-01-22T15:36:11.097" Score="1" Body="&lt;p&gt;In addition to &lt;code&gt;backend.properties()&lt;/code&gt; described above, you can go to &lt;a href=&quot;https://quantum-computing.ibm.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com&lt;/a&gt;, click a machine, then click &quot;Download Calibrations&quot;.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-01-22T15:36:11.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9623" PostTypeId="1" AcceptedAnswerId="9625" CreationDate="2020-01-22T23:02:54.447" Score="4" ViewCount="256" Body="&lt;p&gt;This is the exercise 4.23 from Nielsen and Chuang, asking that if it is possible to construct &lt;span class=&quot;math-container&quot;&gt;$C^1(U)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$U=R_{x,y}(\theta)$&lt;/span&gt; with TWO single qubit gates and CNOT gate. My answer is no, and I would like to argue in the following way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we do have such a construction for &lt;span class=&quot;math-container&quot;&gt;$U=R_z(\theta)$&lt;/span&gt; which is the following (sorry that I have to draw it by hand)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cwVTX.png&quot; width=&quot;320&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the (reverse) CNOT has the matrix representation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0  \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;such that we have the matrix representation of the circuit as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0  \\&#xA;\end{bmatrix}&#xA;\big(&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{-i\theta/2}&#xA;\end{bmatrix}&#xA;\otimes &#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\theta/2}&#xA;\end{bmatrix}&#xA;\big)&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0  \\&#xA;\end{bmatrix} = &#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; e^{-i\theta/2} &amp;amp; 0  \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\theta/2}  \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is the desired matrix for &lt;span class=&quot;math-container&quot;&gt;$C^1(R_z(\theta))$&lt;/span&gt;. Thus we do a have a circuit with only two single qubit gates and CNOT for &lt;span class=&quot;math-container&quot;&gt;$U=R_z(\theta)$&lt;/span&gt;. Now for the rotation &lt;span class=&quot;math-container&quot;&gt;$U=R_x(\theta) = VR_z(\theta)V^\dagger$&lt;/span&gt;, which differ from &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; by a unitary transformation V, we will need to &quot;sandwich&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$U=R_{x,y}$&lt;/span&gt;. However, on the other hand, physically there is no difference between various rotation operators, it feels not right that only &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; has such circuit construction but not for others. So I may have missed sth here, and any help and clarification is appreciated. &lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-01-24T17:05:57.393" LastActivityDate="2020-01-24T17:05:57.393" Title="Constructing a circuit for $C^1(U)$ for rotation operators with TWO single qubit gates and CNOT gate" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9624" PostTypeId="2" ParentId="9597" CreationDate="2020-01-23T01:59:50.700" Score="3" Body="&lt;p&gt;I particularly like this example of a &lt;a href=&quot;https://arxiv.org/abs/1907.02085&quot; rel=&quot;nofollow noreferrer&quot;&gt;single qubit quantum classifier&lt;/a&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There’s an &lt;a href=&quot;https://pennylane.ai/qml/app/tutorial_data_reuploading_classifier.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;example implementation&lt;/a&gt; from Xanadu in Python along with a basic overview. &lt;/p&gt;&#xA;" OwnerUserId="1937" LastActivityDate="2020-01-23T01:59:50.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9625" PostTypeId="2" ParentId="9623" CreationDate="2020-01-23T07:38:42.120" Score="2" Body="&lt;p&gt;The question comes in two parts. Firstly, for the top circuit, can you find the gates &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$ABC=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CXBXA=R_x(\theta)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt;. Secondly, can you reduce either of these to the lower circuit with &lt;span class=&quot;math-container&quot;&gt;$AB=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$XBXA=R_x(\theta)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3PzOk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3PzOk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$C=I$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part, I'll do specifically for the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; version. We know that we need &lt;span class=&quot;math-container&quot;&gt;$B=A^\dagger$&lt;/span&gt;, which means that &lt;span class=&quot;math-container&quot;&gt;$A^\dagger XA$&lt;/span&gt; squares to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. So, we can certainly choose an &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$A^\dagger XA=\cos\theta X+\sin\theta Z$&lt;/span&gt;. Hence, &lt;span class=&quot;math-container&quot;&gt;$XBXA=\cos\theta I-i\sin\theta Y=R_Y(2\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To identify &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in this case, note that we can write &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in the form &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle +|-|-\rangle\langle -|$&lt;/span&gt; and the target unitary &lt;span class=&quot;math-container&quot;&gt;$\cos\theta X+\sin\theta Z$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|u\rangle\langle u|-|v\rangle\langle v|$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\langle u|v\rangle=0$&lt;/span&gt;. So, we simply define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=|+\rangle\langle u|+|-\rangle\langle v|,&#xA;$$&lt;/span&gt;&#xA;and this achieves the desired transformation. Alternatively, I could predict (this comes with experience. The reliable way is the way I just stated.) that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; would be of the form &lt;span class=&quot;math-container&quot;&gt;$R_Y(\phi)$&lt;/span&gt;. Then we'd see&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A^\dagger XA=XA^2=XR_Y(2\phi)=X\cos\phi-\sin\phi Z,&#xA;$$&lt;/span&gt;&#xA;and you just have to choose the correct value of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; to give you the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; that you want.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, note that we cannot achieve the controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; rotation. Here, you would need &lt;span class=&quot;math-container&quot;&gt;$BA=I$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$B=A^\dagger$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$XBXA=R_x(\theta)$&lt;/span&gt;. Now observe that these two conditions could be rewritten as &lt;span class=&quot;math-container&quot;&gt;$BA=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$BXA=R_x(\theta+\pi)$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, meaning the &lt;span class=&quot;math-container&quot;&gt;$R_x(\theta+\pi)$&lt;/span&gt; would have to have eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, meaning &lt;span class=&quot;math-container&quot;&gt;$\theta=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; are the only possible values (which is exactly the do nothing and controlled-not gates up to some possible permutations).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-01-24T08:49:13.017" LastActivityDate="2020-01-24T08:49:13.017" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9626" PostTypeId="1" CreationDate="2020-01-23T11:07:34.970" Score="6" ViewCount="667" Body="&lt;p&gt;Consider the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. Mathematically, we have &lt;span class=&quot;math-container&quot;&gt;$X=i e^{-i\frac{\pi}{2} X}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But as global phase of unitaries don't matter because they will simply act a global phase to the wavefunction, we can consider implementing &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$e^{-i\frac{\pi}{2} X}$&lt;/span&gt;, allright.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, consider a CNOT. Formally, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT=|0\rangle \langle 0| \otimes \mathbb{I} + |1\rangle \langle 1| \otimes X $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If at this point I say &quot;well, a &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate or a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; rotation around &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the same, up to global phase&quot;, I could say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT=|0\rangle \langle 0| \otimes \mathbb{I} + |1\rangle \langle 1| \otimes e^{-i\frac{\pi}{2} X} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But the two expressions of the CNOT do not differ from a global phase.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is the following. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's assume we want to implement an algorithm. Is it that we have &lt;strong&gt;at the beginning&lt;/strong&gt; to define once for all how we implement an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, and be consistant all along.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if as soon as there is an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in the algorithm and that I replace it by &lt;span class=&quot;math-container&quot;&gt;$e^{-i\frac{\pi}{2} X}$&lt;/span&gt;, then I will be fine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But, if sometime I replace it by &lt;span class=&quot;math-container&quot;&gt;$ie^{-i\frac{\pi}{2} X}$&lt;/span&gt; and sometime by &lt;span class=&quot;math-container&quot;&gt;$e^{-i\frac{\pi}{2} X}$&lt;/span&gt; then I will have problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, then I will be safe ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Other question (more important for my purpose).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How is it possible from this to implement a CNOT operation ? Indeed this example shows that a CNOT is &lt;strong&gt;not&lt;/strong&gt; a controlled &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;-pulse around &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. How could I add the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; that is missing in practice then ? Because from respect to the target qubit this &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is a global phase. This confuses me.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2020-01-23T12:57:22.750" LastActivityDate="2020-01-23T21:13:56.377" Title="Global phase and single qubit gate: does it actually matter for two (or more) qubit gates?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9627" PostTypeId="1" CreationDate="2020-01-23T13:18:14.817" Score="4" ViewCount="239" Body="&lt;p&gt;Sender and receiver use the teleportation protocol, where the sender teleports a quantum state &lt;span class=&quot;math-container&quot;&gt;$\left| \varphi \right&amp;gt;=\alpha\left| 0 \right&amp;gt; + \beta \left|1\right&amp;gt;$&lt;/span&gt; to the receiver.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to implement this protocol, and then find the output &lt;span class=&quot;math-container&quot;&gt;$\left| ABC \right&amp;gt;$&lt;/span&gt; of the quantum circuit when the measurement of the teleportation protocol in the left side is &lt;span class=&quot;math-container&quot;&gt;$\left| 11\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words: &lt;strong&gt;when we measure &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, how to show that the state &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; was really teleported?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZxLls.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZxLls.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-11-10T17:35:59.873" LastActivityDate="2020-11-10T17:35:59.873" Title="Compute the output of the quantum teleportation circuit" Tags="&lt;quantum-state&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9628" PostTypeId="1" CreationDate="2020-01-23T17:42:07.787" Score="2" ViewCount="84" Body="&lt;p&gt;Consider a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. Let it have purification &lt;span class=&quot;math-container&quot;&gt;$\psi_{A'AB}$&lt;/span&gt;. I am interested in the coherent information of this state which is given by &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(A\rangle B)_\rho = S(B)_\rho - S(AB)_\rho$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can rewrite this as follows using the fact that &lt;span class=&quot;math-container&quot;&gt;$\psi_{A'AB}$&lt;/span&gt; is pure. &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;I(A\rangle B) &amp;amp;= S(B)_\rho - S(AB)_\rho\\&#xA;&amp;amp;=S(A'A)_\psi - S(A')_\psi \\&#xA;&amp;amp;= S(A|A')_\psi&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let us consider &lt;span class=&quot;math-container&quot;&gt;$J(A\rangle B) = -I(A\rangle B)$&lt;/span&gt;. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;J(A\rangle B) &amp;amp;= S(AB)_\rho - S(B)_\rho\\&#xA;&amp;amp;= S(A|B)_\psi&#xA;\end{align}&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the quantum conditional entropy &lt;span class=&quot;math-container&quot;&gt;$S(X|Y)$&lt;/span&gt; is a concave function of the input state (see Corollary 11.13 in Nielsen and Chuang). So both &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; are concave. This would imply that the coherent information is a linear function of &lt;span class=&quot;math-container&quot;&gt;$\psi_{A'AB}$&lt;/span&gt; which I believe is not true. Where did I make a mistake in the argument? &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-11-04T16:02:28.237" LastActivityDate="2020-11-04T16:02:28.237" Title="Convexity of coherent information - erroneous argument!" Tags="&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9629" PostTypeId="2" ParentId="9567" CreationDate="2020-01-23T19:30:11.987" Score="0" Body="&lt;p&gt;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 &lt;code&gt;PATH&lt;/code&gt; in the command prompt. You have to add the path to your dotnet tools which should be &lt;code&gt;%USERPROFILE%/.dotnet/tools&lt;/code&gt; in the control panel. Look on the internet about how to do it, there are plenty tutorials. The problem should be solved.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-01-23T19:30:11.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9630" PostTypeId="2" ParentId="9626" CreationDate="2020-01-23T21:13:56.377" Score="7" Body="&lt;p&gt;&lt;strong&gt;What is this business of global phase?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, most people encounter this when seeing their first calculation and the teacher says, &quot;we can just get rid of that because overall phases don't matter.&quot; But where does this come from? First, the math answer:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;States of quantum systems are properly modelled as &lt;a href=&quot;https://en.wikipedia.org/wiki/Projective_Hilbert_space&quot; rel=&quot;noreferrer&quot;&gt;complex projective spaces&lt;/a&gt;. (More loosely: 1 dimensional subspaces of the Hilbert space.)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In direct notation, the statement is saying the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is really the projector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\!\langle\psi|$&lt;/span&gt;. Now consider the state defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi_\theta\rangle = e^{i \theta}|\psi\rangle.&#xA;$$&lt;/span&gt; &#xA;Its corresponding projector is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi_\theta\rangle\!\langle\psi_\theta|= e^{i \theta}|\psi\rangle\!\langle\psi| e^{-i\theta} = |\psi\rangle\!\langle\psi|.&#xA;$$&lt;/span&gt;&#xA;The exact same projector! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another answer is that overall phases always drop out at the end of any calculation. Consider again the state defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi_\theta\rangle = e^{i \theta}|\psi\rangle.&#xA;$$&lt;/span&gt; &#xA;You could carry that phase through the whole calculation. But quantum calculations always end with a modulus inner product:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle\phi|\psi_\theta\rangle|^2=|e^{i\theta}\langle\phi|\psi\rangle|^2 = |e^{i\theta}|^2|\langle\phi|\psi\rangle|^2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The important part here is that such a calculation is only ever done on the &lt;em&gt;entire&lt;/em&gt; system. &lt;strong&gt;Phases can be removed not be because they are unphysical or don't matter, but because they are inconvenient in some calculations.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another way to think about it is: two states can be considered the &quot;same&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta} CNOT$&lt;/span&gt; could be considered equivalent, but not if they were part of a larger system.&lt;/p&gt;&#xA;" OwnerUserId="4407" LastActivityDate="2020-01-23T21:13:56.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9631" PostTypeId="1" CreationDate="2020-01-24T05:42:00.140" Score="0" ViewCount="225" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;pauli = Pauli( z=[0], x=[1], label=None)&#xA;weighted_pauli = WeightedPauliOperator(paulis=[(1,pauli)])&#xA;a = qpc.construct_circuit()&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit &lt;code&gt;a&lt;/code&gt; does not seem to be the correct one. More objectively, is there anyway to reproduce a QPE circuit as the one shown in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm#/media/File:PhaseCircuit-crop.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; through Aqua?&lt;/p&gt;&#xA;" OwnerUserId="9877" LastActivityDate="2020-01-24T14:19:00.427" Title="Right way to use Quantum Phase Estimation using aqua" Tags="&lt;qiskit&gt;&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9632" PostTypeId="2" ParentId="9607" CreationDate="2020-01-24T09:06:17.773" Score="1" Body="&lt;p&gt;Lets start with measuring circuits. With link to &lt;em&gt;user245427&lt;/em&gt; answer, you should construct following circuits in composer followingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;T1 (relaxation time)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;T1 is constant connected with spontaneous relaxation from state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. So firstly apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on a qubit to change its state from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, then apply a few &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gates to make a delay and then measure results. Record a probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (i.e. relaxation did not occur).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;T2 (dephasing time)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;T2 is connected with change in phase, for example state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; changes spontaneously to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. To prepare &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Then apply several &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gates to make a delay. After that apply again &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate and do measurement. Record probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (i.e. phase change did not occur).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;T1 and T2 calculation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both decoherence processes are described by exponential decay law:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(t) = \mathrm{e}^{-\frac{t}{T}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is eiher T1 or T2 constant, &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is time between setting qubit to either state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; for T1 or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; for T2 and its measurment. Having probabilities that a qubit is in state either &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and knowing &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; you can easily calculate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T = -\frac{t}{\ln P(t)}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Although it is not problem to construct such circuits on IBM Q, I realized that the problem is how to obtain time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. I did so on Melbourne processor but it seems that some other operations take place among shots which lengthen time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. As a result you can not get actual time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. If you put lenght of simulation to the formula above, resulting T1 is in order of miliseconds which does not make sense.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-24T09:06:17.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9633" PostTypeId="2" ParentId="9631" CreationDate="2020-01-24T11:41:30.727" Score="0" Body="&lt;p&gt;I believe &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/63f6d52747716d90c8f43eb16d110bcdd39dda05/qiskit/advanced/aqua/linear_systems_of_equations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt; takes you through how to find eigenvectors. They use &lt;code&gt;EigsQPE&lt;/code&gt;, through a helper function they define themselves, called &lt;code&gt;create_eigs()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-01-24T11:41:30.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9634" PostTypeId="1" AcceptedAnswerId="9636" CreationDate="2020-01-24T12:42:35.150" Score="2" ViewCount="84" Body="&lt;p&gt;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 &lt;em&gt;have&lt;/em&gt; 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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So how will quantum computers search anything, other than tuning parameters?&lt;/p&gt;&#xA;" OwnerUserId="9482" LastEditorUserId="9006" LastEditDate="2020-01-24T13:49:33.167" LastActivityDate="2020-01-25T05:28:35.610" Title="How will quantum computers access large amounts of storage?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;quantum-memory&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9635" PostTypeId="1" AcceptedAnswerId="9639" CreationDate="2020-01-24T13:20:46.447" Score="8" ViewCount="507" Body="&lt;p&gt;I sometimes see the &quot;Fubini-Study distance&quot; between two (pure) states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle,|\phi\rangle$&lt;/span&gt; written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;d(\psi,\phi)_1=\arccos(|\langle\psi|\phi\rangle|),&#xA;$$&lt;/span&gt;&#xA;for example &lt;a href=&quot;https://en.wikipedia.org/wiki/Fubini%E2%80%93Study_metric#In_bra-ket_coordinate_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the Wikipedia page&lt;/a&gt;.&#xA;Other sources (e.g. &lt;a href=&quot;https://arxiv.org/abs/1611.03449&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; in pag. 16), use the definition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;d(\psi,\phi)_2=\sqrt{1-|\langle\psi|\phi\rangle|}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the difference between these two definitions? Is one preferred over the other?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="4407" LastEditDate="2020-01-25T00:23:26.387" LastActivityDate="2020-10-29T08:01:26.017" Title="What is the difference between the &quot;Fubini-Study distances&quot; $\arccos|\langle\psi|\phi\rangle|$ and $\sqrt{1-|\langle\psi|\phi\rangle|}$?" Tags="&lt;fidelity&gt;&lt;state-space-geometry&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9636" PostTypeId="2" ParentId="9634" CreationDate="2020-01-24T13:48:35.747" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are right that storage is still a problem. So far quantum RAM (qRAM) was proposed. However, it also face problems such a decoherence.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find a proposal of quantum RAM architecture here: &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum random access memory&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some discussion on qRAM is on this forum &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1195/state-of-the-art-in-quantum-memory&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overall, data can be stored classically and access via hybrid algorithms. However, in this case part of quantum speed-up is lost.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-24T13:48:35.747" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9637" PostTypeId="2" ParentId="9631" CreationDate="2020-01-24T14:19:00.427" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-01-24T14:19:00.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9638" PostTypeId="2" ParentId="5462" CreationDate="2020-01-24T22:06:39.423" Score="0" Body="&lt;p&gt;@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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;x=0, \quad y=(0123)\rightarrow(0123) \\&#xA;x=1, \quad y=(0123)\rightarrow(1230) \\&#xA;x=2, \quad y=(0123)\rightarrow(2301) \\&#xA;x=3, \quad y=(0123)\rightarrow(3012) &#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where by arrow we mean &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is treated as an output. So if we denote &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle\equiv|x\rangle|y\rangle=|ab\rangle\ |cd\rangle$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$a,b=0,1$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;|00cd\rangle \rightarrow |00cd\rangle &#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;|0100\rangle \rightarrow |0101\rangle \\&#xA;|0101\rangle \rightarrow |0110\rangle \\&#xA;|0110\rangle \rightarrow |0111\rangle \\&#xA;|0111\rangle \rightarrow |0100\rangle &#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;|1000\rangle \rightarrow |1010\rangle \\&#xA;|1001\rangle \rightarrow |1011\rangle \\&#xA;|1010\rangle \rightarrow |1000\rangle \\&#xA;|1011\rangle \rightarrow |1001\rangle &#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;|1100\rangle \rightarrow |1111\rangle \\&#xA;|1101\rangle \rightarrow |1100\rangle \\&#xA;|1110\rangle \rightarrow |1101\rangle \\&#xA;|1111\rangle \rightarrow |1110\rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;I_4, \begin{bmatrix}&#xA;&amp;amp; I_3 \\&#xA;1&#xA;\end{bmatrix},&#xA;\begin{bmatrix}&#xA; &amp;amp; I_2 \\&#xA;I_2&#xA;\end{bmatrix},&#xA;\begin{bmatrix}&#xA;&amp;amp; 1\\&#xA;I_3&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;respectively for the above four sectors. Since the matrices acting on different sectors (the big &lt;span class=&quot;math-container&quot;&gt;$16\times16$&lt;/span&gt; matrix is block-diagonal), we can construct them separately. In particular, we notice for the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; sector,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA;&amp;amp; I_3 \\&#xA;1&#xA;\end{bmatrix}=\begin{bmatrix}&#xA;I_2 &amp;amp; \\&#xA;&amp;amp; X&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; \\&#xA;&amp;amp; X\\&#xA;&amp;amp; &amp;amp; 1&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;X &amp;amp; \\&#xA;&amp;amp; I_2&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is CNOT conditioned by the first qubit being zero, followed by SWAP, and followed by CNOT. Similarly for the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; space, which is just the hermitian conjugate. For &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, it is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA; &amp;amp; I_2 \\&#xA;I_2&#xA;\end{bmatrix} = X\otimes I_2 &#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i3HIQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i3HIQ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastActivityDate="2020-01-24T22:06:39.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9639" PostTypeId="2" ParentId="9635" CreationDate="2020-01-24T22:30:37.167" Score="7" Body="&lt;p&gt;Recall the law of cosines for two unit vectors &lt;span class=&quot;math-container&quot;&gt;$\mathbf{u}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{v}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^2$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathbf{u}-\mathbf{v}\|^2 = 2-2\cos\theta,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the angle between the vectors. Similarly, you'll recall the definition of the inner product,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \mathbf u|\mathbf {v}\rangle = \cos\theta.&#xA;$$&lt;/span&gt;&#xA;So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathbf{u}-\mathbf{v}\|  = \sqrt{2}\sqrt{1- \langle\mathbf{u}|\mathbf{v}\rangle}.&#xA;$$&lt;/span&gt; &#xA;For these unit vectors in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the arc length on the unit circle intersecting these vectors. It is a distance. In your notation, &lt;span class=&quot;math-container&quot;&gt;$d(\mathbf{u},\mathbf{v})_1$&lt;/span&gt; is the arc length and &lt;span class=&quot;math-container&quot;&gt;$d(\mathbf{u},\mathbf{v})_2$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For complex vectors we can do something analogous. Define the &quot;Hermitian angle&quot; of two complex vectors &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathbb C^n$&lt;/span&gt; to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta = |\langle\psi|\phi\rangle|.&#xA;$$&lt;/span&gt;&#xA;Now consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\psi -\phi\|^2 = 2-2\Re[\langle\psi|\phi\rangle] \geq 2-2|\langle\psi|\phi\rangle|.&#xA;$$&lt;/span&gt;&#xA;So you can see that &lt;span class=&quot;math-container&quot;&gt;$d(\psi,\phi)_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d(\psi,\phi)_2$&lt;/span&gt; are analogous, but not quite, the arc length and distance between the quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both are distances and both are referred to by the name &quot;Fubini-Study&quot;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4407" LastActivityDate="2020-01-24T22:30:37.167" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9640" PostTypeId="2" ParentId="9634" CreationDate="2020-01-25T05:28:35.610" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2020-01-25T05:28:35.610" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9641" PostTypeId="1" AcceptedAnswerId="9653" CreationDate="2020-01-25T09:22:23.550" Score="2" ViewCount="135" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Example error probabilities&#xA;p_reset = 0.03&#xA;p_meas = 0.1&#xA;p_gate1 = 0.05&#xA;&#xA;# QuantumError objects&#xA;error_reset = pauli_error([('X', p_reset), ('I', 1 - p_reset)])&#xA;error_meas = pauli_error([('X',p_meas), ('I', 1 - p_meas)])&#xA;error_gate1 = pauli_error([('X',p_gate1), ('I', 1 - p_gate1)])&#xA;error_gate2 = error_gate1.tensor(error_gate1)&#xA;&#xA;# Add errors to noise model&#xA;noise_bit_flip = NoiseModel()&#xA;noise_bit_flip.add_all_qubit_quantum_error(error_reset, &quot;reset&quot;)&#xA;noise_bit_flip.add_all_qubit_quantum_error(error_meas, &quot;measure&quot;)&#xA;noise_bit_flip.add_all_qubit_quantum_error(error_gate1, [&quot;u1&quot;, &quot;u2&quot;, &quot;u3&quot;])&#xA;noise_bit_flip.add_all_qubit_quantum_error(error_gate2, [&quot;cx&quot;])&#xA;&#xA;print(noise_bit_flip)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;[&quot;u1&quot;, &quot;u2&quot;, &quot;u3&quot;]&lt;/code&gt;? What I need to know is how often it is applied and with which criterion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help!&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-07-26T18:19:04.303" LastActivityDate="2020-07-26T18:19:04.303" Title="How is quantum error applied to the qubits?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9642" PostTypeId="2" ParentId="9627" CreationDate="2020-01-25T09:22:55.970" Score="5" Body="&lt;p&gt;Since your circuit is teleportation, &lt;span class=&quot;math-container&quot;&gt;$|C\rangle =|\varphi\rangle$&lt;/span&gt; and since you measured &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|AB\rangle$&lt;/span&gt; the answer is &lt;span class=&quot;math-container&quot;&gt;$|ABC\rangle = |11\rangle|\varphi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now, let look why this is true.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly Hadamard and CNOT gate on second and third qubit prepares entangled Bell state &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the circuit is in state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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)]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This means that only part &lt;span class=&quot;math-container&quot;&gt;$\beta|1\rangle(|00\rangle + |11\rangle)$&lt;/span&gt; is influenced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, state of the circuit is changed to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \frac{1}{\sqrt{2}}[\alpha|0\rangle(|00\rangle + |11\rangle) + \beta|1\rangle(|10\rangle + |01\rangle)]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application of Hadamard gate on the first qubit change the state further to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \frac{1}{2}[\alpha(|0\rangle + |1\rangle)(|00\rangle + |11\rangle) + \beta(|0\rangle - |1\rangle)(|10\rangle + |01\rangle)]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} \big( |00\rangle(\alpha|0\rangle + \beta|1\rangle) &#xA;+ |01\rangle (\alpha|1\rangle + \beta|0\rangle) &#xA;+ |10\rangle (\alpha|0\rangle - \beta|1\rangle) &#xA;+ |11\rangle (\alpha|1\rangle - \beta|0\rangle) \big)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In your case you measured &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; on first and second qubit. This means that the third qubit is in state&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\alpha|1\rangle - \beta|0\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since both first and second qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; both CNOT gates after measurement will be activated. The first one change the state of third qubit to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\alpha|0\rangle - \beta|1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next two Hadamards together with CNOT implements controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate which change a phase to oposite in case input qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This leads to final state of third qubit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\alpha|0\rangle + \beta|1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Hence, you can see that state from first qubit was teleported to third qubit.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: based on Nielsen and Chuang, pg. 27 and expanded&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="10065" LastEditDate="2020-03-18T11:31:00.170" LastActivityDate="2020-03-18T11:31:00.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9643" PostTypeId="2" ParentId="8908" CreationDate="2020-01-25T11:19:22.737" Score="0" Body="&lt;p&gt;You can also run QML/QAI on a real Quantum Computer using Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are two sample Jupyter Notebooks for qSVM and qGAN.&#xA;&lt;a href=&quot;https://quantum-computing.ibm.com/jupyter/tutorial/advanced/aqua/artificial_intelligence/index.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/jupyter/tutorial/advanced/aqua/artificial_intelligence/index.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9889" LastActivityDate="2020-01-25T11:19:22.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9644" PostTypeId="1" CreationDate="2020-01-25T20:55:48.933" Score="2" ViewCount="104" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Thanks to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/2927/mark-s&quot;&gt;Mark S&lt;/a&gt; for pointing me to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8662/effects-of-quantum-computing-on-parallel-universes&quot;&gt;Effects of quantum computing on parallel universes&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8438" LastEditorUserId="8438" LastEditDate="2020-01-30T16:47:32.053" LastActivityDate="2020-01-30T16:47:32.053" Title="Quantum computing w.r.t. the many-worlds theory" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-01-29T14:23:06.187" ContentLicense="CC BY-SA 4.0" />
  <row Id="9645" PostTypeId="2" ParentId="9644" CreationDate="2020-01-25T21:36:34.297" Score="0" Body="&lt;p&gt;Quantum algorithm can give answers with 100% certainty. For example, Grover's algorithm can give the answer with certainty when the ratio of &quot;good&quot; items to &quot;bad&quot; items satisfies some constraints. The uncertainty exists when the output state is not an eigenstate of the measurement observable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;order&quot; in an iteration, but you cannot say it is incorrect. Instead, the measurement gives one of the phases of the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U|y\rangle =|xy \text{(mod } N\text{)}\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is a superposition of many eigenvectors associated with these phases.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8321" LastEditorUserId="8321" LastEditDate="2020-01-26T17:48:46.113" LastActivityDate="2020-01-26T17:48:46.113" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="9646" PostTypeId="2" ParentId="4434" CreationDate="2020-01-25T22:06:51.617" Score="0" Body="&lt;p&gt;I took a quick look at the QCL paper, it seems that &amp;amp; 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: &lt;span class=&quot;math-container&quot;&gt;$(A\otimes I)(I\otimes B)=A\otimes B)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8321" LastActivityDate="2020-01-25T22:06:51.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9647" PostTypeId="1" CreationDate="2020-01-25T22:09:46.633" Score="1" ViewCount="36" Body="&lt;p&gt;I'm trying to run a simulation of the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kZj3I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kZj3I.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;on the ibmq_qasm_simulator, but it only shows the &quot;Circuit diagram&quot; without the &quot;Circuit Implementation&quot; and &quot;Results tab&quot;.&#xA;Did someone had that problem before ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Ever since it happened, every simulation I ran before started to have this problem too.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9892" LastEditorUserId="9006" LastEditDate="2020-01-25T23:44:31.913" LastActivityDate="2020-01-25T23:44:31.913" Title="Problem with circuit composer results tab" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9648" PostTypeId="1" AcceptedAnswerId="9655" CreationDate="2020-01-25T23:08:28.613" Score="5" ViewCount="314" Body="&lt;p&gt;Let's say I start with the following arbitrary qubits: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\color{red}{\vert Q_1 \rangle = \alpha_1 \vert 0 \rangle + \beta_1 \vert 1 \rangle}\\&#xA;\color{green}{\vert Q_2 \rangle = \alpha_2 \vert 0 \rangle + \beta_2 \vert 1 \rangle}\\&#xA;\color{blue}{\vert Q_3 \rangle = \alpha_3 \vert 0 \rangle + \beta_3 \vert 1 \rangle}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\forall i : \,\,|\alpha_i|^2 + |\beta_i|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then decide to entangle all these qubits to obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I realize that I don't need the second qubit to be entangled with the others, so I &lt;em&gt;unentangle&lt;/em&gt; it to obtain the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\vert \psi \rangle &amp;amp;= \alpha \vert \color{red}{0}\color{blue}{0} \rangle + \beta \vert \color{red}{1}\color{blue}{1} \rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;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?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="55" LastEditDate="2020-01-27T14:27:34.387" LastActivityDate="2020-01-27T14:27:34.387" Title="Unentangling a qubit from a system: can we convert $\alpha|000\rangle+\beta|111\rangle$ into $\alpha|00\rangle+\beta|11\rangle$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9649" PostTypeId="2" ParentId="9648" CreationDate="2020-01-25T23:38:19.067" Score="3" Body="&lt;p&gt;First of all, you cannot describe entanglement with tensor product. Resulting state of &lt;span class=&quot;math-container&quot;&gt;$q_0 \otimes q_1 \otimes q_2$&lt;/span&gt; will be &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi\rangle = \sum_{i=000}^{111}a_{i}|i\rangle,&#xA;$$&lt;/span&gt;&#xA;i.e. &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;...&lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;; and &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=0}^{n}|a_{i}|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To obtain state &lt;span class=&quot;math-container&quot;&gt;$\alpha|000\rangle + \beta|111\rangle$&lt;/span&gt; you have to employ circuit similar to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EwPn3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EwPn3.png&quot; alt=&quot;Entanglement preparation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case &lt;span class=&quot;math-container&quot;&gt;$\alpha = \beta = \frac{1}{\sqrt{2}}$&lt;/span&gt;. To change &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; you should replace Hadamard gate with for example &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate to set these constants according to your requirements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; were firstly entangled and then qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; was unentangled is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gELxy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gELxy.png&quot; alt=&quot;Unentangling q1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-01-26T07:33:51.177" LastActivityDate="2020-01-26T07:33:51.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9651" PostTypeId="1" CreationDate="2020-01-26T04:56:27.680" Score="0" ViewCount="542" Body="&lt;p&gt;I am following this qiskit workshop from &lt;a href=&quot;https://colab.research.google.com/github/mtreinish/qiskit-workshop/blob/master/Workshop.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://colab.research.google.com/github/mtreinish/qiskit-workshop/blob/master/Workshop.ipynb&lt;/a&gt; . After adding my API key I had encountered the error &lt;code&gt;'IBMQFactory' object has no attribute 'load_accounts'&lt;/code&gt;  when running &lt;code&gt;qiskit.IBMQ.load_accounts()&lt;/code&gt;.  &lt;strong&gt;How do I fix this?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9893" LastEditorUserId="9006" LastEditDate="2020-01-26T07:00:58.310" LastActivityDate="2020-01-26T09:24:38.907" Title="'IBMQFactory' object has no attribute 'load_accounts'" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9652" PostTypeId="2" ParentId="9651" CreationDate="2020-01-26T07:44:49.437" Score="1" Body="&lt;p&gt;I also came across with the same issue. However when I added my account token as follows, it worked.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;token = 'Your token'&#xA;IBMQ.save_account(token)    &#xA;provider = IBMQ.load_account()&#xA;device = provider.get_backend('ibmq_16_melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can get your IBM Q token via : &lt;a href=&quot;https://quantum-computing.ibm.com/account&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/account&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helped, let me know if it didn't.&lt;/p&gt;&#xA;" OwnerUserId="9759" LastActivityDate="2020-01-26T07:44:49.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9653" PostTypeId="2" ParentId="9641" CreationDate="2020-01-26T09:05:39.043" Score="1" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-01-26T09:05:39.043" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9654" PostTypeId="2" ParentId="9651" CreationDate="2020-01-26T09:24:38.907" Score="4" Body="&lt;p&gt;IBMQ.load_accounts() was deprecated and removed in Qiskit 0.14. Please use IBMQ.load_account().&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-01-26T09:24:38.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9655" PostTypeId="2" ParentId="9648" CreationDate="2020-01-26T12:46:46.177" Score="7" Body="&lt;p&gt;Yes, it is possible. To obtain the state &lt;span class=&quot;math-container&quot;&gt;$$\vert \phi \rangle = \alpha \vert 00 \rangle + \beta \vert 11 \rangle$$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$$\vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 111 \rangle,$$&lt;/span&gt; note that the latter can be written as &lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}\vert \psi\rangle=&amp;amp;\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\\&#xA;=&amp;amp; \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\\&#xA; =&amp;amp; \frac{1}{\sqrt{2}} \vert \phi \rangle\vert+\rangle + (Z\otimes \text{Id}) \frac{1}{\sqrt{2}} \vert \phi \rangle\vert - \rangle.\end{aligned}$$&lt;/span&gt;&#xA;This shows how you can remove a qubit from this entangled state. If you measure this qubit in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-basis, then you get one of the following two outcomes: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$\vert +\rangle$&lt;/span&gt;), in which case you have successfully projected onto &lt;span class=&quot;math-container&quot;&gt;$\vert \phi \rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$\vert -\rangle$&lt;/span&gt;), in which case you have projected onto &lt;span class=&quot;math-container&quot;&gt;$(Z\otimes Id)\vert \phi\rangle$&lt;/span&gt;, which, however, can be transformed into &lt;span class=&quot;math-container&quot;&gt;$\vert \phi \rangle$&lt;/span&gt; by applying a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-gate on one of the remaining qubits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In summary: measure the qubit that you want to remove in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-Basis and perform a phase correction if neccessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This procedure is standard in entanglement-based quantum computation.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2020-01-26T18:37:50.707" LastActivityDate="2020-01-26T18:37:50.707" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9656" PostTypeId="1" AcceptedAnswerId="9657" CreationDate="2020-01-26T13:14:54.710" Score="1" ViewCount="208" Body="&lt;p&gt;I've started playing around with circuits only recently and decided to try out and implement a 4-qubit Grover's search using qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;iterations&quot; variable for that further in the code - works nicely with qasm_simulator, but seems to have no real effect on a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel like I'm doing something fundamentally wrong, but I simply cannot figure it out. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's my code:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;from qiskit import IBMQ, BasicAer&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute&#xA;from qiskit.visualization import plot_histogram&#xA;pi = math.pi&#xA;provider = IBMQ.load_account()&#xA;&#xA;&#xA;def oracle(circuit, qr):&#xA;    circuit.x(qr[0])&#xA;    circuit.x(qr[2])&#xA;    circuit.x(qr[3])&#xA;    circuit.cu1(pi/4, qr[0], qr[3])&#xA;    circuit.cx(qr[0], qr[1])&#xA;    circuit.cu1(-pi/4, qr[1], qr[3])&#xA;    circuit.cx(qr[0], qr[1])&#xA;    circuit.cu1(pi/4, qr[1], qr[3])&#xA;    circuit.cx(qr[1], qr[2])&#xA;    circuit.cu1(-pi/4, qr[2], qr[3])&#xA;    circuit.cx(qr[0], qr[2])&#xA;    circuit.cu1(pi/4, qr[2], qr[3])&#xA;    circuit.cx(qr[1], qr[2])&#xA;    circuit.cu1(-pi/4, qr[2], qr[3])&#xA;    circuit.cx(qr[0], qr[2])&#xA;    circuit.cu1(pi/4, qr[2], qr[3])&#xA;    circuit.x(qr[0])&#xA;    circuit.x(qr[2])&#xA;    circuit.x(qr[3])&#xA;&#xA;&#xA;def amplification(circuit, qr):&#xA;    circuit.h(qr)&#xA;    circuit.x(qr)&#xA;    circuit.cu1(pi/4, qr[0], qr[3])&#xA;    circuit.cx(qr[0], qr[1])&#xA;    circuit.cu1(-pi/4, qr[1], qr[3])&#xA;    circuit.cx(qr[0], qr[1])&#xA;    circuit.cu1(pi/4, qr[1], qr[3])&#xA;    circuit.cx(qr[1], qr[2])&#xA;    circuit.cu1(-pi/4, qr[2], qr[3])&#xA;    circuit.cx(qr[0], qr[2])&#xA;    circuit.cu1(pi/4, qr[2], qr[3])&#xA;    circuit.cx(qr[1], qr[2])&#xA;    circuit.cu1(-pi/4, qr[2], qr[3])&#xA;    circuit.cx(qr[0], qr[2])&#xA;    circuit.cu1(pi/4, qr[2], qr[3])&#xA;    circuit.x(qr)&#xA;    circuit.h(qr)&#xA;&#xA;&#xA;qr = QuantumRegister(4)&#xA;cr = ClassicalRegister(4)&#xA;iterations = 1&#xA;&#xA;groverCircuit = QuantumCircuit(qr, cr)&#xA;&#xA;# apply Hadamard gate to all qubits&#xA;groverCircuit.h(qr)&#xA;&#xA;while iterations &amp;gt; 0:&#xA;    oracle(groverCircuit, qr)&#xA;    amplification(groverCircuit, qr)&#xA;    iterations -= 1&#xA;&#xA;# measure&#xA;groverCircuit.measure(qr, cr)&#xA;provider.backends()&#xA;&#xA;backend = provider.get_backend('ibmqx2')&#xA;# backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;shots = 1024&#xA;results = execute(groverCircuit, backend=backend, shots=shots).result()&#xA;answer = results.get_counts()&#xA;print(answer)&#xA;print(plot_histogram(answer))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For example, this is one of the probability distributions I got from a quantum computer, where the 0010 value should have been amplified:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/T65FU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T65FU.png&quot; alt=&quot;ibmq_essex&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9896" LastEditorUserId="9896" LastEditDate="2020-01-26T13:33:49.343" LastActivityDate="2020-01-26T14:19:47.870" Title="Vey different results between qasm_simulator and quantum computer" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9657" PostTypeId="2" ParentId="9656" CreationDate="2020-01-26T14:19:47.870" Score="4" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;basis_gates&lt;/code&gt; and qubit &lt;code&gt;coupling_map&lt;/code&gt;. When you &lt;code&gt;transpile&lt;/code&gt; the circuit to respect these constraints and optimize for them (for say &lt;code&gt;ibmq_vigo&lt;/code&gt;), 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://arxiv.org/pdf/2001.06575.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/2001.06575.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. You can modify the last few lines of your code like this to see the circuit metrics I talked about.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;shots = 1024&#xA;groverCircuit_transpiled = transpile(groverCircuit, backend, optimization_level=3)&#xA;qobj = assemble(groverCircuit_transpiled, backend=backend, shots=shots)&#xA;results = backend.run(qobj).result()&#xA;answer = results.get_counts()&#xA;&#xA;print(&quot;%d depth, %d CNOTs&quot; % (groverCircuit.depth(), groverCircuit.count_ops()['cx']))&#xA;print(&quot;%d depth, %d CNOTs&quot; % (groverCircuit_transpiled.depth(), groverCircuit_transpiled.count_ops()['cx']))&#xA;&#xA;print(answer)&#xA;plot_histogram(answer)&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-01-26T14:19:47.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9658" PostTypeId="1" AcceptedAnswerId="9660" CreationDate="2020-01-26T15:46:09.860" Score="1" ViewCount="150" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1010\rangle$&lt;/span&gt;. How to implement the controlled NOT gate using 5 qubits with 4 qubits (&lt;code&gt;q[0]&lt;/code&gt; ... &lt;code&gt;q[3]&lt;/code&gt;) used as the control qubits and &lt;code&gt;q[4]&lt;/code&gt; as the target qubit in Q#?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="9898" LastEditorUserId="2879" LastEditDate="2020-01-26T19:00:10.187" LastActivityDate="2020-01-26T19:00:10.187" Title="Controlled NOT gate using multiple control qubits in Q#" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;grovers-algorithm&gt;&lt;q#&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9660" PostTypeId="2" ParentId="9658" CreationDate="2020-01-26T18:57:48.907" Score="4" Body="&lt;p&gt;You can implement a controlled version of any gate in Q# using &lt;a href=&quot;https://docs.microsoft.com/quantum/language/type-model#controlled&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controlled&lt;/a&gt; functor; for the oracles, you'll use something like &lt;code&gt;Controlled X(controlQubits, targetQubit)&lt;/code&gt;, where &lt;code&gt;controlQubits&lt;/code&gt; is an array of qubits that have to be in 1 state for the X gate to be applied and &lt;code&gt;targetQubit&lt;/code&gt; is the qubit to which the gate is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q# also has a neat library function &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.canon.controlledonbitstring&quot; rel=&quot;nofollow noreferrer&quot;&gt;ControlledOnBitString&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|1010\rangle$&lt;/span&gt; in your example, you can use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(ControlledOnBitString([true, false, true, false], X))(controlQubits, targetQubit);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see examples of implementing Grover's search using Q# in the &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/GroversAlgorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;GroverSearch kata&lt;/a&gt; (task 1.2 is almost exactly your example of looking for a state 1010).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-01-26T18:57:48.907" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9661" PostTypeId="2" ParentId="8799" CreationDate="2020-01-26T19:14:55.927" Score="2" Body="&lt;p&gt;I will try to link the two concepts in the following way. It is rough, descriptive, but contains the essential idea. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\vec{L} \equiv \vec{r}\times\vec{p}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt; is the position of the electron, and &lt;span class=&quot;math-container&quot;&gt;$\vec{p}$&lt;/span&gt; is the momentum. One could roughly think that the magnetic moment to be proportional to &lt;span class=&quot;math-container&quot;&gt;$\vec{L}$&lt;/span&gt;, namely &lt;span class=&quot;math-container&quot;&gt;$\vec{M}\propto\vec{L}$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{p}$&lt;/span&gt; should be thought as operators now (see below) and second, the operators are sandwiched between wavefunctions. Thus&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\vec{L} = \langle \psi | \vec{r}\times\vec{p} |\psi \rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Precisely what this means is that, if you want to calculate say the component &lt;span class=&quot;math-container&quot;&gt;$L_z$&lt;/span&gt;, then the expression is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;L_z = i\int d^3r \psi^*(r) ( x  \frac{\partial}{\partial y} - y  \frac{\partial}{\partial x} )\psi(r)&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we have written out the operator &lt;span class=&quot;math-container&quot;&gt;$\vec{p}$&lt;/span&gt; explicitly as &lt;span class=&quot;math-container&quot;&gt;$i\frac{\partial}{\partial \vec{r}}$&lt;/span&gt; for the purpose of calculation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9816" LastActivityDate="2020-01-26T19:14:55.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9662" PostTypeId="1" AcceptedAnswerId="9713" CreationDate="2020-01-26T23:52:18.620" Score="2" ViewCount="90" Body="&lt;p&gt;Consider two quantum states &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt;, and define the classical-quantum state over a classical binary system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\omega_{AB}^\epsilon :=\epsilon \vert 0 \rangle \langle 0 \vert \rho_A + (1-\epsilon) \vert 1 \rangle \langle 1 \vert \sigma_A.$$&lt;/span&gt;  I am interested in the conditional von Neumann entropy &#xA;&lt;span class=&quot;math-container&quot;&gt;$S(B\vert A)_{\omega_{AB}^\epsilon} = S(\omega_{AB}^\epsilon)- S(\omega_{A}^\epsilon)$&lt;/span&gt;.  This is related to  quantum state discrimination. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; are orthogonal, it is easy to show that &lt;span class=&quot;math-container&quot;&gt;$S(B\vert A)=0$&lt;/span&gt;. In case they are not orthogonal, I seek a lower bound of the form &#xA;&lt;span class=&quot;math-container&quot;&gt;$$S(B\vert A) \ge -c_1\epsilon \ln \epsilon + c_2 \epsilon,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$c_1&amp;gt;0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; is any constant.  I am particularly interested in the case where &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; does not depend on the dimensionality of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and applies even in the countably-infinite dimensional case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can derive a bound of this type for a  classical system in the following way. Define &lt;span class=&quot;math-container&quot;&gt;$c = \max_a [\min\{\rho_A(a), \sigma_A(a)\}]$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$\hat{a}$&lt;/span&gt; indicate the state of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$c = \min\{\rho_A(\hat{a}), \sigma_A(\hat{a})\}$&lt;/span&gt;. Then, write&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;S(B|A)&amp;amp;=\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]\\&#xA;&amp;amp;\ge  \epsilon \rho_A(\hat{a})\ln\frac{\epsilon \rho_A(\hat{a})+(1-\epsilon)\sigma_A(\hat{a})}{\epsilon \rho_A(\hat{a})}\\&#xA;&amp;amp;\ge  \epsilon \rho_A(\hat{a})\ln\frac{c}{\epsilon \rho_A(\hat{a})}\\&#xA;&amp;amp;=  -\epsilon \rho_A(\hat{a})\ln\epsilon  +\epsilon \rho_A(\hat{a})\ln \frac{c}{\rho_A(\hat{a})}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have not seen something similar for the quantum case.&lt;/p&gt;&#xA;" OwnerUserId="9900" LastEditorUserId="55" LastEditDate="2020-11-04T16:02:20.660" LastActivityDate="2020-11-04T16:02:20.660" Title="Quantum state discrimination and lower bound for conditional von Neumann entropy" Tags="&lt;measurement&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9663" PostTypeId="1" AcceptedAnswerId="9667" CreationDate="2020-01-26T23:52:28.403" Score="1" ViewCount="140" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using the following code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qutip import * &#xA;from scipy.special import erf&#xA;import matplotlib.pyplot as plt&#xA;&#xA;def pulseEdge(x, x0, sigma):&#xA;    pulseEdge = ((erf((x-x0)/sigma)) +1.)/2.&#xA;    return pulseEdge&#xA;&#xA;def pulse(t, tOn, tOff, sigma):&#xA;    return pulseEdge(t, tOn, sigma)* (1.-pulseEdge(t, tOff, sigma))&#xA;&#xA;def H(t, args):&#xA;    H = Qobj([[0.,1],[1,0.0]])&#xA;    envelope = pulse(t, 2,2+np.pi/2,0.2)&#xA;    return H*envelope&#xA;&#xA;tlist = np.linspace(0,10,1000)&#xA;h = np.array([H(t,0)[0][0] for t in tlist])&#xA;H_list = H&#xA;&#xA;psi0 = basis(2,0)&#xA;basisStates = [basis(2,i) for i in range(2)]&#xA;e_ops = [b*b.dag() for b in basisStates]&#xA;&#xA;me =mesolve(H_list, psi0, tlist,  progress_bar = None, e_ops = e_ops)&#xA;&#xA;plt.plot(me.expect[0])&#xA;plt.plot(me.expect[1])&#xA;&#xA;plt.plot(h)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which works really well and produces the desired output, a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; Rabi oscillation driven by a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RuHmq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RuHmq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def H(t, args):&#xA;    H = Qobj([[0.,1],[1,0.0]])&#xA;    envelope = pulse(t, 3,3+np.pi/2,0.2)&#xA;    H*=envelope&#xA;    return H&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which produces&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dKL4r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dKL4r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or if I want the edges to be sharper, when again, no evolution occurs&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def H(t, args):&#xA;    H = Qobj([[0.,1],[1,0.0]])&#xA;    envelope = pulse(t, 2,2+np.pi/2,0.01)&#xA;    H*=envelope&#xA;    return H&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://i.stack.imgur.com/F7JG7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F7JG7.png&quot; alt=&quot;strong text&quot;&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What element of these time dependent Hamiltonians functions is causing mesolve to correctly calculate the dynamics in some cases, and completely fail in others?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After Paul Nation's answer, here is updated, working code.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qutip import * &#xA;from scipy.special import erf&#xA;import matplotlib.pyplot as plt&#xA;&#xA;def pulseEdge(x, x0, sigma):&#xA;    pulseEdge = ((erf((x-x0)/sigma)) +1.)/2.&#xA;    return pulseEdge&#xA;&#xA;def pulse(t, tOn, tOff, sigma):&#xA;    return pulseEdge(t, tOn, sigma)* (1.-pulseEdge(t, tOff, sigma))&#xA;&#xA;def H(t, args):&#xA;    H = Qobj([[0.,1],[1,0.0]])&#xA;    envelope = pulse(t, 2,2+np.pi/2,0.01)&#xA;    H*=envelope&#xA;    return H&#xA;&#xA;tlist = np.linspace(0,10,1000)&#xA;h = np.array([H(t,0)[0][0] for t in tlist])&#xA;H_list = H&#xA;&#xA;psi0 = basis(2,0)&#xA;basisStates = [basis(2,i) for i in range(2)]&#xA;e_ops = [b*b.dag() for b in basisStates]&#xA;&#xA;options = Options(max_step = 1)&#xA;me =mesolve(H_list, psi0, tlist,  progress_bar = None, e_ops = e_ops, options = options)&#xA;&#xA;plt.plot(me.expect[0])&#xA;plt.plot(me.expect[1])&#xA;&#xA;plt.plot(h)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zBvsx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zBvsx.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9901" LastEditorUserId="9901" LastEditDate="2020-01-27T12:14:33.997" LastActivityDate="2020-01-27T12:14:33.997" Title="Strange Behaviour of MeSolve, McSolve" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9664" PostTypeId="1" AcceptedAnswerId="9666" CreationDate="2020-01-27T05:47:44.840" Score="1" ViewCount="123" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;s in the quantum circuit. Let &lt;span class=&quot;math-container&quot;&gt;$N\sim \log_2(n)$&lt;/span&gt; be the number of qubits needed for finding the period. As far as I know, we can initialize &lt;span class=&quot;math-container&quot;&gt;$s=1$&lt;/span&gt;, and multiply it with &lt;span class=&quot;math-container&quot;&gt;$a,a^2,a^4 \cdots a^{2^{N-1}} \mod n$&lt;/span&gt; according to the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; control qubits. However, all methods I can think of needs around &lt;span class=&quot;math-container&quot;&gt;$O(N^2)$&lt;/span&gt; modulus and thus &lt;span class=&quot;math-container&quot;&gt;$O(N^2)$&lt;/span&gt; ancillary clean qubits (for example, compute &lt;span class=&quot;math-container&quot;&gt;$a,a^2,a^4 \cdots a^{2^{N-1}}\mod n$&lt;/span&gt; beforehand, use additions, comparing numbers and subtracting accordingly). Is there a way to implement modulus as some reversible circuit? Or, am I all wrong?&lt;/p&gt;&#xA;" OwnerUserId="5951" LastEditorUserId="9006" LastEditDate="2020-01-27T05:52:01.293" LastActivityDate="2020-01-27T07:41:02.447" Title="How to implement modular exponentiation efficiently in Shor's algorithm?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9666" PostTypeId="2" ParentId="9664" CreationDate="2020-01-27T07:41:02.447" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/Strilanc/PaperImpl-2017-DirtyPeriodFinding&quot; rel=&quot;nofollow noreferrer&quot;&gt;working ProjectQ code at the time&lt;/a&gt;) is &quot;&lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;Factoring with n+2 clean qubits and n-1 dirty qubits&lt;/a&gt;&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a few example diagrams:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mEwn8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mEwn8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gw4Gt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gw4Gt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the constructions are really going out of their way to avoid using ancillae, so they often have not-so-great gate counts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's one to reinforce the point that it's complicated:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pxBC7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pxBC7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-01-27T07:41:02.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9667" PostTypeId="2" ParentId="9663" CreationDate="2020-01-27T11:46:09.140" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-01-27T11:46:09.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9668" PostTypeId="1" AcceptedAnswerId="9669" CreationDate="2020-01-27T13:24:07.397" Score="3" ViewCount="425" Body="&lt;p&gt;The most general single qubit gate is &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; given by matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U3}=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the gate is applied on qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; again the most general description of quantum state is obtained, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi_0\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where angles &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; describe position of the state on Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the gate is applied on qubit in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the result is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi_1\rangle = \mathrm{e}^{i\lambda}(-\sin(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\cos(\theta/2)|1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously term &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\lambda}$&lt;/span&gt; can be ignored because it is the global phase of a state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can imagine that global phase can be useful for constructing contolled global phase gate but it can be implemented as &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ph}(\lambda) \otimes I$&lt;/span&gt;,&#xA;where &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Ph}(\lambda) = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\lambda}.&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is: What a parameter &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; is used for?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-01-28T19:43:48.633" LastActivityDate="2020-01-28T19:43:48.633" Title="What is the $\lambda$ parameter in the $U3$ gate used for?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9669" PostTypeId="2" ParentId="9668" CreationDate="2020-01-27T13:28:39.133" Score="5" Body="&lt;p&gt;The parameter &lt;span class=&quot;math-container&quot;&gt;$e^{i\lambda}$&lt;/span&gt; is only a global phase if it's acting on the basis state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Act on any superposition of states, and it's a relative phase, and absolutely critical.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-01-27T13:28:39.133" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9670" PostTypeId="2" ParentId="9648" CreationDate="2020-01-27T14:26:03.093" Score="6" Body="&lt;p&gt;Measuring the second qubit in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis you get one of two results, associated with the two eigenstates of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, which are: &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|#1\rangle}\sqrt2\ket\pm\equiv\ket0\pm\ket1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;post-measurement&lt;/em&gt; states corresponding to these two outcomes are given (up to normalisation) by the overlaps &lt;span class=&quot;math-container&quot;&gt;$\langle\pm_2|\psi\rangle$&lt;/span&gt;, where here &lt;span class=&quot;math-container&quot;&gt;$\ket{\pm_2}\equiv I\otimes\ket\pm\otimes I$&lt;/span&gt;. This gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \ket{\psi_+}\equiv\frac{\langle+_2|\psi\rangle}{\sqrt{p_+}} = \alpha\ket{00} + \beta\ket{11}, \\&#xA;  \ket{\psi_-}\equiv\frac{\langle-_2|\psi\rangle}{\sqrt{p_-}} = \alpha\ket{00} - \beta\ket{11}.&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_\pm\equiv\|\langle \pm_2|\psi\rangle\|^2=1/2$&lt;/span&gt; are the outcome probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This tells you that, if you want to get the state &lt;span class=&quot;math-container&quot;&gt;$\alpha\ket{00}+\beta\ket{11}$&lt;/span&gt; on the remaining qubits, you can do it by &lt;em&gt;post-selecting&lt;/em&gt; on the outcome &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\ket+$&lt;/span&gt; on the second one. This can be used in computation by &lt;em&gt;post-selecting&lt;/em&gt; the experimental runs in which the second qubit was found to be &lt;span class=&quot;math-container&quot;&gt;$\ket+$&lt;/span&gt; (which will be roughly half of them), and discarding the rest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate conditionally to finding &lt;span class=&quot;math-container&quot;&gt;$\ket{2_+}$&lt;/span&gt; which as you can check converts &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_-}$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_+}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-27T14:26:03.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9671" PostTypeId="1" CreationDate="2020-01-27T19:10:10.347" Score="3" ViewCount="94" Body="&lt;p&gt;The coherent information of a channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{A'\rightarrow B}$&lt;/span&gt; is defined as the maximum value obtained by the following function where the maximization is over all input states&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I_{\rm{coh}}(\mathcal{E}) = \max_{\rho_{A'}} S(\mathcal{E}(\rho_{A'})) - S((I_A\otimes \mathcal{E})(\rho_{AA'})),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho_{AA'}$&lt;/span&gt; is the purification of &lt;span class=&quot;math-container&quot;&gt;$\rho_{A'}$&lt;/span&gt;. I can think in terms of the complementary channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^c_{A'\rightarrow E}$&lt;/span&gt; instead and the optimization becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I_{\rm{coh}}(\mathcal{E}) = \max_{\rho_{A'}} S((I_A\otimes \mathcal{E^c})(\rho_{AA'})) - S(\mathcal{E^c}(\rho_{A'}))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose I forget about the channel for a moment and only look at the registers &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. Clearly, the state that maximizes the coherent information is the maximally mixed state &lt;span class=&quot;math-container&quot;&gt;$I_{AE}$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\rho_{AA'}$&lt;/span&gt; such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I\otimes \mathcal{E^c})\rho_{AA'} = I_{AE}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;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 &quot;target&quot; state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AE}$&lt;/span&gt;, can I efficiently prove that there exists/cannot exist a pure input &lt;span class=&quot;math-container&quot;&gt;$\rho_{AA'}$&lt;/span&gt; that satisfies&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I\otimes \mathcal{E^c})\rho_{AA'} = \rho_{AE}$$&lt;/span&gt;  &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-01-27T20:31:01.070" LastActivityDate="2020-01-31T13:59:46.533" Title="Forbidden/allowed outputs of a quantum channel" Tags="&lt;quantum-operation&gt;&lt;optimization&gt;&lt;entropy&gt;&lt;semidefinite-programming&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9672" PostTypeId="1" AcceptedAnswerId="9674" CreationDate="2020-01-28T00:24:20.050" Score="2" ViewCount="178" Body="&lt;p&gt;Being a newbie in this field, I'm trying to understand what types of real-life workloads are suitable for migrating to Quantum computers.&#xA;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.&#xA;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I'd like to clarify my question with an example:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The classical &lt;a href=&quot;https://en.wikipedia.org/wiki/String-searching_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;multiple string-match problem&lt;/a&gt; - namely, &quot;Given a string-set &lt;span class=&quot;math-container&quot;&gt;$L \subseteq \Sigma∗$&lt;/span&gt; and an input stream &lt;span class=&quot;math-container&quot;&gt;$W \in \Sigma∗$&lt;/span&gt;, find all occurrences of any of the strings in &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; that are substrings of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;&quot; - is considered a 'solved problem', where many algorithms solve it in &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;. However, almost all of these algorithms have a hidden constraint - they assume that the input is fed to them sequentially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my question is:&lt;/strong&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit (and some thoughts):&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arguing that speedup requires handling parallelized input may lead to the following (pretty radical) conclusion: &lt;strong&gt;Order is overrated.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Computer Science 101&lt;/em&gt; is all about &lt;code&gt;for()&lt;/code&gt; 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 &lt;strong&gt;&lt;em&gt;'Pollution-as-a-Service'&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The next generation of programmers should probably learn Parallel and Quantum Computing in &lt;em&gt;Computer Science 101&lt;/em&gt;, and treat &lt;code&gt;for()&lt;/code&gt; loops as a last resort...&lt;/p&gt;&#xA;" OwnerUserId="9913" LastEditorUserId="9913" LastEditDate="2020-01-29T07:22:27.423" LastActivityDate="2020-01-29T07:22:27.423" Title="Does the massive parallelization in Quantum computing imply parallelization of input (as opposed to Turing machine)?" Tags="&lt;classical-computing&gt;&lt;performance&gt;&lt;quantum-parallelism&gt;&lt;quantum-turing-machine&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9673" PostTypeId="1" CreationDate="2020-01-28T05:21:36.203" Score="0" ViewCount="44" Body="&lt;p&gt;I have a quantum circuit and the job has been run on the &quot;statevector&quot; backend, which runs only 1 shot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore is there a way to return the qubit state (0 or 1) specifically when selected specifically ?&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="5955" LastEditDate="2020-01-28T09:32:46.777" LastActivityDate="2020-01-28T09:32:46.777" Title="Return the value of a selected Qubit from Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9674" PostTypeId="2" ParentId="9672" CreationDate="2020-01-28T05:51:48.630" Score="1" Body="&lt;p&gt;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).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Commnon misunderstanding is that quantum computers are based on paralelism and provide exponential speed-up always as they process all possible values in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (i.e. &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-28T05:51:48.630" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9676" PostTypeId="2" ParentId="9673" CreationDate="2020-01-28T09:32:10.097" Score="1" Body="&lt;p&gt;The &lt;code&gt;statevector&lt;/code&gt; backend returns the final state vector at the end of the circuit. If you would like to return the counts instead, the &lt;code&gt;qasm_simulator&lt;/code&gt; 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 &lt;code&gt;{00: 6, 11: 4}&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-01-28T09:32:10.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9677" PostTypeId="1" CreationDate="2020-01-28T10:31:13.480" Score="0" ViewCount="317" Body="&lt;p&gt;I referred to the following Qiskit's document: &lt;a href=&quot;https://qiskit.org/documentation/api/qiskit.quantum_info.state_fidelity.html?highlight=fidelity&quot; rel=&quot;nofollow noreferrer&quot;&gt;state_fidelity&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inputs of &lt;code&gt;state_fidelity&lt;/code&gt; are quantum state vectors or density matrices.&#xA;For example, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, let me assume a circuit is described as follows.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cxSud.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cxSud.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The above circuit with no noise provides &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}( |00\rangle + |11\rangle )$&lt;/span&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I would like to measure the noise of this circuit, I use &lt;code&gt;state_fidelity&lt;/code&gt; and compare the measurements and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}( |00\rangle + |11\rangle )$&lt;/span&gt;.&#xA;Here, we have to obtain the state vector such as &lt;code&gt;numpy.array([***])&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I received the following error: &lt;code&gt;AerError: 'statevector_simulator does not support noise.'&lt;/code&gt; when I set &lt;code&gt;backend = Aer.get_backend('statevector_simulator')&#xA;&lt;/code&gt; to get the state vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use &lt;code&gt;qasm_simulator&lt;/code&gt; with &lt;code&gt;noise_model&lt;/code&gt; (cf. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5132/how-can-noise-on-a-device-be-simulated-using-measured-noise-parameters&quot;&gt;How can noise on a device be simulated using measured noise parameters?&lt;/a&gt;),  I obtained the following error: &lt;code&gt;'No statevector for experiment &quot;None&quot;&lt;/code&gt;. However, I could obtain the counts by &lt;code&gt;result().get_counts&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;How can I obtain the state vector with &lt;code&gt;noise_model&lt;/code&gt;?&#xA;Do I have to calculate the state vector from the counts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I append the code as below.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;# Loading your IBM Q account(s)&#xA;provider = IBMQ.load_account()&#xA;&#xA;from qiskit.aqua import run_algorithm&#xA;from qiskit.aqua.input import LinearSystemInput&#xA;from qiskit.quantum_info import state_fidelity&#xA;from qiskit.aqua.algorithms.classical import ExactLSsolver&#xA;&#xA;from qiskit import *&#xA;import numpy as np&#xA;&#xA;from qiskit.providers.aer import noise&#xA;properties = device.properties()&#xA;noise_model = noise.device.basic_device_noise_model(properties)&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;def test():&#xA;    q = QuantumRegister(2)&#xA;    c = ClassicalRegister(2)&#xA;    qc = QuantumCircuit(q,c) &#xA;    qc.h( q[0] )&#xA;    qc.cx( q[0], q[1] )&#xA;&#xA;    qc.measure(q,c)&#xA;&#xA;    return qc&#xA;# test().draw()&#xA;&#xA;def test2():&#xA;    q = QuantumRegister(2)&#xA;    c = ClassicalRegister(2)&#xA;    qc = QuantumCircuit(q,c) &#xA;    qc.h( q[0] )&#xA;    qc.cx( q[0], q[1] )&#xA;&#xA;#     qc.measure(q,c)&#xA;&#xA;    return qc&#xA;# test2().draw()&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;simulator = Aer.get_backend( 'qasm_simulator' )&#xA;job1 = execute( test(), backend, noise_model = noise_model, basis_gates= basis_gates, shots = 100 ).result().get_statevector()&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;simulator = Aer.get_backend( 'statevector_simulator' )&#xA;job2 = execute( test2(), backend, noise_model=noise_model, shots = 100 ).result().get_statevector()&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="8673" LastActivityDate="2020-01-28T10:42:23.113" Title="How to obtain the noise of a circuit in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9678" PostTypeId="2" ParentId="9677" CreationDate="2020-01-28T10:42:23.113" Score="1" Body="&lt;p&gt;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 &lt;strong&gt;Density Matrix&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obtaining the density matrix of a noisy state from the actual measurements is done by something called &lt;strong&gt;Quantum State Tomography&lt;/strong&gt; which is part of qiskit-ignis. See &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/ignis/6a_state_tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; the tutorial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is, however, an alternative method which skips using the simulator altogether. You can use qiskit-terra's &lt;code&gt;quantum_info&lt;/code&gt; 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 &quot;real world&quot; use, where you don't have a noise model.&lt;/p&gt;&#xA;" OwnerUserId="9918" LastActivityDate="2020-01-28T10:42:23.113" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9679" PostTypeId="1" AcceptedAnswerId="9693" CreationDate="2020-01-28T10:57:17.690" Score="2" ViewCount="101" Body="&lt;p&gt;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 &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/introduction/operations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand the mathematical representations of these operators. How would one implement them on for example Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="371" LastEditDate="2020-08-18T08:56:11.747" LastActivityDate="2020-08-18T08:56:11.747" Title="PennyLane operations - Kerr, Displacement and Squeeze" Tags="&lt;qiskit&gt;&lt;neural-network&gt;&lt;pennylane&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9680" PostTypeId="2" ParentId="9672" CreationDate="2020-01-28T12:53:32.023" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Generally speaking yes, you need to come up with different algorithms. You cannot simply take a classical algorithm and &quot;quantize it&quot; in a straightforward way. Quantum algorithms work in a fundamentally different way than their classical counterparts.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think the &quot;sequential&quot; 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).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-28T12:53:32.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9682" PostTypeId="1" CreationDate="2020-01-28T16:00:26.230" Score="2" ViewCount="83" Body="&lt;p&gt;I need to have a resource in which phenomenological decoherence model are well defined and explained.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, from what I read there are three usual timescales considered to model decoherence of a qubit: &lt;span class=&quot;math-container&quot;&gt;$T_1,T_2,T_2^*$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; from what I understood is the typical time for which the qubit will fall in the ground state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; 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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_2^*$&lt;/span&gt; is the one that confuses me the most but represents the following as far as I understood.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I take two qubits &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in some superposition of excited and ground states. I call &lt;span class=&quot;math-container&quot;&gt;$\phi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi_2$&lt;/span&gt; their respective angle to the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis of the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$T_2^*$&lt;/span&gt; is infinite: &lt;span class=&quot;math-container&quot;&gt;$\forall t, \phi_1(t)-\phi_2(t)=\phi_1(0)-\phi_2(0)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_2^*$&lt;/span&gt; thus represent the typical time for which &lt;span class=&quot;math-container&quot;&gt;$\phi_1(t)-\phi_2(t)$&lt;/span&gt; is a uniform random variable that can take any value in &lt;span class=&quot;math-container&quot;&gt;$[0,\pi]$&lt;/span&gt; (I don't know at all what is the relative phase between the two).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know if there is a way to make this definition more precise.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, in practice, a reasonable model for some physical situations in which we assume the noise is markovian is a master equation like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{\partial \rho}{\partial t} = \frac{1}{i \hbar} [H,\rho]+\sum_i \gamma_i D[X_i](\rho) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the hamiltonian of the system that may include the drive to manipulate our qubit (if we want to perform a gate for example).&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How to relate this master equation to those phenomenological times ? Would I be correct to do the following:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\gamma_1, X_1)=(\frac{1}{T_1}, |g\rangle \langle e|)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\gamma_2, X_2)=(Max(\frac{1}{T_2^*},\frac{1}{T_2}) , \sigma_z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T_2^*$&lt;/span&gt;, as a first approximation the dynamic can be modelled like this &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Are there good resources that state clearly what I said. I would like to have a reference clearly stating master equation description relating the &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$T_2^*$&lt;/span&gt; like I tried to do here.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I have heard somewhere that &quot;in general&quot; we have: &lt;span class=&quot;math-container&quot;&gt;$T_2^* &amp;lt; T_2 &amp;lt; T_1$&lt;/span&gt;, do you confirm that it is indeed the case in most physical situations ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do you agree with my understanding of &lt;span class=&quot;math-container&quot;&gt;$T_2^*$&lt;/span&gt; ? Am I wrong in my formulation of its meaning ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$T_i$&lt;/span&gt; ?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2020-01-28T16:46:35.083" LastActivityDate="2020-02-06T23:30:50.223" Title="Rigorous definition of phenomenological master equation for decoherence" Tags="&lt;noise&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9683" PostTypeId="1" CreationDate="2020-01-29T07:32:17.610" Score="3" ViewCount="249" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9924" LastEditorUserId="9006" LastEditDate="2020-01-30T05:26:47.140" LastActivityDate="2020-01-30T05:26:47.140" Title="Implementation of tomography on IBM Q" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;density-matrix&gt;&lt;tomography&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9684" PostTypeId="1" AcceptedAnswerId="9685" CreationDate="2020-01-29T07:32:45.093" Score="1" ViewCount="167" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E(\rho)=\sum_{k=1}^M E_k \rho E_k^\dagger.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example for the bit-flip case the corresponding Kraus operators E_k will be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hVSyE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hVSyE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-07-26T18:18:20.807" LastActivityDate="2021-03-20T07:29:49.057" Title="How does qiskit finally implement a noise model?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-operation&gt;&lt;noise&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9685" PostTypeId="2" ParentId="9684" CreationDate="2020-01-29T08:57:59.987" Score="1" Body="&lt;p&gt;A probability distribution over unitaries &lt;span class=&quot;math-container&quot;&gt;${(p_1, U_1),..., (p_k, U_K)}$&lt;/span&gt;, where you select &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, is equivalent to Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\sqrt{p_1}U_1,..., \sqrt{p_k}U_k$&lt;/span&gt;. For example, the bit flip error can be implemented by randomly deciding whether to leave the state unchanged (with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;) or apply an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate (with probability &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt;). 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.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastEditorUserId="14239" LastEditDate="2021-03-20T07:29:49.057" LastActivityDate="2021-03-20T07:29:49.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9687" PostTypeId="2" ParentId="9683" CreationDate="2020-01-29T10:40:51.500" Score="3" Body="&lt;p&gt;Basically you add measurements in different bases by applying gates before the (Z-basis) measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See here the standard implementation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-ignis/blob/3c59f82c11e87c071bc7e84240b50e2aa995281f/qiskit/ignis/verification/tomography/basis/paulibasis.py#L31&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ignis/blob/3c59f82c11e87c071bc7e84240b50e2aa995281f/qiskit/ignis/verification/tomography/basis/paulibasis.py#L31&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9918" LastActivityDate="2020-01-29T10:40:51.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9688" PostTypeId="2" ParentId="9683" CreationDate="2020-01-29T11:10:39.660" Score="3" Body="&lt;p&gt;Density matrix of single qubit state can be estimated based on this formula&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho = \frac{\text{tr}(\rho)I+\text{tr}(X\rho)X+\text{tr}(Y\rho)Y+\text{tr}(Z\rho)Z}{2},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho) = 1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Terms &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(X\rho)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(Y\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(Z\rho)$&lt;/span&gt; can be estimated by measuring a quantum state in different bases: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; basis you simply measure the state&lt;/li&gt;&#xA;&lt;li&gt;In &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; basis Hadamard gate has to be applied before measurement&lt;/li&gt;&#xA;&lt;li&gt;In &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; basis &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; gate followed by Hadamard gate have to be applied before measurement&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Value of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(A\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A \in \{X,Y,Z\}$&lt;/span&gt;, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}(A\rho) = \frac{1}{m}\sum_{i=1}^{m}\lambda_{i},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is number of measurements (i.e. shots on IBM Q) and &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, eigenvalue +1 is mapped to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For practical purposes formula for calculation &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(A\rho)$&lt;/span&gt; can be rewritten in terms of measured states probability distribution followingly&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}(A\rho) = P(|0\rangle) - P(|1\rangle),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because +1 is equivalent to measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{m}\sum_{\lambda = 1}\lambda_i = \frac{\#(\lambda = 1)}{m} = P(\lambda = 1) = P(|0\rangle)$&lt;/span&gt;. Similarly for eigenvalue -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: probabilities are expressed as decimal number, not percentage!&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To sum up how to do quantum tomography on IBM Q&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare a qubit in some state&lt;/li&gt;&#xA;&lt;li&gt;Measure it in &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; bases&lt;/li&gt;&#xA;&lt;li&gt;Use probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; for estimation of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(A\rho)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Calculate density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; (the first formula in this answer)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-01-29T11:10:39.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9689" PostTypeId="2" ParentId="9682" CreationDate="2020-01-29T11:56:48.430" Score="1" Body="&lt;p&gt;I think you are mostly correct (although I am not an expert).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I agree with your definitions for T1 and T2, but I would give a different definition of T2* (which might be equivalent):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;T2: The time-scale on which a single copy of my system will dephase (loose coherence and become a mixture).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;T2*: The time-scale on which a large ensemble of &quot;copies&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt;, and qubit two to have energy gap &lt;span class=&quot;math-container&quot;&gt;$E_2$&lt;/span&gt;, 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).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;See:&lt;/em&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/T2*-weighted_imaging&quot; rel=&quot;nofollow noreferrer&quot;&gt;T2*-weighted_imaging&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By this definition T2* is always &amp;lt; than T2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(You definitely don't want to take my word for this without checkking but I think:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{T_2} = \frac{1}{2 T_1} + \frac{1}{T_{\text{dephaisng}}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think your definitions should read:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(γ1,X1)=(\frac{1}{T_1},|g⟩⟨e|)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(γ2,X2)=( (\frac{1}{T_2} - \frac{1}{2 T_1}) ,σ_z)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Really useful link (Its about MRI, but they explain it well and this is where the terms come from in the first place).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;See:&lt;/em&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Relaxation_(NMR)#cite_note-Traficante-6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Relaxation NMR - references on Wiki&lt;/a&gt;&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Relaxation_(NMR)#cite_note-Traficante-6&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Relaxation_(NMR)#cite_note-Traficante-6&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8339" LastEditorUserId="9006" LastEditDate="2020-01-29T13:49:16.630" LastActivityDate="2020-01-29T13:49:16.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9690" PostTypeId="1" AcceptedAnswerId="9694" CreationDate="2020-01-29T13:46:17.253" Score="5" ViewCount="93" Body="&lt;p&gt;What is the difference between performing &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation and performing &lt;span class=&quot;math-container&quot;&gt;$e^{-i Zt}$&lt;/span&gt; operation on a state, given that &lt;span class=&quot;math-container&quot;&gt;$e^{-i Zt}= \mathbb{1} + (-i Zt) + ...$&lt;/span&gt; is not equal to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; for any value of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="23" LastEditDate="2020-07-26T18:09:18.680" LastActivityDate="2020-08-02T19:32:28.773" Title="What is the difference between the action of $Z$ and $\exp(-i Z t)$ on a state?" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9691" PostTypeId="1" CreationDate="2020-01-29T14:02:31.177" Score="3" ViewCount="348" Body="&lt;p&gt;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.&#xA;I have attached the circuit which I could come up with.&lt;a href=&quot;https://i.stack.imgur.com/cBggE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cBggE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9928" LastActivityDate="2020-01-31T12:11:17.250" Title="How to prepare mixed states using IBM quantum experience?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9692" PostTypeId="2" ParentId="9691" CreationDate="2020-01-29T14:29:43.217" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example (only works on master branch at the moment):&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.quantum_info.states.utils import partial_trace&#xA;qc = QuantumCircuit(2, 2)&#xA;qc.h(0)&#xA;qc.cx(0, 1)&#xA;&#xA;sim =  Aer.get_backend('statevector_simulator')&#xA;res = execute(qc, sim, shots=1).result()&#xA;state_vec = res.get_statevector()&#xA;&#xA;# Remove qubit zero&#xA;partial_trace(state_vec, [0])&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="332" LastEditorUserId="332" LastEditDate="2020-01-31T12:11:17.250" LastActivityDate="2020-01-31T12:11:17.250" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9693" PostTypeId="2" ParentId="9679" CreationDate="2020-01-29T15:34:25.740" Score="5" Body="&lt;p&gt;&lt;strong&gt;Short, sort-of right answer: you can't&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in essence due to the superconducting qubits that e.g. IBM use being, well, &lt;em&gt;qubits&lt;/em&gt;, while continuous variable (CV) operations don't act on qubits. Well, sort of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These are two fundamentally different ways of going about making a quantum computer, so let's &lt;strong&gt;start from first principles&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you take a state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle$&lt;/span&gt;, such as the state of a qubit, you're using &lt;em&gt;first quantisation&lt;/em&gt;, where the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function&quot; rel=&quot;noreferrer&quot;&gt;wave function&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;). However, CV operaations instead use &lt;a href=&quot;https://en.wikipedia.org/wiki/Second_quantization&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;second quantisation&lt;/em&gt;&lt;/a&gt;. 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?'.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, we use the idea of &lt;a href=&quot;https://en.wikipedia.org/wiki/Creation_and_annihilation_operators&quot; rel=&quot;noreferrer&quot;&gt;creation and annihilation operators&lt;/a&gt; where each creation operator &lt;span class=&quot;math-container&quot;&gt;$a^\dagger$&lt;/span&gt; &lt;em&gt;creates&lt;/em&gt; a particle and each annihilation operator &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; &lt;em&gt;destroys&lt;/em&gt; a particle. We can further define &lt;span class=&quot;math-container&quot;&gt;$n = a^\dagger a$&lt;/span&gt; as the number of particles. These are the operators that are used in defining the CV operations you linked to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Worth noting is that one can be related to the other using &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt; = a^\dagger\left|0\right&amp;gt;$&lt;/span&gt; and therefore &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt; = a\left|1\right&amp;gt;$&lt;/span&gt;. This then gives a more meaningful (at some level) understanding of those basis states - &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; is the state with no excitations and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; is the state with one excitation. This can be further extended to refer to &lt;span class=&quot;math-container&quot;&gt;$\left|n\right&amp;gt;$&lt;/span&gt; (defined by &lt;span class=&quot;math-container&quot;&gt;$a\left|n\right&amp;gt; = \sqrt{n}\left|n-1\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a\left|0\right&amp;gt; = 0$&lt;/span&gt;) as the state with n excitations, where the states with 0 and 1 excitation are used as the basis for your qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/09500340.2013.861935?journalCode=tmop20&quot; rel=&quot;noreferrer&quot;&gt;this appears to be possible&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;This gives the &lt;strong&gt;full answer:&lt;/strong&gt;&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="23" LastActivityDate="2020-01-29T15:34:25.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9694" PostTypeId="2" ParentId="9690" CreationDate="2020-01-29T19:06:43.643" Score="8" Body="&lt;p&gt;Effectively, the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.z&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Z&lt;/code&gt; operation&lt;/a&gt; (represented by the Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; matrix) applies a rotation about the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-axis. As you note, rotations can also be written in the form &lt;span class=&quot;math-container&quot;&gt;$e^{-i Z t}$&lt;/span&gt;. To see that, you can use a trick pretty similar to the one used to derive Euler's identity (&lt;span class=&quot;math-container&quot;&gt;$e^{i \theta} = \cos(\theta) + i \sin(\theta)$&lt;/span&gt;) to rewrite the Taylor series that you quoted in your question.&lt;/p&gt;&#xA;&lt;p&gt;In particular, to derive Euler's identity, you can use that &lt;span class=&quot;math-container&quot;&gt;$i^2 = -1$&lt;/span&gt; to separate the even and odd powers of the series &lt;span class=&quot;math-container&quot;&gt;$e^x$&lt;/span&gt; and identify the series for &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta)$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$(Zt)^2 = t^2$&lt;/span&gt; , you can pull the same trick with &lt;span class=&quot;math-container&quot;&gt;$e^{i Z t}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;     e^{i Z t} &amp;amp; = \sum_{j = 0}^{\infty} \frac{(iZt)^j}{j!} \\&#xA;               &amp;amp; = \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] \\ &#xA;               &amp;amp; =  \cos(t) + i Z \sin(t)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, at &lt;span class=&quot;math-container&quot;&gt;$t = \pi / 2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$e^{i Z t} = iZ$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is an example of a global phase, evolving under &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; for time &lt;span class=&quot;math-container&quot;&gt;$t = \pi / 2$&lt;/span&gt; gives you the same unitary transformation as &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. Indeed, you can check the equivalence of the two matrices using QuTiP:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;In [1]: import qutip as qt&#xA;In [2]: import numpy as np&#xA;In [3]: Z = qt.sigmaz()&#xA;In [4]: -1j * (1j * Z * np.pi / 2).expm()&#xA;Out[4]:&#xA;Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True&#xA;Qobj data =&#xA;[[ 1.  0.]&#xA; [ 0. -1.]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can also check that the quantum program &lt;code&gt;Z(q);&lt;/code&gt; does the same thing as &lt;code&gt;Exp([PauliZ], PI() / 2.0, [q]);&lt;/code&gt; using the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.diagnostics.assertoperationsequalreferenced&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;AssertOperationsEqualReferenced&lt;/code&gt; operation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Diagnostics;&#xA;open Microsoft.Quantum.Math;&#xA;&#xA;operation ApplyZ(qubits : Qubit[]) : Unit is Adj + Ctl {&#xA;    Z(Head(qubits));&#xA;}&#xA;&#xA;operation CheckIfOperationsEqual() : Unit {&#xA;    AssertOperationsEqualReferenced(1,&#xA;        ApplyZ,&#xA;        Exp([PauliZ], PI() / 2.0, _)&#xA;    );&#xA;    Message(&amp;quot;Operations are equal!&amp;quot;);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://mybinder.org/v2/gist/cgranade/c2e9f0e7f2128c6f4d6a467b4353836c/master&quot; rel=&quot;nofollow noreferrer&quot;&gt;Try it online!&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1978" LastEditorUserId="8623" LastEditDate="2020-08-02T19:32:28.773" LastActivityDate="2020-08-02T19:32:28.773" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9695" PostTypeId="1" AcceptedAnswerId="9809" CreationDate="2020-01-29T19:48:33.960" Score="5" ViewCount="762" Body="&lt;p&gt;I can found many qasm examples.&#xA;How can I run them on different IBMQ devices?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2020-02-10T05:51:13.860" Title="How to run a qasm file on IBMQ device?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9696" PostTypeId="2" ParentId="9695" CreationDate="2020-01-29T20:07:13.060" Score="6" Body="&lt;p&gt;The easiest way is to use the &lt;code&gt;QuantumCircuit&lt;/code&gt; methods &lt;code&gt;QuantumCircuit.from_qasm_file()&lt;/code&gt; or &lt;code&gt;QuantumCircuit.from_qasm_str()&lt;/code&gt; depending on if your loading the QASM from a file or Python string, respectively.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-01-29T20:07:13.060" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9697" PostTypeId="1" CreationDate="2020-01-29T21:04:09.317" Score="4" ViewCount="92" Body="&lt;p&gt;&lt;strong&gt;What problem structure(s) are required to admit an exponential speedup in the universal quantum model of computation under the query model?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0005055.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;amplitude amplification framework&lt;/a&gt; inspired by Grover, which (as far as I know, would love to hear otherwise) does not yield exponential speedups for any problems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So recently, I've been digging into this line of inquiry. &lt;a href=&quot;https://cims.nyu.edu/~regev/toc/articles/v010a006/v010a006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson &amp;amp; Ambainis (2014)&lt;/a&gt;, &lt;a href=&quot;https://dspace.mit.edu/bitstream/handle/1721.1/91097/892733342-MIT.pdf;sequence=2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ben-David(2011)&lt;/a&gt; &lt;a href=&quot;https://arxiv.org/pdf/1810.01790v1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chailloux (2018)&lt;/a&gt; (among others) studied the above question, however, to date it seems that it is unresolved (not least because it seems to be a very &lt;em&gt;hard&lt;/em&gt; problem from a complexity standpoint). That said, on the basis of existing algorithms, Aaronson and Ambainis suggest:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the context of most existing quantum algorithms, “structured”&#xA;  basically means that we are trying to determine some global property&#xA;  of an extremely long sequence of numbers, assuming that the sequence&#xA;  satisfies some global regularity. As a canonical example, consider&#xA;  PERIOD-FINDING, the core of Shor’s algorithms for factoring and&#xA;  computing discrete logarithms...The requirement of periodicity is &#xA;  crucial here: it is what lets us use the Quantum Fourier Transform &#xA;  to extract the information we want from a superposition...For other&#xA;  known quantum algorithms, X needs to be (for example) a cyclic shift&#xA;  of quadratic residues or constant on the cosets of a hidden subgroup.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This, as might be presumed, is different from the approach taken by amplitude amplification – setting aside the notion of finding a global property with an 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 &lt;em&gt;seem&lt;/em&gt; superficially necessary for an exponential speedup?&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2020-01-30T19:31:41.677" LastActivityDate="2021-04-21T20:58:53.353" Title="The relationship between problem structure and exponential speedups under the query model" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;amplitude-amplification&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9699" PostTypeId="1" AcceptedAnswerId="9702" CreationDate="2020-01-30T16:41:23.660" Score="0" ViewCount="66" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; which vanishes in the limit where we use the channel infinitely many times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;syndrome&quot; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-01-30T16:48:01.880" LastActivityDate="2020-01-31T09:57:42.637" Title="Quantum error correction - approximate vs exact" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9700" PostTypeId="1" CreationDate="2020-01-30T16:59:29.390" Score="4" ViewCount="159" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do algorithms of each type differ?&lt;/li&gt;&#xA;&lt;li&gt;What are examples of exact algorithms?&lt;/li&gt;&#xA;&lt;li&gt;Can you use amplitude amplification in an exact algorithm?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8438" LastEditorUserId="8438" LastEditDate="2020-03-17T14:45:54.143" LastActivityDate="2020-03-17T14:45:54.143" Title="What is an exact quantum algorithm?" Tags="&lt;algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9701" PostTypeId="1" AcceptedAnswerId="9704" CreationDate="2020-01-30T17:53:51.907" Score="4" ViewCount="420" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/1804.03719.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithm Implementations for Beginners&lt;/a&gt; is an example of the Quantum PCA with an given 2 x 2 covariance matrix &lt;span class=&quot;math-container&quot;&gt;$\sum$&lt;/span&gt;.&lt;br&gt;&#xA;The steps for state preparation are given in the paper. The steps are: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;calculate covariance matrix &lt;span class=&quot;math-container&quot;&gt;$\sum$&lt;/span&gt; from the data&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;compute density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{Tr(\sum)}*\sum$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;calculate two-qubit pure quantum state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;calculate the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U_{prep}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I wanna comprehend the example from the paper. So far I got the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.  I would be glad if someone could explain me  how to calculate the quantum state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; and futhermore  &lt;span class=&quot;math-container&quot;&gt;$U_{prep}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9930" LastEditorUserId="55" LastEditDate="2020-08-01T11:35:58.580" LastActivityDate="2020-08-01T11:35:58.580" Title="Quantum PCA State Preparation" Tags="&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9702" PostTypeId="2" ParentId="9699" CreationDate="2020-01-30T18:55:32.883" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider, for example, one of the simplest QECC's there is: the 3-bit repetition code.&#xA;In this code, the logical Hilbert space is spanned by the logical states &lt;span class=&quot;math-container&quot;&gt;$|\overline{0}\rangle = |000\rangle$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$|\overline{1}\rangle = |111\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By parity comparisons we can infer if certain errors happened. The errors we can detect are all the single qubit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-flips: &lt;span class=&quot;math-container&quot;&gt;$XII$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$IXI$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$IIX$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;individually&lt;/strong&gt; are flipped with a probability &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. That is to say, we have Kraus operators:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_{1} = \sqrt{1-\epsilon}I, \,E_{2} = \sqrt{\epsilon}X,&#xA;\end{equation}&lt;/span&gt;&#xA;on all three qubits. Therefore, our entire system has &lt;span class=&quot;math-container&quot;&gt;$2^{3} = 8$&lt;/span&gt; Kraus operators, namely the three-fold tensor product of &lt;span class=&quot;math-container&quot;&gt;$E_{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{2}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;A_{1} = (1-\epsilon)^{3/2}III, \,&amp;amp; A_{8} = \epsilon^{3/2}XXX \\&#xA;A_{2} = (1-\epsilon)(\epsilon)^{1/2}XII, \,&amp;amp; A_{5} = (1-\epsilon)^{1/2}\epsilon IXX \\&#xA;A_{3} = (1-\epsilon)(\epsilon)^{1/2}IXI, \,&amp;amp; A_{6} = (1-\epsilon)^{1/2}\epsilon XIX \\&#xA;A_{4} = (1-\epsilon)(\epsilon)^{1/2}IIX, \,&amp;amp; A_{7} = (1-\epsilon)^{1/2}\epsilon XXI,\\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where I have put Kraus operators giving raise to the same error syndrome in the same row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have some logical state &lt;span class=&quot;math-container&quot;&gt;$\rho = \in \mathcal{H}_{l}$&lt;/span&gt;, 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):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\rho \rightarrow \frac{1}{(1-\epsilon)^{3} + \epsilon^{3}}\big((1-\epsilon)^{3}\rho + \epsilon^{3} XXX\rho XXX \big), \\&#xA;\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), \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;with the top row holding for a trivial error syndrome, and the bottom row holding for any non-trivial error syndrome.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\sim \epsilon$&lt;/span&gt;. However, the erroneous states are not non-existant). By repeated QECC's (&lt;em&gt;concatenated codes&lt;/em&gt;), 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;threshold theorem&lt;/a&gt; states that if &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is small enough, we can correct the new errors faster than they arise, thereby allowing us to get arbitrary small errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also taps into your last question: essentially &lt;em&gt;all&lt;/em&gt; error correction is of the approximate type. The error only 'vanishes' by the use of repeated and fault-tolerant implementation of codes.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-01-31T09:57:42.637" LastActivityDate="2020-01-31T09:57:42.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9703" PostTypeId="2" ParentId="9700" CreationDate="2020-01-31T09:02:54.760" Score="3" Body="&lt;p&gt;Only a partial answer, the Deutsch-Jozsa algorithm is an example of an exact algorithm. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &#xA;(note that Grover's algorithm for &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; states uses amplitude amplification and gives an exact answer. This is an exception though I would say)&lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2020-01-31T09:02:54.760" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9704" PostTypeId="2" ParentId="9701" CreationDate="2020-01-31T10:48:35.803" Score="1" Body="&lt;p&gt;In an article &lt;a href=&quot;https://arxiv.org/abs/1904.05803&quot; rel=&quot;nofollow noreferrer&quot;&gt;Towards Pricing Financial Derivatives with an IBM Quantum Computer&lt;/a&gt; PCA is implemented in a practical way with an example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operator &lt;span class=&quot;math-container&quot;&gt;$U_{prep}$&lt;/span&gt; is realized with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; gates but parameters for some gates presented in the article seems wrong (maybe typo). See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9375/cannot-replicate-results-in-article-on-pricing-financial-derivatives-on-ibm-q&quot;&gt;this thread &lt;/a&gt; for more information, correct &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; parameters values and a way how to implement PCA on IBM Q.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; &lt;em&gt;How to find parameters &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; for implementation of &lt;span class=&quot;math-container&quot;&gt;$U_{prep}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; gate.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; gate has this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U3}=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, you have to factor out some complex number (denote &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;) from &lt;span class=&quot;math-container&quot;&gt;$U_{prep}$&lt;/span&gt; in order to have a real number on position &lt;span class=&quot;math-container&quot;&gt;$u_{11}$&lt;/span&gt;. After that you can easily calculate &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)$&lt;/span&gt;. Then, it is not problem to find &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\phi}\sin(\theta/2)$&lt;/span&gt; and finnaly &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; factored out in the first step is a global phase. It is not important in case &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; and controlled global phase gate.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-03T10:37:16.390" LastActivityDate="2020-02-03T10:37:16.390" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9705" PostTypeId="1" AcceptedAnswerId="9708" CreationDate="2020-01-31T11:11:01.810" Score="11" ViewCount="1091" Body="&lt;p&gt;There are two groups of quantum gates - Clifford gates and non-Clifford gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Representatives of Clifford gates are Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate and &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate. Non-Clifford gate is for example &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate and Toffoli gate (because its implementation comprise &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Am I right that non-Clifford gates increase time consumption (or complexity of quantum algorithm)?&lt;/li&gt;&#xA;&lt;li&gt;Why non-Clifford gates cannot be simulated efficiently? &lt;em&gt;This is confusing for me, because &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates are both rotations with only different angle.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-07-24T12:16:20.050" LastActivityDate="2020-07-24T12:16:20.050" Title="Why are non-Clifford gates more complex than Clifford gates?" Tags="&lt;quantum-gate&gt;&lt;complexity-theory&gt;&lt;simulation&gt;&lt;clifford-group&gt;&lt;gottesman-knill&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9706" PostTypeId="2" ParentId="9700" CreationDate="2020-01-31T11:20:41.807" Score="2" Body="&lt;p&gt;Say you want to factorise a large integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. 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 &lt;em&gt;deterministically&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt;. Now, this is efficient, &lt;em&gt;but not deterministic&lt;/em&gt;. 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of a less artificial deterministic quantum algorithm would be &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Jozsa&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can you use probability amplification in an exact algorithm? If so, are they really all that different?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What would be the point? If the algorithm is exact/deterministic, then there is nothing to amplify. If anything, you might want to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;nofollow noreferrer&quot;&gt;amplitude amplification&lt;/a&gt; with a &lt;em&gt;non-exact&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-01-31T11:20:41.807" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="9707" PostTypeId="1" AcceptedAnswerId="9710" CreationDate="2020-01-31T13:30:44.110" Score="0" ViewCount="92" Body="&lt;p&gt;Based on the properties of the qubit, how could I solve this problem:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have 3 person A B C and 2 taxis T1 and T2&lt;/li&gt;&#xA;&lt;li&gt;A and B are friends&lt;/li&gt;&#xA;&lt;li&gt;B and C hate each other&lt;/li&gt;&#xA;&lt;li&gt;A and C hate each other&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;How could I maximize the pairs of people (A,C), (A,B) and (B,C) which are friends&#xA;and minimize the pairs of people who hate each other using qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that 'pair' means entangled, so I have the possible 'pairs' in a quantum state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ a|AB\rangle +b|AC\rangle+c|BC\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;satisfying &lt;span class=&quot;math-container&quot;&gt;$ |a|^{2}+|b|^{2}+|c|^{2}=1 $&lt;/span&gt; after normalization.&lt;/p&gt;&#xA;" OwnerUserId="9937" LastEditorUserId="9006" LastEditDate="2020-01-31T23:05:25.460" LastActivityDate="2020-01-31T23:20:24.210" Title="Quantum algorithm for binary assignment problem" Tags="&lt;quantum-state&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9708" PostTypeId="2" ParentId="9705" CreationDate="2020-01-31T19:44:36.910" Score="8" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1812.01238v3&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1902.02134&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional Hilbert space.  The (arguably) surprising result is that circuits consisting only of Clifford gates can be simulated efficiently (by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gottesman%E2%80%93Knill_theorem&quot; rel=&quot;noreferrer&quot;&gt;Gottesman-Knill Theorem&lt;/a&gt;).  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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-01-31T19:44:36.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9709" PostTypeId="2" ParentId="6099" CreationDate="2020-01-31T21:39:03.260" Score="1" Body="&lt;p&gt;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 &lt;strong&gt;of&lt;/strong&gt; a lossy bosonic channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This bound on the secret key rate is computed as a regularisation, where one considers the infinite limit of &lt;span class=&quot;math-container&quot;&gt;$ n \rightarrow \infty$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho}$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathcal{C}(\mathcal{E}) \leq E_R^\infty(\hat{\rho}) := \lim_{n\to\infty} {1\over n} E_R(\hat{\rho}^{\otimes n}).&#xA;\end{equation}&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1711.09909.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, more &lt;a href=&quot;https://arxiv.org/pdf/1808.00608.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent work&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9839" LastActivityDate="2020-01-31T21:39:03.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9710" PostTypeId="2" ParentId="9707" CreationDate="2020-01-31T23:20:24.210" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_annealing#D-Wave_implementations&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Your problem as an binary assignment problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lets denote &lt;span class=&quot;math-container&quot;&gt;$x_{ik} \in \{0;1\}$&lt;/span&gt; a binary variable meaning whether a person &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is assigned to a taxi &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$x_{ik} = 1$&lt;/span&gt;) or not (i.e. &lt;span class=&quot;math-container&quot;&gt;$x_{ik} = 0$&lt;/span&gt;). Further let &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; be a set of persons and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; set of taxis. Without loss of generality, assume that number of taxi is half the number of persons (&lt;em&gt;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&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Lets denote &lt;span class=&quot;math-container&quot;&gt;$c_{ijk}$&lt;/span&gt; a cost of assigning persons &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; to taxi &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. In case the persons are friends then &lt;span class=&quot;math-container&quot;&gt;$c_{ijk} = 1$&lt;/span&gt;, in case they hate each other then &lt;span class=&quot;math-container&quot;&gt;$c_{ijk} = -1$&lt;/span&gt; and if one person is the dummy one then &lt;span class=&quot;math-container&quot;&gt;$c_{ijk} = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Your objective function is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f = \sum_{i,j \in P \\k \in T} c_{ijk}x_{ik}x_{jk} \rightarrow \mathrm{MAX},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;subject to conditions&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\forall k \in T: \sum_{i \in P} x_{ik} = 2 &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\forall i \in P: \sum_{i \in T} x_{ik} = 1 &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Now you can employ a quantum annealer to perform the optimization.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-01-31T23:20:24.210" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9711" PostTypeId="5" CreationDate="2020-02-01T00:28:43.897" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2020-02-01T00:28:43.897" LastActivityDate="2020-02-01T00:28:43.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9712" PostTypeId="4" CreationDate="2020-02-01T00:28:43.897" Score="0" Body="Questions directed to the Gottemsman-Knill theorem, which states that quantum circuits consisting of elements from the Clifford group are classically efficient to simulate." OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-02-02T10:42:17.863" LastActivityDate="2020-02-02T10:42:17.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9713" PostTypeId="2" ParentId="9662" CreationDate="2020-02-01T09:17:57.743" Score="1" Body="&lt;p&gt;I found a very nice result in Audenaert, &quot;Quantum skew divergence&quot;, &lt;em&gt;J of Mathematical Physics&lt;/em&gt;, 2014 (also cited in Kim and Ruskai, &quot;Bounds on the concavity of quantum entropy&quot;, &lt;em&gt;J of Mathematical Physics&lt;/em&gt;, 2014).&#xA; Theorem 14 in Audenaert bounds the Holevo information between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\chi(B;A) \le h(\epsilon) T(\rho_A, \sigma_A)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$h(\epsilon)=-\epsilon \ln \epsilon - (1-\epsilon) \ln (1-\epsilon)$&lt;/span&gt; is the binary Shannon entropy and &lt;span class=&quot;math-container&quot;&gt;$T(\rho_A, \sigma_A) = \frac{1}{2} \lVert \rho_A-\sigma_A\rVert_1$&lt;/span&gt; is the trace distance.&#xA;For our classical-quantum state, &lt;span class=&quot;math-container&quot;&gt;$S(B|A)= S(B) - \chi(B;A)$&lt;/span&gt;, which gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S(B|A) \ge (1 - T(\rho_A, \sigma_A)) h(\epsilon),$$&lt;/span&gt;&#xA;which is exactly the kind of bound I was looking for.&lt;/p&gt;&#xA;" OwnerUserId="9900" LastActivityDate="2020-02-01T09:17:57.743" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9714" PostTypeId="1" CreationDate="2020-02-01T17:34:38.037" Score="-2" ViewCount="78" Body="&lt;p&gt;According to some references (&lt;a href=&quot;https://www.cs.cmu.edu/~odonnell/quantum15/lecture04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lectures on Quantum Computation at Carnegie Mellon School of Computer Science&lt;/a&gt;) Grover’s algorithm uses only  O(&lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}\ln {N}$&lt;/span&gt;) gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this to calculate desired hash (such as you have in Bitcoin) will require, as I interpret the above - &lt;span class=&quot;math-container&quot;&gt;$256\times{2^{128}}$&lt;/span&gt; gates.&#xA;Is this correct interpretation?&lt;/p&gt;&#xA;" OwnerUserId="9261" LastEditorUserId="9006" LastEditDate="2020-02-01T19:01:25.060" LastActivityDate="2020-02-04T09:51:09.080" Title="Grover’s algorithm" Tags="&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2020-02-04T16:24:21.413" ContentLicense="CC BY-SA 4.0" />
  <row Id="9715" PostTypeId="1" AcceptedAnswerId="9718" CreationDate="2020-02-01T19:09:34.493" Score="1" ViewCount="105" Body="&lt;p&gt;On a view places, I've seen kets that look like this &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt; or this &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt;$&lt;/span&gt; but I don't seem to find any explanation of this base online. Is it just a different notation for &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, or does it mean something else? Thanks for your help!&lt;/p&gt;&#xA;" OwnerUserId="9950" LastEditorUserId="9006" LastEditDate="2020-02-01T23:25:39.603" LastActivityDate="2020-02-01T23:25:39.603" Title="What are $|+\rangle$ and $|-\rangle$?" Tags="&lt;quantum-state&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9716" PostTypeId="1" AcceptedAnswerId="14672" CreationDate="2020-02-01T19:22:42.890" Score="0" ViewCount="104" Body="&lt;p&gt;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 &quot;one-leg&quot; spiders could help, but I'm not yet convinced that it's the good way to go.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for example, can ZX-calculus deal with &quot;impossible&quot;/not normalisable circuits, like &quot;create a plus state and project it on minus&quot; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5969" LastActivityDate="2020-11-16T10:14:26.300" Title="ZX-calculus : measurement and output probabilities" Tags="&lt;measurement&gt;&lt;zx-calculus&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9717" PostTypeId="2" ParentId="9716" CreationDate="2020-02-01T19:39:15.667" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenbasis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/43ky2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/43ky2.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-02-01T19:39:15.667" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9718" PostTypeId="2" ParentId="9715" CreationDate="2020-02-01T19:53:25.993" Score="6" Body="&lt;p&gt;The set &lt;span class=&quot;math-container&quot;&gt;$\{ \left|+\right&amp;gt;, \left|-\right&amp;gt; \}$&lt;/span&gt; is known as the polar basis. It easy to see that they are the result of applying the Hadamard transform &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt; to the standard basis vectors of a one-dimensional Hilbert space:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H\left|0\right&amp;gt; = \left| + \right&amp;gt;,&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H\left|1\right&amp;gt; = \left| - \right&amp;gt;.&#xA;$$&lt;/span&gt;&#xA;You can read more about them Hadamard transform &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_transform&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8438" LastActivityDate="2020-02-01T19:53:25.993" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9719" PostTypeId="1" AcceptedAnswerId="9723" CreationDate="2020-02-03T00:08:16.403" Score="1" ViewCount="50" Body="&lt;p&gt;I am reading about Entanglement-assisted Quantum Error Correction Codes from &lt;a href=&quot;https://books.google.ca/books?id=frvBRTnWpEIC&amp;amp;pg=PA338&amp;amp;lpg=PA338&amp;amp;dq=entanglement+assisted+quantum+error+correction+Notice+that+the+channel+does+not+affect+the+receiver%E2%80%99s+half+of+shared+ebits+at+all.&amp;amp;source=bl&amp;amp;ots=VJe26TSuj3&amp;amp;sig=ACfU3U279Yh-xvNS_Cm1cwB222uyX5LlyA&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=2ahUKEwjD18r6h7TnAhWGLc0KHbM-ByoQ6AEwAHoECAoQAQ#v=onepage&amp;amp;q=entanglement%20assisted%20quantum%20error%20correction%20Notice%20that%20the%20channel%20does%20not%20affect%20the%20receiver%E2%80%99s%20half%20of%20shared%20ebits%20at%20all.&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Processing and Quantum Error Correction: An Engineering Approach (Chapter 9)&lt;/a&gt; . 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 &lt;span class=&quot;math-container&quot;&gt;$\vert \Phi^+ \rangle$&lt;/span&gt;. It is assumed to be error-free and shared between the sender Alice and receiver Bob, prior to the start of the communication. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice will encode her state &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; with the help of local ancillary qubits &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and her half of shared ebits. She will then sends the encoded qubits over a noisy quantum channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book then states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Notice that the channel does not affect the receiver’s half of shared&#xA;  ebits at all.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How is that even possible? I thought if one entangled subsystem changes, then the other changes automatically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-02-03T09:10:32.143" Title="The behaviour of ebits in Entanglement-assisted Quantum Error Correction Codes?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;error-correction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9720" PostTypeId="1" AcceptedAnswerId="9721" CreationDate="2020-02-03T02:19:33.760" Score="2" ViewCount="377" Body="&lt;p&gt;There is a basis consisting of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states, i.e. z-basis. Why do we need different basis (in quantum computation), like polar basis and others (&lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="9006" LastEditDate="2020-02-03T05:26:21.097" LastActivityDate="2020-02-04T12:04:18.093" Title="Why do we need different basis vectors?" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9721" PostTypeId="2" ParentId="9720" CreationDate="2020-02-03T04:51:59.650" Score="4" Body="&lt;p&gt;It is not clear for me what &lt;em&gt;need&lt;/em&gt; means here. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Transformation between standard &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle \}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle \}$&lt;/span&gt; basis, then we can use this option to optimize computation or ignore.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We don't really &lt;em&gt;need&lt;/em&gt; different bases, we just can use them if our quantum hardware supports measurements in different bases. &lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-02-04T12:04:18.093" LastActivityDate="2020-02-04T12:04:18.093" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9722" PostTypeId="2" ParentId="9720" CreationDate="2020-02-03T05:34:46.750" Score="0" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+\mathrm{e}^{i\frac{\pi}{2}}|1\rangle)$&lt;/span&gt; in standard basis returns &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; both with probability 50 % but the second state has relative phase &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt; 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 &quot;all its properties&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, sometimes, it is more convenient to switch from standard basis to other one because of simplier calculations.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-03T05:34:46.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9723" PostTypeId="2" ParentId="9719" CreationDate="2020-02-03T08:09:41.330" Score="2" Body="&lt;p&gt;If you have a noisy channel&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\mapsto \mathcal{E}(\rho)&#xA;$$&lt;/span&gt;&#xA;for a single qubit, then if you have a Bell pair&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_B=\frac12\left(|00\rangle+|11\rangle\right)\left(\langle 00|+\langle 11|\right),&#xA;$$&lt;/span&gt;&#xA;then you can describe the effect of sending the first qubit through the channel using&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\mathcal{E}\otimes I)\cdot\rho_B.&#xA;$$&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_1(U_1\otimes I\cdot\rho_{12})=\text{Tr}_1(\rho_{12})&#xA;$$&lt;/span&gt;&#xA;for all possible states &lt;span class=&quot;math-container&quot;&gt;$\rho_{12}$&lt;/span&gt; and and possible unitaries &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if your channel applies &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha|00\rangle+\beta|11\rangle\rightarrow\alpha|10\rangle+\beta|01\rangle.&#xA;$$&lt;/span&gt;&#xA;It's not entirely a fair question, really, to be asking &quot;has the second qubit changed?&quot;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2|0\rangle\langle 0|+|\beta|^2|1\rangle\langle 1|$&lt;/span&gt; both before and after the error.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-03T08:09:41.330" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9724" PostTypeId="2" ParentId="8543" CreationDate="2020-02-03T08:15:37.103" Score="3" Body="&lt;p&gt;You can take the definition of the function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; acting on any normal matrix to be such that if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\sum_i\lambda_i|\lambda_i\rangle\langle\lambda_i|,&#xA;$$&lt;/span&gt;&#xA;then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(M):=\sum_if(\lambda_i)|\lambda_i\rangle\langle\lambda_i|.&#xA;$$&lt;/span&gt;&#xA;So for any &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$M^2=I$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$M=P_+-P_-$&lt;/span&gt; is described using projectors onto its &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt; eigenspaces, and &lt;span class=&quot;math-container&quot;&gt;$P_++P_-=I$&lt;/span&gt;. We can solve these simultaneously to get &lt;span class=&quot;math-container&quot;&gt;$P_+=(I+M)/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_-=(I-M)/2$&lt;/span&gt;. Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-03T08:15:37.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9725" PostTypeId="2" ParentId="9719" CreationDate="2020-02-03T09:10:32.143" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Obviously, this will not be practical nor realizable in reality, and so different entanglement distribution protocols will be needed so that the &quot;noiseless&quot; ebits reach the receiver (i.e. entanglement distillation, protecting such half with unassisted QECCs ...). This paradigm is studied in &lt;a href=&quot;https://arxiv.org/pdf/1204.0302.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entanglement-Assisted Quantum Error-Correcting Codes with Imperfect Ebits&lt;/a&gt;, I give the reference so that you can further deepen your knowledge about QECCs operating with noisy shared entanglement.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2020-02-03T09:10:32.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9726" PostTypeId="2" ParentId="9507" CreationDate="2020-02-03T11:04:35.277" Score="2" Body="&lt;p&gt;&lt;strong&gt;Based on comment by DaftWullie and my experience with the algortihm, it seems that a title of the article is misleading.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(n-1)!$&lt;/span&gt; such eigenstates. Moreover, the list has to be stored in a memory (maybe qRAM). However, qRAM is rather experimental nowadays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To sum up:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The proposed algorithm is in fact only part of complete algorithm for solving TSP&lt;/li&gt;&#xA;&lt;li&gt;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) (&lt;strong&gt;THIS IS THE MAIN OBSTACLE&lt;/strong&gt;)&lt;/li&gt;&#xA;&lt;li&gt;The algorithm needs qRAM which is not avaiable now&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-03T11:04:35.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9728" PostTypeId="1" AcceptedAnswerId="9732" CreationDate="2020-02-03T15:41:22.440" Score="1" ViewCount="115" Body="&lt;p&gt;So I have been given the following quantum states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{I}{2} + \frac{\bar{s}.\bar{\sigma}}{2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\pi = \frac{I}{2} + \frac{\bar{r}.\bar{\sigma}}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I calculate the fidelity between the two?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that the general formula for fidelity is: &lt;span class=&quot;math-container&quot;&gt;$tr\sqrt{\rho^{1/2}\pi\rho^{1/2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho \text{ and } \pi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9959" LastEditorUserId="55" LastEditDate="2020-02-04T10:33:12.687" LastActivityDate="2020-02-04T10:33:12.687" Title="Can I compute the fidelity between two states without having to diagonalise them?" Tags="&lt;quantum-state&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9729" PostTypeId="1" AcceptedAnswerId="9733" CreationDate="2020-02-03T16:01:40.850" Score="12" ViewCount="1899" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I heard more and more that it is &quot;theoretically&quot; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(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)&lt;/p&gt;&#xA;" OwnerUserId="8640" LastEditorUserId="55" LastEditDate="2020-11-04T16:02:12.967" LastActivityDate="2020-11-04T16:02:12.967" Title="Does quantum computing already possess the level of abstraction to be explicable even without knowledge of physics?" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9731" PostTypeId="2" ParentId="9729" CreationDate="2020-02-03T17:46:27.180" Score="5" Body="&lt;p&gt;I believe it is possible to study Quantum Mechanics by studying Quantum Computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I like very much introductory &lt;a href=&quot;https://courses.edx.org/courses/BerkeleyX/CS-191x/2013_August/course/&quot; rel=&quot;noreferrer&quot;&gt;online course on Quantum Mechanics and Quantum Computation&lt;/a&gt; by Prof. Vazirani, now archived, which is an interesting attempt to teach both Quantum Mechanics and Quantum Computation in a single course.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-02-03T17:46:27.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9732" PostTypeId="2" ParentId="9728" CreationDate="2020-02-03T18:13:16.313" Score="3" Body="&lt;p&gt;If these are qubit states, the formula in your question simplifies dramatically to &lt;span class=&quot;math-container&quot;&gt;$$F'(\rho,\pi)=\sqrt{\text{tr}(\rho \pi) + 2 \sqrt{\text{det}(\rho) \text{det}(\pi)}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you consider the components of the vectors, &lt;span class=&quot;math-container&quot;&gt;$\vec s = (s_1, s_2, s_3)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec r = (r_1, r_2, r_3)$&lt;/span&gt;, this can be expressed simply as &lt;span class=&quot;math-container&quot;&gt;$$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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the formula you provided is normally referred to as quantity fidelity (&lt;span class=&quot;math-container&quot;&gt;$F'$&lt;/span&gt;), defined in terms of fidelity (&lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;) by &lt;span class=&quot;math-container&quot;&gt;$F'\equiv\sqrt{F}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-02-04T05:41:06.347" LastActivityDate="2020-02-04T05:41:06.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9733" PostTypeId="2" ParentId="9729" CreationDate="2020-02-03T19:17:09.007" Score="12" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.scottaaronson.com/blog/?p=3943&quot; rel=&quot;noreferrer&quot;&gt;&quot;Introduction to Quantum Information Science&quot;&lt;/a&gt; course by Scott Aaronson&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://cleve.iqc.uwaterloo.ca/qic710.html&quot; rel=&quot;noreferrer&quot;&gt;&quot;Introduction to Quantum Information Processing&quot;&lt;/a&gt; by Richard Cleve&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://people.eecs.berkeley.edu/~vazirani/quantum.html&quot; rel=&quot;noreferrer&quot;&gt;&quot;Quantum Computation&quot;&lt;/a&gt; course by Umesh Vazirani (which mentions physics now and then but more as an illustration)&lt;/li&gt;&#xA;&lt;li&gt;Our group took a similar approach when we taught a class &quot;Introduction to Quantum Computing and Quantum Programming in Q#&quot; last year.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-02-03T19:17:09.007" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9734" PostTypeId="1" AcceptedAnswerId="9745" CreationDate="2020-02-03T20:28:13.157" Score="2" ViewCount="99" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help is greatly appreciated!!!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/maw2R.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/maw2R.png&quot; alt=&quot;Screenshot of the error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9960" LastEditorUserId="9960" LastEditDate="2020-02-07T01:49:22.523" LastActivityDate="2020-02-07T01:49:22.523" Title="Installing Qiskit Error: Building wheel failed!" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9735" PostTypeId="2" ParentId="9714" CreationDate="2020-02-04T09:51:09.080" Score="1" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; notation does not mean what you're interpretting it to mean. All it means is that as &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; grows, the running time scales roughly linearly in &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. But there are constants that are suppressed (&lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; could mean &lt;span class=&quot;math-container&quot;&gt;$10^9N$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$10^{-9}N$&lt;/span&gt;) and also ignores all terms in a summation that could grow more slowly, such as &lt;span class=&quot;math-container&quot;&gt;$N^{0.95}$&lt;/span&gt; (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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-04T09:51:09.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9736" PostTypeId="1" CreationDate="2020-02-04T14:13:37.307" Score="1" ViewCount="104" Body="&lt;p&gt;Dear team and developers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using qiskit on Python 36, windows 64bits&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the same identical problem of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5729/import-from-qiskit-aqua-error&quot;&gt;Import from qiskit-aqua error&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &quot;C:\Users\root\eclipse-workspace\Dir\file.py&quot;, line 11, in &amp;lt;module&amp;gt;&#xA;    from qiskit.aqua.components.uncertainty_models import UniformDistribution, UnivariateVariationalDistribution &#xA;  File &quot;C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\aqua\__init__.py&quot;, line 29, in &amp;lt;module&amp;gt;&#xA;    from .utils.backend_utils import (get_aer_backend,&#xA;  File &quot;C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\aqua\utils\__init__.py&quot;, line 27, in &amp;lt;module&amp;gt;&#xA;    from .qp_solver import optimize_svm&#xA;  File &quot;C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\aqua\utils\qp_solver.py&quot;, line 18, in &amp;lt;module&amp;gt;&#xA;    from cvxopt import matrix, solvers&#xA;  File &quot;C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\cvxopt\__init__.py&quot;, line 50, in &amp;lt;module&amp;gt;&#xA;    import cvxopt.base&#xA;ImportError: DLL load failed: The specified module could not be found.&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I re-installed everything, all is up.to.date&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help.&lt;/p&gt;&#xA;" OwnerUserId="9966" LastActivityDate="2021-03-02T13:02:15.267" Title="from qiskit.aqua import... ImportError: DLL load failed: The specified module could not be found" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9737" PostTypeId="1" CreationDate="2020-02-04T18:30:40.720" Score="3" ViewCount="100" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help would be great Thanks!&lt;/p&gt;&#xA;" OwnerUserId="9902" LastActivityDate="2021-04-15T14:34:40.220" Title="Easiest hash function to implement on Qiskit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9738" PostTypeId="1" CreationDate="2020-02-04T20:58:49.283" Score="2" ViewCount="40" Body="&lt;p&gt;The connection between physical qubits of IBM devices are all bidirectional or there are some architectures that there existing some unidirectional connection?&lt;br&gt;&#xA;I found that in IBM Quantum experience, all the device connections are bidirectional, I was wondering if there are some exceptions?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2020-02-04T21:18:18.463" Title="Are all the IBM QX mapping bidirectional?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;architecture&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9739" PostTypeId="2" ParentId="9738" CreationDate="2020-02-04T21:18:18.463" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-02-04T21:18:18.463" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9740" PostTypeId="1" AcceptedAnswerId="9741" CreationDate="2020-02-05T05:04:52.377" Score="2" ViewCount="79" Body="&lt;p&gt;I'm trying to solve problem 11.3 in Nielsen Chuang:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;(3) Prove the conditional version of the triangle inequality:&#xA;  &lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(A,B|C)\geq S(A|C)-S(B|C)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But the inequality seems incorrect. For example, let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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},\\&#xA;\rho^{ABC} = |\psi\rangle\langle\psi|.&#xA;$$&lt;/span&gt;&#xA;Then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho^{C}=\frac{I}{4},\\&#xA;\rho^{AC}=\rho^{BC}=\frac{I}{2},\\&#xA;S(A,B|C)=S(A,B,C)-S(C)=0-2,\\&#xA;S(A|C)=S(B|C)=1-2=-1,\\&#xA;S(A,B|C)=-2&amp;lt;0=S(A|C)-S(B|C).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I doing something wrong, or did the problem mean to say &lt;span class=&quot;math-container&quot;&gt;$S(A,B)\geq S(A|C)-S(B|C)$&lt;/span&gt; or something?&lt;/p&gt;&#xA;" OwnerUserId="9970" LastEditorUserId="55" LastEditDate="2020-11-04T16:02:08.430" LastActivityDate="2020-11-04T16:02:08.430" Title="Conditional version of the triangle inequality for Von Neumann entropy" Tags="&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9741" PostTypeId="2" ParentId="9740" CreationDate="2020-02-05T11:30:36.423" Score="2" Body="&lt;p&gt;You've computed &lt;span class=&quot;math-container&quot;&gt;$\rho^{AC},\rho^{BC}$&lt;/span&gt; incorrectly &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; they are matrices of size &lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt;, also they are not equal to &lt;span class=&quot;math-container&quot;&gt;$I/8$&lt;/span&gt;. Nevertheless their entropy is equal, i.e. &lt;span class=&quot;math-container&quot;&gt;$S(A,C) = S(B,C)$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is indeed a counterexample to the statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inequality &lt;span class=&quot;math-container&quot;&gt;$S(A,B)\geq S(A|C)-S(B|C)$&lt;/span&gt;, which is equivalent to &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(A,B) + S(B,C) \geq S(A,C) &#xA;$$&lt;/span&gt;&#xA;is probably what they had in mind. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-02-05T14:48:22.140" LastActivityDate="2020-02-05T14:48:22.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9742" PostTypeId="1" CreationDate="2020-02-05T13:01:49.507" Score="1" ViewCount="99" Body="&lt;p&gt;How can we show that HHL algorithm achieves exponential speedup? &lt;/p&gt;&#xA;" OwnerUserId="9973" LastEditorUserId="9006" LastEditDate="2020-02-05T13:52:32.787" LastActivityDate="2020-02-05T22:49:16.773" Title="Where will I find necessary math to understand HHL algorithm?" Tags="&lt;mathematics&gt;&lt;speedup&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9743" PostTypeId="2" ParentId="9695" CreationDate="2020-02-05T16:14:20.447" Score="-1" Body="&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9975" LastActivityDate="2020-02-05T16:14:20.447" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9745" PostTypeId="2" ParentId="9734" CreationDate="2020-02-05T16:41:28.880" Score="1" Body="&lt;p&gt;Try installing using &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;pip install wheel&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pythonwheels.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Refer here.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wheels are the new standard of Python distribution and are intended to replace eggs. Support is offered in pip &gt;= 1.4 and setuptools &gt;= 0.8.&lt;/p&gt;&#xA;" OwnerUserId="9975" LastActivityDate="2020-02-05T16:41:28.880" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9746" PostTypeId="2" ParentId="9742" CreationDate="2020-02-05T22:49:16.773" Score="1" Body="&lt;p&gt;You can find details about the algorithm optimality and complexity in the original paper by Harrow, Hassidim and Lloyd: &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for solving linear systems of equations&lt;/a&gt;, mainly in parts III and appendix 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An article &lt;a href=&quot;https://arxiv.org/abs/1110.2232&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations&lt;/a&gt; may be interesting for you as well. It contains a &quot;practical&quot; example HHL algorithm application.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-05T22:49:16.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9747" PostTypeId="1" AcceptedAnswerId="9819" CreationDate="2020-02-06T02:15:49.623" Score="2" ViewCount="107" Body="&lt;p&gt;&lt;strong&gt;Short version:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How could I prove in ZX-calculus that these two diagrams are equal (up to a global phase), using axioms from &lt;a href=&quot;https://arxiv.org/pdf/1706.09877.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper (Fig. 1)&lt;/a&gt; for example? Any intuition is welcome!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xh0Qm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xh0Qm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long version:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; angle). And it appears that there are (at least) three different ways (sorry for the bad quality of the drawings):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Version 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OdTUg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdTUg.png&quot; alt=&quot;Version 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Version 2: (note the minus sign on the bottom qubit)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Z82Tt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z82Tt.png&quot; alt=&quot;Version 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Version 3:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aGxDE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aGxDE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, version 2 is very easy to derive from version 1 if we take the axiom (EU) of &lt;a href=&quot;https://hal.archives-ouvertes.fr/hal-01529623v2/document&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (we will call this axiom (EU1)), and version 3 is also easy to derive from version 1 if we take the axiom (EU) of &lt;a href=&quot;https://arxiv.org/pdf/1706.09877.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (we will call this axiom (EU2)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xh0Qm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xh0Qm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how to prove the equality of these two diagrams with axioms only from &lt;a href=&quot;https://arxiv.org/pdf/1706.09877.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the first paper&lt;/a&gt; for example? It seems super easy (just 1/2 nodes!)... but I can't make it... Any intuition is welcome!&lt;/p&gt;&#xA;" OwnerUserId="5969" LastActivityDate="2020-02-10T16:52:37.017" Title="ZX-Calculus: how to prove this simple equation between two very small circuits" Tags="&lt;zx-calculus&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9748" PostTypeId="1" AcceptedAnswerId="9757" CreationDate="2020-02-06T04:02:29.143" Score="2" ViewCount="84" Body="&lt;p&gt;I am trying to implement multiple parallel subroutines of HHL algorithm, each working on a different set of matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (when solving for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, in &lt;span class=&quot;math-container&quot;&gt;$A\vec{x} = \vec{b}$&lt;/span&gt;), to find the expectation values of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. The matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is randomly generated Hermitian matrix, and may/may not be sparse (checking what happens, is also something I'm wondering). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I have the following queries:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If I understand correctly, I need to encode eigenvalues of a &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, say &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt; in the quantum register. Is that right? How do I do that? &lt;/li&gt;&#xA;&lt;li&gt;Is the quantum register initialized with the binary values of &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt;? Does that mean 2 runs of HHL? Is finding Eigenvalues of matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; supposed to be a classical subroutine?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2391" LastEditorUserId="2391" LastEditDate="2020-02-06T08:00:28.650" LastActivityDate="2020-02-06T12:29:34.440" Title="How to encode eigenvalues of matrix $A$ in solving $A\vec{x} = \vec{b}$ using the HHL Algorithm" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9750" PostTypeId="2" ParentId="8972" CreationDate="2020-02-06T06:16:31.967" Score="-1" Body="&lt;p&gt;Do install Microsoft Visual C++ . So tat the error can be satisfied. And also do &lt;code&gt;pip install wheel&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9975" LastActivityDate="2020-02-06T06:16:31.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9752" PostTypeId="1" AcceptedAnswerId="9756" CreationDate="2020-02-06T09:30:38.350" Score="12" ViewCount="3777" Body="&lt;p&gt;I learned that T1 is relaxation time (time from &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) and T2 is coherence time.&#xA;The relaxation is a specific case of decoherence.&#xA;What's the difference between them and what's the exact meaning of coherence time T2?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="9006" LastEditDate="2020-02-06T09:48:07.557" LastActivityDate="2021-02-04T00:00:45.617" Title="What's the difference between T1 and T2?" Tags="&lt;decoherence&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9753" PostTypeId="2" ParentId="9736" CreationDate="2020-02-06T09:31:33.827" Score="0" Body="&lt;p&gt;Try using this &lt;code&gt;from qiskit import *&lt;/code&gt;&#xA;After the import, it would work.&#xA;On which IDE are you running your code?&lt;/p&gt;&#xA;" OwnerUserId="9975" LastEditorUserId="9006" LastEditDate="2020-02-06T09:52:33.410" LastActivityDate="2020-02-06T09:52:33.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9756" PostTypeId="2" ParentId="9752" CreationDate="2020-02-06T09:47:34.510" Score="9" Body="&lt;p&gt;T2 is so-called &lt;em&gt;dephasing time&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It describes how long the phase of a qubit stays intact. In your words, it is time from &lt;span class=&quot;math-container&quot;&gt;$|+\rangle= \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle= \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;, or conversely.&lt;/p&gt;&#xA;&lt;p&gt;Just note that both T1 and T2 are not actually &amp;quot;time from state x to state y&amp;quot; but rather decay constants. Probability that a qubit will stay in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; after time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is given by formula&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(|1\rangle) = \mathrm{e}^{-\frac{t}{T1}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly for T2.&lt;/p&gt;&#xA;&lt;p&gt;Both times T1 and T2 are together called &lt;em&gt;decoherence times&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="10480" LastEditDate="2021-02-04T00:00:45.617" LastActivityDate="2021-02-04T00:00:45.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9757" PostTypeId="2" ParentId="9748" CreationDate="2020-02-06T12:29:34.440" Score="2" Body="&lt;p&gt;Finding the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U=e^{iAt}$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-06T12:29:34.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9758" PostTypeId="1" CreationDate="2020-02-06T13:31:58.007" Score="1" ViewCount="117" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically what makes IBM Quantum simulator stand out from general Matlab based or other simulators which generates random numbers for qubits.&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="9006" LastEditDate="2020-02-06T22:13:12.377" LastActivityDate="2020-02-09T07:57:57.410" Title="What is the difference between IBM quantum simulator and others" Tags="&lt;ibm-q-experience&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9759" PostTypeId="2" ParentId="9752" CreationDate="2020-02-06T14:16:28.183" Score="9" Body="&lt;p&gt;Slight correction to Martin Vesely's answer: &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; is not the (decay constant) time after which an initial state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; will necessarily switch to the state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. If it were, then error correction would be easy. Instead, it's the (decay constant) time after which an initial state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; will evolve into an equal classical probabilistic mixture of the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-02-06T14:16:28.183" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9760" PostTypeId="2" ParentId="9700" CreationDate="2020-02-06T14:26:19.780" Score="2" Body="&lt;p&gt;I asked &lt;a href=&quot;https://cs.stackexchange.com/questions/57360/are-there-any-useful-deterministic-quantum-algorithms-for-decision-problems&quot;&gt;basically the same question&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-02-06T14:26:19.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9761" PostTypeId="1" CreationDate="2020-02-06T17:00:19.617" Score="1" ViewCount="255" Body="&lt;p&gt;For my undergraduate final project I am working on a Quantum Inspired Genetic Algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;I am not sure how to do so on real quantum hardware&lt;/strong&gt;. For example I want to put qubit into state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sqrt{0.3}|0\rangle + \sqrt{0.7}|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="9006" LastEditDate="2020-02-06T22:11:05.170" LastActivityDate="2020-02-06T22:29:40.913" Title="How to set initial state on IBM Q?" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9763" PostTypeId="2" ParentId="9761" CreationDate="2020-02-06T22:29:40.913" Score="3" Body="&lt;p&gt;To prepare an arbitrary single qubit state it is possible to use &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; gate. The gate is defined by a matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U3}(\theta, \phi, \lambda)=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When then gate is applied on a qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (i.e. initial state of all qubits on IBM Q), it is transformed to state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\varphi_0\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting parameters &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; allows you to get any single qubit state you need.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sqrt{0.3}|0\rangle + \sqrt{0.7}|1\rangle$&lt;/span&gt;, so obviously &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2) = \sqrt{0.3}$&lt;/span&gt; parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is given as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2 \arccos(\sqrt{0.3}) = 1.9823.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 1: In case &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are real numbers, &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt; always and you can apply &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}(\theta)$&lt;/span&gt; gate (i.e. y-rotation) with same parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; instead because &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}(\theta) = \mathrm{U3}(\theta,0,0)$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 2: To preare any multiqubit quantum state, a method introduced in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt; can be employed.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-06T22:29:40.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9764" PostTypeId="1" CreationDate="2020-02-06T23:28:37.943" Score="2" ViewCount="33" Body="&lt;p&gt;I wanted to know if there are some way in NISQ (we run &quot;bare&quot; 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 ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there similar constructions for NISQ ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2020-02-06T23:28:37.943" Title="Dealing with noise in NISQ" Tags="&lt;noise&gt;&lt;nisq&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9765" PostTypeId="1" CreationDate="2020-02-07T02:25:50.790" Score="3" ViewCount="40" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1811.00414&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum-inspired classical algorithms for principal component analysis and supervised clustering&lt;/a&gt;, the PCA algorithm requires that the variances of the principal vectors differ by at least a constant fraction of the Frobenius norm squared (&lt;span class=&quot;math-container&quot;&gt;$\sigma_{i+1}^2 - \sigma_i^2 \ge \eta ||A||_{F}^2$&lt;/span&gt;) and that the variance is above a certain constant &lt;span class=&quot;math-container&quot;&gt;$\sigma^2$&lt;/span&gt;. 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, &lt;span class=&quot;math-container&quot;&gt;$\sigma^2$&lt;/span&gt;? And, if so, what is the modified algorithm's computational complexity? From the remark, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;As we assume our eigenvalues have an &lt;span class=&quot;math-container&quot;&gt;$\eta ||A||_F^2$&lt;/span&gt;&#xA;  gap, the precise eigenvector &lt;span class=&quot;math-container&quot;&gt;$|v_j\rangle$&lt;/span&gt; sampled can be identified&#xA;  by the eigenvalue estimate. Then, by computing enough&#xA;  samples, we can learn all of the eigenvalues of at least &lt;span class=&quot;math-container&quot;&gt;$\sigma^2$&lt;/span&gt;&#xA;  and get the corresponding states&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It seems like this should be fine, but later Tang adds, &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that we crucially use the assumptions in Problem 7&#xA;  for our QML algorithm: without guarantee on the gap or&#xA;  that &lt;span class=&quot;math-container&quot;&gt;$\sigma_i \ge \sigma$&lt;/span&gt;, finding the top k singular vectors would be&#xA;  intractable, even with samples of &lt;span class=&quot;math-container&quot;&gt;$|v_i\rangle$&lt;/span&gt;’s.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;leaves open the possibility it wouldn't work.&lt;/p&gt;&#xA;" OwnerUserId="9305" LastEditorUserId="9006" LastEditDate="2020-02-07T05:42:40.063" LastActivityDate="2020-02-07T05:42:40.063" Title="Variances of the principal components in Ewin Tang's PCA algorithm" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9766" PostTypeId="1" AcceptedAnswerId="9768" CreationDate="2020-02-07T04:27:42.693" Score="1" ViewCount="324" Body="&lt;p&gt;I am trying to generate a Quantum Phase Estimation (QPE) circuit in QISKIT the following way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;1 - First, I generate a QPE circuit with the following code:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;### building inverse quantum fourier transform circuit&#xA;iqft = StandardIQFTS(2)&#xA;iqft_circ = QuantumCircuit(QuantumRegister(2))&#xA;iqft.construct_circuit(mode='circuit', qubits=iqft_circ.qubits, circuit=iqft_circ, do_swaps=True)&#xA;&#xA;### Defining matrix operator&#xA;matrix = np.array([[1,0],[0,np.exp(1j*np.pi/4)]])&#xA;&#xA;### Defining Quantum Phase Estimation object&#xA;eigs_qpe = EigsQPE(MatrixOperator(matrix=matrix),&#xA;                   iqft,&#xA;                   num_time_slices=2,&#xA;                   num_ancillae=2,&#xA;                   expansion_mode='trotter',&#xA;                   expansion_order=1,&#xA;                   evo_time=2,&#xA;                   negative_evals=False,&#xA;                   ne_qfts=[None,None])&#xA;&#xA;### Generating circuit&#xA;eigs_circ = eigs_qpe.construct_circuit(mode=&quot;circuit&quot;)&#xA;eigs_circ.draw(output=&quot;mpl&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;2 - Then I want to prepend the following initial state to the previous circuit&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vector = np.array([0,1])&#xA;initial_state = Custom(1,state_vector=vector)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thus getting a QPE computed on the &lt;code&gt;initial_state&lt;/code&gt;. Is it possible to do this, for example by accessing &lt;code&gt;eigs_circ.data&lt;/code&gt; and prepending the proper gates that generate the &lt;code&gt;initial_state&lt;/code&gt;? &lt;/p&gt;&#xA;" OwnerUserId="9877" LastActivityDate="2020-02-10T09:49:20.400" Title="Prepending initial state to a quantum circuit in Qiskit" Tags="&lt;qiskit&gt;&lt;phase-estimation&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9767" PostTypeId="1" AcceptedAnswerId="9773" CreationDate="2020-02-07T08:01:44.757" Score="3" ViewCount="397" Body="&lt;p&gt;I'm studying Shor's algorithm.&#xA;This diagram shows a calculation of &lt;span class=&quot;math-container&quot;&gt;$4^x\mod21$&lt;/span&gt;.&#xA;I don't understand how this expresses &lt;span class=&quot;math-container&quot;&gt;$4^x \mod21$&lt;/span&gt;.&#xA;Could you explain this? For example, by showing another calculation such as &lt;span class=&quot;math-container&quot;&gt;$11^x\mod15$&lt;/span&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rZtbU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rZtbU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what does this result mean?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cYqJ0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cYqJ0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9990" LastEditorUserId="9006" LastEditDate="2020-02-07T10:05:27.900" LastActivityDate="2020-02-07T14:12:27.850" Title="Implementing QFT for Shor's Algorithm?" Tags="&lt;circuit-construction&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9768" PostTypeId="2" ParentId="9766" CreationDate="2020-02-07T08:28:59.273" Score="1" Body="&lt;p&gt;If you have the circuit, you can get the registers the circuit acts on from &lt;code&gt;eigs_circ.qregs&lt;/code&gt;. You can then create another circuit using the returned quantum register, add an instruction to it (&lt;code&gt;initialize&lt;/code&gt;) and then add these two circuits together. Your final code should look something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qregs = eigs_circ.qregs         # NB this is a list&#xA;qc = QuantumCircuit(*qregs)&#xA;qc.initialize([0,1], 0)         # You need to specify the qubits to act on&#xA;overall_circ = qc + eigs_circ&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The method for appending two circuits is &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/acb62a48755c34420d71e5680cdc237e2bd3d68b/qiskit/circuit/quantumcircuit.py#L270&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2020-02-10T09:49:20.400" LastActivityDate="2020-02-10T09:49:20.400" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9769" PostTypeId="1" AcceptedAnswerId="9771" CreationDate="2020-02-07T08:57:07.497" Score="6" ViewCount="666" Body="&lt;p&gt;I'm studying Shor's Algorithm.&#xA;In the book, author explains QFT can be replaced by Hadamard gates?&#xA;Why this process is possible??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jYfrg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jYfrg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you everybody. This is QPE. I attach part of book!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jraoF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jraoF.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9990" LastEditorUserId="55" LastEditDate="2020-08-01T11:26:16.350" LastActivityDate="2020-08-01T11:26:16.350" Title="Why can the QFT be replaced by Hadamard gates?" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9770" PostTypeId="2" ParentId="9769" CreationDate="2020-02-07T10:45:24.513" Score="3" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates do not replace a Quantum Fourier Transform. The Quantum Phase Estimation algorithm is &lt;strong&gt;defined&lt;/strong&gt; as shown in the picture you linked in your question:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Hadamard gates on all the &quot;ancillary&quot; qubits&lt;/li&gt;&#xA;&lt;li&gt;Controlled unitary matrices (controlled circuits)&lt;/li&gt;&#xA;&lt;li&gt;Inverse QFT.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Having an inverse QFT at the end of the circuit does not necessarily mean that there should be a QFT beforehand. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page&lt;/a&gt; for example) to convince yourself that the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates at the beginning do not replace a QFT. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also try to replace the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9771/1386&quot;&gt;@DaftWullie's answer&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2020-02-07T12:58:38.460" LastActivityDate="2020-02-07T12:58:38.460" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9771" PostTypeId="2" ParentId="9769" CreationDate="2020-02-07T11:13:44.473" Score="12" Body="&lt;p&gt;While the QFT and Hadamard transforms are different, their action on the input state &lt;span class=&quot;math-container&quot;&gt;$|00\ldots 0\rangle$&lt;/span&gt; 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.&#xA;Hadamard Transform:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&#xA;Fourier Transform:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-07T11:13:44.473" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9772" PostTypeId="1" CreationDate="2020-02-07T13:24:01.760" Score="2" ViewCount="39" Body="&lt;p&gt;Consider the simple state teleportation gadget below. Measuring the entangled state after the CZ gate in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; eigenbasis (equivalent to first applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and then measuring in computational basis) teleports the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to the second register up to a &lt;span class=&quot;math-container&quot;&gt;$X^m H$&lt;/span&gt;.  &lt;a href=&quot;https://i.stack.imgur.com/ZHfg6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZHfg6.png&quot; alt=&quot;teleportation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, what if we were to consider a measurement of non-orthogonal operators (for simplicity say a POVM given by &lt;span class=&quot;math-container&quot;&gt;$E_1, E_2, E_3$&lt;/span&gt;) instead of measuring in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Could someone explain why this is the  case?&lt;/p&gt;&#xA;&lt;p&gt;(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 &lt;span class=&quot;math-container&quot;&gt;$E=|\alpha\rangle\langle\alpha|$&lt;/span&gt; but the coherent states &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; are not orthogonal and form an overcomplete basis. However, I believe this should boil down to the same question)&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-02-07T13:24:01.760" Title="Teleportation and non-orthogonal measurement operators" Tags="&lt;measurement&gt;&lt;teleportation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9773" PostTypeId="2" ParentId="9767" CreationDate="2020-02-07T13:45:08.437" Score="4" Body="&lt;p&gt;It seems that you are trying to make sense of compiled circuits from &lt;a href=&quot;https://arxiv.org/abs/1310.6446v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.  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.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;WHY?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The circuit in your question is a &quot;compiled&quot; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the notation convention &lt;span class=&quot;math-container&quot;&gt;$f_{a,N}(x)=a^x \, (\text{mod} \, N)$&lt;/span&gt;, the authors create a truth table (Table V) that implements the modular exponentiation of &lt;span class=&quot;math-container&quot;&gt;$f_{4,21}(x)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert x \rangle \vert 0 \rangle \rightarrow \vert x \rangle \vert \; 4^x \, (\text{mod} \, 21) \rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The input value, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, corresponds to the left side of both Table V and Table VI, which in turn corresponds to the value over the three input qubits (&lt;span class=&quot;math-container&quot;&gt;$q1_0$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$q1_2$&lt;/span&gt; in your circuit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The value of the function &lt;span class=&quot;math-container&quot;&gt;$f_{4,21}(x)$&lt;/span&gt; corresponds the right side of Table V, which in turn corresponds to the five output qubits of the circuit in Figure 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The two output qubits in your circuit (&lt;span class=&quot;math-container&quot;&gt;$q1_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q1_4$&lt;/span&gt;) correspond to &lt;span class=&quot;math-container&quot;&gt;$\text{log}_4 (f_{4,21}(x))$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the input value over &lt;span class=&quot;math-container&quot;&gt;$q1_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q1_1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$q1_2$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These values are tabulated in the right side of Table VI. This is a second level of compilation, again made possible by &lt;em&gt;a priori&lt;/em&gt; knowledge of the solution.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;What Does this Result Mean?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is explained in detail in Section V.  The end result is Table XI, which tabulates the probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$\vert k \rangle$&lt;/span&gt; (over your &lt;span class=&quot;math-container&quot;&gt;$q1_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q1_1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$q1_2$&lt;/span&gt;) in the columns relative to a postulated period of &lt;span class=&quot;math-container&quot;&gt;$f_{4,21}(x)$&lt;/span&gt; in the rows.  Note that the authors do not use binary in the column headers, so, &lt;em&gt;e.g.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\vert 5 \rangle \equiv \vert 101 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From Table III we know &lt;em&gt;a priori&lt;/em&gt; that the period of &lt;span class=&quot;math-container&quot;&gt;$f_{4,21}(x)$&lt;/span&gt; is 3.  So as expected&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Your histogram corresponds to row 3 of Table XI.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you increase your shots the numbers should align even more closely.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Can I Show a Compiled Circuit for &lt;span class=&quot;math-container&quot;&gt;$11^x \, (\text{mod} \, 15)$&lt;/span&gt;?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-02-07T14:12:27.850" LastActivityDate="2020-02-07T14:12:27.850" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9774" PostTypeId="1" AcceptedAnswerId="9792" CreationDate="2020-02-07T14:43:51.777" Score="2" ViewCount="157" Body="&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is for what purposes the ZX calculus was developed?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-02-07T14:45:02.443" LastActivityDate="2020-02-11T21:26:08.080" Title="What are some applications of the ZX calculus?" Tags="&lt;zx-calculus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9775" PostTypeId="1" AcceptedAnswerId="9778" CreationDate="2020-02-07T14:58:19.823" Score="1" ViewCount="735" Body="&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="9006" LastEditDate="2020-02-13T05:48:02.807" LastActivityDate="2020-02-13T05:48:02.807" Title="Swap test to calculate inner product with qiskit for multi-qubit states" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9776" PostTypeId="1" CreationDate="2020-02-07T16:46:39.313" Score="1" ViewCount="233" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance, when measuring a single qubit in even superposition (the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;, the ideal result would be that you measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt;. However, when running on a simulator, you might naturally get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$0.501$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$0.499$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GVAZZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GVAZZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, knowing that the theoretical probability of obtaining state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; when measuring a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\psi\rangle$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="7761" LastActivityDate="2020-02-09T08:24:29.160" Title="Is there a function that gives the ideal probability distribution of a measurement in Qiskit?" Tags="&lt;qiskit&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9777" PostTypeId="2" ParentId="9776" CreationDate="2020-02-07T16:56:56.523" Score="1" Body="&lt;p&gt;You can use the &lt;code&gt;statevector_simulator&lt;/code&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2)&#xA;qc.x(0)&#xA;&#xA;sim = Aer.get_backend('statevector_simulator')&#xA;&#xA;job = execute(qc, sim)&#xA;&#xA;print(job.result().get_statevector(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;will print out &#xA;&lt;code&gt;[0.+0.j 1.+0.j 0.+0.j 0.+0.j]&lt;/code&gt;. Each element refers to a possible 2-qubit state. The 0th element would refer to state &lt;code&gt;00&lt;/code&gt;, the 1st refers to &lt;code&gt;01&lt;/code&gt;, the 2nd to &lt;code&gt;10&lt;/code&gt;, and the 3rd to &lt;code&gt;11&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-02-07T16:56:56.523" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9778" PostTypeId="2" ParentId="9775" CreationDate="2020-02-07T17:01:26.567" Score="5" Body="&lt;p&gt;It is possible, but when calling &lt;code&gt;cswap&lt;/code&gt;, all of the arguments need to be of the same size. In your example, assuming &lt;code&gt;ancilla[0]&lt;/code&gt; is 1 qubit, you would need &lt;code&gt;qb1&lt;/code&gt; and &lt;code&gt;qb2&lt;/code&gt; to also be 1 qubit. If &lt;code&gt;qb1&lt;/code&gt; and &lt;code&gt;qb2&lt;/code&gt; are QuantumRegisters of size &gt; 1, then you would need multiple &lt;code&gt;cswap&lt;/code&gt; calls. For example, if &lt;code&gt;qb1&lt;/code&gt; and &lt;code&gt;qb2&lt;/code&gt; are of size 2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.cswap(ancilla[0], qb1[0], qb2[0])&#xA;circuit.cswap(ancilla[0], qb1[1], qb2[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This way the &lt;code&gt;ancilla[0]&lt;/code&gt; qubit is still the control for both calls, and all of the arguments in both calls are of the same size. &lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-02-07T17:01:26.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9779" PostTypeId="1" CreationDate="2020-02-07T18:04:30.973" Score="2" ViewCount="92" Body="&lt;p&gt;I'm checking this article of R. Somma about quantum simulations&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0512209&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0512209&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the common commutation relations for creationd and annihilation operators, given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[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\\&#xA;	= \sqrt{n_i(n_j+1)}|n_1\dots n_i-1\ n_j+1\dots n_N\rangle\\&#xA;	-\sqrt{n_i(n_j+1)}|n_1\dots n_i-1\ n_j+1\dots n_N\rangle=0$$&lt;/span&gt;&#xA;My question is about equation (2.57) on page 32. They restrict the Fock space to contain at most &lt;span class=&quot;math-container&quot;&gt;$N_P$&lt;/span&gt; bosons per site, and then they affirm that the following relations hold:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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]$$&lt;/span&gt;&#xA;Where does that come from?&#xA;I started considering the general Fock state &lt;span class=&quot;math-container&quot;&gt;$|n_1 n_2\dots n_N\rangle=\prod_{k=1}^{N}\frac{1}{\sqrt{n_k!}}{b_k^\dagger}^{n_k}|0\rangle$&lt;/span&gt; and trying to compute the commutator expression but obtained nothing useful.&#xA;Can anyone help me?&lt;/p&gt;&#xA;" OwnerUserId="9716" LastEditorUserId="9716" LastEditDate="2020-02-10T11:29:29.493" LastActivityDate="2020-02-10T11:29:29.493" Title="Commutation of bosonic operators on finite Hilbert space" Tags="&lt;simulation&gt;&lt;boson-sampling&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9780" PostTypeId="1" CreationDate="2020-02-07T18:38:19.103" Score="12" ViewCount="773" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9995" LastEditorUserId="9006" LastEditDate="2020-02-07T22:46:03.520" LastActivityDate="2020-02-07T22:46:03.520" Title="What is the opposite of measurement, in a quantum circuit?" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9781" PostTypeId="2" ParentId="9780" CreationDate="2020-02-07T18:56:44.917" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-02-07T18:56:44.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9782" PostTypeId="2" ParentId="9780" CreationDate="2020-02-07T18:57:34.033" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reconstruction of probability distribution is done with quantum tomography.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Arbitrary state can be prepared with method in this paper: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-07T22:45:23.787" LastActivityDate="2020-02-07T22:45:23.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9783" PostTypeId="2" ParentId="9780" CreationDate="2020-02-07T20:01:21.660" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9967" LastActivityDate="2020-02-07T20:01:21.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9784" PostTypeId="2" ParentId="9780" CreationDate="2020-02-07T20:28:36.953" Score="13" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="9006" LastEditDate="2020-02-07T22:44:14.593" LastActivityDate="2020-02-07T22:44:14.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9785" PostTypeId="1" CreationDate="2020-02-07T20:32:30.987" Score="2" ViewCount="330" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qubEj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qubEj.png&quot; alt=&quot;Circuit1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above figure I want to delete q0_0 and q0_1. I want state vectors of only q1_0 and q1_1.&lt;/p&gt;&#xA;" OwnerUserId="9997" LastEditorUserId="9997" LastEditDate="2020-02-07T20:48:02.803" LastActivityDate="2020-02-07T21:42:10.300" Title="How do we discard or delete or resuse a qubit at the end, on Qiskit?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9786" PostTypeId="1" AcceptedAnswerId="13462" CreationDate="2020-02-07T21:33:44.053" Score="5" ViewCount="184" Body="&lt;p&gt;The complexity class &lt;span class=&quot;math-container&quot;&gt;$\mathrm{MIP^*}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{RE}$&lt;/span&gt; includes recursively enumerable problems, the Halting Problem being a complete problem therein.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A recent breakthrough of Ji, Natarajan, Vidick, Wright, and Yuen in quantum complexity theory is &lt;a href=&quot;https://arxiv.org/abs/2001.04383&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{MIP^*=RE}$&lt;/span&gt;&lt;/a&gt;.  This is, in a way, a quantum analog of the classical result that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{MIP=NEXP}$&lt;/span&gt;, but shows that shared quantum entanglement in a potentially infinite-dimensional Hilbert space is much &lt;em&gt;much&lt;/em&gt; more powerful than that allowed in the (unentangled) classical setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get my head around the complexity class &lt;span class=&quot;math-container&quot;&gt;$\mathrm{MIP^*}$&lt;/span&gt; and that of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{RE}$&lt;/span&gt;.  Thanks to Yuen's &lt;a href=&quot;https://www.youtube.com/watch?v=6daiUh-qe9w&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; at the IAS, I vaguely understand Tsirelson's problem in relation to CHSH games, etc., and how it could relate to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{MIP^*}$&lt;/span&gt;.  Also I was able to follow a lot of Slofstra's &lt;a href=&quot;https://www.youtube.com/watch?v=RR_7Y00klK0&amp;amp;t=1800s&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt;, where he mentions that Tsirelson's problem is related to finding magic squares in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2$&lt;/span&gt;, and emphasizes the relation to solving a specific word problem for finitely presented groups.  Famously such word problems can be algorithmically unsolvable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Connes_embedding_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, &quot;Connes' Embedding Problem asks whether every type II1 factor on a separable Hilbert space can be embedded into some &lt;span class=&quot;math-container&quot;&gt;$R^\omega$&lt;/span&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is the CEP itself akin to an &lt;em&gt;algorithmic&lt;/em&gt; problem as in the word problem for a finitely generated groups?  Or is it much more subtle than that?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Basically I'm looking for a statement of Connes' embedding problem that is a bit more accessible than the Wikipedia article?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-02-10T16:25:32.833" LastActivityDate="2020-08-25T01:52:39.600" Title="Is Connes' Embedding Problem akin the word problem for finitely presented groups?" Tags="&lt;mathematics&gt;&lt;complexity-theory&gt;&lt;games&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9787" PostTypeId="2" ParentId="9785" CreationDate="2020-02-07T21:42:10.300" Score="2" Body="&lt;p&gt;You can use Qiskit's &lt;code&gt;partial_trace&lt;/code&gt; 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):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;from qiskit.quantum_info.states import Statevector, partial_trace&#xA;from qiskit.visualization import plot_state_city&#xA;&#xA;q0 = QuantumRegister(2, 'q0')&#xA;q1 = QuantumRegister(2, 'q1')&#xA;&#xA;circuit = QuantumCircuit(q0, q1)&#xA;circuit.h(q1[1])&#xA;circuit.cswap(q1[1], q1[0], q0[1])&#xA;circuit.cx(q1[0], q0[0])&#xA;circuit.cx(q0[1], q0[0])&#xA;circuit.ccx(q0[0], q1[1], q0[1])&#xA;&#xA;zero_state = Statevector.from_label('0000')&#xA;final_state = zero_state.evolve(circuit)&#xA;&#xA;reduced_state = partial_trace(final_state, [0, 1])&#xA;&#xA;plot_state_city(reduced_state.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Cy7hR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cy7hR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-02-07T21:42:10.300" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9788" PostTypeId="2" ParentId="9775" CreationDate="2020-02-07T22:36:52.367" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vy6wN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vy6wN.png&quot; alt=&quot;swap test using cswap&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Gives the same result statistics as this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yf4Lb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yf4Lb.png&quot; alt=&quot;swap test using bell measurements&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But the latter is much less demanding on the quantum hardware, because the three qubit gates can be done in the classical postprocessing.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-02-07T22:36:52.367" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9789" PostTypeId="1" AcceptedAnswerId="9790" CreationDate="2020-02-08T08:23:33.533" Score="4" ViewCount="139" Body="&lt;p&gt;I'm studying Shor's algorithm.&#xA;but I see from the beginning this empty circle.&#xA;what this circle means??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5zFQB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5zFQB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9990" LastEditorUserId="55" LastEditDate="2020-02-10T23:19:57.260" LastActivityDate="2020-02-10T23:19:57.260" Title="What do empty white circles mean in a quantum circuit?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9790" PostTypeId="2" ParentId="9789" CreationDate="2020-02-08T08:57:32.480" Score="5" Body="&lt;p&gt;It is a &quot;negative&quot; control. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert x_3\rangle = \vert 0 \rangle$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;the first ancilla qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;A &quot;normal&quot; control (i.e. not an empty circle) would change the first condition to &lt;span class=&quot;math-container&quot;&gt;$\vert x_3 \rangle = \vert 1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2020-02-08T08:57:32.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9791" PostTypeId="2" ParentId="9779" CreationDate="2020-02-08T11:48:20.693" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-02-08T11:48:20.693" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9792" PostTypeId="2" ParentId="9774" CreationDate="2020-02-08T14:27:16.300" Score="7" Body="&lt;p&gt;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 &lt;em&gt;low&lt;/em&gt; level, albeit without digging into the actual physics. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What it was designed for is hinted at in your observations, and by the name of the ZX calculus itself.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;It can describe individual quantum gates: so it is a notation for circuits (and other quantum procedures &amp;mdash; one of the things the ZX calculus was explicitly designed for was to analyse measurement based quantum computing [&lt;a href=&quot;https://arxiv.org/abs/0906.4725&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0906.4725&lt;/a&gt;]; and Dom Horsman and I showed that it has a very close connection to surface code lattice surgery [&lt;a href=&quot;https://arxiv.org/abs/1704.08670&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1704.08670&lt;/a&gt;]).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is a &lt;strong&gt;calculus&lt;/strong&gt; : 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 &lt;em&gt;limited&lt;/em&gt; extent with ordinary circuit diagrams; for the ZX calculus you can in principle do this entirely with diagrams.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There are people who are working on higher-level ZX descriptions of procedures on multiple qubits &amp;mdash; &lt;em&gt;eg.&lt;/em&gt; [&lt;a href=&quot;https://arxiv.org/abs/1905.00041&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1905.00041&lt;/a&gt;] &amp;mdash; 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. &lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2020-02-11T21:26:08.080" LastActivityDate="2020-02-11T21:26:08.080" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9793" PostTypeId="1" AcceptedAnswerId="9794" CreationDate="2020-02-08T21:58:29.420" Score="5" ViewCount="237" Body="&lt;p&gt;A Hilbert Space has this property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle cf,g\rangle=c\langle f,g\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; are the vectors in the Hilbert Space and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is a complex number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Dirac Notation,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle cf|g\rangle = c^*\langle f\vert g\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused about why the Dirac notation takes complex conjugate on &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. I know &lt;span class=&quot;math-container&quot;&gt;$\langle f \vert$&lt;/span&gt; in the Dirac notation is in the Dual Hilbert space. Is this the reason? Do I need to define a Hilbert Space as  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle cf,g\rangle=c\langle f,g\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I feel it is equivalent if I define as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle cf,g\rangle = c^*\langle f,g\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right? Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="9676" LastEditorUserId="55" LastEditDate="2020-02-10T23:20:54.530" LastActivityDate="2020-02-10T23:20:54.530" Title="In Dirac notation, why do we have $\langle cf|g\rangle = c^*\langle f\vert g\rangle$?" Tags="&lt;mathematics&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9794" PostTypeId="2" ParentId="9793" CreationDate="2020-02-08T23:01:07.727" Score="5" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle f, \, cg\rangle = c^\ast \langle f, \, g \rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$c_1, \, c_2 \in \mathbb{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f, \, g \in \mathcal{H}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\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.$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-02-09T01:06:41.053" LastActivityDate="2020-02-09T01:06:41.053" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9795" PostTypeId="2" ParentId="9758" CreationDate="2020-02-09T07:57:57.410" Score="1" Body="&lt;p&gt;Qiskit simulator supports advanced features like noise simulation. You can explore them by taking a look at the notebooks in &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/tree/master/qiskit/advanced/aer&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-iqx-tutorials/tree/master/qiskit/advanced/aer&lt;/a&gt;. In addition it is written in multi-threaded C++ and is optimized for high performance.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-02-09T07:57:57.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9796" PostTypeId="2" ParentId="9776" CreationDate="2020-02-09T08:24:29.160" Score="1" Body="&lt;p&gt;You can use the probabilities snapshot. Enter a snapshot as a circuit instruction:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.snapshot_probabilities(label, qubits)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then after execution get the probabilities from the result, see the documentation of &lt;code&gt;Result.data&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-02-09T08:24:29.160" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9797" PostTypeId="1" AcceptedAnswerId="9812" CreationDate="2020-02-09T08:35:49.143" Score="1" ViewCount="149" Body="&lt;p&gt;when I measure the shot = 1024&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WmVHR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WmVHR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when I measure the shot = 8192&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v7Vef.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v7Vef.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to derive result value 011(=3)&#xA;However, I know if measure the more shots, increase the accuracy.&#xA;why this result derive???&#xA;why increase inaccuracy??&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sorry to late reply your request. I attach my code in qiskit!!&#xA;Thank you everybody!!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TZ0Zt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TZ0Zt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I want to gain output 011(=3)&lt;/p&gt;&#xA;" OwnerUserId="9990" LastEditorUserId="9006" LastEditDate="2020-02-11T05:30:57.763" LastActivityDate="2020-02-11T05:30:57.763" Title="When increase the shot, why the result is different?" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9798" PostTypeId="1" CreationDate="2020-02-09T14:36:30.403" Score="3" ViewCount="919" Body="&lt;p&gt;This has been bothering me for a while.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or am I missing something? I'm not very familiar with encryption and quantum algorithms, so please correct me if I'm wrong.&lt;/p&gt;&#xA;" OwnerUserId="10014" LastActivityDate="2020-07-09T15:40:29.107" Title="Is it possible to mine bitcoin by implementing Grover's algorithm on a quantum computer" Tags="&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9799" PostTypeId="1" CreationDate="2020-02-09T15:31:32.850" Score="1" ViewCount="127" Body="&lt;p&gt;I am referring to Equation (8.89) to (8.92) in Chapter 8 of &quot;Quantum Computing and Information 10th Anniversary Edition&quot; 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 &quot;...it is not difficult to check...&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have the state of a single qubit in Bloch representation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac{I+\vec{r}\cdot\vec{\sigma}}{2}\hspace{5em}(8.87)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The affine map &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is given as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vec{r}\longrightarrow\vec{r'}=M\space\vec{r}+\vec{c}\hspace{5em}(8.89)$$&lt;/span&gt;   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operators that generate the operator-sum-representation for &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; are given in the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_{i}=\alpha_{i}I+\sum^{3}_{k=1}a_{ik}\sigma_{k}\hspace{5em}(8.90)$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The text went on to say &lt;strong&gt;&lt;em&gt;it is not difficult to check&lt;/em&gt;&lt;/strong&gt; that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c_k=2i\sum_l\sum_{jp}\epsilon_{jkp}a_{lj}a^*_{lp}\hspace{5em}\text{(8.91) and (8.92)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and they claim &lt;span class=&quot;math-container&quot;&gt;$c_k$&lt;/span&gt; was written as such because &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}E^{\dagger}_{i}E_{i}=I$&lt;/span&gt; is used to simplify it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;So I tried to see how I can somehow arrive at (8.91) and (8.92) by doing these:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon(\rho)=\frac{I+\sum_{l}E^{\dagger}_{l}\vec{r}\cdot\vec{\sigma}E_{l}}{2}=\frac{I+(M\space\vec{r}+\vec{c})\cdot\vec{\sigma} }{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second term in the above equality is what I tried to work out,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{I+\sum_{l}E^{\dagger}_{l}\vec{r}\cdot\vec{\sigma}E_{l}}{2}=\frac{1}{2}\bigg[I+\sum_{l}\big(\alpha^*_lI+\sum^3_{j=1}a^*_{lj}\sigma_j\big)\big(\sum^3_{k=1}r_k\sigma_k\big)\big(\alpha_lI+\sum^3_{p=1}a_{lp}\sigma_p\big)  \bigg]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$r_k$&lt;/span&gt; and we know &lt;span class=&quot;math-container&quot;&gt;$c_{k}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastActivityDate="2020-02-09T15:31:32.850" Title="Affine Map of the Bloch sphere" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;&lt;kraus-representation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9800" PostTypeId="1" CreationDate="2020-02-09T15:55:31.197" Score="4" ViewCount="211" Body="&lt;p&gt;We know if we don't use auxiliary, the construction of Toffoli gate will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cqTzQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cqTzQ.png&quot; alt=&quot;3 qubit construction of Toffoli&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?)&lt;/p&gt;&#xA;" OwnerUserId="10015" LastActivityDate="2020-02-17T16:45:43.917" Title="If an auxiliary qubit is allowed, how to construct toffoli gate in easier way?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9802" PostTypeId="1" CreationDate="2020-02-09T17:54:25.053" Score="1" ViewCount="32" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\left|#1\right&amp;gt;}$&lt;/span&gt;&#xA;In the original HHL paper, in step 4 of the &lt;span class=&quot;math-container&quot;&gt;$U_{\text{invert}}$&lt;/span&gt; subroutine (Appendix A.1), it says to adjoin a three-dimensional register S in the state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10018" LastActivityDate="2020-02-09T17:54:25.053" Title="How to prepare the three-dimensional register S in HHL?" Tags="&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9805" PostTypeId="1" CreationDate="2020-02-10T01:15:30.930" Score="0" ViewCount="144" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On another note, I am also curious if the Qiskit ML datasets are usable for classical machine learning, for example, using TensorFlow.&lt;/p&gt;&#xA;" OwnerUserId="10020" LastEditorUserId="5955" LastEditDate="2020-02-10T11:31:08.313" LastActivityDate="2021-03-06T15:08:25.993" Title="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?" Tags="&lt;qiskit&gt;&lt;machine-learning&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9806" PostTypeId="1" CreationDate="2020-02-10T01:46:07.230" Score="1" ViewCount="50" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$a'_k$&lt;/span&gt; be Bob's measurement result of qubit &lt;span class=&quot;math-container&quot;&gt;$ &#xA; {\Psi_{a_kb_k}}$&lt;/span&gt;, assuming a noiseless channel with no eavesdropping. Show that when &lt;span class=&quot;math-container&quot;&gt;$b'_k\neq b_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a'_k$&lt;/span&gt; is random and completely uncorrelated with &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;. But when &lt;span class=&quot;math-container&quot;&gt;$b'_k=b_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a'_k=a_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$ab=00$&lt;/span&gt;, and Bob measures it in state &lt;span class=&quot;math-container&quot;&gt;$a'b'=01$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$a=a'$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$b=b'$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="10021" LastEditorUserId="55" LastEditDate="2020-10-28T09:26:42.627" LastActivityDate="2020-10-28T09:26:42.627" Title="Show that if $b'$ and $b$ are uncorrelated, then $a'$ and $a$ are uncorrelated" Tags="&lt;cryptography&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9807" PostTypeId="1" AcceptedAnswerId="9808" CreationDate="2020-02-10T04:04:10.553" Score="1" ViewCount="63" Body="&lt;p&gt;Given a tensored state of qbits such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{3}}|0\rangle_1|1\rangle_2 + \sqrt{\frac{2}{3}}|1\rangle_1|0\rangle_2&#xA;$$&lt;/span&gt;&#xA;or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle_1|+\rangle_2 + |+\rangle_1|-\rangle_2)&#xA;$$&lt;/span&gt;&#xA;Then how do you calculate the probabilities of getting &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if you measure qbit &lt;strong&gt;&lt;em&gt;one&lt;/em&gt;&lt;/strong&gt; in the above states?&lt;/p&gt;&#xA;" OwnerUserId="10023" LastActivityDate="2020-02-10T07:37:57.307" Title="How to find measurement probabilities of a single qbit in a tensored state" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9808" PostTypeId="2" ParentId="9807" CreationDate="2020-02-10T05:32:39.667" Score="3" Body="&lt;p&gt;Only consider first qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First case:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 3}|0\rangle _1|1\rangle_2 + \sqrt{\frac{2}{3}}|1\rangle_1|0\rangle_2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle_1) = \frac{1}{3}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(|1\rangle_1) = \frac{2}{3}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second case:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, probabilities are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle_1|+\rangle_2) = \frac{1}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle_1|-\rangle_2) = P(|1\rangle_1|+\rangle_2) = \frac{1}{4}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the first qubit is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} + \frac{1}{4} = \frac{3}{4}$&lt;/span&gt; and probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9563" LastEditorUserId="9006" LastEditDate="2020-02-10T07:37:57.307" LastActivityDate="2020-02-10T07:37:57.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9809" PostTypeId="2" ParentId="9695" CreationDate="2020-02-10T05:51:13.860" Score="5" Body="&lt;p&gt;This is a example for loading QASM, executing and displaying the result.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;&#xA;qasm_str = &quot;&quot;&quot;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q[2];&#xA;creg c[2];&#xA;h q[0];&#xA;cx q[0],q[1];&#xA;measure q -&amp;gt; c;&#xA;&quot;&quot;&quot;&#xA;&#xA;# From str.&#xA;qc = QuantumCircuit.from_qasm_str(qasm_str)&#xA;# If you want to read from file, use instead&#xA;# qc = QuantumCircuit.from_qasm_file(&quot;/path/to/file.qasm&quot;)&#xA;&#xA;# You can choose other backend also.&#xA;backend = Aer.get_backend(&quot;qasm_simulator&quot;)&#xA;&#xA;# Execute the circuit and show the result.&#xA;job = execute(qc, backend)&#xA;result = job.result()&#xA;print(result.get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9563" LastActivityDate="2020-02-10T05:51:13.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9810" PostTypeId="2" ParentId="9798" CreationDate="2020-02-10T06:19:08.643" Score="0" Body="&lt;p&gt;Today's quantum computer has too much calculation error.&#xA;To calculate hash, quantum error correction is required.&#xA;It uses a large number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The figure is sited from: Quantum Computing Progress and Prospects (2019) pp.163&#xA;&lt;a href=&quot;https://www.nap.edu/catalog/25196/quantum-computing-progress-and-prospects&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nap.edu/catalog/25196/quantum-computing-progress-and-prospects&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8OkVk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8OkVk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9563" LastActivityDate="2020-02-10T06:19:08.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9811" PostTypeId="2" ParentId="9798" CreationDate="2020-02-10T07:34:55.580" Score="0" Body="&lt;p&gt;Yes, of course. But there are some interesting new challenges arising, if many miners used quantum computers to mine Bitcoin: &lt;a href=&quot;https://arxiv.org/abs/1804.08118&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.08118&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1771" LastActivityDate="2020-02-10T07:34:55.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9812" PostTypeId="2" ParentId="9797" CreationDate="2020-02-10T10:03:23.510" Score="6" Body="&lt;p&gt;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.&lt;a href=&quot;https://i.stack.imgur.com/g34De.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g34De.png&quot; alt=&quot;shots&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We see that as the number of shots is increased, the spread of the distributions decreases, following a &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{\rm{shots}}$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$\sim 0.17$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="332" LastEditDate="2020-02-10T23:27:15.537" LastActivityDate="2020-02-10T23:27:15.537" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9813" PostTypeId="1" AcceptedAnswerId="9814" CreationDate="2020-02-10T10:04:34.967" Score="1" ViewCount="469" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I execute the circuits without noise at all?&lt;/p&gt;&#xA;" OwnerUserId="6071" LastActivityDate="2020-02-10T11:15:18.950" Title="How to run the Qiskit Aer simulator without noise?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9814" PostTypeId="2" ParentId="9813" CreationDate="2020-02-10T11:15:18.950" Score="7" Body="&lt;p&gt;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: &lt;a href=&quot;https://www.qiskit.org/aer&quot; rel=&quot;noreferrer&quot;&gt;https://www.qiskit.org/aer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-02-10T11:15:18.950" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9815" PostTypeId="2" ParentId="9805" CreationDate="2020-02-10T11:30:47.603" Score="1" Body="&lt;p&gt;Qiskit uses the datasets provided by &lt;code&gt;sklearn&lt;/code&gt; and all the ones built into Qiskit are available &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/tree/master/qiskit/ml/datasets&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. You could follow how these methods work to load your own dataset if you wanted to.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to use the return from the call to the dataset directly for classical machine learning methods.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-10T11:30:47.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9817" PostTypeId="2" ParentId="9806" CreationDate="2020-02-10T12:17:30.053" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Psi_{a_k,b_k}$&lt;/span&gt; is the BB84 qubit in basis &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$b_k = 0$&lt;/span&gt;, and in basis &lt;span class=&quot;math-container&quot;&gt;$\{+,-\}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$b_k = 1$&lt;/span&gt;, whose &quot;value&quot; bit is &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Psi_{a_k,b_k} = H^{b_k}X^{a_k}|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, Bob will measure in basis &lt;span class=&quot;math-container&quot;&gt;$b'_k$&lt;/span&gt; (with the same notation as above), and get the result &lt;span class=&quot;math-container&quot;&gt;$a'_k$&lt;/span&gt;. And you want to prove that:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;if &lt;span class=&quot;math-container&quot;&gt;$b'_k = b_k$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$a'_k = a_k$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;if &lt;span class=&quot;math-container&quot;&gt;$b'_k \neq b_k$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$a'_k$&lt;/span&gt; is not correlated with &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\forall a_k, Pr[a'_k = 0 | a_k] = Pr[a'_k = 1 | a_k] = \frac{1}{2}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;First direction&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Performing a measurement in the &lt;span class=&quot;math-container&quot;&gt;$\{+,-\}$&lt;/span&gt; basis consists of a Hadamard gate, and a measurement in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; basis (that we will denote by &lt;span class=&quot;math-container&quot;&gt;$M_Z$&lt;/span&gt;). Basically measuring in the basis &lt;span class=&quot;math-container&quot;&gt;$b'_k$&lt;/span&gt; is like performing the circuit &lt;span class=&quot;math-container&quot;&gt;$M_Z H^{b'_k}$&lt;/span&gt;. So you just need to apply this on your input qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$a'_k = M_Z H^{b'_k} H^{b_k}X^{a_k}|0\rangle$$&lt;/span&gt;&#xA;but &lt;span class=&quot;math-container&quot;&gt;$b_k = b'_k$&lt;/span&gt; so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&#xA;but &lt;span class=&quot;math-container&quot;&gt;$HH$&lt;/span&gt; is identity, so &#xA;&lt;span class=&quot;math-container&quot;&gt;$$a'_k = M_Z X^{a_k}|0\rangle$$&lt;/span&gt;&#xA;And then it's easy to see that &lt;span class=&quot;math-container&quot;&gt;$a'_k = a_k$&lt;/span&gt; (if you are not yet convinced, just try to compute this value for the two possible values of &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Second direction&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start again from equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a'_k = M_Z H^{b'_k} H^{b_k}X^{a_k}|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;derived above. Then, if &lt;span class=&quot;math-container&quot;&gt;$b'_k \neq b_k$&lt;/span&gt;, you see that &lt;span class=&quot;math-container&quot;&gt;$H^{b'_k} H^{b_k} = H$&lt;/span&gt; (if you are not convinced, then just try to write it for the two values of &lt;span class=&quot;math-container&quot;&gt;$b_k$&lt;/span&gt;). so the equation becomes&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a'_k = M_Z H X^{a_k}|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So then, we will have two cases: if &lt;span class=&quot;math-container&quot;&gt;$a_k=0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$a'_k = M_Z |+\rangle$&lt;/span&gt; and if &lt;span class=&quot;math-container&quot;&gt;$a_k=1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$a'_k = M_Z |-\rangle$&lt;/span&gt;. But measuring a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; (or a &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;) in the computational basis always gives you a uniform random bit. Indeed, to get the probability of obtaining a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; as outcome when measuring a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, you need to compute&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\langle 0 | | + \rangle|^2 = |\langle 0 |(\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle))|^2$$&lt;/span&gt;&#xA;So&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\langle 0 | | + \rangle|^2 = |(\frac{1}{\sqrt{2}}(\langle 0 |0\rangle + \langle 0 |1\rangle))|^2$$&lt;/span&gt;&#xA;i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\langle 0 | | + \rangle|^2 = |(\frac{1}{\sqrt{2}}(1 + 0))|^2$$&lt;/span&gt;&#xA;i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\langle 0 | | + \rangle|^2 = \frac{1}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$Pr[a'_k = 0 | a_k=0] = \frac{1}{2}$&lt;/span&gt;. From that, you have directly &lt;span class=&quot;math-container&quot;&gt;$Pr[a'_k = 1 | a_k=0] = 1-\frac{1}{2} = \frac{1}{2}$&lt;/span&gt;. And when &lt;span class=&quot;math-container&quot;&gt;$a_k=1$&lt;/span&gt;, it's the exact same computation, but with a minus sign in front of 0... so it does not really matter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So when &lt;span class=&quot;math-container&quot;&gt;$b_k \neq b'_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a'_k$&lt;/span&gt; is not correlated with &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="5969" LastEditDate="2020-02-11T10:38:00.837" LastActivityDate="2020-02-11T10:38:00.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9818" PostTypeId="2" ParentId="9805" CreationDate="2020-02-10T13:33:27.427" Score="0" Body="&lt;p&gt;Yes, you can use Tensorflow to perform this.&#xA;Below are few mentioned:&#xA;&lt;a href=&quot;https://pennylane.ai/&quot; rel=&quot;nofollow noreferrer&quot;&gt;A cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations&lt;/a&gt;&#xA;&lt;a href=&quot;https://www.xanadu.ai/software/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction of the first dedicated machine learning platform for quantum computers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://pypi.org/project/StrawberryFields/&quot; rel=&quot;nofollow noreferrer&quot;&gt;It's Documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9975" LastActivityDate="2020-02-10T13:33:27.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9819" PostTypeId="2" ParentId="9747" CreationDate="2020-02-10T14:33:56.143" Score="2" Body="&lt;p&gt;Here is a screenshot of a possible proof:&lt;a href=&quot;https://i.stack.imgur.com/OKXQ8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OKXQ8.png&quot; alt=&quot;Graphical proof&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can ignore the scalars if you want.&#xA;The idea is to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;disconnect the red node using the spider rule&lt;/li&gt;&#xA;&lt;li&gt;turn it into a green node with a Hadamard node&lt;/li&gt;&#xA;&lt;li&gt;decompose the hadamard gate&lt;/li&gt;&#xA;&lt;li&gt;use the copy rule to get rid of the red node&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;&lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt;-red node = &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;-green node&quot; into &quot;&lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt;-green node = &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;-red node&quot;.&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2020-02-10T14:33:56.143" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9820" PostTypeId="2" ParentId="9747" CreationDate="2020-02-10T16:08:50.657" Score="2" Body="&lt;p&gt;If all the angles in your diagram are multiples of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;, you should use the rules from &lt;a href=&quot;https://arxiv.org/abs/1602.04744&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;A Simplified Stabilizer ZX-calculus&quot;&lt;/a&gt; instead of the original rules in the paper you linked. But I'll work with them since it's what you asked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UqOhO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UqOhO.png&quot; alt=&quot;EU&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;becomes this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YKP6U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YKP6U.png&quot; alt=&quot;EU without scalar&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VUj1P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VUj1P.png&quot; alt=&quot;EU prime&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which relates your version 1 to your version 2. Your various CZs are just transforming the Hadamard in the middle into different forms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyways, your goal is to prove this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xh0Qm.png&quot; alt=&quot;goal&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which I would call &quot;S gate can be performed by injecting a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}^\dagger |0\rangle$&lt;/span&gt; state&quot;. The main thing you need to do is to translate the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}^\dagger |0\rangle$&lt;/span&gt; part into an equivalent &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z}|+\rangle$&lt;/span&gt; part, i.e. turn that green leaf into a red leaf so that you can just merge it into the central red node.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the simplified stabilizer calculus axioms paper, the only rule that involves a leaf with a &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; angle is &lt;span class=&quot;math-container&quot;&gt;$EU^\prime$&lt;/span&gt;. And if you look at their proof of that axiom from the original axioms, it includes a proof of the &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; color change:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fqLqY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fqLqY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-02-10T16:52:37.017" LastActivityDate="2020-02-10T16:52:37.017" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9821" PostTypeId="2" ParentId="9567" CreationDate="2020-02-10T17:22:49.067" Score="1" Body="&lt;p&gt;Go to Pycharm or VS Code and in console do write this command &lt;code&gt;pip install qsharp&lt;/code&gt; . It works well.&lt;/p&gt;&#xA;" OwnerUserId="9975" LastActivityDate="2020-02-10T17:22:49.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9822" PostTypeId="2" ParentId="9512" CreationDate="2020-02-10T17:33:12.303" Score="1" Body="&lt;p&gt;Yes it can be converted to required Programming language. &#xA;&lt;a href=&quot;https://www.py4j.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Py4J&lt;/a&gt; , Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine.  &#xA;&lt;a href=&quot;http://swig.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;SWIG&lt;/a&gt; is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.&lt;/p&gt;&#xA;" OwnerUserId="9975" LastActivityDate="2020-02-10T17:33:12.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9823" PostTypeId="1" CreationDate="2020-02-11T05:34:38.483" Score="3" ViewCount="814" Body="&lt;p&gt;What is a &quot;shot&quot; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One more question - I saw the sentence &lt;em&gt;for each value of the shots, the experiment repeated 100 times&lt;/em&gt;. What is this mean? Is there difference between shots and repeated experiments? Are shot and experiment repetition same thing?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="55" LastEditDate="2020-10-28T09:26:14.257" LastActivityDate="2020-10-28T09:26:14.257" Title="What is meant with &quot;shot&quot; in quantum computation?" Tags="&lt;terminology&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9824" PostTypeId="1" AcceptedAnswerId="9888" CreationDate="2020-02-11T07:23:41.143" Score="2" ViewCount="129" Body="&lt;p&gt;I'm studying shor's algorithm. I implemented in Qiskit and apriori I know that a period is 3 in my example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, unless I know about period, how to obtain this period only according to seeing diagram?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a circuit diagram.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WHSE9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WHSE9.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a probability diagram. How to obtain a period from it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/r6i5O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/r6i5O.png&quot; alt=&quot;Probabilities&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9990" LastEditorUserId="9006" LastEditDate="2020-02-11T07:29:18.087" LastActivityDate="2020-02-17T17:50:01.723" Title="Shor algorithm - how to obtain a period from diagram?" Tags="&lt;qiskit&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9825" PostTypeId="2" ParentId="9823" CreationDate="2020-02-11T07:26:41.507" Score="3" Body="&lt;p&gt;&lt;strong&gt;Number of shots:&lt;/strong&gt; Number of shots means how many times an algorithm is run to get a probability distribution of results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Experiment is repeated:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overall, number of shots and experiment repetitions mean different things.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Default number of shots:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-11T14:14:42.483" LastActivityDate="2020-02-11T14:14:42.483" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9826" PostTypeId="1" CreationDate="2020-02-11T08:43:59.353" Score="1" ViewCount="1660" Body="&lt;p&gt;I have created a virtual environment by &lt;code&gt;virtualenv&lt;/code&gt; (not &lt;code&gt;conda&lt;/code&gt;) and tried to install qiskit by:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But it gives me a lot of error lines on the output:  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Processing c:\users\mrt\appdata\local\pip\cache\wheels\20\f3\76\5a370641d58aa5f2887118316f675e967dd00c087276c5fc7d\qiskit-0.15.0-py3-none-any.whl&#xA;Requirement already satisfied: qiskit-ibmq-provider==0.4.6 in e:\py\quantum-computing\lib\site-packages (from qiskit) (0.4.6)&#xA;Collecting qiskit-aqua==0.6.4&#xA;  Using cached qiskit_aqua-0.6.4-py3-none-any.whl (1.8 MB)&#xA;Collecting qiskit-aer==0.4.0&#xA;  Using cached qiskit-aer-0.4.0.tar.gz (10.0 MB)&#xA;Requirement already satisfied: qiskit-terra==0.12.0 in e:\py\quantum-computing\lib\site-packages (from qiskit) (0.12.0)&#xA;Requirement already satisfied: qiskit-ignis==0.2.0 in e:\py\quantum-computing\lib\site-packages (from qiskit) (0.2.0)&#xA;Requirement already satisfied: requests&amp;gt;=2.19 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (2.22.0)&#xA;Requirement already satisfied: websockets&amp;lt;8,&amp;gt;=7 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (7.0)&#xA;Requirement already satisfied: requests-ntlm&amp;gt;=1.1.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (1.1.0)&#xA;Requirement already satisfied: arrow&amp;gt;=0.15.5 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (0.15.5)&#xA;Requirement already satisfied: nest-asyncio!=1.1.0,&amp;gt;=1.0.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (1.2.3)&#xA;Collecting scikit-learn&amp;gt;=0.20.0&#xA;  Using cached scikit_learn-0.22.1-cp37-cp37m-win32.whl (5.5 MB)&#xA;Requirement already satisfied: sympy&amp;gt;=1.3 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.5.1)&#xA;Processing c:\users\mrt\appdata\local\pip\cache\wheels\78\55\c8\dc61e772445a566b7608a476d151e9dcaf4e092b01b0c4bc3c\dlx-1.0.4-py3-none-any.whl&#xA;Collecting quandl&#xA;  Using cached Quandl-3.5.0-py2.py3-none-any.whl (25 kB)&#xA;Requirement already satisfied: scipy&amp;gt;=1.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.4.1)&#xA;Requirement already satisfied: jsonschema&amp;gt;=2.6 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (3.2.0)&#xA;Requirement already satisfied: fastdtw in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (0.3.4)&#xA;Requirement already satisfied: numpy&amp;gt;=1.13 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.18.1)&#xA;Requirement already satisfied: setuptools&amp;gt;=40.1.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (45.2.0)&#xA;Requirement already satisfied: psutil&amp;gt;=5 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (5.6.7)&#xA;Requirement already satisfied: networkx&amp;gt;=2.2 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (2.4)&#xA;Requirement already satisfied: docplex in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4-&amp;gt;qiskit) (2.12.182)&#xA;Collecting cvxopt; python_version &amp;lt; &quot;3.8&quot; or sys_platform != &quot;win32&quot;&#xA;  Using cached cvxopt-1.2.4.tar.gz (6.7 MB)&#xA;Collecting h5py&#xA;  Using cached h5py-2.10.0-cp37-cp37m-win32.whl (2.1 MB)&#xA;Requirement already satisfied: cython&amp;gt;=0.27.1 in e:\py\quantum-computing\lib\site-packages (from qiskit-aer==0.4.0-&amp;gt;qiskit) (0.29.15)&#xA;Requirement already satisfied: pybind11&amp;gt;=2.4 in e:\py\quantum-computing\lib\site-packages (from qiskit-aer==0.4.0-&amp;gt;qiskit) (2.4.3)&#xA;Requirement already satisfied: marshmallow-polyfield&amp;lt;6,&amp;gt;=5.7 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0-&amp;gt;qiskit) (5.8)&#xA;Requirement already satisfied: marshmallow&amp;lt;4,&amp;gt;=3 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0-&amp;gt;qiskit) (3.4.0)&#xA;Requirement already satisfied: dill&amp;gt;=0.3 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0-&amp;gt;qiskit) (0.3.1.1)&#xA;Requirement already satisfied: ply&amp;gt;=3.10 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0-&amp;gt;qiskit) (3.11)&#xA;Requirement already satisfied: idna&amp;lt;2.9,&amp;gt;=2.5 in e:\py\quantum-computing\lib\site-packages (from requests&amp;gt;=2.19-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (2.8)&#xA;Requirement already satisfied: chardet&amp;lt;3.1.0,&amp;gt;=3.0.2 in e:\py\quantum-computing\lib\site-packages (from requests&amp;gt;=2.19-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (3.0.4)&#xA;Requirement already satisfied: certifi&amp;gt;=2017.4.17 in e:\py\quantum-computing\lib\site-packages (from requests&amp;gt;=2.19-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (2019.11.28)&#xA;Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,&amp;lt;1.26,&amp;gt;=1.21.1 in e:\py\quantum-computing\lib\site-packages (from requests&amp;gt;=2.19-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (1.25.8)&#xA;Requirement already satisfied: ntlm-auth&amp;gt;=1.0.2 in e:\py\quantum-computing\lib\site-packages (from requests-ntlm&amp;gt;=1.1.0-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (1.4.0)&#xA;Requirement already satisfied: cryptography&amp;gt;=1.3 in e:\py\quantum-computing\lib\site-packages (from requests-ntlm&amp;gt;=1.1.0-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (2.8)&#xA;Requirement already satisfied: python-dateutil in e:\py\quantum-computing\lib\site-packages (from arrow&amp;gt;=0.15.5-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (2.8.1)&#xA;Collecting joblib&amp;gt;=0.11&#xA;  Using cached joblib-0.14.1-py2.py3-none-any.whl (294 kB)&#xA;Requirement already satisfied: mpmath&amp;gt;=0.19 in e:\py\quantum-computing\lib\site-packages (from sympy&amp;gt;=1.3-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.1.0)&#xA;Collecting more-itertools&#xA;  Using cached more_itertools-8.2.0-py3-none-any.whl (43 kB)&#xA;Processing c:\users\mrt\appdata\local\pip\cache\wheels\13\61\89\9192774c0f1e6c3342354df9f4804d7a9de80ac88e062d2e56\inflection-0.3.1-py3-none-any.whl&#xA;Requirement already satisfied: six in e:\py\quantum-computing\lib\site-packages (from quandl-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.14.0)&#xA;Collecting pandas&amp;gt;=0.14&#xA;  Using cached pandas-1.0.1-cp37-cp37m-win32.whl (7.7 MB)&#xA;Requirement already satisfied: pyrsistent&amp;gt;=0.14.0 in e:\py\quantum-computing\lib\site-packages (from jsonschema&amp;gt;=2.6-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (0.15.7)&#xA;Requirement already satisfied: attrs&amp;gt;=17.4.0 in e:\py\quantum-computing\lib\site-packages (from jsonschema&amp;gt;=2.6-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (19.3.0)&#xA;Requirement already satisfied: importlib-metadata; python_version &amp;lt; &quot;3.8&quot; in e:\py\quantum-computing\lib\site-packages (from jsonschema&amp;gt;=2.6-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.5.0)&#xA;Requirement already satisfied: decorator&amp;gt;=4.3.0 in e:\py\quantum-computing\lib\site-packages (from networkx&amp;gt;=2.2-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (4.4.1)&#xA;Requirement already satisfied: docloud&amp;gt;=1.0.375 in e:\py\quantum-computing\lib\site-packages (from docplex-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (1.0.375)&#xA;Requirement already satisfied: cffi!=1.11.3,&amp;gt;=1.8 in e:\py\quantum-computing\lib\site-packages (from cryptography&amp;gt;=1.3-&amp;gt;requests-ntlm&amp;gt;=1.1.0-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (1.14.0)&#xA;Collecting pytz&amp;gt;=2017.2&#xA;  Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB)&#xA;Requirement already satisfied: zipp&amp;gt;=0.5 in e:\py\quantum-computing\lib\site-packages (from importlib-metadata; python_version &amp;lt; &quot;3.8&quot;-&amp;gt;jsonschema&amp;gt;=2.6-&amp;gt;qiskit-aqua==0.6.4-&amp;gt;qiskit) (2.2.0)&#xA;Requirement already satisfied: pycparser in e:\py\quantum-computing\lib\site-packages (from cffi!=1.11.3,&amp;gt;=1.8-&amp;gt;cryptography&amp;gt;=1.3-&amp;gt;requests-ntlm&amp;gt;=1.1.0-&amp;gt;qiskit-ibmq-provider==0.4.6-&amp;gt;qiskit) (2.19)&#xA;Building wheels for collected packages: qiskit-aer, cvxopt&#xA;  Building wheel for qiskit-aer (setup.py) ... error&#xA;  ERROR: Command errored out with exit status 1:&#xA;   command: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\qiskit-aer\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\qiskit-aer\\setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\MRT\AppData\Local\Temp\pip-wheel-ygy91648'&#xA;       cwd: C:\Users\MRT\AppData\Local\Temp\pip-install-6b8z6utw\qiskit-aer\&#xA;  Complete output (153 lines):&#xA;&#xA;&#xA;  --------------------------------------------------------------------------------&#xA;  -- Trying &quot;Ninja (Visual Studio 15 2017 v141)&quot; generator&#xA;  --------------------------------&#xA;  ---------------------------&#xA;  ----------------------&#xA;  -----------------&#xA;  ------------&#xA;  -------&#xA;  --&#xA;  Not searching for unused variables given on the command line.&#xA;  CMake Error: CMake was unable to find a build program corresponding to &quot;Ninja&quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.&#xA;  -- Configuring incomplete, errors occurred!&#xA;  See also &quot;C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log&quot;.&#xA;  --&#xA;  -------&#xA;  ------------&#xA;  -----------------&#xA;  ----------------------&#xA;  ---------------------------&#xA;  --------------------------------&#xA;  -- Trying &quot;Ninja (Visual Studio 15 2017 v141)&quot; generator - failure&#xA;  --------------------------------------------------------------------------------&#xA;&#xA;&#xA;&#xA;  --------------------------------------------------------------------------------&#xA;  -- Trying &quot;Visual Studio 15 2017 v141&quot; generator&#xA;  --------------------------------&#xA;  ---------------------------&#xA;  ----------------------&#xA;  -----------------&#xA;  ------------&#xA;  -------&#xA;  --&#xA;  Not searching for unused variables given on the command line.&#xA;  CMake Error at CMakeLists.txt:2 (PROJECT):&#xA;    Generator&#xA;&#xA;      Visual Studio 15 2017&#xA;&#xA;    could not find any instance of Visual Studio.&#xA;&#xA;&#xA;&#xA;  -- Configuring incomplete, errors occurred!&#xA;  See also &quot;C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log&quot;.&#xA;  --&#xA;  -------&#xA;  ------------&#xA;  -----------------&#xA;  ----------------------&#xA;  ---------------------------&#xA;  --------------------------------&#xA;  -- Trying &quot;Visual Studio 15 2017 v141&quot; generator - failure&#xA;  --------------------------------------------------------------------------------&#xA;&#xA;&#xA;&#xA;  --------------------------------------------------------------------------------&#xA;  -- Trying &quot;NMake Makefiles (Visual Studio 15 2017 v141)&quot; generator&#xA;  --------------------------------&#xA;  ---------------------------&#xA;  ----------------------&#xA;  -----------------&#xA;  ------------&#xA;  -------&#xA;  --&#xA;  Not searching for unused variables given on the command line.&#xA;  -- The C compiler identification is unknown&#xA;  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):&#xA;    The CMAKE_C_COMPILER:&#xA;&#xA;      cl&#xA;&#xA;    is not a full path and was not found in the PATH.&#xA;&#xA;    To use the NMake generator with Visual C++, cmake must be run from a shell&#xA;    that can use the compiler cl from the command line.  This environment is&#xA;    unable to invoke the cl compiler.  To fix this problem, run cmake from the&#xA;    Visual Studio Command Prompt (vcvarsall.bat).&#xA;&#xA;    Tell CMake where to find the compiler by setting either the environment&#xA;    variable &quot;CC&quot; or the CMake cache entry CMAKE_C_COMPILER to the full path to&#xA;    the compiler, or to the compiler name if it is in the PATH.&#xA;&#xA;&#xA;  -- Configuring incomplete, errors occurred!&#xA;  See also &quot;C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log&quot;.&#xA;  See also &quot;C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log&quot;.&#xA;  --&#xA;  -------&#xA;  ------------&#xA;  -----------------&#xA;  ----------------------&#xA;  ---------------------------&#xA;  --------------------------------&#xA;  -- Trying &quot;NMake Makefiles (Visual Studio 15 2017 v141)&quot; generator - failure&#xA;  --------------------------------------------------------------------------------&#xA;&#xA;&#xA;&#xA;  --------------------------------------------------------------------------------&#xA;  -- Trying &quot;NMake Makefiles JOM (Visual Studio 15 2017 v141)&quot; generator&#xA;  --------------------------------&#xA;  ---------------------------&#xA;  ----------------------&#xA;  -----------------&#xA;  ------------&#xA;  -------&#xA;  --&#xA;  Not searching for unused variables given on the command line.&#xA;  -- The C compiler identification is unknown&#xA;  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):&#xA;    The CMAKE_C_COMPILER:&#xA;&#xA;      cl&#xA;&#xA;    is not a full path and was not found in the PATH.&#xA;&#xA;    To use the JOM generator with Visual C++, cmake must be run from a shell&#xA;    that can use the compiler cl from the command line.  This environment is&#xA;    unable to invoke the cl compiler.  To fix this problem, run cmake from the&#xA;    Visual Studio Command Prompt (vcvarsall.bat).&#xA;&#xA;    Tell CMake where to find the compiler by setting either the environment&#xA;    variable &quot;CC&quot; or the CMake cache entry CMAKE_C_COMPILER to the full path to&#xA;    the compiler, or to the compiler name if it is in the PATH.&#xA;&#xA;&#xA;  -- Configuring incomplete, errors occurred!&#xA;  See also &quot;C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log&quot;.&#xA;  See also &quot;C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log&quot;.&#xA;  --&#xA;  -------&#xA;  ------------&#xA;  -----------------&#xA;  ----------------------&#xA;  ---------------------------&#xA;  --------------------------------&#xA;  -- Trying &quot;NMake Makefiles JOM (Visual Studio 15 2017 v141)&quot; generator - failure&#xA;  --------------------------------------------------------------------------------&#xA;&#xA;  ********************************************************************************&#xA;  scikit-build could not get a working generator for your system. Aborting build.&#xA;&#xA;  Building windows wheels for Python 3.7 requires Microsoft Visual Studio 2017.&#xA;  Get it with &quot;Visual Studio 2017&quot;:&#xA;&#xA;    https://visualstudio.microsoft.com/vs/&#xA;&#xA;  ********************************************************************************&#xA;  ----------------------------------------&#xA;  ERROR: Failed building wheel for qiskit-aer&#xA;  Running setup.py clean for qiskit-aer&#xA;  Building wheel for cvxopt (setup.py) ... error&#xA;  ERROR: Command errored out with exit status 1:&#xA;   command: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' bdist_wheel -d 'C:\Users\MRT\AppData\Local\Temp\pip-wheel-03pa82mg'&#xA;       cwd: C:\Users\MRT\AppData\Local\Temp\pip-install-6b8z6utw\cvxopt\&#xA;  Complete output (21 lines):&#xA;  running bdist_wheel&#xA;  running build&#xA;  running build_py&#xA;  creating build&#xA;  creating build\lib.win32-3.7&#xA;  creating build\lib.win32-3.7\cvxopt&#xA;  copying src\python\coneprog.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\cvxprog.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\info.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\misc.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\modeling.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\msk.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\printing.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\solvers.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\_version.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  copying src\python\__init__.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;  UPDATING build\lib.win32-3.7\cvxopt/_version.py&#xA;  set build\lib.win32-3.7\cvxopt/_version.py to '1.2.4'&#xA;  running build_ext&#xA;  building 'base' extension&#xA;  error: Microsoft Visual C++ 14.0 is required. Get it with &quot;Build Tools for Visual Studio&quot;: https://visualstudio.microsoft.com/downloads/&#xA;  ----------------------------------------&#xA;  ERROR: Failed building wheel for cvxopt&#xA;  Running setup.py clean for cvxopt&#xA;Failed to build qiskit-aer cvxopt&#xA;Installing collected packages: joblib, scikit-learn, dlx, more-itertools, inflection, pytz, pandas, quandl, cvxopt, h5py, qiskit-aqua, qiskit-aer, qiskit&#xA;    Running setup.py install for cvxopt ... error&#xA;    ERROR: Command errored out with exit status 1:&#xA;     command: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' 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'&#xA;         cwd: C:\Users\MRT\AppData\Local\Temp\pip-install-6b8z6utw\cvxopt\&#xA;    Complete output (21 lines):&#xA;    running install&#xA;    running build&#xA;    running build_py&#xA;    creating build&#xA;    creating build\lib.win32-3.7&#xA;    creating build\lib.win32-3.7\cvxopt&#xA;    copying src\python\coneprog.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\cvxprog.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\info.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\misc.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\modeling.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\msk.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\printing.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\solvers.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\_version.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    copying src\python\__init__.py -&amp;gt; build\lib.win32-3.7\cvxopt&#xA;    UPDATING build\lib.win32-3.7\cvxopt/_version.py&#xA;    set build\lib.win32-3.7\cvxopt/_version.py to '1.2.4'&#xA;    running build_ext&#xA;    building 'base' extension&#xA;    error: Microsoft Visual C++ 14.0 is required. Get it with &quot;Build Tools for Visual Studio&quot;: https://visualstudio.microsoft.com/downloads/&#xA;    ----------------------------------------&#xA;ERROR: Command errored out with exit status 1: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'&quot;'&quot;'; __file__='&quot;'&quot;'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'&quot;'&quot;';f=getattr(tokenize, '&quot;'&quot;'open'&quot;'&quot;', open)(__file__);code=f.read().replace('&quot;'&quot;'\r\n'&quot;'&quot;', '&quot;'&quot;'\n'&quot;'&quot;');f.close();exec(compile(code, __file__, '&quot;'&quot;'exec'&quot;'&quot;'))' 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.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;System description:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32&#xA;Windows 10 x64&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What are the requirements? What should I do to solve this problem?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="9668" LastEditorUserId="55" LastEditDate="2020-02-19T13:22:08.033" LastActivityDate="2021-01-18T15:31:13.453" Title="Installing qiskit with `pip install qiskit` gives `ERROR: Command errored out with exit status 1`" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="5" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9827" PostTypeId="2" ParentId="9826" CreationDate="2020-02-11T08:59:00.677" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that you have a cached previous install attempt. To ignore it, try:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;pip install qiskit --no-cache-dir&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9918" LastActivityDate="2020-02-11T08:59:00.677" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9828" PostTypeId="1" AcceptedAnswerId="9829" CreationDate="2020-02-11T10:12:09.320" Score="3" ViewCount="149" Body="&lt;p&gt;I want to construct the following state of a qubit using a quantum circuit: &lt;span class=&quot;math-container&quot;&gt;$\frac{-|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use the following qiskit code in Python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(1)&#xA;c = ClassicalRegister(1)&#xA;circuit = QuantumCircuit(q, c)&#xA;circuit.x(q[0])&#xA;circuit.z(q[0])&#xA;circuit.h(q[0])&#xA;backend = BasicAer.get_backend('statevector_simulator')&#xA;job = execute(circuit, backend)&#xA;amplitudes = job.result().get_statevector(circuit)&#xA;print(amplitudes)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get &lt;code&gt;[ 0.70710678+0.00000000e+00j -0.70710678+8.65956056e-17j]&lt;/code&gt;. When I remove the Pauli-Z gate I get: &lt;code&gt;[ 0.70710678+0.00000000e+00j -0.70710678+8.65956056e-17j]&lt;/code&gt;, i.e. the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, using Quirk I get the expected output. With the IBM Quantum Experience, I'm not sure. I get &lt;code&gt;[ -0.707+0j, 0.707+0j ]&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am using &lt;code&gt;qiskit==0.15.0&lt;/code&gt; and &lt;code&gt;qiskit-aqua==0.6.4&lt;/code&gt;, which I updated after having this problem in an older version, too.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also tested the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# setup the circuit as before&#xA;circuit.x(q[0])&#xA;circuit.z(q[0])&#xA;# get and print amplitudes&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which results in &lt;code&gt;[ 0.+0.0000000e+00j -1.+1.2246468e-16j]&lt;/code&gt;, as I had expected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus I am guessing, that I miss something. Can anyone explain this behavior?&lt;/p&gt;&#xA;" OwnerUserId="5461" LastEditorUserId="55" LastEditDate="2020-02-19T13:23:59.097" LastActivityDate="2020-02-19T13:23:59.097" Title="Generate the state $\frac{-|0\rangle + |1\rangle}{\sqrt{2}}$ with qiskit: problem with Pauli-Z behavior" Tags="&lt;qiskit&gt;&lt;pauli-gates&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9829" PostTypeId="2" ParentId="9828" CreationDate="2020-02-11T10:25:15.500" Score="4" Body="&lt;p&gt;Generally, quantum states are determined up to a phase - i.e. up to multiplication by scalar. So &lt;span class=&quot;math-container&quot;&gt;$\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}},\frac{-\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}$&lt;/span&gt; are essentially the same state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a good question how the statevector simulator chooses to normalize its statevector representation.&lt;/p&gt;&#xA;" OwnerUserId="9918" LastActivityDate="2020-02-11T10:25:15.500" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9832" PostTypeId="1" AcceptedAnswerId="9835" CreationDate="2020-02-11T14:59:00.507" Score="2" ViewCount="76" Body="&lt;p&gt;In the quantum search algorithm below, also known as Grover's algorithm, what observable do we measure at the end of the protocol?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, in the red box, it says &lt;em&gt;&quot;measure the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits&quot;&lt;/em&gt;, but which observable are we measuring?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JjWMS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JjWMS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10033" LastEditorUserId="10033" LastEditDate="2020-02-11T15:46:07.213" LastActivityDate="2020-02-11T20:03:45.007" Title="What observable do we measure at the end of a quantum search algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9833" PostTypeId="1" CreationDate="2020-02-11T16:46:04.803" Score="1" ViewCount="147" Body="&lt;p&gt;I have a very basic question: say I perform some set of operations on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits (like QFT, QFT addition etc), and thus have a &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubit final state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If each qubit has something that I want to read off of it, is it possible to extract data from each qubit into classical?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="9997" LastEditorUserId="55" LastEditDate="2020-02-19T13:25:26.993" LastActivityDate="2020-02-19T13:25:26.993" Title="Reading or Unloading quantum data to classical data" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9834" PostTypeId="2" ParentId="9833" CreationDate="2020-02-11T17:54:32.057" Score="1" Body="&lt;p&gt;In Qiskit, to read the qubits into classical bits you can use the &lt;code&gt;measure&lt;/code&gt; operation. If you have defined classical and quantum registers as &lt;code&gt;cr&lt;/code&gt; and &lt;code&gt;qr&lt;/code&gt; respectively, you can get the values of all the qubits by doing &lt;code&gt;qc.measure(qr,cr)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-11T17:54:32.057" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9835" PostTypeId="2" ParentId="9832" CreationDate="2020-02-11T19:58:29.463" Score="3" Body="&lt;p&gt;Usually, when we don't specify, we measure in the computational basis, i.e. each qubit is measured using the observable &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="5969" LastEditDate="2020-02-11T20:03:45.007" LastActivityDate="2020-02-11T20:03:45.007" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9836" PostTypeId="2" ParentId="9833" CreationDate="2020-02-11T20:50:50.827" Score="2" Body="&lt;p&gt;It seems as if you have an algorithm that can prepare a state such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(\vert 0A\rangle+\vert 1B\rangle),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and you want to be able to extract &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; separately.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are correct that if you measure the second register, you will &quot;collapse&quot; the state, and it may be difficult to distinguish &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, you may still be able to determine whether &lt;span class=&quot;math-container&quot;&gt;$A=B$&lt;/span&gt;. For example, interference allows you to measure the first register in the Hadamard basis.  If &lt;span class=&quot;math-container&quot;&gt;$A=B$&lt;/span&gt; then after Hadamarding the first register must revert back to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-02-11T20:50:50.827" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9837" PostTypeId="1" AcceptedAnswerId="9841" CreationDate="2020-02-11T22:03:01.883" Score="4" ViewCount="75" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$=1,$&lt;/span&gt; I know the state is separable and entangled otherwise. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I am trying this method for the following state (which we know to be entangled): &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = a_0b_0 |00\rangle+a_0b_1|01\rangle + a_1b_1|11\rangle \tag{1}&#xA;$$&lt;/span&gt;&#xA;nothing much else is really said about the coefficients other than neither of the above rhs terms have a coefficient &lt;span class=&quot;math-container&quot;&gt;$0.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;My attempt:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I computed &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle \langle\psi|$&lt;/span&gt;, then took the partial trace in the basis of the 2nd qubit &lt;span class=&quot;math-container&quot;&gt;$\rho_1=\operatorname{Tr}_2(\rho).$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The obtained &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1 = \begin{pmatrix} a_0^2b_0^2 &amp;amp; a_0 a_1^* b_1^2 \\ a_0^* a_1 b_1^2 &amp;amp; a_1^2b_1^2\end{pmatrix} \tag{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Then computing &lt;span class=&quot;math-container&quot;&gt;$\rho_1^2$&lt;/span&gt; then taking its trace, I obtain: &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;So for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to be an entangled state, we need to show &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\neq 1,$&lt;/span&gt; i.e., &lt;span class=&quot;math-container&quot;&gt;$(a_0^2b_0^2+a_1^2b_1^2)\neq 1$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The only way I can make progress with the latter, is to assume that our given state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is normalized, then I can assert that &lt;span class=&quot;math-container&quot;&gt;$(a_0^2b_0^2+a_1^2b_1^2)&amp;lt;1$&lt;/span&gt; since by normalization &lt;span class=&quot;math-container&quot;&gt;$a_0^2b_0^2+a_1^2b_1^2+a_0^2 b_1^2=1$&lt;/span&gt; must be unity, thus  &lt;span class=&quot;math-container&quot;&gt;$(a_0^2b_0^2+a_1^2b_1^2)&amp;lt;1$&lt;/span&gt; must be true and our state is entangled.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h2&gt;Question:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is my assumption that &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is a normalized ket a necessary one in order to solve the problem of whether &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is entangled or separable? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In case the assumption is needed, is my end result correctly interpreted then? &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10043" LastEditorUserId="10043" LastEditDate="2020-02-12T00:32:40.337" LastActivityDate="2020-02-12T08:21:36.100" Title="Applying density matrix based criterion to verify separability" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9838" PostTypeId="1" AcceptedAnswerId="9840" CreationDate="2020-02-12T02:28:48.953" Score="2" ViewCount="139" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;First, in concern with quantum parallelism, suppose we are given the function &lt;span class=&quot;math-container&quot;&gt;$f(x): \{0, 1\} \rightarrow \{0, 1\}$&lt;/span&gt;, and the unitary map &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_f:|x, y\rangle \rightarrow |x, y\oplus f(x)\rangle&#xA;$$&lt;/span&gt;&#xA;Now suppose we feed &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; the input &lt;span class=&quot;math-container&quot;&gt;$|+\rangle |0\rangle$&lt;/span&gt;.  Then as output we obtain the interesting state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0, f(0)\rangle + |1, f(1) \rangle)&#xA;$$&lt;/span&gt;&#xA;which clearly exhibits quantum parallelism as &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; are simultaneously evaluated.  What I am unclear on is exactly how to arrive at the above output state via computation: how do you compute &lt;span class=&quot;math-container&quot;&gt;$|0 \oplus f(|+\rangle)\rangle$&lt;/span&gt;, or just &lt;span class=&quot;math-container&quot;&gt;$f(|+\rangle)$&lt;/span&gt;?  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 &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt;, how would you compute &lt;span class=&quot;math-container&quot;&gt;$f(|++\rangle)$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;My next question follows from the first.  In the text, the authors say: applying &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; (as defined above) to the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt; gives the state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(-1)^{f(x)}|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)&#xA;$$&lt;/span&gt;&#xA;How was this result obtained (what computation is needed to obtain it?), where did the term &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(x)}$&lt;/span&gt; come from?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a consequence of this, they say that inputting the state &lt;span class=&quot;math-container&quot;&gt;$|+-\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; leaves us with the two possibilities of &lt;span class=&quot;math-container&quot;&gt;$\pm |+-\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$f(0)=f(1)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pm |--\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$f(0) \not= f(1)$&lt;/span&gt;.  Similarly this doesn't make sense, how can I carry out the computation to show this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you all for the time and help, I will upvote partial answers (anwering one of the above questions for example).&lt;/p&gt;&#xA;" OwnerUserId="10023" LastActivityDate="2020-02-12T07:05:13.760" Title="Understanding Steps in Deutsch's Algorithm" Tags="&lt;nielsen-and-chuang&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9839" PostTypeId="2" ParentId="9837" CreationDate="2020-02-12T06:38:07.480" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-12T06:38:07.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9840" PostTypeId="2" ParentId="9838" CreationDate="2020-02-12T07:05:13.760" Score="4" Body="&lt;p&gt;To answer your first question, the quantum oracles are defined by their effect on the basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$f(|+\rangle)$&lt;/span&gt;; instead, to compute the result of applying &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to a state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|0\rangle$&lt;/span&gt;, you'd perform the following steps:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a basis state 0 or 1, you'll get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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) =$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \frac{1}{\sqrt{2}}(|x,f(x)\rangle - |x,1 \oplus f(x)\rangle) = &#xA;|x\rangle\frac{1}{\sqrt{2}}(|f(x)\rangle - |1 \oplus f(x)\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you consider options:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;, the state of the second qubit is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;, the state of the second qubit is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|1\rangle - |0\rangle) = -|-\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;which finally you can write shorter as &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(x)}|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The same math applies to the final portion of your question, when &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is applied to a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|-\rangle$&lt;/span&gt; state. For educational purposes I would recommend you do go through the steps yourself - you should have all the tool for that now!&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-02-12T07:05:13.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9841" PostTypeId="2" ParentId="9837" CreationDate="2020-02-12T08:14:50.930" Score="2" Body="&lt;p&gt;In essence the calculations are correct, though those numbers &lt;span class=&quot;math-container&quot;&gt;$^2_i, ^2_i$&lt;/span&gt; must be taken with modulus, because they are in fact &lt;span class=&quot;math-container&quot;&gt;$a_ia_i^*, b_ib_i^*$&lt;/span&gt;. In general &lt;span class=&quot;math-container&quot;&gt;$^2_0$&lt;/span&gt; is a complex number, so you can't write &lt;span class=&quot;math-container&quot;&gt;$^2_0&amp;gt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normalization is required when we consider quantum states (also, otherwise, &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\rho_1^2)$&lt;/span&gt; can be arbitrary close to 0). With normalization you have showed that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\rho_1^2) &amp;lt; 1$&lt;/span&gt;, hence the state must be entangled. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-02-12T08:21:36.100" LastActivityDate="2020-02-12T08:21:36.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9842" PostTypeId="1" AcceptedAnswerId="9843" CreationDate="2020-02-12T10:41:49.690" Score="4" ViewCount="600" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to implement two inputs Toffoli gate in simpler way than for example on IBM Q?&lt;/li&gt;&#xA;&lt;li&gt;How to implement Toffoli gate with three or more inputs without building it up from two inputs Toffoli gates and using ancilla qubits?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-14T14:38:21.750" LastActivityDate="2020-02-14T14:38:21.750" Title="Simpler implementation of the Toffoli gate on IBM Q for special circumstances" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9843" PostTypeId="2" ParentId="9842" CreationDate="2020-02-12T10:41:49.690" Score="0" Body="&lt;p&gt;It is possible to employ a method presented in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;. The article shows (besides) how to implement gate controlled by &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and yielding a state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle_{n+1} = |i\rangle_{n}\Big(\sqrt{1-f(i)}|0\rangle + \sqrt{f(i)}|1\rangle\Big),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is a binary representation of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits number and &lt;span class=&quot;math-container&quot;&gt;$f(i)$&lt;/span&gt; is an arbitrary function. Setting function &lt;span class=&quot;math-container&quot;&gt;$f(i) = 1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|i\rangle = |1 \dots1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(i) = 0$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; input qubits &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; rotations is used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;s and four &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gates are used (note that after transpiling the circuit on IBM Q, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; are replaced by &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A implementation of Toffoli gate with above mentioned method is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AXe1S.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AXe1S.png&quot; alt=&quot;2 input Toffoli&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is set to &lt;span class=&quot;math-container&quot;&gt;$\pm\frac{\pi}{4}$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tested the new gate &quot;abilities&quot; on input &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; was &lt;strong&gt;93.286 %&lt;/strong&gt;, while the same probability with Toffoli implemented on IBM Q was &lt;strong&gt;87.486 %&lt;/strong&gt;. Clearly, simpler circuits helped to get a more coherent results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method also allows to implement Toffoli gate with three inputs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8cdFn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8cdFn.png&quot; alt=&quot;3 inputs Toffoli&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: Parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is set to &lt;span class=&quot;math-container&quot;&gt;$\pm\frac{\pi}{8}$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I again tested the circuit on ibmqx2 with same setting as above and compared it with Toffoli gate on IBM Q (&lt;em&gt;here I had to use ancilla qubit and three two input Toffoli gates - one for uncomputing the ancilla&lt;/em&gt;). Input of circuit was &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;. &#xA;A probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; was &lt;strong&gt;81.213 %&lt;/strong&gt;, while the probability with Toffoli implemented on IBM Q was &lt;strong&gt;30.542 %&lt;/strong&gt;. This means that output of construction with two inputs Toffoli gate and one ancilla qubit is very decoherent.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; based on &lt;em&gt;DaftWullie&lt;/em&gt; comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Actually above introduced simplification of a Toffoli gate can be used only in case qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; in case of three inputs) is set to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, i.e. the gate operate as AND known from classical Boolean logic. The reason is that a matrix describing circuit above is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that for input &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; a phase is shifted by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;As a result, the circuit is not &quot;general Toffoli&quot; and can be used only in special cases where it is ensured that the &quot;last&quot; qubit is set to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-14T14:37:33.470" LastActivityDate="2020-02-14T14:37:33.470" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9844" PostTypeId="1" CreationDate="2020-02-12T14:06:00.187" Score="1" ViewCount="106" Body="&lt;p&gt;Suppose that I have a 5 qubit quantum computer and want to generate&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;4 entangled states (each of 5 qubits) &lt;/li&gt;&#xA;&lt;li&gt;Single 6 qubit entangled state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Are these 2 cases possible? I am a beginner please help!&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="9006" LastEditDate="2020-02-13T22:15:05.077" LastActivityDate="2020-02-13T22:15:05.077" Title="Can I generate 4 entangled states (each 5 qubits) on a 5 qubit quantum computer?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9845" PostTypeId="1" CreationDate="2020-02-12T15:59:01.330" Score="1" ViewCount="62" Body="&lt;p&gt;In 2020, practically speaking, how long (time-wise) will a qubit function normally before decoherence kicks in?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-02-13T03:30:43.557" Title="How long can a qubit exist without decoherence?" Tags="&lt;quantum-state&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9846" PostTypeId="1" AcceptedAnswerId="9852" CreationDate="2020-02-12T19:05:38.620" Score="1" ViewCount="231" Body="&lt;p&gt;Please help me in building IBM Quantum Experience circuit for:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M|0\rangle = \frac{1}{2}(|0\rangle+|1\rangle+|2\rangle+|3\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: Is it possible to make a circuit for a general transformation  &lt;span class=&quot;math-container&quot;&gt;$M|0\rangle = \frac{1}{\sqrt{m}}\sum_{i=0}^{m-1}|i\rangle$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$\log m$&lt;/span&gt; qubits initialized to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="9006" LastEditDate="2020-02-13T05:46:43.687" LastActivityDate="2020-02-13T11:12:09.990" Title="How to construct a IBM Quantum Experience circuit for the following state transformation?" Tags="&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9847" PostTypeId="2" ParentId="9845" CreationDate="2020-02-12T19:12:16.573" Score="2" Body="&lt;p&gt;On IBM Q, it is a few tens microseconds. The best value of dephasing time T2 is around 500 microseconds. Have a look here &lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/introduction-to-quantum-circuits&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q website&lt;/a&gt; and navigate to &quot;Qubits as physical system&quot; and then to &quot;dephasing T2&quot; to see development of T2 in last twenty years.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-12T19:12:16.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9848" PostTypeId="2" ParentId="9846" CreationDate="2020-02-12T21:01:22.163" Score="3" Body="&lt;p&gt;The circuit you have described is formed of 2 qubits, both in an equal superposition. This can be achieved by applying the &lt;code&gt;H&lt;/code&gt; 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 &lt;a href=&quot;https://i.stack.imgur.com/ld6nd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ld6nd.png&quot; alt=&quot;2 qubit superposition&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-12T21:01:22.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9849" PostTypeId="2" ParentId="9845" CreationDate="2020-02-13T03:30:43.557" Score="1" Body="&lt;p&gt;Nuclear moments of europium ions have been &lt;a href=&quot;https://www.nature.com/articles/nature14025&quot; rel=&quot;nofollow noreferrer&quot;&gt;experimentally measured&lt;/a&gt; to have coherence times of over six hours, although there is no currently known way of performing controlled logic gate operations on them.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-02-13T03:30:43.557" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9850" PostTypeId="2" ParentId="9844" CreationDate="2020-02-13T04:00:56.253" Score="1" Body="&lt;p&gt;To go straight to your questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;No, simply because if you want four 5-qubit entangled states you'd need 20 qubits.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1cQK5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1cQK5.png&quot; alt=&quot;5-qubit entanglement example&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4966" LastActivityDate="2020-02-13T04:00:56.253" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9851" PostTypeId="1" CreationDate="2020-02-13T04:14:58.097" Score="9" ViewCount="680" Body="&lt;p&gt;(This is a somewhat soft question.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum Fourier transform is formally quite similar to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fast_Fourier_transform&quot; rel=&quot;noreferrer&quot;&gt;fast Fourier transform&lt;/a&gt;, but exponentially faster.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; for solving (certain very special) linear systems of equations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The FFT, on the other hand is used in &lt;em&gt;countless&lt;/em&gt; different applications throughout applied math, science, engineering, finance, and music (notably for signal processing and solving differential equations). Gilbert Strang called it &quot;the most important numerical algorithm of our lifetime.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;application&quot; in the academic's sense of &quot;something that will get me a paper published&quot;, but in the business person's sense of &quot;something that there might be a commercial market for&quot;.) It's &lt;a href=&quot;https://scottaaronson.com/papers/qml.pdf&quot; rel=&quot;noreferrer&quot;&gt;not even clear&lt;/a&gt; if the HHL algorithm would actually deliver a useful speedup in practice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2021-01-20T14:25:46.953" Title="Does the quantum Fourier transform have many applications beyond period finding?" Tags="&lt;shors-algorithm&gt;&lt;hhl-algorithm&gt;&lt;quantum-fourier-transform&gt;&lt;applications&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9852" PostTypeId="2" ParentId="9846" CreationDate="2020-02-13T05:45:30.057" Score="2" Body="&lt;p&gt;&lt;strong&gt;Answer to EDIT in question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is possible to prepeare a state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{\sqrt{m}}\sum_{i=0}^{m-1}|i\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$m = 2^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is a number of qubits, by application of operator &lt;span class=&quot;math-container&quot;&gt;$\otimes H ^{n} = H_{q_0} \otimes H_{q_1} \otimes \dots \otimes H_{q_{n-1}}$&lt;/span&gt;, i.e. Hadamard gate is applied on each qubit involved. As a results, you will get &lt;span class=&quot;math-container&quot;&gt;$n=\log{m}$&lt;/span&gt; qubits in superposition described by uniform probability distribution. It is a generalization of construction provided in answer by &lt;em&gt;met927&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; based on comment by &lt;em&gt;Adam Levine&lt;/em&gt;: &lt;em&gt;&quot;what if for example &lt;span class=&quot;math-container&quot;&gt;$m=5$&lt;/span&gt;?&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It that case you have to prepare entangled state and the approach is a little bit more intricated. For &lt;span class=&quot;math-container&quot;&gt;$m=5$&lt;/span&gt; you have to prepare state (&lt;em&gt;I switched to more common convention with states expressed in binary numbers instead of decimal&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{1}{\sqrt{5}}(|000\rangle + |001\rangle + |010\rangle+|011\rangle+|100\rangle),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. three qubits state where &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; have zero probability.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prepare an arbitrary state, you can employ approach presented in this article:&#xA;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on the article, a circuit preparing state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OMVrK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OMVrK.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here you can see results provided by IBM Q simulator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JNAA0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JNAA0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently, the circuit prepared desired state with uniformly distributed values from &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt; here is a code in QASM of the circuit above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[3];&#xA;creg c[3];&#xA;&#xA;ry(0.927) q[0];&#xA;&#xA;ry(pi/4) q[1];&#xA;cx q[0],q[1];&#xA;ry(pi/4) q[1];&#xA;cx q[0],q[1];&#xA;&#xA;ry(pi/2) q[2];&#xA;cx q[1],q[2];&#xA;ry(-pi/4) q[2];&#xA;cx q[0],q[2];&#xA;ry(pi/4) q[2];&#xA;cx q[1],q[2];&#xA;cx q[0],q[2];&#xA;&#xA;measure q[0] -&amp;gt; c[2];&#xA;measure q[1] -&amp;gt; c[1];&#xA;measure q[2] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-13T11:12:09.990" LastActivityDate="2020-02-13T11:12:09.990" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9854" PostTypeId="2" ParentId="9851" CreationDate="2020-02-13T11:20:59.963" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See list of articles on these applications here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9576/quantum-computing-in-finance-list-of-articles&quot;&gt;Quantum computing in finance - list of articles&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-13T11:20:59.963" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9855" PostTypeId="1" AcceptedAnswerId="12539" CreationDate="2020-02-13T15:28:48.693" Score="6" ViewCount="375" Body="&lt;p&gt;I am a little bit confused by density matrix notation in quantum algorithms. While I am pretty confident with working with pure&#xA; states, I never had the need to work with algorithm using density matrices. &#xA;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is simple with just an Hadamard gate (for n being a power of 2) to prepare the following state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle = \frac{1}{\sqrt{n}} \sum_i^n |i\rangle $$&lt;/span&gt;&#xA;The density matrix version of this state is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma= \sum_{i,y}^{n,n} |i\rangle\langle y|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But instead, I would like to know how to prepare a quantum register in the following state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{1}{n}\sum_{i}^{n} |i\rangle\langle i|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rephrased in other words my question is: what is the pure state state of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;?&#xA;We know it &lt;em&gt;must&lt;/em&gt; exist, because density matrices of pure states have the property that &lt;span class=&quot;math-container&quot;&gt;$\rho^2 = \rho$&lt;/span&gt; &lt;a href=&quot;http://www.theory.caltech.edu/~preskill/ph219/chap2_15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;page 20 of preskill's lecture notes&lt;/a&gt;. &#xA;Intuitively, is &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, but it is not, as &lt;span class=&quot;math-container&quot;&gt;$\sigma \neq \rho$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="10062" LastEditDate="2020-02-19T03:52:18.857" LastActivityDate="2020-06-18T16:22:14.693" Title="How to prepare mixed states on a quantum computer?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;circuit-construction&gt;&lt;density-matrix&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9856" PostTypeId="1" AcceptedAnswerId="9857" CreationDate="2020-02-13T21:34:54.277" Score="3" ViewCount="97" Body="&lt;p&gt;In a recent news &amp;quot;&lt;a href=&quot;https://www.independent.co.uk/life-style/gadgets-and-tech/news/quantum-entanglement-internet-network-memories-processors-a9332476.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scientists Make Major Breakthrough In ‘quantum Entanglement’ That Could Change How The Internet Works&lt;/a&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Scientists have managed to entangle two &amp;quot;quantum memories&amp;quot; at a distant much bigger than ever before, a breakthrough that could one day change the way the internet works.&lt;/p&gt;&#xA;&lt;p&gt;To entangle those two quantum memories, researchers had to shoot photons, or individual particles of light, along the 50-kilometre cable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;My questions are;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is quantum internet&lt;/li&gt;&#xA;&lt;li&gt;What is the relation of it with quantum entanglement&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4866" LastEditorUserId="55" LastEditDate="2020-10-28T09:25:59.267" LastActivityDate="2020-10-28T09:25:59.267" Title="What is &quot;quantum internet&quot; and what is its relation with quantum entanglement?" Tags="&lt;entanglement&gt;&lt;quantum-networks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9857" PostTypeId="2" ParentId="9856" CreationDate="2020-02-13T22:06:54.897" Score="5" Body="&lt;p&gt;&lt;strong&gt;Quantum internet&lt;/strong&gt; is a theoretical concept of global (or at least wide) &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_network&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum net&lt;/a&gt;. It would allow to interconnect many quantum processors (or computers) and enable them to communicate each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How is a entanglement related:&lt;/strong&gt; Quantum entanglement enables to employ &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding&quot; rel=&quot;nofollow noreferrer&quot;&gt;superdense coding&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation&lt;/a&gt; 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. &#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-14T05:25:05.297" LastActivityDate="2020-02-14T05:25:05.297" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9858" PostTypeId="2" ParentId="9855" CreationDate="2020-02-13T23:01:08.653" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="1949" LastActivityDate="2020-02-13T23:01:08.653" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9859" PostTypeId="1" AcceptedAnswerId="9866" CreationDate="2020-02-13T23:40:21.280" Score="2" ViewCount="105" Body="&lt;p&gt;I'm currently learning Simon's algorithm, from &lt;a href=&quot;https://quantum-computing.ibm.com/support/guides/quantum-algorithms-with-qiskit?page=5cbb004574a4010049e1a2aa#example&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Quantum Experiene&lt;/a&gt;.&#xA;For the given string &lt;span class=&quot;math-container&quot;&gt;$s=11$&lt;/span&gt;, they display the implemented function &lt;span class=&quot;math-container&quot;&gt;$Q_f$&lt;/span&gt; like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Tz9Ds.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tz9Ds.png&quot; alt=&quot;Image taken from https://quantum-computing.ibm.com/&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone explain to me, why the CNOT gates are arranged like this, for &lt;span class=&quot;math-container&quot;&gt;$s=11$&lt;/span&gt;? The way I see it, the outcome of the the qubits below, should be &lt;span class=&quot;math-container&quot;&gt;$f(x \oplus 11)$&lt;/span&gt;, but we still don't know about the implementation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, just because we know &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, if I'm not wrong. So how can we display &lt;span class=&quot;math-container&quot;&gt;$Q_f$&lt;/span&gt; here?&lt;/p&gt;&#xA;" OwnerUserId="9950" LastActivityDate="2020-02-14T12:39:19.860" Title="Simon's algorithm -- circuit for given s" Tags="&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9861" PostTypeId="1" AcceptedAnswerId="9862" CreationDate="2020-02-14T02:37:03.720" Score="1" ViewCount="137" Body="&lt;p&gt;Quantum mechanics is based on the idea of waves, and waves have both a magnitude and a phase?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = i\alpha|0\rangle + \beta|1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; represent magnitude and &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; represent phase?&lt;/p&gt;&#xA;&lt;p&gt;Or how do we represent phase? Or is it something else?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="8757" LastEditDate="2020-07-08T10:23:54.357" LastActivityDate="2020-07-08T10:23:54.357" Title="Magnitudes and phases of coefficients of a qubit" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-07-11T21:20:53.200" ContentLicense="CC BY-SA 4.0" />
  <row Id="9862" PostTypeId="2" ParentId="9861" CreationDate="2020-02-14T07:23:16.340" Score="3" Body="&lt;p&gt;It is more common to write a qubit as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \alpha|0\rangle + \beta|1\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt;, i.e. to omit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and get it in complex number &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are called complex amplitudes, &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; is a probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; is a probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. So, &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; (or rather square of their absolute values) can be called &lt;strong&gt;&amp;quot;magnitude&amp;quot;&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Any qubit can be rewritten as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; are coordinates on so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this notation, &lt;span class=&quot;math-container&quot;&gt;$\cos^2(\theta/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta/2)$&lt;/span&gt; are probabilities (&lt;strong&gt;&amp;quot;magnitudes&amp;quot;&lt;/strong&gt;) of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, respecitively. Parameter &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is a &lt;strong&gt;phase&lt;/strong&gt; (or to be precise, relative phase).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="-1" LastEditDate="2020-07-07T23:03:16.810" LastActivityDate="2020-07-07T23:03:16.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9864" PostTypeId="1" CreationDate="2020-02-14T09:27:27.613" Score="3" ViewCount="87" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4135o.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4135o.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to run this qasm file using IBM device.&#xA;However, there's always an error: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.transpiler.exceptions.TranspilerError: 'Number of qubits (16) in circuit0 is greater than maximum (5) in the coupling_map'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How does this error come?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I set up the initial mapping when running this qasm file?&#xA;How to run the qasm file in Jupyter notebook?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2020-02-19T13:47:53.153" LastActivityDate="2020-02-19T13:47:53.153" Title="What is the source of this TranspilerError when running qasm file?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9865" PostTypeId="2" ParentId="9864" CreationDate="2020-02-14T09:42:26.707" Score="5" Body="&lt;p&gt;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 &lt;code&gt;qreg q[16];&lt;/code&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-14T09:42:26.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9866" PostTypeId="2" ParentId="9859" CreationDate="2020-02-14T12:39:19.860" Score="3" Body="&lt;p&gt;Remember that we're not told &lt;em&gt;what&lt;/em&gt; function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is being implemented by this circuit, it is simply claimed that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(y)$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$y=x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$x\oplus 11=\bar{x}$&lt;/span&gt;. So, we need to identify what the function is, and then we can verify if it has that property.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8sIA3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8sIA3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so, if the bit values of the first register are &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, we compute &lt;span class=&quot;math-container&quot;&gt;$0\oplus x=x$&lt;/span&gt; with the first controlled not, and &lt;span class=&quot;math-container&quot;&gt;$x\oplus y$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\oplus 11$&lt;/span&gt;, as required.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-14T12:39:19.860" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9867" PostTypeId="1" CreationDate="2020-02-14T20:54:38.137" Score="2" ViewCount="421" Body="&lt;p&gt;If I have an arbitrary non-unitary matrix of say&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{pmatrix}&#xA;1.5 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1.6 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp;  0 \\&#xA;\end{pmatrix}, &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is it possible to decompose it into gates implementable in qiskit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, how? If not, why not?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is is possible to have &lt;em&gt;any&lt;/em&gt; arbitrary non-unitary matrix as an input and get the corresponding gates that implement this arbitrary matrix?&lt;/p&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="23" LastEditDate="2020-02-19T23:49:37.097" LastActivityDate="2020-02-19T23:49:37.097" Title="Decomposition of an arbitrary gate using given matrix in Qiskit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9868" PostTypeId="2" ParentId="9800" CreationDate="2020-02-14T23:04:46.227" Score="6" Body="&lt;p&gt;To give an answer to part of your question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can we only use X,Y,Z,H and CNOT?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-02-14T23:04:46.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9870" PostTypeId="1" CreationDate="2020-02-15T13:31:22.297" Score="4" ViewCount="133" Body="&lt;p&gt;While I'm reading some literature about synthesizing quantum circuit, I couldn't understand what &lt;strong&gt;cascades of Toffoli gates&lt;/strong&gt; means. How Toffoli cascade runs in quantum circuit?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="55" LastEditDate="2020-02-19T13:49:11.230" LastActivityDate="2020-02-19T13:49:11.230" Title="What is a &quot;cascade of gates&quot;?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9871" PostTypeId="1" AcceptedAnswerId="9875" CreationDate="2020-02-15T17:56:42.213" Score="1" ViewCount="64" Body="&lt;p&gt;I want to implement two Toffoli gates with 4 qubits:&#xA;3 serving as control qubits (the 2 hadamard coins and one other qubit) and &#xA;the last one as target qubit and 3 qubits (2 coins 1 target qubits) as shown below :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2JHWN.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2JHWN.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a way of achieving this with qiskit's ccx function ?&#xA;I tried : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qnodes = QuantumRegister(2)&#xA; qsubnodes = QuantumRegister(2)&#xA; qc.ccx(subnode[0], subnode[1], q[1])&#xA;    if (q[1] ==1) : &#xA;        qc.x(q[0])&#xA;qc.x(q[1]) &#xA;qc.ccx(subnode[0], subnode[1], q[1])&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="10075" LastEditorUserId="5955" LastEditDate="2020-02-16T15:02:24.227" LastActivityDate="2020-02-16T15:02:24.227" Title="Achieve a control gate with 2 hadamard coins" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9872" PostTypeId="2" ParentId="9870" CreationDate="2020-02-15T22:25:42.067" Score="4" Body="&lt;p&gt;I think a &quot;cascade&quot; of gates is just a fancy word for a sequence of gates that follow a certain pattern. A good example is offered in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2178/2879&quot;&gt;this answer&lt;/a&gt; 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 &quot;cascade&quot; means anything more specific than that.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-02-15T22:25:42.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9873" PostTypeId="1" CreationDate="2020-02-16T03:40:20.377" Score="1" ViewCount="142" Body="&lt;p&gt;I understand the matrix multiplication behind Grover's algorithm, but I'd like to get an intuitive grasp on why sequence of gates &lt;em&gt;Hadamard-Phase-Hadamard&lt;/em&gt; does inversion about the mean. Can anyone help?&lt;/p&gt;&#xA;" OwnerUserId="10078" LastEditorUserId="9006" LastEditDate="2020-02-16T09:42:12.410" LastActivityDate="2020-02-16T09:42:12.410" Title="Hadamard/Phase/Hadamard and Inversion about the Mean" Tags="&lt;grovers-algorithm&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9874" PostTypeId="2" ParentId="9873" CreationDate="2020-02-16T06:32:03.760" Score="2" Body="&lt;p&gt;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 &quot;reflection&quot;, since it makes the geometrical interpretation a bit simpler, but I think they are used interchangeably.)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;First, let's convince ourselves that Controlled Z does inversion about the &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; state.&lt;br&gt;&#xA;Controlled Z flips the phase of &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; basis state and keeps the phases of other states unchanged, so it can be written as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I} - 2|1...1\rangle \langle 1...1|$&lt;/span&gt;, which is the reflection about the &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; (with an extra global phase of -1, which can be ignored).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Second, let's see how to represent reflection about any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in terms of reflection about the &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; state, given that we know a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that prepares state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; from the &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = U|1...1\rangle$&lt;/span&gt;.&lt;br&gt;&#xA;Reflection about &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you can represent that reflection by applying the following sequence of steps:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;reflection about the &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, let's see how to prepare the mean state &lt;span class=&quot;math-container&quot;&gt;$\sum_j |j\rangle$&lt;/span&gt;, starting with the &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; state.&lt;br&gt;&#xA;The easiest way is to apply X gate to each qubit to get &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt;, and then to apply H gate to each qubit to get an equal superposition of all basis states.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Putting this all together, we get the following procedure:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;apply H to each qubit&lt;/li&gt;&#xA;&lt;li&gt;apply X to each qubit&lt;/li&gt;&#xA;&lt;li&gt;apply Controlled Z with most qubits as control and last qubit as target&lt;/li&gt;&#xA;&lt;li&gt;apply X to each qubit&lt;/li&gt;&#xA;&lt;li&gt;apply H to each qubit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-02-16T06:32:03.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9875" PostTypeId="2" ParentId="9871" CreationDate="2020-02-16T11:44:52.910" Score="2" Body="&lt;p&gt;You can implement three-input Toffoli gate with three two-input Toffoli gates and one ancilla qubit as shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lSvZD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lSvZD.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; are three inputs and qubit &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; is a target. Qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; is ancilla qubit. The first gate implements function &lt;span class=&quot;math-container&quot;&gt;$q_0~ \mathrm{AND}~ q_1$&lt;/span&gt; and saves results of this operation to &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;. The second gate implements function &lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt;. &lt;strong&gt;Eventually, qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; control qubit &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt;.&lt;/strong&gt; The last gate is used for uncomputation ancilla qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; back to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code in QASM (&lt;em&gt;sorry, I am not experienced in Qiskit&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[5];&#xA;creg c[5];&#xA;&#xA;ccx q[0],q[1],q[3];&#xA;ccx q[2],q[3],q[4];&#xA;ccx q[0],q[1],q[3];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-16T11:44:52.910" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9876" PostTypeId="1" AcceptedAnswerId="9877" CreationDate="2020-02-16T17:28:05.050" Score="4" ViewCount="102" Body="&lt;p&gt;I am trying to read Nielsen's and Chuang's book on quantum computing and I am having problem understanding Deutsch's algorithm. &lt;a href=&quot;https://i.stack.imgur.com/CKoUr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CKoUr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to my understanding of the algorithm, the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. So is &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; after the &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; not the state we used as input? If not then what is the state? Every answer will be appreciated, thanks in advance. &lt;/p&gt;&#xA;" OwnerUserId="10085" LastEditorUserId="2879" LastEditDate="2020-02-16T18:50:59.273" LastActivityDate="2020-02-16T18:50:59.273" Title="How does $U_f$ in Deutsch's Algorithm affect the state $|x\rangle$?" Tags="&lt;nielsen-and-chuang&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9877" PostTypeId="2" ParentId="9876" CreationDate="2020-02-16T18:50:22.457" Score="2" Body="&lt;p&gt;This picture can be confusing, since it makes some assumptions that are not clear when you quickly scan through the text.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The picture of the oracle &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; describes its effect on the &lt;em&gt;basis states&lt;/em&gt; that go into it, not on arbitrary superposition states. If both &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; 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.&lt;/li&gt;&#xA;&lt;li&gt;Since the states fed to the oracle are in superposition, and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = |-\rangle$&lt;/span&gt;, &lt;em&gt;phase kickback&lt;/em&gt; happens: applying the oracle leaves &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; unchanged and modifies the phase of some of the basis states of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; depending on &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. This allows the final H gate to transform the first qubit into &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state depending on the values &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can read more details on the math behind this picture in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9838/understanding-steps-in-deutschs-algorithm&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-02-16T18:50:22.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9878" PostTypeId="1" CreationDate="2020-02-16T18:58:01.280" Score="2" ViewCount="86" Body="&lt;p&gt;I have been exploring quantum computing, I have no idea of decomposing arbitrary gates in Qiskit. Can someone help me with an example?&lt;/p&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="1859" LastEditDate="2020-11-03T14:12:50.393" LastActivityDate="2020-11-03T14:12:50.393" Title="How to decompose arbitrary gates in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;algorithm&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-03-01T15:30:24.293" ContentLicense="CC BY-SA 4.0" />
  <row Id="9879" PostTypeId="1" AcceptedAnswerId="9880" CreationDate="2020-02-16T23:09:18.250" Score="3" ViewCount="693" Body="&lt;p&gt;I'm new to quantum computing, but everything I've read about &lt;strong&gt;superdense coding&lt;/strong&gt; claims that, in the circuit below, Bob &lt;em&gt;should&lt;/em&gt; receive a &lt;span class=&quot;math-container&quot;&gt;$[01\rangle$&lt;/span&gt; from Alice.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/khA4h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/khA4h.png&quot; alt=&quot;Superdense Coding Circuit(01)&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately, that's not what I get I run the above circuit in either Qiskit or Circuit Composer. The latter results are shown below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/M7vVA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M7vVA.png&quot; alt=&quot;Superdense coding results (bar graph)&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I replace the Pauli-X gate with a Pauli-Z gate, the outcome is &lt;span class=&quot;math-container&quot;&gt;$[01\rangle$&lt;/span&gt;. What am I missing? &lt;/p&gt;&#xA;" OwnerUserId="10086" LastEditorUserId="9006" LastEditDate="2020-02-17T15:24:03.527" LastActivityDate="2020-02-17T15:24:03.527" Title="Superdense coding circuit returns wrong result" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9880" PostTypeId="2" ParentId="9879" CreationDate="2020-02-16T23:20:23.577" Score="4" Body="&lt;p&gt;Bit ordering convention in Qiskit is reversed to what is common in many physics textbooks.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From &lt;a href=&quot;https://qiskit.org/textbook/ch-states/atoms-computation.html#Encoding-an-input&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook:&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can also have a look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8244/big-endian-vs-little-endian-in-qiskit&quot;&gt;Big Endian vs. Little Endian in Qiskit (question on this stackexchange)&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Qiskit uses little-endian for both classical bit ordering and qubit ordering.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="10087" LastEditorUserId="1386" LastEditDate="2020-02-17T10:24:52.953" LastActivityDate="2020-02-17T10:24:52.953" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9883" PostTypeId="1" CreationDate="2020-02-17T00:56:32.020" Score="3" ViewCount="178" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10028" LastActivityDate="2020-02-17T21:13:25.900" Title="What is Quantum Phase Estimation in Shor's Algorithm?" Tags="&lt;shors-algorithm&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9884" PostTypeId="2" ParentId="9883" CreationDate="2020-02-17T07:53:33.353" Score="4" Body="&lt;p&gt;Phase estimation is the process by which you are given a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; unitary, and a state that you are promised is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi ix/2^t}$&lt;/span&gt;, then you can use a &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-qubit register to affect the change&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle^{\otimes t}|u\rangle\mapsto|y\rangle|u\rangle.&#xA;$$&lt;/span&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is in integer, then the outcome is guaranteed to be &lt;span class=&quot;math-container&quot;&gt;$y=x$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is not an integer, &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is, with high probability, the closest integer to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase-kickback is the way that we get something, apparently on the second register (i.e. the &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; being acted upon by &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) to change the first register. In effect, this is making use of the difference between global phase (as it would be for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) and relative phase in a superposition (which is what you actually get when you use controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-17T07:53:33.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9885" PostTypeId="2" ParentId="9851" CreationDate="2020-02-17T09:34:29.170" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Given that the QFT is exponentially faster than the FFT, &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Wave_function_collapse&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;collapse&quot;&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While you get all the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; frequency components with FFT, you'll basically just find &lt;em&gt;one&lt;/em&gt; frequency with QFT, and this works nicely in cases where you are only &lt;em&gt;interested in one&lt;/em&gt; frequency.  The latter is the case for Shor's algorithm where you basically compute the order of the multiplicative group of &lt;span class=&quot;math-container&quot;&gt;$\mathbb Z/n\mathbb Z$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10089" LastEditorUserId="2927" LastEditDate="2020-02-17T17:31:07.363" LastActivityDate="2020-02-17T17:31:07.363" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9886" PostTypeId="2" ParentId="9800" CreationDate="2020-02-17T16:45:43.917" Score="3" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/0803.2316.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shende and Markov 08&lt;/a&gt;: &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A circuit consisting of CNOT gates and one-qubit gates which implements the&#xA;  n-qubit TOFFOLI gate without ancillae requires at least 2n CNOT gates. For n = 3, this&#xA;  bound holds even when ancillae are permitted, and is achieved by the circuit of Figure 1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Where Figure 1 is just the circuit in the original question&lt;/p&gt;&#xA;" OwnerUserId="10087" LastActivityDate="2020-02-17T16:45:43.917" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9887" PostTypeId="1" CreationDate="2020-02-17T17:12:25.240" Score="0" ViewCount="52" Body="&lt;p&gt;How to retrieve the parameters of a Q# operation? Is it possible to do such a thing at all?&lt;/p&gt;&#xA;" OwnerUserId="8487" LastEditorUserId="8487" LastEditDate="2020-04-12T15:16:36.403" LastActivityDate="2020-04-12T15:16:36.403" Title="How to retrieve the parameters of a Q# operation?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9888" PostTypeId="2" ParentId="9824" CreationDate="2020-02-17T17:50:01.723" Score="2" Body="&lt;p&gt;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&gt; 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&lt;/p&gt;&#xA;" OwnerUserId="10087" LastActivityDate="2020-02-17T17:50:01.723" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9889" PostTypeId="2" ParentId="9883" CreationDate="2020-02-17T21:13:25.900" Score="2" Body="&lt;p&gt;If you want to learn more generally about phase estimation, the book I am helping write has a whole chapter on it, &lt;a href=&quot;https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Learn Quantum Computing with Python and Q#&lt;/a&gt; (chapter 8). &#xA;Ping me here or via &lt;a href=&quot;https://www.sckaiser.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;email&lt;/a&gt; and I can get you a discount code! &lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2020-02-17T21:13:25.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9890" PostTypeId="1" AcceptedAnswerId="9893" CreationDate="2020-02-18T01:53:27.170" Score="2" ViewCount="90" Body="&lt;p&gt;The paper &lt;a href=&quot;https://arxiv.org/abs/1810.08034&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum fidelity measures for mixed states&lt;/a&gt; considers various differently-normalized variants of the Hilbert-Schmidt inner product &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(A^\dagger B)$&lt;/span&gt; on linear operators as candidate measures of the fidelity &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; between two density operators &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; - that is,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F} = \frac{\mathrm{tr}(\rho \sigma)}{f \left(\mathrm{tr}(\rho^2), \mathrm{tr}(\sigma^2) \right)}$$&lt;/span&gt;&#xA;for various choices of normalization function &lt;span class=&quot;math-container&quot;&gt;$f(x,y)$&lt;/span&gt;. For various choices of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, they say which of the Jozsa axioms are and are not respected by that choice:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J1a. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}(\rho, \sigma) \in [0, 1]$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J1b. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}(\rho, \sigma) = 1 \iff \rho = \sigma$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J1c. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}(\rho, \sigma) = 0 \iff \rho \sigma = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J2. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}(\rho, \sigma) = \mathcal{F}(\sigma, \rho)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J3. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}(\rho, \sigma) = \mathrm{tr}(\rho \sigma)$&lt;/span&gt; if either &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is a pure state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J4. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}(U \rho U^\dagger, U \sigma U^\dagger) = \mathcal{F}(\rho, \sigma)$&lt;/span&gt; for any unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But oddly enough, they never discuss which of these axioms are respected by the simplest choice of normalization of all: &lt;span class=&quot;math-container&quot;&gt;$f \equiv 1$&lt;/span&gt;, which gives the Hilbert-Schmidt inner product itself as the candidate fidelity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="55" LastEditDate="2020-10-28T09:25:38.733" LastActivityDate="2020-10-28T09:25:38.733" Title="Which of the Jozsa axioms does the Hilbert-Schmidt inner product violate?" Tags="&lt;deutsch-jozsa-algorithm&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9891" PostTypeId="1" AcceptedAnswerId="9938" CreationDate="2020-02-18T02:10:08.980" Score="14" ViewCount="310" Body="&lt;p&gt;The (Uhlmann-Josza) &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;fidelity of quantum states&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is defined to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho, \sigma) := \left(\mathrm{tr} \left[\sqrt{\sqrt{\rho} \sigma \sqrt{\rho}} \right]\right)^2.$$&lt;/span&gt;&#xA;However, as discussed &lt;a href=&quot;https://math.stackexchange.com/q/3549539/268333&quot;&gt;here&lt;/a&gt;, the cyclical property of the trace extends to arbitrary analytic functions:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}[f(AB)] \equiv \mathrm{tr}[f(BA)]$$&lt;/span&gt;&#xA;for any analytic function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; whenever either side is well-defined. Letting &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; be the square root function, this seems to imply that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho, \sigma) \equiv \big(\mathrm{tr} \left[\sqrt{\rho \sigma} \right]\big)^2,$$&lt;/span&gt;&#xA;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.)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Am I correct that these two expressions are equivalent?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If so, is there any reason why the much clunkier former expression with nested square roots is always given?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/532223/58382&quot;&gt;Related on physics.SE&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="55" LastEditDate="2020-10-28T09:27:16.227" LastActivityDate="2020-10-28T09:27:16.227" Title="Can we combine the square roots inside the definition of the fidelity?" Tags="&lt;fidelity&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9893" PostTypeId="2" ParentId="9890" CreationDate="2020-02-18T07:33:43.387" Score="2" Body="&lt;p&gt;You could probably reach the same conclusions by identifying that &lt;span class=&quot;math-container&quot;&gt;$tr(\rho \sigma)$&lt;/span&gt; is just the expectation value of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; under the mixed state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, but let's do it explicitly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_i p_i |\psi_i\rangle \langle \psi_i|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma = \sum_i q_i |\phi_i\rangle \langle \phi_i|$&lt;/span&gt;, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$tr(\rho \sigma)$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\sum_{ij} p_i q_j tr(|\psi_i\rangle \langle \psi_i|\phi_j\rangle \langle \phi_j|)$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\sum_{ij} p_i q_j |\langle \psi_i|\phi_j\rangle |^2$&lt;/span&gt; by the trace cyclic property and the fact that the trace of a scalar is the scalar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J1a is true because &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi_i|\phi_j\rangle |$&lt;/span&gt; are all larger or equal zero and smaller or equal one so:&#xA;&lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;J1b is false because &lt;span class=&quot;math-container&quot;&gt;$tr(\rho \sigma) = tr(\rho^2) &amp;lt; 1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\rho = \sigma$&lt;/span&gt; a non-pure state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;J1c is true because right to left direction is trivial. For left to right direction suppose &lt;span class=&quot;math-container&quot;&gt;$tr(\rho \sigma) = \sum_{ij} p_i q_j |\langle \psi_i|\phi_j\rangle |^2$&lt;/span&gt; = 0, so &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_i|\phi_j\rangle  = 0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; in the mixed states (i.e. &lt;span class=&quot;math-container&quot;&gt;$p_i, q_j \neq 0$&lt;/span&gt;). Then &lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt; by the assumption.&lt;/p&gt;&#xA;" OwnerUserId="10087" LastEditorUserId="10087" LastEditDate="2020-02-18T16:36:18.757" LastActivityDate="2020-02-18T16:36:18.757" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="9894" PostTypeId="1" AcceptedAnswerId="9898" CreationDate="2020-02-18T18:12:55.830" Score="3" ViewCount="205" Body="&lt;p&gt;In the &lt;a href=&quot;https://arxiv.org/pdf/1411.4028.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;QAOA algorithm for MaxCut&lt;/a&gt;, the authors construct a very specific scheme where the qubits (corresponding to the vertices of the graph) are transformed using a sequence of unitaries &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$\vert s\rangle$&lt;/span&gt; is an intial state constructed by a Hadamard on the all zero state. The &lt;span class=&quot;math-container&quot;&gt;$U(B, \beta_i)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U(C,\gamma_i)$&lt;/span&gt; are also specific unitaries that the authors construct. The alternating sequence of &lt;span class=&quot;math-container&quot;&gt;$U(B, \beta_i)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U(C,\gamma_i)$&lt;/span&gt; is also specified. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;QAOA works by iteratively measuring the output state &lt;span class=&quot;math-container&quot;&gt;$|\gamma, \boldsymbol{\beta}\rangle$&lt;/span&gt;. It uses a classical optimizer to choose the next set of angles &lt;span class=&quot;math-container&quot;&gt;$\{\beta_i\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\gamma_i\}$&lt;/span&gt;. This is repeated until the classical optimizer converges and the final measurement on the state &lt;span class=&quot;math-container&quot;&gt;$|\gamma, \boldsymbol{\beta}\rangle$&lt;/span&gt; gives us the information of how to cut the graph.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-02-18T22:41:21.720" Title="QAOA for MaxCut - Algorithm motivation" Tags="&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9895" PostTypeId="1" AcceptedAnswerId="9896" CreationDate="2020-02-18T10:18:02.907" Score="1" ViewCount="139" Body="&lt;p&gt;I have two ebits &lt;span class=&quot;math-container&quot;&gt;$e1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e2$&lt;/span&gt; and my 4-qubit system is in the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(|00\rangle + |11\rangle) (|00\rangle + |11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ignoring the normalizing constants for now. As mentioned, I need to obtain &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle + |1111\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle + |10\rangle + |11\rangle$&lt;/span&gt;, and I only know how to entangle if we were starting in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; (or even if we're in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle(|0\rangle + |1\rangle)$&lt;/span&gt;, which is what we get after H gate). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this possible to do?&lt;/p&gt;&#xA;" OwnerDisplayName="Peeyush Kushwaha" LastEditorUserId="55" LastEditDate="2020-10-28T09:25:22.473" LastActivityDate="2020-10-29T12:09:32.617" Title="Further entangling two ebits to obtain $|0000\rangle + |1111\rangle$ state" Tags="&lt;entanglement&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9896" PostTypeId="2" ParentId="9895" CreationDate="2020-02-18T13:09:21.073" Score="5" Body="&lt;p&gt;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{4}\left(\begin{array}{cc}1&amp;amp;0\\0&amp;amp;1\end{array}\right)\otimes \left(\begin{array}{cc}1&amp;amp;0\\0&amp;amp;1\end{array}\right),$$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are you allowed to use measurements on the second and third qubits?&lt;/p&gt;&#xA;" OwnerUserId="1765" OwnerDisplayName="Peter Shor" LastActivityDate="2020-02-18T13:29:04.587" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9898" PostTypeId="2" ParentId="9894" CreationDate="2020-02-18T22:41:21.720" Score="6" Body="&lt;p&gt;What motivated this construction is mentioned in the original paper (section VI): &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;noreferrer&quot;&gt;adiabatic quantum computing&lt;/a&gt;. This construction is basically a Trotterized version of the evolution by the time dependent hamiltonian: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H(t) = (1-t/T)B + (t/T) C $$&lt;/span&gt;&#xA;where T is the total runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Trotterized evolution consists of alternately applying &lt;span class=&quot;math-container&quot;&gt;$U_{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_{B}$&lt;/span&gt;. &#xA;Here, the sum of the angles is the total runtime T. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. And to the limit of infinite depth, you get convergence.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-02-18T22:41:21.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9899" PostTypeId="2" ParentId="9895" CreationDate="2020-02-18T23:02:49.927" Score="1" Body="&lt;p&gt;If you allow for measurements and communication of measurement outcomes, and joint operations on qubits 2 and 3, parties &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; can prepare the desired state locally and teleport it to 1 and 4.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-02-18T23:02:49.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9900" PostTypeId="1" CreationDate="2020-02-19T04:22:29.133" Score="1" ViewCount="33" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="55" LastEditDate="2020-02-19T11:37:30.297" LastActivityDate="2020-02-19T11:37:30.297" Title="What are the different ways of representing unitary gates in terms of the matrix?" Tags="&lt;algorithm&gt;&lt;quantum-gate&gt;&lt;programming&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9902" PostTypeId="1" AcceptedAnswerId="9945" CreationDate="2020-02-19T06:38:40.027" Score="1" ViewCount="181" Body="&lt;p&gt;Delayed choice entanglement swapping.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We follow the calculations in the &lt;a href=&quot;https://arxiv.org/abs/1203.4834&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Phi^+=\frac{1}{\sqrt{2}}(\vert 00\rangle+\vert 11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Phi^-=\frac{1}{\sqrt{2}}(\vert 00\rangle-\vert 11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Psi^+=\frac{1}{\sqrt{2}}(\vert 01\rangle+\vert 10\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Psi^-=\frac{1}{\sqrt{2}}(\vert 01\rangle-\vert 10\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 00\rangle=\frac{1}{\sqrt{2}}(\Phi^+ + \Phi^-)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 11\rangle=\frac{1}{\sqrt{2}}(\Phi^+ - \Phi^-)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 01\rangle=\frac{1}{\sqrt{2}}(\Psi^+ + \Psi^-)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 10\rangle=\frac{1}{\sqrt{2}}(\Psi^+ - \Psi^-)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Two pairs of entangled photons (1&amp;amp;2 and 3&amp;amp;4) are each produced in the antisymmetric polarization entangled Bell singlet state such that the total four photon state has the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert \Psi\rangle_{1234}=\vert \Psi^-\rangle_{12}\otimes\vert\Psi^-\rangle_{34}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In short, we write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert \Psi\rangle_{1234}=\Psi^-_{12}\otimes\Psi^-_{34}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi\rangle_{1234}$&lt;/span&gt; in the basis of Bell states of photons 2 and 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is relation (2) in the paper linked above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is though another  way based on statistics and a reliable entanglement witness.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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  &lt;a href=&quot;https://arxiv.org/abs/1512.06213&quot; rel=&quot;nofollow noreferrer&quot;&gt;reliable procedure of entanglement detection &lt;/a&gt; . And they don't need to compare their records with Victor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the paper above it is discussed &lt;strong&gt;witnessing entanglement without entanglement witness operators&lt;/strong&gt;.  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 &lt;strong&gt;interference signal&lt;/strong&gt;. If followed closely, this method &lt;strong&gt;never gives false positives&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the protocol described , when Victor (the transmitter) and Alice and Bob (the receiver) measure N pairs of photons, then  with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4^N}$&lt;/span&gt;  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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In principle the problem seems to allow a solution.  Reliable entanglement detection seems to circumvent the no - signalling theorem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: Is back in time (classical) information transfer possible? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/531447/is-back-in-time-classical-information-transfer-possible-based-on-delayed-cho&quot;&gt;&lt;strong&gt;&lt;em&gt;Cross-posted on physics.SE&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="55" LastEditDate="2020-10-28T09:25:08.140" LastActivityDate="2020-10-28T09:25:08.140" Title="Is back in time (classical) information transfer possible (based on delayed choice entanglement swapping)?" Tags="&lt;entanglement&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9903" PostTypeId="2" ParentId="9900" CreationDate="2020-02-19T06:40:09.290" Score="3" Body="&lt;p&gt;A unitary gate is described by a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. (Note that this gate can have different representations as a matrix depending on what basis you choose to use.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V^\dagger U$&lt;/span&gt; satisfy this for any unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and, indeed, you can generalise it to the case of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; 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!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-19T06:40:09.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9904" PostTypeId="1" AcceptedAnswerId="9922" CreationDate="2020-02-19T11:16:13.813" Score="3" ViewCount="50" Body="&lt;p&gt;Recently, I started to study practical application of ZX calculus but I am confused by meaning of &quot;diamond&quot; and &quot;loop&quot;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue no. 1:&lt;/strong&gt;&#xA;There are these rules:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;B-rule&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LHCT4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LHCT4.png&quot; alt=&quot;b-rule&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;em&gt;D-rule&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1X8Oq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1X8Oq.png&quot; alt=&quot;d-rule&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this example seems to use the rules wrongly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZKMMc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZKMMc.png&quot; alt=&quot;Example 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar situation occurs in this example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gWvQI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gWvQI.png&quot; alt=&quot;Example 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why is it possible to ignore loop and diamonds?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Issue no. 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpreation of a diamond in Hilbert space is this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Diamond = &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does mean that diamond is &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;? &lt;strong&gt;Is it a normalization constant?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interpreation of a loop in Hilbert space is this:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Loop represent the dimension of underlying Hilbert space&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Assuming D-rule, loop should represent two diamonds hence &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}\sqrt{2} = 2$&lt;/span&gt; which is dimension of Hilbert space for description of single qubit states. But ZX calculus can be used for any number of qubits. &lt;strong&gt;What does it mean that loop represent a dimension? How is a dimension of &quot;multi-qubits&quot; Hilbert space represented?&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-20T15:56:51.970" Title="ZX calculus: What do diamond and loop mean?" Tags="&lt;zx-calculus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9905" PostTypeId="1" CreationDate="2020-02-19T12:15:30.923" Score="2" ViewCount="39" Body="&lt;p&gt;I am wondering how to simulate spin-1 systems with qiskit or on the IBMQ&#xA;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. &lt;/p&gt;&#xA;" OwnerUserId="10112" LastEditorUserId="55" LastEditDate="2020-02-19T12:42:27.867" LastActivityDate="2020-02-19T12:42:27.867" Title="How to simulate spin-1 systems with qiskit or on the IBMQ platform?" Tags="&lt;qiskit&gt;&lt;qudit&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9906" PostTypeId="1" AcceptedAnswerId="9908" CreationDate="2020-02-19T12:37:01.977" Score="2" ViewCount="80" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Pva30.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pva30.png&quot; alt=&quot;32X32 matrix&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Chzd7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Chzd7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="9006" LastEditDate="2020-02-19T13:55:53.483" LastActivityDate="2020-02-19T13:55:53.483" Title="How to make circuit of a 32 X 32 matrix?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9907" PostTypeId="2" ParentId="9855" CreationDate="2020-02-19T12:51:21.643" Score="2" Body="&lt;p&gt;Given an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in a space &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt;, you can always find a pure state &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\tr}{\operatorname{Tr}}\newcommand{\ket}[1]{|#1\rangle}\newcommand{\ketbra}[1]{|#1\rangle\!\langle #1|}\ket\psi$&lt;/span&gt; on some &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho=\tr_B(\ketbra\psi)$&lt;/span&gt;. Any such &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; is called a &lt;em&gt;purification&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;If the eigendecomposition of your &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; reads &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_k p_k\ketbra{\psi_k}$&lt;/span&gt;, any pure of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \ket\psi = \sum_k \sqrt{p_k} \ket{\psi_k}\otimes\ket{u_k},&#xA;$$&lt;/span&gt;&#xA;for any set of orthonormal vectors &lt;span class=&quot;math-container&quot;&gt;$\ket{u_k}$&lt;/span&gt;, is a viable purification.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To actually generate experimentally such a &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, two straightforward ways are&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Actually run the experiment using the different &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_k}$&lt;/span&gt; as input, rather than &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. You can then mix the experimental outcomes according to the weights &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt;. This will give you identical answers as if you used &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use a purification &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; as input for the experiment, but only operate and measure a part of the system (what we denoted with &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt; above).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This depends on why you want to use a non-pure state to begin with.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-02-19T12:51:21.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9908" PostTypeId="2" ParentId="9906" CreationDate="2020-02-19T13:29:53.763" Score="4" Body="&lt;p&gt;If I'm reading your matrix correctly, it can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(\theta)I+i\sin(\theta)Z\otimes X^{\otimes 4}.&#xA;$$&lt;/span&gt;&#xA;So, if I were you, I'd start by performing a rotation &lt;span class=&quot;math-container&quot;&gt;$R_z(2\theta)$&lt;/span&gt; on the first qubit, creating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\cos(\theta)I+i\sin(\theta)Z)\otimes I,&#xA;$$&lt;/span&gt;&#xA;and then apply four controlled-nots, controlled off each of the other 4 qubits, and targetting the first qubit. That creates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(\theta)I+i\sin(\theta)Z^{\otimes 5}.&#xA;$$&lt;/span&gt;&#xA;You can then convert the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s into &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s using Hadamards. Overall, the circuit looks something like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8Z5iL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8Z5iL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-19T13:29:53.763" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9909" PostTypeId="1" CreationDate="2020-02-19T14:39:43.097" Score="2" ViewCount="93" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Deq0j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Deq0j.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a sample IBM experience circuit which generates &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|00\rangle - |01\rangle - |10\rangle + |11\rangle)$$&lt;/span&gt; &#xA;When we measure the state will be either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;/&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;/&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;/&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to know if the circuit has produced my desired state. I want to view the full state.&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="8620" LastEditDate="2020-02-19T15:10:21.190" LastActivityDate="2020-02-19T15:40:07.837" Title="Can we capture phase in IBM Quantum Experience?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9910" PostTypeId="2" ParentId="9909" CreationDate="2020-02-19T14:53:35.387" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can load the circuit by using &lt;code&gt;QuantumCircuit.from_qasm_str('your QASM')&lt;/code&gt; and you can then get the simulator using &lt;code&gt;Aer.get_backend('statevector_simulator')&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-19T14:53:35.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9911" PostTypeId="2" ParentId="5904" CreationDate="2020-02-19T15:37:31.653" Score="3" Body="&lt;p&gt;I was recently looking for a similar solution. Hope this helps.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(qc, backend=backend, shots=1024)&#xA;results = job.result()&#xA;print(results.time_taken)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also check all the values stored in result as it is a dictionary by printing it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(results)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here you can check for all the information that is available within the dictionary and you can also observe the value for &lt;em&gt;'time_taken'&lt;/em&gt;                    &lt;/p&gt;&#xA;" OwnerUserId="10114" LastActivityDate="2020-02-19T15:37:31.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9912" PostTypeId="2" ParentId="9909" CreationDate="2020-02-19T15:40:07.837" Score="3" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UMBwE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UMBwE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;Click on the icon with graph on left hand-side from window with qasm code. You will see theoretical output of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;+1 for Martin Vesely's comment.&lt;/p&gt;&#xA;" OwnerUserId="8620" LastActivityDate="2020-02-19T15:40:07.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9913" PostTypeId="1" AcceptedAnswerId="9919" CreationDate="2020-02-19T16:15:33.640" Score="5" ViewCount="268" Body="&lt;p&gt;It is well known that entanglement in a quantum state is not affected when you perform a combination of 1-qubit unitary transformations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have seen that the QFT can be decomposed into product of 1-qubit unitary transformations (for example in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiki&lt;/a&gt;). However, it is not very clear that QFT preserves entanglement or not. I have seen sources suggesting that it does, doesn't, and unclear.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone have a definite answer for this question?&lt;/p&gt;&#xA;" OwnerUserId="6174" LastEditorUserId="55" LastEditDate="2020-02-20T10:12:03.290" LastActivityDate="2020-02-20T10:12:03.290" Title="Does the Quantum Fourier Transform (QFT) preserve entanglement?" Tags="&lt;entanglement&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9914" PostTypeId="1" AcceptedAnswerId="9916" CreationDate="2020-02-19T16:39:58.750" Score="0" ViewCount="35" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is &lt;span class=&quot;math-container&quot;&gt;$|\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My calculation suggests that the probability of the ancilla being in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_{0} =\frac{1}{2} + \frac{1}{2}|\langle\psi_a | \psi_b \rangle|^2 $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7439" LastEditorUserId="7439" LastEditDate="2020-02-19T19:03:38.870" LastActivityDate="2020-02-20T01:52:48.217" Title="Getting dot product from two wavefunctions" Tags="&lt;mathematics&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9915" PostTypeId="1" CreationDate="2020-02-19T21:16:41.160" Score="1" ViewCount="263" Body="&lt;p&gt;In section 3.3.2 of &lt;a href=&quot;http://www.phy.cuhk.edu.hk/itp/v3/news/ShamLJ_lecture-note2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this PDF&lt;/a&gt;, The general SWAP gate is defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;S (\alpha, \hat{y}) = \begin{bmatrix} &#xA;1  &amp;amp;  0  &amp;amp;  0  &amp;amp;  0  \\&#xA;0  &amp;amp;  \cos(\alpha/2)  &amp;amp;  -\sin(\alpha/2)  &amp;amp;  0  \\&#xA;0  &amp;amp;  \sin(\alpha/2) &amp;amp;  \cos(\alpha/2)  &amp;amp;  0  \\&#xA;0  &amp;amp;  0  &amp;amp;  0  &amp;amp;  1 \\&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same lecture notes claim that for &lt;span class=&quot;math-container&quot;&gt;$\alpha = \pi$&lt;/span&gt;, you get the SWAP gate. This is not correct if we perform the computation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;S (\pi, \hat{y}) = \begin{bmatrix} &#xA;1  &amp;amp;  0  &amp;amp;  0  &amp;amp;  0  \\&#xA;0  &amp;amp;  0  &amp;amp;  -1  &amp;amp;  0  \\&#xA;0  &amp;amp;  1 &amp;amp;  0  &amp;amp;  0  \\&#xA;0  &amp;amp;  0  &amp;amp;  0  &amp;amp;  1 \\&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Those lecture notes also say the square root of SWAP can be created by setting &lt;span class=&quot;math-container&quot;&gt;$\alpha=\frac{\pi}{2}$&lt;/span&gt;. When we do that we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;S (\frac{\pi}{2}, \hat{y}) = \begin{bmatrix} &#xA;1  &amp;amp;  0  &amp;amp;  0  &amp;amp;  0  \\&#xA;0  &amp;amp;  \frac{1}{\sqrt{2}}  &amp;amp;  -\frac{1}{\sqrt{2}}  &amp;amp;  0  \\&#xA;0  &amp;amp;  \frac{1}{\sqrt{2}} &amp;amp;  \frac{1}{\sqrt{2}}  &amp;amp;  0  \\&#xA;0  &amp;amp;  0  &amp;amp;  0  &amp;amp;  1 \\&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2468/362&quot;&gt;The matrix for the square root of Swap&lt;/a&gt; is &#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix} &#xA;1  &amp;amp;  0  &amp;amp;  0  &amp;amp;  0  \\&#xA;0  &amp;amp;  \frac{1}{{2}} (1+i)  &amp;amp;  \frac{1}{{2}} (1-i)  &amp;amp;  0  \\&#xA;0  &amp;amp;  \frac{1}{{2}} (1-i)  &amp;amp;  \frac{1}{{2}} (1+i)  &amp;amp;  0  \\&#xA;0  &amp;amp;  0  &amp;amp;  0  &amp;amp;  1 \\&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="9006" LastEditDate="2020-02-20T12:43:32.493" LastActivityDate="2020-11-16T15:03:55.560" Title="What is the general matrix for the Swap gate?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9916" PostTypeId="2" ParentId="9914" CreationDate="2020-02-20T01:52:48.217" Score="1" Body="&lt;p&gt;Your calculation is correct, given the state and conclusion that you have written. The book may be unclear, or have a typo.&lt;/p&gt;&#xA;" OwnerUserId="10115" LastActivityDate="2020-02-20T01:52:48.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9917" PostTypeId="2" ParentId="9913" CreationDate="2020-02-20T01:56:55.317" Score="7" Body="&lt;p&gt;I expect you're referring to this image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OdMOD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OdMOD.png&quot; alt=&quot;from Wikipedia&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where it says that &lt;span class=&quot;math-container&quot;&gt;$R_m$&lt;/span&gt; is given by a particular 2x2 matrix. In this notation, &lt;span class=&quot;math-container&quot;&gt;$R_m$&lt;/span&gt; is a 1-qubit unitary, but the circuit is applying a different gate, what we might call &lt;span class=&quot;math-container&quot;&gt;$CR_m$&lt;/span&gt;: a &lt;em&gt;controlled&lt;/em&gt; version of &lt;span class=&quot;math-container&quot;&gt;$R_m$&lt;/span&gt;. This is a 2-qubit gate, given by a 4x4 matrix, with the definition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CR_m (|0\rangle |\psi\rangle) = |0\rangle |\psi\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CR_m (|1\rangle |\psi\rangle) = |1\rangle (R_m |\psi\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10115" LastActivityDate="2020-02-20T01:56:55.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9918" PostTypeId="1" CreationDate="2020-02-20T05:36:53.457" Score="3" ViewCount="210" Body="&lt;p&gt;I have been working on implementing Jozsa-Deutsch decision algorithm, Grover search algorithm, Shor factorization algorithm on my home-made 2 qubits device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="11925" LastEditDate="2020-05-04T08:29:29.523" LastActivityDate="2020-05-04T08:29:29.523" Title="Any other quantum algorithms than Jozsa-Deutsch decision algorithm, Grover search algorithm, Shor factorization algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;shors-algorithm&gt;&lt;hhl-algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9919" PostTypeId="2" ParentId="9913" CreationDate="2020-02-20T07:29:41.460" Score="4" Body="&lt;p&gt;TLDR: the Fourier transform is entangling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can immediately agree on two things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if you input a computational basis state (separable) to the Fourier transform, it outputs a separable state&lt;/li&gt;&#xA;&lt;li&gt;the circuit involves entangling gates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7yq0B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7yq0B.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is easy to analyse because there's only one entangling gate: the controlled-&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. Any single-qubit gates that come after it do not affect entanglement. Now, if controlled-&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; acted on an input of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|+\rangle$&lt;/span&gt;, it would create entanglement. So, we can work backwards: if I input &lt;span class=&quot;math-container&quot;&gt;$(H\otimes I)|+\rangle|+\rangle=|0+\rangle$&lt;/span&gt; to the circuit, the output must be entangled. Separable input yields entangled output, so the circuit is entangling.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-20T07:29:41.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9920" PostTypeId="2" ParentId="9918" CreationDate="2020-02-20T08:00:46.810" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;You can however implement algorithms&lt;/strong&gt; based on uniformly controlled rotation used for preparing arbitrary quantum state. See details in the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you can implement toy-model (adding two single bit numbers) of adder based on Fourier transformation. See paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0008033&quot; rel=&quot;nofollow noreferrer&quot;&gt;Addition on a Quantum Computer&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, you can play with quantum tomography on one and two qubits. See this thread for more information how to do the tomography: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9683/implementation-of-tomography-on-ibm-q/9688#9688&quot;&gt;Implementation of tomography on IBM Q&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-20T08:00:46.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9921" PostTypeId="2" ParentId="9915" CreationDate="2020-02-20T14:22:39.537" Score="1" Body="&lt;p&gt;A gate &lt;span class=&quot;math-container&quot;&gt;$S (\alpha, \hat{y})$&lt;/span&gt; implements this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hvEHL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hvEHL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of code for &lt;span class=&quot;math-container&quot;&gt;$\alpha = \pi/4$&lt;/span&gt; (other parameters of &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; have to be set as stated):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cx q[1], q[0];&#xA;cu3(pi/4,-pi,pi) q[0],q[1];&#xA;cx q[1], q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;span class=&quot;math-container&quot;&gt;$\alpha = \pi$&lt;/span&gt; leads to &lt;strong&gt;something similar to swap gate up to a phase&lt;/strong&gt; for input &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; in which case &lt;span class=&quot;math-container&quot;&gt;$-|01\rangle$&lt;/span&gt; is returned.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-20T14:22:39.537" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9922" PostTypeId="2" ParentId="9904" CreationDate="2020-02-20T15:56:51.970" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For a multi-qubit system, you represent an identity operator with several wires. If you trace them, you get dimension equal to &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, and in the diagram you represent this dimension as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; disjoint loops each contributing a factor of 2.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2020-02-20T15:56:51.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9923" PostTypeId="2" ParentId="9918" CreationDate="2020-02-20T17:05:14.880" Score="3" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/DavitKhach/quantum-algorithms-tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/DavitKhach/quantum-algorithms-tutorials&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-02-20T17:13:35.430" LastActivityDate="2020-02-20T17:13:35.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9924" PostTypeId="1" CreationDate="2020-02-20T17:20:36.823" Score="1" ViewCount="356" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ibmq_qasm_simulator ::&#xA;&lt;a href=&quot;https://i.stack.imgur.com/V826I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V826I.png&quot; alt=&quot;ibmq_qasm_simulator&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ibmq_16_melbourne ::&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5cmZG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5cmZG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[6];&#xA;creg c[6];&#xA;&#xA;ry(1.57079631679) q[0];&#xA;ry(1.57079631679) q[1];&#xA;ry(1.57079631679) q[2];&#xA;ry(1.57079631679) q[3];&#xA;ry(1.57083295585) q[4];&#xA;ry(1.98263774407) q[5];&#xA;cx q[0],q[1];&#xA;ry(-0.00000001000) q[1];&#xA;cx q[0],q[1];&#xA;cx q[1],q[2];&#xA;ry(-0.00000001000) q[2];&#xA;cx q[0],q[2];&#xA;ry(-0.00000001000) q[2];&#xA;cx q[1],q[2];&#xA;ry(-0.00000001000) q[2];&#xA;cx q[0],q[2];&#xA;cx q[2],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[1],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[2],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[0],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[2],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[1],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[2],q[3];&#xA;ry(-0.00000001000) q[3];&#xA;cx q[0],q[3];&#xA;cx q[3],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[2],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[3],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[1],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[3],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[2],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[3],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[0],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[3],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[2],q[4];&#xA;ry(-0.78523504324) q[4];&#xA;cx q[3],q[4];&#xA;ry(-0.78523504324) q[4];&#xA;cx q[1],q[4];&#xA;ry(0.78530830134) q[4];&#xA;cx q[3],q[4];&#xA;ry(-0.78523504324) q[4];&#xA;cx q[2],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[3],q[4];&#xA;ry(0.00003662905) q[4];&#xA;cx q[0],q[4];&#xA;cx q[4],q[5];&#xA;ry(0.17720720528) q[5];&#xA;cx q[3],q[5];&#xA;ry(0.17720720528) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.01914233557) q[5];&#xA;cx q[2],q[5];&#xA;ry(0.01914233557) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.21549187642) q[5];&#xA;cx q[3],q[5];&#xA;ry(0.17720720528) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.01914233557) q[5];&#xA;cx q[1],q[5];&#xA;ry(0.01914233557) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.17720720528) q[5];&#xA;cx q[3],q[5];&#xA;ry(-0.21549187642) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.01914233557) q[5];&#xA;cx q[2],q[5];&#xA;ry(-0.76625582782) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.17720720528) q[5];&#xA;cx q[3],q[5];&#xA;ry(0.17720720528) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.37355674613) q[5];&#xA;cx q[0],q[5];&#xA;ry(0.21549187642) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.01914233557) q[5];&#xA;cx q[3],q[5];&#xA;ry(-0.01914233557) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.17720720528) q[5];&#xA;cx q[2],q[5];&#xA;ry(-0.17720720528) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.37355674613) q[5];&#xA;cx q[3],q[5];&#xA;ry(-0.80454049897) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.17720720528) q[5];&#xA;cx q[1],q[5];&#xA;ry(-0.17720720528) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.01914233557) q[5];&#xA;cx q[3],q[5];&#xA;ry(-0.41184141727) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.17720720528) q[5];&#xA;cx q[2],q[5];&#xA;ry(-0.17720720528) q[5];&#xA;cx q[4],q[5];&#xA;ry(-0.01914233557) q[5];&#xA;cx q[3],q[5];&#xA;ry(-0.01914233557) q[5];&#xA;cx q[4],q[5];&#xA;ry(0.21549187642) q[5];&#xA;cx q[0],q[5];&#xA;measure q[0] -&amp;gt; c[5];&#xA;measure q[1] -&amp;gt; c[4];&#xA;measure q[2] -&amp;gt; c[3];&#xA;measure q[3] -&amp;gt; c[2];&#xA;measure q[4] -&amp;gt; c[1];&#xA;measure q[5] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="55" LastEditDate="2020-08-12T08:34:02.147" LastActivityDate="2020-08-12T08:34:02.147" Title="Why IBM Quantum Experience is giving different results under ibmq_qasm_simulator and ibmq_16_melbourne?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9925" PostTypeId="2" ParentId="9924" CreationDate="2020-02-20T17:39:09.700" Score="5" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, qubits are not connected each other (&lt;em&gt;this is not the case on the simulator&lt;/em&gt;), 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-20T17:39:09.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9926" PostTypeId="1" AcceptedAnswerId="9928" CreationDate="2020-02-20T20:55:47.340" Score="0" ViewCount="55" Body="&lt;p&gt;I would like to know which property is being used in this example. &#xA;For &lt;span class=&quot;math-container&quot;&gt;$Tr_1$&lt;/span&gt; the partial trace on the first system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr_1[(|0\rangle\otimes|0\rangle)(\langle 0| \otimes \langle0|)] =|0\rangle\langle0|\langle 0 | 0 \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The property that I can imagine used are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the ciclicity of the trace,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Tr[AB]=Tr[BA]$&lt;/span&gt;, &lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Tr[v_1^Tv_2] = (v_1,v_2)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="9006" LastEditDate="2020-02-20T21:10:05.567" LastActivityDate="2020-02-21T05:43:19.350" Title="Which simple property of partial trace are we using here?" Tags="&lt;partial-trace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9927" PostTypeId="2" ParentId="9924" CreationDate="2020-02-20T21:32:50.273" Score="1" Body="&lt;p&gt;&lt;strong&gt;The brief answer would be, due to the introduced noise on a real quantum device.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Typically the two main sources of noise, on a real device, are &lt;strong&gt;gate-infidelity&lt;/strong&gt; and &lt;strong&gt;decoherence&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In order to understand gate fidelity, you have to know the difference between a physical(native) gate and a logical (software-visible) gate.&#xA;When you are implementing on an IBM device, you'd have the following gate set to use in your circuit: &lt;code&gt;{I,X,Y,Z,H,S,S†,T,T†,U1(λ),U2(λ,φ),U3(λ,φ,θ),CNOT}&lt;/code&gt;.&#xA;Any gate you use, will be translated into products of three physical gates,&lt;code&gt;{U1(λ), RX (π/2), CNOT}&lt;/code&gt; in the hardware level.&#xA;So gate infidelity refers to the fact that the software gate does not precisely map (implement) to the physically implemented gate.&lt;/p&gt;&#xA;&lt;p&gt;It is worth mentioning, that even running the same circuit on different IBM Q topologies (real device topologies) would result in different readout errors!&lt;/p&gt;&#xA;&lt;p&gt;You can find some details in this article: &lt;a href=&quot;https://arxiv.org/abs/1905.11349&quot; rel=&quot;nofollow noreferrer&quot;&gt;Full-Stack, Real-System Quantum Computer Studies: Architectural Comparisons and Design Insights&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2020-08-11T15:07:36.467" LastActivityDate="2020-08-11T15:07:36.467" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9928" PostTypeId="2" ParentId="9926" CreationDate="2020-02-20T21:58:17.093" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;mixed-product property of the Kronecker product: &lt;span class=&quot;math-container&quot;&gt;$(A \otimes B)(C \otimes D) = (AC \otimes BD)$&lt;/span&gt;  &lt;/li&gt;&#xA;&lt;li&gt;definition of the partial trace: &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_1(A\otimes B) = \text{Tr}(A)B$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;cyclic property of the trace: &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(AB) = \text{Tr}(BA)$&lt;/span&gt;  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Your 3 guesses actually follow from the cyclic property.&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(|v_1\rangle\langle v_2|) = \text{Tr}(\langle v_2|\cdot|v_1\rangle) = \langle v_2|v_1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-02-21T05:43:19.350" LastActivityDate="2020-02-21T05:43:19.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9929" PostTypeId="1" AcceptedAnswerId="9936" CreationDate="2020-02-20T22:21:02.780" Score="2" ViewCount="67" Body="&lt;p&gt;using this &lt;a href=&quot;https://arxiv.org/abs/1506.08479&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, I want to implement a solution for the &lt;a href=&quot;https://www.wikiwand.com/en/Job_shop_scheduling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Job Shop Problem&lt;/a&gt; on a D-Wave machine. One of the constraints mentioned in the paper, is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;h_3(\bar{x}) = \sum_i \left(\sum_t x_{i,t}-1 \right)^2,&#xA;$$&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i \left(\sum_t x_{i,t}-1 \right)^2 = \sum_i\left(2\sum_t\sum_{u&amp;gt;t}x_{it}x_{iu} - \sum_tx_{it} +1\right)&#xA;$$&lt;/span&gt;&#xA;and tried to fill the generall matrix with these loops&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for i in range (num_operations):&#xA;    for u in range(upper_time_limit):&#xA;        for t in range(u):&#xA;            # What to do with 2* x_{it}x_{iu} ?&#xA;    for t in range(upper_time_limit):&#xA;        Q[i][t] -= 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here I am unsure about how to handle the first part, with situations like &lt;span class=&quot;math-container&quot;&gt;$x_{2, 3}x_{2,4}$&lt;/span&gt;, and I'm not sure what to do with the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in the end.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I appreciate any help!&lt;/p&gt;&#xA;" OwnerUserId="9950" LastEditorUserId="9006" LastEditDate="2020-02-20T22:26:55.843" LastActivityDate="2020-02-22T18:21:09.510" Title="Quantum Annealing - Job Shop Problem" Tags="&lt;d-wave&gt;&lt;optimization&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9930" PostTypeId="1" CreationDate="2020-02-20T23:09:05.087" Score="3" ViewCount="101" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="10127" LastActivityDate="2020-02-20T23:09:05.087" Title="Difficulty in implementing Grover's Algorithm with large number of qubits" Tags="&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9931" PostTypeId="1" AcceptedAnswerId="9934" CreationDate="2020-02-21T04:40:28.207" Score="1" ViewCount="183" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="55" LastEditDate="2020-10-17T20:28:17.333" LastActivityDate="2020-10-17T20:28:17.333" Title="Can we add two classical registers in IBM Quantum Experience?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9932" PostTypeId="5" CreationDate="2020-02-21T06:51:58.957" Score="0" Body="&lt;p&gt;The tag is used for marking question refereing to algorithm for arithmetic on quantum computers such as adders, multipliers etc.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-23T14:56:57.943" LastActivityDate="2020-02-23T14:56:57.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9933" PostTypeId="4" CreationDate="2020-02-21T06:51:58.957" Score="0" Body="Refers to question on implementation of arithmetic operation on quantum computer, such as adders, multipliers etc." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-21T16:09:26.493" LastActivityDate="2020-02-21T16:09:26.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9934" PostTypeId="2" ParentId="9931" CreationDate="2020-02-21T07:01:24.890" Score="2" Body="&lt;p&gt;You can add two qubits firstly in quantum registers and then measure qubit with results and put it to classical register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Adding two qubits modulo 4 can be do with this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a4NVE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a4NVE.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is fan-out and make a &quot;copy&quot; of qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;, second &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; realizes XOR function between &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. Eventually you have &lt;span class=&quot;math-container&quot;&gt;$(q_0 + q_1) \mod 4$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Expanded for two qubits adder modulo 4, based on comment by Adam &lt;em&gt;Levine&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a code implementing a modulo 4 adder for two qubits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[6];&#xA;creg c[6];&#xA;&#xA;//first input q[0]q[1]&#xA;//second input q[2]q[3]&#xA;//output q[4]q[5]&#xA;&#xA;//input&#xA;//q[0]q[1] = 01&#xA;id q[0];&#xA;x q[1];&#xA;//q[2]q[3] = 11&#xA;x q[2];&#xA;x q[3];&#xA;&#xA;//first qubit:&#xA;//q[1] + q[3] - sum&#xA;cx q[1],q[5];&#xA;cx q[3],q[5];&#xA;//q[1], q[3] - carry&#xA;ccx q[1], q[3], q[4];&#xA;&#xA;//second qubit:&#xA;//q[0] + q[2] - sum&#xA;cx q[0],q[4];&#xA;cx q[2],q[4];&#xA;//no carry, modulo 4 sum&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates set an input (&lt;em&gt;based on the comment&lt;/em&gt;), &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates acting on qubit &lt;span class=&quot;math-container&quot;&gt;$q_5$&lt;/span&gt; return sum of last (&lt;em&gt;lower&lt;/em&gt;) qubits of input numbers. Toffoli gate is used for calculation of carry form last qubits and next two &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates add together the carry and first (&lt;em&gt;higher&lt;/em&gt;) qubits of input numbers. Carry from this sum is not performed as the adder is modulo 4. The result is in qubits &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_5$&lt;/span&gt; where higher qubit is &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; and lower &lt;span class=&quot;math-container&quot;&gt;$q_5$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0008033&quot; rel=&quot;nofollow noreferrer&quot;&gt;Addition on a Quantum Computer&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-24T09:39:22.997" LastActivityDate="2020-02-24T09:39:22.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9935" PostTypeId="2" ParentId="9887" CreationDate="2020-02-21T07:48:43.860" Score="1" Body="&lt;p&gt;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 &lt;code&gt;adjoint&lt;/code&gt; and &lt;code&gt;controlled&lt;/code&gt; versions of a the operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Mariia pointed out, &lt;a href=&quot;https://stackoverflow.com/questions/59022076/how-to-get-the-type-of-a-q-operation-parameter&quot;&gt;https://stackoverflow.com/questions/59022076/how-to-get-the-type-of-a-q-operation-parameter&lt;/a&gt; is a very similar question and the same answer applies: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each Q# operations generations a C# class that extends the generic class &lt;code&gt;Operation&amp;lt;I,O&amp;gt;&lt;/code&gt;, so to figure out what the input/output parameters you can take a look at the &lt;code&gt;BaseType&lt;/code&gt; of the operation's &lt;code&gt;Type&lt;/code&gt;, and look at the value of the &lt;code&gt;GenericTypeArguments[0]&lt;/code&gt; to figure out the input type.&lt;/p&gt;&#xA;" OwnerUserId="2918" LastActivityDate="2020-02-21T07:48:43.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9936" PostTypeId="2" ParentId="9929" CreationDate="2020-02-21T12:25:03.027" Score="1" Body="&lt;p&gt;From what I understand, &lt;span class=&quot;math-container&quot;&gt;$x_{i,t}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; and a binary variable &lt;span class=&quot;math-container&quot;&gt;$x_t$&lt;/span&gt; and they have a real coefficient, so representing a term &lt;span class=&quot;math-container&quot;&gt;$Q[i][j] *x_i x_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ R: (i,u) \rightarrow i*U + u $$&lt;/span&gt; &#xA;U being your &lt;span class=&quot;math-container&quot;&gt;$upper\_time\_limit$&lt;/span&gt; or number of columns;&#xA;and then you can simply call &lt;span class=&quot;math-container&quot;&gt;$Q[R(i,t)][R(i,u)]$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2020-02-22T18:21:09.510" LastActivityDate="2020-02-22T18:21:09.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9938" PostTypeId="2" ParentId="9891" CreationDate="2020-02-21T19:16:36.867" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Square root is not differentiable at 0, so that cyclic property cannot be applied  &lt;/li&gt;&#xA;&lt;li&gt;While &lt;span class=&quot;math-container&quot;&gt;$\rho\sigma$&lt;/span&gt; has the same non-negative eigenvalues as &lt;span class=&quot;math-container&quot;&gt;$\sqrt\rho\sigma\sqrt\rho$&lt;/span&gt;, it's not self-adjoint. Non self-adjoint matrices are not diagonalizable in general, so the square root &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho\sigma}$&lt;/span&gt; can be not well-defined (see edit below).&lt;/li&gt;&#xA;&lt;li&gt;Anyway, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sqrt{\sqrt\rho\sigma\sqrt\rho})$&lt;/span&gt; is equal to the sum of square roots of eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho\sigma$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;br&gt;&#xA;It turns out that &lt;span class=&quot;math-container&quot;&gt;$\rho\sigma$&lt;/span&gt; is always diagonalizable &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/002437959190239S&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/science/article/pii/002437959190239S&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho\sigma$&lt;/span&gt; is not self-adjoint. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-02-24T18:32:23.910" LastActivityDate="2020-02-24T18:32:23.910" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="9939" PostTypeId="1" AcceptedAnswerId="9942" CreationDate="2020-02-21T19:32:46.210" Score="2" ViewCount="218" Body="&lt;p&gt;I don't understand a simple property of the outer product when doing density matrices. I am studying nielsen and chuang's book. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;At equation 2.197 they do show the density matrix of the state of quantum teleportation before alice performs her measurements.&#xA;For &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\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)]$$&lt;/span&gt;&#xA;The density matrix is just:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_1= \frac{1}{4}[|00\rangle \langle 00|(\alpha|0\rangle + \beta|1\rangle)(\alpha^*|0\rangle+\beta^*|1\rangle)+\\&#xA;|01\rangle\langle01|(\alpha|1\rangle +\beta |0\rangle)(\alpha^*\langle1| +\beta^*\langle0|)  +\\&#xA;|10\rangle\langle10|(\alpha|0\rangle -\beta |1\rangle)(\alpha^*\langle 0|-\beta^*\langle1|) +\\&#xA; |11\rangle\langle11|(\alpha|1\rangle -\beta|0\rangle)(\alpha^*\langle 1| -\beta^*\langle0|)&#xA;]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the example a couple of pages before, they present the density matrix of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, which is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2=\frac{1}{2} (|0\rangle+|1\rangle)(\langle0| + \langle 1|) $$&lt;/span&gt;&#xA;Which it gets &quot;opened up&quot; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2=\frac{1}{2} (|0\rangle\langle0|+ |0\rangle \langle1| + |1\rangle\langle0| + |1\rangle\langle1|) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically I don't understand why sometimes the outer product you have the cross terms &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle1|$&lt;/span&gt;, 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Specifically, I expect either &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; to be (which I understand is plain wrong):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_2 = \frac{1}{2}(|0\rangle\langle0| + |1\rangle\langle1|)$$&lt;/span&gt;&#xA;or &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; to be all the cross product terms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_1= \frac{1}{4}[|00\rangle \langle 00|(\alpha|0\rangle + |01\rangle(\alpha^*|1\rangle+\beta^*|0\rangle)+\\&#xA;|01\rangle\langle01|(\alpha|0\rangle +\beta |1\rangle)(\alpha^*\langle0| +\beta^*\langle1|)  +\\&#xA;|10\rangle\langle10|(\alpha|0\rangle -\beta |1\rangle)(\alpha^*\langle 0|-\beta^*\langle1|) +\\&#xA; |11\rangle\langle11|(\alpha|1\rangle -\beta|1\rangle)(\alpha^*\langle 1| -\beta^*\langle1|+\\&#xA;|00\rangle \langle 01|(..)()..)+\\&#xA;|00\rangle \langle 10|(..)()..)+\\&#xA;|00\rangle \langle 11|(..)()..)+\\&#xA;|01\rangle \langle 00|(..)()..)+\\&#xA;|01\rangle \langle 10|(..)()..)+\\&#xA;|01\rangle \langle 11|(..)()..)+\\&#xA;etc..&#xA;)&#xA;]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone tell me what i don get about distributive property of outer products?&lt;/p&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="55" LastEditDate="2020-02-23T11:21:53.790" LastActivityDate="2020-02-23T11:21:53.790" Title="Understanding the outer products in density matrices" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9940" PostTypeId="1" CreationDate="2020-02-22T02:24:00.270" Score="3" ViewCount="121" Body="&lt;p&gt;I would like to know if there is a way to:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Implement Quantum 'Functions' e.g the QFT of QFT* containing several single-qubit operations?&lt;/li&gt;&#xA;&lt;li&gt;Implement such operations on an arbitrary number of qubits and in the same vein implement work-qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Not looking as responsive as pyquil, however, I noticed in the Qiskit documentation that implementing a &lt;code&gt;'CircuitFactory'&lt;/code&gt; with the &lt;code&gt;'ABC'&lt;/code&gt; package seems to be the way to go. I would just appreciate insights from experienced hands.&#xA;Thank you kindly.&lt;/p&gt;&#xA;" OwnerUserId="10141" LastEditorUserId="5955" LastEditDate="2020-02-22T14:28:20.307" LastActivityDate="2021-02-23T02:04:55.457" Title="Implementing QFT" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9941" PostTypeId="1" CreationDate="2020-02-22T04:07:54.527" Score="3" ViewCount="160" Body="&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_{total} = H_1(\theta_1) + H_2(\theta_2) + H_3(\theta_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have been relying on simulating each term of the hamiltonian, the &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt;, as separate circuits and measuring the expected values as &lt;span class=&quot;math-container&quot;&gt;$\theta_i$&lt;/span&gt; changes. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, as I have been told by my TA that one cannot simulate the hamiltonians separately to find the ground state. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-02-22T04:13:19.257" LastActivityDate="2020-02-22T04:13:19.257" Title="XX, YY, ZZ circuit representations?" Tags="&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9942" PostTypeId="2" ParentId="9939" CreationDate="2020-02-22T06:46:48.227" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle \langle 00|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle \langle 01|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle \langle 10|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle \langle 11|$&lt;/span&gt;. Tracing out &lt;span class=&quot;math-container&quot;&gt;$|00\rangle \langle 01|\cdot |\phi\rangle\langle\psi|$&lt;/span&gt; will result in 0, because &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(|00\rangle \langle 01|)=\langle 01|00\rangle=0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-02-22T06:46:48.227" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9943" PostTypeId="1" AcceptedAnswerId="9944" CreationDate="2020-02-22T10:31:08.513" Score="2" ViewCount="255" Body="&lt;p&gt;I am trying to make a circuit for the randomly selected gates from a &lt;code&gt;gate_list&lt;/code&gt; but I don't know how to put these selected gates in front of &lt;code&gt;qr.&lt;/code&gt; statement. I don't know how to do this exactly is there any batter way to do this?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;from qiskit import Aer, execute&#xA;import random&#xA;&#xA;n = 8&#xA;gate_list = ['u1', 'u2', 'u3', 'id', 'x', 'y', 'z', 'h', 's'] &#xA;&#xA;selected_gates= []&#xA;&#xA;for i in range(0,8):&#xA;  x = random.choice(gates)&#xA;  a = '({})'.format(i)&#xA;  k = x+a&#xA;  selected_gates.append(k)&#xA;&#xA;print(selected_gates)&#xA;qr = QuantumCircuit(n)&#xA;qr.selected_gates[0]&#xA;qr.selected_gates[1]&#xA;qr.selected_gates[2]&#xA;qr.selected_gates[3]&#xA;qr.selected_gates[4]&#xA;qr.selected_gates[5]&#xA;qr.selected_gates[6]&#xA;qr.selected_gates[7]&#xA;&#xA;qr.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8527" LastActivityDate="2020-02-22T12:14:01.813" Title="How to make circuit for randomly selected gate?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9944" PostTypeId="2" ParentId="9943" CreationDate="2020-02-22T12:14:01.813" Score="4" Body="&lt;p&gt;This is very similar to an function in terra &lt;code&gt;random_circuit&lt;/code&gt;: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L30-L113&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L30-L113&lt;/a&gt; It randomly picks gates from the list of all the standard gates in terra. For example, you can run something like:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.random import random_circuit&#xA;&#xA;qr = random_circuit(10, 10, max_operands=3, measure=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which will return a 10 qubit circuit of depth 10 with measurements at the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L52-L59&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L52-L59&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-02-22T12:14:01.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9945" PostTypeId="2" ParentId="9902" CreationDate="2020-02-22T14:04:33.547" Score="2" Body="&lt;p&gt;Any scheme of back-in-time &lt;em&gt;information&lt;/em&gt; transfer based on entangled particles runs up against the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-communication_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no-signalling theorem&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially it's not clear how you conclude that &quot;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.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, in your scheme Victor could just as easily be light-years away from Alice and Bob.  Rather than &quot;back in time&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking it a step further, consider &lt;span class=&quot;math-container&quot;&gt;$\alpha^2=1$&lt;/span&gt;. Then up to global phase your system is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\Psi\rangle_{1234}=\vert 0101\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alice and Bob's qubits are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\Psi\rangle_{14}=\vert 01\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But Victor's qubits are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\Psi\rangle_{23}=\vert 10\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Victor can do anything he wants with his two qubits that are in the state &lt;span class=&quot;math-container&quot;&gt;$\vert 10\rangle$&lt;/span&gt;, but Alice/Bob's are already fixed to &lt;span class=&quot;math-container&quot;&gt;$\vert 01\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your Hilbert space only has dimension   &lt;span class=&quot;math-container&quot;&gt;$2^4   =  16$&lt;/span&gt;  , which is not so bad to work out the amplitudes of each basis directly.  Thus I recommend picking a Pythagorean triple for &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, and working out for yourself all &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; amplitudes for your state.  From letting, say, &lt;span class=&quot;math-container&quot;&gt;$\alpha=\frac{12}{13}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta=\frac{5}{13}$&lt;/span&gt;, you can calculate each amplitude and you should see that &lt;em&gt;local operations on &lt;span class=&quot;math-container&quot;&gt;$\vert\Psi\rangle_{23}$&lt;/span&gt; do not impact amplitudes on &lt;span class=&quot;math-container&quot;&gt;$\vert\Psi\rangle_{14}$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-03-04T12:44:39.520" LastActivityDate="2020-03-04T12:44:39.520" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9946" PostTypeId="1" AcceptedAnswerId="9949" CreationDate="2020-02-22T17:06:07.043" Score="1" ViewCount="86" Body="&lt;p&gt;I am creating the following circuit with Qiskit (2Toffoli gates controlled with coins) &lt;a href=&quot;https://i.stack.imgur.com/wDHa0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wDHa0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And to set the coins for one iteration of the circuit i do the following : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qsubnodes = QuantumRegister(2)&#xA;qsubnodes = QuantumRegister(2)&#xA;qc.h(subnode[0])&#xA;qc.h(subnode[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then for the first Toffoli gate: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.ccx(subnode[0], subnode[1], *q) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and the second toffoli gate (which is the issue) : &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc.h(subnode[0])&#xA;qc.h(subnode[1])&#xA;qc.x(subnode[1]) // to invert the coin to control for 0 (as shown in the circuit)&#xA;qc.ccx(subnode[0], subnode[1], *q)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is it the right way of inverting the coin for the second toffoli ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you,&lt;/p&gt;&#xA;" OwnerUserId="10075" LastEditorUserId="9006" LastEditDate="2020-02-22T22:37:54.053" LastActivityDate="2020-02-22T22:45:37.293" Title="Toffoli gates with Hadamard coins (QISKIT)" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9947" PostTypeId="1" CreationDate="2020-02-22T20:24:22.820" Score="1" ViewCount="105" Body="&lt;p&gt;I am writing to double check that if have a hamiltonian of the form &lt;span class=&quot;math-container&quot;&gt;$H = I_1 \otimes I_2$&lt;/span&gt;, when I seek to find the unitary, &lt;span class=&quot;math-container&quot;&gt;$e^{-i\gamma I_1 \otimes I_2}$&lt;/span&gt;, 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)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ask this because what throws me off is the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; factor which, in the case of &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{2} (Z_1 \otimes Z_2)$&lt;/span&gt; it becomes a &lt;span class=&quot;math-container&quot;&gt;$U \approx e^{-i\frac{\alpha}{2} Z_1 \otimes Z_2}$&lt;/span&gt; which becomes the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1AazF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1AazF.png&quot; alt=&quot;Circuit resulting from Trotter&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-02-24T17:36:50.020" LastActivityDate="2020-02-24T17:36:50.020" Title="Circuit of a very trivial thing" Tags="&lt;quantum-gate&gt;&lt;hamiltonian-simulation&gt;&lt;unitarity&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9948" PostTypeId="1" CreationDate="2020-02-22T20:31:49.947" Score="1" ViewCount="39" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10146" LastEditorUserId="9006" LastEditDate="2020-02-22T22:51:51.107" LastActivityDate="2020-02-22T22:51:51.107" Title="Loading old results for Data reprocessing" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9949" PostTypeId="2" ParentId="9946" CreationDate="2020-02-22T22:45:37.293" Score="1" Body="&lt;p&gt;According to your circuit diagram, the second Toffoli should act in case &quot;lower&quot; qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &quot;upper&quot; one in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Since Toffoli acts only in case both inputs are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, you have to invert &quot;upper&quot; qubit, or in other words to apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So it seems that your construction is right.&lt;/strong&gt; &lt;em&gt;To test this, try to prepare circuit containing one Toffoli gate with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; applied on one of its input. Set a input of the circuit to &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; depending on which Toffoli's input is neggated and try to measure Toffoli's output; you should get &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-22T22:45:37.293" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9950" PostTypeId="2" ParentId="9947" CreationDate="2020-02-23T03:14:47.890" Score="2" Body="&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$H = I_1 \otimes I_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$e^{-i\gamma I_1 \otimes I_2} = I_1 \otimes I_2$&lt;/span&gt;. Therefore, you don't have to apply any gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your CNOT RZ CNOT circuit represents the time evolution of Ising coupling.&#xA;However, if you want to solve the Ising model problem by QAOA, you need &quot;mixing term&quot; like RX rotation.&#xA;&lt;a href=&quot;https://grove-docs.readthedocs.io/en/latest/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rigetti grove's document&lt;/a&gt; is very good to understanding QAOA.&lt;/p&gt;&#xA;" OwnerUserId="9563" LastActivityDate="2020-02-23T03:14:47.890" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9951" PostTypeId="1" AcceptedAnswerId="9954" CreationDate="2020-02-23T18:14:26.593" Score="9" ViewCount="2622" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerDisplayName="user10151" LastEditorDisplayName="user10151" LastEditDate="2020-02-23T18:39:15.050" LastActivityDate="2020-02-23T18:58:27.430" Title="Is there anything that can be programmed on a classical computer but not on a quantum computer?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9952" PostTypeId="1" CreationDate="2020-02-23T18:29:13.210" Score="3" ViewCount="125" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As part of that, I need to make a set of standardized components which requires creating a scalable architecture, etc. etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;/p&gt;&#xA;" OwnerUserId="7838" LastActivityDate="2020-02-23T18:29:13.210" Title="Timing accuracy for the KLM protocol and how do controlled gates work?" Tags="&lt;optical-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9953" PostTypeId="2" ParentId="9891" CreationDate="2020-02-23T18:31:29.320" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; represent an arbitrary Hermitian matrix, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; an arbitrary normal one, &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; be a generic diagonalizable matrix, and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; an arbitrary matrix, all acting on an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtlety 1: For normal &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Numerical_range&quot; rel=&quot;nofollow noreferrer&quot;&gt;numerical range&lt;/a&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left \{ \frac{\langle \psi | N | \psi \rangle}{\langle \psi|\psi\rangle} \right \}$$&lt;/span&gt;&#xA;for all nonzero &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; in the Hilbert space is the convex hull of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. (So for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; Hermitian, it's the real interval &lt;span class=&quot;math-container&quot;&gt;$[\min \lambda, \max \lambda]$&lt;/span&gt;.) For generic &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, the numerical range is still convex and contains the eigenvalues, but is not necessarily a hull for them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtlety 2: Therefore, there are two definitions of &quot;positive (semi-)definite&quot; that are equivalent for Hermitian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; but not for generic &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PD1: A matrix is positive (semi-)definite (PD1) if all of its eigenvalues are positive (nonnegative real).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PD2: A matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is positive (semi-)definite (PD2) if &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | M | \psi \rangle &amp;gt; (\geq)\ 0$&lt;/span&gt; for all nonzero &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the Hilbert space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PD1 and PD2 are equivalent for Hermitian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, but PD2 (which I think is the &quot;real&quot; meaning of positive-definite) is strictly stronger for generic &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. See &lt;a href=&quot;https://math.stackexchange.com/a/113859/268333&quot;&gt;here&lt;/a&gt; for an example of a non-Hermitian &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; that satisfies PD1 but not PD2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtlety 3: There are two inequivalent definitions of a square root of a matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SR1: &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is &lt;em&gt;a&lt;/em&gt; square root (SR1) of a generic matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$R^2 = M$&lt;/span&gt;. Under this definition, a matrix has a finite number of square roots (e.g. &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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 &quot;principal&quot; square root in this situation (e.g. if &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is defective), so the notation &lt;span class=&quot;math-container&quot;&gt;$\sqrt{M}$&lt;/span&gt; is not (as far as I know) well defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SR2: &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is &lt;em&gt;a&lt;/em&gt; square root (SR2) of a positive definite Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$R^\dagger R = P$&lt;/span&gt;. (Since &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is Hermitian, we don't need to specify whether we mean PD1 or PD2 for &quot;positive definite&quot;.) Under this definition, the set of square roots of a matrix &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is isomorphic to the Lie group &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;, because if &lt;span class=&quot;math-container&quot;&gt;$R_1$&lt;/span&gt; is a square root of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$R_2$&lt;/span&gt; is a square root of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$R_2 = U R_1$&lt;/span&gt; for some unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is not necessarily Hermitian. But under this definition, we can define &lt;em&gt;the&lt;/em&gt; natural &quot;principal&quot; square root of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, which we denote by &lt;span class=&quot;math-container&quot;&gt;$L = \sqrt{P}$&lt;/span&gt;, as the unique square root that is also Hermitian and positive (semi-)definite (again, no need to distinguish PD1 from PD2 here).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the principal square root &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is Hermitian by definition, it respects both definitions SR1 and SR2, as &lt;span class=&quot;math-container&quot;&gt;$L^\dagger L = L^2 = P$&lt;/span&gt;. But a generic square root (SR1) of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; will not be a square root (SR2) of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; or vice versa.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a Hermitian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, the usual power series expansion of the square root function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{n=0}^\infty \frac{(-1)^n (2n)!}{(1-2n)(n!)^2 4^n} (H - I)^n$$&lt;/span&gt;&#xA;will converge to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{H}$&lt;/span&gt; iff all the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; lie in the interval &lt;span class=&quot;math-container&quot;&gt;$[0,2]$&lt;/span&gt;. For a generic diagonalizable matrix &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, this series will converge to a square root of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; iff all of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; 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.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtlety 4: If either of two generic matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is invertible, then &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$BA$&lt;/span&gt; are similar, but if both &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are singular, then &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$BA$&lt;/span&gt; are not necessarily similar (see &lt;a href=&quot;https://math.stackexchange.com/a/176039/268333&quot;&gt;here&lt;/a&gt; for a counterexample). But even in this case, &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$BA$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subtlety 5: If we have two Hermitian positive-definite matrices &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt;, then their non-Hermitian product &lt;span class=&quot;math-container&quot;&gt;$P_1 P_2$&lt;/span&gt; will satisfy PD1 but not necessarily PD2 (see the first link above for a counterexample), so it may or may not necessarily be &quot;positive definite&quot;, depending on your definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we can finally try to answer my question. The standard definition of the fidelity is unambiguous, because only &lt;em&gt;Hermitian&lt;/em&gt; positive-semidefinite operators are ever getting square rooted. Since &lt;span class=&quot;math-container&quot;&gt;$\rho \sigma$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\sqrt{M}$&lt;/span&gt; may not be meaningful for a non-Hermitian &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; because it implies some natural principal branch.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we can talk about the square roots (plural) of &lt;span class=&quot;math-container&quot;&gt;$\rho \sigma$&lt;/span&gt; under definition SR1, as with any matrix. Moreover, &lt;span class=&quot;math-container&quot;&gt;$\rho \sigma$&lt;/span&gt; is a highly non-generic matrix. It satisfies PD1 by Subtlety 5. In fact, by Subtlety 4, &lt;span class=&quot;math-container&quot;&gt;$\rho \sigma$&lt;/span&gt; has the same characteristic polynomial (with all roots lying in &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;) as &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho} \sigma \sqrt{\rho}$&lt;/span&gt;. So because the eigenvalues all lie in this interval (which is obviously not generically true), there &lt;em&gt;is&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho \sigma}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;TLDR:&lt;/strong&gt; The expression &lt;span class=&quot;math-container&quot;&gt;$\sqrt{M}$&lt;/span&gt; is not uniquely defined for a generic matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; that is not Hermitian and positive semidefinite. But in this case, the special properties of the matrix &lt;span class=&quot;math-container&quot;&gt;$\rho \sigma$&lt;/span&gt; guarantee that the formal power series above converges, so we can use that power series to (non-conventionally) define &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho \sigma}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-02-24T13:20:25.100" LastActivityDate="2020-02-24T13:20:25.100" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="9954" PostTypeId="2" ParentId="9951" CreationDate="2020-02-23T18:58:27.430" Score="11" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-02-23T18:58:27.430" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="9956" PostTypeId="1" CreationDate="2020-02-23T19:58:15.947" Score="3" ViewCount="80" Body="&lt;p&gt;I cannot understand the proof of Lemma 5 from the paper &lt;a href=&quot;https://hal.archives-ouvertes.fr/hal-01378771/document&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Resources Required for Preparing Graph States&quot;&lt;/a&gt;. Here it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9UNGT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9UNGT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(In this paper, &lt;span class=&quot;math-container&quot;&gt;$|G:S\rangle$&lt;/span&gt; denotes &lt;span class=&quot;math-container&quot;&gt;$Z_S$&lt;/span&gt; applied to the graph state &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt;, and the &lt;span class=&quot;math-container&quot;&gt;$/$&lt;/span&gt; symbol denotes contraction of an edge.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I have two questions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; Why is the operator &lt;span class=&quot;math-container&quot;&gt;$Z_{v^{\prime\prime}}^k$&lt;/span&gt; inside the big brackets necessary? Since &lt;span class=&quot;math-container&quot;&gt;$v^{\prime\prime}$&lt;/span&gt; is not present in the graph &lt;span class=&quot;math-container&quot;&gt;$G/vv^\prime/v^\prime v^{\prime\prime}$&lt;/span&gt;, does this operator not just cancel out with the one inside the term &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle +Z_{v^{\prime\prime}}^k|1\rangle)_{v^{\prime\prime}}$&lt;/span&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; What is special about having &lt;span class=&quot;math-container&quot;&gt;$v^\prime$&lt;/span&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$v^{\prime\prime}$&lt;/span&gt; here? If we had no &lt;span class=&quot;math-container&quot;&gt;$v^{\prime\prime}$&lt;/span&gt; vertex, and the vertex &lt;span class=&quot;math-container&quot;&gt;$v^\prime$&lt;/span&gt; attached directly to &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; (see figure 1), would this same argument not work?&lt;/p&gt;&#xA;" OwnerUserId="6118" LastActivityDate="2020-12-15T09:58:08.093" Title="$X$ measurement on graph state leads to edge contraction" Tags="&lt;measurement&gt;&lt;graph-states&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9957" PostTypeId="1" AcceptedAnswerId="9958" CreationDate="2020-02-23T21:43:16.480" Score="1" ViewCount="210" Body="&lt;p&gt;When I run:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QISKitError&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ImportError: cannot import name 'QISKitError'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need QISKitError for exception handling with my program. Did IBMQ recently update this import?&lt;/p&gt;&#xA;" OwnerUserId="5747" LastEditorUserId="55" LastEditDate="2020-02-24T10:42:44.960" LastActivityDate="2020-02-24T10:42:44.960" Title="IBMQ: `from qiskit import QISKitError` gives 'cannot import name QISKitError'" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9958" PostTypeId="2" ParentId="9957" CreationDate="2020-02-23T22:26:34.767" Score="3" Body="&lt;p&gt;This has been moved to &lt;code&gt;from qiskit.exceptions import QiskitError&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-23T22:26:34.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9959" PostTypeId="1" CreationDate="2020-02-23T22:34:19.737" Score="3" ViewCount="637" Body="&lt;p&gt;Is there a way to look up the clock speed for the different computers?&lt;/p&gt;&#xA;" OwnerUserId="10154" LastEditorUserId="9006" LastEditDate="2020-02-23T22:40:40.643" LastActivityDate="2020-02-24T18:25:15.773" Title="The Clock Speed for the Quantum Computers" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9960" PostTypeId="2" ParentId="9959" CreationDate="2020-02-24T05:45:21.557" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While T2 and the gate time tells you how many operations you can perform in the given T1 clock cycle.&lt;/p&gt;&#xA;" OwnerUserId="9579" LastEditorUserId="9579" LastEditDate="2020-02-24T18:25:15.773" LastActivityDate="2020-02-24T18:25:15.773" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9961" PostTypeId="1" CreationDate="2020-02-24T06:35:30.523" Score="1" ViewCount="76" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10156" LastEditorUserId="55" LastEditDate="2020-08-20T08:08:22.440" LastActivityDate="2020-08-20T08:08:22.440" Title="Regarding quantum support vector machine using qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="7" ClosedDate="2020-02-27T14:55:02.537" ContentLicense="CC BY-SA 4.0" />
  <row Id="9962" PostTypeId="1" CreationDate="2020-02-24T08:23:18.213" Score="3" ViewCount="116" Body="&lt;p&gt;I'm trying to become familiar with manipulation of the Dirac notation.&#xA;I want to be able to compute quickly the final states obtained in a small circuit.&#xA;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),&#xA;rotation, hadamard, paulis, and other basic gates. It should not contain too many gates either so I don't spend 4 hours computing it.&#xA;Once computed the final state I want also to be able to give quickly the results of the measure of one of the qubits,&#xA;probability and state after measurement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you know any exercises with solutions of the computation of circuits ?&#xA;Where can I find them ? &lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="5955" LastEditDate="2020-02-24T08:50:26.003" LastActivityDate="2020-02-24T09:49:36.510" Title="Exercises on computing by hand quantum circuits" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9963" PostTypeId="2" ParentId="9962" CreationDate="2020-02-24T09:49:36.510" Score="3" Body="&lt;p&gt;You can use &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; to do this. It allows you to do all of the things you mention, using the four types of displays available.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another option is to look up problem sets from a course.&lt;/p&gt;&#xA;" OwnerUserId="9282" LastActivityDate="2020-02-24T09:49:36.510" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9964" PostTypeId="2" ParentId="9947" CreationDate="2020-02-24T12:05:49.390" Score="2" Body="&lt;p&gt;Remember that we can expand&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\gamma(Z\otimes Z)}=I\cos\gamma+i(Z\otimes Z)\sin(\gamma).&#xA;$$&lt;/span&gt;&#xA;Let's call this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. If I calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|+\rangle|+\rangle=\cos\gamma|+\rangle|+\rangle+i\sin\gamma|-\rangle|-\rangle.&#xA;$$&lt;/span&gt;&#xA;For most vales of &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt;, this state is entangled (indeed, for &lt;span class=&quot;math-container&quot;&gt;$\gamma=\pi/4$&lt;/span&gt;, you essentially have a Bell state in the Hadamard basis). So your statement &quot;given that it's just measuring two non-interacting qubits&quot; is false. The qubits are interacting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a point of comparison, perhaps you are thinking of a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=\gamma(I\otimes Z+Z\otimes I)$&lt;/span&gt;, because in this case, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iH}=e^{i\gamma Z}\otimes e^{i\gamma Z},&#xA;$$&lt;/span&gt;&#xA;which is maybe what you thought was happening above?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit that you show is what you need for an Ising interaction between two qubits. I'm not sure what &quot;Ansatz&quot; you could be referring to?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-24T12:05:49.390" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="9965" PostTypeId="2" ParentId="9576" CreationDate="2020-02-24T14:30:04.693" Score="1" Body="&lt;p&gt;There are many Qiskit notebooks on quatum computers application in different areas, including finance, in IBM Q web interface.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For application in finance, click on icon Qiskit Notebooks, then folder Advanced -&gt; Aqua -&gt; Finance.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is also website dedicated to quantum computing application in finance: &lt;a href=&quot;http://www.quantumforquants.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum for Quants&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-27T13:25:28.447" LastActivityDate="2020-02-27T13:25:28.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9966" PostTypeId="1" AcceptedAnswerId="9972" CreationDate="2020-02-24T14:36:12.713" Score="3" ViewCount="255" Body="&lt;p&gt;While executing the following circuit (consisting 16 qubit and 4 classical bits) I am getting &quot;Error in transpilation process. [1003]&quot; 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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AafTI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AafTI.png&quot; alt=&quot;figure&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[8];&#xA;qreg qGrp1[8];&#xA;creg c[2];&#xA;creg cGrp1[2];&#xA;&#xA;&#xA;h q[2];&#xA;h q[4];&#xA;h q[6];&#xA;x q[7];&#xA;x qGrp1[1];&#xA;h qGrp1[2];&#xA;h qGrp1[4];&#xA;h qGrp1[6];&#xA;x qGrp1[7];&#xA;cx q[2],q[3];&#xA;cx q[4],q[5];&#xA;cx q[6],q[7];&#xA;cx qGrp1[2],qGrp1[3];&#xA;cx qGrp1[4],qGrp1[5];&#xA;cx qGrp1[6],qGrp1[7];&#xA;ccx q[6],q[0],q[4];&#xA;ccx qGrp1[6],qGrp1[0],qGrp1[4];&#xA;ccx q[7],q[1],q[5];&#xA;ccx qGrp1[7],qGrp1[1],qGrp1[5];&#xA;x q[6];&#xA;x q[7];&#xA;x qGrp1[6];&#xA;x qGrp1[7];&#xA;ccx q[6],q[0],q[2];&#xA;ccx qGrp1[6],qGrp1[0],qGrp1[2];&#xA;ccx q[7],q[1],q[3];&#xA;ccx qGrp1[7],qGrp1[1],qGrp1[3];&#xA;cx q[2],q[3];&#xA;cx q[4],q[5];&#xA;cx qGrp1[2],qGrp1[3];&#xA;cx qGrp1[4],qGrp1[5];&#xA;&#xA;measure q[3] -&amp;gt; c[0];&#xA;measure q[5] -&amp;gt; c[1];&#xA;measure qGrp1[3] -&amp;gt; cGrp1[0];&#xA;measure qGrp1[5] -&amp;gt; cGrp1[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="55" LastEditDate="2020-02-25T11:42:30.980" LastActivityDate="2020-02-25T11:42:30.980" Title="Why I am getting transpilation error while executing the following IBM Quantum Experience code?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9967" PostTypeId="1" AcceptedAnswerId="9968" CreationDate="2020-02-24T15:24:51.197" Score="4" ViewCount="464" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How I can use .csv data file with Qiskit libraries to run quantum SVM ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am following the code written below, where I should put my own .csv data file&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from dataset import breast_cancer&#xA;from sklearn.datasets.samples_generator import make_blobs&#xA;from qiskit.aqua.utils import split_dataset_to_data_and_labels &#xA;from sklearn import svm&#xA;from utils import svm_utils &#xA;from matplotlib import pyplot as plt&#xA;#matplotlib inline&#xA;#load_ext autoreload&#xA;#autoreload 2   % Breast Cancer dataset&#xA;&#xA;n = 2 # number of principal components kept&#xA;training_dataset_size = 20&#xA;testing_dataset_size = 10&#xA;&#xA;sample_Total, training_input, test_input, class_labels = breast_cancer(training_dataset_size, testing_dataset_size, n)&#xA;&#xA;data_train, _ = split_dataset_to_data_and_labels(training_input)&#xA;data_test, _ = split_dataset_to_data_and_labels(test_input)  # %%Breast Cancer dataset&#xA;&#xA;##%% Linear Support vector machine&#xA;# We use the function of scikit learn to generate linearly separable blobs&#xA;centers = [(2.5,0),(0,2.5)]&#xA;x, y = make_blobs(n_samples=100, centers=centers, n_features=2,random_state=0,cluster_std=0.5)&#xA;&#xA;&#xA;fig,ax=plt.subplots(1,2,figsize=(10,5))&#xA;&#xA;&#xA;ax[0].scatter(data_train[0][:,0],data_train[0][:,1],c=data_train[1])&#xA;ax[0].set_title('Breast Cancer dataset');&#xA;&#xA;ax[1].scatter(x[:,0],x[:,1],c=y)&#xA;ax[1].set_title('Blobs linearly separable');&#xA;&#xA;##%% Hands-on session on support vector machine&#xA;&#xA;plt.scatter(data_train[0][:,0],data_train[0][:,1],c=data_train[1])&#xA;plt.title('Breast Cancer dataset');&#xA;&#xA;model= svm.LinearSVC()&#xA;model.fit(data_train[0], data_train[1])&#xA;accuracy_train = model.score(data_train[0], data_train[1])&#xA;accuracy_test = model.score(data_test[0], data_test[1])&#xA;&#xA;&#xA;X0, X1 = data_train[0][:, 0], data_train[0][:, 1]&#xA;xx, yy = svm_utils.make_meshgrid(X0, X1)&#xA;Z = model.predict(np.c_[xx.ravel(), yy.ravel()])&#xA;Z = Z.reshape(xx.shape)&#xA;&#xA;fig,ax=plt.subplots(1,2,figsize=(15,5))&#xA;ax[0].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)&#xA;ax[0].scatter(data_train[0][:,0], data_train[0][:,1], c=data_train[1])&#xA;ax[0].set_title('Accuracy on the training set: '+str(accuracy_train));&#xA;&#xA;ax[1].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)&#xA;ax[1].scatter(data_test[0][:,0], data_test[0][:,1], c=data_test[1])&#xA;ax[1].set_title('Accuracy on the test set: '+str(accuracy_test));&#xA;&#xA;##%% We now implement a SVM with gaussian kernel&#xA;clf = svm.SVC(gamma = 'scale')&#xA;clf.fit(data_train[0], data_train[1]);&#xA;accuracy_train = clf.score(data_train[0], data_train[1])&#xA;accuracy_test = clf.score(data_test[0], data_test[1])&#xA;&#xA;&#xA;X0, X1 = data_train[0][:, 0], data_train[0][:, 1]&#xA;xx, yy = svm_utils.make_meshgrid(X0, X1)&#xA;Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])&#xA;Z = Z.reshape(xx.shape)&#xA;&#xA;fig,ax=plt.subplots(1,2,figsize=(15,5))&#xA;ax[0].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)&#xA;ax[0].scatter(data_train[0][:,0], data_train[0][:,1], c=data_train[1])&#xA;ax[0].set_title('Accuracy on the training set: '+str(accuracy_train));&#xA;&#xA;ax[1].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)&#xA;ax[1].scatter(data_test[0][:,0], data_test[0][:,1], c=data_test[1])&#xA;ax[1].set_title('Accuracy on the test set: '+str(accuracy_test));&#xA;&#xA;##%% First steps in Qiskit&#xA;import qiskit as qk&#xA;&#xA;# Creating Qubits&#xA;q = qk.QuantumRegister(2)&#xA;# Creating Classical Bits&#xA;c = qk.ClassicalRegister(2)&#xA;&#xA;##%% Define and print empty circuit&#xA;circuit = qk.QuantumCircuit(q, c)&#xA;print(circuit)&#xA;&#xA;##%%% Add gates to the qubits&#xA;# Initialize empty circuit&#xA;circuit = qk.QuantumCircuit(q, c)&#xA;# Hadamard Gate on the first Qubit&#xA;circuit.h(q[0])&#xA;# CNOT Gate on the first and second Qubits&#xA;circuit.cx(q[0], q[1])&#xA;# Measuring the Qubits&#xA;circuit.measure(q, c)&#xA;print (circuit)&#xA;&#xA;##%% Run the circuit on the quantum simulator&#xA;# Using Qiskit Aer's Qasm Simulator: Define where do you want to run the simulation.&#xA;simulator = qk.BasicAer.get_backend('qasm_simulator')&#xA;&#xA;# Simulating the circuit using the simulator to get the result&#xA;job = qk.execute(circuit, simulator, shots=100)&#xA;result = job.result()&#xA;&#xA;# Getting the aggregated binary outcomes of the circuit.&#xA;counts = result.get_counts(circuit)&#xA;print (counts)&#xA;&#xA;from qiskit.aqua.components.feature_maps import SecondOrderExpansion&#xA;&#xA;feature_map = SecondOrderExpansion(feature_dimension=2, &#xA;                                   depth=1)&#xA;&#xA;##%%Print the feature map circuit&#xA;x = np.array([0.6, 0.3])&#xA;print(feature_map.construct_circuit(x))&#xA;&#xA;##%%% QSVM Algorithm&#xA;from qiskit.aqua.algorithms import QSVM&#xA;&#xA;qsvm = QSVM(feature_map, training_input, test_input)&#xA;&#xA;##%% Run QSVM&#xA;from qiskit.aqua import run_algorithm, QuantumInstance&#xA;from qiskit import BasicAer&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=10598, seed_transpiler=10598)&#xA;&#xA;result = qsvm.run(quantum_instance)&#xA;&#xA;##%%% Analyze output&#xA;plt.scatter(training_input['Benign'][:,0], training_input['Benign'][:,1])&#xA;plt.scatter(training_input['Malignant'][:,0], training_input['Malignant'][:,1])&#xA;plt.show()&#xA;length_data = len(training_input['Benign']) + len(training_input['Malignant'])&#xA;print(&quot;size training set: {}&quot;.format(length_data))&#xA;print(&quot;Matrix dimension: {}&quot;.format(result['kernel_matrix_training'].shape))&#xA;&#xA;print(&quot;testing success ratio: &quot;, result['testing_accuracy'])&#xA;&#xA;test_set = np.concatenate((test_input['Benign'], test_input['Malignant']))&#xA;y_test = qsvm.predict(test_set, quantum_instance)&#xA;&#xA;##%% And here we plot the results. The first plot shows the label predictions of the QSVM and the second plot shows the test labels.&#xA;plt.scatter(test_set[:, 0], test_set[:,1], c=y_test)&#xA;plt.show()&#xA;&#xA;plt.scatter(test_input['Benign'][:,0], test_input['Benign'][:,1])&#xA;plt.scatter(test_input['Malignant'][:,0], test_input['Malignant'][:,1])&#xA;plt.show()&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10156" LastEditorUserId="55" LastEditDate="2020-02-25T11:42:40.270" LastActivityDate="2021-01-20T10:49:42.973" Title="How to use external .csv data file in quantum support vector machine qiskit python code?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9968" PostTypeId="2" ParentId="9967" CreationDate="2020-02-24T15:37:05.530" Score="4" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def userDefinedData(location, file, class_labels,training_size, test_size, n=2, PLOT_DATA=True):&#xA;&#xA;&#xA;    data, target, target_names = load_data(location, file)&#xA;    # sample_train is of the same form as data&#xA;    sample_train, sample_test, label_train, label_test = train_test_split(&#xA;        data, target,test_size=0.25, train_size=0.75 ,random_state=22)&#xA;&#xA;&#xA;    # Now we standarize for gaussian around 0 with unit variance&#xA;    std_scale = StandardScaler().fit(sample_train)&#xA;    sample_train = std_scale.transform(sample_train)&#xA;    sample_test = std_scale.transform(sample_test)&#xA;&#xA;&#xA;    # Now reduce number of features to number of qubits&#xA;    pca = PCA(n_components=n).fit(sample_train)&#xA;    sample_train = pca.transform(sample_train)&#xA;    sample_test = pca.transform(sample_test)&#xA;&#xA;&#xA;    # Samples are pairs of points&#xA;    samples = np.append(sample_train, sample_test, axis=0)&#xA;    minmax_scale = MinMaxScaler((-1, 1)).fit(samples)&#xA;    sample_train = minmax_scale.transform(sample_train)&#xA;    sample_test = minmax_scale.transform(sample_test)&#xA;&#xA;&#xA;    # If class labels are numeric&#xA;    if class_labels[0].isdigit():&#xA;        # Pick training size number of samples from each distro&#xA;        training_input = {key: (sample_train[label_train == int(key), :])[:training_size] for k, key in enumerate(class_labels)}&#xA;        test_input = {key: (sample_test[label_test == int(key), :])[: test_size] for k, key in enumerate(class_labels)}&#xA;&#xA;    else:&#xA;        # if they aren't&#xA;        training_input = {key: (sample_train[label_train == k, :])[:training_size] for k, key in&#xA;                         enumerate(class_labels)}&#xA;        test_input = {key: (sample_train[label_train == k, :])[training_size:(&#xA;                training_size + test_size)] for k, key in enumerate(class_labels)}&#xA;&#xA;&#xA;&#xA;    if PLOT_DATA:&#xA;        for k in range(0, 9):&#xA;            plt.scatter(sample_train[label_train == k, 0][:training_size],&#xA;                        sample_train[label_train == k, 1][:training_size])&#xA;&#xA;        plt.title(&quot;PCA dim. reduced user dataset&quot;)&#xA;        plt.show()&#xA;&#xA;    return sample_train, training_input, test_input, class_labels&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2020-02-24T15:42:51.967" LastActivityDate="2020-02-24T15:42:51.967" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9969" PostTypeId="1" AcceptedAnswerId="9979" CreationDate="2020-02-24T15:53:36.437" Score="1" ViewCount="50" Body="&lt;p&gt;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 &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%7B%22id%22:%22X%5Eft%22,%22arg%22:%221/5%22%7D,%7B%22id%22:%22Y%5Eft%22,%22arg%22:%221/4%22%7D,%7B%22id%22:%22Y%5Eft%22,%22arg%22:%221/3%22%7D],[%22%E2%80%A2%22,%22X%22],[1,%22%E2%80%A2%22,%22X%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;there&lt;/a&gt;. &#xA;The numerical coefficients do not matter and I want to compute it for any rotation parameter. &#xA;So far here's what I've done : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Computing the three states after rotation :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_X(\theta_1) |0⟩ = |\phi_1⟩=  \cos(\frac{\theta_1}{2})|0⟩ - i \sin(\frac{\theta_1}{2}) |1⟩$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta_2) |0⟩ = |\phi_2⟩ =  \cos(\frac{\theta_2}{2}) |0⟩ + \sin(\frac{\theta_2}{2}) |1⟩$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta_3) |0⟩ = |\phi_3⟩ = \cos(\frac{\theta_3}{2}) |0⟩ + \sin(\frac{\theta_3}{2}) |1⟩$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then compute the joint state &lt;span class=&quot;math-container&quot;&gt;$|\phi_1 \phi_2⟩$&lt;/span&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\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⟩)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ = \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⟩  $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then compute the CNOT gate with control &lt;span class=&quot;math-container&quot;&gt;$|\phi_1⟩$&lt;/span&gt; and target &lt;span class=&quot;math-container&quot;&gt;$|\phi_2⟩$&lt;/span&gt; :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ 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⟩  $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.  &lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-02-24T19:06:36.247" LastActivityDate="2020-02-24T23:56:38.263" Title="computing a quantum circuit by hand (CNOT on non-computational basis states)" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9970" PostTypeId="1" AcceptedAnswerId="9971" CreationDate="2020-02-24T15:58:17.697" Score="4" ViewCount="39" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would Monte Carlo methods or Bayesian simulation based methods or Gibbs sampling be improved? &lt;/p&gt;&#xA;" OwnerDisplayName="user10151" LastActivityDate="2020-02-25T05:49:54.590" Title="Would quantum computers improve solving statistical regression problems or neural networks?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9971" PostTypeId="2" ParentId="9970" CreationDate="2020-02-24T16:15:08.850" Score="4" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1908.06655.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;In the article Quantum Expectation-Maximization Algorithm&lt;/a&gt; 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. &lt;/p&gt;&#xA;" OwnerUserId="10065" LastActivityDate="2020-02-24T16:15:08.850" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9972" PostTypeId="2" ParentId="9966" CreationDate="2020-02-24T16:21:28.753" Score="5" Body="&lt;p&gt;Your circuit looks fine, but it has 16 qubits, and the largest IBM public backend currently has 15 qubits (note that &lt;code&gt;Melbourne&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;fake&quot; backends in Qiskit. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.test.mock import FakeAlmaden&#xA;backend = FakeAlmaden()&#xA;&#xA;# you can see how this differs from original circuit and can plan&#xA;# with some transpilation options&#xA;new_circuit = transpile(circuit, backend) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then you can refer to this tutorial on how to simulate this backend. Almaden is a 20-qubit backend.&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/09ea113fdeb340f4f2d71c862126ee35a676b754/qiskit/advanced/aer/2_device_noise_simulation.ipynb&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/09ea113fdeb340f4f2d71c862126ee35a676b754/qiskit/advanced/aer/2_device_noise_simulation.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-02-24T16:21:28.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9974" PostTypeId="1" CreationDate="2020-02-24T17:03:07.037" Score="2" ViewCount="139" Body="&lt;p&gt;I try to optimise a quantity via an SDP. I optimise over all PPT measurement operators and hence have the constraints &lt;span class=&quot;math-container&quot;&gt;$\Pi_k^{T_B} \succeq 0$&lt;/span&gt; (PPT) for my measurement operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The part of the code where I define the SDP and constraints is:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[...]&#xA;&#xA;# Defining the SDP&#xA;p = pic.Problem()&#xA;pic.new_param(&quot;rho_0&quot;, rho_0)&#xA;pic.new_param(&quot;rho_1&quot;, rho_1)&#xA;pic.new_param(&quot;rho_2&quot;, rho_2)&#xA;&#xA;# Measurement operators&#xA;P_0 = p.add_variable(&quot;P_0&quot;, (9,9), &quot;hermitian&quot;)&#xA;P_1 = p.add_variable(&quot;P_1&quot;, (9,9), &quot;hermitian&quot;)&#xA;P_2 = p.add_variable(&quot;P_2&quot;, (9,9), &quot;hermitian&quot;)&#xA;P_inc = p.add_variable(&quot;P_inc&quot;, (9,9), &quot;hermitian&quot;)&#xA;&#xA;# Partial transposes&#xA;p.add_constraint(PT_B(P_0, 3, 3) &amp;gt;&amp;gt; 0)&#xA;p.add_constraint(PT_B(P_1, 3, 3) &amp;gt;&amp;gt; 0)&#xA;p.add_constraint(PT_B(P_2, 3, 3) &amp;gt;&amp;gt; 0)&#xA;p.add_constraint(PT_B(P_inc, 3, 3) &amp;gt;&amp;gt; 0)&#xA;&#xA;[...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;PT_B&lt;/code&gt; is a function implementing the partial transpose, i.e.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def PT_B(M, d1, d2):&#xA;    &quot;&quot;&quot;&#xA;    Partial Transpose map of M&#xA;    Input: Matrix M, Dimension d1 of subsystem 1, Dimension d2 of subsystem 2&#xA;    Output: Partial Transpose M_TB&#xA;    &quot;&quot;&quot;&#xA;    assert M.shape == (d1 * d2, d1 * d2)&#xA;&#xA;    # Reshape into 4 tensor&#xA;    M = M.reshape(d1, d2, d1, d2)&#xA;&#xA;    # Transpose 2nd system&#xA;    M = M.transpose((0, 3, 2, 1))&#xA;&#xA;    # Reshape back into a density matrix&#xA;    return M.reshape(d1 * d2, d1 * d2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Pi_k^{T_B}$&lt;/span&gt;. But then Picos tells me that I can't slice variable expressions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error message for the above SDP code snippet I get is:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-38-36083f3fb159&amp;gt; in &amp;lt;module&amp;gt;&#xA;     12 &#xA;     13 # Partial transposes&#xA;---&amp;gt; 14 p.add_constraint(PT_B(P_0, 3, 3) &amp;gt;&amp;gt; 0)&#xA;     15 p.add_constraint(PT_B(P_1, 3, 3) &amp;gt;&amp;gt; 0)&#xA;     16 p.add_constraint(PT_B(P_2, 3, 3) &amp;gt;&amp;gt; 0)&#xA;&#xA;&amp;lt;ipython-input-34-2327f6ca6850&amp;gt; in PT_B(M, d1, d2)&#xA;      5     Output: Partial Transpose M_TB&#xA;      6     &quot;&quot;&quot;&#xA;----&amp;gt; 7     assert M.shape == (d1 * d2, d1 * d2)&#xA;      8 &#xA;      9     # Reshape into 4 tensor&#xA;&#xA;AttributeError: 'Variable' object has no attribute 'shape'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If I try to force the variable expression into an np.array:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[...]&#xA;&#xA;# Partial transposes&#xA;p.add_constraint(PT_B(np.array(P_0), 3, 3) &amp;gt;&amp;gt; 0)&#xA;p.add_constraint(PT_B(np.array(P_1), 3, 3) &amp;gt;&amp;gt; 0)&#xA;p.add_constraint(PT_B(np.array(P_2), 3, 3) &amp;gt;&amp;gt; 0)&#xA;p.add_constraint(PT_B(np.array(P_inc), 3, 3) &amp;gt;&amp;gt; 0)&#xA;&#xA;[...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I get the error message:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;TypeError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-39-c6e549dceb23&amp;gt; in &amp;lt;module&amp;gt;&#xA;     12 &#xA;     13 # Partial transposes&#xA;---&amp;gt; 14 p.add_constraint(PT_B(np.array(P_0), 3, 3) &amp;gt;&amp;gt; 0)&#xA;     15 p.add_constraint(PT_B(P_1, 3, 3) &amp;gt;&amp;gt; 0)&#xA;     16 p.add_constraint(PT_B(P_2, 3, 3) &amp;gt;&amp;gt; 0)&#xA;&#xA;/usr/local/lib/python3.7/site-packages/picos/expressions.py in __getitem__(self, index)&#xA;   3973         JJ = rangeT&#xA;   3974         VV = [1.] * nsz&#xA;-&amp;gt; 3975         newfacs = {self: spmatrix(VV, II, JJ, (nsz, sz))}&#xA;   3976         if not self.constant is None:&#xA;   3977             newcons = self.constant[rangeT]&#xA;&#xA;/usr/local/lib/python3.7/site-packages/picos/tools.py in spmatrix(*args, **kwargs)&#xA;   2187     &quot;&quot;&quot;&#xA;   2188     try:&#xA;-&amp;gt; 2189         return cvx.spmatrix(*args, **kwargs)&#xA;   2190     except TypeError as error:&#xA;   2191         # CVXOPT does not like NumPy's int64 scalar type for indices, so attempt&#xA;&#xA;TypeError: dimension too small&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone have an idea how to implement the PPT constraint in the SDP in Python?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematica doesn't allow complex matrix SDPs, and Picos and CVXPY give me a hard time implementing the PPT constraint.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any suggestions!&lt;/p&gt;&#xA;" OwnerUserId="8458" LastEditorUserId="10480" LastEditDate="2021-03-09T18:46:27.510" LastActivityDate="2021-03-09T18:46:27.510" Title="How can I implement partial transpose on a variable in Picos (Python, trying to solve an SDP)?" Tags="&lt;programming&gt;&lt;optimization&gt;&lt;semidefinite-programming&gt;&lt;partial-transpose&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9975" PostTypeId="1" AcceptedAnswerId="9977" CreationDate="2020-02-24T17:10:04.303" Score="1" ViewCount="273" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerDisplayName="user10151" LastEditorDisplayName="user10151" LastEditDate="2020-02-24T17:15:19.713" LastActivityDate="2020-02-24T18:49:48.063" Title="What are the mathematical prerequisites to study machine learning on quantum computers?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;applications&gt;&lt;trapped-ion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9976" PostTypeId="1" AcceptedAnswerId="9982" CreationDate="2020-02-24T18:47:31.547" Score="1" ViewCount="66" Body="&lt;p&gt;Will quantum computers be able to pass the Turing test sooner than classical computers?&lt;/p&gt;&#xA;" OwnerDisplayName="user10151" LastActivityDate="2020-02-25T08:37:46.587" Title="Will quantum computers pass the Turing test?" Tags="&lt;classical-computing&gt;&lt;quantum-turing-machine&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-02-25T13:00:53.273" ContentLicense="CC BY-SA 4.0" />
  <row Id="9977" PostTypeId="2" ParentId="9975" CreationDate="2020-02-24T18:49:48.063" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;very&lt;/em&gt; different than running on real hardware and interpreting the results. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A couple of questions that might help you narrow your interests are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2151/introductory-material-for-quantum-machine-learning?rq=1&quot;&gt;Introductory material for quantum machine learning&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1208/is-there-any-potential-application-of-quantum-computers-in-machine-learning-or-a?rq=1&quot;&gt;Is there any potential application of quantum computers in machine learning or AI?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-02-24T18:49:48.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9978" PostTypeId="1" CreationDate="2020-02-24T18:57:04.223" Score="6" ViewCount="94" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1711.06146v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, in Appendix B.1 (&lt;em&gt;Grover's Search Algorithm and Grover Operator G&lt;/em&gt;), 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, it separates the uniform superposition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|{\psi}\rangle = \frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}{|x\rangle} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;in two desired states (based on Oracle &quot;responses&quot;) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle = \sqrt{\frac{M}{N}}|\chi\rangle + \sqrt{\frac{N-M}{N}}|\xi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\chi\rangle = \frac{1}{\sqrt{M}}\sum_{x,f(x)=1}{|x\rangle} \quad,\quad&#xA;|\xi\rangle = \frac{1}{\sqrt{N-M}}\sum_{x,f(x)=0}{|x\rangle}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; (with n being the number of qubits) and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the number of Maximal Cliques, in this case the number of states which &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt;, the states which would be flipped by the Oracle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it changes the coefficients of each summation to trigonometric ones as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle = \sin{\frac{\theta}{2}}|\chi\rangle + \cos{\frac{\theta}{2}}|\xi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I could easily see that this transformation is correct and preserves &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\psi\rangle=1$&lt;/span&gt;, but I got confused on how to deduce it for a many qubits system and how to achieve a similar structure after applying the &lt;em&gt;Grover Operator G&lt;/em&gt; R times as stated by the paper in the following equation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ G^R|\psi\rangle = \sin{\frac{(2R+1)\theta}{2}}|\chi\rangle + \cos{\frac{(2R+1)\theta}{2}}|\xi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7333" LastEditorUserId="7333" LastEditDate="2020-02-25T23:59:51.757" LastActivityDate="2020-08-02T20:47:14.613" Title="Changing qubits coefficients to trigonometric functions in Grover Algorithm" Tags="&lt;mathematics&gt;&lt;grovers-algorithm&gt;&lt;quantum-networks&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9979" PostTypeId="2" ParentId="9969" CreationDate="2020-02-24T23:56:38.263" Score="2" Body="&lt;p&gt;If you include the third qubit in your state, now, you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\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⟩)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you expand this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ + \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⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then do the CNOT on each basis state, changing the third bit iff the second bit is 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ + \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⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;... and that's your final state! Kind of a mess as you can see; there's a reason people avoid computing these by hand. :)&lt;/p&gt;&#xA;" OwnerUserId="10115" LastActivityDate="2020-02-24T23:56:38.263" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9980" PostTypeId="1" CreationDate="2020-02-25T04:06:33.183" Score="2" ViewCount="54" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8120" LastEditorUserId="9006" LastEditDate="2020-02-25T05:52:18.060" LastActivityDate="2020-02-25T05:52:18.060" Title="Software for implementing Quantum Machine Learning" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9981" PostTypeId="2" ParentId="9970" CreationDate="2020-02-25T05:49:54.590" Score="2" Body="&lt;p&gt;Quantum computers bring quadratic speed-up for Monte Carlo method.&#xA;See for example &lt;a href=&quot;https://arxiv.org/abs/1806.06893&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Risk Analysis&lt;/a&gt; where the authors discussed application of Monte Carlo for risk management in finance.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-25T05:49:54.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9982" PostTypeId="2" ParentId="9976" CreationDate="2020-02-25T08:37:46.587" Score="0" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum computer &quot;alone&quot; 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 &lt;strong&gt;very specific&lt;/strong&gt; tasks that are out of reach for classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;hope&lt;/strong&gt; that quantum computers will help us with machine learning. But this is still only in the realm of speculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9918" LastActivityDate="2020-02-25T08:37:46.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9983" PostTypeId="1" AcceptedAnswerId="9988" CreationDate="2020-02-25T11:41:34.587" Score="5" ViewCount="404" Body="&lt;p&gt;Exercise 2.77 in Nielsen and Chuang asks to show by example that there exist tripartite states &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle_{ABC} $&lt;/span&gt; which cannot be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi \rangle = \sum_i \lambda_i | i_A \rangle | i_B \rangle | i_C \rangle .$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;https://github.com/goropikari/SolutionQCQINielsenChuang&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; unofficial solution set, they consider the state &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \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].$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then they perform the arbitrary (unitary) change of basis&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle = \alpha | \phi_0 \rangle + \beta | \phi_1 \rangle , \\&#xA;|1\rangle = \gamma | \phi_0 \rangle + \delta | \phi_1 \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;obtaining&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \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].$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the cross terms cannot vanish, the proof is finished. However, I don't see the last step. Why do you have &lt;span class=&quot;math-container&quot;&gt;$ |00 \rangle_{BC} + | 11 \rangle_{BC}  =  |\phi_0 \phi_0 \rangle_{BC} + | \phi_1 \phi_1 \rangle_{BC}$&lt;/span&gt; ? I mean, for instance, the unitarity of the change of basis doesn't buy us the cancellation of the terms &lt;span class=&quot;math-container&quot;&gt;$ | \phi_0 \phi_1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| \phi_1 \phi_0 \rangle$&lt;/span&gt; (I think).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: Note that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) The coefficients &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; are not, in general, real. Since we want to show that there is no way of rewritting &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; in Schmidt form, we have to consider the most general case where these coefficients are complex.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) The change of basis is, in the most general case, different for each party. I mean, we should rather write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0 \rangle_X = \alpha_X \, | \phi_0 \rangle_X + \beta_X \, | \phi_1 \rangle_X \, ,  \\&#xA;| 1 \rangle_X = \gamma_X \, | \phi_0 \rangle_X + \delta_X \, | \phi_1 \rangle_X \, , $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X= A, B, C$&lt;/span&gt;. Unitarity conditions are&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \alpha_X |^2 + |\beta_X |^2 = | \gamma_X |^2 + |\delta_X |^2  = 1 \, ,\\&#xA;\alpha_X^* \gamma_X + \beta_X^* \delta_X = 0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for each &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. I don't see how you can cancel the cross terms using this.&lt;/p&gt;&#xA;" OwnerUserId="9895" LastEditorUserId="55" LastEditDate="2021-02-20T16:27:05.577" LastActivityDate="2021-05-07T12:10:13.283" Title="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$" Tags="&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;bell-basis&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9984" PostTypeId="1" AcceptedAnswerId="10007" CreationDate="2020-02-25T12:17:00.410" Score="2" ViewCount="150" Body="&lt;p&gt;I'm trying to use sympy to compute symbolic results of quantum circuits using dirac notation. &#xA;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 : &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from IPython.display import display&#xA;&#xA;from sympy import init_printing&#xA;init_printing(use_latex=True)&#xA;from sympy import expand, Eq, Symbol, simplify, exp, sin,cos,I,srepr,Matrix&#xA;from sympy.physics.quantum import *&#xA;from sympy.physics.quantum.qubit import *&#xA;from sympy.physics.quantum.gate import *&#xA;from sympy.physics.quantum.circuitplot import circuit_plot&#xA;&#xA;&#xA;theta = Symbol('theta')&#xA;&#xA;Ry_mat = Matrix([[cos(theta/2), -sin(theta/2)],[sin(theta/2),cos(theta/2)]]) #check&#xA;Rx_mat = Matrix([[cos(theta/2), -I*sin(theta/2)],[-I*sin(theta/2),cos(theta/2)]]) #check&#xA;&#xA;Ry = UGate((0,), Ry_mat)&#xA;Rx= UGate((1,), Rx_mat)&#xA;c = Ry*Rx&#xA;circuit_plot(c, nqubits=2);&#xA;&#xA;qapply(c*Qubit('00'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get the error &lt;strong&gt;unhashable type: 'MutableDenseMatrix'&lt;/strong&gt;&#xA;when executing qapply. I tried to replace the line :&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = Rx*Ry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c = Rx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and then there is no more errors. Does someone know what's going on ? What am I doing wrong ?&lt;/p&gt;&#xA;" OwnerUserId="10065" LastActivityDate="2020-02-26T18:02:47.320" Title="symbolic quantum computing using sympy : how to use arbitrary gate?" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9985" PostTypeId="1" CreationDate="2020-02-25T14:10:05.027" Score="2" ViewCount="96" Body="&lt;p&gt;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%.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vyHDd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vyHDd.png&quot; alt=&quot;figure&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5ar6P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ar6P.png&quot; alt=&quot;results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg qA[8];&#xA;qreg qB[8];&#xA;qreg qC[6];&#xA;qreg qD[6];&#xA;creg c[4];&#xA;&#xA;h qA[2];&#xA;h qA[4];&#xA;x qA[6];&#xA;x qA[7];&#xA;x qB[1];&#xA;h qB[2];&#xA;h qB[4];&#xA;x qB[6];&#xA;x qB[7];&#xA;h qC[0];&#xA;h qC[2];&#xA;x qC[4];&#xA;x qC[5];&#xA;h qD[0];&#xA;h qD[2];&#xA;x qD[4];&#xA;x qD[5];&#xA;cx qA[2],qA[3];&#xA;cx qA[4],qA[5];&#xA;h qA[6];&#xA;cx qB[2],qB[3];&#xA;cx qB[4],qB[5];&#xA;h qB[6];&#xA;cx qC[0],qC[1];&#xA;cx qC[2],qC[3];&#xA;h qC[4];&#xA;cx qD[0],qD[1];&#xA;cx qD[2],qD[3];&#xA;h qD[4];&#xA;cx qA[6],qA[7];&#xA;cx qB[6],qB[7];&#xA;cx qC[4],qC[5];&#xA;cx qD[4],qD[5];&#xA;x qA[0];&#xA;ccx qA[6],qA[0],qA[4];&#xA;ccx qB[6],qB[0],qB[4];&#xA;ccx qA[7],qA[1],qA[5];&#xA;ccx qB[7],qB[1],qB[5];&#xA;x qA[6];&#xA;x qA[7];&#xA;x qB[6];&#xA;x qB[7];&#xA;ccx qA[6],qA[0],qA[2];&#xA;ccx qB[6],qB[0],qB[2];&#xA;ccx qA[7],qA[1],qA[3];&#xA;ccx qB[7],qB[1],qB[3];&#xA;cx qA[2],qA[3];&#xA;cx qA[4],qA[5];&#xA;cx qB[2],qB[3];&#xA;cx qB[4],qB[5];&#xA;ccx qA[3],qC[4],qC[2];&#xA;ccx qB[3],qC[5],qC[3];&#xA;x qC[4];&#xA;x qC[5];&#xA;ccx qA[3],qC[4],qC[0];&#xA;id qA[5];&#xA;ccx qB[3],qC[5],qC[1];&#xA;id qA[5];&#xA;cx qC[0],qC[1];&#xA;cx qC[2],qC[3];&#xA;ccx qA[5],qD[4],qD[2];&#xA;ccx qB[5],qD[5],qD[3];&#xA;x qD[4];&#xA;x qD[5];&#xA;ccx qA[5],qD[4],qD[0];&#xA;ccx qB[5],qD[5],qD[1];&#xA;cx qD[0],qD[1];&#xA;cx qD[2],qD[3];&#xA;measure qC[1] -&amp;gt; c[3];&#xA;measure qC[3] -&amp;gt; c[2];&#xA;measure qD[1] -&amp;gt; c[1];&#xA;measure qD[3] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="8620" LastEditDate="2020-02-25T14:48:11.753" LastActivityDate="2021-03-21T18:01:35.143" Title="Why I am not getting approximate equiprobable states in the following circuit on IBM Q simulator?" Tags="&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="9986" PostTypeId="2" ParentId="9983" CreationDate="2020-02-25T14:34:53.730" Score="-1" Body="&lt;p&gt;the trick is to show the relation &lt;span class=&quot;math-container&quot;&gt;$\alpha \beta$&lt;/span&gt; = - &lt;span class=&quot;math-container&quot;&gt;$\gamma \delta$&lt;/span&gt;  so the cross terms cancels out. It's not so straightforward in my opinion. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's develop the term (dropping the subscript here) &lt;span class=&quot;math-container&quot;&gt;$|00⟩+|11⟩$&lt;/span&gt; in term of the new basis :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ |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⟩ $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we can show that &lt;span class=&quot;math-container&quot;&gt;$\alpha \beta$&lt;/span&gt; = - &lt;span class=&quot;math-container&quot;&gt;$\gamma \delta$&lt;/span&gt; then the above expression reduces to &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00⟩+|11⟩ =(\alpha^2+\gamma^2) |\phi_0 \phi_0⟩ +  (\beta^2+\delta^2) |\phi_1 \phi_1⟩$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we would only need to prove &lt;span class=&quot;math-container&quot;&gt;$(\alpha^2+\gamma^2) = (\beta^2+\delta^2) = 1 $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's show that indeed &lt;span class=&quot;math-container&quot;&gt;$\alpha \beta$&lt;/span&gt; = - &lt;span class=&quot;math-container&quot;&gt;$\gamma \delta$&lt;/span&gt;.&#xA;First remind that a unitary transform preserves orthogonality and since &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1⟩$&lt;/span&gt; are orthogonal, so are &lt;span class=&quot;math-container&quot;&gt;$\alpha |\phi_0⟩ + \beta |\phi_1⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\gamma |\phi_0⟩ + \delta |\phi_1⟩$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;writing the scalar product between the two and using orthogonality we find the relation :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha \gamma + \beta \delta = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not yet what we want.&#xA;We also know from definition of a qubit that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha^2 +\beta^2 =1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma^2 + \delta^2 = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;combining those three equalities and with some help from wolphram I found that this system had solutions all implying the equality &lt;span class=&quot;math-container&quot;&gt;$\alpha \beta = -\gamma \delta$&lt;/span&gt;. I'm not writing the solutions here but you can use this &lt;a href=&quot;https://www.wolframalpha.com/input/?i=systems%20of%20equations%20calculator&amp;amp;assumption=%7B%22F%22%2C%20%22SolveSystemOf3EquationsCalculator%22%2C%20%22equation1%22%7D%20-%3E%22a%5E2%2Bb%5E2%20%3D%201%22&amp;amp;assumption=%22FSelect%22%20-%3E%20%7B%7B%22SolveSystemOf3EquationsCalculator%22%7D%7D&amp;amp;assumption=%7B%22F%22%2C%20%22SolveSystemOf3EquationsCalculator%22%2C%20%22equation2%22%7D%20-%3E%22c%5E2%2Bd%5E2%20%3D%201%22&amp;amp;assumption=%7B%22F%22%2C%20%22SolveSystemOf3EquationsCalculator%22%2C%20%22equation3%22%7D%20-%3E%22a*c%20%2B%20b*d%20%3D%200%22&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to wolphram&lt;/a&gt; to check it yourself. Hence the cross term do cancel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To show that &lt;span class=&quot;math-container&quot;&gt;$(\alpha^2+\gamma^2) = (\beta^2+\delta^2) = 1$&lt;/span&gt;, we can use the result we just showed and the equality using orthogonality :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha \gamma   = - \beta \delta$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha \beta = -\gamma \delta$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so &lt;span class=&quot;math-container&quot;&gt;$\gamma = -\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha^2 + \beta^2 = \alpha^2 + \gamma^2 = 1$&lt;/span&gt;.&#xA;proceed the same way to show &lt;span class=&quot;math-container&quot;&gt;$\beta^2 + \delta^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-02-25T15:09:48.303" LastActivityDate="2020-02-25T15:09:48.303" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9987" PostTypeId="2" ParentId="9985" CreationDate="2020-02-25T14:58:27.400" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WRBfl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WRBfl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-02-25T15:21:21.037" LastActivityDate="2020-02-25T15:21:21.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9988" PostTypeId="2" ParentId="9983" CreationDate="2020-02-25T15:55:54.163" Score="5" Body="&lt;p&gt;In case you are interested in an alternative proof...&lt;/p&gt;&#xA;&lt;p&gt;For a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as given, the reduced density matrices of each of the three qubits must all be of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_i\lambda_i|i_X\rangle\langle i_X|$&lt;/span&gt;, where the basis &lt;span class=&quot;math-container&quot;&gt;$|i_X\rangle$&lt;/span&gt; is orthonormal. That means that all three density matrices have the same spectrum (eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Now, consider a state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle(|00\rangle+|11\rangle)/\sqrt{2}&#xA;$$&lt;/span&gt;&#xA;The first qubit is separable, so the eigenvalues of the reduced density matrix are &lt;span class=&quot;math-container&quot;&gt;$\lbrace 1,0\rbrace$&lt;/span&gt;. The other two qubits are maximally mixed due to the entanglement, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lbrace 1/2,1/2\rbrace$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="15220" LastEditDate="2021-05-07T12:10:13.283" LastActivityDate="2021-05-07T12:10:13.283" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="9989" PostTypeId="1" CreationDate="2020-02-25T16:30:02.763" Score="1" ViewCount="40" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-02-25T16:30:02.763" Title="Primer for Quantum Circuits and Optimization" Tags="&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9990" PostTypeId="1" AcceptedAnswerId="9993" CreationDate="2020-02-25T18:07:27.317" Score="4" ViewCount="215" Body="&lt;p&gt;I could not find any lower bound on the diamond norm for two uniformly random unitaries of dimension D sampled from the haar measure.&lt;/p&gt;&#xA;" OwnerUserId="8748" LastEditorUserId="55" LastEditDate="2020-10-28T09:25:00.080" LastActivityDate="2020-10-28T09:25:00.080" Title="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?" Tags="&lt;haar-distribution&gt;&lt;diamond-norm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9991" PostTypeId="2" ParentId="9983" CreationDate="2020-02-25T18:25:46.580" Score="1" Body="&lt;p&gt;It is &lt;em&gt;not&lt;/em&gt; true that &lt;span class=&quot;math-container&quot;&gt;$ |00 \rangle + | 11 \rangle  =  |\phi_0 \phi_0 \rangle + | \phi_1 \phi_1 \rangle$&lt;/span&gt; for an arbitrary change of basis. For example, let &lt;span class=&quot;math-container&quot;&gt;$|\phi_0 \rangle = |0\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |\phi_1 \rangle = i|1 \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can, however, pick &lt;span class=&quot;math-container&quot;&gt;$ \phi_1 $&lt;/span&gt; so that this equality is true, given &lt;span class=&quot;math-container&quot;&gt;$ \phi_0 $&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$ |\phi_0 \rangle = \kappa | 0 \rangle + \mu | 1 \rangle $&lt;/span&gt;, pick &lt;span class=&quot;math-container&quot;&gt;$ | \phi_1 \rangle = \mu | 0 \rangle - \kappa | 1 \rangle $&lt;/span&gt; .&lt;/p&gt;&#xA;" OwnerUserId="9995" LastActivityDate="2020-02-25T18:25:46.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9992" PostTypeId="1" CreationDate="2020-02-25T18:43:40.493" Score="0" ViewCount="51" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know it's a long shot, but I hope to hear back from someone!&lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2021-03-22T16:07:15.763" Title="Quantum Noise Dataset" Tags="&lt;machine-learning&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9993" PostTypeId="2" ParentId="9990" CreationDate="2020-02-25T20:27:12.683" Score="8" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, suppose that &lt;span class=&quot;math-container&quot;&gt;$\Phi_0(X) = U_0 X U_0^{\dagger}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_1(X) = U_1 X U_1^{\dagger}$&lt;/span&gt; are any two unitary channels. In this special case, the diamond norm distance between these two channels can be expressed as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\Phi_0 - \Phi_1\|_{\diamond} = 2 \sqrt{1 - \delta(U_0^{\dagger} U_1)^2},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\delta(A)$&lt;/span&gt; denotes the minimum absolute value taken over the numerical range of a given operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. That is,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta(A) = \min_{|\psi\rangle} |\langle \psi | A | \psi\rangle|,&#xA;$$&lt;/span&gt;&#xA;where the minimum is over all unit vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if you're interested in &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; being Haar-random, then you might as well set &lt;span class=&quot;math-container&quot;&gt;$U_0 = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_1 = U$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do not know enough about this topic to give you precise bounds, but it is clear that as the dimension &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; 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, &lt;em&gt;all&lt;/em&gt; of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$U_0^{\dagger} U_1$&lt;/span&gt;) must fall within an arc on the unit circle having length strictly less than &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, which is extremely unlikely for large &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; (surely the probability is exponentially small in &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;). &lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-02-25T20:27:12.683" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="9994" PostTypeId="1" AcceptedAnswerId="9995" CreationDate="2020-02-26T05:14:17.770" Score="2" ViewCount="100" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean actual quantum computers rather than simulation of quantum computers on classical computers&lt;/p&gt;&#xA;" OwnerDisplayName="user10151" LastActivityDate="2020-02-26T15:30:01.090" Title="Is Industry or PhD programs best for someone wanting to go to quantum machine learning?" Tags="&lt;resource-request&gt;&lt;machine-learning&gt;&lt;research&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-02-27T21:19:29.807" ContentLicense="CC BY-SA 4.0" />
  <row Id="9995" PostTypeId="2" ParentId="9994" CreationDate="2020-02-26T06:14:25.757" Score="0" Body="&lt;p&gt;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 &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-02-26T15:30:01.090" LastActivityDate="2020-02-26T15:30:01.090" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="9996" PostTypeId="1" AcceptedAnswerId="10013" CreationDate="2020-02-26T14:45:01.990" Score="5" ViewCount="256" Body="&lt;p&gt;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 &lt;code&gt;QuantumCircuit&lt;/code&gt; object, can I obtain the gates that are applied to each qubit in order? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to implement certain noise gate after each Hadamard and I would have therefore to identify each Hadamard in the &lt;code&gt;QuantumCircuit&lt;/code&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-10-28T09:24:31.987" LastActivityDate="2020-10-28T09:24:31.987" Title="How to read the elements of a circuit in qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9997" PostTypeId="1" AcceptedAnswerId="10000" CreationDate="2020-02-26T14:47:47.453" Score="1" ViewCount="83" Body="&lt;p&gt;How do I explain qubits to my cousin who is 8 years old?&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="9006" LastEditDate="2020-02-27T05:25:27.543" LastActivityDate="2020-02-27T05:25:27.543" Title="How do I explain qubits to my cousin who is 8 year old?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="9998" PostTypeId="2" ParentId="9996" CreationDate="2020-02-26T15:09:20.877" Score="1" Body="&lt;p&gt;I would recommend doing this by converting the circuit to a &lt;code&gt;DAGCircuit&lt;/code&gt; and then using the &lt;code&gt;topological_op_nodes()&lt;/code&gt; &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/544f80cbb04dc8f2b71d479b4476f59be3e38090/qiskit/dagcircuit/dagcircuit.py#L714&quot; rel=&quot;nofollow noreferrer&quot;&gt;property&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To convert a circuit to a DAG you can use the function &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.converter import circuit_to_dag&#xA;dag = circuit_to_dag(your_circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then you can iterate over the nodes&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for node in dag.topological_op_nodes():&#xA;    if node.name == 'H':&#xA;       ~do something~&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The objects returned are &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/544f80cbb04dc8f2b71d479b4476f59be3e38090/qiskit/dagcircuit/dagnode.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;DAGNodes&lt;/a&gt; and contain all the information for you to be able to add the gate to a new circuit.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-26T15:09:20.877" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="9999" PostTypeId="1" CreationDate="2020-02-26T15:16:35.563" Score="0" ViewCount="271" Body="&lt;p&gt;Consider the product of gates acting on two qubits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;\cdot&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{pmatrix} &#xA;\cdot&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}} \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;This is a controlled Hadamard, then SWAP, then CNOT.  On the basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;00 \\ 01 \\ 10 \\ 11&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;This leaves us, before the last CNOT, in the basis,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;00 \\ 1 + \\ 01 \\ 1 -&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="5527" LastActivityDate="2020-02-26T16:06:13.083" Title="Interpretation of CNOT after basis-change" Tags="&lt;quantum-gate&gt;&lt;quantum-control&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10000" PostTypeId="2" ParentId="9997" CreationDate="2020-02-26T15:32:59.810" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-02-26T15:32:59.810" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10001" PostTypeId="2" ParentId="2151" CreationDate="2020-02-26T15:51:56.700" Score="4" Body="&lt;p&gt;A lot of focus in quantum machine learning in the near term revolves around &lt;strong&gt;variational quantum algorithms&lt;/strong&gt; (you'll also see them called &lt;em&gt;variational quantum circuits&lt;/em&gt; or &lt;em&gt;parameterized quantum circuits&lt;/em&gt;), 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/2058-9565/ab4eb5/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Benedetti &lt;em&gt;et al&lt;/em&gt; (2019). Parameterized quantum circuits as machine learning models&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would certainly recommend it over the Nature paper mentioned above if you are intereted in the emerging near-term viewpoint. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We've also been curating a number of explanatory QML materials and code demos over at &lt;strong&gt;&lt;a href=&quot;https://pennylane.ai/qml&quot; rel=&quot;nofollow noreferrer&quot;&gt;pennylane.ai/qml&lt;/a&gt;&lt;/strong&gt; which might be helpful for people trying to learn the field.&lt;/p&gt;&#xA;" OwnerUserId="10193" LastActivityDate="2020-02-26T15:51:56.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10002" PostTypeId="2" ParentId="9992" CreationDate="2020-02-26T15:53:52.380" Score="0" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.idquantique.com/resource-library/random-number-generation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-02-26T15:53:52.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10003" PostTypeId="2" ParentId="9997" CreationDate="2020-02-26T16:05:14.467" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=OWJCfOvochA&amp;amp;t=1s&quot; rel=&quot;nofollow noreferrer&quot;&gt;This video&lt;/a&gt; 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 &lt;a href=&quot;https://www.amazon.co.uk/Quantum-Computing-Babies-Baby-University/dp/1492671185/ref=pd_vtp_14_5/258-9928486-5589610?_encoding=UTF8&amp;amp;pd_rd_i=1492671185&amp;amp;pd_rd_r=97c6bacb-fcc0-4a43-a0b7-0cabb9032a6b&amp;amp;pd_rd_w=Ok4iz&amp;amp;pd_rd_wg=pTzif&amp;amp;pf_rd_p=78dd719b-ab64-47e6-8dc1-945f566666b3&amp;amp;pf_rd_r=2NAM3BXH7ZF66HDM6SC6&amp;amp;psc=1&amp;amp;refRID=2NAM3BXH7ZF66HDM6SC6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing for Babies&lt;/a&gt; do a good job of simplifying the concepts so that anyone can understand them!&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-26T16:05:14.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10004" PostTypeId="2" ParentId="9999" CreationDate="2020-02-26T16:06:13.083" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis, then the role is entirely reversed, due to the circuit identity&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uJB7y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uJB7y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you &lt;em&gt;might&lt;/em&gt; complain that the name is not fair if it only applies to one particular basis. But you have to give it &lt;em&gt;some&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yes, as you say, it &lt;em&gt;is&lt;/em&gt; a permutation matrix (I guess this is what you mean by 'swap') but that hardly distinguishes it from many other permutation matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the same token, consider the single-qubit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should also mention that I don't think your calculation of your circuit is correct. If you start with the collection &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$&lt;/span&gt;, the controlled-Hadamard maps these to &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|01\rangle,|1+\rangle,|1-\rangle\}$&lt;/span&gt;, and the swap then maps them to &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|10\rangle,|+1\rangle,|-1\rangle\}$&lt;/span&gt;, which is not what you stated. When you apply the controlled-not on these, some of them (the latter two) will be entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me run through one specific example: cNOT applied to &lt;span class=&quot;math-container&quot;&gt;$|+1\rangle$&lt;/span&gt;. The way that I work this out is the expand it as &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)|1\rangle/\sqrt{2}$&lt;/span&gt;. I apply the controlled-not by using linearity and thinking about exactly the description of how it works on basis states: &lt;span class=&quot;math-container&quot;&gt;$|01\rangle\mapsto|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle\mapsto|10\rangle$&lt;/span&gt;, so the output is &lt;span class=&quot;math-container&quot;&gt;$(|01\rangle+|10\rangle)/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-26T16:06:13.083" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="10006" PostTypeId="1" AcceptedAnswerId="10008" CreationDate="2020-02-26T17:51:52.290" Score="1" ViewCount="108" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-10-28T09:24:27.257" LastActivityDate="2020-10-28T09:24:27.257" Title="How do I know in which state the qubit is in each step of the circuit for the simulator in qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10007" PostTypeId="2" ParentId="9984" CreationDate="2020-02-26T18:02:47.320" Score="1" Body="&lt;p&gt;I don't know why this doesn't work with &lt;code&gt;Matrix&lt;/code&gt;, but a fix for this would be to use &lt;code&gt;ImmutableMatrix&lt;/code&gt; instead&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from sympy import Symbol, sin, cos, I, ImmutableMatrix&#xA;from sympy.physics.quantum import qapply&#xA;from sympy.physics.quantum.qubit import Qubit&#xA;from sympy.physics.quantum.gate import UGate&#xA;&#xA;theta = Symbol('theta')&#xA;&#xA;Ry_mat = ImmutableMatrix([[cos(theta/2), -sin(theta/2)],&#xA;                        [sin(theta/2),cos(theta/2)]])&#xA;Rx_mat = ImmutableMatrix([[cos(theta/2), -I*sin(theta/2)],&#xA;                        [-I*sin(theta/2) ,cos(theta/2)]])&#xA;&#xA;Ry = UGate((0,), Ry_mat)&#xA;Rx= UGate((1,), Rx_mat)&#xA;c = Ry* Ry&#xA;&#xA;print(qapply(c*Qubit('00'))) # -sin(theta/2)**2*|00&amp;gt; + 2*sin(theta/2)*cos(theta/2)*|01&amp;gt; + cos(theta/2)**2*|00&amp;gt;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've filed an &lt;a href=&quot;https://github.com/sympy/sympy/issues/18733&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt; for your problem. In the meantime, use &lt;code&gt;ImmutableMatrix&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-02-26T18:02:47.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10008" PostTypeId="2" ParentId="10006" CreationDate="2020-02-26T18:03:01.517" Score="3" Body="&lt;p&gt;You can take snapshots of the statevector of the circuit when you use the &lt;code&gt;'qasm_simulator'&lt;/code&gt;. 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 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.extensions.simulator import snapshot&#xA;qc.snapshot('my_label')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-26T18:03:01.517" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10009" PostTypeId="1" AcceptedAnswerId="10010" CreationDate="2020-02-26T18:36:57.823" Score="5" ViewCount="207" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More concretely:&lt;br&gt;&#xA; 1. Classical solutions require at-least &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}+1$&lt;/span&gt; evaluations of the black-box function where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of &lt;em&gt;classical&lt;/em&gt; bits.&lt;br&gt;&#xA; 2. Deutsch-Jozsa algorithm requires a single evaluation of the black-box function. However, it takes as input &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &lt;em&gt;qubits&lt;/em&gt;.   &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is not the same as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical bits. They require exponentially more information to simulate.   &lt;/li&gt;&#xA;&lt;li&gt;The black-box function is not the same in both cases since one deals with classical bits whereas the other deals with qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10147" LastActivityDate="2020-02-27T10:29:29.093" Title="How can we compare quantum algorithms against classical equivalents?" Tags="&lt;algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10010" PostTypeId="2" ParentId="10009" CreationDate="2020-02-26T22:49:14.587" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://www.scottaaronson.com/blog/?p=451&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aarsonson&lt;/a&gt; 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 &quot;One is exponentially faster than the other&quot; in the Deutsch-Jozsa sense, we are saying that &quot;One is exponentially faster than the other &lt;em&gt;relative to an oracle&lt;/em&gt;&quot;.&lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-02-26T22:49:14.587" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10011" PostTypeId="2" ParentId="10009" CreationDate="2020-02-26T23:15:18.257" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and we express the complexity by a function of the number of input &lt;span class=&quot;math-container&quot;&gt;$f(n)$&lt;/span&gt;, characterizing the resources needed for the computation, typically, time or space. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In quantum computing the inputs are qubits, and so complexity of an algorithm is a function of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, If we have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking the case of the Deutsch-Jozsa algorithm, for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in input, we need &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O(n)}$&lt;/span&gt; gates, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O(n)}$&lt;/span&gt; measurement as well and the application of an oracle, which I think also has &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O(n)}$&lt;/span&gt; complexity in time but that would ask for confirmation. Globally, we need &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O(n)}$&lt;/span&gt; operations. In the case of a classical computer we need &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(2^n)$&lt;/span&gt; operations so you can see that there's an exponential speedup for the quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia article&lt;/a&gt; mentions that the Shor's algorithm without correcting codes requires between &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L^2$&lt;/span&gt; qubits for factoring a number with &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; bits, but requires to multiply by another factor &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; the number of qubits needed with quantum error correcting codes. &lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-02-27T10:29:29.093" LastActivityDate="2020-02-27T10:29:29.093" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10012" PostTypeId="1" CreationDate="2020-02-27T01:39:14.640" Score="1" ViewCount="92" Body="&lt;p&gt;I want to know the fidelity (or error rate) of the preparation of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. How can I obtain it?&lt;/p&gt;&#xA;" OwnerUserId="10200" LastEditorUserId="10480" LastEditDate="2021-01-25T08:13:45.400" LastActivityDate="2021-02-24T19:04:25.383" Title="How can I find the fidelity of preparation?" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;fidelity&gt;&lt;state-preparation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10013" PostTypeId="2" ParentId="9996" CreationDate="2020-02-27T06:46:04.880" Score="2" Body="&lt;p&gt;You can play with the circuit's &lt;code&gt;data&lt;/code&gt;. First write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(circ.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from pprint import pprint&#xA;pprint(vars(circ.data))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then you'll understand the structure and how to modify it.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-02-27T06:46:04.880" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10014" PostTypeId="1" AcceptedAnswerId="10015" CreationDate="2020-02-27T09:47:44.610" Score="3" ViewCount="140" Body="&lt;p&gt;It is well known that circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1fkDP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1fkDP.png&quot; alt=&quot;CNOT_1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;can be replaced with this circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wpaUF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wpaUF.png&quot; alt=&quot;CNOT_2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The situation is even easier in case of controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; where gate controlled by &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and acting on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; have same matrix as one controlled by &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and acting on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. This means that replacing gate controled by qubit &quot;below&quot; with one controlled by qubit &quot;above&quot; does not need any additional gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was thinking about general case, i.e. how to replace general controlled gate &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U}$&lt;/span&gt; with controlling qubit &quot;below&quot; by the gate controlled by qubit &quot;above&quot;. The very basic idea is to apply swap gate, then controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U}$&lt;/span&gt; with controlling qubit &quot;above&quot; and then again swap gate. This is right approach because &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U}$&lt;/span&gt; gate controlled by qubit &quot;above&quot; is described by matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{CU_{above} =}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; u_{11} &amp;amp; u_{12} \\&#xA;0 &amp;amp; 0 &amp;amp; u_{21} &amp;amp; u_{22} &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and the gate controlled by qubit &quot;below&quot; has this matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{CU_{below} =}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; u_{11} &amp;amp; 0 &amp;amp; u_{12} \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; u_{21} &amp;amp; 0 &amp;amp; u_{22} &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It can be easily checked that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CU_{bellow}} = \mathrm{SWAP} \cdot \mathrm{CU_{above}} \cdot \mathrm{SWAP}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Swap gate can be implemented with three &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt;, two controlled by qubit &quot;above&quot;, one controlled by qubit &quot;below&quot;. However, the latter can be converted to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt; controlled by qubit &quot;above&quot; with help of Hadamards. Ultimatelly, all &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}$&lt;/span&gt;s in swap gate are controlled by qubit &quot;above&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, this is a desired general approach how to convert a gate controlled by qubit &quot;below&quot; to one controlled by qubit &quot;above&quot;. However, application of two swap gates increases depth of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there a simpler general approach how to convert a gate controlled by qubit &quot;below&quot; to one controlled by qubit &quot;above&quot;?&lt;/li&gt;&#xA;&lt;li&gt;Are there other specific construction for other controlled gates similar to approach for controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt;? For example for controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Y}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Ry}$&lt;/span&gt; etc.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-27T10:15:03.070" Title="General approach for switching control and target qubit" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10015" PostTypeId="2" ParentId="10014" CreationDate="2020-02-27T10:00:42.417" Score="4" Body="&lt;p&gt;Any controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U^2=I$&lt;/span&gt; is straightforward. This is because you can write &lt;span class=&quot;math-container&quot;&gt;$U=VZV^\dagger$&lt;/span&gt;. So, we can think of controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt; on target, then controlled-phase, then &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; on target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given the symmetry of controlled-phase, all you have to do is switch which qubits the single-qubit unitaries are applied to.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/yXbdr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yXbdr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;This clearly contains your two stated cases (&lt;span class=&quot;math-container&quot;&gt;$U=X,Z$&lt;/span&gt;) as special cases (&lt;span class=&quot;math-container&quot;&gt;$V=H,I$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About the case of more general &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, I've never thought about it... My first instinct is that given any controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with the switched control/target assignment, and ignoring the fact that you already have controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in the other direction!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-02-27T10:15:03.070" LastActivityDate="2020-02-27T10:15:03.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10016" PostTypeId="1" CreationDate="2020-02-27T10:08:56.630" Score="4" ViewCount="400" Body="&lt;p&gt;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 &quot;Download PNG&quot; or &quot;Download SVG&quot; it continues to show me a 20 results histogram. There is another option that is to pick &quot;Download results&quot; but it downloads two &lt;em&gt;.json&lt;/em&gt; documents which I'm not sure I know how to change into a histogram.&lt;/p&gt;&#xA;" OwnerUserId="10202" LastEditorUserId="5955" LastEditDate="2020-02-27T13:15:04.193" LastActivityDate="2020-02-27T13:15:04.193" Title="How can I get the entire histogram in a 5 qubit program done in IBM quantum experience machine?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10017" PostTypeId="2" ParentId="10016" CreationDate="2020-02-27T10:55:18.647" Score="5" Body="&lt;p&gt;By clicking on Downloand you get two .json files as you mentioned. The results are saved in the file with suffix &lt;em&gt;results&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you open the file in Notepad or any other text editor, you can find results in this form:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;results&quot;:[{&quot;data&quot;:{&quot;counts&quot;:{&quot;0x0&quot;:28,&quot;0x1&quot;:39,&quot;0x10&quot;:35,&quot;0x11&quot;:28,&quot;0x12&quot;:25,&quot;0x13&quot;:32,&quot;0x14&quot;:22,&quot;0x15&quot;:36,&quot;0x16&quot;:42,&quot;0x17&quot;:33,&quot;0x18&quot;:35,&quot;0x19&quot;:23,&quot;0x1a&quot;:34,&quot;0x1b&quot;:24,&quot;0x1c&quot;:29,&quot;0x1d&quot;:43,&quot;0x1e&quot;:34,&quot;0x1f&quot;:31,&quot;0x2&quot;:37,&quot;0x3&quot;:32,&quot;0x4&quot;:31,&quot;0x5&quot;:33,&quot;0x6&quot;:39,&quot;0x7&quot;:35,&quot;0x8&quot;:37,&quot;0x9&quot;:29,&quot;0xa&quot;:29,&quot;0xb&quot;:25,&quot;0xc&quot;:30,&quot;0xd&quot;:29,&quot;0xe&quot;:40,&quot;0xf&quot;:25}},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;0x13&quot;:32&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means that value &lt;span class=&quot;math-container&quot;&gt;$13_{16}=19_{10}=10011_2$&lt;/span&gt; occured 32 times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;HEX2BIN&lt;/em&gt; and then you can use bar graph instead of histogram.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-27T10:55:18.647" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10018" PostTypeId="1" CreationDate="2020-02-27T16:17:10.320" Score="2" ViewCount="43" Body="&lt;p&gt;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.  &lt;/p&gt;&#xA;" OwnerUserId="5693" LastEditorUserId="55" LastEditDate="2020-10-28T09:24:21.377" LastActivityDate="2020-10-28T09:24:21.377" Title="How is the theory of modular representation involved with error-correction?" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10019" PostTypeId="1" CreationDate="2020-02-27T19:32:23.020" Score="16" ViewCount="2652" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there specific reasons to choose a particular technology?&lt;/p&gt;&#xA;" OwnerUserId="9797" LastEditorUserId="-1" LastEditDate="2020-02-28T15:40:59.760" LastActivityDate="2020-11-09T15:01:16.447" Title="Which subatomic particle does each company use in quantum computing?" Tags="&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;d-wave&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="10020" PostTypeId="2" ParentId="10019" CreationDate="2020-02-27T20:45:38.430" Score="31" Body="&lt;p&gt;Google, IBM and &lt;a href=&quot;https://en.wikipedia.org/wiki/Rigetti_Computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rigetti&lt;/a&gt; use &lt;a href=&quot;https://en.wikipedia.org/wiki/Transmon&quot; rel=&quot;nofollow noreferrer&quot;&gt;transmon qubits&lt;/a&gt;; 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 &lt;em&gt;charge qubits&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Intel also used superconducting qubits, but lately has also been interested in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_dot&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum dot&lt;/a&gt; qubits. A quantum dot is like a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;-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.&lt;/p&gt;&#xA;&lt;p&gt;Microsoft is trying a different route: they are trying to built a &lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;topological quantum computer&lt;/a&gt;. 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Majorana_fermion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Majorana fermion&lt;/a&gt;, which can act as an anyon. Such a Majorana fermion is its own anti-particle; no physical Majorana fermion (as opposed to the 'normal' &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_fermion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirac fermion&lt;/a&gt;, 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'.&lt;/p&gt;&#xA;&lt;p&gt;D-Wave's systems is based on a yet more different method of quantum computing: the &lt;em&gt;adiabatic quantum computer&lt;/em&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum annealer&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}\sigma_{z}$&lt;/span&gt; interactions, but they also need either &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x}\sigma_{x}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sigma_{y}\sigma_{y}$&lt;/span&gt; interactions.&lt;/p&gt;&#xA;&lt;p&gt;There are also other types of qubits (that are not used by any of the companies you listed). Two to look out for are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Trapped_ion_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trapped-ion qubits&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Optical_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Photonic quantum computation&lt;/a&gt;. Qubits are encoded into degrees of freedom of photons (=light), most often the polarization; &lt;a href=&quot;https://en.wikipedia.org/wiki/Time-bin_encoding&quot; rel=&quot;nofollow noreferrer&quot;&gt;time-bin encoding&lt;/a&gt; is also often used, especially when considering flying qubits. These photonic machines normally use the computation model of &lt;a href=&quot;https://en.wikipedia.org/wiki/One-way_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurement based&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-11-09T15:01:16.447" LastActivityDate="2020-11-09T15:01:16.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10022" PostTypeId="1" AcceptedAnswerId="10026" CreationDate="2020-02-28T09:15:39.210" Score="1" ViewCount="123" Body="&lt;p&gt;I was trying to implement the 2-qubit Grover algorithm without the auxiliary bit. Before finding the gate symbol for the controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt;, I worked with the controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}$&lt;/span&gt;. The gate glossary states: &lt;em&gt;&quot; &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; is equivalent to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}$&lt;/span&gt; for the angle &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;&quot;&lt;/em&gt;. So I thought the controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}$&lt;/span&gt; with angle &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; should be equal with the controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; gate. However, I get very different results in the browser state-vector representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So my question is, should they be equivalent?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are my circuits:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/u9kqO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u9kqO.png&quot; alt=&quot;2-Qubit Grover with cRz&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vsnT0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vsnT0.png&quot; alt=&quot;2-Qubit Grover with cZ&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5461" LastEditorUserId="9006" LastEditDate="2020-02-28T12:03:37.257" LastActivityDate="2020-02-28T12:46:14.207" Title="Are $\mathrm{cRz}$ with angle $\pi$ and $\mathrm{cZ}$ equal on the IBM Quantum Experience?" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10023" PostTypeId="1" CreationDate="2020-02-28T09:40:25.133" Score="0" ViewCount="149" Body="&lt;p&gt;Why do all tutorials that use QSVM from qiskit Aqua library have the number of features equal to 2?&lt;/p&gt;&#xA;" OwnerUserId="10213" LastEditorUserId="55" LastEditDate="2020-07-27T13:43:17.503" LastActivityDate="2020-07-27T13:43:17.503" Title="Is there a limited number of features for QSVM in Qiskit-Aqua?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10024" PostTypeId="1" AcceptedAnswerId="10025" CreationDate="2020-02-28T11:03:39.883" Score="1" ViewCount="78" Body="&lt;p&gt;Every qubit is a realization of some two-level quantum system with &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right\rangle$&lt;/span&gt; states. These states have their energies &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; respectively.  By solving the Schrödinger equation for the two-level quantum system one can show time evaluation of the &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| + \right\rangle$&lt;/span&gt; states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \psi_0(t) \right\rangle = e^{-i \frac{E_0}{\hbar} t} \left| 0 \right\rangle \\&#xA;\left| \psi_1(t) \right\rangle = e^{-i \frac{E_1}{\hbar} t} \left| 1 \right\rangle \\&#xA;\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)=&#xA;\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)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is about the relative phase &lt;span class=&quot;math-container&quot;&gt;$\varphi = e^{-i \frac{E_1 - E_0}{\hbar} t}$&lt;/span&gt;. This &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mxwQD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mxwQD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the measurement, the state should be &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right\rangle$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt;. But If &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is such that the &lt;span class=&quot;math-container&quot;&gt;$\varphi = \pi$&lt;/span&gt; then we will measure &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right\rangle$&lt;/span&gt;. We can forget about it if &lt;span class=&quot;math-container&quot;&gt;$\varphi(t) &amp;lt;&amp;lt; \pi$&lt;/span&gt; in the whole computational time. Otherwise, we should make sure that the time between gates should be &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(E_1 - E_0)/\hbar$&lt;/span&gt; value is important and for example, the ibmq_armonk qubit's frequency is equal to ~4.97428 GHz (&lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-openpulse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit_textbook&lt;/a&gt;), so should we take into account this value when we play with ibmq_armonk by using OpenPulse?&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-02-28T11:46:14.993" LastActivityDate="2020-02-28T11:46:14.993" Title="How to deal with the relative phase from the evaluation of the not interacting qubit?" Tags="&lt;qiskit&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;ibm&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10025" PostTypeId="2" ParentId="10024" CreationDate="2020-02-28T11:21:46.680" Score="1" Body="&lt;p&gt;The &lt;em&gt;could&lt;/em&gt; be a problem, but it depends on how you're realising your qubits. Some realisations are configured so that &lt;span class=&quot;math-container&quot;&gt;$E_0=E_1$&lt;/span&gt;, and then there's no problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is (at least from the theoretical perspective) a simple fix: if you're supposed to be waiting a time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, then, instead:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;wait time &lt;span class=&quot;math-container&quot;&gt;$t/2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;apply bit flip&lt;/li&gt;&#xA;&lt;li&gt;wait time &lt;span class=&quot;math-container&quot;&gt;$t/2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;apply bit flip.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This exchanges the roles of 0 and 1 for half the time so that they end up with equal phases.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you just take this into account and apply compensating phase gates inside your circuit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-02-28T11:21:46.680" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10026" PostTypeId="2" ParentId="10022" CreationDate="2020-02-28T12:02:47.290" Score="1" Body="&lt;p&gt;I realized that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}(\lambda)$&lt;/span&gt; is implemented in following way on IBM Q:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;gate crz(lambda) a,b&#xA;{&#xA;  u1(lambda/2) b;&#xA;  cx a,b;&#xA;  u1(-lambda/2) b;&#xA;  cx a,b;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;span class=&quot;math-container&quot;&gt;$\lambda =\pi$&lt;/span&gt;, a matrix describing construction above is following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; -i &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not problem when the gate is not controlled as &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is a global phase, however, it matters for controlled gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also checked that these values are really returned for computation basis states in state vector visualization on IBM Q.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion is that controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}(\pi)$&lt;/span&gt; is not equivalent to controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; on IBM Q.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that application of single qubit &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}(\pi)$&lt;/span&gt; returns same results as single qubit &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}(\pi)$&lt;/span&gt; behave as expected, you have to put controlled global phase gate before &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}(\pi)$&lt;/span&gt;. You can do that by application single-qubit gate &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U1}(\pi/2)$&lt;/span&gt; on controlling qubit of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Rz}(\pi)$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; in your case.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-02-28T12:46:14.207" LastActivityDate="2020-02-28T12:46:14.207" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="10027" PostTypeId="2" ParentId="10023" CreationDate="2020-02-28T12:57:58.880" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/blob/f589e0aa4b31de30aed01f8219abdd3e56771653/machine_learning/qsvm_multiclass.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is a tutorial that uses three classes! If you want to use more than two classes, you need a &lt;code&gt;multiclass_extension&lt;/code&gt; which is provided as a parameter to the QSVM&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;svm = QSVM(feature_map, training_input, test_input, total_array,&#xA;          multiclass_extension=AllPairs(_QSVM_Estimator, [feature_map]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As shown in the tutorial. There are a few multiclass extensions to choose from, which are all &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/tree/master/qiskit/aqua/components/multiclass_extensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-02-28T12:57:58.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10028" PostTypeId="1" AcceptedAnswerId="10097" CreationDate="2020-02-28T14:18:17.357" Score="1" ViewCount="85" Body="&lt;p&gt;IBM offers its platform IBM Q for free with certain constraints, such as available quantum processors and number of jobs running in parallel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Does anyone have any experience with  D-Wave and possibility to at least sign up for free to some trial version?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-03-05T09:14:36.773" LastActivityDate="2020-03-05T09:14:36.773" Title="Is it possible to use D-Wave systems for free?" Tags="&lt;resource-request&gt;&lt;d-wave&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10029" PostTypeId="1" CreationDate="2020-02-28T16:12:57.247" Score="1" ViewCount="95" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is the quantum state she transmits to reciever (Bob)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-10-28T09:24:05.790" LastActivityDate="2020-10-28T09:24:05.790" Title="What is the quantum state transmitted to Bob in BB84 protocol?" Tags="&lt;cryptography&gt;&lt;communication&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10030" PostTypeId="1" AcceptedAnswerId="10033" CreationDate="2020-02-28T16:19:41.897" Score="1" ViewCount="90" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for taking the time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;             self.C = self.C[:,:len(self.C[0])]&#xA;                    self.B = self.B[:,:len(self.B[0])]&#xA;                    print(&quot;Input:&quot;,self.C)&#xA;                    qubitOp = MatrixOperator(self.C)                    &#xA;                    print(qubitOp) &#xA;                    backend = Aer.get_backend('statevector_simulator')&#xA;                    var_form = RYRZ(qubitOp.num_qubits,10)&#xA;                    optim = COBYLA()&#xA;                    vqe = VQE(qubitOp, var_form, optim)&#xA;                # Runs the VQE over the backend defined above.&#xA;                    result_vqe = vqe.run(backend)&#xA;&#xA;                    print(qubitOp) # prints operator properties &#xA;                    print('energy', result_vqe['energy'], '\n')&#xA;                    print(result_vqe)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the error &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ValueError                                Traceback (most recent call last)&#xA;&amp;lt;ipython-input-1-03f1f6dbe796&amp;gt; in &amp;lt;module&amp;gt;&#xA;     76 print_state(state)&#xA;     77 &#xA;---&amp;gt; 78 bundle_adjust(state)&#xA;     79 print(&quot;= Bundle Adjusted State =&quot;)&#xA;     80 print_state(state)&#xA;&#xA;&amp;lt;ipython-input-1-03f1f6dbe796&amp;gt; in bundle_adjust(state)&#xA;     39 &#xA;     40     # note: intervene here with other optimizers&#xA;---&amp;gt; 41     o.optimize()&#xA;     42 &#xA;     43     # normalize scale (note: ~ is __invert__, *noisy is __imul__)&#xA;&#xA;~\Bachelor-Project\BA\optimizerVQE3.py in optimize(self)&#xA;     65     # run optimization&#xA;     66     def optimize(self):&#xA;---&amp;gt; 67         for event in self.optimize_it():&#xA;     68             pass&#xA;     69 &#xA;&#xA;~\Bachelor-Project\BA\optimizerVQE3.py in optimize_it(self)&#xA;    131 &#xA;    132                 # Runs the VQE over the backend defined above.&#xA;--&amp;gt; 133                     result_vqe = vqe.run(backend)&#xA;    134 &#xA;    135                     print(qubitOp) # prints operator properties&#xA;&#xA;~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\quantum_algorithm.py in run(self, quantum_instance, **kwargs)&#xA;     65                 quantum_instance.set_config(**kwargs)&#xA;     66             self._quantum_instance = quantum_instance&#xA;---&amp;gt; 67         return self._run()&#xA;     68 &#xA;     69     @abstractmethod&#xA;&#xA;~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\adaptive\vqe\vqe.py in _run(self)&#xA;    314         if self._auto_conversion:&#xA;    315             self._operator = \&#xA;--&amp;gt; 316                 self._config_the_best_mode(self._operator, self._quantum_instance.backend)&#xA;    317             for i in range(len(self._aux_operators)):&#xA;    318                 if not self._aux_operators[i].is_empty():&#xA;&#xA;~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\adaptive\vqe\vqe.py in _config_the_best_mode(self, operator, backend)&#xA;    236                                 &quot;achieve the better performance. We convert &quot;&#xA;    237                                 &quot;the operator to weighted paulis.&quot;)&#xA;--&amp;gt; 238                     ret_op = op_converter.to_weighted_pauli_operator(operator)&#xA;    239         return ret_op&#xA;    240 &#xA;&#xA;~\Anaconda3\lib\site-packages\qiskit\aqua\operators\op_converter.py in to_weighted_pauli_operator(operator)&#xA;     86                                list(itertools.product(possible_basis, repeat=num_qubits)),&#xA;     87                                task_kwargs={&quot;matrix&quot;: operator._matrix},&#xA;---&amp;gt; 88                                num_processes=aqua_globals.num_processes)&#xA;     89         for trace_value, pauli in results:&#xA;     90             weight = trace_value * coeff&#xA;&#xA;~\Anaconda3\lib\site-packages\qiskit\tools\parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)&#xA;    142     results = []&#xA;    143     for _, value in enumerate(values):&#xA;--&amp;gt; 144         result = task(value, *task_args, **task_kwargs)&#xA;    145         results.append(result)&#xA;    146         _callback(0)&#xA;&#xA;~\Anaconda3\lib\site-packages\qiskit\aqua\operators\op_converter.py in _conversion(basis, matrix)&#xA;     36 def _conversion(basis, matrix):&#xA;     37     pauli = Pauli.from_label(''.join(basis))&#xA;---&amp;gt; 38     trace_value = np.sum(matrix.dot(pauli.to_spmatrix()).diagonal())&#xA;     39     return trace_value, pauli&#xA;     40 &#xA;&#xA;~\Anaconda3\lib\site-packages\scipy\sparse\base.py in dot(self, other)&#xA;    361 &#xA;    362         &quot;&quot;&quot;&#xA;--&amp;gt; 363         return self * other&#xA;    364 &#xA;    365     def power(self, n, dtype=None):&#xA;&#xA;~\Anaconda3\lib\site-packages\scipy\sparse\base.py in __mul__(self, other)&#xA;    478         if issparse(other):&#xA;    479             if self.shape[1] != other.shape[0]:&#xA;--&amp;gt; 480                 raise ValueError('dimension mismatch')&#xA;    481             return self._mul_sparse_matrix(other)&#xA;    482 &#xA;&#xA;ValueError: dimension mismatch&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CYkjn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CYkjn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10218" LastActivityDate="2020-02-28T17:37:52.453" Title="VQE with error dim. mismatch using qiskit.aqua.vqe" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;qaoa&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10031" PostTypeId="1" CreationDate="2020-02-28T17:01:06.150" Score="3" ViewCount="270" Body="&lt;p&gt;In HHL algorithm, how do we implement matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$A|x\rangle = |b\rangle$&lt;/span&gt;) in the circuit?&lt;/p&gt;&#xA;" OwnerUserId="9973" LastEditorUserId="9006" LastEditDate="2020-02-28T22:50:26.073" LastActivityDate="2020-03-02T08:41:25.330" Title="Implementation of matrix A in HHL algorithm circuit" Tags="&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10033" PostTypeId="2" ParentId="10030" CreationDate="2020-02-28T17:37:52.453" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This code below (based on yours) does run when given a 16x16.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import Aer&#xA;from qiskit.aqua.algorithms import VQE&#xA;from qiskit.aqua.components.optimizers import COBYLA&#xA;from qiskit.aqua.components.variational_forms import RYRZ&#xA;from qiskit.aqua.operators import MatrixOperator&#xA;&#xA;np.random.seed = 75&#xA;matrix = np.random.rand(16, 16)&#xA;qubitOp = MatrixOperator(matrix)                    &#xA;print(qubitOp) &#xA;backend = Aer.get_backend('statevector_simulator')&#xA;var_form = RYRZ(qubitOp.num_qubits,10)&#xA;optim = COBYLA()&#xA;vqe = VQE(qubitOp, var_form, optim)&#xA;result_vqe = vqe.run(backend)&#xA;&#xA;print(qubitOp) # prints operator properties &#xA;print('energy', result_vqe['energy'], '\n')&#xA;print(result_vqe)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-02-28T17:37:52.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10034" PostTypeId="1" CreationDate="2020-02-28T21:52:36.830" Score="3" ViewCount="55" Body="&lt;p&gt;I'm reading the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9906059&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Implementation of the Quantum Fourier Transform&lt;/em&gt;&lt;/a&gt;. On page 4, they write&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To a first approximation, decoherence during the course of the QFT attenuates the entire density matrix. This is shown in figure 2.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I know that the word &amp;quot;attenuate&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; What is meant by attenuate here?&lt;/p&gt;&#xA;" OwnerUserId="6118" LastEditorUserId="2293" LastEditDate="2021-03-01T22:54:17.557" LastActivityDate="2021-03-01T22:54:17.557" Title="What does &quot;decoherence attenuates the density matrix&quot; mean?" Tags="&lt;density-matrix&gt;&lt;quantum-fourier-transform&gt;&lt;experiment&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10035" PostTypeId="2" ParentId="10029" CreationDate="2020-02-28T22:48:23.540" Score="4" Body="&lt;p&gt;Application of Hadamard gates changes states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; followingly:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{H}|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Identity operator does not change the state in any way, i.e. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{I}|0\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{I}|1\rangle = |1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence if gates &lt;span class=&quot;math-container&quot;&gt;$\mathrm{HHHII}\dots$&lt;/span&gt; are applied on input string of qubits &lt;span class=&quot;math-container&quot;&gt;$|10101\dots\rangle$&lt;/span&gt;, the result is state &lt;span class=&quot;math-container&quot;&gt;$|-+-01\dots\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-02-28T22:48:23.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10036" PostTypeId="2" ParentId="10031" CreationDate="2020-02-28T23:01:27.470" Score="3" Body="&lt;p&gt;A Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is implemented as series of controlled gates &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{iAt}$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. This gate can be then implementend with controlled &lt;span class=&quot;math-container&quot;&gt;$\mathrm{U3}$&lt;/span&gt; gate on IBM Q.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that original paper on HHL algorithm (see link below) provides a &quot;trick&quot; how to convert any matrix to Hermitian one and apply HHL algrithm.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, type 2x2, there are two gates with &lt;span class=&quot;math-container&quot;&gt;$t=\frac{\pi}{2}$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$t=\frac{\pi}{4}$&lt;/span&gt; controlled by two different qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see these articles for more information how to implement HHL algorithm:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Original paper by Harrow, Hasidim and Lloyd: &lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for linear systems of equations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Practical implementation for 2x2 matrix: &lt;a href=&quot;https://www.researchgate.net/publication/51944125_Quantum_Circuit_Design_for_Solving_Linear_Systems_of_Equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum circuits for solving linear systems of equations&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Another demonstration of practical implementation (pgs. 49-51): &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithm Implementations for Beginners&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;I would recommend the third article for the best understanding how to implement HHL algorithm in practice.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-02T08:41:25.330" LastActivityDate="2020-03-02T08:41:25.330" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10037" PostTypeId="1" AcceptedAnswerId="10039" CreationDate="2020-02-29T12:05:06.693" Score="1" ViewCount="131" Body="&lt;p&gt;I'm running VQE algorithm from qiskit aqua on &lt;code&gt;statevector_simulator&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;qubitOp&lt;/code&gt; is generated with DOcplex module. &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;max_trials = 80&#xA;depth = 1&#xA;entanglement='full'&#xA;&#xA;slsqp = SLSQP(maxiter=max_trials)&#xA;ry = RY(qubitOp.num_qubits, depth=depth, entanglement=entanglement)&#xA;vqe = VQE(qubitOp, ry, slsqp)&#xA;provider = IBMQ.get_provider('ibm-q')&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;quantum_instance = QuantumInstance(backend,seed_simulator=seed, seed_transpiler=seed, optimization_level=0)&#xA;res = vqe.run(quantum_instance)    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10234" LastEditorUserId="9006" LastEditDate="2020-03-01T09:44:16.900" LastActivityDate="2020-03-01T09:44:16.900" Title="Qiskit statevector_simulator returns different results" Tags="&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10039" PostTypeId="2" ParentId="10037" CreationDate="2020-02-29T13:49:44.310" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua import aqua_globals&#xA;&#xA;aqua_globals.random_seed = seed&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9831" LastEditorUserId="9831" LastEditDate="2020-02-29T13:55:07.233" LastActivityDate="2020-02-29T13:55:07.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10043" PostTypeId="1" CreationDate="2020-02-29T20:07:49.493" Score="1" ViewCount="58" Body="&lt;p&gt;Cirq has two in-built realizations of quantum hardware, which are realized as GridQubit() and LineQubit() classes (naming convention is slightly disturbing:).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;GridQubit device mimics connectivity of Google's quantum chips (Bristlecone, Sycamore) and qubits are arranged in a 2D grid with nearest-neighbor couplings. &#xA;&lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/cirq/devices/grid_qubit.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/blob/master/cirq/devices/grid_qubit.py&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;LineQubit device represents chips with 1D geometry, where qubits are arranged in a line and again only nearest-neighbor qubits are coupled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any possibility to specify a custom hardware coupling map? E.g. to specify adjacency matrix of new connectivity graph?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that a user has to create his/her own device class for such functionality.&lt;/p&gt;&#xA;" OwnerUserId="7896" LastActivityDate="2020-02-29T20:22:00.597" Title="Cirq: creating a new device with custom coupling topology?" Tags="&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10044" PostTypeId="2" ParentId="10043" CreationDate="2020-02-29T20:22:00.597" Score="2" Body="&lt;p&gt;Generally, yes, it is expected that you would define your own device and perhaps your own qubits in order to make custom topologies.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is currently a graph device package in the &quot;contrib&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq.contrib.graph_device&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-02-29T20:22:00.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10045" PostTypeId="1" CreationDate="2020-03-01T04:51:55.060" Score="3" ViewCount="28" Body="&lt;p&gt;My understanding is the Helstrom measurement distinguishes between 2 pure quantum states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10241" LastEditorUserId="55" LastEditDate="2020-10-28T09:23:30.523" LastActivityDate="2020-10-28T09:23:30.523" Title="Is there a measure similar to the Helstrom measurement which can distinguish between more than 2 pure quantum states?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10047" PostTypeId="1" AcceptedAnswerId="10048" CreationDate="2020-03-01T16:19:28.993" Score="0" ViewCount="79" Body="&lt;p&gt;Someone on research gate said the answer was no &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;So the human brain is more like a classical computer Or is the brain not like a Turing machine? &lt;/p&gt;&#xA;" OwnerDisplayName="user10151" LastActivityDate="2020-03-02T04:34:29.757" Title="Do biological brains compute using quantum mechanics?" Tags="&lt;quantum-turing-machine&gt;&lt;biology&gt;&lt;biocomputing&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2020-03-02T23:23:26.977" ContentLicense="CC BY-SA 4.0" />
  <row Id="10048" PostTypeId="2" ParentId="10047" CreationDate="2020-03-01T21:10:46.863" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5681944/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5681944/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-03-01T21:10:46.863" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10049" PostTypeId="1" CreationDate="2020-03-01T21:54:05.660" Score="1" ViewCount="69" Body="&lt;p&gt;&lt;strong&gt;Consider a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = \sigma_x \otimes \sigma_z$&lt;/span&gt;&#xA;Construct the time evolution operator &lt;span class=&quot;math-container&quot;&gt;$U(t) = \mathrm{e}^{-\frac{iHt}{\frac{h}{2\pi}}}$&lt;/span&gt; [Hint:Write down the expansion of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^x$&lt;/span&gt; and use the property of &lt;span class=&quot;math-container&quot;&gt;$H^2$&lt;/span&gt;]&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This was one of my assignment problems and I really couldn't make sense of what the hint implied and ended up getting &lt;span class=&quot;math-container&quot;&gt;$H^2 = I$&lt;/span&gt; and don't really know how and where to use this.&lt;/p&gt;&#xA;" OwnerUserId="10247" LastEditorUserId="55" LastEditDate="2020-07-26T18:08:22.163" LastActivityDate="2020-07-26T18:08:22.163" Title="Constructing a time evolution operator $e^{it H}$ for $H^2=I$" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10050" PostTypeId="1" AcceptedAnswerId="10056" CreationDate="2020-03-01T23:16:33.900" Score="9" ViewCount="1041" Body="&lt;p&gt;Suppose we have the Fredkin gate with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;   F=&#xA;  \left( {\begin{array}{cc}&#xA;   1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;  \end{array} } \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how is it possible to &quot;see&quot; what its action is without making any matrix multiplication?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In &lt;a href=&quot;http://people.math.gatech.edu/~jeanbel/4782/Year09/problem207.pdf&quot; rel=&quot;noreferrer&quot;&gt;this document&lt;/a&gt;, on solving 4.25, they claim that the action of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is, in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$F|0,y,z\rangle=|0,y,z\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$F|1,y,z\rangle=|1,z,y\rangle$&lt;/span&gt;. But how is it possible to know this beforehand? I feel that I am missing this mental &quot;gymnastic&quot; that I feel is crucial for developing algorithms.&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="734" LastEditDate="2020-03-02T14:09:52.130" LastActivityDate="2020-03-02T14:09:52.130" Title="How can I see, without math, the action of a gate in matrix form?" Tags="&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10051" PostTypeId="2" ParentId="10050" CreationDate="2020-03-02T00:51:47.717" Score="1" Body="&lt;p&gt;We care about &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;'s action on the basis states, where basis states are represented by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\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}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It should be fairly easy to see that on most basis states, this gate will act as the identity. The only exceptions are &lt;span class=&quot;math-container&quot;&gt;$(0,0,0,0,0,1,0,0)^T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(0,0,0,0,0,0,1,0)^T$&lt;/span&gt;, which get swapped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;States of the form &lt;span class=&quot;math-container&quot;&gt;$|0yz\rangle$&lt;/span&gt; are those with a one in one of the first four rows. Clearly these don't get swapped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;States of form &lt;span class=&quot;math-container&quot;&gt;$|1yz\rangle$&lt;/span&gt; have a one in one of the last four rows. Look how they get mapped:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|1yz\rangle :=|100\rangle &amp;amp;\mapsto |100\rangle = |1zy\rangle\\&#xA;|1yz\rangle :=|101\rangle &amp;amp;\mapsto |110\rangle = |1zy\rangle\\&#xA;|1yz\rangle :=|110\rangle &amp;amp;\mapsto |101\rangle = |1zy\rangle\\&#xA;|1yz\rangle :=|111\rangle &amp;amp;\mapsto |111\rangle = |1zy\rangle\\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as desired. &lt;strong&gt;What might be tripping you up is&lt;/strong&gt; the fact that mapping &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; (and similarly for &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;) can technically be thought of as swapping the last two bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What's the intuition?&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="6118" LastActivityDate="2020-03-02T00:51:47.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10052" PostTypeId="2" ParentId="10049" CreationDate="2020-03-02T00:56:17.957" Score="1" Body="&lt;p&gt;The exponential of an operator is defined with respect to its series expansion. The fact that &lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt; will simplify this expansion greatly. &lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="9006" LastEditDate="2020-03-02T05:42:03.103" LastActivityDate="2020-03-02T05:42:03.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10053" PostTypeId="2" ParentId="10049" CreationDate="2020-03-02T00:59:18.950" Score="2" Body="&lt;p&gt;Here is a hint:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are correct that &lt;span class=&quot;math-container&quot;&gt;$H^2 = I$&lt;/span&gt;. Let's set &lt;span class=&quot;math-container&quot;&gt;$a:=\frac{-2it\pi}{h}$&lt;/span&gt; for simplicity. Then the definition of the matrix exponential gives us&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(t) = \sum_{n=0}^\infty \frac{a^n}{n!}H^n$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you use &lt;span class=&quot;math-container&quot;&gt;$H^2 = I$&lt;/span&gt; to help evaluate this?&lt;/p&gt;&#xA;" OwnerUserId="6118" LastActivityDate="2020-03-02T00:59:18.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10054" PostTypeId="2" ParentId="10047" CreationDate="2020-03-02T04:34:29.757" Score="2" Body="&lt;p&gt;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, &lt;a href=&quot;https://arxiv.org/abs/1206.5946v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1206.5946v1&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9579" LastActivityDate="2020-03-02T04:34:29.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10055" PostTypeId="2" ParentId="10050" CreationDate="2020-03-02T08:10:10.613" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for example, the first 4 elements &lt;span class=&quot;math-container&quot;&gt;$0xy$&lt;/span&gt; all transform into themselves (because that part of the matrix is identity). Whereas 110 (penultimate column) transforms into 101, the 6th row.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-02T08:10:10.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10056" PostTypeId="2" ParentId="10050" CreationDate="2020-03-02T08:46:39.227" Score="10" Body="&lt;p&gt;Besides the already given answers note that there is indeed some &quot;mental gymnastics&quot; involved here. As soon as you're getting more acquainted with quantum computing, you know some of your usual gates, including the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; gate that appears in your question:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathsf{SWAP} = \begin{bmatrix}&#xA; 1 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA; 0 &amp;amp;0 &amp;amp;1 &amp;amp;0 \\&#xA; 0 &amp;amp;1 &amp;amp;0 &amp;amp;0 \\&#xA; 0 &amp;amp;0 &amp;amp;0 &amp;amp;1 \\&#xA;\end{bmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, how do we see that the Fredkin gate corresponds to a &lt;em&gt;controlled&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; gate? Looking closer at the Fredkin gate shows us that it has a &lt;em&gt;block structure&lt;/em&gt; where the upper left block is an identity matrix and the lower right block is the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; gate:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathsf{Fredkin} = \mathsf{CSWAP} = \begin{bmatrix}&#xA; \mathbb{I} &amp;amp; 0 \\&#xA;0 &amp;amp; \mathsf{SWAP}&#xA;\end{bmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; gate&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathsf{CNOT} = \begin{bmatrix}&#xA; 1 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA; 0 &amp;amp;1 &amp;amp;0 &amp;amp;0 \\&#xA; 0 &amp;amp;0 &amp;amp;0 &amp;amp;1 \\&#xA; 0 &amp;amp;0 &amp;amp;1 &amp;amp;0 \\&#xA;\end{bmatrix}= \begin{bmatrix}&#xA; \mathbb{I} &amp;amp; 0 \\&#xA;0 &amp;amp; X&#xA;\end{bmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;which is an identity matrix on the upper left (hence the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{C}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt;) and a Pauli &lt;span class=&quot;math-container&quot;&gt;$\mathsf{X}$&lt;/span&gt; gate -- which is the quantum &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; gate -- on the lower right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, &lt;em&gt;i.e.&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;000, 001, 010, 011, 100, 101, 110, 111&#xA;\end{align}&lt;/span&gt;&#xA;for three qubits. If we want to perform an arbitrary unitary &lt;span class=&quot;math-container&quot;&gt;$\mathsf{U}$&lt;/span&gt; on the second and third qubit controlled by the first qubit, the corresponding matrix &lt;em&gt;must&lt;/em&gt; act trivially (&lt;em&gt;i.e.&lt;/em&gt; as identity matrix) on the first 4 basis vectors, just because for them the control bit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. On the last 4 basis vectors, the control bit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is thus performed on these basis vectors. As the control bit must not change under the whole operation, the basis states starting with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and the basis states starting with &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; can not mix, yielding the overall matrix structure&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathsf{CU} = \begin{bmatrix}&#xA; \mathbb{I} &amp;amp; 0 \\&#xA;0 &amp;amp; \mathsf{U}&#xA;\end{bmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10250" LastEditorUserId="-1" LastEditDate="2020-03-02T14:09:31.970" LastActivityDate="2020-03-02T14:09:31.970" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10057" PostTypeId="1" CreationDate="2020-03-02T14:00:45.620" Score="6" ViewCount="158" Body="&lt;p&gt;I would like to check something.&lt;/p&gt;&#xA;&lt;p&gt;Consider I am working on cQED (superconducting qubits), or ion trapped, or silicon qubits (I would like to exclude &amp;quot;exotic for me&amp;quot; quantum computing like photon based, or topological Q.C).&lt;/p&gt;&#xA;&lt;p&gt;The fastest you perform a gate, the less the noise has the time to act for noise &amp;quot;per unit time&amp;quot; acting (not all noise can be modelled this way but it can often be).&lt;/p&gt;&#xA;&lt;p&gt;It is thus important to perform gate &amp;quot;the fastest possible&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;My question is thus: &lt;strong&gt;What is limiting gate speed ?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2020-11-12T23:18:25.407" LastActivityDate="2020-12-13T09:07:05.673" Title="What limits speed of quantum gates?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10058" PostTypeId="1" AcceptedAnswerId="10149" CreationDate="2020-03-02T14:31:20.663" Score="1" ViewCount="215" Body="&lt;p&gt;In article &lt;a href=&quot;https://arxiv.org/abs/1805.00109&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computational finance: Monte Carlo pricing of financial derivatives&lt;/a&gt; the authors said that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Firstly:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;While a practical quantum computer has yet to become&#xA;  a reality, we can exhibit the speedup of our quantum&#xA;  algorithm for options pricing numerically, and compare&#xA;  its performance with the classical Monte Carlo method.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Secondly:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, to showcase the&#xA;  quadratic speed up, we here perform phase estimation by&#xA;  using a single qubit rotated according to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\theta\sigma_x /2}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the predetermined phase.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{T}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my questions is:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-03T05:45:54.477" LastActivityDate="2020-03-10T11:47:46.743" Title="Is it possible to demonstrate a quadratic speed-up of a quantum algorithm on a classical computer?" Tags="&lt;simulation&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;&lt;clifford-group&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10059" PostTypeId="1" AcceptedAnswerId="10060" CreationDate="2020-03-02T17:25:08.817" Score="4" ViewCount="142" Body="&lt;p&gt;Consider the standard &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation scheme&lt;/a&gt;. Let the first register hold the state &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|#1\rangle}\ket\psi$&lt;/span&gt; to be teleported, and the second register be the one shared between the two parties. We can then summarise the protocol as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start with the state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}_1\ket{0,0}_{23}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply the unitary &lt;span class=&quot;math-container&quot;&gt;$U\equiv \operatorname{CNOT}(H\otimes I)$&lt;/span&gt; between second and third register, thus evolving &lt;span class=&quot;math-container&quot;&gt;$\ket{00}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi^+}\simeq \ket{00}+\ket{11}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$U^{-1}$&lt;/span&gt; between first and second registers.&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My question is about the choice of this specific unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&#xA;Consider the following generalisation of the teleportation scheme:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nvkwN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nvkwN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, we again start with &lt;span class=&quot;math-container&quot;&gt;$\ket\psi\otimes\ket{0,0}$&lt;/span&gt;, but now apply &lt;em&gt;some&lt;/em&gt; unitary &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; between second and third register and then &lt;span class=&quot;math-container&quot;&gt;$B^{-1}$&lt;/span&gt; between first and second. We then measure the first two registers in the computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;What are the possible unitaries &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; such that this circuit works as a teleportation protocol?&lt;/em&gt;&lt;/strong&gt; More specifically, for what choices of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can we always find a unitary to apply to the third register to get back &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; regardless of the measurement results &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Intuitively, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; must be some gate creating maximal entanglement between the qubits, but requiring that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; sends &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to a maximally entangled state is also not enough. As a counterexample, we can consider the following &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$B\equiv \begin{pmatrix}&#xA;    0&amp;amp;0&amp;amp;1&amp;amp;0 \\ &#xA;    1/\sqrt2 &amp;amp; 1/\sqrt2 &amp;amp; 0 &amp;amp; 0 \\&#xA;    1/\sqrt2 &amp;amp; -1/\sqrt2 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}.$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$a=b=1$&lt;/span&gt; projects the third qubit to &lt;span class=&quot;math-container&quot;&gt;$\ket0$&lt;/span&gt;, which contains no information about &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-05-12T09:11:47.273" LastActivityDate="2020-05-12T09:11:47.273" Title="Generalising the standard quantum teleportation protocol: what are the possible unitaries?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10060" PostTypeId="2" ParentId="10059" CreationDate="2020-03-03T01:48:11.010" Score="6" Body="&lt;p&gt;A necessary and sufficient condition on the unitary &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is that its columns all correspond to maximally entangled states. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There also does not need to be any relationship between the two unitaries labeled &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B^{-1}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Moreover, this is all true not only for qubits, but for any single dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; shared by systems 1, 2, and 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These facts were proved by Werner:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;R. Werner. All teleportation and dense coding schemes. Journal of Physics A 34: 7081-7094, 2001 (&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0305-4470/34/35/332&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to paper&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="55" LastEditDate="2020-03-03T10:48:24.017" LastActivityDate="2020-03-03T10:48:24.017" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10062" PostTypeId="2" ParentId="2667" CreationDate="2020-03-03T05:58:40.430" Score="3" Body="&lt;p&gt;I enrolled to &lt;a href=&quot;https://www.coursera.org/learn/quantum-computing-algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Quantum Computing&lt;/a&gt; on Coursera.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The course requires understanding of linear algebra, necessary basics of quantum mechanics are explained during the course.&lt;/p&gt;&#xA;&lt;p&gt;Interestingly, the course shows how to build single-purpose quantum computer for implementation of Deutsch-Jozsa algorithm.&lt;/p&gt;&#xA;&lt;p&gt;The course if for free unless you want a certificate. In that case it costs $49.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-03-03T05:58:40.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10063" PostTypeId="2" ParentId="2667" CreationDate="2020-03-03T06:22:03.700" Score="2" Body="&lt;p&gt;Maybe be a bit of left field but I found Peter Wittek - may he Rest In Peace - course on edX quite good.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.edx.org/course/quantum-machine-learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.edx.org/course/quantum-machine-learning&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-03-03T22:32:39.240" LastActivityDate="2020-03-03T22:32:39.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10064" PostTypeId="2" ParentId="2667" CreationDate="2020-03-03T07:40:07.217" Score="2" Body="&lt;p&gt;Currently there are not much courses available. However you can start with following courses: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/course/quantum-information-science-ii&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Science II&lt;/a&gt; (From edX): To build up the concepts you can go through this series of courses.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.coursera.org/learn/quantum-computing-algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Quantum Computing&lt;/a&gt; (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. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/professional-certificate/delftx-quantum-computing-and-quantum-internet&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum 101: Quantum Computing and Quantum Internet&lt;/a&gt; (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.&#xA;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, &quot;Architecture, Algorithms, and Protocols of a Quantum Computer and Quantum Internet&quot;. By completing both parts, you will have a complete overview of all building blocks of a quantum computer.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/course/the-quantum-internet-and-quantum-computers-how-w-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Quantum Internet and Quantum Computers: How Will They Change the World?&lt;/a&gt; (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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, to focus a particular area, you can go for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/course/quantum-machine-learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Machine Learning&lt;/a&gt; (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&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.edx.org/course/quantum-cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Cryptography&lt;/a&gt; (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&#xA;Modern quantum cryptographic tasks and protocols&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8796" LastActivityDate="2020-03-03T07:40:07.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10065" PostTypeId="1" AcceptedAnswerId="10068" CreationDate="2020-03-03T15:10:32.627" Score="4" ViewCount="108" Body="&lt;p&gt;I'm a bit confused about which is the correct sign in the unitary evolution operator of a beam splitter.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In paper &lt;a href=&quot;https://arxiv.org/abs/1909.04408&quot; rel=&quot;nofollow noreferrer&quot;&gt;Digital quantum simulation of linear and nonlinear optical elements&lt;/a&gt; author uses the following expression:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_{ij} = e^{i\epsilon_{ij}\left(b_j^\dagger a_i + b_j a_i^\dagger \right)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; refers to the beam splitter modes (so, what is the meaning of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Nielsen &amp;amp; Chuang use (on page 291) the following equation for the same thing:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U = e^{\theta\left(a^\dagger b - a b^\dagger\right)},$$&lt;/span&gt;&#xA;where the latter term in the exponent has a minus sign.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I relate both equations? Are they the same?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lastly, can you recommend me any book which deals with beam splitter and related stuff? I have not found any good reference.&lt;/p&gt;&#xA;" OwnerUserId="9716" LastEditorUserId="55" LastEditDate="2020-03-04T10:48:44.263" LastActivityDate="2020-03-04T10:48:44.263" Title="What is the correct sign in the unitary evolution operator of a beam splitter?" Tags="&lt;hamiltonian-simulation&gt;&lt;unitarity&gt;&lt;optical-quantum-computing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10066" PostTypeId="1" CreationDate="2020-03-03T20:32:51.847" Score="1" ViewCount="87" Body="&lt;p&gt;How would you explain, pictorially and without too much overhead, an interaction between the qubits on &lt;a href=&quot;https://en.wikipedia.org/wiki/Ising_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;this model&lt;/a&gt; using Cirq? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am interested in trying to map accurately the ansatz on Cirq to a graph using Python network's library. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs.&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="5955" LastEditDate="2020-03-04T09:32:14.227" LastActivityDate="2020-03-18T20:57:43.300" Title="Ising Model, Graphs, and Cirq" Tags="&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10067" PostTypeId="1" CreationDate="2020-03-03T22:51:52.370" Score="2" ViewCount="177" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1908.05238&quot; rel=&quot;nofollow noreferrer&quot;&gt;preprint&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two main challenges that I'm confronted with:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;li&gt;How and where would one dynamically modify each Pauli coefficient in the Hamiltonian? For example it appears something like &lt;code&gt;qubitop.aer_pauli[i,:] = 1.0 + 0.0j&lt;/code&gt;&#xA;should work, but I'm not sure this is complete or an appropriate approach.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;This would enable us to then use the VQE routines with Qiskit to further verify this method. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking to make these modification to the Qiskit source code just need some guidance.&lt;/p&gt;&#xA;" OwnerUserId="10265" LastEditorUserId="9006" LastEditDate="2020-03-04T05:08:37.657" LastActivityDate="2020-03-04T15:33:45.420" Title="Modifying Qiskit Hamiltonian" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;chemistry&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10068" PostTypeId="2" ParentId="10065" CreationDate="2020-03-03T23:32:58.787" Score="3" Body="&lt;p&gt;First, the operators &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$a^{\dagger}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b^{\dagger}$&lt;/span&gt;) are the &lt;em&gt;annihilation&lt;/em&gt; (&lt;em&gt;creation&lt;/em&gt;) 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 &quot;Quantum Optics -- An Introduction&quot; and a more advanced read is Grynberg, Aspect and Fabre's &quot;An Introduction to Quantum Optics&quot;.  But the parts you are interested in are possibly well explained in Nielsen and Chuang. Also &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0305007.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this document&lt;/a&gt; I found while googling might be of interest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But back to the original question: why does the paper you mention and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Beam_splitter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; define the beamsplitter as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U = \mathrm{e}^{i \theta (b^{\dagger} a + b a^{\dagger})}&#xA;\end{align}&lt;/span&gt;&#xA;with a plus sign, contrary to Nielsen and Chuang? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The truth is, both operators are &quot;correct&quot;, 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;. The plus convention corresponds to a Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; rotation, where the minus convention corresponds to a Pauli &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; rotation. As pointed out before, there is an additional phase shift, embodied by the &lt;em&gt;phase operator&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;S = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{bmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;that can be used to relate the two transformations. For that see Page 51 of &quot;Introduction to Optical Quantum Information Processing&quot; by Kok and Lovett.&lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2020-03-03T23:32:58.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10069" PostTypeId="2" ParentId="10065" CreationDate="2020-03-04T00:30:22.813" Score="0" Body="&lt;p&gt;Just replace &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$a'=ia$&lt;/span&gt;, this maps one unitary to the other.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-03-04T00:30:22.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10070" PostTypeId="1" AcceptedAnswerId="10071" CreationDate="2020-03-04T05:38:51.057" Score="3" ViewCount="149" Body="&lt;p&gt;I am following Nielsen and Chuang, section 2.2.5:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;A projective measurement is described by an &lt;em&gt;observable&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, a Hermitian&#xA;  operator on the state space of the system being observed. The&#xA;  observable has a spectral decomposition, &lt;span class=&quot;math-container&quot;&gt;$$M = \sum_m mP_m$$&lt;/span&gt;&#xA;  where &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is the projector onto the eigenspace of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. The possible outcomes of the measurement correspond to the eigenvalues, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, of the observable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how can I find them if I only know of the observable, which in this case is &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt; if I understand correctly?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This observable has only two eigenvalues: &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. The eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; corresponds both to &lt;span class=&quot;math-container&quot;&gt;$\left|00\right\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|11\right\rangle$&lt;/span&gt;, so it seems to me I need a &quot;stronger&quot; observable, which can differentiate those two states, or I'm missing a something elementary in the definition of projective measurements.&lt;/p&gt;&#xA;" OwnerUserId="9918" LastEditorUserId="9006" LastEditDate="2020-03-04T07:44:18.533" LastActivityDate="2020-03-04T12:18:05.817" Title="Viewing two-qubit measurement as a projective measurement" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10071" PostTypeId="2" ParentId="10070" CreationDate="2020-03-04T07:49:20.930" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt; is an observable which specifies &lt;em&gt;a&lt;/em&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2Z\otimes I+I\otimes Z&#xA;$$&lt;/span&gt;&#xA;If you work this out, you'll see it's diagonal, with distinct elements on each diagonal, which is what you need.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-04T07:49:20.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10072" PostTypeId="1" CreationDate="2020-03-04T09:14:39.087" Score="1" ViewCount="53" Body="&lt;p&gt;What is the implementation of quantum superdense coding protocol if the sender and receiver share the entangled state &#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\frac{1}{\sqrt{2}} (\left| 01 \right&amp;gt; -  \left| 10\right&amp;gt;)&#xA;$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9700" LastEditorUserId="55" LastEditDate="2020-03-05T15:53:42.803" LastActivityDate="2020-03-05T15:53:42.803" Title="What is the implementation of the state in superdense coding?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10075" PostTypeId="1" AcceptedAnswerId="10078" CreationDate="2020-03-04T12:18:01.210" Score="3" ViewCount="432" Body="&lt;p&gt;As defined, CNOT should for the two input states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \pmatrix{1 \\ 0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pmatrix{\alpha \\ \beta}$&lt;/span&gt; should result in the second state unchanged: &lt;span class=&quot;math-container&quot;&gt;$\pmatrix{\alpha \\ \beta}$&lt;/span&gt;. However, to me it does not seem to be the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix for CNOT is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am not sure how to interpret the two input states, it makes sense to me to use their XOR as the input:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\pmatrix{1 \\ 0} \otimes \pmatrix{\alpha \\ \beta}  = \pmatrix{ \alpha \\ 0 \\ \beta  \\ 0 }$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How is that?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10270" LastEditorUserId="9006" LastEditDate="2020-03-04T13:04:45.300" LastActivityDate="2020-03-04T13:04:45.300" Title="How does the CNOT gate work?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10076" PostTypeId="2" ParentId="10070" CreationDate="2020-03-04T12:18:05.817" Score="2" Body="&lt;p&gt;An observable having degenerate eigenvalues means that it doesn't completely collapse the system. For example, &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt; would describe a type of measurement in which you are only asking whether the state is in the span of &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle,|11\rangle\}$&lt;/span&gt; or in the span of &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt;. This means that, for example, this type of measurement would leave a state such as &lt;span class=&quot;math-container&quot;&gt;$|00\rangle+|11\rangle$&lt;/span&gt; unperturbed, but make a state like &lt;span class=&quot;math-container&quot;&gt;$|00|\rangle+|01\rangle$&lt;/span&gt; collapse in either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-03-04T12:18:05.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10077" PostTypeId="1" AcceptedAnswerId="10091" CreationDate="2020-03-04T13:03:00.040" Score="3" ViewCount="153" Body="&lt;p&gt;I'm trying to implement an modular adder mentioned &lt;a href=&quot;https://arxiv.org/pdf/1207.0511.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; with qiskit. I have already built the &lt;span class=&quot;math-container&quot;&gt;$\Phi ADD$&lt;/span&gt; gate. But in order to build a modular adder like in figure 5 in the paper, I need to build a doubly-controlled &lt;span class=&quot;math-container&quot;&gt;$\Phi ADD$&lt;/span&gt; gate. Qiskit offers a method to transfer a circuit to a controlled gate, but now I need a &lt;em&gt;doubly&lt;/em&gt; controlled gate. I know I can use something like &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate&quot;&gt;this&lt;/a&gt;, but that need an additional qubit, which is undesired. I also know that I can use &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/basic-circuit-identities.html#The-Toffoli&quot; rel=&quot;nofollow noreferrer&quot;&gt;this method&lt;/a&gt;, but I don't know how to implement the square root of &lt;span class=&quot;math-container&quot;&gt;$\Phi ADD$&lt;/span&gt; gate. Is there any other method to do this (creating a doubly-controlled gate from the &lt;span class=&quot;math-container&quot;&gt;$\Phi ADD$&lt;/span&gt; gate I built without adding any additional qubits)?&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="9153" LastEditDate="2020-03-04T13:39:28.460" LastActivityDate="2020-03-04T17:42:45.513" Title="Make a doubly controlled gates from existing operations" Tags="&lt;algorithm&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10078" PostTypeId="2" ParentId="10075" CreationDate="2020-03-04T13:03:24.890" Score="5" Body="&lt;p&gt;The problem is tensor product which you have calculated wrongly. A correct calculation is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} 1 \\ 0 \end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix} \alpha \\ \beta \end{pmatrix}&#xA;=&#xA;\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you now apply CNOT gate you have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ &#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ &#xA;\end{pmatrix}&#xA;\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix}&#xA;=&#xA;\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which means that the second qubit is unaffected.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-04T13:03:24.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10079" PostTypeId="2" ParentId="10075" CreationDate="2020-03-04T13:03:53.547" Score="3" Body="&lt;p&gt;Where you say &quot;xor&quot;, 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 &lt;span class=&quot;math-container&quot;&gt;$[\alpha,\beta,0,0]^T$&lt;/span&gt; before application of the cnot, and hence &lt;span class=&quot;math-container&quot;&gt;$[\alpha,\beta,0,0]^T$&lt;/span&gt; after the action of the cnot as well.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-04T13:03:53.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10080" PostTypeId="2" ParentId="10072" CreationDate="2020-03-04T13:22:23.517" Score="2" Body="&lt;p&gt;If you apply &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; on second qubit, you will get state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that you can apply &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; on second qubit as well to get Bell state &lt;span class=&quot;math-container&quot;&gt;$\beta_{00}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now you can employ superdense conding as usual.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: matrix description of above mentioned operations is &lt;span class=&quot;math-container&quot;&gt;$(\mathrm{I}\otimes\mathrm{Z})(\mathrm{I}\otimes\mathrm{X})$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a circuit for doing all mentioned above:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VMC58.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VMC58.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A first part prepares state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$&lt;/span&gt;. This is an initial state you questioned about. Second part changes &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;, i.e. Bell state &lt;span class=&quot;math-container&quot;&gt;$\beta_{00}$&lt;/span&gt;. Now you can apply superdense coding as usual - this is symbolized by gates &lt;span class=&quot;math-container&quot;&gt;$\mathrm{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Z}$&lt;/span&gt; (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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-04T14:48:00.623" LastActivityDate="2020-03-04T14:48:00.623" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10081" PostTypeId="1" AcceptedAnswerId="10084" CreationDate="2020-03-04T13:59:06.430" Score="3" ViewCount="123" Body="&lt;p&gt;What will happen if the 'blackbox' function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; in Deutsch's algorithm is designed in such a way that it takes millions of years to deliver result if input is &lt;span class=&quot;math-container&quot;&gt;$x = 1$&lt;/span&gt; and few seconds if the input is &lt;span class=&quot;math-container&quot;&gt;$x = 0$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How long would it take the oracle &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to calculate &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; for all inputs? My understanding is that &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; has such quantum properties, that given a state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; as a superposition of two qubits it will apply &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; (and thus apply internally &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;) to each base state of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; simultaneously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the scenario I've described &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; will, however, take different execution times for different inputs. Will then there be a delay until all base states are evaluated by &lt;span class=&quot;math-container&quot;&gt;$ U_f$&lt;/span&gt; (or more precisely by &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="10264" LastActivityDate="2020-03-04T14:30:20.833" Title="What happens with the oracle $U_f$ if you have different blackbox execution times for different inputs?" Tags="&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10082" PostTypeId="1" AcceptedAnswerId="10085" CreationDate="2020-03-04T14:00:28.677" Score="1" ViewCount="114" Body="&lt;p&gt;If I download calibration of a quantum processor on IBM Q website I see these parameters:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;T1&lt;/li&gt;&#xA;&lt;li&gt;T2&lt;/li&gt;&#xA;&lt;li&gt;frequency (GHz)&lt;/li&gt;&#xA;&lt;li&gt;readout error&lt;/li&gt;&#xA;&lt;li&gt;single qubit U2 error rate&lt;/li&gt;&#xA;&lt;li&gt;CNOT error rate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;T1 and T2 are relaxation and dephasing times, respectively. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What are the other parameters?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-03-04T14:26:08.607" LastActivityDate="2020-03-04T14:33:28.340" Title="IBM Q calibration parameters" Tags="&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;noise&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10083" PostTypeId="2" ParentId="10067" CreationDate="2020-03-04T14:14:55.743" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9831" LastEditorUserId="9831" LastEditDate="2020-03-04T15:33:45.420" LastActivityDate="2020-03-04T15:33:45.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10084" PostTypeId="2" ParentId="10081" CreationDate="2020-03-04T14:25:02.820" Score="3" Body="&lt;p&gt;One implements &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-04T14:30:20.833" LastActivityDate="2020-03-04T14:30:20.833" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10085" PostTypeId="2" ParentId="10082" CreationDate="2020-03-04T14:26:25.397" Score="5" Body="&lt;ul&gt;&#xA;&lt;li&gt;frequency (GHz): The frequency(energy) associated with the transition between the qubit's ground state (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) and first excited state (&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;li&gt;readout error: The probability of preparing a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;(&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) and measuring a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;(&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;), ie., of having an error in your readout&lt;/li&gt;&#xA;&lt;li&gt;single qubit U2 error rate: The average error per gate of a single qubit gate, this is &lt;span class=&quot;math-container&quot;&gt;$1 - \mathrm{average\_gate\_fidelity}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;CNOT error rate: The average error per gate of a two-qubit gate.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9863" LastEditorUserId="9006" LastEditDate="2020-03-04T14:33:28.340" LastActivityDate="2020-03-04T14:33:28.340" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10086" PostTypeId="1" AcceptedAnswerId="10087" CreationDate="2020-03-04T15:27:47.217" Score="1" ViewCount="79" Body="&lt;p&gt;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 &lt;code&gt;pip list&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tXFSt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tXFSt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however whenever I try to import &lt;code&gt;qiskit.visualization&lt;/code&gt; an error occurs:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s32tS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s32tS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I don't understand why since it was suppose to be installed as &lt;code&gt;qiskit&lt;/code&gt; module is installed. Any idea where this error comes from?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="5620" LastEditDate="2020-03-04T15:49:37.700" LastActivityDate="2020-03-04T15:49:37.700" Title="Qiskit visualizations module not installed but qiskit package installed. Why?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10087" PostTypeId="2" ParentId="10086" CreationDate="2020-03-04T15:41:13.913" Score="3" Body="&lt;p&gt;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 &lt;code&gt;pip install qiskit --upgrade&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-03-04T15:41:13.913" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10088" PostTypeId="1" CreationDate="2020-03-04T15:55:26.830" Score="0" ViewCount="74" Body="&lt;p&gt;I have updated qiskit to the newest version using &lt;code&gt;pip install qiskit --upgrade&lt;/code&gt; and all was done successfully, and when I write &lt;code&gt;pip list&lt;/code&gt; on the command line I get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5H50T.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5H50T.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I should. But then I run &lt;code&gt;help(&quot;modules&quot;)&lt;/code&gt; on a jupyter notebook and get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DCud4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DCud4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which I don't understand why are there no other modules. And obviously &lt;code&gt;import qiskit&lt;/code&gt; throws an error as well. Any idea how to solve this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: This is a follow-up from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/10086/qiskit-visualizations-module-not-installed-but-qiskit-package-installed-why&quot;&gt;this question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-03-04T16:06:15.667" Title="Why doesn't qiskit appear in &quot;help(&quot;modules&quot;)&quot; even though it is installed in python environment?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="10089" PostTypeId="2" ParentId="10088" CreationDate="2020-03-04T16:06:15.667" Score="-2" Body="&lt;p&gt;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 &lt;code&gt;pip show qiskit&lt;/code&gt; in a terminal, which will return a field called &lt;code&gt;Location&lt;/code&gt;. In the notebook then add the following lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import sys&#xA;sys.path.append('the location')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-03-04T16:06:15.667" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10091" PostTypeId="2" ParentId="10077" CreationDate="2020-03-04T17:26:28.603" Score="2" Body="&lt;p&gt;Here is an example of creating a doubly controlled version of the simplest circuit with one gate (Qiskit's &lt;span class=&quot;math-container&quot;&gt;$u1$&lt;/span&gt; gate).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit&#xA;import numpy as np&#xA;&#xA;q_reg = QuantumRegister(3, 'q')&#xA;qc_u1 = QuantumCircuit(q_reg)&#xA;qc_cu1 = QuantumCircuit(q_reg)&#xA;qc_ccu1 = QuantumCircuit(q_reg)&#xA;&#xA;qc_u1.u1(np.pi/2, q_reg[0])&#xA;&#xA;qc_cu1 = get_controlled_circuit(qc_u1, q_reg[1])&#xA;&#xA;qc_ccu1 = get_controlled_circuit(qc_cu1, q_reg[2])&#xA;&#xA;print(qc_cu1.qasm())&#xA;print(qc_ccu1.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just an answer about the doubly controlled circuit, don't know much about the links and the problem that you have introduced. &lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-04T17:42:45.513" LastActivityDate="2020-03-04T17:42:45.513" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10092" PostTypeId="1" AcceptedAnswerId="10093" CreationDate="2020-03-04T18:30:58.307" Score="-1" ViewCount="44" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(qiskit.extensions.standard.x.XGate object at 0x0000019B8DEC2EB8, [Qubit(QuantumRegister(2, 'q'), 0)], [])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you so much in advance.&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-10-28T09:23:07.317" LastActivityDate="2020-10-28T09:23:07.317" Title="What do the numbers of the operation object in QuantumCircuit.data outputs?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10093" PostTypeId="2" ParentId="10092" CreationDate="2020-03-04T19:04:42.743" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-03-04T19:04:42.743" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10094" PostTypeId="2" ParentId="10092" CreationDate="2020-03-04T19:09:18.100" Score="1" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; class B():&#xA;...   def __init__(self):&#xA;...     pass&#xA;...&#xA;&amp;gt;&amp;gt;&amp;gt; B()&#xA;&amp;lt;__main__.B object at 0x106e63d30&amp;gt;&#xA;&amp;gt;&amp;gt;&amp;gt; B()&#xA;&amp;lt;__main__.B object at 0x106e63da0&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do you need to know how to reproduce these sequences? There's probably another way to accomplish your goal.&lt;/p&gt;&#xA;" OwnerUserId="10274" LastActivityDate="2020-03-04T19:09:18.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10096" PostTypeId="1" CreationDate="2020-03-04T20:52:32.103" Score="1" ViewCount="47" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this make sense?    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rich Z&lt;/p&gt;&#xA;" OwnerUserId="10275" LastEditorUserId="9006" LastEditDate="2020-03-06T19:23:47.837" LastActivityDate="2020-03-06T19:23:47.837" Title="Application Query" Tags="&lt;resource-request&gt;&lt;models&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-03-04T22:30:40.230" ContentLicense="CC BY-SA 4.0" />
  <row Id="10097" PostTypeId="2" ParentId="10028" CreationDate="2020-03-05T03:46:32.500" Score="2" Body="&lt;p&gt;You can use &lt;a href=&quot;https://www.dwavesys.com/take-leap&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave leap&lt;/a&gt;.&#xA;It is free for sign up, and you can get trial access time.&lt;/p&gt;&#xA;" OwnerUserId="9563" LastActivityDate="2020-03-05T03:46:32.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10098" PostTypeId="1" CreationDate="2020-03-05T12:54:28.547" Score="6" ViewCount="373" Body="&lt;p&gt;If a given quantum circuit has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit inputs and a certain number of gates, how can we represent the whole circuit in matrix form? Here's an example: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u2kKk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u2kKk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you. &lt;/p&gt;&#xA;" OwnerUserId="10282" LastEditorUserId="55" LastEditDate="2020-03-05T23:07:46.337" LastActivityDate="2020-03-06T11:19:46.160" Title="How to represent an $n$-qubit circuit in matrix form?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10099" PostTypeId="1" CreationDate="2020-03-05T18:58:13.930" Score="5" ViewCount="129" Body="&lt;p&gt;(This is basically a reference request)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To elaborate a bit, consider the Haar measure over &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;. This integrates over all the unitaries in &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;. So we could say that given some fixed unitary &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt;, there is an element in the set of unitaries integrated over by the Haar measure which approximates &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; well (this is trivial of course, since &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; itself occurs in the integration). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider a &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design. The &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design looks like the full set of unitaries. So now given some specific unitary &lt;span class=&quot;math-container&quot;&gt;$U_0\in U(d)$&lt;/span&gt;, is it the case that some element of the &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design must be close to &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8468" LastEditorUserId="55" LastEditDate="2020-10-28T09:23:02.593" LastActivityDate="2020-10-28T09:23:02.593" Title="Aproximating unitaries with elements from a t-design" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10100" PostTypeId="2" ParentId="10098" CreationDate="2020-03-05T19:19:30.717" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;In this case, this would amount to&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;List all the elements of the computational basis of five qubits, that is, all bit-strings of length &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle,|00001\rangle,|00010\rangle$&lt;/span&gt; etc.&lt;/li&gt;&#xA;&lt;li&gt;Determine how the gate under consideration acts on each one of these states. For example, the first Toffoli in the circuit sends &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$|11000\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|11100\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Write down the operation as a sum of operators of the form &lt;span class=&quot;math-container&quot;&gt;$|q_p\rangle\!\langle p|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; ranges over all computational basis elements, and &lt;span class=&quot;math-container&quot;&gt;$q_p$&lt;/span&gt; is the element obtained by acting with the gate over &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;To obtain the matrix representation, you now build the matrix whose &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-th column has a single &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; at the position &lt;span class=&quot;math-container&quot;&gt;$q_p$&lt;/span&gt; (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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the action of the first Toffoli gate in your circuit can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  |11100\rangle\!\langle 11000| + |11000\rangle\!\langle 11100| + (\text{identity over all other elements}).&#xA;$$&lt;/span&gt;&#xA;The matrix representation is then the matrix which only differs from the diagonal by its acting off-diagonally in the positions corresponding to &lt;span class=&quot;math-container&quot;&gt;$|11000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11100\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle\to 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|00001\rangle\to 1,...,|11000\rangle\to 2^4 + 2^3=24$&lt;/span&gt;, etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This trick will work to find the matrix representation of any gate which acts as a permutation over computational basis elements.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-03-05T19:19:30.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10101" PostTypeId="1" AcceptedAnswerId="10104" CreationDate="2020-03-05T20:38:47.860" Score="2" ViewCount="65" Body="&lt;p&gt;In his essay &lt;a href=&quot;https://arxiv.org/abs/1501.00011&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;&quot;Why now is the right time to study quantum computing&quot;&lt;/em&gt;&lt;/a&gt; Aram Harrow writes, after describing the action of the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; gate, that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;However, if we apply &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm confused by what he meant here. How does the existence of a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; gate in quantum computation demonstrate a difference in irreversibility as opposed to classical computation?&lt;/p&gt;&#xA;" OwnerUserId="5710" LastEditorUserId="9006" LastEditDate="2020-03-05T22:16:13.167" LastActivityDate="2020-03-06T00:30:22.127" Title="What does the $\sqrt{NOT}$ gate have to do with irreversibility?" Tags="&lt;quantum-gate&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10102" PostTypeId="2" ParentId="10101" CreationDate="2020-03-05T21:51:16.223" Score="3" Body="&lt;p&gt;He's saying that there is a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (quantum operation) with the property that &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt; is a bit flip, but there is no stochastic matrix (random operation) &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$S^2$&lt;/span&gt; is a bit flip.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of reversibility, the key thing is that the state &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle$&lt;/span&gt; is perpendicular to the state &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. For classical operations that is not always true. For example, for the &quot;coin flip&quot; operation &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; it is the case that &lt;span class=&quot;math-container&quot;&gt;$S|0\rangle = S|1\rangle$&lt;/span&gt;. This implies that there can be no inverse operation &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\forall k: S^\dagger S|k\rangle = |k\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-03-05T23:47:53.460" LastActivityDate="2020-03-05T23:47:53.460" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10103" PostTypeId="1" CreationDate="2020-03-05T22:55:00.177" Score="4" ViewCount="55" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\psi_{i,j}$&lt;/span&gt; be the approximate state of the qubits &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, is this enough to approximate the entire quantum state?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/534819/58382&quot;&gt;&lt;strong&gt;&lt;em&gt;Cross-posted on physics&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9305" LastEditorUserId="55" LastEditDate="2020-03-06T09:20:01.037" LastActivityDate="2020-03-06T09:20:01.037" Title="Is there an analog for the Solovay-Kitaev Theorem for approximating quantum states?" Tags="&lt;solovay-kitaev-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10104" PostTypeId="2" ParentId="10101" CreationDate="2020-03-06T00:23:01.150" Score="2" Body="&lt;p&gt;I wouldn't say it's the existence of the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; gate that demonstrates reversibility per se. It's the specific example that Harrow is using.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you measure the output of applying a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; gate to a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, it looks just like a coin flip. It could be either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you apply &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; a second time, the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{NOT}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9995" LastActivityDate="2020-03-06T00:23:01.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10105" PostTypeId="2" ParentId="10101" CreationDate="2020-03-06T00:30:22.127" Score="3" Body="&lt;p&gt;The point is just that the gate &lt;span class=&quot;math-container&quot;&gt;$U := \sqrt{\rm{NOT}}$&lt;/span&gt; naively &lt;em&gt;appears&lt;/em&gt; to to scramble all the information about an initial classical state, because it takes both the initial states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to states that have 50/50 probabilities of being measured to 0 or 1. So classically, one would expect that these superposition states &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; would be identical, and that the procedure that prepared them - applying the gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle$&lt;/span&gt; are actually physically distinct, and applying the gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; again makes the apparently-erased information &quot;reappear&quot; by transforming the apparently-identical states into manifestly distinct states. The point is that unitary operations like &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; never actually destroy any information about the initial state, even if they might naively appear to.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-03-06T00:30:22.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10106" PostTypeId="2" ParentId="10098" CreationDate="2020-03-06T11:04:59.403" Score="2" Body="&lt;p&gt;As mentioned in answer by &lt;em&gt;qIS&lt;/em&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; acting on one qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note, that symbol &lt;span class=&quot;math-container&quot;&gt;$CCNOT$&lt;/span&gt; is used for Toffoli gate.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are matrices describing each step:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S_1 = I \otimes X \otimes I \otimes I \otimes I$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S_2 = CCNOT  \otimes I \otimes I$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S_3 = X \otimes X \otimes I \otimes I \otimes I$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S_4 = CCNOT_{1,2 \rightarrow 4}  \otimes I $&lt;/span&gt;. Matrix &lt;span class=&quot;math-container&quot;&gt;$CCNOT_{1,2 \rightarrow 4}$&lt;/span&gt; is a Toffoli gate controlled by first and second qubit but acting on fourth qubit. If you follow construction proposed by &lt;em&gt;qIS&lt;/em&gt; you will get matrix shown below.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S_5 = I \otimes I \otimes X \otimes X \otimes I$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$S_6 = I \otimes I \otimes CCNOT$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The last step to obtain matrix desribing whole circuit is to do matrix multiplication &lt;span class=&quot;math-container&quot;&gt;$S_{6}S_{5}S_{4}S_{3}S_{2}S_{1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Matrix &lt;span class=&quot;math-container&quot;&gt;$CCNOT_{1,2 \rightarrow 4}$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KWD5i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KWD5i.png&quot; alt=&quot;Matrix for Toffoli acting on fourth qubit and controlled by first and second qubit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-06T11:19:46.160" LastActivityDate="2020-03-06T11:19:46.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10107" PostTypeId="1" AcceptedAnswerId="10108" CreationDate="2020-03-06T11:54:47.517" Score="2" ViewCount="86" Body="&lt;p&gt;I am running vqe algorithm in qasm_simulator and cannot get the optimal solution.&#xA;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?&lt;/p&gt;&#xA;" OwnerUserId="10234" LastActivityDate="2020-03-06T13:45:35.157" Title="Finding optimal values of depth and max_trials parameters in vqe algorithm" Tags="&lt;qiskit&gt;&lt;vqe&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10108" PostTypeId="2" ParentId="10107" CreationDate="2020-03-06T13:45:35.157" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-03-06T13:45:35.157" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10109" PostTypeId="1" AcceptedAnswerId="10124" CreationDate="2020-03-06T23:08:38.113" Score="2" ViewCount="124" Body="&lt;p&gt;I am trying to wrap my head around he &lt;code&gt;quantum_info&lt;/code&gt; module on qiskit, since most of the functions on &lt;code&gt;qiskit.tools&lt;/code&gt; are going to be deprecated, but I am very confused with the Statevector and DensityMatrix objects. For example, with this snippet of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;simulator = BasicAer.get_backend('statevector_simulator') # the device to run on&#xA;result6 = execute(circuit6, simulator).result()&#xA;outputstate6 = result6.get_statevector(circuit6, decimals=3)&#xA;probability = np.abs(np.array(outputstate6))**2&#xA;outstatevector=quantum_info.states.Statevector(outputstate6)&#xA;print(type(outstatevector))&#xA;print(type(outputstate6))&#xA;print(outputstate6)&#xA;print(quantum_info.entropy(outputstate6))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;class 'qiskit.quantum_info.states.statevector.Statevector'&amp;gt;&#xA;&amp;lt;class 'numpy.ndarray'&amp;gt;&#xA;[0.447+0.j 0.   +0.j 0.632+0.j 0.632+0.j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;as expected but then I get the error on &lt;code&gt;quantum_info.entropy(outputstate6)&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;QiskitError: 'Input quantum state is not a valid'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I solve this?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-10-28T09:22:58.633" LastActivityDate="2020-10-28T09:22:58.633" Title="How to calculate the Von Neuman entropy on qiskit with the module quantum_info?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10110" PostTypeId="1" AcceptedAnswerId="10112" CreationDate="2020-03-07T05:47:18.903" Score="4" ViewCount="886" Body="&lt;p&gt;I have a quick question: Is the qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; the same as &lt;span class=&quot;math-container&quot;&gt;$-|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9835" LastEditorUserId="2879" LastEditDate="2020-03-07T08:12:03.207" LastActivityDate="2020-03-13T18:47:42.150" Title="Negative of a qubit state" Tags="&lt;quantum-state&gt;" AnswerCount="3" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10111" PostTypeId="2" ParentId="10110" CreationDate="2020-03-07T07:34:01.383" Score="6" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}$&lt;/span&gt; of the state &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}|\psi\rangle$&lt;/span&gt; (which in this case is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;) is called a &quot;global phase&quot;. 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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-03-07T07:34:01.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10112" PostTypeId="2" ParentId="10110" CreationDate="2020-03-07T07:36:33.027" Score="8" Body="&lt;p&gt;States &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-|\psi\rangle$&lt;/span&gt; differ in global phase only and thus they are indistinguishable. So, the answer is: &lt;strong&gt;state &lt;span class=&quot;math-container&quot;&gt;$-|\psi\rangle$&lt;/span&gt; is the equivalent to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The global phase in this case is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\pi} = -1$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-13T18:47:42.150" LastActivityDate="2020-03-13T18:47:42.150" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10113" PostTypeId="2" ParentId="10110" CreationDate="2020-03-07T08:43:59.920" Score="7" Body="&lt;p&gt;They are physically indistinguishable, also their density matrices are the same because &lt;span class=&quot;math-container&quot;&gt;$$\big(-|\psi\rangle\big)\big(-\langle\psi|\big) = |\psi\rangle \langle\psi|$$&lt;/span&gt; &#xA;But mathematically they are two different vectors. And it's better to not forget about this when doing calculations.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-03-07T08:43:59.920" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10115" PostTypeId="1" AcceptedAnswerId="10117" CreationDate="2020-03-07T19:48:29.830" Score="3" ViewCount="247" Body="&lt;p&gt;The question is quite straightforward, I have some two qubit state and I want to measure it in the Bell basis. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4782/how-to-measure-in-the-standard-basis&quot;&gt;This question&lt;/a&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Phi^+\rangle \to |00\rangle \\&#xA;|\Phi^-\rangle \to |01\rangle \\&#xA;|\Psi^+\rangle \to |10\rangle \\&#xA;|\Psi^+\rangle \to |11\rangle \\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but it does't seem to work as I thought it would:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/us7EV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/us7EV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0rrEL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0rrEL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-03-08T22:40:59.590" Title="How to measure in the bell basis?" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10116" PostTypeId="1" AcceptedAnswerId="10122" CreationDate="2020-03-07T19:53:54.167" Score="3" ViewCount="159" Body="&lt;p&gt;I understand that given a pure state &lt;span class=&quot;math-container&quot;&gt;$ |\psi\rangle$&lt;/span&gt;, we can express it in terms of two angles &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi}\sin(\theta/2)|1\rangle $&lt;/span&gt;, and this is derived by converting from &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; into their representations in terms of &lt;span class=&quot;math-container&quot;&gt;$r\mathrm{e}^{i\theta}$&lt;/span&gt;, and then factoring and rearranging that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how do I convert between the two representations given arbitrary states? I know that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = (\theta,\varphi) = (0,0), |1\rangle = (\pi,0), |+\rangle = (\pi/2, 0)$&lt;/span&gt; etc, but how do I get it for an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is complex, shift the entire state by phase &lt;span class=&quot;math-container&quot;&gt;$\bar{\alpha}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\bar\alpha$&lt;/span&gt; is the complex conjugate of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, to end up with &lt;span class=&quot;math-container&quot;&gt;$\alpha\bar\alpha |0\rangle + \bar\alpha\beta|1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Use the formulas:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2 \arccos(\alpha\bar\alpha) \\&#xA;\varphi = ???&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10304" LastEditorUserId="10304" LastEditDate="2020-03-08T01:05:24.003" LastActivityDate="2020-03-08T15:09:49.867" Title="How to get Bloch sphere angles given arbitrary qbit as linear combination of basis vectors?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10117" PostTypeId="2" ParentId="10115" CreationDate="2020-03-07T20:08:39.347" Score="1" Body="&lt;p&gt;I have found my mistake, and hopefully it may help more people. It lies on the fact that &lt;span class=&quot;math-container&quot;&gt;$(AB)^\dagger=B^\dagger A^\dagger$&lt;/span&gt;. Having done so, my result is as expected. But any more enlightening answer is more than welcome. &lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-03-07T20:08:39.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10118" PostTypeId="2" ParentId="10115" CreationDate="2020-03-07T23:38:33.407" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if your original algorithm is described by series of gates &lt;span class=&quot;math-container&quot;&gt;$A_{n}A_{n-1}\dots A_2A_1$&lt;/span&gt;, the inverse algorithm is &lt;span class=&quot;math-container&quot;&gt;$A_{1}^\dagger A_{2}^\dagger  \dots A_{n-1} ^\dagger A_{n} ^\dagger $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, you use an algorithm &lt;span class=&quot;math-container&quot;&gt;$CNOT(H\otimes I)$&lt;/span&gt; for transforming initial state to Bell state. So, to measure in Bell basis you have to applied inverse &lt;span class=&quot;math-container&quot;&gt;$(H^\dagger\otimes I^\dagger)CNOT^\dagger  = (H\otimes I)CNOT$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$I^\dagger=I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H^\dagger = H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT^\dagger = CNOT$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Added by &lt;em&gt;Davit Khachatryan&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, if one has an arbitrary quantum state in the Bell basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle = c_{\Phi^+}|\Phi^+\rangle + c_{\Phi^-}|\Phi^-\rangle + c_{\Psi^+}|\Psi^+\rangle + c_{\Psi^-}|\Psi^-\rangle &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$c_{\Phi^+}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c_{\Phi^-}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c_{\Psi^+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_{\Psi^-}$&lt;/span&gt; are the corresponding aplitudes in the Bell basis. After applying &lt;span class=&quot;math-container&quot;&gt;$(H\otimes I)CNOT$&lt;/span&gt; we will have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle = c_{\Phi^+}|00\rangle + c_{\Phi^-}|10\rangle + c_{\Psi^+}|01\rangle + c_{\Psi^-}|11\rangle &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9459" LastEditDate="2020-03-08T22:40:59.590" LastActivityDate="2020-03-08T22:40:59.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10119" PostTypeId="1" CreationDate="2020-03-08T00:47:11.730" Score="1" ViewCount="84" Body="&lt;p&gt;I implemented a solver for the Job Shop Problem, based on quantum annealing, on a D-Wave machine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ... 41 energy num_oc. ...&#xA;0    1  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  1 -144.0       1 ...&#xA;1    0  1  0  0  0  0  0  0  0  0  0  0  0  0  1  0 ...  1 -136.0       1 ...&#xA;2    1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0 ...  1 -134.0       1 ...&#xA;15   1  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  0 -133.0       1 ...&#xA;16   1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ...  0 -133.0       1 ...&#xA;138  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0 ...  0 -131.0       1 ...&#xA;3    1  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  1 -129.0       1 ...&#xA;4    0  1  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  0 -127.0       1 ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Should't the lowest energy solution, get picked more than once, just by chance?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On multiple runs, I now always get a different, kind of random result it seems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do you have any idea, what the issue might be?&lt;/p&gt;&#xA;" OwnerUserId="9950" LastActivityDate="2020-03-08T17:34:04.793" Title="Quantum Annealing - Random results on big N" Tags="&lt;d-wave&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10120" PostTypeId="1" CreationDate="2020-03-08T05:57:23.273" Score="2" ViewCount="23" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10307" LastActivityDate="2020-03-08T05:57:23.273" Title="How do we know that there exists a quantum circuit whose output distribution is #P-hard to calculate?" Tags="&lt;random-quantum-circuit&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10121" PostTypeId="1" CreationDate="2020-03-08T14:53:00.467" Score="2" ViewCount="49" Body="&lt;p&gt;Given some partial states &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AC}$&lt;/span&gt;, is there a general procedure to construct a state &lt;span class=&quot;math-container&quot;&gt;$\delta_{ABC}$&lt;/span&gt; such that the following sum of trace distances&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||\text{Tr}_C(\delta_{ABC}) - \rho_{AB}||_1 + ||\text{Tr}_B(\delta_{ABC}) - \sigma_{AC}||_1$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$AC$&lt;/span&gt;, I'm not sure how to proceed.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-03-09T14:13:27.357" Title="Given partial states, can one construct the best estimate of the full state?" Tags="&lt;entanglement&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10122" PostTypeId="2" ParentId="10116" CreationDate="2020-03-08T15:09:49.867" Score="3" Body="&lt;p&gt;As in if given &lt;span class=&quot;math-container&quot;&gt;$ |\psi\rangle=\alpha |0\rangle+\beta |1\rangle$&lt;/span&gt;, and you want it in the form &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2) |0\rangle+e^{i\phi}\sin(\theta/2)  |1\rangle$&lt;/span&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume the state is normalised &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd first start by multiplying by &lt;span class=&quot;math-container&quot;&gt;$\frac{\alpha^*}{|\alpha|}$&lt;/span&gt; which is a phase (complex number unit length), and use &lt;span class=&quot;math-container&quot;&gt;$\alpha \alpha^*=|\alpha|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$\theta=2\arccos(|\alpha|)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\theta=2\arcsin(|\beta|)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$\frac{\beta\alpha^*}{|\alpha|}=e^{i\phi}|\beta|$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\frac{\beta\alpha^*}{|\alpha||\beta|}=e^{i\phi}$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so that &lt;span class=&quot;math-container&quot;&gt;$\phi=\arg\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)$&lt;/span&gt; and it depends on how you want to calculate that, which branch of the loagarithm to take/where to measure angles from.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You could do something like &lt;span class=&quot;math-container&quot;&gt;$\phi=-i\ln\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)$&lt;/span&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In summary try&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2 \arccos(|\alpha|) \\&#xA;\varphi = \arg\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="197" LastActivityDate="2020-03-08T15:09:49.867" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10123" PostTypeId="1" CreationDate="2020-03-08T15:18:31.530" Score="3" ViewCount="55" Body="&lt;p&gt;I would like to understand why two qubit gates are generally more noisy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I am interested in single qubit gates, I can have an effective modelling as a master equation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\dot{\rho}=\frac{1}{i \hbar} [H,\rho]+\gamma \mathcal{D}[\sigma_-] \rho +\gamma^* \mathcal{D}[\sigma_z] \rho$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The rate of noise is roughly: &lt;span class=&quot;math-container&quot;&gt;$\gamma+\gamma^*$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$H=\frac{\hbar \Omega}{2} \sigma_y $&lt;/span&gt; for a &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; rotation in the interaction picture.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a two qubit gate, I would expect a simple model like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$H=\frac{\hbar g}{2} \left( \sigma_1^+ \sigma_2^-+\sigma_1^- \sigma_2^+ \right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Why are two qubit gates generally noisier ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed here with this simple model I would expect the rate noise to simply be &lt;span class=&quot;math-container&quot;&gt;$2(\gamma+\gamma^*)$&lt;/span&gt;. Thus twice as the one for the single qubit gate. But at the same time we have two qubits so &quot;per qubit&quot; the rate of noise is the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are two qubits gate noisier because they rotate slower ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like a justified answer (with references) in the context of superconducting qubits.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2020-03-08T15:18:31.530" Title="Why are two qubits gates more noisy?" Tags="&lt;quantum-gate&gt;&lt;noise&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10124" PostTypeId="2" ParentId="10109" CreationDate="2020-03-08T15:58:04.523" Score="3" Body="&lt;p&gt;&lt;strong&gt;Short answer&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are getting that error because your example does not use a valid (normalized) statevector. If you remove the &lt;code&gt;decimals=3&lt;/code&gt; kwarg where you call &lt;code&gt;result.get_statevector&lt;/code&gt; it will work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Von-Neuman &lt;code&gt;entropy&lt;/code&gt; function in the &lt;code&gt;qiskit.quantum_info&lt;/code&gt; works with either &lt;code&gt;Statevector&lt;/code&gt; or &lt;code&gt;DensityMatrix&lt;/code&gt; 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:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.quantum_info import entropy, Statevector, DensityMatrix&#xA;&#xA;# Pure state entropy (Note this is always 0)&#xA;# The following are equivalent:&#xA;&#xA;s1 = entropy([1, 0, 0, 0])  # Statevector as list&#xA;s2 = entropy(np.array([1, 0, 0, 0])) # Statevector as array&#xA;s3 = entropy(Statevector([1, 0, 0, 0]))  # Statevector object&#xA;&#xA;print(s1, s2, s3)&#xA;&#xA;# Mixed state entropy&#xA;# The following are equivalent&#xA;&#xA;s1 = entropy([[0.75, 0], [0, 0.25]])  # Density matrix as list&#xA;s2 = entropy(np.array([[0.75, 0], [0, 0.25]])) # density matrix as array&#xA;s3 = entropy(DensityMatrix([[0.75, 0], [0, 0.25]]))  # Density matrix object&#xA;&#xA;print(s1, s2, s3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Returns True:&#xA;Statevector([1 / np.sqrt(2), 1 / np.sqrt(2)]).is_valid()&#xA;&#xA;# Returns False:&#xA;Statevector([0.707, 0.707]).is_valid()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Entropy base:&lt;/em&gt; Another thing you should keep in mind if you didn't already notice is that the &lt;code&gt;qiskit.quantum_info.entropy&lt;/code&gt; function takes logarithms in base 2 by default (and you can use a different base using the &lt;code&gt;base&lt;/code&gt; kwarg). The deprecated &lt;code&gt;qiskit.tools.qi.entropy&lt;/code&gt; function was always taken in log base &lt;code&gt;e&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.quantum_info import entropy&#xA;from qiskit.tools.qi import entropy as old_entropy&#xA;&#xA;rho = [[0.75, 0], [0, 0.25]]&#xA;&#xA;s1 = entropy(rho)  # base-2&#xA;s2 = entropy(rho, base=np.e)  # base-e&#xA;s3 = old_entropy(rho)  # base-e&#xA;&#xA;print(s1, s2, s3, s2 == s3)&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2020-03-08T15:58:04.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10125" PostTypeId="2" ParentId="10119" CreationDate="2020-03-08T17:34:04.793" Score="1" Body="&lt;p&gt;There is no guarantee the lowest energy solution get picked more often, or even get picked once. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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...). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_quantum_computation&quot; rel=&quot;nofollow noreferrer&quot;&gt;minimal spectral gap very small&lt;/a&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-03-08T17:34:04.793" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="10126" PostTypeId="1" CreationDate="2020-03-08T21:30:50.937" Score="5" ViewCount="116" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\Omega \rangle$&lt;/span&gt; be the maximally entangled state over a bipartite system whose parts are each dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \Omega \rangle \equiv \sum_i^{d}| ii \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then one way of writing the Choi representation &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt; of a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi: \mathbb{C}^{d\times d} \rightarrow \mathbb{C}^{d\times d}$&lt;/span&gt; that acts on density operators &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathbb{C}^{d \times d}$&lt;/span&gt; is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Phi) \equiv (I \otimes \Phi )| \Omega \rangle \langle \Omega |&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I choose &lt;span class=&quot;math-container&quot;&gt;$\Phi_U$&lt;/span&gt; to be a unitary channel (i.e. &lt;span class=&quot;math-container&quot;&gt;$\Phi_U (\rho ) = U\rho U^\dagger$&lt;/span&gt;) then its Choi representation in this notation would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;J(\Phi_U) \equiv (I \otimes U)| \Omega \rangle \langle \Omega |(I \otimes U^\dagger)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Phi_{U\circ V}(\rho) \equiv UV\rho (UV)^\dagger$&lt;/span&gt;, how can I &quot;nicely&quot; represent &lt;span class=&quot;math-container&quot;&gt;$J(\Phi_{U \circ V})$&lt;/span&gt;, for example in terms of &lt;span class=&quot;math-container&quot;&gt;$J(\Phi_U)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$J(\Phi_V)$&lt;/span&gt; and linear operations in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{d^2 \times d^2}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="55" LastEditDate="2020-09-03T15:03:42.763" LastActivityDate="2020-11-11T14:36:33.167" Title="Explicit form for composition of Choi representation quantum channels" Tags="&lt;quantum-operation&gt;&lt;noise&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10127" PostTypeId="1" AcceptedAnswerId="10130" CreationDate="2020-03-09T00:39:04.637" Score="3" ViewCount="636" Body="&lt;p&gt;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. &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\braket}[1]{\langle #1 \rangle}\newcommand{\bra}[1]{\langle #1 |}\newcommand{\ket}[1]{| #1 \rangle}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U_l = \text{exp}(i\frac{\pi}{4}l(z)X)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is the pauli &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; gate and &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper that I've been reading claims that &lt;span class=&quot;math-container&quot;&gt;$$U_l^{\dagger}YU_l = \cos(\frac{\pi}{2}l(z))Y + \sin(\frac{\pi}{2}l(z))Z$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is the pauli &lt;span class=&quot;math-container&quot;&gt;$\sigma_{y}$&lt;/span&gt; gate and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, they conclude that &lt;span class=&quot;math-container&quot;&gt;$$\bra{z,0}U_l^{\dagger}YU_l\ket{z,0} = \sin(\frac{\pi}{2}l(z)) = l(z)$$&lt;/span&gt; , where &lt;span class=&quot;math-container&quot;&gt;$z = z_1,...,z_n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_l = \text{exp}(i\frac{\pi}{4}l(z)X) = I + e^{i\frac{\pi}{4}l(z)}X$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, I have that &lt;span class=&quot;math-container&quot;&gt;$$U_l^{\dagger}Y = Y + ie^{-i\frac{\pi}{4}l(z)}Z$$&lt;/span&gt; and therefore &lt;span class=&quot;math-container&quot;&gt;$$U_l^{\dagger}YU_l = -ie^{i\frac{\pi}{4}l(z)}Z + ie^{-i\frac{\pi}{4}l(z)}Z$$&lt;/span&gt; which, when we apply Euler's formula, reduces to: &lt;span class=&quot;math-container&quot;&gt;$$2\sin(\frac{\pi}{4}l(z))Z$$&lt;/span&gt; which doesn't seem to be correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please help me out? I've been stuck on it for a couple of days now.&lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="2149" LastEditDate="2020-03-09T22:34:33.420" LastActivityDate="2020-03-10T07:44:53.873" Title="Similarity Transformations on Pauli Operators in 2-qubit states (eq. 11 - Farhi's QNN Paper)" Tags="&lt;pauli-gates&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10128" PostTypeId="1" AcceptedAnswerId="10139" CreationDate="2020-03-09T05:53:19.200" Score="3" ViewCount="402" Body="&lt;p&gt;I know there is a documentation for &lt;a href=&quot;https://qiskit.org/documentation/api/qiskit.aqua.algorithms.single_sample.Shor.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit.aqua.algorithms.Shor&lt;/a&gt; that explains that they used &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205095&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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 ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the code I used to factor N=15&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;shor = Shor(15,2)&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;quantum_instance = QuantumInstance(backend, skip_qobj_validation=False)&#xA;res = shor.run(quantum_instance)&#xA;print(&quot;The list of factors of {} as computed by Shor is {}.&quot;.format(PRIME, res['factors'][0]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is the error i got&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;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'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10280" LastEditorUserId="4127" LastEditDate="2020-03-09T07:04:52.183" LastActivityDate="2020-03-09T12:30:10.293" Title="How many Qubits does the qiskit implementation of Shor's Algorithm need to factor N=15?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10129" PostTypeId="2" ParentId="10127" CreationDate="2020-03-09T07:09:40.643" Score="3" Body="&lt;p&gt;Your assumption that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is invalid. When an operator is in the exponent, it is defined by the power series about &lt;span class=&quot;math-container&quot;&gt;$X = 0$&lt;/span&gt; with the operator replaced in the exponential by the eigenvalue. In this case&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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} +  ...$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recalling that the pauli matrices square to the identity matrix, you can see that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\theta X} = \cos(\theta) I + i\sin(\theta)X$$&lt;/span&gt; in a totally analogous way to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Euler%27s_formula#Using_power_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;proof of euler's formula by power series&lt;/a&gt;. Which is derivation of the accepted answers starting point.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the generic case where such a simplification was not available:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The easiest way to find &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger} Y U$&lt;/span&gt; would be by recalling &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U^{\dagger} Y U = U^{\dagger} (U Y) + U^{\dagger} [Y, U] = Y + U^{\dagger} [Y, U]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you would need to find the commutator &lt;span class=&quot;math-container&quot;&gt;$[Y,U]$&lt;/span&gt;. You could either insert the expansion above in for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and use the linearity of the commutator to work that out, or you could use a form of the use &lt;a href=&quot;https://en.wikipedia.org/wiki/Baker%E2%80%93Campbell%E2%80%93Hausdorff_formula#The_identity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Baker-Campbell-Hausdorf formula&lt;/a&gt; (line 2 in the link):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-A}Be^{A} = B + [A,B] + \frac{1}{2!}[A,[A,B]] + \frac{1}{3!}[A,[A,[A,B]]] + ...$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; separately, you would get the expansion for &lt;span class=&quot;math-container&quot;&gt;$\cos(\frac{\pi}{2} l(z))$&lt;/span&gt; in front of the terms with &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin(\frac{\pi}{2} l(z))$&lt;/span&gt; in front of &lt;span class=&quot;math-container&quot;&gt;$[X,Y] \propto Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a &lt;a href=&quot;https://physics.stackexchange.com/questions/211501/is-there-a-simple-expression-for-x-eixp?noredirect=1&amp;amp;lq=1&quot;&gt;worked example&lt;/a&gt; of using the BCH formula for computing &lt;span class=&quot;math-container&quot;&gt;$[x,e^{ixp}]$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2149" LastEditorUserId="2149" LastEditDate="2020-03-09T21:49:27.757" LastActivityDate="2020-03-09T21:49:27.757" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10130" PostTypeId="2" ParentId="10127" CreationDate="2020-03-09T07:47:20.553" Score="3" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i \theta X} = cos(\theta)I + i sin(\theta) X$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can show that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_l = e^{i \frac{\pi}{4}l(z) X} = cos(\frac{\pi}{4}l(z)) I + isin(\frac{\pi}{4}l(z)) X$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;U_l^\dagger Y U_l &amp;amp;= \left( cos(\frac{\pi}{4}l(z)) I - isin(\frac{\pi}{4}l(z)) &#xA;X \right)&#xA;Y \left( cos(\frac{\pi}{4}l(z)) I + i sin(\frac{\pi}{4}l(z)) X \right) =&#xA;\\&#xA;&amp;amp;= 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 =&#xA;\\&#xA;&amp;amp;= cos(\frac{\pi}{2}l(z))Y + sin(\frac{\pi}{2}l(z)) Z &#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I am not certain what &lt;span class=&quot;math-container&quot;&gt;$\left|z,0\right\rangle$&lt;/span&gt; means, but note that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\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))&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example of &quot;bra-ket&quot; calculation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle 0 | Y | 0 \rangle = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;0 &amp;amp; -i \\&#xA;i &amp;amp; 0&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;1 \\&#xA;0&#xA;\end{pmatrix} = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-10T07:44:53.873" LastActivityDate="2020-03-10T07:44:53.873" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10131" PostTypeId="2" ParentId="10121" CreationDate="2020-03-09T09:40:37.203" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\delta_{ABC}$&lt;/span&gt; except for the constraint that &lt;span class=&quot;math-container&quot;&gt;$\delta_{ABC}$&lt;/span&gt; is positive semi-definite. This is exactly what semi-definite programming is designed to do.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: the calculation below uses a different 1-norm (my bad). See the comment by Norbert, below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M1=\text{Tr}_C(\delta_{ABC})-\rho_{AB}&#xA;$$&lt;/span&gt;&#xA;and the define variables &lt;span class=&quot;math-container&quot;&gt;$x_{ij}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M1_{ij}\leq x_{ij},\qquad -M1_{ij}\leq x_{ij}&#xA;$$&lt;/span&gt;&#xA;with the intent of getting (when we're minimising &lt;span class=&quot;math-container&quot;&gt;$x_{ij}$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$x_{ij}=|M1_{ij}|$&lt;/span&gt;. Then, you set&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j}x_{ij}\leq x\qquad\forall i.&#xA;$$&lt;/span&gt;&#xA;In effect, &lt;span class=&quot;math-container&quot;&gt;$x=\|M_1\|_1$&lt;/span&gt;.&#xA;If you do something similar with a matrix &lt;span class=&quot;math-container&quot;&gt;$M2$&lt;/span&gt;, variables &lt;span class=&quot;math-container&quot;&gt;$y_{ij}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, your final problem is to minimise &lt;span class=&quot;math-container&quot;&gt;$x+y$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Don't forget to include the constraint &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho_{ABC})=1$&lt;/span&gt;. It might be implicit in previous constraints, I'm not sure.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-03-09T14:13:27.357" LastActivityDate="2020-03-09T14:13:27.357" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10132" PostTypeId="2" ParentId="6821" CreationDate="2020-03-09T09:44:57.573" Score="0" Body="&lt;p&gt;If one of them &lt;span class=&quot;math-container&quot;&gt;$(U)$&lt;/span&gt; is a unitary while the other one &lt;span class=&quot;math-container&quot;&gt;$(V)$&lt;/span&gt; is any matrix (with &lt;span class=&quot;math-container&quot;&gt;$\| V \| = 1$&lt;/span&gt;), then&#xA; I think  that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f = - tr((U - V)^{\dagger}(U - V))$$&lt;/span&gt; would work well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$V = U$&lt;/span&gt;, then f would be 0.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$V = 0$&lt;/span&gt;, then f would be -1.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$V = \lambda U$&lt;/span&gt;, then f would be &lt;span class=&quot;math-container&quot;&gt;$-|1 - \lambda|^{2}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;and so on.&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="462" LastEditDate="2020-03-09T09:54:10.387" LastActivityDate="2020-03-09T09:54:10.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10133" PostTypeId="2" ParentId="10126" CreationDate="2020-03-09T09:46:54.223" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; dimensional calculation, where I'm taking it up to &lt;span class=&quot;math-container&quot;&gt;$d^4$&lt;/span&gt;), but what I'd do is calculate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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).&#xA;$$&lt;/span&gt;&#xA;I simply think of this as teleporting the output from the first channel (&lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;) into the into of the second channel (&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) so that you get the composite action of &lt;span class=&quot;math-container&quot;&gt;$UV$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-03-09T16:21:33.990" LastActivityDate="2020-03-09T16:21:33.990" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10134" PostTypeId="1" CreationDate="2020-03-09T10:01:12.090" Score="5" ViewCount="296" Body="&lt;p&gt;Suppose we have an oracle &lt;span class=&quot;math-container&quot;&gt;$O_f$&lt;/span&gt; that given an initial state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; maps it into the following state: &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O_f : |x\rangle \mapsto e^{if(x)} |x\rangle &#xA;$$&lt;/span&gt;&#xA;Now, assuming that &lt;span class=&quot;math-container&quot;&gt;$f(x) \in [0,1]$&lt;/span&gt;, is it possible to construct a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$O_p$&lt;/span&gt; such that: &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O_p : |x\rangle \otimes |0\rangle \mapsto |x\rangle \otimes (\sqrt{f(x)} |0\rangle + \sqrt{1-f(x)} |1\rangle) &#xA;$$&lt;/span&gt;&#xA;using &lt;span class=&quot;math-container&quot;&gt;$O_f$&lt;/span&gt; ? If you can suggest some references, i would appreciate it. Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="10315" LastEditorUserId="55" LastEditDate="2020-10-28T09:22:54.290" LastActivityDate="2020-10-28T09:22:54.290" Title="Convert a quantum Phase Oracle into a Probability Oracle" Tags="&lt;algorithm&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10135" PostTypeId="2" ParentId="6821" CreationDate="2020-03-09T10:10:43.470" Score="0" Body="&lt;p&gt;I think that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f = \frac{tr(A^{\dagger}B)}{\sqrt{tr(A^{\dagger}A)}\sqrt{tr(B^{\dagger}B)}} $$&lt;/span&gt; is a good useful measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets say &lt;span class=&quot;math-container&quot;&gt;$B = e^{i \phi} A$&lt;/span&gt;, then &#xA;&lt;span class=&quot;math-container&quot;&gt;$tr(A^{\dagger}B) = N e^{i \phi} tr(A^{\dagger}A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$tr(B^{\dagger}B) = tr(A^{\dagger}A)$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$f = N e^{i \phi}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this measure reduces to the Hilbert Schmidt norm when used for Unitary matrices.&lt;/p&gt;&#xA;" OwnerUserId="462" LastActivityDate="2020-03-09T10:10:43.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10136" PostTypeId="2" ParentId="10134" CreationDate="2020-03-09T10:55:40.293" Score="4" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A typical construction would allow you to create (Hadamard - controlled oracle - Hadamard) would create an output&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\frac{f(x)}{2}|0\rangle+i\sin\frac{f(x)}{2}|1\rangle,&#xA;$$&lt;/span&gt;&#xA;which is obviously not what you're asking for. There might be some simple modifications that let you approximate what you're after.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-09T10:55:40.293" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10137" PostTypeId="1" AcceptedAnswerId="10138" CreationDate="2020-03-09T12:06:13.117" Score="1" ViewCount="49" Body="&lt;p&gt;In his &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec10.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; on quantum computing, Scott Aaronson describes polynomial-size quantum circuits,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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 &lt;em&gt;polynomial-size quantum circuits&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and then using this goes on to give a practical definition of &lt;span class=&quot;math-container&quot;&gt;$\sf BQP$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sf BQP$&lt;/span&gt; is the class of languages &lt;span class=&quot;math-container&quot;&gt;$L\subseteq\{0, 1\}^*$&lt;/span&gt; for which there exists a uniform family of polynomial-size quantum circuits, &lt;span class=&quot;math-container&quot;&gt;$\{C_n\}$&lt;/span&gt;, such that for all &lt;span class=&quot;math-container&quot;&gt;$x\in\{0, 1\}^n$&lt;/span&gt;:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$x\in L$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$C_n$&lt;/span&gt; accepts input &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|0\cdots0\rangle$&lt;/span&gt; with probability at least 2/3.&lt;/li&gt;&#xA;  &lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$x\notin L$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$C_n$&lt;/span&gt; accepts input &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|0\cdots0\rangle$&lt;/span&gt; with probability at most 1/3.&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now, take &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; to be any standard universal gate set (e.g. the Clifford+&lt;span class=&quot;math-container&quot;&gt;$\rm T$&lt;/span&gt; set), and let &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; be a language that can be computed on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits only by using (polynomially many copies of) some general &lt;span class=&quot;math-container&quot;&gt;$SU(2^n)$&lt;/span&gt; gate &lt;span class=&quot;math-container&quot;&gt;$\rm U$&lt;/span&gt;, whose decomposition requires exponentially (in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) many gates from the set &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. Seemingly &lt;span class=&quot;math-container&quot;&gt;$L\notin\sf BQP$&lt;/span&gt; as the circuit implementing &lt;span class=&quot;math-container&quot;&gt;$\rm U$&lt;/span&gt; is not a polynomial circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, let &lt;span class=&quot;math-container&quot;&gt;$G'=G\cup\{\rm U\}$&lt;/span&gt;. Clearly, &lt;span class=&quot;math-container&quot;&gt;$G'$&lt;/span&gt; is still a universal gate set. However, computing &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; requires polynomially many gates from &lt;span class=&quot;math-container&quot;&gt;$G'$&lt;/span&gt;, which would indicate &lt;span class=&quot;math-container&quot;&gt;$L\in\sf BQP$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This seems like a contradiction. Or more profoundly, the definition of &lt;span class=&quot;math-container&quot;&gt;$\sf BQP$&lt;/span&gt; seems to depend on the choice of the gate set. What exactly is going wrong here? And is &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; an element of &lt;span class=&quot;math-container&quot;&gt;$\sf BQP$&lt;/span&gt; or not?&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="2687" LastEditDate="2020-03-11T09:42:02.030" LastActivityDate="2020-03-11T09:42:02.030" Title="$\sf BQP$ and general $\mathrm{SU}(2^n)$ gates" Tags="&lt;quantum-gate&gt;&lt;bqp&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10138" PostTypeId="2" ParentId="10137" CreationDate="2020-03-09T12:22:54.713" Score="1" Body="&lt;p&gt;I think the issue here is that you've got to be careful with &lt;em&gt;families&lt;/em&gt; of circuits. If you're picking a single fixed gate from &lt;span class=&quot;math-container&quot;&gt;$SU(2^k)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, then that doesn't necessarily help you with &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, if you implicitly assumed that you had the circuit from &lt;span class=&quot;math-container&quot;&gt;$SU(2^n)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, 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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-09T12:22:54.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10139" PostTypeId="2" ParentId="10128" CreationDate="2020-03-09T12:30:10.293" Score="3" Body="&lt;p&gt;Well actually when looking at the source code, the construct_circuit method:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;h1&gt;quantum register where the sequential QFT is performed&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    self._up_qreg = QuantumRegister(2 * self._n, name='up')&#xA;    # quantum register where the multiplications are made&#xA;    self._down_qreg = QuantumRegister(self._n, name='down')&#xA;    # auxiliary quantum register used in addition and multiplication&#xA;    self._aux_qreg = QuantumRegister(self._n + 2, name='aux')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;They use indeed &lt;span class=&quot;math-container&quot;&gt;$4n + 2$&lt;/span&gt; qubits, so it seems they changed what was proposed in the paper. Some parts were simplified. Check the docstring in the &lt;a href=&quot;https://github.com/ttlion/ShorAlgQiskit/blob/master/Shor_Normal_QFT.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;original github repo&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-03-09T12:30:10.293" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10140" PostTypeId="2" ParentId="10127" CreationDate="2020-03-09T16:42:31.263" Score="2" Body="&lt;p&gt;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 !&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope it is as helpful as it was for me to develop it!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://colab.research.google.com/drive/13vxrg483JYVOCywA1xpYnyYnFwoViOEL#scrollTo=qjRWSk6BThju&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://colab.research.google.com/drive/13vxrg483JYVOCywA1xpYnyYnFwoViOEL#scrollTo=qjRWSk6BThju&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-03-09T16:48:18.597" LastActivityDate="2020-03-09T16:48:18.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10141" PostTypeId="1" CreationDate="2020-03-09T17:16:28.130" Score="2" ViewCount="74" Body="&lt;p&gt;I know this perhaps not a suitable topic for this SE - after all, this is about QC knowledge sharing - but &lt;strong&gt;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&lt;/strong&gt; - and would like to know the best way - &lt;strong&gt;for their current station in the physics/QC track/journey&lt;/strong&gt; - to approach/pursue the many opportunities there are out there. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="55" LastEditDate="2020-10-28T09:22:08.337" LastActivityDate="2020-10-28T09:22:08.337" Title="Guide for Quantum Information and Computing Internships and Learning Opportunities" Tags="&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-11-15T23:33:42.983" ContentLicense="CC BY-SA 4.0" />
  <row Id="10142" PostTypeId="1" AcceptedAnswerId="10143" CreationDate="2020-03-09T17:44:46.017" Score="2" ViewCount="70" Body="&lt;p&gt;What is the best mathematical representation of a quantum system that has some classical registers and some quantum registers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm asking because I'm considering any &quot;physical&quot; process &lt;span class=&quot;math-container&quot;&gt;$\pi()$&lt;/span&gt; that takes no input, but that outputs both &lt;strong&gt;classical&lt;/strong&gt; and quantum values, like for example a tuple &lt;span class=&quot;math-container&quot;&gt;$(x, \rho)$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt; a classical string, and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; a quantum state on &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits, and I'd like to find a kind of &lt;strong&gt;Kraus&lt;/strong&gt; representation of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to use the usual formalism of CPTP, but it's not clear in which Hilbert space lives &lt;span class=&quot;math-container&quot;&gt;$(x, \rho)$&lt;/span&gt;... Indeed, usually, a Hilbert space is stable by superposition, but here the first &quot;register&quot; cannot be in superposition. Of course, I could say that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is in fact &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and therefore the output of &lt;span class=&quot;math-container&quot;&gt;$\pi()$&lt;/span&gt; is strictly contained in a Hilbert space of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, but then &lt;span class=&quot;math-container&quot;&gt;$\pi()$&lt;/span&gt; is not simply &lt;span class=&quot;math-container&quot;&gt;$\sigma = \sum_i B_i 1 B_i^\dagger$&lt;/span&gt;, as I'd also need to &quot;measure&quot; &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; to extract a random &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and then set &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to be the matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; &quot;postselected&quot; on &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some better representation for such process that makes the difference between quantum outputs and classical outputs?&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="9006" LastEditDate="2020-03-10T05:12:43.470" LastActivityDate="2020-03-10T05:12:43.470" Title="CPTP, Kraus representation and classical registers" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;quantum-operation&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10143" PostTypeId="2" ParentId="10142" CreationDate="2020-03-09T18:47:46.467" Score="3" Body="&lt;p&gt;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.&lt;br&gt;&#xA;There are some generalizations, though, like this &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_instrument&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_instrument&lt;/a&gt;. But in essence the idea is the same as you've described &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; we model classical register with values &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as a quantum register with orthogonal states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. You can model a measurement in this way, for example. If &lt;span class=&quot;math-container&quot;&gt;$\sum_i B_iB_i^\dagger=I$&lt;/span&gt; describes a measurement, then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&#xA;is a corresponding quantum channel where the first quantum register of the output encodes the classical result &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and the second register contains the quantum state after the measurement.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-03-09T19:17:20.507" LastActivityDate="2020-03-09T19:17:20.507" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10144" PostTypeId="1" CreationDate="2020-03-09T21:41:06.977" Score="4" ViewCount="33" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-10-27T09:17:10.560" LastActivityDate="2020-10-27T09:17:10.560" Title="What are good resources for newcomers on entropy measurements?" Tags="&lt;resource-request&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10146" PostTypeId="2" ParentId="10134" CreationDate="2020-03-09T23:09:48.287" Score="1" Body="&lt;p&gt;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 &quot;quantum singular value transformations&quot; to objects that are known as &quot;block encodings&quot;, and it was invented by Gilyén et al. in 2018. The idea was originally introduced in &lt;a href=&quot;https://arxiv.org/abs/1711.00465&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, Appendix B, which builds on techniques from &lt;a href=&quot;https://arxiv.org/abs/1806.01838&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. Alternatively, you can have a look at &lt;a href=&quot;https://repository.tudelft.nl/islandora/object/uuid%3A26fe945f-f02e-4ef7-bdcb-0a2369eb867e&quot; rel=&quot;nofollow noreferrer&quot;&gt;this master's thesis&lt;/a&gt;, Circuit 6.2.5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It appears that there is a slight error in the statement of the latter reference, as the action of &lt;span class=&quot;math-container&quot;&gt;$Q_f$&lt;/span&gt; in the box referred to should actually be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, the action of &lt;span class=&quot;math-container&quot;&gt;$Q_2$&lt;/span&gt; further down in the box should be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the rest should be correct as stated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Keep in mind that the operation you wish to implement, i.e., the probability oracle of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, makes little sense whenever &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; takes negative values. Moreover, the square root that appears in the probability oracle behaves erratically close to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, so it makes sense to assume that the function values of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; are bounded away from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Gilyén et al. overcome this by assuming that the values of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; are contained in &lt;span class=&quot;math-container&quot;&gt;$(\delta,1-\delta)$&lt;/span&gt;. The latter reference essentially does the same thing, but overcomes it by assuming that &lt;span class=&quot;math-container&quot;&gt;$|f| \leq 1/2$&lt;/span&gt; and implementing the probability oracle of &lt;span class=&quot;math-container&quot;&gt;$\frac12 + \frac14f(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a final remark, note that the conversion you are after up to norm error &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; takes &lt;span class=&quot;math-container&quot;&gt;$O(\log(1/\varepsilon)^2)$&lt;/span&gt; queries to the phase oracle, which is surprisingly little compared to the number of queries &lt;span class=&quot;math-container&quot;&gt;$O(1/\varepsilon)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, which you subsequently postprocess to implement the probability oracle. This is a difficult task, as it requires learning the value of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; in the process (as you could measure after phase estimation to get a binary value of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;). The new techniques circumvent writing down such a binary representation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. This is why I like to call the new technique an instance of &lt;em&gt;analog computation&lt;/em&gt;, and I refer to subroutines that give you binary representations, like phase estimation, as instances of &lt;em&gt;digital computation&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="24" LastActivityDate="2020-03-09T23:09:48.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10147" PostTypeId="2" ParentId="10141" CreationDate="2020-03-10T08:50:08.703" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;Play &quot;Hello Quantum&quot; it is a game by IBM on App Store and&#xA;iTunes &lt;/li&gt;&#xA;&lt;li&gt;Sign up for IBM Q / Quantum Experience -&#xA;&lt;a href=&quot;https://www.ibm.com/quantum-computing/technology/experience&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/quantum-computing/technology/experience&lt;/a&gt; - when&#xA;you are there bookmark &lt;a href=&quot;http://qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://qiskit.org&lt;/a&gt; and&#xA;&lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/preface.html&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;Look for Blogs  especially Microsoft's and Jonathan Hui's blogs - they are fantastic!&#xA;&lt;a href=&quot;https://www.microsoft.com/en-us/quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.microsoft.com/en-us/quantum&lt;/a&gt; &lt;p&gt;&#xA;&lt;a href=&quot;https://medium.com/@jonathan_hui/qc-quantum-computing-series-10ddd7977abd&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/@jonathan_hui/qc-quantum-computing-series-10ddd7977abd&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Eventually make it a habit to look at papers in what interests you at arxiv.org if &#xA;Finance is what interests you - start with this paper &lt;a href=&quot;https://arxiv.org/abs/1807.03890&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1807.03890&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5175" LastActivityDate="2020-03-10T08:50:08.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10149" PostTypeId="2" ParentId="10058" CreationDate="2020-03-10T11:47:46.743" Score="2" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;scaling&quot; that the authors are referring to as giving a quadratic improvement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-10T11:47:46.743" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10150" PostTypeId="1" CreationDate="2020-03-10T13:01:02.683" Score="2" ViewCount="96" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10015" LastActivityDate="2020-11-20T16:29:38.460" Title="How to construct Control-Z with square root of swap?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10151" PostTypeId="1" CreationDate="2020-03-10T15:51:05.777" Score="3" ViewCount="35" Body="&lt;p&gt;Cloud IBMQ simulator &lt;em&gt;ibmq_qasm_simulator&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Could anybody provide me with this information (or link)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10336" LastEditorUserId="9006" LastEditDate="2020-03-10T19:24:29.947" LastActivityDate="2020-03-10T19:24:29.947" Title="How many cores and what processors are used in the cloud ibmq_qasm_simulator?" Tags="&lt;ibm-q-experience&gt;&lt;simulation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10152" PostTypeId="1" AcceptedAnswerId="10155" CreationDate="2020-03-10T16:25:18.327" Score="2" ViewCount="306" Body="&lt;p&gt;I'm using Qiskit and I have a Quantum Circuit (say, &lt;code&gt;circuit&lt;/code&gt;) that gives reasonable results when using the simulator, namely&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sim_backend = provider.get_backend('qasm_simulator')&#xA;job = execute(circuit, sim_backend, shots=shots)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, when switching to the true machine, namely&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;sim_backend = provider.get_backend('ibmq_16_melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm experiencing very noisy, meaningless results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Could someone tell me which Qiskit routine I could use to mitigate noise and how?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the comment by Davit Khachatryan and the answer by Martin Vesely, I have prepared the code below. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# --- Standard imports&#xA;&#xA;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;# Loading your IBM Q account(s)&#xA;provider = IBMQ.load_account()&#xA;&#xA;# --- Imports&#xA;from qiskit import QuantumCircuit, execute, BasicAer&#xA;from qiskit.tools.monitor import job_monitor&#xA;&#xA;import math&#xA;from numpy import linalg as LA&#xA;import numpy as np&#xA;#%config jupy = 'svg' # Makes the images look nice&#xA;&#xA;import time&#xA;&#xA;import matplotlib.pyplot as plt&#xA;&#xA;nBits    = 2&#xA;&#xA;shots    = 8192&#xA;&#xA;# --- Computation of the calibration matrix&#xA;&#xA;from qiskit.ignis.mitigation.measurement import (complete_meas_cal,CompleteMeasFitter)&#xA;from qiskit import *&#xA;&#xA;qr = QuantumRegister(2)&#xA;meas_calibs, state_labels = complete_meas_cal(qr=qr, circlabel='mcal')&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;job = execute(meas_calibs, backend=backend, shots=1000)&#xA;job_monitor(job, interval = 3)&#xA;cal_results = job.result()&#xA;&#xA;meas_fitter = CompleteMeasFitter(cal_results, state_labels, circlabel='mcal')&#xA;print(meas_fitter.cal_matrix)&#xA;&#xA;# --- Execution of the noisy quantum circuit&#xA;&#xA;qc = QuantumCircuit(nBits, nBits)&#xA;qc.x(1)&#xA;&#xA;qc.measure(qc.qregs[0], qc.cregs[0])&#xA;job = execute(qc, provider.get_backend('ibmq_16_melbourne'), shots = shots)&#xA;#job = execute(qc, BasicAer.get_backend('qasm_simulator'), shots = shots)&#xA;job_monitor(job, interval = 3)&#xA;result = job.result()&#xA;print(result.get_counts())&#xA;&#xA;# --- Error correction&#xA;&#xA;# Get the filter object&#xA;meas_filter = meas_fitter.filter&#xA;&#xA;# Results with mitigation&#xA;mitigated_results = meas_filter.apply(result)&#xA;mitigated_counts = mitigated_results.get_counts(0)&#xA;&#xA;print(mitigated_counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The noisy quantum circuit returns:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'00': 661, '11': 34, '10': 7494, '01': 3}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error mitigated noise circuit returns:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'00': 132.05699755089069, '11': 29.711709316932044, '01': 0.4405790117450936, '10': 8029.790714120432}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is that what I should expect?&lt;/p&gt;&#xA;" OwnerUserId="10032" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:45.147" LastActivityDate="2020-08-17T02:53:45.147" Title="Mitigating the noise in a quantum circuit" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;noise&gt;&lt;error-mitigation&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10153" PostTypeId="2" ParentId="10150" CreationDate="2020-03-10T17:38:53.163" Score="2" Body="&lt;p&gt;Found by just trying stuff in Quirk:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZJYkA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZJYkA.png&quot; alt=&quot;cz from sqrt swap&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-03-10T17:38:53.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10154" PostTypeId="1" CreationDate="2020-03-10T18:47:02.230" Score="1" ViewCount="70" Body="&lt;p&gt;I'm trying to find the steady-state of a master equation,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\dot{\rho}(t) = \mathcal{L}\rho(t),\tag{1}\label{1}$$&lt;/span&gt;&#xA;In the form where we vectorise the density matrix and matrixify (??) the Liouvillian super operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a vector representing a state, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; is the Liouvillian, a complex matrix describing the evolution, which is not necessarily symmetric and &lt;span class=&quot;math-container&quot;&gt;$\dot{\rho}$&lt;/span&gt; is the rate of change of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. To find the steady-state we need to set the LHS of the equation to 0 and solve for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;This is just the eigenvector problem, &lt;span class=&quot;math-container&quot;&gt;$(\mathcal{L}-\lambda\pmb{I})\rho=0$&lt;/span&gt; for the case where the eigenvalue, &lt;span class=&quot;math-container&quot;&gt;$\lambda=0$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In many systems I am studying the 0 eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; is diagonalizable). Qutip has the function &lt;code&gt;steadystate()&lt;/code&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\dot{\rho}=0$&lt;/span&gt; but this only produces a single solution and does not help me find a basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An alternative approach is to use the function &lt;code&gt;liouvillian()&lt;/code&gt; which given the same parameters as &lt;code&gt;steadystate()&lt;/code&gt; returns the Liouvillian, &lt;code&gt;L&lt;/code&gt;, of the system in matrix form. We can then use &lt;code&gt;L.eigenstate()&lt;/code&gt; 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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any advice on solving this problem would be much appreciated! Thanks.&lt;/p&gt;&#xA;" OwnerUserId="10338" LastActivityDate="2020-03-10T18:47:02.230" Title="Numerical methods for finding an eigen basis of a degenerate Liouvillian" Tags="&lt;programming&gt;&lt;density-matrix&gt;&lt;qutip&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10155" PostTypeId="2" ParentId="10152" CreationDate="2020-03-10T19:20:48.333" Score="2" Body="&lt;p&gt;&lt;strong&gt;I will provide some general comments concerning noise in quantum computers.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When quantum computers are in higher state of development, error correction will also be able to mitigate noise more effectively than nowadays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning the backend you use - &lt;em&gt;Melbourne&lt;/em&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-10T19:20:48.333" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10156" PostTypeId="1" AcceptedAnswerId="10163" CreationDate="2020-03-10T21:14:56.693" Score="2" ViewCount="36" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But how? A polarization filter that allows transmission of vertically-polarized photons will block horizontally-polarized photons and vice-versa, no?&#xA;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?&lt;/p&gt;&#xA;" OwnerUserId="10340" LastEditorUserId="9006" LastEditDate="2020-03-10T22:33:07.143" LastActivityDate="2020-03-12T09:00:53.667" Title="How does a rectilinear filter used for QKD-BB84 detect both horizontal and vertical polarizations?" Tags="&lt;cryptography&gt;&lt;bb84&gt;&lt;qkd&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10157" PostTypeId="1" CreationDate="2020-03-11T15:11:22.417" Score="2" ViewCount="37" Body="&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice_problem#Shortest_basis_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;shortest basis problem of lattices&lt;/a&gt; which is conjectured to be very hard.&lt;/p&gt;&#xA;" OwnerUserId="4312" LastActivityDate="2020-03-11T15:11:22.417" Title="Obtaining low weight stabilizer generators" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10158" PostTypeId="1" AcceptedAnswerId="10160" CreationDate="2020-03-11T15:56:11.550" Score="2" ViewCount="91" Body="&lt;p&gt;I have a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and a quantum state &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi \rangle$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U \vert \Psi \rangle = e^{i \theta} \vert \Psi \rangle.$$&lt;/span&gt;&#xA;I also know that my unitary matrix and my quantum state can be written as &lt;span class=&quot;math-container&quot;&gt;$U = U_1\otimes U_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi \rangle = \vert \Psi_1\rangle\otimes\vert\Psi_2\rangle$&lt;/span&gt; with matching dimensions (i.e. &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; acts on the Hilbert state &lt;span class=&quot;math-container&quot;&gt;$\vert\Psi_1\rangle$&lt;/span&gt; belongs to, same for &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert\Psi_2\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first equation then becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I deduce the 3 following assertions from my formula above?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U_1 \vert\Psi_1\rangle = e^{i\theta_1}\vert\Psi_1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U_2 \vert\Psi_2\rangle = e^{i\theta_2}\vert\Psi_2\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;with &lt;span class=&quot;math-container&quot;&gt;$\theta = \theta_1 + \theta_2 + 2k\pi$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The implication seems &quot;logical&quot; as we just separate &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; 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 &lt;a href=&quot;https://mathoverflow.net/questions/347383/eigenvectors-of-kronecker-product&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;strong&gt;Theorem&lt;/strong&gt;: Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; be two complex square matrices. If &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is an&#xA;  eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with corresponding eigenvector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; is an&#xA;  eigenvector of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; with corresponding eigenvector &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\lambda\mu$&lt;/span&gt; is an&#xA;  eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; with corresponding eigenvector &lt;span class=&quot;math-container&quot;&gt;$x\otimes y$&lt;/span&gt;. Moreover, every&#xA;  eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; arises as such a product.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;that does not fit with my problem (not the good implication and more oriented toward eigenvectors).&lt;/p&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="5870" LastEditDate="2020-03-11T17:40:21.917" LastActivityDate="2020-03-11T17:40:21.917" Title="Is kronecker product identifiable?" Tags="&lt;mathematics&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10159" PostTypeId="1" CreationDate="2020-03-11T16:37:51.523" Score="2" ViewCount="52" Body="&lt;p&gt;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. &lt;strong&gt;Does anybody know about such example?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9230" LastEditorUserId="55" LastEditDate="2020-10-27T09:15:57.727" LastActivityDate="2020-10-27T09:15:57.727" Title="Graphs are represented using oracle, where oracle is the adjacency matrix. Is there any simple example of this?" Tags="&lt;algorithm&gt;&lt;oracles&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2020-11-06T12:13:03.293" ContentLicense="CC BY-SA 4.0" />
  <row Id="10160" PostTypeId="2" ParentId="10158" CreationDate="2020-03-11T16:48:16.550" Score="3" Body="&lt;p&gt;Let's say I know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_1|\Psi_1\rangle\otimes U_2|\Psi_2\rangle=e^{i\theta}|\Psi_1\rangle\otimes|\Psi_2\rangle.&#xA;$$&lt;/span&gt;&#xA;Now, let's imagine that &lt;span class=&quot;math-container&quot;&gt;$U_1|\Psi_1\rangle=|\phi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_2|\Psi_2\rangle=|\phi_2\rangle$&lt;/span&gt;. So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_1\rangle\otimes |\phi_2\rangle=e^{i\theta}|\Psi_1\rangle\otimes|\Psi_2\rangle.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle\otimes |\phi_2\rangle$&lt;/span&gt;, and calculate the absolute value. You have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;1=|\langle\phi_1|\Psi_1\rangle|\ |\langle\phi_2|\Psi_2\rangle|.&#xA;$$&lt;/span&gt;&#xA;Both terms on the right-hand side satisfy &lt;span class=&quot;math-container&quot;&gt;$|\langle\phi_1|\Psi_1\rangle|\leq 1$&lt;/span&gt;, and can only achieve equality if &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle=e^{i\theta_i}|\Psi_i\rangle$&lt;/span&gt; (do you need a detailed proof of that? Think of real unit vectors &lt;span class=&quot;math-container&quot;&gt;$\underline{v},\underline{u}$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\underline{u}\cdot\underline{v}=\cos\gamma\leq 1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is the angle between them.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, we get overall equality if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\theta}=e^{i\theta_1}e^{i\theta_2},&#xA;$$&lt;/span&gt;&#xA;which is true provided&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta\equiv\theta_1+\theta_2\text{ mod }2\pi.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-11T16:48:16.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10161" PostTypeId="2" ParentId="10158" CreationDate="2020-03-11T17:28:03.783" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$H_1,H_2$&lt;/span&gt; be two Hilbert spaces and for unit vectors &lt;span class=&quot;math-container&quot;&gt;$u_1,v_1 \in H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$u_2,v_2 \in H_2$&lt;/span&gt; we have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;u_1 \otimes u_2 = v_1 \otimes v_2 \in H_1 \otimes H_2.&#xA;$$&lt;/span&gt;&#xA;Then it must be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;v_1 = \lambda u_1, ~~ v_2 = \frac{1}{\lambda} u_2,&#xA;$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\lambda \in \mathbb{C}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\lambda|=1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see why consider a scalar product&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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).&#xA;$$&lt;/span&gt; &#xA;Since &lt;span class=&quot;math-container&quot;&gt;$|(u_i,v_i)|\leq 1$&lt;/span&gt; it must be &lt;span class=&quot;math-container&quot;&gt;$|(u_i,v_i)|=1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1,2$&lt;/span&gt;. Hence &lt;span class=&quot;math-container&quot;&gt;$v_i = \lambda_i u_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\lambda_i|=1$&lt;/span&gt;. But &lt;span class=&quot;math-container&quot;&gt;$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)$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$\lambda_1\lambda_2=1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this you can deduce your 3 assertions, though DaftWullie essentially used this argument directly in his answer. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-03-11T17:33:05.503" LastActivityDate="2020-03-11T17:33:05.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10163" PostTypeId="2" ParentId="10156" CreationDate="2020-03-12T09:00:53.667" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-12T09:00:53.667" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10164" PostTypeId="1" AcceptedAnswerId="10165" CreationDate="2020-03-12T09:43:34.583" Score="1" ViewCount="59" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I have statements like the following - (&lt;code&gt;random_numbers&lt;/code&gt; were generated using QRNG in the circuits - not shown here)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;b = .6&#xA;a = .3&#xA;flt = []&#xA;&#xA;for rn_num in random_numbers:&#xA;     flt.append( b*(a-rn_num) + a * rn_num)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is unless it is related to a Quantum circuit - everything gets executed on a traditional machine (similar to print or sockets?)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there a document that explains this further? I read release notes - I found them a bit ambiguous. I found this comment in &lt;strong&gt;Aer 0.3&lt;/strong&gt; release note &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Increased performance with simulations that require less floating&#xA;  point numerical precision.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Maybe this note is referring to statevectors in floating point ...??&lt;/p&gt;&#xA;" OwnerUserId="5175" LastEditorUserId="5955" LastEditDate="2020-03-12T11:30:29.030" LastActivityDate="2020-03-12T11:30:29.030" Title="In Qiskit, where is the floating point operation performed?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10165" PostTypeId="2" ParentId="10164" CreationDate="2020-03-12T09:54:16.360" Score="2" Body="&lt;p&gt;The Qiskit backends (quantum devices or simulators) work only when you explicitly invoke them, usually with &lt;code&gt;execute&lt;/code&gt;. The code in your snippet does not call &lt;code&gt;qiskit&lt;/code&gt;, and runs on a traditional machine.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-03-12T09:54:16.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10166" PostTypeId="1" CreationDate="2020-03-12T15:44:26.803" Score="2" ViewCount="71" Body="&lt;p&gt;On wikipedia, the article on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement#Reduced_density_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum entanglement&lt;/a&gt; gives an example of the computation of a reduced density matrix. I would like to understand precisely what's going on with the computation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First the context. We consider two systems A and B respectively belonging to Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt;.&#xA;We consider the state of the composite system &lt;span class=&quot;math-container&quot;&gt;$| \Psi\rangle \in \mathcal{H}_A \otimes\mathcal{H}_B$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are interested by the reduced density matrix on the subsystem A, given by the following formula :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = \sum_j \langle j |_B ( | \Psi\rangle \langle\Psi| ) |j\rangle_B $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the article gives the following example . Consider the entangled state :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \Psi \rangle =\frac{1}{\sqrt{2}} ( |0\rangle_A |1\rangle_B - |1\rangle_A |0\rangle_B   ) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the article says that the reduced density of A is then :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = \frac{1}{2} (|0\rangle_A \langle 0|_A + |1\rangle_A \langle 1|_A)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wanted to compute it myself using the definition above but I'm having trouble with it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The term &lt;span class=&quot;math-container&quot;&gt;$| \Psi\rangle \langle\Psi|$&lt;/span&gt; makes sense to me :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \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  ) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;but then let's consider the first term of the sum in the definition of the reduced density matrix : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \langle 0|_B | \Psi\rangle \langle\Psi|  |0\rangle_B  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we then have term such as &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle 0|_B |0\rangle_A $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and I can't make sense of it. If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A = \mathcal{H}_B$&lt;/span&gt; it's the inner product on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; but here I'm confused. Dropping the subscripts I have :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \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|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here there is this minus sign that is not in the given answer of Wikipedia plus I &quot;lost&quot; the information on the states.&#xA;Could you help me doing the computation correctly ? &lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="9006" LastEditDate="2020-03-12T20:43:00.890" LastActivityDate="2020-03-12T20:43:00.890" Title="Computation of a reduced density matrix" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10168" PostTypeId="1" AcceptedAnswerId="10170" CreationDate="2020-03-12T15:58:35.200" Score="1" ViewCount="61" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For one, I am ambivalent - with the scarcity of quantum algorithms, I am leaning towards &quot;&lt;em&gt;a solution looking for a problem&lt;/em&gt;&quot; .&lt;/p&gt;&#xA;" OwnerUserId="166" LastEditorUserId="9006" LastEditDate="2020-03-12T20:41:40.763" LastActivityDate="2020-03-12T22:36:18.340" Title="Like blockchains, other than the few quantum algorithms available out there, are quantum computers/algorithms a solution looking for a problem?" Tags="&lt;algorithm&gt;&lt;cryptography&gt;&lt;cryptocurrency&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-03-17T20:30:09.343" ContentLicense="CC BY-SA 4.0" />
  <row Id="10169" PostTypeId="2" ParentId="10166" CreationDate="2020-03-12T16:28:34.917" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A \neq \mathcal{H}_B$&lt;/span&gt;, they are two distinct physical systems (even if they have the same dimension). &lt;/li&gt;&#xA;&lt;li&gt;That formula for a reduced density matrix is a shortcut for &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&#xA;You can check the dimensions. If &lt;span class=&quot;math-container&quot;&gt;$d_A = \text{dim}H_A, d_B = \text{dim}H_B$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\langle j |_B$&lt;/span&gt; has size &lt;span class=&quot;math-container&quot;&gt;$1 \times d_B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| \Psi\rangle$&lt;/span&gt; has size &lt;span class=&quot;math-container&quot;&gt;$d_Ad_B \times 1$&lt;/span&gt;. You can't multiply &lt;span class=&quot;math-container&quot;&gt;$1 \times d_B$&lt;/span&gt; sized matrix on a &lt;span class=&quot;math-container&quot;&gt;$d_Ad_B \times 1$&lt;/span&gt; sized matrix. But &lt;span class=&quot;math-container&quot;&gt;$I_A \otimes \langle j |_B$&lt;/span&gt; has size &lt;span class=&quot;math-container&quot;&gt;$d_A \times d_Ad_B$&lt;/span&gt;, so it fits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;So, for example, you can compute &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-03-12T16:28:34.917" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10170" PostTypeId="2" ParentId="10168" CreationDate="2020-03-12T22:36:18.340" Score="2" Body="&lt;p&gt;I disagree. By no means is there a scarcity of quantum algorithms. Consider for example &lt;a href=&quot;https://arxiv.org/abs/1611.09347&quot; rel=&quot;nofollow noreferrer&quot;&gt;this review on Quantum Machine Learning&lt;/a&gt;. Therein the term &lt;em&gt;qBLAS&lt;/em&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the present &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;nofollow noreferrer&quot;&gt;NISQ era&lt;/a&gt;, we are indeed in a place where one &lt;em&gt;can&lt;/em&gt; say that quantum computers are a &quot;solution looking for a problem&quot;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today's quantum computers can already &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;outperform classical computers in very artifical and useless tasks&lt;/a&gt;. But people still hope that we can use those devices to do useful stuff. One major candidate are &lt;a href=&quot;https://arxiv.org/abs/1509.04279&quot; rel=&quot;nofollow noreferrer&quot;&gt;hybrid approaches&lt;/a&gt; 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 &lt;em&gt;better&lt;/em&gt; than classical methods yet. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So while quantum computers in general are not a solution looking for a problem, today's NISQ devices, in a way, are.&lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2020-03-12T22:36:18.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10171" PostTypeId="2" ParentId="6399" CreationDate="2020-03-13T00:05:19.877" Score="1" Body="&lt;p&gt;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 at how the phases look like in the following images:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WvMIe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WvMIe.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TpMZT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TpMZT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a way you can workaround this if you separate your input and output registers but this means you need twice as many qubits :) Then you can do something like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VNdSw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VNdSw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quirk &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22QFT4%22],[1,1,1,%22H%22],[%7B%22id%22:%22Z%5Eft%22,%22arg%22:%22-1/8%22%7D,%22Z%5E-%C2%BC%22,%22Z%5E-%C2%BD%22,%22%E2%80%A2%22],[1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,%22H%22],[%22Z%5E-%C2%BC%22,%22Z%5E-%C2%BD%22,%22%E2%80%A2%22],[1,1,%22%E2%80%A2%22,1,1,%22X%22],[1,%22H%22],[%22Z%5E-%C2%BD%22,%22%E2%80%A2%22],[1,%22%E2%80%A2%22,1,1,1,1,%22X%22],[%22H%22],[%22%E2%80%A2%22,1,1,1,1,1,1,%22X%22],[%22Amps4%22,1,1,1,%22Amps4%22]],%22init%22:[1,1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; so you can play with it yourself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: some people mix up the invQFT with the QFT and so I myself I'm a bit lost but it should be failry straight forward to adapt this technique to Nielsen's circuit I think.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here a video where you can see my mental process and how I got to this idea while exploring the QFT myself: &lt;a href=&quot;https://youtu.be/HlMuFqZ9cSE?t=1158&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/HlMuFqZ9cSE?t=1158&lt;/a&gt; (minute 19:18)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this was helpful! :)&lt;/p&gt;&#xA;" OwnerUserId="7322" LastEditorUserId="7322" LastEditDate="2020-03-13T00:11:32.440" LastActivityDate="2020-03-13T00:11:32.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10172" PostTypeId="1" CreationDate="2020-03-13T02:31:07.697" Score="2" ViewCount="386" Body="&lt;p&gt;Is my understanding correct that in &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/tutorial.html#background-variational-quantum-algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, and substitute the values into the classical expression?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But if we added a term like &lt;span class=&quot;math-container&quot;&gt;$X_1 Y_2$&lt;/span&gt;, we would have to double the number of runs, right?&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="491" LastEditDate="2020-08-29T19:00:53.083" LastActivityDate="2021-05-26T21:01:50.153" Title="VQE Cirq example" Tags="&lt;measurement&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;cirq&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10173" PostTypeId="2" ParentId="10172" CreationDate="2020-03-13T03:38:32.473" Score="0" Body="&lt;p&gt;If we have prepared an arbitrary anzats/trial two-qubit state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\psi = a |00\rangle + b |01\rangle+ c |10\rangle+ d |11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle H \rangle = \alpha_1 \langle Z_1 Z_2 \rangle + \alpha_2 \langle Z_1 \rangle + \alpha_3 \langle Z_2 \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\langle Z_1 Z_2 \rangle = |a|^2 - |b|^2 - |c|^2 + |d|^2 \\&#xA;\langle Z_2 \rangle = |a|^2 - |b|^2 + |c|^2 - |d|^2 \\&#xA;\langle Z_1 \rangle = |a|^2 + |b|^2 - |c|^2 - |d|^2&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, just by performing measurements in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis will give you all the expectation values for the given &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, because by these measurements we will obtain all the probabilities (&lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|b|^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|c|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|d|^2$&lt;/span&gt;). More about these calculations can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9026/9459&quot;&gt;answer&lt;/a&gt;. If there are other terms like &lt;span class=&quot;math-container&quot;&gt;$X_1 Y_2$&lt;/span&gt; one should measure also in different basis (for more info here is my Qiskit tutorial on &lt;a href=&quot;https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/variational_quantum_eigensolver.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE&lt;/a&gt;, where at the end a procedure for finding the expectation value of &lt;span class=&quot;math-container&quot;&gt;$X_1 Y_2$&lt;/span&gt; Pauli term is described).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt; (page 77) about the common orthonormal basis of two commuting Hermitian matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Theorem 2.2&lt;/strong&gt;: (Simultaneous diagonalization theorem) Suppose &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are Hermitian operators. Then &lt;span class=&quot;math-container&quot;&gt;$[A, B] = 0$&lt;/span&gt; if and only if there exists an orthonormal basis such that both &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are diagonal with respect to that basis. We say that A and B are simultaneously diagonalizable in this case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I haven't read the Cirq's implementation, so maybe there will be a better answer.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-01T13:00:48.643" LastActivityDate="2020-04-01T13:00:48.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10174" PostTypeId="1" CreationDate="2020-03-13T14:30:41.523" Score="2" ViewCount="112" Body="&lt;p&gt;I have a state &lt;code&gt;psi&lt;/code&gt; as an ndarray of shape (&lt;code&gt;2 ** 3&lt;/code&gt;,) s.t. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;psi[0]= amplitude of 000&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;psi[1] = amplitude of 001.&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as qt&#xA;from qiskit.aqua.circuits import FourierTransformCircuits as QFT&#xA;&#xA;    circuit = qt.QuantumCircuit(3)&#xA;    circuit.initialize( psi, [i for i in reversed(circuit.qubits)])&#xA;&#xA;    QFT.construct_circuit(circuit=circuit, qubits=circuit.qubits[:2], inverse=True)&#xA;&#xA;    backend = qt.Aer.get_backend('statevector_simulator')&#xA;    final_state = qt.execute(circuit, backend, shots=1).result().get_statevector()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From the tests I've run, &lt;code&gt;final_state&lt;/code&gt; is not what I expected: defining &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;exact = np.kron(IQFT_matrix(2),np.eye(2)).dot(state)&lt;/code&gt; with IQFT_matrix(2)= IQFT_matrix for 2 qubits.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;np.testing.assert_array_almost_equal(final_state, exact)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;fails. Can you please help me find the problem?&lt;/p&gt;&#xA;" OwnerUserId="10356" LastEditorUserId="55" LastEditDate="2020-08-12T08:33:25.920" LastActivityDate="2021-05-09T10:07:40.827" Title="qiskit: IQFT acting on subsystem of reversed-ordered qubits state" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10175" PostTypeId="1" AcceptedAnswerId="10183" CreationDate="2020-03-13T14:45:02.853" Score="9" ViewCount="267" Body="&lt;p&gt;I have two question concerning information content of qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1: How many classical bits are needed to represent a qubit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A qubit can be represented by a vector &lt;span class=&quot;math-container&quot;&gt;$q = \begin{pmatrix}\alpha \\\beta \end{pmatrix}, ~~ \alpha, \beta \in \mathbb{C}$&lt;/span&gt;. So, we need four real numbers to represent it. But when facts that (i) &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2 = 1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; or Bloch sphere angles) which influence number of classical bits needed to described the qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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?&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2: What is an (&lt;em&gt;effective&lt;/em&gt;) information content of qubit:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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 &quot;continuous&quot; (i.e. described by complex numbers &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;)?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-10-27T09:14:34.850" LastActivityDate="2020-10-27T09:14:34.850" Title="How many classical bits are needed to represent a qubit?" Tags="&lt;bloch-sphere&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10176" PostTypeId="2" ParentId="10174" CreationDate="2020-03-13T15:16:28.990" Score="0" Body="&lt;p&gt;There is the parameter &lt;code&gt;do_swaps&lt;/code&gt; when you construct the fourier transform circuit.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;do_swaps (bool): Boolean flag to specify if swaps should be included to align&#xA;                 the qubit order of input and output. The output qubits would&#xA;                 be in reversed order without the swaps.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-03-13T15:16:28.990" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10177" PostTypeId="1" CreationDate="2020-03-13T15:55:49.110" Score="2" ViewCount="25" Body="&lt;p&gt;The paper, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0007035&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum deletion is possible via a partial randomization procedure&lt;/a&gt; claims that it is possible to bypass the no-deleting theorem by a procedure called R-deletion. But this seems to go against the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9911090&quot; rel=&quot;nofollow noreferrer&quot;&gt;original no-deleting theorem&lt;/a&gt;. If not, why so? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And doesn't the following line from the first paper actually convey a swapping operation which has been categorically excluded by Pati and Braunstein?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|A_\psi\rangle= \alpha|A_H\rangle +\beta|A_V\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4235" LastEditorUserId="55" LastEditDate="2020-10-28T09:22:03.133" LastActivityDate="2020-10-28T09:22:03.133" Title="Is quantum deletion via a partial randomization procedure possible?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10178" PostTypeId="2" ParentId="10152" CreationDate="2020-03-13T18:32:38.213" Score="1" Body="&lt;p&gt;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 [&lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.8.031027&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] paper: two quantum error mitigation (QEM) techniques have been introduced recently,&#xA;namely, error extrapolation  (proposed by Y. Li and S. C. Benjamin [&lt;a href=&quot;https://doi.org/10.1103/PhysRevX.7.021050&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;] and K. Temme et al [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.119.180509&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;]) and quasiprobability decomposition (proposed by K. Temme et al [&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.119.180509&quot; rel=&quot;nofollow noreferrer&quot;&gt;3&lt;/a&gt;]). How I understand, this Qiskit &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; is an implementation of the second technique. The tutorial is written very nicely and intuitively, so I highly recommend it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I will try to explain the first technique: error extrapolation. We want to estimate something from our circuit, let's call it &lt;span class=&quot;math-container&quot;&gt;$E^*$&lt;/span&gt; (can be the expectation value of Hamiltonian or something else). Because of noise we always obtain a different value than &lt;span class=&quot;math-container&quot;&gt;$E^*$&lt;/span&gt;. Suppose we have a &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; parameter (in this experimental paper [&lt;a href=&quot;https://doi.org/10.1038/s41586-019-1040-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;4&lt;/a&gt;] 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 &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;. This give us different values for &lt;span class=&quot;math-container&quot;&gt;$E(\lambda)$&lt;/span&gt; from which we will be able to construct the following system of equations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{cases} &#xA;E(\lambda_1) = E^* + Noise(\lambda_1) &#xA;\\ &#xA;E(\lambda_2) = E^* + Noise(\lambda_2) &#xA;\\ &#xA;E(\lambda_3) = E^* + Noise(\lambda_3) &#xA;\\&#xA;...&#xA;\end{cases}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By expressing the &lt;span class=&quot;math-container&quot;&gt;$Noise(\lambda)$&lt;/span&gt; with some suitable function (e.g. a polynomial function) one can solve the system of equation and find the desired &lt;span class=&quot;math-container&quot;&gt;$E^*$&lt;/span&gt; value &quot;without&quot; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 [&lt;a href=&quot;https://doi.org/10.1038/s41586-019-1040-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;4&lt;/a&gt;] paper).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-13T18:46:46.357" LastActivityDate="2020-03-13T18:46:46.357" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10179" PostTypeId="1" AcceptedAnswerId="10180" CreationDate="2020-03-13T18:44:30.337" Score="4" ViewCount="435" Body="&lt;p&gt;I'm trying to replicate with qiskit the results of &lt;a href=&quot;https://arxiv.org/pdf/1904.05803.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;In the picture that shows the general circuit for QPE, some multi-target controlled-U gates are shown:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wSlFV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wSlFV.png&quot; alt=&quot;The image in the paper showing the general circuit for QPE&quot;&gt;&lt;/a&gt;&#xA;In the 2x2 case this can be made using simple &lt;em&gt;cU3&lt;/em&gt; gates repeated several times as shown in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9375/cannot-replicate-results-in-article-on-pricing-financial-derivatives-on-ibm-q&quot;&gt;this&lt;/a&gt; answer, where the parameters &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi, \lambda$&lt;/span&gt; that are needed for the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.cu3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;cU3&lt;/em&gt;&lt;/a&gt; gate are calculated using the qiskit function &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.euler_angles_1q.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;euler_angles_1q&lt;/a&gt; directly from the &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i\rho}$&lt;/span&gt; 2x2 matrix where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the normalized covariance matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho=\frac{\sigma}{tr(\sigma)}$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is the 2x2 covariance matrix for which we want to find the eigenvalues and the eigenvectors)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But for the 4x4 case they provide a circuit that does the phase kickback with several U3 gates&#xA;&lt;a href=&quot;https://i.stack.imgur.com/B33hw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B33hw.png&quot; alt=&quot;pca quantum circuit 4x4&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;My question is:&lt;/h2&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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? &lt;/li&gt;&#xA;&lt;li&gt;Is it possible to decompose a multi-target &lt;em&gt;cU3&lt;/em&gt; gate using only 2 single target &lt;em&gt;cU3&lt;/em&gt; gates?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10352" LastActivityDate="2020-03-14T11:59:43.713" Title="How to decompose a multi-target controlled gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10180" PostTypeId="2" ParentId="10179" CreationDate="2020-03-13T19:40:20.557" Score="2" Body="&lt;p&gt;An example of constructing (with help of Qiskit) a controlled version of some simple 4x4 unitary matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{pmatrix}&#xA;\mathrm{e}^{i g_1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i g_2} &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i g_3} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i g_4} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$g_s$&lt;/span&gt; are some given constants. It can be shown that this corresponds to the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;g_1 = 1.2&#xA;g_2 = 1.5&#xA;g_3 = 0.7&#xA;g_4 = -0.9&#xA;&#xA;q = QuantumRegister(2, &quot;q&quot;)&#xA;circuit = QuantumCircuit(q)&#xA;&#xA;circuit.cu1(g_4, q[0], q[1])&#xA;circuit.x(q[1])&#xA;circuit.cu1(g_3, q[0], q[1])&#xA;circuit.x(q[0])&#xA;circuit.cu1(g_1, q[0], q[1])&#xA;circuit.x(q[1])&#xA;circuit.cu1(g_2, q[0], q[1])&#xA;circuit.x(q[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to obtain the controlled version of the circuit we will use Qiskit's &lt;code&gt;get_controlled_circuit()&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit&#xA;&#xA;control_qubit = QuantumRegister(1, &quot;a&quot;)&#xA;controlled_circuit = QuantumCircuit(q, control_qubit)&#xA;&#xA;controlled_circuit = get_controlled_circuit(circuit, control_qubit[0])&#xA;print(controlled_circuit.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How I understand the steps of the &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/utils/controlled_circuit.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;get_controlled_circuit()&lt;/code&gt;&lt;/a&gt; method: &#xA;1) it takes your given circuit &#xA;2) changes your gates to Qiskit's basis gates (u1, u2, u3, cx). &#xA;3) for each given basis gate it modifies and replaces it with the controlled version of it (it has a &quot;dictionary of methods&quot; that implements the controlled circuits for all basis gates).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, to sum up. Firstly one needs to decompose the given &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operator into gates, then for each gate construct the controlled version of it. In other words, if one has a circuit &lt;code&gt;gate_1 gate_2 gate_3&lt;/code&gt;, the controlled version of it will look like this &lt;code&gt;controlled_gate_1 controlled_gate_2 controlled_gate_3&lt;/code&gt;. If the control qubit is in the &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt; state all gates will be executed, and if it is in the &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt; state nothing will happen (as is expected by definition of the control operations). And if you want to implement a controlled version of &lt;span class=&quot;math-container&quot;&gt;$U^n$&lt;/span&gt; operator, you can just apply &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; circuits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Final Notes&lt;/strong&gt;: 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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; operator expressed by a sum of Pauli product terms and the problem is to simulate &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt; unitary operator to estimate the phase &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;, from &lt;span class=&quot;math-container&quot;&gt;$e^{iHt} | \psi \rangle = e^{iEt} | \psi \rangle = e^{i 2 \pi \varphi} | \psi \rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; is some eigenstate of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is given in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = P_1 + P_2 + P_3 + P_3$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_s$&lt;/span&gt; are the Pauli terms (like &lt;span class=&quot;math-container&quot;&gt;$X \otimes Y \otimes Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Y$&lt;/span&gt;). Simulation of the &lt;span class=&quot;math-container&quot;&gt;$e^{i P t}$&lt;/span&gt; for a given &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; Pauli term can be done as described in J.D. Whitfield et al [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] 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 [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] paper).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-14T11:59:43.713" LastActivityDate="2020-03-14T11:59:43.713" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10181" PostTypeId="1" CreationDate="2020-03-13T21:29:18.953" Score="2" ViewCount="156" Body="&lt;p&gt;I'm performing QFT using the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import *&#xA;from qiskit.tools.monitor import job_monitor&#xA;provider = IBMQ.load_account()&#xA;&#xA;# --- Imports&#xA;from numpy import linalg as LA&#xA;import numpy as np&#xA;&#xA;&#xA;def qftA(circ, n):&#xA;    &quot;&quot;&quot;n-qubit QFT on the qubits in circ.&quot;&quot;&quot;&#xA;    for k in range(n):&#xA;        j = n - k&#xA;        circ.h(j - 1)&#xA;        for i in reversed(range(j - 1)):&#xA;            circ.cu1(2 * pi / 2**(j - i), i, j - 1)&#xA;    for i in range(n//2):&#xA;        circuit.swap(i, n - i - 1)&#xA;&#xA;# --- Parameters&#xA;nBits    = 2&#xA;shots    = 8192&#xA;pi       = np.pi&#xA;&#xA;# --- Input data&#xA;&#xA;# --- Defining the array coefficients&#xA;coefficients = [0., 1., 3., 1.]&#xA;coefficients = coefficients / LA.norm(coefficients)&#xA;&#xA;# --- Defining the quantum circuit&#xA;circuit = QuantumCircuit(nBits, nBits, name = &quot;Quantum circuit&quot;)&#xA;&#xA;# --- Quantum circuit initialization&#xA;circuit.initialize(coefficients, range(nBits))&#xA;&#xA;# next, do a qft&#xA;qftA(circuit, nBits)&#xA;circuit.measure(range(nBits), range(nBits))&#xA;&#xA;#sim_backend = provider.get_backend('ibmq_16_melbourne')&#xA;#sim_backend = provider.get_backend('ibmq_vigo')&#xA;#sim_backend = provider.get_backend('ibmq_essex')&#xA;sim_backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;job = execute(circuit, sim_backend, shots=shots)&#xA;job_monitor(job, interval = 3)&#xA;result = job.result().get_counts()&#xA;&#xA;print(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have performed a comparison between the simulator and machine results:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;QASM SIMULATOR&#xA;{'00': 4648, '01': 1680, '10': 169, '11': 1695}&#xA;&#xA;MELBOURNE&#xA;{'00': 3850, '01': 2180, '10': 508, '11': 1654}&#xA;&#xA;VIGO&#xA;{'00': 4757, '01': 1937, '10': 308, '11': 1190}&#xA;&#xA;ESSEX&#xA;{'00': 4251, '01': 1495, '10': 883, 11': 1563}&#xA;&#xA;LONDON&#xA;{'00': 4280, '01': 1332, '10': 608, '11': 1972}&#xA;&#xA;BURLINGTON&#xA;{'00': 2880, '01': 1638, '10': 1745, '11': 1929}&#xA;&#xA;IBMQX2&#xA;{'00': 4425, '01': 1381, '10': 763, '11': 1623}&#xA;&#xA;OURENSE&#xA;{'00': 4922, '01': 1766, '10': 353, '11': 1151}&#xA;&#xA;&#xA;ARMONK&#xA;single qubit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So, depending on what I use I obtain different results. Could someone tell me why and suggest remedies?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&#xA;I have removed the swap at the end of the circuit, as suggested by Davit Khachatrya, and these are the results I achieve&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qasm_simulator&#xA;{'00': 4639, '10': 1651, '01': 201, '11': 1701}&#xA;&#xA;ibmq_16_melbourne&#xA;{'00': 4210, '10': 1828, '01': 531, '11': 1623}&#xA;&#xA;ibmq_vigo&#xA;{'00': 4676, '10': 1697, '01': 406, '11': 1413}&#xA;&#xA;ibmq_essex&#xA;{'00': 4013, '10': 1462, '01': 1010, '11': 1707}&#xA;&#xA;ibmq_london&#xA;{'00': 4341, '10': 1565, '01': 678, '11': 1608}&#xA;&#xA;ibmq_burlington&#xA;{'00': 3798, '10': 1376, '01': 1770, '11': 1248}&#xA;&#xA;ibmqx2&#xA;{'00': 4281, '10': 1481, '01': 621, '11': 1809}&#xA;&#xA;ibmq_ourense&#xA;{'00': 4533, '10': 2037, '01': 293, '11': 1329}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My feeling is that I have now less noisy results.&lt;/p&gt;&#xA;" OwnerUserId="10032" LastEditorUserId="10032" LastEditDate="2020-03-19T08:44:27.863" LastActivityDate="2020-03-19T08:44:27.863" Title="Different QFT results when using Simulator or Quantum Machine" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="12" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10182" PostTypeId="2" ParentId="10175" CreationDate="2020-03-14T05:15:54.733" Score="3" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1867" LastActivityDate="2020-03-14T05:15:54.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10183" PostTypeId="2" ParentId="10175" CreationDate="2020-03-14T06:14:20.887" Score="6" Body="&lt;p&gt;There are two types of information in physics:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Classical information&lt;/li&gt;&#xA;&lt;li&gt;Quantum information&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Physics doesn't answer the question &quot;What is (classical or quantum) information?&quot;. This is philosophic question, and physics never answers questions of this kind. Instead, physics answers another question &quot;How (classical or quantum) information is measured?&quot;. The answer is trivial:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Classical information is measured in bits&lt;/li&gt;&#xA;&lt;li&gt;Quantum information is measured in qubits&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;&quot;effective information&quot;&lt;/em&gt; and don't ask vague questions like &lt;em&gt;&quot;What is an (effective) information content of qubit&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we come to the question: How these two types of information are related?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another question: how many bits can be transmitted by transmitting one qubit?. Here we have 2 fundamental results: &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;noreferrer&quot;&gt;Holevo theorem&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding&quot; rel=&quot;noreferrer&quot;&gt;Superdense coding&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-03-14T06:48:56.400" LastActivityDate="2020-03-14T06:48:56.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10185" PostTypeId="1" AcceptedAnswerId="10201" CreationDate="2020-03-14T12:05:24.900" Score="2" ViewCount="67" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="5955" LastEditDate="2020-03-14T12:32:30.690" LastActivityDate="2020-03-16T10:19:37.577" Title="Constructing an eigenbasis of graph states for a set of stabilizers" Tags="&lt;graph-states&gt;&lt;stabilizer-state&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10186" PostTypeId="1" AcceptedAnswerId="10188" CreationDate="2020-03-14T12:06:08.600" Score="4" ViewCount="1092" Body="&lt;p&gt;I have a little difficulty with understanding. How do I properly visualize the change of qubit's basis as a rotation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say that we have classical basis vectors, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Now, we can change this basis into the &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt; one by applying a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard&lt;/a&gt; gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H|0\rangle = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -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, $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H|1\rangle = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -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. $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some analogy between the Hadamard gate and classical rotation matrix, which can be defined as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R(\theta) = \begin{bmatrix} \cos \theta &amp;amp; -sin \theta \\ \sin \theta &amp;amp; \cos \theta \end{bmatrix},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for a rotation in the counterclockwise direction by the angle of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think that my problem lies in viewing the vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as two perpendicular vectors on a plane of real numbers. But, we are dealing with two vectors of &lt;strong&gt;complex&lt;/strong&gt; numbers, so I guess we shouldn't think of them in this way, but rather than that, use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="2105" LastEditDate="2020-03-15T20:06:27.570" LastActivityDate="2020-03-15T20:06:27.570" Title="How should I understand the change of qubit's basis as a rotation?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;unitarity&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10187" PostTypeId="2" ParentId="10186" CreationDate="2020-03-14T12:45:21.810" Score="1" Body="&lt;p&gt;The first postulate of quantum mechanics that can be found in the M. Nielsen and I. Chuang &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Postulate 1&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, If one has some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha |0\rangle + \alpha |1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$&lt;/span&gt;, it can be described as a vector in the Hilbert space with &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; complex coordinates. Because of normalization &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;, the length of that vector is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. When we apply a unitary operator the length doesn't change (still &lt;span class=&quot;math-container&quot;&gt;$|\alpha'|^2 + |\beta'|^2 = 1$&lt;/span&gt;). 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt;). 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.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-14T18:34:18.553" LastActivityDate="2020-03-14T18:34:18.553" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10188" PostTypeId="2" ParentId="10186" CreationDate="2020-03-14T13:32:18.560" Score="5" Body="&lt;p&gt;Hadamard gate can be interpreted as a rotation in 3D Euclidean space (on Bloch sphere) by angle &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; around X+Z axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The qubit rotation by angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; around axis pointed by unit vector &lt;span class=&quot;math-container&quot;&gt;$\textbf{n}=\{n_x,n_y,n_z\}$&lt;/span&gt; is described by rotation operator (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are Pauli matrices)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;R_{\textbf{n}}(\theta)=&amp;amp;n_xe^{-i\frac{\theta}{2}X}+n_ye^{-i\frac{\theta}{2}Y}+n_ze^{-i\frac{\theta}{2}Z}=\\&#xA;=&amp;amp;\begin{pmatrix}&#xA;\cos\frac{\theta}{2}-in_z\sin\frac{\theta}{2}&amp;amp;(-in_x-n_y)\sin\frac{\theta}{2}\\&#xA;(-in_x+n_y)\sin\frac{\theta}{2}&amp;amp;\cos\frac{\theta}{2}+in_z\sin\frac{\theta}{2}&#xA;\end{pmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;If we choose &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\textbf{n}=\{\frac{1}{\sqrt{2}},0,\frac{1}{\sqrt{2}}\}$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;R_{\textbf{n}}(\pi)=&amp;amp;\begin{pmatrix}&#xA;-\frac{i}{\sqrt{2}}&amp;amp;-\frac{i}{\sqrt{2}}\\&#xA;-\frac{i}{\sqrt{2}}&amp;amp;\frac{i}{\sqrt{2}}&#xA;\end{pmatrix}=-\frac{i}{\sqrt{2}}\begin{pmatrix}&#xA;1&amp;amp;1\\&#xA;1&amp;amp;-1&#xA;\end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which coincides with Hadamard gate up to the global phase &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-03-15T20:03:13.293" LastActivityDate="2020-03-15T20:03:13.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10189" PostTypeId="1" CreationDate="2020-03-14T14:10:54.360" Score="2" ViewCount="136" Body="&lt;p&gt;Seeing a state of qubit is too complicated in Cirq&#xA;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit = cirq.Circuit()&#xA;msg, R, S = cirq.LineQubit.range(3)&#xA;&#xA;circuit.append([cirq.H(R),cirq.CNOT(R, S)])&#xA;&#xA;print(R.state)&#xA;&quot;R = 0.12|0&amp;gt;+0.58|1&amp;gt;&quot;&#xA;or&#xA;&quot;(0.12,0.58)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is there anyway to do this?&lt;/p&gt;&#xA;" OwnerUserId="10364" LastEditorUserId="5955" LastEditDate="2020-03-14T14:20:36.150" LastActivityDate="2020-03-14T18:20:35.250" Title="Cirq - Print state of qubit" Tags="&lt;quantum-state&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10190" PostTypeId="1" CreationDate="2020-03-14T16:33:12.633" Score="1" ViewCount="78" Body="&lt;p&gt;Can someone help me in understanding the program on the link given below?&#xA;I would really appreciate if someone could give a detailed explanation ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="10365" LastEditorUserId="5955" LastEditDate="2020-03-14T17:07:10.307" LastActivityDate="2020-03-14T17:07:10.307" Title="Explanation of HHL Cirq implementation" Tags="&lt;hhl-algorithm&gt;&lt;cirq&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2020-03-15T21:54:23.127" ContentLicense="CC BY-SA 4.0" />
  <row Id="10191" PostTypeId="2" ParentId="10189" CreationDate="2020-03-14T18:20:35.250" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case, you want to ask what the &lt;code&gt;final_wavefunction&lt;/code&gt; of your circuit is and then trace out the other qubits. The output of &lt;code&gt;final_wavefunction&lt;/code&gt; 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 &lt;code&gt;qubit_order&lt;/code&gt; for &lt;code&gt;final_wavefunction&lt;/code&gt;. Cirq also includes methods like &lt;code&gt;wavefuntion_partial_trace_as_mixture&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;msg, R, S = cirq.LineQubit.range(3)&#xA;circuit = cirq.Circuit(cirq.H(R), cirq.CNOT(R, S))&#xA;&#xA;full_wavefunction = cirq.final_wavefunction(&#xA;    circuit,&#xA;    qubit_order=[msg, R, S])&#xA;qubit_mixture = cirq.wavefunction_partial_trace_as_mixture(&#xA;    full_wavefunction,&#xA;    keep_indices=[1])  # offset 1 in qubit order [msg, R, S] is R&#xA;&#xA;for probability, case in qubit_mixture:&#xA;    print(f'{probability:%} {cirq.dirac_notation(case)}')&#xA;&#xA;# prints:&#xA;# 49.999997% |0⟩&#xA;# 49.999997% |1⟩&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-03-14T18:20:35.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10192" PostTypeId="1" AcceptedAnswerId="10193" CreationDate="2020-03-14T18:28:02.173" Score="2" ViewCount="73" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="10366" LastActivityDate="2020-03-17T10:05:15.043" Title="2 qubit gate operation on multi qubit systems" Tags="&lt;quantum-state&gt;&lt;matrix-representation&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10193" PostTypeId="2" ParentId="10192" CreationDate="2020-03-14T19:02:02.300" Score="1" Body="&lt;p&gt;By taking into account this representation of the CNOT gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT = | 0 \rangle \langle 0 | \otimes I + | 1 \rangle \langle 1 | \otimes X$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(1, 3) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes I \otimes X$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT(1, 2) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes X \otimes I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp;CNOT(1, 3) CNOT(1, 2) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes X \otimes X = \\&#xA;&amp;amp;= &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix} &#xA;+ &#xA;\begin{pmatrix}&#xA;0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix} = &#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1  \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0  \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Answers to the related questions: [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4255/9459&quot;&gt;1&lt;/a&gt;] and [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9185/9459&quot;&gt;2&lt;/a&gt;].&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-17T10:05:15.043" LastActivityDate="2020-03-17T10:05:15.043" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10194" PostTypeId="1" AcceptedAnswerId="10196" CreationDate="2020-03-14T22:56:08.003" Score="2" ViewCount="157" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if (c==1) x q[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However, it removes all the if statements after it is transpiled (lines 19 and 21). Do you know what I did wrong?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9rxdu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9rxdu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9676" LastEditorUserId="9006" LastEditDate="2020-03-14T23:11:41.250" LastActivityDate="2020-03-16T14:13:38.613" Title="How to implement controlled gate based on measurement (quantum teleportation)?" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10195" PostTypeId="1" CreationDate="2020-03-14T23:00:06.327" Score="3" ViewCount="47" Body="&lt;p&gt;What is the cost (number of gates) of &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=0}^{N-1}| i \rangle \langle i|\otimes U_i$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and the costs of the unitaries &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;? Say the gate set consists of arbitrary one-qubit gates and the CNOT. The unitaries &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; act on an arbitrary number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know, for example, that the Toffoli gate, which is of the above form with &lt;span class=&quot;math-container&quot;&gt;$N=4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_3=X$&lt;/span&gt;, can be constructed with &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; CNOTs. &lt;/p&gt;&#xA;" OwnerUserId="8881" LastEditorUserId="8881" LastEditDate="2020-03-15T19:35:47.947" LastActivityDate="2020-03-15T19:35:47.947" Title="Cost of controlled-$U_i$" Tags="&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10196" PostTypeId="2" ParentId="10194" CreationDate="2020-03-14T23:08:02.807" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you can simply replace the statement&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;measure q[1] -&amp;gt; c[1];&#xA;if (c == 1) x q[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cx q[1], q[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;i.e. qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; controls CNOT acting on &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, you can do that for controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate. In the end, you will get same results as with IF statement.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-14T23:08:02.807" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10197" PostTypeId="2" ParentId="10185" CreationDate="2020-03-15T00:47:01.533" Score="1" Body="&lt;p&gt;I'm not sure I understand the question, since this seems quite straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Graph states are Clifford states, so for a state on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, the set of stabilizers has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; generators looking like &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$i^k P_1\otimes\ldots\otimes P_n$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$k\in\{0,1,2,3\}$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;'s are Pauli &lt;span class=&quot;math-container&quot;&gt;$X,Y,$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators. (For graph states, these stabilizers look like &lt;span class=&quot;math-container&quot;&gt;$\{X_v Z_{\text{Nbhd}(v)} : v \in V\}$&lt;/span&gt; )&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each Pauli has two eigenvectors. If we choose one of them and call it &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, and call its corresponding eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;, for each &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle\otimes\ldots\otimes|\psi_n\rangle$&lt;/span&gt; will be an eigenvector of the stabilizer with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$i^k\prod_i \lambda_i$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="6118" LastActivityDate="2020-03-15T00:47:01.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10198" PostTypeId="1" CreationDate="2020-03-15T09:58:56.143" Score="0" ViewCount="78" Body="&lt;p&gt;Is Quantum Entanglement the one-dimensional spatial relationship between two particles as described by mathematics? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="10370" LastEditorUserId="55" LastEditDate="2020-03-15T17:31:48.037" LastActivityDate="2020-03-15T17:31:48.037" Title="Is Quantum Entanglement the one-dimensional spatial relationship between two particles as described by mathematics?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="10199" PostTypeId="1" CreationDate="2020-03-15T11:26:49.593" Score="5" ViewCount="64" Body="&lt;p&gt;The following diagram is from &lt;a href=&quot;https://arxiv.org/abs/1810.01637&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental Realization of a Quantum Autoencoder: The Compression of Qutrits via Machine Learning&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/97kSR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/97kSR.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How this setup works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&gt; |V&gt; 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&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is, why is it necessary to use single photon for this experiment?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="7739" LastEditorUserId="7739" LastEditDate="2020-03-18T04:43:22.367" LastActivityDate="2020-03-18T04:43:22.367" Title="Are single photons necessary for this quantum autoencoder implementation?" Tags="&lt;physical-realization&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="10200" PostTypeId="2" ParentId="10198" CreationDate="2020-03-15T12:51:48.157" Score="2" Body="&lt;p&gt;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 &quot;stabile&quot; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi \rangle = \frac{1}{\sqrt{2}}\left( | \downarrow_z \rangle| \downarrow_z \rangle + | \uparrow_z \rangle| \uparrow_z \rangle \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://youtu.be/TrsnMNh9W9U?t=170&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation&lt;/a&gt;). But not only this. A valid question is what is our &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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 &lt;a href=&quot;https://youtu.be/Rc1vFAUnRUM?list=PLUl4u3cNGP61-9PEhRognw5vryrSEVLPr&amp;amp;t=2865&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; by Allan Adams about spin: especially from 47:45-52:45):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;| \uparrow_z \rangle =  \frac{1}{\sqrt{2}}\left( | \uparrow_x \rangle + | \downarrow_x \rangle \right)&#xA;\qquad&#xA;| \downarrow_z \rangle =  \frac{1}{\sqrt{2}}\left( | \uparrow_x \rangle - | \downarrow_x \rangle \right)&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi \rangle = \frac{1}{\sqrt{2}}\left( | \downarrow_x \rangle| \downarrow_x \rangle + | \uparrow_x \rangle| \uparrow_x \rangle \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if we will measure in x-direction we will still have a correlation between the &lt;span class=&quot;math-container&quot;&gt;$| \uparrow_x \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| \downarrow_x \rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more, I highly recommend this &lt;a href=&quot;https://youtu.be/awpnsGl08bc?list=PLUl4u3cNGP61-9PEhRognw5vryrSEVLPr&amp;amp;t=1713&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; by Allan Adams (about separable states and entangled states from 28:33-36:02) and this &lt;a href=&quot;https://www.youtube.com/watch?v=ZuvK-od647c&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt; from Veritasium youtube channel.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-15T13:00:51.597" LastActivityDate="2020-03-15T13:00:51.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10201" PostTypeId="2" ParentId="10185" CreationDate="2020-03-15T13:38:41.903" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a stabilizer of the form &lt;span class=&quot;math-container&quot;&gt;$K_n=X_nZ_iZ_j\ldots Z_k$&lt;/span&gt;, i.e. a graph-state stabilizer with a Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on qubit &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and a bunch of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s on some other qubits (related to the graph structure). By definition, &lt;em&gt;the&lt;/em&gt; graph state satisfies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K_n|\psi\rangle=|\psi\rangle&#xA;$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Now, let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_x\rangle=\left(\bigotimes_{i=1}^nZ^{x_i}\right)|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;, a binary string. If we apply the stabilizers to such a state, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K_n|\Psi_x\rangle=K_n\left(\bigotimes_{i=1}^nZ^{x_i}\right)|\psi\rangle=\left\{\begin{array}{cc}&#xA;\left(\bigotimes_{i=1}^nZ^{x_i}\right)K_n|\psi\rangle &amp;amp; x_n=0 \\&#xA;-\left(\bigotimes_{i=1}^nZ^{x_i}\right)K_n|\psi\rangle &amp;amp; x_n=1&#xA;\end{array}\right.&#xA;$$&lt;/span&gt;&#xA;Thus, every &lt;span class=&quot;math-container&quot;&gt;$|\Psi_x\rangle$&lt;/span&gt; is an eigenstate of every stabilizer, and with a different pattern of &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; eigenvalues (and must therefore be mutually orthogonal).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it must be the case that the different states &lt;span class=&quot;math-container&quot;&gt;$|\Psi_x\rangle$&lt;/span&gt; are orthogonal, I think it's useful to think about this in terms of the way that the graph states are created. Remember that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is created from qubits in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state and then have controlled-phase gates applied between them. Now, if I evaluate &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi_y|\Psi_x\rangle$&lt;/span&gt;, think of this as a calculation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle+|^{\otimes n}CP\cdot Z_{x\oplus y}\cdot CP|+\rangle^{\otimes n}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; represents the collection of controlled phase gates. Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; commutes with controlled phase, which means we can bring the two CPs together and annihilate them, leaving behind&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle+|^{\otimes n} Z_{x\oplus y}|+\rangle^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;Given that &lt;span class=&quot;math-container&quot;&gt;$x\neq y$&lt;/span&gt;, there is at least one &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, and we know &lt;span class=&quot;math-container&quot;&gt;$\langle +|Z|+\rangle=\langle -|+\rangle=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way of thinking gives another way of describing the basis of graph states: prepare each qubit in either &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, and combine with controlled-phases. Each different choice of &lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt; gives a different graph state in the basis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-03-16T10:19:37.577" LastActivityDate="2020-03-16T10:19:37.577" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10202" PostTypeId="1" AcceptedAnswerId="10205" CreationDate="2020-03-16T10:23:00.347" Score="3" ViewCount="73" Body="&lt;p&gt;In the paper &quot;Quantum Expectation-Maximization for Gaussian Mixture Models&quot; I encountered the following proposition :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider two vectors x,y and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; the angle between x and y, &lt;span class=&quot;math-container&quot;&gt;$\theta &amp;lt; \frac{\pi}{2}$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$||x - y|| \leq \epsilon$&lt;/span&gt; implies &lt;span class=&quot;math-container&quot;&gt;$|| |x\rangle - |y\rangle || \leq \frac{\sqrt 2 \epsilon}{||x||}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure how to interpret the link between &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| x \rangle $&lt;/span&gt; ?&#xA;In the case x is an integer, for example &lt;span class=&quot;math-container&quot;&gt;$x = 4$&lt;/span&gt; then I'd say that &lt;span class=&quot;math-container&quot;&gt;$| x \rangle  = | 100 \rangle $&lt;/span&gt;. But what about &lt;span class=&quot;math-container&quot;&gt;$x = 3.5$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$x = (2.5, 2.5)$&lt;/span&gt; ?&#xA;In those cases what &lt;span class=&quot;math-container&quot;&gt;$| x \rangle$&lt;/span&gt; would be ?&lt;/p&gt;&#xA;" OwnerUserId="10065" LastActivityDate="2020-03-16T12:58:41.333" Title="How should I understand the link between $x$ and $| x \rangle $?" Tags="&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10203" PostTypeId="2" ParentId="10181" CreationDate="2020-03-16T12:09:16.893" Score="1" Body="&lt;p&gt;What I have obtained by running 4 times the same code on &quot;qasm_simulator&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'00': 4656, '01': 1613, '10': 185, '11': 1642}&#xA;{'00': 4564, '01': 1735, '10': 179, '11': 1618}&#xA;{'00': 4581, '01': 1646, '10': 184, '11': 1685}&#xA;{'00': 4602, '01': 1684, '10': 181, '11': 1629}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &#xA;Burlington, then from Melbourne (for Melbourne the reason can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10155/9459&quot;&gt;answer&lt;/a&gt;). The rest QCs weren't performing comparably bad. You can try to apply the technique that you have used in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/10152/9459&quot;&gt;question&lt;/a&gt; or look to this &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; for repetition codes. Still, their performance will depend on the circuit depth that you have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Other suggestions&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-16T12:38:06.170" LastActivityDate="2020-03-16T12:38:06.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10205" PostTypeId="2" ParentId="10202" CreationDate="2020-03-16T12:58:41.333" Score="5" Body="&lt;p&gt;Generally it's context-specific what the label means. For example, if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are integers, then if &lt;span class=&quot;math-container&quot;&gt;$x\neq y$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; are orthogonal (since they are different binary strings). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't read the paper you mentioned but in the &quot;Preliminaries&quot; section of 3.1, they describe what &lt;em&gt;they&lt;/em&gt; mean by &lt;span class=&quot;math-container&quot;&gt;$| x\rangle$&lt;/span&gt;. Specifically: They assume &lt;span class=&quot;math-container&quot;&gt;$x\in \mathbb{R}^d$&lt;/span&gt;, and they define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle = \frac{1}{\Vert x\Vert}\sum_{j=1}^d x_j|j\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; will be computational basis vectors, i.e. for &lt;span class=&quot;math-container&quot;&gt;$j=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|j\rangle = |0\dots 01\rangle$&lt;/span&gt;, etc. The components of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; give the amplitudes of each of those basis vectors in some superposition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this definition of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, the &quot;Claim 3.4&quot; should follow. &lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-03-16T12:58:41.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10206" PostTypeId="2" ParentId="10194" CreationDate="2020-03-16T14:13:38.613" Score="1" Body="&lt;p&gt;I contacted &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/7714/fran-cabrera&quot;&gt;@fran-cabrera&lt;/a&gt; from the IBMQ team and he could reproduce the bug! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran you example in Qiskit and it seems to work&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(group='open')&#xA;device = provider.get_backend('ibmq_16_melbourne')&#xA;&#xA;qasm_string = &quot;&quot;&quot;&#xA;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q[3];&#xA;creg c[3];&#xA;h q[1];&#xA;cx q[1],q[2];&#xA;cx q[0],q[1];&#xA;h q[0];&#xA;measure q[1] -&amp;gt; c[1];&#xA;if(c==1) x q[2];&#xA;measure q[0] -&amp;gt; c[0];&#xA;if(c==1) z q[2];&#xA;measure q[2] -&amp;gt; c[2];&#xA;&quot;&quot;&quot;&#xA;&#xA;circuit = QuantumCircuit.from_qasm_str(qasm_string)&#xA;circuit.draw('text')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                         ┌───┐┌─┐          &#xA;q_0: |0&amp;gt;─────────────■───┤ H ├┤M├──────────&#xA;        ┌───┐      ┌─┴─┐ └┬─┬┘└╥┘          &#xA;q_1: |0&amp;gt;┤ H ├──■───┤ X ├──┤M├──╫───────────&#xA;        └───┘┌─┴─┐ ├───┤  └╥┘  ║  ┌───┐ ┌─┐&#xA;q_2: |0&amp;gt;─────┤ X ├─┤ X ├───╫───╫──┤ Z ├─┤M├&#xA;             └───┘ └─┬─┘   ║   ║  └─┬─┘ └╥┘&#xA;                  ┌──┴──┐  ║   ║ ┌──┴──┐ ║ &#xA; c_0: 0 ══════════╡     ╞══╬═══╩═╡     ╞═╬═&#xA;                  │     │  ║     │     │ ║ &#xA; c_1: 0 ══════════╡ = 1 ╞══╩═════╡ = 1 ╞═╬═&#xA;                  │     │        │     │ ║ &#xA; c_2: 0 ══════════╡     ╞════════╡     ╞═╩═&#xA;                  └─────┘        └─────┘   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = transpile(circuit,&#xA;                   backend=provider.get_backend('ibmq_16_melbourne'),&#xA;                   seed_transpiler=42)&#xA;result.draw('text', idle_wires=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                            ┌──────────┐┌─┐             &#xA;q_0 -&amp;gt; 0 |0&amp;gt;────────────────────────■───────┤ U2(0,pi) ├┤M├─────────────&#xA;            ┌──────────┐          ┌─┴─┐     └───┬─┬────┘└╥┘             &#xA;q_1 -&amp;gt; 1 |0&amp;gt;┤ U2(0,pi) ├──■───────┤ X ├─────────┤M├──────╫──────────────&#xA;            └──────────┘┌─┴─┐┌────┴───┴────┐    └╥┘      ║ ┌────────┐┌─┐&#xA;q_2 -&amp;gt; 2 |0&amp;gt;────────────┤ X ├┤ U3(pi,0,pi) ├─────╫───────╫─┤ U1(pi) ├┤M├&#xA;                        └───┘└──────┬──────┘     ║       ║ └───┬────┘└╥┘&#xA;                                 ┌──┴──┐         ║       ║  ┌──┴──┐   ║ &#xA;     c_0: 0 ═════════════════════╡     ╞═════════╬═══════╩══╡     ╞═══╬═&#xA;                                 │     │         ║          │     │   ║ &#xA;     c_1: 0 ═════════════════════╡ = 1 ╞═════════╩══════════╡ = 1 ╞═══╬═&#xA;                                 │     │                    │     │   ║ &#xA;     c_2: 0 ═════════════════════╡     ╞════════════════════╡     ╞═══╩═&#xA;                                 └─────┘                    └─────┘     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Based on this, I think your example should work in the &lt;a href=&quot;https://quantum-computing.ibm.com/jupyter&quot; rel=&quot;nofollow noreferrer&quot;&gt;IQX jupyter notebooks&lt;/a&gt;, included in the IBM Quantum Experience. &lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-03-16T14:13:38.613" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10207" PostTypeId="2" ParentId="4707" CreationDate="2020-03-16T22:14:43.140" Score="1" Body="&lt;p&gt;Regarding (c) -&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Too see what can go wrong, we'll need to take a step back and look at Shor's Algorithm assumptions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, the algorithm says we need to pick a random &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, find its order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, and finally calculate &lt;span class=&quot;math-container&quot;&gt;$X^\frac{r}{2} \pmod N$&lt;/span&gt; to get information about &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is of the form &lt;span class=&quot;math-container&quot;&gt;$2P$&lt;/span&gt;, thus by Chinese Remainder Theorm it will only have two roots modulo &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, and they will have to be the trivial roots &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt;. That happens because &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; has only one trivial root, unlike other primes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus for any &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; you may pick, &lt;span class=&quot;math-container&quot;&gt;$X^\frac{r}{2} \equiv \pm 1 \pmod N$&lt;/span&gt;, so you will always end up with the trivial roots, which are not enough for deriving factors of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (not even the factor &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;!)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Reference - &lt;a href=&quot;https://people.eecs.berkeley.edu/~vazirani/f04quantum/notes/lec9.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;vazirani lecture on Shor's Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10385" LastActivityDate="2020-03-16T22:14:43.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10208" PostTypeId="1" CreationDate="2020-03-17T05:14:13.897" Score="3" ViewCount="25" Body="&lt;p&gt;I am trying to derive the Bloch vector &lt;span class=&quot;math-container&quot;&gt;$dr$&lt;/span&gt; for a measurement of a observable in any arbitrary direction &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. For context this is the setup and derivation I have for continuous measurement along the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The equation of continuous measurement on observable X has the following form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{d \rho}{d t}=\mathcal{D}[X] \rho+\sqrt{\eta} \mathcal{H}[X] \rho \xi(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}[X] \rho=X \rho X^{\dagger}-\frac{1}{2}\left(X^{\dagger} X \rho+\rho X^{\dagger} X\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}[X] \rho=X \rho+\rho X-\left\langle X+X^{\dagger}\right\rangle \rho$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Kappa is the measurement strength.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Bloch Vector form,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho=\frac{1}{2}\left(I+x \sigma_{x}+y \sigma_{y}+z \sigma_{z}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}[X] \rho=2 \kappa\left(\sigma_{z} \rho \sigma_{z}-\rho\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}[X] \rho=\sqrt{2 \kappa}\left(\sigma_{z} \rho+\rho \sigma_{z}-2 z \rho\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To find &lt;span class=&quot;math-container&quot;&gt;$dx$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$=-4 \kappa x-\sqrt{8 \kappa \eta} x z \xi(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$=\sqrt{8 \kappa \eta}\left(1-z^{2}\right) \xi(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now I am trying to find the &lt;span class=&quot;math-container&quot;&gt;$\frac{d z}{d t}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{d x}{d t}$&lt;/span&gt;, in the case that the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}[X]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}[X]$&lt;/span&gt; terms for the same master equation where becomes &lt;span class=&quot;math-container&quot;&gt;$X = \cos(\Theta )\sigma _z+\sin(\Theta )\sigma_x$&lt;/span&gt; along measurement angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}[X] \rho=X \rho X^{\dagger}-\frac{1}{2}\left(X^{\dagger} X \rho+\rho X^{\dagger} X\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \cos^2(\Theta )\sigma _z\rho \sigma _z+\sin^2(\Theta )\sigma _x\rho \sigma _x$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am confused on what the simplified form of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}[X]\rho$&lt;/span&gt; will be as my simplification skills are not very strong&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would also need help in finding &lt;span class=&quot;math-container&quot;&gt;$\frac{d T r\left(\sigma_{x} \rho\right)}{d t}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{d T r\left(\sigma_{z} \rho\right)}{d t}$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$\sin$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos$&lt;/span&gt; terms like the above simplification.&lt;/p&gt;&#xA;" OwnerUserId="10390" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:56.723" LastActivityDate="2020-10-27T09:13:56.723" Title="Deriving Bloch vector $dr$ from master equation" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;quantum-control&gt;&lt;open-quantum-systems&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10209" PostTypeId="1" CreationDate="2020-03-17T06:03:26.610" Score="2" ViewCount="71" Body="&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Teleportation&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the procedure that I have copy-pasted from the textbook:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Step 1: Alice and Bob create an entangled pair of qubits and each one&#xA;  of them holds on to one of the two qubits in the pair.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;The pair they create is a special pair called a Bell pair. In quantum&#xA;  circuit language, the way to create a Bell pair between two qubits is&#xA;  to first transfer one of them to the Bell basis ( |+⟩  and  |−⟩ ) by&#xA;  using a Hadamard gate, and then to apply a CNOT gate onto the other&#xA;  qubit controlled by the one in the Bell basis.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Let's say Alice owns  q1  and Bob owns  q2  after they part ways.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Step 2: Alice applies a CNOT gate on  q1 , controlled by  |ψ⟩  (the&#xA;  qubit she is trying to send Bob).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Step 3: Next, Alice applies a Hadamard gate to  |ψ⟩ , and applies a&#xA;  measurement to both qubits that she owns -  q1  and  |ψ⟩ .&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Step 4: Then, it's time for a phone call to Bob. She tells Bob the&#xA;  outcome of her two qubit measurement. Depending on what she says, Bob&#xA;  applies some gates to his qubit,  q2 . The gates to be applied, based&#xA;  on what Alice says, are as follows :&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;00  →  Do nothing&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;01  →  Apply  X  gate&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;10  →  Apply  Z  gate&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;11  →  Apply  ZX  gate&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Note that this transfer of information is classical.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;And voila! At the end of this protocol, Alice's qubit has now&#xA;  teleported to Bob.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:50.927" LastActivityDate="2020-10-27T09:13:50.927" Title="How does Quantum Teleportation works?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="2" ClosedDate="2020-03-26T16:04:08.893" ContentLicense="CC BY-SA 4.0" />
  <row Id="10210" PostTypeId="2" ParentId="7054" CreationDate="2020-03-17T08:33:22.183" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(1,2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(3,4)$&lt;/span&gt;, but we want to do a measurement on qubits &lt;span class=&quot;math-container&quot;&gt;$(2,3)$&lt;/span&gt;. Well, we write down the 4-qubit state across &lt;span class=&quot;math-container&quot;&gt;$(1,2,3,4)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt;. Now repeat. For example, you might have another entangled state on qubits &lt;span class=&quot;math-container&quot;&gt;$(5,6)$&lt;/span&gt;, and want to perform a measurement on &lt;span class=&quot;math-container&quot;&gt;$(4,5)$&lt;/span&gt;. So, this is exactly the same scenario, which we just repeat the same calculation. Eventually, we've done all the calculations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While it's not exactly the same, you may also be interested to read the section &quot;Linearly assembled quantum states can be efficiently simulated on a classical computer&quot; in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504097&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, which is where I learned about similar ideas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;could&lt;/em&gt; combine &lt;em&gt;all&lt;/em&gt; of them together (consider, for example, a set of qubits arranged along a line, each in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. You first perform controlled-phase gates between pairs &lt;span class=&quot;math-container&quot;&gt;$(2n-1,2n)$&lt;/span&gt;. Then you perform controlled-phase gates between pairs &lt;span class=&quot;math-container&quot;&gt;$(2n,2n+1)$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-03-17T08:38:59.023" LastActivityDate="2020-03-17T08:38:59.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10211" PostTypeId="2" ParentId="4252" CreationDate="2020-03-17T09:51:56.840" Score="-1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10392" LastActivityDate="2020-03-17T09:51:56.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10212" PostTypeId="1" AcceptedAnswerId="13915" CreationDate="2020-03-17T12:36:05.123" Score="6" ViewCount="360" Body="&lt;p&gt;There is a lot of quantum gates in IBM Q Composer, however, only few are implemented physically while others can be composed of them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When one looks at description of a quantum processor in IBM Q interface, there is a list of &lt;em&gt;basis gates&lt;/em&gt;. For example those are &lt;code&gt;id, u1, u2, u3, cx&lt;/code&gt; for Melbourne processor. However, gates &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U2$&lt;/span&gt; are special cases of &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt;. If one removes statement &lt;code&gt;include &quot;qelib1.inc&quot;;&lt;/code&gt; from QASM code, only &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gates are left. So, it seems that all single qubit gates are implemented with &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; and there is of course two qubits &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to IBM Q manual, &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate is implemented by &lt;em&gt;three frame changes and two &lt;span class=&quot;math-container&quot;&gt;$X_{\pi/2}$&lt;/span&gt; pulses&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Which gates are implemented physically on IBM Q? I would expect &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and some single qubit gates but which ones?&lt;/li&gt;&#xA;&lt;li&gt;What are &lt;em&gt;frame changes&lt;/em&gt; and &lt;em&gt;&lt;span class=&quot;math-container&quot;&gt;$X_{\pi/2}$&lt;/span&gt; pulses&lt;/em&gt; used for gate implementation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-03-17T12:57:19.807" LastActivityDate="2020-09-26T10:11:15.757" Title="Physical implementation of gates on IBM Q" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10213" PostTypeId="1" CreationDate="2020-03-17T16:53:54.973" Score="1" ViewCount="167" Body="&lt;p&gt;I want to calculate eigenvectors and eigenvalues for real symmetric matrix or Hermitian matrix. Can I use this: &lt;a href=&quot;https://qiskit.org/documentation/api/qiskit.aqua.components.eigs.Eigenvalues.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/api/qiskit.aqua.components.eigs.Eigenvalues.html&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="10395" LastEditorUserId="9006" LastEditDate="2020-03-17T17:43:34.417" LastActivityDate="2020-03-22T21:11:27.440" Title="Eigenvalue and eigenvector in Qiskit" Tags="&lt;qiskit&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10214" PostTypeId="1" AcceptedAnswerId="10217" CreationDate="2020-03-17T18:28:19.523" Score="1" ViewCount="43" Body="&lt;p&gt;I know that we can measure a state in standard basis (Z) where the post measurement state is either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. But can you do a &lt;em&gt;'half-Z'&lt;/em&gt; basis measurement? I mean, you only measure with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle0|$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \langle1|$&lt;/span&gt;. So that when you measure &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, you would get  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with equal probability. But if you  measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \langle1|$&lt;/span&gt;, then you would not get a detection with certainty. Is there any implementation of this sort of a &lt;em&gt;'half-basis'&lt;/em&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:43.423" LastActivityDate="2020-10-27T09:13:43.423" Title="Half of Standard Basis Measurement" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10215" PostTypeId="1" CreationDate="2020-03-17T19:23:24.997" Score="3" ViewCount="339" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example if I have a circuit like below,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(2)&#xA;qc = QuantumCircuit(q)&#xA;qc.cu1(3*pi/4, q[0], q[1]);&#xA;print(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and different structure&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q = QuantumRegister(2)&#xA;qc = QuantumCircuit(q)&#xA;qc.h(q[0]);&#xA;qc.h(q[1]);&#xA;qc.cu1(3*pi/4, q[0], q[1]);&#xA;qc.h(q[0]);&#xA;qc.h(q[1]);&#xA;print(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="5955" LastEditDate="2020-03-18T08:09:33.170" LastActivityDate="2020-03-18T09:23:13.797" Title="How to calculate state fidelity in Qiskit?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10216" PostTypeId="1" AcceptedAnswerId="10220" CreationDate="2020-03-17T19:30:48.713" Score="7" ViewCount="664" Body="&lt;p&gt;&lt;em&gt;(This is related to Exercise 4.44 in Nielsen and Chuang)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Deutsch quantum gate is basically a &lt;span class=&quot;math-container&quot;&gt;$iR_x(\alpha \pi)$&lt;/span&gt; gate with two control qubits. The constant &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is an irrational number that allows to perform any rotation &lt;span class=&quot;math-container&quot;&gt;$R_x (\theta)$&lt;/span&gt; by sending &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; to the control qubits. In particular, one can (approximately) construct the set &lt;span class=&quot;math-container&quot;&gt;$\{ X, CNOT, \text{Toffoli} \}$&lt;/span&gt; by choosing &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha \pi \, \approx \,  \pi \mod 2\pi,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;such that &lt;span class=&quot;math-container&quot;&gt;$R_x(\alpha \pi) \approx X$&lt;/span&gt;. &lt;strong&gt;My question is: how do you reach quantum universality?&lt;/strong&gt; I guess you should be able to construct the Hadamard (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;) and phase (&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;) gates, which together with &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and Toffoli give quantum universality. Or else you should be able to construct &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$R_z(\alpha) R_x(\beta) R_z(\gamma)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_x(\alpha) R_z(\beta) R_x(\gamma)$&lt;/span&gt; give any one-qubit unitary.&lt;/p&gt;&#xA;" OwnerUserId="9895" LastEditorUserId="9006" LastEditDate="2020-03-17T22:34:25.520" LastActivityDate="2020-03-18T13:35:09.147" Title="Why is Deutsch's gate universal?" Tags="&lt;circuit-construction&gt;&lt;nielsen-and-chuang&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10217" PostTypeId="2" ParentId="10214" CreationDate="2020-03-18T06:03:57.880" Score="2" Body="&lt;p&gt;What you're talking about is called a &quot;projection&quot;. The projection onto basis state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P_{\psi} = |\psi\rangle\langle\psi|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any measurement operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, such as &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; can be written as the sum over projectors, weighted by their respective eigenvalues, such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M = \sum_i \lambda_i P_i$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; is the real-valued eigenvalue associated with outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\{i\}$&lt;/span&gt; is a set of orthogonal states such that &lt;span class=&quot;math-container&quot;&gt;$P_iP_j = \delta_{ij}$&lt;/span&gt;. A measurement basis is said to be &lt;em&gt;complete&lt;/em&gt; if it has the property&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sum_i P_i = I$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;and hence &lt;span class=&quot;math-container&quot;&gt;$\{i\}$&lt;/span&gt; forms an orthonormal basis. What you are describing is an &quot;incomplete&quot; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, that's some maths, but what does this mean physically? If you imagine a photon in one of two waveguides, such that the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state is associated with it being in one waveguide and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in the other, then the measurement of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator is as simple as putting a detector at the end of each waveguide. In the case where your measurement operator is only &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|$&lt;/span&gt;, this equates to a system where you only have a a single detector at the end of the first waveguide. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What happens then? Well, what you would expect, if you put in a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, you detect it with probability 1. On the other hand, you never detect the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. Similarly, in the case of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, you detect a photon in the first waveguide half of the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;all&lt;/em&gt; possible states the system can take.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2020-03-18T06:03:57.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10218" PostTypeId="2" ParentId="10215" CreationDate="2020-03-18T09:23:13.797" Score="2" Body="&lt;p&gt;There is more information towards the end of the tutorial &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/1748699b49c44003c0e7505d0cd2249df25b973a/qiskit/fundamentals/7_summary_of_quantum_operations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but essentially how you do this is you run both circuits on the &lt;code&gt;state_vector&lt;/code&gt; simulator and then you can use the function &lt;code&gt;state_fidelity&lt;/code&gt; to work out the fidelity between the two states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code to do this should look something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import state_fidelity&#xA;&#xA;# set up qc1 and qc2&#xA;&#xA;backend = Aer.get_backend('state_vector')&#xA;&#xA;sv1 = execute(qc1, backend).result().get_statevector(qc1)&#xA;sv2 = execute(qc2, backend).result().get_statevector(qc2)&#xA;&#xA;print(state_fidelity(sv1, sv2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-03-18T09:23:13.797" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10220" PostTypeId="2" ParentId="10216" CreationDate="2020-03-18T10:14:41.997" Score="3" Body="&lt;p&gt;I have thoughts on a couple of different approaches, although I'm sure there'll be simpler options.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, imagine you start from a two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and apply an &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; rotation with an angle equivalent to half that of a Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to the first qubit (I forget which convention N&amp;amp;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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the second qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state. If it isn't, discard and repeat. So, we can produce the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state. If you input this as the target qubit of the controlled-controlled-&lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt; (of arbitrary rotation angle), and have one of the controls in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, you get an arbitrary &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotation on the other control qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we know we can do arbitrary &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotations, meaning that you can make any single-qubit unitary. Combine that with controlled-not and you know you have universality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; logical qubits, you need &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; physical qubits. The extra qubit is a phase register, so if you have &lt;span class=&quot;math-container&quot;&gt;$|x\rangle(\cos\theta|0\rangle+\sin\theta|1\rangle)$&lt;/span&gt;, that is equivalent to &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}|x\rangle$&lt;/span&gt; in a regular quantum computation (this is the real computation version. I think the definition will need to change slightly here). Now &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; rotations and controlled-nots are performed exactly as they normally would be in the first &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits. However, a phase gate is now implemented by a controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-03-18T13:35:09.147" LastActivityDate="2020-03-18T13:35:09.147" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="10221" PostTypeId="2" ParentId="10216" CreationDate="2020-03-18T12:22:41.380" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$ n $&lt;/span&gt; qubits Deutsch's gate using Toffoli gates and three qubits Deutsch's gate only, so the results extends to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the proof in the &lt;a href=&quot;http://www.theory.caltech.edu/people/preskill/ph229/notes/chap6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;caltech's course on quantum computation&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{H, T\}$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; for Hadamard and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; for Toffoli) is universal (proof in &lt;a href=&quot;http://cds.cern.ch/record/600071/files/0301040.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Simple Proof that Toffoli and Hadamard are Quantum Universal&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="10065" LastActivityDate="2020-03-18T12:22:41.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10223" PostTypeId="1" AcceptedAnswerId="10224" CreationDate="2020-03-18T13:19:25.713" Score="3" ViewCount="81" Body="&lt;p&gt;In the Wikipedia's &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum channel article&lt;/a&gt;, it is said that a purely quantum channel &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; (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 :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I_n \otimes \Phi$$&lt;/span&gt;&#xA; We find again this difference of notation in the Heisenberg picture paragraph. &#xA;However I believe  &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; 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 ?&lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="9006" LastEditDate="2020-03-18T14:38:35.427" LastActivityDate="2020-03-18T14:54:11.237" Title="Confusing notation in Wikipedia's quantum channel article" Tags="&lt;quantum-operation&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10224" PostTypeId="2" ParentId="10223" CreationDate="2020-03-18T14:54:11.237" Score="3" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-18T14:54:11.237" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10225" PostTypeId="1" CreationDate="2020-03-18T18:50:57.930" Score="2" ViewCount="22" Body="&lt;p&gt;Currently, I'm learning about topological quantum computers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I don't understand is:&#xA;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?&lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="9006" LastEditDate="2020-03-18T22:18:13.743" LastActivityDate="2020-03-18T22:18:13.743" Title="Why does non-locality and the particle-hole symmetry not contradict each other?" Tags="&lt;physical-realization&gt;&lt;topological-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10227" PostTypeId="2" ParentId="7054" CreationDate="2020-03-19T05:21:00.387" Score="-1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A single-qubit measurement on a single non-entangled qubit.&lt;/li&gt;&#xA;&lt;li&gt;A single-qubit measurement on one qubit of a two-qubit entangled state.&lt;/li&gt;&#xA;&lt;li&gt;A two-qubit measurement on two disentangled qubits, both of which are non-entangled qubits.&lt;/li&gt;&#xA;&lt;li&gt;A two-qubit measurement on an entangled pair of qubits.&lt;/li&gt;&#xA;&lt;li&gt;A two-qubit measurement on two disentangled qubits, where only one is part of two-qubit entangled state.&lt;/li&gt;&#xA;&lt;li&gt;A two-qubit measurement on two disentangled qubits, where both are part of two separate two-qubit entangled states.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;&lt;a href=&quot;https://www.wikiwand.com/en/Quantum_teleportation#/Entanglement_swapping&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement swapping&lt;/a&gt;&quot;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the algorithm goes as follows:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Apply the first stage, creating a state with at most pairwise entanglement.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;li&gt;Any unmeasured qubits are simply discarded.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Van den Nest, Maarten, et al. &quot;Universal resources for measurement-based quantum computation.&quot; Physical review letters 97.15 (2006): 150504. Link &lt;a href=&quot;https://cds.cern.ch/record/939955/files/0604010.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2020-03-21T16:47:39.483" LastActivityDate="2020-03-21T16:47:39.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10228" PostTypeId="1" CreationDate="2020-03-19T05:47:47.700" Score="1" ViewCount="198" Body="&lt;p&gt;I am trying to implement Quantum Teleportation Algorithm on an actual device, I am using IBM-Q Jupyter notebook for the same purpose. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit as qk&#xA;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit&#xA;from qiskit import execute, Aer&#xA;from qiskit import IBMQ&#xA;from qiskit.visualization import plot_histogram&#xA;%config InlineBackend.figure_format = 'svg'&#xA;&#xA;def apply_secret_unitary(secret_unitary, qubit, quantum_circuit, dagger):&#xA;  functionmap = {&#xA;    'x': quantum_circuit.x,&#xA;    'y': quantum_circuit.y,&#xA;    'z': quantum_circuit.z,&#xA;    'h': quantum_circuit.h,&#xA;    't': quantum_circuit.t&#xA;  }&#xA;  if dagger == 1:&#xA;    functionmap['t'] = quantum_circuit.tdg&#xA;&#xA;  if dagger:&#xA;    [functionmap[unitary](qubit) for unitary in secret_unitary]&#xA;  else:&#xA;    [functionmap[unitary](qubit) for unitary in secret_unitary[::-1]]&#xA;&#xA;secret_unitary = 'hzxhzhx'&#xA;&#xA;qc = QuantumCircuit(3, 1)&#xA;'''&#xA;qc[0] -&amp;gt; The qubit to be teleported&#xA;qc[1] -&amp;gt; entangled state, possessed by alice&#xA;qc[2] -&amp;gt; entangled state, possessed by bob&#xA;'''&#xA;&#xA;apply_secret_unitary(secret_unitary, qc.qubits[0], qc, dagger = 0) &#xA;qc.barrier()&#xA;qc.h(1)&#xA;qc.cx(1, 2)&#xA;qc.barrier()&#xA;qc.cx(0, 1)&#xA;qc.h(0)&#xA;qc.cx(1, 2)&#xA;qc.cz(0, 2)&#xA;apply_secret_unitary(secret_unitary, qc.qubits[0], qc, dagger = 1)&#xA;qc.barrier()&#xA;qc.measure(2, 0);&#xA;qc.draw(output= 'mpl')&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;provider.backends()&#xA;&#xA;from qiskit.providers.ibmq import least_busy&#xA;backend = least_busy(provider.backends(filters = lambda b: b.configuration().n_qubits &amp;gt;= 3 and &#xA;                                       not b.configuration().simulator and &#xA;                                       b.status().operational == True))&#xA;job_exp = execute(qc, backend = backend, shots = 8192)&#xA;exp_result = job_exp.result()&#xA;&#xA;exp_measurement_result = exp_result.get_counts()&#xA;print(exp_measurement_result)&#xA;plot_histogram(exp_measurement_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The error which the following code gives is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQJobApiError: &quot;'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.'&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried deleting my account and load a new account using a newly generated token but that doesn't seem to work either.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clicking the link in the error gives the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPERATION_NOT_AVAILABLE&#xA;404 Shared class &quot;Hub&quot; has no method handling GET /ibm-q/Groups/open/Projects/main/Jobs/5e72ff01121d5e0018bfe775/resultDownloadUrl.&#xA;code: 2411&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;perhaps, I am using a method which is now deprecated. How can I tackle this situation?&lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2020-03-23T14:53:30.343" Title="Error while running Quantum Teleportation Algorithm on real device using qiskit on IBM-Q" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10229" PostTypeId="2" ParentId="10228" CreationDate="2020-03-19T09:41:15.710" Score="1" Body="&lt;p&gt;EDIT: I believe this is solved in @IEIrodov's answer below.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, try running:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;exp_result = job_exp.result()&#xA;exp_measurement_result = exp_result.get_counts()&#xA;print(exp_measurement_result)&#xA;plot_histogram(exp_measurement_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Separately in a new cell.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(also, if you're trying to verify teleportation, you need to &lt;code&gt;apply_secret_unitary&lt;/code&gt; on line 42 to &lt;code&gt;qc.qubits[2]&lt;/code&gt; instead of &lt;code&gt;qc.qubits[0]&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="10415" LastEditorUserId="10415" LastEditDate="2020-03-23T14:53:30.343" LastActivityDate="2020-03-23T14:53:30.343" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10230" PostTypeId="1" CreationDate="2020-03-19T10:20:12.647" Score="2" ViewCount="105" Body="&lt;p&gt;My goal is to prove that I can synthesise arbitrary unitary from two components. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the end, I find a matrix with the form&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    \mathbf{W}_j=\begin{pmatrix}&#xA;    |\alpha|2\cos{(\phi_{k,2}+\phi_{k,1})}+i|\beta|2\cos{(\phi_{k,2}-\phi_{k,1})}  &amp;amp; i|\alpha|2\sin{(\phi_{k,2}+\phi_{k,1})}+|\beta|2\sin{(\phi_{k,2}-\phi_{k,1})}\\&#xA;    i|\alpha|2\sin{(\phi_{k,2}+\phi_{k,1})}+|\beta|2\sin{(\phi_{k,2}-\phi_{k,1})}  &amp;amp;&#xA;    |\alpha|2\cos{(\phi_{k,2}+\phi_{k,1})}+i|\beta|2\cos{(\phi_{k,2}-\phi_{k,1})}&#xA;    \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\phi_{k,1}$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\phi_{k,2}$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are parameters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where can I begin to prove that it is an arbitrary unitary?&lt;/p&gt;&#xA;" OwnerUserId="10417" LastEditorUserId="9006" LastEditDate="2020-03-19T12:13:44.040" LastActivityDate="2020-03-19T22:37:17.723" Title="How to prove that a matrix is an arbitrary unitary?" Tags="&lt;gate-synthesis&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10231" PostTypeId="2" ParentId="10228" CreationDate="2020-03-19T10:49:01.320" Score="1" Body="&lt;p&gt;I'm not sure what had caused the problem but I was able to solve it and most likely know what the problem was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider these two lines from my code above:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job_exp = execute(qc, backend = backend, shots = 8192)&#xA;exp_result = job_exp.result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;job_monitor&lt;/code&gt; from &lt;code&gt;qiskit.tools.monitor&lt;/code&gt; which when called, let us know whether the job is complete or not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After it displays that the job has successfully run we should expect value from &lt;code&gt;result&lt;/code&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following is the code for the same purpose:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub = 'ibm-q')&#xA;backend = least_busy(provider.backends(filters = lambda x: x.configuration().n_qubits &amp;gt;= 3&#xA;                                      and not x.configuration().simulator&#xA;                                      and x.status().operational == True))&#xA;print('least busy backend: ', backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.monitor import job_monitor&#xA;job = execute(qc, backend = backend, shots = 8192)&#xA;job_monitor(job)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Proceed further only after the output to the above cell becomes '&lt;em&gt;Job Status: job has successfully run&lt;/em&gt;' which may take some time depending upon the value of shots.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that, you can call result() and get_counts() to get the values:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;result = job.result()&#xA;counts = result.get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2020-03-19T10:49:01.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10232" PostTypeId="2" ParentId="10228" CreationDate="2020-03-19T11:00:19.453" Score="0" Body="&lt;p&gt;Error 3202 is a networking error when trying to get the requested page. In this case the results for your job. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-03-19T11:00:19.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10233" PostTypeId="2" ParentId="10213" CreationDate="2020-03-19T11:02:33.477" Score="1" Body="&lt;p&gt;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. &#xA;In SciPy you can use &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eig.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy.linalg.eig&lt;/a&gt;. You can find examples of using this function in the documentation.&lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="10352" LastEditDate="2020-03-22T21:11:27.440" LastActivityDate="2020-03-22T21:11:27.440" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10234" PostTypeId="2" ParentId="10230" CreationDate="2020-03-19T15:37:44.067" Score="1" Body="&lt;p&gt;The straightforward method is to compute &lt;span class=&quot;math-container&quot;&gt;$ W W^\dagger = W^\dagger W =  I $&lt;/span&gt; and to get constraint over your parameters solving this system. I'm going to show you how to do it only for  &lt;span class=&quot;math-container&quot;&gt;$ W W^\dagger = I$&lt;/span&gt; but it should be very similar for &lt;span class=&quot;math-container&quot;&gt;$ W^\dagger W$&lt;/span&gt;. I assume here that all your parameters are real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;first some notation for ease of reading, let's pose :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$W = \begin{bmatrix} A &amp;amp; B \\ C &amp;amp; D \end{bmatrix} $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$W^\dagger = \begin{bmatrix} A^* &amp;amp; C^* \\ B^* &amp;amp; D^* \end{bmatrix}, I = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;this allows us to see easily that :&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align} AA^* + BB^* &amp;amp;= 1 \\ &#xA;CC^* + DD^* &amp;amp;= 1&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using the property over product of complex conjuguates (&lt;span class=&quot;math-container&quot;&gt;$zz^* = |z|^2$&lt;/span&gt;), the computation for these two equalities is pretty straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} |A|^2 + |B|^2 &amp;amp;= 1 \\ &#xA;|C|^2 + |D|^2 &amp;amp;= 1&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I let you the details of the computation (The trick is to remember that &lt;span class=&quot;math-container&quot;&gt;$cos^2(x) + sin^2(x)=1$&lt;/span&gt;) but in the end you should get :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\alpha|^2+|\beta|^2 = \frac{1}{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;for the two equalities. That's your first constraint over your matrix for it to be unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then you have the two following equalities :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} AC^* + BD^* &amp;amp;= 0 \\ &#xA;CA^* + DB^* &amp;amp;= 0&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$\sin(a+b) = \sin(a)\cos(b) + \cos(a)\sin(b)$&lt;/span&gt;) :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$4 |\alpha||\beta| \sin(2 \phi_2) = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which has multiple solutions :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\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}) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can do the same for&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CA^* + DB^* = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and it should give you a new equality constraint over your parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For now we have the following non-linear system of constraint :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} |\alpha|^2+|\beta|^2 &amp;amp; = \frac{1}{4} \\ &#xA; |\alpha||\beta| \sin(2 \phi_2) &amp;amp; = 0&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$W^\dagger W = I$&lt;/span&gt;. I believe you'll get pretty close constraints, maybe one more over &lt;span class=&quot;math-container&quot;&gt;$\phi_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.wolframalpha.com/calculators/system-equation-calculator&quot; rel=&quot;nofollow noreferrer&quot;&gt;the very useful online systems of equations solver from Wolframalpha&lt;/a&gt;. The solutions of this non-linear system will tell you what range  your parameters can take such that your matrix is unitary.&lt;/p&gt;&#xA;" OwnerUserId="10065" LastActivityDate="2020-03-19T15:37:44.067" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10235" PostTypeId="1" AcceptedAnswerId="10238" CreationDate="2020-03-19T19:11:28.063" Score="6" ViewCount="210" Body="&lt;p&gt;In ZX-calculus, the CNOT gate is represented by this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/amF9b.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/amF9b.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone show my 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.&lt;/p&gt;&#xA;" OwnerUserId="6118" LastEditorUserId="9006" LastEditDate="2020-03-19T22:32:37.003" LastActivityDate="2020-03-19T22:32:37.003" Title="CNOT gate in ZX-calculus" Tags="&lt;quantum-gate&gt;&lt;zx-calculus&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10236" PostTypeId="2" ParentId="10230" CreationDate="2020-03-19T20:10:30.147" Score="2" Body="&lt;p&gt;There are multiple ways to show that &lt;span class=&quot;math-container&quot;&gt;$W_j$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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})).$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are many other ways to show that &lt;span class=&quot;math-container&quot;&gt;$W_j$&lt;/span&gt; is not generally unitary.  Hopefully it's clear that if &lt;span class=&quot;math-container&quot;&gt;$W_j$&lt;/span&gt; is not generally unitary, it's certainly not an arbitrary unitary.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="9006" LastEditDate="2020-03-19T22:37:17.723" LastActivityDate="2020-03-19T22:37:17.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10238" PostTypeId="2" ParentId="10235" CreationDate="2020-03-19T21:18:22.907" Score="7" Body="&lt;p&gt;I am going to assume that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is represented by &lt;a href=&quot;https://i.stack.imgur.com/Uy6nB.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uy6nB.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; by &lt;a href=&quot;https://i.stack.imgur.com/YgHvj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YgHvj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, &lt;a href=&quot;https://i.stack.imgur.com/IwAiZ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IwAiZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; represents the bit-flip, or NOT gate. What it does is: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\mapsto |x\oplus1\rangle$&lt;/span&gt;. This can be verified easily in the graphical calculus, using the &quot;spider&quot; rule:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sB6Tu.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sB6Tu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9n5OC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9n5OC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, by definition, CNOT controls NOT: &lt;span class=&quot;math-container&quot;&gt;$|x_1,x_2\rangle\mapsto|x_1,x_1\oplus x_2\rangle$&lt;/span&gt;. In other words, if &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is fed to the first qubit, the result is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on the first qubit, and the identity on the second. If it is fed &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the result is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on the first qubit, and the gate NOT on the second one. Again this can be verified in the graphical calculus:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TqVlT.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TqVlT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the first equality is the &quot;copy&quot; rule, the second is the &quot;spider&quot; rule, and the last one is the fact that a rotation of angle &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is the identity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4PIPb.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4PIPb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the first equality is the &quot;&lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;-copy&quot; rule, and the second is the &quot;spider&quot; rule.&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2020-03-19T21:18:22.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10239" PostTypeId="1" AcceptedAnswerId="10243" CreationDate="2020-03-20T05:38:59.657" Score="5" ViewCount="336" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$UU^T = I$&lt;/span&gt; analytically. But this 6x6 case is out of computational reach for this method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there any general method, or any clever trick, to help me fill in the rest of matrices such as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note: I actually would prefer if all the entries were real, so technically these are better called orthogonal matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U = \frac{1}{\sqrt{5}}\begin{bmatrix}&#xA;0 &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? \\&#xA;1 &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? \\&#xA;1 &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? \\&#xA;1 &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? \\&#xA;1 &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? \\&#xA;1 &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? &amp;amp; ? \\&#xA;\end{bmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="734" LastEditDate="2020-03-21T05:14:40.137" LastActivityDate="2020-03-22T04:16:57.147" Title="How can I fill a unitary knowing only its first column?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10240" PostTypeId="2" ParentId="9956" CreationDate="2020-03-20T06:41:26.967" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$v^{\prime\prime}$&lt;/span&gt; which is no longer a vertex of the edge-contracted state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v^{\prime\prime}$&lt;/span&gt;, since the operator &lt;span class=&quot;math-container&quot;&gt;$Z^k_{v}Z^l_{N_G(v^{\prime\prime})\setminus \{v^\prime\}}$&lt;/span&gt; looks correct to me. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$L_2$&lt;/span&gt; can be written as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\def\ket#1{\lvert #1 \rangle}\def\bra#1{\langle #1 \rvert}&#xA;\ket{L_2} = \frac{1}{\sqrt{2}}(\ket{++} + \ket{--})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereas the state associated with the three-qubit line &lt;span class=&quot;math-container&quot;&gt;$L_3$&lt;/span&gt; can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\ket{L_3} &amp;amp;= \frac{1}{2}(\ket{+++} + \ket{+--} + \ket{--+} + \ket{-+-}) \\&#xA;&amp;amp;= \frac{1}{2}\big[(\ket{++} + \ket{--})_{1,3}\ket{+}_2 + (\ket{+-} + \ket{-+})_{1,3}\ket{-}_2\big] \\&#xA;&amp;amp;= \frac{1}{\sqrt{2}}\sum_{i=0,1}Z_3^i\ket{L_2}_{1,3}(\ket{0} + Z_2^i\ket{1})&#xA;\end{aligned}&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$L_2 = L_3 \;/\; (1, 2)$&lt;/span&gt;. This equation is telling us that if we measure the middle qubit in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So yeah, my money is that it's just a typo.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) You are correct in asserting that the edge contraction trick would work with only two nodes (up to the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\tilde{G}$&lt;/span&gt; of maximum vertex degree 3. This requires adding the extra internal vertex &lt;span class=&quot;math-container&quot;&gt;$v^\prime$&lt;/span&gt; with degree two, since if one were not to do this, the subsequent expansions would not serve to reduce the overall degree.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The best way to see this is to take the example given in Figure 1 and try the subsequent expansions of &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v^{\prime\prime}$&lt;/span&gt; in the case where &lt;span class=&quot;math-container&quot;&gt;$v^\prime$&lt;/span&gt; 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. &lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2020-03-20T06:41:26.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10241" PostTypeId="1" AcceptedAnswerId="10244" CreationDate="2020-03-20T10:57:29.117" Score="1" ViewCount="51" Body="&lt;p&gt;BB84 protocol works followingly:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Alice generate &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; random qubits &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; in state either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; . These will be a key. Then she prepares &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; random bits &lt;span class=&quot;math-container&quot;&gt;$b_{i}$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$b_i=0$&lt;/span&gt;, an identity gate is applied and qubit is left in either state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$b_i=1$&lt;/span&gt; then Hadamard gate is applied changing qubit &lt;span class=&quot;math-container&quot;&gt;$a_{i}$&lt;/span&gt; to either state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. After that qubits are sent to Bob.&lt;/li&gt;&#xA;&lt;li&gt;Bob generates &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; random bits. According to the value of &lt;span class=&quot;math-container&quot;&gt;$b_{i}^{'}$&lt;/span&gt; he applies either identity or Hadamard gate on received qubit &lt;span class=&quot;math-container&quot;&gt;$a_{i}$&lt;/span&gt; and measure it, receiving either 0 or 1.&lt;/li&gt;&#xA;&lt;li&gt;Alice and Bob compare bits &lt;span class=&quot;math-container&quot;&gt;$b_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_i^{'}$&lt;/span&gt;. If they are equal, now classical bit &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; is preserved and become part of the key. About &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$a_{i}$&lt;/span&gt; bits are preserved on average.&lt;/li&gt;&#xA;&lt;li&gt;Alice and Bob send each other &lt;span class=&quot;math-container&quot;&gt;$N/4$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$a_{i}$&lt;/span&gt; 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.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;So, my question is how step 5 is done in practice?&lt;/strong&gt; 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. &lt;strong&gt;However, if the information is hidden, how can Alice and Bob repair the key to ensure they have the same one?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="7429" LastEditDate="2021-01-21T17:41:22.313" LastActivityDate="2021-01-21T17:41:22.313" Title="How to deal with noise in BB84 protocol?" Tags="&lt;cryptography&gt;&lt;communication&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10242" PostTypeId="2" ParentId="10239" CreationDate="2020-03-20T11:01:32.387" Score="7" Body="&lt;p&gt;Take your vector &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{5}}(0, 1, 1, 1, 1, 1)^T$&lt;/span&gt; and five other arbitrary ones but at the same time these vectors have to be linearly independent. After that apply &lt;a href=&quot;https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process&quot; rel=&quot;noreferrer&quot;&gt;Gram-Schmidt process&lt;/a&gt; which produces orthonormal vectors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put these vectors to a matrix and you will get a unitary matrix with the first column equal to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{5}}(0, 1, 1, 1, 1, 1)^T$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-20T11:01:32.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10243" PostTypeId="2" ParentId="10239" CreationDate="2020-03-20T11:34:06.957" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$V=2|v\rangle\langle v|-I$&lt;/span&gt; is a unitary (&lt;span class=&quot;math-container&quot;&gt;$V=V^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V^2=I$&lt;/span&gt;). So, the question is whether you can select a &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; such that the first column is the one you gave (&lt;span class=&quot;math-container&quot;&gt;$V=U$&lt;/span&gt;). So, just calculate &lt;span class=&quot;math-container&quot;&gt;$\langle 1|V|n\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; to 6, and you'll find (up to a possible global phase)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle=\frac{1}{\sqrt{2}}|1\rangle-\frac{1}{\sqrt{10}}\sum_{n=2}^6|n\rangle.&#xA;$$&lt;/span&gt;&#xA;So now you can write down your unitary:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{5}\left[\begin{array}{cccccc}&#xA;0 &amp;amp; -\sqrt{5} &amp;amp; -\sqrt{5} &amp;amp; -\sqrt{5} &amp;amp; -\sqrt{5} &amp;amp; -\sqrt{5} \\&#xA;-\sqrt{5} &amp;amp; -4 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;-\sqrt{5} &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;-\sqrt{5} &amp;amp; 1 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 &amp;amp; 1 \\&#xA;-\sqrt{5} &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -4 &amp;amp; 1 \\&#xA;-\sqrt{5} &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -4&#xA;\end{array}\right].&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to fill in some details: Your first column can be considered a properly normalised state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, so you are searching for a state that satisfies&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(2|v\rangle\langle v|-I)|1\rangle=|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;It's easy enough to manipulate this to find (where I'm making the simplifying assumption that the inner product &lt;span class=&quot;math-container&quot;&gt;$\langle 1|\psi\rangle$&lt;/span&gt; is real)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle=\frac{|1\rangle+|\psi\rangle}{\sqrt{2(1+\langle 1|\psi\rangle)}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-03-22T04:16:57.147" LastActivityDate="2020-03-22T04:16:57.147" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10244" PostTypeId="2" ParentId="10241" CreationDate="2020-03-20T11:37:36.413" Score="2" Body="&lt;p&gt;It is important to note that Step 5 is a classical step. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2020-03-20T11:37:36.413" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10246" PostTypeId="1" AcceptedAnswerId="10268" CreationDate="2020-03-20T12:57:49.553" Score="3" ViewCount="215" Body="&lt;p&gt;I have a sort of basic question. I think an operator that acts on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-partite states is defined (up to permutation of parties) to be local if it can be written as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A  = A_1 \otimes_{i=2}^n \mathbb{I}_i $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the subscript &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; denotes the party on which an operator acts. This definition ensures that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; 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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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  \, ,  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}_i$&lt;/span&gt; applies the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate to party &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and does nothing to the rest. If Alice performs &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}_1$&lt;/span&gt;, then Bob performs  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}_2$&lt;/span&gt;  and then Charlie performs &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}_3$&lt;/span&gt;, which I understand is a protocol within the LOCC rules (actually no communication is needed at all) then the resulting gate is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{O}_3 \mathcal{O}_2 \mathcal{O}_1 = Z_1 \otimes Z_2 \otimes Z_3 \, ,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9895" LastEditorUserId="9895" LastEditDate="2020-03-21T00:31:37.073" LastActivityDate="2020-03-23T15:33:21.100" Title="What is a local operator?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10247" PostTypeId="2" ParentId="10246" CreationDate="2020-03-20T15:25:05.207" Score="2" Body="&lt;p&gt;There are two inequivalent definitions of &quot;local operator&quot; used in quantum information theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first definition is used in the context of communication over a classical channel (e.g. LOCC). In this context, you have a &lt;em&gt;fixed&lt;/em&gt; partition of the complete Hilbert space into a tensor product of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; 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 &quot;local operator&quot; 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. &lt;span class=&quot;math-container&quot;&gt;$\bigotimes_{i=1}^k A_i$&lt;/span&gt;, where the operator &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; acts on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th subsystem. Under this definition, the product of local operators is always a local operator, because by definition &lt;span class=&quot;math-container&quot;&gt;$\left (\bigotimes_{i=1}^k A_i \right) \left( \bigotimes_{i=1}^k B_i \right) = \bigotimes_{i=1}^k (A_i B_i)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When thinking about hardware implementations of a quantum computer, there's sometimes also a natural sense in which some qubits are &quot;next to&quot; 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, &quot;local&quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-03-23T13:06:58.633" LastActivityDate="2020-03-23T13:06:58.633" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="10248" PostTypeId="1" AcceptedAnswerId="10249" CreationDate="2020-03-20T15:42:16.450" Score="1" ViewCount="151" Body="&lt;p&gt;My understanding, for instance from &lt;a href=&quot;https://youtu.be/vUVkS1XZVCc?t=183&quot; rel=&quot;nofollow noreferrer&quot;&gt;this youtube video&lt;/a&gt;, is the following:&lt;br&gt;&#xA;Assuming a state &lt;span class=&quot;math-container&quot;&gt;$\psi = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; can be complex. I believe any state is always normalized, so that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;. The probabilities can be calculated as follows: &lt;span class=&quot;math-container&quot;&gt;$P_0 = |\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1 = |\beta|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[0.34538722-0.7061969j  0.29214734-0.14894447j 0.29214737-0.14894448j&#xA; 0.13474798+0.02354215j 0.29214734-0.14894444j 0.13474798+0.02354215j&#xA; 0.134748  +0.02354216j 0.03903516+0.04161799j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;My question: Why does this not add up to 1?&lt;/p&gt;&#xA;&lt;p&gt;Minimal example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import sympy&#xA;import numpy as np&#xA;import math&#xA;&#xA;# qubits&#xA;q = cirq.GridQubit.rect(1, 3)&#xA;q_pi = np.pi/4 # quarter_py&#xA;&#xA;# Create a circuit on these qubits using the parameters you created above.&#xA;circuit = cirq.Circuit(&#xA;  cirq.rx(0.1).on(q[0]), cirq.rx(0.1).on(q[1]), cirq.rx(0.1).on(q[2]), &#xA;  cirq.ry(q_pi).on(q[0]), cirq.ry(q_pi).on(q[1]), cirq.ry(q_pi).on(q[2]),&#xA;  cirq.rz(q_pi).on(q[0]), cirq.rz(q_pi).on(q[1]), cirq.rz(q_pi).on(q[2]))&#xA;&#xA;simulator = cirq.Simulator()&#xA;results = simulator.simulate(program=circuit, param_resolver=resolver, qubit_order=q).final_state&#xA;print(results)&#xA;&#xA;print(np.sum([math.pow(x.real,2) for x in results]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="1859" LastEditDate="2020-11-22T00:02:39.020" LastActivityDate="2020-11-22T00:02:39.020" Title="Normalization of the quantum state in Cirq" Tags="&lt;simulation&gt;&lt;cirq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10249" PostTypeId="2" ParentId="10248" CreationDate="2020-03-20T17:26:03.097" Score="1" Body="&lt;p&gt;You say &quot;I believe any state is always normalized, so that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;&quot;, but you don't apply this to your calculation. The summation of squares of the &lt;strong&gt;absolute values&lt;/strong&gt; is what gets the appropriate answer. For a single qubit system, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle +  \beta|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;. For a multiqubit system (3 in your case), &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha_{000}|000\rangle + \alpha_{001}|001\rangle ... +  \alpha_{111}|111\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{000}|^2 + |\alpha_{001}|^2 + ... + |\alpha_{111}|^2  = 1$&lt;/span&gt;. The following will give you what you want.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import sympy&#xA;import numpy as np&#xA;import math&#xA;&#xA;# qubits&#xA;q = cirq.GridQubit.rect(1, 3)&#xA;q_pi = np.pi/4 # quarter_py&#xA;# Create a circuit on these qubits using the parameters you created above.&#xA;circuit = cirq.Circuit(&#xA;  cirq.rx(0.1).on(q[0]), cirq.rx(0.1).on(q[1]), cirq.rx(0.1).on(q[2]), &#xA;  cirq.ry(q_pi).on(q[0]), cirq.ry(q_pi).on(q[1]), cirq.ry(q_pi).on(q[2]),&#xA;  cirq.rz(q_pi).on(q[0]), cirq.rz(q_pi).on(q[1]), cirq.rz(q_pi).on(q[2]))&#xA;&#xA;simulator = cirq.Simulator()&#xA;results = simulator.simulate(program=circuit, qubit_order=q).final_state&#xA;results_abs = map(abs, results)&#xA;print(np.sum([math.pow(x,2) for x in results_abs])) # prints 0.9999995465139359 which is ~=1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2020-03-20T23:19:48.370" LastActivityDate="2020-03-20T23:19:48.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10251" PostTypeId="1" CreationDate="2020-03-20T21:37:52.747" Score="1" ViewCount="87" Body="&lt;p&gt;I'm trying to understand how to read results from an NMR quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Nielsen and Chuang:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The principal output is the free induction decay signal &lt;span class=&quot;math-container&quot;&gt;$$V(t) = V_0\text{Tr}\left[e^{-iHt}\rho e^{iHt}(iX_k+Y_k)\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This signal is measured for some period of time, and then the results are Fourier-transformed into a plot like this one&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a2JX3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a2JX3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; what do these peaks mean? Suppose I want to know how much of my ensemble is in the &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; (or whatever) state, how do I read this off of the plot?&lt;/p&gt;&#xA;" OwnerUserId="6118" LastEditorUserId="9006" LastEditDate="2020-03-20T22:54:36.367" LastActivityDate="2020-04-21T15:06:05.680" Title="Readout using an NMR spectrum" Tags="&lt;physical-realization&gt;&lt;nielsen-and-chuang&gt;&lt;physical-qubit&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10252" PostTypeId="2" ParentId="10248" CreationDate="2020-03-21T10:46:28.607" Score="0" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.varsitytutors.com/hotmath/hotmath_help/topics/absolute-value-complex-number&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The real component of a complex number &lt;span class=&quot;math-container&quot;&gt;$a + bi$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. The absolute value of a complex number &lt;span class=&quot;math-container&quot;&gt;$a + bi$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\sqrt(a^2 + b^2)$&lt;/span&gt;. As pointed out, this is the difference between x.real and abs(x) in python. &lt;/p&gt;&#xA;" OwnerUserId="2794" LastActivityDate="2020-03-21T10:46:28.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10254" PostTypeId="1" CreationDate="2020-03-21T13:53:57.843" Score="1" ViewCount="181" Body="&lt;p&gt;In the notebook &lt;em&gt;&quot;portfolio optimization&quot;&lt;/em&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10426" LastEditorUserId="9006" LastEditDate="2020-03-21T16:53:59.833" LastActivityDate="2020-03-21T17:06:26.020" Title="What is the risk factor on IBM's portfolio optimization notebook?" Tags="&lt;qiskit&gt;&lt;optimization&gt;&lt;vqe&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10255" PostTypeId="2" ParentId="10254" CreationDate="2020-03-21T15:29:23.027" Score="2" Body="&lt;p&gt;The objective of the portfolio optimization problem is to trade off expected return (&lt;span class=&quot;math-container&quot;&gt;$\mu^T x$&lt;/span&gt;) with the risk taken (&lt;span class=&quot;math-container&quot;&gt;$x^T \Sigma $&lt;/span&gt;x).&#xA;This could be achieved by introducing a constraint on the risk, e.g. &lt;span class=&quot;math-container&quot;&gt;$x^T \Sigma x \leq R$&lt;/span&gt;, for an acceptable risk level &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mu^T x - q x^T \Sigma x$&lt;/span&gt;, and is a QUBO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The actual choice &lt;span class=&quot;math-container&quot;&gt;$q=0.5$&lt;/span&gt; in the notebook is arbitrary and just for illustration.&#xA;If you solve the problem for different &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, you'll find different combinations of expected return and risk. E.g. for &lt;span class=&quot;math-container&quot;&gt;$q=0$&lt;/span&gt; you consider a risk-neutral investor and the optimal solution would only maximize the expected return independent of the risk. If you increase &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, the solution gets more and more risk-averse, ie., the return . Solving the problem for a reasonable set of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; but in the risk and return, thus, you would have to do, e.g., a binary search over &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; until you find a solution that does not exceed the acceptable level of risk &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;. You'd like to get as close to &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; as possible while not exceeding it, since this should increase the expected return of the resulting portfolio.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A more general discussion of the portfolio optimization problem can be found here:&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Modern_portfolio_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Modern_portfolio_theory&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10429" LastActivityDate="2020-03-21T15:29:23.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10256" PostTypeId="2" ParentId="10254" CreationDate="2020-03-21T17:06:26.020" Score="0" Body="&lt;p&gt;You can find some information on another approach to portfolio optimization on quantum computer in this article: &lt;a href=&quot;https://arxiv.org/abs/1811.03975&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computational finance: quantum algorithm for portfolio optimization&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors deal with minimizing risk descibed by function &lt;span class=&quot;math-container&quot;&gt;$w^T\Sigma w$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; is vector of asset weights and &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; is a covariance matrix. The minimization is subjected to requirement on expected return &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$R^T w  = \mu$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is vector of historical returns, and budget constraint &lt;span class=&quot;math-container&quot;&gt;$\xi$&lt;/span&gt;:&lt;span class=&quot;math-container&quot;&gt;$P^T w  = \xi$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is vector of asset prices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since constraints are &lt;em&gt;equalities&lt;/em&gt;, 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; for solving system of linear equation on quantum computer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Besides, one of authors of the article, Seth Lloyd designed also HHL algorithm.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-21T17:06:26.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10257" PostTypeId="1" AcceptedAnswerId="10284" CreationDate="2020-03-22T08:22:49.240" Score="3" ViewCount="87" Body="&lt;p&gt;Reading through the official &lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt;, I fell onto the problem of Deutsch - Jozsa Algorithm, which seemed little mystical to me at first but as I tried out the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/deutsch-josza.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; of its working, I was unable to work out the last part of it, the example is copy-pasted below:&lt;/p&gt;&#xA;&lt;p&gt;Let's go through a specific example for a two-bit balanced function with hidden bitstring  &lt;em&gt;&lt;strong&gt;a=3&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The first register of two qubits is initialized to  |0⟩  and the second register qubit to |1⟩:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|ψ_0⟩=|00⟩_1|1⟩_2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Hadamard on all qubits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|ψ_1⟩=\frac{1}{2}(|00⟩_1+|01⟩_1+|10⟩_1+|11⟩_1)\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For  a=3, (11 in binary) the oracle function can be implemented as &lt;span class=&quot;math-container&quot;&gt;$Q_f=CX_{1a}CX_{2a}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|ψ_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)] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;4.Thus:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|ψ_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)]&#xA;=\frac{1}{2}(|00⟩_1−|01⟩_1−|10⟩_1+|11⟩_1)\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =\frac{1}{\sqrt{2}}(|0⟩_{10}−|1⟩_{10})\frac{1}{\sqrt{2}}(|0⟩_{11}−|1⟩_{11})\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Hadamard on the first register:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |ψ_3⟩=|1⟩_{10}|1⟩_{11}(|0⟩_2−|1⟩_2) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measuring the first two qubits will give the non-zero  &lt;em&gt;&lt;strong&gt;11&lt;/strong&gt;&lt;/em&gt;, indicating a balanced function.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The main problem in understanding was in the final step, going from :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |ψ_2⟩=\frac{1}{2}(|00⟩_1−|01⟩_1−|10⟩_1+|11⟩_1)\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |ψ_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}) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems to be some sort of a factorization step, how does that work?&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="2927" LastEditDate="2021-04-27T23:00:31.833" LastActivityDate="2021-04-27T23:00:31.833" Title="Understanding the working of oracle in Deutsch - Jozsa Algorithm" Tags="&lt;qiskit&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10258" PostTypeId="1" CreationDate="2020-03-22T09:24:34.457" Score="1" ViewCount="206" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$P_{00} = |\alpha|^2$&lt;/span&gt;. &#xA;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import sympy&#xA;x0, x1 = sympy.symbols('x0 x1')&#xA;q = cirq.GridQubit.rect(1, 2)&#xA;circuit = cirq.Circuit(&#xA;  cirq.rx(x0).on(q[0]), cirq.rx(x1).on(q[1]), &#xA;  cirq.ry(3.14/4).on(q[0]), cirq.ry(3.14/4).on(q[1]))&#xA;resolver = cirq.ParamResolver({x0: 0.2, x1: 0.3})&#xA;simulator = cirq.Simulator()&#xA;results = simulator.simulate(program=circuit, param_resolver=resolver, &#xA;qubit_order=q).final_state&#xA;print(&quot;Internal quantum state:&quot;, results)&#xA;print(&quot;Probabilities of observing each state:&quot;, [abs(x)**2 for x in results])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;internal quantum state: [0.8377083+0.08743566j 0.3529709-0.11249491j 0.35297093-0.06251574j 0.13120411-0.08743566j]&#xA;probabilities of observing each state: [0.7094002059173512, 0.13724355108492148, 0.12849669756020887, 0.024859516013751914]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, in multiple tutorials (for instance from &lt;a href=&quot;https://www.tensorflow.org/quantum/tutorials/hello_many_worlds&quot; rel=&quot;nofollow noreferrer&quot;&gt;TFQ&lt;/a&gt;) I see the use of &quot;expectation_from_wavefunction&quot;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;z0 = cirq.Z(q[0])&#xA;qubit_map={q[0]: 1, q[1]: 1}&#xA;z0.expectation_from_wavefunction(results, qubit_map).real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.6757938265800476&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt;:&#xA;How can I use expectation_from_wavefunction to obtain the probabilities of observing the individual states (&lt;span class=&quot;math-container&quot;&gt;$P_{00}, P_{01}, P_{10}, P_{11}$&lt;/span&gt;)? &lt;br&gt;&#xA;Bonus question: why would I favor this approach?&lt;/p&gt;&#xA;" OwnerUserId="2794" LastActivityDate="2020-04-22T11:08:03.440" Title="How to calculate the probabilities of observing quantum states using the &quot;expectation_from_wavefunction&quot; in cirq (and why)" Tags="&lt;simulation&gt;&lt;cirq&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10259" PostTypeId="2" ParentId="10258" CreationDate="2020-03-22T14:28:27.557" Score="-1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;why would I favor this approach?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Expectation_value_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Expectation value&lt;/a&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle= \langle\psi|A|\psi\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is the wavefunction and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the operator. Use &quot;expectation_from_wavefunction()&quot; if you don't want to write code that calculates &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|A|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-03-22T14:28:27.557" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10260" PostTypeId="2" ParentId="10251" CreationDate="2020-03-22T14:38:30.823" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For further reading some of the work from J. A. Jones is a good place to start:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;arXiv:quant-ph/0106067&lt;/p&gt;&#xA;" OwnerUserId="9579" LastActivityDate="2020-03-22T14:38:30.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10261" PostTypeId="1" AcceptedAnswerId="10278" CreationDate="2020-03-22T15:36:42.433" Score="5" ViewCount="108" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="4907" LastEditorUserId="9006" LastEditDate="2020-03-22T21:10:55.357" LastActivityDate="2020-03-24T05:45:23.270" Title="What are some good resources for learning about photonic qubits?" Tags="&lt;resource-request&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10262" PostTypeId="1" CreationDate="2020-03-22T21:16:40.033" Score="3" ViewCount="116" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a teleportation circuit, &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(3,3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3E8kD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3E8kD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, I create the bell pair for Alice and Bob:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.h(1)&#xA;circuit.cx(1,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u2h9c.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u2h9c.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I flip alices first qubit to a 1 state; this is the qubit whose state is to be teleported:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.x(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JhTSG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JhTSG.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, my understanding gets fuzzy, and I have a few questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) I seem to entangle Alice's to-be-teleported state qubit with her qubit that is entangled with Bob's. &lt;strong&gt;But what exactly am I doing when I conditionally flip this to-be-teleported qubit and then put a hadamard on it&lt;/strong&gt;?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.cx(0,1)&#xA;circuit.h(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uZ1m6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uZ1m6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then 2) &lt;strong&gt;how does my measurement affect Bob's qubit?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.measure([0,1],[0,1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DP9nC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DP9nC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;finally, &lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.cx(1,2)&#xA;circuit.cz(0,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EgVay.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EgVay.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the whole circuit, for reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KX1dg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KX1dg.png&quot; alt=&quot;teleportation circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:37.907" LastActivityDate="2020-10-27T09:13:37.907" Title="How does the teleportation circuit work after the initial entanglement?" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10263" PostTypeId="2" ParentId="10262" CreationDate="2020-03-22T22:33:55.190" Score="3" Body="&lt;p&gt;1) In this step, you connect a teleported qubit with entangled qubits between Alice and Bob. This means, Bob now has an &lt;em&gt;&quot;access&quot;&lt;/em&gt; to the teleported qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Here you get some information about the teleported qubit and &lt;em&gt;&quot;partially colapse&quot;&lt;/em&gt; Bob's qubit according to a state of the teleported qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This description is unfortunately inaccurate because plain English is not sufficient to described such phenomena like a quantaum teleportation. See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9627/compute-the-output-of-the-quantum-teleportation-circuit/&quot;&gt;this&lt;/a&gt; thread for mathematical description of the whole teleportation process, &lt;em&gt;it is clearer from my point of view.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-22T22:33:55.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10264" PostTypeId="1" AcceptedAnswerId="12159" CreationDate="2020-03-22T23:22:44.940" Score="2" ViewCount="122" Body="&lt;p&gt;Consider the standard two-party &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;CHSH scenario&lt;/a&gt;. Each party can perform one of two measurements (denoted with &lt;span class=&quot;math-container&quot;&gt;$x,y\in\{0,1\}$&lt;/span&gt;) and observe one of two outcomes (denoted with &lt;span class=&quot;math-container&quot;&gt;$a,b\in\{0,1\}$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P(ab|xy)$&lt;/span&gt; be the probability of observing outcomes &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; when choosing the measurements settings &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt;. Local realistic theories are those that, for some probability distribution over some hidden variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P(ab|xy)=\sum_\lambda q(\lambda)P_\lambda(a|x)P_\lambda(b|y).\tag1$$&lt;/span&gt;&#xA;Define the &lt;em&gt;local polytope&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal L$&lt;/span&gt; as the set of theories that can be written as in (1).&#xA;Note that we identify here a &lt;em&gt;theory&lt;/em&gt; with its set of conditional probabilities: &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol P\equiv (P(ab|xy))_{ab,xy}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Denote with &lt;span class=&quot;math-container&quot;&gt;$E_{xy}$&lt;/span&gt; the expectation values &lt;span class=&quot;math-container&quot;&gt;$E_{xy}=\sum_{ab}(-1)^{a+b}P(ab|xy)$&lt;/span&gt;.&#xA;We then know that all local realistic theories &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol P\in\mathcal L$&lt;/span&gt; satisfy the CHSH inequality:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Big|\sum_{xy}(-1)^{xy} E_{xy}\Big| = |E_{00}+ E_{01} + E_{10} - E_{11}|&#xA;= \left|\sum_{abxy}(-1)^{a+b+xy}P(ab|xy)\right| \le 2.\tag2$$&lt;/span&gt;&#xA;Is the opposite true? In other words, do all theories satisfying (2) admit local realistic explanations?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-05-13T14:46:28.877" LastActivityDate="2020-05-24T12:54:00.380" Title="Does the CHSH inequality fully characterise the local polytope?" Tags="&lt;bell-experiment&gt;&lt;non-locality&gt;&lt;nonclassicality&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10265" PostTypeId="2" ParentId="10264" CreationDate="2020-03-23T09:19:35.967" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-23T09:19:35.967" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="10266" PostTypeId="2" ParentId="10261" CreationDate="2020-03-23T09:20:05.927" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Photons are really good as they can be used in many way to create qubits (polarisation of course, but also time, frequency, OAM).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Ph.D Thesis of Laurent Olislager is available online on the subject of time-frequency photon qubits, that is very interesting ! &lt;/p&gt;&#xA;" OwnerUserId="10417" LastActivityDate="2020-03-23T09:20:05.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10268" PostTypeId="2" ParentId="10246" CreationDate="2020-03-23T15:33:21.100" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A\otimes I$&lt;/span&gt; local operators, but &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; is also a local operator. For example, on a quantum circuit, two Hadamard gates applied on neighbouring qubits are described as &lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$I\otimes I+(I-Z)\otimes(X-I)/4$&lt;/span&gt;, and cannot be written in the form &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt;, corresponding with the fact that it's entangling. Given that this is the setting I believe you're talking about, &lt;strong&gt;everything in your question is considered a local operator&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The other context in which this might arrise is a Hamiltonian. If you have a Hamiltonian that is of the form &lt;span class=&quot;math-container&quot;&gt;$H=A\otimes I$&lt;/span&gt;, that Hamiltonian is local. However, a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=A\otimes B$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$A\otimes B$&lt;/span&gt; should be local. Ultimately, what you're really thinking about is the resultant evolution, &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt;. There, you can see that &lt;span class=&quot;math-container&quot;&gt;$H=A\otimes B$&lt;/span&gt; produces unitaries that are non-local in the previous sense, while if I added local operators, &lt;span class=&quot;math-container&quot;&gt;$H=A\otimes I+I\otimes B$&lt;/span&gt;, that produces local operators &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}\otimes e^{-iBt}$&lt;/span&gt; in the same sense as before.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-23T15:33:21.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10269" PostTypeId="1" AcceptedAnswerId="10280" CreationDate="2020-03-23T16:04:17.113" Score="3" ViewCount="74" Body="&lt;p&gt;I'm working on the following problem form Nielsen and Chuang (Ex. 4.40) regarding the universality of Hadamard, phase and &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; gates for single qubit gates:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For arbitrary &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E(R_{\vec{n}}(\alpha), R_{\vec{n}}(\alpha + \beta)) = |1 - exp(i\beta/2)|$&lt;/span&gt;,&#xA;where &lt;span class=&quot;math-container&quot;&gt;$E(U, V) = max_{|\psi\rangle} || (U-V)|\psi\rangle||$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Show (using the previous equality) &lt;span class=&quot;math-container&quot;&gt;$\forall \epsilon &amp;gt;0$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$\exists n$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$E(R(\alpha)_{\vec{n}}, {R(\theta)_{\vec{n}}}^n) &amp;lt; \frac{\epsilon}{3}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is an irrational multiple of &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;My attempt:&lt;/p&gt;&#xA;&lt;p&gt;Prior to the exercise, it discusses how for any arbitrary error &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;gt; 0$&lt;/span&gt;, we can find some multiple &lt;span class=&quot;math-container&quot;&gt;$(mod$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$2\pi)$&lt;/span&gt; of irrational &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (found using the Pigeonhole principle, which I think I understand, and I'm skipping and taking as given), call it &lt;span class=&quot;math-container&quot;&gt;$\theta_k \in (0, 2\pi]$&lt;/span&gt;, |&lt;span class=&quot;math-container&quot;&gt;$\theta_k| &amp;lt; \epsilon$&lt;/span&gt; such that all multiples &lt;span class=&quot;math-container&quot;&gt;$(mod$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$2\pi)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt; differ by at most &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. Thus &lt;span class=&quot;math-container&quot;&gt;$\forall \alpha \in [0, 2\pi)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\exists m$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$|\alpha - (m\theta_k) | =|\alpha - (mk\theta)| &amp;lt; \epsilon$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$n = mk$&lt;/span&gt;, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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))) &amp;lt; &#xA;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))} &amp;lt; 2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(which is not correct).&lt;/p&gt;&#xA;&lt;p&gt;I feel like I'm missing something very obvious in this whole exercise. A hint would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8765" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-03-24T10:40:09.807" Title="Error bound on approximating arbitrary rotation gates" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10270" PostTypeId="1" AcceptedAnswerId="10271" CreationDate="2020-03-23T19:35:00.517" Score="2" ViewCount="109" Body="&lt;p&gt;The question says it all. Explain any difference in terminology that can be encountered across Physics, Quantum Computing and Mathematics. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-03-23T20:36:45.743" Title="Terminology : Are basis states the same as basis vectors?" Tags="&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10271" PostTypeId="2" ParentId="10270" CreationDate="2020-03-23T20:29:33.567" Score="4" Body="&lt;p&gt;You are correct that &quot;basis states&quot; and &quot;basis vectors&quot; essentially mean the same thing, but the terms do have a bit of a different connotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The eigenvectors that span a Hamiltonian matrix are &quot;states&quot; in which a quantum mechanical system can exist. The ones with the smallest eigenvalue are &quot;ground state wavefunctions&quot;, the ones with the next smallest eigenvalue are the &quot;first excited state wavefunctions&quot;, etc.  The eigenvectors of a Hamiltonian matrix are also basis vectors/states, because Hamiltonians are Hermitian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the eigenvectors of a Hermitian matrix arising in some finance application that has nothing to do with quantum mechanics, will be called &quot;basis vectors&quot; but not &quot;basis states&quot; because they don't necessarily have the meaning of being &quot;states&quot; of anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A bigger distinction comes from the fact that not all quantum systems are discrete, for example the position &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; of a particle is often treated to be a continuous variable. Here we are reminded that the Hamiltonian is not just a &quot;matrix&quot; but it's something more general called an &quot;operator&quot;. There is still an eigensystem associated with this operator, but instead of calling the wavefunctions &quot;eigenvectors&quot;, we call them &lt;strong&gt;&quot;eigenfunctions&quot;&lt;/strong&gt;. Eigenfunctions are functions like &lt;span class=&quot;math-container&quot;&gt;$\psi(x) = e^{-x^2}$&lt;/span&gt; and you would not usually call this a &quot;vector&quot; (although you certainly can if you want to).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-03-23T20:29:33.567" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10272" PostTypeId="2" ParentId="10270" CreationDate="2020-03-23T20:36:45.743" Score="1" Body="&lt;p&gt;Any quantum state is described by a complex vector of dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. When you take &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So, answer is: yes, basis states are composed of a vector space basis.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-23T20:36:45.743" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10273" PostTypeId="1" AcceptedAnswerId="10274" CreationDate="2020-03-23T21:56:44.020" Score="5" ViewCount="91" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every circuit that I have made is mostly either guessing or saw someone else's answer and paved my way to it.&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:26.457" LastActivityDate="2020-10-27T09:13:26.457" Title="Is there a systematic way to build quantum circuits?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10274" PostTypeId="2" ParentId="10273" CreationDate="2020-03-23T23:09:52.623" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f(x): \{0;1\}^n \rightarrow \{0,1\}$&lt;/span&gt;, then reversible equivalent can be build in this way:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x_n\rangle |y\rangle \rightarrow |x_n\rangle |f(x_n) \oplus y\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any unitary 2x2 matrix (i.e. single qubit gate) can be decomposed into three matrices&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\mathrm{e}^{i\alpha} &amp;amp; 0\\&#xA;0 &amp;amp; \mathrm{e}^{-i\alpha}\&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;\cos (\theta/2) &amp;amp; \sin(\theta/2)\\&#xA;-\sin (\theta/2) &amp;amp; \cos (\theta/2)&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;\mathrm{e}^{i\beta} &amp;amp; 0\\&#xA;0 &amp;amp; \mathrm{e}^{-i\beta}\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; being real numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you single out &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\alpha}$&lt;/span&gt; from the first matrix and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\beta}$&lt;/span&gt; from the third, you get &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; gate (up to global phase) on IBM Q. A matrix in the middle can be implemented with gate &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; on IBM Q (or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; rotation up to phase). So, this is a universal approach how to build single qubit gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any contolled gate (with one control qubit) can be decomposed to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I\otimes C) \,CNOT\, (I \otimes B)\, CNOT\, (I \otimes A),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is and 2x2 unit matrix and &lt;span class=&quot;math-container&quot;&gt;$ABC = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elementary gates for quantum computation&lt;/a&gt; for more information on three and more qubits gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also these articles could be helpful:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308006&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Quantum Circuits for General Two-Qubit Gates&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1501.06911&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuits for Isometries&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-24T11:00:44.470" LastActivityDate="2020-03-24T11:00:44.470" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10275" PostTypeId="1" CreationDate="2020-03-24T03:12:43.763" Score="1" ViewCount="78" Body="&lt;p&gt;I have a code like this &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public string CalculateMD5Hash(string input)&#xA;{&#xA;&#xA;    MD5 md5 = System.Security.Cryptography.MD5.Create();&#xA;    byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);&#xA;    byte[] hash = md5.ComputeHash(inputBytes); &#xA;&#xA;    StringBuilder sb = new StringBuilder();&#xA;    for (int i = 0; i &amp;lt; hash.Length; i++)&#xA;    {&#xA;        sb.Append(hash[i].ToString(&quot;X2&quot;));&#xA;    }&#xA;    return sb.ToString();&#xA;}&#xA;&#xA;public bool checkHash(){&#xA; List&amp;lt;string&amp;gt; charset = new List&amp;lt;string&amp;gt;{&quot;0&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,&quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;,&quot;f&quot;,&quot;g&quot;,&quot;h&quot;,&quot;i&quot;,&quot;j&quot;,&quot;k&quot;,&quot;l&quot;,&quot;m&quot;,&quot;n&quot;,&quot;o&quot;,&quot;p&quot;,&quot;q&quot;,&quot;r&quot;,&quot;s&quot;,&quot;t&quot;,&quot;u&quot;,&quot;v&quot;,&quot;w&quot;,&quot;x&quot;,&quot;y&quot;,&quot;z&quot;};&#xA; foreach(var a in charset)&#xA; {&#xA;     foreach(var b in charset){&#xA;         foreach(var c in charset){&#xA;             foreach(var d in charset){&#xA;                  foreach(var e in charset)&#xA;                  {&#xA;                    string result = a+b+c+d+e;&#xA;                    if(CalculateMD5Hash(result).StartWiths(&quot;9A4F2E9567F170C5&quot;))&#xA;                      return true;&#xA;                  }              &#xA;             }           &#xA;         }&#xA;     }   &#xA; }&#xA; return false;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this possible to bring this into Q# &amp;amp; run them on Azure Quantum using some of the Q# quantum method?&lt;/p&gt;&#xA;" OwnerUserId="10447" LastActivityDate="2020-03-25T03:29:00.173" Title="May I deploy my C# code to Q# Azure quantum computing?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10276" PostTypeId="2" ParentId="10275" CreationDate="2020-03-24T04:18:29.783" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please read this link - &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quickstart&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/quantum/quickstart&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this link more about the Azure Quantum - &lt;a href=&quot;https://azure.microsoft.com/en-us/services/quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://azure.microsoft.com/en-us/services/quantum/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please read this article to set the right expectation&#xA;&lt;a href=&quot;https://www.scientificamerican.com/article/how-close-are-we-really-to-building-a-quantum-computer/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.scientificamerican.com/article/how-close-are-we-really-to-building-a-quantum-computer/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5175" LastEditorUserId="5175" LastEditDate="2020-03-25T03:29:00.173" LastActivityDate="2020-03-25T03:29:00.173" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="10277" PostTypeId="1" AcceptedAnswerId="10279" CreationDate="2020-03-24T05:19:43.690" Score="1" ViewCount="116" Body="&lt;p&gt;Say I have the stabilizer &lt;span class=&quot;math-container&quot;&gt;$XXI$&lt;/span&gt;, and a phase-flipped state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. What does it mean to measure the stabilizer &lt;span class=&quot;math-container&quot;&gt;$XXI$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the math behind &quot;measurement&quot;?&lt;/p&gt;&#xA;" OwnerUserId="10450" LastEditorUserId="9006" LastEditDate="2020-03-24T05:51:07.443" LastActivityDate="2020-03-24T08:05:28.940" Title="What does it mean to &quot;measure a stabilizer&quot;?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10278" PostTypeId="2" ParentId="10261" CreationDate="2020-03-24T05:45:23.270" Score="2" Body="&lt;p&gt;Here is a handful of Linear Optical Quantum Computation (LOQC) resources I have found useful in the past:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0512071&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Linear Optical Quantum Computing&quot;&lt;/a&gt; (2005) by Kok et. al.&lt;/strong&gt;: 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 &quot;linear&quot; photonic quantum computing.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&quot;Introduction to optical quantum information processing&quot; (2010) by Kok and Lovett&lt;/strong&gt;:  This book (published by Cambridge university press) covers optical information processing more generally, so it also includes content on the non-linear &quot;continuous variable&quot; photonic encodings.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.702792&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Towards practical linear optical quantum computing&quot;&lt;/a&gt; (2015) by Gimeno-Segovia&lt;/strong&gt;: 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.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/abs/1607.08535&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Why I am optimistic about the silicon-photonic route to quantum computing&quot;&#xA;&lt;/a&gt; (2016) by Rudolph&lt;/strong&gt;: 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.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.774447&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Towards realistic architectures for linear optical quantum computing&quot;&#xA;&lt;/a&gt; (2019) by Morley-Short&lt;/strong&gt;: 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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2020-03-24T05:45:23.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10279" PostTypeId="2" ParentId="10277" CreationDate="2020-03-24T08:05:28.940" Score="2" Body="&lt;p&gt;Measurements can be described by a Hermitian operator, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. In this case, &lt;span class=&quot;math-container&quot;&gt;$A=X\otimes X\otimes I$&lt;/span&gt;. That operator has a spectral decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\sum_i\lambda_iP_i,&#xA;$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are the distinct (real) eigenvalues, and the &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are projectors onto the different eigenspaces, and satisfy the completeness relation &lt;span class=&quot;math-container&quot;&gt;$\sum_iP_i=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, basically, we're using &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to define the set &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt; which are the projectors in the formalism of projective measurement, i.e. we measure in this basis and get answer &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i=\langle\psi|P_i|\psi\rangle$&lt;/span&gt;. After the measurement, the system is in the state &lt;span class=&quot;math-container&quot;&gt;$P_i|\psi\rangle/\sqrt{p_i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your case, since &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt;, you know the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and hence you can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{\pm}=\frac12(I\pm A).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-24T08:05:28.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10280" PostTypeId="2" ParentId="10269" CreationDate="2020-03-24T10:40:09.807" Score="2" Body="&lt;p&gt;Firstly, I think there's a reason why the bit in the textbook before the question is using &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; for the results. So, replacing what you've written, it should really be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E&amp;lt;\sqrt{2(1-\cos(\delta/2))}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, start with a double-angle formula: &lt;span class=&quot;math-container&quot;&gt;$1-\cos(\delta/2)=2\sin^2(\delta/4)$&lt;/span&gt;. Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E&amp;lt;2\sin(\delta/4)&#xA;$$&lt;/span&gt;&#xA;Now if you apply the small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; approximation (which should be more obvious following that manipulation), you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E&amp;lt;\delta/2.&#xA;$$&lt;/span&gt;&#xA;Finally, if you want &lt;span class=&quot;math-container&quot;&gt;$E&amp;lt;\delta/2$&lt;/span&gt;, you simply have to select &lt;span class=&quot;math-container&quot;&gt;$\delta=2\epsilon/3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might ask why you want the factor of &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt; in there at all? Why not just leave it as &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;? 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 &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-24T10:40:09.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10281" PostTypeId="1" AcceptedAnswerId="10282" CreationDate="2020-03-24T13:05:46.417" Score="2" ViewCount="155" Body="&lt;p&gt;I'm trying to implement the main algorithm described in the &lt;a href=&quot;https://arxiv.org/pdf/1603.08675.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Recommendation Systems paper&lt;/a&gt;. In order to do this, I have to create a quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; corresponding to a real vector stored in QRAM. I used an algorithm described more in detail in another paper, in which one can read:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For the runtime, there are &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; rotations executed at the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt; be a single qubit rotation conditioned on a bitstring &lt;span class=&quot;math-container&quot;&gt;$x \in \{0, 1\}^k$&lt;/span&gt;. Then the unitary &lt;span class=&quot;math-container&quot;&gt;$\bigoplus\limits_{x\in\{0,1\}^k} U_x$&lt;/span&gt; applied to &lt;span class=&quot;math-container&quot;&gt;$|y\rangle\otimes|q\rangle$&lt;/span&gt; achieves the desired parallel operation on the single qubit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = \sum\limits_{x\in\{0,1\}^k}\alpha_x\,|x\rangle$&lt;/span&gt; is some superposition over bitstrings.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not sure that I understand this notion of parallel execution. In the algorithm, at a given step &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, one performs on one qubit &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; controlled rotation conditionned on every qubit amongst the first &lt;span class=&quot;math-container&quot;&gt;$k-1$&lt;/span&gt;. Hence, we can summarize this as one big unitary matrix that acts on the first &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits, which will look-like &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}R_{\theta_1}&amp;amp;0&amp;amp;0\\\vdots&amp;amp;\ddots&amp;amp;\vdots\\0 &amp;amp; 0 &amp;amp; R_{\theta_{2^k}}\end{bmatrix}$&lt;/span&gt;, where for a given angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_\theta$&lt;/span&gt; is the rotation of angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; around the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-axis of the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we assume that this big operator is applied in &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt;, then I understand the notion of parallelism: you  don't have to successively apply the &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2020-03-24T14:08:15.380" Title="Building a state with parallel execution" Tags="&lt;circuit-construction&gt;&lt;cirq&gt;&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10282" PostTypeId="2" ParentId="10281" CreationDate="2020-03-24T14:08:15.380" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;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&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No, you're not. This is the whole problem with algorithms, be they classical or quantum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in the specific case you're talking about, there is a nice implementation. Imagine that you want to apply the rotation &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta_x)$&lt;/span&gt; if the main register is in the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. Let me further more assume that there is a good &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-bit approximation to the values &lt;span class=&quot;math-container&quot;&gt;$\theta_x$&lt;/span&gt; for which there is an efficient classical function. So, I have a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; that outputs the value &lt;span class=&quot;math-container&quot;&gt;$\tilde\theta_x$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-bit approximation to &lt;span class=&quot;math-container&quot;&gt;$\theta_x$&lt;/span&gt;. Since it's a classical function, I can also write it as a quantum function &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; that acts as &lt;span class=&quot;math-container&quot;&gt;$V|x\rangle|0\rangle=|x\rangle|\tilde\theta_x\rangle$&lt;/span&gt;, having introduced an ancilla system of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; bits. Implementation of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is efficient because the evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is efficient.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, I know that if I apply phase gates on the &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; qubits of the ancilla register (phase &lt;span class=&quot;math-container&quot;&gt;$\pi,\pi/2,\pi/4,\pi/8,\ldots$&lt;/span&gt;), I can implement &lt;span class=&quot;math-container&quot;&gt;$|\tilde\theta_x\rangle\rightarrow e^{i\tilde\theta_x}|\tilde\theta_x\rangle$&lt;/span&gt;. If I just inverted my original calculation at this point, &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt;, then the net effect is &lt;span class=&quot;math-container&quot;&gt;$e^{i\tilde\theta_x}|x\rangle\rightarrow|x\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\tilde\theta_x$&lt;/span&gt; between the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; register and the single qubit target. At this point, you're essentially there. You just need a basis rotation (e.g. &lt;span class=&quot;math-container&quot;&gt;$(Z+Y)/\sqrt{2}$&lt;/span&gt;) on the target qubit to convert the gate from controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to controlled-&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-24T14:08:15.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10284" PostTypeId="2" ParentId="10257" CreationDate="2020-03-24T15:08:45.533" Score="5" Body="&lt;p&gt;Here the subscripts are of the form &lt;span class=&quot;math-container&quot;&gt;$1i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is the label of the subsystem (recall that you are using two qubits for this &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;_0=\left|00\right&amp;gt;_{1}$&lt;/span&gt;). So any product of subscripts can be written as &lt;span class=&quot;math-container&quot;&gt;$\left|q_0\right&amp;gt;_{10}\left|q_1\right&amp;gt;_{11}=\left|q_0q_1\right&amp;gt;_{1}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$q_0,q_1\in\{0,1\}$&lt;/span&gt; in this convention, which makes sense because &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; occupies the position &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; occupies the position &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; from left to right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also you are right, there is a factorization and you can check this fact expanding the first two terms related to the system &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\left|\psi_2\right&amp;gt;$&lt;/span&gt; using the convention explained previously:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|\psi_2\right&amp;gt;=\frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_{10}-\left|1\right&amp;gt;_{10})\frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_{11}-\left|1\right&amp;gt;_{11})\frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_{2}-\left|1\right&amp;gt;_{2})=\frac{1}{2}(\left|0\right&amp;gt;_{10}\left|0\right&amp;gt;_{11}-\left|0\right&amp;gt;_{10}\left|1\right&amp;gt;_{11}-\left|1\right&amp;gt;_{10}\left|0\right&amp;gt;_{11}+\left|1\right&amp;gt;_{10}\left|1\right&amp;gt;_{11})\frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_{2}-\left|1\right&amp;gt;_{2})\\&#xA;=\frac{1}{2}(\left|00\right&amp;gt;_{1}-\left|01\right&amp;gt;_{1}-\left|10\right&amp;gt;_{1}+\left|11\right&amp;gt;_{1})\frac{1}{\sqrt{2}}(\left|0\right&amp;gt;_{2}-\left|1\right&amp;gt;_{2})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this can help you to clarify your problem.&lt;/p&gt;&#xA;" OwnerUserId="10455" LastActivityDate="2020-03-24T15:08:45.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10285" PostTypeId="1" AcceptedAnswerId="10289" CreationDate="2020-03-24T18:54:39.860" Score="1" ViewCount="43" Body="&lt;p&gt;In paper &lt;a href=&quot;https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.1998.0162&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulating quantum systems on a quantum computer&lt;/a&gt; the author mention in section 3, simulating a decay to obtain the ground state, and give the Hamiltonian for that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H=H_1+H_2 + H_{1I}\otimes H_{2I}$$&lt;/span&gt;&#xA;My questions are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can you explain this Hamiltonian more explicitly, or refer me to a paper doing that? &lt;/li&gt;&#xA;&lt;li&gt;Are there papers that elaborate this Hamiltonian in a quantum computer?&lt;/li&gt;&#xA;&lt;li&gt;Are there other Hamiltonians expressing the decay process?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Any answer will be more than appreciated, and thank you :)&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:21.633" LastActivityDate="2020-10-27T09:13:21.633" Title="Questions about the Hamiltonian of a decay" Tags="&lt;hamiltonian-simulation&gt;&lt;open-quantum-systems&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10286" PostTypeId="2" ParentId="10275" CreationDate="2020-03-25T01:06:44.237" Score="0" Body="&lt;p&gt;MD5 hashes are not that hard to crack classically, you probably don't &lt;em&gt;need&lt;/em&gt; a quantum computer to do that (for your hash prefix, the pre-image is 2435435 with full hash &lt;strong&gt;9a4f2e9567f170c5&lt;/strong&gt;685b57d8a6c0af6f).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;f(x) = 1 if hash(x) = your hash, and 0 otherwise&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5908/2879&quot;&gt;this excellent answer&lt;/a&gt; for an overview of papers that analyze applying Grover's search to breaking various hashes, and a note on practicality of such attacks.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-03-25T01:06:44.237" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10287" PostTypeId="1" CreationDate="2020-03-25T04:22:18.540" Score="1" ViewCount="61" Body="&lt;p&gt;I am new to GitHub/Python - please tell me how can I run programs in &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/tree/master/test&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/tree/master/test&lt;/a&gt; and its sub directories in Jupyter. I am connected to IBM Q Expereince. I am looking at class &lt;code&gt;QiskitBaseTestCase&lt;/code&gt; and &lt;code&gt;unittest&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am reading on unittest - I see a template (sample fixture)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import unittest&#xA;&#xA;def fun(x):&#xA;    return x + 1&#xA;&#xA;class MyTest(unittest.TestCase):&#xA;    def test(self):&#xA;        self.assertEqual(fun(3), 4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For something like that including the following is sufficient in Jupyter. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;if __name__ == '__main__': &#xA;    unittest.main() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have tried to copy the &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/test/base_test_case.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/blob/master/test/base_test_case.py&lt;/a&gt; into Jupyter and start from there - it hasn't helped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please help - how to run the Qiskit test cases in Jupyter?&lt;/p&gt;&#xA;" OwnerUserId="5175" LastEditorUserId="9006" LastEditDate="2020-03-25T05:08:46.633" LastActivityDate="2020-03-25T05:08:46.633" Title="How can I run programs in test folder Github Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10289" PostTypeId="2" ParentId="10285" CreationDate="2020-03-25T08:16:49.960" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H_{1,2}$&lt;/span&gt; rather than a simple tensor product of terms)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is that if you've got a system (&quot;1&quot;), 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the way to describe decay using unitary evolution (i.e. the result of Hamiltonian dynamics) is to go to the &quot;church of the larger Hilbert space&quot;. You add in an ancilla system (&quot;2&quot;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Section 8.2.3 of Nielsen &amp;amp; Chuang covers this conceptually, although in a slightly different formalism.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;What&lt;/em&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_dissipation&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page&lt;/a&gt; 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!&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Are there papers that elaborate this Hamiltonian in a quantum computer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-25T08:16:49.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10290" PostTypeId="1" CreationDate="2020-03-25T14:36:42.237" Score="3" ViewCount="146" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oL6DS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oL6DS.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;I have followed all steps  described in &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/install-guide/qjupyter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/quantum/install-guide/qjupyter&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I am unable to get through part 3. It is showing syntax error in Python terminal in Jupyter notebook.&#xA;I am not seeing Q# terminal in jupyter notebook (New) folder&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now after so many attempts its showing&lt;a href=&quot;https://i.stack.imgur.com/NVdSP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NVdSP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; I am done with this. I think its better to switch to Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qUcfE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qUcfE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="10471" LastEditorUserId="10471" LastEditDate="2020-03-30T06:09:40.017" LastActivityDate="2021-02-10T04:09:40.937" Title="Installing Q# in jupyter" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="10291" PostTypeId="1" AcceptedAnswerId="10292" CreationDate="2020-03-25T15:27:10.273" Score="0" ViewCount="57" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GOnJb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GOnJb.png&quot; alt=&quot;Enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case I think the answer should be the square of &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi} \cos(\theta)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I try to input this answer it returns &quot;Phi is not a valid variable for this solution&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I go about tackling this question?&lt;/p&gt;&#xA;" OwnerUserId="10472" LastEditorUserId="734" LastEditDate="2020-03-26T08:28:57.263" LastActivityDate="2020-03-26T08:28:57.263" Title="How can I calculate the probability of a quantum system in superposition to be in the &quot;up&quot; state?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10292" PostTypeId="2" ParentId="10291" CreationDate="2020-03-25T16:24:46.717" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have to remember that &lt;span class=&quot;math-container&quot;&gt;$\cos \theta$&lt;/span&gt; is a real number, and its absolute value is just &lt;span class=&quot;math-container&quot;&gt;$|\cos \theta|$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}$&lt;/span&gt; is a complex number (Euler's formula: &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}=\cos \phi + i \sin \phi$&lt;/span&gt;), so its absolute value is 1. The answer will be just &lt;span class=&quot;math-container&quot;&gt;$\cos^2 \theta$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-03-25T16:24:46.717" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10293" PostTypeId="1" AcceptedAnswerId="10297" CreationDate="2020-03-25T19:12:36.050" Score="1" ViewCount="397" Body="&lt;p&gt;I was wondering what was the easiest way to take a &lt;a href=&quot;https://openfermion.readthedocs.io/en/latest/openfermion.html#openfermion.ops.QubitOperator&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubit Hamiltonian&lt;/a&gt;, and get an expectation value estimated with a certain number of shots over a parameterized quantum circuit (or ansatz) with Cirq. &lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2020-03-26T06:32:00.107" LastActivityDate="2020-04-29T21:19:02.330" Title="Cirq: easiest way to compute qubit Hamiltonian expectation value with number of shots" Tags="&lt;cirq&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10294" PostTypeId="1" AcceptedAnswerId="11346" CreationDate="2020-03-25T19:30:31.677" Score="4" ViewCount="94" Body="&lt;p&gt;The max-relative entropy between two states is &lt;a href=&quot;https://arxiv.org/pdf/0803.2770.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;defined&lt;/a&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho\leq \sigma$&lt;/span&gt; should be read as &lt;span class=&quot;math-container&quot;&gt;$\sigma - \rho$&lt;/span&gt; is positive semidefinite. In other words, &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; is the logarithm of the smallest positive real number that satisfies &lt;span class=&quot;math-container&quot;&gt;$\rho\leq\lambda\sigma$&lt;/span&gt;. I would like to understand the following properties of this quantity when the states are bipartite i.e. they live on &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt;. In the following, all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; correspond to quantum states (positive semidefinite matrices with unit trace).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantity known as the &lt;a href=&quot;https://arxiv.org/pdf/0912.3805.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;max-information&lt;/a&gt; that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; has about &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I_{\max}(A:B)_\rho = \min\limits_{\sigma_B} D_{\max}(\rho_{AB}||\rho_A\otimes\sigma_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let the minimum on the right hand side be achieved by the state &lt;span class=&quot;math-container&quot;&gt;$\sigma^\star_B$&lt;/span&gt;. My questions are as follows&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Can someone provide an example of a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\sigma^\star_B \neq \rho_B$&lt;/span&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is it true that &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho_{B}||\sigma^\star_B) \leq D_{\max}(\rho_{B}||\sigma_B)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt; i.e. is the &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; minimizing state preserved under a partial trace?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2021-05-06T12:39:37.113" LastActivityDate="2021-05-06T12:39:37.113" Title="Questions about the relation between max-relative entropy $D_{\max}(\rho||\sigma)$ and max-information" Tags="&lt;information-theory&gt;&lt;entropy&gt;&lt;max-entropy&gt;&lt;relative-entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10295" PostTypeId="1" AcceptedAnswerId="10296" CreationDate="2020-03-25T23:13:24.713" Score="1" ViewCount="294" Body="&lt;p&gt;I'm wondering how a set of three 0-state qubits, each prepared identically, like so:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KcUSj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KcUSj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When considered together, may produce the fraction:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0jB2D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0jB2D.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; along with their combined states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PjXb0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PjXb0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="2879" LastEditDate="2020-03-26T04:58:39.687" LastActivityDate="2020-03-26T04:58:39.687" Title="Simple algebraic explanation for normalizing states" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10296" PostTypeId="2" ParentId="10295" CreationDate="2020-03-26T00:26:44.357" Score="4" Body="&lt;p&gt;The coefficient &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^3}}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{8}$&lt;/span&gt;, and the amplitude will be square root of that, i.e. exactly &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^3}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also obtain that coefficient from the expansion into a tensor product below.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being able to find such representation is exactly the definition of the qubits not being entangled (in other terms, the state is separable).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-03-26T00:26:44.357" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10297" PostTypeId="2" ParentId="10293" CreationDate="2020-03-26T00:28:59.147" Score="1" Body="&lt;p&gt;tl;dr: You need to compute the &lt;strong&gt;average of the parity of the observed bitstrings&lt;/strong&gt;, with an understanding that the circuit was executed with some appended measurement gates like &lt;span class=&quot;math-container&quot;&gt;$V_{measure} U(\theta)$&lt;/span&gt;. Check out footnote 3 for an example implementation in Cirq.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Compute &lt;span class=&quot;math-container&quot;&gt;$\langle Z_0 \rangle$&lt;/span&gt;&lt;/strong&gt;: To do this, you would run your parametrized circuit (call it &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt;), and then you want to do a weighted average of the bit that you observed. If we use the convention that &lt;span class=&quot;math-container&quot;&gt;$Z | 1 \rangle = -1$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$Z | 0 \rangle = +1$&lt;/span&gt;, then computing the expectation value of &lt;span class=&quot;math-container&quot;&gt;$Z_0$&lt;/span&gt; with respect to a single-qubit state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle = c_0 | 0 \rangle + c_1 |1 \rangle$&lt;/span&gt; gives:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle Z_0 \rangle &amp;amp;= \langle \psi | Z_0 | \psi \rangle \\&#xA;&amp;amp;= |c_0|^2 - |c_1|^2&#xA;\end{align}&lt;/span&gt;The squared amplitudes &lt;span class=&quot;math-container&quot;&gt;$|c_i|$&lt;/span&gt; are the probability &lt;span class=&quot;math-container&quot;&gt;$P(i)$&lt;/span&gt; of observing bitstring &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, so if we want to determine this quantity experimentally we would compute&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle \tilde{Z}_0 \rangle &amp;amp;= P(0) - P(1) \\&#xA;&amp;amp;= \frac{n_0 - n_1}{n_0 + n_1}&#xA;\end{align}&lt;/span&gt;where the tilde indicates that this is an &lt;em&gt;estimator&lt;/em&gt; for the expectation value (and therefore carries along with it some statistical baggage) and &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; is the number of bitstring &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; that we observed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;0&quot; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and each bit measured as &quot;1&quot; to &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. The function that converts individual bits to signed eigenvalues is &lt;span class=&quot;math-container&quot;&gt;$f(b) = 1 - 2b$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$b\in \{0,1\}$&lt;/span&gt;. Then the estimator computed for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; repetitions of the circuit is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \tilde{Z}_0 \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$b_k^{(i)}$&lt;/span&gt; is the observed outcome of the k-th qubit for the i-th repetition of the circuit. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compute&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle X_0 \rangle$&lt;/span&gt; - This task is just another way of saying, ``compute &lt;span class=&quot;math-container&quot;&gt;$\langle Z_0 \rangle$&lt;/span&gt; in the x-basis''. So, &lt;em&gt;if you prepend the measurement with a Hadamard that sends the &lt;span class=&quot;math-container&quot;&gt;$|+ \rangle$&lt;/span&gt; state to &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; state&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;&lt;/em&gt;, i.e. run &lt;span class=&quot;math-container&quot;&gt;$H_0 U(\theta)$&lt;/span&gt; as your quantum circuit &lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt; then the computation is identical:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\langle \tilde{X}_0 \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)})&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compute&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle Z_0 Z_1 \rangle$&lt;/span&gt; - 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:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|00 \rangle &amp;amp;\rightarrow 1 \\&#xA;|01 \rangle &amp;amp;\rightarrow -1 \\&#xA;|10 \rangle &amp;amp;\rightarrow -1 \\&#xA;|11 \rangle &amp;amp;\rightarrow 1 \\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \tilde{Z_0 Z_1} \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)}) f(b_1^{(i)})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again, this is just &lt;strong&gt;computing the average parity of bitstrings measured from the circuit output&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Compute&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle \prod_k \sigma_{k,p(k)} \rangle$&lt;/span&gt; - 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 &lt;span class=&quot;math-container&quot;&gt;$k, p(k)$&lt;/span&gt; to represent a the Pauli operator on qubit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; whose identity is described by &lt;span class=&quot;math-container&quot;&gt;$p(k)\in 0, 1, 2, 3$&lt;/span&gt;. So given measurements extracted from &lt;span class=&quot;math-container&quot;&gt;$V_{measure} U(\theta)$&lt;/span&gt; (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:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)}) &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks complicated, but all it is a general formula for stating &lt;strong&gt;the average parity of bitstrings measured from the circuit output&lt;/strong&gt; for a circuit that has been appended with the appropriate measurement gates.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;1 The change of basis operation from basis &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to basis &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is generally the inverse of the operation that rotates any given vector in basis &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; into the corresponding vector in basis &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; - you're shifting your reference frame, not the vector.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2 Read from right to left!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3 To do this efficiently in Cirq, I would probably do something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Compute a pauli product estimator from n repetitions of a circuit prepended by &#xA;# a measurement unitary over N qubits&#xA;measurement_gates = cirq.Circuit(...)&#xA;results = cirq.Simulator().run(circuit + measurement_gates , repetitions=n)&#xA;&#xA;# get the bool-type measurements, shape (n, N).&#xA;bool_outcomes = results.measurements.get(&quot;my_measurement_key&quot;) &#xA;&#xA;#convert to an array of integer representations of the binary arrays, shape (n,).&#xA;int_outcomes = bool_outcomes.dot(1 &amp;lt;&amp;lt; np.arange(bool_outcomes.shape[-1] - 1, -1, -1)) &#xA;&#xA;# Compute the parity of bitstrings averaged over n repetitions.&#xA;expectation_value = np.mean(find_parity(int_outcomes))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;find_parity&lt;/code&gt; is the function defined &lt;a href=&quot;https://www.geeksforgeeks.org/finding-the-parity-of-a-number-efficiently/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2020-04-29T21:19:02.330" LastActivityDate="2020-04-29T21:19:02.330" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10298" PostTypeId="1" AcceptedAnswerId="11864" CreationDate="2020-03-26T11:36:36.257" Score="10" ViewCount="306" Body="&lt;p&gt;I would like to know if exist a quantum algorithm tailored to compute the &lt;a href=&quot;https://en.wikipedia.org/wiki/QR_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;QR decomposition&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; of a matrix? Pointers to relevant papers will be very appreciated.&lt;/p&gt;&#xA;" OwnerUserId="10478" LastEditorUserId="2293" LastEditDate="2020-04-11T18:48:25.097" LastActivityDate="2020-05-05T12:56:12.213" Title="Quantum algorithm for QR and SVD matrix decomposition?" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10299" PostTypeId="2" ParentId="2310" CreationDate="2020-03-26T13:00:29.883" Score="1" Body="&lt;p&gt;There's one more way: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Create two &lt;strong&gt;identical&lt;/strong&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my implementation of the problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://colab.research.google.com/drive/1lMVaXrPUXpy7SyySZ4v9blhRQKhKQaAU&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://colab.research.google.com/drive/1lMVaXrPUXpy7SyySZ4v9blhRQKhKQaAU&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope that helps ;)&lt;/p&gt;&#xA;" OwnerUserId="10479" LastEditorUserId="10479" LastEditDate="2020-03-27T15:24:36.033" LastActivityDate="2020-03-27T15:24:36.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10300" PostTypeId="1" CreationDate="2020-03-26T13:16:49.697" Score="1" ViewCount="48" Body="&lt;p&gt;As part of a Quantum Theory project I have &quot;constructed&quot; an arbitrary 3-qubit basis: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|B_0\right&amp;gt; =\left|000\right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left|B_1\right&amp;gt; = \frac{1}{\sqrt{2}}\cos(x)(\left|100\right&amp;gt; + \left|010\right&amp;gt;) + \sin(x)\left|001\right&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and so on to &lt;span class=&quot;math-container&quot;&gt;$\left|B_6\right&amp;gt;$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The states are orthogonal and form a proper basis set. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I would like to know if (and how) such a measurement can be performed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for your answers!&lt;/p&gt;&#xA;" OwnerUserId="10479" LastEditorUserId="55" LastEditDate="2020-10-27T09:13:05.170" LastActivityDate="2020-10-27T09:13:05.170" Title="Constructing and Measuring in an Arbitrary 3-qubit basis" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;bell-basis&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="10301" PostTypeId="1" CreationDate="2020-03-26T23:38:42.683" Score="0" ViewCount="89" Body="&lt;p&gt;The question is pretty simple. How can I get an input qubit &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; in the state, say &lt;span class=&quot;math-container&quot;&gt;$$\cos{\frac{\pi}{10}}|0⟩ + \sin{\frac{\pi}{10}}|1⟩$$&lt;/span&gt; Or any other sine/cosine mix state? Which gates do I need to use?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8400" LastEditorUserId="8400" LastEditDate="2020-03-26T23:55:00.283" LastActivityDate="2020-03-27T00:02:30.647" Title="Qubit in a mix sin/cosine state" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="10302" PostTypeId="2" ParentId="10301" CreationDate="2020-03-27T00:02:30.647" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_y(\theta) = e^{-i\frac{\theta}{2}Y} = \begin{bmatrix} \cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2} \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gate might be named slightly differently depending on the source; &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia doesn't seem to know it&lt;/a&gt; but &lt;a href=&quot;http://www.vcpc.univie.ac.at/~ian/hotlist/qc/talks/bloch-sphere-rotations.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this primer on rotations on Bloch sphere&lt;/a&gt; lists all rotation gates nicely.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-03-27T00:02:30.647" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="10303" PostTypeId="1" AcceptedAnswerId="10304" CreationDate="2020-03-27T04:52:02.750" Score="2" ViewCount="82" Body="&lt;p&gt;A quantum state can be represented as linear combination of 2 states:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/SHgxz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SHgxz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Chuang and Nielsens book, it states that because the squared amplitudes sum to 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V5hj0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V5hj0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That the combination can be rewritten as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uNJxZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uNJxZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first question is, why exactly is this? And secondly, how is this state represented in the bloch sphere? &#xA;&lt;a href=&quot;https://i.stack.imgur.com/3do7L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3do7L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="9006" LastEditDate="2020-03-27T05:14:05.543" LastActivityDate="2020-03-28T03:24:16.013" Title="How is a qubit represented on a bloch sphere?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10304" PostTypeId="2" ParentId="10303" CreationDate="2020-03-27T05:13:23.743" Score="2" Body="&lt;p&gt;Qubit is described by a vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta \in \mathbb{C}$&lt;/span&gt;. So, you would need four real numbers for representing it. Because of condition &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 +|\beta|^2 = 1$&lt;/span&gt;, number of degrees of freedom is reduced, so you need only three parameters, hence you can describe the qubit in spacce &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-27T05:13:23.743" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10306" PostTypeId="1" AcceptedAnswerId="10309" CreationDate="2020-03-27T10:56:09.650" Score="2" ViewCount="644" Body="&lt;p&gt;In Nielsen &amp;amp; Chuang section 1.2 introduces multiple qubits and Hilbert spaces.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;More generally, we may consider a system of n qubits. The computational basis states&#xA;  of this system are of the form &lt;span class=&quot;math-container&quot;&gt;$|x_1 x_2 ...x_n\rangle$&lt;/span&gt;, and so a quantum state of such a system&#xA;  is specified by &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; amplitudes. For &lt;span class=&quot;math-container&quot;&gt;$n = 500$&lt;/span&gt; this number is larger than the estimated&#xA;  number of atoms in the Universe! Trying to store all these complex numbers would not&#xA;  be possible on any conceivable classical computer. Hilbert space is indeed a big place.&#xA;  In principle, however, Nature manipulates such enormous quantities of data, even for&#xA;  systems containing only a few hundred atoms. It is as if Nature were keeping &lt;span class=&quot;math-container&quot;&gt;$2^{500}$&lt;/span&gt; hidden&#xA;  pieces of scratch paper on the side, on which she performs her calculations as the system&#xA;  evolves. This enormous potential computational power is something we would very much&#xA;  like to take advantage of. But how can we think of quantum mechanics as computation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Okay, but for a &lt;span class=&quot;math-container&quot;&gt;$n=500$&lt;/span&gt; classical bits you still have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; amplitudes, just half as many as the quantum counterpart. And &lt;span class=&quot;math-container&quot;&gt;$2^{500}$&lt;/span&gt; is still really huge. Does saying &lt;em&gt;&quot;Hilbert space is is a big place&quot;&lt;/em&gt; (Carlton Caves) really mean anything on its own? What do I need to add to this to really differentiate from the classical counterpart?&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="2105" LastEditDate="2020-03-27T16:07:18.183" LastActivityDate="2020-03-28T00:47:58.023" Title="Why is Hilbert space considered especially large?" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="10308" PostTypeId="2" ParentId="10306" CreationDate="2020-03-27T11:33:29.250" Score="2" Body="&lt;p&gt;When you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (or classical bits as well) you can represent &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; basis states (or numbers in classical sense). Hence you need &lt;span class=&quot;math-container&quot;&gt;$2^{n+1}$&lt;/span&gt; real numbers to desribe a quantum state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (real and imaginary part of amplitude for each member of the state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider for example &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;. In this case, 3 bits can represent numbers 000, 001, 010, 011, 100, 101, 110 and 111, i.e. eight values (&lt;span class=&quot;math-container&quot;&gt;$2^3$&lt;/span&gt;). The same is true for qubits. Again for 3 qubits you have eight basis states &lt;span class=&quot;math-container&quot;&gt;$|000\rangle, |001\rangle, |010\rangle, |011\rangle, |100\rangle, |101\rangle, |110\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;. And so on for &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$n=5$&lt;/span&gt; etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with increasing number of qubits, vectors describing quantum states dimension and dimension of matrices describing quatum gates increase exponentially.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: I based my answer on typo in question, so here is answer you probably looked for:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;continuous&quot; because qubit is represented by vector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}\alpha \\ \beta\end{pmatrix}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta \in \mathbb{C}$&lt;/span&gt; (of course with condition &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;). So you can save more information to a qubit than to a classical counterpart (in theory infinite amount) and process it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;bigger space for computation&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;To conclude: I would say that saying about Hilbert space size refers to information processing before measurement. Because of &quot;bigger size of space where computation is done&quot; on quantum computer in comparison with classical one, quantum computer are faster (or at least equally fast).&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-27T11:49:08.247" LastActivityDate="2020-03-27T11:49:08.247" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10309" PostTypeId="2" ParentId="10306" CreationDate="2020-03-27T16:23:36.037" Score="2" Body="&lt;p&gt;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 &quot;size&quot; 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 &lt;em&gt;doubly&lt;/em&gt; exponential. In either case, the quantum space is exponentially larger than the classical space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are two different ways of quantifying the &quot;size&quot; of a state space:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The total number of possible states that a system can take on.&lt;/li&gt;&#xA;&lt;li&gt;The number of bits of information required to uniquely specify the system's physical state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The latter quantity is the logarithm (base 2, or another base if you're not using binary) of the former.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical bits can take on &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; different possible values. Specifying the value of each of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits by definition specifies the state of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit system. So the &quot;size&quot; of the state space is &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; according to the first definition and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; according to the second definition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quantum system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is fundamentally different: it assigns an amplitude to &lt;em&gt;each&lt;/em&gt; 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 &quot;theoretical&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.) Since each of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex ampitudes can take on any of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; possible values, the total number of possible quantum states is actually a &lt;em&gt;doubly&lt;/em&gt;-exponential &lt;span class=&quot;math-container&quot;&gt;$d^{2^n}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^n \times \log_2 d$&lt;/span&gt;, which grows exponentially with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;size&quot; and &quot;dimension&quot; of a vector space interchangeably, since to me it's more natural to think of the &quot;size&quot; of a vector space as referring to the number of distinct vectors, which is actually &lt;em&gt;exponential&lt;/em&gt; in the vector space dimension (for a vector space over a finite field).&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-03-27T23:29:07.433" LastActivityDate="2020-03-27T23:29:07.433" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10312" PostTypeId="1" CreationDate="2020-03-27T18:20:48.490" Score="2" ViewCount="66" Body="&lt;p&gt;I had the following problem with an installation of the Cirq.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I typed &lt;code&gt;python -m pip install cirq&lt;/code&gt;, I got the following line:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;&lt;strong&gt;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.&lt;/strong&gt;&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The source of this issue was in a new version of 'sympy' (1.23 instead of 1.22).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a simple solution to remove 'sympy' &#xA;&lt;code&gt;conda uninstall sympy&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and then wrote this code &lt;code&gt;python -m pip install cirq&lt;/code&gt; again. After that, everything works fine. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you correct this bug in the future? &lt;/p&gt;&#xA;" OwnerUserId="10492" LastEditorUserId="9006" LastEditDate="2020-03-27T23:04:10.393" LastActivityDate="2020-03-27T23:04:10.393" Title="A bug during CIRQ installation" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10313" PostTypeId="1" AcceptedAnswerId="10314" CreationDate="2020-03-27T22:09:13.453" Score="1" ViewCount="159" Body="&lt;p&gt;I am wondering what a circuit should look like if I want to prepare the state of the following form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle^{\otimes n} \mapsto \dfrac{&#xA;|1000\ldots0\rangle +&#xA;|0100\ldots0\rangle +&#xA;|0010\ldots0\rangle +&#xA;\ldots + &#xA;|00\ldots001\rangle&#xA;}{\sqrt{n}}&#xA;$$&lt;/span&gt;&#xA;Is this something well-known and trivial?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;ANSWER&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apparently, this question was asked &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4350/general-construction-of-w-n-state&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Q# realization is provided in katas 15-17 &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/blob/master/Superposition/ReferenceImplementation.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-03-28T15:54:06.227" LastActivityDate="2020-03-28T15:54:06.227" Title="Uniform superposition of states with one qubit set to $|1\rangle$ and others to $|0\rangle$" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10314" PostTypeId="2" ParentId="10313" CreationDate="2020-03-27T23:00:08.790" Score="2" Body="&lt;p&gt;Your state is a generalization of so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;W-state&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8766/is-it-possible-to-have-entanglement-between-more-than-two-qubits/8768#8768&quot;&gt;Here&lt;/a&gt; is a implementation of the state for three qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also use method described in paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt; for preparing W-state with any qubits you want.&#xA;When you use this method, set probability of states &lt;span class=&quot;math-container&quot;&gt;$|10\dots0 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\dots 0\rangle$&lt;/span&gt;,...&lt;span class=&quot;math-container&quot;&gt;$|00\dots1 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{n}$&lt;/span&gt; and probability of other states to zero.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="6313" LastEditDate="2020-03-28T07:14:23.183" LastActivityDate="2020-03-28T07:14:23.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10315" PostTypeId="1" CreationDate="2020-03-27T23:49:45.187" Score="2" ViewCount="118" Body="&lt;p&gt;The known decomposition of toffoli gate that can be used on IBM quantum computer is : &#xA;&lt;a href=&quot;https://i.stack.imgur.com/Eu9DG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Eu9DG.png&quot; alt=&quot;decompoition of toffoli&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="10495" LastEditorUserId="9006" LastEditDate="2020-03-28T07:24:44.847" LastActivityDate="2020-03-28T07:24:44.847" Title="Decompose Toffoli gate with minimum cost for IBM quantum computer" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="10317" PostTypeId="1" AcceptedAnswerId="10318" CreationDate="2020-03-28T10:25:45.057" Score="7" ViewCount="623" Body="&lt;p&gt;I want to build a circuit which will implement &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$ A=&#xA;\begin{pmatrix}&#xA;1.5 &amp;amp; 0.5\\&#xA;0.5 &amp;amp; 1.5\\&#xA;\end{pmatrix}&#xA;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t= \pi/2 $&lt;/span&gt;.&#xA;We see that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be written as, &lt;span class=&quot;math-container&quot;&gt;$A=1.5I+0.5X$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; commute, &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}=e^{i(1.5I)t}e^{i(0.5X)t}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Evaluating manually, I get &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}=1/2\begin{pmatrix}&#xA;e^{2it}+e^{it} &amp;amp; e^{2it}-e^{it}\\&#xA;e^{2it}-e^{it} &amp;amp; e^{2it}+e^{it}\\&#xA;\end{pmatrix}.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I decompose the matrix &lt;span class=&quot;math-container&quot;&gt;$&quot;1/2\begin{pmatrix}&#xA;e^{2it}+e^{it} &amp;amp; e^{2it}-e^{it}\\&#xA;e^{2it}-e^{it} &amp;amp; e^{2it}+e^{it}\\&#xA;\end{pmatrix}&quot;$&lt;/span&gt; into elementary quantum gates&lt;/p&gt;&#xA;" OwnerUserId="10368" LastActivityDate="2020-03-30T08:33:27.767" Title="Quantum circuit to implement matrix exponential" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;hhl-algorithm&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="10318" PostTypeId="2" ParentId="10317" CreationDate="2020-03-28T12:37:52.770" Score="3" Body="&lt;p&gt;I think this is enough &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}= e^{i(1.5I)t} e^{i(0.5X)t}$&lt;/span&gt; for constructing the circuit. From &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/extensions/standard/rx.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;rx&lt;/a&gt; and &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/extensions/standard/u3.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;u3&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_x(-t) = e^{i(0.5X)t} \qquad R_x(\theta) = u3(\theta, -\pi/2, \pi/2)$$&lt;/span&gt; &#xA;The &lt;span class=&quot;math-container&quot;&gt;$e^{i(1.5I)t}$&lt;/span&gt; is a global phase gate that can be implemented via the following circuit for q[0] qubit. Here is the whole circuit for the &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Rx part&#xA;circuit.u3(-t, -pi/2, pi/2)&#xA;&#xA;# Global phase part&#xA;circuit.u1(1.5t, q[0])&#xA;circuit.x(q[0])&#xA;circuit.u1(1.5t, q[0])&#xA;circuit.x(q[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The more general approach can be found in this &lt;a href=&quot;https://arxiv.org/abs/1001.3855&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; (especially 4.1 Trotter decomposition).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-28T12:53:33.963" LastActivityDate="2020-03-28T12:53:33.963" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="11319" PostTypeId="1" CreationDate="2020-03-28T16:04:02.983" Score="3" ViewCount="248" Body="&lt;p&gt;&lt;em&gt;Question from exam:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;what is the probability that the result will be 0 (all qubits are zeroes)?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="Taver" LastEditorUserId="9006" LastEditDate="2020-03-28T17:39:47.947" LastActivityDate="2020-03-30T08:37:42.600" Title="What is the probability to get all qubits equal zero after QFT" Tags="&lt;quantum-state&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11320" PostTypeId="1" CreationDate="2020-03-28T18:05:06.540" Score="2" ViewCount="101" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_money&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Money&lt;/a&gt; is an old proposal that solves the forgeability problem of traditional banknotes, by leveraging the No-Cloning Theorem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recently, blockchains solved the &lt;a href=&quot;https://en.wikipedia.org/wiki/Double-spending&quot; rel=&quot;nofollow noreferrer&quot;&gt;Double-Spending problem&lt;/a&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any aspect which make quantum money a superior alternative to blockchain digital currencies? &lt;/p&gt;&#xA;" OwnerUserId="7727" LastEditorUserId="2293" LastEditDate="2021-04-16T22:45:40.307" LastActivityDate="2021-04-16T22:45:40.307" Title="Has Blockchain made Quantum Money obsolete?" Tags="&lt;no-cloning-theorem&gt;&lt;cryptocurrency&gt;&lt;quantum-money&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11321" PostTypeId="2" ParentId="11319" CreationDate="2020-03-28T18:43:15.117" Score="4" Body="&lt;p&gt;By looking to the circuit for the QFT presented in the M. Nielsen and I. Chuang &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt; (Figure 5.1.) we can notice that all controlled rotations can be neglected because for each control rotation gate the control qubits are in &lt;span class=&quot;math-container&quot;&gt;$| 0\rangle$&lt;/span&gt; state (for the case described in the question). Here is the Figure from the &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;book&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CZVpr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CZVpr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So effectively, in this case, we have only Hadamard gates acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. And, of course, Swap gates (will talk about it later). So&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes n} |000...0\rangle = \frac{1}{\sqrt{2^n}} \sum_x{|x\rangle}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; is the notation of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Hadamard gates acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits that are all in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, &lt;span class=&quot;math-container&quot;&gt;$\sum_x{|x\rangle}$&lt;/span&gt; is the sum of all bit strings (from &lt;span class=&quot;math-container&quot;&gt;$|000...0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|111...1\rangle$&lt;/span&gt;). 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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}$&lt;/span&gt;, and therefore equal probabilities &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{1}{\sqrt{2^n}}\right|^2 = \frac{1}{2^n}$&lt;/span&gt;. Thus, the answer is: for 10 qubits we will measure all qubits in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state with &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{10}} \approx 0.001$&lt;/span&gt; probability.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-29T10:32:48.357" LastActivityDate="2020-03-29T10:32:48.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11322" PostTypeId="2" ParentId="11319" CreationDate="2020-03-28T18:45:44.740" Score="3" Body="&lt;p&gt;When input state to QFT is &lt;span class=&quot;math-container&quot;&gt;$|00\dots0\rangle$&lt;/span&gt; then no controlled gates in QFT work as each control qubit is set to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. However, there are also Hadamard gates on each qubit. As a result, QFT behaves as &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; and produces superposition consisting of all basis state with same probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is number of input qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your case &lt;span class=&quot;math-container&quot;&gt;$n=10$&lt;/span&gt;, hence probability that state &lt;span class=&quot;math-container&quot;&gt;$|00\dots0\rangle$&lt;/span&gt; is preserved after QFT application is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{1024}.$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-28T18:45:44.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11323" PostTypeId="1" AcceptedAnswerId="11325" CreationDate="2020-03-29T01:58:49.923" Score="2" ViewCount="33" Body="&lt;p&gt;The paper &lt;a href=&quot;https://arxiv.org/pdf/1509.03962.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Fully Fault-Tolerant Representation of Quantum Circuits&lt;/a&gt; uses the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; gate which is given as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P = \begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; i\\\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nielsen and Chuang Quantum Computation and  Information 10th edition uses the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate which is also given as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S = \begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; i\\\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why does the same gate has different names?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-03-29T06:56:37.553" Title="S gate vs P gate?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11324" PostTypeId="1" AcceptedAnswerId="11328" CreationDate="2020-03-29T02:27:26.777" Score="1" ViewCount="123" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3do7L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3do7L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where are magnitude and phase of a qbit on Bloch sphere?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Does it means that Z axis represent magnitude/amplitudes, and X and Y represent phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do we need 2 axis (X and Y) to represent phase?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="9006" LastEditDate="2020-03-29T06:50:46.450" LastActivityDate="2020-03-29T10:53:14.247" Title="Bloch sphere, where are magnitude and phase of a qbit?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11325" PostTypeId="2" ParentId="11323" CreationDate="2020-03-29T06:48:35.603" Score="3" Body="&lt;p&gt;Denoting phase gate by &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; probably comes from its name &lt;em&gt;Phase&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase gate is usually denoted by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as you can see from your Nielsen and Chuang book example. Moreoer, symbol &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is used also on IBM Q.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To sum up, it is a matter of a paper's author decission. As I remember, I have seen phase gate denoted by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; only.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-29T06:56:37.553" LastActivityDate="2020-03-29T06:56:37.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11326" PostTypeId="1" AcceptedAnswerId="11327" CreationDate="2020-03-29T08:08:42.577" Score="0" ViewCount="57" Body="&lt;p&gt;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.&lt;a href=&quot;https://i.stack.imgur.com/JzvbW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JzvbW.png&quot; alt=&quot;The screenshot of the lecture.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11505" LastEditorUserId="9006" LastEditDate="2020-03-29T08:54:59.287" LastActivityDate="2020-03-29T09:46:31.030" Title="Creating Bell states (a question from tutorial)" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-04-13T16:23:54.247" ContentLicense="CC BY-SA 4.0" />
  <row Id="11327" PostTypeId="2" ParentId="11326" CreationDate="2020-03-29T09:46:31.030" Score="2" Body="&lt;p&gt;There is no measurement in the picture; the picture shows how to construct 4 Bell states &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt; using Hadamard-CNOT circuit.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-03-29T09:46:31.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11328" PostTypeId="2" ParentId="11324" CreationDate="2020-03-29T10:31:15.877" Score="2" Body="&lt;p&gt;An arbitrary 1 qubit pure state can be represented as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \cos(\theta /2) |0\rangle + e^{i\varphi} \sin(\theta/2) |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$0 \leq \theta \leq \pi$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0 \leq \phi &amp;lt; 2 \pi$&lt;/span&gt;. The amplitude of the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state is &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta /2)$&lt;/span&gt; and the amplitude of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state is &lt;span class=&quot;math-container&quot;&gt;$e^{i\varphi} \sin(\theta/2)$&lt;/span&gt;. The phase of the qubit is &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; as presented in the question. The length of the vector is equal to &lt;span class=&quot;math-container&quot;&gt;$|\cos(\theta /2)|^2 + |e^{i\varphi}\sin(\theta /2)|^2 = 1$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; are both angles and they need planes for defining them. Thus, we need all X, Y, Z axis. &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is the angle defined in the XY plane and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the angle defined in the plane that includes Z axis and the vector that represents the quantum state in the Bloch sphere.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-03-29T10:53:14.247" LastActivityDate="2020-03-29T10:53:14.247" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11329" PostTypeId="2" ParentId="10317" CreationDate="2020-03-29T10:38:45.153" Score="6" Body="&lt;p&gt;There is actually a nice way to do this in Qiskit, since it has decompositions for single-qubit unitaries built in. The &lt;code&gt;QuantumCircuit.squ&lt;/code&gt; method takes a unitary 2x2 matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and a qubit and computes the decomposition &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = R_Z(\alpha) R_Y(\beta) R_Z(\gamma)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a common decomposition, you can find a proof here &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9503016.pdf&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9503016.pdf&lt;/a&gt; in Lemma 4.1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how to do it in Qiskit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.linalg import expm&#xA;from qiskit import QuantumCircuit, QuantumRegister&#xA;&#xA;# define your matrix&#xA;A = np.array([[1.5, 0.5],&#xA;              [0.5, 1.5]])&#xA;t = np.pi / 2&#xA;&#xA;# expm is a matrix exponential &#xA;U = expm(1j * t * A)&#xA;&#xA;# create a 1 qubit circuit&#xA;q = QuantumRegister(1, name='q')&#xA;circuit = QuantumCircuit(q)&#xA;&#xA;# apply a single-qubit unitary gate, this will do the decomposition&#xA;circuit.squ(U, q[0])&#xA;&#xA;# print the circuit components&#xA;print(circuit.decompose().decompose().draw())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will print&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        ┌──────────┐┌───────────┐┌───────────┐&#xA;q_0: |0&amp;gt;┤ Rz(pi/2) ├┤ Ry(-pi/2) ├┤ Rz(-pi/2) ├&#xA;        └──────────┘└───────────┘└───────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So your decomposition would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{iAt} = R_Z\left(\frac{\pi}{2}\right) R_Y\left(-\frac{\pi}{2}\right) R_Z\left(\frac{-\pi}{2}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_Y(\theta) = \begin{pmatrix} &#xA;\cos(\theta / 2) &amp;amp; -\sin(\theta / 2) \\&#xA;\sin(\theta / 2) &amp;amp; \cos(\theta / 2)&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_Z(\lambda) = \begin{pmatrix} &#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\lambda}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also drop the last &lt;code&gt;RZ&lt;/code&gt; gate if you don't care about the global phase. That's also supported in Qiskit using the &lt;code&gt;up_to_diagonal&lt;/code&gt; argument:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# apply a single-qubit unitary gate, this will do the decomposition&#xA;circuit.squ(U, q[0], up_to_diagonal=True)&#xA;&#xA;# print the circuit components&#xA;print(circuit.decompose().decompose().draw())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which produces&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;        ┌──────────┐┌───────────┐&#xA;q_0: |0&amp;gt;┤ Rz(pi/2) ├┤ Ry(-pi/2) ├&#xA;        └──────────┘└───────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the implementation in Qiskit: &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/extensions/quantum_initializer/squ.html&quot; rel=&quot;noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/extensions/quantum_initializer/squ.html&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-03-29T10:38:45.153" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11330" PostTypeId="1" AcceptedAnswerId="11333" CreationDate="2020-03-29T13:44:13.693" Score="1" ViewCount="65" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which side do you fall on, is entanglement easy and hard to avoid or hard to do and easily broken? &#xA;Any additional thoughts you could add would be much appreciated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8193" LastActivityDate="2020-03-30T07:56:10.583" Title="Entanglement - Natural and Unavoidable or Difficult to Do and Flimsy?" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="3" ClosedDate="2020-04-12T02:13:28.653" ContentLicense="CC BY-SA 4.0" />
  <row Id="11331" PostTypeId="1" AcceptedAnswerId="11343" CreationDate="2020-03-29T14:36:01.607" Score="3" ViewCount="77" Body="&lt;p&gt;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 &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;\max_{|φ\rangle_A,|ψ\rangle_B} |\langleφ|_A ⊗ \langleψ|_B |ϕ\rangle_{AB}|^2 &amp;lt; 1&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if there is more than one Schmidt coefficient for the state &lt;span class=&quot;math-container&quot;&gt;$|ϕ_{AB}\rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="11510" LastEditorUserId="55" LastEditDate="2020-10-23T06:47:57.943" LastActivityDate="2020-10-23T06:47:57.943" Title="More than one Schmidt coefficient implies entanglement?" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11332" PostTypeId="2" ParentId="11331" CreationDate="2020-03-29T15:55:17.463" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-03-29T15:55:17.463" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11333" PostTypeId="2" ParentId="11330" CreationDate="2020-03-29T17:13:11.353" Score="6" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Uncontrolled entanglement is natural, controlled entanglement requires high technology, and is important for quantum computation.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-03-29T17:13:11.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11334" PostTypeId="1" AcceptedAnswerId="11341" CreationDate="2020-03-29T21:48:20.657" Score="1" ViewCount="25" Body="&lt;p&gt;The book &lt;em&gt;An Introduction to Quantum Computing&lt;/em&gt; (section 10.4.1 Error Models for Quantum Computing) by Phillip Kaye, Raymond Laflamme and Michele Mosca states the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Errors occur on a qubit when its evolution differs from the desired one. This difference can occur due to imprecise control over the&#xA;  qubits or by interaction of the qubits with an environment. By&#xA;  ‘environment’, we mean everything external to the qubit under&#xA;  consideration. A ‘quantum channel’ is a formal description of how&#xA;  qubits in a given setting are affected by their environment.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would like to know what &lt;em&gt;is&lt;/em&gt; the environment and what are the physical characteristics that describe it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore, does the qubit alone generate noise within itself (assuming that no noise is generated from its environment)?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-03-30T07:48:13.637" Title="What is the precise definition of the environment a qubit lives in?" Tags="&lt;quantum-state&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11335" PostTypeId="1" AcceptedAnswerId="11340" CreationDate="2020-03-29T23:30:53.463" Score="3" ViewCount="129" Body="&lt;p&gt;The book &quot;Introduction to Spintronics&quot; 2nd edition says on page 542 that an arbitrary single qubit rotation and a CNOT comprises a universal gate set. Is this true? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastActivityDate="2020-03-30T07:35:36.487" Title="Is $R_x$, $R_y$, $R_z$, and $CNOT$ a Universal gate set?" Tags="&lt;universal-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11336" PostTypeId="2" ParentId="11335" CreationDate="2020-03-30T04:28:04.247" Score="3" Body="&lt;p&gt;&lt;strong&gt;Partial answer (universality):&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Set of gates consisiting of CNOT, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; allows you to approximate any gate arbitrary accuracy. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT is part of your set. Sice &lt;span class=&quot;math-container&quot;&gt;$S = R_z(\pi/2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T=R_z(\pi/4)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H = R_y(\pi/2)Z = R_y(\pi/2)R_z(\pi)$&lt;/span&gt;, your gates are universal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another perspective: &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; allow you to build any rotation of a qubit, hence any single-qubit gate. Together with CNOT you have universal set of gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note: calculation above based on definition of gates on IBM Q.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-30T04:28:04.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11337" PostTypeId="1" CreationDate="2020-03-30T05:31:10.943" Score="3" ViewCount="51" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt; state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{alignedat}{8}&#xA;&amp;amp;\text{Fermionic state}:\qquad&amp;amp;&amp;amp;(|1000\ldots\rangle+|0100\ldots\rangle+|0010\ldots\rangle+\ldots)/\sqrt{n}\\&#xA;&amp;amp;\text{JW encoded state}:\qquad&amp;amp;&amp;amp;(|1000\ldots\rangle+|0100\ldots\rangle+|0010\ldots\rangle+\ldots)/\sqrt{n} = U_{W_n} (|0\rangle^{\otimes n})&#xA;\end{alignedat}&#xA;$$&lt;/span&gt;&#xA;How do I prepare such a state in the Bravyi-Kitaev encoding?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far I know how to construct:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The BK code matrix &lt;span class=&quot;math-container&quot;&gt;$\beta_n$&lt;/span&gt; (as defined &lt;a href=&quot;https://arxiv.org/abs/1208.5986&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). For each fermionic state, it gives the corresponding qubit state.&lt;/li&gt;&#xA;&lt;li&gt;A circuit &lt;span class=&quot;math-container&quot;&gt;$U_{W_n}$&lt;/span&gt; implementing the &lt;span class=&quot;math-container&quot;&gt;$W_n$&lt;/span&gt; transformation — which does the job in the case of JW encoding.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;My guess is that I should somehow implement a unitary gate which would do sort of a BK transform of the qubits...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, given some superposition of the fermionic states (the one which, in the JW language, can be prepared from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; by a known operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;), how do I construct the corresponding BK-encoded state?&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-03-30T05:38:26.927" LastActivityDate="2020-03-30T05:38:26.927" Title="&quot;$W_n$ state&quot; in Bravyi-Kitaev encoding" Tags="&lt;simulation&gt;&lt;openfermion&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11338" PostTypeId="1" AcceptedAnswerId="11339" CreationDate="2020-03-30T05:39:50.033" Score="1" ViewCount="283" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method 1:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wWTjD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wWTjD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Method 2:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/soObP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/soObP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9676" LastEditorUserId="55" LastEditDate="2020-07-27T12:26:50.463" LastActivityDate="2020-07-27T12:26:50.463" Title="Entanglement Swapping Circuit" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;&lt;teleportation&gt;&lt;entanglement-swapping&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11339" PostTypeId="2" ParentId="11338" CreationDate="2020-03-30T06:45:16.907" Score="3" Body="&lt;p&gt;There is a mistake in design of the first circuit. Both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate work when value 1 is in classical register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; should work in case qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Similarly &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; acts when &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Also you have to deal with state when both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; have to act. In your case you conditioned both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on &lt;code&gt;c==1&lt;/code&gt;. It means that both gates act in case &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Another mistake come from measuring qubits &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; in the first circuit while not to measure them in the second one (in this case they are alway zero).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please see here QASM commented code producing results you desired:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[4];&#xA;creg c[5];&#xA;&#xA;//teleport&#xA;h q[0];&#xA;h q[2];&#xA;cx q[0],q[1];&#xA;cx q[2],q[3];&#xA;cx q[1],q[2];&#xA;h q[1];&#xA;&#xA;//measuring q1 and q2&#xA;//for controlled gates&#xA;&#xA;measure q[2] -&amp;gt; c[0];&#xA;measure q[1] -&amp;gt; c[1];&#xA;&#xA;//set q1 and q2 to |0&amp;gt; to&#xA;//emulate they are not measured&#xA;reset q[1];&#xA;reset q[2];&#xA;&#xA;//controlled gates&#xA;  //q1 = |0&amp;gt;, q2 =|1&amp;gt;&#xA;if (c==1) x q[3];&#xA;  //q1 = |1&amp;gt;, q2 =|0&amp;gt;&#xA;if (c==2) z q[3];&#xA;  //q1 = |1&amp;gt;, q2 =|1&amp;gt;&#xA;if (c==3) x q[3];&#xA;if (c==3) z q[3];&#xA;&#xA;//measure qubits&#xA;measure q[3] -&amp;gt; c[3];&#xA;measure q[0] -&amp;gt; c[0];&#xA;measure q[1] -&amp;gt; c[1];&#xA;measure q[2] -&amp;gt; c[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-30T06:45:16.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11340" PostTypeId="2" ParentId="11335" CreationDate="2020-03-30T07:35:36.487" Score="5" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;an arbitrary single qubit rotation and a CNOT comprises a universal gate set. Is this true?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes. If you want to understand &lt;em&gt;why&lt;/em&gt;, 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 &amp;amp; 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-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If so, why isn't this the gate set implemented in commercial quantum computing implementations? &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;In many cases, it &lt;em&gt;is&lt;/em&gt;. Basically, the construction above tells you that you an make an arbitrary single-qubit gate using a sequence such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_z(\theta)R_x(\phi)R_z(\lambda).&#xA;$$&lt;/span&gt;&#xA;To all intents and purposes this is the u3 command in qiskit, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-30T07:35:36.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11341" PostTypeId="2" ParentId="11334" CreationDate="2020-03-30T07:48:13.637" Score="2" Body="&lt;p&gt;The whole point of the system/environment description is that the &quot;system&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Furthermore, does the qubit alone generate noise within itself (assuming that no noise is generated from its environment)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That might come down to a matter of definition. &lt;em&gt;All&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, what about things like the spontaneous emission of an atom? That &lt;em&gt;sounds&lt;/em&gt; like a qubit alone generating its own noise. I'm not an expert on this (I'm relying on &lt;a href=&quot;https://en.wikipedia.org/wiki/Spontaneous_emission&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;!) 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-30T07:48:13.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11342" PostTypeId="2" ParentId="11330" CreationDate="2020-03-30T07:56:10.583" Score="4" Body="&lt;p&gt;I completely agree with kludg's answer. To follow it up:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;entanglement is natural and unavoidable&lt;/p&gt;&#xA;&lt;p&gt;the entanglement bond is flimsy and easy to break&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;These two things are intrinsically linked. Entanglement has a property called &lt;em&gt;monogamy&lt;/em&gt;. If particle &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is entangled to both particles &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, the more it is entangled with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, the less it is entangled with &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. So, another particle comes along and naturally interacts, acquiring a bit of entanglement (natural &amp;amp; unavoidable), the existing entanglement bonds are lessened (i.e. it was flimsy and easy to break).&lt;/p&gt;&#xA;&lt;p&gt;There is a philosophical question that appears regarding the &amp;quot;breaking&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-03-30T07:56:10.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11343" PostTypeId="2" ParentId="11331" CreationDate="2020-03-30T08:16:13.340" Score="1" Body="&lt;p&gt;You're asking how to prove&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;\max_{|φ\rangle_A,|ψ\rangle_B} |\langleφ|_A ⊗ \langleψ|_B |ϕ\rangle_{AB}|^2 &amp;lt; 1&#xA;\end{equation*}&lt;/span&gt;&#xA;as opposed to actually answering the question?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prove this, consider the Schmidt decomposition of &lt;span class=&quot;math-container&quot;&gt;$|ϕ\rangle_{AB}=\sum_i\lambda_i|\phi^i_A\rangle|\phi^i_B\rangle$&lt;/span&gt;, and let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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.&#xA;$$&lt;/span&gt;&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$|\gamma_B\rangle$&lt;/span&gt; has norm 1, &lt;span class=&quot;math-container&quot;&gt;$\langle\gamma_B|\gamma_B\rangle=1$&lt;/span&gt; by the completeness relation of the orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|\phi^i_B\rangle$&lt;/span&gt;. On the other hand, &lt;span class=&quot;math-container&quot;&gt;$|\gamma_A\rangle$&lt;/span&gt; only has norm 1 if &lt;span class=&quot;math-container&quot;&gt;$|\phi_{AB}\rangle$&lt;/span&gt; has one Schmidt coefficient, since otherwise &lt;span class=&quot;math-container&quot;&gt;$\sum_i\lambda_i^2|\langle\varphi|\psi^i_A\rangle|^2&amp;lt;\sum_i|\langle\varphi|\psi^i_A\rangle|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bringing this together for the case of more than one Schmidt coefficient,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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&amp;lt;1&#xA;$$&lt;/span&gt;&#xA;having used the Schwartz inequality.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-30T08:16:13.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11344" PostTypeId="2" ParentId="10317" CreationDate="2020-03-30T08:33:27.767" Score="4" Body="&lt;p&gt;You want to implement&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i3\pi/4}e^{iX\pi/4}.&#xA;$$&lt;/span&gt;&#xA;I would rewrite this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i3\pi/4}He^{iZ\pi/4}H.&#xA;$$&lt;/span&gt;&#xA;This is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-HS^\dagger H&#xA;$$&lt;/span&gt;&#xA;in standard gate terminology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're only implementing the gate &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, then you can neglect the global phase and just implement &lt;span class=&quot;math-container&quot;&gt;$HS^\dagger H$&lt;/span&gt;. Both of these gates are readily implemented in qiskit as &lt;code&gt;sdg&lt;/code&gt; and &lt;code&gt;h&lt;/code&gt;. OK, you can probably implement the basic rotation directly using &lt;code&gt;rx(pi/2,)&lt;/code&gt;, but this construction is far more relevant in the following case (keeping the global phase a little nicer):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're wanting to use this inside something like the HHL algorithm where you actually need controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, then you implement controlled-&lt;span class=&quot;math-container&quot;&gt;$HS^\dagger H$&lt;/span&gt;, and follow it up with a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on the control qubit in order to get the no-longer-global phase correct. Furthermore, note that something like HHL required controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{i2^kAt}$&lt;/span&gt; for various integers &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Well, we've done the &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; case. But from the way I've written things, I think it makes it more obvious that for &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt;, you're just doing controlled-not (&lt;span class=&quot;math-container&quot;&gt;$HS^\dagger HHS^\dagger H=HZH=X$&lt;/span&gt;). And you don't have to do anything at all for larger &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$X^{2^{k-1}}=I$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k\geq 2$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-30T08:33:27.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11345" PostTypeId="2" ParentId="11319" CreationDate="2020-03-30T08:37:42.600" Score="3" Body="&lt;p&gt;The unitary matrix of the Fourier transform is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|.&#xA;$$&lt;/span&gt;&#xA;So, if I apply this to the input state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, I get the answer&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{QFT}|0\rangle=\frac{1}{\sqrt{2^n}}\sum_{y=0}^{2^n-1}|y\rangle.&#xA;$$&lt;/span&gt;&#xA;The amplitude for finding the system is state &lt;span class=&quot;math-container&quot;&gt;$y=0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2^n}$&lt;/span&gt;. Hence the probability of this outcome is &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n=10$&lt;/span&gt;, so the probability is &lt;span class=&quot;math-container&quot;&gt;$1/1024$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-30T08:37:42.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11346" PostTypeId="2" ParentId="10294" CreationDate="2020-03-30T13:30:53.553" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Can someone provide an example of a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\sigma^\star_B \neq \rho_B$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why not start very easily, with a separable state such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}=\left(p_0|0\rangle\langle 0|\otimes \tau_0+p_1|1\rangle\langle 1|\otimes \tau_1\right)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\tau_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau_1$&lt;/span&gt; are different (normalised) single-qubit density matrices. We have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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\}&#xA;$$&lt;/span&gt;&#xA;Now, by construction, this devolves into two separate questions: pick the common &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; such that both &lt;span class=&quot;math-container&quot;&gt;$\lambda\sigma-\tau_i$&lt;/span&gt; are positive semi-definite. However, this is entirely independent of the &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. Hence, the answer must be independent of the &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. By comparison, &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; depends on the &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. Thus, unless the answer is highly degenerate (allowing for all possible linear combinations of the &lt;span class=&quot;math-container&quot;&gt;$\tau_i$&lt;/span&gt;), it cannot be that &lt;span class=&quot;math-container&quot;&gt;$\sigma=\rho_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$\tau_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau_1$&lt;/span&gt; are orthogonal, the best choice must be &lt;span class=&quot;math-container&quot;&gt;$\sigma=(\tau_0+\tau_1)/2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\lambda=2$&lt;/span&gt;. This is certainly not &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$p_0\neq 1/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Is it true that &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho_{B}||\sigma^\star_B) \leq D_{\max}(\rho_{B}||\sigma_B)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt; i.e. is the &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; minimizing state preserved under a partial trace?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This cannot be true, right? &lt;span class=&quot;math-container&quot;&gt;$D_\max(\rho_B\|\rho_B)=0$&lt;/span&gt;. So in any case where &lt;span class=&quot;math-container&quot;&gt;$\sigma^\star\neq \rho_B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$D_\max(\rho_B\|\sigma^\star)&amp;gt;D_\max(\rho_B\|\rho_B)$&lt;/span&gt;. We know, for example, that &lt;span class=&quot;math-container&quot;&gt;$\lambda\geq 1$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\lambda\sigma-\rho)=\lambda-1$&lt;/span&gt;, and if &lt;span class=&quot;math-container&quot;&gt;$\lambda\sigma-\rho$&lt;/span&gt; is going to be non-negative, then the total of the eigenvalues must be non-negative.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-03-30T13:30:53.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11347" PostTypeId="1" CreationDate="2020-03-30T14:07:48.517" Score="3" ViewCount="246" Body="&lt;p&gt;I'm trying to understand the &lt;a href=&quot;https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.2015.0301&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum monte-carlo algorithm&lt;/a&gt; starting at the most basic version. A key step is rotating (Algorithm 1 p.g 8), an ancilla bit by rotation &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; with respect to the value of a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a bit string encoded in &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R|x\rangle|0\rangle = \sum_{x} |x\rangle(\sqrt{1-f(x)}|0\rangle + \sqrt{f(x)}|1\rangle) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting with the simple function &lt;span class=&quot;math-container&quot;&gt;$f(x) \rightarrow y $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y \in [0,1]$&lt;/span&gt;, i.e &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; maps the bit string to its corresponding fractional number, I am trying to find the rotation &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I was thinking along the lines of using a controlled rotation for each bit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$R_y^k|0 \rangle \rightarrow (\sqrt{1-\frac{1}{2^k}}|0\rangle + \sqrt{\frac{1}{2^k}}|1\rangle) $&lt;/span&gt;  however the issue here is that successive rotations aren't additive, so for example the the encoding the bit string &lt;span class=&quot;math-container&quot;&gt;$|x \rangle = \{1,1\} $&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(\{1,1\}) \rightarrow 0.75$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the controlled rotations from the first and second bit would be&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_y^1R_y^2|0 \rangle \neq (\sqrt{1-f(x)}|0\rangle + \sqrt{f(x)}|1\rangle)$&lt;/span&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is due to the nonlinearity of &lt;span class=&quot;math-container&quot;&gt;$\arccos$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\arccos(\sqrt{0.5}) + \arccos(\sqrt{0.25}) \neq \arccos(\sqrt{0.75})$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other approach is to have a controlled rotation for each permutation in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^k$&lt;/span&gt; however this results gates &lt;span class=&quot;math-container&quot;&gt;$O(2^K)$&lt;/span&gt; . &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For this simple &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; what is the best way to derive the circuit for rotation &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; controlled by  &lt;span class=&quot;math-container&quot;&gt;$|x \rangle$&lt;/span&gt; and if there is a circuit that only involves &lt;span class=&quot;math-container&quot;&gt;$O(K)$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---- Current ideas ----&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) Linear approximation of &lt;span class=&quot;math-container&quot;&gt;$\arccos$&lt;/span&gt; for sufficiently small &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; we can apply a linear correction term to approximate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\arccos(a) + \arccos(b) = \arccos(a+b) - \frac{\pi}{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generalising this for a &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; bit system &lt;span class=&quot;math-container&quot;&gt;$\{i_1,i_2, \dots i_K\} $&lt;/span&gt; the correction is &lt;span class=&quot;math-container&quot;&gt;$-\frac{\pi}{2}(1-\sum_ki_k)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case instead of &lt;span class=&quot;math-container&quot;&gt;$f(x) \rightarrow y $&lt;/span&gt; it is required that &lt;span class=&quot;math-container&quot;&gt;$f(x) \rightarrow \sqrt{y} $&lt;/span&gt;, and assuming the linear approximation &lt;span class=&quot;math-container&quot;&gt;$O(K)$&lt;/span&gt; rotations are required to map binary representation of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{y}$&lt;/span&gt; to the ancilla state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Be lazy and implement a qgan neural network that approximates the rotations. Given a &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; bit system this only requires &lt;span class=&quot;math-container&quot;&gt;$2^K$&lt;/span&gt; training values.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-03-30T19:14:23.150" LastActivityDate="2020-03-30T19:14:23.150" Title="Rotations to encode $f(x)$ into ancilla qubit for quantum Monte Carlo" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="11348" PostTypeId="2" ParentId="11347" CreationDate="2020-03-30T14:27:07.653" Score="1" Body="&lt;p&gt;Please have a look at article &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;, chapters 1 and 2. These provides you with construction of general rotation gate controlled by &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits with different rotations angles for each basis state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You also might be interested in some of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9576/quantum-computing-in-finance-list-of-articles&quot;&gt;these articles&lt;/a&gt; on quantum computers application in finance. There are a few articles on Monte Carlo.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-30T14:27:07.653" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11349" PostTypeId="1" AcceptedAnswerId="11350" CreationDate="2020-03-30T15:27:56.990" Score="4" ViewCount="320" Body="&lt;p&gt;As the title states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a Machine Learning Engineer with a background in physics &amp;amp; engineering (post-secondary degrees). I am reading the Tensorflow Quantum paper. They say the following within the paper:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One key observation that has led to&#xA;  the application of quantum computers to machine learning is their ability to perform fast linear algebra on a&#xA;  state space that grows exponentially with the number of&#xA;  qubits. These quantum accelerated linear-algebra based&#xA;  techniques for machine learning can be considered the&#xA;  first generation of quantum machine learning (QML) algorithms tackling a wide range of applications in both supervised and unsupervised learning, including principal&#xA;  component analysis, support vector machines, kmeans clustering, and recommendation systems.&#xA;  These algorithms often admit exponentially faster solutions compared to their classical counterparts on certain&#xA;  types of quantum data. This has led to a significant&#xA;  surge of interest in the subject. &lt;strong&gt;However, to apply&#xA;  these algorithms to classical data, the data must first&#xA;  be embedded into quantum states&lt;/strong&gt;, a process whose&#xA;  scalability is under debate.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What is meant by this sentence &lt;strong&gt;&lt;em&gt;However, to apply these algorithms to classical data, the data must first be embedded into quantum states&lt;/em&gt;&lt;/strong&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there resources that explain this procedure? Any documentation or links to additional readings would be greatly appreciated as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; 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&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5761/how-do-i-embed-classical-data-into-qubits&quot;&gt;How do I embed classical data into qubits?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11517" LastEditorUserId="55" LastEditDate="2020-03-31T10:34:54.663" LastActivityDate="2020-10-16T21:29:05.303" Title="What exactly does it mean to embed classical data into a quantum state?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;programming&gt;&lt;physical-qubit&gt;&lt;embedding&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11350" PostTypeId="2" ParentId="11349" CreationDate="2020-03-30T17:51:34.330" Score="5" Body="&lt;p&gt;First it is instructive to ask oneself: &quot;how does classical data get into my computer?&quot; 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 &lt;code&gt;int&lt;/code&gt; types for integers and &lt;code&gt;float&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, on a quantum computer you run into a fundamental problem: &lt;em&gt;Qubits are really expensive&lt;/em&gt;. When I say &lt;em&gt;really expensive&lt;/em&gt;, 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 &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;noreferrer&quot;&gt;quantum advantage experiment&lt;/a&gt; used a device with &lt;em&gt;53&lt;/em&gt; 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 &quot;quantum float&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \theta \rangle = \frac{1}{\sqrt{2}}(|0\rangle + \mathrm{e}^{i\theta} |1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And this is the heart of &lt;em&gt;embedding data into quantum states&lt;/em&gt;. 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 &lt;a href=&quot;https://arxiv.org/abs/1803.07128&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. One particular example I want to highlight is the so-called &quot;amplitude embedding&quot; where you map the entries of a vector &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{x}$&lt;/span&gt; into the different amplitudes of a quantum state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \boldsymbol{x} \rangle \propto \sum_i x_i | i \rangle&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; elements into &lt;span class=&quot;math-container&quot;&gt;$\log_2 d$&lt;/span&gt; qubits which is a nice feature in our world where qubits are expensive!&lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2020-03-30T17:51:34.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11351" PostTypeId="1" CreationDate="2020-03-30T20:36:23.273" Score="1" ViewCount="36" Body="&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Is it known that QRAC where the &quot;question&quot; is random instead of chosen are impossible? More generally what are the methods to prove impossibility games?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, let's consider the following game: I prepare a &lt;span class=&quot;math-container&quot;&gt;$|+_\theta \rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; a multiple of &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt;, and the goal is to output &lt;span class=&quot;math-container&quot;&gt;$D \in S$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$S = \{\{0,\frac{\pi}{2}\},\{0,\frac{3\pi}{2}\},\{\pi,\frac{\pi}{2}\},\{\pi,\frac{3\pi}{2}\} \}$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\theta \in D$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have two methods, but they are not really perfect:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the first method is to write a semi-definite program (SDP), where we write each possible output as a 2x2 POVM &lt;span class=&quot;math-container&quot;&gt;$\{E_0, E_1, E_2, E_3\}$&lt;/span&gt;, and then we solve agains the constraint that the &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$0.85$&lt;/span&gt;. 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.&lt;/li&gt;&#xA;&lt;li&gt;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 &quot;on the paper&quot;. The problem here is that it can be a bit tedious and long to write, and harder to &quot;automatize&quot;, and it does not prove optimal bounds, just upper bound, or maybe simply impossibility.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Then, I tried to look at the Holevo bound, but it seems that I can't find anything interesting, because from &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; I can extract at most one bit about &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt; is encoded with &lt;span class=&quot;math-container&quot;&gt;$|+_0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|+_{\pi/2}\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|+_{\pi}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|+_{3\pi/2}\rangle$&lt;/span&gt;, then if we know &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; we can know for sure one bit of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, but we cannot say in advance &quot;give me the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;'th bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is my question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) is it known that &quot;randomized&quot; QRAC are impossible?&#xA;2) is there some other bound that could be useful to prove imposibility results?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="5969" LastEditDate="2020-03-31T07:47:46.847" LastActivityDate="2020-03-31T07:47:46.847" Title="Impossibility of QRAC with random question, or more general proof of impossibility" Tags="&lt;qrac&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11352" PostTypeId="1" CreationDate="2020-03-31T05:35:58.220" Score="2" ViewCount="40" Body="&lt;p&gt;Hello and sorry if the question is too layman's here. I haven't found an answer when googling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a programmer with some video encoding background, so I know how much energy is &quot;wasted&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, ... &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11522" LastEditorUserId="11522" LastEditDate="2020-04-01T22:46:20.300" LastActivityDate="2020-04-01T22:46:20.300" Title="Is quantum computing apropriate for video encoding?" Tags="&lt;applications&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11353" PostTypeId="2" ParentId="11338" CreationDate="2020-03-31T06:09:45.157" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1r98C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1r98C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9676" LastActivityDate="2020-03-31T06:09:45.157" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11354" PostTypeId="1" AcceptedAnswerId="11355" CreationDate="2020-03-31T07:41:43.937" Score="3" ViewCount="668" Body="&lt;p&gt;&lt;strong&gt;Question1.&lt;/strong&gt; If there is a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle)$&lt;/span&gt;, and I want to know the angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. What kind of measurement should I do? Could somebody give me the quantum circuit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question2.&lt;/strong&gt; How to perform a measurement with base &lt;span class=&quot;math-container&quot;&gt;$M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle  \right) \right\}$&lt;/span&gt; on IBMQ?  &lt;/p&gt;&#xA;" OwnerUserId="11523" LastEditorUserId="9459" LastEditDate="2020-07-26T19:10:43.840" LastActivityDate="2020-07-30T09:48:29.197" Title="Given a state $|\phi\rangle=\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle)$, how do I know the angle $\theta$?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11355" PostTypeId="2" ParentId="11354" CreationDate="2020-03-31T08:53:06.367" Score="4" Body="&lt;p&gt;&lt;strong&gt;Answer to the first question&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;As mentioned in the comments of the question I assume that we can prepare &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle$&lt;/span&gt; as many as we want. Let's calculate the relative phase for this one qubit &lt;em&gt;pure state&lt;/em&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \frac{1}{\sqrt{2}} \left( |0\rangle + e^{i\theta}|1\rangle\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We are going to execute &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; different experiments in order to estimate &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. In the first experiment we apply this circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_experiment_1.h(q[0])&#xA;circuit_experiment_1.measure(q[0], c[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The state after Hadamard gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probabilities of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;P(0) = \frac{1}{4}\left| 1 + e^{i\theta} \right|^2 = \frac{1}{2}(1 + \cos(\theta))&#xA;\\&#xA;P(1) = \frac{1}{4}\left| 1 - e^{i\theta} \right|^2 = \frac{1}{2}(1 - \cos(\theta))&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From here we can see that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta = \pm \arccos\big(P(0) - P(1)\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because the range of usual principal value arccosine function is equal to &lt;span class=&quot;math-container&quot;&gt;$[0, \pi]$&lt;/span&gt;. So we will need the second experiment in order to estimate the &lt;span class=&quot;math-container&quot;&gt;$sign(\theta)$&lt;/span&gt;. But, before that, how to find &lt;span class=&quot;math-container&quot;&gt;$P(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(1)$&lt;/span&gt; with the described experiment? We will need to execute the circuit &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times (bigger &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; gives better precision) and take into accout these relations between measurement outcomes and probabilities:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;P(0) = \lim_{N \rightarrow \infty} \frac{N_{0}}{N}&#xA;\qquad&#xA;P(1) = \lim_{N \rightarrow \infty} \frac{N_{1}}{N}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$N_{0}$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; measurement outcomes and &lt;span class=&quot;math-container&quot;&gt;$N_{1}$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; measurement outcomes. Also, note that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle X \rangle = \langle \psi | X | \psi \rangle = \langle \psi |H Z H| \psi \rangle = P(0) - P(1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, the formula can be written in this way:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta = \pm \arccos \big( \langle X \rangle \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The sign of the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we should determine the &lt;span class=&quot;math-container&quot;&gt;$sign(\theta)$&lt;/span&gt; with this circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_experiment_2.sdg(q[0])&#xA;circuit_experiment_2.h(q[0])&#xA;circuit_experiment_2.measure(q[0], c[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The state after applying &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with the same logic:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;P'(0) = \frac{1}{4}\left| 1 - ie^{i\theta} \right|^2 = \frac{1}{2}(1 + \sin(\theta))&#xA;\\&#xA;P'(1) = \frac{1}{4}\left| 1 + ie^{i\theta} \right|^2 = \frac{1}{2}(1 - \sin(\theta))&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So after determining the &lt;span class=&quot;math-container&quot;&gt;$P'(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P'(1)$&lt;/span&gt; from the second experiment we will find the sign of the &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$sign(\theta) = sign(\arcsin\left(P'(0) -  P'(1)\right)) = sign(P'(0) -  P'(1))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because the range of usual principal value of arcsine function is &lt;span class=&quot;math-container&quot;&gt;$[-\frac{\pi}{2}, \frac{\pi}{2}]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also, note that for the expectation value of the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operator (as can be seen from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11789/9459&quot;&gt;answer&lt;/a&gt;) we have this relation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle Y \rangle = \langle \psi| Y | \psi\rangle = \langle \psi| S H Z H S^{\dagger} | \psi\rangle = P'(0) -  P'(1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By taking this into account and combining two results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\theta =  sign \big(\langle Y \rangle \big) \arccos \big(\langle X \rangle \big)&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;An approach for finding the relative phase of an arbitrary &lt;em&gt;pure state&lt;/em&gt; is described in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13055/9459&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Answer to the second question&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;Here is the circuit for measuring in &lt;span class=&quot;math-container&quot;&gt;$M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle  \right) \right\}$&lt;/span&gt; basis. I assume here that &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt; is given:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.u1(theta_k, q[0])    # q[0] is one of the qubits&#xA;circuit.h(q[0])&#xA;circuit.measure(q[0], c[0])   #c[0] is a classical bit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If the state was &lt;span class=&quot;math-container&quot;&gt;$M(\theta _k)_+= 1/\sqrt{2}\left( |0\rangle + e^{-i\theta _k}|1\rangle  \right)$&lt;/span&gt;, then the outcome of the circuit will be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and if it was &lt;span class=&quot;math-container&quot;&gt;$M(\theta _k)_-= 1/\sqrt{2}\left( |0\rangle - e^{-i\theta _k}|1\rangle  \right)$&lt;/span&gt;, then the outcome of the circuit will be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. So this way we will be able to measure in &lt;span class=&quot;math-container&quot;&gt;$M{{({{\theta }_{k}})}_{\pm }}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-30T09:48:29.197" LastActivityDate="2020-07-30T09:48:29.197" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11356" PostTypeId="2" ParentId="11354" CreationDate="2020-03-31T10:23:49.623" Score="2" Body="&lt;p&gt;I would just like to share a code for testing a phase measurement on IBM Q:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;//measuring theta in&#xA;//(|0&amp;gt; + |1&amp;gt;*exp(i*theta))&#xA;&#xA;h q[0]; //(|0&amp;gt; + |1&amp;gt;)&#xA;t q[0]; //(|0&amp;gt; + |1&amp;gt;*exp(i*pi/4))&#xA;//s q[0]; //(|0&amp;gt; + |1&amp;gt;*exp(i*pi/2))&#xA;//u1 (pi/8) q[0]; //(|0&amp;gt; + |1&amp;gt;*exp(i*pi/8))&#xA;&#xA;h q[0]; //measurment in Hadamard basis&#xA;&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;Tested on IBM Q Armonk (1 qubit processor).&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; (&lt;em&gt;based on Davit comment&lt;/em&gt;):&#xA;To infer a sign of the phase, a measurement in circular basis (i.e. adding &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9459" LastEditDate="2020-07-30T09:18:19.780" LastActivityDate="2020-07-30T09:18:19.780" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="11357" PostTypeId="1" AcceptedAnswerId="11358" CreationDate="2020-03-31T10:27:52.777" Score="2" ViewCount="81" Body="&lt;p&gt;I am implementing a quantum circuit in Qiskit. I create the equal superposition state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-|00\rangle + |01\rangle + |10\rangle +|11\rangle  &#xA;$$&lt;/span&gt;&#xA;but I want to obtain the quantum state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle - |01\rangle - |10\rangle -|11\rangle . &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, when I have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, I want to put a -1 coefficient in front of every state except &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;. This transformation corresponds to &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; matrix. Which gate(s) should I apply to my circuit to have this transformation?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="9006" LastEditDate="2020-03-31T17:58:21.953" LastActivityDate="2020-03-31T17:58:21.953" Title="Gate corresponding to $-I$" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11358" PostTypeId="2" ParentId="11357" CreationDate="2020-03-31T10:57:37.223" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note that the global phase is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$-1 = \mathrm{e}^{i\pi}$&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;However, in case the state is produced by controlled gate, global phase cannot be neglected. In that case you can implement controlled &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$Z \otimes I$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate is applied on controlling qubit and identity gates on controlled qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to show that &lt;span class=&quot;math-container&quot;&gt;$Z \otimes I$&lt;/span&gt; is controlled global phase &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; (or in other words controlled gate &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C(-I) = \begin{pmatrix} I &amp;amp; O \\ O &amp;amp; -I \end{pmatrix} = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\ &#xA;\end{pmatrix}=&#xA;\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix}= &#xA;Z \otimes I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-03-31T11:03:01.910" LastActivityDate="2020-03-31T11:03:01.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11360" PostTypeId="1" CreationDate="2020-03-31T16:37:20.873" Score="4" ViewCount="95" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the interested: you can subscribe to the Quantum Foundations list by sending an email to &lt;code&gt;quantum-foundations-subscribe@maillist.ox.ac.uk&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this question seems to be related: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4438/resources-to-keep-a-track-on-open-ph-d-positions-in-specific-sub-fields-topics&quot;&gt;Resources to keep a track on open Ph.D. positions in specific sub-fields/topics of quantum computing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2020-04-04T17:09:38.953" Title="Quantum Computing Mailing Lists" Tags="&lt;resource-request&gt;&lt;research&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11361" PostTypeId="1" AcceptedAnswerId="11365" CreationDate="2020-03-31T17:18:30.210" Score="3" ViewCount="63" Body="&lt;p&gt;My main goal is to learn Quantum annealing and quantum optimization in general. This concept is elaborated in &lt;a href=&quot;https://arxiv.org/abs/0801.2193&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. A better example is &lt;a href=&quot;https://arxiv.org/abs/1808.10816&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. I am particularly interested in reading material where the author describes in detail without skipping any step as to &lt;strong&gt;how one maps the cost function of your desired optimization problem into a Hamiltonian that can then be solved using a quantum computer&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please cite videos/books/papers? If there is prereq to learn &lt;strong&gt;mapping costs functions to Hamiltonians&lt;/strong&gt; then please suggest the quickest possible route for the same?&lt;/p&gt;&#xA;" OwnerUserId="11528" LastEditorUserId="5955" LastEditDate="2020-03-31T19:28:54.937" LastActivityDate="2020-04-01T06:43:40.237" Title="Best route to learn quantum annealing as a beginner" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11363" PostTypeId="1" AcceptedAnswerId="11364" CreationDate="2020-03-31T21:07:48.860" Score="2" ViewCount="114" Body="&lt;p&gt;I was reading a wonderful &lt;a href=&quot;https://www.cs.cmu.edu/~odonnell/quantum15/lecture04.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; from John wright on Grover's algorithm. In section 2.3, he makes some simplifications :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Lastly, we are also going to assume that the data is labeled as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit boolean strings in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; rather than being indexed from 1 to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 : &lt;span class=&quot;math-container&quot;&gt;$$f:\{0,1\}^n \rightarrow \{0,1\}$$&lt;/span&gt;&#xA;Which means it either outputs 0 or 1. But then I can't understand the first part. Could someone please explain this to me ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit : thanks for all the answers, I will just explain what I didn't understand. Basically, putting a set to a power of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; means that you apply the &lt;strong&gt;carthesian product&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times. In this case &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; means all the different combinations of bits you can do of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="8746" LastEditDate="2020-04-04T11:52:04.333" LastActivityDate="2020-04-04T11:52:04.333" Title="Need some explanation about a notation in Grover's algorithm" Tags="&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11364" PostTypeId="2" ParentId="11363" CreationDate="2020-03-31T21:31:37.580" Score="1" Body="&lt;p&gt;A black box function (or so-called oracle) in Grovers algrorithm produces state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; when an input fulfil some requirements imposed on it (searching conditions). This means that such input is marked. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (or rather 0 to &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt;) to binary number is straighforward as any decimal number can be expressed as a binary string (see &lt;a href=&quot;https://www.wikihow.com/Convert-from-Decimal-to-Binary&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-03-31T21:31:37.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11365" PostTypeId="2" ParentId="11361" CreationDate="2020-04-01T06:43:40.237" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1811.11538&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Tutorial on Formulating and Using QUBO Models&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising formulations of many NP problems&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;Finally, for quantum annealing, the best resource is the &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/doc_getting_started.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave documentation&lt;/a&gt;. They explain many concepts very well, in a logical order.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-04-01T06:43:40.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11366" PostTypeId="1" AcceptedAnswerId="11367" CreationDate="2020-04-01T07:48:14.407" Score="2" ViewCount="190" Body="&lt;p&gt;I'm trying to solve 2 linear equations with the help of HHL algorithm. I've taken &lt;span class=&quot;math-container&quot;&gt;$A=\begin{pmatrix}&#xA;1.5 &amp;amp; 0.5\\&#xA;0.5 &amp;amp; 1.5\\&#xA;\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b=\begin{pmatrix}&#xA;1\\&#xA;0\\&#xA;\end{pmatrix}$&lt;/span&gt;. I've implemented the circuit &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,%22H%22,%22H%22],[1,1,%22~rh1n%22],[1,1,%22%E2%80%A2%22,%7B%22id%22:%22Rxft%22,%22arg%22:%22-pi/2%22%7D],[],[1,%22~35nf%22],[1,%22%E2%80%A2%22,1,%7B%22id%22:%22Rxft%22,%22arg%22:%22-pi%22%7D],[1,%22Swap%22,%22Swap%22],[1,1,%22H%22],[1,%22~js47%22,%22%E2%80%A2%22],[1,%22H%22],[%7B%22id%22:%22Ryft%22,%22arg%22:%22pi%20%22%7D,1,%22%E2%80%A2%22],[%7B%22id%22:%22Ryft%22,%22arg%22:%22pi/3%22%7D,%22%E2%80%A2%22],[1,%22H%22],[1,%22~3ig4%22,%22%E2%80%A2%22],[1,1,%22H%22],[1,%22Swap%22,%22Swap%22],[1,%22%E2%80%A2%22,1,%7B%22id%22:%22Rxft%22,%22arg%22:%22pi%20%22%7D],[1,%22~utui%22],[1,1,%22%E2%80%A2%22,%7B%22id%22:%22Rxft%22,%22arg%22:%22pi/2%22%7D],[1,1,%22~o3fm%22],[1,%22H%22,%22H%22],[%22|1%E2%9F%A9%E2%9F%A81|%22]],%22gates%22:[%7B%22id%22:%22~rh1n%22,%22name%22:%22U1(3pi/4)%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,-%E2%88%9A%C2%BD+%E2%88%9A%C2%BDi%7D%7D%22%7D,%7B%22id%22:%22~o3fm%22,%22name%22:%22U1(-3pi/4)%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,-%E2%88%9A%C2%BD-%E2%88%9A%C2%BDi%7D%7D%22%7D,%7B%22id%22:%22~35nf%22,%22name%22:%22U1(3pi/2)%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,-i%7D%7D%22%7D,%7B%22id%22:%22~utui%22,%22name%22:%22U1(-3pi/2)%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,i%7D%7D%22%7D,%7B%22id%22:%22~3ig4%22,%22name%22:%22R2%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,i%7D%7D%22%7D,%7B%22id%22:%22~js47%22,%22name%22:%22R2%5Et%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,-i%7D%7D%22%7D]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, on quirk. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I get expectation value of Pauli matrices in the above circuit?&lt;/p&gt;&#xA;" OwnerUserId="10368" LastActivityDate="2020-04-01T09:14:24.807" Title="Quantum circuit to get expectation values of Pauli matrices, given state $|\psi\rangle$" Tags="&lt;circuit-construction&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11367" PostTypeId="2" ParentId="11366" CreationDate="2020-04-01T09:14:24.807" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix, you find the basis vectors of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix. These are &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, with corresponding eigenvalues +1 and -1. You measure in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis many times and find the probability of getting either result, &lt;span class=&quot;math-container&quot;&gt;$p_\pm$&lt;/span&gt;. Then, finally, the expectation value is &lt;span class=&quot;math-container&quot;&gt;$p_+-p_-$&lt;/span&gt; (the numbers multiplying the &lt;span class=&quot;math-container&quot;&gt;$p_{\pm}$&lt;/span&gt; terms correspond to the eigenvalues).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-01T09:14:24.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11368" PostTypeId="2" ParentId="11363" CreationDate="2020-04-01T11:13:27.887" Score="1" Body="&lt;p&gt;According to this &lt;a href=&quot;https://www.math3ma.com/blog/modeling-sequences-with-quantum-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;'s definition, &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; is set of all bit strings of length n (all bit strings from &lt;span class=&quot;math-container&quot;&gt;$00...0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$11...1$&lt;/span&gt;). How I understand, the mentioned &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; function takes an input bit string from &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; set and returns an output bit string from &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^1 = \{0,1\}$&lt;/span&gt; set (&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-01T13:53:10.457" LastActivityDate="2020-04-01T13:53:10.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11369" PostTypeId="1" AcceptedAnswerId="11371" CreationDate="2020-04-01T12:00:47.187" Score="1" ViewCount="70" Body="&lt;p&gt;I am trying to construct an oracle which should accept 10 or 01 (i.e. &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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 &lt;code&gt;{'10': 260, '01': 248, '00': 274, '11': 242}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pmuD8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pmuD8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11538" LastEditorUserId="11538" LastEditDate="2020-04-01T15:16:47.920" LastActivityDate="2020-04-01T15:16:47.920" Title="Construct a orale for XOR" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11370" PostTypeId="1" CreationDate="2020-04-01T12:43:56.370" Score="2" ViewCount="503" Body="&lt;p&gt;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), &lt;strong&gt;I am unable to understand how the data set is inputed to our quantum circuit (QNN)&lt;/strong&gt;. If anyone can please guide me with that, would be great.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11539" LastEditorUserId="55" LastEditDate="2020-10-23T06:47:34.113" LastActivityDate="2020-10-23T06:47:34.113" Title="How is data encoded in a quantum neural network?" Tags="&lt;quantum-gate&gt;&lt;machine-learning&gt;&lt;neural-network&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11371" PostTypeId="2" ParentId="11369" CreationDate="2020-04-01T13:27:11.750" Score="1" Body="&lt;p&gt;I tried to simulate on IBM Q. I realized that input states &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and two &lt;span class=&quot;math-container&quot;&gt;$-a$&lt;/span&gt;. When you calculate probabilites based on the amplitudes, you get same probabilities for all input states because &lt;span class=&quot;math-container&quot;&gt;$a^2 = (-a)^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you mark only one state, for example &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; (e.g. Toffoli gate is the oracle), the algorithm behave as desired since average of amplitudes after marking &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; is not zero.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-01T13:27:11.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11372" PostTypeId="1" AcceptedAnswerId="11378" CreationDate="2020-04-01T18:20:11.923" Score="2" ViewCount="92" Body="&lt;p&gt;In multiples papers or online article on the QAOA algorithm (such as &lt;a href=&quot;https://grove-docs.readthedocs.io/en/latest/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;), I found notation for the Hamiltonian similar to this one :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{ij} \frac{1}{2} (I-\sigma_i^z \sigma_j^z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to interpret the notation &lt;span class=&quot;math-container&quot;&gt;$\sigma_j^z$&lt;/span&gt;. I guess it has something to do with the Pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; but that's all I can understand.&lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="55" LastEditDate="2020-04-02T12:48:32.227" LastActivityDate="2020-04-02T12:48:32.227" Title="What does the notation $\sigma_j^z$ mean for Pauli matrices?" Tags="&lt;pauli-gates&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11373" PostTypeId="2" ParentId="5567" CreationDate="2020-04-01T18:58:10.787" Score="14" Body="&lt;p&gt;&lt;strong&gt;An approach for Hamiltonian simulation:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any Hermitian (Hamiltonian) matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be decomposed by the sum of Pauli products with real coefficients (see this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis&quot;&gt;thread&lt;/a&gt;). An example of 3 qubit Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = 11 \sigma_z \otimes \sigma_z + 7 \sigma_z \otimes \sigma_x - 5\sigma_z \otimes \sigma_x \otimes \sigma_y$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The final circuit for &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt; can be simulated via Trotter decomposition (chapter 4.1 from the paper [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;]):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{iHt} \approx \big(\prod_k e^{i c_k P_k t/N }\big)^{N}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is a parameter that can have either positive or negative values, &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; are the Pauli terms, &lt;span class=&quot;math-container&quot;&gt;$c_k$&lt;/span&gt; are the coefficients of the corresponding &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt;s, &lt;span class=&quot;math-container&quot;&gt;$H = \sum_k c_k P_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the Trotter number. By increasing &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; it is possible to decrease the error of the Trotter decomposition as much as desired [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;]. If all &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; Pauli terms are commuting to each other, then we can take &lt;span class=&quot;math-container&quot;&gt;$N = 1$&lt;/span&gt; (no Trotter decomposition is needed). For this simulation, we need to know how to simulate individual Pauli products &lt;span class=&quot;math-container&quot;&gt;$e^{iP_k t}$&lt;/span&gt;. Let's start with the simplest one &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_z \otimes \sigma_z \otimes ... \otimes \sigma_z t}$&lt;/span&gt; (chapter 4.2 of the paper [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;]). Here is the circuit for &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_z \otimes \sigma_z t}$&lt;/span&gt; from the paper [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;]&lt;/p&gt;&#xA;&lt;p&gt;                                                     &#xA;&lt;img src=&quot;https://i.stack.imgur.com/sBSmQ.png&quot; width=&quot;200&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;'s argument is &lt;span class=&quot;math-container&quot;&gt;$-2t$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$R_z(-2t) = e^{i\sigma_z t}$&lt;/span&gt;). Before showing why this is true let's introduce 2 formulas that we will us. 4.2 exercise from the textbook [&lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;]: Let &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; be a real number and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; a matrix such that &lt;span class=&quot;math-container&quot;&gt;$A^2 = I$&lt;/span&gt;. Then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{iA t} = \cos(t) I + i \sin(t) A$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For all Pauli terms, this &lt;span class=&quot;math-container&quot;&gt;$P_k^2 =I$&lt;/span&gt; is true. So we can use this formula. For CNOT gate we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{CNOT} = |0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes \sigma_x$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By taking these formulas into account let's show that the circuit implements the &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_z \otimes \sigma_z t}$&lt;/span&gt; Pauli term:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;e^{i \sigma_z \otimes \sigma_z t} = \cos(t) I + i \sin(t) \sigma_z \otimes \sigma_z &#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp;\mathrm{CNOT} \left(I \otimes e^{i \sigma_z  t}\right) \mathrm{CNOT}= &#xA;\big[|0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes \sigma_x \big] \\ &#xA;&amp;amp;\big[ \cos(t) I\otimes I + i \sin(t) I \otimes \sigma_z \big]&#xA;\big[|0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes \sigma_x \big] = \\&#xA;&amp;amp;= \cos(t) I + i \sin(t) \sigma_z \otimes \sigma_z &#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, the circuit implements what we want:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i \sigma_z \otimes \sigma_z t} =\mathrm{CNOT} \left(I \otimes e^{i \sigma_z  t}\right) \mathrm{CNOT}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The circuit for the &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_z \otimes \sigma_z \otimes \sigma_z t}$&lt;/span&gt; Pauli term from the same paper [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;]:&lt;/p&gt;&#xA;&lt;p&gt;                                              &#xA;&lt;img src=&quot;https://i.stack.imgur.com/Tq03G.png&quot; width=&quot;250&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;This also can be shown the same way. Moreover, this solution can be generalized for &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_z \otimes \sigma_z \otimes ... \otimes \sigma_z t}$&lt;/span&gt; Pauli term.&lt;/p&gt;&#xA;&lt;p&gt;Now, what if we have one &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; in the tensor product &lt;span class=&quot;math-container&quot;&gt;$P = P_1 \otimes \sigma_x^{(n)} \otimes P_2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt; are also Pauli products, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the qubit number. Note that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;e^{iP_1 \otimes \sigma_x^{(n)} \otimes P_2t} &amp;amp;= \cos(t) I + i \sin(t) P_1 \otimes \sigma_x^{(n)} \otimes P_2 = \\&#xA;&amp;amp;= \cos(t) I + i \sin(t) P_1 \otimes \left(H \sigma_z^{(n)} H\right) \otimes P_2 = \\&#xA;&amp;amp;= H^{(n)} e^{iP_1 \otimes \sigma_z^{(n)} \otimes P_2t} H^{(n)}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H^{(n)}$&lt;/span&gt; is the Hadamard gate acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th qubit. The same can be shown for &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;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)}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H_y$&lt;/span&gt; is a self-inverse gate (that was suggested &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11391/9459&quot;&gt;here&lt;/a&gt;), which has this nice property &lt;span class=&quot;math-container&quot;&gt;$\sigma_y = H_y \sigma_z H_y$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_y = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; -i \\&#xA;i &amp;amp; -1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we can simulate any Pauli term. For example, the circuit for &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_y \otimes \sigma_y \otimes \sigma_x}$&lt;/span&gt; will look like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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]  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;                                         &#xA;&lt;img src=&quot;https://i.stack.imgur.com/RwJTw.png&quot; width=&quot;300&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;By applying appropriate rotations we can bring any Pauli term simulation problem to the simplest &lt;span class=&quot;math-container&quot;&gt;$e^{i \sigma_z \otimes \sigma_z \otimes ... \otimes \sigma_z t}$&lt;/span&gt; Pauli term simulation problem, which solution we already know. With this approach, we can simulate any Pauli term, thus also any Hermitian operator.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Addition&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators in the Pauli product terms&lt;/p&gt;&#xA;&lt;p&gt;Here we will try to show that we can ignore &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators in the Pauli products when we try to construct circuits for them. For example, we will take &lt;span class=&quot;math-container&quot;&gt;$\sigma_z \otimes I \otimes \sigma_z$&lt;/span&gt; operator and show that we can forget about the second qubit and simulate the circuit for &lt;span class=&quot;math-container&quot;&gt;$e^{i\sigma_z \otimes \sigma_z t}$&lt;/span&gt; applied on the first and third qubits. We should proof that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\sigma_z \otimes I \otimes \sigma_z t} = CNOT^{(1,3)}R_z^{(3)}(-2t)CNOT^{(1,3)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the left side we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the right side:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;amp;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] \\&#xA;&amp;amp;\big[ I \otimes I \otimes \big( \cos(t) I + i \sin(t) \sigma_z \big) \big]&#xA;\big[ | 0 \rangle \langle 0 | \otimes I \otimes I  + | 1 \rangle \langle 1 | \otimes I \otimes X \big]=&#xA;\\&#xA;&amp;amp;= \cos(t) I \otimes I \otimes I + \sin(t) \sigma_z \otimes I \otimes \sigma_z&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, they are equal to each other: we can forget about &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operator for constructing a circuit in this case. This solution can be generalized for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators between two &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; terms.&lt;/p&gt;&#xA;&lt;p&gt;Also, let's proof that &lt;span class=&quot;math-container&quot;&gt;$I \otimes P \otimes I$&lt;/span&gt; can be simulated by &lt;span class=&quot;math-container&quot;&gt;$e^{i I \otimes P \otimes I t} = I \otimes e^{i P t} \otimes I$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is some Pauli product:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;amp;e^{i I \otimes P \otimes I t} = \cos(t) I \otimes I \otimes I + i\sin(t) I \otimes P \otimes I &#xA;\\&#xA;&amp;amp;= I \otimes \big( \cos(t) I + i \sin(t) P \big) \otimes = I \otimes e^{i P t} \otimes I&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this manner, it can be shown for general cases that we can ignore &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators when we simulate Pauli terms in the quantum circuits.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Qiskit implementations of the ideas described here can be found in this &lt;a href=&quot;https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb&quot; rel=&quot;noreferrer&quot;&gt;tutorial&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;[&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;]  &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;noreferrer&quot;&gt;J.D. Whitfield,  J. Biamonte, and  A. Aspuru-Guzik,&#xA;Molecular Physics, &amp;quot;Simulation of electronic structure Hamiltonians using&#xA;quantum computers&amp;quot; (2011)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[&lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;] &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;noreferrer&quot;&gt;M.A. Nielsen, I.L. Chuang, Cambridge University Press New York, &amp;quot;Quantum Computation and Quantum Information: 10th Anniversary Edition&#xA;10th&amp;quot; (2011)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-01T17:34:06.143" LastActivityDate="2020-07-01T17:34:06.143" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="11374" PostTypeId="1" AcceptedAnswerId="11375" CreationDate="2020-04-01T21:47:37.957" Score="3" ViewCount="163" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to avoid this apparently random behaviour? Is it possible to control the way the circuit is transpiled?&lt;/p&gt;&#xA;" OwnerUserId="11544" LastActivityDate="2020-04-01T22:23:25.147" Title="Why does not ibm-q-experience transpile a circuit always in the same way?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11375" PostTypeId="2" ParentId="11374" CreationDate="2020-04-01T22:23:25.147" Score="5" Body="&lt;p&gt;The default Qiskit transpiler uses a stochastic swap (&lt;em&gt;StochasticSwap&lt;/em&gt;) 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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-04-01T22:23:25.147" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11376" PostTypeId="1" CreationDate="2020-04-02T00:27:47.643" Score="1" ViewCount="89" Body="&lt;p&gt;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 &quot;simulation&quot; in some of their names. Does that mean that any backend without the word &quot;simulation&quot; in its name is a real quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="11546" LastActivityDate="2020-04-02T00:54:42.613" Title="Real backend for my students?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11377" PostTypeId="2" ParentId="11376" CreationDate="2020-04-02T00:54:42.613" Score="3" Body="&lt;p&gt;The online simulator is called the &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;, all other devices with city names, e.g. &lt;code&gt;ibmq_vigo&lt;/code&gt;, are real quantum devices.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-04-02T00:54:42.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11378" PostTypeId="2" ParentId="11372" CreationDate="2020-04-02T07:53:06.347" Score="6" Body="&lt;p&gt;What &lt;span class=&quot;math-container&quot;&gt;$\sigma^z_i$&lt;/span&gt; means is that you've got a Pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; applied to qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, and nothing else on the other qubits (i.e. the identity). So, you could expand it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I^{\otimes(i-1)}\otimes\sigma^z\otimes I^{n-i}&#xA;$$&lt;/span&gt;&#xA;if your system has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. A term such as &lt;span class=&quot;math-container&quot;&gt;$\sigma^z_i\sigma^z_j$&lt;/span&gt; is then a product of two of these, which is equivalent to the tensor product of &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt; on qubits &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; and identity everywhere else. The summation is usually taken over pairs &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; which are nearest-neighbours on some underlying geometry of the qubits.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-02T07:53:06.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11379" PostTypeId="2" ParentId="5000" CreationDate="2020-04-02T13:45:44.747" Score="1" Body="&lt;p&gt;If you really want to simulate measurement, that's how I would do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A function that finds probability amplitude associated to each eigenstate.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import itertools&#xA;&#xA;from qutip import basis, tensor, snot&#xA;&#xA;def prepareMeasurement(N, psi):&#xA;    # all the spin configurations&#xA;    confs = list(itertools.product([0, 1], repeat=N))&#xA;    # probability distribution&#xA;    P = []&#xA;    for conf in confs:&#xA;        # particular outcome as quantum object&#xA;        psi_ref = tensor([basis(2, m) for m in conf])&#xA;        # probability of this outcome&#xA;        p = np.abs(psi.overlap(psi_ref))**2.&#xA;        # append to the distribution&#xA;        P.append(p)&#xA;    return confs, np.array(P)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then a function that given this amplitude takes &lt;code&gt;n&lt;/code&gt; random measurements.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def simulateMeasurement(confs, P, n):&#xA;    return np.random.choice(range(len(confs)), n, p=P)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;We can test it on a little example, let's create an even superposition of all the eigenstates. They should all have same amplitudes.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;psi0 = tensor([basis(2, 0), basis(2, 0), basis(2, 0)])&#xA;psif = snot(N=3, target=0)*psi0&#xA;psif = snot(N=3, target=1)*psif&#xA;psif = snot(N=3, target=2)*psif&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And this is how we apply our measurement simulation, let's perform &lt;code&gt;10000&lt;/code&gt; measurements. Let's also calculate counts.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;confs, P = prepareMeasurement(3, psif)&#xA;measurements = simulateMeasurement(confs, P, 10000)&#xA;unique, counts = np.unique(measurements, return_counts=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Visualize the data in histogram-like form.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;&#xA;fig, ax = plt.subplots()&#xA;ax.bar(unique, height=counts)&#xA;plt.xticks(unique, [&quot;|{0}&amp;gt;&quot;.format(format(m, '03b')) for m in unique])&#xA;ax.set_title('Testing measurement simulation with QuTip')&#xA;ax.set_ylabel('Count')&#xA;ax.set_xlabel('Measurement')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is what we're getting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WCxQR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WCxQR.png&quot; alt=&quot;histogram&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I included everything in this &lt;a href=&quot;https://gist.github.com/marekyggdrasil/4d7ac49827d764e51e34e7bd1f3e1d08&quot; rel=&quot;nofollow noreferrer&quot;&gt;public gist repository&lt;/a&gt;. Hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="8883" LastEditorUserId="8883" LastEditDate="2020-04-02T14:03:20.503" LastActivityDate="2020-04-02T14:03:20.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11380" PostTypeId="1" CreationDate="2020-04-02T14:07:30.340" Score="2" ViewCount="117" Body="&lt;p&gt;One can check that, with IBM's circuit composer, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate acted on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or on &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; returns the same phase of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;. &lt;strong&gt;Is this a bug?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dm7hh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dm7hh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wKjfN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wKjfN.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11555" LastEditorUserId="9006" LastEditDate="2020-04-02T21:20:14.843" LastActivityDate="2020-04-02T22:34:42.837" Title="Gate Y returns wrong phase in IBM's circuit composer" Tags="&lt;ibm-q-experience&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11381" PostTypeId="1" AcceptedAnswerId="11385" CreationDate="2020-04-02T15:13:30.787" Score="0" ViewCount="55" Body="&lt;p&gt;After placing the Hadamards on the 2 qubits (both initialized in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state) in the circuit, we are given:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$  |\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) $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the above state is run through the &lt;code&gt;f-cnot&lt;/code&gt;, and we are given a superposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$  |\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 ) $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In order to compute whether the function is balanced or not, we can use some factoring:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$  f(0)=f(1) $&lt;/span&gt; we can factor out:&#xA;&lt;span class=&quot;math-container&quot;&gt;$   |\psi_{c}\rangle = \frac{1}{2}(|0_{1}\rangle -|1_{1}\rangle)(|f (0_{2})\rangle - |\tilde f (0_{2})\rangle)&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$  f(0)=\tilde f(1) $&lt;/span&gt; we can factor out:&#xA;&lt;span class=&quot;math-container&quot;&gt;$   |\psi_{c}\rangle = \frac{1}{2}(|0_{1}\rangle +|1_{1}\rangle)(|f (0_{2})\rangle - |\tilde f (0_{2})\rangle)&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How are these two factored-out states for &lt;span class=&quot;math-container&quot;&gt;$ f_1 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \tilde f_1 $&lt;/span&gt;, actually pulled out of the original superposition?  Like, how are they actually factored? &lt;/p&gt;&#xA;" OwnerUserId="8133" LastEditorUserId="2879" LastEditDate="2020-04-03T00:30:30.123" LastActivityDate="2020-04-03T00:30:30.123" Title="How are the two states factored out of Deutsch's circuit?" Tags="&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11382" PostTypeId="1" CreationDate="2020-04-02T19:22:25.443" Score="1" ViewCount="49" Body="&lt;p&gt;I'm simulating the BB84 protocol using &lt;em&gt;simulaqron&lt;/em&gt;. My&#xA;problem is that when Alice and Bob measure in the same basis, they&#xA;don't get the same result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How can I fix this error?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;BB84.py&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from cqc.pythonLib import CQCConnection, qubit&#xA;import numpy as np&#xA;&quot;&quot;&quot;&#xA;BB84 protocol &#xA;&quot;&quot;&quot;&#xA;&#xA;def prepare_qubits(Sender,receiver,key_bit):&#xA;&#xA;   q=qubit(Sender)&#xA;   S_basis=&quot;&quot; # The sender basis&#xA;&#xA;   if key_bit == 1:  #prepare qubits in |1&amp;gt; state&#xA;    q.X() #apply X gate&#xA;   else:&#xA;    pass&#xA;   # convert  to  Hadamard  basis randomly&#xA;   if 0.5 &amp;lt; np.random.random(): &#xA;    q.H() #apply hadamard gate&#xA;    S_basis='H'&#xA;   else:&#xA;    S_basis='S'&#xA;    pass&#xA;   Sender.sendQubit(q,receiver)&#xA;&#xA;   return [q,S_basis]&#xA;&#xA;def receive_qubits(Receiver):&#xA;  #R_basis=[] #Receiver basis&#xA;  # Wait to  receive a qubit&#xA;  q=Receiver.recvQubit()&#xA;  C=&quot;&quot; # for basis choice&#xA;  # If we  chose  the  Hadamard  basis&#xA;  # to  measure in, apply H&#xA;  if 0.5 &amp;lt; np.random.random(): &#xA;   q.H()&#xA;   C='H'&#xA;  else:&#xA;   C='S' #S: Standard Basis&#xA;   pass&#xA;  # Measure  the  qubit  in the  standard&#xA;  # basis  and  store  the  outcome  in m&#xA;  m=q.measure ()&#xA;  return [m,C]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Alice.py&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from cqc.pythonLib import CQCConnection, qubit&#xA;import numpy as np&#xA;from BB84 import *&#xA;from CAC.classical_comm import *&#xA;&#xA;# Establish a connection  to  SimulaQron&#xA;with CQCConnection(&quot;Alice&quot;) as Alice:&#xA;&#xA; print(&quot;***********************BB84 protocol***************************&quot;)&#xA; #Alice.closeClassicalServer()&#xA; m=[] &#xA; B=[]&#xA; S=''&#xA; n=2 #number of qubits&#xA; Alice.sendClassical(&quot;Bob&quot;,n)#send the number of qubits&#xA; key= np.random.randint(0, high=2**n)#to replace with QRNG() function&#xA; k=np.binary_repr(key,n) #binary representation&#xA; print(&quot;Alice's random key&quot;,key)&#xA; print(&quot;Alice's binary key:&quot;,k)&#xA; print(&quot;*********************************&quot;)&#xA; for x in k:&#xA;&#xA;  m.append(str(x))&#xA;  s=prepare_qubits(Alice,&quot;Bob&quot;,x) #send BB84 states&#xA;  #receive a confirmation msg from Bob via the CAC&#xA;  B.append(s[1])&#xA;  S+=str(s[1])&#xA; &quot;&quot;&quot;&#xA; #send Alice's basis to Bob &#xA; ff=S.encode()#conversion to byte&#xA; Alice.sendClassical(&quot;Bob&quot;,ff)&#xA; &quot;&quot;&quot;&#xA;&#xA; print('a basis',B)&#xA;&#xA; #received Bob's Basis&#xA; x=Alice.recvClassical()&#xA; B_basis=list(x.decode())&#xA; print(&quot;Bob basis received&quot;,B_basis)&#xA; #print(B_basis.split(&quot;&quot;))&#xA; aa=sifted_key(B,B_basis,m)&#xA; print(&quot;sifted key&quot;,aa)&#xA;&#xA;&#xA;&#xA; listToStr =&quot;[&quot;+','.join(map(str, aa[1]))+&quot;]&quot;&#xA; ff=listToStr.encode()&#xA; Alice.sendClassical(&quot;Bob&quot;,ff)&#xA;&#xA;&#xA; #Close  connection  to  SimulaQron&#xA; Alice.close()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Bob.py&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from cqc.pythonLib import CQCConnection, qubit&#xA;import numpy as np&#xA;from BB84 import *&#xA;from CAC.classical_comm import *&#xA;import ast&#xA;&#xA;# Establish  connection  to  SimulaQron&#xA;with CQCConnection(&quot;Bob&quot;) as Bob:&#xA; #Bob.closeClassicalServer() #if I want to use my socket functions&#xA; n=Bob.recvClassical()[0] #number of qubits given by Bob (&quot;Eve&quot;)&#xA; key=[]&#xA; B=''&#xA; for i in range(0,n):&#xA;  c=receive_qubits(Bob)&#xA;  #send confirmation to Alice via CAC&#xA;  #print(&quot;out meas.&quot;,c[0])&#xA;  key.append(c[0])&#xA;  B+=str(c[1]) #Bob basis&#xA;&#xA; print(&quot;Bob off&quot;,B)&#xA; #send Basis to Alice&#xA; print(&quot;bob's initial key :&quot;,key)&#xA; ff=B.encode()#conversion to byte&#xA; Bob.sendClassical(&quot;Alice&quot;,ff)&#xA;&#xA; #receive Alice's basis&#xA; a=Bob.recvClassical()&#xA; x=a.decode()&#xA; res = ast.literal_eval(x)&#xA; print(&quot;Alice's Basis received&quot;,res)&#xA; key_s=[]&#xA;&#xA; for c in res:&#xA;  key_s.append(key[c])&#xA;&#xA; print(&quot;final sifted key&quot;,key_s)&#xA;Bob.close()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11560" LastEditorUserId="9006" LastEditDate="2020-04-02T21:23:48.740" LastActivityDate="2020-04-02T21:23:48.740" Title="Why Alice and Bob don't get the same result when they measure in the same basis?" Tags="&lt;measurement&gt;&lt;simulation&gt;&lt;cryptography&gt;&lt;bb84&gt;&lt;qkd&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11383" PostTypeId="2" ParentId="11380" CreationDate="2020-04-02T21:19:12.940" Score="0" Body="&lt;p&gt;Gate &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is described by matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y=&#xA;\begin{pmatrix}&#xA;0 &amp;amp; -i \\&#xA;i &amp;amp; 0&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it acts on qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, it returns state &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 \\i \end{pmatrix}$&lt;/span&gt;, i.e. a phase is &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;. When you do so on IBM Q a state &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 0+0j, 0+1j ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;is returned as you can see in Visualization =&gt; State vector menu in IBM Q composer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For qubit in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the gate returns state &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}-i \\0 \end{pmatrix}$&lt;/span&gt;, i.e. the phase is &lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt;. In IBM Q visualization you can see&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[ 0-1j, 0+0j ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate is implemented correctly on IBM Q.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note, do not be confused by color in bar graph, see state vector description below the graph.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-02T21:19:12.940" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11384" PostTypeId="2" ParentId="11380" CreationDate="2020-04-02T22:34:42.837" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5FJ5f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5FJ5f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="11555" LastActivityDate="2020-04-02T22:34:42.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11385" PostTypeId="2" ParentId="11381" CreationDate="2020-04-03T00:29:36.650" Score="1" Body="&lt;p&gt;Let's see how to get from &lt;span class=&quot;math-container&quot;&gt;$  |\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 ) $&lt;/span&gt; to the case of &lt;span class=&quot;math-container&quot;&gt;$  f(0)=f(1) $&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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 ) = \\ &#xA;= \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 ) = \\&#xA;= \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 ) = \\&#xA;= \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 ) = \\&#xA;= \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) = \\&#xA;= \frac{1}{2} \big(|0_{1}\rangle - |1_{1}\rangle \big) \otimes \big(|f(0_{2})\rangle - |\tilde f(0_{2})\rangle \big)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-04-03T00:29:36.650" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11386" PostTypeId="1" AcceptedAnswerId="11387" CreationDate="2020-04-03T02:21:10.377" Score="0" ViewCount="67" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Consider &lt;span class=&quot;math-container&quot;&gt;$n = 3$&lt;/span&gt; qubits state and &lt;span class=&quot;math-container&quot;&gt;$N = 2^{n}$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;   |\psi_{0}\rangle &amp;amp;=&amp;amp; |i\rangle \otimes \sum_{i = 0}^{N} a_{i}|i\rangle \\&#xA;   |\psi_{0}\rangle &amp;amp;=&amp;amp; |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)&#xA;\end{eqnarray}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want a quantum circuit or algorithm (&lt;span class=&quot;math-container&quot;&gt;$T_{i}|\psi_{0}\rangle = |\psi_{1}\rangle$&lt;/span&gt;) to transform, for example, the target state,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   |\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).&#xA;\end{equation}&lt;/span&gt;&#xA;Please note that the amplitude &lt;span class=&quot;math-container&quot;&gt;$a_{i}$&lt;/span&gt; still the same as before the operation.&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4729" LastEditorUserId="4729" LastEditDate="2020-04-03T06:33:29.083" LastActivityDate="2020-04-03T06:33:29.083" Title="How to switch bit in the quantum state?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11387" PostTypeId="2" ParentId="11386" CreationDate="2020-04-03T06:22:03.350" Score="0" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n!$&lt;/span&gt; such circuits, from which it is hopefully obvious that there is not a compact description for the vast majority.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-03T06:22:03.350" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11388" PostTypeId="2" ParentId="11386" CreationDate="2020-04-03T06:23:01.147" Score="0" Body="&lt;p&gt;You can use a method described in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Authors of the article introduced method how to change an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; with so-called uniformly controlled rotation, i.e. a rotation which rotational angle depends on combination of zeros and ones in controlling register. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method uses &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gates to achive this. &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gates are used for changing amplitudes and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; for changing phase. If you want to change only amplitudes, you can neglected part with &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gates.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-03T06:23:01.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11389" PostTypeId="1" CreationDate="2020-04-03T07:20:20.603" Score="2" ViewCount="49" Body="&lt;p&gt;In Google's Quantum Supremacy experiment, they use &lt;span class=&quot;math-container&quot;&gt;$f_{sim}$&lt;/span&gt;(fermionic-simulation) gates with &lt;span class=&quot;math-container&quot;&gt;$\theta=90°$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi=30°$&lt;/span&gt; as their two-qubit gates. What if we use &lt;span class=&quot;math-container&quot;&gt;$\theta=45°$&lt;/span&gt; for the two-qubit &lt;span class=&quot;math-container&quot;&gt;$f_{sim}$&lt;/span&gt; gates? What will it do to the experiment's complexity?&lt;/p&gt;&#xA;" OwnerUserId="11562" LastEditorUserId="2927" LastEditDate="2020-04-03T22:07:05.910" LastActivityDate="2020-04-03T23:40:04.733" Title="In Google's Quantum Supremacy experiment, what if we use $\theta=45°$ for two-qubit $f_{sim}$ gates?" Tags="&lt;quantum-gate&gt;&lt;quantum-advantage&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11390" PostTypeId="1" AcceptedAnswerId="11403" CreationDate="2020-04-03T07:20:37.453" Score="2" ViewCount="192" Body="&lt;p&gt;I'm given with a Hamiltonian, &lt;span class=&quot;math-container&quot;&gt;$H=H_1+H_2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H_1=\sigma_x\otimes\sigma_z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2=\sigma_y\otimes\sigma_y$&lt;/span&gt;, and want to built a circuit which will implement &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt},t=\pi/6$&lt;/span&gt;. We see that as &lt;span class=&quot;math-container&quot;&gt;$\sigma_x\otimes\sigma_z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_y\otimes\sigma_y$&lt;/span&gt; commutes, so &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}=e^{-i(\sigma_x\otimes\sigma_z)t}e^{-i(\sigma_y\otimes\sigma_y)t}.$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JBwAi.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JBwAi.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jPMhy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jPMhy.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;By referring to answer given &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5567/circuit-construction-for-hamiltonian-simulation&quot;&gt;here&lt;/a&gt;,the first circuit is of &lt;span class=&quot;math-container&quot;&gt;$e^{-i(\sigma_x\otimes\sigma_z)t}$&lt;/span&gt; and the second implements &lt;span class=&quot;math-container&quot;&gt;$e^{-i(\sigma_y\otimes\sigma_y)t}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$Y=\frac {1}{\sqrt{2}} \begin{pmatrix}&#xA;1&amp;amp;1\\&#xA;i&amp;amp;-i\\&#xA;\end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the bottom qubit corresponds to the first in the tensor product.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; commutes, &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_1t}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_2t}$&lt;/span&gt; should also commute. But &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,%22H%22],[%22%E2%80%A2%22,%22X%22],[1,%7B%22id%22:%22Rzft%22,%22arg%22:%22pi/3%22%7D],[%22%E2%80%A2%22,%22X%22],[1,%22H%22],[%22~tamd%22,%22~tamd%22],[%22%E2%80%A2%22,%22X%22],[1,%7B%22id%22:%22Rzft%22,%22arg%22:%22pi/3%22%7D],[%22%E2%80%A2%22,%22X%22],[%22~ihui%22,%22~ihui%22]],%22gates%22:[%7B%22id%22:%22~tamd%22,%22name%22:%22Y%22,%22matrix%22:%22%7B%7B0.7071067811865475,0.7071067811865475%7D,%7B0.7071067811865475i,-0.7071067811865475i%7D%7D%22%7D,%7B%22id%22:%22~ihui%22,%22name%22:%22Y%5Et%22,%22matrix%22:%22%7B%7B0.7071067811865475,-0.7071067811865475i%7D,%7B0.7071067811865475,0.7071067811865475i%7D%7D%22%7D]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, in quirk. Though probabilities are same after both cases, the final state isn't, which indicates &lt;span class=&quot;math-container&quot;&gt;$e^{-i(\sigma_x\otimes\sigma_z)t}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{-i(\sigma_y\otimes\sigma_y)t}$&lt;/span&gt; are not commuting. What's my mistake here?&lt;/p&gt;&#xA;" OwnerUserId="10368" LastEditorUserId="10368" LastEditDate="2020-04-03T08:26:16.843" LastActivityDate="2020-04-04T18:31:14.833" Title="Problem with commutation of $e^{-iH_1t}$ and $e^{-iH_2t}$, where $H_1$ commutes with $H_2$" Tags="&lt;hamiltonian-simulation&gt;&lt;quirk&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11391" PostTypeId="2" ParentId="11390" CreationDate="2020-04-03T08:45:23.313" Score="2" Body="&lt;p&gt;You reversed the order of &lt;span class=&quot;math-container&quot;&gt;$Y^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; compared to the answer you linked. Instead of using the &quot;&lt;span class=&quot;math-container&quot;&gt;$Y^\dagger$&lt;/span&gt;&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$Y \otimes Y$&lt;/span&gt;. (Incidentally, given the confusion w.r.t. the Y axis, it's hard to think of a &lt;em&gt;worse&lt;/em&gt; name than Y for a custom operation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H_{YZ} = (Y + Z) / \sqrt{2} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 &amp;amp; -i \\ i &amp;amp; -1 \end{bmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-04-03T10:17:46.977" LastActivityDate="2020-04-03T10:17:46.977" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11392" PostTypeId="1" AcceptedAnswerId="11393" CreationDate="2020-04-03T13:00:24.627" Score="2" ViewCount="115" Body="&lt;p&gt;In the article &lt;a href=&quot;https://arxiv.org/abs/1911.09682&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Observables for continuous control of the Quantum Approximate Optimization Algorithm via Reinforcement Learning&lt;/a&gt;, the following notation is used to describe an Unitary operation over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(B,\beta) = \prod_{j =1}^n e^{-i \beta \sigma_j^x} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; a real parameter and &lt;span class=&quot;math-container&quot;&gt;$\sigma^x_j$&lt;/span&gt; the pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma^x$&lt;/span&gt; applied to the &lt;span class=&quot;math-container&quot;&gt;$j^{th}$&lt;/span&gt; qubit. I first thought that this should be read as a matrix product, but since it's applied over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, I believe it should be a tensor product, otherwise there's a dimensionality issue. &#xA;I wonder if using the classical matrix product &lt;span class=&quot;math-container&quot;&gt;$\prod_{j =1}^n$&lt;/span&gt; notation instead of the &lt;span class=&quot;math-container&quot;&gt;$\otimes_{j =1}^n$&lt;/span&gt; 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.    &lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="55" LastEditDate="2020-04-04T16:52:34.773" LastActivityDate="2020-04-04T16:52:34.773" Title="What does the notation $U(B,\beta) = \prod_{j =1}^n e^{-i \beta \sigma_j^x} $ mean in the context of QAOA?" Tags="&lt;tensor-product&gt;&lt;notation&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11393" PostTypeId="2" ParentId="11392" CreationDate="2020-04-03T13:09:18.160" Score="5" Body="&lt;p&gt;I think there are two ways that you could denote the same thing. The first is what is done here:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\prod_{j =1}^n e^{-i \beta \sigma_j^x}&#xA;$$&lt;/span&gt;&#xA;The second is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bigotimes_{j-1}^ne^{-i \beta \sigma^x},&#xA;$$&lt;/span&gt;&#xA;which I imagine is what you're thinking of.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first expression, note the subscript on the Pauli matrix. This means that it's an operator over all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, &lt;span class=&quot;math-container&quot;&gt;$$\sigma^x_j=I^{\otimes(j-1)}\otimes \sigma^x\otimes I^{\otimes(n-j)}.$$&lt;/span&gt;&#xA;Hence the matrix product does make sense (and because all terms commute, we don't have to worry about ordering).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-03T13:09:18.160" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11394" PostTypeId="1" CreationDate="2020-04-03T15:40:37.730" Score="0" ViewCount="73" Body="&lt;p&gt;I am reading Nielsen and Chuang's &quot;Quantum Computation and Quantum Information&quot;. 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rtp2A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rtp2A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Part (1) is OK. In part (2) I think there is a typo. According to the answer to &lt;a href=&quot;https://math.stackexchange.com/questions/1362724/algorithm-for-determining-whether-n-ab&quot;&gt;this question&lt;/a&gt;, it should read &quot;&lt;span class=&quot;math-container&quot;&gt;$y=\log_2 N$&lt;/span&gt;&quot; rather than just &quot;&lt;span class=&quot;math-container&quot;&gt;$\log_2 N$&lt;/span&gt;&quot;. Then, what I understand the algorithm is doing in that step is computing &lt;span class=&quot;math-container&quot;&gt;$x=\log_2N/b$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$b \leq L$&lt;/span&gt;. These are &lt;span class=&quot;math-container&quot;&gt;$O(L)$&lt;/span&gt; operations rather than &lt;span class=&quot;math-container&quot;&gt;$O(L^2)$&lt;/span&gt; as it claims. &lt;strong&gt;Where are the other &lt;span class=&quot;math-container&quot;&gt;$O(L)$&lt;/span&gt; operations?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), and computing &lt;span class=&quot;math-container&quot;&gt;$2^x$&lt;/span&gt; takes more than one operation. But if I take into account the complexity of &lt;span class=&quot;math-container&quot;&gt;$2^x$&lt;/span&gt;, then I should also take into account the complexity of division in &lt;span class=&quot;math-container&quot;&gt;$x = \log_2 N/b$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9895" LastEditorUserId="5955" LastEditDate="2020-04-03T16:55:40.803" LastActivityDate="2020-04-03T16:55:40.803" Title="Not sure what do Nielsen and Chuang mean by number of operations" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11396" PostTypeId="2" ParentId="11389" CreationDate="2020-04-03T23:40:04.733" Score="2" Body="&lt;p&gt;I asked Sergio Boxio about this and he noted that this is discussed in the &lt;a href=&quot;https://arxiv.org/abs/1910.11333&quot; rel=&quot;nofollow noreferrer&quot;&gt;supplementary information of the Supremacy paper&lt;/a&gt;. In particular, Figure S47 has a plot of the speedup you get due to imbalance in the Schmidt coefficients as the rotation angle drifts:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5XF9F.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5XF9F.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and equations 103, 104, and 105 show how to compute the relevant coefficients:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/59qBU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/59qBU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-04-03T23:40:04.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11397" PostTypeId="1" AcceptedAnswerId="11421" CreationDate="2020-04-04T14:33:41.557" Score="1" ViewCount="71" Body="&lt;p&gt;maybe you could help me a little about my calculation of a quantum pure state with purification.&#xA;I have this density matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho=&#xA;\begin{pmatrix}&#xA;0.4489 &amp;amp; 0.2304 &amp;amp; 0.2162 &amp;amp; 0\\&#xA;0.2304 &amp;amp; 0.2518 &amp;amp; 0.2399 &amp;amp; 0\\&#xA;0.2162 &amp;amp; 0.2399 &amp;amp; 0.2993 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I calculated the Eigenvectors and Eigenvalues of this matrix:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eigenvalues:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;e=[0.79987375 \space\space 0.16872495 \space\space 0.03140131\space\space 0   ]&#xA;\end{equation}&lt;/span&gt;&#xA;Eigenvectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;eigenvectors=&#xA;\begin{pmatrix}&#xA;0.66857314 &amp;amp; 0.73407551 &amp;amp; 0.11892473 &amp;amp; 0\\&#xA;0.51561267 &amp;amp; -0.34235582 &amp;amp; -0.78545278 &amp;amp; 0\\&#xA;0.53586708 &amp;amp; -0.58645173 &amp;amp; 0.60738854 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After that I used the formula for purification with the computational bases:&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle = \sum \sqrt{p_i} |\phi_i\rangle \otimes \lvert\psi_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;computational bases:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;computational bases=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I put this all in the equation I got this big &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Psi=&#xA;\begin{pmatrix}&#xA;0.59794281 \\&#xA;0.21179379 \\&#xA;0.09495786  \\&#xA;0 \\ &#xA;0.65652529 \\ &#xA;-0.14062656 \\ &#xA;-0.10392167\\&#xA;0\\&#xA;0.10636112\\&#xA;-0.3226337\\&#xA;0.10763176\\&#xA;0\\&#xA;0\\&#xA;0\\&#xA;0\\&#xA;0&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I checked if the Purifiaction is correct, so I calculated the density matrix of &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; and then I traced out B and thought the result is the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, but this is my result:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho=&#xA;\begin{pmatrix}&#xA;0.41140921 &amp;amp; 0.35291256 &amp;amp; 0.00548653 &amp;amp; 0\\&#xA;0.35291256 &amp;amp; 0.461601 &amp;amp; 0.10401436 &amp;amp; 0\\&#xA;0.00548653 &amp;amp; 0.10401436 &amp;amp; 0.12698979 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But this isn´t equal to the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. &#xA;For the calculation of the partial trace i used the qiskit lib and Python:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.quantum_info&#xA;qubits=[0,1]&#xA;rho= qiskit.quantum_info.partial_trace(psi_density,qubits)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;My question is why I didn´t get the origin rho matrix back? Did I make a mistake with the Purity calculation? &#xA;I would be glad to get an explanation for this. &#xA;edit: For Purifiaction is used this piece of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;w, v = LA.eig(rho)&#xA;null_base = np.array([1,0,0,0])&#xA;one_base = np.array([0,1,0,0])&#xA;two_base = np.array([0,0,1,0])&#xA;three_base = np.array([0,0,0,1])&#xA;v_1=v[0]&#xA;v_2=v[1]&#xA;v_3=v[2]&#xA;v_4=v[3]&#xA;v_1_trans = v_1.reshape(-1,1)&#xA;v_2_trans = v_2.reshape(-1,1)&#xA;v_3_trans = v_3.reshape(-1,1)&#xA;v_4_trans = v_4.reshape(-1,1)&#xA;null_base_trans = null_base.reshape(-1,1)&#xA;one_base_trans = one_base.reshape(-1,1)&#xA;two_base_trans = two_base.reshape(-1,1)&#xA;three_base_trans = three_base.reshape(-1,1)&#xA;sum_1 = np.tensordot(v_1_trans, null_base_trans, 0) * np.sqrt(w[0])&#xA;sum_2 = np.tensordot(v_2_trans, one_base_trans, 0) * np.sqrt(w[1])&#xA;sum_3 = np.tensordot(v_3_trans, two_base_trans, 0) * np.sqrt(w[2])&#xA;sum_4 = np.tensordot(v_4_trans, three_base_trans, 0) * np.sqrt(w[3])&#xA;psi=sum_1+sum_2+sum_3+sum_4&#xA;psi=psi.reshape(16,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so w are the eigenvalues and v are the eigenvectors. The trans variables just only make column vectors for tensordot.&lt;/p&gt;&#xA;" OwnerUserId="9930" LastEditorUserId="9930" LastEditDate="2020-04-05T17:56:24.343" LastActivityDate="2020-04-06T07:41:39.883" Title="Need some help with Purity calculation" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11398" PostTypeId="1" AcceptedAnswerId="11799" CreationDate="2020-04-04T14:39:02.833" Score="4" ViewCount="71" Body="&lt;p&gt;I am working on a circuit for a Grover problem and during that I am trying to minimize the used QuBits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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).&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IjK0p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IjK0p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11571" LastEditorUserId="9006" LastEditDate="2020-04-04T14:53:42.820" LastActivityDate="2020-05-01T22:19:52.330" Title="Quantum circuit CCX optimization for Grover" Tags="&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11399" PostTypeId="1" AcceptedAnswerId="11418" CreationDate="2020-04-04T15:17:06.883" Score="2" ViewCount="166" Body="&lt;p&gt;Recently I read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2030/what-exactly-are-anyons-and-how-are-they-relevant-to-topological-quantum-computi&quot;&gt;thread&lt;/a&gt; on topological quantum computers. If I understood correctly, gates in such computers are based on &quot;effects&quot; in two dimensional spaces. Since our space is three dimensional, such topology has to be &quot;simulated&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can 2D materials (like graphene) be used for construction of topological quantum computer (i.e. to produce anyons used for computing)?&lt;/li&gt;&#xA;&lt;li&gt;Could you please provide with link to articles on physical implementation of topological quantum computer?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/546708/two-dimensional-materials-in-quantum-computing&quot;&gt;&lt;strong&gt;Cross-posted on Physics SE&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-25T18:13:50.223" LastActivityDate="2020-04-25T18:13:50.223" Title="Topological quantum computer and two dimensional materials" Tags="&lt;physical-realization&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11400" PostTypeId="2" ParentId="11370" CreationDate="2020-04-04T16:43:22.547" Score="4" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1804.00633&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;, the authors suggest the following general architecture for a QNN:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7wfYv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7wfYv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit starts with the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, encodes a data point &lt;span class=&quot;math-container&quot;&gt;$\textbf{x}$&lt;/span&gt; using a circuit &lt;span class=&quot;math-container&quot;&gt;$S_\textbf{x}$&lt;/span&gt;, and transforms it using a parametrized unitary &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; (using rotations to encode parameters). The result of the classification is then given by the measurement of one of the qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what does the circuit &lt;span class=&quot;math-container&quot;&gt;$S_\textbf{x}$&lt;/span&gt; look like? You have several possibilities, discussed and compared in a recent paper &lt;a href=&quot;https://arxiv.org/abs/2003.01695&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;. The two main ones are &lt;strong&gt;amplitude encoding&lt;/strong&gt; and &lt;strong&gt;angle encoding&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Amplitude encoding (also called wavefunction encoding) consists in the following transformation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_\textbf{x}|0\rangle=\frac{1}{||\textbf{x}||}\sum_{i=1}^{2^n} x_i |i\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where each &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; is a feature (component) of your data point &lt;span class=&quot;math-container&quot;&gt;$\textbf{x}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle\}$&lt;/span&gt; is a basis of your &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit space (like &lt;span class=&quot;math-container&quot;&gt;$|0..00\rangle, |0..01\rangle,...,|1..11\rangle$&lt;/span&gt;). The advantage of this encoding is that you can store &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; features using only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (so in the IBM case, 32 features). The disadvantage is that in general this circuit &lt;span class=&quot;math-container&quot;&gt;$S_{\textbf{x}}$&lt;/span&gt; will have a depth of &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; and be very hard to construct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Angle encoding (also called qubit encoding) consists in the following transformation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_{\textbf{x}} |0\rangle=\bigotimes_{i=1}^n \cos(x_i)|0\rangle + \sin(x_i)|1\rangle.&#xA;$$&lt;/span&gt;&#xA;It can be constructed using a single rotation with angle &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; (normalized to be in &lt;span class=&quot;math-container&quot;&gt;$[-\pi,\pi]$&lt;/span&gt;) for each qubit, and can therefore encode &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; features with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (so in your case only &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; 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 &lt;strong&gt;dense angle encoding&lt;/strong&gt;, that can encode &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; features in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_{\textbf{x}} |0\rangle=\bigotimes_{i=1}^n \cos(x_{2i-1})|0\rangle + e^{ix_{2i}}\sin(x_{2i-1})|1\rangle.&#xA;$$&lt;/span&gt;&#xA;by using a phase gate after each rotation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[1] Maria Schuld, Alex Bocharov, Krysta Svore and Nathan Wiebe, &lt;a href=&quot;https://arxiv.org/abs/1804.00633&quot; rel=&quot;nofollow noreferrer&quot;&gt;Circuit-centric quantum classifiers&lt;/a&gt;, 2018&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Ryan LaRose and Brian Coyle, &lt;a href=&quot;https://arxiv.org/abs/2003.01695&quot; rel=&quot;nofollow noreferrer&quot;&gt;Robust data encodings for quantum classifiers&lt;/a&gt;, 2020&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-04T16:43:22.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11401" PostTypeId="1" CreationDate="2020-04-04T16:52:55.803" Score="2" ViewCount="22" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="5811" LastEditorUserId="10480" LastEditDate="2021-01-30T07:02:13.367" LastActivityDate="2021-01-30T07:02:13.367" Title="Where does the energy go in a Power Rabi experiment with superconducting circuits?" Tags="&lt;physical-realization&gt;&lt;experiment&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11402" PostTypeId="2" ParentId="11360" CreationDate="2020-04-04T17:09:38.953" Score="3" Body="&lt;p&gt;You have those two mailing lists in quantum computing:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputingreport.com/about/qcr-alerts-signup-form/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Report&lt;/a&gt;, which advertises every week news and job posting from their website&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://elist.ornl.gov/mailman/listinfo/qci-external&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Institute at ORNL mailing list&lt;/a&gt;, with news, conferences and job postings in both academia and industry. This one is probably the closer to what you are looking for.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-04T17:09:38.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11403" PostTypeId="2" ParentId="11390" CreationDate="2020-04-04T18:31:14.833" Score="2" Body="&lt;p&gt;I agree that &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is not the best notation. Actually, in the &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; that I was referring in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt; there was a gate &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; that was doing the desired job (it was also not a self-inverse gate). I didn't use the gate from the &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, but I kept the notation. Anyway, I like more Craig Gidney's suggestion to use &lt;span class=&quot;math-container&quot;&gt;$H_{YZ}$&lt;/span&gt; gate. I will edit my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt; to replace Y gate with &lt;span class=&quot;math-container&quot;&gt;$H_{YZ}$&lt;/span&gt; (but I will call it just &lt;span class=&quot;math-container&quot;&gt;$H_y$&lt;/span&gt; in order to have a short name in the circuits).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now, about the question&lt;/strong&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate is different from the definition mentioned in the question. Here are my notations and corresponding Qiskit implementations of those gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;Y  = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; -i \\&#xA;1 &amp;amp; i&#xA;\end{pmatrix} = &amp;amp;u2(0, \pi/2)&#xA;\qquad &#xA;Y^{\dagger}  = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;i &amp;amp; -i&#xA;\end{pmatrix} = u2(\pi/2, \pi) \\&#xA;&amp;amp;u2 = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; e^{i\varphi} \\&#xA;e^{i\lambda} &amp;amp; e^{i(\varphi + \lambda)}&#xA;\end{pmatrix}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;import numpy as np&#xA;&#xA;simulator = Aer.get_backend('statevector_simulator')&#xA;&#xA;q = QuantumRegister(2, 'q')&#xA;&#xA;circuit_xz = QuantumCircuit(q)&#xA;circuit_xz.h(q[0])&#xA;circuit_xz.cx(q[1], q[0])&#xA;circuit_xz.rz(np.pi / 3, q[0])&#xA;circuit_xz.cx(q[1], q[0])&#xA;circuit_xz.h(q[0])&#xA;&#xA;circuit_yy = QuantumCircuit(q)&#xA;circuit_yy.u2(np.pi/2, np.pi, q[0])&#xA;circuit_yy.u2(np.pi/2, np.pi, q[1])&#xA;circuit_yy.cx(q[1], q[0])&#xA;circuit_yy.rz(np.pi / 3, q[0])&#xA;circuit_yy.cx(q[1], q[0])&#xA;circuit_yy.u2(0, np.pi/2, q[0])&#xA;circuit_yy.u2(0, np.pi/2, q[1])&#xA;&#xA;circuit_xz_yy = circuit_xz + circuit_yy&#xA;circuit_yy_xz = circuit_yy + circuit_xz&#xA;&#xA;result_1 = execute(circuit_xz_yy, simulator).result().get_statevector(circuit_xz_yy)&#xA;result_2 = execute(circuit_xz_yy, simulator).result().get_statevector(circuit_xz_yy)&#xA;&#xA;print(&quot;The first result \n{}&quot;.format(result_1))&#xA;print(&quot;\n The second result \n{}&quot;.format(result_1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And here is the output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;The first result &#xA;[ 0.375+0.64951905j  0.375-0.21650635j  -0.125-0.21650635j  0.375-0.21650635j]&#xA;&#xA;The second result &#xA;[ 0.375+0.64951905j  0.375-0.21650635j  -0.125-0.21650635j  0.375-0.21650635j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-04-04T18:31:14.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11404" PostTypeId="1" CreationDate="2020-04-04T19:14:10.223" Score="2" ViewCount="34" Body="&lt;p&gt;I am trying to find the &lt;span class=&quot;math-container&quot;&gt;$T1$&lt;/span&gt; coherence time for different qubits of Rigetti's quantum processor (Aspen 7) using Python. I tried using &lt;code&gt;Specs()&lt;/code&gt; but encountered an error. &lt;/p&gt;&#xA;" OwnerUserId="11572" LastEditorUserId="9006" LastEditDate="2020-04-04T22:17:40.190" LastActivityDate="2020-04-04T22:17:40.190" Title="How to get the $T1$ specs for the Rigetti's quantum processor (Aspen 7)" Tags="&lt;simulation&gt;&lt;rigetti&gt;&lt;pyquil&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11405" PostTypeId="1" AcceptedAnswerId="11407" CreationDate="2020-04-04T19:48:36.303" Score="1" ViewCount="71" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="5955" LastEditDate="2020-04-04T21:27:24.197" LastActivityDate="2020-06-25T07:40:59.750" Title="Is there quantum error correction code package for python" Tags="&lt;error-correction&gt;&lt;qutip&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11406" PostTypeId="2" ParentId="5567" CreationDate="2020-04-04T21:22:47.570" Score="5" Body="&lt;p&gt;&lt;strong&gt;Controlled version of &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Often in the algorithms (e.g. in HHL or PEA), we want to construct not the circuit for Hamiltonian simulation &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt;, but the controlled version of it. For this, we will use the result obtained from the previous &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt;. First of all, note that if we have &lt;span class=&quot;math-container&quot;&gt;$ABC$&lt;/span&gt; circuit, where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; are operators, then the controlled version of that circuit will equal &lt;span class=&quot;math-container&quot;&gt;$cA$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$cB$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$cC$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; denotes control version of an operator. From the previous &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt; we know that &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt; consists of &lt;span class=&quot;math-container&quot;&gt;$e^{iPt}$&lt;/span&gt; terms, where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is some Pauli product. So, for solving the problem we should find a way for constructing controlled versions of &lt;span class=&quot;math-container&quot;&gt;$e^{iPt}$&lt;/span&gt; terms. Here is a general form for the circuit that implements any given &lt;span class=&quot;math-container&quot;&gt;$e^{iPt}$&lt;/span&gt; and the controlled version of it (like was done similarly in this paper [&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;]):&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/hzvy7.png&quot; width=&quot;700&quot; /&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$O_i$&lt;/span&gt; are gates from this set &lt;span class=&quot;math-container&quot;&gt;$\{I, H, H_y\}$&lt;/span&gt;, and they are chosen differently for each Pauli term (see the previous &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt;). The right circuit in the picture implements the controlled version of the &lt;span class=&quot;math-container&quot;&gt;$e^{iPt}$&lt;/span&gt;, because, if control qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state the &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gate will not work and the rest gates will cancel each other (they are self-inverse gates).&lt;/p&gt;&#xA;&lt;p&gt;When we are talking about the controlled version of the circuit we shouldn't forget about &lt;span class=&quot;math-container&quot;&gt;$e^{iIt}$&lt;/span&gt; term (the global phase in the &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt;). We should also construct a circuit that implements controlled version of &lt;span class=&quot;math-container&quot;&gt;$e^{iIt}$&lt;/span&gt;. Let's call it controlled-global phase (&lt;span class=&quot;math-container&quot;&gt;$CGP$&lt;/span&gt;) gate and try to implement it. The effect of &lt;span class=&quot;math-container&quot;&gt;$CGP$&lt;/span&gt; for controlled qubit &lt;span class=&quot;math-container&quot;&gt;$\alpha|0_c\rangle + \beta|1_c\rangle$&lt;/span&gt; acting on multi-qubit &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is the phase. This action can be done just by one Qiskit's &lt;span class=&quot;math-container&quot;&gt;$u1$&lt;/span&gt; phase gate acting on the control qubit [&lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;]:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$u1(t) = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{it}\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;[&lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;]  &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;J.D. Whitfield,  J. Biamonte, and  A. Aspuru-Guzik,&#xA;Molecular Physics, &amp;quot;Simulation of electronic structure Hamiltonians using&#xA;quantum computers&amp;quot; (2011)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[&lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;] &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;M.A. Nielsen, I.L. Chuang, Cambridge University Press New York, &amp;quot;Quantum Computation and Quantum Information: 10th Anniversary Edition&#xA;10th&amp;quot; (2011)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-01T17:34:11.353" LastActivityDate="2020-07-01T17:34:11.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11407" PostTypeId="2" ParentId="11405" CreationDate="2020-04-04T21:31:28.737" Score="3" Body="&lt;p&gt;I think that &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; 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 &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the textbook&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-04-04T21:31:28.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11408" PostTypeId="1" CreationDate="2020-04-04T22:37:04.420" Score="6" ViewCount="1116" Body="&lt;p&gt;For a given state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, how would I work out &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|Z|\psi\rangle$&lt;/span&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I run a quantum circuit and get the counts dictionary on qiskit, I get observables in the Z basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For n=1 qubits, the basis states returned are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with the counts for each state. I would assign +1 to the counts for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and -1 to the counts for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and work out the Z expectation value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For n=2 qubits, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; have eigenvalues +1 and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; &amp;amp;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is extended to n = 3,4,5.. qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is how do I calculate this automatically in qiskit? &lt;/p&gt;&#xA;" OwnerUserId="11574" LastEditorUserId="55" LastEditDate="2020-05-10T07:52:42.133" LastActivityDate="2020-05-25T15:43:01.353" Title="Qiskit - Z expectation value from counts?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11409" PostTypeId="1" AcceptedAnswerId="11668" CreationDate="2020-04-04T23:47:58.013" Score="0" ViewCount="340" Body="&lt;p&gt;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 &quot;minimum search&quot; of Dür and Hoyer. My question is: Is it possible to encode a list with two registers of qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it is possible, I would like to see a general methods with explanations of how to encode a list in a quantum circuit. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ref: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Algorithm for Finding the Minimum&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10192" LastEditorUserId="55" LastEditDate="2020-07-26T18:07:58.377" LastActivityDate="2020-07-26T18:07:58.377" Title="Finding minimum with Grover" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11410" PostTypeId="1" AcceptedAnswerId="11423" CreationDate="2020-04-05T00:45:02.263" Score="1" ViewCount="174" Body="&lt;p&gt;It is easy to see how &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (rotation from the positive z-axis) and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; values and can't see a clear transformation. Geometrically, how does lambda transform the state?&lt;/p&gt;&#xA;" OwnerUserId="11575" LastEditorUserId="9006" LastEditDate="2020-04-05T06:20:09.170" LastActivityDate="2020-04-06T07:55:01.807" Title="$\lambda$ parameter for U3 gate in qiskit Bloch sphere visualisation" Tags="&lt;qiskit&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11411" PostTypeId="2" ParentId="11408" CreationDate="2020-04-05T07:26:35.713" Score="3" Body="&lt;p&gt;A function for finding the expectation value for the &lt;span class=&quot;math-container&quot;&gt;$Z Z  ... Z$&lt;/span&gt; operator. If, for example, one wants to measure the expectation value of the &lt;span class=&quot;math-container&quot;&gt;$Z Z I$&lt;/span&gt;, instead of &lt;span class=&quot;math-container&quot;&gt;$Z Z Z$&lt;/span&gt; than &lt;code&gt;z_index_list&lt;/code&gt; should be provided (&lt;code&gt;z_index_list = [1, 2]&lt;/code&gt;). Note that I have used the Qiskit's &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/3275cae1d8bd7e4628af63b4b697321c7118e15f/qiskit/quantum_info/operators/pauli.py#L75-L81&quot; rel=&quot;nofollow noreferrer&quot;&gt;ordering&lt;/a&gt; for Pauli labels. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def expectation_zzz(counts, shots, z_index_list=None):&#xA;    &quot;&quot;&quot;&#xA;    :param shots: shots of the experiment&#xA;    :param counts: counts obtained from Qiskit's Result.get_counts()&#xA;    :param z_index_list: a list of indexes&#xA;    :return: the expectation value of ZZ...Z operator for given z_index_list&#xA;    &quot;&quot;&quot;&#xA;&#xA;    if z_index_list is None:&#xA;        z_counts = counts&#xA;    else:&#xA;        z_counts = cut_counts(counts, z_index_list)&#xA;&#xA;    expectation = 0&#xA;    for key in z_counts:&#xA;        sign = -1&#xA;        if key.count('1') % 2 == 0:&#xA;            sign = 1&#xA;        expectation += sign * z_counts[key] / shots&#xA;&#xA;    return expectation&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;cut_counts&lt;/code&gt; function that will work if &lt;code&gt;z_index_list&lt;/code&gt; is provided:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def cut_counts(counts, bit_indexes):&#xA;    &quot;&quot;&quot;&#xA;    :param counts: counts obtained from Qiskit's Result.get_counts()&#xA;    :param bit_indexes: a list of indexes&#xA;    :return: new_counts for the  specified bit_indexes&#xA;    &quot;&quot;&quot;&#xA;    bit_indexes.sort(reverse=True) &#xA;    new_counts = {}&#xA;    for key in counts:&#xA;        new_key = ''&#xA;        for index in bit_indexes:&#xA;            new_key += key[-1 - index]&#xA;        if new_key in new_counts:&#xA;            new_counts[new_key] += counts[key]&#xA;        else:&#xA;            new_counts[new_key] = counts[key]&#xA;&#xA;    return new_counts&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;For the arbitrary Pauli term &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; before &lt;span class=&quot;math-container&quot;&gt;$ZZ...Z$&lt;/span&gt; basis measurement one can apply a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, such that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi |P| \psi \rangle = \langle \psi | U^{\dagger} ZZ...Z U | \psi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;like was described in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11789/9459&quot;&gt;answer&lt;/a&gt;. Note that in &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; we can have identities, so, for example, if we have &lt;span class=&quot;math-container&quot;&gt;$XIY$&lt;/span&gt;, we will need such &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, that &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger} ZIZ U = XIY$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Final notes&lt;/strong&gt;: here I assume that we have only one &lt;code&gt;ClassicalRegister&lt;/code&gt;. If we have more then one &lt;code&gt;ClassicalRegister&lt;/code&gt; 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 &lt;code&gt;QuantumRegister&lt;/code&gt;), so, in general the &lt;code&gt;z_index_list&lt;/code&gt; (and &lt;code&gt;bit_indexes&lt;/code&gt;) doesn't coincide with the indexes of the qubits in the &lt;code&gt;QuantumRegister&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-25T15:43:01.353" LastActivityDate="2020-05-25T15:43:01.353" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="11414" PostTypeId="1" AcceptedAnswerId="11424" CreationDate="2020-04-05T16:09:05.260" Score="3" ViewCount="81" Body="&lt;p&gt;In the application of QFT for quantum phase estimation (QPE) of a unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;, one has to perform successive controlled operations using powers of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;. In order not to break the complexity, each of the controlled &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}^{2^i}$&lt;/span&gt; gates must have the same complexity when applying them as &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; to itself &lt;span class=&quot;math-container&quot;&gt;$2^i$&lt;/span&gt; times, applying &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}^{2^i}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$2^i$&lt;/span&gt; times as long as applying &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;, which breaks the complexity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that fundamentally, what I want to do is to implement a unitary which, given a state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\,|y\rangle$&lt;/span&gt; returns the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\,\mathbf{U}^x|y\rangle$&lt;/span&gt;, but I don't know how should I perform this.&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="9006" LastEditDate="2020-04-05T21:26:48.750" LastActivityDate="2020-04-06T07:59:11.463" Title="How to implement exponentiation of a gate without breaking complexity?" Tags="&lt;circuit-construction&gt;&lt;complexity-theory&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11415" PostTypeId="1" AcceptedAnswerId="11433" CreationDate="2020-04-05T19:00:06.637" Score="0" ViewCount="98" Body="&lt;p&gt;I want to create a parameter dependent gate in qiskit and I need to compute some complex operations as &lt;code&gt;sympy.atan2&lt;/code&gt; or &lt;code&gt;sympy.sin&lt;/code&gt; over the parameters but I don't know how &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.circuit import Parameter&#xA;import sympy as sy&#xA;x=Parameter('x')&#xA;theta=Parameter('θ')&#xA;phase=sy.atan2(sy.N(x)*sy.sin(theta),sy.cos(theta))&#xA;circuit = QuantumCircuit(3,3)&#xA;circuit.cu1(phase,0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but I obtain &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CircuitError: 'invalid param type atan2 in instruction cu1'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11581" LastEditorUserId="9459" LastEditDate="2020-04-05T21:19:57.073" LastActivityDate="2020-04-06T16:11:15.663" Title="How to perform operations like sin over Qiskit parameters" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11416" PostTypeId="2" ParentId="11414" CreationDate="2020-04-05T21:34:41.817" Score="0" Body="&lt;p&gt;&lt;strong&gt;Partial answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If a operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a single qubit rotation around axis &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; for angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (denote &lt;span class=&quot;math-container&quot;&gt;$R_a(\theta)$&lt;/span&gt;) you can use additivity of such operator, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;[R_{a}(\theta)]^k = R_{a}(k\theta).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same is true for global phase gate &lt;span class=&quot;math-container&quot;&gt;$[Ph(\theta)]^k=Ph(k\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, you only change the angle and only one gate is applied.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-05T21:34:41.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11417" PostTypeId="1" AcceptedAnswerId="11419" CreationDate="2020-04-05T23:16:17.840" Score="0" ViewCount="64" Body="&lt;p&gt;In a multi-qubit system I can find the amplitudes of a state and compute probabilities, &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, eg., &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as 4x1 complex numpy array, representing the tensor product of my 2 qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;These amplitudes and phases corresponds to this display in Quirk:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ClhCM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ClhCM.png&quot; alt=&quot;probabilities and phases of all states&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, Quirk also shows the &quot;local state&quot; - per qubit - as a bloch wireframe. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SgqwS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SgqwS.png&quot; alt=&quot;wireframe of &amp;quot;local state&amp;quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I compute the Bloch coordinates for this local state, eg., out of my state vector? I believe I can get &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; as the &lt;span class=&quot;math-container&quot;&gt;$arccos$&lt;/span&gt; of the measurement probability for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, which I compute via projection of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \langle 1|$&lt;/span&gt; onto the density operator of the state? But how do I get the phase?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for any pointers!&lt;/p&gt;&#xA;" OwnerUserId="11582" LastEditorUserId="9459" LastEditDate="2020-04-06T11:35:40.703" LastActivityDate="2020-04-06T11:35:40.703" Title="Find local state and compute Bloch coordinates, like Quirk" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11418" PostTypeId="2" ParentId="11399" CreationDate="2020-04-06T01:36:57.583" Score="1" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.cnet.com/news/for-faster-quantum-computing-microsoft-builds-a-better-qubit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cnet.com/news/for-faster-quantum-computing-microsoft-builds-a-better-qubit/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sad reality is that: ``One drawback of Microsoft's topological qubit, though, is that they're not available yet.&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41567-018-0355-x&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41567-018-0355-x&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;graphene is not actively researched for the purpose of topological quantum computation. &lt;/p&gt;&#xA;" OwnerUserId="11555" LastEditorUserId="11555" LastEditDate="2020-04-06T15:32:14.000" LastActivityDate="2020-04-06T15:32:14.000" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11419" PostTypeId="2" ParentId="11417" CreationDate="2020-04-06T04:30:53.877" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Get the x, y, z coordinates of the Bloch vector from the 2x2 density matrix &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$D = \begin{bmatrix} a&amp;amp; b^\ast\\b &amp;amp; 1-a \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x = 2 \cdot \text{RealPart}(b)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$y = 2 \cdot \text{ImaginaryPart}(b)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$z = 2 \cdot a - 1$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-04-06T06:07:14.287" LastActivityDate="2020-04-06T06:07:14.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11420" PostTypeId="1" AcceptedAnswerId="11425" CreationDate="2020-04-06T07:35:17.560" Score="2" ViewCount="66" Body="&lt;p&gt;Suppose we are given two unitary matrices &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, with the following guarantee,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||U - V||_1 \geqslant \delta$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\delta \geqslant 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We apply an input density state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; individually to both &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, resulting in the output state &lt;span class=&quot;math-container&quot;&gt;$U\rho U^{\dagger}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V\rho V^{\dagger}$&lt;/span&gt; respectively. Then can we say anything about the trace norm of the output states, i.e,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||U\rho U^{\dagger} - V\rho V^{\dagger}||_1 \geqslant \hspace{1mm} ?$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8748" LastEditorUserId="55" LastEditDate="2020-10-23T06:47:09.967" LastActivityDate="2020-10-23T06:47:09.967" Title="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?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11421" PostTypeId="2" ParentId="11397" CreationDate="2020-04-06T07:41:39.883" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{p_1}|\phi_1\rangle|00\rangle.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle$&lt;/span&gt; is bigger than the second, the first element of the output must be bigger than the fifth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventually, I threw this into Mathematica (there are a couple of irrelevant phases that appear in this calculation compared to yours,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;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}});&#xA;Eigenvalues[rho]&#xA;{vals, vecs} = Eigensystem[rho]&#xA;basis = IdentityMatrix[4];&#xA;Sum[KroneckerProduct[{vecs[[i]]}, {basis[[i]]}]*Sqrt[vals[[i]]], {i, 1, 4}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This gave me the answer&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{-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.}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-06T07:41:39.883" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11422" PostTypeId="1" CreationDate="2020-04-06T07:51:35.047" Score="3" ViewCount="416" Body="&lt;p&gt;In HHL algorithm, for subroutine involving controlled rotation, after applying &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\theta=2\sin^{-1}\left(\frac{C}{\lambda}\right)$&lt;/span&gt; to the ancilla, the state changes to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1-\frac{C^2}{\lambda^2}}|0\rangle+\frac{C}{\lambda}|1\rangle.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\lambda=1$&lt;/span&gt;, then by &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1-\frac{C^2}{\lambda^2}}|0\rangle+\frac{C}{\lambda}|1\rangle$&lt;/span&gt; and choosing &lt;span class=&quot;math-container&quot;&gt;$C=1$&lt;/span&gt;, we get &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$\lambda=2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta=\frac{\pi}{3}.$&lt;/span&gt; So in general, for each &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, correspondingly there's a different &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. Since we don't know eigenvalues a priori,  how do we account &lt;span class=&quot;math-container&quot;&gt;$\theta $&lt;/span&gt;s for superpositon of eigenvalues?&lt;/p&gt;&#xA;&lt;p&gt;With respect to the circuit &lt;a href=&quot;https://arxiv.org/pdf/1110.2232v2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; on page 5, I don't understand how the controlled rotation part works. Will this circuit work when I choose a hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A_{4\times 4}$&lt;/span&gt; such that, one of it's eigenvalues, &lt;span class=&quot;math-container&quot;&gt;$\lambda_j=10\neq 2^i,i \in \mathbb{Z}$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="10368" LastEditorUserId="10368" LastEditDate="2020-08-17T11:12:00.057" LastActivityDate="2020-12-28T11:34:21.220" Title="Problem with controlled rotation in HHL" Tags="&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11423" PostTypeId="2" ParentId="11410" CreationDate="2020-04-06T07:55:01.807" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is also a rotation around the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis. However, there is an ordering issue. There's a sequence of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-rotation (&lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-rotation (&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-rotation (&lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-06T07:55:01.807" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11424" PostTypeId="2" ParentId="11414" CreationDate="2020-04-06T07:59:11.463" Score="3" Body="&lt;p&gt;As a general rule, just because you can produce controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, it does not mean that you can produce controlled-&lt;span class=&quot;math-container&quot;&gt;$U^{2^k}$&lt;/span&gt; with the same complexity. Modular exponentiation is a very special case where it turns out that you can.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is probably worth noting (iirc) that even if the best way of implementing controlled-&lt;span class=&quot;math-container&quot;&gt;$U^{2^k}$&lt;/span&gt; is with &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-06T07:59:11.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11425" PostTypeId="2" ParentId="11420" CreationDate="2020-04-06T08:19:38.347" Score="3" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|U-V\|_1=\text{Tr}(\sqrt{2I-VU^\dagger-UV^\dagger}).&#xA;$$&lt;/span&gt;&#xA;Now, &lt;span class=&quot;math-container&quot;&gt;$VU^\dagger$&lt;/span&gt; is a unitary, and hence as a spectral decomposition. Let the eigenvectors be &lt;span class=&quot;math-container&quot;&gt;$|\lambda_i\rangle$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$e^{i\lambda_i}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$UV^\dagger$&lt;/span&gt; has the same eigenvectors, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$e^{-i\lambda_i}$&lt;/span&gt;. Hence, the expression simplifies to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|U-V\|_1=2\sum_i\left|\sin\frac{\lambda_i}{2}\right|\geq\delta.&#xA;$$&lt;/span&gt;&#xA;Note that this doesn't tell us &lt;em&gt;anything&lt;/em&gt; about an individual &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; (whereas if the inequality were the other way around, we'd know that &lt;span class=&quot;math-container&quot;&gt;$\sin\frac{\lambda_i}{2}\leq\delta$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;). In particular, there could be an &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\lambda_i=0$&lt;/span&gt;. Let's call this particular vector &lt;span class=&quot;math-container&quot;&gt;$|\Lambda\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Next, consider the final calculation you want&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|U\rho U^\dagger-V\rho V^\dagger \|=\|\rho-U^\dagger V\rho V^\dagger U\|.&#xA;$$&lt;/span&gt;&#xA;It should now be clear that if &lt;span class=&quot;math-container&quot;&gt;$\rho=|\Lambda\rangle\langle\Lambda |$&lt;/span&gt;, this value is 0. Actually, it is for &lt;em&gt;any&lt;/em&gt; eigenvector, or mixture of eigenvectors, of &lt;span class=&quot;math-container&quot;&gt;$VU^\dagger$&lt;/span&gt;. Since 0 is always the minimum value, there's clearly no non-trivial lower bound.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Having started to think about the follow-up comment, there's an even stronger example of why you can't get anything useful. Let &lt;span class=&quot;math-container&quot;&gt;$V=e^{i\theta} U$&lt;/span&gt;. Obviously, &lt;span class=&quot;math-container&quot;&gt;$\|U\rho U^\dagger-V\rho V^\dagger \|=0$&lt;/span&gt;, while &lt;span class=&quot;math-container&quot;&gt;$\|U-V\|_1=2N\left|\sin\frac{\theta}{2}\right|$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrices.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-04-06T09:28:51.507" LastActivityDate="2020-04-06T09:28:51.507" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11426" PostTypeId="1" AcceptedAnswerId="11427" CreationDate="2020-04-06T08:30:50.250" Score="1" ViewCount="217" Body="&lt;p&gt;I have the following simple quantum circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wH6D3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wH6D3.png&quot; alt=&quot;Simple_Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This outputs are 00 and 11 for the two qubits. Using matrices, I have applied the H gate to the first qubit (ket 0):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;1\\ 1&amp;amp;-1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0\\1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11586" LastEditorUserId="45" LastEditDate="2020-04-06T21:27:13.047" LastActivityDate="2020-04-06T21:27:13.047" Title="Trying to use matrices for Hadamard and Controlled Not gates" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11427" PostTypeId="2" ParentId="11426" CreationDate="2020-04-06T08:50:59.807" Score="2" Body="&lt;p&gt;The application of Hadamard gate on the first qubit is correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; described by unit matrix on the second qubit. Hence the first step in you circuit can be described by matrix &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt;. Resulting matrix is of type 4x4. Now, you can apply CNOT gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, first step is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \otimes I = \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Second step is CNOT gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT= &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The whole circuit is described by matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT(H \otimes I)= \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 \\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply the circuit on input &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; you will get state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix} &#xA;1 \\&#xA;0 \\&#xA;0 \\&#xA;1 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is so-called Bell state &lt;span class=&quot;math-container&quot;&gt;$\beta_{00}$&lt;/span&gt;. If you set inputs  &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, you will get different Bell states.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: a manual how to compute tensor product mechanically&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on comments below, here is a manual how to computer tensor product:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wjbna.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wjbna.png&quot; alt=&quot;Tensor product&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-06T10:31:36.843" LastActivityDate="2020-04-06T10:31:36.843" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="11428" PostTypeId="2" ParentId="11422" CreationDate="2020-04-06T09:16:43.060" Score="4" Body="&lt;p&gt;You don't know the eigenvalues &lt;em&gt;a priori&lt;/em&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-06T09:16:43.060" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11429" PostTypeId="2" ParentId="11415" CreationDate="2020-04-06T11:35:26.587" Score="0" Body="&lt;p&gt;I think these gates only accept &lt;code&gt;float&lt;/code&gt; or &lt;code&gt;np.float&lt;/code&gt; as a parameter. Try casting to one of these types, for example &lt;code&gt;phase = float(phase)&lt;/code&gt; and it should work.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-04-06T11:35:26.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11430" PostTypeId="1" AcceptedAnswerId="11503" CreationDate="2020-04-06T12:57:27.337" Score="2" ViewCount="74" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://arxiv.org/abs/1911.09682&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Observables for continuous control of the Quantum Approximate Optimization Algorithm via Reinforcement Learning&lt;/a&gt;, an Hamiltonian is defined in order to solve the MAXCUT problem :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ C = \sum_{&amp;lt;i,j&amp;gt;} \frac{1}{2} (I -\sigma_i^z \sigma_j^z) = \sum_{&amp;lt;i,j&amp;gt;} C_{i,j} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\sigma_j^z$&lt;/span&gt; the pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt; applied to the &lt;span class=&quot;math-container&quot;&gt;$j^{th}$&lt;/span&gt; qubit. The sum is taken over all adjacent edge in the original graph problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The paper indicates the following result :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \lim_{p \rightarrow \infty} [\max_{\beta,\gamma} \langle \beta,\gamma |_p C | \beta,\gamma \rangle_p] = \max C $$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;consider &lt;span class=&quot;math-container&quot;&gt;$|\beta,\gamma \rangle_p$&lt;/span&gt; some states produced by the QAOA algorithm and &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; an integer, their value do not  matter for my question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantity &lt;span class=&quot;math-container&quot;&gt;$\max_{\beta,\gamma} \langle \beta,\gamma |_p C | \beta,\gamma \rangle_p$&lt;/span&gt; is clearly scalar, whereas I can't make sense of the expression &lt;span class=&quot;math-container&quot;&gt;$\max C$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is then, what does &lt;span class=&quot;math-container&quot;&gt;$\max C$&lt;/span&gt; means in this context ? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe the answer is not given in this paper. I might have the answer from this &lt;a href=&quot;https://grove-docs.readthedocs.io/en/latest/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, where it is said that the Hamiltonian is constructed from the classical function,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C(z_1,...,z_n) =  \sum_{&amp;lt;i,j&amp;gt;} \frac{1}{2} (1 -z_i z_j)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the sum is taken over all adjacent edges in the original graph problem, with &lt;span class=&quot;math-container&quot;&gt;$z_i = 1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$z_i \in S$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$z_i = -1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$z_i \in \bar{S}$&lt;/span&gt; (same for &lt;span class=&quot;math-container&quot;&gt;$z_j$&lt;/span&gt;) with &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bar{S}$&lt;/span&gt; the bipartition of the original graph.&#xA;I believe the authors of the first paper I linked were referring to this classical function and not to the Hamiltonian when speaking about &lt;span class=&quot;math-container&quot;&gt;$\max C$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My second guess is that it might refers to some matrix norms but none is defined in the article.&#xA;What do you think ?&lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-04-06T13:39:01.310" LastActivityDate="2020-04-11T18:53:46.130" Title="What does the maximum of a Hamiltonian means (in a particular paper)?" Tags="&lt;machine-learning&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11431" PostTypeId="1" CreationDate="2020-04-06T15:14:07.410" Score="0" ViewCount="48" Body="&lt;p&gt;I have a question concerning the placement of quantum circuits on Google devices. Consider the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;q           = [cirq.LineQubit(x) for x in range(5)]&#xA;circuit     = cirq.Circuit(cirq.CNOT.on(q[0],q[3]), cirq.CNOT.on(q[1],q[4]))&#xA;line        = cirq.google.line_on_device(cirq.google.Bristlecone, length=5)&#xA;circuit_opt = cirq.google.optimized_for_xmon(circuit=circuit, new_device=cirq.google.Bristlecone, qubit_map=lambda i: line[i.x])&#xA;simulator   = cirq.Simulator()&#xA;result = simulator.run(circuit, repetitions=1024)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This ad comparable codes yields the error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ValueError: Non-local interaction: cirq.CZ.on(cirq.GridQubit(0, 5), cirq.GridQubit(1, 7)).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does &lt;code&gt;Cirq&lt;/code&gt; provide a mechanism to automatically place (and route) a generic algorithm in the qubits 0..5 onto a concrete lattice structure?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance, Matthias&lt;/p&gt;&#xA;" OwnerUserId="11588" LastActivityDate="2020-04-06T16:22:26.790" Title="Placement of quantum circuits" Tags="&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11432" PostTypeId="1" AcceptedAnswerId="11461" CreationDate="2020-04-06T16:00:50.063" Score="0" ViewCount="44" Body="&lt;p&gt;In order to build a &lt;a href=&quot;https://qiskit.org/documentation/apidoc/aer_noise.html#device-noise-parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom noise model in Qiskit Aer&lt;/a&gt;, 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8958/how-good-is-basic-device-noise-model-simulating-the-noise-in-the-quantum-compu?rq=1&quot;&gt;previous stack-exchange question&lt;/a&gt; about Qiskit's &lt;code&gt;basic_device_noise_model()&lt;/code&gt;, I would guess that the first parameter is giving the gate fidelity. Is this true? What are the other 2 (8) numbers specifying? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example for a single-qubit (&lt;code&gt;id&lt;/code&gt;) and a two-qubit (&lt;code&gt;cx&lt;/code&gt;) gate from the backend &lt;code&gt;orense&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   {'type': 'qerror',&#xA;   'operations': ['id'],&#xA;   'instructions': [[{'name': 'id', 'qubits': [0]}],&#xA;    [{'name': 'z', 'qubits': [0]}],&#xA;    [{'name': 'reset', 'qubits': [0]}]],&#xA;   'probabilities': [0.9996936442814689,&#xA;    5.460519336879117e-05,&#xA;    0.0002517505251623531],&#xA;   'gate_qubits': [[0]]},&#xA;&#xA;   {'type': 'qerror',&#xA;   'operations': ['cx'],&#xA;   'instructions': [[{'name': 'id', 'qubits': [1]}],&#xA;    [{'name': 'z', 'qubits': [0]}],&#xA;    [{'name': 'reset', 'qubits': [0]}],&#xA;    [{'name': 'z', 'qubits': [1]}],&#xA;    [{'name': 'z', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}],&#xA;    [{'name': 'reset', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}],&#xA;    [{'name': 'reset', 'qubits': [1]}],&#xA;    [{'name': 'z', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}],&#xA;    [{'name': 'reset', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}]],&#xA;   'probabilities': [0.9893181752693058,&#xA;    0.0004106923127677822,&#xA;    0.001895703775229592,&#xA;    0.002657456705309657,&#xA;    1.1031810267579292e-06,&#xA;    5.092144099539429e-06,&#xA;    0.005698491726413379,&#xA;    2.365595624250726e-06,&#xA;    1.0919290223224507e-05],&#xA;   'gate_qubits': [[0, 1]]},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11589" LastEditorUserId="55" LastEditDate="2020-10-23T06:47:03.273" LastActivityDate="2020-10-23T06:47:03.273" Title="Error parameters from Qiskit backends" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11433" PostTypeId="2" ParentId="11415" CreationDate="2020-04-06T16:11:15.663" Score="0" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/3908&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/3908&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-04-06T16:11:15.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11434" PostTypeId="2" ParentId="11431" CreationDate="2020-04-06T16:22:26.790" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are tools that work with cirq that do what you want, such as &lt;a href=&quot;https://github.com/CQCL/pytket&quot; rel=&quot;nofollow noreferrer&quot;&gt;pytket&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-04-06T16:22:26.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11435" PostTypeId="1" AcceptedAnswerId="11444" CreationDate="2020-04-06T16:29:46.827" Score="3" ViewCount="55" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://arxiv.org/abs/1801.09957&quot; rel=&quot;nofollow noreferrer&quot;&gt;Valley qubit in Gated MoS&lt;span class=&quot;math-container&quot;&gt;$_2$&lt;/span&gt; monolayer quantum dot&lt;/a&gt;, a description of how a &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; gate would be performed on a qubit in the described device is given. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors say that in the described implementation the operation performed is an &lt;span class=&quot;math-container&quot;&gt;$iNOT$&lt;/span&gt; gate, and that the Hadamard operation can be implemented by performing half of the &lt;span class=&quot;math-container&quot;&gt;$iNOT$&lt;/span&gt; Rabi transition. Particularly, the authors say that &lt;span class=&quot;math-container&quot;&gt;$H = e^{i\pi/4}\sqrt{iNOT}$&lt;/span&gt;, (actually they say &lt;span class=&quot;math-container&quot;&gt;$H = e^{i\pi/4}\sqrt{NOT}$&lt;/span&gt;, but I assume this is a typo).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Most generally, my question is: Does &lt;span class=&quot;math-container&quot;&gt;$H = e^{i\pi/4}\sqrt{iNOT}$&lt;/span&gt;? I cannot work it out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My confusion may stem from my lack of understanding concerning why the implemented operation corresponds to &lt;span class=&quot;math-container&quot;&gt;$iNOT$&lt;/span&gt; instead of simply &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt;. My understanding is that &lt;span class=&quot;math-container&quot;&gt;$iNOT = i\sigma_x$&lt;/span&gt;. I'd appreciate any insight you have on this as well. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="4943" LastEditorUserId="9006" LastEditDate="2020-04-06T21:36:56.893" LastActivityDate="2020-04-07T07:26:32.043" Title="$H = e^{i\pi/4} \sqrt{iNOT}$?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11436" PostTypeId="1" CreationDate="2020-04-06T17:05:58.143" Score="5" ViewCount="181" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;To be able to do this, we first need to write the Hamiltonian of the molecule in the second quantization form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H_{fer} = \sum h_{pq} a_p^\dagger a_q + \sum h_{pqrs} a_p^\dagger a_q^\dagger a_r a_s  $$&lt;/span&gt;&#xA;then we map &lt;span class=&quot;math-container&quot;&gt;$H_{fer}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H_{qubit}$&lt;/span&gt; by one of the maps (JW, parity, BK) so it's easier to calculate the expectation value. That is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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 + ...  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand that the set &lt;span class=&quot;math-container&quot;&gt;$\{\sigma^i\}^{\otimes n}$&lt;/span&gt; forms a basis for an &lt;span class=&quot;math-container&quot;&gt;$n \times n$&lt;/span&gt; Hermitian operator so it's reasonable to consider the map from &lt;span class=&quot;math-container&quot;&gt;$H_{fer}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H_{qubit}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H_{qubit}$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$\langle H_{qubit} \rangle$&lt;/span&gt;. To be able to do this, you must make sure that &lt;span class=&quot;math-container&quot;&gt;$H_{qubit}$&lt;/span&gt; has an efficient decomposition. That is, you don't want to use all &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; terms to describe the Hamiltonian... since this will kill off all the efficiency you want to achieve.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="15408" LastEditDate="2021-04-08T14:06:51.330" LastActivityDate="2021-05-08T15:04:45.430" Title="Decomposing Hamiltonian into qubit model representation" Tags="&lt;algorithm&gt;&lt;quantum-advantage&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11437" PostTypeId="1" AcceptedAnswerId="11440" CreationDate="2020-04-06T19:10:06.370" Score="5" ViewCount="181" Body="&lt;p&gt;I recently had an assignment where the question is based on the assumption that we can write any pure state qubit &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle$&lt;/span&gt; as:&#xA;        &lt;span class=&quot;math-container&quot;&gt;$$|\phi \rangle = \gamma |\psi\rangle + \delta |\psi^\perp \rangle$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp \rangle$&lt;/span&gt; are 2 antipodal points on the Bloch sphere:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle =  \cos \frac{\theta}{2} |0\rangle +e^{i\varphi}\sin \frac{\theta}{2} |1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi^\perp\rangle =  \cos \frac{\theta + \pi}{2} |0\rangle +e^{i\varphi}\sin \frac{\theta + \pi}{2} |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have a lingering question about how this actually works. So far I got:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle= \gamma |\psi\rangle + \delta |\psi^{\perp}\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= \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)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \left(\gamma \cos \frac{\theta}{2} + \delta \cos \frac{\theta + \pi}{2}\right)|0\rangle&#xA;		+ \left(\gamma e^{i\varphi}\sin \frac{\theta}{2} + \delta e^{i\varphi} \sin \frac{\theta + \pi}{2}\right)|1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Rightarrow \alpha =  \gamma \cos \frac{\theta}{2} + \delta \cos \frac{\theta + \pi}{2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Rightarrow \beta = \gamma e^{i\varphi}\sin \frac{\theta}{2} + \delta e^{i\varphi} \sin \frac{\theta + \pi}{2}$$&lt;/span&gt;&#xA;So &lt;span class=&quot;math-container&quot;&gt;$\alpha^2 + \beta^2 = 1$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp \rangle$&lt;/span&gt; basis. I know that they are orthonormal so intuitively it should work.&lt;/p&gt;&#xA;" OwnerUserId="11520" LastEditorUserId="11520" LastEditDate="2020-04-06T19:20:46.967" LastActivityDate="2020-04-07T16:01:45.783" Title="Represent a pure state in terms of 2 antipodal points on the Bloch sphere" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="11438" PostTypeId="1" AcceptedAnswerId="11439" CreationDate="2020-04-06T19:17:02.900" Score="3" ViewCount="158" Body="&lt;p&gt;In last year‘s conference &quot;Quantum For Business 2019&quot; Iordanis Kerenidis gave &lt;a href=&quot;https://www.youtube.com/watch?v=UZ9VukrhLg8&amp;amp;list=PLh7C25oO7PW1_kAAhy85diTKGaYlXNtwV&amp;amp;index=7&quot; rel=&quot;nofollow noreferrer&quot;&gt;a nice talk about quantum machine learning&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At about time 27:10 he mentions a &quot;Quantum Data loader&quot; 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?&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="11587" LastActivityDate="2020-04-06T19:57:38.593" Title="QML: &quot;Quantum Data loader&quot; instead of QRAM?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11439" PostTypeId="2" ParentId="11438" CreationDate="2020-04-06T19:57:38.593" Score="2" Body="&lt;p&gt;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.&#xA;This &lt;a href=&quot;https://arxiv.org/abs/1804.11326&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;, and this &lt;a href=&quot;https://arxiv.org/abs/2001.03622&quot; rel=&quot;nofollow noreferrer&quot;&gt;one&lt;/a&gt; are examples/references you can learn about quantum embeddings and quantum feature maps.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-04-06T19:57:38.593" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11440" PostTypeId="2" ParentId="11437" CreationDate="2020-04-06T22:24:41.097" Score="3" Body="&lt;p&gt;Two antipodal states in the Bloch sphere (note that &lt;span class=&quot;math-container&quot;&gt;$0 \leq \theta \leq \pi$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi \rangle = \cos \frac{\theta}{2}  |0 \rangle + e^{i\varphi}\sin \frac{\theta}{2}  |1 \rangle&#xA;\\&#xA;|\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&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expression for &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp \rangle$&lt;/span&gt; from the question is different from this &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp \rangle$&lt;/span&gt; by a global phase. The reason why I prefer this notation is that I want to keep Bloch sphere formalism (e.g. &lt;span class=&quot;math-container&quot;&gt;$0 \leq (\pi - \theta) \leq \pi$&lt;/span&gt; constrant that is true for &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp \rangle$&lt;/span&gt; presented here). Note that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi | \psi^\perp \rangle = \cos \frac{\theta}{2}  \sin \frac{\theta}{2} - \sin \frac{\theta}{2}  \cos \frac{\theta}{2}  = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By doing the same calculations we can obtain for &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle= \gamma |\psi\rangle + \delta |\psi^{\perp}\rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp;\alpha =  \gamma \cos \frac{\theta}{2} + \delta \sin \frac{\theta}{2}&#xA;\\&#xA;&amp;amp;\beta = \gamma e^{i\varphi}\sin \frac{\theta}{2} - \delta e^{i\varphi} \cos \frac{\theta}{2}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then (here I take into account that &lt;span class=&quot;math-container&quot;&gt;$|e^{i\varphi}| = 1$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\alpha|^2 = |\gamma|^2 \cos^2 \frac{\theta}{2} + |\delta|^2 \sin^2 \frac{\theta}{2}&#xA;+ 2 Re(\gamma)  Re(\delta) \cos \frac{\theta}{2}\sin \frac{\theta}{2}  + &#xA; 2 Im(\gamma)  Im(\delta) \cos \frac{\theta}{2}\sin \frac{\theta}{2}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\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}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because if we have two complex numbers &lt;span class=&quot;math-container&quot;&gt;$z_1 = x_1 + i y_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z_2 = x_2 + i y_2$&lt;/span&gt;, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After summing the expressions for &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; we will obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\alpha|^2 + |\beta|^2 = \left(|\gamma|^2 + |\delta|^2 \right) \left(\sin^2 \frac{\theta}{2} + \cos^2 \frac{\theta}{2} \right) =1$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-07T16:01:45.783" LastActivityDate="2020-04-07T16:01:45.783" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11441" PostTypeId="1" AcceptedAnswerId="11443" CreationDate="2020-04-07T05:20:04.273" Score="1" ViewCount="72" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oaSdi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oaSdi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;I made a simple circuit that we can see. In my view, &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt; should appear  in one result, but I didn't see it. why?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/121hu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/121hu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8745" LastEditorUserId="9006" LastEditDate="2020-04-07T07:05:47.030" LastActivityDate="2020-04-07T07:05:47.030" Title="I made a simple circuit on qiskit,but I have some question on this result" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11442" PostTypeId="1" CreationDate="2020-04-07T05:38:16.760" Score="1" ViewCount="230" Body="&lt;p&gt;I have installed qiskit through my terminal using &lt;code&gt;pip3 install qiskit&lt;/code&gt;. But when I try to import all from it in my coding software, it returns a M&lt;code&gt;oduleNotFound error&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Q3n5H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q3n5H.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When i try to install it in &lt;code&gt;interpreter settings&lt;/code&gt;, this error message returns:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dmkRw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dmkRw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11594" LastEditorUserId="9006" LastEditDate="2020-04-07T05:42:12.410" LastActivityDate="2020-05-30T10:49:48.500" Title="Qiskit not installing properly on pyCharm CE" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11443" PostTypeId="2" ParentId="11441" CreationDate="2020-04-07T07:05:28.957" Score="1" Body="&lt;p&gt;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 &lt;em&gt;_results.json&lt;/em&gt; in notepad and look for string &lt;em&gt;results&lt;/em&gt;. There will be something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;results&quot;:[{&quot;data&quot;:{&quot;counts&quot;:&quot;{&quot;0x0&quot;:27,&quot;0x1&quot;:33,&quot;0x10&quot;:36,&quot;0x11&quot;:41,&quot;0x12&quot;:21,&quot;0x13&quot;:32,&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead of binary numbers, the results are expressed in hexadecimal format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The result for state &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt; you were looking for is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&quot;0x0&quot;:27&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This means the number of occurences of &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt; is 27 (I used 1,024 shots).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-07T07:05:28.957" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11444" PostTypeId="2" ParentId="11435" CreationDate="2020-04-07T07:26:32.043" Score="4" Body="&lt;p&gt;It cannot be the case that &lt;span class=&quot;math-container&quot;&gt;$H=e^{i\pi/4}\sqrt{iNOT}$&lt;/span&gt;. Whatever your interpretation of &lt;span class=&quot;math-container&quot;&gt;$iNOT$&lt;/span&gt; (I'd agree with your definition), just square the thing. &lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt;, the identity, and so it is certainly not the case that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I=e^{i\pi/2}iNOT.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is true, however, that if you perform the sequence that would give you an operation such as &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$iNOT$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;) although the interpretation of the results is different as which output is which gets switched.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-07T07:26:32.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11445" PostTypeId="1" AcceptedAnswerId="11446" CreationDate="2020-04-07T09:27:28.697" Score="3" ViewCount="216" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="10366" LastEditorUserId="55" LastEditDate="2020-07-26T17:52:14.357" LastActivityDate="2020-07-26T17:52:14.357" Title="Does Controlled-U gate entangle qubits?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11446" PostTypeId="2" ParentId="11445" CreationDate="2020-04-07T09:52:41.533" Score="8" Body="&lt;p&gt;For any controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, if the input state is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|\phi\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is not an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then the output state is entangled. This immediately deals with trivial cases such as &lt;span class=&quot;math-container&quot;&gt;$U=I$&lt;/span&gt; because in that case all states &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; are eigenstates, and so it is not entangling. For any other &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, there is an input state that is separable that is mapped to an entangled state, and hence controlled=&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is entangling for any &lt;span class=&quot;math-container&quot;&gt;$U\neq I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Proof: Let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=\sum_ia_i|\lambda_i\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\lambda_i\rangle$&lt;/span&gt; are the distinct eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Your gate then evolves&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\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.&#xA;$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$\sum_ia_ie^{i\lambda_i}|\lambda_i\rangle$&lt;/span&gt; is not proportional to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; (under the assumption that the phases &lt;span class=&quot;math-container&quot;&gt;$e^{i\lambda_i}$&lt;/span&gt; are distinct and there are at least two non-zero &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;), the state is entangled because it is not a product state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-07T09:52:41.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11447" PostTypeId="1" AcceptedAnswerId="11449" CreationDate="2020-04-07T17:09:44.663" Score="3" ViewCount="97" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11603" LastEditorUserId="2927" LastEditDate="2020-12-31T17:28:44.230" LastActivityDate="2020-12-31T17:28:44.230" Title="Does principle of deffered measurement imply information can travel faster than light?" Tags="&lt;circuit-construction&gt;&lt;teleportation&gt;&lt;deferred-measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11448" PostTypeId="2" ParentId="6962" CreationDate="2020-04-07T17:39:37.960" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;true&quot; Holevo bound to be saturated.&lt;/p&gt;&#xA;" OwnerUserId="11604" LastActivityDate="2020-04-07T17:39:37.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11449" PostTypeId="2" ParentId="11447" CreationDate="2020-04-07T17:45:25.370" Score="4" Body="&lt;p&gt;I think faster than light communication is more stubborn than that :-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The principle of deferred measurement, to quote Nielsen and Chuang, page 186, is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Measurements can always be moved from an intermediate stage of a quantum circuit to the end of the circuit; &lt;strong&gt;if the measurement results are used at any stage of the circuit then the classically controlled operations can be replaced by conditional quantum operations.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-04-07T17:45:25.370" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11450" PostTypeId="1" AcceptedAnswerId="11542" CreationDate="2020-04-07T21:04:48.337" Score="3" ViewCount="141" Body="&lt;p&gt;There was a similar question asked &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5919/quantum-addition-and-modulo-operation-using-gates&quot;&gt;here&lt;/a&gt;, but I feel like mine is even more basic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What's the easiest way to implement a circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; corresponding to a matrix-vector multiplication modulo 2?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|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&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;y_1 \\ y_2 \\ y_3 \\ \ldots \\ y_n&#xA;\end{pmatrix}&#xA;= M&#xA;\begin{pmatrix}&#xA;x_1 \\ x_2 \\ x_3 \\ \ldots \\ x_n&#xA;\end{pmatrix} \mod 2 \ .&#xA;$$&lt;/span&gt;&#xA;Matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; entries are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, the multiplication is done modulo 2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimal solution in given  &lt;a href=&quot;https://cs.stackexchange.com/a/123782/95710&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a simple solution see my answer below.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="282" LastEditDate="2020-04-14T07:48:37.330" LastActivityDate="2020-04-14T07:48:37.330" Title="Matrix mod 2 multiplication" Tags="&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11451" PostTypeId="1" AcceptedAnswerId="11456" CreationDate="2020-04-07T21:07:08.470" Score="1" ViewCount="30" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;On Wikipedia&lt;/a&gt;, one can read the following about Quantum Phase Estimation:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;the algorithm estimates the value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; with high probability within additive error &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;, using &lt;span class=&quot;math-container&quot;&gt;$O(1/\varepsilon )$&lt;/span&gt; controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operations.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Why do we need so much qubits? What we want is a &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-qubits string such that it is equal to the &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; first bits in the binary writing of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. We also want this binary writing to be at most at &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; from the true value. Hence, we have that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|\sum_{n=t+1}^{+\infty}\theta_n\,2^{-n}\right|\leqslant\frac{\varepsilon}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the worst case, both terms are equal and all &lt;span class=&quot;math-container&quot;&gt;$\theta_n$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Hence, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, we would have &lt;span class=&quot;math-container&quot;&gt;$O(\log(1/\varepsilon))$&lt;/span&gt; controlled operations, since we have as much operations as qubits in the first register. Is it Wiki that is wrong, or my calculations?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Side question: is it some sort of convention to write &lt;span class=&quot;math-container&quot;&gt;$O(1/\varepsilon)$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$O\left(\frac1\varepsilon\right)$&lt;/span&gt;? I only see the former written, while I find the latter less ambiguous.&lt;/p&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2020-04-08T06:09:34.577" Title="Why is the number of qubits linear in the inverse of epsilon in Quantum Phase Estimation?" Tags="&lt;circuit-construction&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11453" PostTypeId="1" CreationDate="2020-04-07T21:48:39.770" Score="2" ViewCount="82" Body="&lt;p&gt;In the &lt;a href=&quot;https://arxiv.org/pdf/1603.08675.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Recommendation Systems paper&lt;/a&gt;, the authors use the Quantum Phase Estimation algorithm in a way that is slightly different from what I've seen so far.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is how it is described:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The analysis of phase estimation shows that the algorithm outputs a discrete valued estimate for each eigenvalue that is within additive error &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; with probability at least &lt;span class=&quot;math-container&quot;&gt;$0.8$&lt;/span&gt;, the probability is boosted to &lt;span class=&quot;math-container&quot;&gt;$1 − 1/\mathrm{poly}(n)$&lt;/span&gt; by repeating &lt;span class=&quot;math-container&quot;&gt;$O(\log n)$&lt;/span&gt; times and choosing the most frequent estimate.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Given that if we choose an additional number of qubits equal to &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, the probability that the QPE outputs the correct state is &lt;span class=&quot;math-container&quot;&gt;$\frac{11}{12}\approx0.91$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes t}$&lt;/span&gt; to apply it once again. But from the no-deleting theorem, I cannot apply some unitary that will map this arbitrary state to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes t}$&lt;/span&gt;. I can't either use the uncompute trick because of the measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My idea was, since I know the state this register is currently in, I can add &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates wherever a qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. But this means that I would have to add gates in the circuit &quot;at runtime&quot;, that is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Performing QPE&lt;/li&gt;&#xA;&lt;li&gt;Measuring state&lt;/li&gt;&#xA;&lt;li&gt;Apply X gates accordingly&lt;/li&gt;&#xA;&lt;li&gt;Repeat&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Is it realistic? If it is not, what other options do I have to perform such a computation?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2020-04-07T21:48:39.770" Title="Repeating Quantum Phase Estimation algorithm" Tags="&lt;circuit-construction&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11454" PostTypeId="1" CreationDate="2020-04-08T01:04:32.850" Score="1" ViewCount="49" Body="&lt;p&gt;How qubit phase is build in real hardware?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On IBM Quantum, D-Wave, etc?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="9006" LastEditDate="2020-04-08T04:09:05.250" LastActivityDate="2020-04-08T04:09:05.250" Title="How qubit phase is build in real hardware?" Tags="&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;d-wave&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11455" PostTypeId="1" CreationDate="2020-04-08T03:32:33.297" Score="0" ViewCount="43" Body="&lt;p&gt;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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4838/how-to-set-up-qconfig-py-and-where-is-the-file&quot;&gt;answered question&lt;/a&gt;. However, this solution also doesn't work, producing the same error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s6ZJe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s6ZJe.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I solve this?&lt;/p&gt;&#xA;" OwnerUserId="11614" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-04-08T15:02:54.010" Title="Can't load account on IBM's qiskit" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11456" PostTypeId="2" ParentId="11451" CreationDate="2020-04-08T06:09:34.577" Score="2" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U^4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U^8$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U^{16}\ldots$&lt;/span&gt; If you have to make these out of just controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, this means using exponentially many of them (in t),&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-08T06:09:34.577" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11457" PostTypeId="1" CreationDate="2020-04-08T06:31:50.653" Score="-2" ViewCount="56" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b9scm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b9scm.png&quot; alt=&quot;Heading&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is this so? Can someone please give me detailed steps with an explanation?&lt;/p&gt;&#xA;" OwnerUserId="11616" LastEditorUserId="55" LastEditDate="2020-08-19T17:35:04.130" LastActivityDate="2020-08-19T17:35:04.130" Title="In the context of Quantum theory of Information, Typical eigenvectors are permutations of basis vectors. Why?" Tags="&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-08-20T07:56:04.900" ContentLicense="CC BY-SA 4.0" />
  <row Id="11458" PostTypeId="2" ParentId="11457" CreationDate="2020-04-08T10:47:01.497" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_2$&lt;/span&gt; be two such operators that satisfy &lt;span class=&quot;math-container&quot;&gt;$\sigma_i^2=I$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_1\sigma_2+\sigma_2\sigma_1=0.&#xA;$$&lt;/span&gt;&#xA;Since they square to identity, the eigenvalues must be &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;. Now let &lt;span class=&quot;math-container&quot;&gt;$|\psi_{\pm}\rangle$&lt;/span&gt; be the corresponding eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm1$&lt;/span&gt;. We see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\sigma_1\sigma_2+\sigma_2\sigma_1)|\psi_{\pm}\rangle=0=(\sigma_1\mp I)\sigma_2|\psi_{\pm}\rangle.&#xA;$$&lt;/span&gt;&#xA;So, &lt;span class=&quot;math-container&quot;&gt;$\sigma_2|\psi_{\pm}\rangle$&lt;/span&gt; are the 0 vectors of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1\pm I$&lt;/span&gt; respectively, and are hence eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\mp1$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$\sigma_2|\psi_{\pm}\rangle=|\psi_{\mp}\rangle$&lt;/span&gt;, which is a permutation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It might help to visualise what's going on on the Bloch sphere. Pick an axis. Let's say the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotation acts as a permutation for any orthogonal basis on the equator, such as the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; axes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This choice is particularly convenient in quantum information because it means that the bases &lt;em&gt;mutually unbiased&lt;/em&gt;, which has useful properties in, for example, cryptography applications.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-08T10:47:01.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11460" PostTypeId="1" AcceptedAnswerId="11462" CreationDate="2020-04-08T15:22:15.233" Score="4" ViewCount="43" Body="&lt;p&gt;I am reading Quantum Computation and Quantum Information by Michael A. Nielsen &amp;amp; Isaac L. Chuang, and I am confused about a concept presented in Section 1.3.7: Quantum Teleportation. The book writes &quot;While together, Alice and Bob generated an EPR pair, each taking one qubit of the EPR&#xA;pair when they separated.&quot; For example, if the EPR pair in question is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle=\frac{|00\rangle+|11\rangle}{\sqrt{2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can we write mathematically what Alice and Bob each have in their possession?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This idea comes up again when quantum teleportation is applied to superdense coding in Section 2.3, where again Alice and Bob &quot;share a pair of qubits in the entangled state &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="11619" LastActivityDate="2020-04-08T15:29:19.153" Title="What does it look like to split an EPR pair?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;nielsen-and-chuang&gt;&lt;teleportation&gt;&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11461" PostTypeId="2" ParentId="11432" CreationDate="2020-04-08T15:25:01.257" Score="0" Body="&lt;p&gt;Each of those dicts are a &lt;code&gt;QuantumError&lt;/code&gt;. You can learn more about the structure of a &lt;code&gt;QuantumError&lt;/code&gt; &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.QuantumError.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. That documentation is most likely what you were looking for.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Each &lt;code&gt;instruction&lt;/code&gt; is an operation being applied on the qubit(s) in &lt;code&gt;qubits&lt;/code&gt;. Each value in &lt;code&gt;probabilities&lt;/code&gt; corresponds to the respective operation in &lt;code&gt;instructions&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-04-08T15:25:01.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11462" PostTypeId="2" ParentId="11460" CreationDate="2020-04-08T15:29:19.153" Score="4" Body="&lt;p&gt;The whole point of an EPR pair is that you cannot write (without losing some information) &quot;This is what Alice has&quot; and &quot;This is what Bob has&quot;. Partial descriptions can be given using reduced density matrices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you want to identify which bits Alice and Bob each have, we often use a notation like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|0\rangle_A|0\rangle_B+|1\rangle_A|1\rangle_B)/\sqrt{2}&#xA;$$&lt;/span&gt;&#xA;which helps to emphasise which ket corresponds to the qubits being held by each party.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-08T15:29:19.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11463" PostTypeId="1" CreationDate="2020-04-08T18:26:02.577" Score="0" ViewCount="202" Body="&lt;p&gt;I am asking this question with reference to this &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/aqua/finance/optimization/portfolio_diversification.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/aqua/finance/optimization/portfolio_diversification.ipynb&lt;/a&gt;&#xA;Happy to know new resources on portfolio optimization.&lt;/p&gt;&#xA;" OwnerUserId="2566" LastEditorUserId="9006" LastEditDate="2020-04-08T19:49:33.663" LastActivityDate="2020-09-18T11:29:51.427" Title="What is Ising Hamiltonian ? What its role in Portfolio Diversification?" Tags="&lt;qiskit&gt;&lt;resource-request&gt;&lt;optimization&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11464" PostTypeId="1" AcceptedAnswerId="11466" CreationDate="2020-04-08T19:54:29.550" Score="3" ViewCount="103" Body="&lt;p&gt;I have implemented a simple CNOT gate using &lt;code&gt;qiskit&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was expecting a the result the matrix as in the following image (extracted from &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vwDFK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vwDFK.png&quot; alt=&quot;CNOT WIKI&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit = QuantumCircuit(2, 2)&#xA;circuit.cx(0, 1)&#xA;simulator = Aer.get_backend(&quot;unitary_simulator&quot;)&#xA;result = execute(circuit, backend=simulator).result()&#xA;unitary = result.get_unitary()&#xA;print(circuit.draw())&#xA;print(unitary)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results in the print are:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y2sTU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y2sTU.png&quot; alt=&quot;Results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To be really clear: The matrix in the first image and the second (the result) should be the same.&lt;/p&gt;&#xA;" OwnerUserId="11609" LastActivityDate="2020-04-08T20:36:52.990" Title="Qiskit unitary representation seems shifted" Tags="&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11465" PostTypeId="2" ParentId="11464" CreationDate="2020-04-08T20:17:44.177" Score="3" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-04-08T20:17:44.177" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11466" PostTypeId="2" ParentId="11464" CreationDate="2020-04-08T20:36:52.990" Score="2" Body="&lt;p&gt;The first matrix is generally seen in books, as you consider computational basis in the order &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt; or in bitstrings &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. So basically, you think as &lt;span class=&quot;math-container&quot;&gt;$| q_0, q_1\rangle$&lt;/span&gt;. This is called little-endian convention. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in Qiskit, they use the inverse, aka big-endian convention. And then you have to think that it is actually &lt;span class=&quot;math-container&quot;&gt;$| q_1, q_0\rangle$&lt;/span&gt;. And what you do is that you define &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; as the control. So when &lt;span class=&quot;math-container&quot;&gt;$| q_1 = 1, q_0 = 0\rangle$&lt;/span&gt; that is 1 in big-endian, &lt;span class=&quot;math-container&quot;&gt;$CNOT |10\rangle = | 10\rangle$&lt;/span&gt;, hence 3. Which explains your second row.&#xA;And when &lt;span class=&quot;math-container&quot;&gt;$| q_1 = 1, q_0 = 1\rangle$&lt;/span&gt; that is 3 in big-endian, &lt;span class=&quot;math-container&quot;&gt;$CNOT |11\rangle = | 01\rangle$&lt;/span&gt;, hence 1 and explaining why you get the last row.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can find the &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;explanation about the CNOT in Qiskit here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-04-08T20:36:52.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11467" PostTypeId="1" CreationDate="2020-04-08T20:59:43.827" Score="2" ViewCount="40" Body="&lt;p&gt;I was reading a &lt;a href=&quot;https://news.ycombinator.com/item?id=9928657&quot; rel=&quot;nofollow noreferrer&quot;&gt;forum&lt;/a&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9iyRE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9iyRE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where the gate &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\def\a{\color{#FF33BB}{\frac{1}{2}}}&#xA;\def\b{\color{#1C3C93}{\frac{1}{6}}}&#xA;\def\c{\color{#37D717}{-\frac{5}{6}}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ G = \begin{bmatrix}&#xA;\a &amp;amp;\a &amp;amp;\a &amp;amp;\a &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;\a &amp;amp;\c &amp;amp;\b &amp;amp;\b &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;\a &amp;amp;\b &amp;amp;\c &amp;amp;\b &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;\a &amp;amp;\b &amp;amp;\b &amp;amp;\c &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\c &amp;amp;\a &amp;amp;\b &amp;amp;\b &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\a &amp;amp;\a &amp;amp;\a &amp;amp;\a &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\b &amp;amp;\a &amp;amp;\c &amp;amp;\b &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\b &amp;amp;\a &amp;amp;\b &amp;amp;\c &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\c &amp;amp;\b &amp;amp;\a &amp;amp;\b &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\b &amp;amp;\c &amp;amp;\a &amp;amp;\b &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\a &amp;amp;\a &amp;amp;\a &amp;amp;\a &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\b &amp;amp;\b &amp;amp;\a &amp;amp;\c &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\c &amp;amp;\b &amp;amp;\b &amp;amp;\a \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\b &amp;amp;\c &amp;amp;\b &amp;amp;\a \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\b &amp;amp;\b &amp;amp;\c &amp;amp;\a \\&#xA;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;0 &amp;amp;\a &amp;amp;\a &amp;amp;\a &amp;amp;\a&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assuming some other part of the circuit sets the control qudit to a given setting, &lt;span class=&quot;math-container&quot;&gt;$|setting\rangle = |0\rangle, |1\rangle, |2\rangle $&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$ |3\rangle$&lt;/span&gt;, applying the gate &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; should have the following effect&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G \Bigg[ |setting\rangle_4 \otimes \frac{1}{2} \Big( |00\rangle + |01\rangle + |10\rangle + |11\rangle \Big) \Bigg] \rightarrow $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{cases}&#xA;|setting\rangle \otimes |00\rangle, &amp;amp; |setting\rangle = 0 \\&#xA;|setting\rangle \otimes |01\rangle, &amp;amp; |setting\rangle = 1 \\&#xA;|setting\rangle \otimes |10\rangle, &amp;amp; |setting\rangle = 2 \\&#xA;|setting\rangle \otimes |11\rangle, &amp;amp; |setting\rangle = 3 \\&#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; would have the effect of sending all the amplitude to the state corresponding to &lt;span class=&quot;math-container&quot;&gt;$|setting\rangle$&lt;/span&gt;, which is precisely what the claim above places limits on due to the unitarity of quantum mechanical operators. It's easy to check that &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is unitary, so what is the maximum amount of amplitude transfer?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="1867" LastEditDate="2020-04-09T04:04:16.250" LastActivityDate="2020-04-09T04:04:16.250" Title="Shifting amplitude from one basis to another with a control qubit" Tags="&lt;quantum-gate&gt;&lt;no-cloning-theorem&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11468" PostTypeId="1" CreationDate="2020-04-08T23:41:56.687" Score="1" ViewCount="45" Body="&lt;p&gt;In quantum circuit, how do you implement the rotation of multi-body interaction, such as &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta\sigma_z^1\sigma_z^2\sigma_z^3}$&lt;/span&gt;? I already know the case of less than two-body interaction, but I cannot find any textbook about more than three-body interaction.&lt;/p&gt;&#xA;" OwnerUserId="9894" LastEditorUserId="9006" LastEditDate="2020-04-09T04:00:09.850" LastActivityDate="2020-04-09T04:45:28.130" Title="Rotation of multi-body interaction in quantum circuit" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11469" PostTypeId="1" AcceptedAnswerId="11473" CreationDate="2020-04-09T04:10:54.693" Score="1" ViewCount="89" Body="&lt;p&gt;Let's suppose I have a quantum channel given in the Kraus decomposition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T(\rho) = \sum_{i} K_i \rho K_i^{\dagger} $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is there any way to put explicitly these &lt;span class=&quot;math-container&quot;&gt;$K_i$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="11626" LastActivityDate="2020-04-09T12:55:07.553" Title="How can I implement an arbitrary quantum channel in a quantum circuit for real experiments using IBM quantum experience?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11470" PostTypeId="2" ParentId="11468" CreationDate="2020-04-09T04:45:28.130" Score="3" Body="&lt;p&gt;Here's an image from a previous answer of mine:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BN1ln.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BN1ln.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;If you replace the &lt;span class=&quot;math-container&quot;&gt;$\sigma_1\otimes\sigma_2\otimes\ldots\otimes\sigma_n$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; equal to &lt;span class=&quot;math-container&quot;&gt;$-2\theta$&lt;/span&gt;, this will do the job up to a global phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-09T04:45:28.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11471" PostTypeId="2" ParentId="11463" CreationDate="2020-04-09T06:08:48.563" Score="1" Body="&lt;p&gt;The Ising model is a formulation of your problem. Variables are variables &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; that can take +1/-1 values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{equation}&#xA; \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&#xA;\end{equation}&#xA;$$&lt;/span&gt;&#xA;For a quantum form, we use spin operators &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt;, giving you an Ising Hamiltonian, whose eigenvalues correspond to the previous cost. What we try to achieve for minimization, is find the state &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In computer science, there is a similar formulation. We use generally QUBO formulations defined on 0/1 variables &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; with a matrix of coefficients &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\begin{equation}&#xA;  f(x) = \sum_{i} {Q_{i,i}}{x_i} + \sum_{i&amp;lt;j} {Q_{i,j}}{x_i}{x_j}&#xA;\end{equation}&#xA;$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is very easy to go from one formulation to another, using the transformation &lt;span class=&quot;math-container&quot;&gt;$s = 2x - 1$&lt;/span&gt;. Many problems can be expressed with these two formulations such as Portfolio Optimization. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For references, you can have a look at (in addition to the notebook you point out):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2278729&quot; rel=&quot;nofollow noreferrer&quot;&gt;Portfolio Optimization: Applications in Quantum Computing&#xA;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising formulations of many NP problems&#xA;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.dwavesys.com/docs/latest/c_gs_3.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;D-Wave documentation on Ising/QUBO&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-04-09T06:08:48.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11472" PostTypeId="2" ParentId="2056" CreationDate="2020-04-09T10:07:06.730" Score="4" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1808.10402&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum computational chemistry&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1509.04279&quot; rel=&quot;nofollow noreferrer&quot;&gt;The theory of variational hybrid quantum-classical algorithms&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, for many problems, you don't have physical insights. Then, the solution I found in the literature are the following: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Gradually adding layers&lt;/strong&gt;: 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 &quot;&lt;a href=&quot;https://www.nature.com/articles/s41534-019-0167-6&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational quantum state diagonalization&lt;/a&gt;&quot; &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Introducing a local version of the cost function&lt;/strong&gt;: I haven't fully understood this one, but here is the paper you can check and find more info: &quot;&lt;a href=&quot;https://arxiv.org/abs/1909.05820&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Linear Solver: A Hybrid Algorithm for Linear Systems&lt;/a&gt;&quot; &lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Using Hamiltonian Morphing&lt;/strong&gt;: this method is based on the Adiabatic theorem. If you are trying to solve a linear system &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; then you can &quot;evolve&quot; the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; during the computation as &lt;span class=&quot;math-container&quot;&gt;$A(t)=(1-t/T)I+t/T \cdot A$&lt;/span&gt;. Where T is a fixed time and t is the time variable of the simulation. I think &quot;&lt;a href=&quot;https://arxiv.org/abs/1909.03898&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational algorithms for linear algebra&lt;/a&gt;&quot; explains it much better than I do. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11551" LastEditorUserId="9006" LastEditDate="2020-04-09T10:36:31.093" LastActivityDate="2020-04-09T10:36:31.093" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11473" PostTypeId="2" ParentId="11469" CreationDate="2020-04-09T12:55:07.553" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you have two possibilities to implement your channel:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4364/depolarizing-channel-implementation-on-ibm-q&quot;&gt;this example&lt;/a&gt; in your case. Otherwise, you might need to use an LCU (linear combination of unitary) decomposition or some other techniques.&lt;/li&gt;&#xA;&lt;li&gt;You really want to use the intrinsic noise of the device. Then, maybe, your channel is implementable using &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-openpulse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenPulse&lt;/a&gt;, but you will need to prepare it using some quantum control and it will be hard if you don't have the background.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-09T12:55:07.553" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11474" PostTypeId="1" AcceptedAnswerId="11475" CreationDate="2020-04-09T13:09:25.133" Score="1" ViewCount="65" Body="&lt;p&gt;Let start with a multi controlled Toffoli gate. Looking at the matrix representation (in the binary base), you easily see &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\pmatrix{&#xA;1&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0\\ &#xA;0&amp;amp; 1&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0\\ &#xA;0&amp;amp; 0&amp;amp; 1&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0\\ &#xA;0&amp;amp; 0&amp;amp; 0&amp;amp; 1&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0\\ &#xA;0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 1&amp;amp; 0&amp;amp; 0&amp;amp; 0\\ &#xA;0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 1&amp;amp; 0&amp;amp; 0\\ &#xA;0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 1\\ &#xA;0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 0&amp;amp; 1&amp;amp; 0\\ &#xA;}&#xA;$$&lt;/span&gt;&#xA;that it only switches two states: &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt;. Conjugating with some &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates on qubit 1 and 2 gives three more pair switches. Similar for the Fredkin gate which switches &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How to generate any of the &lt;span class=&quot;math-container&quot;&gt;$8\cdot 7 $&lt;/span&gt; possible two level switches for three qubits out of elementary gates?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And how for general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For the three qubit case, I tried to e.g. construct a switch of &lt;span class=&quot;math-container&quot;&gt;$|000\rangle \leftrightarrow |111\rangle$&lt;/span&gt; by mapping &lt;span class=&quot;math-container&quot;&gt;$|110\rangle \mapsto |000\rangle$&lt;/span&gt;. To achieve that I conjugated the Toffoli with the following sub circuit: &#xA;two CNOTs conjugated by some &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It worked! I could even construct a switch of &lt;span class=&quot;math-container&quot;&gt;$|000\rangle \leftrightarrow |011\rangle$&lt;/span&gt; by extending the above subcircuit (with another Toffoli) the maps &lt;span class=&quot;math-container&quot;&gt;$|111\rangle \mapsto |011\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I'm not sure whether this approach is valid or if I had just a lucky punch... &lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-04-09T22:00:46.340" LastActivityDate="2020-04-09T22:00:46.340" Title="Any two level flip in $n$ qubit system" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11475" PostTypeId="2" ParentId="11474" CreationDate="2020-04-09T16:38:03.190" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Find a bit position &lt;code&gt;t&lt;/code&gt; where the two states disagree about a bit. Let &lt;code&gt;s&lt;/code&gt; be the state where the bit at &lt;code&gt;t&lt;/code&gt; is 0.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each bit position &lt;code&gt;p&lt;/code&gt; other than &lt;code&gt;t&lt;/code&gt; where the bit is 0 in &lt;code&gt;s&lt;/code&gt;, apply a NOT to qubit &lt;code&gt;p&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For each bit position &lt;code&gt;p&lt;/code&gt; other than &lt;code&gt;t&lt;/code&gt; where the two states disagree about a bit, apply a CNOT from qubit &lt;code&gt;t&lt;/code&gt; to qubit &lt;code&gt;p&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a CCC...CNOT targeting qubit &lt;code&gt;t&lt;/code&gt; controlled by all other qubits.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do the same thing as in step (3).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Do the same thing as in step (2).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-04-09T16:38:03.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11476" PostTypeId="1" AcceptedAnswerId="11484" CreationDate="2020-04-09T23:31:11.950" Score="2" ViewCount="54" Body="&lt;p&gt;Suppose Alice shares &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; pairs of maximally entangled states with Bob and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;0&quot; or all have outcome &quot;1&quot;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: Just want to emphasize that communication is forbidden. Otherwise, the problem is trivial since the classical outcome &quot;0&quot; or &quot;1&quot; can be copied and redistributed.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-07-27T12:27:25.200" LastActivityDate="2020-07-27T12:27:25.200" Title="Can pairwise entanglement be converted into tripartite correlations?" Tags="&lt;entanglement&gt;&lt;correlations&gt;&lt;entanglement-swapping&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11477" PostTypeId="1" AcceptedAnswerId="16103" CreationDate="2020-04-10T02:43:37.417" Score="3" ViewCount="115" Body="&lt;p&gt;I would like to find the lowest eigenvalue of a &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; real matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; using the VQE procedure. The measurement part is simple — I just expand &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in a sum of all possible &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I have not yet come up with a nice way of preparing an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state with real amplitudes. What would be a good ansatz operator &lt;span class=&quot;math-container&quot;&gt;$U(\theta_1,\ldots\theta_{2^n-1})$&lt;/span&gt; to do the job?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(If I were solving the problem in the second-quantized formalism using &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; qubits, I would simply use the Unitary Coupled Cluster with &lt;span class=&quot;math-container&quot;&gt;$(2^n - 1)$&lt;/span&gt; single amplitudes — does it have an analogue in such a 'binary' encoding??)&lt;/p&gt;&#xA;" OwnerUserId="8008" LastEditorUserId="23" LastEditDate="2020-04-17T21:52:55.237" LastActivityDate="2021-02-19T08:06:26.140" Title="Ansatz state for finding the lowest eigenvalue of a $2^n\times 2^n$ real matrix using VQE" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11479" PostTypeId="1" CreationDate="2020-04-10T10:13:13.103" Score="1" ViewCount="19" Body="&lt;p&gt;I have been experimenting with the measurement mitigation module in Qiskit Ignis lately. I determined a calibration matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with the help of &lt;code&gt;CompleteMeasurementFitter(..., qubit_list=qubit_list)&lt;/code&gt; (calibration circuits and state labels given by &lt;code&gt;complete_meas_cal(..., qubit_list=qubit_list)&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have &lt;code&gt;qubit_list = [0, 1, 2]&lt;/code&gt; and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;state_labels = ['000', '001', '010', '011', '100', '101', '110', '111']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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. &#xA;I want to find the calibration matrix for the qubit subsystem &lt;code&gt;[1, 2]&lt;/code&gt; with the &lt;code&gt;subset_fitter()&lt;/code&gt; function. When I went through the source code, I struggled with the line where the reduced state labels are computed:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt;state_labels_reduced = []&#xA;for label in self.state_labels:&#xA;    tmplabel = [label[l] for l in qubit_sublist_ind]&#xA;    state_labels_reduced.append(''.join(tmplabel))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;qubit_sublist_ind&lt;/code&gt; is a list of indices, which maps the reduced qubit list to the original one, in my case:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qubit_sublist_ind = [1, 2]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What confuses me now is that the quoted code snippet produces&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;state_labels_reduced = ['00', '01', '10', '11', '00', '01', '10', '11']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;while I would expect&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;state_labels_reduced = ['00', '00', '01', '01', '10', '10', '11', '11']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="10405" LastEditorUserId="10405" LastEditDate="2020-04-10T10:18:32.737" LastActivityDate="2020-04-10T10:18:32.737" Title="Confusion regarding subset_fitter() functionality from CompleteMeasurementFitter() in Qiskit.Ignis" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11480" PostTypeId="1" AcceptedAnswerId="11482" CreationDate="2020-04-10T11:57:20.890" Score="1" ViewCount="123" Body="&lt;p&gt;I understand you can compose a 2 qubit operation as the tensor product of single qubit operations as: &lt;code&gt;U = U1 x U2&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where U1 applies the the first bit and U2 applies to the second.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can compose a 2x2 hadamard as follows for U1 in python and numpy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;had = hadamard(2, dtype=complex)  / math.sqrt(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And an identity for U2:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;id = np.identity(2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And then take the tensorproduct, U:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;had_id = np.tensordot(had, id, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The resulting matrix is sort of correct:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[[[ 0.70710678+0.j  0.        +0.j]&#xA;   [ 0.        +0.j  0.70710678+0.j]]&#xA;  [[ 0.70710678+0.j  0.        +0.j]&#xA;   [ 0.        +0.j  0.70710678+0.j]]]&#xA; [[[ 0.70710678+0.j  0.        +0.j]&#xA;   [ 0.        +0.j  0.70710678+0.j]]&#xA;  [[-0.70710678+0.j -0.        +0.j]&#xA;   [-0.        +0.j -0.70710678+0.j]]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But just isn't composed properly as a 4x4 matrix that can be applied as a 2-qubit operator. If I reshape, &lt;code&gt;reshape(4,4)&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11634" LastActivityDate="2020-04-10T12:12:56.057" Title="Taking tensor product of single qubit unitary operation matrices" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11481" PostTypeId="2" ParentId="11477" CreationDate="2020-04-10T12:05:57.007" Score="1" Body="&lt;p&gt;If you don't have any prior on your matrix, you can use the &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/code/api/pennylane.templates.layers.StronglyEntanglingLayers.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strongly Entangling Circuit&lt;/a&gt; as a very generic ansatz for qubits.&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-10T12:05:57.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11482" PostTypeId="2" ParentId="11480" CreationDate="2020-04-10T12:12:56.057" Score="3" Body="&lt;p&gt;You can use &lt;code&gt;np.kron&lt;/code&gt; instead of &lt;code&gt;np.tensordot&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;had_id = np.kron(had, id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It should give you the 4x4 matrix you're expecting.&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-10T12:12:56.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11484" PostTypeId="2" ParentId="11476" CreationDate="2020-04-10T16:09:46.233" Score="2" Body="&lt;p&gt;No, it is not possible without communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Finally, note that &lt;em&gt;with&lt;/em&gt; communication, A+B+C can prepare &lt;em&gt;any&lt;/em&gt; tripartite state they want by using teleportation (A prepares the whole state and teleports B's and C's share to them.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-04-10T16:32:09.143" LastActivityDate="2020-04-10T16:32:09.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11486" PostTypeId="1" CreationDate="2020-04-10T21:04:52.743" Score="6" ViewCount="205" Body="&lt;p&gt;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 &quot;simultaneous&quot; 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 &quot;quantumness&quot; of quantum computing without the need for setting some non-zero value of the Planck's constant. Thank you.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;QC-Novice&lt;/p&gt;&#xA;" OwnerUserId="11645" LastEditorUserId="2927" LastEditDate="2020-04-10T22:31:53.890" LastActivityDate="2020-04-12T04:04:10.040" Title="Does Planck's constant have any role in quantum computing?" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;interpretations&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11487" PostTypeId="1" CreationDate="2020-04-10T21:05:18.240" Score="3" ViewCount="94" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-04-10T22:50:55.090" Title="QAOA Belongs into VQE or the other way around?" Tags="&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11488" PostTypeId="1" AcceptedAnswerId="11489" CreationDate="2020-04-10T21:26:04.103" Score="1" ViewCount="66" Body="&lt;p&gt;A simple question that I cannot seem to figure-out why I cannot achieve the correct result. When I evaluate &lt;span class=&quot;math-container&quot;&gt;$$\vert 0 \rangle \otimes \vert + \rangle,$$&lt;/span&gt;&#xA;I end up with &lt;span class=&quot;math-container&quot;&gt;$$\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},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 01 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 10 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 11 \rangle$&lt;/span&gt; have &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0\%$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0\%$&lt;/span&gt; probability to be measured, respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trivial circuit (if you even consider it a circuit) on &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B&amp;quot;cols&amp;quot;:[[&amp;quot;Chance2&amp;quot;]],&amp;quot;init&amp;quot;:[0,&amp;quot;+&amp;quot;]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;algassert&lt;/a&gt; suggests that the probabilities when measured are &lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle = 50\%$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 01 \rangle = 0\%$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert 10 \rangle = 50\%$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vert 11 \rangle = 0\%$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why is my solution doesn't align with algassert?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="9006" LastEditDate="2020-04-10T21:41:37.283" LastActivityDate="2020-04-11T05:10:07.950" Title="What is $\vert 0 \rangle \otimes \vert + \rangle$?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11489" PostTypeId="2" ParentId="11488" CreationDate="2020-04-10T21:50:21.377" Score="2" Body="&lt;p&gt;Your calculation of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |+\rangle$&lt;/span&gt; is right. For now, forget about calculation and use simple logic. In your setting first qubit is always in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the second one is in equally distributed superposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Hence when you take both qubits together, only states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; are possible and both have a probability 50 %.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There can be a problem with qubits ordering. In &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |+\rangle$&lt;/span&gt; we assume that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the most signigicant qubit, hence it is writen first. However, you can also use another convention when &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the least significant qubit, hence it is writen on second place. In this setting you will get results &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; with a probability 50 % and others with zero percent probability.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-10T21:50:21.377" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11490" PostTypeId="2" ParentId="11486" CreationDate="2020-04-10T22:05:27.020" Score="2" Body="&lt;p&gt;Time evolution of quantum systems is described by Schrodinger equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i \frac{h}{2\pi}\frac{\partial}{\partial t}|\psi(t)\rangle = H |\psi(t)\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_units&quot; rel=&quot;nofollow noreferrer&quot;&gt;natural units system&lt;/a&gt;&lt;/em&gt; where reduced Planck constant (i.e &lt;span class=&quot;math-container&quot;&gt;$\frac{h}{2\pi}$&lt;/span&gt;), 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-10T22:05:27.020" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="11491" PostTypeId="2" ParentId="11487" CreationDate="2020-04-10T22:50:55.090" Score="2" Body="&lt;p&gt;QAOA belongs to VQE. Indeed, the idea of VQE is to use a parametrized quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; to minimize &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle 0|U(\theta)^{\dagger}H_PU(\theta)|0\rangle$$&lt;/span&gt;&#xA;in order to obtain an approximation of the groundstate of &lt;span class=&quot;math-container&quot;&gt;$H_P$&lt;/span&gt;. The circuit &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; is called an ansatz, and QAOA uses a particular type of ansatz that can be written&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(\theta)=e^{i\beta_1H_P} e^{i\gamma_1H_M}...e^{i\beta_pH_P} e^{i\gamma_pH_M}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta=(\gamma_1,\beta_1,...,\gamma_p,\beta_p)$&lt;/span&gt;. Therefore, it can be seen as a special case of VQE&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-10T22:50:55.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11492" PostTypeId="1" CreationDate="2020-04-11T02:24:04.093" Score="0" ViewCount="323" Body="&lt;p&gt;I have been following this tutorial: &lt;a href=&quot;https://dkopczyk.quantee.co.uk/vqe/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://dkopczyk.quantee.co.uk/vqe/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the thing though, while I can match expectation values, the graph I find for their angle range does not match their result. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I doing wrong and\or not getting about minimization? My code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def small_ansatz(parameter_y, qubit):&#xA;  ygate = cirq.YPowGate(exponent=parameter_y)&#xA;  #ygate = cirq.YPowGate(exponent=parameter_y)&#xA;  #yield xgate(qubit)&#xA;  yield ygate(qubit)&#xA;&#xA;#wrapping into a circuit&#xA;&#xA;def psi_circuit(parameter):&#xA;  curr_q = cirq.LineQubit(0)&#xA;  curr_c = cirq.Circuit()&#xA;&#xA;  curr_c.append(small_ansatz(parameter, curr_q))&#xA;&#xA;  curr_c.append(cirq.measure(curr_q, key='q0'))&#xA;  return curr_c&#xA;&#xA;def expectation_value_vqe(param, num_reps):&#xA;  curr_psi = psi_circuit(param)&#xA;  print()&#xA;  #keep the measured keys and values&#xA;&#xA;  curr_simulator = cirq.Simulator()&#xA;  curr_results = curr_simulator.run(curr_psi, repetitions=num_reps) &#xA;  s_k, s_v= zip(*r.measurements.items())&#xA;&#xA;  #convert into booleans from sp|in values&#xA;  curr_state_values = 1 - 2*np.array(s_v).astype(np.int32)&#xA;&#xA;  #get the expectation value (the average of the counts)&#xA;  #I keep double the variables because I want to remind myself of the distinction between this task and the context &#xA;  #of Farhi's paper.&#xA;  curr_predicted_label_value = np.mean(curr_state_values)&#xA;  return(curr_predicted_label_value)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the plot I get for my expectation values for the ansatz: &#xA;&lt;a href=&quot;https://i.stack.imgur.com/EwrzP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EwrzP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here is the tutorial: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I also implemented this on Qiskit and did obtain the plot to match Grove's. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/99HAJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/99HAJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-04-11T05:33:47.387" LastActivityDate="2020-04-12T05:57:00.890" Title="VQE for Beginners : Using Tutorial and Cirq" Tags="&lt;qiskit&gt;&lt;cirq&gt;&lt;vqe&gt;&lt;qaoa&gt;&lt;pyquil&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11493" PostTypeId="2" ParentId="11488" CreationDate="2020-04-11T05:10:07.950" Score="1" Body="&lt;p&gt;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 &quot;Final amplitudes&quot; left to right, it says that you have &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; each of getting &lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\vert 01 \rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$0\%$&lt;/span&gt; of measuring &lt;span class=&quot;math-container&quot;&gt;$\vert 10 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\vert 11 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1790" LastActivityDate="2020-04-11T05:10:07.950" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11495" PostTypeId="1" CreationDate="2020-04-11T11:48:45.260" Score="2" ViewCount="57" Body="&lt;p&gt;About the &lt;code&gt;qasm_simulator&lt;/code&gt;, does it have on its 32 qubits a qubit connectivity design like as &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; or as another real device of IBM Experience and Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="11650" LastEditorUserId="5955" LastEditDate="2020-04-11T12:15:16.540" LastActivityDate="2020-04-11T12:49:20.217" Title="Design connectivity of qasm_simulator" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11496" PostTypeId="2" ParentId="11495" CreationDate="2020-04-11T12:16:03.920" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-04-11T12:16:03.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11497" PostTypeId="2" ParentId="11495" CreationDate="2020-04-11T12:49:20.217" Score="2" Body="&lt;p&gt;You can control the connectivity using parameters of the &lt;code&gt;execute&lt;/code&gt; function. You can obtain the connectivity of a specific device by querying the backend configuration, and pass it to &lt;code&gt;execute&lt;/code&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-04-11T12:49:20.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11498" PostTypeId="2" ParentId="11492" CreationDate="2020-04-11T13:10:21.910" Score="2" Body="&lt;p&gt;In the tutorial, the RY gate is used. What you are using is different. If you look at the &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.YPowGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;corresponding documentation of that gate&lt;/a&gt;, you would see:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note in particular that this gate has a global phase factor of&#xA;  e^{i·π·t/2} vs the traditionally defined rotation matrices&#xA;  about the Pauli Y axis.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This may explain the difference. You can use instead the cirq.ry operation to reproduce the tutorial. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried your code by replacing by cirq.ry :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ygate = cirq.ry(parameter_y)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And running the following gave me the correct plot:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;params_range = np.linspace(0.0, 2 * np.pi, 25)&#xA;&#xA;data = [expectation_value_vqe(params) for params in params_range]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zp4Zp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zp4Zp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2020-04-12T05:57:00.890" LastActivityDate="2020-04-12T05:57:00.890" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11499" PostTypeId="2" ParentId="11486" CreationDate="2020-04-11T14:24:22.080" Score="3" Body="&lt;p&gt;I like this question although the question and answers may be a bit vague/a moving target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initially I'll quote Gil Kalai who asked a &lt;a href=&quot;https://mathoverflow.net/questions/341306/the-planck-constant-for-mathematicians&quot;&gt;very similar question&lt;/a&gt; on MathOverflow:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We can take Marin Vesely's observation and work in the natural units system, as that appears to hide the (dimensioned) &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; by setting it to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and enabling exponentiation of (dimensionless) time as in the time-dependent Schrodinger equation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think this may depend upon how qubits are embodied, as we must trace this out to find a hidden &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, Carlo Beenakker (whose profile pic is of &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt;!) 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:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;That is simply a choice (made in the early days of [quantum computing]) to normalize the action &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; by twice the angular momentum of the electron spin, which is just &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt;. So with that choice &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is dimensionless and Planck's constant &lt;span class=&quot;math-container&quot;&gt;$\hbar=1$&lt;/span&gt;, which is why it vanishes from sight.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, what is still fundamentally &quot;quantum&quot; are the &lt;em&gt;photons of light&lt;/em&gt; itself.  That is, if we work with &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_optical_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear optical quantum computing&lt;/a&gt;, we can measure non-commuting properties of photon polarization, but we are acting on the individual &lt;em&gt;quanta&lt;/em&gt; of light.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-04-11T14:24:22.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11500" PostTypeId="1" AcceptedAnswerId="11502" CreationDate="2020-04-11T17:58:35.887" Score="1" ViewCount="65" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} =\mathbb{C}^2, \mathcal{M}_1 = \mathbb{C}|0\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha |0\rangle + \beta|1\rangle$&lt;/span&gt;. Show &lt;span class=&quot;math-container&quot;&gt;$Pr(\mathcal{M_1}) = |\alpha|^2.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M_1}$&lt;/span&gt; is a subspace of the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;, and that &lt;span class=&quot;math-container&quot;&gt;$Pr(\mathcal{M_1}) = \langle \psi| Proj_\mathcal{M}|\psi\rangle.$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see that when we first evaluate &lt;span class=&quot;math-container&quot;&gt;$Pr(\mathcal{M_1}) = \langle \psi| Proj_\mathcal{M}|\psi\rangle$&lt;/span&gt; we obtain &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11648" LastEditorUserId="55" LastEditDate="2020-08-19T17:34:25.903" LastActivityDate="2020-08-19T17:34:25.903" Title="Quantum Expectation Calculation with Orthogonal Projection" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11501" PostTypeId="1" AcceptedAnswerId="11521" CreationDate="2020-04-11T18:23:52.967" Score="5" ViewCount="161" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="10114" LastEditorUserId="9006" LastEditDate="2020-04-11T21:56:37.793" LastActivityDate="2020-04-12T19:47:55.527" Title="What are the differences between the different transpiler optimization levels in qiskit" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11502" PostTypeId="2" ParentId="11500" CreationDate="2020-04-11T18:45:20.713" Score="2" Body="&lt;p&gt;The definition of projectors can be found on page 70 from M. Nielsen and I. Chuang &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt;: Suppose &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-dimensional vector subspace of the &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. Using the Gram–Schmidt procedure it is possible to construct an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;,...&lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;,...&lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; is an orthonormal basis for &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. By definition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P = \sum_{i = 1}^k | i \rangle \langle i |$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is a projector onto the subspace &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. End of the quote from the textbook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for &lt;span class=&quot;math-container&quot;&gt;$H = \mathbb{C}^2$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are orthonormal basis vectors and the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle 0|$&lt;/span&gt; will be a valid projector into &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; subspace:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Proj_{M_1} = |0\rangle \langle 0|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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) \\&#xA;=\big(\alpha^* \langle 0| 0 \rangle + \beta^* \langle 1 | 0 \rangle \big) \big(\alpha \langle 0 | 0 \rangle + \beta \langle 0 | 1 \rangle\big) =&#xA;\alpha^* \alpha = |\alpha|^2&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where we took into account:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp;\text{ortnormality:}\quad \;\; \langle 0| 0 \rangle = \langle 1| 1 \rangle = 1;&#xA;\quad \;\;\;\; \langle 0| 1 \rangle = \langle 1| 0 \rangle = 0 \\&#xA;&amp;amp;\text{$|\psi\rangle$ and $\langle \psi |$:} \qquad |\psi\rangle = \alpha | 0 \rangle + \beta | 1 \rangle; \qquad \langle \psi | = \alpha^* \langle 0| + \beta^* \langle 1 |&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-11T19:33:06.007" LastActivityDate="2020-04-11T19:33:06.007" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11503" PostTypeId="2" ParentId="11430" CreationDate="2020-04-11T18:53:46.130" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is a diagonal matrix, and &lt;span class=&quot;math-container&quot;&gt;$\max{C}$&lt;/span&gt; is simply the maximum element (which is also the maximum eigenvalue, since the matrix is already diagonal). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is also what is usually meant by &quot;maximum&quot; and &quot;minimum&quot; in this &quot;quantum optimization&quot; literature, which includes adiabatic quantum computing (AQC), quantum annealing, and QAOA.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-04-11T18:53:46.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11504" PostTypeId="1" CreationDate="2020-04-11T21:11:18.317" Score="2" ViewCount="185" Body="&lt;p&gt;I just want to use the &quot;if&quot; gate in IBM QX circuit composer, but I don't know how.&lt;/p&gt;&#xA;" OwnerUserId="11657" LastEditorUserId="9006" LastEditDate="2020-04-11T21:33:41.413" LastActivityDate="2020-04-11T21:55:29.930" Title="How can I use IF gate in IBM Q composer?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11505" PostTypeId="2" ParentId="11504" CreationDate="2020-04-11T21:55:29.930" Score="3" Body="&lt;p&gt;IF gate can be used for controlling gates based on value in classical register, i.e. measured values of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lets see at this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HPxYk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HPxYk.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. After measurement you have value 1 in classical bit &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and value 0 in classical bit &lt;span class=&quot;math-container&quot;&gt;$c_0$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$c_1c_0 = 10$&lt;/span&gt; in binary or &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; in decimal numbers. Then IF gate is used with condition &lt;span class=&quot;math-container&quot;&gt;$c=2$&lt;/span&gt;. Since there is the value 2 in classical register, the condition is fulfiled and gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; linked to IF statement is activated. This leads to negating qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After measurement you have classical register in state &lt;span class=&quot;math-container&quot;&gt;$110$&lt;/span&gt;, where the first &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; comes from measuring qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; from measuring qubits &lt;span class=&quot;math-container&quot;&gt;$q_0q_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 1: IF statement can be used only with simulator. It has not been implemented for real quantum processors yet.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note 3: Here is a code of above circuit:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[3];&#xA;creg c[3];&#xA;&#xA;x q[0];&#xA;measure q[0] -&amp;gt; c[1];&#xA;measure q[1] -&amp;gt; c[0];&#xA;&#xA;if (c==2) x q[2];&#xA;measure q[2] -&amp;gt; c[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-11T21:55:29.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11506" PostTypeId="1" AcceptedAnswerId="11553" CreationDate="2020-04-12T00:06:15.013" Score="2" ViewCount="80" Body="&lt;p&gt;The max-relative entropy between two states is &lt;a href=&quot;https://arxiv.org/pdf/0803.2770.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;defined&lt;/a&gt; as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho\leq \sigma$&lt;/span&gt; should be read as &lt;span class=&quot;math-container&quot;&gt;$\sigma - \rho$&lt;/span&gt; is positive semidefinite. Consider the following quantity for a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; with reduced states &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{B}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I_{\max}(\rho_{AB}) = D_{\max}(\rho_{AB}||\rho_{A}\otimes\rho_{B})$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to know if this satisfies a continuity bound. That is, given &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}\approx_{\epsilon}\sigma_{AB}$&lt;/span&gt; in some distance measure, can we bound &lt;span class=&quot;math-container&quot;&gt;$|I_{\max}(\rho_{AB}) - I_{\max}(\sigma_{AB})|$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Motivation for question: Recall the quantum relative entropy &lt;span class=&quot;math-container&quot;&gt;$D(\rho||\sigma) = \text{Tr}(\rho\log\rho - \rho\log\sigma)$&lt;/span&gt; with the convention that &lt;span class=&quot;math-container&quot;&gt;$0\log 0 = 0$&lt;/span&gt;. Let us define the mutual information as follows&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I(\rho_{AB}) = D(\rho_{AB}||\rho_{A}\otimes\rho_{B}) = -S(\rho_{AB}) + S(\rho_A) + S(\rho_B),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$S(\rho) = -\text{Tr}(\rho\log\rho)$&lt;/span&gt; is the von Neumann entropy. In this case, we may use &lt;a href=&quot;https://en.wikipedia.org/wiki/Fannes%E2%80%93Audenaert_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fannes inequality&lt;/a&gt; to find a bound on &lt;span class=&quot;math-container&quot;&gt;$|I(\rho_{AB}) - I(\sigma_{AB})|$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$\|\rho_{AB} - \sigma_{AB}\|_1$&lt;/span&gt;. I'm wondering if the move from &lt;span class=&quot;math-container&quot;&gt;$D(.||.)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(.||.)$&lt;/span&gt; can be made while still having some Fannes type bound. &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-10-27T09:12:51.507" LastActivityDate="2020-10-27T09:12:51.507" Title="Continuity bounds on $D_{\max}(\rho_{AB}\|\rho_A\otimes\rho_B)$" Tags="&lt;entropy&gt;&lt;information-theory&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11507" PostTypeId="1" AcceptedAnswerId="11511" CreationDate="2020-04-12T01:21:55.047" Score="0" ViewCount="60" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RLTzf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RLTzf.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a picture from Wiki(&lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_logic_gate&lt;/a&gt;&lt;/em&gt;). Can someone give me a simple example by using two qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/akfC5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/akfC5.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11523" LastEditorUserId="23" LastEditDate="2020-07-26T18:07:27.320" LastActivityDate="2020-07-26T18:07:27.320" Title="Could someone give an example of this pic?" Tags="&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11509" PostTypeId="2" ParentId="11486" CreationDate="2020-04-12T03:47:57.693" Score="3" Body="&lt;p&gt;Great question, and David Mermin dedicates an entire section of his great paper &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0207118&quot; rel=&quot;nofollow noreferrer&quot;&gt;From Cbits to Qbits&lt;/a&gt;&amp;quot; to it:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If we are not interested in location in continuous space and are only interested in global rather than infinitessimal unitary transformations, then &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Deploring the absence of &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So basically, quantum algorithms researchers aren't setting &lt;span class=&quot;math-container&quot;&gt;$\hbar = 0$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$(\Delta E) T/\hbar$&lt;/span&gt; that arise from the Schrodinger equation.&lt;/p&gt;&#xA;&lt;p&gt;To put it another way, Shankar lists the four fundamental postulates of nonrelativistic quantum mechanics as (greatly abbreviating):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Physical states are represented by vectors in a Hilbert space&lt;/li&gt;&#xA;&lt;li&gt;Measurements yield eigenvalues of the corresponding operator with probability given by the Born rule and change the state to the measured eigenstate.&lt;/li&gt;&#xA;&lt;li&gt;The canonical commutation relation &lt;span class=&quot;math-container&quot;&gt;$[x_i, p_j] = i \hbar \delta_{ij}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The Schrodinger equation for time evolution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt;. (Although the device engineers certainly need to understand the postulates 3 and especially 4 very well. And &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; computational basis states are angular momentum states that differ by &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$2\hbar$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;There is clearly some sense in which postulates 3 and 4 &amp;quot;go away&amp;quot; in the formal limit &lt;span class=&quot;math-container&quot;&gt;$\hbar \to 0$&lt;/span&gt; (although we need to very careful what that limit actually means), since they explicitly contain &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt;, but postulates 1 and 2 clearly &amp;quot;survive&amp;quot;, 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.&lt;/p&gt;&#xA;&lt;p&gt;Finally, I'll mention that &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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 &amp;quot;analog&amp;quot; and more directly tied the underlying physics of the hardware.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-04-12T04:04:10.040" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11510" PostTypeId="1" AcceptedAnswerId="11515" CreationDate="2020-04-12T05:17:14.003" Score="2" ViewCount="71" Body="&lt;p&gt;Prove that if   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_1}\text{Proj}_{M_2}= \text{Proj}_{M_2}\text{Proj}_{M_1}$&lt;/span&gt; then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{Pr}(\text{span}[M_1, M_2]) = \text{Pr}(M_1) + \text{Pr}(M_2) − \text{Pr}(M_1 \cap  M_2)$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt;.   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/O3dOg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O3dOg.png&quot; alt=&quot;Image from text to provide definitions&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10215" LastEditorUserId="55" LastEditDate="2020-04-13T07:59:42.033" LastActivityDate="2020-04-13T07:59:42.033" Title="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)$" Tags="&lt;projection-operator&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11511" PostTypeId="2" ParentId="11507" CreationDate="2020-04-12T06:14:15.077" Score="2" Body="&lt;p&gt;Since Fourier transform and inverse Fourier transform for one qubit is only Hadamard gate, for two qubit case following two circuits are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;First circuit (Fourier transform applied on qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/swoEp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/swoEp.png&quot; alt=&quot;Circuit 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;First circuit (inverse Fourier transform applied on qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8NIca.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8NIca.png&quot; alt=&quot;Circuit 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both circuits return state&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{1}{2}(|00\rangle + |01\rangle + |10\rangle - |11\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I have just realized that the gate &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-12T06:37:13.453" LastActivityDate="2020-04-12T06:37:13.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11512" PostTypeId="1" AcceptedAnswerId="11513" CreationDate="2020-04-12T08:21:57.407" Score="1" ViewCount="95" Body="&lt;p&gt;I understand that starting with&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RvoeK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RvoeK.png&quot; alt=&quot;Entanglement circuit&quot;&gt;&lt;/a&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we can get to &lt;span class=&quot;math-container&quot;&gt;$\vert \Phi^+ \rangle$&lt;/span&gt;. First, we start with &lt;span class=&quot;math-container&quot;&gt;$\vert Q_1 \rangle \otimes \vert Q_2 \rangle = \vert 0 \rangle \otimes \vert 0 \rangle$&lt;/span&gt; and then applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$Q_1$&lt;/span&gt; which gives &lt;span class=&quot;math-container&quot;&gt;$\left( \frac{1}{\sqrt{2}}\vert 0 \rangle + \frac{1}{\sqrt{2}}\vert 1 \rangle \right)\otimes \vert 0 \rangle$&lt;/span&gt;. After &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt;, we obtain &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\vert 00 \rangle + \frac{1}{\sqrt{2}}\vert 10 \rangle$&lt;/span&gt;. Then, we apply the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate to end up with &lt;span class=&quot;math-container&quot;&gt;$$\vert \Phi^+ \rangle = \frac{1}{\sqrt{2}}\vert 00 \rangle + \frac{1}{\sqrt{2}}\vert 11 \rangle.$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start with the state &lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle = \scriptstyle\begin{bmatrix}1\\0\\0\\0\end{bmatrix}$&lt;/span&gt;. Between &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt;, I applied &lt;span class=&quot;math-container&quot;&gt;$$H \otimes I = \begin{bmatrix}\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; 0 &amp;amp; 0\\\frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}} &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\\0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}\end{bmatrix},$$&lt;/span&gt; &#xA;since we are manipulating &lt;span class=&quot;math-container&quot;&gt;$Q_1$&lt;/span&gt; and leaving &lt;span class=&quot;math-container&quot;&gt;$Q_2$&lt;/span&gt; unchanged to obtain &lt;span class=&quot;math-container&quot;&gt;$\scriptstyle\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\\0\\0\end{bmatrix}$&lt;/span&gt;. Lastly, we apply &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; which gives us &lt;span class=&quot;math-container&quot;&gt;$\scriptstyle\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\\0\\0\end{bmatrix}.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am &lt;strong&gt;&lt;em&gt;really&lt;/em&gt;&lt;/strong&gt; looking for the matrices required to achieve the desired result.&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="55" LastEditDate="2020-04-13T07:57:30.727" LastActivityDate="2020-04-13T07:57:30.727" Title="Show how the Bell state arises from the circuit with Hadamard and CNOT, using matrix notation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11513" PostTypeId="2" ParentId="11512" CreationDate="2020-04-12T09:16:07.557" Score="4" Body="&lt;p&gt;I think the problem of the calculations is in the &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt;, that should be equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H \otimes I = \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 \cdot I &amp;amp; 1 \cdot I \\&#xA;1 \cdot I &amp;amp; -1 \cdot I&#xA;\end{pmatrix} =&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&#xA;1 &amp;amp; 0 &amp;amp;-1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp;-1&#xA;\end{pmatrix} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then if we will apply this to &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state we will obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H \otimes I |00\rangle= &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&#xA;1 &amp;amp; 0 &amp;amp;-1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp;-1&#xA;\end{pmatrix} &#xA;\begin{pmatrix}&#xA;1\\0\\0\\0&#xA;\end{pmatrix} = &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1\\0\\1\\0&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's apply the CNOT gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CNOT \frac{1}{\sqrt{2}}\big(|00\rangle + |10\rangle\big)= &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{pmatrix} &#xA;\begin{pmatrix}&#xA;1\\0\\1\\0&#xA;\end{pmatrix} = &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1\\0\\0\\1&#xA;\end{pmatrix} =&#xA;\frac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle\big)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-04-12T09:16:07.557" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11514" PostTypeId="1" AcceptedAnswerId="11524" CreationDate="2020-04-12T09:33:29.813" Score="2" ViewCount="204" Body="&lt;p&gt;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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tYEet.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tYEet.png&quot; alt=&quot;My circuit&quot;&gt;&lt;/a&gt;&#xA;When I do the simulation with qasm everything is ok.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QBsQi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QBsQi.png&quot; alt=&quot;qasm simulation&quot;&gt;&lt;/a&gt; &#xA;When I start the circuit on ibmq_essex I get results in which the value of fourth qubit is 0. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/vmMTN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vmMTN.png&quot; alt=&quot;ibmq-essex execution&quot;&gt;&lt;/a&gt;&#xA;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?&#xA;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&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.ignis.mitigation.measurement import (complete_meas_cal, CompleteMeasFitter)&#xA;&#xA;cal_circuits, state_labels = complete_meas_cal(qr = circuit.qregs[0], circlabel = 'measerrormitigationcal')&#xA;len(cal_circuits)&#xA;cal_job = execute(cal_circuits, backend = qcomp,shots = 1024, optimization_level = 3)&#xA;job_monitor(cal_job)&#xA;cal_results = cal_job.result()&#xA;plot_histogram(cal_results.get_counts(cal_circuits[5]))&#xA;meas_fitter = CompleteMeasFitter(cal_results, state_labels)&#xA;meas_filter = meas_fitter.filter&#xA;mitigated_results = meas_filter.apply(result)&#xA;device_counts = result.get_counts(circuit)&#xA;mitigated_counts = mitigated_results.get_counts(circuit)&#xA;plot_histogram([device_counts, mitigated_counts], legend=['noisy', 'mitigated'],figsize=(20,15))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JWEn8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JWEn8.png&quot; alt=&quot;After Ignis mitigation error&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10335" LastEditorUserId="9459" LastEditDate="2020-04-13T08:47:05.997" LastActivityDate="2020-04-13T10:15:55.690" Title="Different results between qasm_simulator and quantum computer: how to normalize for only few states" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11515" PostTypeId="2" ParentId="11510" CreationDate="2020-04-12T11:40:44.813" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;It follows that  &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; is invariant subspace of operator &lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_2}$&lt;/span&gt;. Indeed, if &lt;span class=&quot;math-container&quot;&gt;$v \in M_1$&lt;/span&gt; then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Proj}_{M_1}\text{Proj}_{M_2}v=\text{Proj}_{M_2}\text{Proj}_{M_1}v = \text{Proj}_{M_2}v,$$&lt;/span&gt; &#xA;so &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Proj}_{M_1}(\text{Proj}_{M_2}v) = \text{Proj}_{M_2}v,$$&lt;/span&gt;&#xA;but this can happen only if &lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_2}v \in M_1$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Similarly, it can be proved that &lt;span class=&quot;math-container&quot;&gt;$M_1^{\perp}$&lt;/span&gt; is invariant for &lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_2}$&lt;/span&gt;, and also &lt;span class=&quot;math-container&quot;&gt;$M_2,M_2^{\perp}$&lt;/span&gt; are invariant for &lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_1}$&lt;/span&gt; by symmetry. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; is invariant for &lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{Proj}_{M_2}$&lt;/span&gt; has two eigenspaces &lt;span class=&quot;math-container&quot;&gt;$M_2,M_2^{\perp}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; can be split into &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_1 = (M_1 \cap M_2) \oplus (M_1 \cap M_2^{\perp})&#xA;$$&lt;/span&gt;&#xA;Similarly, &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_2 = (M_2 \cap M_1) \oplus (M_2 \cap M_1^{\perp})&#xA;$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;Now, clearly, &lt;span class=&quot;math-container&quot;&gt;$(M_1 \cap M_2^{\perp}) \perp (M_2 \cap M_1^{\perp})$&lt;/span&gt;, so &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_1 + M_2 = (M_1 \cap M_2) \oplus (M_1 \cap M_2^{\perp}) \oplus (M_2 \cap M_1^{\perp}),&#xA;$$&lt;/span&gt;&#xA;hence &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \text{Pr}(M_1) + \text{Pr}(M_2) - \text{Pr}(M_1 \cap M_2)&#xA;$$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;A more general case is discussed here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/6469/5870&quot;&gt;https://quantumcomputing.stackexchange.com/a/6469/5870&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-04-12T11:40:44.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11516" PostTypeId="1" AcceptedAnswerId="11585" CreationDate="2020-04-12T12:32:58.157" Score="0" ViewCount="112" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11662" LastEditorUserId="55" LastEditDate="2021-04-09T09:00:09.340" LastActivityDate="2021-04-09T09:00:09.340" Title="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?" Tags="&lt;quantum-gate&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11517" PostTypeId="1" AcceptedAnswerId="11587" CreationDate="2020-04-12T17:51:18.580" Score="2" ViewCount="175" Body="&lt;p&gt;Scott Aaronson is fond of saying &quot;Quantum computers do not solve hard search problems instantaneously by simply trying all the possible solutions at once.&quot; That is, they are not non-deterministic Turing Machines. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on @MarkS's comment, I gather that the something deeper involves constructive and destructive interference and the Chinese Remainder Theorem.&lt;/p&gt;&#xA;" OwnerUserId="9482" LastEditorUserId="2293" LastEditDate="2021-05-28T18:05:39.040" LastActivityDate="2021-05-28T18:05:39.040" Title="Quantum computers don't try all the possible solutions, so how does the QFT really work?" Tags="&lt;quantum-gate&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11518" PostTypeId="1" CreationDate="2020-04-12T18:04:42.800" Score="0" ViewCount="42" Body="&lt;p&gt;Show that the set of density operators is invariant under&#xA;the induced action of &lt;span class=&quot;math-container&quot;&gt;$U(H)$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$End(H)$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume I need to show that the set of density operators consists of the same elements even after applying &lt;span class=&quot;math-container&quot;&gt;$U(H)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$End(H)$&lt;/span&gt;, or am I misunderstanding the question entirely?  &lt;/p&gt;&#xA;" OwnerUserId="10215" LastActivityDate="2020-04-12T18:53:27.763" Title="Is the set of density operators invariant under the induced action of the unitary group?" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11519" PostTypeId="2" ParentId="11518" CreationDate="2020-04-12T18:53:27.763" Score="1" Body="&lt;p&gt;I'm not sure what &lt;span class=&quot;math-container&quot;&gt;$End(H)$&lt;/span&gt; is but here is a proof that unitaries take density operators to density operators. Let &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; be a positive semidefinite matrix with unit trace. We have to show that for a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U^\dagger XU$&lt;/span&gt; is also positive semidefinite with unit trace. Using the cyclicity of trace and &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger = I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(U^\dagger X U) = Tr(XUU^\dagger) = Tr(XI) = Tr(X) = 1$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for positive semidefiniteness, this means that for any &lt;span class=&quot;math-container&quot;&gt;$\vert \psi\rangle$&lt;/span&gt;, you have &lt;span class=&quot;math-container&quot;&gt;$\langle \psi\vert X\vert\psi\rangle \geq 0$&lt;/span&gt;. Now we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi\vert U^\dagger XU\vert\psi\rangle = \langle \phi\vert X\vert\phi\rangle  \geq 0,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I have set &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle = U\vert\psi\rangle$&lt;/span&gt; and the inequality holds since &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is positive semidefinite.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-04-12T18:53:27.763" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11520" PostTypeId="1" AcceptedAnswerId="11531" CreationDate="2020-04-12T19:45:56.527" Score="2" ViewCount="90" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One thing I was able to get to the bottom of is &quot;So far, genuine multipartite entangled (GME) states in the form of Greenberger-HorneZeilinger (GHZ) states..&quot;, but I do not know what about the GHZ states makes them &quot;genuinely entangled&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also the way it comes up is &quot;genuine multipartite entanglement&quot;, which begs the questions (after what is genuine entanglement) why does it only come up in multipartite schemes (&lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;2$&lt;/span&gt;)?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/543411/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8275" LastEditorUserId="55" LastEditDate="2020-04-13T14:42:42.693" LastActivityDate="2020-04-13T18:34:03.217" Title="What is the definition of genuine entanglement?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11521" PostTypeId="2" ParentId="11501" CreationDate="2020-04-12T19:47:55.527" Score="5" Body="&lt;p&gt;These levels are provided via &quot;preset passmanagers&quot; 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:&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/transpiler/preset_passmanagers&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/transpiler/preset_passmanagers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-04-12T19:47:55.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11522" PostTypeId="1" CreationDate="2020-04-12T21:25:11.870" Score="0" ViewCount="117" Body="&lt;p&gt;I am interested in using the QASM2Cirq methods to make this gate: u2(0, np.pi, q[0]). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I build that object using Cirq rather than QASM string value passed onto cirq. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-04-12T22:22:53.860" Title="Implementing U2-Gates on Cirq" Tags="&lt;cirq&gt;&lt;universal-gates&gt;&lt;qasm&gt;&lt;qasm2circ&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11523" PostTypeId="2" ParentId="11522" CreationDate="2020-04-12T22:22:53.860" Score="3" Body="&lt;p&gt;From the &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;spec&lt;/a&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_2(\phi, \lambda) = U ( \frac{\pi}{2}, \phi, \lambda)$&lt;/span&gt;. We can use Cirq's &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/11b1433ea15676efd32e1e291dd5dd0618aee799/cirq/circuits/qasm_output.py#L30&quot; rel=&quot;nofollow noreferrer&quot;&gt;QasmUGate&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;from cirq.circuits.qasm_output import QasmUGate&#xA;&#xA;q0 = cirq.NamedQubit('q[0]')&#xA;u2_gate = QasmUGate(0.5, 0, 1) # The angles are normalized to the range [0, 2) half_turns&#xA;circuit = cirq.Circuit(u2_gate(q0))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-04-12T22:22:53.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11524" PostTypeId="2" ParentId="11514" CreationDate="2020-04-13T07:22:19.487" Score="2" Body="&lt;p&gt;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 &lt;code&gt;ibmq_essex&lt;/code&gt; with 8192 shots and here is what I obtained:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EU0Eh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EU0Eh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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  &lt;code&gt;q[4]&lt;/code&gt; qubit, so I guess this has its effect. If &lt;code&gt;q[4]&lt;/code&gt; 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 &lt;code&gt;q[4]&lt;/code&gt; is not linked with some &lt;code&gt;q[n]&lt;/code&gt; qubit the quantum compiler will introduce SWAP gates to be able to apply CNOT between &lt;code&gt;q[4]&lt;/code&gt; and &lt;code&gt;q[n]&lt;/code&gt;. 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 &lt;a href=&quot;https://www.youtube.com/watch?v=l06HATJAbdI&amp;amp;list=PLmRxgFnCIhaMgvot-Xuym_hn69lmzIokg&amp;amp;index=17&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt;). Here is the connectivity of &lt;code&gt;ibmq_essex&lt;/code&gt; taken from this &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;site&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dSVfb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dSVfb.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If our &lt;code&gt;q[4]&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the final circuit after &lt;code&gt;optimization_level=3&lt;/code&gt; (Note how many CNOTs are there):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bt3YO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bt3YO.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here, if I am not mistaken, we can deduce that &lt;code&gt;q[4]&lt;/code&gt; is the 3rd qubit from &lt;code&gt;ibmq_essex&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the code that I have used:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.visualization import *&#xA;%config InlineBackend.figure_format = 'svg' &#xA;provider = IBMQ.load_account()&#xA;qpu_backend = provider.get_backend('ibmq_essex')&#xA;&#xA;quantum_register = QuantumRegister(4, 'q')&#xA;ancillary_qubit = QuantumRegister(1, 'a')&#xA;classical_register = ClassicalRegister(5, 'c')&#xA;circuit = QuantumCircuit(quantum_register, ancillary_qubit, classical_register)&#xA;&#xA;circuit.h(quantum_register)&#xA;circuit.u1(-0.0707, quantum_register[0])&#xA;circuit.u1(-0.134, quantum_register[1])&#xA;circuit.u1(-0.236, quantum_register[2])&#xA;circuit.u1(-0.314, quantum_register[3])&#xA;&#xA;circuit.x(ancillary_qubit[0])&#xA;circuit.cx(ancillary_qubit[0], quantum_register[0])&#xA;circuit.cx(ancillary_qubit[0], quantum_register[1])&#xA;circuit.cx(ancillary_qubit[0], quantum_register[2])&#xA;circuit.cx(ancillary_qubit[0], quantum_register[3])&#xA;&#xA;circuit.u1(0.385, quantum_register[0])&#xA;circuit.u1(0.605, quantum_register[1])&#xA;circuit.u1(1.02, quantum_register[2])&#xA;circuit.u1(1.884, quantum_register[3])&#xA;circuit.h(quantum_register)&#xA;&#xA;circuit.measure(quantum_register[0], classical_register[0])&#xA;circuit.measure(quantum_register[1], classical_register[1])&#xA;circuit.measure(quantum_register[2], classical_register[2])&#xA;circuit.measure(quantum_register[3], classical_register[3])&#xA;circuit.measure(ancillary_qubit[0], classical_register[4])&#xA;&#xA;qpu_result = execute(circuit, backend=qpu_backend, shots=8192, optimization_level=3).result().get_counts()&#xA;&#xA;plot_histogram(qpu_result, legend=[qpu_backend],figsize=(10,5))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-13T10:15:55.690" LastActivityDate="2020-04-13T10:15:55.690" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11525" PostTypeId="1" AcceptedAnswerId="12003" CreationDate="2020-04-13T08:20:50.337" Score="3" ViewCount="160" Body="&lt;p&gt;Consider the two-qubit Werner state, defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_z = z |\Psi_-\rangle\!\langle \Psi_-| + \frac{1-z}{4}I,&#xA;\quad |\Psi_-\rangle\equiv\frac{1}{\sqrt2}(|00\rangle-|11\rangle),$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$z\ge0$&lt;/span&gt;.&#xA;Using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;PPT criterion&lt;/a&gt;, one can see that this state is separable &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$0\le z\le 1/3$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I couldn't, however, find a source discussing explicit separable decompositions (in the &lt;span class=&quot;math-container&quot;&gt;$z\le1/3$&lt;/span&gt; regime, of course).&#xA;Is there a &quot;nice&quot; way to find such decompositions?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-04-13T08:42:45.213" LastActivityDate="2020-05-13T13:22:43.353" Title="What is a separable decomposition for the Werner state?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11526" PostTypeId="1" AcceptedAnswerId="11559" CreationDate="2020-04-13T10:36:24.297" Score="2" ViewCount="90" Body="&lt;p&gt;I am working with Aqua sample (&lt;code&gt;qiskit-aqua/test/finance/test_readme_sample.py&lt;/code&gt; ) that uses the &lt;code&gt;FixedIncomeExpectedValue&lt;/code&gt; and the &lt;code&gt;AmplitudeEstimation&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is &lt;code&gt;qiskit 0.18&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This sample was previously working with qiskit 0.16.2 when &lt;code&gt;Statevector_simulator&lt;/code&gt; was used for &lt;code&gt;AmplitudeEstimation&lt;/code&gt;. Though I used to run  into an error ERROR_RUNNING_JOB when running on &lt;code&gt;ibmq_&lt;/code&gt; hardware. I was told to upgrade to &lt;code&gt;qiskit 0.18&lt;/code&gt; to fix that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the update it now fails in &lt;code&gt;_check_conflicting_argument&lt;/code&gt; with  the message &quot;&lt;code&gt;The parameters pass_manager conflicts with the following parameter(s): backend.&lt;/code&gt;&quot; as shown below is a stack trace&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    :&#xA;qc = compiler.transpile(circuit, BasicAer.get_backend('qasm_simulator'), pass_manager=p_m)&#xA;&#xA;File &quot;C:\Users\-----\Anaconda3\envs\qiskite\lib\site-packages\qiskit\compiler\transpile.py&quot;, line 188, in transpile&#xA;        routing_method=routing_method, backend=backend)&#xA;&#xA;File &quot;C:\Users\------\Anaconda3\envs\qiskite\lib\site-packages\qiskit\compiler\transpile.py&quot;, line 225, in _check_conflicting_argument&#xA;        &quot;parameter(s): {}.&quot;.format(', '.join(conflicting_args)))&#xA;&#xA;TranspilerError: 'The parameters pass_manager conflicts with the following parameter(s): backend.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Further walk through the stack trace shows the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;bckend = set_backend('STATEVEC')&#xA;&#xA;ampest = AmplitudeEstimation(m, fixed_income)&#xA;result = ampest.run(quantum_instance=bckend)&#xA;..quantum_algorithm.run()&#xA;....ae.run&#xA;......if _quantum_instance.is_statevector:&#xA;........construct_circuit(measurement = False)&#xA;..........pec = PhaseEstimationCircuit(...)&#xA;..........pec.construct_circuit(measurement = False)&#xA;............._state_n_circuit_factory(qc,q,aux)&#xA;................uncertainty_model.build(...) #fixed_income_....py&#xA;..................cs = Custom(...) #multivariate_distribution.py&#xA;..................extend(cs.construct_circuit('circuit',q))   &#xA;.....................cs.construct_circuit('circuit')&#xA;........................svc = StateVectorCircuit(_state_vector)&#xA;........................sv.construct_circuit(...)&#xA;..........................convert_to_basis_gates()&#xA;............................Unroller(...)&#xA;............................PassManager(...)&#xA;............................compiler.transpile(circuit, BasicAer.get_backend('qasm_simulator)...)&#xA;.............................. transpile (....)&#xA;................................._check_conflicting_argument(...backend=backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It is in this &lt;code&gt;_check_conflicting_argument&lt;/code&gt; that the error message is raised &lt;code&gt;&quot;The parameters pass_manager conflicts with the following parameter(s): backend.&quot;&lt;/code&gt; and the script stops execution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know what am I missing something here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="5175" LastEditorUserId="5175" LastEditDate="2020-04-14T21:59:15.923" LastActivityDate="2020-04-15T10:36:09.867" Title="Error using FixedIncomeExpectedValue sample" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11527" PostTypeId="2" ParentId="11525" CreationDate="2020-04-13T10:57:09.993" Score="0" Body="&lt;p&gt;Separable decompositions for high-dimensional Werner states are discussed in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0703240&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unanyan et al. (2007)&lt;/a&gt;. They find decompositions in terms of infinite terms, but from their Eqs. (10) and (11) it seems that these are reducible to finite decompositions (&lt;a href=&quot;https://physics.stackexchange.com/a/401770/58382&quot;&gt;which we know must always exist for finite-dimensional states&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same paper, they also mention that decompositions for the two-qubit case are given in &lt;a href=&quot;https://doi.org/10.1103/PhysRevLett.80.2245&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wootters (1998)&lt;/a&gt; and &lt;a href=&quot;http://dx.doi.org/10.1103/PhysRevA.73.032315&quot; rel=&quot;nofollow noreferrer&quot;&gt;Azuma and Ban (2006)&lt;/a&gt;.&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_q = \sum_{i=1}^4 |z_i\rangle\!\langle z_i|,&#xA;\,\,\text{ where }\,\,&#xA;|z_i\rangle =  \sum_{k=1}^4 (H^{\otimes 2})_{ik}e^{i\theta_k}|x_k\rangle.$$&lt;/span&gt;&#xA;The (unnormalised) states &lt;span class=&quot;math-container&quot;&gt;$|x_k\rangle$&lt;/span&gt; are defined as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{gathered}|x_1\rangle = -i\sqrt{\lambda_+}|\Psi^-\rangle, \\ |x_2\rangle = \sqrt{\lambda_-}|\Psi^+\rangle, \qquad&#xA;|x_3\rangle = \sqrt{\lambda_-}|\Phi^-\rangle, \\&#xA;|x_4\rangle = -i\sqrt{\lambda_-}|\Phi^+\rangle, \end{gathered}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_\pm$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho_q$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\lambda_+=(1+3q)/4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_-=(1-q)/4$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the Hadamard matrix, and &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt; are phases satisfying&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-2i\theta_1} \lambda_+ + (e^{-2i\theta_2}+e^{-2i\theta_3}+e^{-2i\theta_4})\lambda_-=0$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This decomposition follows the method outlined in &lt;a href=&quot;https://doi.org/10.1103/PhysRevLett.80.2245&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wootters 1998&lt;/a&gt; (mostly the second page of the PRL version), but I can't say I fully understand it.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-04-13T12:10:29.837" LastActivityDate="2020-04-13T12:10:29.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11528" PostTypeId="1" CreationDate="2020-04-13T11:28:04.190" Score="2" ViewCount="54" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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? &#xA;Assume that they both have similar structure, for example they are both 2 local on a square lattice acting on n particles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there a sufficient condition for two Hamiltonians to have the same groundstate?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11670" LastEditorUserId="9006" LastEditDate="2020-04-13T12:29:10.177" LastActivityDate="2020-04-14T13:14:02.413" Title="Two commuting Hamiltonians" Tags="&lt;complexity-theory&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11530" PostTypeId="1" CreationDate="2020-04-13T13:54:43.853" Score="2" ViewCount="70" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a prerequisite I would ask that the 'application' have a &lt;strong&gt;real-world use case&lt;/strong&gt; and &lt;strong&gt;associated industry&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thanks in advance for your help!&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt; I have reviewed the following StackExchange links prior to asking this:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8417/applications-of-quantum-computing-for-science-popularization&quot;&gt;Applications of quantum computing for science popularization&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4150/do-we-really-know-how-a-universal-quantum-computer-can-be-used-to-revolutionize&quot;&gt;Do we really know how a universal quantum computer can be used to revolutionize the design of new drugs or materials?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4169/are-there-any-examples-of-anyone-applying-quantum-algorithms-to-problems-in-comp&quot;&gt;Are there any examples of anyone applying quantum algorithms to problems in computational biology?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4107/example-of-hamiltonian-simulation-solving-interesting-problem&quot;&gt;Example of Hamiltonian Simulation solving interesting problem?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;...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).&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2151/introductory-material-for-quantum-machine-learning&quot;&gt;Introductory material for quantum machine learning&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11517" LastEditorUserId="11517" LastEditDate="2020-04-13T15:15:26.143" LastActivityDate="2020-04-13T15:15:26.143" Title="What Are The Most Promising Real-World Applications For Quantum Machine Learning" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;machine-learning&gt;&lt;applications&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11531" PostTypeId="2" ParentId="11520" CreationDate="2020-04-13T14:57:16.683" Score="2" Body="&lt;p&gt;Following &lt;a href=&quot;https://arxiv.org/abs/0811.2803&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gühne and Toth (2008)&lt;/a&gt; (pag. 18), a pure state is &lt;em&gt;genuinely multipartite entangled&lt;/em&gt; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is only one way to partition a bipartite space, thus the notion of &quot;genuine&quot; bipartite entanglement is equivalent to that of &quot;normal&quot; entanglement.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-04-13T18:34:03.217" LastActivityDate="2020-04-13T18:34:03.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11532" PostTypeId="1" CreationDate="2020-04-13T15:10:24.040" Score="1" ViewCount="44" Body="&lt;p&gt;I was reading &lt;a href=&quot;https://doi.org/10.1103/PhysRevA.100.032306&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, respectively. &lt;a href=&quot;https://i.stack.imgur.com/blsAw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/blsAw.png&quot; alt=&quot;circuit&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;but I'm very confused on how can that the set&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\{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}\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;be the universal set. I mean, where did the Y go?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this case &lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just want a clue about how to start here, thanks everyone.&lt;/p&gt;&#xA;" OwnerUserId="11674" LastActivityDate="2020-04-13T15:10:24.040" Title="How can I prove the universality of this set of gates?" Tags="&lt;gate-synthesis&gt;&lt;universal-gates&gt;&lt;continuous-variable&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11533" PostTypeId="1" AcceptedAnswerId="11566" CreationDate="2020-04-13T15:13:27.563" Score="2" ViewCount="273" Body="&lt;p&gt;&lt;strong&gt;Where does The &lt;a href=&quot;https://www.tensorflow.org/quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tensorflow Quantum ( &lt;code&gt;TFQ&lt;/code&gt; )&lt;/a&gt; library fall on it's maturity curve.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words can we currently leverage the &lt;strong&gt;&lt;code&gt;TFQ&lt;/code&gt;&lt;/strong&gt; library to solve real-world problems? Will we need to wait for a &lt;strong&gt;&lt;code&gt;TFQ 2.0&lt;/code&gt;&lt;/strong&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does this library, and if not will it ever, have more than just theoretical usefulness?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will companies be utilizing &lt;strong&gt;&lt;code&gt;TFQ&lt;/code&gt;&lt;/strong&gt; to build systems that can help companies in the wild solve a problem faster/better than if they had utilized classical systems? &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/2003.02989.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Tensorflow Quantum White Paper - For Reference&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11517" LastActivityDate="2020-04-15T19:06:32.770" Title="How Mature is the Tensorflow Quantum Library" Tags="&lt;simulation&gt;&lt;machine-learning&gt;&lt;applications&gt;&lt;neural-network&gt;&lt;tensor-networks&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-04-18T14:29:26.017" ContentLicense="CC BY-SA 4.0" />
  <row Id="11534" PostTypeId="1" AcceptedAnswerId="11539" CreationDate="2020-04-13T15:24:30.453" Score="3" ViewCount="73" Body="&lt;p&gt;Consider a four-qubit circuit with the following structure:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/853WX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/853WX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the boxes can be arbitrary two-qubit unitary operations, and the time- evolution proceeds from left to right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That not every four-qubit unitary can be decomposed in such a way follows from a simple parameter-counting argument: &lt;span class=&quot;math-container&quot;&gt;$(2^4)^2\gg 3(2^2)^2$&lt;/span&gt;.&#xA;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: &lt;span class=&quot;math-container&quot;&gt;$2(2^4)&amp;lt; 3(2^2)^2$&lt;/span&gt;.&#xA;Is it always possible?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words, given a fixed input &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; and a target &lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle$&lt;/span&gt;, can we always find two-qubit unitaries &lt;span class=&quot;math-container&quot;&gt;$U_{12},U_{23},U_{34}$&lt;/span&gt; (acting nontrivially only on the respective subspaces) such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle = (U_{12}\otimes U_{34})U_{23} |\psi_0\rangle$&lt;/span&gt;&#xA;?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-04-13T18:22:12.773" Title="Can arbitrary four-qubit states be generated via circuits of the form $(U_{12}\otimes U_{34})U_{23}$?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11535" PostTypeId="1" AcceptedAnswerId="11558" CreationDate="2020-04-13T15:30:02.260" Score="4" ViewCount="114" Body="&lt;p&gt;I have seen two different definition of Fidelity in different sources. For example, Nielsen &amp;amp; Chuang &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;QCQI, 10th edition, page 409&lt;/a&gt; defines Fidelity like the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(\rho, \sigma) := \operatorname{tr} \sqrt{\rho^{\frac{1}{2}} \sigma \rho^{\frac{1}{2}}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An implementation of this definition is also present in this &lt;a href=&quot;http://www.qetlab.com/Fidelity&quot; rel=&quot;nofollow noreferrer&quot;&gt;QETLAB library&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another definition that I have found is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(\rho, \sigma) := \Big(\operatorname{tr} \sqrt{\rho^{\frac{1}{2}} \sigma \rho^{\frac{1}{2}}}\Big)^2&#xA;$$&lt;/span&gt;&#xA;This def is present in the highly regarded &lt;a href=&quot;http://www.theory.caltech.edu/~preskill/ph219/chap2_15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill notes&lt;/a&gt; and most other places like &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt;, &lt;a href=&quot;https://www.quantiki.org/wiki/fidelity&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantiki&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was this definition changed sometime? TIA.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="2403" LastEditDate="2020-04-15T16:24:32.007" LastActivityDate="2020-04-15T16:24:32.007" Title="Is the quantum state fidelity defined as $F(\rho, \sigma)=\text{tr}\sqrt{\rho^{1/2}\sigma\rho^{1/2}}$ or its square?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;&lt;fidelity&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11538" PostTypeId="1" CreationDate="2020-04-13T18:09:12.333" Score="2" ViewCount="36" Body="&lt;p&gt;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) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ross&lt;/p&gt;&#xA;" OwnerUserId="11671" LastActivityDate="2020-04-13T18:09:12.333" Title="Why does quantum computing only offer faster computational times for certain, specific types of problems?" Tags="&lt;speedup&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-04-14T09:53:14.767" ContentLicense="CC BY-SA 4.0" />
  <row Id="11539" PostTypeId="2" ParentId="11534" CreationDate="2020-04-13T18:22:12.773" Score="3" Body="&lt;p&gt;No, it's impossible. It's easier to go backwards. Let &lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle = \frac{1}{2}\big(|0000\rangle + |0101\rangle + |1010\rangle + |1111\rangle\big)$&lt;/span&gt;. The reduced density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_{12}$&lt;/span&gt; of it on qubits &lt;span class=&quot;math-container&quot;&gt;$[1,2]$&lt;/span&gt; will be maximally mixed state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}I$&lt;/span&gt; (same on qubits &lt;span class=&quot;math-container&quot;&gt;$[3,4]$&lt;/span&gt;). Unitaries &lt;span class=&quot;math-container&quot;&gt;$U_{12}^{-1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_{34}^{-1}$&lt;/span&gt; won't change those &lt;span class=&quot;math-container&quot;&gt;$\rho_{12}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{34}$&lt;/span&gt;, they will remain as &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}I$&lt;/span&gt; after the application. But reducing &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}I$&lt;/span&gt; to a qubit 1 will result in &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_{23}^{-1}$&lt;/span&gt;  can't change that. So, the reduced matrix of &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; on qubit 1 must be equal to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}I$&lt;/span&gt;, but it's not always the case, &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle=|0000\rangle$&lt;/span&gt; is a counterexample. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-04-13T18:22:12.773" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11540" PostTypeId="1" CreationDate="2020-04-13T18:51:54.910" Score="3" ViewCount="31" Body="&lt;p&gt;Can anyone please explain me in simple words how the hyperspherical coordinates can be used to parameterise multi-qubit states?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state of an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system can be thought of as a point on the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{CP}(2^n-1)$&lt;/span&gt;, which is not a sphere. Of course, for small dimensions we have some exceptional correspondences (&lt;a href=&quot;https://en.wikipedia.org/wiki/Hopf_fibration&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hopf fibration&lt;/a&gt;), but my question is regarding the case of a general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11515" LastActivityDate="2020-04-13T18:51:54.910" Title="Hyperspherical parametrization of a multi-qubit state" Tags="&lt;quantum-state&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11541" PostTypeId="1" AcceptedAnswerId="11548" CreationDate="2020-04-13T19:03:16.830" Score="2" ViewCount="92" Body="&lt;p&gt;Let's say I have the following state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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).&#xA;$$&lt;/span&gt;&#xA;I measure the &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt; subsystem and find it to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Then the post measurement state is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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}&#xA;$$&lt;/span&gt;&#xA;Now, I want to trace out subsystems &lt;span class=&quot;math-container&quot;&gt;$a_1b_1$&lt;/span&gt; and calculate the fidelity of the remaining system &lt;span class=&quot;math-container&quot;&gt;$a_2b_2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle = \frac{1}{\sqrt{2}} (|00\rangle + |11\rangle)$&lt;/span&gt;. This value is found to be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle \psi' |\Phi^+\rangle|^2 = .9&#xA;$$&lt;/span&gt;&#xA;Here is my question. If instead of tracing out subsystems &lt;span class=&quot;math-container&quot;&gt;$a_1b_1$&lt;/span&gt;, I trace out &lt;span class=&quot;math-container&quot;&gt;$a_2b_2$&lt;/span&gt; and calculate the remaining subsystem's fidelity with &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;, would I find &lt;span class=&quot;math-container&quot;&gt;$.9$&lt;/span&gt; again? &lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-04-14T12:40:31.560" Title="Fidelity With Bell State Calculation" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;fidelity&gt;&lt;bell-basis&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11542" PostTypeId="2" ParentId="11450" CreationDate="2020-04-13T20:01:09.610" Score="3" Body="&lt;p&gt;The answer to my question is given &lt;a href=&quot;https://i.stack.imgur.com/Gs6Td.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The solution from the provided paper is extremely efficient (for it requires &lt;span class=&quot;math-container&quot;&gt;$O(n^2 / \log n)$&lt;/span&gt; CNOTs instead of the naïve &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; estimate), and is somewhat nontrivial to implement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy-to-implement solution with &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; CNOTs can be, however, obtained in just a few lines. First of all, one has to perform the LU-decomposition of the desired matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. This can be done as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;P, L, U = scipy.linalg.lu(M)&#xA;L = np.mod(L, 2)&#xA;U = np.mod(U, 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Luckily, for an invertible matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, the resulting &lt;span class=&quot;math-container&quot;&gt;$P,L,U$&lt;/span&gt; matrices will contain binary entries. Here &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a permutation matrix, and &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are the lower- and upper-triangular matrices, whose product is the original matrix, &lt;span class=&quot;math-container&quot;&gt;$M = P \ L \ U$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Permutations &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; can be implemented using SWAPs. Multiplication by a triangular matrix is also quite straightforward, and is done using CNOTs &lt;strong&gt;starting from the most occupied row&lt;/strong&gt;. In other words, for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M&#xA;\begin{pmatrix}&#xA;q_0 \\ q_1 \\ q_2&#xA;\end{pmatrix}&#xA;=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;q_0 \\ q_1 \\ q_2&#xA;\end{pmatrix} \ ,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the circuit would look like&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gs6Td.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gs6Td.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly enough, the Bravyi-Kitaev encoder matrix is lower-triangular from the very beginning &lt;a href=&quot;https://arxiv.org/abs/1208.5986&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;, so in this particular case there is no need to perform the LU-decomposition.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-04-14T03:27:38.637" LastActivityDate="2020-04-14T03:27:38.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11544" PostTypeId="1" AcceptedAnswerId="11547" CreationDate="2020-04-13T22:18:23.327" Score="6" ViewCount="925" Body="&lt;p&gt;I'm studying VQE, but there is something I don't get.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$ |0 \rangle $&lt;/span&gt; and -1 associated with state &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;.&#xA;Clearly the minimum eigenvalue is -1 so the ground state should be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. But the ground sate for a qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I getting wrong?&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="55" LastEditDate="2020-04-14T13:30:00.440" LastActivityDate="2020-04-14T17:44:45.467" Title="How is the ground state of a Hamiltonian defined?" Tags="&lt;mathematics&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11545" PostTypeId="1" CreationDate="2020-04-14T00:45:32.587" Score="1" ViewCount="684" Body="&lt;p&gt;I installed &lt;code&gt;qiskit&lt;/code&gt; using directions at &lt;code&gt;https://qiskit.org/documentation/install.html&lt;/code&gt;&#xA;I also have &lt;code&gt;spyder&lt;/code&gt; installed -&lt;code&gt;Spyder 3.3.6 | Python 3.7.7 64-bit | Qt 5.9.6 | PyQt5 5.9.2 | Windows 10&lt;/code&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It works fine i.e. I am able to build from &lt;code&gt;spyder&lt;/code&gt; and connect to &lt;code&gt;ibm_q&lt;/code&gt; hardware ...&#xA;when I run &lt;code&gt;qiskit.__qiskit_version__&lt;/code&gt; it was&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'qiskit-terra': '0.12.0',&#xA; 'qiskit-aer': '0.4.1',&#xA; 'qiskit-ignis': '0.2.0',&#xA; 'qiskit-ibmq-provider': '0.5.0',&#xA; 'qiskit-aqua': '0.6.5',&#xA; 'qiskit': '0.16.2'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Then I had to update &lt;code&gt;qiskit to 0.18&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;so I went to Conda prompt and did &lt;code&gt;pip install qiskit&lt;/code&gt;&#xA;the installation went through successfully - if I do &lt;code&gt;conda list&lt;/code&gt; I see the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;:&#xA;qiskit                    0.18.0                   pypi_0    pypi&#xA;qiskit-aer                0.5.0                    pypi_0    pypi&#xA;qiskit-aqua               0.6.5                    pypi_0    pypi&#xA;qiskit-ibmq-provider      0.6.0                    pypi_0    pypi&#xA;qiskit-ignis              0.3.0                    pypi_0    pypi&#xA;qiskit-terra              0.13.0                   pypi_0    pypi&#xA;:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I then did a reset of &lt;code&gt;spyder&lt;/code&gt; - inspite of that from the &lt;code&gt;IPython console&lt;/code&gt; I still see the older version - &lt;code&gt;'qiskit': '0.16.2'&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I ran &lt;code&gt;print( qiskit.__qiskit_version__)&lt;/code&gt; in my script that runs inside Spyder I still see '&lt;code&gt;qiskit': '0.16.2'&lt;/code&gt; - please help what else needs to be done. What am I missing here? Thank you&lt;/p&gt;&#xA;" OwnerUserId="5175" LastEditorUserId="55" LastEditDate="2020-09-26T22:17:43.000" LastActivityDate="2021-05-07T23:03:40.367" Title="Updating qiskit doesn't update qiskit version from Spyder" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11546" PostTypeId="2" ParentId="11545" CreationDate="2020-04-14T01:16:49.617" Score="0" Body="&lt;p&gt;Previously I had run the &lt;code&gt;pip install qiskit --upgrade&lt;/code&gt; in the &lt;strong&gt;&lt;em&gt;wrong conda environment&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So here is how I fixed it &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;conda activate &amp;lt;to_the_environment_that_Spyder_uses&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;then run &lt;code&gt;pip install qiskit --upgrade&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After successful update completion - verify using &lt;code&gt;conda list&lt;/code&gt;&#xA;here is what i see now&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;:&#xA;qiskit                    0.18.0                   pypi_0    pypi&#xA;qiskit-aer                0.5.0                    pypi_0    pypi&#xA;qiskit-aqua               0.6.5                    pypi_0    pypi&#xA;qiskit-ibmq-provider      0.6.0                    pypi_0    pypi&#xA;qiskit-ignis              0.3.0                    pypi_0    pypi&#xA;qiskit-terra              0.13.0                   pypi_0    pypi&#xA;:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;From inside the spyder script - for  &lt;code&gt;print( qiskit.__qiskit_version__)&lt;/code&gt;&#xA;I see&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'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'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from the IPython console, I get &lt;code&gt;...'qiskit': '0.18.0'}&lt;/code&gt; too&lt;/p&gt;&#xA;" OwnerUserId="5175" LastActivityDate="2020-04-14T01:16:49.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11547" PostTypeId="2" ParentId="11544" CreationDate="2020-04-14T01:40:20.350" Score="8" Body="&lt;p&gt;A couple of points:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The ground state is &lt;em&gt;by definition&lt;/em&gt; the eigenvector associated with the minimum valued eigenvalue.&lt;/li&gt;&#xA;&lt;li&gt;Lets consider the Pauli Z matrix as you have. First,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;Z = \begin{pmatrix}1 &amp;amp; 0\\ 0 &amp;amp; -1 \end{pmatrix}.&#xA;\end{align*}&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; respectively. Thus, since the eigenvector with the lowest associated eigenvalue is the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state is the ground state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Your confusion may have simply been with the definition of the ground state -- it is not always the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, although for some matrices (such as the identity matrix), it can be.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A potentially elucidating example may be found in considering the Hadmard matrix,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;    H = \frac{1}{\sqrt{2}}&#xA;    \begin{pmatrix}&#xA;        1 &amp;amp; 1\\&#xA;        1 &amp;amp; -1&#xA;    \end{pmatrix}.&#xA;\end{align*}&lt;/span&gt;&#xA;The eigenvalues of this matrix are &lt;span class=&quot;math-container&quot;&gt;$1, -1$&lt;/span&gt; with the associated eigenvectors &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;. Thus, we know that the ground state of the Hadamard matrix is the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle \equiv \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: 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. &lt;/p&gt;&#xA;" OwnerUserId="5157" LastEditorUserId="5157" LastEditDate="2020-04-14T17:44:45.467" LastActivityDate="2020-04-14T17:44:45.467" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11548" PostTypeId="2" ParentId="11541" CreationDate="2020-04-14T12:40:31.560" Score="3" Body="&lt;p&gt;No, you wouldn't find &lt;span class=&quot;math-container&quot;&gt;$0.9$&lt;/span&gt; again. To make the partial trace calculation simpler you can note that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; is separable under the bipartition &lt;span class=&quot;math-container&quot;&gt;$a_1b_1 | a_2 b_2$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = |00\rangle \otimes (\sqrt{a} |00\rangle + \sqrt{1-a} |11\rangle)$&lt;/span&gt;. So irrespective of the value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_{a_2b_2}[|\psi'\rangle\langle \psi'|] = |00\rangle\langle 00|$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The fidelity calculation should then be relatively straightforward.  &lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-04-14T12:40:31.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11549" PostTypeId="1" AcceptedAnswerId="11564" CreationDate="2020-04-14T12:54:50.970" Score="2" ViewCount="198" Body="&lt;p&gt;On the English Wikipedia, &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; Ising gates are defined in matrix form as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ XX(\phi) = \begin{bmatrix}\cos(\phi)&amp;amp;0&amp;amp;0&amp;amp; -i \sin(\phi)\\&#xA;0&amp;amp;\cos(\phi)&amp;amp;-i \sin(\phi) &amp;amp; 0 \\&#xA;0 &amp;amp; -i \sin(\phi) &amp;amp; \cos(\phi) &amp;amp; 0 \\&#xA;-i \sin(\phi) &amp;amp; 0 &amp;amp; 0 &amp;amp; \cos(\phi) \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, on the French Wikipedia, the &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; Ising gates are defined as :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ XX(\phi) = \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp;0&amp;amp;0&amp;amp; -i e^{i \phi}\\&#xA;0&amp;amp;1&amp;amp;-i  &amp;amp; 0 \\&#xA;0 &amp;amp; -i  &amp;amp; 1 &amp;amp; 0 \\&#xA;-i e^{i \phi} &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From some &lt;a href=&quot;http://iontrap.umd.edu/wp-content/uploads/2012/12/nature18648.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;sources&lt;/a&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-04-16T09:24:35.383" LastActivityDate="2020-04-16T09:24:35.383" Title="Matrix definition of the Ising XX gate" Tags="&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11550" PostTypeId="2" ParentId="11528" CreationDate="2020-04-14T13:14:02.413" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; commute, then -- as you pointed out -- there exists a common eigenbasis in which they are both diagonal:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_1 = \operatorname{diag}(\lambda_1, \lambda_2, \dots, \lambda_n) \qquad&#xA;H_2 = \operatorname{diag}(\mu_1, \mu_2, \dots, \mu_n)&#xA;$$&lt;/span&gt;&#xA;Note that the eigenvalues will not be ordered and that I start enumerating basis states with &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The groundstate of &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;) in this basis is the basis vector &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{e}_j = |{j}\rangle$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\lambda_j$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mu_j$&lt;/span&gt;) is the minimal eigenvalue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From this, we can already construct a very simple counterexample to your first question, just consider the two Hamiltonians&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_1 = \begin{bmatrix} -1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix}\qquad&#xA;H_2 = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;The first has ground state &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{e}_1 = |1\rangle$&lt;/span&gt; whereas the second has groundstate &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{e}_2 = |2\rangle$&lt;/span&gt;. The only benefit you get from knowing that the Hamiltonians commute is that you &lt;em&gt;know&lt;/em&gt; that one of the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; will also be an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;. In the non-degenerate case, this means that you could just try all eigenstates of &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; and you find the groundstate, but nothing more than that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This highlights that you can't make non-trivial statements about the groundstate of &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; when knowing the groundstate of &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; in general. I personally don't know if this changes if the Hamiltonians in question have more structure like 2-locality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not able to point you to a reference for your second question. Phrasing it in the language of matrices, the question becomes &quot;Do &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; have the same eigenvector for their minimal eigenvalue?&quot;. It seems obvious to me that there is no further sufficient condition for this.&lt;/p&gt;&#xA;" OwnerUserId="10250" LastActivityDate="2020-04-14T13:14:02.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11553" PostTypeId="2" ParentId="11506" CreationDate="2020-04-14T14:26:20.570" Score="1" Body="&lt;p&gt;Unfortunately &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; is not a continuous function and so functions built from it tend not to be continuous. For example consider consider the two states &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB} = |00 \rangle \langle 00|,&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tau_{AB}(\epsilon) = (1-\epsilon) |00 \rangle \langle 00 | + \epsilon | 11\rangle \langle 11 |.&#xA;$$&lt;/span&gt;&#xA;A quick calculation gives &lt;span class=&quot;math-container&quot;&gt;$I_{\max}(\rho_{AB}) = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I_{\max}(\tau_{AB}(\epsilon)) = - \log(\epsilon)$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$I_{\max}(\rho_{AB}) \neq \lim_{\epsilon \rightarrow 0} I_{\max}(\tau_{AB}(\epsilon)) = \infty$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, some authors have studied a smoothed version of &lt;span class=&quot;math-container&quot;&gt;$I_{\max}$&lt;/span&gt; (see &lt;a href=&quot;https://arxiv.org/pdf/1308.5884.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1308.5884.pdf&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-04-14T14:26:20.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11554" PostTypeId="1" AcceptedAnswerId="16347" CreationDate="2020-04-14T14:42:53.493" Score="3" ViewCount="296" Body="&lt;p&gt;What is the simplest quantum circuit which takes states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; as its input, and outputs the superposition &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|a\rangle+|b\rangle\right)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/543883/quantum-circuit-calculating-sum-of-two-quantum-states-a-rangle-b-rangle&quot;&gt;Cross-posted on Physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="5600" LastEditorUserId="55" LastEditDate="2021-03-04T12:21:15.553" LastActivityDate="2021-03-04T13:11:19.163" Title="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)$?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11555" PostTypeId="1" AcceptedAnswerId="11561" CreationDate="2020-04-14T18:00:12.363" Score="2" ViewCount="67" Body="&lt;p&gt;I apologize for a simple question, should be quite trivial. How do I construct a circuit for preparing such a state?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle^n \mapsto \cos(\theta)|0...0\underset{i}{1}0...0\rangle + \sin(\theta) |0...0\underset{j}{1}0...0\rangle \ ,&#xA;$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;th qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2020-04-14T21:48:07.703" Title="Preparing a linear combination of two $1$-occupied states" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11558" PostTypeId="2" ParentId="11535" CreationDate="2020-04-14T20:39:30.823" Score="4" Body="&lt;p&gt;Both definitions are used and authors usually make it clear which one they mean. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wikipedia also points this out under the &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states#Alternative_definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Alternative Defintion&lt;/a&gt; section.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-04-14T20:39:30.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11559" PostTypeId="2" ParentId="11526" CreationDate="2020-04-14T20:48:06.153" Score="1" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;git clone https://github.com/Qiskit/qiskit-aqua&#xA;cd qiskit-aqua&#xA;pip install .&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;more detailed instructions are given on &lt;a href=&quot;https://qiskit.org/documentation/contributing_to_qiskit.html#installing-aqua-from-source&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit's webpage&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/commit/ecf62693ea82ae360beb2d017fdffe220f740f14&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this commit&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="5955" LastEditDate="2020-04-15T10:36:09.867" LastActivityDate="2020-04-15T10:36:09.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11561" PostTypeId="2" ParentId="11555" CreationDate="2020-04-14T21:48:07.703" Score="3" Body="&lt;p&gt;Here is an example of such circuit for five qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9MbjM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9MbjM.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A gate &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; acting on qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; prepares superposition&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (with probability &lt;span class=&quot;math-container&quot;&gt;$\cos^2(\theta/2)$&lt;/span&gt;), qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; thanks to gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (with probability &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta/2)$&lt;/span&gt;), qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; thanks to gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and CNOT gate (two negation is equal to no negation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Other qubits are not changed and remain in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. As a result, the circuit produce state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(\theta/2)|00010\rangle + \sin(\theta/2)|01000\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can construct similar circuit for any positions &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; simply by putting &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gate with proper parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; on one qubit, gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on second qubit and then &quot;connect&quot; them with CNOT gate. &lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-14T21:48:07.703" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11562" PostTypeId="1" AcceptedAnswerId="11563" CreationDate="2020-04-15T04:19:36.667" Score="1" ViewCount="27" Body="&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply a global phase -1 to all qubits &lt;code&gt;x : Qubit[]&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My solution&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;ApplyToEach(R, PauliI, 2.0 * PI(), x)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However this yields a syntax error.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applytoeach&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyToEach doc&lt;/a&gt;, it works if the operation has no parameters:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (register = Qubit[3]) {&#xA;    ApplyToEach(H, register);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you for your expertise. Happy qubitting!&lt;/p&gt;&#xA;" OwnerUserId="7951" LastActivityDate="2020-04-15T05:51:23.737" Title="How to use ApplyToEach when operation has parameters?" Tags="&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11563" PostTypeId="2" ParentId="11562" CreationDate="2020-04-15T05:51:23.737" Score="1" Body="&lt;p&gt;You need to use &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/language/expressions#partial-application&quot; rel=&quot;nofollow noreferrer&quot;&gt;partial application&lt;/a&gt; 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 &lt;code&gt;ApplyToEach&lt;/code&gt; will be able to apply it to each element of the array:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (register = Qubit[3]) {&#xA;    let globalPhaseGate = R(PauliI, 2.0 * PI(), _);&#xA;    ApplyToEach(globalPhaseGate, qs);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can also write this shorter, without using an extra constant to name the gate that is the result of partial application:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (register = Qubit[3]) {&#xA;    ApplyToEach(R(PauliI, 2.0 * PI(), _), register);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-04-15T05:51:23.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11564" PostTypeId="2" ParentId="11549" CreationDate="2020-04-15T07:04:10.783" Score="9" Body="&lt;p&gt;Your first option is the correct one, being related to &lt;span class=&quot;math-container&quot;&gt;$e^{-i\phi X\otimes X}$&lt;/span&gt;, which is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ XX(\phi) = \begin{bmatrix}\cos(\phi)&amp;amp;0&amp;amp;0&amp;amp; -i \sin(\phi)\\&#xA;0&amp;amp;\cos(\phi)&amp;amp;-i \sin(\phi) &amp;amp; 0 \\&#xA;0 &amp;amp; -i \sin(\phi) &amp;amp; \cos(\phi) &amp;amp; 0 \\&#xA;-i \sin(\phi) &amp;amp; 0 &amp;amp; 0 &amp;amp; \cos(\phi) \\&#xA;\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-04-16T08:48:09.813" LastActivityDate="2020-04-16T08:48:09.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11566" PostTypeId="2" ParentId="11533" CreationDate="2020-04-15T19:06:32.770" Score="13" Body="&lt;p&gt;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 &quot;production&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;quantum sensor&quot; problems, and are considered by many to be the first place practical quantum machine learning will be used.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is &lt;a href=&quot;https://www.tensorflow.org/quantum&quot; rel=&quot;noreferrer&quot;&gt;TensorFlow Quantum&lt;/a&gt;? 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 &lt;a href=&quot;https://github.com/quantumlib/cirq&quot; rel=&quot;noreferrer&quot;&gt;Cirq&lt;/a&gt;.  It is also backed by a highly efficient classical simulator of quantum programs, &lt;a href=&quot;https://github.com/quantumlib/qsim&quot; rel=&quot;noreferrer&quot;&gt;qsim&lt;/a&gt;.  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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/XanaduAI/pennylane&quot; rel=&quot;noreferrer&quot;&gt;PennyLane&lt;/a&gt; and Microsoft's Quantum Machine Learning &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/libraries/machine-learning/&quot; rel=&quot;noreferrer&quot;&gt;library&lt;/a&gt; in Q#. IBM also has &lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/tree/master/machine_learning&quot; rel=&quot;noreferrer&quot;&gt;nice tutorials&lt;/a&gt; on using their quantum programming framework for quantum machine learning. &lt;/p&gt;&#xA;" OwnerUserId="189" LastActivityDate="2020-04-15T19:06:32.770" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11567" PostTypeId="1" CreationDate="2020-04-16T02:08:42.013" Score="1" ViewCount="58" Body="&lt;p&gt;I am given the following&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\on}[1]{{\operatorname{#1}}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1 \leq i \leq \on{dim}\,\mathcal{H_A}, |s\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1 \leq s \leq \on{dim}\,\mathcal{H_B}$&lt;/span&gt; be unitary bases. Write &lt;span class=&quot;math-container&quot;&gt;$\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|$&lt;/span&gt; so &lt;span class=&quot;math-container&quot;&gt;$CJ(\Lambda)$&lt;/span&gt; Hermitian implies &lt;span class=&quot;math-container&quot;&gt;$\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}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I know the following &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;blockquote&gt;&#xA;    &lt;ol&gt;&#xA;    &lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is a quantum channel such that &lt;span class=&quot;math-container&quot;&gt;$$\Lambda : \on{End}(\mathcal{H_A}) \xrightarrow{} \on{End}(\mathcal{H_B})$$&lt;/span&gt;&#xA;    Where &lt;span class=&quot;math-container&quot;&gt;$\on{End}(\mathcal{H_A})$&lt;/span&gt; refers to the endomorphism over Hilbert space A&#xA;    &lt;span class=&quot;math-container&quot;&gt;$$$$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;    &lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CJ$&lt;/span&gt; refers to the Choi-Jamiolkowki isomorphism which is of the form:&#xA;    &lt;span class=&quot;math-container&quot;&gt;$$CJ: \on{Hom}(\on{End}(\mathcal{H_A}),\on{End}(\mathcal{H_B)}) \rightarrow \on{End}(\mathcal{H_A^*}\otimes\mathcal{H_B})$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\on{Hom}$&lt;/span&gt; refers to homomorphism (I believe) &lt;/p&gt;&lt;/li&gt;&#xA;    &lt;/ol&gt;&#xA;  &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does the subscript, superscript notation mean on the &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;s?&lt;/p&gt;&#xA;" OwnerUserId="11648" LastEditorUserId="55" LastEditDate="2020-10-22T10:51:35.527" LastActivityDate="2020-10-22T10:51:35.527" Title="Understanding Quantum Channel and Choi Jamiolkowski Notation" Tags="&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2020-07-18T23:36:34.810" ContentLicense="CC BY-SA 4.0" />
  <row Id="11568" PostTypeId="1" AcceptedAnswerId="11570" CreationDate="2020-04-16T07:38:48.963" Score="0" ViewCount="108" Body="&lt;p&gt;Learning from the ground up (while great) is an overdose of the mathematics behind quantum computing and is taking way too long to grasp.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11708" LastEditorUserId="11708" LastEditDate="2020-04-16T08:09:06.893" LastActivityDate="2020-04-16T08:09:06.893" Title="Can I learn Quantum Programming and then go back to learn the Mathematics / Physics behind it later?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11569" PostTypeId="1" CreationDate="2020-04-16T07:52:34.833" Score="4" ViewCount="97" Body="&lt;p&gt;I would like to prepare an ansatz for VQE.&#xA;I know UCC ansatz is one of the most useful ansatz, but I would like to reduce the number of CNOT.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From the matrix of a given Hamiltonian, can we know the ansatz for the given Hamiltonian needs entanglers or not?&lt;/p&gt;&#xA;" OwnerUserId="8673" LastActivityDate="2020-04-21T14:20:12.597" Title="In which type of Hamiltonian does the ansatz need an entangler in VQE?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11570" PostTypeId="2" ParentId="11568" CreationDate="2020-04-16T08:06:31.210" Score="1" Body="&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-16T08:06:31.210" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11571" PostTypeId="1" CreationDate="2020-04-16T08:46:34.060" Score="2" ViewCount="130" Body="&lt;p&gt;I try to run HHL algorithm on quantum computer in Qiskit Notebooks on the site. I take it from here &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html&lt;/a&gt; but it doesn't work. The error message is &#xA; &lt;code&gt;&quot;Credentials are already in use. The existing account in the session will be replaced.&quot;&lt;/code&gt; and &lt;code&gt;&quot;circuits = [qc_qa_c, qc_qa_3cx, qc_qa_5cx]&quot;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="10395" LastEditorUserId="2293" LastEditDate="2020-04-17T18:08:13.690" LastActivityDate="2020-04-17T18:08:13.690" Title="Problem with HHL algorithm on Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11572" PostTypeId="2" ParentId="11571" CreationDate="2020-04-16T10:33:21.257" Score="6" Body="&lt;p&gt;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 &lt;code&gt;IBMQ.load_accounts()&lt;/code&gt; more than once. The second message appears to just be the output of the creation of the &lt;code&gt;circuits&lt;/code&gt; variable.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-04-16T10:33:21.257" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11573" PostTypeId="1" AcceptedAnswerId="11579" CreationDate="2020-04-16T11:19:52.370" Score="3" ViewCount="480" Body="&lt;p&gt;I want to construct a following 16x16 matrix (system of four qubits)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U=\text{diag}(1,1,...,1,e^{-iV},e^{-iV})$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is a constant.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this matrix describe these rotations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|1110 \rangle  \to  e^{-iV}|1110\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|1111 \rangle \to e^{-iV}|1111\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No rotation is applied to other computational basis states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following the book &lt;em&gt;Principles of quantum computation and information&lt;/em&gt; I can build this &lt;span class=&quot;math-container&quot;&gt;$C^4$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate: (with ancillary qubits)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2yvtV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2yvtV.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my situation, I have to build a &lt;span class=&quot;math-container&quot;&gt;$C^3$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate, but the procedure is the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is when I have to apply this &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that appears in the middle of the &lt;span class=&quot;math-container&quot;&gt;$C^3$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't know how to construct the &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate so that it performs ONLY the rotation &lt;span class=&quot;math-container&quot;&gt;$e^{-iV}$&lt;/span&gt; on &lt;code&gt;q[0]&lt;/code&gt;, leaving the rest of thee qubits (&lt;code&gt;q[1]&lt;/code&gt;, &lt;code&gt;q[2]&lt;/code&gt;, &lt;code&gt;q[3]&lt;/code&gt;) as they were.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that if I know how to construct the &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, I will have the &lt;span class=&quot;math-container&quot;&gt;$C^3$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate which represents the matrix I want to implement.&lt;/p&gt;&#xA;" OwnerUserId="10202" LastEditorUserId="9006" LastEditDate="2020-04-16T13:09:06.090" LastActivityDate="2020-04-21T20:41:54.143" Title="Controlled-U gate on IBMQ" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11574" PostTypeId="1" CreationDate="2020-04-16T12:28:27.393" Score="2" ViewCount="51" Body="&lt;p&gt;I'm running tomography job like I have done many times before. I send the job, and the &lt;code&gt;job.status()&lt;/code&gt; is 'DONE'. But when I ask for &lt;code&gt;job.results()&lt;/code&gt;  I get the following traceback.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm using version &lt;code&gt;0.18.0&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;KeyError                                  Traceback (most recent call last)&#xA;/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py in job_result(self, job_id, use_object_storage)&#xA;    245         try:&#xA;--&amp;gt; 246             return self.job_get(job_id)['qObjectResult']&#xA;    247         except KeyError as err:&#xA;&#xA;KeyError: 'qObjectResult'&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;ApiIBMQProtocolError                      Traceback (most recent call last)&#xA;/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in _retrieve_result(self, refresh)&#xA;    675             try:&#xA;--&amp;gt; 676                 result_response = self._api.job_result(self.job_id(), self._use_object_storage)&#xA;    677                 self._result = Result.from_dict(result_response)&#xA;&#xA;/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py in job_result(self, job_id, use_object_storage)&#xA;    248             raise ApiIBMQProtocolError(&#xA;--&amp;gt; 249                 'Unexpected return value received from the server: {}'.format(str(err))) from err&#xA;    250 &#xA;&#xA;ApiIBMQProtocolError: &quot;Unexpected return value received from the server: 'qObjectResult'&quot;&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;IBMQJobApiError                           Traceback (most recent call last)&#xA;&amp;lt;ipython-input-50-0a8321076fbb&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 experimental_state = StateTomographyFitter(best_full_tomography_job.result(), best_full_tomography_transpiled).fit()&#xA;      2 plot_state_hinton(experimental_state)&#xA;&#xA;/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in result(self, timeout, wait, partial, refresh)&#xA;    253                     'Use job.error_message() to get more details.'.format(self.job_id()))&#xA;    254 &#xA;--&amp;gt; 255         return self._retrieve_result(refresh=refresh)&#xA;    256 &#xA;    257     def cancel(self) -&amp;gt; bool:&#xA;&#xA;/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in _retrieve_result(self, refresh)&#xA;    687                 raise IBMQJobApiError(&#xA;    688                     'Unable to retrieve result for '&#xA;--&amp;gt; 689                     'job {}: {}'.format(self.job_id(), str(err))) from err&#xA;    690             finally:&#xA;    691                 # In case partial results are returned or job failure, an error message is cached.&#xA;&#xA;IBMQJobApiError: 'Unable to retrieve result for job 5e984c5e6ad41d00184b12c1: &quot;Unexpected return value received from the server: \'qObjectResult\'&quot;'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What does it mean, and what went &lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I now see that when I retrieve a previously ran job, I get a warning message:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/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.&#xA;  experiments=experiments, header=header)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8069" LastEditorUserId="8069" LastEditDate="2020-04-16T18:29:24.890" LastActivityDate="2020-04-16T18:29:24.890" Title="IBMQJob.result() returns KeyError: 'qObjectResult'" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;tomography&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="11575" PostTypeId="1" AcceptedAnswerId="11604" CreationDate="2020-04-16T14:35:21.067" Score="0" ViewCount="94" Body="&lt;p&gt;I'm using the following piece of python code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;from qiskit import *&#xA;from qiskit.tools.visualization import plot_bloch_multivector, plot_histogram&#xA;&#xA;from qiskit import execute, IBMQ, BasicAer&#xA;from qiskit.providers.ibmq import least_busy&#xA;from qiskit.tools.monitor import job_monitor&#xA;&#xA;secret_number = &quot;1010&quot;&#xA;n = len(secret_number)&#xA;circuit = QuantumCircuit(n+1, n)&#xA;circuit.h(range(n))&#xA;circuit.x(n)&#xA;circuit.h(n)&#xA;circuit.barrier()&#xA;for i,v in enumerate(reversed(secret_number)):&#xA;    if v==&quot;1&quot;:&#xA;        circuit.cx(i, n)&#xA;&#xA;circuit.barrier()&#xA;circuit.h(range(n))&#xA;circuit.barrier()&#xA;circuit.measure(range(n), range(n))&#xA;simulator = Aer.get_backend(&quot;qasm_simulator&quot;)&#xA;sim_result = execute(circuit, backend=simulator, shots=4096).result()&#xA;&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(&quot;ibm-q&quot;)&#xA;# qcomp = provider.get_backend(&quot;ibmq_16_melbourne&quot;)&#xA;qcomp = provider.get_backend(&quot;ibmq_burlington&quot;)&#xA;job = execute(circuit, backend=qcomp, shots=4096)&#xA;job_monitor(job)&#xA;real_result = job.result()&#xA;counts = real_result.get_counts(circuit)&#xA;import collections&#xA;c = collections.Counter(counts)&#xA;&#xA;# printing&#xA;print(circuit.draw())&#xA;print(&quot;result simulation:&quot;)&#xA;print(sim_result.get_counts())&#xA;print(&quot;results (top 5):&quot;)&#xA;print(c.most_common(5))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results are shown here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JgNZM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JgNZM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see, the expected result is &lt;code&gt;1010&lt;/code&gt;, 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As complementary information, I tried the same code with &lt;code&gt;secret_number = &quot;1011001&quot;&lt;/code&gt; and the &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; server. These are the results:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lVvEy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lVvEy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you see. The error is amplified.&lt;/p&gt;&#xA;" OwnerUserId="11609" LastEditorUserId="11609" LastEditDate="2020-04-16T16:03:18.283" LastActivityDate="2020-04-19T00:45:21.870" Title="Bernstein-Vazirani IBMQ error due to probably measurements" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11576" PostTypeId="1" CreationDate="2020-04-16T16:02:17.433" Score="1" ViewCount="42" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first (1024), I got in results, a &quot;Running&quot; time of 8.8s &#xA;For the second (8096), I got in results, a &quot;Running&quot; time of 35.7s&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does this &quot;Running&quot; field means exactly? Is it not a running execution time on the quantum computer?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, normally, I should got about 70 seconds for the second way. &#xA;Why is it shorter?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you for your help &amp;amp; answers.&lt;/p&gt;&#xA;" OwnerUserId="11714" LastEditorUserId="5955" LastEditDate="2020-04-17T09:56:59.987" LastActivityDate="2020-04-17T09:56:59.987" Title="Meaning of &quot;Running&quot; time field in Results and correlation with the &quot;shots&quot; choosen number" Tags="&lt;ibm-q-experience&gt;&lt;speedup&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11577" PostTypeId="2" ParentId="11575" CreationDate="2020-04-16T16:02:21.120" Score="0" Body="&lt;p&gt;This is a partial answer, in case somebody is having the same issue as I.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My code was based on &lt;a href=&quot;https://www.youtube.com/watch?v=sqJIpHYl7oo&amp;amp;list=PLOFEBzvs-Vvp2xg9-POLJhQwtVktlYGbY&amp;amp;index=6&quot; rel=&quot;nofollow noreferrer&quot;&gt;this IBM tutorial video&lt;/a&gt; but with the implementation in the real computer, for the video they use the description of the oracle with &lt;strong&gt;CX gate&lt;/strong&gt;. However in the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/bernstein-vazirani.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation's example&lt;/a&gt;, they use the &lt;strong&gt;Z gate&lt;/strong&gt; 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 &lt;code&gt;circuit.cx(i, n)&lt;/code&gt; with &lt;code&gt;circuit.z(i)&lt;/code&gt; and then you can see the magic in the following picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gdbm9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gdbm9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The reason why &lt;strong&gt;CX gate&lt;/strong&gt; doesn't work is still unclear to me. It would be nice if anyone can provide some clarification. &lt;/p&gt;&#xA;" OwnerUserId="11609" LastEditorUserId="11609" LastEditDate="2020-04-16T16:10:05.903" LastActivityDate="2020-04-16T16:10:05.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11578" PostTypeId="2" ParentId="7117" CreationDate="2020-04-16T18:40:10.177" Score="1" Body="&lt;p&gt;When I tried getting data after using &lt;code&gt;job = backend.retrieve_job('JOB_ID')&lt;/code&gt;, I got &lt;code&gt;&quot;QiskitError: 'Data for experiment &quot;circuit0&quot; could not be found.'&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I tried using &lt;code&gt;job_info = provider.circuits.client.get_job(job_id)&lt;/code&gt;, I got &lt;code&gt;&quot;AttributeError: 'AccountProvider' object has no attribute 'circuits'.&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What worked for me was &lt;code&gt;job_info={the entire text of the json file downloaded from Results}&lt;/code&gt;, and then proceeding as James described above.&lt;/p&gt;&#xA;" OwnerUserId="11715" LastEditorUserId="5955" LastEditDate="2020-04-16T22:08:10.820" LastActivityDate="2020-04-16T22:08:10.820" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11579" PostTypeId="2" ParentId="11573" CreationDate="2020-04-16T21:33:36.673" Score="2" Body="&lt;p&gt;You can implement your gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with following circuit (&lt;em&gt;note that I denoted qubits differently, i.e. qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; are controlling qubits and &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; is target qubit&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/13uGS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/13uGS.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will start with description of gates acting on qubits &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;. Gate &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; is defined as follows&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U1(\theta) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i \theta}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When gate &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; acts on qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; and identity gate &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; acts on qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;, they together &#xA;compose so-called controlled global phase gate denoted by matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U1 \otimes I =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i \theta} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i \theta} &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This gate changes a phase of &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; only in case &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, we want the gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to act only in case qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; are all in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This means that gate &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; has to be controlled by qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; as well. Since there is only gate &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; controlled by one qubit, we have to use Toffoli gate (logical AND) to indicate whether both qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The result of Toffoli gate is stored in ancila qubit &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; and then used for controlling gate &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt;. Finnaly ancila qubit is uncomputed again by Toffoli gate (because this gate is inverse to itself) back to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eventuall, only in case qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; are all in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (as indicated by &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates in the figure), the gate acts and change the phase as desired.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A matrix describing the circuits is this&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = &#xA;\begin{pmatrix}&#xA;I_4 &amp;amp; O_4\\&#xA;O_4 &amp;amp; U_1 \otimes I \\&#xA;\end{pmatrix}&#xA;= \text{diag}(1,1\ \cdots, \mathrm{e}^{i\theta},\mathrm{e}^{i\theta}),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I_4$&lt;/span&gt; is 4x4 unit matrix and &lt;span class=&quot;math-container&quot;&gt;$O_4$&lt;/span&gt; is 4x4 zero matrix.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-16T21:33:36.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11580" PostTypeId="1" AcceptedAnswerId="11624" CreationDate="2020-04-16T22:29:17.530" Score="5" ViewCount="208" Body="&lt;p&gt;The Choi-Jamiolkowski of a channel &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\on}[1]{\operatorname{#1}}\Lambda : \on{End}(\mathcal{H_A}) \xrightarrow{} \on{End}(\mathcal{H_B})$&lt;/span&gt; is obtained through an isomorphism of the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  CJ:&#xA;  \on{Hom}(\on{End}(\mathcal{H_A}),\on{End}(\mathcal{H_B)})&#xA;  \rightarrow&#xA;  \on{End}(\mathcal{H_A^*}\otimes\mathcal{H_B}),&#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\on{End}(\mathcal{H})$&lt;/span&gt; is the set of endomorphisms over the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one interpret &lt;span class=&quot;math-container&quot;&gt;$CJ(\Lambda)$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="11647" LastEditorUserId="55" LastEditDate="2020-10-22T10:51:28.763" LastActivityDate="2020-10-22T12:17:43.517" Title="What does it mean to take the Choi-Jamiolkowski of a quantum channel?" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11581" PostTypeId="1" AcceptedAnswerId="11608" CreationDate="2020-04-17T05:41:46.970" Score="3" ViewCount="142" Body="&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here are a few snippets that lead me to believe this is a valid concept to consider:&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4046/can-we-process-infinite-matrices-with-a-quantum-computer&quot;&gt;Can we process infinite matrices with a quantum computer?&lt;/a&gt;, there is an answer that states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If instead of manipulating the quantum information in qubits, your quantum computer were to do operations on quits with  being infinity, then you'd essentially be processing infinite matrices on a quantum computer.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Additionally, in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4166/what-good-references-would-you-recommend-to-understand-the-continuous-variable/4167#4167&quot;&gt;another question&lt;/a&gt; there is an answer that states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1468/is-quantum-computing-limited-to-a-superposition-of-only-two-states/1469#1469&quot;&gt;Is quantum computing limited to a superposition of only two states?&lt;/a&gt; there is an answer that states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In principle, there is no limit to the dimension of the state space of a quantum system. There could even be an &amp;quot;infinite&amp;quot; dimensional separable Hilbert space (in short, separable means denumerable/countable with a one-one onto mapping to the natural numbers).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;From &lt;a href=&quot;https://physics.stackexchange.com/questions/60608/nonseparable-hilbert-space&quot;&gt;Nonseparable Hilbert space&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Furthermore, the article on Hilbert spaces contains the following:&lt;/p&gt;&#xA;&lt;p&gt;A Hilbert space is separable if and only if it admits a countable orthonormal basis.&lt;/p&gt;&#xA;&lt;p&gt;In case of field theory, it states:&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;What systems make use of countable infinities? How are they used?&lt;/p&gt;&#xA;&lt;p&gt;What systems make use of uncountable infinities? How are they used?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="55" LastEditDate="2020-09-23T12:21:10.933" LastActivityDate="2020-09-23T12:21:10.933" Title="What types of quantum systems use infinite values?" Tags="&lt;mathematics&gt;&lt;photonics&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11582" PostTypeId="2" ParentId="11573" CreationDate="2020-04-17T08:43:11.797" Score="1" Body="&lt;p&gt;In addition to Martin Vesely's &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11579/9459&quot;&gt;answer&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I want to share an alternative way of implementing &lt;code&gt;ccu1(t, q[0], q[1], q[2])&lt;/code&gt; gate, where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is some phase. It can be shown that &lt;code&gt;ccu1&lt;/code&gt; gate can be decomposed in the following way:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ccu1(t, q[0], q[1], q[2]) =&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cu1(t/2, q[0], q[1])&#xA;cx(q[1], q[2])&#xA;cu1(-t/2, q[0], q[2])&#xA;cx(q[1], q[2])&#xA;cu1(t/2, q[0], q[2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;cu1(t, q[0], q[1]) =&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;u1(t/2, q[0])&#xA;cx(q[0], q[1])&#xA;u1(-t/2, q[1])&#xA;cx(q[0], q[1])&#xA;u1(t/2, q[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As can be found &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/f38b617748d855e98f682d259b7cf597ef16b2a8/qiskit/extensions/standard/u1.py#L190-L194&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. So, this implementation of &lt;code&gt;ccu1&lt;/code&gt; gate will require 17 gates in Qiskit and no ancillary qubit. For the version with the &lt;code&gt;ccx&lt;/code&gt; gates we will need 35 gates in Qiskit if we will use &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/f38b617748d855e98f682d259b7cf597ef16b2a8/qiskit/extensions/standard/x.py#L357-L362&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; decomposition for &lt;code&gt;ccx&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; (&lt;em&gt;by Martin Vesely&lt;/em&gt;): For graphical illustration, here is the circuit implementing &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on IBM Q for &lt;span class=&quot;math-container&quot;&gt;$t = \pi$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FHbwR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FHbwR.png&quot; alt=&quot;IBM Q implementation&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-21T20:41:54.143" LastActivityDate="2020-04-21T20:41:54.143" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11584" PostTypeId="1" CreationDate="2020-04-17T16:40:10.513" Score="5" ViewCount="224" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex numbers to represent an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit state of a quantum computer. While it is true that the dimensionality of the Hilbert space spanned by an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit computational basis is &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, it seems to me that the subspaces reachable by many quantum algorithms that employ fixed sequence of unitary gates are substantially smaller.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$kn$&lt;/span&gt; unitary gates (&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$kn$&lt;/span&gt; such gates in a fixed sequence will not need more than &lt;span class=&quot;math-container&quot;&gt;$16kn$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, the &quot;size&quot; of the Hilbert subspace reachable from the initial state should scale as polynomial of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; as well. Therefore, I do not see why we would need &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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 &quot;classical&quot;, possibly probabilistic computing, algorithms capable of equalling Simon's and Shor's in efficiency? What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="11645" LastEditorUserId="9006" LastEditDate="2020-04-17T22:01:49.893" LastActivityDate="2020-04-26T21:03:32.040" Title="Does a classical computer really require $2^n$ complex numbers to represent the state of $n$ qubit quantum computer?" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;classical-computing&gt;&lt;nonclassicality&gt;&lt;interpretations&gt;" AnswerCount="5" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11585" PostTypeId="2" ParentId="11516" CreationDate="2020-04-17T18:14:24.553" Score="2" Body="&lt;p&gt;You only have 4 qubits, so the &quot;full operator&quot; is only at most a 16x16 matrix that combines all 7 of those multi-qubit gates. You can derive this &quot;full operator&quot; in MATLAB quite easily by using the &quot;kron&quot; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the second question: &quot;what operation does this circuit implement&quot;, this will become easier to answer once you figure out the 16x16 matrix see what it does to the four input  qubits. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-04-17T18:14:24.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11586" PostTypeId="2" ParentId="11584" CreationDate="2020-04-17T18:24:53.173" Score="5" Body="&lt;p&gt;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 :) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional Hilbert space. We do not need to know all those &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-04-17T18:24:53.173" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11587" PostTypeId="2" ParentId="11517" CreationDate="2020-04-17T18:32:31.357" Score="2" Body="&lt;p&gt;The question asked is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So is the QFT, which is the basis of Shor's factoring algorithm, an&#xA;  exception Aaronson's aphorism, or is there something else going on&#xA;  that's deeper?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And this is the quote you say Scott made:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Scott Aaronson is fond of saying &quot;Quantum computers do not solve hard&#xA;  search problems instantaneously by simply trying all the possible&#xA;  solutions at once.&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I agree with Scott, that quantum computers do not solve search problems &quot;instantaneously&quot;. If you look at Grover's search algorithm, for example, there is still a lot of work to be done, and a cost of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; gates for searching an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; entry database. Wouldn't the number of operations be &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1)$&lt;/span&gt; if we were just searching everything simultaneously at once?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The QFT however, does act on all of its input qubits at once. For example, here's a 2-qubit QFT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gj4R7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gj4R7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;&lt;em&gt;search problems&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;QFT is not doing any search&lt;/em&gt;&lt;/strong&gt;. QFT is literally just changing &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits according to a matrix like the one I showed.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-04-17T18:32:31.357" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11588" PostTypeId="1" CreationDate="2020-04-17T18:42:32.873" Score="3" ViewCount="289" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ex 2.73:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a density operator. A minimal ensemble for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is an ensemble &lt;span class=&quot;math-container&quot;&gt;$\{p_i,|\psi_i\rangle\}$&lt;/span&gt; containing a number of elements equal to the rank of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be any state in the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Show that there is a minimal ensemble for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; that contains &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, and moreover that in any such ensemble &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; must appear with probability &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_i=\frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p^{-1}$&lt;/span&gt; is defined to be the inverse of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, when &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is considered as an operator acting only on the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My answer so far is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is positive the therefore has a spectral decomposition &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_k\lambda_k|k\rangle\langle k|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The density operator cann be defined as &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_kp_k|k\rangle\langle k| = \sum_k|\hat{k}\rangle\langle \hat{k}|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\hat{k}\rangle=\sqrt{\lambda_k}|k\rangle$&lt;/span&gt;, and therefore &lt;span class=&quot;math-container&quot;&gt;$|k\rangle = \frac{|\hat{k}\rangle}{\sqrt{\lambda_k}} $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle = \sum_k c_{ik}|k\rangle$&lt;/span&gt;, using the above definition of &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle = \sum_k \frac{c_{ik}}{\sqrt{\lambda_k}}|\hat{k}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The density operator is given by &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_i|\psi_i\rangle\langle\psi_i|$&lt;/span&gt;, therefore&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_{i}\sum_{k}\frac{c_{ik}^2}{\lambda_k}|\hat{k}\rangle \langle\hat{k}|$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the definition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is can be seen that &lt;span class=&quot;math-container&quot;&gt;$p_i = \sum_{k}\frac{c_{ik}^2}{\lambda_k}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--- reading this back i'm not sure this is correct at all :( &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the second part working backwards a bit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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 $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; is of basis &lt;span class=&quot;math-container&quot;&gt;$|k \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle k |i\rangle = \langle i |k\rangle = 1 $&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i=k$&lt;/span&gt;, therefore&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle \psi_i|\rho^{-1}|\psi_i\rangle = \sum_{k} \frac{c_{i,k}^2}{\lambda_k}$&lt;/span&gt; so &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p_i = \frac{1}{\sum_{k} \frac{c_{i,k}^2}{\lambda_k}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However the above result does not match with the result I got for &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; in the first part, so one of them is wrong...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;---Update---&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the answer of the first part can be corrected, as the density matrix for &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; needs to be normalised, and therefore to normalise it&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the definition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is can be seen that to normalise the trace it is required that &lt;span class=&quot;math-container&quot;&gt;$p_i = \frac{1}{\sum_{k}\frac{c_{ik}^2}{\lambda_k}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence &lt;span class=&quot;math-container&quot;&gt;$\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}|$&lt;/span&gt;. Which is our original definition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="55" LastEditDate="2020-10-22T10:51:12.480" LastActivityDate="2020-10-22T10:51:12.480" Title="Nielsen and Chuang ex 2.73" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11589" PostTypeId="1" AcceptedAnswerId="11594" CreationDate="2020-04-17T18:46:12.290" Score="1" ViewCount="82" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9503016.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;, a cheap verion of a Toffoli, up to a phase flip for &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;, is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pmuS4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pmuS4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$A=R_y(\pi/4)$&lt;/span&gt;. Are there similar versions of cheap implementation of general &lt;span class=&quot;math-container&quot;&gt;$C^nNOT$&lt;/span&gt; gates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to just extend it the esay way, but found several unwanted off diagonal entries. My goal is a explicite &lt;span class=&quot;math-container&quot;&gt;$C^5NOT$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I came across this one for 4 qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LkOYm.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LkOYm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which I found &lt;a href=&quot;https://arxiv.org/pdf/1508.03273.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Can anyone help me to build the circuit for 6 qubits out of the description?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And finally I found &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0504100v1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; approach:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fp001.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fp001.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;but the number of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;s feels like &lt;span class=&quot;math-container&quot;&gt;$2^5$&lt;/span&gt; in my case, which is too high for my purpose.&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="9006" LastEditDate="2020-04-17T21:15:06.267" LastActivityDate="2020-04-17T21:59:30.597" Title="Cheap Toffoli gates with phase errors" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11590" PostTypeId="2" ParentId="11588" CreationDate="2020-04-17T20:47:51.903" Score="1" Body="&lt;p&gt;Define &lt;span class=&quot;math-container&quot;&gt;$p_i = \dfrac{1}{\sum_k \dfrac{|c_{ik}|^2}{\lambda_k} }$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_{ik} = \dfrac{\sqrt{p_i}c_{ik}}{\sqrt{\lambda_k}}$&lt;/span&gt;&#xA;then &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_k |q_{ik}|^2 = p_i \sum_k \dfrac{|c_{ik}|^2}{\lambda_k} = 1  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And also you have that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi_i| \rho^{-1}|\psi_i\rangle = \sum_k \dfrac{|c_{ik}|^2}{\lambda_k} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that I added &lt;span class=&quot;math-container&quot;&gt;$|c_{ik}|^2 $&lt;/span&gt; to be mathematically accurate. &lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-04-17T21:30:52.537" LastActivityDate="2020-04-17T21:30:52.537" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11592" PostTypeId="2" ParentId="11584" CreationDate="2020-04-17T21:34:22.843" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Ax = b$&lt;/span&gt;. It provides an exponential speed up, and uses &lt;span class=&quot;math-container&quot;&gt;$O(\log(N))$&lt;/span&gt;. If you think about it, it already takes &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; to write down the entire solution... so writing down all the entries of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; would make you lose out all the advantage... the idea is you can translate the problem to about preparing the state &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; for which we can sample. &lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-04-17T21:34:22.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11593" PostTypeId="2" ParentId="11477" CreationDate="2020-04-17T21:51:14.247" Score="1" Body="&lt;p&gt;Giving a general &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n $&lt;/span&gt; Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, it's not guarantee that you can decompose/expand &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in polynomial strings of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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... &lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-04-17T21:51:14.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11594" PostTypeId="2" ParentId="11589" CreationDate="2020-04-17T21:51:41.997" Score="1" Body="&lt;p&gt;Based on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9842/simpler-implementation-of-the-toffoli-gate-on-ibm-q-for-special-circumstances&quot;&gt;this&lt;/a&gt; thread, below is a code implementing &lt;span class=&quot;math-container&quot;&gt;$C^5NOT$&lt;/span&gt; up to a phase for output states &lt;span class=&quot;math-container&quot;&gt;$|q_0 q_1 q_2 q_3 q_4 1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_i \in \{|0\rangle, |1\rangle\}$&lt;/span&gt; (with expection of state &lt;span class=&quot;math-container&quot;&gt;$|111111\rangle$&lt;/span&gt;). For these states the phase is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, so returned computational basis state is multiplied by -1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Concerning number of CNOTs and &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates, I think it is not possible to decrease its number and it rises exponentially with increasing number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[6];&#xA;creg c[6];&#xA;&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[2],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[1],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[2],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[0],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[2],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[1],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[2],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[3],q[5];&#xA;ry(pi/32) q[5];&#xA;cx q[4],q[5];&#xA;ry(-pi/32) q[5];&#xA;cx q[0],q[5];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-17T21:59:30.597" LastActivityDate="2020-04-17T21:59:30.597" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11595" PostTypeId="2" ParentId="11588" CreationDate="2020-04-17T22:12:47.477" Score="3" Body="&lt;p&gt;This formulation of Ex 2.73 looks senseless to me (see the update of this answer). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In my edition of N&amp;amp;C the statement of Ex 2.73 is different. You are given density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and linearly independent states &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}$&lt;/span&gt; that span the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and you have to prove that there are unique numbers &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum p_i |\psi_i\rangle\langle \psi_i |$&lt;/span&gt; (and &lt;span class=&quot;math-container&quot;&gt;$\sum p_i=1$&lt;/span&gt; but this follows trivially from calculating the trace). Those numbers &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; can be computed by &#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_i=\frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such formulation is sensible, but it's just wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho= \frac{1}{3}\big(|0\rangle\langle 0| + 2|1\rangle\langle 1|\big)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle=|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle=|-\rangle$&lt;/span&gt;. It's quite clear that there are no &lt;span class=&quot;math-container&quot;&gt;$p_1, p_2$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho = p_1|+\rangle\langle +| + p_2|-\rangle\langle -|$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; are orthogonal, so it has to be a spectral decomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, but spectral decomposition is unique if eigenvalues are different. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only correct formulation I can imagine is the following. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a density operator and linearly independent states &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}$&lt;/span&gt; span the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. &lt;strong&gt;Suppose we are given that &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum p_i |\psi_i\rangle\langle \psi_i |$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$p_i&amp;gt;0$&lt;/span&gt;&lt;/strong&gt;. &lt;strong&gt;Prove that &lt;span class=&quot;math-container&quot;&gt;$\sum p_i=1$&lt;/span&gt; and&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$$p_i=\frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the proof is quite simple. Multiply that equation for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\rho^{-1}|\psi_j\rangle$&lt;/span&gt; from the right. We obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&#xA;that is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_j\rangle = \sum_i \big(p_i \langle \psi_i| \rho^{-1}|\psi_j\rangle\big) \cdot |\psi_i\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}$&lt;/span&gt; are linearly independent, so it must be &lt;span class=&quot;math-container&quot;&gt;$p_j \langle \psi_j| \rho^{-1}|\psi_j\rangle = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_i \langle \psi_i| \rho^{-1}|\psi_j\rangle = 0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another fact that can be proved is the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a density operator which has support of dim &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; be some state from this support. Then there are states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle, .., |\psi_{m-1}\rangle$&lt;/span&gt; from this support such that &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum p_i |\psi_i\rangle\langle \psi_i |$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p_i&amp;gt;0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i = 0$&lt;/span&gt;. And by the previous fact we can deduce that &lt;span class=&quot;math-container&quot;&gt;$p_i = \frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess it's what the editors actually meant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The proof is also not hard. Consider &lt;span class=&quot;math-container&quot;&gt;$\rho_\epsilon = \rho - \epsilon |\psi_0\rangle\langle \psi_0 |$&lt;/span&gt; for some small &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is small enough then &lt;span class=&quot;math-container&quot;&gt;$\rho_\epsilon$&lt;/span&gt; will be strictly positive on the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. But if we will raise &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; then at some moment &lt;span class=&quot;math-container&quot;&gt;$\epsilon = \epsilon^\prime$&lt;/span&gt; it will be &lt;span class=&quot;math-container&quot;&gt;$\rho_{\epsilon^\prime} \geq 0$&lt;/span&gt; but not &lt;span class=&quot;math-container&quot;&gt;$\rho_{\epsilon^\prime} &amp;gt; 0$&lt;/span&gt;. This implies that &lt;span class=&quot;math-container&quot;&gt;$\rho_{\epsilon^\prime}$&lt;/span&gt; has the support of dim &lt;span class=&quot;math-container&quot;&gt;$m-1$&lt;/span&gt; and we can take &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle,..,|\psi_{m-1}\rangle$&lt;/span&gt; as the corresponding eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho_{\epsilon^\prime}$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-04-19T07:28:16.693" LastActivityDate="2020-04-19T07:28:16.693" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11596" PostTypeId="2" ParentId="11569" CreationDate="2020-04-17T23:07:30.500" Score="3" Body="&lt;p&gt;I think that &lt;span class=&quot;math-container&quot;&gt;$UCC$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \sum h_i \sigma_i + \sum h_{ij}\sigma_{i}\sigma_{j} + \cdots  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this is not true in general. Therefore, you have to be careful about this. &lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-04-17T23:07:30.500" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11597" PostTypeId="2" ParentId="11584" CreationDate="2020-04-18T01:39:17.513" Score="2" Body="&lt;p&gt;The issue is that you are confusing the notions of &lt;a href=&quot;https://en.wikipedia.org/wiki/Kolmogorov_complexity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Komogorov complexity&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;that&lt;/em&gt; sense, only very &quot;simple&quot; states can be practically reached by a quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But that's not the sense that really matters for most purposes. Not all states that are &quot;simple&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that prime-counting function &lt;span class=&quot;math-container&quot;&gt;$\pi(n)$&lt;/span&gt; exceeds the logarithmic integral &lt;span class=&quot;math-container&quot;&gt;$\mathrm{li}(n)$&lt;/span&gt;. 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: &lt;a href=&quot;https://en.wikipedia.org/wiki/Skewes%27s_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;all the computers in the world could not calculate its value&lt;/a&gt;. Some quantum states reachable by shallow circuits are similar.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-04-18T01:39:17.513" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11598" PostTypeId="1" AcceptedAnswerId="11600" CreationDate="2020-04-18T06:49:13.567" Score="1" ViewCount="124" Body="&lt;p&gt;I'm trying to implement Quantum Phase Estimation from &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit textbook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the implementation circuit taken from the above-mentioned site:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yWsfw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yWsfw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The output at position 2 will be as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi _2⟩ = \frac{1}{2^{\frac{n}{2}}} \sum_{k=0}^{2^{n}-1} e^{2\pi i k} |k⟩ ⊗ |\psi⟩ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and after applying inverse QFT, the state becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \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⟩ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the next step claims that the above expression peaks near &lt;span class=&quot;math-container&quot;&gt;$ x = 2^n \theta $&lt;/span&gt; which is my point of doubt, why is this the case? Wouldn't the maximum amplitude be when &lt;span class=&quot;math-container&quot;&gt;$ x = 0 $&lt;/span&gt; based on simple calculus? &lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2020-04-18T08:09:36.407" Title="How does Inverse QFT work in Quantum Phase Estimation?" Tags="&lt;qiskit&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11599" PostTypeId="1" CreationDate="2020-04-18T07:02:57.137" Score="2" ViewCount="97" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H = \begin{pmatrix}&#xA;0 &amp;amp;  0 &amp;amp;  0 &amp;amp; 0 \\&#xA;0 &amp;amp; -1 &amp;amp;  1 &amp;amp; 0 \\&#xA;0 &amp;amp;  1 &amp;amp; -1 &amp;amp; 0 \\&#xA;0 &amp;amp;  0 &amp;amp;  0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;\qquad&#xA;E_{min} = -2&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What will be the QUBO for this hamiltonian? &lt;/li&gt;&#xA;&lt;li&gt;What will be the shape of the QUBO matrix? Is it 4X4 or 2X2? &lt;/li&gt;&#xA;&lt;li&gt;How to convert hamiltonian to QUBO? Please elaborate the mathematical steps.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11727" LastEditorUserId="9459" LastEditDate="2020-04-18T10:11:42.653" LastActivityDate="2020-04-18T16:25:52.947" Title="How to convert a qubit hamiltonian to QUBO and vice versa?" Tags="&lt;hamiltonian-simulation&gt;&lt;annealing&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11600" PostTypeId="2" ParentId="11598" CreationDate="2020-04-18T08:09:36.407" Score="1" Body="&lt;p&gt;The expression you obtain after applying the QFT contains sums of the unit square, &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i/2^n}$&lt;/span&gt;, which sum up to 0 if you sum over the full range of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{k=0}^{2^n - 1} e^{\frac{2\pi i}{2^n} k} = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://math.stackexchange.com/questions/891875/proof-that-sum-of-complex-unit-roots-is-zero&quot;&gt;here&lt;/a&gt; for explanations why this is the case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the inner sum in the amplitudes will also sum up to 0, if &lt;span class=&quot;math-container&quot;&gt;$(x - 2^n\theta)$&lt;/span&gt; is an integer, because that's just multiplication with a constant factor and the sum-to-zero-rule still holds.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x=0}^{2^n - 1} \sum_{k=0}^{2^n - 1} e^{\frac{2\pi i}{2^n} k (x - 2^n \theta)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;But:&lt;/strong&gt; If &lt;span class=&quot;math-container&quot;&gt;$(x - 2^n \theta) = 0$&lt;/span&gt;, then the exponential will be &lt;span class=&quot;math-container&quot;&gt;$e^0 = 1$&lt;/span&gt; and your sum is collapsing to&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x=0}^{2^n - 1} \sum_{k=0}^{2^n - 1} 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, the amplitudes are 0 if &lt;span class=&quot;math-container&quot;&gt;$x \neq 2^n \theta$&lt;/span&gt; and 1 if &lt;span class=&quot;math-container&quot;&gt;$x = 2^n \theta$&lt;/span&gt;. &#xA;Note that the derivation is more complicated if &lt;span class=&quot;math-container&quot;&gt;$2^n\theta$&lt;/span&gt; is not an integer. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The QFT and its derivation is also very well explained in &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt;, chapter 5.1, page 217, I would recommend to look up there if you have any questions! &lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-04-18T08:09:36.407" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11602" PostTypeId="1" AcceptedAnswerId="11603" CreationDate="2020-04-18T17:27:16.853" Score="3" ViewCount="73" Body="&lt;p&gt;Suppose I know how to implement a 2 qubit gate &lt;span class=&quot;math-container&quot;&gt;$C-U$&lt;/span&gt; (i.e controlled U), and I want to implement &lt;span class=&quot;math-container&quot;&gt;$CC-U$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$C-U$&lt;/span&gt; and other 1 or 2 qubit gates, is that possible?&lt;/p&gt;&#xA;" OwnerUserId="8275" LastEditorUserId="9006" LastEditDate="2020-04-18T22:30:46.283" LastActivityDate="2020-04-18T22:30:46.283" Title="Implementing a controlled-controlled-U using controlled-U" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11603" PostTypeId="2" ParentId="11602" CreationDate="2020-04-18T22:29:47.170" Score="4" Body="&lt;p&gt;Yes, generally it is possible by using a &lt;strong&gt;three&lt;/strong&gt; qubits Toffoli gate (or series of Toffoli gates) to evaluate whether all controling qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If this is a case then &lt;span class=&quot;math-container&quot;&gt;$C-U$&lt;/span&gt; gate is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of &lt;span class=&quot;math-container&quot;&gt;$CC-H$&lt;/span&gt; (i.e. controlled-controlled Hadamard gate):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gkxpT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gkxpT.png&quot; alt=&quot;CC-H gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, a first Toffoli gate return &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C-H$&lt;/span&gt; gate acts on qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;. Eventually, you have Hadamard gate controlled by two qubits. Qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is so-called ancila qubit and in the end it has to be in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (so-called uncomputation). This is done by another Toffoli gate because Toffoli is inverse to itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to implement general &lt;span class=&quot;math-container&quot;&gt;$C \dots C-U$&lt;/span&gt; gate you can do it followingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y1iJ4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y1iJ4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please note that in some cases you can construct a simpler circuit (i.e with less quantum gates and those being only &lt;strong&gt;two&lt;/strong&gt; qubits). But generally the above mentioned approach works always.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-18T22:29:47.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11604" PostTypeId="2" ParentId="11575" CreationDate="2020-04-19T00:14:57.993" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0UsWW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0UsWW.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Oracle for the Bernstein algorithm can be implemented both using CX or Z gates. The CX gates make use of the &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/phase-kickback.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phase Kickback effect&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://qiskit.org/documentation/apidoc/aer_noise.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/aer_noise.html&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer.noise import NoiseModel&#xA;&#xA;noise_model = NoiseModel.from_backend(qcomp)&#xA;# Get coupling map from backend&#xA;coupling_map = qcomp.configuration().coupling_map&#xA;# Get basis gates from noise model&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;noisy_result = execute(circuit, Aer.get_backend('qasm_simulator'),&#xA;                 coupling_map=coupling_map,&#xA;                 basis_gates=basis_gates,&#xA;                 noise_model=noise_model,&#xA;                 shots=4096).result()&#xA;&#xA;print(noisy_result.get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I got the following counts:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;{'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}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can also try playing with this: &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&lt;/a&gt; and see if you get any improvements there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this is helpful ;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;&#xA;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 (&lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&lt;/a&gt;) 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. &lt;/p&gt;&#xA;" OwnerUserId="7322" LastEditorUserId="7322" LastEditDate="2020-04-19T00:45:21.870" LastActivityDate="2020-04-19T00:45:21.870" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11605" PostTypeId="1" CreationDate="2020-04-19T04:08:29.127" Score="1" ViewCount="146" Body="&lt;p&gt;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: &lt;code&gt;Instruction not in basis gates: instruction: bfunc, qubits: []&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is the transpiled code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qreg q[5];&#xA;&#xA;creg c[4];&#xA;&#xA;&#xA;u3(2.0943951023931953, 1.5707963267948966, 1.5707963267948966) q[0];&#xA;u2(0, 3.141592653589793) q[1];&#xA;cx q[1], q[2];&#xA;cx q[0], q[1];&#xA;u2(0, 3.141592653589793) q[0];&#xA;cx q[2], q[4];&#xA;measure q[0] -&amp;gt; c[0];&#xA;if(c == 1) u1(3.141592653589793) q[2];&#xA;if(c == 1) u1(3.141592653589793) q[4];&#xA;measure q[1] -&amp;gt; c[1];&#xA;if(c == 1) u3(3.141592653589793, 0, 3.141592653589793) q[2];&#xA;if(c == 1) u3(3.141592653589793, 0, 3.141592653589793) q[4];&#xA;measure q[2] -&amp;gt; c[2];&#xA;measure q[4] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11738" LastEditorUserId="9006" LastEditDate="2020-04-19T11:38:44.737" LastActivityDate="2020-04-19T11:38:44.737" Title="Error when running an algorithm on real device at IBM Q using QASM" Tags="&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11606" PostTypeId="1" AcceptedAnswerId="13281" CreationDate="2020-04-19T11:36:21.937" Score="1" ViewCount="57" Body="&lt;p&gt;I wrote following code in QASM editor on IBM Q web interface (note ccu1 is controlled-controlled U1 gate):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;gate ccu1 ( p ) c1, c2, t  {&#xA;  cu1 ( p / 2 ) c1, c2;&#xA;  cx c2, t;&#xA;  cu1 ( - p / 2 ) c1, t;&#xA;  cx c2, t;&#xA;  cu1 ( p / 2 ) c1, t;&#xA;}&#xA;&#xA;qreg q[4];&#xA;creg c[4];&#xA;&#xA;h q[0];&#xA;h q[1];&#xA;h q[2];&#xA;h q[3];&#xA;&#xA;ccu1(pi) q[0],q[1],q[2];&#xA;&#xA;id q[3];&#xA;measure q[3] -&amp;gt; c[3];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;ERROR_RUNNING_JOB&lt;/code&gt;. There is also a status message &lt;code&gt;Error in transpilation process. [1003]&lt;/code&gt; on results page.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suspect that the issue is caused by subroutine (a &lt;code&gt;gate&lt;/code&gt; statement at the beginning of the code).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Could anyone please help me solve the issue?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Note, I know that it is possible to use subroutine in Qiskit, but I am interested in QASM&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-04-20T09:09:58.827" LastActivityDate="2020-08-12T12:54:30.500" Title="Subroutines on IBM Q (ERROR_RUNNING_JOB returned)" Tags="&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11608" PostTypeId="2" ParentId="11581" CreationDate="2020-04-19T13:12:24.207" Score="5" Body="&lt;p&gt;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, &lt;strong&gt;both countable and uncountable&lt;/strong&gt;. The quantum computing paradigm based on this Hilbert space is called &lt;em&gt;continuous-variable (CV) quantum computing&lt;/em&gt;, and a lot of different protocols and algorithms have been proposed using this framework, see for instance &lt;a href=&quot;https://arxiv.org/abs/1912.07634&quot; rel=&quot;noreferrer&quot;&gt;this recent review&lt;/a&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1605.09278&quot; rel=&quot;noreferrer&quot;&gt;encoding qubits into continuous variables&lt;/a&gt;. This is the approach taken by the photonic quantum computing company PsiQuantum (as far as I understand).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Where does CV quantum computing come from?&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another more rigorous way to define this Hilbert space is called the &lt;em&gt;second quantization&lt;/em&gt;: 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Fock_space&quot; rel=&quot;noreferrer&quot;&gt;Fock space&lt;/a&gt; (which is a separable Hilbert space when defined properly). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.scottaaronson.com/papers/optics.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Formalism and infinities&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;All those formalisms have a common point: you end up with a separable Hilbert space. And &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert_space#Separable_spaces&quot; rel=&quot;noreferrer&quot;&gt;all separable Hilbert spaces are the same up to an isometric isomorphism&lt;/a&gt;. Moreover, separable Hilbert spaces have the amazing properties to contain an infinite &lt;strong&gt;countable basis&lt;/strong&gt;, that we can note &lt;span class=&quot;math-container&quot;&gt;$(|n\rangle)_{n \in {\mathbb{N}}}$&lt;/span&gt;. Therefore, for any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in \mathcal{H}$&lt;/span&gt;, there exists &lt;span class=&quot;math-container&quot;&gt;$(a_n)_{n \in {\mathbb{N}}}$&lt;/span&gt; such that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_{n=0}^{\infty} a_n |n\rangle$$&lt;/span&gt;&#xA;Physically, &lt;span class=&quot;math-container&quot;&gt;$|n\rangle$&lt;/span&gt; is a state that contains &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; indistinguishable photons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this basis &lt;span class=&quot;math-container&quot;&gt;$(|n\rangle)_{n \in \mathbb{N}}$&lt;/span&gt; (called the Fock basis), we can define many important objects of the CV framework, such as the creation and annihilation operators&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{a}^{\dagger}|n\rangle=\sqrt{n+1} |n+1\rangle$$&lt;/span&gt; &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{a}|n\rangle=\sqrt{n} |n-1\rangle,$$&lt;/span&gt; &#xA;the position and momentum operators (which physically correspond the amplitude of the electric and magnetic fields, not to spatial coordinates)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{X}=\frac{1}{\sqrt{2}} (\hat{a}^{\dagger} + \hat{a})$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{P}=\frac{1}{\sqrt{2}} i (\hat{a}^{\dagger} - \hat{a})$$&lt;/span&gt;&#xA;and the number operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{N}|n\rangle = n|n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, you can verify that &lt;span class=&quot;math-container&quot;&gt;$\hat{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{P}$&lt;/span&gt; are hermitian (infinite-dimensional) operators, and are therefore observables that you can physically measure. Their eigenstates &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; form two new bases of your Hilbert space, but this time &lt;strong&gt;uncountably infinite&lt;/strong&gt;, i.e. for every state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, there exists a function &lt;span class=&quot;math-container&quot;&gt;$x\mapsto \psi(x)$&lt;/span&gt; and a function &lt;span class=&quot;math-container&quot;&gt;$p \mapsto \phi(p)$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \int \psi(x) |x\rangle dx$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \int \phi(p) |p\rangle dp$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, &lt;strong&gt;the same state can be represented both using countable infinities and uncountable infinities&lt;/strong&gt;. Which basis you want to choose depends on your measuring device (photon detectors measure in the &lt;span class=&quot;math-container&quot;&gt;$|n\rangle$&lt;/span&gt; basis and homodyne detectors in the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\hat{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{P}$&lt;/span&gt;, 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?). &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Algorithms&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1804.03159&quot; rel=&quot;noreferrer&quot;&gt;the paper&lt;/a&gt; of the CV library &lt;a href=&quot;https://strawberryfields.readthedocs.io/&quot; rel=&quot;noreferrer&quot;&gt;Strawberry Fields&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1110.3234&quot; rel=&quot;noreferrer&quot;&gt;have been ported to CV systems&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Going back to computation, an important CV algorithm is &lt;a href=&quot;https://www.scottaaronson.com/papers/optics.pdf&quot; rel=&quot;noreferrer&quot;&gt;Boson Sampling&lt;/a&gt;, which is mostly considered as a way to demonstrate quantum supremacy, but might have applications such as &lt;a href=&quot;https://arxiv.org/abs/1803.10730&quot; rel=&quot;noreferrer&quot;&gt;finding dense subgraphs&lt;/a&gt; or simulating &lt;a href=&quot;https://arxiv.org/abs/1412.8427&quot; rel=&quot;noreferrer&quot;&gt;molecular vibronic spectra&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, CV quantum computing has been considered in order to &lt;a href=&quot;https://arxiv.org/abs/1809.02622&quot; rel=&quot;noreferrer&quot;&gt;solve partial differential equation&lt;/a&gt; (porting the HHL algorithm to an infinite-dimensional system), to &lt;a href=&quot;https://arxiv.org/abs/1809.02579&quot; rel=&quot;noreferrer&quot;&gt;improve Monte-Carlo algorithms&lt;/a&gt; or to do &lt;a href=&quot;https://arxiv.org/abs/1803.07128&quot; rel=&quot;noreferrer&quot;&gt;quantum machine learning&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1806.06871&quot; rel=&quot;noreferrer&quot;&gt;variational circuits&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://www.diva-portal.org/smash/get/diva2:1320072/FULLTEXT01.pdf&quot; rel=&quot;noreferrer&quot;&gt;my master's thesis&lt;/a&gt;, which explains all of that in more details and (I hope) in an understandable way.&lt;/p&gt;&#xA;" OwnerUserId="8545" LastActivityDate="2020-04-19T13:12:24.207" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11609" PostTypeId="1" AcceptedAnswerId="11611" CreationDate="2020-04-19T14:44:40.247" Score="1" ViewCount="69" Body="&lt;p&gt;Prove that the density matrix of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; with respect to basis &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \begin{bmatrix}&#xA;		1 &amp;amp; 0 \\&#xA;		0 &amp;amp; 0&#xA;		\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8620" LastEditorUserId="55" LastEditDate="2020-04-21T09:00:07.747" LastActivityDate="2020-04-21T09:00:07.747" Title="What is the density matrix of $|+\rangle$ with respect to basis $\{|+\rangle, |-\rangle\}$?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11610" PostTypeId="1" AcceptedAnswerId="11613" CreationDate="2020-04-19T14:45:14.620" Score="1" ViewCount="72" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&#xA;If I make a rotation of &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; around the x axis, starting from &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt;, I expect &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{\sqrt{2 + \sqrt{2}}}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta= \frac{\sqrt{2 - \sqrt{2}}}{2}$&lt;/span&gt; when measured with respect to the computational basis states of &lt;span class=&quot;math-container&quot;&gt;$\ket{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{1}$&lt;/span&gt;. I can verify this is correct empirically using a quantum simulator. I want to measure with respect to new basis states &lt;span class=&quot;math-container&quot;&gt;$\ket{+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{-}$&lt;/span&gt;, defined in &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; as follows &lt;span class=&quot;math-container&quot;&gt;$\ket{+} \equiv \frac{\ket{0}+\ket{1}}{\sqrt{2}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\ket{-} \equiv \frac{\ket{0}-\ket{1}}{\sqrt{2}}$&lt;/span&gt;, and corresponding to the poles of the x axis of the Bloch sphere. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the Bloch sphere, I would expect to get &lt;span class=&quot;math-container&quot;&gt;$\ket{+}$&lt;/span&gt; half of the time, and &lt;span class=&quot;math-container&quot;&gt;$\ket{-}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} = \alpha\ket{0} + \beta\ket{1}$&lt;/span&gt;, with the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; previously mentioned, as follows: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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{-}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This math seems sound to me, however if I attempt to translate to this new basis using my &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, I get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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{-} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\left(\frac{\sqrt{2+\sqrt{2}} + \sqrt{2-\sqrt{2}}}{2\sqrt{2}}\right)^2 \approx 0.85$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, the important bit of my Q# code I've been using to test this is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Rx(PI()/4.0, qubit);&#xA;set state = Measure([PauliX], [qubit]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11742" LastEditorUserId="10473" LastEditDate="2020-04-20T16:13:56.773" LastActivityDate="2020-04-20T16:13:56.773" Title="Why don't I get what I expect when measuring with respect to a different basis?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;q#&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11611" PostTypeId="2" ParentId="11609" CreationDate="2020-04-19T15:39:31.960" Score="2" Body="&lt;p&gt;You may compute the density matrix for a given pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, with&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\rho = |\psi\rangle \langle \psi|.&#xA;\end{align*}&lt;/span&gt;&#xA;Thus, when you define &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle,|-\rangle\}$&lt;/span&gt; to be your standard basis vectors, you have,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\rho = |+\rangle \langle +| = \begin{pmatrix}1 \\ 0 \end{pmatrix}\begin{pmatrix}1 &amp;amp; 0 \end{pmatrix} = \begin{pmatrix}1 &amp;amp; 0 \\0 &amp;amp; 0\end{pmatrix}.&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;    |+\rangle \equiv \begin{pmatrix}1\\0\end{pmatrix}, |-\rangle \equiv \begin{pmatrix}0\\1\end{pmatrix}.&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It may help to consider what would happen if we defined the standard basis to be &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt;. In our computation we would have,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\rho = |+\rangle \langle +| = \frac{1}{2}\begin{pmatrix}1 \\ 1 \end{pmatrix}\begin{pmatrix}1 &amp;amp; 1 \end{pmatrix} = \frac{1}{2}\begin{pmatrix}1 &amp;amp; 1 \\1 &amp;amp; 1\end{pmatrix}.&#xA;\end{align*}&lt;/span&gt;&#xA;Recall that for an invertible matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, we may diagonalize it as &lt;span class=&quot;math-container&quot;&gt;$A = PDP^{-1}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is a diagonal matrix containing the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; consists of its eigenvectors. Diagonalizing the above matrix yields,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\rho = \frac{1}{2}\begin{pmatrix}1 &amp;amp; 1 \\1 &amp;amp; 1\end{pmatrix} &amp;amp;= \frac{1}{2}\begin{pmatrix}1 &amp;amp; -1 \\1 &amp;amp; 1\end{pmatrix}\begin{pmatrix}2 &amp;amp; 0 \\0 &amp;amp; 0\end{pmatrix}\begin{pmatrix}1 &amp;amp; 1 \\-1 &amp;amp; 1\end{pmatrix}\\&#xA;&amp;amp;= \begin{pmatrix}1 &amp;amp; -1 \\1 &amp;amp; 1\end{pmatrix}\begin{pmatrix}1 &amp;amp; 0 \\0 &amp;amp; 0\end{pmatrix}\begin{pmatrix}1 &amp;amp; 1 \\-1 &amp;amp; 1\end{pmatrix}.&#xA;\end{align*}&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$A = PDP^{-1}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P^{-1}$&lt;/span&gt; brings us into the basis where its columns are the standard basis vectors, and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; brings us out of it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please let me know if this doesn't answer your question.&lt;/p&gt;&#xA;" OwnerUserId="5157" LastEditorUserId="5157" LastEditDate="2020-04-19T21:55:48.930" LastActivityDate="2020-04-19T21:55:48.930" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11613" PostTypeId="2" ParentId="11610" CreationDate="2020-04-19T16:29:44.187" Score="2" Body="&lt;p&gt;I think there should be &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; in the expression for &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;R_x\left(\frac{\pi}{4}\right) |0\rangle= &#xA;\begin{pmatrix}&#xA;\cos\left(\frac{\pi}{8}\right) &amp;amp; -i \sin\left(\frac{\pi}{8}\right) \\&#xA;-i \sin\left(\frac{\pi}{8}\right) &amp;amp; \cos\left(\frac{\pi}{8}\right)&#xA;\end{pmatrix} &#xA;\begin{pmatrix} 1 \\ 0\end{pmatrix} = \\&#xA;=\frac{\sqrt{2 + \sqrt{2}}}{2} |0\rangle - i \frac{\sqrt{2 - \sqrt{2}}}{2} |1\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we will have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left|\frac{\sqrt{2 + \sqrt{2}} -i \sqrt{2 - \sqrt{2}}}{2\sqrt{2}}\right|^2 = 0.5 $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-19T16:56:50.413" LastActivityDate="2020-04-19T16:56:50.413" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11614" PostTypeId="1" AcceptedAnswerId="11615" CreationDate="2020-04-20T05:37:44.930" Score="1" ViewCount="93" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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”)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Could you help me please?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hwbfq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hwbfq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BDZCy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BDZCy.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11746" LastEditorUserId="55" LastEditDate="2021-01-18T13:32:59.547" LastActivityDate="2021-01-18T13:32:59.547" Title="What happens if $|\psi\rangle$ = $|0\rangle$ or $|\psi\rangle$ = $|1\rangle$ is passed as an input to two Hadamard gates in sequence?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11615" PostTypeId="2" ParentId="11614" CreationDate="2020-04-20T06:04:18.487" Score="2" Body="&lt;p&gt;The gist of it : If you act two H gates on the qubit you will cancel the rotations thereby obtaining the initial qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only pass one H gate then you have a superposition with a probability amplitude for each quantum state basis vector. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Longer explanation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just to illustrate this better I developed the first circuit with &lt;span class=&quot;math-container&quot;&gt;$\uparrow$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UATQZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UATQZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which will show the following state population distribution:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/051pA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/051pA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we add &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the circuit to bit flip &lt;span class=&quot;math-container&quot;&gt;$\uparrow$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\downarrow$&lt;/span&gt;, then we obtain the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XbfUd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XbfUd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a similar state population measured counts:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KX6Uc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KX6Uc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyway, the idea I want to hammer home with the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates is that, it's an unitary, so &lt;span class=&quot;math-container&quot;&gt;$HH = H^2 = I$&lt;/span&gt;. This is why if you were to operate two of them in sequence, you will get back the original qubit for the &lt;span class=&quot;math-container&quot;&gt;$\uparrow$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AU5hv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AU5hv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And for the &lt;span class=&quot;math-container&quot;&gt;$\downarrow$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j0BTX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j0BTX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, when you have time later on and if you are curious: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We start by defining this as the Clifford Group (of Gates): &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;G &amp;amp;=&amp;amp; \pm \Big \{ I, X, Y, Z \Big \}&#xA;\end{eqnarray}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This group is defined by the following properties:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Each &lt;span class=&quot;math-container&quot;&gt;$\mathbf{M} \in G$&lt;/span&gt; is unitary such that &lt;span class=&quot;math-container&quot;&gt;$M^\dagger = M^{-1}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For each element &lt;span class=&quot;math-container&quot;&gt;$\mathbf{M} \in G, M^2 = \pm I$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$\mathbf{M}^2 = I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{M}$&lt;/span&gt; is hermitian; otherwise, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{M}$&lt;/span&gt; is anti-hermitian.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\forall \, \mathbf{M_i}, \mathbf{M_j} \in G$&lt;/span&gt;, their products either commute or anti-commute, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{M_i}\mathbf{M_j} = \pm \mathbf{M_j}\mathbf{M_i}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;It turns out one can represent &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt{2}} \Big ( X + Z \Big )$&lt;/span&gt; operation. Thus it falls under these rules. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This stuff is really, really, powerful stuff!&lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-04-20T07:27:43.167" LastActivityDate="2020-04-20T07:27:43.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11616" PostTypeId="2" ParentId="11614" CreationDate="2020-04-20T06:58:37.943" Score="1" Body="&lt;p&gt;Hadamard gate is desribed by a matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you apply the Hadamard on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; you will have a superposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ 1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle).&#xA;$$&lt;/span&gt;&#xA;This superposition is denoted &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Application on &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; leads to a superposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ -1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle).&#xA;$$&lt;/span&gt;&#xA;This superposition is denoted &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hadamard gate is inverse to itself, i.e. &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt; (you can verify this by direct matrix multiplication). Hence &lt;span class=&quot;math-container&quot;&gt;$HH|0\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$HH|1\rangle = |1\rangle$&lt;/span&gt;, i.e. there is no change in input state. This can be generalized to any input state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$HH|\psi\rangle = |\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, concerning your particular problem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first case &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is returned after application of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; this means that input (B) had to be &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; is result of application of another &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, its input (A) had to be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second case &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is returned after application of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; this means that input (B) had to be &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is result of application of another &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, its input (A) had to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because a probability of measurement either state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is 50 % for both &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, you cannot distinguish &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; based only on probabilities, you also need phases (in plain words plus and minus before &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in the superpositions). Hence you need &quot;ket&quot; notatiton and not only probabilities.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-20T07:16:31.790" LastActivityDate="2020-04-20T07:16:31.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11617" PostTypeId="1" AcceptedAnswerId="11666" CreationDate="2020-04-20T09:15:59.500" Score="6" ViewCount="152" Body="&lt;p&gt;I've been working on &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google quantum supremacy paper&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;randomly&lt;/strong&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1910.11333&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supplementary information&lt;/a&gt; of the paper (part VII).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do they use a &lt;strong&gt;separate&lt;/strong&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please if you know where I can find the actual code of the simulation, mention that too. Thank you for your attention! &lt;/p&gt;&#xA;" OwnerUserId="10456" LastEditorUserId="55" LastEditDate="2020-04-21T09:05:15.857" LastActivityDate="2020-04-23T16:47:30.077" Title="What did exactly Google do in simulating a random quantum circuit on a classical computer in supremacy experiment?" Tags="&lt;simulation&gt;&lt;quantum-advantage&gt;&lt;google-sycamore&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11618" PostTypeId="2" ParentId="11606" CreationDate="2020-04-20T09:32:39.123" Score="2" Body="&lt;p&gt;I don't know if this will help. I have tried the code and it worked:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created a new file named &lt;code&gt;ccu1_circuit.qasm&lt;/code&gt; with the instruction written in the question. Then in a separate Python file, I have written:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;circuit = QuantumCircuit.from_qasm_file('/...The path.../ccu1_circuit.qasm')&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;print(execute(circuit, backend=backend, shots=1024).result().get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{'1000': 524, '0000': 500}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I noticed that when I tried to run &lt;code&gt;print(circuit.qasm())&lt;/code&gt; I have found &lt;code&gt;ccu1&lt;/code&gt; in the instructions (not its decomposition written in the &lt;code&gt;.qasm&lt;/code&gt; file). &lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-04-20T09:32:39.123" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11620" PostTypeId="1" AcceptedAnswerId="11621" CreationDate="2020-04-20T12:52:26.897" Score="3" ViewCount="167" Body="&lt;p&gt;How do we create an arbitrary vector of the following form in Qiskit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say, we want to initialize a qubit with a vector,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vert \psi \rangle = \frac{1+i}{\sqrt{3}}\vert 0 \rangle - \frac{i}{\sqrt{3}}\vert 1 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I put it in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vert \psi \rangle = \frac{1+i}{\sqrt{3}}\vert 0 \rangle - \frac{i}{\sqrt{3}}\vert 1 \rangle = cos(\frac{\theta}{2})|0&amp;gt; + e^{i\phi}sin(\frac{\theta}{2})|1&amp;gt;&#xA;$$&lt;/span&gt; where &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; \theta &amp;lt; \pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; \phi &amp;lt;2\pi$&lt;/span&gt;&#xA;and then calculate &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;cos(\frac{\theta}{2}) = \frac{1+i}{\sqrt{3}}\\&#xA;e^{i\phi}sin(\frac{\theta}{2}) = - \frac{i}{\sqrt{3}}&#xA;$$&lt;/span&gt;&#xA;Therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\theta = 2 * \arccos{\frac{1+i}{\sqrt{3}}} \\&#xA;\phi = i * ln(\frac{- \frac{i}{\sqrt{3}}}{sin(\frac{\theta}{2})})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I am using the following code..&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#We create the quantum state manually first&#xA;arb_quantum_state = ((1+1.j)/math.sqrt(3))*ket_0 - (1.j/math.sqrt(3))*ket_1&#xA;print(arb_quantum_state)&#xA;&#xA;theta = 2*cmath.acos((1+1.j)/cmath.sqrt(3))&#xA;print('theta : ',theta)&#xA;sinValue = cmath.sin(theta/2)&#xA;print(sinValue)&#xA;phase = -1*(1.j/cmath.sqrt(3))/sinValue&#xA;phi = cmath.log(phase)/1.j&#xA;print('phi : ',phi)&#xA;&#xA;# Use these theta and phi to create the circuit&#xA;circ = QuantumCircuit(1,1)&#xA;#Verify why complex values are not allowed&#xA;#circ.u3(theta.real,phi.real,0,0)&#xA;circ.u3(theta,phi,0,0)&#xA;&#xA;results = execute(circ, backend=Aer.get_backend('statevector_simulator')).result()&#xA;quantum_state = results.get_statevector(circ, decimals=3)&#xA;print (quantum_state)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above code creates the gate alright, but the execute function is returning the following error,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;TypeError: can't convert complex to float&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9201" LastActivityDate="2020-04-20T13:14:17.823" Title="How to create states in Qiskit using complex phase angles?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11621" PostTypeId="2" ParentId="11620" CreationDate="2020-04-20T13:14:17.823" Score="5" Body="&lt;p&gt;The problem is that you're trying to equate &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)$&lt;/span&gt; (a real number) with &lt;span class=&quot;math-container&quot;&gt;$(1+i)/\sqrt{3}$&lt;/span&gt; (a complex number). The way around this is you need to take into account a global phase &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\gamma}|\psi\rangle=\cos\frac{\theta}{2}|0\rangle+e^{i\phi}\sin\frac{\theta}{2}|1\rangle.&#xA;$$&lt;/span&gt;&#xA;To do this, it helps to express your initial state as complex exponentials:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\sqrt{\frac{2}{3}}e^{i\pi/4}|0\rangle+\frac{1}{\sqrt{3}}e^{i\pi/2}|1\rangle&#xA;$$&lt;/span&gt;&#xA;so that we can rewrite it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=e^{i\pi/4}\left(\sqrt{\frac{2}{3}}|0\rangle+\frac{1}{\sqrt{3}}e^{i\pi/4}|1\rangle\right).&#xA;$$&lt;/span&gt;&#xA;Now you can easily see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\frac{\theta}{2}=\sqrt{\frac{2}{3}},\qquad \phi=\frac{\pi}{4},\qquad \gamma=\frac{\pi}{4}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-20T13:14:17.823" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11622" PostTypeId="1" AcceptedAnswerId="11691" CreationDate="2020-04-20T16:27:50.297" Score="3" ViewCount="357" Body="&lt;p&gt;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. &lt;a href=&quot;https://i.stack.imgur.com/4n5gk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4n5gk.png&quot; alt=&quot;QPT for 2 qubit gate&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And I found this, the formula to find Chi matrix for 2-qubit gates. Then in the research paper&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308115&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measuring Controlled-NOT and two-qubit gate operation&lt;/a&gt; there is lucid explanation how to perform the QPT for two qubit gates following Nielsen's suggestion in his book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="8141" LastEditDate="2020-06-09T09:05:32.410" LastActivityDate="2021-05-03T08:48:46.820" Title="How to perform Quantum Process Tomography for three qubit gates?" Tags="&lt;quantum-gate&gt;&lt;nielsen-and-chuang&gt;&lt;density-matrix&gt;&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11623" PostTypeId="2" ParentId="11517" CreationDate="2020-04-20T17:20:15.340" Score="3" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_x |x\rangle|f(x)\rangle\ ,&#xA;$$&lt;/span&gt;&#xA;where the information about the solution is contained in &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt;. (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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-04-20T17:20:15.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11624" PostTypeId="2" ParentId="11580" CreationDate="2020-04-20T22:39:54.543" Score="6" Body="&lt;p&gt;Let me quote &lt;a href=&quot;https://physics.stackexchange.com/a/274739/4888&quot;&gt;my answer from over at physics.SE&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h3&gt;The intuition&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Let us consider a channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;, which we want to apply to a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.  (This could equally well be part of a larger system.) Now consider the following protocol for applying &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Denote the system of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Add a maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle=\tfrac{1}{\sqrt{D}}\sum_{i=1}^D|i,i\rangle$&lt;/span&gt; of the same dimension between systems &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/HeFkh.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now project systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/xgOey.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[This can be understood as a teleportation where we have only consider the &quot;good&quot; outcome, i.e., where we don't have to make a (generalized) Pauli correction on &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, see also the discussion.]&lt;br&gt;&#xA;Our intuition on teleportation (or a simple calculation) tells us that we now have the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in system &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/InKQn.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now we can apply the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, yielding the desired state &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)$&lt;/span&gt; in system &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VtzmB.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;However, steps 2 and 3 commute (2 acts on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and 3 acts on &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;), so we can interchange the ordering and replace 2+3 by 4+5:&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, which is the right part of &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/VAfJN.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This results in a state &lt;span class=&quot;math-container&quot;&gt;$\eta=(\mathbb I\otimes \mathcal E)&#xA;(|\omega\rangle\langle\omega|)$&lt;/span&gt;, which is nothing but the Choi state of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/OOW7c.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(This is the original step 3.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We can now carry out the original step 3: Project &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; onto &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/8peic.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Doing so, we obtain &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/C85vN.gif&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Steps 4 and 5 are exactly the Choi-Jamiolkowski isomorphism:  &lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Step 4 tells us how to obtain the Choi state &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt; for a channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;&lt;/li&gt;&#xA;  &lt;li&gt;Step 5 tells us how we can construct the channel from the state&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Going through the math readily yields the expression for obtaining &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\mathcal \eta$&lt;/span&gt; given in the question:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;\mathcal E(\rho) &amp;amp;= \langle \omega|_{AB}\rho_A\otimes \eta_{BC}|\omega\rangle_{AB}\\&#xA;&amp;amp; \propto \sum_{i,j} \langle i|\rho_A|j\rangle_{A} \langle i|_B\eta_{BC} |j\rangle_B \\&#xA;&amp;amp; = \mathrm{tr}_B[(\rho_B^T\otimes \mathbb I_C) \eta_{BC}]\ .&#xA;\end{align*}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Discussion&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt; of a gate &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; beforehand, and subsequently &quot;teleport through &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt;&quot;, 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 &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, we have implemented (for qubits) the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\sigma_k \cdot \sigma_k)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; is a  Pauli matrix, and generally &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; is a unitary. If we choose our gates carefully, they have &quot;nice&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Applications&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-04-20T22:39:54.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11626" PostTypeId="1" AcceptedAnswerId="11628" CreationDate="2020-04-21T01:01:21.787" Score="0" ViewCount="50" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11753" LastEditorUserId="5955" LastEditDate="2020-04-21T09:01:29.770" LastActivityDate="2020-04-21T09:01:29.770" Title="How to control the qubits in IBMQ" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11627" PostTypeId="1" CreationDate="2020-04-21T01:01:33.750" Score="2" ViewCount="75" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9vw4y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9vw4y.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$$\lvert \psi \rangle = \lvert q2q1q0\rangle $$&lt;/span&gt; with q2 being the most significant bit and q0 the least significant (matching the above schematic for the circuit).&lt;/p&gt;&#xA;&lt;p&gt;H matrix (for a single qbit): &lt;span class=&quot;math-container&quot;&gt;$$H = \frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand that I need to use the identity matrix &amp;amp; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M=(H\otimes I)\otimes I = &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{bmatrix}&#xA;I &amp;amp; 0 &amp;amp; I &amp;amp; 0\\&#xA;0 &amp;amp; I &amp;amp; 0 &amp;amp; I\\&#xA;I &amp;amp; 0 &amp;amp; -I &amp;amp; 0\\&#xA;0 &amp;amp; I &amp;amp; 0 &amp;amp; -I\\&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M=(I\otimes I)\otimes H = &#xA;\begin{bmatrix}&#xA;H &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; H &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; H &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; H\\&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;extension&amp;quot; of my gate's matrices and in which order I need to apply the Identity matrices in the tensor product?&lt;/p&gt;&#xA;" OwnerUserId="11750" LastEditorUserId="55" LastEditDate="2021-05-16T14:19:29.953" LastActivityDate="2021-05-16T14:19:29.953" Title="IBM quantum circuit - order of tensor product for equivalent matrix" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11628" PostTypeId="2" ParentId="11626" CreationDate="2020-04-21T01:10:22.947" Score="1" Body="&lt;p&gt;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: &lt;a href=&quot;https://github.com/Qiskit/qiskit-iqx-tutorials/blob/stable/0.15.x/qiskit/fundamentals/5_using_the_transpiler.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using the Transpiler&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shows you how to visually check which qubits you are using on a device&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-04-21T01:10:22.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11629" PostTypeId="2" ParentId="11627" CreationDate="2020-04-21T03:57:25.137" Score="0" Body="&lt;p&gt;Borrowing from Lenny's Paperback, you can value a product state as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;|\psi_1&amp;gt; &amp;amp;=&amp;amp; a|0&amp;gt; + b|1&amp;gt;\\&#xA;|\psi_1&amp;gt; &amp;amp;=&amp;amp; c|0&amp;gt; + d|1&amp;gt;\\&#xA;|\psi_3&amp;gt; &amp;amp;=&amp;amp; |\psi_1&amp;gt; \otimes \,|\psi_2&amp;gt; \\&#xA;|\psi_3&amp;gt; &amp;amp;=&amp;amp; ( a|0&amp;gt; + b|1&amp;gt;) \otimes ( c|0&amp;gt; + d|1&amp;gt;) \\&#xA;|\psi_3&amp;gt; &amp;amp;=&amp;amp; ac |0&amp;gt; \otimes |0&amp;gt; + ad |0 &amp;gt; \otimes |1&amp;gt; + bc |1&amp;gt; \otimes |0&amp;gt; + bd|1&amp;gt; \otimes |1&amp;gt;&#xA;\end{eqnarray}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using this logic into the operators:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;O &amp;amp;=&amp;amp; H \otimes I \otimes I \\&#xA;|\psi&amp;gt; &amp;amp;=&amp;amp; |q_1&amp;gt; \otimes |q_2 &amp;gt; \otimes|q_3&amp;gt; \\&#xA;O|\psi&amp;gt; &amp;amp;=&amp;amp; \Big (H \otimes I \otimes I \Big) |q_1&amp;gt; \otimes |q_2&amp;gt; \otimes|q_3&amp;gt; \\&#xA;O|\psi&amp;gt; &amp;amp;=&amp;amp; (H|q_1&amp;gt;)\otimes ( I|q_2&amp;gt; ) \otimes ( I|q_3 &amp;gt; )&#xA;\end{eqnarray}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if you want the other operator:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;O' &amp;amp;=&amp;amp; I \otimes I \otimes H \\&#xA;|\psi&amp;gt; &amp;amp;=&amp;amp; |q_1&amp;gt; \otimes |q_2 &amp;gt; \otimes|q_3&amp;gt; \\&#xA;O|\psi&amp;gt; &amp;amp;=&amp;amp; \Big (I \otimes I \otimes H \Big) |q_1&amp;gt; \otimes |q_2&amp;gt; \otimes|q_3&amp;gt; \\&#xA;O|\psi&amp;gt; &amp;amp;=&amp;amp; (I |q_1&amp;gt;)\otimes ( I|q_2&amp;gt; ) \otimes ( H|q_3 &amp;gt; )&#xA;\end{eqnarray}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;" OwnerUserId="6253" LastActivityDate="2020-04-21T03:57:25.137" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11631" PostTypeId="1" AcceptedAnswerId="11633" CreationDate="2020-04-21T04:26:27.850" Score="2" ViewCount="173" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\overline{p}$&lt;/span&gt; be a probability distribution on &lt;span class=&quot;math-container&quot;&gt;$\{1,....,d\}$&lt;/span&gt;. Then let &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_ip_i|i\rangle\langle i| \otimes \rho_i$&lt;/span&gt;. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How should I take the Von-Neumann entropy of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;? I know that Von-Neumann entropy is additive under the tensor product. So &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;How can I break this down further? My goal is to prove &lt;span class=&quot;math-container&quot;&gt;$S(\rho) = S(\overline{p}) + \sum _i p_iS(\rho_i)$&lt;/span&gt; but I would just like help on how to work with the two terms I've broken &lt;span class=&quot;math-container&quot;&gt;$S(\rho)$&lt;/span&gt; into&lt;/p&gt;&#xA;" OwnerUserId="11647" LastEditorUserId="55" LastEditDate="2020-10-12T21:27:03.810" LastActivityDate="2020-10-12T21:27:03.810" Title="What is the Von Neumann entropy of $\rho = \sum_ip_i|i\rangle\langle i| \otimes \rho_i$?" Tags="&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11633" PostTypeId="2" ParentId="11631" CreationDate="2020-04-21T07:23:25.120" Score="6" Body="&lt;p&gt;Operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is not a tensor product, it's a sum of tensor products&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&#xA;This is not the same as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\big(\sum_ip_i|i\rangle\langle i|\big) \otimes \big(\sum_i\rho_i\big),&#xA;$$&lt;/span&gt;&#xA;so your expansion isn't correct. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also in general &lt;span class=&quot;math-container&quot;&gt;$S(A+B)\neq S(A)+S(B)$&lt;/span&gt;, but in this situation the supports of &lt;span class=&quot;math-container&quot;&gt;$|i \rangle\langle i|\otimes \rho_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|j \rangle\langle j|\otimes \rho_j$&lt;/span&gt; are orthogonal, so we can write &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho) = S(p_1|1\rangle\langle 1| \otimes \rho_1) + \dots + S(p_d|d\rangle\langle d| \otimes \rho_d) &#xA;$$&lt;/span&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$p_i|1\rangle\langle 1| \otimes \rho_i$&lt;/span&gt; is not a density matrix because it's scaled, i.e. its trace equals &lt;span class=&quot;math-container&quot;&gt;$p_i&amp;lt;1$&lt;/span&gt;, so technically &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is not defined. But for such matrices we also can define expression &lt;span class=&quot;math-container&quot;&gt;$S(M) = -\sum_i \lambda_i\text{ln}\lambda_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. It's easy to check that for &lt;span class=&quot;math-container&quot;&gt;$c&amp;gt;0$&lt;/span&gt; and density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$S(c\rho) = cS(\rho) - c\text{ln}c$&lt;/span&gt;. So we can write &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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 = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= 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&#xA;$$&lt;/span&gt;&#xA;After the summation we will have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho) =  \sum _i p_iS(\rho_i) - \sum_ip_i\text{ln}p_i = \sum _i p_iS(\rho_i) + S(\overline{p}) &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-04-21T07:23:25.120" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11634" PostTypeId="1" AcceptedAnswerId="11635" CreationDate="2020-04-21T10:07:42.763" Score="1" ViewCount="96" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="6244" LastActivityDate="2020-04-21T12:17:24.113" Title="How to get QASM code from IBMQ experience" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11635" PostTypeId="2" ParentId="11634" CreationDate="2020-04-21T10:57:05.907" Score="3" Body="&lt;p&gt;On the results tab, above the circuit diagram, there is an option to see the QASM code&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rirae.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rirae.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;[EDIT]&lt;/strong&gt; 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 &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;result = backend.retrieve_job('job id')&#xA;qob = result.qobj()&#xA;&#xA;from qiskit.assembler import disassemble&#xA;jobs = disassemble(qob)&#xA;qc = jobs[0][0]&#xA;&#xA;qc.qasm()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2020-04-21T12:17:24.113" LastActivityDate="2020-04-21T12:17:24.113" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11636" PostTypeId="1" AcceptedAnswerId="11638" CreationDate="2020-04-21T13:29:36.177" Score="3" ViewCount="53" Body="&lt;p&gt;Recently I was reading about the projective measurement in &amp;quot;Quantum Computation and Quantum Information&amp;quot; by Nielsen &amp;amp; Chuang, where they describe the projective measurement as follows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Projective measurements: A projective measurement is described by an observable, &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, a Hermitian operator on the state space of the system being observed. The observable has a spectral decoomposition,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \sum_m m P_m, $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is the projector onto the eigenspace of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. The possible outcomes of the measurement correspond to the eigenvalues, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, of the observable. [...]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Usually, while conducting a measurement on a qubit we are using two projectors, namely &lt;span class=&quot;math-container&quot;&gt;$P_0 = |0\rangle \langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1 = |1\rangle \langle 1 |$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For the case of &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; we have two possible eigenvalues:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 0 \end{pmatrix}$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;1, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In the case of &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; we have simmilar eigenvalues:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 0 \end{pmatrix}$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;1, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$M = \sum_m m P_m$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$m = \{0,1\}$&lt;/span&gt;, we would get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = 0 \cdot P_0 + 1 \cdot P_1 = P_1,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which I think is incorrect.&lt;/p&gt;&#xA;&lt;p&gt;Because of that, isn't the formulation of an observable as &lt;span class=&quot;math-container&quot;&gt;$M = \sum_m m P_m$&lt;/span&gt; a little bit misleading? Shouldn't it be defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \sum_m \lambda_m P_m,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_m$&lt;/span&gt; is the eigenvalue associated to the appropriate state? Then we would get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \lambda_0 P_0 + \lambda_1 P_1 = 1 \cdot P_0 + 1 \cdot P_1 = \mathbf{I}. $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2098" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-04-21T13:39:38.633" Title="Help in understanding the usage of eigenvalues in the definition of the projective measurement" Tags="&lt;measurement&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11637" PostTypeId="1" AcceptedAnswerId="11641" CreationDate="2020-04-21T13:35:35.897" Score="2" ViewCount="69" Body="&lt;p&gt;Usually, while conducting a measurement on a qubit we are using two projectors, namely &lt;span class=&quot;math-container&quot;&gt;$P_0 = |0\rangle \langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1 = |1\rangle \langle 1 |$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the case of &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; we have two possible eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 0 \end{pmatrix}$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;1, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;In the case of &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; we have simmilar eigenvalues:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;0, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 0 \end{pmatrix}$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;1, with eigenvector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I guess, that due to the noralization condition we cannot obtain the &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 0 \end{pmatrix}$&lt;/span&gt; states. So the only possible outcomes of a measurement are states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; both with eigenvalue 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what is the interpretation of this eigenvalue? Is it something like the &quot;amount of information&quot; stored in a qubit?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastActivityDate="2020-04-22T13:27:01.560" Title="What's the interpretation of the eigenvalues of qubit's projective operators?" Tags="&lt;measurement&gt;&lt;projection-operator&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11638" PostTypeId="2" ParentId="11636" CreationDate="2020-04-21T13:39:38.633" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$M=Z$&lt;/span&gt;, the standard Pauli matrix. &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z=P_+-P_-,&#xA;$$&lt;/span&gt;&#xA;and we associate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_+=|0\rangle\langle 0|,\qquad P_-=|1\rangle\langle 1|.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;. However, what the operator is essentially telling you is &quot;your measurement device will give you an answer either +1 or -1, and these are the corresponding projectors&quot; and so the meaning is sensible and consistent across all observables you might choose.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-21T13:39:38.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11640" PostTypeId="1" AcceptedAnswerId="11644" CreationDate="2020-04-21T14:25:23.530" Score="1" ViewCount="69" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;HT circuit (Hadmard+ Toffoli)&quot;. However, they don't tell me how to simulate a Hadmard gate and how to simulate the entangled state after Hadmard gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dw4ON.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dw4ON.jpg&quot; alt=&quot;at&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="9006" LastEditDate="2020-04-22T07:27:07.050" LastActivityDate="2020-04-22T08:00:19.300" Title="A question about quantum circuit simulation on PC" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11641" PostTypeId="2" ParentId="11637" CreationDate="2020-04-21T14:59:32.660" Score="2" Body="&lt;p&gt;The eigenvalues are just labels for the outcomes of the measurement. They don't necessarily have any physical meaning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;https://physics.stackexchange.com/a/264439/52363&quot;&gt;this answer&lt;/a&gt; for a more detailed understanding.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-04-21T14:59:32.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11642" PostTypeId="2" ParentId="11637" CreationDate="2020-04-21T15:23:38.513" Score="1" Body="&lt;p&gt;Projectors have eigenvalues 0 and 1 by definition. There's nothing more to interpret here...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that the projectors have eigenvectors of 0 eigenvalue which are non-trivial, which are orthogonal to the eigenvectors with eigenvalue 1.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-21T15:23:38.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11643" PostTypeId="2" ParentId="50" CreationDate="2020-04-21T21:14:53.303" Score="3" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If the circuit does not generate entanglement, classical simulation is linear.&lt;/li&gt;&#xA;&lt;li&gt;If the circuit can be partitioned such that no qubits in one section are entangled with any other section, classical simulation is &lt;span class=&quot;math-container&quot;&gt;$2^{m}$&lt;/span&gt; where m is the number of qubits in the largest section.&lt;/li&gt;&#xA;&lt;li&gt;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).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 * &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 48 qubits that would be: 8 bytes * &lt;span class=&quot;math-container&quot;&gt;$2^{48}$&lt;/span&gt; = 2 petabytes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For 64 qubits that would be: 8 bytes * &lt;span class=&quot;math-container&quot;&gt;$2^{64}$&lt;/span&gt; = 131,072 petabytes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11769" LastActivityDate="2020-04-21T21:14:53.303" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11644" PostTypeId="2" ParentId="11640" CreationDate="2020-04-22T08:00:19.300" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;https://se.mathworks.com/matlabcentral/fileexchange/73035-quantum-computer-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;simulator I implemented in MatLab&lt;/a&gt;. In this simulator I assume no noise, i.e. ideal quantum computer is simulated and returned results follow a theory.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of type &lt;span class=&quot;math-container&quot;&gt;$N \,\text{x}\, N$&lt;/span&gt; and quantum state by complex unit vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in\mathbb{C}^N$$|\,|\psi\rangle\,| = 1$&lt;/span&gt;). Note that &lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is a number of qubits involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, lets look at matrix representation of Hadamard gate you are looking for:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is many gates in quantum computing, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;this list&lt;/a&gt; for their matrix representation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Acting of quantum gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is described by matrix multiplication, i.e. &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, lets have a qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix}1\\0\end{pmatrix}$&lt;/span&gt; and apply Hadamard gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|0\rangle = \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;\begin{pmatrix}1\\0\end{pmatrix}&#xA;=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}1\\1\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now your qubit is in superposition of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To produce entangled state, you need controlled gate, for example CNOT (controlled NOT) acting on two qubits. This gate is descibed by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT} = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The gate negate second qubit (so-called target qubit) in case the first qubit (control qubit) is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; otherwise it does nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of simple circuit (&lt;em&gt;note: the figure was taken from Wiki&lt;/em&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KNfgk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KNfgk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;nothing&lt;/em&gt; means there is a identity operator described by unit matrix &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. This step of algorithm is expressed as&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \otimes I = &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;=\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the symbol &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; means &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor product&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT} (H \otimes I)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix}1 \\0\\0\\0\end{pmatrix}$&lt;/span&gt;, i.e. both input qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Hence we have&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT}(H \otimes I)|00\rangle =&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1\\0\\0\\1&#xA;\end{pmatrix}&#xA;=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1\\0\\0\\0&#xA;\end{pmatrix}+\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;0\\0\\0\\1&#xA;\end{pmatrix}=&#xA;\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After measurement, the output state will be either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, both with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$\Big(\frac{1}{\sqrt{2}}\Big)^2 = \frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-22T08:00:19.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11645" PostTypeId="1" CreationDate="2020-04-22T08:46:22.763" Score="3" ViewCount="80" Body="&lt;p&gt;In  &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;supremacy paper&lt;/a&gt; and part D of section VII of &lt;a href=&quot;https://arxiv.org/abs/1910.11333&quot; rel=&quot;nofollow noreferrer&quot;&gt;supplementary information&lt;/a&gt; (below), it is said that there is a pseudo-random number generator that is initialized with a seed called &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;; And then the single-qubit gates are selected from the set of three gates &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X} , \sqrt{Y},\sqrt{W}$&lt;/span&gt; according to this random number. &lt;/p&gt;&#xA;&#xA;&lt;h2&gt;D. Randomness&lt;/h2&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Single-qubit gates in every cycle are chosen randomly&#xA;  using a pseudo-random number generator (PRNG). The&#xA;  generator is initialized with a seed s which is the third&#xA;  parameter for our family of RQCs. The single-qubit gate&#xA;  applied to a particular qubit in a given cycle depends onlyon s. Consequently, two RQCs with the same s apply the&#xA;  same single-qubit gate to a given qubit in a given cycle&#xA;  as long as the qubit and the cycle belong in both RQCs&#xA;  as determined by their size n and depth m parameters.&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Conversely, the choice of single-qubit gates is the sole&#xA;  property of our RQCs that depends on s. In particular,&#xA;  the same two-qubit gate is applied to a given qubit pair&#xA;  in a given cycle by all RQCs that contain the pair and&#xA;  the cycle.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and in part E:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Single-qubit gates in the first cycle are chosen independently&#xA;  and uniformly at random from the set of the three gates above. In subsequent cycles, each single-qubit&#xA;  gate is chosen independently and uniformly at random&#xA;  from among the gates above except the gate applied to&#xA;  the qubit in the preceding cycle. This prevents simplifications of some simulation paths in SFA. Consequently,&#xA;  there are &lt;span class=&quot;math-container&quot;&gt;$3^n2^{nm}$&lt;/span&gt; possible random choices for a RQC with&#xA;  n qubits and m cycles.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What I understand from the experiment and this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8342/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;answer&lt;/a&gt; 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 (&lt;span class=&quot;math-container&quot;&gt;$e.g. |{10010101..10&amp;gt;}$&lt;/span&gt;) is obtained. Now we are repeating the experiment for many times again and again in exactly the same way and &lt;strong&gt;with exactly the same circuit&lt;/strong&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; to the previous value. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://phsites.technion.ac.il/qst2019/wp-content/uploads/sites/50/2019/09/Pedram_Roushan_Lecture3_Supramacy_Technion_Summer_School_20191.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture note&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yxHNt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yxHNt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and in the caption of this picture it's said:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Lastly, we measure the state of every qubit. The measurement is repeated many times&#xA;  in order to estimate the probability of each output state. Here, we plot the measured probabilities for two instances after 10&#xA;  coupler pulses (cycles).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Now my question is, why do we use random numbers at all when we actually have to measure the output of the &lt;strong&gt;same&lt;/strong&gt; circuit many times? Why don't we choose single-qubits gates according to a pattern like two-qubit gates?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;cycle&lt;/strong&gt; 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 &lt;strong&gt;same&lt;/strong&gt; circuit (&lt;strong&gt;same&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;) to verify the experiment?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is not the case, and each time after a measurement and obtaining a ket consisting of zeros and ones &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What role does this randomness play in making things difficult? When it is practically &lt;strong&gt;&lt;em&gt;pseudo&lt;/em&gt;&lt;/strong&gt;-random and therefore structured, and by knowing &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; (the seed) you can get the rest of the numbers, because according to this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8342/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;answer&lt;/a&gt;, 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8337/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;answer&lt;/a&gt; but I don't quite understand)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the last question is, what does &lt;strong&gt;instance&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="10456" LastEditorUserId="10456" LastEditDate="2020-04-22T08:59:40.377" LastActivityDate="2020-04-24T00:05:21.207" Title="What is the role of choosing the single-qubits randomly in Google quantum supremacy experiment?" Tags="&lt;quantum-advantage&gt;&lt;google-sycamore&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11646" PostTypeId="2" ParentId="10258" CreationDate="2020-04-22T11:02:17.963" Score="-1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system also printed the following probabilities:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_{00} = 0.7094002059173512$&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_{01} = 0.13724355108492148$&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_{10} = 0.12849669756020887$&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_{11} = 0.024859516013751914$&lt;/span&gt; &lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability to observe qubit 0 (indexing right to left) in state 0: &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$ E_{q0} = 0.8378969 = 0.7094002 + 0.1284966 = P_{00} + P_{10}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To answer the question &quot;How can I use expectation_from_wavefunction to obtain the probabilities of observing the individual states&quot;: you can't. You can only relate this particular expectation value (with Pauli Z) to a &lt;strong&gt;set&lt;/strong&gt; of state probabilities, but not to individual ones without extra information (such as observables in different computational basis)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;Why would I favor this approach&quot;: access to the internal quantum state is not realistic with quantum system, and would require more computation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="2794" LastEditorUserId="2794" LastEditDate="2020-04-22T11:08:03.440" LastActivityDate="2020-04-22T11:08:03.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11647" PostTypeId="1" CreationDate="2020-04-22T13:26:32.063" Score="1" ViewCount="345" Body="&lt;p&gt;I have been trying to run a circuit on &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;. But the result shows &lt;code&gt;ERROR_RUNNING_JOB&lt;/code&gt;. The run status says:&#xA;&lt;code&gt;'Circuit runtime is greater than the device repetition rate [8020]'.&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here are a few circuit details:&lt;/p&gt;&#xA;&lt;p&gt;Size (total number of gates): 14137&lt;br /&gt;&#xA;Depth: 7836&lt;br /&gt;&#xA;Qubits: 14&lt;br /&gt;&#xA;Shots: 64&lt;/p&gt;&#xA;&lt;p&gt;Gate count: &lt;code&gt;[('u1', 7506), ('cx', 5850), ('u2', 678), ('x', 73), ('cswap', 18), ('h', 6), ('measure', 6)]&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;It runs fine on the &lt;code&gt;qasm_simulator&lt;/code&gt;. I could not find how to deal with this kind of error. Can some tell what does it mean and how to fix it?&lt;/p&gt;&#xA;" OwnerUserId="11777" LastEditorUserId="104" LastEditDate="2020-11-29T14:46:06.880" LastActivityDate="2020-11-29T14:46:06.880" Title="Error while running the circuit on a real device on IBMQ" Tags="&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11648" PostTypeId="2" ParentId="11637" CreationDate="2020-04-22T13:27:01.560" Score="0" Body="&lt;p&gt;If you think of a projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; as representing a kind of &quot;yes/no&quot; question you can ask to a state, you can understand the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s as marking the eigenstates (more precisely, the eigenspace) corresponding to the &quot;yes&quot; answer.&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace of the projector (i.e. &lt;span class=&quot;math-container&quot;&gt;$\ker(P-I)$&lt;/span&gt;), or you don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;s where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for a projector, some other &lt;span class=&quot;math-container&quot;&gt;$\lambda\neq\mu$&lt;/span&gt; for another operator).&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-04-22T13:27:01.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11649" PostTypeId="2" ParentId="11647" CreationDate="2020-04-22T14:58:39.863" Score="3" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;execute(your_circuit, backend, optimization_level=3)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Alternatively, you can continue running the circuit on the simulator, but add a &lt;code&gt;NoiseModel&lt;/code&gt; to make it more like a run on a real device. There is more information about how to do that &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastEditorUserId="5955" LastEditDate="2020-04-26T13:16:35.997" LastActivityDate="2020-04-26T13:16:35.997" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11650" PostTypeId="1" CreationDate="2020-04-22T23:32:01.600" Score="3" ViewCount="142" Body="&lt;p&gt;I'm trying to find a way to check if a given quantum circuit is essentially a classical one (up to changes in phase). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a description of a quantum circuit by a list (of size &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;) of ordered operations of Hadamard gates and Toffoli gates (i.e, specifying the specific qubits on which they are operated) operating on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, is there an &lt;strong&gt;efficient&lt;/strong&gt; (polynomial in &lt;span class=&quot;math-container&quot;&gt;$l,n$&lt;/span&gt;) algorithm that finds whether the computation of the circuit on a quantum state which is not a superposition? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is, check if for &lt;span class=&quot;math-container&quot;&gt;$\forall x \in\{0,1\}^n \  \exists y\in\{0,1\}^n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|x⟩=|y⟩$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that is represented by the given list. &lt;/p&gt;&#xA;" OwnerUserId="11782" LastEditorUserId="11782" LastEditDate="2020-04-23T07:34:29.497" LastActivityDate="2020-05-23T22:00:20.267" Title="How to check if a quantum circuit is deterministic?" Tags="&lt;quantum-gate&gt;&lt;complexity-theory&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="10" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11651" PostTypeId="1" AcceptedAnswerId="11655" CreationDate="2020-04-23T00:59:39.520" Score="3" ViewCount="162" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&#xA;In &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; the authors make the following statement &quot;[G]iven any basis states &lt;span class=&quot;math-container&quot;&gt;$\ket{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{b}$&lt;/span&gt; for a qubit, it is possible to express an arbitrary state as a linear combination &lt;span class=&quot;math-container&quot;&gt;$\alpha\ket{a} + \beta\ket{b}$&lt;/span&gt; of those states.&quot; They go on to say that if the states are orthonormal, then one can perform a measurement with respect to the &lt;span class=&quot;math-container&quot;&gt;$\ket{a}\!, \ket{b}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is does this imply that any two distinct pure states &lt;span class=&quot;math-container&quot;&gt;$\ket{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{b}$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I attempted to try to transform the state defined by &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} = \frac{\sqrt{2 + \sqrt{2}}}{2}\ket{0} + \frac{\sqrt{2 - \sqrt{2}}}{2}\ket{1}$&lt;/span&gt; into the basis &lt;span class=&quot;math-container&quot;&gt;$\{\ket{0}\!, \ \ket{+}\}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\ket{+} = \frac{\ket{0} + \ket{1}}{\sqrt{2}}$&lt;/span&gt;. I obtained the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\begin{align*}&#xA;\ket{\psi} &amp;amp;=  \alpha\ket{0} + \beta\ket{1} = \alpha\ket{0} + \beta(\sqrt{2}\ket{+}-\ket{0}) = (\alpha - \beta)\ket{0} + \sqrt{2}\beta\ket{+}\\ &#xA;&amp;amp;= \frac{ \sqrt{2+\sqrt{2}} - i\sqrt{2-\sqrt{2}} }{2}\ket{0} + \frac{i\sqrt{2}\sqrt{2 - \sqrt{2}}}{2} \ket{+}&#xA;\end{align*}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the requirement that the basis be orthonormal in order to perform a measurement with respect to it implies that such bases exist,&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="11742" LastActivityDate="2020-04-23T10:05:41.930" Title="Do any two distinct pure states form a basis?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11652" PostTypeId="1" AcceptedAnswerId="11658" CreationDate="2020-04-23T04:32:34.273" Score="0" ViewCount="132" Body="&lt;p&gt;I am running my old &lt;code&gt;qiskit&lt;/code&gt; code after a very long time it's not running now showing error &lt;code&gt;wrong color format 'ansibrightred'&lt;/code&gt; and I don't know why?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;&#xA;circuit = QuantumCircuit(2,2)&#xA;circuit.h(0)&#xA;circuit.cx(0,1)&#xA;circuit.measure([0,1], [0,1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="5955" LastEditDate="2020-04-23T08:03:42.373" LastActivityDate="2020-04-28T19:33:34.533" Title="AssertionError: wrong color format 'ansibrightred'" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11653" PostTypeId="2" ParentId="11651" CreationDate="2020-04-23T05:21:21.443" Score="0" Body="&lt;p&gt;I will start by saying that if you have a vector space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; with dim &lt;span class=&quot;math-container&quot;&gt;$V = N$&lt;/span&gt;, then this space is spanned by a basis comprised of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|a\rangle, |b\rangle$&lt;/span&gt;, standing for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt; can form the basis for the 2-level system. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am a bit confused on the statement regarding mapping &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{B} =\{ |0\rangle , |1\rangle\}$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{B'} =\{ |+\rangle , |- \rangle \}$&lt;/span&gt;. My understanding is that in order to map your original basis into this new basis you need &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate applied to your qubit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Provided: &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{eqnarray}&#xA;H|0\rangle &amp;amp;=&amp;amp; |+\rangle \\&#xA;H|1\rangle &amp;amp;=&amp;amp; |-\rangle \\&#xA;H \Big ( \alpha|0\rangle + \beta |1\rangle \Big ) &amp;amp;=&amp;amp; \alpha H|0\rangle + \beta H|1\rangle\\&#xA;H |\psi\rangle &amp;amp;=&amp;amp; \alpha |+\rangle + \beta |-\rangle &#xA;\end{eqnarray}&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that &lt;span class=&quot;math-container&quot;&gt;$ |+\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}, |-\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; you can see that given that the initial basis was indeed orthonormal, so is this new basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which is to say, I am not sure you can just change old basis for the new basis &lt;em&gt;without&lt;/em&gt; applying the rotation which effectively does that change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;But of course, I can be wrong.&lt;/em&gt; &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="9006" LastEditDate="2020-04-23T10:05:41.930" LastActivityDate="2020-04-23T10:05:41.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11654" PostTypeId="2" ParentId="11651" CreationDate="2020-04-23T06:51:37.377" Score="2" Body="&lt;p&gt;Generally set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; linearly indepedent vectors forms basis of a space with dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. However, in QC the basis has to be orthonormal to be able to distinguish basis states in a measurement and to have fulfilled condition &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^n|x_i|^2=1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; is a vector member.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-23T06:51:37.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11655" PostTypeId="2" ParentId="11651" CreationDate="2020-04-23T07:16:26.100" Score="4" Body="&lt;p&gt;Your statements about bases are correct. &lt;em&gt;For a qubit&lt;/em&gt;, 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.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, a comment about the term &quot;distinct&quot;. Are states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{|0\rangle+|1\rangle}{\sqrt{2}},\qquad{\text{and}}\qquad \frac{1+i}{2}|0\rangle+\frac{1+i}{2}|1\rangle&#xA;$$&lt;/span&gt;&#xA;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 &lt;em&gt;up to an irrelevant global phase&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. I would like to express it in terms of two basis states &lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle$&lt;/span&gt; which are not orthogonal. To help, I can define a state &lt;span class=&quot;math-container&quot;&gt;$|\phi^\perp\rangle$&lt;/span&gt; which is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle$&lt;/span&gt;. This means that I can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\alpha|\phi_0\rangle+\beta|\phi^\perp\rangle&#xA;$$&lt;/span&gt;&#xA;and also&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_1\rangle=\gamma|\phi_0\rangle+\delta|\phi^\perp\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\delta\neq 0$&lt;/span&gt;. So we can trivially substitute&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\alpha|\phi_0\rangle+\frac{\beta}{\delta}\left(|\phi_1\rangle-\gamma|\phi_0\rangle\right),&#xA;$$&lt;/span&gt;&#xA;and hence we can always express &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle$&lt;/span&gt;, as desired, and this is a perfectly valid way to decompse the state. Your case of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is the perfect example of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;projective measurements&lt;/em&gt; but if you were using POVMs, for example, the most natural basis could well be non-orthogonal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-23T07:16:26.100" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11656" PostTypeId="1" AcceptedAnswerId="11657" CreationDate="2020-04-23T11:02:29.423" Score="3" ViewCount="46" Body="&lt;p&gt;A qubit &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle \in \mathcal{H}^2$&lt;/span&gt;. A more general form of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubits is an element in &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{H}^{\otimes 2^{n}} = &#xA;\underbrace{\mathcal{H}^2\otimes\mathcal{H}^2\otimes\ldots\otimes\mathcal{H}^2}_{n \text{ times}}.$$&lt;/span&gt;&#xA;Is it possible to have a qubit to be in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}^{\otimes 2^{n}+1}$&lt;/span&gt; &lt;em&gt;i.e.&lt;/em&gt; in an odd dimension?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-04-23T11:15:19.237" Title="Can a qubit live in $\mathcal{H}^{\otimes 2^{n}+1}$?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11657" PostTypeId="2" ParentId="11656" CreationDate="2020-04-23T11:15:19.237" Score="7" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-23T11:15:19.237" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11658" PostTypeId="2" ParentId="11652" CreationDate="2020-04-23T11:17:00.350" Score="3" Body="&lt;p&gt;That error is caused by running qiskit-terra 0.13.0 with pygments installed, but below the optional dependency minimum version of &lt;code&gt;2.4&lt;/code&gt;: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/setup.py#L117&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/setup.py#L117&lt;/a&gt;. However, you've found a bug in terra, an error should only be shown if you are using the optional functionality (&lt;code&gt;circuit.qasm()&lt;/code&gt; with &lt;code&gt;formatted=True&lt;/code&gt; set or using the circuit library jupyter widget). I've pushed up a fix to address this edge case in: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/4229&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/4229&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the meantime while waiting for that to get into a release, you can workaround this issue by either installing pygments&gt;=2.4 or uninstalling pygments. Either will fix the error.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastEditorUserId="5529" LastEditDate="2020-04-23T12:14:09.953" LastActivityDate="2020-04-23T12:14:09.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11659" PostTypeId="1" AcceptedAnswerId="11661" CreationDate="2020-04-23T11:28:14.690" Score="1" ViewCount="64" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The SAT formula is &lt;span class=&quot;math-container&quot;&gt;$(x_1 \vee x_2) \wedge (x_2 \vee x_3)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aeuNC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aeuNC.png&quot; alt=&quot;result&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10192" LastEditorUserId="9006" LastEditDate="2020-04-23T13:33:22.923" LastActivityDate="2020-04-23T14:50:51.113" Title="Results of SAT on the Qiskit simulator" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11660" PostTypeId="1" CreationDate="2020-04-23T11:56:47.057" Score="1" ViewCount="34" Body="&lt;p&gt;I want to implement this thing: &#xA;&lt;code&gt;Operator([[3, Pauli([1,0,0], [0,0,0])], [2, Pauli([0,0,0],[0,0,3])]])&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But while doing this there is an error in &lt;code&gt;&quot;qiskit.aqua.operator&quot;&lt;/code&gt; &#xA;How can we fix this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The main problem is to run this notebook completely without any error:&#xA;&lt;a href=&quot;https://gitlab.com/qosf/qml-mooc/-/blob/master/qiskit_version/07_Variational_Circuits.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gitlab.com/qosf/qml-mooc/-/blob/master/qiskit_version/07_Variational_Circuits.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If anybody had able to complete this notebook then my all doubts would be cleared.&lt;/p&gt;&#xA;" OwnerUserId="11790" LastEditorUserId="5955" LastEditDate="2020-04-23T12:32:17.780" LastActivityDate="2020-04-23T12:32:17.780" Title="Error in qiskit.aqua.operator" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11661" PostTypeId="2" ParentId="11659" CreationDate="2020-04-23T13:43:32.437" Score="3" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that even the simulator on IBM Q generates some &lt;em&gt;noise&lt;/em&gt; because of finite precision of the simulator. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Overall, there is no mistake.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-23T14:50:51.113" LastActivityDate="2020-04-23T14:50:51.113" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11662" PostTypeId="2" ParentId="11650" CreationDate="2020-04-23T13:46:34.857" Score="0" Body="&lt;p&gt;Following up on @Martin's suggestions, there might be a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; algorithm to test for what you want, as long as you allow for your input circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be only &quot;close to&quot; a classical permutation matrix, that is, &quot;close to&quot; having a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in each row/column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, let &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert y\rangle$&lt;/span&gt; be computational basis states, and let &lt;span class=&quot;math-container&quot;&gt;$\vert w\rangle$&lt;/span&gt; be some monkey state (perhaps also in superposition).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have &lt;span class=&quot;math-container&quot;&gt;$U\vert x\rangle=\alpha\vert y\rangle+\beta\vert w\rangle$&lt;/span&gt;.  As long as &lt;span class=&quot;math-container&quot;&gt;$\alpha^2\gg\beta^2$&lt;/span&gt; for each computational basis, we can choose random computational basis &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt;, apply &lt;span class=&quot;math-container&quot;&gt;$U\vert x\rangle$&lt;/span&gt;, and measure a small number of times.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we always measure the same &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; for the same input &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt;, and never &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, then we can conclude, at least for that basis state &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt;, that &lt;span class=&quot;math-container&quot;&gt;$\alpha^2\gg \beta^2$&lt;/span&gt;; that is, the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; row of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has a single &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; at the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; column.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can repeat to amplify, by choosing another basis state.  I don't think we need to explore a lot of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; states to get some confidence that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is effectively a permutation matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-04-23T13:46:34.857" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11663" PostTypeId="1" AcceptedAnswerId="11665" CreationDate="2020-04-23T14:09:57.277" Score="2" ViewCount="677" Body="&lt;p&gt;According to paper &lt;a href=&quot;https://www.researchgate.net/publication/235702677_Ising_formulations_of_many_NP_problems&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising formulations of many NP problems&lt;/a&gt; an unconstrained quadratic programming problem&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x_1, x_2,\dots, x_n) = \sum_{i}^N h_ix_i + \sum_{i &amp;lt; j} J_ix_ix_j&#xA;$$&lt;/span&gt;&#xA;can be expressed as Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(x_1, x_2,\dots, x_n) = -\sum_{i}^N h_i\sigma^z_i - \sum_{i &amp;lt; j} J_i\sigma^z_i\sigma^z_j,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma^z_i$&lt;/span&gt; is Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate applied on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit whereas other qubits are left without change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to prepare Hamiltonian for simple function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x_1,x_2) = 5x_1+x_2-2x_1x_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = -(5 Z \otimes I + I \otimes Z - 2 Z \otimes Z) = \text{diag}(-4,-6,2,8).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the minimal eigenvalue is -6 and associated ground state is &lt;span class=&quot;math-container&quot;&gt;$|01\rangle = (0, 1, 0, 0)^T$&lt;/span&gt; which is correct as &lt;span class=&quot;math-container&quot;&gt;$f(x_1,x_2)$&lt;/span&gt; minimal value is 1 for &lt;span class=&quot;math-container&quot;&gt;$x_1 = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I changed &lt;span class=&quot;math-container&quot;&gt;$-2x_1x_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-7x_1x_2$&lt;/span&gt; and the Hamiltonian changed to &lt;span class=&quot;math-container&quot;&gt;$\text{diag}(1,-11,-3,13)$&lt;/span&gt;, the ground state remainded &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, however, in this case the function has minimum in &lt;span class=&quot;math-container&quot;&gt;$x_1 = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_2 = 1$&lt;/span&gt; (i.e. the ground state should be &lt;span class=&quot;math-container&quot;&gt;$|11\rangle = (0,0,0,1)^T$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What did I do (or understand) wrong?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="6253" LastEditDate="2020-04-23T17:55:06.397" LastActivityDate="2020-10-15T11:26:34.120" Title="How to convert QUBO problem to Ising Hamiltonian?" Tags="&lt;hamiltonian-simulation&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11664" PostTypeId="2" ParentId="11645" CreationDate="2020-04-23T16:05:26.780" Score="2" Body="&lt;p&gt;It's my understanding that in Google's quantum computational supremacy experiment, they have executed &lt;em&gt;exactly&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Furthermore it's my understanding that the circuit is chosen &lt;em&gt;randomly&lt;/em&gt; because they wish to show to the world that they do not have a potential back-door, which would enable them rapid simulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, I think of their random single-qubit gates as akin to &lt;a href=&quot;https://en.wikipedia.org/wiki/Nothing-up-my-sleeve_number&quot; rel=&quot;nofollow noreferrer&quot;&gt;'nothing-up-my-sleeve numbers'&lt;/a&gt;. These are numbers used in cryptographic protocols to indicate that the protocols are unlikely to have been designed with a nefarious purpose.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-04-24T00:05:21.207" LastActivityDate="2020-04-24T00:05:21.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11665" PostTypeId="2" ParentId="11663" CreationDate="2020-04-23T16:12:46.960" Score="3" Body="&lt;p&gt;Maybe this will help. Let's take a simple case:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(x_1, x_2) = -2x_1 x_2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then it is minimum when &lt;span class=&quot;math-container&quot;&gt;$x_1 = x_2 = 1$&lt;/span&gt;. Now let's take this Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_f = -2Z \otimes Z$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Hamiltonian is minimum when we have either &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; states. So this Hamiltonian doesn't correspond to the &lt;span class=&quot;math-container&quot;&gt;$f(x_1, x_2)$&lt;/span&gt;. Instead this one looks better:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_f = -2 \left(\frac{I - Z}{2}\right) \otimes \left(\frac{ I - Z}{2}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because in this case, &lt;span class=&quot;math-container&quot;&gt;$f(x_1, x_2)$&lt;/span&gt; is equal to the &lt;span class=&quot;math-container&quot;&gt;$H_f$&lt;/span&gt;'s eigenvalue for the &lt;span class=&quot;math-container&quot;&gt;$|x_1 x_2\rangle$&lt;/span&gt; eigenstate. And, consequently, if &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt; correspond to the minimum value of &lt;span class=&quot;math-container&quot;&gt;$f(x_1, x_2)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|x_1 x_2\rangle$&lt;/span&gt; will be the eigenstate with the minimum eigenvalue for &lt;span class=&quot;math-container&quot;&gt;$H_f$&lt;/span&gt;. This is right, because the operator &lt;span class=&quot;math-container&quot;&gt;$\frac{I - Z}{2}$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$|x=0 \rangle$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$|x=1 \rangle$&lt;/span&gt; eigenstates with corresponding &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;So, for the &lt;span class=&quot;math-container&quot;&gt;$f(x_1, x_2) = 5 x_1 + x_2 - 2 x_1 x_2$&lt;/span&gt; we can introduce the following Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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} = \\&#xA;=\frac{5}{2} I \otimes I - 2 Z \otimes I - \frac{1}{2} Z \otimes Z =&#xA;\text{diag}(0, 1, 5, 4)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$H_f|x_1 x_2\rangle = f(x_1, x_2) |x_1 x_2\rangle$&lt;/span&gt;. For optimization problems we can ignore &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{2}I \otimes I$&lt;/span&gt; term. In that case all eigenvalues will be shifted with the same &lt;span class=&quot;math-container&quot;&gt;$-\frac{5}{2}$&lt;/span&gt; value. With or without &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{2}I \otimes I$&lt;/span&gt; term the eigenstates with minimum or maximum eigenvalues will stay at the same &amp;quot;places&amp;quot;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This procedure will also work for more general cost functions &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; (not necessarily QUBO &lt;span class=&quot;math-container&quot;&gt;$\rightarrow$&lt;/span&gt; Ising Hamiltonian). Here is an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14114/9459&quot;&gt;answer&lt;/a&gt; about this.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-15T11:26:34.120" LastActivityDate="2020-10-15T11:26:34.120" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11666" PostTypeId="2" ParentId="11617" CreationDate="2020-04-23T16:47:30.077" Score="4" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$5\times10^6$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;instance&lt;/em&gt; of the experiment, they generated a new circuit using a different seed for the pseudorandom generator which produces a different probability distribution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A high level overview of the experiment looks like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for seed in numInstances:&#xA;    circuit = generateCircuit(seed)&#xA;    qDist = quantumExecution(circuit)&#xA;    cDist = classicalSimulation(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If qDist &lt;span class=&quot;math-container&quot;&gt;$\approx$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11769" LastActivityDate="2020-04-23T16:47:30.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11667" PostTypeId="1" AcceptedAnswerId="11671" CreationDate="2020-04-23T19:42:13.407" Score="3" ViewCount="78" Body="&lt;p&gt;I am reading the chapter about phase kickback from &quot;An Introduction to Quantum Computing&quot; by Kaye, Laflamme, Mosca. I understand why &lt;span class=&quot;math-container&quot;&gt;$U_f :|x \rangle |-\rangle \rightarrow (-1)^{f(x)} |x\rangle |-\rangle$&lt;/span&gt; is correct. But then it is written that &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; can be thought as a 1-qubit operator &lt;span class=&quot;math-container&quot;&gt;$\hat{U}_{f(x)}$&lt;/span&gt; acting on the second qubit controlled by the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. I don't get why this is true and why the circuits below are equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Txwld.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Txwld.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For instance if &lt;span class=&quot;math-container&quot;&gt;$f(0)=1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$U_f:|0\rangle|-\rangle \rightarrow - |0\rangle |-\rangle$&lt;/span&gt;, but this is not the case for the circuit given on the right since if &lt;span class=&quot;math-container&quot;&gt;$|x\rangle=0$&lt;/span&gt;, no operation is applied on the second register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can someone show me what I am missing? &lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-04-24T07:42:41.263" Title="Phase Kickback and Controlled Operations" Tags="&lt;quantum-gate&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11668" PostTypeId="2" ParentId="11409" CreationDate="2020-04-23T20:36:00.707" Score="0" Body="&lt;p&gt;This &lt;a href=&quot;https://arxiv.org/pdf/1502.04943.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; purpose a method to encode a list in quantum circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;An example for the list : [1, 3, 0, 2] and the Grover search, where is 0 ? &#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZOd28.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZOd28.png&quot; alt=&quot;Grover search&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And the result : index 2&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Jbke3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jbke3.png&quot; alt=&quot;Result&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10192" LastActivityDate="2020-04-23T20:36:00.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11670" PostTypeId="1" CreationDate="2020-04-24T01:23:36.707" Score="0" ViewCount="110" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9402" LastEditorUserId="55" LastEditDate="2020-10-22T10:50:49.773" LastActivityDate="2020-10-22T10:50:49.773" Title="Can every process in nature be simulated by a Turing Machine or a quantum computer?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;simulation&gt;&lt;information-theory&gt;&lt;quantum-turing-machine&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11671" PostTypeId="2" ParentId="11667" CreationDate="2020-04-24T07:42:41.263" Score="1" Body="&lt;p&gt;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 &quot;if the control qubit is 0, apply unitary &lt;span class=&quot;math-container&quot;&gt;$\hat U_{f(0)}$&lt;/span&gt; on the target. if the control qubit is 1, apply &lt;span class=&quot;math-container&quot;&gt;$\hat U_{f(1)}$&lt;/span&gt; on the target&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If this is to be the case, let's see what the action is supposed to be. As you say,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle|-\rangle\rightarrow (-1)^{f(x)}|x\rangle|-\rangle.&#xA;$$&lt;/span&gt;&#xA;You also have to check the action on the other basis state,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle|+\rangle\rightarrow|x\rangle|+\rangle.&#xA;$$&lt;/span&gt;&#xA;So, to summarise, if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is 0, the unitary on the second qubit is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\rangle\langle +|+(-1)^{f(0)}|-\rangle\langle -|.&#xA;$$&lt;/span&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is 1, the unitary on the second qubit is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\rangle\langle +|+(-1)^{f(1)}|-\rangle\langle -|.&#xA;$$&lt;/span&gt;&#xA;So, if we defined &lt;span class=&quot;math-container&quot;&gt;$U_y$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat U_y=|+\rangle\langle +|+(-1)^{y}|-\rangle\langle -|,&#xA;$$&lt;/span&gt;&#xA;then this would be consistent with my statement.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-24T07:42:41.263" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11672" PostTypeId="1" AcceptedAnswerId="11753" CreationDate="2020-04-24T10:12:39.063" Score="2" ViewCount="80" Body="&lt;p&gt;I have an issue, perhaps with normalization with the following state. For &lt;span class=&quot;math-container&quot;&gt;$\alpha^2 + \beta^2 =1 $&lt;/span&gt;, the probabilities in this state does not sum up to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;as &lt;span class=&quot;math-container&quot;&gt;$p(0)=\frac{2\alpha^2+2\alpha^2\langle x|x'\rangle}{4}=\alpha^2(\frac{1+\langle x|x'\rangle}{2})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p(1)=\frac{2\beta^2 - 2\beta^2\langle x | x'\rangle}{4} = \beta^2\frac{1-\langle x | x'\rangle}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And &lt;span class=&quot;math-container&quot;&gt;$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}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Long version:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I created the state as follows:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle |0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Hadamard on first qubit &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Controlled operations: if 0 on first register I create state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; otherwise I create state &lt;span class=&quot;math-container&quot;&gt;$|x'\rangle$&lt;/span&gt; on second qubit. &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle|x\rangle+|1\rangle|x'\rangle)$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now a perform a second Hadamard gate and re-group the terms: &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2}\left[\left(|0\rangle(|x\rangle+|x'\rangle\right) + \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Now I am ready to do a rotation on the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-axis of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; on the first qubit. This leads to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2}\left[\alpha\left(|0\rangle(|x\rangle+|x'\rangle\right) + \beta \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Perhaps I am doing something wrong with the normalization? But I don't need any normalization factor as &lt;span class=&quot;math-container&quot;&gt;$\alpha^2+\beta^2=1$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="9006" LastEditDate="2020-04-24T11:02:28.790" LastActivityDate="2020-04-29T18:59:49.733" Title="Probabilities does not sum up to 1 in simple circuit" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11673" PostTypeId="1" CreationDate="2020-04-24T16:18:01.677" Score="4" ViewCount="140" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oYTXg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oYTXg.png&quot; alt=&quot;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.&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="11805" LastActivityDate="2020-04-24T18:33:28.693" Title="Help Identifying a Gate In Nielsen and Chuang" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11674" PostTypeId="2" ParentId="11673" CreationDate="2020-04-24T16:58:26.557" Score="6" Body="&lt;p&gt;Here are the corresponding decompositions of each gate with use of Toffoli and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HRZMX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HRZMX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first one applies &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on the third qubit if control qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state. The second one applies &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on the third qubit if control qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; state. The third one applies &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on the third qubit if control qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; state. The fourth one is the Toffoli gate that applies &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate if control qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; state. In all other cases, they do nothing. The black (white) circle means that the corresponding qubit should be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle)$&lt;/span&gt; to satisfy the condition of the gate. Multiple circles are for multiple conditions on the control qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info look at Figure 4.11 and 4.12 and corresponding descriptions in the same book.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-24T18:33:28.693" LastActivityDate="2020-04-24T18:33:28.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11675" PostTypeId="1" CreationDate="2020-04-24T20:40:25.863" Score="0" ViewCount="101" Body="&lt;p&gt;Can someone help me with the following question?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; be a general operator on the composite system &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes \mathcal{H}_B$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$O_A$&lt;/span&gt; be an operator on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt;. Using the definition of a partial trace that was given in class, together with the properties of the full trace, prove that &lt;span class=&quot;math-container&quot;&gt;$Tr_B(O_AM) = O_ATr_B(M)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I got stuck here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\sum\limits_\alpha OM_\alpha^{(A)}Tr\left(M_\alpha^{(B)}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Editor's note: the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{1}_B$&lt;/span&gt; actually looked more like &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt; except with a 1; however, I couldn't get the font to work properly in mathjax. Apologies.&lt;/p&gt;&#xA;" OwnerUserId="11808" LastEditorUserId="55" LastEditDate="2020-10-22T10:50:34.757" LastActivityDate="2020-10-22T10:50:34.757" Title="Prove that $\operatorname{Tr}_B(O_A M)=O_A\operatorname{Tr}_B(M)$" Tags="&lt;textbook-and-exercises&gt;&lt;partial-trace&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11676" PostTypeId="1" CreationDate="2020-04-24T22:27:54.187" Score="4" ViewCount="95" Body="&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shannon's source coding theorem tells us the following. We shall consider a binary alphabet for simplicity. Suppose Alice has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; independent and identically distributed instances of a random variable &lt;span class=&quot;math-container&quot;&gt;$X\in \{0, 1\}$&lt;/span&gt;. Let us call this string &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. There exists an encoding scheme that allows her to compress this into &lt;span class=&quot;math-container&quot;&gt;$m = H(X)$&lt;/span&gt; bits, where &lt;span class=&quot;math-container&quot;&gt;$H(X)$&lt;/span&gt; is the Shannon entropy, such that she can later decode it to some &lt;span class=&quot;math-container&quot;&gt;$\tilde{M}$&lt;/span&gt;. The error she makes will vanish as &lt;span class=&quot;math-container&quot;&gt;$n\rightarrow \infty$&lt;/span&gt; i.e. in that limit &lt;span class=&quot;math-container&quot;&gt;$\tilde{M} = M$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Schumacher compresssion is the correct quantum analogue of this. We shall consider qubits for simplicity. Suppose Alice has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; independent copies of some qubit state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; i.e. she holds &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes n}$&lt;/span&gt;. There exists an encoding scheme that allows her to compress these registers into &lt;span class=&quot;math-container&quot;&gt;$m = S(\rho)$&lt;/span&gt; qubits, where &lt;span class=&quot;math-container&quot;&gt;$S(\rho)$&lt;/span&gt; is the von Neumann entropy, such that she can later decode it to &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}^n$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$n\rightarrow\infty$&lt;/span&gt;, the error will vanish and &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}^n = \rho^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The quantum case is interesting because &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes n}$&lt;/span&gt; may be entangled with some inaccessible system &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;. The encoding and decoding scheme should work such that these correlations are preserved.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question: What does the encoded state look like?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the classical case, the encoded string is necessarily a uniformly randomly chosen &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and must have von Neumann entropy of exactly &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My guess&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it a uniformly random &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubit pure state? Since the state has to maintain entanglement with &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; in general, this cannot be the answer.&lt;/li&gt;&#xA;&lt;li&gt;A uniformly randomly chosen &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubit mixed state? This seems more plausible and the set of choices depends on how much entanglement the input state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; shares with &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-04-24T23:34:17.370" LastActivityDate="2020-04-24T23:34:17.370" Title="Schumacher compression - comparing with Shannon compression" Tags="&lt;entropy&gt;&lt;communication&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11677" PostTypeId="1" CreationDate="2020-04-25T01:17:28.843" Score="1" ViewCount="201" Body="&lt;p&gt;I am trying to compute the square root of the Y gate. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$Y_\theta =\begin{pmatrix}&#xA;\cos\theta &amp;amp; -\sin\theta \\&#xA;\sin\theta &amp;amp; \cos\theta &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Y-\lambda I$&lt;/span&gt; and I set it to zero, and I get: &lt;span class=&quot;math-container&quot;&gt;$(cos\theta-\lambda)^2 + sin^2\theta=0$&lt;/span&gt;. This cannot have solutions, as a square cannot be negative. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What am I doing wrong?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="55" LastEditDate="2020-04-27T08:52:55.057" LastActivityDate="2020-04-27T08:52:55.057" Title="How do I compute the square root of the $Y$ gate?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11679" PostTypeId="2" ParentId="11675" CreationDate="2020-04-25T07:14:26.160" Score="2" Body="&lt;p&gt;Firstly, just because an operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is defined on a composite space, it does not mean that the operator itself has a tensor product structure. You need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\sum_{i,j,k,l}M_{ij,kl}|ij\rangle\langle kl|&#xA;$$&lt;/span&gt;&#xA;Now let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O=\sum_{i,k}O_{i,k}|i\rangle\langle k|.&#xA;$$&lt;/span&gt;&#xA;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.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I can work out the product&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\Phi=(O\otimes I)M&amp;amp;=\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) \\&#xA;&amp;amp;=\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) \\&#xA;&amp;amp;=\sum_{i,j,k,l,m}O_{i,k}M_{kj,ml}|ij\rangle\langle ml|.&#xA;\end{align*}&lt;/span&gt;&#xA;Taking the partial trace of this, I get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B\Phi=\sum_{i,j,k,m}O_{i,k}M_{kj,mj}|i\rangle\langle m|&#xA;$$&lt;/span&gt;&#xA;(basically summing over indices &lt;span class=&quot;math-container&quot;&gt;$j=l$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I need to compare this to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|,&#xA;$$&lt;/span&gt;&#xA;so the two are the same.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-04-27T08:40:25.577" LastActivityDate="2020-04-27T08:40:25.577" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11680" PostTypeId="2" ParentId="11677" CreationDate="2020-04-25T09:10:57.423" Score="3" Body="&lt;p&gt;There are various ways of finding the square root of a gate.  As the Pauli matrix &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is self adjoing, we can use the Euler formula: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$R_y(\theta) = e^{-i\frac{\theta}{2}Y} = \cos\frac{\theta}{2}I -i \sin\frac{\theta}{2}Y $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now is easy to see that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{R_y(\theta)}$&lt;/span&gt; is just &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta/2)=e^{-i\frac{\theta}{4}Y} $&lt;/span&gt;. This gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{R_y(\theta)}=\begin{pmatrix}&#xA;\cos(\theta/4) &amp;amp; -\sin(\theta/4) \\&#xA;\sin(\theta/4) &amp;amp; \cos(\theta/4) &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\theta/2$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, i.e.:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{R_Y(\theta)} =\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\sin(\theta/2) \\&#xA;\sin(\theta/2) &amp;amp; \cos(\theta/2) &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1644" LastEditorUserId="9006" LastEditDate="2020-04-25T22:25:08.717" LastActivityDate="2020-04-25T22:25:08.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11681" PostTypeId="2" ParentId="11670" CreationDate="2020-04-25T13:50:37.907" Score="3" Body="&lt;p&gt;As far as we know, yes. This is essentially the &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Church-Turing thesis&lt;/a&gt;. 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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cstheory.stackexchange.com/q/88/29288&quot;&gt;What would it mean to disprove Church-Turing thesis? (on cstheory)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://cstheory.stackexchange.com/a/7553/29288&quot;&gt;Extended Church-Turing Thesis [and QC] (on cstheory)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://math.stackexchange.com/q/402934/173147&quot;&gt;Why do we believe the Church-Turing Thesis? (on math)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1/55&quot;&gt;Can a Turing machine simulate a quantum computer? (here)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-04-25T13:50:37.907" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11682" PostTypeId="1" CreationDate="2020-04-25T14:50:58.190" Score="0" ViewCount="232" Body="&lt;p&gt;First a definition: Let there be a quantum like that consists of &lt;span class=&quot;math-container&quot;&gt;$2^n=N$&lt;/span&gt; partitions each of size &lt;span class=&quot;math-container&quot;&gt;$n=\log_2 N$&lt;/span&gt;:  &lt;span class=&quot;math-container&quot;&gt;$$|x_0\rangle|x_1\rangle\cdots|x_{n-1}\rangle = |x_0x_1\dots x_{n-1}\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like in most state preparation schemes I start from &lt;span class=&quot;math-container&quot;&gt;$|00\dots0\rangle|00\dots0\rangle\cdots|00\dots0\rangle$&lt;/span&gt; (where every &lt;span class=&quot;math-container&quot;&gt;$00\dots0$&lt;/span&gt; represents a binary with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits, and I don't say that I permute &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;'s, it's just my initial state!). Is there an efficient way to generate to following quantum state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{\pi_k\in S_N} |\pi_k(x_0x_1\dots x_{n-1})\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\pi(x_0x_1\dots x_{n-1})$&lt;/span&gt; are all possible &lt;span class=&quot;math-container&quot;&gt;$n!$&lt;/span&gt; permutations of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; elements. The final state is permutationally invariant under all permutations, but I'm not sure if this can be used for the generation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I prefer implementations without measurements and no ancilla.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update: A worked out example, another one and an inefficient way&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting from the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubit state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; I'd like to end with &lt;span class=&quot;math-container&quot;&gt;$\frac1{\sqrt 2}(|01\rangle+|10\rangle)$&lt;/span&gt;, which is accomplished by the following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22],[%22%E2%97%A6%22,%22X%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uWckq.jpg&quot; alt=&quot;enter image description here&quot; title=&quot;link to quirk implementation...&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything unitary! Since it was addresed in on of the answers: What happens to &lt;span class=&quot;math-container&quot;&gt;$|10 \rangle$&lt;/span&gt;? It revertibly maps to &lt;span class=&quot;math-container&quot;&gt;$\frac1{\sqrt 2}(|01\rangle-|10\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's try with &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Let's start again with &lt;span class=&quot;math-container&quot;&gt;$$|00\rangle|00\rangle|00\rangle|00\rangle$$&lt;/span&gt; &lt;/li&gt;&#xA;&lt;li&gt;Create a superposition in the first register:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac1{\sqrt 4}(|00\rangle+|01\rangle+|10\rangle+|11\rangle)|00\rangle|00\rangle|00\rangle$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Pick one, lets say &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. We need to split the second register in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2313/5280&quot;&gt;an equal superposition of 3 levels&lt;/a&gt;, 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:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22,%22H%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22~fb2t%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22Y%5E%C2%BC%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22Y%5E-%C2%BC%22],[%22X%22],[%22~et9c%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22X%22],[1,%22X%22],[%22~et9c%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22],[1,%22X%22],[%22X%22,%22X%22],[%22~et9c%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22,%22X%22],[%22X%22,%22X%22]],%22gates%22:[%7B%22id%22:%22~fb2t%22,%22matrix%22:%22%7B%7B%E2%88%9A%E2%85%94,-%E2%88%9A%E2%85%93%7D,%7B%E2%88%9A%E2%85%93,%E2%88%9A%E2%85%94%7D%7D%22%7D,%7B%22id%22:%22~et9c%22,%22name%22:%22Controlled_Split2%22,%22circuit%22:%7B%22cols%22:[[%22%E2%80%A2%22,%22%E2%80%A2%22,%22~fb2t%22,%22Y%5E%C2%BC%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22Y%5E-%C2%BC%22]]%7D%7D],%22init%22:[1,1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7yBOw.jpg&quot; alt=&quot;enter image description here&quot; title=&quot;the density matrix at the end nicely represents the 12 states. Notice the missing diagonal!&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; Since they only idle around, I ommitted the third and forth register (qubits 5 to 8) in this step.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Along the same line for the third register, where we apply &lt;span class=&quot;math-container&quot;&gt;$4\cdot3=12$&lt;/span&gt; operations, which split the third register in 2 levels vontrolled by the first and second register.&lt;/li&gt;&#xA;&lt;li&gt;Another &lt;span class=&quot;math-container&quot;&gt;$24$&lt;/span&gt; operations for the forth register or maybe less because we can skip those who have to end on a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, because it is already there...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;The final state I would get with this procedure, written in decimal basis is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tiny&#xA;|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&#xA;$$&lt;/span&gt;&#xA;and in qubit representation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tiny&#xA;|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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach extends to an exponential number of multiply controlled operations. Does anyone know if there is a more efficient one?&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-04-28T14:00:05.293" LastActivityDate="2020-04-28T14:00:05.293" Title="Generate a quantum state that sums up all permutations of elements" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11683" PostTypeId="2" ParentId="11682" CreationDate="2020-04-25T15:47:54.970" Score="2" Body="&lt;p&gt;We start with the state &lt;span class=&quot;math-container&quot;&gt;$\vert x_1, x_2, ... x_n\rangle$&lt;/span&gt; and wish to obtain the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{n!}}\sum\limits_{k=1}^{n!}\hat{\pi}_k\vert x_1, x_2, ... x_n\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First note that the operation is not a unitary operation. You cannot reverse it since the symmetrized state has lost information about the original &lt;span class=&quot;math-container&quot;&gt;$\vert x_1, x_2, ... x_n\rangle$&lt;/span&gt;. Therefore, the best you can achieve is the state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{n!}}\sum\limits_{k=1}^{n!}\vert k\rangle\otimes\hat{\pi}_k\vert x_1, x_2, ... x_n\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general idea to achieve this is by introducing &lt;span class=&quot;math-container&quot;&gt;$\log(n!)$&lt;/span&gt; auxilliary qubit registers and defining control swap gates. I do not know if Qiskit has an efficient way to do this.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastEditorUserId="5669" LastEditDate="2020-04-25T15:54:16.353" LastActivityDate="2020-04-25T15:54:16.353" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11685" PostTypeId="2" ParentId="11682" CreationDate="2020-04-25T23:47:09.517" Score="2" Body="&lt;p&gt;The operation as you have specified it is not reversible. For example, it would map &lt;span class=&quot;math-container&quot;&gt;$|a\rangle|b\rangle$&lt;/span&gt; to the same state it maps &lt;span class=&quot;math-container&quot;&gt;$|b\rangle|a\rangle$&lt;/span&gt; to. However, if you require that the list of input numbers is &lt;em&gt;sorted&lt;/em&gt; and all elements are unique then it is possible and is explained in &lt;a href=&quot;https://arxiv.org/abs/1711.10460&quot; rel=&quot;nofollow noreferrer&quot;&gt;Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians&lt;/a&gt; by Berry et al. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basic idea is to first produce a &quot;sorting magic state&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you have your &quot;sorting magic state&quot;, 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="9006" LastEditDate="2020-04-26T06:37:32.517" LastActivityDate="2020-04-26T06:37:32.517" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11686" PostTypeId="1" CreationDate="2020-04-26T00:30:53.650" Score="1" ViewCount="162" Body="&lt;p&gt;I am quite new to Quantum Computing. If we have an input-state &lt;span class=&quot;math-container&quot;&gt;$|00⟩$&lt;/span&gt;. How could you transform it into the state &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8400" LastEditorUserId="10473" LastEditDate="2020-05-16T10:11:10.673" LastActivityDate="2020-05-16T10:11:10.673" Title="How to transform $|00\rangle$ into $\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)$?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11687" PostTypeId="2" ParentId="11686" CreationDate="2020-04-26T01:52:35.000" Score="11" Body="&lt;p&gt;Consider the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)$&lt;/span&gt;. This admits a factorisation &lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)&amp;amp;=\frac12\{|0\rangle\otimes(|0\rangle+|1\rangle)+|1\rangle\otimes(|0\rangle+|1\rangle)\}\\&amp;amp;=\frac12\{(|0\rangle+|1\rangle)\otimes(|0\rangle+|1\rangle)\}\\&amp;amp;=\left(\frac{|0\rangle+|1\rangle}{\sqrt2}\right)\otimes \left(\frac{|0\rangle+|1\rangle}{\sqrt2}\right)\\&amp;amp;=H|0\rangle\otimes H|0\rangle\end{align*}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_(H)_gate&quot; rel=&quot;noreferrer&quot;&gt;Hadamard gate&lt;/a&gt; and &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;noreferrer&quot;&gt;tensor product&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus all you have to do is apply parallel Hadamard gates to two copies of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the resulting state is the one you desire.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More compactly &lt;span class=&quot;math-container&quot;&gt;$$H(|0\rangle)\otimes H(|0\rangle)=(H\otimes H)(|0\rangle\otimes|0\rangle)=H_2|00\rangle$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$$H_2=H \otimes H = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix} \otimes \frac{1}{\sqrt{2}} \begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix} = \frac{1}{2} \begin{bmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt; &lt;/p&gt;&#xA;" OwnerUserId="14" LastEditorUserId="14" LastEditDate="2020-04-26T02:01:08.037" LastActivityDate="2020-04-26T02:01:08.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11688" PostTypeId="1" AcceptedAnswerId="11689" CreationDate="2020-04-26T05:15:34.430" Score="2" ViewCount="154" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we have the Hamiltonian &#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ H = Z_1 ⊗ Z_2 ⊗ \cdots ⊗ Z_n,\tag{4.113}$$&lt;/span&gt;&#xA;  which acts on an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$e^{-iH\Delta t}$&lt;/span&gt;, for arbitrary values of &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt;. A circuit doing precisely this, for &lt;span class=&quot;math-container&quot;&gt;$n = 3$&lt;/span&gt;, 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 &lt;em&gt;classical&lt;/em&gt; manner: the phase shift applied to the system is &lt;span class=&quot;math-container&quot;&gt;$e^{-i\Delta t}$&lt;/span&gt; if the &lt;em&gt;parity&lt;/em&gt; of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in the computational basis is even; otherwise, the phase shift should be &lt;span class=&quot;math-container&quot;&gt;$e^{i\Delta t}$&lt;/span&gt;. Thus, simple simulation of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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).&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OwE2r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OwE2r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Considering the case of n=3, let's say we had &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a|000\rangle + b|110\rangle$&lt;/span&gt;. The above circuit is supposed to apply &lt;span class=&quot;math-container&quot;&gt;$e^{-iZ\otimes Z\otimes Z \Delta t}$&lt;/span&gt; to the three qubits. Using what I've read on tensor products,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-iZ\otimes Z\otimes Z t}|\psi\rangle  = e^{Z\otimes Z\otimes (-iZ \Delta t)}(a|000\rangle + b|110\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= 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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using Taylor Series, I found that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^Z|0\rangle = e|0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^Z|1\rangle = \frac{1}{e}|1\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-iZ \Delta t}|0\rangle = e^{-i\Delta t}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= 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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once I did this, I attempted to evaluate what the circuit above, presented in Nielsen and Chuang, does to the vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = (a|000\rangle + b|110\rangle)|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since both &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; are even, we apply &lt;span class=&quot;math-container&quot;&gt;$e^{-iZ\Delta t}$&lt;/span&gt; to the aux 4th qubit, so we get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = (a|000\rangle + b|110\rangle)e^{-iZ\Delta t}|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And since we know that &lt;span class=&quot;math-container&quot;&gt;$e^{-iZ\Delta t}|0\rangle =e^{-i\Delta t}|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = (a|000\rangle + b|110\rangle)e^{-i\Delta t}|0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= a(e^{-i\Delta t})(|000\rangle) + b(e^{-i\Delta t})(|110\rangle) \tag{eq. 2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; through that transformation.&lt;/p&gt;&#xA;" OwnerUserId="11644" LastEditorUserId="11644" LastEditDate="2020-04-26T18:00:55.370" LastActivityDate="2020-04-26T18:00:55.370" Title="Question Regarding Simulating Hamiltonian With Quantum Circuit" Tags="&lt;quantum-gate&gt;&lt;simulation&gt;&lt;nielsen-and-chuang&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11689" PostTypeId="2" ParentId="11688" CreationDate="2020-04-26T10:28:40.510" Score="5" Body="&lt;p&gt;I think the problem is in this assumption:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-i Z \otimes Z \otimes Z  t} |110\rangle = e^{Z}|1\rangle e^{Z}|1\rangle e^{-iZt}|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It shouldn't be right, because, at least, &lt;span class=&quot;math-container&quot;&gt;$e^{Z}$&lt;/span&gt; is not a unitary transformation (normalization is changed).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's try to find out the actual action of the operator. Note that in all calculations I have replaced &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From 4.2 exercise from M. Nielsen and I. Chuang &lt;a href=&quot;https://www.cambridge.org/am/academic/subjects/physics/quantum-physics-quantum-information-and-quantum-computation/quantum-computation-and-quantum-information-10th-anniversary-edition?format=HB&quot; rel=&quot;noreferrer&quot;&gt;textbook&lt;/a&gt;: Let &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; be a real number and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; a matrix such that &lt;span class=&quot;math-container&quot;&gt;$A^2 = I$&lt;/span&gt;. Then&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i A t} = \cos(t) I + i \sin(t) A$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, by taking into account that &lt;span class=&quot;math-container&quot;&gt;$\left[Z \otimes Z\otimes Z\right]^2 = I $&lt;/span&gt;, the action of the operator on &lt;span class=&quot;math-container&quot;&gt;$|011\rangle$&lt;/span&gt; will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;e^{-i Z \otimes Z \otimes Z  t} |110\rangle = \left( \cos(t) I - i \sin( t) Z Z Z \right) |110\rangle = &#xA;\\&#xA;=\cos( t) |110\rangle - i \sin(t) Z|1\rangle Z|1\rangle Z|0\rangle =&#xA;\\ &#xA;= \cos(t) |110\rangle - i \sin(t) (-1)|1\rangle (-1)|1\rangle (+1)|0\rangle =&#xA;\\&#xA;= \left(\cos(t) - i \sin(t)\right) |110\rangle = e^{-i t}|110\rangle&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So as one can see if in the bit string we have even a number of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s (parity), then the phase will be &lt;span class=&quot;math-container&quot;&gt;$e^{-it}$&lt;/span&gt;, otherwise, the phase multiplied to the corresponding bit string will be &lt;span class=&quot;math-container&quot;&gt;$e^{it}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit presented in the question does parity check with CNOTs: if in the bit string we have an even number of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s the target (ancillary) qubit will be in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-i Z t} |0\rangle |\text{even parity}\rangle = e^{-i t} |0\rangle |\text{even parity}\rangle$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second group of CNOTs will not change that state. Otherwise, if in the bit string we have an odd number of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s the target (ancillary) qubit will be in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-i Z t} |1\rangle |\text{odd parity}\rangle = e^{i t} |1\rangle |\text{odd parity}\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After the second group of CNOTs (uncomputing the changes in the target qubit) we will have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i t} |0\rangle |\text{odd parity}\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the circuit does what we want.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-26T12:34:36.633" LastActivityDate="2020-04-26T12:34:36.633" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11690" PostTypeId="1" CreationDate="2020-04-26T11:18:03.080" Score="6" ViewCount="53" Body="&lt;p&gt;Given a graph &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; and a set of marked vertices &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any special types of graphs for which the spatial search problem can be solved with exponential speedup compared to classical algorithms? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] Krovi, H., Magniez, F., Ozols, M., &amp;amp; Roland, J. 2016. “Quantum walks can find a marked element on any graph”, Algorithmica, 74(2), 851-907.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] Chakraborty, S., Novo, L., &amp;amp; Roland, J. (2018). Finding a marked node on any graph by continuous-time quantum walk. arXiv preprint arXiv:1807.05957.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] Ambainis, Andris, et al. &quot;Quadratic speedup for finding marked vertices by quantum walks.&quot; arXiv preprint arXiv:1903.07493 (2019).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[4] Kempe, Julia. &quot;Discrete quantum walks hit exponentially faster.&quot; Probability theory and related fields 133.2 (2005): 215-235.&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-04-26T11:18:03.080" Title="Speedup for spatial search problem using quantum walks" Tags="&lt;research&gt;&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11691" PostTypeId="2" ParentId="11622" CreationDate="2020-04-26T13:00:14.017" Score="4" Body="&lt;p&gt;I am sure that since you are asking this question you probably already understand this, but for future &amp;amp; other's reference let me give a quick recap of what we are trying to achieve.&lt;/p&gt;&#xA;&lt;h2&gt;Quantum channels&lt;/h2&gt;&#xA;&lt;p&gt;Any process (in an open quantum system) is some map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; from &lt;em&gt;a&lt;/em&gt; space of density matrices to &lt;em&gt;a&lt;/em&gt; space of density matrices. I write &lt;em&gt;a&lt;/em&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;We generally write &lt;span class=&quot;math-container&quot;&gt;$\Lambda(\rho_{\mathrm{in}}) = \rho_{\mathrm{out}}$&lt;/span&gt; when our map transforms &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{in}}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{out}}$&lt;/span&gt;. Furthermore, since we always expect any &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{out}}$&lt;/span&gt; to be an actual physical state (it must be positive semidefinite and must have trace &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), we impose two constraints on &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Any map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; should be &lt;em&gt;completely positive&lt;/em&gt;. This ensures that &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{out}}$&lt;/span&gt; is always positive semidefinite, even if it a subsystem of a larger whole. This constraint is often abbreviated as &amp;quot;CP&amp;quot;.&lt;/li&gt;&#xA;&lt;li&gt;Any map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; should be &lt;em&gt;trace preserving&lt;/em&gt;: &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}\big[\Lambda(\rho)\big] = \mathrm{tr}\big[\rho\big]$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\forall\rho$&lt;/span&gt;. This ensures that &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{out}}$&lt;/span&gt; always has unit trace. We abbreviate this constraint as &amp;quot;TP&amp;quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Any map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; that is both CP &amp;amp; TP = CPTP, we call a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;quantum channel&lt;/em&gt;&lt;/a&gt;. Sometimes we relax the TP constraint to include trace &lt;em&gt;decreasing&lt;/em&gt; maps (consider for instance a measurement); some authors refer to these maps as the more general &lt;em&gt;quantum operations&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Different representations of quantum channels&lt;/h2&gt;&#xA;&lt;p&gt;A quantum channel can be represented in different ways; I recap three here.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_operation#Kraus_operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Kraus&lt;/em&gt; representation&lt;/a&gt;. Nielsen &amp;amp; Chuang refer to this as the operator-sum representation. In mathematical form:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Lambda(\rho) = \sum_{k} A_{k} \rho A_{k}^{\dagger},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{A_{k}\}$&lt;/span&gt; are known as the Kraus operators and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is always the same or smaller than the system size &lt;span class=&quot;math-container&quot;&gt;$d = 4^{n}$&lt;/span&gt;. That is, for any valid map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; there can always be found a Kraus representation with at most &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; operators. The CP constraint is automatically met here, the trace constraint reads: &lt;span class=&quot;math-container&quot;&gt;$\sum_{k} A_{k}^{\dagger} A_{k} \leq I$&lt;/span&gt; (with equality for TP).&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Choi%27s_theorem_on_completely_positive_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Choi&lt;/em&gt; matrix&lt;/a&gt;, which is a direct result of the Choi-Jamiolkowski isomorphism. Some intuition on what this is can be found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11580/what-does-it-mean-to-take-the-choi-jamiolkowski-of-a-quantum-channel/11624#11624&quot;&gt;in this previous answer&lt;/a&gt;. Consider the maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\Omega \rangle = \sum_{\mathrm{i}}|\mathrm{i}\rangle \otimes |\mathrm{i}\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{|\mathrm{i}\rangle\}$&lt;/span&gt; forms a basis for the space on which &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; acts. (Note that we thus have a maximally entangled state of twice as many qubits).&#xA;The Choi matrix is the state that we get when on one of these subsystems &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is applied (leaving the other subsystem intact):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_{\mathrm{Choi}} = \big(\Lambda \otimes I\big) |\Omega\rangle\langle\Omega|.&#xA;\end{equation}&lt;/span&gt;&#xA;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).&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography#Standard_quantum_process_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;process&lt;/em&gt;- or &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-matrix&lt;/a&gt;. We write our map as a double sum:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Lambda(\rho) = \sum_{m,n} \chi_{mn}P_{m}\rho P_{n}^{\dagger},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{P_{m}\}$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\{P_{n}\}$&lt;/span&gt; form a basis for the space of density matrices&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt;; we use the Pauli basis &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}^{\otimes n}$&lt;/span&gt; (thereby omitting the need for the &lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$P_{n}$&lt;/span&gt;). The matrix &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; now encapsulates all information of &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;; the CP constraint reads that &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; must be positive semidefinite, and the trace constraint reads that &lt;span class=&quot;math-container&quot;&gt;$\sum_{m,n}\chi_{mn}P_{n}P_{m} \leq I$&lt;/span&gt; (with equality for TP).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The goal for quantum process tomography is now to find a representation of an unknown channel &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;. We focus on the process matrix.&lt;/p&gt;&#xA;&lt;h2&gt;Standard QPT&lt;/h2&gt;&#xA;&lt;p&gt;Our goal is to find &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; for an arbitrary quantum channel. We give ourselves only the power of inputting different input states &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{in}}$&lt;/span&gt;, and measuring the output state &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{out}}$&lt;/span&gt; in different bases with measurement observables &lt;span class=&quot;math-container&quot;&gt;$\{M\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We always measure in the Pauli basis, and using slight abusive notation we use the Pauli basis as input states as well&lt;span class=&quot;math-container&quot;&gt;$^{2}$&lt;/span&gt;. A measurement on &lt;span class=&quot;math-container&quot;&gt;$\rho_{out}$&lt;/span&gt; in a basis denoted by &lt;span class=&quot;math-container&quot;&gt;$P_{j}$&lt;/span&gt; with an input state &lt;span class=&quot;math-container&quot;&gt;$P_{i}$&lt;/span&gt; then has expectation value &lt;span class=&quot;math-container&quot;&gt;$\lambda_{ij}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\lambda_{ij} &amp;amp;= \mathrm{tr}\big[P_{j}\Lambda(P_{i})\big] \\&#xA;&amp;amp;= \mathrm{tr}\big[P_{j}\sum_{mn}\chi_{mn}P_{m}P_{i}P_{n}\big] \\&#xA;&amp;amp;= \sum_{mn}\chi_{mn} \mathrm{tr}\big[P_{j}P_{m}P_{i}P_{n}\big] \\&#xA;&amp;amp;= \sum_{mn} A_{(ij,mn)} \chi_{mn}.\\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A_{(ij,mn)} = \mathrm{tr}\big[P_{j}P_{m}P_{i}P_{n}\big]$&lt;/span&gt;. If we now view all measurement outcomes &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_{ij}\}$&lt;/span&gt; as a vector &lt;span class=&quot;math-container&quot;&gt;$\overrightarrow{\lambda}$&lt;/span&gt; and if we vectorize &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle\rangle = \overrightarrow{\chi}$&lt;/span&gt; we get a giant linear system of equations linking the measurement outcomes to the elements of &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\overrightarrow{\lambda} = A \overrightarrow{\chi}.&#xA;\end{equation}&lt;/span&gt;&#xA;It is now our goal to solve for &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Intermediary: some notes on the sets &lt;span class=&quot;math-container&quot;&gt;$\{P_{i}\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{P_{j}\}$&lt;/span&gt;&lt;/h2&gt;&#xA;&lt;p&gt;The set of states from which we built &lt;span class=&quot;math-container&quot;&gt;$\{P_{i}\}$&lt;/span&gt;, known as the &lt;em&gt;preparation&lt;/em&gt; set, needs to have (at first glance) every Pauli eigenstate for every qubit there is, resulting in &lt;span class=&quot;math-container&quot;&gt;$6^{n}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle, |+\rangle, |+i\rangle\}^{\otimes n}$&lt;/span&gt; - both eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator and the +1 eigenstates of the X and Y operator. This results in &lt;span class=&quot;math-container&quot;&gt;$4^{n}$&lt;/span&gt; different input states.&lt;/p&gt;&#xA;&lt;p&gt;The set of measurements from which we built all &lt;span class=&quot;math-container&quot;&gt;$\{P_{j}\}$&lt;/span&gt; can be as simple as &lt;span class=&quot;math-container&quot;&gt;$\{X,Y,Z\}^{\otimes n}$&lt;/span&gt;; the &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;&amp;quot;-measurements can be inferred from the outcomes of those measurements. I link &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9014/quantum-tomography-on-two-qubits&quot;&gt;a previous answer of mine on QST&lt;/a&gt; where I explain how to built all &lt;span class=&quot;math-container&quot;&gt;$\{P_{j}\}$&lt;/span&gt;'s from only these measurements; there I explain it in detail for &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit QST but the generalization to a higher number of qubits is very straightforward.&lt;/p&gt;&#xA;&lt;p&gt;All in all, we thus need &lt;span class=&quot;math-container&quot;&gt;$4^{n} \times 3^{n} = 12^{n}$&lt;/span&gt; different pairs of measurement operators and preparation states to perform QPT.&lt;/p&gt;&#xA;&lt;h2&gt;Solving for &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Solving for &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; in our system of linear equations can be as straightforward as inverting &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is indeed invertible). Moreover, by using the Pauli basis, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is also unitary and even Hermitian so &lt;span class=&quot;math-container&quot;&gt;$\overrightarrow{\chi}$&lt;/span&gt; is readily calculated as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\overrightarrow{\chi} = A \overrightarrow{\lambda}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This, however, does not respect the CPTP constraints in any way.&#xA;Luckily, it can be shown that as long as all measurements that were performed had an actual outcome, the TP constraint on &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; is automatically met when using this method.&#xA;However, the CP constraint is not automatically met; this means that the calculated &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; might very well have negative eigenvalues. This stems from statistical noise on our estimates of &lt;span class=&quot;math-container&quot;&gt;$\lambda_{ij}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;A very straightforward but also less-then-ideal method of finding a positive semidefinite version of a non-CP &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; is by taking a convex combination with the Identity process such that every eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; becomes non-negative. Let &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\mathrm{min}} &amp;lt; 0$&lt;/span&gt; be the smallest (largest negative) eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;. Then the process matrix &lt;span class=&quot;math-container&quot;&gt;$\chi^{*}$&lt;/span&gt; has only nonnegative eigenvalues:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\chi^{*} = \frac{1}{\mathrm{tr}[\chi]+2^{2n}|\lambda_{\mathrm{min}}|}\big(\chi + |\lambda_{\mathrm{min}}|I\big)&#xA;\end{equation}&lt;/span&gt;&#xA;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).&lt;/p&gt;&#xA;&lt;p&gt;(I would expect about 1-100 million repetitions per prepare-measure pair for &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-qubit QPT will bring negative eigenvalues to something small enough for this method to give a okayish-fidelity. As I mentioned, QPT is &lt;em&gt;hard&lt;/em&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;There exist more elaborate methods that I won't go into to much detail here. If you are familiar with &lt;a href=&quot;https://en.wikipedia.org/wiki/Semidefinite_programming&quot; rel=&quot;nofollow noreferrer&quot;&gt;semidefinite linear programming&lt;/a&gt;, solving the equation &lt;span class=&quot;math-container&quot;&gt;$\overrightarrow{\lambda} = A \overrightarrow{\chi}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; 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) &lt;em&gt;drastically&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Another method can be found &lt;a href=&quot;https://arxiv.org/pdf/1803.10062.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this paper&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;Another approach is to use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Choi%E2%80%93Jamio%C5%82kowski_isomorphism&quot; rel=&quot;nofollow noreferrer&quot;&gt;Choi-Jamiolkowski isomorphism&lt;/a&gt;, mentioned above regarding the Choi matrix. Here one would not optimize for a quantum channel, but for a quantum state (i.e. Quantum &lt;em&gt;State&lt;/em&gt; 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 &lt;strong&gt;not&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;h2&gt;Further reference or reading&lt;/h2&gt;&#xA;&lt;p&gt;My own MSc. thesis (Blatant self-promotion, please excuse me:)) can be found &lt;a href=&quot;https://repository.tudelft.nl/islandora/object/uuid%3A39258a70-a347-40bb-a2f9-9ca301a71652?collection=education&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, 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.&#xA;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.&lt;/p&gt;&#xA;&lt;h2&gt;Footnotes&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Note that using a different basis does in fact transform the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; 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 &lt;em&gt;Hermitian&lt;/em&gt; matrices, of which the density matrices are a subset.&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_{+}\rangle\}$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_{-}\rangle\}$&lt;/span&gt; are the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;- &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstates of a Pauli operator &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, we can combine them as such:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Lambda(P) = \sum_{+}\Lambda(|\psi_{+}\rangle\langle \psi_{+}|) - \sum_{-}\Lambda(|\psi_{-}\rangle\langle \psi_{-}|).&#xA;\end{equation}&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-05-03T08:48:46.820" LastActivityDate="2021-05-03T08:48:46.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11692" PostTypeId="1" AcceptedAnswerId="11693" CreationDate="2020-04-26T13:14:02.593" Score="2" ViewCount="190" Body="&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/DGL5A.png&quot; alt=&quot;Cnot on right and Qiskit representation of cnot on left[1]&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8588" LastEditorUserId="5955" LastEditDate="2020-04-26T13:20:31.610" LastActivityDate="2020-04-26T17:02:26.190" Title="Qiskit flipped representation of qubits in CNOT gate?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11693" PostTypeId="2" ParentId="11692" CreationDate="2020-04-26T14:07:25.003" Score="3" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;&#xA;circuit_cx_01 = QuantumCircuit(2, 2)&#xA;circuit_cx_10 = QuantumCircuit(2, 2)&#xA;&#xA;circuit_cx_01.x(0)&#xA;circuit_cx_01.x(1)&#xA;circuit_cx_01.cx(0, 1)&#xA;circuit_cx_01.measure(0, 0)&#xA;circuit_cx_01.measure(1, 1)&#xA;&#xA;circuit_cx_10.x(0)&#xA;circuit_cx_10.x(1)&#xA;circuit_cx_10.cx(1, 0)&#xA;circuit_cx_10.measure(0, 0)&#xA;circuit_cx_10.measure(1, 1)&#xA;&#xA;result_cx_01 = execute(circuit_cx_01, simulator, shots=1024).result().get_counts()&#xA;result_cx_10 = execute(circuit_cx_10, simulator, shots=1024).result().get_counts()&#xA;&#xA;print(&quot;After cx(0, 1) applied on '11' state \n{}&quot;.format(result_cx_01))&#xA;print(&quot;\nAfter cx(1, 0) applied on '11' state \n{}&quot;.format(result_cx_10))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;After cx(0, 1) applied on '11' state &#xA;{'01': 1024}&#xA;&#xA;After cx(1, 0) applied on '11' state &#xA;{'10': 1024}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where in the &lt;code&gt;cx(i, j)&lt;/code&gt; the &lt;code&gt;i&lt;/code&gt; qubit is the control qubit and &lt;code&gt;j&lt;/code&gt; is the target qubit. From this, one can see that in Qiskit &lt;code&gt;0&lt;/code&gt; index corresponds to the rightmost qubit.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-04-26T17:02:26.190" LastActivityDate="2020-04-26T17:02:26.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11694" PostTypeId="2" ParentId="8850" CreationDate="2020-04-26T15:55:13.940" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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⟩. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So basically the phase oracle applies a &lt;em&gt;phase&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9633" LastActivityDate="2020-04-26T15:55:13.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11695" PostTypeId="2" ParentId="11584" CreationDate="2020-04-26T18:31:06.243" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You really can not do a lot of meaningful stuff without generating massive amounts of entanglement. &lt;/p&gt;&#xA;" OwnerUserId="11828" LastActivityDate="2020-04-26T18:31:06.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11696" PostTypeId="2" ParentId="11584" CreationDate="2020-04-26T21:03:32.040" Score="0" Body="&lt;p&gt;Consider an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit system. For each qubit you need to store 2 complex numbers, making &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; numbers in total. But if these qubits are entangled, then you can no longer store those numbers separetely. The overall system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is represented by a vector of dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; and can not be written as the tensor product of individual vectors. &lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-04-26T21:03:32.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11697" PostTypeId="2" ParentId="8850" CreationDate="2020-04-26T21:22:17.140" Score="0" Body="&lt;p&gt;Those two circuits are two different approches in implementing the oracle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the first one, the idea is to implement a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$x=|000\rangle$&lt;/span&gt;. If the input is &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;, then a NOT gate is applied to &lt;span class=&quot;math-container&quot;&gt;$q_a$&lt;/span&gt; which is the ancilla qubit. If the ancilla qubit is prepared in state &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, then using phase kickback the sign of the amplitude of the state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; is flipped.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the second one, the sign of the amplitude of the state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; is flipped directly through controlled Z gate, which adds an overall of phase of -1 if all control qubits are in state 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About your other question, think of the effect of that operation on an arbitrary basis state. If you apply it to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then the output is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the output is &lt;span class=&quot;math-container&quot;&gt;$-|x\rangle$&lt;/span&gt; for any other input &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. Think about the converse, where you only flip the amplitude of state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Those two operations are indistinguihable and therefore the latter is implemented, which is exactly the same as the oracle implementation where &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; is the marked element. (Check this link:&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11357/gate-corresponding-to-i&quot;&gt;Gate corresponding to $-I$&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-04-26T21:22:17.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11698" PostTypeId="1" CreationDate="2020-04-26T22:27:21.370" Score="1" ViewCount="58" Body="&lt;p&gt;How can you take the Tensor Product in IBM Quantum Experience?&#xA;For example&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(X|1⟩) \otimes ((X|1⟩)$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to look up but couldn’t find anything&lt;/p&gt;&#xA;" OwnerUserId="8400" LastEditorUserId="9006" LastEditDate="2020-04-27T04:30:30.687" LastActivityDate="2020-04-27T04:41:19.003" Title="Tensor product IBM on Quantum Experience" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11699" PostTypeId="1" CreationDate="2020-04-27T01:24:47.153" Score="2" ViewCount="38" Body="&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eZXLv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eZXLv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11833" LastEditorUserId="11833" LastEditDate="2020-04-27T01:32:14.157" LastActivityDate="2020-04-27T11:24:21.360" Title="Why should we measure in X/Z basis for Z/X errors in Steane syndrome extraction?" Tags="&lt;algorithm&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11700" PostTypeId="1" CreationDate="2020-04-27T02:39:33.607" Score="1" ViewCount="86" Body="&lt;p&gt;How can you construct the different Bell states? For example &lt;span class=&quot;math-container&quot;&gt;$$\frac{|01⟩-|10⟩}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8400" LastEditorUserId="55" LastEditDate="2020-04-27T08:50:18.720" LastActivityDate="2020-04-27T10:18:04.137" Title="How can you construct the different two-qubit Bell states?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11701" PostTypeId="2" ParentId="11700" CreationDate="2020-04-27T04:14:14.487" Score="3" Body="&lt;p&gt;Firstly construct following circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TShf1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TShf1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Different Bell states are created according to input to the circuit follwingly:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, output: &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, output: &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, output: &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, output: &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-27T04:14:14.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11702" PostTypeId="2" ParentId="11698" CreationDate="2020-04-27T04:19:05.023" Score="1" Body="&lt;p&gt;Lets have two general single qubit gates &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. If you apply &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on first qubit and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; on second qubit, you will get two qubit gate &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt;. In your case &lt;span class=&quot;math-container&quot;&gt;$A = B = X$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Just note that &lt;span class=&quot;math-container&quot;&gt;$X|1\rangle \otimes X|1\rangle = |0\rangle\otimes|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example of tensor product &lt;span class=&quot;math-container&quot;&gt;$S \otimes T$&lt;/span&gt; implementation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V5Y8l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V5Y8l.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As tensor product is not commutative operation, &lt;span class=&quot;math-container&quot;&gt;$T \otimes S$&lt;/span&gt; is implemented followingly:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TYjQ8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TYjQ8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-27T04:41:19.003" LastActivityDate="2020-04-27T04:41:19.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11703" PostTypeId="1" AcceptedAnswerId="11859" CreationDate="2020-04-27T09:28:43.280" Score="1" ViewCount="96" Body="&lt;p&gt;I have executed this circuit and I don't understand why the result is &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;[q[0], q[1]]&lt;/code&gt; : solution register&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[q[2]]&lt;/code&gt; : ancilla register (clause value) &lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;[q[3]]&lt;/code&gt; : boolean value of Oracle function&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3LIy0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3LIy0.png&quot; alt=&quot;Circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks you&lt;/p&gt;&#xA;" OwnerUserId="10192" LastEditorUserId="9006" LastEditDate="2020-04-27T17:31:46.617" LastActivityDate="2020-05-05T06:55:01.903" Title="Result of Grover on Qiskit simulator" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11704" PostTypeId="2" ParentId="6496" CreationDate="2020-04-27T09:47:10.117" Score="2" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9503016.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elementary gates for quantum computation&lt;/a&gt; it is conjectured that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;based on dimension counting, ... a lower bound on the number of two-bit gates required to produce an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit unitary transformation [is]: &lt;span class=&quot;math-container&quot;&gt;$\Omega(n) =\frac19 4^n−\frac13n−\frac19$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-04-27T09:47:10.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11705" PostTypeId="2" ParentId="11700" CreationDate="2020-04-27T10:18:04.137" Score="2" Body="&lt;p&gt;By a combination of Hadamard Gate and CNOT Gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Check the links below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.quora.com/What-is-the-matrix-of-a-Hadamard-with-a-CNOT-gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.quora.com/What-is-the-matrix-of-a-Hadamard-with-a-CNOT-gate&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/418422/negative-of-quantum-gates-and-entangled-states&quot;&gt;https://physics.stackexchange.com/questions/418422/negative-of-quantum-gates-and-entangled-states&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11708" LastActivityDate="2020-04-27T10:18:04.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11706" PostTypeId="1" CreationDate="2020-04-27T10:27:54.110" Score="2" ViewCount="240" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8388" LastEditorUserId="9006" LastEditDate="2020-04-27T10:52:06.407" LastActivityDate="2020-04-28T00:59:41.603" Title="Readout error in IBM quantum experience processor" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;noise&gt;&lt;decoherence&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11707" PostTypeId="2" ParentId="11706" CreationDate="2020-04-27T10:51:34.973" Score="2" Body="&lt;p&gt;Go to the first page in IBM Q web interface, click on a quantum processor you are interested in and finally click on link &lt;em&gt;Download calibration&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You will see a table (CSV file) containing decoherence times &lt;span class=&quot;math-container&quot;&gt;$T1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T2$&lt;/span&gt;, read-out, single-qubit &lt;span class=&quot;math-container&quot;&gt;$U2$&lt;/span&gt; error rate and CNOT error rate.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-27T10:51:34.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11708" PostTypeId="2" ParentId="11699" CreationDate="2020-04-27T11:24:21.360" Score="1" Body="&lt;p&gt;There is much more information provided &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9611027&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; which may help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me start by clarifying that the aim &lt;strong&gt;is not&lt;/strong&gt; to detect and correct &lt;em&gt;logical&lt;/em&gt; errors, but to detect and correct &lt;em&gt;physical&lt;/em&gt; errors, i.e. those that occur on single physical qubits rather than the encoded qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the macro level, the answer is that if you have an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error (say), you use a controlled-not to propagate it to another qubit where it appears as an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error. Measuring in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis cannot see that error. For example, if a single qubit state was in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error would not change it, and you would be unable to detect the error. On the other hand, if the qubit was initially in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then the possibility of a flip would put it in either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, which can be detected with a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurement. (Put another way, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors commute with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; measurements, so they do not affect each other.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More specifically, let's start by thinking about what happens if there is no error. In that case, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is the eigenstate of controlled-not, so it never changes. This is what initially threw me trying to think about a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurement on this. But of course, it's not logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. What we do know is that &lt;span class=&quot;math-container&quot;&gt;$H\cdot x=0$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the parity-check matrix of the code (I'm being a bit loose about which of the two it is).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what happens if there was a single physical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error somewhere on the logical qubit. Controlled-nots (and we should think about the individual physical ones here, not the logical ones) propagate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; rotations from control to target. So, instead of getting an answer &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, we'd get an answer &lt;span class=&quot;math-container&quot;&gt;$x\oplus e$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt; is a vector representing the single qubit that had the error. So, now, if you apply the parity-check matrix, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H\cdot(x\oplus e)=(H\cdot x)\oplus(H\cdot e)=H\cdot e.&#xA;$$&lt;/span&gt;&#xA;The whole point of the parity-check matrices is that they can let you identify any single-qubit &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt;. Hence, you know what correction to provide.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-27T11:24:21.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11709" PostTypeId="2" ParentId="6915" CreationDate="2020-04-27T15:39:38.477" Score="1" Body="&lt;p&gt;In &lt;a href=&quot;https://www.pqi.org/videos/unitary-transformations-and-elitzur-vaidman-bomb-lecture-4-quantum-computation-cmu&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture 4&lt;/a&gt; of O'Donnell's series on quantum computing, he introduces the Elitzur-Vaidman &lt;a href=&quot;https://en.wikipedia.org/wiki/Elitzur%E2%80%93Vaidman_bomb_tester&quot; rel=&quot;nofollow noreferrer&quot;&gt;bomb tester&lt;/a&gt;, which is an interesting application of the quantum Zeno effect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;O'Donnell introduces the bomb tester prior to discussing multi-qubit entanglement in lecture 5.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; amount, and feeding the qubit back through the tester.  The bomb only goes off with probability only &lt;span class=&quot;math-container&quot;&gt;$\epsilon^2$&lt;/span&gt; for each test.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-04-27T16:04:10.550" LastActivityDate="2020-04-27T16:04:10.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11710" PostTypeId="2" ParentId="11703" CreationDate="2020-04-27T15:47:49.900" Score="0" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HEDaam.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HEDaam.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will bring the all states to zeros, but not &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-04-27T15:47:49.900" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11712" PostTypeId="1" CreationDate="2020-04-27T17:31:47.973" Score="7" ViewCount="164" Body="&lt;p&gt;It is known that &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301040&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli and Hadamard are Quantum Universal&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is - how to construct (an approximation of) the Deutsch's gate or the &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; rotation using Toffoli + Hadamard?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen several implementations of the Toffoli gate using Hadamard, CNOT and &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; gates, but none for the other direction. &lt;/p&gt;&#xA;" OwnerUserId="11782" LastEditorUserId="11782" LastEditDate="2020-04-27T22:41:16.223" LastActivityDate="2020-04-27T22:41:16.223" Title="How to construct Deutsch's gate or $\pi/8$ rotations using Toffoli+Hadamard?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11713" PostTypeId="2" ParentId="11712" CreationDate="2020-04-27T17:47:28.920" Score="5" Body="&lt;p&gt;Toffoli and Hadamard are &lt;em&gt;computationally&lt;/em&gt; 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 &lt;em&gt;not&lt;/em&gt; universal in the sense that you can use them to construct any gate. In particular, there is no way to actually construct the &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; or the Deutsch gate (except for special angles), or to even approximate them.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-04-27T17:47:28.920" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="11714" PostTypeId="1" AcceptedAnswerId="11723" CreationDate="2020-04-27T20:07:14.343" Score="1" ViewCount="67" Body="&lt;p&gt;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, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_i \sum_j |a_i\rangle|b_i\rangle\langle c_j|\langle d_j| =$$&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ =\sum_i \sum_j |a_i\rangle \langle c_j| |b_i\rangle \langle d_j| $$&lt;/span&gt;&lt;br&gt;&#xA;and the reason for this is the following property of the tensor product:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(x \otimes y)^T(x \otimes y) = (x^Tx \otimes y^Ty) $$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I right?&lt;/p&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="10062" LastEditDate="2020-04-29T15:00:56.357" LastActivityDate="2020-04-29T15:00:56.357" Title="Composition of tensor product" Tags="&lt;density-matrix&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11715" PostTypeId="1" AcceptedAnswerId="11720" CreationDate="2020-04-27T23:07:30.883" Score="3" ViewCount="345" Body="&lt;p&gt;I ran the following code &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xqVK0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xqVK0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OyZN7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OyZN7.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TeVzm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TeVzm.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11555" LastActivityDate="2021-05-01T00:13:36.377" Title="Transpiling error in IBM Quantum Experience" Tags="&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11716" PostTypeId="2" ParentId="11715" CreationDate="2020-04-27T23:34:22.050" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-04-27T23:34:22.050" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11717" PostTypeId="1" AcceptedAnswerId="11721" CreationDate="2020-04-28T00:06:30.420" Score="1" ViewCount="43" Body="&lt;p&gt;Let us assume that we have a classical function &lt;span class=&quot;math-container&quot;&gt;$f:\{0\,;\,1\}^n\to\{0\,;\,1\}^m$&lt;/span&gt; which is efficiently computable. Then, its oracle is defined with &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_f\,|x\rangle\,|y\rangle=|x\rangle\,|y\oplus f(x)\rangle$&lt;/span&gt;. I quite often read that if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is efficiently computable, then so is &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_f$&lt;/span&gt;. Why is it the case? Where is the computational cost of evaluating &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; taken into account?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_f$&lt;/span&gt; is a permutation matrix, one can implement it with at most &lt;span class=&quot;math-container&quot;&gt;$2^{n+m}$&lt;/span&gt; SWAP gates, but this is not very efficient. What am I missing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2020-04-28T07:45:46.020" Title="On the complexity of an oracle for a classical function" Tags="&lt;physical-realization&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11718" PostTypeId="1" CreationDate="2020-04-28T00:47:00.793" Score="2" ViewCount="33" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11844" LastEditorUserId="5955" LastEditDate="2020-04-28T10:02:02.537" LastActivityDate="2020-04-28T10:02:02.537" Title="How can we apply Quantum Algorithms (Grover's to be specific) to edge coloring problem?" Tags="&lt;grovers-algorithm&gt;&lt;speedup&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11719" PostTypeId="2" ParentId="11706" CreationDate="2020-04-28T00:59:41.603" Score="2" Body="&lt;p&gt;You can also see this directly in Qiskit.  To see the cals visually you can do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;from qiskit.visualization import plot_error_map&#xA;provider = IBMQ.load_account()&#xA;backend = provider.backends.ibmq_rome&#xA;&#xA;plot_error_map(backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1bulX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1bulX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-04-28T00:59:41.603" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11720" PostTypeId="2" ParentId="11715" CreationDate="2020-04-28T04:17:07.507" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, simulator can be used for algorithms up to 32 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unexpected results on Melbourne are given by too deep circuit.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-28T04:17:07.507" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11721" PostTypeId="2" ParentId="11717" CreationDate="2020-04-28T07:45:46.020" Score="1" Body="&lt;p&gt;There are several different issues all bundled together here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the terminology that you're using is one of &lt;em&gt;oracles&lt;/em&gt;. The oracle model is different. There, each use of the oracle counts as &quot;1&quot;, 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-28T07:45:46.020" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11722" PostTypeId="2" ParentId="11675" CreationDate="2020-04-28T08:53:43.897" Score="1" Body="&lt;p&gt;A way that's perhaps more compact (if less terse), we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only nontrivial thing I used is &lt;span class=&quot;math-container&quot;&gt;$(\mathbb 1_A\otimes \langle i|_B) (O_A\otimes \mathbb 1_B)=O_A(\mathbb 1_A\otimes \langle i|_B)$&lt;/span&gt;, it's pretty clearly true, but to see it explicitely just write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\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) $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2020-04-28T08:53:43.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11723" PostTypeId="2" ParentId="11714" CreationDate="2020-04-28T09:46:37.370" Score="1" Body="&lt;p&gt;The simple answer is: yes...&lt;span class=&quot;math-container&quot;&gt;$ $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-04-28T09:46:37.370" CommentCount="0" CommunityOwnedDate="2020-04-28T09:46:37.370" ContentLicense="CC BY-SA 4.0" />
  <row Id="11724" PostTypeId="1" CreationDate="2020-04-28T10:14:42.520" Score="8" ViewCount="84" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9898" LastEditorUserId="55" LastEditDate="2020-10-12T21:26:07.917" LastActivityDate="2020-10-12T21:26:07.917" Title="Will two entangled qubits be affected by gravity?" Tags="&lt;entanglement&gt;&lt;foundations&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11725" PostTypeId="2" ParentId="11724" CreationDate="2020-04-28T10:35:59.777" Score="3" Body="&lt;p&gt;Let's start with the Bell state &lt;span class=&quot;math-container&quot;&gt;$\frac1{\sqrt2}(|01\rangle+|10\rangle)$&lt;/span&gt;. Let's further assume that the entire universe (or at least the parts of relevance) are pervaded by a static magnetic field along the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis, which I relate to the unitary evolution  &lt;span class=&quot;math-container&quot;&gt;$\exp(-itH_z)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you can see in this QUIRK circuit &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22],[%22%E2%97%A6%22,%22X%22],[%7B%22id%22:%22Z%5Eft%22,%22arg%22:%222%20t%22%7D,%7B%22id%22:%22Z%5Eft%22,%22arg%22:%22t%22%7D]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, the Bell states changes back and forth between&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac1{\sqrt2}(|01\rangle+|10\rangle)\leftrightarrow\frac{e^{i\phi}}{\sqrt2}(|01\rangle-|10\rangle), $$&lt;/span&gt;&#xA;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!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas you only catch up a global phase which is not measurable...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is &lt;a href=&quot;https://arxiv.org/pdf/1703.08036.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Space QUEST (QUantum Entanglement Space Test) mission proposal&quot;&lt;/a&gt; at the arxiv, to  &quot;...Experimentally test decoherence due to gravity&quot;. From  the abstract:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Some speculative theories suggest that quantum properties, such as entanglement, may exhibit entirely different behavior to purely classical systems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-04-30T07:50:05.447" LastActivityDate="2020-04-30T07:50:05.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11726" PostTypeId="1" AcceptedAnswerId="11727" CreationDate="2020-04-28T14:56:00.890" Score="1" ViewCount="145" Body="&lt;p&gt;I'm new in quantum computing, I have this question.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qubits &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; (column vector) and &lt;span class=&quot;math-container&quot;&gt;$A, B$&lt;/span&gt; are unitary matrices (&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; 8x8 and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; 4x4 matrix).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I'm not wrong the input of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$x_1 \otimes x_2 \otimes x_3$&lt;/span&gt; which is in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^8$&lt;/span&gt; (column vector). Now given the output &lt;span class=&quot;math-container&quot;&gt;$z=A(x_1 \otimes x_2 \otimes x_3)$&lt;/span&gt; how can I extract &lt;span class=&quot;math-container&quot;&gt;$y_3$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; to calculate &lt;span class=&quot;math-container&quot;&gt;$y_3 \otimes y_4$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$x_4 = y_4$&lt;/span&gt;) which is the input of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/drGwc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/drGwc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11847" LastEditorUserId="55" LastEditDate="2020-04-29T13:14:38.637" LastActivityDate="2020-04-29T13:14:38.637" Title="How do I compute the output of quantum circuit involving multiple gates?" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11727" PostTypeId="2" ParentId="11726" CreationDate="2020-04-28T15:19:28.117" Score="1" Body="&lt;p&gt;In general, you cannot just extract the part of the state that corresponds to &lt;span class=&quot;math-container&quot;&gt;$y_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_4$&lt;/span&gt;. Instead, you have to consider the entire state (which you will describe using a 16-element vector), and you apply to it the unitary &lt;span class=&quot;math-container&quot;&gt;$I\otimes B$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; identity matrix.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-28T15:19:28.117" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11729" PostTypeId="1" CreationDate="2020-04-28T17:36:02.800" Score="2" ViewCount="43" Body="&lt;p&gt;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)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; be a linear code (Lets suppose its a binary code, i.e. a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-dimensional subspace of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_2^n$&lt;/span&gt;). Show that &lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;Aside&lt;/strong&gt;: This exercise is key in understanding why CSS codes can correct both bit flip and phase flip errors.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The case where &lt;span class=&quot;math-container&quot;&gt;$x\in C^\perp$&lt;/span&gt; is trivial. It's the second case that is less so... I know the following: If &lt;span class=&quot;math-container&quot;&gt;$x\notin C^\perp$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$x\in C$&lt;/span&gt;. I can also see that the solution would follow if I could show that half the vectors &lt;span class=&quot;math-container&quot;&gt;$y\in C$&lt;/span&gt; were orthogonal to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Since this would imply that the other half are not orthogonal and we would have an equal number of &lt;span class=&quot;math-container&quot;&gt;$(+1)$&lt;/span&gt;'s coming from &lt;span class=&quot;math-container&quot;&gt;$x\cdot y=0$&lt;/span&gt; that would cancel out with the &lt;span class=&quot;math-container&quot;&gt;$(-1)$&lt;/span&gt;'s from the &lt;span class=&quot;math-container&quot;&gt;$x\cdot y=1$&lt;/span&gt; terms. Anyone have the missing piece or am I on the wrong track here.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="55" LastEditDate="2020-04-29T13:16:35.220" LastActivityDate="2020-04-29T13:16:35.220" Title="Identity for linear codes and their duals: why do we have $\sum_y (-1)^{x\cdot y}=|C|\delta_{x\in C^\perp}$?" Tags="&lt;mathematics&gt;&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11730" PostTypeId="1" AcceptedAnswerId="11731" CreationDate="2020-04-28T17:52:12.377" Score="3" ViewCount="86" Body="&lt;p&gt;This is related to exercise 4.34,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operation described can be written as &lt;span class=&quot;math-container&quot;&gt;$(H \otimes I)C^1(U)(H \otimes I)(|0\rangle \otimes |\psi\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can get to the point where the state of the system is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes(I+U)|\psi\rangle + |1\rangle \otimes(I-U)|\psi\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a Hermitian unitary with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; with corresponding eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|\lambda_-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\lambda_+\rangle$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however I am stuck on the final part that when measuring &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; the post-measurement state is given by the corresponding eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. This reduces down to to showing that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(I-U)|\psi\rangle = |\lambda_-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(I+U)|\psi\rangle = |\lambda_+\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried using the spectral decomp of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$(I\pm U)$&lt;/span&gt; reduces down to projectors for &lt;span class=&quot;math-container&quot;&gt;$|\lambda_\pm\rangle$&lt;/span&gt;, s.t. &lt;span class=&quot;math-container&quot;&gt;$P_{\pm}|\psi\rangle = c_{\pm}\lambda_\pm $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-- Update --&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An answer using projectors (as suspected) is using the fact that for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be unitary and Hermitian then &lt;span class=&quot;math-container&quot;&gt;$U = (2P - I)$&lt;/span&gt; for an orthogonal projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; (&lt;a href=&quot;https://math.stackexchange.com/questions/57148/matrices-which-are-both-unitary-and-hermitian&quot;&gt;https://math.stackexchange.com/questions/57148/matrices-which-are-both-unitary-and-hermitian&lt;/a&gt;), hence &lt;span class=&quot;math-container&quot;&gt;$(I+U)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(I-U)$&lt;/span&gt; reduce down to a projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and its orthogonal complement &lt;span class=&quot;math-container&quot;&gt;$2(I-P)$&lt;/span&gt;, thus projecting &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; onto the eigenvectors. &lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-04-29T03:30:14.270" LastActivityDate="2020-04-29T03:30:14.270" Title="Showing measurement of a Hermitian Unitary operator gives final states as eigenvectors" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11731" PostTypeId="2" ParentId="11730" CreationDate="2020-04-28T19:16:30.563" Score="2" Body="&lt;p&gt;Just need to write it out:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(I-U)|\psi\rangle &amp;amp;= I\big(c_+|\lambda_{-}\rangle + c_{-}|\lambda_{-}\rangle\big) - U\big(c_+|\lambda_{-}\rangle + c_{-}|\lambda_{-}\rangle\big) \\&#xA;&amp;amp;= c_+|\lambda_{+}\rangle + c_{-}|\lambda_{-}\rangle - \big(c_+|\lambda_{+}\rangle - c_{-}|\lambda_{-}\rangle\big) \\&#xA;&amp;amp;= c_+|\lambda_{+}\rangle + c_{-}|\lambda_{-}\rangle - c_+|\lambda_{+}\rangle + c_{-}|\lambda_{-}\rangle \\&#xA;&amp;amp;= c_{-}|\lambda_{-}\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've used &lt;span class=&quot;math-container&quot;&gt;$U(c_{-}|\lambda_{-}\rangle) = -c_{-}|\lambda_{-}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9282" LastActivityDate="2020-04-28T19:16:30.563" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11733" PostTypeId="2" ParentId="11729" CreationDate="2020-04-28T20:08:04.027" Score="1" Body="&lt;p&gt;Here is a lovely proof. Recall that we can think of any vector space as an abelian group, in particular the codespace &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is an abelian group (isomorphic to &lt;span class=&quot;math-container&quot;&gt;$Z_2^k$&lt;/span&gt;). The dot product &lt;span class=&quot;math-container&quot;&gt;$\varphi_x(y)=x\cdot y$&lt;/span&gt; is a group homomorphism &lt;span class=&quot;math-container&quot;&gt;$\varphi_x:C\rightarrow Z_2$&lt;/span&gt;. Provided that &lt;span class=&quot;math-container&quot;&gt;$x\notin C^\perp$&lt;/span&gt; the map is surjective which means that &lt;span class=&quot;math-container&quot;&gt;$K=ker(\varphi)$&lt;/span&gt; is an index 2 subgroup of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. It follows from Lagrange's theorem that &lt;span class=&quot;math-container&quot;&gt;$|K|=|C|/2$&lt;/span&gt; and the result follows.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-04-28T22:10:54.470" LastActivityDate="2020-04-28T22:10:54.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11734" PostTypeId="1" AcceptedAnswerId="11749" CreationDate="2020-04-28T21:49:29.157" Score="3" ViewCount="143" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt; &#xA;I'm looking for (unitary&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11734/5280&quot; title=&quot;If you need measurements in between, feel free, but I prefer methods without...&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;&lt;/a&gt;) transformations&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11734/5280&quot; title=&quot;Grover is ok, but it feels a bit like cheating...&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt;&lt;/a&gt;, to create a superposition of any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; computational basis states with equal coefficients. I'm further interested in the complexity of these implementations and/or a gate count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Building up on this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2310/5280&quot;&gt;question, on how to create superpositions of 3 states&lt;/a&gt;, I wonder how it scales to split up into any number of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; computational basis states. For simplicity let's always start with &lt;span class=&quot;math-container&quot;&gt;$\ket{00...0}$&lt;/span&gt;. Here are my thoughts:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n=5$&lt;/span&gt;: Split &lt;span class=&quot;math-container&quot;&gt;$\ket{000}\rightarrow \sqrt\frac25\ket{000}+ \sqrt\frac35\ket{001}$&lt;/span&gt; by a local &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-gate , then implement a controlled (trigger when the rightmost bit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;) split like &lt;span class=&quot;math-container&quot;&gt;$\ket{000}\rightarrow \sqrt{\frac12}(\ket{000}+\ket{010})$&lt;/span&gt; and finally a controlled (trigger when the leftmost bit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;) split like &lt;span class=&quot;math-container&quot;&gt;$\ket{001}\rightarrow \sqrt{\frac13}(\ket{001}+\ket{011}+\ket{111})$&lt;/span&gt;. For reference see &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22~ag9c%22%5D%2C%5B%22%E2%97%A6%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22~hql1%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22Y%5E%C2%BC%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%97%A6%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22Y%5E-%C2%BC%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~hql1%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%94%2C%E2%88%9A%E2%85%93%7D%2C%7B%E2%88%9A%E2%85%93%2C-%E2%88%9A%E2%85%94%7D%7D%22%7D%2C%7B%22id%22%3A%22~ag9c%22%2C%22name%22%3A%22Y2%3A3%22%2C%22matrix%22%3A%22%7B%7B%E2%88%9A%E2%85%96%2C-%E2%88%9A%E2%85%97%7D%2C%7B%E2%88%9A%E2%85%97%2C%E2%88%9A%E2%85%96%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;leftmost qubit is the top one&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n=6$&lt;/span&gt;: same as for &lt;span class=&quot;math-container&quot;&gt;$n=5$&lt;/span&gt; but after an local split into 2 equal halves on the first (rightmost/top) qubit, 2 controlled splits into 3 states are involved.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n=7$&lt;/span&gt;: again split in two parts with the weigths &lt;span class=&quot;math-container&quot;&gt;$\sqrt\frac37 :\sqrt\frac47$&lt;/span&gt; and further implement controlled splits...&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n=8$&lt;/span&gt;: trivial&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$n=9$&lt;/span&gt;: 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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; computational basis states?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you can improve my suggested implementations, let me know...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="55" LastEditDate="2020-04-29T13:20:01.820" LastActivityDate="2020-04-29T19:10:34.953" Title="What is the complexity of splitting a state into a superposition of $n$ computational basis states?" Tags="&lt;quantum-state&gt;&lt;gate-synthesis&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11735" PostTypeId="1" AcceptedAnswerId="11748" CreationDate="2020-04-28T22:23:35.497" Score="6" ViewCount="755" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question: Is there any other platform where it is possible to register for free and run programs on real quantum hardware?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-05-24T09:15:31.180" LastActivityDate="2020-05-24T09:15:31.180" Title="What are examples of quantum computing platforms availble for free (other than IBM Q)?" Tags="&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;quantum-inspire&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11736" PostTypeId="2" ParentId="11735" CreationDate="2020-04-28T22:23:35.497" Score="6" Body="&lt;p&gt;There is a platform &lt;em&gt;Quantum Inspire&lt;/em&gt; provided by QuTech, an organization co-founded by Delft University of Technology. Currently, the platform offers two real quantum processors:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Spin-2 - 2 qubits processor with qubits implemented as electron spins&lt;/li&gt;&#xA;&lt;li&gt;Starmon-5 - 5 qubits transmon processor&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The platform uses a programming language based on QASM. It is also possible to use Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.quantum-inspire.com/&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is a link to the platform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$&lt;/span&gt;. On IBM Q (processor Rome), I reached these results (4,096 shots on both platforms):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; - 4.13 %&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; - 50.68 %&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; - 43.29 %&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; - 1.9 %&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;On Quantum Inspire, the results were these&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; - Starmon-5: 9.1 %, Spin-2: 9.1 %&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; - Starmon-5: 44.2 %, Spin-2: 16.8 %&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; - Starmon-5: 43.4 %, Spin-2: 60.5 %&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; - Starmon-5: 3.2 %, Spin-2: 13.6 %&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-04-28T22:23:35.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11737" PostTypeId="1" CreationDate="2020-04-28T22:57:08.987" Score="1" ViewCount="37" Body="&lt;p&gt;I'm trying to solve QUBO problems using Qiskit QAOA and VQE solvers.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="11855" LastEditorUserId="55" LastEditDate="2020-04-29T13:22:01.443" LastActivityDate="2020-04-29T13:22:01.443" Title="Is there a limit to the size of problems that your simulators can run on Qiskit Aqua?" Tags="&lt;algorithm&gt;&lt;optimization&gt;&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11738" PostTypeId="1" CreationDate="2020-04-29T00:01:05.363" Score="2" ViewCount="85" Body="&lt;p&gt;I'm looking at papers like &lt;a href=&quot;https://arxiv.org/pdf/1902.01692.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Demonstration of teleportation-based error correction in the IBM quantum computer&lt;/a&gt; (page) 10 and &lt;a href=&quot;https://arxiv.org/pdf/1605.00527.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Role of syndrome information on a one-way quantum repeater using teleportation-based error correction&lt;/a&gt; (pages 3 and 4 and figure 2).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="6252" LastEditorUserId="9006" LastEditDate="2020-05-01T22:26:24.183" LastActivityDate="2020-05-01T22:26:24.183" Title="How does Teleportation based Error Correction (TEC) detect and correct loss/erasure errors?" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;error-correction&gt;&lt;teleportation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11740" PostTypeId="2" ParentId="11734" CreationDate="2020-04-29T01:19:04.713" Score="3" Body="&lt;p&gt;For large &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; the most efficient method I am aware of is to prepare a uniform superposition over &lt;span class=&quot;math-container&quot;&gt;$2^{\lceil \log_2(N) \rceil}$&lt;/span&gt; values with a bunch of Hadamard gates, then use a perfectly tuned Grover diffusion step to remove the unwanted states between &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2^{\lceil \log_2(N) \rceil}$&lt;/span&gt;. The cost of this approach is &lt;span class=&quot;math-container&quot;&gt;$O(\log N + \log 1/\epsilon)$&lt;/span&gt; gates (the &lt;span class=&quot;math-container&quot;&gt;$1/\epsilon$&lt;/span&gt; is from arbitrary angle rotations being approximated using a fixed gate set).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This method is explained in Figure 12 of &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt;. Beware that there is a sign error in the figure. The numerator in the angle calculations should be &lt;span class=&quot;math-container&quot;&gt;$L - 2^{\lfloor \log(L)\rfloor}$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$ 2^{\lfloor \log(L)\rfloor} - L$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A25%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B%22Chance7%22%5D%2C%5B%22Amps7%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;working example in Quirk&lt;/a&gt;, preparing a uniform superposition over 100 values. 100 is &lt;span class=&quot;math-container&quot;&gt;$25*2^2$&lt;/span&gt;, so this really reduces to the &lt;span class=&quot;math-container&quot;&gt;$N=25$&lt;/span&gt; case with two &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; qubits. The perfect angle for the diffusion is &lt;span class=&quot;math-container&quot;&gt;$\arccos(1 - 16/25)$&lt;/span&gt;, where the 25 comes from &lt;span class=&quot;math-container&quot;&gt;$N=25$&lt;/span&gt; and 16 is the smallest power of 2 less than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A25%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B%22Chance7%22%5D%2C%5B%22Amps7%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z46K7.png&quot; alt=&quot;Quirk circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can confirm that the construction works by clicking on the image to open quirk, changing the three &quot;25&quot;s in the circuit to &quot;23&quot;s, and seeing that the new output is a uniform superposition up to 4*23 = 92.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-04-29T19:10:34.953" LastActivityDate="2020-04-29T19:10:34.953" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11741" PostTypeId="1" CreationDate="2020-04-29T04:42:34.507" Score="1" ViewCount="78" Body="&lt;p&gt;I have been working on Qiksit. Is it possible to display just the angle of each gate in a circuit as an output?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the below code is my circuit is it possible to just print the angle of the gate. We have function &lt;code&gt;QuantumCircuit.count_ops()&lt;/code&gt; to display the gate counts similarly is there a way to do so?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;q2 = QuantumRegister(2)&#xA;circuit = QuantumCircuit(q2)&#xA;circuit.cu1(math.pi/2, q2[0], q2[1])&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="5955" LastEditDate="2020-04-29T08:52:32.100" LastActivityDate="2020-05-02T17:08:56.097" Title="Angle in qiskit" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11742" PostTypeId="2" ParentId="11741" CreationDate="2020-04-29T06:29:29.087" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;import math&#xA;q2 = QuantumRegister(2)&#xA;circuit = QuantumCircuit(q2)&#xA;circuit.cu1(math.pi/2, q2[0], q2[1])&#xA;for gate, _, _ in circuit._data:&#xA;    print(gate.params[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, instructions in Qiskit do not have a standardized interface, meaning not every gate will have &lt;code&gt;params[0]&lt;/code&gt; 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 &lt;code&gt;gate.defintion&lt;/code&gt; might help).&lt;/p&gt;&#xA;" OwnerUserId="9918" LastActivityDate="2020-04-29T06:29:29.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11744" PostTypeId="5" CreationDate="2020-04-29T07:18:03.483" Score="0" Body="&lt;p&gt;Quantum Inspire is free web-based quantum computing platform provided by QuTech, a joint research facility of Delft University of Technology and TNO, the Netherlands Organisation for Applied research. The platform provides two real quantum processors - Starmon-5 and Spin-2. First one is 5 qubits transmon processor, second one 2 qubits processor representing qubit with electron spin. The platform also provide 26 qubit simulator. A programming language used at the platform is a derivative of QASM.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="8141" LastEditDate="2020-06-09T12:50:36.993" LastActivityDate="2020-06-09T12:50:36.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11745" PostTypeId="4" CreationDate="2020-04-29T07:18:03.483" Score="0" Body="Used for question related to quantum computing platform Quantum Inspire provided by QuTech, a company co-founded by Delft University of Technology." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-29T07:18:03.483" LastActivityDate="2020-04-29T07:18:03.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11746" PostTypeId="2" ParentId="11734" CreationDate="2020-04-29T08:12:25.637" Score="2" Body="&lt;p&gt;I'd have thought your easiest method would be to prepare a uniform superposition of &lt;span class=&quot;math-container&quot;&gt;$m=\lceil\log_2 n\rceil$&lt;/span&gt; qubits using hadamard gates. Then introduce an ancilla. You can then compute a function &lt;span class=&quot;math-container&quot;&gt;$f(x):\{0,1\}^m\rightarrow\{0,1\}$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\sum_{x\in\{0,1\}^m}=n$&lt;/span&gt;. Any such function will do (this is the same marking function that you'd have in Grover's search).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, we simply measure the ancilla in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis. If it is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, you've got the state that you want. If it is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you've failed and you have to try again. However, the probability of failure is less than &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt;. Thus, on average, you only need two runs to be successful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, take something like &lt;span class=&quot;math-container&quot;&gt;$n=7$&lt;/span&gt;. Here, we have &lt;span class=&quot;math-container&quot;&gt;$m=3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is just&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x)=\left\{\begin{array}{cc}&#xA;0 &amp;amp; x=111 \\&#xA;1 &amp;amp; \text{otherwise}&#xA;\end{array}\right.&#xA;$$&lt;/span&gt;&#xA;This is just a controlled-controlled-controlled-not targetting the ancilla.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I haven't thought it through particularly carefully, but I think you can achieve a marking function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$O(m^2)$&lt;/span&gt; controlled-nots (because you shouldn't need more than &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; multi-controlled-nots).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-29T08:12:25.637" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11748" PostTypeId="2" ParentId="11735" CreationDate="2020-04-29T09:50:39.550" Score="5" Body="&lt;p&gt;Already mentioned is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;noreferrer&quot;&gt;IBM Quantum Experience&lt;/a&gt;, 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.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.quantum-inspire.com/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Inspire&lt;/a&gt; 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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also familiar with:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rigetti's &lt;a href=&quot;https://qcs.rigetti.com/request-access&quot; rel=&quot;noreferrer&quot;&gt;Forest platform&lt;/a&gt;, 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 &lt;a href=&quot;http://docs.rigetti.com/en/stable/&quot; rel=&quot;noreferrer&quot;&gt;Forest SDK&lt;/a&gt; containing pyQuil.&lt;/li&gt;&#xA;&lt;li&gt;A different approach: D-Wave's &lt;a href=&quot;https://www.dwavesys.com/software&quot; rel=&quot;noreferrer&quot;&gt;software platform&lt;/a&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/74/what-are-the-models-of-quantum-computation&quot;&gt;this excellent set of answers&lt;/a&gt; on this website by Neil de Beaudrap for an overview of all the different models.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I am sure there are more platforms that I am not familiar with!&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-04-29T09:50:39.550" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11749" PostTypeId="2" ParentId="11734" CreationDate="2020-04-29T14:39:27.223" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(m^2)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$m=\lceil\log_2(n)\rceil$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the value &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. We write &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; in binary as &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, comprising &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; bits. We know that the first (most significant) bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; must be 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We're going to describe an iterative protocol. In the first step, we start with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes m}$&lt;/span&gt;, and convert the first qubit to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{\frac{2^{m-1}}{n}}|0\rangle+\sqrt{\frac{n-2^{m-1}}{n}}|1\rangle.&#xA;$$&lt;/span&gt;&#xA;Controlled off the first qubit being 0, we apply Hadamard on all other qubits. This has got all the terms &lt;span class=&quot;math-container&quot;&gt;$|0y\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$y\in\{0,1\}^{m-1}$&lt;/span&gt; correct. Now we just have to worry about the &lt;span class=&quot;math-container&quot;&gt;$|1y\rangle$&lt;/span&gt; terms. If the second bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is 1, then we essentially just repeat the first step but for the &lt;span class=&quot;math-container&quot;&gt;$m-1$&lt;/span&gt; least significant bits, and controlling every operation off the first qubit being in 1. If the second bit of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$n=14$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$x=1101$&lt;/span&gt;), you'd do something like&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|0\rangle^{\otimes 4}&amp;amp;\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) \\&#xA;&amp;amp;\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) \\&#xA;&amp;amp;\rightarrow\sqrt\frac{6}{14}|1\rangle\sqrt\frac{2}{6}|10\rangle\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)+\ldots&#xA;\end{align*}&lt;/span&gt;&#xA;To see the complexity, we've got to loop over the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; bits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and each step, at worst, we have to perform a multi-controlled not, which can be decomposed in terms of &lt;span class=&quot;math-container&quot;&gt;$O(m)$&lt;/span&gt; controlled-nots.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xEYm3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xEYm3.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;In this circuit diagram, I defined &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U(x)|0\rangle=x|0\rangle+\sqrt{1-x^2}|1\rangle$&lt;/span&gt;. 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, &lt;span class=&quot;math-container&quot;&gt;$U(1/\sqrt{2})=H$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-04-29T14:46:55.327" LastActivityDate="2020-04-29T14:46:55.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11750" PostTypeId="1" CreationDate="2020-04-29T16:01:02.323" Score="1" ViewCount="29" Body="&lt;p&gt;I'm &lt;em&gt;still&lt;/em&gt; investigating the TFQ whitepaper.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;In one section of the paper, the authors say this with respect to Quantum Datasets&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In general, [a quantum dataset] might come from a given black-box source...&lt;br&gt;&#xA;  &lt;strong&gt;However, as current quantum computers cannot import quantum data from external sources,&lt;/strong&gt;&#xA;  the user has to specify quantum circuits which generate the data.&#xA;  Quantum datasets are prepared using unparameterized &lt;strong&gt;&lt;code&gt;cirq.Circuit&lt;/code&gt;&lt;/strong&gt; objects and are&#xA;  injected into the computational graph using &lt;strong&gt;&lt;code&gt;tfq.convert_to_tensor&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;As I would like to investigate datasets like (QM9, QM8, etc.) and was hoping there was a way to involve &lt;strong&gt;&lt;code&gt;TFQ/Cirq&lt;/code&gt;&lt;/strong&gt;, this has raised a few questions for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there current methods for importing datasets containing Quantum Data onto a Quantum Computer? Similarly, is it possible to use &lt;strong&gt;&lt;code&gt;TFQ or CIRQ&lt;/code&gt;&lt;/strong&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&#xA;" OwnerUserId="11517" LastActivityDate="2020-04-29T16:01:02.323" Title="Can We Currently Import Quantum Datasets (Datasets Containing Quantum Data) Onto NISQ-era Quantum Computers?" Tags="&lt;circuit-construction&gt;&lt;simulation&gt;&lt;cirq&gt;&lt;machine-learning&gt;&lt;models&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11752" PostTypeId="2" ParentId="4521" CreationDate="2020-04-29T17:36:15.710" Score="2" Body="&lt;p&gt;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 &lt;code&gt;0 -&amp;gt; 1&lt;/code&gt; and &lt;code&gt;1 -&amp;gt; 0&lt;/code&gt;, but more complex examples are possible.&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import numpy as np&#xA;&#xA;class QubitPlusGate(cirq.SingleQubitGate):&#xA;    def _unitary_(self):&#xA;        # Our input is q = a[0] + b[1]&#xA;        # And our output becomes q = b[0] + a[1]&#xA;        return np.array([[0, 1],&#xA;                         [1, 0]])&#xA;&#xA;    def _circuit_diagram_info_(self, args):&#xA;        return '[+1]'&#xA;&#xA;# Create a single line qubit&#xA;q0 = cirq.GridQubit(0, 0)&#xA;&#xA;circuit = cirq.Circuit(&#xA;    QubitPlusGate().on(q0),&#xA;    cirq.measure(q0)&#xA;)&#xA;&#xA;# Simulate the circuit several times.&#xA;simulator = cirq.Simulator()&#xA;result = simulator.run(circuit, repetitions=10)&#xA;print(&quot;Results:&quot;)&#xA;print(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you want to view more complex examples, it is best to dive into the &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/cirq/ops/common_gates.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code&lt;/a&gt; of some gates supplied by cirq itself, but the implementation architecture is exactly the same.&lt;/p&gt;&#xA;" OwnerUserId="11842" LastActivityDate="2020-04-29T17:36:15.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11753" PostTypeId="2" ParentId="11672" CreationDate="2020-04-29T18:59:49.733" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's start where the quantum world is still in order:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Now I perform a second Hadamard gate and re-group the terms: &#xA;  &lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2}\left[\left(|0\rangle(|x\rangle+|x'\rangle\right) + \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$&lt;/span&gt;&#xA;  Now I am ready to do a rotation on the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-axis of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$\tiny\pmatrix{\cos(\alpha)&amp;amp;-\sin(\alpha)\\\sin(\alpha)&amp;amp;\cos(\alpha)}$&lt;/span&gt;) on the first qubit. This leads to:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since I'm not sure where you want to go from here, I end...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-04-29T18:59:49.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11754" PostTypeId="1" AcceptedAnswerId="11755" CreationDate="2020-04-29T20:09:45.967" Score="4" ViewCount="111" Body="&lt;p&gt;Specifically, I'd like to see the &lt;code&gt;ibmq_london&lt;/code&gt; calibration file for April 15, 2020.&lt;/p&gt;&#xA;" OwnerUserId="11715" LastEditorUserId="9006" LastEditDate="2020-04-29T20:54:30.633" LastActivityDate="2020-04-29T20:54:30.633" Title="Is there an archive of IBMQ calibration data?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11755" PostTypeId="2" ParentId="11754" CreationDate="2020-04-29T20:34:39.483" Score="6" Body="&lt;p&gt;Historical calibration data are available for each device via the &lt;code&gt;backend.properties()&lt;/code&gt; method. It accepts a &lt;code&gt;datetime&lt;/code&gt; field.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from datetime import datetime&#xA;&#xA;t = datetime(day=15, month=4, year=2020, hour=10)&#xA;london_backend.properties(datetime=t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-04-29T20:34:39.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11756" PostTypeId="5" CreationDate="2020-04-29T21:08:28.103" Score="0" Body="&lt;p&gt;BB84 is a quantum key distribution protocol for quantum cryptography invented by Charles Bennett and Gilles Brassard in 1984. It is used for safe random key distribution between two parties. It also allows to detect an eavesdropper trying to catch the key.&lt;/p&gt;&#xA;&lt;p&gt;The protocol works as follows:&lt;/p&gt;&#xA;&lt;p&gt;Alice generates a qubit in one of 4 states &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle, |0\rangle, |+\rangle, |-\rangle \}$&lt;/span&gt; and sends it to Bob. The states &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; mean bit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; mean bit &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Upon receiving the qubit Bob measures it in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; basis or in &lt;span class=&quot;math-container&quot;&gt;$\{-,+\}$&lt;/span&gt; basis, chosen randomly. If Bob measured in say &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; basis and Alice sent &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; qubit, then Alice and Bob shared 1 bit of a secret key. What remains is to check that Bob used the right basis. This is done by using an open classical channel, for example Bob sends information which basis he used and Alice replies (also in open) is this basis right or not. If the basis is wrong, the bit is discarded.&lt;/p&gt;&#xA;&lt;p&gt;More information can be found in the original paper &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/2003/2003.06557.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum cryptography: Public key distribution and coin tossing&lt;/a&gt; or on &lt;a href=&quot;https://en.wikipedia.org/wiki/BB84&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="2105" LastEditDate="2021-04-19T07:53:16.003" LastActivityDate="2021-04-19T07:53:16.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11757" PostTypeId="4" CreationDate="2020-04-29T21:08:28.103" Score="0" Body="For questions related to quantum cryptography protocol BB84." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-29T21:08:28.103" LastActivityDate="2020-04-29T21:08:28.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11758" PostTypeId="5" CreationDate="2020-04-29T21:15:14.450" Score="0" Body="&lt;p&gt;Bell basis is composed of so-called Bell states:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This means that it described two qubit states. Or in other words, any two qubit state can be expressed as a linear combination of Bell states above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A state can be transformed to the Bell basis by operation &lt;span class=&quot;math-container&quot;&gt;$\mathrm{CNOT}(H \otimes I)$&lt;/span&gt;. An inverse operation, i.e. &lt;span class=&quot;math-container&quot;&gt;$(H \otimes I)\mathrm{CNOT}$&lt;/span&gt;, is used for a measuring in the Bell basis&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-29T21:15:14.450" LastActivityDate="2020-04-29T21:15:14.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11759" PostTypeId="4" CreationDate="2020-04-29T21:15:14.450" Score="0" Body="For questions related to Bell basis - i.e. converting a state to the Bell basis, working with such states and measuring in the basis." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-29T21:15:14.450" LastActivityDate="2020-04-29T21:15:14.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11760" PostTypeId="1" CreationDate="2020-04-30T07:27:05.557" Score="0" ViewCount="318" Body="&lt;p&gt;How to use Tensorflow and Qiskit to make a quantum neural network and recognize handwriting？&lt;/p&gt;&#xA;" OwnerUserId="8745" LastActivityDate="2020-05-02T08:19:16.683" Title="How to use Tensorflow and Qiskit to make a quantum neural network and recognize handwriting?" Tags="&lt;research&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11761" PostTypeId="1" CreationDate="2020-04-30T08:16:31.423" Score="2" ViewCount="20" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thinking about adiabtic quantum computation, I wonder about the following:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Can we speed up the adiabatic process if we split the target hamiltonian in commuting parts?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Given the standard setup in adiabatic QC to start with a groud state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_0}$&lt;/span&gt; of a known and easy to prepare system hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;, we gradually change the hamiltonian towards a target one &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt;, where the final ground state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_1}$&lt;/span&gt; resembles the solution of our problem. So&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(t)= (1-t) H_0 + t H_1.&#xA;$$&lt;/span&gt;&#xA;The critical thing is, to do that in nice and slowly way, such that we don't excite the system too much.&#xA;Responsible for the speed is the energy gap between ground and first excited state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we known, that a hamilton can be split into commuting parts, i.e. &lt;span class=&quot;math-container&quot;&gt;$H_1=\sum_k H_{1,k}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$[H_{1,a},H_{1,b}]_-=0;\forall a,b$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I assume that we now can evolve the system in parts like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(t)= (1-t_n) H_0 + \sum_{k=0}^{n-1} \operatorname{Ramp}(t_k,t_{k+1})H_{1_k},&#xA;$$&lt;/span&gt;&#xA;where &lt;a href=&quot;https://www.wolframalpha.com/input/?i=integral+%28theta%28x%29+-+theta%28x-1%29%29&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\operatorname{Ramp(t_k,t_{k+1})}$&lt;/span&gt; is a ramp-up function&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-04-30T08:16:31.423" Title="Can we speed up the adiabatic process if we split the target hamiltonian in commuting parts?" Tags="&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11764" PostTypeId="1" AcceptedAnswerId="11765" CreationDate="2020-04-30T10:58:50.623" Score="3" ViewCount="37" Body="&lt;p&gt;When a CNOT gate is applied to 2 qubits, one is known as the control qubit while the other is called target qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to what I understand, if the control qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then it &lt;strong&gt;flips the target qubit&lt;/strong&gt; otherwise it does nothing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to know whether there is some state of 2 qubits &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; such that when we apply CNOT on the two of them by which we can &lt;strong&gt;flip the control qubit when control qubit&lt;/strong&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and do nothing to the target qubit.&lt;/p&gt;&#xA;" OwnerUserId="11868" LastEditorUserId="9006" LastEditDate="2020-04-30T16:17:35.387" LastActivityDate="2020-04-30T16:17:35.387" Title="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?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11765" PostTypeId="2" ParentId="11764" CreationDate="2020-04-30T11:11:11.483" Score="6" Body="&lt;p&gt;Yes. What you want to make use of, essentially, is the identity&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ywqkA.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ywqkA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;meaning that single-qubit rotations can effectively reverse the controlled-not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, if we input the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|-\rangle$&lt;/span&gt; to controlled-not, the output is &lt;span class=&quot;math-container&quot;&gt;$|-\rangle|-\rangle$&lt;/span&gt;, so the control qubit has flipped its value to an orthogonal state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-04-30T11:11:11.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11766" PostTypeId="1" AcceptedAnswerId="11767" CreationDate="2020-04-30T11:42:46.210" Score="3" ViewCount="55" Body="&lt;p&gt;What is the best option for South America Brazil to configure: &lt;code&gt;provider.get_backend ('')&lt;/code&gt;, because &lt;code&gt;melbourne_16&lt;/code&gt; is very slow.&lt;/p&gt;&#xA;" OwnerUserId="11859" LastEditorUserId="55" LastEditDate="2020-05-01T14:01:16.177" LastActivityDate="2020-05-01T14:01:16.177" Title="What is the best IBMQ provider to South America?" Tags="&lt;algorithm&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11767" PostTypeId="2" ParentId="11766" CreationDate="2020-04-30T12:45:10.013" Score="6" Body="&lt;p&gt;The names of the chips are (sadly) not where they are actually located. I would recommend using &lt;code&gt;least_busy&lt;/code&gt; 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&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;device = least_busy(provider.backends(simulator=False))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if you really don't want to wait, you can use a &lt;code&gt;NoiseModel&lt;/code&gt; 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 &lt;a href=&quot;https://qiskit.org/documentation/apidoc/aer_noise.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;,&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-04-30T12:45:10.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11768" PostTypeId="1" AcceptedAnswerId="11795" CreationDate="2020-04-30T13:25:25.060" Score="0" ViewCount="59" Body="&lt;p&gt;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 &amp;lt; n qubits) and B (remaining n-m qubits). No tutorial nor material on the internet addressed this specific task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More practically in python, let &#xA;&lt;code&gt;rhoAB = Qobj=(np.random.rand(8,8))&lt;/code&gt;, and assume that this is a valid density operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How should I call &lt;em&gt;entropy_mutual&lt;/em&gt; so that I can get this measure between A and B, in particular, regarding the arguments &lt;em&gt;selA&lt;/em&gt; and &lt;em&gt;selB&lt;/em&gt;? Ideally, I would call something like &lt;code&gt;entopy_mutual(rhoAB, selA=[1], selB=[2,3])&lt;/code&gt; but this not the approach how the function interprets the subsystems and their respective dimensions.&lt;/p&gt;&#xA;" OwnerUserId="11880" LastActivityDate="2020-05-01T16:38:36.717" Title="Using entropy_mutual function in QuTiP" Tags="&lt;entropy&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11769" PostTypeId="1" CreationDate="2020-04-30T16:47:50.447" Score="4" ViewCount="80" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;amp; Chuang) there is a point (following step 6) where Alice and Bob have both obtained &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; shared bits. In the next step of the protocol, they will ``sacrifice'' &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of their secret bits to check for the presence of an eavesdropper. This check consists of Alice and Bob comparing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of their bits for inconsistencies by publicly declaring them over the classical channel. Define an observable error rate &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt; and an error threshold &lt;span class=&quot;math-container&quot;&gt;$e_{thresh}$&lt;/span&gt;, so that Alice and Bob abort the protocol if they detect &lt;span class=&quot;math-container&quot;&gt;$en$&lt;/span&gt; errors for &lt;span class=&quot;math-container&quot;&gt;$e&amp;gt;e_{thresh}$&lt;/span&gt;, and proceed otherwise. My question is the following:&lt;/p&gt;&#xA;&lt;p&gt;What can we say about the value of &lt;span class=&quot;math-container&quot;&gt;$e_{thres}$&lt;/span&gt;, in particular at what point can Alice and Bob not establish any secure bits?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors, and thus if &lt;span class=&quot;math-container&quot;&gt;$en&amp;gt;t$&lt;/span&gt; they cannot recover the information. This can also be done classically through the so-called &lt;em&gt;information reconciliation&lt;/em&gt; protocol, but I don't understand the limitations of this protocol (so any help on this point would also be appreciated).&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: In fact, because of the noiseless quantum channel we should be perhaps thinking about the following attack, with prob &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt; the eavesdropper measures on the right basis and obtains a bit of information, and with prob &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="7429" LastEditDate="2021-01-21T17:07:21.230" LastActivityDate="2021-01-21T17:07:21.230" Title="In the BB84 protocol, for what error thresholds can Alice and Bob not establish secure bits?" Tags="&lt;cryptography&gt;&lt;communication&gt;&lt;bb84&gt;&lt;qkd&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11770" PostTypeId="1" AcceptedAnswerId="12144" CreationDate="2020-04-30T18:35:04.287" Score="2" ViewCount="194" Body="&lt;p&gt;I am working my through the Strawberry Fields documentation &amp;amp; the section on &lt;a href=&quot;https://web.archive.org/web/20190516231522/https://strawberryfields.readthedocs.io/en/latest/algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;state teleportation&lt;/a&gt; states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.archive.org/web/20190213182823/https://strawberryfields.readthedocs.io/en/latest/_images/teleport.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://web.archive.org/web/20190213182823/https://strawberryfields.readthedocs.io/en/latest/_images/teleport.svg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Here, qumodes &lt;span class=&quot;math-container&quot;&gt;$q1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q2$&lt;/span&gt; are initially prepared as (the unphysical) infinitely squeezed vacuum states in momentum and position space respectively,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{split}&amp;amp;{|0\rangle}_x \sim \lim_{z\rightarrow\infty} S(z){|0\rangle}\\&#xA;&amp;amp;{|0\rangle}_p \sim \lim_{z\rightarrow-\infty} S(z){|0\rangle}=\frac{1}{\sqrt{\pi}}\int_{-\infty}^\infty {|x\rangle}~dx\end{split}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Related: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5187/quantum-teleportation-over-continuous-variables&quot;&gt;Quantum teleportation over continuous variables?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Additionally, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0402202&quot; rel=&quot;nofollow noreferrer&quot;&gt;Constructing finite dimensional codes with optical continuous variables&lt;/a&gt; mentions &amp;quot;superpositions of an infinite number of infinitely squeezed states&amp;quot; in the introduction.&lt;/p&gt;&#xA;&lt;p&gt;My primary question is, &lt;em&gt;what is an infinitely squeezed state &amp;amp; how are they used in practice?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Additionally, what is meant by unphysical? Does this mean purely mathematical?&lt;/p&gt;&#xA;" OwnerUserId="2645" LastEditorUserId="45" LastEditDate="2020-12-28T13:21:06.930" LastActivityDate="2020-12-28T13:21:06.930" Title="What is infinite squeezing?" Tags="&lt;mathematics&gt;&lt;photonics&gt;&lt;continuous-variable&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11771" PostTypeId="1" AcceptedAnswerId="11781" CreationDate="2020-04-30T20:17:42.683" Score="3" ViewCount="269" Body="&lt;p&gt;An N-qubit stabilizer state is a state that can be produced by starting from the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes N}$&lt;/span&gt; state and applying only H, CNOT, and S gates. How many N-qubit stabilizer states are there?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because every stabilizer state can be &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504117&quot; rel=&quot;nofollow noreferrer&quot;&gt;represented as a graph states&lt;/a&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$2^{(N^2)} 24^N$&lt;/span&gt; stabilizer states over &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-04-30T23:02:27.430" LastActivityDate="2020-04-30T23:22:10.463" Title="How many N-qubit stabilizer states are there?" Tags="&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11772" PostTypeId="1" AcceptedAnswerId="11777" CreationDate="2020-04-30T20:23:52.757" Score="2" ViewCount="102" Body="&lt;p&gt;I'm new to using Qiskit Aqua, and I'm trying to get the intermediate values in the VQE algorithm to study the convergence. &lt;a href=&quot;https://qiskit.aqua.algorithms.adaptive.VQE.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The documentation&lt;/a&gt; mentions an internal callback function, but I can't figure out how to use it. Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11884" LastEditorUserId="9006" LastEditDate="2020-04-30T20:58:55.623" LastActivityDate="2020-04-30T21:19:17.463" Title="How do I get intermediate values of VQE algorithm using callback?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11773" PostTypeId="5" CreationDate="2020-04-30T21:04:59.330" Score="0" Body="" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:04:59.330" LastActivityDate="2020-04-30T21:04:59.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11774" PostTypeId="4" CreationDate="2020-04-30T21:04:59.330" Score="0" Body="The tag is used for questions connected with information theory in classical and/or quantum sense." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:04:59.330" LastActivityDate="2020-04-30T21:04:59.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11775" PostTypeId="5" CreationDate="2020-04-30T21:11:54.797" Score="0" Body="&lt;p&gt;A quantum computing (and quantum mechanics) is probabilistic by nature, therefore probability theory is an inseparable part of quantum computing and quantum information theory.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:11:54.797" LastActivityDate="2020-04-30T21:11:54.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11776" PostTypeId="4" CreationDate="2020-04-30T21:11:54.797" Score="0" Body="Used for questions dealing with probability theory application in quantum computing." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:11:54.797" LastActivityDate="2020-04-30T21:11:54.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11777" PostTypeId="2" ParentId="11772" CreationDate="2020-04-30T21:19:17.463" Score="1" Body="&lt;p&gt;Check out this tutorial notebook &lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/blob/master/aqua/vqe_convergence.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-community-tutorials/blob/master/aqua/vqe_convergence.ipynb&lt;/a&gt; which should answer what you need&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-04-30T21:19:17.463" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11778" PostTypeId="1" AcceptedAnswerId="11782" CreationDate="2020-04-30T21:44:42.040" Score="1" ViewCount="80" Body="&lt;p&gt;Qiskit allows a user to directly access IBM Q quantum processors (both real ones and simulator). Each user is given a &lt;em&gt;personal code&lt;/em&gt; which is entered into source code and serves as a login to the IBM Q platform.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; Is there a similar possibility in MatLab? In other words, is there any module/code in MatLab allowing to access IBM Q processors?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:50:17.600" LastActivityDate="2020-06-10T17:15:03.500" Title="Access IBM Q processors from MatLab" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;matlab&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11779" PostTypeId="5" CreationDate="2020-04-30T21:49:15.113" Score="0" Body="&lt;p&gt;MatLab is one of the most widely used programs for scientific computation and simulations. It offers many tools including optimization, machine learning, statistics, finance maths, signal processing etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because of the capabilities mentioned above, MatLab can be used in quantum computing as well, mainly for simulations of quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:49:15.113" LastActivityDate="2020-04-30T21:49:15.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11780" PostTypeId="4" CreationDate="2020-04-30T21:49:15.113" Score="0" Body="The tag is used for questions related to MatLab application in quantum computing." OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-04-30T21:49:15.113" LastActivityDate="2020-04-30T21:49:15.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11781" PostTypeId="2" ParentId="11771" CreationDate="2020-04-30T22:58:36.777" Score="6" Body="&lt;p&gt;There are &lt;span class=&quot;math-container&quot;&gt;$S(n) = 2^n \prod_{i=1}^n (2^i + 1)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit stabilizer states, as per Corollary 21 of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0602001&quot; rel=&quot;noreferrer&quot;&gt;D. Gross, &lt;em&gt;Hudson's Theorem for finite-dimensional quantum systems&lt;/em&gt;, J. Math. Phys. 47, 122107 (2006)&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some simple-to-state bounds on &lt;span class=&quot;math-container&quot;&gt;$S(n)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2^{(n^2 + 3n)/2} \leq S(n) \leq 3 \cdot 2^{(n^2 + 3n)/2}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11887" LastEditorUserId="119" LastEditDate="2020-04-30T23:22:10.463" LastActivityDate="2020-04-30T23:22:10.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11782" PostTypeId="2" ParentId="11778" CreationDate="2020-04-30T23:58:07.960" Score="3" Body="&lt;p&gt;As far as I know, there is no MatLab library for the IBM quantum experience. It may be possible to call &lt;a href=&quot;https://www.mathworks.com/help/matlab/getting-started-with-python.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit from Matlab&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9863" LastEditorUserId="9863" LastEditDate="2020-06-10T17:15:03.500" LastActivityDate="2020-06-10T17:15:03.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11783" PostTypeId="1" AcceptedAnswerId="11789" CreationDate="2020-05-01T00:24:31.153" Score="3" ViewCount="457" Body="&lt;p&gt;I come from a CS background&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was reading Neven and Farhi's paper (&quot;Classification with Quantum Neural Networks on near Term Processors&quot;), and I am trying to implement the subset parity problem using Qiskit, and solve it using a quantum Neural Network.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is one thing that doesn't make sense to me though. In the paper, they measure &quot;the Pauli Y gate on the readout qubit&quot; (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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Through various research, I was able to determine that, for this problem &quot;to measure the Pauli Y gate the readout qubit&quot;, I had to apply &lt;span class=&quot;math-container&quot;&gt;$HS^{\dagger}$&lt;/span&gt; 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 ?)&lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="55" LastEditDate="2020-05-01T13:51:46.177" LastActivityDate="2020-05-01T13:51:46.177" Title="Why can I apply $HS^\dagger$ and then measure in the computational basis to measure $Y$?" Tags="&lt;measurement&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11784" PostTypeId="1" CreationDate="2020-05-01T01:24:09.547" Score="1" ViewCount="133" Body="&lt;p&gt;I was using qiskit to generate all of the Bell States. I created the following circuits for each state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle :$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zipj8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zipj8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle :$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vLdpn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vLdpn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle :$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bWtOe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bWtOe.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle :$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EGtMZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EGtMZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$|\Psi^\pm\rangle$&lt;/span&gt; states were creating CNOTs with X gates before, that way we have a CNOT that acts when the control qubit is set to zero.&lt;/p&gt;&#xA;&lt;p&gt;When I execute the first 3 circuits in Qiskit, I get the expected state vectors. However, when I execute the last one, I get &lt;span class=&quot;math-container&quot;&gt;$\frac{(-|01\rangle + |10\rangle)}{\sqrt{2} }$&lt;/span&gt;. I can see that the state vector is  &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt; 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 &amp;quot;normal&amp;quot; CNOT, X and Z?&lt;/p&gt;&#xA;" OwnerUserId="8377" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-01T01:24:09.547" Title="Creating Bell States with CNOT conditioned to the control qubit being set to zero" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;bell-basis&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11786" PostTypeId="1" AcceptedAnswerId="11788" CreationDate="2020-05-01T02:18:56.303" Score="2" ViewCount="113" Body="&lt;p&gt;The Bernstein-Vazirani problem: &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; be a function from bit strings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; to a single bit,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f: \{ 0, 1\}^n \to \{0, 1\} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thus all input bit strings &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt;. There exists a secret string &lt;span class=&quot;math-container&quot;&gt;$s \in \{0,1\}^n$&lt;/span&gt; such that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ f(x) = x\cdot s$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; denotes the inner product mod 2. Find &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; by querying &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; as a few times as possible. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;This problem can be solved using 1 query using QFT. The algorithm construction only uses an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, Hadamard (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;) gates, and &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Now, according to the Gottesman-Knill theorem, quantum algorithms which utilise only the&#xA;operations belonging to a certain restricted set (Clifford group &lt;span class=&quot;math-container&quot;&gt;$C_n$&lt;/span&gt;, which is nothing but the normalizer of the Pauli group &lt;span class=&quot;math-container&quot;&gt;$P_n$&lt;/span&gt;) are efficiently simulable classically. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that if you want to develop a classical algorithm then you do have to query the oracle &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times... but can't we just implement the entire circuit classically in polynomial time based on the Gottesman-Knill theorem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What am I missing here? Thank you! &lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="55" LastEditDate="2020-10-12T21:25:56.547" LastActivityDate="2020-10-12T21:25:56.547" Title="Speed up in Bernstein-Vazirani algorithm and Gottesman-Knill theorem" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;bernstein-vazirani-algorithm&gt;&lt;gottesman-knill&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11787" PostTypeId="1" AcceptedAnswerId="11790" CreationDate="2020-05-01T06:19:46.570" Score="1" ViewCount="51" Body="&lt;p&gt;I am wondering what is the equivalent to the import bellow in the current version of Qiskit?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.tools.qcvv.tomography as tomography&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10478" LastEditorUserId="9006" LastEditDate="2020-05-01T06:24:28.597" LastActivityDate="2020-05-01T08:10:47.860" Title="Tomography library in Qiskit?" Tags="&lt;qiskit&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11788" PostTypeId="2" ParentId="11786" CreationDate="2020-05-01T07:45:14.583" Score="2" Body="&lt;p&gt;There are two different aspects to your question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, nobody should be claiming that you can solve this exponentially faster on a quantum computer. If I evaluate &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; just &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times using &lt;span class=&quot;math-container&quot;&gt;$x=1000..0, 01000...0, 00100..0, ... , 00...001$&lt;/span&gt;, then each time I find a particular bit value of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, and hence I find &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; function calls. This is only polynomially worse than the 1 function call in the quantum algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I should, however, mention the second point: that while you list the gates used: &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and cNOT, you leave out a very important &quot;gate&quot;: the oracle itself. Do you &lt;em&gt;know&lt;/em&gt; that if you were to decompose the oracle's function in terms of gates that you could certainly write it in terms of just &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-01T07:45:14.583" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11789" PostTypeId="2" ParentId="11783" CreationDate="2020-05-01T07:57:50.010" Score="3" Body="&lt;p&gt;Your normal measurement is a pauli-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurement. If you apply a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; just before measurement, this transforms the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurement into &lt;span class=&quot;math-container&quot;&gt;$U^\dagger ZU$&lt;/span&gt;. So, any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that transforms &lt;span class=&quot;math-container&quot;&gt;$U^\dagger ZU=Y$&lt;/span&gt; will do the job. One convenient way of doing this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{Y+Z}{\sqrt{2}},&#xA;$$&lt;/span&gt;&#xA;but your choice will also work:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;SHZHS^\dagger=SXS^\dagger=-iS^2X=-iZX=Y&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to know why it's the transformation &lt;span class=&quot;math-container&quot;&gt;$U^\dagger ZU$&lt;/span&gt;, well think about a circuit with input &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that has a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; enacted upon it, and then it's measured in the standard basis. The probability of getting the 0 answer is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle 0|U|\psi\rangle|^2,&#xA;$$&lt;/span&gt;&#xA;which is the same as the probability that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$U^\dagger|0\rangle$&lt;/span&gt;. This corresponds to a measurement projector &lt;span class=&quot;math-container&quot;&gt;$U^\dagger |0\rangle\langle 0|U$&lt;/span&gt;, so you can see that transformation starting to come out.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-01T07:57:50.010" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11790" PostTypeId="2" ParentId="11787" CreationDate="2020-05-01T08:10:47.860" Score="0" Body="&lt;p&gt;The import should be replaced by:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.ignis.verification.tomography as tomo&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;As documented &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#release-notes-0-9-0-upgrade-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10478" LastActivityDate="2020-05-01T08:10:47.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11791" PostTypeId="2" ParentId="11783" CreationDate="2020-05-01T09:44:24.303" Score="3" Body="&lt;p&gt;&lt;strong&gt;Measurement in &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis&lt;/strong&gt; means that we want to measure is the qubit in &lt;span class=&quot;math-container&quot;&gt;$|+i\rangle$&lt;/span&gt; state or &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle$&lt;/span&gt; state which are eigenbasis vectors for &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate. Because they are eigenbasis vectors we can express any &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle$&lt;/span&gt; state in this form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_1 \rangle = \alpha_{+i} |+i\rangle + \alpha_{-i} |-i\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{+i}|^2$&lt;/span&gt; is the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|+i\rangle$&lt;/span&gt; state and &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{-i}|^2$&lt;/span&gt; is the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle$&lt;/span&gt;. And&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|+i\rangle = |0\rangle + i |1\rangle&#xA;\qquad&#xA;|-i\rangle = |0\rangle - i |1\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now when we apply &lt;span class=&quot;math-container&quot;&gt;$HS^{\dagger}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle$&lt;/span&gt; state, we will obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_2 \rangle = \alpha_{+i} |0\rangle + \alpha_{-i} |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, with &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{+i}|^2$&lt;/span&gt; we will measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (the same probability that we had for &lt;span class=&quot;math-container&quot;&gt;$|+i \rangle$&lt;/span&gt; measurment in the initial &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;), and with with &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{-i}|^2$&lt;/span&gt; we will measure &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (the same probability that we had for &lt;span class=&quot;math-container&quot;&gt;$| -i \rangle$&lt;/span&gt; measurment in the initial &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;). For any gate that will do &lt;span class=&quot;math-container&quot;&gt;$U |+i\rangle = e^{i \varphi_1} |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U |-i\rangle = e^{i \varphi_2}|1\rangle$&lt;/span&gt; mapping (where &lt;span class=&quot;math-container&quot;&gt;$\varphi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi_2$&lt;/span&gt; are some phases that will not have any influence on probabilities), we will have this correspondence. For example, if I understand this Riggeti's &lt;a href=&quot;https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/pyvqe/vqe.py#L264&quot; rel=&quot;nofollow noreferrer&quot;&gt;code&lt;/a&gt; right, they are doing &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis measurement by applying firstly &lt;span class=&quot;math-container&quot;&gt;$U = R_x(\pi /2)$&lt;/span&gt; gate that maps &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi /2) |+i\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi /2) |-i\rangle = -i|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The other thing is to &lt;strong&gt;measure the expectation value of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operator&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi_1 | Y | \psi_1 \rangle = |\alpha_{+i}|^2 - |\alpha_{-i}|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;that can easily be calculated after enough measurements in the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis. Here we took into accout that &lt;span class=&quot;math-container&quot;&gt;$Y|+i\rangle = (+1)|+i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y|-i\rangle = (-1)|-i\rangle$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{+i}|^2 = \frac{N_{+i}}{N}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha_{-i}|^2 = \frac{N_{-i}}{N}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of measurements, &lt;span class=&quot;math-container&quot;&gt;$N_{+i}$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$| +i \rangle$&lt;/span&gt; measurements, and &lt;span class=&quot;math-container&quot;&gt;$N_{-i}$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$| -i \rangle$&lt;/span&gt; measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess in the paper they mean &lt;strong&gt;expectation value of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operator&lt;/strong&gt;, not just one simple measurement in the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis, because of this line &quot;Our predicted label value is the real number between &lt;span class=&quot;math-container&quot;&gt;$−1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;... which is the average of the observed outcomes if &lt;span class=&quot;math-container&quot;&gt;$Y_{n+1}$&lt;/span&gt; is measured in multiple copies of...&quot;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-01T10:06:50.360" LastActivityDate="2020-05-01T10:06:50.360" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11792" PostTypeId="2" ParentId="9597" CreationDate="2020-05-01T15:05:46.830" Score="1" Body="&lt;p&gt;Elitzur and Vaidman showed in 1993 that a single qubit in superposition can be used to detect the presence or absence of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Elitzur%E2%80%93Vaidman_bomb_tester&quot; rel=&quot;nofollow noreferrer&quot;&gt;bomb&lt;/a&gt; without the bomb necessarily going off!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also really like O'Donnell's lecture on the Elitzur-Vaidman bomb tester &lt;a href=&quot;https://www.youtube.com/watch?v=8jW5ArmHLOI&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.  With the naive experiment, there is a 50% chance that the bomb will still go off; O'Donnell describes a nice improvement where the same qubit is rotated by &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; degrees for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times - the probability that the bomb is present and yet still goes off decreases as &lt;span class=&quot;math-container&quot;&gt;$\epsilon^2$&lt;/span&gt; .&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-05-02T02:56:11.733" LastActivityDate="2020-05-02T02:56:11.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11793" PostTypeId="2" ParentId="11769" CreationDate="2020-05-01T15:25:46.177" Score="1" Body="&lt;p&gt;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%. &lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-05-01T15:25:46.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11794" PostTypeId="1" CreationDate="2020-05-01T15:45:32.383" Score="2" ViewCount="49" Body="&lt;p&gt;An interesting optimization of Grover's quantum algorithm is discussed in Sysoev's paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1401.6030&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reference paper&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use the usual notation.  &lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt; ,  the number of all possible n-bit strings . The oracle  &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; can be put in the form  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_\omega=I - 2  (\vert\omega\rangle\langle\omega \vert )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; is a reflection of any vector on the hyperplane orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vector &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle $&lt;/span&gt; and operator &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt; are introduced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle = H \vert 0 \rangle^n$&lt;/span&gt; , where H is the n-qubit Hadamard transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operator &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt; reflects any vector with respect to &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_s = 2\vert s \rangle \langle s \vert - I$&lt;/span&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Grover iteration is &lt;span class=&quot;math-container&quot;&gt;$U_{Grover} = U_s U_\omega$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{Grover}$&lt;/span&gt; rotates (at every iteration) the initial vector &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; towards the desired vector &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt; by the angle &lt;span class=&quot;math-container&quot;&gt;$2\theta$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$sin\theta =  \frac{1}{\sqrt{N}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We note that a reflection is expressed by a unitary matrix, so if we know the algebraic form of a vector &lt;span class=&quot;math-container&quot;&gt;$\vert\zeta\rangle$&lt;/span&gt; then we can physically construct the quantum circuit that implements the operator &lt;span class=&quot;math-container&quot;&gt;$U_\zeta$&lt;/span&gt; which reflects any vector with respect to &lt;span class=&quot;math-container&quot;&gt;$\vert\zeta\rangle$&lt;/span&gt; .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider then the following modified Grover algorithm,  following  Sysoev,  but not exactly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 1&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \zeta_1 \rangle  = U_s U_\omega \vert s \rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the constructed  quantum circuit implementing the operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{\zeta_1} = 2\vert\zeta_1\rangle\langle\zeta_1\vert - I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \zeta_2 \rangle  = U_{\zeta_1} U_\omega \vert {\zeta_1} \rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the constructed  quantum circuit implementing the operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{\zeta_2} = 2\vert\zeta_2\rangle\langle\zeta_2\vert - I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 3&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \zeta_3 \rangle  = U_{\zeta_2} U_\omega \vert {\zeta_2} \rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the constructed  quantum circuit implementing the operator &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{\zeta_3} = 2\vert\zeta_3\rangle\langle\zeta_3\vert - I$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;................................and so on..........&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Step &lt;span class=&quot;math-container&quot;&gt;$[log_2 N] $&lt;/span&gt;(approximately in a neighborhood of n  where we stop,  see note below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \zeta_n \rangle  = U_{\zeta_{n-1}} U_\omega \vert \zeta_{n-1} \rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measurement and stop.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So at each step, the current vector is reflected on the hyperplane orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt; and then we further reflect this reflection with respect to the current vector itself.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm rotates the initial vector &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; towards the solution following the sequence:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta  , 3\theta, 9\theta , .......3^k \theta$&lt;/span&gt; .....&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The optimal stopping time will be in a neighborhood of &lt;span class=&quot;math-container&quot;&gt;$[log_2 N]$&lt;/span&gt; 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  &lt;span class=&quot;math-container&quot;&gt;$[log_2 N]$&lt;/span&gt;. The probability of getting very close to the target vector &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt; becomes sufficiently  high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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  &lt;span class=&quot;math-container&quot;&gt;$U_{\zeta_k}$&lt;/span&gt;  for &lt;span class=&quot;math-container&quot;&gt;$k \in \{1, 2, 3, ...., [log_2 N]\}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$[\sqrt N]$&lt;/span&gt;  for a chosen N.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;.  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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1&lt;/strong&gt; We consider the operator U defined by the relation:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U(\vert x \rangle , \vert y \rangle  ) = ( \vert x \rangle , U_x \vert y \rangle) $&lt;/span&gt;  , where  &lt;span class=&quot;math-container&quot;&gt;$U_x \vert y \rangle$&lt;/span&gt; represents the reflection of &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt;  with respect to &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We have then the relations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.......................and so on..........................&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another possibility is the following  (state &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; is known):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.......................and so on..........................&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit 2&lt;/strong&gt;. 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. &lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="10110" LastEditDate="2020-05-09T07:27:08.270" LastActivityDate="2020-05-09T07:27:08.270" Title="A question about Sysoev's extension of Grover's algorithm" Tags="&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11795" PostTypeId="2" ParentId="11768" CreationDate="2020-05-01T16:38:36.717" Score="1" Body="&lt;p&gt;Best to look at the source code when the documentation isn't helpful enough. The definition of entropy_mutual is &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def entropy_mutual(rho, selA, selB, base=e, sparse=False):&#xA;    &quot;&quot;&quot;&#xA;    Calculates the mutual information S(A:B) between selection&#xA;    components of a system density matrix.&#xA;&#xA;    Parameters&#xA;    ----------&#xA;    rho : qobj&#xA;        Density matrix for composite quantum systems&#xA;    selA : int/list&#xA;        `int` or `list` of first selected density matrix components.&#xA;    selB : int/list&#xA;        `int` or `list` of second selected density matrix components.&#xA;    base : {e,2}&#xA;        Base of logarithm.&#xA;    sparse : {False,True}&#xA;        Use sparse eigensolver.&#xA;&#xA;    Returns&#xA;    -------&#xA;    ent_mut : float&#xA;       Mutual information between selected components.&#xA;&#xA;    &quot;&quot;&quot;&#xA;    if isinstance(selA, int):&#xA;        selA = [selA]&#xA;    if isinstance(selB, int):&#xA;        selB = [selB]&#xA;    if rho.type != 'oper':&#xA;        raise TypeError(&quot;Input must be a density matrix.&quot;)&#xA;    if (len(selA) + len(selB)) != len(rho.dims[0]):&#xA;        raise TypeError(&quot;Number of selected components must match &quot; +&#xA;                        &quot;total number.&quot;)&#xA;&#xA;    rhoA = ptrace(rho, selA)&#xA;    rhoB = ptrace(rho, selB)&#xA;    out = (entropy_vn(rhoA, base, sparse=sparse) +&#xA;           entropy_vn(rhoB, base, sparse=sparse) -&#xA;           entropy_vn(rho, base, sparse=sparse))&#xA;    return out&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$S(A:B)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a qubit system and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is a two-qubit system. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qutip as qtp&#xA;# note there is a rand_dm function&#xA;# We should also let qutip know how are systems are partitioned&#xA;# This is so it knows how to correctly compute the partial trace&#xA;rho = qtp.rand_dm(8, dims=[[2,4],[2,4]])&#xA;qtp.entropy_mutual(rho,0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the above example we could also specify the second system as two-qubits instead of a four dimensional system i.e.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;rho = qtp.rand_dm(8, dims=[[2,2,2],[2,2,2]])&#xA;qtp.entropy_mutual(rho,0,[1,2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-05-01T16:38:36.717" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11796" PostTypeId="1" CreationDate="2020-05-01T19:08:20.943" Score="7" ViewCount="96" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Train one's staff in the use of quantum computers.&lt;/li&gt;&#xA;&lt;li&gt;Write papers about what you can do with a quantum computer.&lt;/li&gt;&#xA;&lt;li&gt;Explore quantum algorithms.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Am I mistaken? Is there any &quot;quantum advantage&quot; to be had from these machines---that is, a computation that can be done more cost effectively than with conventional computers?&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2020-12-14T02:00:55.293" Title="Is there quantum advantage to be had with a D-Wave computer in 2020?" Tags="&lt;d-wave&gt;&lt;quantum-advantage&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11797" PostTypeId="1" AcceptedAnswerId="11825" CreationDate="2020-05-01T21:36:46.803" Score="2" ViewCount="222" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;Given a mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum p_k \rho_k$&lt;/span&gt; that is an statistical emsemble, where each &quot;state&quot; &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt; on the upper half of the Bloch sphere&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hskip3in$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/lBDnA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lBDnA.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;appears with equal probability. The states don't lie on the surface of the Bloch sphere but at a radius of &lt;span class=&quot;math-container&quot;&gt;$1/{2\pi}$&lt;/span&gt;, such that the sum, which, in the continous case turns out to be an &lt;a href=&quot;https://math.stackexchange.com/q/3652487/19341&quot;&gt;integral&lt;/a&gt;, properly works out. So the &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt; are not pure states!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I now measure the system in the computational basis, I'll get &lt;span class=&quot;math-container&quot;&gt;$\ket0$&lt;/span&gt; in 100% of the cases. So I would assume the state is a pure one, but is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We might need infinitely many states &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt;, but maybe a big number is enough to get a good aprroximation.&#xA;Or did I miss something else?&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="55" LastEditDate="2020-06-04T15:03:15.067" LastActivityDate="2020-06-04T15:03:15.067" Title="Is my $|0\rangle$ state mixed or pure?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11798" PostTypeId="2" ParentId="11796" CreationDate="2020-05-01T21:44:28.277" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See for example these links for near to practice application of D-Wave:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.lockheedmartin.com/en-us/news/features/2017/quantum-computing-spot-checking-millions-lines-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lockheed Martin&lt;/a&gt; application of D-Wave for source code verification and mistakes identification&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.volkswagenag.com/en/news/stories/2018/06/avoiding-traffic-jams-and-surviving-tsunamis.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Volksvagen&lt;/a&gt; used D-Wave for traffic flow optimization in Beijing&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Other applications seems more or less experimental, for example &lt;a href=&quot;https://www.nas.nasa.gov/projects/quantum.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;NASA&lt;/a&gt; partnership with D-Wave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is interesting is a usage of D-Wave by &lt;a href=&quot;https://www.cnet.com/news/nuclear-weapons-lab-buys-d-wave-next-gen-quantum-computer/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Los Alamos National Laboratory&lt;/a&gt;. It seems that army research is interested in the quantum annealers which can be significant for further development (mainly in terms of financing).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-01T21:44:28.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11799" PostTypeId="2" ParentId="11398" CreationDate="2020-05-01T22:19:52.330" Score="2" Body="&lt;p&gt;Instead of saving the information of a single comparison into a y qubit, you can use a controlled adder. Instead of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; y qubits you would only need &lt;span class=&quot;math-container&quot;&gt;$\log_2 n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-05-01T22:19:52.330" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11800" PostTypeId="2" ParentId="9918" CreationDate="2020-05-01T22:21:20.390" Score="0" Body="&lt;p&gt;There is&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511096&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Polynomial Quantum Algorithm for Approximating the Jones Polynomial&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;For simple knots, you can do that with &lt;a href=&quot;https://www.researchgate.net/publication/279292249_Untying_knots_by_NMR_First_implementation_of_a_polynomial_quantum_algorithm_for_approximating_the_Jones_Polynomial&quot; rel=&quot;nofollow noreferrer&quot;&gt;2 qubits&lt;/a&gt;...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-05-02T22:10:33.410" LastActivityDate="2020-05-02T22:10:33.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11801" PostTypeId="1" CreationDate="2020-05-02T00:11:59.997" Score="3" ViewCount="40" Body="&lt;p&gt;In this excellently answered question '&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1522/how-are-gates-implemented-in-a-continuous-variable-quantum-computer?newreg=8373ab721dcd4120a9b2ee9c578ae700&quot;&gt;How are gates implemented in a continuous-variable quantum computer?&lt;/a&gt;' 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 (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;) and momentum (&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x+t$&lt;/span&gt; or the squeeze gate &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$xe^t$&lt;/span&gt; etc)?&lt;/p&gt;&#xA;" OwnerUserId="11896" LastEditorUserId="11896" LastEditDate="2020-05-03T19:43:55.980" LastActivityDate="2020-05-03T19:43:55.980" Title="What is the explicit action of the non-linear gate in CV quantum computing on the quadratures?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;&lt;continuous-variable&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11802" PostTypeId="2" ParentId="9918" CreationDate="2020-05-02T08:11:20.197" Score="1" Body="&lt;p&gt;Stephan Jordan maintains a very comprehensive list of quantum algorithms on &lt;a href=&quot;https://quantumalgorithmzoo.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantumalgorithmzoo.org/&lt;/a&gt;. Now that you have worked on some famous ones, you can consider veering off a bit. Take a look at the &quot;Algorithm: Machine Learning&quot; consolidation section. There are for instance single-qubit and two-qubit classifiers that could be interesting. In particular, the &quot;Quantum enhanced feature space&quot; classifier that was published in nature last year can be done on 2 qubits (&lt;a href=&quot;https://arxiv.org/abs/1804.11326&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.11326&lt;/a&gt;). &lt;/p&gt;&#xA;" OwnerUserId="2794" LastActivityDate="2020-05-02T08:11:20.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11803" PostTypeId="2" ParentId="11760" CreationDate="2020-05-02T08:19:16.683" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A tutorial on how to build a QNN using Tensorflow Quantum for MNIST (recognize hand-written digits) is available at &lt;a href=&quot;https://www.tensorflow.org/quantum/tutorials/mnist&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.tensorflow.org/quantum/tutorials/mnist&lt;/a&gt;. &lt;/p&gt;&#xA;" OwnerUserId="2794" LastActivityDate="2020-05-02T08:19:16.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11804" PostTypeId="1" AcceptedAnswerId="11805" CreationDate="2020-05-02T14:09:33.393" Score="1" ViewCount="86" Body="&lt;p&gt;A &lt;code&gt;QuantumCircuit()&lt;/code&gt; command creates a qubit with zero state always. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've seen some instructions about using &lt;em&gt;Arbitrary Initialization&lt;/em&gt; but it is not accessible and returns &lt;code&gt;404 error&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="11906" LastEditorUserId="9006" LastEditDate="2020-05-02T16:41:46.643" LastActivityDate="2020-05-02T16:41:46.643" Title="How to create a qubit in arbitrary state in qiskit" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11805" PostTypeId="2" ParentId="11804" CreationDate="2020-05-02T14:37:58.023" Score="2" Body="&lt;p&gt;Any one-qubit state can be described as (up to a global phase):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \cos \left(\frac{\theta}{2} \right)|0\rangle + \sin \left(\frac{\theta}{2} \right) e^{i\varphi}|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we start from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state arbitrary quantum state can be generated (up to a global phase) with &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z(\varphi)$&lt;/span&gt; unitary operators (the order is important). Firstly we apply &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_y(\theta) |0\rangle = \cos \left( \frac{\theta}{2} \right)|0\rangle + \sin \left( \frac{\theta}{2}\right)|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$R_z(\varphi)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Disregarding the global phase we will obtain the following state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \cos\left(\frac{\theta}{2}\right)|0\rangle + \sin\left(\frac{\theta}{2}\right)e^{i\varphi}|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That is an arbitrary state that we wanted to create. There are also other ways (gates) to this transformation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The code will look like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.ry(theta, qubit[0])&#xA;circuit.rz(phi, qubit[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It can also be done only with one &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/b41891aaffec0896294096cdcc24bf8c8ec6e540/qiskit/circuit/library/standard_gates/u3.py#L45-L49&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$u3(\theta, \varphi, 0)$&lt;/span&gt;&lt;/a&gt; gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.u3(theta, phi, 0, qubit[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-02T14:49:31.027" LastActivityDate="2020-05-02T14:49:31.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11806" PostTypeId="1" CreationDate="2020-05-02T15:01:23.973" Score="7" ViewCount="380" Body="&lt;p&gt;I'm struggling with the framework for quantum process tomography on Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The final step of such a framework is running &lt;code&gt;fit&lt;/code&gt; method of &lt;code&gt;ProcessTomographyFitter&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Thus, my questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is the relationship between Choi and Chi matrix?&lt;/li&gt;&#xA;&lt;li&gt;When do they coincide?&lt;/li&gt;&#xA;&lt;li&gt;How to obtain Chi from Choi matrix?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="55" LastEditDate="2021-05-05T18:24:42.243" LastActivityDate="2021-05-05T18:24:42.243" Title="What is the relationship between Choi and Chi matrix in Qiskit?" Tags="&lt;qiskit&gt;&lt;quantum-operation&gt;&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11807" PostTypeId="1" AcceptedAnswerId="11808" CreationDate="2020-05-02T16:03:56.867" Score="1" ViewCount="46" Body="&lt;p&gt;I'm studying Mark Wilde's &quot;Quantum Information Theory&quot; and the author sometimes use the inequality &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\prod_\mathcal{H'}Y) \leq  \mathrm{Tr}(Y)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Y\in \mathcal{H}'$&lt;/span&gt; is a density matrix and &lt;span class=&quot;math-container&quot;&gt;$\prod_\mathcal{H'}=V^{\dagger}V$&lt;/span&gt; with isometry &lt;span class=&quot;math-container&quot;&gt;$V: \mathcal{H} \rightarrow \mathcal{H}'$&lt;/span&gt;. As far as I know, this inequality does not hold for general matrix &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. So I tried to prove the inequality using the positive semi-definite condition of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, but I cannot grasp any clue. Does the inequality really holds? And if it does, how can I prove it? I appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="11510" LastEditorUserId="5280" LastEditDate="2020-05-03T11:09:55.863" LastActivityDate="2020-05-03T11:09:55.863" Title="Projection is trace-decreasing?" Tags="&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11808" PostTypeId="2" ParentId="11807" CreationDate="2020-05-02T16:43:37.297" Score="3" Body="&lt;p&gt;Hint: Write &lt;span class=&quot;math-container&quot;&gt;$\Pi_{\mathcal H'}=\sum \lambda_i|i\rangle\langle i|$&lt;/span&gt; in an eigenbasis &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\lambda_i=0,1$&lt;/span&gt;.  Then use that the trace is cyclic, and &lt;span class=&quot;math-container&quot;&gt;$\langle i|Y|i\rangle\ge0$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Note that the inequality &lt;em&gt;cannot&lt;/em&gt; hold for a general matrix: If it holds for &lt;span class=&quot;math-container&quot;&gt;$Y=Y_0$&lt;/span&gt;, it cannot hold for &lt;span class=&quot;math-container&quot;&gt;$Y=-Y_0$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-05-02T16:43:37.297" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11809" PostTypeId="2" ParentId="11741" CreationDate="2020-05-02T17:08:56.097" Score="1" Body="&lt;p&gt;If you iterate over the circuit data as in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11742/11908&quot;&gt;Gadi A's answer&lt;/a&gt;, and use gate.qasm(), then you get the gate printed in concise format with all the relevant parameters.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for gate in circuit.data:&#xA;    print(gate[0].qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11908" LastActivityDate="2020-05-02T17:08:56.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11810" PostTypeId="1" AcceptedAnswerId="11815" CreationDate="2020-05-02T17:21:13.267" Score="3" ViewCount="114" Body="&lt;p&gt;I am referring to the MS Quantum Katas, Measurements, 2.3 Peres/Wooters game&#xA;I have big problems to understand the solution.&#xA;The task is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;--begin&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Input:&lt;/strong&gt; A qubit which is guaranteed to be in one of the three states:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|A\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big)$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|B\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle + \omega |1\rangle \big)$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|C\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle + \omega^2 |1\rangle \big)$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$\omega = e^{2i \pi/ 3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;1 or 2 if the qubit was in the &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt; state, &lt;/li&gt;&#xA;&lt;li&gt;0 or 2 if the qubit was in the &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; state, &lt;/li&gt;&#xA;&lt;li&gt;0 or 1 if the qubit was in the &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The state of the qubit at the end of the operation does not matter. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;--end&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution is described as:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Solution&lt;/h3&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The task is a simple game inspired by a quantum detection problem due to Holevo&lt;sup&gt;[1]&lt;/sup&gt; and Peres/Wootters&lt;sup&gt;[2]&lt;/sup&gt;. 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. &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Classically, if you just made a guess, you'd have to ask two questions to be right &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; 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. &#xA;  It can be shown that this allows B to be right &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; of the time with only 1 measurement, which is something that is not achievable with a von Neumann measurement on 1 qubit.&#xA;  See also Peres&lt;sup&gt;[3, chapter 9.6]&lt;/sup&gt; for a nice description of the optimal POVM.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M = \frac{1}{\sqrt{2}}\left(\begin{array}{rrr}&#xA;1 &amp;amp; 1 &amp;amp; 1 \\ &#xA;1 &amp;amp; \omega &amp;amp; \omega^2 &#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\omega = e^{2 \pi i/3}$&lt;/span&gt; denotes a primitive &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;rd root of unity. Our task will be to implement the rank 1 POVM given by the columns of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; via a von Neumann measurement. This can be done by &quot;embedding&quot; &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; into a larger unitary matrix (taking complex conjugates and transposed):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M' = \frac{1}{\sqrt{2}}\left(\begin{array}{cccc}&#xA;1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 0 \\ &#xA;1 &amp;amp; -\omega^2 &amp;amp; \omega &amp;amp; 0 \\&#xA;1 &amp;amp; -\omega &amp;amp; \omega^2 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i &#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that applying &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt; to input states given by column &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (padded with two zeros to make it a vector of length &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;), where &lt;span class=&quot;math-container&quot;&gt;$i=0, 1, 2$&lt;/span&gt; will never return the label &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; as the corresponding vectors are perpendicular. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We are therefore left with the problem of implementing &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt; as a sequence of elementary quantum gates. Notice that &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M' \cdot {\rm diag}(1,-1,1,-1) = M' \cdot (\mathbf{1}_2 \otimes Z) = &#xA;\frac{1}{\sqrt{2}}\left(\begin{array}{cccc}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\ &#xA;1 &amp;amp; \omega^2 &amp;amp; \omega &amp;amp; 0 \\&#xA;1 &amp;amp; \omega &amp;amp; \omega^2 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i &#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;...&lt;br&gt;&#xA;--end&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have several questions / problems here.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What exactly is a &quot;von-Neumann&quot; measurement? Is it just a measurement in the standard basis?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I understand how to get M:&lt;br&gt;&#xA;A POVM M with &lt;span class=&quot;math-container&quot;&gt;${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)$&lt;/span&gt; results in &lt;span class=&quot;math-container&quot;&gt;$M=(\psi_0 \psi_1 \psi_2) = \frac{1}{\sqrt{2}}\left(\begin{array}{rrr} 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; \omega &amp;amp; \omega^2 \end{array}\right)$&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Next step is &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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 &quot;embedding&quot; M into a larger unitary matrix (taking complex conjugates and transposed)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does this embedding mean exactly, what is the math behind?&#xA;I only found one article about &quot;Emdedded Transforms&quot; (&lt;a href=&quot;https://books.google.de/books?id=pefvCAAAQBAJ&amp;amp;pg=PA104&amp;amp;lpg=PA104&amp;amp;dq=embedding+matrix+into+larger+unitary+matrix&amp;amp;source=bl&amp;amp;ots=2apFdXFYNd&amp;amp;sig=ACfU3U3JCtj7GgJimx5cgCcKE_FrMUx_4Q&amp;amp;hl=de&amp;amp;sa=X&amp;amp;ved=2ahUKEwjo-K3EipHpAhW8UxUIHVuyDtYQ6AEwCXoECAgQAQ#v=onepage&amp;amp;q=embedding%20matrix%20into%20larger%20unitary%20matrix&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://books.google.de/books?id=pefvCAAAQBAJ&amp;amp;pg=PA104&amp;amp;lpg=PA104&amp;amp;dq=embedding+matrix+into+larger+unitary+matrix&amp;amp;source=bl&amp;amp;ots=2apFdXFYNd&amp;amp;sig=ACfU3U3JCtj7GgJimx5cgCcKE_FrMUx_4Q&amp;amp;hl=de&amp;amp;sa=X&amp;amp;ved=2ahUKEwjo-K3EipHpAhW8UxUIHVuyDtYQ6AEwCXoECAgQAQ#v=onepage&amp;amp;q=embedding%20matrix%20into%20larger%20unitary%20matrix&amp;amp;f=false&lt;/a&gt;), but this is valid only for square matrices. &lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;The next step in the solution is:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Notice that applying &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt; to input states given by column &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (padded with two zeros to make it a vector of length &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;), where &lt;span class=&quot;math-container&quot;&gt;$i=0, 1, 2$&lt;/span&gt; will never return the label &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; as the corresponding vectors are perpendicular. &#xA;  We are therefore left with the problem of implementing &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt; as a sequence of elementary quantum gates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;What does this mean? I don't understand the sense of this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance,&#xA;Markus&lt;/p&gt;&#xA;" OwnerUserId="11909" LastEditorUserId="9006" LastEditDate="2020-05-02T21:16:39.773" LastActivityDate="2020-05-04T07:13:54.233" Title="MS Quantum Katas - Measurements Task 2.3 - problems in understanding the solution" Tags="&lt;algorithm&gt;&lt;games&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11812" PostTypeId="1" CreationDate="2020-05-02T18:21:35.450" Score="4" ViewCount="288" Body="&lt;p&gt;I am referring to the article &lt;a href=&quot;http://edu.itp.phys.ethz.ch/fs13/atqit/sol01.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Advanced Topics in Quantum Information Theory&lt;/a&gt; exercise 4 and to the MS Quantum Kata &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/MagicSquareGame&quot; rel=&quot;nofollow noreferrer&quot;&gt;MS-Quantum-Kata&lt;/a&gt; which describes a solution for the Mermin–Peres Magic Square Game.&#xA;I could follow the article and do all the maths for myself until the end of the article.&#xA;Unfortunately the article ends with&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;... Following the hint, we consider two maximally entangled states shared between Alice and Bob:&lt;span class=&quot;math-container&quot;&gt;$$|Ψ〉_{AB}=1/√2(|00〉_{A_1B_1}+|11〉_{A_1B_1})⊗1/√2(|00〉_{A_2B_2}+|11〉_{A_2B_2})$$&lt;/span&gt;&#xA;It is then easy to check by using &lt;span class=&quot;math-container&quot;&gt;$$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〉)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|0,1〉$&lt;/span&gt; are the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$σ_z$&lt;/span&gt; and  where &lt;span class=&quot;math-container&quot;&gt;$|φ^{x,y}_j〉$&lt;/span&gt; denote the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$σ_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$σ_y$&lt;/span&gt; as in the solution to the last exercise (with eigenvalues ±1 each), that the compatibility condition is indeed satisfied.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Unfortunately for me it is not easy to check, I spent multiple nights to try this, but I don't get it done.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can anyone show me how this check looks like? What is the math behind it?&lt;/li&gt;&#xA;&lt;li&gt;The algorithm states that Alice (and Bob) are performing multiple measurements on their qubits for all observables &lt;span class=&quot;math-container&quot;&gt;$M_{x,y}$&lt;/span&gt; in her row (in his column).&lt;br&gt; 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?&#xA;I know there is something called &amp;quot;phase kick-back&amp;quot; that kicks the phase into the control bit if I use &amp;quot;Controlled Operations&amp;quot;, is that something that is used here? How exactly?&lt;/li&gt;&#xA;&lt;li&gt;Is &amp;quot;Phase Kickback&amp;quot; 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)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thanks a lot for any help or hints.&lt;/p&gt;&#xA;" OwnerUserId="11909" LastEditorUserId="45" LastEditDate="2020-09-28T08:35:02.027" LastActivityDate="2020-09-28T08:35:02.027" Title="Problems in understanding the solution for &quot;Mermin–Peres Magic Square Game&quot;" Tags="&lt;algorithm&gt;&lt;games&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11813" PostTypeId="2" ParentId="9918" CreationDate="2020-05-02T18:37:09.060" Score="1" Body="&lt;p&gt;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?&#xA;I would really love to get into discussions with you, maybe you could support me to build my own device?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/CHSHGame&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/QuantumKatas/tree/master/CHSHGame&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/Superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/QuantumKatas/tree/master/Superposition&lt;/a&gt; - Hardy-State&lt;/p&gt;&#xA;" OwnerUserId="11909" LastEditorUserId="9006" LastEditDate="2020-05-02T21:21:10.717" LastActivityDate="2020-05-02T21:21:10.717" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11814" PostTypeId="2" ParentId="11806" CreationDate="2020-05-02T18:43:24.313" Score="6" Body="&lt;p&gt;( I copied some text from a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11622/how-to-perform-quantum-process-tomography-for-three-qubit-gates/11691#11691&quot;&gt;previous answer of mine)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Defining the Choi and &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; matrix&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Choi%27s_theorem_on_completely_positive_maps&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;Choi&lt;/em&gt; matrix&lt;/a&gt; is a direct result of the Choi-Jamiolkowski isomorphism. Some intuition on what this is can be found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11580/what-does-it-mean-to-take-the-choi-jamiolkowski-of-a-quantum-channel/11624#11624&quot;&gt;in this previous answer&lt;/a&gt;. Consider the maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\Omega \rangle = \sum_{\mathrm{i}}|\mathrm{i}\rangle \otimes |\mathrm{i}\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{|\mathrm{i}\rangle\}$&lt;/span&gt; forms a basis for the space on which &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; acts. (Note that we thus have a maximally entangled state of twice as many qubits).&#xA;The Choi matrix is the state that we get when on one of these subsystems &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is applied (leaving the other subsystem intact):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_{\mathrm{Choi}} = \big(\Lambda \otimes I\big) |\Omega\rangle\langle\Omega|.&#xA;\end{equation}&lt;/span&gt;&#xA;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography#Standard_quantum_process_tomography&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;process&lt;/em&gt;- or &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-matrix&lt;/a&gt; comes from the fact that we can write our map as a double sum:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Lambda(\rho) = \sum_{m,n} \chi_{mn}P_{m}\rho P_{n}^{\dagger},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{P_{m}\}$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\{P_{n}\}$&lt;/span&gt; form a basis for the space of density matrices; we use the Pauli basis &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}^{\otimes n}$&lt;/span&gt; (thereby omitting the need for the &lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$P_{n}$&lt;/span&gt;). The matrix &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; now encapsulates all information of &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;; the CP constraint reads that &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; must be positive semidefinite, and the trace constraint reads that &lt;span class=&quot;math-container&quot;&gt;$\sum_{m,n}\chi_{mn}P_{n}P_{m} \leq I$&lt;/span&gt; (with equality for TP).&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Computing one from another&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;From this, we get the following two identities:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\rho_{\mathrm{Choi}} &amp;amp;= \sum_{m,n} \chi_{m,n} |P_{m}\rangle\rangle\langle\langle P_{n}|, \\&#xA;\chi_{m,n} &amp;amp;= \langle\langle P_{m} | \rho_{\mathrm{Choi}} |P_{n}\rangle\rangle,&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|P_{m}\rangle\rangle$&lt;/span&gt; is the 'vectorized' version of &lt;span class=&quot;math-container&quot;&gt;$P_{m}$&lt;/span&gt;, which is essentially just the columns of &lt;span class=&quot;math-container&quot;&gt;$P_{m}$&lt;/span&gt; stacked on top of each other, giving a vector. That answers question 3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again I shamelessly 'self-promote': in the first appendix of &lt;a href=&quot;https://repository.tudelft.nl/islandora/object/uuid%3A39258a70-a347-40bb-a2f9-9ca301a71652?collection=education&quot; rel=&quot;noreferrer&quot;&gt;my thesis&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Relationship between the two&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;From this, you can see that the Choi matrix and the chi matrix do indeed have some relationship: The Choi matrix is the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; matrix, when the used based is not the Pauli basis but the Bell basis. That, I believe, answers question 1 &amp;amp; 2.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8954" LastEditDate="2020-05-04T07:09:27.670" LastActivityDate="2020-05-04T07:09:27.670" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11815" PostTypeId="2" ParentId="11810" CreationDate="2020-05-02T19:04:08.387" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for the solution, at first you need to construct a POVM from the vectors &lt;strong&gt;orthogonal&lt;/strong&gt; to those &lt;span class=&quot;math-container&quot;&gt;$|A\rangle, |B\rangle, |C\rangle$&lt;/span&gt;. For example, you can take &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|E_0\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle - |1\rangle \big),  &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|E_1\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle - \omega |1\rangle \big),&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|E_2\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle - \omega^2 |1\rangle \big).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can verify that it's indeed a POVM, i.e. &lt;span class=&quot;math-container&quot;&gt;$\sum_i |E_i\rangle\langle E_i| = \frac{3}{2}I$&lt;/span&gt;. Not any set of vectors is suitable for a POVM.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if the result of the corresponding POVM measurement is &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; (label 1), then the input state certainly &lt;strong&gt;wasn't&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; and you return 1 as an answer &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; this will satisfy the output requirement. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding POVM matrix is&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = \frac{1}{\sqrt{3}}\left(\begin{array}{rrr}&#xA;1 &amp;amp; 1 &amp;amp; 1 \\ &#xA;-1 &amp;amp; -\omega &amp;amp; -\omega^2 &#xA;\end{array}&#xA;\right)&#xA;$$&lt;/span&gt;&#xA;Notice that we've renormalized vectors, i.e. &lt;span class=&quot;math-container&quot;&gt;$|E_i'\rangle = \sqrt{\frac{2}{3}}|E_i\rangle$&lt;/span&gt;, to satisfy &lt;span class=&quot;math-container&quot;&gt;$\sum_i |E_i'\rangle\langle E_i'| = I$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To construct von Neumann measurement we must find &quot;embedding&quot; of this &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; into some unitary matrix &lt;span class=&quot;math-container&quot;&gt;$M^\prime$&lt;/span&gt;. Embedding means that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is just a submatrix of the matrix &lt;span class=&quot;math-container&quot;&gt;$M^\prime$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can take &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M' = \frac{1}{\sqrt{3}}\left(\begin{array}{cccc}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\ &#xA;-1 &amp;amp; -\omega &amp;amp; -\omega^2 &amp;amp; 0 \\&#xA;1 &amp;amp; \omega^2 &amp;amp; \omega &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \sqrt{3}&#xA;\end{array}&#xA;\right)&#xA;$$&lt;/span&gt;&#xA;Here the embedding is obvious - &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the top left corner. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |0\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the given state which is either &lt;span class=&quot;math-container&quot;&gt;$|A\rangle,|B\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How it corresponds to a POVM measurement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;? In this case trivially &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; label &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt; corresponds to the label &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i=0,1,2$&lt;/span&gt;. The result labelled &lt;span class=&quot;math-container&quot;&gt;$i=3$&lt;/span&gt; can't happen because &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |0\rangle$&lt;/span&gt; is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-05-04T07:13:54.233" LastActivityDate="2020-05-04T07:13:54.233" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="11816" PostTypeId="5" CreationDate="2020-05-02T21:34:45.000" Score="0" Body="&lt;p&gt;A description of OpenFermion from &lt;a href=&quot;http://OpenFermion%20is%20an%20open%20source%20library%20for%20compiling%20and%20analyzing%20quantum%20algorithms%20to%20simulate%20fermionic%20systems,%20including%20quantum%20chemistry.%20Among%20other%20functionalities,%20this%20version%20features%20data%20structures%20and%20tools%20for%20obtaining%20and%20manipulating%20representations%20of%20fermionic%20and%20qubit%20Hamiltonians.&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;OpenFermion is an open source library for compiling and analyzing quantum algorithms to simulate fermionic systems, including quantum chemistry. Among other functionalities, this version features data structures and tools for obtaining and manipulating representations of fermionic and qubit Hamiltonians. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-05-02T21:34:45.000" LastActivityDate="2020-05-02T21:34:45.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11817" PostTypeId="4" CreationDate="2020-05-02T21:34:45.000" Score="0" Body="For questions related to OpenFermion python library for studying quantum algorithms related to fermionic systems such as those arising in quantum chemistry." OwnerUserId="9006" LastEditorUserId="10480" LastEditDate="2021-01-31T22:22:17.727" LastActivityDate="2021-01-31T22:22:17.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11818" PostTypeId="2" ParentId="11812" CreationDate="2020-05-02T22:05:18.050" Score="2" Body="&lt;p&gt;Not an answer yet, but to long for comment:&#xA;Alice and Bob share two entangled pairs. Now look only at Alice's.&#xA;The last line gives the state that only one of'em has:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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〉).$$&lt;/span&gt;&#xA;You can see that when you trace out Bob.&#xA;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. &#xA;I think you have to check that the measured value is the same at the coincident site...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-05-02T22:05:18.050" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11819" PostTypeId="1" CreationDate="2020-05-02T22:14:42.217" Score="5" ViewCount="54" Body="&lt;p&gt;Definitions: a map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is called positive if &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)$&lt;/span&gt; is positive semidefinite for any positive semidefinite &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and completely positive (CP) if &lt;span class=&quot;math-container&quot;&gt;$\Phi \otimes \mathrm{Id}$&lt;/span&gt; is a positive map with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Id}$&lt;/span&gt; standing for an identity channel of arbitrary dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.77.042113&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;, &lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0375960105005748&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;breaking physics&quot;? 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?&lt;/p&gt;&#xA;" OwnerUserId="11887" LastEditorUserId="55" LastEditDate="2020-10-12T07:28:55.890" LastActivityDate="2020-10-12T07:28:55.890" Title="When can a non-completely-positive evolution of a state be physical?" Tags="&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11820" PostTypeId="2" ParentId="11797" CreationDate="2020-05-02T22:48:07.620" Score="0" Body="&lt;p&gt;A pure state is any state that &lt;i&gt;can&lt;/i&gt; be written in the form &lt;span class=&quot;math-container&quot;&gt;$|\alpha \rangle \langle \alpha|$&lt;/span&gt;, but you are free to write it any way you like, including as a sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A density &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is any Hermitian trace-1 positive semi-definite matrix.  It &lt;i&gt;can&lt;/i&gt; be written as &lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_i p_i |\psi_i\rangle \langle \psi_i|$$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\{p_i\}$&lt;/span&gt; a probability distribution (i.e. all between 0 and 1 and they sum to 1) and each &lt;span class=&quot;math-container&quot;&gt;$|\psi_i \rangle$&lt;/span&gt; a pure state.  But, yes, you could write one density as a sum of other mixed densities, provided again your &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; form a probability distribution.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only trace-1 positive semi-definite matrix with &lt;span class=&quot;math-container&quot;&gt;$\langle 0 |\rho |0\rangle = 1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$$\rho = \begin{pmatrix}1 &amp;amp; 0\\ 0 &amp;amp; 0 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9626" LastActivityDate="2020-05-02T22:48:07.620" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11821" PostTypeId="1" CreationDate="2020-05-02T22:52:21.667" Score="2" ViewCount="74" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9226" LastActivityDate="2020-05-03T23:05:59.623" Title="Will NISQ based algorithms be useful in fault-tolerant Quantum computers?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11823" PostTypeId="1" CreationDate="2020-05-03T10:30:21.553" Score="2" ViewCount="114" Body="&lt;p&gt;In Nielsen and Chuang, it is stated that the effect of phase estimation circuit is mapping state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle |u\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|j\rangle U^j |u\rangle$&lt;/span&gt;. &lt;a href=&quot;https://i.stack.imgur.com/ebT10.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ebT10.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is my solution:&#xA;Consider the first &lt;span class=&quot;math-container&quot;&gt;$CU^{2^0}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|j\rangle = |j_1j_2\dots j_t\rangle$&lt;/span&gt;. It maps the state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle |u\rangle$&lt;/span&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle U^{j_t2^0}|u\rangle$&lt;/span&gt;.If &lt;span class=&quot;math-container&quot;&gt;$j_t=0$&lt;/span&gt;, then nothing happens. Otherwise, &lt;span class=&quot;math-container&quot;&gt;$U^{2^0}$&lt;/span&gt; is applied.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Continuing like this I get the following quantum state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|j\rangle U^{j_12^{t-1}} \cdots U^{j_t2^0}|u\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then it should be true that &lt;span class=&quot;math-container&quot;&gt;$U^{j_12^{t-1}} \cdots U^{j_t2^0} = U^j$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2021-05-29T08:09:05.810" Title="Quantum Phase Estimation Circuit and Modular Exponentiaton" Tags="&lt;nielsen-and-chuang&gt;&lt;shors-algorithm&gt;&lt;phase-estimation&gt;&lt;modular-exponentiation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11824" PostTypeId="1" CreationDate="2020-05-03T16:14:37.353" Score="3" ViewCount="71" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho : V_1 \to V_1 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_2 : V_2 \to V_2 $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$V_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_2$&lt;/span&gt; are Hilbert spaces.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose that &lt;span class=&quot;math-container&quot;&gt;$U:V_1\otimes V_2 \to V_1\otimes V_2$&lt;/span&gt;  is a unitary operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Define a map &lt;span class=&quot;math-container&quot;&gt;$M : L(V_1, V_1) \to L(V_1, V_1)$&lt;/span&gt; as &#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;M(\rho) := \operatorname{Tr}_2 \left(\  U\  \rho\otimes\rho_2 \ U^{\dagger}\   \right)&#xA;\end{align*}&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho_2 \in L(V_2, V_2)$&lt;/span&gt; is a fixed density operator, and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_2$&lt;/span&gt; is the partial trace of vector space &lt;span class=&quot;math-container&quot;&gt;$V_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, trivially &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a unitary operator, if &lt;span class=&quot;math-container&quot;&gt;$U = U_1 \otimes U_2$&lt;/span&gt; for some unitary operators &lt;span class=&quot;math-container&quot;&gt;$U_1 \in L(V_1,V_1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_2 \in L(V_2,V_2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is the converse also true?&#xA;If &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; cannot be expressed as a tensor product of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; unitary operators, then is &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; non-unitary ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am lost how to prove this statement. Any hints or references are appreciated.  &lt;/p&gt;&#xA;" OwnerUserId="9908" LastActivityDate="2020-05-04T17:48:46.030" Title="$M(\rho)=\operatorname{Tr}_2\left(\ U\ \rho\otimes\rho_2\ U^{\dagger}\right)$is unitary $\iff\ U=U_1\otimes U_2$, a product of $2$ unitary operators?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11825" PostTypeId="2" ParentId="11797" CreationDate="2020-05-03T16:46:54.767" Score="1" Body="&lt;p&gt;You're forgetting the requirement that the probability weights must sum to 1.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can't sum up all the mixed state 3-vectors corresponding to the &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt; with unit weight to get the 3-vector corresponding to &lt;span class=&quot;math-container&quot;&gt;$\rho = \iint_k \rho_k$&lt;/span&gt; - that sum isn't properly normalized. You need to take a &lt;em&gt;convex&lt;/em&gt; combination of the &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt;, i.e. a weighted sum &lt;span class=&quot;math-container&quot;&gt;$\sum_k \rho_k$&lt;/span&gt; in which the &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; are nonnegative and sum to 1, which yours don't.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n$&lt;/span&gt; always yields a vector inside their &lt;a href=&quot;https://en.wikipedia.org/wiki/Convex_hull&quot; rel=&quot;nofollow noreferrer&quot;&gt;convex hull&lt;/a&gt;, which (loosely) consists of &quot;the space in between&quot; the original vectors. So you can't take a convex combination of 3-vectors and get a 3-vector that &quot;reaches outside&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-05-03T16:46:54.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11826" PostTypeId="1" AcceptedAnswerId="11830" CreationDate="2020-05-03T16:56:48.933" Score="4" ViewCount="102" Body="&lt;p&gt;How can we use Quantum Computing to break a Cryptosystem like RSA or AES-256?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can we use Quantum Computing to solve difficult mathematical problems like Discrete Logarithms or Prime Number Factorization?&lt;/p&gt;&#xA;" OwnerUserId="11861" LastActivityDate="2021-01-21T17:58:57.900" Title="Is Quantum Computing a problem for Cryptography?" Tags="&lt;mathematics&gt;&lt;cryptography&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11827" PostTypeId="1" AcceptedAnswerId="11829" CreationDate="2020-05-03T17:16:58.597" Score="2" ViewCount="57" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; on the Wikipedia page). I tried to look into the kata tests but I wasn't very successful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal of the operator is to flip the sign of a state if it is correct. The mathematical representation for this is : &lt;span class=&quot;math-container&quot;&gt;$$|x\rangle \, \overset{U_\omega} \longrightarrow \, (-1)^{f(x)}|x\rangle$$&lt;/span&gt;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 &quot;formula&quot; to do so ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-05-04T14:58:13.417" Title="How to correctly define $U_\omega$ for Grover's search algorithm" Tags="&lt;programming&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11828" PostTypeId="1" CreationDate="2020-05-03T17:30:30.230" Score="2" ViewCount="57" Body="&lt;p&gt;Is it possible, using the QPE algorithm, to map the state &lt;span class=&quot;math-container&quot;&gt;$\sum_j\alpha_j\,\left|v_j\right\rangle\,|0\rangle^{\otimes n}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\sum_j\alpha_j\,\left|v_j\right\rangle\,\left|\theta_j\right\rangle$&lt;/span&gt;? I understand how it is done, and why does it work when applying the QPE algorithm to an eigenvector &lt;span class=&quot;math-container&quot;&gt;$|v_i\rangle$&lt;/span&gt;. But there is this measurement after the inverse QFT, which will just outputs the state &lt;span class=&quot;math-container&quot;&gt;$\sum_j\alpha_j\,\left|v_j\right\rangle\,\left|\theta_k\right\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\left\|\alpha_k\right\|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The algorithm I want to implement is designed as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, we have a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_j\alpha_j\,\left|v_j\right\rangle$&lt;/span&gt;. Then, we apply the QPE with a certain unitary whose eigenvectors are the &lt;span class=&quot;math-container&quot;&gt;$\left|v_i\right\rangle$&lt;/span&gt; (this is not true in practice, there's an intermediary step but this does not matter here). Hence, we are left with the state &lt;span class=&quot;math-container&quot;&gt;$\sum_j\alpha_j\,\left|v_j\right\rangle\,\left|\theta_j\right\rangle$&lt;/span&gt;. We consider a gate &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}_\theta$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}_\theta\,\left|\theta_j\right\rangle\,|0\rangle = \left|\theta_j\right\rangle\,|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\theta_j &amp;lt; \theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\theta_j\right\rangle\,|0\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\theta_j\geqslant\theta$&lt;/span&gt;. We apply this gate on the second register and are left with the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; represents the set of indexes &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\theta_j\geqslant\theta$&lt;/span&gt;. We finally uncompute the QPE to get the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and we measure the second register. This works well if all &lt;span class=&quot;math-container&quot;&gt;$\theta_j$&lt;/span&gt; can be represented exactaly on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Now, let us assume this is not the case. We denote &lt;span class=&quot;math-container&quot;&gt;$2^n\,\theta_j=\overline{\theta_j} + 2^n\,\delta_j$&lt;/span&gt;. After applying the QPE, we are left with the state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which we can rewrite as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which we can also rewrite as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now apply &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}_\theta$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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]\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="10454" LastEditDate="2020-05-04T12:00:08.083" LastActivityDate="2020-05-04T12:00:08.083" Title="Quantum Phase Estimation on a superposed state" Tags="&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11829" PostTypeId="2" ParentId="11827" CreationDate="2020-05-03T18:28:21.183" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Marking oracles are the ones that flip the state of the qubit &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle|y\rangle \, \overset{U_\omega} \longrightarrow \, |x\rangle|y \oplus f(x)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/SolveSATWithGrover&quot; rel=&quot;nofollow noreferrer&quot;&gt;SolveSATWithGrover&lt;/a&gt; and &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/GraphColoring&quot; rel=&quot;nofollow noreferrer&quot;&gt;GraphColoring&lt;/a&gt; show how to take a problem and implement it this way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase (or sign flipping) oracles are the ones that flip the sign of the register &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle \, \overset{U_\omega} \longrightarrow \, (-1)^{f(x)}|x\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/GroversAlgorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;GroversAlgorithm kata&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-03T18:28:21.183" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11830" PostTypeId="2" ParentId="11826" CreationDate="2020-05-03T21:45:17.193" Score="4" Body="&lt;p&gt;RSA is based on high computational complexity of integer factorization. In simple words you prepare two large prime numbers &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. These composed your private key which is used for decryption. The public key used for encryption is simply product &lt;span class=&quot;math-container&quot;&gt;$m = pq$&lt;/span&gt;. If you were able to factorize public key, you would get private key and break the cypher. Since for large &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1808.08927&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Factoring&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="11925" LastEditDate="2020-05-04T08:29:19.327" LastActivityDate="2020-05-04T08:29:19.327" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11831" PostTypeId="2" ParentId="11824" CreationDate="2020-05-03T21:56:03.160" Score="1" Body="&lt;p&gt;This is probably not the answer to what you've meant, but it's still relevant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume that &lt;span class=&quot;math-container&quot;&gt;$\rho_2 = |0\rangle\langle0|$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; it's known that quantum channels have such representation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$U = U_1 \otimes U_2$&lt;/span&gt; then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M(\rho) = U_1\rho U_1^\dagger.&#xA;$$&lt;/span&gt; &#xA;This &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is &quot;unitary&quot; if we consider the space &lt;span class=&quot;math-container&quot;&gt;$L(V_1, V_1)$&lt;/span&gt; as a vector space of matrices with Hilbert-Schmidt inner product given by &lt;span class=&quot;math-container&quot;&gt;$(A,B) = \text{Tr}(B^\dagger A)$&lt;/span&gt;. Indeed, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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),&#xA;$$&lt;/span&gt;&#xA;so the inner product remains the same. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now suppose &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is unitary in this sense. Consider any pure state &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (density matrix of it, e.g. &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\langle1|$&lt;/span&gt;). We must have &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(M(\theta)^\dagger M(\theta)) = \text{Tr}(\theta^\dagger \theta) = 1.&#xA;$$&lt;/span&gt;&#xA;But &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(M(\theta))=1$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; be eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$M(\theta)$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$0\leq \lambda_i \leq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_i \lambda_i = 1$&lt;/span&gt;. The above equality gives us that   &lt;span class=&quot;math-container&quot;&gt;$\sum_i \lambda_i^2 = 1$&lt;/span&gt;. From this it's easy to deduce that for some index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; it must be &lt;span class=&quot;math-container&quot;&gt;$\lambda_k=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_i = 0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\neq k$&lt;/span&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$M(\theta)$&lt;/span&gt; also must be a pure state. So, &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; maps pure states to pure states.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that partial trace &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_2(s)$&lt;/span&gt; is pure for a density matrix &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; only if the  state &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is a product state: &lt;span class=&quot;math-container&quot;&gt;$s = \text{Tr}_2(s) \otimes \text{Tr}_1(s)$&lt;/span&gt; (here &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_1(s)$&lt;/span&gt; is not necessary pure).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we can write &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U\  \theta \otimes\rho_2 \ U^{\dagger}\ = M(\theta) \otimes N(\theta), &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N(\theta) = \text{Tr}_1(U\  \theta \otimes\rho_2 \ U^{\dagger})$&lt;/span&gt; is a complementary channel. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now take two pure states &lt;span class=&quot;math-container&quot;&gt;$\theta_1, \theta_2$&lt;/span&gt;. We have that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M(\theta_1\theta_2) = \text{Tr}_2(U\  \theta_1\theta_2 \otimes\rho_2 \ U^{\dagger})&#xA;= \text{Tr}_2(U\  \theta_1 \otimes\rho_2 \ U^{\dagger} \cdot U\  \theta_2 \otimes\rho_2 \ U^{\dagger}) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \text{Tr}_2( M(\theta_1) \otimes N(\theta_1) \cdot M(\theta_2) \otimes N(\theta_2)) &#xA;= M(\theta_1)M(\theta_2).&#xA;$$&lt;/span&gt;&#xA;So, for any pure states &lt;span class=&quot;math-container&quot;&gt;$\theta_1, \theta_2$&lt;/span&gt; we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M(\theta_1\theta_2) = M(\theta_1)M(\theta_2).&#xA;$$&lt;/span&gt;&#xA;By linearity it can be proved that for any matrices &lt;span class=&quot;math-container&quot;&gt;$A,B \in L(V_1, V_1)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M(AB) = M(A)M(B).&#xA;$$&lt;/span&gt; &#xA;It also can be shown that &lt;span class=&quot;math-container&quot;&gt;$M(I)=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M(A^\dagger) = M(A)^\dagger$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a unital  &lt;span class=&quot;math-container&quot;&gt;$*$&lt;/span&gt;-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 &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M(A) = U_1 A U_1^\dagger&#xA;$$&lt;/span&gt; &#xA;for some unitary &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; and any matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-05-04T07:03:12.193" LastActivityDate="2020-05-04T07:03:12.193" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11832" PostTypeId="2" ParentId="11823" CreationDate="2020-05-03T22:28:05.130" Score="0" Body="&lt;p&gt;Thanks to comment by @gIS, I realized that I was mixing up the order. If I write &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|j_1\dots j_t\rangle$&lt;/span&gt;, of course it will be equal to &lt;span class=&quot;math-container&quot;&gt;$j_12^{t-1} \cdots j_t2^0$&lt;/span&gt;. I was confused about the numbering of the qubits.&lt;/p&gt;&#xA;" OwnerUserId="7986" LastEditorUserId="7986" LastEditDate="2020-05-04T06:54:25.370" LastActivityDate="2020-05-04T06:54:25.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11833" PostTypeId="2" ParentId="11821" CreationDate="2020-05-03T23:00:13.757" Score="1" Body="&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, in the future, quantum computers may be able to tackle such a problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the issues, again, as I understand it, is the error-correcting capabilities we have today and their impact on current quantum computing. &lt;/p&gt;&#xA;" OwnerUserId="6253" LastEditorUserId="6253" LastEditDate="2020-05-03T23:05:59.623" LastActivityDate="2020-05-03T23:05:59.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11834" PostTypeId="1" AcceptedAnswerId="11841" CreationDate="2020-05-04T00:25:25.527" Score="5" ViewCount="55" Body="&lt;p&gt;Given two 1-qubit rotations &lt;span class=&quot;math-container&quot;&gt;$U=R_n (\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V=R_m(\phi)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; vectors defining a rotation and &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi$&lt;/span&gt; angles, define &lt;span class=&quot;math-container&quot;&gt;$D(U,V)=Tr(|U-V|)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|U-V|=\sqrt{(U-V)^\dagger (U-V)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E(U,V)=max_{|\psi \rangle} ||(U-V)|\psi \rangle ||$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|| |\psi\rangle ||$&lt;/span&gt; is the vector norm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Im trying to prove that &lt;span class=&quot;math-container&quot;&gt;$D(U,V)=2E(U,V)$&lt;/span&gt;, which can be seen from taking &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; as the same vector.&#xA;I also tried considering the case &lt;span class=&quot;math-container&quot;&gt;$U=R_z(\theta)$&lt;/span&gt; and taking &lt;span class=&quot;math-container&quot;&gt;$m=\cos(\alpha)Z + \sin(\alpha)X$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="1754" LastEditorUserId="55" LastEditDate="2020-10-12T21:25:46.133" LastActivityDate="2020-10-12T21:25:46.133" Title="Prove that for one-qubit unitaries $\text{Tr}|U-V|=2\max_\psi\|(U-V)|\psi\rangle\|$" Tags="&lt;mathematics&gt;&lt;trace-distance&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11837" PostTypeId="1" AcceptedAnswerId="11838" CreationDate="2020-05-04T06:14:55.840" Score="0" ViewCount="126" Body="&lt;p&gt;How does entangle qubits pass single qubit gate?&#xA;For example, I initialize two qubits &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\otimes|0\rangle$&lt;/span&gt;, then first qubit passes &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate to make it an superposition state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt; and then applied CNOT gate. The state finally become &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then I put the first qubit into &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. What will happen? It will become &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|10\rangle+|01\rangle)$&lt;/span&gt;? If so, how could it is possible the entangled two quibits pass the single-qubit-gate? If not, what will happen in this situation?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="9006" LastEditDate="2020-05-04T21:33:59.007" LastActivityDate="2020-05-04T21:33:59.007" Title="How does entangle qubits pass single qubit gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11838" PostTypeId="2" ParentId="11837" CreationDate="2020-05-04T06:42:12.563" Score="1" Body="&lt;p&gt;Here are the steps in details:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, we don't apply to the two-qubit state an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator, instead, we actually apply &lt;span class=&quot;math-container&quot;&gt;$X \otimes I$&lt;/span&gt; operator or &lt;span class=&quot;math-container&quot;&gt;$I \otimes X$&lt;/span&gt; depending on what qubit &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is applied.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-04T06:47:20.327" LastActivityDate="2020-05-04T06:47:20.327" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11839" PostTypeId="2" ParentId="11837" CreationDate="2020-05-04T06:58:25.283" Score="1" Body="&lt;p&gt;Generally, if you have no gate on qubit, it means that there is an identity operator &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. So if you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, a gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; applied on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; th qubit and no gate on others, effectively you have a gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I_1 \otimes \dots \otimes I_{i-1} \otimes U \otimes I_{i+1} \otimes I_n,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits gate. So in your case two qubits go through two qubits gate as Davit shown in his answer.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-04T06:58:25.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11840" PostTypeId="1" AcceptedAnswerId="11842" CreationDate="2020-05-04T07:30:44.813" Score="2" ViewCount="75" Body="&lt;p&gt;Now I have five qubits quantum circuit like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/AJwXY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AJwXY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and as the circuit, first &lt;code&gt;q[0], q[2] and q[3]&lt;/code&gt; pass the X gate, and then is that means they store in QRAM as a whole by the following quantum circuit?&#xA;If so, in the next step, how could it possible to take &lt;code&gt;q[3]&lt;/code&gt; and &lt;code&gt;q[4]&lt;/code&gt; out from the &quot;whole &lt;span class=&quot;math-container&quot;&gt;$| \text{out} \rangle$&lt;/span&gt;&quot;?or actually, every time it takes the &quot;whole &lt;span class=&quot;math-container&quot;&gt;$| \text{out} \rangle$&lt;/span&gt;&quot; to the new step?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3Dr0A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Dr0A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="5955" LastEditDate="2020-05-04T08:45:07.160" LastActivityDate="2020-05-04T08:45:07.160" Title="A question about how to store the quantum state in quantum circuit" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11841" PostTypeId="2" ParentId="11834" CreationDate="2020-05-04T07:32:59.703" Score="4" Body="&lt;p&gt;Let's start with expanding the calculation of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E(U,V)=\max_{|\psi\rangle}\sqrt{\langle\psi|(U-V)^\dagger(U-V)|\psi\rangle}.&#xA;$$&lt;/span&gt;&#xA;Clearly, we want &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to be the eigenvector with maximum eigenvalue of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2I-V^\dagger U-U^\dagger V.&#xA;$$&lt;/span&gt;&#xA;Let's note that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U^\dagger V$&lt;/span&gt;, then the eigenvalue must be of the form &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$U^\dagger V$&lt;/span&gt; is unitary&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Furthermore, it is also an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$V^\dagger U$&lt;/span&gt;, but with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta}$&lt;/span&gt; just by rearranging (multiplying by &lt;span class=&quot;math-container&quot;&gt;$V^\dagger U$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$U^\dagger V|\psi\rangle=e^{i\theta}|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For a single-qubit rotation where &lt;span class=&quot;math-container&quot;&gt;$\text{det}(U)=\text{det}(V)=1$&lt;/span&gt;, there is a second eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\psi^{\perp}\rangle$&lt;/span&gt; whose eigenvalue is the conjugate (i.e. &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$U^\dagger V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$V^\dagger U$&lt;/span&gt;) because the eigenvalues must have a product equal to 1.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E(U,V)=\sqrt{2-e^{i\theta}-e^{-i\theta}}=2\cos\frac{\theta}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now let's consider &lt;span class=&quot;math-container&quot;&gt;$D(U,V)$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D(U,V)=\text{Tr}\left(\sqrt{(U-V)^\dagger(U-V)}\right).&#xA;$$&lt;/span&gt;&#xA;When taking the trace, we can use any basis we want. Let's use the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$2I-V^\dagger U-U^\dagger V$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&#xA;Square roots maintain the diagonalisation, which means we can do&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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},&#xA;$$&lt;/span&gt;&#xA;and we can now make use of the eigenvector relations&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;D(U,V)&amp;amp;=\sqrt{2+e^{i\theta}+e^{-i\theta}}+\sqrt{2+e^{-i\theta}+e^{i\theta}} \\&#xA;&amp;amp;=4\cos\frac{\theta}{2} \\&#xA;&amp;amp;=2E(U,V).&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;For a completely different way to tackle the problem, let &lt;span class=&quot;math-container&quot;&gt;$U=e^{i\theta\underline{n}\cdot\underline{\sigma}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V=e^{i\phi\underline{m}\cdot\underline{\sigma}}$&lt;/span&gt;. Let's multiply out &lt;span class=&quot;math-container&quot;&gt;$U^\dagger V$&lt;/span&gt;. We get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&#xA;Similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&#xA;So, when we add these two terms together, the middle two terms cancel immediately. The last term requires a little more thought. Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\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}.&#xA;$$&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^\dagger V+V^\dagger U=2I(\cos\theta\cos\phi+\underline{n}\cdot\underline{m})\sin\theta\sin\phi).&#xA;$$&lt;/span&gt;&#xA;Overall, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2I-U^\dagger V-V^\dagger=2I(1-\cos\theta\cos\phi-\underline{n}\cdot\underline{m}),&#xA;$$&lt;/span&gt;&#xA;which makes both the maximum eigenvector and the trace very easy to deal with and, critically, the trace of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is double the maximum eigenvector.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-04T07:32:59.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11842" PostTypeId="2" ParentId="11840" CreationDate="2020-05-04T08:15:36.763" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X \otimes I \otimes X \otimes X \otimes I |00000\rangle = |10110\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I \otimes CNOT^{3,4} |10110\rangle = |101\rangle \otimes  CNOT^{3,4}|10\rangle = |10111\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes I \otimes I \otimes CNOT^{4,3} |10111\rangle = |101\rangle \otimes  CNOT^{4,3}|11\rangle = |10101\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here the indexes of the qubits start from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Note that sometimes it is more convenient to drop the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators wherever it is possible. For example, the last step can be written in a shorter form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT^{4,3} |10111\rangle = |101\rangle \otimes  CNOT^{4,3}|11\rangle = |10101\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-04T08:28:45.713" LastActivityDate="2020-05-04T08:28:45.713" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11843" PostTypeId="1" CreationDate="2020-05-04T08:24:11.747" Score="0" ViewCount="70" Body="&lt;p&gt;Find the decomposition of the following matrix into two level unitary matrices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\&#xA;1 &amp;amp; i &amp;amp; -1 &amp;amp; -i\\&#xA;1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1\\&#xA;1 &amp;amp; -i &amp;amp; -1 &amp;amp; i\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11580" LastEditorUserId="9006" LastEditDate="2020-05-05T13:41:11.547" LastActivityDate="2020-05-05T13:41:11.547" Title="Find the decomposition of the following matrix into two level unitary matrices" Tags="&lt;matrix-representation&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ClosedDate="2020-05-04T20:16:11.013" ContentLicense="CC BY-SA 4.0" />
  <row Id="11844" PostTypeId="2" ParentId="11834" CreationDate="2020-05-04T11:15:54.580" Score="2" Body="&lt;p&gt;Use the fact that both distance measures are invariant under left- as well as right-multiplication (independently!) with an arbitrary unitary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way, you can map &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$R_z(\phi)$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will simplify the problem tremendously.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-05-04T11:15:54.580" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11845" PostTypeId="1" AcceptedAnswerId="11846" CreationDate="2020-05-04T12:19:10.240" Score="1" ViewCount="204" Body="&lt;p&gt;I am interested in the execution time of quantum gates on IBM's &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;-qubits Melbourne computer. Is there any information regarding this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;After searching for a while I have only managed to find the times of the &lt;code&gt;CNOT&lt;/code&gt; gates &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/blob/master/backends/melbourne/V1/version_log.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but unfortunately, no information for other quantum operations. I am specifically interested in the Hadamard gate &lt;code&gt;.h()&lt;/code&gt; and the phase and rotation gates &lt;code&gt;.rz()&lt;/code&gt; and &lt;code&gt;.u3()&lt;/code&gt;, as well as the simple inverter &lt;code&gt;.x()&lt;/code&gt;. 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!&lt;/p&gt;&#xA;" OwnerUserId="6244" LastEditorUserId="9006" LastEditDate="2020-05-04T21:26:22.003" LastActivityDate="2020-05-04T21:26:22.003" Title="Quantum gates execution times on IBM Q Melbourne" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11846" PostTypeId="2" ParentId="11845" CreationDate="2020-05-04T12:47:47.610" Score="2" Body="&lt;p&gt;You can get all the information about execution times on a backend by using the &lt;code&gt;.properties()&lt;/code&gt; method in Qiskit. In your example, this can be done as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmq_16_melbourne')&#xA;backend.properties()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This returns an object containing all the gate times. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is worth noting that all single qubit gates get converted into &lt;code&gt;u3&lt;/code&gt; gates, and all multiqubit gates converted to use &lt;code&gt;cx&lt;/code&gt;, 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 &lt;code&gt;new_qc = transpile(qc, optimization_level=3)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-04T12:47:47.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11847" PostTypeId="2" ParentId="11843" CreationDate="2020-05-04T13:39:06.140" Score="1" Body="&lt;p&gt;This is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Fourier Transform&lt;/a&gt; and the Wiki page provides a generic decomposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AW7vr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AW7vr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can you find your two qubit version?&lt;/p&gt;&#xA;" OwnerUserId="5280" LastActivityDate="2020-05-04T13:39:06.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11848" PostTypeId="1" CreationDate="2020-05-04T14:07:02.310" Score="0" ViewCount="86" Body="&lt;p&gt;You are given a quantum state&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; qubits and the possibility to recreate the state &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; times, but only one at a time. Further &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; grows polynomial with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$m=O(poly(n))$&lt;/span&gt;. Your task is to determine the probability (or even harder the coefficient) of &lt;span class=&quot;math-container&quot;&gt;$\ket{00\cdots0}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;, so you start to measure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since you don't have enough (exponentially many) copies to fully characterize &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt;, what is the best strategy to at least get an upper bound on the probability to measure &lt;span class=&quot;math-container&quot;&gt;$\ket{00\cdots 0}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is brute force measuring the best or could entanglement help?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ok, so what one can do is to measure all qubits and collapse the state to &lt;span class=&quot;math-container&quot;&gt;$\ket{ m_0m_1\cdots m_{2n-1}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$m_k$&lt;/span&gt; is the measured &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th qubit &lt;span class=&quot;math-container&quot;&gt;$\in \{\ket0,\ket1\}$&lt;/span&gt;. And then I count (&lt;span class=&quot;math-container&quot;&gt;$\#C_{\ket{00\cdots 0}}$&lt;/span&gt;) how many &lt;span class=&quot;math-container&quot;&gt;$\ket{00\cdots 0}$&lt;/span&gt; I had and divide by &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. This gives at least the probability &lt;span class=&quot;math-container&quot;&gt;$\displaystyle p_{\ket{00\cdots 0}}=\frac{\#C_{\ket{00\cdots 0}}}{m}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But doesn't measuring any &lt;span class=&quot;math-container&quot;&gt;$\ket0$&lt;/span&gt; at any qubit &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (I assume that qubits are measured one by one) and statistics on that affect my overall &lt;span class=&quot;math-container&quot;&gt;$p_{\ket{00\cdots 0}}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I thought of some statistical thing like &lt;a href=&quot;https://en.wikipedia.org/wiki/Bayesian_inference#Examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bayesian Inference, testing of hypothesis,...&lt;/a&gt;. Can these methods be applied?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;E.g. if I only look at the first measured qubit. If I measure a &lt;span class=&quot;math-container&quot;&gt;$\ket0$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\#C_{\ket{0}}/4m$&lt;/span&gt;...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-05-06T18:07:22.183" LastActivityDate="2020-05-06T18:07:22.183" Title="What is the best strategy to get an upper bound to measure $|00\cdots 0\rangle$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="11850" PostTypeId="1" CreationDate="2020-05-04T15:49:59.137" Score="2" ViewCount="18" Body="&lt;p&gt;In superconducting qubits, all the method that I have seen until now are based on short range interaction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is:&lt;/strong&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="9006" LastEditDate="2020-05-04T21:21:36.440" LastActivityDate="2020-05-04T21:21:36.440" Title="Long range two qubit gates in superconducting qubits" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;physical-realization&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11851" PostTypeId="1" AcceptedAnswerId="11852" CreationDate="2020-05-04T16:10:31.040" Score="4" ViewCount="445" Body="&lt;p&gt;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. &#xA;For implementing the oracle, I use a CNOT gate and now I have this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h3Ssl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h3Ssl.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every time I ran it, the first qubit is always in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&#xA;I am not sure if this is what I expect. Shouldn't it be sometimes &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and sometimes &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9569" LastEditorUserId="9006" LastEditDate="2020-05-04T21:20:01.933" LastActivityDate="2020-05-04T21:20:01.933" Title="Deutsch's algorithm in Qiskit" Tags="&lt;qiskit&gt;&lt;nielsen-and-chuang&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11852" PostTypeId="2" ParentId="11851" CreationDate="2020-05-04T16:43:37.947" Score="2" Body="&lt;p&gt;CNOT gate is an example that implements a balanced function for which &lt;span class=&quot;math-container&quot;&gt;$f(0) = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1) = 1$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;CNOT \frac{1}{2}\left(|0\rangle + |1\rangle \right) \left(|0\rangle - |1\rangle \right) =&#xA;\\&#xA;= \frac{1}{2}|0\rangle \left(|0 \oplus f(0)\rangle - |1 \oplus f(0)\rangle \right) &#xA;+ \frac{1}{2}|1\rangle \left(|0 \oplus f(1)\rangle - |1 \oplus f(1)\rangle \right) =&#xA;\\&#xA;= \frac{1}{2} \left(|0\rangle - |1\rangle \right) \left(|0\rangle - |1\rangle \right)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It means that if we will do everything right we always should obtain (for balanced functions &lt;span class=&quot;math-container&quot;&gt;$f(0) \ne f(1)$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; outcome in the Deutsch algorithm.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f(0) = f(1)$&lt;/span&gt; then the first qubit  will be in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and if &lt;span class=&quot;math-container&quot;&gt;$f(0) \ne f(1)$&lt;/span&gt; (like the case with CNOT) then the first qubit will be in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state before the measurement.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-04T19:55:07.967" LastActivityDate="2020-05-04T19:55:07.967" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11853" PostTypeId="1" CreationDate="2020-05-04T17:40:13.463" Score="3" ViewCount="47" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt N)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How about the following scenario:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are given access to an oracle with &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; marked items, and &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is unknown. What would be a lower bound for finding a marked item using &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt {N/K})$&lt;/span&gt;, with probability more than &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, is there an algorithm to show it?&lt;/p&gt;&#xA;" OwnerUserId="11927" LastEditorUserId="9006" LastEditDate="2020-05-04T21:15:15.807" LastActivityDate="2020-05-04T21:15:15.807" Title="How to find a marked item out of $K &lt; N$ marked items when K is unknown?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11854" PostTypeId="2" ParentId="11824" CreationDate="2020-05-04T17:48:46.030" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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}}$&lt;/span&gt;You can prove this as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\sigma=|k\rangle\!\langle k|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Expliciting the expression of &lt;span class=&quot;math-container&quot;&gt;$M(\rho)$&lt;/span&gt; in its matrix components we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ M(\rho)_{ij} &#xA;    = \sum_{a,n,m} \calU_{i a}^{n k}(\calU^*)_{j a}^{m k} \rho_{nm}.&#xA;$$&lt;/span&gt;&#xA;This gives you the Kraus representation &lt;span class=&quot;math-container&quot;&gt;$M(\rho)=\sum_a A_a^{(k)}\rho A_a^{(k)\dagger}$&lt;/span&gt; with  &lt;span class=&quot;math-container&quot;&gt;$(A_a^{(k)})_{i,n}\equiv \calU_{ia}^{nk}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Our hypothesis is that, for some unitary &lt;span class=&quot;math-container&quot;&gt;$\calV$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$M(\rho)=\calV\rho\calV^\dagger$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;This would then imply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\calV \rho\calV^\dagger = \sum_a A_a^{(k)}\rho A_a^{(k)\dagger}\quad\forall\rho,$$&lt;/span&gt;&#xA;&#xA;This, in turn, implies that &lt;span class=&quot;math-container&quot;&gt;$A_a^{(k)}=C_{a}^{(k)}\calV$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_a |C_a^{(k)}|^2=1$&lt;/span&gt;.&#xA;This follows from the fact that if &lt;span class=&quot;math-container&quot;&gt;$\sum_a A_a\rho A_a^\dagger=\sum_a B_a \rho B_a^\dagger$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; then for some unitary &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$A_a=\sum_b C_{ab}B_b$&lt;/span&gt; (which in turn is a direct application of the SVD decomposition). If &lt;span class=&quot;math-container&quot;&gt;$B_b=\delta_{b0}\calV$&lt;/span&gt; we get the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We thus proved that &lt;span class=&quot;math-container&quot;&gt;$(A_a^{(k)})_{i,n}=\calU_{ia}^{nk}=C_a^{(k)}\calV_{i}^n$&lt;/span&gt;.&#xA;This is essentially the conclusion: it means that &lt;span class=&quot;math-container&quot;&gt;$\calU=\calV\otimes \tilde C$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\tilde C$&lt;/span&gt; a unitary whose first column (or row, depending on the convention we are using) equals &lt;span class=&quot;math-container&quot;&gt;$(C_a^{(k)})_a$&lt;/span&gt; (it can be any such unitary, as &lt;span class=&quot;math-container&quot;&gt;$\calU$&lt;/span&gt; is not fully defined by the definition of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-04T17:48:46.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11855" PostTypeId="1" CreationDate="2020-05-04T19:47:59.510" Score="2" ViewCount="117" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Assume we have a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$t= 0$&lt;/span&gt;. Then, the measuring instrument performs the measurement in the time interval &lt;span class=&quot;math-container&quot;&gt;$(- \epsilon, \epsilon)$&lt;/span&gt;. The probability of it happening within this interval at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$p(t) \delta t$&lt;/span&gt;. Obviously, &lt;span class=&quot;math-container&quot;&gt;$ \int_{- \epsilon}^\epsilon p(t) d t = 1$&lt;/span&gt;. The density operator post measurement at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is given by: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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 )$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With being the &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; is an arbitrary projection operator &lt;span class=&quot;math-container&quot;&gt;$\tilde \rho$&lt;/span&gt; being the density matrix at time &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; (assuming no measurement) and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; being the unitary operator. The resultant density matrix when the non-ideal measurement device is included is given by at time &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\rho(\epsilon)$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    \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&#xA;\end{equation}&lt;/span&gt;&#xA; &lt;span class=&quot;math-container&quot;&gt;$$+ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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  $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$+ $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \vdots$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ + $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    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&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, in the limit &lt;span class=&quot;math-container&quot;&gt;$\delta t \to 0$&lt;/span&gt; we get an integral:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; \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 &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us see what happens as &lt;span class=&quot;math-container&quot;&gt;$\epsilon \to 0$&lt;/span&gt;. The first thing we notice is this would imply:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    \epsilon \to 0 \implies p(z) \to \delta (z)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Substituting this result in our integral we get the normal result of an ideal measurement at &lt;span class=&quot;math-container&quot;&gt;$t = 0$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    \lim_{\epsilon \to 0}\rho( \epsilon) = \frac{  P_i \tilde \rho  P_i}{Tr  P_i \tilde \rho }&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Consider the von Neumann entropy &lt;span class=&quot;math-container&quot;&gt;$S(\rho)$&lt;/span&gt; of the system. Is there a way to find the probability distributions which ensure the von Neumann entropy always increases? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ S(\rho(-\epsilon)) \leq S(\rho(\epsilon)) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Try to solve for as general as possible?&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="9118" LastEditDate="2020-10-26T18:31:22.043" LastActivityDate="2020-10-26T18:31:22.043" Title="Increasing the von Neumann entropy despite the measurement?" Tags="&lt;measurement&gt;&lt;density-matrix&gt;&lt;entropy&gt;&lt;projection-operator&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11856" PostTypeId="1" CreationDate="2020-05-05T01:04:05.717" Score="1" ViewCount="40" Body="&lt;p&gt;My question concerns a proof in &lt;a href=&quot;https://people.eecs.berkeley.edu/~vazirani/pubs/qao.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://people.eecs.berkeley.edu/~vazirani/pubs/qao.pdf&lt;/a&gt;, &quot;Limits on Quantum Adiabatic Optimization - Warning: Rough Manuscript!&quot; by Wim van Dam and Umesh Vazirani. It seems that it was never completed, although it has been &lt;em&gt;cited&lt;/em&gt; several times since. In particular, Lemma 2 states (summarized and paraphrased):&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;If a quantum adiabatic algorithm is carried out on a graph of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; with diameter &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, with a Hamiltonian whose entries are polynomial in &lt;span class=&quot;math-container&quot;&gt;$\log(n)$&lt;/span&gt;, the optimization will take time &lt;span class=&quot;math-container&quot;&gt;$2^{(w \log w)}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Expander_graph&quot; rel=&quot;nofollow noreferrer&quot;&gt;expander graph&lt;/a&gt; with degree &lt;span class=&quot;math-container&quot;&gt;$d = \log^k(n)$&lt;/span&gt;, and get a graph of width &lt;span class=&quot;math-container&quot;&gt;$w = c\log(n)/\log(d)$&lt;/span&gt; for some constant &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That would imply a runtime of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then by taking &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; to be sufficiently large, say, &lt;span class=&quot;math-container&quot;&gt;$4/c$&lt;/span&gt;, this gives you a &lt;span class=&quot;math-container&quot;&gt;$poly(log(n))*2^{\log(n)/4}$&lt;/span&gt;, which appears to outperform Grover's algorithm, which is strong evidence that something here has gone wrong. :) &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2358/can-adiabatic-quantum-computing-be-faster-than-grovers-algorithm&quot;&gt;As pointed out in the second answer to this question&lt;/a&gt;, 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. &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; would depend on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; in some nontrivial way or something.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can anyone explain what's going on here, and perhaps provide a proof of that Lemma 2?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;[*] This requires the existence of a such a graph. Moore graphs seem sufficient (a degree-&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; tree branching out for &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\lambda_2 \le 2\sqrt{d-1}$&lt;/span&gt;, and the edge expansion is lower-bounded by &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(d-\lambda_2) \ge \frac{d}{3}$&lt;/span&gt;. A graph with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; vertices and edge expansion &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; has diameter bounded by &lt;span class=&quot;math-container&quot;&gt;$2\log(n)/\log(1+\phi)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10115" LastEditorUserId="55" LastEditDate="2020-05-24T09:17:29.413" LastActivityDate="2020-05-24T09:17:29.413" Title="van Dam's proof for adiabatic optimization and graph diameter" Tags="&lt;optimization&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11857" PostTypeId="1" AcceptedAnswerId="14889" CreationDate="2020-05-05T01:52:19.353" Score="5" ViewCount="146" Body="&lt;p&gt;I am following the 5.4.1 Period-Finding Algorithm in Nielsen and Chuang as shown below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/rArn0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rArn0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Nielsen and Chuang states on the next page that &amp;quot;the approximate equality in step 3 is required because &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; may not be an integer multiple of r in general&amp;quot;. But when I work through the following steps, I don't see exactly why &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; must be an integer multiple of r for the equality to hold. Consider:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We know by the definition of &lt;span class=&quot;math-container&quot;&gt;$|\hat{f}(\ell)\rangle$&lt;/span&gt; in the image above,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\hat{f}(\ell)\rangle = \frac{1}{\sqrt{r}}\sum_{s = 0}^{r-1} e^{-2\pi i\ell s/r} |f(s)\rangle$$&lt;/span&gt;&#xA;(I use &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; as the index instead of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is already used as an index in the first expression.) Anyways, now plugging this in to the first expression, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we know that &lt;span class=&quot;math-container&quot;&gt;$g(x, s) = \sum_{\ell=0}^{r-1} e^{2\pi \ell(x-s)/r} = r$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$r|(x-s)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; otherwise. Also, let &lt;span class=&quot;math-container&quot;&gt;$x \equiv s_2 (mod \&amp;gt; r)$&lt;/span&gt;. So for every &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in the summation, there is an &lt;span class=&quot;math-container&quot;&gt;$s = s_2$&lt;/span&gt; meaning that &lt;span class=&quot;math-container&quot;&gt;$g(x, s_2) = r$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g(x, s) = 0$&lt;/span&gt; for every other &lt;span class=&quot;math-container&quot;&gt;$s \neq s_2$&lt;/span&gt;. This means that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Regardless of whether &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; is a multiple of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, this equality holds. However, Nielsen and Chuang is stating that its an approximation, being equal only if &lt;span class=&quot;math-container&quot;&gt;$r|2^t$&lt;/span&gt;. What exactly am I missing here? Perhaps I'm making some assumption that is not true in the work above?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-12-28T18:02:30.250" Title="Question Regarding Quantum Period-Finding Fourier Transform Approximation" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;nielsen-and-chuang&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11858" PostTypeId="1" AcceptedAnswerId="11860" CreationDate="2020-05-05T05:49:01.113" Score="3" ViewCount="115" Body="&lt;p&gt;In the book, Nielsen and Chuang, there is a section on quantum simulation of the quantum search algorithm. Hamiltonion operator is defined as follows-&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = |x\rangle\langle x| + |\psi\rangle\langle\psi|&#xA;$$&lt;/span&gt;&#xA;where x is the only solution to the search problem and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\psi = \frac{\sum_{x}{|x\rangle}}{N}&#xA;$$&lt;/span&gt;&#xA;with N being the total number of elements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uQSRi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uQSRi.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11932" LastEditorUserId="9006" LastEditDate="2020-05-05T06:13:30.850" LastActivityDate="2020-05-06T07:41:13.163" Title="Problem with building quantum circuit for Hamiltonian operation" Tags="&lt;circuit-construction&gt;&lt;simulation&gt;&lt;nielsen-and-chuang&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11859" PostTypeId="2" ParentId="11703" CreationDate="2020-05-05T06:55:01.903" Score="0" Body="&lt;p&gt;So, I add a &quot;ghost qubit&quot; in the solution space in order to increase &lt;em&gt;N&lt;/em&gt;. I fixe the &quot;ghost qubit&quot; to a state (|1&gt; here) and we get &lt;em&gt;#solutions &amp;lt; N/2&lt;/em&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ENFne.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ENFne.png&quot; alt=&quot;The circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TcJyE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TcJyE.png&quot; alt=&quot;The results&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10192" LastActivityDate="2020-05-05T06:55:01.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11860" PostTypeId="2" ParentId="11858" CreationDate="2020-05-05T07:32:51.103" Score="5" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;if the top register is in the all 0 state, flip the bit of the second register&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if the second register is in 1, apply a phase. Otherwise, do nothing.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;if the top register is in the all 0 state, flip the bit of the second register.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Clearly, the first and the third cancel each other out, meaning that the second register will return as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. 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 &quot;add a phase if the top register is in the all 0 state&quot;. Thus, the effect of these 3 gates on the first register can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I+(e^{i\Delta t}-1)|0\rangle\langle 0|^{\otimes n}.&#xA;$$&lt;/span&gt;&#xA;You can now take into account the effect of the other two gates.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To check the identity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I+(e^{i\Delta t}-1)|\psi\rangle\langle \psi|=e^{i\Delta t|\psi\rangle\langle\psi|},&#xA;$$&lt;/span&gt;&#xA;it is perhaps easiest to go from right to left. Clearly, the operator &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; is a rank 1 projector, which I'll denote &lt;span class=&quot;math-container&quot;&gt;$P_{\psi}$&lt;/span&gt;. We can introduce a second projector &lt;span class=&quot;math-container&quot;&gt;$P_{\perp}=I-P_{\psi}$&lt;/span&gt;. The states that this projects onto all have 0 eigenvalue with &lt;span class=&quot;math-container&quot;&gt;$P_{\psi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The definition of the exponential of matrix &lt;span class=&quot;math-container&quot;&gt;$M=\sum_j\lambda_jP_j$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\theta M}=\sum_je^{i\lambda_j\theta}P_j.&#xA;$$&lt;/span&gt;&#xA;So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\Delta t|\psi\rangle\langle\psi|}=e^{i\Delta t}P_{\psi}+P_{\perp},&#xA;$$&lt;/span&gt;&#xA;which is exactly what we were after.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-05-06T07:41:13.163" LastActivityDate="2020-05-06T07:41:13.163" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11861" PostTypeId="1" AcceptedAnswerId="12133" CreationDate="2020-05-05T10:21:25.380" Score="8" ViewCount="861" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; on Spin-2 processor, &lt;a href=&quot;https://www.quantum-inspire.com/kbase/starmon-5-operational-specifics/&quot; rel=&quot;noreferrer&quot;&gt;Starmon-5 gate set consist only of&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pauli gates &lt;span class=&quot;math-container&quot;&gt;$\text{X}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\text{Y}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\text{Z}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{I}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$\text{H}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Phase gate (&lt;span class=&quot;math-container&quot;&gt;$\text{S}$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\text{T}$&lt;/span&gt;) gate and their conjugate transpose gates&lt;/li&gt;&#xA;&lt;li&gt;rotation around axes &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; for angle &lt;span class=&quot;math-container&quot;&gt;$\pm\frac{\pi}{2}$&lt;/span&gt; gates&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\text{CZ}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{SWAP}$&lt;/span&gt; gates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is how can I construct gates &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; with rotation angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; from gate listed above.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on advice from &lt;em&gt;JSdJ&lt;/em&gt; and the Nielsen and Chuang book, I found out that:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$HTH = Rx(\pi/4)$&lt;/span&gt; which together with the fact that &lt;span class=&quot;math-container&quot;&gt;$T=Rz(\pi/4)$&lt;/span&gt; allows to build gate &#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&#xA;(note that &lt;span class=&quot;math-container&quot;&gt;$Y=-iZX$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;this is a rotation around axis defined by vector &lt;span class=&quot;math-container&quot;&gt;$\hat{n}=(\cos(\pi/8);\sin(\pi/8);\cos(\pi/8))$&lt;/span&gt;. Rotation angle is given by equation &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2) =\cos^2(\pi/8)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$2\arccos[\cos^2(\pi/8)] \approx 1.096$&lt;/span&gt; which is irrational multiple of &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;since &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is irrational, repeated application of the gate &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}$&lt;/span&gt; never leads to rotation by an angle which sum up to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;as a result we are able to reach any rotation by angle &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; around &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; axis by repeated application of &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}$&lt;/span&gt;, i.e. we can construct &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\alpha)=R_{\hat{n}}^{n_1}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n_1$&lt;/span&gt; is an integer&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;also it is true that &lt;span class=&quot;math-container&quot;&gt;$HR_{\hat{n}}(\alpha)H = R_{\hat{m}}(\alpha)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\hat{m}$&lt;/span&gt; is axis defined by vector &lt;span class=&quot;math-container&quot;&gt;$(\cos(\pi/8);-\sin(\pi/8);\cos(\pi/8))$&lt;/span&gt;, so the same procedure allows to find rotation for &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; around axis &lt;span class=&quot;math-container&quot;&gt;$\hat{m}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;it can also be proven that any arbitrary single qubit unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written (up to global phase) as &lt;span class=&quot;math-container&quot;&gt;$U = R_{\hat{n}}(\beta_1)R_{\hat{m}}(\gamma_1)R_{\hat{n}}(\beta_2)R_{\hat{m}}(\gamma_2)\dots$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;together this leads to conclusion that any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (including &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; rotations) can be approximated by repeated application of &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}$&lt;/span&gt; and Hadamards, i.e. &lt;span class=&quot;math-container&quot;&gt;$U \approx R_{\hat{n}}^{n_1}HR_{\hat{n}}^{n_2}HR_{\hat{n}}^{n_3}HR_{\hat{n}}^{n_4}H \dots$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; are integers&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;To sum up, only with &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates we can construct any rotation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Only question is how to find integers &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; for construction of arbitrary &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; rotation. Can anybody give me an example of such circuit, for exaple gate &lt;span class=&quot;math-container&quot;&gt;$Ry(\pi/8)$&lt;/span&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-05-06T10:15:40.097" LastActivityDate="2020-06-16T18:57:18.030" Title="How to approximate $Rx$, $Ry$ and $Rz$ gates?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;quantum-inspire&gt;" AnswerCount="3" CommentCount="10" FavoriteCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11862" PostTypeId="1" CreationDate="2020-05-05T10:51:43.967" Score="1" ViewCount="56" Body="&lt;p&gt;Alice wants to send Bob qubit in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_A\rangle = \alpha|0\rangle_A + \beta|1\rangle_A$&lt;/span&gt; , also she has one qubit from GHZ state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0\rangle_a|00\rangle +|1\rangle_a|11\rangle)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then she performs Bell basis&lt;br&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$|\Psi_{\pm}\rangle_{Aa}=\frac{1}{\sqrt 2}(|00\rangle_{Aa}\pm|11\rangle_{Aa})$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ |\Phi_{\pm}\rangle_{Aa}=\frac{1}{\sqrt 2}(|01\rangle_{Aa}\pm|10\rangle_{Aa})$&lt;/span&gt; &#xA;measurement on qubits &lt;span class=&quot;math-container&quot;&gt;$(A, a)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of projection operators and/or measurement operators how can I get expression for this 4-qubit state: &#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\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)]$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(I understand that if just simplify this exptression I get &lt;span class=&quot;math-container&quot;&gt;$(\alpha|0\rangle_A + \beta|1\rangle_A) \frac{1}{\sqrt 2}(|0\rangle_a|00\rangle +|1\rangle_a|11\rangle)$&lt;/span&gt; ???&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dHhJr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dHhJr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ETDhp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ETDhp.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11641" LastEditorUserId="55" LastEditDate="2020-10-12T21:25:09.160" LastActivityDate="2020-10-12T21:25:09.160" Title="What kind of operators should I perform on 4-qubit state $|\psi\rangle_A|GHZ\rangle$ to get expression like $|\Psi\rangle_4$?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11863" PostTypeId="1" AcceptedAnswerId="12191" CreationDate="2020-05-05T11:24:52.817" Score="2" ViewCount="60" Body="&lt;p&gt;We are trying to implement a &quot;sum over 4 booleans = k&quot; in the spirit of Grover search. First, we have 4 qubits, one for each boolean &lt;code&gt;q00, q01, q02, q03,;&lt;/code&gt; then 4 qubits to computed intermediate sum (&lt;code&gt;q11&lt;/code&gt; and &lt;code&gt;q10&lt;/code&gt; to store &lt;code&gt;&quot;q00+q01&quot;&lt;/code&gt; where &lt;code&gt;q11&lt;/code&gt; is the carry, etc);  then 3 qubits to binary represent the int result &lt;code&gt;q22.q21.q20&lt;/code&gt; (varying between 0 to 3); and then a final qubit to test the result = k (here we want &lt;code&gt;k=1&lt;/code&gt; so &lt;code&gt;001&lt;/code&gt; is the good result, then 2 X gate on &lt;code&gt;q21&lt;/code&gt; and &lt;code&gt;q22&lt;/code&gt; will bring &lt;code&gt;111&lt;/code&gt; via the C3Not into &lt;code&gt;q40.&lt;/code&gt; Finally &lt;code&gt;q60&lt;/code&gt; is for Grover extraction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First we describe the sum (Oracle), then Grover Amplification (separated with a barrier); and done 2 iterations before measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The histogram result is quite strange despite we found the standard 4 solutions, 0000 and 1111 appear also.&#xA;Can someone explain this behaviour?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rK1zJ.png&quot; alt=&quot;Circuit sum over boolean = k&quot;&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CDkJc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CDkJc.png&quot; alt=&quot;Histogram k=1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11936" LastEditorUserId="9006" LastEditDate="2020-05-06T06:37:48.247" LastActivityDate="2020-05-26T09:39:19.913" Title="Implementing sum on Boolean with Grover algorithm" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11864" PostTypeId="2" ParentId="10298" CreationDate="2020-05-05T12:56:12.213" Score="1" Body="&lt;p&gt;I could find a few research papers with the potential application of quantum algorithms for Singular Value Decomposition and QR decomposition. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Singular Value Decomposition:&lt;/strong&gt;&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.worldscientific.com/doi/10.1142/S0218126610006797&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum SVD based Approximation Algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;QR Factorisation&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&#xA;can be used to reduce a matrix to upper triangular form using a minimal number of&#xA;rotations. One interesting rotation graph is the star graph. A second interesting rotation graph is the chain. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.cs.umd.edu/users/oleary/tr/tr4592.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;QR Factorisation using Rotation Graphs and Eliminated Orderings&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-05-05T12:56:12.213" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11866" PostTypeId="2" ParentId="8651" CreationDate="2020-05-05T22:01:35.230" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.cs.mcgill.ca/~prakash/Pubs/leader.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;following research paper.&lt;/a&gt; This paper outlines the state computation of quantum processors participating in the distributed consensus through a sequence of symmetric moves in the anonymous network. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is another relevant approach is proposed by Bogdan S. Chlebus, Dariusz  R. Kowalski and Michał Strojnowski in the the &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-3-642-15763-9_24&quot; rel=&quot;nofollow noreferrer&quot;&gt;following journal&lt;/a&gt;. 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. &lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-05-05T22:01:35.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11867" PostTypeId="1" CreationDate="2020-05-06T00:36:46.353" Score="1" ViewCount="29" Body="&lt;p&gt;I tried to run the starter program demonstrated on this page:&#xA;&lt;a href=&quot;http://docs.rigetti.com/en/stable/start.html#installing-the-qvm-and-compiler-on-linux-deb&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://docs.rigetti.com/en/stable/start.html#installing-the-qvm-and-compiler-on-linux-deb&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# construct a Bell State program&#xA;p = Program(H(0), CNOT(0, 1))&#xA;&#xA;# run the program on a QVM&#xA;qc = get_qc('9q-square-qvm')&#xA;result = qc.run_and_measure(p, trials=10)&#xA;for i in range(10):&#xA;    print(result[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And all of &lt;code&gt;result[i]&lt;/code&gt;'s turn out to be the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this expected?&#xA;If not, what might I be doing wrongly?&lt;/p&gt;&#xA;" OwnerUserId="11944" LastEditorUserId="55" LastEditDate="2020-05-10T07:52:29.933" LastActivityDate="2020-06-09T08:04:55.453" Title="Pyquil run_and_measure gives the same output across all the trials: is this expected?" Tags="&lt;programming&gt;&lt;pyquil&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11868" PostTypeId="2" ParentId="11867" CreationDate="2020-05-06T03:47:43.273" Score="1" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;And all of result[i]'s turn out to be the same.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is what I get from the program you posted:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[1 0 1 0 1 0 1 1 1 0]&#xA;[1 0 1 0 1 0 1 1 1 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;[0 0 0 0 0 0 0 0 0 0]&#xA;Traceback (most recent call last):&#xA;  File &quot;test.py&quot;, line 16, in &amp;lt;module&amp;gt;&#xA;    print(result[i])&#xA;KeyError: 9&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first 2 arrays are not the same as the rest, but they are correlated (that's what happens after &lt;code&gt;CNOT&lt;/code&gt; is applied to an &lt;code&gt;H&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key error is because you are performing a &lt;code&gt;run_and_measure&lt;/code&gt; on a 9 qubit device and you are trying to print &lt;code&gt;10&lt;/code&gt; measurement arrays. Studying the &lt;a href=&quot;http://docs.rigetti.com/en/stable/apidocs/autogen/pyquil.api.QuantumComputer.run_and_measure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt; for &lt;code&gt;run_and_measure&lt;/code&gt;: &quot;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.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's print out result&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;print(result)&#xA;#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])}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see that the &lt;code&gt;10&lt;/code&gt; different results from &lt;code&gt;run_and_measure&lt;/code&gt; of the first qubit and second are the same and the rest are &lt;code&gt;0&lt;/code&gt;'s cause we don't apply gates to them.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2020-05-06T03:55:50.490" LastActivityDate="2020-05-06T03:55:50.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11869" PostTypeId="2" ParentId="9826" CreationDate="2020-05-06T04:39:37.530" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Create a Conda Environment&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;conda create -n name_of_my_env python=3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Activate the Conda Environment&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;source activate name_of_my_env&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Install the QiSkit Package&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11945" LastEditorUserId="13968" LastEditDate="2020-12-05T23:14:47.873" LastActivityDate="2020-12-05T23:14:47.873" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11871" PostTypeId="1" AcceptedAnswerId="11876" CreationDate="2020-05-06T13:06:05.653" Score="1" ViewCount="94" Body="&lt;p&gt;I'm reading Horsman et al. &quot;Surface code quantum computing by lattice surgery&quot; and I'm wondering about the rotated surface code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider Figure 13:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FfHTs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FfHTs.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is supposed to have distance 5. But in (c), an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error on the top left qubit and the qubit beneath it would be undetectable (brown plaquettes are &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-stabilizer measurements). If there were a stabilizer measurement on every outside edge, this problem wouldn't occur. What am I misunderstanding?&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-05-06T18:01:40.263" Title="Is there benefit to extra stabilizers in a rotated surface code?" Tags="&lt;error-correction&gt;&lt;surface-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11872" PostTypeId="1" AcceptedAnswerId="11873" CreationDate="2020-05-06T13:59:46.790" Score="4" ViewCount="110" Body="&lt;p&gt;According to Solovay-Kitaev theorem it is possible to approximate any unitary quantum gate by sequence of gates from &lt;em&gt;small&lt;/em&gt; set of another gates. The approximation can be done with an arbitrary accuracy &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of such set of gates is composed of Hadamard gate, phase gate (&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; gate (&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;) and CNOT gate.&#xA;However, it is also true that &lt;span class=&quot;math-container&quot;&gt;$S=T^2$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate is a rotation around &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis by &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate a rotation by &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; around the same axis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Since &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate can be composed of two &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates, why do we add &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate to the set? It seems that a set containing only &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and CNOT is equivalent. What am I missing?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-06T14:13:31.190" Title="Why is phase gate a member of universal gate set?" Tags="&lt;quantum-gate&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11873" PostTypeId="2" ParentId="11872" CreationDate="2020-05-06T14:13:31.190" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$T^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-06T14:13:31.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11874" PostTypeId="2" ParentId="11871" CreationDate="2020-05-06T14:33:08.817" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$_{topleft}$&lt;/span&gt; and  beneath it &lt;span class=&quot;math-container&quot;&gt;$X_{beneath}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$X_{topleft} _{beneath}$&lt;/span&gt;  is a stabilizer and acts as the identity gate on the logical qubit. So we can choose to correct both errors with either &lt;span class=&quot;math-container&quot;&gt;$_{topleft}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$X_{beneath}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Take a look at:&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9469/how-does-surface-17-tell-apart-z-errors-on-db-and-dc/9482#9482&quot;&gt;How does Surface-17 tell apart Z errors on Db and Dc?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9282" LastActivityDate="2020-05-06T14:33:08.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11875" PostTypeId="1" AcceptedAnswerId="11973" CreationDate="2020-05-06T15:44:10.373" Score="3" ViewCount="116" Body="&lt;p&gt;I'm trying to understand the historical ordering and the practical differences between the Toffoli Gate and the Fredkin Gate.&lt;/p&gt;&#xA;&lt;p&gt;Toffoli's February 1980 tech report MIT/LCS/TM-151 states:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5wKwR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5wKwR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where reference [7] is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WEiTr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WEiTr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Conservative Logic&lt;/em&gt; is then published in 1982 in at least different guises: an article in &lt;em&gt;International Journal of Theoretical Physics&lt;/em&gt; and a chapter in &lt;em&gt;Collision-Based Computing&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So the implication to me is that the Fredkin gate precedes the Toffoli Gate.&lt;/p&gt;&#xA;&lt;p&gt;Given that both gates are universal, what is the purpose of trying to simulate Fredkin gates with Toffoli gates, or vice-versa?&lt;/p&gt;&#xA;&lt;p&gt;Also, Which gate is more commonly used, and why? A recent Google search finds 84 results for &amp;quot;Fredkin gate&amp;quot; in the Google index, and 86 results for &amp;quot;Toffoli gate.&amp;quot; Both of those seem to be dramatic undercounts.&lt;/p&gt;&#xA;" OwnerUserId="9482" LastEditorUserId="9482" LastEditDate="2020-09-28T04:06:24.770" LastActivityDate="2020-09-28T04:06:24.770" Title="What are the differences between the Toffoli and Fredkin gates (historical, practical, etc.)" Tags="&lt;circuit-construction&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11876" PostTypeId="2" ParentId="11871" CreationDate="2020-05-06T18:01:40.263" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;an X error on the top left qubit and the qubit beneath it would be undetectable&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That error would be detected by the flipping of the four body Z stabilizer adjacent to the lower qubit you operated on:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oUrMt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oUrMt.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UPtUj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UPtUj.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-05-06T18:01:40.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11877" PostTypeId="1" AcceptedAnswerId="11890" CreationDate="2020-05-06T18:52:05.840" Score="2" ViewCount="133" Body="&lt;p&gt;Knowing that CX and U3 (taking 3 parameters &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;) form a set of universal gates how can I construct an arbitrary CU3 gate using a decomposition of only CX and arbitrary U3 gates?&lt;/p&gt;&#xA;" OwnerUserId="11952" LastActivityDate="2020-05-08T10:26:20.650" Title="How to construct a CU3 gate using only CX and U3 gates?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11878" PostTypeId="2" ParentId="11877" CreationDate="2020-05-06T20:32:56.130" Score="3" Body="&lt;p&gt;Here is a construction of &lt;span class=&quot;math-container&quot;&gt;$CU3$&lt;/span&gt; gate on IBM Q:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;  u1((lambda+phi)/2) c;&#xA;  u1((lambda-phi)/2) t;&#xA;  cx c,t;&#xA;  u3(-theta/2,0,-(phi+lambda)/2) t;&#xA;  cx c,t;&#xA;  u3(theta/2,phi,0) t;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;t&lt;/code&gt; is a target qubit and &lt;code&gt;c&lt;/code&gt; is control qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; gate is a special case of &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt;, it holds that &lt;span class=&quot;math-container&quot;&gt;$U1(\lambda)=U3(0,0,\lambda)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-05-06T21:30:11.407" LastActivityDate="2020-05-06T21:30:11.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11879" PostTypeId="1" AcceptedAnswerId="11883" CreationDate="2020-05-06T21:07:37.740" Score="1" ViewCount="117" Body="&lt;p&gt;I am a little stuck on understanding the measurement probabilities of a 3 qubit system (QCQI q 4.41).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1)H gates are applied to both &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) &lt;span class=&quot;math-container&quot;&gt;$C^{(1,2)}_3(X)$&lt;/span&gt;, a Toffoli, controlled by &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is then applied to &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) A Unitary (S gate) is then applied to &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) &lt;span class=&quot;math-container&quot;&gt;$C^{(1,2)}_3(X)$&lt;/span&gt;, a Toffoli, controlled by &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is then applied to &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;5) H gates are applied to both &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle = |q_2\rangle = 0$&lt;/span&gt; should be &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{8}$&lt;/span&gt;, however I can only seem to derive &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{8}$&lt;/span&gt;, by expanding out the tensors and then cancelling.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After step 4 the state I think is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(|00\rangle + |01\rangle + |10\rangle)\otimes S|q_3\rangle + |11\rangle \otimes XSX|q_3\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then after applying step 5, expanding out and cancelling I am left with:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(|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 $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however I can't seem to find the missing &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and also in this result the measurement of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; corresponds to two different states of &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;. I think the error in my understanding is somewhere here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying Hs (step 5) and expanding &lt;span class=&quot;math-container&quot;&gt;$|11\rangle \otimes XSX|q_3\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(H|1\rangle \otimes H|1\rangle) \otimes IXSX|q_3\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$(|00\rangle - |01\rangle - |10\rangle + |11\rangle)\otimes XSX|q_3\rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could it also be my misunderstanding that the state of &lt;span class=&quot;math-container&quot;&gt;$|q_1q_2\rangle$&lt;/span&gt; going into both Toffoli gates can be different for step 2 &amp;amp; 4? I was assuming that if that state was &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; in the first Toffoli then it must be &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; into the second as well.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-07T03:23:44.360" LastActivityDate="2020-05-07T08:04:37.993" Title="Measuring Probability of Mixed States" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11881" PostTypeId="1" AcceptedAnswerId="14297" CreationDate="2020-05-07T04:38:13.280" Score="2" ViewCount="140" Body="&lt;p&gt;What would be the best/prefered bibtex entry for citing cirq ?&#xA;Is this ok ?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;@article{cirq,&#xA;    title={Cirq, a python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits},&#xA;    note={\url{https://github.com/quantumlib/Cirq}}&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9470" LastActivityDate="2020-10-22T17:36:04.120" Title="How to cite cirq in a scientific article?" Tags="&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11882" PostTypeId="1" AcceptedAnswerId="11884" CreationDate="2020-05-07T06:52:04.860" Score="1" ViewCount="206" Body="&lt;p&gt;This question was inspired by the following reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1401.6030&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reference paper&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We use the usual notation.  &lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt; ,  the number of all possible n-bit strings . The oracle  &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; can be put in the form  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_\omega=I - 2  (\vert\omega\rangle\langle\omega \vert )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; is a reflection of any vector on the hyperplane orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The vector &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle $&lt;/span&gt; and operator &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt; are introduced. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle = H^{\otimes n} \vert 0 \rangle^{\otimes n}$&lt;/span&gt; , where &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt;  is the n-qubit Hadamard transform. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Operator &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt; reflects any vector with respect to &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_s = 2\vert s \rangle \langle s \vert - I$&lt;/span&gt;    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Grover iteration is &lt;span class=&quot;math-container&quot;&gt;$U_{Grover} = U_s U_\omega$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{Grover}$&lt;/span&gt; rotates (at every iteration) the initial vector &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; towards the desired vector &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt; by the angle &lt;span class=&quot;math-container&quot;&gt;$2\theta$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$sin\theta =  \frac{1}{\sqrt{N}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 (&lt;strong&gt;Edit&lt;/strong&gt;. This statement was proven false by the answer to this question).  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We define the operator:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U(\vert x \rangle , \vert y \rangle  ) = ( \vert x \rangle , U_x \vert y \rangle) $&lt;/span&gt;  , where  &lt;span class=&quot;math-container&quot;&gt;$U_x \vert y \rangle$&lt;/span&gt; represents the reflection of &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt;  with respect to &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the following relations the vectors  &lt;span class=&quot;math-container&quot;&gt;$\vert \xi_i \rangle$&lt;/span&gt; are implicitly defined based on the action of the operator U.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider the following sequence of transformations (based on the definition of the operator  U):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;.......................and so on..........................&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 )$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At every step  K of the algorithm above  the initial vector &lt;span class=&quot;math-container&quot;&gt;$\vert s \rangle$&lt;/span&gt; is rotated towards the desired vector &lt;span class=&quot;math-container&quot;&gt;$\vert\omega\rangle$&lt;/span&gt; by an angle which is at about &lt;span class=&quot;math-container&quot;&gt;$2^K\theta$&lt;/span&gt; (as order of magnitude ), where &lt;span class=&quot;math-container&quot;&gt;$sin\theta =  \frac{1}{\sqrt{N}}$&lt;/span&gt;.  That means that this algorithm will only need about  &lt;span class=&quot;math-container&quot;&gt;$log_2 N$&lt;/span&gt; (as order of magnitude ) steps  to reach the target.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1.&lt;/strong&gt; Can a quantum circuit be designed, that implements this algorithm, in principle ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2.&lt;/strong&gt; Does this algorithm present an exponential speedup,  when compared to Grover's algorithm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11926/10110&quot;&gt;Related  question&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="10110" LastEditDate="2020-05-12T07:38:58.867" LastActivityDate="2020-05-12T08:04:52.537" Title="Exponential speedup of Grover's algorithm?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11883" PostTypeId="2" ParentId="11879" CreationDate="2020-05-07T08:04:37.993" Score="2" Body="&lt;p&gt;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),&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle)\otimes S|q_3\rangle+|11\rangle\otimes XSX|q_3\rangle,&#xA;$$&lt;/span&gt;&#xA;which I would even simplify to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle)\otimes S|q_3\rangle+|11\rangle\otimes iS^\dagger|q_3\rangle.&#xA;$$&lt;/span&gt;&#xA;Now we need to apply the Hadamards&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rightarrow\frac{1}{4}(|00\rangle+|01\rangle+|10\rangle+|11\rangle+&#xA;|00\rangle-|01\rangle+|10\rangle-|11\rangle+&#xA;|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.&#xA;$$&lt;/span&gt;&#xA;Let's simplify the first bracket&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\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.&#xA;$$&lt;/span&gt;&#xA;So, we can now regroup terms as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;At this point, you might get ahead of yourself and try to read off the amplitude for the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; 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,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(S-iS^\dagger)=(1-i)Z=\sqrt{2}e^{-i\pi/4}Z.&#xA;$$&lt;/span&gt;&#xA;From this, we conclude that each of the other terms appears with probability &lt;span class=&quot;math-container&quot;&gt;$|\sqrt{2}e^{-i\pi/4}/4|^2=1/8$&lt;/span&gt;, and applies &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on qubit 3. So, it is clear that the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; answer must arise with probability 5/8. We just need to check what the rotation is. Let's maipulate it a bit&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;3S+iS^\dagger=\left(\begin{array}{cc} 3+i &amp;amp; 0 \\ 0 &amp;amp; 3i+1 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;If we write &lt;span class=&quot;math-container&quot;&gt;$3+i=\sqrt{10}e^{i\phi}$&lt;/span&gt;, then this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{10}\left(\begin{array}{cc} e^{i\phi} &amp;amp; 0 \\ 0 &amp;amp; ie^{-i\phi}\end{array}\right)=\sqrt{10}e^{i\pi/4}\left(\begin{array}{cc} e^{i(\phi-\pi/4)} &amp;amp; 0 \\ 0 &amp;amp; ie^{-i(\phi-\pi/4)}\end{array}\right).&#xA;$$&lt;/span&gt;&#xA;The &lt;span class=&quot;math-container&quot;&gt;$\sqrt{10}$&lt;/span&gt; contributes to the amplitude of the overall state, so we get &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\sqrt{10}e^{i\pi/4}/4|^2$&lt;/span&gt;, as required. The unitary is of the form &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\theta/2=\pi/4-\phi$&lt;/span&gt;. Hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta=\cos\left(\frac{\pi}{2}-2\phi\right)=\sin(2\phi)=\frac{3}{5}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-07T08:04:37.993" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="11884" PostTypeId="2" ParentId="11882" CreationDate="2020-05-07T08:45:49.913" Score="2" Body="&lt;p&gt;TLDR: your operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; does not exist (so the answer to question 2 is irrelevant, and I haven't thought about it).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can show that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|\psi\rangle|r\rangle\mapsto |0\rangle(I-2|0\rangle\langle 0|)|\psi\rangle|s\rangle&#xA;$$&lt;/span&gt;&#xA;and a second one&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle|\psi\rangle|r\rangle\mapsto |\phi\rangle(I-2|\phi\rangle\langle \phi|)|\psi\rangle|s'\rangle.&#xA;$$&lt;/span&gt;&#xA;Let's consider the inner products. Before the transformation, we have &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|0\rangle$&lt;/span&gt;, which we'll assume to be non-zero. After the transformation, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\phi|0\rangle \langle\psi|(I-2|\phi\rangle\langle\phi|)(I-2|0\rangle\langle 0|)|\psi\rangle\langle s'|s\rangle.&#xA;$$&lt;/span&gt;&#xA;The two can only be equal (as required for a unitary) if &lt;span class=&quot;math-container&quot;&gt;$|s\rangle=|s'\rangle$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;It's easy to find a counter-example to this. For example, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|0\rangle$&lt;/span&gt; and and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=\cos\theta|0\rangle+\sin\theta|1\rangle$&lt;/span&gt; provided &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;\theta&amp;lt;\pi/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="8141" LastEditDate="2020-05-12T08:04:52.537" LastActivityDate="2020-05-12T08:04:52.537" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11885" PostTypeId="1" AcceptedAnswerId="11892" CreationDate="2020-05-07T10:08:28.527" Score="1" ViewCount="57" Body="&lt;p&gt;I am referring to Nielsen and Chuang Quantum Computation and Quantum Information 10th Anniversary Edition Textbook, Chapter 8.3.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A linear operator &lt;span class=&quot;math-container&quot;&gt;$E_i:H_{QR}\longrightarrow H_Q $&lt;/span&gt; is defined by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_i \bigg(\sum_j \lambda_j |q_j\rangle|j\rangle    \bigg)\equiv \lambda_i |q_i\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;whereby &lt;span class=&quot;math-container&quot;&gt;$|q_j\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; are arbitrary states of system Q and the basis of system R respectively. Define &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; to be the quantum operation with the operation elements {&lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt;}:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon(\rho)\equiv \sum_i E_i \rho E_i^{\dagger}$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The text went on to say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varepsilon(\rho\otimes|j\rangle\langle j'|)=\rho \space \delta_{j,j'}=tr_R(\rho\otimes|j\rangle\langle j'|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Question:&#xA;I do not understand how to arrive at &lt;span class=&quot;math-container&quot;&gt;$\delta_{j,j'}$&lt;/span&gt;, and what form will be the operator representation of &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; take? From what I've observed, system Q and R are not entangled in the last equation and &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; seems to disregard whatever &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; basis of system R. &#xA;Help will be much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="55" LastEditDate="2021-02-19T18:29:08.053" LastActivityDate="2021-02-19T18:29:08.053" Title="Prove that the partial trace is a quantum operation, finding its Kraus representation" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;partial-trace&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11886" PostTypeId="1" AcceptedAnswerId="11887" CreationDate="2020-05-07T11:03:58.880" Score="2" ViewCount="21" Body="&lt;p&gt;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 &quot;Tail&quot; when it is 1, and &quot;Head&quot; when it is 0. However, when I try to get raw data by &lt;code&gt;job.result(job)&lt;/code&gt;, I get the information of the result instead. By the way, here is the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;qr = QuantumRegister(1)&#xA;cr = ClassicalRegister(1)&#xA;circuit = QuantumCircuit(qr, cr)&#xA;circuit.h(qr[0])&#xA;circuit.measure(qr, cr)&#xA;job = execute(circuit, backend = simulator, shots=1024)&#xA;a = job.result(job) #the problematic code&#xA;print(a)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I use Qiskit with Python, and do not use Jupyter notebooks.&lt;/p&gt;&#xA;" OwnerUserId="11962" LastEditorUserId="9006" LastEditDate="2020-05-07T11:33:32.380" LastActivityDate="2020-05-07T11:33:32.380" Title="How can I make qiskit output raw data?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11887" PostTypeId="2" ParentId="11886" CreationDate="2020-05-07T11:30:35.603" Score="1" Body="&lt;p&gt;You need to do &lt;code&gt;.get_counts()&lt;/code&gt; to get a dictionary of the counts returned by the circuit. You would do this as follows&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(circuit, backend = simulator, shots=100)&#xA;result = job.result()&#xA;counts_dict = result.get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Using your circuit and this code, &lt;code&gt;counts_dict&lt;/code&gt; will look something like &lt;code&gt;{'0':497, '1':503}&lt;/code&gt;. From there you might want to extract the key which has a higher value to be the result of your coin flip.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-07T11:30:35.603" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11888" PostTypeId="1" AcceptedAnswerId="12418" CreationDate="2020-05-07T11:32:18.160" Score="6" ViewCount="213" Body="&lt;p&gt;A &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotation gate is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rz(\theta)=\mathrm{e}^{-i\frac{\theta}{2}Z}=&#xA;\begin{pmatrix}&#xA;\mathrm{e}^{-i\frac{\theta}{2}} &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\frac{\theta}{2}}&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;however, when one uses &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gate on IBM Q, the results are these (tested in Visualization of state vector):&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)|0\rangle = |0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)|1\rangle = \mathrm{e}^{i\theta}|1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;This means that a matrix representation of such gate is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rz^{\text{IBM}}(\theta)=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, it seems that &lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)$&lt;/span&gt; is on IBM Q implemented with &lt;span class=&quot;math-container&quot;&gt;$U1(\theta)$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since gates &lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)^\text{IBM}$&lt;/span&gt; differs only by global phase &lt;span class=&quot;math-container&quot;&gt;$\theta/2$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$Rz^\text{IBM} = \mathrm{e}^{i\frac{\theta}{2}}Rz(\theta))$&lt;/span&gt;, this difference can be neglected. However, in case of controlled version of &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotation the global phase matters. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Controlled version of &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; is described by matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CRz(\theta)=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \mathrm{e}^{-i\frac{\theta}{2}} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i\frac{\theta}{2}}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On IBM Q, controlled version of &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; behaves according to this matrix which is right.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Despite the global phase can be neglected in case of single qubit gates, one would expect that relation between a single qubit gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and its contolled version, i.e.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CU=&#xA;\begin{pmatrix}&#xA;I &amp;amp; O \\&#xA;O &amp;amp; U&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;will be preserved. In some cases the convention used by IBM for &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; can be confusing (discussed for example &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/10022/are-mathrmcrz-with-angle-pi-and-mathrmcz-equal-on-the-ibm-quantum-e/10026#10026&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I have counted with this fact but I am curious: &lt;strong&gt;Why does IBM use its own convention and does not follow definitions used in quantum physics?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;(I would appreciate if somebody from IBM Q development team could give an insight to this).&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9800" LastEditDate="2020-05-10T16:31:17.223" LastActivityDate="2020-06-21T19:41:51.137" Title="Why is a different convention used for the $Rz$ implementation on IBM Q?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11889" PostTypeId="2" ParentId="11885" CreationDate="2020-05-07T11:59:13.620" Score="-1" Body="&lt;p&gt;Say &lt;span class=&quot;math-container&quot;&gt;$\lambda_j=\delta_{j,k}$&lt;/span&gt; so that the first equation gives:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_i\left|q_k\right&amp;gt;\left|k\right&amp;gt;=\delta_{k,i}\left|q_i\right&amp;gt;&#xA;$$&lt;/span&gt;&#xA;Now, we can write &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_k p_k \left|q_k\right&amp;gt;\left&amp;lt;q_k\right|&#xA;$$&lt;/span&gt;&#xA;so that&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\varepsilon(\rho\otimes\left|j\right&amp;gt;\left&amp;lt;j'\right|)=\sum_i\sum_k p_k E_i \left|q_k\right&amp;gt;\left|j\right&amp;gt;\left&amp;lt;q_k\right|\left&amp;lt;j'\right|E_i\dagger = \sum_{i,k}p_k\delta_{j,i}\delta_{j',i}\left|q_k\right&amp;gt;\left&amp;lt;q_k\right|&#xA;$$&lt;/span&gt;&#xA;This term is non-zero only when both kronecker deltas are 1 which happens only when &lt;span class=&quot;math-container&quot;&gt;$i=j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i=j'$&lt;/span&gt;, which is only possible when &lt;span class=&quot;math-container&quot;&gt;$j=j'$&lt;/span&gt;. This gives us the required&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\varepsilon(\rho\otimes\left|j\right&amp;gt;\left&amp;lt;j'\right|)=\delta_{j,j'} \sum_k p_k \left|q_k\right&amp;gt;\left&amp;lt;q_k\right| = \rho \delta_{j,j'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10165" LastEditorUserId="2687" LastEditDate="2020-05-07T15:52:59.067" LastActivityDate="2020-05-07T15:52:59.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11890" PostTypeId="2" ParentId="11877" CreationDate="2020-05-07T12:02:47.850" Score="4" Body="&lt;p&gt;I use the ideas from &lt;a href=&quot;https://qudev.phys.ethz.ch/static/content/courses/QSIT07/presentations/Schmassmann.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these slides&lt;/a&gt;, specifically slide 8,9,10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can decompose any &lt;span class=&quot;math-container&quot;&gt;$U_{3}(\theta,\phi,\lambda)$&lt;/span&gt; into a rotation around the &lt;span class=&quot;math-container&quot;&gt;$Z,Y$&lt;/span&gt; &amp;amp; again &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis, because for any &lt;span class=&quot;math-container&quot;&gt;$U \in SU(2)$&lt;/span&gt; we can write:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U = &#xA;\begin{bmatrix}&#xA;e^{i(\alpha-\frac{\beta}{2}-\frac{\delta}{2})}\cos(\frac{\gamma}{2})&#xA;&amp;amp;&#xA;e^{i(\alpha-\frac{\beta}{2}+\frac{\delta}{2})}\sin(\frac{\gamma}{2})&#xA;\\&#xA;e^{i(\alpha+\frac{\beta}{2}-\frac{\delta}{2})}\sin(\frac{\gamma}{2})&#xA;&amp;amp;&#xA;e^{i(\alpha+\frac{\beta}{2}+\frac{\delta}{2})}\cos(\frac{\gamma}{2})&#xA;\end{bmatrix}&#xA;= e^{i\alpha}R_{z}(\beta)R_{y}(\gamma)R_{z}(\delta),&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; can be computed straightforwardly from &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, let &lt;span class=&quot;math-container&quot;&gt;$A = R_{z}(\beta)R_{y}(\gamma/2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B = R_{y}(-\gamma/2)R_{z}(-\delta/2-\beta/2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C = R_{z}(\delta/2 - \beta/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A straightforward calculation shows that:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;ABC &amp;amp;= R_{z}(\beta)R_{y}(\gamma/2)R_{y}(-\gamma/2)R_{z}(-\delta/2-\beta/2)R_{z}(\delta/2 - \beta/2) = I\\&#xA;AXBXC &amp;amp;= R_{z}(\beta)R_{y}(\gamma/2)XR_{y}(-\gamma/2)R_{z}(-\delta/2-\beta/2)XR_{z}(\delta/2 - \beta/2) \\&#xA;&amp;amp;= R_{z}(\beta)R_{y}(\gamma/2)R_{y}(\gamma/2)XXR_{z}(\delta/2+\beta/2)R_{z}(\delta/2 - \beta/2) \\&#xA;&amp;amp;= R_{z}(\beta)R_{y}(\gamma)R_{z}(\delta) = e^{-i\alpha}U.&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can use this fact to implement &lt;span class=&quot;math-container&quot;&gt;$CU$&lt;/span&gt; by using two &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; gates that we apply between the &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&amp;amp;&lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;&amp;amp;&lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; gates:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;&amp;amp;(I\otimes A)CX(I\otimes B)CX(I\otimes C) \\&#xA;= &amp;amp;\big(|0\rangle\langle0|\otimes ABC\big) + \big(|1\rangle\langle1|\otimes AXBXC\big) \\&#xA;= &amp;amp;\big(|0\rangle\langle0|\otimes I\big) + \big(|1\rangle\langle1|\otimes e^{-i\alpha}U\big) \\&#xA;= &amp;amp; CU \big(R_{z}(\alpha)\otimes I\big)&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where the last phase gate on the control qubit is needed because we have the phase &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; in our equality &lt;span class=&quot;math-container&quot;&gt;$U = e^{i\alpha}AXBXC$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This allows us to implement any controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-05-08T10:26:20.650" LastActivityDate="2020-05-08T10:26:20.650" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11891" PostTypeId="2" ParentId="11826" CreationDate="2020-05-07T12:28:17.200" Score="4" Body="&lt;p&gt;To add on the answer of Martin Vesely:&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;discrete logarithm&lt;/em&gt;). Quantum computers are, among other things, good in period finding through the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum Fourier transform&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_logarithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;'discrete logarithm'&lt;/a&gt; cryptography standards. The discrete logarithm is the source of the hardness of these standards.&lt;/p&gt;&#xA;&lt;p&gt;For post-quantum cryptography, there are essentially two ways to go:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Post-quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Post-quantum (classical) cryptography&lt;/a&gt;, with a promising candidate forms of &lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice-based_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;lattice based cryptography&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$BQP$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;-equivalent of quantum computers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum cryptography&lt;/a&gt;, where you use the powers of quantum computers (or rather quantum &lt;em&gt;networks&lt;/em&gt;) to attain what some people call &lt;em&gt;inherently&lt;/em&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;nofollow noreferrer&quot;&gt;one-time pad&lt;/a&gt; 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).&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Note that all of the above is on &lt;em&gt;public&lt;/em&gt; or &lt;em&gt;asymmetrical&lt;/em&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's search algorithm&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt; This is the theoretical slimmed down version. Of course, in practice, there are many caveats and exclusions. For some more discussion see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7/how-is-quantum-cryptography-different-from-cryptography-used-nowadays?rq=1&quot;&gt;this previous question and answer&lt;/a&gt; and &lt;a href=&quot;https://crypto.stackexchange.com/questions/51311/what-makes-quantum-cryptography-secure&quot;&gt;this answer it references&lt;/a&gt; on the cryptography stack exchange.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="10480" LastEditDate="2021-01-21T17:58:57.900" LastActivityDate="2021-01-21T17:58:57.900" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11892" PostTypeId="2" ParentId="11885" CreationDate="2020-05-07T12:30:28.763" Score="2" Body="&lt;p&gt;I think the presentation in N&amp;amp;C is a little confusing because &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is used in two contexts. I'll substitute one of those for a &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_i=I\otimes\langle j|,&#xA;$$&lt;/span&gt;&#xA;which will certainly achieve the effect stated in your first equation. This lets us define the quantum operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\sigma)=\sum_iE_i\sigma E_i^\dagger&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is a density matrix on &lt;span class=&quot;math-container&quot;&gt;$QR$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a density matrix on &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho\otimes|j\rangle\langle j'|)=\sum_iE_i(\rho\otimes|j\rangle\langle j'|)E_i^\dagger.&#xA;$$&lt;/span&gt;&#xA;Now, &lt;span class=&quot;math-container&quot;&gt;$E_i\rho\otimes |j\rangle=\delta_{i,j}\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho\otimes\langle j'|E_i^\dagger=\delta_{i,j'}\rho$&lt;/span&gt;. Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho\otimes|j\rangle\langle j'|)=\sum_i\rho\delta_{i,j}\delta_{i,j'}=\delta_{j,j'}\rho.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-07T12:30:28.763" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11893" PostTypeId="1" CreationDate="2020-05-07T13:03:00.440" Score="1" ViewCount="39" Body="&lt;p&gt;This question is from Nielson and Chuang's &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dUj7v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dUj7v.png&quot; alt=&quot;question_image&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{N-M}}\sum_{x} &quot;|x\rangle $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sum_{x}&quot; |x\rangle$&lt;/span&gt; is the sum of states which are not the solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle $&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{M}}\sum_{x} ' |x\rangle $$&lt;/span&gt;&#xA;where it represents all &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is defined by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\cos\Big(\frac{\theta}{2}\Big) = \sqrt{\frac {N-M}{N}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; must be a unitary Matrix made up of trigonometric functions. How can I approach this problem? &lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="55" LastEditDate="2020-10-12T21:25:00.190" LastActivityDate="2020-10-12T21:25:00.190" Title="Writing Grover's Iterator in different computational phase" Tags="&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2020-05-11T22:58:36.217" ContentLicense="CC BY-SA 4.0" />
  <row Id="11894" PostTypeId="1" AcceptedAnswerId="11914" CreationDate="2020-05-07T14:33:13.713" Score="3" ViewCount="99" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or have we reached the &quot;pinnacle computing technology&quot; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11849" LastEditorUserId="11849" LastEditDate="2020-05-08T07:12:44.483" LastActivityDate="2020-05-08T12:27:05.587" Title="Is quantum computing the most advanced computing technology we will ever have?" Tags="&lt;architecture&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="0" ClosedDate="2020-05-11T22:28:14.693" ContentLicense="CC BY-SA 4.0" />
  <row Id="11895" PostTypeId="1" AcceptedAnswerId="11955" CreationDate="2020-05-07T15:45:53.687" Score="8" ViewCount="443" Body="&lt;p&gt;In supremacy experiment Google has used &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Y}$&lt;/span&gt; as two of their single qubit gates   (&lt;a href=&quot;https://idp.nature.com/authorize?response_type=cookie&amp;amp;client_id=grover&amp;amp;redirect_uri=https%3A%2F%2Fwww.nature.com%2Farticles%2Fs41586-019-1666-5&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there any specific reason for choosing these gates and not &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; instead? &lt;/li&gt;&#xA;&lt;li&gt;Is it because of technical issues like the natural choice for transmon qubits are these gates? &lt;/li&gt;&#xA;&lt;li&gt;Or is it about complexity of the algorithm that is needed to simulate these gates?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10456" LastEditorUserId="2293" LastEditDate="2020-05-11T01:32:32.617" LastActivityDate="2020-05-11T02:45:15.880" Title="Why Google has used $\sqrt{X}$ and $\sqrt{Y}$ instead of $X$ and $Y$ in supremacy experiment?" Tags="&lt;quantum-gate&gt;&lt;quantum-advantage&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11896" PostTypeId="2" ParentId="11893" CreationDate="2020-05-07T16:03:05.407" Score="1" Body="&lt;p&gt;You can rewrite &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \cos(\theta/2)|\alpha\rangle + \sin(\theta/2)|\beta\rangle&#xA;$$&lt;/span&gt; &#xA;Also, G rotates the state vector by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; towards &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G|\psi\rangle = \cos(3\theta/2)|\alpha\rangle + \sin(3\theta/2)|\beta\rangle&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;    x_{11}       &amp;amp; x_{12}\\&#xA;    x_{21}       &amp;amp; x_{22}\\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;    \cos(\theta/2)\\&#xA;    \sin(\theta/2)\\&#xA;\end{bmatrix} = &#xA;\begin{bmatrix}&#xA;    \cos(3\theta/2)\\&#xA;    \sin(3\theta/2)\\&#xA;\end{bmatrix} = &#xA;\begin{bmatrix}&#xA;    \cos(\theta)\cos(\theta/2)-\sin(\theta)\sin(\theta/2)\\&#xA;    \sin(\theta)\cos(\theta/2)+\cos(\theta)\sin(\theta/2)\\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;By comparison, you can find the value of &lt;span class=&quot;math-container&quot;&gt;$x_{11},x_{12},x_{21}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_{22}$&lt;/span&gt;, and hence, G which comes out to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;    \cos(\theta) &amp;amp;&amp;amp; -\sin(\theta)\\&#xA;    \sin(\theta) &amp;amp;&amp;amp; \cos(\theta)\\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11932" LastActivityDate="2020-05-07T16:03:05.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11899" PostTypeId="1" AcceptedAnswerId="11924" CreationDate="2020-05-07T18:54:14.363" Score="5" ViewCount="771" Body="&lt;p&gt;I need to see an example of how Hamiltonian, i.e. any Hermitian matrix, can be decomposed into a linear combination of Pauli matrices.&lt;/p&gt;&#xA;&lt;p&gt;I would prefer an option to do this in larger than 2 dimensions, if that is possible.&lt;/p&gt;&#xA;" OwnerUserId="11968" LastEditorUserId="2293" LastEditDate="2021-04-16T21:14:24.130" LastActivityDate="2021-04-16T21:14:24.130" Title="What is an example of how a Hamiltonian can be decomposed in terms of Pauli matrices?" Tags="&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11900" PostTypeId="1" CreationDate="2020-05-07T20:07:01.990" Score="2" ViewCount="131" Body="&lt;p&gt;I am new to this field and I have been baffled by the idea of Oracle for a long time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of the procedure, but I am very confused about how we choose the oracle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; (see &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html#2.-Example:-2-Qubits-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt;), and evolve the state and everything, I will finally end up with the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, which means spade of the Ace. Am I missing a step somewhere?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7379" LastActivityDate="2020-05-08T09:33:20.230" Title="How does the Grover's Algorithm work with a real example?" Tags="&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ClosedDate="2020-05-25T12:34:43.757" ContentLicense="CC BY-SA 4.0" />
  <row Id="11902" PostTypeId="1" CreationDate="2020-05-07T20:41:42.923" Score="2" ViewCount="31" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastActivityDate="2020-05-07T21:52:25.187" Title="Do we already know some problems, that would be hard to solve for quantum computers, and use them in cryptography?" Tags="&lt;complexity-theory&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-05-08T13:56:36.317" ContentLicense="CC BY-SA 4.0" />
  <row Id="11903" PostTypeId="2" ParentId="11902" CreationDate="2020-05-07T21:52:25.187" Score="1" Body="&lt;p&gt;As far as I know a cipher with random key cannot be broken, however, in &lt;em&gt;classical realm&lt;/em&gt; it is problematic to distribute the key without being eavesdropped. Probably physical exchange of the key would be necessary which impractical for digital communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But at the same time, quantum computers are used to implement the cipher. A &lt;em&gt;quantum realm&lt;/em&gt; allows to create and distribute the random key and the same time being able to realize whether you were eavesdropped or not. See &lt;a href=&quot;http://eavesdropped&quot; rel=&quot;nofollow noreferrer&quot;&gt;BB84 protocol&lt;/a&gt; for more information how this is done.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-07T21:52:25.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11905" PostTypeId="1" AcceptedAnswerId="11907" CreationDate="2020-05-07T22:58:11.683" Score="1" ViewCount="182" Body="&lt;p&gt;The toffioli gate flips the target bit when both of the control bits are &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it be possible to instead have a gate which flips a target bit when both control bits are 'equal'?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Possible meanings of equal:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Control bits are identical: &lt;span class=&quot;math-container&quot;&gt;$\vert c1 \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle = \vert c2 \rangle$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Control bits have the same sign/phase: doesn't flip if &lt;span class=&quot;math-container&quot;&gt;$\vert c1 \rangle = -\vert c2 \rangle$&lt;/span&gt;. Flips otherwise.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Many thanks&lt;/p&gt;&#xA;" OwnerUserId="11970" LastEditorUserId="55" LastEditDate="2020-05-08T12:32:53.500" LastActivityDate="2020-05-08T15:45:03.520" Title="Can you make a Toffoli-like gate which flips if control bits are equal?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11906" PostTypeId="2" ParentId="11905" CreationDate="2020-05-08T01:50:27.320" Score="2" Body="&lt;p&gt;I propose a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-input &quot;Agnew&quot; gate acting on &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^3$&lt;/span&gt; and producing &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; outputs as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;1 2 T || 1 2 T&#xA;==============&#xA;0 0 0 || 0 0 1&#xA;0 0 1 || 0 0 0&#xA;0 1 0 || 0 1 0&#xA;0 1 1 || 0 1 1&#xA;1 0 0 || 1 0 0&#xA;1 0 1 || 1 0 1&#xA;1 1 0 || 1 1 1&#xA;1 1 1 || 1 1 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here, 1 and 2 are the two control (qu)bits, while T is the target (qu)bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be written in matrix form as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathsf{AGNEW}=&#xA;\left(&#xA;\begin{array}{cccc}&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This of course can be written in many other ways.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is a permutation matrix, and is unitary. Thus, it is reversible and can be achieved with a quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-05-08T01:50:27.320" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11907" PostTypeId="2" ParentId="11905" CreationDate="2020-05-08T02:37:49.593" Score="3" Body="&lt;p&gt;You can decompose that operation into CNOTs and NOTs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z0yOE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z0yOE.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-05-08T02:37:49.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11908" PostTypeId="1" CreationDate="2020-05-08T03:35:19.447" Score="6" ViewCount="153" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://scirate.com/arxiv/2003.12770&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://scirate.com/arxiv/2003.12770&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.swissquantumhub.com/quantum-supremacy-quantum-hybrid-hhl-algorithm-for-solving-a-system-of-linear-equation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.swissquantumhub.com/quantum-supremacy-quantum-hybrid-hhl-algorithm-for-solving-a-system-of-linear-equation/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1909.05820&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1909.05820&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_vqls.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pennylane.ai/qml/demos/tutorial_vqls.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can we compare both algorithms?&lt;/p&gt;&#xA;&lt;p&gt;In the part of the near-term application of H-HHL paper, they talk about Bayesian deep learning application: &amp;quot;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&amp;quot;&#xA;[&lt;a href=&quot;https://arxiv.org/pdf/1806.11463.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;21&lt;/a&gt;].&lt;/p&gt;&#xA;&lt;p&gt;Which algorithm should be better in the next-gen state-of-art 53-Qubits quantum computer for the Quantum Bayesian deep learning algorithm?&lt;/p&gt;&#xA;" OwnerUserId="9226" LastEditorUserId="2293" LastEditDate="2021-01-24T03:10:50.367" LastActivityDate="2021-01-24T03:23:21.833" Title="New Hybrid-HHL algorithm vs VQLS" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11909" PostTypeId="2" ParentId="11905" CreationDate="2020-05-08T09:31:25.563" Score="0" Body="&lt;blockquote&gt;&#xA;  &lt;ol start=&quot;2&quot;&gt;&#xA;  &lt;li&gt;Control bits have the same sign/phase: doesn't flip if &lt;span class=&quot;math-container&quot;&gt;$\vert c1\rangle=−\vert c2\rangle$&lt;/span&gt;. Flips otherwise.&lt;/li&gt;&#xA;  &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is difficult.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the state is &lt;span class=&quot;math-container&quot;&gt;$-\vert 000\rangle$&lt;/span&gt;, there's no way to decide&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert c1\rangle, \vert c2\rangle, \vert t\rangle = \vert 0\rangle, \vert 0\rangle, -\vert 0\rangle$&lt;/span&gt; or&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert c1\rangle, \vert c2\rangle, \vert t\rangle = \vert 0\rangle, -\vert 0\rangle, \vert 0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9563" LastEditorUserId="2927" LastEditDate="2020-05-08T15:45:03.520" LastActivityDate="2020-05-08T15:45:03.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11910" PostTypeId="2" ParentId="11900" CreationDate="2020-05-08T09:33:20.230" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;looking at&quot; &lt;span class=&quot;math-container&quot;&gt;$\approx\frac{\pi}{2}\sqrt{52}\approx 11$&lt;/span&gt; cards (although you would need some way to look at cards in a coherent superposition).&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-05-08T09:33:20.230" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11911" PostTypeId="1" AcceptedAnswerId="11912" CreationDate="2020-05-08T09:55:48.420" Score="1" ViewCount="28" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; then it also corrects any linear combination of errors (in particular by Gottesman); the sources can be found here:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Gottesman: &lt;a href=&quot;https://arxiv.org/abs/0904.2557&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0904.2557&lt;/a&gt;&#xA;Nielsen, Chuang: &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11977" LastActivityDate="2020-05-08T10:22:59.393" Title="Can a quantum error-correcting code really correct any linear combination of correctable errors?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11912" PostTypeId="2" ParentId="11911" CreationDate="2020-05-08T10:16:09.763" Score="0" Body="&lt;p&gt;Let's make it even simpler by using the &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-qubit bit-flip code. That code corrects the errors &lt;span class=&quot;math-container&quot;&gt;$E_{1} = XII$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$E_{2} = IXI$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{3} = IIX$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The 'theorem' states that this code can then also correct any error which is a linear combination &lt;span class=&quot;math-container&quot;&gt;$E_{l}$&lt;/span&gt; of these errors:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_{l} = \alpha I + \beta E_{1} + \gamma E_{2} + \delta E_{3}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note, however, that the error you describe (a bit flip on the first &lt;em&gt;and&lt;/em&gt; the second qubit, let's call it &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;) is described by the operator &lt;span class=&quot;math-container&quot;&gt;$K = XXI$&lt;/span&gt;, which is &lt;strong&gt;not&lt;/strong&gt; a linear combination of &lt;span class=&quot;math-container&quot;&gt;$E_{1}, E_{2} \&amp;amp; E_{3}$&lt;/span&gt;. In other words:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;XXI \not = XII + IXI.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you view the collection of all operators/errors as a space, then &lt;span class=&quot;math-container&quot;&gt;$E_{1} = XII$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$E_{2} = IXI$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{3} = IIX$&lt;/span&gt; form a basis for a &lt;em&gt;subspace&lt;/em&gt; 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 &lt;em&gt;a&lt;/em&gt; basis, and the rest of the space comes for free. Any operator outside that space will be non-correctable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is what we call a &lt;em&gt;correlated&lt;/em&gt; error: the flips on the first and second qubits are &lt;em&gt;correlated&lt;/em&gt;. 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).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-05-08T10:22:59.393" LastActivityDate="2020-05-08T10:22:59.393" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11913" PostTypeId="1" AcceptedAnswerId="11972" CreationDate="2020-05-08T10:27:13.817" Score="2" ViewCount="91" Body="&lt;p&gt;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: &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.primitive.exp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.primitive.exp&lt;/a&gt; or using a PauliEvolutionSet when trying to do Hamiltonian simulation: &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.simulation.paulievolutionset&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.simulation.paulievolutionset&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help!&lt;/p&gt;&#xA;" OwnerUserId="11979" LastEditorUserId="55" LastEditDate="2020-05-10T07:50:14.250" LastActivityDate="2020-05-11T18:12:33.010" Title="Generic matrix exponential in Q#" Tags="&lt;programming&gt;&lt;q#&gt;&lt;hamiltonian-simulation&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11914" PostTypeId="2" ParentId="11894" CreationDate="2020-05-08T12:27:05.587" Score="3" Body="&lt;p&gt;The question is fine, but I think still a bit difficult to answer in a non-subjective way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;better&quot; 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 &lt;em&gt;physical Church-Turing thesis&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;are&lt;/em&gt; phenomena which are not well-described by our current physical theories -- cue merging of QM and general relativity etc. -- so there &lt;em&gt;could&lt;/em&gt; be room for something more happening there, but we simply don't know for certain yet). &lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-08T12:27:05.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11915" PostTypeId="1" AcceptedAnswerId="11935" CreationDate="2020-05-08T13:49:35.907" Score="3" ViewCount="143" Body="&lt;p&gt;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?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are these operations mathematically equivalent if you use Toffoli Gates or Fredkin gates, or is one gate easier for optimizers to work with?&lt;/p&gt;&#xA;" OwnerUserId="9482" LastEditorUserId="9482" LastEditDate="2020-05-09T12:11:39.627" LastActivityDate="2020-05-10T03:38:37.457" Title="Are Toffoli gates actually used in designing quantum circuits?" Tags="&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11916" PostTypeId="1" CreationDate="2020-05-08T15:04:48.437" Score="6" ViewCount="306" Body="&lt;p&gt;Based on my current understanding, a qubit is represented as a vector &lt;span class=&quot;math-container&quot;&gt;$(a, b)$&lt;/span&gt; which satisfy  &lt;span class=&quot;math-container&quot;&gt;$a^2 + b^2 = 1$&lt;/span&gt;. Classical bit one can be represented as &lt;span class=&quot;math-container&quot;&gt;$(0, 1)$&lt;/span&gt; and bit zero can be represented as &lt;span class=&quot;math-container&quot;&gt;$(1, 0)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then we can have things that cannot be described isomorphically in classical computing such as &lt;span class=&quot;math-container&quot;&gt;$(\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}})$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, I came to a realization where this is quite similar to trigonometry identity where &lt;span class=&quot;math-container&quot;&gt;$\sin^2(t) + \cos^2(t) = 1$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, I'm wondering if a qubit is a point &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; that lies anywhere on the circumference of a unit circle, can a qubit &lt;span class=&quot;math-container&quot;&gt;$(a, b)$&lt;/span&gt; be described as &lt;span class=&quot;math-container&quot;&gt;$(\sin(t), \cos(t))$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is the angle measured from positive &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis to the line formed between &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and center of the circle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this analogy faulty?&lt;/p&gt;&#xA;" OwnerUserId="11980" LastEditorUserId="55" LastEditDate="2020-10-12T21:24:43.253" LastActivityDate="2020-10-12T21:24:43.253" Title="Is it right to think of superposition as just angle?" Tags="&lt;mathematics&gt;&lt;classical-computing&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11917" PostTypeId="2" ParentId="11916" CreationDate="2020-05-08T15:43:16.770" Score="4" Body="&lt;p&gt;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 &lt;a href=&quot;https://rebootingcomputing.ieee.org/archived-articles-and-videos/feature-articles/probabilistic-bits-p-bits&quot; rel=&quot;nofollow noreferrer&quot;&gt;this talk&lt;/a&gt; (which I have not seen myself).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your analogy fails because a general qubit's state cannot be written using one, but rather two free  (real) parameters/angles:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle = \cos(\frac{\theta}{2}) |0\rangle + e^{i\phi}\sin (\frac{\theta}{2})|1\rangle,&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is divided by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; for reasons I briefly mention below.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is like the angle that you have described, which describes the relative 'population' of the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is commonly referred to as the &lt;em&gt;phase&lt;/em&gt; (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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state are the north- and south pole (on the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-axis) of the sphere, respectively, and altering &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; rotates the state from the north- to the south pole. (Since this is actually just a rotation of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, we divide &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The phase &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is then the angle the state vector makes with the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-axis (in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; plane).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-05-08T20:09:19.897" LastActivityDate="2020-05-08T20:09:19.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11918" PostTypeId="2" ParentId="11915" CreationDate="2020-05-08T15:55:25.163" Score="3" Body="&lt;p&gt;It depends on what you mean by an &quot;actual quantum computer&quot;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think part of the reason for this is that a Toffoli gate almost acts as a stand-in replacement for an &quot;AND&quot; gate. If you use &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;more&lt;/em&gt; qubits than a regular Toffoli, to try to make the circuit faster or use fewer T gates. &lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-05-08T15:55:25.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11919" PostTypeId="2" ParentId="11916" CreationDate="2020-05-08T16:10:55.700" Score="5" Body="&lt;p&gt;That's not &lt;em&gt;too&lt;/em&gt; far from the truth.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can always describe the probabilities of a two-outcome event like that: you have &lt;span class=&quot;math-container&quot;&gt;$p_1+p_2=1$&lt;/span&gt; and thus defining &lt;span class=&quot;math-container&quot;&gt;$c_i\equiv\sqrt{p_i}$&lt;/span&gt; you observe that &lt;span class=&quot;math-container&quot;&gt;$(c_1,c_2)$&lt;/span&gt; are distributed on a circle (more precisely, in the upper-right sector of one).&#xA;More generally, if an event has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; possible outcomes, you can describe the corresponding probabilities as the squares of the components of points on (one sector of) a hypersphere: &lt;span class=&quot;math-container&quot;&gt;$p_i\equiv c_i^2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$(c_i)_{i=1}^n\equiv\boldsymbol c\in S^{n-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$c_i$&lt;/span&gt; (let's call these &lt;em&gt;amplitudes&lt;/em&gt;) is simpler. However, it also turns out that using values &lt;span class=&quot;math-container&quot;&gt;$c_i\in[0,1]$&lt;/span&gt;, 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 &quot;promoting&quot; these coefficients to be &lt;em&gt;complex numbers&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$c_i\in\mathbb C$&lt;/span&gt;. &#xA;In the case of a qubit, this amounts to the state being describable as a point on &lt;em&gt;a sphere&lt;/em&gt;, rather than on a circle (the complex phases add an additional &quot;phase angle&quot; on top of the &quot;angle&quot; corresponding to the measurement probabilities).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;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 your circle and the possible outcome probabilities. This is to be expected, as if you do not work with different measurement bases, everything can be described with classical probability theory.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-08T16:10:55.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11920" PostTypeId="1" CreationDate="2020-05-08T16:35:35.330" Score="1" ViewCount="84" Body="&lt;p&gt;I'm using SPSA as an optimizer in VQE algorithm.&lt;br&gt;&#xA;The code runs on &lt;code&gt;ibmq-qasm-simulator&lt;/code&gt;.&lt;br&gt;&#xA;I've set SPSA &lt;em&gt;max_trials&lt;/em&gt; parameter to 500, but, when I run the code, it makes 1000 iterations.&lt;br&gt;&#xA;I've tried with COBYLA optimizer too, and it makes correctly 500 iterations.&lt;br&gt;&#xA;Does someone know why?&lt;br&gt;&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11981" LastEditorUserId="55" LastEditDate="2020-05-10T07:49:14.270" LastActivityDate="2020-05-10T07:49:14.270" Title="SPSA max_trials" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;optimization&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11921" PostTypeId="1" AcceptedAnswerId="11965" CreationDate="2020-05-08T17:49:28.357" Score="2" ViewCount="171" Body="&lt;p&gt;In exercise 6.7 page 258 in Nielsen and Chuang book, they have a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = \left| x \right\rangle \!\!\left\langle x \right| + \left| \psi \right\rangle \!\!\left\langle \psi \right|$&lt;/span&gt; and the purpose is implementing &lt;span class=&quot;math-container&quot;&gt;$\exp(-iHt)\left| \psi \right\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\left| \psi \right\rangle = \frac{\sum_{x}\left| x \right\rangle}{\sqrt N}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regarding the first part of the Hamiltonian, I couldn't understand how I can figure out the circuit implementation (the gates) for the operator &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \left| x \right\rangle \!\!\left\langle x \right| \Delta t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the book, they implement it as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sBKKP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sBKKP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Could you please explain to me that circuit, and how they come out with it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And what the oracle contains? an example with 4-qubits (&lt;span class=&quot;math-container&quot;&gt;$exp(-i \left| 0101 \right\rangle \left\langle 0101 \right| \Delta t)$&lt;/span&gt;) or else, would be too helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And thank you.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="23" LastEditDate="2020-07-26T18:06:56.507" LastActivityDate="2020-07-26T18:06:56.507" Title="How to implement the exponential of an outer product?" Tags="&lt;quantum-gate&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11922" PostTypeId="2" ParentId="11920" CreationDate="2020-05-08T18:34:50.003" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-05-08T18:34:50.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11923" PostTypeId="2" ParentId="11921" CreationDate="2020-05-08T20:33:15.820" Score="2" Body="&lt;p&gt;When exponentiating a diagonal matrix, you get a new diagonal matrix where the diagonals are exponentiated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the matrix: &lt;span class=&quot;math-container&quot;&gt;$-i|x\rangle\langle x|\Delta t$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\textrm{diag}(0,i\Delta t)$&lt;/span&gt;,  the matrix exponential is  &lt;span class=&quot;math-container&quot;&gt;$\textrm{diag}(e^0,e^{i\Delta t})$&lt;/span&gt; as shown in the 2x2 gate in the figure you showed. You do not need &quot;oracles&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For your 4-qubit example, write down the diagonal matrix and then exponentiate the diagonals. You will get 15 elements being &lt;span class=&quot;math-container&quot;&gt;$e^0=1$&lt;/span&gt;, and you will get &lt;span class=&quot;math-container&quot;&gt;$e^{-i\Delta t}$&lt;/span&gt; for the other element, depending on how you define &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt; (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).  &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-05-08T20:33:15.820" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="11924" PostTypeId="2" ParentId="11899" CreationDate="2020-05-08T21:10:05.593" Score="8" Body="&lt;p&gt;I call this the &amp;quot;Paulinomial decomposition&amp;quot; as you are writing the matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as a polynomial of Pauli matrices:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt; (for the 2-qubit case).&lt;/p&gt;&#xA;&lt;p&gt;To get the coefficients, you can use this formula:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a_{AB}=\frac{1}{4}\textrm{tr}\left((A_1\otimes B_2)H\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, here is a 2-qubit gate (the square root of the SWAP gate) written as a polynomial of Pauli matrices:&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/BPo02.png&quot; width=&quot;500&quot;&gt;&#xA;&lt;p&gt;You can even do this for a &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; Hamiltonian, for example an 8x8 Hamiltonian can be done like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a_{ABC}=\frac{1}{8}\textrm{tr}((A_1\otimes B_2\otimes C_3))H)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have a code that can also do it for arbitrary matrices (not only &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-04-01T03:47:36.433" LastActivityDate="2021-04-01T03:47:36.433" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="11925" PostTypeId="2" ParentId="4978" CreationDate="2020-05-09T00:01:59.713" Score="2" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho) = (1-p)\rho + p \frac{I}{d}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the Hilbert space dimension. Since &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho) = 1$&lt;/span&gt; for any density operator, we can write &lt;span class=&quot;math-container&quot;&gt;$\frac{I}{d} = \frac{I}{d}\mathrm{tr}(\rho)$&lt;/span&gt;. For any orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|1\rangle, \dots, |d\rangle\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I = \sum_i |i\rangle \langle i|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho) = \sum_i \langle i|\rho |i\rangle$&lt;/span&gt;, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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|,$$&lt;/span&gt;&#xA;from which we see that a possible set of Kraus operators for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle \langle j|/\sqrt{d}\}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$i,j \in \{1,\dots, d\}$&lt;/span&gt;. (You can check that these satisfy the completeness relation.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the two-qubit case, note that &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}$&lt;/span&gt; are related to &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle\langle 0|/\sqrt{2}, |0\rangle\langle 1|/\sqrt{2}, |1\rangle\langle 0|/\sqrt{2},|1\rangle\langle 1|/\sqrt{2}\}$&lt;/span&gt; by a unitary, so by using the unitary freedom in the Kraus representation, we can get from the above representation to the standard &lt;span class=&quot;math-container&quot;&gt;$\frac{I}{2} = \rho + X\rho X + Y\rho Y + Z\rho Z$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="11984" LastActivityDate="2020-05-09T00:01:59.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11926" PostTypeId="1" AcceptedAnswerId="11927" CreationDate="2020-05-09T09:32:36.267" Score="1" ViewCount="57" Body="&lt;p&gt;Statement of the problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to consider/design  a quantum circuit that takes as &lt;strong&gt;input&lt;/strong&gt; two vectors &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt;. The &lt;strong&gt;output&lt;/strong&gt; of this quantum circuit must contain the reflected vector of   &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt;  with respect to  &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;  (and whatever else that is irrelevant to the purpose ) . I can't find a solution to this problem.  I am not sure if &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9703032&quot; rel=&quot;nofollow noreferrer&quot;&gt;this reference&lt;/a&gt; might give a clue towards a solution (programmable quantum gate arrays?). We work in a Hilbert space of fixed (but large) dimension.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;.  Does such a quantum circuit exist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11882&quot;&gt; this question &lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="55" LastEditDate="2020-05-09T16:53:26.707" LastActivityDate="2020-05-09T19:12:48.233" Title="Can a circuit map $|x,y\rangle$ to the reflection of $|y\rangle$ with respect to $|x\rangle$?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11927" PostTypeId="2" ParentId="11926" CreationDate="2020-05-09T13:22:09.243" Score="3" Body="&lt;p&gt;Such an operation would not be linear in the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the simplest example with &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; two qubits.&#xA;We want an operation implementing the following transformation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle\otimes |y\rangle\to |\psi_{x,y}\rangle\otimes(-|y\rangle + 2|x\rangle\langle x|y\rangle),\tag1$$&lt;/span&gt;&#xA;for some output qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi_{x,y}\rangle$&lt;/span&gt;.&#xA;Consider how this would work on the computational basis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;  |0,0\rangle&amp;amp;\to \phantom{-}|\psi_{00},0\rangle, \\&#xA;  |0,1\rangle&amp;amp;\to -|\psi_{01},1\rangle, \\&#xA;  |1,0\rangle&amp;amp;\to -|\psi_{10},0\rangle, \\&#xA;  |1,1\rangle&amp;amp;\to \phantom{-}|\psi_{11},1\rangle.&#xA;\end{align}$$&lt;/span&gt;&#xA;Now consider the action of this map on &lt;span class=&quot;math-container&quot;&gt;$|+,0\rangle$&lt;/span&gt;.&#xA;Eq. (1) would tell us that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|+,0\rangle\to -|0\rangle+2\frac{1}{\sqrt2}|+\rangle = |1\rangle.$$&lt;/span&gt;&#xA;At the same time, linearity would imply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|+,0\rangle\to (|\psi_{00}\rangle-|\psi_{10}\rangle)\otimes|0\rangle,$$&lt;/span&gt;&#xA;which is clearly not how the reflection operation should behave.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;At the same time, for every &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, the action on &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is linear (and if this wasn't the case, that would be a rather big problem for anything Grover-related).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; needs to be part of the specification of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, which is how it usually appears when discussing Grover (the projections are essentially unitaries parametrised by an &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;).&#xA;Now, this might appear contradictory: after all, if I &quot;enlarge enough the black box&quot;, at some point I must be able to describe the choice of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as input to some operation.&#xA;If I were to guess, the solution to this conundrum is that this reflection operation &lt;em&gt;is&lt;/em&gt; possible, as long as you don't require it to work on &lt;em&gt;all&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. &#xA;In other words, it's fine to have this operation, provided you restrict the possible choices of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to an orthogonal set of vectors (e.g. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in this case). Note how this is exactly the same situation you have for the &quot;cloning operation&quot;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-05-09T19:12:48.233" LastActivityDate="2020-05-09T19:12:48.233" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="11928" PostTypeId="1" AcceptedAnswerId="11929" CreationDate="2020-05-09T14:49:48.507" Score="1" ViewCount="127" Body="&lt;p&gt;As I understood, the X gate flips the state around : &lt;span class=&quot;math-container&quot;&gt;$X(|0\rangle) = |1\rangle$&lt;/span&gt;. It can also be visualized with a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; rotation around the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis in the Bloch sphere. I have no problem with that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is with the minus state. The Bloch sphere visualization of the Hadamard gate is a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; rotation around the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis and a &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; rotation around the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; axis. This makes it that when we use the H gate on the basis state we obtain &lt;span class=&quot;math-container&quot;&gt;$H(|0\rangle) = \frac {|0\rangle+|1\rangle} {\sqrt 2} = |+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H(|1\rangle) = \frac {|0\rangle-|1\rangle} {\sqrt 2} = |-\rangle$&lt;/span&gt;. I understand that without any problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These two states are on the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis, this means that applying an X gate and therefor create a rotation shouldn't change anything. This is the case with the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state since &lt;span class=&quot;math-container&quot;&gt;$X(|+\rangle) = |+\rangle$&lt;/span&gt;. However. I simply do not understand how the case of the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state can be explained &lt;span class=&quot;math-container&quot;&gt;$X(|-\rangle) = -|-\rangle$&lt;/span&gt; using the Bloch sphere since a rotation of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; around the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; axis shouldn't change anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for reading, and I hope you can explain&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS : I do understand the other demonstration &lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-05-09T15:04:10.257" Title="Effect of Pauli X gate on minus state using bloch sphere" Tags="&lt;mathematics&gt;&lt;bloch-sphere&gt;&lt;pauli-gates&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11929" PostTypeId="2" ParentId="11928" CreationDate="2020-05-09T15:04:10.257" Score="1" Body="&lt;p&gt;You are correct on the part that rotation about the X axis should not cause any change in the Bloch Sphere representation. In fact, &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-\left|-\right&amp;gt;$&lt;/span&gt; do have the same Bloch sphere representation. Since &lt;span class=&quot;math-container&quot;&gt;$-\left|-\right&amp;gt;=e^{i\pi}\left|-\right&amp;gt;$&lt;/span&gt;, 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.&lt;br&gt;&#xA;Section 1.2 of Nielson-Chuang (mainly page 15 in the 10th anniversary edition) can be a good reference! &lt;/p&gt;&#xA;" OwnerUserId="10165" LastActivityDate="2020-05-09T15:04:10.257" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11932" PostTypeId="1" AcceptedAnswerId="11933" CreationDate="2020-05-09T19:06:00.247" Score="5" ViewCount="774" Body="&lt;p&gt;I am trying to make circuit for &lt;span class=&quot;math-container&quot;&gt;$C^3Z$&lt;/span&gt; gate I have seen a circuit for &lt;span class=&quot;math-container&quot;&gt;$C^2Z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$CCZ$&lt;/span&gt; gate made by using &lt;span class=&quot;math-container&quot;&gt;$CCX$&lt;/span&gt; gate so is there any way to make circuit for &lt;span class=&quot;math-container&quot;&gt;$C^3Z$&lt;/span&gt; in this similar manner( i.e by using &lt;span class=&quot;math-container&quot;&gt;$CCX$&lt;/span&gt; gate) or i have to do something different then this method Fig. is below for &lt;span class=&quot;math-container&quot;&gt;$CCZ$&lt;/span&gt; gate&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4gQ6y.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4gQ6y.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="8527" LastEditDate="2020-05-16T07:30:52.667" LastActivityDate="2020-05-16T07:30:52.667" Title="How to make circuit for n-control Z gate( i.e $C^3Z$ )?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11933" PostTypeId="2" ParentId="11932" CreationDate="2020-05-09T21:53:46.723" Score="5" Body="&lt;p&gt;The circuit you showed above for the double-controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate can be extended to a triple-controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; by adding an extra Toffoli and ancilla:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bzEFpm.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bzEFpm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Qiskit offers such circuits readily in the &lt;a href=&quot;https://qiskit.org/documentation/apidoc/circuit_library.html&quot; rel=&quot;noreferrer&quot;&gt;circuit library&lt;/a&gt;, where you have many different possibilities to implement your multi-controlled Z gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the &lt;strong&gt;MCMT&lt;/strong&gt; (multi-controlled multi-target circuit) is one option.&#xA;You can either use the v-chain version with ancillas, which produces the same circuit as above:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import MCMTVChain&#xA;c3z = MCMTVChain('z', num_ctrl_qubits=3, num_target_qubits=1)&#xA;c3z.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bzEFpm.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bzEFpm.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or you can use an ancilla-free version:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import MCMT&#xA;c3z = MCMT('z', num_ctrl_qubits=3, num_target_qubits=1)&#xA;c3z.decompose().decompose().draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YCz11.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YCz11.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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! &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Excursion to multi-controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Since you know that &lt;span class=&quot;math-container&quot;&gt;$Z = HXH$&lt;/span&gt; another possibility would be to use the multi-controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate from Qiskit. Since there are different methods on how the multi-controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; can be implemented you can choose the &lt;em&gt;mode&lt;/em&gt; you want as either of &lt;code&gt;'noancilla' 'recursion' 'v-chain' 'v-chain-dirty-ancilla'&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;noancilla = QuantumCircuit(4)&#xA;noancilla.h(3)  # H on target qubit&#xA;noancilla.mcx([0, 1, 2], 3, mode='noancilla')&#xA;noancilla.h(3)  # again H on target qubit&#xA;noancilla.draw()&#xA;&#xA;&#xA;q_0: ───────■───────&#xA;            │       &#xA;q_1: ───────■───────&#xA;            │       &#xA;q_2: ───────■───────&#xA;     ┌───┐┌─┴─┐┌───┐&#xA;q_3: ┤ H ├┤ X ├┤ H ├&#xA;     └───┘└───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n = 5  # number of controls&#xA;recursion = QuantumCircuit(n + 1 + 1)  # one for target, one as ancilla&#xA;recursion.h(n)  # H on target qubit&#xA;recursion.mcx(list(range(n)), n, ancilla_qubits=[n + 1], mode='recursion')&#xA;recursion.h(n)  # again H on target qubit&#xA;recursion.decompose().draw()&#xA;&#xA;q_0: ──────────────■─────────■───────────────────&#xA;                   │         │                   &#xA;q_1: ──────────────■─────────■───────────────────&#xA;                   │         │                   &#xA;q_2: ──────────────■─────────■───────────────────&#xA;                   │         │                   &#xA;q_3: ──────────────┼────■────┼────■──────────────&#xA;                   │    │    │    │              &#xA;q_4: ──────────────┼────■────┼────■──────────────&#xA;     ┌──────────┐  │  ┌─┴─┐  │  ┌─┴─┐┌──────────┐&#xA;q_5: ┤ U2(0,pi) ├──┼──┤ X ├──┼──┤ X ├┤ U2(0,pi) ├&#xA;     └──────────┘┌─┴─┐└─┬─┘┌─┴─┐└─┬─┘└──────────┘&#xA;q_6: ────────────┤ X ├──■──┤ X ├──■──────────────&#xA;                 └───┘     └───┘                 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The v-chain implementation is similar to the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate implementations with the Toffolis. Here you need &lt;span class=&quot;math-container&quot;&gt;$n - 2$&lt;/span&gt; ancillas, if &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of controls. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;vchain = QuantumCircuit(n + 1 + n - 2)  # needs n - 2 ancillas&#xA;vchain.h(n)  # H on target qubit&#xA;vchain.mcx(list(range(n)), n, ancilla_qubits=list(range(n+1, 2*n-1)), mode='v-chain')&#xA;vchain.h(n)  # again H on target qubit&#xA;&#xA;&#xA;q_0: ───────■────────&#xA;            │        &#xA;q_1: ───────■────────&#xA;            │        &#xA;q_2: ───────■────────&#xA;     ┌───┐┌─┴──┐┌───┐&#xA;q_3: ┤ H ├┤0   ├┤ H ├  # if you decompose this you'll see&#xA;     └───┘│  X │└───┘  # the exact implementation, try&#xA;q_4: ─────┤1   ├─────  # vchain.decompose().decompose().draw()&#xA;          └────┘     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-05-09T21:53:46.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11934" PostTypeId="1" AcceptedAnswerId="11936" CreationDate="2020-05-10T02:11:31.637" Score="1" ViewCount="466" Body="&lt;p&gt;I am importing &lt;code&gt;from qiskit.circuit.library import MCMTVChain&lt;/code&gt; on python IDLE editor but it showing error &lt;code&gt;ModuleNotFoundError: No module named 'qiskit.circuit.library'&lt;/code&gt; although it's working fine on &lt;code&gt;google colab&lt;/code&gt;. Also why Qiskit does not work properly on python IDLE it's show lots of other error not just this one?&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="55" LastEditDate="2020-05-10T07:44:30.417" LastActivityDate="2020-05-10T07:44:30.417" Title="ModuleNotFoundError: No module named 'qiskit.circuit.library'" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11935" PostTypeId="2" ParentId="11915" CreationDate="2020-05-10T03:38:37.457" Score="3" Body="&lt;p&gt;I guess you assume that you can implement any quantum circuit using Toffoli gates only; this is not true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Toffoli gate is &lt;em&gt;classically&lt;/em&gt; universal, but not &lt;em&gt;quantum&lt;/em&gt; universal. The importance of Toffoli gate in quantum information science is based on 2 facts:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Toffoli gate is classically universal, that is you can implement any classical circuit using Toffoli gates only;&lt;/li&gt;&#xA;&lt;li&gt;Toffoli gate is reversible, so it is also a quantum gate.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The existence of Toffoli gate is a proof that you can implement any classical circuit using quantum circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notion of universal quantum set of gates is more subtle compared with classical case. A set of quantum gates is said to be &lt;em&gt;computationally universal&lt;/em&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301040&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Simple Proof that Toffoli and Hadamard are Quantum Universal&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-05-10T03:38:37.457" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11936" PostTypeId="2" ParentId="11934" CreationDate="2020-05-10T05:47:32.143" Score="3" Body="&lt;p&gt;You most probably haven't installed the qiskit module. Qiskit can be installed via :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Try the following commands in command prompt, one of them should work (if your PATH variables are appropriately set):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;py -m pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;python -m pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or if you have more than one python versions, you can try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;py -'version number like 3.7' pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;without the quotes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should install the qiskit module and then you can import it.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2020-05-10T05:47:32.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11937" PostTypeId="1" AcceptedAnswerId="11938" CreationDate="2020-05-10T10:07:04.960" Score="0" ViewCount="22" Body="&lt;p&gt;Consider a Bell scenario: Alice and Bob perform measurements on a shared system, and each of them has a &quot;measurement box&quot; with a bunch of inputs (corresponding to different measurement settings) and corresponding outputs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Say they can each choose from &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; possible inputs, labelled as &lt;span class=&quot;math-container&quot;&gt;$x,y\in\{1,...,m\}$&lt;/span&gt;, and can get one of &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; possible outputs &lt;span class=&quot;math-container&quot;&gt;$a,b\in\{1,...,\Delta\}$&lt;/span&gt; (taking the notation from (&lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;nofollow noreferrer&quot;&gt;1303.2849&lt;/a&gt;)).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this context, a &lt;em&gt;behaviour&lt;/em&gt; is a set of joint probabilities &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol p\equiv \{p(ab|xy)\}_{abxy}\in\mathbb R^{\Delta^2 m^2}$&lt;/span&gt;.&#xA;A &lt;em&gt;local deterministic behaviour&lt;/em&gt; is a behaviour such that  &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy)=\delta_{a,a_x}\delta_{b,b_x}$&lt;/span&gt; for some pair &lt;span class=&quot;math-container&quot;&gt;$(a_x,b_y)$&lt;/span&gt; associated with each &lt;span class=&quot;math-container&quot;&gt;$(x,y)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to count the number of such behaviours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do this, I would have said that, for each &lt;span class=&quot;math-container&quot;&gt;$(x,y)$&lt;/span&gt;, there are &lt;span class=&quot;math-container&quot;&gt;$\Delta^2$&lt;/span&gt; possible outcome assignments, as &lt;span class=&quot;math-container&quot;&gt;$a_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_x$&lt;/span&gt; can be chosen independently. At the same time, there are &lt;span class=&quot;math-container&quot;&gt;$m^2$&lt;/span&gt; possible pairs &lt;span class=&quot;math-container&quot;&gt;$(x,y)$&lt;/span&gt;, and thus the total number should be &lt;span class=&quot;math-container&quot;&gt;$(\Delta^2)^{m^2}=\Delta^{2 m^2}$&lt;/span&gt;.&#xA;However, in (&lt;a href=&quot;https://arxiv.org/abs/1303.2849&quot; rel=&quot;nofollow noreferrer&quot;&gt;1303.2849&lt;/a&gt;) (between (17) and (18)) they state that this number is &lt;span class=&quot;math-container&quot;&gt;$\Delta^{2m}$&lt;/span&gt;. Why is my calculation off?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-10T10:07:04.960" Title="What is the number of local deterministic behaviours in a Bell scenario?" Tags="&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11938" PostTypeId="2" ParentId="11937" CreationDate="2020-05-10T10:07:04.960" Score="1" Body="&lt;p&gt;I figured out the answer while writing the question, but figured I'd still post it for future reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem with the calculation is that it was not taking into account the &lt;em&gt;locality&lt;/em&gt; constraint. Namely, the fact that local deterministic behaviours also have to satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(ab|xy)=p(a|x)p(b|y).$$&lt;/span&gt;&#xA;Taking this into account, we notice that there are &lt;span class=&quot;math-container&quot;&gt;$\Delta^m$&lt;/span&gt; possible assignments for &lt;span class=&quot;math-container&quot;&gt;$p(a|x)$&lt;/span&gt;, and the same number of &lt;span class=&quot;math-container&quot;&gt;$p(b|y)$&lt;/span&gt;, making for a total number of&#xA;&lt;span class=&quot;math-container&quot;&gt;$(\Delta^m)^2=\Delta^{2m}$&lt;/span&gt; local deterministic assignments, as reported in the reference.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-10T10:07:04.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11939" PostTypeId="2" ParentId="10264" CreationDate="2020-05-10T13:26:05.683" Score="0" Body="&lt;p&gt;I will here spell out more explicitly what the vertices of the local polytope look like.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;The local polytope is generated by local &lt;em&gt;deterministic&lt;/em&gt; behaviours&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;The local polytope is, by definition, comprised of behaviours &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy)$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(ab|xy)=\sum_\lambda p_\lambda p_\lambda(a|x) p_\lambda(b|y).$$&lt;/span&gt;&#xA;Moreover, for each &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, we can always decompose &lt;span class=&quot;math-container&quot;&gt;$p_\lambda(a|x)$&lt;/span&gt; as a convex combination of local deterministic assignments. For example,&#xA;if &lt;span class=&quot;math-container&quot;&gt;$p_\lambda(0|x)=q_{\lambda,0x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_\lambda(1|x)=1-q_{\lambda,0x}$&lt;/span&gt;, then we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_\lambda(a|x) = q_{\lambda,0x} \delta_{a,0} + (1-q_{\lambda,0x})\delta_{a,1}.$$&lt;/span&gt;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a vector, this reads&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\mathbf p_\lambda &amp;amp;=&#xA;  (q_{\lambda,00}\mathbf e_{0} + (1-q_{\lambda,00})\mathbf e_{1})&#xA;  \oplus&#xA;  (q_{\lambda,01}\mathbf e_{0} + (1-q_{\lambda,01})\mathbf e_{1}) \\&#xA;  &amp;amp;= (q_{\lambda,00},1-q_{\lambda,00},q_{\lambda,01},1-q_{\lambda,01}) \\&#xA;  &amp;amp;= (p_\lambda(0|0), p_\lambda(1|0), p_\lambda(0|1), p_\lambda(1|1)),&#xA;\end{align}&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$q_{\lambda,00},q_{\lambda,01}\in\{0,1\}$&lt;/span&gt;.&#xA;All such vectors are generated by the basis vectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathbf e_{ij}\equiv \mathbf e_i\oplus\mathbf e_j$&lt;/span&gt;, representing behaviours in which &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$a=i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x=1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$a=j$&lt;/span&gt;. Explicitly, these are spanned by the four length-four vectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(1,0,1,0),\quad (1,0,0,1),\quad (0,1,1,0), \quad (0,1,0,1).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Behaviours in full space&lt;/em&gt;&lt;/strong&gt;) Now, what about the actual behaviours corresponding to the full conditional probabilities &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy)$&lt;/span&gt;? To accommodate &lt;em&gt;any&lt;/em&gt; such distribution, these must be vectors with &lt;span class=&quot;math-container&quot;&gt;$(2^2)^{2^2}=2^8=256$&lt;/span&gt; elements. The deterministic behaviours in such space are the vectors of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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},$$&lt;/span&gt;&#xA;with each &lt;span class=&quot;math-container&quot;&gt;$\mathbf e_{ij}$&lt;/span&gt; characterising the outputs &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; associated with a given pair of inputs &lt;span class=&quot;math-container&quot;&gt;$xy$&lt;/span&gt;.&#xA;Clearly, however, such vectors do not always correspond to &lt;em&gt;local&lt;/em&gt; behaviours. For example, the vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf e_{00}\otimes \mathbf e_{10}\otimes \mathbf e_{\bullet\bullet}\otimes \mathbf e_{\bullet\bullet}$$&lt;/span&gt;&#xA;is not local, as it gives &lt;span class=&quot;math-container&quot;&gt;$(a,b)=(0,0)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$(x,y)=(0,0)$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$(a,b)=(1,0)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$(x,y)=(0,1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Local behaviours in full space&lt;/em&gt;&lt;/strong&gt;)&#xA;&lt;em&gt;Local&lt;/em&gt; behaviours have the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf e_{a_0b_0}\otimes&#xA;\mathbf e_{a_0b_1} \otimes&#xA;\mathbf e_{a_1b_0} \otimes&#xA;\mathbf e_{a_1b_1} \simeq \mathbf e_{a_0 a_1}\otimes\mathbf e_{b_0b_1},&#xA;$$&lt;/span&gt;&#xA;for some choice of &lt;span class=&quot;math-container&quot;&gt;$a_i,b_j\in\{0,1\}$&lt;/span&gt;. There are therefore only &lt;span class=&quot;math-container&quot;&gt;$(2^2)^2=16$&lt;/span&gt; such basic vectors, whose convex combinations draw the subset of local behaviours in the bigger &lt;span class=&quot;math-container&quot;&gt;$256$&lt;/span&gt;-dimensional space of general behaviours.&lt;/p&gt;&#xA;&#xA;&lt;h2&gt;Show that &lt;em&gt;all&lt;/em&gt; local deterministic behaviours are vertices&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;Suppose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left|\sum_{abxy} (-1)^{a+b+xy} P(ab|xy)\right|= 2.$$&lt;/span&gt;&#xA;Explicitly, this amounts to the following two equations (I'll use &lt;span class=&quot;math-container&quot;&gt;$P_{ab,xy}\equiv P(ab|xy)$&lt;/span&gt; for notational brevity):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(P_{00,00} + P_{11,00} - P_{01,00} - P_{10,00}) +&#xA;(P_{00,01} + P_{11,01} - P_{01,01} - P_{10,01}) +&#xA;(P_{00,10} + P_{11,10} - P_{01,10} - P_{10,10}) -&#xA;(P_{00,11} + P_{11,11} - P_{01,11} - P_{10,11}) = \pm2.&#xA;$$&lt;/span&gt;&#xA;Taking into account the normalisation condition for each &lt;span class=&quot;math-container&quot;&gt;$(x,y)$&lt;/span&gt;, we can simplify this to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\underbrace{P_{00,00} + P_{11,00}}_{\equiv a_{00}}) +&#xA;(\underbrace{P_{00,01} + P_{11,01}}_{\equiv a_{01}}) +&#xA;(\underbrace{P_{00,10} + P_{11,10}}_{\equiv a_{10}}) -&#xA;(\underbrace{P_{00,11} + P_{11,11}}_{\equiv a_{11}}) \in \{0,2\}.&#xA;\tag X$$&lt;/span&gt;&#xA;Consider the possible &lt;em&gt;deterministic&lt;/em&gt; assignments. Any such assignment corresponds to a choice of each of the above four terms on the LHS &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; here denoted with &lt;span class=&quot;math-container&quot;&gt;$a_{xy}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; equaling one (if &lt;span class=&quot;math-container&quot;&gt;$P_{00,xy}=1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$P_{11,xy}=1$&lt;/span&gt;) or zero (if &lt;span class=&quot;math-container&quot;&gt;$P_{01,xy}=1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$P_{10,xy}=1$&lt;/span&gt;).&#xA;In other words, &lt;span class=&quot;math-container&quot;&gt;$a_{xy}\in\{0,1\}$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt;.&#xA;The possible combinations are thus seen to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|c|c|c|c}&#xA;  a_{00} &amp;amp; a_{01} &amp;amp; a_{10} &amp;amp; a_{11} &amp;amp; S\\\hline&#xA;  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\\hline&#xA;  0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\\hline&#xA;  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\\hline&#xA;  1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 2 \\\hline&#xA;  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\\hline&#xA;  1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 2 \\\hline&#xA;  1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 2 \\\hline&#xA;  0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 2 \\\hline&#xA;\end{array}&#xA;$$&lt;/span&gt;&#xA;Each of these rows corresponds to &lt;span class=&quot;math-container&quot;&gt;$2^4=16$&lt;/span&gt; deterministic behaviours. &lt;em&gt;However&lt;/em&gt;, this does not take into account the locality constraint.&#xA;To see this, focus for example on the first row. A compatible behaviour corresponding to this row is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf e_{00}\otimes\mathbf e_{01}\otimes\mathbf e_{10}\otimes\mathbf e_{00}.$$&lt;/span&gt;&#xA;This is nonlocal: the fourth assignment shouldn't be possible, as the first three established that &lt;span class=&quot;math-container&quot;&gt;$a=x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b=y$&lt;/span&gt;, but here we get that &lt;span class=&quot;math-container&quot;&gt;$(1,1)\to(0,0)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, a local &lt;em&gt;deterministic&lt;/em&gt; behaviour must be factorisable: &lt;span class=&quot;math-container&quot;&gt;$$P(ab|xy)=p(a|x)q(b|y)\equiv p_{a|x}q_{b|y}=\delta_{a,a_x}\delta_{b,b_y},$$&lt;/span&gt;&#xA;for some deterministic probability distributions &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. There are &lt;span class=&quot;math-container&quot;&gt;$(2^2)^2=16$&lt;/span&gt; such assignments,&#xA;and the proper way to list them is via each possible assignment of four bits to the four variables &lt;span class=&quot;math-container&quot;&gt;$(a_0, a_1, b_0, b_1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us rewrite (X) embedding the locality constraint in the expression. We get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(p_{00} + p_{01}) q_{00} +&#xA;(p_{00} - p_{01}) q_{01} +&#xA;(p_{10} + p_{11}) q_{10} +&#xA;(p_{10} - p_{11}) q_{11} \in \{0,2\}.&#xA;$$&lt;/span&gt;&#xA;One can verify directly that each one of the possible &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; assignments satisfies this equation, meaning that &lt;em&gt;all possible deterministic local behaviours are vertices on the local polytope&lt;/em&gt;.&#xA;Half of these are vertices for the polytope corresponding to &lt;span class=&quot;math-container&quot;&gt;$S=2$&lt;/span&gt;, and the remaining &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; for the &lt;span class=&quot;math-container&quot;&gt;$S=0$&lt;/span&gt; polytope.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-05-24T10:31:08.333" LastActivityDate="2020-05-24T10:31:08.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11940" PostTypeId="2" ParentId="11408" CreationDate="2020-05-10T14:17:14.700" Score="5" Body="&lt;p&gt;There's actually a really great way to evaluate this with &lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.aqua.operators.html&quot; rel=&quot;noreferrer&quot;&gt;Qiskit Aqua's operator&lt;/a&gt; logic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This module has the concept of statefunctions to represent &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi |$&lt;/span&gt; and operators to represent operators such as &lt;span class=&quot;math-container&quot;&gt;$Z^{\otimes n}$&lt;/span&gt;.&#xA;Your operator would be created using the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; primitive:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import Z&#xA;&#xA;operator = Z ^ Z  # ^ represents a tensor product &#xA;operator = Z ^ 2  # same thing, computes Z ^ Z&#xA;operator = Z.tensorpower(2)  # same thing as Z ^ 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now you need to create your state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;, for which you have different options. Say you know the circuit to prepare your state, then you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.aqua.operators import StateFn&#xA;&#xA;psi_circuit = QuantumCircuit(2)&#xA;# prepare your state ..&#xA;psi = StateFn(psi_circuit)  # wrap it into a statefunction&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Or you can also use prepared common statefunctions such as &lt;code&gt;Zero&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;code&gt;One&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;code&gt;Plus&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;code&gt;Minus&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import Zero, Plus&#xA;&#xA;&#xA;psi = Zero ^ Plus  # creates the state |0+&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To compute the expectation value you naturally need to evaluate &lt;span class=&quot;math-container&quot;&gt;$\langle \Psi | ZZ | \Psi\rangle$&lt;/span&gt;, which you can do as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;expectation_value = (~psi @ operator @ psi).eval()&#xA;expectation_value = (psi.adjoint().compose(operator).compose(psi)).eval()  # same as above&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To explain the syntax: &lt;code&gt;~&lt;/code&gt; computes the adjoint, so &lt;code&gt;~psi&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi|$&lt;/span&gt;. The &lt;code&gt;@&lt;/code&gt; sign is composition and sticks together your states and operators.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Full example&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;As an example, let's compute the expectation value of &lt;span class=&quot;math-container&quot;&gt;$\langle \Psi| ZZ | \Psi\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle = \frac{1}{\sqrt{2}} (|01\rangle + |10\rangle)$&lt;/span&gt;.&#xA;Calculating by hand, this should yield &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.aqua.operators import Z, Zero, One&#xA;&#xA;operator = Z ^ Z &#xA;psi = 1 / np.sqrt(2) * ((One ^ Zero) + (Zero ^ One))&#xA;expectation_value = (~psi @ operator @ psi).eval()&#xA;print(expectation_value.real)  # -1.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-05-10T14:17:14.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11941" PostTypeId="1" AcceptedAnswerId="11948" CreationDate="2020-05-10T14:36:06.243" Score="0" ViewCount="175" Body="&lt;p&gt;I need help with the exercise 4.34 from Nielsen &amp;amp; Chuang Book.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IX9iJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IX9iJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am supposed to get a matrix corresponding to the circuit. Thanks&lt;/p&gt;&#xA;" OwnerUserId="11997" LastActivityDate="2020-05-10T18:50:55.463" Title="Nielsen &amp; Chuang Exercise 4.34 &quot;Measuring an operator&quot;" Tags="&lt;circuit-construction&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11942" PostTypeId="1" AcceptedAnswerId="11944" CreationDate="2020-05-10T14:52:31.820" Score="1" ViewCount="80" Body="&lt;p&gt;This related to the proof of universality (pg 196),and partially related to the question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/10216/why-is-deutschs-gate-universal&quot;&gt;Why is Deutsch&amp;#39;s gate universal?&lt;/a&gt;, however i'm trying to workout a more rigorous proof and understanding of why irrationality is so important.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\theta_k \in [0,2\pi)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta_k = (k\theta)\text{mod }2\pi$&lt;/span&gt;, I am struggling to see how for a sequence &lt;span class=&quot;math-container&quot;&gt;$k \in \mathbb{Z}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k = {1\dots} N$&lt;/span&gt; that the set of &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt; fills up the interval &lt;span class=&quot;math-container&quot;&gt;$[0,2\pi)$&lt;/span&gt;, and why is is important that &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is an irrational multiple of &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. Does irrationality indicate the uniqueness of each &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt;? This is something I was trying to prove but can't seem to get very far, based on&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha \mod \beta = a - \beta[\alpha/\beta]$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$[]$&lt;/span&gt; is the floor.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;using &lt;span class=&quot;math-container&quot;&gt;$\alpha = \gamma(2\pi)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is irrational, and &lt;span class=&quot;math-container&quot;&gt;$\beta=2\pi$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta_k =k\gamma(2\pi) - 2\pi[k\gamma(2\pi)/2\pi] = k\gamma(2\pi) - 2\pi[k\gamma]$&lt;/span&gt;, however I can't see how this yields uniqueness for irrational &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and not for a rational &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is rational &lt;span class=&quot;math-container&quot;&gt;$\gamma = \frac{p}{q}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\frac{kp}{q}$&lt;/span&gt; is still unique unless &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;....Or I could just be taking entirely the wrong approach!&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-10T18:19:49.633" LastActivityDate="2020-05-10T18:28:16.173" Title="Universality and coverage of irrational multiples of $2\pi$ In $[0, 2\pi)$" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;mathematics&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11943" PostTypeId="1" CreationDate="2020-05-10T15:41:08.033" Score="3" ViewCount="218" Body="&lt;p&gt;I am digging into to the workings of the D-wave quantum annealing computers using &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/doc_getting_started.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation&lt;/a&gt;. I find it very intuitive and well-explained, but &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/c_gs_5.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;their example&lt;/a&gt; of a &quot;simple QUBO problem&quot; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="11842" LastEditorUserId="2293" LastEditDate="2020-05-10T22:21:15.330" LastActivityDate="2020-10-01T17:09:05.973" Title="What is an example of a simple QUBO problem?" Tags="&lt;d-wave&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11944" PostTypeId="2" ParentId="11942" CreationDate="2020-05-10T16:41:11.277" Score="2" Body="&lt;p&gt;There are two statements in your question:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is a rational number of &lt;span class=&quot;math-container&quot;&gt;$2\,\pi$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt; does not reach every &lt;span class=&quot;math-container&quot;&gt;$x\in[0\,;\,2\,\pi)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;If &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is an irrational number of &lt;span class=&quot;math-container&quot;&gt;$2\,\pi$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt; does reach every &lt;span class=&quot;math-container&quot;&gt;$x\in[0\,;\,2\,\pi)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We can prove that actually, none of these statements are true.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us consider the first one for now. Let &lt;span class=&quot;math-container&quot;&gt;$\theta=2\,q\,\pi$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$q\in\mathbf{Q}$&lt;/span&gt;. Then we can write &lt;span class=&quot;math-container&quot;&gt;$q=\frac{a}{b}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$(a,b)\in\mathbf{Z}^2$&lt;/span&gt;. We can then show that the sequence &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt; contains at most (exactly actually, if &lt;span class=&quot;math-container&quot;&gt;$\frac{a}{b}$&lt;/span&gt; is the irreducible form of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; different elements modulo &lt;span class=&quot;math-container&quot;&gt;$2\,\pi$&lt;/span&gt;. Indeed, we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, the sequence &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;-periodic. As such, it contains at most &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; different elements. Hence, the sequence &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt; does not reach every &lt;span class=&quot;math-container&quot;&gt;$x\in[0\,;\,2\,\pi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us now consider the second statement. Let &lt;span class=&quot;math-container&quot;&gt;$\theta=2\,\gamma\,\pi$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; being an irrational number. Let &lt;span class=&quot;math-container&quot;&gt;$x=2\,k'\,\pi+x'$&lt;/span&gt;. Then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta_k=x\,\mathrm{mod}\,2\,\pi\iff2\,k\,\gamma\,\pi=2\,k'\,\pi+x'$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are now two cases: either &lt;span class=&quot;math-container&quot;&gt;$\gamma\,\pi$&lt;/span&gt; is rational, either it isn't. In the first case, &lt;span class=&quot;math-container&quot;&gt;$2\,k\,\gamma\,\pi$&lt;/span&gt; is always rational. Hence, it cannot reach &lt;span class=&quot;math-container&quot;&gt;$1+2\,k'\,\pi$&lt;/span&gt; whatever &lt;span class=&quot;math-container&quot;&gt;$k'$&lt;/span&gt; is since it is an irrational number. Hence, let us now now consider that &lt;span class=&quot;math-container&quot;&gt;$\gamma\,\pi$&lt;/span&gt; is irrational. Then &lt;span class=&quot;math-container&quot;&gt;$2\,k\,\gamma\,\pi$&lt;/span&gt; is always irrational (for &lt;span class=&quot;math-container&quot;&gt;$k\neq0$&lt;/span&gt;). Let us consider &lt;span class=&quot;math-container&quot;&gt;$x'=\pi$&lt;/span&gt; then. The equation becomes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$2\,k\,\gamma=2\,k'+1$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is irrational, then so is &lt;span class=&quot;math-container&quot;&gt;$2\,k\,\gamma$&lt;/span&gt;. However, &lt;span class=&quot;math-container&quot;&gt;$2\,k'+1$&lt;/span&gt; is rational. Hence, this equation cannot hold. Hence, in every case, we found &lt;span class=&quot;math-container&quot;&gt;$x'\in[0\,;\,2\,\pi)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$x'$&lt;/span&gt; is not reached by the sequence &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, what you can also prove is that every &lt;span class=&quot;math-container&quot;&gt;$x'\in[0\,;\,2\pi)$&lt;/span&gt; can be approached as close as you want, given that &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is irrational.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, let us consider the subgroup of &lt;span class=&quot;math-container&quot;&gt;$(\mathbf{R}, +)$&lt;/span&gt; spanned by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2\,\pi$&lt;/span&gt;, that is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left\{p\,\theta+2\,q\,\pi\middle|(p,q)\in\mathbf{Z}^2\right\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a subgroup of &lt;span class=&quot;math-container&quot;&gt;$(\mathbf{R}, +)$&lt;/span&gt;, it is either discrete (like &lt;span class=&quot;math-container&quot;&gt;$\mathbf{Z}$&lt;/span&gt;) or dense (like &lt;span class=&quot;math-container&quot;&gt;$\mathbf{Q}$&lt;/span&gt;) within &lt;span class=&quot;math-container&quot;&gt;$\mathbf{R}$&lt;/span&gt;. In our case, we can show that it is dense within &lt;span class=&quot;math-container&quot;&gt;$\mathbf{R}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us assume that it is discrete. Then, there exists &lt;span class=&quot;math-container&quot;&gt;$\lambda=p\,\theta+2\,q\pi$&lt;/span&gt; such that every element &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; of this set can be written as &lt;span class=&quot;math-container&quot;&gt;$x=k\,\lambda$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$k\in\mathbf{Z}$&lt;/span&gt;. Since we know that &lt;span class=&quot;math-container&quot;&gt;$2\,\pi$&lt;/span&gt; is in this group, we can write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence, it implies that &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is rational, which we assumed to be false. Hence, this group is dense within &lt;span class=&quot;math-container&quot;&gt;$\mathbf{R}$&lt;/span&gt;. What that means is that every element of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{R}$&lt;/span&gt; can be approached arbitrarily close using an element of this subgroup. More formally:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall\varepsilon&amp;gt;0, \forall x\in\mathbf{R},\exists(p, q)\in\mathbf{Z}^2,|p\theta+2\,q\,\pi-x|&amp;lt;\varepsilon$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By reducing modulo &lt;span class=&quot;math-container&quot;&gt;$2\,\pi$&lt;/span&gt;, you can finally conclude that every &lt;span class=&quot;math-container&quot;&gt;$x'\in[0\,;\,2\,\pi)$&lt;/span&gt; can be approached arbitrarily close by a member of the sequence &lt;span class=&quot;math-container&quot;&gt;$\left(\theta_k\right)_{k\in\mathbf{Z}}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="10454" LastEditDate="2020-05-10T18:28:16.173" LastActivityDate="2020-05-10T18:28:16.173" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11945" PostTypeId="1" CreationDate="2020-05-10T17:09:16.450" Score="3" ViewCount="307" Body="&lt;p&gt;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? &lt;/p&gt;&#xA;" OwnerUserId="11998" LastEditorUserId="55" LastEditDate="2020-08-19T17:34:05.733" LastActivityDate="2020-08-19T19:10:30.343" Title="Why don't quantum computing scientists build two 50-qubit processors and connect them in parallel instead of building one 100-qubit processor?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;&lt;scalability&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11946" PostTypeId="2" ParentId="11943" CreationDate="2020-05-10T17:50:10.887" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://or.stackexchange.com/q/828/727&quot;&gt;I asked a similar question&lt;/a&gt; on the Operations Research Stack Exchange. &lt;a href=&quot;https://or.stackexchange.com/a/978/727&quot;&gt;This answer&lt;/a&gt; lists about 20 different problems that can be solved by QUBO.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want a &quot;dead-simple&quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-05-10T17:50:10.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11947" PostTypeId="1" AcceptedAnswerId="11953" CreationDate="2020-05-10T17:50:26.643" Score="1" ViewCount="64" Body="&lt;p&gt;I'm going through &quot;Quantum Computation &amp;amp; Quantum Information&quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="12015" LastEditorUserId="2927" LastEditDate="2020-05-10T18:10:34.747" LastActivityDate="2020-05-10T22:49:24.920" Title="What kind of transformation does the Y-gate do on the bloch sphere?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11948" PostTypeId="2" ParentId="11941" CreationDate="2020-05-10T18:50:55.463" Score="1" Body="&lt;p&gt;You can show that the circuit satisfies the problem's criteria like so:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cotgn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cotgn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here: &lt;a href=&quot;https://github.com/rehaanahmad2013/NielsenChuang-QuantumComputingSolutions&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/rehaanahmad2013/NielsenChuang-QuantumComputingSolutions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11644" LastActivityDate="2020-05-10T18:50:55.463" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11949" PostTypeId="2" ParentId="11945" CreationDate="2020-05-10T18:56:10.277" Score="6" Body="&lt;p&gt;This reminds me of the Q20:20 engine that &lt;a href=&quot;https://en.wikipedia.org/wiki/NQIT&quot; rel=&quot;nofollow noreferrer&quot;&gt;NQIT&lt;/a&gt; aimed to build over a 5-year period from January 2015 to January 2020, for which they received £38,000,000 of funding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The goal was to build a 400-qubit quantum computer made up of 20 smaller processors, each with 20 qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unfortunately they failed in that aim, as most people would have predicted, because it was an unrealistic goal at the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your suggestion of combining &lt;strong&gt;&lt;em&gt;two&lt;/em&gt;&lt;/strong&gt; processors instead of 20 processors, is a much better one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src=&quot;https://i.stack.imgur.com/6FvsF.png&quot; width=&quot;200&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;inter-chip connection&lt;/em&gt; which is by its very nature, &lt;strong&gt;&lt;em&gt;not as efficient&lt;/em&gt;&lt;/strong&gt; as &lt;em&gt;intra-chip connections&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the above chip, the grey qubits are connected by the blue connections in the picture below:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src=&quot;https://i.stack.imgur.com/ZIpQE.png&quot; width=&quot;300&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What it boils down to is this&lt;/strong&gt;: 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. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-05-11T13:46:54.830" LastActivityDate="2020-05-11T13:46:54.830" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11950" PostTypeId="1" AcceptedAnswerId="11952" CreationDate="2020-05-10T21:06:48.063" Score="5" ViewCount="537" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;is_in_superposition(&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;&lt;code&gt;) = 0&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;is_in_superposition(&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$&lt;/span&gt;&lt;code&gt;) = 1&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="12003" LastEditorUserId="12003" LastEditDate="2020-05-10T22:01:16.797" LastActivityDate="2020-05-11T00:40:26.607" Title="How to check a qubit's state?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11952" PostTypeId="2" ParentId="11950" CreationDate="2020-05-10T21:49:36.463" Score="6" Body="&lt;p&gt;Even though this gate wouldn't be unitary, it wouldn't even be linear. Let us write this down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us call this gate &lt;span class=&quot;math-container&quot;&gt;$\mathbf{S}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\mathbf{S}$&lt;/span&gt; has the following properties:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{S}\,|x\rangle=\begin{cases}|0\rangle&amp;amp;\text{if } |x\rangle=|0\rangle\text{ or }|1\rangle\\|1\rangle&amp;amp;\text{otherwise}\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we would have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{S}\,(\alpha\,|0\rangle+\beta\,|1\rangle)=|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by assumption. But we also have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{S}\,(\alpha\,|0\rangle+\beta\,|1\rangle)=\alpha\,\mathbf{S}\,|0\rangle+\beta\,\mathbf{S}\,|1\rangle = \alpha\,|0\rangle+\beta\,|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create the state you're interested in.&lt;/li&gt;&#xA;&lt;li&gt;Measure it.&lt;/li&gt;&#xA;&lt;li&gt;Repeat.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Creating the state can be computationally hard.&lt;/li&gt;&#xA;&lt;li&gt;Noise can induce inaccuracies in the measurement.&lt;/li&gt;&#xA;&lt;li&gt;You're never sure that a state really is not in a superposed state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is nil, since the measurement will then affect &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Unless I'm mistaken, it is thus impossible to perform such an operation.&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="10454" LastEditDate="2020-05-11T00:40:26.607" LastActivityDate="2020-05-11T00:40:26.607" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11953" PostTypeId="2" ParentId="11947" CreationDate="2020-05-10T22:41:15.597" Score="3" Body="&lt;p&gt;The nice thing about the Bloch sphere is that you can visualize the various rotations without having to think too much about complex numbers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate causes a 180-degree rotation around the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-axis of the sphere. (Imagine spinning the sphere a half-rotation around the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-axis.) For example, if your state is at either end of the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis, then rotating 180 degrees around the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-axis will move your state to the opposite end of the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis. Same if your state is at either end of the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis. But if your state is on the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-axis itself, then applying a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate does not rotate the state — it remains in the same place.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Mathematically, yes, this is represented with complex numbers. If it helps, you can think of the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; plane of the Bloch sphere as sort of like polar coordinates representing the relative phase between the &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; parts of your superposition — the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-axis represents the real part, and the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-axis represents the imaginary part.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastActivityDate="2020-05-10T22:41:15.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11954" PostTypeId="1" CreationDate="2020-05-11T01:49:28.697" Score="0" ViewCount="60" Body="&lt;p&gt;I learnt from &lt;a href=&quot;https://www.youtube.com/watch?v=F_Riqjdh2oM&quot; rel=&quot;nofollow noreferrer&quot;&gt;this lecture&lt;/a&gt; (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 &lt;em&gt;smart structuring&lt;/em&gt; of input data, which is also doable on classical computers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Hadamard gate&lt;/li&gt;&#xA;&lt;li&gt;CNOT gate&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11980" LastEditorUserId="11980" LastEditDate="2020-05-11T03:48:12.847" LastActivityDate="2020-05-11T04:09:25.560" Title="How does Deutsch Oracle shows quantum supremacy?" Tags="&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11955" PostTypeId="2" ParentId="11895" CreationDate="2020-05-11T02:45:15.880" Score="6" Body="&lt;p&gt;While Craig Gidney (from Google) is correct in his comment which says that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; do not create superpositions on states that are not in superposition, such as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;; even if we assume that the initial state must &lt;em&gt;not&lt;/em&gt; be in superposition, it is still possible to create superpositions with the 2-qubit gates, even if the 1-qubit gates are in fact &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; (without the square roots).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would still be a perfectly fair question to ask your exact same question, but for 2-qubit gates instead of 1-qubit gates:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there any specific reason for not using text-book gates such as &lt;span class=&quot;math-container&quot;&gt;$\textrm{CZ}$&lt;/span&gt; (controlled-Z)  ? &lt;/li&gt;&#xA;&lt;li&gt;Is it because of technical issues, such as the natural choice for transmon qubits not being these gates?&lt;/li&gt;&#xA;&lt;li&gt;Or is it because of the complexity of the algorithm that is needed to&#xA;simulate these gates?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;These are actually &lt;strong&gt;very&lt;/strong&gt;, &lt;strong&gt;very&lt;/strong&gt; good questions, and while the answer is subtle, the answer is in fact &lt;strong&gt;yes&lt;/strong&gt; for all three questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will start by pointing out that page 3 of the paper says:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;The implementation of high-fidelity ‘textbook gates’ natively, such as&#xA;  CZ or iSWAP, is work in progress.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The details about the &lt;em&gt;reason&lt;/em&gt; for this, are buried all the way down to pages 15-16 of the Supplementary Information document. They say:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;For quantum supremacy, the two-qubit gate of choice is the iSWAP gate.&#xA;  For example, CZ is less computationally expensive to simulate on a&#xA;  classical computer by a factor of two [37, 49]. A dominant&#xA;  error-mechanism when trying to implement an iSWAP is a small&#xA;  conditional-phase that is generated by an interaction of the&#xA;  |11&gt;-state with higher states of the transmons (|02&gt; and |20&gt;). For&#xA;  this reason, the fSim gate with swap-angle θ ~ 90◦ and conditional&#xA;  phase φ ~ 30◦ has become the gate of choice in our supremacy&#xA;  experiment. gates. These gates result from the natural evolution of&#xA;  two qubits making them easy to calibrate, high intrinsic fidelity&#xA;  gates for quantum supremacy.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;h2&gt;So now here are the answers to the three questions:&lt;/h2&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Yes, there is a specific reason why they didn't implement the &lt;span class=&quot;math-container&quot;&gt;$\textrm{CZ}$&lt;/span&gt; gate:&lt;/li&gt;&#xA;&lt;li&gt;Yes, one reason is because of the complexity of the algorithm needed to simulate these gates: The &lt;span class=&quot;math-container&quot;&gt;$\textrm{iSWAP}$&lt;/span&gt; gate happens to be two times harder to simulate on a classical computer than the &lt;span class=&quot;math-container&quot;&gt;$\textrm{CZ}$&lt;/span&gt; gate. They do not give the specific numbers for how long the classical simulation would take if &lt;span class=&quot;math-container&quot;&gt;$\textrm{CZ}$&lt;/span&gt; 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). &lt;strong&gt;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&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Yes, there is also a technical issue which caused them not to implement the iSWAP gate exactly, but instead what they call a &quot;partial-iSWAP gate&quot;. The most natural way for them to implement an iSWAP gate is partially &quot;polluted&quot; by higher excited states which they label &lt;span class=&quot;math-container&quot;&gt;$|02\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|20\rangle$&lt;/span&gt;, so they instead implement a &quot;partial-iSWAP&quot; gate. This is in a sub-section of the Supplementary Information called &lt;strong&gt;&quot;The natural two-qubit gate for transmon qubits&quot;&lt;/strong&gt; which is exactly what you suggested in your question, so you seem to have been very correct in your thinking!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Furthermore, I personally wouldn't call CZ or iSWAP &quot;text-book&quot; 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 &quot;natural&quot; 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. &lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;${ 53 \choose{2}}$&lt;/span&gt; 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. &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-05-11T02:45:15.880" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="11956" PostTypeId="1" AcceptedAnswerId="11958" CreationDate="2020-05-11T03:26:36.220" Score="1" ViewCount="55" Body="&lt;p&gt;In Quantum Country's &lt;a href=&quot;https://quantum.country/search&quot; rel=&quot;nofollow noreferrer&quot;&gt;post on the quantum search algorithm&lt;/a&gt;, they lay out the search algorithm for the case where there is exactly one solution &lt;span class=&quot;math-container&quot;&gt;$| s \rangle$&lt;/span&gt;. The key steps are to start in the equal superposition state &lt;span class=&quot;math-container&quot;&gt;$|E \rangle$&lt;/span&gt; and then apply a Grover iteration &lt;span class=&quot;math-container&quot;&gt;$\pi \sqrt N / 4$&lt;/span&gt; times. The Grover iteration is to reflect about the &lt;span class=&quot;math-container&quot;&gt;$|s \rangle$&lt;/span&gt; state and then reflect about the &lt;span class=&quot;math-container&quot;&gt;$|E \rangle$&lt;/span&gt; state, resulting in a rotation of the current state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; towards &lt;span class=&quot;math-container&quot;&gt;$|s \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$|s_1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|s_2 \rangle$&lt;/span&gt;. It seems to me the exact same algorithm and circuit for rotating around &lt;span class=&quot;math-container&quot;&gt;$|s \rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|s_1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|s_2 \rangle$&lt;/span&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there anything else we must modify in the algorithm for search to handle two possible solutions (or N possible solutions)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For context, the rotation about &lt;span class=&quot;math-container&quot;&gt;$|s \rangle$&lt;/span&gt; looks like this, where &lt;span class=&quot;math-container&quot;&gt;$C_s$&lt;/span&gt; is an oracle that flips the working bit if &lt;span class=&quot;math-container&quot;&gt;$|x \rangle$&lt;/span&gt; is a solution (image from QC):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NeZkr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NeZkr.png&quot; alt=&quot;Circuit for rotating around solution state&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12005" LastActivityDate="2020-05-11T04:20:45.670" Title="Quantum search algorithm with exactly 2 solutions" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11957" PostTypeId="2" ParentId="11954" CreationDate="2020-05-11T04:09:25.560" Score="1" Body="&lt;p&gt;The video at 33:20 is talking about the Deutsch problem, which is a problem that a quantum computer can solve with 1 query whereas a classical computer only needs 2 queries. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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-Josza problem, can be solved on a quantum computer with 1 query instead of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; on a classical computer, so let's continue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are asking whether or not the quantum computer performs better because of certain gates running faster than simulating them on classical computers:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Thus, for me, the only way to accept that Deutsch Oracle is indeed&#xA;  faster on quantum computers is due to the fact that some of the&#xA;  following gates run much faster on quantum computers than being&#xA;  simulated on classical computers:&lt;/p&gt;&#xA;  &#xA;  &lt;ul&gt;&#xA;  &lt;li&gt;Hadamard gate &lt;/li&gt;&#xA;  &lt;li&gt;CNOT gate&lt;/li&gt;&#xA;  &lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The answer, is that this is not the case.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First of all, there's no CNOT in the quantum-computer solution to the Deutsch-Josza problem. &lt;/li&gt;&#xA;&lt;li&gt;Second, the way a classical computer solves this problem is not by simulating the Hadamard gates. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The reason why quantum computers can theoretically outperform classical computers for solving Deutsch-Josza problems, is because they can evaluate the mystery function for all possible inputs at the same time.&lt;/strong&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm#Algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;a resource here&lt;/a&gt; for you to see every step of how the Deutsch-Josza 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.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-05-11T04:09:25.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11958" PostTypeId="2" ParentId="11956" CreationDate="2020-05-11T04:20:45.670" Score="1" Body="&lt;p&gt;The only thing we need to modify is the number of iterations we do. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The geometric representation of the Grover iteration is a rotation of the system state by an angle &lt;span class=&quot;math-container&quot;&gt;$2\Delta$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Delta \approx \sqrt{\frac{M}{N}}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the size of the search space, and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the number of solutions, &lt;span class=&quot;math-container&quot;&gt;$M \ll N$&lt;/span&gt;). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need to rotate the state by approximately &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt;, which is going to take about &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4\Delta} \approx \frac{\pi}{4}\sqrt{\frac{N}{M}}$&lt;/span&gt; iterations. In other words, the more solutions your problem has, the fewer iterations we need to do (which makes sense).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-11T04:20:45.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11959" PostTypeId="1" AcceptedAnswerId="11961" CreationDate="2020-05-11T05:19:46.023" Score="0" ViewCount="56" Body="&lt;p&gt;I am new to quantum computing. Can someone help me in calculating state of the qubit when &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{3}{5}e^{i\pi/7}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta = -\frac{4i}{5}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="12006" LastEditorUserId="2879" LastEditDate="2020-05-11T05:33:45.050" LastActivityDate="2020-05-11T14:05:48.023" Title="Calculating the state of the qubit when $\alpha$ and $\beta$ are given" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-05-11T16:29:23.177" ContentLicense="CC BY-SA 4.0" />
  <row Id="11961" PostTypeId="2" ParentId="11959" CreationDate="2020-05-11T08:52:26.317" Score="2" Body="&lt;p&gt;The state is usually just expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha|0\rangle+\beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;which is straightforward given that you're stating &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, if what you actually want is a geoemtric interpretation, that means mapping your system to something of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\gamma}(\cos\frac{\theta}{2}|0\rangle+\sin\frac{\theta}{2}e^{i\phi}|1\rangle)&#xA;$$&lt;/span&gt;&#xA;where you want the values of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. In this case, you immediately have &lt;span class=&quot;math-container&quot;&gt;$\gamma=\pi/7$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\theta}{2}=\frac{3}{5}$&lt;/span&gt;. You want to be a little careful in your choice of &lt;span class=&quot;math-container&quot;&gt;$\sin\frac{\theta}{2}$&lt;/span&gt; - you probably want it to be positive (as was also true of cos), so &lt;span class=&quot;math-container&quot;&gt;$\sin\frac{\theta}{2}=\frac{4}{5}$&lt;/span&gt;. Hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sin\theta=2\cdot\frac{3}{5}\cdot\frac{4}{5}=\frac{24}{25}.&#xA;$$&lt;/span&gt;&#xA;You can numerically evaluate this of you want, but it's probably better to leave it just like that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we need to take care of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\phi}=-ie^{-i\pi/7}=e^{-i\pi/7-i\pi/2},&#xA;$$&lt;/span&gt;&#xA;so we conclude that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\phi=2\pi-\frac{\pi}{7}-\frac{\pi}{2}=\frac{19}{14}\pi,&#xA;$$&lt;/span&gt;&#xA;since you're probably expected to give a value of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; in the range 0 to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="2293" LastEditDate="2020-05-11T14:05:48.023" LastActivityDate="2020-05-11T14:05:48.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11962" PostTypeId="1" AcceptedAnswerId="11963" CreationDate="2020-05-11T11:14:29.663" Score="1" ViewCount="51" Body="&lt;p&gt;Using &lt;code&gt;transpile&lt;/code&gt; with &lt;code&gt;optimization_level = 3&lt;/code&gt;, which is the layout method used by default? &lt;/p&gt;&#xA;" OwnerUserId="12013" LastEditorUserId="5955" LastEditDate="2020-05-11T11:17:11.610" LastActivityDate="2020-05-11T11:58:53.493" Title="Layout Method in qiskit" Tags="&lt;qiskit&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11963" PostTypeId="2" ParentId="11962" CreationDate="2020-05-11T11:18:03.070" Score="1" Body="&lt;p&gt;&lt;code&gt;DenseLayout&lt;/code&gt; is used by default. You can see the code for the optimization level &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level3.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and it is &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/d5e0750d6fe0cae0a204a3cdd8751c0ede9ed6e1/qiskit/transpiler/preset_passmanagers/level3.py#L84&quot; rel=&quot;nofollow noreferrer&quot;&gt;this line&lt;/a&gt; that sets the default to be the dense layout.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-11T11:18:03.070" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="11964" PostTypeId="2" ParentId="11962" CreationDate="2020-05-11T11:58:53.493" Score="1" Body="&lt;p&gt;You can pass a &lt;code&gt;layout_method=...&lt;/code&gt; arg to set this yourself. It currently accepts &lt;code&gt;'dense'&lt;/code&gt;, &lt;code&gt;'noise_adaptive'&lt;/code&gt; and &lt;code&gt;'trivial'&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(There is a also an option for &lt;code&gt;routing_method=...&lt;/code&gt; which accepts &lt;code&gt;'basic'&lt;/code&gt;, &lt;code&gt;'stochastic'&lt;/code&gt; and &lt;code&gt;'lookahead'&lt;/code&gt;.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-05-11T11:58:53.493" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11965" PostTypeId="2" ParentId="11921" CreationDate="2020-05-11T12:42:54.557" Score="1" Body="&lt;p&gt;Firstly let's use Taylor series (I will write &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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!} ... =&#xA;\\&#xA; = \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|) =&#xA;\\&#xA;= I + (e^{-it} - 1) |x \rangle \langle x |&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the circuit should implement the operator &lt;span class=&quot;math-container&quot;&gt;$I + (e^{-it} - 1) |x \rangle \langle x |$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now what does the Oracle (from the M. Nielsen and I. Chuang textbook):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle |q\rangle \xrightarrow[]{\text{O}} |x\rangle |q \oplus f(x)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, if &lt;span class=&quot;math-container&quot;&gt;$|q\rangle = |0\rangle$&lt;/span&gt; as mentioned in the circuit, and note that &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; only if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a solution, otherwise &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;. The operator that corresponds to the Oracle (here I am assuming (also assumed in the book) that we have only one solution):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$O = \sum_{y \ne x} |y\rangle \langle y| I + |x\rangle \langle x| X = II + |x\rangle \langle x| (X - I) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's see what the combined action looks like (the phase gate is denoted as &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$II \equiv I$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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]= &#xA;\\&#xA;= 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) =&#xA;\\ = I \cdot P - |x\rangle \langle x| P + e^{it}|x\rangle \langle x| P^{\dagger}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$XPX = e^{it}P^{\dagger}$&lt;/span&gt;. Let's take into account that the ancillary qubit starts in the &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; state, then the combined operator will look like (by omitting the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P^{\dagger}$&lt;/span&gt; applyied on the ancillary qubit, because they do noting on the &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; state and thus the ancillary qubit is &quot;out of the game&quot;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;I - |x\rangle \langle x| + e^{it}|x\rangle \langle x| = I + (e^{it} - I)|x\rangle \langle x|&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How one can see there is the inconsistency of &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; sign in the phase like in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11860/9459&quot;&gt;answer&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0101\rangle$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt; should be a solution):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/3UMkp.png&quot; width=&quot;150&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the leftmost qubit in &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt; corresponds to the first wire. The circuit is drawn with &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk&lt;/a&gt;. The way of implementing the Oracle shown above more explicitly can be understood from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11674/9459&quot;&gt;answer&lt;/a&gt; about black and white dots in the circuit and this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11603/9459&quot;&gt;answer&lt;/a&gt; about multi-controlled gates.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-11T16:07:53.343" LastActivityDate="2020-05-11T16:07:53.343" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11966" PostTypeId="1" CreationDate="2020-05-11T12:49:21.893" Score="1" ViewCount="191" Body="&lt;p&gt;I have created a circuit and then run the following:&#xA;&lt;code&gt;provider = IBMQ.get_provider('ibm-q')&lt;/code&gt;&#xA;And this is what I get:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQProviderError                         Traceback (most recent call last)&#xA;&amp;lt;ipython-input-24-d651cdcd236d&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 provider = IBMQ.get_provider('ibm-q')&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqfactory.py in get_provider(self, hub, group, project)&#xA;    352 &#xA;    353         if not providers:&#xA;--&amp;gt; 354             raise IBMQProviderError('No provider matches the criteria.')&#xA;    355         if len(providers) &amp;gt; 1:&#xA;    356             raise IBMQProviderError('More than one provider matches the criteria.')&#xA;&#xA;IBMQProviderError: 'No provider matches the criteria.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="user12014" LastEditorUserId="55" LastEditDate="2020-10-12T07:28:07.173" LastActivityDate="2020-10-12T07:28:07.173" Title="Trying to get a provider from IBMQ but get 'No provider matches the criteria.'" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11967" PostTypeId="2" ParentId="11966" CreationDate="2020-05-11T13:20:26.817" Score="1" Body="&lt;p&gt;There is no hub simply called &lt;code&gt;ibm-q&lt;/code&gt;. I think what you are meaning to do is&#xA;&lt;code&gt;provider  = IBMQ.get_provider()&lt;/code&gt;. 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 &lt;code&gt;backend = provider.get_backend(BACKEND_NAME)&lt;/code&gt; to get the backend you want to use.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-11T13:20:26.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11968" PostTypeId="1" AcceptedAnswerId="11970" CreationDate="2020-05-11T17:06:10.273" Score="1" ViewCount="92" Body="&lt;p&gt;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). &#xA;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. &#xA;Do any of you had the same problem or figure out why I have it?&#xA;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="12017" LastActivityDate="2020-05-11T17:41:37.443" Title="Evaluated Standard deviation during QAOA/VQE optimization is always zero. Qiskit 0.19" Tags="&lt;qiskit&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11969" PostTypeId="1" CreationDate="2020-05-11T17:18:15.920" Score="0" ViewCount="62" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12015" LastEditorUserId="55" LastEditDate="2020-08-27T12:55:37.677" LastActivityDate="2020-08-27T12:55:37.677" Title="Cannot interpret transformations on the bloch sphere as matrix multiplications" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;bloch-sphere&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11970" PostTypeId="2" ParentId="11968" CreationDate="2020-05-11T17:41:37.443" Score="0" Body="&lt;p&gt;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 &lt;code&gt;expectation&lt;/code&gt; property of your QAOA object to &lt;code&gt;PauliExpectation()&lt;/code&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="4379" LastActivityDate="2020-05-11T17:41:37.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11971" PostTypeId="2" ParentId="11969" CreationDate="2020-05-11T17:51:50.177" Score="2" Body="&lt;p&gt;First of all if you take at look at how the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate works:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X|0\rangle = |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now applying a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; you get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y|0\rangle = i|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y|1\rangle = -i|0\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$[X,Z] = XZ - ZX =2iY $&lt;/span&gt;). In the case of the pure states &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; you can see that it ends up in another pure state, and as such the phases, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; applied by the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gates can be treated a global phase and in these cases 'ignored' when taking a measurement, you will always be measuring with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; the state that you are in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the more general case consider a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y|\psi\rangle = i\alpha|1\rangle -i\beta|0\rangle $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|i\alpha|^2 + |-i\beta|^2 = 1$&lt;/span&gt;, when measuring these states the factor of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|i^2|=1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Again when applying a phase gate to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, you are only shifting the phase of &lt;span class=&quot;math-container&quot;&gt;$1\rangle$&lt;/span&gt;, but this doesn't change the probability of measuring the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what about the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate, this is a combination of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; rotations, and takes &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;, in this case we can't ignore the phase &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$|\frac{1}{\sqrt{2}}|^2 = \frac{1}{2}$&lt;/span&gt;, and changes the measurement probability such that it is 50/50 measuring either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a side, to visualise the poles of the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; axis, in (into the screen) and out (out of the screen), they are given by:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|i\rangle = \frac{1}{\sqrt{2}}|0\rangle + \frac{i}{\sqrt{2}}|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|o\rangle\ = \frac{1}{\sqrt{2}}|0\rangle - \frac{i}{\sqrt{2}}|1\rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;so on the Bloch Sphere applying a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gate to either of these poles flips between them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would recommend watching Prof Shor explain this better than me &lt;a href=&quot;https://courses.edx.org/courses/course-v1:MITx+8.370.1x+1T2018/courseware/Week2/lectures_u1_3/?child=first&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://courses.edx.org/courses/course-v1:MITx+8.370.1x+1T2018/courseware/Week2/lectures_u1_3/?child=first&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-11T18:33:37.213" LastActivityDate="2020-05-11T18:33:37.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11972" PostTypeId="2" ParentId="11913" CreationDate="2020-05-11T18:05:34.240" Score="2" Body="&lt;p&gt;One thing to point out is that because the Paulis form a basis, you &lt;em&gt;can&lt;/em&gt; actually represent any &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; matrix in terms of a sum of tensors of Paulis, i.e., members of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli group. That is, you can write any &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as a sum of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A =\sum_{i,j,k}h_{ijk}\ \sigma_i\otimes\sigma_j\otimes\sigma_k$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$h_{ijk}$&lt;/span&gt; are the coefficients in the Pauli basis. The answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis&quot;&gt;this related question&lt;/a&gt; describes how to solve for these coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, once you have expressed &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; 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 &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/libraries/standard/data-structures#dynamical-generator-modeling&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;. The general idea is that once you have expressed the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the Pauli basis, you can now use something like a &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/libraries/chemistry/concepts/algorithms#trottersuzuki-formulas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trotter–Suzuki expansion&lt;/a&gt; to approximately express the exponential &lt;span class=&quot;math-container&quot;&gt;$e^{iA}$&lt;/span&gt; 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 &lt;code&gt;Exp&lt;/code&gt; and &lt;code&gt;PauliEvolutionSet&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why doesn't a language like Q# include a built-in library for implementing a matrix exponential &lt;span class=&quot;math-container&quot;&gt;$e^{iA}$&lt;/span&gt; for some general matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;? Essentially because such an operation is, in general, extremely inefficient to implement on a quantum computer. To understand why, note that for a general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary, there are &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; -- far too deep to be practical for anything beyond very small systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The exception is the case where the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has &quot;sparsity&quot; in some representation -- for example, if only a constant number of the &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="1978" LastEditDate="2020-05-11T18:12:33.010" LastActivityDate="2020-05-11T18:12:33.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11973" PostTypeId="2" ParentId="11875" CreationDate="2020-05-11T18:13:49.073" Score="3" Body="&lt;p&gt;You can see from here, &lt;a href=&quot;https://nmr.physics.ox.ac.uk/oxonly/C2/QIP2answers.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;nmr.physics.ox.ac.uk/oxonly/C2/QIP2answers.pdf&lt;/a&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="9482" LastEditDate="2020-05-11T22:50:43.787" LastActivityDate="2020-05-11T22:50:43.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11974" PostTypeId="1" AcceptedAnswerId="11975" CreationDate="2020-05-11T18:53:04.430" Score="1" ViewCount="99" Body="&lt;p&gt;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)?&lt;/p&gt;&#xA;" OwnerUserId="12015" LastEditorUserId="23" LastEditDate="2020-05-12T14:56:36.937" LastActivityDate="2020-05-12T14:56:36.937" Title="Where is $i|0\rangle$ located on the bloch sphere?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11975" PostTypeId="2" ParentId="11974" CreationDate="2020-05-11T20:00:24.970" Score="3" Body="&lt;p&gt;If you read my previous answer here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11969/cannot-interpret-transformations-on-the-bloch-sphere-as-matrix-multiplications&quot;&gt;Cannot interpret transformations on the bloch sphere as matrix multiplications&lt;/a&gt; you can see that on the Bloch sphere &lt;span class=&quot;math-container&quot;&gt;$i|0\rangle$&lt;/span&gt; lies on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, because we can ignore the global phase here and the probability of being in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is 1, when measuring you can't distinguish between the sign of &lt;span class=&quot;math-container&quot;&gt;$i^2$&lt;/span&gt; and 1. But then what about &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = \alpha\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;. However &lt;span class=&quot;math-container&quot;&gt;$i|0\rangle = \alpha|0\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha=i$&lt;/span&gt;, thus they are not distinct states up to a phase of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The basis of the Bloch sphere is not that of the two states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the Bloch sphere is on the basis of the 3 spin states, &lt;span class=&quot;math-container&quot;&gt;$\sigma_x, \sigma_y, \sigma_z$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if we start by assuming we can measure spin on one axis we get either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; both with equal chance, i.e our measuring device is inbetween &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; has poles &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; has poles &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; has poles &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rather than getting bogged down with imaginary numbers, just remember that &lt;span class=&quot;math-container&quot;&gt;$i^2=-1$&lt;/span&gt;, and that in the complex space we can represent a real number or a complex number using &lt;span class=&quot;math-container&quot;&gt;$re^{i\theta} = r(\cos(\theta) + i\sin(\theta))$&lt;/span&gt;, and that real numbers are just where we have &lt;span class=&quot;math-container&quot;&gt;$i\sin(\theta)=0$&lt;/span&gt;. In fact, you may be wondering why we can saying by using &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; we have a perpendicular axis, well, &lt;span class=&quot;math-container&quot;&gt;$\cos$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin$&lt;/span&gt; form an orthogonal basis &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi/2)=0$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$\sin(\pi/2)=1$&lt;/span&gt;, hence we can can now see that we can form the 3rd orthogonal axis from 2 complex numbers by using the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; component, and in the case of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis we just have 0 imaginary part. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are linearly independent, otherwise they wouldn't form an orthonormal basis, there is no such non trivial &lt;span class=&quot;math-container&quot;&gt;$\alpha \in \mathbb{R}$&lt;/span&gt; s.t. &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle = |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-12T14:53:57.780" LastActivityDate="2020-05-12T14:53:57.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11976" PostTypeId="2" ParentId="11945" CreationDate="2020-05-12T00:50:24.240" Score="2" Body="&lt;p&gt;How do you connect your two processors and with high fidelity let them communicate? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably the highest fidelity &quot;flying&quot; qubit is a photon of light. But they face several challenges:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;How do you interface a photon of light with your stationary qubits?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do generate heralded photons in the first place?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we actually transmit these photons between processors(tens of feet through fiber optics between refrigerators)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Quantum transduction is a very hot topic in basic research right now. &lt;/p&gt;&#xA;" OwnerUserId="9579" LastActivityDate="2020-05-12T00:50:24.240" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11978" PostTypeId="1" AcceptedAnswerId="11979" CreationDate="2020-05-12T09:29:49.407" Score="0" ViewCount="143" Body="&lt;p&gt;I have some problem in understanding the proof of the concavity of root fidelity given in Chapter 9.2 of Mark M. Wilde's &amp;quot;Quantum Information Theory&amp;quot;. Here, the fidelity is defined by &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma) = ||\sqrt{\rho}\sqrt{\sigma}||_1^2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$||\cdot ||_1$&lt;/span&gt; is a Schatten 1-norm and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are density matrices. The joint concavity of root fidelity is the following property:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;\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)&#xA;\end{equation*}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_X(x)$&lt;/span&gt; is a probability distribution. The proof of the joint concavity is given as below in the book:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;Proof.&lt;/em&gt; Let &lt;span class=&quot;math-container&quot;&gt;$|\phi^{\rho_x}\rangle_{RA}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi^{\sigma_x}\rangle_{RA}$&lt;/span&gt; be the respective Uhlmann purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;, i.e, &lt;span class=&quot;math-container&quot;&gt;$F(\rho_x, \sigma_x) = |\langle \phi^{\rho_x}| \phi^{\sigma_x}\rangle_{RA}|^2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; denotes the environment system.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; be the orthonormal basis of the system &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{gather*}&#xA;|\phi^{\rho}\rangle = \sum_x \sqrt{p_X(x)}|\phi^{\rho_x}\rangle_{RA} |x\rangle_X, &amp;amp; |\phi^{\sigma}\rangle = \sum_x \sqrt{p_X(x)}|\phi^{\sigma_x}\rangle_{RA} |x\rangle_X&#xA;\end{gather*}&lt;/span&gt;&#xA;are respective purifications of &lt;span class=&quot;math-container&quot;&gt;$\sum_x p_X(x)\rho_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_x p_X(x)\sigma_x$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\sqrt{F}\left( \sum_x p_X(x)\rho_x,\, \sum_x p_X(x)\sigma_x \right) &amp;amp; \geq |\langle\phi^{\rho}|\phi^{\sigma}\rangle| \\&#xA;&amp;amp; = \Bigg| \sum_x p_X(x) \langle\phi^{\rho_x}|\phi^{\sigma_x}\rangle \Bigg| \\&#xA;&amp;amp; \geq \sum_x p_X(x) \,|\langle\phi^{\rho_x}|\phi^{\sigma_x}\rangle|\\&#xA;&amp;amp; = \sum_x p_X(x) \sqrt{F}(\rho_x, \sigma_x)&#xA;\end{align*}&lt;/span&gt;&#xA;where the first inequality is due to Uhlmann's theorem.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11510" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-12T10:41:59.843" Title="Joint Concavity of (Root) Fidelity" Tags="&lt;mathematics&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11979" PostTypeId="2" ParentId="11978" CreationDate="2020-05-12T10:41:59.843" Score="1" Body="&lt;p&gt;You can assign an arbitrary phase to the purifications. This way, you can make &lt;span class=&quot;math-container&quot;&gt;$\langle \phi^{\rho_x}\vert\phi^{\sigma_x}\rangle\ge0$&lt;/span&gt;, and thus you have equality in the 2nd inequality.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-05-12T10:41:59.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11980" PostTypeId="1" CreationDate="2020-05-12T12:54:39.627" Score="0" ViewCount="64" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.get_provider('ibm-q')&#xA;qcomp = provider.get_backend('ibmq-16-melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But the queue is endless.&#xA;I live in Southern Europe.&lt;/p&gt;&#xA;" OwnerUserId="12015" LastEditorUserId="5955" LastEditDate="2020-05-12T13:25:32.307" LastActivityDate="2020-05-12T13:25:32.307" Title="How can I find the most suitable IBMQ provider for my location?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-05-12T13:30:50.510" ContentLicense="CC BY-SA 4.0" />
  <row Id="11981" PostTypeId="1" AcceptedAnswerId="11992" CreationDate="2020-05-12T13:00:02.603" Score="1" ViewCount="124" Body="&lt;p&gt;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 &lt;code&gt;Number of shots specified: 1000001 exceeds max_shots property of the backend: 1000000.'&lt;/code&gt;. Can someone help me? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="7598" LastEditDate="2020-05-12T13:22:12.297" LastActivityDate="2020-05-13T09:28:39.863" Title="How do I change the number of max_shots of Aer qasm_simulator in Qiskit running on my computer?" Tags="&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11982" PostTypeId="2" ParentId="11980" CreationDate="2020-05-12T13:10:30.107" Score="2" Body="&lt;p&gt;All the machines are in New York so it does not matter which one you pick. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-05-12T13:10:30.107" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11983" PostTypeId="2" ParentId="11981" CreationDate="2020-05-12T13:19:53.430" Score="1" Body="&lt;p&gt;This limit is set in the configuration of the device. There is no way to edit this property as far as I know.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-05-12T13:19:53.430" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11984" PostTypeId="2" ParentId="11981" CreationDate="2020-05-12T13:24:05.047" Score="2" Body="&lt;p&gt;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 &lt;code&gt;execute([qc, qc], shots=100)&lt;/code&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-12T13:24:05.047" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11985" PostTypeId="1" AcceptedAnswerId="11986" CreationDate="2020-05-12T13:47:50.477" Score="1" ViewCount="81" Body="&lt;p&gt;If it is possible give me an intuition both with vectors on the plane and on the Bloch-Sphere.&lt;/p&gt;&#xA;" OwnerUserId="12015" LastEditorUserId="9459" LastEditDate="2020-05-12T14:53:43.617" LastActivityDate="2020-05-12T15:14:37.017" Title="What is the intuition of the outer product of two states?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;state-space-geometry&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11986" PostTypeId="2" ParentId="11985" CreationDate="2020-05-12T14:14:27.890" Score="2" Body="&lt;p&gt;The outer product of two states is a matrix. Here are some often used outer products:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|0\rangle \langle 0 | =&#xA;\begin{pmatrix} 1&amp;amp;0\\0&amp;amp;0 \end{pmatrix}&#xA;\qquad&#xA;|0\rangle \langle 1 | =&#xA;\begin{pmatrix} 0&amp;amp;1\\0&amp;amp;0 \end{pmatrix}&#xA;\\&#xA;|1\rangle \langle 0 | =&#xA;\begin{pmatrix} 0&amp;amp;0\\1&amp;amp;0 \end{pmatrix}&#xA;\qquad&#xA;|1\rangle \langle 1 | =&#xA;\begin{pmatrix} 0&amp;amp;0\\0&amp;amp;1 \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For any &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; matrix we can write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;M = \begin{pmatrix} a&amp;amp;b\\c&amp;amp;d \end{pmatrix} = &#xA;a|0\rangle \langle 0 | + b|0\rangle \langle 1 | +c |1\rangle \langle 0 | +d|1\rangle \langle 1 |&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to calculate the outer product of two vectors:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|v\rangle \langle w | =&#xA;\begin{pmatrix} v_1\\v_2 \end{pmatrix}&#xA;\begin{pmatrix} w_1^{\dagger}&amp;amp;w_2^{\dagger}\end{pmatrix} =&#xA;\begin{pmatrix} v_1 w_1^{\dagger} &amp;amp; v_1 w_2^{\dagger} \\&#xA;v_2 w_1^{\dagger} &amp;amp; v_2 w_2^{\dagger}\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The outer product of a state from the Bloch sphere &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; with itself:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle \langle \psi | = &#xA;\begin{pmatrix} |\alpha|^2 &amp;amp; \alpha \beta^{\dagger} \\&#xA;\beta \alpha^{\dagger} &amp;amp; |\beta|^2 \end{pmatrix} = \rho&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is equal to the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; that also describes the state of the system like the wavefunction &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and has correspondence with the same point on the Bloch sphere as the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another useful thing to know about the outer products of two states. Assume we have orthonormal eigenbasis &lt;span class=&quot;math-container&quot;&gt;$|v_s \rangle$&lt;/span&gt; and we have this matrix &lt;span class=&quot;math-container&quot;&gt;$| w \rangle \langle v_1 |$&lt;/span&gt; (that is not a unitary matrix and &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; is some normalized state). What will be after the multiplication of this matrix with a geneal &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \sum_s \alpha_s |v_s\rangle$&lt;/span&gt; state vector:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| w \rangle \langle v_1 | \sum_s \alpha_s |v_s\rangle = \alpha_1 | w \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This kind of outer products are often used in QC. For example, for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator we can write:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X = | 0\rangle \langle 1| + | 1\rangle \langle 0|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-12T15:14:37.017" LastActivityDate="2020-05-12T15:14:37.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11987" PostTypeId="1" AcceptedAnswerId="11988" CreationDate="2020-05-12T15:19:17.740" Score="3" ViewCount="76" Body="&lt;p&gt;I have a state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and I want to get the expected result when measuring observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (i.e. get the result of &lt;span class=&quot;math-container&quot;&gt;$\langle x| A | x \rangle$&lt;/span&gt;). In my case &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be any of the Pauli gates. Does anyone know how to do this in &lt;code&gt;Q#&lt;/code&gt;? There doesn't seem to be an inner product function in the libraries.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="11979" LastEditorUserId="9459" LastEditDate="2020-05-12T15:27:16.877" LastActivityDate="2020-05-16T13:51:22.817" Title="Inner product of states in Q#" Tags="&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11988" PostTypeId="2" ParentId="11987" CreationDate="2020-05-12T17:39:49.457" Score="2" Body="&lt;p&gt;It sounds like you're really asking about how to &lt;em&gt;measure&lt;/em&gt; 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.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Q# has a &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.measure&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measure operation&lt;/a&gt; which performs a measurement in a given Pauli basis. For example, if you have a &lt;code&gt;Qubit&lt;/code&gt; object &lt;code&gt;q&lt;/code&gt; in some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and you want to measure it in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis, you can write:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   let result = Measure([PauliX], [q]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here &lt;code&gt;result&lt;/code&gt; will be either &lt;code&gt;Zero&lt;/code&gt; or &lt;code&gt;One&lt;/code&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;) many times and take an average of the measurement results.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="10473" LastEditDate="2020-05-16T13:51:22.817" LastActivityDate="2020-05-16T13:51:22.817" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="11990" PostTypeId="1" AcceptedAnswerId="11991" CreationDate="2020-05-12T18:54:39.170" Score="2" ViewCount="38" Body="&lt;p&gt;First I would like to find the matrix corresponding to the transformation and then implement it with rotational gates. How can I do it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GUgX6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GUgX6.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8377" LastActivityDate="2020-05-12T19:29:31.460" Title="How do I find the matrix and circuit equivalent to this transformation?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11991" PostTypeId="2" ParentId="11990" CreationDate="2020-05-12T19:06:50.310" Score="2" Body="&lt;p&gt;The matrix for &lt;span class=&quot;math-container&quot;&gt;$\sigma_z \otimes \sigma_z$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_z \otimes \sigma_z = &#xA;\begin{pmatrix}  &#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;-1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;-1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The matrix for &lt;span class=&quot;math-container&quot;&gt;$e^{-i\sigma_z \otimes \sigma_z t}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is some parameter:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{-i\sigma_z \otimes \sigma_z t} = &#xA;\begin{pmatrix}  &#xA;e^{-i t}&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;e^{i t}&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;e^{i t}&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{-i t} &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The circuit for this operator (like described in this &lt;a href=&quot;https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/sBSmQ.png&quot; width=&quot;200&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;'s argument is &lt;span class=&quot;math-container&quot;&gt;$2t$&lt;/span&gt;. An explicit explanation about why this circuit implements the operator mentioned above can be found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;here&lt;/a&gt;. Or can be seen after doing matrix multiplication for the gates presented in the circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT} \cdot I \otimes R_z(2t) \cdot \text{CNOT} = \\ =&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&#xA;\end{pmatrix}&#xA;\begin{pmatrix}  &#xA;e^{-i t}&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;e^{i t}&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;e^{-i t}&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{i t}&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&#xA;\end{pmatrix} &#xA;= e^{-i\sigma_z \otimes \sigma_z t}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-12T19:29:31.460" LastActivityDate="2020-05-12T19:29:31.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11992" PostTypeId="2" ParentId="11981" CreationDate="2020-05-12T19:25:38.320" Score="3" Body="&lt;p&gt;&lt;code&gt;backend._configuration.max_shots= ...&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Will do what you want. &lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="5955" LastEditDate="2020-05-13T09:28:39.863" LastActivityDate="2020-05-13T09:28:39.863" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11993" PostTypeId="1" CreationDate="2020-05-12T21:51:14.440" Score="0" ViewCount="361" Body="&lt;p&gt;Consider a &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; containing up to two non-zero elements, which are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (so, either &lt;span class=&quot;math-container&quot;&gt;$M_{ii}=1$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$M_{ij}=M_{ji} = 1$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;). Each such matrix can be expressed a linear combination of Pauli operators. For example:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;=&#xA;\frac{1}{2} (XX+YY)&#xA;\ ,\quad&#xA;\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;=&#xA;\frac{1}{4} (1 - Z_1 + Z_2 -Z_1 Z_2)&#xA;\ .&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would  be the general expression for such an expansion, for an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i,j=1\ldots2^n$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CLARIFICATION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(4^n)$&lt;/span&gt; operations, since this is the total number of Paulis on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The motivation for my question, of course, comes from expanding an arbitrary Hermitian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in terms of Pauli operators. The number of parameters in such a matrix is &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; from my question in &lt;span class=&quot;math-container&quot;&gt;$O(\operatorname{poly}(n)) $&lt;/span&gt; steps. This would allow to expand &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$O(4^n)$&lt;/span&gt; steps, via expressing it in terms of Paulis entry by entry. &lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-05-13T13:40:12.280" LastActivityDate="2020-05-13T13:40:12.280" Title="Expressing a term of an $n$-qubit Hamiltonian in terms of Pauli operators" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11994" PostTypeId="1" AcceptedAnswerId="11999" CreationDate="2020-05-12T22:11:51.553" Score="0" ViewCount="90" Body="&lt;p&gt;CHSH inequality is defined in the following way. Let &lt;span class=&quot;math-container&quot;&gt;$Q, R, S, T$&lt;/span&gt; be two outcomes &lt;span class=&quot;math-container&quot;&gt;$\{\pm 1\}$&lt;/span&gt; measurements. The measurements are chosen in a certain way, but that is not our concern right now. We know that a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; would not admit to any hidden variable representation if it violates the following inequality:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi| (\langle QS \rangle + \langle RS \rangle + \langle RT \rangle - \langle QT \rangle)|\psi\rangle \le 2,&#xA;$$&lt;/span&gt;&#xA;where, &lt;span class=&quot;math-container&quot;&gt;$\langle . \rangle$&lt;/span&gt; is defined as the expected value of those operators with respect to &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;. My question is, why do we have a negative sign for &lt;span class=&quot;math-container&quot;&gt;$\langle QT \rangle$&lt;/span&gt;? Could we not have any other constant on the right and have all positive terms on the left? Why does it work?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-05-13T14:48:05.990" LastActivityDate="2020-05-13T14:48:05.990" Title="Why is the CHSH inequality defined with a minus sign?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11995" PostTypeId="1" AcceptedAnswerId="11997" CreationDate="2020-05-12T23:50:28.767" Score="3" ViewCount="313" Body="&lt;p&gt;The CNOT gate together with phase shift gates for all possible angles are not universal for quantum computing. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are they also not universal for classical (reversible) computing?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is it possible to characterize the set of classical Boolean functions that can be obtained using this set of gates?&lt;/p&gt;&#xA;" OwnerUserId="12038" LastActivityDate="2020-05-13T07:35:00.390" Title="Classical computations from restricted quantum gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="11996" PostTypeId="2" ParentId="8930" CreationDate="2020-05-13T00:02:06.873" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\{|u_a\rangle\}_{a\in A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|v_e\rangle\}_{e\in E}$&lt;/span&gt; be orthonormal bases for the space &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and the environment space &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; resp. Now, if we express &lt;span class=&quot;math-container&quot;&gt;$\rho_A=\sum_A \alpha_a |u_a\rangle \langle u_a|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_E=|v_0\rangle \langle v_0|$&lt;/span&gt; assuming that &lt;span class=&quot;math-container&quot;&gt;$\rho_E$&lt;/span&gt; is some pure state on the environment. Then we can write&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{E}(\rho_A)=tr_E\left(U\left(\rho_A\otimes \rho_E\right)U^*\right)\\ &#xA;= \sum_{A}\alpha_a\,&#xA;tr_E\left(\left(U|u_a\rangle |v_0\rangle\right)\left(U|u_a\rangle |v_0\rangle\right)^*\right)\\&#xA;= \sum_{A}\alpha_a\,&#xA;\sum_E\langle v_e|U|v_0\rangle |u_a\rangle \langle u_a|\langle v_0|U^*|v_e\rangle\\&#xA;=\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\\&#xA;=\sum_E\langle v_e|U|v_0\rangle \rho_A\left(\langle v_e|U|v_0\rangle\right)^*,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;taking &lt;span class=&quot;math-container&quot;&gt;$E_e=\langle v_e|U|v_0\rangle$&lt;/span&gt; be obtain the Kraus operators which act on the space &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-05-13T15:25:24.307" LastActivityDate="2020-05-13T15:25:24.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11997" PostTypeId="2" ParentId="11995" CreationDate="2020-05-13T05:05:00.257" Score="3" Body="&lt;p&gt;Firstly, let us assume that we are restricted to measurements in the computational basis, i.e. outcomes of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, in answer to the first question, a quick bit of googling &lt;a href=&quot;https://www.wikiwand.com/en/Toffoli_gate#/Universality_and_Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;reveals&lt;/a&gt; the answer is no, since the CNOT gate is not universal for classical computation, reversible or otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://scicomp.stackexchange.com/&quot;&gt;CompSci stack exchange&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="391" LastActivityDate="2020-05-13T05:05:00.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="11998" PostTypeId="2" ParentId="11995" CreationDate="2020-05-13T07:35:00.390" Score="4" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;CNOT is only another name for XOR operation which is not universal. In classical computation, universal sets of gates are for example:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\{\text{NAND}\}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\{\text{NOR}\}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\{\text{AND},\text{OR},\text{NOT}\}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-13T07:35:00.390" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="11999" PostTypeId="2" ParentId="11994" CreationDate="2020-05-13T07:35:20.787" Score="2" Body="&lt;p&gt;Imagine you had a general formula&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C=a_1QS+a_2RS+a_3RT+a_4QT.&#xA;$$&lt;/span&gt;&#xA;Algebraically, we know that if &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; are random variables with values &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, then each term such as &lt;span class=&quot;math-container&quot;&gt;$QS\in\{\pm 1\}$&lt;/span&gt;. Hence, there is a trivial bound&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C\leq |a_1|+|a_2|+|a_3|+|a_4| =C_\max.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$C=C_\max$&lt;/span&gt; for a particular set of &lt;span class=&quot;math-container&quot;&gt;$\{a_i\}$&lt;/span&gt;, then that set of &lt;span class=&quot;math-container&quot;&gt;$\{a_i\}$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, if all the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; are positive, then the choices &lt;span class=&quot;math-container&quot;&gt;$Q=R=S=T=1$&lt;/span&gt; saturate the bound. You can also check all cases where an even number of the &lt;span class=&quot;math-container&quot;&gt;$\{a_i\}$&lt;/span&gt; are negative - you can always find a deterministic assignment to the random variables that saturates the &lt;span class=&quot;math-container&quot;&gt;$C_\max$&lt;/span&gt; bound. So, for it to be interesting, we need an odd number of negative signs in the coefficients.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To give a vague illustration: let &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt; be positive, and &lt;span class=&quot;math-container&quot;&gt;$a_4$&lt;/span&gt; be negative. &lt;span class=&quot;math-container&quot;&gt;$C_\max=a_1+a_2+a_3-a_4$&lt;/span&gt;. One choice of LHV is every variable being 1, so we can achieve the value &lt;span class=&quot;math-container&quot;&gt;$a_1+a_2+a_3+a_4$&lt;/span&gt;, making the gap between the two &lt;span class=&quot;math-container&quot;&gt;$2|a_4|$&lt;/span&gt;. So you'd think to make &lt;span class=&quot;math-container&quot;&gt;$|a_4|$&lt;/span&gt; as large as possible. However, another choice is to set &lt;span class=&quot;math-container&quot;&gt;$T=-1$&lt;/span&gt;, in which case your LHV can achieve &lt;span class=&quot;math-container&quot;&gt;$a_1+a_2-a_3-a_4$&lt;/span&gt;, yielding a gap of &lt;span class=&quot;math-container&quot;&gt;$2|a_3|$&lt;/span&gt;. Which is bigger? Obviously whichever term is larger. The best balance is to set &lt;span class=&quot;math-container&quot;&gt;$|a_3|=|a_4|$&lt;/span&gt;. Repeat for other possibilities.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-13T07:35:20.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12000" PostTypeId="2" ParentId="11993" CreationDate="2020-05-13T07:40:32.087" Score="3" Body="&lt;p&gt;There's a generalisation that one can make. Let &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1,2,3\}^n$&lt;/span&gt; be a string of values. We can define an operator &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; to mean &quot;do identity on any qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x_i=0$&lt;/span&gt;, do &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on any qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x_i=1,\ldots$&lt;/span&gt;&quot;. Then, because the Pauli matrices form a basis, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{x\in\{0,1,2,3\}^n}\alpha_x\sigma_x.&#xA;$$&lt;/span&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian (as it should be for a Hamiltonian) then &lt;span class=&quot;math-container&quot;&gt;$\alpha_x$&lt;/span&gt; is real. If you have &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in matrix form then you can find the &lt;span class=&quot;math-container&quot;&gt;$\alpha_x$&lt;/span&gt; via the computation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha_y=\frac{1}{2^n}\text{Tr}(H\sigma_y).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-13T07:40:32.087" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12001" PostTypeId="1" AcceptedAnswerId="12002" CreationDate="2020-05-13T10:23:12.693" Score="1" ViewCount="164" Body="&lt;p&gt;Consider very simple Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = Z = \begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{pmatrix}$&lt;/span&gt;. It has eigenvalues 1 and -1 with coresponding eigenstates &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, respectively. Hence, a ground state is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Hamiltonian simulation we need to construct a gate &lt;span class=&quot;math-container&quot;&gt;$U(t) = \mathrm{e}^{-i\mathcal{H} t}$&lt;/span&gt;. For our &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;, this gate is &lt;span class=&quot;math-container&quot;&gt;$U(t) = Rz(-2t)$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To simulate the Hamiltonian we apply gate &lt;span class=&quot;math-container&quot;&gt;$U(\Delta t)$&lt;/span&gt; several times to get from state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|\psi_t\rangle$&lt;/span&gt; where number of steps (or application of the Hamiltonian) is &lt;span class=&quot;math-container&quot;&gt;$t/\Delta t$&lt;/span&gt;. This is called Trotter method.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since our gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotation which is additive, i.e. &lt;span class=&quot;math-container&quot;&gt;$Rz(\alpha)Rz(\beta) = Rz(\alpha+\beta)$&lt;/span&gt;, we do not have to bother about steps &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt; and simply apply &lt;span class=&quot;math-container&quot;&gt;$Rz(-2t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to apply &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gate on some states generated by Hadamard gate and &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gate with different angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So my question is how to build a circuit for finding the ground state of the Hamiltonian?&lt;/strong&gt; I would appreciate if you could provide a circuit for finding ground state of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=Z$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-13T13:08:20.623" Title="How to build a circuit for simulation of a simple Hamiltonian?" Tags="&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12002" PostTypeId="2" ParentId="12001" CreationDate="2020-05-13T12:25:38.007" Score="3" Body="&lt;p&gt;If two operators &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; commute then we can always write &lt;span class=&quot;math-container&quot;&gt;$e^{i(A+B)t} = e^{iAt}e^{iBt}$&lt;/span&gt;, so we don't need to worry about the Trotterization. Otherwise if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; don't commute, then &lt;span class=&quot;math-container&quot;&gt;$e^{i(A+B)t} \ne e^{iAt}e^{iBt}$&lt;/span&gt; and that's why we will need to apply the Trotterization procedure. Both (in)equalities can be proved with the Taylor series. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Now about how to obtain the ground state of the &lt;span class=&quot;math-container&quot;&gt;$H=Z$&lt;/span&gt; Hamiltonian.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we will apply &lt;span class=&quot;math-container&quot;&gt;$e^{iHt} = R_z(-2t)$&lt;/span&gt; to an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; we will obtain only some relative phase (desregarding the global phase):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_z(-2t) |\psi\rangle = \alpha |0\rangle + e^{-it}\beta |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, by just applying the &lt;span class=&quot;math-container&quot;&gt;$R_z(-2t)$&lt;/span&gt; on some fixed state we will not succeed. One way for obtaining the ground state of the Hamiltonian is using the &lt;strong&gt;VQE algorithm&lt;/strong&gt;. Here is the circuit that we will need:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/ERVTP.png&quot; width=&quot;300&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With this circuit, one has a possibility to obtain all one-qubit states in the Bloch sphere, if the initial state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. For each given &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_2$&lt;/span&gt;, the circuit will run &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times and we will measure the expectation value of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle = \langle Z \rangle = \frac{N_0 - N_1}{N}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$N_0$&lt;/span&gt; is the number of measured &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$N_1$&lt;/span&gt; is the number of measured &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s. With some optimization method we will change &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;s in order to minimize &lt;span class=&quot;math-container&quot;&gt;$\langle Z \rangle$&lt;/span&gt;. After the optimization is over (we have found the state for which  &lt;span class=&quot;math-container&quot;&gt;$\langle Z \rangle$&lt;/span&gt; is minimal: in this case &lt;span class=&quot;math-container&quot;&gt;$\langle Z \rangle = -1$&lt;/span&gt; is the minimal value), the circuit with the final &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;s can recreate the ground state of the Hamiltonian (the &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; state, because &lt;span class=&quot;math-container&quot;&gt;$\langle 1| Z |1 \rangle = -1$&lt;/span&gt;). Note, that I haven't used the circuit for the Hamiltonian simulation &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope and I am interested to see an answer that will use &lt;strong&gt;Adiabatic state preparation algorithm&lt;/strong&gt; for the same job.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-13T13:08:20.623" LastActivityDate="2020-05-13T13:08:20.623" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12003" PostTypeId="2" ParentId="11525" CreationDate="2020-05-13T13:22:43.353" Score="2" Body="&lt;p&gt;The way that I think about this is to take a decomposition in Paulis,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_z=(I+zZ\otimes Z-zX\otimes X-zY\otimes Y)/4.&#xA;$$&lt;/span&gt;&#xA;I can group these as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;((1-3z)I+z(I+Z\otimes Z)+z(I-X\otimes X)+z(I-Y\otimes Y))/4.&#xA;$$&lt;/span&gt;&#xA;Each of the 4 terms is diagonal in a separable basis, and positive semi-definite (provided &lt;span class=&quot;math-container&quot;&gt;$z\leq 1/3$&lt;/span&gt;). This directly implies a separable decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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_+|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-13T13:22:43.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12004" PostTypeId="1" AcceptedAnswerId="12008" CreationDate="2020-05-13T13:38:59.333" Score="3" ViewCount="279" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ybYMT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ybYMT.png&quot; alt=&quot;shown below, the four possible bell states from the Bell measurement&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any help appreciated, preferably in the form of an analogy!&lt;/p&gt;&#xA;" OwnerUserId="12044" LastEditorUserId="23" LastEditDate="2020-07-26T18:06:31.010" LastActivityDate="2020-07-26T18:06:31.010" Title="What does the minus sign in the four bell states represent?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;mathematics&gt;&lt;bell-basis&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12006" PostTypeId="2" ParentId="12004" CreationDate="2020-05-13T14:15:26.050" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you have a two qubit system, for which both qubits are in indepent superpostion, i.e &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle = |q_2\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle$&lt;/span&gt;, so both qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; at the same time! Then the combined state of the system you get a state of all four combinations of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; for both qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\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)$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now if we say that &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q_2\rangle$&lt;/span&gt;, are correlated, that means that if &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; is in a state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; we can start off by determining that there are only two possible combinations of correlation; either &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; are in the same state so &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, or that &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; are in opposite states &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; when you put this qubit into superposition(via a &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate) &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, however if you put &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; into superposition  you get &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;, notice the minus sign. So the Bell States with the minus sign appear when you start with &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; in opposite states, one is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the other in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; start in the same state! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-13T14:47:10.627" LastActivityDate="2020-05-13T14:47:10.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12007" PostTypeId="2" ParentId="12004" CreationDate="2020-05-13T14:43:09.117" Score="5" Body="&lt;p&gt;If we measure states &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; in computational basis, both look identical: if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;; if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, if we measure states &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; in computational basis, both look identical: if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;; if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But let us change to Hadamard basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt{2}}\\&#xA;|-\rangle=\frac{|0\rangle-|1\rangle}{\sqrt{2}}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The inverse transformation is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|0\rangle=\frac{|+\rangle+|-\rangle}{\sqrt{2}}\\&#xA;|1\rangle=\frac{|+\rangle-|-\rangle}{\sqrt{2}}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\Psi^-\rangle&amp;amp;=\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)\\&#xA;&amp;amp;=\frac{1}{\sqrt{2}}\left(-|+\rangle|-\rangle+|-\rangle|+\rangle \right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\Psi^+\rangle&amp;amp;=\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)\\&#xA;&amp;amp;=\frac{1}{\sqrt{2}}\left(|+\rangle|+\rangle-|-\rangle|-\rangle \right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can see that in Hadamard basis &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; states behave differently:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt; state, if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;; if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; state, if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;; if one qubit is measured &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, the other is measured &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;You can check that &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; states also behave differently in Hadamard basis.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-05-13T19:28:25.480" LastActivityDate="2020-05-13T19:28:25.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12008" PostTypeId="2" ParentId="12004" CreationDate="2020-05-13T14:53:06.090" Score="1" Body="&lt;p&gt;Quantum states are defined by more than the outcome probabilities in a fixed measurement setting.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you noticed, &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-13T14:53:06.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12009" PostTypeId="1" CreationDate="2020-05-13T15:15:02.843" Score="3" ViewCount="182" Body="&lt;p&gt;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 &amp;quot;paint&amp;quot;ings):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hskip2.0in$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/A1xGT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/A1xGT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So there is an entangled state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. It is entangled because it is not inside the set of separable states. My question is inspired by the picture:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is there a separable state that is furthest away from the entangled one?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I tried to indicate it in red, but can we calculate the separable state?&lt;/p&gt;&#xA;&lt;p&gt;To be concrete: What is the separable state furthest away from a GHZ state:&lt;span class=&quot;math-container&quot;&gt;$(|00\cdots 0\rangle+|11\cdots 1\rangle)/\sqrt2$&lt;/span&gt;...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-22T13:21:16.450" Title="Is there a separable state that is furthest away from an entangled one?" Tags="&lt;entanglement&gt;" AnswerCount="4" CommentCount="10" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12010" PostTypeId="2" ParentId="5972" CreationDate="2020-05-13T18:27:11.927" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I suggest you have a look at the qiskit book, which has a &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#2.-The-HHL-algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;simple tutorial&lt;/a&gt; that I found super useful. They literally say that you don't have to compute the eigenvalues. This is because a matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; that is &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; can have up to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; distinct eigenvalues and therefore computing them will take at least &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; time, which means the exponential advantage is lost.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="11551" LastActivityDate="2020-05-13T18:27:11.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12012" PostTypeId="1" CreationDate="2020-05-13T19:42:53.913" Score="1" ViewCount="71" Body="&lt;p&gt;In &lt;a href=&quot;https://www.researchgate.net/publication/323356026_Quantum_linear_systems_algorithms_a_primer&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, there is a diagram explaining how HHL works, which I attached below:&lt;a href=&quot;https://i.stack.imgur.com/88kfg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/88kfg.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is, for the rotation part, how do you write &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; as a combination of universal set of gates without knowing the eigenvalues a priori? Or what is a generic way of writing &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; without doing any classical pre-computation regarding the eigenvalues? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$\theta_i = arccos(\frac{C}{\lambda_i})$&lt;/span&gt;. After that, one can append for the ancilla register multiple &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates with the aforementioned angles of rotation as arguments.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help!&lt;/p&gt;&#xA;" OwnerUserId="11979" LastEditorUserId="55" LastEditDate="2020-05-14T06:29:46.150" LastActivityDate="2020-05-14T20:41:45.183" Title="In the rotation part of HHL algorithm, how do you decompose $R$ in terms of universal gates?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12013" PostTypeId="2" ParentId="12009" CreationDate="2020-05-13T21:00:34.523" Score="4" Body="&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In particular, there &lt;em&gt;is&lt;/em&gt; always a furthest state as measured by the trace norm distance.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-05-13T21:00:34.523" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12014" PostTypeId="1" AcceptedAnswerId="12015" CreationDate="2020-05-13T22:13:10.513" Score="3" ViewCount="38" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ ||\rho_A - \rho_{A^\prime}||\leq \epsilon$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$ ||\rho_B - \rho_{B^\prime}||\leq \epsilon,$$&lt;/span&gt;&#xA;can we claim that  &lt;span class=&quot;math-container&quot;&gt;$$ ||\rho_{AB} - \rho_{A^\prime B^\prime}||\leq \delta(\epsilon)$$&lt;/span&gt;?&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-05-13T23:12:29.477" LastActivityDate="2020-05-14T08:51:18.683" Title="Does the trace distance between marginals bound the distance between the overall states?" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12015" PostTypeId="2" ParentId="12014" CreationDate="2020-05-13T23:10:33.590" Score="4" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-05-14T08:51:18.683" LastActivityDate="2020-05-14T08:51:18.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12016" PostTypeId="1" AcceptedAnswerId="12072" CreationDate="2020-05-14T01:47:51.690" Score="2" ViewCount="136" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&#xA;Assume there is an entangled pair &lt;span class=&quot;math-container&quot;&gt;$(q_1, q_2)$&lt;/span&gt; owned by Alice and Bob, respectively, and some qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; that Alice wants to teleport. Let Alice perform all the necessary operations to teleport &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, namely, &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}(q_0, q_1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H(q_0)$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; should equal &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is keeping Bob from assuming that &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; is in some particular bell state, and measuring &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;? It would seem that would allow faster than light communication 25% of the time. In fact, Bob could even produce imperfect clones of &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What prevents this from working?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to Holevo's Theorem, one can only retrieve up to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical bits given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. However, as I understand it, this does not prevent one from storing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical bits into a single qubit, imperfectly cloning it &lt;span class=&quot;math-container&quot;&gt;$n - 1$&lt;/span&gt; times, and thus retrieving &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In regards to the user not knowing whether the information is correct and thus it being no use, consider the classical case of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; one-way radios. Only 25% of the radios send the correct message, on channel &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="11742" LastEditorUserId="11742" LastEditDate="2020-05-14T14:40:11.707" LastActivityDate="2020-05-19T02:25:05.803" Title="Why can’t I use quantum teleportation to transmit data FTL 1/4 of the time?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12018" PostTypeId="2" ParentId="12016" CreationDate="2020-05-14T02:51:27.833" Score="5" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;better&lt;/em&gt; than the noise floor to transmit information.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-05-14T02:58:05.797" LastActivityDate="2020-05-14T02:58:05.797" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12019" PostTypeId="2" ParentId="12012" CreationDate="2020-05-14T05:17:10.833" Score="1" Body="&lt;p&gt;I think you are misunderstanding what HHL is doing here. Let's recall the problem definition earlier in §3.1:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;We are given a system of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; linear equations with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; unknowns which can be expressed as &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a vector of unknowns, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the matrix of coeﬃcients and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is the vector of solutions. If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an invertible matrix, then we can write that the solution is given by &lt;span class=&quot;math-container&quot;&gt;$x=A^{−1}b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;From this we can see that it is in fact &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, that is the unknown to be found. So, since you know what &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is, you do in fact know the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; beforehand. In fact, since &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; must be known to implement &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you must even know them in steps a) and c) also! Hence what you describe as &quot;pre-computation&quot; is actually a necessary step, encoding the problem statement into the gates in the algorithm :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://quantumcomputing.stackexchange.com/q/2604/1386&quot;&gt;post&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="391" LastEditorUserId="391" LastEditDate="2020-05-14T20:41:45.183" LastActivityDate="2020-05-14T20:41:45.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12020" PostTypeId="2" ParentId="12009" CreationDate="2020-05-14T09:26:01.947" Score="4" Body="&lt;p&gt;Here's an example based on entanglement witnesses. Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle).&#xA;$$&lt;/span&gt;&#xA;The aim is to define an operator &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W\rho_\text{sep})\geq 0$&lt;/span&gt; for all separable states &lt;span class=&quot;math-container&quot;&gt;$\rho_\text{sep}$&lt;/span&gt;. That means for any &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W\rho)&amp;lt;0$&lt;/span&gt;, it must be entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;An easy way to define such an operator is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W=\alpha I-|\psi\rangle\langle\psi|,&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha=\max_{\rho_\text{sep}}\langle\psi|\rho_\text{sep}|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;In this particular case, the maximisation is achieved with &lt;span class=&quot;math-container&quot;&gt;$\rho_\text{sep}=|0\rangle\langle 0|^{\otimes 3}$&lt;/span&gt;, I believe, so &lt;span class=&quot;math-container&quot;&gt;$\alpha=\frac12$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W|\psi\rangle\langle\psi|)=\alpha-1=-\frac12$&lt;/span&gt;, so we see that it's entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider any other state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. We can think of the value &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W\rho)$&lt;/span&gt; as measuring distance. The smallest possible value is &lt;span class=&quot;math-container&quot;&gt;$-\frac12$&lt;/span&gt;, and if you have that, you've got the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. The larger the value, there is a sense of getting further away from &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Now, the maximum value of &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W\rho)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\alpha=\frac12$&lt;/span&gt;, which is achieved by &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\rho|\psi\rangle=0$&lt;/span&gt;. So this categorises the states that are furthest away &lt;em&gt;according to this specific measure&lt;/em&gt;. There are separable states which are orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, such as &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;, and so they can be considered the furthest separable states.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-14T09:26:01.947" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12021" PostTypeId="1" CreationDate="2020-05-14T11:30:40.583" Score="1" ViewCount="51" Body="&lt;p&gt;The paper &lt;a href=&quot;https://arxiv.org/pdf/1906.11192.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Iterative Qubit Coupled Cluster approach with efficient screening of generators&lt;/a&gt; describes a new screening procedure for generators of the QCC ansatz. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does one get from defining the flip indices &lt;span class=&quot;math-container&quot;&gt;$F(\hat{T})$&lt;/span&gt; of a Pauli term &lt;span class=&quot;math-container&quot;&gt;$\hat{P}$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\hat{P}) = \{j: \hat{f} ∈\hat{P}\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to the partitioning of the second-quantised Hamiltonian as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{H}=\sum_{k}\hat{S}_{k},$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{S}_{k}=\sum_{j}\hat{C}_{j}\hat{P}_{j}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;groups the terms with the same flip indices? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\hat{P}_{i})=F(\hat{P}_{j}),\quad ∀(\hat{P}_{i},\hat{P}_{j})  ∈ \hat{S}_{k}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And how is it that Pauli words possessing the same flip indices introduce an equivalence relation on the set of Hamiltonian terms?&lt;/p&gt;&#xA;" OwnerUserId="9175" LastEditorUserId="55" LastEditDate="2020-05-29T07:40:09.450" LastActivityDate="2020-06-18T23:19:03.913" Title="Screening procedure in an iterative qubit coupled cluster (iQCC) ansatz" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;models&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12022" PostTypeId="1" CreationDate="2020-05-14T11:40:41.767" Score="0" ViewCount="73" Body="&lt;p&gt;I'm doing a simulation of the QAOA algorithm with noise via the QAOA class of Qiskit 0.19.&#xA;Here's (part of) my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;p=1&#xA;In_params=np.random.rand(2*p)*np.pi/2&#xA;optalg= SPSA(max_trials=1000)&#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;model_device= provider.get_backend('ibmq_16_melbourne')&#xA;device_prop = model_device.properties()&#xA;noisemodel= NoiseModel.from_backend(device_prop)&#xA;&#xA;quantum_instance=QuantumInstance(backend, shots=1024, noise_model=noisemodel)&#xA;qaoa = QAOA(qubitOp, optalg, p, initial_point=In_params, callback= mycallback)&#xA;qaoa.expectation=PauliExpectation()&#xA;result = qaoa.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'm using the default initial state, that is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes n}$&lt;/span&gt;, 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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="12017" LastEditorUserId="9800" LastEditDate="2020-05-14T17:43:29.253" LastActivityDate="2020-05-14T17:43:29.253" Title="QAOA with Qiskit: Is the initial state affected by the noise model?" Tags="&lt;qiskit&gt;&lt;noise&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12023" PostTypeId="1" AcceptedAnswerId="12024" CreationDate="2020-05-14T13:07:16.613" Score="3" ViewCount="45" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SjBx8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SjBx8.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/docs/guide/mult-entang/entanglement-and-bell-tests&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/guide/mult-entang/entanglement-and-bell-tests&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My understanding is that the &lt;span class=&quot;math-container&quot;&gt;$(|00 \rangle + |11 \rangle)/ \sqrt{2}$&lt;/span&gt; represents a superposition of two states, &lt;span class=&quot;math-container&quot;&gt;$|00 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11 \rangle$&lt;/span&gt;. And that &lt;span class=&quot;math-container&quot;&gt;$|00 \rangle$&lt;/span&gt; is a two qubit entangled state. If Alice measures one of the qubits to be a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, the other qubit must be a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; as well due to the entanglement. The same is true if Alice measures a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question comes from not understanding why &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; are present in the box. What are they measuring? Is &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; measuring one qubit while &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; is measuring the second qubit? Or is &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; measuring one qubit while &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; measures the same qubit. Same questions for box &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="12050" LastEditorUserId="9459" LastEditDate="2020-05-14T14:51:13.320" LastActivityDate="2020-05-15T17:00:29.740" Title="What are the two measurements per box being done in the Bell Tests in the IBM Quantum Experience &quot;Entanglement and Bell tests&quot; Section" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;superposition&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12024" PostTypeId="2" ParentId="12023" CreationDate="2020-05-14T15:55:22.040" Score="2" Body="&lt;p&gt;Both &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; measure the same qubit, while &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B'$&lt;/span&gt; are applied to the second qubit. Alice chooses (randomly) which of the two measurement settings (&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt;) she will choose for each run of the experiment, while Bob chooses between &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B'$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You mention the perfect correlation in the computational basis.&#xA;Note however that there's nothing &quot;quantum&quot; about correlation in a single basis. You can easily reproduce this in a &quot;classical&quot; theory.&#xA;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.&#xA;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. ;-)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need at least two measurement settings for both parties for a Bell inequality (that can be violated).&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2020-05-15T17:00:29.740" LastActivityDate="2020-05-15T17:00:29.740" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12025" PostTypeId="2" ParentId="10099" CreationDate="2020-05-14T18:31:10.427" Score="3" Body="&lt;p&gt;It’s straightforward to see that a random element &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; drawn from a design is, with very high probability, far away from any fixed unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, i.e. you can show that the distance between &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; (in operator norm or in the diamond norm of their channels) is on average very close to maximal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But what you’re asking about is if there exists at least one element in the design which is close to some fixed unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. Without knowing anything else about the structure of the design, you’re asking when do unitary &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-designs cover the unitary group (i.e. every &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt; is at most &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; away, in some norm, from some element of the design. Equivalently, putting &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-balls around each unitary, &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt; is contained in the union of the balls.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't address your question rigorously, but here's an argument for why the design order should be at least &lt;span class=&quot;math-container&quot;&gt;$t=O(d^2)$&lt;/span&gt;, in order for &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-designs to cover &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;. For an exact unitary &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-design &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, a lower bound on the cardinality is &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{E}| \geq d^{2t}/t!$&lt;/span&gt;. If the number of elements in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is some constant multiple of this lower bound, then we find that &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{E}|$&lt;/span&gt; becomes comparable to the volume of the unitary group (more precisely, the vol(&lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;)/vol(&lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-ball)) when &lt;span class=&quot;math-container&quot;&gt;$t\sim d^2$&lt;/span&gt;. But to rigorously show that for some &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, unitary &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-designs cover the unitary group will require more work.&lt;/p&gt;&#xA;" OwnerUserId="12057" LastEditorUserId="12057" LastEditDate="2020-05-14T19:03:55.133" LastActivityDate="2020-05-14T19:03:55.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12026" PostTypeId="1" AcceptedAnswerId="12028" CreationDate="2020-05-14T19:30:31.123" Score="1" ViewCount="53" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12044" LastEditorUserId="55" LastEditDate="2020-10-12T07:28:01.503" LastActivityDate="2020-10-12T07:28:01.503" Title="Why does the entangled pair need to be entangled to perform teleportation?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12027" PostTypeId="1" AcceptedAnswerId="12033" CreationDate="2020-05-14T19:49:19.580" Score="10" ViewCount="404" Body="&lt;p&gt;While trying to simplify a certain 2-qubit quantum circuit, I managed to get it down to this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/rLjY5.png&quot; width=&quot;500&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But by inspecting the corresponding two-qubit unitary directly, I can come up with the arguably simpler:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/cDEck.png&quot; width=&quot;380&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the rotation operator &quot;moved&quot; to the first qubit.&#xA;I am using the convention&#xA;&lt;span class=&quot;math-container&quot;&gt;$   &#xA;R_{\theta} := R_y(2\theta) =&#xA;    \begin{pmatrix}&#xA;        \cos\theta &amp;amp; -\sin\theta \\&#xA;        \sin\theta &amp;amp;  \cos\theta&#xA;    \end{pmatrix}&#xA;$&lt;/span&gt;.&#xA;The rotation &lt;span class=&quot;math-container&quot;&gt;$R_{\pi/4}$&lt;/span&gt; is thus &lt;span class=&quot;math-container&quot;&gt;$=XH$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I show that the two circuits are equivalent by &quot;elementary&quot; circuit identities, instead of just verifying that they amount to the same unitary? I tried many different simplifications without success.&lt;/p&gt;&#xA;" OwnerUserId="8247" LastEditorUserId="8247" LastEditDate="2020-05-14T23:05:25.660" LastActivityDate="2020-05-15T11:28:07.227" Title="Simplification of &quot;rotation swapping&quot; circuit" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12028" PostTypeId="2" ParentId="12026" CreationDate="2020-05-14T19:59:50.367" Score="6" Body="&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First Alice and Bob's parts of Bell pair are entangled. &lt;/li&gt;&#xA;&lt;li&gt;Then Alice's message qubit is entangled with Alice's part of Bell pair, so that information carried by it (the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; state) is distributed across the whole system. &lt;/li&gt;&#xA;&lt;li&gt;Measuring two qubits in Alice's possession &quot;squeezes&quot; the information out of them and into the last part of the system, Bob's qubit.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Without the initial entanglement, Alice's qubits don't have a way to share information with Bob's qubit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more mathematical terms, &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If Alice's and Bob's qubits are not entangled initially, the state of the system can be represented as tensor product &lt;span class=&quot;math-container&quot;&gt;$|\psi_A\rangle\otimes|\psi_B\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Adding message qubit corresponds to the state &lt;span class=&quot;math-container&quot;&gt;$|m_A\rangle \otimes |\psi_A\rangle\otimes|\psi_B\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Now, if you only perform gates on the first two qubits, you can always represent them as &lt;span class=&quot;math-container&quot;&gt;$G_A\otimes I_B$&lt;/span&gt;, and the state of Bob's qubit never changes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-14T19:59:50.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12029" PostTypeId="2" ParentId="9143" CreationDate="2020-05-15T04:57:27.810" Score="1" Body="&lt;p&gt;For more information on transpiling in Qiskit, see &lt;a href=&quot;https://stackoverflow.com/questions/61790974/qiskit-transpiler-for-quantum-circuits&quot;&gt;this StackOverflow post&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen &amp;amp; Chuang&lt;/a&gt; 4.5, and Appendix 3. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;decoherence&quot;, and the introduction of errors due to errors in the gates themselves. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;QMA-complete&quot; 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 &amp;amp; Chuang. You might also want to read up on &lt;a href=&quot;https://www.cs.umd.edu/~rrand/voqc_draft.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;verifiable optimizations using automated theorem provers&lt;/a&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;random_unitary()&lt;/code&gt; function in Qiskit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope this helps you understand transpilers somewhat better. &lt;/p&gt;&#xA;" OwnerUserId="12060" LastActivityDate="2020-05-15T04:57:27.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12030" PostTypeId="2" ParentId="8783" CreationDate="2020-05-15T07:16:23.843" Score="5" Body="&lt;p&gt;Following are a few insightful journals on quantum information, computation and algorithms. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantum-journal.org/&quot; rel=&quot;noreferrer&quot;&gt;Quantum Journal&lt;/a&gt; &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.rintonpress.com/journals/qic/index.html&quot; rel=&quot;noreferrer&quot;&gt;Quantum Information and Computation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.techscience.com/journal/jqc&quot; rel=&quot;noreferrer&quot;&gt;Journal of Quantum Computing&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-05-15T07:16:23.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12031" PostTypeId="2" ParentId="12027" CreationDate="2020-05-15T08:30:17.360" Score="5" Body="&lt;p&gt;I am going to assume some usual transformations such as the involution of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;em&gt;CNOT&lt;/em&gt;. Rewriting the two gates &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; with more standard gates, a possible derivation goes like this (details for equalities (1), (2) and (3) are given below):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wSNyq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wSNyq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I used in particular the identity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fGKD1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fGKD1.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;from which I also derived:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xc8Nc.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xc8Nc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also used:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KMw9L.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KMw9L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A very powerful tool for doing this kind of graphical proof is the ZX-Calculus (&lt;a href=&quot;https://arxiv.org/abs/0906.4725&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/0906.4725&lt;/a&gt;), which I actually used for reasoning on your problem here, before turning the answer in circuit form.&lt;/p&gt;&#xA;" OwnerUserId="7422" LastActivityDate="2020-05-15T08:30:17.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12032" PostTypeId="2" ParentId="12027" CreationDate="2020-05-15T08:49:22.117" Score="3" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$U_1 = U_2$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$U_1 U_2^{\dagger} = I$&lt;/span&gt;. So let's add to the first circuit the inverse/dagger of the second one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/yC6Ay.png&quot; width=&quot;600&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This whole thing should be an identity. Note that, for this, we should prove that whole circuit except last &lt;span class=&quot;math-container&quot;&gt;$R_y(-\theta) I$&lt;/span&gt; should be equal to &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)  I$&lt;/span&gt;. By remembering that the SWAP gate consists of 3 CNOT gates and &lt;span class=&quot;math-container&quot;&gt;$\text{SWAP} \cdot I R_y(\theta) \cdot\text{SWAP} = R_y(\theta)  I$&lt;/span&gt;, we will have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5q8i4.png&quot; width=&quot;600&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This should be equal to &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta) I$&lt;/span&gt;. This circuit is equal to &lt;span class=&quot;math-container&quot;&gt;$U \cdot R_y(\theta) I  \cdot U^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/5DVk1.png&quot; width=&quot;290&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we should try to prove that &lt;span class=&quot;math-container&quot;&gt;$U \cdot R_y(\theta) I \cdot  U^\dagger = R_y(\theta) I$&lt;/span&gt;. After simplifying the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; I have obtained this circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/wx9Kq.png&quot; width=&quot;220&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I took into account that &lt;span class=&quot;math-container&quot;&gt;$HXH = Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I \otimes H \cdot \text{CNOT} \cdot I \otimes H = CZ$&lt;/span&gt; (note that I have omitted the &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; sign in the previous expressions). If my calculations are right, then &lt;span class=&quot;math-container&quot;&gt;$U = \frac{1}{\sqrt{2}}(I \otimes I+iY \otimes X)$&lt;/span&gt;. So, by omitting again the &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; sign:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the circuits are equivalent.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-15T11:28:07.227" LastActivityDate="2020-05-15T11:28:07.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12033" PostTypeId="2" ParentId="12027" CreationDate="2020-05-15T08:59:49.250" Score="5" Body="&lt;p&gt;Why not make it even smaller?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ChH42.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ChH42.png&quot; alt=&quot;One two qubit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Initial state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5gcIC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5gcIC.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Change rotation basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T7u8A.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T7u8A.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Phase the parity on the top bit instead of the bottom bit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GzHSc.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GzHSc.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Apply XZ = iY to the adjacent CX CZ operations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rsy5p.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rsy5p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5ARuU.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ARuU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3KL1r.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3KL1r.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cancel the two X rotations and you're done.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-05-15T08:59:49.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12035" PostTypeId="1" CreationDate="2020-05-15T17:55:06.103" Score="1" ViewCount="124" Body="&lt;p&gt;I've been trying to learn about Shor's algorithm by writing out implementations of the circuit for modular exponentiation, &lt;span class=&quot;math-container&quot;&gt;${ a }^{ x }\; ({ mod }\; N)$&lt;/span&gt;, to find the period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; for small numbers such as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(N=15,\quad a=11)\quad \longrightarrow \quad r=2$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(N=35,\quad a=13)\quad \longrightarrow \quad r=4$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(N=21,\quad a=5)\quad \longrightarrow \quad r=6$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;${ a }^{ { 2 }^{ k } }\; ({ mod }\; N)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$0\;\le\;k \; &amp;lt;\; 2\; \lceil { \log _{ 2 }{ N }  }\rceil $&lt;/span&gt;, which pretty much immediately made the values of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; obvious before I'd even started building the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, take the least trivial case from the above, where &lt;span class=&quot;math-container&quot;&gt;$r=6$&lt;/span&gt;. I needed to calculate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${ 5 }^{ 0 }\; ({ mod }\; 21)=1$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${ 5 }^{ 1 }\; ({ mod }\; 21)=5$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${ 5 }^{ 2 }\; ({ mod }\; 21)=4$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${ 5 }^{ 4 }\; ({ mod }\; 21)=16$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${ 5 }^{ 8 }\; ({ mod }\; 21)=4$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${ 5 }^{ 16 }\; ({ mod }\; 21)=16$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Simply by inspection, I can already see what the value of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; must be, because the result is the same when &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; increases by six or twelve, but not after increasing by two or three.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I therefore have two questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is calculating these modular exponentials of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; to powers of two &lt;em&gt;required&lt;/em&gt; when building these circuits, or is there some way of not even having to do that?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If we do need to calculate these values, can we not find the period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; 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]&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT: As Mark S points out, the results of modular exponentiation have very little structure, and so although perhaps faster than &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt;, such an 'interval halving' method would not have logarithmic complexity, thus would be slower than Shor's algorithm for large enough &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12068" LastEditorUserId="12068" LastEditDate="2020-05-16T02:07:01.333" LastActivityDate="2020-05-16T02:07:01.333" Title="Building the period-finding circuit for Shor's Algorithm &amp; the classical complexity of finding the period" Tags="&lt;shors-algorithm&gt;&lt;modular-exponentiation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12036" PostTypeId="2" ParentId="12035" CreationDate="2020-05-15T21:02:16.877" Score="1" Body="&lt;p&gt;The fast &quot;modular exponentiation by repeated-squaring&quot; 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 &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, so that you can perform the QFT on &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle\vert f(x)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I also think you are being significantly misled by looking at such small numbers.  You'll need to prepare a state &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle\vert f(x)\rangle$&lt;/span&gt; somehow; here &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is evaluated with repeated-squaring, which is honestly pretty darned fast already, when &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; gets large.  It's not clear if a &quot;binary search&quot; is not already what the repeated-squaring is effectively doing.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-05-15T21:02:16.877" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12037" PostTypeId="2" ParentId="10290" CreationDate="2020-05-16T01:39:05.730" Score="0" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Remove any existing installation of .NET Core SDK or .NET Core Runtime.&lt;/li&gt;&#xA;&lt;li&gt;Install .NET Core 3.1 SDK (x64 or x86 to match your Windows installation) using the links here: &lt;a href=&quot;https://docs.microsoft.com/en-us/dotnet/core/install/sdk?pivots=os-windows&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/dotnet/core/install/sdk?pivots=os-windows&lt;/a&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In PowerShell, you can run &lt;code&gt;[System.Environment]::Is64BitOperatingSystem&lt;/code&gt; to see whether you are running 64-bit Windows. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&lt;/li&gt;&#xA;&lt;li&gt;Open a new command prompt and reinstall the latest version of IQSharp by running:&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dotnet tool uninstall -g Microsoft.Quantum.IQSharp&#xA;dotnet tool install -g Microsoft.Quantum.IQSharp&#xA;dotnet iqsharp install&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="10473" LastEditDate="2020-05-16T01:51:54.517" LastActivityDate="2020-05-16T01:51:54.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12038" PostTypeId="1" AcceptedAnswerId="12193" CreationDate="2020-05-16T02:01:33.543" Score="2" ViewCount="188" Body="&lt;p&gt;I first encounted this idea in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0402202&quot; rel=&quot;nofollow noreferrer&quot;&gt;Constructing finite dimensional codes with optical continuous variables&lt;/a&gt; where it mentions &quot;superpositions of an infinite number of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11770/what-is-infinite-squeezing&quot;&gt;infinitely squeezed&lt;/a&gt; states&quot; in the introduction.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to find &lt;a href=&quot;https://physics.stackexchange.com/questions/373419/how-does-paulis-exclusion-principle-come-into-play-for-two-non-entangled-loca&quot;&gt;this question&lt;/a&gt; which states in regards to free fermions that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;you can argue that the wavefunctions are superpositions of an infinite number of space &quot;basis states&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I was also able to find references to the idea in &lt;a href=&quot;https://books.google.com/books?id=RQ23CgAAQBAJ&amp;amp;pg=PA255&amp;amp;lpg=PA255&amp;amp;dq=%22superpositions+of+an+infinite+number%22&amp;amp;source=bl&amp;amp;ots=sUu5BVUKmy&amp;amp;sig=ACfU3U3WbnsfSMEe48Dn9glJNA9zHawVmg&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=2ahUKEwii-IGe5ZDpAhWYsJ4KHU08CgEQ6AEwAHoECAkQAQ#v=onepage&amp;amp;q=%22superpositions%20of%20an%20infinite%20number%22&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Cosmology And Baby Universes&lt;/a&gt; where it is stated:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;One can therefore regard the singular &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; eigenstates as being superpostions of an infinite number of regular harmonic oscillator solutions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Additionally, in &lt;a href=&quot;http://www.cft.edu.pl/~birula/publ/QED.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (PDF) on Quantum Theory of the Electric Field in the Coherent States section (page 6) it states:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Coherent states are superpositions of an infinite number of Fock states&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Related: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1468/is-quantum-computing-limited-to-a-superposition-of-only-two-states&quot;&gt;Is quantum computing limited to a superposition of only two states?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11581/what-types-of-quantum-systems-use-infinite-values&quot;&gt;What types of quantum systems use infinite values?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2020-05-26T15:42:43.117" Title="Are superpositions of an infinite number of states realizable?" Tags="&lt;mathematics&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12039" PostTypeId="1" AcceptedAnswerId="12041" CreationDate="2020-05-16T05:07:45.257" Score="1" ViewCount="73" Body="&lt;p&gt;Sorry, I am a newbie to quantum computing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am reading an overview paper (released just a week ago) titled &lt;a href=&quot;https://arxiv.org/abs/2005.04316&quot; rel=&quot;nofollow noreferrer&quot;&gt;Advances in Quantum Deep Learning: An Overview&lt;/a&gt; (Garg &amp;amp; Ramakrishnan, 2020). I am stuck on the following example from paper (shown in screenshot below).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4fLLk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4fLLk.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that one of the qubits was measured and it returned a value of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Therefore, the state of entangled two-qubit quantum system has been updated as following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = \frac{1}{\sqrt{2}} |00\rangle + \frac{1}{\sqrt{2}} |01\rangle.$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in the initial state,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;the superposition state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}} |00\rangle + \frac{1}{\sqrt{3}} |01\rangle$&lt;/span&gt; has the probability &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}$&lt;/span&gt; which according to the statement in paper has been measured to be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Then why the updated state of quantum system is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = \frac{1}{\sqrt{2}} |00\rangle + \frac{1}{\sqrt{2}} |01\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which yielded &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; instead of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = \frac{1}{\sqrt{2}} |10\rangle + \frac{1}{\sqrt{2}} |11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which instead has the probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt; when it was not measured?&lt;/p&gt;&#xA;" OwnerUserId="10428" LastActivityDate="2020-05-16T11:23:14.707" Title="Which entangled qubit is measured in this example?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12040" PostTypeId="1" AcceptedAnswerId="12042" CreationDate="2020-05-16T06:26:04.617" Score="3" ViewCount="200" Body="&lt;p&gt;I'm trying to implement a controlled &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt; 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 (&lt;span class=&quot;math-container&quot;&gt;$\theta, \phi, \lambda$&lt;/span&gt;) for the matrices I got. Is there a workaround for this? Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: I know if I remove the overall phase of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Y}$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="9153" LastEditDate="2020-05-16T06:42:27.600" LastActivityDate="2020-05-16T18:15:49.940" Title="Implementing controlled $\frac{\pi}{2}$ y and z rotation in Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12041" PostTypeId="2" ParentId="12039" CreationDate="2020-05-16T06:30:11.283" Score="1" Body="&lt;p&gt;Firstly, note that the state is seperable (not entangled):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\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= \\&#xA;= \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&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle = \left(\frac{\sqrt{2}}{\sqrt{3}}|0\rangle + \frac{1}{\sqrt{3}}|1\rangle \right)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle= \left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle \right)$&lt;/span&gt; correspond to the first and the second qubit states. This &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |\psi_1 \rangle |\psi_2 \rangle$&lt;/span&gt; is not possible if we have entangled states. The consequence of this is that after measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; for the first qubit (in the example the measurement is done &lt;strong&gt;for the first qubit&lt;/strong&gt;), the state of the first qubit becomes &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle \rightarrow |0\rangle$&lt;/span&gt; (the second qubit's state will not be changed) and the combined state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The explanation with the projective measurements:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We should renormalize the state after the measurement (after measurement the probabilities of the state should sum to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;). If we apply the projective measurement, we should calculate the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; outcome:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(m) = \langle \psi | P_m | \psi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is is the projector onto the eigenspace of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a Hermitian operator/observable, that describes the measuremet. Then the state after the measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; will be equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{P_m |\psi \rangle}{\sqrt{p_m}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The division to the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{p_m}$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the case of the question the observable is &lt;span class=&quot;math-container&quot;&gt;$M = Z\otimes I$&lt;/span&gt;, the projector to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state of the first qubit is &lt;span class=&quot;math-container&quot;&gt;$P_{+1} = |0\rangle \langle 0| \otimes I$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; means that we are not touching the second qubit, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; eigenvalue is &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;. Then the probability of measuring the first qubit &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p_{+1} = \langle \psi | P_{+1} | \psi \rangle = \frac{2}{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The resulting state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-16T11:23:14.707" LastActivityDate="2020-05-16T11:23:14.707" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12042" PostTypeId="2" ParentId="12040" CreationDate="2020-05-16T06:49:23.940" Score="2" Body="&lt;p&gt;The circuit for the controlled &lt;span class=&quot;math-container&quot;&gt;$R_y(t)$&lt;/span&gt; that is true also for &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; (just change the indexes). For &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt;, instead of &lt;span class=&quot;math-container&quot;&gt;$cx$&lt;/span&gt; we should use &lt;span class=&quot;math-container&quot;&gt;$cz = I \otimes H \cdot cx \cdot I \otimes H$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gU2Jh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gU2Jh.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The corresponding code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;t = np.pi/2 # for the question's case&#xA;circuit = QuantumCircuit(2)&#xA;circuit.ry(t/2, 1)&#xA;circuit.cx(0, 1)&#xA;circuit.ry(-t/2, 1)&#xA;circuit.cx(0, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are the expressions for &lt;span class=&quot;math-container&quot;&gt;$cx$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_y(t)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;cx = |0\rangle \langle 0| I + |1\rangle \langle 1 | X&#xA;\qquad R_y(\theta) = \cos(\theta/2)I - i \sin(\theta/2)Y&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By taking into account that &lt;span class=&quot;math-container&quot;&gt;$XYX = -Y$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;$XR_y(\theta)X = R_y(-\theta)$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and if we multiply this with &lt;span class=&quot;math-container&quot;&gt;$R_y(t/2)$&lt;/span&gt; from the right side we will obtain: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle \langle0| I + |1\rangle \langle 1| R_y(t) = cR_y(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta_1)R_y(\theta_2) = R_y(\theta_1 + \theta_2)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-16T07:17:33.200" LastActivityDate="2020-05-16T07:17:33.200" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12043" PostTypeId="1" CreationDate="2020-05-16T07:00:16.283" Score="1" ViewCount="319" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; directly, without calculating the truth table outside the part of quantum computation?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, if elements in the array to search are obtained in iterations (e.g. in one iterate, I obtain one element &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, which is sum of something else like &lt;span class=&quot;math-container&quot;&gt;$\sum_j y_j$&lt;/span&gt;), 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In addition, I use the tutorial from &lt;a href=&quot;https://github.com/Qiskit/qiskit-community-tutorials/blob/master/optimization/grover.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-community-tutorials/blob/master/optimization/grover.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12073" LastEditorUserId="55" LastEditDate="2020-05-18T15:31:20.493" LastActivityDate="2020-05-20T03:22:26.397" Title="How to write decent code for oracle in Qiskit without custom circuit or long truth table?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12044" PostTypeId="2" ParentId="12040" CreationDate="2020-05-16T07:24:39.317" Score="1" Body="&lt;p&gt;You can use gate &lt;span class=&quot;math-container&quot;&gt;$CU3$&lt;/span&gt; directly on IBM Q and then leave the gate decomposition on transpiler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are relations between rotational gates and U3 gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Ry(\theta) = U3(\theta, 0, 0)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rx(\theta) = U3(\theta, -\pi/2, \pi/2).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-16T07:24:39.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12045" PostTypeId="1" AcceptedAnswerId="12046" CreationDate="2020-05-16T10:45:16.717" Score="2" ViewCount="72" Body="&lt;p&gt;I'm learning how to do error mitigation on Qiskit as my experiment result differs from the simulated result. I read the tutorial &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, 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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:27.387" LastActivityDate="2020-08-17T02:53:27.387" Title="Specifying qubits to achieve measurement error mitigation on Qiskit" Tags="&lt;qiskit&gt;&lt;error-correction&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12046" PostTypeId="2" ParentId="12045" CreationDate="2020-05-16T11:05:57.097" Score="3" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(my_circuit, seed_transpiler=123)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Alternatively, if you would like to specify the layout yourself, you can do this by providing an &lt;code&gt;initial_layout&lt;/code&gt; to the transpiler, and then setting the &lt;code&gt;optimization_level=0&lt;/code&gt;. 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 &lt;code&gt;{qr[0] : 3, qr[1]: 2}&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Overall, your code could then look something like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;my_layout = {qr[0] : 3, qr[1]: 2}&#xA;job = execute(my_circuit, initial_layout=my_layout, optimization_level=0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-16T11:05:57.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12047" PostTypeId="1" AcceptedAnswerId="12049" CreationDate="2020-05-16T11:38:08.707" Score="4" ViewCount="428" Body="&lt;p&gt;Consider the following situation, we import a 3-bit Toffoli gate as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.circuits.gates.multi_control_toffoli_gate import _cccx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I further define a Quantum Register of size 4 and a circuit containing it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(4, 'q')&#xA;circuit = QuantumCircuit(qr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I form a small circuit by applying Hadamard on the last qubit followed by &lt;code&gt;_cccx&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;circuit.h(3)&#xA;circuit.barrier()&#xA;_cccx(circuit, q)&#xA;circuit.barrier()&#xA;circuit.draw(output=&quot;mpl&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output of the following code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qrp5C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qrp5C.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As we can see that the underlying logic of &lt;code&gt;_cccx&lt;/code&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; This question is not limited to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit Toffoli gate but to any circuit which may even be defined by user. &lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="9006" LastEditDate="2020-05-17T07:03:03.210" LastActivityDate="2020-05-17T09:56:39.347" Title="How to format a qiskit circuit to only have a high level abstraction?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12049" PostTypeId="2" ParentId="12047" CreationDate="2020-05-16T12:00:07.003" Score="5" Body="&lt;p&gt;You should use the &lt;code&gt;mcx&lt;/code&gt; method of the circuit instead (methods with a leading underscore are usually for internal usage and not developed for users), then you can do&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;circuit = QuantumCircuit(4)&#xA;circuit.h(3)&#xA;circuit.mcx([0, 1, 2], 3)&#xA;circuit.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Which outputs &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cLNlnm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cLNlnm.png&quot; alt=&quot;c3x&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you decompose or transpile the circuit you'll get down to the implementation of the multi-controlled X&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import transpile&#xA;basis_gates = ['h', 'cx', 'cu1', 'u1', 'u3']&#xA;transpiled = transpile(circuit, basis_gates=basis_gates)&#xA;transpiled.draw(output='mpl', filename='c3x_decomp.png')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get &#xA;&lt;a href=&quot;https://i.stack.imgur.com/zg9zT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zg9zT.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;h1&gt;General logic wrapping into &lt;code&gt;Instruction&lt;/code&gt;s&lt;/h1&gt;&#xA;&#xA;&lt;p&gt;To wrap any circuit logic into an abstract block you can use the &lt;code&gt;Instruction&lt;/code&gt; object. First you define a subcircuit and then append it onto the larger circuit as &lt;code&gt;Instruction&lt;/code&gt;. Here's a short example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;larger = QuantumCircuit(5)&#xA;larger.h(4)&#xA;&#xA;sub = QuantumCircuit(4, name='My subcircuit')&#xA;sub.ccx(0, 1, 2)&#xA;sub.h([0, 1, 2, 3])&#xA;sub.crx(0.2, 3, 0)&#xA;&#xA;larger.append(sub.to_instruction(), [1, 2, 3, 4])&#xA;larger.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UIdiym.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UIdiym.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you decompose the &lt;code&gt;larger&lt;/code&gt; circuit you'll see the components. If you don't want to wrap it into a block you can just directly append &lt;code&gt;sub&lt;/code&gt; to the circuit using the &lt;code&gt;compose&lt;/code&gt; method:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;composed = larger.compose(sub, qubits=[1, 2, 3, 4)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9800" LastEditDate="2020-05-17T09:56:39.347" LastActivityDate="2020-05-17T09:56:39.347" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12051" PostTypeId="1" CreationDate="2020-05-16T13:57:57.820" Score="2" ViewCount="51" Body="&lt;p&gt;I currently have a tablet I don't have a desktop or laptop to access the IBM Quantum Experience.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do I have to upgrade to personal computer or laptop computer in order to be able to use the website or run code locally?&lt;/p&gt;&#xA;" OwnerUserId="12074" LastEditorUserId="55" LastEditDate="2020-07-26T18:05:22.807" LastActivityDate="2020-07-26T18:05:22.807" Title="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?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12052" PostTypeId="2" ParentId="12051" CreationDate="2020-05-16T14:37:46.163" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;http://www.quantumplayground.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Playground&lt;/a&gt; to see how basic gates, circuits and algorithms work. Please find a list of useful Quantum Computing Simulators in this &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;. 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. &lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="5955" LastEditDate="2020-05-16T15:13:51.720" LastActivityDate="2020-05-16T15:13:51.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12053" PostTypeId="2" ParentId="12009" CreationDate="2020-05-16T17:39:43.507" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\ket{GHZ}$&lt;/span&gt; be a GHZ state with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&#xA;So thanks to Norbert's answer I found the following separable pure states that maximize the trace distance:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket\psi=\frac1{2^{n/2}}\otimes_{k=1}^n(\ket0 +\exp{\left(i\pi f(k)\right)} \ket1),&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\sum_{k=1}^n f(k)=1$&lt;/span&gt;. By that we get the coefficient of &lt;span class=&quot;math-container&quot;&gt;$\ket{00\cdots 0}$&lt;/span&gt;  to be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the one of &lt;span class=&quot;math-container&quot;&gt;$\ket{11\cdots 1}$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. Therefore &lt;span class=&quot;math-container&quot;&gt;$\bk\psi{GHZ}=0$&lt;/span&gt; holds. They all have &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;trace distance&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12\sum |\lambda_i|=1,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\left(\ket{GHZ}\bra{GHZ}-\ket\psi\bra\psi\right)$&lt;/span&gt;. Both states share the same permutation symmetry if &lt;span class=&quot;math-container&quot;&gt;$f(k)=1/n$&lt;/span&gt;...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-05-16T18:29:53.347" LastActivityDate="2020-05-16T18:29:53.347" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12054" PostTypeId="2" ParentId="12040" CreationDate="2020-05-16T18:15:49.940" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the first approach, here's the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import qiskit as qk&#xA;from qiskit.circuit.library import RYGate&#xA;&#xA;circ = qk.QuantumCircuit(2)&#xA;&#xA;circ.append(RYGate(np.pi/2).control(), [0, 1])&#xA;&#xA;print('before...')&#xA;print(circ.draw())&#xA;&#xA;new_circ = qk.transpile(circ, basis_gates=['u3', 'cx'], optimization_level=3)&#xA;&#xA;print('after...')&#xA;print(new_circ_1.draw(fold=100))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;before...&#xA;&#xA;q_0: ─────■──────&#xA;     ┌────┴─────┐&#xA;q_1: ┤ RY(pi/2) ├&#xA;     └──────────┘&#xA;after...&#xA;&#xA;q_0: ──────────────────■─────────────────────■──────────────────────&#xA;     ┌──────────────┐┌─┴─┐┌───────────────┐┌─┴─┐┌──────────────────┐&#xA;q_1: ┤ U3(0,0,pi/2) ├┤ X ├┤ U3(-pi/4,0,0) ├┤ X ├┤ U3(pi/4,-pi/2,0) ├&#xA;     └──────────────┘└───┘└───────────────┘└───┘└──────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-05-16T18:15:49.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12055" PostTypeId="2" ParentId="12043" CreationDate="2020-05-16T18:35:17.937" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In your example you are searching for the decimal &lt;code&gt;4&lt;/code&gt; in 8 possibilities. You need 3 qubits for this problem, and the answer to search for would be &lt;code&gt;100&lt;/code&gt; (little endian convention).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import Diagonal&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;mark_state = Statevector.from_label('100')&#xA;mark_circuit = Diagonal((-1)**mark_state.data)  # circuit that induces a -1 phase on the mark_state&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You can see a complete Grover example in Qiskit with this approach here:&#xA;&lt;a href=&quot;https://github.com/ajavadia/qiskit-terra/blob/Demo/demo/Grover%20Interactive.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ajavadia/qiskit-terra/blob/Demo/demo/Grover%20Interactive.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastActivityDate="2020-05-16T18:35:17.937" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12056" PostTypeId="2" ParentId="12038" CreationDate="2020-05-16T18:40:08.447" Score="5" Body="&lt;p&gt;For any problem which is described by an infinite dimensional Hilbert space, you can regard &lt;em&gt;any&lt;/em&gt; state as a superposition of an infinite number of states.  The only real question is thus whether infinite-dimensional Hilbert space are &lt;em&gt;&quot;used in practice&quot;&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-05-16T18:40:08.447" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12057" PostTypeId="1" CreationDate="2020-05-16T18:59:06.580" Score="1" ViewCount="90" Body="&lt;p&gt;I'm new to the IBM Q Experience. In the Composer, I built a circuit consisting of two Hadamard Gates and an Ry: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg q[5];&#xA;creg c[5];&#xA;&#xA;h q[0];&#xA;h q[0];&#xA;ry(pi/2) q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The results returned are 50/50 probability. However, when I apply the matrices in a spreadsheet, I get a &lt;span class=&quot;math-container&quot;&gt;$\frac{28}{72}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\cos\big(\frac{pi/2}{2}\big)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$-\sin\big(\frac{pi/2}{2}\big)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sin\big(\frac{pi/2}{2}\big)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos\big(\frac{pi/2}{2}\big)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\pi=180^{\text{o}}$&lt;/span&gt;. 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; I used 3.14 instead of 180 degrees, and it came out 50/50.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p1nOd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p1nOd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12075" LastEditorUserId="9006" LastEditDate="2020-05-17T07:13:06.887" LastActivityDate="2020-05-17T11:30:04.770" Title="Hadamard + Hadamard + Ry: Results in the IBM Q Experience don't match the matrix results" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12058" PostTypeId="2" ParentId="12057" CreationDate="2020-05-16T19:59:06.280" Score="4" Body="&lt;p&gt;Here are the gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1 \\1&amp;amp;-1 \end{pmatrix}&#xA;\qquad&#xA;R_y(\theta) = \begin{pmatrix} \cos(\theta/2) &amp;amp; -\sin(\theta/2)  \\\sin(\theta/2) &amp;amp; \cos(\theta/2)  \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Matrix multiplication (note that &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt;):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = R_y(\pi/2) H H = R_y(\pi/2) = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; -1  \\ 1 &amp;amp; 1  \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we will apply this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, we will obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U |0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; -1  \\ 1 &amp;amp; 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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability we will measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) state.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-05-16T19:59:06.280" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12059" PostTypeId="2" ParentId="12057" CreationDate="2020-05-17T03:34:29.307" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;For pi I used 3.14 instead of 180 degrees, and it came out 50/50.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Sounds like you answered your own question. Sine and cosine functions would be expecting radians by default, so using &lt;span class=&quot;math-container&quot;&gt;$\pi=3.14 \cdots$&lt;/span&gt; is correct.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="10473" LastEditDate="2020-05-17T11:30:04.770" LastActivityDate="2020-05-17T11:30:04.770" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12060" PostTypeId="2" ParentId="5263" CreationDate="2020-05-17T05:55:38.757" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quantum Key Exchange (QKE) on the other hand is a cryptographic concept originally explored by Donald Beaver. There is a &lt;a href=&quot;https://link.springer.com/chapter/10.1007/3-540-46035-7_23&quot; rel=&quot;nofollow noreferrer&quot;&gt;seminal paper of the deniability of QKE&lt;/a&gt; published in 2002 itself. There are a few variants of QKE like authenticated QKE, Entanglement Distillation QKE etc. Please refer to this &lt;a href=&quot;https://arxiv.org/pdf/1812.02245.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent paper on QKE&lt;/a&gt; with reference to the aspects of covert communication and entanglement distillation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are some clear distinctions between QKD and QKE such as the following.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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&lt;/li&gt;&#xA;&lt;li&gt;QKD uses classical encryption schemes such as one-time-pads whereas QKE does not employ any classical cryptographic devices and schemes. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-05-17T05:55:38.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12061" PostTypeId="2" ParentId="12051" CreationDate="2020-05-17T07:09:24.750" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; which can be simulated efficiently on classical computers).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-17T07:09:24.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12062" PostTypeId="2" ParentId="5053" CreationDate="2020-05-17T07:49:23.067" Score="2" Body="&lt;p&gt;It is relevant to consider the following research paper from Mashiko Fukiyama on &lt;a href=&quot;https://doi.org/10.1016/S0304-3975(03)00292-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nim Game on Graph&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose an edge incident with the vertex of the piece &lt;/li&gt;&#xA;&lt;li&gt;Decrease the value of this edge to any strictly smaller non-negative integer.&lt;/li&gt;&#xA;&lt;li&gt;Move the piece to the adjacent vertex along this edge.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This approach outlines scenarios when any graph of the game forms a bipartite graph without multiple edges except in a few conditions. &lt;a href=&quot;https://mathoverflow.net/questions/17252/bipartite-nim-geography/145513?newreg=a48a6d47f42d461fa472c53acb404169&quot;&gt;Following MathOverflow discussion&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://bib.irb.hr/datoteka/466760.101960_0_art_file_176934_l0fztc.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph Approach to Quantum Systems&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus we can devise a quantum combinatorial game to implement Nim game on graph  using the algorithms outlined in this research paper on &lt;a href=&quot;https://arxiv.org/pdf/2005.01052.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Programming based Quantum Graph Partitioning&lt;/a&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1606.02136.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Oscillatory localisation of Quantum Walks&lt;/a&gt; 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. &lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-05-17T07:49:23.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12064" PostTypeId="2" ParentId="7098" CreationDate="2020-05-18T05:26:16.237" Score="1" Body="&lt;p&gt;The above answer did not work for me. This worked for me. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.delete_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;By deleting account, you should not be having any active accounts from IBMQ api. check that by getting active accounts &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.active_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After which generate a new token in your IBMQ experience website, &lt;a href=&quot;https://quantum-computing.ibm.com/account&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/account&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And then copy the new token, save that as a variable (I saved it into API_KEY), then save account in IBMQ&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account(API_KEY, overwrite=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7344" LastActivityDate="2020-05-18T05:26:16.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12066" PostTypeId="1" CreationDate="2020-05-18T14:56:43.193" Score="1" ViewCount="155" Body="&lt;p&gt;I'm running VQE algorithm on &lt;code&gt;ibmq-qasm-simulator&lt;/code&gt;.&lt;br&gt;&#xA;I'm trying to implement a &lt;strong&gt;restart&lt;/strong&gt; mechanism in order to be able to start a new computation from the result of a previous one.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To do so I've tried to set VQE' s &lt;code&gt;initial_point&lt;/code&gt; parameter to &lt;code&gt;result['optimal_point']&lt;/code&gt;, where &lt;em&gt;result&lt;/em&gt; is the return value of &lt;code&gt;vqe.run(quinstance)&lt;/code&gt; of the previous computation.&lt;br&gt;&lt;br&gt;&#xA;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.&lt;br&gt;&lt;br&gt;&#xA;Is this the correct way to implement a restart?&lt;br&gt;&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11981" LastActivityDate="2020-06-17T16:40:20.953" Title="VQE restart from a previous computation" Tags="&lt;qiskit&gt;&lt;vqe&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12067" PostTypeId="1" CreationDate="2020-05-18T15:58:28.803" Score="3" ViewCount="137" Body="&lt;p&gt;I am trying to create a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U = \sum^{T - 1}_{k=0}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle k |$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$ \otimes$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$e^{i A k}$&lt;/span&gt; in Q#, where A is a Hermitian matrix. For the beginning, I just want A to be a combination of 2 Pauli matrices, say &lt;span class=&quot;math-container&quot;&gt;$A = X + 2Z$&lt;/span&gt;. This is the code that I have, where &lt;code&gt;input&lt;/code&gt; is of type &lt;code&gt;Qubit[3]&lt;/code&gt; and &lt;code&gt;register&lt;/code&gt; of &lt;code&gt;Qubit[2]&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;   ...&#xA;   let SIZE_OF_MATRIX = 2; &#xA;   let unitaryGenerator = (2 ^ SIZE_OF_MATRIX, ConstructU);&#xA;   let registerLE = LittleEndian(register);&#xA;&#xA;   MultiplexOperationsFromGenerator(unitaryGenerator, registerLE, input);&#xA;   ...&#xA;&#xA;function ConstructU (j : Int) : (Qubit[] =&amp;gt; Unit is Adj + Ctl) {&#xA;    let generatorSystem = GeneratorSystem(2, MapToGeneratorIndex);&#xA;&#xA;    let evolutionGenerator = EvolutionGenerator(PauliEvolutionSet(), generatorSystem);&#xA;&#xA;    let unitaryOperator = TrotterStep(evolutionGenerator, 1, - IntAsDouble(j));&#xA;&#xA;    return unitaryOperator;&#xA;}&#xA;&#xA;// The purpose of this function is to map each part of the Hamiltonian generator&#xA;// to a generator index.&#xA;// Initially, we want to test the matrix A = X + 2Z.&#xA;function MapToGeneratorIndex (index : Int) : GeneratorIndex {&#xA;    // We only have 2 terms, hence index can only be 0 or 1&#xA;&#xA;    if (index == 0) {&#xA;        // Here we just want X&#xA;        return GeneratorIndex(([1], [1.0]), [0]);&#xA;    }&#xA;&#xA;    elif (index == 1) {&#xA;        // Here we want 2Z&#xA;        return GeneratorIndex(([3], [2.0]), [0]);&#xA;    }&#xA;&#xA;    // TODO: throw an error&#xA;    return GeneratorIndex( ([1000], [1000.0]), [0]);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Does anyone know what am I doing incorrectly? I am not getting the result that I am expecting.&#xA;I know the code is messy but I am just trying to make it work for a basic 2x2 matrix first.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="11979" LastEditorUserId="11979" LastEditDate="2020-05-22T10:36:14.360" LastActivityDate="2020-05-27T00:20:54.263" Title="Creating Hamiltonian Simulation Operator in Q#" Tags="&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12068" PostTypeId="1" CreationDate="2020-05-18T19:17:40.620" Score="2" ViewCount="454" Body="&lt;p&gt;I would like to use the built-in Qiskit &lt;code&gt;VQE()&lt;/code&gt; function, with my own variational form. What is the proper way to define it? I was expecting &lt;code&gt;var_form&lt;/code&gt; to be simply a function returning an object of type &lt;code&gt;QuantumCircuit&lt;/code&gt; for a particular set of parameters (that's how it's done in Pyquil).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely: how do I manually create an instance of the &lt;code&gt;VariationalForm&lt;/code&gt; class which would correspond to preparing the desired program for a given set of parameters?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far my understanding is that I have to do smth like that:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; class my_var_form(VariationalForm):&#xA;    def construct_circuit(self,&#xA;                          parameters: Union[List[float], np.ndarray],&#xA;                          q: Optional[QuantumRegister] = None) -&amp;gt; NoReturn:&#xA;        circuit = QuantumCircuit(q)&#xA;        ...&#xA;        return circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Is this the proper way to do things?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;CLARIFICATION&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let us define a function which would generate a Qiskit circuit for an arbitrary parameter of type &lt;code&gt;float&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def black_box( param : float ):&#xA;    qc = qskt.QuantumCircuit( 1 )&#xA;    qc.u1( np.sqrt( param ), 0 )&#xA;    return qc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;np.sqrt()&lt;/code&gt; was chosen as a toy example, one could equally well replace it with any fucntion defined on &lt;code&gt;float&lt;/code&gt;s. To make sure that the function makes sense, one can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job = execute( black_box( 1. ), get_backend('qasm_simulator') ) # Works fine&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, let us try to define a &lt;code&gt;VariationalForm&lt;/code&gt; which will use our &lt;code&gt;black_box&lt;/code&gt; function:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class my_var_form( VariationalForm ):&#xA;    def __init__(self, numpar, numq, bnds) -&amp;gt; None:&#xA;        super().__init__()&#xA;        self._num_parameters = numpar&#xA;        self._num_qubits = numq&#xA;        self._bounds = bnds&#xA;        pass&#xA;    def construct_circuit(self,&#xA;                          parameters: Union[List[float], np.ndarray],&#xA;                          q: Optional[qskt.QuantumRegister] = None) -&amp;gt; NoReturn:&#xA;    circuit = black_box( parameters[0] )&#xA;    return circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, the following code fails to work:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var_form_instance = my_var_form( 1, 1, [[-2., 2]] )&#xA;vqe = VQE( WeightedPauliOperator( [1., Pauli([0.],[0.])] ),&#xA;           var_form_instance,&#xA;           L_BFGS_B(),&#xA;           np.array([0])&#xA;         )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;TypeError: loop of ufunc does not support argument 0 of type Parameter which has no callable sqrt method&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The problem is that Qiskit no matter what wants to use its built-in &lt;code&gt;Parameter&lt;/code&gt; class which is based on the &lt;code&gt;sympy&lt;/code&gt; package.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I overcome this issue? Or is there absolutely no way I could use the built-in &lt;code&gt;VQE&lt;/code&gt; function without dealing with &lt;code&gt;Parameter&lt;/code&gt; class?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;VQE()&lt;/code&gt; function to use my own &lt;code&gt;black_box()&lt;/code&gt; function for generating the quantum circuit on each step of the minimization.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Alternatively, I could just not use &lt;code&gt;VQE()&lt;/code&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12080/evaluating-expectation-values-of-operators-in-qiskit&quot;&gt;here&lt;/a&gt;: to my understanding &lt;code&gt;SnapshotExpectationValue()&lt;/code&gt; is an unphysical method, and does not allow one to calculate expectation values of Pauli strings using sampling on real devices.)&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-05-23T04:14:28.463" LastActivityDate="2020-09-18T10:55:00.387" Title="Creating a custom VariationalForm in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12069" PostTypeId="2" ParentId="12068" CreationDate="2020-05-18T19:43:44.073" Score="5" Body="&lt;p&gt;You can plug any parameterized &lt;code&gt;QuantumCircuit&lt;/code&gt; into the VQE. &#xA;Parameterized means it contains &lt;code&gt;Parameter&lt;/code&gt; objects e.g. as rotation angles. For instance&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit, ParameterVector&#xA;from qiskit.aqua.algorithms import VQE&#xA;&#xA;params = ParameterVector(3)&#xA;wavefunction = QuantumCircuit(3)&#xA;wavefunction.ry(params[0], 0)&#xA;wavefunction.ry(params[1], 1)&#xA;wavefunction.ry(params[2], 2)&#xA;&#xA;vqe = VQE(var_form=wavefunction, ...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I'd suggest you to have a look at the &lt;a href=&quot;https://qiskit.org/documentation/apidoc/circuit_library.html&quot; rel=&quot;noreferrer&quot;&gt;circuit library&lt;/a&gt;, especially the N-local circuits as e.g. the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.TwoLocal.html&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;TwoLocal&lt;/code&gt; circuit&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Cryoris/notebooks/blob/master/Circuit%20library%20%26%20native%20circuits.ipynb&quot; rel=&quot;noreferrer&quot;&gt;This notebook&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-05-18T19:43:44.073" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="12070" PostTypeId="1" CreationDate="2020-05-18T21:35:53.597" Score="1" ViewCount="63" Body="&lt;p&gt;I'm running an experiment first on &lt;code&gt;qasm_simulator&lt;/code&gt; backend from &lt;code&gt;Aer&lt;/code&gt; 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 &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt; backend from &lt;code&gt;IBMQ&lt;/code&gt; provider and got different results (don't reach minimal energy value). What is the reason for this behavior?&lt;/p&gt;&#xA;" OwnerUserId="10234" LastActivityDate="2020-05-18T21:35:53.597" Title="ibmq_qasm_simulator from IBMQ provider and qasm_simulator from Aer provider gives different results" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12071" PostTypeId="1" CreationDate="2020-05-18T23:39:40.723" Score="0" ViewCount="41" Body="&lt;p&gt;We consider  a quantum circuit that takes as &lt;strong&gt;input&lt;/strong&gt; two vectors &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt;. The &lt;strong&gt;output&lt;/strong&gt; of this quantum circuit must contain the reflected vector of   &lt;span class=&quot;math-container&quot;&gt;$\vert y \rangle$&lt;/span&gt;  with respect to  &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt;  (and whatever else that is irrelevant to the purpose ).&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11926/10110&quot;&gt;It can be proved&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, In the reference linked in my question &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9703032&quot; rel=&quot;nofollow noreferrer&quot;&gt;Programmable quantum gate arrays&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; qubits in the program register, but in principle possible. In our case &lt;span class=&quot;math-container&quot;&gt;$\vert x \rangle$&lt;/span&gt; is the program, the reflection axis. So we can implement all the operators &lt;span class=&quot;math-container&quot;&gt;$U_{\xi_k}$&lt;/span&gt; described below  for &lt;span class=&quot;math-container&quot;&gt;$k=1.2.3......n$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that means that these operators allow an implementation (with one quantum circuit with &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt;  input &quot;program&quot; qubits ) as long as the program states are orthogonal (as explained above ). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And that means that the &lt;a href=&quot;https://arxiv.org/pdf/1401.6030&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Grover-Sysoev algorithm&lt;/em&gt;&lt;/a&gt; can be implemented. This consists in the following &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; steps:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\xi_1\rangle = U_s U_\omega |s\rangle,&#xA;\quad&#xA;\vert \xi_2 \rangle = U_{\xi_1} U_\omega \vert s \rangle,&#xA;\quad&#xA;\cdots&#xA;\quad &#xA;\vert \xi_n \rangle = U_{\xi_{n-1}} U_\omega \vert  s \rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U_\omega\equiv I - 2  (\vert\omega\rangle\langle\omega \vert )$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_s \equiv 2\vert s \rangle \langle s \vert - I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This algorithm finds a solution exponentially faster than Grover's. In other words, for a fixed large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; we can actually build this complex quantum circuit that would solve problems of practical interest efficiently.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the optimality proof in Grover 's original paper doesn't include operators with &quot;program&quot;  registers as input. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question  1.&lt;/strong&gt; Is this algorithm  possible to implement,  in principle?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2.&lt;/strong&gt; Is this algorithm exponentially faster that Grover, for a fixed, chosen n?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way &quot;exponentially faster&quot; is defined implies considering arbitrarily large values of n,  but the meaning of this question is clear from the context. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;My calculations indicate that both questions allow &quot;yes&quot; answers, but I could be wrong. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another related question I asked previously can be found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11882/10110&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="55" LastEditDate="2020-05-19T23:59:07.150" LastActivityDate="2020-05-19T23:59:07.150" Title="Question about the Grover-Sysoev algorithm" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="17" ClosedDate="2020-05-20T07:47:42.620" ContentLicense="CC BY-SA 4.0" />
  <row Id="12072" PostTypeId="2" ParentId="12016" CreationDate="2020-05-19T02:25:05.803" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607018&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Quantum copying: Beyond the no-cloning theorem&quot;&lt;/a&gt;. In fact, even &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; makes the following strong and damning statements (emphasis added) &quot;&lt;strong&gt;only&lt;/strong&gt; if infinitely many identically prepared qubits were measured would one be able to determine &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&quot; and &quot;the laws of quantum mechanics prevent [one] from determining the state when [one] only has a single copy of &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit message, you must send &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="11742" LastActivityDate="2020-05-19T02:25:05.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12073" PostTypeId="1" AcceptedAnswerId="12074" CreationDate="2020-05-19T08:41:53.357" Score="1" ViewCount="64" Body="&lt;p&gt;I'm working with a program, which needs iterations of quantum computation like this&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def quantum(n):&#xA;    Grover(oracle).run(QuantumInstance(...))&#xA;    #n is input size associated with oracle, &#xA;    #and some other components are omitted.&#xA;&#xA;for n in range(0,10):&#xA;    start = time.time()&#xA;    quantum(n)&#xA;    end = time.time()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12073" LastEditorUserId="12073" LastEditDate="2020-05-19T10:10:48.400" LastActivityDate="2020-05-19T10:10:48.400" Title="How to reduce unnecessary waiting time when using IBM's backend?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12074" PostTypeId="2" ParentId="12073" CreationDate="2020-05-19T10:03:56.670" Score="2" Body="&lt;p&gt;Assuming your &lt;code&gt;quantum()&lt;/code&gt; method creates a circuit, you can run lots of circuits in one go by using the &lt;code&gt;execute&lt;/code&gt; command. For example &lt;code&gt;execute([grover_1, grover_2, grover_3], backed=my_backend)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-19T10:03:56.670" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12075" PostTypeId="1" AcceptedAnswerId="12079" CreationDate="2020-05-19T10:20:11.083" Score="3" ViewCount="109" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_A \otimes \mathcal{E_{\text{depol}}} $&lt;/span&gt;. If the input is a density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, is it correct that the output is &lt;span class=&quot;math-container&quot;&gt;$p \rho_A \otimes \mathbb{I}/2 + (1-p) \rho_{AB}$&lt;/span&gt;? How can this be generalized? &#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-08-27T12:55:47.070" LastActivityDate="2020-08-27T12:55:47.070" Title="How to compute the tensor product of the depolarizing channel with the identity?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12076" PostTypeId="1" AcceptedAnswerId="12081" CreationDate="2020-05-19T10:45:43.543" Score="0" ViewCount="100" Body="&lt;p&gt;I'm trying to do error mitigation in IBM-Q quantum computers with qiskit. I followed the tutorial &lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/3_measurement_error_mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12045/specifying-qubits-to-achieve-measurement-error-mitigation-on-qiskit&quot;&gt;this question&lt;/a&gt; and followed along, but I have encountered some problems. Here is the part that is causing problem:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    qreg = qk.QuantumRegister(7)&#xA;    layout = {qreg[0]: 12, &#xA;              qreg[1]: 11,&#xA;              qreg[2]: 13, &#xA;              qreg[3]: 17, &#xA;              qreg[4]: 14, &#xA;              qreg[5]: 12, &#xA;              qreg[6]: 6}&#xA;&#xA;&#xA;    ########## error mitigation ##########&#xA;&#xA;    meas_calibs, state_labels = complete_meas_cal(&#xA;            qubit_list=[0, 1, 2], qr=qreg, circlabel='mcal') &#xA;    print(meas_calibs[0])&#xA;&#xA;    # This line below is causing error if I add &quot;initial_layout&quot; in both qk.compiler.transpile and qk.execute&#xA;    qk.compiler.transpile(meas_calibs, backend=_backend, initial_layout=layout)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I receive the error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.dagcircuit.exceptions.DAGCircuitError: 'not a DAG' &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="9153" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:15.573" LastActivityDate="2020-08-17T02:53:15.573" Title="Real-device error mitigation with qiskit" Tags="&lt;qiskit&gt;&lt;error-correction&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12077" PostTypeId="1" CreationDate="2020-05-19T10:50:44.747" Score="0" ViewCount="35" Body="&lt;p&gt;In Cleve et al.'s paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9901025.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;How to share a quantum secret&quot;&lt;/a&gt;, two encodings of quantum states are mentioned. The first one encodes one qutrit into three qutrits,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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).$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second encoding is in fact a quantum error-correcting code and encodes one qubit into four qubits, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + \beta|1\rangle \mapsto &#xA;\alpha(|0000\rangle + |1111\rangle) + \beta(|0011\rangle + |1100\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="11977" LastEditorUserId="11977" LastEditDate="2020-05-19T12:50:56.447" LastActivityDate="2020-06-18T15:01:30.183" Title="How does the unitary encoding procedure in quantum secret sharing schemes or error correcting codes work?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12078" PostTypeId="1" AcceptedAnswerId="12169" CreationDate="2020-05-19T11:38:31.750" Score="3" ViewCount="168" Body="&lt;p&gt;&lt;strong&gt;Quantum simulation&lt;/strong&gt; (also referred to as &lt;strong&gt;Hamiltonian simulation&lt;/strong&gt;) is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In the Hamiltonian simulation problem, given a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; hermitian matrix acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits), a time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; and maximum simulation error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, the goal is to find an algorithm that approximates &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$||U - e^{-iHt}|| \leq \epsilon$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; is the ideal evolution and &lt;span class=&quot;math-container&quot;&gt;$||\cdot||$&lt;/span&gt; is the spectral norm.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 :) ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="2098" LastActivityDate="2020-05-25T12:26:04.867" Title="What are the biggest obstacles currently preventing us from solving real world problems defined in terms of quantum simulation?" Tags="&lt;algorithm&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12079" PostTypeId="2" ParentId="12075" CreationDate="2020-05-19T11:56:37.803" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi_{dp}$&lt;/span&gt; denote the fully depolarising channel: &lt;span class=&quot;math-container&quot;&gt;$\Phi_{dp}(\rho)=\operatorname{Tr}(\rho) I/d$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; the dimension of the space.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The depolarising channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal E_{depol}$&lt;/span&gt; in the OP can be written as &lt;span class=&quot;math-container&quot;&gt;$\mathcal E_{depol}=(1-p) \operatorname{Id} + p \Phi_{dp}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Id}$&lt;/span&gt; the identity channel. It follows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Id}\otimes \mathcal E_{depol} = (1-p) \operatorname{Id}\otimes \operatorname{Id} + p \operatorname{Id}\otimes \Phi_{dp}.$$&lt;/span&gt;&#xA;The only thing that might appear nontrivial is how the second term acts on states.&#xA;There are several ways to compute this. For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\operatorname{Id}\otimes\Phi_{dp} )\rho&#xA;= \sum_{ijk\ell} \rho_{ijk\ell} (\operatorname{Id}\otimes\Phi_{dp} )  (|ij\rangle\!\langle k\ell|)&#xA;= \sum_{ijk\ell} \rho_{ijk\ell} |i\rangle\!\langle k|\otimes \underbrace{\Phi_{dp} (|j\rangle\!\langle\ell|)}_{=\delta_{j\ell}/d}  \\&#xA;= \sum_{ijk} \rho_{ijkj} |i\rangle\!\langle k|\otimes I / d&#xA;\equiv \operatorname{Tr}_B(\rho) \otimes I/d,&#xA;\equiv \rho_A\otimes I/d.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similar calculations can be performed in different representations of the map (natural, Choi, etc) with analogous results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Working out tensor products of more depolarising channels is analogous.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;TL;DR: Yes, that's correct.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-05T09:47:21.390" LastActivityDate="2020-06-05T09:47:21.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12080" PostTypeId="1" AcceptedAnswerId="12210" CreationDate="2020-05-19T12:04:02.313" Score="4" ViewCount="1396" Body="&lt;p&gt;I'm wondering how in Qiskit one can calculate the expectation value of an operator given as a &lt;code&gt;WeightedPauli&lt;/code&gt; (or, at least, of a single &lt;code&gt;Pauli&lt;/code&gt; operator...) in a certain state (given as a &lt;code&gt;QuantumCircuit&lt;/code&gt; 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 &lt;code&gt;float&lt;/code&gt;s, not &lt;code&gt;Parameter&lt;/code&gt;s (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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I guess, &lt;code&gt;PauliBasisChange&lt;/code&gt; may be involved...&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-05-23T06:34:35.477" LastActivityDate="2020-05-28T07:48:53.440" Title="Evaluating expectation values of operators in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12081" PostTypeId="2" ParentId="12076" CreationDate="2020-05-19T12:38:40.540" Score="1" Body="&lt;p&gt;You have assigned 2 virtual qubits to the same physical qubit, both &lt;code&gt;qreg[0]&lt;/code&gt; and &lt;code&gt;qreg[5]&lt;/code&gt; are assigned to physical qubit &lt;code&gt;12&lt;/code&gt;. If you change one of these to be a different physical qubit, it should work.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-19T12:38:40.540" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12082" PostTypeId="2" ParentId="12077" CreationDate="2020-05-19T14:19:03.110" Score="1" Body="&lt;p&gt;Let's say you're given a transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i\alpha_i|\psi_i\rangle\mapsto\sum_i\alpha_i|\phi_i\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_i|\psi_j\rangle=\langle\phi_i|\phi_j\rangle=\delta_{ij}$&lt;/span&gt;. What this really means is that you want a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that transforms&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi_i\rangle=|\phi_i\rangle&#xA;$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) to make up the Hilbert space to the correct dimension. So, perhaps we really mean&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi_i\rangle|00\rangle=|\phi_i\rangle,&#xA;$$&lt;/span&gt;&#xA;for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if you're looking at the transformation &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle+\beta|1\rangle\mapsto \alpha|00\rangle+\beta|11\rangle$&lt;/span&gt;, we know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|00\rangle=|00\rangle,\qquad U|10\rangle=|11\rangle.&#xA;$$&lt;/span&gt;&#xA;This tells us certain parts of the unitary:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left[\begin{array}{cccc}&#xA;1 &amp;amp; ? &amp;amp; 0 &amp;amp; ? \\&#xA;0 &amp;amp; ? &amp;amp; 0 &amp;amp; ? \\&#xA;0 &amp;amp; ? &amp;amp; 0 &amp;amp; ? \\&#xA;0 &amp;amp; ? &amp;amp; 1 &amp;amp; ?\end{array}&#xA;\right].&#xA;$$&lt;/span&gt;&#xA;Orthogonality of the two remaining columns means we can fill in a bit more&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left[\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; ? &amp;amp; 0 &amp;amp; ? \\&#xA;0 &amp;amp; ? &amp;amp; 0 &amp;amp; ? \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{array}&#xA;\right].&#xA;$$&lt;/span&gt;&#xA;The remaining &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; submatrix can be any &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitary that you want, but the choice &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\left[\begin{array}{cccc}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{array}&#xA;\right]&#xA;$$&lt;/span&gt;&#xA;conveniently corresponds to the controlled-not gate.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-19T14:19:03.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12083" PostTypeId="1" AcceptedAnswerId="12084" CreationDate="2020-05-19T14:59:37.843" Score="4" ViewCount="89" Body="&lt;p&gt;Inspired by the comments in this question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11861/how-to-approximate-rx-ry-and-rz-gates&quot;&gt;How to approximate $Rx$, $Ry$ and $Rz$ gates?&lt;/a&gt;, there is the errata for question 4.11 pg 176 in N&amp;amp;C. The original form states that for any non parallel &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, then for an arbitrary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U =  e^{i\alpha}R_n(\beta)R_m(\gamma)R_n(\delta)$&lt;/span&gt;, for appropriate &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta, \gamma, \delta$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The errata, &lt;a href=&quot;http://www.michaelnielsen.org/qcqi/errata/errata/errata.html&quot; rel=&quot;noreferrer&quot;&gt;http://www.michaelnielsen.org/qcqi/errata/errata/errata.html&lt;/a&gt;,  corrects this s.t.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U =  e^{i\alpha}R_n(\beta_1)R_m(\gamma_1)R_n(\beta_2)R_m(\gamma_2)\dots$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&amp;amp;C?&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="2927" LastEditDate="2020-05-19T23:39:07.257" LastActivityDate="2020-05-19T23:39:07.257" Title="Correct Formulation of N&amp;C Exercise 4.11 and other textbooks misquoting" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12084" PostTypeId="2" ParentId="12083" CreationDate="2020-05-19T15:05:29.287" Score="5" Body="&lt;p&gt;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&amp;amp;C erratum. As you say, it has propagated far and wide!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want some insight about the problem, imagine &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; axis. With a sequence &lt;span class=&quot;math-container&quot;&gt;$n-m-n$&lt;/span&gt;, so the claim goes, I should be able to produce &lt;em&gt;any&lt;/em&gt; state on the surface of the Bloch sphere. But the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; does nothing because of what our initial state is. Then the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; axis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-19T15:05:29.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12085" PostTypeId="1" AcceptedAnswerId="12086" CreationDate="2020-05-19T18:17:02.210" Score="2" ViewCount="196" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/B1j35.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B1j35.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand the simple quantum teleportation protocol and why it uses X and Z gate at the end of the circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was researching about the Qiskit and I came across this video &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=mMwovHK2NrE&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=mMwovHK2NrE&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which uses the following algorithm for quantum teleportation. &lt;a href=&quot;https://i.stack.imgur.com/apWPa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/apWPa.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't understand why they use CX and CZ gate with qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; as controls and qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; as the target at the end. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please try to explain why they're using CZ and CX gate at the end of the circuit.&lt;/p&gt;&#xA;" OwnerUserId="11906" LastEditorUserId="2879" LastEditDate="2020-05-20T06:49:43.030" LastActivityDate="2020-05-20T06:49:43.030" Title="In Qiskit quantum teleportation protocol, why they use CZ and CX gate at the end?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12086" PostTypeId="2" ParentId="12085" CreationDate="2020-05-19T20:30:34.717" Score="2" Body="&lt;p&gt;The top circuit uses classically controlled X and Z gates - gates that are conditioned on the measurement result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (which leads to gates applied in the bottom circuit).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, you can do teleportation even without those two measurements in the bottom circuit, following &lt;a href=&quot;https://en.wikipedia.org/wiki/Deferred_Measurement_Principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;the principle of deferred measurement&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-19T20:30:34.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12087" PostTypeId="2" ParentId="12085" CreationDate="2020-05-19T21:55:03.210" Score="0" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can check the following notebook for implementation and more details.&#xA;&lt;a href=&quot;https://gitlab.com/qkitchen/basics-of-quantum-computing/-/blob/master/bronze/B56_Quantum_Teleportation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gitlab.com/qkitchen/basics-of-quantum-computing/-/blob/master/bronze/B56_Quantum_Teleportation.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-05-19T21:55:03.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12089" PostTypeId="2" ParentId="11320" CreationDate="2020-05-19T23:37:21.773" Score="2" Body="&lt;p&gt;I propose the following advantages to quantum money, over and above blockchain-based cryptocurrencies.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The security of Nakomoto-style cryptocurrencies (read, &lt;a href=&quot;https://www.bitcoin.com/get-started/bitcoin-white-paper-beginner-guide/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bitcoin&lt;/a&gt;) is based on computational assumptions, at least in that there is a assumption that inverting SHA256 hashes is likely computationally difficult. However, &lt;a href=&quot;https://wiki.veriqloud.fr/index.php?title=Wiesner_Quantum_Money&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiesner-style&lt;/a&gt; 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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 (&quot;private-key&quot;), and even &quot;public-key&quot; quantum money schemes such as those based on &lt;a href=&quot;https://arxiv.org/abs/1004.5127&quot; rel=&quot;nofollow noreferrer&quot;&gt;knots&lt;/a&gt; don't appear to have a lot of similar disadvantages in energy usage; there is no &quot;proof-of-work&quot; at play in quantum money.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Investigating schemes for quantum money may also provide schemes for &lt;a href=&quot;https://arxiv.org/abs/1711.02276&quot; rel=&quot;nofollow noreferrer&quot;&gt;digital signatures/commitment&lt;/a&gt;. 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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1809.05925&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kane's proposal on modular forms&lt;/a&gt;, and Shor has recently teased quantum money based on &lt;a href=&quot;https://simons.berkeley.edu/talks/quantum-money-based-lattices&quot; rel=&quot;nofollow noreferrer&quot;&gt;lattices&lt;/a&gt;.  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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-05-19T23:37:21.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12090" PostTypeId="1" AcceptedAnswerId="12105" CreationDate="2020-05-20T00:53:23.500" Score="1" ViewCount="100" Body="&lt;p&gt;I want to implement the Grover iteration instead of the multi-control qubit implemented as in this picture:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3kHiP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3kHiP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to implement them like in this example of five qubits:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/DiRV4.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DiRV4.jpg&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mean how can I decompose them in the circuit (picture1)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,1,1,1,1,1,1,%22X%22],[%22H%22,%22H%22,%22H%22,%22H%22,1,1,1,%22H%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22X%22],[1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[1,1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[1,1,1,1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22X%22],[%22H%22,%22H%22,%22H%22,1,1,%22H%22],[%22X%22,%22X%22,%22X%22,1,1,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22],[1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,1,1,1,%22H%22],[1,1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,1,1,1,%22H%22],[1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22],[%22X%22,%22X%22,%22X%22,1,1,%22X%22],[%22H%22,%22H%22,%22H%22,1,1,%22H%22],[%22Chance6%22]],%22gates%22:[%7B%22id%22:%22~akt%22,%22name%22:%22Oracle%22,%22circuit%22:%7B%22cols%22:[[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22X%22],[1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[1,1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[1,1,1,1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,%22X%22]]%7D%7D,%7B%22id%22:%22~pb2i%22,%22name%22:%22Amplif%22,%22circuit%22:%7B%22cols%22:[[%22H%22,%22H%22,%22H%22,1,1,%22H%22],[%22X%22,%22X%22,%22X%22,1,1,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22],[1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,1,1,1,%22H%22],[1,1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,1,1,1,%22H%22],[1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22],[%22X%22,%22X%22,%22X%22,1,1,%22X%22],[%22H%22,%22H%22,%22H%22,1,1,%22H%22]]%7D%7D]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;This is my attempt&lt;/a&gt; but I failed to get the amplitude increases for the state |1111&gt; (after measuring the wires 1,2,3 and 6)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you could do it in the Quirk simulator, that will be too helpful.&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="8009" LastEditDate="2020-05-20T20:33:01.517" LastActivityDate="2020-05-21T06:52:02.683" Title="Question about Grover algorithm implementation in the Quirk simulator" Tags="&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12091" PostTypeId="2" ParentId="12043" CreationDate="2020-05-20T03:22:26.397" Score="1" Body="&lt;p&gt;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. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/6325/2879&quot;&gt;This question&lt;/a&gt; goes into detail about using Grover's search for unordered database search, which is pretty much your example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://web.eecs.umich.edu/~imarkov/pubs/jour/cise05-grov.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; discusses the practicality of using Grover's algorithm for solving various types of problems.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-20T03:22:26.397" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12092" PostTypeId="1" AcceptedAnswerId="12121" CreationDate="2020-05-20T06:47:06.693" Score="2" ViewCount="51" Body="&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt; Is there any proposal how to build a quantum processor with full connectivity?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-22T17:37:16.637" Title="Is it possible to build a quantum processor with connections among all qubits?" Tags="&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;quantum-inspire&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12093" PostTypeId="1" AcceptedAnswerId="12100" CreationDate="2020-05-20T07:30:10.790" Score="3" ViewCount="63" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;This state may be re-written in the following way, simply by&#xA;  regrouping terms:&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;|\phi_2\rangle=\frac{1}{2}\big[|00\rangle(\alpha|0\rangle+\beta|1\rangle)+|01\rangle(\alpha|1\rangle+\beta|0\rangle)\\&#xA;+|10\rangle(\alpha|0\rangle-\beta|1\rangle)+|11\rangle(\alpha|1-\beta|0\rangle)\big]\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9906" LastEditorUserId="27" LastEditDate="2020-05-20T09:46:53.293" LastActivityDate="2020-05-20T18:27:49.437" Title="Rearrangement of qubits in Quantum Teleportation Protocol" Tags="&lt;mathematics&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12094" PostTypeId="1" AcceptedAnswerId="12098" CreationDate="2020-05-20T12:53:22.593" Score="0" ViewCount="63" Body="&lt;p&gt;Does anyone know how you can obtain a new state &lt;code&gt;|z&amp;gt;&lt;/code&gt; from two pre-existing states &lt;code&gt;|x&amp;gt;&lt;/code&gt; and &lt;code&gt;|y&amp;gt;&lt;/code&gt; using the Tensor product in &lt;code&gt;Q#&lt;/code&gt;? i.e. &lt;code&gt;|z&amp;gt; = |x&amp;gt; ⊗|y&amp;gt;&lt;/code&gt; ?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance for the help! &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: for clarity, the states that I am working with are   &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|x\rangle = \frac{1}{\sqrt{2}} \sum^{3}_{j=0} \sin \frac{\pi (j + 0.5)}{4} |j\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|y\rangle = \sum^{1}_{i=0} b_i |i\rangle$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$b_i$&lt;/span&gt;'s are just real numbers.&lt;/p&gt;&#xA;" OwnerUserId="11979" LastEditorUserId="9006" LastEditDate="2020-05-21T06:27:06.433" LastActivityDate="2020-05-21T06:27:06.433" Title="Tensor Product in Q#" Tags="&lt;programming&gt;&lt;q#&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12095" PostTypeId="1" AcceptedAnswerId="12097" CreationDate="2020-05-20T13:52:08.087" Score="1" ViewCount="67" Body="&lt;p&gt;Given the the two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; of a quantum system, with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; as their purification respectively, the fidelity is defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho,\sigma)=\max_{|\psi\rangle,|\varphi\rangle}|\langle\psi|\varphi\rangle|$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;During the derivation of the expresssion, &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi|\varphi\rangle|$&lt;/span&gt; follows this inequality:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\langle\psi|\varphi\rangle|\leq tr|\sqrt{\rho}\sqrt{\sigma}|=tr\sqrt{\rho^{\frac{1}{2}}\sigma\rho^{\frac{1}{2}}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My workings for &lt;span class=&quot;math-container&quot;&gt;$tr|\sqrt{\rho}\sqrt{\sigma}|$&lt;/span&gt; is as follows:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$tr|\sqrt{\rho}\sqrt{\sigma}|=tr\sqrt{(\sqrt{\rho}\sqrt{\sigma})^\dagger(\sqrt{\rho}\sqrt{\sigma})}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=tr\sqrt{(\sqrt{\sigma}\sqrt{\rho})(\sqrt{\rho}\sqrt{\sigma})}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=tr\sqrt{\sigma^{\frac{1}{2}}\rho\sigma^{\frac{1}{2}}} $$&lt;/span&gt;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Why do I get an expression that is different from the definition?&lt;/p&gt;&#xA;" OwnerUserId="5253" LastEditorUserId="55" LastEditDate="2020-05-22T16:25:01.887" LastActivityDate="2020-05-22T16:25:01.887" Title="Why does the state fidelity satisfy $\operatorname{tr}|\sqrt{\rho}\sqrt{\sigma}|=\operatorname{tr}\sqrt{\sigma^{1/2}\rho\sigma^{1/2}}$?" Tags="&lt;mathematics&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12096" PostTypeId="1" CreationDate="2020-05-20T14:05:56.350" Score="0" ViewCount="85" Body="&lt;p&gt;I want to execute multiple circuits in one round on IBM's backends, especially the 16-qubit one, to save time. For instance, &lt;code&gt;execute([grover_1, grover_2, grover_3], backend)&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I found &lt;code&gt;result&lt;/code&gt; given by that quantum processor contain only one overall time like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{'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}&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;while simulators can provide time counted for each circuit in the result of one instance like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;{'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}}&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for n in range(1,10):&#xA;    start = time.time()&#xA;    quantumAlgorithm(n)&#xA;    end = time.time()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12073" LastEditorUserId="12073" LastEditDate="2020-05-21T00:44:47.283" LastActivityDate="2021-02-28T14:05:50.550" Title="How to get running time for each circuit executed on IBM's quantum processors in one round?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12097" PostTypeId="2" ParentId="12095" CreationDate="2020-05-20T14:10:11.440" Score="3" Body="&lt;p&gt;The expressions are equivalent:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ F(\rho,\sigma) =\operatorname{tr}\sqrt{\sigma^{1/2}\rho\sigma^{1/2}}=&#xA;\operatorname{tr}\sqrt{\rho^{1/2}\sigma\rho^{1/2}} \\&#xA;= \operatorname{tr}|\sqrt\rho\sqrt\sigma| = &#xA;\operatorname{tr}|\sqrt\sigma\sqrt\rho| = &#xA;\max_{\psi_\rho,\psi_\sigma}|\langle\psi_\rho|\psi_\sigma\rangle|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://physics.stackexchange.com/q/409727/58382&quot;&gt;this question&lt;/a&gt; about the symmetry of the fidelity, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;the relevant Wikipedia page&lt;/a&gt;, as well as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/4664/55&quot;&gt;this question&lt;/a&gt; and links therein.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-20T14:10:11.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12098" PostTypeId="2" ParentId="12094" CreationDate="2020-05-20T15:59:18.590" Score="1" Body="&lt;p&gt;If you have an array of &lt;code&gt;Qubit&lt;/code&gt; objects, and you prepare the individual qubits into arbitrary states, then the array effectively contains the tensor product of all of the original qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To quickly illustrate what I mean:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (qubits = Qubit[2]) {&#xA;    // do something to prepare qubits[0] individually&#xA;    // do something to prepare qubits[1] individually&#xA;&#xA;    // now the state of &quot;qubits&quot; is the tensor product of the two&#xA;    // individual qubit states that you prepared&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This also generalizes if you're preparing groups of qubits within the array that you allocated.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="10473" LastEditDate="2020-05-20T16:22:11.437" LastActivityDate="2020-05-20T16:22:11.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12099" PostTypeId="1" AcceptedAnswerId="12132" CreationDate="2020-05-20T17:23:37.993" Score="3" ViewCount="44" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12044" LastEditorUserId="55" LastEditDate="2020-08-27T12:55:50.953" LastActivityDate="2020-08-27T12:55:50.953" Title="How does quantum teleportation relate to quantum encryption?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12100" PostTypeId="2" ParentId="12093" CreationDate="2020-05-20T17:33:01.797" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\phi_2$&lt;/span&gt; and expand it out more explicitly with subscripts &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for Alice and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; for Bob: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|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$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we start with the original &lt;span class=&quot;math-container&quot;&gt;$|\phi_2\rangle$&lt;/span&gt; given by e.q. 1.31&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\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)]$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A \otimes B \neq B \otimes A$&lt;/span&gt;), 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second part, Alice is measuring two qubits, one which is part of her EPR pair and the other that WAS &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. We know she can't measure &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; otherwise this would violate the no-cloning theorem as Alice and Bob would then both have a quibit in state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; at the end of teleportation!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Daftwullie gives a great explanation here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4430/quantum-teleportation-second-classical-bit-for-removing-entanglement?rq=1&quot;&gt;Quantum teleportation: second classical bit for removing entanglement?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-20T18:27:49.437" LastActivityDate="2020-05-20T18:27:49.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12101" PostTypeId="1" CreationDate="2020-05-20T17:50:31.077" Score="2" ViewCount="167" Body="&lt;p&gt;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.&#xA;Suppose the initial state of principal system is &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and the initial state of the environment is &lt;span class=&quot;math-container&quot;&gt;$\rho_{env}$&lt;/span&gt;. Let the principal-system-environment system start out in the product state &lt;span class=&quot;math-container&quot;&gt;$\rho \otimes \rho_{env}$&lt;/span&gt;. Let's say after some unitary evolution &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we want to extract the &quot;evolved&quot; state of the principal system. We do this by tracing over the environment i.e. averaging over the states of environment as shown below &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho) = tr_{env}(U(\rho \otimes \rho_{env})U^{\dagger})$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;${|e_k\rangle}$&lt;/span&gt; be some orthonormal basis of the state space of the environment and &lt;span class=&quot;math-container&quot;&gt;$\rho_{env} = |e_0\rangle\langle e_0|$&lt;/span&gt;. Then we have &#xA;&lt;a href=&quot;https://i.stack.imgur.com/z5Ztu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z5Ztu.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now in the text, it is said that &lt;span class=&quot;math-container&quot;&gt;$tr(\mathcal{E}(p))$&lt;/span&gt; can be less than 1 or &lt;span class=&quot;math-container&quot;&gt;$\sum_k E_kE^{\dagger}_k &amp;lt;I$&lt;/span&gt;. &lt;strong&gt;But how can this be true? Is the basis &lt;span class=&quot;math-container&quot;&gt;${|e_k\rangle}$&lt;/span&gt; not complete?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the text, non-trace preserving that follow the above properties are said to &quot;not provide a complete description of the process that may occur in the system&quot;. An example is used to illustrate this : &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JVCY9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JVCY9.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Granted &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_0(\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_1(\rho)$&lt;/span&gt; don't provide full description of the system but that is only because the basis for these operations are not complete. &lt;strong&gt;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 &quot;non trace preserving&quot; property?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7943" LastEditorUserId="55" LastEditDate="2020-08-27T12:56:04.490" LastActivityDate="2020-08-27T12:56:04.490" Title="Physical Interpretation of Non-Trace Preserving Quantum Operations" Tags="&lt;error-correction&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12102" PostTypeId="1" AcceptedAnswerId="12106" CreationDate="2020-05-20T17:53:23.390" Score="3" ViewCount="42" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerDisplayName="user12101" LastActivityDate="2020-05-21T07:11:53.527" Title="What does it mean geometrically (in terms of vectors in the Bloch sphere) if the commutator of two density matrices $ρ_1$ and $ρ_2$ vanishes?" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12103" PostTypeId="1" AcceptedAnswerId="12117" CreationDate="2020-05-20T19:16:47.273" Score="2" ViewCount="642" Body="&lt;p&gt;How to create Ising Hamiltonian and implement it with qiskit (the output should be in the form of  &lt;code&gt;WeightedPauliOperator&lt;/code&gt;) for the following problem:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = A \big(K - \sum_{i}^{N} t_i x_i \big)^2\\&#xA;x_i=\{0,1\}\\&#xA;t_i \in \mathbb{N}_{&amp;gt;0}\\&#xA;K\in \mathbb{N}\\&#xA;A \in \mathbb{R}_{&amp;gt;0}\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to choose any number of variables &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, that the sum &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}^{N} t_i x_i$&lt;/span&gt; will equal exactly &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10234" LastEditorUserId="434" LastEditDate="2020-05-21T13:09:24.310" LastActivityDate="2020-05-21T16:49:44.257" Title="Creating Ising Hamiltonian with Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12104" PostTypeId="1" AcceptedAnswerId="12120" CreationDate="2020-05-20T21:25:42.280" Score="7" ViewCount="315" Body="&lt;p&gt;Suppose I have a black-box unitary &lt;span class=&quot;math-container&quot;&gt;$U_p$&lt;/span&gt; which is described as follows: given a finite probability distribution &lt;span class=&quot;math-container&quot;&gt;$p:\{1,\ldots,n\}\rightarrow \mathbb{R}_{\geq0}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\sum_{x=1}^n p(x)=1$&lt;/span&gt;, the action of the black box on a basis is given by &lt;span class=&quot;math-container&quot;&gt;$$U_p:|x\rangle|0\rangle\mapsto |x\rangle |p(x)\rangle,$$&lt;/span&gt; where I am assuming I can encode each &lt;span class=&quot;math-container&quot;&gt;$p(x)$&lt;/span&gt; into some register of quantum states (say using binary encoding into qubits). Then applying &lt;span class=&quot;math-container&quot;&gt;$U_p$&lt;/span&gt; to a superposition of inputs is easy and I can easily construct a circuit that prepares the state &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{n}}\sum_{x=1}^n |x\rangle |p(x)\rangle.$$&lt;/span&gt; My question is the following, using what I have described above or otherwise how could I prepare the quantum state &lt;span class=&quot;math-container&quot;&gt;$$|p\rangle:=\sum_{x=1}^n \sqrt{p(x)}|x\rangle$$&lt;/span&gt; given access to &lt;span class=&quot;math-container&quot;&gt;$U_p$&lt;/span&gt;. I guess my question could be see as how can make this fit into the amplitude amplification scheme.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One can see that this is a generalization of the typical quantum search, since if &lt;span class=&quot;math-container&quot;&gt;$p(x)=\delta_{x,y}$&lt;/span&gt; (the distribution that is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x=y$&lt;/span&gt; and 0 if &lt;span class=&quot;math-container&quot;&gt;$x\neq y$&lt;/span&gt;) then &lt;span class=&quot;math-container&quot;&gt;$U_p$&lt;/span&gt; is the quantum black-box for one marked item quantum search, and therefore preparing the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; can be done with &lt;span class=&quot;math-container&quot;&gt;$\Theta(\sqrt{n})$&lt;/span&gt; queries to &lt;span class=&quot;math-container&quot;&gt;$U_{\delta(x,y)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I think this might boil down to someone explaining how I might implement the relative-phase like transformation &lt;span class=&quot;math-container&quot;&gt;$$ 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)$$&lt;/span&gt; using some sort of controlled rotation?&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-05-21T14:19:11.300" LastActivityDate="2020-05-21T23:31:53.057" Title="Preparing a quantum state from a classical probability distribution" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12105" PostTypeId="2" ParentId="12090" CreationDate="2020-05-21T06:52:02.683" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C1%2C1%2C1%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Chance6%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~akt%22%2C%22name%22%3A%22Oracle%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%5D%7D%7D%2C%7B%22id%22%3A%22~pb2i%22%2C%22name%22%3A%22Amplif%22%2C%22circuit%22%3A%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%2C1%2C1%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%2C1%2C1%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%2C1%2C1%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C1%2C1%2C%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gn1hY.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-05-21T06:52:02.683" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12106" PostTypeId="2" ParentId="12102" CreationDate="2020-05-21T07:11:53.527" Score="4" Body="&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{m}$&lt;/span&gt;) are parallel, i.e. there exists a real number &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\vec{n}=\alpha\vec{m}$&lt;/span&gt; (note the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; may be negative. I'm also ignoring the trivial case of &lt;span class=&quot;math-container&quot;&gt;$\vec{m}=0$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-21T07:11:53.527" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12107" PostTypeId="1" CreationDate="2020-05-21T09:17:06.400" Score="-1" ViewCount="27" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt;. My understanding was that the coefficients in this ensemble should add up to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. 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?&lt;/p&gt;&#xA;" OwnerDisplayName="user12101" LastEditorUserId="55" LastEditDate="2020-05-21T09:28:04.020" LastActivityDate="2020-05-21T09:59:11.287" Title="Can an ensemble of pure states give probability less than 1?" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12108" PostTypeId="1" AcceptedAnswerId="12110" CreationDate="2020-05-21T09:39:29.233" Score="2" ViewCount="131" Body="&lt;p&gt;I understand that the intuition behind a unitary operator is that it preserves the length of the vector it acts upon. Also &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = I$&lt;/span&gt;. Doesn't that just mean that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is just an invertible operator which preserves distance? And that &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; is the inverse?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If not&lt;/strong&gt;, where am I making my mistake in reasoning? How should I rewire my thinking to avoid this flawed paradigm?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;If so&lt;/strong&gt;, does that then mean that all distance preserving and invertible operators are also normal operators?&lt;/p&gt;&#xA;" OwnerUserId="10485" LastActivityDate="2020-05-21T12:58:02.313" Title="Why does the concept of a unitary matrix seem so similar to that of an invertible matrix?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12109" PostTypeId="2" ParentId="12107" CreationDate="2020-05-21T09:59:11.287" Score="0" Body="&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$\rho\equiv\sum_{ijk\ell}\rho_{ij,k\ell}|ij\rangle\!\langle k\ell|$&lt;/span&gt;, the reduced state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_A = \sum_{ik} \left(\sum_j \rho_{ij,kj} \right)|i\rangle\!\langle k|.$$&lt;/span&gt;&#xA;Therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}(\rho_A)\equiv \sum_i (\rho_A)_{ii} = \sum_{ijk}\rho_{ij,ij}=1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equivalently,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}(\rho_A)=\operatorname{Tr}(\operatorname{Tr}_B(\rho))&#xA;= (\operatorname{Tr}_A\otimes\operatorname{Tr}_B)\rho=\operatorname{Tr}(\rho)=1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-21T09:59:11.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12110" PostTypeId="2" ParentId="12108" CreationDate="2020-05-21T11:34:36.577" Score="5" Body="&lt;p&gt;This is one of the definitions of a unitary &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; a (bounded) linear surjective map that preserves distances (the inner product). From this it can be deduced that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is invertible and &lt;span class=&quot;math-container&quot;&gt;$U^{-1} = U^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also, it's enough to require the preservation of the lengths of all vectors (instead of all inner products) due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Polarization_identity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polarization identity&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unitaries are normal because &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U =  U U^\dagger$&lt;/span&gt;, clearly.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-21T12:58:02.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12111" PostTypeId="1" CreationDate="2020-05-21T11:40:25.303" Score="6" ViewCount="39" Body="&lt;p&gt;According to the circuit model, the output for a quantum computation on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit string. But what if we instead got a full two qubit tomography for all &lt;span class=&quot;math-container&quot;&gt;$n(n-1)$&lt;/span&gt; pairs of qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\textrm{poly}(n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For algorithms with random outputs (like Shor's which gives random factors), things might be more tricky.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what kinds of algorithms could be run with this restriction? And what kind of speed-ups could be obtained?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2020-05-21T11:40:25.303" Title="If we could only get two-qubit tomography as an output, what algorithms are possible" Tags="&lt;algorithm&gt;&lt;tomography&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12112" PostTypeId="1" AcceptedAnswerId="12119" CreationDate="2020-05-21T12:19:17.560" Score="4" ViewCount="178" Body="&lt;p&gt;From a few VQE tutorials online I see that they normally start with something like:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://cstheory.stackexchange.com/a/2810&quot;&gt;not a hard problem&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question then is&lt;/strong&gt; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="10485" LastEditDate="2020-05-21T14:29:58.130" LastActivityDate="2020-05-21T20:45:41.303" Title="What's the point of VQE if classical computers can solve for eigenvalues easily?" Tags="&lt;vqe&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12113" PostTypeId="1" AcceptedAnswerId="12122" CreationDate="2020-05-21T13:22:12.513" Score="8" ViewCount="653" Body="&lt;p&gt;Starting from:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-i\hbar \frac{d|\psi⟩}{dt} = H|\psi⟩&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was able to do some working to prove that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in the corresponding discrete representation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t_1,t_2) = exp\frac{-iH(t_2-t_1)}{\hbar}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;is unitary if and only if &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian. That is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^\dagger(t_1,t_2)U(t_1,t_2) = I \iff H = H^\dagger&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Cool! But now I'm stuck trying to understand the physical significance of the fact that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian. I try to see &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as a &quot;velocity function&quot; because it gives the instantaneous change in &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩$&lt;/span&gt;. That's as far as my intuition goes in terms of understanding the Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So what's another intuitive way of understanding why the Hamiltonian must be Hermitian? And as a bonus, can the Hamiltonian also be unitary?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the following &quot;intuitive&quot; description works best for me (the answers led me here):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we start from my idea that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is like a &quot;velocity function&quot; that takes as input the current state vector &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩$&lt;/span&gt; and spits out the infinitesimal change &lt;span class=&quot;math-container&quot;&gt;$d|\psi⟩/dt$&lt;/span&gt;. Now we consider two things:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;1) &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩ = \sum_i{c_i}|\psi_i⟩$&lt;/span&gt; (where I've just expressed &lt;span class=&quot;math-container&quot;&gt;$|\psi⟩$&lt;/span&gt; as a weighted sum over basis vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi_i⟩$&lt;/span&gt;), you end up getting &lt;span class=&quot;math-container&quot;&gt;$\sum_iR_ic_i|\psi_i⟩$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$R_i$&lt;/span&gt; are purely real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) But then we also consider that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is also multiplied by &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is like an instantaneous tangential nudge to the vector. So by integrating, the corresponding discrete operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary.&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="10485" LastEditDate="2020-05-22T16:44:17.683" LastActivityDate="2020-05-25T12:42:47.350" Title="Why does a Hamiltonian have to be Hermitian?" Tags="&lt;quantum-state&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12114" PostTypeId="2" ParentId="12113" CreationDate="2020-05-21T13:31:57.080" Score="2" Body="&lt;p&gt;I will basically quote directly from Susskind as its a great explanation. First of all being Hermitian tells us that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is an observable, secondly, it has a complete set of eigenvectors and eigenvalues that define the energy levels of the system by spectral decompsition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H = \sum E |E\rangle \langle E|$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To derive the condition for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = I$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;based on smoothness of time evolution we also require &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be of the form that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U = I - i\epsilon H$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;thus for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to remain unitary we must have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = \left(I + i\epsilon H^\dagger\right)\left(I - i\epsilon H\right) = I$&lt;/span&gt;, &lt;/p&gt;&#xA;&#xA;&lt;p&gt;expanding this out we find that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H^\dagger - H = 0$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which is our condition of being Hermitian. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be unitary? For &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to have a spectral decomposition the eigenvalues need to be real, and we cannot guarantee this for a unitary. Secondly for &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to be Unitary and Hermitian, this means that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H = (2P - I)$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is an orthogonal projector. This will have eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, thus you will have degenerate energy levels. So yes you can, but you are rather limited.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="23" LastEditDate="2020-05-21T15:22:35.157" LastActivityDate="2020-05-21T15:22:35.157" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12115" PostTypeId="1" AcceptedAnswerId="12118" CreationDate="2020-05-21T14:26:36.337" Score="0" ViewCount="95" Body="&lt;p&gt;With regard to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10078/12108&quot;&gt;this&lt;/a&gt; question/answer:&lt;/p&gt;&#xA;&lt;p&gt;How's the generalized behaviour of a two-qubit gate for the resulting two qubits?&lt;/p&gt;&#xA;&lt;p&gt;Here e.g. CNOT:&lt;/p&gt;&#xA;&lt;p&gt;If I apply the CNOT matrix to the tensor product, also the control qubit seems to get affected:&lt;/p&gt;&#xA;&lt;p&gt;Control qubit&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{ctrl} = \begin{pmatrix} x \\ y \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Target qubit&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{target} = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Tensor product tp:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{tp} = \text{ctrl} \otimes \text{target} = &#xA;\begin{pmatrix} x \\ y \end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix} \alpha \\ \beta \end{pmatrix}&#xA;=&#xA;\begin{pmatrix} x\alpha \\ x\beta \\ y\alpha \\ y\beta \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Applying the CNOT gate with control qubit a and target qubit b:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{res}_1 = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ &#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ &#xA;\end{pmatrix}&#xA;\begin{pmatrix} x\alpha \\ x\beta \\ y\alpha \\ y\beta \end{pmatrix}&#xA;=&#xA;\begin{pmatrix} x\alpha \\ x\beta \\ y\beta \\ y\alpha \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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?)?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{res}_\text{target} = \begin{pmatrix} x\alpha \\ x\beta \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does the control qubit also get affected in that case? e.g.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{res}_\text{ctrl} = \begin{pmatrix} y\beta \\ y\alpha \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Clearly building the tensor product of those two results wouldn't result in the&lt;/p&gt;&#xA;" OwnerUserId="12108" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-23T07:17:52.417" Title="Generic maths for two-qubit gates" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="0" ClosedDate="2020-08-12T21:15:03.133" ContentLicense="CC BY-SA 4.0" />
  <row Id="12116" PostTypeId="2" ParentId="12115" CreationDate="2020-05-21T16:04:47.403" Score="1" Body="&lt;p&gt;So it is easier to understand if we properly write out the state of the system:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\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$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;you can see now that the cnot will only invoke &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; on the second qubit when the first qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, so the output state afterwards will be:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$C^1(\sigma_x)|\phi\rangle = x\alpha|00\rangle + x\beta |01\rangle + y\beta |10\rangle + y\alpha|11\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-05-21T16:26:04.660" LastActivityDate="2020-05-21T16:26:04.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12117" PostTypeId="2" ParentId="12103" CreationDate="2020-05-21T16:49:44.257" Score="4" Body="&lt;p&gt;You can use Qiskit's new optimization module. This allows you to use &lt;code&gt;docplex&lt;/code&gt; to build your model:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# required imports&#xA;from docplex.mp.model import Model&#xA;from qiskit.optimization.problems import QuadraticProgram&#xA;from qiskit.optimization.converters import QuadraticProgramToIsing&#xA;&#xA;# specify problem&#xA;n = 3&#xA;a = 1.0&#xA;k = 2&#xA;t = range(1, n+1)&#xA;&#xA;# build model with docplex&#xA;mdl = Model()&#xA;x = [mdl.binary_var() for i in range(n)]&#xA;objective = a*(k - mdl.sum(t[i]*x[i] for i in range(n)))**2&#xA;mdl.minimize(objective)&#xA;&#xA;# convert to Qiskit's quadratic program&#xA;qp = QuadraticProgram()&#xA;qp.from_docplex(mdl)&#xA;&#xA;# convert to Ising Hamiltonian&#xA;qp2ising = QuadraticProgramToIsing()&#xA;H, offset = qp2ising.encode(qp)&#xA;print('Offset:', offset)&#xA;print('Ising Hamiltonian:')&#xA;print(H.print_details())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Offset: 4.5&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;Ising Hamiltonian: &lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;IIZ   (-1+0j)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;IZI   (-2+0j)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;ZII   (-3+0j)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;IZZ   (1+0j)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;ZIZ   (1.5+0j)&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;ZZI   (3+0j)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You can find some tutorials introducing the functionality here:&#xA;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/optimization/index.html&lt;/a&gt;&#xA;or here&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/tree/master/tutorials/optimization&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/tree/master/tutorials/optimization&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10429" LastActivityDate="2020-05-21T16:49:44.257" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12118" PostTypeId="2" ParentId="12115" CreationDate="2020-05-21T18:43:12.780" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2*2=2+2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So you are correct in getting&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;x\alpha\\&#xA;x\beta\\&#xA;y\beta\\&#xA;y\alpha&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That was just a coincidence in in the other answer. &lt;span class=&quot;math-container&quot;&gt;$x=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y=0$&lt;/span&gt; there so the top two happened to give you the correct coefficients for something you could interpret as &lt;span class=&quot;math-container&quot;&gt;$res_{target}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But in this case you can't get back to something of the form &lt;span class=&quot;math-container&quot;&gt;$res_{control} \otimes res_{target}$&lt;/span&gt;, let alone being able to read them off from a direct sum decomposition.&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2020-05-21T18:43:12.780" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12119" PostTypeId="2" ParentId="12112" CreationDate="2020-05-21T20:40:14.393" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.)&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider, as an example, a Hamiltonian describing a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; particles. The Hilbert space size in this case grows with the number of particles as &lt;span class=&quot;math-container&quot;&gt;$N=O(\operatorname{exp}(n))$&lt;/span&gt;. For any reasonable encoding, the number of qubits required to encode the state of such a system in a quantum computer grows as &lt;span class=&quot;math-container&quot;&gt;$O(\operatorname{poly}(n))$&lt;/span&gt;. If you want to use VQE, the other parameters you are concerned with are:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The number of Pauli operators in the expansion of the Hamiltonian — grows as &lt;span class=&quot;math-container&quot;&gt;$O(\operatorname{poly}(n))$&lt;/span&gt; for local interactions.&lt;/li&gt;&#xA;&lt;li&gt;The number of gates required to prepare an ansatz state — grows as &lt;span class=&quot;math-container&quot;&gt;$O(\operatorname{poly}(n))$&lt;/span&gt; for many known cases (e.g. look up UCCSD for quantum chemistry: &lt;a href=&quot;https://arxiv.org/abs/1701.02691&quot; rel=&quot;noreferrer&quot;&gt;one&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1803.10238&quot; rel=&quot;noreferrer&quot;&gt;two&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Therefore, in this case all the quantum resources grow polynomially in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Memory; number of gates; number of measurements &lt;span class=&quot;math-container&quot;&gt;$=O(\operatorname{poly}(n))$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the classical case, one would have to generally deal with vectors and matrices in &lt;span class=&quot;math-container&quot;&gt;$N = O(\operatorname{exp(n)})$&lt;/span&gt; dimensions. Therefore, in this case we clearly have an improvement in memory and, quite likely, in the number of operations (asymptotically) as well.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-05-21T20:45:41.303" LastActivityDate="2020-05-21T20:45:41.303" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12120" PostTypeId="2" ParentId="12104" CreationDate="2020-05-21T22:41:44.310" Score="3" Body="&lt;p&gt;Suppose we have two quantum circuits, the first computes (or at least approximates) the classical &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\cdot}$&lt;/span&gt; function &lt;span class=&quot;math-container&quot;&gt;$$S|x\rangle|0\rangle=|x\rangle |\sqrt{x}\rangle,$$&lt;/span&gt; while the second circuit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; computes (again could probably just approximate) the &lt;span class=&quot;math-container&quot;&gt;$\arccos(\cdot)$&lt;/span&gt; function &lt;span class=&quot;math-container&quot;&gt;$$A|x\rangle|0\rangle=|x\rangle |\arccos(x)\rangle.$$&lt;/span&gt; Lastly, suppose we have are able to preform controlled single qubit rotation (or at least approximately preform these) &lt;span class=&quot;math-container&quot;&gt;$$R|\theta\rangle|0\rangle=|\theta\rangle(\cos(\theta)|0\rangle+\sin(\theta)|1\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then using the oracle &lt;span class=&quot;math-container&quot;&gt;$$U_p|x\rangle|0\rangle=|x\rangle|p(x)\rangle,$$&lt;/span&gt; along with a bunch of auxiliary qubits (which I won't write out in detail) we can create a circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; which computes (or at least approximates) the state &lt;span class=&quot;math-container&quot;&gt;$$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).$$&lt;/span&gt; Now, using &lt;span class=&quot;math-container&quot;&gt;$\log(n)$&lt;/span&gt; qubits we can create the superposition &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{n}}\sum_{x=1}^n |x\rangle$&lt;/span&gt; using Hadamards. Applying &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; to this superposition we can create the state &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{n}}\sum_{x=1}^n(\sqrt{p(x)})|0\rangle+\sqrt{1-p(x)})|1\rangle)|x\rangle.$$&lt;/span&gt; If we rewrite this state as &lt;span class=&quot;math-container&quot;&gt;$$\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\\&#xA;=\sqrt{\tfrac{1}{n}}|p\rangle|0\rangle+\sqrt{\tfrac{n-1}{n}}|\tilde{p}\rangle|1\rangle.$$&lt;/span&gt; Then it is clear that the amplitude amplification algorithm will output the state &lt;span class=&quot;math-container&quot;&gt;$|p\rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\Theta(\sqrt{n})$&lt;/span&gt; queries with high probability.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-05-21T23:31:53.057" LastActivityDate="2020-05-21T23:31:53.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12121" PostTypeId="2" ParentId="12092" CreationDate="2020-05-22T00:57:13.460" Score="2" Body="&lt;p&gt;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, &lt;a href=&quot;https://www.nature.com/articles/s41467-019-13534-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41467-019-13534-2&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So if by &quot;full connectivity&quot; you really mean all-to-all connectivity, such that you can execute gates directly between any arbitrary pair of qubits, this requires &lt;span class=&quot;math-container&quot;&gt;$n(n-1)/2$&lt;/span&gt; physical connections between qubits. It really seems that this becomes infeasible for large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; beyond, say, a few hundred. Even going to three-dimensional structures wouldn't get you too far.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="10473" LastEditDate="2020-05-22T17:37:16.637" LastActivityDate="2020-05-22T17:37:16.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12122" PostTypeId="2" ParentId="12113" CreationDate="2020-05-22T02:26:19.340" Score="2" Body="&lt;p&gt;&lt;strong&gt;More Pragmatic Answer after Dialogue with OP in Comments&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rearranging the wave equation in the question to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d \vert \Psi \rangle}{dt} = \frac{i}{\hbar} H \vert \Psi \rangle \tag{1}$$&lt;/span&gt;&#xA;should make it obvious that wavefunction takes the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \Psi \rangle = e^{\frac{i}{\hbar} H t}. \tag{2}$$&lt;/span&gt;&#xA;However, the wavefunction is not only a function of time, but also of position.  We can&lt;span class=&quot;math-container&quot;&gt;${}^\ast$&lt;/span&gt; think about the time evolution of the system as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \Psi(t) \rangle = e^{\frac{i}{\hbar}Et} \vert \psi_{r} \rangle, \tag{3}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_{r} \rangle$&lt;/span&gt; depends on the position within some coordinate system and is independent of time, and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; generally represents the energy in the system, which is a scalar value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can now consider the time derivative of Eqs. (2) and (3) in the &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_r \rangle$&lt;/span&gt; basis,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&#xA;and rearrange to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\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.$$&lt;/span&gt;&#xA;The second equality here is the eigenvalue equation.  It follows directly that if we need energy to be real and positive, which we do, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; must have positive real eigenvalues.  The eigenvalue equation above also implies that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is diagonalizable.  As noted in the comments to your question, these two conditions are sufficient to require that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;${}^\ast$&lt;/span&gt;&lt;/strong&gt; After thinking about this some more, I should point out that Eq. (3) amounts to an assumption that at least one eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi \rangle$&lt;/span&gt; can be expressed as a function of time (independent of position).  Similarly, Eq. (4) amounts to an assumption that the positional basis &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_r \rangle$&lt;/span&gt; is independent of time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Einstein showed that these assumptions are only low velocity approximations, &lt;em&gt;i.e.&lt;/em&gt; that time is not independent of space.  This is one way of seeing why the Shrödinger equation is inherently non-relativistic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Original Less Pragmatic Answer/Geometric Intuition Regarding Hermitian Matrices&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The intuition behind Hermitian matrices, is that they are the &quot;real&quot; matrices in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{n \times n}$&lt;/span&gt;. The most basic property of any Hermitian matrix (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;) is that it equals its conjugate transpose &lt;span class=&quot;math-container&quot;&gt;$H=H^\dagger$&lt;/span&gt; (in direct analogy to &lt;span class=&quot;math-container&quot;&gt;$r \in \mathbb{R}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$r = r^\ast$&lt;/span&gt;).  Equally fundamental, a Hermitian matrix has real eigenvalues and it's eigenvectors form a unitary basis that diagonalizes &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the familiar case of generating a 1-sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^1$&lt;/span&gt; by taking the exponent &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta}$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\theta \in \mathbb{R}$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$i\theta$&lt;/span&gt; is a purely imaginary value.  In this case, our implicit real basis for the real parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and not very interesting.  If we wanted to be pedantic we could call &lt;span class=&quot;math-container&quot;&gt;$[1]$&lt;/span&gt; a &lt;span class=&quot;math-container&quot;&gt;$1 \times 1$&lt;/span&gt; Hermitian matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the same manner, we can generate a 3-sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2 \times 2}$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$U = e^{\frac{i}{2} \vec{\phi} \, \cdot \, \vec{\sigma}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\vec \phi$&lt;/span&gt; is a vector in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vec \sigma$&lt;/span&gt; are the three Hermitian &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli matrices&lt;/a&gt; (which are much more interesting than &lt;span class=&quot;math-container&quot;&gt;$[1]$&lt;/span&gt;).  This guarantees that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is an arbitrary element of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, which is isomorphic to the 3-sphere.  Setting &lt;span class=&quot;math-container&quot;&gt;$\vec \phi = \alpha (\hat \phi_1, \hat \phi_2, \hat \phi_3)$&lt;/span&gt;, Taylor expansion gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=e^{\frac{i}{2} \vec{\phi} \, \cdot \, \vec{\sigma}}=\begin{bmatrix} \cos \frac{\alpha}{2} + i \hat \phi_3 \sin \frac{\alpha}{2} &amp;amp; \sin \frac{\alpha}{2} (\hat \phi_2 + i \hat \phi_1) \\ \sin \frac{\alpha}{2} (-\hat \phi_2 + i \hat \phi_1) &amp;amp; \cos \frac{\alpha}{2}- i \hat \phi_3 \sin \frac{\alpha}{2} \end{bmatrix}.$$&lt;/span&gt;&#xA;The elements of the Pauli basis generate a representation of the (real) Lie algebra &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{su_2}$&lt;/span&gt;, and are related to the three independent rotations (&lt;span class=&quot;math-container&quot;&gt;$R_n$&lt;/span&gt;), by &lt;span class=&quot;math-container&quot;&gt;$\sigma_n = 2i \frac{\partial R_n}{\partial\alpha} |_{\alpha=0}$&lt;/span&gt;.  Although &lt;span class=&quot;math-container&quot;&gt;$\sigma_2$&lt;/span&gt; makes use of imaginary numbers, the Pauli basis is real in all the ways that matter.  For example &lt;span class=&quot;math-container&quot;&gt;$\sigma_n^2 = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(\vec \phi  \cdot  \vec \sigma)^2 = \vert \vec \phi \vert^2$&lt;/span&gt;.  Just as in the case of &lt;span class=&quot;math-container&quot;&gt;$i \theta$&lt;/span&gt;, when we multiply the &lt;span class=&quot;math-container&quot;&gt;$\sigma_n$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, they become purely imaginary, i.e. &lt;span class=&quot;math-container&quot;&gt;$(i \sigma_n)^2 = -I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(i \vec \phi \cdot  \vec \sigma)$&lt;/span&gt; is isomorphic to the pure quaternions (the imaginary part of the quaternions).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Recalling that &lt;span class=&quot;math-container&quot;&gt;$\sigma_n^2 = I$&lt;/span&gt;, if we forgo the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in the exponentiation, we get something directly analogous to the 1-dimensional case of exponentiating with the split complex number, &lt;span class=&quot;math-container&quot;&gt;$k^2=1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$e^{k \beta} = \cosh{\beta} + k \sinh{\beta}$&lt;/span&gt;.  In the three dimensional case we have, by Taylor expansion again:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ V = e^{\frac{1}{2} \vec \phi \, \cdot \, \vec \sigma} = \begin{bmatrix} \cosh \frac{\alpha}{2} + \hat \phi_3 \sinh \frac{\alpha}{2} &amp;amp; \sinh \frac{\alpha}{2} (\hat \phi_1 - i \hat \phi_2) \\ \sinh \frac{\alpha}{2} (\hat \phi_1 + i \hat \phi_2) &amp;amp; \cosh \frac{\alpha}{2} - \hat \phi_3 \sinh \frac{\alpha}{2}  \end{bmatrix}, $$&lt;/span&gt;&#xA;which are Hermitian matrices with unit determinant and Minkowski signature &lt;span class=&quot;math-container&quot;&gt;$(+,-,-,-)$&lt;/span&gt;.  This matrix can be directly identified with a real 4-vector as discussed below.  The 1-dimensional projection operators &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(1 \pm k)$&lt;/span&gt; are also strikingly similar to the 3-dimensional Hermitian projection operators &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(I \pm \hat \phi \cdot \vec \sigma)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pauli used his namesake matrices to formulate the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli equation&lt;/a&gt;, 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Gamma_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;gamma matrices&lt;/a&gt;, which enabled him to formulate the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dirac_equation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dirac equation&lt;/a&gt;, which was one of the great breakthroughs of the past century.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially if we take a direct sum &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{su}_2$&lt;/span&gt; (which generates the element &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; above) with &lt;span class=&quot;math-container&quot;&gt;$i \mathfrak{su}_2$&lt;/span&gt; (which generates &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; above) we get the 6-dimensional (complex) Lie algebra &lt;span class=&quot;math-container&quot;&gt;$sl_{2 \mathbb{C}}$&lt;/span&gt;, which generates the universal cover of the Lorentz group &lt;span class=&quot;math-container&quot;&gt;$SL(2,\mathbb{C})$&lt;/span&gt;, providing both Lorentzian rotations (&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;), boosts (&lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;) and combinations of the two (&lt;span class=&quot;math-container&quot;&gt;$L \in SL(2,\mathbb{C}$&lt;/span&gt;)).  In other words, any &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; has unique left and right polar decompositions as &lt;span class=&quot;math-container&quot;&gt;$UV_R$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$V_L U$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is analogous to a radius, and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to an angle. (&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; commute iff they share the same unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat \phi$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Wheeler calls the matrix &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;, which effects an arbitrary Lorentz transformation, a Lorentzian spin transformation matrix.  &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; acts on an Hermitian &quot;coordinate-generating spin matrix&quot; (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;),&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X=\begin{bmatrix} t + z &amp;amp; x-iy \\ x+iy &amp;amp; t-z \end{bmatrix},$$&lt;/span&gt;&#xA;(note the same Hermitian structure and Minkowski signature as &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;) according to &lt;span class=&quot;math-container&quot;&gt;$X^\prime = L X L^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The structure &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; ensures that &lt;span class=&quot;math-container&quot;&gt;$X^\prime$&lt;/span&gt; remains Hermitian by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (X^\prime)^\dagger = (LXL^\dagger)^\dagger = (L^\dagger)^\dagger(X)^\dagger(L)^\dagger = LXL^\dagger = X^\prime $$&lt;/span&gt;&#xA;and thus &lt;span class=&quot;math-container&quot;&gt;$(t,x,y,z) \mapsto (t',x',y',z')$&lt;/span&gt; remains real.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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) &quot;In an infinitesimal unitary rotation of a vector field the velocity &lt;span class=&quot;math-container&quot;&gt;$\frac{d \chi}{d \tau}$&lt;/span&gt; is related to &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; by by means of a correspondence whose matrix is i times an Hermitian matrix.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; I forgot to answer the bonus question.  The Pauli matrices are both unitary and Hermitian.  The Hadamard matrix,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}} \end{bmatrix}, $$&lt;/span&gt;&#xA;which is prominent in QIS/QIT, is also unitary and Hermitian.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-05-25T12:42:47.350" LastActivityDate="2020-05-25T12:42:47.350" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="12123" PostTypeId="2" ParentId="12009" CreationDate="2020-05-22T04:58:47.653" Score="1" Body="&lt;p&gt;A somewhat informal comment. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$v_1$&lt;/span&gt; moving away from &lt;span class=&quot;math-container&quot;&gt;$v_2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and as far as &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; apart from each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt;): while for vectors we have &lt;span class=&quot;math-container&quot;&gt;$d(|\psi\rangle,|\psi'\rangle)=|\langle \psi | \psi' \rangle|$&lt;/span&gt;, for the corresponding pure density matrices we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$d(|\psi\rangle\langle\psi|, &#xA;|\psi'\rangle\langle\psi'|) &#xA;=\operatorname{tr} (|\psi\rangle\langle\psi||\psi'\rangle\langle\psi'| )$&lt;/span&gt;, which is obtained by squaring the previous expression. &lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-05-22T13:21:16.450" LastActivityDate="2020-05-22T13:21:16.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12124" PostTypeId="2" ParentId="12115" CreationDate="2020-05-22T07:37:01.870" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can see this nicely on coefficents. While &lt;span class=&quot;math-container&quot;&gt;$x\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x\beta$&lt;/span&gt; remained on same places in output vector, &lt;span class=&quot;math-container&quot;&gt;$y\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y\beta$&lt;/span&gt; are switched. It is not possible to find tensor product of two vectors which would allow you to have &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; on first and second coordinate, respectivelly and then &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; on first (third) and second (fourth), respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(|00\rangle)=|00\rangle=|0\rangle\otimes|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(|01\rangle)=|01\rangle=|0\rangle\otimes|1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(|10\rangle)=|11\rangle=|1\rangle\otimes|1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(|11\rangle)=|10\rangle=|1\rangle\otimes|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-05-23T07:17:52.417" LastActivityDate="2020-05-23T07:17:52.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12125" PostTypeId="1" AcceptedAnswerId="12126" CreationDate="2020-05-22T09:46:38.053" Score="2" ViewCount="144" Body="&lt;p&gt;I'm confused about the state of a system after a measurement. Say we have a particle &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; in the state: &lt;span class=&quot;math-container&quot;&gt;$ |\psi\rangle= \sqrt{1/4} \ |0\rangle + \sqrt{3/4} \ |1\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;From my understanding, if one were to measure the state of &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;, one would get the result &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\sqrt{1/4}|^2=1/4$&lt;/span&gt;, and similarly, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$3/4$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I've also learned that a measurement is always done by an observable (a unitary operator), e.g. &lt;span class=&quot;math-container&quot;&gt;$Z=|0\rangle \langle 0|-|1\rangle \langle 1|$&lt;/span&gt;, 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, by inspection, I noticed that when I measure &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, I do get the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/4$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$3/4$&lt;/span&gt;, as expected.  But I don't get these results when I measure the Pauli operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, for example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does that mean that the claim in my second paragraph always assumes a measurement of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;? &lt;/p&gt;&#xA;" OwnerUserId="10033" LastActivityDate="2020-05-22T12:22:25.390" Title="Confusion about the state of a system after a measurement" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12126" PostTypeId="2" ParentId="12125" CreationDate="2020-05-22T10:43:38.313" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis measurement means that after the measurement we will have either &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state (the eigenbasis vectors for the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator). To see the corresponding probabilities we should rewrite the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; state in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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) = \\&#xA;= \left(\frac{1 + \sqrt{3}}{\sqrt{2^3}}\right)|+\rangle + \left(\frac{1 - \sqrt{3}}{\sqrt{2^3}}\right)|-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;. The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$\left| \frac{1 + \sqrt{3}}{\sqrt{2^3}}\right|^2$&lt;/span&gt; and the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$\left| \frac{1 - \sqrt{3}}{\sqrt{2^3}}\right|^2$&lt;/span&gt;. In general case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \alpha |0\rangle + \beta |1\rangle = \frac{\alpha + \beta}{\sqrt{2}} |+\rangle + \frac{\alpha - \beta}{\sqrt{2}} |-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The statement in the second paragraph of the question assumes that the measurement is done in &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis because &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are eigenbasis vectors of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator. If we will do a measurement in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis we will never have &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state after the measurement.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-22T11:37:22.440" LastActivityDate="2020-05-22T11:37:22.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12127" PostTypeId="1" CreationDate="2020-05-22T10:43:44.807" Score="1" ViewCount="47" Body="&lt;p&gt;There is &lt;code&gt;DOcplex&lt;/code&gt; module that generates &lt;code&gt;WeightedPauliOperator&lt;/code&gt; for the &lt;a href=&quot;http://ibmdecisionoptimization.github.io/docplex-doc/mp/docplex.mp.model.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DOcplex Model&lt;/a&gt; by calling docplex.get_operator(model). I want to understand what are the steps for creating the qubit operators (List of &lt;code&gt;WeightedPauliOperator&lt;/code&gt;) without DOcplex module?&#xA;As I understand it is necessary to map problem to QUBO form.&lt;/p&gt;&#xA;" OwnerUserId="10234" LastActivityDate="2020-05-22T10:43:44.807" Title="Creating qubit operators for optimization problem" Tags="&lt;algorithm&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12128" PostTypeId="2" ParentId="12101" CreationDate="2020-05-22T11:11:53.773" Score="2" Body="&lt;p&gt;Let's consider a simple example to try and clarify the issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider a one-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; measured in the computational basis.&#xA;You can describe the results of such a measurement via the map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; acting as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\ketbra}[1]{|#1\rangle\!\langle #1|}\Phi(|i\rangle\!\langle j|)=\delta_{ij}\ketbra i,$$&lt;/span&gt;&#xA;so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(\ketbra\psi)=|\alpha|^2\ketbra0+|\beta|^2\ketbra1.$$&lt;/span&gt;&#xA;You can equivalently write this map as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(\rho)=\operatorname{Tr}_E[U(\rho\otimes\ketbra0)U^\dagger]$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|0,0\rangle\equiv|0,0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1,0\rangle=|1,1\rangle$&lt;/span&gt; (more generally, any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|0,0\rangle=|0,u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1,0\rangle=|1,u_\perp\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\langle u|u_\perp\rangle=0$&lt;/span&gt; does the job).&#xA;The corresponding Kraus operators are then&#xA;&lt;span class=&quot;math-container&quot;&gt;$E_0=\ketbra0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_1=\ketbra1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, what happens if I consider another map &lt;span class=&quot;math-container&quot;&gt;$\tilde\Phi(\rho)=E_0\rho E_0^\dagger$&lt;/span&gt;? Clearly this is not trace-preserving, and the physical interpretation of this is that you are &lt;em&gt;not&lt;/em&gt; describing the full array of possible outputs. Because any physical process always gives &lt;em&gt;some&lt;/em&gt; output state (by the definition itself of what &quot;process&quot; means here), there must always be a trace-preserving map describing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example is &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)=\ketbra0$&lt;/span&gt;, which corresponds to &lt;span class=&quot;math-container&quot;&gt;$E_0=|0\rangle\!\langle0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_1=|0\rangle\!\langle 1|$&lt;/span&gt;. Now a corresponding non-trace-preserving version could be &lt;span class=&quot;math-container&quot;&gt;$\tilde\Phi(\rho)=E_0\rho E_0^\dagger$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; when the environment has been found in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, that is, as the output state of the system post-selected over an environment state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-05-23T07:07:16.213" LastActivityDate="2020-05-23T07:07:16.213" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12130" PostTypeId="1" CreationDate="2020-05-22T12:18:51.530" Score="2" ViewCount="120" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do this with Q#?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So by doing that I think,I can entangle two qubits in Sample Quantum Random Number Generator &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation SampleQuantumRandomNumberGenerator() : Result {&#xA;// Allocate two qubits&#xA;using ((q1, q2) = (Qubit(), Qubit()))  {&#xA;    // Prepare Bell state (|00⟩ + |11⟩) / sqrt(2) on them&#xA;    H(q1);&#xA;    CNOT(q1, q2);&#xA;    // The measurement results are going to be correlated: you get 0,0 in 50% of the cases and 1,1 in 50%&#xA;    return (MResetZ(q1) == Zero ? 0 | 1, &#xA;            MResetZ(q2) == Zero ? 0 | 1);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 ? &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation SampleRandomNumberInRange(max : Int) : Int {&#xA;    mutable bits = new Result[0];&#xA;    for (idxBit in 1..BitSizeI(max)) {&#xA;        set bits += [SampleQuantumRandomNumberGenerator()];&#xA;    }&#xA;    let sample = ResultArrayAsInt(bits);&#xA;    return sample &amp;gt; max&#xA;           ? SampleRandomNumberInRange(max)&#xA;           | sample;&#xA;}&#xA;&#xA;@EntryPoint()&#xA;operation SampleRandomNumber() : Int {&#xA;    let max = 100;&#xA;    Message($&quot;Sampling a random number between 0 and {max}: &quot;);&#xA;    return SampleRandomNumberInRange(max);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11913" LastEditorUserId="11913" LastEditDate="2020-05-24T08:53:08.770" LastActivityDate="2020-05-24T08:53:08.770" Title="Are there patterns in the numbers created with qrng by entangled qubits?" Tags="&lt;programming&gt;&lt;entanglement&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="12131" PostTypeId="2" ParentId="12125" CreationDate="2020-05-22T12:22:25.390" Score="2" Body="&lt;p&gt;Yes, the claim in your second paragraph implicitly assumes a measurement of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are not well-defined unless you specify which basis you're referring to (e.g. the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis). To make this completely clear, it's better to write out the states as &lt;span class=&quot;math-container&quot;&gt;$|Z = 0\rangle$&lt;/span&gt;and &lt;span class=&quot;math-container&quot;&gt;$|Z = 1\rangle$&lt;/span&gt; whenever there's any ambiguity as to the basis.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-05-22T12:22:25.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12132" PostTypeId="2" ParentId="12099" CreationDate="2020-05-22T16:09:25.327" Score="1" Body="&lt;p&gt;The question reads like quantum encryption is a special example of quantum teleportation, which is not the case. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9626" LastActivityDate="2020-05-22T16:09:25.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12133" PostTypeId="2" ParentId="11861" CreationDate="2020-05-22T17:54:37.203" Score="6" Body="&lt;p&gt;Ross and Selinger have solved this problem here: &lt;a href=&quot;https://arxiv.org/abs/1403.2975&quot; rel=&quot;noreferrer&quot;&gt;Optimal ancilla-free Clifford+T approximation of z-rotations&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and provide a command-line tool for generating Clifford+T approximations to Rz gates, which you can download here: &lt;a href=&quot;https://www.mathstat.dal.ca/~selinger/newsynth/&quot; rel=&quot;noreferrer&quot;&gt;https://www.mathstat.dal.ca/~selinger/newsynth/&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="9626" LastEditorUserId="9006" LastEditDate="2020-05-23T07:05:51.337" LastActivityDate="2020-05-23T07:05:51.337" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12134" PostTypeId="2" ParentId="12113" CreationDate="2020-05-22T18:00:25.447" Score="1" Body="&lt;p&gt;Let's say we take for granted that physical states are described by complex vectors &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb C^n$&lt;/span&gt; defined up to their normalisation and (global) phase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Unitaries are the general way to map states to states&lt;/em&gt;&lt;/strong&gt;) We now want to describe how these things evolve in time.&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. We want this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to map states into states. That means &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum channels&lt;/a&gt;, but that's a discussion for another day).&#xA;Putting these requirements together identifies &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as an element of &lt;a href=&quot;https://en.wikipedia.org/wiki/Special_unitary_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;the group of unitary matrices &lt;span class=&quot;math-container&quot;&gt;$SU(n)$&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Unitaries don't have a notion of time&lt;/em&gt;&lt;/strong&gt;) But there is something rather unphysical about the above description: where is time? Indeed, describing the evolution of a state via unitary operators, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\mapsto U|\psi\rangle$&lt;/span&gt;, corresponds to considering the state at only different &quot;time snapshots&quot;. In other words, unitaries are akin to &quot;black boxes&quot;: they describe the overall effect of some physical evolution, but don't delve about the details actually making it up.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Bringing time into the picture: families of unitaries&lt;/em&gt;&lt;/strong&gt;) Real physical interactions act on states by &lt;em&gt;continuously&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as the (continuous) set of states &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle=U(t)|\psi\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; is a unitary for each &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, and satisfies &lt;a href=&quot;https://en.wikipedia.org/wiki/One-parameter_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;a bunch of conditions&lt;/a&gt; to make it model a proper time evolution. In particular, we must have &lt;span class=&quot;math-container&quot;&gt;$U(t_1)U(t_2)=U(t_1+t_2)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$t_1,t_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Finally, where Hamiltonians are born&lt;/em&gt;&lt;/strong&gt;) Ok, so we know how to describe time evolutions via families of unitaries. What happens now if the time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is taken to be very small? It is a natural question to ask in &quot;what direction&quot; the state is changing at any given time. Mathematically, this amounts to studying&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac1 {dt} (|\psi(dt)\rangle-|\psi(0)\rangle) = \frac{U(dt) - I}{dt}|\psi(0)\rangle.$$&lt;/span&gt;&#xA;But now look at the kind of expression we got: infinitesimal changes are described by operators of the form &lt;span class=&quot;math-container&quot;&gt;$\frac{U(dt)-I}{dt}$&lt;/span&gt; in the limit &lt;span class=&quot;math-container&quot;&gt;$dt\to0$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$t\mapsto U(t)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U(0)=I$&lt;/span&gt;. &lt;a href=&quot;https://en.wikipedia.org/wiki/Stone%27s_theorem_on_one-parameter_unitary_groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;As it turns out&lt;/a&gt;, these objects are skew-Hermitian operators. More precisely, there is always some Hermitian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U(t)=e^{it H}$&lt;/span&gt;.&#xA;And there you have it: if you want to describe infinitesimal evolution of quantum states, you must do so via Hermitian operators called &quot;Hamiltonians&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;&lt;em&gt;Physically, how do Hermitians act?&lt;/em&gt;&lt;/strong&gt;) Hermitians are those matrices which are orthonormally diagonalisable and have real eigenvalues. Their appearing via exponentials means that &lt;span class=&quot;math-container&quot;&gt;$e^{iHt}$&lt;/span&gt; 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. &lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-05-22T18:14:48.257" LastActivityDate="2020-05-22T18:14:48.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12135" PostTypeId="2" ParentId="4886" CreationDate="2020-05-22T18:14:40.530" Score="2" Body="&lt;p&gt;What you are asking is: How to create a Dicke State?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A Dicke state is a balanced superposition of bit string of length n with hamming weight &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Refer to &lt;a href=&quot;https://arxiv.org/abs/1904.07358&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deterministic Preparation of Dicke States&lt;/a&gt; for the solution.&lt;/p&gt;&#xA;" OwnerUserId="12118" LastEditorUserId="9006" LastEditDate="2020-05-23T07:01:42.250" LastActivityDate="2020-05-23T07:01:42.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12136" PostTypeId="1" CreationDate="2020-05-22T19:09:00.597" Score="1" ViewCount="32" Body="&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;&#xA;def set_io_qubits(qubit_count):&#xA;    input_qubits = [cirq.GridQubit(i, 0) for i in range(qubit_count)]&#xA;    return (input_qubits)&#xA;&#xA;def debug_oracle(input_qubits):&#xA;    yield (cirq.H(input_qubits[0]))&#xA;&#xA;&#xA;def make_grover_circuit(input_qubits, oracle):&#xA;    c = cirq.Circuit()&#xA;&#xA;    c.append(oracle)&#xA;    c.append(oracle)&#xA;    c.append(oracle)&#xA;&#xA;    c.append(cirq.measure(*input_qubits, key='result'))&#xA;&#xA;    return c&#xA;&#xA;&#xA;def main():&#xA;    input_qubits = set_io_qubits(2)&#xA;&#xA;    oracle = debug_oracle(input_qubits)&#xA;&#xA;    circuit = make_grover_circuit(input_qubits, oracle)&#xA;    print('Circuit:')&#xA;    print(circuit)&#xA;&#xA;if __name__ == '__main__':&#xA;    main()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I add &lt;code&gt;c.append(oracle)&lt;/code&gt; three times in &lt;code&gt;make_grover_circuit&lt;/code&gt;. However, when I print the circuit, it seems there is only one &lt;code&gt;oracle&lt;/code&gt;. Is it a bug? Or just I can't &lt;code&gt;.append&lt;/code&gt; my oracle more than once? Here is my result of the program.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 /Users/a123/Desktop/Cirq/test.py&#xA;Circuit:&#xA;(0, 0): ───H───M('result')───&#xA;               │&#xA;(1, 0): ───────M─────────────&#xA;&#xA;Process finished with exit code 0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12120" LastEditorUserId="55" LastEditDate="2020-05-24T10:48:15.300" LastActivityDate="2020-07-23T19:08:40.907" Title="Can't append multiple times with self-defined oracle" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12137" PostTypeId="1" AcceptedAnswerId="12150" CreationDate="2020-05-22T20:00:21.963" Score="3" ViewCount="176" Body="&lt;p&gt;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 &lt;a href=&quot;https://api.research-repository.uwa.edu.au/portalfiles/portal/16487932/THESIS_DOCTOR_OF_PHILOSOPHY_LOKE_Thomas_Oon_Han_2017.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this thesis&lt;/a&gt; (page 39), the two images below show graph and circuit. I've already wrote the code using Qiskit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s3QOG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s3QOG.png&quot; alt=&quot;cyclic graph with 8 nodes&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/DVlAT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DVlAT.png&quot; alt=&quot;Szegedy quantum walk circuit for a cyclic graph&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As suggested in the reference for the current position I'm using as state vector|&lt;span class=&quot;math-container&quot;&gt;$\phi_{0}\rangle = [0,\frac{1}{\sqrt{2}},0,...,0,\frac{1}{\sqrt{2}}]^{T}$&lt;/span&gt; that is the column in the transition matrix P that represents node 0 then considering a state |x,y&lt;span class=&quot;math-container&quot;&gt;$\rangle$&lt;/span&gt; as a state for the Szegedy QW I place the vector &lt;span class=&quot;math-container&quot;&gt;$|\phi_{0}\rangle$&lt;/span&gt; in position x expecting the output in y. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To construct the vector |&lt;span class=&quot;math-container&quot;&gt;$\phi_{0}\rangle$&lt;/span&gt; I am using an Hadamard gate and some C-NOT gates in sequence &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,1,1,1,%22H%22],[1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,1,1,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[1,1,1,1,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[1,1,1,1,%22%E2%97%A6%22,%22X%22],[1,1,1,1,1,%22Chance3%22],[1,1,1,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[1,1,%22%E2%80%A2%22,1,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[1,%22%E2%80%A2%22,1,1,%22%E2%97%A6%22,%22X%22],[%22%E2%80%A2%22,1,1,1,%22X%22],[1,1,1,1,%22%E2%97%A6%22,%22X%22,%22X%22],[1,1,1,1,%22H%22],[1,1,1,1,%22%E2%97%A6%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22Z%22],[1,1,1,1,%22H%22],[1,1,1,1,%22%E2%97%A6%22,%22X%22,%22X%22],[1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,1,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22],[1,%22%E2%80%A2%22,1,1,%22%E2%80%A2%22,%22X%22],[%22%E2%80%A2%22,1,1,1,%22X%22],[1,1,1,%22Swap%22,1,1,1,%22Swap%22],[1,1,%22Swap%22,1,1,1,%22Swap%22],[1,%22Swap%22,1,1,1,%22Swap%22],[%22Swap%22,1,1,1,%22Swap%22],[1,%22Chance3%22,1,1,1,%22Chance3%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;This simulation in Quirk&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="12121" LastEditorUserId="55" LastEditDate="2020-05-23T13:46:39.733" LastActivityDate="2020-05-23T17:22:01.727" Title="Quantum circuit for Szegedy quantum walk on a cyclic graph" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12138" PostTypeId="1" AcceptedAnswerId="12146" CreationDate="2020-05-22T20:05:02.517" Score="4" ViewCount="107" Body="&lt;p&gt;This is a fairly broad question, I hope it fits here.  I am wondering if the BB84 protocol is an example of &quot;quantum supremacy&quot;, 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?&lt;/p&gt;&#xA;" OwnerUserId="10023" LastEditorUserId="55" LastEditDate="2020-05-24T10:48:48.153" LastActivityDate="2020-05-24T10:48:48.153" Title="Is the BB84 protocol an example of &quot;quantum supremacy&quot;?" Tags="&lt;cryptography&gt;&lt;quantum-advantage&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12139" PostTypeId="2" ParentId="12136" CreationDate="2020-05-22T21:16:45.843" Score="1" Body="&lt;p&gt;The issue is that you are using the result of a generator method multiple times:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def gen():&#xA;    yield 1&#xA;g = gen()&#xA;print(list(g))  # prints [1]&#xA;print(list(g))  # prints []&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is a common mistake to make in Python. The solution is to store a list of the items instead of the generator:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def gen():&#xA;    yield 1&#xA;&#xA;gen_items_safe_to_reuse = list(gen())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-06-23T18:05:32.287" LastActivityDate="2020-06-23T18:05:32.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12140" PostTypeId="2" ParentId="12101" CreationDate="2020-05-22T23:57:42.213" Score="1" Body="&lt;p&gt;The basis &lt;span class=&quot;math-container&quot;&gt;$| e_k\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;large enough&quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-05-23T13:25:39.723" LastActivityDate="2020-05-23T13:25:39.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12141" PostTypeId="1" CreationDate="2020-05-23T03:51:08.737" Score="1" ViewCount="38" Body="&lt;p&gt;Is it possible to use built-in &lt;code&gt;qiskit.chemistry&lt;/code&gt; tools, such as &lt;code&gt;VQE&lt;/code&gt;, &lt;code&gt;UCCSD&lt;/code&gt;, etc., without using the notion of spins ('alpha'/'beta')?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$h_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$h_2$&lt;/span&gt; coefficients and ladder operators.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I do all that?&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-05-24T10:49:00.407" LastActivityDate="2020-05-24T10:49:00.407" Title="How to ignore spins is Qiskit chemistry package?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12142" PostTypeId="2" ParentId="12130" CreationDate="2020-05-23T04:13:56.353" Score="3" Body="&lt;p&gt;You can base your code on &lt;a href=&quot;https://github.com/microsoft/Quantum/tree/master/samples/getting-started/measurement&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Q# sample&lt;/a&gt;, adjacent to the one you've been looking at.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The simplest thing is generating random bits 0 or 1 that are perfectly correlated; you can do that using &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state#Creating_Bell_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell state&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation GenerateCorrelatedRandomNumbers () : (Int, Int) {&#xA;    // Allocate two qubits&#xA;    using ((q1, q2) = (Qubit(), Qubit()))  {&#xA;        // Prepare Bell state (|00⟩ + |11⟩) / sqrt(2) on them&#xA;        H(q1);&#xA;        CNOT(q1, q2);&#xA;        // The measurement results are going to be correlated: you get 0,0 in 50% of the cases and 1,1 in 50%&#xA;        return (MResetZ(q1) == Zero ? 0 | 1, &#xA;                MResetZ(q2) == Zero ? 0 | 1);&#xA;    }&#xA;}&#xA;&#xA;@EntryPoint()&#xA;operation SampleCorrelatedRandomNumbers () : Unit {&#xA;    for (i in 1 .. 10) {&#xA;        Message($&quot;{GenerateCorrelatedRandomNumbers()}&quot;);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will give you&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(0, 0)&#xA;(1, 1)&#xA;(1, 1)&#xA;...&#xA;(0, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;If you want the bits to be perfectly anti-correlated, you can use the state &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    using ((q1, q2) = (Qubit(), Qubit()))  {&#xA;        // Prepare Bell state (|10⟩ + |01⟩) / sqrt(2) on them&#xA;        H(q1);&#xA;        CNOT(q1, q2);&#xA;        X(q1);&#xA;        // The measurement results are going to be correlated: you get 0,1 in 50% of the cases and 1,0 in 50%&#xA;        return (MResetZ(q1) == Zero ? 0 | 1, &#xA;                MResetZ(q2) == Zero ? 0 | 1);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\alpha |00\rangle + \beta |11\rangle$&lt;/span&gt; - that will give you (0,0) with probability &lt;span class=&quot;math-container&quot;&gt;$\alpha^2$&lt;/span&gt; and (1,1) with probability &lt;span class=&quot;math-container&quot;&gt;$\beta^2$&lt;/span&gt; (you don't need to use complex coefficients if you only care about simple measurement probabilities).&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{20}}(3|00\rangle + |01\rangle + |10\rangle + 3|11\rangle)$&lt;/span&gt; will give you equal bits in 90% of the cases and distinct bits in 10% of the cases.&lt;/li&gt;&#xA;&lt;li&gt;You can learn more about Q# programming and preparing quantum states using Q# in the &lt;a href=&quot;https://github.com/Microsoft/QuantumKatas/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas&lt;/a&gt; - the first set of tutorials and exercises focuses on the basic constructs like allocating qubits and applying gates and preparing states on them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;To address the updated question:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2020-05-24T00:26:17.423" LastActivityDate="2020-05-24T00:26:17.423" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12143" PostTypeId="1" CreationDate="2020-05-23T06:02:18.803" Score="3" ViewCount="69" Body="&lt;p&gt;In their &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801041&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper (last part of the paper)&lt;/a&gt;, 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 &lt;a href=&quot;http://web.eecs.utk.edu/~bmaclenn/Classes/494-594-UC-F13/handouts/LNUC-III.E.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;   .&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Classical irreversible logical  gates can be simulated by unitary gates that involve some ancillary qubits, as can be seen &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/131/10110&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5829/10110&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;. What exactly is the reason why the Abrams - Lloyd algorithm does not allow implementation using unitary gates and ancillary qubits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="9006" LastEditDate="2020-05-24T07:14:49.197" LastActivityDate="2020-06-09T05:06:26.717" Title="What exactly is the reason why the Abrams - Lloyd algorithm does not allow implementation using unitary gates and ancillary qubits?" Tags="&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="10" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12144" PostTypeId="2" ParentId="11770" CreationDate="2020-05-23T07:32:14.493" Score="2" Body="&lt;p&gt;The idea of squeezing arises when discussing the state of a quantum harmonic oscillator (e.g. a bosonic system). Such systems differ from simpler &lt;em&gt;qudit systems&lt;/em&gt; in that, even when only a single mode is being considered, the system is infinitely dimensional.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A common way to describe these systems is via pairs of non-commuting observables, often the &quot;position&quot; and &quot;momentum&quot; operators &lt;span class=&quot;math-container&quot;&gt;$\hat x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat p$&lt;/span&gt;. For an arbitrary pair of observables &lt;span class=&quot;math-container&quot;&gt;$\hat A,\hat B$&lt;/span&gt;, the corresponding uncertainties &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncertainty_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;are bounded by &lt;span class=&quot;math-container&quot;&gt;$\sigma_A^2\sigma_B^2\ge\frac14|\langle[A,B]\rangle|^2$&lt;/span&gt;&lt;/a&gt;.&#xA;Whenever a state is such that &lt;span class=&quot;math-container&quot;&gt;$\sigma_A&amp;lt;\frac12|\langle[A,B]\rangle|$&lt;/span&gt; (or the same holds for &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt;) we talk of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Squeezed_coherent_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;squeezed state&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More formally, a squeezed state can be written by having a &lt;a href=&quot;https://en.wikipedia.org/wiki/Squeeze_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;squeezing operator&lt;/em&gt;&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$$S(\xi)\equiv\exp\left[\frac12(\xi a^{\dagger 2}-\xi^*a^2)\right],\quad \xi\in\mathbb C$$&lt;/span&gt; act on some other state. For example, &lt;em&gt;squeezed vacuum states&lt;/em&gt; have the form &lt;span class=&quot;math-container&quot;&gt;$S(\xi)|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;Now, are such states &lt;em&gt;physical&lt;/em&gt;? 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.&#xA;See &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0031-8949/91/5/053001&quot; rel=&quot;nofollow noreferrer&quot;&gt;this review&lt;/a&gt; to read more about squeezing.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-05-23T07:32:14.493" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12146" PostTypeId="2" ParentId="12138" CreationDate="2020-05-23T13:52:36.537" Score="4" Body="&lt;p&gt;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 &quot;quantum supremacy&quot;.  But historians will likely still consider the initial hardware implementing BB84 as a sort of quantum advantage, in much the same way that the &quot;Enigma&quot; machine is a bit of a precursor to an (electronic) computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more detail, lately there's been a push to ask for and discuss evidence of &quot;quantum &lt;em&gt;computational&lt;/em&gt; supremacy&quot;, with an emphasis on &quot;computation&quot;.  Adding the word &quot;computational&quot; into the phrase is seen as a means to move away from the loaded phrase &quot;quantum supremacy.&quot;  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, this also helps to emphasize that quantum computers may do &lt;em&gt;computational&lt;/em&gt; tasks much faster than classical computers.  Indeed, this appears to be the sense in to which Preskill referred when coining the phrase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can prepare the qubits into a superposition in a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; - e.g., &lt;em&gt;exponential&lt;/em&gt; in the number of qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; photons traded therebetween.  The dimension of their Hilbert space only grows &lt;em&gt;linearly&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;quantum&lt;/em&gt; resource - indeed, Alice provides Bob with &lt;em&gt;quanta&lt;/em&gt; of light (photons.)  This does seem unique and different from that of, for example, classical one-time pads (OTPs.)&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-05-23T19:13:08.280" LastActivityDate="2020-05-23T19:13:08.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12147" PostTypeId="1" CreationDate="2020-05-23T15:29:12.487" Score="4" ViewCount="60" Body="&lt;p&gt;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 &quot;place&quot; or book that compiles all of it?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-08-08T05:38:10.743" Title="Resource recommendation on quantum simulations" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12148" PostTypeId="1" AcceptedAnswerId="12156" CreationDate="2020-05-23T17:03:12.920" Score="3" ViewCount="179" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The speaker ended the talk with a kind of &quot;On the Other Hand&quot; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12050" LastEditorUserId="55" LastEditDate="2020-08-27T12:56:09.570" LastActivityDate="2020-08-27T12:56:09.570" Title="Exponential Growth of Noise in Quantum Computers" Tags="&lt;error-correction&gt;&lt;physical-realization&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12150" PostTypeId="2" ParentId="12137" CreationDate="2020-05-23T17:22:01.727" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're looking for the circuit representation of &lt;span class=&quot;math-container&quot;&gt;$C_8$&lt;/span&gt;, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[1,1,1,%22H%22,1,%22X%22],[1,1,1,%22%E2%80%A2%22,%22X%22],[1,1,1,%22Amps3%22],[],[1,1,%22%E2%80%A2%22,%22X%22,%22%E2%97%A6%22,%22%E2%97%A6%22],[1,1,%22%E2%80%A2%22,1,%22X%22,%22%E2%97%A6%22],[1,1,%22%E2%80%A2%22,1,1,%22X%22],[1,%22%E2%80%A2%22,1,%22X%22,%22%E2%97%A6%22],[1,%22%E2%80%A2%22,1,1,%22X%22],[%22%E2%80%A2%22,1,1,%22X%22],[1,1,1,%22%E2%97%A6%22,%22X%22],[1,1,1,%22H%22],[1,1,1,%22%E2%97%A6%22,%22%E2%80%A2%22,%22Z%22],[1,1,1,%22H%22],[1,1,1,%22%E2%97%A6%22,%22X%22],[1,1,%22%E2%80%A2%22,%22X%22,%22%E2%80%A2%22,%22%E2%80%A2%22],[1,1,%22%E2%80%A2%22,1,%22X%22,%22%E2%80%A2%22],[1,1,%22%E2%80%A2%22,1,1,%22X%22],[1,%22%E2%80%A2%22,1,%22X%22,%22%E2%80%A2%22],[1,%22%E2%80%A2%22,1,1,%22X%22],[%22%E2%80%A2%22,1,1,%22X%22],[1,1,%22Swap%22,1,1,%22Swap%22],[1,%22Swap%22,1,1,%22Swap%22],[%22Swap%22,1,1,%22Swap%22],[%22Chance3%22,1,1,%22Chance3%22]]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here's&lt;/a&gt; the Quirk simulation for it. The first two columns prepare the state &lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle = \frac{1}{\sqrt{2}}(|001\rangle+|111\rangle)$&lt;/span&gt; in &lt;strong&gt;big-endian&lt;/strong&gt; order (the dominant convention years back), which in Quirk is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|100\rangle+|111\rangle)$&lt;/span&gt; because it uses &lt;strong&gt;little-endian&lt;/strong&gt; order.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$N=2^3=8$&lt;/span&gt; specifically. Note also how the L (left-rotation) and R (right-rotation) operators are defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To make sense of the results, the qualitative way of looking at this is that the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle=|0\rangle|\otimes|\phi_0\rangle$&lt;/span&gt; means that we start at the vertex 0 on the graph &lt;span class=&quot;math-container&quot;&gt;$C_8$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can also inspect this analytically.&#xA;The Szegedy operator is defined as &lt;span class=&quot;math-container&quot;&gt;$U_{walk}=S(I-2\Pi)$&lt;/span&gt;, where the swap operator &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; acts as &lt;span class=&quot;math-container&quot;&gt;$S|i,j\rangle=|j,i\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\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|)$&lt;/span&gt;.&#xA;With the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle=|0\rangle|\otimes|\phi_0\rangle$&lt;/span&gt;, and given that &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_i|\psi_j\rangle=\delta_{i,j}$&lt;/span&gt;, it can be easily shown that &lt;span class=&quot;math-container&quot;&gt;$U_{walk}|\psi_0\rangle=-|\phi_0\rangle\otimes|0\rangle$&lt;/span&gt;, which matches the qualitative expectation, and the Quirk circuit output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope that helps! :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;-Thomas&lt;/p&gt;&#xA;" OwnerUserId="12130" LastActivityDate="2020-05-23T17:22:01.727" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12151" PostTypeId="2" ParentId="11650" CreationDate="2020-05-23T19:52:05.087" Score="3" Body="&lt;p&gt;This is at least NP hard. The basic problem is that the circuit can encode things like &quot;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&quot;. Deciding whether such a circuit is classical-ish requires determining if the 3-SAT problem it encodes is satisfiable or not.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-05-23T22:00:20.267" LastActivityDate="2020-05-23T22:00:20.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12152" PostTypeId="1" CreationDate="2020-05-23T20:11:28.723" Score="2" ViewCount="112" Body="&lt;p&gt;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. &#xA;&lt;a href=&quot;https://i.stack.imgur.com/ougAr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ougAr.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="7943" LastEditorUserId="55" LastEditDate="2020-05-24T10:51:19.923" LastActivityDate="2020-12-05T15:12:07.233" Title="Does normalizing a mixed state give a pure state?" Tags="&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12153" PostTypeId="2" ParentId="12152" CreationDate="2020-05-23T21:10:25.123" Score="1" Body="&lt;p&gt;An arbitrary one qubit density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \begin{pmatrix} \rho_{00} &amp;amp; \rho_{01} \\ \rho_{10} &amp;amp; \rho_{11}\end{pmatrix} = \frac{I + \vec{r} \cdot \vec{\sigma}}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\vec{r} \cdot \vec{\sigma} = r_x \sigma_x + r_y \sigma_y + r_z \sigma_z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;s are Pauli matrices, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the corresponding vector for the density matrix in the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state is equal to &lt;span class=&quot;math-container&quot;&gt;$\rho_{00}$&lt;/span&gt; and the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state is equal to &lt;span class=&quot;math-container&quot;&gt;$\rho_{11}$&lt;/span&gt;. Thus, the normalization of the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states for the density matrix corresponds to the statement &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho) = \rho_{00} + \rho_{11} = 1$&lt;/span&gt;. In this sense it is already a normalized state if &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho) = 1$&lt;/span&gt;, but still the vector &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt; in the Bloch sphere formalizm will be inside the sphere for a mixed state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure how the action described in the question can be related to the normalization, because &lt;strong&gt;both mixed (inside the sphere) and pure (on the sphere) states should be normalized.&lt;/strong&gt; &lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-24T11:16:48.260" LastActivityDate="2020-05-24T11:16:48.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12154" PostTypeId="1" AcceptedAnswerId="12155" CreationDate="2020-05-24T00:56:05.273" Score="3" ViewCount="82" Body="&lt;p&gt;How can I plot custom labels for specific qubits on the left and right side similar to the picture shown here (A, B, Sum ...):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://lahirumadushankablog.files.wordpress.com/2020/02/fulladder.jpg?w=616&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user12136" LastEditorUserId="55" LastEditDate="2020-05-25T09:20:55.003" LastActivityDate="2020-05-25T09:20:55.003" Title="How to plot custom labels for quantum registers in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12155" PostTypeId="2" ParentId="12154" CreationDate="2020-05-24T05:51:41.463" Score="2" Body="&lt;p&gt;&lt;strong&gt;A partial answer.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How to customize the labels of &lt;code&gt;QuantumRegister&lt;/code&gt;s:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;red_qubit = QuantumRegister(1,'red')&#xA;blue_qubit = QuantumRegister(1, 'blue')&#xA;green_qubit = QuantumRegister(2, 'green')&#xA;&#xA;circuit = QuantumCircuit(red_qubit, blue_qubit, green_qubit)&#xA;&#xA;circuit.h(red_qubit[0])&#xA;circuit.x(blue_qubit[0])&#xA;circuit.x(green_qubit[0])&#xA;circuit.cx(red_qubit[0], blue_qubit[0])&#xA;circuit.cx(red_qubit[0], green_qubit[0])&#xA;circuit.cx(red_qubit[0], green_qubit[1])&#xA;&#xA;%matplotlib inline&#xA;circuit.draw(output=&quot;mpl&quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/J1LD9.png&quot; width=&quot;350&quot; /&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-24T06:20:23.763" LastActivityDate="2020-05-24T06:20:23.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12156" PostTypeId="2" ParentId="12148" CreationDate="2020-05-24T07:24:36.083" Score="4" Body="&lt;p&gt;According to so-called &lt;em&gt;threshold theorem&lt;/em&gt;, it is possible to get rid of errors in quantum computation with arbitrary precision. However, there is an assumption that you have &lt;em&gt;enough&lt;/em&gt; qubits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To ilustrate the idea, you can encode one qubit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; with more qubits, for example &lt;span class=&quot;math-container&quot;&gt;$|q\rangle=\alpha|0000\rangle+\beta|1111\rangle$&lt;/span&gt; and after calculation, based on majority rule, to decide about result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-05-24T07:24:36.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12157" PostTypeId="2" ParentId="12152" CreationDate="2020-05-24T08:40:43.777" Score="3" Body="&lt;p&gt;Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\vec{v}$&lt;/span&gt; of a density matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_C = \frac{1}{2}(I + \vec{v}\cdot\vec{\sigma})&#xA;$$&lt;/span&gt;&#xA;can be shorter than 1 i.e. &lt;span class=&quot;math-container&quot;&gt;$|\vec{v}| \le 1$&lt;/span&gt;, when the the density matrix represents a mixed state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you normalize it &lt;span class=&quot;math-container&quot;&gt;$\vec{n} = \vec{v}/|\vec{v}|$&lt;/span&gt; then you will get the density matrix of the C' pure state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{C'} = \frac{1}{2}(I + \vec{n}\cdot\vec{\sigma}).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12140" LastActivityDate="2020-05-24T08:40:43.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12159" PostTypeId="2" ParentId="10264" CreationDate="2020-05-24T12:44:03.843" Score="1" Body="&lt;p&gt;Not quite. Consider the following no-signalling distribution &lt;span class=&quot;math-container&quot;&gt;$PR_1$&lt;/span&gt; which I will write in the form &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;p(00|00) &amp;amp; p(01|00) &amp;amp; p(00|01) &amp;amp; p(01|01) \\&#xA;p(10|00) &amp;amp; p(11|00) &amp;amp; p(10|01) &amp;amp; p(11|01) \\&#xA;p(00|10) &amp;amp; p(01|10) &amp;amp; p(00|11) &amp;amp; p(01|11) \\&#xA;p(10|10) &amp;amp; p(11|10) &amp;amp; p(10|11) &amp;amp; p(11|11) \\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;PR_1 = \begin{pmatrix}&#xA;1/2 &amp;amp; 0 &amp;amp; 1/2 &amp;amp; 0 \\&#xA;0 &amp;amp; 1/2 &amp;amp; 0 &amp;amp; 1/2 \\&#xA;1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2 \\&#xA;0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;This distribution has &lt;span class=&quot;math-container&quot;&gt;$E_{00} = E_{01} = E_{10} = - E_{11} = 1$&lt;/span&gt; and so achieves the algebraic maximum of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; of the CHSH expression as you write it in the question. Now consider another no-signalling distribution &lt;span class=&quot;math-container&quot;&gt;$PR_2$&lt;/span&gt;, derived from &lt;span class=&quot;math-container&quot;&gt;$PR_1$&lt;/span&gt; by relabelling the inputs of Alice (&lt;span class=&quot;math-container&quot;&gt;$x \mapsto x + 1 \mod 2$&lt;/span&gt;), i.e. &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;PR_2 = \begin{pmatrix}&#xA;1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2 \\&#xA;0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0 \\&#xA;1/2 &amp;amp; 0 &amp;amp; 1/2 &amp;amp; 0 \\&#xA;0 &amp;amp; 1/2 &amp;amp; 0 &amp;amp; 1/2 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$PR_2$&lt;/span&gt; is another no-signalling distribution that is not local &lt;span class=&quot;math-container&quot;&gt;$PR_2 \notin \mathcal{L}$&lt;/span&gt; -- (sketch) the local set is closed under relabellings of inputs/outputs, &lt;span class=&quot;math-container&quot;&gt;$PR_2$&lt;/span&gt; is a relabelling of &lt;span class=&quot;math-container&quot;&gt;$PR_1$&lt;/span&gt; (and vice versa) and &lt;span class=&quot;math-container&quot;&gt;$PR_1 \notin \mathcal{L}$&lt;/span&gt;. Now &lt;span class=&quot;math-container&quot;&gt;$PR_2$&lt;/span&gt; results in the expectation values &lt;span class=&quot;math-container&quot;&gt;$E_{00} = 1, E_{01} = -1, E_{10} = 1, E_{11} = 1$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$E_{00} + E_{01} + E_{10} - E_{11} = 0$&lt;/span&gt;. Therefore, we have found a distribution that cannot be explained by a local model but nevertheless satisfies the CHSH inequality. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can however still get a converse statement by including relabelled versions of the CHSH inequality. Suppose a no-signalling distribution &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; satisfies all of the following inequalities &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;|E_{00} + E_{01} + E_{10} - E_{11}| &amp;amp;\leq 2 \\&#xA;|E_{10} + E_{11} + E_{00} - E_{01}| &amp;amp;\leq 2 \\&#xA;|E_{01} + E_{00} + E_{11} - E_{10}| &amp;amp;\leq 2 \\&#xA;|E_{11} + E_{10} + E_{01} - E_{00}| &amp;amp;\leq 2&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;then &lt;span class=&quot;math-container&quot;&gt;$p \in \mathcal{L}$&lt;/span&gt;. In other words &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; non-trivial facets.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-05-24T12:54:00.380" LastActivityDate="2020-05-24T12:54:00.380" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12160" PostTypeId="1" AcceptedAnswerId="12165" CreationDate="2020-05-24T16:29:54.247" Score="1" ViewCount="46" Body="&lt;p&gt;I have already made a small Q# program and ran it using Python on VSCode, my question is &lt;strong&gt;how can I run it on Azure Quantum&lt;/strong&gt; to make it run faster?&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Q# program :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace QubitTest {&#xA;open Microsoft.Quantum.Convert;&#xA;open Microsoft.Quantum.Math;&#xA;open Microsoft.Quantum.Measurement;&#xA;open Microsoft.Quantum.Canon;&#xA;open Microsoft.Quantum.Intrinsic;&#xA;&#xA;operation QChange() : Int {&#xA;// on retourne un qubit   &#xA; using ( q = Qubit()) {&#xA; for (i in 1..500000){&#xA;     H(q);&#xA;     Message($&quot; Qubit {i} : {q}&quot;);&#xA; }&#xA; return 0;&#xA; }&#xA;}&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Python Simulation :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt; import qsharp&#xA;&#xA; from QubitTest import QChange &#xA;&#xA; QChange.simulate()&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12137" LastEditorUserId="9006" LastEditDate="2020-05-25T07:52:08.997" LastActivityDate="2020-05-25T08:38:45.743" Title="How can I run Q# program in Azure Quantum" Tags="&lt;algorithm&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12161" PostTypeId="1" CreationDate="2020-05-24T19:50:15.570" Score="4" ViewCount="261" Body="&lt;p&gt;I can't seem to wrap my head around the suzuki-trotter formula. I have seen &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8248/5620&quot;&gt;This answer&lt;/a&gt; but I am still confused of the applicability of the formula. Let me explain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand it Trotterization lets us use directly the Schrodinger equation &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle = e^{-i H t} |\psi(0)\rangle$&lt;/span&gt; where we approximate &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}=e^{\sum_k H_kt}\approx \bigg(\prod_k e^{-iH_k\Delta t}\bigg)^N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\Delta t=t_{final}/N$&lt;/span&gt;. This is formula is approximate to &lt;span class=&quot;math-container&quot;&gt;$O(\Delta t^2)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle$&lt;/span&gt; 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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{H}=\frac{\hat{P}^2}{2m}+\frac{1}{2}m\omega^2\hat{X}^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;if we want to evolve this system we can do so in a position or momentum basis, so that the &lt;span class=&quot;math-container&quot;&gt;$\hat X$&lt;/span&gt; operator will just be a diagonal matrix in our discrete space and &lt;span class=&quot;math-container&quot;&gt;$\hat P$&lt;/span&gt; will also be diagonal given that we express it as &lt;span class=&quot;math-container&quot;&gt;$\hat X$&lt;/span&gt; wrapped around the Fourier transform as &lt;span class=&quot;math-container&quot;&gt;$\hat P=\hat{(QFT)}\hspace{1mm}\hat X \hspace{1mm}\hat{(QFT)}^{-1}$&lt;/span&gt;. So we clearly have a way to study the system. Another way is to express in terms of the creation and destruction operators &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A^\dagger$&lt;/span&gt;, so that our Hamiltonian can be written as &lt;span class=&quot;math-container&quot;&gt;$\hat H=\hat A \hat A^\dagger +\hat I/2$&lt;/span&gt;. 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 &lt;em&gt;a priori&lt;/em&gt; our Hamiltonian but in this case we can. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Having said this, here's what I don't get:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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 &lt;strong&gt;given&lt;/strong&gt; that our initial state was &lt;strong&gt;already&lt;/strong&gt; 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. &lt;/li&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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). &lt;strong&gt;What are the practical uses of the Trotter formula?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I have looked into these papers for the harmonic oscillator application:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DOI: 10.13140/RG.2.2.18996.81284&lt;/p&gt;&#xA;&#xA;&lt;p&gt;DOI: 10.1109/NYSDS.2018.8538959&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="9459" LastEditDate="2020-05-25T09:44:41.683" LastActivityDate="2021-04-21T06:35:39.443" Title="What is the usefulness of the Suzuki-Trotter formula?" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12162" PostTypeId="1" CreationDate="2020-05-25T02:06:36.767" Score="3" ViewCount="285" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; rotation (i.e. &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta \sigma_z^i\sigma_z^{i+1}}$&lt;/span&gt;) can be decomposed as &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}\,R_z(\theta)\,\text{CNOT}$&lt;/span&gt;. So, I think the depth of &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; rotation is 3. However, if &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; rotation gate exists, then the depth should be 1. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question is as follows:&lt;/strong&gt; Which gate set should be used when I measure the depth of a circuit?&lt;/p&gt;&#xA;" OwnerUserId="9894" LastEditorUserId="55" LastEditDate="2020-09-09T20:44:31.770" LastActivityDate="2020-09-09T20:44:31.770" Title="Which gate set should be used when I measure the depth of a circuit?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12163" PostTypeId="2" ParentId="12162" CreationDate="2020-05-25T02:23:18.520" Score="8" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-05-25T02:23:18.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12164" PostTypeId="2" ParentId="12162" CreationDate="2020-05-25T06:52:35.177" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8588" LastActivityDate="2020-05-25T06:52:35.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12165" PostTypeId="2" ParentId="12160" CreationDate="2020-05-25T08:38:45.743" Score="1" Body="&lt;p&gt;Azure Quantum is in private preview right now. You can sign up to request early access &lt;a href=&quot;https://azure.microsoft.com/en-us/services/quantum/#contact&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2918" LastActivityDate="2020-05-25T08:38:45.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12168" PostTypeId="1" CreationDate="2020-05-25T12:19:54.227" Score="2" ViewCount="114" Body="&lt;p&gt;I am trying to implement the 4-qubit example outlined in showed in section 3 of the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#2.-The-HHL-algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit tutorial on the HHL algorithm&lt;/a&gt;. Does anyone know what are the 2 angles that the &lt;code&gt;Ry&lt;/code&gt; gate needs to be applied with? They say what the values of &lt;code&gt;C&lt;/code&gt; and the approximated values of the eigenvalues are (&lt;span class=&quot;math-container&quot;&gt;$\tilde {\lambda_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde {\lambda_2}$&lt;/span&gt;), but they don't mention the rotation angles. Are they just &lt;span class=&quot;math-container&quot;&gt;$\theta_1 = \arccos(\frac{C}{\tilde {\lambda_1}})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_2 = \arccos(\frac{C}{\tilde {\lambda_2}})$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="11979" LastEditorUserId="10480" LastEditDate="2021-01-30T06:51:49.647" LastActivityDate="2021-01-30T06:53:03.260" Title="Angles of rotation in HHL example" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12169" PostTypeId="2" ParentId="12078" CreationDate="2020-05-25T12:26:04.867" Score="4" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;What is preventing us from solving real world problems, defined in terms of Hamiltonian simulation, on currently available quantum computers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Short answer: it depends on the &quot;real world problem&quot; considered, but one or several of qubit number, coherence time or gate errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The real answer is really problem-dependant. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I am not an expert of VQE, please double or triple-check the claims I am making in the following paragraph&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For VQE and quantum chemistry applications we are &lt;em&gt;mostly&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\langle \psi \vert U \vert \psi \rangle$&lt;/span&gt; with direct measurements instead of indirect ones. See &lt;a href=&quot;https://arxiv.org/abs/1901.00015v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Methodology for replacing indirect measurements with direct measurements&lt;/a&gt; for more information on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A few research papers have analysed the cost of simulating more complex Hamiltonians. Here are the two I am aware of:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://link.springer.com/article/10.1007/s11128-016-1495-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Concrete resource analysis of the quantum linear-system algorithm used to compute the electromagnetic scattering cross section of a 2D target&lt;/a&gt;. The authors have used an automatic oracle synthesis tool but they write that &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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&#xA;  perhaps at most a factor of 10.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The overall number of gates and circuit are depicted at pages 41 and 42. The paper is &lt;strong&gt;really&lt;/strong&gt; detailed and it seems like every implementation steps have been explained. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Disclaimer: I am the main author of this paper&lt;/em&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2003.12458&quot; rel=&quot;nofollow noreferrer&quot;&gt;Practical Quantum Computing: solving the wave equation using a quantum approach&lt;/a&gt;. Here the Hamiltonian is given as an Hermitian matrix and is simulated using Trotter-Suzuki formula. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is one of the reason why the number of gates is so high.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;huge&lt;/strong&gt; and so gate errors and coherence time are the real bottleneck here.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$10^{20}$&lt;/span&gt; gates would require &lt;span class=&quot;math-container&quot;&gt;$10^{11}$&lt;/span&gt; seconds, i.e. more than 3000 years.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conclusion: Hamiltonian simulation is costly and depending on your specific problem you will be limited by either the number of qubits or thegate errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PS: I did not had the time to read the paper yet, but you might be interested in &lt;a href=&quot;https://arxiv.org/abs/2003.06886&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamiltonian Simulation Algorithms for Near-Term Quantum Hardware&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2020-05-25T12:26:04.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12170" PostTypeId="1" CreationDate="2020-05-25T12:47:59.367" Score="6" ViewCount="61" Body="&lt;p&gt;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? ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here an illustrative use case:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know some good literature or papers to read, or as a starting point ?&#xA;Or good keywords to search for? &#xA;Should I look into compilers, even though papers in that direction never really name the attributes of the algorithms?&#xA;In which topic area do I have to look into?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Best regards,&#xA;krsp.&lt;/p&gt;&#xA;" OwnerUserId="12150" LastEditorUserId="55" LastEditDate="2020-08-27T12:56:26.107" LastActivityDate="2020-08-27T12:56:26.107" Title="How to decide which quantum device to use if a quantum algorithm is given?" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12171" PostTypeId="1" AcceptedAnswerId="12184" CreationDate="2020-05-25T15:32:47.543" Score="3" ViewCount="62" Body="&lt;p&gt;The problem of factoring large numbers may be in the so-called &quot;intermediate&quot; regime. These are problems that are in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt;, but are neither likely to be easy enough to be in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}$&lt;/span&gt; nor hard enough to be complete.  Following Shor's algorithm and a general consensus that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}\not\subseteq\mathrm{BQP}$&lt;/span&gt;, focus quickly turned to such difficult intermediate problems, with modest success. Now, a general consensus is that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; are likely incomparable, and research focus has moved a bit to problems, such as forrelation, that are in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; but are not likely even in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt; or even in any point of the polynomial hierarchy.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Nevertheless, one problem that appears to me to be in this &quot;intermediate&quot; area is that of finding small &lt;a href=&quot;https://en.wikipedia.org/wiki/Golomb_ruler&quot; rel=&quot;nofollow noreferrer&quot;&gt;Golomb rulers&lt;/a&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Imagine marking a 6&quot; ruler only at the 1&quot; position and the 4&quot;. To measure something one-inch in size, measure between the left edge and the 1&quot; mark; to measure something two-inches in size, measure between the 4&quot; mark and the right edge; to measure something three-inches in size, measure between the 3&quot; mark and the 4&quot; mark; etc. We can measure anything between one inches and six inches, with only two marks on the ruler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is there any hope of a quantum computer finding a large Golomb ruler? &#xA; That is, of finding a string of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;'s and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s that possess the Golomb property of not having distances measurable more than once?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here I think of having &lt;span class=&quot;math-container&quot;&gt;$n=O(m^2)$&lt;/span&gt; qubits, and preparing them in a uniform superposition having a fixed Hamming weight of &lt;span class=&quot;math-container&quot;&gt;$O(m)$&lt;/span&gt; ; using the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;'th index (&lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;'th qubit) of the ruler as a way to perform a controlled rotation by &lt;span class=&quot;math-container&quot;&gt;$e^{i/n}$&lt;/span&gt; I think would assign a random phase to all vectors but those corresponding to Golomb rulers... or something&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Upon consideration, perhaps it's best to ask for a quantum algorithm for the dual problem of generating a string on &lt;span class=&quot;math-container&quot;&gt;$n=O(m^2)$&lt;/span&gt; qubits that has the Golomb ruler property, with a Hamming weight of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, a solution with &lt;span class=&quot;math-container&quot;&gt;$m=4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=6$&lt;/span&gt; is the already-described string&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert 1010011\rangle;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;or equivalently&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert 1100101\rangle;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;a solution with &lt;span class=&quot;math-container&quot;&gt;$m=5$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=11$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert 110010000101\rangle;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a given length (given number of qubits &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;), what's the largest Hamming weight (largest &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;) that can be created for having the Golomb property?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-05-26T00:10:06.047" LastActivityDate="2020-05-26T00:10:06.047" Title="Could finding Golomb rulers be in $\mathrm{BQP}$?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;bqp&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12172" PostTypeId="1" AcceptedAnswerId="12180" CreationDate="2020-05-25T16:29:20.627" Score="1" ViewCount="80" Body="&lt;p&gt;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 &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22QFT3%22]],%22init%22:[1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I was testing with 3-Qubit set as you can see in the link. The expression used for calculating is&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JZ80m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JZ80m.png&quot; alt=&quot;QFT for 3- qubit&quot;&gt;&lt;/a&gt; &#xA;Note:-&lt;span class=&quot;math-container&quot;&gt;$[0.x_1x_2x_3...x_n] = \sum_{i=1} ^n x_i2^{-i} $&lt;/span&gt;.&#xA;I got the above expression from &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;br&gt;&#xA;As you can see from the link given above I was doing QFT on |100&gt;, which should yield a phase of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; (first qubit)(calculated from the above expression) but from the simulator it is showing phase f &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;. I also did the same simulation on Qiskit, i got the same Bloch representation, the same phase for the first Qubit &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;. Now my question is why the difference? Why the difference between calculated phase and the Bloch representation in the simulators? Please help!!   &lt;/p&gt;&#xA;" OwnerUserId="12154" LastEditorUserId="12154" LastEditDate="2020-05-25T16:35:56.573" LastActivityDate="2020-05-25T19:01:07.967" Title="QFT of 3-bit system" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12173" PostTypeId="2" ParentId="12168" CreationDate="2020-05-25T16:34:44.180" Score="1" Body="&lt;p&gt;Just to be really precise, let's take the definition of the &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gate as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y(\theta) = \exp(-i\frac{\theta}{2}Y) = \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;from the Qiskit documentation, and the values from the textbook example. Then you would have to apply a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-controlled &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta_1)$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\theta_1 = -2\arcsin\left(\frac{3/8}{1/4}\right)$&lt;/span&gt;, and similarly, a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-controlled &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta_2)$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\theta_2 = -2\arcsin\left(\frac{3/8}{1/2}\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastEditorUserId="10480" LastEditDate="2021-01-30T06:53:03.260" LastActivityDate="2021-01-30T06:53:03.260" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12176" PostTypeId="1" AcceptedAnswerId="12182" CreationDate="2020-05-25T17:06:48.433" Score="0" ViewCount="44" Body="&lt;p&gt;Assume my function Qiskit receives a certain &lt;code&gt;circuit&lt;/code&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="5955" LastEditDate="2020-05-25T19:33:08.503" LastActivityDate="2020-05-25T19:38:52.880" Title="Modifying measurements in a Qiskit circuit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12177" PostTypeId="1" AcceptedAnswerId="12178" CreationDate="2020-05-25T17:21:18.083" Score="3" ViewCount="138" Body="&lt;p&gt;From the &lt;a href=&quot;https://arxiv.org/pdf/1304.3061.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE paper&lt;/a&gt; they claim that a Hamiltonian can be expressed as a polynomial series of pauli operators (equation 1).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I noticed that &lt;span class=&quot;math-container&quot;&gt;$\sigma_y\sigma_z$&lt;/span&gt; is in fact not hermitian, and so it doesn't give me purely real energy eigenvalues.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="10485" LastEditDate="2020-05-25T19:22:53.947" LastActivityDate="2020-05-26T07:00:00.617" Title="VQE: Can I build a non-hermitian Hamiltonian with just Pauli matrices?" Tags="&lt;pauli-gates&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12178" PostTypeId="2" ParentId="12177" CreationDate="2020-05-25T17:43:40.560" Score="2" Body="&lt;p&gt;The Hamiltonian of the closed system is by definition a Hermitian operator. A quote from M. Nielsen and I. Chuang textbook page 82:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Postulate 2': The time evolution of the state of a closed quantum system is&#xA;  described by the Schrödinger equation,&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$i \hbar \frac{d |\psi\rangle}{dt} = H |\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;  &#xA;  &lt;p&gt;In this equation, &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, effectively setting &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; = 1. &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a fixed Hermitian operator known as the Hamiltonian of the closed system&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;The operator &lt;span class=&quot;math-container&quot;&gt;$\sigma_y \otimes \sigma_z$&lt;/span&gt; is Hermitian&lt;/strong&gt;, because &lt;span class=&quot;math-container&quot;&gt;$(\sigma_y \otimes \sigma_z)^\dagger = \sigma_y^{\dagger} \otimes \sigma_z^{\dagger} = \sigma_y \otimes \sigma_z$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For decomposing the Hamiltonian matrix into the sum of Pauli terms look in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis&quot;&gt;thread&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About &lt;em&gt;non-Hermitian Hamiltonians&lt;/em&gt; (they are not conventional Hamiltonians) can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3928/9459&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9006" LastEditDate="2020-05-26T07:00:00.617" LastActivityDate="2020-05-26T07:00:00.617" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12179" PostTypeId="1" AcceptedAnswerId="12181" CreationDate="2020-05-25T18:01:06.063" Score="1" ViewCount="85" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After reading through some of the resources from the accepted answer I came up with a response that works best for me:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The number of parameters required to describe all possible states of an n-qubit quantum system scales exponentially with n.&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;So an ansatz which can cover all possible states would need an exponential number of parameters. And that just won't do because:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We'd then need a classical optimistion algorithm which can search through an exponentially large parameter space.&lt;/li&gt;&#xA;&lt;li&gt;We'd need an exponential number of gates to actually prepare the state (certainly not good for a NISQ device with short coherence times).&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="10485" LastEditDate="2020-05-26T12:00:57.527" LastActivityDate="2020-05-26T12:00:57.527" Title="In which situations is it hard to find an ansatz?" Tags="&lt;vqe&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12180" PostTypeId="2" ParentId="12172" CreationDate="2020-05-25T19:01:07.967" Score="2" Body="&lt;p&gt;I think this is an issue of endianness of input. The Wikipedia article follows Nielsen &amp;amp; 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 &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22H%22],[%22Z%5E%C2%BD%22,%22%E2%80%A2%22],[%22Z%5E%C2%BC%22,1,%22%E2%80%A2%22],[1,%22H%22],[1,%22Z%5E%C2%BD%22,%22%E2%80%A2%22],[1,1,%22H%22],[%22rev3%22],[%22Amps1%22,%22Amps1%22,%22Amps1%22]],%22init%22:[1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;manually implemented circuit&lt;/a&gt; and the corresponding amplitudes - the phase is non-zero only on the 3rd qubit, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle + e^{2\pi i [0.100]}|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22QFT3%22],[%22Amps1%22,%22Amps1%22,%22Amps1%22]],%22init%22:[1]%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;library implementation in Quirk&lt;/a&gt; uses little-endian notation, so it's processing an input &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;, and the phases of all three qubits are non-zero.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-25T19:01:07.967" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12181" PostTypeId="2" ParentId="12179" CreationDate="2020-05-25T19:08:04.863" Score="1" Body="&lt;p&gt;If you haven't read the Qiskit chapter on &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulating Molecules Using VQE&lt;/a&gt; yet, that's a good place to start.  There's also a related response to a similar question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4077/8623&quot;&gt;here&lt;/a&gt;, which you might find helpful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/FeMoco&quot; rel=&quot;nofollow noreferrer&quot;&gt;FeMoco&lt;/a&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1902.02134&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-05-25T19:20:59.027" LastActivityDate="2020-05-25T19:20:59.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12182" PostTypeId="2" ParentId="12176" CreationDate="2020-05-25T19:38:52.880" Score="2" Body="&lt;p&gt;The easiest way to do this is probably by converting the circuit to a &lt;code&gt;DAGCircuit&lt;/code&gt;, which can be done using the method &lt;code&gt;from qiskit.converters import circuit_to_dag&lt;/code&gt;. From the DAG you can get properties, such as any measurement operations, by using the function &lt;code&gt;my_dag.named_nodes('measurement')&lt;/code&gt;. &lt;code&gt;DAGNode&lt;/code&gt; objects are returned which will tell you the properties of the measurement. You can then remove nodes using &lt;code&gt;my_dag.remove_op_node(a_measurement_node)&lt;/code&gt;, it is preferable to remove and add nodes than to modify inplace. Following this you could convert the &lt;code&gt;DAGCircuit&lt;/code&gt; back to a &lt;code&gt;QuantumCircuit&lt;/code&gt; using &lt;code&gt;from qiskit.converters import dag_to_circuit&lt;/code&gt; and then append any measurement operations as desired.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-25T19:38:52.880" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12183" PostTypeId="1" CreationDate="2020-05-25T20:15:17.290" Score="3" ViewCount="93" Body="&lt;p&gt;After a successful first run without problems, I found that I cannot connect any longer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.load_account() #previously enabled and saved, even updated&#xA;IBMQ.providers()  # returns empty why???&#xA;provider = IBMQ.get_provider()&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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. &#xA;I get this error&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;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.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ibmqfactory._initialize_providers:WARNING:2020-05-25 22:08:29,324: Unable to instantiate provider for {'hub': 'ibm-q', 'group': 'open', 'project': 'main'}: &quot;{'online_date': ['Not a valid datetime.']}&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ibmqfactory.load_account:WARNING:2020-05-25 22:08:29,325: No Hub/Group/Projects could be found for this account.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Even if I directly add the same hub, group and project, I am not able to retrieve a single provider. &#xA;If I run &lt;code&gt;IBMQ_provider()&lt;/code&gt; I get an empty list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is summarized as &lt;code&gt;IBMQProviderError: 'No provider matches the specified criteria&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you could give me a had, I would be very thankful.&lt;/p&gt;&#xA;" OwnerUserId="12157" LastEditorUserId="5955" LastEditDate="2020-05-26T10:34:06.347" LastActivityDate="2020-06-28T14:06:05.503" Title="IBMQfactory._initialize_providers Error" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12184" PostTypeId="2" ParentId="12171" CreationDate="2020-05-25T20:47:09.750" Score="2" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Theorem :&lt;/strong&gt; For any &lt;span class=&quot;math-container&quot;&gt;$n\in \mathbb N^*$&lt;/span&gt;, and for a fixed &lt;span class=&quot;math-container&quot;&gt;$c\in\{1,2\}$&lt;/span&gt;, the sequence &lt;span class=&quot;math-container&quot;&gt;$cnk^2+k,\ k\in[n-1]$&lt;/span&gt; forms a Golomb ruler.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Proof :&lt;/strong&gt; For &lt;span class=&quot;math-container&quot;&gt;$c=2$&lt;/span&gt;, we start with &lt;span class=&quot;math-container&quot;&gt;$$2n(x^2+y^2)+(x+y)=a.$$&lt;/span&gt; Given that &lt;span class=&quot;math-container&quot;&gt;$0\le\frac{x+y}{2n}&amp;lt;1$&lt;/span&gt;, we get &lt;span class=&quot;math-container&quot;&gt;$$x^2+y^2=\lfloor a/2n\rfloor.$$&lt;/span&gt; Thus &lt;span class=&quot;math-container&quot;&gt;$$x+y=a-2n\lfloor a/2n\rfloor=a\ \mathrm{mod}\ 2n$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$xy=\frac12\{(x+y)^2-(x^2+y^2)\}=\frac12\{(a\ \mathrm{mod} \ 2n)^2-\lfloor a/2n\rfloor\}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last 2 equations show that &lt;span class=&quot;math-container&quot;&gt;${x,y}$&lt;/span&gt; are the two roots of a polynomial of degree 2, hence determined in at most one way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$c=1$&lt;/span&gt;, we start with &lt;span class=&quot;math-container&quot;&gt;$$n(x^2-y^2)+(x-y)=a,\ x&amp;lt;y$$&lt;/span&gt; and since &lt;span class=&quot;math-container&quot;&gt;$0\le x-y&amp;lt;n$&lt;/span&gt;, it follows that &lt;span class=&quot;math-container&quot;&gt;$$x^2-y^2=\lfloor a/n\rfloor.$$&lt;/span&gt; Then &lt;span class=&quot;math-container&quot;&gt;$$x-y=a-n\lfloor a/n\rfloor=a\ \mathrm{mod}\ n.$$&lt;/span&gt; Dividing the above two equations, we get &lt;span class=&quot;math-container&quot;&gt;$$x+y=\frac{\lfloor a/n\rfloor}{a\ \mathrm{mod}\ n}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The last 2 equations form a system of 2 equations with 2 unknowns and hence uniquely define &lt;span class=&quot;math-container&quot;&gt;$\{x,y\}$&lt;/span&gt;. This completes the proof. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This algorithm can generate the sequence in &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(n)$&lt;/span&gt; time. I believe that a quantum algorithm using this will run on the same time since this is a deterministic algorithm. &lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2020-05-25T20:47:09.750" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12185" PostTypeId="1" AcceptedAnswerId="12192" CreationDate="2020-05-25T21:09:07.253" Score="4" ViewCount="69" Body="&lt;p&gt;I can't find the true difference between Quantum Neural Network (QNN) and Quantum-Inspired Neural Network (QINN).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have multiple guesses:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;QINN and QNN are absolutely the same thing (all QNNs are actually QINNs unless the true quantum computing hardware is developed)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;QINNs are the neural nets ensembles.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Something else.?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Thank you a lot for any information!&lt;/p&gt;&#xA;" OwnerUserId="12158" LastEditorUserId="55" LastEditDate="2020-06-08T12:30:11.917" LastActivityDate="2020-06-08T12:30:11.917" Title="Quantum NN vs Quantum-Inspired NN" Tags="&lt;quantum-gate&gt;&lt;machine-learning&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12186" PostTypeId="1" CreationDate="2020-05-25T21:33:11.850" Score="0" ViewCount="119" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E2VTX.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E2VTX.jpg&quot; alt=&quot;Q&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;C:/snippet_.qs(1,85): error QS3001: Syntax does not match any known patterns.&#xA;C:/snippet_.qs(1,26): error QS6104: No namespace with the name &quot;Microsoft.Quantum.Intrinsic&quot; exists.&#xA;C:/snippet_.qs(7,17): error QS5022: No identifier with the name &quot;ArcSin&quot; exists.&#xA;C:/snippet_.qs(7,30): error QS5022: No identifier with the name &quot;Sqrt&quot; exists.&#xA;C:/snippet_.qs(8,5): error QS5022: No identifier with the name &quot;Ry&quot; exists.&#xA;C:/snippet_.qs(11,25): error QS5022: No identifier with the name &quot;H&quot; exists.&lt;/p&gt;&#xA;" OwnerUserId="11600" LastEditorUserId="2879" LastEditDate="2020-05-25T22:53:42.667" LastActivityDate="2020-05-25T22:53:42.667" Title="Error running Q# notebooks: Syntax does not match any known patterns" Tags="&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12187" PostTypeId="2" ParentId="12186" CreationDate="2020-05-25T22:10:38.833" Score="2" Body="&lt;p&gt;You can see in the output of the first cell that the versions of packages &lt;code&gt;Microsoft.Quantum.Standard&lt;/code&gt; and &lt;code&gt;Microsoft.Quantum.Katas&lt;/code&gt; do not match; they have to match for you to be able to use &lt;code&gt;%kata&lt;/code&gt; command that invokes unit test (the first line of the second cell).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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 &lt;code&gt;%package&lt;/code&gt; command. All katas have instructions on how to update IQ# to a specific version, or you can use &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/install-guide/update#update-iq-for-jupyter-notebooks&quot; rel=&quot;nofollow noreferrer&quot;&gt;these instructions&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;code&gt;%kata&lt;/code&gt; command from the second cell.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-25T22:10:38.833" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12188" PostTypeId="1" AcceptedAnswerId="12189" CreationDate="2020-05-26T02:45:42.747" Score="3" ViewCount="93" Body="&lt;p&gt;How do IBM, D-Wave, etc. change phase physically? In real hardware?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="9006" LastEditDate="2020-05-26T06:55:38.427" LastActivityDate="2020-05-28T08:10:58.530" Title="How do IBM, D-Wave, etc. change phase physically?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;d-wave&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12189" PostTypeId="2" ParentId="12188" CreationDate="2020-05-26T08:28:54.417" Score="2" Body="&lt;p&gt;If by 'change phase' you mean the relative phase of the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, then the short answer is: IBM doesn't, D-Wave doesn't really care.&lt;/p&gt;&#xA;&lt;h2&gt;For IBM:&lt;/h2&gt;&#xA;&lt;p&gt;Whenever a phase gate (that is, a rotation around the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-axis, so that any subsequent rotation around these new axes is as if they were the original axes preceded by the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotation. In essence, the entire Bloch sphere is rotated 'through software' along the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-axis.&lt;/p&gt;&#xA;&lt;p&gt;This only works because of two things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-axis are a relatively arbitrary choice (they of course still need to be orthogonal). We like to think about the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-axis as &amp;quot;that axis for which the angle along the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-axis is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;&amp;quot;, but we can just as equal think of it the other way around: Setting the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-axis (completely arbitrary) then actually defines not only the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-axis but also the (angle of) the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-axis.&lt;/li&gt;&#xA;&lt;li&gt;The non-trivial rotations (that is, the rotations along axes in the &lt;span class=&quot;math-container&quot;&gt;$X-Y$&lt;/span&gt; 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&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt;; any phase can then be used to implement any angle. Therefore, the physical operations that performs the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;- and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-rotations are the same x-rays, only differing in phase.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;For D-Wave&lt;/h2&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-rotations are irrelevant. Please correct me if I am wrong.&lt;/p&gt;&#xA;&lt;h2&gt;Further reference&lt;/h2&gt;&#xA;&lt;p&gt;A good introduction on transmons, the type of qubits that IBM uses, can be found here:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=cb_f9KpYipk&quot; rel=&quot;nofollow noreferrer&quot;&gt;General introduction on transmons&lt;/a&gt; by Prof. Leo DiCarlo of QuTech&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=_MfABBLtBd0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Single qubit gates&lt;/a&gt; by Brian Taransinski from DiCarlo's lab&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=vwjlEdwi2LU&quot; rel=&quot;nofollow noreferrer&quot;&gt;Multi-qubit gates&lt;/a&gt; (i.e. entangling gates) by Adriaan Rol from DiCarlo's lab&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=KDANvtOkEc4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measurements on transmons&lt;/a&gt; by Niels Bultink, (previously I think) from DiCarlo's lab&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;h2&gt;Footnotes&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;This is a gross oversimplification and should not be perpetuated:)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-28T08:10:58.530" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12191" PostTypeId="2" ParentId="11863" CreationDate="2020-05-26T09:39:19.913" Score="1" Body="&lt;p&gt;We found the mistake.&#xA;In the first figure, when we compute q2x from q1x by :&#xA;1/ purple ccnot for the carry &#xA;2/ blue cnot for the summation&#xA;we unroll them in the wrong way (purple then blue instead blue then purple).&lt;/p&gt;&#xA;" OwnerUserId="11936" LastActivityDate="2020-05-26T09:39:19.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12192" PostTypeId="2" ParentId="12185" CreationDate="2020-05-26T12:51:29.053" Score="2" Body="&lt;p&gt;A QNN is a &quot;quantum implementation of a NN&quot; that actually runs on a quantum device. &#xA;Look for example at &lt;a href=&quot;https://arxiv.org/abs/1912.12486&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Tacchino et al.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A QINN instead is a complex model that runs on traditional hardware (maybe special-purpose, but still classical). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum vs. quantum inspired computing, look at this &lt;a href=&quot;http://marketing.us.fujitsu.com/rs/407-MTR-501/images/quantum-inspired-computing.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;white paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-05-26T12:51:29.053" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12193" PostTypeId="2" ParentId="12038" CreationDate="2020-05-26T15:42:43.117" Score="3" Body="&lt;p&gt;First things first, theoretically infinite dimensional Hilbert space is natural in quantum mechanics due to the relation &lt;span class=&quot;math-container&quot;&gt;$[x,p]=ih$&lt;/span&gt;. This produces the Heisenberg algebra. This algebra is solvable and then invoking the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie%E2%80%93Kolchin_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lie-Kolchin theorem&lt;/a&gt;, 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 &lt;em&gt;our Hilbert space is infinite dimensional&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1109.5724.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;The spectrum and eigenstates of any field quadrature operator restricted to a finite&#xA;  number N of photons are studied, in terms of the Hermite polynomials. By (naturally)&#xA;  defining approximate eigenstates, which represent highly localized wavefunctions with up&#xA;  to N photons, one can arrive at an appropriate notion of limit for the spectrum of the&#xA;  quadrature as N goes to infinity, in the sense that the limit coincides with the spectrum of&#xA;  the infinite-dimensional quadrature operator. In particular, this notion allows the spectra&#xA;  of truncated phase operators to tend to the complete unit circle, as one would expect. A&#xA;  regular structure for the zeros of the Christoffel-Darboux kernel is also shown.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0022123608000219&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&#xA;  .&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;But does that mean that infinite Hilbert spaces are relegated to the corners of theoretical physics? The answer is, not surprisingly, &lt;em&gt;no&lt;/em&gt;. The experimenters did find application of this, and is technically known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-variable_quantum_information&quot; rel=&quot;nofollow noreferrer&quot;&gt;continuous-variable quantum information&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Quoting Wikipedia :&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;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 &quot;quadratures&quot;, 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.&lt;/em&gt;   &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And all these have been formalised. For example, one can look &lt;a href=&quot;https://arxiv.org/pdf/1110.3234.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;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&#xA;  quantum teleportation are among the most celebrated ideas that have emerged from this new field. It was realized&#xA;  later on that using continuous-variable quantum information carriers, instead of qubits, constitutes an extremely&#xA;  powerful alternative approach to quantum information processing. This review focuses on continuous-variable&#xA;  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&#xA;  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&#xA;  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&#xA;  reports on the state of the art in this field, ranging from the basic theoretical tools and landmark experimental&#xA;  realizations to the most recent successful developments.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0008040.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Quantum error-correcting codes are constructed that embed a finite-dimensional code space in the infinite-dimensional&#xA;  Hilbert space of a system described by continuous quantum&#xA;  variables. These codes exploit the noncommutative geometr&#xA;  y&#xA;  of phase space to protect against errors that shift the value&#xA;  s&#xA;  of the canonical variables&#xA;  q and&#xA;  p. In the setting of quantum&#xA;  optics, fault-tolerant universal quantum computation can be&#xA;  executed on the protected code subspace using linear optical operations, squeezing, homodyne detection, and photon&#xA;  counting; however, nonlinear mode coupling is required for&#xA;  the preparation of the encoded states. Finite-dimensional&#xA;  versions of these codes can be constructed that protect encoded quantum information against shifts in the amplitude&#xA;  or phase of a&#xA;  d-state system. Continuous-variable codes can&#xA;  be invoked to establish lower bounds on the quantum capacity&#xA;  of Gaussian quantum channels.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;and finally &lt;a href=&quot;https://arxiv.org/pdf/1603.00065.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;We consider the quantum processor based on a chain of trapped ions to propose an architecture wherein the motional&#xA;  degrees of freedom of trapped ions (position and momentum) could be exploited as the computational Hilbert space. We&#xA;  adopt a continuous-variables approach to develop a toolbox of quantum operations to manipulate one or two vibrational&#xA;  modes at a time. Together with the intrinsic non-linearity of the qubit degree of freedom, employed to mediate the&#xA;  interaction between modes, arbitrary manipulation and readout of the ionic wave function could be achieved.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Thus, there are several proposals for using infinite dimensional Hilbert spaces, and the same is used in optics &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0110039.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;sometimes&lt;/a&gt;. These are just a few ways in which this can be utilised, and more are expected to open as research progresses.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2020-05-26T15:42:43.117" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12194" PostTypeId="1" AcceptedAnswerId="12201" CreationDate="2020-05-26T18:29:52.810" Score="3" ViewCount="74" Body="&lt;p&gt;What are the ways to rewrite a single-qubit gate follow by a signle-qubit error?&lt;/p&gt;&#xA;" OwnerUserId="12162" LastEditorUserId="12162" LastEditDate="2020-05-29T20:35:25.970" LastActivityDate="2020-05-29T20:35:25.970" Title="single-qubit gate followed by a single-qubit error" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12196" PostTypeId="1" AcceptedAnswerId="12197" CreationDate="2020-05-26T23:14:11.827" Score="1" ViewCount="148" Body="&lt;p&gt;I have a Kraus operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is composed of a list of matrices &lt;span class=&quot;math-container&quot;&gt;$M_k$&lt;/span&gt; satisfying&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{k} M_k^\dagger M_k = I$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would like to control the application of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; using a control qubit. This controlled operation will have a Kraus operator &lt;span class=&quot;math-container&quot;&gt;$C(M)$&lt;/span&gt;. Given &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as a list of matrices, how do I compute a list of matrices describing the Kraus operator &lt;span class=&quot;math-container&quot;&gt;$C(M)$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, what are Kraus operators for the controlled amplitude damping channel?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a perfectly valid answer to this question is &quot;this concept of controlling a Kraus operator is ambiguous, here's why&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me clarify what I mean when I say &quot;controlled Kraus operator&quot;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My initial idea was to treat each &lt;span class=&quot;math-container&quot;&gt;$M_k$&lt;/span&gt; as if it was a unitary operation and created a derived &lt;span class=&quot;math-container&quot;&gt;$C(M_k) = \begin{bmatrix} I &amp;amp; 0 \\ 0 &amp;amp; M_k \end{bmatrix}$&lt;/span&gt;, but this produces a list of matrices whose upper left corner violates the &lt;span class=&quot;math-container&quot;&gt;$\sum_{k} C(M)_k^\dagger C(M)_k = I$&lt;/span&gt; requirement.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-05-26T23:59:47.733" LastActivityDate="2020-06-03T06:21:56.487" Title="Deriving a controlled Kraus operator from an uncontrolled Kraus operator" Tags="&lt;matrix-representation&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12197" PostTypeId="2" ParentId="12196" CreationDate="2020-05-27T00:20:26.590" Score="1" Body="&lt;p&gt;The concept of controlling a Kraus operator is not well defined. It produces ambiguous results.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZLaoj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZLaoj.png&quot; alt=&quot;interpretation 1&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But another completely valid circuit representation uses the opposite kind of control:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fHypW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fHypW.png&quot; alt=&quot;interpretation 2&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you produce the &quot;controlled dephasing operation&quot; by controlling the first circuit, you get a circuit that dephases the 11 subspace from the 00,01,10 subspace:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YOR1x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YOR1x.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas if you choose the other starting circuit, you get a circuit that dephases the 10 subspace from the 00,01,11 subspace:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UePch.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UePch.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;These controlled operations are &lt;em&gt;not equivalent&lt;/em&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In more detail, the problem comes down to the fact that, after the Kraus operator, you can apply any unitary operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the environment. The uncontrolled operator is unaffected by &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;'s presence, but the controlled operator is affected. There would need to be some convention around fixing this &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-05-27T00:25:45.120" LastActivityDate="2020-05-27T00:25:45.120" CommentCount="19" ContentLicense="CC BY-SA 4.0" />
  <row Id="12198" PostTypeId="2" ParentId="12067" CreationDate="2020-05-27T00:20:54.263" Score="1" Body="&lt;p&gt;Check your arguments to &lt;code&gt;TrotterStep()&lt;/code&gt;. You are passing &lt;code&gt;-IntAsDouble(j)&lt;/code&gt; as the &lt;code&gt;trotterStepSize&lt;/code&gt; argument, but I believe this should just be a constant, since it indicates the simulation time for each Trotter step.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I change that line of your code to do something like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let unitaryOperator = TrotterStep(evolutionGenerator, 1, 0.1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where I arbitrarily chose a value of &lt;code&gt;0.1&lt;/code&gt; for &lt;code&gt;trotterStepSize&lt;/code&gt;, I get some behavior that I believe is more like what you are expecting.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastActivityDate="2020-05-27T00:20:54.263" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12199" PostTypeId="1" AcceptedAnswerId="12200" CreationDate="2020-05-27T01:18:39.097" Score="4" ViewCount="67" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SPobD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SPobD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am trying to understand the meaning of the equation shown in the above image taken from &lt;a href=&quot;https://arxiv.org/abs/2005.02421&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$I\otimes I$&lt;/span&gt; and the RHS looks like &lt;span class=&quot;math-container&quot;&gt;$$\frac{I\otimes I+X\otimes X+Y\otimes Y+Z\otimes Z}{2},$$&lt;/span&gt;&#xA;but clearly they are not equal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Could anybody shed more light on this?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12167" LastEditorUserId="10480" LastEditDate="2021-03-10T03:20:19.713" LastActivityDate="2021-03-10T03:20:19.713" Title="Pauli Identity Using Tensor Network Notation" Tags="&lt;mathematics&gt;&lt;pauli-gates&gt;&lt;tensor-networks&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12200" PostTypeId="2" ParentId="12199" CreationDate="2020-05-27T07:51:35.033" Score="1" Body="&lt;p&gt;In your computation of the RHS of the equation, you treat the two &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So this calculation should look like this in terms of matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac12\left(&#xA;\begin{pmatrix}1\\0\\0\\1\end{pmatrix}^\dagger\otimes\begin{pmatrix}1\\0\\0\\1\end{pmatrix}+&#xA;\begin{pmatrix}0\\1\\1\\0\end{pmatrix}^\dagger\otimes\begin{pmatrix}0\\1\\1\\0\end{pmatrix}+&#xA;\begin{pmatrix}0\\-i\\i\\0\end{pmatrix}^\dagger\otimes\begin{pmatrix}0\\-i\\i\\0\end{pmatrix}+&#xA;\begin{pmatrix}1\\0\\0\\-1\end{pmatrix}^\dagger\otimes\begin{pmatrix}1\\0\\0\\-1\end{pmatrix}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Aternatively, using the map/state duality, you could prove this equality by showing:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="7422" LastEditorUserId="7422" LastEditDate="2020-05-27T07:57:35.517" LastActivityDate="2020-05-27T07:57:35.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12201" PostTypeId="2" ParentId="12194" CreationDate="2020-05-27T08:15:48.163" Score="3" Body="&lt;p&gt;Let's assume that your single qubit gate is &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, and it's followed by some noise operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. So, overall, you've implemented &lt;span class=&quot;math-container&quot;&gt;$AU$&lt;/span&gt;. You want to know if this can be written in the form &lt;span class=&quot;math-container&quot;&gt;$UB$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is a new noise operator. So, you just want to solve&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;AU=UB.&#xA;$$&lt;/span&gt;&#xA;To rearrange for &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, just pre-multiply by &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B=U^\dagger AU.&#xA;$$&lt;/span&gt;&#xA;As a bonus, if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; was unitary, you can easily see that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is unitary. If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is  Kraus operator, then you might have a trace preserving property such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_iA_i^\dagger A_i=I,&#xA;$$&lt;/span&gt;&#xA;then this also applies to your new description:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-27T08:15:48.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12202" PostTypeId="1" AcceptedAnswerId="12206" CreationDate="2020-05-27T08:48:15.477" Score="2" ViewCount="78" Body="&lt;p&gt;I am reading the book &quot;Quantum Computing verstehen&quot; by Matthias Homeister.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At the moment i'm having a look at the BB84 protocol (which is described in kind of an abstract way).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In this chapter a quantum circuit is shown, describing how Alice creates and sends a qubit and how Bob measures it.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/8RhVu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8RhVu.png&quot; alt=&quot;BB84 circuit&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now Alice qubit-creation step is described as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{1. generate a random classical bit } a \text{ and initialize the qubit } | x \rangle \gets  |a\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{2. generate a second random classical bit } a' \text{ . If } a'=1 \text{ apply the Hadamard matrix to }|a\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12168" LastEditorUserId="55" LastEditDate="2020-05-27T16:17:08.050" LastActivityDate="2020-05-27T16:17:08.050" Title="Hadamard gate with two inputs in the circuit for the BB84 protocol?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;cryptography&gt;&lt;hadamard&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12204" PostTypeId="1" CreationDate="2020-05-27T09:58:06.787" Score="2" ViewCount="45" Body="&lt;p&gt;I have searched for works  that focus on designing a fault-tolerant quantum circuit for a specialized application and only found 'Error-corrected quantum annealing with hundreds of qubits' by Pudenz, Albash and Lidar from 2014. May be I am searching using the wrong keywords, but are there other works? Are there obvious issues with following this approach? Are there examples of addressing this idea in classical circuits?&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-10-12T07:27:55.917" LastActivityDate="2020-10-12T07:27:55.917" Title="Is there any published research on quantum fault tolerant circuits that are designed for a specific task or algorithm?" Tags="&lt;algorithm&gt;&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12205" PostTypeId="1" AcceptedAnswerId="12248" CreationDate="2020-05-27T12:54:21.773" Score="0" ViewCount="154" Body="&lt;p&gt;In regards to &quot;Classification with Quantum Neural Networks on near term processors&quot; (which you can find &lt;a href=&quot;https://arxiv.org/abs/1802.06002&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) , there are still a few things that do not make entirely sense to me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, why is the architecture called a &quot;neural network&quot;? 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hope you can clarify this for me.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance! &lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="55" LastEditDate="2020-08-01T11:37:19.640" LastActivityDate="2020-08-01T11:37:19.640" Title="Why is Farhi and Neven's architecture described in &quot;Classification with Quantum Neural Network on near term processors&quot; called a Neural Network?" Tags="&lt;machine-learning&gt;&lt;neural-network&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12206" PostTypeId="2" ParentId="12202" CreationDate="2020-05-27T12:56:05.847" Score="3" Body="&lt;p&gt;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 &lt;code&gt;CNOT&lt;/code&gt; gate, that applies an &lt;code&gt;x&lt;/code&gt; gate to the target qubit when the control is 1. This gate works in exactly the same way, only that it applies the &lt;code&gt;h&lt;/code&gt; gate instead of the &lt;code&gt;x&lt;/code&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-27T12:56:05.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12207" PostTypeId="1" AcceptedAnswerId="12284" CreationDate="2020-05-27T13:06:28.783" Score="6" ViewCount="121" Body="&lt;p&gt;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 &quot;we're focused on sustainable solutions that will change the world&quot;; &quot;in the future, topological qubits will allow us to reach fault-tolerance&quot;, etc.)&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-05-31T17:53:26.863" LastActivityDate="2020-06-02T00:15:09.697" Title="Is there any legitimate information about Microsoft quantum hardware?" Tags="&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12209" PostTypeId="2" ParentId="6496" CreationDate="2020-05-27T17:04:52.613" Score="2" Body="&lt;p&gt;There's a known theorem known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Solovay%E2%80%93Kitaev_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solovay-Kitaev theorem&lt;/a&gt; which can be used to deduce the order of the number of gates required to approximate any unitary operator of arbitrary dimension quantum systems.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, suppose we have a quantum system with states in &lt;span class=&quot;math-container&quot;&gt;$\mathbb C^n$&lt;/span&gt;. We take a universal family of gates (the OP wants 1 and 2 qubit ones, so...) say &lt;span class=&quot;math-container&quot;&gt;$\{CNOT, H, X, Z, R(\pi/8)\}$&lt;/span&gt;. Then one can approximate any unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with accuracy &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathcal O(n^2\log^4\frac1{\epsilon})$&lt;/span&gt; gates.&lt;/p&gt;&#xA;" OwnerUserId="14" LastActivityDate="2020-05-27T17:04:52.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12210" PostTypeId="2" ParentId="12080" CreationDate="2020-05-27T17:40:16.590" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First, you need to define the operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; you're interested in and the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with respect to which you want to compute the expecation value. So we're looking for &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E = \langle\psi|O|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;In the code below we have &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; = &lt;code&gt;op&lt;/code&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; = &lt;code&gt;psi&lt;/code&gt;.&#xA;See also there for your use-case of a &lt;code&gt;WeightedPauliOperator&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# you can define your operator as circuit&#xA;circuit = QuantumCircuit(2)&#xA;circuit.z(0)&#xA;circuit.z(1)&#xA;op = CircuitOp(circuit)  # and convert to an operator&#xA;&#xA;# or if you have a WeightedPauliOperator, do&#xA;op = weighted_pauli_op.to_opflow()&#xA;&#xA;# but here we'll use the H2-molecule Hamiltonian&#xA;from qiskit.aqua.operators import X, Y, Z, I&#xA;op =  (-1.0523732 * I^I) + (0.39793742 * I^Z) + (-0.3979374 * Z^I) \&#xA;    + (-0.0112801 * Z^Z) + (0.18093119 * X^X)&#xA;&#xA;# define the state you w.r.t. which you want the expectation value&#xA;psi = QuantumCircuit(2)&#xA;psi.x(0) &#xA;psi.x(1)&#xA;&#xA;# convert to a state&#xA;psi = CircuitStateFn(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are now different ways to evaluate the expectation value. The straightforward, &quot;mathematical&quot;, approach would be to take the adjoint of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (which is &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|$&lt;/span&gt;) and multiply with &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to get the expectation. You can actually do exactly this in Qiskit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# easy expectation value, use for small systems only!&#xA;print('Math:', psi.adjoint().compose(op).compose(psi).eval().real)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;to get &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Exact: -1.0636533199999998&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is only suitable for small systems though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To use the simulators, and the also get the shot-based result, you can use the &lt;code&gt;PauliExpectation&lt;/code&gt; (shots), &lt;code&gt;AerPauliExpectation&lt;/code&gt; (exact) or &lt;code&gt;MatrixExpectation&lt;/code&gt; (exact).&#xA;Here's how to do it:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.operators import PauliExpectation, CircuitSampler, StateFn&#xA;&#xA;# define your backend or quantum instance (where you can add settings)&#xA;backend = Aer.get_backend('qasm_simulator') &#xA;q_instance = QuantumInstance(backend, shots=1024)&#xA;&#xA;# define the state to sample&#xA;measurable_expression = StateFn(op, is_measurement=True).compose(psi) &#xA;&#xA;# convert to expectation value&#xA;expectation = PauliExpectation().convert(measurable_expression)  &#xA;&#xA;# get state sampler (you can also pass the backend directly)&#xA;sampler = CircuitSampler(q_instance).convert(expectation) &#xA;&#xA;# evaluate&#xA;print('Sampled:', sampler.eval().real)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which yields&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Sampled: -1.0530518430859401&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This result varies if you execute multiple times.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For comparison, here the other methods to evaluate the expecation value&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;expectation = AerPauliExpectation().convert(measurable_expression)&#xA;sampler = CircuitSampler(backend).convert(expectation)  &#xA;print('Snapshot:', sampler.eval().real) &#xA;&#xA;expectation = MatrixExpectation().convert(measurable_expression)&#xA;sampler = CircuitSampler(backend).convert(expectation)  &#xA;print('Matrix:', sampler.eval().real) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;which produces&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Snapshot: -1.06365328&#xA;Matrix: -1.06365328&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I hope that clarifies how to compute the expectation value!&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9800" LastEditDate="2020-05-28T07:48:53.440" LastActivityDate="2020-05-28T07:48:53.440" CommentCount="15" ContentLicense="CC BY-SA 4.0" />
  <row Id="12212" PostTypeId="1" CreationDate="2020-05-28T00:03:26.877" Score="3" ViewCount="222" Body="&lt;p&gt;I am trying to show that for any qubit state p, the following holds:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I = \frac{\rho  + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y  + \sigma_z\rho\sigma_z}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried different manipulations, but got stuck... Will be grateful for any help!&lt;/p&gt;&#xA;" OwnerUserId="12162" LastEditorUserId="55" LastEditDate="2020-07-26T18:17:29.900" LastActivityDate="2020-07-28T15:33:51.347" Title="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$" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;textbook-and-exercises&gt;" AnswerCount="7" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12213" PostTypeId="1" CreationDate="2020-05-28T00:53:52.753" Score="3" ViewCount="164" Body="&lt;p&gt;Hi I am quite new to Quantum Mechanics and I came across with this confusion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say there are 2 entangled particles A and B. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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 ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;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 ?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="9759" LastEditDate="2020-05-28T01:15:48.287" LastActivityDate="2020-05-28T04:36:17.573" Title="Quantum Entanglement : Changing states after measurement" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12214" PostTypeId="1" AcceptedAnswerId="12223" CreationDate="2020-05-28T04:21:27.053" Score="2" ViewCount="104" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12178" LastEditorUserId="55" LastEditDate="2020-10-12T07:27:50.927" LastActivityDate="2020-10-12T07:27:50.927" Title="Smallest Distance-5 Quantum Error Correction Code?" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12215" PostTypeId="2" ParentId="12213" CreationDate="2020-05-28T04:36:17.573" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;For example, if the original state was &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|01\rangle + |10\rangle)$&lt;/span&gt;, measuring the first particle in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; will indeed collapse the second one to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. But if the original state was &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$&lt;/span&gt;, the state of the second particle will be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and if it was &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}|0\rangle\otimes(|0\rangle + |1\rangle) + \frac{1}{\sqrt2}|11\rangle$&lt;/span&gt;, the second particle will end up in &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;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...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-05-28T04:36:17.573" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12216" PostTypeId="1" AcceptedAnswerId="12276" CreationDate="2020-05-28T05:21:46.373" Score="1" ViewCount="31" Body="&lt;p&gt;I'm a complete beginner in Q#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider the code in the following image:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pMmkX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pMmkX.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For some reason, there always is an error message when I try to import anything. It also implies to keywords like &lt;code&gt;Length&lt;/code&gt;. The error message is :&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No namespace with the name &quot;Microsoft.Quantum.Canon&quot; exists.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, my code works just fine. The code in the image is taken directly from user guide of Q#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any Suggestions?&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="55" LastEditDate="2020-06-04T15:03:36.937" LastActivityDate="2020-06-04T15:03:36.937" Title="'Unable to import' error message in Q# using VS Code" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12217" PostTypeId="1" AcceptedAnswerId="12219" CreationDate="2020-05-28T06:47:22.800" Score="2" ViewCount="54" Body="&lt;p&gt;I am writing an Excel spreadsheet to work through the matrix algebra for a simple Bell's game with the following parameters.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\bra}[1]{\langle #1|}\newcommand{\ket}[1]{|#1\rangle}A_\pm = \frac{1}{2}\times(I \pm Z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A'_\pm = \frac{1}{2}\times(I \pm X)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B_\pm = \frac{1}{2}\times(I \pm \frac{1}{\sqrt{2}}\times(X+Z))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B'_\pm- = \frac{1}{2}\times(I \pm \frac{1}{\sqrt{2}}\times(X-Z))$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completion, I will define the matrices:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I = \begin{bmatrix}1&amp;amp;0\\0&amp;amp;1\end{bmatrix},\qquad&#xA;X=\begin{bmatrix}0&amp;amp;1\\1&amp;amp;0\end{bmatrix},\qquad&#xA;Z = \begin{bmatrix}1&amp;amp;0\\0&amp;amp;-1\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expectation value  is calculated using the following:&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Sample calc:&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$Pr(A_+,B_+) = \bra{Phi} A\otimes{B} \ket{Phi}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&amp;lt;AB&amp;gt; = Pr(A_+,B_+)\times1 + Pr(A_-,B_-)\times1 + Pr(A_+,B_-)\times(-1) + Pr(A_-,B_+)\times(-1)$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The CHSH Inequality states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$ &amp;lt;AB&amp;gt;-&amp;lt;AB'&amp;gt;+&amp;lt;A'B&amp;gt;+&amp;lt;A'B'&amp;gt; \leq 2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is typically shown is that when Phi equals an entangled state, the outcome violates the CHSH Inequality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, running through the above calcs with Phi equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Phi = \frac{\ket{00}}{\sqrt{2}} + \frac{\ket{11}}{\sqrt{2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can show the expectation value is &lt;span class=&quot;math-container&quot;&gt;$2\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I then calculated the sum with Phi equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Phi = \ket{00}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The expectation value I got is &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is two parts.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;First, is this value correct?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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).&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12050" LastEditorUserId="55" LastEditDate="2020-05-28T07:57:59.053" LastActivityDate="2020-05-28T07:57:59.053" Title="What would the CHSH inequality be equal to if the two qubits were separable?" Tags="&lt;pauli-gates&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12218" PostTypeId="2" ParentId="12212" CreationDate="2020-05-28T07:49:29.830" Score="2" Body="&lt;p&gt;For arbitrary one qubit density matrix we have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{I}{2} + \frac{r_x \sigma_x + r_y \sigma_y + r_z \sigma_z}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|r| \le 1$&lt;/span&gt;. Here we should take into account that &lt;span class=&quot;math-container&quot;&gt;$\sigma_i  \sigma_j  \sigma_i = -\sigma_j$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$i \ne j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i, j \in \{x, y, z\}$&lt;/span&gt;, and, also &lt;span class=&quot;math-container&quot;&gt;$\sigma_i\sigma_i=I$&lt;/span&gt;. With this we will obtain the equality presented in the question. Let's see, for example what will be equal the &lt;span class=&quot;math-container&quot;&gt;$\sigma_x \rho \sigma_x$&lt;/span&gt; term:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_x \rho \sigma_x = \frac{I}{2} + \frac{r_x \sigma_x - r_y \sigma_y - r_z \sigma_z}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, we will obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\rho  + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y  + \sigma_z\rho\sigma_z}{2} = \\&#xA;=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 $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-28T11:05:16.583" LastActivityDate="2020-05-28T11:05:16.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12219" PostTypeId="2" ParentId="12217" CreationDate="2020-05-28T07:50:51.837" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;First, is this value correct?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Yes, it is. If you expand out the calculation you're doing, this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{2}\langle\psi|X\otimes X+Z\otimes Z|\psi\rangle&#xA;$$&lt;/span&gt;&#xA;for any two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. In the particular case &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|00\rangle$&lt;/span&gt;, it's easy to extract that this is &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}$&lt;/span&gt;. Indeed, for any separable state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=(\cos\theta_1|0\rangle+\sin\theta_1|1\rangle)\otimes(\cos\theta_2|0\rangle+\sin\theta_2|1\rangle),&#xA;$$&lt;/span&gt;&#xA;you get the same answer.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Not really. If the bits are classical, the only measurement you can make on them is in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-28T07:50:51.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12220" PostTypeId="2" ParentId="12212" CreationDate="2020-05-28T07:53:49.013" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \begin{pmatrix}&#xA;a &amp;amp; \beta \\&#xA;\overline{\beta} &amp;amp; 1-a&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$a\in[0,1]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta \in \mathbb{C}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(1-2a)^2  + 4 |\beta|^2 \leq 1$&lt;/span&gt;. Then we can directly compute the action of the Pauli conjugation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_x \rho \sigma_x = \begin{pmatrix} &#xA;1-a &amp;amp; \overline{\beta} \\&#xA;\beta &amp;amp; a&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_y \rho \sigma_y = \begin{pmatrix} &#xA;1-a &amp;amp; -\overline{\beta} \\&#xA;-\beta &amp;amp; a&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_z \rho \sigma_z = \begin{pmatrix} &#xA;a &amp;amp; -\beta \\&#xA;-\overline{\beta} &amp;amp; 1-a&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Summing these up with &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and dividing through by &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; we get the desired result. &lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-05-28T07:53:49.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12222" PostTypeId="2" ParentId="12212" CreationDate="2020-05-28T08:10:07.890" Score="0" Body="&lt;p&gt;Assuming &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a pure state, these are the explicit calculations. You can easily generalize to mixed states.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|{#1}\rangle}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\langle{#1}|}$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} = \alpha\ket{0}+ \beta\ket{1}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta \in \mathbb{C}^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus &lt;span class=&quot;math-container&quot;&gt;$\rho = \ket{\psi}\bra{\psi} = \begin{pmatrix} \alpha\alpha^* &amp;amp; \alpha\beta^* \\ \beta\alpha^* &amp;amp; \beta\beta^*\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now &lt;span class=&quot;math-container&quot;&gt;$\sigma_x = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{pmatrix}$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$ \sigma_x \rho \sigma_x = \begin{pmatrix} \beta\beta^* &amp;amp; \beta\alpha^* \\ \alpha\beta^* &amp;amp; \alpha\alpha^*\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Similarly, you can compute &lt;span class=&quot;math-container&quot;&gt;$\sigma_y\rho\sigma_y = \begin{pmatrix} \beta\beta^* &amp;amp; -\beta\alpha^* \\ -\alpha\beta^* &amp;amp; \alpha\alpha^*\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_z\rho\sigma_z = \begin{pmatrix} \alpha\alpha* &amp;amp; -\alpha\beta* \\ -\beta\alpha* &amp;amp; \beta\beta*\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, summing up: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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^*) &amp;amp; 0 \\ 0 &amp;amp; 2(\alpha\alpha^* + \beta\beta^*) \end{pmatrix}  = I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-05-29T17:47:33.947" LastActivityDate="2020-05-29T17:47:33.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12223" PostTypeId="2" ParentId="12214" CreationDate="2020-05-28T08:10:19.017" Score="2" Body="&lt;p&gt;If you look in this &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9608006&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, section 7, they give an [[11,1,5]] code, and show that it is the smallest you can have.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In general, for these sorts of questions, a great starting point is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9705052&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman's thesis&lt;/a&gt;. That's where I found this result stated.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-28T08:10:19.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12224" PostTypeId="2" ParentId="12212" CreationDate="2020-05-28T08:36:55.483" Score="2" Body="&lt;p&gt;This method is largely similar to Davit's (this covers a slightly more general case where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is any arbitrary matrix with trace 1, and you easily see how to adjust it without the trace 1 condition). Any &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix can be decomposed as &lt;span class=&quot;math-container&quot;&gt;$aI+\vec{n}\cdot\vec{\sigma}$&lt;/span&gt; if we allow &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt; to take on arbitrary complex values. Moreover, two &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices are equal if an only if their values of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt; are equal. So, let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tau=\frac{\rho  + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y  + \sigma_z\rho\sigma_z}{2}.&#xA;$$&lt;/span&gt;&#xA;We want to show that &lt;span class=&quot;math-container&quot;&gt;$a=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{n}=0$&lt;/span&gt;. Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a=\text{Tr}(\tau)/2,\qquad n_i=\text{Tr}(\sigma_i\tau)/2.&#xA;$$&lt;/span&gt;&#xA;Remember that trace is invariant under cyclic permutations, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&#xA;Similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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).&#xA;$$&lt;/span&gt;&#xA;Now use the anti-commutation properties of the Pauli matrices to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;n_x=\frac12\text{Tr}(2\rho\sigma_x -\rho\sigma_x  - \rho\sigma_x)=0.&#xA;$$&lt;/span&gt;&#xA;The other two components are just the same.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-05-28T08:36:55.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12225" PostTypeId="1" CreationDate="2020-05-28T12:33:01.667" Score="3" ViewCount="51" Body="&lt;p&gt;I am trying IBM's code for graphing T1 and I keep getting the following error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;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.&#xA;/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.&#xA;  return func(*args, **kwargs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The link to the code is here: &lt;a href=&quot;https://quantum-computing.ibm.com/docs/guide/wwwq/decoherence&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/guide/wwwq/decoherence&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7856" LastEditorUserId="55" LastEditDate="2020-06-08T12:29:39.497" LastActivityDate="2020-07-08T14:04:35.460" Title="Graphing T1 using Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12226" PostTypeId="1" CreationDate="2020-05-28T12:43:34.170" Score="2" ViewCount="59" Body="&lt;p&gt;Is there a tool which takes the adjacency matrix of a graph as input and prints out a table with all stabilizer measurements?&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="55" LastEditDate="2020-05-28T15:31:11.960" LastActivityDate="2020-05-30T21:38:30.933" Title="Is there a tool that shows me all $2^n$ stabilizers for a given graph state?" Tags="&lt;graph-states&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12227" PostTypeId="2" ParentId="12226" CreationDate="2020-05-28T13:44:02.983" Score="5" Body="&lt;p&gt;To obtain the stabilisers of a graph state, from its adjacency matrix:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Change all 1s to Zs&lt;/li&gt;&#xA;&lt;li&gt;Change all 0s to identity operators&lt;/li&gt;&#xA;&lt;li&gt;Put X operators on the diagonal&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Each row then represents a stabiliser of the graph state, and any nontrivial stabiliser is a product of one or more rows. &lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2020-05-28T13:44:02.983" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12228" PostTypeId="1" CreationDate="2020-05-28T14:12:43.683" Score="1" ViewCount="59" Body="&lt;p&gt;I'm trying to construct a circuit that performs the quantum transformation :&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ce534.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ce534.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is some function. Is there a way to do it without going through every possible value of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="12041" LastEditorUserId="55" LastEditDate="2020-07-26T18:04:27.120" LastActivityDate="2020-07-26T18:04:27.120" Title="How to construct a multi-qubit controlled rotation with variable angle?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-07-29T00:30:20.200" ContentLicense="CC BY-SA 4.0" />
  <row Id="12229" PostTypeId="2" ParentId="12199" CreationDate="2020-05-28T16:03:21.900" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, the left side is the identity map&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal E_L(\rho)=\rho\ ,&#xA;$$&lt;/span&gt;&#xA;and the right side is the map&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal E_R(\rho) = \sum \sigma_i \mathrm{tr}(\sigma_i\rho)\ .&#xA;$$&lt;/span&gt;&#xA;So the claim is that &lt;span class=&quot;math-container&quot;&gt;$E_R(\rho)$&lt;/span&gt; is the identity channel.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[X^\dagger Y]$&lt;/span&gt;, 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\rho\rangle = \sum_i |\sigma_i\rangle\langle\sigma_i|\rho\rangle&#xA;$$&lt;/span&gt;&#xA;with an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|\sigma_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-05-28T16:03:21.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12231" PostTypeId="2" ParentId="12212" CreationDate="2020-05-28T19:19:16.493" Score="1" Body="&lt;p&gt;Chapter VII. E. in &lt;a href=&quot;https://arxiv.org/pdf/1902.00967.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Daniel Lidar's&lt;/a&gt; notes. Use &lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{2}(I + \vec{v}\cdot\vec{\sigma})$&lt;/span&gt; and products of Pauli matrices:&lt;/p&gt;&#xA;&lt;p&gt;Check for each pair that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sigma_i \sigma_j = \delta_{ij} I + i \epsilon_{ijk}\sigma_k$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Use it to show:&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\sigma_i \sigma_j \sigma_k = \delta_{ij} \sigma_k - \delta_{ik} \sigma_j + \delta_{jk} \sigma_i &#xA;+ i \epsilon_{ijk} I&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One more step&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\sigma_i \sigma_j \sigma_i = &#xA;2\delta_{ij} \sigma_i - \sigma_j = &#xA;\begin{cases}&#xA;+\sigma_j &amp;amp;, i = j\\&#xA;-\sigma_j &amp;amp;, i \neq j&#xA;\end{cases}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with this go to eq. 189 from &lt;a href=&quot;https://arxiv.org/pdf/1902.00967.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Daniel Lidar&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_x(I + \vec{v}\cdot \vec{\sigma}) \sigma_x = &#xA;I + v_x \sigma_x - v_y \sigma_y - v_z \sigma_z&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_y(I + \vec{v}\cdot \vec{\sigma}) \sigma_y = &#xA;I - v_x \sigma_x + v_y \sigma_y - v_z \sigma_z&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_z(I + \vec{v}\cdot \vec{\sigma}) \sigma_z = &#xA;I - v_x \sigma_x - v_y \sigma_y + v_z \sigma_z&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;add it together with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I(I + \vec{v}\cdot \vec{\sigma}) I = &#xA;I + v_x \sigma_x + v_y \sigma_y + v_z \sigma_z&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2(\rho &#xA;+ \sigma_x \rho \sigma_x &#xA;+ \sigma_y \rho \sigma_y &#xA;+ \sigma_z \rho \sigma_z) &#xA;= &#xA;4I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12140" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-05-28T19:19:16.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12232" PostTypeId="2" ParentId="8300" CreationDate="2020-05-28T20:07:47.030" Score="4" Body="&lt;p&gt;To form a RNOT gate , the basic gate operations HAD and PHASE() can be used.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;         ┌───┐┌───────────┐┌───┐ &#xA;        ─┤ H ├┤ U1(-pi/2) ├┤ H ├─ &#xA;         └───┘└───────────┘└───┘ &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Qiskit code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.h(reg)&#xA;qc.u1(math.radians(-90), reg)&#xA;qc.h(reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12189" LastEditorUserId="12280" LastEditDate="2020-07-10T05:54:22.877" LastActivityDate="2020-07-10T05:54:22.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12233" PostTypeId="2" ParentId="12214" CreationDate="2020-05-29T04:39:28.433" Score="0" Body="&lt;p&gt;Another good place to find codes with your desired parameters is this website: &lt;a href=&quot;http://www.codetables.de/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.codetables.de/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-05-29T04:39:28.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12234" PostTypeId="2" ParentId="12212" CreationDate="2020-05-29T07:26:08.407" Score="2" Body="&lt;p&gt;This is a special instance of a general linear algebra result.&lt;/p&gt;&#xA;&lt;p&gt;Note that the identity matrix &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\vec}{\operatorname{vec}}I$&lt;/span&gt; can be decomposed as &lt;span class=&quot;math-container&quot;&gt;$I=\sum_k v_k\otimes v_k^*$&lt;/span&gt; for any orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}_k$&lt;/span&gt;, and vice versa any such decomposition identifies the identity matrix.&lt;/p&gt;&#xA;&lt;p&gt;Now notice that the Pauli matrices are an orthonormal basis in an enlarged Hilbert space, meaning that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}[(\sigma_i/\sqrt2)(\sigma_j/\sqrt2)]=\delta_{ij}.$$&lt;/span&gt;&#xA;More explicitly, this is saying that we can think of the &lt;em&gt;matrices&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; as orthonormal &lt;em&gt;vectors&lt;/em&gt; in some space, &lt;span class=&quot;math-container&quot;&gt;$i.e.$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle \vec(\sigma_i/\sqrt2),\vec(\sigma_j/\sqrt2)\rangle=\delta_{ij}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\vec(B)$&lt;/span&gt; is the vectorisation of the operator &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$A_a\in\mathrm{Lin}(\mathcal X,\mathcal Y)$&lt;/span&gt; are a set of such orthonormal operators, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}(A_a^\dagger A_b)=\delta_{ab} \Longleftrightarrow \langle\mathrm{vec}(A_a),\mathrm{vec}(A_b)\rangle=\delta_{ab},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vec(A_a)\in\mathcal Y\otimes\mathcal X$&lt;/span&gt; is the vectorisation of &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt;.&#xA;If the set is a basis, then we also have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_a (A_a)_{12} (A_a^*)_{34} = \delta_{13}\delta_{24}&#xA;\Longleftrightarrow&#xA;\sum_a\vec(A_a)\vec(A_a)^\dagger = I_{\mathcal Y\otimes\mathcal X}&#xA;$$&lt;/span&gt;&#xA;Now, the statement we are interested in is of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sum_a A_a \rho A_a^\dagger = I$&lt;/span&gt;. This amounts to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{a34} (A_a)_{13} (A_a^*)_{24} \rho_{34} = \delta_{12}&#xA;\Longleftrightarrow&#xA;\sum_a (A_a\otimes A_a^*)\vec(\rho) = \lvert m\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lvert m\rangle\equiv\sum_k \lvert k,k\rangle$&lt;/span&gt;.&#xA;The question is thus, what type of operator is &lt;span class=&quot;math-container&quot;&gt;$\sum_a A_a\otimes A_a^*$&lt;/span&gt;?&#xA;Componentwise, the relation with &lt;span class=&quot;math-container&quot;&gt;$\sum_a \vec(A_a)\vec(A_a)^\dagger$&lt;/span&gt; is clear:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(A_a\otimes A_a^*)_{ij,nm} = (A_a)_{in} (A_a^*)_{jm}&#xA;= (\vec(A_a)\vec(A_a)^\dagger)_{in,jm} = \delta_{ij}\delta_{nm},$$&lt;/span&gt;&#xA;that is, &lt;span class=&quot;math-container&quot;&gt;$A_a\otimes A_a^*$&lt;/span&gt; is the &lt;em&gt;Choi&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\vec(A_a)\vec(A_a)^\dagger$&lt;/span&gt;. Summing over &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; this is the identity, which means that &lt;span class=&quot;math-container&quot;&gt;$\sum_a A_a\otimes A_a^*$&lt;/span&gt; is the Choi of the identity, which is the projector over the maximally entangled state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_a A_a\otimes A_a^*=\lvert m\rangle\!\langle m\rvert.$$&lt;/span&gt;&#xA;We conclude that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_A A_a \rho A_a^\dagger &#xA;= \operatorname{unvec}\left(\sum_a (A_a\otimes A_a^*) \vec(\rho)\right)&#xA;= \operatorname{unvec}(\lvert m\rangle ) = I_{\mathcal X}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-27T12:17:51.090" LastActivityDate="2020-07-27T12:17:51.090" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12235" PostTypeId="2" ParentId="12225" CreationDate="2020-05-29T09:51:21.700" Score="1" Body="&lt;p&gt;This is not an error, there are two messages here and they are both just warnings. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first &lt;code&gt;Credentials are already in use&lt;/code&gt; error means that you have called &lt;code&gt;load_account()&lt;/code&gt; when you already had an account loaded. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second message, &lt;code&gt;DeprecationWarning&lt;/code&gt;, 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 &lt;code&gt;.i()&lt;/code&gt; instead of &lt;code&gt;.iden()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-29T09:51:21.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12236" PostTypeId="2" ParentId="12183" CreationDate="2020-05-29T09:55:25.543" Score="1" Body="&lt;p&gt;It is possible your credentials file has got messed up in someway. The best thing to do would be to run &lt;code&gt;IBMQ.delete_account()&lt;/code&gt; to remove the current account details, regenerate the API token in the IBM Quantum Experience and then save this new token with &lt;code&gt;IBMQ.save_account(token=new_token, overwrite=True)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-05-29T09:55:25.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12237" PostTypeId="2" ParentId="12183" CreationDate="2020-05-29T14:03:23.187" Score="0" Body="&lt;p&gt;This is likely due to a mismatch of &lt;code&gt;qiskit-terra&lt;/code&gt; and &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt; versions. If you're using &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt; 0.7 it requires &lt;code&gt;qiskit-terra&lt;/code&gt; 0.14. There's a bug in &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt;'s setup.py that missed this dependency. &lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-05-29T14:03:23.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12240" PostTypeId="1" CreationDate="2020-05-29T21:00:15.010" Score="2" ViewCount="43" Body="&lt;p&gt;I have been doing some practice problems from &quot;Gentle introduction to Quantum Computing&quot;. I am a little bit lost with this one:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The generalized Pauli group &lt;span class=&quot;math-container&quot;&gt;$\mathcal G_n$&lt;/span&gt; is defined by all elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal G_n$&lt;/span&gt; being of the form &lt;span class=&quot;math-container&quot;&gt;$\mu A_1\otimes A_2 \otimes \ldots\otimes A_n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A_j\in\left\lbrace I, X, Y, Z\right\rbrace$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu\in\left\lbrace 1, i, -1, -i\right\rbrace$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;em&gt;Show that generalized set of Pauli elements for a basis for the linear transformations on the vector space associated with an n-qubit system.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Is there any formal proof for this problem? And how do I approach it?&lt;/p&gt;&#xA;" OwnerUserId="12200" LastEditorUserId="55" LastEditDate="2020-06-04T15:01:33.540" LastActivityDate="2020-06-04T15:01:33.540" Title="Generalized set of Pauli elements for a basis for the linear transformations on the vector space" Tags="&lt;pauli-gates&gt;&lt;textbook-and-exercises&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-06-03T18:50:45.077" ContentLicense="CC BY-SA 4.0" />
  <row Id="12241" PostTypeId="1" AcceptedAnswerId="12245" CreationDate="2020-05-30T10:04:04.683" Score="1" ViewCount="29" Body="&lt;p&gt;I am starting with Q# and I would like to know how can I get the following qubit state:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;0.8|0⟩ + 0.2|1⟩&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;from a qubit initialized as |0⟩.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="12203" LastActivityDate="2020-05-30T18:25:00.027" Title="Change single qubit state in Q#" Tags="&lt;q#&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12243" PostTypeId="1" CreationDate="2020-05-30T15:05:30.653" Score="0" ViewCount="98" Body="&lt;p&gt;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.&#xA;And if there are any research papers or articles regarding my question please let me know.&lt;/p&gt;&#xA;" OwnerUserId="12207" LastEditorUserId="55" LastEditDate="2020-10-12T07:27:20.393" LastActivityDate="2020-10-12T07:27:20.393" Title="For what kinds of problems is quantum interference used in quantum computers?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12244" PostTypeId="2" ParentId="12243" CreationDate="2020-05-30T15:16:28.943" Score="2" Body="&lt;p&gt;Welcome, Yousef.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A quick answer to your question: &lt;a href=&quot;https://www.quantiki.org/wiki/grovers-search-algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt;, among others.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your first statement is a bit confused: &quot;the wave like nature of the electrons allows the qubits to interfere with each other amplifying correct answers and canceling out wrong answers.&quot; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indeed, interference is between &quot;paths of quantum computation&quot;: 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://blogs.scientificamerican.com/cross-check/scott-aaronson-answers-every-ridiculously-big-question-i-throw-at-him/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://blogs.scientificamerican.com/cross-check/scott-aaronson-answers-every-ridiculously-big-question-i-throw-at-him/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-05-30T15:16:28.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12245" PostTypeId="2" ParentId="12241" CreationDate="2020-05-30T18:25:00.027" Score="2" Body="&lt;p&gt;First, a clarification that in order to have a properly-normalized state, you probably intend to create a state something like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{0.8}  \left| 0 \right&amp;gt; + \sqrt{0.2} \left| 1 \right&amp;gt;$&lt;/span&gt;.&#xA;Here the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right&amp;gt;$&lt;/span&gt; is 0.8 and the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right&amp;gt;$&lt;/span&gt; is 0.2, when measuring in the computational basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, starting with a qubit in the &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right&amp;gt;$&lt;/span&gt; state, you can just apply an &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ry operation&lt;/a&gt; with the appropriate angle. You need to choose the angle such that &lt;span class=&quot;math-container&quot;&gt;$\cos({\theta}/{2}) = \sqrt{0.8}$&lt;/span&gt;. The &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.math.arccos&quot; rel=&quot;nofollow noreferrer&quot;&gt;ArcCos function&lt;/a&gt; will help you here.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastActivityDate="2020-05-30T18:25:00.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12246" PostTypeId="2" ParentId="12243" CreationDate="2020-05-30T18:33:28.603" Score="1" Body="&lt;p&gt;&lt;strong&gt;An example of the interference in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum circuit model&lt;/a&gt; of computation:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say we have some arbitrary one qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;. After applying the Hadamard gate we will have:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;because:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \qquad &#xA;H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)&#xA;\\&#xA;H = \frac{1}{\sqrt{2}} \begin{pmatrix}1&amp;amp;1\\1&amp;amp;-1 \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\alpha = \beta = \frac{1}{\sqrt{2}}$&lt;/span&gt;, we will have constructive interference for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and destructive interference for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H \frac{1}{\sqrt{2}}( |0\rangle  + |1\rangle) = \frac{1}{2}( |0\rangle  + |1\rangle + |0\rangle  - |1\rangle) = |0\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a &lt;a href=&quot;https://youtu.be/Y5WRv_9757A?t=259&quot; rel=&quot;nofollow noreferrer&quot;&gt;video lecture&lt;/a&gt; (starting from 4:19) about a similar example (with another gate) for the interference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One of the applications of the interference in QC can be found in the &lt;strong&gt;Deutch algorithm&lt;/strong&gt;. 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: &lt;a href=&quot;https://youtu.be/awpnsGl08bc?t=3020&quot; rel=&quot;nofollow noreferrer&quot;&gt;video lecture&lt;/a&gt; about the Deutch algorithm (from 50:20 to 1:10:00).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-05-30T19:28:39.700" LastActivityDate="2020-05-30T19:28:39.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12248" PostTypeId="2" ParentId="12205" CreationDate="2020-05-30T23:41:50.580" Score="2" Body="&lt;p&gt;On page 2, the authors of the paper write &quot;We continue to use the&#xA;word 'neural' to describe our network since the term has been adopted by the machine&#xA;learning community recognizing that the connection to neuroscience is now only historical&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11644" LastActivityDate="2020-05-30T23:41:50.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12249" PostTypeId="1" CreationDate="2020-05-31T01:06:23.907" Score="0" ViewCount="42" Body="&lt;p&gt;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&#xA;Can somebody help me in that &#xA;Thank you in advance&lt;/p&gt;&#xA;" OwnerUserId="12209" LastEditorUserId="55" LastEditDate="2020-06-08T12:29:13.460" LastActivityDate="2020-06-08T12:29:13.460" Title="How to create a Quantum circuit to implement the generation of 3-qubit uniform superposition wavefunction" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;superposition&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12250" PostTypeId="1" CreationDate="2020-05-31T05:36:17.947" Score="1" ViewCount="40" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="12211" LastEditorUserId="9006" LastEditDate="2020-05-31T06:34:23.360" LastActivityDate="2020-05-31T06:34:23.360" Title="Conversion of python code on Machine learning to realise on quantum processor" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12251" PostTypeId="2" ParentId="12250" CreationDate="2020-05-31T06:30:25.437" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, look at the following paper for a study on the relation between fuzzy and quantum logic:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/publication/225320983_On_the_Relation_between_Fuzzy_and_Quantum_Logic&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.researchgate.net/publication/225320983_On_the_Relation_between_Fuzzy_and_Quantum_Logic&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-05-31T06:30:25.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12252" PostTypeId="1" AcceptedAnswerId="12256" CreationDate="2020-05-31T06:43:54.333" Score="0" ViewCount="48" Body="&lt;p&gt;I'm currently reading the paper: &lt;a href=&quot;https://arxiv.org/pdf/1802.06002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1802.06002.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm a little bit stuck on the step of how to determine the following quantity:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OJjGL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OJjGL.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where U is a unitary operator acting on &lt;span class=&quot;math-container&quot;&gt;$|z,1\rangle$&lt;/span&gt;. The paper states the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eDUN4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eDUN4.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4pM6c.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4pM6c.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}(|z,1\rangle + iU|z,1\rangle |0\rangle) + \frac{1}{2}(|z,1\rangle-iU|z,1\rangle |1\rangle)$$&lt;/span&gt;&#xA;Shouldn't it result in&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And if this is the case, I'm confused as to how the probability of the auxiliary qubit being 1 is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}-\frac{1}{2}Im(\langle z, 1|U|z,1\rangle)$&lt;/span&gt;. Could someone explain why this is the case, and perhaps what I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastActivityDate="2020-06-30T12:05:15.553" Title="Question About Measuring an Operator For Quantum Neural Network Paper" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;machine-learning&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12253" PostTypeId="2" ParentId="12249" CreationDate="2020-05-31T06:45:54.517" Score="2" Body="&lt;p&gt;A uniformly distributed superposition can be prepared by Hadamard gate.&#xA;If you apply a Hadamard on single qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; you get state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt;. Both states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are measured with same probability &lt;span class=&quot;math-container&quot;&gt;$50  \%$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To prepare uniformly distributed state having &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, simply apply Hadamard on each of them. This leads to a operator &lt;span class=&quot;math-container&quot;&gt;$H \otimes H \otimes \dots \otimes H = \otimes^nH$&lt;/span&gt;. A state produced by this operation after application on initial state &lt;span class=&quot;math-container&quot;&gt;$|00\cdots00\rangle$&lt;/span&gt; is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2^n}}\big(|00\dots00\rangle+|00\dots01\rangle + |00\dots10\rangle+\cdots+|11\dots10\rangle+|11\dots11\rangle\big),$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;i.e. all combinations of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are presented with equal probability.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9459" LastEditDate="2020-05-31T09:23:18.903" LastActivityDate="2020-05-31T09:23:18.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12254" PostTypeId="1" AcceptedAnswerId="12255" CreationDate="2020-05-31T06:58:23.373" Score="4" ViewCount="235" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;My question: Is there any paper/article/business analysis dealing with Moore's law for quantum computer?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-05-31T12:07:41.477" LastActivityDate="2020-06-01T17:56:20.087" Title="Moore's law for quantum computers" Tags="&lt;ibm-q-experience&gt;&lt;resource-request&gt;&lt;physical-realization&gt;&lt;d-wave&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12255" PostTypeId="2" ParentId="12254" CreationDate="2020-05-31T08:03:09.040" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The notion of &quot;computational power&quot; 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].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;a href=&quot;https://arxiv.org/pdf/1811.12926.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1811.12926.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[2] &lt;a href=&quot;https://www.ibm.com/blogs/research/2019/03/power-quantum-device/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/blogs/research/2019/03/power-quantum-device/&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[3] &lt;a href=&quot;https://www.honeywell.com/en-us/newsroom/news/2020/03/quantum-volume-the-power-of-quantum-computers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.honeywell.com/en-us/newsroom/news/2020/03/quantum-volume-the-power-of-quantum-computers&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[4] &lt;a href=&quot;https://www.honeywell.com/content/dam/honeywell/files/HQS-QCCD-Demonstration.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.honeywell.com/content/dam/honeywell/files/HQS-QCCD-Demonstration.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[5] &lt;a href=&quot;https://quantum-computing.ibm.com/docs/cloud/backends/systems/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/cloud/backends/systems/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="332" LastEditDate="2020-06-01T17:56:20.087" LastActivityDate="2020-06-01T17:56:20.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12256" PostTypeId="2" ParentId="12252" CreationDate="2020-05-31T10:17:14.300" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|{#1}\rangle}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\langle{#1}|}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to the auxiliary qubit results in:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(\ket{z,1}(\ket{0}+\ket{1}) + iU\ket{z,1}(\ket{0}-\ket{1}))$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= \frac{1}{2}(\ket{z,1} + iU\ket{z,1})\ket{0} + \frac{1}{2}(\ket{z,1} - iU\ket{z,1})\ket{1}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then the probability of having one on the auxiliary qubit is &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$p(1) = ||P_1\ket{\psi}||^2$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; is the whole state and &lt;span class=&quot;math-container&quot;&gt;$P_1 = I \otimes \ket{1}\bra{1}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-05-31T10:22:32.730" LastActivityDate="2020-05-31T10:22:32.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12258" PostTypeId="1" AcceptedAnswerId="12259" CreationDate="2020-05-31T20:34:05.690" Score="2" ViewCount="93" Body="&lt;p&gt;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)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ A(\vec c)=\prod_{j=1}^3[I\otimes I\cos(c_j/2)-i\sigma_j\otimes\sigma_j\sin(c_j/2)] $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(this is taken from this paper &lt;a href=&quot;https://arxiv.org/abs/1306.2811&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1306.2811&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.extensions.UnitaryGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.extensions.UnitaryGate.html&lt;/a&gt;&#xA;and Gate &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.Gate.html#qiskit.circuit.Gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.Gate.html#qiskit.circuit.Gate&lt;/a&gt;, &#xA;but apart from saying that the function needs parameters, there isn't any more documentation. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet another option could be to have a function that would take a matrix, such as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;g = twoQubitGateFrom4-by-4Matrix( -- some 4x4 matrix that is the desired unitary -- )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Such that later I can apply it some where, e.g.,&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myQuantumCircuit.g(3,5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even parameterized?&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;myQuantumCircuit.g(3,5,vecAlpha)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12213" LastEditorUserId="55" LastEditDate="2020-06-04T15:02:58.553" LastActivityDate="2020-06-04T15:02:58.553" Title="Generic 2-qubit gate in qiskit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12259" PostTypeId="2" ParentId="12258" CreationDate="2020-05-31T20:55:28.523" Score="2" Body="&lt;p&gt;The iso() function allows you to add a gate, defined by means of a unitary, to your quantum circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-05-31T20:55:28.523" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12260" PostTypeId="1" AcceptedAnswerId="12262" CreationDate="2020-05-31T22:17:05.887" Score="1" ViewCount="474" Body="&lt;p&gt;I know that a Hadamard states is a purely probabalistic one; e.g.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H\vert 0\rangle=a\vert 0\rangle+b\vert 1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a^2=0.5$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b^2=0.5$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Are there any states in which the probabilities differ, and if there are how are they important?&lt;/p&gt;&#xA;" OwnerUserId="12207" LastEditorUserId="55" LastEditDate="2020-10-12T07:26:18.963" LastActivityDate="2020-10-12T07:26:18.963" Title="Is there a gate that puts a qubit into superposition with a not so purely probabalistic (50 50) outcome?" Tags="&lt;quantum-gate&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12261" PostTypeId="1" CreationDate="2020-05-27T03:18:58.150" Score="7" ViewCount="90" Body="&lt;p&gt;The asymptotic time complexity of Grover's algorithm is the square root of the time of a brute force algorithm. However, according to &lt;a href=&quot;https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=924493&quot; rel=&quot;noreferrer&quot;&gt;Perlner and Liu&lt;/a&gt;, the thermodynamic behavior (theoretical minimum on energy consumption) is asymptotically the same as brute force.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an analogous limit of Shor's algorithm? If so, this could potentially affect some cryptographic protocols.&lt;/p&gt;&#xA;" OwnerUserId="12235" OwnerDisplayName="Nic" LastEditorUserId="12235" LastEditDate="2020-06-02T16:01:42.423" LastActivityDate="2020-10-27T11:04:33.523" Title="What are the thermodynamic limits of Shor's algorithm" Tags="&lt;complexity-theory&gt;&lt;cryptography&gt;&lt;shors-algorithm&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12262" PostTypeId="2" ParentId="12260" CreationDate="2020-06-01T00:37:48.083" Score="5" Body="&lt;p&gt;Welcome to QCSE. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You already know that &lt;span class=&quot;math-container&quot;&gt;$a^2=b^2=0.5$&lt;/span&gt;.  For a single qubit gate akin to the Hadamard gate you can achieve any two probabilities you want, as long as they add to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example one trick that I learned was that you could choose ratios of Pythagorean triples, i.e. numbers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^2+b^2=c^2$&lt;/span&gt;. Let's have a gate called &lt;span class=&quot;math-container&quot;&gt;$\mathrm{YOUSEF}$&lt;/span&gt; defined as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{YOUSEF}\vert 0\rangle=\frac{3}{5}\vert 0\rangle+\frac{4}{5}\vert 1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such a gate may be useful in biasing your transition probabilities in a manner your algorithm dictates.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="45" LastEditDate="2020-06-01T11:42:49.833" LastActivityDate="2020-06-01T11:42:49.833" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12263" PostTypeId="2" ParentId="12260" CreationDate="2020-06-01T08:30:42.387" Score="6" Body="&lt;p&gt;You can use &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gate to prepare a qubit in superposition with arbitrary probabilities.&#xA;When you apply the gate on qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you get a qubit in superposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By chaning angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; you can set any probability you want. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For setting &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi/2$&lt;/span&gt; you will get equally distributed superposition because &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi/4) = \sin(\pi/4)=\frac{1}{\sqrt{2}}$&lt;/span&gt;, for setting &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt; you will get qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |1\rangle$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi/2) =0$&lt;/span&gt;, etc. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Changing &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; continously from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is decreasing from &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; while probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is increasing from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-01T08:30:42.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12264" PostTypeId="1" CreationDate="2020-06-01T08:51:20.760" Score="0" ViewCount="89" Body="&lt;p&gt;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.&#xA;I haven't published any research paper before, do you have any suggestions about where to publish? or about how to represent my ideas?&lt;/p&gt;&#xA;" OwnerUserId="11560" LastEditorUserId="5955" LastEditDate="2020-06-01T10:18:58.067" LastActivityDate="2020-08-13T20:03:30.843" Title="Is it a good idea to publish a research paper about the simulation of BB84 protocol?" Tags="&lt;simulation&gt;&lt;cryptography&gt;&lt;research&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12265" PostTypeId="2" ParentId="12264" CreationDate="2020-06-01T09:31:01.833" Score="3" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice also that BB84 is the reference example in the following tutorial by the authors of SimulaQron:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.simulaqron.org/wp-content/uploads/2019/04/instructions_2018_2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.simulaqron.org/wp-content/uploads/2019/04/instructions_2018_2.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you want to simulate BB84 in a detailed fashion, you may try &lt;a href=&quot;https://aqua.sfc.wide.ad.jp/quisp_website/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuISP&lt;/a&gt;, a novel simulation tool whose focus is &quot;on protocol design and emergent behavior of complex, heterogeneous networks at large scale, while keeping the physical layer as realistic as possible.&quot;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-01T09:52:59.937" LastActivityDate="2020-06-01T09:52:59.937" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12266" PostTypeId="1" CreationDate="2020-06-01T10:49:07.460" Score="2" ViewCount="90" Body="&lt;p&gt;How to implement NOR gate functionality within a quantum circuit? Having &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; input bits &lt;span class=&quot;math-container&quot;&gt;$f(x) \rightarrow y$&lt;/span&gt;, I would like to achieve &lt;span class=&quot;math-container&quot;&gt;$y=1$&lt;/span&gt; every time when &lt;span class=&quot;math-container&quot;&gt;$x=?00$&lt;/span&gt; is on input (&lt;span class=&quot;math-container&quot;&gt;$x=000$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$x=100$&lt;/span&gt;). &lt;/p&gt;&#xA;" OwnerUserId="12220" LastEditorUserId="9459" LastEditDate="2020-06-01T12:22:42.727" LastActivityDate="2020-06-01T12:22:42.727" Title="Quantum NOR Gate" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12267" PostTypeId="2" ParentId="12196" CreationDate="2020-06-01T10:49:19.760" Score="1" Body="&lt;p&gt;Unlike the concept of a controlled unitary, a controlled CP map is not uniquely defined.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As an example, consider the Identity map &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, seen as a CP map.  Then, the controlled-Identity map (as a CP map) can be defined in different ways, e.g.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal E(\rho) = \rho&#xA;$$&lt;/span&gt;&#xA;or &lt;span class=&quot;math-container&quot;&gt;$$\mathcal E(\rho) = \tfrac12I_A\otimes\mathrm{tr}_A(\rho)\ ,&#xA;$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;actual&lt;/em&gt; degree of freedom.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; system is in a fixed point &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt; of the CP map (such a &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-06-01T10:49:19.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12268" PostTypeId="2" ParentId="12266" CreationDate="2020-06-01T11:14:58.073" Score="1" Body="&lt;p&gt;A possible implementation for &lt;strong&gt;NOR&lt;/strong&gt; gate by using one &lt;strong&gt;Toffoli&lt;/strong&gt; gate and &lt;strong&gt;X&lt;/strong&gt; gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qNDaJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qNDaJ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that the last qubit is always in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and the output of this implementation for &lt;strong&gt;NOR&lt;/strong&gt; gate will be stored in the state of that qubit. The first two qubits are for the input state.&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11674/9459&quot;&gt;Here&lt;/a&gt; one can find more about similar gates. The main idea is that the &lt;strong&gt;X&lt;/strong&gt; gate will be applied only if both top qubits are in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, otherwise, the gate(s) will do nothing. Hence the action on different inputs look like this &lt;span class=&quot;math-container&quot;&gt;$|000\rangle \rightarrow |100\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|001\rangle \rightarrow |001\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|010\rangle \rightarrow |010\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|011\rangle \rightarrow |011\rangle$&lt;/span&gt; (the bottom qubit is the leftmost qubit in this notation).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-01T12:19:20.103" LastActivityDate="2020-06-01T12:19:20.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12270" PostTypeId="1" CreationDate="2020-06-01T13:29:52.003" Score="2" ViewCount="269" Body="&lt;p&gt;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 &lt;code&gt;operation&lt;/code&gt; using a python script to call the operation which is written in Q#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For Example: Consider the following Q# code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation SlightlyComplicated(register : Qubit[], pauli : String[]):&#xA;        Bool { // Does something and returns a bool value&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The above operation is saved in a file called &lt;code&gt;Program.qs&lt;/code&gt; which is saved in the same folder as the python code under the name &lt;code&gt;TempQuant&lt;/code&gt; and then here's the python code that is responsible for calling this operation:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qsharp&#xA;from qsharp import Result&#xA;from Quantum.TempQuant import SlightlyComplicated&#xA;&#xA;res = SlightlyComplicated.simulate(register = , pauli = ['X', 'Y', 'Z', 'Z'])&#xA;print(res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since &lt;code&gt;pauli&lt;/code&gt; is an array of Strings, it is easy to pass it through python since they share this type, but for types like &lt;code&gt;qubit&lt;/code&gt;, &lt;code&gt;Result&lt;/code&gt;, &lt;code&gt;Pauli&lt;/code&gt;(which are exclusively present in Q#), how am I supposed to pass them through python into their respective counterparts in Q#?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, I am using Visual Studio Code to write the codes.&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="55" LastEditDate="2020-06-04T15:05:25.477" LastActivityDate="2020-06-04T15:05:25.477" Title="Passing an array of qubits into Q# using Python" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12271" PostTypeId="2" ParentId="12270" CreationDate="2020-06-01T14:20:47.247" Score="2" Body="&lt;p&gt;In general, any logic that relates to Q#-specific types like &lt;code&gt;Qubit&lt;/code&gt; should live in your Q# code.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;nQubits : Int&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;code&gt;Pauli&lt;/code&gt; and &lt;code&gt;Result&lt;/code&gt; types, there are actually Python enums defined such that you could pass those values directly if you want to. See &lt;a href=&quot;https://docs.microsoft.com/en-us/python/qsharp/qsharp.types.pauli&quot; rel=&quot;nofollow noreferrer&quot;&gt;qsharp.types.Pauli&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/en-us/python/qsharp/qsharp.types.result&quot; rel=&quot;nofollow noreferrer&quot;&gt;qsharp.types.Result&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You may also find the answers to this similar question helpful:&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2553/how-do-you-send-an-array-of-qubits-to-an-operation-in-q&quot;&gt;How do you send an array of qubits to an operation in Q#?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10473" LastEditorUserId="10473" LastEditDate="2020-06-01T15:23:16.090" LastActivityDate="2020-06-01T15:23:16.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12272" PostTypeId="2" ParentId="12270" CreationDate="2020-06-01T15:08:35.560" Score="4" Body="&lt;p&gt;Building off of Ryan's answer (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12271/12224&quot;&gt;https://quantumcomputing.stackexchange.com/a/12271/12224&lt;/a&gt;), it's important to recognize that the &lt;code&gt;Qubit&lt;/code&gt; type should not only live just in the Q# code but also have its scope bounded by either a &lt;code&gt;using&lt;/code&gt; statement or a &lt;code&gt;borrowing&lt;/code&gt; statement. See &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/using-qsharp/working-with-qubits&quot; rel=&quot;nofollow noreferrer&quot;&gt;Working with Qubits&lt;/a&gt; for more guidance on how to allocate qubits for use in an operation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applytoeachindex&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ApplyToEachIndex&lt;/code&gt; from Microsoft.Quantum.Cannon&lt;/a&gt; to map that array onto the array of qubits:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;    operation test(bools : Bool[]) : Unit {&#xA;        using (qs = Qubit[Length(bools)]) {&#xA;            ApplyToEachIndex(InitializeFromBoolArray(_, bools, _), qs);&#xA;        }&#xA;    }&#xA;&#xA;    operation InitializeFromBoolArray(index : Int, bools : Bool[], qubit : Qubit) : Unit {&#xA;        if (bools[index]) {&#xA;            X(qubit);&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Note that this also uses a &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/language/expressions#callable-invocation-expressions&quot; rel=&quot;nofollow noreferrer&quot;&gt;callable invocation expression&lt;/a&gt; to create an operation with the signature expected by &lt;code&gt;ApplyToEachIndex&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12224" LastActivityDate="2020-06-01T15:08:35.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12273" PostTypeId="1" CreationDate="2020-06-01T16:53:04.780" Score="1" ViewCount="78" Body="&lt;p&gt;&lt;strong&gt;English/Englisch&lt;/strong&gt;:&#xA;Hi, could anyone help me please?I have a problem with the API-token&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;line 8, in random_qubit&#xA;&#xA;IBMQ.load_account('API-token is normally standing here but I delete it for the question')&#xA;&#xA;TypeError: load_account() takes 1 positional argument but 2 were given&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If someone has the solution or the same problem, please comment it below this question&#xA;And sorry for my bad english.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;German/Deutsch&lt;/strong&gt;:&#xA;Hey könnte mir wer bitte helfen? Ich hab ein Problem und zwar&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;line 8, in random_qubit&#xA;&#xA;IBMQ.load_account('API-Token hab ich heraus gelöscht wegen Kommentar sonst würde hier der API-Token stehen')&#xA;&#xA;TypeError: load_account() takes 1 positional argument but 2 were given&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Falls jemand die Lösung bzw das gleiche Problem hat / hatte bitte unter diesen Kommentar kommentieren&lt;/p&gt;&#xA;" OwnerUserId="12225" LastActivityDate="2020-06-01T17:07:58.007" Title="Problem with the API-token from IBM TypeError" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12274" PostTypeId="2" ParentId="12273" CreationDate="2020-06-01T17:07:25.537" Score="2" Body="&lt;p&gt;&lt;code&gt;IBMQ.load_account()&lt;/code&gt; doesn't take any parameters. It loads the credentials saved locally, if you did a &lt;code&gt;IBMQ.save_account()&lt;/code&gt; prior. If you want to use the credentials for just a single session, you can use &lt;code&gt;IBMQ.enable_account(API_TOKEN)&lt;/code&gt;. &lt;/p&gt;&#xA;" OwnerUserId="12195" LastEditorUserId="5955" LastEditDate="2020-06-01T17:07:58.007" LastActivityDate="2020-06-01T17:07:58.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12275" PostTypeId="1" CreationDate="2020-06-01T17:18:24.840" Score="5" ViewCount="300" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The projective measurement is given by the PVM on the space &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum P_i = I,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are mutually orthogonal projections. &#xA;The post-measurement state of a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_i \rho P_i ~/~ \text{Tr}(P_i \rho P_i),$$&lt;/span&gt; &#xA;with the probability &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(P_i \rho P_i)=\text{Tr}(\rho P_i)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The general measurement is given by the set of operators &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; that corresponds to the POVM on &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum M_i^\dagger M_i = I.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The post-measurement state of a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_i \rho M_i^\dagger ~/~ \text{Tr}(M_i \rho M_i^\dagger),$$&lt;/span&gt; &#xA;with the probability &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(M_i \rho M_i^\dagger) = \text{Tr}(\rho M_i^\dagger M_i)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that POVM itself doesn't describe the post-measurement state, because &lt;span class=&quot;math-container&quot;&gt;$M_i^\prime = UM_i$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gives the same POVM but different post-measurement results (I mean states, though the probability will be the same). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;&lt;em&gt;indirect&lt;/em&gt;&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the question is &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; 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? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Formally, let &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the target system, &lt;span class=&quot;math-container&quot;&gt;$H_a$&lt;/span&gt; - ancilla space with some fixed density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; on it, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary on &lt;span class=&quot;math-container&quot;&gt;$H \otimes H_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum P_i = I$&lt;/span&gt; is a PVM on the whole &lt;span class=&quot;math-container&quot;&gt;$H \otimes H_a$&lt;/span&gt;. The post-measurements states of this scheme are &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Tr}_a ( P_i U \cdot \rho \otimes \rho_0 \cdot U^\dagger P_i) ~/~ n_i,$$&lt;/span&gt;&#xA;with the probability &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; is just the trace of the numerator. &#xA;The question is &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; are there operators &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; such that those post-measurement states equal to &lt;span class=&quot;math-container&quot;&gt;$$M_i \rho M_i^\dagger ~/~ \text{Tr}(\rho M_i^\dagger M_i) ?$$&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know how to prove that there exists a unique corresponding POVM &lt;span class=&quot;math-container&quot;&gt;$\sum F_i=I$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; that can be used to compute probabilities, i.e. &lt;span class=&quot;math-container&quot;&gt;$n_i = \text{Tr}(\rho F_i)$&lt;/span&gt;, but it's not clear how to derive the exact &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; or even prove that they  exist.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;Also, we can consider a related quantum channel &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \Phi(\rho) = \sum_i \text{Tr}_a ( P_i U \cdot \rho \otimes \rho_0 \cdot U^\dagger P_i) $$&lt;/span&gt; and derive Kraus decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(\rho) = \sum_j K_j \rho K_j^\dagger,&#xA;$$&lt;/span&gt;&#xA;but it still doesn't answer the question. It's not even clear if Kraus decomposition has the same number of summands. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-06-02T09:33:52.863" LastActivityDate="2020-06-02T20:02:58.140" Title="Projective vs general measurements - a missing piece" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12276" PostTypeId="2" ParentId="12216" CreationDate="2020-06-01T17:22:13.930" Score="1" Body="&lt;p&gt;If your code builds and runs successfully, this error has to come from IntelliSense.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: the &lt;a href=&quot;https://github.com/microsoft/qsharp-compiler/issues/434&quot; rel=&quot;nofollow noreferrer&quot;&gt;relevant issue on GitHub&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-01T17:22:13.930" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12277" PostTypeId="1" CreationDate="2020-06-01T17:33:47.773" Score="0" ViewCount="147" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;n=5&#xA;beta=0.5*np.pi&#xA;state=initial_state_QFT(n,beta)&#xA;qr=QuantumRegister(n)&#xA;cr=ClassicalRegister(n)&#xA;qc=QuantumCircuit(qr)&#xA;&#xA;qc.initialize(state,qr)&#xA;qft(qc,n)&#xA;qst = tomo.state_tomography_circuits(qc, qr)&#xA;job = job_manager.run(qst, backend=device, name='foo',shots=8192)&#xA;statefit = tomo.StateTomographyFitter(job.results(), qst)&#xA;p, M, weights = statefit._fitter_data(True, 0.5)&#xA;M_dg = np.conj(M).T&#xA;linear_inversion_matrix = np.linalg.inv(M_dg @ M) @ M_dg&#xA;rho = linear_inversion_matrix @ p&#xA;rho = np.reshape(rho, (2**n, 2**n))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Thank you in advance for your answer!&lt;/p&gt;&#xA;" OwnerUserId="9887" LastActivityDate="2021-02-28T16:08:25.867" Title="How to obtain the density matrix using tomography in the real device?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;quantum-fourier-transform&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12278" PostTypeId="2" ParentId="12258" CreationDate="2020-06-01T17:58:31.193" Score="3" Body="&lt;p&gt;For completeness, the operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; you're describing can be implemented more efficiently using the rotations &lt;span class=&quot;math-container&quot;&gt;$R_{XX}, R_{YY}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_{ZZ}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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)$$&lt;/span&gt;&#xA;as &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&#xA;and analogously for &lt;span class=&quot;math-container&quot;&gt;$YY$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In Qiskit that would simply be&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;c = [0.2, 0.3, 0.4]&#xA;A = QuantumCircuit(2)&#xA;A.rzz(c[2])  # remember: R_ZZ is applied first to the state!&#xA;A.ryy(c[1]) &#xA;A.rxx(c[0]) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-06-01T17:58:31.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12279" PostTypeId="1" AcceptedAnswerId="12434" CreationDate="2020-06-01T18:48:15.453" Score="1" ViewCount="83" Body="&lt;p&gt;You can find the paper &lt;a href=&quot;https://arxiv.org/pdf/1802.06002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; , in which they describe the architecture of a QNN that can be used to learn binary functions and correctly classify unseen data.&lt;/p&gt;&#xA;&lt;p&gt;They say that for each binary label function &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$l(z) = -1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$l(z) = 1$&lt;/span&gt;, there exists a unitary &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt; such that, for all input strings &lt;span class=&quot;math-container&quot;&gt;$z = z_0z_1...z_{n-1}$&lt;/span&gt; (where each &lt;span class=&quot;math-container&quot;&gt;$z_i = -1,1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$$\langle z,0 | U_l^{\dagger} Y_{n+1} U_l |z,0 \rangle =  l(z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you assume that &lt;span class=&quot;math-container&quot;&gt;$U_l = \text{exp}(i\frac{\pi}{4}l(z)X_{n+1})$&lt;/span&gt;, then it can be easily proven that &lt;span class=&quot;math-container&quot;&gt;$\langle z,0 | U_l^{\dagger} Y_{n+1} U_l |z,0 \rangle =  l(z)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now let's consider the subset parity problem. Here, &lt;span class=&quot;math-container&quot;&gt;$l(z) = 1-2B(z)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$B(z) = \oplus^{n-1}_{j=0} \phantom{a} a_j \cdot  \frac{1}{2}(1-z_j)$&lt;/span&gt;, which, when plugged into &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt; gives us &lt;span class=&quot;math-container&quot;&gt;$$\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))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, for the subset parity problem, what you want to learn is &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}a_j$&lt;/span&gt;, which you do not know beforehand.&lt;/p&gt;&#xA;&lt;p&gt;So, during learning, you assume that &lt;span class=&quot;math-container&quot;&gt;$$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))$$&lt;/span&gt; (our goal is to update &lt;span class=&quot;math-container&quot;&gt;$\vec\theta$&lt;/span&gt; s.t when we compute the estimated label, we get close to the actual label)&lt;/p&gt;&#xA;&lt;p&gt;This method seems to be working fine for this problem (I get an accuracy of 96%).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; (which I thought was perfect, because the QNN allows me to design a circuit that correctly classifies my strings). Therefore, I assumed that &lt;span class=&quot;math-container&quot;&gt;$$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))$$&lt;/span&gt;, just like the subset parity problem.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt; for this new problem is legit or not (it could be a coincidence or an error in my code).&lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-06-13T09:20:40.867" Title="Initial assumption of the unitary that allows us to estimate the label function" Tags="&lt;machine-learning&gt;&lt;unitarity&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12280" PostTypeId="1" CreationDate="2020-06-01T20:52:49.610" Score="0" ViewCount="48" Body="&lt;p&gt;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.&#xA;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.&#xA;Any ideas? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9569" LastEditorUserId="55" LastEditDate="2020-06-04T15:03:24.233" LastActivityDate="2020-06-04T15:03:24.233" Title="Install qiskit in django project" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12281" PostTypeId="1" AcceptedAnswerId="12283" CreationDate="2020-06-01T21:59:00.767" Score="3" ViewCount="132" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12207" LastEditorUserId="55" LastEditDate="2020-10-12T07:26:10.817" LastActivityDate="2020-10-12T07:26:10.817" Title="Does quantum computers give any advantage over classical computers in Sudoku?" Tags="&lt;algorithm&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12282" PostTypeId="2" ParentId="12277" CreationDate="2020-06-01T22:20:21.190" Score="0" Body="&lt;p&gt;&lt;code&gt;IBMQJobManager.run()&lt;/code&gt; returns a &lt;code&gt;ManagedResult&lt;/code&gt;, but &lt;code&gt;StateTomographyFitter&lt;/code&gt; expects a &lt;code&gt;Result&lt;/code&gt; object. Unfortunately there is no easy way to convert the former into the latter, so you'll have to combine the results yourself:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;job_set = job_manager.run(qst, backend=device, name='foo',shots=8192)&#xA;jobs = job_set.jobs()&#xA;new_result = copy.deepcopy(jobs[0].result())&#xA;for idx in range(1, len(jobs)):&#xA;    new_result.results.extend(jobs[idx].result().results)&#xA;statefit = tomo.StateTomographyFitter(new_result, qst)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is an interesting use case. Looks like Job Manager should really support returning a &lt;code&gt;Result&lt;/code&gt; object.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastEditorUserId="12195" LastEditDate="2020-06-03T12:46:12.047" LastActivityDate="2020-06-03T12:46:12.047" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12283" PostTypeId="2" ParentId="12281" CreationDate="2020-06-01T23:55:00.720" Score="5" Body="&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/a/54184908/1271772&quot;&gt;You are correct&lt;/a&gt; that solving Sudoku for &lt;span class=&quot;math-container&quot;&gt;$n^2 \times n^2$&lt;/span&gt; grids with &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; blocks is an NP complete problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m1E4L.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m1E4L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is an excerpt from &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; Wikipedia article:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;It is suspected that NP &lt;span class=&quot;math-container&quot;&gt;$ \nsubseteq $&lt;/span&gt; BQP; that is, it is believed&#xA;  that there are efficiently checkable problems that are not efficiently&#xA;  solvable by a quantum computer. As a direct consequence of this&#xA;  belief, it is also suspected that BQP is disjoint from the class of&#xA;  NP-complete problems (if an NP-complete problem were in BQP, then it&#xA;  would follow from NP-hardness that all problems in NP are in BQP).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Therefore quantum comptuers are unlikely to be able to solve an &lt;span class=&quot;math-container&quot;&gt;$n^2 \times n^2$&lt;/span&gt; Sudoku puzzle in polynomial time. It is quite possible that quantum computers will have to pay &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(2^n)$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The original question:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&quot;is there any possible way quantum computers give an advantage over&#xA;  classical computers in this type of problem?&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;is a bit vague, because what is meant by &quot;advantage&quot; ?&#xA;Many people would only consider it to be an &quot;advantage&quot; if there is there is an improvement in the scaling of the cost with respect to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, 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 &lt;strong&gt;&lt;em&gt;are&lt;/em&gt;&lt;/strong&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2019/2293&quot;&gt;an open problem&lt;/a&gt;. So the answer depends on what you consider to be an &quot;advantage&quot; and how you define things, but you can certainly define things in a way in which a quantum computer would have an advantage.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-06-01T23:55:00.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12284" PostTypeId="2" ParentId="12207" CreationDate="2020-06-02T00:15:09.697" Score="2" Body="&lt;h2&gt;I'm glad that you inserted this quote:&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;in the future, topological qubits will allow us to reach fault-tolerance&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So you are at least aware that Microsoft is invested in &lt;em&gt;&lt;strong&gt;topoligical quantum computing.&lt;/strong&gt;&lt;/em&gt; You can even see it directly from microsoft.com:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AaZxB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AaZxB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2&gt;So now the answer to your question:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Topological_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Topolgical quantum computing&lt;/a&gt; is quantum computing that would use anyons. If you read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/2054/2293&quot;&gt;this question of mine&lt;/a&gt; you will see that confirming the existence of anyons is still an open problem (unfortunately there is an &amp;quot;answer&amp;quot; to the question, but it is about simulating anyons, not actually realizing them in real life). My answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2034/2293&quot;&gt;here&lt;/a&gt; explains what anyons are in more detail, and my answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/3776/2293&quot;&gt;here&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;So you ask:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;I'm wondering if anyone has information regarding the current status of Microsoft quantum hardware?&amp;quot;  How many working qubits do they have? What are the gate depth/fidelity?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is what they have so far:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;# of qubits = 0&lt;/li&gt;&#xA;&lt;li&gt;gate depth = 0&lt;/li&gt;&#xA;&lt;li&gt;fidelity = 0&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &amp;quot;Our approach focuses on topological quantum computing&amp;quot; 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 &lt;a href=&quot;https://stationq.github.io/Liquid/&quot; rel=&quot;nofollow noreferrer&quot;&gt;liquid&lt;/a&gt;. No hardware though.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-06-02T00:15:09.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12285" PostTypeId="1" AcceptedAnswerId="12328" CreationDate="2020-06-02T01:53:01.967" Score="1" ViewCount="70" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Please also link important papers and articles that you think are worth reading. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="12229" LastEditorUserId="491" LastEditDate="2020-06-06T20:53:06.740" LastActivityDate="2020-06-06T20:53:06.740" Title="IBM Q Experience - Can it be used draw out ML inferences?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;machine-learning&gt;&lt;models&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-06-09T00:54:01.940" ContentLicense="CC BY-SA 4.0" />
  <row Id="12286" PostTypeId="2" ParentId="9990" CreationDate="2020-06-02T02:44:04.250" Score="4" Body="&lt;p&gt;The result you're looking for is effectively &lt;strong&gt;Proposition 19&lt;/strong&gt; of the paper: &lt;a href=&quot;https://arxiv.org/abs/1612.00401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Almost all quantum channels are equidistant&lt;/a&gt;; which I'm rewriting here for convenience:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U, V \in \mathcal{U}(d)$&lt;/span&gt; be two independent random variables, at least one of them being Haar-distributed. Then, with overwhelming probability as &lt;span class=&quot;math-container&quot;&gt;$d \rightarrow \infty$&lt;/span&gt;, the quantum channels &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=U X U^{\dagger}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi(X)=V X V^{\dagger}$&lt;/span&gt; become perfectly distinguishable: for &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; large enough,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathbb{P}\left[\|\Phi-\Psi\|_{\diamond}=2\right] \geq 1-\exp \left(-\frac{\log 2}{2} d^{2}\right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're familiar with typicality results, then this is an example of &lt;a href=&quot;https://en.wikipedia.org/wiki/Concentration_of_measure&quot; rel=&quot;nofollow noreferrer&quot;&gt;concentration of measure phenomenon&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this result is general than the one you're looking for since it requires &lt;em&gt;only&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-06-02T02:44:04.250" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12287" PostTypeId="1" AcceptedAnswerId="12289" CreationDate="2020-06-02T05:17:55.010" Score="0" ViewCount="221" Body="&lt;p&gt;I've started learning quantum computing using 'Learn quantum computation using qiskit',&#xA;and I've stumbled upon what I think is a bug in the code in chapter 1.3: Representing Qubit States&#xA;when I reached the part and run the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1) &#xA;initial_state = [0,1]   &#xA;qc.initialize(initial_state, 0)&#xA;qc.draw()   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It returned &lt;code&gt;'Attribute Error'&lt;/code&gt;&#xA;Saying that &lt;code&gt;'Initialize' object has no attribute 'label'&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="12233" LastEditorUserId="55" LastEditDate="2020-06-03T19:27:00.797" LastActivityDate="2020-07-08T00:30:45.413" Title="Problem with code in 'Learning quantum computation using qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12288" PostTypeId="2" ParentId="12275" CreationDate="2020-06-02T07:42:59.270" Score="2" Body="&lt;p&gt;Let me start with a clarification:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;Note that POVM itself doesn't describe the post-measurement state,&#xA;  because &lt;span class=&quot;math-container&quot;&gt;$M′_i=UM_i$&lt;/span&gt; for some unitary U gives the same POVM but different&#xA;  post-measurement results.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The formalism you're talking about here is &lt;em&gt;not&lt;/em&gt; POVMs. POVMs is when you only use the operators &lt;span class=&quot;math-container&quot;&gt;$E_i=M_i^\dagger M_i$&lt;/span&gt;, the point being that with these you can calculate the probability of the measurement outcome but cannot calculate the final state because, given &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt;, I cannot find &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; because any &lt;span class=&quot;math-container&quot;&gt;$M'_i$&lt;/span&gt; would do just as well. If you are given the &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt;, then the post-measurement state, as you state, is well defined:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{M_i\rho M_i^\dagger}{\text{Tr}(\rho M_i^\dagger M_i)}.&#xA;$$&lt;/span&gt;&#xA;The fact that other &lt;span class=&quot;math-container&quot;&gt;$M_i'$&lt;/span&gt; give different outcomes is irrelevant. They're due to different measurements!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand your actual question, you're wanting to understand the correspondence between&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_a ( P_i U \cdot \rho \otimes \rho_0 \cdot U^\dagger P_i) ~/~ n_i&#xA;$$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_i \rho M_i^\dagger ~/~ \text{Tr}(\rho M_i^\dagger M_i) ?$$&lt;/span&gt; &#xA;In particular, you want to go from &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to finding &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me start the other way around. If you're given a set &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt;, then you can introduce an ancilla in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, and define a &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi\rangle|0\rangle=\sum_i(M_i|\psi\rangle)\otimes|i\rangle,&#xA;$$&lt;/span&gt;&#xA;in which case &lt;span class=&quot;math-container&quot;&gt;$P_i=I\otimes |i\rangle\langle i$&lt;/span&gt;. Note that, if we were given &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt; of this form, we could easily calculate the &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_i=I\otimes\langle i|\cdot U\cdot I\otimes|0\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, generically, if we're given &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt;, can we write down &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt;? No, because they don't exist. Note that when &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; acts on a pure state (&lt;em&gt;every&lt;/em&gt; pure state), it must give a pure state output. That is extremely constraining on the possible forms of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$P_iU|\psi\rangle|0\rangle$&lt;/span&gt; must be separable for all &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-06-02T13:03:57.680" LastActivityDate="2020-06-02T13:03:57.680" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="12289" PostTypeId="2" ParentId="12287" CreationDate="2020-06-02T07:46:24.130" Score="2" Body="&lt;p&gt;This is a known bug in Qiskit (&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/4439&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/4439&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a workaround, you can create an initialize gate and add the missing label using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.extensions import Initialize&#xA;&#xA;qc = QuantumCircuit(1)&#xA;initial_state = [0,1]&#xA;&#xA;init_gate = Initialize(initial_state) # Create a new initialize gate&#xA;init_gate.label = &quot;init&quot;    # Add a label to avoid the bug&#xA;&#xA;qc.append(init_gate, 0)     # Perform the gate on the 0th qubit&#xA;qc.draw()    # Draw the circuit (to complete your code block)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-06-02T07:46:24.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12290" PostTypeId="1" CreationDate="2020-06-02T08:11:46.003" Score="3" ViewCount="45" Body="&lt;p&gt;A &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1654/how-do-i-add-11-using-a-quantum-computer&quot;&gt;similar question&lt;/a&gt; has been previously asked &amp;amp; has an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1656/2645&quot;&gt;excellent answer&lt;/a&gt; discussing half, full &amp;amp; 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).&lt;/p&gt;&#xA;" OwnerUserId="2645" LastActivityDate="2020-06-02T08:11:46.003" Title="How do I add 1+1 using a photonic computer?" Tags="&lt;circuit-construction&gt;&lt;mathematics&gt;&lt;photonics&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12291" PostTypeId="2" ParentId="12280" CreationDate="2020-06-02T09:13:19.677" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-06-02T09:13:19.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12292" PostTypeId="1" AcceptedAnswerId="12315" CreationDate="2020-06-02T12:03:20.970" Score="1" ViewCount="156" Body="&lt;p&gt;How could we construct a circuit with quantum gates for desired time-dependent hamiltonian?&lt;/p&gt;&#xA;&lt;p&gt;For example suppose we wanna construct for below 3 types of hamiltonian :&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;a simple hamiltonian and time_independent without dissipation :&lt;span class=&quot;math-container&quot;&gt;$ 2\sigma_x+ 3 \sigma_z$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;a time dependent hamiltonian without dissipation : &lt;span class=&quot;math-container&quot;&gt;$2\sigma_x+ 3t \sigma_z$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;time dependent hamiltonian with dissipation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Is there a general solution for construct gates for these hamiltonians ?&lt;/p&gt;&#xA;" OwnerUserId="11971" LastEditorUserId="11971" LastEditDate="2020-07-19T13:18:58.997" LastActivityDate="2020-07-19T13:18:58.997" Title="quantum gates hamiltonian" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2020-06-10T10:34:35.843" ContentLicense="CC BY-SA 4.0" />
  <row Id="12293" PostTypeId="1" AcceptedAnswerId="12317" CreationDate="2020-06-02T16:39:21.367" Score="1" ViewCount="65" Body="&lt;p&gt;Here is the first article I could find on this idea in 2016:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1611.07690&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1611.07690&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://patentscope.wipo.int/search/en/detail.jsf?docId=WO2017091870&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://patentscope.wipo.int/search/en/detail.jsf?docId=WO2017091870&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The two are now working at Archer Materials to commercialize this idea.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Fuechsle is known for inventing a single-atom transistor, which has applications to the mentioned quantum device:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/publication/221840938_A_single-atom_transistor&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.researchgate.net/publication/221840938_A_single-atom_transistor&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This leads me to my questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How promising is a carbon-based qubit? Any disadvantages to this approach?&lt;/li&gt;&#xA;&lt;li&gt;If topological quantum computing prevails, could a room temperature qubit based on carbon still be beneficial to topological quantum computing?&lt;/li&gt;&#xA;&lt;li&gt;Is anyone outside of Archer Materials researching this approach?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12236" LastEditorUserId="12236" LastEditDate="2020-06-02T17:57:18.873" LastActivityDate="2020-07-03T18:00:14.660" Title="How promising is the possibility of carbon-based qubits to make a qubit that’s stable at room temperature?" Tags="&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12294" PostTypeId="1" AcceptedAnswerId="12311" CreationDate="2020-06-02T16:50:30.820" Score="3" ViewCount="84" Body="&lt;p&gt;In this Question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/117/why-do-optical-quantum-computers-not-have-to-be-kept-near-absolute-zero-while-su?noredirect=1&amp;amp;lq=1&quot;&gt;Why do optical quantum computers not have to be kept near absolute zero while superconducting quantum computers do?&lt;/a&gt;&#xA;A comment said that the most common way to encode q information in photons is using their internal degrees of freedom, not using a &quot;there/not there&quot; encoding.&#xA;So does that mean that optical quantum computers that use photons doesn't suffer or suffers less from decoherence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What sort of environmental noise causes decoherence?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What is the expected number of qubits that will allow us to build a universal quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="12207" LastEditorUserId="55" LastEditDate="2020-06-03T19:18:22.987" LastActivityDate="2020-06-09T13:13:54.917" Title="Do photons also suffer from decoherence?" Tags="&lt;physical-realization&gt;&lt;decoherence&gt;&lt;photonics&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12295" PostTypeId="2" ParentId="12275" CreationDate="2020-06-02T20:02:58.140" Score="1" Body="&lt;p&gt;I'll try to explain DaftWullie's answer as I see it. We assume &lt;span class=&quot;math-container&quot;&gt;$\rho_0 = |0\rangle\langle0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we have &lt;span class=&quot;math-container&quot;&gt;$P_i = I \otimes |i\rangle \langle i|$&lt;/span&gt; then for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$H \otimes H_a$&lt;/span&gt; operators &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; can be computed by the formula &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ M_i=I\otimes\langle i|\cdot U\cdot I\otimes|0\rangle.$$&lt;/span&gt;&#xA;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.&lt;br&gt;&#xA;This also works in the other direction &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; general measurement &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt; on the target system can be seen as a unitary evolution &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho \otimes |0\rangle\langle0|$&lt;/span&gt; followed by a PVM on the ancilla. The unitary can be derived from the equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U|\psi\rangle|0\rangle=\sum_i(M_i|\psi\rangle)\otimes|i\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Such equivalence between measurements also known as Naimark's theorem. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; is a PVM on the whole &lt;span class=&quot;math-container&quot;&gt;$H \otimes H_a$&lt;/span&gt; then there are no &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt; in general.&lt;br&gt;&#xA;To see this consider &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi\rangle \langle \psi|$&lt;/span&gt;. In general, the state &lt;span class=&quot;math-container&quot;&gt;$P_iU|\psi\rangle|0\rangle$&lt;/span&gt; will not be separable. In such case the state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_a ( P_i U \cdot |\psi\rangle \langle \psi| \otimes |0\rangle \langle 0| \cdot U^\dagger P_i) ~/~ n_i $$&lt;/span&gt;&#xA;will be mixed. But &#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_i |\psi\rangle \langle \psi| M_i^\dagger ~/~ \text{Tr}(|\psi\rangle \langle \psi| M_i^\dagger M_i)$$&lt;/span&gt;&#xA;is a pure state &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; a contradiction, so there are no such &lt;span class=&quot;math-container&quot;&gt;$\{ M_i \}$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;But we can write that &#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_a ( P_i U \cdot \rho \otimes |0\rangle \langle 0| \cdot U^\dagger P_i) ~/~ n_i  = $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \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  = $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \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  = $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \sum_j M_{ij} \rho M_{ij}^\dagger ~/~ n_i,$$&lt;/span&gt;&#xA;where &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ M_{ij} = I \otimes \langle j| \cdot P_i U \cdot I \otimes |0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th post measurement state can be seen as an output of some quantum channel (that depends on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;). Though, this was natural to expect, according to the general theory.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-06-02T20:02:58.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12296" PostTypeId="1" AcceptedAnswerId="12310" CreationDate="2020-06-02T20:12:43.343" Score="-1" ViewCount="50" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12238" LastActivityDate="2020-06-03T08:03:21.863" Title="Could a quantum computer simulator be faster than a normal computer when running on a normal computer?" Tags="&lt;speedup&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12297" PostTypeId="2" ParentId="12296" CreationDate="2020-06-02T20:53:23.653" Score="1" Body="&lt;p&gt;No, it could not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-02T20:53:23.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12298" PostTypeId="2" ParentId="12196" CreationDate="2020-06-02T21:31:19.450" Score="0" Body="&lt;p&gt;I think there is an unambiguous (in some sense) definition of a controlled quantum channel (also see the update). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any quantum channel from &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (actually, from &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(H)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(H)$&lt;/span&gt;) has a representation &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \Phi(\rho) = \text{Tr}_2 (U \rho \otimes \rho_2 U^\dagger),$$&lt;/span&gt;&#xA;where  &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary on &lt;span class=&quot;math-container&quot;&gt;$H \otimes H_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; is the ancilla space, &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; is a density matrix on &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is on &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Clearly, this formula doesn't depend on the phase of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. But we have similar situation in the simple case of controlled unitaries. Moreover, as I've learned from physicists, phases of physical unitaries matter &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; we can distinguish them (e.g. if we are given some physical blackbox unitaries). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, the controlled version of it is the channel &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ C(\Phi)(\rho') = \text{Tr}_2\big(C(U) \cdot \rho' \otimes \rho_2 \cdot C(U)^\dagger\big),$$&lt;/span&gt; &#xA;where we introduce control qubit space &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; is a density matrix on &lt;span class=&quot;math-container&quot;&gt;$H_0 \otimes H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C(U)$&lt;/span&gt; is the controlled unitary on &lt;span class=&quot;math-container&quot;&gt;$H_0 \otimes H \otimes H_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's hard to say what this means from the point of view of Kraus decomposition (which ignores the phase). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br&gt;&#xA;Actually, not only the phase of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; matters. From the Craig Gidney's answer we see that if &lt;span class=&quot;math-container&quot;&gt;$\rho_2 = |0\rangle\langle0|$&lt;/span&gt; on the 1-qubit ancilla, &lt;span class=&quot;math-container&quot;&gt;$U_1 = CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_2 = X\otimes I \cdot CNOT \cdot X\otimes I$&lt;/span&gt; then &#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \Phi_1(\rho) = \Phi_2(\rho), $$&lt;/span&gt;&#xA;but&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ C(\Phi_1)(\rho') \neq C(\Phi_2)(\rho').$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I still think that this straightforward idea of fixing &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; related to a quantum channel representation is the way to go. &lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-06-03T06:21:56.487" LastActivityDate="2020-06-03T06:21:56.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12299" PostTypeId="1" CreationDate="2020-06-02T23:05:47.080" Score="1" ViewCount="60" Body="&lt;p&gt;Consider a pure state &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\eta} \in \mathcal{H}_{AB}$&lt;/span&gt;. There exist orthonormal sets &lt;span class=&quot;math-container&quot;&gt;$\{\alpha_1, \alpha_2 \dots \alpha_i\} \subset \mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\beta_1, \beta_2 \dots \beta_i\} \subset \mathcal{H}_B$&lt;/span&gt;, and real numbers &lt;span class=&quot;math-container&quot;&gt;$\lambda_k &amp;gt; 0$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;\boldsymbol{\eta} = \sum_{i=1}^d \lambda_i \alpha_i \otimes \beta_i&#xA;\end{equation*}&lt;/span&gt;&#xA;My question is if it is it possible (if so, how?) to find &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; without using the decomposition above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I have done so far is that I have set &lt;span class=&quot;math-container&quot;&gt;$\text{dim}\mathcal{H}_A=m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{dim}\mathcal{H}_B = n$&lt;/span&gt;. This means that &lt;span class=&quot;math-container&quot;&gt;$d \leq \min(m,n)$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; only depends on &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\eta}$&lt;/span&gt;? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8400" LastEditorUserId="55" LastEditDate="2020-10-12T07:25:58.107" LastActivityDate="2020-10-12T07:25:58.107" Title="Find the number of elements in the Schmidt decomposition of a pure state" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12300" PostTypeId="1" CreationDate="2020-06-02T23:49:00.977" Score="2" ViewCount="78" Body="&lt;p&gt;For a quantum state on the form &lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \alpha |0 \rangle + \beta |1 \rangle$$&lt;/span&gt; which possible qubit states can you construct from this? I know that &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; must satisfy &lt;span class=&quot;math-container&quot;&gt;$$|\alpha|^2 + |\beta|^2 = 1$$&lt;/span&gt; but are there any other requirements besides this?&lt;/p&gt;&#xA;" OwnerUserId="8400" LastEditorUserId="491" LastEditDate="2020-06-06T21:06:29.373" LastActivityDate="2020-06-06T21:06:29.373" Title="What are the possible qubit states?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12301" PostTypeId="1" AcceptedAnswerId="12302" CreationDate="2020-06-03T00:37:03.100" Score="1" ViewCount="90" Body="&lt;p&gt;I am interested in implementing a operation in Q#. The operation should follow the algorithm below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0coAf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0coAf.png&quot; alt=&quot;Taken from a paper on quantum algorithms&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$A=0$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am not sure how to use the algorithm for the 'i is in A' case. &lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="9006" LastEditDate="2020-06-03T07:44:23.057" LastActivityDate="2020-06-30T19:24:43.710" Title="How can I code a Conditional phase shift transform?" Tags="&lt;quantum-gate&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12302" PostTypeId="2" ParentId="12301" CreationDate="2020-06-03T03:21:14.443" Score="2" Body="&lt;p&gt;The trick here is to define a new operation whose unitary representation is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;    S_a|i\rangle = \begin{cases}&#xA;        -|i\rangle \text{ if } i = a \\&#xA;         |i\rangle \text{ otherwise }&#xA;    \end{cases}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;At that point, &lt;span class=&quot;math-container&quot;&gt;$S_A = \prod_{a \in A} S_a$&lt;/span&gt;.&#xA;In Q#, you can implement &lt;span class=&quot;math-container&quot;&gt;$S_a$&lt;/span&gt; easily using the &lt;code&gt;ControlledOnInt&lt;/code&gt; operation, an auxillary qubit in the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state, and an &lt;code&gt;X&lt;/code&gt; operation:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;operation ApplyConditionalPhase(subset : Int[], register : LittleEndian)&#xA;: Unit is Adj + Ctl {&#xA;    using (aux = Qubit()) {&#xA;        within {&#xA;            // prepare aux in the |−⟩ state. &#xA;            H(aux);&#xA;            Z(aux);&#xA;        } apply {&#xA;            for (element in subset) {&#xA;                (ControlledOnInt(element, X))(register!, aux);&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works using the same &lt;strong&gt;phase kickback&lt;/strong&gt; principle as in the Deutsch−Jozsa algorithm; for more details on how phase kickback works, check out Chapters 6 and 7 of &lt;a href=&quot;https://www.manning.com/books/learn-quantum-computing-with-python-and-q-sharp?a_aid=learn-qc-granade&amp;amp;a_bid=ee23f338&quot; rel=&quot;nofollow noreferrer&quot;&gt;my book&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-06-03T03:21:14.443" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="12303" PostTypeId="1" CreationDate="2020-06-03T06:47:32.210" Score="2" ViewCount="53" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DnNOn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DnNOn.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hi. I'm trying to make a circuit including some Toffoli gates in Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The problem is that, because of connectivity between qubits, some gates should be modified to satisfy it. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've read this post similar to this problem: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6868/how-is-it-possible-to-perform-a-c-not-on-4-qubits-using-the-same-control-qubits&quot;&gt;How is it possible to perform a c-not on 4 qubits using the same control qubits on IBM Q computers?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This helped me a lot, but I'm still uncertain that these two circuits are equivalent &amp;amp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SWAP gates applied to &lt;span class=&quot;math-container&quot;&gt;$q_1, q_2, q_3$&lt;/span&gt; don't affect after all works are done.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="12240" LastEditorUserId="9006" LastEditDate="2020-06-03T07:43:26.680" LastActivityDate="2020-06-03T07:43:26.680" Title="Are these two circuits equivalent (using swap gates with control qubits)?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12304" PostTypeId="2" ParentId="12303" CreationDate="2020-06-03T07:42:28.417" Score="2" Body="&lt;p&gt;Yes, they are equivalent. You've managed to include the &quot;uncompute&quot; sequences of swaps after the Toffoli, which are quite easy to overlook.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way that I convinced myself that it was correct was to take each of the qubits &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; in turn (&lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; goes through the control of the Toffoli.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-03T07:42:28.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12305" PostTypeId="2" ParentId="12300" CreationDate="2020-06-03T07:47:21.077" Score="2" Body="&lt;p&gt;There are no additional constraints on &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;. This means that we cannot directly answer the question of &quot;which possible qubit states can you construct&quot; because that suggests an enumeration, but this corresponds to a continuum of states!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that a particularly convenient way of writing these is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\gamma}(\cos\theta|0\rangle+\sin\theta e^{i\phi}|1\rangle),&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\theta\in[0,\pi)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi\in[0,2\pi)$&lt;/span&gt;, as this automatically takes care of the normalisation in the parametrisation. Also, the &lt;span class=&quot;math-container&quot;&gt;$e^{i\gamma}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta$&lt;/span&gt; formulation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are asking how to go from the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that you want, then start from the parameterisation above, and consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y(2\theta)|0\rangle=(I\cos\theta-i\sin\theta Y)|0\rangle=\cos\theta|0\rangle+\sin\theta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;so that you can then just follow it up with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&#xA;So you can prep any state you want with two single-qubit rotations (up to an irrelevant global phase).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-06-04T08:18:41.713" LastActivityDate="2020-06-04T08:18:41.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12306" PostTypeId="2" ParentId="12300" CreationDate="2020-06-03T07:51:40.210" Score="2" Body="&lt;p&gt;Any unitary transformation preserves angles and length of vectors it is applied upon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, an unitary transformation applied on your states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; will lead to state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle = \alpha_1|0\rangle + \beta_1|1\rangle$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$|\alpha_1|^2+|\beta_1|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Taking appropriate unitary trasformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you can convert any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to any other state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-03T07:51:40.210" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12307" PostTypeId="1" AcceptedAnswerId="12309" CreationDate="2020-06-03T07:56:22.477" Score="1" ViewCount="109" Body="&lt;p&gt;IBM Q backends have many different names, see for example this &lt;a href=&quot;https://quantum-computing.ibm.com/docs/cloud/backends/systems/&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;. We have for example processors called Melbourne, Tokyo, Armonk etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am curious where these names come from? For example, I know that IBM headquarter is placed in Armonk, NY. But what about others? &lt;strong&gt;Is there any special logic behind naming IBM processors?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="5955" LastEditDate="2020-06-03T11:11:38.680" LastActivityDate="2020-06-03T11:11:38.680" Title="Names of IBM Q backends" Tags="&lt;ibm-q-experience&gt;&lt;history&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12308" PostTypeId="2" ParentId="12299" CreationDate="2020-06-03T07:59:31.277" Score="2" Body="&lt;p&gt;&lt;em&gt;A priori&lt;/em&gt;, the only thing you can know is, as you say, &lt;span class=&quot;math-container&quot;&gt;$d\leq\min(m,n)$&lt;/span&gt;. To get more information, you're going to have to do a state-dependent calculation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's say you're told &lt;span class=&quot;math-container&quot;&gt;$|\eta\rangle$&lt;/span&gt; but not its Schmidt decomposition. So, you possibly have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\eta\rangle=\sum_{i,j}\eta_{ij}|i\rangle_A|j\rangle_B,&#xA;$$&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\text{Tr}_B|\eta\rangle\langle\eta|.&#xA;$$&lt;/span&gt;&#xA;In this case, &lt;span class=&quot;math-container&quot;&gt;$d=\text{rank}(\rho_A)$&lt;/span&gt;, so you just have to find the number of non-zero eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Equally, just write the coefficients &lt;span class=&quot;math-container&quot;&gt;$\eta_{ij}$&lt;/span&gt; as an &lt;span class=&quot;math-container&quot;&gt;$m\times n$&lt;/span&gt; matrix and find the rank (i.e. number of non-zero singular values).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-03T07:59:31.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12309" PostTypeId="2" ParentId="12307" CreationDate="2020-06-03T08:02:39.903" Score="3" Body="&lt;p&gt;The documentation states that &quot;All quantum systems are given a city name, e.g., ibmq_johannesburg. This name does not indicate where the actual quantum system is hosted.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/docs/cloud/backends/configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/cloud/backends/configuration&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some cities (e.g., Yorktown) host IBM Research centers. &lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-03T08:02:39.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12310" PostTypeId="2" ParentId="12296" CreationDate="2020-06-03T08:03:21.863" Score="3" Body="&lt;p&gt;I could argue your answer in either way, based on semantics.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;quantum inspired&quot; algorithm that performs better than anything we had before. In that sense, it can be a valuable research direction, for example.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-03T08:03:21.863" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12311" PostTypeId="2" ParentId="12294" CreationDate="2020-06-03T08:13:44.700" Score="3" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;A comment said that the most common way to encode q information in photons is using their internal degrees of freedom, not using a &quot;there/not there&quot; encoding. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;When using photons, quantum information can indeed be encoded into an internal degree of freedom; for instance the polarization of the photon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;strong&gt;definitely&lt;/strong&gt; needs to be cooled (although its temperature can be higher than that of superconducting qubits!).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;there/not there&quot; encoding.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;So does that mean that optical quantum computers that use photons doesn't suffer or suffers less from decoherence?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;With those two previous things in mind I would argue that the discerning property for the amount of decoherence is &lt;strong&gt;not&lt;/strong&gt; the 'internal-vs-external' encoding nature of the qubit. &#xA;You might be able to argue that photonic (quantum) computers suffer from different &lt;em&gt;kinds&lt;/em&gt; of decoherence though...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What sort of environmental noise causes decoherence?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Well, pretty much &lt;em&gt;anything&lt;/em&gt;. Decoherence is quite a broad term and can be seen as loosing the &lt;em&gt;coherent&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course there are other types of environmental noise, including, but not limited to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Magnetic coupling&lt;/li&gt;&#xA;&lt;li&gt;Electric coupling&lt;/li&gt;&#xA;&lt;li&gt;Stray photons&lt;/li&gt;&#xA;&lt;li&gt;Mechanical (not an issue for most architectures)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;What is the expected number of qubits that will allow us to build a universal quantum computer?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;This is an entirely different questions, and we need to treat it carefully.&#xA;If we are talking about a universal &lt;em&gt;fault-tolerant&lt;/em&gt; computer (loosely speaking the high-in-the-sky 'end goal' of all quantum computer manufacturing efforts) the answer is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;many, many many&lt;/em&gt; qubits. No I really mean a lot. &lt;a href=&quot;https://arxiv.org/pdf/1905.09749.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; states the need of &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; million noisy (by then state-of-the-art noise levels, if I recall correctly) qubits to factor a &lt;span class=&quot;math-container&quot;&gt;$2048$&lt;/span&gt; RSA key in &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; hours. This number can be brought down in four ways: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Better noise characteristics for the physical qubits.&lt;/li&gt;&#xA;&lt;li&gt;Better error correction and fault-tolerance schemes.&lt;/li&gt;&#xA;&lt;li&gt;Better connectivity between the qubits to reduce overhead.&lt;/li&gt;&#xA;&lt;li&gt;Smarter compilation &amp;amp; algorithms.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;computation&lt;/em&gt;, so that's why this paper was actually worth publishing at all.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;useful&lt;/em&gt;) then I would say that at around &lt;span class=&quot;math-container&quot;&gt;$~100$&lt;/span&gt; qubits we will have a definite answer. Something &lt;em&gt;useful&lt;/em&gt; (if not very limited) coming out of the computation will impose the need for a multiplying factor of (I guess) &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-09T13:13:54.917" LastActivityDate="2020-06-09T13:13:54.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12312" PostTypeId="1" CreationDate="2020-06-03T08:52:29.633" Score="1" ViewCount="73" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1844" LastEditorUserId="491" LastEditDate="2020-07-17T23:41:36.037" LastActivityDate="2021-04-14T01:54:59.687" Title="Software used for modelling quantum processors" Tags="&lt;programming&gt;&lt;resource-request&gt;&lt;physical-realization&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12313" PostTypeId="1" CreationDate="2020-06-03T12:27:41.287" Score="6" ViewCount="215" Body="&lt;p&gt;I am trying to understand a test called Hadamard Overlap Test, which consists of a destructive swap test (section IV of &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.87.052330&quot; rel=&quot;nofollow noreferrer&quot;&gt;swap test and Hong-Ou-Mandel effect are equivalent&lt;/a&gt;) right after a Hadamard test. The circuit is from the &lt;a href=&quot;https://arxiv.org/abs/1909.05820&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Linear Solver&lt;/a&gt; paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0KDVK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0KDVK.png&quot; alt=&quot;Hadamard overlap test&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The authors claim that &quot;conditioning the measurement on the ancilla qubit to yield the &lt;span class=&quot;math-container&quot;&gt;$|\boldsymbol{0}\rangle$&lt;/span&gt;&#xA;state, we can perform the depth-two Overlap circuit between registers S1 and S2 to get&quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;P(0) &amp;amp;=\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 \\&#xA;&amp;amp;\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)&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\boldsymbol{0}\rangle$&lt;/span&gt; represents a vector of 0 qubits, those making up the registers &lt;span class=&quot;math-container&quot;&gt;$S_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$S_2$&lt;/span&gt;.&#xA;I can't understand how to derive this result. In particular, I have the following questions:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What are we exactly measuring by &lt;span class=&quot;math-container&quot;&gt;$P(0)$&lt;/span&gt;? 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 &lt;span class=&quot;math-container&quot;&gt;$P(0)$&lt;/span&gt; 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. &lt;/li&gt;&#xA;&lt;li&gt;How do you get to this result? Below is my attempt and what I achieved so far&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;&amp;amp; |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}}\\ &amp;amp;\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}\\&#xA;&amp;amp; \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]&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;Now, one measures the ancilla, if it results in a 0 state, the system collapses in&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\frac{1}{2}(V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle)&#xA;\end{equation}&lt;/span&gt;&#xA;How does one implement the the CNOTs and H now? What are the further steps that yields the results of the authors?&lt;/p&gt;&#xA;" OwnerUserId="11551" LastEditorUserId="55" LastEditDate="2020-07-26T18:04:15.213" LastActivityDate="2021-04-22T23:56:05.883" Title="Hadamard Overlap Test" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;hadamard&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12314" PostTypeId="2" ParentId="12096" CreationDate="2020-06-03T14:01:45.013" Score="0" Body="&lt;p&gt;For you first question, I do not think you can get the &lt;code&gt;time_taken&lt;/code&gt; for each individual circuit that were sent bundled into one job. I believe, like you saw in your example, it will only show the &lt;code&gt;time_taken&lt;/code&gt; to complete the entire job.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;job.result()&lt;/code&gt;. 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 &lt;code&gt;job.result()&lt;/code&gt; right away, then you can continue to submit jobs, even though the previous ones have not completed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, you should be able to run something similar to the following code snippet to accomplish what you want:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;jobs = []&#xA;for _ in range(&amp;lt;num_of_iterations&amp;gt;):&#xA;    job = execute(circ, backend)&#xA;    jobs.append(job)&#xA;&#xA;for j in jobs:&#xA;    print(j.result().time_taken)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;time_taken&lt;/code&gt; of each job afterwards. Though, if running through the general &quot;open&quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-06-03T14:01:45.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12315" PostTypeId="2" ParentId="12292" CreationDate="2020-06-03T14:34:30.863" Score="1" Body="&lt;p&gt;Given an initial state &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle$&lt;/span&gt; and a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; for the system, the system evolves (in the non-relativistic limit) from time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_1 \rangle = e^{-iH(t_1-t_0)}\vert \psi_0 \rangle = U_t \vert \psi_0 \rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian resulting in &lt;span class=&quot;math-container&quot;&gt;$U_{t}$&lt;/span&gt; being unitary.  The time evolution described by this equation can be represented in a quantum circuit by preparing the state &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle$&lt;/span&gt; and then applying a &lt;span class=&quot;math-container&quot;&gt;$U_{t}$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Setting &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_0 \rangle = \vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t = t_1-t_0$&lt;/span&gt; a quantum circuit representing the equation above is nothing more than&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xqR0h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xqR0h.png&quot; alt=&quot;U(t)_pseudo&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the Hamiltonian in your question, &lt;span class=&quot;math-container&quot;&gt;$H=2 \sigma_x+3 \sigma_z$&lt;/span&gt;, you can calculate &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; for any given &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.  For an easy example, consider &lt;span class=&quot;math-container&quot;&gt;$t=\frac{\pi}{2\sqrt{13}}$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U \left(\frac{\pi}{2\sqrt{13}} \right) = \begin{bmatrix} -\frac{3}{\sqrt{13}}i &amp;amp; -\frac{2}{\sqrt{13}}i \\-\frac{2}{\sqrt{13}}i &amp;amp; \frac{3}{\sqrt{13}}i  \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To actually run this on a quantum chip, we would need to decompose the general unitary transformation (the pseudo-gate &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt;) from the equations describing the system into some combination of transformations available in the set of available universal quantum gates (up to global phase).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; decomposes into two &lt;span class=&quot;math-container&quot;&gt;$SO(2)$&lt;/span&gt; rotations and a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; transformation.  Define the rotation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R_y = \begin{bmatrix} \sqrt{\frac{1}{2}+\frac{3}{2 \sqrt{13}}} &amp;amp; -\sqrt{\frac{1}{2}-\frac{3}{2 \sqrt{13}}}  \\ \sqrt{\frac{1}{2}-\frac{3}{2 \sqrt{13}}} &amp;amp; \sqrt{\frac{1}{2}+\frac{3}{2 \sqrt{13}}} \end{bmatrix},$$&lt;/span&gt;&#xA;then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U \left(\frac{\pi}{2\sqrt{13}} \right) = -i R_y \sigma_z R_y^\dagger.$$&lt;/span&gt;&#xA;Noting that the leading &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc=QuantumCircuit(1)&#xA;qc.ry(2*acos(sqrt(1/2+3/(2*sqrt(13)))),0)&#xA;qc.z(0)&#xA;qc.ry(-2*acos(sqrt(1/2+3/(2*sqrt(13)))),0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OyVfH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OyVfH.png&quot; alt=&quot;U(t)_actual&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are any number of other possible ways to implement this transformation in Qiskit, this is just one possible approach.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-06-03T19:16:42.907" LastActivityDate="2020-06-03T19:16:42.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12316" PostTypeId="1" AcceptedAnswerId="12735" CreationDate="2020-06-03T15:15:55.883" Score="4" ViewCount="147" Body="&lt;p&gt;I am trying to understand just the first step of the proof fo Lemma 53 of &lt;a href=&quot;https://arxiv.org/pdf/1806.01838.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, with scarce success.&lt;/p&gt;&#xA;&lt;p&gt;Before starting, let me state this definition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Definition: Block encoding of operator A&lt;/strong&gt;.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-qubit operator, and &lt;span class=&quot;math-container&quot;&gt;$\alpha, \epsilon \in \mathbb{R}_+$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a \in \mathbb{N}$&lt;/span&gt;. Then, we say that a &lt;span class=&quot;math-container&quot;&gt;$(s+a)$&lt;/span&gt;-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$(\alpha, a, \epsilon)$&lt;/span&gt; block encoding of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; if:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|A - \alpha(\langle0|^{\otimes a} \otimes I) U (|0\rangle^{\otimes a} \otimes I) \| \leq \epsilon $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the statement I would like to prove:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Lemma 53:&lt;/strong&gt; (Product of block-encoded matrices)&#xA;If &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$(\alpha, a, \delta)$&lt;/span&gt;-block encoding of an &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-qubit operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$(\beta,b,\epsilon)$&lt;/span&gt;-block encoding of a s-qubit operator &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$(I_b \otimes U)(I_a \otimes V)$&lt;/span&gt; is an (&lt;span class=&quot;math-container&quot;&gt;$\alpha\beta, a+b, \alpha\epsilon + \beta\delta)$&lt;/span&gt;-block encoding of &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The first step of the proof is writing the definition of block encoding, which for this case s:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\| 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)   \| =$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand all the steps of the proof, but I don't understand the first passage. Why the previous equation should be equal to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\|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)    \| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This looks similar to the cases where I can apply the property that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(A \otimes B)(|x\rangle \otimes |y\rangle) = (A|x\rangle \otimes B|y\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; identity matrices would help the understanding..&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark&lt;/strong&gt;: in the statement of the Theorem there is a small footnote where they claim&#xA;&amp;quot;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.&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="1644" LastEditorUserId="1644" LastEditDate="2020-07-01T09:13:37.183" LastActivityDate="2020-07-01T10:52:48.713" Title="Product of block-encoded matrices" Tags="&lt;algorithm&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12317" PostTypeId="2" ParentId="12293" CreationDate="2020-06-03T17:12:39.413" Score="4" Body="&lt;p&gt;In my opinion this is not a very promising qubit for quantum computing, though it may hold more promise for quantum sensing or communication.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://en.m.wikipedia.org/wiki/DiVincenzo%27s_criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.m.wikipedia.org/wiki/DiVincenzo%27s_criteria&lt;/a&gt;&#xA;Going through those criteria it becomes obvious where the system demonstrated in the first paper falls short.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://doi.org/10.1021/acs.jpcb.5b03027&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1021/acs.jpcb.5b03027&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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(&gt;3T) and very low temperature (&amp;lt;4K)&#xA;Though, optically generated polarization is a thing but just like with optical readout, you need to satisfy very specific photophysical conditions. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="9579" LastActivityDate="2020-06-03T17:12:39.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12318" PostTypeId="1" AcceptedAnswerId="12319" CreationDate="2020-06-03T21:16:51.567" Score="3" ViewCount="65" Body="&lt;p&gt;I've been trying to solve this question&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cYzsZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cYzsZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems that in order to show it has unit length, we must show that &lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{d} \sum_{m, n=0}^{d=1} \lvert U_{m, n}\rvert ^2 = 1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've tried searching online for this type of relation on unitary matrices but haven't succeeded in finding anything. Would appreciate any help.&lt;/p&gt;&#xA;" OwnerUserId="12243" LastEditorUserId="55" LastEditDate="2020-06-04T15:01:26.193" LastActivityDate="2020-06-04T15:01:26.193" Title="Bipartite states whose coefficients are entries of a unitary matrix" Tags="&lt;quantum-state&gt;&lt;unitarity&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12319" PostTypeId="2" ParentId="12318" CreationDate="2020-06-03T22:32:08.867" Score="2" Body="&lt;p&gt;It may be more helpful to think about the relationship you need to show in terms of the Hermitian form &lt;span class=&quot;math-container&quot;&gt;$\sum \limits_{m,n=0}^{d-1} U_{m,n} U_{m,n}^\ast = d$&lt;/span&gt;, which is a necessary condition for the defining unitary relationship &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this explicitly, consider the four equations implicit in the &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt; case: &lt;span class=&quot;math-container&quot;&gt;$$UU^\dagger=\begin{bmatrix} U_{1,1} &amp;amp; U_{1,2} \\ U_{2,1} &amp;amp; U_{2,2} \end{bmatrix} \begin{bmatrix} U_{1,1}^\ast &amp;amp; U_{2,1}^\ast \\ U_{1,2}^\ast &amp;amp; U_{2,2}^\ast \end{bmatrix} = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix}.$$&lt;/span&gt;&#xA;The diagonal terms are what you need for the desired relationship:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(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.$$&lt;/span&gt;&#xA;It should not be hard to convince yourself that this generalizes to any &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-06-03T22:42:40.637" LastActivityDate="2020-06-03T22:42:40.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12320" PostTypeId="2" ParentId="12318" CreationDate="2020-06-04T00:14:47.283" Score="2" Body="&lt;p&gt;A matrix is unitary &lt;strong&gt;&lt;em&gt;iff&lt;/em&gt;&lt;/strong&gt; its columns (equivalently, rows) are orthonormal (see &lt;em&gt;e.g.&lt;/em&gt; Wikipedia).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The sum &lt;span class=&quot;math-container&quot;&gt;$\sum_{nm}|U_{nm}|^2$&lt;/span&gt; can be thought of as the sum of the squared norms of the rows of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (equivalently, of the columns of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;). As each such row (column) has unit norm, the sum of these norms must equal &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; unitary, its &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; has the form &lt;span class=&quot;math-container&quot;&gt;$U=\sum_k |u_k\rangle\!\langle k|$&lt;/span&gt; for some orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$(|u_k\rangle)_k$&lt;/span&gt;. The corresponding state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; thus reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \frac{1}{\sqrt d}\sum_{k=1}^d |u_k\rangle\otimes|k\rangle,$$&lt;/span&gt;&#xA;which is the maximally entangled state.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-06-04T00:14:47.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12321" PostTypeId="1" AcceptedAnswerId="12322" CreationDate="2020-06-04T02:26:43.703" Score="3" ViewCount="352" Body="&lt;p&gt;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 &quot;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 ?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-06-08T12:29:50.140" LastActivityDate="2020-06-08T12:29:50.140" Title="How to decompose a unitary single qubit gate by universal quantum gate set?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12322" PostTypeId="2" ParentId="12321" CreationDate="2020-06-04T04:21:54.447" Score="2" Body="&lt;p&gt;The phase gate, &lt;span class=&quot;math-container&quot;&gt;$S = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{bmatrix}$&lt;/span&gt; is just the square root of Pauli Z, so the specific decomposition in your question is nothing more than &lt;span class=&quot;math-container&quot;&gt;$Z = SS$&lt;/span&gt;.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Hadamard gate can be used, for example, with Z to decompose Pauli X as &lt;span class=&quot;math-container&quot;&gt;$X = HZH$&lt;/span&gt;, which is an eigendecomposition of X.  So if by chance you didn't have S, but had &lt;span class=&quot;math-container&quot;&gt;$\lbrace X, H \rbrace$&lt;/span&gt; instead, you could get Z from &lt;span class=&quot;math-container&quot;&gt;$Z=HXH$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-06-04T04:35:39.987" LastActivityDate="2020-06-04T04:35:39.987" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12323" PostTypeId="2" ParentId="12312" CreationDate="2020-06-04T06:26:01.287" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q Experience&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.quantum-inspire.com/projects&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuTech Quantum Inspire&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-04T06:26:01.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12324" PostTypeId="2" ParentId="12321" CreationDate="2020-06-04T07:22:00.553" Score="2" Body="&lt;p&gt;You need to be a little careful with terminology. When you say &quot;phase gate&quot;, what &lt;em&gt;precisely&lt;/em&gt; do you mean? Often, that terminology refers to the gate &lt;span class=&quot;math-container&quot;&gt;$S=\sqrt{Z}$&lt;/span&gt;. In this context, I am assuming this is not what you mean because &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; are not universal for single-qubit gates. However, for completeness, you were asking how to make &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, which is trivial: &lt;span class=&quot;math-container&quot;&gt;$Z=S^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might mean an arbitrary phase gate &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)=e^{iZ\theta/2}$&lt;/span&gt; where you can choose any/all &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; values. In that case, your special case is &lt;span class=&quot;math-container&quot;&gt;$Z=R_z(\pi)$&lt;/span&gt; (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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=e^{i\delta}R_z(\alpha)HR_z(\beta)HR_z(\gamma).&#xA;$$&lt;/span&gt;&#xA;There are other questions.answers on this site with more details about how to find what the parameters are.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What you seem to imply in comments is that you're really interested in the set &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$S=T^2$&lt;/span&gt;). In that case, &lt;span class=&quot;math-container&quot;&gt;$Z=T^4$&lt;/span&gt;. If you want to find a good decomposition of an arbitrary single-qubit unitary in terms of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, you need the Solovay-Kitaev algorithm. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dawson&lt;/a&gt; wrote quite a useful paper on how to do it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More recent &lt;a href=&quot;https://arxiv.org/abs/1206.5236&quot; rel=&quot;nofollow noreferrer&quot;&gt;work&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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&lt;span class=&quot;math-container&quot;&gt;$\leq 3$&lt;/span&gt; cases and how to make them. Persumably the code they provide could help you with those.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-04T07:22:00.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12325" PostTypeId="1" AcceptedAnswerId="12329" CreationDate="2020-06-04T12:45:17.420" Score="4" ViewCount="265" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Do we gain anything by 'classical' instead of 'digital', or is it just a shibboleth?&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2020-06-05T02:06:49.650" Title="Why do we say 'classical computer' to mean 'digital computer'?" Tags="&lt;terminology&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12326" PostTypeId="2" ParentId="12299" CreationDate="2020-06-04T13:09:24.327" Score="0" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-04T13:09:24.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12327" PostTypeId="2" ParentId="12325" CreationDate="2020-06-04T13:21:56.220" Score="1" Body="&lt;p&gt;I think the reason is that 'classical' is more effective.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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'. &lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-04T13:29:47.293" LastActivityDate="2020-06-04T13:29:47.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12328" PostTypeId="2" ParentId="12285" CreationDate="2020-06-04T13:23:40.787" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://ibm-q4ai.mybluemix.net&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;. Also IBM has demonstrated Hybrid quantum - classical neural networks with PyTorch and Qiskit online in the following &lt;a href=&quot;https://qiskit.org/textbook/ch-machine-learning/machine-learning-qiskit-pytorch.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-04T13:23:40.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12329" PostTypeId="2" ParentId="12325" CreationDate="2020-06-04T14:02:00.257" Score="4" Body="&lt;p&gt;I think we do gain a little bit by saying &quot;classical&quot; instead of &quot;digital&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As you point out, you can certainly build classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Analog_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;analog computers&lt;/a&gt;, 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis#Variations&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;extended&lt;/em&gt; Church-Turing thesis&lt;/a&gt; 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 &lt;em&gt;proven&lt;/em&gt;, but I think it's generally accepted to be true in our world.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think that referring to these computers by the broad term &quot;classical&quot; usefully conveys the highly nontrivial insight of the extended Church-Turing thesis: that if you just care about &quot;macro&quot; features like the asymptotic runtime, then it doesn't actually &lt;em&gt;matter&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edited to add.&lt;/strong&gt; 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 &lt;em&gt;quite&lt;/em&gt; 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 &quot;All physical regimes can be described by some type of action principle&quot; than a mathematical proposition.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By the way, I highly recommend Scott Aaronson's paper &quot;&lt;a href=&quot;https://www.scottaaronson.com/papers/npcomplete.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;NP-complete problems and physical reality&lt;/a&gt;&quot; (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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-06-05T02:06:49.650" LastActivityDate="2020-06-05T02:06:49.650" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12330" PostTypeId="2" ParentId="12312" CreationDate="2020-06-04T14:20:45.163" Score="1" Body="&lt;p&gt;Are you looking for something that simulates the actual hardware, or something that runs quantum circuits?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://gitlab.com/quantumsim&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantumsim&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/quantumlib/cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;cirq&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;are two that I've used, but others are also out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you actually want to simulate the physics happening on the hardware level, the question is very hardware specific.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-06-04T14:20:45.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12331" PostTypeId="5" CreationDate="2020-06-04T15:12:49.877" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-04T15:12:49.877" LastActivityDate="2020-06-04T15:12:49.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12332" PostTypeId="4" CreationDate="2020-06-04T15:12:49.877" Score="0" Body="Applies to questions of primarily educational value - styled in the format similar to that found in textbook exercises. This tag should be applied to questions that are (1) stated in the form of an exercise and (2) at the level of basic quantum information textbooks." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-04T15:12:49.877" LastActivityDate="2020-06-04T15:12:49.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12334" PostTypeId="1" AcceptedAnswerId="15732" CreationDate="2020-06-04T16:57:05.887" Score="2" ViewCount="132" Body="&lt;p&gt;&lt;strong&gt;Some background:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question: Is there a way to disable multiprocessing in TensorFlow Quantum?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="562" LastEditorUserId="10480" LastEditDate="2021-01-28T07:54:47.577" LastActivityDate="2021-01-28T19:27:30.940" Title="How to turn off multiprocessing in TensorFlow Quantum" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;machine-learning&gt;&lt;tfq&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12335" PostTypeId="1" AcceptedAnswerId="12339" CreationDate="2020-06-04T17:40:03.033" Score="2" ViewCount="102" Body="&lt;p&gt;For noise parameter &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; and a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, we know that the depolarization channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; would act like:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho) = (1 - Q)\rho +Q\frac{I}{2},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix in 2 dimensions. Now, an interesting question is, what happens to a Bell state &lt;span class=&quot;math-container&quot;&gt;$|\Phi^{+}\rangle = \frac{1}{2}(|00\rangle + |11\rangle)$&lt;/span&gt;, when we apply &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; to each qubits of the Bell state separately. What would be the resulting state? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Meaning, what is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\mathcal{E} \otimes \mathcal{E})(|\Phi^{+}\rangle \langle\Phi^{+}| )&#xA;$$&lt;/span&gt;&#xA;Remembering that, operation on the first qubit would collapse the state. Is it physically possible?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="491" LastEditDate="2020-06-06T20:53:54.350" LastActivityDate="2020-06-06T20:53:54.350" Title="What happens when you send a Bell state through depolarizing channel?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;noise&gt;&lt;bell-basis&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12336" PostTypeId="1" CreationDate="2020-06-04T18:10:21.710" Score="3" ViewCount="74" Body="&lt;p&gt;I am reading this &lt;a href=&quot;https://arxiv.org/pdf/1612.02058.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;error mitigation paper&lt;/a&gt; by the IBM team and I am slightly confused about the meaning of &amp;quot;coupling coefficients&amp;quot; when describing multi-qubit Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ty6e6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ty6e6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="7943" LastEditorUserId="10480" LastEditDate="2021-03-18T05:46:22.180" LastActivityDate="2021-04-17T06:46:55.073" Title="What do coupling coefficients mean in terms of Pauli gates, and why are they time dependent?" Tags="&lt;quantum-gate&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12337" PostTypeId="2" ParentId="6128" CreationDate="2020-06-04T18:46:21.023" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We can find a seminal research paper on Quantum Arithmetic Circuits by &lt;a href=&quot;https://ui.adsabs.harvard.edu/abs/2009IEITF..92.1276T/abstract&quot; rel=&quot;nofollow noreferrer&quot;&gt;Takahashi Yasuhiro&lt;/a&gt; quite relevant to this topic. There is a &lt;a href=&quot;https://arxiv.org/pdf/1411.5949.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent research paper&lt;/a&gt; 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 &lt;a href=&quot;https://www.nature.com/articles/s41534-018-0072-4&quot; rel=&quot;nofollow noreferrer&quot;&gt;research paper published in nature&lt;/a&gt; about Automated Optimisation of large quantum circuits with continuous parameters which talks about the complexity of quantum arithmetic circuits. &lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-04T18:46:21.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12338" PostTypeId="2" ParentId="6128" CreationDate="2020-06-04T23:12:40.237" Score="2" Body="&lt;p&gt;Here's a really old reference:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9511018&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Quantum Networks for Elementary Arithmetic Operations&quot; by Vedral et al (1995)&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And here's some state of the art stuff:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In-place ripply carry adder: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0410184&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;A new quantum ripple-carry addition circuit&#xA;&quot; by Cuccaro et al 2004&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Optimal Toffoli count ripply carry adder: &lt;a href=&quot;https://arxiv.org/abs/1709.06648&quot; rel=&quot;nofollow noreferrer&quot;&gt;Halving the cost of quantum addition&#xA;by Gidney 2017&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Carry lookahead adder: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406142&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;A logarithmic-depth quantum carry-lookahead adder&quot;&#xA;by Draper et al 2004&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Carry save adder (sortof): &lt;a href=&quot;https://arxiv.org/abs/1905.08488&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Approximate encoded permutations and piecewise quantum adders&quot; by Gidney 2019&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Karatsuba multiplier: &lt;a href=&quot;https://arxiv.org/abs/1904.07356&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Asymptotically Efficient Quantum Karatsuba Multiplication&quot; by Gidney 2019&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Multiplier w/ table lookup acceleration: &lt;a href=&quot;https://arxiv.org/abs/1905.07682&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Windowed quantum arithmetic&quot; by Gidney 2019&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Nearly inline incrementing using dirty qubits: &lt;a href=&quot;https://arxiv.org/abs/1611.07995&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Factoring using 2n+2 qubits with Toffoli based modular multiplication&#xA;&quot; by Haner et al&lt;/a&gt; and also &lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Factoring with n+2 clean qubits and n-1 dirty qubits&quot; by Gidney (2017)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Sorry for the number of self-cites. I got really interested in this problem for awhile.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's also some cool papers like &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0008033&quot; rel=&quot;nofollow noreferrer&quot;&gt;&quot;Addition on a quantum computer&quot;&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-06-04T23:18:50.500" LastActivityDate="2020-06-04T23:18:50.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12339" PostTypeId="2" ParentId="12335" CreationDate="2020-06-05T05:29:55.000" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's denote our two qubits as &lt;span class=&quot;math-container&quot;&gt;$\mathrm{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{B}$&lt;/span&gt;. The Bell state of these two qubits is then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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}}&#xA;$$&lt;/span&gt;&#xA;With a density matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which makes the two reduced density matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_\mathrm{A} = \text{tr}_\mathrm{B}(\rho) = \frac{|0 \rangle \langle 0| + |1 \rangle \langle 1|}{2} = \frac{I}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_\mathrm{B} = \text{tr}_\mathrm{A}(\rho) = \frac{|0 \rangle \langle 0| + |1 \rangle \langle 1|}{2} = \frac{I}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The operation can then be defined as (assuming the same noise parameter &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; on both applications of the operation):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E} \otimes \mathcal{E} = (Q \; \frac{I}{2} + (1-Q) \rho_\mathrm{A}) \otimes (Q \;  \frac{I}{2} + (1-Q) \rho_\mathrm{B})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which ultimately simplifies to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E} \otimes \mathcal{E} = Q(2-Q) \; \frac{I}{2} \otimes \frac{I}{2} + (1-Q)^2 \; \rho&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Because both reduced density matrices for the Bell state given are equivalent to the density matrix for a completely mixed state, i.e. &lt;span class=&quot;math-container&quot;&gt;$\frac{I}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="12070" LastActivityDate="2020-06-05T05:29:55.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12340" PostTypeId="1" CreationDate="2020-06-05T09:30:29.937" Score="4" ViewCount="3217" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Was inspired by &lt;a href=&quot;https://www.youtube.com/watch?v=w6O7K7Ij2Rk&quot; rel=&quot;nofollow noreferrer&quot;&gt;this youtube video&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12255" LastEditorUserId="55" LastEditDate="2020-07-26T18:17:10.963" LastActivityDate="2020-07-26T20:54:36.800" Title="How to build a quantum computer in your house?" Tags="&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="6" CommentCount="3" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12341" PostTypeId="1" AcceptedAnswerId="12343" CreationDate="2020-06-05T09:33:08.107" Score="1" ViewCount="175" Body="&lt;p&gt;Let's say we have the GHZ state with 3 qubits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\mathrm{GHZ}\rangle = \dfrac{1}{\sqrt{2}}\Big(|000\rangle + |111\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I want to find the stabilizer group of this state, that is, the &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; operators such that &lt;span class=&quot;math-container&quot;&gt;$M_i|\mathrm{GHZ}\rangle = |\mathrm{GHZ}\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M_i \in P_3$&lt;/span&gt;, being &lt;span class=&quot;math-container&quot;&gt;$P_3$&lt;/span&gt; the Pauli group for &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, in this case, by testing with brute force we can find:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;M_1 &amp;amp;= XXX\\&#xA;M_2 &amp;amp;= ZZ1\\&#xA;M_3 &amp;amp;= Z1Z\\&#xA;M_4 &amp;amp;= 1ZZ&#xA;\end{align} $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But I do have a couple of questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Shouldn't I get &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; stabilizers instead of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;? because as I understand it, the number of stabilizers is given by &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of physical bits and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the number of logical or information bits, and in our case we have &lt;span class=&quot;math-container&quot;&gt;$n=3,\ k=0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9716" LastEditorUserId="8141" LastEditDate="2020-06-05T12:59:00.117" LastActivityDate="2020-06-08T09:22:26.133" Title="How to get the stabilizer group for a given state?" Tags="&lt;mathematics&gt;&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12342" PostTypeId="2" ParentId="12335" CreationDate="2020-06-05T10:13:25.843" Score="1" Body="&lt;p&gt;As also discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12079/55&quot;&gt;here&lt;/a&gt; you can write your channel as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E = p\mathcal E_{dp} + (1-p) \operatorname{Id},&#xA;\quad \mathcal E_{dp}(\rho)\equiv\operatorname{Tr}(\rho)I/d.$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p\in[0,1]$&lt;/span&gt; and, in your case, &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You thus have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When the input is a maximally entangled state, &lt;span class=&quot;math-container&quot;&gt;$\sqrt d|\Phi\rangle=\sum_k |u_k,v_k\rangle$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$u_k,v_k$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\langle u_k,u_\ell\rangle=\langle v_k,v_\ell\rangle=\delta_{k\ell}$&lt;/span&gt;, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  (\mathcal E_{dp}\otimes \mathcal E_{dp})\Phi =&#xA;  \frac{1}{d}\sum_{jk} \mathcal E_{dp}(|u_j\rangle\!\langle u_k|)\otimes \mathcal E_{dp}(|v_j\rangle\!\langle v_k|) =&#xA;  \frac{1}{d^2}I\otimes I\equiv \frac{1}{d^2}I, \\&#xA;  (\mathcal E_{dp}\otimes \operatorname{Id})\Phi =&#xA;  \frac{1}{d}\sum_j \mathcal E_{dp}(|u_j\rangle\!\langle u_k|)\otimes |v_j\rangle\!\langle v_k| =&#xA;  \frac{1}{d^2}I\otimes I\equiv \frac{1}{d^2}I.&#xA;$$&lt;/span&gt;&#xA;where we are using the notation &lt;span class=&quot;math-container&quot;&gt;$\Phi\equiv |\Phi\rangle\!\langle \Phi|$&lt;/span&gt;.&#xA;In conclusion,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\mathcal E\otimes\mathcal E)\Phi= \underbrace{[p^2+2p(1-p)]}_{=p(2-p)} \frac{I}{d^2} + (1-p)^2\Phi.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-06-05T10:13:25.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12343" PostTypeId="2" ParentId="12341" CreationDate="2020-06-05T10:36:51.710" Score="3" Body="&lt;p&gt;You need to watch out when you say 'stabilizer' or 'stabilizers' because there is a little bit of ambiguity in that terminology&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;em&gt;stabilizer&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; of a state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is the &lt;strong&gt;group&lt;/strong&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Paulis of which &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate. That is, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is the shared &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace of all these operators. We can generalize this by having a stabilizer &lt;strong&gt;code&lt;/strong&gt; where the shared eigenspace is of dimension &lt;span class=&quot;math-container&quot;&gt;$2^{n-l}$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, because we now take only &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; Paulis for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system. We then get &lt;span class=&quot;math-container&quot;&gt;$k = n-l$&lt;/span&gt; logical qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The number of elements in any stabilizer is &lt;span class=&quot;math-container&quot;&gt;$2^{l}$&lt;/span&gt;, because if &lt;span class=&quot;math-container&quot;&gt;$P_{1}, P_{2} \in \mathcal{S}$&lt;/span&gt;, then evidently &lt;span class=&quot;math-container&quot;&gt;$P_{12} = P_{1}P_{2} \in \mathcal{S}$&lt;/span&gt; as well. That is, the elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; form a &lt;em&gt;group&lt;/em&gt; (hence why we refer to it as the stabilizer group). Our &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; Paulis are &lt;em&gt;generators&lt;/em&gt; for the group; but there are &lt;span class=&quot;math-container&quot;&gt;$2^{l}$&lt;/span&gt; elements in the group, because any multiplication of our generators will give an element of the stabilizer as well.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You should get &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; &lt;strong&gt;generators&lt;/strong&gt; for the state, since the number of generators is &lt;span class=&quot;math-container&quot;&gt;$l = n-k = (3 - 0)$&lt;/span&gt;. The four Paulis that you have listed are not mutual exclusive generators, because &lt;span class=&quot;math-container&quot;&gt;$M_4 = M_{2}M_{3}$&lt;/span&gt; (or any other permutation). Hence, to generate this specific stabilizer we only need &lt;span class=&quot;math-container&quot;&gt;$M_{1}$&lt;/span&gt; and any two of the set &lt;span class=&quot;math-container&quot;&gt;$M_{2},M_{3},M_{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To illustrate, consider the operator &lt;span class=&quot;math-container&quot;&gt;$M_{5} = M_{1}M_{4} = (XXX)(IZZ) = (XYY)$&lt;/span&gt; (up to a phase). Evidently, &lt;span class=&quot;math-container&quot;&gt;$M_{5}|\psi\rangle = XYY|\psi\rangle = (+1)|\psi\rangle$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$M_{5}$&lt;/span&gt; is also an element of the stabilizer of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. However, we can 'generate' &lt;span class=&quot;math-container&quot;&gt;$M_{5}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M_{1}\&amp;amp; M_{4}$&lt;/span&gt;  (and therefore with &lt;span class=&quot;math-container&quot;&gt;$M_{1}, M_{2} \&amp;amp; M_{3}$&lt;/span&gt; as well), so we don't need to keep track of &lt;span class=&quot;math-container&quot;&gt;$M_{5}$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;Also, please note that only a subset of all valid quantum states can have a stabilizer comprised of Pauli matrices.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In fact,Daniel Gottesman, who developed the stabilizer formalism, said (and I paraphrase): &quot;I can't stop you from calling them stabilizers, but I do not condone it.&quot; :)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-08T09:22:26.133" LastActivityDate="2020-06-08T09:22:26.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12345" PostTypeId="2" ParentId="12340" CreationDate="2020-06-05T10:51:45.867" Score="9" Body="&lt;p&gt;A serious answer: you pretty much can't. It's not that &lt;em&gt;you in particular&lt;/em&gt; can't, it's that &lt;strong&gt;no one&lt;/strong&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;A slightly less serious answer: some odd &lt;span class=&quot;math-container&quot;&gt;$10-100$&lt;/span&gt; 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 &lt;strong&gt;pricey&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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:)&lt;/p&gt;&#xA;&lt;p&gt;This is not intended to shoot you down, but more as a light joke:)&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;Actually, what might be in reach for a personal investment is some very rudimentary version of a &lt;em&gt;photonic&lt;/em&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-07-26T20:54:36.800" LastActivityDate="2020-07-26T20:54:36.800" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12346" PostTypeId="2" ParentId="12341" CreationDate="2020-06-05T11:14:12.433" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$K=III\ldots IZII\ldots I$&lt;/span&gt;, where you have one with a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on each qubit (i.e. the stabilizers of the all-zero state), and you just update them to &lt;span class=&quot;math-container&quot;&gt;$UKU^\dagger$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, there's no guarantee that the output will be a nice tensor product of Paulis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-05T11:14:12.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12347" PostTypeId="1" AcceptedAnswerId="12350" CreationDate="2020-06-05T13:28:38.197" Score="7" ViewCount="219" Body="&lt;p&gt;I'm looking at a circuit from &lt;a href=&quot;https://arxiv.org/pdf/1409.3097.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; on quantum machine learning.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v9zXH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v9zXH.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So to introduce my own notation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we start with &lt;span class=&quot;math-container&quot;&gt;$|\psi_0⟩ = |0,a,b⟩ = a_0b_0|000⟩ + a_0b_1|001⟩ + a_1b_0|010⟩ + a_1b_1|011⟩$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;after the first &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gate we have &lt;span class=&quot;math-container&quot;&gt;$|\psi_1⟩$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;after the controlled-SWAP we have &lt;span class=&quot;math-container&quot;&gt;$|\psi_2⟩$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;after the second &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gate we have &lt;span class=&quot;math-container&quot;&gt;$|\psi_3⟩$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The paper says that at the end we measure &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; for the top qubit with the following probability:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(|0⟩_{\psi_3}) = \frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I'm new to this I decided to do the expansion by hand.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ySRlZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ySRlZ.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first two rows are grouped for &lt;span class=&quot;math-container&quot;&gt;$\vert 0xx\rangle$&lt;/span&gt; and the second two rows are for &lt;span class=&quot;math-container&quot;&gt;$\vert 1xx\rangle$&lt;/span&gt;. As I understand, I can get &lt;span class=&quot;math-container&quot;&gt;$P(|0⟩_{\psi_3})$&lt;/span&gt; by summing the probability amplitudes for the first two rows. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's what's baffling me:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The first two rows are basically what you would get back if you skipped the controlled-swap. You'd just come back to &lt;span class=&quot;math-container&quot;&gt;$|\psi_0⟩$&lt;/span&gt;. And as before, you'd get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(|0⟩_{\psi_0}) = |a_0b_0| + |a_0b_1| + |a_1b_0| + |a_1b_1|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|a_0b_1| + |a_1b_0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="2035" LastEditDate="2020-06-07T10:18:33.583" LastActivityDate="2020-08-12T15:50:58.453" Title="How to do quantum circuit arithmetic?" Tags="&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12348" PostTypeId="2" ParentId="12347" CreationDate="2020-06-05T14:58:19.787" Score="3" Body="&lt;p&gt;Found it! To me it actually feels very sneaky so I'll take the time to explain it.&lt;/p&gt;&#xA;&lt;p&gt;Focussing on just the top two rows of my handwritten expansion:&lt;/p&gt;&#xA;&lt;p&gt;I made the mistake of taking vertically adjacent pairs of coefficients, adding them together, and dividing by 2.&lt;/p&gt;&#xA;&lt;p&gt;So from left to right in vertical pairs:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then I just cancelled the 2's and was left with:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a_0b_0| + |a_0b_1| + |a_1b_0| + |a_1b_1| = 1 \tag{2A}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;hence my confusion.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;(1A)&lt;/strong&gt; would then be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And actually once you take the norms with these coefficients you get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a_0 b_0|^2&#xA;+ \frac{1}{2} | a_0 b_1 + a_1 b_0 |^2&#xA;+ |a_1 b_1|^2 \neq 1 \tag{2B}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And that makes up the gap.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|⟨a|b⟩|$&lt;/span&gt;. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13222/12643&quot;&gt;This answer&lt;/a&gt; explains how to do that.&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="12643" LastEditDate="2020-08-12T15:50:58.453" LastActivityDate="2020-08-12T15:50:58.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12349" PostTypeId="1" AcceptedAnswerId="12363" CreationDate="2020-06-05T15:34:25.227" Score="2" ViewCount="78" Body="&lt;p&gt;This question is related and complementary to this one:&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/12341/9716&quot;&gt;How to get the stabilizer group for a given state?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I want is to find the stabilizer group generators for the following state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|W\rangle = \dfrac{1}{\sqrt{3}}\Big(|011\rangle + |101\rangle + |110\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In theory, I should find &lt;span class=&quot;math-container&quot;&gt;$n-k = 3-0=3$&lt;/span&gt; independent non trivial generators.&#xA;But the only one I can find is &lt;span class=&quot;math-container&quot;&gt;$M_1 = Z\otimes Z\otimes Z$&lt;/span&gt; because any other combination, like &lt;span class=&quot;math-container&quot;&gt;$-Z\otimes Z\otimes -Z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$iZ\otimes iZ\otimes -Z$&lt;/span&gt; actually is equivalent to the first one, and there cannot be a combination with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; because it would alter the difference between 0s and 1s that is conserved in each sum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where are the other two generators?&lt;/p&gt;&#xA;" OwnerUserId="9716" LastEditorUserId="55" LastEditDate="2020-06-06T13:31:36.597" LastActivityDate="2020-06-08T08:27:34.377" Title="What is the stabilizer group of a $|W\rangle$ state?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12350" PostTypeId="2" ParentId="12347" CreationDate="2020-06-05T15:46:42.733" Score="3" Body="&lt;p&gt;For completeness i'm going to give the proof of the swap test:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The initial state is given as, where I will use a slight abuse of notation on the R.H.S (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle|a\rangle|b\rangle \equiv |0\rangle \otimes|a\rangle \otimes|b\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; are states NOT bases).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, if we were to take the measurement of either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; now the inner products of the measurements would give:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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}$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which isn't very useful, so by applying the swap:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi_3\rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|b\rangle|a\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;we will see that this changes the inner product of the measurements.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applying the second &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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]$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So first by inspection we can see with at least probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; that we will measure the first qubit in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we take the inner product for the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; measurement:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;(remembering the abuse of notation s.t. &lt;span class=&quot;math-container&quot;&gt;$\langle a | b \rangle \neq 0$&lt;/span&gt; because it is the inner product of the states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle = a_0|0\rangle + a_1|1\rangle$&lt;/span&gt; and not the bases of type &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. However by completion we know that &lt;span class=&quot;math-container&quot;&gt;$\langle a | a \rangle = 1$&lt;/span&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally how can &lt;span class=&quot;math-container&quot;&gt;$\langle b| \langle a| b \rangle |a\rangle)$&lt;/span&gt; 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&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle b| \langle a| b \rangle |a\rangle = \langle a| b \rangle\langle b| a \rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;by shuffling the scalar terms, and we can also see that&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle b| \langle a| b \rangle |a\rangle = \langle a| b \rangle\langle b| a \rangle = \langle a| \langle b| a \rangle |b\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However &lt;span class=&quot;math-container&quot;&gt;$ \langle a| b \rangle \neq \langle b| a \rangle$&lt;/span&gt; so we can't just square the inner product term. But we can use the relation via the complex conjugate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle b| a \rangle = \langle a| b \rangle^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hence we can write this as the modulus squared&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle a| b \rangle\langle b| a \rangle = \langle a| b \rangle\langle a| b \rangle^\dagger = |\langle a| b \rangle|^2$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-06-05T17:18:19.207" LastActivityDate="2020-06-05T17:18:19.207" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="12351" PostTypeId="2" ParentId="12340" CreationDate="2020-06-05T16:13:08.050" Score="7" Body="&lt;p&gt;With current technology, there's not much of a chance to build a true quantum &lt;em&gt;computer&lt;/em&gt;,  but you may be able to build some interesting quantum circuits with a fairly sizable (but still on the scale of &quot;self-funded&quot; for the ordinary person) budget, using the optical photon model. For instance, one could use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_optical_quantum_computing&quot; rel=&quot;noreferrer&quot;&gt;linear optical quantum computing model&lt;/a&gt;. Using beamsplitters as &lt;span class=&quot;math-container&quot;&gt;$\hat{y}$&lt;/span&gt; rotations and phase shifters as &lt;span class=&quot;math-container&quot;&gt;$\hat{z}$&lt;/span&gt; rotations, one can construct arbitrary one-qubit quantum gates. With the addition of a nonlinear medium (like &lt;a href=&quot;https://en.wikipedia.org/wiki/Kerr_effect&quot; rel=&quot;noreferrer&quot;&gt;Kerr Media&lt;/a&gt;), one can construct some interesting circuits. For reference, here are the transformations that each of those optical tools performs:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{B}_\theta = \begin{bmatrix} &#xA;\text{cos}(\theta) &amp;amp; -\text{sin}(\theta) \\&#xA;\text{sin}(\theta) &amp;amp; \text{cos}(\theta)&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{P}_\phi = \begin{bmatrix} &#xA;e^{i \phi} &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{K}_\mathcal{E} = \begin{bmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i \mathcal{E}}&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="12070" LastActivityDate="2020-06-05T16:13:08.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12352" PostTypeId="1" CreationDate="2020-06-05T19:17:55.203" Score="0" ViewCount="47" Body="&lt;p&gt;According to the Grover's algorithm section in the IBM Quantum Experience, if I have two qubits in the &quot;one&quot; 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?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/aLOr0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aLOr0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12075" LastEditorUserId="491" LastEditDate="2020-06-06T20:54:22.090" LastActivityDate="2020-06-06T20:54:22.090" Title="Grover oracle result: vectors (0,1) &amp; (0,1) =&gt; two Hadamards =&gt; product of two H results =&gt; CZ = (.5, .-5, -.5, -.5)" Tags="&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12353" PostTypeId="2" ParentId="12352" CreationDate="2020-06-05T21:25:23.740" Score="1" Body="&lt;p&gt;Could you point to the source? Your calculations seem correct, in Dirac notation:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;start with &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \otimes |1\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;apply H to each qubit: &lt;span class=&quot;math-container&quot;&gt;$|-\rangle \otimes |-\rangle = \frac12(|00\rangle - |01\rangle - |10\rangle + |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply CZ: the sign of &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; changes, for the final result &lt;span class=&quot;math-container&quot;&gt;$\frac12(|00\rangle - |01\rangle - |10\rangle - |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Could it be that the source starts with qubits in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |0\rangle$&lt;/span&gt; state? In that case the resulting amplitudes will indeed be &lt;span class=&quot;math-container&quot;&gt;$\frac12(|00\rangle + |01\rangle + |10\rangle - |11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-05T21:25:23.740" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="12354" PostTypeId="1" CreationDate="2020-06-05T21:32:26.127" Score="2" ViewCount="138" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$max(b)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$max(b)max(\alpha) &amp;lt; p-1$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is the full discrete logarithm. So for instance, if &lt;span class=&quot;math-container&quot;&gt;$max(b)$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$max(\alpha)$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{2^{\lfloor \log p \rfloor}}{64}$&lt;/span&gt;, then the modified Shor's algorithm will output &lt;span class=&quot;math-container&quot;&gt;$\alpha \mod w$&lt;/span&gt;. The modified Shor circuit will end in state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The restricted range of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; works for the following reason. If we write &lt;span class=&quot;math-container&quot;&gt;$y \equiv g^k$&lt;/span&gt; (the power of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; can be written as a power of &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;), then &lt;span class=&quot;math-container&quot;&gt;$a-rb \equiv k \mod (p-1)$&lt;/span&gt; and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a = rb + k - (p-1)\lfloor \frac{br+k}{p-1} \rfloor&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; should have the entire range of &lt;span class=&quot;math-container&quot;&gt;$2^{\lceil \log p \rceil}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; should be restricted to &lt;span class=&quot;math-container&quot;&gt;$max(b)$&lt;/span&gt;. This isn't a problem because any &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; will have a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; which ranges from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$p-1$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; will always have solutions. &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; in the substitution should be chosen to be in the range &lt;span class=&quot;math-container&quot;&gt;$[0,max(r)]$&lt;/span&gt; in order to avoid errors with taking the second modulus.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Following Shor, the amplitude is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Factor out a factor of &lt;span class=&quot;math-container&quot;&gt;$\exp(2\pi i \frac{kc}{w})$&lt;/span&gt; that doesn't affect the probability and get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$T = rc + d - \frac{r}{p-1}\{c(p-1)\}_w$&lt;/span&gt; and&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$V = \big( \frac{br}{p-1} - \lfloor \frac{br+k}{p-1} \rfloor\big) \{c(p-1)\}_w$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is automatically small as in the normal algorithm. For &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, those &lt;span class=&quot;math-container&quot;&gt;$c,d$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$rc+d=0\mod w$&lt;/span&gt; encode the period modulo &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\frac{\{c(p-1)\}_w}{w} &amp;lt; 1$&lt;/span&gt;, so if &lt;span class=&quot;math-container&quot;&gt;$\frac{max(b)r}{p-1} &amp;lt;&amp;lt; 1$&lt;/span&gt; then the exponentials for all terms will be close to 1 for pairs &lt;span class=&quot;math-container&quot;&gt;$c,d$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$rc+d=0\mod w$&lt;/span&gt;, so that the &lt;span class=&quot;math-container&quot;&gt;$max(b)+1$&lt;/span&gt; sums will all be constructive. If &lt;span class=&quot;math-container&quot;&gt;$rc+d \neq 0 \mod w$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\exp(\frac{2\pi i}{w}bT)$&lt;/span&gt; will contain terms at least as &quot;cycled through&quot; as &lt;span class=&quot;math-container&quot;&gt;$\exp(\frac{2\pi i}{w}max(b))$&lt;/span&gt;, and destructive interference will guarantee their sum is nearly 0.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9508027&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9305" LastEditorUserId="9305" LastEditDate="2020-06-14T19:46:27.047" LastActivityDate="2020-08-13T02:57:34.160" Title="Shor's Discrete Logarithm Algorithm with a QFT with a small prime base" Tags="&lt;shors-algorithm&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12355" PostTypeId="1" AcceptedAnswerId="12357" CreationDate="2020-06-06T05:18:16.877" Score="1" ViewCount="103" Body="&lt;p&gt;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  &lt;a href=&quot;https://github.com/DEBARGHYA4469/Quantum-Compiler&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/DEBARGHYA4469/Quantum-Compiler&lt;/a&gt; and &lt;a href=&quot;https://github.com/cryptogoth/skc-python&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/cryptogoth/skc-python&lt;/a&gt;.&#xA;As SK algorithm needs two parameters - an unitary single qubit gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and deepth &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. I tried to put &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; and make a unitary qubit gate as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. If I set the accuracy &lt;span class=&quot;math-container&quot;&gt;$\epsilon = 0.125$&lt;/span&gt;, which means the sequence should include &lt;span class=&quot;math-container&quot;&gt;$O(\log 3.97\cdot 0.05)$&lt;/span&gt; gates. I calculated it (&lt;span class=&quot;math-container&quot;&gt;$\log 3.97 \cdot 0.01$&lt;/span&gt; is around 2). But actually the sequence I get from code is far more than 2 gates:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SHTHTHTHTHHTHTHTHTHTHTHHTHhthhththththshthhththththtSTHTHSHTHSHTHTHTHTHHTHTHTHHTHTHTHTHSHTHhthththhththththshththththTHTHSHHSTHTHShthshthshthtsTHTHTHTHTHHTHSHTHTHTHTHHTHhthhththththththhththththsshthtshhshthtHTHTHTHTHSHTHTHTHTHHTHTHTHhthshththththhthththhththtTHTHSHTHSHTHSTHSSTHTHSTHHHshthshthshththhhtshthtsshtHHTHTHHHHTHSH&lt;/p&gt;&#xA;&#xA;&lt;p&gt;ACCURACY 0.053661016216388954&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So I just want to know why?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-06-06T13:41:30.190" LastActivityDate="2020-06-06T13:41:30.190" Title="Understanding the length of the sequence obtained via Solovay-Kitaev decomposition" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12356" PostTypeId="1" AcceptedAnswerId="12359" CreationDate="2020-06-06T06:42:08.717" Score="0" ViewCount="158" Body="&lt;p&gt;Transpiler Error: &lt;em&gt;Number of qubits (2) in circuit11 is greater than maximum (1) in the couplings map&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Initialize two qubits and create Entanglement using Hadamard and CX/CNOT Gate&#xA;q = qiskit.QuantumRegister(2)&#xA;c = qiskit.ClassicalRegister(2)&#xA;qc = qiskit.QuantumCircuit(q, c)&#xA;qc.h(q[0])&#xA;qc.cx(q[0], q[1])&#xA;qc.measure(q, c)&#xA;job_exp = qiskit.execute(qc, backend=backend, shots=1024, max_credits=3)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;TranspilerError                           Traceback (most recent call last)&#xA;&amp;lt;ipython-input-11-7b13276b10ae&amp;gt; in &amp;lt;module&amp;gt;()&#xA;      9 qc.cx(q[0], q[1])&#xA;     10 qc.measure(q, c)&#xA;---&amp;gt; 11 job_exp = qiskit.execute(qc, backend=backend, shots=1024, max_credits=3)&#xA;&#xA;2 frames&#xA;/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)&#xA;    249                                 seed_transpiler=seed_transpiler,&#xA;    250                                 optimization_level=optimization_level,&#xA;--&amp;gt; 251                                 backend=backend)&#xA;    252 &#xA;    253     if schedule_circuit:&#xA;&#xA;/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)&#xA;    205                                            callback, output_name)&#xA;    206 &#xA;--&amp;gt; 207     _check_circuits_coupling_map(circuits, transpile_args, backend)&#xA;    208 &#xA;    209     # Transpile circuits in parallel&#xA;&#xA;/usr/local/lib/python3.6/dist-packages/qiskit/compiler/transpile.py in _check_circuits_coupling_map(circuits, transpile_args, backend)&#xA;    245                                   'in {} '.format(circuit.name) +&#xA;    246                                   'is greater than maximum ({}) '.format(max_qubits) +&#xA;--&amp;gt; 247                                   'in the coupling_map')&#xA;    248 &#xA;    249 &#xA;&#xA;TranspilerError: 'Number of qubits (2) in circuit11 is greater than maximum (1) in the coupling_map'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9365" LastEditorUserId="55" LastEditDate="2020-06-06T11:35:46.653" LastActivityDate="2020-06-06T11:35:46.653" Title="Transpiler Error: Number of qubits greater than maximum in coupling map" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-06-23T19:38:34.750" ContentLicense="CC BY-SA 4.0" />
  <row Id="12357" PostTypeId="2" ParentId="12355" CreationDate="2020-06-06T06:46:14.917" Score="4" Body="&lt;p&gt;According to the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0505030&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Solovay-Kitaev algorithm&lt;/a&gt; (pg. 7) a number of single qubits gates approximating unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;l = O(\ln^{\ln5/\ln(3/2)}\frac{1}{\epsilon}),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;${\ln5/\ln(3/2)} = 3.97$&lt;/span&gt;. So, in your case with accuracy &lt;span class=&quot;math-container&quot;&gt;$\epsilon = 0.125$&lt;/span&gt;, you have &lt;span class=&quot;math-container&quot;&gt;$\ln^{3.97}\frac{1}{0.125}=\ln^{3.97} 8 = 18.29$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\epsilon = 0.05$&lt;/span&gt;, you will get 77.93.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-06T06:46:14.917" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12358" PostTypeId="2" ParentId="12340" CreationDate="2020-06-06T07:34:13.420" Score="6" Body="&lt;p&gt;Note that while you probably can't &lt;em&gt;build&lt;/em&gt; a quantum computer at home, you can &lt;em&gt;simulate&lt;/em&gt; one with a classical computer, at the cost of merely an exponential slowdown. There's a rather long list of available software at &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;noreferrer&quot;&gt;https://www.quantiki.org/wiki/list-qc-simulators&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12268" LastActivityDate="2020-06-06T07:34:13.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12359" PostTypeId="2" ParentId="12356" CreationDate="2020-06-06T10:45:41.420" Score="2" Body="&lt;p&gt;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 &lt;code&gt;backend.configuration()&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-06-06T10:45:41.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12360" PostTypeId="1" CreationDate="2020-06-06T11:54:21.373" Score="5" ViewCount="233" Body="&lt;p&gt;I have been trying to run two circuits in the ibmq_london device, the one resulting of applying one X gate on qubit &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;X circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;￼￼&lt;a href=&quot;https://i.stack.imgur.com/XoK5y.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XoK5y.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;XX circuit&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1LH8z.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1LH8z.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried to write the following code:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;job_device = execute(qc, device,shots=8192,basis_gates=None,optimization_level=0)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-06-06T13:42:00.107" LastActivityDate="2020-07-25T09:47:51.110" Title="How to not optimize the quantum gates in a qiskit circuit when running it in the real device?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12361" PostTypeId="2" ParentId="12360" CreationDate="2020-06-06T12:40:46.357" Score="5" Body="&lt;p&gt;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: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level0.py&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level0.py&lt;/a&gt; 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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;print(transpile(qc, device, optimization_level=0))&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which should show you 2 U3(pi,0,pi) gates next to each other. For example, when I ran it locally it shows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; print(transpile(qc, backend, optimization_level=0))&#xA;               ┌─────────────┐┌─────────────┐ ░ ┌─┐      &#xA;      q_0 -&amp;gt; 0 ┤ U3(pi,0,pi) ├┤ U3(pi,0,pi) ├─░─┤M├──────&#xA;               └─────────────┘└─────────────┘ ░ └╥┘┌─┐   &#xA;      q_1 -&amp;gt; 1 ───────────────────────────────░──╫─┤M├───&#xA;                                              ░  ║ └╥┘┌─┐&#xA;      q_2 -&amp;gt; 2 ───────────────────────────────░──╫──╫─┤M├&#xA;                                              ░  ║  ║ └╥┘&#xA;ancilla_0 -&amp;gt; 3 ──────────────────────────────────╫──╫──╫─&#xA;                                                 ║  ║  ║ &#xA;ancilla_1 -&amp;gt; 4 ──────────────────────────────────╫──╫──╫─&#xA;                                                 ║  ║  ║ &#xA;       meas_0: ══════════════════════════════════╩══╬══╬═&#xA;                                                    ║  ║ &#xA;       meas_1: ═════════════════════════════════════╩══╬═&#xA;                                                       ║ &#xA;       meas_2: ════════════════════════════════════════╩═&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-06-06T12:40:46.357" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12363" PostTypeId="2" ParentId="12349" CreationDate="2020-06-06T19:55:31.323" Score="2" Body="&lt;p&gt;To cite from &lt;a href=&quot;https://physics.stackexchange.com/a/422752/4888&quot;&gt;my answer from over at physics.SE&lt;/a&gt;:&#xA;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or, to phrase it without reduced density matrices: For a stabilizer state, if you measure &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; for any single qubit, the probability of getting either outcome is either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.  This is clearly not the case for a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurement on the W state above, where the probability of getting &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-06-08T08:27:34.377" LastActivityDate="2020-06-08T08:27:34.377" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12364" PostTypeId="2" ParentId="12340" CreationDate="2020-06-06T20:45:22.220" Score="3" Body="&lt;p&gt;It's actually an interesting question. And the previous answers (&quot;strictly speaking, you can't,&quot; &quot;you can simulate quantum computers,&quot; and &quot;photonics-based processing holds some promise&quot;) are all true. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.datavortex.com/research/quantum-simulation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.datavortex.com/research/quantum-simulation/&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="12277" LastActivityDate="2020-06-06T20:45:22.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12365" PostTypeId="1" CreationDate="2020-06-06T21:42:19.997" Score="1" ViewCount="167" Body="&lt;p&gt;I was trying to initialize to an arbitrary state of n qubits with the &lt;code&gt;initialize()&lt;/code&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. (&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/circuits/3_summary_of_quantum_operations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;described here&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My question is: Is there any method that can generate a state that will have numerically same wanted amplitudes ?  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Just found the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.preparearbitrarystate&quot; rel=&quot;nofollow noreferrer&quot;&gt;PrepareArbitraryState&lt;/a&gt; in Q# that does the same thing, they are based in the same &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; but some results seen different between then. If someone could explain me the technical differences between then it will be perfect.    &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit(2)&lt;/strong&gt;: Here is the test cited in the Qiskit tutorial:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Applied to Q# (this result is the same as input and is what I want):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|0⟩     5.970914908063292E-17 + 0.25000000000000017&#xA;|1⟩     0.3535533905932739 + 3.251767952832691E-17&#xA;|2⟩     0.2500000000000002 + 0.25000000000000017&#xA;|3⟩     -2.4061305817955694E-17 + -4.7860913024955035E-18&#xA;|4⟩     -4.845288669732255E-17 + 1.506300336842906E-16&#xA;|5⟩     0.3535533905932743 + 0.7071067811865478&#xA;|6⟩     0.2500000000000002 + -7.897235558417238E-17&#xA;|7⟩     4.7022165029227935E-18 + -4.194489669218219E-17&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;|0⟩     2.50000000e-01 + 0.j&#xA;|1⟩     2.77555756e-17 - 0.35355339j,&#xA;|2⟩     2.50000000e-01 - 0.25j&#xA;|3⟩     0.00000000e+00 + 0.j&#xA;|4⟩     0.00000000e+00 + 0.j&#xA;|5⟩     7.07106781e-01 - 0.35355339j&#xA;|6⟩     5.89805982e-17 - 0.25j&#xA;|7⟩     0.00000000e+00 + 0.j&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12278" LastEditorUserId="55" LastEditDate="2020-06-08T12:07:29.027" LastActivityDate="2020-08-05T06:47:02.320" Title="How can I initialize a state with chosen amplitudes in Qiskit?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;q#&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12366" PostTypeId="2" ParentId="12143" CreationDate="2020-06-07T05:21:22.200" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;In   &lt;a href=&quot;https://dspace.mit.edu/bitstream/handle/1721.1/85313/43918004-MIT.pdf?sequence=2&quot; rel=&quot;nofollow noreferrer&quot;&gt;Abrams' PhD Thesis&lt;/a&gt;  (partial, freely available on the Internet  )  there is a partial  answer to this  question, pages 79-80  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U_1 $&lt;/span&gt; of dimension &lt;span class=&quot;math-container&quot;&gt;$n+k$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;  is a constant), with some  ancillary qubits  set on input to state &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;  for example. All the &lt;span class=&quot;math-container&quot;&gt;$n+k$&lt;/span&gt;  output qubits of &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; are entangled.  At the next iteration,  I simulate &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;  using a unitary &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; gate  of dimension &lt;span class=&quot;math-container&quot;&gt;$n+2k$&lt;/span&gt; , by setting some  extra ancillary qubits  to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;.  At the next iteration,  I simulate &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt;  using a unitary gate &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt;  of dimension &lt;span class=&quot;math-container&quot;&gt;$n+3k$&lt;/span&gt; , by setting some extra ancillary qubits to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;.  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.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;   &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; , ..... is not exactly  the same thing as simulating the nonlinear OR gate (even if  &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;  with some ancillary qubits set to &lt;span class=&quot;math-container&quot;&gt;$\vert  0 \rangle$&lt;/span&gt; does indeed simulate the nonlinear OR gate). When you set the ancillary qubits of &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; you need &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; to simulate &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; when its own ancillary qubits are set to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle $&lt;/span&gt;. (in order to simulate the nonlinear OR gate). When you set the ancillary qubits of &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; you need &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; to simulate &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; when its own ancillary qubits are set to &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; , and so on. The problem requires a careful analysis,  and at this point I don't know if it allows a solution. &lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="10110" LastEditDate="2020-06-09T05:06:26.717" LastActivityDate="2020-06-09T05:06:26.717" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12367" PostTypeId="2" ParentId="12340" CreationDate="2020-06-07T06:32:01.233" Score="1" Body="&lt;p&gt;All previous answers are true. I would like to contribute with a serious question and a comment.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would it make sense to build a quantum computer in your house?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They are and will be hard to maintain. In my opinion, having them in the cloud is and will be the best solution. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-07T06:32:01.233" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12368" PostTypeId="1" CreationDate="2020-06-07T06:42:34.977" Score="3" ViewCount="131" Body="&lt;p&gt;I'm looking at the Qiskit getting started documentation, &lt;a href=&quot;https://qiskit.org/documentation/getting_started.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/getting_started.html&lt;/a&gt;. They create a quantum circuit and run an &lt;strong&gt;approximate simulation&lt;/strong&gt; on it 1000 times:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ln0pn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ln0pn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why bother with an &lt;strong&gt;approximate solution&lt;/strong&gt; when you can get an &lt;strong&gt;exact solution&lt;/strong&gt;? In this case, you can simulate everything with matrices and get this result:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}{1 \over {\sqrt 2}} \\ 0 \\ 0 \\ {1 \over {\sqrt 2}}\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;From this you know the &lt;strong&gt;exact&lt;/strong&gt; probabilities of each output: 00 occurs &lt;span class=&quot;math-container&quot;&gt;$1 \over 2$&lt;/span&gt; the time, 11 occurs &lt;span class=&quot;math-container&quot;&gt;$1 \over 2$&lt;/span&gt; the time. Is an exact simulator available in Qiskit?&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;How does an &lt;strong&gt;approximate simulator&lt;/strong&gt; work? For instance, after passing through the Hadamard gate, we have the qubit&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;{1 \over {\sqrt 2}} \\&#xA;{1 \over {\sqrt 2}}&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At that point, does the simulator immediately collapse the qubit to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to avoid potential superpositions? Or would that not be sufficient, and an approximate simulator is more complicated?&lt;/p&gt;&#xA;" OwnerUserId="12262" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-08-11T10:10:50.080" Title="How to run an approximate simulation, and why" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12369" PostTypeId="1" AcceptedAnswerId="12427" CreationDate="2020-06-07T22:36:11.353" Score="2" ViewCount="154" Body="&lt;p&gt;A couple of questions regarding the conversion between Jordan-Wigner (JW) and Bravyi-Kitaev (BK) states in Qiskit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The JW &lt;span class=&quot;math-container&quot;&gt;$\rightarrow$&lt;/span&gt; BK conversion matrix I refer to below is the one from equation (29) &lt;a href=&quot;https://arxiv.org/abs/1208.5986&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. (I'm not referring to equation (24) in &lt;em&gt;Ibid.&lt;/em&gt; for it contains a typo.)&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit vector by a &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$\operatorname{mod} 2$&lt;/span&gt;; since the matrix is upper-triangular, it is rather trivial to construct it out of CNOTs.)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-06-11T22:46:23.117" LastActivityDate="2020-06-11T22:46:23.117" Title="Jordan-Wigner $\leftrightarrow$ Bravyi-Kitaev transformation in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12370" PostTypeId="1" CreationDate="2020-06-08T01:02:04.930" Score="1" ViewCount="47" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Is this an error or it is functioning correctly, because in before versions it was possible doing it?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="11650" LastEditorUserId="9006" LastEditDate="2020-06-08T07:45:04.887" LastActivityDate="2020-06-08T07:45:35.330" Title="Who cares about Transpiled Circuit Text?" Tags="&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-06-08T18:53:48.357" ContentLicense="CC BY-SA 4.0" />
  <row Id="12371" PostTypeId="2" ParentId="12370" CreationDate="2020-06-08T01:26:38.517" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12278" LastEditorUserId="9006" LastEditDate="2020-06-08T07:45:35.330" LastActivityDate="2020-06-08T07:45:35.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12372" PostTypeId="2" ParentId="12340" CreationDate="2020-06-08T02:44:19.483" Score="1" Body="&lt;p&gt;He has basically described how to build the &lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.74.4091?casa_token=2tmp1e6xz3QAAAAA%3AT8mLeGX9fy_RxbTRGs_fgU77FN0eGucx27Kt7f8aLTYNZH9fH2OTZYfqlRzsUGdBSkvxFT8N4gQ9K9A&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirac-Zoller&lt;/a&gt; quantum computer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trapping of ions was already demonstrated a while ago e.g. &lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.45.6493&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;https://www.osapublishing.org/DirectPDFAccess/B1C0C8CD-E90D-221F-3646CF5B46659F3C_63302/oe-3-2-89.pdf?da=1&amp;amp;id=63302&amp;amp;seq=0&amp;amp;mobile=no&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A real competition to his start-up is a company called &lt;a href=&quot;https://ionq.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ionQ&lt;/a&gt; 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 &lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.97.103007?casa_token=lBWHDGQFH4wAAAAA%3AXOAVZEylEd2Ch-xTvoiuEbKTGiTi5MpChuCWATWdxeUZOJ7ZX4KNCBmKXIjxkTWiKploAKW_L5ZxVo0&quot; rel=&quot;nofollow noreferrer&quot;&gt;anomalous heating&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputingreport.com/scorecards/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; you can check out other architectures with their strengths and weaknesses.&lt;/p&gt;&#xA;" OwnerUserId="12140" LastActivityDate="2020-06-08T02:44:19.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12373" PostTypeId="2" ParentId="12368" CreationDate="2020-06-08T09:08:32.580" Score="5" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Why bother with an approximate solution when you can get an exact solution?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is an exact simulator available in Qiskit?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Qiskit can indeed handle exact simulations - there is the 'statevector_simulator' which will do this; you can retrieve it with &lt;code&gt;aer.get_backend('statevector_simulator')&lt;/code&gt;. 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 &lt;code&gt;results&lt;/code&gt; object using the &lt;code&gt;.get_statevector()&lt;/code&gt; method. See also &lt;a href=&quot;https://qiskit.org/textbook/ch-states/representing-qubit-states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this webpage&lt;/a&gt; from IBM/qiskit.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How does an approximate simulator work?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The simulations do &lt;strong&gt;not&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^{n} \times 2^{n}$&lt;/span&gt; density matrix; however you can use various insights and tricks to reduce the memory usage. It &lt;em&gt;will&lt;/em&gt; always be exponential though.)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\alpha|$&lt;/span&gt;'s and &lt;span class=&quot;math-container&quot;&gt;$|\beta|$&lt;/span&gt;'s. For density matrices, it is a bit more intricate as you use projection matrices.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-08-11T10:10:50.080" LastActivityDate="2020-08-11T10:10:50.080" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12374" PostTypeId="1" AcceptedAnswerId="12375" CreationDate="2020-06-08T11:20:46.910" Score="1" ViewCount="39" Body="&lt;p&gt;I have understood the concept of &quot;universal quantum gates&quot; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-06-08T12:28:50.103" LastActivityDate="2020-06-08T12:28:50.103" Title="A question about how to emulate quantum states and computation on classical computer" Tags="&lt;quantum-state&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12375" PostTypeId="2" ParentId="12374" CreationDate="2020-06-08T12:22:57.757" Score="3" Body="&lt;p&gt;In simulation, it is normally not needed to perform the process of decomposition - so your perspective is right, in principle. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, it can be actually useful to perform the decomposition and synthesis, for various reasons, including but not limited to:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The gate decomposition algorithm itself needs to be simulated (Rather than the algorithm/computation).&lt;/li&gt;&#xA;&lt;li&gt;Gate decomposition and synthesis might offer easier methods of circuit compilation, limiting or bringing down the number of operations that need to be simulated.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;li&gt;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. &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-06-08T12:22:57.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12376" PostTypeId="1" CreationDate="2020-06-08T13:10:53.070" Score="6" ViewCount="280" Body="&lt;p&gt;In some texts I see &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; Pauli operators as being said as boost and shift operators respectively.&#xA;But I came across some text that defines its own operators, namely:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X \vert j\rangle = \vert j+1\,\mod\,d\rangle \\&#xA;Z \vert j\rangle = \omega^j\vert j\rangle, \quad \omega = \exp \left( \frac{2\pi i}{d} \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I am confused as to what is the standard meaning of it, and why such a name.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I realized &lt;em&gt;Boost&lt;/em&gt; operator has something to do with quantum mechanics, where it is said to:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;shift expectation value of momentum&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Since I am not from physics background, it would be great if someone could explain it in simple words.&lt;/p&gt;&#xA;" OwnerUserId="12298" LastEditorUserId="55" LastEditDate="2020-07-26T18:04:04.393" LastActivityDate="2020-07-26T18:04:04.393" Title="What are boost and shift operators and why are they called so?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;pauli-gates&gt;&lt;terminology&gt;&lt;clifford-group&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12377" PostTypeId="1" AcceptedAnswerId="12379" CreationDate="2020-06-08T16:40:05.637" Score="4" ViewCount="93" Body="&lt;p&gt;In two places so far, I've heard statements of the sort &lt;em&gt;&quot;... 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.&quot;&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For reference, here are two timestamped youtube links to my examples:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://youtu.be/HHIWUi3GmdM?t=981&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/HHIWUi3GmdM?t=981&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://youtu.be/egli0tC1tRo?t=20&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/egli0tC1tRo?t=20&lt;/a&gt; (this is actually preceded by a &lt;a href=&quot;https://www.youtube.com/watch?v=Wy9YoEYv-fA&amp;amp;t=19s&quot; rel=&quot;nofollow noreferrer&quot;&gt;video on the classical model&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;So why is this the case? Looking for any good answers, but for me 1 to 3 intuitive &quot;ways of looking at it&quot; works best, even if they aren't airtight explanations.&lt;/p&gt;&#xA;" OwnerUserId="10485" LastActivityDate="2020-06-09T13:18:04.963" Title="Why does one need a non-commuting Hamiltonian for an algorithm to exhibit &quot;quantumness&quot;" Tags="&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12378" PostTypeId="1" AcceptedAnswerId="12412" CreationDate="2020-06-08T18:24:07.000" Score="2" ViewCount="99" Body="&lt;p&gt;In Qiskit, how do I construct a circuit corresponding to the Trotter expansion of a Pauli sum &lt;span class=&quot;math-container&quot;&gt;$A+B+C+\ldots$&lt;/span&gt; given as a &lt;code&gt;WightedPauliSum&lt;/code&gt; object?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{e}^{A + B + C + \ldots } \overset{?}{\mapsto}&#xA;\left\{\begin{alignedat}{9}&#xA;U &amp;amp;= \operatorname{e}^{A}\operatorname{e}^{B}\operatorname{e}^{C}\ldots \ &amp;amp;&amp;amp;, \quad &amp;amp;&amp;amp;\text{(first order)}\\&#xA;U &amp;amp;= \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} \ &amp;amp;&amp;amp;, \quad &amp;amp;&amp;amp;\text{(second order)}\\&#xA; &amp;amp; \ldots&#xA;\end{alignedat}\right.&#xA;$$&lt;/span&gt;&#xA;I guess, &lt;code&gt;PauliTrotterEvolution&lt;/code&gt; should do the job, but I have not found a tutorial.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-06-11T22:47:28.673" LastActivityDate="2020-06-11T22:47:28.673" Title="Trotterizing a Pauli sum in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12379" PostTypeId="2" ParentId="12377" CreationDate="2020-06-08T18:25:32.587" Score="3" Body="&lt;p&gt;First, a minor point: it doesn't make any sense to say that &quot;a Hamiltonian commutes&quot;. You mean that the different &lt;em&gt;terms&lt;/em&gt; in the Hamilonian commute. When it comes to commutation, it takes two (or more) to tango.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;there exists&lt;/em&gt; a basis of the Hilbert space that simultaneous diagonalizes every term. &lt;em&gt;After&lt;/em&gt; 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 &quot;operator&quot; nature effectively falls away and it basically just becomes a scalar energy function.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;quantum-ness&quot; only vanishes &lt;em&gt;after&lt;/em&gt; you've finished the highly quantum step of finding the simultaneous eigenstates of each term in the Hamiltonian.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, the toric code Hamiltonian has every term commuting, and you do sometimes hear the toric code described as &quot;classical&quot;, but I personally would say that it's highly quantum.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, saying that &quot;all terms in the Hamiltonian commute&quot; 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 &quot;a single term&quot; in the Hamiltonian.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-06-08T18:25:32.587" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12380" PostTypeId="1" CreationDate="2020-06-08T21:31:24.203" Score="2" ViewCount="135" Body="&lt;p&gt;Under Qiskit QAOA's tutorial (&lt;a href=&quot;https://qiskit.org/textbook/ch-applications/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/qaoa.html&lt;/a&gt;), the authors specify that a cost function &lt;span class=&quot;math-container&quot;&gt;$C(x)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H^{2^n}$&lt;/span&gt; via the transformation&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x_i \rightarrow \frac{1}{2}(1-Z_{i})$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; is a Boolean variable of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$Z_i$&lt;/span&gt; is the pauli-Z operator applied to qubit i.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was wondering what was the intuition behind the transformation and if there is a way to propose different alternatives.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="12302" LastEditDate="2020-06-09T22:18:02.957" LastActivityDate="2020-06-11T07:41:35.973" Title="Why do we transform a Boolean variable into a a Pauli Z matrix" Tags="&lt;pauli-gates&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12382" PostTypeId="1" CreationDate="2020-06-09T06:51:03.893" Score="4" ViewCount="1245" Body="&lt;p&gt;When I tried to use the Qiskit textbook module, it threw the following error:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Command was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit_textbook.tools import array_to_latex&#xA;array_to_latex(final_state, pretext=&quot;\\text{Statevector} = &quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Error was:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;ModuleNotFoundError                       Traceback (most recent call last)&#xA;&amp;lt;ipython-input-9-fe86c66f7ae0&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 from qiskit_textbook.tools import array_to_latex&#xA;      2 array_to_latex(final_state, pretext=&quot;\\text{Statevector} = &quot;)&#xA;&#xA;ModuleNotFoundError: **No module named 'qiskit_textbook'**&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I looked up the version I had, it showed the following: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;{'qiskit-terra': '0.12.0',&#xA; 'qiskit-aer': '0.4.1',&#xA; 'qiskit-ignis': '0.2.0',&#xA; 'qiskit-ibmq-provider': '0.5.0',&#xA; 'qiskit-aqua': '0.6.4',&#xA; 'qiskit': '0.16.1'}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Can someone help me in resolving the issue?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12304" LastEditorUserId="5955" LastEditDate="2020-06-09T10:49:38.637" LastActivityDate="2020-12-06T11:17:53.673" Title="Unable to use qiskit_textbook module" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12384" PostTypeId="5" CreationDate="2020-06-09T09:07:34.220" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2020-06-09T09:07:34.220" LastActivityDate="2020-06-09T09:07:34.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12385" PostTypeId="4" CreationDate="2020-06-09T09:07:34.220" Score="0" Body="For all questions regarding quantum process tomography or derivatives thereof (like gate-set tomography). In quantum process tomography, processes that are performed on qubits are characterized rather than the state of the qubits themselves; see quantum state tomography for this." OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-09T12:50:50.367" LastActivityDate="2020-06-09T12:50:50.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12386" PostTypeId="2" ParentId="12382" CreationDate="2020-06-09T10:52:20.863" Score="3" Body="&lt;p&gt;The qiskit textbook is not a standard module included with qiskit, it has to be installed separately. The repo where it is kept is &lt;a href=&quot;https://github.com/Qiskit/qiskit-textbook&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;a href=&quot;https://adamj.eu/tech/2019/03/11/pip-install-from-a-git-repository/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This link&lt;/a&gt; explains how to pip install from a git repo, you need to use a slightly different command to normal pip installs.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-06-09T10:52:20.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12387" PostTypeId="1" AcceptedAnswerId="12388" CreationDate="2020-06-09T12:05:00.703" Score="0" ViewCount="93" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-10-12T07:25:52.533" LastActivityDate="2020-10-12T07:25:52.533" Title="How to decompose unitary quantum gate in current simulator or emulator?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12388" PostTypeId="2" ParentId="12387" CreationDate="2020-06-09T12:11:11.547" Score="2" Body="&lt;p&gt;In Qiskit, the iso() function allows you to add a gate, defined by means of a unitary, to your quantum circuit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The decomposition used in the iso() function was introduced by Iten et al. in &lt;a href=&quot;https://arxiv.org/abs/1501.06911&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1501.06911&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course this is related to the circuit, not to the backend (which can be real or simulated).&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-09T12:11:11.547" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12389" PostTypeId="2" ParentId="12377" CreationDate="2020-06-09T13:18:04.963" Score="1" Body="&lt;p&gt;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!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;instantaneous quantum computing&quot;, where all gates commute, yet where &lt;a href=&quot;https://arxiv.org/abs/1504.07999&quot; rel=&quot;nofollow noreferrer&quot;&gt;evidence has been given that it cannot be classically simulated&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-06-09T13:18:04.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12390" PostTypeId="1" AcceptedAnswerId="12391" CreationDate="2020-06-09T15:59:18.517" Score="2" ViewCount="52" Body="&lt;p&gt;For Mosca Keynes, ex 7.1.5:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You are asked to prove:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi_{r,b}\rangle = \frac{1}{\sqrt{m}}\sum_{z=0}^{m-1}|zr + b\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;with period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, shift &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; repetitions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I get to a point where I can factor to QFT result into two parts where get:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get the final result I assume that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sum_{z=0}^{m-1}\sum_{k=0}^{r-1}e^{-2\pi izk} = m$&lt;/span&gt;, given that &lt;span class=&quot;math-container&quot;&gt;$e^{-2\pi izk} = 1$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$z,k\in\mathbb{Z}$&lt;/span&gt;, is this final stage of my proof correct or have I gone in completely the wrong direction?&lt;/p&gt;&#xA;" OwnerUserId="6139" LastActivityDate="2020-06-09T19:46:27.523" Title="Proof of QFT for a Periodic Function" Tags="&lt;mathematics&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12391" PostTypeId="2" ParentId="12390" CreationDate="2020-06-09T19:39:28.323" Score="1" Body="&lt;p&gt;If you assume that &lt;span class=&quot;math-container&quot;&gt;$e^{−2\pi z k} = 1$&lt;/span&gt; then the sum is &#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\sum_{z=0}^{m-1} \sum_{k=0}^{r-1} 1 = \sum_{z=0}^{m-1} r = mr,&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, at the same time&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;&amp;amp;\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 \\&#xA;=&amp;amp;&#xA;\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 \\&#xA;=&amp;amp;&#xA;\frac{1}{m\sqrt{r}}m\sum_{k=0}^{r-1}e^{-2\pi i \frac{b}{r}k}|mk\rangle &#xA;\end{split}&#xA;$$&lt;/span&gt;&#xA;the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;s cancel and it looks like you get your result.&lt;/p&gt;&#xA;" OwnerUserId="12140" LastEditorUserId="12140" LastEditDate="2020-06-09T19:46:27.523" LastActivityDate="2020-06-09T19:46:27.523" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12392" PostTypeId="1" CreationDate="2020-06-09T19:45:05.180" Score="0" ViewCount="68" Body="&lt;p&gt;We have a classical reversible circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; implementing a classical boolean function &lt;span class=&quot;math-container&quot;&gt;$f: \left\{0, 1\right\}^n \to \left\{0, 1\right\}$&lt;/span&gt;, which also takes some &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; ancilla bits, and has side effect of outputting garbage &lt;span class=&quot;math-container&quot;&gt;$g(x)$&lt;/span&gt;. Then we have the following circuit diagram for uncomputing the garbage. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The trick is to CNOT the answer qubit (which I'll call the 2nd qubit) &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; with a fresh ancilla (the 1st qubit) initialized to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, which changes the state of the first qubit to &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. Then we use the inverse of the circuit and get back &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and other ancilla qubits back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we are using this circuit with classical inputs, then it is clear that &lt;span class=&quot;math-container&quot;&gt;$f(x) \in \left\{0, 1\right\}$&lt;/span&gt;. Then, &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; CNOT &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is the same as taking the XOR of the two bits. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we feed the input a uniform superposition of all the inputs, then we want the circuit to behave as follows: &lt;span class=&quot;math-container&quot;&gt;$$\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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now this is the part I don't understand. In the quantum case, &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt; can be a general quantum state &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b|1\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$a |00\rangle + b|11\rangle$&lt;/span&gt;. Now, &lt;span class=&quot;math-container&quot;&gt;$U^{-1}$&lt;/span&gt; undoes everything done inside &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|x\rangle \otimes |f(x)\rangle$&lt;/span&gt;, which indicates that they are not entangled.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qwO4w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qwO4w.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12309" LastActivityDate="2020-06-10T20:54:43.520" Title="CNOT in reversible computing and entanglement" Tags="&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12393" PostTypeId="2" ParentId="12392" CreationDate="2020-06-09T21:00:47.073" Score="1" Body="&lt;p&gt;When we talk about reversible computing, &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is the scalar value of the function of the input vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-09T21:00:47.073" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12394" PostTypeId="1" AcceptedAnswerId="12395" CreationDate="2020-06-09T21:17:44.843" Score="1" ViewCount="32" Body="&lt;p&gt;&lt;strong&gt;Updated and edited question:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$N_{\delta}:P(\mathcal{H}_A)\rightarrow P(\mathcal{H}_B)$&lt;/span&gt; be a completely positive trace nonincreasing map from the set of positive semidefinite operators in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; to positive semidefinite operators in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt;. For any &lt;span class=&quot;math-container&quot;&gt;$\rho\in P(\mathcal{H}_{A})$&lt;/span&gt;, we want &lt;span class=&quot;math-container&quot;&gt;$\sigma = N_{\delta}(\rho)$&lt;/span&gt; such that all its positive eigenvalues are greater than &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; and all remamining eigenvalues are zero.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can such a map &lt;span class=&quot;math-container&quot;&gt;$N_\delta$&lt;/span&gt; be constructed?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on a previous version of the question, the comment of @Rammus and the answer of @NorbertSchuch suggested using a projection operation &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; into the eigenspace with eigenvalues larger than &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;. However, the required projector depends on the input state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, which I would like to avoid. &lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-06-09T22:09:16.060" LastActivityDate="2020-06-09T22:18:53.180" Title="Quantum operation to get rid of small but nonzero eigenvalues" Tags="&lt;density-matrix&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12395" PostTypeId="2" ParentId="12394" CreationDate="2020-06-09T21:32:29.797" Score="1" Body="&lt;p&gt;Answer to the new version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;No, such a map cannot exist.  CP maps are linear, i.e., &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal E(\lambda\rho) = \lambda \mathcal E(\rho)\ .&#xA;$$&lt;/span&gt;&#xA;Thus, you can easily see that for &lt;span class=&quot;math-container&quot;&gt;$\lambda\ne 1$&lt;/span&gt;, this is inconsistent with your definition.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Answer to the original version:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sure, just project onto the eigenspace which you want to keep:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\mapsto P\rho P^\dagger&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; the orthogonal projector onto the eigenspace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is in Kraus form, and thus CP.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-06-09T22:18:53.180" LastActivityDate="2020-06-09T22:18:53.180" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12396" PostTypeId="2" ParentId="12392" CreationDate="2020-06-09T22:09:51.243" Score="1" Body="&lt;p&gt;An illuminating example is reported in the last page of the following lecture notes:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://people.cs.uchicago.edu/~ftchong/33001/lecture09.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://people.cs.uchicago.edu/~ftchong/33001/lecture09.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-09T22:09:51.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12397" PostTypeId="1" AcceptedAnswerId="12399" CreationDate="2020-06-09T22:19:25.047" Score="4" ViewCount="124" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="12312" LastEditorUserId="55" LastEditDate="2020-06-10T14:43:15.713" LastActivityDate="2020-06-11T07:40:47.997" Title="What is a difference between error rates and qubit/gate fidelity?" Tags="&lt;error-correction&gt;&lt;fidelity&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12398" PostTypeId="1" AcceptedAnswerId="12400" CreationDate="2020-06-10T00:10:21.133" Score="3" ViewCount="91" Body="&lt;p&gt;I have read a paper about &quot;approximated decomposition&quot; of a unitary single gate (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0505030.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Solovay-Kitaev algorithm&lt;/a&gt;) which told us a any unitary single gate can be decomposed into {Hadamard, Phase} with any accuracy &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; . The number of {Hadamard, Phase} grows exponentially as the &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; becomes lower and the result is a better approximation of the gate. However, in simulator or emulator such as project Q and Qiskit, the &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate seems exacted decomposition which means only one parameterized &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate can realize any unitary single gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;So if we can realize &quot;exact unitary single gate&quot; in quantum computer, why still so many people focus on the &quot;approximated one&quot; and try to optimized the sequence after decomposition?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:50.303" LastActivityDate="2020-10-08T17:54:50.303" Title="a question about quantum gate decomposition on simulator or emulator" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;programming&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12399" PostTypeId="2" ParentId="12397" CreationDate="2020-06-10T04:04:34.190" Score="4" Body="&lt;p&gt;Usually, error rate for a qubit is defined as probability of undesired change in the qubit state (see for example this &lt;a href=&quot;https://arxiv.org/pdf/1805.10224.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then we have &lt;em&gt;state fidelity&lt;/em&gt;, 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. &lt;em&gt;Quantum state tomography&lt;/em&gt; is a means to characterize the actual state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, &lt;em&gt;gate fidelity&lt;/em&gt; 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 &lt;em&gt;quantum process tomography&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-10T04:04:34.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12400" PostTypeId="2" ParentId="12398" CreationDate="2020-06-10T06:43:54.870" Score="3" Body="&lt;p&gt;The restricted gate set of, for example, &lt;span class=&quot;math-container&quot;&gt;$\{H,T\}$&lt;/span&gt;, 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 + &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-10T06:43:54.870" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12401" PostTypeId="2" ParentId="12392" CreationDate="2020-06-10T06:44:03.713" Score="1" Body="&lt;p&gt;This statement is not quite right: &lt;em&gt;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⟩&lt;/em&gt;. &#xA;In your circuit CNOT only applies operation but does not entangle state, because there are no Hadamard gates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I.e. This state is not entangled:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/V9g1p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V9g1p.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;and this one is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9NjTw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9NjTw.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9456" LastEditorUserId="9456" LastEditDate="2020-06-10T20:54:43.520" LastActivityDate="2020-06-10T20:54:43.520" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12402" PostTypeId="2" ParentId="12380" CreationDate="2020-06-10T07:01:22.113" Score="2" Body="&lt;p&gt;The main thing that you're trying to do is create Hamiltonians whose ground states have a correspondence to basis vectors &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. So, the point of an operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R=\frac12(1-Z)=\left(\begin{array}{cc} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;is that it has two eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; has a ground state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-R$&lt;/span&gt; has a ground state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The 0 and 1 are the things you're trying to directly correspond to binary variables.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You might ask why one bothers to include the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\frac12(I+Z)$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$-R$&lt;/span&gt; to get the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state as a ground state).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, let's say I want to create a ground state corresponding to the binary string &lt;span class=&quot;math-container&quot;&gt;$x=01$&lt;/span&gt;. I can use a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=R_1-R_2$&lt;/span&gt;. (This is obviously diagonal, so the computational basis states are all eigenstates). In general, for any &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;, I can use&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{i=1}^n(-1)^{x_i}R_i&#xA;$$&lt;/span&gt;&#xA;to make the ground state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. (There are several other ways that we could construct a Hamiltonian with the correct ground state, but this is a particularly simple one.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$x_1=x_2$&lt;/span&gt;. You could do something like &lt;span class=&quot;math-container&quot;&gt;$\frac12(I-Z_1Z_2)$&lt;/span&gt;. You find a ground state (with energy 0), perhaps &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, and that tells you &lt;span class=&quot;math-container&quot;&gt;$x=11$&lt;/span&gt; is a solution to &lt;span class=&quot;math-container&quot;&gt;$x_1=x_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we take this a little further, you could ask if there's a satisfying formula &lt;span class=&quot;math-container&quot;&gt;$x_1=x_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_2=x_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_3\neq x_1$&lt;/span&gt; (OK, obviously not, but with more complex formulae, it's not so obvious).&#xA;You'd set up a Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\frac12(I-Z_1Z_2)+\frac12(I-Z_2Z_3)+\frac12(I+Z_1Z_3),&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-06-11T07:41:35.973" LastActivityDate="2020-06-11T07:41:35.973" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12403" PostTypeId="1" AcceptedAnswerId="12404" CreationDate="2020-06-10T07:59:34.893" Score="2" ViewCount="108" Body="&lt;p&gt;I hope you don't mind me having two questions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;br&gt;&#xA;&lt;strong&gt;What is the maximum depth possible on a quantum computer?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Secondly, on a smaller problem in the HHL of size 2x2 the depth is 326 and width of 7 qubits. &lt;strong&gt;Are my results wrong? It seems odd to have a lower depth than such a small problem.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;[1] &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#implementationsim&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#implementationsim&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12316" LastEditorUserId="9006" LastEditDate="2020-06-10T09:17:39.887" LastActivityDate="2020-06-10T09:17:39.887" Title="The maximum depth possible on quantum computers" Tags="&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12404" PostTypeId="2" ParentId="12403" CreationDate="2020-06-10T09:07:43.803" Score="1" Body="&lt;p&gt;This is quite a broad question. In fact it seems that you have 2 questions:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can a smaller (in term of size) matrix result in a longer quantum circuit?&lt;/li&gt;&#xA;&lt;li&gt;What is the maximum depth current quantum computer can execute (reliably)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;About question 1, the number of quantum gates and depth of the quantum circuit generated depends &lt;strong&gt;a lot&lt;/strong&gt; on the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; of your linear system, on the method used to implement the evolution &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt; and on how you &quot;load&quot; the right-hand side &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in a quantum register.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Efficient&lt;/em&gt; methods to construct the quantum circuit that implements &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt; exist when &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; satisfy some properties (like sparsity or locality). But here, &lt;em&gt;efficient&lt;/em&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2497/1386&quot;&gt;here&lt;/a&gt; and an example of an hand-craft method for specific matrices has been written &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/1386&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another point that might impact a lot the final depth of the circuit is the encoding of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; into a quantum register. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About your second question, have a look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5752/1386&quot;&gt;this answer&lt;/a&gt;. Do not use the numbers in it as they are probably outdated, but you can use the method with up-to-date error rates.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2020-06-10T09:07:43.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12405" PostTypeId="1" AcceptedAnswerId="12407" CreationDate="2020-06-10T09:35:00.053" Score="0" ViewCount="59" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate remained. Hence, I was not able to run my original circuit and assess effect of decoherence etc based on depth of the circuit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To given an example, my original circuit is&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;h q[0];&#xA;s q[0];&#xA;t q[0];&#xA;sdg q[0];&#xA;h q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;After transpiling (on IBM Q Armonk), the resulting QASM code is as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;u3(-0.7853981633974483, 1.5707963267948966, 4.71238898038469) q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I tried to add barriers before first &lt;code&gt;h q[0];&lt;/code&gt; and after last &lt;code&gt;h q[0];&lt;/code&gt; to prevent optimizer from working, however, without success.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I understand that basic gates on IBM Q are &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; and that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; are eventually impleted by these &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gates. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;However, is it possible to avoid optimization so that the original number of gates is preserved?&lt;/strong&gt; In other words, Hadamard will be presented by one &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate, phase gate and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; by one &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; gate each etc.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-10T11:37:10.333" Title="How to stop optimization of a circuit during transpiling in web-interface of IBM Q?" Tags="&lt;ibm-q-experience&gt;&lt;optimization&gt;&lt;qasm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12406" PostTypeId="2" ParentId="12405" CreationDate="2020-06-10T09:53:17.033" Score="1" Body="&lt;p&gt;When you transpile (either when calling &lt;code&gt;execute&lt;/code&gt; or &lt;code&gt;transpile&lt;/code&gt;), you should be able to set &lt;code&gt;optimization_level=0&lt;/code&gt; so the transpiler only maps the qubits to the backend. &lt;a href=&quot;https://www.youtube.com/watch?v=xWJbfyE9Vi4&quot; rel=&quot;nofollow noreferrer&quot;&gt;You can see an example here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-06-10T09:53:17.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12407" PostTypeId="2" ParentId="12405" CreationDate="2020-06-10T11:37:10.333" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-06-10T11:37:10.333" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12408" PostTypeId="1" AcceptedAnswerId="12409" CreationDate="2020-06-10T12:39:01.233" Score="2" ViewCount="67" Body="&lt;p&gt;As far as I know the single qubit gate&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\beta\sigma_z} =&#xA;\begin{bmatrix}&#xA;e^{i\beta} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{-i\beta}&#xA;\end{bmatrix}&#xA;= e^{i\beta}&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{-i2\beta}&#xA;\end{bmatrix} = e^{i\beta} R_Z(-2\beta).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, I have seen the above gate implemented using &lt;span class=&quot;math-container&quot;&gt;$U_1(2\beta)$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;U_1(\lambda) = &#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\lambda}&#xA;\end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is &lt;span class=&quot;math-container&quot;&gt;$e^{i\beta} R_Z(-2\beta)$&lt;/span&gt; equivalent to &lt;span class=&quot;math-container&quot;&gt;$U_1(2\beta)$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As Davit explains below, &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta/2} R_Z(\theta) = U_1(\theta)$&lt;/span&gt;, so with &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}=\beta$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$e^{i\beta} R_Z(2\beta) = U_1(2\beta)$&lt;/span&gt;. Note the difference: in this case the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-rotation is positive, whereas in my original question it is negative.&lt;/p&gt;&#xA;" OwnerUserId="8282" LastEditorUserId="8282" LastEditDate="2020-06-10T23:10:51.043" LastActivityDate="2020-06-11T07:10:06.630" Title="Is $e^{i\beta} R_Z(-2\beta)$ equivalent to $U_1(2\beta)$?" Tags="&lt;quantum-gate&gt;&lt;bloch-sphere&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12409" PostTypeId="2" ParentId="12408" CreationDate="2020-06-10T13:03:52.910" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gate from M. Nielsen and I. Chuang textbook (page 174):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_z(\theta) = e^{-i\theta Z/2} =\begin{pmatrix} e^{-i \theta /2} &amp;amp;0 \\ 0&amp;amp;e^{i \theta /2} \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we use this definition for &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_z(\theta) = e^{-i \theta/2} \begin{pmatrix} 1 &amp;amp;0 \\ 0&amp;amp;e^{i \theta} \end{pmatrix} = e^{-i \theta/2} U_1(\theta)$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Therefore, &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_1(\theta)$&lt;/span&gt; can be regarded as equivalent gates, because the global phase &lt;span class=&quot;math-container&quot;&gt;$e^{-i \theta/2}$&lt;/span&gt; can be neglected. Note that this comparison is not true for their controlled versions: &lt;span class=&quot;math-container&quot;&gt;$cR_z(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$cU_1(\theta)$&lt;/span&gt; can't be regarded as equivalent gates.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-11T07:10:06.630" LastActivityDate="2020-06-11T07:10:06.630" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12410" PostTypeId="1" CreationDate="2020-06-10T17:19:50.277" Score="2" ViewCount="88" Body="&lt;p&gt;&lt;em&gt;This question is available in Quantum Katas &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/Superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;In Task 2.6 of this notebook, we are required to create the &lt;code&gt;W&lt;/code&gt; State for &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Input: &lt;span class=&quot;math-container&quot;&gt;$=2^$&lt;/span&gt; qubits in the |0…0⟩ state.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For example, for &lt;span class=&quot;math-container&quot;&gt;$=4$&lt;/span&gt; the required state is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|1000⟩+|0100⟩+|0010⟩+|0001⟩)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And since this problem is taken from Katas, it came with a solution which is as follows:&#xA;s&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;operation WState_PowerOfTwo (qs : Qubit[]) : Unit is Adj+Ctl {&#xA;    let N = Length(qs);&#xA;&#xA;    if (N == 1) {&#xA;        // base of recursion: |1⟩&#xA;        X(qs[0]);&#xA;    } else {&#xA;        let K = N / 2;&#xA;        using (anc = Qubit()) {&#xA;            H(anc);&#xA;            &#xA;            (ControlledOnInt(0, WState_PowerOfTwo))([anc], qs[0 .. K - 1]);&#xA;            (ControlledOnInt(1, WState_PowerOfTwo))([anc], qs[K .. N - 1]);&#xA;&#xA;            for (i in K .. N - 1) {&#xA;                CNOT(qs[i], anc);&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;operation WState_PowerOfTwo (qs : Qubit[]) : Unit {&#xA;    let length_qs = Length(qs);&#xA;    if (length_qs == 1){&#xA;        X(qs[0]);&#xA;    }&#xA;    else{&#xA;    H(qs[0]);&#xA;    &#xA;    for(i in 1..length_qs-1){&#xA;        if(i != length_qs-1){&#xA;            for (j in 0..i-1){&#xA;                X(qs[j]);&#xA;            }&#xA;            Controlled H(qs[0..i-1], qs[i]);&#xA;            for (j in 0..i-1){&#xA;                X(qs[j]);&#xA;            }&#xA;        }&#xA;        else{&#xA;            for (j in 0..i-1){&#xA;                X(qs[j]);&#xA;            }&#xA;            Controlled X(qs[0..i-1], qs[i]);&#xA;            for (j in 0..i-1){&#xA;                X(qs[j]);&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This logics works fine till &lt;code&gt;N=2&lt;/code&gt; but it shows the following error when testing for hidden cases:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;The desired state for N = 1&#xA;# wave function for qubits with ids (least to most significant): 0&#xA;∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   &#xA;∣1❭:     1.000000 +  0.000000 i  ==     ******************** [ 1.000000 ]     --- [  0.00000 rad ]&#xA;The actual state:&#xA;# wave function for qubits with ids (least to most significant): 0&#xA;∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   &#xA;∣1❭:     1.000000 +  0.000000 i  ==     ******************** [ 1.000000 ]     --- [  0.00000 rad ]&#xA;Test case passed&#xA;The desired state for N = 2&#xA;# wave function for qubits with ids (least to most significant): 0;1&#xA;∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   &#xA;∣1❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]&#xA;∣2❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]&#xA;∣3❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   &#xA;The actual state:&#xA;# wave function for qubits with ids (least to most significant): 0;1&#xA;∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   &#xA;∣1❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]&#xA;∣2❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]&#xA;∣3❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   &#xA;Test case passed&#xA;Testing on hidden test cases...&#xA;Released qubits are not in zero state.&#xA;Try again!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I cannot find a root for this problem, is there any error in my logic or am I missing something here?&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="23" LastEditDate="2020-07-26T18:02:53.043" LastActivityDate="2020-07-26T18:02:53.043" Title="Creating a W state for $2^k$ qubits" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12411" PostTypeId="2" ParentId="12410" CreationDate="2020-06-10T18:11:50.310" Score="3" Body="&lt;p&gt;Yes, there is an error in your logic. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you take the task one step further, to &lt;span class=&quot;math-container&quot;&gt;$N = 4$&lt;/span&gt;, the desired state is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|1000\rangle + |0100\rangle + |0010\rangle + |0001\rangle)$&lt;/span&gt;, and the state your solution prepares is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}|1000\rangle + \frac{1}{2}|0100\rangle + \frac{1}{2\sqrt2}(|0010\rangle + |0001\rangle)$&lt;/span&gt;. You can see this for yourself if you modify the testing harness in VS or VS Code to have &lt;code&gt;AssertEqualOnZeroState(4, WState_PowerOfTwo, WState_PowerOfTwo_Reference, true, &quot;N = 4&quot;);&lt;/code&gt; so that it prints the expected state and the actual state when testing your solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You have a linear combination of the right basis states but the amplitudes are incorrect, since you apply&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;one H gate to modify the amplitude of the state in which &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is in the first position, &lt;/li&gt;&#xA;&lt;li&gt;two H gates to modify the amplitude of the state in which &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is in the second position, &lt;/li&gt;&#xA;&lt;li&gt;and three H gates to modify the amplitude of the states in which &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is in the third or fourth positions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}|1000\rangle + \frac{\sqrt3}{2}|0000\rangle$&lt;/span&gt; so that the amplitude of the first state is correct. You can check the reference solution for task 2.7 for this approach.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-10T18:11:50.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12412" PostTypeId="2" ParentId="12378" CreationDate="2020-06-10T23:44:08.873" Score="1" Body="&lt;p&gt;Looks like this works:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qc_trotter = paulistring.evolve( evo_time = 1, &#xA;                                 expansion_order = 2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;where &lt;code&gt;qc_trotter&lt;/code&gt; is an object of type &lt;code&gt;WeightedPauliOperator&lt;/code&gt;, see &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.legacy.WeightedPauliOperator.evolve.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Be mindful though that using circuits generated in this way may sometimes result in errors, as reported &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/issues/1034&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-06-11T14:03:56.510" LastActivityDate="2020-06-11T14:03:56.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12413" PostTypeId="1" AcceptedAnswerId="12414" CreationDate="2020-06-11T03:01:20.503" Score="1" ViewCount="98" Body="&lt;p&gt;If we choose double-slit, can we put multiple &quot;slits&quot; and create calculation for just one algorithm (problem, solution...)? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Not general purpose quantum CPU, just for one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Same question for Stern-Gerlach.&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="55" LastEditDate="2020-06-13T05:40:50.487" LastActivityDate="2020-06-13T05:40:50.487" Title="Is it possible to create a quantum computer with a double-slit or Stern-Gerlach apparatus?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;physical-realization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12414" PostTypeId="2" ParentId="12413" CreationDate="2020-06-11T06:53:06.363" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Stern-Gerlach experiment is basically just a measurement of a qubit in a specific basis. You need more than that for an algorithm....&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-06-11T09:47:07.480" LastActivityDate="2020-06-11T09:47:07.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12415" PostTypeId="2" ParentId="12397" CreationDate="2020-06-11T07:40:47.997" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let me illustrate this with an example. Let's say I have an initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; which I'm just storing. So my expected output is &lt;span class=&quot;math-container&quot;&gt;$|\psi_\text{target}\rangle=|0\rangle$&lt;/span&gt;. However, what actually happens is that with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, there is an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error (this flips the bit value). So my real output is a density matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|,&#xA;$$&lt;/span&gt;&#xA;which you can interpret as &quot;with probability &lt;span class=&quot;math-container&quot;&gt;$(1-p)$&lt;/span&gt;, I get the 0 state, and with probability 1, I get the 1 state&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The error rate in this case is simply &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. (If you want to interpret it as a rate, it's a probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; per operation.) The fidelity, on the other hand, is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F=\langle\psi_\text{target}|\rho|\psi_\text{target}\rangle=1-p.&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt;, then the error rate is still &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. However, &lt;span class=&quot;math-container&quot;&gt;$\rho_\text{out}=|+\rangle\langle +|$&lt;/span&gt;, and thus, the fidelity is 1. This particular input was unaffected by noise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-11T07:40:47.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12416" PostTypeId="2" ParentId="11861" CreationDate="2020-06-11T09:52:23.347" Score="1" Body="&lt;p&gt;According to the answer of &lt;em&gt;Simon Crane&lt;/em&gt; and an algorithm provided in the question, it is possible to implement any &lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)$&lt;/span&gt; gate with gates &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The provided algorithm is based on number theory (in particular on solving specific Diophanine equation). According to the paper &lt;em&gt;Optimal ancilla-free Clifford+T approximation of z-rotations&lt;/em&gt;, the algorithm is optimal and faster than general Solovay-Kitaev algorithm for the gate set mentioned above. So, now we can prepare any &lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Based on identities&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$X=HZH$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Y=-SXS^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{-i\frac{\theta}{2}A}=\cos\frac{\theta}{2}I-i\sin\frac{\theta}{2}A$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A \in \{X;Y;Z\}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;it can be shown that&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Rx(\theta) = HRz(\theta)H$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Ry(\theta) = S^\dagger HRz(-\theta)HS$&lt;/span&gt; (&lt;em&gt;note that &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; is not in the gate set above but it holds that &lt;span class=&quot;math-container&quot;&gt;$S^\dagger = S^3$&lt;/span&gt;&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hence, we can implement any &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; rotation with &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotation. Consequently we can create any rotation with gates &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; only.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-11T09:52:23.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12417" PostTypeId="1" CreationDate="2020-06-11T09:57:09.577" Score="1" ViewCount="62" Body="&lt;p&gt;In natural basis &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle = \begin{pmatrix} 1 \\0 \end{pmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt;, what physical situation/model does the following Hamiltonian represent: &lt;span class=&quot;math-container&quot;&gt;$H = \alpha \Big( |01 \rangle \langle10| + | 10 \rangle \langle 01| \Big)$&lt;/span&gt;?. Here, &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; has the dimensions of energy.&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="55" LastEditDate="2020-06-13T05:38:14.400" LastActivityDate="2020-06-13T05:38:14.400" Title="What is the physical meaning of the Hamiltonian $H = \alpha ( |01 \rangle \langle10| + | 10 \rangle \langle 01| )$?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;dynamics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12418" PostTypeId="2" ParentId="11888" CreationDate="2020-06-11T10:30:32.530" Score="2" Body="&lt;p&gt;&lt;strong&gt;I'm not from IBM Q development team, but here is how I understand the problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/f72f5cd5fcdc83b323685b5e4fb1f0545fc67ebd/qiskit/circuit/library/standard_gates/rz.py#L40-L44&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit's definition of &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;&lt;/a&gt; gate coincides with the conventional definition used, for example, in M. Nielsen and I. Chuang's textbook (page 174):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_z(\theta) = \begin{pmatrix} e^{-i \theta/2}  &amp;amp;0 \\ 0&amp;amp;e^{i \theta/2} \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;problem&amp;quot; is not in the &lt;strong&gt;definitions&lt;/strong&gt;, the &amp;quot;problem&amp;quot; is in the &lt;strong&gt;implementations&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Although Qiskit's implementation of &lt;code&gt;rz&lt;/code&gt; gate coincides with the &lt;code&gt;u1&lt;/code&gt; gate, the implementations of &lt;code&gt;crz&lt;/code&gt; and &lt;code&gt;cu1&lt;/code&gt; are different and coincide with the conventional definitions. Nevertheless, I think this still can cause some problems. For example, after creating a circuit with &lt;code&gt;rz&lt;/code&gt; gate in it, one may want to create a controlled version of the circuit with Qiskit's &lt;code&gt;get_controlled_circuit&lt;/code&gt; method that will not give &lt;code&gt;crz&lt;/code&gt; gate, but &lt;code&gt;cu1&lt;/code&gt;, as a result, there will be some logical errors.&lt;/p&gt;&#xA;&lt;p&gt;Here are the codes and corresponding circuits in &lt;code&gt;qasm&lt;/code&gt; format for all mentioned 4 gates&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gate:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_rz = QuantumCircuit(1)&#xA;circuit_rz.rz(1.4, 0)&#xA;circuit_rz = transpile(circuit_rz, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)&#xA;---------------------------------------------------------------------------------------------&#xA;u1(1.4) q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$cR_z$&lt;/span&gt; gate:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_crz = QuantumCircuit(2)&#xA;circuit_crz.crz(1.4, 0, 1)&#xA;circuit_crz = transpile(circuit_crz, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)&#xA;---------------------------------------------------------------------------------------------&#xA;u1(0.7) q[1];&#xA;cx q[0],q[1];&#xA;u1(-0.7) q[1];&#xA;cx q[0],q[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$u1$&lt;/span&gt; gate:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_u1 = QuantumCircuit(1)&#xA;circuit_u1.u1(1.4, 0)&#xA;---------------------------------------------------------------------------------------------&#xA;u1(1.4) q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$cu1$&lt;/span&gt; gate:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_cu1 = QuantumCircuit(2)&#xA;circuit_cu1.cu1(1.4, 0, 1)&#xA;circuit_cu1 = transpile(circuit_cu1, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)&#xA;---------------------------------------------------------------------------------------------&#xA;u1(0.7) q[0];&#xA;cx q[0],q[1];&#xA;u1(-0.7) q[1];&#xA;cx q[0],q[1];&#xA;u1(0.7) q[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-21T19:41:51.137" LastActivityDate="2020-06-21T19:41:51.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12419" PostTypeId="1" AcceptedAnswerId="12431" CreationDate="2020-06-11T11:49:44.800" Score="4" ViewCount="137" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;I don't know if my understanding of this issue is right.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-06-13T05:43:32.283" LastActivityDate="2020-06-13T05:43:32.283" Title="Do all physical architectures for quantum computers use the same universal gate sets?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;universal-gates&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12420" PostTypeId="1" AcceptedAnswerId="12424" CreationDate="2020-06-11T12:17:22.847" Score="3" ViewCount="68" Body="&lt;p&gt;I'm working on a QuantumCircuit which measures the fidelity of one point (my &quot;test vector&quot;) and two other points (my &quot;data set&quot;, containing of states &lt;code&gt;phi_1&lt;/code&gt; and &lt;code&gt;phi_2&lt;/code&gt;) &lt;strong&gt;at once&lt;/strong&gt;. I'm using &lt;a href=&quot;http://arxiv.org/abs/2003.09187&quot; rel=&quot;nofollow noreferrer&quot;&gt;Afham; Basheer, Afrad; Goyal, Sandeep (2020)&lt;/a&gt; to reproduce their circuit. My circuit right now looks as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                                          ░ ┌───┐                    ┌───┐ ░ ┌─┐   &#xA;          control_0: ─────────────────────░─┤ H ├────────────■──■──■─┤ H ├─░─┤M├───&#xA;                     ┌──────────────────┐ ░ └───┘            │  │  │ └───┘ ░ └╥┘   &#xA;state_to_classify_0: ┤0                 ├─░──────────────────X──┼──┼───────░──╫────&#xA;                     │                  │ ░                  │  │  │       ░  ║    &#xA;state_to_classify_1: ┤1 INIT TEST STATE ├─░──────────────────┼──X──┼───────░──╫────&#xA;                     │                  │ ░                  │  │  │       ░  ║    &#xA;state_to_classify_2: ┤2                 ├─░──────────────────┼──┼──X───────░──╫────&#xA;                     └──────────────────┘ ░      ┌─────────┐ │  │  │       ░  ║    &#xA;     train_states_0: ─────────────────────░──────┤0        ├─X──┼──┼───────░──╫────&#xA;                                          ░      │         │    │  │       ░  ║    &#xA;     train_states_1: ─────────────────────░──────┤1        ├────X──┼───────░──╫────&#xA;                                          ░      │  oracle │       │       ░  ║    &#xA;     train_states_2: ─────────────────────░──────┤2        ├───────X───────░──╫────&#xA;                                          ░ ┌───┐│         │               ░  ║ ┌─┐&#xA;       comp_basis_0: ─────────────────────░─┤ H ├┤3        ├───────────────░──╫─┤M├&#xA;                                          ░ └───┘└─────────┘               ░  ║ └╥┘&#xA;     meas_control_0: ═════════════════════════════════════════════════════════╩══╬═&#xA;                                                                                 ║ &#xA;  meas_comp_basis_0: ════════════════════════════════════════════════════════════╩═&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where the &lt;code&gt;INIT TEST STATE&lt;/code&gt; is used to initialise my test state on a 3-qubit register, and my &lt;code&gt;oracle&lt;/code&gt; is defined as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;                     ┌────────┐     ┌────────┐&#xA;train_states_0: ─────┤0       ├─────┤0       ├&#xA;                     │        │     │        │&#xA;train_states_1: ─────┤1 phi_0 ├─────┤1 phi_1 ├&#xA;                     │        │     │        │&#xA;train_states_2: ─────┤2       ├─────┤2       ├&#xA;                ┌───┐└───┬────┘┌───┐└───┬────┘&#xA;  comp_basis_0: ┤ X ├────■─────┤ X ├────■─────&#xA;                └───┘          └───┘          &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So that my &lt;code&gt;train_states&lt;/code&gt; 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 &lt;code&gt;qiskit.extensions.quantum_initializer.Isometry&lt;/code&gt; to initialize my registers into the desired state. If I want to test another test state, I reproduce my entire circuit. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;code&gt;INIT TEST STATE&lt;/code&gt; in such a way that I can define an example function like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def apply_new_datapoint(new_init_gate, old_circuit):&#xA;    old_circuit.data.replace(0, new_init_gate)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have no idea if the above works, but this is what I'm trying to reach eventually.&lt;/p&gt;&#xA;" OwnerUserId="12194" LastActivityDate="2020-06-12T08:42:46.617" Title="Is there a &quot;parameterized initialization&quot; that I can apply to a QuantumRegister to re-use a circuit?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;machine-learning&gt;&lt;research&gt;&lt;initialization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12422" PostTypeId="2" ParentId="4354" CreationDate="2020-06-11T14:26:11.617" Score="1" Body="&lt;p&gt;You may find some base information how D-Wave qubit is implemented in this article&#xA;&lt;a href=&quot;https://www.dwavesys.com/tutorials/background-reading-series/introduction-d-wave-quantum-hardware&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction of D-Wave hardware&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;D-Wave is not universal quantum computer and for this reason does not satisfy DiVincenzo's criteria.&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4361/does-the-d-wave-2000q-satisfy-divincenzos-criteria&quot;&gt;Related question, answer&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9456" LastActivityDate="2020-06-11T14:26:11.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12423" PostTypeId="2" ParentId="12420" CreationDate="2020-06-11T15:17:00.277" Score="1" Body="&lt;p&gt;John Preskill identified the bottleneck you described as a fundamental problem in quantum deep learning (section 6.5, &lt;a href=&quot;https://arxiv.org/abs/1801.00862&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).  In particular,&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;But typical proposals for quantum machine learning applications are&#xA;  confounded by severe input/output bottlenecks. For applications to&#xA;  large classical data sets one should take into account the cost of&#xA;  encoding the input into QRAM, which can nullify the potential&#xA;  advantages.... These bottlenecks arise when we try to train a quantum&#xA;  network to learn about correlations in classical data.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-06-11T15:17:00.277" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12424" PostTypeId="2" ParentId="12420" CreationDate="2020-06-11T16:07:08.190" Score="2" Body="&lt;p&gt;There is no replace() method, but you can do the trick by means of pop() and insert().&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;from qiskit.extensions.standard import XGate&#xA;&#xA;simulator = Aer.get_backend(&quot;qasm_simulator&quot;)&#xA;&#xA;qc = QuantumCircuit(4,4)&#xA;qc.h([0,1,2,3])&#xA;qc.measure([0,1,2,3], [0,1,2,3])&#xA;print(qc.draw())&#xA;result = execute(qc, backend=simulator, shots=1000).result()&#xA;counts = result.get_counts(qc)&#xA;print(&quot;\nTotal counts:&quot;,counts)&#xA;&#xA;qc.data.pop(0)&#xA;qc.data.insert(0,(XGate(),[qc.qregs[0][0]],[]))&#xA;print(qc.draw())&#xA;result = execute(qc, backend=simulator, shots=1000).result()&#xA;counts = result.get_counts(qc)&#xA;print(&quot;\nTotal counts:&quot;,counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-12T08:42:46.617" LastActivityDate="2020-06-12T08:42:46.617" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12425" PostTypeId="2" ParentId="12368" CreationDate="2020-06-11T16:21:14.447" Score="1" Body="&lt;p&gt;Here's how you can use &lt;code&gt;statevector_simulator&lt;/code&gt; to get an &lt;strong&gt;exact&lt;/strong&gt; answer:&lt;/p&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit, execute, Aer&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;# Use Aer's statevector_simulator&#xA;simulator = Aer.get_backend(&quot;statevector_simulator&quot;)&#xA;&#xA;# Create a Quantum Circuit acting on the q register&#xA;circuit = QuantumCircuit(2, 2)&#xA;&#xA;# Add a H gate on qubit 0&#xA;circuit.h(0)&#xA;&#xA;# Add a CX (CNOT) gate on control qubit 0 and target qubit 1&#xA;circuit.cx(0, 1)&#xA;&#xA;# Execute the circuit on the qasm simulator&#xA;job = execute(circuit, simulator)&#xA;&#xA;# Grab results from the job&#xA;result = job.result()&#xA;&#xA;out_state = result.get_statevector()&#xA;print([abs(q ** 2) for q in out_state])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Running this prints:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[0.5000000000000001, 0.0, 0.0, 0.4999999999999999]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So 00 occurred 50% of the time, and 11 occurred 50% of the time. The minor error is due to floating point rounding.&lt;/p&gt;&#xA;" OwnerUserId="12262" LastActivityDate="2020-06-11T16:21:14.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12427" PostTypeId="2" ParentId="12369" CreationDate="2020-06-11T18:39:59.690" Score="1" Body="&lt;p&gt;I have not found such functionality in Qiskit. However, one can use the &lt;code&gt;openfermion&lt;/code&gt; function &lt;code&gt;openfermion.transforms._encoder_bk()&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def _encoder_bk(n_modes):&#xA;    &quot;&quot;&quot; Helper function for bravyi_kitaev_code that outputs the binary-tree&#xA;    (dimension x dimension)-matrix used for the encoder in the&#xA;    Bravyi-Kitaev transform.&#xA;&#xA;    Args:&#xA;    n_modes (int): length of the matrix, the dimension x dimension&#xA;&#xA;    Returns (numpy.ndarray): encoder matrix&#xA;    &quot;&quot;&quot;&#xA;    reps = int(numpy.ceil(numpy.log2(n_modes)))&#xA;    mtx = numpy.array([[1, 0], [1, 1]])&#xA;    for repetition in numpy.arange(1, reps + 1):&#xA;        mtx = numpy.kron(numpy.eye(2, dtype=int), mtx)&#xA;        for column in numpy.arange(0, 2 ** repetition):&#xA;            mtx[2 ** (repetition + 1) - 1, column] = 1&#xA;    return mtx[0:n_modes, 0:n_modes]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;With the aid of this function, one constructs the JW → BK circuit as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;def jw_to_bk_circuit_qiskit(n):&#xA;    &quot;&quot;&quot;&#xA;    Creates a Qiskit circuit which performs the JW -&amp;gt; BK transformation on qubits.&#xA;    One needs this function to prepare initial states when using BK encoding.&#xA;    :param n: Number of qubits.&#xA;    :return:&#xA;    &quot;&quot;&quot;&#xA;&#xA;    # Initializing qubits:&#xA;    qc = qiskit.QuantumCircuit( n )&#xA;&#xA;    # JW-&amp;gt;BK encoder (lower-triangluar!) matrix&#xA;    bk_encoder = openfermion.transforms._encoder_bk( n )&#xA;    # print(bk_encoder)&#xA;    # Matrix multiplication mod 2 using CNOTs (starting from the bottom row)&#xA;    for i in reversed( range( 1, n ) ):&#xA;        for j in range( i  ):&#xA;            if bk_encoder[i, j] == 1:&#xA;                qc.cx(j,i)&#xA;&#xA;    return qc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Not that it is crucial to perform the matrix multiplication using CNOTs &lt;strong&gt;starting from the bottom row&lt;/strong&gt;, since the encoder matrix is lower-triangular.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2020-06-11T18:39:59.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12428" PostTypeId="2" ParentId="4354" CreationDate="2020-06-11T18:53:40.083" Score="2" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="12140" LastActivityDate="2020-06-11T18:53:40.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12429" PostTypeId="1" AcceptedAnswerId="12430" CreationDate="2020-06-11T22:45:46.383" Score="0" ViewCount="345" Body="&lt;p&gt;I'm having trouble running the following cell:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fVtPz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fVtPz.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The system told me &quot;The 'ibmq_qasm_simulator' backend is not installed in your system.&quot; I'm so confused. Is there a way I can install this backend in my system? Thanks!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OkLdv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OkLdv.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2020-06-13T05:49:50.740" LastActivityDate="2020-06-13T05:49:50.740" Title="How can I install the 'ibmq_qasm_simulator' backend?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12430" PostTypeId="2" ParentId="12429" CreationDate="2020-06-11T22:48:44.150" Score="2" Body="&lt;p&gt;The ibmq_qasm_simulator is a cloud-based simulator. You need to say&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;provider = IBMQ.load_account()&#xA;sim = provider.backends.ibmq_qasm_simulator&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-06-11T22:48:44.150" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12431" PostTypeId="2" ParentId="12419" CreationDate="2020-06-12T03:51:02.137" Score="6" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1603.07678.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. As a result we have a full universal set. The only difference for the SC gate sets would be a different decomposition of CNOT.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="3056" LastEditDate="2020-06-12T17:17:13.830" LastActivityDate="2020-06-12T17:17:13.830" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12432" PostTypeId="1" CreationDate="2020-06-12T09:45:12.353" Score="2" ViewCount="34" Body="&lt;p&gt;This question is about the effect of available information on random quantum channels.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Suppose there are two black box devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Device 1&lt;/strong&gt;.&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\rho \to (1-p) I \rho I^\dagger + p  X \rho X^\dagger$&lt;/span&gt;, with certainty. Here &lt;span class=&quot;math-container&quot;&gt;$p \in (0,1)$&lt;/span&gt;. No measurement takes place after this device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Device 2.&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$q \in (0,1)$&lt;/span&gt;. Once we turn this device on, the device flips the coin internally, and therefore thus executes either &lt;span class=&quot;math-container&quot;&gt;$\rho \to \rho$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho \to X \rho X^\dagger$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1-q$&lt;/span&gt;. No measurement takes place after this device.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;We haven't yet&lt;/em&gt; but are about to turn on both devices.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 1.&lt;/strong&gt; Suppose we &lt;em&gt;will&lt;/em&gt; be informed of the outcome of the coin flip. If &lt;span class=&quot;math-container&quot;&gt;$p = q$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question 2.&lt;/strong&gt; Suppose we &lt;em&gt;will not&lt;/em&gt; be informed of the outcome of the coin flip. What would be the answer now?&lt;/p&gt;&#xA;" OwnerUserId="12339" LastActivityDate="2020-06-12T10:53:07.440" Title="The effect of available information on random quantum channels" Tags="&lt;quantum-gate&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12433" PostTypeId="2" ParentId="12432" CreationDate="2020-06-12T10:53:07.440" Score="1" Body="&lt;p&gt;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 &lt;em&gt;subjective&lt;/em&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-12T10:53:07.440" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12434" PostTypeId="2" ParentId="12279" CreationDate="2020-06-12T11:23:32.097" Score="1" Body="&lt;p&gt;As far as I understand from the paper, eq. (13) gives &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt; as a product of two qubit unitaries, independently of &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt;. Then the authors present two cases, subset parity and subset majority, and derive their specific &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt;. Thus I guess your classification problem will need its own specialization of eq. (13). If you get an acceptable accuracy with the subset parity &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-13T09:20:40.867" LastActivityDate="2020-06-13T09:20:40.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12435" PostTypeId="1" AcceptedAnswerId="12437" CreationDate="2020-06-12T12:40:10.850" Score="2" ViewCount="74" Body="&lt;p&gt;Concerning the Von Neumann Entropy &lt;span class=&quot;math-container&quot;&gt;$S(\rho) = H(pi) + \sum_{i}p_{i}S(\rho_{i})$&lt;/span&gt;, under what circumstances does &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}piS(\rho_{i})$&lt;/span&gt; become greater than 0? I am aware it occurs when &lt;span class=&quot;math-container&quot;&gt;$\rho_{i}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; itself is? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:45.913" LastActivityDate="2020-10-08T17:54:45.913" Title="Under what situation is $\sum_{i} p_{i}S(\rho_i)$ &gt; 0" Tags="&lt;entanglement&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12436" PostTypeId="1" CreationDate="2020-06-12T14:56:32.460" Score="1" ViewCount="40" Body="&lt;p&gt;I have already read through the answers &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1937/why-is-it-crucial-that-the-initial-hamiltonian-does-not-commute-with-the-final-h&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I understand that if the Hamiltonians commute, then they have the same eigenstates but not necessarily the same energy eigenvalues. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To formulate my question (skip to last paragraph if you prefer), we have the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; with known lowest energy eigenstate &lt;span class=&quot;math-container&quot;&gt;$|\psi_{B_0}\rangle$&lt;/span&gt; and corresponding energy eigenvalue &lt;span class=&quot;math-container&quot;&gt;$E_{B_0}$&lt;/span&gt;. Then our time-depenent Hamiltonian is&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(t) = (1-\alpha(t))H_B + \alpha(t) H_C&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; is the problem Hamiltonian with lowest energy eigenstate &lt;span class=&quot;math-container&quot;&gt;$|\psi_{C_0}\rangle$&lt;/span&gt; and corresponding energy eigenvalue &lt;span class=&quot;math-container&quot;&gt;$E_{C_0}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\alpha \in [0,1]$&lt;/span&gt; is a time varying function that gradually moves from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As I understand, if &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; don't commute, then &lt;span class=&quot;math-container&quot;&gt;$|\psi_{B_0}\rangle$&lt;/span&gt; is an eigenstate of both of them, and therefore also of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. So the state won't evolve out of &lt;span class=&quot;math-container&quot;&gt;$|\psi_{B_0}\rangle$&lt;/span&gt;, and we aren't guaranteed that it is equal to &lt;span class=&quot;math-container&quot;&gt;$|\psi_{C_0}\rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Here's my question&lt;/strong&gt;. As I said we aren't &lt;em&gt;guaranteed&lt;/em&gt; that &lt;span class=&quot;math-container&quot;&gt;$|\psi_{B_0}\rangle = |\psi_{C_0}\rangle$&lt;/span&gt;. But does that mean that we are sure &lt;span class=&quot;math-container&quot;&gt;$|\psi_{B_0}\rangle \neq |\psi_{C_0}\rangle$&lt;/span&gt;? Are there situations where &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; commute and we can know in advance that &lt;span class=&quot;math-container&quot;&gt;$|\psi_{B_0}\rangle = |\psi_{C_0}\rangle$&lt;/span&gt; and can do QAA anyway?&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="10485" LastEditDate="2020-06-12T15:01:38.423" LastActivityDate="2020-06-12T15:01:38.423" Title="Is it absolutely necessary for Hamiltonians to not commute in QAA?" Tags="&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12437" PostTypeId="2" ParentId="12435" CreationDate="2020-06-12T15:00:05.417" Score="4" Body="&lt;p&gt;&lt;strong&gt;Mathematically when is &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i S(\rho_i) &amp;gt; 0$&lt;/span&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am assuming that &lt;span class=&quot;math-container&quot;&gt;$\{p_i\}$&lt;/span&gt; form a probability distribution (and that none of the &lt;span class=&quot;math-container&quot;&gt;$p_i = 0$&lt;/span&gt;) and each &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; is a normalised state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As &lt;span class=&quot;math-container&quot;&gt;$p_i \geq 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i) \geq 0$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i S(\rho_i) = 0 \iff S(\rho_i) = 0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. Then we can ask the question under what circumstances do we have that each &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i) = 0$&lt;/span&gt;. But a state &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i) = 0 \iff \rho_i$&lt;/span&gt; is a pure state. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see this let &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_x\}_x$&lt;/span&gt; be the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt;. We can then compute &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i) = - \sum_x \lambda_x \log \lambda_x$&lt;/span&gt;. Now as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a positive semi-definite matrix we have for each &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_x \geq 0$&lt;/span&gt; and as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is normalized we have &lt;span class=&quot;math-container&quot;&gt;$ \sum_x \lambda_x = 1$&lt;/span&gt;. Putting these two constraints together we must have that for each &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0 \leq \lambda_x \leq 1$&lt;/span&gt;. This means that for each term in the sum we have &lt;span class=&quot;math-container&quot;&gt;$- \lambda_x \log \lambda_x \geq 0$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$-\sum_x \lambda_x \log \lambda_x = 0 \iff -\lambda_x \log \lambda_x = 0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. But &lt;span class=&quot;math-container&quot;&gt;$- \lambda_x \log \lambda_x = 0 \iff \lambda_x \in \{0,1\}$&lt;/span&gt;. Combining this with the fact that we need &lt;span class=&quot;math-container&quot;&gt;$\sum_x \lambda_x = 1$&lt;/span&gt; we must have exactly one &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$\lambda_x = 1$&lt;/span&gt; and the rest must vanish. Finally, if &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; is a state with a single nonzero eigenvalue then it is a pure state. Hence &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i) = 0 \implies \rho_i $&lt;/span&gt; is pure. The other direction follows readily. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;tl;dr &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i S(\rho_i) &amp;gt; 0 \iff \exists i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$p_i&amp;gt;0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; is not pure.  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = |\psi \rangle \langle \psi |$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\psi = \tfrac{1}{\sqrt{2}}(|00\rangle + |11 \rangle)$&lt;/span&gt;. Suppose we measure on the first system the POVM &lt;span class=&quot;math-container&quot;&gt;$\{M, \mathbb{I} - M\}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$M = \frac{\mathbb{I} + \gamma \sigma_z}{2}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\gamma \in [0,1]$&lt;/span&gt; is some parameter and &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; is the Pauli z operator. The &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; parameter is sometimes referred to as the strength/sharpness of the measurement. When &lt;span class=&quot;math-container&quot;&gt;$\gamma = 1$&lt;/span&gt; the measurement is projective and when &lt;span class=&quot;math-container&quot;&gt;$\gamma = 0$&lt;/span&gt; the measurement is trivial (doesn't interact with the system). Labelling the measurement outcomes &lt;span class=&quot;math-container&quot;&gt;$0,1$&lt;/span&gt; respectively we get outcome &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_0 = \mathrm{Tr}[(M^{1/2} \otimes \mathbb{I}) \rho_{AB} (M^{1/2} \otimes \mathbb{I})]&#xA;$$&lt;/span&gt;&#xA;and &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_1 = \mathrm{Tr}[((\mathbb{I}-M)^{1/2} \otimes \mathbb{I}) \rho_{AB} ((\mathbb{I}-M)^{1/2} \otimes \mathbb{I})].&#xA;$$&lt;/span&gt;&#xA;Similarly the normailised state on system B after receiving outcome &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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})]}&#xA;$$&lt;/span&gt;&#xA;and on outcome &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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})]}.&#xA;$$&lt;/span&gt;&#xA;We can represent the correlations between system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and the outcome of our measurement on system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; by some cq-state &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{A'B} = p_0 |0\rangle\langle 0 | \otimes \rho_B(0) + p_1 |1\rangle\langle 1 | \otimes \rho_B(1). &#xA;$$&lt;/span&gt;&#xA;The entropy of this state is &#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho_{A'B}) = H(\{p_i\}) + \sum_i p_i S(\rho_B(i)),&#xA;$$&lt;/span&gt;&#xA;like in your question. Now for the particular state we picked we can calculate the eigenvalues of both &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\{(1+\gamma)/2, (1-\gamma)/2\}$&lt;/span&gt;. So we see our states are pure only when &lt;span class=&quot;math-container&quot;&gt;$\gamma = 1$&lt;/span&gt;. Note that this is exactly when the measurement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$S(A'|B) = S(A'B) - S(B)$&lt;/span&gt;. &lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-06-12T16:07:08.230" LastActivityDate="2020-06-12T16:07:08.230" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="12438" PostTypeId="1" CreationDate="2020-06-12T15:15:50.223" Score="2" ViewCount="61" Body="&lt;p&gt;I understand that every Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be decomposed into two mutually orthogonal subspaces &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; whose direct sum is &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, every vector &lt;span class=&quot;math-container&quot;&gt;$v\in H$&lt;/span&gt; can be decomposed into &lt;span class=&quot;math-container&quot;&gt;$v_1\in H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_2\in H_2$&lt;/span&gt; such that direct sum of &lt;span class=&quot;math-container&quot;&gt;$v_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v_2$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I just want to see the mathematical procedure for an arbitrary quantum state.&lt;/p&gt;&#xA;" OwnerUserId="12342" LastEditorUserId="10480" LastEditDate="2021-01-27T02:54:39.597" LastActivityDate="2021-01-27T03:09:55.103" Title="How do you decompose an arbitrary quantum state into its corresponding projection subspaces such that their direct sum is the quantum state?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12439" PostTypeId="1" CreationDate="2020-06-12T15:48:38.343" Score="5" ViewCount="298" Body="&lt;p&gt;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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/222Zd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/222Zd.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12344" LastEditorUserId="55" LastEditDate="2020-06-13T05:39:48.753" LastActivityDate="2020-06-13T05:39:48.753" Title="Procedures and intuition for designing simple quantum circuits?" Tags="&lt;circuit-construction&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12440" PostTypeId="2" ParentId="12439" CreationDate="2020-06-12T16:49:33.530" Score="4" Body="&lt;p&gt;Here are the actions for the given transformation on the computational basis states:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle \rightarrow |000\rangle \qquad |001\rangle \rightarrow |010\rangle \qquad |010\rangle \rightarrow |011\rangle \qquad |011\rangle \rightarrow |100\rangle &#xA;\\&#xA;|100\rangle \rightarrow |101\rangle \qquad |101\rangle \rightarrow |110\rangle \qquad |110\rangle \rightarrow |111\rangle \qquad |111\rangle \rightarrow |001\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let's label the qubits in this format: &lt;span class=&quot;math-container&quot;&gt;$|q_2 q_1 q_0 \rangle$&lt;/span&gt; (Qiskit's labeling). Here are some ideas. &lt;span class=&quot;math-container&quot;&gt;$|001\rangle \rightarrow |010\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |010\rangle \rightarrow |011\rangle$&lt;/span&gt; transformations can be done with &lt;code&gt;CNOT(0, 1)&lt;/code&gt; and &lt;code&gt;CNOT(1, 0)&lt;/code&gt; gates. &lt;span class=&quot;math-container&quot;&gt;$|011\rangle \rightarrow |100\rangle$&lt;/span&gt; transformation can be done by adding &lt;code&gt;Toffali(0, 1, 2)&lt;/code&gt; before the two CNOTs presented above and adding &lt;code&gt;CNOT(2, 0)&lt;/code&gt; after the two CNOTs. &lt;span class=&quot;math-container&quot;&gt;$|110\rangle \rightarrow |111\rangle$&lt;/span&gt; transformation can be done with &lt;code&gt;Toffali(2, 1, 0)&lt;/code&gt;.  With this ideas we can construct the circuit (the ordering is important, but can be changed in some places):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/WyvtU.png&quot; width=&quot;400&quot; /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For checking the correctness of the circuit we can try to give different inputs to the circuit and check the outputs &lt;strong&gt;or&lt;/strong&gt; we can do matrix multiplications and see if the final matrix will be equal to the given matrix &lt;strong&gt;or&lt;/strong&gt; we can use tools from Qiskit:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;import qiskit.quantum_info as qi&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;&#xA;circuit.ccx(0, 1, 2)&#xA;circuit.cx(0, 1)&#xA;circuit.cx(1, 0)&#xA;circuit.cx(2, 0)&#xA;circuit.ccx(2, 1, 0)&#xA;&#xA;matrix = qi.Operator(circuit)&#xA;print(matrix.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The output:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;[[1 0 0 0 0 0 0 0]&#xA; [0 0 0 0 0 0 0 1]&#xA; [0 1 0 0 0 0 0 0]&#xA; [0 0 1 0 0 0 0 0]&#xA; [0 0 0 1 0 0 0 0]&#xA; [0 0 0 0 1 0 0 0]&#xA; [0 0 0 0 0 1 0 0]&#xA; [0 0 0 0 0 0 1 0]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-12T17:23:34.760" LastActivityDate="2020-06-12T17:23:34.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12441" PostTypeId="1" CreationDate="2020-06-12T17:00:35.873" Score="1" ViewCount="69" Body="&lt;p&gt;I need to manipulate phases in 2 qubits.  I will eventually create 34 distinct phase sets to map to an alphabet I built.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see &lt;a href=&quot;https://github.com/oreilly-qc/oreilly-qc.github.io/blob/master/samples/Qiskit/ch07_08_qft_rotating_phases.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/oreilly-qc/oreilly-qc.github.io/blob/master/samples/Qiskit/ch07_08_qft_rotating_phases.py&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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)?:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As the letters change, so will each phase in each qubit.  Any help appreciated.    Here is the first &quot;letter&quot; (&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pNO54.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pNO54.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12346" LastEditorUserId="55" LastEditDate="2020-06-13T05:44:23.447" LastActivityDate="2020-06-13T05:44:23.447" Title="Example of Simple phase Change Using 2 Qubits" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;textbook-and-exercises&gt;" AnswerCount="0" CommentCount="8" ClosedDate="2020-06-18T08:29:01.503" ContentLicense="CC BY-SA 4.0" />
  <row Id="12442" PostTypeId="2" ParentId="12413" CreationDate="2020-06-12T20:03:11.723" Score="2" Body="&lt;p&gt;To get a quantum gate with single photons, you need something of the form:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(|0\rangle+e^{i*0}|1\rangle)|1\rangle \rightarrow (|0\rangle+e^{i\pi}|1\rangle)|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;nonlinear&quot; interaction where one photon sort-of &quot;pushes&quot; 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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2020-06-12T20:03:11.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12443" PostTypeId="2" ParentId="12439" CreationDate="2020-06-12T21:37:20.137" Score="5" Body="&lt;p&gt;Here are two 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;A) Work up in stages from a classical circuit&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;B) Fix one state at a time, without breaking previous states&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pick the first input that is being sent to the wrong output. For example, &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt; staying fixed instead of becoming &lt;span class=&quot;math-container&quot;&gt;$|010\rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;C) Recognize approximate patterns&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;each entry shifted down by one&quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-06-12T21:37:20.137" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12444" PostTypeId="2" ParentId="12417" CreationDate="2020-06-12T22:24:07.140" Score="1" Body="&lt;p&gt;I'm not sure for this specific problem, and more broadly Hamiltonians are typically in the &quot;eye of the beholder.&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, for quantum chemistry problems, Hamiltonians are really clean mappings from problems that were originally in quantum chemistry. For example, there are &quot;annihilation/creation operators&quot; (discussed more &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/10065/what-is-the-correct-sign-in-the-unitary-evolution-operator-of-a-beam-splitter/10068#10068&quot;&gt;here&lt;/a&gt;) that could be converted into quantum simulation problems through the Jordan-Wigner Transforms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a^{\dagger} = \frac{X + i Y}{2},  a = \frac{X - i Y}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even though &lt;span class=&quot;math-container&quot;&gt;$ a^{\dagger}, a $&lt;/span&gt; aren't unitary, we can exponentiate the transformations:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{a^{\dagger} + a} = e^{1/2}e^{X + iY} e^{1/2}e^{X - iY} + O(*)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Where &lt;span class=&quot;math-container&quot;&gt;$O(*)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$a^{\dagger}, a$&lt;/span&gt; were not.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-06-12T22:24:07.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12445" PostTypeId="1" CreationDate="2020-06-13T01:05:51.657" Score="3" ViewCount="66" Body="&lt;p&gt;I was reading over the proof of the Deutsch-Jozsa algorithm, which in its simplest case, involves at least 2 qubits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an example of a quantum algorithm that is better than it's classical counterpart which only involves a single qubit?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If not, could you provide an explanation of why such an algorithm cannot exist?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thank you very much. I have only recently started my journey into quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="12347" LastEditorUserId="55" LastEditDate="2020-06-13T05:33:58.473" LastActivityDate="2020-06-18T05:45:10.773" Title="Example of a quantum algorithm better than its classical counterpart which involves only $1$ qubit?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;quantum-state&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;classical-quantum&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12446" PostTypeId="2" ParentId="12445" CreationDate="2020-06-13T01:13:06.300" Score="5" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://random.org&quot; rel=&quot;noreferrer&quot;&gt;random.org&lt;/a&gt; for more stuff on randomness!)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Seriously, though, to take advantage of constructive interference, you'll need amplitudes over different bitstrings to constructively interfere. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Great question!&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-06-13T01:13:06.300" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12447" PostTypeId="1" CreationDate="2020-06-13T01:48:59.630" Score="1" ViewCount="41" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6HrhD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6HrhD.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user12136" LastEditorUserId="55" LastEditDate="2020-06-13T05:31:52.717" LastActivityDate="2020-06-13T05:31:52.717" Title="Equality comparator for two qubits each" Tags="&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12448" PostTypeId="1" AcceptedAnswerId="12449" CreationDate="2020-06-13T04:00:12.567" Score="1" ViewCount="453" Body="&lt;p&gt;I have looked at the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5125/what-is-the-difference-between-a-relative-phase-and-a-global-phase-in-particula&quot;&gt;What is the difference between a relative phase and a global phase? In particular, what is a phase?&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/257824/global-and-relative-phases-of-kets-in-qm&quot;&gt;Global and relative phases of kets in QM&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/401523/global-phases-and-indistinguishable-quantum-states-mathematical-understanding&quot;&gt;Global phases and indistinguishable quantum states, mathematical understanding&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If two states differ by a scalar of magnitude of 1, then they are indistinguishable. Consider:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\vert \psi_1 \rangle &amp;amp;= \dfrac{1}{\sqrt{2}} \vert 0 \rangle + \dfrac{i}{\sqrt{2}} \vert 1 \rangle\\&#xA;\vert \psi_2 \rangle &amp;amp;= \color{red}{i}\left(\dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle\right).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Which of the following is true about &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle = \vert \psi_2 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle \neq \dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle = \dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$&lt;/span&gt; up to global phase.&lt;/li&gt;&#xA;&lt;li&gt;If we just ignore the global phase in &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_2 \rangle$&lt;/span&gt; and only deal with &lt;span class=&quot;math-container&quot;&gt;$\dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$&lt;/span&gt; , do we still have the state vector on a Bloch sphere yields the same projection as &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_1 \rangle$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Lastly, since the global phase is not physically observable, is it mathematically evident?&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="55" LastEditDate="2020-06-13T05:30:27.443" LastActivityDate="2020-06-13T06:33:55.973" Title="Understanding global phase" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12449" PostTypeId="2" ParentId="12448" CreationDate="2020-06-13T05:16:56.407" Score="1" Body="&lt;p&gt;1) So &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle \neq |\psi_2\rangle$&lt;/span&gt;, but it effectively is since they give the exact same distributions for any measurement in any basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;2) Same discussion as above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;3) True&lt;/p&gt;&#xA;&#xA;&lt;p&gt;4) States in the Bloch sphere are of the form&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) is on the Bloch sphere.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You cannot measure the global phase. Phases are only relevant when they are relative, and consequently affect superpositions/measurements.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastEditorUserId="9006" LastEditDate="2020-06-13T06:33:55.973" LastActivityDate="2020-06-13T06:33:55.973" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12450" PostTypeId="1" AcceptedAnswerId="12451" CreationDate="2020-06-13T05:38:48.710" Score="2" ViewCount="83" Body="&lt;p&gt;I have been given a LittleEndian register. I want to know the following things:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How many bits there are in the LittleEndian?&lt;/li&gt;&#xA;&lt;li&gt;How to convert the LittleEndian into a Qubit[] Array.&lt;/li&gt;&#xA;&lt;li&gt;How to access individual qubits of LittleEndian?&lt;/li&gt;&#xA;&lt;li&gt;How to apply simple and controlled gates onto individual qubits of LittleEndian?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="55" LastEditDate="2020-06-13T17:51:51.883" LastActivityDate="2020-06-13T17:51:51.883" Title="How to apply a gate to a LittleEndian in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12451" PostTypeId="2" ParentId="12450" CreationDate="2020-06-13T06:03:00.037" Score="3" Body="&lt;p&gt;The &lt;code&gt;LittleEndian&lt;/code&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is no fixed number of bits in a &lt;code&gt;LittleEndian&lt;/code&gt;, it only documents that the least significant bit of a register is index 0 (on the left).&lt;/li&gt;&#xA;&lt;li&gt;If you want to get back just the register not wrapped in the &lt;code&gt;LittleEndian&lt;/code&gt; type, you can use the &lt;a href=&quot;https://docs.microsoft.com/quantum/user-guide/language/expressions#unwrap-expressions&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;!&lt;/code&gt; operator&lt;/a&gt; like this:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (register = LittleEndian(Qubit[3]) {&#xA;    ResetAll(register!);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Similar to #2 if you us &lt;code&gt;!&lt;/code&gt; to unwrap the &lt;code&gt;LittleEndian&lt;/code&gt; type you can then index it like normal.&lt;/li&gt;&#xA;&lt;li&gt;Same as #3, just unwrap the type and you should be able to do the gates as you would regularly. The &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/language/types#operation-and-function-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;controlled functor&lt;/a&gt; may be of use to you. &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;I also have a &lt;a href=&quot;https://livebook.manning.com/book/learn-quantum-computing-with-python-and-q-sharp/chapter-8/section-8-2?origin=product-toc&quot; rel=&quot;nofollow noreferrer&quot;&gt;section in my book&lt;/a&gt; that talks about how to use UDTs or User Defined Types which &lt;code&gt;LittleEndian&lt;/code&gt; is an example of (provided by the &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/libraries/numerics/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Numerics library&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="4211" LastActivityDate="2020-06-13T06:03:00.037" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12452" PostTypeId="1" CreationDate="2020-06-13T06:14:52.767" Score="4" ViewCount="144" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;To compute the expectation value&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I can use the definition of expectation value &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|O|\psi\rangle$&lt;/span&gt; to achieve this computation as follows:  &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a copy of the given state vector &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, &lt;strong&gt;apply the observable to the required qubit&lt;/strong&gt; to obtain &lt;span class=&quot;math-container&quot;&gt;$O|\psi\rangle$&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Calculate the inner product of the state calculated in 1 with the conjugate transpose of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that is &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|O|\psi\rangle$&lt;/span&gt;.  &lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Is the method for computing the expectation values correct ?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;For computing the variance&lt;/strong&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm thinking of using the following definition:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Variance}(O) = \text{Expectation}(O^2) - \text{Expectation}(O)^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I understand correctly, I need to compute the following two quantities:  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;a. &lt;span class=&quot;math-container&quot;&gt;$\text{Expectation}(O)^2$&lt;/span&gt;: This is simply the square of the expectation value that I can calculate using the method stated earlier.&lt;br&gt;&#xA; b. &lt;span class=&quot;math-container&quot;&gt;$\text{Expectation}(O^2)$&lt;/span&gt;: 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 &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\psi\rangle$&lt;/span&gt; (which should be 1 since my state is normalized).&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is this correct?&lt;/li&gt;&#xA;&lt;li&gt;Is there a better (more efficient) way to accomplish this?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12349" LastEditorUserId="55" LastEditDate="2020-06-13T18:02:59.423" LastActivityDate="2020-06-13T18:02:59.423" Title="Computing variance under the action of a unitary operator" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12453" PostTypeId="2" ParentId="12452" CreationDate="2020-06-13T08:21:08.280" Score="1" Body="&lt;p&gt;&lt;strong&gt;Calculating the expectation value for a specific Hermitian operator&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis&quot;&gt;1&lt;/a&gt;])&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = a \cdot \sigma_z \otimes I + b \cdot\sigma_y \otimes \sigma_y + c \cdot\sigma_x \otimes I, $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a,b,c$&lt;/span&gt; are real numbers. The expectation value of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, finding the expectation value of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/9192/9459&quot;&gt;2&lt;/a&gt;] (or here [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10173/9459&quot;&gt;3&lt;/a&gt;]). It is not our case, because our Pauli terms do not commute with each other.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = c_0 |0 \rangle + c_1| 1 \rangle = c_+ | + \rangle + c_-| - \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;s are complex numbers, &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt; are eigenbasis for &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+ \rangle = \frac{1}{\sqrt{2}}(|0 \rangle + | 1 \rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| - \rangle = \frac{1}{\sqrt{2}}(|0 \rangle - | 1 \rangle)$&lt;/span&gt; are eigenbasis for &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;. For the two-qubit case, we can use Bell basis that is also an eigenbasis for &lt;span class=&quot;math-container&quot;&gt;$\sigma_y \otimes \sigma_y$&lt;/span&gt; [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/9192/9459&quot;&gt;2&lt;/a&gt;], [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10118/9459&quot;&gt;4&lt;/a&gt;]&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle = c_{\Phi^+}|\Phi^+\rangle + c_{\Phi^-}|\Phi^-\rangle + c_{\Psi^+}|\Psi^+\rangle + c_{\Psi^-}|\Psi^-\rangle &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Phi^-\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle$&lt;/span&gt; are Bell states. By taking this into account we can obtain:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi| \sigma_z | \psi \rangle = |c_0|^2 - |c_1|^2&#xA;\\&#xA;\langle \psi| \sigma_x | \psi \rangle = |c_+|^2 - |c_-|^2&#xA;\\&#xA;\langle \psi| \sigma_y \otimes \sigma_y | \psi \rangle = -|c_{\Phi^+}|^2 + |c_{\Phi^-}|^2 + |c_{\Psi^+}|^2 - |c_{\Psi^-}|^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&quot;+&quot; and &quot;-&quot; sign comes from &lt;span class=&quot;math-container&quot;&gt;$P |\lambda \rangle = \pm |\lambda \rangle$&lt;/span&gt; for a Pauli term &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; with correspoding eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\lambda \rangle$&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$|c_0|^2 = \frac{N_0}{N}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|c_1|^2 = \frac{N_1}{N}$&lt;/span&gt; for big enough &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of the measurements, &lt;span class=&quot;math-container&quot;&gt;$N_0$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; measurements, &lt;span class=&quot;math-container&quot;&gt;$N_1$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; measurements. The same for &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$|c_+|^2 = \frac{N_+}{N}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|c_-|^2 = \frac{N_-}{N}$&lt;/span&gt; for big enough &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N_+$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; measurements, &lt;span class=&quot;math-container&quot;&gt;$N_-$&lt;/span&gt; is the number of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; Pauli term this problem can be overcomed by applying such &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; unitary operator before the &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; (default) measurements (like was presented here [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11789/9459&quot;&gt;5&lt;/a&gt;]), that:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi |P| \psi \rangle = \langle \psi | U^{\dagger} \sigma_z \otimes \sigma_z \otimes ...\otimes \sigma_z U | \psi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that in the product &lt;span class=&quot;math-container&quot;&gt;$\sigma_z \otimes \sigma_z \otimes ...\otimes \sigma_z$&lt;/span&gt; in some places we can have &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;: it just means that we will not do any measurement for the corresponding qubit. For &lt;span class=&quot;math-container&quot;&gt;$P = \sigma_x$&lt;/span&gt; this can be done with &lt;span class=&quot;math-container&quot;&gt;$U = H$&lt;/span&gt; gate. For &lt;span class=&quot;math-container&quot;&gt;$\sigma_y \otimes \sigma_y$&lt;/span&gt; we can take &lt;span class=&quot;math-container&quot;&gt;$U = (H\otimes I) CNOT$&lt;/span&gt; [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/9192/9459&quot;&gt;2&lt;/a&gt;], [&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10118/9459&quot;&gt;4&lt;/a&gt;].&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The same can be done for &lt;span class=&quot;math-container&quot;&gt;$H^2$&lt;/span&gt; because it is also a Hermitian operator and hence &lt;strong&gt;with this method, we will be able also to calculate the variance of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-13T11:36:14.847" LastActivityDate="2020-06-13T11:36:14.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12454" PostTypeId="1" AcceptedAnswerId="12456" CreationDate="2020-06-13T09:16:06.847" Score="2" ViewCount="50" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;Suppose we have a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_{x∈\{0,1\}^n}\alpha_x |x\rangle$&lt;/span&gt;,and we measure the first qubit of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the computational basis.  What is the probability that the measurement outcome is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, in terms of the &lt;span class=&quot;math-container&quot;&gt;$\alpha_x $&lt;/span&gt; coefficients?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'm not quite sure how to approach this. Usually the computational basis is &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt; and I'm not sure what ket I am meant to apply to the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm also not sure what matrix I need to use to do the measurement.&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="55" LastEditDate="2020-06-13T18:06:46.263" LastActivityDate="2020-06-13T18:06:46.263" Title="Find the probability of a measurement outcome in terms of the coefficients of the state" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12455" PostTypeId="2" ParentId="12454" CreationDate="2020-06-13T09:33:44.447" Score="1" Body="&lt;p&gt;The probability that the measurement outcome is 1 in the first qubit is &lt;span class=&quot;math-container&quot;&gt;$\sum|\alpha_x|^2$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; whose first bit is 1.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-13T09:44:32.520" LastActivityDate="2020-06-13T09:44:32.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12456" PostTypeId="2" ParentId="12454" CreationDate="2020-06-13T09:39:16.477" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x \in \{0, 1\}^n$&lt;/span&gt; means that in the sum we have all possible bitstrings with length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Let's take &lt;span class=&quot;math-container&quot;&gt;$n = 3$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_{x \in \{0, 1\}^n} \alpha_x |x\rangle= \alpha_{000} |000\rangle + \alpha_{001} |001\rangle + \alpha_{010} |010\rangle + \\&#xA;+ \alpha_{011} |011\rangle + \alpha_{100} |100\rangle + \alpha_{101} |101\rangle + \alpha_{110} |110\rangle + \alpha_{111} |111\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we use projecter &lt;span class=&quot;math-container&quot;&gt;$P = |1\rangle \langle 1 | \otimes I \otimes I$&lt;/span&gt; then the probability of measuring first qubit &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; will be equal to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p = \langle \psi | P | \psi \rangle = |a_{100}|^2 + |a_{101}|^2 + |a_{110}|^2 + |a_{111}|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;More about projective measurements can be found in M. Nielsen and I. Chuang's textbook pages 87-88 (for &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; in the textbook one can take &lt;span class=&quot;math-container&quot;&gt;$Z \otimes I \otimes I$&lt;/span&gt; operator).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-13T09:47:18.467" LastActivityDate="2020-06-13T09:47:18.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12457" PostTypeId="1" CreationDate="2020-06-13T10:46:50.630" Score="1" ViewCount="161" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No namespace with the name &quot;Microsoft.Quantum.MachineLearning&quot; exists.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This error is then followed by multiple errors of the identifiers under this namespace not existing. &#xA;In my python Host.py file&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have the following Import Lines&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qsharp&#xA;qsharp.packages.add(&quot;Microsoft.Quantum.MachineLearning::0.11.2006.403&quot;)&#xA;qsharp.reload()&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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  &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;No namespace with the name &quot;Microsoft.Quantum.MachineLearning&quot; exists.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The program runs correctly but the warnings don't go away. &#xA;Hence I ask is there anyway to fix these warnings?&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="55" LastEditDate="2020-06-14T12:34:30.083" LastActivityDate="2020-06-14T12:34:30.083" Title="Q# Quantum.MachineLearning namespace doesn't exist error" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12458" PostTypeId="1" AcceptedAnswerId="12460" CreationDate="2020-06-13T11:54:43.447" Score="3" ViewCount="332" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Show that a &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; gate can be implemented using a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate and Hadamard gates and write down the corresponding circuit.&lt;/p&gt;&#xA;&lt;p&gt;Recall  from  Quantum  Information  Theory  that &lt;span class=&quot;math-container&quot;&gt;$Z=HXH$&lt;/span&gt;.  As &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is a controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation, we would expect that &lt;span class=&quot;math-container&quot;&gt;$CZ= (I \otimes H)CNOT(I\otimes H)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Why would we expect this form? Where does this come from?&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-06-14T12:25:11.647" Title="Show that a $CZ$ gate can be implemented using a $CNOT$ gate and Hadamard gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;matrix-representation&gt;&lt;tensor-product&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12459" PostTypeId="2" ParentId="12458" CreationDate="2020-06-13T12:51:14.927" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gxeYP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gxeYP.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;The form &lt;span class=&quot;math-container&quot;&gt;$(I \otimes H)CNOT(I \otimes H)$&lt;/span&gt; just means that you have a control qubit whose state is left unchanged (applying the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operator), and a target qubit whose state is operated with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; again. This is actually a controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator applied to a two-qubit system.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-06-13T12:51:14.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12460" PostTypeId="2" ParentId="12458" CreationDate="2020-06-13T12:54:28.153" Score="2" Body="&lt;p&gt;Here is the CNOT gate:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If we will take into account &lt;span class=&quot;math-container&quot;&gt;$HXH = Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt;, then:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Let's show that &lt;span class=&quot;math-container&quot;&gt;$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&amp;amp;0 \\ 0&amp;amp;0 \end{pmatrix} \otimes\begin{pmatrix}1&amp;amp;0 \\ 0&amp;amp;1 \end{pmatrix} + \begin{pmatrix}0&amp;amp;0 \\ 0&amp;amp;1 \end{pmatrix} \otimes\begin{pmatrix}0&amp;amp;1 \\ 1&amp;amp;0 \end{pmatrix} = &#xA;\\&#xA;=\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\ &#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;\end{pmatrix} +&#xA;\begin{pmatrix}&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0 \\ &#xA;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;\end{pmatrix} = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\ &#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;\end{pmatrix} = CNOT$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-14T12:25:11.647" LastActivityDate="2020-06-14T12:25:11.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12461" PostTypeId="1" AcceptedAnswerId="12463" CreationDate="2020-06-13T13:53:24.087" Score="3" ViewCount="196" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Applying the above construction to AND we get the map &lt;span class=&quot;math-container&quot;&gt;$(x1,x2,y) \rightarrow (x1,x2,y⊕(x1∧x2))$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x1,x2,y \in \{0,1\}$&lt;/span&gt;.  The unitaryoperator which implements this is then simply the map &lt;span class=&quot;math-container&quot;&gt;$|x1〉|x2〉|y&amp;gt; \rightarrow |x1〉|x2〉|y \oplus (x1∧x2)〉$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Written as a matrix with respect to the computational basis this is&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0  &#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can you just spot what the matrix is with respect to the computational basis?&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-06-13T20:56:48.897" Title="How to spot the matrix representation of the quantum NOT operation" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12462" PostTypeId="2" ParentId="12461" CreationDate="2020-06-13T14:51:25.360" Score="1" Body="&lt;p&gt;Something that might help is that this gate is pretty common - it's the &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli&lt;/a&gt;! (or CCNOT). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More generally, you can make matrices by considering the action of the unitary on every input; for example, what is Toffoli(&lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;), Toffoli(&lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;), ... etc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that the first two bits are unaffected, and the third bit is only changed from &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$x_1, x_2$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. So, the only inputs where the transformation isn't the identity is &lt;span class=&quot;math-container&quot;&gt;$|110\rangle, |111\rangle$&lt;/span&gt;. Running through the computation, Toffoli(&lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt;) = &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; and Toffoli(&lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;)=&lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt;, which is shown in the matrix.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-06-13T14:51:25.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12463" PostTypeId="2" ParentId="12461" CreationDate="2020-06-13T15:06:31.203" Score="2" Body="&lt;p&gt;This is the CCNOT gate, but let's try to derive it. Note that the action of the matrix on &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A |00\rangle = &#xA;\begin{pmatrix}&#xA;a_{11}&amp;amp;a_{12}&amp;amp;a_{13}&amp;amp;a_{14}\\&#xA;a_{21}&amp;amp;a_{22}&amp;amp;a_{23}&amp;amp;a_{24}\\&#xA;a_{31}&amp;amp;a_{32}&amp;amp;a_{33}&amp;amp;a_{34}\\&#xA;a_{41}&amp;amp;a_{42}&amp;amp;a_{43}&amp;amp;a_{44}&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;1\\0\\0\\0&#xA;\end{pmatrix} =&#xA;\begin{pmatrix}&#xA;a_{11}\\&#xA;a_{21}\\&#xA;a_{31}\\&#xA;a_{41}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another example for &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A |10\rangle = &#xA;\begin{pmatrix}&#xA;a_{11}&amp;amp;a_{12}&amp;amp;a_{13}&amp;amp;a_{14}\\&#xA;a_{21}&amp;amp;a_{22}&amp;amp;a_{23}&amp;amp;a_{24}\\&#xA;a_{31}&amp;amp;a_{32}&amp;amp;a_{33}&amp;amp;a_{34}\\&#xA;a_{41}&amp;amp;a_{42}&amp;amp;a_{43}&amp;amp;a_{44}&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;0\\0\\1\\0&#xA;\end{pmatrix} =&#xA;\begin{pmatrix}&#xA;a_{13}\\&#xA;a_{23}\\&#xA;a_{33}\\&#xA;a_{43}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is true also for other computational basis states. Here is the truth table for the transformation described in the question:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{array}{c|c}&#xA;|x_1 x_2 y \rangle &amp;amp; |x_1 x_2 (y \oplus x_1  ∧x_2) \rangle\\&#xA;\hline&#xA;|000 \rangle &amp;amp; |000 \rangle \\&#xA;|001 \rangle &amp;amp; |001 \rangle \\&#xA;|010 \rangle &amp;amp; |010 \rangle \\&#xA;|011 \rangle &amp;amp; |011 \rangle \\&#xA;|100 \rangle &amp;amp; |100 \rangle \\&#xA;|101 \rangle &amp;amp; |101 \rangle \\&#xA;|110 \rangle &amp;amp; |111 \rangle\\&#xA;|111 \rangle &amp;amp; |110\rangle&#xA;\end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So we just need to put in the first column the vector that is presented as an output for &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;, the second column is the output of the &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; and 8th column will be equal to &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt;. This way we will obtain the matrix presented in the question: the CCNOT gate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;More schematically&lt;/strong&gt; if we have some &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; matrix, for which we only know the outputs for basis vectors, then (for our case):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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) =&#xA;\\&#xA;= \big(|000\rangle \;  |001\rangle \; |010\rangle \;  |011\rangle \;   |100\rangle \;   |101\rangle \;   |111\rangle \;   |110\rangle \big) =&#xA;\\&#xA;= &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0 &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, this might be interesting &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2335/9459&quot;&gt;answer&lt;/a&gt; for a different matrix. I have used the approach presented there.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-13T16:44:45.763" LastActivityDate="2020-06-13T16:44:45.763" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12464" PostTypeId="2" ParentId="12452" CreationDate="2020-06-13T18:00:48.673" Score="1" Body="&lt;p&gt;I'll comment on how you would obtain these quantities in a (generic, idealised) experimental scenario.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To compute an expectation value &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|O|\psi\rangle$&lt;/span&gt; you need to be able to measure in the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;. Being observables, by definitions, Hermitian operators, you can always write &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$O = \sum_k \lambda_k |u_k\rangle\!\langle u_k|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$O|u_k\rangle=\lambda_k|u_k\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|u_k\rangle$&lt;/span&gt; are an orthonormal basis.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of these quantities, the expectation value reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle\psi|O|\psi\rangle = \sum_k \lambda_k |\langle u_k|\psi\rangle|^2.$$&lt;/span&gt;&#xA;What you need to do is therefore measure &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}_k$&lt;/span&gt;. Each such measurement will give you as output one of the possible output state (&lt;em&gt;e.g.&lt;/em&gt; you might find &lt;span class=&quot;math-container&quot;&gt;$|u_1\rangle$&lt;/span&gt; at the first run, &lt;span class=&quot;math-container&quot;&gt;$|u_3\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$p_k\equiv |\langle u_k|\psi\rangle|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you estimated these probabilities, the expectation value is obtained by simply attaching (multiplying) the number &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; to each probability &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; and summing the resulting values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Measuring &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|O^2|\psi\rangle$&lt;/span&gt; is fully analogous, and doesn't require additional measurements. The only difference is that each &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; is multiplied by &lt;span class=&quot;math-container&quot;&gt;$\lambda_k^2$&lt;/span&gt; rather than by &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;With regards to the calculation involving applying &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, it is important to note that this is useful as a mathematical trick to compute this quantity, but &lt;em&gt;does not&lt;/em&gt; represent a physical operation. Observables &lt;em&gt;are not&lt;/em&gt; physical operations that transform states into other states. &lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-06-13T18:00:48.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12465" PostTypeId="2" ParentId="12461" CreationDate="2020-06-13T18:18:53.470" Score="3" Body="&lt;p&gt;Whenever a unitary is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Permutation_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;permutation matrix&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Once you notice this, you just need to observe that the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th column of the matrix tells you where the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th state is sent (where some ordering of the states has been defined). More precisely, the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th input state is sent to the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-th output state with &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; the row in the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th column that corresponds to a value &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;More generally, the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th input is sent to the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th output for all &lt;span class=&quot;math-container&quot;&gt;$i=1,...,6$&lt;/span&gt;.&#xA;However, the seventh input goes to the eigth output, and the eight input to the seventh output.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The standard ordering in the computational basis for three qubits is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle, |001\rangle, |010\rangle, |011\rangle, |100\rangle, |101\rangle, |110\rangle, |111\rangle.$$&lt;/span&gt;&#xA;This means that the matrix corresponds to the following transformation rules:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|000\rangle \to |000\rangle, \quad&#xA;|001\rangle \to |001\rangle, \quad&#xA;|010\rangle \to |010\rangle, \\&#xA;|011\rangle \to |011\rangle, \quad&#xA;|100\rangle \to |100\rangle, \quad&#xA;|101\rangle \to |101\rangle, \\&#xA;|110\rangle \to |111\rangle, \quad&#xA;|111\rangle \to |110\rangle,&#xA;$$&lt;/span&gt;&#xA;which you can observe corresponds to a CCNOT operation.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-13T20:56:48.897" LastActivityDate="2020-06-13T20:56:48.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12466" PostTypeId="1" AcceptedAnswerId="12468" CreationDate="2020-06-13T20:28:22.840" Score="4" ViewCount="197" Body="&lt;p&gt;I'm trying to add the Q# machine learning library to my program by&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qsharp&#xA;qsharp.packages.add(&quot;Microsoft.Quantum.MachineLearning::0.11.2004.2825&quot;)&#xA;qsharp.reload()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but it throws the errors below. Any solutions?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;P.S. I have the qsharp package and iqsharp installed. Normal programs in python that use qsharp work correctly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;dotnet iqsharp --version&#xA;iqsharp: 0.11.2006.403&#xA;Jupyter Core: 1.3.60623.0&#xA;.NET Runtime: .NETCoreApp,Version=v3.1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'iqsharp': LooseVersion ('0.11.2006.403'),&#xA; 'Jupyter Core': LooseVersion ('1.3.60623.0'),&#xA; '.NET Runtime': LooseVersion ('.NETCoreApp,Version=v3.1'),&#xA; 'qsharp': LooseVersion ('0.11.2006.403')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Also even if I don't add the Machine Learning library and just run &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qsharp&#xA;qsharp.reload()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;It still throws the same error&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Errors:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Adding package Microsoft.Quantum.MachineLearning::0.11.2004.2825.&#xA;---------------------------------------------------------------------------&#xA;IQSharpError                              Traceback (most recent call last)&#xA;&amp;lt;ipython-input-15-b3244a777be2&amp;gt; in &amp;lt;module&amp;gt;&#xA;      1 import qsharp&#xA;      2 qsharp.packages.add(&quot;Microsoft.Quantum.MachineLearning::0.11.2004.2825&quot;)&#xA;----&amp;gt; 3 qsharp.reload()&#xA;&#xA;~\anaconda3\lib\site-packages\qsharp\__init__.py in reload()&#xA;     70     Q# compilation errors are raised as an exception.&#xA;     71     &quot;&quot;&quot;&#xA;---&amp;gt; 72     client.reload()&#xA;     73 &#xA;     74 def get_available_operations() -&amp;gt; List[str]:&#xA;&#xA;~\anaconda3\lib\site-packages\qsharp\clients\iqsharp.py in reload(self)&#xA;    117 &#xA;    118     def reload(self) -&amp;gt; None:&#xA;--&amp;gt; 119         return self._execute(f&quot;%workspace reload&quot;, raise_on_stderr=True)&#xA;    120 &#xA;    121     def add_package(self, name : str) -&amp;gt; None:&#xA;&#xA;~\anaconda3\lib\site-packages\qsharp\clients\iqsharp.py in _execute(self, input, return_full_result, raise_on_stderr, output_hook, **kwargs)&#xA;    207         # There should be either zero or one execute_result messages.&#xA;    208         if errors:&#xA;--&amp;gt; 209             raise IQSharpError(errors)&#xA;    210         if results:&#xA;    211             assert len(results) == 1&#xA;&#xA;IQSharpError: The Q# kernel raised the following errors:&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(2,10): error QS6104: No namespace with the name &quot;Microsoft.Quantum.Convert&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(3,10): error QS6104: No namespace with the name &quot;Microsoft.Quantum.Intrinsic&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(60,21): error QS5022: No identifier with the name &quot;Default&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(61,16): error QS5022: No identifier with the name &quot;Structure&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(62,16): error QS5022: No identifier with the name &quot;Parameters&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(63,16): error QS5022: No identifier with the name &quot;Bias&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(11,16): error QS5022: No identifier with the name &quot;Length&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(30,23): error QS5022: No identifier with the name &quot;Mapped&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(32,13): error QS5022: No identifier with the name &quot;Zip&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(35,13): error QS5022: No identifier with the name &quot;Mapped&quot; exists.&#xA;    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(46,9): error QS5022: No identifier with the name &quot;Message&quot; exists.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12355" LastEditorUserId="55" LastEditDate="2020-06-14T07:47:59.380" LastActivityDate="2020-06-17T17:35:30.140" Title="qsharp.reload() throws error in python" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12467" PostTypeId="1" CreationDate="2020-06-13T22:11:47.160" Score="2" ViewCount="27" Body="&lt;p&gt;Question about the practical use of super dense coding in information transmission:&#xA;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. &#xA;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!&#xA;Am I correct or am I missing something?&#xA;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="12357" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:37.790" LastActivityDate="2020-10-08T17:54:37.790" Title="Question about the practical use of super dense coding in information transmission" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;superdense-coding&gt;&lt;classical-quantum&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2020-06-17T07:51:25.173" ContentLicense="CC BY-SA 4.0" />
  <row Id="12468" PostTypeId="2" ParentId="12466" CreationDate="2020-06-13T23:28:26.020" Score="0" Body="&lt;p&gt;@ChrisGranade &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12466/qsharp-reload-throws-error-in-python#comment16425_12466&quot;&gt;solved my problem&lt;/a&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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 &lt;code&gt;qsharp.packages.add&lt;/code&gt; call to use 0.11.2006.403&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12355" LastEditorUserId="23" LastEditDate="2020-06-17T17:35:30.140" LastActivityDate="2020-06-17T17:35:30.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12469" PostTypeId="1" CreationDate="2020-06-14T02:50:09.460" Score="3" ViewCount="43" Body="&lt;p&gt;Given two qubit states &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;. By applying some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$\rho = U(\rho_1 \otimes \rho_2)U^\dagger$&lt;/span&gt;. Can &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be entangled if either of &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; is a maximally mixed state?&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="55" LastEditDate="2020-06-14T08:05:05.700" LastActivityDate="2020-06-14T09:28:20.863" Title="Can $U(\rho_1\otimes\rho_2)U^\dagger$ be entangled if either of $\rho_1$ or $\rho_2$ is a maximally mixed state?" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12470" PostTypeId="1" AcceptedAnswerId="12488" CreationDate="2020-06-14T03:57:32.393" Score="1" ViewCount="38" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2020-06-15T04:46:11.937" Title="Where can I find tutorials about correcting gate errors in the quantum circuit?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12471" PostTypeId="1" AcceptedAnswerId="12472" CreationDate="2020-06-14T05:06:16.933" Score="0" ViewCount="68" Body="&lt;p&gt;&lt;a href=&quot;https://export.arxiv.org/ftp/arxiv/papers/1908/1908.07943.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://export.arxiv.org/ftp/arxiv/papers/1908/1908.07943.pdf&lt;/a&gt;&#xA;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. &lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="12239" LastEditDate="2020-06-15T00:08:10.187" LastActivityDate="2020-06-15T00:08:10.187" Title="How do I encode integers into BigEndian in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12472" PostTypeId="2" ParentId="12471" CreationDate="2020-06-14T05:52:41.453" Score="2" Body="&lt;p&gt;I don't think there's a single function, but here's how you can do this with several library functions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Convert;&#xA;open Microsoft.Quantum.Diagnostics;&#xA;&#xA;operation Demo () : Unit {&#xA;    let N = 12;&#xA;    Message(&lt;span class=&quot;math-container&quot;&gt;$&quot;Number: {N}&quot;);&#xA;    let bitsLE = IntAsBoolArray(N, 4);&#xA;    Message($&lt;/span&gt;&quot;Bits in little endian: {bitsLE}&quot;);&#xA;    let bitsBE = Reversed(bitsLE);&#xA;    Message($&quot;Bits in big endian: {bitsBE}&quot;);&#xA;    using (qs = Qubit[N]) {&#xA;        ApplyPauliFromBitString(PauliX, true, bitsBE, qs);&#xA;        DumpMachine();&#xA;        ResetAll(qs);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.convert.intasboolarray&quot; rel=&quot;nofollow noreferrer&quot;&gt;IntAsBoolArray&lt;/a&gt; converts an integer to a bit string with the given number of bits (in this case &lt;code&gt;[False,False,True,True]&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.arrays.reversed&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reversed&lt;/a&gt; returns the bits of the array in reverse order, i.e., converts them from little endian to big endian (&lt;code&gt;[True,True,False,False]&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applypaulifrombitstring&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyPauliFromBitString&lt;/a&gt; applies an X gate to each of the qubits that correspond to &lt;code&gt;true&lt;/code&gt; elements of the &lt;code&gt;bitsBE&lt;/code&gt; array (&lt;span class=&quot;math-container&quot;&gt;$|1100\rangle$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-14T05:52:41.453" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12473" PostTypeId="2" ParentId="12458" CreationDate="2020-06-14T06:34:17.027" Score="2" Body="&lt;p&gt;In simple words:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;if a control qubit of CNOT is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is applied on target qubit. Since &lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$HIH=I$&lt;/span&gt; and nothing is done on the target qbubit&lt;/li&gt;&#xA;&lt;li&gt;if the control qubit of CNOT is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, an operator &lt;span class=&quot;math-container&quot;&gt;$HXH=Z$&lt;/span&gt; is applied on the target qubit.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hence we have controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-14T06:34:17.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12474" PostTypeId="1" AcceptedAnswerId="12479" CreationDate="2020-06-14T09:16:26.213" Score="4" ViewCount="200" Body="&lt;p&gt;This may be a dumb question, if so please forgive me, it is late at night.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7655" LastEditorUserId="55" LastEditDate="2020-06-14T12:50:40.153" LastActivityDate="2020-06-14T12:50:40.153" Title="How does a classical computer simulate nonclassical correlations?" Tags="&lt;entanglement&gt;&lt;simulation&gt;&lt;classical-computing&gt;&lt;games&gt;&lt;non-locality&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12475" PostTypeId="2" ParentId="12469" CreationDate="2020-06-14T09:21:10.237" Score="2" Body="&lt;p&gt;The question is equivalent to the following: can a balanced mixture of (not all separable) states be entangled?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To see the equivalence, observe that if &lt;span class=&quot;math-container&quot;&gt;$\rho_2=I/d$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is here the dimension of the space) then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\frac1 d\sum_{k=1}^d U(\rho_1\otimes|k\rangle\langle k|)U^\dagger,$$&lt;/span&gt;&#xA;and if we don't put further restrictions on &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;, then the only thing we know about &lt;span class=&quot;math-container&quot;&gt;$U(\rho_1\otimes |k\rangle\langle k|)U^\dagger$&lt;/span&gt; is that they are orthogonal states (and if we are to hope the mixture is entangled, the states cannot be all separable).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not the case. As a counterexample in the two-qubit scenario, consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt2|\Phi_+\rangle \equiv |00\rangle + |11\rangle,&#xA;\qquad&#xA;\sqrt3|\Psi\rangle \equiv |00\rangle + |10\rangle - |11\rangle.&#xA;$$&lt;/span&gt;&#xA;You can then verify that &lt;span class=&quot;math-container&quot;&gt;$(|\Phi_+\rangle\!\langle\Phi_+|+|\Psi\rangle\!\langle\Psi|)/2$&lt;/span&gt; is still entangled (using e.g. the PPT criterion).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Translated into the notation of the question, this example would correspond to &lt;span class=&quot;math-container&quot;&gt;$\rho_1=|0\rangle\langle 0|$&lt;/span&gt; (or any other pure state), and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|0,0\rangle=|\Phi_+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|0,1\rangle=|\Psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This paper might be of interest to figure out when mixing pure &lt;em&gt;maximally entangled&lt;/em&gt; states can result in an entangled state: (&lt;a href=&quot;https://doi.org/10.1016/j.aop.2016.05.018&quot; rel=&quot;nofollow noreferrer&quot;&gt;Flores and Galapon 2016&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-14T09:28:20.863" LastActivityDate="2020-06-14T09:28:20.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12477" PostTypeId="1" CreationDate="2020-06-14T12:26:35.810" Score="2" ViewCount="36" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; be the number of qubits we're using, and let &lt;span class=&quot;math-container&quot;&gt;$$\mathrm H=\sum_{i=1}^T\alpha_i\mathrm U_i|0\rangle\langle0|\mathrm U_i^\dagger$$&lt;/span&gt; be an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit hermitian observable where &lt;span class=&quot;math-container&quot;&gt;$T=O(\mathrm{poly}(n))$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\alpha_i\in\mathbb R\!\setminus\!\{0\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm U_i$&lt;/span&gt; a unitary that can be implemented as a circuit of size &lt;span class=&quot;math-container&quot;&gt;$O(\mathrm{poly}(n))$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For my purposes, I would like to express &lt;span class=&quot;math-container&quot;&gt;$\mathrm H$&lt;/span&gt; as an observable consisting of &lt;em&gt;only a single term, without any ancillary qubits&lt;/em&gt;; thus, the most general desired form is &lt;span class=&quot;math-container&quot;&gt;$\mathrm H=\mathrm W\mathrm D\mathrm W^\dagger$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathrm W$&lt;/span&gt; an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary and &lt;span class=&quot;math-container&quot;&gt;$\mathrm D$&lt;/span&gt; a &lt;span class=&quot;math-container&quot;&gt;$2^n\times2^n$&lt;/span&gt; real diagonal matrix.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: is there a construction of &lt;span class=&quot;math-container&quot;&gt;$\mathrm W$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm D$&lt;/span&gt; that can be computed in time &lt;span class=&quot;math-container&quot;&gt;$O(\mathrm{poly}(n))$&lt;/span&gt;, possibly exploiting that &lt;span class=&quot;math-container&quot;&gt;$\mathrm H$&lt;/span&gt; is of low rank (namely polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;)? Clearly, &lt;span class=&quot;math-container&quot;&gt;$\mathrm W$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm D$&lt;/span&gt; can be brute forced by diagonalising &lt;span class=&quot;math-container&quot;&gt;$\mathrm H$&lt;/span&gt;, but from what I have found even the fastest diagonalisation algorithms still run in time proportional to the dimensionality of &lt;span class=&quot;math-container&quot;&gt;$\mathrm H$&lt;/span&gt;, which is exponential.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, if you know of any papers related to this question, sharing would be highly appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2687" LastActivityDate="2020-06-15T07:19:00.667" Title="Efficient diagonalisation of low-rank observables" Tags="&lt;measurement&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12478" PostTypeId="2" ParentId="12474" CreationDate="2020-06-14T12:32:03.047" Score="2" Body="&lt;p&gt;There are two definitions of simulation that are commonly used in this context.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We consider a quantum computation to be:&#xA;1. loading an input&#xA;2. performing some processing&#xA;3. doing a measurement&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This defines a distribution on possible measurement outcomes for each input.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Weak Simulation&lt;/em&gt; would be a classical randomised algorithm that could sample from these distributions, given a suitable description of the quantum computation as defined above.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Strong Simulation&lt;/em&gt; is the ability to approximately calculate individual probabilities.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A naive simulation algorithm that uses exponential time and space is to store the state as a big vector (of length &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;) and then multiply it by the matrices for each of the gates (size &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt;).  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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This doesn't violate any laws of quantum physics, because it is simulating the whole system, not simulating each qubit locally&lt;/p&gt;&#xA;" OwnerUserId="9626" LastActivityDate="2020-06-14T12:32:03.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12479" PostTypeId="2" ParentId="12474" CreationDate="2020-06-14T12:46:36.180" Score="2" Body="&lt;blockquote&gt;&#xA;  &lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Quantum phenomena cannot be &quot;explained classically&quot; only when locality is taken into consideration.&#xA;In other words, classical phenomena cannot reproduce (some types of) quantum correlations &lt;em&gt;provided that we don't allow for certain types of correlations&lt;/em&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &quot;simulate&quot; 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 &lt;em&gt;you&lt;/em&gt; know, in some situations, can be interpreted as markers of nonclassical correlations. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Put in another way, you can always sample from an arbitrary probability distribution &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy)$&lt;/span&gt;. Whether such a distribution is &quot;nonclassical&quot; is only meaningful in relation to some imposed restriction (&lt;em&gt;e.g.&lt;/em&gt; defining &quot;classical&quot; when it can be written as &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy)=\sum_\lambda p_\lambda p_\lambda(a|x) p_\lambda(b|y)$&lt;/span&gt;). When you simulate such a distribution on a computer, you don't need to respect such restrictions, so there is no problem.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;In general, how could a classical computer simulate quantum phenomena that cannot be explained classically&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;how&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-06-14T12:46:36.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12480" PostTypeId="2" ParentId="12376" CreationDate="2020-06-14T14:02:16.220" Score="5" Body="&lt;p&gt;The shift operator takes his name from the fact that it &lt;em&gt;shifts&lt;/em&gt; the position of its input, as in, it sends &lt;span class=&quot;math-container&quot;&gt;$1\to2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2\to3$&lt;/span&gt; etc, with the last computational basis element being sent back to the first one: &lt;span class=&quot;math-container&quot;&gt;$d\to 1$&lt;/span&gt; (or the same thing starting with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, depending on notation).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per the &quot;boost&quot; operator &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, I have usually seen those referred to as &quot;clock matrices&quot;, as in &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices&quot; rel=&quot;noreferrer&quot;&gt;the Wikipedia page&lt;/a&gt;. Such name comes from the fact that they are diagonal matrices, whose diagonal elements are phases of the form &lt;span class=&quot;math-container&quot;&gt;$\omega_d^k$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\omega_d\equiv e^{2\pi i/d}$&lt;/span&gt;. Represented in the complex plane, this are &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; unit vectors pointing in equidistant directions, thus somewhat resembling hands on a clock.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both definitions give the usual Pauli matrices for &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As per their usefulness, it depends on the context. One thing that comes to mind is that they are used to find the &quot;easy&quot; examples of mutually unbiased bases, see &lt;em&gt;e.g.&lt;/em&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Mutually_unbiased_bases&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1004.3348&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-06-14T14:02:16.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12481" PostTypeId="1" CreationDate="2020-06-14T15:24:25.540" Score="5" ViewCount="102" Body="&lt;p&gt;Suppose that we have a quantum state of the form: &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sqrt{p}|0\rangle + \sqrt{1-p}|1\rangle$$&lt;/span&gt;&lt;br&gt;&#xA;In order to get an estimate of the probability of reading &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we need to sample &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. How many times do we need to sample to have an &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-estimate ? Keep in mind that this is different from &lt;em&gt;quantum tomography&lt;/em&gt; 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 &lt;a href=&quot;https://www.springer.com/gp/book/9783319964232&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supervised Learning with Quantum Computers, Schuld,M, et.al&lt;/a&gt;, the authors say that sampling from a qubit is equivalent to sampling from a bernoulli distribution,thus we can use the Wald interval:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\epsilon = z\sqrt{{\bar{p}(1-\bar{p})}\over S}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is the confidence level, &lt;span class=&quot;math-container&quot;&gt;$\bar{p}$&lt;/span&gt; is the average and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; the number of samples.&lt;br&gt;&#xA;In the case of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; being close to either 0 or 1, we can use Wilson Score interval:&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\epsilon = {z \over {1 + {z^2\over S}}}\sqrt{{{\bar{p}(1-\bar{p})}\over S} + {z^2 \over 4S^2}}&#xA;$$&lt;/span&gt;&#xA;Now, the i ask the following question: What if i have a state with multiple qubits? How do i get an &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-estimate of the probability of reading some state? If you can suggest some references, i would appreciateit. Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="10315" LastEditorUserId="55" LastEditDate="2020-06-25T16:16:05.450" LastActivityDate="2020-06-25T16:17:45.253" Title="How many samples are required to estimate the probabilities of a state?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12482" PostTypeId="1" CreationDate="2020-06-14T16:53:31.497" Score="0" ViewCount="41" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/atdvq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/atdvq.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 . &#xA;i have also installed vscode 2019 is it the cause. &#xA;i need help please&lt;/p&gt;&#xA;" OwnerUserId="11600" LastEditorUserId="10473" LastEditDate="2020-06-16T10:34:54.117" LastActivityDate="2020-06-16T10:34:54.117" Title="dotnet iqsharp install gives error &quot;FileNotFoundError: The system cannot find the path specified&quot;" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12483" PostTypeId="1" AcceptedAnswerId="14255" CreationDate="2020-06-14T16:58:18.467" Score="6" ViewCount="103" Body="&lt;p&gt;I'm reading the proof of &quot;nonlocality without inequality&quot; presented in (&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.68.2981&quot; rel=&quot;noreferrer&quot;&gt;Hardy 1992&lt;/a&gt;).&#xA;In this protocol, we consider two particles (say, an electron and a positron) evolving &lt;em&gt;almost&lt;/em&gt; 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.&#xA;Here is the setup as given in the paper:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/3z99K.png&quot; width=&quot;250&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$C^\pm$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D^\pm$&lt;/span&gt; are the possible output events, and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the point at which &lt;span class=&quot;math-container&quot;&gt;$e_+$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e_-$&lt;/span&gt; interact if they both pass through it. Note how, if there was no point of interaction &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, the two particles would evolve independently, and the beamsplitters cancel each other out.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We focus on the output events in four scenarios: 1) when all BSs are as in the above figure, 2) when BS2&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; is removed, 3) when BS2&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt; is removed, 4) when both BS2&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; and BS2&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt; are removed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Using the convention for beamsplitter evolutions in which a phase &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is introduced upon reflection, &lt;span class=&quot;math-container&quot;&gt;$a_1\to a_1 + i a_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_2 \to ia_1 + a_2$&lt;/span&gt;, we can compute the output states in the four cases, and find the following&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  &amp;amp;\,\,\,\,\,\text{both BS}\,: &amp;amp;&amp;amp;-3|cc\rangle + \,\,\,i |cd\rangle + \,\,\,i |dc\rangle - |dd\rangle, \\&#xA;  &amp;amp;\text{only BS2$^+$}: &amp;amp;&amp;amp;\phantom3-|cc\rangle + 2i |cd\rangle + \,\,\,i|dc\rangle, \\&#xA;  &amp;amp;\text{only BS2$^-$}: &amp;amp;&amp;amp;\phantom3-|cc\rangle + \,\,\,i| cd\rangle + 2i |dc\rangle, \\&#xA;  &amp;amp;\,\,\,\,\,\text{no BS2$^\pm$}: &amp;amp;&amp;amp;\phantom1  \qquad\qquad\,\,\, i| cd\rangle + \,\,\,i |dc\rangle + |dd\rangle.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We now consider what happens when the output &lt;span class=&quot;math-container&quot;&gt;$|dd\rangle$&lt;/span&gt; is observed when both BSs are used. This happens with probability &lt;span class=&quot;math-container&quot;&gt;$1/16$&lt;/span&gt;. Then, the author remarks that&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;From the only BS2&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; case, we conclude that observing &lt;span class=&quot;math-container&quot;&gt;$d_+$&lt;/span&gt; (&lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; for the first particle) implies that we should observe &lt;span class=&quot;math-container&quot;&gt;$c_-$&lt;/span&gt; when no BS2&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt; is used.&lt;/li&gt;&#xA;&lt;li&gt;From the only BS2&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt; case, we conclude that observing &lt;span class=&quot;math-container&quot;&gt;$d_-$&lt;/span&gt; (&lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; for the second particle) implies that we should observe &lt;span class=&quot;math-container&quot;&gt;$c_+$&lt;/span&gt; when no BS2&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; is used.&lt;/li&gt;&#xA;&lt;li&gt;The above two observations tell us that, when neither BS2&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; nor BS2&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt; are used, we should observe the output &lt;span class=&quot;math-container&quot;&gt;$|cc\rangle$&lt;/span&gt;. But this is incompatible with the output state we know we have in this instance, which assigns zero probability to such event.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;We then conclude that observing &lt;span class=&quot;math-container&quot;&gt;$|dd\rangle$&lt;/span&gt; contradicts local realistic explanations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;Why can we mix the output states in the four different scenarios (yes/no BS&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt;/BS&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt;) like this? Why does it matter what we &lt;em&gt;would&lt;/em&gt; observe when one of the two BSs is removed, when both of them are present in the considered experimental run?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-10-19T16:28:07.177" Title="Understanding Hardy's proof of &quot;nonlocality without inequalities&quot;" Tags="&lt;non-locality&gt;&lt;nonclassicality&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12484" PostTypeId="1" AcceptedAnswerId="12490" CreationDate="2020-06-14T19:08:26.853" Score="3" ViewCount="402" Body="&lt;p&gt;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?&#xA;For example, in a system of 3-qubits, after a certain circuitry, I measure all the qubits. I found that&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;c1% probability of |000&amp;gt;, &#xA;c2% of |001&amp;gt;,&#xA;c3% of |010&amp;gt;,&#xA;c4% of |101&amp;gt;,&#xA;c5% of |111&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;so that c1+c2+c3+c4+c5 = 100.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Can I then say that the system of 3-qubits is an entangled one?&lt;/p&gt;&#xA;" OwnerUserId="9201" LastEditorUserId="55" LastEditDate="2020-06-17T06:52:29.957" LastActivityDate="2020-06-17T06:52:29.957" Title="Can we say that an $n$-qubit system is entangled if at least one basis vector is missing?" Tags="&lt;entanglement&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12485" PostTypeId="2" ParentId="12484" CreationDate="2020-06-14T19:48:44.957" Score="7" Body="&lt;p&gt;In general this is not correct. Consider two systems: one in state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|00\rangle + |01\rangle)$&lt;/span&gt; and another in state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$&lt;/span&gt;. Both of them have exactly two basis vectors missing from the measurement results, but the first one can be represented as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\otimes\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt; and thus is not entangled, while the second one cannot be represented as a tensor product of 1-qubit states and is entangled.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-14T19:48:44.957" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12486" PostTypeId="2" ParentId="12482" CreationDate="2020-06-14T21:59:07.530" Score="1" Body="&lt;p&gt;If you installed IQ# with &lt;code&gt;--version 0.1.2.3&lt;/code&gt;, then this would have installed a very old version on your machine, which had &lt;a href=&quot;https://github.com/microsoft/iqsharp/issues/63&quot; rel=&quot;nofollow noreferrer&quot;&gt;this bug&lt;/a&gt; that is probably affecting you here. You can run &lt;code&gt;dotnet iqsharp --version&lt;/code&gt; to see which version you have installed. (&lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/relnotes/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check here&lt;/a&gt; for the latest released version numbers.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If so, you should install the latest version of IQ# by running &lt;code&gt;dotnet tool update -g Microsoft.Quantum.IQSharp&lt;/code&gt;, followed by &lt;code&gt;dotnet iqsharp install&lt;/code&gt;. That should fix your problem.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastActivityDate="2020-06-14T21:59:07.530" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12488" PostTypeId="2" ParentId="12470" CreationDate="2020-06-15T04:46:11.937" Score="1" Body="&lt;p&gt;For quantum circuits:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In terms of NISQ/smaller algorithms, it depends on the type of error your system has. &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.121.250502&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt;  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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For quantum control:&#xA;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 &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.70.052318&quot; rel=&quot;nofollow noreferrer&quot;&gt;SK1&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/0906.4719.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;BB1&lt;/a&gt; are two composite pulse techniques that allow gates to be less noisy by making them robust to overrotation errors.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-06-15T04:46:11.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12489" PostTypeId="2" ParentId="12484" CreationDate="2020-06-15T06:45:31.403" Score="3" Body="&lt;p&gt;Recall that for a tripartite quantum state &lt;span class=&quot;math-container&quot;&gt;$| \psi_{ABC} \rangle$&lt;/span&gt;, one needs to specify the partition along which we're studying entanglement. For example, consider the &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;-state &lt;span class=&quot;math-container&quot;&gt;$| \mathrm{W} \rangle = \frac{1}{\sqrt{3}} \left( | 100 \rangle + | 010 \rangle + | 001 \rangle \right)$&lt;/span&gt;, which is entangled across all partitions. However, a state of the form, &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left( | 00 \rangle + | 11 \rangle \right) \otimes  | \alpha \rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$| \alpha \rangle$&lt;/span&gt; is any single-qubit state, is entangled across the &lt;span class=&quot;math-container&quot;&gt;$A:BC$&lt;/span&gt; partition but is not entangled on the &lt;span class=&quot;math-container&quot;&gt;$AB:C$&lt;/span&gt; partition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that, in general, unless you specify the partitions (for a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system with &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;2$&lt;/span&gt;) and the coefficients (in your case the set &lt;span class=&quot;math-container&quot;&gt;$\{ c_{1}, \cdots, c_{5} \}$&lt;/span&gt;), 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: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504163&quot; rel=&quot;nofollow noreferrer&quot;&gt;An introduction to entanglement measures&lt;/a&gt; by Plenio and Virmani. If this is a bit advanced for you then I'd recommend studying the standard textbook: Nielsen and Chuang.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://www.qetlab.com/List_of_functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;QETLAB&lt;/a&gt; (or others, an exhaustive list can be found on &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantiki&lt;/a&gt;). For example, &lt;a href=&quot;http://www.qetlab.com/IsProductVector&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; 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.  &lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-06-15T06:45:31.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12490" PostTypeId="2" ParentId="12484" CreationDate="2020-06-15T07:04:42.573" Score="5" Body="&lt;p&gt;There's two sides to this. First, the question you actually ask: No. Consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle&#xA;$$&lt;/span&gt;&#xA;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).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other side (I know you didn't ask), but there are entangled states which contain all basis states. For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12(|00\rangle+|01\rangle+|10\rangle-|11\rangle).&#xA;$$&lt;/span&gt;You can see that this is entangled by writing it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0+\rangle+|1-\rangle),&#xA;$$&lt;/span&gt;&#xA;which is just one of the standard Bell states + a Hadamard rotation on one qubit (which therefore cannot affect the entanglement).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-15T07:04:42.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12491" PostTypeId="2" ParentId="12477" CreationDate="2020-06-15T07:19:00.667" Score="1" Body="&lt;p&gt;There are a few things you can say quite easily. Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_i\rangle=U_i|0\rangle.&#xA;$$&lt;/span&gt;&#xA;Now, let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; be a state that is orthogonal to all of these states. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|\phi\rangle=0.&#xA;$$&lt;/span&gt;&#xA;This is most of your job done given that the Hilbert space is of dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, and your space spanned by the &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; is no more than size poly(&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, now, I'd probably construct a matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H'=\sum_{i,j}|i\rangle\langle j| \langle\psi_i|H|\psi_j\rangle,&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$H'$&lt;/span&gt; (which should be fine), you can diagonalise &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-15T07:19:00.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12493" PostTypeId="1" AcceptedAnswerId="12495" CreationDate="2020-06-15T10:09:06.017" Score="2" ViewCount="63" Body="&lt;p&gt;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 &quot;accuracy&quot;, which means use the composition of this set of gates can achieve any accuracy of the gate we want to approximately simulate. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 (&lt;a href=&quot;https://arxiv.org/pdf/1603.07678.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1603.07678.pdf&lt;/a&gt;), and the concept of &quot;accuracy&quot; is also no longer mentioned.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It mentioned a concept of &quot;fidelity&quot; 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 &quot;universal quantum gates&quot;?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-06-15T12:23:08.587" LastActivityDate="2020-06-15T17:04:24.277" Title="A question about a real programmable quantum computer" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12494" PostTypeId="1" CreationDate="2020-06-15T14:17:39.180" Score="1" ViewCount="48" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;https://user-images.githubusercontent.com/34424412/84667163-e341b980-af19-11ea-9342-5e2506bf219c.png&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As can be seen the attempt to import the machine learning package returns an error and also attempting to use it does not work.&#xA;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):&#xA;&lt;img src=&quot;https://user-images.githubusercontent.com/34424412/84667439-44698d00-af1a-11ea-8b0d-7b37e1eed629.png&quot; alt=&quot;image&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12373" LastActivityDate="2020-06-15T14:17:39.180" Title="Attempting to use the QuantumMachineLearning Repositry with vscode and now import qsharp is reporting 'Fail'" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12495" PostTypeId="2" ParentId="12493" CreationDate="2020-06-15T15:07:16.740" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;), 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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-06-15T15:07:16.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12496" PostTypeId="1" AcceptedAnswerId="12502" CreationDate="2020-06-15T15:51:05.200" Score="6" ViewCount="619" Body="&lt;p&gt;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&gt;.&lt;br&gt;&#xA;What would be an efficient way to design such a gate (best case for n control qubits)? &lt;/p&gt;&#xA;" OwnerUserId="12143" LastEditorUserId="5955" LastEditDate="2020-06-15T15:59:15.963" LastActivityDate="2020-11-21T16:19:46.347" Title="XOR gate for n control qubits in qiskit" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12497" PostTypeId="2" ParentId="12493" CreationDate="2020-06-15T17:04:24.277" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-06-15T17:04:24.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12498" PostTypeId="2" ParentId="12496" CreationDate="2020-06-15T18:13:37.730" Score="8" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should be able to do this using &lt;code&gt;C4XGate&lt;/code&gt;. This would look something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library.standard_gates import C4XGate&#xA;qr = QuantumRegister(5)&#xA;qc = QuantumCircuit(qr)&#xA;&#xA;gate = C4XGate(qr, ctrl_state='1000')&#xA;qc.append(gate, qr)&#xA;gate = C4XGate(qr, ctrl_state='0100')&#xA;qc.append(gate, qr)&#xA;gate = C4XGate(qr, ctrl_state='0010')&#xA;qc.append(gate, qr)&#xA;gate = C4XGate(qr, ctrl_state='0001')&#xA;qc.append(gate, qr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2020-06-15T18:13:37.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12499" PostTypeId="1" AcceptedAnswerId="12508" CreationDate="2020-06-15T19:01:57.120" Score="2" ViewCount="119" Body="&lt;p&gt;Start with Shor's codeword for &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt;: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{8}}(|000\rangle + |111\rangle)\otimes(|000\rangle + |111\rangle)\otimes(|000\rangle + |111\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, assume that instead of an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; flip or a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; flip, the first qubit is measured.&#xA;Can Shor's error correction algorithm correct for this error and recover the original &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;? Show the calculations to justify your answer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My guess is that it can succesfully correct, because of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Deferred_Measurement_Principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deferred Measurement Principle&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My attempt at a solution:&#xA;Let's say that the result of the measurement of the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Thus the entire state collapses to:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle = \frac{1}{\sqrt{4}}(|000\rangle)\otimes(|000\rangle + |111\rangle)\otimes(|000\rangle + |111\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In step 1 we detect and correct for &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors. Since there is no bit flip, this step doesn't change the state.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In step 2 we look for &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; errors. My question is, how to calculate a phase-flip check on &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt;, and how do I interpret the result to correct the error? Same question for the state after measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thanks! &lt;/p&gt;&#xA;" OwnerUserId="11927" LastEditorUserId="8141" LastEditDate="2020-06-16T07:19:10.133" LastActivityDate="2020-06-17T07:47:41.803" Title="Can Shor's 9 Qubit Code Correct for a measurement on the first qubit?" Tags="&lt;measurement&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12500" PostTypeId="1" AcceptedAnswerId="12503" CreationDate="2020-06-15T20:34:11.873" Score="2" ViewCount="45" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;A parity function &lt;span class=&quot;math-container&quot;&gt;$f_s:\{0,1\}^{n}\rightarrow\{0,1\}$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$s\in \{0,1\}^n$&lt;/span&gt;, is a function of the form &lt;span class=&quot;math-container&quot;&gt;$f_s(x) = x \cdot s$&lt;/span&gt;, where the inner product is taken modulo 2.&lt;/p&gt;&#xA;&lt;p&gt;Show that &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; is a balanced function for all &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have &lt;span class=&quot;math-container&quot;&gt;$f_s(x) =\sum_i x_is_i \mod 2$&lt;/span&gt;.  If &lt;span class=&quot;math-container&quot;&gt;$s \neq 0^n$&lt;/span&gt;, then there exist &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;  such that &lt;span class=&quot;math-container&quot;&gt;$s_i \neq 0$&lt;/span&gt;.  So, for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$f_s(x) \neq f_s(x^i)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x^i$&lt;/span&gt; the string obtained from by inverting bit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.  Hence &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; is balanced.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I really don't understand the second from last sentence. Why this does this imply the function is balanced?&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="-1" LastEditDate="2020-06-18T08:31:18.387" LastActivityDate="2020-06-17T06:53:53.950" Title="Why is the function $f_s(x)=\sum_i x_i s_i \pmod 2$ balanced?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;textbook-and-exercises&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12501" PostTypeId="2" ParentId="12496" CreationDate="2020-06-15T21:11:53.097" Score="2" Body="&lt;p&gt;If we are allowed to use ancillary qubits, then this will work (here is an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11603/9459&quot;&gt;answer&lt;/a&gt; about multi-control qubit gates and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11674/9459&quot;&gt;answer&lt;/a&gt; that can show why there are &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates in the following circuit):&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/S3AhE.png&quot; width=&quot;700&quot; /&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$q[0 - 3]$&lt;/span&gt; qubits are controlled qubits, the &lt;span class=&quot;math-container&quot;&gt;$q[4]$&lt;/span&gt; qubit is the target qubit, &lt;span class=&quot;math-container&quot;&gt;$q[5 - 6]$&lt;/span&gt; are ancillary qubits. One small optimization can be done by erasing &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;th and &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt;th &lt;span class=&quot;math-container&quot;&gt;$CCNOT$&lt;/span&gt; gates (nearby two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;s commute with them). This solution can be extended for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits (with more ancillary qubits).&lt;/p&gt;&#xA;&lt;p&gt;This &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11933/9459&quot;&gt;answer&lt;/a&gt; to the related question might be interesting.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-11-21T16:19:46.347" LastActivityDate="2020-11-21T16:19:46.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12502" PostTypeId="2" ParentId="12496" CreationDate="2020-06-15T22:22:44.007" Score="8" Body="&lt;p&gt;For the general case, you can use a counting strategy like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TGv4L.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TGv4L.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This has a gate count of &lt;span class=&quot;math-container&quot;&gt;$O(n \lg n)$&lt;/span&gt; and a work qubit count of &lt;span class=&quot;math-container&quot;&gt;$O(\lg n)$&lt;/span&gt;. Much better than the naive &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; gate count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can improve the gate count to &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; 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 &quot;none, one, more&quot; and then merge. This will increase the ancilla qubit count from &lt;span class=&quot;math-container&quot;&gt;$O(\lg n)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;. Though that count can probably be reduced by playing pebble games with the intermediate values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that for specific &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TOzWM.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TOzWM.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:[[%22QFT5%22],[%22inputA5%22,1,1,1,1,1,%22+=A5%22],[1,1,1,1,1,%22~9k1v%22],[1,1,%22X%22,%22%E2%80%A2%22],[%22%E2%80%A2%22,%22X%22],[1,%22%E2%80%A2%22,%22%E2%97%A6%22,1,1,%22X%22],[1,1,1,%22%E2%97%A6%22,%22X%22,%22%E2%80%A2%22],[1,%22%E2%80%A2%22,1,1,1,%22X%22],[1,1,%22%E2%80%A2%22,1,1,%22X%22],[%22%E2%97%A6%22,1,1,1,%22X%22,%22%E2%80%A2%22],[1,%22%E2%97%A6%22,%22%E2%80%A2%22,1,1,%22X%22],[%22%E2%80%A2%22,%22X%22],[1,1,%22X%22,%22%E2%80%A2%22],[1,1,1,1,%22%E2%80%A6%22],[%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[%22%E2%97%A6%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22X%22],[%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%80%A2%22,%22%E2%97%A6%22,%22X%22],[%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%80%A2%22,%22X%22],[%22inputA5%22,1,1,1,1,1,%22-=A5%22],[%22QFT%E2%80%A05%22]],%22gates%22:[%7B%22id%22:%22~9k1v%22,%22name%22:%22|0%3E%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,1%7D%7D%22%7D]%7D&quot; rel=&quot;noreferrer&quot;&gt;verification in Quirk via state channel duality&lt;/a&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Start from the obvious solution:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SuZ5V.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SuZ5V.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Conjugate adjacent &quot;controls differ in two places&quot; pairs with CNOTs to reduce the big operation count in half:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WDhGU.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WDhGU.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bzlih.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bzlih.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-06-16T01:07:55.393" LastActivityDate="2020-06-16T01:07:55.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12503" PostTypeId="2" ParentId="12500" CreationDate="2020-06-15T22:37:39.793" Score="4" Body="&lt;p&gt;Let's say that the first bit of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$s_0=1$&lt;/span&gt; (the argument will be exactly the same for any bit, just for convenience). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can split the space of inputs &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt; in two halves: one half where &lt;span class=&quot;math-container&quot;&gt;$x_0 = 0$&lt;/span&gt; and the other half where &lt;span class=&quot;math-container&quot;&gt;$x_0 = 1$&lt;/span&gt;. For each bitstring &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from the first half you'll have a bitstring &lt;span class=&quot;math-container&quot;&gt;$\tilde{x}$&lt;/span&gt; from the second half which will be equal to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in all bits except the first one, and will differ from &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in the first bit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now consider &lt;span class=&quot;math-container&quot;&gt;$f_s(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_s(\tilde{x})$&lt;/span&gt;; you'll have &lt;span class=&quot;math-container&quot;&gt;$f_s(x) = x_0s_0 + F$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_s(\tilde{x}) = \tilde{x}_0s_0 + F$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is the sum of all terms except the first one). You know that &lt;span class=&quot;math-container&quot;&gt;$x_0 = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde{x}_0 = 1$&lt;/span&gt;, so you'll have &lt;span class=&quot;math-container&quot;&gt;$F = f_s(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f_s(\tilde{x}) = 1 + F$&lt;/span&gt;, so you're guaranteed that &lt;span class=&quot;math-container&quot;&gt;$f_s(x) \neq f_s(\tilde{x})$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This way you can split all possible &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; pairs, and each of the pairs will have different values of &lt;span class=&quot;math-container&quot;&gt;$f_s$&lt;/span&gt; - which means that exactly &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; values are 0 and &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; are 1, and the function is balanced.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-15T22:37:39.793" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12504" PostTypeId="1" CreationDate="2020-06-16T01:26:51.423" Score="3" ViewCount="379" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT:&#xA;A previous question with link was presented. I've read it but it doesn't address a couple things:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the top answer states &quot;...just elect to do a hard fork to post-quantum cryptography.&quot; 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?&lt;/li&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;EDIT 2:&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The solution cannot be reactive, it can't be &quot;post-quantum&quot;. It can't simply be &quot;electing to do a hard fork&quot; or installing new certs. It certainly won't be flipping a switch. It will be too late then.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &amp;amp; rewrite of software - what I consider the &quot;adapt &amp;amp; survive&quot; 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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT 3:&#xA;&lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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:&#xA;1. chip makers start working on a QC chip or chipset&#xA;2. when #1 is achieved, OS vendors would start rewriting code for an operating system for that chip&#xA;3. when #2 is achieved, vendors for software development platform (Java, .NET, etc) would start rewriting their code&#xA;4. when #3 is achieved, vendors for software for cryptocurrencies, ecommerce, and private comms would start (re)writing code&lt;/p&gt;&#xA;" OwnerUserId="12378" LastEditorUserId="12378" LastEditDate="2020-06-18T06:59:23.983" LastActivityDate="2020-06-18T23:20:56.783" Title="Will quantum computing kill cryptocurrencies, ecommerce and private communications (Signal, TOR, etc)?" Tags="&lt;cryptocurrency&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12505" PostTypeId="2" ParentId="12504" CreationDate="2020-06-16T03:59:25.137" Score="1" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the other hand, it is likely that PQC will be widely available before that could happen. For examples, look at &lt;a href=&quot;https://pqcrypto.eu.org/nist.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-16T06:01:58.570" LastActivityDate="2020-06-16T06:01:58.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12506" PostTypeId="2" ParentId="12504" CreationDate="2020-06-16T04:31:07.270" Score="3" Body="&lt;p&gt;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).&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="12379" LastActivityDate="2020-06-16T04:31:07.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12507" PostTypeId="1" CreationDate="2020-06-16T05:52:43.493" Score="7" ViewCount="300" Body="&lt;p&gt;It can be shown that any classical function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; can be implemented by a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$Q_f$&lt;/span&gt;, so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{x}|x,0^k\rangle \xrightarrow{\mathit{Q_f}} \sum_{x}|x,f(x)\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; output bits, and ingnoring normalization. I have seen such circuits called quantum oracles and treated&#xA;as black boxes in quantum algorithms. If I want to write a&#xA;quantum computer program that includes the circuit &lt;span class=&quot;math-container&quot;&gt;$Q_f$&lt;/span&gt;, it is convenient to write a classical program for &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;&#xA;in a high level language (like C or Java or python) and have it compiled to a quantum circuit.&#xA;&lt;p&gt;&#xA;My question is: is there an implementation of a compiler (preferably open source) that will compile my classical high-level program for &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;&#xA;into some representation of the quantum circuit &lt;span class=&quot;math-container&quot;&gt;$Q_f$&lt;/span&gt; (e.g. using OpenQASM)? If not, is there a compiler that will&#xA;compile into reversible gates?&#xA;&lt;p&gt;&#xA;Thanks!&lt;br&gt;&#xA;kgi&lt;/p&gt;&#xA;" OwnerUserId="12380" LastEditorUserId="8141" LastEditDate="2020-06-16T06:55:26.247" LastActivityDate="2020-06-26T23:35:16.080" Title="Compiling a classical function to a quantum circuit in practice" Tags="&lt;programming&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12508" PostTypeId="2" ParentId="12499" CreationDate="2020-06-16T07:17:48.503" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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' - &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;). There are many other errors that map to a specific codespace, but we cannot always* correct for these errors.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt;-bit Shor code, the subspaces are those associated with all the single-qubit bit flips &lt;span class=&quot;math-container&quot;&gt;$X_{i}$&lt;/span&gt;, and furthermore with all the single qubit phase flips &lt;span class=&quot;math-container&quot;&gt;$Z_{i}$&lt;/span&gt;. There is some degeneracy in the code where there are cases that sometimes you can correct mulitple (correlated!) &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-flips, but we'll disregard that in our discussion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now we are ready to investigate our measurement: after measureing, the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt; does not lie in any of the subspaces associated with the &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt;-bit Shor code, but it is rather a specific superposition:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;|\psi_{0}\rangle = &amp;amp;\frac{1}{2}|000\rangle \otimes \big(|000\rangle+|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \\&#xA;= &amp;amp;\frac{1}{4}\big(|000\rangle+|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \\&#xA;+&amp;amp; \frac{1}{4}\big(|000\rangle-|111\rangle\big) \otimes \big(|000\rangle|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \\&#xA;= &amp;amp; \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),&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We thus see that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt; is a superposition of &lt;em&gt;no&lt;/em&gt;&#xA; error having happened, and of a phase flip on either the first, second &lt;em&gt;or&lt;/em&gt; third having happened.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;em&gt;error syndrome&lt;/em&gt;) will also indicate what subspace we have projected to. The correction is then straightforward.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If the measurement on qubit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; resulted in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we obtain a different 'superposition of subpsaces'. It is not &lt;em&gt;that&lt;/em&gt; different though (the &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; in the beginning of the third line changes to a &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt;), 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) &lt;em&gt;exactly&lt;/em&gt; the same.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;*I say not &lt;em&gt;always&lt;/em&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-17T07:47:41.803" LastActivityDate="2020-06-17T07:47:41.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12509" PostTypeId="1" AcceptedAnswerId="12510" CreationDate="2020-06-16T08:11:45.603" Score="0" ViewCount="40" Body="&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;&#xA;I am looking for a visual, or just probabilities like the ones given in the link.Is this possible on Q#?&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="55" LastEditDate="2020-06-17T06:54:38.290" LastActivityDate="2020-06-17T06:54:38.290" Title="Is there a way to grab probablities of my qubits in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12510" PostTypeId="2" ParentId="12509" CreationDate="2020-06-16T08:23:41.773" Score="1" Body="&lt;p&gt;You can use &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpmachine&quot; rel=&quot;nofollow noreferrer&quot;&gt;DumpMachine&lt;/a&gt; to dump the amplitudes and probabilities of the states; for Grover search it will give you something like this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0MHs0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0MHs0.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-16T08:23:41.773" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12511" PostTypeId="2" ParentId="12354" CreationDate="2020-06-16T09:53:33.113" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is a minor mistake in your first equation, which is that the QFT will have different moduli for the different integers. That is, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit register, so the QFT will produce a phase modulo &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, whereas &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\lceil \lg w\rceil$&lt;/span&gt; bit register to which you are applying a QFT modulo &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;. I will also assume the QFT on &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is done modulo &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, as that makes the analysis much easier. This leaves a state of&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a-rb\equiv k\mod N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll focus on the state corresponding to some fixed value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. The set of states in superposition will be all &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, plus pairs &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt; in the set &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$K =\left\{(a,b) : a- rb\equiv k \mod N, 0\leq a \leq N-1, 0\leq b\leq w-1\right\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the  usual Shor's algorithm, every value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;) is in a pair in this set, and for each one there is approximately one value of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;) forming such a pair. Here, there will be many values of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; that are not in the set. But maybe that's fine, because for a fixed value of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, there will still be a unique value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a\equiv k+rb\mod N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, for a fixed &lt;span class=&quot;math-container&quot;&gt;$c, d, k$&lt;/span&gt; we get&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where I used the fact that powers of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;th root of unity are isomorphic to integers mod &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$N'\equiv N^{-1}\mod w$&lt;/span&gt; (assume &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; are co-prime):&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This will be non-zero if and only if &lt;span class=&quot;math-container&quot;&gt;$rcN'\equiv -d \mod w$&lt;/span&gt;. When we measure &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, we will thus find &lt;span class=&quot;math-container&quot;&gt;$-dc^{-1}N\equiv r\mod w$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So I think this technique will work to recover the discrete log modulo &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I don't think it's correct when you say &quot;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; will always have solutions&quot;. For a given &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$0\leq a\leq 2^{\lceil\lg p\rceil} -1$&lt;/span&gt;, there might be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; solutions for &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a-rb\equiv k\mod p -1$&lt;/span&gt;. Suppose &lt;span class=&quot;math-container&quot;&gt;$b=k=0$&lt;/span&gt;; then we have &lt;span class=&quot;math-container&quot;&gt;$a=p-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a=2(p-1)$&lt;/span&gt; as solutions. &#xA;The analysis for using &lt;span class=&quot;math-container&quot;&gt;$a\in \{0,\dots, 2^{\lceil\lg p\rceil}-1\}$&lt;/span&gt; will probably be really tricky to get right, but it should work in principle.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Normally Shor's algorithm for DLP needs &lt;span class=&quot;math-container&quot;&gt;$2\lceil\lg p\rceil$&lt;/span&gt; computations of the group action in a single run. Your technique reduces it to &lt;span class=&quot;math-container&quot;&gt;$\lceil \lg p\rceil + \lceil \lg w\rceil$&lt;/span&gt;, but you need to repeat roughly &lt;span class=&quot;math-container&quot;&gt;$\frac{\lg p}{\lg w}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-06-16T09:53:33.113" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="12512" PostTypeId="2" ParentId="12376" CreationDate="2020-06-16T11:05:53.330" Score="5" Body="&lt;p&gt;The orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensional finite Hilbert space corresponds to a configuration space of equally spaced clockwise ordered &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; points on a circle &lt;span class=&quot;math-container&quot;&gt;$S^1$&lt;/span&gt; or equivalently, the vertices of a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional regular polygon. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;One may think of a point as a discrete location of a particle, then the shift operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; shifts the particle position by one step clockwise. Thus, we may think of this orthonormal basis as the position basis. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;More precisely, the configuration space may also be considered as the cyclic group &lt;span class=&quot;math-container&quot;&gt;$Z_d$&lt;/span&gt;, by defining the action of its points on themselves as modulo &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; addition.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|k\rangle\rangle = \sum_{j=0}^{d-1}\omega^{-jk}|j\rangle$$&lt;/span&gt;&#xA;It is not hard to see that the action of the operators on  the dual basis is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X|k\rangle\rangle = \omega^{k} |k\rangle\rangle$$&lt;/span&gt;&#xA;and:&#xA; &lt;span class=&quot;math-container&quot;&gt;$$Z|k\rangle\rangle = |k+1 \mod d\rangle\rangle$$&lt;/span&gt;&#xA;Thus, the operator &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, is the shift operator in the momentum basis. A shift in the momentum is a boost. This is the reason for this terminology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In classical mechanics, a (non-relativistic or Galilean) boost acts on the position and momentum observables as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$q\rightarrow q' = q+vt$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p\rightarrow p' = p+mv$$&lt;/span&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the particle mass, and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, the analog of a state in classical mechanics is not the position and momentum, but rather their initial values, i.e., at &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt;. We see that indeed the Galilean boost introduces an instantaneous jump to the momentum but doesn't change the position at &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt; similar to the above discrete quantum boost, in agreement with the above finding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In standard quantum mechanics (on a continuous space), the (infinitesimal) Galilean boost &lt;span class=&quot;math-container&quot;&gt;$\mathbf{G}$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{G} = m \mathbf{Q}$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\mathbf{Q}$&lt;/span&gt; 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: &lt;a href=&quot;https://books.google.co.il/books?id=sHJRFHz1rYsC&amp;amp;pg=PA610&amp;amp;dq=Ballentine%20mechanics&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=0ahUKEwiVr_aYoPnpAhX-ZxUIHczQD1cQ6AEIJzAA#v=onepage&amp;amp;q=Ballentine%20mechanics&amp;amp;f=false&quot; rel=&quot;noreferrer&quot;&gt;Quantum mechanics: A modern development&lt;/a&gt;.  Ballentine proves that the above relation is the only compatible choice for a system whose kinematics is governed by the Heisenberg commutation relation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[\mathbf{Q}, \mathbf{P}] = i \hbar \mathbf{I}$$&lt;/span&gt;&#xA;Returning to the discrete case, we observe that the momentum basis &lt;span class=&quot;math-container&quot;&gt;$|k\rangle\rangle$&lt;/span&gt; can also be modeled on a circle &lt;span class=&quot;math-container&quot;&gt;$S^1$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$S^1\times S^1$&lt;/span&gt;. Of circumference &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. Equivalently, the phase space is the group  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_d \times \mathbb{Z}_d$&lt;/span&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;). 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: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$W_{\rho}(p, q) = \frac{1}{d} \mathrm{tr}(\rho w(p, q)),\quad p,q\in \mathbb{Z}_d,$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where the Weyl operator is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$w(p, q) = \omega^{-\frac{pq}{2}}Z^pX^q$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Galilean group consists of translations (shifts), rotations, boosts and time translations. When the configuration (position) space is a one-dimensional lattice &lt;span class=&quot;math-container&quot;&gt;$Z_d$&lt;/span&gt; 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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ x: q\rightarrow q' = q+1\mod d,  \quad  p\rightarrow p'=p$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ z: q\rightarrow q' = q, \quad p\rightarrow p'=p+1\mod d$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ZX=\omega XZ$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Thus, in the discrete phase space, the Galilean group is isomorphic to the (generalized) Pauli group generated by &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For the action of the full Galilean group on the discrete phase space and on the finite Hilbert space, please see: &lt;a href=&quot;http://www.quantum.physics.sk/conf/tatry07/talks/tolar_1.pdf&quot; rel=&quot;noreferrer&quot;&gt;ŠŤoviček and Tolar&lt;/a&gt;.  For the definition of the generalized Pauli group on the finite (qudit) Hilbert space please see &lt;a href=&quot;https://arxiv.org/abs/1810.10259v1&quot; rel=&quot;noreferrer&quot;&gt;Tolar&lt;/a&gt;.  &lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2020-06-16T11:05:53.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12513" PostTypeId="1" AcceptedAnswerId="12514" CreationDate="2020-06-16T13:05:20.537" Score="4" ViewCount="316" Body="&lt;p&gt;I am trying to understand the Schmidt Decomposition, currently in my QC class. We had a tutorial where we were told if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a pure state of a composite system A then there exists &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|i_B\rangle$&lt;/span&gt; which are orthonomral states for systems A and B respectively.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_i \lambda_i |i_A\rangle|i_B\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I more or less understand that we write &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi\rangle = \sum_{j,k} c_{jk}|a_j\rangle|b_k\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|a_j\rangle_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b_k\rangle_k$&lt;/span&gt; are orthonormal bases for A and B and &lt;span class=&quot;math-container&quot;&gt;$C=(c_{jk})$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle$&lt;/span&gt;. 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!&lt;/p&gt;&#xA;" OwnerUserId="12303" LastEditorUserId="55" LastEditDate="2020-06-17T06:55:00.873" LastActivityDate="2020-06-17T06:55:00.873" Title="How to apply the Schmidt Decomposition to a Bell state?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12514" PostTypeId="2" ParentId="12513" CreationDate="2020-06-16T13:20:12.137" Score="3" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Instead, why not try an example such as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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&#xA;$$&lt;/span&gt;&#xA;So, as you say, work out what the matrix &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is, and perform a singular value decomposition on it. From there, try to extract &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle, |i_B\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; values. (is this all you were after? since you don't want too many hints, I'm not sure what else to say.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-16T13:20:12.137" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12516" PostTypeId="2" ParentId="11861" CreationDate="2020-06-16T18:57:18.030" Score="3" Body="&lt;p&gt;Recently the Starmon-5 system was upgraded. Single qubit rotations Rx, Ry and Rz are now available, see &lt;a href=&quot;https://www.quantum-inspire.com/kbase/starmon-5-operational-specifics/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.quantum-inspire.com/kbase/starmon-5-operational-specifics/&lt;/a&gt; &lt;/p&gt;&#xA;" OwnerUserId="5473" LastActivityDate="2020-06-16T18:57:18.030" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12517" PostTypeId="1" CreationDate="2020-06-16T20:46:54.890" Score="0" ViewCount="88" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Md88f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Md88f.png&quot; alt=&quot;enter image description here&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this error? I am installing the newest version of Qiskit.&lt;/p&gt;&#xA;" OwnerUserId="11600" LastEditorUserId="55" LastEditDate="2020-07-29T18:12:10.373" LastActivityDate="2020-07-29T19:50:55.787" Title="Installing Qiskit Error: Building wheel for ecos error" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12518" PostTypeId="2" ParentId="1474" CreationDate="2020-06-16T23:37:01.413" Score="3" Body="&lt;p&gt;&lt;strong&gt;Silq&lt;/strong&gt; is new high level Quantum Computing language. &#xA;As quoted on their site:&#xA;&quot;&lt;em&gt;Silq is a new high-level programming language for quantum computing with a strong static type system, developed at ETH Zürich.&lt;/em&gt;&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://silq.ethz.ch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Silq&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1863" LastActivityDate="2020-06-16T23:37:01.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12519" PostTypeId="2" ParentId="12507" CreationDate="2020-06-17T09:00:05.840" Score="0" Body="&lt;p&gt;&lt;strong&gt;In theory:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;To sum up, in theory it is possible to convert any classical code into &lt;em&gt;quantum code&lt;/em&gt; (gates, QASM etc.). However, this seems to be difficult to do in practice. Maybe, this can be done only for the simplest codes.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-17T09:00:05.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12520" PostTypeId="1" AcceptedAnswerId="12522" CreationDate="2020-06-17T10:59:45.997" Score="2" ViewCount="269" Body="&lt;p&gt;I'm having trouble getting the namespace &lt;code&gt;Microsoft.Quantum.MachineLearning&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is an example Q# code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;namespace Temp {&#xA;    open Microsoft.Quantum.Math;&#xA;    open Microsoft.Quantum.Canon;&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;    open Microsoft.Quantum.MachineLearning;&#xA;&#xA;    operation Hello () : Unit{&#xA;        Message(&quot;Hello&quot;);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is the python script which drives the code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;import qsharp&#xA;from qsharp import Result&#xA;import json&#xA;import os&#xA;from Temp import Hello&#xA;Hello.simulate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the error that the VSCode terminal shows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Preparing Q# environment...&#xA;fail: Microsoft.Quantum.IQSharp.Workspace[0]&#xA;      QS6104: No namespace with the name &quot;Microsoft.Quantum.MachineLearning&quot; exists.&#xA;Traceback (most recent call last):&#xA;  File &quot;Driver.py&quot;, line 5, in &amp;lt;module&amp;gt;&#xA;    from Temp import Hello&#xA;ModuleNotFoundError: No module named 'Temp'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here are my component versions:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; qsharp.component_versions()&#xA;{'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')}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried adding the package manually into my conda environment:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; qsharp.packages.add(&quot;Microsoft.Quantum.MachineLearning::0.11.2004.2825&quot;)&#xA;Adding package Microsoft.Quantum.MachineLearning::0.11.2004.2825.&amp;gt;&amp;gt;&amp;gt; qsharp.reload()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that doesn't help.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2020-06-20T04:21:06.340" Title="Q# Error: No namespace with the name &quot;Microsoft.Quantum.MachineLearning&quot; exists" Tags="&lt;programming&gt;&lt;q#&gt;&lt;machine-learning&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12521" PostTypeId="2" ParentId="12507" CreationDate="2020-06-17T13:48:54.567" Score="4" Body="&lt;p&gt;Using Qiskit you can compile a boolean function to a Quantum circuit. &#xA;2 options are available: Using a logical expression LogicalExpressionOracle() or a thuth table TruthTableOracle().  &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;an example with LogicalExpressionOracle() &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.components.oracles import TruthTableOracle, LogicalExpressionOracle&#xA;expression = 'Or(And(v0, v1, v2), And(~v0, ~v1, ~v2))'&#xA;#expression = '(v0&amp;amp;v1&amp;amp;v2) | (~v0&amp;amp;~v1&amp;amp;~v2)'&#xA;oracle=LogicalExpressionOracle(expression, optimization=True)&#xA;&#xA;# then get the OpenQasm code from the circuit &#xA;print(oracle.circuit.qasm())&#xA;OPENQASM 2.0;&#xA;include &quot;qelib1.inc&quot;;&#xA;qreg v[3];&#xA;qreg c[2];&#xA;qreg o[1];&#xA;mcx v[0],v[1],v[2],c[0];&#xA;u3(pi,0,pi) c[0];&#xA;x v[0];&#xA;x v[1];&#xA;x v[2];&#xA;mcx v[0],v[1],v[2],c[1];&#xA;u3(pi,0,pi) c[1];&#xA;x v[0];&#xA;x v[1];&#xA;x v[2];&#xA;u3(pi,0,pi) o[0];&#xA;ccx c[0],c[1],o[0];&#xA;u3(pi,0,pi) c[0];&#xA;u3(pi,0,pi) c[1];&#xA;mcx v[0],v[1],v[2],c[0];&#xA;x v[0];&#xA;x v[1];&#xA;x v[2];&#xA;mcx v[0],v[1],v[2],c[1];&#xA;x v[0];&#xA;x v[1];&#xA;x v[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9934" LastActivityDate="2020-06-17T13:48:54.567" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12522" PostTypeId="2" ParentId="12520" CreationDate="2020-06-17T13:53:09.727" Score="2" Body="&lt;p&gt;You'll need to actually add these two lines into your Python script:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;qsharp.packages.add(&quot;Microsoft.Quantum.MachineLearning::0.11.2004.2825&quot;)&#xA;qsharp.reload()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This causes the packages to be loaded and available at runtime.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You need those two lines before you call &lt;code&gt;from Temp import Hello&lt;/code&gt;, otherwise you will get the errors since you try to open the &lt;code&gt;Microsoft.Quantum.MachineLearning&lt;/code&gt; namespace inside your &lt;code&gt;Temp&lt;/code&gt; namespace.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Notice that you may still see an error message that says &lt;code&gt;No namespace with the name &quot;Microsoft.Quantum.MachineLearning&quot; exists&lt;/code&gt; due to the behavior of &lt;code&gt;import qsharp&lt;/code&gt; (see &lt;a href=&quot;https://github.com/microsoft/iqsharp/issues/171&quot; rel=&quot;nofollow noreferrer&quot;&gt;this issue&lt;/a&gt; for more details), but your code should then compile and run successfully anyway, in which case you can ignore that error message.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastActivityDate="2020-06-17T13:53:09.727" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12523" PostTypeId="2" ParentId="12517" CreationDate="2020-06-17T15:39:13.487" Score="3" Body="&lt;p&gt;This error seems to be reported by various users as per the Qiskit GitHub repository. Could you please try the following steps.&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install Anaconda&lt;/li&gt;&#xA;&lt;li&gt;Create a python 3.7 environment: conda create --name your_env python=3.7&lt;/li&gt;&#xA;&lt;li&gt;conda activate your_env&lt;/li&gt;&#xA;&lt;li&gt;pip install qiskit&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;You can report the specific details of the issues in the following GitHub repository issue log if it is persisting after following these steps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit/issues/197&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit GitHub Repository Issue Log &lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-17T15:39:13.487" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12524" PostTypeId="2" ParentId="12066" CreationDate="2020-06-17T16:40:20.953" Score="5" Body="&lt;p&gt;You can use a callback function to save the parameters for each iterations of your vqe algorithm and even store the mean, std.&#xA;Below an example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;# Create the callback function to store intermediate values in vqe&#xA;counts = []&#xA;values = []&#xA;parameters_list=[]&#xA;std_list=[]&#xA;def store_intermediate_result(eval_count, parameters, mean, std):&#xA;    counts.append(eval_count)&#xA;    values.append(mean)&#xA;    parameters_list.append(parameters)&#xA;    std_list.append(std)&#xA;# Create your vqe instance by specifying the callback function and run it on the simulator&#xA;# You already created your operator, varational form and optimizer.&#xA;&#xA;vqe = VQE(op, var_form, optimizer, callback=store_intermediate_result)&#xA;result=vqe.run(simulator)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;last_parameters=parameters_list[-1]&#xA;# The initial_point option allow to start from specific parameters.&#xA;vqe2=VQE(op, var_form, optimizer, callback=store_intermediate_result, initial_point=last_parameters)&#xA;# Run the algorithm from your last iteration&#xA;result2=vqe2.run(simulator)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12386" LastActivityDate="2020-06-17T16:40:20.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12525" PostTypeId="2" ParentId="4399" CreationDate="2020-06-17T17:26:47.990" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YxwIj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YxwIj.png&quot; alt=&quot;Quantum Repeaters and Link Entanglements&quot;&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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. &lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-17T17:26:47.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12526" PostTypeId="1" CreationDate="2020-06-17T20:02:20.520" Score="1" ViewCount="139" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2020-06-18T07:43:32.300" Title="Quantum error correction on IBM devices?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12527" PostTypeId="2" ParentId="12445" CreationDate="2020-06-18T05:45:10.773" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;https://s2.smu.edu/~mitch/ftp_dir/pubs/squint18-2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Single Qubit Quantum Ring Structures and Applications&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-18T05:45:10.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12528" PostTypeId="1" AcceptedAnswerId="12533" CreationDate="2020-06-18T06:59:53.357" Score="2" ViewCount="58" Body="&lt;p&gt;Suppose I have two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. We are given that,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr((\rho - \sigma)|\psi\rangle\langle\psi|) \geq \epsilon$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a fixed state and &lt;span class=&quot;math-container&quot;&gt;$\epsilon \rightarrow 0$&lt;/span&gt;,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then can we conclude anything about the closeness of two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; in any distance measure?&lt;/p&gt;&#xA;" OwnerUserId="8748" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:42.213" LastActivityDate="2020-10-08T17:54:42.213" Title="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?" Tags="&lt;quantum-state&gt;&lt;fidelity&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12529" PostTypeId="1" CreationDate="2020-06-18T07:30:58.237" Score="1" ViewCount="51" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does anyone face similar problems? Can anybody from IBM check this and fix?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gh1nt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gh1nt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This code I wrote to Circuit editor:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[5];&#xA;creg c[5];&#xA;&#xA;x q[1]; //ancila&#xA;&#xA;h q[0]; //init&#xA;h q[1];&#xA;h q[2];&#xA;//Oracle f = 11.x&#xA;cx q[0],q[1];&#xA;cx q[2],q[1];&#xA;//measurement in Hadamard basis&#xA;h q[0];&#xA;h q[2];&#xA;measure q[0] -&amp;gt; c[1];&#xA;measure q[2] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then I clicked on Save, closed the the circuit, opened again from Dashboard and the code changed to this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[5];&#xA;creg c[5];&#xA;&#xA;h q[0];&#xA;x q[1];&#xA;h q[2];&#xA;h q[1];&#xA;cx q[0],q[1];&#xA;h q[0];&#xA;cx q[2],q[1];&#xA;h q[2];&#xA;measure q[0] -&amp;gt; c[1];&#xA;measure q[2] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So, the code is changed to transpiled code. I would like to avoid this behavior.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-06-23T07:43:43.210" LastActivityDate="2020-06-23T07:43:43.210" Title="Problem with comments and code rearranging in IBM Q web interface" Tags="&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12530" PostTypeId="2" ParentId="12526" CreationDate="2020-06-18T07:43:32.300" Score="2" Body="&lt;p&gt;You might find some examples in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2238/practical-implementations-of-qeccs-in-ibm-q-experience&quot;&gt;this two-year-old question&lt;/a&gt; :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt; or the &lt;a href=&quot;https://arxiv.org/abs/2004.11037&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;). 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 &lt;a href=&quot;https://arxiv.org/abs/1806.02359&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for example, which says &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;  &lt;p&gt;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. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;(I have to admit that it's about fault-tolerant quantum computation and not a very good example.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Still, like these recent work, you could try to test some QEC codes on IBMQ devices instead of perfectly implementing them.&lt;/p&gt;&#xA;" OwnerUserId="4178" LastActivityDate="2020-06-18T07:43:32.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12531" PostTypeId="1" CreationDate="2020-06-18T08:02:33.757" Score="3" ViewCount="35" Body="&lt;p&gt;I'm studying quantum walk and quantum simulated annealing. While reading the paper &lt;a href=&quot;https://arxiv.org/abs/1512.03806&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithms for simulated annealing&lt;/a&gt;, I feel a little confused about the quantum walk they gave in Sec 2.1 &lt;em&gt;Quantum walks for QSA&lt;/em&gt;, which is&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$W=X^\dagger PXPRPX^\dagger PXR,$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the swapping opertor, &lt;span class=&quot;math-container&quot;&gt;$R=\mathbb{I}-2|\vec{0}\rangle\langle \vec{0}|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; satisfies&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X|\sigma_i\rangle |\vec{0}\rangle =\sum_{j=0}^{d-1} \sqrt{Pr_\beta (\sigma_j|\sigma_i)} |\sigma_i\rangle &#xA; |\sigma_j\rangle, \qquad&#xA;\vec{0}=\sigma_0,$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_i\}_{i=0}^{d-1}$&lt;/span&gt; can be considered as the full space of configurations.&lt;/p&gt;&#xA;&lt;p&gt;As mentioned in the paper,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;the detailed balance condition implies &lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\pi_\beta(\sigma_i)$&lt;/span&gt; in the eigenstate are the probabilities given by the Gibbs distribution dependent on &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;. And&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;the goal of QSA is to prepare the corresponding eigenstate of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do we write &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in the operator form? Is &lt;span class=&quot;math-container&quot;&gt;$$\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}|$$&lt;/span&gt; correct?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which qubits do the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;s act on? I think it's the first qubit for the first &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and the second one for the second, otherwise, the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;s would make no sense...&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What does this walk mean? With the assumptions about &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;, I tried to compute &lt;span class=&quot;math-container&quot;&gt;$$W\sum_{i=0}^{d-1} \sqrt{\pi_\beta(\sigma_i)} |\sigma_i\rangle|\vec{0}\rangle,$$&lt;/span&gt;&#xA;which seems to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$(-1)^{I(i=0)+I(b=0)}$&lt;/span&gt; could take different forms due to the location of &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;s). But is there any relationship between the &lt;em&gt;balance condition&lt;/em&gt; and the walk &lt;em&gt;c-&amp;gt;b-&amp;gt;i-&amp;gt;b-&amp;gt;c&lt;/em&gt; ?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="4178" LastEditorUserId="55" LastEditDate="2020-06-18T09:50:12.333" LastActivityDate="2020-06-18T09:50:12.333" Title="Quantum walk for quantum simulated annealing in arXiv: 1512.03806" Tags="&lt;algorithm&gt;&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12532" PostTypeId="2" ParentId="12529" CreationDate="2020-06-18T08:41:06.497" Score="4" Body="&lt;p&gt;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 &amp;quot;barriers&amp;quot;, 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ct4Ow.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ct4Ow.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When the code is transpiled the comments are omitted, but they are unchanged in the original code&lt;/p&gt;&#xA;" OwnerUserId="9898" LastActivityDate="2020-06-18T08:41:06.497" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12533" PostTypeId="2" ParentId="12528" CreationDate="2020-06-18T09:13:16.650" Score="4" Body="&lt;p&gt;In general, it would seem no. The quantity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Tr}[(\rho - \sigma)|\psi\rangle\langle\psi|]&#xA;$$&lt;/span&gt;&#xA;is only concerned with the distance between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; on the subspace &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|\psi\rangle)$&lt;/span&gt;. For example, we know we can decompose the Hilbert space as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \mathrm{span}(|\psi\rangle) \oplus \mathrm{span}(|\psi\rangle)^{\perp}$&lt;/span&gt;. Then take &lt;span class=&quot;math-container&quot;&gt;$\rho', \sigma'$&lt;/span&gt; to be operators with support only on &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|\psi\rangle)^{\perp}$&lt;/span&gt;. Then for any &lt;span class=&quot;math-container&quot;&gt;$\epsilon \geq 0$&lt;/span&gt; define &lt;span class=&quot;math-container&quot;&gt;$ \rho_{\epsilon} = (1-\epsilon)\rho' + \epsilon |\psi \rangle \langle \psi |$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma = \sigma'$&lt;/span&gt;. For these states we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Tr}[(\rho_{\epsilon} - \sigma)|\psi\rangle\langle\psi|] = \epsilon.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, as you mention in your question &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho' = \sigma'$&lt;/span&gt; then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\|\rho_{\epsilon} - \sigma\| &amp;amp;= \|-\epsilon \rho' + \epsilon |\psi\rangle\langle\psi|\| \\&#xA;&amp;amp;= \epsilon \| \rho' - |\psi\rangle\langle\psi|\|&#xA;\end{align}&lt;/span&gt;&#xA;which is small if &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is small. However, in general if we use the fact that norms are continuous we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\lim_{\epsilon \rightarrow 0} \| \rho_{\epsilon} - \sigma\| &amp;amp;= \|\lim_{\epsilon \rightarrow 0} \rho_{\epsilon} - \sigma \| \\&#xA;&amp;amp;= \|\rho' - \sigma' \|.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;So as &lt;span class=&quot;math-container&quot;&gt;$\epsilon \rightarrow 0$&lt;/span&gt; the distance between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; just becomes the distance  between &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma'$&lt;/span&gt;. But we were free to choose &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma'$&lt;/span&gt; as we wished so this distance has no nontrivial a priori bound.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma'$&lt;/span&gt;. In this case we end up in the first example again where for &lt;span class=&quot;math-container&quot;&gt;$\epsilon \rightarrow 0$&lt;/span&gt; we found &lt;span class=&quot;math-container&quot;&gt;$\|\rho_{\epsilon} - \sigma\| \rightarrow 0$&lt;/span&gt;. For qubits you can probably work out some concrete bounds on the distance.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-06-18T09:13:16.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12534" PostTypeId="1" CreationDate="2020-06-18T10:53:58.717" Score="1" ViewCount="115" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For the encoding I use qiskit's &lt;code&gt;StateVectorCircuit&lt;/code&gt;. I expect to receive the same state vector when using the &lt;code&gt;StateVectorCircuit&lt;/code&gt; with the 'statevector_simulator' as I put in.&lt;/p&gt;&#xA;&lt;p&gt;However, I experienced, that the sign of the real part (I don't use complex numbers) doesn't matches.&lt;/p&gt;&#xA;&lt;p&gt;Here is a small example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;state_vector = [-1/2, -1/2, -1/2, -1/2]&#xA;&#xA;state_vector_circuit = StateVectorCircuit(state_vector).construct_circuit()&#xA;&#xA;job = execute(state_vector_circuit, Aer.get_backend('statevector_simulator'), optimization_level=0)&#xA;result = job.result()&#xA;&#xA;outputstate = result.get_statevector(state_vector_circuit)&#xA;&#xA;print(outputstate)&#xA;print(state_vector)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Running this code, I receive the following output, where the second line is the expected one:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[0.5+0.j 0.5+0.j 0.5+0.j 0.5+0.j]&#xA;[-0.5, -0.5, -0.5, -0.5]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Where is the wrong sign coming from? Is it the &lt;code&gt;StateVectorCircuit&lt;/code&gt; or the 'statevector_simulator'? And more importantly is there a way from preventing this?&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, I figured I could use only positive amplitudes. However, I feel this would be a limitation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I created an example jupyter notebook on my GitHub page: &lt;a href=&quot;https://github.com/danielmpla/quantum-stackexchange-shares/blob/master/StateVectorCircuitTest.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;StateVectorCircuitTest.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5461" LastEditorUserId="5461" LastEditDate="2020-06-18T12:36:21.977" LastActivityDate="2020-06-21T07:17:07.443" Title="Why do I get positive amplitudes when I create a qiskit StateVectorCircuit from only negative amplitudes?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12535" PostTypeId="2" ParentId="12534" CreationDate="2020-06-18T11:28:34.950" Score="1" Body="&lt;p&gt;Your target state and the state that you get only differ by a total factor of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;.&#xA;In other words, if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the state that you get and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{t}\rangle$&lt;/span&gt; is the target state, we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = (-1)\times|\psi_{t}\rangle = -|\psi_{t}\rangle.&#xA;$$&lt;/span&gt;&#xA;Such a overall factor is known as a &lt;em&gt;global&lt;/em&gt; phase. People think of it as a phase, because we can write &lt;span class=&quot;math-container&quot;&gt;$-1 = e^{i\phi}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi$&lt;/span&gt;. Note that we're not only considering global phases when &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; equal to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; can be anything between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We don't care about global phases, because whenever we try to retrieve information (i.e. a measurement) from a state the global phase &lt;strong&gt;cannot&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;The sign difference between elements in your statevector, however, &lt;em&gt;does&lt;/em&gt; play a vital role. We call this the &lt;em&gt;relative&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\phi_{rel}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;), you severely limit the quantum advantage that you can attain.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-06-18T11:28:34.950" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12536" PostTypeId="1" CreationDate="2020-06-18T13:08:42.353" Score="3" ViewCount="93" Body="&lt;p&gt;Just read this paper from &lt;a href=&quot;https://arxiv.org/pdf/1912.08278.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Xanadu on Quantum Transfer Learning&lt;/a&gt; and a couple of things are unclear to me regarding the optimisation step.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How is back-propagation done through the classical weights feeding into the quantum unitaries?&lt;/li&gt;&#xA;&lt;li&gt;How do they even calculate cross-entropy loss without adding some sort of squashing function to the final output to give outputs in &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt; (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).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;PS: I know this might be overly-specific for SE but I suppose this is the best avenue short of writing the authors.&lt;/p&gt;&#xA;" OwnerUserId="10485" LastActivityDate="2020-06-19T06:42:43.883" Title="How is back-propagation done in &quot;Transfer learning in hybrid classical-quantum neural networks&quot;" Tags="&lt;machine-learning&gt;&lt;neural-network&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12537" PostTypeId="1" CreationDate="2020-06-18T13:31:47.693" Score="4" ViewCount="99" Body="&lt;p&gt;Classically, if the mutual information between the input and output of some channel or circuit &lt;span class=&quot;math-container&quot;&gt;$= 0$&lt;/span&gt;, it means the output is independent of the input, and the circuit is in a way 'useless'.&lt;/p&gt;&#xA;&lt;p&gt;For the quantum case, defining the mutual information between an input &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and the output &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho_B = \mathcal{E}_{B|A}(\rho_A)$&lt;/span&gt; is not so straightforward.&#xA;Let the Choi state be &lt;span class=&quot;math-container&quot;&gt;$\rho_{A'B}=\mathbb{I}_{A'}\otimes \mathcal{E}_{B|A}(\Omega_{A'A})$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Omega_{A'A}$&lt;/span&gt; is a maximally entangled state. If &lt;span class=&quot;math-container&quot;&gt;$I(A';B)=0$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-10-12T07:24:52.423" LastActivityDate="2020-11-11T08:06:40.673" Title="Mutual information of Choi state=0, what would that imply about the quantum channel?" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12538" PostTypeId="1" AcceptedAnswerId="16385" CreationDate="2020-06-18T15:56:42.453" Score="1" ViewCount="219" Body="&lt;p&gt;Is it possible to express gate &lt;span class=&quot;math-container&quot;&gt;$U_1(\lambda)$&lt;/span&gt; through the gates &lt;span class=&quot;math-container&quot;&gt;$R_x, R_y, R_z$&lt;/span&gt; while maintaining the phase? Both in principle and in practice (in Qiskit for example)?&lt;/p&gt;&#xA;&lt;p&gt;The single gate &lt;span class=&quot;math-container&quot;&gt;$R_z(\lambda)$&lt;/span&gt; is not suitable, because it loses phase. In qiskit the &lt;code&gt;transpile&lt;/code&gt; function throws an error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Cannot unroll the circuit to the given basis, ['rx', 'ry', 'rz']. No rule to expand instruction u1.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12280" LastEditorUserId="10480" LastEditDate="2021-03-12T19:14:25.957" LastActivityDate="2021-03-12T19:28:19.273" Title="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" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12539" PostTypeId="2" ParentId="9855" CreationDate="2020-06-18T16:22:14.693" Score="5" Body="&lt;p&gt;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.&lt;br /&gt;&#xA;If you want to prepare the mixed state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{1}{d}\sum_{i}^{d} |i\rangle\langle i|$$&lt;/span&gt;&#xA;you can start by preparing the maximally entangled pure state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi\rangle = \frac{1}{\sqrt{d}}\sum_{i}^{d} |i\rangle|i\rangle$$&lt;/span&gt;&lt;br /&gt;&#xA;The density matrix of &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$$|\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}|$$&lt;/span&gt;.&#xA;Tracing out the second qubit would result in:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr_2[\frac{1}{d}\sum_{i}^{d} \sum_{j}^{d}|i\rangle\langle{j}|\otimes|i\rangle\langle{j}|] =$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{d}\sum_{i}^{d} \sum_{j}^{d}|i\rangle\langle{j}|\cdot Tr[|i\rangle\langle{j}|] = $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Moreover, instead of using&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle = \frac{1}{\sqrt{d}}\sum_{i}^{d} |i\rangle|i\rangle$&lt;/span&gt;&#xA;you could start with any state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi\rangle = \frac{1}{\sqrt{d}}\sum_{i}^{d} |u_i\rangle|u_i\rangle$$&lt;/span&gt;&lt;br /&gt;&#xA;where {&lt;span class=&quot;math-container&quot;&gt;$u_i$&lt;/span&gt;} is an orthonormal basis for &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes d}$&lt;/span&gt; and you would still have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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|$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10259" LastActivityDate="2020-06-18T16:22:14.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12540" PostTypeId="1" CreationDate="2020-06-18T18:36:14.977" Score="2" ViewCount="223" Body="&lt;p&gt;I know that to prepare a Bell state say &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle$&lt;/span&gt;, we need to initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|0\rangle$&lt;/span&gt; and then perform a Hadamard on the first and then use it as control to do a NOT gate on the second to obtain &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{|00\rangle+|11\rangle}{\sqrt{2}}.$$&lt;/span&gt; But what if wanted to create the state &lt;span class=&quot;math-container&quot;&gt;$$\alpha|00\rangle+\beta|01\rangle+\gamma|10\rangle+\eta|10\rangle.$$&lt;/span&gt; How does one create this state?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-06-21T09:42:42.373" LastActivityDate="2020-06-21T09:42:42.373" Title="How to prepare an arbitrary two-qubit state?" Tags="&lt;quantum-state&gt;&lt;bell-experiment&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12541" PostTypeId="2" ParentId="12540" CreationDate="2020-06-18T19:37:22.440" Score="2" Body="&lt;p&gt;First of all, I'm assuming you mean the state : &lt;span class=&quot;math-container&quot;&gt;$\alpha \left|00\right&amp;gt; + \beta \left|01\right&amp;gt; + \gamma\left|10\right&amp;gt; + \eta \left|11\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What you actually want to do is to act with a gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the initial state &lt;span class=&quot;math-container&quot;&gt;$\left|00\right&amp;gt;$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$U\left|00\right&amp;gt; = \alpha \left|00\right&amp;gt; + \beta \left|01\right&amp;gt; + \gamma\left|10\right&amp;gt; + \eta \left|11\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So you will need a matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix}&#xA;\alpha &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;\beta &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\gamma &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;\eta &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so that when in acts on&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left|00\right&amp;gt; =&#xA;\begin{bmatrix}&#xA;1\\&#xA;0\\&#xA;0\\&#xA;0&#xA;\end{bmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;it produces the desired state. So how can someone build such a matrix?&lt;/p&gt;&#xA;&lt;p&gt;You just have to find a decomposition, or an approximation to some extent, to a familiar set of single and 2-qubit quantum gates.&lt;/p&gt;&#xA;" OwnerUserId="12408" LastEditorUserId="23" LastEditDate="2020-06-18T23:10:35.313" LastActivityDate="2020-06-18T23:10:35.313" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12542" PostTypeId="1" AcceptedAnswerId="12555" CreationDate="2020-06-18T20:33:13.737" Score="2" ViewCount="45" Body="&lt;p&gt;I am checking Q# - Graph coloring&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;                for (C in 0 .. (1 &amp;lt;&amp;lt;&amp;lt; N) - 1) {&#xA;                InitializeColor(C, register);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Can you help me explain this part of the code?&lt;/p&gt;&#xA;&lt;p&gt;Thnx&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;        for (N in 1 .. 4) {&#xA;            using (register = Qubit[N]) {&#xA;                for (C in 0 .. (1 &amp;lt;&amp;lt;&amp;lt; N) - 1) {&#xA;                    InitializeColor(C, register);&#xA;                    let measurementResults = MultiM(register);&#xA;                    Fact(ResultArrayAsInt(measurementResults) == C, &#xA;                        $&amp;quot;Unexpected initialization result for N = {N}, C = {C} : {measurementResults}&amp;quot;);&#xA;                    ResetAll(register);&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11913" LastActivityDate="2020-06-19T15:39:07.083" Title="Graph coloring - Q# -" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12544" PostTypeId="2" ParentId="12528" CreationDate="2020-06-18T22:03:32.063" Score="4" Body="&lt;p&gt;Here's a concrete example for a single qubit.&lt;/p&gt;&#xA;&lt;p&gt;We can always change the basis to have &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|0\rangle$&lt;/span&gt;.&#xA;Let us further suppose that &lt;span class=&quot;math-container&quot;&gt;$\langle0|\rho|0\rangle=0$&lt;/span&gt;, so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\begin{pmatrix}0&amp;amp;0\\0&amp;amp;1\end{pmatrix}.$$&lt;/span&gt;&#xA;The requirement &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}[(\sigma-\rho)|\psi\rangle\!\langle\psi|]=\langle\psi|\sigma-\rho|\psi\rangle=\epsilon$&lt;/span&gt; then becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma=\begin{pmatrix}\epsilon &amp;amp; a^* \\ a &amp;amp; 1-\epsilon\end{pmatrix}$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$a\in\mathbb C$&lt;/span&gt;. To have &lt;span class=&quot;math-container&quot;&gt;$\sigma\ge0$&lt;/span&gt;, the coefficient &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; must satisfy &lt;span class=&quot;math-container&quot;&gt;$|a|^2\le \epsilon(1-\epsilon)$&lt;/span&gt; (as follows from imposing its eigenvalues to be non-negative).&#xA;We then have&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle0|\sigma-\rho|0\rangle= \epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To quantify the distance between these states, we notice that the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sigma-\rho$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\lambda_\pm=\pm\sqrt{\epsilon^2+|a|^2}$&lt;/span&gt;, and therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|\rho-\sigma\|_1=|\lambda_+|=\sqrt{\epsilon^2+|a|^2}.$$&lt;/span&gt;&#xA;We then have the following bound on the trace distance:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\epsilon\le\|\rho-\sigma\|_1\le\sqrt{\epsilon}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In the general case, suppose &lt;span class=&quot;math-container&quot;&gt;$\langle0|\rho|0\rangle=p$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\begin{pmatrix}p &amp;amp; b^* \\ b &amp;amp; 1-p\end{pmatrix},&#xA;\qquad&#xA;\sigma=\begin{pmatrix}p+\epsilon &amp;amp; a^* \\ a &amp;amp; 1-(p+\epsilon)\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a,b\in\mathbb C$&lt;/span&gt; are arbitrary complex vectors such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|a|^2\le p(1-p)\equiv r_{p}^2,\qquad |b|^2\le (p+\epsilon)(1-(p+\epsilon))\equiv r_{p+\epsilon}^2.$$&lt;/span&gt;&#xA;The trace distance then reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|\sigma-\rho\|_1=\sqrt{\epsilon^2+|a-b|^2}.$$&lt;/span&gt;&#xA;To get maximum and minimum values of this quantity we notice that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(r_p-r_{p+\epsilon})^2 \le |a-b|^2\le (r_p+r_{p+\epsilon})^2,$$&lt;/span&gt;&#xA;which immediately translates into a bound for the trace distance.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-06-18T22:03:32.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12545" PostTypeId="2" ParentId="12537" CreationDate="2020-06-19T01:03:14.083" Score="1" Body="&lt;p&gt;Here's a guess: they might be related to &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0302031&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement-breaking channels&lt;/a&gt;  (also known as measure-and-prepare channels, quantum-classical channels, etc.). Any channel of the form,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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}, $$&lt;/span&gt;&#xA;are POVM elements and &lt;span class=&quot;math-container&quot;&gt;$\{ \sigma_{k} \}$&lt;/span&gt; are quantum states is called EB. One can show that the Choi states of such channels are always &lt;em&gt;seperable&lt;/em&gt; (in fact, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I}^{A} \otimes \Phi^{B} (\Gamma^{AB})$&lt;/span&gt; is seperable for &lt;strong&gt;any&lt;/strong&gt; entangled input density matrix -- hence the name, entanglement-breaking.)&lt;/p&gt;&#xA;&lt;p&gt;As an example, consider a (simplified) EB channel of the form, &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho) = \operatorname{Tr}\left( \rho \right) \sigma$&lt;/span&gt;. Then, note that its Choi state is,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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. $$&lt;/span&gt;&#xA;Since the quantum mutual information of the input state &lt;span class=&quot;math-container&quot;&gt;$I(A:B) = S_{\mathrm{rel}}(\rho^{AB} || \rho^{A} \otimes \rho^{B})$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S_{\mathrm{rel}}(\cdot || \cdot)$&lt;/span&gt; is the quantum relative entropy (see for ex. Nielsen and Chuang); we have, that for a &amp;quot;simple&amp;quot; measure-and-prepare channel, the quantum mutual information of the input-output states in the Choi representation is zero.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Phi_{j}(\rho) = \operatorname{Tr}\left( \rho \right) \sigma_{j}$&lt;/span&gt; will also satisfy this property, but I'm not sure how far this can generalize.&lt;/p&gt;&#xA;&lt;p&gt;Note #2: To remark on the broader question, yes, convex combinations of channels of the form &lt;span class=&quot;math-container&quot;&gt;$\Phi_{j}(\rho) = \operatorname{Tr}\left( \rho \right) \sigma_{j}$&lt;/span&gt; are, in fact, useless since their input-output states are independent (note that this is a convex subset of EB channels, and this is &lt;em&gt;not&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-06-20T00:07:49.130" LastActivityDate="2020-06-20T00:07:49.130" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="12546" PostTypeId="2" ParentId="12536" CreationDate="2020-06-19T06:42:43.883" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;How is back-propagation done through the classical weights feeding into the quantum unitaries?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For example, given a variational quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U(\boldsymbol \theta)$&lt;/span&gt;&#xA;and some measured observable &lt;span class=&quot;math-container&quot;&gt;$\hat{B}$&lt;/span&gt;, the derivative of the expectation value&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \hat{B} \rangle (\boldsymbol\theta) =&#xA;    \langle 0 \mid U(\boldsymbol\theta)^\dagger \hat{B} U(\boldsymbol\theta) \mid 0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with respect to the input circuit parameters &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\theta}$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\nabla_{\theta_i}\langle \hat{B} \rangle(\boldsymbol\theta)&#xA;      =  \frac{1}{2}&#xA;            \left[&#xA;                \langle \hat{B} \rangle\left(\boldsymbol\theta + \frac{\pi}{2}\hat{\mathbf{e}}_i\right)&#xA;              - \langle \hat{B} \rangle\left(\boldsymbol\theta - \frac{\pi}{2}\hat{\mathbf{e}}_i\right)&#xA;            \right].$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the gradient of the expectation value can be calculated by evaluating the same variational&#xA;quantum circuit, but with shifted parameter values.&lt;/p&gt;&#xA;&lt;p&gt;To 'integrate' the quantum circuit into the larger classical ML model, we use &lt;a href=&quot;https://pennylane.ai&quot; rel=&quot;nofollow noreferrer&quot;&gt;PennyLane&lt;/a&gt;; which allows you to create an arbitrary hybrid classical-quantum ML model that supports backpropagation using either TensorFlow, PyTorch, or Autograd.&lt;/p&gt;&#xA;&lt;p&gt;In this particular case, two good resources are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_quantum_transfer_learning.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum transfer learning tutorial&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://github.com/XanaduAI/quantum-transfer-learning&quot; rel=&quot;nofollow noreferrer&quot;&gt;XanaduAI/quantum-transfer-learning&lt;/a&gt; GitHub repo, which contains the code for the numerical experiments in the paper.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How do they even calculate cross-entropy loss&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In this case, since PennyLane lets us use PyTorch to drive the overall model, we simply use &lt;a href=&quot;https://pytorch.org/docs/master/generated/torch.nn.CrossEntropyLoss.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;nn.CrossEntropyLoss()&lt;/code&gt;&lt;/a&gt; class provided by PyTorch.&lt;/p&gt;&#xA;&lt;h3&gt;References&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1803.00745&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum circuit learning&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1811.11184&quot; rel=&quot;nofollow noreferrer&quot;&gt;Evaluating analytic gradients on quantum hardware&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="371" LastActivityDate="2020-06-19T06:42:43.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12547" PostTypeId="1" CreationDate="2020-06-19T07:01:53.917" Score="0" ViewCount="110" Body="&lt;p&gt;Is there a way to use a ParamResolver or Sweep to assign values to the symbols in a parameterized Cirq circuit without running it?&lt;/p&gt;&#xA;&lt;p&gt;For example, something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#set up parameterized circuit&#xA;simulator = cirq.Simulator()&#xA;circuit = cirq.Circuit()&#xA;alpha = sympy.Symbol('alpha')&#xA;beta = sympy.Symbol('beta')&#xA;circuit.append(one_step(alpha, beta))&#xA;circuit.append(cirq.measure(*qubits, key='x'))&#xA;sweep = (cirq.Linspace(key='alpha', start=0.1, stop=0.9, length=5)&#xA;         * cirq.Linspace(key='beta', start=0.1, stop=0.9, length=5))&#xA;for param_resolver in study.to_resolvers(sweep):&#xA;     #resolve parameters&#xA;     *line that resolves the symbolic parameters in circuit using param_resolver*&#xA;     #run measurement simulations &#xA;     measurements = simulator.run(circuit=circuit, repetitions=100)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Instead of:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#set up parametrized circuit&#xA;simulator = cirq.Simulator()&#xA;circuit = cirq.Circuit()&#xA;alpha = sympy.Symbol('alpha')&#xA;beta = sympy.Symbol('beta')&#xA;circuit.append(one_step(alpha, beta))&#xA;circuit.append(cirq.measure(*qubits, key='x'))&#xA;sweep = (cirq.Linspace(key='alpha', start=0.1, stop=0.9, length=5)&#xA;         * cirq.Linspace(key='beta', start=0.1, stop=0.9, length=5))&#xA;for param_resolver in study.to_resolvers(sweep):&#xA;     #resolve parameters and run measurement simulations in one step&#xA;     measurements = simulator.run(circuit=circuit, param_resolver=param_resolver, repetitions=100)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12417" LastEditorUserId="55" LastEditDate="2020-06-21T09:43:42.307" LastActivityDate="2020-06-21T21:29:03.530" Title="How to assign values to the symbols in a parametrized Cirq circuit without running it?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12548" PostTypeId="2" ParentId="12540" CreationDate="2020-06-19T07:03:04.677" Score="2" Body="&lt;p&gt;GiannisKol is correct in an abstract sense -- you simply want to specify any unitary matrix with the first column containing elements &lt;span class=&quot;math-container&quot;&gt;$(\alpha,\beta,\gamma,\eta)$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;You have a couple of options for ways to proceed. One option is to rewrite the state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}}.&#xA;$$&lt;/span&gt;&#xA;To me, this instantly suggests one circuit. Start with a single-qubit rotation that rotates the first qubit as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\rightarrow\sqrt{|\alpha|^2+|\beta|^2}|0\rangle+\sqrt{|\gamma|^2+|\eta|^2}|1\rangle&#xA;$$&lt;/span&gt;&#xA;Now apply a single qubit rotation on the second qubit that rotates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\rightarrow\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}}&#xA;$$&lt;/span&gt;&#xA;Now, all you need is a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, controlled off the first qubit, targeting the second, where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; rotates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A second method is to make use of the Schmidt decomposition. Using that, you can find that your initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; may be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=U_1\otimes U_2(\delta_0|00\rangle+\delta_1|11\rangle).&#xA;$$&lt;/span&gt;&#xA;So, if we can produce &lt;span class=&quot;math-container&quot;&gt;$\delta_0|00\rangle+\delta_1|11\rangle$&lt;/span&gt;, then we just apply &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; on the first quit and &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; on the second, and we'll have made &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. How do we do this? Apply a single qubit unitary that rotates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\rightarrow \delta_0|0\rangle+\delta_1|1\rangle&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|00\rangle+|11\rangle)/\sqrt{2}.&#xA;$$&lt;/span&gt;&#xA;If you perform a generalised measurement with elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; applying. Then, finally, you apply &lt;span class=&quot;math-container&quot;&gt;$U_1\otimes U_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-06-19T07:18:23.717" LastActivityDate="2020-06-19T07:18:23.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12549" PostTypeId="2" ParentId="12540" CreationDate="2020-06-19T08:24:35.357" Score="0" Body="&lt;p&gt;You can prepare any arbitrary state with method described in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The method is based on application of &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; rotation for setting amplitudes and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; rotations for setting phases.&lt;/p&gt;&#xA;&lt;p&gt;The method is able to transform any state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; to another one &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; with intermediate step of transforming &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;. So in practise, only part transforming &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; is probably relevant as state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; is usually initial state of quatum registers.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-19T08:24:35.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12550" PostTypeId="1" AcceptedAnswerId="12551" CreationDate="2020-06-19T08:32:51.443" Score="1" ViewCount="396" Body="&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; 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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# initialising registers for readability&#xA;[control, train_register] = circ.qregs&#xA;&#xA;circ.h(control)&#xA;&#xA;# create and append oracle&#xA;oracle = create_oracle(train_register, control)  # returns an Instruction&#xA;circ.append(oracle, [train_register, control])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If my &lt;code&gt;train_register&lt;/code&gt; and &lt;code&gt;control&lt;/code&gt; are both &lt;code&gt;QuantumRegisters&lt;/code&gt; with length 1, this works perfectly fine. But I want to make this work for variable length of these registers, I get the error &lt;code&gt;qiskit.circuit.exceptions.CircuitError: 'The amount of qubit arguments does not match the instruction expectation.'&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is logical, since this error occurs because qiskit checks the length of my provided &lt;code&gt;qargs&lt;/code&gt; in &lt;code&gt;QuantumCircuit.append()&lt;/code&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;However, I want this to work for variable length. If I &lt;em&gt;know&lt;/em&gt; what the length of my &lt;code&gt;QuantumRegister&lt;/code&gt;s are, say &lt;code&gt;len(train_register)&lt;/code&gt; is 3 and &lt;code&gt;len(control)&lt;/code&gt; is 1 I can use&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ.append(oracle, [0, 1, 2, 3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or to make it work for unspecified lengths, I can write something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;indices_to_append_to = list(np.arange(len(train_register) + len(control)))&#xA;circ.append(oracle, indices_to_append_to)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But I just really like the idea of just plugging in the names of the &lt;code&gt;qregs&lt;/code&gt; as &lt;code&gt;qargs&lt;/code&gt;. Is there something to make this work like that?&lt;/p&gt;&#xA;" OwnerUserId="12194" LastEditorUserId="55" LastEditDate="2020-06-21T09:44:37.603" LastActivityDate="2020-06-21T09:44:37.603" Title="How to append an Instruction to a QuantumCircuit with variable length of QuantumRegisters as qargs?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12551" PostTypeId="2" ParentId="12550" CreationDate="2020-06-19T08:49:09.820" Score="2" Body="&lt;p&gt;If you pass a list of qubits instead of a list of register this works. For this do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ.append(oracle, train_register[:] + control[:])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;train_register&lt;/code&gt; and &lt;code&gt;control&lt;/code&gt; are &lt;code&gt;QuantumRegister&lt;/code&gt;s.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-06-19T08:49:09.820" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12552" PostTypeId="1" AcceptedAnswerId="12558" CreationDate="2020-06-19T10:53:56.673" Score="1" ViewCount="232" Body="&lt;p&gt;I have a circuit that generates a 4 qubit linear cluster.&lt;a href=&quot;https://i.stack.imgur.com/7N0h1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7N0h1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The steps i understand are&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialize the 4 qubits to &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply Hadamard &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on all.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then apply a controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate .&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;All this is clear, but what is not clear to me is&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What are the two Hadamards doing on wire 1 and 4? what does this mean?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;At the end of the circuit we get the state as &lt;span class=&quot;math-container&quot;&gt;$$|a\rangle=\frac{1}{2}(|0000\rangle+|0011\rangle+|1100\rangle-|1111\rangle)$$&lt;/span&gt;&#xA;Can somebody explain the two hadamards to me?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-07-14T16:55:58.523" LastActivityDate="2020-07-14T16:55:58.523" Title="Quantum Circuit explaination" Tags="&lt;circuit-construction&gt;&lt;graph-states&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12554" PostTypeId="1" CreationDate="2020-06-19T12:00:18.813" Score="2" ViewCount="46" Body="&lt;p&gt;Assuming I have a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|x_n\rangle$&lt;/span&gt; are quantum state vectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x_n\rangle = \frac{1}{\|x_n\|}\sum_i x_{in}|i\rangle$$&lt;/span&gt;&#xA;and that I have a unitary &lt;span class=&quot;math-container&quot;&gt;$U:|x_n\rangle \mapsto e^{2\pi i\theta_n}|x_n\rangle$&lt;/span&gt; such that I can use the phase estimation procedure to get the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle|\theta_n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Question:&#xA;I am wondering whether there is a way to compute the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle|n\rangle$$&lt;/span&gt;&#xA;I was thinking to modify the Phase Estimation Algorithm, but I still find it difficult to understand if I can prepare a unitary &lt;span class=&quot;math-container&quot;&gt;$U = \sum_n e^{2\pi in}|x_n\rangle\langle x_n|$&lt;/span&gt; for instance.&lt;br /&gt;&#xA;I am not insterested in ordering the vectors &lt;span class=&quot;math-container&quot;&gt;$|x_n\rangle$&lt;/span&gt; in any way, I just wonder if there is a way to index them easily.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="10259" LastEditorUserId="55" LastEditDate="2020-06-21T09:47:35.070" LastActivityDate="2020-07-22T09:00:40.067" Title="Indexing an &quot;unknown&quot; quantum state" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12555" PostTypeId="2" ParentId="12542" CreationDate="2020-06-19T13:00:27.460" Score="3" Body="&lt;p&gt;This is part of the &lt;strong&gt;Graph Coloring Kata&lt;/strong&gt;. The &lt;code&gt;InitializeColor&lt;/code&gt; is an operation that you must implement. The code above is part of the checker code to confirm the working of the implementation.&lt;/p&gt;&#xA;&lt;p&gt;The code is used to check if the &lt;code&gt;InitializeColor&lt;/code&gt; operation is implemented correctly. It is supposed to take an input &lt;code&gt;C&lt;/code&gt; denoting the color as an non-negative integer. It is supposed to apply a unitary to convert the state &lt;span class=&quot;math-container&quot;&gt;$|000...0\rangle$&lt;/span&gt; to state denoted by LittleEndian encoding of &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;InitializeColor&lt;/code&gt; operation is supposed to take a register which is in the state &lt;span class=&quot;math-container&quot;&gt;$|0..0\rangle$&lt;/span&gt; and applies a Unitary which transforms it into a register in the state &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt;. The nextline measures the register using the &lt;code&gt;MultiM&lt;/code&gt; operation.&#xA;The &lt;code&gt;Fact&lt;/code&gt; function essentially confirms if the measured result in the state &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt; and if not it print the error statement. The last line resets the register and brings it back to the state &lt;span class=&quot;math-container&quot;&gt;$|000..0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An example can be with &lt;span class=&quot;math-container&quot;&gt;$C=2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N=4$&lt;/span&gt;. Then &lt;code&gt;InitializeColor&lt;/code&gt; should apply a Unitary Operation which transform &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|0100\rangle$&lt;/span&gt; assuming LittleEndian encoding or &lt;span class=&quot;math-container&quot;&gt;$|0010\rangle$&lt;/span&gt; assuming BigEndian encoding.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-06-19T13:05:44.270" LastActivityDate="2020-06-19T13:05:44.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12556" PostTypeId="2" ParentId="9408" CreationDate="2020-06-19T13:22:34.250" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12357" LastActivityDate="2020-06-19T13:22:34.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12557" PostTypeId="1" AcceptedAnswerId="12559" CreationDate="2020-06-19T13:57:49.140" Score="4" ViewCount="71" Body="&lt;p&gt;Define &lt;span class=&quot;math-container&quot;&gt;$|\psi^{00}\rangle = \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi^{01}\rangle = \frac{1}{\sqrt2}(|00\rangle - |11\rangle)$&lt;/span&gt;, and consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |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}, $$&lt;/span&gt;&#xA;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?&lt;/p&gt;&#xA;&lt;p&gt;Essentially, I am asking if Bell states are locally distinguishable. If we consider &lt;span class=&quot;math-container&quot;&gt;$|\psi^{00}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi^{10}\rangle = \frac{1}{\sqrt2}(|01\rangle + |10\rangle)$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;Any help is appreciated.&lt;/p&gt;&#xA;" OwnerUserId="12421" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:23.157" LastActivityDate="2020-10-08T17:54:23.157" Title="Are Bell states distinguishable through LOCC?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;non-locality&gt;&lt;locc-operation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12558" PostTypeId="2" ParentId="12552" CreationDate="2020-06-19T14:16:09.507" Score="2" Body="&lt;p&gt;We need to go throught the gates one by one to understand what's happening.&#xA;We have to keep a few things in mind.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$H|0\rangle=\frac{1}{\sqrt2}(|0\rangle + |1\rangle) = |+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle=\frac{1}{\sqrt2}(|0\rangle - |1\rangle) = |-\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In the Hadamard basis the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate acts like the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. Namely &lt;span class=&quot;math-container&quot;&gt;$Z|+\rangle=|-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z|-\rangle=|+\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The controlled Z gate &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt; does the following here &lt;span class=&quot;math-container&quot;&gt;$cZ|0\rangle \otimes |\pm\rangle = |0\rangle \otimes |\pm\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$cZ|1\rangle \otimes |\pm\rangle = |1\rangle \otimes |\mp\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now we start in the state &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt; and this gets converted to &lt;span class=&quot;math-container&quot;&gt;$|++++\rangle$&lt;/span&gt; by the first column of Hadamard. Lets focus on the first 2 qubits. The &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt; gate takes the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$|++\rangle = \frac{1}{\sqrt2}(|0\rangle + |1\rangle)|+\rangle$&lt;/span&gt; and transforms it into&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The last expression can be derived using a expanding and rearranging of the terms.&lt;/p&gt;&#xA;&lt;p&gt;We now move onto the 2nd &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt; gate which is applied on the 2nd and 3rd qubit. Remember the 3rd and 4th qubit both are still in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. Application of the next &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt; state can be written as follows.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes cZ\frac{1}{\sqrt2}(|+\rangle \otimes |0\rangle + |-\rangle \otimes |1\rangle)|+\rangle \\&#xA;= \frac{1}{\sqrt2}(I|+\rangle \otimes cZ|0\rangle|+\rangle + I|-\rangle \otimes cZ|1\rangle|+\rangle) \\&#xA;= \frac{1}{\sqrt2}(|+\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|-\rangle) \\&#xA;= \frac{1}{2}(|+\rangle|0\rangle|0\rangle + |+\rangle|0\rangle|1\rangle + &#xA;|-\rangle|1\rangle|0\rangle - |-\rangle|1\rangle|1\rangle) \\&#xA;= \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle &#xA;+ (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle)\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We now apply the final &lt;span class=&quot;math-container&quot;&gt;$cZ$&lt;/span&gt; gate on the 3rd and 4th qubits. Remember the 4th qubit is still in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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 \\&#xA;= \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) \\&#xA;= \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) \\&#xA;= \frac{1}{2}\big(|+\rangle|0\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|0\rangle|+\rangle &#xA;+ |+\rangle|0\rangle|1\rangle|-\rangle - |-\rangle|1\rangle|1\rangle|-\rangle\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the final step is the application of the 2 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; again.&lt;/p&gt;&#xA;&lt;p&gt;Finally after applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on these qubits we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}H\otimes I \otimes I \otimes H\big(|+\rangle|0\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|0\rangle|+\rangle &#xA;+ |+\rangle|0\rangle|1\rangle|-\rangle - |-\rangle|1\rangle|1\rangle|-\rangle\big) \\&#xA;= \frac{1}{2}\big(|0\rangle|0\rangle|0\rangle|0\rangle + |1\rangle|1\rangle|0\rangle|0\rangle &#xA;+ |0\rangle|0\rangle|1\rangle|1\rangle - |1\rangle|1\rangle|1\rangle|1\rangle\big) \\&#xA;= \frac{1}{2}\big(|0000\rangle + |1100\rangle + |0011\rangle - |1111\rangle\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the exact answer as you said the circuit would give. Hence I suppose the purpose of the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is to convert the 1st and 4th qubits back into computational basis.&lt;/p&gt;&#xA;&lt;p&gt;I hope this answer's your question.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-06-19T14:16:09.507" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12559" PostTypeId="2" ParentId="12557" CreationDate="2020-06-19T14:33:42.390" Score="2" Body="&lt;p&gt;If you look at these states in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis, they are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|++\rangle+|--\rangle,\qquad |+-\rangle+|-+\rangle.&#xA;$$&lt;/span&gt;&#xA;Thus, by both measuring in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis and computing the parity of the answers, you can tell &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;'s bit value.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-19T14:33:42.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12560" PostTypeId="2" ParentId="12557" CreationDate="2020-06-19T14:49:26.373" Score="1" Body="&lt;p&gt;We can distinguish these states using SingleQubit Unitaries and Measurements.&lt;/p&gt;&#xA;&lt;p&gt;Lets the 2 states be &lt;span class=&quot;math-container&quot;&gt;$|\psi^{00}\rangle = \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi^{01}\rangle = \frac{1}{\sqrt2}(|00\rangle - |11\rangle)$&lt;/span&gt;. Let Alice be in possession of the 1st qubit and Bob be in possession of the 2nd qubit.&lt;/p&gt;&#xA;&lt;p&gt;Bob applies a &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on his qubit. This would result in the following states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes H|\psi^{00}\rangle = \frac{1}{\sqrt2}(|0\rangle \otimes |+\rangle + |1\rangle \otimes |-\rangle) &#xA;= \frac{1}{\sqrt2}(|0\rangle|+\rangle + |1\rangle|-\rangle) &#xA;= \frac{1}{\sqrt2}(|+\rangle|0\rangle + |-\rangle|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes H|\psi^{01}\rangle = \frac{1}{\sqrt2}(|0\rangle \otimes |+\rangle - |1\rangle \otimes |-\rangle) &#xA;= \frac{1}{\sqrt2}(|0\rangle|+\rangle - |1\rangle|-\rangle) &#xA;= \frac{1}{\sqrt2}(|-\rangle|0\rangle + |+\rangle|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now Bob performs a measurement on his qubit.&#xA;If the initial state was &lt;span class=&quot;math-container&quot;&gt;$|\psi^{00}\rangle$&lt;/span&gt; then the result of the measurement could be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and Alice's qubit would be &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, if the initial state was &lt;span class=&quot;math-container&quot;&gt;$|\psi^{01}\rangle$&lt;/span&gt; then the result of the measurement could be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and Alice's qubit would be &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state respectively.&lt;/p&gt;&#xA;&lt;p&gt;Now Alice can apply the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on her qubit and then perform a Measurement on it.&#xA;If Bob's and Alice's results were &lt;span class=&quot;math-container&quot;&gt;$(0,0)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt; then the initial state was &lt;span class=&quot;math-container&quot;&gt;$|\psi^{00}\rangle$&lt;/span&gt;. On the other hand if Bob's and Alice's results were &lt;span class=&quot;math-container&quot;&gt;$(0,1)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(1,0)$&lt;/span&gt; then the initial state was &lt;span class=&quot;math-container&quot;&gt;$|\psi^{01}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hence we can now formulate an Algorithm for distinguishing the phase.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bob applies &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on his qubit.&lt;/li&gt;&#xA;&lt;li&gt;Bob performs a measurement and sends the result of the measurement to Alice.&lt;/li&gt;&#xA;&lt;li&gt;Alice applies &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on her qubit.&lt;/li&gt;&#xA;&lt;li&gt;Alice performs a measurement and sends the result of the measurement to Bob.&lt;/li&gt;&#xA;&lt;li&gt;Now if their results were the same then the state was &lt;span class=&quot;math-container&quot;&gt;$|\psi^{00}\rangle$&lt;/span&gt; else it was &lt;span class=&quot;math-container&quot;&gt;$|\psi^{01}\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-06-19T14:49:26.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12563" PostTypeId="1" AcceptedAnswerId="12577" CreationDate="2020-06-19T16:26:19.930" Score="1" ViewCount="45" Body="&lt;p&gt;On page 560, it states that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}|)).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, shouldn't this be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}|)).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as on the same page it states that if &lt;span class=&quot;math-container&quot;&gt;$\varepsilon(|{\psi_{j}}\rangle\langle{\psi_{j}}|) = p|{\psi_{j}}\rangle\langle{\psi_{j}}|+(1-p)\frac{I}{2}$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$S(\varepsilon(|{\psi_{j}}\rangle\langle{\psi_{j}}|)) = H(\frac{1+p}{2})$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$C(\varepsilon)=1-H(\frac{1-p}{2})$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:18.850" LastActivityDate="2020-10-08T17:54:18.850" Title="Confusion over HSW theorem depicted in Nielsen and Chuang" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12564" PostTypeId="1" CreationDate="2020-06-19T16:56:53.453" Score="4" ViewCount="113" Body="&lt;p&gt;How do I optimize HHL algorithm in Qiskit?&lt;/p&gt;&#xA;&lt;p&gt;I tried to follow &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/legacy_tutorials/aqua/linear_systems_of_equations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial on HHL in Qiskit&lt;/a&gt;. My project requires solving a very specific type of linear equations &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; like the one below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b = np.array( [ 0.   ,  0.   ,  2.25 ,  0.   ,  0.   ,  0.   , -4.285,  0.   ])&#xA;A = np.array([[ 1.   ,  0.333,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ],&#xA;              [ 0.   ,  1.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ],&#xA;              [ 0.   ,  0.   ,  1.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ],&#xA;              [ 0.   ,  0.   ,  0.143,  1.   ,  0.   ,  0.   ,  0.   ,  0.   ],&#xA;              [-0.333, -1.   ,  0.   ,  0.   ,  1.   ,  0.333,  0.   ,  0.   ],&#xA;              [-0.25 , -1.5  , -0.25 ,  0.   ,  0.   ,  1.   ,  0.   ,  0.   ],&#xA;              [ 0.   , -0.562, -0.875, -0.562,  0.   ,  0.   ,  1.   ,  0.   ],&#xA;              [ 0.   ,  0.   , -1.   , -0.143,  0.   ,  0.   ,  0.143,  1.   ]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, I only obtain a fidelity of around 0.7 - 0.8, which is not good enough for what I would like to do.&lt;/p&gt;&#xA;&lt;p&gt;I notice the tutorial has a function called &lt;code&gt;create_eigs&lt;/code&gt; with input parameters &lt;code&gt;num_ancillae&lt;/code&gt;, &lt;code&gt;num_time_slices&lt;/code&gt;, &lt;code&gt;negative_evals&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def create_eigs(matrix, num_ancillae, num_time_slices, negative_evals):&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What are they really? And what are their appropriate values?&lt;/p&gt;&#xA;" OwnerUserId="9903" LastEditorUserId="55" LastEditDate="2020-06-21T09:49:59.970" LastActivityDate="2020-09-22T17:55:59.410" Title="How do I optimize HHL algorithm in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12566" PostTypeId="2" ParentId="12552" CreationDate="2020-06-19T19:11:58.743" Score="2" Body="&lt;p&gt;Because &lt;span class=&quot;math-container&quot;&gt;$CNOT = I\otimes H \cdot CZ \cdot I\otimes H$&lt;/span&gt; as was mentioned &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12460/9459&quot;&gt;here&lt;/a&gt;, and because &lt;span class=&quot;math-container&quot;&gt;$CZ(q_1, q_2) = CZ(q_2, q_1)$&lt;/span&gt;, we can rewrite the circuit in this way (by adding Hadamards as needed):&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/5RSpa.png&quot; width=&quot;300&quot; /&gt;&#xA;&lt;p&gt;The link to the &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B1,%22H%22%5D,%5B%22X%22,%22%E2%80%A2%22%5D,%5B1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22H%22%5D,%5B1,1,%22%E2%80%A2%22,%22X%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt; created with Quirk. As one can see from the circuit above, after the first Hadamard gate and two &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates, we will have a GHZ state for the first three qubits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_1 \rangle = \frac{1}{\sqrt{2}} \left( |000\rangle + |111\rangle\right) |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After the Hadamard gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_2 \rangle = \frac{1}{2} \big( | 000 \rangle + | 001 \rangle + | 110 \rangle - | 111 \rangle \big) |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And after the final &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_3 \rangle = \frac{1}{2} \big( | 0000 \rangle + | 0011 \rangle + | 1100 \rangle - | 1111 \rangle \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-06-19T19:11:58.743" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12567" PostTypeId="1" CreationDate="2020-06-19T19:48:53.403" Score="-1" ViewCount="150" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12425" LastEditorUserId="9006" LastEditDate="2020-06-24T07:46:24.527" LastActivityDate="2020-06-24T07:46:24.527" Title="Difference between $Rz$ and $R1$ gate" Tags="&lt;quantum-gate&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-06-24T15:40:15.363" ContentLicense="CC BY-SA 4.0" />
  <row Id="12568" PostTypeId="1" CreationDate="2020-06-19T21:36:59.523" Score="1" ViewCount="46" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;So how do I decide which Rotations and what seeds to use?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ControlledRotation((0, new Int[0]), PauliY, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I tried using this as the rotation gate but it gave an inaccurate model for many different seed values.&lt;/p&gt;&#xA;&lt;p&gt;I also tried combining gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ControlledRotation((0, new Int[0]), PauliY, 0),&#xA;ControlledRotation((0, new Int[0]), PauliX, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but this also gave an inaccurate model.&lt;/p&gt;&#xA;&lt;p&gt;There must surely be a way to analyse what kind of gates to use and not just trial and error.&#xA;What kind of analysis would be appropriate?&lt;/p&gt;&#xA;" OwnerUserId="12355" LastEditorUserId="55" LastEditDate="2020-06-21T09:50:17.650" LastActivityDate="2020-06-21T09:50:17.650" Title="How do you decide which rotations to use in a Quantum Machine Learning model?" Tags="&lt;programming&gt;&lt;q#&gt;&lt;machine-learning&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12569" PostTypeId="1" AcceptedAnswerId="12570" CreationDate="2020-06-20T03:38:16.973" Score="2" ViewCount="222" Body="&lt;p&gt;In two dimensions, for a density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and probability &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, a depolarizing channel can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho) = (1-\lambda) \frac{\mathbb{I}}{2} + \lambda\rho$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_depolarizing_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; should be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-\frac{1}{d^2 - 1} \le \lambda \le 1&#xA;$$&lt;/span&gt;&#xA;Any pointers about how to prove that a depolarizing channel is CPTP?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="491" LastEditDate="2020-07-17T23:22:58.080" LastActivityDate="2020-07-17T23:22:58.080" Title="Prove that the depolarizing channel is completely positive" Tags="&lt;quantum-operation&gt;&lt;noise&gt;&lt;textbook-and-exercises&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12570" PostTypeId="2" ParentId="12569" CreationDate="2020-06-20T04:03:11.483" Score="2" Body="&lt;p&gt;Ok, so starting with Trace Preserving, since it's easier:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(I/2) = 1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho) = 1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr((1-\lambda)I/2 + \lambda\rho) = (1-\lambda)Tr(I/2) + \lambda Tr(\rho) = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Lambda_0$&lt;/span&gt; now has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda\Lambda_0 + \frac{(1-\lambda)}{2}$&lt;/span&gt; which will also be positive.&lt;/p&gt;&#xA;&lt;p&gt;So since it preserves positivity and trace, its CPTP.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-06-20T04:03:11.483" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12571" PostTypeId="1" CreationDate="2020-06-20T04:08:56.750" Score="4" ViewCount="165" Body="&lt;p&gt;After reading &lt;a href=&quot;https://algassert.com/circuits/2015/06/22/Using-Quantum-Gates-instead-of-Ancilla-Bits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;about using quantum gates instead of ancillas&lt;/a&gt;, it asserts that every quantum circuit has a &lt;em&gt;square root&lt;/em&gt;. 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt[2^k]{QFT}$$&lt;/span&gt;&#xA;Has a concise, practical representation as a quantum circuit. Besides from diagonalizing the matrix by hand and then using the sledgehammer of &lt;a href=&quot;https://arxiv.org/abs/1501.06911&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum circuits for arbitrary isometries&lt;/a&gt;, i see no other possible method.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia says&lt;/a&gt;: &amp;quot;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&amp;quot; but provides no proof or associated reference to that claim.&lt;/p&gt;&#xA;&lt;p&gt;Help and insights are greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="12430" LastEditorUserId="55" LastEditDate="2020-06-21T09:54:36.777" LastActivityDate="2020-06-22T17:53:33.327" Title="How to find a circuit for the roots of QFT?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12572" PostTypeId="1" AcceptedAnswerId="12818" CreationDate="2020-06-20T04:16:59.967" Score="2" ViewCount="55" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$m \times n$&lt;/span&gt; size depending on the limitations of the simulation. From here I would like the hard coded gate to transform my register of qubits.&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="55" LastEditDate="2020-06-21T09:54:51.503" LastActivityDate="2020-07-07T21:24:16.007" Title="Is it possible to create a gate in Q# that is dictated by a matrix?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12573" PostTypeId="2" ParentId="12520" CreationDate="2020-06-20T04:21:06.340" Score="1" Body="&lt;p&gt;In VS code, you have to manually add the package in the .csproj file under Item Group:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;PackageReference Include=&amp;quot;Microsoft.Quantum.MachineLearning&amp;quot; Version=&amp;quot;0.11.2006.403&amp;quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or alternatively, you can also add it in the terminal:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dotnet add [project_name].csproj package Microsoft.Quantum.MachineLearning&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9906" LastActivityDate="2020-06-20T04:21:06.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12574" PostTypeId="1" AcceptedAnswerId="12612" CreationDate="2020-06-20T05:07:47.817" Score="1" ViewCount="69" Body="&lt;p&gt;I would like to create a set of basis qubits. For example if I have &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; I should get 4 states being 01 10 11 00. Generalized for &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. Is there a way to do this in Q#?&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="55" LastEditDate="2020-06-21T09:55:01.167" LastActivityDate="2020-06-22T19:49:01.853" Title="How can I create a basis state of $n$ qubits in Q#?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12577" PostTypeId="2" ParentId="12563" CreationDate="2020-06-20T08:36:23.657" Score="2" Body="&lt;p&gt;Adding my comment as an answer: I think this is a &lt;em&gt;typo&lt;/em&gt;. The equation contains a scalar, namely &lt;span class=&quot;math-container&quot;&gt;$S(\cdot)$&lt;/span&gt; and an operator, the output of the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\cdot)$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-06-20T08:36:23.657" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12578" PostTypeId="2" ParentId="12569" CreationDate="2020-06-20T08:58:41.097" Score="2" Body="&lt;p&gt;Here's an alternative proof: first note that any quantum map, &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho) \mapsto \sigma$&lt;/span&gt; that can be written in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_operation#Kraus_operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kraus form&lt;/a&gt;, that is, as &lt;span class=&quot;math-container&quot;&gt;$\Phi(\cdot) = \sum_{j} K_j (\cdot) K_j^\dagger$&lt;/span&gt;, with, &lt;span class=&quot;math-container&quot;&gt;$K_j^\dagger K_j \geq 0, \sum_j K_j^\dagger K_j = \mathbb{I}$&lt;/span&gt; is a CP map (see for example, Nielsen and Chuang, or Page 26 of &lt;a href=&quot;https://arxiv.org/abs/1902.00967&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1902.00967&lt;/a&gt;). This is also the &amp;quot;usual&amp;quot; way to prove CP-ness: find a set of Kraus operators for the map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; that satisfy the above condition. Also, note that the TP part is straightforward since you can just take the trace of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho)$&lt;/span&gt; and show that is it &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, note that &lt;span class=&quot;math-container&quot;&gt;$\rho+X \rho X+Y \rho Y+Z \rho Z=2 I$&lt;/span&gt;, therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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). $$&lt;/span&gt;&#xA;Then, we can see that the Kraus operators are &lt;span class=&quot;math-container&quot;&gt;$K_{0} = \frac{1}{2} \sqrt{1 + 3 \lambda} \mathbb{I}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$K_{i} = \frac{1}{2} \sqrt{(1- \lambda)} \sigma_{i}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1,2,3$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{ \sigma_{i} \}$&lt;/span&gt; are the sigma matrices. Hence this map is CP because it has a Kraus representation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The Kraus operator form also reveals why in &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, the limit for CP is &lt;span class=&quot;math-container&quot;&gt;$-1/3 \leq \lambda \leq 1$&lt;/span&gt; (note the square roots in the Kraus representation). This can be generalized to &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensions.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-06-21T20:02:09.850" LastActivityDate="2020-06-21T20:02:09.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12580" PostTypeId="1" AcceptedAnswerId="12595" CreationDate="2020-06-20T09:45:18.103" Score="1" ViewCount="41" Body="&lt;p&gt;I am searching for articles/books about the measurement energy of Hamiltonians in adiabatic quantum computing. Do you know of any good resources?&lt;/p&gt;&#xA;" OwnerUserId="9842" LastEditorUserId="55" LastEditDate="2020-06-21T10:08:10.797" LastActivityDate="2020-06-22T00:10:02.243" Title="Books about the measurement for Hamiltonian Energy" Tags="&lt;measurement&gt;&lt;resource-request&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12581" PostTypeId="2" ParentId="12574" CreationDate="2020-06-20T11:56:58.030" Score="1" Body="&lt;p&gt;To get a superposition of all the possible states, each qubit has an equal probability of being a 0/1.&#xA;So you apply a Hadamard gate to each qubit.&lt;/p&gt;&#xA;&lt;p&gt;In Q# :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;using(qubits = Qubit[N])&#xA;{&#xA;    for(q in qubits)&#xA;    {&#xA;        H(q);&#xA;    }&#xA;    // Now the qubits are in a superposition of all possible states.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12355" LastActivityDate="2020-06-20T11:56:58.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12583" PostTypeId="2" ParentId="1577" CreationDate="2020-06-20T20:42:42.507" Score="1" Body="&lt;p&gt;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 &amp;quot;universal&amp;quot; quantum annealer, in the sense that it can't operate perfectly at all &amp;quot;temperatures&amp;quot;/levels of adiabaticity. In other words, it can (allegedly) perform &lt;em&gt;some&lt;/em&gt; types of quantum annealing, but not &lt;em&gt;all&lt;/em&gt; of them.&lt;/p&gt;&#xA;&lt;p&gt;In particular, it can't perform the most useful form of quantum annealing of all - the perfectly adiabatic case (&amp;quot;zero temperature&amp;quot;/no quantum fluctuations out of the ground state). If it could, then it would indeed be (equivalent to) a universal quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-06-20T20:42:42.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12584" PostTypeId="1" CreationDate="2020-06-20T21:08:14.970" Score="4" ViewCount="35" Body="&lt;p&gt;Quantum annealing can be considered either in the perfectly adiabatic &amp;quot;slow&amp;quot; limit (in which case it's usually referred as &amp;quot;adiabatic quantum computing&amp;quot; (AQC) instead of &amp;quot;quantum annealing&amp;quot;), or in the diabatic regime of diabatic quantum annealing (DQA).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, I could also imaging telling a heuristic story in which in some cases the diabatic effects can &lt;em&gt;help&lt;/em&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For all problems, AQC is at least as powerful as DQA.&lt;/li&gt;&#xA;&lt;li&gt;For all problems, DQA is at least as powerful as AQC.&lt;/li&gt;&#xA;&lt;li&gt;For some problems, AQC gives a qualitative speedup over DQA, and for other problems, DQA gives a qualitative speedup over AQC.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="551" LastActivityDate="2020-06-20T21:08:14.970" Title="Is either the adiabatic or the diabatic version of quantum annealing known to be theoretically more powerful than the other?" Tags="&lt;complexity-theory&gt;&lt;speedup&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12585" PostTypeId="1" AcceptedAnswerId="12591" CreationDate="2020-06-20T23:14:21.420" Score="5" ViewCount="215" Body="&lt;p&gt;I was wondering in how to interpret and represent the operator &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$&lt;/span&gt; for a 3 qubit system in a circuit using qiskit.&lt;/p&gt;&#xA;&lt;p&gt;I was thinking I could just perform an individual &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; degree rotation about each qubit Z axis but what about the identity? &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta I} = \begin{bmatrix}&#xA;e^{-i \theta } &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ &#xA;0 &amp;amp;  e^{-i\theta}&amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ &#xA; 0 &amp;amp; 0 &amp;amp; e^{-i\theta} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\ &#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{-i\theta} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{-i\theta} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\ &#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;e^{-i\theta} &amp;amp; 0 &amp;amp; 0  \\ &#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;e^{-i\theta}  &amp;amp; 0 \\  &#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{-i\theta}&#xA;\end{bmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can construct this operator with the identity operator in 2 qubits and one identity with a global phase &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta}$&lt;/span&gt;. Isn't this just an identity with a global phase factor?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="9459" LastEditDate="2020-06-21T13:43:56.407" LastActivityDate="2020-07-09T22:37:34.750" Title="Representation of rotation operators $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ about arbitrary axis for $3$ qubits" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12587" PostTypeId="2" ParentId="12585" CreationDate="2020-06-21T01:07:00.040" Score="3" Body="&lt;p&gt;You're right, that this factor can be separated as an operation that applies a global phase factor. Matrix exponentiation is &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_exponential#Elementary_properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;distributive over an additive argument if and and only if the additive terms commute&lt;/a&gt;. The identity operator and the scalar &lt;span class=&quot;math-container&quot;&gt;$-i\theta$&lt;/span&gt;, 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, &lt;span class=&quot;math-container&quot;&gt;$e^{-i\theta I}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta Z_1 Z_2 Z_3}$&lt;/span&gt;, to the quantum register in either order of application, applied by successive left multiplication on the initial quantum register &amp;quot;ket&amp;quot; in this case, from rightmost term.&lt;/p&gt;&#xA;&lt;p&gt;Further, &lt;a href=&quot;https://en.wikipedia.org/wiki/Phase_factor&quot; rel=&quot;nofollow noreferrer&quot;&gt;a global phase factor does not change the expectation values of Hermitian observables&lt;/a&gt;. Hence, I can think of no physically measurable reason this factor need not be dropped entirely from the circuit, (except classical simulator bookkeeping).&lt;/p&gt;&#xA;&lt;p&gt;However, if this operator is controlled by any number of control qubits, disjoint from the set enumerated by your &lt;span class=&quot;math-container&quot;&gt;$Z_n$&lt;/span&gt; operators, then the application of the phase factor is logically conditioned on these control bits being &amp;quot;true.&amp;quot; Since the phase factor wouldn't be applied to basis states where the control bits are &amp;quot;false,&amp;quot; the phase factor would no longer be &amp;quot;global&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$Z_n$&lt;/span&gt; operators, though, so your matrix exponentiation still distributes.&lt;/p&gt;&#xA;" OwnerUserId="7595" LastEditorUserId="7595" LastEditDate="2020-07-09T22:37:34.750" LastActivityDate="2020-07-09T22:37:34.750" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12589" PostTypeId="2" ParentId="12534" CreationDate="2020-06-21T07:17:07.443" Score="0" Body="&lt;p&gt;If your circuit is a component of a larger circuit then global phase may matter. See relevant discussions in &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/issues/353&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/issues/353&lt;/a&gt; and &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/3083&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/3083&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-06-21T07:17:07.443" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12590" PostTypeId="2" ParentId="9428" CreationDate="2020-06-21T08:05:15.903" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.apress.com/gp/book/9781484242179&quot; rel=&quot;nofollow noreferrer&quot;&gt;Practical Quantum Computing for Developers&lt;/a&gt; by Vladimir Silva, starting at page 101. Here are some examples of these methods:&lt;/p&gt;&#xA;&lt;p&gt;You have to log to your account:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl -d 'apiToken=API_TOKEN' 'https://api.quantum-computing.ibm.com/api/users/loginWithToken'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;where the &lt;code&gt;API_TOKEN&lt;/code&gt; can be copied from your account information.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The answer to this request will give you four fields &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;ttl&lt;/code&gt;, &lt;code&gt;created&lt;/code&gt; and &lt;code&gt;userId&lt;/code&gt;. The &lt;code&gt;id&lt;/code&gt; field will be referred to below as &lt;code&gt;ACCESS_TOKEN&lt;/code&gt; while &lt;code&gt;userId&lt;/code&gt; will be referred to as &lt;code&gt;USER_ID&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;list of all backends:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl 'https://api.quantum-computing.ibm.com/api/Backends?access_token=ACCESS_TOKEN'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;personal infos:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl 'https://api.quantum-computing.ibm.com/api/users/USER_ID?access_token=ACCESS_TOKEN'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;latest experiences:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl 'https://api.quantum-computing.ibm.com/api/users/USER_ID/codes/latest?access_token=ACCESS_TOKEN&amp;amp;includeExecutions=true'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;&lt;p&gt;You may have a look at my current project &lt;a href=&quot;https://gitlab.com/baruchel/ibmq-shell&quot; rel=&quot;nofollow noreferrer&quot;&gt;ibmq-shell&lt;/a&gt; which contains shell aliases for interacting with the API with common tools (&lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;jq&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="12446" LastEditorUserId="12446" LastEditDate="2020-06-21T09:26:33.953" LastActivityDate="2020-06-21T09:26:33.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12591" PostTypeId="2" ParentId="12585" CreationDate="2020-06-21T09:41:20.103" Score="5" Body="&lt;p&gt;We can't implement &lt;span class=&quot;math-container&quot;&gt;$e^{iZ_1 \otimes Z_2 \otimes Z_3 \theta}$&lt;/span&gt; with three separate rotations. In other words:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The implementation of this gate can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt;. The &lt;span class=&quot;math-container&quot;&gt;$e^{-iI \otimes I \otimes I\theta} = e^{-i\theta} I \otimes I \otimes I$&lt;/span&gt; term is a global phase gate and can be ignored for the case described in the question.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;An implementation with Qiskit:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;&#xA;theta = 1.7&#xA;pauli_dict = {'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: theta}, &amp;quot;label&amp;quot;: &amp;quot;ZZZ&amp;quot;},&#xA;                         {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -theta}, &amp;quot;label&amp;quot;: &amp;quot;III&amp;quot;}&#xA;                         ]&#xA;              }&#xA;operator = WeightedPauliOperator.from_dict(pauli_dict)&#xA;circuit = operator.evolve(evo_time=1).decompose()&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q3_0: ──■─────────────────────────■──&#xA;      ┌─┴─┐                     ┌─┴─┐&#xA;q3_1: ┤ X ├──■───────────────■──┤ X ├&#xA;      └───┘┌─┴─┐┌─────────┐┌─┴─┐└───┘&#xA;q3_2: ─────┤ X ├┤ U1(3.4) ├┤ X ├─────&#xA;           └───┘└─────────┘└───┘     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That coincides with the ideas discussed in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9459&quot;&gt;answer&lt;/a&gt; (&lt;span class=&quot;math-container&quot;&gt;$u1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gates are different just by a global phase). Note, that here &lt;span class=&quot;math-container&quot;&gt;$e^{-iI\theta}$&lt;/span&gt; is a global phase and can be neglected (as was done in the circuit). However, as was discussed in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11406/9459&quot;&gt;answer&lt;/a&gt; the controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{-i I \theta}$&lt;/span&gt; should be implemented if one needs to construct controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{-i H \theta}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a sum of tensor product terms of Pauli matrices with real coefficients (like &lt;span class=&quot;math-container&quot;&gt;$H = I - Z\otimes Z\otimes Z$&lt;/span&gt; in the question's example) and one of the terms is &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. Also, note that the code presented above works only for such &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; whose terms commute. For more general cases one should also specify the rest of the arguments of the &lt;code&gt;evolve&lt;/code&gt; method in order to implement for example first-order Trotter decomposition.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-21T11:58:32.130" LastActivityDate="2020-06-21T11:58:32.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12592" PostTypeId="1" AcceptedAnswerId="12641" CreationDate="2020-06-21T09:42:44.493" Score="2" ViewCount="34" Body="&lt;p&gt;I'm training a model in Q# which has more than 2 features. &lt;br&gt;&#xA;I have trouble understanding the following things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How is the data classified based on the qubit states?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&lt;br&gt; 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).&#xA;&lt;br&gt;&lt;br&gt;&#xA;But now if I have say 4 features then 2 qubits would be used and i could have 4 possible outcomes:&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle,\quad  |01\rangle,\quad  |10\rangle,\quad  |11\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So how would the data be classified based on these states?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Also am I correct in thinking that all the qubits are measured or is only 1 qubit measured and classified as class A/B?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12355" LastEditorUserId="55" LastEditDate="2020-06-25T08:16:19.437" LastActivityDate="2020-06-25T08:16:19.437" Title="What's the relationship between output of qubit measurements and classification of data in Quantum Machine Learning?" Tags="&lt;q#&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12593" PostTypeId="1" AcceptedAnswerId="12596" CreationDate="2020-06-21T11:26:26.480" Score="6" ViewCount="78" Body="&lt;p&gt;Disclaimer:  I don't understand quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;Given a CNF boolean formula &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; variables&#xA;and quantum computer with &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; qubits, what is the&#xA;complexity of solving &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; as a function of &lt;span class=&quot;math-container&quot;&gt;$n,q$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I am mainly interested when &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can we get &lt;span class=&quot;math-container&quot;&gt;$2^{o(n)}$&lt;/span&gt; (small Oh, &lt;a href=&quot;https://en.wikipedia.org/wiki/Exponential_time_hypothesis&quot; rel=&quot;nofollow noreferrer&quot;&gt;Exponential time hypothesis&lt;/a&gt;)?&lt;/p&gt;&#xA;&lt;p&gt;I believe on a traditional computer the complexity is &lt;span class=&quot;math-container&quot;&gt;$C^n$&lt;/span&gt;&#xA;for a constant &lt;span class=&quot;math-container&quot;&gt;$C &amp;lt; 2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12448" LastEditorUserId="12448" LastEditDate="2020-06-22T16:06:36.147" LastActivityDate="2020-06-23T06:18:56.843" Title="State of the art of SAT on a quantum computer" Tags="&lt;complexity-theory&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12594" PostTypeId="2" ParentId="12547" CreationDate="2020-06-21T21:29:03.530" Score="1" Body="&lt;p&gt;You're looking for &lt;code&gt;cirq.resolve_parameters(object, resolver)&lt;/code&gt;, which returns the object after the parameters have been resolved. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import sympy&#xA;&#xA;q = cirq.LineQubit(0)&#xA;s = sympy.Symbol('s')&#xA;&#xA;symbol_op = cirq.X(q)**s&#xA;resolved_op = cirq.resolve_parameters(symbol_op, {s: 0.25})&#xA;print(resolved_op)&#xA;# X**0.25(0)&#xA;&#xA;symbol_circuit = cirq.Circuit(symbol_op, cirq.measure(q))&#xA;resolved_circuit = cirq.resolve_parameters(symbol_circuit, {s: 0.5})&#xA;print(resolved_circuit)&#xA;# 0: ───X^0.5───M───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-06-21T21:29:03.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12595" PostTypeId="2" ParentId="12580" CreationDate="2020-06-22T00:10:02.243" Score="1" Body="&lt;p&gt;We can find a number of good articles on Hamiltonians in Adiabatic Quantum Computing. Please let me share a few prominent articles here.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1808.07177&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamiltonian engineering for adiabatic quantum computation: Kazutaka Takahashi&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/0806.0385&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adiabatic Quantum Computation with a 1D projector Hamiltonian&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.researchgate.net/publication/329182120_Non-diagonal_problem_Hamiltonian_for_adiabatic_quantum_computation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Non-diagonal problem Hamiltonian for adiabatic quantum computation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.78.012352&quot; rel=&quot;nofollow noreferrer&quot;&gt;Realizable Hamiltonians for universal adiabatic quantum computers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-06-22T00:10:02.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12596" PostTypeId="2" ParentId="12593" CreationDate="2020-06-22T01:31:07.013" Score="4" Body="&lt;p&gt;This is an open question. People who try to prove &lt;span class=&quot;math-container&quot;&gt;$\text{BQP} = \text{NP}$&lt;/span&gt; usually use the SAT formulation, in my experience. But we don't know of any algorithm that addresses the structure of the SAT problem.&lt;/p&gt;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="9006" LastEditDate="2020-06-22T10:07:01.963" LastActivityDate="2020-06-22T10:07:01.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12597" PostTypeId="1" CreationDate="2020-06-22T01:56:05.303" Score="1" ViewCount="15" Body="&lt;p&gt;In the context of superconducting quantum computing measuments, consider the dispersive shift Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H/\hbar = \omega_R a^\dagger a + \frac{1}{2} (\omega_Q + \frac{2g^2}{\Delta} a^\dagger a)\sigma^z $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we interpret the dispersive shift as a change in the qubit frequency. What happens when we just keep adding photons into the resonator?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="1867" LastEditorUserId="9006" LastEditDate="2020-06-22T10:07:34.030" LastActivityDate="2020-06-22T10:07:34.030" Title="Many-photon limit of dispersive shift Hamiltionian" Tags="&lt;measurement&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12598" PostTypeId="1" AcceptedAnswerId="12599" CreationDate="2020-06-22T05:10:25.017" Score="1" ViewCount="48" Body="&lt;p&gt;Given a single-qubit unitary matrix, can we find the shortest sequence of Clifford + T gates that correspond to that unitary?&lt;/p&gt;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://arxiv.org/abs/1206.5236&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast and efficient exact synthesis of single qubit unitaries generated by Clifford and T gates&lt;/a&gt; , which is Solovay-Kitaev decomposition, I learned single-qubit decomposition may need &lt;span class=&quot;math-container&quot;&gt;$O(\log^{3.97} (1/\delta))$&lt;/span&gt; clifford+T gates with the accuracy &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And later many optimization is worked on it.&#xA;For example:&#xA;&lt;a href=&quot;https://arxiv.org/pdf/1306.3200.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Synthesis of unitaries with Clifford+T circuits&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&#xA;If it existed, what is commonly used in current compiler?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-10-05T13:42:04.157" LastActivityDate="2020-10-05T13:42:04.157" Title="What is the shortest sequence of decomposition a given single-qubit unitary gate" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12599" PostTypeId="2" ParentId="12598" CreationDate="2020-06-22T07:17:26.360" Score="3" Body="&lt;p&gt;In the abstract of the first paper you cite (which, incidentally, is &lt;em&gt;not&lt;/em&gt; Solovay-Kitaev, it's an improvement), they say&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We report an efficient synthesis algorithm, with an exact optimality guarantee on the number of Hadamard and T gates used&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In other words, this is the best that can be done. It yields the shortest possible sequence. This best is &lt;span class=&quot;math-container&quot;&gt;$O(\log\frac{1}{\delta})$&lt;/span&gt; Hadamard + T.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-22T07:17:26.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12600" PostTypeId="2" ParentId="12571" CreationDate="2020-06-22T07:41:04.680" Score="1" Body="&lt;p&gt;Existence (as mentioned on Wikipedia, for example), is easy, although not necessarily unique. Any unitary can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\sum_ie^{i\theta_i}P_i&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are projectors such that &lt;span class=&quot;math-container&quot;&gt;$\sum_iP_i=1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\theta_i$&lt;/span&gt; is in the range 0 to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. Then we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{U}=\sum_ie^{i\theta_i/2}P_i.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to create a circuit for &lt;span class=&quot;math-container&quot;&gt;$\sqrt{U}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One method (even if you don't know anything about the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) is that if you can implement &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; then you can implement controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (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 &lt;a href=&quot;https://arxiv.org/abs/0810.3843&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One simplification that you can make is that if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=VWV^\dagger,&#xA;$$&lt;/span&gt;&#xA;then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{U}=V\sqrt{W}V^\dagger,&#xA;$$&lt;/span&gt;&#xA;so if you have your circuit and can find a big section corresponding to &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, you can remove it and just worry about implementing the square root of the remaining component &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;can&lt;/em&gt; compute higher powers more efficiently: you get Shor's factoring algorithm! (The point being that phase estimation becomes vastly more efficient.) If you &lt;em&gt;could&lt;/em&gt; generically do better, you could apply phase estimation to Grover's search and you'd have a faster search algorithm.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-22T07:41:04.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12601" PostTypeId="2" ParentId="12554" CreationDate="2020-06-22T08:17:18.390" Score="1" Body="&lt;p&gt;The root of the issue here is how do you map between the values &lt;span class=&quot;math-container&quot;&gt;$\theta_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. &lt;em&gt;A priori&lt;/em&gt; there is no way of doing this because the values &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; are a completely abstract labelling. It wouldn't make any difference if I rearranged all the labels &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, you have defined the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;s to be a particular order that you want. Presumably as part of that, you know how to identify, given a &lt;span class=&quot;math-container&quot;&gt;$\theta_n$&lt;/span&gt;, what the value of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Incidentally, are the coefficients &lt;span class=&quot;math-container&quot;&gt;$x_{in}$&lt;/span&gt; known? If so, you should be able to construct a transformation directly rather than having to use phase estimation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-22T08:17:18.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12602" PostTypeId="1" AcceptedAnswerId="12768" CreationDate="2020-06-22T09:43:55.597" Score="3" ViewCount="95" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12454" LastEditorUserId="9459" LastEditDate="2020-06-22T09:45:20.377" LastActivityDate="2020-07-03T15:47:38.323" Title="Finding phase angle in Q#" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;q#&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12603" PostTypeId="1" CreationDate="2020-06-22T10:14:02.103" Score="1" ViewCount="59" Body="&lt;p&gt;I'm trying to install the &lt;code&gt;qiskit_textbook&lt;/code&gt; repository (&lt;a href=&quot;https://github.com/qiskit-community/qiskit-textbook&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qiskit-community/qiskit-textbook&lt;/a&gt;) and I keep getting this error&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ERROR: Command errored out with exit status 1:&#xA;     command: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '&amp;quot;'&amp;quot;'/private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/setup.py'&amp;quot;'&amp;quot;'; __file__='&amp;quot;'&amp;quot;'/private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/setup.py'&amp;quot;'&amp;quot;';f=getattr(tokenize, '&amp;quot;'&amp;quot;'open'&amp;quot;'&amp;quot;', open)(__file__);code=f.read().replace('&amp;quot;'&amp;quot;'\r\n'&amp;quot;'&amp;quot;', '&amp;quot;'&amp;quot;'\n'&amp;quot;'&amp;quot;');f.close();exec(compile(code, __file__, '&amp;quot;'&amp;quot;'exec'&amp;quot;'&amp;quot;'))' egg_info --egg-base /private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-pip-egg-info-wn16yzlv&#xA;         cwd: /private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/&#xA;    Complete output (5 lines):&#xA;    Traceback (most recent call last):&#xA;      File &amp;quot;&amp;lt;string&amp;gt;&amp;quot;, line 1, in &amp;lt;module&amp;gt;&#xA;      File &amp;quot;/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tokenize.py&amp;quot;, line 452, in open&#xA;        buffer = _builtin_open(filename, 'rb')&#xA;    FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/setup.py'&#xA;    ----------------------------------------&#xA;ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12457" LastEditorUserId="9006" LastEditDate="2020-06-23T06:58:17.143" LastActivityDate="2020-06-23T06:59:19.533" Title="Qiskit textbook install error" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12604" PostTypeId="1" AcceptedAnswerId="12608" CreationDate="2020-06-22T10:54:41.980" Score="0" ViewCount="142" Body="&lt;p&gt;Program.qs&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Quantum.Kata.SingleQubitGates {&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;    open Microsoft.Quantum.Math;&#xA;    &#xA;    &#xA;     operation GlobalPhaseI (q : Qubit) : Unit is Adj+Ctl {&#xA;        X(q);&#xA;        Z(q);&#xA;        Y(q);&#xA;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Reference.qs&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Quantum.Kata.SingleQubitGates {&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;    open Microsoft.Quantum.Math;&#xA;    &#xA;&#xA;    &#xA;    operation GlobalPhaseI_Reference (q : Qubit) : Unit is Adj+Ctl {&#xA;        X(q);&#xA;        Z(q);&#xA;        Y(q);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Test.qs&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    open Microsoft.Quantum.Intrinsic;&#xA;    open Microsoft.Quantum.Canon;&#xA;    open Microsoft.Quantum.Diagnostics;&#xA;    open Microsoft.Quantum.Math;&#xA;    open Microsoft.Quantum.Convert;&#xA;    &#xA;&#xA;    operation ControlledArrayWrapperOperation (op : (Qubit =&amp;gt; Unit is Adj+Ctl), qs : Qubit[]) : Unit is Adj+Ctl {&#xA;        Controlled op([qs[0]], qs[1]);&#xA;    }&#xA;&#xA;    operation AssertEqualOnZeroState (testImpl : (Qubit =&amp;gt; Unit is Ctl), refImpl : (Qubit =&amp;gt; Unit is Adj+Ctl)) : Unit {&#xA;        using (qs = Qubit[2]) {&#xA;            within {&#xA;                H(qs[0]);&#xA;            }&#xA;            apply {&#xA;               &#xA;                Controlled testImpl([qs[0]], qs[1]);&#xA;&#xA;              &#xA;                Adjoint Controlled refImpl([qs[0]], qs[1]);&#xA;            }&#xA;&#xA;          &#xA;            AssertAllZero(qs);&#xA;        }&#xA;    }&#xA;&#xA;    operation T2_GlobalPhaseI_Test () : Unit {&#xA;        AssertOperationsEqualReferenced(2, ControlledArrayWrapperOperation(GlobalPhaseI, _), ControlledArrayWrapperOperation(GlobalPhaseI_Reference, _));&#xA;    }&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Driver.cs&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;using Microsoft.Quantum.Simulation.XUnit;&#xA;using Microsoft.Quantum.Simulation.Simulators;&#xA;&#xA;using Xunit.Abstractions;&#xA;&#xA;namespace Quantum.Kata.SingleQubitGates&#xA;{&#xA;    public class TestSuiteRunner&#xA;    {&#xA;        private readonly ITestOutputHelper output;&#xA;&#xA;        public TestSuiteRunner(ITestOutputHelper output)&#xA;        {&#xA;            this.output = output;&#xA;        }&#xA;&#xA;        /// &amp;lt;summary&amp;gt;&#xA;   &#xA;        /// &amp;lt;/summary&amp;gt;&#xA;        [OperationDriver(TestNamespace = &amp;quot;Quantum.Kata.SingleQubitGates&amp;quot;)]&#xA;        public void TestTarget(TestOperation op)&#xA;        {&#xA;            using (var sim = new QuantumSimulator())&#xA;            {&#xA;    &#xA;                sim.OnLog += (msg) =&amp;gt; { output.WriteLine(msg); };&#xA;                sim.OnLog += (msg) =&amp;gt; { Debug.WriteLine(msg); };&#xA;                op.TestOperationRunner(sim);&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11913" LastEditorUserId="11913" LastEditDate="2020-06-23T06:55:38.473" LastActivityDate="2020-06-26T10:09:49.430" Title="Quantum Katas - Tutorials - SingleQubitGates - Exercise 2 - GlobalPhaseI" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12605" PostTypeId="2" ParentId="12603" CreationDate="2020-06-22T10:56:55.313" Score="1" Body="&lt;p&gt;Why are you trying to install the &lt;code&gt;qiskit_textbook&lt;/code&gt; repository? You should install Qiskit (&lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/install.html&lt;/a&gt;) and Jupyter notebook, unless you have installed them already. Then you will be able open the &lt;code&gt;ipynb&lt;/code&gt; files in the textbook repository.&lt;/p&gt;&#xA;" OwnerUserId="9201" LastEditorUserId="9006" LastEditDate="2020-06-23T06:59:19.533" LastActivityDate="2020-06-23T06:59:19.533" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12606" PostTypeId="2" ParentId="12571" CreationDate="2020-06-22T11:04:22.807" Score="1" Body="&lt;p&gt;There is a known circuit construction &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208130&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0208130&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also check this post &lt;a href=&quot;https://algassert.com/post/1710&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/post/1710&lt;/a&gt;&lt;br /&gt;&#xA;It uses phase estimation ideas to derive the resulting circuit&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-06-22T17:53:33.327" LastActivityDate="2020-06-22T17:53:33.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12607" PostTypeId="1" CreationDate="2020-06-22T16:32:08.913" Score="1" ViewCount="64" Body="&lt;p&gt;Over the past month, I have been learning about the HHL algorithm and am interested in extending the &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq implementation&lt;/a&gt; to include the quantum state tomography step to extract the amplitudes or solutions of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. How would I do this in Cirq?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12399" LastEditorUserId="13991" LastEditDate="2021-04-28T15:22:51.753" LastActivityDate="2021-04-28T15:22:51.753" Title="Adding Quantum State Tomography Step to HHL Algorithm (Cirq)" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;hhl-algorithm&gt;&lt;tomography&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12608" PostTypeId="2" ParentId="12604" CreationDate="2020-06-22T17:59:56.527" Score="2" Body="&lt;p&gt;Yes, this sequence of gates will work to apply the global phase of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. You can check it using matrix multiplication - a product of matrices &lt;span class=&quot;math-container&quot;&gt;$Y \cdot Z \cdot X$&lt;/span&gt; will give you a matrix &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} i &amp;amp; 0 \\ 0 &amp;amp; i \end{bmatrix}$&lt;/span&gt;, which corresponds to applying a global phase.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, you can implement it using &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.r&quot; rel=&quot;nofollow noreferrer&quot;&gt;R gate&lt;/a&gt; with the phase &lt;span class=&quot;math-container&quot;&gt;$-\pi$&lt;/span&gt;: &lt;code&gt;R(PauliI, -PI(), q);&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-22T17:59:56.527" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12609" PostTypeId="1" CreationDate="2020-06-22T18:01:52.960" Score="0" ViewCount="43" Body="&lt;p&gt;The two-ququart (&lt;span class=&quot;math-container&quot;&gt;$16 \times 16$&lt;/span&gt;) &amp;quot;Hiesmayr-Loffler&amp;quot;  density matrix&#xA;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/15/8/083036/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://iopscience.iop.org/article/10.1088/1367-2630/15/8/083036/meta&lt;/a&gt;,&#xA;(&lt;a href=&quot;https://arxiv.org/abs/2004.06745&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2004.06745&lt;/a&gt; eq. (13)),  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5943/what-are-the-ranges-of-the-four-q-parameters-in-the-magic-simplex-of-bell-stat&quot;&gt;What are the ranges of the four $q$ parameters in the magic simplex of Bell states formula?&lt;/a&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_{HL}^{2qq}=&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\left(&#xA;\begin{array}{cccccccccccccccc}&#xA; \kappa _1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   \kappa _2 \\&#xA; 0 &amp;amp; Q_2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; Q_3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   \kappa _2 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; Q_2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; Q_3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; Q_3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   \kappa _2 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; Q_2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; Q_2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; Q_3 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _3 &amp;amp; 0 \\&#xA; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \kappa _2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;&#xA;   \kappa _1 \\&#xA;\end{array}&#xA;\right),  &#xA;\end{equation}&lt;/span&gt;&#xA;where,&#xA;&lt;span class=&quot;math-container&quot;&gt;$\kappa_1=\frac{1}{4} \left(Q_1+3 Q_4\right),\kappa_2=\frac{1}{4} \left(Q_1-Q_4\right)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\kappa_3=\frac{1}{4} \left(-Q_1-4 Q_2-4 Q_3-3 Q_4+1\right)$&lt;/span&gt;&#xA;is not in normal form, as the Bloch vectors of the two reduced &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt;&#xA;subsystems both have a component &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{16} \sqrt{\frac{3}{2}} (Q_1+3 Q_4)$&lt;/span&gt; associated with the fifteen generator&#xA;of &lt;span class=&quot;math-container&quot;&gt;$SU(4)$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\lambda_{15}=\left(&#xA;\begin{array}{cccc}&#xA; \frac{1}{\sqrt{6}} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; \frac{1}{\sqrt{6}} &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt{6}} &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -\sqrt{\frac{3}{2}} \\&#xA;\end{array}&#xA;\right).&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The components associated with the fourteen other generators are all zero in both cases.&lt;/p&gt;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$a_{\mu}= \mbox{Tr}[\rho_{HL}^{2qq} (\lambda_{\mu} \otimes \mathbb{1})]=0, b_{\mu}= \mbox{Tr}[\rho_{HL}^{2qq} (\mathbb{1} \otimes \lambda_{\mu})]=0,\mu=1,\ldots,14$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_{15}= \mbox{Tr}[\rho_{HL}^{2qq} (\lambda_{15} \otimes \mathbb{1})]=b_{15}= \mbox{Tr}[\rho_{HL}^{2qq} ( \mathbb{1} \otimes \lambda_{15})]\frac{1}{16} \sqrt{\frac{3}{2}} (Q_1+3 Q_4)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I would like to convert &lt;span class=&quot;math-container&quot;&gt;$\rho_{HL}^{2qq}$&lt;/span&gt; to normal form (&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.68.012103&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.68.012103&lt;/a&gt;), that is, where all fifteen of the components of the Bloch vectors of the two reduced ququart (&lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt;) density matrices become zero.&lt;/p&gt;&#xA;&lt;p&gt;Given such a normal form, I can then pursue the application to it of the necessary and sufficient conditions for separability of Li and Qiao&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41598-018-19709-z&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41598-018-19709-z&lt;/a&gt;   &lt;a href=&quot;https://idp.springer.com/authorize/casa&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://idp.springer.com/authorize/casa&lt;/a&gt;? &lt;a href=&quot;https://idp.springer.com/authorize/casa&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://idp.springer.com/authorize/casa&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://idp.springer.com/authorize/casa?redirect_uri=https://link.springer.com/article/10.1007/s11128-018-1862-5&amp;amp;casa_token=9VD5vRx0Ns4AAAAA:m0_N47thT2-Kg0sFZaSDDJWwojwCy5Wx9e-UBFPV_6N5yBqAz9WB9KG0bFzKi4tkP7UFpxzs49xRg0De&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://idp.springer.com/authorize/casa?redirect_uri=https://link.springer.com/article/10.1007/s11128-018-1862-5&amp;amp;casa_token=9VD5vRx0Ns4AAAAA:m0_N47thT2-Kg0sFZaSDDJWwojwCy5Wx9e-UBFPV_6N5yBqAz9WB9KG0bFzKi4tkP7UFpxzs49xRg0De&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So doing, would require the construction of the &lt;span class=&quot;math-container&quot;&gt;$15 \times 15$&lt;/span&gt; correlation matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$T_{\mu \nu}= \mbox{Tr}[\rho_{HL}^{2qq} (\lambda_{\mu} \otimes \lambda_{\nu})]$&lt;/span&gt;, and, then, the determination of its singular-value decomposition.&lt;/p&gt;&#xA;&lt;p&gt;Here is some Matlab code--which I will try to implement--written by Nathaniel Johnston &lt;a href=&quot;http://www.qetlab.com/FilterNormalForm&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.qetlab.com/FilterNormalForm&lt;/a&gt; for this explicit purpose (however, this may work only with numerical--not symbolic--input):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;%%  FILTERNORMALFORM    Computes the filter normal form of an operator&#xA;%   This function has one required argument:&#xA;%     RHO: a density matrix&#xA;%&#xA;%   XI = FilterNormalForm(RHO) is a vector of the coefficients in RHO's&#xA;%   filter normal form (see Section IV.D of [1]), which are useful for&#xA;%   showing that RHO is entangled.&#xA;%&#xA;%   The filter normal form is not guaranteed to exist if RHO is not full&#xA;%   rank. If a filter normal form can not be found, an error is returned.&#xA;%&#xA;%   This function has two optional input arguments:&#xA;%     DIM (default has both subsystems of equal dimension)&#xA;%     TOL (default sqrt(eps))&#xA;%&#xA;%   This function has four optional output arguments:&#xA;%     GA,GB: cells of mutually orthonormal matrices&#xA;%     FA,FB: invertible matrices&#xA;%&#xA;%   [XI,GA,GB,FA,FB] = FilterNormalForm(RHO,DIM,TOL) returns XI, GA, GB,&#xA;%   FA, FB such that (eye(length(RHO)) + TensorSum(XI,GA,GB))/length(RHO)&#xA;%   equals kron(FA,FB)*RHO*kron(FA,FB)'. In other words, FA and FB are&#xA;%   matrices implementing the local filter, XI is a vector of coefficients&#xA;%   in the filter normal form, and GA and GB are cells of matrices in the&#xA;%   tensor-sum decomposition of the filter normal form.&#xA;%&#xA;%   DIM is a 1-by-2 vector containing the dimensions of the subsystems on&#xA;%   which RHO acts. TOL is the numerical tolerance used when constructing&#xA;%   the filter normal form.&#xA;%&#xA;%   URL: http://www.qetlab.com/FilterNormalForm&#xA;%&#xA;%   References:&#xA;%   [1] O. Gittsovich, O. Guehne, P. Hyllus, and J. Eisert. Unifying several&#xA;%   separability conditions using the covariance matrix criterion. Phys.&#xA;%   Rev. A, 78:052319, 2008. E-print: arXiv:0803.0757 [quant-ph]&#xA; &#xA;%   requires: OperatorSchmidtDecomposition.m, OperatorSinkhorn.m,&#xA;%             opt_args.m, PartialTrace.m, PermuteSystems.m,&#xA;%             SchmidtDecomposition.m, Swap.m&#xA;%             &#xA;%   author: Nathaniel Johnston (nathaniel@njohnston.ca)&#xA;%   package: QETLAB&#xA;%   last updated: October 3, 2014&#xA; &#xA;function [xi,GA,GB,FA,FB] = FilterNormalForm(rho,varargin)&#xA; &#xA;lrho = length(rho);&#xA; &#xA;% set optional argument defaults: dim=sqrt(length(rho)), tol=sqrt(eps)&#xA;[dim,tol] = opt_args({ round(sqrt(lrho)), sqrt(eps) },varargin{:});&#xA; &#xA;% allow the user to enter a single number for dim&#xA;if(length(dim) == 1)&#xA;    dim = [dim,lrho/dim];&#xA;    if abs(dim(2) - round(dim(2))) &amp;gt;= 2*lrho*eps&#xA;        error('FilterNormalForm:InvalidDim','If DIM is a scalar, it must evenly divide length(RHO); please provide the DIM array containing the dimensions of the subsystems.');&#xA;    end&#xA;    dim(2) = round(dim(2));&#xA;end&#xA; &#xA;try&#xA;    [sigma,F] = OperatorSinkhorn(rho,dim);&#xA;catch err&#xA;    % Operator Sinkhorn didn't converge.&#xA;    if(strcmpi(err.identifier,'OperatorSinkhorn:LowRank'))&#xA;        error('FilterNormalForm:NoFNF','The state RHO can not be transformed into a filter normal form. This is often the case if RHO is not of full rank.');&#xA;    else&#xA;        rethrow(err);&#xA;    end&#xA;end&#xA; &#xA;% Do some post-processing to make the output more useful and consistent&#xA;% with the literature.&#xA;pd = prod(dim);&#xA;[xi,GA,GB] = OperatorSchmidtDecomposition(sigma - trace(sigma)*eye(pd)/pd,dim);&#xA;xi = pd*xi;&#xA;FA = F{1};&#xA;FB = F{2};&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="55" LastEditDate="2020-10-05T13:41:56.587" LastActivityDate="2020-10-05T13:41:56.587" Title="Convert a two-ququart (16 x 16) density matrix into normal form--so that the components of the Bloch vectors of the two reduced systems are all zero" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;unitarity&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12610" PostTypeId="1" AcceptedAnswerId="12613" CreationDate="2020-06-22T19:11:27.383" Score="0" ViewCount="97" Body="&lt;p&gt;I came across somewhere about the circuit diagram that depicts the teleportation of a 4-qubit cluster state. Here it is&lt;a href=&quot;https://i.stack.imgur.com/GJ4yM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GJ4yM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let me tell what i understood.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The qubits on the first two wires give the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}}(|0\rangle|0\rangle+|1\rangle|1\rangle)$&lt;/span&gt;, 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The qubits on wires 3,4,5,6 after Hadamards and controlled phase give the cluster state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|a\rangle=\frac{1}{2}(|0000\rangle+|0011\rangle+|1100\rangle-|1111\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now after this i am not able to understand the circuit, apart from the measurement. For example why is Hadamard on the 3rd wire?&lt;/p&gt;&#xA;&lt;p&gt;Is there any specific way to make this circuit, any sequential procedure?&#xA;Can somebody explain?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastActivityDate="2020-06-23T11:22:05.927" Title="Cluster/Graph state teleportation" Tags="&lt;teleportation&gt;&lt;graph-states&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12611" PostTypeId="1" CreationDate="2020-06-22T19:29:44.010" Score="3" ViewCount="58" Body="&lt;p&gt;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?&#xA;I would also be very grateful for any references to read about as I could not find the needed information.&lt;/p&gt;&#xA;" OwnerUserId="12460" LastActivityDate="2020-12-31T01:05:05.533" Title="STO-3G Basis Set" Tags="&lt;classical-computing&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12612" PostTypeId="2" ParentId="12574" CreationDate="2020-06-22T19:49:01.853" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.prepareuniformsuperposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.prepareuniformsuperposition&lt;/a&gt;&#xA;Provides a nice operation to set register as LE and create the above script but a bit more efficiently without use of for loop.&lt;/p&gt;&#xA;" OwnerUserId="12239" LastActivityDate="2020-06-22T19:49:01.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12613" PostTypeId="2" ParentId="12610" CreationDate="2020-06-22T21:08:44.317" Score="2" Body="&lt;p&gt;&lt;strong&gt;The calculation of the resulting state of the described circuit:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;After applying the same circuit identities described in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12566/9459&quot;&gt;answer&lt;/a&gt; (and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12460/9459&quot;&gt;here&lt;/a&gt;) to the connected &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/12552/9459&quot;&gt;question&lt;/a&gt; we will obtain a &amp;quot;simplified&amp;quot; circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jlN1K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jlN1K.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here are the links to the &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,1,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,%22Z%22%5D,%5B1,1,%22H%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22Z%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22Z%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B%22H%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22H%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,1,1,%22Measure%22%5D,%5B1,1,1,1,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;initial&lt;/a&gt;, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,1,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,%22H%22%5D,%5B1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,%22H%22%5D,%5B1,1,%22H%22%5D,%5B1,1,1,1,%22H%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,%22H%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B%22H%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22H%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,1,1,1,%22H%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22X%22%5D,%5B1,1,1,1,%22H%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B1,%22%E2%80%A2%22,1,1,1,%22X%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B1,1,1,1,1,%22Measure%22%5D,%5B1,1,1,1,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;first intermediate&lt;/a&gt;, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,1,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22H%22,%22H%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,%22H%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B%22H%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22H%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22H%22%5D,%5B%22X%22,1,1,1,%22%E2%80%A2%22%5D,%5B%22H%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22H%22%5D,%5B1,%22X%22,1,1,1,%22%E2%80%A2%22%5D,%5B1,%22H%22%5D,%5B1,1,1,1,1,%22Measure%22%5D,%5B1,1,1,1,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;second intermediate&lt;/a&gt; and &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,1,1,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22X%22,%22%E2%80%A2%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,%22H%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22X%22,1,1,1,%22%E2%80%A2%22%5D,%5B1,%22X%22,1,1,1,%22%E2%80%A2%22%5D,%5B%22H%22%5D,%5B1,%22H%22%5D,%5B1,1,1,1,1,%22Measure%22%5D,%5B1,1,1,1,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;final&lt;/a&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12566/9459&quot;&gt;here&lt;/a&gt; combined with the Bell state we will have the following state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_1 \rangle = \frac{1}{2\sqrt{2}} \big(|00\rangle + |11\rangle\big)\big(| 0000 \rangle + | 0011 \rangle + | 1100 \rangle - | 1111 \rangle \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After the following &amp;quot;cascade-like&amp;quot; sequence consisted of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; CNOTs:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_2 \rangle = \frac{1}{2\sqrt{2}} \Big(| 000000 \rangle + | 000011 \rangle + | 001111 \rangle - | 001100 \rangle +&#xA;\\ + | 111111 \rangle + | 111100 \rangle + | 110000 \rangle - | 110011 \rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After the final two CNOTs:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_3 \rangle = \frac{1}{2\sqrt{2}} \Big(| 000000 \rangle + | 110011 \rangle + | 111111 \rangle - | 001100 \rangle +&#xA;\\ + | 001111 \rangle + | 111100 \rangle + | 110000 \rangle - | 000011 \rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After the final two Hadamard gates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_4 \rangle = \frac{1}{2\sqrt{2}} \Big(| ++0000 \rangle + | --0011 \rangle + | --1111 \rangle - | ++1100 \rangle +&#xA;\\ + | ++1111 \rangle + | --1100 \rangle + | --0000 \rangle - | ++0011 \rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can simplify this state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_4 \rangle = \frac{1}{2\sqrt{2}} \Big(| 000000 \rangle + | 110000 \rangle - | 010011 \rangle - | 100011 \rangle +&#xA;\\&#xA;+ | 001111 \rangle + | 111111 \rangle - | 011100 \rangle - | 101100 \rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Regrouping the terms:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| \psi_4 \rangle = \frac{1}{2\sqrt{2}} \Big(\big(| 0000 \rangle + | 1100 \rangle - | 0111 \rangle - | 1011 \rangle \big) |00\rangle +&#xA;\\&#xA;+ \big(| 0011 \rangle + | 1111 \rangle   - | 0100 \rangle - | 1000\rangle \big) |11\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,1,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,%22Z%22%5D,%5B1,1,%22H%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22Z%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22Z%22%5D,%5B1,1,1,1,1,%22H%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B%22H%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22H%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,1,1,%22Measure%22%5D,%5B1,1,1,1,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;initial&lt;/a&gt; version of the circuit (the order of the qubits in the ket notation is reversed there).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-23T11:22:05.927" LastActivityDate="2020-06-23T11:22:05.927" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12615" PostTypeId="1" AcceptedAnswerId="12617" CreationDate="2020-06-23T00:20:03.733" Score="1" ViewCount="283" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12462" LastEditorUserId="55" LastEditDate="2020-10-05T13:41:49.027" LastActivityDate="2020-11-20T13:23:50.197" Title="Hamming Weight algorithm" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12616" PostTypeId="2" ParentId="12593" CreationDate="2020-06-23T06:18:56.843" Score="3" Body="&lt;p&gt;Adding to psitae's answer, in 2 recent papers by Aaronson, Chia, Lin, Wang and Zhang (&lt;a href=&quot;https://arxiv.org/abs/1911.01973&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1911.01973&lt;/a&gt;) and Buhrman, Patro and Speelman (&lt;a href=&quot;https://arxiv.org/abs/1911.05686&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1911.05686&lt;/a&gt;) the &lt;em&gt;Quantum Strong Exponential Time Hypothesis&lt;/em&gt; (QSETH) was formulated. This hypothesis in fact claims that there is no &lt;span class=&quot;math-container&quot;&gt;$2^{o(n)}$&lt;/span&gt; quantum algorithm for solving &lt;span class=&quot;math-container&quot;&gt;$k-\mathrm{SAT}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="282" LastActivityDate="2020-06-23T06:18:56.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12617" PostTypeId="2" ParentId="12615" CreationDate="2020-06-23T06:29:20.533" Score="1" Body="&lt;p&gt;This corresponds to the problem of &lt;em&gt;counting&lt;/em&gt; the number of 1's in some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit input string. It is well known that for exact counting there can be no significant speedup. This follows from the &lt;span class=&quot;math-container&quot;&gt;$\Omega(n)$&lt;/span&gt; lower bound on the quantum query complexity of parity (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9802049&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). For &lt;em&gt;approximate counting&lt;/em&gt; you can get a quantum speedup, as is described here.&lt;/p&gt;&#xA;" OwnerUserId="282" LastActivityDate="2020-06-23T06:29:20.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12618" PostTypeId="2" ParentId="12604" CreationDate="2020-06-23T07:29:04.393" Score="1" Body="&lt;p&gt;On IBM Q, you can also use &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate to prepare a global phase operator.&#xA;&lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3(\theta, \varphi, \lambda) =&#xA;\begin{pmatrix}&#xA;\cos (\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\varphi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\varphi + \lambda)}\cos(\theta/2)\\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Setting &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt; we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3(\pi, \varphi, \lambda) =&#xA;\begin{pmatrix}&#xA;0 &amp;amp; -\mathrm{e}^{i\lambda} \\&#xA;\mathrm{e}^{i\varphi} &amp;amp; 0\\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Let's denote our global phase &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and set &lt;span class=&quot;math-container&quot;&gt;$\varphi = \alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda = \alpha + \pi$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$-\mathrm{e}^{i\pi}=1$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3(\pi, \alpha, \alpha+\pi) =&#xA;\begin{pmatrix}&#xA;0 &amp;amp; \mathrm{e}^{i\alpha} \\&#xA;\mathrm{e}^{i\alpha} &amp;amp; 0\\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;which is &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e^{i\alpha}}X$&lt;/span&gt;. To get &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e^{i\alpha}}I$&lt;/span&gt;, we apply another &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So, global phase gate is implemented as &lt;span class=&quot;math-container&quot;&gt;$X\,\,U3(\pi,\alpha,\alpha+\pi)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is global phase.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT (solution in Q#)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A &lt;span class=&quot;math-container&quot;&gt;$R1$&lt;/span&gt; gate is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R1(\theta) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;An operation &lt;span class=&quot;math-container&quot;&gt;$X\,R1(\theta)$&lt;/span&gt; is described by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;0 &amp;amp; \mathrm{e}^{i\theta} \\&#xA;1 &amp;amp; 0 &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we apply this operation twice (i.e. &lt;span class=&quot;math-container&quot;&gt;$[X\,R1(\theta)]^2$&lt;/span&gt; ), we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\mathrm{e}^{i\theta} &amp;amp; 0  \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is a global phase gate with arbitrary phase &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So, global phase gate in Q# can be realized as &lt;span class=&quot;math-container&quot;&gt;$[X\,R1(\theta)]^2$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="12280" LastEditDate="2020-06-25T08:31:42.680" LastActivityDate="2020-06-25T08:31:42.680" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12619" PostTypeId="1" AcceptedAnswerId="12623" CreationDate="2020-06-23T08:53:31.223" Score="1" ViewCount="78" Body="&lt;p&gt;I ran my qsvm code on the quantum computer and I'm facing the following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FAILURE: Can not get job id, Resubmit the qobj to get job id. Terra job error: &amp;quot;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.**'&amp;quot; &#xA;Job limit reached, waiting for job 5ef1bc3ecd20b1001387fa06 to finish before submitting the next one.&#xA;FAILURE: Job id: 5ef1bc4edab6ee0013416233 is cancelled. Re-submit the Qobj.&#xA;FAILURE: Job id: 5ef1bc546daf510014814cd8 is cancelled. Re-submit the Qobj.&#xA;FAILURE: Job id: 5ef1bc5a13b5f900139e97c5 is cancelled. Re-submit the Qobj.&#xA;FAILURE: Job id: 5ef1bc62c7453600138726d0 is cancelled. Re-submit the Qobj.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The last line is repeating every few minutes. The url does not exist. I did run my code on the simulator and it worked.&#xA;It uses &lt;strong&gt;5 features and hence 5 qubits&lt;/strong&gt;. Could anyone please help me out?&#xA;The code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;data = np.genfromtxt('diabetes.csv', delimiter=',', names=True, case_sensitive=True)&#xA;data = np.array(data.tolist()) # was an array of arrays earlier&#xA;data = np.delete(data, 7, axis = 1)&#xA;data = np.delete(data, 3, axis = 1)&#xA;data = np.delete(data, 2, axis = 1)&#xA;print(data.shape)&#xA;x = np.copy(data[:,0:5]) #features&#xA;y = np.copy(data[:,5]) #targets&#xA;features = 5&#xA;from sklearn.model_selection import train_test_split&#xA;import qiskit&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import QSVM&#xA;  &#xA;from qiskit.aqua.components.multiclass_extensions import one_against_rest, all_pairs&#xA;from qiskit.aqua.components.feature_maps import SecondOrderExpansion&#xA;provider = qiskit.IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;train_x, test_x, train_y, test_y = train_test_split(x[0:101], y[0:101], test_size=0.2)&#xA;&#xA;training_data = {'A':train_x[train_y==0],'B':train_x[train_y==1]}&#xA;testing_data = {'A':test_x[test_y==0],'B':test_x[test_y==1]}&#xA;feature_map = SecondOrderExpansion(feature_dimension=features,depth=2,entanglement='full')&#xA;svm = QSVM(feature_map,training_data,testing_data)&#xA;shots = 1 &#xA;quantum_instance = QuantumInstance(backend,shots=shots,skip_qobj_validation=False)&#xA;%%time&#xA;result = svm.run(quantum_instance) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12468" LastEditorUserId="5955" LastEditDate="2020-06-23T09:32:18.840" LastActivityDate="2020-06-23T13:17:33.753" Title="Error code: 3458" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12620" PostTypeId="2" ParentId="12610" CreationDate="2020-06-23T09:39:32.380" Score="1" Body="&lt;p&gt;I think it is worth trying to understand the circuit that the authors &lt;em&gt;really&lt;/em&gt; want to implement:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uy2Yb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uy2Yb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-23T09:39:32.380" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12621" PostTypeId="1" CreationDate="2020-06-23T09:59:51.103" Score="5" ViewCount="255" Body="&lt;p&gt;I'm reading &amp;quot;Quantum Computing Expained&amp;quot; of David McMahon, and encountered a confusing concept.&lt;/p&gt;&#xA;&lt;p&gt;In the beginning of Chapter 4, author described the tensor product as below:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To construct a basis for the larger Hilbert space, we simply form the&#xA;tensor products of basis vectors from the spaces &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;. Let&#xA;us denote the basis of &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle$&lt;/span&gt; and the basis of &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$|v_i\rangle$&lt;/span&gt;. Then it follows that we can construct a basis &lt;span class=&quot;math-container&quot;&gt;$|w_i\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$H=H_1\otimes H_2$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$|w_i\rangle = |u_i\rangle \otimes |v_i\rangle$&lt;/span&gt; (4.6)&lt;/p&gt;&#xA;&lt;p&gt;Note that the order of the tensor product is not relevant, meaning&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\otimes |\chi\rangle = |\phi\rangle \otimes |\chi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Can anyone help me to understand what author want to explain?&lt;/p&gt;&#xA;" OwnerUserId="12469" LastEditorUserId="2927" LastEditDate="2021-02-26T16:55:19.330" LastActivityDate="2021-02-26T16:55:19.330" Title="Is the tensor product of two states commutative?" Tags="&lt;mathematics&gt;&lt;tensor-product&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12622" PostTypeId="2" ParentId="12621" CreationDate="2020-06-23T10:36:45.387" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Let's say we have a qubit, which we &lt;strong&gt;label&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, and a qubit which we &lt;strong&gt;label&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. These qubits 'live' in the Hilbert spaces of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{b}$&lt;/span&gt;, respectively; we might call their respective states &lt;span class=&quot;math-container&quot;&gt;$|\psi_{a}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{b}\rangle$&lt;/span&gt;. The idea of the tensor product is that we can write the state of the two system together as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_{ab}\rangle = |\psi_{a}\rangle \otimes |\psi_{b}\rangle.$$&lt;/span&gt; We have 'linked' the Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{b}$&lt;/span&gt; together into one big composite Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{ab}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{H_{ab}} = \mathcal{H}_{a} \otimes \mathcal{H}_{b}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Of course, there is no reason that qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; should come before qubit &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. We thus also could link their Hilbert spaces together in reversed order:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{H_{ba}} = \mathcal{H}_{b} \otimes \mathcal{H}_{a}.&#xA;$$&lt;/span&gt;&#xA;We need to respect our new ordering, and therefore the state of the two systems together is now:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{ba}\rangle = |\psi_{b}\rangle \otimes |\psi_{a}\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Mathematically speaking, this is a different vector than &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ab}\rangle$&lt;/span&gt;. This is &lt;em&gt;exactly&lt;/em&gt; because we have rearranged the order of qubits in how we linked them together.&lt;/p&gt;&#xA;&lt;h2&gt;Explicit example&lt;/h2&gt;&#xA;&lt;p&gt;Let's say that we have a qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{a}$&lt;/span&gt; with the state &lt;span class=&quot;math-container&quot;&gt;$$|\psi_{a}\rangle = \alpha |0_{a}\rangle + \beta|1_{a}\rangle,$$&lt;/span&gt; and a qubit &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{b}$&lt;/span&gt; with the state &lt;span class=&quot;math-container&quot;&gt;$$|\psi_{b}\rangle = \gamma |0_{b}\rangle + \delta|1_{b}\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can link these two qubits together with &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; first:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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,&#xA;$$&lt;/span&gt;&#xA;where I now have specifically labeled the basis states for qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Or with &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; first:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;These state are not the same&lt;/strong&gt;. We see that the coefficients for &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; have been interchanged, but why this happened becomes very obvious if we look at the labels &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; of the basis states. All we have done is writing &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; &lt;em&gt;or&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; first.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; to qubit &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and vice versa. If you may, it is kind of like a 'double fault', that cancels itself out.&lt;/p&gt;&#xA;&lt;p&gt;So in general a tensor product does &lt;strong&gt;not&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-23T10:42:21.133" LastActivityDate="2020-06-23T10:42:21.133" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12623" PostTypeId="2" ParentId="12619" CreationDate="2020-06-23T13:17:33.753" Score="1" Body="&lt;p&gt;tldr: this is caused by a change in behavior of the IQX server that needs to be fixed.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FAILURE: Can not get job id, Resubmit the qobj to get job id. Terra job error: &amp;quot;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.**'&amp;quot; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Aqua then tried to wait for the oldest job to finish before submitting the next one, as indicated by this message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Job limit reached, waiting for job 5ef1bc3ecd20b1001387fa06 to finish before submitting the next one.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-06-23T13:17:33.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12624" PostTypeId="1" CreationDate="2020-06-23T17:10:37.883" Score="2" ViewCount="21" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$P_{XY}$&lt;/span&gt;. In the quantum case, if a state &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; is input to a channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{B|A}$&lt;/span&gt; producing &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;, speaking of a quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is not consistent. However, if A and B are spatially correlated systems, and it makes sense in that case to speak of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. Why is that?&lt;/p&gt;&#xA;" OwnerUserId="12047" LastActivityDate="2020-06-23T17:10:37.883" Title="Density matrix of spatially (i.e., at the same time instant) vs. causally ( i.e., one evolves into the other) correlated quantum systems" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12625" PostTypeId="1" CreationDate="2020-06-23T19:14:46.793" Score="1" ViewCount="66" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RuFET.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RuFET.png&quot; alt=&quot;picture&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="12229" LastEditorUserId="9006" LastEditDate="2020-06-24T07:49:09.760" LastActivityDate="2020-06-24T07:49:09.760" Title="Time taken on IBM Q qasm_simulator vs real backend" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12626" PostTypeId="2" ParentId="12625" CreationDate="2020-06-23T19:38:34.353" Score="1" Body="&lt;p&gt;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..&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-06-23T19:38:34.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12627" PostTypeId="1" AcceptedAnswerId="12629" CreationDate="2020-06-23T20:59:02.700" Score="1" ViewCount="74" Body="&lt;p&gt;Suppose we have a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-qubit system at time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert{\psi(t_0)}\rangle= \vert{q_0}\rangle \otimes \vert{q_1} \rangle \otimes \vert{q_2}\rangle.&#xA;$$&lt;/span&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/IgnEa.png&quot; alt=&quot;1&quot; /&gt;&#xA;We want to check if, for instance, the first qubit at time &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; is equals to itself at time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert{\psi(t_1)} \rangle = \vert{q_0} \rangle \otimes \vert{\phi} \rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vert{\phi} \rangle$&lt;/span&gt; is the state of the qubits &lt;span class=&quot;math-container&quot;&gt;$q_1, q_2$&lt;/span&gt; after the operations.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho^0(t_0) = \operatorname{Tr}_{12}(\rho(t_0)),\\&#xA;\rho^0(t_1) = \operatorname{Tr}_{12}(\rho(t_1)).$$&lt;/span&gt;&#xA;So my question is:&#xA;is there an equivalence relation between the equality of the reduced matrices and the two subsystems being in the same state?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho^0(t_0) = \rho^0(t_1) \Leftrightarrow \vert{q_0}\rangle = \text{the state of the subsystem at }t_1 $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2752" LastEditorUserId="2752" LastEditDate="2020-06-25T19:45:53.580" LastActivityDate="2020-06-25T19:45:53.580" Title="If two reduced density matrices are equal, does that mean that the two subsystems are the same?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;entanglement&gt;&lt;random-quantum-circuit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12629" PostTypeId="2" ParentId="12627" CreationDate="2020-06-24T04:53:05.917" Score="2" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;But you should not forget that&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The state of a subsystem can be mixed (e.g. look at the Bell state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt;). Density matrices uniquely describe mixed states as well, so calculating the partial trace is the most general method for checking the equality.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-06-24T04:53:05.917" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12630" PostTypeId="1" CreationDate="2020-06-24T07:18:40.540" Score="1" ViewCount="102" Body="&lt;p&gt;Suppose we start from 2 wires (q0 and q1) and through some quantum gates, suppose we measure q1 wire only.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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!)&lt;/p&gt;&#xA;" OwnerUserId="12457" LastEditorUserId="55" LastEditDate="2020-10-05T13:41:44.273" LastActivityDate="2021-04-03T18:03:05.337" Title="How can I print out a state vector of a specific wire?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;programming&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12631" PostTypeId="2" ParentId="12567" CreationDate="2020-06-24T07:45:35.013" Score="1" Body="&lt;p&gt;&lt;em&gt;Disclaimer: I am answering this question because the competition the question come from ended. Otherwise, I would consider to answer the question unfair.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;A &lt;span class=&quot;math-container&quot;&gt;$R1$&lt;/span&gt; gate is given by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R1(\theta) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;while &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gate by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Rz(\theta)=&#xA;\begin{pmatrix}&#xA;\mathrm{e}^{-i\theta/2} &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\theta/2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Easily you can see that &lt;span class=&quot;math-container&quot;&gt;$R1(\theta) = \mathrm{e^{i\theta/2}}Rz(\theta)$&lt;/span&gt;. So, the gates differ only by global phase &lt;span class=&quot;math-container&quot;&gt;$\theta/2$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;However, controlled versions of these gates are different. For &lt;span class=&quot;math-container&quot;&gt;$R1(\theta)$&lt;/span&gt;, its controlled version is described by matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C-R1(\theta) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i\theta}&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;while controled version of &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; is given by matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C-RZ(\theta) =&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \mathrm{e}^{-i\theta/2} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \mathrm{e}^{i\theta/2}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Clearly, these gates do not differ by the phase.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-24T07:45:35.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12632" PostTypeId="2" ParentId="12627" CreationDate="2020-06-24T07:59:56.803" Score="2" Body="&lt;p&gt;It depends what you mean in wanting to say that the states &amp;quot;are the same&amp;quot;. You probably mean&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;all observable consequences on just that subsystem (i.e. measurements in&#xA;arbitrary bases etc, without using the other qubits) are identical.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the best description that you can give.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-24T07:59:56.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12633" PostTypeId="1" CreationDate="2020-06-24T08:18:56.417" Score="2" ViewCount="121" Body="&lt;p&gt;Does anyone know how to encode a classical vector into a quantum state? For instance, I would like to encoder a classical vector &lt;span class=&quot;math-container&quot;&gt;$(0, 0.1, 0.4, 0.9)$&lt;/span&gt; into 2 qubits by adding some quantum gates on 2 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; starting states. Any program package including Qiskit, pyquil, cirq... is fine.&lt;/p&gt;&#xA;" OwnerUserId="12457" LastEditorUserId="55" LastEditDate="2020-06-27T15:42:04.003" LastActivityDate="2020-06-27T15:42:04.003" Title="How do I encode a classical vector into the input qubits?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12634" PostTypeId="1" CreationDate="2020-06-24T08:40:36.213" Score="1" ViewCount="123" Body="&lt;p&gt;Given a set of four qubits, say &lt;span class=&quot;math-container&quot;&gt;$q_{0},q_{1},q_{2},q_{3}$&lt;/span&gt; which represent a &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-bit binary number with &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt; as the MSB. After applying QFT on these qubits the phase of &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt;using the concept of binary fractions (&lt;span class=&quot;math-container&quot;&gt;$e^{\frac{a}{2^{n}}} = e^{0..an...a1}$&lt;/span&gt;) becomes:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Q(q_0) = \frac{1}{\sqrt{2}}\big(|0\rangle + e^{(0.q_{0}q_{1}q_{2}q_{3})}|1\rangle\big)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is&lt;/strong&gt;: Is there a quantum operation to change the phase of &lt;span class=&quot;math-container&quot;&gt;$Q(q_0)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$e^{(0.q_{0}q_{1}q_{2}q_{3})}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$e^{(0.q_{1}q_{2}q_{3})}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6297" LastEditorUserId="55" LastEditDate="2020-06-26T20:26:36.337" LastActivityDate="2020-06-27T05:08:29.207" Title="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)}$?" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12635" PostTypeId="1" CreationDate="2020-06-24T11:08:41.227" Score="2" ViewCount="145" Body="&lt;p&gt;This question is just my effort that I made by understanding the previous answers to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12610/cluster-graph-state-teleportation/12613?noredirect=1#comment16611_12613&quot;&gt;my questions&lt;/a&gt; . I have a GHZ state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle+|111\rangle$&lt;/span&gt; (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&lt;a href=&quot;https://i.stack.imgur.com/MQ3El.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MQ3El.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can this be the extension of the case when we teleport a Bell state (two-qubit) using 4 qubits cluster state?&lt;/p&gt;&#xA;&lt;p&gt;Can somebody just check on this circuit? What should be the outcome? Can anybody suggest a possible reference to read?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2020-06-26T12:38:27.880" LastActivityDate="2020-06-28T16:35:38.590" Title="Transferring GHZ state onto some qubits" Tags="&lt;teleportation&gt;&lt;tomography&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12636" PostTypeId="2" ParentId="12633" CreationDate="2020-06-24T11:29:42.397" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/qiskit/building-the-worlds-smallest-quantum-classifier-7da7cd845b84&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/qiskit/building-the-worlds-smallest-quantum-classifier-7da7cd845b84&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Interesting (but more advanced) articles are also:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41598-019-40439-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41598-019-40439-3&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1907.02085&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1907.02085&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-06-24T12:55:07.623" LastActivityDate="2020-06-24T12:55:07.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12637" PostTypeId="2" ParentId="12634" CreationDate="2020-06-24T13:49:15.163" Score="2" Body="&lt;p&gt;First you need to undo the QFT applied to &lt;span class=&quot;math-container&quot;&gt;$|q_3\rangle$&lt;/span&gt;, so you would apply a &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate to &lt;span class=&quot;math-container&quot;&gt;$Q(|q_3\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$HQ(|q_3\rangle) = |q_3\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or more generally for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qbit system&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$HQ(|q_n\rangle) = |q_n\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you then apply the conditional rotation (on &lt;span class=&quot;math-container&quot;&gt;$Q(|q_0\rangle)$&lt;/span&gt; conditioned by &lt;span class=&quot;math-container&quot;&gt;$|q_3\rangle$&lt;/span&gt;) of angle &lt;span class=&quot;math-container&quot;&gt;$R_4^{\dagger}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0  \\&#xA;0 &amp;amp; e^{-\pi i / 8}&#xA;\end{pmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; this will undo the &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; rotation applied by QFT. You would then want to fix up the &lt;span class=&quot;math-container&quot;&gt;$|q_3\rangle$&lt;/span&gt; state to put it back into QFT by applying a &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate again.&lt;/p&gt;&#xA;&lt;p&gt;--&lt;/p&gt;&#xA;&lt;p&gt;I don't think you need to correct &lt;span class=&quot;math-container&quot;&gt;$|q_3\rangle$&lt;/span&gt; for any phase-kickback after applying the conditional rotation to &lt;span class=&quot;math-container&quot;&gt;$Q(|q_0\rangle)$&lt;/span&gt; as we're not applying the rotation to an eigenstate, but anyone feel free to correct me!&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-06-26T03:43:50.707" LastActivityDate="2020-06-26T03:43:50.707" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12638" PostTypeId="2" ParentId="12604" CreationDate="2020-06-24T16:18:55.320" Score="1" Body="&lt;p&gt;I apologize, but I can not comment on @Martin Vesely answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12618/12280&quot;&gt;above&lt;/a&gt;.&#xA;I am glad that my amendments have already been adopted, I’ll leave only a short note, in case someone is interested in this:&#xA;In Qiskit programs (e.g. &lt;a href=&quot;https://gist.github.com/Zhuravlev-A-E/a9fdeb5bb555b177e9e26b6c9fa411e7&quot; rel=&quot;nofollow noreferrer&quot;&gt;see&lt;/a&gt;) I use X before U3 in my variants of phase shift circuits,&#xA;in an attempt to avoid &amp;quot;distortion&amp;quot; during further processing of Qiskit (for example, by transpiler):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(qubit)&#xA;qc.u3(np.pi, gamma, np.pi + gamma, qubit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If not for similar considerations, then the order here would not be important (as in other similar cases, e.g. &lt;span class=&quot;math-container&quot;&gt;$[X\,R1(\theta)]^2 = [R1(\theta)\,X]^2$&lt;/span&gt;)&lt;/p&gt;&#xA;" OwnerUserId="12280" LastEditorUserId="12280" LastEditDate="2020-06-26T10:09:49.430" LastActivityDate="2020-06-26T10:09:49.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12639" PostTypeId="1" AcceptedAnswerId="12640" CreationDate="2020-06-24T17:19:50.457" Score="-1" ViewCount="76" Body="&lt;p&gt;I have a system that generates a random 7 qubit state and I need a method to always find the orthogonal state.&lt;/p&gt;&#xA;&lt;p&gt;I'm currently using python and qutip for this, representing this 7 qubit state by a 128-dimensional vector.&lt;/p&gt;&#xA;" OwnerUserId="5065" LastActivityDate="2020-06-24T17:47:23.083" Title="Find orthogonal state for random 7 qubit state" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12640" PostTypeId="2" ParentId="12639" CreationDate="2020-06-24T17:42:17.823" Score="1" Body="&lt;p&gt;Basically, you divide the entire &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;-qubit Hilbert space into two subspaces: the one spanned by your state (let's call the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;), let's call that subspace &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, and it's orthogonal complement &lt;span class=&quot;math-container&quot;&gt;$V = W^{\perp}$&lt;/span&gt;. You want &lt;em&gt;any&lt;/em&gt; vector from &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, because this will by definition be orthogonal.&lt;/p&gt;&#xA;&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$P_{V}$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$P_{W} = I$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$P_{V}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_{W}$&lt;/span&gt; being the projectors upon the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; subspaces. Since &lt;span class=&quot;math-container&quot;&gt;$P_{W} = |\psi\rangle\langle\psi|$&lt;/span&gt;, we can easily calculate &lt;span class=&quot;math-container&quot;&gt;$P_{V}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{V} = I - |\psi\rangle\langle\psi|.&#xA;$$&lt;/span&gt;&#xA;We can let this projection matrix act on virtually &lt;em&gt;any&lt;/em&gt; state to obtain a state orthogonal on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, lets use the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; vector &lt;span class=&quot;math-container&quot;&gt;$|00....0\rangle$&lt;/span&gt;. An orthogonal state &lt;span class=&quot;math-container&quot;&gt;$|\psi^{\perp}\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is thus:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is more or less the Gram-Schmidt process.&lt;/p&gt;&#xA;&lt;p&gt;Note that you can use (almost) &lt;em&gt;any&lt;/em&gt; state instead of &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt;; the only state that you &lt;em&gt;cannot&lt;/em&gt; use is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; itself.&lt;/p&gt;&#xA;&lt;p&gt;In python, this becomes something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;from numpy import zeros_like, inner&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;zeros_vect = zeros_like(psi_orig)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;psi_orth = zeros_vect - inner(zeros_vect,psi_orig).conj()*psi_orig&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-06-24T17:47:23.083" LastActivityDate="2020-06-24T17:47:23.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12641" PostTypeId="2" ParentId="12592" CreationDate="2020-06-24T18:30:56.577" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If you dig into the source code of the QML library, the measurement is performed in &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/bb75af3caa54b99b6e68989fe9fb1de0cc6d0b65/MachineLearning/src/Classification.qs#L40&quot; rel=&quot;nofollow noreferrer&quot;&gt;EstimateClassificationProbability&lt;/a&gt; operation, which measures the last qubit of the register.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-24T18:30:56.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12642" PostTypeId="1" CreationDate="2020-06-24T18:39:21.063" Score="2" ViewCount="67" Body="&lt;p&gt;Is there a working rule to compute the capacity of a quantum channel described by a set of Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{K_i\}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="55" LastEditDate="2020-06-27T15:58:54.333" LastActivityDate="2020-06-27T15:58:54.333" Title="How to compute the capacity of a quantum channel from its Kraus operators?" Tags="&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12644" PostTypeId="1" AcceptedAnswerId="12647" CreationDate="2020-06-24T18:58:54.297" Score="3" ViewCount="191" Body="&lt;p&gt;Consider two states &lt;span class=&quot;math-container&quot;&gt;$\sigma_0,\sigma_1\in\text{L}(\mathcal{H}_{AB})$&lt;/span&gt;, and suppose &lt;span class=&quot;math-container&quot;&gt;$\sigma_0,\sigma_1$&lt;/span&gt; are separable and orthogonal. Is it possible to distinguish between &lt;span class=&quot;math-container&quot;&gt;$\sigma_0,\sigma_1$&lt;/span&gt; through LOCC?&lt;/p&gt;&#xA;&lt;p&gt;My approach so far har been to write out&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sigma_0 = \sum_{i=1}^n p_i |a_ib_i\rangle\langle a_ib_i| \quad\text{and}\quad&#xA;    \sigma_1 = \sum_{j=1}^n q_j |a_jb_j\rangle\langle a_jb_j|, \quad&#xA;    \text{where } p_i,q_j\geq 0, $$&lt;/span&gt;&#xA;and since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 0 = \text{Tr}(\sigma_0^\dagger\sigma_1)&#xA;    = \sum_{i,j}^n p_iq_j \lvert\langle a_ib_i | a_jb_j\rangle\rvert^2, $$&lt;/span&gt;&#xA;it follows that all terms in the decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sigma_0$&lt;/span&gt; are orthogonal to all terms in the decomposition of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt;. 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!&lt;/p&gt;&#xA;" OwnerUserId="12421" LastEditorUserId="55" LastEditDate="2020-07-27T12:28:46.510" LastActivityDate="2020-07-27T12:28:46.510" Title="Are separable, orthogonal states LOCC distinguishable?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;non-locality&gt;&lt;locc-operation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12645" PostTypeId="1" CreationDate="2020-06-24T21:42:31.187" Score="1" ViewCount="250" Body="&lt;p&gt;I want to replicate the depolarizing noise channel&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OFbHg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OFbHg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;for a 4 qubit circuit system, where p is the probability for an error.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uJntB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uJntB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;I tried doing this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BGOrh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BGOrh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I get the error &lt;code&gt;WARNING: all-qubit error already exists for instruction &amp;quot;measure&amp;quot;, composing with additional error.&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have looked at &lt;a href=&quot;https://qiskit.org/documentation/locale/de_DE/stubs/qiskit.providers.aer.noise.depolarizing_error.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskits documentation&lt;/a&gt; on the &lt;code&gt;depolarizing_error&lt;/code&gt; function but it is not clear, or I don't understand the maths.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Could anyone please shed more light on this?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;I might have found a solution, but I'm not sure if my logic is right.&lt;/p&gt;&#xA;&lt;p&gt;For my 4 qubit system, I want to apply the depolarizing channel noise to the measurement of the qubits &lt;span class=&quot;math-container&quot;&gt;$q_{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_{2}$&lt;/span&gt; in the z-direction:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2cee1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2cee1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;I realized that the single-qubit depolarizing channel above acts separately on the two qubits:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ACOPC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ACOPC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9396" LastEditorUserId="55" LastEditDate="2020-10-05T13:41:36.257" LastActivityDate="2020-10-05T13:41:36.257" Title="I want to create a depolarizing channel on IBM qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12646" PostTypeId="2" ParentId="12621" CreationDate="2020-06-24T22:43:56.563" Score="4" Body="&lt;p&gt;Annoyingly, the answer is &amp;quot;it depends on what you mean by &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |\phi\rangle$&lt;/span&gt;.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;A tensor product of &lt;em&gt;vectors&lt;/em&gt; 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 &lt;em&gt;Hilbert spaces&lt;/em&gt; is more complicated.) Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt; be the Hilbert spaces for two distinct physical systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (e.g. qubits), and let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in \mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle \in \mathcal{H}_B$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_A \otimes |\phi\rangle_B$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle_B \otimes |\psi\rangle_A$&lt;/span&gt; are indeed identical vectors; clearly the choice itself doesn't depend on the order in which you write down its pieces.&lt;/p&gt;&#xA;&lt;p&gt;But if there is a natural isomorphism between &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt; (which is the case by definition if the two systems are &amp;quot;physically equivalent&amp;quot; at the level of our quantum description), with &lt;span class=&quot;math-container&quot;&gt;$(|\psi\rangle \in \mathcal{H}_A) \equiv (|\psi'\rangle \in \mathcal{H}_B)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(|\phi\rangle \in \mathcal{H}_B) \equiv (|\phi'\rangle \in \mathcal{H}_A)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_A \otimes |\phi\rangle_B$&lt;/span&gt; is definitely &lt;em&gt;not&lt;/em&gt; necessarily equal to &lt;span class=&quot;math-container&quot;&gt;$|\phi'\rangle_A \otimes |\psi'\rangle_B$&lt;/span&gt;. The tensor product doesn't even &amp;quot;know about&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;Without Hilbert space subscripts, the notations &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle \otimes |\psi\rangle$&lt;/span&gt; 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 &amp;quot;pinned&amp;quot; to the particular vector, so it swaps along with the symbols &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. In this case, indeed &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |\phi\rangle \equiv|\phi\rangle \otimes |\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, physicists often use the following &lt;em&gt;notational&lt;/em&gt; convention:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If there exists a natural physical isomorphism between Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A \equiv \mathcal{H}_B$&lt;/span&gt;, then use the same notation for isomorphic vectors between the Hilbert spaces, with possibly only a subscript distinguishing them. That is, if &lt;span class=&quot;math-container&quot;&gt;$(|\psi\rangle \in \mathcal{H}_A) \equiv (|\psi'\rangle \in \mathcal{H}_B)$&lt;/span&gt;, then simply use the notations &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_B$&lt;/span&gt; to describe them.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Under this second convention (which is more common with physicists), we have &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |\phi\rangle \not\equiv|\phi\rangle \otimes |\psi\rangle$&lt;/span&gt;, as explained in the third paragraph.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="551" LastEditDate="2020-06-24T23:02:44.003" LastActivityDate="2020-06-24T23:02:44.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12647" PostTypeId="2" ParentId="12644" CreationDate="2020-06-25T06:12:12.457" Score="2" Body="&lt;p&gt;Consider these two states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_0 = \frac{1}{2}(|11\rangle\langle 11| + |++\rangle\langle ++|)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_1 = \frac{1}{2}(|0-\rangle\langle 0-| + |-0\rangle\langle -0|)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I believe they are indistinguishable (with certainty), though to be sure it's better to find the exact proof.&lt;/p&gt;&#xA;&lt;p&gt;Also check this paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9804053&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9804053&lt;/a&gt;.&lt;br /&gt;&#xA;It's impossible to distinguish a set of product states in general, though this is not directly answers your question.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br /&gt;&#xA;As John Watrous explained in the comments, &lt;span class=&quot;math-container&quot;&gt;$\sigma_0$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\text{Im}(\sigma_0)$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0 = \frac{1}{3}\begin{pmatrix} &#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 3 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and you can check that the partial transpose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0^{T_2} = \frac{1}{3}\begin{pmatrix} &#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 3 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;has a negative eigenvalue.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-06-30T07:57:31.080" LastActivityDate="2020-06-30T07:57:31.080" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12648" PostTypeId="2" ParentId="11405" CreationDate="2020-06-25T07:40:59.750" Score="1" Body="&lt;p&gt;You might also want to check out &lt;a href=&quot;https://github.com/cgranade/python-quaec&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quaec&lt;/a&gt;, documentation &lt;a href=&quot;https://www.cgranade.com/python-quaec/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, which is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;QuaEC is a library for working with quantum error correction, including support for efficiently maniuplating Pauli and Clifford operators.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The use of this would pretty much be as-is, since it is not actively (or even passively I believe) developed anymore.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-06-25T07:40:59.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12649" PostTypeId="2" ParentId="12633" CreationDate="2020-06-25T08:40:13.867" Score="1" Body="&lt;p&gt;Firstly, you have to normalize your vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; to have an Euclidian norm equal one, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;||x||=||(0,0.1,0.4,0.9)|| = \sqrt{0^2 + 0.1^2 +0.4^2+0.9^2} = \sqrt{0.98}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, your vector representing a quantum state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{0.98}}(0,0.1,0.4,0.9).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, you can apply methods described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12540/how-to-prepare-an-arbitrary-two-qubit-state/12549#12549&quot;&gt;this thread&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-25T08:40:13.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12650" PostTypeId="1" CreationDate="2020-06-25T10:16:35.397" Score="0" ViewCount="41" Body="&lt;p&gt;Searching the web for '&amp;quot;quantum computer&amp;quot; nilpotent'&#xA;returns many results, so maybe the question is ontopic&#xA;for this site.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Can a quantum computer solve the following mathematical&#xA;problem:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is related to an open problem, so likely the answer is negative.&lt;/p&gt;&#xA;&lt;p&gt;The problem is &lt;a href=&quot;https://members.loria.fr/RSchott/staceyAISCfinalmarch10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cycle Enumeration using Nilpotent Adjacency&#xA;Matrices with Algorithm Runtime Comparisons&lt;/a&gt; pp 2-3 about zeon algebra.&lt;/p&gt;&#xA;&lt;p&gt;Is there commutative ring or commutative algebra &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; with the following properties:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; nilpotent elements &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$a_i^2=0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$a_1 a_2 \cdots a_n \ne 0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Computation in &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is efficient: for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;&#xA;with entries zero and &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;, for natural &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; we can compute&#xA;&lt;span class=&quot;math-container&quot;&gt;$M^m$&lt;/span&gt; in time polynomial in &lt;span class=&quot;math-container&quot;&gt;$nm$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If we omit the efficiency constraint, the answer is easy:&lt;/p&gt;&#xA;&lt;p&gt;Take &lt;span class=&quot;math-container&quot;&gt;$R=K[a_1,a_2,...a_n]/(a_1^2,a_2^2,...a_n^2)$&lt;/span&gt; for any ring &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12448" LastEditorUserId="12448" LastEditDate="2020-06-26T08:25:48.090" LastActivityDate="2020-06-26T08:25:48.090" Title="Rings or algebras with many nilpotent elements and efficient computation" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12651" PostTypeId="1" CreationDate="2020-06-25T11:37:33.410" Score="1" ViewCount="28" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2020-06-25T11:37:33.410" Title="Quantum channels and error correction research groups" Tags="&lt;error-correction&gt;&lt;research&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12652" PostTypeId="1" AcceptedAnswerId="12661" CreationDate="2020-06-25T13:29:57.200" Score="1" ViewCount="74" Body="&lt;p&gt;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 &lt;code&gt;_unitary_(self)&lt;/code&gt; method. I did the same for the three-qubit gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import numpy as np&#xA;&#xA;class CsAgate(cirq.ThreeQubitGate):&#xA;    def __init__(self, theta):&#xA;        self.theta = theta&#xA;&#xA;    def _unitary_(self):&#xA;        st = np.sin(self.theta)&#xA;        ct = np.cos(self.theta)&#xA;&#xA;        return np.array([&#xA;        [1., 0, 0, 0,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, ct, st,0,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, st,-ct,0,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 1.,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;&#xA;        [0, 0, 0, 0,    1., 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, ct,st, 0,    0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, st,-ct,0,    0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 1.,    0, 0, 0, 0,     0, 0, 0, 0],&#xA;&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],&#xA;        ]&#xA;        )&#xA;&#xA;&#xA;    def _circuit_diagram_info_(self, args):&#xA;        return 'o','theta({})'.format(round(self.theta, 2)), '0'&#xA;&#xA;    def __str__(self):&#xA;        return 'test'&#xA;&#xA;n_qubits = 8&#xA;qubits = cirq.LineQubit.range(n_qubits)&#xA;my_circuit=cirq.Circuit([CsAgate(2.)(qubits[0], qubits[1], qubits[2])])&#xA;print(my_circuit)&#xA;print(my_circuit.unitary())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The circuit is generated successfully but Cirq throws an error when calculating the circuit unitary. Any idea how to solve this issue?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &amp;quot;/Users/mjahanpo/Desktop/opt_api/test.py&amp;quot;, line 46, in &amp;lt;module&amp;gt;&#xA;    print(my_circuit.unitary())&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/circuits/circuit.py&amp;quot;, line 1418, in unitary&#xA;    result = _apply_unitary_circuit(self, state, qs, dtype)&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/circuits/circuit.py&amp;quot;, line 1960, in _apply_unitary_circuit&#xA;    return protocols.apply_unitaries(&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py&amp;quot;, line 492, in apply_unitaries&#xA;    result = apply_unitary(unitary_value=op,&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py&amp;quot;, line 347, in apply_unitary&#xA;    result = strat(unitary_value, args)&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py&amp;quot;, line 384, in _strat_apply_unitary_from_apply_unitary&#xA;    sub_result = func(sub_args)&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/ops/gate_operation.py&amp;quot;, line 113, in _apply_unitary_&#xA;    return protocols.apply_unitary(self.gate, args, default=None)&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py&amp;quot;, line 347, in apply_unitary&#xA;    result = strat(unitary_value, args)&#xA;  File &amp;quot;/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py&amp;quot;, line 419, in _strat_apply_unitary_from_unitary&#xA;    matrix.reshape(val_qid_shape * 2),&#xA;ValueError: cannot reshape array of size 256 into shape (2,2,2,2,2,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12489" LastActivityDate="2020-06-25T19:01:52.373" Title="Can not build circuit unitary for a three-qubit gate in Cirq" Tags="&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12653" PostTypeId="1" CreationDate="2020-06-25T13:47:00.817" Score="1" ViewCount="158" Body="&lt;p&gt;I'm following the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-counting.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt; for Quantum Counting. We have assumed &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as the number of states containing solutions throughout the algorithm but at last, &lt;span class=&quot;math-container&quot;&gt;$N-M$&lt;/span&gt; has been taken as the solution. What am I missing?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IHXVM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IHXVM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; corresponds to the number of states that contain solutions and &lt;span class=&quot;math-container&quot;&gt;$|'\rangle$&lt;/span&gt; corresponds to the number of states that don't contain solutions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle s'|s\rangle = \cos \frac{\theta}{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle s'|s\rangle = \sqrt \frac{N-M}{N}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We combine these equations to obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N \sin^2 \frac{\eta}{2} = M$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The theory part is understandable, and it clearly shows that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the number of states containing solutions, yet, the answer is given as &lt;span class=&quot;math-container&quot;&gt;$N-M$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can anyone help me with it?&lt;/p&gt;&#xA;" OwnerUserId="12488" LastEditorUserId="8343" LastEditDate="2020-06-27T22:36:37.820" LastActivityDate="2020-06-30T12:32:07.620" Title="Why is the number of solutions given in Qiskit textbook(Quantum Counting Algorithm) as N-M instead of M?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12654" PostTypeId="1" AcceptedAnswerId="12659" CreationDate="2020-06-25T14:25:11.007" Score="0" ViewCount="51" Body="&lt;p&gt;I have a two-qubit gate with below unitary:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;    def _unitary_(self):&#xA;        st = np.sin(self.theta)&#xA;        ct = np.cos(self.theta)&#xA;        ei = np.exp(1j*self.phi)&#xA;        emi = np.exp(-1j*self.phi)&#xA;&#xA;        return np.array([&#xA;            [1.,        0,          0,  0],&#xA;            [0,         ct,     ei*st,  0],&#xA;            [0,         emi*st,   -ct,  0],&#xA;            [0,         0,          0,  1.]&#xA;        ]&#xA;        )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;How would the unitary of such three-qubit gate look like? (I'm doing this in Cirq)&lt;/p&gt;&#xA;" OwnerUserId="12489" LastActivityDate="2020-06-25T18:34:22.190" Title="How to build a controlled two-qubit gate?" Tags="&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12655" PostTypeId="2" ParentId="12481" CreationDate="2020-06-25T16:11:02.827" Score="1" Body="&lt;p&gt;Well, I would say you can consider each possible outcome as a Bernoulli in the very same way!&lt;br /&gt;&#xA;You can consider a state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi\rangle = \sum_{i}^k\alpha_i|x_i\rangle$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; is a vector of the computational basis (i.e. &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle \in \{|0\rangle, |1\rangle\}^{\otimes n}$&lt;/span&gt;) and each &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; has probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha_i|^2$&lt;/span&gt; of being measured.&lt;br /&gt;&#xA;After creating and sampling such state &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; times, you could consider &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; Bernoulli trials - one for each &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; - where for each &lt;span class=&quot;math-container&quot;&gt;$i^{th}$&lt;/span&gt; trial you consider a success if you measure the state &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; and failure if you measure any other state.&lt;/p&gt;&#xA;&lt;p&gt;In that way you could just reuse the Wald/Wilson intervals for each &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt;.&lt;br /&gt;&#xA;For instance, using the Wald interval, you could compute for each &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{p}_i = \frac{\text{ number of times } |x_i\rangle\text{ appears}}{S}$$&lt;/span&gt;&#xA;and say with confidence &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\alpha_i|^2 \in [\hat{p}_i - \epsilon, \hat{p}_i + \epsilon]$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\epsilon = z\sqrt{\frac{\hat{p}_i(1 - \hat{p}_i)}{S}}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10259" LastEditorUserId="55" LastEditDate="2020-06-25T16:17:45.253" LastActivityDate="2020-06-25T16:17:45.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12656" PostTypeId="1" CreationDate="2020-06-25T17:12:56.417" Score="4" ViewCount="191" Body="&lt;p&gt;It is well-known that one side of the Fuchs-van de Graaf inequality is saturated for pure states, i.e. &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)^2 = 1-d(\rho,\sigma)^2$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are pure (here we are using the definition &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma) := \|\sqrt{\rho}\sqrt{\sigma}\|_1$&lt;/span&gt; for fidelity). However, are there other situations where it is known that this equality holds? How far has this been characterized?&lt;/p&gt;&#xA;&lt;p&gt;As a starting point, I am aware that when the states are qubits, it can be shown that &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)^2 = 1-d(\rho,\sigma)^2$&lt;/span&gt; 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 &amp;quot;have the same eigenvalues&amp;quot; condition does not generalize even to qutrits, however, and hence it may perhaps not be the best approach to characterizing the conditions.&lt;/p&gt;&#xA;" OwnerUserId="12482" LastActivityDate="2021-05-24T11:43:51.217" Title="Saturating the Fuchs-van de Graaf inequality" Tags="&lt;fidelity&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12657" PostTypeId="1" CreationDate="2020-06-25T18:03:44.197" Score="0" ViewCount="96" Body="&lt;p&gt;If We perform some unitary operations on a Quantum State &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt; after which it becomes&lt;span class=&quot;math-container&quot;&gt;$|A'\rangle$&lt;/span&gt;. Then if we perform the inverse of all those unitary operations on the state &lt;span class=&quot;math-container&quot;&gt;$|A'\rangle$&lt;/span&gt; in reverse order, can we roll back to the state &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="55" LastEditDate="2020-10-05T13:41:23.430" LastActivityDate="2020-10-05T13:41:23.430" Title="Are quantum operations reversible?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12659" PostTypeId="2" ParentId="12654" CreationDate="2020-06-25T18:34:22.190" Score="1" Body="&lt;p&gt;&lt;code&gt;MyTwoQubitGate().on(q1, q2).controlled_by(c)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;MyTwoQubitGate().controlled().on(c, q1, q2)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-06-25T18:34:22.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12660" PostTypeId="1" CreationDate="2020-06-25T18:47:31.423" Score="2" ViewCount="68" Body="&lt;p&gt;The protocol is:&#xA;We start with a supply&#xA;of identically prepared bipartite non-Gaussian states. The overall protocol then amounts to an iteration of the following&#xA;basic steps.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The states will be mixed pairwise locally at 50:50&#xA;beam splitters.&lt;/li&gt;&#xA;&lt;li&gt;On one of the outputs of each beam splitter, a photon&#xA;detector distinguishes between the absence and presence of&#xA;photons. It should be noted that we do not require photon&#xA;counters that can discriminate between different photon&#xA;numbers.&lt;/li&gt;&#xA;&lt;li&gt;In case of absence of photons at both detectors for a&#xA;particular pair, one keeps the remaining modes as an input&#xA;for the next iteration, otherwise the state is discarded.&#xA;This is one iteration of the protocol which we will continue&#xA;until we finally end up with a small number of states&#xA;that closely resemble Gaussian states.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3dTtU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3dTtU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This protocol is presented in the paper: &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.062320&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.062320&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11668" LastEditorUserId="55" LastEditDate="2020-06-28T14:31:33.947" LastActivityDate="2020-09-22T16:00:30.047" Title="What is the intuition behind the following entanglement distillation protocol for continuous variable systems?" Tags="&lt;entanglement&gt;&lt;key-distribution&gt;&lt;state-distillation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12661" PostTypeId="2" ParentId="12652" CreationDate="2020-06-25T19:01:52.373" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Do this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    def _unitary_(self):&#xA;        st = np.sin(self.theta)&#xA;        ct = np.cos(self.theta)&#xA;&#xA;        return np.array([&#xA;            [1., 0, 0, 0,   0, 0, 0, 0],&#xA;            [0, ct, st,0,   0, 0, 0, 0],&#xA;            [0, st,-ct,0,   0, 0, 0, 0],&#xA;            [0, 0, 0, 1.,   0, 0, 0, 0],&#xA;&#xA;            [0, 0, 0, 0,    1., 0, 0, 0],&#xA;            [0, 0, 0, 0,    0, ct,st, 0],&#xA;            [0, 0, 0, 0,    0, st,-ct,0],&#xA;            [0, 0, 0, 0,    0, 0, 0, 1.],&#xA;        ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also, based on that matrix, it looks like this is actually a two qubit gate tensored with an identity gate on a third qubit.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-06-25T19:01:52.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12662" PostTypeId="1" AcceptedAnswerId="12664" CreationDate="2020-06-26T01:06:14.580" Score="1" ViewCount="270" Body="&lt;p&gt;I would like to create a n-dimensional Hadamard transform in Q# with n in set of even integers.&lt;/p&gt;&#xA;" OwnerUserId="12239" LastActivityDate="2020-06-26T06:58:47.897" Title="How can I create an n-dimensional Hadamard transform in Q#?" Tags="&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12663" PostTypeId="2" ParentId="12662" CreationDate="2020-06-26T01:28:57.317" Score="1" Body="&lt;p&gt;The higher order analog of Hadamard Transform is the Quantum Fourier Transform.&#xA;You can learn more about it on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="9006" LastEditDate="2020-06-26T06:58:47.897" LastActivityDate="2020-06-26T06:58:47.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12664" PostTypeId="2" ParentId="12662" CreationDate="2020-06-26T01:45:07.220" Score="3" Body="&lt;p&gt;If you're looking to implement &lt;span class=&quot;math-container&quot;&gt;$H^\otimes$&lt;/span&gt; (i.e., applying the Hadamard transform to each of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits), you can use library operation &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applytoeach&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyToEach&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;using (register = Qubit[n]) {&#xA;    ApplyToEach(H, register);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you are indeed looking for quantum Fourier transform, as the other answer suggests, the Q# library operation that implements it is &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applyquantumfouriertransform&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyQuantumFourierTransform&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-26T01:45:07.220" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12665" PostTypeId="2" ParentId="12657" CreationDate="2020-06-26T07:06:26.307" Score="3" Body="&lt;p&gt;Any operation on quantum computer (with measurement being exception) are described by unitary matrix. A feature of the unitary matrix is &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger=I$&lt;/span&gt;, which means that transpose conjugate to matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is inverse to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; too. It can be easily proven that if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is unitary then &lt;span class=&quot;math-container&quot;&gt;$A^\dagger$&lt;/span&gt; is also unitary hence it is also quantum gate.&lt;/p&gt;&#xA;&lt;p&gt;If you came from state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; by transformation &lt;span class=&quot;math-container&quot;&gt;$A|\psi_0\rangle = |\psi_1\rangle$&lt;/span&gt;, then it is possible to reverse the transformation in this way: &lt;span class=&quot;math-container&quot;&gt;$A^{\dagger}|\psi_1\rangle = |\psi_0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In practise, this means that you put all gates in original circuit in reverse order and replace each gate &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with its transpose conjugate operator &lt;span class=&quot;math-container&quot;&gt;$A^{\dagger}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-26T07:06:26.307" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12668" PostTypeId="1" AcceptedAnswerId="12738" CreationDate="2020-06-26T15:52:04.527" Score="0" ViewCount="175" Body="&lt;p&gt;First, I apologize if something is poorly written but English is not my first language.&lt;/p&gt;&#xA;&lt;p&gt;I know that these exercises have been solved in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2423/nielsen-chuang-exercise-2-2-matrix-representations-example&quot;&gt;this question&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;So I think we only have to use eq. 2.12 in this way:&lt;/p&gt;&#xA;&lt;p&gt;if we write &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;=\left|v_{0}\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;=\left|v_{1}\right&amp;gt;$&lt;/span&gt; and we use them as input and output basis, we can write (2.12) as &lt;span class=&quot;math-container&quot;&gt;$A\left|v_{j}\right&amp;gt; = \sum_{i} A_{ij} \left|v_{i}\right&amp;gt;$&lt;/span&gt;; so,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A\left|v_{0}\right&amp;gt; = A_{00}\left|v_{0}\right&amp;gt; + A_{10}\left|v_{1}\right&amp;gt; = \left|v_{1}\right&amp;gt; \Rightarrow A_{00}=0; A_{10}=1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A\left|v_{1}\right&amp;gt; = A_{01}\left|v_{0}\right&amp;gt; + A_{11}\left|v_{1}\right&amp;gt; = \left|v_{0}\right&amp;gt; \Rightarrow A_{01}=1; A_{11}=0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \begin{bmatrix}&#xA;0 &amp;amp; 1\\&#xA;1 &amp;amp; 0&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As we can see I don't use concrete basis vectors and this works for basis &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 \\1 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 \\0 \end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But not with basis like &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\begin{pmatrix}1 \\1 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\begin{pmatrix}1 \\-1 \end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My feeling was that this solution doesn't depend on the basis but it does. So why?&lt;/p&gt;&#xA;" OwnerDisplayName="user12503" LastEditorUserId="55" LastEditDate="2020-06-26T20:26:56.457" LastActivityDate="2020-07-01T16:21:02.140" Title="How to find the matrix representation of an operator from its action on a basis?" Tags="&lt;nielsen-and-chuang&gt;&lt;matrix-representation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="16" ContentLicense="CC BY-SA 4.0" />
  <row Id="12670" PostTypeId="1" AcceptedAnswerId="12671" CreationDate="2020-06-26T22:18:05.427" Score="0" ViewCount="35" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Negativity_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;entanglement negativity&lt;/em&gt;&lt;/a&gt;, introduced in (&lt;a href=&quot;https://doi.org/10.1103/PhysRevA.65.032314&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vidal and Werner 2002&lt;/a&gt;), is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal N(\rho) \equiv \frac{\|\rho^{T_B}\|_1-1}{2}.$$&lt;/span&gt;&#xA;It is mentioned there that this equals the sum of the absolute values of the negative values of the eigenvalues of the partial transpose &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathcal N(\rho)=\sum_{\lambda&amp;lt;0} \lvert\lambda\rvert$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How does one show the equivalence of these two quantities?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-03-09T18:49:00.287" LastActivityDate="2021-03-09T18:49:00.287" Title="Why does the entanglement negativity equal (in magnitude) the sum of the negative eigenvalues?" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;partial-transpose&gt;&lt;entanglement-negativity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12671" PostTypeId="2" ParentId="12670" CreationDate="2020-06-26T22:18:05.427" Score="1" Body="&lt;p&gt;This is also discussed in the paper linked above. The trace norm of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is defined as the sum of the absolute values of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\|X\|_1=\sum_i \lvert\lambda_i\rvert$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\tr}{\operatorname{tr}}$&lt;/span&gt;Given a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, the normalisation condition amounts to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tr(\rho) = \sum_i \lambda_i = \sum_{\lambda\in\sigma_+}\lambda + \sum_{\lambda\in\sigma_-}\lambda = 1,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_\pm$&lt;/span&gt; is the set of positive (negative) eigenvalues.&#xA;Given &lt;span class=&quot;math-container&quot;&gt;$\rho=\rho_{ij,k\ell}|ij\rangle\!\langle k\ell|$&lt;/span&gt;,&#xA;the partial transpose &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}=\sum_{ijk\ell}\rho_{ij,k\ell}|i\ell\rangle\!\langle kj|$&lt;/span&gt;, which means that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tr(\rho^{T_B})=\sum_{ij} \rho_{ij,ij} = \tr(\rho) = 1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It follows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|\rho^{T_B}\|_1 = \sum_i \lvert\lambda_i\rvert = \sum_{\lambda\in\sigma_+}\lambda - \sum_{\lambda\in\sigma_-}\lambda &#xA;= 1 - 2 \sum_{\lambda\in\sigma_-}\lambda.&#xA;$$&lt;/span&gt;&#xA;And therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal N(\rho) = \frac{\|\rho^{T_B}\|_1-1}{2} = -\sum_{\lambda\in\sigma_-}\lambda = \sum_{\lambda\in\sigma_-}\lvert\lambda\rvert.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-26T22:25:08.430" LastActivityDate="2020-06-26T22:25:08.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12672" PostTypeId="2" ParentId="12507" CreationDate="2020-06-26T23:35:16.080" Score="0" Body="&lt;p&gt;Yes, here it is: this project (&lt;a href=&quot;https://github.com/softwareQinc/staq&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/softwareQinc/staq&lt;/a&gt;) attempts to synthesize Verilog code to OpenQASM.&lt;/p&gt;&#xA;&lt;p&gt;As you may know, the Verilog is used to build very complex/large classical circuits, which can implement any functions.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9768" LastActivityDate="2020-06-26T23:35:16.080" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12673" PostTypeId="1" AcceptedAnswerId="12674" CreationDate="2020-06-27T00:13:35.853" Score="0" ViewCount="43" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Negativity_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement negativity&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal N(\rho)$&lt;/span&gt; of a (bipartite) state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is defined as the absolute value of the sum of the negative eigenvalues of the partial transpose of a state, or equivalently, &lt;span class=&quot;math-container&quot;&gt;$2\mathcal N(\rho)=\|\rho^{T_B}\|_1-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consider a maximally entangled pure state: &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \simeq \sum_{k=1}^N |k,k\rangle$&lt;/span&gt;. What is the entanglement negativity of such states? What are good ways to derive this quantity?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-03-09T18:49:13.797" LastActivityDate="2021-03-09T18:49:13.797" Title="Compute the negativity of maximally entangled bipartite states" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;partial-transpose&gt;&lt;entanglement-negativity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12674" PostTypeId="2" ParentId="12673" CreationDate="2020-06-27T00:34:02.567" Score="0" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\sqrt N|\psi\rangle=\sum_{k=1}^N|k,k\rangle$&lt;/span&gt; be a maximally entangled state of dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\rho\equiv|\psi\rangle\!\langle\psi|$&lt;/span&gt;.&#xA;More generally, we don't need to stick to maximally entangled states: any state with this (or equivalent) Schmidt decomposition will behave identically.&lt;/p&gt;&#xA;&lt;p&gt;The partial transpose reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}=\frac{1}{N}\sum_{ij}\lvert ij\rangle\!\langle ji\rvert. $&lt;/span&gt;&#xA;Separating this into terms that are symmetric and terms that are not we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$N\rho^{T_B} = \sum_i \lvert ii\rangle\!\langle ii| + \underbrace{\sum_{i\neq j}\lvert ij\rangle\!\langle ji\rvert}_{A},$$&lt;/span&gt;&#xA;where here &lt;span class=&quot;math-container&quot;&gt;$A^\dagger =A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(A)=0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt;.&#xA;It follows that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has an equal number of eigenvalues equal to &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;.&#xA;Moreover, the rank of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$N(N-1)$&lt;/span&gt;, so the multiplicity of both eigenvalues is &lt;span class=&quot;math-container&quot;&gt;$N(N-1)/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; are therefore &lt;span class=&quot;math-container&quot;&gt;$\frac1 N$&lt;/span&gt; with multiplicity &lt;span class=&quot;math-container&quot;&gt;$N+\frac{N(N-1)}2=\frac{N(N+1)}{2}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$-\frac1 N$&lt;/span&gt; with multiplicity &lt;span class=&quot;math-container&quot;&gt;$\frac{N(N-1)}2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We conclude that the negativity equals &lt;span class=&quot;math-container&quot;&gt;$\frac{N(N-1)}{2}\frac{1}{N}=\frac{N-1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-06-27T00:39:49.807" LastActivityDate="2020-06-27T00:39:49.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12675" PostTypeId="2" ParentId="12668" CreationDate="2020-06-27T01:52:22.633" Score="0" Body="&lt;p&gt;A simple explanation is if we look geometrically at what &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;  is doing, which is a reflection. For orthogonal basis &lt;span class=&quot;math-container&quot;&gt;$|v_1\rangle, |v_2\rangle$&lt;/span&gt; we want to find unitary transform &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A|v_1\rangle = |v_2\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A|v_2\rangle = |v_1\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;i.e. we want to find a reflection matrix. We want to find the vector, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, that reflects &lt;span class=&quot;math-container&quot;&gt;$|v_1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|v_2\rangle$&lt;/span&gt;, and this is dependant on the choice of &lt;span class=&quot;math-container&quot;&gt;$|v_1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|v_2\rangle$&lt;/span&gt;. The axis of reflection is the vector inbetween so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$r = \frac{1}{2}\left( |v_1\rangle - |v_2\rangle \right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Using the Householder identity for the reflection matrix &lt;span class=&quot;math-container&quot;&gt;$R = I - 2rr^T = A$&lt;/span&gt;, gives us &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; which is dependent on the basis vectors.&lt;/p&gt;&#xA;&lt;p&gt;As an example for the computational basis we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$r = 0.5\begin{pmatrix} 1 \\ 0 \end{pmatrix}  - \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0.5 \\ -0.5 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;plugging this into the Householder identity:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A = I - 2\begin{pmatrix} 0.5 \\ -0.5 \end{pmatrix}\begin{pmatrix} 0.5 &amp;amp; -0.5 \end{pmatrix} = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-06-27T03:08:11.263" LastActivityDate="2020-06-27T03:08:11.263" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12676" PostTypeId="1" AcceptedAnswerId="12681" CreationDate="2020-06-27T03:19:25.120" Score="1" ViewCount="16" Body="&lt;p&gt;All quantum computers now are working with qubit which is zero or one.&lt;/p&gt;&#xA;&lt;p&gt;Can we have quantum computer with multiple-state unit? Such as trit (trinary, 3 states), digit (10 states) instead of qubit (2 states)?&lt;/p&gt;&#xA;" OwnerUserId="12506" LastEditorUserId="9006" LastEditDate="2020-06-27T06:29:36.580" LastActivityDate="2020-06-27T06:29:36.580" Title="Can we have multiple-state unit for quantum computer?" Tags="&lt;quantum-state&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12677" PostTypeId="1" AcceptedAnswerId="12682" CreationDate="2020-06-27T03:45:15.607" Score="4" ViewCount="298" Body="&lt;p&gt;I work with stabilizer codes using the real version of Pauli matrices:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X=((0,1),(1,0))$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z=((1,0),(0,-1))$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y=XZ$&lt;/span&gt; (not &lt;span class=&quot;math-container&quot;&gt;$\imath XZ$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I know the encoders for these codes lie in the Clifford group which is generated by the matrices (P,H,CX) described here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://mathoverflow.net/questions/84388/presentation-of-the-clifford-group-by-generators-and-relations&quot;&gt;Presentation of the Clifford group by generators and relations&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are H and CX enough to generate a real version of the Clifford group? Or is there an additional gate to replace the &amp;quot;P&amp;quot; gate? (This would be the group of real &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; orthogonal matrices that normalize the group generated by the real Pauli matrices.)&lt;/p&gt;&#xA;" OwnerUserId="12265" LastEditorUserId="734" LastEditDate="2020-06-27T19:13:27.247" LastActivityDate="2020-06-27T19:13:27.247" Title="What are generators for a &quot;real&quot; Clifford group?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12678" PostTypeId="2" ParentId="12634" CreationDate="2020-06-27T05:08:29.207" Score="3" Body="&lt;p&gt;It seems that such a transformation would not be unitary. Since it drops the information about bit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; altogether, it would have basis states that differ in that bit transformed into the same state, and that would not be possible to invert.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-27T05:08:29.207" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12679" PostTypeId="1" AcceptedAnswerId="12684" CreationDate="2020-06-27T05:34:02.783" Score="4" ViewCount="94" Body="&lt;p&gt;Disclaimer: &lt;a href=&quot;https://physics.stackexchange.com/q/562079/58382&quot;&gt;I had posted this question previously on the physics StackExchange&lt;/a&gt;, but received no response there.&lt;/p&gt;&#xA;&lt;p&gt;My question is two-part. First, imagine a bipartite quantum state &lt;span class=&quot;math-container&quot;&gt;$|\Phi \rangle_{AB}$&lt;/span&gt;, made of &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt;-qubits, shared between Alice and Bob (with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubits each). Alice performs some unitary operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on her part of the state and then performs &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis measurements. As a result, Bob's state collapses to a mixed superposition of states. Now, &lt;strong&gt;if Alice measures her state to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;&lt;/strong&gt;, how do I write the state that Bob's share has collapsed to, in bra-ket notation? At first, I thought it would be &lt;span class=&quot;math-container&quot;&gt;$\langle 0 |^{\otimes n} (U \otimes I_n) | \Phi \rangle_{AB}$&lt;/span&gt; but that is, of course, incorrect (dimensional mismatch tells me that). I should probably be using some projection operators instead of simply &lt;span class=&quot;math-container&quot;&gt;$\langle 0 |^{\otimes n}$&lt;/span&gt; but I can't figure out exactly what.&lt;/p&gt;&#xA;&lt;p&gt;Second, assume that &lt;span class=&quot;math-container&quot;&gt;$| \Phi \rangle_{AB} = \left ( \frac{|00\rangle_{AB} + |11 \rangle_{AB}}{\sqrt{2}} \right )^{\otimes n}$&lt;/span&gt; so that Alice owns the first qubit from every term and Bob owns the second (essentially, they share &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; copies of the &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; Bell state between them). Now what I want to prove is &lt;span class=&quot;math-container&quot;&gt;$$U^{\dagger} | 0 \rangle^{\otimes n} = \color{red}{\langle 0 |^{\otimes n} (U \otimes I_n) | \Phi \rangle_{AB}} $$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;(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)&lt;/p&gt;&#xA;" OwnerUserId="6113" LastEditorUserId="55" LastEditDate="2020-09-30T03:54:23.577" LastActivityDate="2020-09-30T03:54:23.577" Title="Bra-Ket Notation and Proof of a Ket Equation in Two-Party Shared-Entanglement Setting" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12680" PostTypeId="2" ParentId="12635" CreationDate="2020-06-27T06:19:47.423" Score="1" Body="&lt;p&gt;About checking.&#xA;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 &lt;a href=&quot;https://quantum-computing.ibm.com/docs/guide/mult-entang/ghz-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurements&lt;/a&gt;, 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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gruYR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gruYR.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;I think that all listed checking methods (slightly customized) will work with other GHZ-state teleportation schemes, and in addition,&#xA;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).&lt;/p&gt;&#xA;&lt;p&gt;About teleportation schemes of arbitrary qubit states via clusters states can see e.g. &lt;a href=&quot;https://www.researchgate.net/publication/339663304_Experimental_realization_of_quantum_controlled_teleportation_of_arbitrary_qubit_states_via_cluster_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12280" LastEditorUserId="12280" LastEditDate="2020-06-28T16:35:38.590" LastActivityDate="2020-06-28T16:35:38.590" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12681" PostTypeId="2" ParentId="12676" CreationDate="2020-06-27T06:28:58.277" Score="1" Body="&lt;p&gt;Generally, you can have quantum computer with so-called qudits, i.e. qubits with two possible states are replaced by an entity having &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; distinguished states. Example is so-called qutrit having three possible values (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Application of qutrit was devised for example in quantum RAM. See this paper &lt;a href=&quot;https://arxiv.org/abs/0708.1879&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum random access memory for more information&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;), the noise also increases. See how much the noise &amp;quot;destroy&amp;quot; computation in quantum computers based on qubits.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-27T06:28:58.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12682" PostTypeId="2" ParentId="12677" CreationDate="2020-06-27T06:47:01.847" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1801.06121&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; uses &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_Z$&lt;/span&gt; to generate the real Clifford group. You can replace &lt;span class=&quot;math-container&quot;&gt;$C_Z$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$C_X$&lt;/span&gt;, but you will need the same number of generators.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2020-06-27T06:47:01.847" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12683" PostTypeId="1" AcceptedAnswerId="12691" CreationDate="2020-06-27T10:45:51.930" Score="1" ViewCount="37" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12510" LastEditorUserId="2879" LastEditDate="2020-06-27T18:51:24.700" LastActivityDate="2020-06-27T18:51:24.700" Title="What would be the difference between using qsharp library on python vs learning the Q# langauge?" Tags="&lt;simulation&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12684" PostTypeId="2" ParentId="12679" CreationDate="2020-06-27T10:58:44.827" Score="2" Body="&lt;p&gt;Let's consider the following &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubit state (taking &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; from the quesion):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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  &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M = m_{00} P_{00} + m_{01} P_{01} + m_{10} P_{10} + m_{11} P_{11}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;s are the corresponding projectors onto eigenspaces of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with their eigenvalues &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{00} = |0 0\rangle \langle 0 0| \otimes II \qquad m_{00} = 1&#xA;\\&#xA;P_{01} = |0 1\rangle \langle 0 1| \otimes II  \qquad m_{01} = 2&#xA;\\&#xA;P_{10} = |1 0\rangle \langle 1 0| \otimes II  \qquad m_{10} = 3&#xA;\\&#xA;P_{11} = |1 1\rangle \langle 1 1| \otimes II  \qquad m_{11} = 4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here it can be proved that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a Hermitian operator. The one projector whose action is described in the question (obtaining the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state after the measurement) is the &lt;span class=&quot;math-container&quot;&gt;$P_{00}$&lt;/span&gt; projector. The resulting state after applying &lt;span class=&quot;math-container&quot;&gt;$P_{00}$&lt;/span&gt; projector (the formula can be found from the same textbook's page 88):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_{out}\rangle = &#xA;\frac{P_{00} |\psi_{in}\rangle}{\sqrt{\langle \psi_{in}| P_{00} |\psi_{in} \rangle}} &#xA;= |0 0\rangle \otimes |00\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we apply some &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to Alice's qubit's before the measurement, then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_{out}\rangle = &#xA;\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}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we disregard Alice's qubits, then Bob's state will be as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_{B}\rangle = &#xA;\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}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators are 4x4 identity matrices.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-06-28T14:18:40.850" LastActivityDate="2020-06-28T14:18:40.850" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12685" PostTypeId="1" CreationDate="2020-06-27T11:36:29.413" Score="1" ViewCount="59" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;For example, what if with every qubit of data (X) on a quantum hard drive, we also required a separate, &amp;quot;assigned&amp;quot; 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 &amp;quot;reads&amp;quot; be used...like something borrowed from quantum error correction ideas?&lt;/p&gt;&#xA;" OwnerUserId="8193" LastEditorUserId="55" LastEditDate="2020-06-27T11:53:49.253" LastActivityDate="2020-06-27T12:29:18.150" Title="Creative way to clone quantum data?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12686" PostTypeId="2" ParentId="12685" CreationDate="2020-06-27T12:29:18.150" Score="1" Body="&lt;p&gt;So the no cloning theorem doesn't preclude you from creating the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha|0\rangle + \beta|1\rangle \rightarrow \alpha|00\rangle + \beta|11\rangle,$$&lt;/span&gt;&#xA;it just says you cant create&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha|0\rangle + \beta|1\rangle \rightarrow (\alpha|0\rangle + \beta|1\rangle)(\alpha|0\rangle + \beta|1\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So yeah, you could do something like create a state like the first state, and then you would have &amp;quot;cloned&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$\alpha|00\rangle + \beta|11\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\gamma|++\rangle + \delta|--\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That's the closest I can think of.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-06-27T12:29:18.150" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="12687" PostTypeId="2" ParentId="12677" CreationDate="2020-06-27T14:49:55.697" Score="1" Body="&lt;p&gt;Note that if you don't keep track of the phase &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$Y = iXZ$&lt;/span&gt;, so letting &lt;span class=&quot;math-container&quot;&gt;$\hat{Y} = XZ$&lt;/span&gt;, then something 'weird' happens:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{Y}\hat{Y} = XZXZ = X(-XZ)Z = -XXZZ = -I.&#xA;$$&lt;/span&gt;&#xA;This is not just an oddity. Any stabilizer code with a generator &lt;span class=&quot;math-container&quot;&gt;$G_{1}$&lt;/span&gt; containing an (odd number of) &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; will now not be possible, because:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G_{1}G_{1} = -I \in \mathcal{S}.&#xA;$$&lt;/span&gt;&#xA;But this is of course a contradiction, because &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; has &lt;em&gt;no&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstates, and therefore cannot be part of the stabilizer.&lt;/p&gt;&#xA;&lt;p&gt;By getting rid of that &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; explicitly you thus destroy the structure of the code.&lt;/p&gt;&#xA;&lt;p&gt;This is not to say that you explicitly need to keep track of the phase; many people use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Stabilizer_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;binary formalism&lt;/a&gt; (see section 'Relation between Pauli group and binary vectors'). Here you also don't track the phase.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{\pm 1\}\otimes\{X,\hat{Y},Z\}$&lt;/span&gt;. Table &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on page &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; of &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0602096.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; lists all such permutations (there are &lt;span class=&quot;math-container&quot;&gt;$24$&lt;/span&gt;, so that's why there are &lt;span class=&quot;math-container&quot;&gt;$24$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$X-,Y-$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-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.&lt;/p&gt;&#xA;&lt;p&gt;As noted in the other answer, another set of generators that you can use is &lt;span class=&quot;math-container&quot;&gt;$\{H,Z\}$&lt;/span&gt;, and equally &lt;span class=&quot;math-container&quot;&gt;$\{H,X\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, I would personally use the elementary permutations &lt;span class=&quot;math-container&quot;&gt;$\{1,2,3\} \rightarrow \{1,-3,2\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{1,2,3\} \rightarrow \{-2,1,3\}$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$\{1,2,3\}$&lt;/span&gt; indicating &lt;span class=&quot;math-container&quot;&gt;$\{X,Y,Z\}$&lt;/span&gt;), which you can use to create any permutation. These permutations are equivalent to a &lt;span class=&quot;math-container&quot;&gt;$e^{i\frac{\pi}{2}X}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\frac{\pi}{2}Z}$&lt;/span&gt; rotation, respectively. These are not real matrices, but do indicate much more structure.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-06-27T14:49:55.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12688" PostTypeId="2" ParentId="12653" CreationDate="2020-06-27T15:53:21.580" Score="1" Body="&lt;p&gt;(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 &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;. Recognize that, because &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; is the equal superposition of &lt;span class=&quot;math-container&quot;&gt;$ M$&lt;/span&gt; states, each of the marked bitstrings will have a coefficient of &lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{\sqrt{M}} $&lt;/span&gt;. For clarity, we can write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \omega \rangle = \frac{1}{\sqrt{M}} \sum_{k \in T} | k \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In contrast, &lt;span class=&quot;math-container&quot;&gt;$| s' \rangle $&lt;/span&gt; is the orthogonal state, so it has &lt;span class=&quot;math-container&quot;&gt;$N - M $&lt;/span&gt; states that are in a uniform superposition. Thus,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |s' \rangle = \frac{1}{\sqrt{N - M}} \sum_{k \not \in T} | k \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, we note the initial state is a uniform superposition over all potential states. Thus, there are &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; potential states, so we can write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we take the inner product:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that unless &lt;span class=&quot;math-container&quot;&gt;$k = j $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ \langle k | j \rangle $&lt;/span&gt; vanishes as two distinct basis vectors are orthogonal. Thus, we can rearrange the summation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Recall that we have &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; target states, so there are &lt;span class=&quot;math-container&quot;&gt;$N - M$&lt;/span&gt; nontarget states (or &lt;span class=&quot;math-container&quot;&gt;$N - M$&lt;/span&gt; times where &lt;span class=&quot;math-container&quot;&gt;$k \not \in T$&lt;/span&gt;), so:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{N - M}{\sqrt{N - M}} \frac{1}{\sqrt{N}} = \sqrt{\frac{N - M}{N}} $$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As desired.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-06-27T15:53:21.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12690" PostTypeId="2" ParentId="12621" CreationDate="2020-06-27T18:36:08.470" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&#xA;Let's say &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; are finite dimensional with bases &lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v_j\rangle_2$&lt;/span&gt;. The Hilbertspace &lt;span class=&quot;math-container&quot;&gt;$H_1\otimes H_2$&lt;/span&gt; has a basis &lt;span class=&quot;math-container&quot;&gt;$|w_{ij}\rangle = |u_i\rangle_1 \otimes |v_j\rangle_2$&lt;/span&gt;, but the order does not matter: &lt;span class=&quot;math-container&quot;&gt;$|w_{ij}\rangle=|u_i\rangle_1 \otimes |v_j\rangle_2 = |v_j\rangle_2 \otimes |u_i\rangle_1$&lt;/span&gt;. The same applies to the states &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;|\phi\rangle_1 \otimes |\chi\rangle_2 &#xA;=&amp;amp; \sum_{ij} \phi_i \chi_j |v_i\rangle_1\otimes |u_j\rangle_2 \\&#xA;=&amp;amp; \sum_{ij} \phi_i \chi_j |w_{ij}\rangle \\&#xA;=&amp;amp; \sum_{ij} \phi_i \chi_j |u_j\rangle_2\otimes |v_i\rangle_1  \\&#xA;=&amp;amp; |\chi\rangle_2 \otimes |\phi\rangle_1&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Your confusion probably comes from the fact that the &lt;em&gt;coefficients&lt;/em&gt; in a vector representation change when you change the basis. This is because in general the tensor product is not commutative. For example:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left(&#xA;\begin{array}{c}&#xA;1\\ 0 \end{array}\right) \otimes \left(&#xA;\begin{array}{c}&#xA;0\\ 1 \end{array}\right) = \left(&#xA;\begin{array}{c}&#xA;0\\1 \\ 0 \\ 0 \end{array}\right)$$&lt;/span&gt;&#xA;but&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left(&#xA;\begin{array}{c}&#xA;0\\ 1 \end{array}\right) \otimes \left(&#xA;\begin{array}{c}&#xA;1\\ 0 \end{array}\right) = \left(&#xA;\begin{array}{c}&#xA;0\\0 \\ 1 \\ 0 \end{array}\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2020-07-05T08:02:44.287" LastActivityDate="2020-07-05T08:02:44.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12691" PostTypeId="2" ParentId="12683" CreationDate="2020-06-27T18:51:00.980" Score="1" Body="&lt;p&gt;There are several separate questions entangled here.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-27T18:51:00.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12692" PostTypeId="1" AcceptedAnswerId="12697" CreationDate="2020-06-27T19:36:45.037" Score="1" ViewCount="98" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$[[n_1,k_1,d_1]]$&lt;/span&gt; is a better code than an &lt;span class=&quot;math-container&quot;&gt;$[[n_2,k_2,d_2]]$&lt;/span&gt; if for example &lt;span class=&quot;math-container&quot;&gt;$k_1/n_1 = k_2/n_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d_1&amp;gt;d_2$&lt;/span&gt; (same rate, larger distance); or maybe &lt;span class=&quot;math-container&quot;&gt;$d_1 = d_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k_1/n_1 \gt k_2/n_2$&lt;/span&gt;, (same distance, higher rate),or &lt;span class=&quot;math-container&quot;&gt;$n_1/k_1=n_2/k_2, d_1=d_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n_1 \lt n_2$&lt;/span&gt;, (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 &amp;quot;channel&amp;quot; (or error model) has to enter the picture as well as the decoding algorithm. Distance can also be difficult to calculate for large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. 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)&lt;/p&gt;&#xA;" OwnerUserId="12265" LastEditorUserId="55" LastEditDate="2020-09-30T03:54:31.373" LastActivityDate="2020-09-30T03:54:31.373" Title="Other than distance, what other metrics can be used to compare quantum error correcting codes?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12693" PostTypeId="1" CreationDate="2020-06-27T19:41:49.073" Score="4" ViewCount="101" Body="&lt;p&gt;I have a state &lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{2}(|00000\rangle+|00111\rangle+|11101\rangle+|11010\rangle).$$&lt;/span&gt; How does one create this state? In general, how does one create for instance an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-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?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="10480" LastEditDate="2021-01-22T21:10:32.007" LastActivityDate="2021-01-22T21:10:32.007" Title="Creating a specific cluster state" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12694" PostTypeId="2" ParentId="12656" CreationDate="2020-06-28T01:22:15.177" Score="1" Body="&lt;p&gt;This is not a saturation of the the Fuchs-van de Graaf upper bound, &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)^2 = 1-d(\rho,\sigma)^2$&lt;/span&gt;, but rather the lower bound, &lt;span class=&quot;math-container&quot;&gt;$1 - \sqrt{F(\rho,\sigma)} \leq d(\rho,\sigma)$&lt;/span&gt; (see, for example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states#Relationship_to_trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Consider, &lt;span class=&quot;math-container&quot;&gt;$\rho = | \psi \rangle \langle  \psi |$&lt;/span&gt;, a pure state and &lt;span class=&quot;math-container&quot;&gt;$\sigma = \frac{\mathbb{I}}{d}$&lt;/span&gt; is the maximally mixed state (for a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional Hilbert space). Then, the fidelity reduces to &lt;span class=&quot;math-container&quot;&gt;$F(| \psi \rangle \langle  \psi | , \frac{\mathbb{I}}{d}) = \langle \psi | \frac{\mathbb{I}}{d} |  \psi \rangle = \frac{1}{d}$&lt;/span&gt; (see, for example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;And the trace norm distance is &lt;span class=&quot;math-container&quot;&gt;$\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})$&lt;/span&gt;. Therefore, using the normalized trace norm, &lt;span class=&quot;math-container&quot;&gt;$d(\rho, \sigma) \equiv \frac{1}{2} \left\Vert \rho - \sigma \right\Vert_{1}$&lt;/span&gt;, we have, &lt;span class=&quot;math-container&quot;&gt;$1 - F(\rho,\sigma) = d(\rho,\sigma)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-06-28T04:36:13.853" LastActivityDate="2020-06-28T04:36:13.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12695" PostTypeId="2" ParentId="12693" CreationDate="2020-06-28T10:15:36.467" Score="3" Body="&lt;p&gt;You can think of a cluster state as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Graph_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;graph state&lt;/a&gt;, where the graph's vertices are on some &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional lattice (normally just &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-dimensional). Each vertex represents a qubit in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state, and two vertices that are next to each other on the lattice may be connected, which means that a &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; or controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate has been applied to them.&lt;/p&gt;&#xA;&lt;p&gt;Within this picture, it's relatively straightforward to prepare a cluster state. For a cluster state that is equivalent to some graph with vertices &lt;span class=&quot;math-container&quot;&gt;$V = (1,2,3...n)$&lt;/span&gt; and edges&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{a,b\} \in E$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the set of all connected edges and obvsiouly &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is a subset of &lt;span class=&quot;math-container&quot;&gt;$V^{2}$&lt;/span&gt;.&#xA;Starting from &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a Hadamard operation &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply a controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation to all pairs &lt;span class=&quot;math-container&quot;&gt;$\{a,b\}$&lt;/span&gt; of qubits if &lt;span class=&quot;math-container&quot;&gt;$\{a,b\} \in E$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This results in that particular cluster state. Note that there can be multiple different cluster states for a particular number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;Concerning the particular state that you wrote down; I am not sure if this is a cluster state. The operators &lt;span class=&quot;math-container&quot;&gt;$ZZIII$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$IIZIZ$&lt;/span&gt; are in the stabilizer of this state, meaning that the state is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; Pauli in them, which does not hold for the above two operators.&lt;/p&gt;&#xA;&lt;p&gt;If you're up for it, &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; 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:)&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-06-28T10:15:36.467" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12696" PostTypeId="2" ParentId="12692" CreationDate="2020-06-28T11:02:05.843" Score="1" Body="&lt;p&gt;If you focus solely on stabilizer/additive codes, I believe that the weight of the Paulis in the stabilizer is highly important. The &lt;em&gt;weight&lt;/em&gt; of a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli is the number of non-trivial factors in it.&lt;/p&gt;&#xA;&lt;p&gt;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-&lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; generator is easier said then done.&lt;/p&gt;&#xA;&lt;p&gt;For instance, the &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit 'perfect' code is by no means perfect because the generators are of weight &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;. If you use just &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; ancilla, that means that this ancilla needs to be connected to &lt;em&gt;all&lt;/em&gt; the data qubits.&lt;/p&gt;&#xA;&lt;p&gt;You can check out the concept of &lt;em&gt;LDPC&lt;/em&gt;-codes (Low Density Parity Check) that tries to acknowledge this problem.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-06-28T11:02:05.843" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12697" PostTypeId="2" ParentId="12692" CreationDate="2020-06-28T18:26:27.423" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Look at figure 4 in &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1208/1208.0928.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Lastly, when it comes to error models there are a lot of different things to consider. In &lt;a href=&quot;https://arxiv.org/abs/1910.08495&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, we talked about a few ion trap error models, and discussed how their structure interacts with different codes. &lt;a href=&quot;https://arxiv.org/abs/1711.04736&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-06-28T18:26:27.423" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12699" PostTypeId="1" AcceptedAnswerId="12701" CreationDate="2020-06-28T22:34:29.270" Score="2" ViewCount="303" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-diy-dCKRO&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-diy-dCKRO&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-solving-the-deutschs-problem-7EuD2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-solving-the-deutschs-problem-7EuD2&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since my only knowledge of quantum computing comes from this online textbook: &lt;a href=&quot;https://qiskit.org/textbook/ch-states/introduction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-states/introduction.html&lt;/a&gt;, which doesn't focus on the underlying physics), I was having trouble understanding the underlying physics used in those 2 videos.&lt;/p&gt;&#xA;&lt;p&gt;I will try to explain the device's function in my own words. Please critique any incorrect statements I make.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fLOul.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fLOul.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;2 qubits are encoded using a single photon.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;After the photon passes through the waveplates, it is equivalent to the quantum oracle being applied to both Qubit 1 and Qubit 2.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The difference in the interference pattern on the wall shows whether the quantum oracle was balanced or constant.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much for your time and I apologize for the long question.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/562531/question-about-diy-quantum-computer-prototype&quot;&gt;Cross posted on Physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12347" LastEditorUserId="9006" LastEditDate="2020-06-29T07:15:14.637" LastActivityDate="2020-06-29T07:33:30.803" Title="Question about DIY Quantum Computer Prototype" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;physical-qubit&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;photonics&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12700" PostTypeId="2" ParentId="12699" CreationDate="2020-06-29T00:14:14.740" Score="2" Body="&lt;p&gt;Not exactly.&lt;/p&gt;&#xA;&lt;p&gt;You are correct, there is a single photon; qubit 1 is its path, qubit 2 is its polarization.&lt;/p&gt;&#xA;&lt;p&gt;The waveplates implement an oracle (one from 4 possible).&lt;/p&gt;&#xA;&lt;p&gt;You are wrong about the beam splitters; beam splitters do not affect polarization, so they act on the qubit 1 only as Hadamard gates.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and the polarization filter acted as Hadamard gate.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-06-29T00:14:14.740" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12701" PostTypeId="2" ParentId="12699" CreationDate="2020-06-29T07:33:30.803" Score="2" Body="&lt;p&gt;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 &amp;quot;second&amp;quot; qubit in the fixed state determined by what polarisation the filter is detecting. So, at this point, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|-\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;not&lt;/em&gt; Hadamard. Instead, it is a beamsplitter, action,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B=\frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 &amp;amp; i \\ i &amp;amp; 1 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;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!&lt;/p&gt;&#xA;&lt;p&gt;Your state at this point is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)|-\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt;. You have an incident photon (travelling along &lt;span class=&quot;math-container&quot;&gt;$y=0$&lt;/span&gt;) that you might describe by &lt;span class=&quot;math-container&quot;&gt;$Ie^{i(kx-\omega t)}$&lt;/span&gt;. This will give you a transmitted component &lt;span class=&quot;math-container&quot;&gt;$Te^{i(kx-\omega t)}$&lt;/span&gt; and a reflected one &lt;span class=&quot;math-container&quot;&gt;$Re^{i(ky+\omega t)}$&lt;/span&gt; (note the different sin on the &lt;span class=&quot;math-container&quot;&gt;$\omega t$&lt;/span&gt; component). By assumption, the beamsplitter is 50:50 meaning &lt;span class=&quot;math-container&quot;&gt;$|R|^2=|T|^2=|I|^2/2$&lt;/span&gt;. We require continuity on the first derivative of the wavefunction at the boundary (&lt;span class=&quot;math-container&quot;&gt;$x=y=0$&lt;/span&gt;). This gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|I|^2=|T-R|^2.&#xA;$$&lt;/span&gt;&#xA;Since we don't care about global phase, we can assume &lt;span class=&quot;math-container&quot;&gt;$T=I/\sqrt{2}$&lt;/span&gt; is real. From this, you derive that &lt;span class=&quot;math-container&quot;&gt;$R=iI/\sqrt{2}$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; coefficient is top-left (and bottom-right) of the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; matrix, while &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is the two off-diagonal elements.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;1&amp;quot; path but not the &amp;quot;0&amp;quot; path, this would be like applying the gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$|H\rangle\leftrightarrow |V\rangle$&lt;/span&gt; (or not). The net effect on the calculation is the same, but there is a slight conceptual difference.&lt;/p&gt;&#xA;&lt;p&gt;At this point (however you've made them), if the two waveplates are the same, you're in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)|-\rangle&#xA;$$&lt;/span&gt;&#xA;whereas if they're different, you've got&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle-i|1\rangle)|-\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, you use the second beamsplitter. The two results are &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|-\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-29T07:33:30.803" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12702" PostTypeId="1" AcceptedAnswerId="12716" CreationDate="2020-06-29T07:53:39.477" Score="3" ViewCount="89" Body="&lt;p&gt;I have been learning about the concept of entanglement swapping and found an equation mentioned in the textbook, &lt;em&gt;Mathematics Of Quantum Computing: An Introduction&lt;/em&gt; written by Wolfgang Scherer.&lt;br /&gt;&#xA;At section 4.13, equation (4.13),&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;{|\Phi\rangle}^{ABCD} &amp;amp; = |\Psi^{-}\rangle^{AB} \otimes |\Psi^{-}\rangle^{CD} \\&#xA; &amp;amp; = \frac{1}{2} \left( |0101\rangle - |0110\rangle -|1001\rangle + |1010\rangle \right)\\&#xA; &amp;amp; = \frac{1}{2} \left( |\Psi^{+}\rangle^{AD} \otimes |\Psi^{+}\rangle^{BC} &#xA;                      - |\Psi^{-}\rangle^{AD} \otimes |\Psi^{-}\rangle^{BC}\\&#xA;                \quad - |\Phi^{+}\rangle^{AD} \otimes |\Phi^{+}\rangle^{BC}&#xA;                      + |\Phi^{-}\rangle^{AD} \otimes |\Phi^{-}\rangle^{BC}&#xA;                 \right)\\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;|\Phi^{+}\rangle = \frac{1}{\sqrt{2}} \left( |00\rangle + |11\rangle \right)\\&#xA;|\Phi^{-}\rangle = \frac{1}{\sqrt{2}} \left( |00\rangle - |11\rangle \right)\\&#xA;|\Psi^{+}\rangle = \frac{1}{\sqrt{2}} \left( |01\rangle + |10\rangle \right)\\&#xA;|\Psi^{-}\rangle = \frac{1}{\sqrt{2}} \left( |01\rangle - |10\rangle \right)&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;and the supernotes &lt;span class=&quot;math-container&quot;&gt;$\{ A,B,C,D \}$&lt;/span&gt; outside the ket indicate the qubits forming the bell state. Therefore, by doing bell measurement on qubits &lt;span class=&quot;math-container&quot;&gt;$(B,C)$&lt;/span&gt;, qubits &lt;span class=&quot;math-container&quot;&gt;$(A,D)$&lt;/span&gt; are in bell state. This result is also mentioned in &lt;em&gt;Multiparticle generalization of entanglement swapping&lt;/em&gt; by S. Bose et al (PhysRevA.57.822), but without derivation.&lt;/p&gt;&#xA;&lt;p&gt;So my question is that how to derive other similar equations efficiently instead of expand the bell states back into computational basis &lt;span class=&quot;math-container&quot;&gt;$| x \rangle^{\otimes n}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}$&lt;/span&gt; and go through the tedious algebras step by step? For example, how to do the entanglement swapping of &lt;span class=&quot;math-container&quot;&gt;${|\Phi\rangle}^{ABCD} = |\Psi^{-}\rangle^{AB} \otimes |\Phi^{+}\rangle^{CD}$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$(A,B)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(C,D)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(A,D)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(B,C)$&lt;/span&gt; or even &lt;span class=&quot;math-container&quot;&gt;$(A,C)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(B,D)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="10132" LastEditorUserId="55" LastEditDate="2020-06-30T16:51:00.547" LastActivityDate="2020-06-30T16:51:00.547" Title="Problem about entanglement swapping" Tags="&lt;textbook-and-exercises&gt;&lt;bell-experiment&gt;&lt;bell-basis&gt;&lt;entanglement-swapping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12703" PostTypeId="1" CreationDate="2020-06-29T11:42:38.397" Score="2" ViewCount="24" Body="&lt;p&gt;Considering the current state of research into quantum memristors, and the advantages/disadvantages of quantum and memristor driven computing architectures:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://escholarship.org/content/qt9cb4k842/qt9cb4k842_noSplash_c9655d27c36a95af34e033c62928942b.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Memristors&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://escholarship.org/content/qt41h5t5z3/qt41h5t5z3_noSplash_b780c09866e96f8eac3fcbcc0c3bc190.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Memristor Circuits&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.labs.hpe.com/pdf/Beyond_the_qubit.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing vs. Memory focused computation of Memristors&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;From a practical implementation point of view, what are current the limits of 'boosting' or 'complementing' quantum computations with memristors?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12524" LastEditorUserId="9006" LastEditDate="2020-06-30T08:00:15.170" LastActivityDate="2020-06-30T08:00:15.170" Title="What are the practical limitations of complementing quantum computations with memristors?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12706" PostTypeId="1" CreationDate="2020-06-29T14:01:23.130" Score="2" ViewCount="127" Body="&lt;p&gt;What are examples of quantum operators or evolutions of quantum states that can be modeled as sparse matrices?&lt;/p&gt;&#xA;" OwnerUserId="8707" LastActivityDate="2020-07-03T16:03:15.893" Title="Quantum operations as sparse matrices" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ClosedDate="2020-07-22T08:20:58.527" ContentLicense="CC BY-SA 4.0" />
  <row Id="12708" PostTypeId="1" CreationDate="2020-06-29T15:02:40.260" Score="3" ViewCount="36" Body="&lt;p&gt;Given two states &lt;span class=&quot;math-container&quot;&gt;$\rho_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_b$&lt;/span&gt;, and knowing that the SWAP gate swaps two qubits, how can one prove that visibilities&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 ]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;https://arxiv.org/pdf/1501.03099.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1501.03099.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="55" LastEditDate="2020-06-30T16:43:20.593" LastActivityDate="2020-06-30T16:43:20.593" Title="Prove expressions for visibilities $\operatorname{Tr}(\rho_a^2\rho_b^2), \operatorname{Tr}[(\rho_a \rho_b)^2]$ in terms of SWAP operations" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12709" PostTypeId="2" ParentId="12708" CreationDate="2020-06-29T15:56:29.897" Score="1" Body="&lt;p&gt;Explicitly write out what the trace is supposed to be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;Now you can apply the swaps to the basis elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\sum_{i,j,k,l}\langle jikl|S_{BC}S_{CD}\rho_a\otimes\rho_a\otimes\rho_b\otimes\rho_b|ijkl\rangle&#xA;$$&lt;/span&gt;&#xA;and keep going...&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\sum_{i,j,k,l}\langle jkli|\rho_a\otimes\rho_a\otimes\rho_b\otimes\rho_b|ijkl\rangle&#xA;$$&lt;/span&gt;&#xA;So, this is the same thing as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;It's worth a comment about how I chose the ordering of those terms. I just started with the first index (&lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;). Because it's closing index was &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, the next term I wrote down started with &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, and so on. Now, knowing the result I want, I'll use the commutativity of multiplication to choose a slightly different order:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;Next, notice that there's lots of completeness relations appearing here: &lt;span class=&quot;math-container&quot;&gt;$\sum_j|j\rangle\langle j|=I$&lt;/span&gt;. Thus, this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_k\langle k|\rho_aI\rho_aI\rho_bI\rho_B|k\rangle=\text{Tr}(\rho_a^2\rho_b^2).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The other one will work just the same.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-29T15:56:29.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12710" PostTypeId="1" AcceptedAnswerId="12711" CreationDate="2020-06-29T18:13:07.797" Score="0" ViewCount="33" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; on my qubit, then I mean to communicate the bit &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and when I perform the rotation &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, then I mean to communicate the bit 1.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;&lt;p&gt;Can anyone point out the error in my reasoning?&lt;/p&gt;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="509" LastEditorUserId="2879" LastEditDate="2020-06-29T18:32:11.903" LastActivityDate="2020-06-29T18:40:54.113" Title="Predicting rotations with many EPR pairs" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12711" PostTypeId="2" ParentId="12710" CreationDate="2020-06-29T18:31:15.123" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, so they are a lot easier to distinguish than arbitrary rotations by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You start with the EPR state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$&lt;/span&gt;. If you apply an X gate to the first qubit, you'll get state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|10\rangle + |01\rangle)$&lt;/span&gt;. Now you have to distinguish these two states by doing an experiment on the second qubit (and you can repeat that experiment 1kk times).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-06-29T18:31:15.123" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12712" PostTypeId="2" ParentId="12710" CreationDate="2020-06-29T18:40:54.113" Score="1" Body="&lt;p&gt;Whatever rotation you do on one half of the state does not affect the reduced state on the other half,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;\mathrm{Tr}_A[(U \otimes \mathbb{I}) |\psi \rangle\langle \psi | ( U^* \otimes \mathbb{I}) ]  &amp;amp;= \mathrm{Tr}_A[(U^* U \otimes \mathbb{I}) |\psi \rangle\langle \psi | ]   \\  &amp;amp;= \mathrm{Tr}_A[(\mathbb{I} \otimes \mathbb{I}) |\psi \rangle\langle \psi | ]  \\ &amp;amp;=  \mathrm{Tr}_A[ |\psi \rangle\langle \psi | ] . &#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the other party will never be able to distinguish between the two rotations you do and hence no communication.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-06-29T18:40:54.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12713" PostTypeId="2" ParentId="12301" CreationDate="2020-06-30T01:35:22.753" Score="0" Body="&lt;pre&gt;&lt;code&gt;operation ApplyConditionalPhase_0(register: LittleEndian) : Unit is Adj + Ctl&#xA;{&#xA;    using (aux = Qubit()) &#xA;    {&#xA;        (ControlledOnInt(0,X))(register!,aux);&#xA;    }&#xA;}&#xA;operation ApplyConditionalPhase(register : LittleEndian) : Unit is Adj + Ctl &#xA;{&#xA;    using (aux = Qubit()) &#xA;    {&#xA;        (ControlledOnInt(1,X))(register!,aux);&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="12239" LastEditDate="2020-06-30T19:24:43.710" LastActivityDate="2020-06-30T19:24:43.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12714" PostTypeId="2" ParentId="5730" CreationDate="2020-06-30T04:26:29.790" Score="0" Body="&lt;p&gt;One potential method, albeit clunky, is with traditional Hamiltonian simulation techniques like Trotterization. It's conceivable that you could argue:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ e^{-iHt} = \prod_{j = 0}^M e^{-i |V_j|/\sqrt{M} |j \rangle \langle j | t \otimes X} + O(*)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For some error amount. Then, the simulation of &lt;span class=&quot;math-container&quot;&gt;$e^{-i \gamma |j \rangle \langle j| t \otimes X}$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; should not be difficult, as it is the application of a phase of &lt;span class=&quot;math-container&quot;&gt;$-i\gamma t$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|j \rangle \langle j|$&lt;/span&gt; while leaving all other states intact (also, the ancilla should have the &lt;span class=&quot;math-container&quot;&gt;$e^{-i\gamma Xt}$&lt;/span&gt; applied.)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-06-30T04:26:29.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12715" PostTypeId="2" ParentId="12706" CreationDate="2020-06-30T07:06:45.737" Score="2" Body="&lt;p&gt;Pretty much everything!&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Equally, any tensor product of Paulis is sparse.&lt;/p&gt;&#xA;&lt;p&gt;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!)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-30T07:06:45.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12716" PostTypeId="2" ParentId="12702" CreationDate="2020-06-30T07:33:37.490" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle^{AD}$&lt;/span&gt; component is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Phi^+|^{AD}|\Phi\rangle^{ABCD}=-\frac12|\Phi^+\rangle^{BC}.&#xA;$$&lt;/span&gt;&#xA;You do this for each of the four states, and you can use that to reconstruct the overall description that you've given.&lt;/p&gt;&#xA;&lt;p&gt;Now, for simplifying the above calculation without expanding out the state in the computational basis. Remember that all Bell states can be converted into &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; by Pauli operations on either qubit. So, reduce the calculation to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Phi^+|^{AD}|\Psi^-\rangle^{AB}|\Psi^-\rangle^{CD}=Y_BY_C\langle\Phi^+|^{AD}|\Phi^+\rangle^{AB}|\Phi^+\rangle^{CD}.&#xA;$$&lt;/span&gt;&#xA;How does this help? Well, you could just explicitly calculate this once, or believe me, that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Phi^+|^{AD}|\Phi^+\rangle^{AB}|\Phi^+\rangle^{CD}=\frac12|\Phi^+\rangle^{BC},&#xA;$$&lt;/span&gt;&#xA;(the idea being that you can use this one result again and again) so the outcome is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12 Y_BY_C|\Phi^+\rangle^{BC}=-\frac12|\Phi^+\rangle^{BC}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-06-30T07:33:37.490" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12717" PostTypeId="1" CreationDate="2020-06-30T08:17:14.183" Score="1" ViewCount="41" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|c\rangle$&lt;/span&gt; is measured if the ancilla is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/syOcO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/syOcO.png&quot; alt=&quot;Post-selection&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So far, I did post-selection manually. This means that I took all results with ancilla being in a particular state (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the example above), removed others and finally normalized remained distribution to have sum of probabilities equal to 1.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is whether is it possible to do so in more elegant way in QASM on IBM Q Experience.&lt;/strong&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-06-30T08:17:14.183" Title="Post-selection in QASM" Tags="&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12718" PostTypeId="1" AcceptedAnswerId="12719" CreationDate="2020-06-30T08:34:10.063" Score="0" ViewCount="28" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bhaul.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bhaul.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; operation Algorithm() : Unit&#xA; {&#xA;    using (register = Qubit[4])&#xA;    {&#xA;        within&#xA;            {&#xA;                PrepareUniformSuperposition(4,LittleEndian(register));&#xA;                ApplyToEach(register[2],register);&#xA;            }&#xA;    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="12239" LastEditDate="2020-06-30T18:34:38.987" LastActivityDate="2020-06-30T18:34:38.987" Title="Entangling a register with another register using phase flips" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12719" PostTypeId="2" ParentId="12718" CreationDate="2020-06-30T08:42:40.490" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applytoeach&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyToEach&lt;/a&gt; operation applies an operation to each element of the array, you can't apply a qubit to each element of the array.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1...1\rangle$&lt;/span&gt; state to &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Controlled Z(register[0..2], register[3]);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you're looking to prepare a specific state, you might want to clarify this in the question.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To address the updated question:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You need to allocate two registers, one to hold the values &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; and another to hold the values &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The first line of 2(a) is almost satisfied with &lt;code&gt;PrepareUniformSuperposition&lt;/code&gt;: after this the first register will hold &lt;span class=&quot;math-container&quot;&gt;$\sum_j\frac{1}{\sqrt{N}}|j\rangle$&lt;/span&gt; and the second one &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;To finish preparing the state described in the first line of 2(a) you need to prepare the state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; on the second register. That can be done by converting &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; to binary and applying X gate to each qubit that corresponds to 1 bit.&lt;/li&gt;&#xA;&lt;li&gt;To implement the second line of 2(a), you need to write some extra code that compares &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and &amp;quot;marks&amp;quot; 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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2020-06-30T09:53:22.507" LastActivityDate="2020-06-30T09:53:22.507" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12720" PostTypeId="2" ParentId="12653" CreationDate="2020-06-30T12:32:07.620" Score="0" Body="&lt;p&gt;yes you are correct there is some missing information! This is known in the textbook and should be added in &lt;a href=&quot;https://github.com/qiskit-community/qiskit-textbook/pull/451&quot; rel=&quot;nofollow noreferrer&quot;&gt;this PR&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, instead of every state orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; as is required by the diffuser. I.e. we implement:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$-U_s = -2|s\rangle\langle s| + I_n$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;instead of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U_s = 2|s\rangle\langle s| - I_n $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This iterator with negative phase is equivalent to an iterator that searches for 'not-solutions' (of which there are &lt;span class=&quot;math-container&quot;&gt;$N-M$&lt;/span&gt;), hence an easy fix to do &lt;span class=&quot;math-container&quot;&gt;$N - $&lt;/span&gt; our result at the end.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;tl; dr&lt;/strong&gt;: The iterator in that example implements &lt;span class=&quot;math-container&quot;&gt;$-U_s$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-06-30T12:32:07.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12721" PostTypeId="1" CreationDate="2020-06-30T15:43:19.807" Score="1" ViewCount="38" Body="&lt;p&gt;Some papers use the &amp;quot;destabilizer group&amp;quot; for more efficient simulations; see for example (page 3):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.scottaaronson.com/showcase2/report/ted-yoder.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.scottaaronson.com/showcase2/report/ted-yoder.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&amp;quot;In addition to stabilizers, we also make use of destabilizers, introduced by Aaronson and Gottesman [10]. While the&#xA;stabilizer generators can be thought of as virtual Z operators, the destabilizers can be thought of as their conjugate,&#xA;virtual X operators.&lt;/em&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Given the stabilizers &lt;span class=&quot;math-container&quot;&gt;$S_i$&lt;/span&gt; of an &lt;span class=&quot;math-container&quot;&gt;$[n,k,d]$&lt;/span&gt; code I know of algorithms to put them in standard form&#xA;and calculate the encoded &lt;span class=&quot;math-container&quot;&gt;$\bar X$&lt;/span&gt;'s and &lt;span class=&quot;math-container&quot;&gt;$\bar Z$&lt;/span&gt;'s (also in standard forms). This gives me &lt;span class=&quot;math-container&quot;&gt;$m+k+k$&lt;/span&gt; operators. The destabilizers are an additional &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; operators on top of these; how are these calculated? Are there standard forms possibly related to the other generators'? Also, the &lt;span class=&quot;math-container&quot;&gt;$[2d^2,2,d]$&lt;/span&gt; toric code is usually&#xA;described with &lt;span class=&quot;math-container&quot;&gt;$2d^2$&lt;/span&gt; stabilizers (2 of them redundant); how is the redundancy handled?&lt;/p&gt;&#xA;" OwnerUserId="12265" LastActivityDate="2020-06-30T15:43:19.807" Title="How to calculate destabilizer group of toric and other codes" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12722" PostTypeId="1" CreationDate="2020-06-30T17:41:40.560" Score="1" ViewCount="133" Body="&lt;p&gt;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.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C_r(\rho) = S_{VN}(\rho_{diag}) - S_{VN}(\rho)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;I'm also defining this to be a 5-qubit stabilizer state.&lt;/p&gt;&#xA;&lt;p&gt;I'm using python and qutip to do these calculations.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5065" LastActivityDate="2020-07-02T11:12:11.473" Title="Algorithm to find stabilizer states" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12724" PostTypeId="2" ParentId="2343" CreationDate="2020-06-30T19:24:38.763" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5705" LastActivityDate="2020-06-30T19:24:38.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12725" PostTypeId="2" ParentId="12722" CreationDate="2020-06-30T20:34:35.060" Score="2" Body="&lt;p&gt;Let's make a few observations first:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Since an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit stabilizer state can be generated starting from &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle^{\otimes N}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$ | + \rangle^{\otimes N}$&lt;/span&gt; which is maximally coherent (under the free operations given by IO; see for example this &lt;a href=&quot;https://arxiv.org/abs/1609.02439&quot; rel=&quot;nofollow noreferrer&quot;&gt;review paper on quantum coherence&lt;/a&gt;). On the other hand, the initial state &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle^{\otimes N}$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The number of stabilizer states for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubits is exponential (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11771/how-many-n-qubit-stabilizer-states-are-there?rq=1&quot;&gt;this answer&lt;/a&gt;), a brute-force search would not be wise. Even for your &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit case, the number of states is &lt;span class=&quot;math-container&quot;&gt;$\approx 2^{20}$&lt;/span&gt;. However, since you want to use the relative entropy of coherence (and we're working in the pure state formalism), note that &lt;span class=&quot;math-container&quot;&gt;$S(| \psi \rangle \langle  \psi | ) = 0$&lt;/span&gt;, so you only need to compute the first term, i.e., &lt;span class=&quot;math-container&quot;&gt;$S(\mathcal{D}(| \psi \rangle \langle  \psi | ))$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}(\cdot)$&lt;/span&gt; is the dephasing superoperator (or the operator that dephases your state and makes it diagonal in the incoherent basis).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Moreover, the entries of &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{diag}}$&lt;/span&gt; are simply the inner products &lt;span class=&quot;math-container&quot;&gt;$|\langle k | \psi \rangle|^2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; 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 &lt;em&gt;spread&lt;/em&gt; of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the computational basis.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using &lt;a href=&quot;https://www.scottaaronson.com/chp/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scott Aaronson's code&lt;/a&gt; (hopefully, you can find something more updated), one can efficiently compute inner products between two stabilizer states.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I would also recommend understanding the interplay between multipartite coherence and entanglement, for example, as initiated in this (now famous) &lt;a href=&quot;https://arxiv.org/abs/1502.05876&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Update: I would also recommend using &lt;a href=&quot;http://www.qetlab.com/RelEntCoherence&quot; rel=&quot;nofollow noreferrer&quot;&gt;QETLAB&lt;/a&gt;'s function to compute relative entropy of coherence (or other measures) in case you don't have an efficient code.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-06-30T20:45:20.743" LastActivityDate="2020-06-30T20:45:20.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12726" PostTypeId="1" CreationDate="2020-06-30T20:58:38.187" Score="0" ViewCount="28" Body="&lt;p&gt;I've been looking into quantum algorithms, Deutsch–Jozsa, Grover, Shor.&lt;/p&gt;&#xA;&lt;p&gt;To me all they share is that they do something in parallel and then cleverly extra some specific information for that. Which to me means QC can provide efficient parallel programming if the goal itself isnt the direct result. By this I mean if the goal was actually knowing the result of each calculation.&lt;/p&gt;&#xA;&lt;p&gt;Is there a property that all problems that QC will excel at share?&lt;/p&gt;&#xA;" OwnerUserId="12510" LastActivityDate="2020-06-30T20:58:38.187" Title="Is there a shared property between the type of problems that quantum computers will beat classical computers at?" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-07-01T05:34:18.143" ContentLicense="CC BY-SA 4.0" />
  <row Id="12727" PostTypeId="2" ParentId="12645" CreationDate="2020-06-30T21:26:27.237" Score="1" Body="&lt;p&gt;The aim is to use Qiskits built in depolarizing quantum error channel function&#xA;&lt;span class=&quot;math-container&quot;&gt;$\texttt{depolarizing}$$\_$$\texttt{error(param, num_qubits, standard_gates=True)}$&lt;/span&gt; to create the desired depolarizing channel. It takes the depolarization parameter &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and number of qubits &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; to create the depolarizing channel&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{equation}&#xA;    \label{eqn:depo-chan-qiskit}&#xA;    \varepsilon(\rho) = (1-\lambda)\rho + \lambda Tr\left[\rho\right]\frac{I}{2^{n}}&#xA;    \text{.}&#xA;\end{equation}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It can then be manipulated to create the single qubit depolarizing channel&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{equation}&#xA;    \label{eqn:depo-chan-1qubit}&#xA;    \varepsilon(\rho_{single-qubit}) =    &#xA;    (1-P)\rho + \frac{P}{3}\left(X\rho X + Y\rho Y + Z\rho Z\right)&#xA;    \text{.}&#xA;\end{equation}$$&lt;/span&gt;&#xA;This is shown by the following derivation.&#xA;For a single qubit &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{I}{2^{1}} = \frac{1}{4} \left(I\rho I + X\rho X + Y\rho Y + Z\rho Z\right),$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$Tr[\rho] = 1.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we then chose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lambda=\frac{4^{n}P}{4^{n}-1},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the probability. At &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; the depolarization paramater&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lambda = \frac{4P}{3}$$&lt;/span&gt; and by substituting these results into &lt;span class=&quot;math-container&quot;&gt;$\varepsilon(\rho)$&lt;/span&gt; we get that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;    \varepsilon(\rho) &amp;amp;= (1-\frac{4P}{3})\rho +  &#xA;        \frac{4P}{3} \left(I\rho I + X\rho X + Y\rho Y + Z\rho Z\right)&#xA;    \frac{1}{4} \\&#xA;                      &amp;amp;=  \left( 1 - \frac{4P}{3} + \frac{P}{3} \right)\rho&#xA;                        + \frac{P}{3} \left(X\rho X + Y\rho Y + Z\rho Z\right) \\&#xA;                       &amp;amp;= (1-P)\rho + \frac{P}{3}\left(X\rho X + Y\rho Y + Z\rho Z\right)&#xA;    \text{.}&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/M6t6V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M6t6V.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is a link to my notebook explaining how it works &lt;a href=&quot;https://github.com/MIGUEL-LO/Qiskit_depolarazation_channel/blob/master/depo_channel_using_depolarizing_error.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/MIGUEL-LO/Qiskit_depolarazation_channel/blob/master/depo_channel_using_depolarizing_error.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9396" LastActivityDate="2020-06-30T21:26:27.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12728" PostTypeId="1" AcceptedAnswerId="12731" CreationDate="2020-07-01T02:57:58.587" Score="1" ViewCount="66" Body="&lt;p&gt;I have found the procedure of simulation process as this picture :&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kzbY1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kzbY1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/2058-9565/aaa5cc/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image reference&lt;/a&gt;. So in the low-level compilers, all single-qubit gates are approximated by the universal gate set (CNOT, H, T, S).&lt;/p&gt;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="8343" LastEditDate="2020-07-01T06:59:15.227" LastActivityDate="2020-07-01T07:11:38.120" Title="A question about how does the single qubit gate simulated in simulator?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12729" PostTypeId="1" AcceptedAnswerId="13170" CreationDate="2020-07-01T05:34:11.947" Score="2" ViewCount="211" Body="&lt;p&gt;I'm trying to make a calibration matrix using CompleteMeasFitter as in &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; 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 &lt;code&gt;The number of experiments in the Qobj (32768) is higher than the number of experiments supported by the device (75) [1102]&lt;/code&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:32.613" LastActivityDate="2020-09-11T08:23:16.137" Title="How to do error mitigation on the ibmq_16_melbourne?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12730" PostTypeId="1" CreationDate="2020-07-01T07:11:32.067" Score="2" ViewCount="65" Body="&lt;p&gt;&lt;strong&gt;Intention&lt;/strong&gt; - To learn and apply QFT on time-series data and compare the result with classical FFT.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Data Used&lt;/strong&gt; - Small timeseries data of 16 points -&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;array([ &#xA;    669., 589.95, 659.9, 998.85, 690.8, 390.75, 633.7, 457.65, 581.6,&#xA;    662.55, 1105.5, 1237.45, 537.4, 464.35, 685.3, 499.25&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Detrended the linear component and used the residual data for my experiment.&#xA;Encoded the values as amplitudes of the 16 basis states -&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def get_quantum_amplitude(signal):&#xA;    sum_squared_signal =  sum(signal**2)&#xA;    divider = np.sqrt(sum_squared_signal)&#xA;    amplitude_values = signal/divider&#xA;    no_of_qubit = np.log2(signal.size),&#xA;    return int(no_of_qubit[0]), amplitude_values, divider&#xA;&#xA;no_of_qubit, amplitude_values, divider = get_quantum_amplitude(x_notrend)&#xA;amplitude_values,no_of_qubit, divider&#xA;&#xA;qc = QuantumCircuit(no_of_qubit)&#xA;qft_circuit = QFT(no_of_qubit)&#xA;print(qft_circuit.qregs)&#xA;qc.initialize( amplitude_values, [i for i in reversed(qc.qubits)])&#xA;qc = qc.compose(qft_circuit, [0,1,2,3])&#xA;qc.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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(&lt;code&gt;fft_vals = fft.fft(sample)&lt;/code&gt;) of the same signal, I see there is a mismatch.&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;Can anybody explain this behaviour?&lt;/p&gt;&#xA;" OwnerUserId="12099" LastEditorUserId="12099" LastEditDate="2020-07-24T11:27:48.310" LastActivityDate="2020-07-24T11:27:48.310" Title="QFT on timeseries Data and compare results with classical FFT" Tags="&lt;qiskit&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12731" PostTypeId="2" ParentId="12728" CreationDate="2020-07-01T07:11:38.120" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle = U |\psi_0\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; is initial state of a quantum computer, &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; is its final state and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a matrix describing algorithm. Hence, a simulation is reduced to matrix multiplication.&lt;/p&gt;&#xA;&lt;p&gt;Some simulators artifically introduce noise present on real quantum hardware. This can be done by perturbation of matrices describing gates by a random variable.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note: My answer is concerning gate-based computers. Adiabatic quantum computers case may be different.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-01T07:11:38.120" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12732" PostTypeId="1" CreationDate="2020-07-01T10:14:16.957" Score="1" ViewCount="53" Body="&lt;p&gt;Given a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{AB}$&lt;/span&gt; on a joint system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;, we can consider the reduced density operator &lt;span class=&quot;math-container&quot;&gt;$\sigma_A = Tr_B(|\psi \rangle \langle \psi|)$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and subsequently purify this state into &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle_{RA}$&lt;/span&gt; using a new register &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; (ie &lt;span class=&quot;math-container&quot;&gt;$\sigma_A = Tr_R(|\phi \rangle \langle \phi|)$&lt;/span&gt;. My question is: what is the joint system on &lt;span class=&quot;math-container&quot;&gt;$RAB$&lt;/span&gt;? Is it the product state &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle \langle \phi|_{RA} \otimes \sigma_{B}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\sigma_B = Tr_A(|\psi \rangle \langle \psi|)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12540" LastEditorUserId="55" LastEditDate="2020-09-30T03:54:07.927" LastActivityDate="2020-09-30T03:54:07.927" Title="Joint system of RAB after purification of A into R" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12733" PostTypeId="1" CreationDate="2020-07-01T10:18:48.197" Score="1" ViewCount="24" Body="&lt;p&gt;The qubit relaxation time &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2020-07-01T10:18:48.197" Title="Qubit relaxation time dependencies" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12734" PostTypeId="2" ParentId="12732" CreationDate="2020-07-01T10:30:39.567" Score="2" Body="&lt;p&gt;Let's write the state in terms of its Schmidt decomposition.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle_{AB}=\sum_i\alpha_i|u_i\rangle_A|v_i\rangle_B,&#xA;$$&lt;/span&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle,|v_i\rangle$&lt;/span&gt; are orthonormal bases). Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\sum|\alpha_i|^2|u_i\rangle\langle u_i|&#xA;$$&lt;/span&gt;&#xA;and the purification that you would attempt would map &lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle\mapsto |u_i\rangle_A|w_i\rangle_R$&lt;/span&gt; (state &lt;span class=&quot;math-container&quot;&gt;$\sum_i\alpha_i|u_i\rangle|w_i\rangle$&lt;/span&gt;). Hence, you can see that the overall state would become&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i\alpha_i|u_i\rangle_A|v_i\rangle_B|w_i\rangle_R,&#xA;$$&lt;/span&gt;&#xA;which is GHZ-like, and certainly not separable unless &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle$&lt;/span&gt; was separable.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-01T10:30:39.567" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="12735" PostTypeId="2" ParentId="12316" CreationDate="2020-07-01T10:52:48.713" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; qubits denoted &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, a set of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; qubits denoted &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; and a set of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; qubits denoted &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. Now I can use &lt;span class=&quot;math-container&quot;&gt;$U_{CS}$&lt;/span&gt; to mean apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on qubits in sets &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; (the ancillas) and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, and act as identity on the qubits in set &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The calculation that they are doing is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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\|.&#xA;$$&lt;/span&gt;&#xA;Now, because you know that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts as &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on qubits &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\langle 0|^{\otimes b}_D$&lt;/span&gt; just moves past that operator.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\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\|.&#xA;$$&lt;/span&gt;&#xA;You'll note that now &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is only acting on qubits from sets &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; so I don't need the subscripts any more. We can do a similar thing with the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes a}_C$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$V_{DS}$&lt;/span&gt; only acts as &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on the &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; qubits. Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\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\|.&#xA;$$&lt;/span&gt;&#xA;This rearranges to give the result that you want,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;&amp;amp;=\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\|. \\&#xA;&amp;amp;=\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\|.&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-01T10:52:48.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12736" PostTypeId="2" ParentId="9536" CreationDate="2020-07-01T12:26:14.120" Score="3" Body="&lt;p&gt;Yes, there are. I just wrote a &lt;a href=&quot;https://arxiv.org/abs/2005.13418&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; about it, actually.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;impossible&lt;/em&gt; 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 &lt;em&gt;unlikely&lt;/em&gt;, with &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-value smaller than some threshold, or Bayes factor above some threshold. For example, in one of the &lt;a href=&quot;https://arxiv.org/abs/1511.03190&quot; rel=&quot;nofollow noreferrer&quot;&gt;loophole-free Bell tests&lt;/a&gt; they reported that the &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-value of their data under the local hidden variables hypothesis was below &lt;span class=&quot;math-container&quot;&gt;$10^{-30}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In a single-shot scenario, the &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The simplest way of constructing such a game is by doing parallel repetition of a pseudo-telepathy game, that is, playing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times in parallel a nonlocal game with Tsirelson bound 1. The local bound goes down to zero exponentially in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (this is highly nontrivial to prove), while the Tsirelson bound stays equal to 1, so there you have it.&lt;/p&gt;&#xA;&lt;p&gt;This construction is physically meaningless though, because the local bound here is the probability of winning &lt;em&gt;all&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; under the local hidden variables hypothesis, as proven by Rao's concentration bound, and goes up to one exponentially with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; under quantum mechanics. Now this is robust to experimental errors, so it is the way to do it in reality.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-07-01T12:26:14.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12737" PostTypeId="1" AcceptedAnswerId="12750" CreationDate="2020-07-01T13:22:16.807" Score="1" ViewCount="51" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there any vehicles or frameworks, (or math techniques) that could be helpful?&lt;/p&gt;&#xA;" OwnerUserId="4963" LastActivityDate="2020-07-02T09:03:38.580" Title="Visualizing &quot;interference&quot; in Quantum Programs" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12738" PostTypeId="2" ParentId="12668" CreationDate="2020-07-01T14:35:59.110" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;As I've done before, taking any basis, say &lt;span class=&quot;math-container&quot;&gt;$|v_{0}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v_{1}\rangle$&lt;/span&gt;, I'm looking for the matrix representation of the lineal operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$A |v_{0}\rangle = |v_{1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A |v_{1}\rangle = |v_{0}\rangle$&lt;/span&gt;. Applying eq. 2.12 we obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A |v_{0}\rangle = A_{00} |v_{0}\rangle + A_{10} |v_{1}\rangle = |v_{1}\rangle \Rightarrow A_{00} = 0; A_{10} = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A |v_{1}\rangle = A_{01} |v_{0}\rangle + A_{11} |v_{1}\rangle = |v_{0}\rangle \Rightarrow A_{01} = 0; A_{11} = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And now my mistake:&lt;/p&gt;&#xA;&lt;p&gt;I said this works for computational basis &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt; but not for &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;And I said that because I did these wrong calculations:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With computational basis:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ A |v_{0}\rangle = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 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 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With the other basis:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ A |v_{0}\rangle = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 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 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I used elements of the vectors and not vectors, so all these calculations are wrong.&lt;/p&gt;&#xA;&lt;p&gt;Let's see how is the correct way:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With computational basis:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;With the other basis:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope all become clear now. I couldn't explain my problem correctly before. I'm really sorry.&lt;/p&gt;&#xA;&lt;p&gt;I have to thanks a lot to &lt;strong&gt;teclado&lt;/strong&gt; from another forum web page.&lt;/p&gt;&#xA;" OwnerDisplayName="user12503" LastEditorDisplayName="user12503" LastEditDate="2020-07-01T16:21:02.140" LastActivityDate="2020-07-01T16:21:02.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12739" PostTypeId="1" AcceptedAnswerId="12747" CreationDate="2020-07-01T17:06:34.860" Score="7" ViewCount="282" Body="&lt;p&gt;How can a while loop be implemented in a quantum computer?&lt;/p&gt;&#xA;&lt;p&gt;If quantum computing consists of :&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;preparing a state&lt;/li&gt;&#xA;&lt;li&gt;applying a unitary operator&lt;/li&gt;&#xA;&lt;li&gt;measuring,&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;then it seems like it's not possible to wait for an indefinite amount of time before measuring.&#xA;How can one know that the while loop ended and that it's time to mesure ?&lt;/p&gt;&#xA;" OwnerUserId="12547" LastEditorUserId="491" LastEditDate="2020-07-17T23:26:07.117" LastActivityDate="2020-07-17T23:26:07.117" Title="How to implement a while loop in a quantum computer?" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;physical-realization&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12740" PostTypeId="2" ParentId="12739" CreationDate="2020-07-01T17:15:19.587" Score="6" Body="&lt;p&gt;I think the closest thing to a &amp;quot;while loop&amp;quot; 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 &amp;quot;close enough&amp;quot; to approximating the desired quantum state, so you can think of it as a while loop.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1905/1905.12068.pdf&quot; rel=&quot;noreferrer&quot;&gt;quantum assertions&lt;/a&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-07-01T17:15:19.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12742" PostTypeId="1" AcceptedAnswerId="12744" CreationDate="2020-07-01T20:42:36.960" Score="0" ViewCount="92" Body="&lt;p&gt;To distinguish between a coherent and de-cohered stage of the same system&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;Assumptions: Suppose the system initially is in a true superposition state &lt;code&gt;|ψ⟩ = 1/√2(|0⟩+|1⟩)&lt;/code&gt;, thus its density matrix initially has coherences (off diagonal) terms.&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix}0.5 &amp;amp; 0 \\ 0 &amp;amp; 0.5\end{bmatrix}&lt;/span&gt; We'll call that new stage 'the system has decohered'.&lt;/p&gt;&#xA;&lt;p&gt;The question is - what experimental test can determine whether the system has decohered or not.&lt;/p&gt;&#xA;&lt;p&gt;(*As the model-system any convenient physical 2- state model can be used i.e. spins, energy levels etc.)&lt;/p&gt;&#xA;" OwnerUserId="12551" LastEditorUserId="9006" LastEditDate="2020-07-02T09:49:19.647" LastActivityDate="2020-07-04T17:44:06.283" Title="Mixed state vs superposition , experiment test" Tags="&lt;density-matrix&gt;&lt;experiment&gt;&lt;decoherence&gt;&lt;product-states&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12743" PostTypeId="1" AcceptedAnswerId="12751" CreationDate="2020-07-01T21:19:07.883" Score="1" ViewCount="40" Body="&lt;p&gt;When a azimuthal phase &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{il\phi}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; rotation hence &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; can only take integer values. One can create these states by passing Gaussian beams into spiral wave plates.&#xA;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?&lt;/p&gt;&#xA;" OwnerUserId="11668" LastEditorUserId="55" LastEditDate="2020-07-03T09:41:12.473" LastActivityDate="2020-07-03T09:41:12.473" Title="How do we restrict to a limited number of dimensions, say 3 for qutrits, while using OAM states of light?" Tags="&lt;quantum-state&gt;&lt;photonics&gt;&lt;qutrit&gt;&lt;quantum-optics&gt;&lt;orbital-angular-momentum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12744" PostTypeId="2" ParentId="12742" CreationDate="2020-07-01T21:20:13.887" Score="2" Body="&lt;p&gt;So basically you want to distinguish the state &lt;span class=&quot;math-container&quot;&gt;$| + \rangle \langle  + | $&lt;/span&gt; from the dephased state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(| 0 \rangle \langle  0 | + | 1 \rangle \langle  1 | ) = \frac{\mathbb{I}}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here's a simple experiment: apply a Hadamard to both states and then measure in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; basis. For the ``true superposition'', this transforms it into the state &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle \langle  0 | $&lt;/span&gt; and so we get the output &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with probability 1 (when measured in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; basis). The mixed state on the other hand is unitarily invariant and therefore yields probabilities &lt;span class=&quot;math-container&quot;&gt;$(\frac{1}{2}, \frac{1}{2})$&lt;/span&gt; in &lt;em&gt;any&lt;/em&gt; basis (inclusing the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; basis).&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-01T21:20:13.887" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="12745" PostTypeId="1" AcceptedAnswerId="12752" CreationDate="2020-07-01T23:24:38.853" Score="2" ViewCount="421" Body="&lt;p&gt;I have looked at other questions that ask pretty much the same thing such as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9924/why-ibm-quantum-experience-is-giving-different-results-under-ibmq-qasm-simulator&quot;&gt;this&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;The circuit that I am running is exactly the same as the &lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/Coding_With_Qiskit/ep6_Bernstein-Vazirani_Algorithm.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Coding with Qiskit Episode 6 Tutorial&lt;/a&gt;, 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 &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; I didn't even get a single count for the ONLY theoretically expected result, for example if the secret number is &lt;code&gt;num='101010'&lt;/code&gt; then the &lt;code&gt;qasm_simulator&lt;/code&gt; correctly returned &lt;code&gt;num&lt;/code&gt; 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 &lt;code&gt;num&lt;/code&gt; returned in the results but it wasn't significant and had a probability similar to the rest of the counts.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2020-07-02T10:39:19.747" Title="Why are IBM QE backend results different from the qasm simulator for a simple quantum circuit?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12746" PostTypeId="1" AcceptedAnswerId="12748" CreationDate="2020-07-02T04:13:08.453" Score="4" ViewCount="143" Body="&lt;p&gt;The conditional min-entropy is defined as (&lt;a href=&quot;https://en.wikipedia.org/wiki/Min-entropy&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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\}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the smooth min-entropy is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{\min}^{\epsilon}(A|B)_{\rho} \equiv \sup_{\rho'} H_{\min}(A|B)_{\rho'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which just means that &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB}$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-bounded distance away from &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. I know how to write a semi-definite program of the conditional min-entropy, which is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{min } \text{tr}(X) \\&#xA;\text{such that:} \\&#xA;\mathbb{I} \otimes X \ge \rho_{AB}\\&#xA;X \in \text{Herm}(\mathcal{H_B})&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB}$&lt;/span&gt; who are &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-distance away from &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. This means I need to write a double objective function in the semidefinite program. Something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{max } \rho'_{AB} \\&#xA;\text{min } \text{tr}(X) \\&#xA;\text{such that:} \\&#xA;\mathbb{I} \otimes X \ge \rho'_{AB}\\&#xA;X \in \text{Herm}(\mathcal{H_B}) \\&#xA;\rho'_{AB} \in \mathcal{B}^\epsilon(\rho_{AB})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What is the correct form of this double objective function? Is there any hope of writing it in cvx (matlab)?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-09-30T03:54:03.547" LastActivityDate="2020-09-30T03:54:03.547" Title="Semi-definite program for smooth min-entropy" Tags="&lt;density-matrix&gt;&lt;semidefinite-programming&gt;&lt;matlab&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12747" PostTypeId="2" ParentId="12739" CreationDate="2020-07-02T07:22:16.570" Score="7" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;repeat until successful&amp;quot; i.e. a while loop.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-02T07:22:16.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12748" PostTypeId="2" ParentId="12746" CreationDate="2020-07-02T08:03:29.423" Score="6" Body="&lt;p&gt;You do not need a double objective function to solve this. Given &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; let &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABC}$&lt;/span&gt; be any purification of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. Then we can write the smooth min-entropy as the following SDP&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;2^{-H_{\min}^{\epsilon}(A|B)} = \min&amp;amp; \quad\mathrm{Tr}(\sigma_B) \\&#xA;\text{s.t.}&amp;amp; \quad I_A \otimes \sigma_B \geq \mathrm{Tr}_C(\widetilde{\rho}_{ABC}) \\&#xA;&amp;amp; \quad \mathrm{Tr}(\widetilde{\rho}_{ABC}) \leq 1 \\&#xA;&amp;amp; \quad \mathrm{Tr}(\widetilde{\rho}_{ABC} \rho_{ABC}) \geq 1 - \epsilon^2 \\&#xA;&amp;amp; \quad \widetilde{\rho}_{ABC} \geq 0 \\&#xA;&amp;amp; \quad \sigma_B \geq 0&#xA;\end{align*}&lt;/span&gt;&#xA;For more details on this I would suggest reading &lt;a href=&quot;https://arxiv.org/abs/1504.00233&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Information Processing with Finite Resources&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-07-02T19:58:09.647" LastActivityDate="2020-07-02T19:58:09.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12749" PostTypeId="2" ParentId="12739" CreationDate="2020-07-02T08:16:57.557" Score="6" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;Consider you have three registers&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a control &lt;span class=&quot;math-container&quot;&gt;$|\text{cntl}\rangle$&lt;/span&gt; bit&lt;/li&gt;&#xA;&lt;li&gt;some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;some condition for the while loop &lt;span class=&quot;math-container&quot;&gt;$|\text{cond}\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Assume the maximal number of iterations is bounded to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, then you perform the following &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; times:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Check if condition &lt;span class=&quot;math-container&quot;&gt;$|\text{cond}\rangle$&lt;/span&gt; is fulfilled for register &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Save the output in &lt;span class=&quot;math-container&quot;&gt;$|cntl\rangle$&lt;/span&gt; (note that &lt;span class=&quot;math-container&quot;&gt;$|\text{ctl}\rangle$&lt;/span&gt; will represent a superposition of &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt;, s.t. its &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for those substates that require additional iteration)&lt;/li&gt;&#xA;&lt;li&gt;Perform the unitary operation on register &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; conditioned on &lt;span class=&quot;math-container&quot;&gt;$|\text{ctl}\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;(Uncompute &lt;span class=&quot;math-container&quot;&gt;$|cntl\rangle$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Repeat.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;(If someone can tell me how to use Tikz code or insert a picture, I can provide you a circuit representation)&lt;/p&gt;&#xA;" OwnerUserId="7824" LastEditorUserId="7824" LastEditDate="2020-07-13T12:15:00.727" LastActivityDate="2020-07-13T12:15:00.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12750" PostTypeId="2" ParentId="12737" CreationDate="2020-07-02T09:03:38.580" Score="1" Body="&lt;p&gt;The awesome drag-and-drop quantum circuit visualization Quirk offers &lt;em&gt;some&lt;/em&gt; kind of visualiztion, i.e., one can display the probabilities (amplitudes) and density matrices for every step.&lt;/p&gt;&#xA;&lt;p&gt;E.g. in the implementation of Simon's algorithm below for the function &lt;span class=&quot;math-container&quot;&gt;$f(x) = f(x \oplus s), s=11$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|00&amp;gt;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,1,%22Measure%22,%22Measure%22%5D,%5B%22Chance2%22%5D,%5B%22H%22,%22H%22%5D,%5B%22Chance2%22%5D,%5B%22Measure%22,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;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]]}&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7824" LastActivityDate="2020-07-02T09:03:38.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12751" PostTypeId="2" ParentId="12743" CreationDate="2020-07-02T09:34:21.997" Score="2" Body="&lt;p&gt;As for any platform, one has to choose a suitable &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional &amp;quot;computational&amp;quot; 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 &amp;quot;robust&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;As far as I know from conversations with friends working on OAM &amp;amp; entanglement, the qubit case is often realised in a &lt;span class=&quot;math-container&quot;&gt;$\pm l$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$d \leq 5$&lt;/span&gt;: &lt;a href=&quot;https://www.osapublishing.org/optica/abstract.cfm?uri=optica-7-2-98&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.osapublishing.org/optica/abstract.cfm?uri=optica-7-2-98&lt;/a&gt; and this paper from the Viennise groups demonstrate higher-dimensional entanglement using OAM &lt;a href=&quot;https://www.nature.com/articles/nphoton.2016.12&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/nphoton.2016.12&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.97.012321&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.97.012321&lt;/a&gt; and &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/ab006e&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://iopscience.iop.org/article/10.1088/1367-2630/ab006e&lt;/a&gt; (arxiv versions available).&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2020-07-02T09:34:21.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12752" PostTypeId="2" ParentId="12745" CreationDate="2020-07-02T09:47:08.647" Score="4" Body="&lt;p&gt;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: &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&lt;/a&gt;&lt;br /&gt;&#xA;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 :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-02T09:47:08.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12753" PostTypeId="2" ParentId="7215" CreationDate="2020-07-02T10:13:28.243" Score="4" Body="&lt;p&gt;This question was solved in 2014 by &lt;a href=&quot;https://arxiv.org/abs/1405.4502&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vértesi and Brunner&lt;/a&gt;: 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.40.4277&quot; rel=&quot;nofollow noreferrer&quot;&gt;since 1989&lt;/a&gt; that there exists entangled states that do not violate any Bell inequality; &lt;a href=&quot;https://arxiv.org/abs/1606.02215&quot; rel=&quot;nofollow noreferrer&quot;&gt;more recently&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: It turns out that it is not easy, but it has been done. In &lt;a href=&quot;https://arxiv.org/abs/1512.00262&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; they showed a PPT entangled state that is local for all projective measurements, and in &lt;a href=&quot;https://arxiv.org/abs/1904.07899&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; a tripartite PPT entangled state that is local for all POVMs.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastEditorUserId="12541" LastEditDate="2020-07-17T12:11:55.487" LastActivityDate="2020-07-17T12:11:55.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12754" PostTypeId="2" ParentId="12745" CreationDate="2020-07-02T10:39:19.747" Score="2" Body="&lt;p&gt;For running on melbourne, try increasing the &lt;code&gt;optimization_level&lt;/code&gt; 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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;melb = provider.get_backend('ibmq_16_melbourne')&#xA;tcircuit_melb = transpile(circuit, melb, optimization_level=1) #change this&#xA;tcircuit_melb.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;(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 &lt;code&gt;110&lt;/code&gt; on melbourne:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'000': 50, '010': 11, '101': 5, '100': 824, '110': 134}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'111': 9, '000': 4, '011': 2, '010': 27, '101': 1, '100': 18, '110': 963}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-07-02T10:39:19.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12755" PostTypeId="2" ParentId="12722" CreationDate="2020-07-02T11:12:11.473" Score="0" Body="&lt;p&gt;As a supplement to the previous answer:&lt;/p&gt;&#xA;&lt;p&gt;No need to compute inner products ... It is well known that any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit stabiliser state is of the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |K|^{-1/2} \sum_{x\in K} i^{d\cdot x} (-1)^{q(x)+b\cdot x} |x\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$K\subset \mathbb{F}_2^{n}$&lt;/span&gt; is an affine subspace, &lt;span class=&quot;math-container&quot;&gt;$b,d\in \mathbb{F}_2^{n}$&lt;/span&gt; are vectors and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is a quadratic form (Dehaene and de Moor 2003). In particular, &lt;span class=&quot;math-container&quot;&gt;$|\langle x | \psi \rangle|^2$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1/|K|$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x\in K$&lt;/span&gt; and 0 else. Thus, the von Neumann entropy is &lt;span class=&quot;math-container&quot;&gt;$S(\rho_\mathrm{diag}) = \log |K| = \log 2^k = k \log 2$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$k=\dim K$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2020-07-02T11:12:11.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12756" PostTypeId="2" ParentId="9635" CreationDate="2020-07-02T13:32:03.190" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The distance &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt; is the geodesic distance of the &lt;strong&gt;Fubini-Study metric&lt;/strong&gt; on the pure state space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt; connecting the rays &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.  It is the only distance on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt; invariant under unitary evolution.&lt;/p&gt;&#xA;&lt;p&gt;The elements of the pure state space are rank &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; projectors onto rays of a projective Hilbert space. This space is a subspace of the following spaces:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The cone &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}^N$&lt;/span&gt; of positive definite &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; dimensional complex matrices.&lt;/li&gt;&#xA;&lt;li&gt;The quantum state space of density matrices &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^N$&lt;/span&gt; consisting of the intersection of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}^N$&lt;/span&gt;  with the space of unit trace matrices.&#xA;(Using the notation of &lt;a href=&quot;https://www.researchgate.net/profile/Karol_Zyczkowski/publication/325707595_Geometry_of_quantum_states_An_introduction_to_quantum_entanglement/links/5e6ab206299bf12e23c03ea7/Geometry-of-quantum-states-An-introduction-to-quantum-entanglement.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bengtsson and Życzkowski&lt;/a&gt; , pages 192 and 200).&#xA;The spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}^N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^N$&lt;/span&gt; can be equipped with a metric called the &lt;strong&gt;Bures metric&lt;/strong&gt; (Or the &lt;strong&gt;Bures-Wasserstein metric&lt;/strong&gt;).&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ds_B^2 = \text{tr}(GdX)$$&lt;/span&gt;&#xA;Where, in the first case, &lt;span class=&quot;math-container&quot;&gt;$X=R$&lt;/span&gt;,  a positive definite complex matrix, and in the second case &lt;span class=&quot;math-container&quot;&gt;$X=\rho$&lt;/span&gt;, a density matrix&#xA;The matrix valued one form &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is given implicitly in:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$dX = XG+GX$$&lt;/span&gt;&#xA;The geodesic distance function associated to this metric on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}^N$&lt;/span&gt; is given by ( Bengtsson and Życzkowski equation 9.31):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$\sqrt{F}$&lt;/span&gt; is the &lt;strong&gt;Uhlmann fidelity&lt;/strong&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{F}( R_1, R_2) = \text{tr}\left(\sqrt{\sqrt{R_1}R_2\sqrt{R_1})}\right)$$&lt;/span&gt;&#xA;While on the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^N$&lt;/span&gt;  of density matrices, the same metric gives rise to the geodesic distance function (equation 9.32):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D^{\mathcal{M}^N }_{\text{Bures}}(\rho_1, \rho_2) = \arccos(\sqrt{F}( \rho_1, \rho_2))$$&lt;/span&gt;&#xA;As can be easily seen, when the initial and final points are pure states, the first formula reduces to &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt; (multiplied by a factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;), while the second formula reduces to &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$d_2$&lt;/span&gt;. On the other hand, if we insist that the intermediate points are also quantum states we get the first distance &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; (Bengtsson and Życzkowski equation 9.50). The distance function of Bures was known long ago, but it was only much later when &lt;a href=&quot;http://www.physik.uni-leipzig.de/%7Euhlmann/PDF/Uh92b.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Uhlmann&lt;/a&gt; proved that the distance function originates from a Riemannian metric.&lt;/p&gt;&#xA;&lt;p&gt;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:&#xA;On a Riemannian manifold &lt;span class=&quot;math-container&quot;&gt;$(M, g)$&lt;/span&gt;, a geodesic is a curve: &lt;span class=&quot;math-container&quot;&gt;$[0, 1] \rightarrow M$&lt;/span&gt; starting at &lt;span class=&quot;math-container&quot;&gt;$x(0) = x_i$&lt;/span&gt; and ending at &lt;span class=&quot;math-container&quot;&gt;$x(1) = x_f$&lt;/span&gt; minimizing the functional (arc length):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I[x]= \int_0^1 g\left(\frac{dx}{dt}, \frac{dx}{dt}\right) dt$$&lt;/span&gt;&#xA;When a unique solution &lt;span class=&quot;math-container&quot;&gt;$x_c(t)$&lt;/span&gt; exists, then the arc length (regarded as a function of the initial and final points):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S(x_i, x_f) = I[x_c],$$&lt;/span&gt;&#xA;satisfies the Hamilton-Jacobi equation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ g(\nabla_{x_i}S, \nabla_{x_i}S) = 1$$&lt;/span&gt;&#xA;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.&#xA;The Fubini-Study geodesic motion on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt;, is integrable and the Hamilton-Jacobi equation is exactly solvable. Substituting &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle =|\psi\rangle + |d\psi\rangle $&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$d_1$&lt;/span&gt;, we get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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 }$$&lt;/span&gt;&#xA;One way to accomplish that is to exploit the homogeneity of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1} = SU(N)/S(U(N-1) \times U(1))$&lt;/span&gt;. In calculating the geodesic distance between two rays &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\psi_f$&lt;/span&gt;, we can perform a special unitary transformation to bring &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_i\rangle = [1, 0, …, 0]^t$$&lt;/span&gt;&#xA;We still have an &lt;span class=&quot;math-container&quot;&gt;$S(U(N-1) \times U(1))$&lt;/span&gt;, freedom which can be used to bring any other unit vector to the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = [\cos(\theta), \sin(\theta), 0, …, 0]^t$$&lt;/span&gt;&#xA;Substituting, the last expression in the Fubini-Study metric we obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ds^2_{FS} =d\theta^2$$&lt;/span&gt;&#xA;Thus, the Hamilton-Jacobi equation takes the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left(\frac{dS_{FS}}{d\theta}\right)^2 = 1$$&lt;/span&gt;&#xA;Whose, solution is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_{FS} = \theta + \text{Const.}$$&lt;/span&gt;&#xA;Fixing the constant by requiring the distance to be from the initial point (&lt;span class=&quot;math-container&quot;&gt;$\theta = 0$&lt;/span&gt;) to vanish:&#xA;Thus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ S_{FS}  = \theta = \arccos|\langle \psi|\psi_i\rangle|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt;  as a Riemannian symmetric space. In this respect, the angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt;  is symmetric space of rank one). The space of density matrices &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^N$&lt;/span&gt; possesses subspaces which are symmetric spaces of higher rank. Thus, these spaces have multiple radial coordinates and other distance functions.&lt;/p&gt;&#xA;&lt;p&gt;The Hamilton-Jacobi equation on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^{N-1}$&lt;/span&gt; can also be directly solved using the local Kählerian coordinates given in in Bengtsson and Życzkowski equation 4.51.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="9118" LastEditDate="2020-10-29T08:01:26.017" LastActivityDate="2020-10-29T08:01:26.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12757" PostTypeId="1" AcceptedAnswerId="12758" CreationDate="2020-07-02T15:27:54.677" Score="3" ViewCount="285" Body="&lt;p&gt;I was researching how to submit multiple pulse schedules/circuits in the same job and came across 2 methods:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Executing Experiments with &lt;a href=&quot;https://qiskit.org/documentation/apidoc/execute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;qiskit.execute&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.run.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;IBMQJobManager.run&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;What are the advantages and disadvantages of using either over the other?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-08-02T12:19:19.707" LastActivityDate="2020-09-01T14:03:30.323" Title="What is the difference between Qiskit execute and the IBMQJobManager?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12758" PostTypeId="2" ParentId="12757" CreationDate="2020-07-02T15:56:21.687" Score="2" Body="&lt;p&gt;&lt;code&gt;qiskit.execute&lt;/code&gt; is a convenience function that does both &lt;code&gt;transpile&lt;/code&gt; and &lt;code&gt;assemble&lt;/code&gt; under the cover.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;IBMQJobManager.run&lt;/code&gt; does &lt;em&gt;not&lt;/em&gt; do &lt;code&gt;transpile&lt;/code&gt;, but it does &lt;code&gt;assemble&lt;/code&gt;. &lt;code&gt;IBMQJobManager&lt;/code&gt; 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. &lt;code&gt;qiskit.execute&lt;/code&gt; doesn't do this and the job will just fail the limit is reached.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-07-02T15:56:21.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12759" PostTypeId="2" ParentId="8570" CreationDate="2020-07-02T16:48:22.020" Score="2" Body="&lt;p&gt;It is equivalent to saying that Alice and Bob share a state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^{AB} = \int \mathrm{d}\lambda \mu(\lambda) |\lambda\rangle\langle \lambda| \otimes \rho_\lambda, $$&lt;/span&gt;&#xA;without any restriction whatsoever on Alice's measurements (you forgot the normalisation, without which it is not a valid quantum state). The expression &amp;quot;classical message&amp;quot; only implies that there's no restriction on how the probability distribution &lt;span class=&quot;math-container&quot;&gt;$p(a|x,\lambda)$&lt;/span&gt; depends on &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;. Allowing the different &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; to be associated to orthogonal quantum states is enough to attain full generality. The formulation with the &amp;quot;classical message&amp;quot; is the most usual one, because it's more convenient for making calculations with a computer.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; for input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p(a|x)$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\rho_{a|x}$&lt;/span&gt;. All the information available can then be encoded in the assemblage &lt;span class=&quot;math-container&quot;&gt;$\sigma_{a|x} := p(a|x)\rho_{a|x}$&lt;/span&gt;. Now one can ask whether this assemblage allows for a Local Hidden State model, or it certifies that Alice and Bob shared entanglement.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-07-02T16:48:22.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12760" PostTypeId="1" AcceptedAnswerId="12761" CreationDate="2020-07-02T19:37:59.100" Score="0" ViewCount="51" Body="&lt;p&gt;Very general question so I'm not looking for an exact answer.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Contact the machinery that directly builds a full circuit and then run it?&#xA;Does it go line by line and apply the gate at each stage?&#xA;Can it just directly communicate with the qubits?&lt;/p&gt;&#xA;&lt;p&gt;Note: I am looking for answers for both gate based and continous computing&lt;/p&gt;&#xA;" OwnerUserId="12510" LastActivityDate="2020-07-03T01:49:17.423" Title="What are some general concepts of how a classical computer would interface with a quantum computer?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12761" PostTypeId="2" ParentId="12760" CreationDate="2020-07-03T01:49:17.423" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Prepare&lt;/strong&gt; a quantum program (Q#, Qiskit, etc.)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Compile&lt;/strong&gt; into the device's gate set (RZ, X, etc.)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Convert gates&lt;/strong&gt; into hardware instruction (Laser pulse of XYZ with frequency ABC, for example)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Report results&lt;/strong&gt; mechanically (e.g. measure qubit) and return to operating machine&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here's an &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/host-programs?tabs=tabid-python&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; of how Q# thinks of the classical/quantum interaction. What we discussed occurs between &amp;quot;Q# operation&amp;quot; and &amp;quot;Target machine.&amp;quot;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/agiVe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/agiVe.png&quot; alt=&quot;Q# architecture&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-07-03T01:49:17.423" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12762" PostTypeId="1" AcceptedAnswerId="12781" CreationDate="2020-07-03T02:06:30.460" Score="1" ViewCount="134" Body="&lt;p&gt;The motivation for this question comes from trace distance. For any two states &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt;, the trace distance &lt;span class=&quot;math-container&quot;&gt;$T(\rho, \sigma)$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$T(\rho, \sigma) = |\rho - \sigma|_1,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\cdot|_1$&lt;/span&gt; is the 1-norm and given by &lt;span class=&quot;math-container&quot;&gt;$|X|_1 = \text{Tr}(\sqrt{X^\dagger X})$&lt;/span&gt;. The point here is that I do not need to know &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; to compute the trace distance between them. All I need to know is &lt;span class=&quot;math-container&quot;&gt;$\rho - \sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can one also compute &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is the fidelity if one is only given &lt;span class=&quot;math-container&quot;&gt;$\rho - \sigma$&lt;/span&gt;? I am aware of bounds that can be placed using the trace distance on &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)$&lt;/span&gt; but was wondering if it could be exactly computed.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-07-03T09:20:43.227" LastActivityDate="2020-07-04T13:09:34.850" Title="Can the fidelity $F(\rho,\sigma)$ be computed knowing only $\rho - \sigma$?" Tags="&lt;fidelity&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12764" PostTypeId="1" AcceptedAnswerId="12765" CreationDate="2020-07-03T03:19:55.920" Score="1" ViewCount="109" Body="&lt;p&gt;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).&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12568" LastEditorUserId="9006" LastEditDate="2020-07-03T06:14:45.507" LastActivityDate="2020-07-03T12:46:36.513" Title="Tips on quantum cryptography?" Tags="&lt;resource-request&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12765" PostTypeId="2" ParentId="12764" CreationDate="2020-07-03T03:34:31.610" Score="2" Body="&lt;p&gt;I would start from this excellent intro course by Thomas Vidick and Stephanie Wehner, available in &lt;a href=&quot;https://www.edx.org/course/quantum-cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Edx&lt;/a&gt;. Then take a look at some classic papers:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The one that started it all: &lt;a href=&quot;https://core.ac.uk/reader/82447194&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://core.ac.uk/reader/82447194&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The one that brought a whole new approach: &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.67.661&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.67.661&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;The one that simplified it somewhat: &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.68.3121&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.68.3121&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang book&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="2403" LastEditDate="2020-07-03T12:46:36.513" LastActivityDate="2020-07-03T12:46:36.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12767" PostTypeId="2" ParentId="12706" CreationDate="2020-07-03T14:49:23.803" Score="1" Body="&lt;p&gt;Quantum Operations are visualized as Unitary matrices. This puts a limit to their sparseness. A Quantum Operation acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can be represented by Unitary Matrix of size &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt;. However since these are unitary operations, every column of the Unitary must have &lt;span class=&quot;math-container&quot;&gt;$L2$&lt;/span&gt; norm as &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and hence have atleast 1 non-zero value. This implies that out of the &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n = 2^{2n}$&lt;/span&gt; elements of the Unitary atleast &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; must be non-zero.&lt;/p&gt;&#xA;&lt;p&gt;Hence for a Quantum Operation acting on a given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. We can define a &lt;strong&gt;most sparse&lt;/strong&gt; matrix criteria. Unitaries which have the minimum i.e. &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; non-zero elements can be said to satisfy this criteria.&lt;br /&gt;&#xA;The most common/canonical Quantum Operations which satisfy the &lt;strong&gt;most sparse&lt;/strong&gt; matrix criteria are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Single Qubit Pauli Gates &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z,I$&lt;/span&gt; .&lt;/li&gt;&#xA;&lt;li&gt;Single Qubit Phase Gates &lt;span class=&quot;math-container&quot;&gt;$S,T,R_1(\theta),R_Z(\theta)$&lt;/span&gt; .&lt;/li&gt;&#xA;&lt;li&gt;Multi-Qubit &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt; gate.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;most sparse&lt;/strong&gt; matrix criteria can be said to be closed under the Tensor product operator as &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt;. &lt;strong&gt;Most Sparse&lt;/strong&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; &lt;strong&gt;Most Sparse&lt;/strong&gt; matrix is also a &lt;strong&gt;Most Sparse&lt;/strong&gt; matrix.&lt;/li&gt;&#xA;&lt;li&gt;Other common examples of these gates can be the &lt;span class=&quot;math-container&quot;&gt;$Increment, Decrement$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Shift$&lt;/span&gt; Unitaries.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We can also define a &lt;strong&gt;least sparse&lt;/strong&gt; criteria which can be said to include Unitaries which have the maximum i.e. &lt;span class=&quot;math-container&quot;&gt;$2^{2n}$&lt;/span&gt; non-zero elements.&#xA;The most common/canonical Quantum Operations which satisfy the &lt;strong&gt;most sparse&lt;/strong&gt; matrix criteria are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Hadamard Operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; for Single Qubit Operations.&lt;/li&gt;&#xA;&lt;li&gt;Single Qubit Rotation Gates &lt;span class=&quot;math-container&quot;&gt;$R_x(\theta),R_y(\theta)$&lt;/span&gt; for non-trivial &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Quantum Fourier Transform &lt;span class=&quot;math-container&quot;&gt;$QFT$&lt;/span&gt; for Multi Qubit Operations is another operations whose matrix representation can be said to be &lt;strong&gt;least sparse&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-07-03T16:03:15.893" LastActivityDate="2020-07-03T16:03:15.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12768" PostTypeId="2" ParentId="12602" CreationDate="2020-07-03T15:47:38.323" Score="3" Body="&lt;p&gt;If this is part of a debugging effort then you can use the &lt;code&gt;DumpRegister&lt;/code&gt; function.&#xA;If you have a qubit &lt;code&gt;q&lt;/code&gt; which is in the general state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are complex numbers such that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;DumpRegister([q])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;will give an output like this (&lt;em&gt;Having Different Numbers&lt;/em&gt;)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# wave function for qubits with ids (least to most significant): 1&#xA;∣0❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]&#xA;∣1❭:    -0.500000 + -0.500000 i  ==     ***********          [ 0.500000 ]  /      [ -2.35619 rad ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However if the qubit is entangled with some other qubit the result would be&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Qubits provided (0;) are entangled with some other qubit.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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].&lt;br /&gt;&#xA;The phase angle with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; axis is simply the &lt;span class=&quot;math-container&quot;&gt;$\arctan$&lt;/span&gt; of the ratio of the absolute values of the amplitudes.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us say the results give the amplitudes of basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\alpha = \alpha_R + i\alpha_I = |\alpha|e^{i\theta_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \beta = \beta_R + i\beta_I =|\beta|e^{i\theta_2} $&lt;/span&gt; respectively.&lt;br /&gt;&#xA;Then &lt;code&gt;q&lt;/code&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + \beta|1\rangle = |\alpha|e^{i\theta_1}|0\rangle + |\beta|e^{i\theta_2}|1\rangle$&lt;/span&gt;.&lt;br /&gt;&#xA;We can remove the global phase and thus the relative phase will be &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta_1-i\theta_2} = e^{i\theta}$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$\phi = 2\arctan\frac{|\beta|}{|\alpha|}$&lt;/span&gt;.&lt;br /&gt;&#xA;Thus &lt;code&gt;q&lt;/code&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\theta}{2}|0\rangle + e^{i\theta}\sin\frac{\theta}{2}|1\rangle$&lt;/span&gt;.&#xA;This state can be represented on the Bloch Sphere by the coordinates &lt;span class=&quot;math-container&quot;&gt;$(\sin\theta\cos\phi, \sin\theta\sin\phi, \cos\theta)$&lt;/span&gt;. Consequently the phase angle with X axis is given by &lt;span class=&quot;math-container&quot;&gt;$\arctan$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; coordinates. Thus the phase angle is &lt;span class=&quot;math-container&quot;&gt;$\phi=2\arctan\frac{|\beta|}{|\alpha|}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-07-03T15:47:38.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12769" PostTypeId="1" CreationDate="2020-07-03T18:47:05.800" Score="1" ViewCount="113" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12571" LastEditorUserId="9006" LastEditDate="2020-07-04T06:21:39.337" LastActivityDate="2020-07-16T13:23:19.623" Title="Does anyone know of Qiskit source code for a Bernstein Vazirani grover's algorithm for N bits? If so please share" Tags="&lt;qiskit&gt;&lt;resource-request&gt;&lt;grovers-algorithm&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12770" PostTypeId="1" CreationDate="2020-07-03T19:44:36.370" Score="1" ViewCount="105" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aIPwn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aIPwn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am having challenges with Microsoft Q#. I wrote this short code and it says it can only occur at a global scope.&lt;/p&gt;&#xA;&lt;p&gt;How do I fix this error? Any ideas? Thank you&lt;/p&gt;&#xA;" OwnerUserId="11600" LastEditorUserId="2879" LastEditDate="2020-07-04T17:53:09.800" LastActivityDate="2020-07-04T17:53:09.800" Title="Microsoft Q#: &quot;Namespace declarations can only occur at a global scope&quot; error" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12771" PostTypeId="2" ParentId="12770" CreationDate="2020-07-03T20:24:07.597" Score="1" Body="&lt;p&gt;This error is about the “global scope” of the namespace declaration, which is unrelated to the “global phase” mentioned in your Q# code.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;namespace Quantum.Kata.SingleQubitGates&lt;/code&gt; declaration from your code, it should work.&lt;/p&gt;&#xA;" OwnerUserId="10473" LastActivityDate="2020-07-03T20:24:07.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12772" PostTypeId="1" AcceptedAnswerId="12773" CreationDate="2020-07-03T22:46:25.233" Score="2" ViewCount="263" Body="&lt;p&gt;I know this it's perhaps, a little &amp;quot;stupid&amp;quot; question, but... What's the purpose of phase in Quantum?&lt;/p&gt;&#xA;&lt;p&gt;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?)&lt;/p&gt;&#xA;" OwnerUserId="9013" LastEditorUserId="55" LastEditDate="2020-07-04T10:28:01.400" LastActivityDate="2020-07-11T08:37:49.400" Title="What's the purpose of phases in quantum mechanics?" Tags="&lt;quantum-state&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12773" PostTypeId="2" ParentId="12772" CreationDate="2020-07-03T23:08:31.833" Score="7" Body="&lt;p&gt;This is simply not true. It is the &lt;em&gt;global&lt;/em&gt; phase that is not physically relevant -- which can be immediately seen from the linearity of the Schrodinger equation: two states &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle, e^{i \phi} | \psi \rangle$&lt;/span&gt; are both solutions to the &lt;em&gt;same&lt;/em&gt; equation.&lt;/p&gt;&#xA;&lt;p&gt;However, consider a qubit state, &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \in \mathbb{C}^{2}$&lt;/span&gt;, with two different choices of &lt;em&gt;local&lt;/em&gt; (a.k.a. relative) phases: &lt;span class=&quot;math-container&quot;&gt;$| + \rangle \equiv \frac{1}{\sqrt{2}}(| 0 \rangle + | 1 \rangle) \text{ and } | - \rangle \equiv \frac{1}{\sqrt{2}}(| 0 \rangle - | 1 \rangle)$&lt;/span&gt;, which are orthogonal to each other and hence completely distinguishable (for example, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8283/how-to-show-whether-two-states-are-indistinguishable-or-not-by-measuring-in-a-di&quot;&gt;this answer&lt;/a&gt;). For an explanation of the difference(s) between global and local phases, see &lt;a href=&quot;https://physics.stackexchange.com/questions/177588/the-meaning-of-the-phase-in-the-wave-function&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also, phases &lt;em&gt;are&lt;/em&gt; relevant for both amplitudes and probabilities of outcomes (again, it is the &lt;em&gt;global&lt;/em&gt; phase that is not physically relevant). For example, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12742/mixed-state-vs-superposition-experiment-test/12744#12744&quot;&gt;this answer&lt;/a&gt;, where two states that have same probability of outcomes when measured in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; basis yield different probabilities when measured in a different basis (say &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;). Apart from this, phases are clearly very important for several quantum computing protocols like &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum phase estimation&lt;/a&gt;, in cyclic evolutions i.e., &lt;a href=&quot;https://en.wikipedia.org/wiki/Geometric_phase#Berry_phase_in_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;Berry phase&lt;/a&gt;, etc.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-07-11T08:37:49.400" LastActivityDate="2020-07-11T08:37:49.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12774" PostTypeId="2" ParentId="12772" CreationDate="2020-07-03T23:12:39.203" Score="3" Body="&lt;p&gt;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 &amp;quot;probability theory with negative numbers.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = |0\rangle + |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = |0\rangle - |1\rangle$&lt;/span&gt; in the Z basis. Both states will give a 50/50 distribution. But if you apply a Hadamard transform to them, &lt;span class=&quot;math-container&quot;&gt;$$H|+\rangle = H|0\rangle + H|1\rangle = (|0\rangle + |1\rangle) + (|0\rangle - |1\rangle) = |0\rangle,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H|-\rangle = H|0\rangle - H|1\rangle = (|0\rangle + |1\rangle) - (|0\rangle - |1\rangle) = |1\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-07-03T23:12:39.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12776" PostTypeId="2" ParentId="12769" CreationDate="2020-07-04T05:44:50.243" Score="2" Body="&lt;p&gt;Qiskit Aqua includes both algorithms:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.aqua.algorithms.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/qiskit.aqua.algorithms.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-07-04T09:45:16.593" LastActivityDate="2020-07-04T09:45:16.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12777" PostTypeId="2" ParentId="12772" CreationDate="2020-07-04T06:27:31.797" Score="1" Body="&lt;p&gt;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 &amp;quot;marked&amp;quot; by negative amplitude (i.e. phase is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;). 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-04T06:27:31.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12779" PostTypeId="1" CreationDate="2020-07-04T11:10:10.980" Score="3" ViewCount="99" Body="&lt;p&gt;I am trying to calculate the expectation value of a customized operator on two similar but differently constructed states &lt;span class=&quot;math-container&quot;&gt;$\phi = \phi_2 =\frac{1}{\sqrt{2}}\left( |001⟩ + |011⟩\right)$&lt;/span&gt; which consist of more qubits than the operator. (via Qiskit)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.aqua.operators import CircuitOp, state_fns, Zero, One&#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.z(0)&#xA;circuit.z(1)&#xA;&#xA;op = CircuitOp(circuit)&#xA;&#xA;psi = QuantumCircuit(3)&#xA;psi.h(1)&#xA;psi.x(2)&#xA;psi = state_fns.CircuitStateFn(circuit)&#xA;psi2 = 1 / np.sqrt(2) * ((Zero ^ Zero ^ One) + (Zero ^ One ^ One))&#xA;&#xA;&#xA;print('Expectation for phi:', psi.adjoint().compose(op).compose(psi).eval().real)  # Expectation for phi: 1.0&#xA;print('Expectation for phi2:', psi2.adjoint().compose(op).compose(psi2).eval().real) # Error&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The second expectation raises an error:&#xA;&lt;code&gt;ValueError: Composition is not defined over Operators of different dimensions, 3 and 2, respectively.&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Why is this happening? Why the first expectation is executed fine but not the second one?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12572" LastEditorUserId="55" LastEditDate="2020-07-07T13:08:41.357" LastActivityDate="2020-07-07T13:08:41.357" Title="Expectation value of an operator error: Composition is not defined over operators of different dimensions," Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12780" PostTypeId="2" ParentId="5532" CreationDate="2020-07-04T12:46:27.057" Score="1" Body="&lt;p&gt;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...&lt;/p&gt;&#xA;&lt;p&gt;See &lt;em&gt;&lt;strong&gt;Account Management&lt;/strong&gt;&lt;/em&gt; section in the below link for version &amp;quot;&amp;lt;0.3/v1&amp;quot; vs &amp;quot;&amp;gt;=0.3/v2&amp;quot; credentials:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/#updating-your-ibm-q-experience-credentials&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ibmq-provider/#updating-your-ibm-q-experience-credentials&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12574" LastActivityDate="2020-07-04T12:46:27.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12781" PostTypeId="2" ParentId="12762" CreationDate="2020-07-04T13:09:34.850" Score="5" Body="&lt;p&gt;The answer is no, as the following counter-example reveals. Let &lt;span class=&quot;math-container&quot;&gt;$\varepsilon\in(0,1)$&lt;/span&gt; and define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_0  = &#xA;\begin{pmatrix}&#xA;\frac{1+\varepsilon}{2} &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \frac{1-\varepsilon}{2}&#xA;\end{pmatrix},\quad&#xA;\rho_1 = &#xA;\begin{pmatrix}&#xA;\frac{1-\varepsilon}{2} &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \frac{1+\varepsilon}{2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;as well as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_0  = &#xA;\begin{pmatrix}&#xA;\varepsilon &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1-\varepsilon &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix},\quad&#xA;\sigma_1 = &#xA;\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1-\varepsilon &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \varepsilon&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;The differences agree,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_0 - \rho_1 =&#xA;\begin{pmatrix}&#xA;\varepsilon &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; -\varepsilon&#xA;\end{pmatrix} = \sigma_0 - \sigma_1,&#xA;$$&lt;/span&gt;&#xA;but the fidelities are not equal:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{F}(\rho_0,\rho_1) = \sqrt{(1 + \varepsilon)(1-\varepsilon)}&#xA;\quad\text{and}\quad&#xA;\mathrm{F}(\sigma_0,\sigma_1) = 1-\varepsilon.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-07-04T13:09:34.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12782" PostTypeId="2" ParentId="12732" CreationDate="2020-07-04T14:09:20.683" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi_R\rangle|\psi_A\rangle|\psi_B\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;monogamy of entanglement&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-07-04T14:09:20.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12783" PostTypeId="1" CreationDate="2020-07-04T16:27:45.423" Score="2" ViewCount="67" Body="&lt;p&gt;The book by John Watrous, &amp;quot;The Theory of Quantum Information&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}_0, \mathcal{X}_1, \mathcal{Y}_0, \mathcal{Y}_1$&lt;/span&gt; are complex Euclidean spaces (Finite dimensional Hilbert spaces on complex field) and &lt;span class=&quot;math-container&quot;&gt;$\Phi_0 \in C(\mathcal{X}_0,\mathcal{Y}_0)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\Phi_1 \in C(\mathcal{X}_1,\mathcal{Y}_1)$&lt;/span&gt; are two quantum channels, with &lt;span class=&quot;math-container&quot;&gt;$\Phi_0$&lt;/span&gt; being entanglement breaking, then show that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;I_C(\Phi_0\otimes\Phi_1) = I_C(\Phi_1).&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt;&#xA;Here, the space of channels &lt;span class=&quot;math-container&quot;&gt;$C(\mathcal{X}_0, \mathcal{Y}_0)$&lt;/span&gt; consists of linear, completely positive trace-preserving (CPTP) maps on &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal{X}_0)$&lt;/span&gt; (linear operators on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}_0$&lt;/span&gt;) returning operators in &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal{Y}_0)$&lt;/span&gt;. For any channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; and state &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; (states are non-negative operators with unit trace), the coherent information &lt;span class=&quot;math-container&quot;&gt;$I_C(\Phi;S) = H(\Phi(S)) - H((\Phi\otimes I)(vec(\sqrt{S})vec(\sqrt{S})^\dagger))$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I_C(\Phi) = \max_S I_C(\Phi;S)$&lt;/span&gt;, where the maximum is taken with respect to all states. For any operator &lt;span class=&quot;math-container&quot;&gt;$A = \sum_{i,j}a_{ij}|e_i\rangle\langle f_j|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$vec(A) = \sum_{i,j}a_{ij}|e_i\rangle \otimes |f_j\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A separable state is a state of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i P_i\otimes Q_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q_i$&lt;/span&gt; are states with &lt;span class=&quot;math-container&quot;&gt;$\sum_i p_i = 1$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$p_i\ge 0$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;There is a theorem that may prove useful: The following are equivalent.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is entanglement breaking (EB).&lt;/li&gt;&#xA;&lt;li&gt;For any finite-dimensional Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Phi\otimes I_\mathcal{Z}$&lt;/span&gt; is separable where &lt;span class=&quot;math-container&quot;&gt;$I_\mathcal{Z}$&lt;/span&gt; is the identity map in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Z}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;There exist states &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; and non-negative operators &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}M_i = I$&lt;/span&gt; (called a POVM) such that &lt;span class=&quot;math-container&quot;&gt;$\Phi(S) = \sum_i \rho_i Tr(SM_i)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I was able to show &lt;span class=&quot;math-container&quot;&gt;$I_C(\Phi_0 \otimes\Phi_1) \ge I_C(\Phi_0) + I_C(\Phi_1)$&lt;/span&gt; for any two channels &lt;span class=&quot;math-container&quot;&gt;$\Phi_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_1$&lt;/span&gt;. The book does prove that &lt;span class=&quot;math-container&quot;&gt;$I_C(\Phi) \le 0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; EB. But I've been unable to make any progress beyond that.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://math.stackexchange.com/q/3742968/173147&quot;&gt;Cross-posted on math.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="12577" LastEditorUserId="55" LastEditDate="2020-09-30T03:53:58.837" LastActivityDate="2020-09-30T03:53:58.837" Title="Coherent Information and Entanglement Breaking channels" Tags="&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12784" PostTypeId="2" ParentId="12742" CreationDate="2020-07-04T17:44:06.283" Score="-1" Body="&lt;p&gt;So as to provide a resource for use and benefit of others , I'd like to provide general description and links to important related articles. As multiply explained above by @keisuke.akira the measurement and characterization of Coherence of a state is an important,vibrant and long studied subject. Coherence is much richer and complete description.&#xA;Here are a few &amp;quot;root&amp;quot; studies both indicated above and additional&#xA;&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.113.170401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Observable_Measure_of_Quantum_Coherence&lt;/a&gt;_&lt;em&gt;&lt;strong&gt;,&#xA;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0031-8949/79/06/065013&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introd_Quantum_Tomography&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;,&lt;/p&gt;&#xA;&lt;p&gt;The knowledge of complete density matrix is in fact a lot - more then needed. A more limited, and often sufficient manifestation is the Purity of state&#xA;&lt;span class=&quot;math-container&quot;&gt;$Tr(\rho^2)$&lt;/span&gt; (as pointed above by @QurakNerd), my question was on the Experimental realization of that, and lots of research was and is done on this subject&#xA;&lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.95.110504&quot; rel=&quot;nofollow noreferrer&quot;&gt;Purity_Estimation&lt;/a&gt; __,&#xA;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0031-8949/83/04/045001/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;estimation_quantum_state_purity&lt;/a&gt; ___,&#xA;&lt;a href=&quot;https://www.worldscientific.com/doi/abs/10.1142/S1230161214400095&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measurement_Purity_Simplest&lt;/a&gt; ___,&#xA;&lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.85.042316&quot; rel=&quot;nofollow noreferrer&quot;&gt;Purity&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12551" LastActivityDate="2020-07-04T17:44:06.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12785" PostTypeId="1" AcceptedAnswerId="12817" CreationDate="2020-07-04T22:21:32.010" Score="5" ViewCount="132" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;It seems to me that this &lt;em&gt;should&lt;/em&gt; be possible, just as any program on a conventional computer can be transformed into a boolean circuit (in theory).&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2020-07-13T07:10:30.563" Title="Can you transform a quantum program into an arrangement of slits?" Tags="&lt;programming&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12786" PostTypeId="1" CreationDate="2020-07-04T23:42:53.407" Score="1" ViewCount="153" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-diy-dCKRO&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-diy-dCKRO&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-solving-the-deutschs-problem-7EuD2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-solving-the-deutschs-problem-7EuD2&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;How can a half-wave plate affect the position qubit and not the polarization qubit?&lt;/p&gt;&#xA;" OwnerUserId="12347" LastEditorUserId="55" LastEditDate="2020-07-07T13:11:46.663" LastActivityDate="2020-08-07T09:40:12.527" Title="How can a half-wave plate affect the position qubit and not the polarization qubit of a photon?" Tags="&lt;quantum-gate&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;photonics&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12788" PostTypeId="1" CreationDate="2020-07-05T03:09:15.580" Score="3" ViewCount="141" Body="&lt;p&gt;In the paper of HHL algorithm (&lt;a href=&quot;https://arxiv.org/abs/0811.3171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum algorithm for linear systems of equations&lt;/a&gt;), the time complexity of simulating &lt;span class=&quot;math-container&quot;&gt;$e^{i A t}$&lt;/span&gt; for a hermitian matrix A is &lt;span class=&quot;math-container&quot;&gt;$\tilde{O}\left(\log (N) s^{2} t_0\right)$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; be the time required for the phase estimation subroutine. Then, the total-time of simulation should be &lt;span class=&quot;math-container&quot;&gt;$T \cdot \tilde{O}\left(\log (N) s^{2} t_0\right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why, then, is the time complexity &lt;span class=&quot;math-container&quot;&gt;$\tilde{O}\left(\log (N) s^{2} \kappa^{2} / \epsilon\right)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;In the subsection of error and run-time, they said that the run-time is &lt;span class=&quot;math-container&quot;&gt;$\tilde{O}\left(\kappa \left(T_B + t_0 s^2 \log (N) \right) \right)$&lt;/span&gt;; why is it not &lt;span class=&quot;math-container&quot;&gt;$T \cdot \log (N) s^{2} t_0$&lt;/span&gt; in the run-time, just &lt;span class=&quot;math-container&quot;&gt;$\log (N) s^{2} t_0$&lt;/span&gt;? Does that mean they just simulate &lt;span class=&quot;math-container&quot;&gt;$e^{i A t}$&lt;/span&gt; one time?&lt;/p&gt;&#xA;&lt;p&gt;Why does &lt;a href=&quot;https://arxiv.org/abs/1307.0471&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; needs T times simulation?&lt;/p&gt;&#xA;" OwnerUserId="12581" LastEditorUserId="12581" LastEditDate="2020-07-07T10:00:59.510" LastActivityDate="2020-07-07T10:00:59.510" Title="Confusion regarding time complexity in the HHL algorithm" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12789" PostTypeId="1" AcceptedAnswerId="12798" CreationDate="2020-07-05T08:09:11.263" Score="3" ViewCount="95" Body="&lt;p&gt;In &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/master/Measurements/Workbook_Measurements_Part2.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantumKatas&lt;/a&gt; Measurement Task 2.3 - Peres-Wooter's Game, we are given 3 states A,B and C.&#xA;We construct a POVM of these states. But how do we convert that POVM into a Unitary that we can apply.&lt;/p&gt;&#xA;&lt;p&gt;Basically what I am asking is How do we get from&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M = \frac{1}{\sqrt{2}}\left(\begin{array}{rrr}1 &amp;amp; 1 &amp;amp; 1 \\\ 1 &amp;amp; \omega &amp;amp; \omega^2 \end{array}\right)$&lt;/span&gt;&#xA;to&#xA;&lt;span class=&quot;math-container&quot;&gt;$M' = \frac{1}{\sqrt{3}}\left(\begin{array}{cccc}1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 0 \\\ 1 &amp;amp; -\omega^2 &amp;amp; \omega &amp;amp; 0 \\\ 1 &amp;amp; -\omega &amp;amp; \omega^2 &amp;amp; 0 \\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i\sqrt3\end{array}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="55" LastEditDate="2020-08-22T05:55:37.493" LastActivityDate="2020-08-22T05:55:37.493" Title="How do you embed a POVM matrix in a Unitary?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12790" PostTypeId="1" AcceptedAnswerId="12795" CreationDate="2020-07-05T12:40:51.467" Score="3" ViewCount="81" Body="&lt;p&gt;The Setup for Grover's Algorithm is the following:&lt;br /&gt;&#xA;Given an oracle &lt;span class=&quot;math-container&quot;&gt;$f_O^{\pm}$&lt;/span&gt; representing a Query on a Database with total &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; entries &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; of which &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; are matching. Grover's Algorithm is used to find with high probability a matching entry &lt;span class=&quot;math-container&quot;&gt;$x^*$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In most papers researching Grover's Algorithm, the underlying assumption is that &lt;span class=&quot;math-container&quot;&gt;$k\lt\lt N$&lt;/span&gt;. Under the above assumption the optimal number of iterations is estimated to be &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}\sqrt{\frac{N}{k}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{k}{N} \ge 0.5$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="9006" LastEditDate="2020-07-06T06:24:37.313" LastActivityDate="2020-07-06T06:24:37.313" Title="Grover's Algorithm on a Database with more than 50% matching entries" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12791" PostTypeId="1" AcceptedAnswerId="12792" CreationDate="2020-07-05T13:42:48.960" Score="0" ViewCount="34" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;two hadamard gates on one qubit &lt;br&gt;&lt;a href=&quot;https://i.stack.imgur.com/golNW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/golNW.png&quot; alt=&quot;two hadamard gates on one qubit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Hadamard gates on two qubits &lt;br&gt;&lt;a href=&quot;https://i.stack.imgur.com/4O8bD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4O8bD.png&quot; alt=&quot;Hadamard gates on two qubits&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Interconnected Hadamard gates on two qubits &lt;br&gt;&lt;a href=&quot;https://i.stack.imgur.com/zsGFE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zsGFE.png&quot; alt=&quot;Interconnected Hadamard gates on two qubits&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;with the first scenario, I am sure the case is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H \cdot H = H^2 = \begin{pmatrix} &#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{\sqrt{2}}{2} \\&#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{-\sqrt{2}}{2} \\&#xA;\end{pmatrix}. \begin{pmatrix} &#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{\sqrt{2}}{2} \\&#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{-\sqrt{2}}{2} \\&#xA;\end{pmatrix} = \begin{pmatrix} &#xA;1&amp;amp;0 \\&#xA;0&amp;amp;1 \\&#xA;\end{pmatrix} = I $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;br&gt;with the second scenario, I am sure the case is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H \otimes H = H_2 = \begin{pmatrix} &#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{\sqrt{2}}{2} \\&#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{-\sqrt{2}}{2} \\&#xA;\end{pmatrix} \otimes  \begin{pmatrix} &#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{\sqrt{2}}{2} \\&#xA;\frac{\sqrt{2}}{2}&amp;amp;\frac{-\sqrt{2}}{2} \\&#xA;\end{pmatrix} = \begin{pmatrix} &#xA;\frac{1}{2}&amp;amp;\frac{1}{2}&amp;amp;\frac{1}{2}&amp;amp;\frac{1}{2} \\&#xA;\frac{1}{2}&amp;amp;\frac{-1}{2}&amp;amp;\frac{1}{2}&amp;amp;\frac{-1}{2} \\&#xA;\frac{1}{2}&amp;amp;\frac{1}{2}&amp;amp;\frac{-1}{2}&amp;amp;\frac{-1}{2} \\&#xA;\frac{1}{2}&amp;amp;\frac{-1}{2}&amp;amp;\frac{-1}{2}&amp;amp;\frac{1}{2} \\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What seems to be the case with scenario 3 or what does the interconnection do to the qubits?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;P.S&lt;/strong&gt; 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 &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B1,%22Z%22,%22Z%22,%22Z%22,1,%22%E2%8A%96%22%5D,%5B1,%22Z%22,%22Z%22,1,%22Z%22,1,%22%E2%8A%96%22%5D,%5B1,%22Z%22,1,%22Z%22,%22Z%22,1,1,%22%E2%8A%96%22%5D,%5B1,1,%22Z%22,%22Z%22,%22Z%22,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,%22Z%22,%22Z%22,%22Z%22,%22Z%22,1,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,1,1,%22Z%22,%22Z%22,1,1,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,1,%22Z%22,1,%22Z%22,1,1,1,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,%22Z%22,1,1,%22Z%22,1,1,1,1,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,1,%22Z%22,%22Z%22,1,1,1,1,1,1,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,%22Z%22,1,%22Z%22,1,1,1,1,1,1,1,1,1,1,%22%E2%8A%96%22%5D,%5B%22Z%22,%22Z%22,%22Z%22,1,1,1,1,1,1,1,1,1,1,1,1,%22%E2%8A%96%22%5D,%5B1,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22,%22Z%5E%C2%BC%22%5D,%5B1,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B1,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22%5D,%5B1,%22X%22,%22X%22,%22X%22,1,%22%E2%80%A2%22%5D,%5B1,%22X%22,%22X%22,1,%22X%22,1,%22%E2%80%A2%22%5D,%5B1,%22X%22,1,%22X%22,%22X%22,1,1,%22%E2%80%A2%22%5D,%5B1,1,%22X%22,%22X%22,%22X%22,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,%22X%22,%22X%22,%22X%22,%22X%22,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,1,1,%22X%22,%22X%22,1,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,1,%22X%22,1,%22X%22,1,1,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,%22X%22,1,1,%22X%22,1,1,1,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,1,%22X%22,%22X%22,1,1,1,1,1,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,%22X%22,1,%22X%22,1,1,1,1,1,1,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22Z%22,%22X%22,%22X%22,1,1,1,1,1,1,1,1,1,1,1,1,%22%E2%80%A2%22%5D,%5B%22X%22,%22Chance4%22%5D,%5B%22Amps1%22,%22%7C0%E2%9F%A9%E2%9F%A80%7C%22,%22%7C0%E2%9F%A9%E2%9F%A80%7C%22,%22%7C0%E2%9F%A9%E2%9F%A80%7C%22,%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;magic-state-distillation&lt;/a&gt; on &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8605" LastEditorUserId="8605" LastEditDate="2020-07-05T14:50:37.733" LastActivityDate="2020-07-05T14:50:37.733" Title="Interconnection clarification?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12792" PostTypeId="2" ParentId="12791" CreationDate="2020-07-05T14:25:31.243" Score="2" Body="&lt;p&gt;Scenario 3 does not make sense to me. You should provide a reference, if any.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-07-05T14:25:31.243" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12793" PostTypeId="1" AcceptedAnswerId="12799" CreationDate="2020-07-05T15:47:32.580" Score="1" ViewCount="98" Body="&lt;p&gt;Couple of weeks ago I asked this question on &lt;a href=&quot;https://cstheory.stackexchange.com/questions/47049/quantum-error-correction-and-graph-codes&quot;&gt;theory CS&lt;/a&gt;  but I didn't get an answer. So trying it here.&lt;/p&gt;&#xA;&lt;p&gt;I was reading &lt;a href=&quot;https://arxiv.org/abs/1304.6743&quot; rel=&quot;nofollow noreferrer&quot;&gt;combinatorial approach towards quantum correction&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;Given a labeling &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; (a map where each vertex is is assigned 1 or 0) we define two operations on this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X(v,L)$&lt;/span&gt;: you flip labeling of vertex v that is if it was zero make it 1 if it was 1 make it 0.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z(v,L)$&lt;/span&gt;: you flip labeling of every neighbor of vertex v&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Then diagonal distance is defined as length of minimal non-trivial sequence of operation so that &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is taken back to itself.&lt;/p&gt;&#xA;&lt;p&gt;How is this exactly related to the quantum error correction property?&lt;/p&gt;&#xA;" OwnerUserId="8132" LastEditorUserId="8132" LastEditDate="2020-07-05T15:52:58.880" LastActivityDate="2020-08-05T09:05:15.730" Title="Quantum Error Correcting Codes and Graphs" Tags="&lt;error-correction&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12795" PostTypeId="2" ParentId="12790" CreationDate="2020-07-05T17:51:59.187" Score="5" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; below (instead of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; in your case) and the emphasis is mine.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt; if you know &lt;span class=&quot;math-container&quot;&gt;$M \geq N/2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$M \geq N/2$&lt;/span&gt;, then, double the search space (which can be done by adding a &lt;em&gt;single&lt;/em&gt; qubit since &lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits) with the new &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; elements such that none of them are solutions to the search -- as a consequence, the number of marked elements is now less than &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here's the quoted section:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;If &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is known in advance&lt;/strong&gt;: What happens when more than half the items are solutions to the search problem, that is, &lt;span class=&quot;math-container&quot;&gt;$M \geq N/2$&lt;/span&gt;?&#xA;[...] the number of iterations needed by the search algorithm&#xA;increases with &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$M \geq N/2$&lt;/span&gt;. Intuitively, this is a silly&#xA;property for a search algorithm to have: we expect that it should&#xA;become easier to ﬁnd a solution to the problem as the number of&#xA;solutions increases. There are at least two ways around this problem.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is known in advance to be larger than &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; then we can just&#xA;randomly pick an item from the search space, and then check that it is&#xA;a solution using the oracle. This approach has a success probability&#xA;at least one-half, and only requires one consultation with the oracle.&#xA;It has the disadvantage that we may not know the number of solutions&#xA;&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; in advance.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;In the case where it isn’t known whether &lt;span class=&quot;math-container&quot;&gt;$M \geq N/2$&lt;/span&gt;&lt;/strong&gt;, another approach can be used. [...] The idea is to double the number of&#xA;elements in the search space by adding &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; extra items to the search&#xA;space, none of which are solutions. As a consequence, less than half&#xA;the items in the new search space are solutions. This is effected by&#xA;adding a &lt;em&gt;single&lt;/em&gt; qubit &lt;span class=&quot;math-container&quot;&gt;$|q \rangle$&lt;/span&gt; to the search index, doubling the&#xA;number of items to be searched to &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-05T17:51:59.187" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12796" PostTypeId="1" CreationDate="2020-07-05T20:20:35.333" Score="2" ViewCount="153" Body="&lt;p&gt;Next year, I will be a senior Computer Engineering student. Saying that, I have studied computer organization, electrical circuits, electronics and data structures.&lt;/p&gt;&#xA;&lt;p&gt;Our university provides an opportunity to get a concentration on quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;So, my question is:&#xA;Are the subjects I mentioned helpful in learning about quantum computing?&#xA;Are there other prerequisites that may also be helpful?&lt;/p&gt;&#xA;" OwnerUserId="12589" LastEditorUserId="55" LastEditDate="2020-09-30T03:53:21.897" LastActivityDate="2020-09-30T03:53:21.897" Title="Are the skills learned for a degree in Computer Engineering helpful in learning Quantum Computing?" Tags="&lt;algorithm&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2020-07-06T11:56:01.327" ContentLicense="CC BY-SA 4.0" />
  <row Id="12797" PostTypeId="1" AcceptedAnswerId="12801" CreationDate="2020-07-06T05:17:57.950" Score="3" ViewCount="475" Body="&lt;p&gt;I'm currently reading the paper &lt;a href=&quot;https://arxiv.org/pdf/1802.06002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classification with Quantum Neural Networks on Near Term Processors&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It shows a method to determine the following quantity:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OJjGL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OJjGL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where U is a unitary operator acting on &lt;span class=&quot;math-container&quot;&gt;$|z,1\rangle$&lt;/span&gt;. The paper states the following:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/eDUN4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eDUN4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/4pM6c.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4pM6c.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am wondering if there is a way to calculate any general inner product like &lt;span class=&quot;math-container&quot;&gt;$\langle z_2, 1|U|z, 1\rangle$&lt;/span&gt; or just &lt;span class=&quot;math-container&quot;&gt;$\langle a | b \rangle $&lt;/span&gt; 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?)&lt;/p&gt;&#xA;" OwnerUserId="11644" LastEditorUserId="9006" LastEditDate="2020-07-06T06:28:44.013" LastActivityDate="2020-07-06T09:29:45.747" Title="Quantum Circuit To Compute Any Inner Product" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;machine-learning&gt;&lt;neural-network&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12798" PostTypeId="2" ParentId="12789" CreationDate="2020-07-06T08:01:49.680" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;That task gives you 3 states &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|C\rangle$&lt;/span&gt;. You want a POVM that, for example, cannot give the answer &amp;quot;0&amp;quot; is the state was in &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt;, cannot give the answer &amp;quot;1&amp;quot; if the state was in &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; etc. So, the POVM elements are orthogonal to those states. So, let me write &lt;span class=&quot;math-container&quot;&gt;$|A^\perp\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\langle A|A^\perp\rangle=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, we will be defining POVM elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|.&#xA;$$&lt;/span&gt;&#xA;It might help to also have &lt;span class=&quot;math-container&quot;&gt;$E_3=I-E_0-E_1-E_2$&lt;/span&gt;. All these operators must be non-negative, and we want the &lt;span class=&quot;math-container&quot;&gt;$\alpha_i$&lt;/span&gt; to be as large as possible. There's actually a certain symmetry here. If you set &lt;span class=&quot;math-container&quot;&gt;$\alpha_0=\alpha_1=\alpha_2$&lt;/span&gt; then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_3=I-\alpha\frac32 I,&#xA;$$&lt;/span&gt;&#xA;so &lt;span class=&quot;math-container&quot;&gt;$E_3$&lt;/span&gt; is non-negative if &lt;span class=&quot;math-container&quot;&gt;$\alpha\leq\frac23$&lt;/span&gt;, so we set &lt;span class=&quot;math-container&quot;&gt;$\alpha=\frac23$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^k\geq3$&lt;/span&gt; dimensional, i.e. we'll pick &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, and the unitary will need to map us to these states. But unitaries map orthogonal states to orthogonal states and our states &lt;span class=&quot;math-container&quot;&gt;$|A^\perp\rangle|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|B^\perp\rangle|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|C^\perp\rangle|0\rangle$&lt;/span&gt; are not orthogonal to each other. What we need to do is find components such as &lt;span class=&quot;math-container&quot;&gt;$|\tilde A\rangle$&lt;/span&gt; below:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_0\rangle=\sqrt\alpha_0|A^\perp\rangle|0\rangle+\sqrt{1-\alpha_0}|\tilde A\rangle|1\rangle&#xA;$$&lt;/span&gt;&#xA;such that all three states are orthogonal.&lt;/p&gt;&#xA;&lt;p&gt;With this in mind, we can start to specify &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=|00\rangle\langle\psi_0|+|01\rangle\langle\psi_1|+|10\rangle\langle\psi_2|+|11\rangle\langle\psi_3|,&#xA;$$&lt;/span&gt;&#xA;and so we already know some of the elements:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\frac{1}{\sqrt{3}}\left(\begin{array}{cc}&#xA;1 &amp;amp; -1 &amp;amp; ? &amp;amp; ? \\&#xA;1 &amp;amp; -\omega^2 &amp;amp; ? &amp;amp;?\\&#xA;1 &amp;amp; -\omega &amp;amp; ? &amp;amp;?\\&#xA;0 &amp;amp; 0 &amp;amp; ? &amp;amp; ?&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\frac{1}{\sqrt{3}}\left(\begin{array}{cc}&#xA;1 &amp;amp; -1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; -\omega^2 &amp;amp; \omega &amp;amp;0\\&#xA;1 &amp;amp; -\omega &amp;amp; \omega^2 &amp;amp;0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \sqrt3&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;You can put any phase you like on the bottom-right element, such as &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;. Which one you want will basically be determined by whatever is easiest to implement with a circuit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="8757" LastEditDate="2020-07-06T08:39:06.120" LastActivityDate="2020-07-06T08:39:06.120" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12799" PostTypeId="2" ParentId="12793" CreationDate="2020-07-06T08:16:22.000" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Let's see how this connects to a graph state description. Usually a graph state has stabilizers defined as &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on a vertex, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on that vertex, or a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-06T08:16:22.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12800" PostTypeId="2" ParentId="12779" CreationDate="2020-07-06T08:23:42.897" Score="5" Body="&lt;p&gt;First of all, I think there is a little mistake in the way you define &lt;code&gt;psi&lt;/code&gt;. Indeed, you first create it as a 3-qubits circuit and then &amp;quot;erase&amp;quot; this by doing &lt;code&gt;psi = state_fns.CircuitStateFn(circuit)&lt;/code&gt;, meaning it will be exactly the same as the operator you defined right before, &lt;code&gt;op&lt;/code&gt;. You can check the circuit you create via an operator using for example &lt;code&gt;psi.primitive.draw()&lt;/code&gt; if you want to see! This is why your code worked for &lt;code&gt;psi&lt;/code&gt; but not for &lt;code&gt;psi2&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;op&lt;/code&gt; without adding any gates on it, this way &lt;code&gt;op&lt;/code&gt; will have the same size as &lt;code&gt;psi&lt;/code&gt; and &lt;code&gt;psi2&lt;/code&gt; and your code will run without errors since all the operators will have the same size!&lt;br /&gt;&#xA;I hope this will help you :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-06T08:23:42.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12801" PostTypeId="2" ParentId="12797" CreationDate="2020-07-06T09:29:45.747" Score="7" Body="&lt;p&gt;We can use the SWAP test to determine the inner product of 2 states &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. The circuit is shown below &lt;a href=&quot;https://i.stack.imgur.com/ed6KR.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ed6KR.png&quot; alt=&quot;SWAP Test Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The state of the system at the beginning of the protocol is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |\phi \rangle \otimes |\psi \rangle$&lt;/span&gt;. After the Hadamard gate, the state of the system is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle \otimes |\phi \rangle \otimes |\psi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The controlled SWAP gate transforms the state into &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt {2}}|0\rangle \otimes |\phi \rangle \otimes |\psi \rangle + |1\rangle \otimes |\psi \rangle \otimes |\phi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The second Hadamard gate results in&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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 ) \\&#xA;=\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Measurement gate on the first qubit ensures that it's 0 with a probability of&#xA;&lt;span class=&quot;math-container&quot;&gt;$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}$&lt;/span&gt; when measured.&lt;/p&gt;&#xA;&lt;p&gt;The downside of this test is that the qubits cannot be recovered to the same state as before. Hence &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle,|\phi\rangle|$&lt;/span&gt; must be prepared multiple times independently in order to get a good probability estimate and hence the value of inner product.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-07-06T09:29:45.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12802" PostTypeId="2" ParentId="12796" CreationDate="2020-07-06T09:51:33.983" Score="3" Body="&lt;p&gt;For quantum computing you will need some bases in linear algebra and probability theory. &lt;a href=&quot;https://www.cambridge.org/core/books/quantum-computation-and-quantum-information/01E10196D0A682A6AEFFEA52D53BE9AE&quot; rel=&quot;nofollow noreferrer&quot;&gt;This book&lt;/a&gt; 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 &lt;em&gt;Introduction to quantum mechanics&lt;/em&gt; is about Linear Algebra and there is also a little bit of proba theory on the appendix 1. &lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Qiskit textbook&lt;/a&gt; also gives you a good view of the background you need by doing examples at the same time.&lt;/p&gt;&#xA;&lt;p&gt;If you need something else feel free to ask! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="8623" LastEditDate="2020-07-06T17:33:16.477" LastActivityDate="2020-07-06T17:33:16.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12803" PostTypeId="1" CreationDate="2020-07-06T16:40:07.183" Score="4" ViewCount="140" Body="&lt;p&gt;I have a quantum state on &lt;span class=&quot;math-container&quot;&gt;$ n $&lt;/span&gt; qubits (&lt;span class=&quot;math-container&quot;&gt;$ 2^n $&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;2$&lt;/span&gt; (my scale is &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; 10$&lt;/span&gt;). Is there an easier way?&lt;/p&gt;&#xA;" OwnerUserId="7759" LastEditorUserId="55" LastEditDate="2020-09-30T03:53:16.547" LastActivityDate="2020-09-30T03:53:16.547" Title="How to measure the sign of quantum amplitudes" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;tomography&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12804" PostTypeId="2" ParentId="12803" CreationDate="2020-07-06T20:48:11.247" Score="5" Body="&lt;p&gt;An empirical solution could be to use the Grover's Diffusion Operator &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Lets say the qubits are in an initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_{0}^{2^n-1}\alpha_i|i\rangle$&lt;/span&gt;. Since global phase/sign is irrelevant. We can assume that phase/sign of &lt;span class=&quot;math-container&quot;&gt;$\alpha_0$&lt;/span&gt; is + for the sake of convenience (If &lt;span class=&quot;math-container&quot;&gt;$\alpha_0=0$&lt;/span&gt; choose the lowest index with non-zero amplitude).&lt;br /&gt;&#xA;We can find the constants &lt;span class=&quot;math-container&quot;&gt;$|\alpha_i|\forall i$&lt;/span&gt;  by taking square roots of probabilities and hence we can assume their knowledge.&lt;/p&gt;&#xA;&lt;p&gt;Grover's Diffusion Operator maps &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_{0}^{2^n-1}\alpha_i|i\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$D|\psi\rangle = \sum_{0}^{2^n-1}(2\mu-\alpha_i)|i\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mu = \sum_{0}^{2^n-1}\alpha_i$&lt;/span&gt;. We can find the probability distribution of this state and let us say we now also have knowledge of &lt;span class=&quot;math-container&quot;&gt;$|2\mu-\alpha_i| \forall i$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using values of &lt;span class=&quot;math-container&quot;&gt;$|\alpha_i|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|2\mu-\alpha_i|$&lt;/span&gt; we get 4 possible values of&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mu = \frac{\pm|\alpha_i| \pm|2\mu-\alpha_i|}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Remember we have &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; values of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; each which can give us a group of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; possible values of &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;. We find the common value of &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; across all these &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; groups of &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since we assumed &lt;span class=&quot;math-container&quot;&gt;$\alpha_0&amp;gt;0$&lt;/span&gt; we only get 2 possible values of &lt;span class=&quot;math-container&quot;&gt;$\mu = \frac{|\alpha_i| \pm|2\mu-\alpha_i|}{2}$&lt;/span&gt; So at max there can only be &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; values of &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;.&#xA;Hopefully we have narrowed down to a single value of &lt;span class=&quot;math-container&quot;&gt;$\mu\ne0$&lt;/span&gt;. If we have then we can use it to easily calculated &lt;span class=&quot;math-container&quot;&gt;$\alpha_i$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|\alpha_i|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|2\mu-\alpha_i|$&lt;/span&gt; thus giving us the sign information for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\mu=0$&lt;/span&gt; or there are &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; possible &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; then we must modify the original state. A possible solution is too selectively flip the sign (using &lt;span class=&quot;math-container&quot;&gt;$Controlled$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates) if and only if the state is &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; which has an amplitude &lt;span class=&quot;math-container&quot;&gt;$\alpha_j\ne0$&lt;/span&gt;.&lt;br /&gt;&#xA;This will result in a new &lt;span class=&quot;math-container&quot;&gt;$\mu'$&lt;/span&gt; which cannot be zero if &lt;span class=&quot;math-container&quot;&gt;$\mu=0$&lt;/span&gt;. Applying same procedure on this state will yield 1/2 value(s) which can be used to deduce original &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate only changes sign but not magnitude of amplitude the probability distributions will remain same.&lt;/p&gt;&#xA;&lt;p&gt;I know this isn't a complete formal solution but hopefully it helps.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-07-07T00:06:24.700" LastActivityDate="2020-07-07T00:06:24.700" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12805" PostTypeId="1" CreationDate="2020-07-06T22:44:41.747" Score="1" ViewCount="47" Body="&lt;p&gt;I would like to better understand some passages in a &lt;a href=&quot;https://arxiv.org/abs/1902.00814&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; (Appendix A):&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Properties of Tensor Product&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bilinearity: &lt;span class=&quot;math-container&quot;&gt;$A\otimes(B+ C) = A \otimes B + A \otimes C $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mixed-product property: &lt;span class=&quot;math-container&quot;&gt;$(A\otimes B)(C \otimes D) = AC \otimes BD$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ (|a\rangle \otimes|b\rangle) (\langle c| \otimes \langle d|)  = |a\rangle \langle c| \otimes |b\rangle \langle d| $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For a unitary &lt;span class=&quot;math-container&quot;&gt;$U_p |0\rangle |0\rangle \mapsto \sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle|j\rangle $&lt;/span&gt;, we have a matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; defined as such:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We used the mixed-product property&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\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| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here we applied the definition of &lt;span class=&quot;math-container&quot;&gt;$U_p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\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| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My steps are:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\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| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because of the third property (name?)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\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| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because of associativity property of matrix product&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\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| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\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| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As &lt;span class=&quot;math-container&quot;&gt;$\langle i | j \rangle = \delta_{ij}$&lt;/span&gt;, the final result is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\sum_{i=1}^{n}\sqrt{p_i}|\phi_i \rangle \langle 0|\otimes |i \rangle \langle 0|\otimes |i \rangle \langle i|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="10062" LastEditorUserId="55" LastEditDate="2020-07-07T12:50:17.990" LastActivityDate="2020-07-07T12:50:17.990" Title="Step-by-step passages in calculation" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12806" PostTypeId="2" ParentId="12788" CreationDate="2020-07-06T22:56:00.340" Score="1" Body="&lt;p&gt;It is incorrect to say that the time of simulation is &lt;span class=&quot;math-container&quot;&gt;$T O(\log N s^2t)$&lt;/span&gt;&#xA;(it's also better written as &lt;span class=&quot;math-container&quot;&gt;$O(T\log N s^2t)$&lt;/span&gt;).&#xA;Conceptually, the simulation time ends at &lt;span class=&quot;math-container&quot;&gt;$O(\log N s^2t)$&lt;/span&gt;. 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,&#xA;let &lt;span class=&quot;math-container&quot;&gt;$U=g(H,t,initial\_state,)$&lt;/span&gt; be the function that performs hamiltonian simulation, and &lt;span class=&quot;math-container&quot;&gt;$f(U, args*)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, an hypotetical function (which you can imagine written in a quantum programming language) that builds the unitary for hamiltonian simulation U.&lt;/p&gt;&#xA;&lt;p&gt;The reason there is no time dependence in the runtime is because they implicitely set &lt;span class=&quot;math-container&quot;&gt;$t=1$&lt;/span&gt; and perform a time-indepentent Hamiltonian simulation. The other paper performs a time dependent simulation.&lt;/p&gt;&#xA;" OwnerUserId="1644" LastActivityDate="2020-07-06T22:56:00.340" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12807" PostTypeId="1" CreationDate="2020-07-07T06:35:56.723" Score="2" ViewCount="117" Body="&lt;p&gt;How do I prepare a quantum circuit for  &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}(|00\rangle+|01\rangle+|10\rangle)$&lt;/span&gt; state starting from the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state?&lt;/p&gt;&#xA;&lt;p&gt;I have no clue how to do it. I tried with controlled Hadamard gate but of no use here. Can someone help?&#xA;Furthermore, can it be constructed with only one CNOT and any number of single-qubit gates?&lt;/p&gt;&#xA;" OwnerUserId="12599" LastEditorUserId="55" LastEditDate="2020-07-14T06:54:14.857" LastActivityDate="2020-07-14T06:54:14.857" Title="How to prepare a quantum circuit for $\frac{1}{\sqrt{3}}(|00\rangle+|01\rangle+|10\rangle)$ starting from $|00\rangle$" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12808" PostTypeId="2" ParentId="12807" CreationDate="2020-07-07T07:00:28.543" Score="6" Body="&lt;p&gt;Step 1: Find the Schmidt decomposition &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_i\alpha_i|u_i\rangle|v_i\rangle$&lt;/span&gt;. I won't do this completely here, but&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&#xA;should be enough to confirm you're going in the right direction.&lt;/p&gt;&#xA;&lt;p&gt;Step 2: Express this as &lt;span class=&quot;math-container&quot;&gt;$(U_A\otimes U_B)(\alpha_0|00\rangle+\alpha_1|11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Step 3: Write down the circuit. First apply &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle\rightarrow \alpha_0|0\rangle+\alpha_1|1\rangle$&lt;/span&gt; on the first qubit. Then apply &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate with first qubit as control and second qubit as target. Then apply &lt;span class=&quot;math-container&quot;&gt;$U_A\otimes U_B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="8757" LastEditDate="2020-07-07T23:02:27.733" LastActivityDate="2020-07-07T23:02:27.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12809" PostTypeId="2" ParentId="12803" CreationDate="2020-07-07T12:33:03.027" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurements, while for the real-only version, you'd only need to make &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurements.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Hadamard every qubit and repeat your amplitude determination step. The results should be sufficient to reverse engineer the signs, it's &amp;quot;just&amp;quot; a classical computation (I make no promises that it's an easy computation).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Assume the weights are &lt;span class=&quot;math-container&quot;&gt;$\alpha_i^2$&lt;/span&gt;, and that these are ordered. Apply a measurement with projectors onto states &lt;span class=&quot;math-container&quot;&gt;$(|2n\rangle\pm|2n+1\rangle)/\sqrt{2}$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$\alpha_{2n}^2\approx\alpha_{2n+1}$&lt;/span&gt;, it shouldn't take many measurements (relatively!) to determine the relative signs of the amplitudes &lt;span class=&quot;math-container&quot;&gt;$\alpha_{2n},\alpha_{2n+1}$&lt;/span&gt;. Repeat using projectors onto states &lt;span class=&quot;math-container&quot;&gt;$(|2n\rangle\pm|2n-1\rangle)/\sqrt{2}$&lt;/span&gt; and that's enough to globally reconstruct the phases.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I wonder if there's a smarter method, similar to the previous one, but incorporating a &amp;quot;divide and conquer&amp;quot; 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...&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;the answer of user1294287 looks plausible (aside from some normalisation issues), although I wonder what accuracy one has to achieve.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-07T12:33:03.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12811" PostTypeId="2" ParentId="12786" CreationDate="2020-07-07T13:26:10.923" Score="1" Body="&lt;p&gt;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 &amp;quot;if the photon passes through this waveplate, x happens to it&amp;quot; where x might be &amp;quot;apply phase &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi}$&lt;/span&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Because there are two different paths, and you put a waveplate on a single path, the net effect is &amp;quot;if the photon traveled down that path, do x to it&amp;quot;. Hence, it affects the position component.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="91" LastEditDate="2020-08-07T09:40:12.527" LastActivityDate="2020-08-07T09:40:12.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12812" PostTypeId="1" CreationDate="2020-07-07T14:24:43.960" Score="0" ViewCount="68" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11977" LastEditorUserId="11977" LastEditDate="2020-07-08T09:22:03.467" LastActivityDate="2020-07-08T09:22:03.467" Title="Is there a notion of “computational security” in quantum cryptography?" Tags="&lt;cryptography&gt;&lt;bb84&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12813" PostTypeId="2" ParentId="12812" CreationDate="2020-07-07T14:58:07.473" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-07T14:58:07.473" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12814" PostTypeId="2" ParentId="12812" CreationDate="2020-07-07T15:01:18.280" Score="0" Body="&lt;p&gt;You are confusing two different things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum cryptography protocols that cannot be implemented classically, and having nothing to do with computational security;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Mathematical problems that can be solved both quantumly and classically, and here you can consider the computational security of algorithms.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-07-07T15:01:18.280" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12815" PostTypeId="1" CreationDate="2020-07-07T19:08:53.403" Score="4" ViewCount="160" Body="&lt;p&gt;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 &amp;quot;logical heat bath&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;Thus it should be possible to compute the energy cost of any quantum computation as the entropy difference between the required effective &amp;quot;logical heat bath&amp;quot; and the ambient environment. As entropy scales as &lt;span class=&quot;math-container&quot;&gt;$$dS = \frac{dQ}{T_A} - \frac{dQ}{T_B},$$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12609" LastActivityDate="2020-07-08T07:43:36.683" Title="Energy cost of quantum computation" Tags="&lt;cryptography&gt;&lt;shors-algorithm&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12817" PostTypeId="2" ParentId="12785" CreationDate="2020-07-07T21:20:39.627" Score="7" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The question is similar to &amp;quot;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?&amp;quot;  .&lt;/p&gt;&#xA;&lt;p&gt;Indeed, Shor has &lt;a href=&quot;https://www.youtube.com/watch?v=hOlOY7NyMfs&quot; rel=&quot;noreferrer&quot;&gt;referred to&lt;/a&gt; Shor's algorithm as a &amp;quot;computational interferometer.&amp;quot;  For example, one thing that quantum computers can do, and that diffraction gratings can do, is perform Fourier transforms on large data sets.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For example, you could cut slits in your foil in a manner where the spacing is &lt;span class=&quot;math-container&quot;&gt;$a^x\bmod N$&lt;/span&gt;.  Shining light through such a diffraction grating, even a single photon of light, will perform the quantum Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;However, in this case you had to cut your diffraction grating &lt;em&gt;a-priori&lt;/em&gt; into &lt;span class=&quot;math-container&quot;&gt;$a^x\bmod N$&lt;/span&gt;; that is, you had to perform an exponential number of cuts in the first place.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-07-07T22:31:49.110" LastActivityDate="2020-07-07T22:31:49.110" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12818" PostTypeId="2" ParentId="12572" CreationDate="2020-07-07T21:24:16.007" Score="0" Body="&lt;p&gt;There is currently an Issue (&lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/issues/291&quot; rel=&quot;nofollow noreferrer&quot;&gt;#291&lt;/a&gt;) raised on the &lt;em&gt;Microsoft QuantumLibraries GitHub&lt;/em&gt; regarding an operation called &lt;code&gt;ApplyUnitaryOperation(unitary: Complex[][], qubits : LittleEndian)&lt;/code&gt; which aims to do what you are asking. This functionality doesn't exist right now but it was also discussed on the &lt;a href=&quot;https://gitter.im/qsharp-community/community&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q# Community Gitter&lt;/a&gt; a while ago. Hopefully it will be added as a feature in the future.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-07-07T21:24:16.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12819" PostTypeId="2" ParentId="12630" CreationDate="2020-07-07T21:43:02.210" Score="0" Body="&lt;p&gt;This task can be done using &lt;code&gt;Microsoft Q#&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you have two qubits which after quantum operations are in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;,&#xA;and you wish to find the state of the qubit &lt;code&gt;q0&lt;/code&gt; before/without measurement, You can use&#xA;&lt;code&gt;Q#&lt;/code&gt;'s &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpregister&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;DumpRegister&lt;/code&gt;&lt;/a&gt; function which will print to the console the state of your qubits.&lt;/p&gt;&#xA;&lt;p&gt;The output would look something like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# wave function for qubits with ids (least to most significant): 0&#xA;∣0❭:     1.000000 +  0.000000 i  ==     ******************** [ 1.000000 ]     --- [  0.00000 rad ]&#xA;∣1❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you choose to Measure the qubit &lt;code&gt;q0&lt;/code&gt; then its state collapses to the result of your measurement.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="2879" LastEditDate="2021-03-04T17:13:26.133" LastActivityDate="2021-03-04T17:13:26.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12821" PostTypeId="1" CreationDate="2020-07-08T01:11:47.477" Score="1" ViewCount="88" Body="&lt;p&gt;If a quantum system is described to be only in Quantum states &lt;span class=&quot;math-container&quot;&gt;$s_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_2$&lt;/span&gt; (described by computational basis &lt;span class=&quot;math-container&quot;&gt;$\vert {0} \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert {1}\rangle$&lt;/span&gt;) 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?&lt;/p&gt;&#xA;&lt;p&gt;If we measure a property of the quantum system (operator O) and measure an eigenvalue for an eigenvector which is not associated to &lt;span class=&quot;math-container&quot;&gt;$s_1$&lt;/span&gt; nor &lt;span class=&quot;math-container&quot;&gt;$s_2$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$s_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="8623" LastEditDate="2020-07-08T02:45:56.397" LastActivityDate="2020-07-08T09:49:58.830" Title="Correct interpretation of a Quantum State" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12822" PostTypeId="1" AcceptedAnswerId="12823" CreationDate="2020-07-08T04:04:29.780" Score="2" ViewCount="447" Body="&lt;p&gt;I am trying to understand how the reset gate in Qiskit affects qubits its entangled with. Consider the following circuit with qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SYIGs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SYIGs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where circuit240 takes &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle + b|1\rangle$&lt;/span&gt; and circuit 244 takes &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$c|0\rangle + d|1\rangle$&lt;/span&gt;. Right before the reset gate on qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; the state of this circuit is &lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and tested how the quantum reset gate affects the measurement of the qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. 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?&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, when I take the qubit expression above and just reset qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; I get the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$= \frac{1}{\sqrt{2}}((a + c)|1\rangle + (b + d)|0\rangle)|0\rangle \tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But, mathematically, the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; is not the same as the probability in  qubit expression &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;(even though the tests show that removing the reset gate did not change the probability of measuring a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. What is the correct way to represent what the qubit reset gate does to an entangled qubit?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastEditorUserId="55" LastEditDate="2020-07-14T16:54:49.983" LastActivityDate="2020-07-14T16:54:49.983" Title="Question About How Qiskit Reset Gate Affects Other Entangled Qubits" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12823" PostTypeId="2" ParentId="12822" CreationDate="2020-07-08T04:24:49.290" Score="1" Body="&lt;p&gt;A reset gate is equivalent to a swap gate between the target qubit and a new ancilla qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. So you can replace your question with &amp;quot;how does swapping a qubit Q with an fresh ancilla qubit affect the qubits Q is entangled with?&amp;quot; or &amp;quot;how does discarding Q affect the qubits Q is entangled with&amp;quot;. And the answer is that, for all intents and purposes, it doesn't affect them at all.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-07-08T04:24:49.290" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12825" PostTypeId="1" AcceptedAnswerId="12830" CreationDate="2020-07-08T06:50:53.980" Score="0" ViewCount="51" Body="&lt;p&gt;I have a mixed state with a density matrices corresponding to &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_0^{2^n-1}p_i|i\rangle\langle i|$&lt;/span&gt;. How would i represent this in Q#? How would I go about applying Unitary Operations &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on this mixed state in Q#?&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="55" LastEditDate="2020-07-14T16:52:40.000" LastActivityDate="2020-07-14T16:52:40.000" Title="How can I represent mixed states in Q#?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12826" PostTypeId="2" ParentId="12815" CreationDate="2020-07-08T07:06:48.300" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Theoretically, the energy is needed to &lt;em&gt;erase&lt;/em&gt; information (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Landauer%27s_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Landauer's principle&lt;/a&gt;), but unitary transformations do not erase information.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2020-07-08T07:43:36.683" LastActivityDate="2020-07-08T07:43:36.683" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12827" PostTypeId="2" ParentId="12821" CreationDate="2020-07-08T07:49:19.747" Score="1" Body="&lt;p&gt;You seem to be referring specifically to measurement operators (&amp;quot;operator&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$M = \sum m \, P_m$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is an eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is a projection operator (POVM is slightly more complicated, but conceptually similar).&lt;/p&gt;&#xA;&lt;p&gt;The projection operator &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; projects every vector in the relevant vector space into the eigenspace associated with &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.  So if the state vector, say &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt;, is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; associated with the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, then the probabilities of the measurement will be &lt;span class=&quot;math-container&quot;&gt;$p(m=k)=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p(m \ne k)=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For the general case when &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; is not necessarily an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(m)=\langle \psi \vert P_m \vert \psi \rangle = \sum P_{m,ij} \, \psi_i^\ast \psi_j.$$&lt;/span&gt;&#xA;So each &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is playing the role of an Hermitian form (the complex version of a quadratic form) that gives the probability of the measurement observing &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; eigenspace.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; are always complete, &lt;span class=&quot;math-container&quot;&gt;$\sum P_m = I$&lt;/span&gt;, positive semi-definite, and, in this case (projective measurements), also orthogonal, &lt;span class=&quot;math-container&quot;&gt;$P_i \, P_j = \delta_{ij} P_i$&lt;/span&gt;.  Two &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;'s with distinct eigenspaces are simply measuring &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; over distinct bases that are related by some coordinate transform.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is diagonal, the &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; are permutations of &lt;span class=&quot;math-container&quot;&gt;$\text{diag}(1,0,...,0)$&lt;/span&gt;.  This makes the calculations easy, but it's certainly not necessary for a valid measurement operator.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-07-08T09:49:58.830" LastActivityDate="2020-07-08T09:49:58.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12828" PostTypeId="1" AcceptedAnswerId="12829" CreationDate="2020-07-08T11:44:10.127" Score="2" ViewCount="83" Body="&lt;p&gt;I've been trying to figure out the extra functionality available to &lt;code&gt;IBM Q Network&lt;/code&gt; members that are not available to normal &lt;code&gt;IBM Q Experience&lt;/code&gt; users.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Could someone please list all the benefits of having Network membership?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-07-14T16:52:16.413" LastActivityDate="2020-07-14T16:52:16.413" Title="What extra functionality is available to an IBM Q Network member over a regular IBM Q Experience user" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12829" PostTypeId="2" ParentId="12828" CreationDate="2020-07-08T12:58:48.817" Score="5" Body="&lt;p&gt;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: &lt;a href=&quot;https://www.ibm.com/blogs/research/2020/07/qv32-performance/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/blogs/research/2020/07/qv32-performance/&lt;/a&gt;&#xA;Depending on your engagement you also have access to different levels of collaboration from simple support to joint development.&#xA;No special qiskit library for IBM Q Network but special content/documentation and education materials.&#xA;Note that between the common user and the IBM Q Network member there is also a new way to engage for academic researchers: &lt;a href=&quot;https://www.ibm.com/blogs/research/2020/07/quantum-researcher-program/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/blogs/research/2020/07/quantum-researcher-program/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7853" LastEditorUserId="8757" LastEditDate="2020-07-08T13:51:39.823" LastActivityDate="2020-07-08T13:51:39.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12830" PostTypeId="2" ParentId="12825" CreationDate="2020-07-08T15:05:40.720" Score="4" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; represents a distribution in which &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |i\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. That is, a density operator describes a probability over an &lt;em&gt;ensemble&lt;/em&gt; of state vectors.&lt;/p&gt;&#xA;&lt;p&gt;From that perspective, we easily write pseudocode for a quantum program that prepares &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_i p_i |\psi_i\rangle\langle\psi_i|$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Draw a random &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Prepare the pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Thinking of state vectors like &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; as &lt;a href=&quot;https://www.cgranade.com/blog/2019/09/08/this-is-not-a-qubit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum programs that prepare those states&lt;/a&gt;, this is already a complete description of how to prepare &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. You can, for instance, use the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.preparearbitrarystate&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;PrepareArbitraryState&lt;/code&gt; operation&lt;/a&gt; to prepare each &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; on a freshly allocated register of qubits.&lt;/p&gt;&#xA;&lt;p&gt;In practice, however, you'll often have a much more efficient implementation of the state preparation programs for each &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;. For example, there's no need to use &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.preparearbitrarystate&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;PrepareArbitraryState&lt;/code&gt; operation&lt;/a&gt; to prepare &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, as the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.h&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;H&lt;/code&gt; operation&lt;/a&gt; does just fine.&lt;/p&gt;&#xA;&lt;p&gt;This is, for instance, how the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.preparesinglequbitidentity&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;PrepareSingleQubitIdentity&lt;/code&gt; operation&lt;/a&gt; prepares the particular mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho =  / 2$&lt;/span&gt; on a single qubit.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-07-08T15:05:40.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12831" PostTypeId="1" AcceptedAnswerId="12832" CreationDate="2020-07-08T15:58:13.183" Score="2" ViewCount="65" Body="&lt;p&gt;I have a few questions about measurement in Bell-state basis. In particular, if &lt;span class=&quot;math-container&quot;&gt;$Z = \begin{bmatrix}&#xA;1 &amp;amp; 0\\ &#xA;0 &amp;amp; -1&#xA;\end{bmatrix}$&lt;/span&gt;&#xA;is for a measurement on the computational basis, then what is the representative matrix for a measurement in Bell-state basis.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;However, Nielsen and Chuang (p.27) give a circuit for teleportation (basically Bell-basis measurement)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9h66g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9h66g.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I wondered if &lt;span class=&quot;math-container&quot;&gt;$U^\dagger (Z\otimes Z)U$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U = (H\otimes I)CNOT$&lt;/span&gt;, is the needed matrix. It turns out that its eigenvectors are not Bell states. Can someone explain where I'm wrong here?&lt;/p&gt;&#xA;" OwnerUserId="7648" LastEditorUserId="491" LastEditDate="2020-07-17T23:23:55.760" LastActivityDate="2020-07-17T23:23:55.760" Title="What is the representative matrix for a measurement in the Bell-state basis?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12832" PostTypeId="2" ParentId="12831" CreationDate="2020-07-08T16:41:44.743" Score="3" Body="&lt;p&gt;I think your reasoning is just fine and I checked that the Bell states are indeed eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$$M=U^\dagger(Z\otimes Z)U,$$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;M|\phi^+\rangle =&amp;amp; \phantom{{}-{}}|\phi^+\rangle,\\&#xA;M|\phi^-\rangle =&amp;amp; -|\phi^-\rangle,\\&#xA;M|\psi^+\rangle =&amp;amp; -|\psi^+\rangle,\\&#xA;\text{and } M|\psi^-\rangle =&amp;amp; \phantom{{}-{}}|\psi^-\rangle&#xA;\end{align}.$$&lt;/span&gt;&#xA;I like to see it this way:&#xA;The matrix that you assign to a measurement depends on what measurement results you assign to a certain outcome state.&#xA;For the measurement in the computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt; you are assigning &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; outcome&#xA;and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; outcome. That's why you say that, using the spectral decomposition, &lt;span class=&quot;math-container&quot;&gt;$$1 |0\rangle \langle 0| + (-1) |1\rangle \langle 1| = Z$$&lt;/span&gt; is the corresponding matrix.&lt;/p&gt;&#xA;&lt;p&gt;Now you can do the same with the Bell basis, e.g. &lt;span class=&quot;math-container&quot;&gt;$$1 |\phi^+\rangle\langle\phi^+| + 1 |\psi^+\rangle\langle\psi^+| + (-1) |\phi^-\rangle\langle\phi^-| + (-1) |\psi^-\rangle\langle\psi^-|.$$&lt;/span&gt;&#xA;This is quite arbitrary, of course. You are free to choose the values that you assign to each outcome. Typically they would be &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, but really you can assign any number (in the broadest sense) to it.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2020-07-08T16:52:38.360" LastActivityDate="2020-07-08T16:52:38.360" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12833" PostTypeId="1" AcceptedAnswerId="12834" CreationDate="2020-07-08T17:34:06.347" Score="0" ViewCount="48" Body="&lt;p&gt;Part three (going by N&amp;amp;C page 544) states that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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))).$$&lt;/span&gt;&#xA;Now I understand how the term on the left of + goes to 0 as n &lt;span class=&quot;math-container&quot;&gt;$\to \infty$&lt;/span&gt;. However, I am confused how the term on the right does. N&amp;amp;I states that you can set&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't quite understand why this is the case. My only assumption is that the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes n}(I-P(n,\epsilon))$&lt;/span&gt; are bounded in such a way that as &lt;span class=&quot;math-container&quot;&gt;$n \to \infty$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes n}P(n,\epsilon)), 2^{-n(S(\rho)-\epsilon)}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-09-30T03:53:08.893" LastActivityDate="2020-09-30T03:53:08.893" Title="Question regarding part of the proof for the typical subspace theorem" Tags="&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12834" PostTypeId="2" ParentId="12833" CreationDate="2020-07-08T18:23:59.380" Score="2" Body="&lt;p&gt;By part 1, we have that for any &lt;span class=&quot;math-container&quot;&gt;$\delta &amp;gt; 0$&lt;/span&gt;, then for sufficiently large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$tr( \rho ^ {\otimes n} P(n, \epsilon)) \geq 1 - \delta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$tr( \rho ^ {\otimes n} P(n, \epsilon)) \rightarrow 1$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$n \rightarrow \infty$&lt;/span&gt;, since it is at most 1.&lt;/p&gt;&#xA;" OwnerUserId="9626" LastActivityDate="2020-07-08T18:23:59.380" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12835" PostTypeId="1" CreationDate="2020-07-08T18:39:05.203" Score="0" ViewCount="57" Body="&lt;p&gt;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 &amp;quot;coin&amp;quot; as follows (forgive the crude drawing):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p7NRd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p7NRd.png&quot; alt=&quot;Coin in a unit circle&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As far as I can recall, whenever the qbit goes through a quantum gate the coin is rotated some amount, then when &amp;quot;measuring&amp;quot; the qbit you basically just look from the perspective of the basis you're measuring (say the |0&amp;gt;/|1&amp;gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2020-07-09T04:33:16.403" Title="Are there any resources of lists of attempts at non-probabilistic models of quantum mechanics, with debunking?" Tags="&lt;quantum-state&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12836" PostTypeId="1" AcceptedAnswerId="12837" CreationDate="2020-07-08T18:43:13.113" Score="2" ViewCount="56" Body="&lt;p&gt;We are considering Grover's algorithm with a search space of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; for an arbitrary integer &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; for arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and a unique marked element &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Question: Calculate &lt;span class=&quot;math-container&quot;&gt;$\langle x | D | y \rangle$&lt;/span&gt; for arbitrary &lt;span class=&quot;math-container&quot;&gt;$x,y \in \{0,1\}^n$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Answer: Using the expression &lt;span class=&quot;math-container&quot;&gt;$D = -(I-2|+^n\rangle\langle+^n|)$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle x | D | y \rangle =  &#xA;     \begin{cases}&#xA;       \frac{2}{N}-1 &amp;amp;\quad\text{if x=y}\\&#xA;       \frac{2}{N} &amp;amp;\quad\text{if x $\neq$ y} &#xA;     \end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How has the equality &lt;span class=&quot;math-container&quot;&gt;$D = -(I-2|+\rangle\langle+|)$&lt;/span&gt; been derived? Its from these notes &lt;a href=&quot;https://people.maths.bris.ac.uk/%7Ecsxam/teaching/qc2020/lecturenotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://people.maths.bris.ac.uk/~csxam/teaching/qc2020/lecturenotes.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do derive the split function? I cannot see the route to start to evaluate this.&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="491" LastEditDate="2020-07-17T23:42:36.277" LastActivityDate="2020-07-17T23:42:36.277" Title="Calcuate $\langle x | D | y \rangle$ for arbitrary $x,y \in \{0,1\}^n$" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12837" PostTypeId="2" ParentId="12836" CreationDate="2020-07-08T19:18:35.057" Score="3" Body="&lt;p&gt;Grover's Diffusion Operator &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}U_0H^{\otimes n}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; is the following matrix &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}-1 &amp;amp; 0 &amp;amp; 0 &amp;amp;... &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; ... &amp;amp;0 &#xA;\\.&amp;amp; . &amp;amp; 1 &amp;amp; ... &amp;amp; .&#xA;\\.&amp;amp; . &amp;amp; . &amp;amp; ... &amp;amp; .&#xA;\\0&amp;amp; 0 &amp;amp; 0 &amp;amp; ... &amp;amp; 1&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;The unitary &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; has the property that &lt;span class=&quot;math-container&quot;&gt;$U_0|0^n\rangle = -|0^n\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_0|\psi\rangle = -|\psi\rangle$&lt;/span&gt;.&lt;br /&gt;&#xA;Thus unitary &lt;span class=&quot;math-container&quot;&gt;$U_0$&lt;/span&gt; can also be written as &lt;span class=&quot;math-container&quot;&gt;$2|0^n\rangle\langle0^n|-I$&lt;/span&gt; as its matrix form can be expressed as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp;... &amp;amp; 0 &#xA;\\ 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; ... &amp;amp;0 &#xA;\\.&amp;amp; . &amp;amp; -1 &amp;amp; ... &amp;amp; .&#xA;\\.&amp;amp; . &amp;amp; . &amp;amp; ... &amp;amp; .&#xA;\\0&amp;amp; 0 &amp;amp; 0 &amp;amp; ... &amp;amp; -1&#xA;\end{bmatrix} = 2&#xA;\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp;... &amp;amp; 0 &#xA;\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; ... &amp;amp;0 &#xA;\\.&amp;amp; . &amp;amp; 0 &amp;amp; ... &amp;amp; .&#xA;\\.&amp;amp; . &amp;amp; . &amp;amp; ... &amp;amp; .&#xA;\\0&amp;amp; 0 &amp;amp; 0 &amp;amp; ... &amp;amp; 0&#xA;\end{bmatrix} -&#xA;\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp;... &amp;amp; 0 &#xA;\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; ... &amp;amp;0 &#xA;\\.&amp;amp; . &amp;amp; 1 &amp;amp; ... &amp;amp; .&#xA;\\.&amp;amp; . &amp;amp; . &amp;amp; ... &amp;amp; .&#xA;\\0&amp;amp; 0 &amp;amp; 0 &amp;amp; ... &amp;amp; 1&#xA;\end{bmatrix}   &#xA;$$&lt;/span&gt;&#xA;Now &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; can be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$D=H^{\otimes n}U_0H^{\otimes n}=H^{\otimes n}(2|0^n\rangle\langle0^n|-I)H^{\otimes n}\\&#xA;= 2H^{\otimes n}|0^n\rangle\langle0^n|H^{\otimes n}-H^{\otimes n}IH^{\otimes n} \\&#xA;= 2(H|0\rangle\langle0|H)^{\otimes n} - I \\&#xA;= 2(|+\rangle\langle+|)^{\otimes n} -I \\&#xA;= 2|+^n\rangle\langle+^n| -I \\&#xA;= -(I - 2|+^n\rangle\langle+^n|)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope this derivation helps.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-07-08T19:45:08.940" LastActivityDate="2020-07-08T19:45:08.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12838" PostTypeId="1" AcceptedAnswerId="12839" CreationDate="2020-07-08T19:26:36.980" Score="1" ViewCount="126" Body="&lt;p&gt;I'm trying to visualize a custom gate in Cirq. I have through &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; page, which briefly mentions how to create custom gates in Cirq. However, I'm getting errors when trying to visualize it.&lt;/p&gt;&#xA;&lt;p&gt;My current code defines a class &lt;code&gt;CustomGate&lt;/code&gt;, which inherits from &lt;code&gt;cirq.Gate&lt;/code&gt; class.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import cirq &#xA;class CustomGate(cirq.Gate):&#xA;    def __init__(self, unitary):&#xA;        self.unitary = unitary&#xA;        self.numQubits = int(np.log2(unitary.shape[0]))&#xA;&#xA;    def _num_qubits_(self):&#xA;        return self.numQubits&#xA;&#xA;    def _unitary_(self):&#xA;        return self.unitary&#xA;&#xA;    def _circuit_diagram_info_(self, args='cirq.CircuitDiagramInfoArgs') -&amp;gt; 'cirq.CircuitDiagramInfo':&#xA;        return cirq.CircuitDiagramInfo(wire_symbols=(&amp;quot;CG&amp;quot;,), exponent=1.0, connected=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The usage is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Define custom gate&#xA;customUnitary = np.eye(4)    # The custom unitary matrix would go here&#xA;CG = CustomGate(customUnitary)&#xA;&#xA;# Setup circuit&#xA;q = cirq.LineQubit.range(2)&#xA;circuit=cirq.Circuit()&#xA;circuit.append(CG(q[0], q[1]))&#xA;&#xA;# Visualize circuit&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm getting the following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &amp;quot;test.py&amp;quot;, line 42, in &amp;lt;module&amp;gt;&#xA;    print(circuit)&#xA;  File &amp;quot;/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py&amp;quot;, line 338, in __str__&#xA;    return self.to_text_diagram()&#xA;  File &amp;quot;/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py&amp;quot;, line 1609, in to_text_diagram&#xA;    transpose=transpose)&#xA;  File &amp;quot;/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py&amp;quot;, line 1668, in to_text_diagram_drawer&#xA;    get_circuit_diagram_info, include_tags)&#xA;  File &amp;quot;/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py&amp;quot;, line 1924, in _draw_moment_in_diagram&#xA;    info = get_circuit_diagram_info(op, args)&#xA;  File &amp;quot;/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py&amp;quot;, line 1818, in _get_operation_circuit_diagram_info_with_fallback&#xA;    info))&#xA;ValueError: Wanted diagram info from &amp;lt;__main__.CustomGate object at 0x10379bb90&amp;gt;.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)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12614" LastEditorUserId="55" LastEditDate="2020-07-14T16:50:56.810" LastActivityDate="2020-07-14T16:50:56.810" Title="Visualizing custom gates in Cirq" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12839" PostTypeId="2" ParentId="12838" CreationDate="2020-07-08T20:00:04.837" Score="2" Body="&lt;p&gt;You're making a two qubit gate but the circuit diagram info only has one wire label. Change &lt;code&gt;wire_symbols=(&amp;quot;CG&amp;quot;,)&lt;/code&gt; to &lt;code&gt;wire_symbols=(&amp;quot;CG&amp;quot;, &amp;quot;#2&amp;quot;)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that, since you're using default values for the diagram info you can just return the tuple &lt;code&gt;return &amp;quot;CG&amp;quot;, &amp;quot;#2&amp;quot;&lt;/code&gt; instead of bothering to wrap it in the more complicated data type.&lt;/p&gt;&#xA;&lt;p&gt;Note that cirq does include &lt;code&gt;cirq.MatrixGate&lt;/code&gt;, which takes an arbitrary unitary similar to what your custom gate is doing.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-07-08T20:00:04.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12840" PostTypeId="2" ParentId="12835" CreationDate="2020-07-08T21:11:02.547" Score="2" Body="&lt;p&gt;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: &lt;a href=&quot;https://en.wikipedia.org/wiki/Hidden-variable_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Hidden-variable_theory&lt;/a&gt;. As proved later on by Bell, this theory was not &amp;quot;possible&amp;quot; given the theory could not account for experimental behavior when observing correlations between entangled states.&lt;/p&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;You could start from there :)&lt;/p&gt;&#xA;" OwnerUserId="12302" LastActivityDate="2020-07-08T21:11:02.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12841" PostTypeId="1" AcceptedAnswerId="12842" CreationDate="2020-07-08T22:18:33.087" Score="1" ViewCount="70" Body="&lt;p&gt;Say we have a custom gate &lt;code&gt;CG&lt;/code&gt;, defined by a unitary matrix &lt;code&gt;U&lt;/code&gt;, and line qubits &lt;code&gt;qubits&lt;/code&gt; in Cirq. Something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy&#xA;import cirq&#xA;&#xA;U = np.eye(8)    # The custom unitary matrix goes here&#xA;CG = cirq.MatrixGate(U)&#xA;qubits = cirq.LineQubit.range(3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We build the circuit as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = cirq.Circuit()&#xA;circuit.append(CG(qubits[0], qubits[1], qubits[2]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is it possible to build the circuit without explicitly specifying all the qubits? Something like &lt;code&gt;circuit.append(CG(qubits))&lt;/code&gt;, which would apply the &lt;code&gt;CG&lt;/code&gt; gate to all the qubits?&lt;/p&gt;&#xA;" OwnerUserId="12614" LastEditorUserId="55" LastEditDate="2020-07-14T16:50:48.747" LastActivityDate="2020-07-14T16:50:48.747" Title="Applying a gate to all line qubits without explicitly listing them in Cirq" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12842" PostTypeId="2" ParentId="12841" CreationDate="2020-07-08T23:34:34.887" Score="2" Body="&lt;p&gt;In Python you can say &lt;code&gt;callable(*args)&lt;/code&gt; instead of &lt;code&gt;callable(args[0], args[1], args[2])&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-07-08T23:34:34.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12843" PostTypeId="2" ParentId="12835" CreationDate="2020-07-09T04:33:16.403" Score="1" Body="&lt;p&gt;The coin example is incorrect (that is, different from QM) if you consider correlations of measurements of entangled qubits in different bases.&lt;/p&gt;&#xA;&lt;p&gt;If you want a more advanced attempt of building a deterministic theory underlying QM, have a look at Gerard 't Hooft book &lt;a href=&quot;https://www.springer.com/gp/book/9783319412849&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Cellular Automaton Interpretation of Quantum Mechanics&lt;/a&gt; which is free now.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2020-07-09T04:33:16.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12844" PostTypeId="1" AcceptedAnswerId="12852" CreationDate="2020-07-09T06:21:11.547" Score="0" ViewCount="128" Body="&lt;p&gt;Recently I focused on how to simulate in classical computer, and I found Qiskit offers &lt;code&gt;qasmsimulator&lt;/code&gt; and &lt;code&gt;statevector simulator&lt;/code&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-07-13T16:03:25.343" LastActivityDate="2020-07-13T16:03:25.343" Title="How the simulator work?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12845" PostTypeId="1" AcceptedAnswerId="12848" CreationDate="2020-07-09T13:30:45.183" Score="0" ViewCount="81" Body="&lt;p&gt;In Learning Quantum Computation using Qiskit chapter 3.4 I encountered the Deutsch-Josza Algorithm.&#xA;At the end of the chapter I was presented with a homework problem where the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit_textbook.problems import dj_problem_oracle&#xA;oracle = dj_problem_oracle(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;gives me a gate called 'oracle' and I was supposed to do find out whether it was balanced or constant.&#xA;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.'&lt;/p&gt;&#xA;&lt;p&gt;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).&#xA;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).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12233" LastEditorUserId="12233" LastEditDate="2020-07-09T14:11:54.730" LastActivityDate="2020-07-09T15:41:47.593" Title="Feedback on Deutsch-Josza alg. homework prob. in Learning Quantum computation using Qiskit" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2020-07-10T11:28:38.703" ContentLicense="CC BY-SA 4.0" />
  <row Id="12846" PostTypeId="1" CreationDate="2020-07-09T15:01:00.753" Score="3" ViewCount="374" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;    import numpy as np&#xA;    from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister, IBMQ, execute&#xA;    from qiskit.providers.aer import QasmSimulator&#xA;    from qiskit.visualization import plot_histogram&#xA;    from qiskit.compiler import transpile&#xA;    import DAQC&#xA;&#xA;    provider = IBMQ.load_account() &#xA;    # Get properties and coupling map of the desired device&#xA;    device = provider.get_backend('ibmq_london')&#xA;    properties = device.properties()&#xA;    coupling_map = device.configuration().coupling_map&#xA;    basis_gates=device.configuration().basis_gates  &#xA; &#xA;    # Circuit&#xA;    n=5&#xA;    beta=0&#xA;    state=DAQC.initial_state_QFT(n,beta)&#xA;    qr=QuantumRegister(n)&#xA;    cr=ClassicalRegister(n)&#xA;    qc=QuantumCircuit(qr,cr)&#xA;        &#xA;    qc.initialize(state,qr)&#xA;    qft(qc,n)&#xA;    qc.measure(qr,cr)&#xA;    backend = QasmSimulator()&#xA;    job = execute(qc, backend=backend,shots=100000)&#xA;    result_ideal = job.result()&#xA;    qiskit_counts=result_ideal.get_counts()&#xA;    qnoise.show_figure(plot_histogram(qiskit_counts, title='Results for qiskit ideal simulator'))&#xA;    &#xA;    # Transpiled circuit&#xA;    qr2=QuantumRegister(n)&#xA;    cr2=ClassicalRegister(n)&#xA;    qc2=QuantumCircuit(qr2,cr2)&#xA;        &#xA;    qc2.initialize(state,qr2)&#xA;    qft(qc2,n)&#xA;    qc2=transpile(qc2,basis_gates=basis_gates,coupling_map=coupling_map)&#xA;    qc2.measure(0,0)&#xA;    qc2.measure(1,1)&#xA;    qc2.measure(2,2)&#xA;    qc2.measure(3,3)&#xA;    qc2.measure(4,4)  &#xA;    job = execute(qc2, backend=backend,shots=100000)&#xA;    result_ideal = job.result()&#xA;    qiskit_counts=result_ideal.get_counts()&#xA;    qnoise.show_figure(plot_histogram(qiskit_counts, title='Results for qiskit ideal simulator (transpiled)'))&#xA;    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3NSut.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3NSut.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zInHI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zInHI.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="9887" LastEditorUserId="55" LastEditDate="2020-07-13T16:04:33.323" LastActivityDate="2020-07-13T18:02:49.880" Title="Why after transpiling a Qiskit circuit we obtain a different result?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;quantum-fourier-transform&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="12847" PostTypeId="2" ParentId="9798" CreationDate="2020-07-09T15:40:29.107" Score="2" Body="&lt;p&gt;The linked question gives most of the relevant information but I want to focus on a few aspects of :&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Grover's algorithm needs a number of &lt;em&gt;iterations&lt;/em&gt; 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 &amp;quot;iteration&amp;quot; is one computation of the hash function SHA-256.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://eprint.iacr.org/2016/992.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;5000 qubits.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum computers need error correction, so each of the qubits from the first point (what we call &amp;quot;logical qubits&amp;quot;) will need many thousands of &amp;quot;physical&amp;quot; qubits (e.g., the kind that IBM and Google have right now, but better). The same paper estimates &lt;a href=&quot;https://eprint.iacr.org/2016/992.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;14 million physical qubits&lt;/a&gt; to run Grover's algorithm on SHA-256. They are considering a full pre-image search, which is harder, so maybe bitcoin mining would &amp;quot;only&amp;quot; need a few hundred thousand qubits.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Grover's algorithm won't instantly find a valid block header. If the current challenge is to find a header whose hash has &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; zero bits, Grover's algorithm needs to compute the hash function roughly &lt;span class=&quot;math-container&quot;&gt;$2^{b/2}$&lt;/span&gt; times. Right now &lt;a href=&quot;https://en.bitcoin.it/wiki/Hashcash&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$b=62$&lt;/span&gt;&lt;/a&gt; so Grover's algorithm would still need to compute SHA-256 &lt;span class=&quot;math-container&quot;&gt;$2^{31}$&lt;/span&gt; times.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Right now, the bitcoin network is massively parallel. The network as a whole computes something like &lt;span class=&quot;math-container&quot;&gt;$2^{60}$&lt;/span&gt; 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 &lt;a href=&quot;https://en.bitcoin.it/wiki/Non-specialized_hardware_comparison#CPUs.2FAPUs&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$2^{20}$&lt;/span&gt; hashes/second for a single processor&lt;/a&gt;). 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 &lt;span class=&quot;math-container&quot;&gt;$2^{29}$&lt;/span&gt; hashes in 10 minutes, so it would need &lt;span class=&quot;math-container&quot;&gt;$(2^{31}/2^{29})^2=2^{4}=16$&lt;/span&gt; quantum computers to have any mining advantage.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So: if you had 16 quantum computers, each with several hundred thousand qubits, you &lt;em&gt;might&lt;/em&gt; have a slight bitcoin mining advantage.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-07-09T15:40:29.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12848" PostTypeId="2" ParentId="12845" CreationDate="2020-07-09T15:41:47.593" Score="2" Body="&lt;p&gt;I think you misunderstood the problem here.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Now, since the oracle that is created is a gate, you can access its number of qubits by doing &lt;code&gt;oracle.num_qubits&lt;/code&gt;, 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).&lt;br /&gt;&#xA;I tried this and it worked, let me know if you still need help! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-09T15:41:47.593" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12849" PostTypeId="1" AcceptedAnswerId="12861" CreationDate="2020-07-09T16:02:37.130" Score="2" ViewCount="157" Body="&lt;p&gt;The following links provides circuts for &lt;span class=&quot;math-container&quot;&gt;$a\in\{2,7,8,11,13\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N=15$&lt;/span&gt;: &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/shor.html#3.-Qiskit-Implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/shor.html#3.-Qiskit-Implementation&lt;/a&gt;&#xA;&lt;a href=&quot;https://arxiv.org/abs/1202.6614v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1202.6614v3&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I am interested in implementing circuts for the case when &lt;span class=&quot;math-container&quot;&gt;$a=2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N=21$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a=3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N=14$&lt;/span&gt; or a generic way to generate them.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12626" LastEditorUserId="55" LastEditDate="2020-07-13T16:04:55.613" LastActivityDate="2020-07-13T16:04:55.613" Title="How to implement Cx mod N unitary" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12850" PostTypeId="1" CreationDate="2020-07-09T18:04:28.850" Score="-1" ViewCount="117" Body="&lt;p&gt;Reproduced from Nielsen &amp;amp; Chuang's Quantum Computation and Quantum Information (10th Anniversary Edition) in page 64:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We've seen that matrices can be regarded as linear operators. [...] Suppose &lt;span class=&quot;math-container&quot;&gt;$A: V \rightarrow W$&lt;/span&gt; is a linear operator between vector spaces &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. Suppose &lt;span class=&quot;math-container&quot;&gt;$|v_{1}\rangle,...,|v_{m}\rangle$&lt;/span&gt; is a basis for &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|w_{1}\rangle,...,|w_{m}\rangle$&lt;/span&gt; is a basis for &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. Then for each j in the range 1,...,m, there exist complex numbers &lt;span class=&quot;math-container&quot;&gt;$A_{1j}$&lt;/span&gt; through  &lt;span class=&quot;math-container&quot;&gt;$A_{nj}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A|v_{j}\rangle = \sum_{i} A_{ij} |w_{i}\rangle \tag{2.12} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I'm presenting this question because I made a mistake with equation (2.12) in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12668/how-to-find-the-matrix-representation-of-an-operator-from-its-action-on-a-basis?noredirect=1&quot;&gt;this other question&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;Thanks for all information or advice you can give to me.&lt;/p&gt;&#xA;" OwnerDisplayName="user12503" LastEditorUserId="23" LastEditDate="2020-07-18T23:32:33.693" LastActivityDate="2020-07-18T23:32:33.693" Title="Nielsen and Chuang: Demonstration of equation 2.12" Tags="&lt;nielsen-and-chuang&gt;&lt;matrix-representation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ClosedDate="2021-02-22T12:16:43.777" ContentLicense="CC BY-SA 4.0" />
  <row Id="12851" PostTypeId="2" ParentId="12850" CreationDate="2020-07-09T18:54:23.197" Score="0" Body="&lt;p&gt;Suppose that you have an basis vector &lt;span class=&quot;math-container&quot;&gt;$|v_i\rangle  $&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|w_j\rangle $&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$A_{ij}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11971" LastActivityDate="2020-07-09T18:54:23.197" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12852" PostTypeId="2" ParentId="12844" CreationDate="2020-07-09T19:03:12.637" Score="4" Body="&lt;p&gt;There are three major levels of simulation difficulty (broadly, there are a bunch of others, but these are the main levels.)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;The last level is Density Matrix simulation. Here, we store the full &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-07-09T19:03:12.637" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12854" PostTypeId="2" ParentId="8300" CreationDate="2020-07-10T03:28:35.180" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;How to construct SqrtX using the minimum number of gates, it depends on your purposes.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; ┌──────────┐&#xA; ┤ RX(pi/2) ├&#xA; └──────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.rx(np.pi/2, reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; ┌──────────┐┌───┐┌───────────────────┐&#xA; ┤ RX(pi/2) ├┤ X ├┤ U3(pi,pi/4,5pi/4) ├&#xA; └──────────┘└───┘└───────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.rx(np.pi/2, reg)&#xA;qc.x(reg)&#xA;qc.u3(np.pi, np.pi/4, 5*np.pi/4, reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or like this (without RX):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; ┌────────────────┐┌───┐┌────────────────┐&#xA; ┤ U2(-pi/4,pi/2) ├┤ X ├┤ U3(pi,0,5pi/4) ├&#xA; └────────────────┘└───┘└────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.u2(-np.pi / 4, np.pi / 2, reg)&#xA;qc.x(reg)&#xA;qc.u3(np.pi, 0, 5 * np.pi / 4, reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or as in my edition of the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12232/12280&quot;&gt;answer&lt;/a&gt;. As you see, this circuit is almost same as in the original of the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/posts/12232/revisions&quot;&gt;answer&lt;/a&gt; but in my edition it uses u1 instead of rz.&lt;/p&gt;&#xA;&lt;blockquote class=&quot;spoiler&quot;&gt;&#xA;&lt;p&gt; 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 &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html#Rotation-around-Z-axis&quot; rel=&quot;nofollow noreferrer&quot;&gt;a global phase exp(-iϕ/2)&lt;/a&gt; and this can be significant in cases like adding control to an unitary gate (in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13156/12280&quot;&gt;answer&lt;/a&gt; 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).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Also SqrtX may be constucted by using the  Qiskit's power method:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.append(XGate().power(1/2), reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or by using one of unitary matrices corresponding to the square roots of the X gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.unitary([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]], reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or by using Operator:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.append(Operator([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]]), reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or similarly, using UnitaryGate, squ/iso methods, qasm, etc (but be careful, Qiskit does not always accurately process the phase!).&lt;/p&gt;&#xA;&lt;p&gt;PS. I already mentioned in another &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12638/12280&quot;&gt;answer&lt;/a&gt; about my Qiskit program for small investigating of the various cases of the roots of X and Y, look if you are interested.&lt;/p&gt;&#xA;&lt;p&gt;UPD: In new version of Qiskit &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#qiskit-0-20-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;0.20.0&lt;/a&gt; there are new gates, such as: SXGate, SXdgGate and CSXGate (i.e. SqrtX, SqrtX&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; and Controlled-SqrtX gates, respectively). Similar gates have also been added to &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/libs/qelib1.inc&quot; rel=&quot;nofollow noreferrer&quot;&gt;qelib1.inc&lt;/a&gt;. The following decompositions of these gates is applied there (unlike the &lt;code&gt;csx&lt;/code&gt; gate, these decomposition of the &lt;code&gt;sx&lt;/code&gt; and &lt;code&gt;sxdg&lt;/code&gt; gates are completely equivalent to the &lt;code&gt;rx(π/2)&lt;/code&gt; and &lt;code&gt;rx(-π/2)&lt;/code&gt; gates respectively, and if the global phase is important for your purposes, then these decompositions require adding it as &lt;span class=&quot;math-container&quot;&gt;$\pm\pi/4$&lt;/span&gt; respectively!):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// sqrt(X)&#xA;gate sx a { sdg a; h a; sdg a; }&#xA;// inverse sqrt(X)&#xA;gate sxdg a { s a; h a; s a; }&#xA;...&#xA;// controlled-sqrt(X)&#xA;gate csx a,b { h b; cu1(pi/2) a,b; h b; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;UPD2: The new IBM Q system  has a native implementation of  the SqrtX gate along with other innovations: &amp;quot;&lt;em&gt;The ibmq_montreal device  has  the  following  native  gate  set  forachieving universal quantum computation: Ctrl-X (CX), &lt;strong&gt;Sqrt-X (SX)&lt;/strong&gt; and Phase(θ)&lt;/em&gt;&amp;quot;, for details see &lt;a href=&quot;https://arxiv.org/pdf/2008.08571.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12280" LastEditorUserId="12280" LastEditDate="2020-08-25T06:46:10.710" LastActivityDate="2020-08-25T06:46:10.710" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12857" PostTypeId="1" AcceptedAnswerId="12870" CreationDate="2020-07-10T10:17:08.167" Score="2" ViewCount="148" Body="&lt;p&gt;I am going through the paper &lt;a href=&quot;https://arxiv.org/pdf/1210.5799.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Surface code with decoherence: An analysis of three superconducting architectures&lt;/a&gt; and I have a doubt about how the authors get what they refer to as the &lt;em&gt;combined channel of amplitude and phase damping&lt;/em&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I am wondering how such Kraus operators are obtained from the Kraus operators describing the individual channels&lt;/strong&gt;, 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).&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="491" LastEditDate="2020-07-17T23:25:38.510" LastActivityDate="2020-07-17T23:25:38.510" Title="Find the Kraus operators of a combined amplitude and phase damping channel" Tags="&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12858" PostTypeId="2" ParentId="12850" CreationDate="2020-07-10T10:23:46.637" Score="2" Body="&lt;p&gt;I'll try to explain the whole process here, I hope this will clear the equation for you!&lt;/p&gt;&#xA;&lt;p&gt;So, what we are trying to do here is to find a matrix that represents the linear operator &lt;span class=&quot;math-container&quot;&gt;$A : V \rightarrow W$&lt;/span&gt;.&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; are both vector spaces so we know we can find one basis for each set, here &lt;span class=&quot;math-container&quot;&gt;$|v_1\rangle, ..., |v_m\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|w_1\rangle, ..., |w_n\rangle$&lt;/span&gt;. Now, we want to study how &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; acts on the set &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|y_i\rangle = A(|v_i\rangle)$&lt;/span&gt;. So since &lt;span class=&quot;math-container&quot;&gt;$A : V \rightarrow W$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$|y_i\rangle \in W$&lt;/span&gt;, so the direct result we have is that we can write this vector as a linear combination of the &lt;span class=&quot;math-container&quot;&gt;$|w_1\rangle, ..., |w_n\rangle$&lt;/span&gt; since this is a basis of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;This is the information &lt;span class=&quot;math-container&quot;&gt;$(2.12)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$A(|v_i\rangle)$&lt;/span&gt; is written as a linear combination of the basis &lt;span class=&quot;math-container&quot;&gt;$|w_1\rangle, ..., |w_n\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Please let me know if you need clarification on something :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="8757" LastEditDate="2020-07-10T11:12:45.753" LastActivityDate="2020-07-10T11:12:45.753" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12859" PostTypeId="1" CreationDate="2020-07-10T10:34:49.210" Score="1" ViewCount="116" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The following is a graphical representation of my algorithm. To read the diagram, &lt;strong&gt;follow the colored circles&lt;/strong&gt;. The arrows show the direction in which data flows, not sequential steps in the program. The sequential steps are represented by the colored circles. &lt;strong&gt;Note that all state in this system would be finite&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HAY1j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HAY1j.png&quot; alt=&quot;Design for a quantum machine learning algorithm&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The user pre-configures their &lt;strong&gt;training data&lt;/strong&gt; into the system. This consists of &lt;strong&gt;network input&lt;/strong&gt; and &lt;strong&gt;expected network output&lt;/strong&gt; pairs.&lt;/li&gt;&#xA;&lt;li&gt;The user pre-configures the &lt;strong&gt;cost threshold&lt;/strong&gt;, a guess for the lowest accumulated cost value.&lt;/li&gt;&#xA;&lt;li&gt;The algorithm starts the &lt;strong&gt;iteration&lt;/strong&gt; over &lt;strong&gt;training data&lt;/strong&gt; pairs. The &lt;strong&gt;network input&lt;/strong&gt; is fed into the &lt;strong&gt;neural network&lt;/strong&gt;, along with the &lt;strong&gt;weights&lt;/strong&gt; which are represented in qbits. This produces a &lt;strong&gt;network output&lt;/strong&gt;, which is also represented in qbits. (Each superposition of the &lt;strong&gt;network output&lt;/strong&gt; should be entangled with a particular superposition of the &lt;strong&gt;weights&lt;/strong&gt;.) A &lt;strong&gt;cost function&lt;/strong&gt; then computes a cost (represented in qbits) based on the &lt;strong&gt;expected network output&lt;/strong&gt; and the &lt;strong&gt;network output&lt;/strong&gt;. An &lt;strong&gt;accumulator&lt;/strong&gt; accumulates these costs over each &lt;strong&gt;iteration&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Once the &lt;strong&gt;iteration&lt;/strong&gt; is finished, we compare the &lt;strong&gt;accumulated cost&lt;/strong&gt; with the &lt;strong&gt;cost threshold&lt;/strong&gt;. If it is &lt;strong&gt;less&lt;/strong&gt; than the &lt;strong&gt;cost threshold&lt;/strong&gt;, we display the &lt;strong&gt;weights&lt;/strong&gt; that are entangled with the &lt;strong&gt;accumulated cost&lt;/strong&gt; 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 &lt;strong&gt;weights&lt;/strong&gt; that produce an &lt;strong&gt;accumulated cost&lt;/strong&gt; that is less than the &lt;strong&gt;cost threshold&lt;/strong&gt;. If nothing is displayed, it means no branch passed the &lt;strong&gt;cost threshold&lt;/strong&gt;, so the user should start from step 2 with a higher &lt;strong&gt;cost threshold&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Repeat steps 2, 3, 4 until satisfied with the displayed weights and cost threshold.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;cost threshold&lt;/strong&gt; 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 &lt;strong&gt;cost function&lt;/strong&gt;). Would this work in practice, and are there any glaring flaws with my design or understanding of quantum mechanics?&lt;/p&gt;&#xA;" OwnerUserId="12631" LastActivityDate="2021-04-09T20:07:20.727" Title="Quantum-Assisted Neural Network Training (Is my design reasonable?)" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;machine-learning&gt;" AnswerCount="1" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="12861" PostTypeId="2" ParentId="12849" CreationDate="2020-07-10T16:08:20.377" Score="1" Body="&lt;p&gt;Firstly, these circuits only need to work for states &lt;span class=&quot;math-container&quot;&gt;$C^k \pmod{N}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$N \bmod N$&lt;/span&gt; without outputting to a different register since this would not be reversible.&lt;/p&gt;&#xA;&lt;h2&gt;Below is how I came to an answer for your specific question (not a general method):&lt;/h2&gt;&#xA;&lt;p&gt;For the specific cases you stated, you can find a circuit analytically. I'll create &lt;span class=&quot;math-container&quot;&gt;$2x \bmod 21$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Start with a working circuit, for example the &lt;span class=&quot;math-container&quot;&gt;$2x \bmod 15$&lt;/span&gt; circuit from the paper you linked. I have added one qubit since we'll need it later to create &lt;span class=&quot;math-container&quot;&gt;$2x \bmod 21$&lt;/span&gt;. I have also included a function that cycles through the states and checks everything works correctly.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;def test_cycles(circuit, cycles):&#xA;    i = 1&#xA;    for application in range(cycles):&#xA;        print(&amp;quot;Apply %s, %i times: %i&amp;quot; % (circuit.name, application, i))&#xA;        sv = Statevector.from_int(i, 32)  # 32 is no. of elements in vector (dimension)&#xA;        sv = sv.evolve(circuit)&#xA;        output = sv.sample_memory(1)[0]  # simulate one shot (circuit is deterministic)&#xA;        i = int(output, 2)  # convert binary output to int&#xA;&#xA;tm15 = QuantumCircuit(5)  # 2x mod 15&#xA;tm15.name = &amp;quot;2x (mod 15)&amp;quot;&#xA;tm15.swap(0,3)&#xA;tm15.swap(3,2)&#xA;tm15.swap(2,1)&#xA;        &#xA;test_cycles(tm15, 6)&#xA;tm15.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Apply 2x (mod 15), 0 times: 1&#xA;Apply 2x (mod 15), 1 times: 2&#xA;Apply 2x (mod 15), 2 times: 4&#xA;Apply 2x (mod 15), 3 times: 8&#xA;Apply 2x (mod 15), 4 times: 1&#xA;Apply 2x (mod 15), 5 times: 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jPy4r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jPy4r.png&quot; alt=&quot;2x mod 15 circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can see the state of the state of the register follows the sequence &lt;code&gt;1, 2, 4, 8, 1...&lt;/code&gt; with successvie applications of the circuit. To make &lt;span class=&quot;math-container&quot;&gt;$2x \bmod 21$&lt;/span&gt; we want the sequence to be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;1, 2, 4, 8, 16, 11, 1... &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2x \bmod 31$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;tm31 = QuantumCircuit(5)&#xA;tm31.name = &amp;quot;2x mod 31&amp;quot;&#xA;tm31.swap(3,4)&#xA;tm31 += tm15&#xA;test_cycles(tm31, 6)&#xA;tm31.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Apply 2x mod 31, 0 times: 1&#xA;Apply 2x mod 31, 1 times: 2&#xA;Apply 2x mod 31, 2 times: 4&#xA;Apply 2x mod 31, 3 times: 8&#xA;Apply 2x mod 31, 4 times: 16&#xA;Apply 2x mod 31, 5 times: 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RYdLB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RYdLB.png&quot; alt=&quot;2x mod 31 circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We need to modify our circuit to do the transformation: 16 -&amp;gt; 11. In binary, this is the transformation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;10000 -&amp;gt; 01011&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;tm21 = QuantumCircuit(5)&#xA;tm21.name = &amp;quot;2x mod 21&amp;quot;&#xA;tm21.cx(4, 2)&#xA;tm21.cx(4, 0)&#xA;tm21 += tm32&#xA;test_cycles(tm21, 16)&#xA;tm21.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Apply 2x mod 21, 0 times: 1&#xA;Apply 2x mod 21, 1 times: 2&#xA;Apply 2x mod 21, 2 times: 4&#xA;Apply 2x mod 21, 3 times: 8&#xA;Apply 2x mod 21, 4 times: 16&#xA;Apply 2x mod 21, 5 times: 11&#xA;Apply 2x mod 21, 6 times: 22&#xA;Apply 2x mod 21, 7 times: 7&#xA;Apply 2x mod 21, 8 times: 14&#xA;Apply 2x mod 21, 9 times: 28&#xA;Apply 2x mod 21, 10 times: 19&#xA;Apply 2x mod 21, 11 times: 13&#xA;Apply 2x mod 21, 12 times: 26&#xA;Apply 2x mod 21, 13 times: 31&#xA;Apply 2x mod 21, 14 times: 21&#xA;Apply 2x mod 21, 15 times: 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dbo4U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dbo4U.png&quot; alt=&quot;incomplete 2x mod 21 circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here I have used the fact that the &lt;span class=&quot;math-container&quot;&gt;$2x\bmod 31$&lt;/span&gt; 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 -&amp;gt; 1. It does however do: 21 -&amp;gt; 1. To complete our circuit, we must prepend a circuit that does the transformation: 11 -&amp;gt; 21, or in binary:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;01011 -&amp;gt; 10101&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we know this will not adversely affect any of the other states in the cycle:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;tm21 = QuantumCircuit(5)&#xA;tm21.name = &amp;quot;2x mod 21&amp;quot;&#xA;tm21.cswap(0,3,4)&#xA;tm21.cswap(0,1,2)&#xA;tm21.cx(4, 2)&#xA;tm21.cx(4, 0)&#xA;tm21 += tm31&#xA;test_cycles(tm21, 8)&#xA;tm21.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Apply 2x mod 21, 0 times: 1&#xA;Apply 2x mod 21, 1 times: 2&#xA;Apply 2x mod 21, 2 times: 4&#xA;Apply 2x mod 21, 3 times: 8&#xA;Apply 2x mod 21, 4 times: 16&#xA;Apply 2x mod 21, 5 times: 11&#xA;Apply 2x mod 21, 6 times: 1&#xA;Apply 2x mod 21, 7 times: 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6RNcv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6RNcv.png&quot; alt=&quot;complete 2x mod 21 circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Above is a complete circuit for &lt;span class=&quot;math-container&quot;&gt;$2x \bmod 21$&lt;/span&gt; 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 &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0205095.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10415" LastEditorUserId="10415" LastEditDate="2020-07-10T16:15:58.910" LastActivityDate="2020-07-10T16:15:58.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12862" PostTypeId="1" CreationDate="2020-07-10T18:21:39.643" Score="2" ViewCount="47" Body="&lt;p&gt;Question is about techniques from &lt;a href=&quot;https://www.cs.princeton.edu/%7Emzhandry/docs/papers/QIndiff.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. Essentially the paper provides a way to record what queries were asked to a quantum-accessible oracle. We have the oracles: &lt;span class=&quot;math-container&quot;&gt;\begin{aligned}&#xA;&amp;amp;\text { Standard oracle }(\mathrm{StO}):|x\rangle_{X}|y\rangle_{Y} \mapsto|x\rangle_{X}|y \oplus f(x)\rangle_{Y}\\&#xA;&amp;amp;\text { Phase oracle (PhO): } \quad|x\rangle_{X}|\eta\rangle_{Y} \mapsto(-1)^{\eta \cdot f(x)}|x\rangle_{X}|\eta\rangle_{Y}&#xA;\end{aligned}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The fourier oracle is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text { Fourier Oracle }(\mathrm{FO}): F O:=H^{F} \circ P h O \circ H^{F}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$H^F$&lt;/span&gt; stands for &lt;span class=&quot;math-container&quot;&gt;$QFT$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;The problem is decoding what happens in the last step here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array}{l}&#xA;|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 \\&#xA;\stackrel{H^{F}}{\rightarrow} \sum_{f, \phi}(-1)^{\phi \cdot f}(-1)^{\eta \cdot f(x)}|x\rangle|\eta\rangle|\phi\rangle=\ldots \\&#xA;=|x\rangle|\eta\rangle\left|0^{n} \cdots 0^{n} \eta 0^{n} \cdots 0^{n}\right\rangle&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|f\rangle$&lt;/span&gt; is the superposition of all possible &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; in the corresponding domain and range. The claim is that after the last step at the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;'th position you get &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt;. Which indicates at which point the oracle was queried. How does the register containing &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; transform to the register with &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;'th position?&lt;/p&gt;&#xA;" OwnerUserId="12634" LastEditorUserId="55" LastEditDate="2020-09-30T03:53:01.050" LastActivityDate="2020-09-30T03:53:01.050" Title="Recording Quantum Queries" Tags="&lt;oracles&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12863" PostTypeId="2" ParentId="12785" CreationDate="2020-07-10T22:39:43.597" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If the input is classical (&lt;em&gt;i.e.&lt;/em&gt; coherent light) then the output of an interferometer can be simulated efficiently classically, meaning that this is not useful for quantum computation.&#xA;The same goes when the input is a single photon.&lt;/p&gt;&#xA;&lt;p&gt;Things get more interesting when using as input multiple single photons on different inputs modes. Then we know that this setup &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;cannot be simulated efficiently with a classical device&lt;/a&gt;. However, as far as I know, it is not known whether it is possible to implement &amp;quot;useful&amp;quot; quantum algorithms with this type of device.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-07-10T22:39:43.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12864" PostTypeId="1" AcceptedAnswerId="12865" CreationDate="2020-07-11T03:23:31.493" Score="0" ViewCount="73" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="1108" LastEditDate="2020-07-11T23:28:53.030" LastActivityDate="2020-07-13T02:24:53.497" Title="Can you encode two values in a single qubit state, say its phase and orientation?" Tags="&lt;quantum-state&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12865" PostTypeId="2" ParentId="12864" CreationDate="2020-07-11T06:21:31.727" Score="1" Body="&lt;p&gt;Each qubit can be described as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \alpha|0\rangle+\mathrm{e}^{i\varphi}\beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\alpha^2+\beta^2=1$&lt;/span&gt;. Both &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are real numbers. These values are so-called amplitudes and it holds that &lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle) = \alpha^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(|1\rangle) = \beta^2$&lt;/span&gt;. So, amplitudes describe probability that you find your qubit in either state after measurement (up or down in your question or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in example above). An angle &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is the phase, the person you mentioned talked about. It is another purely quantum parameter of qubit (i.e. there is no analog in &lt;em&gt;classical world&lt;/em&gt;). The existence of phase is one of reasons why quantum computer can be superior to classical one in some tasks.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Appendix:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also write the qubit as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \alpha|0\rangle+\beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;. Both &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are complex numbers. These numbers are again called amplitudes and it holds that &lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle) = |\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(|1\rangle) = |\beta|^2$&lt;/span&gt;. The phase is &lt;em&gt;hidden&lt;/em&gt; in amplitudes in this case.&lt;/p&gt;&#xA;&lt;p&gt;Both above mentioned forms can be transformed to each other (write complex numbers &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; in expontential form).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-11T06:21:31.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12866" PostTypeId="2" ParentId="12864" CreationDate="2020-07-11T07:09:56.727" Score="4" Body="&lt;p&gt;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 &lt;em&gt;successfully distinguished&lt;/em&gt;. This nuance is captured by the so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's theorem&lt;/a&gt; which essentially states that a qubit can contain &lt;em&gt;at most&lt;/em&gt; one bit of information.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;only two&lt;/em&gt; orthogonal states (for the pure state case), one can &lt;em&gt;retrieve&lt;/em&gt; only a single bit of information from a qubit.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-11T07:09:56.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12868" PostTypeId="1" CreationDate="2020-07-11T18:49:11.733" Score="2" ViewCount="75" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://tex.stackexchange.com/q/553152/103128&quot;&gt;Cross-posted on Tex.SE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10455" LastEditorUserId="23" LastEditDate="2020-07-18T23:44:09.170" LastActivityDate="2020-07-18T23:44:09.170" Title="Is there anything Quantikz can do that Tikz cannot do?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="3" ClosedDate="2020-07-18T23:40:53.400" ContentLicense="CC BY-SA 4.0" />
  <row Id="12869" PostTypeId="2" ParentId="12868" CreationDate="2020-07-12T09:34:58.640" Score="1" Body="&lt;p&gt;As explained in &lt;a href=&quot;https://arxiv.org/pdf/1809.03842.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt;, Quantikz is a Tikz package that is specific for drawing quantum circuits. So they are not alternative solutions.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-07-12T09:34:58.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12870" PostTypeId="2" ParentId="12857" CreationDate="2020-07-12T11:27:23.237" Score="4" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&lt;p&gt;Amplitude damping:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E^{AD}_1 = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-p_{AD}} \end{bmatrix}$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$E^{AD}_2 = \begin{bmatrix} 0 &amp;amp; \sqrt{p_{AD}} \\ 0 &amp;amp; 0 \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Phase damping:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E^{PD}_1 = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-p_{PD}} \end{bmatrix}$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$E^{PD}_2 = \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{p_{PD}} \end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Combined:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E^{D}_1 = E^{PD}_1 E^{AD}_1 = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-p_{AD}}\sqrt{1-p_{PD}} \end{bmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E^{D}_2 = E^{PD}_1 E^{AD}_2 = \begin{bmatrix} 0 &amp;amp; \sqrt{p_{AD}} \\ 0 &amp;amp; 0 \end{bmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E^{D}_3 = E^{PD}_2 E^{AD}_1 = \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-p_{AD}}\sqrt{p_{PD}} \end{bmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the Kraus set given in the paper you linked.  There is a fourth possible combination, which is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E^{D}_4 = E^{PD}_2 E^{AD}_2 =  \begin{bmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is the null channel.  Since we first destroy any &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states, the phase damping channel only has &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; states to act on, which are sent to 0.&lt;/p&gt;&#xA;&lt;p&gt;The order in which you apply amplitude and phase damping does not actually matter, that is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{AD} \circ \mathcal{E}_{PD} (\rho) = \mathcal{E}_{PD} \circ \mathcal{E}_{AD} (\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2020-07-12T11:27:23.237" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12872" PostTypeId="1" CreationDate="2020-07-12T18:56:36.517" Score="3" ViewCount="84" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33}$&lt;/span&gt;&#xA;(&lt;a href=&quot;https://arxiv.org/abs/1701.01973&quot; rel=&quot;nofollow noreferrer&quot;&gt;MasterLovas-AndaiFormula&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;Assuming this proposition, it follows from the interesting 2005 analysis of Szarek, Bengtsson and Zyczkowski &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0509008&quot; rel=&quot;nofollow noreferrer&quot;&gt;structure of the body of states with positive partial transpose&lt;/a&gt; that&#xA;the Hilbert-Schmidt probability that a generic boundary (rank-3) two-qubit density matrix is separable/PPT is simply one-half, that is &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{33}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{27}{1000}$&lt;/span&gt;.&#xA;&lt;a href=&quot;https://arxiv.org/abs/1901.09889&quot; rel=&quot;nofollow noreferrer&quot;&gt;NumericalExact&lt;/a&gt; (It was also speculated there that the Hilbert-Schmidt PPT-probability for generic two-qutrit states might be &lt;span class=&quot;math-container&quot;&gt;$\frac{323}{3161088}=\frac{17 \cdot 19}{2^{10} \cdot 3^2 \cdot 7^3} \approx 0.000102180009$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\frac{11}{107653} = \frac{11}{7^2 \cdot 13^3} \approx 0.000102180153$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Rank-2 two-qubit states have been studied in considerable depth by Horia Scutaru&#xA;in &amp;quot;On the pseudo-pure states of two qubits.&amp;quot; Proceedings of the Romanian Academy. Series A. Mathematics, Physics, Technical Sciences, Information Science 5.2 (2004): 136-140.  &lt;a href=&quot;https://acad.ro/sectii2002/proceedings/doc2_2004/07_Scutaru.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;pseudo-pure state article&lt;/a&gt; (I considered sending him this question, but found that he is deceased.)&lt;/p&gt;&#xA;&lt;p&gt;Let us also point out that in our 2005 paper &lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.71.052319?casa_token=FE6gQlG-jmsAAAAA%3AG6gZuWiS8AVaTT1v-HjfE7ksrp1bww8pCX4PqAIPGyae4PX6UFFAhPDvY7eOuUVGnVLQSQilpV8pDw&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubit-qutrit ratios&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Theorem 1 of the 2001 paper &lt;a href=&quot;http://cds.cern.ch/record/526006/files/0111051.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;LowRankSeparable&lt;/a&gt;,&#xA;&amp;quot;Low Rank Separable States Are A Set Of Measure Zero Within The Set of Low Rank States&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="55" LastEditDate="2020-09-30T03:52:49.217" LastActivityDate="2020-09-30T03:52:49.217" Title="Is the Hilbert-Schmidt probability simply zero that a generic rank-2 two-qubit (&quot;pseudo-pure&quot;) density matrix is separable?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12874" PostTypeId="2" ParentId="12864" CreationDate="2020-07-13T02:24:53.497" Score="1" Body="&lt;p&gt;What is &amp;quot;a single qubit state&amp;quot; in your question?&lt;/p&gt;&#xA;&lt;p&gt;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),&#xA;then in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12866/12280&quot;&gt;answer&lt;/a&gt; it is already quite explained for this case.&lt;/p&gt;&#xA;&lt;p&gt;If it is a single qubit in a quantum program (circuit) designed to be executed on a &lt;a href=&quot;https://arxiv.org/abs/1801.00862v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;NISQ&lt;/a&gt; computer (or on its simulator),&#xA;then usually such a circuit is run several times (or shots) up to obtain stable results.&#xA;Thus, although one speaks of measuring a single qubit state, each shot a &amp;quot;new&amp;quot; state of the qubit is measured.&#xA;Accordingly, using multiple runs, you can get the orientation (e.g. up/down) in different proportions, which can &amp;quot;encode&amp;quot; various values.&#xA;Also two &amp;quot;encoded&amp;quot; values can be &amp;quot;decoded&amp;quot; from a single qubit, measuring the orientation (up/down) in half the cases, the phase in the other half.&#xA;And more than two values, if measuring this qubit in more then two various basises, for details see e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12280" LastActivityDate="2020-07-13T02:24:53.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12875" PostTypeId="1" AcceptedAnswerId="12876" CreationDate="2020-07-13T05:50:02.953" Score="1" ViewCount="61" Body="&lt;p&gt;Given a qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in \mathcal{H}$&lt;/span&gt;, and two bipartite general mixed states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, such that,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi|\otimes \langle \psi|\rho - \sigma |\psi\rangle \otimes |\psi \rangle \ \leqslant \epsilon$$&lt;/span&gt;&#xA;Now suppose the reduced state of &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt; be such that,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_r = Tr_1(\rho) = Tr_2(\rho), \hspace{5mm} \sigma_r = Tr_1(\sigma) = Tr_2(\sigma)$$&lt;/span&gt;&#xA;Then can we say something about the closeness of the reduced state in terms of epsilon? In other words,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi| \rho_r - \sigma_r|\psi\rangle \leqslant ? $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8748" LastEditorUserId="55" LastEditDate="2020-09-30T03:52:38.953" LastActivityDate="2020-09-30T03:52:38.953" Title="What can be inferred about the closeness of reduced qubit states from the closeness of the bipartite quantum state?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;fidelity&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12876" PostTypeId="2" ParentId="12875" CreationDate="2020-07-13T06:57:36.023" Score="2" Body="&lt;p&gt;No, there's not a lot you can say. Consider these two cases, both with &lt;span class=&quot;math-container&quot;&gt;$\epsilon=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;First, the obvious one, &lt;span class=&quot;math-container&quot;&gt;$\rho=\sigma=|\psi\rangle\langle\psi|\otimes |\psi\rangle\langle\psi|$&lt;/span&gt;. Clearly &lt;span class=&quot;math-container&quot;&gt;$\rho_r-\sigma_r=0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Second, let &lt;span class=&quot;math-container&quot;&gt;$|\psi^\perp\rangle$&lt;/span&gt; be orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. You can have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=(|\psi\rangle\langle\psi|\otimes |\psi^\perp\rangle\langle\psi^\perp|+|\psi^\perp\rangle\langle\psi^\perp|\otimes |\psi\rangle\langle\psi|)/2$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma=|\psi^\perp\rangle\langle\psi^\perp|\otimes |\psi^\perp\rangle\langle\psi^\perp|.$$&lt;/span&gt;&#xA;Now you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi|\rho_r-\sigma_r|\psi\rangle=\frac12,&#xA;$$&lt;/span&gt;&#xA;which is more or less as far away as you can get.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-07-13T07:16:37.803" LastActivityDate="2020-07-13T07:16:37.803" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12877" PostTypeId="2" ParentId="12868" CreationDate="2020-07-13T07:03:53.723" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;More specifically, it's done in a way that &lt;strong&gt;I&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="2293" LastEditDate="2020-07-13T14:20:08.363" LastActivityDate="2020-07-13T14:20:08.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12878" PostTypeId="2" ParentId="12785" CreationDate="2020-07-13T07:10:30.563" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit computation, you need a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;, which you're encoding in a path. In other words, you need &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible paths. So, immediately, you need exponentially scaling resources, meaning that you cannot get a speed-up over classical.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-13T07:10:30.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12879" PostTypeId="1" AcceptedAnswerId="12881" CreationDate="2020-07-13T12:30:45.347" Score="1" ViewCount="54" Body="&lt;p&gt;On page 547 of N&amp;amp;C, for &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle=|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt; and for &lt;span class=&quot;math-container&quot;&gt;$|\tilde{0}\rangle=\cos(\pi/8)|0\rangle+\sin(\pi/8)|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\tilde{1}\rangle=-\sin(\pi/8)|0\rangle + \cos(\pi/8)|1\rangle$&lt;/span&gt;, that &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{0}|\psi_{k}\rangle| = \cos(\pi/8)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{1}|\psi_{k}\rangle| = \sin(\pi/8)$&lt;/span&gt; for k = &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt;. I just don't see how this can be the case for either of them.&lt;/p&gt;&#xA;&lt;p&gt;I get &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi/8)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos(\pi/8)/\sqrt{2}+\sin(\pi/8)\sqrt{2}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{0}|\psi_{k}\rangle|$&lt;/span&gt; and for &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{1}|\psi_{k}\rangle|$&lt;/span&gt; I get &lt;span class=&quot;math-container&quot;&gt;$-\sin(\pi/8)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-\sin(\pi/8)/\sqrt{2}+\cos(\pi/8)/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The inner product only produce these for &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt;. Is this a typo, and what they mean to say is that the inner product &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{0}|\psi_{k}\rangle|$&lt;/span&gt; is much larger than &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{1}|\psi_{k}\rangle|$&lt;/span&gt;. But even in this case, that isn't completely true, as it's only just larger in the case of &lt;span class=&quot;math-container&quot;&gt;$|\langle\tilde{1}|\psi_{k}\rangle|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For context, &lt;span class=&quot;math-container&quot;&gt;$|\tilde{0}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\tilde{1}\rangle$&lt;/span&gt; come from the spectral decomposition of the density operator representing the source that generates &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; with probability a half for each.&lt;/p&gt;&#xA;&lt;p&gt;What am I missing here? It seems like a simple inner product should be used but I can't get their results.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-09-30T03:52:34.857" LastActivityDate="2020-09-30T03:52:34.857" Title="Confused regarding explanation of Schumachers compression in N&amp;C" Tags="&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12881" PostTypeId="2" ParentId="12879" CreationDate="2020-07-13T15:27:04.417" Score="2" Body="&lt;p&gt;You're missing a bit of algebraic trickery. Remember that &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}=\sin(\pi/4)=\cos(\pi/4)$&lt;/span&gt;. Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&#xA;by the double angle formula.&lt;/p&gt;&#xA;&lt;p&gt;Also, be careful of signs. It might be an amplitude is &lt;span class=&quot;math-container&quot;&gt;$\pm\sin(\pi/8)$&lt;/span&gt;, but when you take the modulus, that becomes &lt;span class=&quot;math-container&quot;&gt;$\sin(\pi/8)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-13T15:27:04.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12882" PostTypeId="2" ParentId="12857" CreationDate="2020-07-13T15:41:47.787" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12870/55&quot;&gt;The other answer&lt;/a&gt; already uses this, but just to make the general fact more explicit: if &lt;span class=&quot;math-container&quot;&gt;$\mathcal E=\mathcal E_A\circ\mathcal E_B$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)=\mathcal E_A(\mathcal E_B(\rho))$&lt;/span&gt;, and the Kraus decompositions of the single channels read&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E_A(\rho)=\sum_a A_a\rho A_a^\dagger,&#xA;\qquad \mathcal E_B(\rho)=\sum_b B_b\rho B_b^\dagger,$$&lt;/span&gt;&#xA;then&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)=\sum_{a,b} C_{ab}\rho C_{ab}^\dagger$&lt;/span&gt;,&#xA;where &lt;span class=&quot;math-container&quot;&gt;$C_{ab}\equiv A_a B_b$&lt;/span&gt; are the Kraus operators of the combined channel.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-07-13T15:41:47.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12883" PostTypeId="2" ParentId="12872" CreationDate="2020-07-13T17:19:17.873" Score="2" Body="&lt;p&gt;Apparently, the specific question posed here has been answered in the affirmative--at least (first, we point out) through numerical means--by&#xA;Arsen Khvedelidze and Ilya Rogojin in Table 2 of their 2018 paper,&#xA;&amp;quot;On the Generation of Random Ensembles of Qubits and Qutrits: Computing Separability Probabilities for Fixed Rank States&amp;quot; &lt;a href=&quot;https://www.epj-conferences.org/articles/epjconf/pdf/2018/08/epjconf_mmcp2018_02010.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;ArsenIlya&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;exact value of &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33} \approx 0.24242424...$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{33} \approx 0.121212...$&lt;/span&gt;, based on the application of the noted theorem of Szarek, Bengtsson and Zyczkowski to the &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33}$&lt;/span&gt; assertion.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1751-8113/42/9/095303/pdf?casa_token=Sv55p0Mkb4AAAAAA:28yfcWnF-3EIyuo6akwmIuXVVaAnIbkqiG5-d7tMCYKn0vb-sTppZFOaRpttimhSpy1AOoZ7X9X3Q3gWmTg&quot; rel=&quot;nofollow noreferrer&quot;&gt;RuskaiWerner&lt;/a&gt;. Upon the first submission of this answer, I had not perceived that the specific question posed here was fully addressed there.&lt;/p&gt;&#xA;&lt;p&gt;However, I now see that their&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\bf{Corollary}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;${4}$&lt;/span&gt;. If a state &lt;span class=&quot;math-container&quot;&gt;$\gamma_{AB}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\bf{C}_2 \otimes \bf{C}_2$&lt;/span&gt; has rank 2, then &lt;span class=&quot;math-container&quot;&gt;$γ_{AB}$&lt;/span&gt; is almost surely entangled&lt;/p&gt;&#xA;&lt;p&gt;leads to an affirmative answer to the question put.&lt;/p&gt;&#xA;&lt;p&gt;Also, to similar effect, their&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\bf{Theorem}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\bf{9}$&lt;/span&gt;. Assume &lt;span class=&quot;math-container&quot;&gt;$d_A \geq d_B \geq 2$&lt;/span&gt;. If a state &lt;span class=&quot;math-container&quot;&gt;$\gamma_{AB}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$M_{d_A} \otimes M_{d_B}$&lt;/span&gt; has rank &lt;span class=&quot;math-container&quot;&gt;$\gamma_{AB} \leq d_{A}$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$\gamma_{AB}$&lt;/span&gt; is almost surely entangled.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="3089" LastEditDate="2020-07-14T15:11:05.637" LastActivityDate="2020-07-14T15:11:05.637" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12884" PostTypeId="1" CreationDate="2020-07-13T17:39:21.147" Score="2" ViewCount="158" Body="&lt;p&gt;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 .&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="2752" LastEditorUserId="55" LastEditDate="2020-09-30T03:52:29.497" LastActivityDate="2020-09-30T03:52:29.497" Title="What is the pseudo threshold of a QECC using stabilizer formalism" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;terminology&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12885" PostTypeId="2" ParentId="12846" CreationDate="2020-07-13T18:02:49.880" Score="4" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="9887" LastActivityDate="2020-07-13T18:02:49.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12886" PostTypeId="1" CreationDate="2020-07-13T19:04:08.177" Score="1" ViewCount="104" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12656" LastActivityDate="2020-07-13T22:26:33.427" Title="Can quantum computing help to recover a lost private key?" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12887" PostTypeId="2" ParentId="12859" CreationDate="2020-07-13T19:19:52.187" Score="0" Body="&lt;p&gt;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 &amp;quot;If done on classical can I just tweak a few things and make them quantum?&amp;quot; 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?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="12239" LastEditDate="2020-07-13T19:45:33.830" LastActivityDate="2020-07-13T19:45:33.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12888" PostTypeId="1" AcceptedAnswerId="12889" CreationDate="2020-07-13T19:51:11.843" Score="3" ViewCount="105" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12239" LastEditorUserId="491" LastEditDate="2020-07-17T23:27:17.970" LastActivityDate="2020-09-17T23:10:06.130" Title="Is running a for loop faster on a quantum computer than a classical computer?" Tags="&lt;algorithm&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12889" PostTypeId="2" ParentId="12888" CreationDate="2020-07-13T21:00:40.417" Score="5" Body="&lt;p&gt;No, quantum computers can't run for-loops faster in general.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;for x in range(N): if predicate(x): y = x&lt;/code&gt; with something that uses &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N})$&lt;/span&gt; calls to &lt;code&gt;predicate&lt;/code&gt; instead of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; that the for loop is using.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-07-13T21:00:40.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12890" PostTypeId="2" ParentId="12886" CreationDate="2020-07-13T22:26:33.427" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-07-13T22:26:33.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12891" PostTypeId="2" ParentId="9320" CreationDate="2020-07-14T00:33:06.967" Score="3" Body="&lt;p&gt;Ancilla-free solution: replace the two controlled-SWAPs in the &amp;quot;summary update&amp;quot; of Craig Gidney's solution with controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s between the second and fourth qubits in the diagram, and remove the third qubit.&lt;/p&gt;&#xA;&lt;p&gt;(That is, instead of swapping &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; with a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state stored in the second register, conditioned on &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; being set to 1, conditionally change &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; directly using controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="11984" LastActivityDate="2020-07-14T00:33:06.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12892" PostTypeId="1" CreationDate="2020-07-14T00:45:36.873" Score="5" ViewCount="55" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H = \sum{H_i}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; are products of Pauli Matrices on a subset of the qubits) constructed from the structure of the optimization function &lt;span class=&quot;math-container&quot;&gt;$C(z)$&lt;/span&gt; with respect to some parametrized state &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}\ket{\theta}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\ket{\theta}$&lt;/span&gt; on the computational basis and use the proportions of observed outcomes as the probability of each solution and then evaluating &lt;span class=&quot;math-container&quot;&gt;$C(z)$&lt;/span&gt; on each outcome  (&lt;a href=&quot;https://qiskit.org/textbook/ch-applications/qaoa.html&quot; rel=&quot;noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/qaoa.html&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Wouldn't this procedure be infeasible when &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; grows too big? If anyone knows of other alternatives it would be greatly appreciated&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-07-14T08:49:50.203" LastActivityDate="2020-07-14T08:49:50.203" Title="Computing the expectation values of a Hamiltonian constructed from a cost functions in combinatorial optimization" Tags="&lt;algorithm&gt;&lt;optimization&gt;&lt;dynamics&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12893" PostTypeId="5" CreationDate="2020-07-14T07:02:26.823" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-14T07:02:26.823" LastActivityDate="2020-07-14T07:02:26.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12894" PostTypeId="4" CreationDate="2020-07-14T07:02:26.823" Score="0" Body="For questions about the entanglement measure derived from the PPT separability criterion." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-14T07:02:26.823" LastActivityDate="2020-07-14T07:02:26.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12895" PostTypeId="1" AcceptedAnswerId="12896" CreationDate="2020-07-14T09:46:19.500" Score="1" ViewCount="101" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FFNWH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FFNWH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\qquad$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/BpkgQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BpkgQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\qquad$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/d0TZc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/d0TZc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;" OwnerUserId="12658" LastEditorUserId="491" LastEditDate="2020-07-17T23:24:49.603" LastActivityDate="2020-07-17T23:24:49.603" Title="How does the graphical notation used to denote doubly-controlled gates work?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12896" PostTypeId="2" ParentId="12895" CreationDate="2020-07-14T10:45:15.423" Score="4" Body="&lt;p&gt;The black (white) dot means a condition that the corresponding qubit should be in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state) in order to apply the gate. The first circuit implements the Hadamard gate only if the first qubit is in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and the second qubit is in &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; state (similar discussions can be found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11674/9459&quot;&gt;here&lt;/a&gt;). In other words, if the combined state of the first two qubits is &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate is applied, otherwise, we apply &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; (nothing). Mathematically it looks like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}C_{B}C_{W}\_H =&amp;amp; |00\rangle\langle 00| \otimes I + |01\rangle\langle 01| \otimes I + |10\rangle\langle 10| \otimes H + |11\rangle\langle 11| \otimes I\\ =&amp;amp; |10\rangle\langle 10| \otimes H + (I-|10\rangle\langle 10|)\otimes I,\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C_{B}$&lt;/span&gt; is denoted here as the control with a black dot and &lt;span class=&quot;math-container&quot;&gt;$C_{W}$&lt;/span&gt; is the control with a white dot. By taking this into account the corresponding matrix will look like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_{B}C_{W}\_H = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1/\sqrt{2}&amp;amp;1/\sqrt{2}&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1/\sqrt{2}&amp;amp;-1/\sqrt{2}&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;0&amp;amp;1 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrixes for the other two gates can be constructed in a similar way. Here is an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4255/9459&quot;&gt;answer&lt;/a&gt; about not adjacent controlled gates. Note that for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit gate we will need &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; matrices, so it is not always convenient to use matrices.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="104" LastEditDate="2020-07-14T19:17:34.493" LastActivityDate="2020-07-14T19:17:34.493" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12898" PostTypeId="1" AcceptedAnswerId="12907" CreationDate="2020-07-14T15:27:47.650" Score="1" ViewCount="189" Body="&lt;p&gt;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?)&lt;/p&gt;&#xA;&lt;p&gt;Now suppose we have an answer to the above question, then, how to extend the above circuit to deal with a 5-qubit input?&lt;/p&gt;&#xA;" OwnerUserId="12662" LastEditorUserId="491" LastEditDate="2020-07-17T23:32:00.740" LastActivityDate="2020-07-17T23:32:00.740" Title="How to construct quantum circuit to count number of 0-qubits and 1-qubits" Tags="&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12899" PostTypeId="1" AcceptedAnswerId="12900" CreationDate="2020-07-14T17:55:39.160" Score="2" ViewCount="50" Body="&lt;p&gt;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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/DTXHg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DTXHg.png&quot; alt=&quot;Simple circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&amp;gt; -&amp;gt; |11111&amp;gt; which is bizare. I'm very new to quantum computing - could someone explain me why there is visible such strong linear dependence?&#xA;Or maybe this is expected, but why?&lt;/p&gt;&#xA;&lt;p&gt;What I tried up til now:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I've tried to change measurment order and using/not using barrier before measurements. Everything was calculated on ibmq_burlington mashine.&lt;/li&gt;&#xA;&lt;li&gt;I've also tried error mitigation (CompleteMeasFitter prepared and applied to results, with no luck - as before I can see a strong linear relation).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9Qk6U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Qk6U.png&quot; alt=&quot;Histogram&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can anybody help me to understand this behaviour?&lt;/p&gt;&#xA;&lt;p&gt;Regards&#xA;Konrad&lt;/p&gt;&#xA;" OwnerUserId="12664" LastEditorUserId="2293" LastEditDate="2020-08-17T02:54:16.597" LastActivityDate="2020-08-17T02:54:16.597" Title="Randomness using simple parallel Hadamard circuit" Tags="&lt;measurement&gt;&lt;hadamard&gt;&lt;random-quantum-circuit&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12900" PostTypeId="2" ParentId="12899" CreationDate="2020-07-14T19:04:47.417" Score="5" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;It's difficult to say for sure &lt;em&gt;exactly&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-07-14T19:04:47.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12901" PostTypeId="1" AcceptedAnswerId="12909" CreationDate="2020-07-14T19:21:55.230" Score="2" ViewCount="143" Body="&lt;p&gt;In the textbook “Quantum Computation and Quantum Information” by Nielsen and Chuang, it is stated that there exists a set of unitaries &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; and a probability distribution &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; for &lt;strong&gt;any&lt;/strong&gt; matrix A,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_i p_i U_i A U_i^\dagger =tr(A) I/d,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12665" LastEditorUserId="55" LastEditDate="2020-09-30T03:52:06.767" LastActivityDate="2020-10-02T09:27:51.490" Title="Can a Kraus representation act as the identity on any operator?" Tags="&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;&lt;kraus-representation&gt;" AnswerCount="4" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12902" PostTypeId="1" CreationDate="2020-07-14T20:26:42.033" Score="3" ViewCount="158" Body="&lt;p&gt;I am trying to use the method of calculating the expectation values of Pauli operators in Qiskit which I found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12080/evaluating-expectation-values-of-operators-in-qiskit&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, the results obtained via IBMQ sampling differ significantly from the exact value, even though I perform measurement error mitigation.&lt;/p&gt;&#xA;&lt;p&gt;The state, in which I am trying to calculate the expectation values, is prepared using a simple circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;          ┌─────────────┐                   ┌───┐                     &#xA;q_0: ─────┤ RY(-1.8018) ├──■────────■───────┤ X ├────────────────────&#xA;     ┌───┐└──────┬──────┘┌─┴─┐      │       └─┬─┘                    &#xA;q_1: ┤ X ├───────■───────┤ X ├──────┼─────────┼──────────────────────&#xA;     └───┘               └───┘┌─────┴──────┐  │                 ┌───┐&#xA;q_2: ─────────────────────────┤ RY(2.2489) ├──■─────────■───────┤ X ├&#xA;                              └────────────┘     ┌──────┴──────┐└─┬─┘&#xA;q_3: ────────────────────────────────────────────┤ RY(0.99778) ├──■──&#xA;                                                 └─────────────┘     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which after transpiling looks as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UO4XZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UO4XZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For reference, for each Pauli operator I print the exact expectation value and also calculate it a few times using the QASM simulator.&lt;/p&gt;&#xA;&lt;p&gt;Here's the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(4)&#xA;circuit.x(1)&#xA;circuit.cry(-1.80184863, 1, 0)&#xA;circuit.cx(0,1)&#xA;circuit.cry(2.24892942,0,2)&#xA;circuit.cx(2,0)&#xA;circuit.cry(0.9977846,2,3)&#xA;circuit.cx(3,2)&#xA;psi = CircuitStateFn( circuit )&#xA;    &#xA;paulis = [ Pauli([1,1,0,0],[1,1,0,0]),  Pauli([1,1,1,1],[1,0,0,1]) ]&#xA;shots = 8000&#xA;reps = 3   &#xA;&#xA;backend_qasm = qiskit.Aer.get_backend( 'qasm_simulator' )&#xA;q_instance_qasm = QuantumInstance( backend_qasm, shots = shots )&#xA;    &#xA;load_account()&#xA;provider = get_provider( hub='ibm-q' )&#xA;backend_ibmq = least_busy( provider.backends(filters=lambda x: x.configuration().n_qubits &amp;gt;= 4 and not x.configuration().simulator) )&#xA;q_instance_ibmq = QuantumInstance( backend = backend_ibmq,&#xA;                                   shots = shots,&#xA;                                   measurement_error_mitigation_cls = CompleteMeasFitter,&#xA;                                   measurement_error_mitigation_shots = shots )&#xA;print(f'IBMQ backend: {backend_ibmq}.\n')     &#xA;&#xA;for pauli in paulis:&#xA;    print(f'Pauli operator: {pauli}.')&#xA;    pauli = WeightedPauliOperator([[1., pauli]]).to_opflow()&#xA;&#xA;    measurable_expression = StateFn( pauli, is_measurement = True ).compose( psi )&#xA;    expectation = PauliExpectation().convert( measurable_expression )&#xA;&#xA;    expect_exact = psi.adjoint().compose( pauli ).compose( psi ).eval().real&#xA;&#xA;    print( f'Exact expectation value: {expect_exact}.' )&#xA;    for r in range(reps):&#xA;        sampler_qasm = CircuitSampler( q_instance_qasm ).convert( expectation )&#xA;        expect_sampling_qasm = sampler_qasm.eval().real&#xA;        print( f'Exact expectation, QASM sampling: {expect_sampling_qasm}.' )&#xA;    for r in range( reps ):&#xA;        sampler_ibmq = CircuitSampler( q_instance_ibmq ).convert( expectation )&#xA;        expect_sampling_ibmq = sampler_ibmq.eval().real&#xA;        print( f'Exact expectation, IBMQ sampling: {expect_sampling_ibmq}.' )&#xA;&#xA;    print()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And here's the output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ backend: ibmq_ourense.&#xA;&#xA;Pauli operator: IIYY.&#xA;WARNING - The skip Qobj validation does not work for IBMQ provider. Disable it.&#xA;Exact expectation value: -0.4201884924852.&#xA;Exact expectation, QASM sampling: -0.42275.&#xA;Exact expectation, QASM sampling: -0.4175.&#xA;Exact expectation, QASM sampling: -0.4165.&#xA;Exact expectation, IBMQ sampling: -0.19053720838213.&#xA;Exact expectation, IBMQ sampling: -0.33771371840093.&#xA;Exact expectation, IBMQ sampling: 0.14870401826006.&#xA;&#xA;Pauli operator: YZZY.&#xA;Exact expectation value: 0.22895884311365.&#xA;Exact expectation, QASM sampling: 0.237.&#xA;Exact expectation, QASM sampling: 0.2385.&#xA;Exact expectation, QASM sampling: 0.2345.&#xA;Exact expectation, IBMQ sampling: 0.06862734682344.&#xA;Exact expectation, IBMQ sampling: 0.10246703115813.&#xA;Exact expectation, IBMQ sampling: 0.13078427261863.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Am I doing something conceptually wrong?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Any thoughts/suggestions/corrections greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="8008" LastEditorUserId="2293" LastEditDate="2020-08-17T02:54:04.670" LastActivityDate="2020-08-17T02:54:04.670" Title="Am I doing anything wrong when trying to calculate the expectation value in Qiskit on the real hardware?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12903" PostTypeId="1" CreationDate="2020-07-15T01:27:29.673" Score="1" ViewCount="29" Body="&lt;p&gt;In the Qiskit &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="8405" LastEditorUserId="491" LastEditDate="2020-07-17T23:24:23.433" LastActivityDate="2020-07-17T23:24:23.433" Title="In quantum teleportation what is the need for the extra X/Z gate after classical information is sent from Alice to Bob?" Tags="&lt;teleportation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12904" PostTypeId="2" ParentId="12901" CreationDate="2020-07-15T03:06:51.403" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{ U_{j} \}$&lt;/span&gt;. In particular, there exists a choice such that their action is to ``coarse-grain'' all the information in a state.&lt;/p&gt;&#xA;&lt;p&gt;Here's a single qubit example to illustrate my point: consider the set &lt;span class=&quot;math-container&quot;&gt;$p_{j} = \frac{1}{4}, U_{j} = \sigma_{j}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$j \in \{ 1,2,3,4 \}$&lt;/span&gt;, where, &lt;span class=&quot;math-container&quot;&gt;$\sigma_{j}$&lt;/span&gt; are the Pauli matrices (with &lt;span class=&quot;math-container&quot;&gt;$\sigma_{0} = \mathbb{I}$&lt;/span&gt;). Then, its action on a single qubit is,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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},$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$\cdots$&lt;/span&gt; can be evaluated using the anticommutativity of the Pauli matrices (Hint: use the relation &lt;span class=&quot;math-container&quot;&gt;$\sigma_{j} \sigma_{k} \sigma_{j} = - \sigma_{k}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$j \neq k$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Now, since any matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$A = H + iK$&lt;/span&gt; for hermitian matrices &lt;span class=&quot;math-container&quot;&gt;$H,K$&lt;/span&gt;; and any hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$H = H_{1} - H_{2}$&lt;/span&gt; for positive semidefinite matrices, you can write &lt;span class=&quot;math-container&quot;&gt;$A  = H_{1} - H_{2} + i(K_{1} - K_{2})$&lt;/span&gt;. Rewriting each of the matrices as &lt;span class=&quot;math-container&quot;&gt;$H_{1} = \operatorname{Tr}\left( H_{1} \right) (\frac{1}{\operatorname{Tr}\left( H_{1} \right)} H_{1})$&lt;/span&gt;, we have that &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\operatorname{Tr}\left( H_{1} \right)} H_{1}$&lt;/span&gt; is a density matrix and so the above result applies. Continuing this, you'll find, using the linearity of trace, that for the &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; case, the above unitaries give you &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(A) \frac{\mathbb{I}}{d}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The generalization to &lt;span class=&quot;math-container&quot;&gt;$n \times n$&lt;/span&gt; matrices is left as an exercise to the OP (where you need to find a set of unitaries analogous to the Pauli matrices).&lt;/p&gt;&#xA;&lt;p&gt;Edit: One way to obtain the result in &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensions is to use the &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heisenberg-Weyl operators&lt;/a&gt; (or the finite dimensional representation of the Heisenberg-Weyl algebra). If &lt;span class=&quot;math-container&quot;&gt;$X(i)Z(j)$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt;th operator then, we have, &lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;. See, for example, Page 176 of &lt;a href=&quot;https://arxiv.org/abs/1106.1445&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-07-18T00:53:34.743" LastActivityDate="2020-07-18T00:53:34.743" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12905" PostTypeId="2" ParentId="12903" CreationDate="2020-07-15T03:49:56.893" Score="2" Body="&lt;p&gt;Without that fixup, the state of Bob's qubit can be in any one of the states &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; (the state we actually wanted to teleport) or &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle - \beta |1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta |0\rangle + \alpha |1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\beta |0\rangle - \alpha |1\rangle$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; - otherwise we can't count our teleportation a a success.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-07-15T03:49:56.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12906" PostTypeId="1" AcceptedAnswerId="12908" CreationDate="2020-07-15T06:40:04.323" Score="1" ViewCount="67" Body="&lt;p&gt;If I know a sparse matrix, is there any tool that allows me to get the corresponding quantum circuit directly?&lt;/p&gt;&#xA;&lt;p&gt;If not what should I do?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;I'm new in this field.&lt;/p&gt;&#xA;&lt;p&gt;Need your help&lt;/p&gt;&#xA;" OwnerUserId="12658" LastEditorUserId="491" LastEditDate="2020-07-17T23:31:11.950" LastActivityDate="2020-07-17T23:31:11.950" Title="Is there a tool to get the quantum circuit corresponding to a sparse matrix?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12907" PostTypeId="2" ParentId="12898" CreationDate="2020-07-15T07:32:17.467" Score="3" Body="&lt;p&gt;Here's a general strategy that doesn't quite fulfil the brief: for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit input where &lt;span class=&quot;math-container&quot;&gt;$n+1=2^k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; an integer (e.g. &lt;span class=&quot;math-container&quot;&gt;$n=3,k=2$&lt;/span&gt;), it uses &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; ancilla qubits but no Toffolis. (You can do something similar if &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; 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!)&lt;/p&gt;&#xA;&lt;p&gt;The idea is to define a Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\left(\sum_{j=1}^nZ_j+nI\right)/2.&#xA;$$&lt;/span&gt;&#xA;Note that this has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0,1,2,3,\ldots,n$&lt;/span&gt; corresponding to the number of 1s in the string it's acting on. So, let &lt;span class=&quot;math-container&quot;&gt;$U=e^{2i\pi H/2^k}$&lt;/span&gt;. This is a unitary with the eigenvectors that we need. If you run a phase estimation procedure using &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; ancilla qubits, it will exactly read out the number of 1s for you. This requires controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;So, once you know who many 1s there are, you can classically process that to decide if it's greater than &lt;span class=&quot;math-container&quot;&gt;$n/2$&lt;/span&gt;. In the case of &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; 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 &lt;em&gt;last&lt;/em&gt; bit output by the Fourier transform, not the first).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-15T07:32:17.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12908" PostTypeId="2" ParentId="12906" CreationDate="2020-07-15T08:22:13.070" Score="1" Body="&lt;p&gt;Concerning Hamiltonian simulation, you can find very useful guide in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5567/circuit-construction-for-hamiltonian-simulation&quot;&gt;this question&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;General approach to quantum circuit construction is explained in paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elementary gates for quantum computation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0308006&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal Quantum Circuits for General Two-Qubit Gates&lt;/a&gt; can be helpful.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-15T08:22:13.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12909" PostTypeId="2" ParentId="12901" CreationDate="2020-07-15T09:05:18.230" Score="1" Body="&lt;p&gt;(&lt;em&gt;&lt;strong&gt;General result&lt;/strong&gt;&lt;/em&gt;) The main thing to keep in mind is that this is a result about &lt;em&gt;a type of channel&lt;/em&gt;, not about specific states. Suppose &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(U_i U_j^\dagger)=\delta_{ij}$&lt;/span&gt; for some set of matrices &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;.&#xA;This is equivalent to &lt;span class=&quot;math-container&quot;&gt;$\sum_{k\ell}(U_i)_{k\ell} (U_j^*)_{k\ell}=\delta_{ij}$&lt;/span&gt;.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; form a basis (&lt;em&gt;i.e.&lt;/em&gt; there are &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; of them), then we must also have&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sum_i (U_i)_{k\ell} (U_i^*)_{mn}=\delta_{km}\delta_{\ell n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For such choice of matrices we have, for &lt;em&gt;any&lt;/em&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_i U_i \rho U_i^\dagger&#xA;= \sum_{ijk \ell m} \lvert j\rangle\!\langle k\rvert\,\, (U_i)_{j\ell}(U_i^*)_{km} \rho_{\ell m}&#xA;= \sum_{jk\ell m} \lvert j\rangle\!\langle k\rvert\,\, \delta_{jk} \delta_{\ell m}\rho_{\ell m}&#xA;\\= \sum_{j\ell} \lvert j\rangle\!\langle j\rvert \,\, \rho_{\ell\ell} = \operatorname{tr}(\rho) I. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice how the identity does not depend on what &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is. It can be an arbitrary operator. You can test it yourself with a nondiagonalisable matrix such as &lt;span class=&quot;math-container&quot;&gt;$\rho=\begin{pmatrix}0&amp;amp;1\\0&amp;amp;0\end{pmatrix}$&lt;/span&gt;. It is a statement about the mapping &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto \sum_i U_i \rho U_i^\dagger$&lt;/span&gt;, not about &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notice also that I did not use any assumption on the &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;. They need not be unitaries (indeed, they &lt;em&gt;cannot&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(U_i U_j^\dagger)=\delta_{ij}/d$&lt;/span&gt;, and the rest follows.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Representations of the completely depolarising channel&lt;/strong&gt;&lt;/em&gt;)&#xA;Consider the linear map &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\operatorname{tr}(X) I/d$&lt;/span&gt;. You can verify that it is a CPTP map and thus admits a Kraus decomposition.&lt;/p&gt;&#xA;&lt;p&gt;Its natural representation reads &lt;span class=&quot;math-container&quot;&gt;$\Phi_{i|j}^{k|\ell}=K(\Phi)_{ij,k\ell}=\delta_{k\ell}\delta_{ij}/d=\lvert m\rangle\!\langle m\rvert$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|m\rangle$&lt;/span&gt; a maximally entangled state.&#xA;The Kraus decomposition is then obtained as the spectral decomposition of the operator mapping &lt;span class=&quot;math-container&quot;&gt;$j\ell$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$ik$&lt;/span&gt;. Stated more precisely, we need the spectral decomposition of the Choi operator &lt;span class=&quot;math-container&quot;&gt;$$J(\Phi)\equiv (\Phi\otimes I)\lvert m\rangle\!\langle m\rvert=\frac1 d I\otimes I\equiv I/d.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The eigendecomposition of this operator is trivial: its eigenvalues are all equal to &lt;span class=&quot;math-container&quot;&gt;$1/d$&lt;/span&gt;, thus any orthonormal set of vectors will be a suitable set of eigenvectors. Write these as &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{\boldsymbol{#1}} \{\bs v_a\}_a$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\bs v_a=\frac1 d \bs v_a$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$a=1,...,d^2$&lt;/span&gt;.&#xA;In terms of the natural representation, these satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{j\ell} K(\Phi)_{ij,k\ell}(\bs v_a)_{j\ell} = \frac1 d(\bs v_a)_{ik}&#xA;\Longleftrightarrow K(\Phi) = \frac1 d \sum_a \bs v_a \otimes \bs v_a^\dagger.$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K(\Phi)_{ij,k\ell}=\frac1 d\sum_a (\bs v_a)_{ik}(\bs v_a^*)_{j\ell}.$$&lt;/span&gt;&#xA;Defining the operators &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$(A_a)_{ij}\equiv (\bs v_a)_{ij}$&lt;/span&gt; we thus get the Kraus decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$\Phi(X) = \sum_a A_a X A_a^\dagger. $&lt;/span&gt;&#xA;Note that the orthogonality of the vectors &lt;span class=&quot;math-container&quot;&gt;$\bs v_a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle \bs v_a,\bs v_b\rangle=\delta_{ab}$&lt;/span&gt;, translates into the orthogonality of the matrices &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$L_2$&lt;/span&gt; norm: &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(A_a A_b^\dagger)=\delta_{ab}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Result from Kraus representation&lt;/strong&gt;&lt;/em&gt;) This proves that, for any set of matrices &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{tr}(A_a A_b^\dagger)=\delta_{ab}$&lt;/span&gt;, we have for &lt;em&gt;all&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac1 d\sum_a A_a X A_a^\dagger= \operatorname{tr}(X) \frac I d.$$&lt;/span&gt;&#xA;Of course, we already showed this in the first paragraph. This is just a different angle to get to the same result.&lt;/p&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Finding Kraus decompositions made up of unitaries&lt;/strong&gt;&lt;/em&gt;) In the above, &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; are not unitaries. However, the freedom in the choice of vectors &lt;span class=&quot;math-container&quot;&gt;$\bs v_a$&lt;/span&gt;, or equivalently the freedom in the choice of &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt;, can be used to find a decomposition in terms of Kraus operators that are (proportional to) unitaries.&#xA;A basis of unitaries can be constructed &lt;em&gt;e.g.&lt;/em&gt; using &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;clock and shift matrices&lt;/a&gt;. Have a look at (&lt;a href=&quot;https://arxiv.org/abs/1004.3348&quot; rel=&quot;nofollow noreferrer&quot;&gt;Durt 2010&lt;/a&gt;), around page 10, and &lt;a href=&quot;https://www.reed.edu/physics/faculty/wheeler/documents/Miscellaneous%20Math/Unitary%20Bases.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these nice notes by Wheeler&lt;/a&gt; (pdf alert), around page 12.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-17T08:18:46.740" LastActivityDate="2020-07-17T08:18:46.740" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12910" PostTypeId="2" ParentId="12901" CreationDate="2020-07-15T09:38:41.560" Score="2" Body="&lt;p&gt;If it holds for hermitian matrices, it holds for all matrices due to linearity: Over &lt;span class=&quot;math-container&quot;&gt;$\mathbb C$&lt;/span&gt;, the hermitian matrices span the full matrix space.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-07-15T09:38:41.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12912" PostTypeId="2" ParentId="12902" CreationDate="2020-07-15T14:10:38.500" Score="3" Body="&lt;p&gt;I tried to run your code with the same backend as you, &lt;code&gt;ibmq_ourense&lt;/code&gt;, and also got the same kind of bad results. Although, I also tried on other backends, first the &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt; 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 &lt;code&gt;ibmq_vigo&lt;/code&gt;, which has a better quantum volume than &lt;code&gt;ibmq_ourense&lt;/code&gt;(16 vs 8), and I got much better results, closer to the exact expected value.&lt;/p&gt;&#xA;&lt;p&gt;You could try the &amp;quot;obvious ways&amp;quot; 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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.compiler.transpile.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the documentation&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a tutorial from Qiskit&lt;/a&gt; to check how you can play with this!&lt;br /&gt;&#xA;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!&lt;/p&gt;&#xA;&lt;p&gt;Hope this will help you, feel free to ask any other thing :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-15T14:10:38.500" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12913" PostTypeId="1" CreationDate="2020-07-15T14:43:17.730" Score="3" ViewCount="75" Body="&lt;p&gt;Given the state of a system as &lt;span class=&quot;math-container&quot;&gt;$\rho_s$&lt;/span&gt; and that of the ancilla (pointer) as &lt;span class=&quot;math-container&quot;&gt;$\rho_a$&lt;/span&gt;, the Von-Neumann measurement involves entangling a system with ancilla and then performing a projective measurement on the ancilla. This is often represented as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[\mathcal{I} \otimes P_i] U(\rho_s \otimes \rho_a)U^{-1} [\mathcal{I} \otimes P_i],$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{I}$&lt;/span&gt; is the identity on system space, &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; is the projector corresponding to &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th outcome, and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the combined unitary.&lt;/p&gt;&#xA;&lt;p&gt;My question: How to choose the form of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="491" LastEditDate="2020-07-17T23:21:25.887" LastActivityDate="2020-07-18T11:15:46.660" Title="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$?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;unitarity&gt;&lt;textbook-and-exercises&gt;&lt;projection-operator&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12914" PostTypeId="1" AcceptedAnswerId="12915" CreationDate="2020-07-15T18:47:33.153" Score="3" ViewCount="42" Body="&lt;p&gt;Is there any relation between the Wigner quasi-probability distribution function &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; and the statistical second-moment (also known as covariance matrix) of a density matrix of a continuous variable state, such as Gaussian state?&lt;/p&gt;&#xA;" OwnerUserId="10371" LastEditorUserId="55" LastEditDate="2020-07-16T09:22:04.090" LastActivityDate="2020-07-16T09:22:04.090" Title="Relation between Wigner quasi-probabability distribution and statistical second-moment" Tags="&lt;density-matrix&gt;&lt;continuous-variable&gt;&lt;quantum-optics&gt;&lt;wigner-function&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12915" PostTypeId="2" ParentId="12914" CreationDate="2020-07-15T19:36:14.813" Score="3" Body="&lt;p&gt;You mean something like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}})},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$W_{G}(\mathbf{r})$&lt;/span&gt; is the Wigner function corresponding to a Gaussian state, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{\sigma}$&lt;/span&gt; its covariance matrix, and &lt;span class=&quot;math-container&quot;&gt;$\overline{r}$&lt;/span&gt; the vector of first moments?&lt;/p&gt;&#xA;&lt;p&gt;If yes, then, see, for example, Eqn. (4.50) of &lt;a href=&quot;https://www.google.com/books/edition/_/bMItDwAAQBAJ?hl=en&amp;amp;gbpv=1&amp;amp;pg=PA1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Continuous Variables&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-15T19:36:14.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12916" PostTypeId="1" AcceptedAnswerId="16296" CreationDate="2020-07-15T22:50:38.083" Score="8" ViewCount="221" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is simple:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;[edit2]: Actually to be safe we should reflect signal at &lt;strong&gt;all frequencies&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2021-03-02T09:28:22.603" LastActivityDate="2021-04-16T21:05:33.147" Title="Why attenuator and not filters for QC driving line" Tags="&lt;physical-realization&gt;&lt;noise&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12917" PostTypeId="1" CreationDate="2020-07-15T23:29:21.843" Score="5" ViewCount="182" Body="&lt;p&gt;Given a quantum channel (CPTP map) &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathcal X\to\mathcal Y$&lt;/span&gt;, its &lt;em&gt;adjoint&lt;/em&gt; is the CPTP map &lt;span class=&quot;math-container&quot;&gt;$\Phi^\dagger:\mathcal Y\to\mathcal X$&lt;/span&gt; such that, for all &lt;span class=&quot;math-container&quot;&gt;$X\in\mathcal X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y\in\mathcal Y$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle Y,\Phi(X)\rangle= \langle \Phi^\dagger(Y),X\rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\tr}{\operatorname{tr}}\langle X,Y\rangle\equiv \tr(X^\dagger Y)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, if &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is the &lt;em&gt;trace map&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\tr(X)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\Phi^\dagger(\alpha)=\alpha I$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\alpha\in\mathbb C$&lt;/span&gt;, as follows from&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle \alpha,\Phi(Y)\rangle = \tr(Y) \alpha^* = \langle \Phi^\dagger(\alpha),Y\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Another example is the &lt;em&gt;partial trace&lt;/em&gt; map. If &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)\equiv\tr_2(X)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\Phi^\dagger(Y)=Y\otimes I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there any general physical interpretation for the adjoint channel?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-16T15:37:02.510" LastActivityDate="2020-07-16T23:39:43.583" Title="What does the adjoint of a channel represent physically?" Tags="&lt;quantum-operation&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12918" PostTypeId="1" AcceptedAnswerId="12920" CreationDate="2020-07-16T05:57:26.533" Score="2" ViewCount="88" Body="&lt;p&gt;I found an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11356/12416&quot;&gt;answer&lt;/a&gt; that shows how to detect the phase in cases like &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; for circuit to prepare state as H P, where P is a phase gate like &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$U1(\pi/8)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But in my case the circuit to prepare state is &lt;span class=&quot;math-container&quot;&gt;$X H P$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate (conditionally phase &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;) or &lt;span class=&quot;math-container&quot;&gt;$ID$&lt;/span&gt; (conditionally phase 0).&lt;/p&gt;&#xA;&lt;p&gt;This circuit in Qasm with conditionally phase equal to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;x q[0];&#xA;h q[0];&#xA;x q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;with conditionally phase equal to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;x q[0];&#xA;h q[0];&#xA;id q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Appending &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate (as in the above answer) don't detect a difference for conditionally phase &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; and phase &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; (but does detect for phases &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\pi/8$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U1(\pi/8)$&lt;/span&gt;, respectively).&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to detect the conditionally phase &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; or 0 for this circuit to prepare state?&lt;/p&gt;&#xA;" OwnerUserId="12416" LastEditorUserId="491" LastEditDate="2020-07-17T23:40:42.133" LastActivityDate="2020-07-17T23:40:42.133" Title="Is it possible to detect the phase $\pi$ or 0 for the single qubit circuit X H P?" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;measurement&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12919" PostTypeId="1" CreationDate="2020-07-16T06:47:29.600" Score="1" ViewCount="73" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12676" LastEditorUserId="55" LastEditDate="2020-07-20T12:36:19.950" LastActivityDate="2020-07-20T12:36:19.950" Title="How do you turn the CX gate upside down on ibm-q-experience?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12920" PostTypeId="2" ParentId="12918" CreationDate="2020-07-16T06:58:05.067" Score="1" Body="&lt;p&gt;I think unlike the relative phase in the answer you reference, it is a global phase in your case:&lt;/p&gt;&#xA;&lt;p&gt;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].&#xA;These states are differ by a global phase &lt;span class=&quot;math-container&quot;&gt;${e}^{i\pi}=-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But the global phase is undetectable &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html#Single-Qubit-Quantum-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$|ψ⟩:={e}^{iδ}|ψ⟩$&lt;/span&gt;&lt;/a&gt;, also see the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9630/12416&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12280" LastEditorUserId="12280" LastEditDate="2020-07-16T15:41:00.553" LastActivityDate="2020-07-16T15:41:00.553" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12921" PostTypeId="2" ParentId="12919" CreationDate="2020-07-16T06:59:25.300" Score="5" Body="&lt;p&gt;If you click the CX gate itself, it will be surrounded by a dashed box with a pen symbol in the top right corner.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VFILS.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VFILS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you click this pen you can choose which qubit is the target and which is the control by drag-and-drop.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/O6bcH.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O6bcH.png&quot; alt=&quot;dd pi&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-07-16T06:59:25.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12922" PostTypeId="1" CreationDate="2020-07-16T08:08:39.267" Score="5" ViewCount="39" Body="&lt;p&gt;Suppose you are given two circuit descriptions &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and the circuit is measured in the computational basis).&lt;/p&gt;&#xA;&lt;p&gt;Are there techniques to check from the circuit descriptions &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; that the sampled output probability distributions induced by the computational basis measurements are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;a) equal&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;b) more interesting to me: &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-close in total variation distance&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Even more ambitious, are there results about the complexity of this task? Are there such results for classical boolean circuits?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt;, then it is known that operator norm errors &lt;span class=&quot;math-container&quot;&gt;$||U_j-V_j||=\epsilon_j$&lt;/span&gt; of the individual gates just add up.&lt;/p&gt;&#xA;&lt;p&gt;A &amp;quot;brute-force&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="5322" LastEditorUserId="5322" LastEditDate="2020-07-16T09:07:48.993" LastActivityDate="2020-07-16T09:07:48.993" Title="Equivalence checking of quantum circuits up to error" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;complexity-theory&gt;&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12923" PostTypeId="1" CreationDate="2020-07-16T10:49:01.013" Score="2" ViewCount="47" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;I want to define the following multiplication rules over &lt;span class=&quot;math-container&quot;&gt;$\Bbb{C}^{2n}$&lt;/span&gt; with standard basis vectors &lt;span class=&quot;math-container&quot;&gt;$e_j$&lt;/span&gt; via &lt;span class=&quot;math-container&quot;&gt;$$e_j^2=0 \text{ and the anti-commutation rule } e_ie_j+e_je_i=0$$&lt;/span&gt;&#xA;I then plan on defining an exponential function of quadratic terms in these basis vectors in a way that respects the relations above, ie &lt;span class=&quot;math-container&quot;&gt;$\exp{(ie_ae_b)}$&lt;/span&gt;, via the power series definition.&lt;/p&gt;&#xA;&lt;p&gt;I would be very grateful for any suggestions on how to program this!&lt;/p&gt;&#xA;" OwnerUserId="12678" LastActivityDate="2020-07-16T10:49:01.013" Title="Defining a Grassmann Algebra in Python" Tags="&lt;programming&gt;&lt;clifford-group&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12924" PostTypeId="2" ParentId="12769" CreationDate="2020-07-16T13:23:19.623" Score="3" Body="&lt;p&gt;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).&#xA;You can easily create &lt;strong&gt;Oracle&lt;/strong&gt; from a thruthtable or logical expression.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; from qiskit import *&#xA; import matplotlib.pyplot as plt&#xA; from qiskit.aqua import QuantumInstance&#xA; from qiskit.aqua.algorithms import BernsteinVazirani&#xA; from qiskit.aqua.components.oracles import TruthTableOracle, LogicalExpressionOracle&#xA;&#xA; # Set the secret number &#xA; s='110111' # The secret number&#xA; # Create the thruthTable. &#xA; truth_table_str=''&#xA; print('The Truthtable corresponding to the oracle is:','\n')&#xA; for i in range(2**len(s)):&#xA;    var=sum(list(map(int, list(bin(int(s,2) &amp;amp; i)[2:])))) % 2&#xA;    print('s.',format(i, '0{}b'.format(len(s))) ,var)&#xA;    truth_table_str += str(var)&#xA;&#xA; # Pass the bistring of the oracle in the TruthTable oracle function with optimization=True to generate the oracle circuit&#xA; oracle = TruthTableOracle(truth_table_str, optimization=True, mct_mode='advanced')&#xA;&#xA; # Set the backend to qasm_simulator&#xA; backend = Aer.get_backend('qasm_simulator')&#xA;&#xA; # Create the BernsteinVazirani circuit&#xA; bv = BernsteinVazirani(oracle, backend)&#xA;&#xA; # you can draw the overall circuit &#xA; full_circuit = bv.construct_circuit(measurement=True)&#xA; full_circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ejKMo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ejKMo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9934" LastActivityDate="2020-07-16T13:23:19.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12925" PostTypeId="1" CreationDate="2020-07-16T16:39:11.797" Score="2" ViewCount="127" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\rangle=\frac{1}{\sqrt{2}} ( |0\rangle+ |1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|-\rangle=\frac{1}{\sqrt{2}} ( |0\rangle- |1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is divided by &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} $&lt;/span&gt; ?&lt;/li&gt;&#xA;&lt;li&gt;What does this symbol mean &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;? I understand what  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; means.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12682" LastEditorUserId="491" LastEditDate="2020-07-17T23:21:09.143" LastActivityDate="2020-07-18T07:02:56.587" Title="Why do we divide by $\sqrt2$ in the qubit states $\lvert\pm\rangle=\frac{1}{\sqrt2}(\lvert0\rangle\pm\lvert1\rangle)$?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12926" PostTypeId="2" ParentId="12925" CreationDate="2020-07-16T17:03:35.513" Score="4" Body="&lt;p&gt;#1: the &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt; is a normalization which ensures that the ``length'' of the vector is one.&lt;/p&gt;&#xA;&lt;p&gt;#2: The notation &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; is just a label for the two states defined above. Since the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt; are elements of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Vector_space&quot; rel=&quot;nofollow noreferrer&quot;&gt;vector space&lt;/a&gt;, you can take linear combinations and therefore construct the states &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-16T17:03:35.513" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12927" PostTypeId="2" ParentId="12917" CreationDate="2020-07-16T21:35:55.623" Score="7" Body="&lt;p&gt;The adjoint of a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; represents how &lt;em&gt;observables&lt;/em&gt; transform (in the Heisenburg picture), under the physical process for which &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is the description of how &lt;em&gt;states&lt;/em&gt; transform (in the Schrödinger picture). So, in particular, the expected value of a measurement of the observable &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; on a state &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)$&lt;/span&gt; is equivalent to the expected value of the observable &lt;span class=&quot;math-container&quot;&gt;$\Phi^\dagger(E)$&lt;/span&gt; on the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2020-07-16T21:35:55.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12928" PostTypeId="1" CreationDate="2020-07-16T21:58:23.633" Score="5" ViewCount="217" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="8214" LastEditorUserId="8214" LastEditDate="2020-07-19T18:32:57.797" LastActivityDate="2020-07-22T08:45:49.903" Title="Is communication possible with entanglement?" Tags="&lt;entanglement&gt;&lt;teleportation&gt;&lt;communication&gt;&lt;faster-than-light&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12929" PostTypeId="1" AcceptedAnswerId="12934" CreationDate="2020-07-16T22:00:37.603" Score="1" ViewCount="63" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/0704.3942.pdf&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;page 18&quot;&gt;&amp;quot;SEPARABILITY CRITERION FOR MULTIPARTITE QUANTUM STATES BASED ON THE BLOCH REPRESENTATION OF DENSITY MATRICES&amp;quot;&lt;/a&gt; by Hassan and Joag, I found this remarkable thing about entanglement of mixed GHZ states, saying:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We consider [a] &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{noisy}^{N} = \frac{1-p}{2^N}I + p|\psi\rangle\langle\psi|, 0\le p\le1 $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit ... GHZ state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hskip2.0in$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/hRhgfm.png&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;page 19&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hRhgfm.png&quot; alt=&quot;enter image description here&quot; title=&quot;page 19&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does anyone know how these value would evolve when &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; grows?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Their entanglement/separability criterion is given as Theorem 1.&lt;/p&gt;&#xA;&lt;p&gt;If a &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-partite quantum state of dimension &lt;span class=&quot;math-container&quot;&gt;$d_1d_2...d_N$&lt;/span&gt; with Bloch representation &lt;span class=&quot;math-container&quot;&gt;$(8)$&lt;/span&gt; is fully separable, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;||\mathcal{T}^{(N)}||_{KF}\le \sqrt{\frac1{2^N}\prod_{k=1}^N d_k(d_k-1)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}^{(N)}$&lt;/span&gt; is given as last term in &lt;span class=&quot;math-container&quot;&gt;$(8)$&lt;/span&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7RgG0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7RgG0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$||\mathcal T||_{KF} = max\{||T_{(n)}^N||_{KF}\}, n=1,...,N;$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition#Ky_Fan_norms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ky-Fan norm&lt;/a&gt;, which is the sum of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; largest singular values of the matrix unfoldings of &lt;span class=&quot;math-container&quot;&gt;$\mathcal T$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm not interested in &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$|W\rangle$&lt;/span&gt; states&lt;/a&gt;...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-07-17T07:43:41.777" LastActivityDate="2020-07-17T07:43:41.777" Title="Separability Criterion for Multipartite GHZ Quantum States" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12930" PostTypeId="2" ParentId="12917" CreationDate="2020-07-16T23:01:51.917" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I usually think of adjoint operations in terms of pullbacks and their adjoint pushforwards.  For a simple example, assume we have smooth maps &lt;span class=&quot;math-container&quot;&gt;$f: \mathcal{Y} \rightarrow \mathbb{R}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g: \mathcal{X} \rightarrow \mathcal{Y}$&lt;/span&gt;, as shown below.  In this case, the pullback of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; is simply the composition &lt;span class=&quot;math-container&quot;&gt;$\Phi = f \circ g$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/preHL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/preHL.png&quot; alt=&quot;Pullback&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;While it's straightforward to pull functions on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt; back to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt;, even if we had a function mapping &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X} \rightarrow \mathbb{R}$&lt;/span&gt; there would be no way to push that function forward to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;.  The maps we have available aren't sufficient to define that kind of transfer.&lt;/p&gt;&#xA;&lt;p&gt;However we can define the pushforward of a vector from &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;, which is the adjoint to the pullback described above.  This is possible because we can treat vectors as derivative operators that map functions to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For a vector at point &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt;, say &lt;span class=&quot;math-container&quot;&gt;$V(x)$&lt;/span&gt;, the pushforward vector &lt;span class=&quot;math-container&quot;&gt;$\Phi^\dagger V$&lt;/span&gt; at point &lt;span class=&quot;math-container&quot;&gt;$g(x)$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt; can be defined in terms of its action on functions of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\Phi^\dagger V)(f) = V(\Phi f).$$&lt;/span&gt;&#xA;So the action of &lt;span class=&quot;math-container&quot;&gt;$\Phi^\dagger V$&lt;/span&gt; on a function is the action of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; on the pullback of that function.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OmwvQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OmwvQ.png&quot; alt=&quot;Pushforward&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;From a practical standpoint, we can take a basis for vectors on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;${\partial {}_\mu} = {\partial }/{\partial x^\mu}$&lt;/span&gt; and the same for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{Y}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;${\partial {}_\nu} = {\partial }/{\partial y^\nu}$&lt;/span&gt;.  To relate &lt;span class=&quot;math-container&quot;&gt;$V = V^\mu \partial {}_\mu$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$(\Phi^\dagger V)=(\Phi^\dagger V)^\nu \partial {}_\nu$&lt;/span&gt; we only need the chain rule:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\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.$$&lt;/span&gt;&#xA;This leads directly to the matrix &lt;span class=&quot;math-container&quot;&gt;$$(\Phi^\dagger)^\nu{}_\mu = \partial y^\nu / \partial x^\mu.$$&lt;/span&gt;&#xA;You can see after all this that the adjoint of the pullback, a vector pushforward, is essentially a generalization of a coordinate transformation.&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;em&gt;Maps between Manifolds&lt;/em&gt;, in &lt;a href=&quot;https://www.cambridge.org/core/books/spacetime-and-geometry/38EDABF9E2BADCE6FBCF2B22DC12BFFE&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spacetime And Geometry&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-07-16T23:39:43.583" LastActivityDate="2020-07-16T23:39:43.583" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12931" PostTypeId="1" CreationDate="2020-07-16T23:07:15.210" Score="5" ViewCount="86" Body="&lt;p&gt;In John Watrous' &lt;a href=&quot;https://youtu.be/nSdDbuAttLw?t=78&quot; rel=&quot;nofollow noreferrer&quot;&gt;lectures&lt;/a&gt;, he defines the quantum min-relative entropy as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\min}(\rho\|\sigma) = -\log(F(\rho, \sigma)^2),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma) = tr(\sqrt{\rho\sigma})$&lt;/span&gt;. Here, I use &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9891/can-we-combine-the-square-roots-inside-the-definition-of-the-fidelity&quot;&gt;this&lt;/a&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, one of the early papers introducing this quantity (see Definition 2 of &lt;a href=&quot;https://arxiv.org/pdf/0803.2770.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;) defines it as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\min}(\rho\|\sigma) = -\log(tr(\Pi_\rho\sigma)),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\Pi_\rho$&lt;/span&gt; is the projector onto the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. It's not clear if these definitions are equivalent since I can change &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; without altering its support.&lt;/p&gt;&#xA;&lt;p&gt;How are the two definitions related to each other, if at all?&lt;/p&gt;&#xA;" OwnerUserId="12686" LastEditorUserId="55" LastEditDate="2021-05-06T12:38:09.063" LastActivityDate="2021-05-06T12:38:09.063" Title="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))$?" Tags="&lt;information-theory&gt;&lt;entropy&gt;&lt;fidelity&gt;&lt;relative-entropy&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12932" PostTypeId="2" ParentId="12917" CreationDate="2020-07-16T23:08:45.213" Score="2" Body="&lt;p&gt;The key is to utilize the Kraus decomposition along with the Hilbert-Schmidt inner product: Given a quantum channel, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; with Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\left\{V_{l}\right\}$&lt;/span&gt;, we have,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{align}\langle Y, \mathcal{N}(X)\rangle &amp;amp;=\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\} \\ &amp;amp;=\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} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, the adjoint of a quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{N}^{\dagger}(Y)=\sum_{l} V_{l}^{\dagger} Y V_{l}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{ \Lambda^{j} \}$&lt;/span&gt; be a POVM, then the  probability of getting outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; from a measurement on state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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\}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The latter expression can be interpreted as the Heisenberg picture, where we evolve the ``observables'' instead of the state  &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; under the action of the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can find more details in these &lt;a href=&quot;http://www.markwilde.com/teaching/2015-fall-qit/lectures/lecture-10.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; by Mark Wilde.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-16T23:08:45.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12933" PostTypeId="2" ParentId="12919" CreationDate="2020-07-17T06:31:24.973" Score="1" Body="&lt;p&gt;Just to add. If you do not have a possibility to switch control and target qubits, you can implement &amp;quot;upside down&amp;quot; CNOT with this circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(H \otimes H) CNOT (H \otimes H),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hadamard gate and &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is controlled NOT with control qubit upside and target qubit downside.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-17T06:31:24.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12934" PostTypeId="2" ParentId="12929" CreationDate="2020-07-17T07:42:02.890" Score="2" Body="&lt;p&gt;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, &lt;a href=&quot;https://arxiv.org/abs/1006.5197&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p=\frac{1}{2^{N-1}+1}.&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-17T07:42:02.890" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="12936" PostTypeId="1" AcceptedAnswerId="12937" CreationDate="2020-07-17T10:11:50.360" Score="1" ViewCount="50" Body="&lt;p&gt;I got confused when reading an article about linear combination of unitary method. It shows its process as the following:&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/YvdR8.png&quot; width=&quot;500&quot;&gt;&#xA;&lt;p&gt;I can't figure out how the effect of &lt;span class=&quot;math-container&quot;&gt;$B^{\dagger}$&lt;/span&gt; is calculated with the limited information of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://dspace.mit.edu/bitstream/handle/1721.1/95812/PhysRevLett.114.090502.pdf?sequence=1&amp;amp;isAllowed=y&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;&#xA;is the article mentioned.&lt;/p&gt;&#xA;&lt;p&gt;Thanks to you all!&lt;/p&gt;&#xA;" OwnerUserId="12690" LastEditorUserId="55" LastEditDate="2020-07-17T11:28:03.973" LastActivityDate="2020-07-17T11:28:03.973" Title="How to compute the inverse of a unitary B when it's defined only by B|0⟩=XXXX?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12937" PostTypeId="2" ParentId="12936" CreationDate="2020-07-17T11:25:42.100" Score="2" Body="&lt;p&gt;The trick is that you don't need to calculate the inverse of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. What you really want to evaluate is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\langle 0|\otimes I)(B^\dagger \otimes I)(\text{select}(V))(B\otimes I).&#xA;$$&lt;/span&gt;&#xA;So, the point is that you only need &lt;span class=&quot;math-container&quot;&gt;$\langle 0|B^\dagger$&lt;/span&gt; which is the Hermitian conjugate of &lt;span class=&quot;math-container&quot;&gt;$B|0\rangle$&lt;/span&gt;, which you know.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-17T11:25:42.100" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12938" PostTypeId="1" AcceptedAnswerId="12939" CreationDate="2020-07-17T12:42:36.430" Score="0" ViewCount="66" Body="&lt;p&gt;As discussed in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' book&lt;/a&gt;, &lt;em&gt;quantum-to-classical&lt;/em&gt; channels are CPTP maps whose output is always fully depolarised. These can always be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_\mu(X) = \sum_a \langle X,\mu(a)\rangle E_{a,a}$$&lt;/span&gt;&#xA;for some set of positive operators &lt;span class=&quot;math-container&quot;&gt;$\mu(a)\ge0$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$\sum_a \mu(a)=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What is the (a) Kraus representation of these maps?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-18T14:51:32.347" LastActivityDate="2020-07-18T18:05:34.720" Title="What is the Kraus representation of quantum-to-classical channels?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12939" PostTypeId="2" ParentId="12938" CreationDate="2020-07-17T12:42:36.430" Score="1" Body="&lt;p&gt;We start from the defining form of the channel as &lt;span class=&quot;math-container&quot;&gt;$\Phi_\mu(X)=\sum_a \operatorname{tr}(\mu(a)X)E_{a,a}$&lt;/span&gt;.&lt;span class=&quot;math-container&quot;&gt;$\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}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Natural representations&lt;/strong&gt;&lt;/em&gt;)&#xA;To derive the natural representation of the map, note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_\mu(E_{k,\ell})=\sum_a\mu(a)_{\ell,k} E_{a,a}.$$&lt;/span&gt;&#xA;It follows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K(\Phi_\mu)_{ij,k\ell} = \langle i\rvert \Phi_\mu(E_{k,\ell})\lvert j\rangle&#xA;= \sum_a \mu(a)_{\ell,k} \langle i\rvert E_{a,a}\lvert j\rangle=\delta_{ij} \mu(i)_{\ell,k},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$E_{a,b}\equiv\lvert a\rangle\!\langle b\rvert$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; denotes the natural representation of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;.&#xA;As an operator, this reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K(\Phi_\mu)&#xA;%= \sum_a \lvert a,a\rangle \langle \mu(a)^T\rvert&#xA;\equiv \sum_a \ket{a,a}\!\operatorname{vec}(\mu(a)^*)^T.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Choi representation&lt;/strong&gt;&lt;/em&gt;)&#xA;Consider now the Choi operator, defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\equiv \sum_{i,j}\Phi(E_{i,j})\otimes E_{i,j}$&lt;/span&gt;.&#xA;From this we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi_\mu) = \sum_{a,i,j} \mu(a)_{j,i} E_{a,a}\otimes E_{i,j}&#xA;= \sum_a E_{a,a}\otimes \mu(a)^T.$$&lt;/span&gt;&#xA;We can also get this from &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt;, using the relation&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle i,j\rvert J(\Phi)\lvert k,\ell\rangle = \langle i,k\rvert K(\Phi)\lvert j,\ell\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Kraus representation from Choi&lt;/strong&gt;&lt;/em&gt;)&#xA;One way to get the Kraus representation is via the spectral decomposition of the Choi.&#xA;From the relations above, we see that the spectral decomposition of the Choi is in this case quite easy: define &lt;span class=&quot;math-container&quot;&gt;$\ket{v_{a,j}}\equiv \ket a\otimes \ket{p_{a,j}^*}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\ket{p_{a,j}}$&lt;/span&gt; the eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$p_{a,j}$&lt;/span&gt;, and using &lt;span class=&quot;math-container&quot;&gt;$\ket{p_{a,j}^*}$&lt;/span&gt; to denote the complex conjugate of &lt;span class=&quot;math-container&quot;&gt;$\ket{p_{a,j}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From this we get the Kraus operators as the maps &lt;span class=&quot;math-container&quot;&gt;$A_{a,j}$&lt;/span&gt; of the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_{a,j} = \sqrt{p_{a,j}} \lvert a\rangle\!\langle p_{a,j}\rvert&#xA;\Longleftrightarrow&#xA;(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&#xA;$$&lt;/span&gt;&#xA;With these operators, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_\mu(X) = \sum_{a,j} A_{a,j} X A_{a,j}^\dagger.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(&lt;em&gt;&lt;strong&gt;Direct derivation&lt;/strong&gt;&lt;/em&gt;) For a direct route that doesn't require passing through the Choi representation, let us write down the explicit form of &lt;span class=&quot;math-container&quot;&gt;$\Phi_\mu(X)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_\mu(X) = \sum_{a,\ell k} \mu(a)_{k,\ell}X_{\ell,k} E_{a,a}.$$&lt;/span&gt;&#xA;Because, by hypothesis, &lt;span class=&quot;math-container&quot;&gt;$\mu(a)\ge0$&lt;/span&gt;, we can find some operator &lt;span class=&quot;math-container&quot;&gt;$M_a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mu(a)=M_a^\dagger M_a$&lt;/span&gt;. Componentwise, this reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mu(a)_{k,\ell} = \sum_j(M_a^*)_{j,k}(M_a)_{j,\ell}.$&lt;/span&gt; Using this in the expression above we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_\mu(X) = \sum_{a,jk\ell}  E_{a,a}(M_a^*)_{j,k} X_{\ell,k} (M_a)_{j,\ell} E_{a,a}.$$&lt;/span&gt;&#xA;The corresponding Kraus operators thus have the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A_{a,j}= \lvert a\rangle\!\langle j\rvert M_a.\tag2$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$M_a$&lt;/span&gt;, and in particular doesn't necessarily lead to orthogonal Kraus operators, like (1) does. To see this, notice that we can generally express &lt;span class=&quot;math-container&quot;&gt;$M_a$&lt;/span&gt; in terms of the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_a = \sum_\ell \sqrt{p_{a,\ell}} \lvert u_{a,\ell}\rangle\!\langle p_{a,\ell}\rvert,$$&lt;/span&gt;&#xA;for any choice of orthonormal vectors &lt;span class=&quot;math-container&quot;&gt;$\lvert u_{a,\ell}\rangle$&lt;/span&gt;.&#xA;In particular, we can choose &lt;span class=&quot;math-container&quot;&gt;$\lvert u_{a,\ell}\rangle=\lvert \ell\rangle$&lt;/span&gt; to retrieve (1).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-18T18:05:34.720" LastActivityDate="2020-07-18T18:05:34.720" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12940" PostTypeId="2" ParentId="12925" CreationDate="2020-07-17T14:23:42.783" Score="2" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; 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&lt;/p&gt;&#xA;&lt;p&gt;The vectors &lt;span class=&quot;math-container&quot;&gt;$|+⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-⟩$&lt;/span&gt; are known as the eigenvectors for the Hadamard gate. When we apply the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on the &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1⟩$&lt;/span&gt;, we get &lt;span class=&quot;math-container&quot;&gt;$|+⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-⟩$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&lt;p&gt;That is, &lt;span class=&quot;math-container&quot;&gt;$$H|0⟩=|+⟩$$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H|1⟩=|-⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11868" LastEditorUserId="8787" LastEditDate="2020-07-18T07:02:56.587" LastActivityDate="2020-07-18T07:02:56.587" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12941" PostTypeId="1" AcceptedAnswerId="12942" CreationDate="2020-07-17T16:27:33.103" Score="1" ViewCount="73" Body="&lt;p&gt;Whenever we calculate entropy we make use, for example,  &lt;span class=&quot;math-container&quot;&gt;$\log(P)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; a projection defined for some arbitrary finite dimensional Hilbert space.&lt;/p&gt;&#xA;&lt;p&gt;But for projection operators this is not well-defined by means of the functional calculus. My question is: &lt;em&gt;although we are more interested in the terms &lt;span class=&quot;math-container&quot;&gt;$P \log(P)$&lt;/span&gt; what is really happening is that we use this only for a symbol whenever we have projections and write &lt;span class=&quot;math-container&quot;&gt;$0\log(0)=0$&lt;/span&gt; as the eigenvalue description using the functional calculus for the operator &lt;span class=&quot;math-container&quot;&gt;$P\log(P)$&lt;/span&gt;?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is there a way to make &lt;span class=&quot;math-container&quot;&gt;$\log(P)$&lt;/span&gt; a valid, well-defined, mathematical description?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8787" LastEditorUserId="8787" LastEditDate="2020-07-17T23:27:08.157" LastActivityDate="2020-07-17T23:27:08.157" Title="How well defined is $\log(P)$ for $P$ projection?" Tags="&lt;mathematics&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12942" PostTypeId="2" ParentId="12941" CreationDate="2020-07-17T17:56:36.203" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a projection operator in the limiting case where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lim_{P \rightarrow 0^+} P \log(P)=0.$$&lt;/span&gt;&#xA;This is still a bit sloppy. Since &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a matrix, we're actually taking the trace and &lt;span class=&quot;math-container&quot;&gt;$P \rightarrow 0^+$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S=\sum \lambda_i \log \lambda_i,$$&lt;/span&gt;&#xA;so that there is no ambiguity in interpreting&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lim_{\lambda \rightarrow 0^+} \lambda \log(\lambda)=0,$$&lt;/span&gt;&#xA;for any given term in the sum.&lt;/p&gt;&#xA;&lt;p&gt;In response to your comment, when &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a projection operator, the expression &lt;span class=&quot;math-container&quot;&gt;$\log(P)$&lt;/span&gt; is inherently undefined.  You can see this by noting that projection operators are idempotent by definition, so &lt;span class=&quot;math-container&quot;&gt;$P^2=P$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consider the proposition that we can express &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; in exponential form &lt;span class=&quot;math-container&quot;&gt;$P=e^x$&lt;/span&gt; for some unknown &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. The idempotentcy of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; requires &lt;span class=&quot;math-container&quot;&gt;$e^x=e^{2x}$&lt;/span&gt;, which tells us that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is imaginary with magnitude &lt;span class=&quot;math-container&quot;&gt;$2 \pi n, \, n \in \mathbb{Z}$&lt;/span&gt;, over some &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional basis.&lt;/p&gt;&#xA;&lt;p&gt;Whatever appropriately normalized basis we pick, say &lt;span class=&quot;math-container&quot;&gt;$b_d$&lt;/span&gt;, the inevitable result is &lt;span class=&quot;math-container&quot;&gt;$e^{i2\pi n b_d}=I_d$&lt;/span&gt;.  So we get back the identity instead of our projection operator, contradicting the proposition.&lt;/p&gt;&#xA;&lt;p&gt;The is one of several ways to see that we can't define &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; as an exponential, and that &lt;span class=&quot;math-container&quot;&gt;$\log(P)$&lt;/span&gt; is hopelessly undefined.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-07-17T19:28:17.367" LastActivityDate="2020-07-17T19:28:17.367" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12944" PostTypeId="1" AcceptedAnswerId="12946" CreationDate="2020-07-18T02:49:20.927" Score="2" ViewCount="105" Body="&lt;p&gt;I have two states &lt;span class=&quot;math-container&quot;&gt;$|{\psi}\rangle = \begin{pmatrix} a_1\\a_2 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|{\phi}\rangle = \begin{pmatrix} b_1 \\ b_2 \end{pmatrix} $&lt;/span&gt; that I want to &amp;quot;add&amp;quot; together. By &amp;quot;add,&amp;quot; I of course mean perform the xor operation &lt;span class=&quot;math-container&quot;&gt;$|{\psi} \oplus {\phi}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;My initial thought was to split the states into the logical basis and sum the components.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a_1|{0}\rangle + a_2|{1}\rangle + b_1|{0}\rangle + b_2|{1}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But this doesn't seem right. If my assumption that &lt;span class=&quot;math-container&quot;&gt;$|{0}\rangle + |{\psi}\rangle = |{\psi}\rangle$&lt;/span&gt; is correct, then &lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt; which misses the point of the sum altogether.&lt;/p&gt;&#xA;&lt;p&gt;What is my misunderstanding, and what is &lt;span class=&quot;math-container&quot;&gt;$|{\psi} \oplus {\phi}\rangle$&lt;/span&gt; is in terms of &lt;span class=&quot;math-container&quot;&gt;$a_1, b_1, a_2, b_2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="11628" LastEditorUserId="55" LastEditDate="2020-07-26T17:48:38.350" LastActivityDate="2020-07-26T17:48:38.350" Title="How do I &quot;add&quot; two qubit states?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12945" PostTypeId="1" AcceptedAnswerId="12954" CreationDate="2020-07-18T04:37:01.677" Score="4" ViewCount="76" Body="&lt;p&gt;Suppose I have an unknown state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_i \alpha_i|{\lambda_i}\rangle$&lt;/span&gt;, is it possible that I can transform it into  &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{\sum_i|\alpha_i|^{2r}}} \sum_i \alpha_i^r|{\lambda_i}\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I have an idea for one qubit with a measurement, which would be better without measurements.&lt;/p&gt;&#xA;&lt;p&gt;Suppose the input state is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt; and can be prepared with two copies. An ancilla qubit is provided with state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;(\alpha|0\rangle+\beta|1\rangle)(\alpha|0\rangle+\beta|1\rangle)|0\rangle=&#xA;\alpha^2|000\rangle + \alpha\beta|010\rangle+\beta\alpha|100\rangle+\beta^2|110\rangle.&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With two CNOT gates in a row, the ancilla qubit is the target qubit, such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\alpha^2|000\rangle+\alpha\beta|011\rangle+\beta\alpha|101\rangle+\beta^2|110\rangle.&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}}|000\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}}|110\rangle.&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With an CNOT gate on the second qubit, using the first qubit as control, such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}}|00\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}}|10\rangle=&#xA;(\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}}|0\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}}|1\rangle)|0\rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The state in the first qubit will be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}} |0\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}} |1\rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QTlFy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QTlFy.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, the measurement on ancilla qubit is a nuisance. Can I obtain the powered amplitude state without measurement on arbitrary number of qubits?&lt;/p&gt;&#xA;" OwnerUserId="12693" LastEditorUserId="55" LastEditDate="2020-07-26T18:03:36.003" LastActivityDate="2020-07-26T18:03:36.003" Title="How to transform a state with amplitude squared or to any power?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12946" PostTypeId="2" ParentId="12944" CreationDate="2020-07-18T06:04:06.440" Score="2" Body="&lt;p&gt;The XOR operation is not a well defined action in quantum computing since it is non-reversible. (For example: &lt;span class=&quot;math-container&quot;&gt;$|0 \oplus 0\rangle = |1 \oplus 1\rangle = |0\rangle $&lt;/span&gt;) However, XOR &lt;em&gt;is&lt;/em&gt; implicit in the CNOT operation, as CNOT&lt;span class=&quot;math-container&quot;&gt;$(|a,b\rangle) = |a, a \oplus b\rangle$&lt;/span&gt; Hence to answer my own question:&lt;/p&gt;&#xA;&lt;p&gt;CNOT&lt;span class=&quot;math-container&quot;&gt;$(|\psi \otimes \phi\rangle) = \begin{pmatrix} a_1b_1 \\ a_1b_2 \\ a_2b_2 \\ a_2b_1\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I'm not mistaken, the state of the target qubit is then given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(a_1b_1 +a_2b_2)|0\rangle + (a_1b_2 + a_2b_1)|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Under some normalization&lt;/p&gt;&#xA;" OwnerUserId="11628" LastEditorUserId="11628" LastEditDate="2020-07-23T04:43:15.377" LastActivityDate="2020-07-23T04:43:15.377" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12948" PostTypeId="1" AcceptedAnswerId="12950" CreationDate="2020-07-18T13:33:28.320" Score="0" ViewCount="85" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7739" LastEditorUserId="55" LastEditDate="2020-09-25T11:40:52.987" LastActivityDate="2020-09-25T11:40:52.987" Title="Where to publish quantum algorithm related paper" Tags="&lt;algorithm&gt;&lt;research&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12949" PostTypeId="2" ParentId="12948" CreationDate="2020-07-18T14:37:00.073" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://rdvlivefromtokyo.blogspot.com/2019/11/quantum-information-theory-computing.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is a good list made by Prof. Rod Van Meter.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-07-18T14:37:00.073" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12950" PostTypeId="2" ParentId="12948" CreationDate="2020-07-18T17:07:25.937" Score="3" Body="&lt;p&gt;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 &lt;strong&gt;Quantum Information Processing&lt;/strong&gt;. Since this journal is good, and moreover it has papers regarding Image Processing related topics like its Representation, security.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastActivityDate="2020-07-18T17:07:25.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12951" PostTypeId="1" AcceptedAnswerId="12952" CreationDate="2020-07-18T21:16:23.917" Score="2" ViewCount="81" Body="&lt;p&gt;We know that every CPTP map &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathcal X\to\mathcal Y$&lt;/span&gt; can be represented via an isometry &lt;span class=&quot;math-container&quot;&gt;$U:\mathcal X\otimes\mathcal Z\to\mathcal Y\otimes\mathcal Z$&lt;/span&gt;, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&#xA;Showing this is quite easy &lt;em&gt;e.g.&lt;/em&gt; from the Kraus representation.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$A_a:\mathcal X\to\mathcal Y$&lt;/span&gt; are Kraus operators for &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&#xA;We can, of course, replace &lt;span class=&quot;math-container&quot;&gt;$E_{0,0}$&lt;/span&gt; with any pure state in (1) without affecting the result.&lt;/p&gt;&#xA;&lt;p&gt;This shows that, given any channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; and any pure state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle\in\mathcal Z$&lt;/span&gt;, we can represent &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; as in (1) (with &lt;span class=&quot;math-container&quot;&gt;$E_{0,0}\to\lvert\psi\rangle$&lt;/span&gt;).&#xA;However, what about the more general case of &lt;span class=&quot;math-container&quot;&gt;$E_{0,0}\to\sigma$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; not pure?&lt;/p&gt;&#xA;&lt;p&gt;To analyse this case, consider a channel written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)=\operatorname{Tr}_{\mathcal Z}[U(X\otimes \sigma)U^\dagger]\tag3$$&lt;/span&gt;&#xA;for some state &lt;span class=&quot;math-container&quot;&gt;$\sigma=\sum_k p_k E_{k,k}\in\mathrm{Lin}(\mathcal Z)$&lt;/span&gt; (appropriately choosing the computational basis for &lt;span class=&quot;math-container&quot;&gt;$\mathcal Z$&lt;/span&gt;).&#xA;The relation with the Kraus operators reads in this case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)_{\alpha,\beta} = \sum_{\ell k ij} p_\ell U_{\alpha \ell,i k} X_{ij} U^*_{\beta\ell,jk}&#xA;= \sum_{\ell,k} (A_{\ell,k}XA_{\ell,k}^\dagger)_{\alpha\beta}\tag4$$&lt;/span&gt;&#xA;with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(A_{\ell,k})_{\alpha,i} \equiv  \sqrt{p_\ell} U_{\alpha\ell,ik},&#xA;\qquad A_{\ell,k} = \sqrt{p_\ell} (I\otimes \langle \ell\rvert)U(I\otimes \lvert k\rangle).\tag5$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is now a difference: the number of Kraus operators must be larger than the rank of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; (which determines the number elements spanned by the index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$A_{\ell,k}$&lt;/span&gt;).&#xA;Indeed, a different way to state this same fact is to notice that the &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; in (3) is a convex combination of several channels:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This leads me to the question: can any &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; be written as in (3) &lt;em&gt;for any &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;&lt;/em&gt;? More precisely, given &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, can I always find an isometry &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that (3) holds?&lt;/p&gt;&#xA;&lt;p&gt;The question arises from the fact that, because when &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is not pure (3) leads to &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; be a convex combination of other maps as shown in (6), I would think that there should be maps that are &amp;quot;extremal&amp;quot;, 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; not pure.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-07-19T01:14:19.947" Title="Can any channel be written as $\Phi(X)=\operatorname{Tr}_{\mathcal Z}[U(X\otimes \sigma)U^\dagger]$ for any state $\sigma$?" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12952" PostTypeId="2" ParentId="12951" CreationDate="2020-07-18T21:37:49.560" Score="5" Body="&lt;p&gt;No, this is not always possible.&lt;/p&gt;&#xA;&lt;p&gt;A counterexample is given by &lt;span class=&quot;math-container&quot;&gt;$\sigma=I/d'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\mathrm{tr}(X)|0\rangle\langle0|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To see this, note that for &lt;span class=&quot;math-container&quot;&gt;$X=I/d$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;2(1-1/d) &amp;amp; = &#xA;\|\,|0\rangle\langle0|-I/d\|_1 &#xA;\\&#xA;&amp;amp;= \|\Phi(X)-I/d\|_1&#xA;\\&#xA;&amp;amp;\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&#xA;\\&#xA;&amp;amp;\le \left\|X\otimes \frac{I}{d'}-\frac{I}{d}\otimes\frac{I}{d'}\right\|_1&#xA;\\&#xA;&amp;amp;&#xA;=\left\|X-\frac{I}{d}\right\|_1&#xA;\\&#xA;&amp;amp;=0&#xA;\end{align}&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\|A\otimes I/d'\|_1 = \|A\|_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is clearly a contradiction and thus shows that such a representation for the chosen channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; cannot exist.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;As always, let me take the opportunity to &lt;a href=&quot;https://physics.stackexchange.com/questions/291810/canonical-examples-of-quantum-channels/291811#291811&quot;&gt;advertise my list of canonical (counter)examples for quantum channels.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-07-19T01:14:19.947" LastActivityDate="2020-07-19T01:14:19.947" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12953" PostTypeId="2" ParentId="12931" CreationDate="2020-07-18T21:40:53.137" Score="3" Body="&lt;p&gt;As @rnva points out these are not the same quantities. To give some clarity as to why they are both referred to as &lt;span class=&quot;math-container&quot;&gt;$D_{\min}$&lt;/span&gt; it is best to look at the as limiting cases of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;-R'enyi divergences.&lt;/p&gt;&#xA;&lt;p&gt;First, we have the sandwiched divergences which for &lt;span class=&quot;math-container&quot;&gt;$\alpha \in (0, 1) \cup (1, \infty)$&lt;/span&gt; are defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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].&#xA;$$&lt;/span&gt;&#xA;These divergences are monotonically increasing in &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and satisfy the data processing inequality (DPI) for all &lt;span class=&quot;math-container&quot;&gt;$\alpha \geq 1/2$&lt;/span&gt;. Thus the smallest divergence in this family satisfying the DPI is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\widetilde{D}_{\min}(\rho \| \sigma) = \widetilde{D}_{1/2}(\rho \|\sigma) = - \log \mathrm{Tr}[\sqrt{\rho} \sqrt{\sigma}]^2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another well studied family of divergences are the so-called Petz divergences defined for &lt;span class=&quot;math-container&quot;&gt;$\alpha \in (0,1) \cup (1, \infty)$&lt;/span&gt; to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\overline{D}_{\alpha}(\rho \| \sigma) = \frac{1}{\alpha - 1} \log \mathrm{Tr}[\rho^{\alpha} \sigma^{1-\alpha}].&#xA;$$&lt;/span&gt;&#xA;This family satisfies the DPI for &lt;span class=&quot;math-container&quot;&gt;$\alpha \in (0,1) \cup(1,2]$&lt;/span&gt; and they are also monotonically increasing in &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;. Thus, the smallest divergence satisfying the DPI in this family is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\overline{D}_{\min}(\rho \| \sigma) = \lim_{\alpha \to 0^+} \overline{D}_{\alpha}(\rho \|\sigma) = -\log \mathrm{Tr}[\Pi_\rho \sigma ].&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-07-18T21:40:53.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12954" PostTypeId="2" ParentId="12945" CreationDate="2020-07-19T00:01:38.400" Score="3" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9703032&quot; rel=&quot;nofollow noreferrer&quot;&gt;No-Programming Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also note at, as &lt;span class=&quot;math-container&quot;&gt;$r\to\infty$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is finite.&lt;/p&gt;&#xA;&lt;p&gt;Nearly final observation: you mention you want &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to be &amp;quot;unknown&amp;quot;. You should be cautious taking your solution (as you generalise requiring more copies of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;) farther without thinking about no-cloning or more subtle resource counting.&lt;/p&gt;&#xA;&lt;p&gt;Last thing. A coherent version of something like what you might be looking for is &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amplitude Amplification&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4407" LastActivityDate="2020-07-19T00:01:38.400" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12955" PostTypeId="1" CreationDate="2020-07-19T00:09:09.907" Score="1" ViewCount="90" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12676" LastActivityDate="2020-07-19T06:33:04.950" Title="How to remove ancilla bits from results?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12956" PostTypeId="1" AcceptedAnswerId="12957" CreationDate="2020-07-19T00:26:45.523" Score="1" ViewCount="158" Body="&lt;p&gt;In David Deutsch's classic paper &lt;em&gt;Quantum theory, the Church-Turing principle and the universal quantum computer&lt;/em&gt; (1985), Deutsch writes on p. 99:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dETLg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dETLg.png&quot; alt=&quot;C(ℱ) itself, also known as the set of recursive functions, is denumerable and therefore infinitely smaller than the set of all functions from ℤ to ℤ.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;(I thought that this might be in typo &lt;a href=&quot;https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.1985.0070&quot; rel=&quot;nofollow noreferrer&quot;&gt;in the original publication&lt;/a&gt;, but it is also present in the version that was &lt;a href=&quot;http://gretl.ecn.wfu.edu/%7Ecottrell/ope/archive/0305/att-0257/01-deutsch85.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;retypeset in 1999&lt;/a&gt; which is easily findable on the Internet.)&lt;/p&gt;&#xA;&lt;p&gt;Since ℤ=ℤ, what is &amp;quot;the set of all functions from ℤ to ℤ?&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="9482" LastEditorUserId="5957" LastEditDate="2020-07-20T11:23:36.687" LastActivityDate="2020-07-20T11:23:36.687" Title="What is the set of all functions from ℤ to ℤ?" Tags="&lt;mathematics&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12957" PostTypeId="2" ParentId="12956" CreationDate="2020-07-19T01:49:10.510" Score="3" Body="&lt;p&gt;Recall that a &lt;a href=&quot;https://en.wikipedia.org/wiki/Function_(mathematics)#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;function&lt;/a&gt; between two sets (say &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt;) is simply a binary relation that associates to every element of the first set &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; &lt;em&gt;exactly&lt;/em&gt; one element of the second set &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Therefore, a function can be represented as a set &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; of ordered pairs &lt;span class=&quot;math-container&quot;&gt;$(x,y), x \in A, y \in B$&lt;/span&gt;, satisfying the following: each element of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; 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 &lt;em&gt;is&lt;/em&gt; a function).&lt;/p&gt;&#xA;&lt;p&gt;Now, to count the total number of functions between two sets we need to count the number of unique sets (of the form &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; above) that can be constructed. One can show that the number of functions from a set &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to a set &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|B|^{|A|}$&lt;/span&gt; (see, for example, this &lt;a href=&quot;https://math.stackexchange.com/questions/223240/how-many-distinct-functions-can-be-defined-from-set-a-to-b&quot;&gt;intuitive answer&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Do the same for &lt;span class=&quot;math-container&quot;&gt;$A = \mathbb{Z} = B$&lt;/span&gt; but beware of their cardinalities (and realize that this set is &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncountable_set&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncountable&lt;/a&gt;, see for example, &lt;a href=&quot;https://math.stackexchange.com/questions/837223/is-the-set-of-all-functions-mathbb-n-to-mathbb-q-uncountable&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update (from the comments)&lt;/strong&gt;: The notation ``set of all functions from &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt;'' is shorthand for &lt;span class=&quot;math-container&quot;&gt;$\{f | f: \mathbb{Z} \rightarrow \mathbb{Z}\}$&lt;/span&gt;, i.e., all functions whose domain and range is &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt; (or subsets of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-07-19T19:52:38.540" LastActivityDate="2020-07-19T19:52:38.540" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12958" PostTypeId="2" ParentId="12884" CreationDate="2020-07-19T02:47:07.820" Score="2" Body="&lt;p&gt;So the general definition of pseudothreshold is when the logical qubit outperforms a physical qubit.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;A simple example would be a channel:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E(\rho) = (1-p)I\rho I + p Z\rho Z$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-07-19T02:47:07.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12959" PostTypeId="1" AcceptedAnswerId="12961" CreationDate="2020-07-19T04:03:29.133" Score="1" ViewCount="123" Body="&lt;p&gt;Why we should use density matrices to simulate quantum systems with noise?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-09-25T11:42:57.447" LastActivityDate="2020-09-25T11:42:57.447" Title="Why should we use density matrices to simulate quantum systems with noise?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;simulation&gt;&lt;noise&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12960" PostTypeId="2" ParentId="12956" CreationDate="2020-07-19T04:41:35.947" Score="1" Body="&lt;p&gt;Just consider the set of all functions from &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt; to a two point set &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt;. The cardinality of the set of all functions between these two sets is &lt;span class=&quot;math-container&quot;&gt;$2^{|\mathbb{Z}|}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now ask yourself is the power set of &lt;span class=&quot;math-container&quot;&gt;$ \mathbb{Z}$&lt;/span&gt; countable. If the answer is NO then the answer to your question is also a NO.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastActivityDate="2020-07-19T04:41:35.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12961" PostTypeId="2" ParentId="12959" CreationDate="2020-07-19T05:29:34.173" Score="4" Body="&lt;p&gt;Noise effects introduce classical uncertainty in what the underlying state is. A mixed state is a statistical ensemble of several quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; (not necessarily orthogonal), with respective probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Noise models are always defined in terms of density operators.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-07-19T09:40:59.820" LastActivityDate="2020-07-19T09:40:59.820" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12962" PostTypeId="2" ParentId="12955" CreationDate="2020-07-19T06:33:04.950" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UgmOa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UgmOa.png&quot; alt=&quot;Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The purpose of the circuit is to calculate &lt;span class=&quot;math-container&quot;&gt;$q_0 \,\text{AND}\, q_1 \,\text{AND} q_2$&lt;/span&gt;. To do so, firstly &lt;span class=&quot;math-container&quot;&gt;$q_0 \,\text{AND}\, q_1$&lt;/span&gt; is calculated and result is stored to ancilla &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;. After that final result is obtained by &lt;span class=&quot;math-container&quot;&gt;$q_2 \,\text{AND}\, q_3$&lt;/span&gt; and stored to &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt;. Finnaly, inverse operation (note that inverse gate to Toffoli is again Toffoli) is applied. As a result, state of ancilla &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; is returned back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. This value is returned during measurement. If you do not want to include ancilla to measurement, simply do not put the measurement on qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-19T06:33:04.950" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12963" PostTypeId="2" ParentId="12884" CreationDate="2020-07-19T14:06:17.087" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In quantum error correction (QEC), a logical qubit is encoded in many physical qubits.  Given some underlying physical error rate &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, there will be a corresponding logical error rate &lt;span class=&quot;math-container&quot;&gt;$\bar{p}$&lt;/span&gt;.  If we are smart with our encoding and can make hardware that is &amp;quot;good enough&amp;quot;, then ideally &lt;span class=&quot;math-container&quot;&gt;$\bar{p} &amp;lt; p$&lt;/span&gt; below some &lt;span class=&quot;math-container&quot;&gt;$p_{th}$&lt;/span&gt; for the physical error rate.&lt;/p&gt;&#xA;&lt;p&gt;When simulating QEC codes, if one type of circuit component (like a single qubit gate) is assumed to fail with some rate &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, we might obtain a plot like the one below (left).  The parameter &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; refers to the code concatenation; &lt;span class=&quot;math-container&quot;&gt;$L=0$&lt;/span&gt; means no QEC, &lt;span class=&quot;math-container&quot;&gt;$L=1$&lt;/span&gt; means each logical qubit is encoded with a set of physical qubits, &lt;span class=&quot;math-container&quot;&gt;$L=2$&lt;/span&gt; means each of the &lt;span class=&quot;math-container&quot;&gt;$L=1$&lt;/span&gt; physical qubits &lt;em&gt;itself&lt;/em&gt; is encoded, etc.  Notice that there is clean crossover (i.e. all curves intersect the &lt;span class=&quot;math-container&quot;&gt;$L=0$&lt;/span&gt; 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 (&lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is used as the rate symbol here).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$L=0$&lt;/span&gt; curve at a different point, so you cannot just find the threshold of, say, the &lt;span class=&quot;math-container&quot;&gt;$L=1$&lt;/span&gt; code and then scale up to higher &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;--you will actually make the code worse, because you only found a pseudothreshold.  Instead, you need to simulate many values of &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and infer some kind of asymptotic behavior in the curves to get a rough estimate of where it is truly safe to scale up.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eFhcM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eFhcM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I took these details and image from this &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0508176.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2020-07-19T14:06:17.087" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12964" PostTypeId="1" CreationDate="2020-07-19T14:10:13.613" Score="3" ViewCount="85" Body="&lt;p&gt;Suppose I am solving the TSP formulated as a QUBO problem using QAOA. I understand from the original &lt;a href=&quot;https://arxiv.org/pdf/1411.4028.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; that there is a parameter &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; which sets the number of steps used in the alternating ansatz. Also, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; represents the locality of the terms in the ansatz.&lt;/p&gt;&#xA;&lt;p&gt;So what does this &amp;quot;locality&amp;quot; mean for our real world TSP problem? Does it mean that we can only find optimal paths that are locally optimised up to &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; edges radius?&lt;/p&gt;&#xA;" OwnerUserId="10485" LastEditorUserId="10485" LastEditDate="2020-12-30T09:47:48.687" LastActivityDate="2020-12-31T21:08:33.277" Title="What is the implication of locality in QAOA?" Tags="&lt;qaoa&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12965" PostTypeId="1" CreationDate="2020-07-19T14:59:34.000" Score="1" ViewCount="69" Body="&lt;p&gt;In Quantum Information processing, we can extract entanglement from &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-copies of a weakly entangled state to produce a fully or highly entangled states in &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensions, using the known distillation protocols.&lt;/p&gt;&#xA;&lt;p&gt;However, there are states from which no entanglement can be extracted out using the known distillation protocols for no value of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Such states contain bound entanglement.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;What is the deep physical reason behind the existence of bound entanglement?&lt;/p&gt;&#xA;" OwnerUserId="11668" LastEditorUserId="55" LastEditDate="2020-09-25T11:42:43.670" LastActivityDate="2020-09-25T11:42:43.670" Title="What is the deep physical reason behind the existence of bound entanglement?" Tags="&lt;entanglement&gt;&lt;state-distillation&gt;&lt;entanglement-negativity&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="0" ClosedDate="2020-07-26T11:50:11.443" ContentLicense="CC BY-SA 4.0" />
  <row Id="12966" PostTypeId="1" AcceptedAnswerId="12967" CreationDate="2020-07-19T15:55:20.163" Score="2" ViewCount="37" Body="&lt;p&gt;Fix a finite number of states &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt;, and consider a channel of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)=\sum_k c_{k}(X)\sigma_k.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; to be linear and trace-preserving we must have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$c_k(X+X') = c_k(X) + c_k(X'), \qquad \sum_k c_k(X)=1.$$&lt;/span&gt;&#xA;In other words, the coefficients must be linear functionals &lt;span class=&quot;math-container&quot;&gt;$c_k\in\mathrm{Lin}(\mathcal X)^*$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Does this imply that there must be some positive operators &lt;span class=&quot;math-container&quot;&gt;$F_k\ge0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$c_k(X)=\operatorname{Tr}(F_k X)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (which in turn would imply &lt;span class=&quot;math-container&quot;&gt;$\sum_k F_k=I$&lt;/span&gt; and thus that &lt;span class=&quot;math-container&quot;&gt;$\{F_k\}_k$&lt;/span&gt; is a POVM)? What's a good way to show this?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-19T16:26:11.000" LastActivityDate="2020-07-19T16:26:11.000" Title="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$?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12967" PostTypeId="2" ParentId="12966" CreationDate="2020-07-19T16:17:27.263" Score="2" Body="&lt;p&gt;The answer is &lt;em&gt;&lt;strong&gt;no&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To this end, pick a linearly independent set &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_k\}$&lt;/span&gt; which spans the full matrix space (over &lt;span class=&quot;math-container&quot;&gt;$\mathbb C)$&lt;/span&gt;, that is, a basis.  (This is always possible, as the positive operators span the hermitian ones over &lt;span class=&quot;math-container&quot;&gt;$\mathbb R$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Then pick a dual basis &lt;span class=&quot;math-container&quot;&gt;$\sigma'_\ell$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\sigma'_\ell \sigma_k]=\delta_{k\ell}\ .&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(X) = \sum_k \mathrm{tr}[\sigma'_k X]\,\sigma_k&#xA;$$&lt;/span&gt;&#xA;is the identity channel, which cannot be written as a POVM &lt;span class=&quot;math-container&quot;&gt;$F_k\ge0$&lt;/span&gt; followed by a preparation of &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; (as that channel would be entanglement breaking).&lt;/p&gt;&#xA;&lt;p&gt;(Note that this shows that the dual basis &lt;span class=&quot;math-container&quot;&gt;$\sigma'_\ell$&lt;/span&gt; has non-positive elements. This is not surprising, since otherwise the scalar product &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[\sigma'_\ell\sigma_k]\ge0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k,\ell$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-07-19T16:17:27.263" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12968" PostTypeId="2" ParentId="12959" CreationDate="2020-07-19T17:47:42.680" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-07-19T17:47:42.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12969" PostTypeId="1" CreationDate="2020-07-19T20:20:31.107" Score="1" ViewCount="23" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2020-07-27T12:25:32.030" LastActivityDate="2020-07-27T12:25:32.030" Title="Frequency collision and crosstalk error" Tags="&lt;quantum-state&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12970" PostTypeId="1" CreationDate="2020-07-19T21:11:41.520" Score="3" ViewCount="70" Body="&lt;p&gt;&amp;quot;Quantum theory, the Church-Turing principle and the universal quantum computer&amp;quot; (Deutsch 1985b) appears to introduce the term of &amp;quot;quantum parallelism&amp;quot; (the term is not in &amp;quot;Quantum Theory as a Universal Physical Theory&amp;quot; (Deutsch 1985a)). He makes two obvious (to me) claims:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&amp;quot;Quantum parallelism cannot be used to improve the mean running time of parallelizable algorithms.&amp;quot; (p. 112, top)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum parallelism could be used to prove the many-worlds interpretation of quantum mechanics, specifically:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;h2&gt;Interpretational implications&lt;/h2&gt;&#xA;&lt;p&gt;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? &lt;em&gt;Where was it computed?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;And what about the many worlds?&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2020-07-20T07:21:55.437" Title="Is Deutsch 1985b wrong about and Quantum Parallelism?" Tags="&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12971" PostTypeId="1" CreationDate="2020-07-20T05:32:39.227" Score="2" ViewCount="29" Body="&lt;p&gt;I am trying to compute cross-correlation on a quantum computer, and I have found a research paper describing the cross-correlation algorithm.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The link to access the research paper is &lt;a href=&quot;https://arxiv.org/abs/1908.09519&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cross-Correlations computation through quantum computing&lt;/a&gt;. On page number  4 the cross-correlation algorithm is mentioned.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12709" LastEditorUserId="55" LastEditDate="2020-07-20T11:11:44.413" LastActivityDate="2020-07-20T11:11:44.413" Title="Computing cross-correlations on a quantum computer" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12972" PostTypeId="1" CreationDate="2020-07-20T05:43:19.447" Score="5" ViewCount="70" Body="&lt;p&gt;Consider an entangled bipartite quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathcal{M}_d(\mathbb{C}) \otimes \mathcal{M}_{d'}(\mathbb{C})$&lt;/span&gt; which is positive under partial transposition, i.e., &lt;span class=&quot;math-container&quot;&gt;$\rho^\Gamma \geq 0$&lt;/span&gt;. As separability of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is equivalent to separability of its partial transpose &lt;span class=&quot;math-container&quot;&gt;$\rho^\Gamma$&lt;/span&gt;, we know that &lt;span class=&quot;math-container&quot;&gt;$\rho^\Gamma$&lt;/span&gt; is entangled. What are the conditions on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; which will guarantee that the sum &lt;span class=&quot;math-container&quot;&gt;$\rho + \rho^\Gamma$&lt;/span&gt; (ignoring trace normalization) is also entangled?&lt;/p&gt;&#xA;&lt;p&gt;It turns out that the above proposition does not hold for arbitrary PPT entangled states. Easiest counterexamples can be found in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}_2(\mathbb{C}) \otimes \mathcal{M}_{d}(\mathbb{C})$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho + \rho^\Gamma$&lt;/span&gt; is separable for all quantum states &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathcal{M}_2(\mathbb{C}) \otimes \mathcal{M}_d(\mathbb{C})$&lt;/span&gt; (see &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9903012.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;separability in 2xN systems&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;In the language of entanglement witnesses, the problem reduces to finding a common witness that detects both &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho^\Gamma$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; be the entanglement witness detecting &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$\text{Tr} (W\rho) &amp;lt; 0$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; is non-decomposable (as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is PPT) and is of the canonical form &lt;span class=&quot;math-container&quot;&gt;$P+Q^\Gamma - \epsilon \mathbb{I}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P, Q \geq 0$&lt;/span&gt; are such that &lt;span class=&quot;math-container&quot;&gt;$\text{range}(P) \subseteq\text{ker}(\delta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{range}(Q) \subseteq \text{ker}(\delta^\Gamma)$&lt;/span&gt; for some bipartite edge state &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; (these are special states that violate the range criterion for separability in an extreme manner, see &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.63.044304&quot; rel=&quot;nofollow noreferrer&quot;&gt;edge states&lt;/a&gt;) and &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; \epsilon \leq \text{inf}_{|e,f\rangle} \langle e,f | P+Q^\Gamma | e,f \rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is such that &lt;span class=&quot;math-container&quot;&gt;$\text{ker}(\delta) \cap \text{ker}(\delta^\Gamma)$&lt;/span&gt; is not empty, then we can choose &lt;span class=&quot;math-container&quot;&gt;$P=Q$&lt;/span&gt; to be the orthogonal projector on &lt;span class=&quot;math-container&quot;&gt;$\text{ker}(\delta) \cap \text{ker}(\delta^\Gamma)$&lt;/span&gt;, in which case &lt;span class=&quot;math-container&quot;&gt;$W=W^\Gamma$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://math.stackexchange.com/q/3753413/173147&quot;&gt;Cross-posted on math.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/565067/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="55" LastEditDate="2021-03-09T21:59:33.200" LastActivityDate="2021-03-09T21:59:33.200" Title="Finding a class $C$ of bipartite PPT states such that entanglement of $\rho \in C$ implies entanglement of $\rho + \rho^{\Gamma}$" Tags="&lt;entanglement&gt;&lt;partial-transpose&gt;&lt;entanglement-witness&gt;&lt;ppt-criterion&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12973" PostTypeId="2" ParentId="12971" CreationDate="2020-07-20T07:11:25.937" Score="3" Body="&lt;p&gt;It is referring the the &amp;quot;function variable&amp;quot; register of figure 1. It consists of &lt;span class=&quot;math-container&quot;&gt;$\log_2N$&lt;/span&gt; qubits, all prepared in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-20T07:11:25.937" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12974" PostTypeId="2" ParentId="12970" CreationDate="2020-07-20T07:21:55.437" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;My reason for asking the question is that Deutsch seems to be implying&#xA;that quantum parallelism is real, and that it can be used for&#xA;significant speedup, but my understanding is that quantum parallelism,&#xA;in this sense, does not exist.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This does not make any actual experiment or theory in his papers wrong. It's just this interpretational issue that is unresolved.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-20T07:21:55.437" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="12975" PostTypeId="2" ParentId="6499" CreationDate="2020-07-20T07:50:41.040" Score="3" Body="&lt;p&gt;Remember that the partial transpose condition is generally good for detecting entanglement, i.e. a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is certainly entangled if the partial transpose is not non-negative. In other words, if there exists a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi|I\otimes\text{T}(\rho)|\psi\rangle&amp;lt;0,&#xA;$$&lt;/span&gt;&#xA;then the state is certainly entangled.&lt;/p&gt;&#xA;&lt;p&gt;If you want to be able to distil some entanglement from &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; copies then, crudely, you'd like to look at &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; copies of the partially transposed state, and if that has a negative eigenvalue, you would be able to extract some entanglement.&lt;/p&gt;&#xA;&lt;p&gt;With that level of explanation, you'd ask why looking at more than one copy is any use -- the eigenvalues of many copies of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are easily related to the eigenvalues of a single copy. However, this is because of the extra condition that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Essentially, this is due to the fact that you're trying to project onto a Bell pair which, of course, is Schmidt rank 2.&lt;/p&gt;&#xA;&lt;p&gt;For a better understanding that the very hand-wavy suggestions I've just given, you'd want to work through page 2 of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9801069&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9801069&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-01-03T09:17:11.053" LastActivityDate="2021-01-03T09:17:11.053" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="12976" PostTypeId="1" CreationDate="2020-07-20T09:30:29.697" Score="4" ViewCount="130" Body="&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1805.10549.pdf&quot; rel=&quot;noreferrer&quot;&gt;Quantum algorithms for systems of linear equations inspired by adiabatic quantum computing&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt;, and column indices &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; returns the matrix entry:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|j\rangle|i\rangle |z\rangle \rightarrow |j\rangle|i\rangle |z \oplus A_{ji}\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;A=\left[ \begin{array}{cccccc}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \ldots &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \ldots &amp;amp; 0 \\&#xA;. &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; . \\&#xA;. &amp;amp; &amp;amp; &amp;amp; &amp;amp; &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \ldots &amp;amp; 1 &amp;amp; 0&#xA;\end{array} \right]&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$i,j=3,4$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$A_{j,i}=1$&lt;/span&gt;, whereas it's 0 for &lt;span class=&quot;math-container&quot;&gt;$i,j=3,3$&lt;/span&gt; and so on.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there a smart way to proceed in this case, and is there a general strategy one uses to implement Oracles?&lt;/p&gt;&#xA;" OwnerUserId="11551" LastActivityDate="2020-07-20T09:54:41.613" Title="How to implement an Oracle" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12977" PostTypeId="2" ParentId="12976" CreationDate="2020-07-20T09:54:41.613" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|i-j|==1$&lt;/span&gt;. This has a classical algorithm which you can figure out, and there's your oracle.&lt;/p&gt;&#xA;&lt;p&gt;In this specific instance there are probably some smarter things you can do. For instance, introduce the shift operator &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; which does &lt;span class=&quot;math-container&quot;&gt;$T|i\rangle=|i+1\text{ mod N}\rangle$&lt;/span&gt; on an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; dimensions). This gives one of the two off-diagonals. Then applying &lt;span class=&quot;math-container&quot;&gt;${T^\dagger}^2$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-20T09:54:41.613" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12978" PostTypeId="2" ParentId="12928" CreationDate="2020-07-20T12:42:15.727" Score="9" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is this clear enough? Does this answer your question or do you have more?&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-20T12:42:15.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12979" PostTypeId="1" CreationDate="2020-07-20T12:51:59.303" Score="3" ViewCount="141" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Note: I have run successful calculations for all these molecules using the state-vector simulator with no issues.&lt;/p&gt;&#xA;&lt;p&gt;Here is the function i use to calculate energy via VQE given a molecule (created from PySCF driver):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def calc_vqe_energy(molecule):&#xA;  driver = molecule&#xA;&#xA;  energy = MolecularGroundStateEnergy(driver = driver, &#xA;                                      transformation=TransformationType('full'), &#xA;                                      qubit_mapping=QubitMappingType('parity'), &#xA;                                      two_qubit_reduction=True, &#xA;                                      freeze_core=False, &#xA;                                      z2symmetry_reduction='auto')&#xA;    &#xA;  solver = energy.get_default_solver(quantum_instance)&#xA;    &#xA;  #calculate energy using the above solver &#xA;  calc = energy.compute_energy(solver)&#xA;  return calc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;this is set up to run using the quantum instance:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account(token)&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = provider.get_backend(&amp;quot;ibmq_qasm_simulator&amp;quot;)&#xA;coupling_map = backend.configuration().coupling_map&#xA;quantum_instance = QuantumInstance(backend=backend, shots=1000,&#xA;                                   coupling_map=coupling_map,&#xA;                                   measurement_error_mitigation_cls=CompleteMeasFitter,&#xA;                                   cals_matrix_refresh_period=30, skip_qobj_validation=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="12714" LastEditorUserId="55" LastEditDate="2020-07-26T20:07:54.823" LastActivityDate="2021-04-22T21:18:36.760" Title="VQE jobs do not appear in queue" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12980" PostTypeId="2" ParentId="12979" CreationDate="2020-07-20T13:22:53.743" Score="0" Body="&lt;p&gt;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.&lt;br /&gt;&#xA;If you want to see your job status or monitor it, you can try to use the method &lt;code&gt;job.status()&lt;/code&gt; (see details &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.BaseJob.html#qiskit.providers.BaseJob&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) or try the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.tools.job_monitor.html#qiskit.tools.job_monitor&quot; rel=&quot;nofollow noreferrer&quot;&gt;job monitor&lt;/a&gt;, you can see if it fails or if it runs with those.&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-20T13:22:53.743" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12981" PostTypeId="1" CreationDate="2020-07-20T14:50:24.330" Score="1" ViewCount="92" Body="&lt;p&gt;If&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{+} = |+\rangle\langle+|=\frac{1}{2}(|0\rangle\langle0|+|0\rangle\langle1|+|1\rangle\langle0| +|1\rangle\langle1|)$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{-} = |-\rangle\langle-|=\frac{1}{2}(|0\rangle\langle0|-|0\rangle\langle1|-|1\rangle\langle0| +|1\rangle\langle1|),$$&lt;/span&gt;&#xA;then we can choose &lt;span class=&quot;math-container&quot;&gt;$\lambda_{+}=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_{-}=-1$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$\begin {bmatrix}0&amp;amp;1\\ 1&amp;amp;0\end{bmatrix}$&lt;/span&gt; is a hermitian operator for single qubit measurement in the hadamard basis.&lt;/p&gt;&#xA;&lt;p&gt;My confusion is about what this even means? Surely measurement in the hadamard basis simply involves the application of the associated projectors &lt;span class=&quot;math-container&quot;&gt;$P_{+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_{-}$&lt;/span&gt; to whatever state you possess, with &lt;span class=&quot;math-container&quot;&gt;$\frac{P_{i}|\psi\rangle}{\sqrt{tr(P_{i}|\psi\rangle\langle\psi|P_{i})}}$&lt;/span&gt; giving the new state and &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|P_{i}|\psi\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;I just don't see what use the above operator has, beyond maybe making it clear that &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\to|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle\to-|-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-09-25T11:42:19.630" LastActivityDate="2020-09-25T11:42:19.630" Title="Meaning behind obtaining a hermitian operator for measurement in another basis?" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12982" PostTypeId="2" ParentId="12981" CreationDate="2020-07-20T16:43:13.267" Score="2" Body="&lt;p&gt;The reason for this viewpoint on measurement is primarily historical. Physicists often think of measurements in terms of &lt;em&gt;observables&lt;/em&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$$M=\sum_i \lambda_i P_i,$$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;'s are the &lt;em&gt;real&lt;/em&gt; eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; (historically the eigenvalues were relevant measurable quantities in some physical experiment, which is the reason why this viewpoint exists) and each &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; is the orthogonal projection onto the corresponding eigenspace.&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;em&gt;measuring the observable and obtaining the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;&lt;/em&gt; is analogous to &lt;em&gt;measuring the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th outcome of the projective measurement&lt;/em&gt; (this projective measurement is exactly the one defined by &lt;span class=&quot;math-container&quot;&gt;$\sum_i P_i=I$&lt;/span&gt;). Another common viewpoint is to define the &lt;em&gt;expected value of an observable acting on a state&lt;/em&gt; by the formula &lt;span class=&quot;math-container&quot;&gt;$$E(\lambda_i)=tr(M|\psi\rangle \langle \psi|),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$E(\lambda_i)$&lt;/span&gt; is called the &lt;em&gt;expected value&lt;/em&gt; of obtaining the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-08-02T18:06:13.610" LastActivityDate="2020-08-02T18:06:13.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12983" PostTypeId="2" ParentId="12981" CreationDate="2020-07-20T16:54:19.700" Score="0" Body="&lt;p&gt;You can think of an observable as giving you a more &lt;em&gt;coarse-grained&lt;/em&gt; type of information than a projective measurement.&lt;/p&gt;&#xA;&lt;p&gt;A projective measurement &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt; amounts to asking &lt;em&gt;in which of these states am I going to find the system?&lt;/em&gt; The answer to this question is of course probabilistic in general, and thus in practice you would find sometimes the state corresponding to &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;, sometimes the state corresponding to &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt;, etc.&lt;/p&gt;&#xA;&lt;p&gt;Suppose now you have an observable written as &lt;span class=&quot;math-container&quot;&gt;$A=\sum_k \lambda_k P_k$&lt;/span&gt;. Compute the expectation value of this observable amounts to doing the above projective measurement &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt;, then attaching the value &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is smaller than that you get from &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-07-20T16:54:19.700" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="12984" PostTypeId="1" AcceptedAnswerId="12987" CreationDate="2020-07-20T21:48:04.337" Score="2" ViewCount="69" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;) makes a Bell measurement on a Bell state it has from before along with &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; together with its Bell state have any bearing on the indices of the Bell state, considering &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is not involved in the Bell measurement?&lt;/p&gt;&#xA;" OwnerUserId="12718" LastEditorUserId="491" LastEditDate="2020-07-21T10:39:14.547" LastActivityDate="2020-07-22T06:54:13.323" Title="How does Bell measurement work in the teleportation?" Tags="&lt;teleportation&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12985" PostTypeId="1" AcceptedAnswerId="12993" CreationDate="2020-07-21T05:18:15.987" Score="1" ViewCount="58" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there an analogous method for OpenPulse Schedules?&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;If not, has anyone come up with a &amp;quot;schedule qasm&amp;quot; workaround/hack for the time being?&lt;/p&gt;&#xA;" OwnerUserId="2895" LastEditorUserId="55" LastEditDate="2020-07-26T20:08:31.307" LastActivityDate="2020-07-26T20:08:31.307" Title="Is there a standard way to save pulse schedules akin to a qasm for a circuit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;qasm&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12986" PostTypeId="2" ParentId="12984" CreationDate="2020-07-21T07:00:13.963" Score="3" Body="&lt;p&gt;Perhaps the following diagram helps to show what acts where. I think you've got a little muddled.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QKYbL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QKYbL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-21T07:00:13.963" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12987" PostTypeId="2" ParentId="12984" CreationDate="2020-07-21T10:10:29.250" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;So, you see the controlled-NOT acts as an &lt;em&gt;entangling operator&lt;/em&gt; without affecting the first qubit (here &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;) and changing the entangled Bell state and hence its measurement outcome.&lt;/p&gt;&#xA;" OwnerUserId="12624" LastEditorUserId="9006" LastEditDate="2020-07-22T06:54:13.323" LastActivityDate="2020-07-22T06:54:13.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12988" PostTypeId="1" CreationDate="2020-07-21T11:02:04.163" Score="0" ViewCount="314" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;What is the best way to gain access to the Slack group?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&lt;p&gt;Link to IBMQ support page: &lt;a href=&quot;https://quantum-computing.ibm.com/support&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/support&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12714" LastActivityDate="2020-07-26T03:37:35.250" Title="IBMQ / Qiskit slack links are broken" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2020-07-26T11:49:18.640" ContentLicense="CC BY-SA 4.0" />
  <row Id="12991" PostTypeId="1" AcceptedAnswerId="12992" CreationDate="2020-07-21T13:27:38.720" Score="1" ViewCount="55" Body="&lt;p&gt;Given a mixed state with a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit density matrix of the following structure:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\pmatrix{\lambda_1&amp;amp;&amp;amp;&amp;amp;&amp;amp;\nu\\&amp;amp;\lambda_2\\ &amp;amp;&amp;amp;\lambda_{\dots}\\ &amp;amp;&amp;amp;&amp;amp;\lambda_2\\ \nu&amp;amp;&amp;amp;&amp;amp;&amp;amp;\lambda_1},&#xA;$$&lt;/span&gt;&#xA;so a mixture of a GHZ state and a sum of diagonal contributions of the form: &lt;span class=&quot;math-container&quot;&gt;$\prod Z_k^{x_k}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x_k$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;th bit of the binary number &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;, which is restricted to contain an even number of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s. The latter restriction ensures that the matrix is symmetric w.r.t. the anti-diagonal.&lt;/p&gt;&#xA;&lt;p&gt;If all &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; are equal, there is a way to measure exponentially small amounts of the GHZ state, as proposed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12934/5280&quot;&gt;here&lt;/a&gt;. It looks to me, that my states don't respect the graph diagonal state requirement given in the comments.&lt;/p&gt;&#xA;&lt;p&gt;What is the best lower bound for &lt;span class=&quot;math-container&quot;&gt;$\nu$&lt;/span&gt;, that is efficiently measurable (involving polynomially many measurements)?&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-07-21T13:35:37.823" LastActivityDate="2020-07-21T13:57:09.880" Title="Lower Bound to Measure Entanglement in Mixed States" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12992" PostTypeId="2" ParentId="12991" CreationDate="2020-07-21T13:57:09.880" Score="2" Body="&lt;p&gt;As soon as you impose that &lt;span class=&quot;math-container&quot;&gt;$\lambda_x=\lambda_{\bar x}$&lt;/span&gt;, your state is of the form that my previous results apply to. This is because you can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|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|),&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$y\in\{0,1\}^n$&lt;/span&gt; be the choice that gives the largest value of &lt;span class=&quot;math-container&quot;&gt;$\lambda_y$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$y\neq 000\ldots 0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$111\ldots 1$&lt;/span&gt;). Choose &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; to specify your bipartition of the qubits. This is entangled when &lt;span class=&quot;math-container&quot;&gt;$\lambda_y&amp;lt;\nu$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-21T13:57:09.880" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12993" PostTypeId="2" ParentId="12985" CreationDate="2020-07-21T14:18:37.003" Score="1" Body="&lt;p&gt;I believe there are several developments about this on Qiskit to make the use of Pulse easier. Try to check the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pulls&quot; rel=&quot;nofollow noreferrer&quot;&gt;PR&lt;/a&gt; or the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues?q=is%3Aissue+is%3Aopen+pulse&quot; rel=&quot;nofollow noreferrer&quot;&gt;issues&lt;/a&gt; regarding Pulse, maybe you'll find what you are looking for.&lt;br /&gt;&#xA;I also found an &lt;a href=&quot;https://github.com/qiskit-community/qiskit-camp-asia-19/issues/28&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt; about a QASM 3.0, I think this will interest you! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-07-21T14:18:37.003" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12994" PostTypeId="2" ParentId="12928" CreationDate="2020-07-21T15:21:52.900" Score="3" Body="&lt;p&gt;It sounds like the source of your misunderstanding is the following&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Bob is able to harness the information of a qubit which contains more information than regular classical bits&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This statement is not true. There is a theorem known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's theorem&lt;/a&gt; which states that the maximum information that can be obtained from a single qubit is one bit.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastActivityDate="2020-07-21T15:21:52.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12995" PostTypeId="1" CreationDate="2020-07-21T20:09:22.723" Score="0" ViewCount="97" Body="&lt;p&gt;I have 2 qubits which are in an unknown &lt;em&gt;pure&lt;/em&gt; state i.e. their density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be expressed as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let the initial state be &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = c_{00}|00\rangle + c_{01}|01\rangle + c_{10}|10\rangle + c_{11}|11\rangle$&lt;/span&gt;. These coefficients &lt;span class=&quot;math-container&quot;&gt;$c_{i}$&lt;/span&gt; are unknown.&lt;/p&gt;&#xA;&lt;p&gt;I wish to find out if they are entangled or seperable? Can this be done by constructing a Quantum Oracle or some other circuit?&lt;/p&gt;&#xA;&lt;p&gt;The Rules are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We do not have access to the circuit which created this state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The initial state of the qubits can be destroyed at the end of the measurement.&lt;/li&gt;&#xA;&lt;li&gt;Any method which has &lt;span class=&quot;math-container&quot;&gt;$&amp;gt;0.5$&lt;/span&gt; chance of success is acceptable.&lt;/li&gt;&#xA;&lt;li&gt;Free to use ancillary qubits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Edit: I have tried to rewrite the question in order to clarify it as per suggestions in the comments.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-07-23T04:04:09.057" LastActivityDate="2020-07-23T04:04:09.057" Title="Is there a way to construct a quantum circuit/oracle to check if 2 qubits in an unknown pure state are entangled?" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="12996" PostTypeId="2" ParentId="12995" CreationDate="2020-07-21T20:20:07.623" Score="2" Body="&lt;p&gt;No.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if I either give you &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; with 50% probability each, or &lt;span class=&quot;math-container&quot;&gt;$|00\rangle\pm|11\rangle$&lt;/span&gt; with 50% probability each, there is no way to distinguish these two cases - not even with any whatsoever small probability. The &lt;em&gt;mathematical&lt;/em&gt; reason is that those are described by the same density matrix - but you always get some &lt;em&gt;&lt;strong&gt;pure&lt;/strong&gt;&lt;/em&gt; state!&lt;/p&gt;&#xA;&lt;p&gt;However, one of those sets consists of entangled states, while the other one doesn't.&lt;/p&gt;&#xA;&lt;p&gt;The situation is different if you get the same state several times and can do a number of tests on each of those copies.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-07-21T21:27:48.180" LastActivityDate="2020-07-21T21:27:48.180" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="12997" PostTypeId="2" ParentId="12988" CreationDate="2020-07-21T20:22:55.677" Score="2" Body="&lt;p&gt;This link was shared in the Qiskit Global Summer School Discord channel.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://join.slack.com/t/qiskit/shared_invite/zt-fybmq791-hYRopcSH6YetxycNPXgv%7EA&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://join.slack.com/t/qiskit/shared_invite/zt-fybmq791-hYRopcSH6YetxycNPXgv~A&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope this works for you!&lt;/p&gt;&#xA;" OwnerUserId="12728" LastActivityDate="2020-07-21T20:22:55.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="12998" PostTypeId="1" AcceptedAnswerId="13002" CreationDate="2020-07-21T23:34:29.037" Score="2" ViewCount="112" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt; state, creating the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}} \sum_{x\in\{0,1\}^n}|x\rangle$&lt;/span&gt; state. I'm reading this from the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/simon.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10388" LastActivityDate="2020-07-23T08:21:18.993" Title="N-Qubit Hadamard vs Quantum Fourier Transform" Tags="&lt;quantum-fourier-transform&gt;&lt;hadamard&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="12999" PostTypeId="1" AcceptedAnswerId="13000" CreationDate="2020-07-22T00:53:00.947" Score="3" ViewCount="90" Body="&lt;p&gt;I have an extension to the following question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11354/how-to-get-the-relative-phase-of-a-qubit&quot;&gt;How to get the relative phase of a qubit?&lt;/a&gt;&#xA;How do I get the relative phase of a pair of entangled qubits such as &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(|00\rangle+e^{i\theta}|11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11644" LastActivityDate="2020-07-22T09:20:41.083" Title="How to get the relative phase of an entangled pair of qubits" Tags="&lt;algorithm&gt;&lt;entanglement&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13000" PostTypeId="2" ParentId="12999" CreationDate="2020-07-22T03:56:28.627" Score="5" Body="&lt;ol&gt;&#xA;&lt;li&gt;Apply a CNOT gate with one of the qubits as control and the other as target. You'll get&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle) \otimes |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Use the methodology from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11354/how-to-get-the-relative-phase-of-a-qubit&quot;&gt;How to get the relative phase of a qubit?&lt;/a&gt; for the first qubit :-)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2020-07-22T09:20:41.083" LastActivityDate="2020-07-22T09:20:41.083" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13001" PostTypeId="1" CreationDate="2020-07-22T06:05:52.287" Score="1" ViewCount="81" Body="&lt;p&gt;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”.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Has this been addressed before? Am I doing something wrong? Is there a solution?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12676" LastEditorUserId="9006" LastEditDate="2020-07-22T06:43:02.893" LastActivityDate="2020-07-22T10:26:58.237" Title="CSV files cut results short in ibm-q-experience?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13002" PostTypeId="2" ParentId="12998" CreationDate="2020-07-22T06:40:54.697" Score="3" Body="&lt;p&gt;As you pointed out correctly, both &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; and QFT applied on input state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; return state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n}|i\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is no special reason why &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit Hadamard gate cannot replace QFT for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; input. Maybe, an author of article about Simon's algorithm wanted to be more precise.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Overall, it does not matter which approach you use. Both return same result for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; input.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; (based on &lt;em&gt;DaftWullie&lt;/em&gt; comment): However, in practice &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits Hadamard is prefered as it is very simple circuit in comparison with QFT.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-07-23T08:21:18.993" LastActivityDate="2020-07-23T08:21:18.993" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13003" PostTypeId="2" ParentId="13001" CreationDate="2020-07-22T08:13:46.117" Score="2" Body="&lt;p&gt;I think the problem you are experiencing comes from Excel and not IBM Quantum Experience. Check &lt;a href=&quot;https://support.microsoft.com/en-us/help/269370/last-digits-are-changed-to-zeroes-when-you-type-long-numbers-in-cells&quot; rel=&quot;nofollow noreferrer&quot;&gt;this explanation&lt;/a&gt;, it explains why the bug you have happens, and ways to work around it.&lt;br /&gt;&#xA;Hope this will help :)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt; : I think I found another workaround to your problem. Try this and tell me if this works for you:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Download the CSV file but don't touch it yet.&lt;/li&gt;&#xA;&lt;li&gt;Open a new Excel file.&lt;/li&gt;&#xA;&lt;li&gt;Click the &amp;quot;Data&amp;quot; tab, then click on &amp;quot;Get data&amp;quot; on the upper left, then &amp;quot;From file&amp;quot;, then &amp;quot;From text/CSV&amp;quot;.&lt;/li&gt;&#xA;&lt;li&gt;Choose your CSV file you want to download.&lt;/li&gt;&#xA;&lt;li&gt;Normally, at this point you should have a window popping to your screen, and at the bottom of it 3 buttons, &amp;quot;Load&amp;quot;, &amp;quot;Transform data&amp;quot;, and &amp;quot;Cancel&amp;quot;. Click on &amp;quot;Transform data&amp;quot;.&lt;/li&gt;&#xA;&lt;li&gt;Select the first column (the one with all the states) then click on the &amp;quot;Transform&amp;quot; tag at the top of the window, you should have an option right below &amp;quot;Data type : Decimal number&amp;quot;. Click on this and select &amp;quot;Text&amp;quot;. Click on &amp;quot;File&amp;quot; and select &amp;quot;Close and load&amp;quot;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="12396" LastEditDate="2020-07-22T10:26:58.237" LastActivityDate="2020-07-22T10:26:58.237" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13004" PostTypeId="2" ParentId="12928" CreationDate="2020-07-22T08:19:53.443" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12191" LastEditorUserId="12191" LastEditDate="2020-07-22T08:45:49.903" LastActivityDate="2020-07-22T08:45:49.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13005" PostTypeId="1" CreationDate="2020-07-22T08:36:34.400" Score="1" ViewCount="65" Body="&lt;p&gt;Let us suppose that I have the state&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\frac{1}{\sqrt2}(\alpha|0\rangle|+\rangle+\beta|1\rangle|-\rangle) &#xA;\end{equation}&lt;/span&gt;&#xA;and I choose to measure the first qubit in the basis &lt;span class=&quot;math-container&quot;&gt;$\{(1/\sqrt{2})(|0\rangle\pm e^{i\phi}|1\rangle)\}$&lt;/span&gt;.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="12731" LastEditorUserId="55" LastEditDate="2020-07-22T16:21:00.353" LastActivityDate="2020-07-22T16:21:00.353" Title="How do I measure a single qubit in a two-qubit state?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13006" PostTypeId="2" ParentId="13005" CreationDate="2020-07-22T09:01:12.083" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P_{\pm}$&lt;/span&gt; be the projectors onto the two orthonormal basis states of the measurement. So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|).&#xA;$$&lt;/span&gt;&#xA;Also, let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be the state that you're measuring (note that this must be normalised. Yours might be depending on your constraints on &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, but we wouldn't usually have a factor of &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt; present).&lt;/p&gt;&#xA;&lt;p&gt;Since you are measuring the first qubit of two, the actual projectors should be written as &lt;span class=&quot;math-container&quot;&gt;$P_\pm\otimes I$&lt;/span&gt;. Now, we get the + result with probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_+=\langle\psi |P_+\otimes I|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;and if the result is &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt;, the state after measurement is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(P_+\otimes I)|\psi\rangle/\sqrt{p_+}.&#xA;$$&lt;/span&gt;&#xA;In this case, &lt;span class=&quot;math-container&quot;&gt;$p_+=p_-=\frac12$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-22T09:01:12.083" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13007" PostTypeId="1" CreationDate="2020-07-22T09:36:32.790" Score="1" ViewCount="82" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-09-25T11:41:59.857" LastActivityDate="2020-09-25T11:41:59.857" Title="A question about quantum noise model" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;error-correction&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13008" PostTypeId="1" CreationDate="2020-07-22T11:44:55.923" Score="3" ViewCount="146" Body="&lt;p&gt;Why do quantum operations need to be reversible?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12099" LastEditorUserId="55" LastEditDate="2020-07-22T16:06:16.003" LastActivityDate="2020-07-23T07:31:37.860" Title="Why do quantum operations need to be reversible?" Tags="&lt;quantum-gate&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13009" PostTypeId="2" ParentId="13008" CreationDate="2020-07-22T11:58:15.717" Score="5" Body="&lt;p&gt;&amp;quot;Why&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;A second postulate is &lt;em&gt;essentially&lt;/em&gt; 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.)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;(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!)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-07-23T07:31:37.860" LastActivityDate="2020-07-23T07:31:37.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13011" PostTypeId="2" ParentId="13008" CreationDate="2020-07-22T16:17:13.780" Score="1" Body="&lt;p&gt;Not all quantum operations are reversible. Consider for example the quantum channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)=\operatorname{tr}(\rho)\sigma$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The operations that are reversible are the ones described by &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Unitary_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary operators&lt;/a&gt;&lt;/em&gt; (or in the density matrix formalism, by maps of the form &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto U\rho U^\dagger$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; unitary). Any operation mapping pure states to pure states is going to be unitary.&#xA;These are the operations describing the evolution of a quantum state without loss of information.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-07-22T16:17:13.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13012" PostTypeId="1" AcceptedAnswerId="13084" CreationDate="2020-07-22T17:08:08.410" Score="1" ViewCount="126" Body="&lt;p&gt;In general, an entangled state is one which cannot be decomposed as &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}p_{i} \bigl(\rho_{i}^A\otimes\rho_{i}^B\bigr)$&lt;/span&gt;. But such an entangled state could still be mixed in principle.&lt;/p&gt;&#xA;&lt;p&gt;How would one create a &lt;em&gt;mixed&lt;/em&gt; entangled state? For instance, can one create such a state by tracing out one qubit or a subsystem of a pure state?&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="124" LastEditDate="2020-07-29T10:35:53.407" LastActivityDate="2020-07-29T10:35:53.407" Title="How does one go about constructing a mixed entangled state?" Tags="&lt;entanglement&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13013" PostTypeId="1" AcceptedAnswerId="13020" CreationDate="2020-07-22T17:56:15.237" Score="2" ViewCount="111" Body="&lt;p&gt;Define &lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$\ket\psi,\ket\phi$&lt;/span&gt; be two bipartite states such that &lt;span class=&quot;math-container&quot;&gt;$\tr_2(\PP_\psi)\prec\tr_2(\PP_\phi)$&lt;/span&gt;.&#xA;Here, &lt;span class=&quot;math-container&quot;&gt;$A\prec B$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; positive operators means that the vector of eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is majorised by that of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$A\preceq B\Longleftrightarrow\lambda(A)\preceq\lambda(B)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A step to prove &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9811053&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen's theorem&lt;/a&gt;, used in the proof of the theorem given &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/LectureNotes/CS766.Fall2011/16.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (pdf alert) is that &lt;span class=&quot;math-container&quot;&gt;$\tr_2(\PP_\psi)\prec\tr_2(\PP_\phi)$&lt;/span&gt; implies &lt;span class=&quot;math-container&quot;&gt;$\tr_2(\PP_\psi)=\Psi(\tr_2(\PP_\phi))$&lt;/span&gt; for some mixed unitary channel &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;.&#xA;More precisely, it implies that &lt;span class=&quot;math-container&quot;&gt;$\tr_2(\PP_\psi)=\Psi( W\tr_2(\PP_\phi)W^\dagger)$&lt;/span&gt; for some mixed unitary channel &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; and isometry &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; (though these two statements seem pretty much equivalent to me).&lt;/p&gt;&#xA;&lt;p&gt;To show this, an important observation seems to be the fact that, introducing the operators &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt; with components &lt;span class=&quot;math-container&quot;&gt;$X_{ij}=\psi_{ij}, Y_{ij}=\phi_{ij}$&lt;/span&gt; (that is, &lt;span class=&quot;math-container&quot;&gt;$\ket\psi= \operatorname{vec}(X)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\phi= \operatorname{vec}(Y)$&lt;/span&gt;), we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tr_2(\PP_\psi) = XX^\dagger,\qquad \tr_2(\PP_\phi) = YY^\dagger.$$&lt;/span&gt;&#xA;Suitably defining the underlying vector spaces, we can always assume &lt;span class=&quot;math-container&quot;&gt;$XX^\dagger ,YY^\dagger &amp;gt;0$&lt;/span&gt;. Moreover, &lt;span class=&quot;math-container&quot;&gt;$XX^\dagger\prec YY^\dagger$&lt;/span&gt; implies &lt;span class=&quot;math-container&quot;&gt;$\operatorname{rank}(XX^\dagger)\ge\operatorname{rank}(YY^\dagger)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why does this imply that the existence of a mixed unitary channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; and isometry &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$XX^\dagger = \Psi(WYY^\dagger W^\dagger)$&lt;/span&gt;? The reason is probably trivial but I'm not seeing it right now.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-28T13:36:44.357" LastActivityDate="2020-07-28T13:36:44.357" Title="Prove that $A\preceq B$ implies $A=\Psi(B)$ for some channel $\Psi$" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;&lt;locc-operation&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13014" PostTypeId="5" CreationDate="2020-07-22T17:57:40.580" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-22T17:57:40.580" LastActivityDate="2020-07-22T17:57:40.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13015" PostTypeId="4" CreationDate="2020-07-22T17:57:40.580" Score="0" Body="For questions related to quantum operation obtainable via local operations and classical communication." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-22T17:57:40.580" LastActivityDate="2020-07-22T17:57:40.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13016" PostTypeId="2" ParentId="12916" CreationDate="2020-07-22T18:00:39.650" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12624" LastEditorUserId="2293" LastEditDate="2021-04-16T21:05:33.147" LastActivityDate="2021-04-16T21:05:33.147" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13017" PostTypeId="2" ParentId="12995" CreationDate="2020-07-22T18:33:56.230" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\calU}{\mathcal{U}}\newcommand{\ket}[1]{\lvert#1\rangle}$&lt;/span&gt;Suppose such a circuit existed, and denote with &lt;span class=&quot;math-container&quot;&gt;$\calU$&lt;/span&gt; the unitary describing its overall action.&#xA;For this to be a &amp;quot;circuit detecting entanglement&amp;quot;, there should be two types of output states, one corresponding to the answer &amp;quot;&lt;em&gt;yes, the input was entangled&lt;/em&gt;&amp;quot; and the other corresponding to the answer &amp;quot;&lt;em&gt;no, the input was not entangled&lt;/em&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;In other words, there should be two orthogonal subspaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal V_e$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal V_{ne}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\calU\lvert\psi\rangle\in\mathcal V_e$&lt;/span&gt; for all entangled states &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\calU\lvert\phi\rangle\in\mathcal V_{ne}$&lt;/span&gt; for all separable &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_1},\ket{\psi_2}$&lt;/span&gt; be two orthogonal separable states, so that &lt;span class=&quot;math-container&quot;&gt;$\calU\ket{\psi_i}\in\mathcal V_{ne}$&lt;/span&gt;. Then, by linearity, we must also have &lt;span class=&quot;math-container&quot;&gt;$\calU(\alpha\ket{\psi_1}+\beta\ket{\psi_2})\in\mathcal V_{ne}$&lt;/span&gt; for any pair of complex coefficients with &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-07-22T18:33:56.230" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13018" PostTypeId="1" CreationDate="2020-07-22T19:24:26.733" Score="3" ViewCount="75" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bob and Alice decide on 2 different bases to encode quantum states&lt;/li&gt;&#xA;&lt;li&gt;Alice chooses a basis and a random bit to prepare a qubit and transmits the prepared qubit to Bob.&lt;/li&gt;&#xA;&lt;li&gt;Bob randomly chooses a basis to measure the received qubit in&lt;/li&gt;&#xA;&lt;li&gt;Alice and Bob communicate over a classical channel and figure out which bits they measured with the same basis&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; be the number of qubits Alice and Bob measure in the same basis. This means that Eve has &lt;span class=&quot;math-container&quot;&gt;$0.75^n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;While the probability of Eve measuring the key correctly scales exponentially with respect to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, it seems like this algorithm is not safe unless roughly &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; 1000$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4186/how-many-bits-do-alice-and-bob-needs-to-compare-to-make-sure-the-channel-is-secu&quot;&gt;This&lt;/a&gt; is an answer to a similar question but does not answer my final question.&lt;/p&gt;&#xA;" OwnerUserId="12736" LastActivityDate="2020-07-23T07:26:10.513" Title="Can Eve randomly guess the correct bases in the BB84 exchange of a one-time pad?" Tags="&lt;bb84&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13020" PostTypeId="2" ParentId="13013" CreationDate="2020-07-22T22:55:08.943" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{d}, \sigma_{d}$&lt;/span&gt;  be the (simultaneously diagonal) density matrices whose eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\{ p_{j} \}, \{ q_{j} \}$&lt;/span&gt;, respectively (represented as probability vectors below). Then, if &lt;span class=&quot;math-container&quot;&gt;$\vec{p} \succ \vec{q}$&lt;/span&gt;, the following sequence of arguments can be observed:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There exists a bistochastic matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$M \vec{p} = \vec{q}$&lt;/span&gt; (basic result of majorization theory, see &lt;a href=&quot;https://link.springer.com/book/10.1007/978-0-387-68276-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Marshall and Olkin&lt;/a&gt;, for example.)&lt;/li&gt;&#xA;&lt;li&gt;Using &lt;a href=&quot;https://en.wikipedia.org/wiki/Doubly_stochastic_matrix#Birkhoff_polytope_and_Birkhoff.E2.80.93von_Neumann_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Birkhoff's theorem&lt;/a&gt;, the bistochastic can be written as a convex combination of permutations: &lt;span class=&quot;math-container&quot;&gt;$M = \sum\limits_{j} r_{j} P_{j}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; can be ``quantized'' into a (&lt;strong&gt;mixed unitary&lt;/strong&gt;) CPTP map, &lt;span class=&quot;math-container&quot;&gt;$M \mapsto \mathcal{M} = \sum\limits_{j} r_{j} \mathcal{U}_{P_{j}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}_{P_{j}}$&lt;/span&gt; is the unitary superoperator, defined as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}_{P_{j}}(\cdot) = P_{j} (\cdot) P_{j}^{\dagger}$&lt;/span&gt;. Recall that permutations have a unitary representation.&lt;/li&gt;&#xA;&lt;li&gt;The action of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; is to transform &lt;span class=&quot;math-container&quot;&gt;$\rho_{d} \mapsto \sigma_{d}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Why can we start from simultaneously diagonal states &lt;span class=&quot;math-container&quot;&gt;$\rho_{d}, \sigma_{d}$&lt;/span&gt;? Hint: the partial trace.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1609.02439&quot; rel=&quot;nofollow noreferrer&quot;&gt;coherence&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1309.6586&quot; rel=&quot;nofollow noreferrer&quot;&gt;non-uniformity&lt;/a&gt;, etc.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-07-23T20:22:55.520" LastActivityDate="2020-07-23T20:22:55.520" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13024" PostTypeId="1" CreationDate="2020-07-23T03:33:39.210" Score="1" ViewCount="123" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The answer can be Circuit Diagram or Implementation in any Quantum Programming Language (Q#, Qiskit etc)&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-07-24T08:29:29.660" Title="Circuit for implementing Steane's code for Quantum Error Correction" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13025" PostTypeId="2" ParentId="13024" CreationDate="2020-07-23T07:10:05.613" Score="1" Body="&lt;p&gt;One way of defining the Steane code is via its stabilizers. There's a set of operators &lt;span class=&quot;math-container&quot;&gt;$\{K_n\}_{n=1}^6$&lt;/span&gt; which all commute, such that a state in the code space is defined by being the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of all these operators.&lt;/p&gt;&#xA;&lt;p&gt;So, you can perform syndrome extraction simply by measuring the value of each stabilizer. This is a standard circuit,&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FhTmv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FhTmv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;(the &lt;span class=&quot;math-container&quot;&gt;$\sigma_1\otimes\ldots\otimes\sigma_n$&lt;/span&gt; corresponds to a single &lt;span class=&quot;math-container&quot;&gt;$K_i$&lt;/span&gt; term in this setting).&lt;/p&gt;&#xA;&lt;p&gt;One very simple way that you can produce a codeword in the code space is simply to start with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as &lt;em&gt;any&lt;/em&gt; state you want. Perform syndrome extraction and error correction on it, and the result must be a word in the space.&lt;/p&gt;&#xA;&lt;p&gt;In fact, if you set &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|0000000\rangle$&lt;/span&gt;, you'll get the logical 0 state because this is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of &lt;span class=&quot;math-container&quot;&gt;$Z^{\otimes 7}$&lt;/span&gt;. Moreover, this state is already the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of all the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizers so you don't have to measure any of those.&lt;/p&gt;&#xA;&lt;p&gt;There do exist unitary encoding methods, but from the conceptual point of view, this is a very simple method that generalises to &lt;em&gt;any&lt;/em&gt; stabilizer code.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-07-24T08:29:29.660" LastActivityDate="2020-07-24T08:29:29.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13026" PostTypeId="2" ParentId="13018" CreationDate="2020-07-23T07:26:10.513" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In the context of today's communication, 1000 bits is a &lt;em&gt;very&lt;/em&gt; 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. &lt;em&gt;large&lt;/em&gt; volumes, or even continuously generated data. Just think what value &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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). &lt;span class=&quot;math-container&quot;&gt;$n=8\times (1024)^3\approx 9\times 10^9$&lt;/span&gt;. Put that in your exponential!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-23T07:26:10.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13027" PostTypeId="2" ParentId="13012" CreationDate="2020-07-23T09:58:47.897" Score="1" Body="&lt;p&gt;A mixed separable state is written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_ip_i\sigma^A_i\otimes\sigma^B_i&#xA;$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; are valid density matrices on a single site.&lt;/p&gt;&#xA;&lt;p&gt;The example you give, say &lt;span class=&quot;math-container&quot;&gt;$\rho=\frac12|00\rangle\langle00|+\frac12|11\rangle\langle 11|$&lt;/span&gt; is exactly of this form. Specifically,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;The classic example is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Werner_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Werner state&lt;/a&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\frac{1-p}{4}I+p|\psi\rangle\langle\psi|&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a two-qubit Bell state. This can be written out as a matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\left(\begin{array}{cccc}&#xA;\frac{1-p}{4} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \frac{1+p}{4} &amp;amp; -\frac{p}{2}  &amp;amp; 0 \\&#xA;0 &amp;amp; -\frac{p}{2} &amp;amp; \frac{1+p}{4} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1-p}{4}&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;If we take the partial transpose of this, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho^T=\left(\begin{array}{cccc}&#xA;\frac{1-p}{4} &amp;amp; 0 &amp;amp; 0 &amp;amp; -\frac{p}{2} \\&#xA;0 &amp;amp; \frac{1+p}{4} &amp;amp; 0  &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \frac{1+p}{4} &amp;amp; 0 \\&#xA;-\frac{p}{2} &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1-p}{4}&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;This has a negative eigenvalue if &lt;span class=&quot;math-container&quot;&gt;$p/2&amp;gt;(1-p)/4$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-23T09:58:47.897" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="13028" PostTypeId="2" ParentId="12660" CreationDate="2020-07-23T11:00:35.547" Score="1" Body="&lt;p&gt;To see intuitively why this protocol increases the entanglement after each iteration, we can work out an example where our initial state is say &lt;span class=&quot;math-container&quot;&gt;$\lvert 00\rangle+\lvert 11\rangle$&lt;/span&gt;. Upon passing through a 50:50 Beam Splitter, we get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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 \\&#xA;=|00\rangle + \frac{i}{\sqrt2}(|20\rangle+|02\rangle)$$&lt;/span&gt;&#xA;(Ignore normalisation in the above equations)&#xA;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.&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\frac{1}{\cosh{r}}\sum^{\infty}_{n=0} (-1)^{n}e^{in\phi}\tanh^{n}r |n,n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11668" LastEditorUserId="4622" LastEditDate="2020-08-23T15:12:48.600" LastActivityDate="2020-08-23T15:12:48.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13029" PostTypeId="1" AcceptedAnswerId="13030" CreationDate="2020-07-23T11:32:28.360" Score="2" ViewCount="70" Body="&lt;p&gt;I have heard this is the case but can not find a source even discussing this.&lt;/p&gt;&#xA;&lt;p&gt;Can any problem that can be solved by a Quantum Computer, also be solved by the quantum circuit model?&lt;/p&gt;&#xA;&lt;p&gt;I realise that even if this is true, it won't always be the best option, I mean theoretically.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12510" LastEditorUserId="9006" LastEditDate="2020-07-24T06:24:19.553" LastActivityDate="2020-07-24T06:33:31.567" Title="Is the gate-based model of QC universal?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13030" PostTypeId="2" ParentId="13029" CreationDate="2020-07-23T11:50:39.933" Score="5" Body="&lt;p&gt;The quantum circuit model is one of the possible models for quantum computation. It is the most studied, because it is quite practical.&lt;/p&gt;&#xA;&lt;p&gt;Back to the origins, you can look at papers by David Deutsch, like:&lt;/p&gt;&#xA;&lt;p&gt;Quantum computational networks&#xA;Proc. R. Soc. Lond. A 425, 73-90 (1989)&lt;/p&gt;&#xA;&lt;p&gt;For a slow start, I suggest to read Nielsen and Chuang's book and maybe Scott Aaronson's &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=3943&quot; rel=&quot;noreferrer&quot;&gt;lecture notes&lt;/a&gt; (Section 16.2.2).&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-07-23T11:50:39.933" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13031" PostTypeId="1" AcceptedAnswerId="13038" CreationDate="2020-07-23T15:11:21.587" Score="3" ViewCount="125" Body="&lt;p&gt;As shown &lt;em&gt;e.g.&lt;/em&gt; in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' book&lt;/a&gt; (Proposition 6.6, page 314), a separable state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can always be written as a convex combination of at most &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\rho)^2$&lt;/span&gt; &lt;em&gt;pure, separable states&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;More precisely, using the notation in the book, any separable state &lt;span class=&quot;math-container&quot;&gt;$\xi\in\mathcal X\otimes\mathcal Y$&lt;/span&gt; can be decomposed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\xi = \sum_{a\in\Sigma} p(a) \, x_a x_a^*\otimes y_a y_a^*,\tag1$$&lt;/span&gt;&#xA;for some probability distribution &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, sets of pure states &lt;span class=&quot;math-container&quot;&gt;$\{x_a: a\in\Sigma\}\subset\mathcal X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{y_a: a\in\Sigma\}\subset\mathcal Y$&lt;/span&gt;, and alphabet &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\lvert\Sigma\rvert\le \mathrm{rank}(\xi)^2$&lt;/span&gt;.&#xA;This is shown by observing that &lt;span class=&quot;math-container&quot;&gt;$\xi$&lt;/span&gt; is an element of the real affine space of hermitian operators &lt;span class=&quot;math-container&quot;&gt;$H\in\mathrm{Herm}(\mathcal X\otimes\mathcal Y)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{im}(H)\subseteq\mathrm{im}(\xi)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(H)=1$&lt;/span&gt;. This space has dimension &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\xi)^2-1$&lt;/span&gt;, and thus from Carathéodory we get the conclusion.&lt;/p&gt;&#xA;&lt;p&gt;Consider the case of the totally mixed state in a space &lt;span class=&quot;math-container&quot;&gt;$\mathcal X\otimes\mathcal Y$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{dim}(\mathcal X)=d, \mathrm{dim}(\mathcal Y)=d'$&lt;/span&gt;. For this state, &lt;span class=&quot;math-container&quot;&gt;$\xi\equiv \frac{1}{dd'}I = \frac{I}{d}\otimes\frac{I}{d'}$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\xi)=\lvert\Sigma\rvert=dd'$&lt;/span&gt; for the standard choice of decomposition.&#xA;Generating random convex combinations of product states I also always find &lt;span class=&quot;math-container&quot;&gt;$\lvert\Sigma\rvert=\mathrm{rank}(\xi)$&lt;/span&gt; (code below). In the case &lt;span class=&quot;math-container&quot;&gt;$\lvert\Sigma\rvert=1$&lt;/span&gt;, it is trivial to see that we must also always have &lt;span class=&quot;math-container&quot;&gt;$\lvert\Sigma\rvert=\mathrm{rank}(\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What are examples in which this is &lt;em&gt;not&lt;/em&gt; the case?&#xA;More precisely, what are examples of states for which &lt;em&gt;there is no&lt;/em&gt; alphabet &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\lvert\Sigma\rvert\le\mathrm{rank}(\xi)$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\xi=\sum_{a\in\Sigma}p(a)x_a x_a^*\otimes y_a y_a^*$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;A strictly related question is, of course, what are examples in which the smallest possible &lt;span class=&quot;math-container&quot;&gt;$\lvert\Sigma\rvert$&lt;/span&gt; is &lt;em&gt;different&lt;/em&gt; than &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\xi)$&lt;/span&gt;, as in all examples above this seems to be the case (although for the randomly generated convex combinations we don't know whether there is another decomposition using less than &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\xi)$&lt;/span&gt; terms).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The following is the Mathematica snippet I used to generate random convex combinations of product states:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;RandomUnitary[m_] := Orthogonalize[&#xA;  Map[#[[1]] + I #[[2]]&amp;amp;, #, {2}]&amp;amp; @ RandomReal[&#xA;    NormalDistribution[0, 1], {m, m, 2}&#xA;  ]&#xA;];&#xA;randomPureDM[dim_] := First@RandomUnitary@dim // KroneckerProduct[#, Conjugate@#] &amp;amp;;&#xA;With[{numComponents = 4, bigDim = 10},&#xA;  With[{&#xA;      mats = Table[KroneckerProduct[randomPureDM@bigDim, randomPureDM@bigDim], numComponents],&#xA;      probs = RandomReal[{0, 1}, numComponents] // #/Total@# &amp;amp;&#xA;    },&#xA;    Total[probs*mats] // Eigenvalues // Chop&#xA;  ]&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A related question on physics.SE is &lt;a href=&quot;https://physics.stackexchange.com/q/399675/58382&quot;&gt;&lt;em&gt;What is the minimum number of separable pure states needed to decompose arbitrary separable states?&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-23T17:08:34.127" LastActivityDate="2020-07-24T14:29:01.123" Title="What separable $\rho$ only admit separable pure decompositions with more than $\mathrm{rank}(\rho)$ terms?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13032" PostTypeId="1" CreationDate="2020-07-23T17:42:00.990" Score="0" ViewCount="30" Body="&lt;p&gt;As you probably know, when 2 particles are entangled, they share some properties, even when separated long distances. If 2 devices each had entangled particles, would it be possible to communicate though them, by changes properties of one, which changes the properties of the other. If this was possible, then we could communicate faster than light. But, is it possible?&lt;/p&gt;&#xA;" OwnerUserId="12745" LastEditorUserId="491" LastEditDate="2020-07-23T19:01:19.737" LastActivityDate="2020-07-23T19:01:19.737" Title="Could entangled particles be used for communication?" Tags="&lt;entanglement&gt;&lt;faster-than-light&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-07-24T06:21:38.520" ContentLicense="CC BY-SA 4.0" />
  <row Id="13033" PostTypeId="1" AcceptedAnswerId="13037" CreationDate="2020-07-23T20:20:18.453" Score="4" ViewCount="137" Body="&lt;p&gt;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):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} |0_L\rangle =&amp;amp;|0000000\rangle+|1010101\rangle+|0110011\rangle+|1100110\rangle+&#xA;\\&#xA;+&amp;amp;|0001111\rangle+|1011010\rangle+|0111100\rangle+|1101001\rangle&#xA;\end{align*}&lt;/span&gt;&#xA;Furthermore, I was wondering if it exists a general procedure in order to prepare an arbitrary multipartite state like &lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12731" LastEditorUserId="9459" LastEditDate="2020-07-25T09:46:31.207" LastActivityDate="2020-07-25T09:46:48.183" Title="How to create the logical $|0_L\rangle$ state for the Steane's 7-qubit code?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13035" PostTypeId="2" ParentId="13029" CreationDate="2020-07-24T06:33:31.567" Score="1" Body="&lt;p&gt;A Toffoli gate is in fact NAND gate (&lt;em&gt;when target qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, othwerwise it implements AND gate&lt;/em&gt;). 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;To have a universal quantum computer, we need a gate preparing superposition. This can be done with Hadamard gate.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-24T06:33:31.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13036" PostTypeId="2" ParentId="13033" CreationDate="2020-07-24T07:09:56.783" Score="0" Body="&lt;p&gt;Qubits are initialized at 0 so would you be wanting to flip certain qubits to 1?&lt;/p&gt;&#xA;&lt;p&gt;I’m tempted to just apply x gates to obtain the necessary bits.&lt;/p&gt;&#xA;&lt;p&gt;For example: |ψ⟩=...+|1010101⟩+...&lt;/p&gt;&#xA;&lt;p&gt;from qiskit import QuantumCircuit&#xA;qc = QuantumCircuit(7)&#xA;qc.x([0, 2, 4, 6])&lt;/p&gt;&#xA;&lt;p&gt;I hope I understood your question :)&lt;/p&gt;&#xA;" OwnerUserId="12728" LastActivityDate="2020-07-24T07:09:56.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13037" PostTypeId="2" ParentId="13033" CreationDate="2020-07-24T11:12:28.953" Score="4" Body="&lt;p&gt;Here is a circuit that can create the desired state (similar ideas were discussed in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13025/9459&quot;&gt;answer&lt;/a&gt;), if all mentioned measurements yield &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/CKnF6.png&quot; width=&quot;600&quot; /&gt;&#xA;&lt;p&gt;or in a more compact &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22,1,%22X%22,1,%22X%22,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22,%22X%22,1,1,%22X%22,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,1,1,%22X%22,%22X%22,%22X%22,%22X%22%5D,%5B%22H%22,%22H%22,%22H%22%5D,%5B%22Measure%22,%22Measure%22,%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;form&lt;/a&gt; (the circuits are constructed via &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk&lt;/a&gt;). The first three qubits are ancillary qubits and the rest are the qubits where &lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle$&lt;/span&gt; will be created if after the measurements all ancillary qubits are in the &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; state, otherwise one should repeat the procedure until the desired measurement result will be archived.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. The normalization factors are omitted.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The state after measuring the first ancillary qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state: (measuring &lt;span class=&quot;math-container&quot;&gt;$XIXIXIX$&lt;/span&gt; stabilizer)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle \big( |0000000\rangle + |1010101\rangle \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;The state after measuring the second ancillary qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state:&#xA;(measuring &lt;span class=&quot;math-container&quot;&gt;$IXXIIXX$&lt;/span&gt; stabilizer)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle \big( |0000000\rangle + |1010101\rangle + &#xA;|0110011\rangle + |1100110\rangle\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;The state after measuring the third ancillary qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state:&#xA;(measuring &lt;span class=&quot;math-container&quot;&gt;$IIIXXXX$&lt;/span&gt; stabilizer)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle |0_L\rangle = |000\rangle \big( |0000000\rangle + |1010101\rangle + &#xA;|0110011\rangle + |1100110\rangle \\&#xA;|0001111\rangle + |1011010\rangle +|0111100\rangle + |1101001\rangle \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After disregarding the ancillary qubits that are in the &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; state we will have the desired &lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle$&lt;/span&gt; state. The probability that each measurement outcome will be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt;, thus the probability of creating the &lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle$&lt;/span&gt; state with this circuit is &lt;span class=&quot;math-container&quot;&gt;$0.125$&lt;/span&gt;. For Qiskit, one can implement the circuit mentioned above, then apply any algorithm or gate that is needed on the &lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle$&lt;/span&gt; state, and after the computation disregard all the results where ancillary qubits are not in the &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-25T09:46:48.183" LastActivityDate="2020-07-25T09:46:48.183" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13038" PostTypeId="2" ParentId="13031" CreationDate="2020-07-24T13:48:48.663" Score="6" Body="&lt;p&gt;Symmetric Werner states in any dimension &lt;span class=&quot;math-container&quot;&gt;$n\geq 2$&lt;/span&gt; provide examples.&lt;/p&gt;&#xA;&lt;p&gt;Let's take &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; as an example for simplicity. Define &lt;span class=&quot;math-container&quot;&gt;$\rho\in\mathrm{D}(\mathbb{C}^2\otimes\mathbb{C}^2)$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{6}\,&#xA;\begin{pmatrix}&#xA;2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 2&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;which is proportional to the projection onto the symmetric subspace of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2\otimes\mathbb{C}^2$&lt;/span&gt;. The projection onto the symmetric subspace is always separable, but here you can see it easily by applying the PPT test.&#xA;The rank of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is 3.&lt;/p&gt;&#xA;&lt;p&gt;It is possible to write &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{4}\sum_{k = 1}^4 u_k u_k^{\ast} \otimes u_k u_k^{\ast}&#xA;$$&lt;/span&gt;&#xA;by taking &lt;span class=&quot;math-container&quot;&gt;$u_1,\ldots,u_4$&lt;/span&gt; to be the four tetrahedral states, or any other four states that form a SIC (symmetric information-complete measurement) in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;. It is, however, not possible to express &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_{k = 1}^3 p_k x_k x_k^{\ast} \otimes y_k y_k^{\ast}&#xA;$$&lt;/span&gt;&#xA;for any choice of unit vectors &lt;span class=&quot;math-container&quot;&gt;$x_1,x_2,x_3,y_1,y_2,y_3\in\mathbb{C}^2$&lt;/span&gt; and probabilities &lt;span class=&quot;math-container&quot;&gt;$p_1, p_2, p_3$&lt;/span&gt;. To see why, let us assume toward contradiction that such an expression does exist.&lt;/p&gt;&#xA;&lt;p&gt;Observe first that because the image of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the symmetric subspace, the vectors &lt;span class=&quot;math-container&quot;&gt;$x_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y_k$&lt;/span&gt; must be scalar multiples of one another for each &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, so there is no loss of generality in assuming &lt;span class=&quot;math-container&quot;&gt;$y_k = x_k$&lt;/span&gt;. Next we will use the fact that if &lt;span class=&quot;math-container&quot;&gt;$\Pi$&lt;/span&gt; is any rank &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; projection operator and &lt;span class=&quot;math-container&quot;&gt;$z_1,\ldots,z_r$&lt;/span&gt; are vectors satisfying&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Pi = z_1 z_1^{\ast} + \cdots + z_r z_r^{\ast},&#xA;$$&lt;/span&gt;&#xA;then it must be that &lt;span class=&quot;math-container&quot;&gt;$z_1,\ldots,z_r$&lt;/span&gt; are orthogonal unit vectors. Using the fact that &lt;span class=&quot;math-container&quot;&gt;$3\rho$&lt;/span&gt; is a projection operator, we conclude that &lt;span class=&quot;math-container&quot;&gt;$p_1 = p_2 = p_3 = 1/3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_1\otimes x_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_2\otimes x_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_3\otimes x_3$&lt;/span&gt; are orthogonal. This implies that &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$x_3$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;More generally, the symmetric Werner state &lt;span class=&quot;math-container&quot;&gt;$\rho\in\mathrm{D}(\mathbb{C}^n\otimes\mathbb{C}^n)$&lt;/span&gt; is always separable and has rank &lt;span class=&quot;math-container&quot;&gt;$\binom{n+1}{2}$&lt;/span&gt; but cannot be written as a convex combination of fewer than &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; rank one separable states (and that is only possible when there exists a SIC in dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;). This fact is proved in a paper by Andrew Scott &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0604049&quot; rel=&quot;noreferrer&quot;&gt;[arXiv:quant-ph/0604049]&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastEditorUserId="1764" LastEditDate="2020-07-24T14:29:01.123" LastActivityDate="2020-07-24T14:29:01.123" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13039" PostTypeId="1" CreationDate="2020-07-24T19:03:44.590" Score="4" ViewCount="58" Body="&lt;p&gt;When we write a QASM code or build quantum circuit on Qiskit GUI, it converts it into QObj/QASMQObj (refering paper &lt;a href=&quot;https://arxiv.org/pdf/1809.03452.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Backend Specifications for OpenQASM and OpenPulse Experiments&lt;/a&gt;) or its transpiled version, before executing. However this is assembly language, how it is converted into opcode/bytecode before executing on the hardware?&lt;/p&gt;&#xA;" OwnerUserId="12752" LastEditorUserId="55" LastEditDate="2020-07-26T10:10:54.480" LastActivityDate="2020-09-10T16:05:52.963" Title="What is the executable opcode for Qiskit quantum hardware, as the quantum circuits or the transpiled/compiled QObj/ QASMQObj are assembly languages?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;architecture&gt;&lt;experiment&gt;&lt;qasm&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2020-10-04T13:17:25.850" ContentLicense="CC BY-SA 4.0" />
  <row Id="13040" PostTypeId="1" AcceptedAnswerId="13045" CreationDate="2020-07-24T20:39:33.617" Score="0" ViewCount="102" Body="&lt;p&gt;Is it possible to perform an operation on two qubits with initial states as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$q_1: 1/\sqrt(2)(|0\rangle + exp(0.a_1a_2a_3)|1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$q_2: 1/\sqrt(2)(|0\rangle + |1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To resultant state:-&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$q_1: 1/\sqrt(2)(|0\rangle + exp(0.a_1a_2)|1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$q_2: 1/\sqrt(2)(|0\rangle + exp(0.a_3)|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Without knowing the value of &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt;. Where &lt;span class=&quot;math-container&quot;&gt;$a_1,a_2,a_3 ∈ [0, 1].$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The idea is to shift the phase of &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$exp(-0.00a_3)$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$exp(0.a_3)$&lt;/span&gt; with the unitary operation not being aware of the value of &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="6297" LastEditorUserId="6297" LastEditDate="2020-07-25T07:34:34.573" LastActivityDate="2020-07-25T21:55:31.060" Title="SWAP specific phase components of two qubits" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13043" PostTypeId="1" CreationDate="2020-07-25T12:53:08.043" Score="4" ViewCount="62" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="11704" LastEditorUserId="45" LastEditDate="2020-07-26T06:24:49.627" LastActivityDate="2020-07-28T06:47:57.573" Title="Are there any common applications where one can replace FFT with Quantum Fourier Transform?" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13044" PostTypeId="1" CreationDate="2020-07-25T16:49:25.173" Score="0" ViewCount="229" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bTb5B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bTb5B.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;I am trying to implement a quantum scheme of sharing a secret via EPR states. Here is my initial state of 6 qubits &lt;span class=&quot;math-container&quot;&gt;\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}&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The qubits &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; belong to &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(2,6)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(3,5)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$P_3$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;An operator is applied to qubit &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; say the Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate, to get &lt;span class=&quot;math-container&quot;&gt;\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}&lt;/span&gt;. Now after each party measures his qubits the operator is revealed.&#xA;For instance say if &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; measures  &lt;span class=&quot;math-container&quot;&gt;$|\alpha^+\rangle_{14}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_3$&lt;/span&gt; measure &lt;span class=&quot;math-container&quot;&gt;$|\beta^-\rangle_{26}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta^+\rangle_{35}$&lt;/span&gt; respectively, they write their state as after swapping as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;  |\alpha^-\rangle_{12}|\alpha^+\rangle_{34} |\alpha^+\rangle_{56}&#xA;    \end{equation}&lt;/span&gt;, now they know the initial state of the qubits &lt;span class=&quot;math-container&quot;&gt;$(1,2)$&lt;/span&gt;, hence they deduce the operator as &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I have tried hard, but how to make the circuit for this scheme on an IBM-QE or for that matter any hardware.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/bTb5B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bTb5B.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The circuit provided is my try.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The part before the first barrier is where the initial state is prepared with the operator &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt;, (this the operator that the parties have to find out by combing their measurements).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(2,6)$&lt;/span&gt; undergoes a Bell Basis measurement with the C-NOT and hadamard.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This makes &lt;span class=&quot;math-container&quot;&gt;$(1,5)$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(3,5)$&lt;/span&gt; undergoes a Bell Basis measurement with the C-NOT and Hadamard.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This makes &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; entangled, represented by the reverse C-NOT between (1,4) (again intuition).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then the Bell basis measurement on &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; with the C-NOT and Hadamard.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;But, i am still not knowing how to proceed, the theoretical calculations say that the final state should be&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    |\alpha^-\rangle_{12}|\alpha^+\rangle_{34}|\alpha^+\rangle_{56}&#xA;    \end{equation}&lt;/span&gt; so that they apply the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on the first qubit to get&#xA;&lt;span class=&quot;math-container&quot;&gt;\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}&lt;/span&gt;&#xA;Can't somebody atleast hint at where to start from?&#xA;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&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2020-07-27T21:59:19.193" LastActivityDate="2020-07-27T21:59:19.193" Title="The analogous IBM circuit representation for the quantum scheme" Tags="&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13045" PostTypeId="2" ParentId="13040" CreationDate="2020-07-25T21:55:31.060" Score="3" Body="&lt;p&gt;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 &amp;quot;amplify&amp;quot; single small phase differences into big phase differences, because of linearity.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-07-25T21:55:31.060" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13046" PostTypeId="1" CreationDate="2020-07-25T23:10:44.757" Score="1" ViewCount="35" Body="&lt;p&gt;I have been trying to create a C# host program for a Q# program in Visual Studio Community 2019 by following these instructions: &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/quickstarts/install-cs?tabs=tabid-vs2019%2Ctabid-csharp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/quantum/quickstarts/install-cs?tabs=tabid-vs2019%2Ctabid-csharp&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But when I click &amp;quot;Create&amp;quot;, I cannot complete the process, and this message pops up:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zvfJ6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zvfJ6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Any idea?&lt;/p&gt;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="12766" LastEditorUserId="55" LastEditDate="2020-07-27T12:25:40.987" LastActivityDate="2020-07-27T12:25:40.987" Title="How to create a C# host program for a Q# program in Visual Studio Community 2019?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13047" PostTypeId="2" ParentId="12988" CreationDate="2020-07-26T03:37:35.250" Score="1" Body="&lt;p&gt;Consider &lt;a href=&quot;https://ibm.co/joinqiskitslack&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ibm.co/joinqiskitslack&lt;/a&gt; the Slack link, it's always updated to a working invitation link.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-07-26T03:37:35.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13048" PostTypeId="1" AcceptedAnswerId="13052" CreationDate="2020-07-26T05:14:56.483" Score="2" ViewCount="67" Body="&lt;p&gt;Let's say I have a particle in the quantum state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;, represented as a density operator (1st matrix) that went through a depolarizing chanel (2nd matrix). Let's call the depolarized matrix &lt;span class=&quot;math-container&quot;&gt;$D_p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;.5 &amp;amp; .5 \\&#xA;.5 &amp;amp; .5&#xA;\end{bmatrix}&#xA;\rightarrow&#xA;\begin{bmatrix}&#xA;.5 &amp;amp; .43 \\&#xA;.43 &amp;amp; .5&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;Now, I have two of these &lt;span class=&quot;math-container&quot;&gt;$D_p$&lt;/span&gt;, and their resulting product state is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D_p^{\otimes 2} = \begin{bmatrix}&#xA;.5 &amp;amp; .43 \\&#xA;.43 &amp;amp; .5&#xA;\end{bmatrix}&#xA;\otimes &#xA;\begin{bmatrix}&#xA;.5 &amp;amp; .43 \\&#xA;.43 &amp;amp; .5&#xA;\end{bmatrix}.&#xA;$$&lt;/span&gt;&#xA;Now, if I want want to calculate the probability of finding some state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |0\rangle \otimes |0\rangle$&lt;/span&gt; in the above mentioned product system, then this is what I do:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(|\psi\rangle | D_p^{\otimes 2}) = trace(\psi\rangle\langle \psi | D_p^{\otimes 2}).&#xA;$$&lt;/span&gt;&#xA;As you can see, calculating this trace is a &lt;span class=&quot;math-container&quot;&gt;$O(N^3)$&lt;/span&gt; complexity operation and becomes very slow for even a small number of particles, i.e. for &lt;span class=&quot;math-container&quot;&gt;$D_p^{\otimes 10}$&lt;/span&gt; or higher. Is there a principled way to calculate these probabilities? Without using any matrix multiplication?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/568203/calculate-probability-of-a-state-after-depolarization&quot;&gt;Cross-posted on Physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="491" LastEditDate="2020-08-29T19:06:59.237" LastActivityDate="2020-08-29T19:06:59.237" Title="Calculate probability of a state after depolarization" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;density-matrix&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13049" PostTypeId="1" CreationDate="2020-07-26T07:35:46.910" Score="3" ViewCount="70" Body="&lt;p&gt;I have been trying to implement methods from paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0208112.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Creating superpositions that correspond to efficiently integrable probability distributions&lt;/a&gt; by Grover and Rudolph.&lt;/p&gt;&#xA;&lt;p&gt;It is stated that there exists an efficient (polynomial) process for the preparation of certain probability density functions (e.g. log-concave distributions).&lt;/p&gt;&#xA;&lt;p&gt;Specifically, in equation 5. It is stated that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{p_i^{(m)}}|i\rangle |0...0\rangle \rightarrow \sqrt{p_i^{(m)}}|i\rangle |\theta_i\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can be done efficiently under these assumptions.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Would highly appreciate any insights on this.&lt;/p&gt;&#xA;" OwnerUserId="12769" LastEditorUserId="9006" LastEditDate="2020-07-27T07:11:47.763" LastActivityDate="2020-07-27T07:11:47.763" Title="Preparation of states that correspond to efficiently integrable probability distributions" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13050" PostTypeId="1" CreationDate="2020-07-26T09:13:48.223" Score="2" ViewCount="56" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Yzhvy.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yzhvy.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;For instance for the Essex device, I can obtain the id gate length value using the following code:&lt;/p&gt;&#xA;&lt;p&gt;device = provider.get_backend('ibmq_essex')&lt;/p&gt;&#xA;&lt;p&gt;properties = device.properties()&lt;/p&gt;&#xA;&lt;p&gt;from qiskit.providers.aer.noise.device.parameters import gate_length_values&lt;/p&gt;&#xA;&lt;p&gt;gate_times_out = gate_length_values(properties)&lt;/p&gt;&#xA;&lt;p&gt;print(gate_times_out[0])&lt;/p&gt;&#xA;&lt;p&gt; &#xA;('id', [0], 64.0)&lt;/p&gt;&#xA;&lt;p&gt;Note that this method of creating a delay was used in a published paper about decoherence.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1712.07080.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1712.07080.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the methods section the authors give the following description:&lt;/p&gt;&#xA;&lt;p&gt;« 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. »&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I can find the buffer times in older descriptions of some devices, like the Yorktown (see: &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/blob/master/backends/yorktown/V1/version_log.md&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/ibmq-device-information/blob/master/backends/yorktown/V1/version_log.md&lt;/a&gt;).&#xA;But I cannot find it for the Essex device.What is it? Or where can I find it?&#xA;Or maybe the waiting time is already included in the gate length values?&lt;/p&gt;&#xA;&lt;p&gt;Thanks by advance for helping.&lt;/p&gt;&#xA;" OwnerUserId="4600" LastActivityDate="2020-07-26T09:13:48.223" Title="What is the buffer time between gates of the ibmq_essex in nanoseconds?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13051" PostTypeId="1" AcceptedAnswerId="13055" CreationDate="2020-07-26T09:52:19.660" Score="3" ViewCount="227" Body="&lt;p&gt;Let's say that the qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$\psi = \alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;. We want to find out the values &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If we measure it in, say, the standard basis, then the outcome we get is either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. So, how do we find out the given values?&lt;/p&gt;&#xA;&lt;p&gt;I recently came across the problem that asked to compare the probabilities of finding out the &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; if we measured the qubit in two different bases and I'm not sure how to calculate them.&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="55" LastEditDate="2020-07-26T18:57:42.473" LastActivityDate="2020-07-30T09:57:33.750" Title="How is it possible to guess what state the qubit was in by measuring it?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13052" PostTypeId="2" ParentId="13048" CreationDate="2020-07-26T12:11:32.917" Score="3" Body="&lt;p&gt;As long as your final state is a product state, &lt;em&gt;everything&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;But even if this is not the case, you can compute &lt;span class=&quot;math-container&quot;&gt;$\langle \psi\vert D_p^{\otimes k}\vert\psi\rangle$&lt;/span&gt; rather than the trace, then it only scales as &lt;span class=&quot;math-container&quot;&gt;$O(N^2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N=2^k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, you could use that &lt;span class=&quot;math-container&quot;&gt;$D_p^{\otimes k}$&lt;/span&gt; is a tensor product and multiply &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt; with one &lt;span class=&quot;math-container&quot;&gt;$D_p$&lt;/span&gt; at a time.  Then, it is easy to see that each of these operations only sums over &lt;em&gt;one&lt;/em&gt; index with &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; settings, which takes &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; operations, so the total number of operations is &lt;span class=&quot;math-container&quot;&gt;$2kN = O(kN) = O(N\log(N))$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-07-26T14:00:44.110" LastActivityDate="2020-07-26T14:00:44.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13053" PostTypeId="2" ParentId="13051" CreationDate="2020-07-26T18:55:05.580" Score="3" Body="&lt;p&gt;You measure many times and collect statistics. &lt;em&gt;E.g.&lt;/em&gt; you do &lt;span class=&quot;math-container&quot;&gt;$1000$&lt;/span&gt; measurements and find &lt;span class=&quot;math-container&quot;&gt;$600$&lt;/span&gt; times the first outcome. You can then deduce that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2\simeq 0.6$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2\sim0.4$&lt;/span&gt; (using appropriate statistical methods to compute the associated estimation errors).&lt;/p&gt;&#xA;&lt;p&gt;Note that this does not fully characterise the state, but only gives you the amplitudes &lt;span class=&quot;math-container&quot;&gt;$|\alpha|,|\beta|$&lt;/span&gt;. You do not have access to any other information, unless you also do measurements on a different basis.&lt;/p&gt;&#xA;&lt;p&gt;If you measure for example in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis, you will find that this gives you information about the relative phase (more specifically, it gives you the value of &lt;span class=&quot;math-container&quot;&gt;$2\operatorname{Re}(\alpha^*\beta)$&lt;/span&gt;). To definitively pinpoint the state, you will then also need the probabilities in a third measurement basis, &lt;em&gt;e.g.&lt;/em&gt; the basis &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\pm i\lvert0\rangle$&lt;/span&gt;, which allow you to compute &lt;span class=&quot;math-container&quot;&gt;$2\operatorname{Im}(\alpha^* \beta)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-07-26T20:49:26.580" LastActivityDate="2020-07-26T20:49:26.580" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13054" PostTypeId="2" ParentId="13051" CreationDate="2020-07-26T19:46:01.550" Score="0" Body="&lt;p&gt;Usually, the calculation of amplitudes can be accomplished by either of the following properties:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Complex amplitudes are always normalized (as they form the probabilities) so &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2+|\beta|^2$&lt;/span&gt;=1&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using the geometric interpretation of quantum bit (if you know the angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;) 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 &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\cos$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\theta$$|0\rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\sin$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\theta$$|1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; will be the angle between &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the superposition state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; (and the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are orthonormal). It will satisfy 1 as &lt;span class=&quot;math-container&quot;&gt;$\sin^2$$\theta$&lt;/span&gt;+&lt;span class=&quot;math-container&quot;&gt;$\cos^2$$\theta$&lt;/span&gt;=1&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (example, for sign basis you will have amplitutes as 1/&lt;span class=&quot;math-container&quot;&gt;$\sqrt2$&lt;/span&gt; and the basis will be rotated by 45 degree clockwise so &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; will be at &lt;span class=&quot;math-container&quot;&gt;$+$$\pi/4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; will be at &lt;span class=&quot;math-container&quot;&gt;$-$$\pi/4$&lt;/span&gt; angle with horizontal &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12624" LastEditorUserId="9006" LastEditDate="2020-07-27T07:15:05.947" LastActivityDate="2020-07-27T07:15:05.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13055" PostTypeId="2" ParentId="13051" CreationDate="2020-07-26T20:33:55.377" Score="5" Body="&lt;p&gt;Let's describe the one qubit &lt;em&gt;pure stat&lt;/em&gt; in Bloch sphere notation (in order to avoid the global phase ambiguity):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \cos\big(\frac{\theta}{2}\big) |0\rangle + e^{i\varphi} \sin\big(\frac{\theta}{2}\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;pure states&lt;/em&gt;. This answer is a generalized version of this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11355/9459&quot;&gt;answer&lt;/a&gt;. Here we assume that the described state can be prepared as many times as we want.&lt;/p&gt;&#xA;&lt;p&gt;We are going to execute three different experiments to estimate the &lt;span class=&quot;math-container&quot;&gt;$\alpha = \cos\big(\frac{\theta}{2}\big)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta = e^{i\varphi} \sin\big(\frac{\theta}{2}\big)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$[0, \pi]$&lt;/span&gt; range, &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$[-\pi, \pi)$&lt;/span&gt; range (in the Bloch sphere formalism &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$[0, 2\pi)$&lt;/span&gt;, but we can, without any problems, take &lt;span class=&quot;math-container&quot;&gt;$[-\pi, \pi)$&lt;/span&gt; range for our convenience). The first experiment will give us &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and the last two experiments will give us &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; from which it will be straightforward to calculate &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, and thus the &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; &lt;em&gt;pure state&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The first experiment: determining &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Execute &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times (bigger &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; will give a better answer) &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis measurements. Note that the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\left( P(0) \right)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\left(P(1)\right)$&lt;/span&gt; states have these relations with the outcomes of the experiment:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(0) = \lim_{N \rightarrow \infty} \frac{N_{0}}{N} = |\alpha|^2 = \cos^2 \big(\frac{\theta}{2}\big)&#xA;\\&#xA;P(1) = \lim_{N \rightarrow \infty} \frac{N_{1}}{N} = |\beta|^2  = \sin^2\big(\frac{\theta}{2}\big)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta = 2 \arccos \big(\sqrt{(P(0))}\big) = 2 \arcsin \big(\sqrt{(P(1))}\big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because values of &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}$&lt;/span&gt; is in the &lt;span class=&quot;math-container&quot;&gt;$[0, \frac{\pi}{2}]$&lt;/span&gt; range.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The second experiment: the absolute value of the relative phase.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have defined the relative phase &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; in the range &lt;span class=&quot;math-container&quot;&gt;$[-\pi, \pi)$&lt;/span&gt; and here we are going to find the &lt;span class=&quot;math-container&quot;&gt;$|\varphi|$&lt;/span&gt;. For that, we apply a Hadamard gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H \left( \cos\big(\frac{\theta}{2}\big) |0\rangle + e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) = &#xA;\\&#xA;= \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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we calculate the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$P'(0)$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$P'(1)$&lt;/span&gt; we will obtain that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}&#xA;\\&#xA;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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is why:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varphi = \pm \arccos \left( \frac{P'(0) - P'(1)}{\sin(\theta)} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because the range of usual principal value arccosine function is equal to &lt;span class=&quot;math-container&quot;&gt;$[0, \pi]$&lt;/span&gt;. We know &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, we know how to calculate &lt;span class=&quot;math-container&quot;&gt;$P'(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P'(1)$&lt;/span&gt; from the new experiment with Hadamard gate, so we will be able to find &lt;span class=&quot;math-container&quot;&gt;$|\varphi|$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta) = 0$&lt;/span&gt;, then we can just skip the second and the third experiments, because in that case we have either &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |1\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt;) or &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |0\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\theta = 0$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Also, note that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle X \rangle = \langle \psi | X | \psi \rangle = \langle \psi |H Z H| \psi \rangle = P(0) - P(1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, the formula can be written in this way:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta = \pm \arccos \left( \frac{\langle X \rangle}{\sin(\theta)} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The third experiment: determining the sign of the relative phase.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;For this we will need to apply &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates to the initial state before &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; measurements:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H S^{\dagger} \left( \cos\big(\frac{\theta}{2}\big) |0\rangle + e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) = &#xA;\\&#xA;= \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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probabilities:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}&#xA;\\&#xA;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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the sign of the relative phase we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$sign(\varphi) = sign \left( \arcsin \left(\frac{P''(0) - P''(1)}{\sin(\theta)} \right) \right) = sign \left( P''(0) - P''(1) \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because the range of usual principal value of arcsine function is &lt;span class=&quot;math-container&quot;&gt;$[-\frac{\pi}{2}, \frac{\pi}{2}]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta) &amp;gt; 0$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\left( \theta \in [0, \pi] \right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also, note that for the expectation value of the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operator (as can be seen from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11789/9459&quot;&gt;answer&lt;/a&gt;) we have this relation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle Y \rangle = \langle \psi| Y | \psi\rangle = \langle \psi| S H Z H S^{\dagger} | \psi\rangle = P''(0) -  P''(1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By taking this into account and combining the last two experiments we can obtain the relative phase:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\varphi = sign \big( \langle Y \rangle \big) \arccos \left( \frac{\langle X \rangle}{\sin(\theta)} \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-30T09:57:33.750" LastActivityDate="2020-07-30T09:57:33.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13056" PostTypeId="1" AcceptedAnswerId="13078" CreationDate="2020-07-27T02:43:21.897" Score="1" ViewCount="148" Body="&lt;p&gt;In QAOA algorithm, for &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt; layer of gates and at most degree &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt;, the expectation value can be calculated by hand. I think I can convince myself the idea of commutability. In &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this qiskit example&lt;/a&gt;, the author evaluated&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f_A(\gamma,\beta) = \frac{1}{2}\left(sin(4\gamma)sin(4\beta) + sin^2(2\beta)sin^2(2\gamma)\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I believe I can write these unitaries explicitly as tensor product of &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate. However, when we evaluate this by hand, the states &lt;span class=&quot;math-container&quot;&gt;$|+^3\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+^5\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U_{02}$&lt;/span&gt;. How can I sandwich an identity operator into a two-qubit operator?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is how to evaluate this explicitly by hand.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I found a paper &lt;a href=&quot;https://arxiv.org/abs/1703.06199&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithms for Fixed Qubit Architectures&lt;/a&gt; and it provided some operator identity which I think can help understand how this evaluation worked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;But I still have no idea how these identities hold.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Eul54.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Eul54.png&quot; alt=&quot;operator identity&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I copied the original text here:&lt;/p&gt;&#xA;&lt;h2&gt;5.2 Optimal trial state parameters&lt;/h2&gt;&#xA;&lt;p&gt;In this example we consider the case for &lt;span class=&quot;math-container&quot;&gt;$p = 1$&lt;/span&gt;, i.e. only layer of gates. The expectation value &lt;span class=&quot;math-container&quot;&gt;$F_1(\gamma,\beta) = \langle \psi_1(\beta,\gamma)|H|\psi_1(\beta,\gamma) \rangle$&lt;/span&gt; can be calculated analytically for this simple setting. Let us discuss the steps explicitly for the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = \sum_{(j,k) \in E} \frac{1}{2}\left(1 - Z_i Z_k\right)$&lt;/span&gt;. Due to the linearity of the expectation value we can compute the expectation value for the edges individually&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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. $$&lt;/span&gt;&#xA;For the butterfly graph as plotted above, we observe that there are only two kinds of edges &lt;span class=&quot;math-container&quot;&gt;$A = \{(0,1),(3,4)\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B = \{(0,2),(1,2),(2,3),(2,4)\}$&lt;/span&gt;. The edges in &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; only have two neighboring edges, while the edges in &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$F_1(\gamma,\beta) = 2 f_A(\gamma,\beta) + 4f_B(\gamma,\beta)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$Z_0Z_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z_0Z_2$&lt;/span&gt; commute and cancel out so that we only need to compute&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&#xA;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$U_{k,l}(\gamma) = \exp\frac{i\gamma}{2}\left(1 - Z_kZ_l\right)$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$X_k(\beta) = \exp(i\beta X_k)$&lt;/span&gt; yields&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f_A(\gamma,\beta) = \frac{1}{2}\left(sin(4\gamma)sin(4\beta) + sin^2(2\beta)sin^2(2\gamma)\right)$$&lt;/span&gt;&#xA;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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) $$&lt;/span&gt;&#xA;These results can now be combined as described above, and the expectation value is therefore given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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),$$&lt;/span&gt;&#xA;We plot the function &lt;span class=&quot;math-container&quot;&gt;$F_1(\gamma,\beta)$&lt;/span&gt; and use a simple grid search to find the parameters &lt;span class=&quot;math-container&quot;&gt;$(\gamma^*,\beta^*)$&lt;/span&gt; that maximize the expectation value.&lt;/p&gt;&#xA;" OwnerUserId="12693" LastEditorUserId="12693" LastEditDate="2020-07-27T10:05:59.293" LastActivityDate="2021-05-20T16:29:28.160" Title="How to do the direct evaluation by hand in QAOA algorithm" Tags="&lt;qaoa&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13057" PostTypeId="2" ParentId="13048" CreationDate="2020-07-27T06:38:14.053" Score="2" Body="&lt;p&gt;Norbert's answer is correct, but just for the sake of being explicit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-27T06:38:14.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13058" PostTypeId="1" AcceptedAnswerId="13059" CreationDate="2020-07-27T19:16:40.310" Score="1" ViewCount="37" Body="&lt;p&gt;I have already visited this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6571/what-does-it-mean-to-get-403-error-when-running-a-code-on-qiskit&quot;&gt;What does it mean to get 403 error when running a code on Qiskit?&lt;/a&gt; which did not help me fix my problem.&#xA;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)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;provider = IBMQ.get_provider('ibm-q')&#xA;qcomp = provider.get_backend('ibmq_16_melbourne')&#xA;job = execute(circuit, backend=qcomp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="7706" LastEditorUserId="55" LastEditDate="2020-07-28T13:28:07.173" LastActivityDate="2020-08-27T14:02:15.160" Title="Queue disabled and HTTP 403 error" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13059" PostTypeId="2" ParentId="13058" CreationDate="2020-07-27T19:43:37.723" Score="0" Body="&lt;p&gt;You're getting the 403 because &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; is currently offline for maintenance. You can checkout the status of each backend on the IBM Quantum Experience website, or do &lt;code&gt;backend.status().operational&lt;/code&gt;. Furthermore, you can get the least busy operational backend with something like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.ibmq import least_busy&#xA;backend = least_busy(provider.backends(simulator=False, filters=lambda b: &#xA;    b.configuration().n_qubits &amp;gt;= 5))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-07-27T19:43:37.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13060" PostTypeId="2" ParentId="8431" CreationDate="2020-07-27T21:06:38.223" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/terra/qis_adv/quantum_walk.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; Qiskit tutorial does what I think you're looking for; with the &lt;code&gt;cnx()&lt;/code&gt; function. It uses &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper to decompose the CNOT gate without ancilla qubits.&lt;/p&gt;&#xA;&lt;p&gt;Let me know, if this helps you.&lt;/p&gt;&#xA;" OwnerUserId="12778" LastEditorUserId="27" LastEditDate="2020-07-28T00:53:18.703" LastActivityDate="2020-07-28T00:53:18.703" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13061" PostTypeId="1" CreationDate="2020-07-27T22:17:50.447" Score="1" ViewCount="71" Body="&lt;p&gt;I'm trying to grok more of the adiabatic model.  I also really enjoyed O'Donnell's &lt;a href=&quot;https://www.youtube.com/watch?v=8jW5ArmHLOI&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; on the Elitzur-Vaidman bomb tester.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt; state, and does nothing if going through in the &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;Conventionally a qubit is prepared in the &lt;span class=&quot;math-container&quot;&gt;$\vert +\rangle$&lt;/span&gt; state to go through the bomb tester, and if it doesn't trigger the bomb, it is measured in the &lt;span class=&quot;math-container&quot;&gt;$\{\vert +\rangle,\vert -\rangle\}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\vert -\rangle$&lt;/span&gt;, proving the presence of the bomb.&lt;/p&gt;&#xA;&lt;p&gt;In O'Donnell's description of the improved test, a qubit without a bomb present is slowly rotated by &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; degrees, from &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;. However if a bomb is present, the qubit will remain in &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; with high probability.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-07-27T22:17:50.447" Title="Is the Elitzur-Vaidman bomb tester an example of adiabatic evolution?" Tags="&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13062" PostTypeId="1" CreationDate="2020-07-28T01:29:31.143" Score="2" ViewCount="211" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5426" LastActivityDate="2020-07-29T01:22:36.170" Title="Can quantum computers be used to solve P = NP" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13063" PostTypeId="1" AcceptedAnswerId="13065" CreationDate="2020-07-28T05:47:25.557" Score="2" ViewCount="145" Body="&lt;p&gt;I am new in this field and I am considering to do research for my engineering degree.&lt;/p&gt;&#xA;&lt;p&gt;First, I would like to have an opinion from more experienced people. &lt;strong&gt;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&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If so, can you explain your point of view and if it is possible, an example?&lt;/p&gt;&#xA;" OwnerUserId="12786" LastEditorUserId="55" LastEditDate="2020-07-28T06:54:48.133" LastActivityDate="2020-08-07T22:53:07.463" Title="Is it possible to convert classical algorithms to quantum ones?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13064" PostTypeId="2" ParentId="13043" CreationDate="2020-07-28T06:47:57.573" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;digitization&amp;quot; formalism is given in [1], or for a more thorough review see [2].&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[1] Ronaldo D Somma. &amp;quot;Quantum simulations of one dimensional quantum systems&amp;quot;. arXiv preprint: &lt;a href=&quot;https://arxiv.org/abs/1503.06319&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1503.06319&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[2] Natalie Klco and Martin J. Savage. “Digitization of Scalar Fields for Quantum Computing.” Physical Review A 99.5 (2019): &lt;a href=&quot;https://arxiv.org/abs/1808.10378&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1808.10378&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-07-28T06:47:57.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13065" PostTypeId="2" ParentId="13063" CreationDate="2020-07-28T07:34:53.587" Score="1" Body="&lt;p&gt;It depends on what you mean by converting classical algorithm to quantum one.&lt;/p&gt;&#xA;&lt;p&gt;One angle of view can be: &lt;em&gt;Is it possible to run any classical algorithm on quantum computer?&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Seconde angle of view could be: &lt;em&gt;Is there a qunatum counterpart to any classical algorithm?&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-28T07:34:53.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13066" PostTypeId="1" CreationDate="2020-07-28T08:00:22.143" Score="2" ViewCount="60" Body="&lt;p&gt;For example, a computer represent a variable named &amp;quot;A&amp;quot; as 01000001. How does a quantum computer represent &amp;quot;A&amp;quot;?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12788" LastEditorUserId="55" LastEditDate="2020-08-27T12:54:24.800" LastActivityDate="2020-08-27T12:54:24.800" Title="How is a bit field represented in Quantum Computing?" Tags="&lt;quantum-state&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13067" PostTypeId="2" ParentId="13066" CreationDate="2020-07-28T08:52:18.240" Score="3" Body="&lt;p&gt;You can represent the &amp;quot;A&amp;quot; as a series of qubits in the &lt;span class=&quot;math-container&quot;&gt;$\vert 01000001\rangle$&lt;/span&gt;-state. Any other representation would work as well, as long as there is consensus on the notation.&lt;/p&gt;&#xA;&lt;p&gt;Regarding usefulness, most envisioned applications of quantum computers are as subpart of classical algorithms, where computationally hard problems are solved. Hence, 'typing' an &amp;quot;A&amp;quot; might not be necessary, though the development of quantum computers might prove otherwise.&lt;/p&gt;&#xA;" OwnerUserId="2005" LastActivityDate="2020-07-28T08:52:18.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13068" PostTypeId="1" AcceptedAnswerId="13120" CreationDate="2020-07-28T09:23:23.383" Score="1" ViewCount="41" Body="&lt;p&gt;This &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0105141&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; shows the impossibility of perfect error correction for strictly contractive quantum channels, i.e., for channels such that &lt;span class=&quot;math-container&quot;&gt;$||\mathcal{E}(\rho)-\mathcal{E}(\sigma) ||\leq k ||\rho-\sigma||$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$0\leq k &amp;lt;1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The requirement for perfect error correction of a subspace &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is that there exists a channel &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the inverse of the restriction of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; to the subspace &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The proof of impossibility uses the fact that this would require &lt;span class=&quot;math-container&quot;&gt;$||S\mathcal{E}(|u\rangle\langle u|)-S\mathcal{E}(|v\rangle\langle v|)|| = |||u\rangle\langle u|-|v\rangle\langle v|||$&lt;/span&gt;, for some basis vectors &lt;span class=&quot;math-container&quot;&gt;$u,v$&lt;/span&gt;, which would contradict strict contractivity.&lt;/p&gt;&#xA;&lt;p&gt;My confusion is concerning how this contradiction argument doesn't seem take into consideration the fact that we should restrict to the subspace &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. In other words, if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the projector onto the subspace &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, is it generally true that if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is strictly contractive, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$||P(\mathcal{E}(\rho))-P(\mathcal{E}(\sigma)) ||&amp;lt;||P(\rho)-P(\sigma)||$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-08-07T18:56:10.830" LastActivityDate="2020-08-07T18:56:10.830" Title="Is the restriction of a strictly contractive channel (SCC) to a subspace necessarily still SCC? (impossibility of perfect QEC for SCCs)" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13069" PostTypeId="1" CreationDate="2020-07-28T11:21:20.960" Score="-1" ViewCount="96" Body="&lt;p&gt;I am trying to write a quantum circuit that implements swapping. The initial state is &lt;span class=&quot;math-container&quot;&gt;$$\phi^+_{12}\phi^+_{34},$$&lt;/span&gt; where particles &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; belong to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2,3)$&lt;/span&gt;, belong to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&#xA;After A's measurement in Bell basis we have &lt;span class=&quot;math-container&quot;&gt;$$\phi^+_{14}\phi^+_{23}+\phi^-_{14}\phi^-_{23}+\psi^+_{14}\psi^+_{23}+\psi^-_{14}\psi^-_{23}.$$&lt;/span&gt;&#xA;Which means that &lt;span class=&quot;math-container&quot;&gt;$(2,3)$&lt;/span&gt; become entangled after the measurement of &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt;.I got the results correct, the problem was the measurement that was stored in the classical register, (the order in which it is measured matters) my output was&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XvrlM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XvrlM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;as can be seen the 5th and 6th qubit are entangled. Basically i measured the 1st qubit on register 5 and the 4th qubit on register 6. However there is a problem when i run it on a IBM's melbourne hardware, it transpiles, but doesn't run. I guess the problem is with the conditional 'if' statements i have used after i have measured the qubits &lt;span class=&quot;math-container&quot;&gt;$2,6,3,5$&lt;/span&gt;. For instance when i get value of &lt;span class=&quot;math-container&quot;&gt;$c=2,7,8,13$&lt;/span&gt; on the classical register i do a &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on the first qubit. But how do i do this without the if statement.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2020-07-29T07:15:59.517" LastActivityDate="2021-01-02T10:03:40.303" Title="Quantum circuit not giving right results" Tags="&lt;programming&gt;&lt;entanglement&gt;&lt;ibm-q-experience&gt;&lt;entanglement-swapping&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13071" PostTypeId="1" CreationDate="2020-07-28T13:17:00.300" Score="3" ViewCount="805" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This is my gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class LGate(Gate):&#xA; &#xA;    def __init__(self, label=None):&#xA;    &#xA;        super().__init__('l', 1, [], label=label)&#xA;&#xA;    def _define(self):&#xA;&#xA;  &#xA;        from qiskit.circuit.quantumcircuit import QuantumCircuit&#xA;        from qiskit.circuit.library import U3Gate&#xA;        q = QuantumRegister(1, 'q')&#xA;        qc = QuantumCircuit(q, name=self.name)&#xA;        rules = [&#xA;            (U3Gate(pi, 0, pi), [q[0]], [])&#xA;        ]&#xA;        qc._data = rules&#xA;        self.definition = qc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Of course this is just an X gate, but I was just trying a basic example.&lt;/p&gt;&#xA;&lt;p&gt;Running the program:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(2)&#xA;circ.l(0)&#xA;print(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError: 'QuantumCircuit' object has no attribute 'l'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12790" LastEditorUserId="55" LastEditDate="2020-07-28T13:29:17.483" LastActivityDate="2020-08-04T06:48:21.610" Title="Making custom gate in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13072" PostTypeId="2" ParentId="13071" CreationDate="2020-07-28T13:27:49.057" Score="1" Body="&lt;p&gt;You only defined the gate, but not you haven't added the according method to the circuit. Add the following to the &lt;code&gt;QuantumCircuit&lt;/code&gt; class:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    def l(self, qubit): &#xA;        # adjust this import to the location of your gate&#xA;        from .library.standard_gates.l import LGate&#xA;        return self.append(LGate(), [qubit], [])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;See for instance &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/aa22a50d42c17c5a5951775018621b8d7e2a8661/qiskit/circuit/quantumcircuit.py#L2060&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; how it works for the &lt;code&gt;SwapGate&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Just as a note: It's best practice to not use the letter &lt;code&gt;l&lt;/code&gt; because that can be difficult to distinguish from an &lt;code&gt;I&lt;/code&gt; in some fonts.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-07-28T13:27:49.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13073" PostTypeId="2" ParentId="12212" CreationDate="2020-07-28T15:24:29.717" Score="2" Body="&lt;p&gt;I know this is an old question, but I feel like giving, imo, the simplest answer following the question specified in N&amp;amp;C.&lt;/p&gt;&#xA;&lt;p&gt;Firstly as specified in the question define:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \mathcal{E}(A) = \frac{A + XAX + YAY + ZAZ}{4}$&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;p&gt;It it is easy to see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \mathcal{E}(I) = \frac{I + XIX + YIY + ZIZ}{4} = \frac{I + XX + YY + ZZ}{4} = I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the other three quantities &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(X),\mathcal{E}(Y),\mathcal{E}(Z)$&lt;/span&gt; we can make use of the elementary identities:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma_i\sigma_i\sigma_i = \sigma_i$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma_i\sigma_j\sigma_i = -\sigma_j$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Plugging in these identities we can see &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(X),\mathcal{E}(Y),\mathcal{E}(Z) = 0$&lt;/span&gt;. More generally, (after grouping the terms), we can see that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \mathcal{E}(\sigma_i) = \frac{2\sigma_i - 2\sigma_i}{4} = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally we know from e.q 2.175 that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{I + \vec{r} \cdot\vec{\sigma}}{2} = \frac{I + r_x\sigma_x + r_y\sigma_y + r_z\sigma_z}{2}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;and plugging this into&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;using the results from above we see all the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(r_i\sigma_i)=0$&lt;/span&gt;, leaving us just with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho) = \frac{\mathcal{E}\left({I}\right)}{2} = \frac{I}{2}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;finally to complete the proof&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2\mathcal{E}(\rho) = I$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2020-07-28T15:33:51.347" LastActivityDate="2020-07-28T15:33:51.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13074" PostTypeId="1" CreationDate="2020-07-28T22:25:18.783" Score="1" ViewCount="27" Body="&lt;p&gt;I need to compute &lt;span class=&quot;math-container&quot;&gt;$(A+B^{-1})^{-1}|x\rangle$&lt;/span&gt;, where A and B is hermitian for simplicity.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12794" LastActivityDate="2020-07-28T22:25:18.783" Title="Using matrix inversion and summation together. How to compute $(A+B^{-1})^{-1}|x\rangle$" Tags="&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13075" PostTypeId="2" ParentId="13062" CreationDate="2020-07-29T00:28:58.300" Score="6" Body="&lt;p&gt;I see maybe four (4) ways to interpret the question.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The first asks whether we can use a quantum computer to efficiently solve &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; problems.  The class of problems efficiently solvable by a quantum computer is called &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;, and so the question would ask &lt;strong&gt;whether&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}\subseteq\mathsf{BQP}$&lt;/span&gt;.  As is indicted in the comments, quantum computers are not known to efficiently solve arbitrary &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; problems, and are suspected not to be able to.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The second asks whether a proof that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}\subseteq\mathsf{BQP}$&lt;/span&gt; would &lt;strong&gt;suffice&lt;/strong&gt; as a proof that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}=\mathsf{NP}$&lt;/span&gt;.  Although &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}\subseteq\mathsf{BQP}$&lt;/span&gt;, such a containment does not necessarily follow.  For example, there may be problems in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; that are not in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; or even in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; - 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The third asks whether a proof that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}\not\subseteq\mathsf{BQP}$&lt;/span&gt; would &lt;strong&gt;suffice&lt;/strong&gt; as a proof that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}\ne\mathsf{NP}$&lt;/span&gt;.  However, even this does not follow.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The fourth interpretation asks whether a quantum computer could provide any &lt;strong&gt;leverage&lt;/strong&gt; in answering the question of if the classical complexity class &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;.  That is, could one pose the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The &amp;quot;standard model&amp;quot; that many people believe is that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}\subsetneq\mathsf{NP}$&lt;/span&gt;, and further both &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\not\subseteq\mathsf{NP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}\not\subseteq\mathsf{BQP}$&lt;/span&gt; - that is, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; are incomparable.  However, we are likely far away from proving any.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-07-29T01:22:36.170" LastActivityDate="2020-07-29T01:22:36.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13076" PostTypeId="1" AcceptedAnswerId="13082" CreationDate="2020-07-29T00:40:49.723" Score="2" ViewCount="49" Body="&lt;p&gt;I know that &lt;span class=&quot;math-container&quot;&gt;$QFT_n|0\rangle$&lt;/span&gt; is equivalent to &lt;span class=&quot;math-container&quot;&gt;$H_n|0\rangle$&lt;/span&gt;&#xA;(&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9769/why-qft-can-be-replaced-by-hadamard-gates&quot;&gt;mathematical proof&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;And it is also easy to prove that &lt;span class=&quot;math-container&quot;&gt;$QFT_1$&lt;/span&gt; is equivalent to &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; (applied to one QuBit).&lt;/p&gt;&#xA;&lt;p&gt;From looking at the circuit below it seems clear to me that the gates should also be equivalent if &lt;span class=&quot;math-container&quot;&gt;$|x_1\rangle$&lt;/span&gt; is in any state and all other QuBits are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&#xA;This should be true because none of the controlled &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; gates are applied to &lt;span class=&quot;math-container&quot;&gt;$|x_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I do not know how to prove this mathematically. Can anyone provide an elegant proof?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gtbss.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gtbss.png&quot; alt=&quot;from wikipedia 3&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12796" LastEditorUserId="55" LastEditDate="2020-08-01T11:40:47.853" LastActivityDate="2020-08-01T11:40:47.853" Title="Prove that QFT and Walsh-Hadamard gates give the same output when acting on $\lvert x\rangle\lvert 0\rangle$" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;quantum-fourier-transform&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2020-08-03T21:17:33.953" ContentLicense="CC BY-SA 4.0" />
  <row Id="13077" PostTypeId="1" CreationDate="2020-07-29T01:02:27.080" Score="1" ViewCount="68" Body="&lt;p&gt;Although this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4350/general-construction-of-w-n-state&quot;&gt;question&lt;/a&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W_3^1 = \frac{1}{\sqrt{3}}(|001\rangle  + |010\rangle + |100\rangle).&#xA;$$&lt;/span&gt;&#xA;An orthogonal state to this state would be (from &lt;a href=&quot;https://arxiv.org/pdf/1909.00862.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper, page 4)&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W_3^2 = \frac{1}{\sqrt{3}}(|001\rangle  - |010\rangle + |111\rangle).&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-08-27T12:54:17.243" LastActivityDate="2020-08-27T12:54:17.243" Title="Generalized construction of W basis" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13078" PostTypeId="2" ParentId="13056" CreationDate="2020-07-29T03:25:47.963" Score="1" Body="&lt;p&gt;After several days of thinking and researching, I decided to answer my own question.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;N.B.&lt;/strong&gt; The tensor product symbol &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; are omitted when there is no risk in confusion, especially when the index is different. In symbol,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_iB_j = A_i \otimes B_j (i \neq j).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Firstly, for case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i \beta B} Z_i Z_j e^{-i \beta B},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;we only consider qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, in which &lt;span class=&quot;math-container&quot;&gt;$B_e=\sum_{k \in e}{X_k}$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_j$&lt;/span&gt; act on different qubits,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i{(X_i+X_j)}}=e^{i((X_i\otimes I_j)+(I_i \otimes X_j))}=e^{iX_i}e^{iX_j}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;e^{-i \beta X} &#xA;&amp;amp; = e^{-i \beta \begin{bmatrix}0 &amp;amp; 1\\ 1 &amp;amp; 0\end{bmatrix}} \\&#xA;&amp;amp; = e^{-i \beta \begin{bmatrix}\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}\end{bmatrix} &#xA;              \begin{bmatrix}1 &amp;amp; 0\\ 0 &amp;amp; 1\end{bmatrix}&#xA;              \begin{bmatrix}\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\end{bmatrix}} \\&#xA;&amp;amp; = \begin{bmatrix}\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} &amp;amp; -\frac{1}{\sqrt{2}}\end{bmatrix} &#xA;    \begin{bmatrix}e^{-i \beta} &amp;amp; 0\\ 0 &amp;amp; e^{-i \beta}\end{bmatrix}&#xA;    \begin{bmatrix}\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}}\end{bmatrix} \\&#xA;&amp;amp; = \begin{bmatrix}\cos(\beta) &amp;amp; -i\sin(\beta)\\ -i\sin(\beta) &amp;amp; \cos(\beta)\end{bmatrix} \\&#xA;&amp;amp; = I\cos(\beta)-iX\sin(\beta).&#xA;\end{align} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;e^{i \beta X} &#xA;&amp;amp; = I\cos(\beta)+iX\sin(\beta).&#xA;\end{align} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;e^{i \beta X} Z e^{-i \beta X} &amp;amp; = (I\cos(\beta)+iX\sin(\beta))Z(I\cos(\beta)-iX\sin(\beta)) \\&#xA;&amp;amp; = Z \cos(2\beta) + Y\sin(2\beta).&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the Ising traverse field Hamiltonian, we only consider &lt;span class=&quot;math-container&quot;&gt;$$G_{e=(i,k)}=Z_iZ_k.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$e^{i \gamma Z_iZ_k}$&lt;/span&gt;, it can be evaluated as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;e^{i \gamma Z_iZ_k} &amp;amp;= e^{i \gamma \begin{bmatrix}1&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;-1&amp;amp;&amp;amp;\\&amp;amp;&amp;amp;-1&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;1\end{bmatrix}} \\&#xA;&amp;amp; = \begin{bmatrix}e^{i\gamma}&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;e^{-i\gamma}&amp;amp;&amp;amp;\\&amp;amp;&amp;amp;e^{-i\gamma}&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;e^{i\gamma}\end{bmatrix} \\&#xA;&amp;amp; = \begin{bmatrix}\cos\gamma+i\sin\gamma &amp;amp;&amp;amp;&amp;amp;\\&amp;amp;\cos\gamma-i\sin\gamma&amp;amp;&amp;amp;\\&amp;amp;&amp;amp;\cos\gamma-i\sin\gamma&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;\cos\gamma+i\sin\gamma\end{bmatrix} \\&#xA;&amp;amp; = \cos\gamma\begin{bmatrix}1&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;1&amp;amp;&amp;amp;\\&amp;amp;&amp;amp;1&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;1\end{bmatrix}+i\sin\gamma\begin{bmatrix}1&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;-1&amp;amp;&amp;amp;\\&amp;amp;&amp;amp;-1&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;1\end{bmatrix} \\&#xA;&amp;amp; = I_i I_k \cos\gamma + i Z_1Z_2 \sin\gamma.&#xA;\end{align} &#xA;$$&lt;/span&gt;&#xA;We can calculate two-qubit operations independently, such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Numerically, if you cannot convince yourself,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y_i \otimes I_k = \begin{bmatrix} &amp;amp;&amp;amp;-i&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;-i\\i&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;i&amp;amp;&amp;amp; \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_i \otimes Z_k = \begin{bmatrix} 1&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;-1&amp;amp;&amp;amp;\\&amp;amp;&amp;amp;-1&amp;amp;\\&amp;amp;&amp;amp;&amp;amp; 1\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(Y_i \otimes I_k)(Z_i \otimes Z_k) = \begin{bmatrix} &amp;amp;&amp;amp;i&amp;amp;\\&amp;amp;&amp;amp;&amp;amp;-i\\i&amp;amp;&amp;amp;&amp;amp;\\&amp;amp;-i&amp;amp;&amp;amp;\end{bmatrix} = i(X_i \otimes Z_k).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, for a more specific example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;e^{-i \gamma Z_iZ_k} Y_i e^{i \gamma Z_iZ_k} &amp;amp; = (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) \\&#xA;&amp;amp; = 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 \\&#xA;&amp;amp; = Y_i \cos 2\gamma - X_iZ_k\sin 2\gamma.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Q.E.D.&lt;/p&gt;&#xA;" OwnerUserId="12693" LastEditorUserId="12693" LastEditDate="2020-07-30T02:32:30.707" LastActivityDate="2020-07-30T02:32:30.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13080" PostTypeId="1" AcceptedAnswerId="13087" CreationDate="2020-07-29T07:43:33.670" Score="0" ViewCount="77" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12803" LastEditorUserId="55" LastEditDate="2020-07-29T18:12:23.930" LastActivityDate="2020-07-29T18:12:23.930" Title="How to undo an operation in qiskit on jupyter notebook?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13082" PostTypeId="2" ParentId="13076" CreationDate="2020-07-29T08:19:07.623" Score="3" Body="&lt;p&gt;I think your explanation based on the circuit is perfectly adequate.&lt;/p&gt;&#xA;&lt;p&gt;For a more rigorous &amp;quot;proof&amp;quot;, why not simply take the output of the circuit? Substitute in &lt;span class=&quot;math-container&quot;&gt;$x_i=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and see that all the outputs are &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\neq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+(-1)^{x_1}|1\rangle)/\sqrt{2}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1$&lt;/span&gt;, exactly as it would be for the Hadamard transform.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, simply repeat the proof in the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9771/1837&quot;&gt;answer you cite&lt;/a&gt; for two inputs: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|0\rangle^{\otimes(n-1)}$&lt;/span&gt;. If it works for those two, by linearity it must work for any input on the first qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-29T08:19:07.623" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13083" PostTypeId="1" CreationDate="2020-07-29T10:04:16.990" Score="1" ViewCount="110" Body="&lt;p&gt;Considering a &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-matrix of a circuit with, say, 4 qubits, is it possible to trace out 3 of them from &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; - for example qubits &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; - thus gaining the process matrix describing what happens to &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;?&#xA;If yes, since it seems to me different from partial trace for a density matrix, could you please give me the definition?&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-matrix of an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is a matrix &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; such that the evolution of a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{gather}&#xA;\mathcal{E}(\rho) = \sum_{i,j}\chi_{i,j}P_i \rho P_j&#xA;\end{gather}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\{P_0, P_1,\dots ,P_{d^{2}−1}\}$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli basis containing &lt;span class=&quot;math-container&quot;&gt;$d^{2} = 4^{n}$&lt;/span&gt; elements.&lt;/p&gt;&#xA;&lt;p&gt;An estimation method to compute the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-matrix is available at 8.4.2 of Nielsen &amp;amp; Chuang's Quantum Computation and Quantum Information.&lt;/p&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="55" LastEditDate="2020-11-25T10:04:03.457" LastActivityDate="2020-11-25T10:04:03.457" Title="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$?" Tags="&lt;partial-trace&gt;&lt;quantum-process-tomography&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13084" PostTypeId="2" ParentId="13012" CreationDate="2020-07-29T10:27:10.277" Score="2" Body="&lt;p&gt;An example of a state which yeilds an entangled state when you trace one qubit out, is the 3-qubit &amp;quot;W&amp;quot; state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\lvert W_3 \rangle = \tfrac{1}{\sqrt3} \Bigl( \lvert 100 \rangle + \lvert 010 \rangle + \lvert 001 \rangle \Bigr)&#xA;$$&lt;/span&gt;&#xA;Taking the outer product with itself, we obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\lvert W_3 \rangle\!\langle W_3 \rvert = \tfrac{1}{3} \Bigl(&#xA;\!\begin{aligned}[t]&amp;amp;&#xA; \lvert 100 \rangle\!\langle 100 \rvert + \lvert 100 \rangle\!\langle 010 \rvert&#xA; + \lvert 100 \rangle\!\langle 001 \rvert \phantom{\Big)}&#xA; \\&amp;amp;+ &#xA; \lvert 010 \rangle\!\langle 100 \rvert + \lvert 010 \rangle\!\langle 010 \rvert&#xA; + \lvert 010 \rangle\!\langle 001 \rvert &#xA; \\&amp;amp;+ &#xA; \lvert 001 \rangle\!\langle 100 \rvert + \lvert 001 \rangle\!\langle 010 \rvert&#xA; + \lvert 001 \rangle\!\langle 001 \rvert&#xA;\Bigr) \end{aligned}&#xA;$$&lt;/span&gt;&#xA;If we trace out the third qubit, we then obtain the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho = \mathrm{tr}_3\Bigl(\lvert W_3 \rangle\!\langle W_3 \rvert\Bigr)&#xA;&amp;amp;= \tfrac{1}{3} \Bigl(&#xA; \lvert 10 \rangle\!\langle 10 \rvert + \lvert 10 \rangle\!\langle 01 \rvert + &#xA; \lvert 01 \rangle\!\langle 10 \rvert + \lvert 01 \rangle\!\langle 01 \rvert&#xA; + \lvert 00 \rangle\!\langle 00 \rvert&#xA;\Bigr)&#xA;\\&amp;amp;= \tfrac{1}{3} \lvert 00 \rangle\!\langle 00 \rvert +  \tfrac{2}{3} \lvert \Psi^+ \rangle\!\langle \Psi^+ \rvert,&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;where in particular &lt;span class=&quot;math-container&quot;&gt;$\lvert \Psi^+ \rangle = \tfrac{1}{\sqrt 2}\bigl( \lvert 01 \rangle + \lvert 10 \rangle \bigr)$&lt;/span&gt; is a Bell state.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a rank-2 operator with different eigenvalues: any decomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as a convex combination of other density operators, can only involve terms whose eigenvectors are supported on &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}\,\{ \lvert 00 \rangle, \lvert \Psi^+ \rangle \}$&lt;/span&gt;. Any mixed tensor product density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_A \otimes \rho_B$&lt;/span&gt; has an eigenbasis consisting of two or more product states; but the only product state contained in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}\,\{ \lvert 00 \rangle, \lvert \Psi^+ \rangle \}$&lt;/span&gt; is the state &lt;span class=&quot;math-container&quot;&gt;$\lvert 00 \rangle$&lt;/span&gt; itself. It follows that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; cannot be decomposed as a convex combination of products of possibly-mixed states, and is entangled.&lt;/p&gt;&#xA;&lt;p&gt;More generally, if for &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; 1$&lt;/span&gt; we define &lt;span class=&quot;math-container&quot;&gt;$\lvert W_n \rangle$&lt;/span&gt; as the analogous &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-term uniform superposition of standard basis states with a single 1, we may describe it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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&#xA;$$&lt;/span&gt;&#xA;so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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&#xA;$$&lt;/span&gt;&#xA;which for larger values of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is closer and closer to being a pure entangled state, while still being mixed for any finite &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2020-07-29T10:27:10.277" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13085" PostTypeId="1" AcceptedAnswerId="13098" CreationDate="2020-07-29T12:58:45.643" Score="0" ViewCount="969" Body="&lt;p&gt;I know that when a qubit is described in a superposition state as &lt;span class=&quot;math-container&quot;&gt;$\alpha|0⟩ + \beta|1⟩$&lt;/span&gt;, then the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\alpha^2$&lt;/span&gt; and probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1⟩$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\beta^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; belong to the complex number set, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So let's say that, the amplitude of state, say, &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\alpha=i$&lt;/span&gt;, which means that the probabilty of measuring the &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; state will be &lt;span class=&quot;math-container&quot;&gt;$\alpha^2=i^2=-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11868" LastActivityDate="2020-07-30T12:30:00.660" Title="Can quantum states have negative probability?" Tags="&lt;quantum-state&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13086" PostTypeId="2" ParentId="13085" CreationDate="2020-07-29T13:01:51.050" Score="14" Body="&lt;p&gt;The probability is &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$\alpha^2$&lt;/span&gt;, and thus always non-negative.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="9006" LastEditDate="2020-07-30T07:03:54.837" LastActivityDate="2020-07-30T07:03:54.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13087" PostTypeId="2" ParentId="13080" CreationDate="2020-07-29T13:41:46.963" Score="2" Body="&lt;p&gt;To remove the last gate you can do &lt;code&gt;qc.data.pop()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1)&#xA;qc.h(0)&#xA;qc.draw('text')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐&#xA;q_0: ┤ H ├&#xA;     └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.data.pop()&#xA;qc.draw('text')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-07-29T13:41:46.963" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13088" PostTypeId="1" CreationDate="2020-07-29T14:55:04.980" Score="1" ViewCount="53" Body="&lt;p&gt;I might be asking something quite obvious but why is it stated that only one evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is needed in the Deutsch-Jozsa algorithm?&lt;/p&gt;&#xA;&lt;p&gt;If we have a quantum oracle for &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n\rightarrow\{0,1\}$&lt;/span&gt; and we apply the oracle to the &lt;span class=&quot;math-container&quot;&gt;$(n+1)$&lt;/span&gt;-qubit state, we get the quantum state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^{n+1}}}\sum_{n=0}^{2^n-1}|x\rangle (|f(x)\rangle-|1\oplus f(x)\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why does the algorithm involve only a single evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;? In order to apply the quantum oracle, doesn't the application of the quantum oracle involve full knowledge of the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;? Don't we have to calculate &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x=0,1,2,...,2^n-1$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12480" LastEditorUserId="55" LastEditDate="2020-07-29T15:11:13.767" LastActivityDate="2020-07-29T15:11:13.767" Title="Deutsch-Jozsa: why is only one evaluation of $f$ needed?" Tags="&lt;algorithm&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2020-07-29T19:30:32.060" ContentLicense="CC BY-SA 4.0" />
  <row Id="13089" PostTypeId="2" ParentId="12517" CreationDate="2020-07-29T17:12:38.843" Score="-3" Body="&lt;p&gt;In my development Anaconda environment, I faced similar issues related to setup, I too observed alike issues asking by peoples in big open forums, I suggested the below approach where they respond back it's working for them.&lt;/p&gt;&#xA;&lt;p&gt;There are many causes related too Setup.py but I would suggest you the common approach to resolve.&#xA;It usually comes when your Anaconda environment owning an older version of Setup tools. I would recommend to upgrade your setup tools and conda or pip based on the usage.&#xA;Whenever we are using the Anaconda environment after a long period, it's always advisable to use latest and greatest python setuptools and conda or pip versions.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully it will resolve your issue.&lt;/p&gt;&#xA;" OwnerUserId="12805" LastEditorUserId="45" LastEditDate="2020-07-29T19:50:55.787" LastActivityDate="2020-07-29T19:50:55.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13090" PostTypeId="1" CreationDate="2020-07-29T17:33:50.213" Score="2" ViewCount="47" Body="&lt;p&gt;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.)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance to anyone who can help&lt;/p&gt;&#xA;" OwnerUserId="12806" LastEditorUserId="55" LastEditDate="2020-08-27T12:53:48.620" LastActivityDate="2020-08-27T12:53:48.620" Title="How do I compare the secret key rate (kbps) with the secret key rate per channel use?" Tags="&lt;communication&gt;&lt;qkd&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13091" PostTypeId="2" ParentId="13069" CreationDate="2020-07-29T17:34:39.487" Score="0" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;While designing your circuit are you sure 6 Qubits were really&#xA;required for &lt;em&gt;&lt;strong&gt;X&lt;/strong&gt;&lt;/em&gt;  gate . As i am observing in your above plot there are&#xA;two possible probabilities hopefully that might be right ,&lt;/p&gt;&#xA;&lt;p&gt;I would suggest you to start designing the above circuit with 2 Qubits&#xA;and observe the outcome.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="12805" LastActivityDate="2020-07-29T17:34:39.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13092" PostTypeId="1" AcceptedAnswerId="13094" CreationDate="2020-07-29T17:36:06.060" Score="1" ViewCount="94" Body="&lt;p&gt;I am trying to simulate an experiment on IBM's melbourne quantum computer and here are the results&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Qasm simulator :&lt;a href=&quot;https://i.stack.imgur.com/yhLt9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yhLt9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;ibmq_16_melbourne:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7SQ02.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7SQ02.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;error&lt;a href=&quot;https://i.stack.imgur.com/MJyJy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MJyJy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;why is there such high probability of unwanted states i.e &lt;code&gt;01&lt;/code&gt; and &lt;code&gt;10&lt;/code&gt;. Also when the circuit is transpiled on the melbourne computer the circuit operates between &lt;span class=&quot;math-container&quot;&gt;$q[4]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q[10]$&lt;/span&gt;, is these usual.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-07-29T18:11:31.730" LastActivityDate="2020-07-30T02:13:28.933" Title="IBMQ_Melbourne Readout error" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13094" PostTypeId="2" ParentId="13092" CreationDate="2020-07-29T18:53:34.027" Score="1" Body="&lt;p&gt;Every rotation or controlled operation you perform on each individual qubit has an error associated to it, you can check it &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; by selecting a computer and hovering over each Qubit, through the error range bar or through Python as you seem to have done.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;qc.count_ops().get('cx')&lt;/code&gt;. Another thing that may help is setting the layout method to &amp;quot;noise adaptive&amp;quot;, by including &lt;code&gt;layout_method='noise_adaptive'&lt;/code&gt; into the transpiler parameters. You should check the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.compiler.transpile.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;transpiler documentation&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12778" LastEditorUserId="12778" LastEditDate="2020-07-30T02:13:28.933" LastActivityDate="2020-07-30T02:13:28.933" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13095" PostTypeId="2" ParentId="13090" CreationDate="2020-07-29T21:50:02.837" Score="2" Body="&lt;p&gt;Indeed, the PLOB bound is an ultimate upper bound for repeaterless quantum communications, and is thus derived by averaging over &lt;span class=&quot;math-container&quot;&gt;$n\rightarrow \infty$&lt;/span&gt; uses of the communications channel - Hence why the capacity is given as bits per channel use.&lt;/p&gt;&#xA;&lt;p&gt;If you wish to more closely compare the PLOB bound to other well known protocols, look at Supplementary Note 6 in the &lt;a href=&quot;https://arxiv.org/abs/1510.08863&quot; rel=&quot;nofollow noreferrer&quot;&gt; original paper &lt;/a&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1711.09909&quot; rel=&quot;nofollow noreferrer&quot;&gt; this paper also &lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9839" LastActivityDate="2020-07-29T21:50:02.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13096" PostTypeId="1" AcceptedAnswerId="13099" CreationDate="2020-07-30T01:17:20.990" Score="2" ViewCount="99" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;However, is there any standard to choose the model we apply?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-08-27T12:53:09.170" LastActivityDate="2020-08-27T12:53:09.170" Title="What is the standard noise channel that is applied in simulations?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13097" PostTypeId="1" CreationDate="2020-07-30T07:04:33.907" Score="6" ViewCount="112" Body="&lt;p&gt;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.&#xA;For example, if we consider &lt;span class=&quot;math-container&quot;&gt;$N=15$&lt;/span&gt;, we have all the &lt;span class=&quot;math-container&quot;&gt;$\text{gcd}$&lt;/span&gt; of 15 to be 2,7,8,11,13 (although I suspect that 4 is not considered as it is &lt;span class=&quot;math-container&quot;&gt;$2^2$&lt;/span&gt;). For &lt;span class=&quot;math-container&quot;&gt;$a=2 \,\text{or}\, 13$&lt;/span&gt;, we swap qubits 0 and 1, 1 and 2, 2 and 3. If &lt;span class=&quot;math-container&quot;&gt;$a=7 \,\text{or}\, 8$&lt;/span&gt;, we swap 2 and 3, 1 an 2, 0 and 1. If &lt;span class=&quot;math-container&quot;&gt;$a=11$&lt;/span&gt;, we swap 1 and 3, 0 and 2. Also, if &lt;span class=&quot;math-container&quot;&gt;$a=7, 11 \,\text{or}\, 13$&lt;/span&gt;, we add an X gate on all the 4 added qubits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I want to know how we chose which qubits to swap for a particular number, and how we can generalize it, if possible.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12811" LastEditorUserId="9006" LastEditDate="2020-07-30T07:12:32.497" LastActivityDate="2021-05-06T18:04:10.580" Title="Is there a general order finding quantum algorithm for a given a and N?" Tags="&lt;qiskit&gt;&lt;shors-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13098" PostTypeId="2" ParentId="13085" CreationDate="2020-07-30T07:10:26.410" Score="4" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \alpha|0\rangle + \beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, we can have for example a qubit&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \frac{1}{\sqrt{2}}(|0\rangle - \beta|1\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It may seem that probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is negative, but the coefficient &lt;span class=&quot;math-container&quot;&gt;$-\frac{1}{\sqrt{2}}$&lt;/span&gt; is a complex amplitude, not the probability itself.&lt;/p&gt;&#xA;&lt;p&gt;The probabilities are, as already mentioned by Norbert Schuch, calculated as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(|0\rangle) = |\alpha|^2&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(|1\rangle) = |\beta|^2&#xA;$$&lt;/span&gt;&#xA;Hence they are non-negative.&lt;/p&gt;&#xA;&lt;p&gt;The negative sign in my example is caused by non-zero phase of the qubit which is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; in this case (note that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i \pi} = -1$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-07-30T07:10:26.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13099" PostTypeId="2" ParentId="13096" CreationDate="2020-07-30T08:23:21.993" Score="1" Body="&lt;p&gt;Some thoughts:&lt;/p&gt;&#xA;&lt;h2&gt;A theoretical perspective&lt;/h2&gt;&#xA;&lt;p&gt;From a theoretical perspective, the depolarizing channel is the 'standard' (if there is such a thing) or by some means the most applicable.&lt;/p&gt;&#xA;&lt;p&gt;Because the Paulis (together with the identity operator) form a basis for &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, if a code can correct the &lt;span class=&quot;math-container&quot;&gt;$X, Y$&lt;/span&gt; &lt;em&gt;and&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; flips on a certain qubit (and it it is able to correctly identify no error (i.e. '&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;-flip') having happened), it can correct &lt;em&gt;all&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\frac{p}{3}$&lt;/span&gt;, thereby obtaining the depolarizing channel.&lt;/p&gt;&#xA;&lt;p&gt;The depolarizing channel &lt;span class=&quot;math-container&quot;&gt;$\Lambda_{\mathrm{depo}}$&lt;/span&gt; can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda_{\mathrm{deph}}\left(\begin{bmatrix}a &amp;amp; b \\ b^{*} &amp;amp; d\end{bmatrix}\right) = \begin{bmatrix} (1-\frac{2p}{3})a + \frac{2p}{3}d &amp;amp; (1-\frac{4p}{3}) b \\ (1-\frac{4p}{3})b^{*} &amp;amp; (1-\frac{2p}{3})d + \frac{2p}{3}a\end{bmatrix}.&#xA;$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$d = 1-a$&lt;/span&gt;, we can rewrite this to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda_{\mathrm{deph}}\left(\rho_{\mathrm{in}}\right) = (1-\frac{4p}{3})\rho_{\mathrm{in}} + \frac{4p}{3} \frac{I}{2},&#xA;$$&lt;/span&gt;&#xA;which is a convex combination of the input &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{in}}$&lt;/span&gt; and the &lt;em&gt;maximally mixed&lt;/em&gt; state &lt;span class=&quot;math-container&quot;&gt;$\frac{I}{2}$&lt;/span&gt;.&#xA;Furthermore, if you would equate &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; to the elapsed time, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; would asymptotically go to &lt;span class=&quot;math-container&quot;&gt;$\frac{3}{4}$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;h2&gt;A physical perspective&lt;/h2&gt;&#xA;&lt;p&gt;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.&#xA;A good first model for noise in qubits is the combination of two channels, the dephasing channel &lt;span class=&quot;math-container&quot;&gt;$\Lambda_{\mathrm{deph}}$&lt;/span&gt; and the amplitude damping channel &lt;span class=&quot;math-container&quot;&gt;$\Lambda_{\mathrm{amp}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Loosely speaking, the dephasing channel map destroys the coherent phase between the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda_{\mathrm{deph}}\left(\begin{bmatrix}a &amp;amp; b \\ b^{*} &amp;amp; 1-a\end{bmatrix}\right) = \begin{bmatrix}a &amp;amp; e^{-\frac{t}{T_{2}}} b \\ e^{-\frac{t}{T_{2}}}b^{*} &amp;amp; 1-a\end{bmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt; is known as the characteristic qubit dephasing time.&lt;/p&gt;&#xA;&lt;p&gt;The Kraus operators of &lt;span class=&quot;math-container&quot;&gt;$\Lambda_{\mathrm{deph}}$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$A_{1} = \sqrt{1-p}I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_{2} = \sqrt{p}Z$&lt;/span&gt;, so it is still a Pauli channel, which can help in the analysis or simulation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Lambda_{\mathrm{amp}}$&lt;/span&gt; is a little bit trickier: it simulates the relaxation of the excited (by convention &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) state, and maps it to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda_{\mathrm{amp}}\left(\begin{bmatrix}a &amp;amp; b \\ b^{*} &amp;amp; 1-a\end{bmatrix}\right) = \begin{bmatrix}a &amp;amp; e^{-\frac{t}{2T_{1}}} b \\ e^{-\frac{t}{2T_{1}}} b^{*} &amp;amp; e^{-\frac{t}{T_{1}}}(1-a)\end{bmatrix},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; is known as the qubit relaxation time.&lt;/p&gt;&#xA;&lt;p&gt;The Kraus operators are also a little trickier: &lt;span class=&quot;math-container&quot;&gt;$B_{1} = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; \sqrt{1-p}\end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_{2} = \begin{bmatrix}0 &amp;amp; \sqrt{p} \\ 0 &amp;amp; 0\end{bmatrix}$&lt;/span&gt;. 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).&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-07-30T12:11:25.663" LastActivityDate="2020-07-30T12:11:25.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13100" PostTypeId="1" AcceptedAnswerId="13114" CreationDate="2020-07-30T09:45:56.260" Score="2" ViewCount="62" Body="&lt;p&gt;Given density operator of a composite system, say &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, we can always calculate reduced density operators of individual system i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}=Tr_{B}(\rho_{AB})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{B}=Tr_{A}(\rho_{AB})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can we calculate density matrix of a composite system, &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, given reduced density operators &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{B}$&lt;/span&gt; and also knowing that &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{B}$&lt;/span&gt; are mixed state density operators? If yes, then how?&lt;/p&gt;&#xA;" OwnerUserId="10368" LastEditorUserId="55" LastEditDate="2020-08-01T11:48:08.687" LastActivityDate="2020-08-01T11:48:08.687" Title="Can we compute a full density operator $\rho_{AB}$ from its reduced density operators $\rho_A$ and $\rho_B$?" Tags="&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13101" PostTypeId="2" ParentId="13100" CreationDate="2020-07-30T09:53:28.580" Score="3" Body="&lt;p&gt;No. For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}=\frac{I}{4},\qquad \rho_{AB}=\frac{1}{2}(|00\rangle+|11\rangle)(\langle00|+\langle 11|)&#xA;$$&lt;/span&gt;&#xA;both have the same reduced density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho_A=\rho_B=I/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-07-30T09:53:28.580" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13102" PostTypeId="1" CreationDate="2020-07-30T10:34:58.533" Score="3" ViewCount="120" Body="&lt;p&gt;Can someone suggest me a way to load a distribution (for example a discretized Gaussian distribution) into a quantum computer using a quantum circuit?&lt;/p&gt;&#xA;&lt;p&gt;I tried to implement the code using Qiskit.&lt;/p&gt;&#xA;" OwnerUserId="12747" LastEditorUserId="9006" LastEditDate="2020-07-31T07:01:40.577" LastActivityDate="2020-07-31T07:01:40.577" Title="How can I load a probability distribution using a quantum circuit in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13103" PostTypeId="2" ParentId="13102" CreationDate="2020-07-30T12:03:12.983" Score="1" Body="&lt;p&gt;Several quantum circuit representations for common distributions are given in &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/tree/master/qiskit/aqua/components/uncertainty_models&quot; rel=&quot;nofollow noreferrer&quot;&gt;uncertainty models&lt;/a&gt;.&#xA;For generic probability distributions, you can train a quantum circuit representation using quantum generative adversarial networks. For a respective tutorial, please see &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/legacy_tutorials/aqua/machine_learning/qgans_for_loading_random_distributions.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12815" LastActivityDate="2020-07-30T12:03:12.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13104" PostTypeId="2" ParentId="13085" CreationDate="2020-07-30T12:30:00.660" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In 1942, Paul Dirac wrote a paper &amp;quot;The Physical Interpretation of Quantum Mechanics&amp;quot; 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 &amp;quot;negative probability&amp;quot; in perturbative gauge theories. The main purpose of the ghosts is to cancel the contributions from unphysical polarisations of gauge fields in loops.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;However, one never obtains &amp;quot;negative probability&amp;quot; densities when one discusses single observables. One obtains &amp;quot;negative probability&amp;quot; densities only when one discusses joint distributions of incompatible observables.&lt;/p&gt;&#xA;&lt;p&gt;There are two works of Feynman about negative probabilities.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;R. P. Feynman, Simulating physics with computers (Chapter 6), Int. J. Theor. Phys., 21, 467 – 488 (1982).&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-07-30T12:30:00.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13105" PostTypeId="2" ParentId="13102" CreationDate="2020-07-30T12:57:35.907" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.algorithms import AmplitudeEstimation&#xA;from qiskit.aqua.components.uncertainty_models import MultivariateNormalDistribution&#xA;from qiskit.finance.components.uncertainty_problems import FixedIncomeExpectedValue&#xA;&#xA;# Create a suitable multivariate distribution&#xA;mvnd = MultivariateNormalDistribution(num_qubits=[2, 2],&#xA;                                      low=[0, 0], high=[0.12, 0.24],&#xA;                                      mu=[0.12, 0.24], sigma=0.01 * np.eye(2))&#xA;&#xA;# Create fixed income component&#xA;fixed_income = FixedIncomeExpectedValue(mvnd, np.eye(2), np.zeros(2),&#xA;                                        cash_flow=[1.0, 2.0], c_approx=0.125)&#xA;&#xA;# Set number of evaluation qubits (samples)&#xA;num_eval_qubits = 5&#xA;&#xA;# Construct and run amplitude estimation&#xA;algo = AmplitudeEstimation(num_eval_qubits, fixed_income)&#xA;result = algo.run(BasicAer.get_backend('statevector_simulator'))&#xA;&#xA;print('Estimated value:\t%.4f' % result['estimation'])&#xA;print('Probability:    \t%.4f' % result['max_probability'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-07-30T12:57:35.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13106" PostTypeId="1" CreationDate="2020-07-30T13:08:20.487" Score="4" ViewCount="95" Body="&lt;p&gt;I want to understand the form of the intrinsic Hamiltonian of the IBM machines, such as &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;, and how this affects the data I get out when waiting using identity gates.&lt;/p&gt;&#xA;&lt;p&gt;From the &lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/1_hamiltonian_and_gate_characterization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ZZ-characterisation tutorial&lt;/a&gt; in the documentation, it seems like the general form of the intrinsic Hamiltonian is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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),$$&lt;/span&gt;&#xA;with sums in theory over all &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits. Here &lt;span class=&quot;math-container&quot;&gt;$\nu_i\approx 5\,\text{GHz}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\xi_{ij}$&lt;/span&gt; seem to take values up to &lt;span class=&quot;math-container&quot;&gt;$\sim 100\,\text{kHz}$&lt;/span&gt;, but only significantly above &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; for nearest neighbours. Is this correctly understood?&lt;/p&gt;&#xA;&lt;p&gt;Now, if I prepare an initial state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}\left(|0\rangle +|1\rangle\right)\otimes|0\rangle^{N-1}$&lt;/span&gt; I do not see oscillations with a frequency anywhere near &lt;span class=&quot;math-container&quot;&gt;$5\,\text{GHz}$&lt;/span&gt;, but rather something closer to &lt;span class=&quot;math-container&quot;&gt;$100\,\text{kHz}$&lt;/span&gt;. Does this mean that the measurements are being taken in the co-moving frame with frequencies for each qubit being &lt;span class=&quot;math-container&quot;&gt;$\nu_i$&lt;/span&gt;? If so, why do I have these residual oscillations?&lt;/p&gt;&#xA;" OwnerUserId="12810" LastEditorUserId="12810" LastEditDate="2020-08-03T09:41:41.693" LastActivityDate="2020-08-03T09:41:41.693" Title="Form and effect of the intrinsic Hamiltonian on the IBM machines" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;physical-realization&gt;&lt;ibm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13108" PostTypeId="1" AcceptedAnswerId="13113" CreationDate="2020-07-30T16:38:35.170" Score="3" ViewCount="160" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12723" LastEditorUserId="55" LastEditDate="2020-08-01T10:35:43.140" LastActivityDate="2020-08-01T10:35:43.140" Title="Intuitively, what does the quantum Fourier transform do?" Tags="&lt;quantum-gate&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13109" PostTypeId="1" CreationDate="2020-07-30T17:13:52.870" Score="2" ViewCount="152" Body="&lt;p&gt;The first time I create a two qubits, two bits circuit and draw it the output is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q0_0 &#xA;q0_1 &#xA;c0_0 &#xA;c0_1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Each subsequent time I run my script (even after clearing all the variables) I get the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q1_0&#xA;q1_1 &#xA;c1_0 &#xA;c1_1 &#xA;. &#xA;. &#xA;. &#xA;qn_0 &#xA;qn_1 &#xA;cn_0 &#xA;cn_1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The number next to the qubit or classical bit increases every time. Is this a bug, is there a way to avoid this?&lt;/p&gt;&#xA;&lt;p&gt;I am using Qiskit 0.19.6.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JSxytm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JSxytm.png&quot; alt=&quot;12th time executing my script&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MghR4m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MghR4m.png&quot; alt=&quot;13th time executing my script&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12820" LastEditorUserId="9800" LastEditDate="2020-08-06T05:27:49.190" LastActivityDate="2020-08-06T05:27:49.190" Title="qiskit.QuantumCircuit and qiskit.QuantumCircuit.draw()" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13110" PostTypeId="2" ParentId="13109" CreationDate="2020-07-30T17:27:05.697" Score="5" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;&#xA;qr = QuantumRegister(2, 'q')&#xA;cr = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qr, cr)&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-07-30T17:27:05.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13111" PostTypeId="1" AcceptedAnswerId="13127" CreationDate="2020-07-30T19:14:33.730" Score="0" ViewCount="61" Body="&lt;p&gt;Let say we have a product state &lt;span class=&quot;math-container&quot;&gt;$$|\phi^+\rangle_{12}|\phi^+\rangle_{34}$$&lt;/span&gt; with particles (1,4) belong to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and (2,3) belong to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are say at distance of &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; from each other. When particle &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; measures his qubits &lt;span class=&quot;math-container&quot;&gt;$(1,4)$&lt;/span&gt; in the BSM (Bell state measurement), there is correlation to the BSM of the &lt;span class=&quot;math-container&quot;&gt;$(2,3)$&lt;/span&gt; qubits of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does the distance between these two parties &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; have some role to play?&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is this cost some function of &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and the number of qubits (in this case &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;). And if there is some transmission cost how does one reduce this?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can somebody atleast give some references?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="6070" LastEditDate="2020-07-31T19:00:03.460" LastActivityDate="2020-07-31T22:46:19.777" Title="Entanglement and teleportation transmission costs" Tags="&lt;communication&gt;&lt;entanglement-swapping&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13113" PostTypeId="2" ParentId="13108" CreationDate="2020-07-30T21:55:40.190" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; basis state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the qubit number. Now suppose &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;QFT |00\rangle &amp;amp;= 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)&#xA;\\&#xA;QFT |01\rangle &amp;amp;= 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)&#xA;\\&#xA;QFT |10\rangle &amp;amp;= 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)&#xA;\\&#xA;QFT |11\rangle &amp;amp;= 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)&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From here one can see that each &lt;span class=&quot;math-container&quot;&gt;$|j \rangle$&lt;/span&gt; after QFT becomes a superposition state of all basis states with equal probabilities (in this case the probability is equal to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;). And because QFT is a unitary operator, if &lt;span class=&quot;math-container&quot;&gt;$\langle j | j'\rangle= 0$&lt;/span&gt; (when &lt;span class=&quot;math-container&quot;&gt;$j \ne j'$&lt;/span&gt;), then &lt;span class=&quot;math-container&quot;&gt;$\langle j |QFT^{\dagger} QFT | j'\rangle= 0$&lt;/span&gt;, so the states generated by &lt;span class=&quot;math-container&quot;&gt;$QFT | j\rangle$&lt;/span&gt; are different superposition states with equal probabilities that are orthogonal to each other.&lt;/p&gt;&#xA;&lt;p&gt;Now three qubit case. I will write down only for three cases:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;QFT &amp;amp;|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 = &#xA;\\&#xA;&amp;amp;=\frac{1}{2^{\frac{3}{2}}}\big( |0\rangle + |1\rangle + |2\rangle + |3\rangle + |4\rangle  + |5\rangle + |6\rangle + |7\rangle\big)&#xA;\\&#xA;QFT &amp;amp;|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 = &#xA;\\&#xA;&amp;amp;=\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)&#xA;\\&#xA;QFT &amp;amp;|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 =&#xA;\\&#xA; &amp;amp;=\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)&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This time also &lt;span class=&quot;math-container&quot;&gt;$QFT |j\rangle$&lt;/span&gt; generates superposition states with equal probabilities (note that &lt;span class=&quot;math-container&quot;&gt;$| \frac{e^{i\varphi}}{2^{\frac{3}{2}}}|^2 = \frac{1}{8}$&lt;/span&gt; for any given &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; ) that are orthogonal to each other. The same logic works for arbitrary number of qubits &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be regarded as one qubit QFT and note that &lt;span class=&quot;math-container&quot;&gt;$H |j \rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$j = 0,1$&lt;/span&gt;), in the same manner, also produces superposition states with equal probabilities that are orthogonal to each other.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If instead of computational basis &lt;span class=&quot;math-container&quot;&gt;$|j \rangle$&lt;/span&gt; we apply QFT on an arbitrary superposition state &lt;span class=&quot;math-container&quot;&gt;$\sum_{j = 0}^{2^n -1} a_j |j\rangle$&lt;/span&gt; things get slightly complicated:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|k \rangle$&lt;/span&gt; is equal to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As an example let's apply QFT on this Bell state &lt;span class=&quot;math-container&quot;&gt;$| \Phi^+ \rangle = \frac{1}{\sqrt{2}} \big(|00\rangle + |11\rangle \big) = \frac{1}{\sqrt{2}} \big(|0\rangle + |3\rangle \big)$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state is equal to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;, but the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt; states are equal &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;. Also, note that the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; state is zero in this case.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-31T04:49:11.653" LastActivityDate="2020-07-31T04:49:11.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13114" PostTypeId="2" ParentId="13100" CreationDate="2020-07-31T03:22:59.500" Score="2" Body="&lt;p&gt;In general, given only the reduced states, you cannot find a &lt;strong&gt;unique&lt;/strong&gt; state for the composite system. But you can certainly find states &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; such that their reduced states are &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}, \rho_{B}$&lt;/span&gt;. As a trivial example, consider the state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}=\rho_{A} \otimes \rho_{B}$&lt;/span&gt;, it is easy to check that it's reduced states give you &lt;span class=&quot;math-container&quot;&gt;$\rho_{A}, \rho_{B}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The real question is, why can't you find a unique composite state? Also, are there instances where you can find unique extensions?&lt;/p&gt;&#xA;&lt;p&gt;The answer, like many things in quantum information theory, lies in entanglement. If the state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathbb{I}}{2}$&lt;/span&gt;) but the four Bell states are orthogonal to each other and hence completely distinguishable.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-07-31T03:22:59.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13115" PostTypeId="1" AcceptedAnswerId="13116" CreationDate="2020-07-31T05:49:52.627" Score="3" ViewCount="173" Body="&lt;p&gt;We can calculate single qubit state by measuring it in pauli observables {&lt;span class=&quot;math-container&quot;&gt;$\sigma_{x},\sigma_{y},\sigma_{z}$&lt;/span&gt;} 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x}\otimes\sigma_{x}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_{y}\otimes\sigma_{y}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}\otimes\sigma_{z}$&lt;/span&gt; observables?&lt;/p&gt;&#xA;" OwnerUserId="10368" LastEditorUserId="8141" LastEditDate="2020-07-31T08:26:10.963" LastActivityDate="2020-07-31T21:02:35.687" Title="Calculating bipartite state from joint probability distribution" Tags="&lt;measurement&gt;&lt;tomography&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13116" PostTypeId="2" ParentId="13115" CreationDate="2020-07-31T08:25:40.767" Score="4" Body="&lt;p&gt;This would not be enough information to reconstruct the bi-partite state.&lt;/p&gt;&#xA;&lt;h2&gt;Single-qubit case&lt;/h2&gt;&#xA;&lt;p&gt;For the one-qubit case, reconstruction of the state (which we describe as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;) works, because the single-qubit Pauli observables &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_{x},\sigma_{y},\sigma_{z}\}$&lt;/span&gt; together with the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{I}$&lt;/span&gt;-operator creates a basis for the space of single-qubit density matrices. If our probabilities are &lt;span class=&quot;math-container&quot;&gt;$\{p_{I}=1,p_{x},p_{y}.p_{z}\}$&lt;/span&gt;, we reconstruct as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_{i \in \{I,x,y,z\}} p_{i}\sigma_{i}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Bi-partite case&lt;/h2&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; elements in this basis, and not the four in &lt;span class=&quot;math-container&quot;&gt;$\{I, \sigma_{x}\otimes \sigma_{x},\sigma_{y}\otimes \sigma_{y},\sigma_{z}\otimes \sigma_{z}\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The most obvious (and used) choice is to also include the cross products of all the Paulis. We then get a set of &lt;span class=&quot;math-container&quot;&gt;$4^{2} = 16$&lt;/span&gt; elements, which is called the two-qubit Pauli group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}^{2}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{P}^{2} = \{\sigma_{I},\sigma_{x},\sigma_{y},\sigma_{z}\} \otimes \{\sigma_{I},\sigma_{x},\sigma_{y},\sigma_{z}\}.&#xA;$$&lt;/span&gt;&#xA;If we would have all &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$p_{i}$&lt;/span&gt;'s, the reconstruction is as straightforward for the one-qubit case:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{2} = \sum_{i \in \{I,x,y,z\}\times \{I,x,y,z\}} p_{i}\sigma_{i}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You said you already have &lt;span class=&quot;math-container&quot;&gt;$p_{x,x}, p_{y,y}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{z,z}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$p_{I,I}$&lt;/span&gt; is a freebie because it needs to be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;; so you still need the &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; other probabilities.&lt;/p&gt;&#xA;&lt;h2&gt;Some intuition&lt;/h2&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We need to know how these two qubits act under &lt;em&gt;aymmetric&lt;/em&gt; coupling. That is to say, we need the probabilities for measurements of e.g. &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x} \otimes \sigma_{y}$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z} \otimes \sigma_{x}$&lt;/span&gt;. Of course, there are &lt;span class=&quot;math-container&quot;&gt;$|\{x,y,z\}\times \{x,y,z\}|=9$&lt;/span&gt; different elements here, but we already counted the three symmetric ones.&lt;/li&gt;&#xA;&lt;li&gt;We also need to know what they do &lt;em&gt;individually&lt;/em&gt;: 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma_{I}\otimes \{\sigma_{x},\sigma_{y},\sigma_{z}\}$&lt;/span&gt; and vice-versa: there are &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; of them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This gives a total of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (for &lt;span class=&quot;math-container&quot;&gt;$\sigma_{I}\otimes \sigma_{I}$&lt;/span&gt;) + &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; (for our original &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; operators) + &lt;span class=&quot;math-container&quot;&gt;$9-3 = 6$&lt;/span&gt; (for the asymmetric coupling operators) + &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; (for the individual operators). This sums up to &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt;, so we now have accounted for all of the operators.&lt;/p&gt;&#xA;&lt;h2&gt;Then how to actually get these other probabilities?&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9014/quantum-tomography-on-two-qubits&quot;&gt;This question&lt;/a&gt; deals with the same problem, and there I also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9026/8141&quot;&gt;explain&lt;/a&gt; how to obtain these &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; other probabilities from experimental outcomes. Note that these &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; measurements really &lt;em&gt;are&lt;/em&gt; not enough, and that you will need at least &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; different measurement results: you need all symmetric and asymmetric operators.&lt;/p&gt;&#xA;&lt;h2&gt;Final note + further reading&lt;/h2&gt;&#xA;&lt;p&gt;As a last remark, the techniques of reconstructing density matrices from probability distributions (or a finite number of measurement outcomes) are collectively known as &lt;em&gt;quantum state tomography&lt;/em&gt; or QST (It even has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page&lt;/a&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-07-31T21:02:35.687" LastActivityDate="2020-07-31T21:02:35.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13117" PostTypeId="2" ParentId="13115" CreationDate="2020-07-31T09:25:31.337" Score="0" Body="&lt;p&gt;&lt;strong&gt;1. Calculating &lt;span class=&quot;math-container&quot;&gt;$\langle \sigma_z \otimes \sigma_z \rangle$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \sigma_z \otimes \sigma_z \rangle = Tr\big(\sigma_z \otimes \sigma_z \rho\big) = \rho_{11} - \rho_{22} - \rho_{33} + \rho_{44}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As can be seen from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9026/9459&quot;&gt;answer&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho_{11}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho_{22}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho_{33}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{44}$&lt;/span&gt; are the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; correspondingly. This can be seen for example by calculating &lt;span class=&quot;math-container&quot;&gt;$Tr(P_{01} \rho) = \rho_{22}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P_{01} = |01\rangle \langle 01|$&lt;/span&gt; is the projector for the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;. Note, that &lt;span class=&quot;math-container&quot;&gt;$\rho_{11}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho_{22}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho_{33}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{44}$&lt;/span&gt; can be calculated from repeated experiments by applying &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; basis measurements (also it is described in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9026/9459&quot;&gt;answer&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Calculating &lt;span class=&quot;math-container&quot;&gt;$\langle \sigma_x \otimes \sigma_x \rangle$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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) =&#xA;\\&#xA;= 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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because &lt;span class=&quot;math-container&quot;&gt;$H\sigma_z H = \sigma_x$&lt;/span&gt; and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_(linear_algebra)#:%7E:text=the%20inner%20product%3A-,Cyclic%20property,known%20as%20the%20cyclic%20property.&amp;amp;text=where%20the%20first%20equality%20is,is%20not%20true%20in%20general.&quot; rel=&quot;nofollow noreferrer&quot;&gt;cyclic property&lt;/a&gt; of the trace. Here &lt;span class=&quot;math-container&quot;&gt;$\rho' =  H \otimes H \; \rho \; H \otimes H$&lt;/span&gt;. So, after applying &lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt; the the initial &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we just need to calculate &lt;span class=&quot;math-container&quot;&gt;$Tr\big( \sigma_z \otimes \sigma_z \; \rho'\big)$&lt;/span&gt;  that we already know how to do.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;3. Calculating &lt;span class=&quot;math-container&quot;&gt;$\langle \sigma_y \otimes \sigma_y \rangle$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The same works, but instead of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, we take &lt;span class=&quot;math-container&quot;&gt;$H S^{\dagger}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \sigma_y \otimes \sigma_y \rangle = Tr\big( \sigma_z \otimes \sigma_z \; \rho''\big) = \rho''_{11} - \rho''_{22} - \rho''_{33} + \rho''_{44}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho'' = \big(HS^{\dagger} \otimes HS^{\dagger} \big) \; \rho \; \big(SH \otimes SH \big)$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$SH\sigma_z HS^\dagger = \sigma_y$&lt;/span&gt; as can be seen from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11789/9459&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; in the trace). But of course, if we can measure also in &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt; basis directly the gates before the measurements will be unnecessary. As was pointed out in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13116/9459&quot;&gt;answer&lt;/a&gt; we should calculate all &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt; Pauli terms in order to estimate the density matrix (the mentioned three are not enough).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;It is possible to combine measurements for &lt;span class=&quot;math-container&quot;&gt;$\langle \sigma_y \otimes \sigma_y \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle \sigma_x \otimes \sigma_x \rangle$&lt;/span&gt;, by measuring in Bell basis as was discussed in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/9192/9459&quot;&gt;question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-07-31T09:47:11.610" LastActivityDate="2020-07-31T09:47:11.610" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13119" PostTypeId="1" CreationDate="2020-07-31T12:28:24.490" Score="1" ViewCount="81" Body="&lt;p&gt;Consider the following unitary defined for a system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; interacting with a bipartite system &lt;span class=&quot;math-container&quot;&gt;$BB^\prime$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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},$$&lt;/span&gt; with&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathbf{I}_i$&lt;/span&gt; being the identity.&lt;/p&gt;&#xA;&lt;p&gt;My question:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the physical meaning of operation &lt;span class=&quot;math-container&quot;&gt;$U_{AB}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can one represent &lt;span class=&quot;math-container&quot;&gt;$U_{AB}$&lt;/span&gt; in terms of quantum logic gates ( a circuit diagram)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8290" LastEditorUserId="55" LastEditDate="2020-08-01T18:36:20.873" LastActivityDate="2020-08-01T18:36:20.873" Title="What does the unitary $[|0\rangle\langle 0|\otimes I+|1\rangle\langle1|\otimes(|1\rangle\langle 0|+|0\rangle\langle1|)]\otimes I$ represent?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13120" PostTypeId="2" ParentId="13068" CreationDate="2020-07-31T12:40:10.030" Score="1" Body="&lt;p&gt;I am no longer confused about this, since now I see in this equation we are already restricting to a subspace &lt;span class=&quot;math-container&quot;&gt;$||S\mathcal{E}(|u\rangle\langle u|)-S\mathcal{E}(|v\rangle\langle v|)|| = |||u\rangle\langle u|-|v\rangle\langle v|||$&lt;/span&gt;, and the contracting map has to contract every subspace.&lt;/p&gt;&#xA;" OwnerUserId="12047" LastActivityDate="2020-07-31T12:40:10.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13121" PostTypeId="1" AcceptedAnswerId="13125" CreationDate="2020-07-31T14:19:23.610" Score="0" ViewCount="54" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="55" LastEditDate="2020-08-01T10:45:00.187" LastActivityDate="2020-08-01T10:45:00.187" Title="Does Qiskit offer a stack of functions to generate and manipulate graph states?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13123" PostTypeId="1" AcceptedAnswerId="13149" CreationDate="2020-07-31T16:35:55.153" Score="2" ViewCount="77" Body="&lt;p&gt;Given a composite system with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits represented by some &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt;-dimensional vector, how would I get the quantum state of an individual qubit?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Separable_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia entry&lt;/a&gt; provides a somewhat brief answer to this question but doesn't expand on the general case for separating quantum states.&lt;/p&gt;&#xA;" OwnerUserId="12723" LastEditorUserId="55" LastEditDate="2020-08-03T10:18:23.530" LastActivityDate="2020-08-03T10:18:23.530" Title="How to get the state of an individual qubit in a composite system?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13124" PostTypeId="1" AcceptedAnswerId="13128" CreationDate="2020-07-31T17:32:32.803" Score="2" ViewCount="92" Body="&lt;p&gt;Let's imagine we have an arbitrary 1-qubit quantum system &lt;span class=&quot;math-container&quot;&gt;$\alpha \vert 0 \rangle + \beta \vert 1 \rangle$&lt;/span&gt; Making a measurement in the +/- basis is equivalent to performing a Hadamard gate and then making a measurement in the standard computational basis.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (supposing such &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be composed theoretically) that transforms the basis state into orthonormal states of that orientation and then perform a measurement in the computational basis?&lt;/p&gt;&#xA;&lt;p&gt;Let's say we have unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that maps &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle $&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\langle a \vert b \rangle = 0$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle$&lt;/span&gt; have certain orientation with respect to the standard basis states) the same way &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; transforms &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert + \rangle$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle $&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert - \rangle$&lt;/span&gt; state. One difference could be that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian too while &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; may not be.&#xA;Another sub question is whether &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; needs to be Hermitian also to make this generalization.&lt;/p&gt;&#xA;" OwnerUserId="12826" LastEditorUserId="12826" LastEditDate="2020-08-01T05:01:02.527" LastActivityDate="2020-08-01T05:46:31.813" Title="How do we perform a measurement of an arbitrary 1-qubit quantum state in any arbitrary orientation?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13125" PostTypeId="2" ParentId="13121" CreationDate="2020-07-31T18:33:38.223" Score="0" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;|⟩ = ∏(,)∈(,)|+⟩⊗&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.GraphState.html#graphstate&quot; rel=&quot;nofollow noreferrer&quot;&gt;following link&lt;/a&gt; in the IBM Qiskit library.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2CQH1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2CQH1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-07-31T18:33:38.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13126" PostTypeId="1" CreationDate="2020-07-31T19:08:47.080" Score="3" ViewCount="76" Body="&lt;p&gt;The principle of the three-qubit Bit Flip Code is straight forward at first sight. Using CNOT you basically encode&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a|0\rangle + b|1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$    a|000\rangle + b|111\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;using entanglement. Now we assume that noise flips one of the qubits so that the state becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$    a|100\rangle + b|011\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="12828" LastEditorUserId="55" LastEditDate="2020-08-03T12:11:28.383" LastActivityDate="2020-08-03T12:33:01.957" Title="In the three-qubit bit flip code, why can the first bit flip without impacting the entanglement with the other qubits?" Tags="&lt;entanglement&gt;&lt;error-correction&gt;&lt;noise&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13127" PostTypeId="2" ParentId="13111" CreationDate="2020-07-31T22:46:19.777" Score="3" Body="&lt;p&gt;I'm unsure of this exact protocol you're referring to, but if you're interested in the &amp;quot;cost&amp;quot; or reliability of teleportation , then I have some information pertaining to the original setup.&lt;/p&gt;&#xA;&lt;p&gt;Teleportation is a protocol that uses local operations and classical communications to teleport a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{\text{in}}$&lt;/span&gt; from Alice (A) to Bob (B) who share an entangled resource state &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt; (typically a Bell state &lt;span class=&quot;math-container&quot;&gt;$|{\Phi}\rangle$&lt;/span&gt;).&#xA;Alice performs a Bell measurement on her input state &lt;span class=&quot;math-container&quot;&gt;$\rho_{\text{in}}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho_{\text{out}} \approx \rho_{\text{in}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;During this protocol, &lt;em&gt;quantum data is not transmitted&lt;/em&gt; - 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 &lt;a href=&quot;https://arxiv.org/abs/1706.05384&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for the interesting impact of imperfect classical communications on teleportation).&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;ideal scenario one can think of teleportation as a &lt;em&gt;simulation&lt;/em&gt; of transmission of an input state through an identity channel &lt;span class=&quot;math-container&quot;&gt;$&#xA;\rho_{\text{out}} = \mathcal{I}(\rho_{\text{in}}) = \rho_{\text{in}}.&#xA;$&lt;/span&gt;&#xA;But if the resource state entanglement is sub-maximal, it introduces error on this operation. Instead, we &lt;em&gt;simulate&lt;/em&gt; some non-identity, decohering channel&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\rho_{\text{out}} = \mathcal{E}(\rho_{\text{in}}) \neq \rho_{\text{in}}.&#xA;$&lt;/span&gt;&#xA;Therefore one can quantify the performance of a teleportation protocol based on the entanglement properties of the resource state.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;These ideas have some really cool applications in quantum channel capacities, metrology and channel discrimination, and see &lt;a href=&quot;https://arxiv.org/abs/1711.09909&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for some better insight.&lt;/p&gt;&#xA;" OwnerUserId="9839" LastActivityDate="2020-07-31T22:46:19.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13128" PostTypeId="2" ParentId="13124" CreationDate="2020-08-01T01:36:33.250" Score="4" Body="&lt;p&gt;Yes, this observation can be generalized. To start with, let's notice why is Hadamard the transformation required to measure a state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x}$&lt;/span&gt; basis. This is because it is the ``unitary intertwiner'' connecting the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x}$&lt;/span&gt; basis to the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; basis (a.k.a. computational basis). Recall that the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{x}$&lt;/span&gt; eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$\{ | + \rangle, | - \rangle \}$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$\{ | 0 \rangle, | 1 \rangle \}$&lt;/span&gt;. The unitary operator connecting these basis is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{U}_{\sigma_{x} \rightarrow \sigma_{z}} = | 0 \rangle \langle  + | + | 1 \rangle \langle  - | = H. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's take a moment to interpret the action of this intertwiner: when it acts on the &lt;span class=&quot;math-container&quot;&gt;$| + \rangle$&lt;/span&gt; state, it sends it to the &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt; state and when it acts on the &lt;span class=&quot;math-container&quot;&gt;$| - \rangle$&lt;/span&gt; state, it sends it to the &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt; state, thereby connecting the basis elements (and by linearity, any other vector expressed in these bases). Therefore, measuring &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; basis is the same as applying &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}_{\sigma_{x} \rightarrow \sigma_{z}}$&lt;/span&gt; and then measuring in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;For connecting to an arbitrary basis, we simply replace &lt;span class=&quot;math-container&quot;&gt;$\{ | \pm \rangle \}$&lt;/span&gt; with the new basis vectors, say &lt;span class=&quot;math-container&quot;&gt;$ \mathbb{B} = \{ | \phi_{+} \rangle, | \phi_{-} \rangle \}$&lt;/span&gt;, giving us,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{U}_{\mathbb{B} \rightarrow \sigma_{z}} = | 0 \rangle \langle  \phi_{+} | + | 1 \rangle \langle  \phi_{-} |  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the most general case, where you want to connect a basis &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}_{0} = \{ \phi_{j} \}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}_{1} = \{ \chi_{j} \}$&lt;/span&gt;, the intertwiner is defined as,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{U}_{\mathbb{B}_{0} \rightarrow \mathbb{B}_{1}} = \sum\limits_{j=1}^{d} | \chi_{j} \rangle \langle  \phi_{j} | . $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-08-01T05:46:31.813" LastActivityDate="2020-08-01T05:46:31.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13129" PostTypeId="2" ParentId="13126" CreationDate="2020-08-01T01:55:54.540" Score="1" Body="&lt;p&gt;We're trying to &lt;em&gt;build&lt;/em&gt; a code to protect against single bit flips. That is, we are &lt;em&gt;assuming&lt;/em&gt; the noise model. By assumption, it has the form &lt;span class=&quot;math-container&quot;&gt;$\sigma_x \otimes \mathbb{I} \otimes \mathbb{I}$&lt;/span&gt;, 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).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-08-01T01:55:54.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13130" PostTypeId="1" CreationDate="2020-08-01T02:07:38.360" Score="1" ViewCount="58" Body="&lt;p&gt;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 &lt;code&gt;qc.depth()&lt;/code&gt; slightly less than 150000 before the kernel crash into oblivion (with or without &lt;code&gt;optimization_level = 3&lt;/code&gt;, 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!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="55" LastEditDate="2020-08-18T08:42:30.477" LastActivityDate="2020-08-18T08:42:30.477" Title="What is the maximum circuit depth for Qiskit Aer Simulator?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13131" PostTypeId="1" AcceptedAnswerId="13243" CreationDate="2020-08-01T03:40:36.073" Score="2" ViewCount="336" Body="&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.ignis.verification.state_tomography_circuits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;special method for this&lt;/a&gt;, but I could not find a working example.&lt;/p&gt;&#xA;&lt;p&gt;More precisely, I would be interested in two cases: when the full state tomography is performed (all the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; amplitudes are measured) and when it's known apriori that the wave function has support in a certain subspace (say, only &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; for a two-qubit system).&lt;/p&gt;&#xA;&lt;p&gt;BTW, is &lt;span class=&quot;math-container&quot;&gt;$3^n$&lt;/span&gt; a lower bound on the number of operators which have to be measured in order to perform the state tomography? (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; for each qubit.)&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-08-03T12:14:24.300" LastActivityDate="2020-08-10T20:58:20.260" Title="How to do state tomography when using sampling in Qiskit?" Tags="&lt;qiskit&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13132" PostTypeId="1" AcceptedAnswerId="13135" CreationDate="2020-08-01T04:42:10.253" Score="5" ViewCount="429" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12826" LastEditorUserId="55" LastEditDate="2020-08-03T12:17:13.547" LastActivityDate="2020-08-03T12:17:13.547" Title="How can we implement controlled-T gate using CNOT and H, S and T gates?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13133" PostTypeId="2" ParentId="13132" CreationDate="2020-08-01T07:35:44.180" Score="3" Body="&lt;p&gt;We can implement &lt;span class=&quot;math-container&quot;&gt;$CT$&lt;/span&gt; using the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bsV6h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bsV6h.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This solutions uses an extra gate which isn't available above &lt;span class=&quot;math-container&quot;&gt;$R_I(\pi/8) = \sqrt{T}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$T = \sqrt{S} = Z^{\frac{1}{4}}$&lt;/span&gt;.&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$S,T,Z$&lt;/span&gt; are all diagonal matrices hence their controlled versions will also be diagonal matrices &lt;span class=&quot;math-container&quot;&gt;$CZ,CS,CT$&lt;/span&gt;. Thus &lt;span class=&quot;math-container&quot;&gt;$CT=CZ^{\frac{1}{4}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If we can implement the fourth root of &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; using the above gates we will have a &lt;span class=&quot;math-container&quot;&gt;$Controlled-T$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;We can implement a Controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate using &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CZ = |0\rangle\langle 0|\otimes I + |1\rangle\langle 1|\otimes Z \\&#xA;= |0\rangle\langle 0|\otimes HIH + |1\rangle\langle 1|\otimes HXH \\&#xA;= (I\otimes H)(|0\rangle\langle 0|\otimes I + |1\rangle\langle 1|\otimes X)(I\otimes H)\\&#xA;= (I\otimes H)CNOT(I\otimes H)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can implement &lt;span class=&quot;math-container&quot;&gt;$CNOT^{2t}$&lt;/span&gt; gates using the circuit show in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8274/how-to-implement-the-controlled-square-root-of-not-gate-on-the-ibm-q-composer&quot;&gt;Craig Gidney's Answer&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/272n0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/272n0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We need &lt;span class=&quot;math-container&quot;&gt;$CNOT^{1/4}$&lt;/span&gt; hence &lt;span class=&quot;math-container&quot;&gt;$t=\frac{1}{8}$&lt;/span&gt;. This requires &lt;span class=&quot;math-container&quot;&gt;$Z^{\frac{1}{8}}$&lt;/span&gt; i.e &lt;span class=&quot;math-container&quot;&gt;$R_{I}(\pi/8)$&lt;/span&gt; and its Adjoint gate.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U = (I\otimes H)CNOT^{\frac{1}{4}}(I\otimes H)$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U^4= UUUU \\&#xA;= (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) \\&#xA;= (I\otimes H)CNOT^{\frac{1}{4}}CNOT^{\frac{1}{4}}CNOT^{\frac{1}{4}}CNOT^{\frac{1}{4}}(I\otimes H) \\&#xA;= (I\otimes H)CNOT(I\otimes H) \\&#xA;= CZ$$&lt;/span&gt;&#xA;Thus &lt;span class=&quot;math-container&quot;&gt;$U = CZ^{\frac{1}{4}} = CT$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In general for implementing &lt;span class=&quot;math-container&quot;&gt;$Controlled-Z^{\frac{1}{2^n}}$&lt;/span&gt; gate we would need &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^{\frac{1}{2^{n+1}}}$&lt;/span&gt;(along with its adjoint version) gate.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-08-01T07:59:39.527" LastActivityDate="2020-08-01T07:59:39.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13134" PostTypeId="2" ParentId="13132" CreationDate="2020-08-01T07:50:29.093" Score="2" Body="&lt;p&gt;In general you need more than &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and CNOT to implement a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.  One approach to constructing a controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate, for arbitrary &lt;span class=&quot;math-container&quot;&gt;$U \in \mathbf{U}(2)$&lt;/span&gt;, from single qubit and CNOT gates begins by parameterizing &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$U(\alpha,\beta,\gamma,\delta)$&lt;/span&gt; according to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = e^{i\alpha}\begin{bmatrix} \exp\left({-i\frac{\beta+\delta}{2}}\right)\cos \frac{\gamma}{2} &amp;amp; -\exp\left({-i\frac{\beta-\delta}{2}}\right)\sin \frac{\gamma}{2} \\ \exp\left({i \frac{\beta-\delta}{2}}\right)\sin \frac{\gamma}{2} &amp;amp; \exp\left({i\frac{\beta+\delta}{2}}\right)\cos \frac{\gamma}{2} \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With this parameterization, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be decomposed in terms of the Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$\sigma_x, \, \sigma_y, \, \sigma_z$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The usefulness of this decomposition is that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be expressed as above, while &lt;span class=&quot;math-container&quot;&gt;$ABC=I$&lt;/span&gt;.  Defining one additional gate &lt;span class=&quot;math-container&quot;&gt;$$D=\begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i \alpha} \end{bmatrix}$$&lt;/span&gt; allows circuit implementation of an arbitrary controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; using four single qubit gates and two CNOT gates as&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NV6nj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NV6nj.png&quot; alt=&quot;Controlled-U Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the specific case noted in the title, &lt;span class=&quot;math-container&quot;&gt;$U=T$&lt;/span&gt;, the parameterization is &lt;span class=&quot;math-container&quot;&gt;$\alpha=\beta=\delta=\frac{\pi}{8}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\gamma=0$&lt;/span&gt;.  This gives &lt;span class=&quot;math-container&quot;&gt;$A=e^{-\frac{i \pi}{16} \sigma_z} \cong \sqrt{T} $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B=e^{\frac{i \pi}{16} \sigma_z} \cong \sqrt{T^\dagger}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C=I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$D=\sqrt{T}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\cong$&lt;/span&gt; indicates equivalence up to global phase).  It seems that you need access to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{T}$&lt;/span&gt; gates to implement the desired controlled-&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-08-01T08:57:10.647" LastActivityDate="2020-08-01T08:57:10.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13135" PostTypeId="2" ParentId="13132" CreationDate="2020-08-01T10:29:49.997" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1Zrmf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1Zrmf.png&quot; alt=&quot;ct to tofs to decomposed&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-01T10:29:49.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13136" PostTypeId="5" CreationDate="2020-08-01T11:34:32.920" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-01T11:34:32.920" LastActivityDate="2020-08-01T11:34:32.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13137" PostTypeId="4" CreationDate="2020-08-01T11:34:32.920" Score="0" Body="For questions about quantum algorithms tackling machine learning tasks (e.g. the HHL algorithm or questions about quantum neural networks). For questions about applying classical machine learning to quantum-information-related problems, use machine-learning instead." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-01T11:34:32.920" LastActivityDate="2020-08-01T11:34:32.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13138" PostTypeId="2" ParentId="13119" CreationDate="2020-08-01T16:56:42.830" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This gate will take a 3 qubit state and flip the second qubit of this state when the first is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; It will take &lt;span class=&quot;math-container&quot;&gt;$|110\rangle \to|100\rangle, |111\rangle \to |101\rangle$&lt;/span&gt; and vice-versa.&lt;/p&gt;&#xA;&lt;p&gt;Edit: important to note is that &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\langle 0|+|0\rangle\langle 1|$&lt;/span&gt; is the Pauli X gate&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2020-08-01T16:56:42.830" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13140" PostTypeId="1" AcceptedAnswerId="13191" CreationDate="2020-08-01T17:48:20.857" Score="4" ViewCount="178" Body="&lt;p&gt;The inequality &lt;span class=&quot;math-container&quot;&gt;$\chi \le H(X)$&lt;/span&gt; gives the upper bound on accessible information.&#xA;This much is clear to me. However, what isn't clear is how this tells me I cannot transmit more than &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of information.&lt;/p&gt;&#xA;&lt;p&gt;I understand that if &lt;span class=&quot;math-container&quot;&gt;$\chi &amp;lt; H(X)$&lt;/span&gt;, then reliable in-ferment isn't possible, with the Fano inequality giving the lower bound for the chance of an error being made.&lt;/p&gt;&#xA;&lt;p&gt;However, I've seen some examples state that &lt;span class=&quot;math-container&quot;&gt;$\chi\le n$&lt;/span&gt; proves this, which I can only see being the case of &lt;span class=&quot;math-container&quot;&gt;$H(X)$&lt;/span&gt; is maximum for each qubit. Do they mean that if &lt;span class=&quot;math-container&quot;&gt;$\chi = H(X)$&lt;/span&gt; then given that this is all the information about one qubit, then for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, if &lt;span class=&quot;math-container&quot;&gt;$\chi=H(X)$&lt;/span&gt; for all of them then &lt;span class=&quot;math-container&quot;&gt;$\chi =n$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Is it taking the &lt;span class=&quot;math-container&quot;&gt;$H(X)$&lt;/span&gt; as all the information of a single qubit/bit, regardless of its value, and as such if &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; is equal to it, it is said to have access to all that information as well?&lt;/p&gt;&#xA;&lt;p&gt;Edit: Maybe to make this clearer, I am asking where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; comes from if we take &lt;span class=&quot;math-container&quot;&gt;$\chi \le H(X)$&lt;/span&gt;, as in many cases &lt;span class=&quot;math-container&quot;&gt;$H(X)$&lt;/span&gt; will not be maximum.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-08-27T12:52:54.077" LastActivityDate="2020-08-27T12:52:54.077" Title="How can the Holevo bound be used to show that $n$ qubits cannot transmit more than $n$ classical bits?" Tags="&lt;quantum-state&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13141" PostTypeId="1" CreationDate="2020-08-02T00:12:37.847" Score="1" ViewCount="162" Body="&lt;p&gt;Termux has some issues with &lt;code&gt;cmake&lt;/code&gt;, therefore qiskit-aer-0.5.2 installation returns error 1.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Collecting qiskit&#xA;  Downloading qiskit-0.19.6.tar.gz (4.0 kB)&#xA;Collecting qiskit-terra==0.14.2&#xA;  Downloading qiskit-terra-0.14.2.tar.gz (6.3 MB)&#xA;     |████████████████████████████████| 6.3 MB 110 kB/s&#xA;Collecting qiskit-aer==0.5.2&#xA;  Downloading qiskit-aer-0.5.2.tar.gz (10.3 MB)&#xA;     |████████████████████████████████| 10.3 MB 60 kB/s&#xA;    ERROR: Command errored out with exit status 1:&#xA;     command: /data/data/com.termux/files/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '&amp;quot;'&amp;quot;'/data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/setup.py'&amp;quot;'&amp;quot;'; __file__='&amp;quot;'&amp;quot;'/data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/setup.py'&amp;quot;'&amp;quot;';f=getattr(tokenize, '&amp;quot;'&amp;quot;'open'&amp;quot;'&amp;quot;', open)(__file__);code=f.read().replace('&amp;quot;'&amp;quot;'\r\n'&amp;quot;'&amp;quot;', '&amp;quot;'&amp;quot;'\n'&amp;quot;'&amp;quot;');f.close();exec(compile(code, __file__, '&amp;quot;'&amp;quot;'exec'&amp;quot;'&amp;quot;'))' egg_info --egg-base /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-v59grdvz&#xA;         cwd: /data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/&#xA;    Complete output (559 lines):&#xA;      ERROR: Command errored out with exit status 1:&#xA;       command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '&amp;quot;'&amp;quot;'/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/setup.py'&amp;quot;'&amp;quot;'; __file__='&amp;quot;'&amp;quot;'/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/setup.py'&amp;quot;'&amp;quot;';f=getattr(tokenize, '&amp;quot;'&amp;quot;'open'&amp;quot;'&amp;quot;', open)(__file__);code=f.read().replace('&amp;quot;'&amp;quot;'\r\n'&amp;quot;'&amp;quot;', '&amp;quot;'&amp;quot;'\n'&amp;quot;'&amp;quot;');f.close();exec(compile(code, __file__, '&amp;quot;'&amp;quot;'exec'&amp;quot;'&amp;quot;'))' bdist_wheel -d /data/data/com.termux/files/usr/tmp/pip-wheel-76sn2q3h&#xA;           cwd: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/&#xA;      Complete output (520 lines):&#xA;&#xA;&#xA;      --------------------------------------------------------------------------------&#xA;      -- Trying &amp;quot;Ninja&amp;quot; generator&#xA;      --------------------------------&#xA;      ---------------------------&#xA;      ----------------------&#xA;      -----------------&#xA;      ------------&#xA;      -------&#xA;      --&#xA;      Not searching for unused variables given on the command line.&#xA;      CMake Error: CMake was unable to find a build program corresponding to &amp;quot;Ninja&amp;quot;.  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.&#xA;      -- Configuring incomplete, errors occurred!&#xA;      See also &amp;quot;/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log&amp;quot;.&#xA;      --&#xA;      -------&#xA;      ------------&#xA;      -----------------&#xA;      ----------------------&#xA;      ---------------------------&#xA;      --------------------------------&#xA;      -- Trying &amp;quot;Ninja&amp;quot; generator - failure&#xA;      --------------------------------------------------------------------------------&#xA;&#xA;&#xA;&#xA;      --------------------------------------------------------------------------------&#xA;      -- Trying &amp;quot;Unix Makefiles&amp;quot; generator&#xA;      --------------------------------&#xA;      ---------------------------&#xA;      ----------------------&#xA;      -----------------&#xA;      ------------&#xA;      -------&#xA;      --&#xA;      Not searching for unused variables given on the command line.&#xA;      -- The C compiler identification is Clang 10.0.1&#xA;      -- Detecting C compiler ABI info&#xA;      -- Detecting C compiler ABI info - done&#xA;      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped&#xA;      -- Detecting C compile features&#xA;      -- Detecting C compile features - done&#xA;      -- The CXX compiler identification is Clang 10.0.1&#xA;      -- Detecting CXX compiler ABI info&#xA;      -- Detecting CXX compiler ABI info - done&#xA;      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped&#xA;      -- Detecting CXX compile features&#xA;      -- Detecting CXX compile features - done&#xA;      -- Configuring done&#xA;      -- Generating done&#xA;      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_cmake_test_compile/build&#xA;      --&#xA;      -------&#xA;      ------------&#xA;      -----------------&#xA;      ----------------------&#xA;      ---------------------------&#xA;      --------------------------------&#xA;      -- Trying &amp;quot;Unix Makefiles&amp;quot; generator - success&#xA;      --------------------------------------------------------------------------------&#xA;&#xA;      Configuring Project&#xA;        Working directory:&#xA;          /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build&#xA;        Command:&#xA;          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&#xA;&#xA;      -- The CXX compiler identification is Clang 10.0.1&#xA;      -- Detecting CXX compiler ABI info&#xA;      -- Detecting CXX compiler ABI info - done&#xA;      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped&#xA;      -- Detecting CXX compile features&#xA;      -- Detecting CXX compile features - done&#xA;      -- ***************************************************&#xA;      -- Build CMake from source: ON&#xA;      -- ***************************************************&#xA;      -- SuperBuild - CMakeProject-src-download&#xA;      -- SuperBuild - CMakeProject-src-download - URL: https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz&#xA;      -- SuperBuild - CMakeProject-src-download - CMakeProject_SOURCE_DIR: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/src&#xA;      -- SuperBuild -   CMakeProject-build&#xA;      -- 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&#xA;      -- SuperBuild -   CMakePythonDistributions&#xA;      -- Configuring done&#xA;      -- Generating done&#xA;      CMake Warning:&#xA;        Manually-specified variables were not used by the project:&#xA;&#xA;          PYTHON_EXECUTABLE&#xA;          PYTHON_INCLUDE_DIR&#xA;          PYTHON_LIBRARY&#xA;          PYTHON_VERSION_STRING&#xA;          SKBUILD&#xA;&#xA;&#xA;      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build&#xA;      Scanning dependencies of target CMakeProject-src-download&#xA;      [  3%] Creating directories for 'CMakeProject-src-download'&#xA;      [  6%] Performing download step (download, verify and extract) for 'CMakeProject-src-download'&#xA;      -- Downloading...&#xA;         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'&#xA;         timeout='none'&#xA;      -- Using src='https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz'&#xA;      -- [download 0% complete]&#xA;      -- [download 100% complete]&#xA;      -- [download 0% complete]&#xA;      -- [download 1% complete]&#xA;...&#xA;      -- [download 100% complete]&#xA;      -- verifying file...&#xA;             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'&#xA;      -- Downloading... done&#xA;      -- extracting...&#xA;           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'&#xA;           dst='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/src'&#xA;      -- extracting... [tar xfz]&#xA;      -- extracting... [analysis]&#xA;      -- extracting... [rename]&#xA;      -- extracting... [clean up]&#xA;      -- extracting... done&#xA;      [  9%] No update step for 'CMakeProject-src-download'&#xA;      [ 12%] No patch step for 'CMakeProject-src-download'&#xA;      [ 15%] No configure step for 'CMakeProject-src-download'&#xA;      [ 18%] No build step for 'CMakeProject-src-download'&#xA;      [ 21%] No install step for 'CMakeProject-src-download'&#xA;      [ 24%] Completed 'CMakeProject-src-download'&#xA;      [ 24%] Built target CMakeProject-src-download&#xA;      Scanning dependencies of target LibUV&#xA;      [ 27%] Creating directories for 'LibUV'&#xA;      [ 30%] Performing download step (download, verify and extract) for 'LibUV'&#xA;      -- Downloading...&#xA;         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'&#xA;         timeout='none'&#xA;      -- Using src='https://dist.libuv.org/dist/v1.23.0/libuv-v1.23.0.tar.gz'&#xA;      -- [download 0% complete]&#xA;      -- [download 1% complete]&#xA;....&#xA;      -- [download 98% complete]&#xA;      -- [download 100% complete]&#xA;      -- verifying file...&#xA;             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'&#xA;      -- Downloading... done&#xA;      -- extracting...&#xA;           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'&#xA;           dst='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-src'&#xA;      -- extracting... [tar xfz]&#xA;      -- extracting... [analysis]&#xA;      -- extracting... [rename]&#xA;      -- extracting... [clean up]&#xA;      -- extracting... done&#xA;      [ 33%] No update step for 'LibUV'&#xA;      [ 36%] No patch step for 'LibUV'&#xA;      [ 39%] Performing configure step for 'LibUV'&#xA;      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&#xA;      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&#xA;      -- The C compiler identification is Clang 10.0.1&#xA;      -- The CXX compiler identification is Clang 10.0.1&#xA;      -- Detecting C compiler ABI info&#xA;      -- Detecting C compiler ABI info - done&#xA;      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped&#xA;      -- Detecting C compile features&#xA;      -- Detecting C compile features - done&#xA;      -- Detecting CXX compiler ABI info&#xA;      -- Detecting CXX compiler ABI info - done&#xA;      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped&#xA;      -- Detecting CXX compile features&#xA;      -- Detecting CXX compile features - done&#xA;      -- Configuring done&#xA;      -- Generating done&#xA;      -- 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&#xA;      [ 42%] Performing build step for 'LibUV'&#xA;      Scanning dependencies of target uv&#xA;      [  1%] Building C object CMakeFiles/uv.dir/src/fs-poll.c.o&#xA;      [  2%] Building C object CMakeFiles/uv.dir/src/inet.c.o&#xA;      [  4%] Building C object CMakeFiles/uv.dir/src/threadpool.c.o&#xA;      [  5%] Building C object CMakeFiles/uv.dir/src/timer.c.o&#xA;      [  7%] Building C object CMakeFiles/uv.dir/src/uv-common.c.o&#xA;      [  8%] Building C object CMakeFiles/uv.dir/src/uv-data-getter-setters.c.o&#xA;      [ 10%] Building C object CMakeFiles/uv.dir/src/version.c.o&#xA;      [ 11%] Building C object CMakeFiles/uv.dir/src/unix/async.c.o&#xA;      [ 13%] Building C object CMakeFiles/uv.dir/src/unix/core.c.o&#xA;      [ 14%] Building C object CMakeFiles/uv.dir/src/unix/dl.c.o&#xA;      [ 16%] Building C object CMakeFiles/uv.dir/src/unix/fs.c.o&#xA;      [ 17%] Building C object CMakeFiles/uv.dir/src/unix/getaddrinfo.c.o&#xA;      [ 19%] Building C object CMakeFiles/uv.dir/src/unix/getnameinfo.c.o&#xA;      [ 20%] Building C object CMakeFiles/uv.dir/src/unix/loop-watcher.c.o&#xA;      [ 22%] Building C object CMakeFiles/uv.dir/src/unix/loop.c.o&#xA;      [ 23%] Building C object CMakeFiles/uv.dir/src/unix/pipe.c.o&#xA;      /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]&#xA;        if (addrlen &amp;gt;= *size) {&#xA;            ~~~~~~~ ^  ~~~~~&#xA;      1 warning generated.&#xA;      [ 25%] Building C object CMakeFiles/uv.dir/src/unix/poll.c.o&#xA;      [ 26%] Building C object CMakeFiles/uv.dir/src/unix/process.c.o&#xA;      [ 27%] Building C object CMakeFiles/uv.dir/src/unix/signal.c.o&#xA;      [ 29%] Building C object CMakeFiles/uv.dir/src/unix/stream.c.o&#xA;      [ 30%] Building C object CMakeFiles/uv.dir/src/unix/tcp.c.o&#xA;      [ 32%] Building C object CMakeFiles/uv.dir/src/unix/thread.c.o&#xA;      [ 33%] Building C object CMakeFiles/uv.dir/src/unix/tty.c.o&#xA;      [ 35%] Building C object CMakeFiles/uv.dir/src/unix/udp.c.o&#xA;      [ 36%] Building C object CMakeFiles/uv.dir/src/unix/android-ifaddrs.c.o&#xA;      [ 38%] Building C object CMakeFiles/uv.dir/src/unix/linux-core.c.o&#xA;      [ 39%] Building C object CMakeFiles/uv.dir/src/unix/linux-inotify.c.o&#xA;      [ 41%] Building C object CMakeFiles/uv.dir/src/unix/linux-syscalls.c.o&#xA;      [ 42%] Building C object CMakeFiles/uv.dir/src/unix/procfs-exepath.c.o&#xA;      [ 44%] Building C object CMakeFiles/uv.dir/src/unix/pthread-fixes.c.o&#xA;      [ 45%] Building C object CMakeFiles/uv.dir/src/unix/sysinfo-loadavg.c.o&#xA;      [ 47%] Building C object CMakeFiles/uv.dir/src/unix/sysinfo-memory.c.o&#xA;      [ 48%] Building C object CMakeFiles/uv.dir/src/unix/proctitle.c.o&#xA;      [ 50%] Linking C shared library libuv.so&#xA;      [ 50%] Built target uv&#xA;      Scanning dependencies of target uv_a&#xA;      [ 51%] Building C object CMakeFiles/uv_a.dir/src/fs-poll.c.o&#xA;      [ 52%] Building C object CMakeFiles/uv_a.dir/src/inet.c.o&#xA;      [ 54%] Building C object CMakeFiles/uv_a.dir/src/threadpool.c.o&#xA;      [ 55%] Building C object CMakeFiles/uv_a.dir/src/timer.c.o&#xA;      [ 57%] Building C object CMakeFiles/uv_a.dir/src/uv-common.c.o&#xA;      [ 58%] Building C object CMakeFiles/uv_a.dir/src/uv-data-getter-setters.c.o&#xA;      [ 60%] Building C object CMakeFiles/uv_a.dir/src/version.c.o&#xA;      [ 61%] Building C object CMakeFiles/uv_a.dir/src/unix/async.c.o&#xA;      [ 63%] Building C object CMakeFiles/uv_a.dir/src/unix/core.c.o&#xA;      [ 64%] Building C object CMakeFiles/uv_a.dir/src/unix/dl.c.o&#xA;      [ 66%] Building C object CMakeFiles/uv_a.dir/src/unix/fs.c.o&#xA;      [ 67%] Building C object CMakeFiles/uv_a.dir/src/unix/getaddrinfo.c.o&#xA;      [ 69%] Building C object CMakeFiles/uv_a.dir/src/unix/getnameinfo.c.o&#xA;      [ 70%] Building C object CMakeFiles/uv_a.dir/src/unix/loop-watcher.c.o&#xA;      [ 72%] Building C object CMakeFiles/uv_a.dir/src/unix/loop.c.o&#xA;      [ 73%] Building C object CMakeFiles/uv_a.dir/src/unix/pipe.c.o&#xA;      /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]&#xA;        if (addrlen &amp;gt;= *size) {&#xA;            ~~~~~~~ ^  ~~~~~&#xA;      1 warning generated.&#xA;      [ 75%] Building C object CMakeFiles/uv_a.dir/src/unix/poll.c.o&#xA;      [ 76%] Building C object CMakeFiles/uv_a.dir/src/unix/process.c.o&#xA;      [ 77%] Building C object CMakeFiles/uv_a.dir/src/unix/signal.c.o&#xA;      [ 79%] Building C object CMakeFiles/uv_a.dir/src/unix/stream.c.o&#xA;      [ 80%] Building C object CMakeFiles/uv_a.dir/src/unix/tcp.c.o&#xA;      [ 82%] Building C object CMakeFiles/uv_a.dir/src/unix/thread.c.o&#xA;      [ 83%] Building C object CMakeFiles/uv_a.dir/src/unix/tty.c.o&#xA;      [ 85%] Building C object CMakeFiles/uv_a.dir/src/unix/udp.c.o&#xA;      [ 86%] Building C object CMakeFiles/uv_a.dir/src/unix/android-ifaddrs.c.o&#xA;      [ 88%] Building C object CMakeFiles/uv_a.dir/src/unix/linux-core.c.o&#xA;      [ 89%] Building C object CMakeFiles/uv_a.dir/src/unix/linux-inotify.c.o&#xA;      [ 91%] Building C object CMakeFiles/uv_a.dir/src/unix/linux-syscalls.c.o&#xA;      [ 92%] Building C object CMakeFiles/uv_a.dir/src/unix/procfs-exepath.c.o&#xA;      [ 94%] Building C object CMakeFiles/uv_a.dir/src/unix/pthread-fixes.c.o&#xA;      [ 95%] Building C object CMakeFiles/uv_a.dir/src/unix/sysinfo-loadavg.c.o&#xA;      [ 97%] Building C object CMakeFiles/uv_a.dir/src/unix/sysinfo-memory.c.o&#xA;      [ 98%] Building C object CMakeFiles/uv_a.dir/src/unix/proctitle.c.o&#xA;      [100%] Linking C static library libuv_a.a&#xA;      [100%] Built target uv_a&#xA;      [ 45%] Performing install step for 'LibUV'&#xA;      [ 50%] Built target uv&#xA;      [100%] Built target uv_a&#xA;      Install the project...&#xA;      -- Install configuration: &amp;quot;Release&amp;quot;&#xA;      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include&#xA;      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv.h&#xA;      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- 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&#xA;      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/lib/pkgconfig/LICENSE&#xA;      -- 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&#xA;      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/lib/libuv.so&#xA;      -- 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&#xA;      [ 48%] Completed 'LibUV'&#xA;      [ 48%] Built target LibUV&#xA;      Scanning dependencies of target CMakeProject-build&#xA;      [ 51%] Creating directories for 'CMakeProject-build'&#xA;      [ 54%] No download step for 'CMakeProject-build'&#xA;      [ 57%] No update step for 'CMakeProject-build'&#xA;      [ 60%] No patch step for 'CMakeProject-build'&#xA;      [ 63%] Performing configure step for 'CMakeProject-build'&#xA;      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&#xA;      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&#xA;      -- The C compiler identification is Clang 10.0.1&#xA;      -- The CXX compiler identification is Clang 10.0.1&#xA;      -- Detecting C compiler ABI info&#xA;      -- Detecting C compiler ABI info - done&#xA;      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped&#xA;      -- Detecting C compile features&#xA;      -- Detecting C compile features - done&#xA;      -- Detecting CXX compiler ABI info&#xA;      -- Detecting CXX compiler ABI info - failed&#xA;      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++&#xA;      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - broken&#xA;      CMake Error at /data/data/com.termux/files/usr/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message):&#xA;        The C++ compiler&#xA;&#xA;          &amp;quot;/data/data/com.termux/files/usr/bin/c++&amp;quot;&#xA;&#xA;        is not able to compile a simple test program.&#xA;&#xA;        It fails with the following output:&#xA;&#xA;          Change Dir: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp&#xA;&#xA;          Run Build Command(s):/data/data/com.termux/files/usr/bin/make cmTC_793bc/fast &amp;amp;&amp;amp; 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'&#xA;          /data/data/com.termux/files/usr/bin/make  -f CMakeFiles/cmTC_793bc.dir/build.make CMakeFiles/cmTC_793bc.dir/build&#xA;          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'&#xA;          Building CXX object CMakeFiles/cmTC_793bc.dir/testCXXCompiler.cxx.o&#xA;          /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&#xA;          Linking CXX executable cmTC_793bc&#xA;          /data/data/com.termux/files/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_793bc.dir/link.txt --verbose=1&#xA;          /data/data/com.termux/files/usr/bin/c++ -g -static-libstdc++ -static-libgcc -lrt  CMakeFiles/cmTC_793bc.dir/testCXXCompiler.cxx.o -o cmTC_793bc&#xA;          /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: cannot find -lc++_shared&#xA;          clang-10: error: linker command failed with exit code 1 (use -v to see invocation)&#xA;          make[4]: *** [CMakeFiles/cmTC_793bc.dir/build.make:106: cmTC_793bc] Error 1&#xA;          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'&#xA;          make[3]: *** [Makefile:140: cmTC_793bc/fast] Error 2&#xA;          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'&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;        CMake will not be able to correctly generate this project.&#xA;      Call Stack (most recent call first):&#xA;        CMakeLists.txt:7 (project)&#xA;&#xA;&#xA;      -- Configuring incomplete, errors occurred!&#xA;      See also &amp;quot;/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeOutput.log&amp;quot;.&#xA;      See also &amp;quot;/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeError.log&amp;quot;.&#xA;      make[2]: *** [CMakeFiles/CMakeProject-build.dir/build.make:131: CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-configure] Error 1&#xA;      make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/CMakeProject-build.dir/all] Error 2&#xA;      make: *** [Makefile:149: all] Error 2&#xA;      Traceback (most recent call last):&#xA;        File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/setuptools_wrap.py&amp;quot;, line 589, in setup&#xA;          cmkr.make(make_args, env=env)&#xA;        File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/cmaker.py&amp;quot;, line 496, in make&#xA;          raise SKBuildError(&#xA;&#xA;      An error occurred while building with CMake.&#xA;        Command:&#xA;          cmake --build . --target install --config Release --&#xA;        Source directory:&#xA;          /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake&#xA;        Working directory:&#xA;          /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build&#xA;      Please see CMake's output for more information.&#xA;      ----------------------------------------&#xA;      ERROR: Failed building wheel for cmake&#xA;    ERROR: Failed to build one or more wheels&#xA;    Traceback (most recent call last):&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/installer.py&amp;quot;, line 128, in fetch_build_egg&#xA;        subprocess.check_call(cmd)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/subprocess.py&amp;quot;, line 364, in check_call&#xA;        raise CalledProcessError(retcode, cmd)&#xA;    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.&#xA;&#xA;    During handling of the above exception, another exception occurred:&#xA;&#xA;    Traceback (most recent call last):&#xA;      File &amp;quot;&amp;lt;string&amp;gt;&amp;quot;, line 1, in &amp;lt;module&amp;gt;&#xA;      File &amp;quot;/data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/setup.py&amp;quot;, line 56, in &amp;lt;module&amp;gt;&#xA;        setup(&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/setuptools_wrap.py&amp;quot;, line 468, in setup&#xA;        return upstream_setup(*args, **kw)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/__init__.py&amp;quot;, line 143, in setup&#xA;        _install_setup_requires(attrs)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/__init__.py&amp;quot;, line 138, in _install_setup_requires&#xA;        dist.fetch_build_eggs(dist.setup_requires)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/dist.py&amp;quot;, line 695, in fetch_build_eggs&#xA;        resolved_dists = pkg_resources.working_set.resolve(&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/pkg_resources/__init__.py&amp;quot;, line 781, in resolve&#xA;        dist = best[req.key] = env.best_match(&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/pkg_resources/__init__.py&amp;quot;, line 1066, in best_match&#xA;        return self.obtain(req, installer)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/pkg_resources/__init__.py&amp;quot;, line 1078, in obtain&#xA;        return installer(requirement)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/dist.py&amp;quot;, line 754, in fetch_build_egg&#xA;        return fetch_build_egg(self, req)&#xA;      File &amp;quot;/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/installer.py&amp;quot;, line 130, in fetch_build_egg&#xA;        raise DistutilsError(str(e))&#xA;    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.&#xA;    ----------------------------------------&#xA;ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is there any way how to get Qiskit running on my mobile?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12832" LastEditorUserId="55" LastEditDate="2020-08-02T07:39:48.923" LastActivityDate="2020-08-02T07:39:48.923" Title="Problem with installing Qiskit on Android with Termux emulator" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13142" PostTypeId="1" AcceptedAnswerId="13154" CreationDate="2020-08-02T06:08:26.433" Score="2" ViewCount="69" Body="&lt;p&gt;Quantum error correction is a fundamental aspect of quantum computation. I have read some material about &amp;quot;Quantum Channel&amp;quot; and &amp;quot;Quantum error correction&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For example, in depolarizing channel, each error can be approximated into pauli error, which is X,Y,Z error with their own possibility &lt;span class=&quot;math-container&quot;&gt;$p_x$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$p_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_z$&lt;/span&gt;. So is that a certain scale of possibility (just for example, &lt;span class=&quot;math-container&quot;&gt;$1\%&amp;lt;p_x&amp;lt;10\%$&lt;/span&gt;) of each error is reliable or something close to that?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-08-03T12:18:17.753" LastActivityDate="2020-08-03T12:56:45.543" Title="What is the certain error rate in a quantum channel?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13143" PostTypeId="1" AcceptedAnswerId="14985" CreationDate="2020-08-02T12:30:26.373" Score="1" ViewCount="102" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="9006" LastEditDate="2020-08-03T07:17:00.063" LastActivityDate="2020-12-05T11:41:04.157" Title="How to make Toffoli gate using matrix form in multi qubits system?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13144" PostTypeId="2" ParentId="13143" CreationDate="2020-08-02T13:09:25.927" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If the Control qubits are &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;; and target qubit is &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Such that &lt;span class=&quot;math-container&quot;&gt;$i+1&amp;lt;j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j+1&amp;lt;k$&lt;/span&gt;. Then we can use SWAP gates to bring these qubits closer.&lt;/p&gt;&#xA;&lt;p&gt;If there is a distance between &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; i.e &lt;span class=&quot;math-container&quot;&gt;$j-i-1&amp;gt;0$&lt;/span&gt;, then we can use &lt;span class=&quot;math-container&quot;&gt;$j-i-1$&lt;/span&gt; SWAP gates to bring the states of these qubits closer and apply the gate. Then another &lt;span class=&quot;math-container&quot;&gt;$j-i-1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: We have 7 qubits &lt;span class=&quot;math-container&quot;&gt;$q_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i\in \{0,1,2,3,4,5,6\}$&lt;/span&gt;. We need to apply a &lt;span class=&quot;math-container&quot;&gt;$Toffoli$&lt;/span&gt; Gate to &lt;span class=&quot;math-container&quot;&gt;$q_5$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; as control.&lt;/p&gt;&#xA;&lt;p&gt;Then the original state of the system is &lt;span class=&quot;math-container&quot;&gt;$q_0q_1q_2q_3q_4q_5q_6$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can apply the &lt;span class=&quot;math-container&quot;&gt;$CCNOT$&lt;/span&gt; gate as follows&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We apply SWAP gate to &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_1q_0q_2q_3q_4q_5q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;We apply SWAP gate to &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_1q_2q_0q_3q_4q_5q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;We apply SWAP gate to &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_5$&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_1q_2q_0q_3q_5q_4q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;We apply CCNOT gate on &lt;span class=&quot;math-container&quot;&gt;$q_0,q_3,q_5$&lt;/span&gt; and now &lt;span class=&quot;math-container&quot;&gt;$q_5 \rightarrow q_5' $&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_1q_2q_0q_3q_5'q_4q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;We apply SWAP gate to &lt;span class=&quot;math-container&quot;&gt;$q_5'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_1q_2q_0q_3q_4q_5'q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;We apply SWAP gate to &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_1q_0q_2q_3q_4q_5'q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;We apply SWAP gate to &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; resulting in state &lt;span class=&quot;math-container&quot;&gt;$q_0q_1q_2q_3q_4q_5'q_6$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In this manner you can apply &lt;span class=&quot;math-container&quot;&gt;$CCNOT$&lt;/span&gt; gate to non-adjacent qubits using &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Just to be clear SWAP gates do not switch qubits but they are &lt;em&gt;unitaries&lt;/em&gt; whose effect is that the state of the 2 qubits is swapped.&#xA;To know more about SWAP Gates see &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Swap_(SWAP)_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-08-02T13:09:25.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13145" PostTypeId="1" AcceptedAnswerId="13146" CreationDate="2020-08-02T15:55:34.500" Score="2" ViewCount="42" Body="&lt;p&gt;Given the following quantum state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I apply a QFT (given by the formula below) to that state in superposition?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$QFT_n|j\rangle = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\omega_{N}^{j \times k} |k\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user12136" LastActivityDate="2020-08-02T17:00:00.287" Title="How to apply QFT to a quantum state in superposition?" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13146" PostTypeId="2" ParentId="13145" CreationDate="2020-08-02T17:00:00.287" Score="2" Body="&lt;p&gt;QFT on any Superposition (Linear Combination of Basis States) can be applied using Linearity.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$QFT_n|\psi\rangle = \sum_{k=0}^{2^n-1}a_kQFT_n|k\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence &lt;span class=&quot;math-container&quot;&gt;$QFT_4|\psi\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$QFT_4(\frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)) \\&#xA;= \frac{1}{2}(QFT_4|0000\rangle + QFT_4|0100\rangle + QFT_4|1000\rangle + QFT_4|1100\rangle) \\&#xA;= \frac{1}{2}(QFT_4|0\rangle + QFT_4|4\rangle + QFT_4|8\rangle + QFT_4|12\rangle) \\&#xA;= \frac{1}{2}(\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 0}|k\rangle +&#xA;\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 4}|k\rangle +&#xA;\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 8}|k\rangle +&#xA;\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 12}|k\rangle ) \\&#xA;=\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$\omega_N = e^{\frac{i2\pi}{2^4}} = e^{\frac{i\pi}{8}}$&lt;/span&gt;, therefore &lt;span class=&quot;math-container&quot;&gt;$\omega_N^0 = 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\omega_N^4 = e^{\frac{i\pi}{2}} = i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\omega_N^8 = e^{i\pi}=-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega_N^{12} = e^{\frac{i3\pi}{2}}=-i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus &lt;span class=&quot;math-container&quot;&gt;$QFT_4|\psi\rangle$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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 \\&#xA;= \frac{1}{8}\sum_{k=0}^{15}(1^{k}+i^{k}+(-1)^{k}+(-i)^{k})|k\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This sum &lt;span class=&quot;math-container&quot;&gt;$(1^{k}+i^{k}+(-1)^{k}+(-i)^{k})$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; divides 4 otherwise its 0.&lt;/p&gt;&#xA;&lt;p&gt;Thus &lt;span class=&quot;math-container&quot;&gt;$QFT_4|\psi\rangle$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$QFT_n|\psi\rangle = \frac{1}{8}\sum_{k'=0}^{3}(4)|4k'\rangle \\&#xA;= \frac{1}{2}(|0\rangle + |4\rangle + |8\rangle + |12\rangle) \\&#xA;= \frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here I noticed that our initial state is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$QFT_4$&lt;/span&gt; with an eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. If I noticed this before I could have directly written the answer.&lt;/p&gt;&#xA;&lt;p&gt;Nonetheless, I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-08-02T17:00:00.287" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13147" PostTypeId="2" ParentId="13126" CreationDate="2020-08-02T18:01:50.777" Score="1" Body="&lt;p&gt;I would like to add to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1108/keisuke-akira&quot;&gt;keisuke.akira&lt;/a&gt; answer.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$E=e^{i\epsilon\sigma_x}$&lt;/span&gt; (a small coherent rotation) where &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; is the Pauli-X matrix i.e &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}0 &amp;amp; 1 \\ 1&amp;amp; 0\end{bmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is small and represents the tiny probability of an error.&lt;/p&gt;&#xA;&lt;p&gt;Thus &lt;span class=&quot;math-container&quot;&gt;$E=e^{i\epsilon\sigma_x} = \sin{(\epsilon)}\sigma_x + \cos{(\epsilon)}\sigma_I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now if this error was applicable on single qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (It works exactly same in case of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;). It would become&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E|0\rangle = (i\sin{(\epsilon)}\sigma_x + \cos{(\epsilon)}\sigma_I)|0\rangle \\&#xA;= \cos{(\epsilon)}\sigma_I|0\rangle + i\sin{(\epsilon)}\sigma_x|0\rangle \\&#xA;= i\sin{(\epsilon)}|1\rangle + \cos{(\epsilon)}|0\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Measuring this qubit would result in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$P(1)=\sin^2(\epsilon) =  O(\epsilon^2)$&lt;/span&gt;. Thus probability of error is &lt;span class=&quot;math-container&quot;&gt;$O(\epsilon^2)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(\epsilon^4)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;In Bit Flip Code &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_L = |000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_L = |111\rangle$&lt;/span&gt;&#xA;Now when &lt;span class=&quot;math-container&quot;&gt;$U=E^{\otimes 3}$&lt;/span&gt; is applied to &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|000\rangle = E^{\otimes 3}|000\rangle \\&#xA;= (i\sin{(\epsilon)}\sigma_x + \cos{(\epsilon)}\sigma_I)^{\otimes 3}|000\rangle \\&#xA;= (-i\sin^3{(\epsilon)}\sigma_x\sigma_x\sigma_x - \\&#xA;\sin^2{(\epsilon)}\cos{(\epsilon)}\sigma_x\sigma_x\sigma_I - &#xA;\sin{(\epsilon)}\cos{(\epsilon)}\sin{(\epsilon)}\sigma_x\sigma_I\sigma_x -&#xA;\cos{(\epsilon)}\sin^2{(\epsilon)}\sigma_I\sigma_x\sigma_x - \\&#xA;i\sin{(\epsilon)}\cos^2{(\epsilon)}\sigma_x\sigma_I\sigma_I + &#xA;i\cos{(\epsilon)}\sin{(\epsilon)}\cos{(\epsilon)}\sigma_I\sigma_x\sigma_I +&#xA;i\cos^2{(\epsilon)}\sin{(\epsilon)}\sigma_I\sigma_I\sigma_x + \\&#xA;\cos^3{(\epsilon)}\sigma_I\sigma_I\sigma_I)|000\rangle \\&#xA;= (-i\sin^3{(\epsilon)}|111\rangle - \\&#xA;\sin^2{(\epsilon)}\cos{(\epsilon)}(|110\rangle + |101\rangle + |011\rangle) + \\&#xA;i\cos^2{(\epsilon)}\sin{(\epsilon)}(|100\rangle + |001\rangle + |010\rangle) + \\&#xA;\cos^3{(\epsilon)}|000\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;While Decoding the Bit Flip Code Essentially find the majority of the 3 qubit states.&#xA;In this case the majority is state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; when after &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; the state are&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{|110\rangle,|101\rangle,|011\rangle,|111\rangle\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus probability of final measurement yielding us &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P(1) = (\sin^3(\epsilon))^2 + 3(\sin^2(\epsilon)\cos(\epsilon))^2 \\&#xA;= \sin^6(\epsilon) + 3\sin^4(\epsilon)\cos^2(\epsilon) = O(\epsilon^4)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this manner Bit Flip Error Correcting Code has reduced the error probability from &lt;span class=&quot;math-container&quot;&gt;$O(\epsilon^2)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$O(\epsilon^4)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8757" LastEditorUserId="8757" LastEditDate="2020-08-02T18:18:37.780" LastActivityDate="2020-08-02T18:18:37.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13148" PostTypeId="2" ParentId="5851" CreationDate="2020-08-02T19:22:39.417" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;what is being said with &amp;quot;a single probe within &lt;span class=&quot;math-container&quot;&gt;$2^$&lt;/span&gt; possible locations&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It wants to say the process has translated the qubit (binary representation) into a single location in memory.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What is the &amp;quot;probe&amp;quot;? And what is behind &amp;quot;degree of freedom&amp;quot;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The CPU has an index register &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and a data register &lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt; (mentioned in text above your quote in the book), the CPU would like to add contents &lt;span class=&quot;math-container&quot;&gt;$d_x$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$x^{th}$&lt;/span&gt; memory cell to the data register, i.e. &lt;span class=&quot;math-container&quot;&gt;$|d\rangle \rightarrow |d\bigoplus d_x\rangle$&lt;/span&gt;. The switches guide the data register qubit, based on index register &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, to one of the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; locations.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The binary to unary encoding is then reversed, leaving the data register with the desired contents.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The qubits are then routed back into a deﬁnite position - How does the way back work?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Swithces form a binary tree. We can go from leaf node (a location on memory) to the root node (&amp;quot;a definite position&amp;quot;) by recursively visiting the parent node.&lt;/p&gt;&#xA;" OwnerUserId="7460" LastActivityDate="2020-08-02T19:22:39.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13149" PostTypeId="2" ParentId="13123" CreationDate="2020-08-02T20:21:34.033" Score="2" Body="&lt;p&gt;Given a separable bipartite state as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\otimes|\phi\rangle$&lt;/span&gt;, you &amp;quot;get&amp;quot; the states of the single systems but taking only the corresponding state, e.g. here &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Given an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-partite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, get the corresponding reduced states via the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Partial_trace&quot; rel=&quot;nofollow noreferrer&quot;&gt;partial trace&lt;/a&gt;&lt;/em&gt; operation.&#xA;For example, if you want the state of the first &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; qubits, you do&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}_N(\rho) \equiv&#xA;(I\otimes\operatorname{Tr})\rho&#xA;\equiv \sum_k(I\otimes\langle k\rvert)\rho(I\otimes \lvert k\rangle).$$&lt;/span&gt;&#xA;More explicitly, if the matrix elements of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are written as &lt;span class=&quot;math-container&quot;&gt;$\rho_{i_1,...,i_N;j_1,...,j_N}$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[\operatorname{Tr}_N(\rho)]_{i_1,...,i_{N-1};j_1,...,j_{N-1}} \equiv&#xA;\sum_{k}\rho_{i_1,...,i_{N-1},k;j_1,...,j_{N-1},k}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To get the state of a single qubit, you do the above for all degrees of freedom except the first one.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-02T20:21:34.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13150" PostTypeId="2" ParentId="9978" CreationDate="2020-08-02T20:47:14.613" Score="2" Body="&lt;p&gt;We know that the Initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be represented as &lt;span class=&quot;math-container&quot;&gt;$\sin\frac{\theta}{2}|\chi\rangle + \cos\frac{\theta}{2}|\xi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can prove the result &lt;span class=&quot;math-container&quot;&gt;$G^R|\psi\rangle = \sin\frac{(2R+1)\theta}{2}|\chi\rangle + \cos\frac{(2R+1)\theta}{2}|\xi\rangle$&lt;/span&gt; by Induction&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Base Case&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$R=0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$G^R=G^0=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2R+1=2\times0+1=1$&lt;/span&gt;.&#xA;Thus &lt;span class=&quot;math-container&quot;&gt;$G^0|\psi\rangle = \sin\frac{(2\times 0+1)\theta}{2}|\chi\rangle + \cos\frac{(2\times 0+1)\theta}{2}|\xi\rangle &#xA;= \sin\frac{\theta}{2}|\chi\rangle + \cos\frac{\theta}{2}|\xi\rangle = |\psi\rangle$&lt;/span&gt;&#xA;is true. Base Case Proven&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Inductive Step&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us assume this is true for &lt;span class=&quot;math-container&quot;&gt;$\forall R \leq k$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$G^{k}|\psi\rangle = \sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Induction Proof&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;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&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;First we will derive some useful results.&#xA;From the same paper's Appendix B1 we are given that&#xA;&lt;span class=&quot;math-container&quot;&gt;$G = UO = (H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n})O$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; is the oracle.&lt;/p&gt;&#xA;&lt;p&gt;We know that since all states in &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle$&lt;/span&gt; are marked and all states in &lt;span class=&quot;math-container&quot;&gt;$|\xi\rangle$&lt;/span&gt; are unmarked therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$O|\chi\rangle =-|\chi\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$O|\xi\rangle =|\xi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus by Linearity,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$O(\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) = &#xA;-\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Moreover it is important to note that &lt;span class=&quot;math-container&quot;&gt;$\langle\xi|\chi\rangle =\langle\chi|\xi\rangle=0$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle and |\xi\rangle$&lt;/span&gt; are orthogonal&lt;/p&gt;&#xA;&lt;p&gt;Now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U =  H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n} \\&#xA;= 2H^{\otimes n}|0\rangle\langle0|H^{\otimes n} - I $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We note that &lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U = 2|\psi\rangle\langle \psi| - I \\&#xA;= 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 \\&#xA;= 2(\sin^2\frac{\theta}{2}|\chi\rangle\langle\chi| &#xA;+ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\xi\rangle\langle\chi| &#xA;+ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\chi\rangle\langle\xi| &#xA;+ \cos^2\frac{\theta}{2}|\xi\rangle\langle\xi|) - I$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore for &lt;span class=&quot;math-container&quot;&gt;$G^{k+1}|\psi\rangle$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G^{k+1}|\psi\rangle = GG^k|\psi\rangle &#xA;= G(\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) \\&#xA;= UO(\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) \\&#xA;= U(-\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) \\&#xA;= (2(\sin^2\frac{\theta}{2}|\chi\rangle\langle\chi| &#xA;+ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\xi\rangle\langle\chi| &#xA;+ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\chi\rangle\langle\xi| &#xA;+ \cos^2\frac{\theta}{2}|\xi\rangle\langle\xi|) - I)\\&#xA;(-\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle)\\&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we expand this expression, cancel out the terms where inner product is zero and combine the coefficients involving the same state we get,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ G^R|\psi\rangle \\&#xA;= (-(2sin^2\frac{\theta}{2}-1)\sin\frac{(2k+1)\theta}{2} &#xA;+ (2\cos\frac{\theta}{2}\sin\frac{\theta}{2})\cos\frac{(2k+1)\theta}{2})|\chi\rangle \\&#xA;+ (-(2\cos\frac{\theta}{2}\sin\frac{\theta}{2})\sin\frac{(2k+1)\theta}{2}&#xA;+ (2cos^2\frac{\theta}{2}-1)\cos\frac{(2k+1)\theta}{2})|\xi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using some trigonometry we can simply it further&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ G^R|\psi\rangle \\&#xA;= (\cos\theta\sin\frac{(2k+1)\theta}{2} + \sin\theta\cos\frac{(2k+1)\theta}{2})|\chi\rangle \\&#xA;+ (-\sin\theta\sin\frac{(2k+1)\theta}{2} + \cos\theta\cos\frac{(2k+1)\theta}{2})|\chi\rangle \\&#xA;= \sin(\theta + \frac{(2k+1)\theta}{2})|\chi\rangle + \cos(\theta + \frac{(2k+1)\theta}{2})|\xi\rangle \\&#xA;= \sin\frac{(2k+3)\theta}{2}|\chi\rangle + \cos\frac{(2k+3)\theta}{2}|\xi\rangle \\&#xA;= \sin\frac{(2(k+1)+1)\theta}{2}|\chi\rangle + \cos\frac{(2(k+1)+1)\theta}{2}|\xi\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is exactly what we wanted. Hence our proof by Mathematical Induction is complete.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;QED&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-08-02T20:47:14.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13151" PostTypeId="1" CreationDate="2020-08-02T21:44:11.060" Score="3" ViewCount="69" Body="&lt;p&gt;Since 2009, many matrix inversion algorithms have appeared.&lt;/p&gt;&#xA;&lt;p&gt;Is there somewhere a table, or recently released overview, comparing the speed of matrix inversion algorithms, like done in this table taken from &lt;a href=&quot;https://arxiv.org/abs/1803.01601&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shao&lt;/a&gt; comparing different algorithms for quantum state preparation?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IFY44.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IFY44.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12804" LastEditorUserId="55" LastEditDate="2020-08-03T09:10:13.827" LastActivityDate="2020-08-03T09:10:13.827" Title="Comparison of matrix inversion algorithms" Tags="&lt;resource-request&gt;&lt;hhl-algorithm&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13152" PostTypeId="1" CreationDate="2020-08-03T00:15:05.497" Score="2" ViewCount="80" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10455" LastEditorUserId="2293" LastEditDate="2020-08-17T02:53:21.933" LastActivityDate="2020-08-17T02:53:21.933" Title="Error mitigation matrix as backend property: Are any &quot;reliable&quot; mitigation matrices publicly available?" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;error-mitigation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13153" PostTypeId="2" ParentId="13152" CreationDate="2020-08-03T03:58:41.730" Score="3" Body="&lt;p&gt;Yes, if we have fixed backend, number of qubits, and noise model (e.g., Basic device noise model in &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.html#qiskit.providers.aer.noise.NoiseModel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.html#qiskit.providers.aer.noise.NoiseModel&lt;/a&gt;), 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I can also share one tutorial on measurement error mitigation as well as a nice YouTube video.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/3_measurement_error_mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/noise/3_measurement_error_mitigation.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=yuDxHJOKsVA&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=yuDxHJOKsVA&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I hope my answer would help.&lt;/p&gt;&#xA;" OwnerUserId="12841" LastActivityDate="2020-08-03T03:58:41.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13154" PostTypeId="2" ParentId="13142" CreationDate="2020-08-03T10:15:32.103" Score="2" Body="&lt;p&gt;As I explained in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13099/8141&quot;&gt;my answer&lt;/a&gt; on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/13096/8141&quot;&gt;a previous question&lt;/a&gt; of yours, the depolarizing channel is not really 'physical' - actual quantum systems don't really behave that way.&lt;/p&gt;&#xA;&lt;p&gt;So for simulations where you, for instance, investigate the performance of some code against the depolarizing channel, it doesn't &lt;em&gt;really&lt;/em&gt; matter what the exact value of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is in your simulations. Moreover, what is much more interesting is to perform the simulation for a &lt;em&gt;range of values&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, and see how the performance of the code depends on &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. As you may be aware, for higher &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, a code may do more bad than good (i.e. it creates more errors than it can correct); for a low &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; the code will actually do some good, and thus an interesting value for &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; might be the point where the code starts to add benefit - this value is often referred to as the &lt;em&gt;pseudo threshold&lt;/em&gt;. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12963/8141&quot;&gt;This excellent answer&lt;/a&gt; elaborates a bit on why we call it the &lt;em&gt;pseudo&lt;/em&gt; threshold, and not just threshold.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; and dephasing time &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt;; what exactly these values are is &lt;strong&gt;highly&lt;/strong&gt; dependent on what system you are simulating.&lt;/p&gt;&#xA;&lt;p&gt;For instance, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Transmon&quot; rel=&quot;nofollow noreferrer&quot;&gt;transmon qubits&lt;/a&gt; from &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM&lt;/a&gt; have a typical &lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$~50 \mu s$&lt;/span&gt; and a &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$~60 \mu s$&lt;/span&gt;. As another example, the quantum dot based &lt;a href=&quot;https://en.wikipedia.org/wiki/Loss%E2%80%93DiVincenzo_quantum_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;semiconductor qubits&lt;/a&gt; of QuTech's &lt;a href=&quot;https://www.quantum-inspire.com/backends/spin-2/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Inspire&lt;/a&gt; have a typical &lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$&amp;gt; 20 ms$&lt;/span&gt; and a &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$&amp;gt; 6 \mu s$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Note that this is just one part of the story; &lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt; say only something about what happens to your qubits when they are &lt;em&gt;idle&lt;/em&gt;. 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!&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-08-03T12:56:45.543" LastActivityDate="2020-08-03T12:56:45.543" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13155" PostTypeId="2" ParentId="13126" CreationDate="2020-08-03T12:20:10.683" Score="1" Body="&lt;p&gt;You are analysing the case where you &lt;em&gt;know&lt;/em&gt; 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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;single qubit unitaries do not change entanglement. To change entanglement with a unitary requires a two-qubit unitary.&lt;/li&gt;&#xA;&lt;li&gt;If you know what error has occurred, you can undo it with no problem.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The real trick with error correcting codes is that they still work even if you don't &lt;em&gt;know&lt;/em&gt; that the error has occurred. For example, if you have a probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; that the error occured, you should really be describing your state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=(1-p)|\psi\rangle\langle\psi|+(1-p)X_1|\psi\rangle\langle\psi|X_1,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; was your original (encoded) state. Here, the entanglement will most definitely vary with &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="8141" LastEditDate="2020-08-03T12:33:01.957" LastActivityDate="2020-08-03T12:33:01.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13156" PostTypeId="2" ParentId="8274" CreationDate="2020-08-03T14:32:06.090" Score="1" Body="&lt;p&gt;If take e.g. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12232/12280&quot;&gt;this&lt;/a&gt; decomposition of the square root of NOT then it's so simple in the IBM Q composer:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/viIhF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/viIhF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://uwspace.uwaterloo.ca/bitstream/handle/10012/7818/Amy_Matthew.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yu3wu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yu3wu.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also use functions (subroutines) in the composer (like as &lt;code&gt;csx&lt;/code&gt; from  &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/libs/qelib1.inc&quot; rel=&quot;nofollow noreferrer&quot;&gt;qelib1.inc&lt;/a&gt;), but unfortunately they do not work well any time or work with restrictions.&lt;/p&gt;&#xA;" OwnerUserId="12280" LastEditorUserId="12280" LastEditDate="2020-08-20T05:08:16.377" LastActivityDate="2020-08-20T05:08:16.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13157" PostTypeId="1" AcceptedAnswerId="13162" CreationDate="2020-08-03T17:14:36.190" Score="4" ViewCount="158" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to identify if an arbitrary Unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; is a Clifford Gate.&#xA;If such an algorithm(s) exists, what is the best computational complexity achieved thus far? Are there lower bounds on this problem?&lt;/p&gt;&#xA;" OwnerUserId="8757" LastActivityDate="2020-08-04T14:52:21.907" Title="How do I check if a gate represented by Unitary $U$ is a Clifford Gate?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;clifford-group&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13158" PostTypeId="2" ParentId="13157" CreationDate="2020-08-03T17:31:40.650" Score="7" Body="&lt;p&gt;Here's a simple strategy based on the idea that Clifford operations conjugate Pauli products into other Pauli products.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a Clifford operation, then &lt;span class=&quot;math-container&quot;&gt;$U P U^\dagger$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$X_q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_q$&lt;/span&gt; for each qubit &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, the operation is guaranteed to be Clifford.&lt;/p&gt;&#xA;&lt;p&gt;Performing the multiplication and checking if the matrix is a product of Paulis can be done in &lt;span class=&quot;math-container&quot;&gt;$O(8^N)$&lt;/span&gt; time using naive matrix multiplication, and you need to do this &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; times, so overall this would be &lt;span class=&quot;math-container&quot;&gt;$O(N 8^N)$&lt;/span&gt; time.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-03T17:31:40.650" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13160" PostTypeId="2" ParentId="13071" CreationDate="2020-08-04T04:02:15.440" Score="2" Body="&lt;p&gt;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 &lt;code&gt;to_instruction()&lt;/code&gt; 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 &lt;code&gt;append()&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;# customize a gate instruction (e.g., X gate)&#xA;qc = QuantumCircuit(1, name='X')&#xA;qc.x(0)&#xA;custom_gate = qc.to_instruction()&#xA;&#xA;# append custom gate to a new circuit&#xA;new_circ = QuantumCircuit(2)&#xA;new_circ.append(custom_gate, [0])&#xA;print(new_circ)&#xA;&#xA;     ┌───┐&#xA;q_0: ┤ X ├&#xA;     └───┘&#xA;q_1: ─────&#xA;    &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I hope my answer would help.&lt;/p&gt;&#xA;" OwnerUserId="12841" LastEditorUserId="12841" LastEditDate="2020-08-04T06:48:21.610" LastActivityDate="2020-08-04T06:48:21.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13161" PostTypeId="1" AcceptedAnswerId="13165" CreationDate="2020-08-04T07:11:35.010" Score="2" ViewCount="964" Body="&lt;p&gt;A documentation of Qiskit language is provided on &lt;a href=&quot;https://qiskit.org/documentation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit.org/documentation/&lt;/a&gt;. However, this is an on-line source and sometimes I would apprecite to have an off-line version at hand.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is it possible to download the documentation I mentioned above in PDF? Or is it available somewhere?&lt;/li&gt;&#xA;&lt;li&gt;Could you please recommend me any other Qiskit textbook for beginers in Qiskit?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-08-07T22:59:01.580" LastActivityDate="2020-08-07T22:59:01.580" Title="Where can I find the Qiskit tutorial as a pdf?" Tags="&lt;qiskit&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13162" PostTypeId="2" ParentId="13157" CreationDate="2020-08-04T12:09:49.177" Score="6" Body="&lt;p&gt;Following &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0304125&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dehaene and de Moor&lt;/a&gt; (Theorem 6 in particular), every Clifford unitary can be represented (up to a global scalar factor) by an expression of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  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&#xA;\qquad\qquad\qquad(\ast)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$0 \leqslant k \leqslant n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is a linear function of &lt;span class=&quot;math-container&quot;&gt;$n+k$&lt;/span&gt; arguments, &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is a quadratic function of &lt;span class=&quot;math-container&quot;&gt;$n+k$&lt;/span&gt; arguments, &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is a binary vector of dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is addition modulo 2, and &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; are invertible linear transformation acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional vectors modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;h2&gt;1. Check the magnitudes of the coefficients&lt;/h2&gt;&#xA;&lt;p&gt;Looking at Equation &lt;span class=&quot;math-container&quot;&gt;$(\ast)$&lt;/span&gt;, 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.&#xA;Furthermore, up to the scalar factor of &lt;span class=&quot;math-container&quot;&gt;$2^{-k/2}$&lt;/span&gt; each term is proportional to &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This implies that, for any Clifford unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, there exists an integer &lt;span class=&quot;math-container&quot;&gt;$k \geqslant 0$&lt;/span&gt; such that every entry of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is either zero or has norm &lt;span class=&quot;math-container&quot;&gt;$2^{-k/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So the first thing you should compute is &lt;span class=&quot;math-container&quot;&gt;$k = -2 \log_2 \lvert\alpha\rvert$&lt;/span&gt; for the first non-zero entry &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; that you find. If &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is not a non-negative integer (up to machine precision), your matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford. Then, as you read the rest of the matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you should check whether every other non-zero entry also has norm &lt;span class=&quot;math-container&quot;&gt;$2^{-k/2}$&lt;/span&gt;; if not, your matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;h2&gt;2. Compute a global phase&lt;/h2&gt;&#xA;&lt;p&gt;Again looking at Equation &lt;span class=&quot;math-container&quot;&gt;$(\ast)$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;So, for that same coefficient &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; as above, compute &lt;span class=&quot;math-container&quot;&gt;$\omega = \exp(-i \arg(\alpha))$&lt;/span&gt;, and compute the matrix &lt;span class=&quot;math-container&quot;&gt;$U' = \omega U$&lt;/span&gt;. The corresponding coefficient &lt;span class=&quot;math-container&quot;&gt;$\omega \alpha$&lt;/span&gt; will be purely real; if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is Clifford, all the other coefficients of &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; will be either purely real or purely imaginary. If this is not the case, then &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;p&gt;(By performing the substitution &lt;span class=&quot;math-container&quot;&gt;$U \gets U'$&lt;/span&gt; above, we may reduce to the case where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is a positive real; I suppose that this is done for the remaining description below.)&lt;/p&gt;&#xA;&lt;h2&gt;3. Test the number of entries in each row/column&lt;/h2&gt;&#xA;&lt;p&gt;If the matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, then in particular each of its columns and rows are unit vectors. As each non-zero coefficient of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has the same magnitude, namely &lt;span class=&quot;math-container&quot;&gt;$2^{-k/2}$&lt;/span&gt;, it follows that every row or column must have precisely &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; non-zero entries.&lt;/p&gt;&#xA;&lt;p&gt;So, given the value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; computed from the first non-zero entry, you can simply check as you read the matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; whether the number of non-zero entries in each row or column is &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;. If not, then &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;h2&gt;4. Test how &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; affects Pauli operators&lt;/h2&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; which may or may not be Clifford, I would expect that one of these tests would quickly discover some evidence that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford, which would improve the speed of your test.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U P_j U^\dagger$&lt;/span&gt; is a Pauli operator, for the single-qubit Pauli operators &lt;span class=&quot;math-container&quot;&gt;$P_j \in \{X_j,Z_j\}$&lt;/span&gt; acting on any one qubit &lt;span class=&quot;math-container&quot;&gt;$1 \leqslant j \leqslant n$&lt;/span&gt;. However, there are still useful things to observe here.&lt;/p&gt;&#xA;&lt;p&gt;[&lt;strong&gt;Edit:&lt;/strong&gt; &lt;em&gt;note that the following includes some corrections and improvements on the previous version of the answer. Apologies for the errors.&lt;/em&gt;]&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The number of non-zero coefficients &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt; in each row or column will give you a better bound on the run-time of computing each matrix &lt;span class=&quot;math-container&quot;&gt;$U P_j U^\dagger$&lt;/span&gt;. In general, you may be forced to use a fully general multiplication algorithm — in &lt;span class=&quot;math-container&quot;&gt;$O((2^n)^3) = O(8^n)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$O(4^k 2^n)$&lt;/span&gt; time if you use a representation of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; which can take advantage of the cases where &lt;span class=&quot;math-container&quot;&gt;$2^{k-n}$&lt;/span&gt; is small.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a Clifford operator, then &lt;span class=&quot;math-container&quot;&gt;$Q = U P_j U^\dagger$&lt;/span&gt; will be a Pauli operator. The operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; will some form &lt;span class=&quot;math-container&quot;&gt;$i^m Z^{\otimes a} X^{\otimes b}$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$a,b \in \{0,1\}^n$&lt;/span&gt; — where &lt;span class=&quot;math-container&quot;&gt;$A^{\otimes v}$&lt;/span&gt; represents a tensor product which is &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on those qubits &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$v_j = 1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathbf 1$&lt;/span&gt; on those qubits where &lt;span class=&quot;math-container&quot;&gt;$v_j = 0$&lt;/span&gt; — and where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is an integer which is odd if and only if &lt;span class=&quot;math-container&quot;&gt;$a \cdot b = \sum_j a_j b_j$&lt;/span&gt; is odd.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;When you compute &lt;span class=&quot;math-container&quot;&gt;$Q = U P_j U^\dagger$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As you compute &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, you should consider the values of every entry which you compute, because the coefficients of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; will either all be &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, or all be &lt;span class=&quot;math-container&quot;&gt;$\pm i$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is Pauli. If this does not hold, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As Craig again notes, index of the non-zero entry in the first column of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; indicates what the value of &lt;span class=&quot;math-container&quot;&gt;$b \in \{0,1\}^n$&lt;/span&gt; is. Set &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; to this value. At the same time, let &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; be the inverse (or equivalently in this case, the complex conjugate) of the non-zero entry of the first column of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Then, evaluate &lt;span class=&quot;math-container&quot;&gt;$Q' = \gamma Q X^{\otimes b}$&lt;/span&gt;. Using sparse representations of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X^{\otimes b}$&lt;/span&gt;, this should take time &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is a Pauli matrix, the matrix &lt;span class=&quot;math-container&quot;&gt;$Q'$&lt;/span&gt; which you have computed should have the form &lt;span class=&quot;math-container&quot;&gt;$Z^{\otimes a}$&lt;/span&gt; for some matrix &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, as the upper-left entry of &lt;span class=&quot;math-container&quot;&gt;$Q'$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. In particular, &lt;span class=&quot;math-container&quot;&gt;$Q'$&lt;/span&gt; should only have diagonal entries consisting of &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and you can check whether this is so while you are computing &lt;span class=&quot;math-container&quot;&gt;$Q'$&lt;/span&gt;. If this is not the case, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Finally, we can compute &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; by querying a handful of entries of &lt;span class=&quot;math-container&quot;&gt;$Q'$&lt;/span&gt;, to test whether they are &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. For each bit-string &lt;span class=&quot;math-container&quot;&gt;$e_j \in \{0,1\}^n$&lt;/span&gt; consisting of a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; at index &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; elsewhere, read the entry &lt;span class=&quot;math-container&quot;&gt;$\langle e_j \rvert\,Q'\,\lvert e_j \rangle$&lt;/span&gt;. If this is &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;, set &lt;span class=&quot;math-container&quot;&gt;$a_j = 0$&lt;/span&gt;; if it is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, set &lt;span class=&quot;math-container&quot;&gt;$a_j = 1$&lt;/span&gt;. Then, for all remaining vectors &lt;span class=&quot;math-container&quot;&gt;$x \in \{0,1\}^n$&lt;/span&gt;, test whether &lt;span class=&quot;math-container&quot;&gt;$\langle x \rvert \, Q' \lvert x \rangle = (-1)^{x \cdot a}$&lt;/span&gt;. If this is true for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$Q' = Z^{\otimes a}$&lt;/span&gt;; otherwise &lt;span class=&quot;math-container&quot;&gt;$Q'$&lt;/span&gt; is not a Pauli operator, and &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; is not Clifford.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This test performs a number of operations on very sparse matrices, each of which takes time &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; or much less, which is to say on the order of the square root of the size of the input matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For each Pauli operator &lt;span class=&quot;math-container&quot;&gt;$P_j$&lt;/span&gt;, this then takes time &lt;span class=&quot;math-container&quot;&gt;$O(4^k 2^n)$&lt;/span&gt;, and you must repeat this &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; times to test each &lt;span class=&quot;math-container&quot;&gt;$P_j \in \{X_j, Z_j\}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$1 \leqslant j \leqslant n$&lt;/span&gt;. (If you don't know for certain whether &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, you should also compute &lt;span class=&quot;math-container&quot;&gt;$U U^\dagger$&lt;/span&gt;, which also takes &lt;span class=&quot;math-container&quot;&gt;$O(4^k 2^n)$&lt;/span&gt; time). All together, this then takes time &lt;span class=&quot;math-container&quot;&gt;$O(n 4^k 2^n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Summary&lt;/h2&gt;&#xA;&lt;p&gt;Ignoring the time required to do basic arithmetic computations:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, check whether &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; could even conceivably be unitary, by computing an appropriate value of &lt;span class=&quot;math-container&quot;&gt;$k \leqslant n$&lt;/span&gt;, and testing the coefficients of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; for consistency with this value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Computing &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; will take time &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$O(4^n)$&lt;/span&gt;, which is the time required to even read the matrix (again faster if you have a sparse representation).&lt;/li&gt;&#xA;&lt;li&gt;Assuming that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; passes the consistency checks, you can test whether &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary if necessary in time &lt;span class=&quot;math-container&quot;&gt;$O(4^k 2^n)$&lt;/span&gt;, and then test whether it is Clifford in time &lt;span class=&quot;math-container&quot;&gt;$O(n 4^k 2^n)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2020-08-04T14:52:21.907" LastActivityDate="2020-08-04T14:52:21.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13163" PostTypeId="1" CreationDate="2020-08-04T12:58:41.167" Score="2" ViewCount="72" Body="&lt;p&gt;I know that for a given spin-j quantum state, say &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle = (\psi_0 , \psi_1 , \cdots , \psi_{2j})$&lt;/span&gt;, we can construct a polynomial as follows&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;w(z) = \sum_{k = 0}^{2j} (-1)^k \psi_k \sqrt{\binom{2j}{k} } z^{2j-k}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and by means of the inverse stereographic projection of the roots of &lt;span class=&quot;math-container&quot;&gt;$w(z)$&lt;/span&gt;, the Majorana's representation of &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt; is obtained on sphere. I also know that the Majorana's representation for the eigen-state of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{J.n}$&lt;/span&gt; operator with eigen-value &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the configuration of points on sphere in which there are &lt;span class=&quot;math-container&quot;&gt;$j+m$&lt;/span&gt; points in the &lt;span class=&quot;math-container&quot;&gt;$\mathbf{n}$&lt;/span&gt; direction and other &lt;span class=&quot;math-container&quot;&gt;$j-m$&lt;/span&gt; points in the antipodal point (equivalently &lt;span class=&quot;math-container&quot;&gt;$-\mathbf{n}$&lt;/span&gt; direction).&lt;/p&gt;&#xA;&lt;p&gt;My question is why the Majorana's representation of &lt;span class=&quot;math-container&quot;&gt;$e^{i\mathbf{n.J} \theta} \vert \psi \rangle$&lt;/span&gt; is just that of &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt; rotated around &lt;span class=&quot;math-container&quot;&gt;$\mathbf{n}$&lt;/span&gt; by an angle of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;? (This is transparent when &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle$&lt;/span&gt; is an eigen-vector of angular momentum in some direction but I do not see why this is true in general.)&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="12853" LastEditorUserId="12853" LastEditDate="2020-08-04T19:11:26.527" LastActivityDate="2020-08-04T19:11:26.527" Title="Why an element of SU(2) acts as a rotation for Majorana representation of states?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13164" PostTypeId="1" AcceptedAnswerId="13169" CreationDate="2020-08-04T13:53:16.377" Score="5" ViewCount="128" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt; be the tensor product of two finite dimensional Hilbert spaces, let &lt;span class=&quot;math-container&quot;&gt;$d = \operatorname{dim}(\mathcal{H}_A \otimes \mathcal{H}_B)$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle \in \mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt; be a pure entangled state.&lt;/p&gt;&#xA;&lt;p&gt;We say the entanglement in &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-&lt;em&gt;robust&lt;/em&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0 \in [0,1]$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$ (1-\epsilon) | \psi \rangle \langle \psi |  + \epsilon \, \mathbb{I}/d$&lt;/span&gt; is entangled for all &lt;span class=&quot;math-container&quot;&gt;$\epsilon \in [0, \epsilon_0]$&lt;/span&gt;. More generally we say the entanglement in &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt; is &lt;em&gt;completely&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-&lt;em&gt;robust&lt;/em&gt; if &lt;span class=&quot;math-container&quot;&gt;$ (1-\epsilon) | \psi \rangle \langle \psi |  + \epsilon \, \tau$&lt;/span&gt; is entangled for all &lt;span class=&quot;math-container&quot;&gt;$\epsilon \in [0, \epsilon_0]$&lt;/span&gt; and all states &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Are there any pure entangled states that are not &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-robust (or completely &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-robust) for all &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0 &amp;gt; 0$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-08-04T15:11:56.983" LastActivityDate="2020-08-05T07:35:30.367" Title="Are all pure entangled states `robust'?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13165" PostTypeId="2" ParentId="13161" CreationDate="2020-08-04T14:37:55.583" Score="2" Body="&lt;p&gt;The Qiskit documentation is included in the &lt;a href=&quot;https://github.com/Qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Github repositories&lt;/a&gt;, so if you clone the Qiskit repositories locally, you'll have full access to the documentation offline.  Alternatively, you could use something like &lt;a href=&quot;https://www.httrack.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;HTTrack&lt;/a&gt; to download and access the documentation website offline.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt; is probably the best resource for learning Qiskit.  There is also a nice set of Qiskit tutorials &lt;a href=&quot;https://arxiv.org/abs/1903.04359&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and the documentation itself includes a set of &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/1_getting_started_with_qiskit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorials&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-08-04T16:13:02.403" LastActivityDate="2020-08-04T16:13:02.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13166" PostTypeId="2" ParentId="13164" CreationDate="2020-08-04T15:02:12.230" Score="1" Body="&lt;p&gt;For a fixed &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;, why not simply consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\cos\theta|00\rangle+\sin\theta|11\rangle?&#xA;$$&lt;/span&gt;&#xA;Since it's a two-qubit state, entanglement can be determined using the PPT criterion. Hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=(1-\epsilon)|\psi\rangle\langle\psi|+\epsilon I/4&#xA;$$&lt;/span&gt;&#xA;is entangled if &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;lt;2\sin(2\theta)/(1+2\sin(2\theta))$&lt;/span&gt;. Any &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; you give me, and I just pick &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;\theta&amp;lt;\arcsin(\epsilon_0/2)/2\approx\epsilon_0/4$&lt;/span&gt;, and the state is not &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-robust. Given there exists a state that is not &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-robust, entanglement is not completely &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt;-robust.&lt;/p&gt;&#xA;&lt;p&gt;To prove things the other way around (for fixed &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, is there always a non-zero &lt;span class=&quot;math-container&quot;&gt;$\epsilon_0$&lt;/span&gt; such that for all &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;lt;\epsilon_0$&lt;/span&gt;, the mixed state is entangled?), we can consider entanglement witnesses. Let &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; be an entanglement witness for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. We have &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W\rho)\geq 0$&lt;/span&gt; for all separable states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W|\psi\rangle\langle \psi|)=-\sigma&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, the trace of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; will be some specific value &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(W)=k\geq 0$&lt;/span&gt; (this is positive since the maximally mixed state is separable). Consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(W(\epsilon I+(1-\epsilon)|\psi\rangle\langle\psi|))=\epsilon k-(1-\epsilon)\sigma.&#xA;$$&lt;/span&gt;&#xA;For any&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\epsilon&amp;lt;\frac{\sigma}{k+\sigma},&#xA;$$&lt;/span&gt;&#xA;the trace is negative and hence the state is entangled.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-08-05T07:35:30.367" LastActivityDate="2020-08-05T07:35:30.367" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13167" PostTypeId="2" ParentId="13152" CreationDate="2020-08-04T15:06:57.860" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;what are the advantages and disadvantages in the determination of the&#xA;calibration matrix each time that we do an experiment and mitigate its&#xA;error?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Advantage:&lt;/strong&gt; 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), &lt;em&gt;so it's likely that the matrix made immediately before an experiment will be the most accurate description of the noise of that experiment&lt;/em&gt;.&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Disadvantage:&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^{15} \times 2^{15}$&lt;/span&gt; matrix. The whole point of quantum computation is to avoid the &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(2^N)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(2^N)$&lt;/span&gt; procedure ever again.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt; For this part I do not have an answer yet, but would be keen to know if someone else does.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-08-04T15:06:57.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13168" PostTypeId="1" CreationDate="2020-08-04T15:13:33.863" Score="2" ViewCount="160" Body="&lt;p&gt;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. &lt;a href=&quot;https://i.stack.imgur.com/LWYKV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LWYKV.png&quot; alt=&quot;Image&quot; /&gt;&lt;/a&gt; instead of &lt;a href=&quot;https://i.stack.imgur.com/R40uX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R40uX.png&quot; alt=&quot;this&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.visualization import plot_bloch_vector&#xA;&#xA;%matplotlib inline&#xA;&#xA;plot_bloch_vector([0,1,0], title=&amp;quot;New Bloch Sphere&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12854" LastEditorUserId="5955" LastEditDate="2020-08-20T22:08:43.083" LastActivityDate="2021-04-23T19:17:34.553" Title="My Bloch sphere/ qsphere is appearing as an ellipse/oval" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13169" PostTypeId="2" ParentId="13164" CreationDate="2020-08-04T15:29:09.453" Score="3" Body="&lt;p&gt;The set of separable states is closed.&lt;/p&gt;&#xA;&lt;p&gt;Thus, around any entangled state - not necessarily pure - there is an &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-ball which lies entirely within the entangled states.&lt;/p&gt;&#xA;&lt;p&gt;Or, in the language of your question: All entangled states are &amp;quot;robust&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-08-04T15:29:09.453" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13170" PostTypeId="2" ParentId="12729" CreationDate="2020-08-04T18:33:13.717" Score="2" Body="&lt;p&gt;I think in this case you can split the experiments into multiple jobs. The idea is that you split measurement calibration circuits generated by &lt;code&gt;complete_meas_cal&lt;/code&gt; into a number of batches, execute the first batch and use the corresponding results to initialize a measurement correction fitter with &lt;code&gt;CompleteMeasFitter&lt;/code&gt;. Then you can use the &lt;code&gt;CompleteMeasFitter.add_data&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;device = provider.get_backend('ibmq_16_melbourne')&#xA;&#xA;from qiskit.ignis.mitigation.measurement import (complete_meas_cal,CompleteMeasFitter)&#xA;# Generate the calibration circuits&#xA;qr = qiskit.QuantumRegister(4)&#xA;meas_calibs, state_labels = complete_meas_cal(qr=qr, circlabel='mcal')&#xA;&#xA;#Split calibration circuits into two batches&#xA;job1_res = qiskit.execute(meas_calibs[0:8], backend=device, shots=1024,optimization_level=0).result()&#xA;job2_res = qiskit.execute(meas_calibs[8:16], backend=device, shots=1024,optimization_level=0).result()&#xA;&#xA;#Initialize the measurement correction fitter with the first 8 calibration circuits&#xA;meas_fitter = CompleteMeasFitter(job1_res, state_labels, circlabel='mcal')&#xA;meas_fitter.plot_calibration()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/64nm2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/64nm2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#Update the measurement correction fitter with the second 8 calibration circuits&#xA;meas_fitter.add_data(new_results=job2_res)&#xA;meas_fitter.plot_calibration()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K7mVc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K7mVc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I hope my answer would help.&lt;/p&gt;&#xA;" OwnerUserId="12841" LastEditorUserId="1859" LastEditDate="2020-09-11T08:23:16.137" LastActivityDate="2020-09-11T08:23:16.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13171" PostTypeId="1" CreationDate="2020-08-04T20:06:12.260" Score="2" ViewCount="69" Body="&lt;p&gt;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 &lt;code&gt;c_if&lt;/code&gt; to apply the gate based on the measurement result of that bit.&lt;/p&gt;&#xA;&lt;p&gt;Intuitively I would think this could be written as: &lt;code&gt;qc.h(q[0]).c_if(c[3], 1)&lt;/code&gt; but that only returns an error while &lt;code&gt;qc.h(q[0]).c_if(c, 1)&lt;/code&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9372/how-to-implement-if-statement-based-on-measurement-results-in-qiskit&quot;&gt;This question&lt;/a&gt; is similar and the answer seems to imply that it isn't possible to use c_if this way.&lt;/p&gt;&#xA;&lt;p&gt;If c_if can't do this, would something like what they mentioned in their question: &lt;code&gt;if(c[3]==1) qc.h(q[0])&lt;/code&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="12856" LastEditorUserId="9006" LastEditDate="2020-08-05T06:58:34.873" LastActivityDate="2020-08-05T13:55:30.477" Title="Is it possible to implement c_if statement based on a measurement in a single specified classical bit in qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13173" PostTypeId="2" ParentId="8274" CreationDate="2020-08-05T04:02:54.917" Score="1" Body="&lt;p&gt;I cannot add a comment, but I have a little question to the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13156/12416&quot;&gt;answer&lt;/a&gt;, sorry.&lt;/p&gt;&#xA;&lt;p&gt;Why exactly &lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt; (with minus) is a parameter of the cU1 gate in your circuit?&#xA;Isn't e.g. &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; (without minus) appropriate?&lt;/p&gt;&#xA;" OwnerUserId="12416" LastEditorUserId="9006" LastEditDate="2020-08-05T06:57:42.990" LastActivityDate="2020-08-05T06:57:42.990" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13174" PostTypeId="1" AcceptedAnswerId="13178" CreationDate="2020-08-05T06:07:21.483" Score="1" ViewCount="39" Body="&lt;p&gt;Let's say I have the state of the system of 2 qubits: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}|00\rangle+\frac{2}{\sqrt{3}}|10\rangle$&lt;/span&gt;, and I want to measure it in the standard basis. How would I write it mathematically? What is the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; number of qubits version of it?&lt;/p&gt;&#xA;" OwnerUserId="2559" LastEditorUserId="9006" LastEditDate="2020-08-05T06:59:02.720" LastActivityDate="2020-08-05T07:18:11.223" Title="What is the matrix for measuring a superposition of general number of qubits in standard basis?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13175" PostTypeId="2" ParentId="8326" CreationDate="2020-08-05T06:16:25.850" Score="3" Body="&lt;p&gt;Yes it is possible!&#xA;However you need to make some small changes to the circuit. In the paper An &lt;a href=&quot;https://arxiv.org/abs/1903.00768&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental Study of Shor's Factoring Algorithm on IBM Q&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11857" LastEditorUserId="9006" LastEditDate="2020-08-05T06:56:38.713" LastActivityDate="2020-08-05T06:56:38.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13176" PostTypeId="2" ParentId="13097" CreationDate="2020-08-05T06:40:10.703" Score="1" Body="&lt;p&gt;I shall explain taking the case of a = 2. The process is the same for any other value of a you have mentioned.&lt;/p&gt;&#xA;&lt;p&gt;So to factor N = 15, you need the gates &lt;span class=&quot;math-container&quot;&gt;$U^4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^1$&lt;/span&gt; gates. Where U performs the following operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$ U|y\rangle = |yamodN\rangle $&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$ U^2|y\rangle = |ya^2modN\rangle $&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$ U^4|y\rangle = |ya^4modN\rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We first apply &lt;span class=&quot;math-container&quot;&gt;$U^4$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt; and finally &lt;span class=&quot;math-container&quot;&gt;$U^1$&lt;/span&gt;. I am assuming that you are aware that we start Shor's algorithm by giving an input &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$U^4$&lt;/span&gt; which simply performs &lt;span class=&quot;math-container&quot;&gt;$|16mod15\rangle = |1\rangle$&lt;/span&gt;. Actually if you try out all the possible input values you will realise that &lt;span class=&quot;math-container&quot;&gt;$U^4$&lt;/span&gt; is actually an identity operation.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt;, the operation performed is &lt;span class=&quot;math-container&quot;&gt;$U^2|1\rangle = |4mod15\rangle = |4\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$log_2(n)$&lt;/span&gt;). So &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is represented by 0001 and similarly &lt;span class=&quot;math-container&quot;&gt;$|4\rangle$&lt;/span&gt; by 0100. Therefore we need to swap 1st and third row. This is the general procedure.&lt;/p&gt;&#xA;&lt;p&gt;Now the two possible kets which may enter &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|4\rangle$&lt;/span&gt;. So you need to be able to map them to &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|8\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt; by applying U twice or by the method I have described above. Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="11857" LastActivityDate="2020-08-05T06:40:10.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13177" PostTypeId="2" ParentId="12365" CreationDate="2020-08-05T06:47:02.320" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11857" LastActivityDate="2020-08-05T06:47:02.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13178" PostTypeId="2" ParentId="13174" CreationDate="2020-08-05T07:18:11.223" Score="2" Body="&lt;p&gt;For measuring 2 qubits, there are 4 possible outcomes, corresponding to projectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|.&#xA;$$&lt;/span&gt;&#xA;So, if you have a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, you get the outcome &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_x=\langle\psi|P_x|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This immediately generalises to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits where you have &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible outcomes &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$P_x=|x\rangle\langle x|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_x=\langle\psi|P_x|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-05T07:18:11.223" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13179" PostTypeId="1" CreationDate="2020-08-05T08:23:20.683" Score="3" ViewCount="56" Body="&lt;p&gt;In &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/15/11/113008&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; on quantum Ising model dynamics, they consider the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{H} = \sum_{j &amp;lt; k} J_{jk} \hat{\sigma}_{j}^{z}\hat{\sigma}_{k}^{z}$$&lt;/span&gt;&#xA;and the correlation function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a,b= \pm$&lt;/span&gt; and the time dependence of the Heisenberg picture&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{\sigma}_{j}^{a}(t) = e^{it\mathcal{H}}\hat{\sigma}_{j}^{a}e^{-it\mathcal{H}}$$&lt;/span&gt;&#xA;where the time ordering operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T_C}$&lt;/span&gt; orders operators along a closed path &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;Can anyone see the reasoning behind the subsequent statement on page 6:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If an operator &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}^{a=\pm}_{j}$&lt;/span&gt; occurs in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; one or more times, the operator &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}^{z}_{j}$&lt;/span&gt; (appearing in the time evolution operator) is forced to take on a well defined value &lt;span class=&quot;math-container&quot;&gt;$\sigma_{j}^{z}(t)$&lt;/span&gt; &lt;em&gt;at all points in time&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I understand why it would be well-defined for all times after &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; (denoting the first occurrence of the operator &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}^{a=\pm}_{j}$&lt;/span&gt;) since this results in the state on site &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; being an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}_{j}^{z}$&lt;/span&gt;, hence it commutes with the Ising Hamiltonian above. But surely before &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; the state on site &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; could be in any spin orientation and hence would be affected by the Ising interaction?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2020-08-27T12:54:10.960" LastActivityDate="2020-08-27T12:54:10.960" Title="Quantum Ising model correlation function query" Tags="&lt;quantum-state&gt;&lt;correlations&gt;&lt;many-body-systems&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13181" PostTypeId="1" AcceptedAnswerId="13182" CreationDate="2020-08-05T13:04:13.660" Score="0" ViewCount="206" Body="&lt;p&gt;I am running a standard VQE from the example shown in here &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&lt;/a&gt;, however I keep getting this output constantly (as many times the vqe runs which is a lot).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;DeprecationWarning: The Python built-in `round` is deprecated for complex scalars, &#xA;and will raise a `TypeError` in a future release. Use `np.round` or `scalar.round` &#xA;instead.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;is there any way to suppress this without suppressing the entire python terminal as I need the output for other things.&lt;/p&gt;&#xA;" OwnerUserId="12862" LastEditorUserId="55" LastEditDate="2020-08-06T08:34:14.130" LastActivityDate="2020-08-06T08:34:14.130" Title="Suppress deprecation warnings from Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13182" PostTypeId="2" ParentId="13181" CreationDate="2020-08-05T13:27:32.840" Score="1" Body="&lt;p&gt;You can add the following before running the VQE to suppress the deprecation warning&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;warnings.filterwarnings('ignore', category=DeprecationWarning)&#xA;# run VQE here&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That turns &lt;strong&gt;all&lt;/strong&gt; the deprecation warnings off, if you want to turn them on again you can add&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;warnings.filterwarnings('always', category=DeprecationWarning)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I don't think there is a way to turn off just Qiskit's deprecation warnings.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-08-05T13:27:32.840" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13183" PostTypeId="2" ParentId="13171" CreationDate="2020-08-05T13:55:30.477" Score="2" Body="&lt;p&gt;&lt;code&gt;c_if&lt;/code&gt; must be used on an entire &lt;code&gt;ClassicalRegister&lt;/code&gt;. However, it is still possible to use it on a single classical bit. You would need to create a &lt;code&gt;ClassicalRegister&lt;/code&gt; of size 1, and attach that to your circuit. This would be the register that you input into the &lt;code&gt;c_if&lt;/code&gt; call.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;&#xA;c1 = ClassicalRegister(1)&#xA;c3 = ClassicalRegister(3)&#xA;q4 = QuantumRegister(4)&#xA;qc = QuantumCircuit(q4, c3)  # Instantiate with one of the classical registers &#xA;qc.add_register(c1) # Add the other classical register&#xA;&#xA;qc.x(0)&#xA;qc.measure(range(4), range(4)&#xA;qc.x(0).c_if(c1, 1)  # Add an X-Gate if the classical register c1 outputs 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Do note though, using &lt;code&gt;c_if&lt;/code&gt; is not supported on the real hardware, so you would only be able to run this circuit on the simulator.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-08-05T13:55:30.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13185" PostTypeId="2" ParentId="13181" CreationDate="2020-08-05T14:40:38.810" Score="1" Body="&lt;p&gt;@Cryoris answer is perfectly valid, but a more &amp;quot;Pythonic&amp;quot; way of doing this is with the help of the &lt;code&gt;with&lt;/code&gt; keyword:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;&#xA;with warnings.catch_warnings():&#xA;    warnings.filterwarnings(&amp;quot;ignore&amp;quot;, category=DeprecationWarning) &#xA;    # Run VQE here, respect the identation.&#xA;# /!\ At this level of identation, warnings are no longer ignored.&#xA;# No need to think to call another method afterwards.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The issue with this code being that you ignore &lt;strong&gt;all&lt;/strong&gt; the deprecation warnings. If you want to only ignore the one that bother you, add a filter:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;&#xA;with warnings.catch_warnings():&#xA;    warnings.simplefilter(&amp;quot;ignore&amp;quot;, &#xA;                          category=DeprecationWarning, &#xA;                          message=(&#xA;                                 &amp;quot;The Python built-in round is deprecated for complex &amp;quot;&#xA;                                 &amp;quot;scalars, and will raise a TypeError in a future release. &amp;quot;&#xA;                                 &amp;quot;Use np.round or scalar.round instead.&amp;quot;&#xA;                             ) &#xA;                         ) &#xA;    # Run VQE here, respect the identation.&#xA;# /!\ At this level of identation, warnings are no longer ignored.&#xA;# No need to think to call another method afterwards.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This answer has been constructed from &lt;a href=&quot;https://stackoverflow.com/a/14463362/4810787&quot;&gt;this other answer&lt;/a&gt; and the &lt;a href=&quot;https://docs.python.org/3.9/library/warnings.html#warnings.filterwarnings&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;warnings&lt;/code&gt; module documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I tested with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;def f():&#xA;    warnings.warn(&amp;quot;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.&amp;quot;, DeprecationWarning)&#xA;    &#xA;with warnings.catch_warnings():&#xA;    warnings.filterwarnings(&amp;quot;ignore&amp;quot;, &#xA;                          category=DeprecationWarning, &#xA;                          message=(&#xA;                                 &amp;quot;The Python built-in round is deprecated for complex &amp;quot;&#xA;                                 &amp;quot;scalars, and will raise a TypeError in a future release. &amp;quot;&#xA;                                 &amp;quot;Use np.round or scalar.round instead.&amp;quot;&#xA;                             ) &#xA;                         ) &#xA;    print(&amp;quot;In 'with' block:&amp;quot;)&#xA;    f()&#xA;    print(&amp;quot;Done&amp;quot;)&#xA;print(&amp;quot;Out of 'with' block:&amp;quot;)&#xA;f()&#xA;print(&amp;quot;Done&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;that prints&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;In 'with' block:&#xA;Done&#xA;Out of 'with' block:&#xA;-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.&#xA;Done&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in my IPython session. You can check that the warning has been filtered within the &lt;code&gt;with&lt;/code&gt; block and not filtered outside of it.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2020-08-05T14:40:38.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13186" PostTypeId="1" AcceptedAnswerId="13188" CreationDate="2020-08-05T16:27:54.413" Score="1" ViewCount="101" Body="&lt;p&gt;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 :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let a = 4.0;&#xA;Message(Type(a));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This would print :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;double&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-08-05T19:28:36.370" Title="Is there a Q# funtion which returns the type of a variable?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13188" PostTypeId="2" ParentId="13186" CreationDate="2020-08-05T19:28:36.370" Score="4" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="12864" LastActivityDate="2020-08-05T19:28:36.370" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13189" PostTypeId="1" AcceptedAnswerId="13190" CreationDate="2020-08-05T20:22:39.880" Score="1" ViewCount="35" Body="&lt;p&gt;I am working with multiple operations and used partial application in different cases in Q#. I have 2 questions :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can a partial applicated operation be passed as an argument ?&lt;/li&gt;&#xA;&lt;li&gt;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 ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Of course, I you need clarifications, I will comment and edit appropriately. Thanks for reading !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-08-05T20:55:14.017" Title="Usage of partial application in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13190" PostTypeId="2" ParentId="13189" CreationDate="2020-08-05T20:55:14.017" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Can a partial applicated operation be passed as an argument ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes.&lt;/p&gt;&#xA;&lt;p&gt;For example, let's say you want to pass an argument of type &lt;code&gt;(Qubit =&amp;gt; Unit)&lt;/code&gt; (an operation applied to a single qubit, say, a gate), and you want to get it by using &lt;code&gt;Ry&lt;/code&gt; gate with a fixed rotation angle parameter. The signature of &lt;code&gt;Ry&lt;/code&gt; operation is &lt;code&gt;operation Ry (theta : Double, qubit : Qubit) : Unit&lt;/code&gt;, so its type is &lt;code&gt;((Double, Qubit) =&amp;gt; Unit)&lt;/code&gt;. If you use partial application to define a new operation&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let RyHalfPi = Ry(PI() / 2.0, _);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the signature of the new operation will be &lt;code&gt;(Qubit =&amp;gt; Unit)&lt;/code&gt; (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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Can you first fill one argument, store it, fill another argument, store it, and then finally call the operation by filling the last argument ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes, in exactly the same way as in the first case!&lt;/p&gt;&#xA;&lt;p&gt;If, for example, you want to use &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1frac&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;R1Frac&lt;/code&gt;&lt;/a&gt; gate with signature &lt;code&gt;(Int, Int, Qubit) : Unit&lt;/code&gt;, you can first fill in the numerator:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let R1Frac10 = R1Frac(10, _, _);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;to get operation with signature &lt;code&gt;(Int, Qubit) : Unit&lt;/code&gt;, and then fill in the power to get a single-qubit gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for (power in 0 .. 1 &amp;lt;&amp;lt; 10) {&#xA;    let R1Frac10Power = R1Frac10 (power, _);&#xA;    // ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You can check the testing harnesses of the &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Katas&lt;/a&gt; for more examples - they use partial application quite extensively to use unified testing harness for tasks with slightly different operation signatures.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-08-05T20:55:14.017" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13191" PostTypeId="2" ParentId="13140" CreationDate="2020-08-05T21:43:11.273" Score="3" Body="&lt;p&gt;Like many ideas in quantum information theory, I think this is best understood using a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-party communication scenario. Suppose Alice has a classical random variable, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; which can take values &lt;span class=&quot;math-container&quot;&gt;$1,2, \cdots, k$&lt;/span&gt; with probabilities &lt;span class=&quot;math-container&quot;&gt;$p_{X}(1), p_{X}(2), \cdots, p_{X}(k)$&lt;/span&gt;. Alice then encodes this information by encoding the classical index &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$\rho^{j}$&lt;/span&gt;. One can represent this scenario as a classical ensemble, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E} = \{ p_X(j), \rho^{j} \}_{j=1}^{k}$&lt;/span&gt; (note that the set &lt;span class=&quot;math-container&quot;&gt;$\{\rho^j\}$&lt;/span&gt; is, per se, not mutually orthogonal). For convenience, let's explicitly keep the classical index &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; by representing this as a classical-quantum state (where the classical index &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is correlated to the state &lt;span class=&quot;math-container&quot;&gt;$\rho^{j}$&lt;/span&gt; that carries its information)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sigma = \sum\limits_{j=1}^{k} p_X(j) | j \rangle_{X} \langle  j | \otimes \rho^{j}. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, Alice sends this state to Bob, whose task is to determine the classical index &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; 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,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ I_{\mathrm{acc}}(\mathcal{E})=\max _{\left\{\Lambda_{y}\right\}} I(X ; Y), $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{ \Lambda_{y} \}$&lt;/span&gt; is a POVM and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is a random variable corresponding to the outcome of the measurement. This quantity &lt;span class=&quot;math-container&quot;&gt;$I_{\mathrm{acc}}(\mathcal{E})$&lt;/span&gt; is called the accessible information of the ensemble &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;. Now, in general, one has&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ I_{\mathrm{acc}}(\mathcal{E}) \leq \chi(\mathcal{E}) $$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \chi(\mathcal{E}) \equiv H\left(\rho_{B}\right)-\sum_{x} p_{X}(x) H\left(\rho_{B}^{x}\right) $$&lt;/span&gt;&#xA;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,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \chi(\mathcal{E})=I(X ; B)_{\sigma}, $$&lt;/span&gt;&#xA;which, when combined with the following (simple) bound:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ I(X;Y) \leq \log \left( \mathrm{dim}(\mathcal{H}) \right), $$&lt;/span&gt;&#xA;gives us the desired result. Note that the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{dim}(\mathcal{H})$&lt;/span&gt; is the Hilbert space where the states &lt;span class=&quot;math-container&quot;&gt;$\{\rho^j\}$&lt;/span&gt; belong.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{ \rho_{j} \}$&lt;/span&gt; is mutually orthogonal and hence all states &lt;span class=&quot;math-container&quot;&gt;$\rho^j$&lt;/span&gt; are distinguishable. Now, if &lt;span class=&quot;math-container&quot;&gt;$k=2^n$&lt;/span&gt;, say, for example, because the random variable takes values in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit strings, then, we need, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{dim}(\mathcal{H}) = 2^n$&lt;/span&gt;, which can be achieved by choosing states from an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit space, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} \cong (\mathbb{C}^{2})^{\otimes n}$&lt;/span&gt;. Therefore, if we want to classically encode (and retrieve) &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bits, then we need &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubits. Vice versa, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubits can contain &lt;strong&gt;at most&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bits of information.&lt;/p&gt;&#xA;&lt;p&gt;A few remarks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You don't need to store information in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubits. You can store the information in any &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-levels).&lt;/li&gt;&#xA;&lt;li&gt;The key constraint comes from the ability to &lt;em&gt;successfully&lt;/em&gt; retrieve information, which requires the states to be distinguishable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;More details can be found in Section 11.6 of &lt;a href=&quot;https://arxiv.org/abs/1106.1445&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mark Wilde's book&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-08-07T03:21:16.773" LastActivityDate="2020-08-07T03:21:16.773" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13192" PostTypeId="1" CreationDate="2020-08-06T05:23:13.617" Score="0" ViewCount="31" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2NQ1R.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2NQ1R.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/egXFV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/egXFV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The simulation result is 111, but the actual result is 000 001 010 011 100 101 110 111&lt;/p&gt;&#xA;" OwnerUserId="12866" LastActivityDate="2020-08-12T07:33:09.107" Title="The results of Toffoli gate are quite different from those of simulation" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-08-12T15:51:11.507" ContentLicense="CC BY-SA 4.0" />
  <row Id="13193" PostTypeId="2" ParentId="13192" CreationDate="2020-08-06T05:36:45.410" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Try to increase number of shot for algorithm run on actual quantum computer. It can help to get &amp;quot;better&amp;quot; results. Also, try to run the algorithm on different backends.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt; (&lt;em&gt;Comments added by JSdJ&lt;/em&gt;):&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-08-12T07:33:09.107" LastActivityDate="2020-08-12T07:33:09.107" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13194" PostTypeId="1" CreationDate="2020-08-06T07:21:50.513" Score="2" ViewCount="177" Body="&lt;p&gt;I've been following &lt;a href=&quot;https://pennylane.ai/qml/glossary/parameter_shift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; website to check out how parameter-shift works for calculation of gradients for backpropagation in Variational Quantum Machine Learning Circuits&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U_i(\theta_i) = exp(-i\frac{\theta_i}{2}\hat P_i) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The Gradient of this unitary is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;which makes sense, the problem starts with the following sentence:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Substituting this into the quantum circuit function &lt;span class=&quot;math-container&quot;&gt;$f(x;\theta_i)$&lt;/span&gt;, we get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$f(x;\theta)$&lt;/span&gt; was given by the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \langle 0 | U_0^{\dagger}(x)U_i^{\dagger}(\theta_i)\hat BU_i(\theta_i)U_0(x)|0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now I have no idea how that came to be, what am I missing?&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="55" LastEditDate="2020-08-14T06:29:29.623" LastActivityDate="2020-08-14T06:29:29.623" Title="Calculating gradient of a gate using Parameter shift rule" Tags="&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13195" PostTypeId="1" AcceptedAnswerId="13290" CreationDate="2020-08-06T11:10:21.450" Score="0" ViewCount="159" Body="&lt;p&gt;I was reading about the Grover Search algorithm on &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html#example&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html#example&lt;/a&gt;. I understood the method but I have a few questions. My question regards the two-qubit case.&lt;/p&gt;&#xA;&lt;p&gt;Does the diffusion operator &lt;span class=&quot;math-container&quot;&gt;$D=2|s\rangle\langle s|-1$&lt;/span&gt;, depend upon the initial state i.e &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|+\rangle$&lt;/span&gt; and the marked state?&lt;/p&gt;&#xA;&lt;p&gt;Actually I was reading an article &lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.68.022306&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.68.022306&lt;/a&gt;, which had an equation&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;-U_{S_j}|S_j\rangle_{w}=|w\rangle&#xA;\end{equation}&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$U_x=1-2|x\rangle\langle x|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S_1=\left(\dfrac{0+1}{\sqrt{2}}\right)^{\otimes 2}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; is the marked state. The other &lt;span class=&quot;math-container&quot;&gt;$S_{j's}$&lt;/span&gt; can be the states for instance &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|-\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle|-\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle|+\rangle$&lt;/span&gt; etc. with total such &lt;span class=&quot;math-container&quot;&gt;$S_j$&lt;/span&gt; being &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt;. My question is how does one make the diffusion operator for a state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle|-\rangle$&lt;/span&gt;. As an example from the table in the article it states for instance if &lt;span class=&quot;math-container&quot;&gt;$j=2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S_2=|+\rangle|-\rangle$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-U_{S_2}|S_1\rangle_{10}=-|00\rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$10=w$&lt;/span&gt; is the marked state.&#xA;Can somebody explain how this equation came? can somebody atleast hint at some references?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-08-14T06:37:21.197" LastActivityDate="2020-08-14T06:37:21.197" Title="Grover search with different diffusion operators" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13196" PostTypeId="1" CreationDate="2020-08-06T15:10:48.443" Score="3" ViewCount="68" Body="&lt;p&gt;Given a pure two qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle$&lt;/span&gt;. If we trace out system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, the remaining density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_A = Tr_B|\psi_{AB}\rangle\langle\psi_{AB}|$&lt;/span&gt;, can be represented as a point lying anywhere on or inside a Blochsphere.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;How do have to steer (by applying timevarying unitaries &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt;) the composite system &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle$&lt;/span&gt;, such that the resulting trajectory on or inside the Bloch sphere of system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an ellipse?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="5280" LastEditDate="2020-08-07T09:39:45.950" LastActivityDate="2020-08-10T16:21:17.757" Title="Reduced Density Matrix Equation of Motion to describe an Ellipse" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13198" PostTypeId="1" CreationDate="2020-08-06T17:52:07.113" Score="4" ViewCount="531" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7856" LastEditorUserId="55" LastEditDate="2020-08-07T20:12:35.150" LastActivityDate="2020-08-11T15:17:47.157" Title="What does quantum gate fidelity mean?" Tags="&lt;quantum-gate&gt;&lt;fidelity&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13199" PostTypeId="1" CreationDate="2020-08-06T18:40:13.070" Score="1" ViewCount="41" Body="&lt;p&gt;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&amp;gt; state to the |1&amp;gt; state.&lt;/p&gt;&#xA;&lt;p&gt;My question is, how does the existence of noise affect the implementation of gates (i.e. the X-gate)?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="7856" LastEditorUserId="55" LastEditDate="2020-08-10T06:15:21.320" LastActivityDate="2020-08-10T07:54:48.770" Title="How does noise affect the implementation of quantum gates?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13200" PostTypeId="1" CreationDate="2020-08-06T19:15:20.433" Score="0" ViewCount="49" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Cheers!&lt;/p&gt;&#xA;" OwnerUserId="12239" LastActivityDate="2020-08-07T04:25:43.360" Title="How can I mesure a register of qubits and grab the index of the qubit with the highest probability in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13201" PostTypeId="1" AcceptedAnswerId="13207" CreationDate="2020-08-07T02:12:07.913" Score="1" ViewCount="55" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;2-1-0-3&#xA;    | |&#xA;    4-5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;would it be better to CNOT 0 with 2, or 0 with 5, given that they have the same distance? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="55" LastEditDate="2020-08-10T06:14:35.447" LastActivityDate="2020-08-10T06:14:35.447" Title="How do you CNOT between qubits faraway from each other?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13202" PostTypeId="1" AcceptedAnswerId="13226" CreationDate="2020-08-07T02:20:01.977" Score="1" ViewCount="453" Body="&lt;p&gt;Is there a way in Qiskit to initialize &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits with binary values (0s and 1s)? For example, how can I initialize two qubits in the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;? Here is a code snippet:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;import numpy as np&#xA;&#xA;n = 2&#xA;circuit = QuantumCircuit(n, n)&#xA;&#xA;# Seeking some sort of initialization routine like this&#xA;circuit.initializeQubits(initialState=np.ones(n), ...)   &#xA;&#xA;# Define rest of the circuit&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I am aware of the method in &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/circuits/3_summary_of_quantum_operations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; tutorial, which is also referenced &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1413/how-to-create-an-arbitrary-state-in-qiskit-for-a-local-qasm-simulator&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9766/prepending-initial-state-to-a-quantum-circuit-in-qiskit&quot;&gt;here&lt;/a&gt;. This method creates an arbitrary qubit state by defining an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; dimensional (&lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt;) 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; dimensional binary vector, which for the above example would be &lt;code&gt;[1, 1]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12614" LastEditorUserId="9118" LastEditDate="2020-10-26T18:31:37.873" LastActivityDate="2020-10-26T18:31:37.873" Title="Qiskit: Initializing $n$ qubits with binary values ($0$s and $1$s)" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;ibm&gt;&lt;initialization&gt;" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13203" PostTypeId="1" AcceptedAnswerId="13204" CreationDate="2020-08-07T03:22:03.673" Score="1" ViewCount="37" Body="&lt;p&gt;According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum threshold theorem&lt;/a&gt;, error rate can be arbitrarily low. But when I use IBM Quantum Experience to measure a simple &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, it gives result of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with probability of 52.148%.&lt;/p&gt;&#xA;" OwnerUserId="12876" LastActivityDate="2020-08-07T04:12:15.630" Title="Dose Quantum threshold theorem apply to IBM Quantum Experience" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;error-correction&gt;&lt;physical-realization&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13204" PostTypeId="2" ParentId="13203" CreationDate="2020-08-07T04:12:15.630" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, the statistic provided in the Wikipedia page suggests this chip would be incapable of sufficiently depressing the error rate:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;IBM's chips have 10-20 qubits, and your own figures indicate an error rate of &amp;gt;2%, so you'd either need significantly reduced error rates or &lt;strong&gt;significantly&lt;/strong&gt; increased qubit volume.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-07T04:12:15.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13205" PostTypeId="2" ParentId="13200" CreationDate="2020-08-07T04:25:43.360" Score="1" Body="&lt;p&gt;One potential strategy is to probabilistically estimate the qubits' probabilities. Here's some pseudocode:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;counts = Int[NumberOfQubits]&#xA;for counter in trials:&#xA;   ApplyOperationToArray&#xA;   results = MeasureArray&#xA;   AddResults(results, counts)&#xA;idx = maxIdx(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;em&gt;always&lt;/em&gt; have a chance for failure!&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-07T04:25:43.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13206" PostTypeId="2" ParentId="13202" CreationDate="2020-08-07T07:20:07.857" Score="0" Body="&lt;p&gt;Qiskit assumes that initially each qubitt is set to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. So if you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, the initial state is &lt;span class=&quot;math-container&quot;&gt;$|00..0\rangle$&lt;/span&gt;. If you want to flip the state of some specific qubits, you have to apply an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to each of those specific qubits. For example, the following code sets the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(2)&#xA;cr = ClassicalRegister(2)&#xA;circuit = QuantumCircuit(qr, cr, name='mycircuit')&#xA;circuit.x(qr[0])&#xA;circuit.x(qr[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-08-07T07:20:07.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13207" PostTypeId="2" ParentId="13201" CreationDate="2020-08-07T07:36:10.950" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-07T07:36:10.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13208" PostTypeId="1" AcceptedAnswerId="13209" CreationDate="2020-08-07T09:57:17.530" Score="3" ViewCount="68" Body="&lt;p&gt;Assume a composite quantum systes with state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle$&lt;/span&gt; or better &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi_{AB}\rangle\langle\psi_{AB}|$&lt;/span&gt;. I want to know the state of system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; only, i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there any difference if I trace out system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_A=Tr_B\rho$&lt;/span&gt; compared to building up &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; from projections on the Pauli operators, i.e. &lt;span class=&quot;math-container&quot;&gt;$\displaystyle\rho_A=\sum_{k=1,x,y,z}Tr\big((\sigma_k\otimes 1\big)^\dagger \rho)\sigma_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Some numerics indicate, that this is the same...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="55" LastEditDate="2020-08-07T12:41:30.867" LastActivityDate="2020-08-07T12:41:30.867" Title="Is the partial trace $\mathrm{Tr}_B(\rho)$ equal to $\sum_k \mathrm{Tr}[(\sigma_k\otimes I)^\dagger \rho]\sigma_k$?" Tags="&lt;density-matrix&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13209" PostTypeId="2" ParentId="13208" CreationDate="2020-08-07T10:06:36.003" Score="4" Body="&lt;p&gt;They are exactly the same. Remember that you can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=\sum_{i,j}\rho_{ij}\sigma_i\otimes\sigma_j.&#xA;$$&lt;/span&gt;&#xA;If you take the partial trace, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\sum_{i,j}\rho_{ij}\sigma_i \text{Tr}(\sigma_j).&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\sigma_j)=0$&lt;/span&gt; unless &lt;span class=&quot;math-container&quot;&gt;$j=0$&lt;/span&gt;, i.e. the identity operator. Thus, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=\sum_i2\rho_{i0}\sigma_i,&#xA;$$&lt;/span&gt;&#xA;and of course we can calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2\rho_{i0}=\text{Tr}((\sigma_i\otimes I)\rho).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-07T10:06:36.003" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13210" PostTypeId="1" CreationDate="2020-08-07T11:55:27.213" Score="1" ViewCount="143" Body="&lt;p&gt;I am currently reading &lt;a href=&quot;https://arxiv.org/abs/1501.03099&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1501.03099&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the third part of the paper, &amp;quot;&lt;em&gt;Measuring and detecting quantumness&lt;/em&gt;&amp;quot;, the authors define the SWAP operators, use them on the initial state &lt;span class=&quot;math-container&quot;&gt;$\rho_a \otimes \rho_a \otimes \rho_b\otimes \rho_b $&lt;/span&gt; and take the trace.&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/EvGQn.jpg&quot; width=&quot;400&quot;&gt;&#xA;&lt;p&gt;Now, I know that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\rho_a \otimes \rho_b)$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\rho_a)\mathrm{Tr}(\rho_b)$&lt;/span&gt; according to the property of the Trace operator on a product state.&#xA;Does this mean that the SWAP operator acting on these two qubits must also preserve the trace?&lt;/p&gt;&#xA;&lt;p&gt;Therefore if my interpretation is correct, I have two questions regarding this.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Why would the SWAP operator &lt;span class=&quot;math-container&quot;&gt;$S_{CD}$&lt;/span&gt; change the whole system state as the states of the qubits C and D are the same in equation (12)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How is the trace in equations (12) and (13) different if the SWAP operators must preserve trace? And how do these equations hold?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12560" LastEditorUserId="55" LastEditDate="2020-08-09T05:18:09.473" LastActivityDate="2020-08-09T05:36:05.880" Title="Can SWAP operators change trace of a product state?" Tags="&lt;quantum-gate&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ClosedDate="2020-08-09T18:37:00.343" ContentLicense="CC BY-SA 4.0" />
  <row Id="13211" PostTypeId="2" ParentId="13201" CreationDate="2020-08-07T11:55:44.530" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2020-08-07T11:55:44.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13212" PostTypeId="1" CreationDate="2020-08-07T13:09:27.630" Score="3" ViewCount="78" Body="&lt;p&gt;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 &amp;quot;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&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;However, the authors only loosely describe potential applications of quantum sampling, viz. &amp;quot;inference and pattern recognition in machine learning&amp;quot;. Can anyone describe the utility of quantum sampling in further depth?&lt;/p&gt;&#xA;&lt;p&gt;[1] Mohseni, M., Read, P., Neven, H., Boixo, S., Denchev, V., Babbush, R., ... &amp;amp; Martinis, J. (2017). Commercialize quantum technologies in five years. Nature, 543(7644), 171-174.&lt;/p&gt;&#xA;" OwnerUserId="12878" LastEditorUserId="55" LastEditDate="2020-08-10T08:01:15.707" LastActivityDate="2020-08-10T08:01:15.707" Title="What are known applications of quantum sampling?" Tags="&lt;applications&gt;&lt;boson-sampling&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13213" PostTypeId="1" AcceptedAnswerId="13227" CreationDate="2020-08-07T13:41:20.577" Score="2" ViewCount="58" Body="&lt;p&gt;I am learning Q# so, as I often do, I am writing some unit tests to play with quantum gates.&#xA;I was able to write these tests for X gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    @Test(&amp;quot;QuantumSimulator&amp;quot;)&#xA;    operation XGateAppliedToZeroShouldTransformIntoOne() : Unit {&#xA;        &#xA;        using (q = Qubit()) {&#xA;            X(q);&#xA;            Assert([PauliZ], [q], One, &amp;quot;X gate transform |0&amp;gt; state in |1&amp;gt; state.&amp;quot;);&#xA;&#xA;            X(q);&#xA;            Assert([PauliZ], [q], Zero, &amp;quot;X gate transform |1&amp;gt; state in |0&amp;gt; state.&amp;quot;);&#xA;        }&#xA;        &#xA;        Message(&amp;quot;Test passed.&amp;quot;);&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12873" LastEditorUserId="55" LastEditDate="2020-08-08T18:34:44.670" LastActivityDate="2020-08-08T18:34:44.670" Title="Testing superposition states in Q#" Tags="&lt;programming&gt;&lt;q#&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13214" PostTypeId="2" ParentId="13213" CreationDate="2020-08-07T15:18:56.893" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$| + \rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |-\rangle$&lt;/span&gt; basis states (and, if you got &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; with high probability, you could assume &lt;span class=&quot;math-container&quot;&gt;$H |0\rangle \mapsto |+\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;In Q#, I don't believe this has yet been implemented. Some alternative approaches include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Measuring the qubit directly over many trials, expecting about a 50/50 probability of getting 0 or 1.&lt;/li&gt;&#xA;&lt;li&gt;If you have verified the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, you could perform &lt;span class=&quot;math-container&quot;&gt;$ HZH $&lt;/span&gt; and ensure it behaves like &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If you have verified the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, you could perform &lt;span class=&quot;math-container&quot;&gt;$HXH$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and ensure it always returns &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 :)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$ |0\rangle \mapsto \frac{1}{\sqrt{2}}(|0\rangle + e^{i\theta} |1\rangle)$&lt;/span&gt;). What do we do in that case? &lt;a href=&quot;https://www.nature.com/articles/s41567-019-0747-6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;One approach&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-07T15:18:56.893" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13215" PostTypeId="2" ParentId="13198" CreationDate="2020-08-07T18:49:55.953" Score="2" Body="&lt;p&gt;Fidelity is a distance measure between quantum states. The gate fidelity uses fidelity to decide how noisy a quantum gate is.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;See the discussion in Section 4 of &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0375960120302139&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastActivityDate="2020-08-07T18:49:55.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13216" PostTypeId="2" ParentId="13066" CreationDate="2020-08-07T18:54:16.210" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-07T18:54:16.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13217" PostTypeId="2" ParentId="13210" CreationDate="2020-08-07T22:32:26.567" Score="3" Body="&lt;p&gt;The SWAP operator has been widely used to ``linearize'' polynomial functions of the density matrix. To understand this carefully, consider the following setup: Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \mathcal{H}_{A} \otimes \mathcal{H}_{A'}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{A} \cong \mathcal{H}_{A'}$&lt;/span&gt;, that is, we take two copies of the Hilbert space. The SWAP operator acting on this doubled space is defined as,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{S} = \sum_{i, j}|i\rangle_{A}\langle j|\otimes| j\rangle_{A'}\langle i|.&#xA;$$&lt;/span&gt;&#xA;Why is this the SWAP operator? It's easy to see from its action on product states (which is to swap them): &lt;span class=&quot;math-container&quot;&gt;$| ij \rangle \overset{\hat{S}}{\mapsto} | ji \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, the simplest version of this linearization takes the form takes the form,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{Tr}\left( \rho^{2} \right) = \operatorname{Tr}\left( \hat{S} \rho \otimes \rho \right) . $$&lt;/span&gt;&#xA;(The proof is straightforward, just expand the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and apply the definition of the SWAP operator). A slight generalization of this is &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}\left( \rho \sigma \right) = \operatorname{Tr}\left( \hat{S} \rho \otimes \sigma \right)$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th order polynomial as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&#xA;is the cyclic shift operator (a generalization of the SWAP operator above).&lt;/p&gt;&#xA;&lt;p&gt;With regard to your questions: note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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 . $$&lt;/span&gt;&#xA;As an example, consider any mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}\left( \rho^{2} \right)$&lt;/span&gt;, also known as its &lt;a href=&quot;https://en.wikipedia.org/wiki/Purity_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;purity&lt;/a&gt; is (strictly) &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;1$&lt;/span&gt;, while it is normalized and therefore &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}\left( \rho \right) = 1$&lt;/span&gt; and so the RHS is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Hence, these two aren't equal.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}\left( \rho_{a}^{2} \rho_{b}^{2} \right)$&lt;/span&gt;. In particular, the SWAP doesn't preserve the trace (in the sense of the equation with the &lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt; above) and is being used as a linerization trick.&lt;/p&gt;&#xA;&lt;p&gt;Many useful tricks of this sort have been discussed in this (wonderful) paper: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0401067&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measuring polynomial functions of states&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-08-09T05:36:05.880" LastActivityDate="2020-08-09T05:36:05.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13218" PostTypeId="2" ParentId="13063" CreationDate="2020-08-07T22:53:07.463" Score="1" Body="&lt;p&gt;Given an arbitrary classical algorithm, you can trivially convert it into a &amp;quot;quantum algorithm&amp;quot; by simply making it into a &lt;a href=&quot;https://en.wikipedia.org/wiki/Reversible_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;reversible circuit&lt;/a&gt;. There are standard ways to do this.&lt;/p&gt;&#xA;&lt;p&gt;Of course, this doesn't really give you any &amp;quot;quantum advantage&amp;quot;. Any quantum algorithm obtained this way will have the same efficiency as the same algorithm run on classical computer.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-07T22:53:07.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13219" PostTypeId="2" ParentId="9222" CreationDate="2020-08-08T01:40:04.730" Score="1" Body="&lt;p&gt;&lt;strong&gt;CW from self-answer, and also because this is more of an extended comment than an answer.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; be the adjacency matrix of the Cayley graph of our group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; of order &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.  Notice that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is square-hermitian.  Further let &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_N$&lt;/span&gt; be the &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; identity matrix.&lt;/p&gt;&#xA;&lt;p&gt;It occurs to me that I am, in a sense, asking to prepare the ground state &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; - i.e. the uniform superposition over all elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; - by doing an initially very slow, very lazy random walk along &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That is, it feels like &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is adiabatically evolved, with an &amp;quot;initial Hamiltonian&amp;quot; being &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_N+\epsilon A$&lt;/span&gt; which acts on &lt;span class=&quot;math-container&quot;&gt;$\vert e\rangle$&lt;/span&gt;, and a &amp;quot;final Hamiltonian&amp;quot; being &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; itself.&lt;/p&gt;&#xA;&lt;p&gt;A defining paper on adiabatic state preparation appears to be &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301023&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aharanov and Ta-Shma&lt;/a&gt;.  I believe the speed at which one could prepare &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; by such an evolution is indeed given by spectral properties of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, or rather of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_N+\epsilon A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Post-selection may be a bit of a red-herring.  If post-selection doesn't work out one could just lower &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-08-08T01:40:04.730" CommentCount="0" CommunityOwnedDate="2020-08-08T01:40:04.730" ContentLicense="CC BY-SA 4.0" />
  <row Id="13220" PostTypeId="1" AcceptedAnswerId="13222" CreationDate="2020-08-08T03:45:48.800" Score="2" ViewCount="80" Body="&lt;p&gt;I'm trying to derive &lt;span class=&quot;math-container&quot;&gt;$P(\text{First qubit}=0) = \frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2$&lt;/span&gt; for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Swap_test&quot; rel=&quot;nofollow noreferrer&quot;&gt;swap test&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v9zXH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v9zXH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The wiki page shows one way, but the result should also be obtainable via direct expansion of the tensor products, as attempted &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12348/12643&quot;&gt;here&lt;/a&gt;. Present question is about bringing this process to completion as I — rather disappointingly — wasn't able to finish the proof myself.&lt;/p&gt;&#xA;&lt;p&gt;To summarize the thought process (adapted from &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12350/12643&quot;&gt;here&lt;/a&gt;), let's assume we start out with:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a \rangle = a_0 |0\rangle + a_1 |1\rangle \\&#xA;|b \rangle = b_0 |0\rangle + b_1 |1\rangle \\&#xA;|\phi_0 \rangle = |0 \rangle |a \rangle |b \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\phi_0\rangle$&lt;/span&gt;, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Applying the swap, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_2 \rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|b\rangle|a\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Applying the second H, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_3 \rangle = H|\phi_2\rangle = \\&#xA;\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 =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we want to calculate &lt;span class=&quot;math-container&quot;&gt;$P(\text{First qubit}=0)$&lt;/span&gt;, then the interesting quantity from &lt;span class=&quot;math-container&quot;&gt;$|\phi_3\rangle$&lt;/span&gt; is the first term of \eqref{1}:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}|0\rangle \left[|a\rangle|b\rangle + |b\rangle|a\rangle\right]&#xA;= \\&#xA;\frac{1}{2} \left[&#xA;2 a_0 b_0 |0,0\rangle&#xA;+ \left( a_0 b_1 + a_1 b_0 \right) |0,1\rangle&#xA;+ \left( a_0 b_1 + a_1 b_0 \right) |1,0\rangle&#xA;+ 2 a_1 b_1 |1,1\rangle&#xA;\right] =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a_0 b_0 |0,0\rangle&#xA;+ \frac{1}{2} \left( a_0 b_1 + a_1 b_0 \right) |0,1\rangle&#xA;+ \frac{1}{2} \left( a_0 b_1 + a_1 b_0 \right) |1,0\rangle&#xA;+ a_1 b_1 |1,1\rangle \tag{2}\label{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where I used:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a \rangle |b \rangle =&#xA;a_0 b_0 |0,0\rangle&#xA;+ a_0 b_1 |0,1\rangle&#xA;+ a_1 b_0 |1,0\rangle&#xA;+ a_1 b_1 |1,1\rangle&#xA;\\&#xA;|b \rangle |a \rangle =&#xA;a_0 b_0 |0,0\rangle&#xA;+ a_1 b_0 |0,1\rangle&#xA;+ a_0 b_1 |1,0\rangle&#xA;+ a_1 b_1 |1,1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Squaring the amplitudes from \eqref{2}, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a_0 b_0|^2&#xA;+ \frac{1}{4} | a_0 b_1 + a_1 b_0 |^2&#xA;+ \frac{1}{4} | a_0 b_1 + a_1 b_0 |^2&#xA;+ |a_1 b_1|^2 =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|a_0 b_0|^2&#xA;+ \frac{1}{2} | a_0 b_1 + a_1 b_0 |^2&#xA;+ |a_1 b_1|^2 \tag{3}\label{3}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to prove that \eqref{3} equals &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2$&lt;/span&gt; but I could not.&#xA;I tried using:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT: The following equations do not hold, as explained by C. Kang in the answers.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle a| b \rangle|^2 =&#xA;\langle a| b \rangle\langle a| b \rangle^\dagger =&#xA;\langle a| b \rangle\langle b| a \rangle =&#xA;\langle b| \langle a| b \rangle |a\rangle =&#xA;|a_0 b_0|^2 + |a_1 b_0|^2 + |a_0 b_1|^2 + |a_1 b_1|^2&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Substituting \eqref{4} into \eqref{3}, I got:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I'm not sure how to turn this into &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2$&lt;/span&gt;. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="12643" LastEditDate="2020-08-08T13:29:19.687" LastActivityDate="2020-08-08T13:29:19.687" Title="Alternative derivation of $P(\text{First qubit}=0)$ for the swap test" Tags="&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13222" PostTypeId="2" ParentId="13220" CreationDate="2020-08-08T05:05:01.860" Score="1" Body="&lt;p&gt;Welcome to the community Attila! I do not believe your equation 4 holds; consider the orthogonal vectors &lt;span class=&quot;math-container&quot;&gt;$ [\frac{i}{\sqrt{2}}, \frac{-i}{\sqrt{2}}]^T, [\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}]^T$&lt;/span&gt; - 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.&lt;/p&gt;&#xA;&lt;p&gt;The correct expansion for (4) would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | \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)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which, by distributivity of complex conjugation simplifies to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ (\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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's also rewrite (3). Again, we can use the trick for the norm squared:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, the entire (3) is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, recognize that &lt;span class=&quot;math-container&quot;&gt;$ |a_0 b_0|^2 + |a_0 b_1|^2 + |a_1 b_0|^2 + |a_1 b_1|^2 $&lt;/span&gt; is actually just 1! (As it's the amplitudes of &lt;span class=&quot;math-container&quot;&gt;$|a \rangle |b \rangle$&lt;/span&gt;). Thus, we yield:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2} (1 + | \langle a| b \rangle |^2 )$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As desired!&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-08T05:05:01.860" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13223" PostTypeId="2" ParentId="12147" CreationDate="2020-08-08T05:38:10.743" Score="1" Body="&lt;p&gt;This is somewhat late, but the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamiltonian_simulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; page has aggregated some of the main techniques for quantum Hamiltonian simulation.&lt;/p&gt;&#xA;&lt;p&gt;If you're looking for a bit more of a walkthrough (over scientific papers), Microsoft provides a &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/libraries/chemistry/concepts/algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;good overview&lt;/a&gt; of both Trotteriation / Qubitization. IBM also talks about &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQEs&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-08T05:38:10.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13224" PostTypeId="2" ParentId="13202" CreationDate="2020-08-08T07:14:15.267" Score="0" Body="&lt;p&gt;may be you can define a function like below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;def qubitinitialize(n,n_init):&#xA;#n = number of qubits&#xA;#n_init = initial state of each qubit&#xA;    qc = QuantumCircuit(n)&#xA;    for i in n_init:&#xA;        if i == 1:&#xA;            qc.x(i)&#xA;return(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This function will return a circuit with initial state as you provide in n_init&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n = 4  #number of qubits &#xA;n_init = [0,0,1,0] #a bit string of qubit initialization we need &#xA;qc_n = qubitinitialize(n,n_init)&#xA;qc_n.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;just remember that 0,1,2,3 in the bit string will convert to q3,q2,q1,q0&lt;/p&gt;&#xA;" OwnerUserId="12890" LastEditorUserId="12890" LastEditDate="2020-08-08T07:34:22.500" LastActivityDate="2020-08-08T07:34:22.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13226" PostTypeId="2" ParentId="13202" CreationDate="2020-08-08T09:47:58.553" Score="4" Body="&lt;p&gt;You can also create a &lt;code&gt;Statevector&lt;/code&gt;, that can be directly initialized as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Statevector&#xA;sv = Statevector.from_label('11')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can use &lt;code&gt;sv.evolve(qc)&lt;/code&gt; to apply an operator/circuit to the state, where &lt;code&gt;qc&lt;/code&gt; is the operator/circuit. &lt;code&gt;sv.data&lt;/code&gt; gives you the &lt;code&gt;numpy&lt;/code&gt; array, containing the actual implementation of the state.&lt;/p&gt;&#xA;&lt;p&gt;Check &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Statevector.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="12785" LastActivityDate="2020-08-08T09:47:58.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13227" PostTypeId="2" ParentId="13213" CreationDate="2020-08-08T17:24:12.743" Score="3" Body="&lt;p&gt;As @JSdJ indicated in their comment, one approach is to perform the assertion in the -basis instead of the -basis:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    open Microsoft.Quantum.Diagnostics;&#xA;&#xA;    @Test(&amp;quot;QuantumSimulator&amp;quot;)&#xA;    operation CheckThatHPreparesPlus() : Unit {        &#xA;        using (q = Qubit()) {&#xA;            within { H(q); }&#xA;            apply {&#xA;                AssertMeasurement([PauliZ], [q], Zero, &amp;quot;H operation did not prepare |+⟩, given input in |0⟩.&amp;quot;);&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Another approach would be to use the &lt;code&gt;AssertMeasurementProbability&lt;/code&gt; operation, which asserts that the probability of a given hypothetical measurement is equal to an expected probability:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    open Microsoft.Quantum.Diagnostics;&#xA;&#xA;    @Test(&amp;quot;QuantumSimulator&amp;quot;)&#xA;    operation CheckThatHPreparesPlus() : Unit {        &#xA;        using (q = Qubit()) {&#xA;            within { H(q); }&#xA;            apply {&#xA;                AssertMeasurementProbability(&#xA;                    [PauliZ], [q], Zero, 0.5,&#xA;                    &amp;quot;State prepared by H operation does not admit 50/50 measurement in  basis.&amp;quot;, 1e-8&#xA;                );&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;Zero&lt;/code&gt; when measured in the -basis.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/18/3/033024/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum tomography&lt;/a&gt; to be an interesting place to start!&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-08-08T17:24:12.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13228" PostTypeId="1" CreationDate="2020-08-08T17:32:59.823" Score="0" ViewCount="36" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6xd23.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6xd23.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;thank you&lt;/p&gt;&#xA;" OwnerUserId="11600" LastEditorUserId="55" LastEditDate="2020-08-08T18:35:34.240" LastActivityDate="2020-08-10T07:35:30.037" Title="provider.backends( ) not responding in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13229" PostTypeId="2" ParentId="13228" CreationDate="2020-08-08T19:23:23.193" Score="0" Body="&lt;p&gt;You need to load your IBMQ account first.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account(&amp;quot;your IBMQ credentials&amp;quot;)&#xA;provider = IBMQ.load_account()&#xA;provider.backends()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For more details on loading your IBMQ account checkout this &lt;a href=&quot;https://www.youtube.com/watch?v=M4EkW4VwhcI&amp;amp;list=PLOFEBzvs-Vvp2xg9-POLJhQwtVktlYGbY&amp;amp;index=2&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12785" LastActivityDate="2020-08-08T19:23:23.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13230" PostTypeId="1" AcceptedAnswerId="13236" CreationDate="2020-08-08T19:31:31.127" Score="2" ViewCount="82" Body="&lt;p&gt;Within the context of Grover's algorithm,  if there are  &lt;span class=&quot;math-container&quot;&gt;$N/4$&lt;/span&gt;  elements marked instead of just one (&lt;span class=&quot;math-container&quot;&gt;$N = 2^n$&lt;/span&gt;) , 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). &lt;/p&gt;&#xA;&lt;p&gt;I propose the following extension. &lt;/p&gt;&#xA;&lt;p&gt;The extension of Grover's algorithm. &lt;/p&gt;&#xA;&lt;p&gt;First iteration.  We use an oracle that marks  &lt;span class=&quot;math-container&quot;&gt;$2^{n-2} - 1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^{n-2}$&lt;/span&gt; marked states including  x*.&lt;/p&gt;&#xA;&lt;p&gt;Second iteration.  We use another oracle that marks  &lt;span class=&quot;math-container&quot;&gt;$2^{n-4}-1$&lt;/span&gt;  elements (from the  &lt;span class=&quot;math-container&quot;&gt;$2^{n-2}-1$&lt;/span&gt;  above) and x*. We run another Grover iteration and we end up with a superposition of &lt;span class=&quot;math-container&quot;&gt;$2^{n-4}$&lt;/span&gt;  marked states including x*.&lt;/p&gt;&#xA;&lt;p&gt;And so on..........&lt;/p&gt;&#xA;&lt;p&gt;At the k-th step we use an oracle that marks &lt;span class=&quot;math-container&quot;&gt;$ 2^{n-2k}-1$&lt;/span&gt;  elements and x* and we end up with a superposition of &#xA;&lt;span class=&quot;math-container&quot;&gt;$2^{n-2k}$&lt;/span&gt;  marked states, including x*.&lt;/p&gt;&#xA;&lt;p&gt;We continue this process for about  O(log N ) = O(n) steps. The difference is that at each iteration we use a different oracle.  &lt;/p&gt;&#xA;&lt;p&gt;At the end, when we measure we will find x* with high probability. &lt;/p&gt;&#xA;&lt;p&gt;If correct (big IF here ) this would be an exponential speedup compared to Grover.&lt;/p&gt;&#xA;&lt;p&gt;Question.  What am I missing  here? Is implementation possible?&lt;/p&gt;&#xA;" OwnerUserId="10110" LastActivityDate="2020-08-09T14:16:16.817" Title="Can we use different oracles for each (extended) Grover iteration?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13231" PostTypeId="2" ParentId="4829" CreationDate="2020-08-08T23:49:27.850" Score="1" Body="&lt;p&gt;Suppose we are given the (&lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; adjacency matrix &lt;span class=&quot;math-container&quot;&gt;$M_0$&lt;/span&gt; of graph &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; of graph &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;, and we wish to know whether &lt;span class=&quot;math-container&quot;&gt;$G_0\simeq G_1$&lt;/span&gt;.  It is a folklore result that if we can prepare states:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\alpha_G\rangle=\sum\limits_{\sigma\in S_n}\vert \sigma (G)\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$S_n$&lt;/span&gt; being the symmetric group on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; elements, we can prepare such a state for &lt;span class=&quot;math-container&quot;&gt;$G=G_0$&lt;/span&gt; and another for &lt;span class=&quot;math-container&quot;&gt;$G=G_1$&lt;/span&gt;, and run the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; test between them, to answer the graph isomorphism problem.&lt;/p&gt;&#xA;&lt;p&gt;Following the ideas of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301023&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aharonov and Ta-Shma&lt;/a&gt; we can propose a &amp;quot;quantum Zeno effect&amp;quot; preparation for such a state &lt;span class=&quot;math-container&quot;&gt;$\vert \alpha_G\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That is, Aharanov and Ta-Shma speak of adiabatic state preparation in terms of this &amp;quot;quantum Zeno effect.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Of course, although the quantum Zeno effect was discussed/envisioned by Turing, there is no other relation between the quantum Zeno effect and &amp;quot;Zeno&amp;quot; hypercomputation, as mentioned above.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-08-08T23:49:27.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13232" PostTypeId="2" ParentId="13202" CreationDate="2020-08-09T07:44:06.133" Score="0" Body="&lt;p&gt;Aer simulators will support what you're looking for very soon: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/pull/834&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/pull/834&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-08-09T07:44:06.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13233" PostTypeId="2" ParentId="13228" CreationDate="2020-08-09T12:17:58.947" Score="1" Body="&lt;p&gt;Well try doing this as it worked for me&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account(&amp;quot;your_API_id&amp;quot;, overwrite=True)&#xA;provider = IBMQ.load_account()&#xA;provider.backends()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12897" LastEditorUserId="9006" LastEditDate="2020-08-10T07:35:30.037" LastActivityDate="2020-08-10T07:35:30.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13234" PostTypeId="2" ParentId="13212" CreationDate="2020-08-09T12:24:14.403" Score="2" Body="&lt;p&gt;The two main classes of sampling problems demonstrating quantum supremacy are &lt;strong&gt;BosonSampling&lt;/strong&gt; and &lt;strong&gt;IQP&lt;/strong&gt; 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.&#xA;Recently the complexity of IQP sampling has been connected to the complexity of quantum algorithms for &lt;strong&gt;approximate optimization problems&lt;/strong&gt;, suggesting further applications of IQP and closely related classes.&lt;/p&gt;&#xA;&lt;p&gt;Applications of BosonSampling to molecular simulations, meteorology, and decision problems have been suggested, though more work is needed in this space.&lt;/p&gt;&#xA;&lt;p&gt;For more information see &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0018-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12897" LastEditorUserId="55" LastEditDate="2020-08-10T06:17:19.777" LastActivityDate="2020-08-10T06:17:19.777" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13235" PostTypeId="2" ParentId="13230" CreationDate="2020-08-09T12:28:33.173" Score="0" Body="&lt;p&gt;See this &lt;a href=&quot;https://www.youtube.com/watch?v=GliOLKa_EFo&amp;amp;list=PL74Rel4IAsETUwZS_Se_P-fSEyEVQwni7&amp;amp;index=54&quot; rel=&quot;nofollow noreferrer&quot;&gt;video&lt;/a&gt; here professor Vazirani explains why you cannot have less than &lt;code&gt;sqrt(N)&lt;/code&gt; steps if you want at least a constant probability.&lt;/p&gt;&#xA;" OwnerUserId="12897" LastActivityDate="2020-08-09T12:28:33.173" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13236" PostTypeId="2" ParentId="13230" CreationDate="2020-08-09T14:16:16.817" Score="4" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;What am I missing  here? Is implementation possible?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; then your diffusion operation is &lt;span class=&quot;math-container&quot;&gt;$I - 2|v\rangle\langle v|$&lt;/span&gt;. This operation is only cheap to implement when &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is simple. For example, typically &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; would be &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes n}$&lt;/span&gt; since you can implement &lt;span class=&quot;math-container&quot;&gt;$I - 2|+\rangle^{\otimes n}\langle +|^{\otimes n}$&lt;/span&gt; using a multi-controlled NOT with some Hadamards around it.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$\sum_{k | P_1(k)} |k\rangle$&lt;/span&gt;. The problem is that it is not cheap to implement &lt;span class=&quot;math-container&quot;&gt;$I - 2\sum_{k | P_1(k)} |k\rangle\langle k|$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;Basically, you're right that the &lt;em&gt;number&lt;/em&gt; of oracles calls is going to decrease exponentially as the algorithm progresses but the &lt;em&gt;cost of each call&lt;/em&gt; is going up exponentially. You end up not getting any benefit.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-09T14:16:16.817" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="13238" PostTypeId="1" AcceptedAnswerId="13249" CreationDate="2020-08-09T15:22:43.527" Score="2" ViewCount="142" Body="&lt;p&gt;This &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0105141&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; discusses strictly contractive channels, i.e. channels that strictly decrease the trace distance between any two input quantum states.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In light of this, how is it even possible to build any kind of fault-tolerant circuit which is capable of &amp;quot;arbitrarily long&amp;quot; computations, given that the standard noise model, the depolarizing channel, is strictly contractive?&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-08-13T08:28:34.467" LastActivityDate="2020-08-13T08:28:34.467" Title="How is it not a contradiction that it is possible to build fault tolerant circuits with strictly contractive (e.g.: depolarizing noise) channels?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;fault-tolerance&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13239" PostTypeId="2" ParentId="13097" CreationDate="2020-08-09T16:29:03.310" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Yet you can use the following idea to create operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Let's suppose that &lt;span class=&quot;math-container&quot;&gt;$a=11$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N=21$&lt;/span&gt;. &lt;code&gt;u&lt;/code&gt; is the matrix that corresponds to operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. By using &lt;code&gt;u&lt;/code&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and there is no need for order finding algorithm.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;u = np.zeros([32, 32], dtype = int) &#xA;&#xA;for i in range(21):&#xA;    u[11*i%21][i]=1&#xA;for i in range(21,32):&#xA;    u[i][i]=1&#xA;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-08-09T16:29:03.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13240" PostTypeId="2" ParentId="13238" CreationDate="2020-08-09T18:26:05.600" Score="0" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;Imagine the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E(\rho) = (1-p)I\rho I + p X_2\rho X_2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The overall state will now become a mixed state described by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{1}{2}[(1-p)(|00\rangle + |11\rangle)(\langle 00| + \langle 11|) + p(|01\rangle + |10\rangle)(\langle 01| + \langle 10|)].$$&lt;/span&gt;&#xA;This state is a mixed state with trace less than 1, since the error channel is non-unitary.&lt;/p&gt;&#xA;&lt;p&gt;When we measure the stabilizers XX and ZZ, we either get [+1, +1] with probability &lt;span class=&quot;math-container&quot;&gt;$1+p$&lt;/span&gt;, meaning that we have projected ourselves back into the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;, or with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; we get [+1, -1], meaning the state is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="3056" LastActivityDate="2020-08-09T18:26:05.600" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13241" PostTypeId="2" ParentId="13198" CreationDate="2020-08-10T06:11:48.870" Score="2" Body="&lt;p&gt;Very briefly, &lt;em&gt;gate fidelity&lt;/em&gt; refers to a way to compare how &amp;quot;close&amp;quot; two gates, or more generally operations, are to each other.&lt;/p&gt;&#xA;&lt;p&gt;As discussed &lt;em&gt;e.g.&lt;/em&gt; in (&lt;a href=&quot;https://arxiv.org/abs/0910.1315&quot; rel=&quot;nofollow noreferrer&quot;&gt;Magesan et al. 2012&lt;/a&gt;), if one wants to compare the action of an operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; and a gate &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; on a given state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, one can define their &amp;quot;&lt;em&gt;gate fidelity&lt;/em&gt;&amp;quot; as the quantum state fidelity between &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal U\rho\mathcal U^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A related notion is that of &lt;em&gt;average&lt;/em&gt; gate fidelity, which is defined as the above but averaging over all states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-10T06:11:48.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13242" PostTypeId="2" ParentId="13199" CreationDate="2020-08-10T07:54:48.770" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&lt;/a&gt;) So, yes there will be deviation and that will cause the measurement to change.&lt;/p&gt;&#xA;" OwnerUserId="12902" LastActivityDate="2020-08-10T07:54:48.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13243" PostTypeId="2" ParentId="13131" CreationDate="2020-08-10T09:55:03.463" Score="4" Body="&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/344cf552e190a4f68bee3643b0b563236b2919b0/qiskit/ignis/state_tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/ignis/verification/tomography/basis/circuits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;“This performs measurement in the Pauli-basis resulting in :math:`3^n circuits for an n-qubit state tomography experiment.”&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/344cf552e190a4f68bee3643b0b563236b2919b0/community/terra/qis_adv/Multi-Qubit_W_States_with_Tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;However, you may be interested by &lt;a href=&quot;https://www.nature.com/articles/s41567-020-0932-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;this recent paper&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and by its &lt;a href=&quot;https://phys.org/news/2020-07-method-properties-complex-quantum.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;presentation in Phys.org&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I quote from this presentation written by Ingrid Fadelli&lt;/p&gt;&#xA;&lt;p&gt;“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.”&lt;/p&gt;&#xA;&lt;p&gt;So, you are surely right in proposing that full tomography can be replaced by alternate methods using a lower number of measurements.&lt;/p&gt;&#xA;&lt;p&gt;For your last question about the 3^n bound, I see that JSdJ already answered to you.&lt;/p&gt;&#xA;" OwnerUserId="4600" LastEditorUserId="4600" LastEditDate="2020-08-10T20:58:20.260" LastActivityDate="2020-08-10T20:58:20.260" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13244" PostTypeId="1" CreationDate="2020-08-10T15:35:59.537" Score="3" ViewCount="123" Body="&lt;p&gt;I know the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state can relax spontaneously to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, but can the opposite also happen?&lt;/p&gt;&#xA;" OwnerUserId="12906" LastEditorUserId="9006" LastEditDate="2020-08-11T10:24:19.587" LastActivityDate="2020-08-11T10:24:19.587" Title="Is spontaneous excitation possible?" Tags="&lt;quantum-state&gt;&lt;noise&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13245" PostTypeId="2" ParentId="13244" CreationDate="2020-08-10T15:59:55.867" Score="5" Body="&lt;p&gt;As a first note: the (uncontrolled) transition of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is generally not referred to as &lt;em&gt;dephasing&lt;/em&gt; but as &lt;em&gt;relaxation&lt;/em&gt;. The noise-process that involves (spontaneous) relaxation is also called the &lt;em&gt;amplitude damping&lt;/em&gt; channel.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state spontaneously transitions to the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, something we call (spontaneous) &lt;em&gt;excitation&lt;/em&gt;. So yeah, if there is any energy in the system (i.e. de facto &lt;strong&gt;every&lt;/strong&gt; conceivable system), the reverse is also possible.&lt;/p&gt;&#xA;&lt;p&gt;If you're familiar with the math, you might want to check out the &lt;em&gt;generalized amplitude damping&lt;/em&gt; channel, for instance as introduced &lt;a href=&quot;https://arxiv.org/abs/1902.00967&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. It formalizes the above idea that, in addition of a small relaxation probability, there is also a (small) probability of a spontaneous excitation.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-08-10T15:59:55.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13247" PostTypeId="1" AcceptedAnswerId="13263" CreationDate="2020-08-10T16:27:54.910" Score="1" ViewCount="59" Body="&lt;p&gt;On page 566, it states that using &lt;span class=&quot;math-container&quot;&gt;$S(\rho^{'})-S(\rho,\varepsilon) \ge S(\rho)$&lt;/span&gt; and combining this with &lt;span class=&quot;math-container&quot;&gt;$S(\rho) \ge S(\rho^{'})-S(\rho,\varepsilon))$&lt;/span&gt;, we get &lt;span class=&quot;math-container&quot;&gt;$S(\rho^{'})=S(\rho)-S(\rho,\varepsilon)$&lt;/span&gt;. I can see no way in which this case holds, as by subbing this back in you'd end up getting either &lt;span class=&quot;math-container&quot;&gt;$S(\rho)-2S(\rho,\varepsilon) \ge S(\rho)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$S(\rho) \ge S(\rho)-2S(\rho,\varepsilon)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first inequality should never hold, with equality only when &lt;span class=&quot;math-container&quot;&gt;$S(\rho,\varepsilon)=0$&lt;/span&gt;, and the second should hold, but contradicts the first.&lt;/p&gt;&#xA;&lt;p&gt;This is meant to be a way to show the necessity of &lt;span class=&quot;math-container&quot;&gt;$S(\rho)=S(\rho^{'})-S(\rho,\varepsilon)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If feel like it should actually be &lt;span class=&quot;math-container&quot;&gt;$S(\rho^{'})=S(\rho)+S(\rho,\varepsilon))$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-08-24T09:26:48.403" LastActivityDate="2020-08-24T09:26:48.403" Title="Proof of quantum data processing inequality in N&amp;C on pg 566" Tags="&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13248" PostTypeId="1" AcceptedAnswerId="13256" CreationDate="2020-08-10T17:25:43.630" Score="2" ViewCount="48" Body="&lt;p&gt;I'm starting with Qiskit in Python.&lt;/p&gt;&#xA;&lt;p&gt;My question is regarding to have registers and sub-register. Something like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;axreg=QuantumRegister(4,name='ax')&#xA;ahreg=QuantumRegister(axreg[:2],name='ah')&#xA;alreg=QuantumRegister(axreg[2:],name='al')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="12893" LastActivityDate="2020-08-11T04:33:11.700" Title="Can a Qubit belong to 2 different registers?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13249" PostTypeId="2" ParentId="13238" CreationDate="2020-08-10T18:17:19.340" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;much&lt;/em&gt; less contractive - still contractive, but supressed exponentially.  The art of (quantum) error correction is to encode the information in those subspaces, and to &amp;quot;re-focus&amp;quot; it into those subspaces (which is the actual error correction procedure).&lt;/p&gt;&#xA;&lt;p&gt;Let me give a (slightly oversimplified) example.&lt;/p&gt;&#xA;&lt;p&gt;Consider a noise which flips a bit with probability &lt;span class=&quot;math-container&quot;&gt;$\epsilon=0.01$&lt;/span&gt; (per unit time, if you wish).&lt;/p&gt;&#xA;&lt;p&gt;Now encode a (classical) bit in &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; zeros or &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; ones, &lt;span class=&quot;math-container&quot;&gt;$0\cdots 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1\cdots 1$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\epsilon^{-N/2}$&lt;/span&gt; -- after all, you have to flip half the bits in either to get &lt;em&gt;any&lt;/em&gt; overlap between them (and if they are orthogonal, the trace distance stays 1).&lt;/p&gt;&#xA;&lt;p&gt;So what happened?  Before, the noise was &lt;span class=&quot;math-container&quot;&gt;$\epsilon=0.01$&lt;/span&gt;.  Now, the noise is &lt;span class=&quot;math-container&quot;&gt;$\epsilon=0.01^{-N/2}$&lt;/span&gt;.  So for &lt;span class=&quot;math-container&quot;&gt;$N=10$&lt;/span&gt;, you might be able to go about &lt;span class=&quot;math-container&quot;&gt;$10^{10}$&lt;/span&gt; time steps, rather than &lt;span class=&quot;math-container&quot;&gt;$100$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;re-focus&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; error in &lt;span class=&quot;math-container&quot;&gt;$10^{10}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(Note: Clearly, this is not a way to safely encode quantum information - this is not what this example is supposed to illustrate.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2020-08-10T20:33:50.230" LastActivityDate="2020-08-10T20:33:50.230" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13250" PostTypeId="1" CreationDate="2020-08-10T19:07:09.400" Score="1" ViewCount="56" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/1675/12908&quot;&gt;this answer&lt;/a&gt;, 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?&lt;/p&gt;&#xA;&lt;p&gt;I am particularly confused by how Alice decides what to post-select on. For example, if she wanted to teleport&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\ket}[1]{\lvert #1\rangle}\ket{-} = \frac{1}{\sqrt{2}}(\ket{0}-\ket{1})$$&lt;/span&gt;&#xA;then she could not post select on &lt;span class=&quot;math-container&quot;&gt;$\ket{00}$&lt;/span&gt; because the amplitude of this state in the first two qubits would be zero.&lt;/p&gt;&#xA;&lt;p&gt;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. &lt;strong&gt;This seems equivalent&lt;/strong&gt; to sending him the two classical bits in the usual quantum teleportation.&lt;/p&gt;&#xA;&lt;p&gt;What am I missing here?&lt;/p&gt;&#xA;" OwnerUserId="12908" LastEditorUserId="55" LastEditDate="2020-08-10T19:52:56.873" LastActivityDate="2020-08-10T19:52:56.873" Title="Post-selection applied to quantum teleportation" Tags="&lt;teleportation&gt;&lt;postselection&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13251" PostTypeId="1" CreationDate="2020-08-10T19:18:41.100" Score="3" ViewCount="116" Body="&lt;p&gt;There are two possibilities to prepare a qubit in a particular state like &lt;span class=&quot;math-container&quot;&gt;$ | - \rangle $&lt;/span&gt; in Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;The first approach is using the initialize function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1)&#xA;initial_state = [1/sqrt(2),-1/sqrt(2)]&#xA;qc.initialize(initial_state, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The second approach is using standard quantum gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;qc = QuantumCircuit(qreg_q, creg_c)&#xA;qc.x(qreg_q[0])&#xA;qc.h(qreg_q[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Are these two possibilities different? What is the &amp;quot;best practice&amp;quot; for preparing an arbitrary qubit state?&lt;/p&gt;&#xA;&lt;p&gt;Is there a comparable initialize function in Q#?&lt;/p&gt;&#xA;" OwnerUserId="12909" LastEditorUserId="55" LastEditDate="2020-08-14T06:23:36.537" LastActivityDate="2020-08-14T06:23:36.537" Title="What is the right way to prepare a specific qubit state in Qiskit / Q#?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13252" PostTypeId="2" ParentId="13251" CreationDate="2020-08-10T19:44:30.287" Score="1" Body="&lt;p&gt;&lt;em&gt;(Disclaimer: I don't know what's going on &amp;quot;under the hood&amp;quot; in Qiskit's &lt;code&gt;initialize&lt;/code&gt;, my answer is based on Q# part of the question, but I suspect it's something similar.)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s) and applying the necessary gates to transform the system to the necessary state.&lt;/p&gt;&#xA;&lt;p&gt;In Q#, the corresponding library operation is &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.preparation.preparearbitrarystate&quot; rel=&quot;nofollow noreferrer&quot;&gt;PrepareArbitraryState&lt;/a&gt; which takes an array of coefficients and prepares a quantum state with these coefficients. You can see that &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/master/Standard/src/Preparation/Arbitrary.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;under the hood&amp;quot;&lt;/a&gt; it compiles a sequence of gates necessary to prepare the state depending on the given coefficients and applies them to the qubits.&lt;/p&gt;&#xA;&lt;p&gt;To return to your original question, the options you're considering might end up being identical (if you have a simple state, &lt;code&gt;initialize&lt;/code&gt; will probably compile it to the same gates as the ones you've written out manually). The factors to consider are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/tree/master/Superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superposition quantum kata&lt;/a&gt; offers you to).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-08-10T19:44:30.287" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13253" PostTypeId="2" ParentId="13250" CreationDate="2020-08-10T19:48:36.700" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;time travel&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2020-08-10T19:48:36.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13254" PostTypeId="2" ParentId="13244" CreationDate="2020-08-10T20:18:02.153" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Spontaneous_emission&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spontaneous emission&lt;/a&gt; from an excited state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to ground state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is a well known phenomenon, but spontaneous excitation is not discussed as often, although &lt;a href=&quot;https://arxiv.org/abs/gr-qc/9408019&quot; rel=&quot;nofollow noreferrer&quot;&gt;there has been discussion about spontaneous excitation for accelerating qubits&lt;/a&gt;, along with its relation to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Unruh_effect&quot; rel=&quot;nofollow noreferrer&quot;&gt;Unruh effect&lt;/a&gt; which comes up when relativity is considered.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Keep in mind also that Wolfgang Ketterle's group has observed &lt;a href=&quot;https://en.wikipedia.org/wiki/Negative_temperature&quot; rel=&quot;nofollow noreferrer&quot;&gt;negative temperature&lt;/a&gt; at his lab, which means the opposite is true: &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is the preferred state and you would need to provide external energy to force the system to go from &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; except in the case of spontaneous emission, which at negative temperature would be the equivalent of spontaneous excitation.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-08-10T20:18:02.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13255" PostTypeId="1" AcceptedAnswerId="13260" CreationDate="2020-08-10T21:13:11.933" Score="3" ViewCount="67" Body="&lt;p&gt;The GHZ state is defined as &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{GHZ}\rangle = \frac{|000\rangle + |111\rangle}{\sqrt{2}}$&lt;/span&gt;. Is there a name for the phase flipped GHZ state, i.e. &lt;span class=&quot;math-container&quot;&gt;$Z_1(|\mathrm{GHZ}\rangle)=\frac{|000\rangle - |111\rangle}{\sqrt{2}}$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="4986" LastEditorUserId="8141" LastEditDate="2020-08-11T10:48:04.590" LastActivityDate="2020-08-11T10:48:04.590" Title="Is there a name for $Z_{1}(|\mathrm{GHZ}\rangle)$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13256" PostTypeId="2" ParentId="13248" CreationDate="2020-08-11T04:33:11.700" Score="1" Body="&lt;p&gt;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 |++&amp;gt; and we want to add them to our register which has for example 4 qubits, we can do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sub_circuit = QuantumCircuit(2)&#xA;circuit = QuantumCircuit(4)&#xA;qr = circuit.qregs[0]&#xA;circuit.x(range(4))&#xA;sub_circuit.h(range(2))&#xA;circuit = circuit.append(sub_circ.to_instruction(), [qr[0], qr[1]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You'll get something like this&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mgoYZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mgoYZ.png&quot; alt=&quot;picture of the final circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12897" LastActivityDate="2020-08-11T04:33:11.700" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13257" PostTypeId="1" CreationDate="2020-08-11T06:29:55.350" Score="2" ViewCount="121" Body="&lt;p&gt;It stated in Qiskit's &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html#Single-Qubit-Quantum-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This question arose after I accidentally called the U3 gate with parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;=&lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; in the program and Qiskit executed the program without error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;tetha = 2 * np.pi&#xA;qc.u3(theta, phi, lam, reg)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I checked other values out of bounds and every time it worked (including looping at a distance of &lt;span class=&quot;math-container&quot;&gt;$4\pi$&lt;/span&gt;) according to the formula for U from the documentation (judging by the resulting unitary operator) but ignoring violation of declared boundaries for &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, e.g:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(Operator(U3Gate(1.5 * np.pi, 0, 0)))&#xA;print(Operator(U3Gate(5.5 * np.pi, 0, 0)))&#xA;print(Operator(U3Gate(-.5 * np.pi, 0, 0)))&#xA;print(Operator(U3Gate(3.5 * np.pi, 0, 0)))&#xA;&#xA;Operator([[-0.70710678+0.j, -0.70710678+0.j],&#xA;          [ 0.70710678+0.j, -0.70710678+0.j]],&#xA;         input_dims=(2,), output_dims=(2,))&#xA;Operator([[-0.70710678+0.j, -0.70710678+0.j],&#xA;          [ 0.70710678+0.j, -0.70710678+0.j]],&#xA;         input_dims=(2,), output_dims=(2,))&#xA;Operator([[ 0.70710678+0.j,  0.70710678+0.j],&#xA;          [-0.70710678+0.j,  0.70710678+0.j]],&#xA;         input_dims=(2,), output_dims=(2,))&#xA;Operator([[ 0.70710678+0.j,  0.70710678+0.j],&#xA;          [-0.70710678+0.j,  0.70710678+0.j]],&#xA;         input_dims=(2,), output_dims=(2,))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But do &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; values outside the declared range make any real sense in quantum computing?&lt;/p&gt;&#xA;&lt;p&gt;Or is it just a little flaw in Qiskit?&lt;/p&gt;&#xA;&lt;p&gt;Just in case, the formula for the U3 gate is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U3}=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12416" LastEditorUserId="9006" LastEditDate="2020-08-11T10:09:08.980" LastActivityDate="2020-08-11T14:01:29.770" Title="Why is declared that $0 \le \theta \le \pi$ for Qiskit's U3 gate?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="13258" PostTypeId="1" CreationDate="2020-08-11T07:34:26.123" Score="1" ViewCount="69" Body="&lt;p&gt;Can someone please explan how the &lt;span class=&quot;math-container&quot;&gt;$\rm I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rm X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rm Z$&lt;/span&gt; gates work?&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rm{I = X^2 = Z^2}$&lt;/span&gt;, can you explain why this is the case or why it wouldn't work?&lt;/p&gt;&#xA;" OwnerUserId="12913" LastEditorUserId="9006" LastEditDate="2020-08-12T07:10:57.063" LastActivityDate="2020-08-12T07:10:57.063" Title="What are the I, X, Z gates in quantum gates?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ClosedDate="2020-08-12T18:34:42.477" ContentLicense="CC BY-SA 4.0" />
  <row Id="13259" PostTypeId="2" ParentId="13257" CreationDate="2020-08-11T08:41:44.970" Score="1" Body="&lt;p&gt;You use the mathematical  representation of the gate to generate something you can apply to your qubit. Nothing breaks if you input &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; higher that the range given. We can see this with some examples :&#xA;With &lt;span class=&quot;math-container&quot;&gt;$\theta = 0$&lt;/span&gt; and not thinking about the phase,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3 = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;With &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{2}$&lt;/span&gt; and not thinking about the phase,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3 = &#xA;\begin{pmatrix}&#xA;0.7071 &amp;amp; 0.7071 \\&#xA;0.7071 &amp;amp;  0.7071 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;With &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi$&lt;/span&gt; and not thinking about the phase,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3 = &#xA;\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp;  0 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;With &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{3\pi}{2}$&lt;/span&gt; and not thinking about the phase,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3 = &#xA;\begin{pmatrix}&#xA;-0.7071 &amp;amp; 0.7071 \\&#xA;0.7071 &amp;amp;  -0.7071 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;With &lt;span class=&quot;math-container&quot;&gt;$\theta = 2\pi$&lt;/span&gt; and not thinking about the phase,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U3 = &#xA;\begin{pmatrix}&#xA;-1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="8746" LastEditDate="2020-08-11T14:01:29.770" LastActivityDate="2020-08-11T14:01:29.770" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13260" PostTypeId="2" ParentId="13255" CreationDate="2020-08-11T09:01:00.390" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I'd like to add one more thing: it might even be a &lt;em&gt;bad&lt;/em&gt; idea to give that state (identified as &lt;span class=&quot;math-container&quot;&gt;$Z_{1}|\mathrm{GHZ}\rangle$&lt;/span&gt;) a specific name, because (as you may be well aware) &lt;span class=&quot;math-container&quot;&gt;$Z_{1}|\mathrm{GHZ}\rangle = Z_{2}|\mathrm{GHZ}\rangle = Z_{3}|\mathrm{GHZ}\rangle$&lt;/span&gt;. This could create some unwarranted ambiguity.&lt;/p&gt;&#xA;&lt;p&gt;If you identify the state as &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$&lt;/span&gt; you don't have this problem, of course.&lt;/p&gt;&#xA;&lt;p&gt;Also, it may be of interest to note that the &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{GHZ}\rangle$&lt;/span&gt; state (generalized to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits) is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0409201&quot; rel=&quot;nofollow noreferrer&quot;&gt;often used&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Now, this may be &lt;strong&gt;really&lt;/strong&gt; out of focus, but there's one other thing that might be of interest to you. You might now that the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{GHZ}$&lt;/span&gt; state is (up to local Cliffords) equivalent to a &lt;a href=&quot;https://en.wikipedia.org/wiki/Graph_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;graph state&lt;/a&gt;. Moreover, in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;this review paper&lt;/a&gt; they introduce (Eq. &lt;span class=&quot;math-container&quot;&gt;$(28)$&lt;/span&gt;, page &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt;) the set of states &lt;span class=&quot;math-container&quot;&gt;$\{|W\rangle = Z_{W}|G\rangle\}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|G\rangle$&lt;/span&gt; is a graph state. This set forms an orthonormal basis, and if the &lt;span class=&quot;math-container&quot;&gt;$|\mathrm{GHZ}\rangle$&lt;/span&gt; state were a graph state your state &lt;span class=&quot;math-container&quot;&gt;$Z_{1}|\mathrm{GHZ}\rangle$&lt;/span&gt; would be an element of this basis, namely &lt;span class=&quot;math-container&quot;&gt;$|W_{100}\rangle$&lt;/span&gt;. However, the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{GHZ}$&lt;/span&gt; state is only equivalent to a graph state, so it doesn't really work. (If it were to work, we would have &lt;span class=&quot;math-container&quot;&gt;$|W_{100}\rangle = |W_{010}\rangle = |W_{001}\rangle$&lt;/span&gt;, which is clearly not possible for a basis!)&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-08-11T10:11:51.407" LastActivityDate="2020-08-11T10:11:51.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13261" PostTypeId="2" ParentId="13258" CreationDate="2020-08-11T10:08:02.403" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is identity operator, which means that input state is not affected. In mathematical notation: &lt;span class=&quot;math-container&quot;&gt;$I|\psi\rangle = |\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator is a negation. It changes 0 to 1 and conversely, i.e. &lt;span class=&quot;math-container&quot;&gt;$X|0\rangle = |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X|1\rangle = |0\rangle$&lt;/span&gt;. If it is applied on a qubit in arbitrary superposition, i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;, the state changes to &lt;span class=&quot;math-container&quot;&gt;$X|\psi\rangle = \beta|0\rangle + \alpha|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator is a little bit more difficult to understand for beginners. The operator changes a phase of qubit. Consider for example state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;. This state is an equally distributed superposition of state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. When you apply &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator, you get a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;. This is also an equally distributed superpositon of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, however, the phase changed as you can see from minus sign before &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If it is applied on a qubit in arbitrary superposition, i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;, the state changes to &lt;span class=&quot;math-container&quot;&gt;$Z|\psi\rangle = \alpha|0\rangle - \beta|1\rangle$&lt;/span&gt;. Again, only the phase changes.&lt;/p&gt;&#xA;&lt;p&gt;An identity &lt;span class=&quot;math-container&quot;&gt;$I = X^2 = Z^2$&lt;/span&gt; can be easily verified by direct multiplication of matrix representations of the operators:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X = &#xA;\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-08-11T10:08:02.403" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13262" PostTypeId="2" ParentId="13244" CreationDate="2020-08-11T10:21:42.587" Score="2" Body="&lt;p&gt;I tried to prepare a two simple circuits on IBM Q (1 qubit Armonk processor). First one was composed only of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. So, when the gate was applied on state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, it changed to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. As you can see from the figure below, after measurement there is non-zero probability that the qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. This is a spontaneous relaxation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CHdrh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CHdrh.png&quot; alt=&quot;relaxation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you replaced gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; (or there is no gate at all), the qubit remains in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. However, after measurement, there is also non-zero probability that the qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This is a spontaneous excitation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TTZqh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TTZqh.png&quot; alt=&quot;excitation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, the spontaneous excitation does not occur as often as the relaxation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note that these results can be also influenced by read-out errors and imperfect gates.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-08-11T10:21:42.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13263" PostTypeId="2" ParentId="13247" CreationDate="2020-08-11T10:23:23.753" Score="3" Body="&lt;p&gt;Combining those two equations gives&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\rho')-S(\rho,\epsilon)\geq S(\rho)\geq S(\rho')-S(\rho,\epsilon)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and since the left and right hand sides are the same, the inequalities must be equalities, which indeed gives &lt;span class=&quot;math-container&quot;&gt;$S(\rho')=S(\rho)+S(\rho,\epsilon)$&lt;/span&gt;, or equivalently &lt;span class=&quot;math-container&quot;&gt;$S(\rho)=S(\rho')-S(\rho,\epsilon)$&lt;/span&gt;. It's quite possible this was a typo where they mixed up the &lt;span class=&quot;math-container&quot;&gt;$'$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-08-11T10:23:23.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13264" PostTypeId="1" CreationDate="2020-08-11T14:23:56.073" Score="8" ViewCount="158" Body="&lt;p&gt;There exists a nice way of preparing any superposition (with real amplitudes — this is the case I'm interested in) of states &lt;span class=&quot;math-container&quot;&gt;$\{\ldots0001\rangle,\,|\ldots0010\rangle,\,|\ldots0100\rangle,\ldots\}$&lt;/span&gt;, etc. This can be achieved with an &lt;span class=&quot;math-container&quot;&gt;$O(\log_2 n)$&lt;/span&gt;-depth circuit having &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; gates. To do so, one takes the circuit from Fig. 5 &lt;a href=&quot;https://arxiv.org/abs/1807.05572&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and replaces the &lt;span class=&quot;math-container&quot;&gt;$G(1/2)$&lt;/span&gt; gate with &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; rotations.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O\left({n}\choose{m}\right)$&lt;/span&gt; parametric gates. Would be cool if the depth could be made, similarly to the case above, significantly smaller than the number of gates.&lt;/p&gt;&#xA;&lt;p&gt;Please do not suggest the &lt;a href=&quot;https://arxiv.org/abs/1701.02691&quot; rel=&quot;nofollow noreferrer&quot;&gt;UCC ansatz&lt;/a&gt; :D&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the comments below, Mark S pointed out &lt;a href=&quot;https://arxiv.org/abs/1904.07358&quot; rel=&quot;nofollow noreferrer&quot;&gt;a paper&lt;/a&gt; in which the preparation of Dicke states is discussed. Those are the equal-weight superpositions of constant Hamming weight states. The circuit contains only &lt;span class=&quot;math-container&quot;&gt;$O(kn)$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-08-13T13:28:09.337" LastActivityDate="2020-08-13T13:56:47.687" Title="Preparing any superposition of fixed Hamming weight states" Tags="&lt;circuit-construction&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13265" PostTypeId="2" ParentId="13198" CreationDate="2020-08-11T15:17:47.157" Score="2" Body="&lt;p&gt;I find the above answers correct and sophisticated. My explanation would give you just a very general understanding.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The difference between an ideal gate (a logical gate) and what the corresponding physical gate that a quantum hardware offers is called gate infidelity.&lt;/p&gt;&#xA;" OwnerUserId="9318" LastActivityDate="2020-08-11T15:17:47.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13266" PostTypeId="1" AcceptedAnswerId="13270" CreationDate="2020-08-11T15:55:44.020" Score="0" ViewCount="509" Body="&lt;p&gt;I know I can make a &lt;code&gt;random_circuit&lt;/code&gt;, but I see that Qiskit has &lt;code&gt;random_statevector&lt;/code&gt;. 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!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="55" LastEditDate="2020-08-12T08:33:18.577" LastActivityDate="2020-08-12T15:04:51.710" Title="How to initialize a random state in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13267" PostTypeId="2" ParentId="11966" CreationDate="2020-08-11T20:38:58.137" Score="2" Body="&lt;p&gt;First try to sign-in into &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/&lt;/a&gt;, if not done already. There you will get to see one of IBM's free 15 qubit quantum machines named &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If successful, try adding the following snippet:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.get_provider('ibm-q')&#xA;qcomp = provider.get_backend('ibmq_16_melbourne')&#xA;job = execute(circuit, backend=qcomp)&#xA;from qiskit.tools.monitor import job_monitor&#xA;from qiskit.providers.ibmq.job import job_monitor&#xA;job_monitor(job)&#xA;result = job.result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to come up with a histogram, try:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.visualization import plot_histogram&#xA;plot_histogram(result.get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For more info, refer to this YouTube video on &lt;a href=&quot;https://www.youtube.com/watch?v=RrUTwq5jKM4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Hello World&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12918" LastActivityDate="2020-08-11T20:38:58.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13268" PostTypeId="1" AcceptedAnswerId="13275" CreationDate="2020-08-11T22:29:14.613" Score="2" ViewCount="161" Body="&lt;p&gt;Im trying to use IBM quantum machine instead of qiskit aer simulator with the following command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = IBMQ.get_backend('ibmq_16_melbourne', 'ibm-q')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It's giving me the following error:&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError    Traceback (most recent call last)&#xA;&#xA; &#xA; &amp;lt;ipython-input-22-39269ac2204d&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 backend = IBMQ.get_backend('ibmq_16_melbourne', 'ibm-q')&#xA;&#xA;AttributeError: 'IBMQFactory' object has no attribute 'get_backend'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What syntax I should try to submit the job to designated quantum machine?&lt;/p&gt;&#xA;" OwnerUserId="12920" LastEditorUserId="55" LastEditDate="2020-08-12T08:32:59.537" LastActivityDate="2020-08-12T08:32:59.537" Title="Qiskit error on get_backend()" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13269" PostTypeId="2" ParentId="13268" CreationDate="2020-08-11T23:48:25.630" Score="2" Body="&lt;p&gt;you should get_provider first.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or you can simply use simulator:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer&#xA;simulator = Aer.get_backend('qasm_simulator')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12921" LastActivityDate="2020-08-11T23:48:25.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13270" PostTypeId="2" ParentId="13266" CreationDate="2020-08-12T00:27:00.347" Score="3" Body="&lt;p&gt;here is an example of how to initialize the random statevector then send it to the quantum circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import random_statevector, Statevector&#xA;from qiskit import QuantumCircuit&#xA;# import numpy as np&#xA;&#xA;vec = random_statevector(2)&#xA;# vec = Statevector([1, 0])&#xA;print('before circuit: {}'.format(vec)) &#xA;&#xA;qc = QuantumCircuit(1)&#xA;qc.x(0)&#xA;qc.draw()&#xA;&#xA;new_vec = vec.evolve(qc)&#xA;print('after circuit: {}'.format(new_vec))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;you should notice that the dim of state vector is 2 so the quantum circuit is 1 qubit.&lt;/p&gt;&#xA;" OwnerUserId="12922" LastEditorUserId="12922" LastEditDate="2020-08-12T00:46:24.790" LastActivityDate="2020-08-12T00:46:24.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13272" PostTypeId="1" CreationDate="2020-08-12T03:25:51.103" Score="5" ViewCount="147" Body="&lt;p&gt;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 &amp;quot;TICKER&amp;quot; and &amp;quot;RandomDataProvider&amp;quot; parts of the code in order to generate a real-life portfolio.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Generate expected return and covariance matrix from (random) time-series&#xA;stocks = [(&amp;quot;TICKER%s&amp;quot; % i) for i in range(num_assets)]&#xA;data = RandomDataProvider(tickers=stocks,&#xA;                 start=datetime.datetime(2016,1,1),&#xA;                 end=datetime.datetime(2016,1,30))&#xA;data.run()&#xA;mu = data.get_period_return_mean_vector()&#xA;sigma = data.get_period_return_covariance_matrix()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I've imported Quandl and WikipediaDataProvider. I want to keep the number of assets the same, using Microsoft &amp;quot;MSFT&amp;quot;, Disney &amp;quot;DIS&amp;quot;, Nike &amp;quot;NKE&amp;quot;, and Home Depot &amp;quot;HD&amp;quot; stocks.  How might I apply this financial from Quandl to the tutorial? I've tried this so far:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;num_assets = 4&#xA;&#xA;# Generate expected return and covariance matrix from (random) time-series&#xA;stocks = [(&amp;quot;MSFT%s&amp;quot; , &amp;quot;DIS%s&amp;quot; , &amp;quot;NKE%s&amp;quot; , &amp;quot;HD%s&amp;quot; % i) for i in range(num_assets)]&#xA;data = WikipediaDataProvider(tickers=stocks,&#xA;                 token=&amp;quot;xeesvko2fu6Bt9jg-B1T&amp;quot;,&#xA;                 start=datetime.datetime(2016,1,1),&#xA;                 end=datetime.datetime(2016,1,30))&#xA;data.run()&#xA;mu = data.get_period_return_mean_vector()&#xA;sigma = data.get_period_return_covariance_matrix()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But get the error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;TypeError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-59-19e4d9cde1e3&amp;gt; in &amp;lt;module&amp;gt;&#xA;      3 # Generate expected return and covariance matrix from (random) time-series&#xA;      4 stocks = [(&amp;quot;MSFT%s&amp;quot; , &amp;quot;DIS%s&amp;quot; , &amp;quot;NKE%s&amp;quot; , &amp;quot;HD%s&amp;quot; % i) for i in range(num_assets)]&#xA;----&amp;gt; 5 data = WikipediaDataProvider(tickers=stocks,&#xA;      6                  token=&amp;quot;xeesvko2fu6Bt9jg-B1T&amp;quot;,&#xA;      7                  start=datetime.datetime(2016,1,1),&#xA;&#xA;TypeError: Can't instantiate abstract class WikipediaDataProvider with abstract methods run&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I apologize for my limited coding skills - I'm very new to all of this! Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="12924" LastEditorUserId="55" LastEditDate="2020-08-12T08:33:36.513" LastActivityDate="2020-08-12T22:59:30.333" Title="Qiskit Portfolio Optimization Application" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;optimization&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13273" PostTypeId="1" AcceptedAnswerId="13284" CreationDate="2020-08-12T06:32:46.813" Score="3" ViewCount="227" Body="&lt;p&gt;I can see in example code of qiskit, to implement job monitors on IBM Quantum machines, example uses any of the following&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.monitor import job_monitor&#xA;from qiskit.providers.ibmq.job import job_monitor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have downloaded qiskit in my laptop and used both of them. Could not see any differences.&lt;/p&gt;&#xA;&lt;p&gt;What is the difference between them? Does the invocation vary depending on the Quantum machine on which job is being executed?&lt;/p&gt;&#xA;" OwnerUserId="12925" LastEditorUserId="55" LastEditDate="2020-08-12T08:33:09.823" LastActivityDate="2020-08-12T14:55:06.570" Title="Existence of multiple job monitor in qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13274" PostTypeId="2" ParentId="10174" CreationDate="2020-08-12T06:50:20.827" Score="0" Body="&lt;p&gt;To change the endianness of a circuit in Qiskit you can use the &lt;code&gt;reverse_bits&lt;/code&gt; method of the &lt;code&gt;QuantumCircuit&lt;/code&gt;. To do so for the QFT you can pick the QFT from the circuit library, reverse it, and add it to your circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit.library import QFT&#xA;&#xA;iqft = QFT(3, inverse=True)  # get the IQFT&#xA;reversed_bits_QFT = iqft.reverse_bits()  # reverse bit order&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;circuit.compose(reversed_bits_QFT, inplace=True)  # append your QFT &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-08-12T06:50:20.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13275" PostTypeId="2" ParentId="13268" CreationDate="2020-08-12T07:33:02.200" Score="1" Body="&lt;p&gt;First of all, check this &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; if you have access to any additional quantum machine.&lt;/p&gt;&#xA;&lt;p&gt;By default, as a basic user, you would be having access to &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; as a 15 qubit machine.&lt;/p&gt;&#xA;&lt;p&gt;Keep in mind that these real-time machines still have certain error factors which get included due to quantum mechanics limitations.&lt;/p&gt;&#xA;&lt;p&gt;If you want an error-free simulation(not on actual hardware), use QASM(quantum assembly language) simulator from &lt;code&gt;qiskit Aer&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Talking about your query, it seems like you are using an older syntax of submitting jobs to IBM quantum machines.&#xA;Check out this &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; for better understanding.&lt;/p&gt;&#xA;&lt;p&gt;Just try the following replacing your line:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.get_provider('ibm-q')&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let me know if you still face any issue.&lt;/p&gt;&#xA;" OwnerUserId="12918" LastActivityDate="2020-08-12T07:33:02.200" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13276" PostTypeId="2" ParentId="13273" CreationDate="2020-08-12T07:47:11.353" Score="1" Body="&lt;p&gt;briefly, no big difference.&lt;/p&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;ibmq version:&#xA;&lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;tools version:&#xA;&lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="12921" LastEditorUserId="12921" LastEditDate="2020-08-12T07:58:08.357" LastActivityDate="2020-08-12T07:58:08.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13277" PostTypeId="1" CreationDate="2020-08-12T08:04:14.120" Score="1" ViewCount="44" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/1510.06750.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, while using a diagonalization argument in Section &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;, the authors write:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Fix some enumeration over all &lt;span class=&quot;math-container&quot;&gt;$poly(n)$&lt;/span&gt;-size quantum verifiers &lt;span class=&quot;math-container&quot;&gt;$M_{1},&#xA; M_{2},...$&lt;/span&gt; which we can do because the number of such machines is&#xA;countably infinite (by the Solovay-Kitaev theorem [15]). Some of these&#xA;verifiers may try to decide a language by trivially “hardwiring” its&#xA;outputs; for example, by returning 1 independent of the input. We&#xA;start by fixing a unary language &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; such that no machine &lt;span class=&quot;math-container&quot;&gt;$M_{i}$&lt;/span&gt; hardwires&#xA;the language. We can always do this because there are more languages&#xA;than &lt;span class=&quot;math-container&quot;&gt;$poly(n)$&lt;/span&gt;-sized machines.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Maybe I am missing something very basic, but:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why do we care if some of the verifiers have the output hardwired?&lt;/li&gt;&#xA;&lt;li&gt;How can we find an &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;, like in the description? Why will this &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; even be decidable? I know there are more languages than there are Turing machines; but those extra languages aren't decidable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2020-09-11T16:01:01.443" Title="Hardwiring the output in black box separation" Tags="&lt;complexity-theory&gt;&lt;quantum-turing-machine&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13278" PostTypeId="2" ParentId="13273" CreationDate="2020-08-12T10:02:20.867" Score="1" Body="&lt;p&gt;They are different depending on the qiskit version.&lt;/p&gt;&#xA;&lt;p&gt;Check qiskit version using:&#xA;qiskit.&lt;strong&gt;qiskit_version&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have installed latest qiskit which gives:&#xA;{'qiskit-terra': '0.14.2',&#xA;'qiskit-aer': '0.5.2',&#xA;'qiskit-ignis': '0.3.3',&#xA;'qiskit-ibmq-provider': '0.7.2',&#xA;'qiskit-aqua': '0.7.3',&#xA;'qiskit': '0.19.6'}&lt;/p&gt;&#xA;&lt;p&gt;Check your respective version.&lt;/p&gt;&#xA;" OwnerUserId="12926" LastActivityDate="2020-08-12T10:02:20.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13279" PostTypeId="1" CreationDate="2020-08-12T11:45:15.207" Score="2" ViewCount="38" Body="&lt;p&gt;When I try QSVM over Iris data, it needs multiclass extension, but when I provide it, a following error is returned:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-18-86cd4e7dd846&amp;gt; in &amp;lt;module&amp;gt;&#xA;      2 &#xA;      3 feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement='linear')&#xA;----&amp;gt; 4 qsvm = QSVM(feature_map, training_input, test_input, multiclass_extension=AllPairs)&#xA;&#xA;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)&#xA;    148         else:&#xA;    149             multiclass_extension.set_estimator(_QSVM_Estimator, [feature_map])&#xA;--&amp;gt; 150             qsvm_instance = _QSVM_Multiclass(self, multiclass_extension)&#xA;    151 &#xA;    152         self.instance = qsvm_instance&#xA;&#xA;d:\anaconda\envs\ai\lib\site-packages\qiskit\aqua\algorithms\classifiers\qsvm\_qsvm_multiclass.py in __init__(self, qalgo, multiclass_classifier)&#xA;     37         super().__init__(qalgo)&#xA;     38         self.multiclass_classifier = multiclass_classifier&#xA;---&amp;gt; 39         self.multiclass_classifier.params.append(qalgo)&#xA;     40 &#xA;     41     def train(self, data, labels):&#xA;&#xA;AttributeError: type object 'AllPairs' has no attribute 'params'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The code is :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;seed = 10598&#xA;&#xA;feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement='linear')&#xA;qsvm = QSVM(feature_map, training_input, test_input, multiclass_extension=AllPairs)&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12929" LastEditorUserId="9006" LastEditDate="2020-08-13T07:19:49.463" LastActivityDate="2020-09-12T08:00:10.070" Title="Type object 'AllPairs' has no attribute 'params'" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13280" PostTypeId="1" CreationDate="2020-08-12T12:29:17.343" Score="3" ViewCount="31" Body="&lt;p&gt;I'm reading about cluster states using &lt;a href=&quot;http://kodu.ut.ee/%7Egelonoel/notes/clusterStateQC.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; online source. It is explained that a CNOT can be performed on cluster states using as little as &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits. However, the standard implementation is with &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; qubits. Why is that the case?&lt;/p&gt;&#xA;&lt;p&gt;Is it also possible with any number of qubits beyond &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;? So can I implement a CNOT in a cluster state with &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; qubits for instance, and if yes, how?&lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="55" LastEditDate="2020-08-14T06:10:22.183" LastActivityDate="2020-08-14T06:10:22.183" Title="Limitations on the number of qubits for a $\mathrm{CNOT}$-gate in cluster states" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;cluster-states&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13281" PostTypeId="2" ParentId="11606" CreationDate="2020-08-12T12:54:30.500" Score="1" Body="&lt;p&gt;I have just realized that web interface of IBM Q was updated and custom gates, i.e.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gate ccu1 ( p ) c1, c2, t  {&#xA;  cu1 ( p / 2 ) c1, c2;&#xA;  cx c2, t;&#xA;  cu1 ( - p / 2 ) c1, t;&#xA;  cx c2, t;&#xA;  cu1 ( p / 2 ) c1, t;&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;is correctly transpiled to gates used in the custom gate and subsequently to basic gate set used on IBM Q.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Overall, custom gate functionality is now available in QASM&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-08-12T12:54:30.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13282" PostTypeId="1" AcceptedAnswerId="13283" CreationDate="2020-08-12T13:30:18.223" Score="1" ViewCount="388" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12915" LastEditorUserId="55" LastEditDate="2020-08-14T06:14:12.447" LastActivityDate="2020-11-09T17:49:11.927" Title="How are eigenvectors and eigenvalues expressed in the Bloch sphere?" Tags="&lt;mathematics&gt;&lt;bloch-sphere&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13283" PostTypeId="2" ParentId="13282" CreationDate="2020-08-12T14:04:53.933" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; different on the Bloch sphere, i.e. opposite directions along the same axis.)&lt;/p&gt;&#xA;&lt;p&gt;The eigenvalue (or, more precisely, the relative angle between the two eigenvalues) is the angle of rotation around that axis.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-12T14:04:53.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13284" PostTypeId="2" ParentId="13273" CreationDate="2020-08-12T14:55:06.570" Score="1" Body="&lt;p&gt;They both are (almost) identical:&#xA;&lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html&lt;/a&gt;&#xA;&lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The only difference is that &lt;code&gt;qiskit.tools.monitor.job_monitor()&lt;/code&gt; have a argument named &lt;code&gt;quiet&lt;/code&gt;, which is set to &lt;code&gt;false&lt;/code&gt; by default:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_monitor(job, interval=None, quiet=False, output=sys.stdout)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If we set to to &lt;code&gt;true&lt;/code&gt;, it will not print any status message.&lt;/p&gt;&#xA;&lt;p&gt;As a best practice, you can use &lt;code&gt;help()&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;p&gt;If we import the first version:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.monitor import job_monitor&#xA;help(job_monitor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Corrosponding output shows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Help on function job_monitor in module qiskit.tools.monitor.job_monitor:&#xA;&#xA;job_monitor(job, interval=None, quiet=False, output=&amp;lt;ipykernel.iostream.OutStream object at 0x7fa9383ff7c0&amp;gt;)&#xA;    Monitor the status of a IBMQJob instance.&#xA;&#xA;    Args:&#xA;        job (BaseJob): Job to monitor.&#xA;        interval (int): Time interval between status queries.&#xA;        quiet (bool): If True, do not print status messages.&#xA;        output (file): The file like object to write status messages to.&#xA;        By default this is sys.stdout.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, if we import the second version:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.ibmq.job import job_monitor&#xA;help(job_monitor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Corrosponding output shows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Help on function job_monitor in module qiskit.providers.ibmq.job.job_monitor:&#xA;&#xA;job_monitor(job: qiskit.providers.ibmq.job.ibmqjob.IBMQJob, interval: Union[float, NoneType] = None, output: &amp;lt;class 'TextIO'&amp;gt; = &amp;lt;ipykernel.iostream.OutStream object at 0x7fa9383ff7c0&amp;gt;) -&amp;gt; None&#xA;    Monitor the status of an ``IBMQJob`` instance.&#xA;&#xA;    Args:&#xA;        job: Job to monitor.&#xA;        interval: Time interval between status queries.&#xA;        output: The file like object to write status messages to.&#xA;            By default this is sys.stdout.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12918" LastActivityDate="2020-08-12T14:55:06.570" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13285" PostTypeId="2" ParentId="13282" CreationDate="2020-08-12T14:56:34.517" Score="0" Body="&lt;p&gt;A state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with Bloch sphere coordinates &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{\boldsymbol{#1}}\bs r\equiv (x,y,z)$&lt;/span&gt; has the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{I + \bs r\cdot\bs \sigma}{2}\equiv \frac{I+x\sigma_x + y \sigma_y + z\sigma_z}{2}, $$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\sigma_x,\sigma_y,\sigma_z$&lt;/span&gt; the Pauli matrices.&lt;/p&gt;&#xA;&lt;p&gt;Computing the eigenvalues (eigenvectors) of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; thus amounts to computing those of &lt;span class=&quot;math-container&quot;&gt;$\bs r\cdot\bs\sigma$&lt;/span&gt;. Observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\bs r\cdot\bs \sigma=\begin{pmatrix}z &amp;amp; x-iy \\ x+iy &amp;amp; -z,\end{pmatrix}$$&lt;/span&gt;&#xA;and thus the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\lambda_\pm = \pm\sqrt{-\det(\bs r\cdot\bs \sigma)}=\pm\|\bs r\|$&lt;/span&gt;. The corresponding eigenvectors are then seen to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lvert\lambda_\pm\rangle = \frac{1}{\sqrt{2\|\bs r\|(\|\bs r\|\mp z)}}\begin{pmatrix}x-iy \\ \pm \|\bs r\| - z\end{pmatrix}.$$&lt;/span&gt;&#xA;The vectors in the Bloch sphere corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lvert\lambda_\pm\rangle$&lt;/span&gt; have coordinates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{cases}&#xA;x_\pm &amp;amp;=&amp;amp; \pm x/ \|\bs r\|, \\&#xA;y_\pm &amp;amp;=&amp;amp; \pm y/ \|\bs r\|, \\&#xA;z_\pm &amp;amp;=&amp;amp; \pm z/ \|\bs r\|.&#xA;\end{cases}$$&lt;/span&gt;&#xA;In other words, the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\bs r\cdot\bs\sigma$&lt;/span&gt; correspond to the two unit vectors in the Bloch sphere along the same direction as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are then clearly the same as those of &lt;span class=&quot;math-container&quot;&gt;$\bs r\cdot\bs \sigma$&lt;/span&gt;, while its eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$(1\pm\lambda_\pm)/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-12T15:16:04.303" LastActivityDate="2020-08-12T15:16:04.303" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13286" PostTypeId="2" ParentId="13266" CreationDate="2020-08-12T15:04:51.710" Score="2" Body="&lt;p&gt;How about using the data attribute, like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1)   &#xA;initial_state = qc.initialize(random_statevector(2).data, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12932" LastActivityDate="2020-08-12T15:04:51.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13287" PostTypeId="2" ParentId="13280" CreationDate="2020-08-12T15:42:15.337" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; measurement on those qubits. It's kind of a cheat, which you perhaps didn't intend....&lt;/p&gt;&#xA;&lt;p&gt;I think the reason for the &amp;quot;standard&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-12T15:42:15.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13288" PostTypeId="2" ParentId="13279" CreationDate="2020-08-12T16:25:39.390" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/machine_learning/qsvm_multiclass.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/machine_learning/qsvm_multiclass.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2020-08-12T16:25:39.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13289" PostTypeId="1" CreationDate="2020-08-12T17:12:40.273" Score="4" ViewCount="127" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13071/making-custom-gate-in-qiskit&quot;&gt;Here&lt;/a&gt; it is explained how to define a custom non-parametric gate in Qiskit. How do I define a new parametric gate?&lt;/p&gt;&#xA;&lt;p&gt;For example, I want to have the &lt;span class=&quot;math-container&quot;&gt;$CCR_y$&lt;/span&gt; gate defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p7Vkt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p7Vkt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;in order to use it as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.ccry(theta, c1, c2, targ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-08-14T06:14:20.583" LastActivityDate="2020-08-14T06:14:20.583" Title="Defining a custom parametric gate in Qiskit in terms of standard gates?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13290" PostTypeId="2" ParentId="13195" CreationDate="2020-08-12T19:07:34.510" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;it should be clear that the core of the Grover algorithm includes 3 steps&lt;/p&gt;&#xA;&lt;p&gt;a) prepare initial state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;b) apply &lt;span class=&quot;math-container&quot;&gt;$U=1-2|\omega\rangle\langle \omega|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;c) apply &lt;span class=&quot;math-container&quot;&gt;$D=2|s\rangle\langle s|-1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then repeat step b and c&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the original Grover algorithm,  the diffusion operator is fixed as &lt;span class=&quot;math-container&quot;&gt;$D=2|s\rangle\langle s|-1$&lt;/span&gt;, which you can say it depends upon the initial state. Actually in the image of &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit textbook&lt;/a&gt;, you can see the initial state is &lt;span class=&quot;math-container&quot;&gt;$|s\rangle=H^{\otimes n}|0\rangle^{n}$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NhWjk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NhWjk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the paper your reference, it extends the Grover algorithm, especially extends the diffusion operator from &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; (named as &lt;span class=&quot;math-container&quot;&gt;$\left|S_{1}\right\rangle$&lt;/span&gt;) to another 15 states &lt;span class=&quot;math-container&quot;&gt;$\left|S_{j}\right\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For the equation you mentioned in the case of &lt;span class=&quot;math-container&quot;&gt;$j = 2$&lt;/span&gt;, the detail derivation is as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/n2ZT6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n2ZT6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;the tensor product formula can learn from &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html#single-qubit-gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12921" LastActivityDate="2020-08-12T19:07:34.510" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13291" PostTypeId="1" CreationDate="2020-08-12T19:51:12.293" Score="11" ViewCount="155" Body="&lt;p&gt;If one generates an &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; Haar random unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then clearly &lt;span class=&quot;math-container&quot;&gt;$\Pr(U=I)=0$&lt;/span&gt;. However, for every &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;, the probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Pr(\|U-I\|_{\rm op}&amp;lt;\varepsilon)$$&lt;/span&gt;&#xA;should be positive.&#xA;How can this quantity be computed?&lt;/p&gt;&#xA;" OwnerUserId="12167" LastEditorUserId="55" LastEditDate="2021-04-30T08:11:02.793" LastActivityDate="2021-04-30T08:11:02.793" Title="What is the probability $\Pr(\|U-I\|_{\rm op}&lt;\varepsilon)$ of a Haar-random unitary being close to the identity?" Tags="&lt;mathematics&gt;&lt;unitarity&gt;&lt;probability&gt;&lt;haar-distribution&gt;" AnswerCount="0" CommentCount="10" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13292" PostTypeId="2" ParentId="13272" CreationDate="2020-08-12T22:59:30.333" Score="3" Body="&lt;p&gt;I changed the stock parameter to a list of strings and added the line &lt;code&gt;stockmarket = StockMarket.NASDAQ&lt;/code&gt; as such:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;num_assets = 4&#xA;&#xA;# Generate expected return and covariance matrix from (random) time-series&#xA;stocks = ['MSFT', 'DIS', 'NKE', 'HD']&#xA;data = WikipediaDataProvider(&#xA;                             token=&amp;quot;xeesvko2fu6Bt9jg-B1T&amp;quot;,&#xA;                             tickers = stocks,&#xA;                             stockmarket = StockMarket.NASDAQ,&#xA;                             start=datetime.datetime(2016,1,1),&#xA;                             end=datetime.datetime(2016,1,30))&#xA;data.run()&#xA;mu = data.get_period_return_mean_vector()&#xA;sigma = data.get_period_return_covariance_matrix()&#xA;print(mu)&#xA;print(sigma)&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12924" LastActivityDate="2020-08-12T22:59:30.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13293" PostTypeId="1" CreationDate="2020-08-13T00:29:40.530" Score="2" ViewCount="34" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Also are there other frameworks that can do this?&lt;/p&gt;&#xA;" OwnerUserId="12934" LastEditorUserId="55" LastEditDate="2020-08-14T06:01:01.043" LastActivityDate="2020-08-14T06:01:01.043" Title="Simulating a Quantum Network over a real Classical Network Using Simulaqron" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;communication&gt;&lt;quantum-networks&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13294" PostTypeId="2" ParentId="12354" CreationDate="2020-08-13T02:57:34.160" Score="0" Body="&lt;p&gt;I rechecked the small &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; QFT for unitarity and it doesn't work. The off diagonal terms fail to cancel when input and output bases differ by multiples of &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;. However, the superposition only depends on the value of the first QFT &lt;span class=&quot;math-container&quot;&gt;$\mod w$&lt;/span&gt;. A prime-factor QFT can be factored if its basis is the product of two relatively prime numbers as described at&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Prime-factor_FFT_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Prime-factor_FFT_algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, the non-base &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; part can be summed out and the QFT can be simplified to a base &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; QFT. So if you assume &lt;span class=&quot;math-container&quot;&gt;$N=Lw$&lt;/span&gt;, the input and output indices can be rewritten as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n = n_1L+n_2w$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k = k_1 L' L + k_2 w' w  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$L' = L^{-1} \mod w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w' = w^{-1} \mod L$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This represents modular structure of the indices&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$n \mod w = n_1 L \mod w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n \mod L = n_2 w \mod L$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k \mod w = k_1 (L^{-1} \mod w)(L \mod w) + 0 = k_1 \mod w = k_1$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k \mod L = 0 + k_2 (w^{-1} \mod L) (w \mod L) = k_2 \mod L = k_2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}&#xA; $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you sum out the &lt;span class=&quot;math-container&quot;&gt;$\mod L$&lt;/span&gt; subregister, leaving only the &lt;span class=&quot;math-container&quot;&gt;$\mod w$&lt;/span&gt; subregister, you get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}&#xA; $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Plancherel's theorem implies that the summed out probability (indexed by &lt;span class=&quot;math-container&quot;&gt;$n_1$&lt;/span&gt;) is constant before and after the application of a QFT. Assuming one performs the base &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; QFT before the base &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; QFT, &lt;span class=&quot;math-container&quot;&gt;$x_{n_1L+n_2w}$&lt;/span&gt; will have solutions (= 0, 1) for all &lt;span class=&quot;math-container&quot;&gt;$n_1, n_2$&lt;/span&gt; (i.e. for each index &lt;span class=&quot;math-container&quot;&gt;$n_1$&lt;/span&gt;, every index &lt;span class=&quot;math-container&quot;&gt;$n_2$&lt;/span&gt; will have a basis vector with coefficient &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), so the base &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; part of the first QFT will have the same phase value for all &lt;span class=&quot;math-container&quot;&gt;$n_1$&lt;/span&gt;. So that, up to a constant phase, the QFT on the &lt;span class=&quot;math-container&quot;&gt;$\mod w$&lt;/span&gt; subregister only depends on the base &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; QFT.&lt;/p&gt;&#xA;&lt;p&gt;It's possible to choose a good &lt;span class=&quot;math-container&quot;&gt;$L, N=Lw$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$N=Lw$&lt;/span&gt; is very close to the group order and such that &lt;span class=&quot;math-container&quot;&gt;$L \mod w = 1$&lt;/span&gt; so that both QFTs in the compressed 'classical' circuit can use a plain base &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;-QFT. Changing &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; will cause small changes in the &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; phases that are in superposition and induce (a typically sizeable) change in the overall phase.&lt;/p&gt;&#xA;" OwnerUserId="9305" LastActivityDate="2020-08-13T02:57:34.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13295" PostTypeId="1" AcceptedAnswerId="13296" CreationDate="2020-08-13T03:34:53.440" Score="5" ViewCount="556" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="55" LastEditDate="2020-08-14T06:20:56.090" LastActivityDate="2020-08-14T06:20:56.090" Title="Can anyone provide me with an example of the for Grover's algorithm on one qubit?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13296" PostTypeId="2" ParentId="13295" CreationDate="2020-08-13T05:33:40.047" Score="11" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Both inputs are solutions to &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;.&lt;br /&gt;&#xA;The classical solution takes one function evaluation, so there is no speedup.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Both inputs are not solutions.&lt;br /&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Exactly one of the inputs is a solution.&lt;br /&gt;&#xA;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.&lt;br /&gt;&#xA;Grover's search will start with a superposition of both inputs &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$&lt;/span&gt;; if you do a measurement immediately you'll get the correct answer with 50% chance. One Grover iteration will convert the system to the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(|0\rangle - |1\rangle)$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-08-13T05:33:40.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13297" PostTypeId="2" ParentId="13264" CreationDate="2020-08-13T13:56:47.687" Score="3" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{\Lambda}(\alpha_1,\alpha_2,\ldots,\alpha_{|\Lambda|})&#xA;$$&lt;/span&gt;&#xA;be a unitary that acts on a set of qubits &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; such that, if those qubits start in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes|\Lambda|}$&lt;/span&gt;, they are output in the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i\alpha_i|0\rangle^{\otimes(i-1)}|1\rangle|0\rangle^{\otimes|\Lambda|-i}.&#xA;$$&lt;/span&gt;&#xA;You say you already know how to do this.&lt;/p&gt;&#xA;&lt;p&gt;Now consider wanting to make a state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum\beta_{i&amp;lt;j}|ij\rangle&#xA;$$&lt;/span&gt;&#xA;(where &lt;span class=&quot;math-container&quot;&gt;$|ij\rangle$&lt;/span&gt; is a shorthand to say 1s on qubits &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; and 0 elsewhere) on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits. Presumably we could do this by&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;let &lt;span class=&quot;math-container&quot;&gt;$\alpha_i=\sqrt{\sum_{j:j&amp;gt;i}|\beta_{ij}|^2}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Implement &lt;span class=&quot;math-container&quot;&gt;$U_{1,2,\ldots,N}(\alpha_1,\alpha_2,\ldots,\alpha_N)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Apply controlled-&lt;span class=&quot;math-container&quot;&gt;$U_{2,3,\ldots ,N}(\tilde\beta_{12},\tilde\beta_{13},\ldots,\tilde\beta_{1N})$&lt;/span&gt; controlled off qubit 1, where &lt;span class=&quot;math-container&quot;&gt;$\tilde\beta_{ij}=\beta_{ij}/\alpha_i$&lt;/span&gt;. This gets all the terms correct where the first qubit is in the 1 state.&lt;/li&gt;&#xA;&lt;li&gt;Then apply controlled-&lt;span class=&quot;math-container&quot;&gt;$U_{3,4,\ldots,N}(\tilde\beta_{23},\tilde\beta_{24},\ldots,\tilde\beta_{2N})$&lt;/span&gt; where qubit 1 is controlled off &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and qubit 2 is controlled off being in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Repeat in order until all are done. On the &lt;span class=&quot;math-container&quot;&gt;$n^{th}$&lt;/span&gt; round, you control off &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits such that the first &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; are in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and the &lt;span class=&quot;math-container&quot;&gt;$n^{th}$&lt;/span&gt; is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-excitation case, you first perform the division in steps 1 &amp;amp; 2, then replace the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;s in the controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$k-1$&lt;/span&gt; excitation version.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-13T13:56:47.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13298" PostTypeId="1" CreationDate="2020-08-13T14:51:54.837" Score="1" ViewCount="37" Body="&lt;p&gt;I just started using Qiskit and I have implemented the QSVM example. However, I having trouble with the return. The &lt;code&gt;qsvm.predict()&lt;/code&gt; results are reasonable but when trying to calculate the margin myself, this does not make sense. I was hoping someone could help me:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;xData = qsvm_res['svm']['support_vectors']&#xA;yData = qsvm_res['svm']['yin']&#xA;qsvm_alphas = qsvm_res['svm']['alphas']&#xA;&#xA;w = np.zeros(n_features)&#xA;&#xA;for n in range(len(qsvm_alphas)):&#xA;    w += qsvm_alphas[n]*yData[n]*xData[n]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thanks,&lt;/p&gt;&#xA;&lt;p&gt;Matthias&lt;/p&gt;&#xA;" OwnerUserId="12942" LastEditorUserId="5955" LastEditDate="2020-08-20T22:07:05.893" LastActivityDate="2020-08-20T22:07:05.893" Title="Qiskit QSVM - Alphas and Support Vectors" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-08-24T08:56:46.013" ContentLicense="CC BY-SA 4.0" />
  <row Id="13299" PostTypeId="2" ParentId="13289" CreationDate="2020-08-13T15:02:29.913" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def add_ccry(theta):&#xA;    qc = QuantumCircuit(3)&#xA;    qc.cry(theta/2, 1, 2)&#xA;    qc.cx(0, 1)&#xA;    qc.cry(-theta/2, 1, 2)&#xA;    qc.cx(0, 1)&#xA;    qc.cry(theta/2, 0, 2)&#xA;    gate = qc.to_gate()&#xA;    return gate&#xA;&#xA;qc = QuantumCircuit(3, 3)&#xA;qc.append(add_ccry(np.pi), [0, 1, 2]) # As an example. Theta will be numpy.pi&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6180" LastEditorUserId="6180" LastEditDate="2020-08-13T15:59:45.503" LastActivityDate="2020-08-13T15:59:45.503" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13300" PostTypeId="1" AcceptedAnswerId="13301" CreationDate="2020-08-13T15:48:50.290" Score="2" ViewCount="69" Body="&lt;p&gt;I was wondering if the complexity of a quantum circuit that solves a problem that is in NP implies P=NP?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastActivityDate="2020-08-13T23:51:25.587" Title="Does finding an algorithm that solves an NP-Problem in Polynomial time in a Quantum Computer imply P = NP?" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13301" PostTypeId="2" ParentId="13300" CreationDate="2020-08-13T16:07:07.947" Score="4" Body="&lt;p&gt;In short, no — as things stand, if there were a polynomial-time algorithm to solve an &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete problem on a(n idealised) quantum computer (with reasonably low error probabilities), this would not imply that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P} = \mathsf{NP}$&lt;/span&gt;. The question of &amp;quot;what problems are in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;&amp;quot; is a very different one from &amp;quot;what problems can you efficiently solve in principle on an idealised quantum computer&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;The problems that are in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;, are not actually &amp;quot;the problems that can be solved in practise&amp;quot;; 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).&lt;/p&gt;&#xA;&lt;p&gt;It is, perhaps, possible that there is a classical algorithm to efficiently simulate an idealised quantum computer, &lt;em&gt;i.e.&lt;/em&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete problem &lt;em&gt;L&lt;/em&gt; which happened to be solvable efficiently (and with low enough probability of error) by quantum computers — that is, if we discovered such a problem &lt;em&gt;L&lt;/em&gt;, which belonged to the class &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; 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 &lt;em&gt;L&lt;/em&gt; is also in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;), nor even any evidence in that direction.&lt;/p&gt;&#xA;&lt;p&gt;More generally, there are no other formal results or other evidence to the effect that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP} \subseteq \mathsf{BQP}$&lt;/span&gt; only if &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP} = \mathsf{P}$&lt;/span&gt;. So, even if we could solve &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete problems on a quantum computer, this wouldn't provide us with any proof (or formal reason to believe) that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P} = \mathsf{NP}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(It would, however, be an extremely exciting and surprising result.)&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2020-08-13T23:51:25.587" LastActivityDate="2020-08-13T23:51:25.587" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13302" PostTypeId="1" CreationDate="2020-08-13T16:26:44.877" Score="0" ViewCount="736" Body="&lt;p&gt;I installed qiskit using qiskit documents from here &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/install.html&lt;/a&gt;. When I first installed qiskit the version was 0.12.xx on ubuntu with python installed. Everything was working great.&lt;/p&gt;&#xA;&lt;p&gt;yesterday I needed qiskit version 0.19.6 for &amp;quot;IBM Advocate Test&amp;quot;. When I run &lt;code&gt;qiskit.__qiskit_version__&lt;/code&gt; &lt;br&gt; it shows&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'qiskit-terra': '0.xx.xx',&#xA; 'qiskit-aer': '0.x.x',&#xA; 'qiskit-ignis': '0.x.x',&#xA; 'qiskit-ibmq-provider': '0.x.x',&#xA; 'qiskit-aqua': '0.x.x',&#xA; 'qiskit': '0.12.xx'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then I run some commands that were in the test file so everyone trying to give the test have updated qiskit version.&lt;br&gt; Commands are: &lt;br&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;!pip install --upgrade qiskit==0.19.6 &#xA;!pip install --upgrade metakernel&#xA;!pip install --upgrade portalocker&#xA;!pip install --upgrade matplotlib&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So after running them there were some sort of errors I don't remember, then I seek on internet and found something useful here&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11545/updating-qiskit-doesnt-update-qiskit-version-from-spyder?newreg=ca47231b51aa46e09caf83b0e5d17223&quot;&gt;Updating qiskit doesn&amp;#39;t update qiskit version from Spyder&lt;/a&gt;&lt;br&gt;&lt;br&gt; But Qiskit just updated to version 0.13.xx. I have tried this Q&amp;amp;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.&lt;/p&gt;&#xA;&lt;p&gt;Plz help me for what else needs to be done.&lt;/p&gt;&#xA;" OwnerUserId="12944" LastEditorUserId="55" LastEditDate="2020-08-14T08:08:09.657" LastActivityDate="2020-09-13T20:01:40.170" Title="Updating qiskit doesn't update qiskit version using jupyter notebook/terminal" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13303" PostTypeId="1" AcceptedAnswerId="13305" CreationDate="2020-08-13T16:32:17.697" Score="3" ViewCount="77" Body="&lt;p&gt;In phase estimation, we start by using an eigenvector &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}\ket u$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\ket{xy\bmod N}$&lt;/span&gt;.&#xA;However, the eigenvectors/eigenvalues depend on the order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, which we don't know.&lt;/p&gt;&#xA;&lt;p&gt;As a solution, textbooks note that the eigenvectors add up to &lt;span class=&quot;math-container&quot;&gt;$\ket1$&lt;/span&gt; and then use that to initialize the phase estimation circuit.&lt;/p&gt;&#xA;&lt;p&gt;My question is - why does that work? Why can I use the sum of eigenvectors and not just a specific eigenvector?&lt;/p&gt;&#xA;" OwnerUserId="11582" LastEditorUserId="55" LastEditDate="2020-08-19T23:17:13.610" LastActivityDate="2020-08-19T23:17:13.610" Title="Why can I use the Sum of Eigenvectors for Phase Estimation in Shor" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13304" PostTypeId="1" AcceptedAnswerId="13312" CreationDate="2020-08-13T16:55:41.010" Score="3" ViewCount="100" Body="&lt;p&gt;A quote from the &lt;a href=&quot;https://arxiv.org/abs/1508.04212v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; &amp;quot;Quantum annealing for constrained optimization&amp;quot; by I. Hen, F. M. Spedalieri:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Let us now consider the driver Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_d = - \sum_{i=1}^n \left( \sigma_i^x \sigma_{i+1}^x + \sigma_i^y \sigma_{i+1}^y \right)$$&lt;/span&gt;&#xA;where the label &lt;span class=&quot;math-container&quot;&gt;$i = n + 1$&lt;/span&gt; is identified with &lt;span class=&quot;math-container&quot;&gt;$i = 1$&lt;/span&gt; ... This driver has the following atractive properties (i) &lt;strong&gt;as can easily be verified, it obeys&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$[H_d, \sum_{i = 1}^n \sigma_i^z] = 0$&lt;/span&gt;; (ii)...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't see why &lt;span class=&quot;math-container&quot;&gt;$[H_d, \sum_{i = 1}^2 \sigma_i^z] = 0$&lt;/span&gt;. Note that for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; from this commutation relation we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_d \left(\sigma_1^z + \sigma_2^z \right) = \left(\sigma_1^z + \sigma_2^z \right) H_d$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_d = -2\left(\sigma_1^x \sigma_{2}^x + \sigma_1^y \sigma_{2}^y \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but actually:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_d \left(\sigma_1^z + \sigma_2^z \right) = -\left(\sigma_1^z + \sigma_2^z \right) H_d$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$\sigma^x \sigma^z = -\sigma^z \sigma^x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma^y \sigma^z = -\sigma^z \sigma^y$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$\sigma_1^x \sigma_{2}^x \sigma_1^z = -\sigma_1^z \sigma_1^x \sigma_{2}^x$&lt;/span&gt; and the similar for other terms. So, in contradiction, instead of commuting operators, we have anticommuting operators &lt;span class=&quot;math-container&quot;&gt;$\{H_d, \sum_{i = 1}^2 \sigma_i^z \} = 0$&lt;/span&gt;. Where is my mistake(s)?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to the answers below indeed &lt;span class=&quot;math-container&quot;&gt;$[H_d, \sum_{i = 1}^2 \sigma_i^z] = 0$&lt;/span&gt;. Also, the operators &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \sum_{i = 1}^2 \sigma_i^z$&lt;/span&gt; (for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;) commute and anticommute at the same time and there is no contradiction (as I have wrongly stated above). This is because:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_d \left(\sigma_1^z + \sigma_2^z \right) = \left(\sigma_1^z + \sigma_2^z \right) H_d = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's prove for the first part:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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) =&#xA;\\&#xA;=-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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-08-14T10:50:08.297" LastActivityDate="2020-08-14T13:21:32.813" Title="The commutation relation $[H_d, \sum_{i = 1}^n \sigma_i^z] = 0$ from the paper about the constrained quantum annealing (CQA)" Tags="&lt;d-wave&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13305" PostTypeId="2" ParentId="13303" CreationDate="2020-08-13T17:17:01.823" Score="3" Body="&lt;p&gt;As you say, we would be able to use phase estimation if we knew the eigenvector &lt;span class=&quot;math-container&quot;&gt;$|u_s \rangle$&lt;/span&gt; that depends on the order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and the integer &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$0 \leq s \leq r - 1$&lt;/span&gt;. However, we don't know the eigenvector, only the superposition of them, which is &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{s}{r}$&lt;/span&gt;. Why does it have this form? Because of the form of the unitary's eigenvalue: &lt;span class=&quot;math-container&quot;&gt;$U |u_s \rangle = \exp \left[ 2 \pi i \frac{s}{r} \right] |u_s \rangle $&lt;/span&gt;. Using the fact that the phase is &lt;span class=&quot;math-container&quot;&gt;$\frac{s}{r}$&lt;/span&gt;, we can use the continued fractions algorithm to calculate both &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; (even though we only really care about &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="12643" LastEditDate="2020-08-13T17:26:49.877" LastActivityDate="2020-08-13T17:26:49.877" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13306" PostTypeId="2" ParentId="13302" CreationDate="2020-08-13T18:22:04.390" Score="0" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cd /path/to/qiskit/advocate/folder&#xA;python3 -m venv /path/to/new/venv &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Replace the path in the above code with the appropriate path. Once that is done then you can use &lt;code&gt;pip install qiskit==0.19.6&lt;/code&gt;. This is if you are accessing the shell via a terminal. If you are doing it from a jupyter notebook, then add &lt;code&gt;!&lt;/code&gt; in front of all these commands.&lt;/p&gt;&#xA;&lt;p&gt;Also version &lt;code&gt;0.13.xx&lt;/code&gt; is lower than &lt;code&gt;0.19.6&lt;/code&gt;. So it would seem that somehow you have downgraded qiskit.&lt;/p&gt;&#xA;" OwnerUserId="12785" LastActivityDate="2020-08-13T18:22:04.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13308" PostTypeId="2" ParentId="13304" CreationDate="2020-08-13T21:01:55.077" Score="2" Body="&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$[\sigma_i^k,\sigma_j^k]=0$&lt;/span&gt;, you can expand the first product in &lt;span class=&quot;math-container&quot;&gt;$[H_d, \sum_{i = 1}^2 \sigma_i^z]$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;(\sigma_1^x \sigma_2^x + \sigma_1^y \sigma_2^y) (\sigma_1^z + \sigma_2^z)= &amp;amp; \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&#xA;\\ = &amp;amp; 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)&#xA;\\=&amp;amp;i([\sigma_1^y,\sigma_2^x]+[\sigma_2^y,\sigma_1^x])=0&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the second product as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;(\sigma_1^z + \sigma_2^z)(\sigma_1^x \sigma_2^x + \sigma_1^y \sigma_2^y)= &amp;amp; \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&#xA;\\ = &amp;amp;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)&#xA;\\=&amp;amp;i([\sigma_1^y,\sigma_2^x]+[\sigma_2^y,\sigma_1^x])=0&#xA;\end{align}$$&lt;/span&gt;&#xA;showing that &lt;span class=&quot;math-container&quot;&gt;$[H_d, \sum_{i = 1}^2 \sigma_i^z]=0$&lt;/span&gt; as claimed.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-08-14T13:21:32.813" LastActivityDate="2020-08-14T13:21:32.813" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13310" PostTypeId="5" CreationDate="2020-08-14T06:13:55.373" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-14T06:13:55.373" LastActivityDate="2020-08-14T06:13:55.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13311" PostTypeId="4" CreationDate="2020-08-14T06:13:55.373" Score="0" Body="For questions about cluster states, a class of entangled many-qubit systems that are especially useful in the context of measurement-based quantum computation schemes." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-14T06:13:55.373" LastActivityDate="2020-08-14T06:13:55.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13312" PostTypeId="2" ParentId="13304" CreationDate="2020-08-14T07:42:04.463" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\sum Z_i$&lt;/span&gt; has a bunch of eigenspaces, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$-N,2-N,4-N,\ldots,N-2,N$&lt;/span&gt;. The eigenspace &lt;span class=&quot;math-container&quot;&gt;$-N+2k$&lt;/span&gt; is spanned by all basis states comprising &lt;span class=&quot;math-container&quot;&gt;$N-k$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;s. Now, observe that a term &lt;span class=&quot;math-container&quot;&gt;$X_nX_{n+1}+Y_nY_{n+1}$&lt;/span&gt; is a hopping term that preserves the number of excitations (the value &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;). Specifically it changes the state of the pair of qubits based on&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;00\rightarrow00,\quad 01\rightarrow 10,\quad 10\rightarrow 01,\quad 11\rightarrow 11.&#xA;$$&lt;/span&gt;&#xA;So, you can see that the eigenspace of the &lt;span class=&quot;math-container&quot;&gt;$\sum_iZ$&lt;/span&gt; operator does not change under that action. Similarly, the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; can be grouped in terms of excitation number. An eigenvector of &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; within a particular excitation subspace is unchanged by the action &lt;span class=&quot;math-container&quot;&gt;$\sum_iZ_i$&lt;/span&gt; (because, within that excitation subspace, &lt;span class=&quot;math-container&quot;&gt;$\sum_iZ_i$&lt;/span&gt; is just a multiple of the identity).&lt;/p&gt;&#xA;&lt;p&gt;That should make commutation quite clear. For any eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;[H_d,\sum_iZ_i]|\lambda\rangle=0,&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Let's return to doing things the more obvious way. Unfortunately, just applying commutation properties is not very revealing. We want to calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(X_1X_2+Y_1Y_2)(Z_1+Z_2)-(Z_1+Z_2)(X_1X_2+Y_1Y_2).&#xA;$$&lt;/span&gt;&#xA;What you want to compare are the two terms&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X_1X_2Z_1-Z_2Y_1Y_2.&#xA;$$&lt;/span&gt;&#xA;We recall that &lt;span class=&quot;math-container&quot;&gt;$X_1Z_1=-iY_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2Y_2=-iX_2$&lt;/span&gt;,&#xA;so this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-iY_1X_2+iY_1X_2=0.&#xA;$$&lt;/span&gt;&#xA;Other pairs of terms cancel in a similar way.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-14T07:42:04.463" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13313" PostTypeId="1" AcceptedAnswerId="13314" CreationDate="2020-08-14T09:41:32.357" Score="4" ViewCount="169" Body="&lt;p&gt;I know how Grover's diffusion operator works (&lt;span class=&quot;math-container&quot;&gt;$U_s = 2|s\rangle\langle s|-I$&lt;/span&gt;) with the inversion around the mean. However, I want to implement it in simpler gates, to use the algorithm. How can I do this ?&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="55" LastEditDate="2020-08-19T23:23:51.960" LastActivityDate="2020-08-19T23:23:51.960" Title="How can you decompose Grover's diffusion operator into gates?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13314" PostTypeId="2" ParentId="13313" CreationDate="2020-08-14T09:41:32.357" Score="6" Body="&lt;p&gt;Grover's diffusion operator can be implemented with H, X and a controlled Z gate. I will show this mathematically. Since &lt;span class=&quot;math-container&quot;&gt;$|s\rangle = |+\rangle^{\otimes n} $&lt;/span&gt; :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_s = 2|s\rangle\langle s|-I = H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n}&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle 0|-I$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle0|$&lt;/span&gt; is the outer product of the first basic state. It is a matrix filled with 0s only (0, 0) is filled with a 1. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; Is the identity matrix.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2|0\rangle\langle 0|-I = 2&#xA;\begin {bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end {bmatrix}&#xA;-&#xA;I = &#xA;\begin {bmatrix}&#xA;2 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end {bmatrix} -&#xA;\begin {bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end {bmatrix}&#xA;=&#xA;\begin {bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;0 &amp;amp; -1 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; -1&#xA;\end {bmatrix}&#xA;$$&lt;/span&gt;&#xA;We now have the matrix which represents &lt;span class=&quot;math-container&quot;&gt;$2|0\rangle\langle 0|-I$&lt;/span&gt;. It flips the phase of every state apart from &lt;span class=&quot;math-container&quot;&gt;$|0\cdots0\rangle$&lt;/span&gt;. If we apply a global phase of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; (which can be ignored), we only have to flip the phase of &lt;span class=&quot;math-container&quot;&gt;$|0\cdots0\rangle$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin {bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;0 &amp;amp; -1 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; -1&#xA;\end {bmatrix}&#xA;= -1&#xA;\begin {bmatrix}&#xA;-1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0\\&#xA;0  &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end {bmatrix} = -1 X^{\otimes n}&#xA;\begin {bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \\&#xA;\end {bmatrix} X^{\otimes n}&#xA;$$&lt;/span&gt;&#xA;We can transform the matrix by applying the X gate to every qubit to only have to flip the phase of &lt;span class=&quot;math-container&quot;&gt;$|1\cdots1\rangle$&lt;/span&gt; state. However, this matrix is only a controlled Z operation with all the qubits except the last one as control.&lt;/p&gt;&#xA;&lt;p&gt;There we have it : Grover's diffusion operator with only H gates , X gates and a controlled Z gate. This &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0301079.pdf&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-08-14T09:41:32.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13315" PostTypeId="1" AcceptedAnswerId="13324" CreationDate="2020-08-14T09:58:17.177" Score="6" ViewCount="104" Body="&lt;p&gt;Consider an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt;. Two orthonormal bases &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\{\ket{u_j}\}_{j=1}^N,\{\ket{v_j}\}_{j=1}^N\subset\mathcal H$&lt;/span&gt; are said to be &lt;em&gt;Mutually Unbiased Bases&lt;/em&gt; (MUBs) if &lt;span class=&quot;math-container&quot;&gt;$\lvert\langle u_i\lvert v_j\rangle\rvert =1/\sqrt N$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we want to fully reconstruct a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; by means of projective measurements. A single basis provides us with &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; real parameters (the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; outcome probabilities associated with the measurement, minus one for the normalisation constraint).&lt;/p&gt;&#xA;&lt;p&gt;Intuitively, if two bases are mutually unbiased, they provide fully uncorrelated information (finding a state in some &lt;span class=&quot;math-container&quot;&gt;$\ket{u_j}$&lt;/span&gt; says nothing about which &lt;span class=&quot;math-container&quot;&gt;$\ket{v_k}$&lt;/span&gt; would have been found), and thus measuring the probabilities in two different MUBs should characterise &lt;span class=&quot;math-container&quot;&gt;$2(N-1)$&lt;/span&gt; real parameters.&#xA;If we can measure in &lt;span class=&quot;math-container&quot;&gt;$N+1$&lt;/span&gt; different MUBs (assuming they exist), it thus stands to reason that we characterised &lt;span class=&quot;math-container&quot;&gt;$(N-1)(N+1)=N^2-1$&lt;/span&gt; independent real parameters of the state, and thus obtained tomographically complete information.&#xA;This is also mentioned in passing in &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.105.030406&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (page 2, second column, &lt;a href=&quot;https://arxiv.org/abs/0808.0944&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:0808.0944&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;What is a more rigorous way to see why this is the case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="5870" LastEditDate="2020-08-17T12:56:33.913" LastActivityDate="2020-11-23T19:31:31.950" Title="Why does full state reconstruction require at least $N+1$ MUBs?" Tags="&lt;quantum-state&gt;&lt;tomography&gt;&lt;mub&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13316" PostTypeId="1" CreationDate="2020-08-14T11:51:24.867" Score="7" ViewCount="114" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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%.&lt;/p&gt;&#xA;&lt;p&gt;I am curious to know:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;is there a particular reason for this, outside of just the inherent &amp;quot;randomness&amp;quot; of QM?&lt;/li&gt;&#xA;&lt;li&gt;Are different IBM pieces of hardware better for different tasks?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="12955" LastActivityDate="2020-10-01T20:17:18.403" Title="What are the differences between the IBM machines?" Tags="&lt;ibm-q-experience&gt;&lt;machine-learning&gt;&lt;ibm&gt;&lt;pennylane&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13317" PostTypeId="2" ParentId="5287" CreationDate="2020-08-14T12:27:43.750" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12956" LastActivityDate="2020-08-14T12:27:43.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13318" PostTypeId="1" AcceptedAnswerId="13322" CreationDate="2020-08-14T12:40:50.800" Score="5" ViewCount="151" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="491" LastEditDate="2020-08-15T21:37:01.787" LastActivityDate="2020-08-15T21:37:01.787" Title="What to do when the amount of solutions is not known before applying Grovers Algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13320" PostTypeId="2" ParentId="13316" CreationDate="2020-08-14T13:48:57.017" Score="6" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Those are some high level differences at least.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-08-14T13:48:57.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13321" PostTypeId="2" ParentId="13316" CreationDate="2020-08-14T13:59:25.977" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Regarding differences between hardware, some information is aggregated &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.  But you can also map your logical qubits to the physical qubits of specific hardware, at specific optimization levels directly in Qiskit.  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9064/getting-a-layout-for-qubits-in-qiskit&quot;&gt;This Q&amp;amp;A&lt;/a&gt; is a good example with corresponding code.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Some of the links in the linked Q&amp;amp;A are apparently dead.  This &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/pulse/5_gathering_system_information.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;pulse tutorial&lt;/a&gt; has a lot of good information on getting backend information in Qiskit.&#xA;You may also find this &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; on transpiler passes and optimization levels relevant.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-08-14T14:30:13.617" LastActivityDate="2020-08-14T14:30:13.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13322" PostTypeId="2" ParentId="13318" CreationDate="2020-08-14T15:14:05.597" Score="6" Body="&lt;p&gt;It's a good question, as the number of solutions is sometimes unknown. The approach is described in Algorithm 2 of &lt;a href=&quot;https://arxiv.org/pdf/1709.01236.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;The entire proof is sketched out &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9605034.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, but here's the brief pseudocode:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;m = 1&#xA;while m &amp;lt;= \sqrt{N}:&#xA;   pick k in {1 ... m}&#xA;   apply the Grover iterate k times to the superposition state&#xA;   measure the register; if a solution, exit and return&#xA;   otherwise, m = lambda * m&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For some &lt;span class=&quot;math-container&quot;&gt;$ \lambda \in (1, \frac{4}{3}) $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(Btw: This technique underlies Amplitude Amplification!)&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-14T15:14:05.597" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13323" PostTypeId="1" CreationDate="2020-08-14T15:29:17.450" Score="4" ViewCount="135" Body="&lt;p&gt;In a &lt;a href=&quot;https://books.google.ch/books?id=XV9sAAAAQBAJ&amp;amp;pg=PA92&amp;amp;lpg=PA92&amp;amp;dq=daniel%20lidar%20noiseless%20product,%20and%20this%20does%20not%20have%20to%20be%20a%20subspace%20(e.g.,%20in%20general%20it%20is%20not%20closed%20under%20addition)&amp;amp;source=bl&amp;amp;ots=zs7Tt3rlYN&amp;amp;sig=ACfU3U06N1o2GSgaBa8Ho72Q7QHa03mNrA&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=2ahUKEwjhganBgpvrAhXCyaQKHbhOBP8Q6AEwAHoECAkQAQ#v=onepage&amp;amp;q=daniel%20lidar%20noiseless%20product%2C%20and%20this%20does%20not%20have%20to%20be%20a%20subspace%20(e.g.%2C%20in%20general%20it%20is%20not%20closed%20under%20addition)&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;text&lt;/a&gt; (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).'&lt;/p&gt;&#xA;&lt;p&gt;I do not understand how if some quantum states &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma \in  \mathbb{C}^n \otimes \mathbb{C}^m$&lt;/span&gt;&#xA;then how can their addition not be in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n \otimes \mathbb{C}^m$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="12047" LastEditDate="2020-08-14T16:10:20.317" LastActivityDate="2020-09-02T18:16:52.380" Title="Is there a proof or example to show that a noiseless subsystem is not necessarily closed under addition?" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13324" PostTypeId="2" ParentId="13315" CreationDate="2020-08-14T16:22:35.717" Score="4" Body="&lt;p&gt;Denote the projections onto basis elements by &lt;span class=&quot;math-container&quot;&gt;$P_j^{(k)}=|u_j^{(k)}\rangle\langle u_j^{(k)}|$&lt;/span&gt;, where superscript indexes different bases.&#xA;Tomography of a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; gives us probabilities &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho P_j^{(k)})$&lt;/span&gt;.&#xA;This is actually a value of the Hilbert-Schmidt inner product between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_j^{(k)}$&lt;/span&gt; in the space &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal{H})$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; the complex space of all &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrices.&#xA;Such values can be used to reconstruct a projection of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; onto the &lt;span class=&quot;math-container&quot;&gt;$\text{span}\{P_j^{(k)}\}$&lt;/span&gt; in the space &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal{H})$&lt;/span&gt;. For a full reconstruction of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we must have &lt;span class=&quot;math-container&quot;&gt;$\text{span}\{P_j^{(k)}\}_{j,k} = L(\mathcal{H})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\sum_{j=1}^N P_j^{(k)} = I$&lt;/span&gt; we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \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,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_k$&lt;/span&gt; is a subspace of dimension &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal{H})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The element &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is special since we a priory know the length of projection on it &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho I) = 1$&lt;/span&gt; (so we could consider the space &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal{H}) \ominus \langle I\rangle$&lt;/span&gt; of dimension &lt;span class=&quot;math-container&quot;&gt;$N^2-1$&lt;/span&gt;, but it's easier for me to work in the full space).&lt;/p&gt;&#xA;&lt;p&gt;Now note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}\big((P_i^{(k)}-I/N)(P_j^{(l)}-I/N)\big) = 0&#xA;$$&lt;/span&gt;&#xA;whenever &lt;span class=&quot;math-container&quot;&gt;$k\neq l$&lt;/span&gt;. This means that &lt;span class=&quot;math-container&quot;&gt;$\mathcal S_k \perp \mathcal S_l$&lt;/span&gt;. Hence the dimension of the span of &lt;span class=&quot;math-container&quot;&gt;$P_j^{(k)}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; MUBs is exactly &lt;span class=&quot;math-container&quot;&gt;$m(N-1)+1$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$L(\mathcal H)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-11-23T11:06:59.400" LastActivityDate="2020-11-23T11:06:59.400" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13325" PostTypeId="1" AcceptedAnswerId="13327" CreationDate="2020-08-14T17:25:06.770" Score="4" ViewCount="114" Body="&lt;p&gt;I'm studying Deutsch–Jozsa algorithm and I don't understand this passage about Hadamard gate result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why this equivalence is true? In particular, what is &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="11696" LastEditorUserId="55" LastEditDate="2020-08-15T06:45:59.317" LastActivityDate="2020-08-15T06:45:59.317" Title="Why does the Hadamard gate satisfy $H|x\rangle=\frac{1}{\sqrt2}\sum_{z\in\{0,1\}}(-1)^{xz}\lvert z\rangle$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13327" PostTypeId="2" ParentId="13325" CreationDate="2020-08-14T17:37:15.887" Score="5" Body="&lt;p&gt;This is just a compact way of representing the Hadamard operator. The summation operator can be expanded, yielding:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This occurs because the matrix representation of the Hadamard operator is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{2}} \begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="8343" LastEditDate="2020-08-14T19:17:56.727" LastActivityDate="2020-08-14T19:17:56.727" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13328" PostTypeId="2" ParentId="13325" CreationDate="2020-08-14T19:10:54.470" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;We initially prepare two quantum registers. The first is an n-qubit&#xA;register initialized to |0&amp;gt;, and the second is a one-qubit register&#xA;initialized to |1&amp;gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then the quantum oracle is applied such that it does not decohere the inputs.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;At this point, the second single qubit register may be ignored.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then we apply a Hadamard gate to each qubit in the first register.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i8JcV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i8JcV.png&quot; alt=&quot;Deutch Jozsa Algorithm Circuit Diagram&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="4501" LastEditDate="2020-08-14T19:17:56.763" LastActivityDate="2020-08-14T19:17:56.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13329" PostTypeId="2" ParentId="13302" CreationDate="2020-08-14T19:44:16.737" Score="2" Body="&lt;p&gt;I accidentally encountered the solution. Sorry I didn't tried your solution butwe have a solution.&#xA;So&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;you need to make sure that you have updated python version.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;run this command &lt;code&gt;conda info --env&lt;/code&gt; to check your conda environments it should look like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# conda environments:&#xA;#&#xA;base                  *  /home/alrazi/anaconda3&#xA;python3-env              /home/alrazi/anaconda3/envs/python3-env&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now the Solution is simple and it works fine on different issues like I have&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Collecting qiskit&#xA;Cache entry deserialization failed, entry ignored&#xA;Could not find a version that satisfies the requirement qiskit (from versions: )&#xA;No matching distribution found for qiskit&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Start-up your system and open the terminal type these commands:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get update&#xA;sudo apt-get dist-upgrade&#xA;conda info --env   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;it will give you least one environment which is most of the time named as &amp;quot;base&amp;quot; or something else if you installed anaconda with more customization. Now activate the one with asterisk  &amp;quot;*&amp;quot;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;conda activate base&#xA;pip install qiskit --upgrade&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;so it will take some time. I am showing you some last lines&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hxHTG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hxHTG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here you can see the qiskit 0.19.6 is uninstalling and it is installing 0.20.0&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;you can check the qiskit and all of it's components version by typing:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;conda list&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and I got this after scrolling up&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qiskit                    0.20.0                   pypi_0    pypi&#xA;qiskit-aer                0.6.1                    pypi_0    pypi&#xA;qiskit-aqua               0.7.5                    pypi_0    pypi&#xA;qiskit-ibmq-provider      0.8.0                    pypi_0    pypi&#xA;qiskit-ignis              0.4.0                    pypi_0    pypi&#xA;qiskit-terra              0.15.1                   pypi_0    pypi&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;rebooting your pc will give you some extra powers at this point.&lt;/p&gt;&#xA;&lt;p&gt;Mashaallah! we got working and upto date Qiskit. Now you can run Jupyter Notebook without any casualty Inshaallah.&lt;/p&gt;&#xA;" OwnerUserId="12944" LastActivityDate="2020-08-14T19:44:16.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13330" PostTypeId="2" ParentId="13316" CreationDate="2020-08-14T19:48:34.243" Score="5" Body="&lt;p&gt;&lt;em&gt;First of all, the name of  backends (devices) have nothing to do with their location! They are all located in US.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;If you click the name of any backend (device) in your &lt;strong&gt;IBM_Q Experience&lt;/strong&gt; dashboard, you'll see detailed information about the error rate for each backend.&lt;/p&gt;&#xA;&lt;p&gt;For example &lt;code&gt;ibmq_london&lt;/code&gt; and &lt;code&gt;ibmq_essex&lt;/code&gt; have the same topology and number of quits but &lt;code&gt;qubit_1&lt;/code&gt; in &lt;code&gt;ibmq_london&lt;/code&gt; has lower gate error rate compared to the same qubit in &lt;code&gt;ibmq_essex&lt;/code&gt;.&#xA;That's the reason applying the same gate to same qubits on different backends, results in different output.&lt;br /&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/65U74.png&quot; width=&quot;400&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kQmj6.png&quot; width=&quot;400&quot;&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;is there a particular reason for this, outside of just the inherent &amp;quot;randomness&amp;quot; of QM?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes, the reason is the difference in performance between devices. &lt;br /&gt;&#xA;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).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Are different IBM pieces of hardware better for different tasks?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As long as the number of qubits doesn't limit your choice of device, you'd always go for devices with higher &lt;code&gt;Quantum volume&lt;/code&gt; (higher performance). You can find QV in backend specification for each device.&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2020-10-01T20:17:18.403" LastActivityDate="2020-10-01T20:17:18.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13331" PostTypeId="2" ParentId="5895" CreationDate="2020-08-15T01:58:59.310" Score="3" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/2_relaxation_and_decoherence.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;2_relaxation_and_decoherence&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/noise/2_relaxation_and_decoherence.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;2_relaxation_and_decoherence.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It contains lots of figures, perhaps they are what you want.&lt;/p&gt;&#xA;" OwnerUserId="12922" LastActivityDate="2020-08-15T01:58:59.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13332" PostTypeId="1" CreationDate="2020-08-15T10:29:20.660" Score="1" ViewCount="35" Body="&lt;p&gt;The fidelity between two density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho,\sigma)=\operatorname{Tr}\left[\sqrt{\sqrt{\rho} \sigma \sqrt{\rho}} \right]^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If one of the two state is a pure state the expression is very easy, but in general it is this one.&#xA;To compute it I would naïvely diagonalise &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to find &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho}$&lt;/span&gt;, then compute &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\rho} \sigma \sqrt{\rho}$&lt;/span&gt;, then diagonalize again to find the square root: &lt;span class=&quot;math-container&quot;&gt;$ \sqrt{\sqrt{\rho} \sigma \sqrt{\rho}}$&lt;/span&gt;, take the trace and square.&lt;/p&gt;&#xA;&lt;p&gt;It is a &amp;quot;complicated&amp;quot; thing to do.&lt;/p&gt;&#xA;&lt;p&gt;I wondered if there are tricks to compute fidelity between two mixed states ? Also, are there some &amp;quot;usual&amp;quot; tricks to make proof based on that (like proving inequalities).&lt;/p&gt;&#xA;&lt;p&gt;Again my &amp;quot;confusion&amp;quot; is that this formula for two mixed state is not easy to handle so I wondered if I see it under the wrong angle ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-08-19T22:29:48.500" LastActivityDate="2020-08-19T22:29:48.500" Title="Calculating fidelity for mixed states: are there tricks or it is &quot;brute force&quot; calculations?" Tags="&lt;fidelity&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13334" PostTypeId="1" AcceptedAnswerId="13337" CreationDate="2020-08-15T13:56:39.123" Score="4" ViewCount="162" Body="&lt;p&gt;In the book &amp;quot;Quantum Computer Science&amp;quot;, when explaining the error correction code, it uses this picture and says &amp;quot;the action of controlled-z is unaltered by exchanging the target and control qubits&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;In my understanding, |1&amp;gt;Z|0&amp;gt;(first qubit is control qubit) is not equal to Z|0&amp;gt;|1&amp;gt;(second qubit is control qubit).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Jo48d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jo48d.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2020-08-19T22:29:14.707" LastActivityDate="2020-09-22T06:13:45.597" Title="Why is the action of controlled-Z unaltered by exchanging target control qubits?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13335" PostTypeId="1" AcceptedAnswerId="13336" CreationDate="2020-08-15T14:34:55.893" Score="2" ViewCount="36" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12950" LastEditorUserId="55" LastEditDate="2020-08-18T09:00:29.083" LastActivityDate="2020-08-18T09:00:29.083" Title="Any good resources for learning about quantum networks and how to do a simulation of BB84 protocol?" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;cryptography&gt;&lt;bb84&gt;&lt;quantum-networks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13336" PostTypeId="2" ParentId="13335" CreationDate="2020-08-15T14:45:29.003" Score="1" Body="&lt;p&gt;A very good book about quantum networks (with a communication engineering flavour) is &amp;quot;Quantum Networking&amp;quot; by Rodney Van Meter.&lt;/p&gt;&#xA;&lt;p&gt;Regarding SimulaQron, look at this simple tutorial for getting started:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://softwarequtech.github.io/SimulaQron/html/GettingStarted.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://softwarequtech.github.io/SimulaQron/html/GettingStarted.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I strongly suggest to read the main paper on SimulaQron (&lt;a href=&quot;https://arxiv.org/abs/1712.08032&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1712.08032&lt;/a&gt;)&#xA;where the BB84 example is clearly illustrated.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2020-08-15T18:06:45.317" LastActivityDate="2020-08-15T18:06:45.317" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13337" PostTypeId="2" ParentId="13334" CreationDate="2020-08-15T15:13:36.510" Score="5" Body="&lt;p&gt;If we have an arbitrary two qubit state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then after applying &lt;span class=&quot;math-container&quot;&gt;$CZ_{1 \rightarrow 2}$&lt;/span&gt; controlled from the first qubit we will obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CZ_{1 \rightarrow 2}|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle - d|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because control operation works when the control qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate changes the sign of the amplitude of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, hence &lt;span class=&quot;math-container&quot;&gt;$CZ_{1 \rightarrow 2}$&lt;/span&gt; action is changing the sign of the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now the action of &lt;span class=&quot;math-container&quot;&gt;$CZ_{2 \rightarrow 1}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CZ_{2 \rightarrow 1}|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle - d|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The same is true here only the sign of the &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; should be changed because of similar reasons. This can be seen also by using matrices:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CZ_{1 \rightarrow 2} = |0\rangle \langle 0| I + |1 \rangle \langle 1| Z = \\&#xA;=&#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;-1 \\&#xA;\end{pmatrix}=\\&#xA;=I |0\rangle \langle 0|  + Z |1 \rangle \langle 1| = CZ_{2 \rightarrow 1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-22T06:13:45.597" LastActivityDate="2020-09-22T06:13:45.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13340" PostTypeId="1" CreationDate="2020-08-16T02:25:45.947" Score="2" ViewCount="56" Body="&lt;p&gt;My main question: Can someone please explain to me how the list of array is used to define the dimension in qutip?&lt;/p&gt;&#xA;&lt;p&gt;Context:&lt;/p&gt;&#xA;&lt;p&gt;If I have my density operator &lt;code&gt;A = Qobj(np.arange(1,65).reshape(8,8))&lt;/code&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;I am guessing that I would have to define my mask as  &lt;code&gt;X.dims = [[2,4],[2,4]]&lt;/code&gt; and take &lt;code&gt;qt.partial_transpose(X, [1,0])&lt;/code&gt; which taking partial transposition over the second subsystem. But what does this &lt;code&gt;X.dims = [[2,4],[2,4]]&lt;/code&gt; mean in qutip?&lt;/p&gt;&#xA;&lt;p&gt;If this is correct then how would I define my dimension for entanglement between qubit 1 and 3 and qubit 2?&lt;/p&gt;&#xA;" OwnerUserId="12967" LastEditorUserId="10480" LastEditDate="2021-03-26T04:39:27.377" LastActivityDate="2021-03-26T04:39:27.377" Title="Defining dimension of an operator in qutip" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;qutip&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13341" PostTypeId="1" AcceptedAnswerId="13344" CreationDate="2020-08-16T02:56:43.137" Score="4" ViewCount="667" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;It seems to me that a quantum computer answers the question of the unitary acts on the quantum state. This is &amp;quot;just&amp;quot; a matter of linear algebra. It strikes me, then, that quantum computers can be seen as linear algebra calculators.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Question: Are there any candidates for classical linear algebra solvers (classical analog computers) which could implement the &amp;quot;quantum computer&amp;quot; algorithms whiles enjoying a similar speedup over digital classical computers?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12968" LastEditorUserId="55" LastEditDate="2020-08-18T08:32:15.697" LastActivityDate="2020-08-18T08:32:15.697" Title="Can classical linear algebra solvers implement quantum algorithms with similar speed-ups?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;&lt;speedup&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13342" PostTypeId="1" CreationDate="2020-08-16T09:12:25.753" Score="2" ViewCount="86" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;I'm looking for simple, abstract problems that could be solved when such a paradigm is utilized.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know any articles on the subject? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12971" LastEditorUserId="55" LastEditDate="2020-08-18T08:46:30.933" LastActivityDate="2021-02-14T22:00:35.087" Title="Distributed quantum computing with classical communication" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;communication&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13343" PostTypeId="2" ParentId="13342" CreationDate="2020-08-16T11:38:55.260" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.nature.com/articles/s41534-019-0139-x&quot; rel=&quot;nofollow noreferrer&quot;&gt;research article&lt;/a&gt; published by Nature.&lt;/p&gt;&#xA;&lt;p&gt;There is a paper published in &lt;a href=&quot;https://arxiv.org/pdf/1912.06642.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.researchgate.net/publication/342325939_Imperfect_Distributed_Quantum_Phase_Estimation&quot; rel=&quot;nofollow noreferrer&quot;&gt;ResearchGate&lt;/a&gt; and &lt;a href=&quot;https://europepmc.org/article/pmc/pmc7304757&quot; rel=&quot;nofollow noreferrer&quot;&gt;EuropePMC&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-08-16T11:38:55.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13344" PostTypeId="2" ParentId="13341" CreationDate="2020-08-16T11:59:14.027" Score="5" Body="&lt;p&gt;The complexity that you are glossing over is that in the general case you need to store &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex amplitudes to even represent an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit system classically. Therefore, for a quantum computer of let's say 1000 qubits you need to store  &lt;span class=&quot;math-container&quot;&gt;$2^{1000}$&lt;/span&gt; complex amplitudes. Even if you use one atom per amplitude to do this, you still run out of atoms in the observable universe.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; requirement. But this is likely to be problem-specific and unlikely to work in the general case.&lt;/p&gt;&#xA;" OwnerUserId="12643" LastActivityDate="2020-08-16T11:59:14.027" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13346" PostTypeId="2" ParentId="13341" CreationDate="2020-08-16T14:17:28.887" Score="3" Body="&lt;p&gt;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., &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2595/if-quantum-speed-up-is-due-to-the-wave-like-nature-of-quantum-mechanics-why-not&quot;&gt;here&lt;/a&gt;, and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2654/are-quantum-computers-just-a-variant-on-analog-computers-of-the-50s-60s-that?noredirect=1&amp;amp;lq=1&quot;&gt;here&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For example, the &lt;strong&gt;recommendation problem&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;However, in attempting to prove that the quantum algorithm truly was superior, E. Tang showed that there was indeed a &amp;quot;classical system which implements linear algebra operations and use[s] this to implement the algorithms which have been designed for quantum computers&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Tang's work has kicked off a program of &lt;em&gt;dequantization&lt;/em&gt; - i.e. of redesigning fast quantum algorithms in linear algebra/machine learning as fast classical algorithms.  A Quanta Magazine &lt;a href=&quot;https://www.quantamagazine.org/teenager-finds-classical-alternative-to-quantum-recommendation-algorithm-20180731/&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; describes the problem and Tang's approach.&lt;/p&gt;&#xA;&lt;p&gt;Which problems are amenable to this dequantization is an active area of research, as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5525/quantum-machine-learning-after-ewin-tang&quot;&gt;this thread&lt;/a&gt; discusses.  This may depend on the rank of the matrices considered.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-08-16T16:25:47.573" LastActivityDate="2020-08-16T16:25:47.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13347" PostTypeId="1" AcceptedAnswerId="13460" CreationDate="2020-08-16T16:30:01.993" Score="8" ViewCount="298" Body="&lt;p&gt;The (pending-peer review) proof of &lt;span class=&quot;math-container&quot;&gt;$MIP^\ast=RE$&lt;/span&gt; in &lt;a href=&quot;https://arxiv.org/abs/2001.04383&quot; rel=&quot;nofollow noreferrer&quot;&gt;this pre-print&lt;/a&gt; has been hailed as a significant breakthrough.  The significance of this result is addressed by Henry Yuen (one of the authors) in &lt;a href=&quot;https://quantumfrontiers.com/2020/03/01/the-shape-of-mip-re/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post&lt;/a&gt;.  Scott Aaronson also lists some of the major implications in &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=4512&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For a non-local game (&lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;), define the supremum of success probabilities for non-relativistic tensor product strategies as &lt;span class=&quot;math-container&quot;&gt;$\omega^\ast(G)$&lt;/span&gt;, and the supremum of success probabilities for a relativistic commuting operator (QFT) strategy as &lt;span class=&quot;math-container&quot;&gt;$\omega^{co}(G)$&lt;/span&gt;.  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, &lt;span class=&quot;math-container&quot;&gt;$\omega^\ast(G) \le \omega^{co}(G)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My understanding of Yuen's post is that one consequence of &lt;span class=&quot;math-container&quot;&gt;$MIP^\ast=RE$&lt;/span&gt; is that non-local games exist for which &lt;span class=&quot;math-container&quot;&gt;$\omega^\ast(G) &amp;lt; \omega^{co}(G)$&lt;/span&gt;.  Specifically, he says&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;There must be a game &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, then, for which the quantum value is different&#xA;from the commuting operator value. But this implies Tsirelson’s&#xA;problem has a negative answer, and therefore Connes’ embedding&#xA;conjecture is false.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;The first part of my question is, &lt;em&gt;assuming this proof stands&lt;/em&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does &lt;span class=&quot;math-container&quot;&gt;$MIP^\ast=RE$&lt;/span&gt; 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)?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\omega^\ast(G) &amp;lt; 0.5$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega^{co}(G) &amp;gt; 0.5$&lt;/span&gt;?  Specifically, the second part of my question is:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does &lt;span class=&quot;math-container&quot;&gt;$MIP^\ast=RE$&lt;/span&gt; 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?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; Henry Yuen has created an &lt;a href=&quot;http://mipstar.henryyuen.net/doku.php&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIP* Wiki&lt;/a&gt; for those interested in better understanding this complexity class or the &lt;span class=&quot;math-container&quot;&gt;$MIP^\ast = RE$&lt;/span&gt; result.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-11-30T21:02:04.553" LastActivityDate="2020-11-30T21:02:04.553" Title="Consequences of $MIP^\ast=RE$ Regarding Quantum Algorithms" Tags="&lt;circuit-construction&gt;&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13348" PostTypeId="1" AcceptedAnswerId="13461" CreationDate="2020-08-16T17:12:35.913" Score="4" ViewCount="173" Body="&lt;p&gt;I am reading &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0408063.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Distance measures to compare real and ideal quantum processes&lt;/a&gt; and it is explained the motivation behind Bures metric and angle metric.&lt;/p&gt;&#xA;&lt;p&gt;Bures metric is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B(\rho,\sigma)=\sqrt{2-2 F(\rho,\sigma)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Angle metric is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A(\rho,\sigma)=\arccos(\sqrt{F(\rho,\sigma)})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)$&lt;/span&gt; is the fidelity between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; density matrices. He says that we can understand such motivation on pure states: we would see it comes from the usual euclidian distance.&lt;/p&gt;&#xA;&lt;p&gt;If I do such calculations, I would define the euclidian distance as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d(X,Y)=||X-Y||=\sqrt{\langle X-Y | X-Y \rangle}=\sqrt{2-2 Re(\langle X | Y \rangle)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To find the Bure metric I have to assume &lt;span class=&quot;math-container&quot;&gt;$\langle X | Y \rangle \geq 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But why would it be the case ? For instance if I consider:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = | a \rangle + |b \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I cannot change the relative phase between &lt;span class=&quot;math-container&quot;&gt;$|a \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b \rangle$&lt;/span&gt; as I want (because it would change the physical state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;). Thus if &lt;span class=&quot;math-container&quot;&gt;$\langle a | b \rangle $&lt;/span&gt; is not a positive number I guess there is nothing much I can do for that.&lt;/p&gt;&#xA;&lt;p&gt;How to understand the intuition behind such metric then? Should I actually consider it as an &amp;quot;abstract&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;Similar question for the angle metric.&lt;/p&gt;&#xA;&lt;p&gt;[edit]: I think it might come from the fact we want to define a distance between &lt;strong&gt;physical&lt;/strong&gt; states. Considering &lt;span class=&quot;math-container&quot;&gt;$|\Phi \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$| \Psi \rangle$&lt;/span&gt; two physical state, their global phase do not matter. Thus, to have a simple formula we can choose their phases &lt;span class=&quot;math-container&quot;&gt;$\phi_{\Psi}, \phi_{\Phi}$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$\langle \Psi | \Phi \rangle \geq 0$&lt;/span&gt; which correspond to the upper bound: &lt;span class=&quot;math-container&quot;&gt;$\sup_{\phi_{\Psi}, \phi_{\Phi}}(Re[\langle \Psi | \Phi \rangle])=\langle \Psi | \Phi \rangle$&lt;/span&gt;. It somehow makes sense because we are interested into distance between &lt;strong&gt;physical&lt;/strong&gt;&#xA;and not mathematical states. We can thus fix the global phases of the two states as we would like.&lt;/p&gt;&#xA;&lt;p&gt;Does that make sense ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2020-08-23T11:03:23.230" LastActivityDate="2020-08-25T10:26:53.197" Title="What is the intuition behind Bures and angle metrics?" Tags="&lt;fidelity&gt;&lt;state-space-geometry&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13349" PostTypeId="1" CreationDate="2020-08-16T18:39:51.447" Score="1" ViewCount="22" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho\in\mathrm{D}(\mathcal H)$&lt;/span&gt; be a state in some (finite-dimensional) Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt; and suppose that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{rank}(\rho)=r$&lt;/span&gt;.&#xA;This means that we can write it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_{k=1}^r p_k \mathbb P_{u_k}, \quad\text{with}\quad p_k&amp;gt;0, \,\,\sum_k p_k=1, \,\, \mathbb P_{u_k}\equiv \lvert u_k\rangle\!\langle u_k\rvert.\tag1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The set of &lt;em&gt;purifications&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is easily characterised as the set of states &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\ket\psi\in\mathcal H\otimes \mathcal H_A$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\dim\mathcal H_A=r$&lt;/span&gt;, that have the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ket\psi=\sum_{k=1}^r \sqrt{p_k} \ket{u_k}\otimes\ket{v_k},\tag2$$&lt;/span&gt;&#xA;for any orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{\ket{v_k}\}_{k=1}^r\subset \mathcal H_{A}$&lt;/span&gt;.&#xA;We can of course also consider purifications with larger ancillary spaces, but those would be trivially reducible to the case with &lt;span class=&quot;math-container&quot;&gt;$\dim\mathcal H_A=r$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Consider now the more general set of &lt;em&gt;extensions&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;This is the set of states &lt;span class=&quot;math-container&quot;&gt;$\tilde\rho\in\mathrm{D}(\mathcal H\otimes\mathcal H_A)$&lt;/span&gt;, for some auxiliary space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_A$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_A\tilde\rho=\rho$&lt;/span&gt;. An example of a non-pure extension for a qubit can be found &lt;em&gt;e.g.&lt;/em&gt; &lt;a href=&quot;https://physics.stackexchange.com/a/439119/58382&quot;&gt;in this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; that uses a bipartite auxiliary space, &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_A=\mathcal H_B\otimes\mathcal H_C$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$\ket{v_k}\in\mathcal H_B\otimes\mathcal H_C$&lt;/span&gt;, and then tracing out &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_C$&lt;/span&gt; gives&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\newcommand{\ketbra}[2]{\lvert #1\rangle\!\langle #2\rvert}&#xA;\tilde\rho&#xA;  = \sum_k \sqrt{p_j p_k} \ketbra{u_j}{u_k}\otimes \operatorname{Tr}_C[\ketbra{v_j}{v_k}] &#xA;  = \sum_k \sqrt{p_j p_k} \ketbra{u_j}{u_k}\otimes \sigma_{jk},&#xA;\tag3&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_{jk}\equiv \operatorname{Tr}_C[\ketbra{v_j}{v_k}]\in\mathrm{Lin}(\mathcal H_B)$&lt;/span&gt; is such that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\sigma_{jk})=\delta_{jk}$&lt;/span&gt;.&#xA;Any extension can be written as (3), as if &lt;span class=&quot;math-container&quot;&gt;$\tilde\rho$&lt;/span&gt; is a generic extension, then its purification has the form in Eq. (2), and then partial tracing we get the form in Eq. (3).&lt;/p&gt;&#xA;&lt;p&gt;Are there nicer/more elegant/terser characterisations for the set of extensions of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-16T18:39:51.447" Title="Is there a nice characterisation for the set of extensions of a given state?" Tags="&lt;quantum-state&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13350" PostTypeId="1" CreationDate="2020-08-16T19:25:27.030" Score="2" ViewCount="56" Body="&lt;p&gt;So when trying to load my account I get this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ibmqfactory._initialize_providers:WARNING:2020-08-16 17:47:17,410: Unable to instantiate provider for {'hub': 'ibm-q', 'group': 'open', 'project': 'main'}: &amp;quot;{'online_date': ['Not a valid datetime.']}&amp;quot;&#xA;ibmqfactory.load_account:WARNING:2020-08-16 17:47:17,411: No Hub/Group/Projects could be found for this account. &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have tried changing the date format on my machine but other than that I'm lost.&lt;/p&gt;&#xA;" OwnerUserId="12975" LastEditorUserId="55" LastEditDate="2020-08-18T08:55:47.203" LastActivityDate="2021-05-15T12:09:00.863" Title="Qiskit IBMQ.load_account fails on version 0.20.0" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13351" PostTypeId="1" CreationDate="2020-08-16T19:42:16.393" Score="3" ViewCount="92" Body="&lt;p&gt;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 (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9503016.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elementary gates for quantum computation&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="9006" LastEditDate="2020-08-17T08:04:25.500" LastActivityDate="2020-08-17T08:04:25.500" Title="Can you take infinitely many square roots of Pauli-X?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13353" PostTypeId="2" ParentId="13351" CreationDate="2020-08-16T20:37:10.310" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In the case of the Pauli X matrix, the eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle +|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle\langle -|$&lt;/span&gt; so you can find roots like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X^s = \frac{1}{2}\begin{bmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp;1\end{bmatrix} + \frac{e^{i \pi s}}{2}\begin{bmatrix} 1 &amp;amp; -1 \\ -1 &amp;amp; 1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once that's done the actual challenge is realizing &lt;span class=&quot;math-container&quot;&gt;$X^s$&lt;/span&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1403.2975&quot; rel=&quot;nofollow noreferrer&quot;&gt;using a series of H and T gates&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that, for performing a many-controlled NOT, there are more efficient ancilla-free constructions than the one you linked: &lt;a href=&quot;https://algassert.com/circuits/2015/06/22/Using-Quantum-Gates-instead-of-Ancilla-Bits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/circuits/2015/06/22/Using-Quantum-Gates-instead-of-Ancilla-Bits.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-16T20:37:10.310" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13354" PostTypeId="1" AcceptedAnswerId="13364" CreationDate="2020-08-16T23:50:42.913" Score="1" ViewCount="119" Body="&lt;p&gt;This could be seen as a followup to the question &amp;quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6314/how-to-calculate-the-distance-of-stabilizer-code&quot;&gt;How to calculate the distance of stabilizer code?&lt;/a&gt;&amp;quot;. Summarizing the accepted answer : distance is the minimum weight of the set&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E = \bigl\{e : e \not \in S, e \in \mathrm{Nor}(P_N,S)/(\pm I)  \bigr\}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the stabilizer group (generated by &lt;span class=&quot;math-container&quot;&gt;$K_n$&lt;/span&gt;'s in the previous question), and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Nor}(P_N,S)$&lt;/span&gt; is its&#xA;normalizer in the Pauli group of order &lt;span class=&quot;math-container&quot;&gt;$2^{2N+1}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;=number of qubits; using real version of group here).&lt;/p&gt;&#xA;&lt;p&gt;My question is the following: does this hold for &lt;span class=&quot;math-container&quot;&gt;$k=0$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\tfrac{1}{\sqrt 2}\bigl(\lvert00\rangle + \lvert11\rangle\bigr)$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$K_1=X_1X_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$K_2=Z_1Z_2$&lt;/span&gt;. In this case, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Nor}(P,S)=\pm S$&lt;/span&gt;, so the set &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is empty. Something is obviously broken in this process: I think that the distance should be 2. What's going on here?&lt;/p&gt;&#xA;" OwnerUserId="12265" LastEditorUserId="124" LastEditDate="2020-08-17T09:26:01.647" LastActivityDate="2020-09-07T18:39:25.593" Title="How to calculate distance of $k=0$ stabilizer code?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13355" PostTypeId="1" CreationDate="2020-08-17T02:48:48.487" Score="1" ViewCount="26" Body="&lt;p&gt;Qiskit's function &lt;code&gt;CompleteMeasFitter&lt;/code&gt; builds a calibration matrix in this way (2 qubit case):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Everything is initialized in the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, which is the usual case for IBM hardware.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, it just measures the proportion of counts for &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle, |11\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, it applies an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the second qubit, then measures the counts for all 4 states.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, it applies an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the first qubit, then measures the counts for all 4 states.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, it applies an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to both qubits, then measures the counts for all 4 states.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; case the calibration matrix is picking up the &lt;em&gt;&lt;strong&gt;measurement error&lt;/strong&gt;&lt;/em&gt;.&lt;br&gt;&#xA;In all other cases, the calibration matrix is picking up measurement error &lt;em&gt;&lt;strong&gt;plus some gate error&lt;/strong&gt;&lt;/em&gt;.&lt;br&gt;&#xA;For states involving more 1s, the calibration matrix elements are &lt;em&gt;&lt;strong&gt;less pure&lt;/strong&gt;&lt;/em&gt; (there's more errors).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there a &lt;em&gt;&lt;strong&gt;consequence&lt;/strong&gt;&lt;/em&gt; of this? E.g. the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; counts will be corrected better than the others?&lt;br&gt;&lt;/li&gt;&#xA;&lt;li&gt;Is there any way to mitigate this bias?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-14T03:58:03.250" LastActivityDate="2021-03-14T03:58:03.250" Title="There seems to be a bias against states with more 1s, in IBM's calibration matrix generator: What are the consequences and possible solutions?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;noise&gt;&lt;error-mitigation&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13356" PostTypeId="5" CreationDate="2020-08-17T02:55:22.307" Score="0" Body="" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-08-17T02:55:22.307" LastActivityDate="2020-08-17T02:55:22.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13357" PostTypeId="4" CreationDate="2020-08-17T02:55:22.307" Score="0" Body="For questions about QEM (Quantum Error Mitigation) which is different from Quantum Error Correction in that no extra qubits are used. " OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-08-17T02:55:22.307" LastActivityDate="2020-08-17T02:55:22.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13358" PostTypeId="1" CreationDate="2020-08-17T03:10:07.640" Score="7" ViewCount="1167" Body="&lt;p&gt;If I were to create a circuit with the following gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}R_\phi = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i \phi} \end{bmatrix},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; 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 &amp;quot;run&amp;quot; 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 &amp;quot;apply&amp;quot; any gate at all?&lt;/p&gt;&#xA;&lt;p&gt;While the two cases would ideally be equivalent, in practice the one where &amp;quot;nothing&amp;quot; is done, would be less susceptible to error, which could make a significant difference in the outcomes we observe.&lt;/p&gt;&#xA;&lt;p&gt;Likewise, if we put two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;To what extent does IBM's software and firmware &amp;quot;compile&amp;quot; circuits like this?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-08-17T13:49:15.230" LastActivityDate="2020-08-17T13:49:15.230" Title="Would IBM's &quot;compiler&quot; turn my identity circuit into nothing?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;&lt;ibm&gt;&lt;compiling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13359" PostTypeId="5" CreationDate="2020-08-17T03:13:26.863" Score="0" Body="" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-08-17T03:13:26.863" LastActivityDate="2020-08-17T03:13:26.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13360" PostTypeId="4" CreationDate="2020-08-17T03:13:26.863" Score="0" Body="For questions about compiling problems on quantum hardware. For annealing devices, this can include minor-embedding, quadratization, and other types of gadgetization; while for circuit-based devices this can include anything necessary to get a circuit running on a particular hardware." OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-08-17T03:13:26.863" LastActivityDate="2020-08-17T03:13:26.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13361" PostTypeId="1" CreationDate="2020-08-17T03:35:17.680" Score="2" ViewCount="58" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10455" LastEditorUserId="9006" LastEditDate="2020-08-17T08:07:33.247" LastActivityDate="2020-12-01T03:34:39.747" Title="How to implement gate error mitigation in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13362" PostTypeId="2" ParentId="13358" CreationDate="2020-08-17T03:56:41.300" Score="9" Body="&lt;p&gt;Any compilation/circuit optimization happens transparently by Qiskit. As a user you have control over what happens via the &lt;code&gt;optimization_level&lt;/code&gt; argument passed to &lt;code&gt;transpile()&lt;/code&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="2293" LastEditDate="2020-08-17T13:43:29.377" LastActivityDate="2020-08-17T13:43:29.377" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13363" PostTypeId="1" AcceptedAnswerId="13375" CreationDate="2020-08-17T08:22:22.010" Score="1" ViewCount="77" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7648" LastEditorUserId="55" LastEditDate="2020-08-27T12:51:55.657" LastActivityDate="2020-08-27T12:51:55.657" Title="Is a 2nd course on Quantum Mechanics helpful for research in Quantum Information/Computing?" Tags="&lt;research&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-08-27T12:54:05.913" ContentLicense="CC BY-SA 4.0" />
  <row Id="13364" PostTypeId="2" ParentId="13354" CreationDate="2020-08-17T10:17:16.347" Score="3" Body="&lt;p&gt;Note that in the case &lt;span class=&quot;math-container&quot;&gt;$k = 0$&lt;/span&gt;, the stabiliser 'code' is a &lt;span class=&quot;math-container&quot;&gt;$2^0 = 1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;code distance&amp;quot; is ultimately defined in terms of the minimum weight of a Pauli operator &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; which is not 'detectable' (by which I mean, distinguishable from the identity) according to the Knill–Laflamme conditions:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi_j \rvert E \lvert \psi_k \rangle = C_E \delta_{j,k} $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_j \rangle, \lvert \psi_k \rangle$&lt;/span&gt; are states in the code. In the case of a 1-dimensional subspace, there is only a single state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle =: \lvert \psi_0 \rangle$&lt;/span&gt;. Thus we would take &lt;span class=&quot;math-container&quot;&gt;$j,k \in \{ 0 \}$&lt;/span&gt;, so that the &lt;span class=&quot;math-container&quot;&gt;$\delta_{j,k}$&lt;/span&gt; term is always equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. But that means that by simply defining &lt;span class=&quot;math-container&quot;&gt;$C_E = \langle \psi \rvert E \lvert \psi \rangle$&lt;/span&gt;, the Knill–Laflamme condition is always satisfied.&#xA;Thus, the 'distance' of the code is defined for a &lt;span class=&quot;math-container&quot;&gt;$k = 0$&lt;/span&gt; stabiliser code as the minimum over the empty set.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$k = 0$&lt;/span&gt; operators which map the state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;According to your conventions, it could possibly be sensible to talk about the distance as being &lt;em&gt;infinite&lt;/em&gt;; but in practise it would be better to say that the distance is undefined.&lt;/p&gt;&#xA;" OwnerUserId="124" LastActivityDate="2020-08-17T10:17:16.347" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13365" PostTypeId="1" AcceptedAnswerId="13369" CreationDate="2020-08-17T12:07:01.157" Score="1" ViewCount="51" Body="&lt;p&gt;For example, the 5-qubit QECC.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$X_i, Y_i, Z_i$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, how comes that a change in the target qubit could influence the measurement of the control qubit? For example, if &lt;span class=&quot;math-container&quot;&gt;$X_0$&lt;/span&gt; appears, why is the measurement result of ancilla qubit be 0100?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/FzRR0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FzRR0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9Lf5Z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9Lf5Z.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2020-08-17T19:55:14.930" Title="What's the relation between the sign of error correction code and commute of operators?" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13366" PostTypeId="1" AcceptedAnswerId="13376" CreationDate="2020-08-17T12:47:41.097" Score="2" ViewCount="72" Body="&lt;p&gt;I am trying to solve the problem of optimization (VRP) with genetic algorithm and quantum computing in the platform IBM Q Experience.&#xA;But I am unable to advance on this. How can I do it?&#xA;According to my understanding of quantum computing, we cannot apply the two processes of crossover and mutation in their classic sense.&lt;/p&gt;&#xA;" OwnerUserId="12982" LastEditorUserId="9006" LastEditDate="2020-08-18T06:53:42.677" LastActivityDate="2020-08-18T06:58:27.977" Title="How can I solve the problem of optimisation the quantum computer?" Tags="&lt;ibm-q-experience&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13367" PostTypeId="2" ParentId="13350" CreationDate="2020-08-17T14:19:33.347" Score="0" Body="&lt;p&gt;This looks like this issue: &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/issues/677&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ibmq-provider/issues/677&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can you verify the version of your qiskit elements by doing&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;print(qiskit.__qiskit_version__)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-08-17T14:19:33.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13368" PostTypeId="1" CreationDate="2020-08-17T15:11:37.987" Score="5" ViewCount="179" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What benefits (or predicted benefits) are there using quantum machine learning?&lt;/li&gt;&#xA;&lt;li&gt;Is there little benefit now, but the potential for performance increases when hardware improves?&lt;/li&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12955" LastActivityDate="2021-05-15T07:05:25.607" Title="What are the benefits of using quantum machine learning?" Tags="&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;pennylane&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13369" PostTypeId="2" ParentId="13365" CreationDate="2020-08-17T15:43:37.370" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.  Also, the &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; wire is generally a bundle of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; wires, and the gate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; acts on all of them (in your example, it is a five-qubit state, and each single-qubit Pauli is &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;), but for this example let's just assume it's a single qubit.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, we can call these two eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|\phi_+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_-\rangle$&lt;/span&gt;, and write the input state in this basis &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \alpha |\phi_+\rangle + \beta |\phi_-\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jxpyH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jxpyH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Working out the action of the circuit, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|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)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\phi_+\rangle$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; just a ray in Hilbert space, but you can imagine other projectors like &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; which define even/odd subspaces, not rays.&lt;/p&gt;&#xA;&lt;p&gt;If we intentionally prepare &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = |\phi_+\rangle$&lt;/span&gt;, then the ancilla can only ever give 0, because no part of the data state lies in the negative eigen(sub)space (&lt;span class=&quot;math-container&quot;&gt;$\alpha=1, \beta=0$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Now, what happens if some error &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; occurs, somewhere before the gate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;?  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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XU8mk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XU8mk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Assume that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UP = PU \rightarrow PU|\phi_+\rangle = U|\phi_+\rangle&#xA;$$&lt;/span&gt;&#xA;so the new error state &lt;span class=&quot;math-container&quot;&gt;$U|\phi_+\rangle$&lt;/span&gt; still has eigenvalue +1 under &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;.  Meauring the ancilla can still only ever give &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (i.e &lt;span class=&quot;math-container&quot;&gt;$m_Z = +1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Now assume that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; anti-commutes with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UP = -PU \rightarrow PU|\phi_+\rangle = -U|\phi_+\rangle&#xA;$$&lt;/span&gt;&#xA;Now the state that was supposed to be in the positive eigenspace has eigenvalue -1 under &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; due to the error, so the spaces have flipped!  This means the ancilla can only ever give &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; upon measurement (i.e. &lt;span class=&quot;math-container&quot;&gt;$m_Z = -1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;In this way, errors (&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) that commute with the stabilizers (&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;) 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.&lt;/p&gt;&#xA;&lt;p&gt;(image credit to TU Delft Fundamentals of Quantum Information course notes)&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2020-08-17T19:55:14.930" LastActivityDate="2020-08-17T19:55:14.930" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13370" PostTypeId="2" ParentId="13368" CreationDate="2020-08-17T17:48:27.187" Score="0" Body="&lt;p&gt;Check out these resources. It shows how QML might turn out to be in the future, see &lt;a href=&quot;https://ibm-q4ai.mybluemix.net/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q for AI&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In case of quantum-inspired algorithms, when the dataset meets certain conditions, it might be better than the classical approaches, see &lt;a href=&quot;https://arxiv.org/abs/1905.10415&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum-inspired algorithms in practice&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10425" LastEditorUserId="9006" LastEditDate="2020-08-18T06:50:02.863" LastActivityDate="2020-08-18T06:50:02.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13371" PostTypeId="1" AcceptedAnswerId="13372" CreationDate="2020-08-17T18:18:39.467" Score="0" ViewCount="83" Body="&lt;p&gt;I have some questions about the Choi-Jamiolkowski isomorphism.&lt;/p&gt;&#xA;&lt;p&gt;I remind how it can be defined. First, we define &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{I}_{H_0} \rangle \rangle \in H_0 \otimes H_0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\mathcal{I}_{H_0} \rangle \rangle = \sum_i |i i \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the family &lt;span class=&quot;math-container&quot;&gt;$\{ |i\rangle \}_i $&lt;/span&gt; is an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;C.J isomorphism: pure case&lt;/h2&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$X \in \mathcal{L}(H_0, H_1)$&lt;/span&gt;, the C.J isomorphism consist in associating to this linear operator, a kets &lt;span class=&quot;math-container&quot;&gt;$|X \rangle \rangle \in H_1 \otimes H_0 $&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |X \rangle \rangle \equiv ( X \otimes I_{H_0} ) |\mathcal{I}_{H_0} \rangle \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A little calculation shows that the isomorphism simply consists in performing the following mapping:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Basically we replace: &lt;span class=&quot;math-container&quot;&gt;$|i\rangle \langle j | \in \mathcal{L}(H_0,H_1) \leftrightarrow |i,j \rangle \rangle \in H_1 \otimes H_0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;C.J isomorphism: mixed case&lt;/h2&gt;&#xA;&lt;p&gt;The mixed case consist in associating linear operator to quantum map. Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M} \in \mathcal{L}(\mathcal{L}(H_0),\mathcal{L}(H_1))$&lt;/span&gt;. We define the Choi matrix &lt;span class=&quot;math-container&quot;&gt;$M \in \mathcal{L}(H_1 \otimes H_0)$&lt;/span&gt; such that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{C}(\mathcal{M}) \equiv (\mathcal{M} \otimes \mathcal{I}_{H_0}) (|\mathcal{I}_{H_0} \rangle \rangle \langle \langle \mathcal{I}_{H_0} | )$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We notice the strong analogy with the definition of the Choi isomorphism for the pure case.&lt;/p&gt;&#xA;&lt;h2&gt;My questions&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is there an analog &amp;quot;easy&amp;quot; definition for the Choi isomorphism in the mixed case as there were in the pure case with &lt;span class=&quot;math-container&quot;&gt;$|i \rangle \langle j| \leftrightarrow |i,j \rangle \rangle$&lt;/span&gt; ? Or should we always take the &amp;quot;brute force&amp;quot; definition to calculate the isomorphism ?&lt;/li&gt;&#xA;&lt;li&gt;Why is this isomorphism important ? I have seen &lt;a href=&quot;https://physics.stackexchange.com/questions/270032/whats-the-intuition-behind-the-choi-jamiolkowski-isomorphism&quot;&gt;this post&lt;/a&gt; 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.&lt;/li&gt;&#xA;&lt;li&gt;Are there typical relationship between the pure and mixed case ? I managed to prove that if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}(\rho)=U \rho U^{\dagger}$&lt;/span&gt; is a unitary map, then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}(\mathcal{U})=|U \rangle \rangle \langle \langle U |$&lt;/span&gt;. But are there some other usefull relationship ?&lt;/li&gt;&#xA;&lt;li&gt;(related to my second question): I checked and it seems that the mixed isomorphism is different from the &amp;quot;natural&amp;quot; isomorphism we would consider to associate matrix to quantum map. Basically where the inputs (density matrices) would be replaced by vector: &lt;span class=&quot;math-container&quot;&gt;$|i \rangle \langle j | \rightarrow |i,j\rangle$&lt;/span&gt; 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 ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-08-24T09:26:35.910" LastActivityDate="2020-08-24T09:26:35.910" Title="Some questions to get intuition on Choi isomorphism" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-08-20T22:09:39.547" ContentLicense="CC BY-SA 4.0" />
  <row Id="13372" PostTypeId="2" ParentId="13371" CreationDate="2020-08-17T19:14:47.410" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Is there an analog &amp;quot;easy&amp;quot; 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 &amp;quot;brute force&amp;quot; definition to calculate the isomorphism ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; should be a &lt;em&gt;linear&lt;/em&gt; map - therefore, if you define the action of &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; on a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{0}$&lt;/span&gt;, &lt;em&gt;everything that &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; can do&lt;/em&gt; to any state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is encoded into that information.&lt;/p&gt;&#xA;&lt;p&gt;Lets pick the most straightforward basis (actually, it's not really a basis for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{0}$&lt;/span&gt; that we use but for the space of &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; matrices, where &lt;span class=&quot;math-container&quot;&gt;$d=2^{n}$&lt;/span&gt;): &lt;span class=&quot;math-container&quot;&gt;$$\{|i\rangle\langle j|\}\,\,\,\,\forall i,j \in \{1,...,d\},$$&lt;/span&gt; this gives us &lt;span class=&quot;math-container&quot;&gt;$d^{2}$&lt;/span&gt; elements. &lt;strong&gt;All information&lt;/strong&gt; about &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is encoded into the following &lt;span class=&quot;math-container&quot;&gt;$d^{2}$&lt;/span&gt; elements:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\{\Lambda\left(|i\rangle\langle j|\right)\}\,\,\,\,\forall i,j \in \{1,...,d\}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Choi matrix the above &lt;span class=&quot;math-container&quot;&gt;$d^{2}$&lt;/span&gt; elements, but then not as a list, but we put the &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt;-th element of that list (which is a &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; matrix) into a new matrix as the &lt;span class=&quot;math-container&quot;&gt;$(i,j)$&lt;/span&gt;-th element: we get a &lt;span class=&quot;math-container&quot;&gt;$d \times d$&lt;/span&gt; block matrix where each entry is itself a &lt;span class=&quot;math-container&quot;&gt;$d \times d$&lt;/span&gt; matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\mathrm{Choi}} = &#xA;\begin{bmatrix}&#xA;\Lambda\left(|0\rangle\langle 0|\right) &amp;amp; \Lambda\left(|0\rangle\langle 1|\right) &amp;amp; \dots &amp;amp; \Lambda\left(|0\rangle\langle d-1|\right)  \\ &#xA;\Lambda\left(|1\rangle\langle 0|\right) &amp;amp; \Lambda\left(|1\rangle\langle 1|\right) &amp;amp; \dots &amp;amp; \Lambda\left(|1\rangle\langle d-1|\right)  \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots  \\ &#xA;\Lambda\left(|d-1\rangle\langle 0|\right) &amp;amp; \Lambda\left(|d-1\rangle\langle 1|\right) &amp;amp; \dots &amp;amp; \Lambda\left(|d-1\rangle\langle d-1|\right) \\ &#xA;\end{bmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From this point of view, it is pretty clear that the Choi matrix is a clever way of writing down the information encoded into &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The important thing to notice&lt;/strong&gt; is that the above matrix is &lt;em&gt;always&lt;/em&gt; a valid density matrix, which is obvious from your definition.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The Choi-Jamiolkowski isomorphism states that having &lt;span class=&quot;math-container&quot;&gt;$d^{2}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The process fidelity of a map &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is the same as the state fidelity of it's Choi matrix.&lt;/li&gt;&#xA;&lt;li&gt;The CP constraint of &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; translates nicely into the positive-semidefiniteness of the Choi matrix.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;However, it is important that not all properties translate nicely. The TP constraint on &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; is a stronger constraint than &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; just having unit trace. &lt;strong&gt;This also means that not all &lt;span class=&quot;math-container&quot;&gt;$d^{2} \times d^{2}$&lt;/span&gt; density matrices represent a &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; map!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I believe that the first answer answers this question as well. If you have some other representation of &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; (e.g. a Kraus representation, it's &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; matrix or a &lt;a href=&quot;https://en.wikipedia.org/wiki/Stinespring_factorization_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stinespring dilation&lt;/a&gt;) there exist nice ways of translating one representation into another, but I guess that this is best asked as a separate question (and for the &lt;span class=&quot;math-container&quot;&gt;$\chi \leftrightarrow \rho_{\mathrm{Choi}}$&lt;/span&gt; translation I already have an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11814/8141&quot;&gt;answer&lt;/a&gt; on a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11806/8141&quot;&gt;previous question&lt;/a&gt;; the Kraus decomposition should be really straightforward as well).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(related to my second question): I checked and it seems that the mixed isomorphism is different from the &amp;quot;natural&amp;quot; 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 ?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is indeed not the same as the Choi matrix. Rather, this would be a representation sometimes just called the &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0504091.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;superoperator representation&lt;/a&gt;. It isn't used that often though, because both the CP and the TP constraints (&lt;em&gt;especially the TP&lt;/em&gt;) are &lt;strong&gt;really&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-08-18T09:19:44.747" LastActivityDate="2020-08-18T09:19:44.747" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13373" PostTypeId="1" AcceptedAnswerId="13396" CreationDate="2020-08-17T19:53:38.770" Score="4" ViewCount="213" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1⟩$&lt;/span&gt; are usually referred as the computational basis. &lt;span class=&quot;math-container&quot;&gt;$|+⟩$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-⟩$&lt;/span&gt;, the polar basis.&lt;/p&gt;&#xA;&lt;p&gt;What about &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\mbox{-}i\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22Bloch%22,%22Bloch%22,%22Bloch%22,%22Bloch%22,%22Bloch%22,%22Bloch%22%5D%5D,%22init%22:%5B0,1,%22+%22,%22-%22,%22i%22,%22-i%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/slwyQ.png&quot; alt=&quot;basis in Quirk&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And collectively? Orthonormal states?&lt;/p&gt;&#xA;&lt;p&gt;References are welcomed!&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-08-19T12:40:41.533" LastActivityDate="2020-08-20T10:49:26.350" Title="Terminology: what do $|i\rangle$ and $|\mbox{-}i\rangle$ represent?" Tags="&lt;quantum-state&gt;&lt;terminology&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13374" PostTypeId="2" ParentId="13373" CreationDate="2020-08-17T20:42:33.593" Score="4" Body="&lt;p&gt;Quirk &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Amps1%22%2C%22Amps1%22%2C%22Amps1%22%2C%22Amps1%22%5D%5D%2C%22init%22%3A%5B0%2C%22%2B%22%2C%22i%22%2C%22-i%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;refers to&lt;/a&gt; the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle + \frac{i}{\sqrt{2}}|1\rangle$&lt;/span&gt; state as &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and to the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle - \frac{i}{\sqrt{2}}|1\rangle$&lt;/span&gt; state as &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Amps1%22%2C%22Amps1%22%2C%22Amps1%22%2C%22Amps1%22%5D%5D%2C%22init%22%3A%5B0%2C%22%2B%22%2C%22i%22%2C%22-i%22%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k10BS.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-17T20:42:33.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13375" PostTypeId="2" ParentId="13363" CreationDate="2020-08-18T01:13:00.607" Score="4" Body="&lt;p&gt;If you want an excellent answer, you will have to say what &amp;quot;2nd course in QM&amp;quot; means, by specifying which exact topics will be covered, other than just &amp;quot;perturbation theory&amp;quot;, 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.&lt;/p&gt;&#xA;&lt;p&gt;However, I can already give a decent answer with what you've provided so far:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Can someone confirm whether perturbation theory has anything to do&#xA;with QI/QC?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There's several benefits of learning perturbation theory.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;1) Even for the &amp;quot;theoretical computer science&amp;quot; aspect of QI/QC:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&amp;quot;Perturbative gadgets&amp;quot; first introduced by Kitaev, Kempe &amp;amp; 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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;2) At the hardware level:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;3) On an academic level:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Even if you just want to do more &amp;quot;hardcore&amp;quot; quantum information, such as studying multi-partite entanglement witnesses, quantum discord, quantum &amp;quot;contextuality&amp;quot;, or thinking about interesting &amp;quot;quantum games&amp;quot; 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.&lt;/li&gt;&#xA;&lt;li&gt;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).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;4) Outside of QM:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I am speaking from experience:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I personally did &lt;strong&gt;not&lt;/strong&gt; 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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Variational Principle (which is now extremely popular if you are to look at the VQE algorithm or the &lt;a href=&quot;https://arxiv.org/abs/1903.04500&quot; rel=&quot;nofollow noreferrer&quot;&gt;variational model for quantum computing&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Advanced mathematics of spin (Clebsch-Gordon coefficients, adding angular momenta, etc.).&lt;/li&gt;&#xA;&lt;li&gt;Perturbation theory (as you mentioned yourself, and I went into detail describing above).&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;I really want to expand my knowledge in QM, but the course is very&#xA;challenging so I don't want to waste much time for something I'll&#xA;barely use.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You said you want to do &amp;quot;&lt;em&gt;&lt;strong&gt;reasearch&lt;/strong&gt;&lt;/em&gt;&amp;quot; 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 &amp;quot;waste of time&amp;quot;, &amp;quot;barely useful&amp;quot;, or &amp;quot;too challenging&amp;quot;. 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).&lt;/p&gt;&#xA;&lt;p&gt;In one of the comments, someone said:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;spherical harmonics/calculating hydrogen orbitals/perturbation theory are not useful for quantum computing.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I have addressed perturbation theory already.&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;em&gt;actually&lt;/em&gt; useful, since people are already switching to post-quantum cryptography). Paragraph 3 of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/2552/2293&quot;&gt;this answer&lt;/a&gt; and the citation marked as &amp;quot;reference 1&amp;quot; claim that QCQC is the one area where quantum computing is &amp;quot;not just hype&amp;quot;.&lt;/li&gt;&#xA;&lt;li&gt;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 &amp;quot;quantum winter&amp;quot; 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 &lt;em&gt;condensed matter physics&lt;/em&gt; 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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-08-18T01:13:00.607" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13376" PostTypeId="2" ParentId="13366" CreationDate="2020-08-18T06:58:27.977" Score="0" Body="&lt;p&gt;Please have a look at this paper: &lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising formulations of many NP problems&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.dwavesys.com/docs/latest/doc_getting_started.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; you can find something more about D-Wave, how it works and how it can be programmed.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-08-18T06:58:27.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13377" PostTypeId="2" ParentId="13340" CreationDate="2020-08-18T08:29:18.010" Score="2" Body="&lt;p&gt;From the &lt;a href=&quot;http://qutip.org/docs/latest/guide/guide-basics.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;official documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;Q.dims&lt;/code&gt;: List keeping track of shapes for individual components of a multipartite system (for tensor products and partial traces).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&#xA;The first element tells you about the number of rows while the second element tells you about the number of columns.&lt;/p&gt;&#xA;&lt;p&gt;Consider as an example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;fooQ = qutip.tensor(qutip.basis(2, 0), qutip.basis(2, 1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is the tensor product of two qubit ket states, thus it's a vector in a space of dimension &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt;. As a matrix, you can represent it as a &lt;span class=&quot;math-container&quot;&gt;$4\times 1$&lt;/span&gt; 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 &lt;code&gt;fooQ.dims == [[2, 2], [1, 1]]&lt;/code&gt;, because there are &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; rows, and &lt;span class=&quot;math-container&quot;&gt;$1=1\times 1$&lt;/span&gt; column.&lt;/p&gt;&#xA;&lt;p&gt;In your example, &lt;code&gt;[[2, 4], [2, 4]]&lt;/code&gt; represents a density matrix in a space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_1\otimes\mathcal H_2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\dim\mathcal H_1=2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\dim\mathcal H_2=4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can retrieve the overall dimensions of the space by doing &lt;em&gt;e.g.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;number_of_rows = np.prod(fooQ.dims[0])&#xA;number_of_cols = np.prod(fooQ.dims[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or you can &amp;quot;unravel&amp;quot; the dimensions, obtaining a list of the dimensions of each individual component space, with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;unravelled_dimensions = np.transpose(fooQ.dims)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-18T08:29:18.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13378" PostTypeId="5" CreationDate="2020-08-18T08:44:52.573" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-18T08:44:52.573" LastActivityDate="2020-08-18T08:44:52.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13379" PostTypeId="4" CreationDate="2020-08-18T08:44:52.573" Score="0" Body="For questions about Mutually Unbiased Bases (MUBs)." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-18T08:44:52.573" LastActivityDate="2020-08-18T08:44:52.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13380" PostTypeId="1" AcceptedAnswerId="13382" CreationDate="2020-08-18T15:03:43.710" Score="2" ViewCount="40" Body="&lt;p&gt;Came across &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6800/maximum-number-of-almost-orthogonal-vectors-one-can-embed-in-hilbert-space&quot;&gt;This question&lt;/a&gt; regarding the maximum number of almost orthogonal vectors one can embed in a Hilbert space. They state that &lt;span class=&quot;math-container&quot;&gt;$N(\frac{1}{2},2)=3$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$N(\frac{1}{\sqrt{2}},2)=6$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle V_i|V_i\rangle = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\langle V_i|V_j\rangle| \leq \epsilon, i \neq j$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="9006" LastEditDate="2020-08-19T07:33:32.660" LastActivityDate="2020-08-19T07:33:32.660" Title="$N(\frac{1}{2},2)=3$ for vectors in a Hilbert Space" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13381" PostTypeId="1" AcceptedAnswerId="13384" CreationDate="2020-08-18T15:39:09.233" Score="2" ViewCount="145" Body="&lt;p&gt;I was wondering if there is any way to present the CNOT matrix as we usually present single qubit operations&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$... 1 \otimes NOT \otimes 1 ...$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I know that for adjacent qubits in a circuit we can present it identically&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$... 1 \otimes CNOT \otimes 1 ...$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But is there a way to present the operation mathematically if there are several CNOTs acting on not neighboring wires?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-08-24T08:58:05.893" LastActivityDate="2020-08-24T08:58:05.893" Title="Is there a good way to mathematically write a CNOT operation over non-neighboring qubits in a circuit?" Tags="&lt;quantum-gate&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2020-08-25T17:25:23.487" ContentLicense="CC BY-SA 4.0" />
  <row Id="13382" PostTypeId="2" ParentId="13380" CreationDate="2020-08-18T15:53:33.460" Score="3" Body="&lt;p&gt;Here's a very visual way to think about this (I make no claim about it being a rigorous proof). Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|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.&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;Now, can I add a fourth vector? Whatever vector I add into the sphere, it must make an angle of &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; or less with one of the existing vectors, and hence would have overlap &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt; or greater. So, at least for this choice of three vectors, I cannot add a fourth and maintain the value of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;With this picture in mind, you can probably also convince yourself that these vectors &lt;em&gt;have&lt;/em&gt; to be selected this way. &lt;span class=&quot;math-container&quot;&gt;$|V_1\rangle$&lt;/span&gt; is arbitrary, I can just orient the view so that it's at the top of the sphere. For &lt;span class=&quot;math-container&quot;&gt;$|V_2\rangle$&lt;/span&gt; I've got an arbitrary freedom of rotation about the &lt;span class=&quot;math-container&quot;&gt;$V_1\rangle$&lt;/span&gt; axis, so I just picked the orthogonal component to be real and positive. At that point, my choice of &lt;span class=&quot;math-container&quot;&gt;$|V_3\rangle$&lt;/span&gt; was fixed - there was only one possible choice that could have the correct overlap.&lt;/p&gt;&#xA;&lt;p&gt;If the visual version doesn't do it for you, I'm sure someone will formalise this mathematically...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-18T15:53:33.460" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13383" PostTypeId="2" ParentId="13381" CreationDate="2020-08-18T15:57:53.277" Score="1" Body="&lt;p&gt;Personally, I just define myself some notation. For example, instead of the NOT that you wrote down, I define &lt;span class=&quot;math-container&quot;&gt;$X_n$&lt;/span&gt; to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X_n=1^{\otimes(n-1)}\otimes X\otimes 1^{\otimes(N-n)}.&#xA;$$&lt;/span&gt;&#xA;Similarly, I might then define &lt;span class=&quot;math-container&quot;&gt;$CNOT^i_j$&lt;/span&gt; to be a controlled-not controlled off &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and targeting &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. If I had to write it out as tensor products, I'd probably do something like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)}&#xA;$$&lt;/span&gt;&#xA;assuming &lt;span class=&quot;math-container&quot;&gt;$j&amp;gt;i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-18T15:57:53.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13384" PostTypeId="2" ParentId="13381" CreationDate="2020-08-18T16:16:14.897" Score="4" Body="&lt;p&gt;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 &amp;quot;adjacent&amp;quot; according to your labeling.  For example, if the basis is ordered like &lt;span class=&quot;math-container&quot;&gt;$1,2,3$&lt;/span&gt;, and you want to perform a CNOT between qubits 1 and 3, then you just write something like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT_{1,3} \otimes I_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the basis is now ordered &lt;span class=&quot;math-container&quot;&gt;$1,3,2$&lt;/span&gt;.  But if you don't want to reorder the basis, there is also another way of writing the CNOT:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes X&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which could include an identity on the state of the second qubit like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|0\rangle\langle0|)_1 \otimes I_2 \otimes I_3 + (|1\rangle\langle1|)_1 \otimes I_2 \otimes X_3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2020-08-18T16:16:14.897" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13385" PostTypeId="2" ParentId="13373" CreationDate="2020-08-18T16:21:47.203" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://www.quantum-inspire.com/kbase/what-is-a-qubit/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is another reference.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\mbox{-}i\rangle$&lt;/span&gt; are two orthogonal y-basis states. In the above link they are called &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|L\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|i\rangle = \frac{1}{\sqrt{2}}\left[&#xA;\begin{array}{c}&#xA;    1 \\&#xA;    i&#xA;\end{array}&#xA;\right] \;\; , \;\; |\mbox{-}i\rangle = \frac{1}{\sqrt{2}}\left[&#xA;\begin{array}{c}&#xA;    1 \\&#xA;    -i&#xA;\end{array}&#xA;\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can simply check the orthonormality by using the definition of inner product space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle v | w\rangle =\sum(v_i^{*} w_i)$&lt;/span&gt;,&#xA;and Kronecker delta function.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle i|i\rangle = [1.1 + (-i).i]/2 = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle i|\mbox{-}i\rangle = [1.1 + (-i).(-i)]/2 = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2020-08-20T07:07:19.990" LastActivityDate="2020-08-20T07:07:19.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13386" PostTypeId="1" AcceptedAnswerId="13392" CreationDate="2020-08-18T17:21:00.260" Score="2" ViewCount="72" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/0904.4483&quot; rel=&quot;nofollow noreferrer&quot;&gt;A theoretical framework for quantum networks&lt;/a&gt; is proven that a linear map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M} \in \mathcal{L}(\mathcal{H_0},\mathcal{H_1})$&lt;/span&gt; is CP (completely positive) iff its Choi operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is semi definite positive. Something confuses me in this derivation.&lt;/p&gt;&#xA;&lt;p&gt;First, some definition reminders.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$X \in \mathcal{L}(H_0,H_1)$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$\{|i \rangle \}_i$&lt;/span&gt; be an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt;, we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  | \mathcal{I} \rangle \rangle \equiv \sum_i |ii \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|X \rangle \rangle \equiv (X \otimes \mathcal{I}) | \mathcal{I} \rangle \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Choi operator is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \mathcal{M} \otimes \mathcal{I}_{H_0} | \mathcal{I} \rangle \rangle \langle \langle \mathcal{I} |$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In his proof, he assumes &lt;span class=&quot;math-container&quot;&gt;$M \geq 0$&lt;/span&gt; the goal is to show that it implies &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; is CP.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is semi definite positive which implies it is hermitian with positive eigenvalues. It can thus be diagonalized. With &lt;span class=&quot;math-container&quot;&gt;$\lambda_i \geq 0$&lt;/span&gt;, we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \sum_i \lambda_i |u_i \rangle \langle u_i |=\sum_i | K_i \rangle \langle K_i |$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$|K_i \rangle = \sqrt{\lambda_i} |u_i \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But he seems to &amp;quot;automatically&amp;quot; consider that &lt;span class=&quot;math-container&quot;&gt;$|K_i \rangle = |K_i \rangle \rangle$&lt;/span&gt;. I don't understand that. Why would we necesseraly have &lt;span class=&quot;math-container&quot;&gt;$|K_i \rangle = (K_i \otimes \mathcal{I}) | \mathcal{I} \rangle \rangle$&lt;/span&gt;. It is a very particular case. Why can the state be written as a local operation acting on a maximally entangled state ?&lt;/p&gt;&#xA;&lt;p&gt;I have a super vague memory that any quantum state can be written as &lt;span class=&quot;math-container&quot;&gt;$(K \otimes \mathbb{I}) | \mathcal{I} \rangle \rangle$&lt;/span&gt;. Said differently, there always exist a linear operation &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; (not necesseraly unitary of course) such that any vector in &lt;span class=&quot;math-container&quot;&gt;$H_1 \otimes H_0$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$K \otimes \mathcal{I} | \mathcal{I} \rangle \rangle$&lt;/span&gt; I guess it would solve the problem. But I cannot find the source of that and I may be totally wrong.&lt;/p&gt;&#xA;&lt;p&gt;In the end, why can we write: &lt;span class=&quot;math-container&quot;&gt;$|K_i \rangle = |K_i \rangle \rangle$&lt;/span&gt;. 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)&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-08-22T07:30:41.833" LastActivityDate="2020-08-22T07:30:41.833" Title="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)$?" Tags="&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13387" PostTypeId="2" ParentId="13386" CreationDate="2020-08-18T18:39:36.573" Score="2" Body="&lt;p&gt;You've already defined the Choi matrix as &lt;span class=&quot;math-container&quot;&gt;$M = \rho_{\mathrm{Choi}} = \left(\mathcal{M}\otimes I\right)(|\mathcal{I}\rangle\rangle\langle\langle\mathcal{I}||)$&lt;/span&gt;. I'm gonna write the maximally entangled state as &lt;span class=&quot;math-container&quot;&gt;$|\mathcal{\Omega}\rangle$&lt;/span&gt; because it's better readable to me and I'm more accustomed to it.&lt;/p&gt;&#xA;&lt;p&gt;You've already pointed out that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; being positive-semidefinite means that we can perform a real-valued spectral decomposition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}}.&#xA;$$&lt;/span&gt;&#xA;We can decompose these &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\lambda_{i}}|u_{i}\rangle$&lt;/span&gt;'s into a tensor product of a basis for both of the copies of the Hilbert spaces:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{\lambda_{i}}|u_{i}\rangle = \sum_{l}|a^{i}_{l}\rangle \otimes |b^{i}_{l}\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which means that we can write:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;M =&amp;amp; \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}| \\&#xA;=&amp;amp; \sum_{i,l,m} |a^{i}_{l}\rangle \langle a^{i}_{m}|  \otimes |b^{i}_{l}\rangle \langle b^{i}_{m}|.&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you may be well aware, we can write the 'output' of the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; on 'input' &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{in}}$&lt;/span&gt;, which thus is &lt;span class=&quot;math-container&quot;&gt;$\rho_{\mathrm{out}} = \mathcal{M}\left(\rho_{\mathrm{in}}\right)$&lt;/span&gt;, in terms of the Choi matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{M}\left(\rho_{\mathrm{in}}\right) = d \mathrm{tr}_{2}\big[M\left(I \otimes \rho_{\mathrm{in}}^{T}\right)\big],&#xA;$$&lt;/span&gt;&#xA;where the trace is the partial trace over the second subsystem, and the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; superscript means the transpose.&lt;/p&gt;&#xA;&lt;p&gt;Now, we plug in our above decomposition for &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\mathcal{M}\left(\rho_{\mathrm{in}}\right) &amp;amp;= d\mathrm{tr}_{2}\big[M\left(I \otimes \rho_{\mathrm{in}}^{T}\right)\big] \\&#xA;&amp;amp;= 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] \\&#xA;&amp;amp;= 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] \\&#xA;&amp;amp;= 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 \\&#xA;&amp;amp;= d\sum_{i,l,m}|a^{i}_{l}\rangle \langle a^{i}_{m}|   \langle b^{*i}_{l}| \rho_{\mathrm{in}}|b^{*i}_{m}\rangle \\&#xA;&amp;amp;= d\sum_{i,l,m}|a^{i}_{l}\rangle    \langle b^{*i}_{l}| \rho_{\mathrm{in}}|b^{*i}_{m}\rangle \langle a^{i}_{m}| \\&#xA;&amp;amp;= \sum_{i} A_{i} \rho_{\mathrm{in}} A_{i}^{\dagger},&#xA;\end{split} &#xA;\end{equation}&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$A_{i} = \sum_{l}\sqrt{d} |a^{i}_{l}\rangle    \langle b^{*i}_{l}|$&lt;/span&gt;. This is just the Kraus decomposition, which is enough for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; being CP.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-08-18T18:39:36.573" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13388" PostTypeId="1" AcceptedAnswerId="13390" CreationDate="2020-08-18T19:42:36.127" Score="0" ViewCount="59" Body="&lt;p&gt;This question is taken from &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/3032&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/issues/3032&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;standard&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="55" LastEditDate="2020-08-24T09:00:37.760" LastActivityDate="2020-08-24T09:00:37.760" Title="What is the analysis of the Bell Inequality protocol in Cirq's 'examples'?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;cirq&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13389" PostTypeId="1" CreationDate="2020-08-18T22:24:54.080" Score="1" ViewCount="29" Body="&lt;p&gt;I would like to know how the gates are defined in quantum random access codes? Consider the &lt;span class=&quot;math-container&quot;&gt;$2 \to 1$&lt;/span&gt; code described in Lemma 3.1 of &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9804043.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Rz(\theta)$&lt;/span&gt; on the first qubit or a CNOT gate on both qubits.&lt;/p&gt;&#xA;&lt;p&gt;How do I do that?&lt;/p&gt;&#xA;" OwnerUserId="1798" LastEditorUserId="9006" LastEditDate="2020-08-19T07:34:34.060" LastActivityDate="2020-08-19T07:34:34.060" Title="Gate definitions for quantum random access codes" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;measurement&gt;&lt;superdense-coding&gt;&lt;qrac&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13390" PostTypeId="2" ParentId="13388" CreationDate="2020-08-19T01:14:42.650" Score="1" Body="&lt;p&gt;The part you're overlooking is these lines:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    # Players do a sqrt(X) based on their referee's coin.&#xA;    circuit.append([&#xA;        cirq.CNOT(alice_referee, alice)**0.5,&#xA;        cirq.CNOT(bob_referee, bob)**0.5,&#xA;    ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-08-20T03:50:03.153" LastActivityDate="2020-08-20T03:50:03.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13391" PostTypeId="1" CreationDate="2020-08-19T01:39:17.257" Score="3" ViewCount="196" Body="&lt;p&gt;Is there a function in Qiskit similar to &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/pauli-measurements&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; function in Q# which measures strings of Pauli operators applied to different qubits?&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="55" LastEditDate="2020-08-24T09:03:51.063" LastActivityDate="2021-05-21T10:06:40.673" Title="Is there a function in Qiskit to measure tensor products of Pauli operators?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;q#&gt;&lt;pauli-gates&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13392" PostTypeId="2" ParentId="13386" CreationDate="2020-08-19T07:29:11.390" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; be a vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|K\rangle=\sum_{ij}K_{ij}|i,j\rangle.&#xA;$$&lt;/span&gt;&#xA;We could rewrite this ias&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|K\rangle=\left(\left(\sum_{ij}K_{ij}|i\rangle\langle j|\right)|j\rangle\right)\otimes|j\rangle,&#xA;$$&lt;/span&gt;&#xA;and this is just the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|K\rangle=K\otimes 1\sum_j|j,j\rangle=|K\rangle\rangle&#xA;$$&lt;/span&gt;&#xA;if we define the matrix &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$K=\sum_{ij}K_{ij}|i\rangle\langle j|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-19T07:29:11.390" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13393" PostTypeId="1" AcceptedAnswerId="13419" CreationDate="2020-08-19T10:11:20.170" Score="2" ViewCount="53" Body="&lt;p&gt;I read an interesting &lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.121.050502&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; of QEC with only two extra qubits.&lt;/p&gt;&#xA;&lt;p&gt;In the paper, there is a circuit. Note that &lt;a href=&quot;https://i.stack.imgur.com/JsJ0N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JsJ0N.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here are some contexts of the paper:&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;The stablizer is &lt;span class=&quot;math-container&quot;&gt;$XZZXI$&lt;/span&gt;. If the second gate fails and introduces an &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt; fault, then this fault will propagate through the subsequent gates to become an &lt;span class=&quot;math-container&quot;&gt;$IIZXI$&lt;/span&gt; error on the data.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Since the stablizer on the second gate is &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, how could it introduce the &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt; fault? &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, isn't it? Why the subsequent gate becomes &lt;span class=&quot;math-container&quot;&gt;$IIZXI$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sBxbr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sBxbr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2020-08-24T09:04:41.457" LastActivityDate="2020-08-24T09:04:41.457" Title="Circuit of quantum error correction code" Tags="&lt;circuit-construction&gt;&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13394" PostTypeId="2" ParentId="13386" CreationDate="2020-08-19T10:26:34.677" Score="0" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\kett}[1]{\lvert #1\rangle\!\rangle}\newcommand{\ket}[1]{\lvert#1\rangle}\ket m\equiv \sum_k \ket{k,k}$&lt;/span&gt; denote the (unnormalised) maximally entangled state.&lt;/p&gt;&#xA;&lt;p&gt;The relation &lt;span class=&quot;math-container&quot;&gt;$\kett X=(X\otimes I)\ket m$&lt;/span&gt; amounts to some simple index juggling. By this, I mean that you are considering the same object, &lt;em&gt;i.e.&lt;/em&gt; the same set of numbers, but interpreting it in different ways (as an operator rather than as a vector).&lt;/p&gt;&#xA;&lt;p&gt;To see this, let &lt;span class=&quot;math-container&quot;&gt;$X\in\mathcal L(H_0,H_1)$&lt;/span&gt; be your operator, whose matrix elements (in some choice of basis) we write as &lt;span class=&quot;math-container&quot;&gt;$X_{ij}$&lt;/span&gt;.&#xA;Note that you can understand &lt;span class=&quot;math-container&quot;&gt;$X_{ij}$&lt;/span&gt; as an operator (&amp;quot;sending the index &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; to the index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&amp;quot;), &lt;em&gt;or&lt;/em&gt; as a vector in &lt;span class=&quot;math-container&quot;&gt;$H_0\otimes H_1$&lt;/span&gt;.&#xA;More formally, if we write with &lt;span class=&quot;math-container&quot;&gt;$\kett X$&lt;/span&gt; the &amp;quot;vector interpretation&amp;quot; of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle i,j\kett X = X_{ij} =\langle i|X|j\rangle = \langle i,j|(X\otimes I)\ket m,$$&lt;/span&gt;&#xA;where we used&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle i,j|X\otimes I|k,\ell\rangle = X_{ik}\delta_{j\ell},$&lt;/span&gt;&#xA;and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$\kett X=(X\otimes I)\ket m.$&lt;/span&gt;&#xA;This is also often written as &lt;span class=&quot;math-container&quot;&gt;$\kett X=\operatorname{vec}(X)$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}:\mathrm{Lin}(\mathcal X,\mathcal Y)\to\mathcal Y\otimes\mathcal X$&lt;/span&gt; the &amp;quot;vectorisation&amp;quot; operation.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-19T11:32:49.120" LastActivityDate="2020-08-19T11:32:49.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13395" PostTypeId="1" AcceptedAnswerId="13397" CreationDate="2020-08-19T12:21:08.453" Score="3" ViewCount="242" Body="&lt;p&gt;In Nielsen and Chuang, Quantum computing and quantum information, the following definition is given to a projective measurement :&lt;/p&gt;&#xA;&lt;p&gt;Projective measurements are described by an observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M = \sum_m m P_m$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; a projector onto the Eigenspace of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 ?&lt;/p&gt;&#xA;&lt;p&gt;For 1 qubit, I know that this refer to the Z observable :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Z = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{pmatrix} = |0 \rangle \langle 0| - |1\rangle \langle 1|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for n qubits,my intuition would be :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;    P_1 &amp;amp; = \underbrace{Z \otimes I \otimes ... \otimes I}_{n \textrm{ terms}}. \\&#xA;    P_2 &amp;amp; = I \otimes Z \otimes ... \otimes I. \\&#xA;    &amp;amp; ... \\&#xA;    P_n &amp;amp;  = I \otimes I \otimes ... \otimes Z.&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with I the identity matrix.&lt;/p&gt;&#xA;&lt;p&gt;Then the observable would be as in the definition. Is that correct ?&lt;/p&gt;&#xA;" OwnerUserId="10065" LastEditorUserId="10065" LastEditDate="2020-08-19T13:13:02.477" LastActivityDate="2020-08-19T15:28:03.433" Title="What's the observable when measuring multiple qubits in the computational basis?" Tags="&lt;measurement&gt;&lt;terminology&gt;&lt;projection-operator&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13396" PostTypeId="2" ParentId="13373" CreationDate="2020-08-19T13:29:25.897" Score="2" Body="&lt;p&gt;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle \sim |\updownarrow\,\rangle \qquad&#xA;|1\rangle \sim |\leftrightarrow\,\rangle&#xA;$$&lt;/span&gt;&#xA;The superposition states then correspond to diagonally polarized light:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\rangle \sim |⤢\,\rangle \qquad&#xA;|-\rangle \sim |⤡\,\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, the superposition states that have an &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; do actually correspond to &lt;em&gt;circularly polarized light:&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+i\rangle \sim |\circlearrowright\,\rangle \qquad&#xA;|-i\rangle \sim |\circlearrowleft\,\rangle&#xA;$$&lt;/span&gt;&#xA;Which also explains the labels &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; for &lt;em&gt;right&lt;/em&gt; and &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; for &lt;em&gt;left&lt;/em&gt; in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13385/1859&quot;&gt;@Z..'s post&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This correspondence is explained by the fact that circularly polarized light is created by superposing vertical light with horizontal light that has a &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; phase difference. This phase difference is exactly &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i \pi/2}=i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10250" LastEditorUserId="1859" LastEditDate="2020-08-20T10:49:26.350" LastActivityDate="2020-08-20T10:49:26.350" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13397" PostTypeId="2" ParentId="13395" CreationDate="2020-08-19T13:35:19.387" Score="4" Body="&lt;p&gt;Note that your current definitions of the projection matrices &lt;span class=&quot;math-container&quot;&gt;$\{P_{1},P_{2},...,P_{n}\}$&lt;/span&gt; are actually not projection matrices, since &lt;span class=&quot;math-container&quot;&gt;$P_{i}^{2} = I \not= P_{i} \,\, \forall i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What works 'better' is if you have something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;P_{1}^{+1} =&amp;amp; |0\rangle\langle 0 | \otimes I \otimes I....\otimes I \\&#xA;P_{1}^{-1} =&amp;amp; |1\rangle\langle 1 | \otimes I \otimes I....\otimes I \\&#xA;P_{2}^{+1} =&amp;amp;  I \otimes |0\rangle\langle 0 | \otimes  I....\otimes I \\&#xA;P_{2}^{-1} =&amp;amp;  I \otimes |1\rangle\langle 1 | \otimes  I....\otimes I \\&#xA;&amp;amp; \vdots \\&#xA;P_{n}^{+1} =&amp;amp;  I   \otimes  I....\otimes I \otimes |0\rangle\langle 0|\\&#xA;P_{n}^{-1} =&amp;amp;  I  \otimes  I.... \otimes I \otimes |1\rangle\langle 1 |\\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, a PVM must have that &lt;span class=&quot;math-container&quot;&gt;$\sum_{i = 0}^{2n-1} P_{i} = I$&lt;/span&gt;, which is clearly not the case here!&#xA;One could solve for this by renormalizing, but there is another thing missing here: these projectors actually don't account for any &lt;em&gt;correlations&lt;/em&gt; that the measurements might have.&lt;/p&gt;&#xA;&lt;p&gt;A better 'choice' is therefore the measurement operators &lt;span class=&quot;math-container&quot;&gt;$Z_{n} = Z \otimes Z \otimes Z ... \otimes Z$&lt;/span&gt;. This operator has &lt;span class=&quot;math-container&quot;&gt;$2^{n}$&lt;/span&gt; eigenvectors:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Z_{n} = \sum_{i \in \{0,1\}^{n}} m_{i} |i\rangle\langle i|,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$m_{i} = \pm 1$&lt;/span&gt; based on the parity of the bitstring &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. As a measurement outcome,you then get the bitstring &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, associated with the projection on the state &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-08-19T13:35:19.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13398" PostTypeId="2" ParentId="13395" CreationDate="2020-08-19T13:59:49.820" Score="2" Body="&lt;p&gt;You simply want &lt;em&gt;any&lt;/em&gt; diagonal operator that has distinct diagonal elements (which would imply that every basis element maps to a distinct output of the measurement).&lt;/p&gt;&#xA;&lt;p&gt;One convenient way to denote this in terms of Pauli matrices is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=1}^N2^{N-i-1}(1-Z_i)&#xA;$$&lt;/span&gt;&#xA;For a basis state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a binary number, the eigenvalue is the decimal representation of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (and hence distinct). Of course, you can drop all the identity terms as those just give a shift in all the eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-19T13:59:49.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13399" PostTypeId="2" ParentId="13395" CreationDate="2020-08-19T15:28:03.433" Score="2" Body="&lt;p&gt;Note that if you are considering a projective measurement, there is no need to deal with observables at all.&#xA;A projective measurement is characterised by the basis &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\{\ket{u_i}\}_i$&lt;/span&gt; on which you are measuring, and therefore the associated projection probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i\equiv \lvert\langle u_i\rvert \psi\rangle\rvert^2$&lt;/span&gt; (when &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; is the state being measured).&#xA;You don't need anything else.&lt;/p&gt;&#xA;&lt;p&gt;Bringing an observable into the picture &lt;em&gt;can&lt;/em&gt; be useful, depending on the circumstances and what exactly you are interested in.&#xA;But remember that observables are used to compute &lt;em&gt;expectation values&lt;/em&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-19T15:28:03.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13400" PostTypeId="2" ParentId="11945" CreationDate="2020-08-19T19:10:30.343" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2149" LastActivityDate="2020-08-19T19:10:30.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13401" PostTypeId="1" CreationDate="2020-08-19T20:33:47.850" Score="1" ViewCount="49" Body="&lt;p&gt;The original &lt;a href=&quot;https://www.nature.com/articles/35051009&quot; rel=&quot;nofollow noreferrer&quot;&gt;KLM paper&lt;/a&gt; says:&lt;/p&gt;&#xA;&lt;p&gt;The basic states of a bosonic qubit encoded in modes &lt;span class=&quot;math-container&quot;&gt;$l_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$l_2$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\mapsto|0\rangle_{l_1}|1\rangle_{l_2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\mapsto|1\rangle_{l_1}|0\rangle_{l_2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why couldn't we simply encode qubits as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\mapsto|0\rangle_{l_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\mapsto|1\rangle_{l_1}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-08-24T09:20:20.740" LastActivityDate="2020-08-24T09:20:20.740" Title="Why do we use two optical modes per qubit in the KLM scheme?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;photonics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13402" PostTypeId="1" CreationDate="2020-08-19T21:00:28.243" Score="2" ViewCount="40" Body="&lt;p&gt;Some quantum computers hold their qubits in a 2D array. I've even seen a 1D topology I think.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I would imagine it has something to do with decoherence?  But any other specific reason?&lt;/p&gt;&#xA;" OwnerUserId="13009" LastEditorUserId="2927" LastEditDate="2020-08-19T22:10:40.677" LastActivityDate="2020-08-20T14:30:45.877" Title="What determines the topology/connectedness of quantum computers?" Tags="&lt;physical-qubit&gt;&lt;architecture&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13404" PostTypeId="1" CreationDate="2020-08-20T00:26:40.450" Score="9" ViewCount="164" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.researchgate.net/publication/220295493_A_Simple_PromiseBQP-complete_Matrix_Problem&quot; rel=&quot;noreferrer&quot;&gt;matrix powers&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$(A^m)_{ij}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$A_{ij}\in\{-1,0,1\}$&lt;/span&gt; is (promise) BQP-complete.  That is, the problem is both in BQP, and can simulate other problems in BQP.&lt;/p&gt;&#xA;&lt;p&gt;Janzing and Wocjan emphasize that their BQP-hardness reduction requires a negative-sign in an entry of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to &lt;em&gt;simulate interference&lt;/em&gt; afforded by BQP algorithms.  At a critical point in their reduction they apply a (conditional)-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotation, which leads to a matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with a negative entry.&#xA;I don't think their proof of BQP-hardness would carry over when entries &lt;span class=&quot;math-container&quot;&gt;$A_{ij}$&lt;/span&gt; are strictly non-negative, e.g. in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt;. Indeed, I believe that such a restricted matrix-powers problem may be amenable to some form of Stockmeyer approximation, e.g. in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AM}$&lt;/span&gt;, and hence not BQP-complete under the reasonable hypothesis that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\not\subseteq\mathsf{AM}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6615/showing-that-matrix-inversion-is-bqp-complete-hhl-algorithm&quot;&gt;here&lt;/a&gt;.&#xA;However, HHL considers the Taylor-series expansion of &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A=I-Ue^{-1/T}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary operator which simulates a given unitary circuit with a clock register construction — so that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (and powers of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) will have negative or complex entries, if any of the gates in the circuit do. For the case &lt;span class=&quot;math-container&quot;&gt;$\tilde A = U \mathrm{e}^{-1/T}$&lt;/span&gt;, this again suggests that the BQP-completeness of estimating entries of matrix powers &lt;span class=&quot;math-container&quot;&gt;$\tilde A^m$&lt;/span&gt; is associated with whether &lt;span class=&quot;math-container&quot;&gt;$\tilde A$&lt;/span&gt; has entries apart from non-negative reals.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert b \rangle$&lt;/span&gt; are in &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="124" LastEditDate="2020-08-25T13:13:15.550" LastActivityDate="2020-08-25T13:13:15.550" Title="Is HHL still BQP-complete when the matrix entries are only in {0,1}?" Tags="&lt;complexity-theory&gt;&lt;hhl-algorithm&gt;&lt;bqp&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13405" PostTypeId="1" CreationDate="2020-08-20T01:45:46.463" Score="0" ViewCount="31" Body="&lt;p&gt;I want to perform a CHSH inequalities test using operators &lt;span class=&quot;math-container&quot;&gt;$A \, \&amp;amp; B$&lt;/span&gt; and their combinations each possessed by Alice and Bob, which obey the following commutator relation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[A, B] = 2C$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt; such that their eigenvalues lie between &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$||A'||\leq 1,\quad ||B'||\leq 1, \quad ||C'|| \leq 1,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A' = f_1(A), \quad B' = f_2(B), \quad C' = f_3(C)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the following relation holds?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[A', B'] = 2 C'$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that this transformation will allow me to write down operators which replicate standard spin operators, using which the CHSH bound of &amp;quot;2&amp;quot; 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?&lt;/p&gt;&#xA;" OwnerUserId="13011" LastActivityDate="2020-08-20T01:45:46.463" Title="CHSH test using unbounded operators" Tags="&lt;bell-experiment&gt;&lt;locc-operation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13406" PostTypeId="1" CreationDate="2020-08-20T07:28:58.113" Score="4" ViewCount="213" Body="&lt;p&gt;The documentation for the new version &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#qiskit-0-20-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit 0.20.0&lt;/a&gt; states that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.UGate.html#ugate&quot; rel=&quot;nofollow noreferrer&quot;&gt;UGate&lt;/a&gt; is &amp;quot;Implemented using two X90 pulses on IBM Quantum systems:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U(θ,ϕ,λ)=RZ(ϕ−π/2)RX(π/2)RZ(π−θ)RX(π/2)RZ(λ−π/2)$&lt;/span&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U3Gate.html#u3gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;U3Gate&lt;/a&gt; is &amp;quot;Implemented using two X90 pulses on IBM Quantum systems:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U3(θ,ϕ,λ)=RZ(ϕ)RX(−π/2)RZ(θ)RX(π/2)RZ(λ)$&lt;/span&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;It looks like only the latter matches the known &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11423/12280&quot;&gt;rotation sequence&lt;/a&gt; for U3:&#xA;&lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-rotation (&lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;-rotation (&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-rotation (&lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;Although their presentation matrices completely coincide:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U3}=&#xA;\mathrm{U}=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this an inaccuracy in the documentation or am I missing something and these gates are actually different?&lt;/p&gt;&#xA;&lt;p&gt;Just in case, the aforementioned difference stated in the documentation refers to the &lt;strong&gt;hardware&lt;/strong&gt; (not software) implementation of these gates on IBM Q systems.&lt;/p&gt;&#xA;" OwnerUserId="12416" LastEditorUserId="12416" LastEditDate="2020-08-20T16:15:56.157" LastActivityDate="2020-08-20T16:15:56.157" Title="Why are there such different UGate and U3Gate implementations in the Qiskit documentation?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13407" PostTypeId="1" AcceptedAnswerId="13412" CreationDate="2020-08-20T07:49:35.360" Score="1" ViewCount="63" Body="&lt;p&gt;I was wondering what would be an equation for Hadamard operation for a single qubit, given the input as the current &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (0 to &lt;span class=&quot;math-container&quot;&gt;$+\pi/2$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$-\pi$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$+\pi$&lt;/span&gt;) and output expected in &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; with same ranges. Most expressions of Hadamard that I saw use Cartesian transformation, but not &lt;span class=&quot;math-container&quot;&gt;$\theta/\varphi$&lt;/span&gt; transform.&lt;/p&gt;&#xA;&lt;p&gt;I could convert the input to Cartesian form, and convert the output back into &lt;span class=&quot;math-container&quot;&gt;$\theta/\varphi$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and adding &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; to phase, but I see that it doesn't quite work for arbitrary input.&lt;/p&gt;&#xA;&lt;p&gt;Note: here &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; refers to relative phase (&lt;span class=&quot;math-container&quot;&gt;$-\pi$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$+\pi$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; refers to component amplitude factor (0 to &lt;span class=&quot;math-container&quot;&gt;$+\pi/2$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="13012" LastEditorUserId="9006" LastEditDate="2020-08-21T07:05:57.300" LastActivityDate="2020-08-24T12:18:30.217" Title="Hadamard direct mapping of input to output in $\theta$ and $\varphi$ form" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13409" PostTypeId="2" ParentId="13406" CreationDate="2020-08-20T13:48:09.170" Score="3" Body="&lt;p&gt;If you look at the source code then you will see that the &lt;code&gt;UGate&lt;/code&gt; is defined as an alias for the &lt;code&gt;U3Gate&lt;/code&gt;. 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, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is used to refer to an arbitrary unitary gate/operator. Since in qiskit &lt;code&gt;U3Gate&lt;/code&gt; is the most generic single qubit unitary gate, it makes sense to identify it with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; from quantum computing literature.&lt;/p&gt;&#xA;" OwnerUserId="12785" LastActivityDate="2020-08-20T13:48:09.170" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="13410" PostTypeId="2" ParentId="13402" CreationDate="2020-08-20T14:30:45.877" Score="2" Body="&lt;p&gt;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 &amp;quot;connected&amp;quot;, so that the graph of qubit-qubit connections is complete.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;lines&amp;quot; (coplanar waveguides) to cross on chips via &lt;a href=&quot;https://arxiv.org/pdf/1712.01671.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;airbridges&lt;/a&gt;, and there is current work on &lt;a href=&quot;https://arxiv.org/pdf/1906.11146.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;3D-integrated technology&lt;/a&gt; that can &amp;quot;break the plane&amp;quot;, where different aspects of the chip's functionality are spread across different wafers that can be stacked and bonded in the vertical direction.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2020-08-20T14:30:45.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13411" PostTypeId="1" CreationDate="2020-08-20T16:22:43.850" Score="0" ViewCount="102" Body="&lt;p&gt;I would like to implement the Deutsch-Jozsa algorithm myself using cirq.&#xA;However, I faced the problem of the implementation of the oracle.&lt;/p&gt;&#xA;&lt;p&gt;I endeavored to apply the Deutsch-Jozsa algorithm for &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt;-qubits circuit,&#xA;but I got the wrong answer. I found the analytical implementation of oracle here&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5723/implementing-an-oracle&quot;&gt;Implementing an oracle&lt;/a&gt;,&#xA;so I try to program it. You can see below my implementation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def qunatum_oracle (input_qubits, output_qubit, secret_string, quibit_number):&#xA; for qubit, bit in zip(input_qubits, secret_string):&#xA;  if bit and qubit != input_qubits[quibit_number - 1]: &#xA;    yield [CNOT(qubit, output_qubit), X(output_qubit)] &#xA;  &#xA;  if bit and qubit == input_qubits[quibit_number - 1]:&#xA;    yield CNOT(qubit, output_qubit) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where input_qubits are the circuit of input qubits, out output_qubit is the output qubit,&#xA;secret_string is an input x of the oracle, and qubit_number is the number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;My oracle is acting on the &lt;span class=&quot;math-container&quot;&gt;$n + 1$&lt;/span&gt; qubit and implements a CNOT gate. My oracle returns 1 instead of 0 for a constant string. I have no idea what was wrong. I was inspired by the realization of the Deutsch algorithm by cirq team &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/deutsch.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/blob/master/examples/deutsch.py&lt;/a&gt; but still didn't get my mistake. Unfortunately, I haven't found the solution to my problem on the forum.&lt;/p&gt;&#xA;&lt;p&gt;Could you provide me any clue or what I did wrong or could you share the link where I can find the solution?&lt;/p&gt;&#xA;&lt;p&gt;My idea is I would like to implement a general oracle that finds whether a function is balanced or constant for &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; circuit without dividing for balanced and constant cases.&lt;/p&gt;&#xA;&lt;p&gt;Best regards,&lt;/p&gt;&#xA;&lt;p&gt;Elijah&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;" OwnerUserId="10492" LastEditorUserId="55" LastEditDate="2020-08-24T09:24:43.080" LastActivityDate="2020-08-24T09:24:43.080" Title="Deutsch-Jozsa algorithm: an oracle implementation" Tags="&lt;algorithm&gt;&lt;programming&gt;&lt;cirq&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;oracles&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13412" PostTypeId="2" ParentId="13407" CreationDate="2020-08-20T17:05:18.370" Score="0" Body="&lt;p&gt;I think I got it. The two rotations with angles &lt;span class=&quot;math-container&quot;&gt;$-\pi/4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; 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 :)&lt;/p&gt;&#xA;" OwnerUserId="13012" LastEditorUserId="13012" LastEditDate="2020-08-24T12:18:30.217" LastActivityDate="2020-08-24T12:18:30.217" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13413" PostTypeId="1" AcceptedAnswerId="13414" CreationDate="2020-08-20T17:41:45.820" Score="4" ViewCount="71" Body="&lt;p&gt;An arbitrary single qubit gate can be decomposed as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=e^{i \alpha} R_z(\beta) R_y(\gamma) R_z(\delta)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We notice that in addition to the three rotations, there is a coefficient &lt;span class=&quot;math-container&quot;&gt;$e^{i \alpha}$&lt;/span&gt;. What disturbs me is that this extra phase &lt;span class=&quot;math-container&quot;&gt;$e^{i \alpha}$&lt;/span&gt; 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 &amp;quot;mathematically&amp;quot; identify the expression of the unitary but in term of physics this phase will never be added in practice on a quantum computer ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2020-08-20T19:05:48.400" Title="Adding a phase to qubit: why is it necessary for arbitrary single qubit gate" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13414" PostTypeId="2" ParentId="13413" CreationDate="2020-08-20T19:00:22.973" Score="4" Body="&lt;p&gt;&lt;strong&gt;A reason why we need that &lt;span class=&quot;math-container&quot;&gt;$e^{i \alpha}$&lt;/span&gt; term:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is right that the global phase &lt;span class=&quot;math-container&quot;&gt;$e^{i \alpha}$&lt;/span&gt; will not change the action of the gate, but let's consider these two gates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U1\big(\frac{\pi}{2}\big) = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; i&#xA;\end{pmatrix} &#xA;\qquad &#xA;R_z\big(\frac{\pi}{2}\big) = &#xA;\begin{pmatrix}&#xA;e^{-i \frac{\pi}{4}} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i \frac{\pi}{4}}&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It can be easily seen that &lt;span class=&quot;math-container&quot;&gt;$R_z\big(\frac{\pi}{2}\big) = e^{-i \frac{\pi}{4}} U1\big(\frac{\pi}{2}\big)$&lt;/span&gt;. So both gates are differ by a global phase &lt;span class=&quot;math-container&quot;&gt;$e^{-i \frac{\pi}{4}}$&lt;/span&gt; which means that they are equavalent when we apply them in the circuits. Nevertheless, as was discussed in this question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/11888/9459&quot;&gt;[1]&lt;/a&gt; and in this this answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12409/9459&quot;&gt; [2]&lt;/a&gt; &lt;strong&gt;the control version of this gates are not equivalent to each other&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CU1\big(\frac{\pi}{2}\big) = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp; 1 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp; 0 &amp;amp;1 &amp;amp;0 \\&#xA;0 &amp;amp; 0 &amp;amp;0 &amp;amp;i &#xA;\end{pmatrix} &#xA;\qquad &#xA;CR_z\big(\frac{\pi}{2}\big) = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp; 1 &amp;amp;0 &amp;amp;0 \\&#xA;0 &amp;amp; 0 &amp;amp;e^{-i \frac{\pi}{4}} &amp;amp;0 \\&#xA;0 &amp;amp; 0 &amp;amp;0 &amp;amp;e^{i \frac{\pi}{4}} &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-08-20T19:05:48.400" LastActivityDate="2020-08-20T19:05:48.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13415" PostTypeId="2" ParentId="13391" CreationDate="2020-08-21T02:54:57.950" Score="0" Body="&lt;p&gt;You can create a string of Pauli operators, applied to different qubits, using the &lt;code&gt;Pauli&lt;/code&gt; class from &lt;code&gt;qiskit.quantum_info&lt;/code&gt;, and then just do a measurement like you would do for any circuit.&lt;/p&gt;&#xA;" OwnerUserId="12785" LastActivityDate="2020-08-21T02:54:57.950" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13416" PostTypeId="1" CreationDate="2020-08-21T06:40:27.397" Score="2" ViewCount="68" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8031" LastEditorUserId="55" LastEditDate="2020-08-24T09:25:31.580" LastActivityDate="2020-08-24T09:25:31.580" Title="Using QuantumCircuit.initialize() on a real quantum computer" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13417" PostTypeId="2" ParentId="13416" CreationDate="2020-08-21T06:59:40.123" Score="2" Body="&lt;p&gt;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.&#xA;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.&#xA;State preparation is still an active field of research.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9006" LastEditDate="2020-08-22T06:23:37.560" LastActivityDate="2020-08-22T06:23:37.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13418" PostTypeId="1" CreationDate="2020-08-21T10:58:56.597" Score="0" ViewCount="39" Body="&lt;p&gt;When it is used in a controlling circuit, QuantumCircuit.diagonal() decomposition in Qiskit does not provide global phase (as a relative phase), but instead only identity operator is used. Here the example of the code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;`CIRCF= QuantumCircuit(3)    &#xA;PARAM1=[complex(0.02,(math.sqrt(1.0-0.02**2)))]*4&#xA;PARAM2=[complex(0.02,-(math.sqrt(1.0-0.02**2)))]*4&#xA;CIRCF.h([0, 1, 2])&#xA;&#xA;CIRCF_1 = QuantumCircuit(2)&#xA;CIRCF_1.diagonal(PARAM1,[0, 1])&#xA;GATECIRCF_1  =CIRCF_1.to_gate(label='DiagGate1')&#xA;CGATECIRCF_1 =GATECIRCF_1.control(1,ctrl_state='0')&#xA;CIRCF.append(CGATECIRCF_1,[2, 0, 1])  &#xA;&#xA;CIRCF_2 = QuantumCircuit(2)&#xA;CIRCF_2.diagonal(PARAM2,[0, 1])&#xA;GATECIRCF_2  =CIRCF_2.to_gate(label='DiagGate2)&#xA;CGATECIRCF_2 =GATECIRCF_2.control(1,ctrl_state='0')&#xA;CIRCF.append(CGATECIRCF_2,[2, 0, 1])&#xA;&#xA;CIRCF.h(2)&#xA;CIRCF_job1 = execute(CIRCF, backend1).result().get_statevector(CIRCF) `&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output statevector corresponds to the case where identity operator is used in &lt;code&gt;CIRCF_1.to_gate(label='DiagGate1')&lt;/code&gt; and &lt;code&gt;CIRCF_2.to_gate(label='DiagGate1')&lt;/code&gt;, without applying the global phase as relative phase. The list of diagonal entries in &lt;code&gt;PARAM1&lt;/code&gt; and &lt;code&gt;PARAM2&lt;/code&gt; does not affect the output in any way, i.e. the output statevector is always in form:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;(0.5000000000000001-3.061616997868384e-17j)&#xA;(0.5000000000000001-3.061616997868384e-17j)&#xA;(0.5000000000000001-3.061616997868384e-17j)&#xA;(0.5000000000000001-3.061616997868384e-17j)&#xA;3.061616997868384e-17j&#xA;3.061616997868384e-17j&#xA;3.061616997868384e-17j&#xA;3.061616997868384e-17j&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The problem is that the output state vector should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}|0\rangle($&lt;/span&gt;&lt;code&gt;GATECIRCF_1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt;&lt;code&gt;GATECIRCF_2&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)|\Psi\rangle +$$\frac{1}{2}|1\rangle($&lt;/span&gt;&lt;code&gt;GATECIRCF_1&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt;&lt;code&gt;GATECIRCF_2&lt;/code&gt;&lt;span class=&quot;math-container&quot;&gt;$)|\Psi\rangle$&lt;/span&gt; ,&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; is the initial state given by the &lt;span class=&quot;math-container&quot;&gt;$|H\rangle$&lt;/span&gt; for all qubits. But any change in &lt;code&gt;PARAM1&lt;/code&gt; or &lt;code&gt;PARAM2&lt;/code&gt; gives exactly the same output as above. In general, global phase for .diagonal method should be included.&lt;/p&gt;&#xA;" OwnerUserId="5730" LastEditorUserId="55" LastEditDate="2020-08-24T09:25:37.157" LastActivityDate="2020-08-24T09:25:37.157" Title="Why QuantumCircuit.diagonal does not provide global phase when it is used in a controlling circuit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;applications&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13419" PostTypeId="2" ParentId="13393" CreationDate="2020-08-21T13:44:22.910" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pDuYD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pDuYD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="12047" LastActivityDate="2020-08-21T13:44:22.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13420" PostTypeId="1" CreationDate="2020-08-21T16:49:11.780" Score="3" ViewCount="16" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are there already hypothetical durations of how long a continuous-variable gate would take on a continuous-variable quantum computer?&lt;/li&gt;&#xA;&lt;li&gt;What are these constant factors that makes the speed up for quantum algorithms on qc more difficult?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13030" LastActivityDate="2020-08-21T16:49:11.780" Title="Are there already hypothetical durations of how long a continuous-variable gate would take on a continuous-variable quantum computer?" Tags="&lt;quantum-gate&gt;&lt;speedup&gt;&lt;continuous-variable&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13421" PostTypeId="1" AcceptedAnswerId="13423" CreationDate="2020-08-21T21:55:55.643" Score="1" ViewCount="40" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate, the function returns something like &lt;code&gt;[0.5, 0.5]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="55" LastEditDate="2020-08-24T09:18:55.280" LastActivityDate="2020-08-24T09:18:55.280" Title="How to get state vector probabilities in Q#" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13422" PostTypeId="2" ParentId="13401" CreationDate="2020-08-21T22:19:37.187" Score="1" Body="&lt;p&gt;Mathematically, both options are ok. You can use &amp;quot;single-rail&amp;quot; or &amp;quot;dual-rail&amp;quot; encoding. Dual-rail has some implementation advantages. Look here for example :&#xA;&lt;a href=&quot;https://arxiv.org/pdf/1103.6071.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1103.6071.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12265" LastActivityDate="2020-08-21T22:19:37.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13423" PostTypeId="2" ParentId="13421" CreationDate="2020-08-21T22:27:32.310" Score="2" Body="&lt;p&gt;You may be looking for &lt;code&gt;DumpMachine&lt;/code&gt; which will gove you all the information about the whole quantum machine including complex amplitudes and phases. You can find the tutorials here : &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/using-qsharp/testing-debugging?tabs=tabid-vs2019#dump-functions&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-08-21T22:27:32.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13424" PostTypeId="1" AcceptedAnswerId="13425" CreationDate="2020-08-21T23:09:56.163" Score="2" ViewCount="80" Body="&lt;p&gt;Consider this expression where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are matrices, &lt;span class=&quot;math-container&quot;&gt;$|i \rangle$&lt;/span&gt; is a ket (column vector) and &lt;span class=&quot;math-container&quot;&gt;$\langle j |$&lt;/span&gt; is a bra (row vector) :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A | i \rangle \langle j | B \tag1\label1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Due to the general associative properties of the bra-ket notation, this can be interpreted as the inner product of 2 vectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left( A | i \rangle \right) \left( \langle j | B \right) \tag2\label2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A (| i \rangle \langle j |) B \tag3\label3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="55" LastEditDate="2020-08-24T09:18:41.813" LastActivityDate="2020-08-24T09:18:41.813" Title="Confused about associativity of outer product notation" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13425" PostTypeId="2" ParentId="13424" CreationDate="2020-08-21T23:39:23.420" Score="2" Body="&lt;p&gt;It seems you're conflating inner products and outer products.  An inner product would be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle i \vert j \rangle \;\;\; \text{or} \;\;\; \langle i \vert A^\dagger B \vert j\rangle.$$&lt;/span&gt;&#xA;A column vector times a row vector, &lt;span class=&quot;math-container&quot;&gt;$C^{j \times 1}  R^{1 \times i}$&lt;/span&gt;, results in a &lt;span class=&quot;math-container&quot;&gt;$j \times i$&lt;/span&gt; matrix.  A row vector times a column vector with compatible dimension, &lt;span class=&quot;math-container&quot;&gt;$R^{1 \times j}  C^{j \times 1}$&lt;/span&gt;, gives a scalar.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-08-21T23:39:23.420" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13426" PostTypeId="1" AcceptedAnswerId="13431" CreationDate="2020-08-22T03:08:23.587" Score="3" ViewCount="164" Body="&lt;p&gt;We know that generalized (POVM) measurement is defined by matrices &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; which are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Positive semidefinite&lt;/li&gt;&#xA;&lt;li&gt;Add up to a unit matrix, &lt;span class=&quot;math-container&quot;&gt;$\sum_i M_i = \mathbb{I}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and the probability of obtaining outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; on state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$p_i = Tr(\rho M_i)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I can easily construct POVM example on a qubit by choosing&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$M_0 = |\Psi\rangle\langle\Psi|$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$M_1 = \mathbb{I}- |\Psi\rangle\langle\Psi|$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;But this is simply a projective measurement (on state &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;How to construct a non-trivial (non-projective) POVM measurement example?&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="55" LastEditDate="2020-08-22T05:57:57.013" LastActivityDate="2020-08-22T08:04:56.600" Title="How to construct a non-trivial (non-projective) POVM measurement example?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13427" PostTypeId="5" CreationDate="2020-08-22T05:54:10.917" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-22T05:54:10.917" LastActivityDate="2020-08-22T05:54:10.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13428" PostTypeId="4" CreationDate="2020-08-22T05:54:10.917" Score="0" Body="For questions related to positive-operator valued measures (POVMs), that is, sets of positive semi-definite operators summing to the identity matrix." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-22T05:54:10.917" LastActivityDate="2020-08-22T05:54:10.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13429" PostTypeId="1" CreationDate="2020-08-22T06:04:30.580" Score="1" ViewCount="33" Body="&lt;p&gt;I have a circuit that prepares a state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; which is a superposition of the basis states &lt;span class=&quot;math-container&quot;&gt;$$\sum_{x=0}^{2^{n-1}}\alpha_x|x\rangle$$&lt;/span&gt;&#xA;with amplitude &lt;span class=&quot;math-container&quot;&gt;$\alpha_x$&lt;/span&gt; for a circuit of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Particularly, the solution to the problem I'm looking is on the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The challenge is that, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; usually has a really low probability (and sometimes its not even present in the superposition).&lt;/p&gt;&#xA;&lt;p&gt;I  was wondering if there was a simple way to boost the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; given I know specifically location of my solution?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-08-24T09:18:15.743" LastActivityDate="2020-08-24T09:18:15.743" Title="Amplitude amplification for known state but unknown amplitude" Tags="&lt;amplitude-amplification&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13430" PostTypeId="1" CreationDate="2020-08-22T07:20:44.667" Score="0" ViewCount="26" Body="&lt;p&gt;In &lt;a href=&quot;https://www.slideshare.net/mobile/alishakiba&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link (the bottom presentation)&lt;/a&gt; is described an application of Grover's algorithm for 3SAT (and a possible quantum version of Shoning's algorithm for 3SAT). I can find my way through the calculations for the most part of this presentation,  except for the last few slides where it talks about a chaotic amplitude amplifier. How exactly does this work , at least in principle?  I don't think it can be seen as a quantum circuit model, but I could be wrong.&lt;/p&gt;&#xA;&lt;p&gt;A related approach appears in &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1464-4266/5/6/015/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;  , but unfortunately I don't have access,  and I won't bother to purchase it. Also see  &lt;a href=&quot;https://ui.adsabs.harvard.edu/abs/2003JOptB...5S.639O/abstract&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I hope someone here can enlighten me, at least in terms of the basic principles. &lt;/p&gt;&#xA;&lt;p&gt;I doubt that actual implementation is possible  ( Grover can be proved optimal within the quantum circuit model),  since this would have been big news (solving NP complete problems efficiently),  yet this is the first time I hear of this. Is it based on the assumptions of a nonlinear state evolution,  contrary to the experimental established fact that QM is exactly linear? Any clarification would be appreciated. &lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="10110" LastEditDate="2020-08-22T09:32:26.223" LastActivityDate="2020-08-22T09:32:26.223" Title="How exactly does a chaotic amplitude amplifier work?" Tags="&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13431" PostTypeId="2" ParentId="13426" CreationDate="2020-08-22T07:52:06.983" Score="3" Body="&lt;p&gt;Here's a few examples&lt;/p&gt;&#xA;&lt;h2&gt;POVMs with two components&lt;/h2&gt;&#xA;&lt;p&gt;These are POVMs involving only two matrices &lt;span class=&quot;math-container&quot;&gt;$M_1,M_2\ge0$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M_1+M_2=I$&lt;/span&gt;.&#xA;This implies that they are mutually diagonalisable, as discussed &lt;em&gt;e.g.&lt;/em&gt; &lt;a href=&quot;https://math.stackexchange.com/q/3457408/173147&quot;&gt;in this question&lt;/a&gt;. Using their (mutual) eigenvectors as basis, we can therefore always write them as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\on}[1]{{\operatorname{#1}}} M_1 = \on{diag}(s_1,..., s_N),&#xA;\qquad M_2 = \on{diag}(1-s_1,...,1-s_N),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the dimension of the underlying space and &lt;span class=&quot;math-container&quot;&gt;$s_i\in[0,1]$&lt;/span&gt;.&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; are not, in general, projections.&lt;/p&gt;&#xA;&lt;p&gt;For a concrete example, consider&#xA;&lt;span class=&quot;math-container&quot;&gt;$M_1 = M_2 = \on{diag}(1/2,1/2). %\begin{pmatrix}1/2 &amp;amp; 0 \\ 0 &amp;amp; 1/2\end{pmatrix}.$&lt;/span&gt;&#xA;Of course, this represents a completely useless measurement, as &lt;span class=&quot;math-container&quot;&gt;$\on{Tr}(\rho M_i)=1/2$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;POVMs that are sum of projectors&lt;/h2&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{\boldsymbol{#1}}\newcommand{\PP}{\mathbb P}\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}$&lt;/span&gt; and consider &lt;span class=&quot;math-container&quot;&gt;$M_1=\ketbra1+\ketbra2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2=\ketbra3$&lt;/span&gt;. This is a POVM that's also not sum of trace-1 projectors.&lt;/p&gt;&#xA;&lt;p&gt;You can also show that, if &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;, the only POVMs that are sum of projectors have the form &lt;span class=&quot;math-container&quot;&gt;$\{\PP(\bs u),\PP(-\bs u)\}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\PP(\bs u)\equiv \frac12 (I+\bs u\cdot\bs \sigma)$&lt;/span&gt; projects onto the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace of &lt;span class=&quot;math-container&quot;&gt;$\bs u\cdot\bs \sigma\equiv\sum_k u_k \sigma_k$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\sigma_k$&lt;/span&gt; the Pauli matrices and &lt;span class=&quot;math-container&quot;&gt;$u\in\mathbb R^3$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\|\bs u\|=1$&lt;/span&gt;.&#xA;This can be seen from the above observation about diagonalisability. Another proof is found around page 19 of these notes by Nicholas Wheeler (&lt;a href=&quot;https://www.reed.edu/physics/faculty/wheeler/documents/Quantum%20Mechanics/Miscellaneous%20Essays/Generalized%20Quantum%20Measurement/Generalized%20Quantum%20Measurements.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Link to pdf&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Still considering the qubit case &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;, we can more generally take a set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; vectors &lt;span class=&quot;math-container&quot;&gt;$\mathbf a_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_i \mathbf a_i=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\|\mathbf a_i\|\le1$&lt;/span&gt;, and then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_i \frac{2}{n}\PP(\mathbf a_i) = I,$$&lt;/span&gt;&#xA;so that &lt;span class=&quot;math-container&quot;&gt;$\big\{\frac{2}{n}\PP(\mathbf a_i)\big\}_{i=1}^n$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-element qubit POVM. This is also shown in Wheeler's notes linked above.&lt;/p&gt;&#xA;&lt;p&gt;A question related to this is &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/8814/55&quot;&gt;&lt;em&gt;Are three POVM measurements on a single qubit physically realizable?&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;State discrimination&lt;/h2&gt;&#xA;&lt;p&gt;Another common scenario is unambiguous state discrimination. Given two pure states &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\ket\psi,\ket\varphi$&lt;/span&gt;, the optimal POVM to distinguish between them is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_1 = \frac{1}{1+\lvert\langle\varphi|\psi\rangle\rvert}\ketbra{\varphi^\perp},&#xA;\quad&#xA;M_2 = \frac{1}{1+\lvert\langle\varphi|\psi\rangle\rvert}\ketbra{\psi^\perp},&#xA;\quad&#xA;M_3 = I - M_1 - M_2.&#xA;$$&lt;/span&gt;&#xA;This is also discussed in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4172/55&quot;&gt;&lt;em&gt;What is the Helstrom measurement?&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Example without any specific structure&lt;/h2&gt;&#xA;&lt;p&gt;A generic example with &lt;span class=&quot;math-container&quot;&gt;$N=3$&lt;/span&gt;, given &lt;a href=&quot;https://math.stackexchange.com/a/3660111/173147&quot;&gt;in this answer&lt;/a&gt;, is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_1 =\frac{1}{9}&#xA;  \begin{pmatrix}&#xA;    3 &amp;amp; 2 &amp;amp; -1\\&#xA;    2 &amp;amp; 3 &amp;amp; -1\\&#xA;    -1 &amp;amp; -1 &amp;amp; 3\\&#xA;  \end{pmatrix},&#xA;\quad&#xA;M_2 =\frac{1}{9}&#xA;  \begin{pmatrix}&#xA;    3 &amp;amp; -1 &amp;amp; 2\\&#xA;    -1 &amp;amp; 3 &amp;amp; -1\\&#xA;    2 &amp;amp; -1 &amp;amp; 3\\&#xA;  \end{pmatrix},&#xA;\quad&#xA;M_3 =\frac{1}{9}&#xA;  \begin{pmatrix}&#xA;    3 &amp;amp; -1 &amp;amp; -1\\&#xA;    -1 &amp;amp; 3 &amp;amp; 2\\&#xA;    -1 &amp;amp; 2 &amp;amp; 3\\&#xA;  \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-22T08:04:56.600" LastActivityDate="2020-08-22T08:04:56.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13432" PostTypeId="1" AcceptedAnswerId="13434" CreationDate="2020-08-22T13:40:22.413" Score="3" ViewCount="43" Body="&lt;p&gt;Consider the density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho_0 = |0 \rangle \langle 0|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_1 = |1 \rangle \langle 1|$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\{p_1, p_2\}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\{p_3, p_4\}$&lt;/span&gt; be two probability distributions, that is,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$0 \leq p_1, p_2, p_3, p_4 \leq 1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_1 + p_2 = 1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$~\text{and}~ p_3 + p_4 = 1.$$&lt;/span&gt;&#xA;These probability distributions refers two mixed states &lt;span class=&quot;math-container&quot;&gt;$\rho = p_1 \rho_0 + p_2 \rho_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho' = p_3 \rho_0 + p_4 \rho_1$&lt;/span&gt;. Now I have the following questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is there is a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho' = U^\dagger \rho U$&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How to calculate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; when all &lt;span class=&quot;math-container&quot;&gt;$p_1, p_2, p_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_4$&lt;/span&gt; are known, if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; exists?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we represent &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with a quantum circuit with qubits if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; exists?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="962" LastEditorUserId="55" LastEditDate="2020-08-24T09:12:22.160" LastActivityDate="2020-08-24T09:12:22.160" Title="Can we always find a unitary operation connecting qubit states with given eigendecompositions?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13433" PostTypeId="1" AcceptedAnswerId="13457" CreationDate="2020-08-22T14:39:22.113" Score="0" ViewCount="62" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Block A for the first time step&#xA;qp.cx(q0,q1)&#xA;qp.cx(q2,q3)&#xA;qp.cx(q4,q5)&#xA;qp.cx(q6,q7) &#xA;&#xA;# Block B for the second time step&#xA;qp.cx(q1,q2)&#xA;qp.cx(q3,q4)&#xA;qp.cx(q5,q6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11572" LastEditorUserId="55" LastEditDate="2020-08-24T09:10:45.503" LastActivityDate="2020-08-24T14:16:35.990" Title="Implementing block of gates at different times in a same qiskit program" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13434" PostTypeId="2" ParentId="13432" CreationDate="2020-08-22T14:42:14.070" Score="3" Body="&lt;p&gt;Since conjugation of the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with unitaries, i. e. &lt;span class=&quot;math-container&quot;&gt;$\rho \mapsto U \rho U^\dagger$&lt;/span&gt;, preserves eigenvalues, this could only be possible in your case if &lt;span class=&quot;math-container&quot;&gt;$p_1 =p_3$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$p_1 = p_4$&lt;/span&gt;. In those cases the unitary transformation required is the identity and &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-08-22T14:42:14.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13435" PostTypeId="1" AcceptedAnswerId="13464" CreationDate="2020-08-22T15:20:19.297" Score="2" ViewCount="67" Body="&lt;p&gt;I would like to understand an example of finding a noiseless subsystem of a quantum channel from the irreducible representation of its Kraus operators.&lt;/p&gt;&#xA;&lt;p&gt;Assume we have &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; dephasing channels acting on two qubits, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho_{AB})= \sum_{i=1}^4 K_i \rho_{AB} K_i^\dagger,$$&lt;/span&gt;&#xA;where the Kraus operators are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$K_1=\mathbf{1}_{AB}/2,&#xA;\qquad K_2= \frac{1}{2}\mathbf{1}_{A}\otimes Z_B,&#xA;\qquad K_3=\frac{1}{2}Z_A\otimes \mathbf{1}_{B},&#xA;\qquad K_4=\frac{1}{2}Z_{A}\otimes Z_B.$$&lt;/span&gt;&#xA;How do I decompose this as &lt;span class=&quot;math-container&quot;&gt;$\bigoplus_j \mathbf{1}_{n_j}\otimes M(d_j) $&lt;/span&gt;? Will each Kraus operator be expressible in this decomposition?&lt;/p&gt;&#xA;&lt;p&gt;I can see they are diagonal, and this channel has three decoherence-free subspaces; one spanned by &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;,  one spanned by &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;,and one spanned by &lt;span class=&quot;math-container&quot;&gt;$\{|01\rangle,|10\rangle\}$&lt;/span&gt;.&#xA;As mentioned in this &lt;a href=&quot;https://books.google.ch/books?id=XV9sAAAAQBAJ&amp;amp;pg=PA92&amp;amp;lpg=PA92&amp;amp;dq=daniel%20lidar%20noiseless%20product,%20and%20this%20does%20not%20have%20to%20be%20a%20subspace%20(e.g.,%20in%20general%20it%20is%20not%20closed%20under%20addition)&amp;amp;source=bl&amp;amp;ots=zs7Tt3rlYN&amp;amp;sig=ACfU3U06N1o2GSgaBa8Ho72Q7QHa03mNrA&amp;amp;hl=en&amp;amp;sa=X&amp;amp;ved=2ahUKEwjhganBgpvrAhXCyaQKHbhOBP8Q6AEwAHoECAkQAQ#v=onepage&amp;amp;q=daniel%20lidar%20noiseless%20product%2C%20and%20this%20does%20not%20have%20to%20be%20a%20subspace%20(e.g.%2C%20in%20general%20it%20is%20not%20closed%20under%20addition)&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;book&lt;/a&gt;, decoherence free subspaces are a special case of noiseless subsystems, where &lt;span class=&quot;math-container&quot;&gt;$M(d_j)$&lt;/span&gt; is just a constant, and &lt;span class=&quot;math-container&quot;&gt;$n_j$&lt;/span&gt; is the dimension of the decoherence-free subspace. How do I extract these &lt;span class=&quot;math-container&quot;&gt;$n_j$&lt;/span&gt;'s from the Kraus operators or their irreps?&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="12047" LastEditDate="2020-08-25T07:03:36.530" LastActivityDate="2020-08-25T07:15:23.130" Title="Finding the irreducible representation of Kraus operators of a dephasing channel" Tags="&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;decoherence&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13436" PostTypeId="1" CreationDate="2020-08-23T00:01:01.823" Score="3" ViewCount="76" Body="&lt;p&gt;&lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.132.6306&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schoening's algorithm &lt;/a&gt;  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 &amp;quot;flipping a coin &amp;quot; 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. &lt;/p&gt;&#xA;&lt;p&gt;A related approach can be found  &lt;a href=&quot;https://dspace.mit.edu/handle/1721.1/108412&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;&#xA;&lt;p&gt;Two simplistic computations  involving simple expressions  with  1-clauses and 2-clauses  are described here (in order to see what I'm looking for ):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://imgur.com/a/S4wGWGK&quot; rel=&quot;nofollow noreferrer&quot;&gt;first simplistic sample computation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://imgur.com/a/P51Kedb&quot; rel=&quot;nofollow noreferrer&quot;&gt;second simplistic sample computation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10110" LastEditorUserId="10110" LastEditDate="2020-08-25T11:45:08.540" LastActivityDate="2020-08-25T11:45:08.540" Title="What is known about the quantum version of Schoening's algorithm for 3SAT?" Tags="&lt;quantum-gate&gt;&lt;complexity-theory&gt;&lt;classical-quantum&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13437" PostTypeId="1" AcceptedAnswerId="13438" CreationDate="2020-08-23T00:15:45.970" Score="3" ViewCount="84" Body="&lt;p&gt;From Nielsen &amp;amp; Chuang (10th edition), page 69:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is any linear operator on a Hilbert space, &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. It turns&#xA;out that there exists a unique linear operator &lt;span class=&quot;math-container&quot;&gt;$A^\dagger$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such&#xA;that for all vectors &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|w\rangle \in V$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ (|v, A|w\rangle)=(A^\dagger|v\rangle, |w\rangle). \tag{2.32} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This linear operator is known as the &lt;em&gt;adjoint&lt;/em&gt; or &lt;em&gt;Hermitian conjugate&lt;/em&gt; of&#xA;the operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. From the definition it is easy to see that &lt;span class=&quot;math-container&quot;&gt;$(AB)^\dagger = B^\dagger A^\dagger$&lt;/span&gt;. By convention, if &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is a vector, then we define &lt;span class=&quot;math-container&quot;&gt;$|v\rangle^\dagger \equiv \langle v|$&lt;/span&gt;. With this definition it is not difficult to see that &lt;span class=&quot;math-container&quot;&gt;$(A|v\rangle)^\dagger = \langle v|A^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Well, to me it is difficult to see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(A|v\rangle)^\dagger = \langle v|A^\dagger \tag1\label1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;at least without invoking&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A^\dagger=\left(A^* \right)^T \tag2\label2&#xA;$$&lt;/span&gt;&#xA;which I don't want to do because the book haven't introduced \eqref{2} at this point!&lt;/p&gt;&#xA;&lt;p&gt;I realise that by using the definition &lt;span class=&quot;math-container&quot;&gt;$|v\rangle^\dagger \equiv \langle v|$&lt;/span&gt; and right multiplying it by &lt;span class=&quot;math-container&quot;&gt;$A^\dagger$&lt;/span&gt; I get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle^\dagger A^\dagger = \langle v| A^\dagger \tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is pretty close to \eqref{1} and I only need to show that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle^\dagger A^\dagger = (A|v\rangle)^\dagger \tag4\label4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My first instinct was to use &lt;span class=&quot;math-container&quot;&gt;$(AB)^\dagger = B^\dagger A^\dagger$&lt;/span&gt; here. However, this does not feel quite right because &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|v \rangle$&lt;/span&gt; into a matrix such as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B =&#xA;\begin{bmatrix}&#xA;    \vert &amp;amp; \vert &amp;amp; \dots &amp;amp; \vert \\&#xA;    |v \rangle   &amp;amp; 0 &amp;amp; \dots &amp;amp; 0  \\&#xA;    \vert &amp;amp; \vert &amp;amp; \dots &amp;amp; \vert \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then I could invoke &lt;span class=&quot;math-container&quot;&gt;$(AB)^\dagger = B^\dagger A^\dagger$&lt;/span&gt; but I'm not sure what to do with this because at this point in the book we don't know that &lt;span class=&quot;math-container&quot;&gt;$B^\dagger = \left(B^* \right)^T$&lt;/span&gt;. Therefore, we don't know that the first row of &lt;span class=&quot;math-container&quot;&gt;$B^\dagger$&lt;/span&gt; will be &lt;span class=&quot;math-container&quot;&gt;$\langle v|$&lt;/span&gt;. Does anybody know how to proceed?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="55" LastEditDate="2020-08-24T09:27:08.607" LastActivityDate="2020-08-24T09:27:08.607" Title="Deriving $\left( A | v \rangle \right)^\dagger = \langle v | A^\dagger$ without using $A^\dagger=\left(A^* \right)^T$" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13438" PostTypeId="2" ParentId="13437" CreationDate="2020-08-23T07:26:40.137" Score="3" Body="&lt;p&gt;The application of &lt;span class=&quot;math-container&quot;&gt;$(AB)^\dagger = B^\dagger A^\dagger$&lt;/span&gt; directly is indeed not quite right.&lt;/p&gt;&#xA;&lt;p&gt;At first note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(A|v\rangle,|w\rangle) = (|w\rangle, A|v\rangle)^* = (A^\dagger|w\rangle, |v\rangle)^* = (|v\rangle , A^\dagger|w\rangle)&#xA;$$&lt;/span&gt;&#xA;BTW, from this you can immediately deduce &lt;span class=&quot;math-container&quot;&gt;$(A^\dagger)^\dagger = A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now for all &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(A|v\rangle)^\dagger |w\rangle = (A|v\rangle,|w\rangle) = (|v\rangle,A^\dagger|w\rangle) =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \langle v | \big(A^\dagger|w\rangle\big) = \langle v | A^\dagger|w\rangle = \big(\langle v | A^\dagger \big)|w\rangle&#xA;$$&lt;/span&gt;&#xA;Since it's true for all &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; we can deduce the required &lt;span class=&quot;math-container&quot;&gt;$(A|v\rangle)^\dagger= \langle v | A^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-08-23T07:50:36.043" LastActivityDate="2020-08-23T07:50:36.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13439" PostTypeId="1" CreationDate="2020-08-23T13:59:33.573" Score="2" ViewCount="24" Body="&lt;p&gt;Quantum circuits can be expressed as the matrix product of each gate in the circuit, where each gate is a unitary matrix (say) &lt;span class=&quot;math-container&quot;&gt;$G_i$&lt;/span&gt;. So, the whole circuit is &lt;span class=&quot;math-container&quot;&gt;$S = G_n G_{n-1} \cdots G_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="12376" LastEditorUserId="55" LastEditDate="2020-08-24T09:27:40.760" LastActivityDate="2020-08-24T09:27:40.760" Title="Can low-rank factorizations approximate quantum circuits?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13440" PostTypeId="1" CreationDate="2020-08-23T14:21:45.910" Score="0" ViewCount="386" Body="&lt;p&gt;When trying to import qiskit I obtain following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/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.&#xA;  warnings.warn('Could not import the Aer provider from the qiskit-aer '&#xA;/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.&#xA;  warnings.warn('Could not import the IBMQ provider from the '&#xA;---------------------------------------------------------------------------&#xA;ModuleNotFoundError                       Traceback (most recent call last)&#xA;&amp;lt;ipython-input-3-578b7f7e9727&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 import qiskit&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py in &amp;lt;module&amp;gt;&#xA;     78 # Moved to after IBMQ and Aer imports due to import issues&#xA;     79 # with other modules that check for IBMQ (tools)&#xA;---&amp;gt; 80 from qiskit.execute import execute  # noqa&#xA;     81 from qiskit.compiler import transpile, assemble, schedule  # noqa&#xA;     82 &#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/execute.py in &amp;lt;module&amp;gt;&#xA;     24 import logging&#xA;     25 from time import time&#xA;---&amp;gt; 26 from qiskit.compiler import transpile, assemble, schedule&#xA;     27 from qiskit.qobj.utils import MeasLevel, MeasReturnType&#xA;     28 from qiskit.pulse import Schedule&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/compiler/__init__.py in &amp;lt;module&amp;gt;&#xA;     33 &#xA;     34 from .assemble import assemble&#xA;---&amp;gt; 35 from .transpile import transpile&#xA;     36 from .schedule import schedule&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/compiler/transpile.py in &amp;lt;module&amp;gt;&#xA;     22 from qiskit.providers.models import BackendProperties&#xA;     23 from qiskit.providers.models.backendproperties import Gate&#xA;---&amp;gt; 24 from qiskit.transpiler import Layout, CouplingMap, PropertySet, PassManager&#xA;     25 from qiskit.transpiler.basepasses import BasePass&#xA;     26 from qiskit.dagcircuit import DAGCircuit&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/transpiler/__init__.py in &amp;lt;module&amp;gt;&#xA;    412 &amp;quot;&amp;quot;&amp;quot;&#xA;    413 &#xA;--&amp;gt; 414 from .runningpassmanager import FlowController&#xA;    415 from .passmanager import PassManager&#xA;    416 from .passmanager_config import PassManagerConfig&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py in &amp;lt;module&amp;gt;&#xA;     21 from time import time&#xA;     22 &#xA;---&amp;gt; 23 from qiskit.dagcircuit import DAGCircuit&#xA;     24 from qiskit.converters import circuit_to_dag, dag_to_circuit&#xA;     25 from .propertyset import PropertySet&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/dagcircuit/__init__.py in &amp;lt;module&amp;gt;&#xA;     39    DAGCircuitError&#xA;     40 &amp;quot;&amp;quot;&amp;quot;&#xA;---&amp;gt; 41 from .dagcircuit import DAGCircuit&#xA;     42 from .dagnode import DAGNode&#xA;     43 from .dagdepnode import DAGDepNode&#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/qiskit/dagcircuit/dagcircuit.py in &amp;lt;module&amp;gt;&#xA;     29 import math&#xA;     30 &#xA;---&amp;gt; 31 import retworkx as rx&#xA;     32 import networkx as nx&#xA;     33 &#xA;&#xA;/opt/anaconda3/lib/python3.8/site-packages/retworkx/__init__.py in &amp;lt;module&amp;gt;&#xA;      7 # that they have been altered from the originals.&#xA;      8 &#xA;----&amp;gt; 9 from .retworkx import *&#xA;     10 &#xA;     11 &#xA;&#xA;ModuleNotFoundError: No module named 'retworkx.retworkx' &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Have I installed Qiskit to the target directory incorrectly?&#xA;I attempted to install Qiskit in Terminal using:&#xA;&lt;code&gt;python3 -m pip install qiskit -t /opt/anaconda3/lib/python3.8/site-packages&lt;/code&gt;.&lt;br /&gt;I navigated to the path manually and I could find all the qiskit modules, including the &lt;code&gt;retworkx&lt;/code&gt; modules (whatever it may be).&lt;br /&gt;&#xA;If anybody has experienced this sort of error before and happens to know a fix, I would appreciate it very much.&lt;/p&gt;&#xA;" OwnerUserId="12809" LastEditorUserId="55" LastEditDate="2020-08-24T09:28:10.837" LastActivityDate="2020-09-15T01:44:43.447" Title="Trouble importing Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13441" PostTypeId="1" CreationDate="2020-08-23T14:46:31.087" Score="1" ViewCount="26" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2020-08-23T14:46:31.087" Title="Difference between a Non-Gaussian Circuit and Gaussian Circuit" Tags="&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13442" PostTypeId="1" AcceptedAnswerId="13449" CreationDate="2020-08-23T15:43:29.120" Score="2" ViewCount="71" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Say I have a source that produces two states &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{2}$&lt;/span&gt; with probability a half each, and both are mixed states, ie &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i)&amp;gt;0$&lt;/span&gt; for each of them. The dimensions of the Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How can &lt;span class=&quot;math-container&quot;&gt;$S(\rho)=H(p_{i})+\sum_{i}p_{i}S(\rho_{i})\le \log(d)$&lt;/span&gt;, given that &lt;span class=&quot;math-container&quot;&gt;$H(p_{i})=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i)&amp;gt;0$&lt;/span&gt;, given that &lt;span class=&quot;math-container&quot;&gt;$\log(d)=\log(2)=1?$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am assuming that I am missing something obvious in the actual construction of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, in that something is bounding &lt;span class=&quot;math-container&quot;&gt;$H(p_{i})$&lt;/span&gt; away from 1. I am assuming this has something to do with orthogonal supports, as &lt;span class=&quot;math-container&quot;&gt;$S(\rho) \le H(p)+\sum_{i}p_iS(\rho_{i})$&lt;/span&gt; if they are not orthogonal.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-08-25T14:59:11.040" LastActivityDate="2020-08-25T14:59:11.040" Title="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?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13443" PostTypeId="1" CreationDate="2020-08-23T17:18:24.733" Score="1" ViewCount="39" Body="&lt;p&gt;I am following &lt;a href=&quot;https://arxiv.org/pdf/1309.6405.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, and I am stuggling with a derivation.&lt;/p&gt;&#xA;&lt;p&gt;Basically, I consider an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{B_i \}$&lt;/span&gt; with respect to Hilbert-Schmidt scalar product, on the density matrix space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(H)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I have a noisy process: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}=\mathcal{N} \circ \mathcal{U}$&lt;/span&gt; which tries to implement the unitary map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt;. The noise map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; is actually defined from this last equation.&lt;/p&gt;&#xA;&lt;p&gt;We can decompose those process on the basis &lt;span class=&quot;math-container&quot;&gt;$\{B_i\}$&lt;/span&gt; which define the so-called &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; matrix. We have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{E}(\rho) = \sum_{ij} \chi_{\mathcal{E}}^{ij} B_i \rho B_j^{\dagger} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{U}(\rho) = \sum_{ij} \chi_{\mathcal{U}}^{ij} B_i \rho B_j^{\dagger} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{N}(\rho) = \sum_{ij} \chi_{\mathcal{N}}^{ij} B_i \rho B_j^{\dagger} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am struggling to prove that the fidelity of the process which is defined as: &lt;span class=&quot;math-container&quot;&gt;$F(\mathcal{E},\mathcal{U})=Tr(\chi_{\mathcal{E}}\chi_{\mathcal{U}})$&lt;/span&gt; verifies:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\mathcal{E},\mathcal{U})=F(\mathcal{N},\mathcal{I})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{I}$&lt;/span&gt; being the identity map.&lt;/p&gt;&#xA;&lt;p&gt;In the paper he work with the particular basis &lt;span class=&quot;math-container&quot;&gt;$\{B_i\}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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 ?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;[edit]: I just realized that chi matrix associated to different basis of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(H)$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-08-24T09:26:24.080" LastActivityDate="2020-08-24T09:26:24.080" Title="Why the chi-matrix fidelity of the process is the fidelity of the chi-matrix noise map" Tags="&lt;quantum-operation&gt;&lt;quantum-process-tomography&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13444" PostTypeId="1" AcceptedAnswerId="13451" CreationDate="2020-08-23T21:09:53.923" Score="4" ViewCount="251" Body="&lt;p&gt;I am trying to understand the Hadamard Test by finding the average value of &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;, which is a diagonal matrix with &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; everywhere except on the first element.&lt;/p&gt;&#xA;&lt;p&gt;I performed the regular Hadamard Test as presented in the wiki page:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/f/f2/Hadamard_test_measure_real.png&quot; alt=&quot;Text&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so far so good, everything works as it should.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle-i |1\rangle)$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle$&lt;/span&gt;, I attempted doing the test adding a phase shift of -i on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;  by applying &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}\ 1 &amp;amp; 0 \\ 0 &amp;amp; -i \end{bmatrix}$&lt;/span&gt; on the control qubit after &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, but all im getting is random measurements&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-08-27T00:07:17.450" LastActivityDate="2020-08-27T00:07:17.450" Title="Hadamard Test to calculate imaginary part" Tags="&lt;algorithm&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13445" PostTypeId="1" CreationDate="2020-08-23T22:26:17.623" Score="1" ViewCount="44" Body="&lt;p&gt;Lets say &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma$&lt;/span&gt; satisfy &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)=0$&lt;/span&gt;, i.e., they are quantum states living on orthogonal supports. What can we say about &lt;span class=&quot;math-container&quot;&gt;$F(\text{Tr}_A(\rho),\text{Tr}_B(\sigma))$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I am looking for upper bounds here, so we clearly know that &lt;span class=&quot;math-container&quot;&gt;$$F(\text{Tr}_A(\rho),\text{Tr}_B(\sigma))\geq F(\rho,\sigma)=0$$&lt;/span&gt;&#xA;but this is trivial. Can we prove any upper bound? I don't mind if we also assume &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma$&lt;/span&gt; are pure states, in which case can we give a non-trivial upper bound?&lt;/p&gt;&#xA;&lt;p&gt;One example I tried was orthogonal EPR pairs which satisfied RHS=0 and LHS (i.e., after taking partial trace)=&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;. But is this the maximum one can achieve for orthogonal quantum states?&lt;/p&gt;&#xA;" OwnerUserId="13042" LastEditorUserId="55" LastEditDate="2020-08-27T00:05:39.897" LastActivityDate="2020-08-27T00:05:39.897" Title="Given $\rho,\sigma$ such that $F(\rho,\sigma)=0$, what can we say about $F(\text{Tr}_A(\rho),\text{Tr}_B(\sigma))$?" Tags="&lt;fidelity&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13446" PostTypeId="2" ParentId="13445" CreationDate="2020-08-23T22:47:36.507" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|a\rangle\otimes|b_i\rangle$&lt;/span&gt; with two orthogonal states &lt;span class=&quot;math-container&quot;&gt;$|b_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-08-23T22:47:36.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13447" PostTypeId="2" ParentId="13444" CreationDate="2020-08-24T07:01:06.907" Score="1" Body="&lt;p&gt;Here, I think you wanted this &lt;a href=&quot;https://quantum-computing.ibm.com/composer/new-experiment?initial=N4IgdghgtgpiBcICqYAuBLVAbGATABAMboBOhArpiADQgCOEAzlAiAPIAKAogHICKAQQDKAWXwAmAHQAGANwAdMOjCEs5XDHzz6MLOgBGARknLC2hWEV0SMAOb46AbXEBdC4Rv3Cjw28WKADwdHaT8wIKdfCwALYNCLRjiwikMACgAHdABKJOpIsNineMVYJnIbJPwAWgA%2BIhC3GhANRg90dIwAezBWEABfIA&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[2];&#xA;creg c[1];&#xA;&#xA;x q[0];&#xA;x q[1];&#xA;h q[0];&#xA;s q[0];&#xA;cu1(pi) q[0],q[1];&#xA;h q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13045" LastEditorUserId="13045" LastEditDate="2020-08-24T07:13:33.290" LastActivityDate="2020-08-24T07:13:33.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13448" PostTypeId="2" ParentId="13440" CreationDate="2020-08-24T07:20:04.783" Score="1" Body="&lt;p&gt;It would be better if you install Qiskit after opening anaconda and then terminal from Anaconda and use &lt;code&gt;pip install qiskit&lt;/code&gt;. For more info visit, you can try visiting &lt;a href=&quot;https://qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13045" LastActivityDate="2020-08-24T07:20:04.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13449" PostTypeId="2" ParentId="13442" CreationDate="2020-08-24T07:30:58.070" Score="3" Body="&lt;p&gt;I guess you meant to consider generic (not necessarily pure) states &lt;span class=&quot;math-container&quot;&gt;$\rho_1,\rho_2$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert\phi\rangle\langle \phi\rvert$&lt;/span&gt;, so I'll consider the slightly modified question &amp;quot;&lt;em&gt;how is &lt;span class=&quot;math-container&quot;&gt;$$S(\rho)= H(p)+\sum_i p_i S(\rho_i)\le \log d$$&lt;/span&gt; possible for a state &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_i p_i\rho_i$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$H(p)=\log d$&lt;/span&gt;?&lt;/em&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;The first thing to notice is that, in general,&#xA;&lt;span class=&quot;math-container&quot;&gt;$S(\rho)\le H(p)+\sum_i p_i S(\rho_i)$&lt;/span&gt;.&#xA;This is not an identity unless &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; have orthogonal support.&#xA;You then also have &lt;span class=&quot;math-container&quot;&gt;$S(\rho)\le\log d$&lt;/span&gt;.&#xA;From these, you cannot imply &lt;span class=&quot;math-container&quot;&gt;$H(p)+\sum_i p_i S(\rho_i)\le \log d$&lt;/span&gt;, which is indeed untrue in general, as you observed.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; &lt;em&gt;do&lt;/em&gt; have orthogonal support, then &lt;span class=&quot;math-container&quot;&gt;$S(\rho)= H(p)+\sum_i p_i S(\rho_i)$&lt;/span&gt;, and therefore you must also have &lt;span class=&quot;math-container&quot;&gt;$H(p)+\sum_i p_i S(\rho_i)\le \log d$&lt;/span&gt;.&#xA;So then why don't we have a contradiction?&#xA;Well, consider the case with &lt;span class=&quot;math-container&quot;&gt;$H(p)=\log d$&lt;/span&gt;. This means that you are dealing with a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; that is a balanced mixture of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; different states &lt;em&gt;with orthogonal support&lt;/em&gt;. The only way to get &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; states with orthogonal support in a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional space is that they each have unit rank, &lt;em&gt;i.e.&lt;/em&gt; they are all pure, and thus &lt;span class=&quot;math-container&quot;&gt;$S(\rho_i)=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-25T12:39:58.557" LastActivityDate="2020-08-25T12:39:58.557" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="13451" PostTypeId="2" ParentId="13444" CreationDate="2020-08-24T10:19:53.160" Score="2" Body="&lt;p&gt;Here is a circuit for calcualating &lt;span class=&quot;math-container&quot;&gt;$Im(\langle\psi|U |\psi \rangle)$&lt;/span&gt; (&lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit composer from IBM&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nYOEb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nYOEb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Initial state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_0 \rangle=|0\rangle |\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger} H$&lt;/span&gt; on the first qubit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_1 \rangle=\frac{1}{\sqrt{2}}(|0\rangle  - i|1\rangle) |\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_2 \rangle=\frac{1}{\sqrt{2}}(|0\rangle |\psi\rangle  - i|1\rangle U |\psi\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After final Hadamard on the control qubit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|\Psi_3 \rangle &amp;amp;=\frac{1}{2} \big[(|0\rangle + |1\rangle) |\psi\rangle  - i(|0\rangle - |1\rangle) U |\psi\rangle \big] = &#xA;\\&#xA;&amp;amp;=\frac{1}{2} \big[|0\rangle (|\psi\rangle - i U |\psi\rangle) + |1\rangle(|\psi\rangle + i U |\psi\rangle) \big]&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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]&#xA;\\&#xA;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]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\psi \rangle = 1$&lt;/span&gt;. Calculating the expectation value of &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the circuit works as was described in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; page about the Hadamard test.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-08-24T10:35:54.753" LastActivityDate="2020-08-24T10:35:54.753" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13452" PostTypeId="1" AcceptedAnswerId="13455" CreationDate="2020-08-24T10:34:09.230" Score="-2" ViewCount="111" Body="&lt;p&gt;I'm following the tutorial in &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html#3.-Example:-3-Qubits-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover's Algorithm - Example 3 qubits&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;As described in the tutorial, the state before and after are the same (and I have checked using the 'statevector_simulator'&lt;/p&gt;&#xA;&lt;p&gt;Why do we need this step?&lt;/p&gt;&#xA;&lt;p&gt;This is my code (doubt in line &lt;code&gt;DO WE REALLY NEED?!?&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def oracle(qc: QuantumCircuit, qr: QuantumRegister):&#xA;    # Combined: Negate |101&amp;gt; and |110&amp;gt;&#xA;    qc.cz(qr[0],qr[2]) # Negate |101&amp;gt; and |111&amp;gt;&#xA;    qc.cz(qr[1], qr[2]) # Negate |110&amp;gt; and |111&amp;gt;&#xA;&#xA;    qc.barrier(qr[0]) # stetic only&#xA;&#xA;# Perform the reflection around the average amplitude&#xA;def diffuser(qc: QuantumCircuit, qr: QuantumRegister):&#xA;    # |3⟩=1/2(|000⟩+|011⟩+|100⟩−|111⟩)&#xA;    qc.h(qr)&#xA;    &#xA;    # |3⟩=1/2(−|000⟩+|011⟩+|100⟩+|111⟩)&#xA;    qc.x(qr)&#xA;    &#xA;    # |3⟩=1/2(−|000⟩+|011⟩+|100⟩−|111⟩)&#xA;    # Do controlled-Z&#xA;    qc.barrier(qr[0])&#xA;    qc.barrier(qr[1])&#xA;    qc.h(2)&#xA;    qc.ccx(0,1,2)&#xA;    qc.barrier(qr[0])&#xA;    qc.barrier(qr[1])&#xA;    qc.h(2)&#xA;&#xA;    # DO WE REALLY NEED?!?&#xA;    # |3⟩=1/2(−|000⟩+|011⟩+|100⟩−|111⟩)&#xA;    # qc.x(qr)&#xA;&#xA;    # |3⟩=1/√2(−|101⟩−|110⟩)&#xA;    qc.h(qr)&#xA;&#xA;# endregion oracles/checkers&#xA;&#xA;&#xA;# 3 Qubits circuit&#xA;n = 3&#xA;qr = QuantumRegister(n)&#xA;qc = QuantumCircuit(qr)&#xA;&#xA;# for qubit in range(n):&#xA;#     grover_circuit.h(qubit)&#xA;# Initialize: All inputs in uniform superposition&#xA;# |1⟩=1/√8(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩+|101⟩+|110⟩+|111⟩)&#xA;qc.h(qr)&#xA;# Apply oracle&#xA;# |2⟩=1/√8(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩−|101⟩−|110⟩+|111⟩)&#xA;oracle(qc, qr)&#xA;# Apply augmentation&#xA;diffuser(qc, qr)&#xA;&#xA;# Plot circuit&#xA;qc.draw('mpl')&#xA;plt.show()&#xA;&#xA;# Get state vector (simulated one run)&#xA;backend_sv = Aer.get_backend('statevector_simulator')&#xA;job_sv = execute(qc, backend_sv)&#xA;statevec = job_sv.result().get_statevector()&#xA;print('Qiskit statevector')&#xA;for cn in statevec:&#xA;    rcn = complex(round(cn.real, 8), round(cn.imag, 8))&#xA;    print(f'{rcn:+.2g}')&#xA;&#xA;# Get unitary (simulated one run)&#xA;backend_uni = Aer.get_backend('unitary_simulator')&#xA;job_uni = execute(qc, backend_uni)&#xA;unitary = job_uni.result().get_unitary()&#xA;print('Qiskit unitary')&#xA;print(unitary)&#xA;&#xA;&#xA;# Add measure and simulate&#xA;qc.measure_all()&#xA;backend_sim = Aer.get_backend('qasm_simulator')&#xA;shots = 1024&#xA;results = execute(qc, backend=backend_sim, shots=shots).result()&#xA;answer = results.get_counts()&#xA;plot_histogram(answer)&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12893" LastEditorUserId="12893" LastEditDate="2020-08-24T16:22:05.177" LastActivityDate="2020-08-24T16:22:05.177" Title="Grover's 3-qubits tutorial: Why we need the last X gates" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13453" PostTypeId="1" AcceptedAnswerId="13459" CreationDate="2020-08-24T11:02:58.063" Score="3" ViewCount="56" Body="&lt;p&gt;I am asked to prove the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Consider the Deutsch-Jozsa circuit. The output of the circuit is of the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$&lt;/span&gt;. Prove that the state&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; right before the measure is entangled if and only if it is entangled right before applying the final series of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates (Hadamard gates)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here's my attempt.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi_m\rangle$&lt;/span&gt; be the state right before the measure and &lt;span class=&quot;math-container&quot;&gt;$|\psi_h\rangle$&lt;/span&gt; be the state right before applying the final Hadamard gates (i.e &lt;span class=&quot;math-container&quot;&gt;$|\psi_m\rangle = H^{\otimes n}|\psi_h\rangle$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_m\rangle$&lt;/span&gt; entangled &lt;span class=&quot;math-container&quot;&gt;$\Rightarrow |\psi_h\rangle$&lt;/span&gt; entangled :&lt;/p&gt;&#xA;&lt;p&gt;Assume &lt;span class=&quot;math-container&quot;&gt;$|\psi_h\rangle$&lt;/span&gt; is not entangled. Then &lt;span class=&quot;math-container&quot;&gt;$|\psi_h\rangle$&lt;/span&gt; can be written as:&lt;span class=&quot;math-container&quot;&gt;$$|\psi_h\rangle &#xA;=|x_1\rangle \otimes...\otimes|x_n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we now apply the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates, we get:&lt;span class=&quot;math-container&quot;&gt;$$H|x_1\rangle \otimes...\otimes H|x_n\rangle$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2^{n/2}}\big[(|0\rangle+(-1)^{x_1}|1\rangle) \otimes ... \otimes (|0\rangle+(-1)^{x_n}|1\rangle) \big] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unless there's something I misunderstood or miscalculated, I do not see how this could be not entangled.&lt;/p&gt;&#xA;&lt;p&gt;Could you please help me out there, please?&lt;/p&gt;&#xA;&lt;p&gt;Also, I have no idea how to prove the if-part.&lt;/p&gt;&#xA;" OwnerUserId="9407" LastEditorUserId="55" LastEditDate="2020-08-27T00:03:56.493" LastActivityDate="2020-08-27T00:03:56.493" Title="Prove entanglement in the final state of the Deutsch-Jozsa circuit" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13454" PostTypeId="1" CreationDate="2020-08-24T12:31:40.310" Score="2" ViewCount="39" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13012" LastEditorUserId="55" LastEditDate="2020-08-25T19:31:38.807" LastActivityDate="2020-09-25T08:01:55.190" Title="Asymmetry in distributing phase change across components" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13455" PostTypeId="2" ParentId="13452" CreationDate="2020-08-24T12:40:27.390" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def oracle(qc: QuantumCircuit, qr: QuantumRegister):&#xA;    # Negate |101&amp;gt;&#xA;    qc.h(2)&#xA;    qc.x(1)&#xA;    qc.ccx(0,1,2)&#xA;    qc.h(2)&#xA;    qc.x(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Two Grover iterations should give you a 94.5% chance of measuring &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;, but if you comment out the &lt;code&gt;qc.x(qr)&lt;/code&gt; line you won't see this.&lt;/p&gt;&#xA;&lt;h3&gt;Explanation:&lt;/h3&gt;&#xA;&lt;p&gt;To perform Grover's algorithm, we need the diffuser to do a reflection around &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;. It is obvious how we can do a reflection around &lt;span class=&quot;math-container&quot;&gt;$|111\dots1\rangle$&lt;/span&gt;: a multiple controlled-Z gate (&lt;span class=&quot;math-container&quot;&gt;$MCZ$&lt;/span&gt;). To achieve a reflection around the state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, we wrap this gate in the transformations &lt;span class=&quot;math-container&quot;&gt;$|s\rangle \rightarrow |111\dots1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\dots1\rangle \rightarrow |s\rangle$&lt;/span&gt;, i.e&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_s = H^{\otimes n}X^{\otimes n}(MCZ) X^{\otimes n}H^{\otimes n}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you remove the X-gates, you no longer have &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt;, and instead something else that may work in specific cases but is not guaranteed to work generally.&lt;/p&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-08-24T12:40:27.390" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13456" PostTypeId="1" CreationDate="2020-08-24T13:15:55.717" Score="2" ViewCount="52" Body="&lt;p&gt;In some quantum algorithms, the output of the quanutm circuit is probabilistic. For example. the measurement outcome (once) for a specific qubit &amp;quot;0&amp;quot; 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 &amp;quot;0&amp;quot;, then we measure the rest, othervise, we will not record this time. Can this be done in Qiskit?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho_{is}$&lt;/span&gt;, where i and s represents the indicater and system. Then we can project this state as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_s=P\rho_{is}P^{\dagger}$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$P=|0\rangle \langle 0|\otimes I_s$&lt;/span&gt; the projector operator. But when I put this into a function called &amp;quot;state_fidelity&amp;quot; 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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for help!&lt;/p&gt;&#xA;" OwnerUserId="6128" LastEditorUserId="55" LastEditDate="2020-08-27T00:09:08.830" LastActivityDate="2020-08-27T00:09:08.830" Title="Can we measure the quantum circuit sequently when using Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13457" PostTypeId="2" ParentId="13433" CreationDate="2020-08-24T14:16:35.990" Score="0" Body="&lt;p&gt;Did you try to put a barrier between your two blocks? You can do this by writing this &lt;code&gt;qp.barrier()&lt;/code&gt; right after your first block, then Qiskit will transpile separately the two blocks. Is this what you were searching for?&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-08-24T14:16:35.990" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13458" PostTypeId="2" ParentId="13456" CreationDate="2020-08-24T15:02:58.890" Score="2" Body="&lt;p&gt;I believe you have a function that allows you to do that, check &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.Measure.c_if.html?highlight=measure%20c_if#qiskit.circuit.library.Measure.c_if&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation&lt;/a&gt; to see how this works exactly.&lt;/p&gt;&#xA;&lt;p&gt;If you want to see an example on how to use it, you can check the step 4 of the second part of &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial of Qiskit&lt;/a&gt;, the quantum teleportation, where they apply gates regarding the measured values.&lt;/p&gt;&#xA;&lt;p&gt;Hope this works! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-08-24T15:02:58.890" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13459" PostTypeId="2" ParentId="13453" CreationDate="2020-08-24T16:19:14.817" Score="2" Body="&lt;p&gt;Suppose we have two n-qubits states such that &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}|\psi\rangle = |\varphi\rangle$&lt;/span&gt;. Then you have the following (remember that H is reversible meaning we can go from the first to the second line) :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|\psi\rangle \text{ is separable iff }&amp;amp; \exists (|\psi_i\rangle)_{i \in [\![1,n]\!]} \text{ such that }  |\psi\rangle = |\psi_1\rangle \otimes ... \otimes |\psi_n\rangle \\&#xA;\text{iff } &amp;amp; \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} \\&#xA;\text{iff } &amp;amp; \exists (|\varphi_i\rangle)_{i \in [\![1,n]\!]} \text{ such that }  |\varphi\rangle = |\varphi_1\rangle \otimes ... \otimes |\varphi_n\rangle \\&#xA;\text{iff }&amp;amp; |\varphi\rangle \text{ is separable}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;More generally, I would say that if you have a separable state, if you apply any reversible 1-qubit gate then it stays separable.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt; factor for each &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; you apply, meaning the state should have a total factor of &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-08-24T16:19:14.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13460" PostTypeId="2" ParentId="13347" CreationDate="2020-08-24T16:41:52.140" Score="7" Body="&lt;p&gt;I don't know if the MIP* = RE result, and in particular the claim that there exists a nonlocal game &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\omega^*(G) \neq \omega^{co}(G)$&lt;/span&gt;, has any algorithmic implications for quantum computers. There's a couple things to say here.&lt;/p&gt;&#xA;&lt;p&gt;The MIP* = RE result is about what computational problems can be &lt;em&gt;verified&lt;/em&gt; using nonlocal games, as opposed to what can be &lt;em&gt;solved&lt;/em&gt; 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 &lt;em&gt;prove&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://arxiv.org/pdf/1811.12575.pdf&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/pdf/1811.12575.pdf&lt;/a&gt;. You might find this interesting.&lt;/p&gt;&#xA;" OwnerUserId="13048" LastActivityDate="2020-08-24T16:41:52.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13461" PostTypeId="2" ParentId="13348" CreationDate="2020-08-24T20:48:27.867" Score="2" Body="&lt;p&gt;Filling out a number of details for the sake of a complete answer —&lt;/p&gt;&#xA;&lt;p&gt;Starting from the linked article, &lt;em&gt;Distance measures to compare real and ideal quantum processes&lt;/em&gt; &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0408063.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[arXiv:quant-ph/0408063]&lt;/a&gt;, the definition of fidelity is given in Eqn. (4) as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ F(\rho,\sigma) = \mathrm{tr}\Bigl( \!\sqrt{\sqrt{\rho} \!\phantom|\sigma \phantom|\!\!\sqrt{\rho}\phantom|}\Bigr)^2$$&lt;/span&gt;&#xA;— which might look a bit intimidating, but demonstrates two important things about fidelity: that it is defined in general on &lt;em&gt;density operators&lt;/em&gt; (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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi \rangle$&lt;/span&gt; (which is not physical information about the state).&lt;/p&gt;&#xA;&lt;p&gt;The Bures metric (from the second column of page 4)  is then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B(\rho,\sigma) = \sqrt{2 - 2\sqrt{F(\rho,\sigma)}} $$&lt;/span&gt;&#xA;which for pure states simplifies to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned} B(\lvert \psi\rangle\! \langle \psi\rvert,\lvert \phi\rangle\! \langle \phi\rvert) &amp;amp;= \sqrt{2 - 2\sqrt{F(\lvert \psi\rangle\! \langle \psi\rvert,\lvert \phi\rangle\! \langle \phi\rvert)}} \\&amp;amp;=  \sqrt{2 - 2\bigl\lvert \langle\psi\vert \phi\rangle \bigr\rvert} \\&amp;amp;= \sqrt{2 - 2 \max \langle\psi'\vert \phi'\rangle},\end{aligned} $$&lt;/span&gt;&#xA;where the maximum is taken over unit vectors &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi'\rangle \propto \lvert \psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi'\rangle \propto \lvert \phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You ask (not unreasonably) why, for pure states, you would take the absolute value &lt;span class=&quot;math-container&quot;&gt;$\lvert \langle \psi \vert \phi \rangle \rvert$&lt;/span&gt;, instead of the real part &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Re}\,\langle \psi \vert \phi \rangle$&lt;/span&gt; as you would if you were dealing directly with the inner products of vectors &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi \rangle$&lt;/span&gt;. The answer is that, because we are interested in the &lt;em&gt;states&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi' \rangle \propto \lvert \phi \rangle$&lt;/span&gt;, the values of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Re}\,\langle \psi \vert \phi \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Re}\,\langle \psi \vert \phi' \rangle$&lt;/span&gt; usually won't be the same — but whether we use &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi' \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi \rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; if we were to consider different ways &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi' \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert \phi \rangle$&lt;/span&gt; to represent the same state.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;Euclidean distance&amp;quot; between &amp;quot;states&amp;quot;, and I expect that this is what they have in mind.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2020-08-25T10:26:53.197" LastActivityDate="2020-08-25T10:26:53.197" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13462" PostTypeId="2" ParentId="9786" CreationDate="2020-08-25T01:52:39.600" Score="4" Body="&lt;p&gt;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 (&lt;a href=&quot;https://arxiv.org/pdf/1008.1142.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1008.1142.pdf&lt;/a&gt;), Fritz (&lt;a href=&quot;https://arxiv.org/pdf/1008.1168.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1008.1168.pdf&lt;/a&gt;), and Ozawa (&lt;a href=&quot;https://arxiv.org/pdf/1211.2712.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1211.2712.pdf&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If you're looking for a computability-theoretic formulation of Connes' Embedding Conjecture, then there is one due to Goldbring and Hart (&lt;a href=&quot;https://arxiv.org/pdf/1308.2638.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1308.2638.pdf&lt;/a&gt;), which says that if CEP has a positive answer, then the &amp;quot;universal theory of type II von Neumann algebras&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;Here's yet another formulation of CEP that I like, which I find rather concrete:&lt;/p&gt;&#xA;&lt;p&gt;The Connes Embedding Conjecture posits that for every tracial von Neumann algebra &lt;span class=&quot;math-container&quot;&gt;$(M,\tau)$&lt;/span&gt;, for every finite subset &lt;span class=&quot;math-container&quot;&gt;$\{x_1,\ldots,x_n\}$&lt;/span&gt; of self-adjoint elements from &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, one can approximate them using finite-dimensional matrices in the following way: for every &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;gt; 0$&lt;/span&gt; and every integer &lt;span class=&quot;math-container&quot;&gt;$N \geq 1$&lt;/span&gt;, there exists a dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d \times d$&lt;/span&gt; matrices &lt;span class=&quot;math-container&quot;&gt;$A_1,\ldots,A_n$&lt;/span&gt; such that for every word &lt;span class=&quot;math-container&quot;&gt;$i \in \{1,\ldots,n\}^N$&lt;/span&gt;, we have the following approximation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="13048" LastActivityDate="2020-08-25T01:52:39.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13463" PostTypeId="1" CreationDate="2020-08-25T04:07:47.647" Score="1" ViewCount="57" Body="&lt;p&gt;In Qiskit's implementation of the HHL algorithm, they have the following line at the end of their code that allows them to compute the global phase we need to add on to the solution.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;f2 = sum(np.angle(in_vec * tmp_vec.conj() - 1 + 1)) / (np.log2(matrix.shape[0]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I was wondering if someone could explain where this comes from / why we do this / how it works. Any help is appreciated!&lt;/p&gt;&#xA;&lt;p&gt;By the way, the implementation can be found here: &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/linear_solvers/hhl.html#HHL&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/linear_solvers/hhl.html#HHL&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12399" LastEditorUserId="55" LastEditDate="2020-08-27T00:02:15.367" LastActivityDate="2020-08-27T00:02:15.367" Title="Help Understanding Line in Source Code" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13464" PostTypeId="2" ParentId="13435" CreationDate="2020-08-25T07:15:23.130" Score="1" Body="&lt;p&gt;To clear up my own confusion, these DFSs exist for the channel that maps &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$e^{j\phi}|1\rangle$&lt;/span&gt;. This is not the channel discussed in the question.&lt;/p&gt;&#xA;" OwnerUserId="12047" LastActivityDate="2020-08-25T07:15:23.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13465" PostTypeId="1" AcceptedAnswerId="13466" CreationDate="2020-08-25T08:18:25.130" Score="1" ViewCount="28" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\def\ket#1{|#1\rangle}&#xA;\def\bra#1{\langle#1|}&#xA;\def\mt#1{\mathrm{#1}}&#xA;\def\E{\mathcal E}&#xA;\def\F{\mathcal F}$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\ket\phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; be pure states on the same quantum system, so that &lt;span class=&quot;math-container&quot;&gt;$\ket\psi=\mt U\ket\phi$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$\mt U$&lt;/span&gt;.&#xA;Say we have a quantum operation (CPTP map) &lt;span class=&quot;math-container&quot;&gt;$\E$&lt;/span&gt;, and write &lt;span class=&quot;math-container&quot;&gt;$\sigma_\phi=\E(\ket\phi\bra\phi)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_\psi=\E(\ket\psi\bra\psi)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: given that &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket\phi$&lt;/span&gt; are related by a unitary &lt;span class=&quot;math-container&quot;&gt;$\mt U$&lt;/span&gt;, are &lt;span class=&quot;math-container&quot;&gt;$\sigma_\psi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_\phi$&lt;/span&gt; related by a quantum operation? I.e. does there exist a quantum operation &lt;span class=&quot;math-container&quot;&gt;$\F$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sigma_\psi=\F(\sigma_\phi)$&lt;/span&gt; (or the other way around)?&lt;/p&gt;&#xA;&lt;p&gt;My feeling says this has to be true, but I'm struggling to prove it.&lt;/p&gt;&#xA;" OwnerUserId="2687" LastActivityDate="2020-08-25T09:56:28.027" Title="Are two outputs of a quantum operation (CPTP map) themselves related by a quantum operation?" Tags="&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13466" PostTypeId="2" ParentId="13465" CreationDate="2020-08-25T09:56:28.027" Score="2" Body="&lt;p&gt;Two states are &lt;em&gt;always&lt;/em&gt; related by a CPTP map, regardless where they come from.&lt;/p&gt;&#xA;&lt;p&gt;Just take e.g. &lt;span class=&quot;math-container&quot;&gt;$$\mathcal F(\rho) =\mathrm{tr}(\rho) \, \sigma_\psi\ . $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-08-25T09:56:28.027" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13467" PostTypeId="1" CreationDate="2020-08-25T11:46:28.180" Score="-1" ViewCount="38" Body="&lt;p&gt;I needed help with CIRQ coding as I'm quite new to Quantum Computing.&#xA;I read the tutorials on CIRQ but don't really understand it.&#xA;I'd be very thankful if someone could help.&lt;/p&gt;&#xA;&lt;p&gt;A program to create the state using CIRQ coding.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A program to create the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|00\rangle+|11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12913" LastEditorUserId="27" LastEditDate="2020-08-27T08:15:47.720" LastActivityDate="2020-08-27T08:15:47.720" Title="Create this state using CIRQ Coding language" Tags="&lt;quantum-state&gt;&lt;programming&gt;&lt;mathematics&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-09-11T08:34:31.633" ContentLicense="CC BY-SA 4.0" />
  <row Id="13468" PostTypeId="2" ParentId="13467" CreationDate="2020-08-25T15:21:24.530" Score="3" Body="&lt;p&gt;The state you want to create is called a Bell State. Creating it can be accomplished &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state#Creating_Bell_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;by a Hadamard gate followed by a CNOT gate &lt;/a&gt;. In Cirq this will be&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q0 = cirq.GridQubit(0, 0)&#xA;q1 = cirq.GridQubit(0, 1)&#xA;&#xA;circuit = cirq.Circuit(&#xA;    cirq.H(q0),&#xA;    cirq.CNOT(q0, q1)&#xA;    &#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Printing the circuit show's that this is indeed the case.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(circuit)&#xA;&#xA;# Circuit:&#xA;# (0, 0): ───H───@───&#xA;#                │&#xA;# (0, 1): ───────X───&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-08-25T15:21:24.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13469" PostTypeId="1" CreationDate="2020-08-25T20:35:36.073" Score="1" ViewCount="70" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;PS: &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.210501&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.210501&lt;/a&gt; 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&lt;/p&gt;&#xA;" OwnerUserId="13056" LastActivityDate="2020-08-25T20:35:36.073" Title="Changing the Basis" Tags="&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;&lt;tensor-product&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13471" PostTypeId="2" ParentId="13454" CreationDate="2020-08-26T07:32:09.100" Score="1" Body="&lt;p&gt;If I understand your question correctly, you're asking why we choose to write phase gates like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\phi} \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;rather than&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} e^{-i\phi/2} &amp;amp; 0 \\ 0 &amp;amp; e^{i\phi/2} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;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.)&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. You might argue that we should be symmetrising that instead but, again, we'd find it much harder to think about and manipulate.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-26T07:32:09.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13472" PostTypeId="1" CreationDate="2020-08-26T11:57:57.570" Score="3" ViewCount="402" Body="&lt;p&gt;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?&#xA;Or is there any other way to do it?&lt;/p&gt;&#xA;" OwnerUserId="13060" LastEditorUserId="55" LastEditDate="2020-08-27T12:43:30.080" LastActivityDate="2020-08-27T12:43:30.080" Title="Is there any way we get the state vector/density matrix of a noisy simulation in qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;noise&gt;&lt;fidelity&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13473" PostTypeId="2" ParentId="13472" CreationDate="2020-08-26T12:32:28.790" Score="3" Body="&lt;p&gt;I think you can use noise in the statevector simulator. If nevertheless you want to use the qasm simulator, you can use snapshots: &lt;a href=&quot;https://qiskit.org/documentation/apidoc/aer_extensions.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/aer_extensions.html&lt;/a&gt;. 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: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/reference/ref_snapshot_state.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/reference/ref_snapshot_state.py&lt;/a&gt;. Then another example here for how to read the snapshot result: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/backends/qasm_simulator/qasm_snapshot.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/backends/qasm_simulator/qasm_snapshot.py&lt;/a&gt;   If you apply the snapshot on a subset of the qubits, be aware that the qubit ordering may be confusing.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-08-26T12:32:28.790" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13474" PostTypeId="1" AcceptedAnswerId="13475" CreationDate="2020-08-26T14:12:44.430" Score="2" ViewCount="79" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Equation 2.168&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$|{\tilde\psi_i}\rangle = \sum_j{u_{ij}|{\tilde\varphi_j}\rangle}$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$u_{ij}$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sum_i{|{\tilde\psi_i}\rangle\langle\tilde\psi_i|} = \sum_{ijk}{u_{ij}u_{ik}^*|\tilde\varphi_j\rangle\langle\tilde\varphi_j|}$&lt;/span&gt; (2.168)&lt;/p&gt;&#xA;&lt;p&gt;I don't get this step. If I take &lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt; and substitute this in the outer product I receive &lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;&lt;br&gt;&#xA;Can someone explain this to me please?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Equation 2.169 -&amp;gt; 2.170&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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|}$$&lt;/span&gt;&#xA;I can't understand why &lt;span class=&quot;math-container&quot;&gt;$(\sum_i{u_{ki}^\dagger u_{ij}}) = \delta_{kj}$&lt;/span&gt;.&lt;br&gt;I understand that  &lt;span class=&quot;math-container&quot;&gt;$u_{ki}^\dagger u_{ij} = I$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=j$&lt;/span&gt;, but why is it zero otherwise?&lt;/p&gt;&#xA;&lt;p&gt;It would be so kind if someone could enlighten me.&lt;/p&gt;&#xA;" OwnerUserId="11909" LastEditorUserId="55" LastEditDate="2020-08-26T23:55:39.377" LastActivityDate="2020-08-26T23:55:39.377" Title="Nielsen &amp; Chuang Theorem 2.6 Proof" Tags="&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13475" PostTypeId="2" ParentId="13474" CreationDate="2020-08-26T14:30:10.327" Score="4" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be a unitary matrix. By definition &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U=I$&lt;/span&gt;. So, if I take an off-diagonal element, this corresponds to (&lt;span class=&quot;math-container&quot;&gt;$j\neq k$&lt;/span&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(U^\dagger U)_{j,k}=I_{j,k}=0,&#xA;$$&lt;/span&gt;&#xA;and of course&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(U^\dagger U)_{j,k}=\sum_iu_{ji}^\star u_{ik}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-26T14:30:10.327" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="13476" PostTypeId="2" ParentId="9534" CreationDate="2020-08-26T15:49:19.670" Score="0" Body="&lt;p&gt;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. (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9705031.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Source&lt;/a&gt; for the diagrams / info)&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qMnZHm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qMnZHm.png&quot; alt=&quot;Parity matrix&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the associated circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/peoD7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/peoD7.png&quot; alt=&quot;Circuit for encoding scheme of [[7, 1, 3]]&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;One open question for me remains, namely in the necessity for the repetition code to begin with. Answers/edits on this front appreciated!&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-26T15:49:19.670" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13477" PostTypeId="1" CreationDate="2020-08-26T17:10:12.387" Score="1" ViewCount="93" Body="&lt;p&gt;I am attempting to run a VQE calculation on the 'ibmq_qasm_simulator'. The job is failing with a series of errors caused by:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.providers.ibmq.job.exceptions.IBMQJobApiError: &amp;quot;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.'&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have used the same code on the statevector simulator successfully. I have copied the full error message below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FAILURE: Can not get job id, Resubmit the qobj to get job id. Terra job error: 'Error submitting job: \'(\\\'Connection aborted.\\\', OSError(&amp;quot;(110, \\\'ETIMEDOUT\\\')&amp;quot;))\'' &#xA;Traceback (most recent call last):&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/session.py&amp;quot;, line 250, in request&#xA;    response.raise_for_status()&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/requests/models.py&amp;quot;, line 940, in raise_for_status&#xA;    raise HTTPError(http_error_msg, response=self)&#xA;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&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;Traceback (most recent call last):&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py&amp;quot;, line 856, in _retrieve_result&#xA;    result_response = self._api.job_result(self.job_id(), self._use_object_storage)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py&amp;quot;, line 243, in job_result&#xA;    return self._job_result_object_storage(job_id)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py&amp;quot;, line 263, in _job_result_object_storage&#xA;    download_url = job_api.result_url()['url']&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/rest/job.py&amp;quot;, line 147, in result_url&#xA;    return self.session.get(url).json()&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/requests/sessions.py&amp;quot;, line 546, in get&#xA;    return self.request('GET', url, **kwargs)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/session.py&amp;quot;, line 270, in request&#xA;    raise RequestsApiError(message) from ex&#xA;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.'&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;Traceback (most recent call last):&#xA;  File &amp;quot;OH-_iqs_length.py&amp;quot;, line 90, in &amp;lt;module&amp;gt;&#xA;    ret = vqe.run(quantum_instance)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py&amp;quot;, line 70, in run&#xA;    return self._run()&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py&amp;quot;, line 362, in _run&#xA;    optimizer=self.optimizer)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/vq_algorithm.py&amp;quot;, line 201, in find_minimum&#xA;    gradient_function=gradient_fn)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/components/optimizers/slsqp.py&amp;quot;, line 87, in optimize&#xA;    options=self._options)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/scipy/optimize/_minimize.py&amp;quot;, line 618, in minimize&#xA;    constraints, callback=callback, **options)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/scipy/optimize/slsqp.py&amp;quot;, line 423, in _minimize_slsqp&#xA;    g = append(fprime(x), 0.0)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/scipy/optimize/optimize.py&amp;quot;, line 327, in function_wrapper&#xA;    return function(*(wrapper_args + args))&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/scipy/optimize/slsqp.py&amp;quot;, line 63, in approx_jacobian&#xA;    jac[i] = (func(*((x0+dx,)+args)) - f0)/epsilon&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/scipy/optimize/optimize.py&amp;quot;, line 327, in function_wrapper&#xA;    return function(*(wrapper_args + args))&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py&amp;quot;, line 450, in _energy_evaluation&#xA;    sampled_expect_op = self._circuit_sampler.convert(self._expect_op, params=param_bindings)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/operators/converters/circuit_sampler.py&amp;quot;, line 194, in convert&#xA;    param_bindings=param_bindings)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/operators/converters/circuit_sampler.py&amp;quot;, line 272, in sample_circuits&#xA;    had_transpiled=self._transpile_before_bind)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/quantum_instance.py&amp;quot;, line 374, in execute&#xA;    self._skip_qobj_validation, self._job_callback)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/utils/run_circuits.py&amp;quot;, line 302, in run_qobj&#xA;    results.append(job.result(**qjob_config))&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py&amp;quot;, line 276, in result&#xA;    return self._retrieve_result(refresh=refresh)&#xA;  File &amp;quot;/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py&amp;quot;, line 869, in _retrieve_result&#xA;    'job {}: {}'.format(self.job_id(), str(err))) from err&#xA;qiskit.providers.ibmq.job.exceptions.IBMQJobApiError: &amp;quot;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.'&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can i do about fixing this? Any help would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="12714" LastEditorUserId="55" LastEditDate="2020-08-30T21:01:01.827" LastActivityDate="2021-05-27T23:06:35.563" Title="Unable to retrieve result for Job Error during VQE simulation" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13478" PostTypeId="2" ParentId="6987" CreationDate="2020-08-26T17:45:11.640" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;First off, accuracy of quantum chemistry simulations via &lt;strong&gt;Trotterization&lt;/strong&gt; 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 &lt;strong&gt;lot&lt;/strong&gt; of different types of basis sets, like &lt;a href=&quot;https://en.wikipedia.org/wiki/STO-nG_basis_sets&quot; rel=&quot;nofollow noreferrer&quot;&gt;sto-ng&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Basis_set_(chemistry)#Correlation-consistent_basis_sets&quot; rel=&quot;nofollow noreferrer&quot;&gt;coupled cluster&lt;/a&gt; bases, each with varying performance.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.ptable.com/#Electrons&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Carbon: 4 orbitals, 16 atoms&lt;/li&gt;&#xA;&lt;li&gt;Hydrogen: 1 orbital, 18 atoms&lt;/li&gt;&#xA;&lt;li&gt;Nitrogen: 5 orbitals, 2 atoms&lt;/li&gt;&#xA;&lt;li&gt;Oxygen: 5 orbitals, 4 atoms&lt;/li&gt;&#xA;&lt;li&gt;Sulfur: 9 orbitals, 1 atom&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;least accurate&lt;/strong&gt; simulations.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$ 2^n $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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 &lt;em&gt;double&lt;/em&gt; the storage cost of your computation... yikes!!)&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-08-26T17:45:11.640" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13479" PostTypeId="2" ParentId="13477" CreationDate="2020-08-26T18:00:54.500" Score="0" Body="&lt;p&gt;While it's not always helpful, you can find solutions for most error codes here: &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/manage/errors&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In your case since you're running with Qiskit Aqua, it automatically re-submitted the job, as indicated by&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FAILURE: Can not get job id, Resubmit the qobj to get job id.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So your VQE calculation should resume once the new job finishes.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-08-26T18:00:54.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13480" PostTypeId="1" CreationDate="2020-08-26T19:11:22.637" Score="2" ViewCount="78" Body="&lt;p&gt;Can anyone explain how Qiskit does the merging of single-qubit gates for the purpose of optimization?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;u1(lambda1) * u1(lambda2) = u1(lambda1 + lambda2)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;u1(lambda1) * u2(phi2, lambda2) = u2(phi2 + lambda1, lambda2)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;u2(phi1, lambda1) * u1(lambda2) = u2(phi1, lambda1 + lambda2)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;u1(lambda1) * u3(theta2, phi2, lambda2) = u3(theta2, phi2 + lambda1, lambda2)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;u3(theta1, phi1, lambda1) * u1(lambda2) = u3(theta1, phi1, lambda1 + lambda2)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using Ry(pi/2).Rz(2&lt;em&gt;lambda).Ry(pi/2) = Rz(pi/2).Ry(pi     2&lt;/em&gt;lambda).Rz(pi/2),&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;u2(phi1, lambda1) * u2(phi2,lambda2) = u3(pi - lambda1 - phi2, phi1 + pi/2, lambda2 + pi/2)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;For composing u3's or u2's with u3's,u2(phi,lambda) = u3(pi/2, phi, lambda)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;How do they come up with these equations? Is there a property to derive them?&lt;/p&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="55" LastEditDate="2020-08-27T13:11:24.417" LastActivityDate="2020-09-26T14:05:45.680" Title="Optimize chains of single-qubit u1, u2, u3 gates by combining them into a single gate in Qikist" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13481" PostTypeId="1" AcceptedAnswerId="13486" CreationDate="2020-08-26T20:50:22.620" Score="1" ViewCount="68" Body="&lt;p&gt;Is it possible to solve the following kind of optimization using Quantum Computing?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Minimize&#xA;5*x1 - 7*x2&#xA;&#xA;binary&#xA;x1&#xA;x2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If yes, is it possible to have a sample code using &lt;code&gt;QISKit&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2884" LastEditorUserId="55" LastEditDate="2020-08-30T21:01:17.997" LastActivityDate="2020-08-30T21:01:17.997" Title="Optimization using Quantum Logics" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;resource-request&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13482" PostTypeId="1" CreationDate="2020-08-27T02:30:50.317" Score="1" ViewCount="66" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;A qubit is a quantum system in which the Boolean states 0 and 1 are&#xA;rep- resented by a prescribed pair of normalised and mutually&#xA;orthogonal quantum states labeled as &lt;span class=&quot;math-container&quot;&gt;${|0⟩, |1⟩}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0011013.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;. Then a quantum register &lt;span class=&quot;math-container&quot;&gt;$\mid x_1x_2...x_n\rangle, x_i\in\{0,1\}$&lt;/span&gt; is defined to be collection of n qubits.&lt;/p&gt;&#xA;&lt;p&gt;Now I often see expressions like &lt;span class=&quot;math-container&quot;&gt;$\mid x_1, ... x_n \rangle$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; belong to some &lt;span class=&quot;math-container&quot;&gt;$S \subset \mathbf{Z}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can the individual constituents &lt;span class=&quot;math-container&quot;&gt;$\mid x_i \rangle$&lt;/span&gt; be called qubits even though they are non-binary?&lt;/li&gt;&#xA;&lt;li&gt;Would it be appropriate to call &lt;span class=&quot;math-container&quot;&gt;$\mid x_1, ... x_n \rangle$&lt;/span&gt; a qubit register in this case?&lt;/li&gt;&#xA;&lt;li&gt;What is the physical interpretation of such a register?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5710" LastEditorUserId="55" LastEditDate="2020-08-31T07:16:36.613" LastActivityDate="2020-08-31T07:16:36.613" Title="In $|x_1,...,x_n\rangle$, can the individual constituents be called qubits?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;interpretations&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13483" PostTypeId="1" AcceptedAnswerId="13484" CreationDate="2020-08-27T03:14:09.530" Score="2" ViewCount="86" Body="&lt;p&gt;I was trying to build the Toffoli gate using the following diagram (found in the qiskit textbook):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nl16f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nl16f.png&quot; alt=&quot;qiskit book toffoli gate diagram&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, I set &lt;code&gt;V := Rx(pi/2)&lt;/code&gt; (as shown in the following diagram) (Note: that I am switching now to the little-endian format)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/SWHYV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SWHYV.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, the unitary matrix equivalent to the previous was&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i &amp;amp; 0\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That will lead to a relative phase of &lt;span class=&quot;math-container&quot;&gt;$(-i)$&lt;/span&gt; in the states &lt;span class=&quot;math-container&quot;&gt;$\lvert 110 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert 111 \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What is the reason for that?&lt;/p&gt;&#xA;" OwnerUserId="12998" LastActivityDate="2020-08-27T04:07:09.503" Title="Unexpected Relative Phase while making the Toffoli Gate" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13484" PostTypeId="2" ParentId="13483" CreationDate="2020-08-27T04:07:09.503" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_x(\pi/2)$&lt;/span&gt; isn't a square root of the X gate. If you square it, you get &lt;span class=&quot;math-container&quot;&gt;$-iX$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. That's where the phase is coming from.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-27T04:07:09.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13485" PostTypeId="2" ParentId="13480" CreationDate="2020-08-27T07:13:28.923" Score="1" Body="&lt;p&gt;As pointed by &lt;em&gt;DaftWullie&lt;/em&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; for angles &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_a(\alpha)R_a(\beta) = R_a(\alpha+\beta). &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This can be used in the first identity for example, since &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; is in fact &lt;em&gt;z&lt;/em&gt;-rotation (up to global phase).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-08-27T07:13:28.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13486" PostTypeId="2" ParentId="13481" CreationDate="2020-08-27T07:14:20.770" Score="2" Body="&lt;p&gt;Qiskit has an optimization module and you can find tutorials that illustrate its functionality &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To solve the example you posted, e.g., with the Quantum Approximate Optimization Algorithm (QAOA), you can do the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer&#xA;from qiskit.optimization import QuadraticProgram&#xA;from qiskit.aqua.algorithms import QAOA&#xA;from qiskit.optimization.algorithms import MinimumEigenOptimizer&#xA;&#xA;# construct optimization problem&#xA;qp = QuadraticProgram()&#xA;qp.binary_var('x1')&#xA;qp.binary_var('x2')&#xA;qp.minimize(linear=[5, -7])&#xA;&#xA;# initialize optimizer&#xA;qaoa_mes = QAOA(quantum_instance=Aer.get_backend('statevector_simulator'))&#xA;qaoa = MinimumEigenOptimizer(qaoa_mes)&#xA;&#xA;# solve problem&#xA;result = qaoa.solve(qp)&#xA;print(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which prints:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;optimal function value: -7.0&#xA;optimal value: [0. 1.]&#xA;status: SUCCESS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Qiskit's optimization module also provides other quantum optimization algorithms for quadratic programs and you can find a more detailed description &lt;a href=&quot;https://medium.com/qiskit/towards-quantum-advantage-for-optimization-with-qiskit-9a564339ef26&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10429" LastActivityDate="2020-08-27T07:14:20.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13487" PostTypeId="2" ParentId="13482" CreationDate="2020-08-27T07:14:24.917" Score="3" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; you mention here are &lt;strong&gt;qudits&lt;/strong&gt;, they are the generalization of qubits to base &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|S| = d$&lt;/span&gt;. It is categorized by a superposition of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; states, same way a qubit is described by the superposition of 2 states.&lt;br /&gt;&#xA;In base 3 it has a specific name as well, this is called &lt;strong&gt;qutrit&lt;/strong&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-08-27T07:14:24.917" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13488" PostTypeId="1" AcceptedAnswerId="13491" CreationDate="2020-08-27T11:02:48.873" Score="1" ViewCount="58" Body="&lt;p&gt;The main functionality for ordering gates in a cirq circuit that I'm aware of is using the predefined insert strategies of &lt;code&gt;cirq.Circuit.insert()&lt;/code&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="562" LastActivityDate="2020-08-27T21:24:31.020" Title="Reordering commuting gates in cirq to reduce circuit depth?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13489" PostTypeId="1" AcceptedAnswerId="13497" CreationDate="2020-08-27T17:49:33.520" Score="3" ViewCount="69" Body="&lt;p&gt;I'm studying Shor algorithm. This is a demostration about the eigenvectors and eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$U_a$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://latex.codecogs.com/gif.latex?U_%7Ba%7D:&amp;space;%5Cleft&amp;space;|s&amp;space;%5Cright&amp;space;%5Crangle&amp;space;%5Crightarrow&amp;space;%5Cleft&amp;space;|sa&amp;space;%5Cmod&amp;space;N&amp;space;%5Cright&amp;space;%5Crangle&amp;space;%5C%5C&amp;space;%5C%5C&amp;space;%5C%5C&amp;space;U_%7Ba%7D&amp;space;%5Cleft|w_k%5Cright&amp;space;%5Crangle&amp;space;=&amp;space;%5Cfrac%7B1%7D%7B%5Csqrt%7Br%7D%7D&amp;space;%5Csum_%7Bs=0%7D%5E%7Br-1%7D&amp;space;e%5E%7B-2%5Cpi&amp;space;i&amp;space;%5Cfrac%7Bk%7D%7Br%7Ds%7D&amp;space;U_%7Ba%7D%5Cleft|a%5E%7Bs%7D&amp;space;%5Cmod&amp;space;N%5Cright&amp;space;%5Crangle&amp;space;%5C%5C&amp;space;=&amp;space;%5Cfrac%7B1%7D%7B%5Csqrt%7Br%7D%7D&amp;space;%5Csum_%7Bs=0%7D%5E%7Br-1%7D&amp;space;e%5E%7B-2%5Cpi&amp;space;i&amp;space;%5Cfrac%7Bk%7D%7Br%7Ds%7D%5Cleft|a%5E%7Bs&amp;plus;1%7D&amp;space;%5Cmod&amp;space;N%5Cright&amp;space;%5Crangle&amp;space;%5C%5C&amp;space;=&amp;space;e%5E%7B2%5Cpi&amp;space;i&amp;space;%5Cfrac%7Bk%7D%7Br%7D%7D&amp;space;%5Cfrac%7B1%7D%7B%5Csqrt%7Br%7D%7D&amp;space;%5Csum_%7Bs=0%7D%5E%7Br-1%7D&amp;space;e%5E%7B-2%5Cpi&amp;space;i&amp;space;%5Cfrac%7Bk%7D%7Br%7D(s&amp;plus;1)%7D%5Cleft|a%5E%7Bs&amp;plus;1%7D&amp;space;%5Cmod&amp;space;N%5Cright&amp;space;%5Crangle&amp;space;%5C%5C&amp;space;=&amp;space;e%5E%7B2%5Cpi&amp;space;i&amp;space;%5Cfrac%7Bk%7D%7Br%7D%7D&amp;space;%5Cleft&amp;space;|w_%7Bk%7D&amp;space;%5Cright&amp;space;%5Crangle&quot; title=&quot;U_{a}: \left |s \right \rangle \rightarrow \left |sa \mod N \right \rangle \\ \\ \\ U_{a} \left|w_k\right \rangle = \frac{1}{\sqrt{r}} \sum_{s=0}^{r-1} e^{-2\pi i \frac{k}{r}s} U_{a}\left|a^{s} \mod N\right \rangle \\ = \frac{1}{\sqrt{r}} \sum_{s=0}^{r-1} e^{-2\pi i \frac{k}{r}s}\left|a^{s+1} \mod N\right \rangle \\ = e^{2\pi i \frac{k}{r}} \frac{1}{\sqrt{r}} \sum_{s=0}^{r-1} e^{-2\pi i \frac{k}{r}(s+1)}\left|a^{s+1} \mod N\right \rangle \\ = e^{2\pi i \frac{k}{r}} \left |w_{k} \right \rangle&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can somebody explain me from the third step to the last?&lt;/p&gt;&#xA;" OwnerUserId="11696" LastEditorUserId="55" LastEditDate="2020-08-31T07:14:55.180" LastActivityDate="2020-08-31T07:14:55.180" Title="Eigenvectors and eigenvalues of the gate $U_a:|s\rangle\mapsto|sa \bmod N\rangle$" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13490" PostTypeId="1" AcceptedAnswerId="13496" CreationDate="2020-08-27T18:07:51.047" Score="3" ViewCount="89" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;For example, is there an entangled state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of two qubits such that for the joint probability mass function for a measurement in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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\},$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left\{ P(+, +) = |\langle + + | \psi\rangle|^2, P(+, -) = |\langle + - | \psi\rangle|^2,\\ P(-, +) = |\langle - + | \psi\rangle|^2, P(-, -) = |\langle - - | \psi\rangle|^2 \right\},$$&lt;/span&gt;&#xA;the measurement outcomes of the two qubits are dependent?&lt;/p&gt;&#xA;&lt;p&gt;I don't see why this shouldn't be possible, but I can't think of an example.&lt;/p&gt;&#xA;" OwnerUserId="551" LastEditorUserId="55" LastEditDate="2020-08-28T08:42:55.947" LastActivityDate="2020-08-28T09:02:15.670" Title="Example of a two-qudit state whose measurement outcomes are independent in one basis but dependent in another" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;correlations&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13491" PostTypeId="2" ParentId="13488" CreationDate="2020-08-27T21:24:31.020" Score="0" Body="&lt;p&gt;No, there's no built-in functionality to optimize the circuit in that way.&lt;/p&gt;&#xA;&lt;p&gt;There is &lt;code&gt;cirq.commutes(A, B)&lt;/code&gt; which will tell you if A and B commute. However, &lt;code&gt;cirq.commutes&lt;/code&gt; 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 &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/3274&quot; rel=&quot;nofollow noreferrer&quot;&gt;refuse to check if an operation commutes with a moment&lt;/a&gt;. You can instead use &lt;code&gt;cirq.definitely_commutes(A, B)&lt;/code&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-27T21:24:31.020" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13494" PostTypeId="1" CreationDate="2020-08-28T00:09:38.253" Score="2" ViewCount="211" Body="&lt;p&gt;I try to run simple circuit measurement program using Qiskit in Visual Code.  I received this error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;AttributeError: 'IBMQFactory' object has no attribute 'backend'&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;from the line of code  &lt;code&gt;print(IBMQ.backends())&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does anyone know what this mean and how to solve it?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5124" LastEditorUserId="55" LastEditDate="2020-08-31T07:13:48.843" LastActivityDate="2021-05-28T11:28:32.073" Title="IBMQFactory object has not attribute backends" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13495" PostTypeId="2" ParentId="13494" CreationDate="2020-08-28T00:20:34.317" Score="1" Body="&lt;p&gt;With the help of documentation from this URL &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ibmq-provider&lt;/a&gt;, I realized that I need to run &lt;code&gt;load_account()&lt;/code&gt; of my &lt;code&gt;APIToken&lt;/code&gt; and store the provider object as shown below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;my_provider = IBMQ.load_account()&#xA;print(my_provider.backends())&#xA;backend = my_provider.get_backend('ibmq_qasm_simulator')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5124" LastEditorUserId="1386" LastEditDate="2021-05-28T11:28:32.073" LastActivityDate="2021-05-28T11:28:32.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13496" PostTypeId="2" ParentId="13490" CreationDate="2020-08-28T02:24:11.073" Score="3" Body="&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + i|11\rangle$&lt;/span&gt; has deterministic Z parity and random X parity.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2DVgx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2DVgx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Basically the trick is to rotate &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |11\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-28T02:24:11.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13497" PostTypeId="2" ParentId="13489" CreationDate="2020-08-28T07:18:20.833" Score="3" Body="&lt;p&gt;You have the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;Perform a change of variable &lt;span class=&quot;math-container&quot;&gt;$p=s+1$&lt;/span&gt; so this simply reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{r}}\sum_{p=1}^{r}e^{-2\pi i\frac{k}{r}p}|a^p\text{ mod }N\rangle.&#xA;$$&lt;/span&gt;&#xA;Now consider for a moment that &lt;span class=&quot;math-container&quot;&gt;$p=r$&lt;/span&gt; term,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-2\pi i\frac{k}{r}r}|a^r\text{ mod }N\rangle=|a^r\text{ mod }N\rangle.&#xA;$$&lt;/span&gt;&#xA;By definition, &lt;span class=&quot;math-container&quot;&gt;$a^r\equiv 1\text{ mod }N$&lt;/span&gt;, which we could also write as &lt;span class=&quot;math-container&quot;&gt;$a^0$&lt;/span&gt;. Hence, this term is exactly the same as using &lt;span class=&quot;math-container&quot;&gt;$p=0$&lt;/span&gt; instead. Thus, the state has become&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{r}}\sum_{p=0}^{r-1}e^{-2\pi i\frac{k}{r}p}|a^p\text{ mod }N\rangle,&#xA;$$&lt;/span&gt;&#xA;which &lt;em&gt;is&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|w_k\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-28T07:18:20.833" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13498" PostTypeId="2" ParentId="13490" CreationDate="2020-08-28T08:56:42.423" Score="2" Body="&lt;p&gt;Consider two copies of a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional system, &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_1,\mathcal X_2$&lt;/span&gt;, and take two &lt;a href=&quot;https://en.wikipedia.org/wiki/Mutually_unbiased_bases&quot; rel=&quot;nofollow noreferrer&quot;&gt;mutually unbiased bases&lt;/a&gt; (MUBs) in each space. Denote these bases with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\ket}[1]{\lvert #1\rangle} U\equiv \{\ket{u_k}\}_k,\,V\equiv \{\ket{v_k}\}_k.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Consider the state &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_1\otimes\mathcal X_2\ni\ket\psi\equiv\sum_k \ket{u_k}\otimes\ket{u_k}$&lt;/span&gt; (apply normalisations at will).&lt;/p&gt;&#xA;&lt;p&gt;Then, measuring in the basis &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on both sides, the measurement outcomes are fully correlated: if &lt;span class=&quot;math-container&quot;&gt;$\ket{u_k}$&lt;/span&gt; is found in &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_1$&lt;/span&gt;, then with certainty &lt;span class=&quot;math-container&quot;&gt;$\ket{u_k}$&lt;/span&gt; will be found in &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, using different bases on different sides, we get fully uncorrelated outcomes. For example, measuring with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_1$&lt;/span&gt;, the post-measurement state on &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_2$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$\ket{u_k}$&lt;/span&gt;. Measuring this state in the basis &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; we can get any &lt;span class=&quot;math-container&quot;&gt;$\ket{v_j}$&lt;/span&gt; with equal probability.&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;em&gt;i.e.&lt;/em&gt; change the measurement basis in both spaces at the same time, you just need &lt;em&gt;three&lt;/em&gt; MUBs, so that the state give correlated outcomes in &lt;span class=&quot;math-container&quot;&gt;$U\otimes U$&lt;/span&gt; but uncorrelated ones in &lt;span class=&quot;math-container&quot;&gt;$V\otimes W$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; the third MUB.&lt;/p&gt;&#xA;&lt;p&gt;Of course, which bases you want to use will also depend on the initial state. &lt;em&gt;E.g.&lt;/em&gt;, the example in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13496/55&quot;&gt;this other answer&lt;/a&gt; works by using the same measurement basis on both sides (the Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis) because the initial state includes some phases.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-08-28T09:02:15.670" LastActivityDate="2020-08-28T09:02:15.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13499" PostTypeId="1" AcceptedAnswerId="13501" CreationDate="2020-08-28T20:34:12.587" Score="1" ViewCount="103" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}&#xA;\newcommand{\ket}[1]{\left|#1\right&amp;gt;}$&lt;/span&gt;Here is what I tried:&lt;/p&gt;&#xA;&lt;p&gt;Given that we have two projectors:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_i \ket{i} \bra{i}, \hspace{2em}&#xA;B = \sum_j \ket{j} \bra{j}&#xA;$$&lt;/span&gt;&#xA;The goal is to prove that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A \otimes B = \sum_k \ket{k} \bra{k}. \tag1\label1&#xA;$$&lt;/span&gt;&#xA;Plugging into \eqref{1}, we get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A \otimes B&#xA;= \left( \sum_i \ket{i} \bra{i} \right) \otimes \left( \sum_j \ket{j} \bra{j} \right)&#xA;= \sum_{i,j} \ket{i} \bra{i} \otimes \ket{j} \bra{j}&#xA;\tag{2}\label{2}&#xA;$$&lt;/span&gt;&#xA;I'm not sure how to proceed from \eqref{2}. It would be convenient if for every &lt;span class=&quot;math-container&quot;&gt;$\ket{i}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{j}$&lt;/span&gt; there is a &lt;span class=&quot;math-container&quot;&gt;$\ket{k}$&lt;/span&gt; for which the following identity is true:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{k} \bra{k} = \ket{i} \bra{i} \otimes \ket{j} \bra{j} \tag{3}\label{3}&#xA;$$&lt;/span&gt;&#xA;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}?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="55" LastEditDate="2020-08-28T22:33:12.470" LastActivityDate="2020-08-29T06:58:43.967" Title="Nielsen &amp; Chuang Exercise 2.32: Show that the tensor product of two projectors is a projector" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13500" PostTypeId="1" AcceptedAnswerId="13502" CreationDate="2020-08-29T04:48:54.707" Score="1" ViewCount="110" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle,|\psi\rangle$&lt;/span&gt; be two state vectors, and let &lt;span class=&quot;math-container&quot;&gt;$d=\frac{1}{2}\mathrm{Tr}(\sqrt{(|\phi\rangle\langle\phi|-|\psi\rangle\langle\psi|)^2})$&lt;/span&gt; be their trace distance. Then it will always hold that &lt;span class=&quot;math-container&quot;&gt;$d = \sqrt{1-|\langle\phi|\psi\rangle|^2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13074" LastEditorUserId="55" LastEditDate="2020-08-31T09:32:15.997" LastActivityDate="2020-08-31T09:32:15.997" Title="Relation between trace distance and inner product between pure states" Tags="&lt;textbook-and-exercises&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13501" PostTypeId="2" ParentId="13499" CreationDate="2020-08-29T06:58:43.967" Score="3" Body="&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a projector if and only if &lt;span class=&quot;math-container&quot;&gt;$P^2=P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P=P^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, let's take&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P=P_A\otimes P_B.&#xA;$$&lt;/span&gt;&#xA;We can calculate &lt;span class=&quot;math-container&quot;&gt;$P^\dagger=P_A^\dagger\otimes P_B^\dagger=P_A\otimes P_B=P$&lt;/span&gt;, which follows from the assumption that &lt;span class=&quot;math-container&quot;&gt;$P_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_B$&lt;/span&gt; are projectors.&lt;/p&gt;&#xA;&lt;p&gt;Similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P^2=P_A^2\otimes P_B^2=P_A\otimes P_B=P.&#xA;$$&lt;/span&gt;&#xA;You're done!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-08-29T06:58:43.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13502" PostTypeId="2" ParentId="13500" CreationDate="2020-08-29T07:55:08.850" Score="2" Body="&lt;p&gt;A derivation of this is given in Mark Wilde's book &lt;a href=&quot;https://arxiv.org/abs/1106.1445&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1106.1445&lt;/a&gt; equation 9.173, pages 274-275.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-08-29T07:55:08.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13503" PostTypeId="1" AcceptedAnswerId="13504" CreationDate="2020-08-29T09:00:37.367" Score="3" ViewCount="46" Body="&lt;p&gt;I'm following the Qiskit textbook. I'm currently here: &lt;a href=&quot;https://quantum-computing.ibm.com/jupyter/user/qiskit-textbook/content/ch-states/representing-qubit-states.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/jupyter/user/qiskit-textbook/content/ch-states/representing-qubit-states.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's an example of my initialization code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;initial_state = [1/sqrt(2), 1j/sqrt(2)]&#xA;&#xA;qc = QuantumCircuit(1)&#xA;&#xA;qc.initialize(initial_state, 0)&#xA;&#xA;state = execute(qc,backend).result().get_statevector() &#xA;&#xA;print(state) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;[0.70710678+0.j         0.        +0.70710678j]&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;results = execute(qc,backend).result().get_counts()&#xA;&#xA;plot_histogram(results)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I plot this to a histogram, the same 50/50 distribution occurs as when I remove the imaginary &amp;quot;j&amp;quot; from the initialization.  Why is the j in there?&lt;/p&gt;&#xA;" OwnerUserId="12442" LastEditorUserId="55" LastEditDate="2020-08-30T21:00:02.160" LastActivityDate="2020-08-30T21:00:02.160" Title="When defining the state vector of a qubit in qiskit, what difference does putting &quot;j&quot; make?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13504" PostTypeId="2" ParentId="13503" CreationDate="2020-08-29T10:21:12.280" Score="1" Body="&lt;p&gt;Those two states are different quantum states (with different relative phases) that have the same probabilities of measurement outcomes when we measure in &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis. The first state without &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; in the Python):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|i\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to show the difference between these two states let's apply &lt;span class=&quot;math-container&quot;&gt;$H S^{\dagger}$&lt;/span&gt; gates to each of them and see how much different results we can obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$|\frac{1-i}{2}|^2 = |\frac{1+i}{2}|^2 = 0.5$&lt;/span&gt;. Now let's apply the same gates to the &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H S^{\dagger} |i\rangle = H \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. These two states (&lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;) can lead to different results, so &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; in Python) does make a difference.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Answer to the questions in the comments&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Measurement in &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis is the conventional measurement: measuring if the state is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state (there are other basis measurements: a related example can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11791/9459&quot;&gt;answer&lt;/a&gt;). &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are eigenvectors (also eigenbasis) of &lt;span class=&quot;math-container&quot;&gt;$Z=\begin{pmatrix} 1&amp;amp;0 \\ 0 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt; operator. &lt;span class=&quot;math-container&quot;&gt;$HS^{\dagger}$&lt;/span&gt; is two separate gates: &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt;. Here I have applied firstly &lt;span class=&quot;math-container&quot;&gt;$S^\dagger = \begin{pmatrix} 1&amp;amp;0 \\ 0 &amp;amp; -i \end{pmatrix}$&lt;/span&gt; gate, then &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp;1 \\ 1 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-08-29T18:32:54.447" LastActivityDate="2020-08-29T18:32:54.447" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13505" PostTypeId="2" ParentId="8702" CreationDate="2020-08-29T16:27:34.757" Score="4" Body="&lt;p&gt;Use the command &lt;code&gt;ls -alt&lt;/code&gt; in Terminal on macOS to find hidden files. It's there. This should work for all Mac users.&lt;/p&gt;&#xA;" OwnerUserId="13081" LastEditorUserId="45" LastEditDate="2020-09-01T06:53:47.410" LastActivityDate="2020-09-01T06:53:47.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13506" PostTypeId="1" CreationDate="2020-08-29T19:06:35.560" Score="1" ViewCount="103" Body="&lt;p&gt;I have a single qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |s\rangle = \alpha_0|0\rangle + \alpha_1|1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha_0$&lt;/span&gt; may be 0 whereas &lt;span class=&quot;math-container&quot;&gt;$\alpha_1$&lt;/span&gt; is always positive and above &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Almost always &lt;span class=&quot;math-container&quot;&gt;$$\alpha_0 &amp;lt;&amp;lt;  \alpha_1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there any way to flip &lt;span class=&quot;math-container&quot;&gt;$\alpha_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha_1$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$\alpha_0 &amp;gt; 0$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I was thinking of having two ancillary qubits and perform two controlled CNOTs to detect both state &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and state &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and then CCNOT with those two ancillary qubits to flip &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But does this make sense? I am not sure if detecting a superposition is possible in this way&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-08-30T23:43:10.413" LastActivityDate="2020-09-01T07:10:58.930" Title="Can I switch $\alpha_0$ and $\alpha_1$ conditionally to $\alpha_0&gt;0$ in a state $\alpha_0|0\rangle+\alpha_1|1\rangle$?" Tags="&lt;quantum-operation&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13507" PostTypeId="2" ParentId="13506" CreationDate="2020-08-29T19:09:02.210" Score="1" Body="&lt;p&gt;No, that's not possible. For example, it would allow you to implement an operation that sent both &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Two states going to the same state means the operation is irreversible and non-unitary.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-29T19:09:02.210" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="13508" PostTypeId="1" CreationDate="2020-08-30T10:25:33.640" Score="1" ViewCount="102" Body="&lt;p&gt;Recently May and Schlieper have published a preprint (&lt;a href=&quot;https://arxiv.org/abs/1905.10074&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1905.10074&lt;/a&gt;) 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 ( &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12354/shors-discrete-logarithm-algorithm-with-a-qft-with-a-small-prime-base&quot;&gt;Shor&amp;#39;s Discrete Logarithm Algorithm with a QFT with a small prime base&lt;/a&gt;) 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 &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; (it seems it can). If further, the QFT can be factored into &lt;span class=&quot;math-container&quot;&gt;$\bmod w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bmod L$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$N=Lw$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O(\log N)}$&lt;/span&gt; qubits. &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O(\log N)}$&lt;/span&gt; runs with different small prime bases suffice to reconstruct using the Chinese Remainder Theorem the entire logarithm in polynomial time (roughly quintic).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    x_{i+1,b} = G_ix_{i,a} + n_{i+1,b}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is Gaussian noise, &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; are the values of variables representing the probability amplitudes at each layer and &lt;span class=&quot;math-container&quot;&gt;$G_i$&lt;/span&gt; is the unitary quantum gate. This implies Gaussian distributions like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&#xA;which can then be converted to a MRF.&lt;/p&gt;&#xA;&lt;p&gt;(Explanation of Factor Analysis)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://users.ics.aalto.fi/harri/thesis/valpola_thesis/node37.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://users.ics.aalto.fi/harri/thesis/valpola_thesis/node37.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.cs.ubc.ca/%7Emurphyk/Teaching/CS532c_Fall04/Lectures/lec17.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cs.ubc.ca/~murphyk/Teaching/CS532c_Fall04/Lectures/lec17.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;(GaBP explained here: &lt;a href=&quot;https://arxiv.org/abs/0811.2518&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0811.2518&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;The 4 Clifford+T gates for a universal set of quantum gates. They are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt{2}}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X = $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CX = $&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{pmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T = $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \omega&#xA;\end{pmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\omega = e^{\frac{i \pi}{4}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;X Gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;T Gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;CX Gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;H Gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;quantum&amp;quot; circuits can be used to solve &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PP-Complete}$&lt;/span&gt; problems.&lt;/p&gt;&#xA;&lt;p&gt;A natural hashing strategy is to use a non-cryptographic hash function family like &lt;span class=&quot;math-container&quot;&gt;$(ax+b) \bmod 2^n \div 2^{(n-p)}$&lt;/span&gt; which is&#xA;well adapted to hashing qubits, but for each layer keep up to 2 &amp;quot;windows&amp;quot; open on the qubits acted on by the preceding and following quantum gates. Conveniently, the shared covariance between layers can be represented sparsely by &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}(m=2^p)$&lt;/span&gt; edges. Qubits from this hash function can be &amp;quot;wrapped&amp;quot; and &amp;quot;unwrapped&amp;quot; out of the hashed qubits for gates to act on them because the hash function is non-cryptographic.&lt;/p&gt;&#xA;&lt;p&gt;For ordinary qubits, the universal hash function family &lt;span class=&quot;math-container&quot;&gt;$(ax+b) \mod 2^n \div 2^{n-p}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$m=2^p$&lt;/span&gt; is effective. &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, 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' &lt;span class=&quot;math-container&quot;&gt;$x_{constant}$&lt;/span&gt;, the 'bitfield' to be wrapped into the hashed qubits can be specified as &lt;span class=&quot;math-container&quot;&gt;$x_{wrap}$&lt;/span&gt;, and the 'bitfield' to be unwrapped can be specified as &lt;span class=&quot;math-container&quot;&gt;$x_{unwrap}$&lt;/span&gt;.  For fixed bases of both pair of qubits, the hashed qubits differ by &lt;span class=&quot;math-container&quot;&gt;$a(x_{wrap} - x_{unwrap}) \mod 2^n \div 2^{n-p}$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$8 \times 2 \times 2 + 2 + 1 = 35$&lt;/span&gt; neighbors including itself and each layer of the MRF is sparse, so &lt;span class=&quot;math-container&quot;&gt;$2^p = O(m)$&lt;/span&gt;. If some of the wrapped and unwrapped qubits overlap, the overlapping 'bitfields' will cancel, resulting in the correct difference.&lt;/p&gt;&#xA;&lt;p&gt;Hashed precisions &lt;span class=&quot;math-container&quot;&gt;$A^h_{ij}$&lt;/span&gt; can be computed as multiple of the unhashed precisions &lt;span class=&quot;math-container&quot;&gt;$A_{ij}$&lt;/span&gt; up to the point that the precision is split among adjacent hashed qubits. This is because &lt;span class=&quot;math-container&quot;&gt;$A_{ij}$&lt;/span&gt; in unhashed form consists of copies of &lt;span class=&quot;math-container&quot;&gt;$A_{ij}$&lt;/span&gt; restricted to qubits which are acted on by a quantum gate.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$B_{\alpha} = a(x_{wrap} - x_{unwrap}) \bmod 2^n \div 2^{n-p}$&lt;/span&gt; and \newline&#xA;&lt;span class=&quot;math-container&quot;&gt;$C_{\alpha}= a(x_{wrap} - x_{unwrap}) \bmod 2^{n-p} / 2^{n-p}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The wrapping and unwrapping affects hashed variables like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x^h_{a,b,h(i)+B_{\alpha}+1} = C_{\alpha}\sum_i x_{a,c,i}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x^h_{a,b,h(i)+B_{\alpha}} = (1-C_{\alpha}) \sum_i x_{a,c,i}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;%&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is a normalization constant equal to the number of unhashed qubits mapped to hashed qubits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$x'$&lt;/span&gt; represents the next layer. &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;s are hashed &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;s, but there is no need to specify which &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; because each layer is homogeneous. &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is the unitary gate, &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; represent the unwrapped variables. In most cases, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; will represent different unwrapped qubits.&lt;/p&gt;&#xA;&lt;p&gt;The noise model is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C_{\alpha}x'_{a,\mu+B_{\alpha}+1} =  C_{\alpha}Gx_{b,\mu} +  n_{\mu}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(1-C_{\alpha})x'_{a,\mu+B_{\alpha}} = (1-C_{\alpha})Gx_{b,\mu} + n_{\mu}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$x'$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; are sums of the unhashed variables. The &lt;span class=&quot;math-container&quot;&gt;$C_{\alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1-C_{\alpha}$&lt;/span&gt; weights are the fractions of the variables which map to each pattern. The noise &lt;span class=&quot;math-container&quot;&gt;$n_{\mu}$&lt;/span&gt; is the sum of the noise for each variable with the same hash value (&lt;span class=&quot;math-container&quot;&gt;$C_{\alpha}\sum_{h^{-1}(\mu)} n_i$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(1-C_{\alpha})\sum_{h^{-1}(\mu)} n_i$&lt;/span&gt;) and, as such, grows quadratically, while variables grow linearly. This means the noise variables are proportional to &lt;span class=&quot;math-container&quot;&gt;$\sqrt{C_{\alpha}}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1-C_{\alpha}}$&lt;/span&gt; and the variance is proportional to &lt;span class=&quot;math-container&quot;&gt;$C_{\alpha}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1-C_{\alpha}$&lt;/span&gt;. The linear weighting on the variance partially cancels out the quadratic weighting on the variables, resulting in a linear factor for the precision matrix.&lt;/p&gt;&#xA;&lt;p&gt;This results in Gaussians&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   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)} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;First and second layer precisions are the same as the unhashed precisions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A^h_{x,x,a,b,\mu,\mu} =  A_{x,x,a,b,i,i}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The second layer precisions are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A^h_{x',x',a,b,\mu,\mu} = A_{x',x',a,b,i,i}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The interlayer precisions are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A^h_{x',x,a,b,\mu,\mu+B_{\alpha}+1} = C_{\alpha}A_{x',x,a,b,i,i}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A^h_{x',x,a,b,\mu,\mu+B_{\alpha}}= (1-C_{\alpha})A_{x',x,a,b,i,i}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In other words only the interlayer precisions change.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$32m$&lt;/span&gt; variables will be used at each layer. (We can set &lt;span class=&quot;math-container&quot;&gt;$m = 2^{ p }$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; may be given a lower bound of &lt;span class=&quot;math-container&quot;&gt;$\frac{m-1}{m}p(x)$&lt;/span&gt; and, since the number of levels in &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is small, &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; (usually 4), there is an upper bound of &lt;span class=&quot;math-container&quot;&gt;$\frac{m-1}{m}p(x)+\frac{1}{m}$&lt;/span&gt; from the available probality and and upper bound of  &lt;span class=&quot;math-container&quot;&gt;$\frac{m-1}{m}p(x)+\frac{c^2}{m}$&lt;/span&gt; from summing out forgotten qubits.&lt;/p&gt;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; stands for the unwrapped qubits in the following layer. This can include the qubits unwrapped for the next gate. &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are the hashed qubits which are preserved going from one gate to another. &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; are the unwrapped qubits in the previous layer that are hashed into &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and forgotten. &lt;span class=&quot;math-container&quot;&gt;$y'$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; hashed with &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$z'$&lt;/span&gt; are the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; which correspond to the hashed with &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; basis &lt;span class=&quot;math-container&quot;&gt;$y'$&lt;/span&gt;. The transformation between  &lt;span class=&quot;math-container&quot;&gt;$w_{x,y',z'}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w_{x,y,z}$&lt;/span&gt; is unitary.&lt;/p&gt;&#xA;&lt;p&gt;The weights for &lt;span class=&quot;math-container&quot;&gt;$w_{x,y',z'}$&lt;/span&gt; are calculated from the universal hash function &lt;span class=&quot;math-container&quot;&gt;$(ax+b) \bmod 2^n \div 2^{n-p}$&lt;/span&gt;. Each basis vector can be encoded as an unsigned integer and hashed into a smaller unsigned integer, like a bitfield. To hash the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; qubits into the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; qubits, add the bitfield represening the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; qubits and apply the hash function. The &lt;span class=&quot;math-container&quot;&gt;$\bmod 2^n$&lt;/span&gt; differs by &lt;span class=&quot;math-container&quot;&gt;$ax_z \bmod 2^n$&lt;/span&gt;. The resulting &lt;span class=&quot;math-container&quot;&gt;$y'$&lt;/span&gt; value will then shift by either &lt;span class=&quot;math-container&quot;&gt;$\lfloor ax_z \bmod 2^n \div 2^{n-p} \rfloor$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\lfloor ax_z \bmod 2^n \div 2^{n-p} \rfloor +1$&lt;/span&gt;. The fractions of the two shifts are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$1 - \frac{ax_z \bmod 2^{n-p} }{2^{n-p}} $$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{ax_z \bmod 2^{n-p} }{2^{n-p}}$$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&lt;p&gt;The state after the last quantum gate is applied, but before the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; qubits are hashed in and discarded is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;  \psi = \sum_x  \sum_y \sum_z w_{x,y,z}|x \rangle | y \rangle |z \rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The state remembered by the next layer after &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is hashed into &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and forgotten is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;  \psi' = \sum_x  \sum_{y'} w_{x,y'}|x \rangle | y' \rangle&#xA;\end{equation}&lt;/span&gt;&#xA;This differs from May and Schlieper because &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;s originally with the same &lt;span class=&quot;math-container&quot;&gt;$(x,y)$&lt;/span&gt; will be randomly sent to a different &lt;span class=&quot;math-container&quot;&gt;$(x,y')$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The condition in Theorem 6.1&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    W_{x,y} := \sum_z w_{x,y,z} = 0&#xA;\end{equation}&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    W_{x,y'} := \sum_{z'} w_{x,y',z'}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probability of observing a hashed state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    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)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; is a normalization factor over all possible hash functions in the given family. The sum over &lt;span class=&quot;math-container&quot;&gt;$z'$&lt;/span&gt; is correct because the &lt;span class=&quot;math-container&quot;&gt;$ w_{x,y',z'}$&lt;/span&gt; are unitary transformations of &lt;span class=&quot;math-container&quot;&gt;$ w_{x,y,z}$&lt;/span&gt;. The universality of the hash function allows the expression to be simplified to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    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}}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; basis vectors.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    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&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;     \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}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$p_h$&lt;/span&gt; is a probability, there is a different logical upper bound&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;     \frac{m-1}{m} p(x,y') \leq p_h(x,y') \leq  \frac{m-1}{m} p(x,y') +  \frac{1}{m}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; will still leave the same error margins and the desired single qubit probability amplitude estimates will be accurate to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}(\frac{1}{m})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Summing over only the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; qubits is necessary because it can be that &lt;span class=&quot;math-container&quot;&gt;$W_x &amp;gt; 1$&lt;/span&gt; even with only polynomially many hashed variables which cannot be interpreted as a probability. For instance, one layer of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Hadamard gates with state to be hashed &lt;span class=&quot;math-container&quot;&gt;$\sum^{2^n -1}_{i=0}\frac{1}{\sqrt{2^n}} x_i$&lt;/span&gt;, would have &lt;span class=&quot;math-container&quot;&gt;$W_x = 2^n$&lt;/span&gt; which is nonsensically large. Even a hashed state would still have &lt;span class=&quot;math-container&quot;&gt;$W_x = m$&lt;/span&gt;. To control &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;To guarantee &lt;span class=&quot;math-container&quot;&gt;$W_{x,y'}$&lt;/span&gt; is small enough, we need to reduce the number of &lt;span class=&quot;math-container&quot;&gt;$z'$&lt;/span&gt; per &lt;span class=&quot;math-container&quot;&gt;$x,y'$&lt;/span&gt; to a constant so that increasing &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; will make them inconsequential. The terms summed in &lt;span class=&quot;math-container&quot;&gt;$W_{x,y'}$&lt;/span&gt; will always be &lt;span class=&quot;math-container&quot;&gt;$|w_{x,y'}| \leq 1$&lt;/span&gt; so &lt;span class=&quot;math-container&quot;&gt;$W_{x,y'} \leq \frac{c^2}{m}$&lt;/span&gt;. On average, the &lt;span class=&quot;math-container&quot;&gt;$w_{x,y',z'}$&lt;/span&gt; will be much smaller, on the order of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}(\frac{1}{\sqrt{m}})$&lt;/span&gt; which results in an average error in probability around &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}(\frac{1}{m^2})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$y'$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathrm{PP-Complete}$&lt;/span&gt; counting problems which are considerably hard than &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NP}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the worst case, amplitude errors will add up over &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; gates, so amplitude and probability errors at the end of the circuit will be at most &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}(\frac{g}{m})$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is large enough for the linear approximation to hold to get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    \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}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, as long as &lt;span class=&quot;math-container&quot;&gt;$m \gg g \epsilon$&lt;/span&gt;, the final error in probability and probability amplitude will be &lt;span class=&quot;math-container&quot;&gt;$&amp;lt; \epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Using the broadcast variant of GaBP, the runtime to calculate probability amplitudes is &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}(E \log N)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the number of edges and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\pm \epsilon$&lt;/span&gt;, the running time is &lt;span class=&quot;math-container&quot;&gt;$\mathrm{O}((\frac{g^2+gn\log g}{\epsilon})\log{(\frac{g^2+gn\log g}{\epsilon}}))$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubits and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is the number of gates.&lt;/p&gt;&#xA;" OwnerUserId="9305" LastEditorUserId="9305" LastEditDate="2020-09-11T21:09:25.323" LastActivityDate="2020-09-11T21:09:25.323" Title="Can hash functions speed up quantum simulation? (Generalizing May and Schlieper's idea)" Tags="&lt;classical-computing&gt;&lt;speedup&gt;" AnswerCount="0" CommentCount="12" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13509" PostTypeId="1" CreationDate="2020-08-30T18:27:20.717" Score="1" ViewCount="31" Body="&lt;p&gt;I assume &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E} \in \mathcal{L}(\mathcal{L}(H))$&lt;/span&gt; is a CPTP map. I call &lt;span class=&quot;math-container&quot;&gt;$\{B_i\}$&lt;/span&gt; an orthonormal basis for Hilbert-Schmidt scalar product of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(H)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This quantum map can be decomposed as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho)=\sum_{ij} \chi_{ij} B_i \rho B_j^{\dagger}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrix having for element &lt;span class=&quot;math-container&quot;&gt;$\chi_{ij}$&lt;/span&gt; is called the chi-matrix of the process.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question are:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 ?&lt;/p&gt;&#xA;&lt;p&gt;Same question in the particular case the chi-matrix is actually diagonal, is there a general interpretation of the &lt;span class=&quot;math-container&quot;&gt;$\chi_{ii}$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-11-25T09:47:16.447" LastActivityDate="2020-11-25T09:47:16.447" Title="Is there a physical interpretation for the diagonal terms of a $\chi$ matrix?" Tags="&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13511" PostTypeId="1" CreationDate="2020-08-30T21:15:26.180" Score="2" ViewCount="482" Body="&lt;p&gt;For example, if I had a gate &lt;code&gt;rz(0)&lt;/code&gt;, it holds no value in a circuit. It comes out to a matrix of &lt;code&gt;[[1,0], [0,1]]&lt;/code&gt;, which seems to be of no value, but I am wondering if there is any purpose of such gate in a circuit.&lt;/p&gt;&#xA;" OwnerUserId="12790" LastEditorUserId="9006" LastEditDate="2020-08-31T06:26:48.017" LastActivityDate="2020-08-31T06:34:40.767" Title="Is a 0 degree rotation around an axis meaningless?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13512" PostTypeId="2" ParentId="13511" CreationDate="2020-08-30T21:27:34.093" Score="3" Body="&lt;p&gt;Operations like that can be removed without changing the function of the circuit.&lt;/p&gt;&#xA;&lt;p&gt;They may be in the circuit to achieve some alternative purpose in context, for example to reserve a particular location for a particular purpose.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-08-30T21:27:34.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13513" PostTypeId="1" AcceptedAnswerId="13575" CreationDate="2020-08-31T02:44:00.553" Score="7" ViewCount="99" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13092" LastEditorUserId="55" LastEditDate="2020-08-31T21:15:38.383" LastActivityDate="2021-04-05T11:46:37.903" Title="What are some current applications of Quantum Computing in drug discovery? Are there any test examples of this?" Tags="&lt;qiskit&gt;&lt;applications&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13514" PostTypeId="1" CreationDate="2020-08-31T03:13:42.027" Score="2" ViewCount="31" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kCJts.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kCJts.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In Google's quantum supremacy experiment, supplementary Section VIIIH, they calculate the correlation coefficient of the linear fit coefficients &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;. I can't figure out the definition of this quantity. Is this the same as the Pearson correlation coefficient?&lt;/p&gt;&#xA;" OwnerUserId="11562" LastEditorUserId="55" LastEditDate="2020-08-31T21:16:30.533" LastActivityDate="2020-08-31T21:16:30.533" Title="When we do a linear fit, what is the correlation coefficient of the estimated parameters?" Tags="&lt;mathematics&gt;&lt;quantum-advantage&gt;&lt;google-sycamore&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13515" PostTypeId="1" AcceptedAnswerId="13521" CreationDate="2020-08-31T03:19:02.543" Score="2" ViewCount="138" Body="&lt;p&gt;Inspired by &lt;a href=&quot;https://medium.com/@edwinagnew1/quantum-teleportation-from-scratch-to-magic-part-3-a-new-theory-of-time-feb8684d952b&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; which uses a &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state as a control for a &lt;span class=&quot;math-container&quot;&gt;$CSWAP$&lt;/span&gt;, I realised you can conditionally measure a qubit by (maybe) swapping it with an empty ancilla, measuring it and (maybe) swapping it back.&lt;/p&gt;&#xA;&lt;p&gt;As such, you could prepare a Bell pair, (maybe) measure half of it and then check if the other half was affected as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ow32z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ow32z.png&quot; alt=&quot;qiskit circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If measurement changes the top qubit then the second &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate should put it back into the |+&amp;gt; state and we should measure random results. If the measurement doesn't change the top qubit, then it should turn the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, deterministically measuring 0. Right?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 (&amp;quot;Qubit measurement not the final instruction. [7006]&amp;quot;).&#xA;So can anyone think of a way I could test it?&#xA;Does this count as a Bell Test?&#xA;Has this been tried before?&#xA;Am I missing something obvious?&lt;/p&gt;&#xA;&lt;p&gt;Not sure if this is the right place to post this but just interested to hear people's thoughts/predictions.&lt;/p&gt;&#xA;" OwnerUserId="13093" LastEditorUserId="55" LastEditDate="2020-09-10T11:48:20.523" LastActivityDate="2020-09-10T11:48:20.523" Title="Is this a Bell test?" Tags="&lt;qiskit&gt;&lt;entanglement&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13516" PostTypeId="2" ParentId="13511" CreationDate="2020-08-31T06:34:40.767" Score="1" Body="&lt;p&gt;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 &lt;code&gt;rz(0)&lt;/code&gt;. As pointed by &lt;em&gt;Craig Gidney&lt;/em&gt; and you, such gate is in fact identity operator and it can be removed from the circuit without affecting its function.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and measure a probability that the qubit stays in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-08-31T06:34:40.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13517" PostTypeId="1" AcceptedAnswerId="13518" CreationDate="2020-08-31T08:59:17.410" Score="1" ViewCount="87" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P_1 = \lbrace I, -I, iI, -iI, X, -X, iX, -iX, Y, -Y, iY, -iY, Z, -Z, iZ, -iZ\rbrace$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$P_n$&lt;/span&gt; be the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-tensor fold of &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt;. It is said that two operators &lt;em&gt;either&lt;/em&gt; commute if &lt;span class=&quot;math-container&quot;&gt;$AB = BA$&lt;/span&gt; or anti-commute if &lt;span class=&quot;math-container&quot;&gt;$AB = -BA$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$A,B \in P_n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let us have &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A=I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B=Y$&lt;/span&gt;, then we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;    IY &amp;amp;\stackrel{\text{true}}{=} YI,\\&#xA;    IY &amp;amp;\stackrel{\text{true}}{=} -YI.&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; both commute and anti-commute. I have also added a matlab code snippet for completeness.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;I = [1 0; 0 1];&#xA;Y = [0 -i;i  0];&#xA;if isequal(I*Y,Y*I)&#xA;   disp('commute') &#xA;end&#xA;if isequal(I*Y,-Y*I)&#xA;   disp('ANTI-commute') &#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I am referring to &lt;a href=&quot;https://thesis.library.caltech.edu/2900/2/THESIS.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Daniel Gottesman's PhD thesis&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="7528" LastEditorUserId="7528" LastEditDate="2020-09-01T10:25:22.437" LastActivityDate="2020-09-01T10:25:22.437" Title="The commutativity of $I$ and $Y$ in a stabilizer code" Tags="&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13518" PostTypeId="2" ParentId="13517" CreationDate="2020-08-31T09:27:40.770" Score="3" Body="&lt;p&gt;It should be &lt;span class=&quot;math-container&quot;&gt;$IY \ne - YI$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$IY = - YI$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$IY \ne - YI \\&#xA;\begin{pmatrix}&#xA;1&amp;amp;0\\&#xA;0&amp;amp; 1&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;0&amp;amp;-i\\&#xA;i&amp;amp; 0&#xA;\end{pmatrix} &#xA;\ne&#xA;-\begin{pmatrix}&#xA;0&amp;amp;-i\\&#xA;i&amp;amp; 0&#xA;\end{pmatrix} &#xA;\begin{pmatrix}&#xA;1&amp;amp;0\\&#xA;0&amp;amp; 1&#xA;\end{pmatrix}&#xA;\\&#xA;Y = &#xA;\begin{pmatrix}&#xA;0&amp;amp;-i\\&#xA;i&amp;amp; 0&#xA;\end{pmatrix} \ne&#xA;-\begin{pmatrix}&#xA;0&amp;amp;-i\\&#xA;i&amp;amp; 0&#xA;\end{pmatrix} &#xA;= -Y&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; don't anti-commute. Moreover &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; anti-commutes only with the matrix with all &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; entries. Also, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; commutes with all matrices, because from definition &lt;span class=&quot;math-container&quot;&gt;$IM = M = MI$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a random matrix.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;On the contrary all pairs from &lt;span class=&quot;math-container&quot;&gt;$\{X, Y, Z \}$&lt;/span&gt; anti-commute with each other. As an example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\{X Z \} = XZ + ZX = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$XZ = -ZX$&lt;/span&gt;. Also, we have thess relations: &lt;span class=&quot;math-container&quot;&gt;$XY = -YX$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$YZ = -ZY$&lt;/span&gt; from which we can conclude &lt;span class=&quot;math-container&quot;&gt;$\{XY\} = \{ZY\} = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-01T10:15:21.740" LastActivityDate="2020-09-01T10:15:21.740" CommentCount="28" ContentLicense="CC BY-SA 4.0" />
  <row Id="13519" PostTypeId="2" ParentId="13500" CreationDate="2020-08-31T09:31:37.397" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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}&#xA;$&lt;/span&gt;Define &lt;span class=&quot;math-container&quot;&gt;$A\equiv \ketbra\phi\phi - \ketbra\psi\psi$&lt;/span&gt;. Being &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; hermitian, &lt;span class=&quot;math-container&quot;&gt;$\on{Tr}(\sqrt{A^2})$&lt;/span&gt; equals the sum of its singular values. Being &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; spanned by only two vectors, its singular vectors must be of the form &lt;span class=&quot;math-container&quot;&gt;$\alpha\ket\phi+\beta\ket\psi$&lt;/span&gt;. We then see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A(\alpha\ket\phi+\beta\ket\psi)=&#xA;  (\alpha +\beta \braket{\phi}{\psi})\ket\phi -&#xA;  (\alpha \braket{\psi}{\phi} +\beta)\ket\psi,&#xA;$$&lt;/span&gt;&#xA;and the expectation value thus reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \langle A\rangle\equiv (\alpha^*\bra\phi + \beta^* \bra\psi)A(\alpha\ket\phi+\beta\ket\psi) =&#xA;  (|\alpha|^2 - |\beta|^2) (1 - |\braket\phi\psi|^2).\tag1&#xA;$$&lt;/span&gt;&#xA;Now remember that the largest singular value is the largest value of &lt;span class=&quot;math-container&quot;&gt;$|\langle \Psi|A|\Psi\rangle|$&lt;/span&gt; over all unit vectors &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt;. From (1), we easily see that this equals &lt;span class=&quot;math-container&quot;&gt;$1-|\braket\phi\psi|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From &lt;span class=&quot;math-container&quot;&gt;$\on{Tr}(A)=0$&lt;/span&gt; we know that the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\pm\sqrt{-\det(A)}$&lt;/span&gt;, and thus its singular values are equal.&#xA;We conclude that &lt;span class=&quot;math-container&quot;&gt;$\on{Tr}(\sqrt{A^2})=2(1-|\braket\phi\psi|^2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Of course, the more standard argument passing through the matrix representation of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in a basis &lt;span class=&quot;math-container&quot;&gt;$\{\ket\phi,\ket{\phi_\perp}\}$&lt;/span&gt; works equally well.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-08-31T09:31:37.397" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13521" PostTypeId="2" ParentId="13515" CreationDate="2020-08-31T12:23:36.770" Score="1" Body="&lt;p&gt;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) &lt;a href=&quot;https://arxiv.org/abs/1712.05642&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To run the circuit in the OP, just move the second &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gate on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; in front of the measurement on &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;.  This will have no impact on your outcomes distribution (i.e. these two operations commute).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-08-31T13:36:20.670" LastActivityDate="2020-08-31T13:36:20.670" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13522" PostTypeId="1" CreationDate="2020-08-31T13:56:29.350" Score="2" ViewCount="211" Body="&lt;p&gt;I’m trying to simulate LiH using VQE. But I keep getting the error&#xA;QiskitChemistryError:PySCF is not installed&#xA;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.&#xA;(Running with the updated qiskit version 0.20.0 on Windows10)&lt;/p&gt;&#xA;" OwnerUserId="10039" LastEditorUserId="55" LastEditDate="2020-08-31T21:20:27.590" LastActivityDate="2020-08-31T21:20:27.590" Title="How to fix “QiskitChemistryError:PySCF is not installed”" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13523" PostTypeId="2" ParentId="13522" CreationDate="2020-08-31T14:14:02.120" Score="1" Body="&lt;p&gt;Typically you would need to install it through &lt;code&gt;pip install pyscf&lt;/code&gt;, however I believe &lt;code&gt;pyscf&lt;/code&gt; does not support Windows. If you look on their &lt;a href=&quot;https://sunqm.github.io/pyscf/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;installation guide&lt;/a&gt; they give some instructions for installing the library, but on Windows you probably need to either use the &lt;a href=&quot;https://docs.microsoft.com/en-us/windows/wsl/install-win10&quot; rel=&quot;nofollow noreferrer&quot;&gt;ubuntu subsytem for Windows&lt;/a&gt; or set up a VM.&lt;/p&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-08-31T14:14:02.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13524" PostTypeId="1" CreationDate="2020-08-31T15:20:41.293" Score="2" ViewCount="110" Body="&lt;p&gt;I'm trying to implement a circuit for Quantum Amplitude Estimation in Qiskit using elementary gates.&lt;/p&gt;&#xA;&lt;p&gt;I have created the circuit that represent my algorithm  &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; but now from the theory I know that I have to create the &lt;strong&gt;Q-operator&lt;/strong&gt; defined as: &lt;span class=&quot;math-container&quot;&gt;$Q = A S_0 A^{-1} S_{\psi_{0}}$&lt;/span&gt; , where &lt;span class=&quot;math-container&quot;&gt;$S_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_{\psi_{0}}$&lt;/span&gt; are two reflections.&lt;/p&gt;&#xA;&lt;p&gt;How can I implement these two reflections in the circuit using Qiskit gates?&lt;/p&gt;&#xA;&lt;p&gt;&lt;br /&gt;&#xA;&lt;strong&gt;UPDATE&lt;/strong&gt;&#xA;&lt;br /&gt;&#xA;I built a quantum circuit for reproducing an algorithm &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for computing expected value of a random variable, given by:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Load a random variable &lt;em&gt;X&lt;/em&gt; as a quantum state&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;L|0\rangle_n = |\psi\rangle_n = \sum_{i=0}^{2^n - 1}\sqrt{p_i} |i\rangle_n &#xA;\ \ \ such \ that \ \sum_{i=0}^{2^n - 1}p_i = 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Create an operator for the encoding&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F|i\rangle_n |0\rangle = \sqrt{1 - f(i)} |i\rangle_n |0\rangle + \sqrt{f(i)} |i\rangle_n |1\rangle &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So my algorithm &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is given by the final state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&#xA;&lt;br /&gt;&#xA;I used 3 qubits for loading distribution and one ancilla qubit; so my Qiskit circuit is the following&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WbLOp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WbLOp.png&quot; alt=&quot;Qiskit circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;From this I would create &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; operator for Amplitude Estimation.&#xA;How can I procede?&lt;/p&gt;&#xA;" OwnerUserId="12747" LastEditorUserId="12747" LastEditDate="2020-09-29T13:58:15.397" LastActivityDate="2020-09-29T13:58:15.397" Title="How to define Q-operator in Quantum Amplitude Estimation" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13525" PostTypeId="2" ParentId="13522" CreationDate="2020-08-31T15:22:35.327" Score="0" Body="&lt;p&gt;I was able to run PySCF on Windows by first downloading &lt;a href=&quot;https://visualstudio.microsoft.com/downloads/?utm_medium=microsoft&amp;amp;utm_source=docs.microsoft.com&amp;amp;utm_campaign=button%20cta&amp;amp;utm_content=download%20vs2019%20rc&quot; rel=&quot;nofollow noreferrer&quot;&gt;Visual studio installer&lt;/a&gt;. After installing it, you have to install desktop development with C++ in there and it'll solve your issue most probably.&lt;/p&gt;&#xA;" OwnerUserId="12897" LastActivityDate="2020-08-31T15:22:35.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13527" PostTypeId="1" AcceptedAnswerId="13542" CreationDate="2020-08-31T16:52:51.623" Score="1" ViewCount="74" Body="&lt;p&gt;How do quantum gates work on qubits in the physical world?&lt;/p&gt;&#xA;&lt;p&gt;What are different ways through which qubits can be manipulated in the physical world?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Accordingly, how would one implement an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate acting on a qubit?&lt;/p&gt;&#xA;" OwnerUserId="9660" LastEditorUserId="55" LastEditDate="2020-09-01T22:29:36.787" LastActivityDate="2020-09-01T22:29:36.787" Title="How do quantum gates work on qubits in the physical world?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13528" PostTypeId="1" CreationDate="2020-08-31T17:09:03.890" Score="4" ViewCount="215" Body="&lt;p&gt;I was going through the qiskit textbook and in &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/phase-kickback.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this chapter&lt;/a&gt; I came across a statement under the topic &amp;quot;Kickback with the T-gate&amp;quot; related to the Controlled-Z gate that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What does it imply exactly?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t1xfd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t1xfd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13105" LastEditorUserId="10480" LastEditDate="2021-02-08T17:09:44.263" LastActivityDate="2021-02-08T18:12:42.363" Title="controlled-Z rotation gates in symmetrical fashion" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;pauli-gates&gt;&lt;universal-gates&gt;&lt;phase-kickback&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13529" PostTypeId="1" AcceptedAnswerId="13533" CreationDate="2020-08-31T23:32:01.567" Score="3" ViewCount="531" Body="&lt;p&gt;I am trying to produce any arbitrary superposition state of two qubits, for example &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$a^2 + b^2 + c^2 + d^2 = 1$&lt;/span&gt; . How can I do that with Qiskit?&lt;/p&gt;&#xA;&lt;p&gt;One way that I have found out is to use &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta, 0, 0)$&lt;/span&gt; gates for suitable values of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; on both of the qubits. Is there another way?&lt;/p&gt;&#xA;" OwnerUserId="12785" LastEditorUserId="55" LastEditDate="2020-09-01T22:29:01.130" LastActivityDate="2020-09-01T22:29:01.130" Title="How can I create an arbitrary superposition state of two qubits in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13530" PostTypeId="1" CreationDate="2020-09-01T00:04:11.060" Score="3" ViewCount="116" Body="&lt;p&gt;What is the best way to handle parametric circuits in Qiskit? When I create a variational form like &lt;code&gt;TwoLocal&lt;/code&gt; and then do &lt;code&gt;var_form.parameters&lt;/code&gt; it returns a set but that is an unordered structure so I fear that it will give me different results upon different calls.&lt;/p&gt;&#xA;&lt;p&gt;Here is what I have:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var_form = TwoLocal(num_qubits=4,&#xA;                       rotation_blocks=[&amp;quot;ry&amp;quot;,&amp;quot;rx&amp;quot;],&#xA;                       entanglement_blocks=[&amp;quot;cx&amp;quot;],&#xA;                       entanglement=&amp;quot;full&amp;quot;,&#xA;                       reps=1,&#xA;                       skip_final_rotation_layer=False,&#xA;                       insert_barriers=True)&#xA;&#xA;parameters=np.random.random(var_form.num_parameters)&#xA;param_dict={}&#xA;for i in range(var_form.num_parameters):&#xA;    param_dict[list(var_form.parameters)[i]]=parameters[i]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is what I want:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def get_var_form(parameters):&#xA;    &amp;quot;&amp;quot;&amp;quot;parameters is a list like [0,1,2,3,4....]&amp;quot;&amp;quot;&amp;quot;&#xA;    &#xA;    ## &#xA;    # DO MAGIC HERE &#xA;    var_form = TwoLocal(num_qubits=4,&#xA;                       rotation_blocks=[&amp;quot;ry&amp;quot;,&amp;quot;rx&amp;quot;],&#xA;                       entanglement_blocks=[&amp;quot;cx&amp;quot;],&#xA;                       entanglement=&amp;quot;full&amp;quot;,&#xA;                       reps=1,&#xA;                       skip_final_rotation_layer=False,&#xA;                       insert_barriers=True)&#xA;    &#xA;    #I want to insert parameters-----&amp;gt;var_form&#xA;    ##&#xA;    &#xA;    return var_form #with given parameters&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-09-01T22:28:53.107" LastActivityDate="2021-01-29T23:07:20.783" Title="What is the best way to handle parametric circuits in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13531" PostTypeId="1" AcceptedAnswerId="13556" CreationDate="2020-09-01T00:45:58.217" Score="7" ViewCount="343" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13092" LastEditorUserId="55" LastEditDate="2021-03-11T10:09:39.877" LastActivityDate="2021-03-11T10:09:39.877" Title="What is the advantage of quantum machine learning over traditional machine learning?" Tags="&lt;machine-learning&gt;&lt;quantum-advantage&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13532" PostTypeId="1" AcceptedAnswerId="13536" CreationDate="2020-09-01T01:04:42.567" Score="1" ViewCount="75" Body="&lt;p&gt;I've seen a similar question asked (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11677/how-do-i-compute-the-square-root-of-the-y-gate&quot;&gt;How do I compute the square root of the $Y$ gate?&lt;/a&gt;) but I'm trying to understand how I can use the gates &lt;span class=&quot;math-container&quot;&gt;$Y^{\frac{1}{2}}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y^{\frac{1}{4}}$&lt;/span&gt; in Qiskit in terms of other building blocks, if it is possible.&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to use the gate &lt;span class=&quot;math-container&quot;&gt;$Y^{\frac{1}{2}} = \begin{bmatrix}&#xA;\frac{1}{2}&#xA; + \frac{1}{2}i &amp;amp; -\frac{1}{2} - \frac{1}{2}i\\&#xA;\frac{1}{2} + \frac{1}{2}i &amp;amp; \frac{1}{2} + \frac{1}{2}i&#xA;\end{bmatrix}$&lt;/span&gt; in Qiskit? I can say that &lt;span class=&quot;math-container&quot;&gt;$Y = iRY(\pi)$&lt;/span&gt; and compute the square root manually, but how can I describe such an operation, if possible, in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="12088" LastActivityDate="2020-09-01T04:36:46.627" Title="Principal square root of Pauli Y gate in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;gate-synthesis&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13533" PostTypeId="2" ParentId="13529" CreationDate="2020-09-01T03:21:31.270" Score="5" Body="&lt;p&gt;&lt;code&gt;qiskit.quantum_info&lt;/code&gt; has a useful &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.random_statevector.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;random_statevector&lt;/a&gt; function that you can use to generate a random statevector that's sampled from the uniform measure.&#xA;For a 2-qubit state, you would call it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import random_statevector&#xA;state = random_statevector(4) # note: the parameter you pass is the number of entries in the vector, not the number of qubits&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once you have this statevector, the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.initialize.html#qiskit.circuit.QuantumCircuit.initialize&quot; rel=&quot;nofollow noreferrer&quot;&gt;initialize&lt;/a&gt; function lets you initialize your qubits to the state you just created. The documentation for &lt;code&gt;initialize&lt;/code&gt; is not very helpful so here's how you would use it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;qc = QuantumCircuit(2)&#xA;qc.initialize(state.data, [0,1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that you will have to use &lt;code&gt;state.data&lt;/code&gt; to get the underlying array representing the statevector, because &lt;code&gt;initialize&lt;/code&gt; doesn't accept an argument of type &lt;code&gt;StateVector&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8955" LastEditorUserId="8955" LastEditDate="2020-09-01T05:28:40.400" LastActivityDate="2020-09-01T05:28:40.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13534" PostTypeId="1" AcceptedAnswerId="13541" CreationDate="2020-09-01T03:23:45.780" Score="2" ViewCount="119" Body="&lt;p&gt;Consider two quantum states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and the probability distributions induced by measuring both of them in the standard basis. Let’s call the probability distributions &lt;span class=&quot;math-container&quot;&gt;$p_{\rho}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{\sigma}$&lt;/span&gt; respectively. What is the relation between the trace distance between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and the total variation distance between &lt;span class=&quot;math-container&quot;&gt;$p_{\rho}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{\sigma}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-09-01T22:15:48.300" LastActivityDate="2020-09-03T07:54:58.117" Title="Relationship between trace distance and total variation distance" Tags="&lt;quantum-state&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13535" PostTypeId="1" AcceptedAnswerId="13537" CreationDate="2020-09-01T03:37:27.967" Score="1" ViewCount="354" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there a way I can add certain gates to the beginning of a Qiskit Circuit as opposed to creating new ones each time?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastEditorUserId="9006" LastEditDate="2020-09-01T07:00:02.210" LastActivityDate="2020-10-01T08:01:20.097" Title="Can I append gates in a certain position in a Qiskit circuit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13536" PostTypeId="2" ParentId="13532" CreationDate="2020-09-01T04:36:46.627" Score="0" Body="&lt;p&gt;For some reason this took a while to find, but has a simple solution:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ.append(YGate().power(1/2), [qbit])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where &lt;code&gt;circ&lt;/code&gt; is the &lt;code&gt;QuantumCircuit&lt;/code&gt; object and &lt;code&gt;qbit&lt;/code&gt; is the register to apply the gate on.&lt;/p&gt;&#xA;" OwnerUserId="12088" LastActivityDate="2020-09-01T04:36:46.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13537" PostTypeId="2" ParentId="13535" CreationDate="2020-09-01T06:59:16.210" Score="1" Body="&lt;p&gt;Have a look at &lt;a href=&quot;https://arxiv.org/abs/1903.04359&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Coding Quantum Algorithms: A Tutorial Series Using Qiskit&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The manual I refer to is very easy to understand. Each manipulation is documented with examples.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Concerning combining of the circuit, you can use this statement:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;newCircuit = oldCircuit1 + oldCircuit2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;newCircuit = oldCircuit2 + oldCircuit1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So, you can easily add one circuit to the end or the begin of another circuit.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-01T06:59:16.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13538" PostTypeId="2" ParentId="13506" CreationDate="2020-09-01T07:10:58.930" Score="1" Body="&lt;p&gt;Elaborating more on the previous answer, here is a proof that it's indeed not possible.&lt;/p&gt;&#xA;&lt;p&gt;Let us assume that there is a unitary &lt;span class=&quot;math-container&quot;&gt;$ U $&lt;/span&gt; acting on qubit &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and on &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; ancillary qubits such that &lt;span class=&quot;math-container&quot;&gt;$U\Big(|s \rangle \otimes |0 \rangle^m_{anc}\Big)$&lt;/span&gt; is the desired output. Then on inputs &lt;span class=&quot;math-container&quot;&gt;$|+ \rangle, |- \rangle$&lt;/span&gt; the outputs are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U\Big(|+ \rangle \otimes |0 \rangle^m_{anc}\Big) = |+ \rangle \otimes |\phi_+ \rangle_{anc} $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$U\Big(|- \rangle \otimes |0 \rangle^m_{anc}\Big) = |- \rangle \otimes |\phi_- \rangle_{anc} $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So we may write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = |+ \rangle \langle +| \otimes W_+ + |- \rangle \langle -| \otimes W_-$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$W_{\pm} |0 \rangle^m = |\phi_{\pm} \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On input &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; we have the output state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\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)$$&lt;/span&gt;&#xA;and since we want the qubit to be in &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; state, it must hold that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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$$&lt;/span&gt;&#xA;But&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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}$$&lt;/span&gt;&#xA;so finally &lt;span class=&quot;math-container&quot;&gt;$U\Big(|s \rangle \otimes |0 \rangle^m_{anc}\Big) = |s \rangle \otimes |\phi \rangle_{anc}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; does not flip &lt;span class=&quot;math-container&quot;&gt;$a_0, a_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|s \rangle$&lt;/span&gt;, then&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply amplitude amplification on the first copy to amplify the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Apply an X gate on the second copy and then a Controlled-X (control is the first copy). Now the state is &lt;span class=&quot;math-container&quot;&gt;$ c_0 |0 \rangle X|s \rangle + c_1 |1 \rangle |s \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Measure the first qubit. If it's zero, then the state of the second qubit is in the correct state (&lt;span class=&quot;math-container&quot;&gt;$X|s \rangle$&lt;/span&gt;). If it's one, then there is some error probability but this will be small since from step 1, &lt;span class=&quot;math-container&quot;&gt;$|c_0|^2$&lt;/span&gt; will be big if &lt;span class=&quot;math-container&quot;&gt;$a_0 \neq 0 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-01T07:10:58.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13539" PostTypeId="2" ParentId="13529" CreationDate="2020-09-01T11:10:24.937" Score="3" Body="&lt;p&gt;Putting my answer here just for completeness.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;I made code a bit verbose for clarity.&lt;/p&gt;&#xA;&lt;p&gt;Code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;from qiskit.quantum_info.states.random import random_statevector&#xA;from qiskit.extensions import Initialize&#xA;from qiskit.visualization import plot_bloch_multivector&#xA;&#xA;state_backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;def initrstate(qc, label=&amp;quot;&amp;quot;):&#xA;   state = random_statevector((2,1)).data&#xA;   print(state) # if you want to see what state you have initialized the qubit to&#xA;   init = Initialize(state)&#xA;   init.label = label&#xA;   return init&#xA;&#xA;def viewstate(qc):&#xA;   result = execute(qc, state_backend).result()&#xA;   fstate = result.get_statevector()&#xA;   print(fstate) # This will be the superposition state&#xA;   return fstate&#xA;&#xA;qc = QuantumCircuit(2)&#xA;init1 = initrstate(qc)&#xA;init2 = initrstate(qc)&#xA;qc.append(init1, [0])&#xA;qc.append(init2, [1])&#xA;&#xA;plot_bloch_multivector(viewstate(qc)) #Plot the state vectors on the bloch sphere&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13102" LastEditorUserId="13102" LastEditDate="2020-09-01T11:16:38.710" LastActivityDate="2020-09-01T11:16:38.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13540" PostTypeId="2" ParentId="13530" CreationDate="2020-09-01T12:30:42.033" Score="1" Body="&lt;p&gt;This is what I came up with:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;param_dict={}&#xA;for i in range(var_form.num_parameters):&#xA;    param_dict[list(var_form.ordered_parameters)[i]]=parameters[i]&#xA;&#xA;ansatz=var_form.bind_parameters(param_dict)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;maybe its not the best way, but it works...&lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-09-01T12:30:42.033" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13541" PostTypeId="2" ParentId="13534" CreationDate="2020-09-01T13:07:58.077" Score="3" Body="&lt;h2&gt;A bound on the total variation distance&lt;/h2&gt;&#xA;&lt;p&gt;Rammus already provided a short answer, but I'd like to elaborate a bit on &lt;em&gt;why&lt;/em&gt; this is the case. This is basically the proof of theorem &lt;span class=&quot;math-container&quot;&gt;$9.1$&lt;/span&gt; on page &lt;span class=&quot;math-container&quot;&gt;$405$&lt;/span&gt; of Nielsen &amp;amp; Chuang. Note that they call the total variation distance the &lt;em&gt;(classical) trace distance&lt;/em&gt;, to draw the connection to the quantum trace distance.&lt;/p&gt;&#xA;&lt;p&gt;For any two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, let the trace distance be &lt;span class=&quot;math-container&quot;&gt;$D(\rho, \sigma) = \frac{1}{2}\mathrm{tr}|\rho -  \sigma|$&lt;/span&gt; (eq. &lt;span class=&quot;math-container&quot;&gt;$9.11$&lt;/span&gt;, page &lt;span class=&quot;math-container&quot;&gt;$403$&lt;/span&gt;). Furthermore, let &lt;span class=&quot;math-container&quot;&gt;$\{E_{m}\}$&lt;/span&gt; be any POVM such that &lt;span class=&quot;math-container&quot;&gt;$p_{m} = \mathrm{tr}(\rho E_{m})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_{m} = \mathrm{tr}(\sigma E_{m})$&lt;/span&gt;, where I've slightly changed your notation to ease the analysis. Note that in your case &lt;span class=&quot;math-container&quot;&gt;$\{E_{m}\}$&lt;/span&gt; is just the collection of projectors on the standard basis.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$|\rho -  \sigma|$&lt;/span&gt; means &lt;span class=&quot;math-container&quot;&gt;$\sqrt{(\rho - \sigma)^{\dagger}(\rho - \sigma)}$&lt;/span&gt; and is &lt;em&gt;not&lt;/em&gt; a number; if we take the trace of this operator it of course becomes a number.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;classical&lt;/em&gt; trace distance between &lt;span class=&quot;math-container&quot;&gt;$\{p_{m}\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{q_{m}\}$&lt;/span&gt; is (eq. &lt;span class=&quot;math-container&quot;&gt;$9.1$&lt;/span&gt;, page &lt;span class=&quot;math-container&quot;&gt;$400$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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))|.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The most straightforward answer to your question&lt;/strong&gt;: Theorem &lt;span class=&quot;math-container&quot;&gt;$9.1$&lt;/span&gt; can be rephrased to say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;D(p_{m},q_{m}) \leq D(\rho, \sigma)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Why 'exactly'?&lt;/h2&gt;&#xA;&lt;p&gt;The classical trace distance looks a bit like the quantum trace distance, but not completely. The important detail to note is that for any &lt;span class=&quot;math-container&quot;&gt;$E_{m}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\mathrm{tr}(E_{m}(\rho - \sigma))| \leq \mathrm{tr}(E_{m}|\rho - \sigma|).&#xA;\end{equation}&lt;/span&gt;&#xA;This holds, because (and I again quote Nielsen &amp;amp; Chuang, eq. &lt;span class=&quot;math-container&quot;&gt;$9.25-9.27$&lt;/span&gt; (page &lt;span class=&quot;math-container&quot;&gt;$405$&lt;/span&gt;)), we can always write &lt;span class=&quot;math-container&quot;&gt;$\rho - \sigma = Q - S$&lt;/span&gt; for some &lt;em&gt;positive&lt;/em&gt; operators &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; &lt;strong&gt;with orthogonal support&lt;/strong&gt;, meaning that &lt;span class=&quot;math-container&quot;&gt;$|\rho - \sigma| = Q + S$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Proof of the above statements&lt;/h2&gt;&#xA;&lt;p&gt;We know that both &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are positive and Hermitian; this means that &lt;span class=&quot;math-container&quot;&gt;$A = \rho - \sigma$&lt;/span&gt; is also Hermitian, now with both positive and negative (but real!) eigenvalues. That is, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has eigenvalue-eigenvector pairs &lt;span class=&quot;math-container&quot;&gt;$(\lambda_{i},|\psi_{i}\rangle)$&lt;/span&gt;, with some &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i} \geq 0$&lt;/span&gt; and the others less than zero. Also, &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_{i}| \psi_{i'}\rangle = \delta_{ii'}$&lt;/span&gt;. Splitting the spectrum of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; into the positive part &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_{+}\}$&lt;/span&gt; and negative part &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_{-}\}$&lt;/span&gt;, we can write for &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;A = \sum_{i}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | &amp;amp;= \sum_{i\in +}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | + \sum_{i \in -}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | \\&#xA;&amp;amp;= \sum_{i\in +}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | - \sum_{i \in -} |\lambda_{i}| |\psi_{i}\rangle \langle \psi_{i} | \\&#xA;&amp;amp;= Q - S,&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where both &lt;span class=&quot;math-container&quot;&gt;$Q = \sum_{i\in +}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} |$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S = \sum_{i \in -}|\lambda_{i}| |\psi_{i}\rangle \langle \psi_{i} |$&lt;/span&gt; are positive operators, with completely orthogonal support. It is now easy to verify that &lt;span class=&quot;math-container&quot;&gt;$|\rho - \sigma| = Q + S$&lt;/span&gt;. Moreover, by construction we have &lt;span class=&quot;math-container&quot;&gt;$\rho - \sigma = Q - S$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can now write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;|\mathrm{tr}(E_{m}(\rho - \sigma))|  &amp;amp;= |\mathrm{tr}(E_{m}(Q - S))|\\&#xA;&amp;amp;= |\mathrm{tr}(E_{m}Q) - \mathrm{tr}(E_{m}S)| \\&#xA;&amp;amp; \leq \mathrm{tr}(E_{m}Q) + \mathrm{tr}(E_{m}S) = \mathrm{tr}(E_{m}(Q+S)) \\&#xA;&amp;amp;= \mathrm{tr}(E_{m}|\rho - \sigma|)),&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which proves our equation above.&lt;/p&gt;&#xA;&lt;h2&gt;Back to the problem at hand&lt;/h2&gt;&#xA;&lt;p&gt;In the end, we can now combine the two equations:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;D(p_{m},q_{m}) &amp;amp;= \frac{1}{2} \sum_{m}|p_{m} - q_{m}| = \frac{1}{2} \sum_{m}|\mathrm{tr}(E_{m}(\rho - \sigma))| \\&#xA;&amp;amp; \leq \frac{1}{2} \sum_{m}\mathrm{tr}(E_{m}|\rho - \sigma|) = \frac{1}{2} \mathrm{tr}|\rho - \sigma| = D(\rho, \sigma).&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;where the last identity holds because &lt;span class=&quot;math-container&quot;&gt;$\{E_{m}\}$&lt;/span&gt; is a POVM and thus &lt;span class=&quot;math-container&quot;&gt;$\sum_{m} E_{m} = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Of course there is a particular POVM &lt;span class=&quot;math-container&quot;&gt;$\{E_{m}\}$&lt;/span&gt; for which the bound is saturated, but it is highly dependent on both &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;; it is very unlikely that this is exactly the standard basis.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-09-03T07:54:58.117" LastActivityDate="2020-09-03T07:54:58.117" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13542" PostTypeId="2" ParentId="13527" CreationDate="2020-09-01T13:52:28.177" Score="3" Body="&lt;p&gt;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 &lt;a href=&quot;https://www.youtube.com/playlist?list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&quot; rel=&quot;nofollow noreferrer&quot;&gt;youtube series by QuTech&lt;/a&gt; that gives a general overview of the current state of the art. I'd also reccommend taking a look at &lt;a href=&quot;https://www.youtube.com/watch?v=_1XTChcvbOs&amp;amp;t=2982s&quot; rel=&quot;nofollow noreferrer&quot;&gt;this circuit session by Nathan Earnest-Noble&lt;/a&gt; that gives a brief overview of the transmon qubits and an intro to Qiskit OpenPulse.&lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-09-01T13:52:28.177" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13543" PostTypeId="1" AcceptedAnswerId="13659" CreationDate="2020-09-01T13:53:33.640" Score="5" ViewCount="242" Body="&lt;p&gt;The book &lt;a href=&quot;https://www.cambridge.org/core/books/quantum-computation-and-quantum-information/01E10196D0A682A6AEFFEA52D53BE9AE&quot; rel=&quot;noreferrer&quot;&gt;Quantum Computing and Quantum Information&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Its own preface (at least in the &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;th anniversary edition) addresses this as well, and links to the website &lt;code&gt;http://www.squint.org/qci/&lt;/code&gt; for a list of errata and requests any newly found errors to be send to &lt;code&gt;qci@squint.org&lt;/code&gt;. Neither links are still functional, let alone maintained.&lt;/p&gt;&#xA;&lt;p&gt;There is also the &lt;a href=&quot;http://www.michaelnielsen.org/qcqi/errata/errata/errata.html&quot; rel=&quot;noreferrer&quot;&gt;list of errata&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2014$&lt;/span&gt; and the list refers to the first until the &lt;em&gt;fifth&lt;/em&gt; print of the book, which is not the last print of the book.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is&lt;/strong&gt;: Is there (still) an 'official' or 'semi-official' list of errata, preferably for the &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;th anniversary edition, and also preferably still being maintained?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;As a follow up question&lt;/strong&gt;, is there also a way to notify the maintainers about any as of yet unnoticed errors?&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-01-25T10:59:48.837" Title="Is there any 'official' list of errata for Nielsen &amp; Chuang?" Tags="&lt;resource-request&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13544" PostTypeId="1" AcceptedAnswerId="13545" CreationDate="2020-09-01T14:19:41.520" Score="1" ViewCount="63" Body="&lt;p&gt;I'm trying to wrap my head around the expectation argument in Qiskit's &lt;code&gt;VQE&lt;/code&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-09-01T22:13:15.463" LastActivityDate="2020-09-01T22:13:15.463" Title="How to build an ExpectationBase object?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13545" PostTypeId="2" ParentId="13544" CreationDate="2020-09-01T15:43:25.497" Score="1" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;convert operator to a matrix, the ansatz circuit to a statevector and compute the dot-product, or&lt;/li&gt;&#xA;&lt;li&gt;convert the operator to Pauli strings, diagonalize the ansatz circuit in each basis of the Pauli strings and measure.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The &lt;code&gt;expectation&lt;/code&gt; argument allows you to choose the kind of expectation computation you want to use.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;qiskit.aqua.operators.MatrixExpectation&lt;/code&gt; does the dot product&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;qiskit.aqua.operators.PauliExpectation&lt;/code&gt; does the Pauli string transform (this is what you would do on real quantum hardware)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;qiskit.aqua.operators.AerPauliExpectation&lt;/code&gt; uses a special expectation value from Qiskit's Aer element&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A bit more advanced:&lt;/p&gt;&#xA;&lt;p&gt;If you were to create your own kind of expectation computation you can check how &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/operators/expectations/matrix_expectation.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;MatrixExpectation&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/operators/expectations/pauli_expectation.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;PauliExpectation&lt;/code&gt;&lt;/a&gt; are implemented. They require some knowledge of how the operator flow in Aqua works though. In brief, the &lt;code&gt;ExpectationValue&lt;/code&gt; provides a &lt;code&gt;convert&lt;/code&gt; method that maps an operator expression that realizes the expectation value (something like &lt;code&gt;OperatorMeasurement @ StateFn&lt;/code&gt;) to a new expression that implements your expectation value scheme. For &lt;code&gt;MatrixExpectation&lt;/code&gt; this means converting all operators to matrices and for &lt;code&gt;PauliExpectation&lt;/code&gt; this means converting the operator to Pauli strings and applying the right basis transformations to the ansatz circuit.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-09-01T15:43:25.497" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13546" PostTypeId="1" AcceptedAnswerId="13550" CreationDate="2020-09-01T15:56:36.683" Score="3" ViewCount="62" Body="&lt;p&gt;Given many copies of some unknown quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, I would like to compute its von Neumann entropy &lt;span class=&quot;math-container&quot;&gt;$S(\rho)$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\varepsilon-$&lt;/span&gt;close and one will need more copies as &lt;span class=&quot;math-container&quot;&gt;$\varepsilon\rightarrow 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. But the classical description of the state has a lot more information so perhaps there is a smarter way?&lt;/p&gt;&#xA;" OwnerUserId="13114" LastEditorUserId="55" LastEditDate="2020-09-10T11:48:15.087" LastActivityDate="2020-09-10T11:48:15.087" Title="How can one estimate the von Neumann entropy of an unknown quantum state?" Tags="&lt;algorithm&gt;&lt;entropy&gt;&lt;tomography&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13547" PostTypeId="1" CreationDate="2020-09-01T16:15:26.993" Score="7" ViewCount="79" Body="&lt;p&gt;In Trotterization, the typical Hamiltonian considered is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is then converted into a sequence of gates by the Jordan Wigner transformation.&lt;/p&gt;&#xA;&lt;p&gt;However, &lt;strong&gt;how do we choose the ordering of the &lt;span class=&quot;math-container&quot;&gt;$ pq$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$pqrs$&lt;/span&gt; terms&lt;/strong&gt;? For example, if our Hamiltonian was:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are at least &lt;span class=&quot;math-container&quot;&gt;$ 3! = 6$&lt;/span&gt; ways to order the Hamiltonian, a number which quickly explodes as the size of the Hamiltonian grows.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="8343" LastEditDate="2020-09-02T14:47:39.480" LastActivityDate="2021-02-22T14:50:39.430" Title="Impact of ordering Hamiltonian terms for Trotterization" Tags="&lt;hamiltonian-simulation&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13548" PostTypeId="1" AcceptedAnswerId="13553" CreationDate="2020-09-01T16:18:02.667" Score="4" ViewCount="131" Body="&lt;p&gt;Suppose we have a depolarizing channel operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E(\rho)=\frac{p}{2}\textbf{1}+(1-p)\rho$$&lt;/span&gt;&#xA;acting on a Spin&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; density matrix of the form &lt;span class=&quot;math-container&quot;&gt;$\rho=\frac{1}{2}(\textbf{1}+\textbf{s}\cdot\textbf{$\sigma$})$&lt;/span&gt;. I have found the Kraus operators to be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&#xA;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$E(\rho)=\sum_kE_k\rho E_k^\dagger=\text{Tr}_S(U\rho\otimes\rho_EU^\dagger)$$&lt;/span&gt;&#xA;Supposing the new system S is prepared on a state &lt;span class=&quot;math-container&quot;&gt;$|e_0\rangle$&lt;/span&gt;, How do I find the correct unitary matrix?&lt;/p&gt;&#xA;&lt;p&gt;I appreciate your cooperation.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Crossposted to physics: &lt;a href=&quot;https://physics.stackexchange.com/questions/576952/how-to-find-the-unitary-operation-of-a-depolarizing-channel&quot;&gt;https://physics.stackexchange.com/questions/576952/how-to-find-the-unitary-operation-of-a-depolarizing-channel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13115" LastEditorUserId="55" LastEditDate="2020-09-01T21:57:17.273" LastActivityDate="2020-09-01T21:57:17.273" Title="How to find the unitary operation of a depolarizing channel?" Tags="&lt;quantum-operation&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13549" PostTypeId="1" CreationDate="2020-09-01T16:27:28.750" Score="0" ViewCount="281" Body="&lt;p&gt;&lt;strong&gt;I was installing the editable version of qiskit-terra from source in my conda environment using the following command&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install -e .&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;and I got the following error:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ERROR: Command errored out with exit status 1:&#xA; command: 'C:\Users\Tanya Garg\Anaconda3\envs\fixissueenv\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '&amp;quot;'&amp;quot;'C:\\Users\\Tanya Garg\\qiskit-terra\\setup.py'&amp;quot;'&amp;quot;'; __file__='&amp;quot;'&amp;quot;'C:\\Users\\Tanya Garg\\qiskit-terra\\setup.py'&amp;quot;'&amp;quot;';f=getattr(tokenize, '&amp;quot;'&amp;quot;'open'&amp;quot;'&amp;quot;', open)(__file__);code=f.read().replace('&amp;quot;'&amp;quot;'\r\n'&amp;quot;'&amp;quot;', '&amp;quot;'&amp;quot;'\n'&amp;quot;'&amp;quot;');f.close();exec(compile(code, __file__, '&amp;quot;'&amp;quot;'exec'&amp;quot;'&amp;quot;'))' develop --no-deps&#xA;     cwd: C:\Users\Tanya Garg\qiskit-terra\&#xA;Complete output (13 lines):&#xA;running develop&#xA;running egg_info&#xA;writing qiskit_terra.egg-info\PKG-INFO&#xA;writing dependency_links to qiskit_terra.egg-info\dependency_links.txt&#xA;writing requirements to qiskit_terra.egg-info\requires.txt&#xA;writing top-level names to qiskit_terra.egg-info\top_level.txt&#xA;reading manifest file 'qiskit_terra.egg-info\SOURCES.txt'&#xA;reading manifest template 'MANIFEST.in'&#xA;warning: no files found matching 'test\python\pickles\*.pickle'&#xA;writing manifest file 'qiskit_terra.egg-info\SOURCES.txt'&#xA;running build_ext&#xA;building 'qiskit.transpiler.passes.routing.cython.stochastic_swap.utils' extension&#xA;error: Microsoft Visual C++ 14.0 or greater is required. Get it with &amp;quot;Microsoft C++ Build Tools&amp;quot;: https://visualstudio.microsoft.com/visual-cpp-build-tools/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;What does this error mean and how can I address it?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13116" LastEditorUserId="13117" LastEditDate="2020-09-04T11:39:28.803" LastActivityDate="2020-09-04T11:41:19.513" Title="Command errored out with exit status 1 while installing the editable env for qiskit terra" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13550" PostTypeId="2" ParentId="13546" CreationDate="2020-09-01T16:32:38.277" Score="1" Body="&lt;p&gt;Similar ideas with Quantum PCA may be useful. Meaning, apply Quantum Phase Estimation on unitary &lt;span class=&quot;math-container&quot;&gt;$e^{-i\rho t}$&lt;/span&gt; to obtain estimates of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and finally estimate von Neumann entropy as &lt;span class=&quot;math-container&quot;&gt;$S(\rho) = -\sum \tilde{\lambda_i} \text{log}\tilde{\lambda_i}$&lt;/span&gt;. In the original paper there is the claim that you obtain estimates of the eigenvalues with accuracy &lt;span class=&quot;math-container&quot;&gt;$O(\epsilon)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$O(\frac{1}{\epsilon^3})$&lt;/span&gt; copies of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-01T16:32:38.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13551" PostTypeId="2" ParentId="13529" CreationDate="2020-09-01T17:09:08.880" Score="2" Body="&lt;p&gt;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: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.circuits.StateVectorCircuit.construct_circuit.html#qiskit.aqua.circuits.StateVectorCircuit.construct_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.aqua.circuits.StateVectorCircuit.construct_circuit.html#qiskit.aqua.circuits.StateVectorCircuit.construct_circuit&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You initialize StateVectorCircuit with your array of complex values.&lt;/p&gt;&#xA;" OwnerUserId="4966" LastActivityDate="2020-09-01T17:09:08.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13552" PostTypeId="2" ParentId="13524" CreationDate="2020-09-01T17:14:32.240" Score="1" Body="&lt;p&gt;Short answer:&lt;/p&gt;&#xA;&lt;p&gt;Check out &lt;code&gt;qiskit.aqua.algorithms.amplitude_estimators.q_factory.QFactory&lt;/code&gt; which constructs &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; if you provide it with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. You can use the &lt;code&gt;i_objective&lt;/code&gt; argument to specify the &amp;quot;good&amp;quot; state in &lt;span class=&quot;math-container&quot;&gt;$S_{\Psi_0}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Long answer:&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$S_0$&lt;/span&gt; operation is flips the sign of the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. In Qiskit, you can do that with the &lt;code&gt;QuantumCircuit.mcx&lt;/code&gt; method and Hadamard gates around that (since there's no &lt;code&gt;mcz&lt;/code&gt; method and &lt;code&gt;HXH = Z&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;s0 = QuantumCircuit(n)&#xA;s0.x(n - 1)&#xA;s0.h(n - 1)&#xA;s0.mcx(list(range(n - 1)), n - 1)&#xA;s0.h(n - 1)&#xA;s0.x(n - 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$S_{\Psi_0}$&lt;/span&gt; operation, called the oracle in Grover's algorithm, applies a -1 factor to the &amp;quot;good&amp;quot; qubit states. This requires additional information, how do you determine if a state is &amp;quot;good&amp;quot; or &amp;quot;bad&amp;quot; in your scenario?&lt;/p&gt;&#xA;&lt;p&gt;As an example: In many optimization examples we define the operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A|0\rangle^{\otimes (n + 1)} = \sqrt{1 - a} |\psi_0\rangle|0\rangle + \sqrt{a} |\psi_1\rangle|1\rangle&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit states &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0,1}\rangle$&lt;/span&gt;. There we define good states by the last qubit begin in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and hence the circuit for &lt;span class=&quot;math-container&quot;&gt;$S_{\Psi_0}$&lt;/span&gt; is just a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on the last qubit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;s_psi0 = QuantumCircuit(n + 1)&#xA;s_psi0.z(n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the amplitude estimation algorithm, the &lt;code&gt;QFactory&lt;/code&gt; class (full import &lt;code&gt;qiskit.aqua.algorithms.amplitude_estimators.q_factory.QFactory&lt;/code&gt;) is used, which constructs &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; if you provide it with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. There it assumes that the good state can be specified by the a single qubit begin in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The index of this qubit is specified via &lt;code&gt;i_objective&lt;/code&gt; (per default the last qubit index is used).&lt;/p&gt;&#xA;&lt;p&gt;The above example, where the &amp;quot;good&amp;quot; state is specified by the last qubit being in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; would therefore be&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.algorithms.amplitude_estimators.q_factory import QFactory&#xA;q = QFactory(your_a_factory)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-09-01T17:14:32.240" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13553" PostTypeId="2" ParentId="13548" CreationDate="2020-09-01T17:55:42.157" Score="5" Body="&lt;p&gt;From N&amp;amp;C: Assuming the environment is in some pure state we recall that Kraus representations comes from the unitary evolution &lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. So we need a unitary such that &lt;span class=&quot;math-container&quot;&gt;$E_k=\langle e_k|U|e_0\rangle$&lt;/span&gt;. We can pick &lt;span class=&quot;math-container&quot;&gt;$$U=\begin{pmatrix} E_1 &amp;amp; \cdots &amp;amp; \cdots &amp;amp; \cdots \\ E_2 &amp;amp; \cdots &amp;amp; \cdots &amp;amp; \cdots \\  \vdots &amp;amp; \cdots &amp;amp; \cdots &amp;amp; \cdots \\ E_n &amp;amp; \cdots &amp;amp; \cdots &amp;amp; \cdots\end{pmatrix}$$&lt;/span&gt; in the basis for &lt;span class=&quot;math-container&quot;&gt;$e_k$&lt;/span&gt;. To find your unitary you just need to find the remaining entries that make the resulting matrix unitary (this should be possible).&lt;/p&gt;&#xA;&lt;p&gt;More uniquely, each Kraus representation has a Stinespring dilation, which is merely an isometry &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\sum_{k}E_k\rho E_k^*=tr_S(V\rho V^*)$$&lt;/span&gt; and now &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; can be written as the matrix &lt;span class=&quot;math-container&quot;&gt;$$V=\begin{pmatrix} E_1  \\ E_2  \\ \vdots \end{pmatrix}$$&lt;/span&gt; in the basis for &lt;span class=&quot;math-container&quot;&gt;$e_k$&lt;/span&gt;, 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&amp;amp;C).&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-09-01T18:19:48.080" LastActivityDate="2020-09-01T18:19:48.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13554" PostTypeId="2" ParentId="13323" CreationDate="2020-09-01T18:42:01.227" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I do not understand how if some quantum states &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma \in  \mathbb{C}^n \otimes \mathbb{C}^m$&lt;/span&gt;&#xA;then how can their addition not be in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n \otimes \mathbb{C}^m$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The author is not claiming that this is false. This is certainly true, you are right about that!&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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).'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The author is saying that there are non-subspace structures (i.e. tensor factors) which have the &lt;em&gt;noiseless&lt;/em&gt;  property. The point is kind of abstract but it comes from the notion that &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; isn't &lt;em&gt;naturally&lt;/em&gt; a subspace of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n\otimes \mathbb{C}^m$&lt;/span&gt;. However, this doesn't mean you can't think of a way to think of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; as a subspace, it just means you need to fix something in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^m$&lt;/span&gt; to do so.&lt;/p&gt;&#xA;&lt;p&gt;More to the point, if you did want to think about &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; as a subspace of  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n\otimes \mathbb{C}^m$&lt;/span&gt; you would need to fix a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^m$&lt;/span&gt; and identify how the basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; gets mapped to the basis of  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n\otimes \mathbb{C}^m$&lt;/span&gt;. It's because of this &amp;quot;identication requirement&amp;quot; these noiseless subsystems are not technically subspaces.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;subspace&lt;/em&gt; of a 2-qubit space can be given by the mapping &lt;span class=&quot;math-container&quot;&gt;$$\alpha|0\rangle+\beta|1\rangle \mapsto \alpha|0\rangle_1|0\rangle_2+\beta|1\rangle_1|1\rangle_2$$&lt;/span&gt; this encoding can be seen as a linear (or subspace) endcoding as we are mapping a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; to a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2\otimes \mathbb{C}^2\cong \mathbb{C}^4$&lt;/span&gt;. Now, consider an encoding of a qubit of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha|0\rangle+\beta|1\rangle \mapsto (\alpha|0\rangle_1+\beta|1\rangle_1)\otimes |\psi\rangle_2 $$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_2$&lt;/span&gt; is an arbitrary qubit in the second space of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2\otimes \mathbb{C}^2$&lt;/span&gt;. This encoding is into the first &lt;em&gt;subsystem&lt;/em&gt; 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 &lt;em&gt;non-linear&lt;/em&gt; and that's why its not the same as a subspace encoding). That being said, if we did fix &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_2$&lt;/span&gt; to be a specific element of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; then we would get a subspace encoding like the first example, just in a different basis.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-09-02T18:16:52.380" LastActivityDate="2020-09-02T18:16:52.380" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13555" PostTypeId="2" ParentId="13549" CreationDate="2020-09-01T20:33:16.190" Score="4" Body="&lt;p&gt;It looks like the error message suggests to install Microsoft Visual C++ 14.0 or greater by following the link: &lt;a href=&quot;https://visualstudio.microsoft.com/visual-cpp-build-tools/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://visualstudio.microsoft.com/visual-cpp-build-tools/&lt;/a&gt; . 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 &lt;a href=&quot;https://qiskit.org/documentation/contributing_to_qiskit.html#install-qiskit-terra&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/contributing_to_qiskit.html#install-qiskit-terra&lt;/a&gt;  :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;conda activate name-of-env&#xA;pip install cython&#xA;pip install -r requirements-dev.txt&#xA;pip install -e .&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-01T20:33:16.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13556" PostTypeId="2" ParentId="13531" CreationDate="2020-09-01T22:24:50.047" Score="3" Body="&lt;p&gt;Potentially, the same advantage that quantum computing can provide over classical computing. By &amp;quot;&lt;em&gt;quantum machine learning&lt;/em&gt;&amp;quot;, 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).&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;quantum-enhanced machine learning&amp;quot; in this context, to distinguish it from applications of classical machine learning to quantum information tasks, which is an entirely different field of study.&lt;/p&gt;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1208/55&quot;&gt;this question&lt;/a&gt; and links therein.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-09-01T22:24:50.047" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13557" PostTypeId="1" CreationDate="2020-09-02T00:54:01.503" Score="3" ViewCount="36" Body="&lt;p&gt;What is the complexity of the quantum unconstrained binary optimization (QUBO) algorithm in the number of queries to the quantum processor?&lt;/p&gt;&#xA;&lt;p&gt;To clarify, I'm asking about the complexity on quantum annealers.&lt;/p&gt;&#xA;" OwnerUserId="13118" LastEditorUserId="55" LastEditDate="2020-09-04T09:28:06.340" LastActivityDate="2020-09-04T09:28:06.340" Title="What is the query complexity of the QUBO algorithm?" Tags="&lt;complexity-theory&gt;&lt;optimization&gt;&lt;d-wave&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13558" PostTypeId="1" CreationDate="2020-09-02T08:44:38.453" Score="3" ViewCount="546" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;theta_range = np.linspace(0, 2 * np.pi, 128)&#xA;circuits = [qc.bind_parameters({theta: theta_val})&#xA;            for theta_val in theta_range]&#xA;circuits[-1].draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There is only one parameter, &lt;code&gt;theta&lt;/code&gt;. I want more parameters in the some range. How can I achieve that?&lt;/p&gt;&#xA;" OwnerUserId="12877" LastEditorUserId="55" LastEditDate="2020-09-04T09:29:21.500" LastActivityDate="2020-09-04T09:29:21.500" Title="How to add several parameters in qiskit circuit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13559" PostTypeId="2" ParentId="13558" CreationDate="2020-09-02T09:03:39.770" Score="3" Body="&lt;p&gt;You can create an arbitrary number of parameters in your circuit by using the &lt;code&gt;qiskit.circuit.Parameter&lt;/code&gt; class. Here's a brief example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import Parameter, QuantumCircuit&#xA;&#xA;# define your parameters&#xA;a, b, c = Parameter('a'), Parameter('b'), Parameter('c')&#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.rx(a, 0)  # RX(a) on qubit 0&#xA;circuit.ry(b, 0)  # RY(b) on qubit 1&#xA;circuit.crz(c, 0, 1)  # CRZ(c) controlled on qubit 0, acting on qubit 1&#xA;&#xA;# bind the values&#xA;bound_circuit = circuit.bind_parameters({a: 0, b: 1, c: 2})&#xA;&#xA;# or if you have a list of values&#xA;a_vals = [0, 1, 2, 3]&#xA;b_vals = [1, 2, 3, 4]&#xA;c_vals = [2, 3, 4, 5]&#xA;bound_circuits = [circuit.bind_parameters(&#xA;    {a: a_val, b: b_val, c: c_val}) &#xA;     for (a_val, b_val, c_val) in zip(a_vals, b_vals, c_vals)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For convenience there's also the &lt;code&gt;ParameterVector&lt;/code&gt; class to construct multiple parameters at once. The above example can also look like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import ParameterVector, QuantumCircuit&#xA;&#xA;# define your parameters&#xA;p = ParameterVector('p', 3)  &#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.rx(p[0], 0)  # RX(p[0]) on qubit 0&#xA;circuit.ry(p[1], 0)  # RY(p[1]) on qubit 1&#xA;circuit.crz(p[2], 0, 1)  # CRZ(p[2]) controlled on qubit 0, acting on qubit 1&#xA;&#xA;# bind the values&#xA;bound_circuit = circuit.bind_parameters({p: [0, 1, 2]})&#xA;&#xA;# or for a list of values&#xA;values = [ [0, 1, 2], [1, 2, 3], [2, 3, 4] ]&#xA;bounds_circuits = [circuit.bind_parameters({p: val} for val in values})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9800" LastEditDate="2020-09-02T14:01:01.517" LastActivityDate="2020-09-02T14:01:01.517" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="13560" PostTypeId="1" CreationDate="2020-09-02T11:08:02.960" Score="2" ViewCount="265" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Code examples would be great.&lt;/p&gt;&#xA;" OwnerUserId="12877" LastEditorUserId="55" LastEditDate="2020-09-04T09:29:33.787" LastActivityDate="2020-09-04T09:29:33.787" Title="Examples of VQE on Qiskit" Tags="&lt;qiskit&gt;&lt;resource-request&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13561" PostTypeId="2" ParentId="13560" CreationDate="2020-09-02T11:21:22.783" Score="2" Body="&lt;p&gt;Did you have a look to the following chapters in the Qiskit Textbook?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Simulating Molecules using VQE:&#xA;&lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#vqe&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#vqe&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Variational Quantum Linear Solver:&#xA;&lt;a href=&quot;https://qiskit.org/textbook/ch-paper-implementations/vqls.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-paper-implementations/vqls.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-02T11:21:22.783" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13562" PostTypeId="1" CreationDate="2020-09-02T11:47:52.017" Score="1" ViewCount="40" Body="&lt;p&gt;I am reading about the noise models that can be simulated in Qiskit and I found out the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.phase_amplitude_damping_error.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;phase_amplitude_damping_error&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="10480" LastEditDate="2021-04-30T02:05:58.807" LastActivityDate="2021-04-30T02:05:58.807" Title="Qiskit function phase_amplitude_damping_error" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-operation&gt;&lt;noise&gt;&lt;kraus-representation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13563" PostTypeId="1" AcceptedAnswerId="13574" CreationDate="2020-09-02T14:08:15.273" Score="5" ViewCount="219" Body="&lt;p&gt;I'm not sure if this is a good question for the site, but here goes.&lt;/p&gt;&#xA;&lt;p&gt;On the &amp;quot;Quantum logic gate&amp;quot; Wikipedia page, &lt;a href=&quot;https://en.wikipedia.org/w/index.php?title=Quantum_logic_gate&amp;amp;oldid=976213131#Square_root_of_Swap_gate_(%E2%88%9ASWAP)&quot; rel=&quot;nofollow noreferrer&quot;&gt;it is said that&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\mathrm{SWAP}}$&lt;/span&gt; gate is not, however maximally entangling; more than one application of it is required to produce a Bell state from product states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'm a bit confused by this remark, its definition for the gate in the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle, |11\rangle$&lt;/span&gt; basis is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{\mathrm{SWAP}} = \begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \frac{1}{2}(1+i) &amp;amp; \frac{1}{2}(1-i) &amp;amp; 0 \\&#xA;0 &amp;amp; \frac{1}{2}(1-i) &amp;amp; \frac{1}{2}(1+i) &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix} \,.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems like if I apply the gate on the product state &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; I should end up with something proportional to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}|01\rangle - \frac{i}{\sqrt2}|10\rangle$&lt;/span&gt; which looks maximally entangled to me? Am I misunderstanding something?&lt;/p&gt;&#xA;" OwnerUserId="13110" LastEditorUserId="55" LastEditDate="2020-09-02T14:56:52.787" LastActivityDate="2020-09-03T17:08:32.710" Title="Is the square root of SWAP gate &quot;maximally entangling&quot;?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13565" PostTypeId="1" AcceptedAnswerId="13572" CreationDate="2020-09-02T14:40:53.833" Score="5" ViewCount="98" Body="&lt;p&gt;One can rattle off names of implementations of Superconducting Qubits, transmon qubits, etc&lt;/p&gt;&#xA;&lt;p&gt;For example, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10020/462&quot;&gt;Physical realizations used by Google&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But NV centre Qubits as in this question, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/10020/462&quot;&gt;Is there any company that backs and implements diamond vacancy quantum computers?&lt;/a&gt; have no large company spending money on it.&lt;/p&gt;&#xA;&lt;p&gt;Any research on it is relegated to academia or the companies in stealth mode.&lt;/p&gt;&#xA;&lt;p&gt;What about its implementation makes it unattractive?&lt;/p&gt;&#xA;&lt;p&gt;One would think that since it operates at near room temperatures should make it more appealing?&#xA;For reference See Quantum computing book by Nielsen and Chuang&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt; This  question  is completely produced  by a comment in  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5361/462&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="8623" LastEditDate="2020-09-02T21:11:38.643" LastActivityDate="2020-09-03T08:15:14.907" Title="Why isn't NV-center-based quantum computing mainstream?" Tags="&lt;physical-realization&gt;&lt;nv-centers&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13566" PostTypeId="2" ParentId="13563" CreationDate="2020-09-02T15:00:20.007" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{SWAP}|01\rangle\ = \frac{1+i}{2}|01\rangle + \frac{1-i}{2}|10\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{i}{2}|01\rangle+\frac{1}{2}|10\rangle-\frac{i}{2}|01\rangle+\frac{1}{2}|10\rangle=|10\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="4991" LastEditDate="2020-09-02T15:57:05.517" LastActivityDate="2020-09-02T15:57:05.517" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13568" PostTypeId="1" AcceptedAnswerId="13569" CreationDate="2020-09-02T15:53:11.060" Score="2" ViewCount="56" Body="&lt;p&gt;Analogous to this question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5287/462&quot;&gt;Is there any company that backs and implements diamond vacancy quantum computers?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="55" LastEditDate="2020-09-02T18:51:56.300" LastActivityDate="2020-09-02T18:51:56.300" Title="Is there any company trying out ion trap qubits?" Tags="&lt;physical-realization&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13569" PostTypeId="2" ParentId="13568" CreationDate="2020-09-02T16:26:40.867" Score="3" Body="&lt;p&gt;IonQ, Honeywell, and Infineon Technologies (&lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_companies_involved_in_quantum_computing_or_communication&quot; rel=&quot;nofollow noreferrer&quot;&gt;list here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;From my understanding, IonQ and Honeywell seem to be leading in the trapped ion space&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-02T16:26:40.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13570" PostTypeId="5" CreationDate="2020-09-02T18:15:57.127" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-09-02T18:15:57.127" LastActivityDate="2020-09-02T18:15:57.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13571" PostTypeId="4" CreationDate="2020-09-02T18:15:57.127" Score="0" Body="For questions about nitrogen-vacancy centers in diamonds." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-09-02T18:15:57.127" LastActivityDate="2020-09-02T18:15:57.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13572" PostTypeId="2" ParentId="13565" CreationDate="2020-09-02T18:48:57.583" Score="6" Body="&lt;p&gt;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 &lt;a href=&quot;https://youtu.be/C0tJ617xzTE?t=230&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Despite the difficulties, it seems highly likely that NV centers, or similar semiconductor impurities (there are at least seven other possibilities, &lt;em&gt;see, e.g.&lt;/em&gt;, &lt;a href=&quot;https://youtu.be/2kpTK1cKDto?t=2543&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://journals.aps.org/prx/abstract/10.1103/PhysRevX.9.031045&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. The system described in that paper uses the NV center plus 9 surrounding nuclear spins (one &lt;span class=&quot;math-container&quot;&gt;${}^{14}$&lt;/span&gt;N plus eight &lt;span class=&quot;math-container&quot;&gt;${}^{13}$&lt;/span&gt;C) to create a fully connected 10-qubit register.  That's 10 connected qubits from a single NV center, very impressive!&lt;/p&gt;&#xA;&lt;p&gt;As a final note, Awschalom (from the videos linked above) is a leading expert on this topic and runs a group at Chicago doing &lt;a href=&quot;https://pme.uchicago.edu/awschalom-group/quantum-information-processing-diamond&quot; rel=&quot;nofollow noreferrer&quot;&gt;great work in this space&lt;/a&gt;.  Awschalom is also Director of &lt;a href=&quot;https://www.q-next.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q-Next&lt;/a&gt;, which &lt;a href=&quot;https://www.anl.gov/article/department-of-energy-selects-argonne-to-lead-national-quantum-center&quot; rel=&quot;nofollow noreferrer&quot;&gt;just received&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-09-03T08:15:14.907" LastActivityDate="2020-09-03T08:15:14.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13573" PostTypeId="1" CreationDate="2020-09-02T18:55:04.970" Score="3" ViewCount="87" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9805082.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;In the paper by Brassard, Hoyer, Tapp (1998) on Quantum Counting&lt;/a&gt; we have the following expression for the state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|Y\rangle =\sum_{i\in\mathbb{Z}}x_i|i\rangle |Y_i\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we have a quantum algorithm &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt;. Then we have the operator &lt;span class=&quot;math-container&quot;&gt;$S_0^{\phi}$&lt;/span&gt; which changes the phase of the state by a factor of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; if and only the first register holds a zero. The paper goes into more detail about the setup.&lt;/p&gt;&#xA;&lt;p&gt;Lemma 1 claims that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{A}S_0^{\phi}\mathcal{A}^{-1}|Y\rangle=|Y\rangle-(1-\phi)\langle Y|\mathcal{A}|0\rangle ^*\mathcal{A}|0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How is this lemma arising? What is the proof for that lemma?&lt;/p&gt;&#xA;" OwnerUserId="12480" LastEditorUserId="55" LastEditDate="2020-09-03T08:11:35.783" LastActivityDate="2021-05-28T01:35:53.543" Title="Lemma 1 in the paper by Brassard, Hoyer, Tapp (1998) on Quantum counting" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13574" PostTypeId="2" ParentId="13563" CreationDate="2020-09-02T19:50:01.300" Score="4" Body="&lt;p&gt;It seems like the article you're referencing is defining &amp;quot;maximally entangling&amp;quot; as &amp;quot;capable of producing Bell states from product states&amp;quot;. However there are other ways to describe how much entanglement an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; introduces into a state.&lt;/p&gt;&#xA;&lt;p&gt;One definition that I like but haven't had much success with is the &amp;quot;entangling power&amp;quot; introduced in [1], which describes the maximum entropy resulting from applying the operation to a bipartite input state (note that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle,|\phi\rangle$&lt;/span&gt; are each defined over two-qubit systems):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K_E(U) \equiv \max_{|\psi\rangle,|\phi\rangle}E\left(U |\psi\rangle|\phi\rangle \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the Von Neumann entropy of the partial trace state. The article computes the entangling power of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; as 1 ebit and entangling power of &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt; as 2 ebits.&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V = \sum_{j=0}^3 c_j \sigma_j \otimes \sigma_j&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is related to &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; by local rotations only. Then the Schmidt rank of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is 2 and the Schmidt rank of &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt; is 4.&lt;/p&gt;&#xA;&lt;p&gt;So to address your question, I believe its impossible to construct a Bell state starting from a separable two-qubit state and using only &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt;'s for entanglement, but both of the definitions above suggest that the &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt; gate is capable of creating more entanglement than a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; in at least some sense. This suggests that the definition of &amp;quot;maximally entangling&amp;quot; provided is either inconsistent or poorly defined or both. As for how much entanglement &lt;span class=&quot;math-container&quot;&gt;$\sqrt{SWAP}$&lt;/span&gt; produces, you might look into computing either of the quantities defined above for a more rigorous (albeit less conceptual) answer.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[1] (Shen and Chen, 2018) Entangling power of two-qubit unitary operations. &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1751-8121/aad7cb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://iopscience.iop.org/article/10.1088/1751-8121/aad7cb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[2] (Nielsen, 2002) Quantum dynamics as a physical resource. &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.052301&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.052301&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[3] (Nielsen, 2000) Quantum Information Theory. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0011036&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0011036&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2020-09-03T17:08:32.710" LastActivityDate="2020-09-03T17:08:32.710" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13575" PostTypeId="2" ParentId="13513" CreationDate="2020-09-03T00:33:33.240" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.proteinqure.com/&quot; rel=&quot;noreferrer&quot;&gt;ProteinQure&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://qulab.com/&quot; rel=&quot;noreferrer&quot;&gt;Qulab&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumsimulations.de/&quot; rel=&quot;noreferrer&quot;&gt;HQS&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://gtn.ai/&quot; rel=&quot;noreferrer&quot;&gt;Kuano&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For a general understanding of molecular simulation, &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;noreferrer&quot;&gt;Simulating Molecules using VQE&lt;/a&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;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. &lt;a href=&quot;https://arxiv.org/abs/1902.02134&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-09-03T00:33:33.240" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13576" PostTypeId="1" CreationDate="2020-09-03T02:36:37.200" Score="1" ViewCount="16" Body="&lt;p&gt;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.&#xA;However, runs with 100 shots rarely yield 100% accuracy.&lt;/p&gt;&#xA;" OwnerUserId="13127" LastActivityDate="2020-09-03T02:36:37.200" Title="Do we expect similar results in form of measurement histogram for both (1 run with 100 shots) and (100 runs with 1 shot each)?" Tags="&lt;noise&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13578" PostTypeId="1" CreationDate="2020-09-03T06:43:48.973" Score="1" ViewCount="89" Body="&lt;p&gt;I am trying to understand what exactly happens in QAOA. I am reading &lt;a href=&quot;https://www.mustythoughts.com/quantum-approximate-optimization-algorithm-explained&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog&lt;/a&gt; which says,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We would be just repetitively applying &lt;span class=&quot;math-container&quot;&gt;$U_C$&lt;/span&gt;. But once we got into a state which is the eigenstate of &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; which commutes with &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;. So we need this intermediate step of applying &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$β$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$γ$&lt;/span&gt; which make it happen.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I want to know what do they mean by local minimum?&lt;/p&gt;&#xA;&lt;p&gt;It also says,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It doesn’t need to be just &lt;span class=&quot;math-container&quot;&gt;$\sum_i^N \sigma_i^x$&lt;/span&gt;. We want it to be something that does not commute with &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; and this choice of &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; meets this requirement and is super easy to implement.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What does that mean?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; is the cost hamiltonian which corresponds to the objective function to be optimized and &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; is the operator which is summation of Pauli-z operators on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th qubit. &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; is the mixing operator.&lt;/p&gt;&#xA;" OwnerUserId="13129" LastEditorUserId="55" LastEditDate="2020-09-03T20:32:17.520" LastActivityDate="2020-09-04T17:25:25.183" Title="What is meant by &quot;local minimum&quot; in QAOA?" Tags="&lt;qaoa&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13579" PostTypeId="1" AcceptedAnswerId="13588" CreationDate="2020-09-03T07:05:55.763" Score="1" ViewCount="49" Body="&lt;p&gt;In PyQuil, a qubit is initialised as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; by default. Suppose, I want to initialise a qubit in an arbitrary state, say &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}|0\rangle+\sqrt{\frac{2}{3}}|1\rangle$&lt;/span&gt;. How to do this arbitrary qubit initialisation in PyQuil?&lt;/p&gt;&#xA;" OwnerUserId="11572" LastEditorUserId="55" LastEditDate="2020-09-04T09:49:51.857" LastActivityDate="2020-09-04T09:49:51.857" Title="How to create a qubit in an arbitrary state in PyQuil" Tags="&lt;programming&gt;&lt;pyquil&gt;&lt;rigetti&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13580" PostTypeId="2" ParentId="13573" CreationDate="2020-09-03T07:31:57.680" Score="1" Body="&lt;p&gt;First observe that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;S_0^{\phi} &#xA;&amp;amp;= \phi \cdot |0 \rangle \langle 0| \otimes \mathbb{1} + |1 \rangle \langle 1| \otimes \mathbb{1} \\&#xA;&amp;amp;= \phi \cdot |0 \rangle \langle 0| \otimes \mathbb{1} + \Big(\mathbb{1} - |0 \rangle \langle 0|\Big) \otimes \mathbb{1} \\&#xA;&amp;amp;= \mathbb{1} \otimes \mathbb{1} - (1 - \phi) \cdot |0 \rangle \langle 0| \otimes \mathbb{1}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So it holds that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\mathcal{A} S_0^{\phi} \mathcal{A}^{-1} |Y \rangle &#xA;&amp;amp;= |Y \rangle - (1 - \phi) \cdot \mathcal{A} \Big(|0 \rangle \langle 0| \otimes \mathbb{1}\Big) \mathcal{A}^{-1}|Y \rangle \\&#xA;&amp;amp;= |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 \\&#xA;&amp;amp;= |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}&#xA;\end{align*}&lt;/span&gt;&#xA;and with an &amp;quot;abuse of notation&amp;quot; the two expressions are equal.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-03T07:31:57.680" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13581" PostTypeId="1" AcceptedAnswerId="13594" CreationDate="2020-09-03T07:35:46.130" Score="0" ViewCount="69" Body="&lt;p&gt;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#.&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="55" LastEditDate="2020-09-04T09:50:08.880" LastActivityDate="2020-09-04T16:58:22.427" Title="How to implement quantum gate from matrix in Q#" Tags="&lt;programming&gt;&lt;q#&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13582" PostTypeId="1" CreationDate="2020-09-03T09:27:49.860" Score="3" ViewCount="67" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Note  I am not talking about relativistic or other corrections already present.&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="55" LastEditDate="2020-09-03T12:11:15.487" LastActivityDate="2020-09-03T12:11:15.487" Title="What happens to Quantum computing if Schroedingers equation gets a correction term to account for some new changes in fundamental physics?" Tags="&lt;foundations&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2020-09-04T11:47:28.993" ContentLicense="CC BY-SA 4.0" />
  <row Id="13584" PostTypeId="1" AcceptedAnswerId="13585" CreationDate="2020-09-03T14:24:07.283" Score="2" ViewCount="56" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t8zUw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t8zUw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a simulation I did in my program. I'm hoping to print out the probability of the state &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle$&lt;/span&gt; (which is &lt;span class=&quot;math-container&quot;&gt;$0.052$&lt;/span&gt;), and store this number in a letter (a). How can I do this? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="1859" LastEditDate="2020-11-23T09:49:56.183" LastActivityDate="2020-11-23T09:49:56.183" Title="How can I print out the probability of a certain state in histogram?" Tags="&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13585" PostTypeId="2" ParentId="13584" CreationDate="2020-09-03T15:13:22.380" Score="3" Body="&lt;p&gt;&lt;code&gt;.get_counts()&lt;/code&gt; 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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(counts['0001'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sum(counts.values())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and from this print the probability:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(counts['0001'] / sum(counts.values()))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-09-03T15:13:22.380" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13586" PostTypeId="1" AcceptedAnswerId="13587" CreationDate="2020-09-03T15:19:02.403" Score="3" ViewCount="66" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi\in\mathrm T(\mathcal X,\mathcal Y)$&lt;/span&gt; be a quantum channel, &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathrm{Lin}(\mathcal X)\to\operatorname{Lin}(\mathcal Y)$&lt;/span&gt;.&#xA;We define its &lt;em&gt;Choi representation&lt;/em&gt; as the operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\in \mathrm{Lin}(\mathcal{Y})\otimes \mathrm{Lin}(\mathcal{X})$&lt;/span&gt; defined by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi) = (\Phi\otimes I) \,d\,\mathbb P_+= \sum_{a,b}\Phi(E_{a,b})\otimes E_{a,b},\tag1$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_+\equiv \lvert +\rangle\!\langle +|$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sqrt d|+\rangle=\sum_i |i,i\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$E_{a,b}\equiv |a\rangle\!\langle b|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One way to retrieve the map from the Choi, used for example in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous&lt;/a&gt;, Eq. (2.66), is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X) = \operatorname{Tr}_{\mathcal X}[J(\Phi)(I_{\mathcal Y}\otimes X^T)].\tag2$$&lt;/span&gt;&#xA;Verifying the equivalence between these two isn't too hard:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \operatorname{Tr}_{\mathcal X}[J(\Phi)(I_{\mathcal Y}\otimes X^T)]&#xA;  = \sum_{a,b} \operatorname{Tr}_{\mathcal X} [&#xA;    \Phi(E_{a,b})\otimes E_{a,b} X^T&#xA;  ]&#xA;  = \Phi(X).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;More generally, this gives us a way to associate to each bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; a map &lt;span class=&quot;math-container&quot;&gt;$\Phi_\rho$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$J(\Phi_\rho)=d\,\rho$&lt;/span&gt;, and if &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_{\mathcal Y}\rho=I/d$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\Phi_\rho$&lt;/span&gt; is trace-preserving (and thus CPTP).&lt;/p&gt;&#xA;&lt;p&gt;In (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807091&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horodecki, Horodecki, Horodecki 1998&lt;/a&gt;) the authors mention another way to associate a map to a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Writing its eigendecomposition as &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_i p_k \mathbb P_{\psi_k}$&lt;/span&gt;, and writing with &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; the operator whose vectorisation is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, &lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(\psi)\equiv |\psi\rangle$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle=(\psi_k\otimes I)\,\sqrt d |+\rangle$&lt;/span&gt;, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_k p_k (\psi_k \otimes I) \,d\,\mathbb P_+(\psi_k^\dagger\otimes I)&#xA;  = (\Phi_\rho\otimes I) \mathbb P_+,\tag3$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Phi_\rho(X) = d\sum_k p_k \psi_k X \psi_k^\dagger.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I presume (2) and (3) should be equivalent, provided &lt;span class=&quot;math-container&quot;&gt;$d \,\rho=J(\Phi)$&lt;/span&gt;. What's a good way to show this equivalence?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-01-31T20:50:46.933" LastActivityDate="2021-01-31T20:50:46.933" Title="Equivalence of two ways to recover a map from its Choi state" Tags="&lt;mathematics&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13587" PostTypeId="2" ParentId="13586" CreationDate="2020-09-03T15:19:02.403" Score="1" Body="&lt;p&gt;The goal is to start from a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and find the channel &lt;span class=&quot;math-container&quot;&gt;$\Phi_\rho$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$J(\Phi_\rho)=d\, \rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The goal is, given &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)$&lt;/span&gt;, to show that we can retrieve &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; via (3) rather than (2). In other words, that (2) is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X) = d\sum_k p_k \psi_k X \psi_k^\dagger,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; are the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)/d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\psi_k$&lt;/span&gt; the (unvectorised operators corresponding to the) eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)/d$&lt;/span&gt;.&#xA;We, therefore, wish to show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$d\sum_k p_k \psi_k X \psi_k^\dagger = \operatorname{Tr}_{\mathcal X}[J(\Phi)(I_{\mathcal Y}\otimes X^T)].$$&lt;/span&gt;&#xA;Writing &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=d \sum_k p_k \mathbb P_{\psi_k}$&lt;/span&gt;, we get from the RHS:&#xA;&lt;span class=&quot;math-container&quot;&gt;$d\sum_k p_k \operatorname{Tr}_{\mathcal X}[\mathbb P_{\psi_k}(I_{\mathcal Y}\otimes X^T)]$&lt;/span&gt;.&#xA;We therefore only need to show that, for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\psi_k X \psi_k^\dagger = \operatorname{Tr}_{\mathcal X}[\mathbb P_{\psi_k}(I_{\mathcal Y}\otimes X^T)].$$&lt;/span&gt;&#xA;This can be proven directly analysing the matrix components, or again applying the previous trick to write &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_{\psi_k}=(\psi_k\otimes I)\mathbb P_+(\psi_k^\dagger\otimes I)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-09-03T15:19:02.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13588" PostTypeId="2" ParentId="13579" CreationDate="2020-09-03T15:38:11.007" Score="1" Body="&lt;p&gt;As far as I know, you can only do this with the &lt;a href=&quot;https://pyquil-docs.rigetti.com/en/stable/apidocs/autogen/pyquil.reference_simulator.ReferenceDensitySimulator.html#pyquil.reference_simulator.ReferenceDensitySimulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;ReferenceDensitySimulator&lt;/a&gt;, which contains a &lt;code&gt;set_initial_state&lt;/code&gt; method. This is unfortunate because density matrix simulation is very costly.&lt;/p&gt;&#xA;&lt;p&gt;In your case:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from pyquil import Program&#xA;from pyquil.simulation import ReferenceDensitySimulator&#xA;from pyquil.pyqvm import PyQVM&#xA;from pyquil.gates import I&#xA;&#xA;state_ket = np.array([1/np.sqrt(3), np.sqrt(2/3)])&#xA;state_bra =  np.array([[1/np.sqrt(3)], [np.sqrt(2/3)]])&#xA;&#xA;rho1 = state_ket * state_bra&#xA;&#xA;prog = Program(I(0))&#xA;qam = PyQVM(n_qubits=1, quantum_simulator_type=ReferenceDensitySimulator)&#xA;&#xA;# must call reset() to change the current state of the density matrix&#xA;density_matrix = qam.wf_simulator.set_initial_state(rho1).reset()&#xA;qam.execute(prog)&#xA;np.testing.assert_array_equal(qam.wf_simulator.density, rho1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-09-03T15:38:11.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13589" PostTypeId="1" AcceptedAnswerId="13590" CreationDate="2020-09-03T18:14:06.033" Score="3" ViewCount="157" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\expterm}[0]{\frac{-iH(t_2 - t_1)}{\hbar}}&#xA;\newcommand{\exptermp}[0]{\frac{iH(t_2 - t_1)}{\hbar}}$&lt;/span&gt;Nielsen &amp;amp; Chuang (10th edition, page 82) states that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a fixed Hermitian operator known as the Hamiltonian. In exercise 2.54, we prove that if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are commuting Hermitian operators, then the following holds:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp(A)\exp(B)=\exp(A+B) \tag{1}\label{1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The goal is to prove&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\exp \left[ \expterm \right] \exp \left[ \exptermp \right] = I.\tag{2}\label{2}$$&lt;/span&gt;&#xA;&lt;em&gt;If&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\expterm$&lt;/span&gt; is Hermitian, then we can plug &lt;span class=&quot;math-container&quot;&gt;$A=\expterm$&lt;/span&gt; and its Hermitian conjugate &lt;span class=&quot;math-container&quot;&gt;$B = \exptermp$&lt;/span&gt; into \eqref{1} to prove \eqref{2}. However, I don't see why &lt;span class=&quot;math-container&quot;&gt;$\expterm$&lt;/span&gt; is necessarily Hermitian. Take &lt;span class=&quot;math-container&quot;&gt;$H=I$&lt;/span&gt; for example: &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian but &lt;span class=&quot;math-container&quot;&gt;$\expterm$&lt;/span&gt; is not, so we can't use \eqref{1}. Any thoughts?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastActivityDate="2020-09-04T07:58:07.537" Title="Nielsen &amp; Chuang Exercise 2.55: Prove that $\exp \left[ -\frac{iH(t_2 - t_1)}{\hbar} \right]$ is unitary" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13590" PostTypeId="2" ParentId="13589" CreationDate="2020-09-03T20:44:23.437" Score="6" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is Hermitian, then &lt;span class=&quot;math-container&quot;&gt;$iH$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; Hermitian, but rather &lt;a href=&quot;https://en.wikipedia.org/wiki/Skew-Hermitian_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;skew&lt;/em&gt;-Hermitian&lt;/a&gt;: &lt;span class=&quot;math-container&quot;&gt;$(iH)^\dagger = -i H^\dagger =-iH$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Still, the identity in (1) holds generally for commuting matrices, they don't have to be Hermitian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)!}&#xA;\\ = \sum_{n,m=0}^\infty \frac{A^n B^m}{n! m!} = e^A e^B,$$&lt;/span&gt;&#xA;where the commutativity was necessary to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Binomial_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Newton's formula&lt;/a&gt; in the second step, and in the penultimate step we changed the summation variables with &lt;span class=&quot;math-container&quot;&gt;$n=j, m=k-j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;More generally, &lt;span class=&quot;math-container&quot;&gt;$e^A$&lt;/span&gt; is unitary if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is skew-Hermitian, as &lt;span class=&quot;math-container&quot;&gt;$$(e^A)^\dagger e^A = e^{A^\dagger} e^A = e^{-A}e^A=I,$$&lt;/span&gt;&#xA;and similarly for &lt;span class=&quot;math-container&quot;&gt;$e^{A}(e^A)^\dagger=I$&lt;/span&gt;.&#xA;Vice-versa, for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; there is always a skew-Hermitian &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U=e^A$&lt;/span&gt;, see &lt;a href=&quot;https://math.stackexchange.com/q/2229659/173147&quot;&gt;this question on math.SE&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://math.stackexchange.com/a/3313476/173147&quot;&gt;this similar question on math.SE&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-09-04T07:58:07.537" LastActivityDate="2020-09-04T07:58:07.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13592" PostTypeId="1" CreationDate="2020-09-04T04:25:43.517" Score="2" ViewCount="47" Body="&lt;p&gt;I would like to know about the mathematical relations among T1, T2, frequency, readout error, and single-qubit error?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Md1oo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Md1oo.png&quot; alt=&quot;File Ibmq-16 melbourne&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This screenshot is from the ibmq-16 Melbourne excel data file.&lt;/p&gt;&#xA;" OwnerUserId="13138" LastEditorUserId="55" LastEditDate="2020-09-04T17:16:13.720" LastActivityDate="2021-04-22T23:04:10.390" Title="Need mathematical Calculation of input(T1,T2,f) and output(Readout Error)" Tags="&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13594" PostTypeId="2" ParentId="13581" CreationDate="2020-09-04T16:58:22.427" Score="1" Body="&lt;p&gt;There's a &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/issues/291&quot; rel=&quot;nofollow noreferrer&quot;&gt;feature request&lt;/a&gt; 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!&lt;/p&gt;&#xA;&lt;p&gt;In the meantime, though, it's actually really straightforward to implement the same unitary operation as &lt;code&gt;cirq.CZPowGate&lt;/code&gt; in Q#.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Math as Math;&#xA;&#xA;operation ApplyCZPow(t : Double, control : Qubit, target : Qubit) : Unit is Adj + Ctl {&#xA;    Controlled R1([control], (t * Math.PI(), target));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This uses the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;R1&lt;/code&gt; operation&lt;/a&gt; provided with the Microsoft.Quantum.Intrinsic namespace together with the &lt;a href=&quot;https://docs.microsoft.com/quantum/user-guide/using-qsharp/operations-functions#controlled-functor&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Controlled&lt;/code&gt; keyword&lt;/a&gt; to apply the same rotation as &lt;code&gt;cirq.CZPowGate&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To see how this works, note that as per the &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.CZPowGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq documentation for CZPowGate&lt;/a&gt;, that instruction is represented by the unitary matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{\text{CZPowGate}}(t) = \left(\begin{matrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i \pi t}&#xA;\end{matrix}\right).&#xA;$$&lt;/span&gt;&#xA;This is a special case of a controlled operation with a single control qubit, as it has the pattern&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda(U) = \left(\begin{matrix}&#xA; &amp;amp; 0 \\&#xA;0 &amp;amp; U&#xA;\end{matrix}\right) = |0\rangle\langle0| \otimes  + |1\rangle\langle1| \otimes U&#xA;$$&lt;/span&gt;&#xA;for some unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. In particular, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in this case represents a rotation that leaves the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state alone but that applies a phase to the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state; precisely the action of the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.r1&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;R1&lt;/code&gt; operation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In Q#, the &lt;code&gt;Controlled&lt;/code&gt; keyword can be used to get the controlled version of any controllable operation (that is, an operation with &lt;code&gt;is Ctl&lt;/code&gt; in its signature). Each &lt;code&gt;Controlled&lt;/code&gt; 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, &lt;code&gt;CNOT(control, target)&lt;/code&gt; in Q# is shorthand for &lt;code&gt;Controlled X([control], target)&lt;/code&gt;.&#xA;Similarly, a Toffoli in Q# can be written as &lt;code&gt;Controlled X([control1, control2], target)&lt;/code&gt; and the Fredkin operation can be written as &lt;code&gt;Controlled SWAP([control], (target1, target2))&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Using the same pattern here works since &lt;code&gt;R1&lt;/code&gt; is a controllable operation. We can check  that we get what we expect by using the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpoperation&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Microsoft.Quantum.Diagnostics.DumpOperation&lt;/code&gt;  operation&lt;/a&gt; to check the unitary representation of our new &lt;code&gt;ApplyCZPow&lt;/code&gt; operation (&lt;a href=&quot;https://mybinder.org/v2/gist/cgranade/b8cefb19b63154f343c790c035a8e161/master&quot; rel=&quot;nofollow noreferrer&quot;&gt;run online without installing&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Diagnostics as Diag;&#xA;&#xA;operation DumpApplyCZPow(t : Double) : Unit {&#xA;    Diag.DumpOperation(2, ApplyToFirstTwoQubitsCA(ApplyCZPow(t, _, _), _));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BF9U9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BF9U9.png&quot; alt=&quot;Using %simulate to run DumpCZPow&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-09-04T16:58:22.427" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13595" PostTypeId="2" ParentId="13578" CreationDate="2020-09-04T17:25:25.183" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I want to know what do they mean by local minimum?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In general any optimization problem's goal is to  either maximize or minimize the objective function.&lt;br /&gt;&#xA;The local minimums are the candidate solutions to your optimization problem. Same as in the blog that you've mentioned!&lt;/p&gt;&#xA;&lt;p&gt;In general, QAOA (Quantum Approximate Optimization Algorithm) tries to solve same optimization problems but with a different approach than classical algorithms. &lt;br /&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is &lt;a href=&quot;https://www.youtube.com/watch?v=zvfkXjzzYOo&amp;amp;list=PLPvKnT7dgEsvVQwGgrlUVXBa2J6PAW8a4&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9318" LastActivityDate="2020-09-04T17:25:25.183" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13596" PostTypeId="1" AcceptedAnswerId="13602" CreationDate="2020-09-04T18:01:09.667" Score="2" ViewCount="85" Body="&lt;p&gt;I am just starting to get up to speed with quantum computing via the Quiskit learning path: &lt;a href=&quot;https://qiskit.org/learn/intro-qc-qh/?utm_source=Twitter&amp;amp;utm_medium=Social&amp;amp;utm_campaign=Learn-Intro&quot; rel=&quot;nofollow noreferrer&quot;&gt;online tutorial&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here they explain the Dirac notation and use it to describe quantum states as elements in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; (square could be for the initial lesson but my question holds in &lt;em&gt;n&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;i.e a quantum state &lt;span class=&quot;math-container&quot;&gt;$| a \rangle = \begin{pmatrix}a_1  \\ a_2  \end{pmatrix}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a_1, a_2 \in \mathbb{C}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Shortly after this the concept of the &lt;em&gt;basis&lt;/em&gt; is introduced, with the &lt;em&gt;x&lt;/em&gt;, &lt;em&gt;y&lt;/em&gt; and &lt;em&gt;z&lt;/em&gt; examples given. Their orthonormality is stressed. In all three cases this 'basis' is two dimensional.&lt;/p&gt;&#xA;&lt;p&gt;So as a concrete example &lt;span class=&quot;math-container&quot;&gt;$ \{| 0 \rangle ,  | 1 \rangle  \}$&lt;/span&gt; is given as an orthonormal basis for the space to describe and measure quantum states.&lt;/p&gt;&#xA;&lt;p&gt;Clearly this pair of basis is not an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We have touched on the &lt;strong&gt;Bloch Sphere&lt;/strong&gt; which &lt;em&gt;is&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13144" LastEditorUserId="55" LastEditDate="2020-09-09T12:33:58.837" LastActivityDate="2020-09-09T12:33:58.837" Title="when we specify quantum states in $\mathbb C^2$, why do we only have $2$ basis states?" Tags="&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13598" PostTypeId="1" CreationDate="2020-09-04T19:01:43.567" Score="5" ViewCount="96" Body="&lt;p&gt;The max-relative entropy between two states is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho\leq \sigma$&lt;/span&gt; should be read as &lt;span class=&quot;math-container&quot;&gt;$\sigma - \rho$&lt;/span&gt; is positive semidefinite. There is also a smoothed version of this quantity and this is given by taking the infimum of &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho\|\sigma)$&lt;/span&gt; over all states &lt;span class=&quot;math-container&quot;&gt;$\bar{\rho}$&lt;/span&gt; which are within an &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; ball of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; according to some metric. For example, one may require that the trace distance between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bar{\rho}$&lt;/span&gt; is at most &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; and define a ball this way. So we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D^{\varepsilon}_{\max}(\rho\|\sigma) = \inf\limits_{\bar{\rho}\in\mathcal{B}^{\varepsilon}(\rho)}D_{\max}(\bar{\rho}\|\sigma)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now consider the case where &lt;span class=&quot;math-container&quot;&gt;$\rho = \rho_{AB}$&lt;/span&gt; (some bipartite state) and &lt;span class=&quot;math-container&quot;&gt;$\sigma = \rho_A\otimes\rho_B$&lt;/span&gt;. A quantity known as the max-information that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; has about &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I_{\max}(A:B)_\rho =  D_{\max}(\rho_{AB}||\rho_A\otimes\rho_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that this is not the only definition of the max-information (there are several as shown &lt;a href=&quot;https://arxiv.org/pdf/1308.5884.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; but they are all equivalent after smoothing). The smoothed max-information for our definition of the max-information is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In contrast, the smoothed max-relative entropy is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are the two quantities &lt;span class=&quot;math-container&quot;&gt;$D^{\varepsilon}_{\max}(\rho_{AB}\|\rho_A\otimes\rho_B)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I^{\varepsilon}_{\max}(A:B)_{\rho_{AB}}$&lt;/span&gt; close to each other (e.g. the difference is some function of &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;) such that they are qualitatively equivalent?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-09-08T05:49:46.760" LastActivityDate="2020-09-08T05:49:46.760" Title="Connection between smooth max-relative entropy and smooth max-information" Tags="&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13601" PostTypeId="2" ParentId="13596" CreationDate="2020-09-05T06:47:50.490" Score="3" Body="&lt;p&gt;Any complex vector &lt;span class=&quot;math-container&quot;&gt;$v \in  \mathbb{C}^n$&lt;/span&gt; can be written as a linear combination&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;v = \sum_{i=1}^n \alpha_ib_i,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$b_i$&lt;/span&gt; are basis vectors and &lt;span class=&quot;math-container&quot;&gt;$\alpha_i \in \mathbb{C}$&lt;/span&gt; are coefficients. Since real numbers are subset of complex ones and &lt;span class=&quot;math-container&quot;&gt;$\alpha_i$&lt;/span&gt; are complex numbers, basis vectors can be real.&lt;/p&gt;&#xA;&lt;p&gt;In your particular example, it is not problem to use basis composed of real vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; since complex amplitudes are &amp;quot;hidden&amp;quot; in complex coefficients of the linear combination.&lt;/p&gt;&#xA;&lt;p&gt;Regarding ortogonality, a dot product on space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; for vectors &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;, both from that space, is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;v \cdot w = \sum_{i=1}^n v_i w_i^*,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$w_i^*$&lt;/span&gt; is complex conjugated number to &lt;span class=&quot;math-container&quot;&gt;$w_i$&lt;/span&gt;. Since both members of vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are real, &lt;span class=&quot;math-container&quot;&gt;$w_i^*=w_i$&lt;/span&gt; and hence these vectors are orthogonal in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the Bloch sphere. In the end you need only two parameters - angles &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; since you have only two degrees of freedom. This is given by constraints imposed on qubits:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;lenght of a vector describing qubit is 1&lt;/li&gt;&#xA;&lt;li&gt;global phase can be neglected as two qubits differing in the global phase only are physically indistinguisable&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-05T06:47:50.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13602" PostTypeId="2" ParentId="13596" CreationDate="2020-09-05T06:52:34.930" Score="5" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Clearly this pair of basis is not an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt;...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\{\lvert0\rangle,\lvert1\rangle\}$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt; is a 2-dimensional &lt;em&gt;complex&lt;/em&gt; vector space, which means that every element of the space is essentially a vector of 2 complex numbers.&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\lvert0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lvert1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt; are both vectors in this space because 0 and 1 are also complex numbers. The vectors are also orthogonal:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\langle0\rvert1\rangle &amp;amp; = \begin{pmatrix} 1\:\:0 \end{pmatrix}\begin{pmatrix} 0\\1 \end{pmatrix}\\&#xA;&amp;amp; = 1(0) + 0(1)\\&#xA;&amp;amp; = 0 &#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;br /&gt;&#xA;Further, the &lt;a href=&quot;https://qiskit.org/textbook/ch-states/representing-qubit-states.html##3-Global-Phase&quot; rel=&quot;noreferrer&quot;&gt;&lt;em&gt;global phase&lt;/em&gt;&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; which specify a location on the surface of the Bloch Sphere.&lt;/p&gt;&#xA;&lt;p&gt;I hope that answers your question...&lt;/p&gt;&#xA;" OwnerUserId="8955" LastActivityDate="2020-09-05T06:52:34.930" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13604" PostTypeId="1" AcceptedAnswerId="13606" CreationDate="2020-09-05T14:36:45.233" Score="5" ViewCount="171" Body="&lt;p&gt;Suppose there is some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. It is well known fact that, given some orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$U = \{|u_i\rangle\}$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$p_i = \langle u_i| \rho |u_i \rangle$&lt;/span&gt; (that is, measuring &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; produce the result &lt;span class=&quot;math-container&quot;&gt;$u_i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$P = (p_1,...)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$H(P) \geq S(\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;I would be glad for some help.&lt;/p&gt;&#xA;" OwnerUserId="13152" LastEditorUserId="55" LastEditDate="2020-09-05T15:10:29.953" LastActivityDate="2020-09-20T22:37:57.557" Title="Prove that Shannon and von Neumann entropies satisfy $H(P)\ge S(\rho)$ with $P$ diagonal of $\rho$" Tags="&lt;measurement&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13605" PostTypeId="1" AcceptedAnswerId="13611" CreationDate="2020-09-05T15:47:21.003" Score="4" ViewCount="1363" Body="&lt;p&gt;I am new to qiskit and I have to simulate a quantum circuit. I read this documentation &lt;a href=&quot;https://qiskit.org/textbook/ch-states/single-qubit-gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-states/single-qubit-gates.html&lt;/a&gt; where it is left as an exercise to the reader to write a function to measure in the &lt;span class=&quot;math-container&quot;&gt;$|+i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle$&lt;/span&gt; or the y-basis. I want to know if I've done it correctly or not.&lt;/p&gt;&#xA;&lt;p&gt;I need to measure a state in the y-basis after preparing it in an equal superposition the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states. To do this, I first applied the Hadamard gate which does the first part and takes the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state to the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. Now comes the measurement part. To do this I applied an &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; and then the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate again.&lt;/p&gt;&#xA;&lt;p&gt;Now I simply measure the state&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def Y_measurement(qc,qubit,cbit):&#xA;    qc.sdg(qubit)&#xA;    qc.h(qubit)&#xA;    qc.measure(qubit,cbit)&#xA;    return qc&#xA;&#xA;circuit = QuantumCircuit(1,1)&#xA;circuit.h(0)&#xA;circuit.barrier()&#xA;&#xA;&#xA;Y_measurement(circuit, 0, 0)&#xA;&#xA;circuit.draw(output='mpl') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xrfQn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xrfQn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="7706" LastEditorUserId="7706" LastEditDate="2020-09-06T09:55:38.507" LastActivityDate="2020-09-07T06:45:44.777" Title="How to measure in another basis" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13606" PostTypeId="2" ParentId="13604" CreationDate="2020-09-05T15:48:53.173" Score="4" Body="&lt;p&gt;This can be seen through &amp;quot;twirling&amp;quot; with a bunch of unitaries.&lt;/p&gt;&#xA;&lt;p&gt;Call your density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; be a unitary with &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; on the diagonal, and zeros everywhere else when expressed in your basis.&#xA;Consider all &lt;span class=&quot;math-container&quot;&gt;$2^d$&lt;/span&gt; such unitaries where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the dimension of your density matrix.&#xA;I leave it to you to show that &lt;span class=&quot;math-container&quot;&gt;$\rho_D = \frac{1}{2^d}\sum\limits_i U_i\rho U^\dagger_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho_D$&lt;/span&gt; is the diagonal matrix with entries &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Using the concavity of entropy and the unitary invariance of entropy, we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5669" LastEditorUserId="13152" LastEditDate="2020-09-06T16:55:37.860" LastActivityDate="2020-09-06T16:55:37.860" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13607" PostTypeId="1" CreationDate="2020-09-06T00:18:31.727" Score="6" ViewCount="113" Body="&lt;p&gt;Denote the Haar measure on the unitary group &lt;span class=&quot;math-container&quot;&gt;$U(\mathcal X)$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt;. Does this equation hold (assuming the integral exists):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\int d\eta(U) f(U) = \int d\eta(U) f(U^\dagger)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Intuitively this makes sense because choosing a random &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; seems to be the same as choosing a random &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt;, but I'm not sure how to prove this.&lt;/p&gt;&#xA;" OwnerUserId="13157" LastEditorUserId="13157" LastEditDate="2020-09-07T22:47:48.020" LastActivityDate="2020-09-07T22:47:48.020" Title="Is the Haar measure invariant under conjugation?" Tags="&lt;mathematics&gt;&lt;unitarity&gt;&lt;haar-distribution&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13608" PostTypeId="1" CreationDate="2020-09-06T01:52:41.373" Score="6" ViewCount="225" Body="&lt;p&gt;Microsoft has its own agenda regarding quantum computer - it is topological quantum computer being invented by the team lead by Michael Freedman &lt;a href=&quot;https://www.microsoft.com/en-us/research/project/topological-quantum-computing/&quot; rel=&quot;noreferrer&quot;&gt;https://www.microsoft.com/en-us/research/project/topological-quantum-computing/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;While this idea is very efficient implementation, it still required experimental proof of anyons. At last such proof has arrived, see &lt;a href=&quot;https://phys.org/news/2020-09-evidence-quantum-world-stranger-thought.html&quot; rel=&quot;noreferrer&quot;&gt;New evidence that the quantum world is even stranger than we thought&lt;/a&gt; (original publication in Nature Physics, article &lt;a href=&quot;https://www.nature.com/articles/s41567-020-1019-1&quot; rel=&quot;noreferrer&quot;&gt;Direct observation of anyonic braiding statistics&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is this:&lt;/strong&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="1326" LastEditorUserId="9006" LastEditDate="2020-09-06T06:22:42.483" LastActivityDate="2020-12-20T14:23:40.503" Title="Does this experimental discovery of anyons enables the topological quantum computer (e.g. Microsoft) to become a reality?" Tags="&lt;physical-realization&gt;&lt;topological-quantum-computing&gt;&lt;anyons&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13609" PostTypeId="1" CreationDate="2020-09-06T06:05:53.510" Score="3" ViewCount="34" Body="&lt;p&gt;Let's say I am given access to a magical box that lets me apply a projector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \langle\psi|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a quantum state. I do not know anything about &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;: just that I am given this magical box. Can I prepare &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, in a polynomial amount of time, using it?&lt;/p&gt;&#xA;&lt;p&gt;One way to do it is: start with any arbitrary efficiently preparable quantum state, apply the projector. If the outcome is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, you have &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. There is no way of knowing whether or not it would be beforehand, as we know nothing about &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Hence, the probability of succeeding in successfully projecting onto &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be exponentially small, and it will take us an exponentially large time to prepare the state.&lt;/p&gt;&#xA;&lt;p&gt;Also, is the opposite true? If we can efficiently prepare a state, can we efficiently project onto that state?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-09-06T09:44:33.010" LastActivityDate="2020-09-06T09:44:33.010" Title="Preparing a state given access to projector" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13610" PostTypeId="1" CreationDate="2020-09-06T06:11:31.773" Score="2" ViewCount="129" Body="&lt;p&gt;I've recently tried to run &lt;a href=&quot;https://qiskit.org/documentation/tutorials/finance/01_portfolio_optimization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this sample from Qiskit&lt;/a&gt; (Portfolio Optimization)&lt;/p&gt;&#xA;&lt;p&gt;I was able to change RandomDataProvider to YahooDataProvider and able to run it on real stock prices.&lt;/p&gt;&#xA;&lt;p&gt;However, there is one peculiar challenge I'm facing - I'm not sure if it is my lack of understanding. At this particular code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;budget = num_assets // 2  # set budget&#xA;penalty = num_assets      # set parameter to scale the budget penalty term&#xA;qubitOp, offset = portfolio.get_operator(mu, sigma, q, budget, penalty)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;No matter what budget or penalty I set this to, I always receive portfolio with about half of the total number of assets.&#xA;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]&lt;/p&gt;&#xA;&lt;p&gt;If I change my budget to&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;budget = num_assets // 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and my total assets are 5, then I expect to see only 1 asset in the resulting portfolio. However, I see 2&lt;/p&gt;&#xA;&lt;p&gt;If I increase my num_assets to 10 and make&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;budget = num_assets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I still get a portfolio of 5 or 6 stocks (close to half of 10) and not a portfolio of 10.&lt;/p&gt;&#xA;&lt;p&gt;Note - I'm running on qasm_simulator&lt;/p&gt;&#xA;&lt;p&gt;Is there a gap in my understanding? What role do these variables - budget and penalty - play while building the portfolio?&lt;/p&gt;&#xA;" OwnerUserId="13134" LastEditorUserId="55" LastEditDate="2020-09-06T09:42:28.900" LastActivityDate="2020-09-06T09:42:28.900" Title="Qiskit sample - Portfolio optimization" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;optimization&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13611" PostTypeId="2" ParentId="13605" CreationDate="2020-09-06T06:15:15.393" Score="3" Body="&lt;p&gt;Yes, your solution is correct.&lt;/p&gt;&#xA;&lt;p&gt;Please find here circuits for measurement in &lt;em&gt;z&lt;/em&gt; (computational), &lt;em&gt;y&lt;/em&gt; (circular) and &lt;em&gt;x&lt;/em&gt; (Hadamard) bases:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bil8h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bil8h.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithm Implementations for Beginners&lt;/a&gt;, pg. 68.&lt;/p&gt;&#xA;&lt;p&gt;Note that the blue Hadamard gate is used for preparing state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; which is then measured. Pink gates are those needed for measuring in different basis. So, measurement in &lt;em&gt;z&lt;/em&gt; basis needs no additional gate (left circuit), measuring in &lt;em&gt;y&lt;/em&gt; basis needs &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; additional gates (middle circuit) and measuring in &lt;em&gt;x&lt;/em&gt; basis needs additional &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate (right circuit).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-09-07T06:45:44.777" LastActivityDate="2020-09-07T06:45:44.777" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13612" PostTypeId="2" ParentId="13610" CreationDate="2020-09-06T06:47:50.190" Score="2" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-06T06:47:50.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13613" PostTypeId="2" ParentId="13604" CreationDate="2020-09-06T09:36:48.167" Score="0" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\braket}[2]{\langle #1 | #2\rangle}\{\ket{u_k}\}_k$&lt;/span&gt; be some orthonormal basis for the space, and define &lt;span class=&quot;math-container&quot;&gt;$p_k\equiv \langle u_k|\rho| u_k\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{\boldsymbol{#1}}\bs p\in\mathbb R^n$&lt;/span&gt; denote the corresponding vector. Write the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_\ell \lambda_\ell |\lambda_\ell\rangle\!\langle\lambda_\ell\rvert,&#xA;\qquad \lambda_\ell\ge0, \quad \sum_\ell \lambda_\ell=1.$$&lt;/span&gt;&#xA;From these, we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$M_{k,\ell}\equiv \lvert \braket{u_k}{\lambda_\ell}\rvert^2$&lt;/span&gt; is easily seen to be a &lt;a href=&quot;https://en.wikipedia.org/wiki/Doubly_stochastic_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;bistochastic matrix&lt;/a&gt;, due to the completeness of both the bases &lt;span class=&quot;math-container&quot;&gt;$\{\ket{u_k}\}_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\ket{\lambda_\ell}\}_\ell$&lt;/span&gt;.&#xA;See also &lt;a href=&quot;https://en.wikipedia.org/wiki/Schur%E2%80%93Horn_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schur-Horn's lemma&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We therefore proved that &lt;span class=&quot;math-container&quot;&gt;$\bs p=M\bs\lambda$&lt;/span&gt; for some bistochastic matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&#xA;This is equivalent to &lt;span class=&quot;math-container&quot;&gt;$\bs p\preceq \bs\lambda$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\preceq$&lt;/span&gt; here denotes the &lt;a href=&quot;https://en.wikipedia.org/wiki/Majorization&quot; rel=&quot;nofollow noreferrer&quot;&gt;majorization preorder&lt;/a&gt;.&#xA;This, in turn, implies that &lt;span class=&quot;math-container&quot;&gt;$H(\bs p)\ge H(\bs \lambda)$&lt;/span&gt; (see &lt;em&gt;e.g.&lt;/em&gt; &lt;a href=&quot;https://math.stackexchange.com/a/3775069/173147&quot;&gt;this related answer on math.SE&lt;/a&gt;). Because by definition of the von Neumann entropy &lt;span class=&quot;math-container&quot;&gt;$H(\bs\lambda)=S(\rho)$&lt;/span&gt;, we reach the conclusion.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-09-20T22:37:57.557" LastActivityDate="2020-09-20T22:37:57.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13614" PostTypeId="2" ParentId="13608" CreationDate="2020-09-06T11:12:38.597" Score="3" Body="&lt;p&gt;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 &lt;em&gt;proof&lt;/em&gt; but rather &lt;em&gt;evidence&lt;/em&gt; - that's why I also used the quotation marks above.&lt;/p&gt;&#xA;&lt;p&gt;Back in &lt;a href=&quot;https://science.sciencemag.org/content/336/6084/1003&quot; rel=&quot;nofollow noreferrer&quot;&gt;2012&lt;/a&gt; there supposedly was found the first experimental evidence of Majorana bound states by an observation of the &lt;em&gt;zero bias peak&lt;/em&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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) &lt;a href=&quot;https://qutech.nl/expression-of-concern-about-quantized-majorana-conductance-publication/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuTech voiced concerns&lt;/a&gt; about their own results.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Of course, something being shown in the lab does not mean it is &lt;em&gt;at all&lt;/em&gt; feasible - don't gross over these technical challenges, they will prove at least as though I presume.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-12-20T14:23:40.503" LastActivityDate="2020-12-20T14:23:40.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13615" PostTypeId="1" AcceptedAnswerId="13631" CreationDate="2020-09-06T17:16:53.220" Score="0" ViewCount="62" Body="&lt;p&gt;I'm trying to visualize a simple circuit in Qiskit. A single gate &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is applied to the single-qubit register. The expected state is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Y |0\rangle &#xA;= \begin{bmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix}&#xA;= \begin{bmatrix} 0 \\ i \end{bmatrix}&#xA;= i |1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then I visualize the final state with &lt;code&gt;plot_state_qsphere&lt;/code&gt; function (&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.visualization.plot_state_qsphere.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;). Since the coefficient of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; I'm expecting phase &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$i = e^{i \pi/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.tools.visualization import plot_state_qsphere&#xA;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'}&#xA;circuit = QuantumCircuit(1)&#xA;circuit.y(0)&#xA;statevector = execute(circuit, backend=Aer.get_backend('statevector_simulator')).result().get_statevector()&#xA;print(statevector) # [0.-0.j 0.+1.j]&#xA;plot_state_qsphere(statevector)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this representation, &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; phase corresponds to green color. However, I visualize the red color (&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; phase). Is it a known bug? Am I missing something?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yvXTJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yvXTJ.png&quot; alt=&quot;Jupyter notebook with phase bug shown&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="55" LastEditDate="2020-09-06T17:32:52.037" LastActivityDate="2020-09-07T14:25:50.277" Title="Qiskit plot_state_qsphere phase error" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13616" PostTypeId="1" CreationDate="2020-09-06T22:17:28.430" Score="1" ViewCount="33" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12302" LastActivityDate="2020-09-07T08:20:01.633" Title="Alternative Grover's Diffuse Operator" Tags="&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-09-11T15:11:04.500" ContentLicense="CC BY-SA 4.0" />
  <row Id="13617" PostTypeId="1" AcceptedAnswerId="13620" CreationDate="2020-09-07T04:56:59.330" Score="-1" ViewCount="81" Body="&lt;p&gt;I wonder what is a Qiskit stabilizer and why we need it. Also I want to know the difference between stabilizer and extended stabilizer.&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="9006" LastEditDate="2020-09-07T06:48:52.707" LastActivityDate="2020-09-07T06:59:57.480" Title="What is a Qiskit stabilizer" Tags="&lt;qiskit&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13618" PostTypeId="1" CreationDate="2020-09-07T06:49:26.970" Score="2" ViewCount="39" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="45" LastEditDate="2020-10-02T05:35:21.423" LastActivityDate="2020-10-02T05:35:21.423" Title="Do I need to download Qiskit from IBM Quantum Experience?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13619" PostTypeId="2" ParentId="13618" CreationDate="2020-09-07T06:58:42.943" Score="4" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w2p2x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w2p2x.png&quot; alt=&quot;Quantum Lab&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;After that, click on New notebook button  and here you can write your code in Qiskit and run it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vEGbd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vEGbd.png&quot; alt=&quot;Quantum Lab 2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Quantum Lab is based on Jupyter notebooks and interactive Python.&lt;/p&gt;&#xA;&lt;p&gt;Also, you can use the Qiskit tutorial which is a part of the Quantum Lab.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-07T06:58:42.943" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13620" PostTypeId="2" ParentId="13617" CreationDate="2020-09-07T06:59:57.480" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-09-07T06:59:57.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13621" PostTypeId="2" ParentId="13607" CreationDate="2020-09-07T08:00:40.337" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, there is a unique left-invariant (Borel) measure &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;, up to a positive constant. Left-invariance means that &lt;span class=&quot;math-container&quot;&gt;$\mu(g A)=\mu(A)$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt; and (measurable) set &lt;span class=&quot;math-container&quot;&gt;$A\subset G$&lt;/span&gt;. This is the (left-) Haar measure on &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The same argument yields a unique right-invariant measure, up to a constant.&#xA;Note that we can always turn a left-invariant Haar measure into a right-invariant Haar measure by taking the inverse: &lt;span class=&quot;math-container&quot;&gt;$\tilde\mu(A) := \mu(A^{-1})$&lt;/span&gt;. That is exactly what you are interested in.&lt;/p&gt;&#xA;&lt;p&gt;For certain groups, the left- and right-invariant Haar measures coincide (unimodular groups) and the unitary group &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt; is such a group. For these groups, your statement is correct. The proof is straightforward:&lt;/p&gt;&#xA;&lt;p&gt;Unimodularity implies that the &amp;quot;inverse&amp;quot; of the normalised Haar measure &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt; is itself a left- and right-invariant Haar measure on &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;. By uniqueness, &lt;span class=&quot;math-container&quot;&gt;$\tilde\mu$&lt;/span&gt; can only differ by a positive constant from &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt;. However, it is clear that both measures are normalised, thus &lt;span class=&quot;math-container&quot;&gt;$\tilde\mu = \mu$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2020-09-07T08:00:40.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13622" PostTypeId="2" ParentId="13616" CreationDate="2020-09-07T08:20:01.633" Score="0" Body="&lt;p&gt;Here is the decomposition of Grover's diffusion algorithm into simple gates : &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/13313/8746&quot;&gt;How can you decompose Grover&amp;#39;s diffusion operator into gates?&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, when you want to increase the amplitude of states, you should look into amplitude amplification. You could start looking at :  &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Amplitude_amplification&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;wikipedia&quot;&gt;wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, you will always require a Hermitian Projector operator or an oracle function.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-09-07T08:20:01.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13623" PostTypeId="1" AcceptedAnswerId="13625" CreationDate="2020-09-07T09:06:33.933" Score="0" ViewCount="105" Body="&lt;p&gt;If, for some &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, I have the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{y\in\{0,1\}^n} (-1)^{xy}|y\rangle,$$&lt;/span&gt;&#xA;and I would like to apply to that the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Hadamard transform, with the aim of calculating the final state.&lt;/p&gt;&#xA;&lt;p&gt;I understand I can continue like following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{y\in\{0,1\}^n}\sum_{j\in\{0,1\}^n}(-1)^{xy}(-1)^{jy} |j\rangle&#xA;= \sum_{y\in\{0,1\}^n}\sum_{j\in\{0,1\}^n}(-1)^{y(x+j)}|j\rangle, $$&lt;/span&gt;&#xA;but what cancels out here and why?&lt;/p&gt;&#xA;" OwnerUserId="13130" LastEditorUserId="23" LastEditDate="2020-09-11T15:33:16.483" LastActivityDate="2020-09-11T15:33:16.483" Title="What is the output of applying the Hadamard matrix to $\sum_{y\in\{0,1\}^n} (-1)^{xy}|y\rangle$?" Tags="&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13624" PostTypeId="2" ParentId="13604" CreationDate="2020-09-07T09:41:26.280" Score="2" Body="&lt;p&gt;I will expand on my comment as an answer because it is not as immediate as I initially thought it was. Let &lt;span class=&quot;math-container&quot;&gt;$D(\rho \| \sigma ) := \mathrm{Tr}[\rho( \log \rho - \log \sigma)]$&lt;/span&gt; be the relative entropy where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a state and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is a positive semidefinite operator. We can write the von Neumann entropy of a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in terms of the relative entropy,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho) = -D(\rho \| \mathbb{1}).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the relative entropy satisfies something known as the &lt;em&gt;data processing inequality&lt;/em&gt;) DPI which states that for any CPTP map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D(\rho  \| \sigma) \geq D(\mathcal{N}(\rho) \| \mathcal{N}(\sigma)). &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us take the CPTP map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}(\rho) = \sum_i |i \rangle \langle i | \rho | i \rangle \langle i |$&lt;/span&gt; which is defined by the measurement in your question. This map when applied to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; prepares the state &lt;span class=&quot;math-container&quot;&gt;$ \sum_i p(i) | i \rangle \langle i |$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$p(i)$&lt;/span&gt; is the probability of obtaining outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; when measuring the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Now by the above we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;S(\rho) &amp;amp;= -D(\rho \| \mathbb{1}) \\&#xA;&amp;amp;\leq -D(\mathcal{M}(\rho) \| \mathcal{M}( \mathbb{1})) \\&#xA;&amp;amp;= -D(\mathcal{M}(\rho) \|  \mathbb{1}) \\&#xA;&amp;amp;= S(\mathcal{M}(\rho)) \\&#xA;&amp;amp;= H(p).&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-09-07T09:41:26.280" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13625" PostTypeId="2" ParentId="13623" CreationDate="2020-09-07T09:59:28.937" Score="2" Body="&lt;p&gt;Use the identity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{y\in\{0,1\}^n} (-1)^{y\cdot z} = 2^n \delta_{z,0}&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$z=x+j$&lt;/span&gt;. This identity is based on the fact that &amp;quot;summing &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-th roots of unity gives zero&amp;quot; if &lt;span class=&quot;math-container&quot;&gt;$d&amp;gt;1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then you see that the result of applying the Hadamard gate twice is indeed the input state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{y\in\{0,1\}^n} \sum_{j\in\{0,1\}^n} (-1)^{y\cdot (x+j)} |j\rangle = 2^n |x\rangle&#xA;$$&lt;/span&gt;&#xA;Note that usually the Hadamard gate is normalised by &lt;span class=&quot;math-container&quot;&gt;$2^{-n/2}$&lt;/span&gt; for it to be unitary.&lt;/p&gt;&#xA;&lt;p&gt;Remark: In higher-dimensional systems, &lt;span class=&quot;math-container&quot;&gt;$H\neq H^{-1}$&lt;/span&gt;, which you can see above since the identity would give you &lt;span class=&quot;math-container&quot;&gt;$j=-x$&lt;/span&gt; which is only equal to &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2=\{0,1\}$&lt;/span&gt;. There, the inverse has an additional minus sign in the exponent (well, and replace &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i/d}$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;EDIT: I was asked to elaborate on the sum of roots of unity. Let's show the following&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{y\in\mathbb{Z}_d^n} \omega^{y\cdot z} = d^n \delta_{z,0},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$d&amp;gt;1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; is primitive &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-th root of unity, e.g. &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2\pi i/d}$&lt;/span&gt;. Above, we have &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;. We have the following identity for the sum of all primitive &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-th roots:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{k=0}^{d-1} \omega^k = 0.&#xA;$$&lt;/span&gt;&#xA;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. &lt;a href=&quot;https://en.wikipedia.org/wiki/Root_of_unity&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiki&lt;/a&gt;).&#xA;Next, we have to count how many times we get each root of unity in the second-to-last equation. If &lt;span class=&quot;math-container&quot;&gt;$z\neq 0$&lt;/span&gt;, there are &lt;span class=&quot;math-container&quot;&gt;$d^{n-1}$&lt;/span&gt; possible solutions &lt;span class=&quot;math-container&quot;&gt;$y\in\mathbb{Z}_d^n$&lt;/span&gt; to each of the linear systems &lt;span class=&quot;math-container&quot;&gt;$y\cdot z = k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k\in\mathbb{Z}_d$&lt;/span&gt;. Clearly, the solution spaces are mutally disjoint and their union is &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_d^n$&lt;/span&gt;. Thus, any primitive root appears exactly &lt;span class=&quot;math-container&quot;&gt;$d^{n-1}$&lt;/span&gt; times, and the sum is &lt;span class=&quot;math-container&quot;&gt;$d^{n-1} \sum_{k=0}^{d-1} \omega^k = 0$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$z=0$&lt;/span&gt;, however, any term is identically &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the result is &lt;span class=&quot;math-container&quot;&gt;$d^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;PS: BTW, the matrix representation of the Hadamard gate is just the discrete Fourier transform; the math is the same.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-09-08T12:15:10.777" LastActivityDate="2020-09-08T12:15:10.777" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13626" PostTypeId="1" AcceptedAnswerId="13640" CreationDate="2020-09-07T10:00:06.657" Score="0" ViewCount="46" Body="&lt;p&gt;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) ?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="55" LastEditDate="2020-09-08T05:53:42.093" LastActivityDate="2020-09-08T05:53:42.093" Title="Run circuit N times in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13629" PostTypeId="1" AcceptedAnswerId="13630" CreationDate="2020-09-07T13:24:19.980" Score="13" ViewCount="1579" Body="&lt;p&gt;I wonder what are &lt;em&gt;magic states&lt;/em&gt;, and a &lt;em&gt;magic state gadget&lt;/em&gt;. While I'm reading a paper, these terms frequently appear.&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="2293" LastEditDate="2021-05-28T18:05:12.920" LastActivityDate="2021-05-28T18:05:12.920" Title="What are magic states?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;error-correction&gt;&lt;universal-gates&gt;&lt;fault-tolerance&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13630" PostTypeId="2" ParentId="13629" CreationDate="2020-09-07T14:13:07.390" Score="15" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Magic_state_distillation#Magic_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;Magic states&lt;/a&gt; are certain states that have very nice properties with respect to fault-tolerant quantum computation.&lt;/p&gt;&#xA;&lt;p&gt;In the vast landscape of quantum gates, there is a crude but useful distinction to be made between &lt;a href=&quot;https://en.wikipedia.org/wiki/Clifford_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;Clifford gates&lt;/a&gt; and all other gates (also referred to as the inspired &lt;em&gt;non-Clifford gates&lt;/em&gt;). The set of Clifford gates is in technical terms the &lt;a href=&quot;https://en.wikipedia.org/wiki/Centralizer_and_normalizer#Group_and_semigroup&quot; rel=&quot;nofollow noreferrer&quot;&gt;normalizer&lt;/a&gt; of the Pauli group, which basically means that it's the set of operations that map the set of &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices#Eigenvectors_and_eigenvalues&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli eigenstates&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Another reason why we care about Clifford gates is the fact (in the scope of Quantum Error correction (specifically &lt;a href=&quot;https://en.wikipedia.org/wiki/Stabilizer_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;stabilizer codes&lt;/a&gt;) and Fault-tolerance) that all Clifford operations on stabilizer codes can be implemented &lt;a href=&quot;https://www.quantiki.org/wiki/quantum-error-correction-and-fault-tolerance-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;transversally&lt;/a&gt; - which is a certain way of implementing (logical) operations on codes that are more or less 'the most easy way' of fault-tolerant, making them &lt;em&gt;highly&lt;/em&gt; desirable.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately it's impossible &lt;a href=&quot;https://en.wikipedia.org/wiki/Eastin%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;(as shown here)&lt;/a&gt; to have a complete &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal gateset&lt;/a&gt; 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 &lt;em&gt;not&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;magic state distillation&lt;/em&gt;. 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).&lt;/p&gt;&#xA;&lt;p&gt;Note that one needs &lt;em&gt;a lot&lt;/em&gt; 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'.&lt;/p&gt;&#xA;&lt;p&gt;As a closing note, it may very well be that at some point all we care about in quantum computing resource is the distillation of magic states. This is of course an oversimplification, but I use it to emphasize the possible importance of these states.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-12-06T19:14:10.667" LastActivityDate="2020-12-06T19:14:10.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13631" PostTypeId="2" ParentId="13615" CreationDate="2020-09-07T14:25:50.277" Score="1" Body="&lt;p&gt;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: &lt;a href=&quot;https://nonhermitian.org/kaleido/tutorials/interactive/qsphere.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://nonhermitian.org/kaleido/tutorials/interactive/qsphere.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2020-09-07T14:25:50.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13634" PostTypeId="1" AcceptedAnswerId="13636" CreationDate="2020-09-07T18:00:33.723" Score="1" ViewCount="121" Body="&lt;p&gt;Let's say I have a &lt;code&gt;QuantumCircuit&lt;/code&gt; with multiple &lt;code&gt;barrier&lt;/code&gt;s as shown in the visual below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LV5ss.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LV5ss.png&quot; alt=&quot;Quantum Circuit with Multiple Barriers&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How would I split up the &lt;code&gt;QuantumCircuit&lt;/code&gt; on the &lt;code&gt;barrier&lt;/code&gt;s into a list of 3 &lt;code&gt;QuantumCircuit&lt;/code&gt;s in &lt;strong&gt;Qiskit&lt;/strong&gt;?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/randomized-benchmarking.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Textbook: 5.3 Randomized Benchmarking&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-09T20:46:10.660" LastActivityDate="2020-09-09T20:46:10.660" Title="How to split a Quantum Circuit on a barrier in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;random-quantum-circuit&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13635" PostTypeId="2" ParentId="13354" CreationDate="2020-09-07T18:28:29.827" Score="3" Body="&lt;p&gt;In the classic paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9608006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9608006.pdf&lt;/a&gt;, on page 10, the distance of an &lt;span class=&quot;math-container&quot;&gt;$[n,0]$&lt;/span&gt; code is defined as the smallest non-zero weight of any stabilizer in the code. The physical interpretation for this definition given is,&#xA;&amp;quot;An &lt;span class=&quot;math-container&quot;&gt;$[[n, 0, d]]$&lt;/span&gt; code is a quantum state such that,&#xA;when subjected to a decoherence of &lt;span class=&quot;math-container&quot;&gt;$[(d − 1)/2]$&lt;/span&gt; coordinates, it is possible to determine exactly which coordinates were decohered.&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="13182" LastEditorUserId="13182" LastEditDate="2020-09-07T18:39:25.593" LastActivityDate="2020-09-07T18:39:25.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13636" PostTypeId="2" ParentId="13634" CreationDate="2020-09-07T19:29:23.187" Score="1" Body="&lt;p&gt;For such a simple circuit, probably the easier way is to dump it as QASM and read it back.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def split_circuit_by_barrier(circuit):&#xA;    qasm = circuit.qasm()&#xA;    prelude = []&#xA;    circuits = [[]]&#xA;    for line in qasm.splitlines():&#xA;        if any([line.startswith(t) for t in ['OPENQASM', 'include', 'qreg', 'creg']]):&#xA;            prelude.append(line)&#xA;        elif line.startswith('barrier'):&#xA;            circuits.append([])&#xA;        else:&#xA;            circuits[-1].append(line)&#xA;    circuits_with_prelude = [prelude+circuit for circuit in circuits]&#xA;    for circuit_with_prelude in circuits_with_prelude:&#xA;        yield QuantumCircuit.from_qasm_str('\n'.join(circuit_with_prelude))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Taking your example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for subcircuit in (split_circuit_by_barrier(circuit)):&#xA;    print(subcircuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;                             ┌───┐ ┌───┐&#xA;   q_0: ─────────────────■───┤ H ├─┤ S ├─────&#xA;        ┌───┐┌───┐┌───┐┌─┴─┐┌┴───┴┐├───┤┌───┐&#xA;   q_1: ┤ H ├┤ H ├┤ S ├┤ X ├┤ SDG ├┤ H ├┤ X ├&#xA;        └───┘└───┘└───┘└───┘└─────┘└───┘└───┘&#xA;meas: 2/═════════════════════════════════════&#xA;&#xA;        ┌─────┐┌───┐&#xA;   q_0: ┤ SDG ├┤ H ├───────■───────────────────&#xA;        └┬───┬┘├───┤┌───┐┌─┴─┐┌─────┐┌───┐┌───┐&#xA;   q_1: ─┤ X ├─┤ H ├┤ S ├┤ X ├┤ SDG ├┤ H ├┤ H ├&#xA;         └───┘ └───┘└───┘└───┘└─────┘└───┘└───┘&#xA;meas: 2/═══════════════════════════════════════&#xA;&#xA;        ┌─┐&#xA;   q_0: ┤M├───&#xA;        └╥┘┌─┐&#xA;   q_1: ─╫─┤M├&#xA;         ║ └╥┘&#xA;meas: 2/═╩══╩═&#xA;         0  1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-07T19:40:51.713" LastActivityDate="2020-09-07T19:40:51.713" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13637" PostTypeId="1" AcceptedAnswerId="13641" CreationDate="2020-09-07T20:06:43.770" Score="3" ViewCount="160" Body="&lt;p&gt;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 ?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="55" LastEditDate="2020-09-09T20:46:01.123" LastActivityDate="2020-09-09T20:46:01.123" Title="Implement U2 and U3 gate in Q#" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13638" PostTypeId="1" CreationDate="2020-09-07T23:03:46.257" Score="3" ViewCount="31" Body="&lt;p&gt;I asked earlier &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12162/which-quantum-gates-can-we-use-in-terms-of-depth&quot;&gt;Which quantum gates can we use in terms of depth?&lt;/a&gt;. In the question, I asked&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;and the answers is&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;depending on hardware.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If we use the quantum computer made of ion trap, what is the gate set, especially two-qubit gate? I have heard that &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; rotation is one of them, is it right?&lt;/p&gt;&#xA;" OwnerUserId="9894" LastEditorUserId="55" LastEditDate="2020-09-09T20:45:42.333" LastActivityDate="2020-09-09T20:45:42.333" Title="What is the elementary gate set for ion-trap quantum computers?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13639" PostTypeId="2" ParentId="13626" CreationDate="2020-09-08T00:28:55.387" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-08T00:28:55.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13640" PostTypeId="2" ParentId="13626" CreationDate="2020-09-08T01:01:52.750" Score="3" Body="&lt;p&gt;Quantum programs in Q# can include classical logic as well as low-level quantum instructions, such that you can directly include the &amp;quot;shot&amp;quot; concept from circuits in your Q# programs by using a &lt;code&gt;for&lt;/code&gt;-loop.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@EntryPoint()&#xA;operation RunSeveralTimes(nTimes : Int) : Result[] {&#xA;    mutable results = new Result[nTimes];&#xA;    for (idx in 0..nTimes - 1) {&#xA;        set results w/= idx &amp;lt;- DoSomething();&#xA;    }&#xA;    return results;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When running this program with &lt;code&gt;dotnet run&lt;/code&gt;, you can now pass &lt;code&gt;--n-times&lt;/code&gt; as a command-line argument to control how many times your &lt;code&gt;DoSomething()&lt;/code&gt; operation gets called. Similarly, if you're using Q# in Jupyter Notebooks, you can use a command like &lt;code&gt;%simulate RunSeveralTimes nTimes=50&lt;/code&gt;. From Python interoperability, you can pass &lt;code&gt;nTimes&lt;/code&gt; as a keyword argument, e.g.: &lt;code&gt;RunSeveralTimes.simulate(nTimes=50)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The Q# standard libraries also offer several functions and operations to make this sort of loop easier to write:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.characterization.estimatefrequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;EstimateFrequency&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.characterization.estimatefrequencya&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;EstimateFrequencyA&lt;/code&gt;&lt;/a&gt;: run an operation many times, and collect the probability with which a measurement at the end returns &lt;code&gt;One&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.arrays.drawmany&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;DrawMany&lt;/code&gt;&lt;/a&gt;: run an operation many times with the same input, and collect all outputs.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.arrays.foreach&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ForEach&lt;/code&gt;&lt;/a&gt;: run an operation once for each of many inputs, and collect all outputs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-09-08T01:01:52.750" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13641" PostTypeId="2" ParentId="13637" CreationDate="2020-09-08T02:11:15.720" Score="3" Body="&lt;p&gt;The gates &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rx&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rx&lt;/a&gt;, &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ry&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rz&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rz&lt;/a&gt; in Q# have the same definition as RXGate, RYGate and RZGate in Qiskit, and the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U2Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;U2Gate&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U3Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;U3Gate&lt;/a&gt; documentation offers decomposition of these gates into Rx, Ry and Rz, so I would just use that decomposition:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;operation U2(psi : Double, lambda : Double, q : Qubit) : Unit is Adj + Ctl {&#xA;    Rz(lambda, q);&#xA;    Ry(0.5 * PI(), q);&#xA;    Rz(psi, q);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and a similar one for U3.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-09-08T02:11:15.720" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13642" PostTypeId="2" ParentId="13629" CreationDate="2020-09-08T02:48:43.063" Score="3" Body="&lt;p&gt;Consider a quantum computer that can:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Prepare qubits in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply unitary gates from the Clifford group&lt;/li&gt;&#xA;&lt;li&gt;Measure qubits in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; bases&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This seems ideal because:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We know how to implement all three functionalities quite easily (compared to more complicated gates or measurements)&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;But, the above quantum computer is &lt;em&gt;not&lt;/em&gt; universal!&lt;/h3&gt;&#xA;&lt;p&gt;You just need &lt;em&gt;one&lt;/em&gt; more functionality to make the above quantum computer universal though:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Be able to prepare a magic state&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Examples of magic states are (here I give &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-type and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-type magic states):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|H\rangle &amp;amp;\equiv \cos(\frac{\pi}{8})|0\rangle + \sin(\frac{\pi}{8})|1\rangle,\tag{1} \\&#xA;|T\rangle &amp;amp;\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}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The above example is not unique. In fact to make any &lt;em&gt;universal&lt;/em&gt; quantum computer, you need to be able to prepare at least one magic state.&lt;/p&gt;&#xA;&lt;p&gt;The term &amp;quot;magic state&amp;quot; was introduced &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403025&quot; rel=&quot;nofollow noreferrer&quot;&gt;in 2004 by Bravyi and Kitaev&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-10-18T19:15:08.673" LastActivityDate="2020-10-18T19:15:08.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13643" PostTypeId="1" AcceptedAnswerId="13650" CreationDate="2020-09-08T06:14:03.147" Score="3" ViewCount="417" Body="&lt;p&gt;For any fixed &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, how do we prove that the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Clifford group (subgroup of &lt;span class=&quot;math-container&quot;&gt;$ U(2^n) $&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, if it is finite, what is the expression of the number of elements in the group as a function of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8131" LastEditorUserId="55" LastEditDate="2020-09-09T20:41:46.847" LastActivityDate="2020-09-09T20:41:46.847" Title="Is the Clifford group finite?" Tags="&lt;clifford-group&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13644" PostTypeId="1" AcceptedAnswerId="13645" CreationDate="2020-09-08T07:44:00.143" Score="3" ViewCount="104" Body="&lt;p&gt;How to implement a 3 qubit gate, that exchanges the level &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;, with elementary gates (CNOT, SWAP, Toffoli, local gates, etc.(everything Qiskit allows)):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\pmatrix{&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;}=?&#xA;$$&lt;/span&gt;&#xA;I tried to decompose the unitaries hamiltonian &lt;span class=&quot;math-container&quot;&gt;$U=\exp(-i\pi $&lt;/span&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/13644/5280&quot; title=&quot; 1/4( -111 - 11z  + xx1 + xxz - yy1 - yyz - zz1 - zzz)&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;math-container&quot;&gt;$)$&lt;/span&gt; in the Zeeman basis, but it doesn't looks not very promising.&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="9006" LastEditDate="2020-09-09T07:05:19.097" LastActivityDate="2020-09-09T07:05:19.097" Title="Decomposition of $|110\rangle \leftrightarrow |000\rangle$ Exchange Gate" Tags="&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13645" PostTypeId="2" ParentId="13644" CreationDate="2020-09-08T08:29:39.833" Score="4" Body="&lt;p&gt;One simple idea would be to introduce an ancilla (I'm sure there will be protocols without an ancilla as well) that starts in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. You can use a Toffoli (and some X gates) to flip the ancilla if the system is in the state &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;. You can also do the same if it's in state &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt;. So, the ancilla is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xSOnA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xSOnA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I believe the following does the same without an ancilla (although you'll want to check it carefully:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Plcqr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Plcqr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-09-08T08:48:40.643" LastActivityDate="2020-09-08T08:48:40.643" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13646" PostTypeId="2" ParentId="13644" CreationDate="2020-09-08T08:50:57.907" Score="4" Body="&lt;p&gt;Adding to @DaftWullie's answer,&lt;/p&gt;&#xA;&lt;p&gt;If you're only looking to implement a gate in Qiskit that swaps &lt;span class=&quot;math-container&quot;&gt;$\lvert000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert110\rangle$&lt;/span&gt; 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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html#qiskit.circuit.QuantumCircuit.iso&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantumCircuit.iso&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The code would look roughly like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, execute, Aer&#xA;import numpy as np&#xA;&#xA;unitary = np.zeros((8,8))&#xA;unitary[0][6] = unitary[6][0] = 1&#xA;unitary[1][1] = unitary[2][2] = unitary[3][3] = unitary[4][4] = unitary[5][5] = unitary[7][7] = 1&#xA;&#xA;ckt = QuantumCircuit(3)&#xA;ckt.iso(unitary, [0,1,2,3], [])&#xA;ckt.measure_all()&#xA;&#xA;execute(ckt, backend=Aer.get_backend('qasm_simulator'), shots=1024).result()&#xA;&#xA;# do what you want with the result &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Do keep in mind qiskit's &amp;quot;reverse-ordering&amp;quot; of qubits when you're playing around with this! Hope this helps...&lt;/p&gt;&#xA;" OwnerUserId="8955" LastActivityDate="2020-09-08T08:50:57.907" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13647" PostTypeId="1" CreationDate="2020-09-08T10:09:32.200" Score="1" ViewCount="172" Body="&lt;p&gt;Running the program in Quantum Lab, it shows error. I am looking for solution.&lt;/p&gt;&#xA;&lt;p&gt;Here is a code I run:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(3)&#xA;&#xA;circ.h(0)&#xA;&#xA;circ.cx(0, 1)&#xA;&#xA;circ.cx(0, 2)&#xA;circ.draw('mpl')&#xA;&#xA;from qiskit import Aer&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;job = execute(circ, backend)&#xA;result = job.result()   &#xA;outputstate =result.get_statevector(circ, decimals=3)&#xA;print(outputstate) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;An here is an error I got:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;NameError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-3-17b8e431afa9&amp;gt; in &amp;lt;module&amp;gt;&#xA;&#xA;----&amp;gt; 1 circ = QuantumCircuit(3)&#xA;&#xA;      2 # Add a H gate on qubit 0, putting this qubit in superposition.&#xA;&#xA;&#xA;      3 circ.h(0)&#xA;&#xA;      4 # Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting&#xA;&#xA;      5 # the qubits in a Bell state.&#xA;&#xA;&#xA;NameError: name 'QuantumCircuit' is not defined&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="9006" LastEditDate="2020-09-09T07:08:41.010" LastActivityDate="2020-09-09T07:08:41.010" Title="Getting an error running a program in IBM Q Experience Quantum lab" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13648" PostTypeId="2" ParentId="13647" CreationDate="2020-09-08T10:52:55.480" Score="1" Body="&lt;p&gt;You need to import &lt;code&gt;QuantumCircuit&lt;/code&gt; from qiskit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;from qiskit import QuantumCircuit&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I imagine you will probably also need to do:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;from qiskit import execute&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;And you can combine your three imports neatly into one line like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, QuantumCircuit, execute&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="10415" LastActivityDate="2020-09-08T10:52:55.480" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13649" PostTypeId="1" CreationDate="2020-09-08T12:34:36.380" Score="2" ViewCount="34" Body="&lt;p&gt;See article here: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208112&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0208112&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{p_i^{(m)} } |i\rangle|0\cdots 0\rangle \rightarrow \sqrt{p_i^{(m)} } |i\rangle|\theta_i\rangle.$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\theta_i$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$f(i) = \theta_i$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;My next question is regarding the next step of the procedure. That is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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). $$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$|\theta_i\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Any literature or answers getting me closer to learning this would be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="55" LastEditDate="2020-09-09T20:39:35.043" LastActivityDate="2020-09-09T20:39:35.043" Title="How one would implement the circuit to create superpositions corresponding to efficiently integrable probability distributions?" Tags="&lt;algorithm&gt;&lt;quantum-parallelism&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13650" PostTypeId="2" ParentId="13643" CreationDate="2020-09-08T12:40:10.257" Score="7" Body="&lt;p&gt;Sometimes, there is a bit of confusion around the Clifford group in the field ... and it's a matter of definition.&lt;/p&gt;&#xA;&lt;p&gt;A lot of people define the Clifford group &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Cl}_n(p)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qudits of prime dimension &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; as the unitary normaliser of the generalised Pauli group (e.g. Gottesman, Nielsen &amp;amp; Chuang). As such, it is clearly &lt;strong&gt;not&lt;/strong&gt; a finite group as the centre is &lt;span class=&quot;math-container&quot;&gt;$U(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;There are three ways of resolving this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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: &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_8$&lt;/span&gt;. The minimal one is &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_4$&lt;/span&gt; in the qubit case an &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_p$&lt;/span&gt; in the qudit case. Redefining the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate as &lt;span class=&quot;math-container&quot;&gt;$\frac{1+i}{\sqrt{2}} H$&lt;/span&gt; makes the centre minimal for qubits.&lt;/li&gt;&#xA;&lt;li&gt;You can define it as the normaliser in the unitary group with entries in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Q}[i]$&lt;/span&gt; (rational complex numbers). This will give you a group with minimal centre (see Ref. 1).&lt;/li&gt;&#xA;&lt;li&gt;Define the projective group &lt;span class=&quot;math-container&quot;&gt;$\overline{\mathrm{Cl}}_n(p):=\mathrm{Cl}_n(p)/U(1)$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$p^{2n}$&lt;/span&gt; Pauli operators, the number of permutations is finite (and thus is &lt;span class=&quot;math-container&quot;&gt;$\overline{\mathrm{Cl}}_n(p)$&lt;/span&gt;).&#xA;Moreover, it holds&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\overline{\mathrm{Cl}}_n(p)/\overline{\mathcal{P}}_n(p) \simeq \mathrm{Sp}_{2n}(p),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\overline{\mathcal{P}}_n(p)$&lt;/span&gt; is the (generalised) Pauli group up to phases and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Sp}_{2n}(p)$&lt;/span&gt; is the symplectic group over the finite field &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_p$&lt;/span&gt;. Its cardinality is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\mathrm{Sp}_{2n}(p)| = p^{n^2} \prod_{i=1}^n (p^{2i} - 1).&#xA;$$&lt;/span&gt;&#xA;Thus, the projective Clifford group has cardinality&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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)&#xA;$$&lt;/span&gt;&#xA;For the non-projective ones, one has to multiply with the order of the centre. For a reference, see e.g. Ref. 2&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;References:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Gabriele Nebe, E. M. Rains, and N. J. A. Sloane. “The invariants of the Clifford groups”&lt;/li&gt;&#xA;&lt;li&gt;D. Gross, &amp;quot;Hudson’s theorem for finite-dimensional quantum systems&amp;quot;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-09-08T14:19:04.507" LastActivityDate="2020-09-08T14:19:04.507" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13651" PostTypeId="1" AcceptedAnswerId="13824" CreationDate="2020-09-08T12:42:52.357" Score="0" ViewCount="63" Body="&lt;p&gt;Let's say I have a &lt;code&gt;QuantumCircuit&lt;/code&gt; with &lt;code&gt;depth&lt;/code&gt; &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; layers. How can I generate a new &lt;code&gt;QuantumCircuit&lt;/code&gt; with the last &lt;strong&gt;n&lt;/strong&gt; layers removed. For example, let's say the &lt;code&gt;QuantumCircuit&lt;/code&gt; has &lt;span class=&quot;math-container&quot;&gt;$d=8$&lt;/span&gt; layers as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ijwqy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ijwqy.png&quot; alt=&quot;Quantum Circuit with Depth 8 Layers&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And let's say the last &lt;strong&gt;n=4&lt;/strong&gt; layers are desired to be removed then the resulting &lt;code&gt;QuantumCircuit&lt;/code&gt; should be as follows leaving only the first 4 layers of the above &lt;code&gt;QuantumCircuit&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Lt2dx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Lt2dx.png&quot; alt=&quot;Removed Last 4 Layers from QC&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can this be done in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-09T20:35:11.153" LastActivityDate="2020-09-19T17:02:55.483" Title="How to remove last n layers of Quantum Circuit in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13652" PostTypeId="1" AcceptedAnswerId="13660" CreationDate="2020-09-08T12:51:52.603" Score="0" ViewCount="107" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="55" LastEditDate="2020-09-09T20:34:52.207" LastActivityDate="2020-09-09T20:34:52.207" Title="How do I compute the fidelity on the IBM Q using qiskit without the statevector simulator?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13653" PostTypeId="2" ParentId="13531" CreationDate="2020-09-08T12:54:29.683" Score="5" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does quantum mechanics change what is theoretically learnable?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A beautiful paper is &lt;a href=&quot;https://arxiv.org/abs/1701.06806&quot; rel=&quot;noreferrer&quot;&gt;this reference&lt;/a&gt; which states a few complex results in rather clear words. Again, it depends very much on what you define as &amp;quot;learning&amp;quot;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What asymptotic computational speedups can quantum computing provide for machine learning?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Quantum computing research is traditionally very focused on &lt;em&gt;exponential speedups&lt;/em&gt;, which have been claimed in many quantum machine learning papers. But they rely on lots of &lt;a href=&quot;https://scottaaronson.com/papers/qml.pdf&quot; rel=&quot;noreferrer&quot;&gt;assumptions&lt;/a&gt; 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 &amp;quot;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5525/quantum-machine-learning-after-ewin-tang&quot;&gt;de-quantised&lt;/a&gt;&amp;quot;, which is a euphemism for &amp;quot;found to not really provide an exponential speedup if the same assumptions are imposed on classical algorithms&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Can quantum computations give rise to machine learning models that generalise well?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Most of the work in near-term quantum machine learning, that is QML using small and noisy devices that are the current &amp;quot;prototypes&amp;quot; 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?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;br /&gt;&#xA;This type of research, much driven by &amp;quot;variational&amp;quot; or &amp;quot;trainable&amp;quot; or &amp;quot;parametrised&amp;quot; quantum circuits which are &lt;a href=&quot;https://pennylane.ai/&quot; rel=&quot;noreferrer&quot;&gt;optimised with the usual classical techniques of deep learning&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;automatically given&amp;quot;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;show&lt;/em&gt; 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 &amp;quot;are quantum models better machine learning models?&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13188" LastActivityDate="2020-09-08T12:54:29.683" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13654" PostTypeId="1" CreationDate="2020-09-08T13:36:03.633" Score="1" ViewCount="119" Body="&lt;p&gt;I want to reduce the depth of a &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.ucrz.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ucrz&lt;/a&gt; gate acting on multiple qubits with ancilla qubits in qiskit. One way to do this could be the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.MCMT.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;mcmt&lt;/a&gt; implementation with &lt;code&gt;method='v-chain'&lt;/code&gt;. However, it seems that &lt;code&gt;mcmt&lt;/code&gt; is incompatible with base gates acting on multiple qubits. How can I reduce the circuit depth with ancillas?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;from qiskit.extensions.quantum_initializer.ucrz import UCRZGate&#xA;import numpy as np&#xA;&#xA;nqbits=3 # the number of qubits&#xA;qr = QuantumRegister(nqbits) #initialize register&#xA;QM = QuantumCircuit(qr) #initialize circuits&#xA;ang_li=list([np.pi,np.pi,-np.pi,np.pi])# list of angles&#xA;QM.ucrz(ang_li,q_controls=[qr[1],qr[2]],q_target=[qr[0]])#apply the gate&#xA;on the first register&#xA;display(QM.draw())#This is the full circuit&#xA;display(QM.decompose().decompose().decompose().draw()) #This is the decomposed circuit whose depth I wanna reduce with ancillas&#xA;&#xA;qr2 = QuantumRegister(2*nqbits-1) #initialize the second register&#xA;ancilla = QuantumCircuit(qr2) #initialize the second circuit &#xA;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&#xA;display(ancilla.decompose().decompose().decompose().decompose().draw())&#xA;print(ancilla.decompose().decompose().decompose().decompose().count_ops())&#xA;print(ancilla.decompose().decompose().decompose().decompose().depth())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13189" LastEditorUserId="55" LastEditDate="2020-09-09T20:33:46.387" LastActivityDate="2020-09-09T20:33:46.387" Title="qiskit - MCMT - base gate acting on only one qubit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13655" PostTypeId="1" CreationDate="2020-09-08T16:12:04.190" Score="0" ViewCount="163" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qcomp = provider.get_backend('ibmq_5_yorktown') &#xA;fidelitycount = 0&#xA;shots = 1&#xA;for i in range(shots):&#xA;    num_qubits = 5&#xA;    adj_matrix_fcg = np.ones((num_qubits,num_qubits),dtype=int)&#xA;    circuit_fcg_5 = qiskit.circuit.library.GraphState(adj_matrix_fcg)&#xA;    sv2 = execute(circuit_fcg_5, qcomp).result().get_statevector(circuit_fcg_5)&#xA;    #fidelity = qiskit.quantum_info.state_fidelity(sv1)&#xA;    #fidelitycount += fidelity&#xA;&#xA;print(sv2)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and this is the error&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yt5kA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yt5kA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8330" LastEditorUserId="55" LastEditDate="2020-09-09T20:33:23.737" LastActivityDate="2020-09-09T20:33:23.737" Title="QiskitError: 'No statevector for experiment" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13656" PostTypeId="2" ParentId="13655" CreationDate="2020-09-08T16:22:38.590" Score="3" Body="&lt;p&gt;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 &lt;code&gt;get_statevector&lt;/code&gt; method on the &lt;code&gt;Result&lt;/code&gt; class only works if the backend (in this case a simulator) returns a statevector after executing the circuit.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/noise/8_tomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/noise/8_tomography.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-09-08T16:22:38.590" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13657" PostTypeId="1" AcceptedAnswerId="13675" CreationDate="2020-09-08T16:31:47.587" Score="7" ViewCount="283" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi | H_i | \psi \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; can be decomposed into Paulis?&lt;/p&gt;&#xA;&lt;p&gt;The first strategy that comes to mind is &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6011/calculating-the-expectation-value-of-a-unitary-operator-on-a-quantum-computer&quot;&gt;simply applying the adjoint of the state prep routine&lt;/a&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-11T19:00:21.703" Title="Circuit for VQE Expectation Value Finding" Tags="&lt;measurement&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13658" PostTypeId="2" ParentId="13651" CreationDate="2020-09-08T17:27:40.120" Score="1" Body="&lt;p&gt;Based on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5144/can-i-remove-gates-from-a-quantumcircuit&quot;&gt;this question&lt;/a&gt; I have been able to solve this problem as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;initial_d = qc.depth() # in my case 8&#xA;n = 4 # number of layers to remove&#xA;while qc.depth() &amp;gt; (initial_depth - n):&#xA;    qc.data.pop(-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2020-09-08T17:27:40.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13659" PostTypeId="2" ParentId="13543" CreationDate="2020-09-08T17:28:10.403" Score="5" Body="&lt;p&gt;Michael Nielsen said the book is not maintained. I asked him on &lt;a href=&quot;https://twitter.com/michael_nielsen/status/1303374791554940929&quot; rel=&quot;nofollow noreferrer&quot;&gt;Twitter&lt;/a&gt; .&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2021-01-25T10:59:48.837" LastActivityDate="2021-01-25T10:59:48.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13660" PostTypeId="2" ParentId="13652" CreationDate="2020-09-08T19:26:54.333" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job.result().data(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;for a specific circuit and job run on a real IBMQ device. The output you will get will be in the form of&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'counts': {...}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where {...} is a dictionary mapping states to counts for those states.&lt;/p&gt;&#xA;&lt;p&gt;If you run the same command on a job run on the statevector simulator, you will get&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'counts':{...}, 'statevector': array([...])}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where array([...]) is an array form of the resulting statevector, and the dictionary for counts maps that same statevector to a count of 1.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;However, you can compute the hellinger fidelity, which compares counts instead of state vectors. You can read more about it here: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.hellinger_fidelity.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.quantum_info.hellinger_fidelity.html&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13117" LastEditorUserId="13117" LastEditDate="2020-09-08T19:48:04.593" LastActivityDate="2020-09-08T19:48:04.593" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13661" PostTypeId="1" AcceptedAnswerId="13671" CreationDate="2020-09-09T07:03:09.330" Score="3" ViewCount="94" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 (?).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13195" LastEditorUserId="13195" LastEditDate="2020-09-13T22:16:01.200" LastActivityDate="2020-09-13T22:16:01.200" Title="Effect of quantum entanglement on measurement" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;foundations&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13662" PostTypeId="1" AcceptedAnswerId="13663" CreationDate="2020-09-09T11:08:39.397" Score="1" ViewCount="93" Body="&lt;p&gt;I started to learn Qiskit, so sorry if my question is very basic.  So far I used &lt;code&gt;qasm_simulator&lt;/code&gt; or &lt;code&gt;state_vectorsimulator&lt;/code&gt;, however, now I would like to run my circuit on real IBM Q processor.&lt;/p&gt;&#xA;&lt;p&gt;Here is my code, I wanted to execute:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;&#xA;provider = IBMQ.load_account()&#xA;backend = provider.backends(name='ibmq_ourense')&#xA;&#xA;q = QuantumRegister(5, name = 'q')&#xA;c = ClassicalRegister(2,name = 'c')&#xA;&#xA;circuit = QuantumCircuit(q,c)&#xA;circuit.h(q[0])&#xA;circuit.cx(q[0],q[1])&#xA;circuit.measure(q[0],c[0])&#xA;circuit.measure(q[1],c[1])&#xA;&#xA;job = execute(circuit, backend, shots = 1024)&#xA;counts = job.result().get_counts()&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, this error was shown:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-26-b48ae13f56aa&amp;gt; in &amp;lt;module&amp;gt;&#xA;     11 circuit.measure(q[1],c[1])&#xA;     12 &#xA;---&amp;gt; 13 job = execute(circuit, backend, shots = 1024)&#xA;     14 counts = job.result().get_couns()&#xA;     15 plot_histogram(counts)&#xA;&#xA;/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)&#xA;    258                                 seed_transpiler=seed_transpiler,&#xA;    259                                 optimization_level=optimization_level,&#xA;--&amp;gt; 260                                 backend=backend)&#xA;    261 &#xA;    262     if schedule_circuit:&#xA;&#xA;/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)&#xA;    211                                            callback, output_name)&#xA;    212 &#xA;--&amp;gt; 213     _check_circuits_coupling_map(circuits, transpile_args, backend)&#xA;    214 &#xA;    215     # Transpile circuits in parallel&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/compiler/transpile.py in _check_circuits_coupling_map(circuits, transpile_args, backend)&#xA;    244 &#xA;    245         # If coupling_map is None, the limit might be in the backend (like in 1Q devices)&#xA;--&amp;gt; 246         elif backend is not None and not backend.configuration().simulator:&#xA;    247             max_qubits = backend.configuration().n_qubits&#xA;    248 &#xA;&#xA;AttributeError: 'list' object has no attribute 'configuration'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I think that the problem is hidden in getting backends or &lt;code&gt;execute&lt;/code&gt; command.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note: I run my code in Quantum Lab on IBM Q website interface.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Could any please help me how to change my code to run it on real IBM Q processor?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-09-09T20:46:41.073" LastActivityDate="2020-10-10T01:03:36.183" Title="Error while running Qiskit code on real quantum hardware" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13663" PostTypeId="2" ParentId="13662" CreationDate="2020-09-09T11:18:43.583" Score="3" Body="&lt;p&gt;Looks like &lt;code&gt;backend = provider.backends(name='ibmq_ourense')&lt;/code&gt; returns a list of backends whose name is &lt;code&gt;ibmq_oursense&lt;/code&gt; (a list whose length is obviously 1). Try &lt;code&gt;backend = provider.backends(name='ibmq_ourense')[0]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-09-09T11:18:43.583" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13665" PostTypeId="2" ParentId="4469" CreationDate="2020-09-09T15:09:01.403" Score="1" Body="&lt;p&gt;It sounds like GLOA algorithms are a type of &lt;em&gt;genetic algorithm&lt;/em&gt;. Genetic algorithms are &lt;em&gt;heuristic algorithms&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand the SK algorithm is an &lt;em&gt;exact or deterministic algorithm&lt;/em&gt; with polynomial complexity in &lt;span class=&quot;math-container&quot;&gt;$O(\log(1/\epsilon))$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;, which is a Lie group and therefore a smooth manifold in which one can make conclusions about the geometry and distance between points.&lt;/p&gt;&#xA;&lt;p&gt;GLOA's may have advantages when &lt;em&gt;engineering&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="11793" LastActivityDate="2020-09-09T15:09:01.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13667" PostTypeId="1" AcceptedAnswerId="13668" CreationDate="2020-09-09T18:36:28.227" Score="2" ViewCount="51" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13199" LastEditorUserId="55" LastEditDate="2020-09-09T21:00:55.770" LastActivityDate="2020-09-10T08:39:41.170" Title="Qiskit: Get gates from circuit object" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13668" PostTypeId="2" ParentId="13667" CreationDate="2020-09-09T18:51:32.873" Score="2" Body="&lt;p&gt;You can inspect the QuantumCircuit.data structure:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, here is a loop that prints the name, qubits and any other parameters for all the gates in a circuit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for gate in qc.data:&#xA;    print('\ngate name:', gate[0].name)&#xA;    print('qubit(s) acted on:', gate[1])&#xA;    print('other paramters (such as angles):', gate[0].params)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="409" LastEditDate="2020-09-10T08:39:41.170" LastActivityDate="2020-09-10T08:39:41.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13669" PostTypeId="1" CreationDate="2020-09-09T19:55:47.407" Score="0" ViewCount="59" Body="&lt;p&gt;How can I solve this situation?&lt;/p&gt;&#xA;&lt;p&gt;I'm using the IBMQX2 chip. When I run my simulation some circuits are executed and the following WARNING message is displayed:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;account._job_result_object_storage:WARNING:2020-09-10 05:31:30,318: An error occurred while sending download completion acknowledgement: &amp;quot;HTTPSConnectionPool(host='api.quantum-computing.ibm.com', port=443): Read timed out. (read timeout=None)&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After a long time a few more circuits are run and the following error message is displayed:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQBackendApiError: 'Error sending job: &amp;quot;HTTPSConnectionPool (host = \ 'api .quantum -computing.ibm.com \', port = 443): Reading timeout. (reading timeout = None) &amp;quot;.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13200" LastEditorUserId="45" LastEditDate="2020-09-19T09:46:23.490" LastActivityDate="2020-09-19T09:46:23.490" Title="Error associated with HTTPSConnectionPool" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13670" PostTypeId="2" ParentId="13669" CreationDate="2020-09-09T20:29:59.123" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-09-09T20:29:59.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13671" PostTypeId="2" ParentId="13661" CreationDate="2020-09-09T20:59:24.183" Score="4" Body="&lt;p&gt;It depends on what exactly you mean by &amp;quot;affected&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;First of all, I'd say from your description that your &amp;quot;a&amp;quot; does not actually enter the discussion. The question is then essentially: &lt;em&gt;suppose Alice (A) and Bob (B) have entangled states, and A performs a measurement; does this affect B's state&lt;/em&gt;?&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;em&gt;i.e.&lt;/em&gt; their measurement results will be correlated.&lt;/p&gt;&#xA;&lt;p&gt;Does this mean that A's act of measuring &lt;em&gt;affected&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;The situation is more akin to the states being &lt;em&gt;correlated&lt;/em&gt;, albeit this type of correlation is stronger than what is possible classically.&lt;/p&gt;&#xA;&lt;p&gt;There's also plenty of posts on similar topics on physics.SE. &lt;em&gt;E.g.&lt;/em&gt; &lt;a href=&quot;https://physics.stackexchange.com/q/317535/58382&quot;&gt;&lt;em&gt;If two particles are entangled and you collapse the wave function of one of the particles. Does the other particle collapse as well?&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-09-10T09:59:28.700" LastActivityDate="2020-09-10T09:59:28.700" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13672" PostTypeId="1" AcceptedAnswerId="13674" CreationDate="2020-09-09T22:41:33.763" Score="3" ViewCount="123" Body="&lt;p&gt;Let's say you want to do an experiment with 14+ qubits. You apply some arbitrary unitary operator &lt;span class=&quot;math-container&quot;&gt;$U \in  (\mathbb{C}^2)^{\otimes n} \times  (\mathbb{C}^2)^{\otimes n}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in (\mathbb{C}^2)^{\otimes n}  $&lt;/span&gt;. That is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U|\psi \rangle = |\phi \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can take &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |0\rangle^{\otimes n} $&lt;/span&gt; to fits with current quantum computing setting. Now, if we do this experiment with &lt;span class=&quot;math-container&quot;&gt;$2^{13} = 8192$&lt;/span&gt; shots, how is this enough to build up the statistical distribution as we have more than &lt;span class=&quot;math-container&quot;&gt;$2^{14}$&lt;/span&gt; slots to distribute them to. If your output state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is particular eigenstate, says &lt;span class=&quot;math-container&quot;&gt;$|0110\cdots 1 \rangle$&lt;/span&gt;, then this many shots is more than enough. But if &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is in a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-17T04:00:44.520" LastActivityDate="2021-05-01T19:29:31.627" Title="How can we only use 8192 shots for an experiment with 14 or more qubits?" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13673" PostTypeId="1" CreationDate="2020-09-10T04:36:20.633" Score="3" ViewCount="151" Body="&lt;p&gt;I am mainly talking about QSVM from Qiskit (&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.QSVM.html#qiskit.aqua.algorithms.QSVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.QSVM.html#qiskit.aqua.algorithms.QSVM&lt;/a&gt;) versus a classical SVM. Is it just a time complexity speed-up?&lt;/p&gt;&#xA;" OwnerUserId="13092" LastEditorUserId="55" LastEditDate="2020-09-18T09:55:10.667" LastActivityDate="2021-03-10T10:43:31.467" Title="What is the advantage of QSVM over the classical SVM?" Tags="&lt;qiskit&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13674" PostTypeId="2" ParentId="13672" CreationDate="2020-09-10T08:28:45.903" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt; shots, or some other complexity that is far less than &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, if you want more than 8192 you could submit several jobs and combine results.&lt;/p&gt;&#xA;" OwnerUserId="409" LastActivityDate="2020-09-10T08:28:45.903" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13675" PostTypeId="2" ParentId="13657" CreationDate="2020-09-10T10:50:56.227" Score="5" Body="&lt;p&gt;Let's denote &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; as a Pauli tensor product term (Pauli term: e.g. &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X \otimes X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y \otimes X \otimes X$&lt;/span&gt;), then note that &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a Hermitian matrix whose expectation value is real, the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; with corresponding eigenspaces. The expectation value of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; will be equal to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi | P |\psi\rangle = p_{+} - p_{-}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p_{+}$&lt;/span&gt; is the probability of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; being in the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace and &lt;span class=&quot;math-container&quot;&gt;$p_{-}$&lt;/span&gt; is the probability of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; being in the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace of &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. We will prove this. Note that &lt;span class=&quot;math-container&quot;&gt;$p_{+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{-}$&lt;/span&gt; can be calculated by measuring in &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; eigenbasis: &lt;span class=&quot;math-container&quot;&gt;$p_{+} = \frac{N_{+}}{N}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_{-} = \frac{N_{-}}{N}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$N_+$&lt;/span&gt; is the number of measured eigenvectors that have &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalue, &lt;span class=&quot;math-container&quot;&gt;$N_-$&lt;/span&gt; is the number of measured eigenvectors that have &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenvalue and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the total number of measurements.&lt;/p&gt;&#xA;&lt;p&gt;Now the prove. Arbitrary &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; can be expressed as superposition of eigenbasis vectors of arbitrary Hermitian matrix (but we are interested in &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;) that acts in the same Hilbert space, so:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_{j_+} a_{j_+}|j_+\rangle + \sum_{j_-} b_{j_-}|j_-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a_{j_+}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_{j_-}$&lt;/span&gt; are amplitudes of eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|j_+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|j_-\rangle$&lt;/span&gt; of the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. We have separated the sum for our convenience: &lt;span class=&quot;math-container&quot;&gt;$|j_+\rangle$&lt;/span&gt; are eigenvectors that have &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalue (that means &lt;span class=&quot;math-container&quot;&gt;$P|j_+\rangle = |j_+\rangle$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$|j_-\rangle$&lt;/span&gt; are eigenvectors that have &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenvalue (that means &lt;span class=&quot;math-container&quot;&gt;$P|j_-\rangle = -|j_-\rangle$&lt;/span&gt;). So:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P |\psi\rangle = \sum_{j_+} a_{j_+}|j_+\rangle - \sum_{j_-} b_{j_-}|j_-\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By taking into account that all eigenbasis vectors &lt;span class=&quot;math-container&quot;&gt;$|j_+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|j_-\rangle$&lt;/span&gt; are orthogonal to each other (e.g. &lt;span class=&quot;math-container&quot;&gt;$\langle j_+| k_+\rangle = 0$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$j \ne k$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\langle j_+| k_-\rangle = 0$&lt;/span&gt; ):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi |P |\psi\rangle = \sum_{j_+} |a_{j_+}|^2 - \sum_{j_-} |b_{j_-}|^2= p_{+} - p_{-}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11411/9459&quot;&gt;answer&lt;/a&gt;, one can find Qiskit implementation for &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z \otimes ... \otimes Z$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H = \sum_i c_i P_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are Pauli terms and &lt;span class=&quot;math-container&quot;&gt;$c_i$&lt;/span&gt; are real numberes, then &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H| \psi \rangle = \sum_i c_i \langle \psi | P_i | \psi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Replying to the comments of the answer&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/concepts/pauli-measurements&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft's docs&lt;/a&gt; it was proposed (not only) an approach of measuring &lt;span class=&quot;math-container&quot;&gt;$\langle ZZ \rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\langle ZZ \rangle$&lt;/span&gt; and here are three alternative ways for doing it:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p7l5r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p7l5r.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If the measured bitstring has odd (even) &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s then we have measured the state in &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;) eigenspace. The generalized Qiskit implementation of this approach can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11411/9459&quot;&gt;answer&lt;/a&gt;. Also, this approach is used (if I have understood the paper right) in this &lt;a href=&quot;https://arxiv.org/abs/1704.05018&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; from IBM (Fig. 1 shows not only measurements but also simple one qubit unitary transformations (&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$X_{-\frac{\pi}{2}}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y_{-\frac{\pi}{2}}$&lt;/span&gt;) that are specific for each Pauli term).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If we measure the ancillary qubit in &lt;span class=&quot;math-container&quot;&gt;$| 0\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) state then we have measured it in &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;) eigenspace. This circuit is also used for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard test&lt;/a&gt; / &lt;a href=&quot;https://www.nature.com/articles/nature00801#:%7E:text=The%20purpose%20of%20tomography%20is,dual%20forms%20of%20quantum%20computation.&quot; rel=&quot;nofollow noreferrer&quot;&gt;scattering circuit&lt;/a&gt;. 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 &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22,%22Z%22,%22Z%22,%22Y%22%5D,%5B%22H%22%5D,%5B%22Measure%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt; for &lt;span class=&quot;math-container&quot;&gt;$\langle XZZY \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If measure the target qubit (targeted by CNOT) &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) then we have measured the state in the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;) 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;P.S. There exist also other approaches for calculating &lt;span class=&quot;math-container&quot;&gt;$\langle ZZ \rangle$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-11T19:00:21.703" LastActivityDate="2020-09-11T19:00:21.703" CommentCount="25" ContentLicense="CC BY-SA 4.0" />
  <row Id="13676" PostTypeId="1" CreationDate="2020-09-10T14:40:26.410" Score="3" ViewCount="59" Body="&lt;p&gt;The end of Section III in the paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196&quot; rel=&quot;nofollow noreferrer&quot;&gt;Improved Simulation of Stabilizer Circuits&lt;/a&gt; by Aaronson and Gottesman shows how to compute the inner product of stabilizer states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; represented by sets of generators of their stabilizer group.&lt;/p&gt;&#xA;&lt;p&gt;Given generators for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt;, it suggests to compute the inner product of &lt;span class=&quot;math-container&quot;&gt;$U |\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U |\varphi\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is chosen to ensure that &lt;span class=&quot;math-container&quot;&gt;$U |\psi\rangle=|0\rangle^{\otimes n}$&lt;/span&gt;. It then computes generators for &lt;span class=&quot;math-container&quot;&gt;$U |\varphi\rangle$&lt;/span&gt; represented as a &lt;em&gt;tableau&lt;/em&gt; and applies Gaussian elimination to this tableau.&lt;/p&gt;&#xA;&lt;p&gt;I don't understand the following aspects of this algorithm:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How does the algorithm conclude? (The final steps of the algorithm are not clear to me)&lt;/li&gt;&#xA;&lt;li&gt;Why is this algorithm correct? (The reasoning in the paper is not clear to me)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2444" LastActivityDate="2020-09-10T14:40:26.410" Title="Inner Product of Stabilizer States" Tags="&lt;stabilizer-state&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13677" PostTypeId="1" AcceptedAnswerId="13678" CreationDate="2020-09-10T17:15:21.517" Score="2" ViewCount="49" Body="&lt;p&gt;Given a circuit, if one wishes to add a gate, it is done through a line like the one below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mycircuit.cx(0, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;'cx'&lt;/code&gt; and integers &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; i.e. without manually typing them?&lt;/p&gt;&#xA;&lt;p&gt;I tried using &lt;a href=&quot;https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-by-using-its-name-a-string&quot;&gt;https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-by-using-its-name-a-string&lt;/a&gt; but getattr did not work for me.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;circ = QuantumCircuit(2)&#xA;circ.draw()&#xA;a = ('cx', 0, 1)&#xA;circ = getattr(circ, a[0])(a[1], a[2])&#xA;circ.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13206" LastEditorUserId="13206" LastEditDate="2020-09-10T18:35:01.307" LastActivityDate="2020-09-10T18:51:14.340" Title="Qiskit: Add a standard gate to circuit from a string" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13678" PostTypeId="2" ParentId="13677" CreationDate="2020-09-10T18:51:14.340" Score="1" Body="&lt;p&gt;You are getting &lt;code&gt;AttributeError: 'InstructionSet' object has no attribute 'draw'&lt;/code&gt; because &lt;code&gt;getattr&lt;/code&gt; doesn't return a &lt;code&gt;QuantumCircuit&lt;/code&gt;. It returns an &lt;code&gt;InstructionSet&lt;/code&gt;, which doesn't have a &lt;code&gt;draw()&lt;/code&gt; method.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;circuit = QuantumCircuit(2)&#xA;print(type(circuit)) # prints &amp;lt;class 'qiskit.circuit.quantumcircuit.QuantumCircuit'&amp;gt;&#xA;circuit.draw()&#xA;a = ('cx', 0, 1)&#xA;circuit = getattr(circuit, a[0])(a[1], a[2])&#xA;print(type(circuit)) # prints &amp;lt;class 'qiskit.circuit.instructionset.InstructionSet'&amp;gt;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Removing the assignment of &lt;code&gt;circuit&lt;/code&gt; to what is returned from &lt;code&gt;getatrr&lt;/code&gt; should get rid of the error.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;circuit = QuantumCircuit(2)&#xA;circuit.draw()&#xA;a = ('cx', 0, 1)&#xA;getattr(circuit, a[0])(a[1], a[2])&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-09-10T18:51:14.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13679" PostTypeId="1" AcceptedAnswerId="13695" CreationDate="2020-09-10T18:58:24.800" Score="3" ViewCount="104" Body="&lt;p&gt;I am doing the 5th exercise on &lt;a href=&quot;https://qiskit.org/textbook/ch-states/representing-qubit-states.html#Quick-Exercise&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-states/representing-qubit-states.html#Quick-Exercise&lt;/a&gt; (all the way at the bottom).&lt;/p&gt;&#xA;&lt;p&gt;Which states find the angle for the vector &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}\begin{pmatrix}i\\ 1\end{pmatrix}$&lt;/span&gt;.&#xA;I find that &lt;span class=&quot;math-container&quot;&gt;$$\cos\left(\frac{\theta}{2}\right) = \frac{i}{\sqrt{2}}&#xA;\qquad\text{and}\qquad e^{i\phi} \sin\left(\frac{\theta}{2}\right) =  \frac{1}{\sqrt{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't know how to find the angles. Or do I just leave it in the form of cosine and sine inverse?&lt;/p&gt;&#xA;" OwnerUserId="13208" LastEditorUserId="55" LastEditDate="2020-09-18T11:10:20.233" LastActivityDate="2020-09-18T11:10:20.233" Title="Having trouble finding angles for Bloch vector" Tags="&lt;qiskit&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13680" PostTypeId="2" ParentId="13528" CreationDate="2020-09-10T19:54:48.670" Score="1" Body="&lt;p&gt;For the mathematical explanation, check here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13334/why-is-the-action-of-controlled-z-unaltered-by-exchanging-target-control-qubits/13337#13337&quot;&gt;Why is the action of controlled-Z unaltered by exchanging target control qubits?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Maybe it would help you to see CZ in a different (symmetric) notation, like its current representation in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit = QuantumCircuit(2)&#xA;circuit.cz(0,1)&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vgEpH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vgEpH.png&quot; alt=&quot;a CZ gate represented as a symmetric gate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-10T19:54:48.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13681" PostTypeId="1" AcceptedAnswerId="13683" CreationDate="2020-09-10T20:47:52.257" Score="1" ViewCount="160" Body="&lt;p&gt;I attempted to &lt;code&gt;execute&lt;/code&gt; a list of &lt;span class=&quot;math-container&quot;&gt;$3200$&lt;/span&gt; &lt;code&gt;QuantumCircuit&lt;/code&gt;s in Qiskit, each with the &lt;code&gt;max_shots&lt;/code&gt; of &lt;span class=&quot;math-container&quot;&gt;$8096$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ibmq_manhattan = provider.get_backend('ibmq_manhattan')&#xA;job = execute(all_qc, backend=ibmq_manhattan, shots=8096)&#xA;job_monitor(job)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and got the following response:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Job Status: job has been cancelled&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Furthermore, I successfully performed the exact same execution locally using the Aer &lt;code&gt;qasm_simulator&lt;/code&gt;. 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?&lt;/p&gt;&#xA;&lt;p&gt;This is a summary of the job on IBMQ:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jSdXz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jSdXz.png&quot; alt=&quot;job summary on IBMQ&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-18T11:08:21.463" LastActivityDate="2020-09-18T11:08:21.463" Title="How to execute many circuits on an IBMQ backend?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13682" PostTypeId="2" ParentId="13681" CreationDate="2020-09-10T21:00:11.800" Score="2" Body="&lt;p&gt;Checkout the backend &lt;code&gt;max_experiments&lt;/code&gt; property. The amount of circuits in a job ( &lt;code&gt;len(all_qc)&lt;/code&gt;) should be smaller than that.&lt;/p&gt;&#xA;&lt;p&gt;For example, in &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;device = provider.get_backend('ibmq_16_melbourne')&#xA;device.configuration().max_experiments&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;75&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-10T21:07:08.803" LastActivityDate="2020-09-10T21:07:08.803" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13683" PostTypeId="2" ParentId="13681" CreationDate="2020-09-10T21:54:36.497" Score="1" Body="&lt;p&gt;If you have more circuits than what the backend allows, consider using &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html#qiskit.providers.ibmq.managed.IBMQJobManager&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBMQJobManager&lt;/a&gt;, which will divide the circuits and collect results for you.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-09-10T21:54:36.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13684" PostTypeId="1" AcceptedAnswerId="13693" CreationDate="2020-09-10T21:59:21.133" Score="0" ViewCount="171" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NLvyT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NLvyT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cjY5L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cjY5L.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a way I can get the similar histogram using the statevector simulator? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="8955" LastEditDate="2020-09-11T08:26:29.417" LastActivityDate="2020-09-11T08:26:29.417" Title="How to plot histogram using statevector simulator?" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;qasm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13685" PostTypeId="2" ParentId="13679" CreationDate="2020-09-10T23:21:37.437" Score="2" Body="&lt;p&gt;The complex number &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}+i\frac{1}{\sqrt{2}}$&lt;/span&gt; shows up in a lot situations. It's a primitive eighth root of unity so it equals &lt;span class=&quot;math-container&quot;&gt;$e^{i \frac{\pi}{4}}$&lt;/span&gt;. Also note that &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is a primitive fourth root of unity, so it equals &lt;span class=&quot;math-container&quot;&gt;$e^{i \frac{\pi}{2}}$&lt;/span&gt;.  So in this case &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi = \frac{3 \pi}{2}$&lt;/span&gt;, which gives this state after pulling out a global phase of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.  Global phases do not impact outcome probabilities, so states are considered equivalent if they are equal up to a global phase.&lt;/p&gt;&#xA;&lt;p&gt;More generally if you suspect an angle is a rational multiple of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, but you aren't sure of the value, you can just enter, for example, &lt;code&gt;acos(1/2^.5)/pi&lt;/code&gt;, or equivalently &lt;code&gt;log(1/2^.5+i/2^.5)/pi&lt;/code&gt;, into your favorite math software, which in this case will spit out &lt;span class=&quot;math-container&quot;&gt;$0.25$&lt;/span&gt; for the first and &lt;span class=&quot;math-container&quot;&gt;$0.25i$&lt;/span&gt; for the second.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-09-10T23:50:20.593" LastActivityDate="2020-09-10T23:50:20.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13686" PostTypeId="1" CreationDate="2020-09-11T01:13:45.600" Score="0" ViewCount="20" Body="&lt;p&gt;In a review paper of decoherence-free subspace(DFS) [1], they consider the spin-boson Hamiltonian and they write&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;the system of qubits could be the spins of N electrons trapped in the periodic potential well of a crystalline lattice. ...  the system-bath interaction has permutation symmetry,...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;in P8. I do not know electron trapped quantum computer. Is this different from ion trapped quantum computer? If there is electron trapped quantum computer, is the assumption &amp;quot;permutation symmetry&amp;quot; is valid?&lt;/p&gt;&#xA;&lt;p&gt;Moreover, is there any other physical system whose noise can be explained by spin-boson Hamiltonian?&lt;/p&gt;&#xA;&lt;p&gt;[1] Lidar, Daniel A. 2014. “Review of Decoherence Free Subspaces, Noiseless Subsystems, and Dynamical Decoupling.” Advances in Chemical Physics 154: 295–354.&lt;/p&gt;&#xA;" OwnerUserId="9894" LastActivityDate="2020-09-11T01:13:45.600" Title="Which type of quantum computer is explained by spin-boson Hamiltonian?" Tags="&lt;physical-realization&gt;&lt;noise&gt;&lt;superconducting-quantum-computing&gt;&lt;ion-trap-quantum-computing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13687" PostTypeId="1" CreationDate="2020-09-11T03:06:08.840" Score="3" ViewCount="84" Body="&lt;p&gt;I do understand the math behind phase kickback. The math makes sense. For more context, I find &lt;a href=&quot;https://eduardsmetanin.github.io/PhaseKickback.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this document&lt;/a&gt; very helpful.&lt;/p&gt;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;&lt;p&gt;Can somebody help to explain this in an intuitive way?&lt;/p&gt;&#xA;" OwnerUserId="13107" LastEditorUserId="55" LastEditDate="2020-09-18T11:06:30.507" LastActivityDate="2020-09-18T11:06:30.507" Title="How to understand intuitively the quantum gate phase kickback?" Tags="&lt;quantum-gate&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13688" PostTypeId="1" CreationDate="2020-09-11T03:28:51.737" Score="0" ViewCount="257" Body="&lt;p&gt;In qiskit, how can I initialise a qubit in a complex state, specifically in the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left|q\right&amp;gt; = \frac{1}{\sqrt2} \left|0\right&amp;gt; + i \frac{1}{\sqrt2} \left|1\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13211" LastEditorUserId="55" LastEditDate="2020-09-18T11:05:51.033" LastActivityDate="2020-09-18T11:05:51.033" Title="How to initialise a qubit in the state $\frac{1}{\sqrt2}(|0\rangle+|1\rangle)$ in qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13689" PostTypeId="1" AcceptedAnswerId="13694" CreationDate="2020-09-11T04:00:23.907" Score="0" ViewCount="56" Body="&lt;p&gt;I am pretty new to Quantum Computing and am not exactly sure what the phase is.&#xA;Could you please explain in terms of the Bloch sphere and point out how to mathematically calculate and represent the phase?&lt;/p&gt;&#xA;" OwnerUserId="10153" LastEditorUserId="9006" LastEditDate="2020-09-11T06:57:48.503" LastActivityDate="2020-09-11T07:08:25.887" Title="What is the phase of state?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13690" PostTypeId="2" ParentId="13688" CreationDate="2020-09-11T06:35:59.633" Score="2" Body="&lt;p&gt;You can generate a general quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in Qiskit by using their Custom package.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.components.initial_states import Custom &#xA;import math &#xA;state_vector = [1, 1j]&#xA;Psi = Custom(1,state_vector = state_vector).construct_circuit()&#xA;Psi.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Running the above code in Qiskit would give you something like below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UaP2C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UaP2C.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;But also notice that your state &lt;span class=&quot;math-container&quot;&gt;$|q\rangle = \dfrac{1}{\sqrt{2}}\big( |0\rangle + i | 1\rangle \big) $&lt;/span&gt; is actually resulting from&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \dfrac{Z + Y}{\sqrt{2}} |0\rangle = |q\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; are the Pauli matrices and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix} $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-11T06:35:59.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13691" PostTypeId="2" ParentId="13684" CreationDate="2020-09-11T06:56:40.323" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-11T06:56:40.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13692" PostTypeId="2" ParentId="13688" CreationDate="2020-09-11T06:57:09.780" Score="2" Body="&lt;p&gt;You can use &lt;code&gt;initialize&lt;/code&gt; function. Here is a code constructing your one qubit state:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, Aer, execute&#xA;import math as m&#xA;&#xA;quantumState = [&#xA;    1 / m.sqrt(2) * complex(1, 0),&#xA;    1 / m.sqrt(2) * complex(0, 1)]&#xA;&#xA;q = QuantumRegister(1, name = 'q')&#xA;c = ClassicalRegister(1, name = 'c')&#xA;&#xA;circuit = QuantumCircuit(q,c)&#xA;&#xA;circuit.initialize(quantumState, [q[0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can prepare multiqubit states as well, for example for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{2}(|00\rangle + |01\rangle+|10\rangle+|11\rangle)$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, Aer, execute&#xA;import math as m&#xA;&#xA;quantumState = [0.5,0.5,0.5,0.5]&#xA;&#xA;q = QuantumRegister(2, name = 'q')&#xA;c = ClassicalRegister(2, name = 'c')&#xA;&#xA;circuit = QuantumCircuit(q,c)&#xA;&#xA;circuit.initialize(quantumState, [q[0],q[1]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-11T06:57:09.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13693" PostTypeId="2" ParentId="13684" CreationDate="2020-09-11T06:59:42.793" Score="2" Body="&lt;p&gt;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.&lt;br /&gt;&#xA;(edit: if there were no measurements the qasm simulator wouldn't work, so you obviously have a measurement happening in your circuit)&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;statevector_simulator&lt;/code&gt; 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 &lt;code&gt;get_counts&lt;/code&gt; method will return something that looks like &lt;code&gt;{'measurement_outcome' : 1}&lt;/code&gt;. However, the &lt;code&gt;qasm_simulator&lt;/code&gt; performs as many measurement shots as you tell it to and aggregates the results in &lt;code&gt;counts&lt;/code&gt;, which makes it useful for plotting histograms.&lt;/p&gt;&#xA;&lt;p&gt;So if you want to plot a histogram and you need to use the &lt;code&gt;statevector_simulator&lt;/code&gt;, remove the measurements from the circuit. If you don't want to mess with the circuit itself, there's a handy method called &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.remove_final_measurements.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;remove_final_measurements&lt;/a&gt; that you can pass to execute as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;execute(qc.remove_final_measurements(inplace=False), backend=simulator)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8955" LastActivityDate="2020-09-11T06:59:42.793" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13694" PostTypeId="2" ParentId="13689" CreationDate="2020-09-11T07:08:25.887" Score="2" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \alpha|0\rangle + \beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;i.e. a superposition of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (&lt;em&gt;you can choose any other two orthogonal state but I think that quantum analogs to 0 and 1 bit are more illustrative&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are complex numbers, so you can write them in exponential form, i.e. &lt;span class=&quot;math-container&quot;&gt;$\alpha = |\alpha|\mathrm{e}^{i\varphi_\alpha}$&lt;/span&gt;, similarly &lt;span class=&quot;math-container&quot;&gt;$\beta= |\beta|\mathrm{e}^{i\varphi_\beta}$&lt;/span&gt;. Now, put this into our definition of qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = |\alpha|\mathrm{e}^{i\varphi_\alpha}|0\rangle + |\beta|\mathrm{e}^{i\varphi_\beta}|1\rangle,&#xA;$$&lt;/span&gt;&#xA;and factor out &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\varphi_\alpha}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \mathrm{e}^{i\varphi_\alpha}[|\alpha||0\rangle + |\beta|\mathrm{e}^{i(\varphi_\beta-\varphi_\alpha)}|1\rangle].&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$\varphi_\alpha$&lt;/span&gt; is called global phase.&lt;/strong&gt; Whole term &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\varphi_\alpha}$&lt;/span&gt; can be neglected as two qubits which differ in global phase only are physically undistinguishable. So, after substituting &lt;span class=&quot;math-container&quot;&gt;$\varphi = \varphi_\beta-\varphi_\alpha$&lt;/span&gt; we are left with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = |\alpha||0\rangle + |\beta|\mathrm{e}^{i\varphi}|1\rangle.&#xA;$$&lt;/span&gt;&#xA;&lt;strong&gt;A parameter &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is called relative phase.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-11T07:08:25.887" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13695" PostTypeId="2" ParentId="13679" CreationDate="2020-09-11T07:29:51.217" Score="3" Body="&lt;p&gt;What you're trying to do is find a parametrisation of the state in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{c} \cos\frac{\theta}{2} \\ \sin\frac{\theta}{2}e^{i\phi} \end{array}\right)&#xA;$$&lt;/span&gt;&#xA;However, you'll notice that the first element &lt;em&gt;is real&lt;/em&gt;, while it isn't in your state, so they cannot be matched. Instead, what is actually going on where is that you require &lt;em&gt;equivalence up to a global phase&lt;/em&gt;. Hence, you should write your state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\left(\begin{array}{c} \frac{1}{\sqrt{2}} \\ \frac{-i}{\sqrt{2}} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;So, now you can try to match up&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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).&#xA;$$&lt;/span&gt;&#xA;From this, you'll see that &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\theta}{2}=\frac{1}{\sqrt{2}}$&lt;/span&gt; and hence &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi/2$&lt;/span&gt;. It then follows that &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}=-i$&lt;/span&gt; and hence &lt;span class=&quot;math-container&quot;&gt;$\phi=3\pi/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-11T07:29:51.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13696" PostTypeId="2" ParentId="13687" CreationDate="2020-09-11T07:39:18.703" Score="3" Body="&lt;p&gt;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-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we divide it up as &amp;quot;if the control qubit is something, do something on the target qubit&amp;quot;. 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.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 0|\otimes I+|1\rangle\langle 1|\otimes Z=I\otimes |0\rangle\langle 0|+Z\otimes|1\rangle\langle 1|&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-11T07:39:18.703" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13697" PostTypeId="1" CreationDate="2020-09-11T07:48:37.487" Score="1" ViewCount="96" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="9006" LastEditDate="2020-09-18T06:51:34.753" LastActivityDate="2020-09-18T06:51:34.753" Title="quantum random number generator implementation in quantum lab" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13698" PostTypeId="1" AcceptedAnswerId="13699" CreationDate="2020-09-11T08:34:48.597" Score="2" ViewCount="170" Body="&lt;p&gt;I am trying to understand the soundness bound reached in Theorem 4 of &lt;a href=&quot;https://arxiv.org/pdf/1510.06750.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, which deals with separating &lt;span class=&quot;math-container&quot;&gt;$QMA$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$QCMA$&lt;/span&gt; with respect to an in-place oracle. To state just the part I am confused with:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;For some fixed integer &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$N = 2^{{n}}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$S \subseteq&#xA; [N^{2}]$&lt;/span&gt; be a set such that &lt;span class=&quot;math-container&quot;&gt;$|S| = N$&lt;/span&gt;. Let&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A = \frac{1}{2^{n}}~~ \Big| \sum_{i \in S} \beta_{i} \Big|^{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$B = \sum_{i \in Z_{even} \cap S} | \beta_{i} |^{2}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where each &lt;span class=&quot;math-container&quot;&gt;$\beta_{i}$&lt;/span&gt; is a complex number, &lt;span class=&quot;math-container&quot;&gt;$[n] = \{1, 2, \ldots,&#xA; n \}$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{i \in [N^{2}]} | \beta_{i} |^{2} = 1.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z_{even}$&lt;/span&gt; is the set of all even integers, where we know that &lt;span class=&quot;math-container&quot;&gt;$|Z_{even} \cap S| = \frac{1}{3} |S|$&lt;/span&gt;. I am trying to prove that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$1 \geq \frac{\sqrt{3A} +(\sqrt{2} - 1)B}{\sqrt{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am stuck after this.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-09-23T09:30:17.103" LastActivityDate="2020-09-23T09:30:17.103" Title="Question regarding soundness bound in QMA versus QCMA separation" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13699" PostTypeId="2" ParentId="13698" CreationDate="2020-09-11T10:35:40.407" Score="3" Body="&lt;p&gt;I'm not entirely convinced that this statement &lt;em&gt;is&lt;/em&gt; true without further constraints.&lt;/p&gt;&#xA;&lt;p&gt;Let me set&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\beta_i=\left\{\begin{array}{cc}&#xA;\sqrt\frac{3x}{2^n} &amp;amp; i\in Z_\text{even}\cap S \\&#xA;\sqrt\frac{3(1-x)}{2^{n+1}}  &amp;amp; i\in Z_\text{odd}\cap S \\&#xA;0 &amp;amp; \text{otherwise}&#xA;\end{array}\right.&#xA;$$&lt;/span&gt;&#xA;These must satisfy the inequality for all &lt;span class=&quot;math-container&quot;&gt;$0\leq x\leq 1$&lt;/span&gt;. This inequality states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{2}\geq \sqrt{x}+\sqrt{2(1-x)}+(\sqrt{2}-1)x.&#xA;$$&lt;/span&gt;&#xA;This is exactly satisfied for &lt;span class=&quot;math-container&quot;&gt;$x=0,1$&lt;/span&gt;, but for any &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in between, it doesn't work. For example, &lt;span class=&quot;math-container&quot;&gt;$x=1/2$&lt;/span&gt; gives the value &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2}+1/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-11T10:35:40.407" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13700" PostTypeId="2" ParentId="13698" CreationDate="2020-09-11T15:03:42.657" Score="2" Body="&lt;p&gt;The correct inequality should be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sqrt{3A} \leq \sqrt{B} + \sqrt{2(1-B)} $$&lt;/span&gt;&#xA;The proof is the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\big| \sum_{i \in S} \beta_i \big| &amp;amp;\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| \\&#xA;&amp;amp; \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}  \\&#xA;&amp;amp; \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}  \\&#xA;&amp;amp; \leq \sqrt{\frac{|S|}{3}} \cdot \sqrt{B} + \sqrt{\frac{2|S|}{3}} \cdot \sqrt{1-B}&#xA;\end{align*}&lt;/span&gt;&#xA;where triangle inequality and the fact that &lt;span class=&quot;math-container&quot;&gt;$ ||x||_1 \leq \sqrt{n} ||x||_2 $&lt;/span&gt; were used in the first two lines.&lt;/p&gt;&#xA;&lt;p&gt;The inequality is tight (see previous answer for an example).&lt;/p&gt;&#xA;&lt;p&gt;Coming back to the original paper, the probability bound in the 'soundness' argument should be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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) $$&lt;/span&gt;&#xA;with maximum value &lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{2} (1 + \frac{1}{\sqrt{3}}) \approx 0,788 $&lt;/span&gt; and the general argument still holds.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-09-11T15:20:48.027" LastActivityDate="2020-09-11T15:20:48.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13701" PostTypeId="1" AcceptedAnswerId="13703" CreationDate="2020-09-11T15:14:26.800" Score="2" ViewCount="76" Body="&lt;p&gt;I am new to quantum gates but do not understand the connection between the &lt;span class=&quot;math-container&quot;&gt;$RX$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates. I know that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R X(\theta)=\exp \left(-i \frac{\theta}{2} X\right)=\left(\begin{array}{cc}&#xA;\cos \frac{\theta}{2} &amp;amp; -i \sin \frac{\theta}{2} \\&#xA;-i \sin \frac{\theta}{2} &amp;amp; \cos \frac{\theta}{2}&#xA;\end{array}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Meanwhile the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X = \left(\begin{array}{cc}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{array}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; such that the two are the same? I see that choosing &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi/2$&lt;/span&gt; gives the result upto an overall factor of &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;. Is that it or is there a deeper connection between the two gates? Is there a similar connection between the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; gates and the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$RZ$&lt;/span&gt; gates such that the rotated gates are more general than the &lt;span class=&quot;math-container&quot;&gt;$X, Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates?&lt;/p&gt;&#xA;" OwnerUserId="13214" LastActivityDate="2020-09-11T16:19:31.283" Title="What is the connection between $RX$ gates and $X$ gates (similar for $Y$ and $Z$)?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13702" PostTypeId="1" CreationDate="2020-09-11T16:15:09.053" Score="1" ViewCount="109" Body="&lt;p&gt;I'm just ttrying to run the simple example code in Google's Cirq startup page:&#xA;&lt;a href=&quot;https://cirq.readthedocs.io/en/stable/google/engine.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cirq.readthedocs.io/en/stable/google/engine.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Code cut/paste from their webpage here:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;import cirq.google as cg&#xA;&#xA;# A simple sample circuit&#xA;qubit = cirq.GridQubit(5, 2)&#xA;circuit = cirq.Circuit(&#xA;    cirq.X(qubit)**0.5,                 # Square root of NOT.&#xA;    cirq.measure(qubit, key='result')   # Measurement.&#xA;)&#xA;&#xA;# Create an Engine object to use.&#xA;# Replace YOUR_PROJECT_ID with the id from your cloud project.&#xA;engine = cg.Engine(project_id=YOUR_PROJECT_ID, proto_version=cg.ProtoVersion.V2)&#xA;&#xA;# Create a sampler from the engine&#xA;sampler = engine.sampler(processor_id='PROCESSOR_ID', gate_set=cg.SYC_GATESET)&#xA;&#xA;# This will run the circuit and return the results in a 'TrialResult'&#xA;results = sampler.run(circuit, repetitions=1000)&#xA;&#xA;# Sampler results can be accessed several ways&#xA;&#xA;# For instance, to see the histogram of results&#xA;print(results.histogram(key='result'))&#xA;&#xA;# Or the data itself&#xA;print(results.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13104" LastEditorUserId="55" LastEditDate="2020-09-18T11:03:32.907" LastActivityDate="2020-09-18T11:03:32.907" Title="Running Google Cirq example code from their webpage -- where do I find information about PROCESSOR_ID?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13703" PostTypeId="2" ParentId="13701" CreationDate="2020-09-11T16:19:31.283" Score="2" Body="&lt;p&gt;You're almost correct - choosing &lt;span class=&quot;math-container&quot;&gt;$ \theta = \pi$&lt;/span&gt; does yield &lt;span class=&quot;math-container&quot;&gt;$$ \begin{bmatrix} 0 &amp;amp; -i \\ -i &amp;amp; 0 \end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because this differs from the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate by a constant factor global phase (&lt;span class=&quot;math-container&quot;&gt;$ -i$&lt;/span&gt;), the gates are equivalent. (See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12448/understanding-global-phase&quot;&gt;here&lt;/a&gt; to learn more about the global phase).&lt;/p&gt;&#xA;&lt;p&gt;This connection holds similarly for &lt;span class=&quot;math-container&quot;&gt;$ RY$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$RZ$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. A way to visualize this is the Bloch sphere: in essence, these gates are rotations about the &lt;span class=&quot;math-container&quot;&gt;$X, Y, Z$&lt;/span&gt; axes (respectively):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DjkNh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DjkNh.png&quot; alt=&quot;Bloch sphere&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So essentially our Pauli primitives are &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; rotations over the respective axis.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-11T16:19:31.283" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13704" PostTypeId="2" ParentId="13702" CreationDate="2020-09-11T16:41:16.233" Score="1" Body="&lt;p&gt;Do you have access specifically given by Google? See the second paragraph in the link you sent:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Note that the Quantum Engine API is not yet open for public access.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Likely their chips are only being used for internal testing now, and the docs are being prepped for public release / public chip access.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-11T16:41:16.233" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13705" PostTypeId="1" AcceptedAnswerId="13706" CreationDate="2020-09-11T19:00:38.293" Score="-1" ViewCount="25" Body="&lt;p&gt;Here is my code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import qiskit&#xA;from qiskit import *&#xA;&#xA;&#xA;number_of_qubits = 3&#xA;backend_sim = Aer.get_backend('qasm_simulator')&#xA;&#xA;#Generate a circuit in qiskit&#xA;input_circuit = QuantumCircuit(number_of_qubits, number_of_qubits)&#xA;input_circuit.x(0)&#xA;input_circuit.h(1)&#xA;input_circuit.cx(0,1)&#xA;input_circuit.i(1) &#xA;input_circuit.x(1)&#xA;&#xA;job_sim = execute(input_circuit, backend_sim, shots=1024)&#xA;result_sim = job_sim.result()&#xA;counts = result_sim.get_counts(input_circuit)&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;No matter what gates I try (e.g. I can remove the last X gate), the result is always &lt;code&gt;'000': 1024&lt;/code&gt;. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-09-11T19:25:08.617" Title="Qiskit job not giving the right result after execution" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13706" PostTypeId="2" ParentId="13705" CreationDate="2020-09-11T19:16:06.943" Score="1" Body="&lt;p&gt;Your current circuit looks like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NquYB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NquYB.png&quot; alt=&quot;example circuit without measurements&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to get the &amp;quot;counts&amp;quot;, you need to measure at the end of the circuit, before &lt;code&gt;execute&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;input_circuit.measure(range(number_of_qubits), range(number_of_qubits))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q3FNb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q3FNb.png&quot; alt=&quot;Example circuit with measurements&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-11T19:25:08.617" LastActivityDate="2020-09-11T19:25:08.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13707" PostTypeId="1" AcceptedAnswerId="13709" CreationDate="2020-09-11T20:26:27.123" Score="0" ViewCount="146" Body="&lt;p&gt;When using qiskit &lt;a href=&quot;https://qiskit.org/documentation/apidoc/execute.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;execute&lt;/code&gt;&lt;/a&gt; it is possible to stipulate the number of &lt;code&gt;shots&lt;/code&gt; for each experiment/&lt;code&gt;QuantumCircuit&lt;/code&gt;, however when using &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;IBMJobManager&lt;/code&gt;&lt;/a&gt; this is seemingly not possible.&lt;/p&gt;&#xA;&lt;p&gt;Is this correct and if so how many &lt;code&gt;shots&lt;/code&gt; are executed by default? and if not how can the number of &lt;code&gt;shots&lt;/code&gt; be specified?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2020-09-11T21:47:55.957" Title="How many shots are executed when using the IBMQJobManager?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13708" PostTypeId="2" ParentId="13702" CreationDate="2020-09-11T20:29:16.447" Score="2" Body="&lt;p&gt;There is a method &lt;code&gt;list_processors&lt;/code&gt; on the engine object that will return a list of processor objects which include a processor id:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for p in engine.list_processors():&#xA;    print(p.processor_id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;em&gt;watch&lt;/em&gt; someone using the service (plus some neat hardware build stuff) you can watch the second half of the &lt;a href=&quot;https://youtu.be/crpQexwT2HU?t=665&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Google's Quantum Computing Service&amp;quot; presentation at the 2020 quantum summer symposium&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-09-11T20:29:16.447" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13709" PostTypeId="2" ParentId="13707" CreationDate="2020-09-11T21:31:05.147" Score="1" Body="&lt;p&gt;You can specify &lt;code&gt;IBMQJobManager.run(shots=my_shots)&lt;/code&gt;. See &lt;code&gt;run_config&lt;/code&gt; in &lt;code&gt;IBMQJobManager.run()&lt;/code&gt; documentation: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.run.html#qiskit.providers.ibmq.managed.IBMQJobManager.run&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.run.html#qiskit.providers.ibmq.managed.IBMQJobManager.run&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The default is 1024 or the maximum allowed by the backend, whichever is smaller.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-09-11T21:31:05.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13710" PostTypeId="2" ParentId="13707" CreationDate="2020-09-11T21:47:55.957" Score="1" Body="&lt;p&gt;When using execute in qiskit, you can specify how many shots you want done for a circuit in the following way:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#for a defined circuit and backend&#xA;job = execute(circuit, backend, shots=___)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#for a defined list of circuits and backend&#xA;circuits = transpile(circuit, backend)&#xA;job = IBMQJobManager().run(circuits, backend, shots = ___)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where the range for the possible number of shots is the same as that for execute. More information about IBMQJobManager can be found here: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html#qiskit.providers.ibmq.managed.IBMQJobManager&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html#qiskit.providers.ibmq.managed.IBMQJobManager&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, the default number of shots on any job run on an IBMQ backend is 1024.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-11T21:47:55.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13711" PostTypeId="1" AcceptedAnswerId="13712" CreationDate="2020-09-11T21:50:50.783" Score="0" ViewCount="27" Body="&lt;p&gt;According to the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.ManagedResults.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;ManagedResults Documentation&lt;/a&gt; the class has a &lt;code&gt;combine_results&lt;/code&gt; method, however when attempting to use it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_set = IBMQJobManager().run(circs, backend=ibmq_backend, name='job-set-abc')&#xA;job_results = job_set.results()&#xA;job_results_combined = job_results.combine_results() # fails on this line&#xA;job_counts_combined = job_results_combined.get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get the following error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;AttributeError: 'ManagedResults' object has no attribute 'combine_results'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Furthermore, the &lt;code&gt;combine_results&lt;/code&gt; method is not listed under &lt;code&gt;help(type(job_results))&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;p&gt;Does this mean that the method has been deprecated? If so how can I overcome this?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2020-09-11T23:01:01.437" Title="Is the combine_results method deprecated in qiskit v0.20.0" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13712" PostTypeId="2" ParentId="13711" CreationDate="2020-09-11T23:01:01.437" Score="0" Body="&lt;p&gt;It's still there. See the source code: &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/blob/stable/0.8/qiskit/providers/ibmq/managed/managedresults.py#L178&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ibmq-provider/blob/stable/0.8/qiskit/providers/ibmq/managed/managedresults.py#L178&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are you using the right version of &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt;? &lt;code&gt;combine_results&lt;/code&gt; was introduced in 0.8.&lt;/p&gt;&#xA;&lt;p&gt;If you do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;print(qiskit.__qiskit_version__)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;it'll show you the version of each element.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-09-11T23:01:01.437" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13713" PostTypeId="1" CreationDate="2020-09-12T02:58:29.043" Score="1" ViewCount="48" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;This occurs on different IBM machines and QASM simulators. What causes these differences?&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-09-15T16:21:51.277" LastActivityDate="2020-09-15T16:21:51.277" Title="What causes the random variations in the probabilities with respect to the theoretical values, in IBM and QASM simulators?" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;noise&gt;&lt;qasm&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13714" PostTypeId="1" CreationDate="2020-09-12T09:10:31.277" Score="1" ViewCount="63" Body="&lt;p&gt;I am going through the QAOA section in the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/qaoa.html#5.2-Optimal-trial-state-parameters&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Textbook - QAOA&lt;/a&gt; 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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qg5CQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qg5CQ.png&quot; alt=&quot;QAOA Doubt&quot; /&gt;&lt;/a&gt;&#xA;I have done some digging and have read other useful posts like &lt;a href=&quot;https://www.mustythoughts.com/quantum-approximate-optimization-algorithm-explained&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Approximate Optimization Algorithm explained&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13056/how-to-do-the-direct-evaluation-by-hand-in-qaoa-algorithm&quot;&gt;How to do the direct evaluation by hand in QAOA algorithm&lt;/a&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="13221" LastActivityDate="2020-09-12T09:10:31.277" Title="Deriving Expression For QAOA Optimal Trial State Parameters" Tags="&lt;qiskit&gt;&lt;mathematics&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13715" PostTypeId="1" CreationDate="2020-09-12T09:35:11.837" Score="1" ViewCount="54" Body="&lt;p&gt;what is the significance of varying the number of shots while running a circuit in a quantum machine and qasm simulator?&lt;/p&gt;&#xA;&lt;p&gt;Does more number of shots give better/accurate result?&#xA;I am running a simple 2 qubit measurement circuit after Hadamard gates on both qubits.&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-09-15T16:20:28.430" LastActivityDate="2020-09-15T16:20:28.430" Title="What is the significance of varying the number of shots while running a circuit in a quantum machine and qasm simulator?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13716" PostTypeId="2" ParentId="13715" CreationDate="2020-09-12T10:09:56.873" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-09-12T10:09:56.873" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13718" PostTypeId="1" AcceptedAnswerId="13722" CreationDate="2020-09-12T12:17:10.503" Score="1" ViewCount="34" Body="&lt;p&gt;We know for a pure state conversion &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \rightarrow_\textrm{LOCC} |\phi \rangle$&lt;/span&gt; via local operation and classical communication (LOCC), an entanglement monotone should not increase, that is, &lt;span class=&quot;math-container&quot;&gt;$E(|\psi \rangle) \geq E(|\phi \rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Say for a pure to mixed state conversion &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \rightarrow_\textrm{LOCC} \rho$&lt;/span&gt; given by the unique ensemble &lt;span class=&quot;math-container&quot;&gt;$l = \{ q_l, |\xi_l \rangle \}  \in \mathcal{D}$&lt;/span&gt; fixed by pointer states (which are omitted), where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}$&lt;/span&gt; is the set of all decompositions for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Naturally, the convex roof extension &lt;span class=&quot;math-container&quot;&gt;$E_\textrm{min}(\rho) = \min_\mathcal{D} \Sigma_i q_i |\xi_i \rangle \langle \xi_i|$&lt;/span&gt; should not increase, nor should that of the obtained ensemble &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; on average, i.e., &lt;span class=&quot;math-container&quot;&gt;$E(|\psi \rangle) \geq E_l(\rho) \geq E_\textrm{min}(\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, is it for certain there is not some decomposition &lt;span class=&quot;math-container&quot;&gt;$j = \{ q_j, |\xi_j \rangle \}$&lt;/span&gt; that violates the nonincreasing criterion for &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; on average, i.e., &lt;span class=&quot;math-container&quot;&gt;$E_j(|\rho \rangle) \geq E(\psi \rangle)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13204" LastEditorUserId="13204" LastEditDate="2020-09-12T19:34:07.597" LastActivityDate="2020-09-12T19:34:07.597" Title="Is entanglement nonincreasing on average by local operations for all possible ensemble decompositions?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13719" PostTypeId="1" CreationDate="2020-09-12T15:32:31.450" Score="3" ViewCount="62" Body="&lt;p&gt;Suppose Alice and Bob share the quantum state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|x\rangle + (-1)^b |y\rangle)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$x\neq y \in \{0,1\}^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b \in \{0,1\}$&lt;/span&gt;. They both do not know &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt;, and use some middlemen who wishes to learn &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. They are allowed to send only classical messages to him (i.e. not quantum states). The marginal density matrix of Alice, for example, is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A = tr_B(\rho_{AB}) = \frac{1}{2}( |x_1\rangle \langle x_1| +|y_1\rangle \langle y_1| &#xA;+ (-1)^b |x_1 \rangle \langle y_1| \cdot \langle x_2 | y_2 \rangle &#xA;+ (-1)^b |y_1 \rangle \langle x_1| \cdot \langle y_2 | x_2 \rangle &#xA;)&#xA;$$&lt;/span&gt;&#xA;Note that when &lt;span class=&quot;math-container&quot;&gt;$x_2 \neq y_2$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; does not depends on &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Moreover, if also &lt;span class=&quot;math-container&quot;&gt;$x_1 \neq y_1$&lt;/span&gt;, from symmetry arguments, &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; does not depends on &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&#xA;In such case, it seems to me that they can not send any data to the middleman (such as measurements), to help him deduce &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, as the marginal density matrix, i.e. their personal view of the system, is oblivous of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Is it correct to say so?&lt;/p&gt;&#xA;&lt;p&gt;Of course when &lt;span class=&quot;math-container&quot;&gt;$x_2 = y_2$&lt;/span&gt; for example, then Alice marginal density matrix does depends on &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, and she can apply Hadamard gate + measure, to obtain exactly &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, and send it to the middleman.&lt;/p&gt;&#xA;" OwnerUserId="13152" LastEditorUserId="55" LastEditDate="2020-09-15T16:18:36.370" LastActivityDate="2020-09-16T07:09:32.127" Title="Can Alice and Bob distinguish entangled state coefficients?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13720" PostTypeId="1" AcceptedAnswerId="13721" CreationDate="2020-09-12T17:39:23.393" Score="1" ViewCount="81" Body="&lt;p&gt;It seems like I can use &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.random.random_circuit.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.random.random_circuit.html&lt;/a&gt; but I would like to control the gates that are allowed.&lt;/p&gt;&#xA;&lt;p&gt;What is an efficient way to make random circuits with a fixed set of gates?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-09-18T09:48:59.033" LastActivityDate="2020-09-18T09:48:59.033" Title="Is there a way to generate random circuits in qiskit with only certain allowed gates?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13721" PostTypeId="2" ParentId="13720" CreationDate="2020-09-12T18:09:00.777" Score="1" Body="&lt;p&gt;I think you should &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/new/choose&quot; rel=&quot;nofollow noreferrer&quot;&gt;report of &amp;quot;feature request&amp;quot; issue&lt;/a&gt; if you have a good use case for this. It should not be hard to implement and I could help with it.&lt;/p&gt;&#xA;&lt;p&gt;If by any chance your fixed set of gates is based on the amount of qubits involved in gate, you can control that with &lt;code&gt;max_operands&lt;/code&gt;. For example, you can  exclude &lt;code&gt;CCXGate&lt;/code&gt; and &lt;code&gt;CSwapGate&lt;/code&gt; (3-qubit operands) with &lt;code&gt;max_operand=2&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If this is not the case, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/7bc7f08bf64aa686694467e8f8be551e0b740213/qiskit/circuit/random/utils.py#L30&quot; rel=&quot;nofollow noreferrer&quot;&gt;the source code for &lt;code&gt;random_circuit&lt;/code&gt;&lt;/a&gt; seems straightforward to modify for your need. You can remove or add the gates from &lt;code&gt;*_q_ops&lt;/code&gt; and &lt;code&gt;*_param&lt;/code&gt; variables on top.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def random_circuit(num_qubits, depth, max_operands=3, measure=False,&#xA;                   conditional=False, reset=False, seed=None):&#xA;    &#xA;    if max_operands &amp;lt; 1 or max_operands &amp;gt; 3:&#xA;        raise CircuitError(&amp;quot;max_operands must be between 1 and 3&amp;quot;)&#xA;&#xA;    one_q_ops = [IGate, U1Gate, U2Gate, U3Gate, XGate, YGate, ZGate,&#xA;                 HGate, SGate, SdgGate, TGate, TdgGate, RXGate, RYGate, RZGate]&#xA;    one_param = [U1Gate, RXGate, RYGate, RZGate, RZZGate, CU1Gate, CRZGate]&#xA;    two_param = [U2Gate]&#xA;    three_param = [U3Gate, CU3Gate]&#xA;    two_q_ops = [CXGate, CYGate, CZGate, CHGate, CRZGate,&#xA;                 CU1Gate, CU3Gate, SwapGate, RZZGate]&#xA;    three_q_ops = [CCXGate, CSwapGate]&#xA;&#xA;    qr = QuantumRegister(num_qubits, 'q')&#xA;    qc = QuantumCircuit(num_qubits)&#xA;&#xA;    if measure or conditional:&#xA;        cr = ClassicalRegister(num_qubits, 'c')&#xA;        qc.add_register(cr)&#xA;&#xA;    if reset:&#xA;        one_q_ops += [Reset]&#xA;&#xA;    if seed is None:&#xA;        seed = np.random.randint(0, np.iinfo(np.int32).max)&#xA;    rng = np.random.default_rng(seed)&#xA;&#xA;    # apply arbitrary random operations at every depth&#xA;    for _ in range(depth):&#xA;        # choose either 1, 2, or 3 qubits for the operation&#xA;        remaining_qubits = list(range(num_qubits))&#xA;        while remaining_qubits:&#xA;            max_possible_operands = min(len(remaining_qubits), max_operands)&#xA;            num_operands = rng.choice(range(max_possible_operands)) + 1&#xA;            rng.shuffle(remaining_qubits)&#xA;            operands = remaining_qubits[:num_operands]&#xA;            remaining_qubits = [q for q in remaining_qubits if q not in operands]&#xA;            if num_operands == 1:&#xA;                operation = rng.choice(one_q_ops)&#xA;            elif num_operands == 2:&#xA;                operation = rng.choice(two_q_ops)&#xA;            elif num_operands == 3:&#xA;                operation = rng.choice(three_q_ops)&#xA;            if operation in one_param:&#xA;                num_angles = 1&#xA;            elif operation in two_param:&#xA;                num_angles = 2&#xA;            elif operation in three_param:&#xA;                num_angles = 3&#xA;            else:&#xA;                num_angles = 0&#xA;            angles = [rng.uniform(0, 2 * np.pi) for x in range(num_angles)]&#xA;            register_operands = [qr[i] for i in operands]&#xA;            op = operation(*angles)&#xA;&#xA;            # with some low probability, condition on classical bit values&#xA;            if conditional and rng.choice(range(10)) == 0:&#xA;                value = rng.integers(0, np.power(2, num_qubits))&#xA;                op.condition = (cr, value)&#xA;&#xA;            qc.append(op, register_operands)&#xA;&#xA;    if measure:&#xA;        qc.measure(qr, cr)&#xA;&#xA;    return qc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-13T00:19:06.013" LastActivityDate="2020-09-13T00:19:06.013" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13722" PostTypeId="2" ParentId="13718" CreationDate="2020-09-12T18:52:41.947" Score="1" Body="&lt;p&gt;You don't even define &lt;span class=&quot;math-container&quot;&gt;$E_j(\rho)$&lt;/span&gt;. This makes your question hard to answer.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-09-12T18:52:41.947" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13723" PostTypeId="1" AcceptedAnswerId="13724" CreationDate="2020-09-12T20:33:05.390" Score="3" ViewCount="264" Body="&lt;p&gt;I have two circuits that I believe are equivalent. How can one check this on qiskit? Currently, I am executing both circuits and verifying that the counts are close (which they are) but I would like to be more precise. Here is my code where &lt;code&gt;circ&lt;/code&gt; is the quantum circuit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, QuantumCircuit, execute&#xA;.&#xA;.&#xA;.&#xA;&#xA;backend_sim = Aer.get_backend('qasm_simulator')&#xA;job_sim = execute(circ, backend_sim, shots=1000)&#xA;result_sim = job_sim.result()&#xA;counts = result_sim.get_counts(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is there a cleaner way to do this e.g. compare the unitaries of the two circuits, and if yes how? Of course, they are only the same up to a global phase so how to show equivalence isn't clear to me.&lt;/p&gt;&#xA;" OwnerUserId="13222" LastEditorUserId="55" LastEditDate="2020-09-18T09:49:10.427" LastActivityDate="2020-09-18T09:49:10.427" Title="Test equivalence of circuits exactly on qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13724" PostTypeId="2" ParentId="13723" CreationDate="2020-09-12T21:53:27.067" Score="1" Body="&lt;p&gt;As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13723/test-equivalence-of-circuits-exactly-on-qiskit/13724?noredirect=1#comment18445_13724&quot;&gt;it is point out&lt;/a&gt;, depends on your notion of equivalence.&lt;/p&gt;&#xA;&lt;h2&gt;State vectors&lt;/h2&gt;&#xA;&lt;p&gt;Two circuits are equivalent upto global phase if they represent the same state vector. Consider the following two circuits:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;import numpy as np&#xA;&#xA;qc1 = QuantumCircuit(2)&#xA;qc1.h(0)&#xA;qc1.cx(0,1)&#xA;&#xA;qc2 = QuantumCircuit(2)&#xA;qc2.u2(0, np.pi, 0)&#xA;qc2.cx(0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It is possible to check if their state vector is the same with the Qiskit &lt;code&gt;qiskit.quantum_info&lt;/code&gt; module:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Statevector&#xA;Statevector.from_instruction(qc1).equiv(Statevector.from_instruction(qc2)) # True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;Unitary matrices&lt;/h2&gt;&#xA;&lt;p&gt;If you need to consider global phase, in that case you need to compare their unitary matrices via simulation.&lt;/p&gt;&#xA;&lt;p&gt;In the following case:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc1 = QuantumCircuit(1)&#xA;qc1.x(0)&#xA;&#xA;qc2 = QuantumCircuit(1)&#xA;qc2.rx(np.pi, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;These circuit has the same state vector, but not the same unitary:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Statevector.from_instruction(qc1).equiv(Statevector.from_instruction(qc2))  # True&#xA;&#xA;backend_sim = Aer.get_backend('unitary_simulator')&#xA;job_sim = execute([qc1, qc2], backend_sim)&#xA;result_sim = job_sim.result()&#xA;unitary1 = result_sim.get_unitary(qc1)&#xA;unitary2 = result_sim.get_unitary(qc2)&#xA;&#xA;np.allclose(unitary1, unitary2)  # False&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;Counts&lt;/h2&gt;&#xA;&lt;p&gt;If your circuits have measurements, you probably want to consider these to circuits equivalent, since their measured results are equivalent.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc1 = QuantumCircuit(2,2)&#xA;qc1.h(0)&#xA;qc1.measure(0,0)&#xA;qc1.measure(1,1)&#xA;&#xA;qc2 = QuantumCircuit(2,2)&#xA;qc2.h(0)&#xA;qc2.swap(0,1)&#xA;qc2.measure(0,1)&#xA;qc2.measure(1,0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case, you want to compare their result counts, considering some statistical error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend_sim = Aer.get_backend('qasm_simulator')&#xA;job_sim = execute([qc1, qc2], backend_sim, shots=1000)&#xA;result_sim = job_sim.result()&#xA;counts1 = result_sim.get_counts(qc1)&#xA;counts2 = result_sim.get_counts(qc2)&#xA;print(counts1, counts2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;Up to Ancillas&lt;/h2&gt;&#xA;&lt;p&gt;You might want to consider these two circuits equivalent:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc1 = QuantumCircuit(3)&#xA;qc1.x(0)&#xA;&#xA;qc2 = QuantumCircuit(1)&#xA;qc2.rx(np.pi, 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13723/test-equivalence-of-circuits-exactly-on-qiskit/13724?noredirect=1#comment18456_13724&quot;&gt;It was suggested&lt;/a&gt; to invert one of them, compose them (wiring the ancillas) and check if it is the identity. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator&#xA;&#xA;composed = qc1.compose(qc2.inverse(), qubits=range(len(qc2.qubits)))&#xA;Operator(composed).equiv(Operator.from_label('I'*len(qc1.qubits))) # True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-13T14:03:53.827" LastActivityDate="2020-09-13T14:03:53.827" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13725" PostTypeId="1" CreationDate="2020-09-12T23:29:29.683" Score="0" ViewCount="237" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_{1}|0\rangle_{2} \langle0|_{1}\langle0|_{2}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;So I'm asking 2 questions here-&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How do I define a projector operator like this in qiskit&lt;/li&gt;&#xA;&lt;li&gt;How do I apply that operator to a state that I have measured with a state vector simulator?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="7706" LastEditorUserId="7706" LastEditDate="2020-09-13T09:35:16.247" LastActivityDate="2020-09-17T19:19:32.090" Title="How to code a projector operator in qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-operation&gt;&lt;gate-synthesis&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13728" PostTypeId="1" CreationDate="2020-09-13T10:11:34.263" Score="-1" ViewCount="667" Body="&lt;p&gt;When I run the following command&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;for my circuit qc, I get this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ImportError: The class MatplotlibDrawer needs pylatexenc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How do I address this issue? Below an image of my problem&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PNkUf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PNkUf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; ------ &lt;br /&gt;&#xA;Installation steps on Google Colaboratoy: &lt;br /&gt;&#xA;&lt;code&gt;!pip install pylatexenc ?&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The installation attempt (was successful and the installed &lt;code&gt;pylatexenc&lt;/code&gt;  has version &lt;code&gt;2.7&lt;/code&gt;.)&lt;/p&gt;&#xA; &#xA;" OwnerUserId="8527" LastEditorUserId="13132" LastEditDate="2020-09-18T10:40:20.860" LastActivityDate="2020-12-08T11:22:52.370" Title="Google Colab - ImportError: The class MatplotlibDrawer needs pylatexenc" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="4" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="13731" PostTypeId="1" CreationDate="2020-09-13T13:52:37.263" Score="0" ViewCount="208" Body="&lt;p&gt;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!)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v0Bo9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v0Bo9.png&quot; alt=&quot;Binary Tree State Vector&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now what's interesting is that if you start with a state vector of |0&amp;gt;, placing qubits into superposition opens paths in the tree, while entanglement and &amp;quot;measurement&amp;quot; close paths. I was working this out with the sudoku example in the qiskit textbook at &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html#sudoku&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Grover's Algorithm Example&lt;/a&gt;, 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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start with a linear tree with every bit in the 0 state.&lt;/li&gt;&#xA;&lt;li&gt;Place a single variable qubit into superposition, creating a single sub-tree/branch.&lt;/li&gt;&#xA;&lt;li&gt;Apply all CNOT gates related to that qubit to close off any potential branching and adjust the states of the nodes appropriately.&lt;/li&gt;&#xA;&lt;li&gt;Whenever a &amp;quot;clause bit&amp;quot; (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 &amp;quot;clause bit&amp;quot; in a position of 1.&lt;/li&gt;&#xA;&lt;li&gt;Place the next variable qubit into superposition and repeat 3 &amp;amp; 4, until all variable qubits have been placed into superposition.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So, the circuit design would look like this (forget about the diffuser and toffoli for the moment):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8dZHv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8dZHv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yHHXs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yHHXs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iUnhI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iUnhI.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VnCMj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VnCMj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;P.S. Could this answer P = NP?&#xA;Also I noticed my quantum circuit isn't quite correct.&lt;/p&gt;&#xA;" OwnerUserId="13230" LastEditorUserId="13230" LastEditDate="2020-09-14T00:52:50.177" LastActivityDate="2020-09-14T00:52:50.177" Title="Can one use a quantum circuit as a pathfinding algorithm?" Tags="&lt;algorithm&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="14" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13732" PostTypeId="1" AcceptedAnswerId="13743" CreationDate="2020-09-13T15:14:15.673" Score="1" ViewCount="89" Body="&lt;p&gt;Let's say I have two arbitrary quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. I apply the SWAP test circuit (something like what is given &lt;a href=&quot;https://sites.cs.ucsb.edu/%7Evandam/teaching/S05_CS290/week9.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), and measure the first qubit to get either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Is there any way to get back the states  &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, in an unentangled form, after this measurement? From what I understand, measuring the output entangles the two states.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2020-09-14T09:13:11.637" Title="Question on output of SWAP test" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13733" PostTypeId="1" CreationDate="2020-09-13T18:39:37.790" Score="-1" ViewCount="147" Body="&lt;p&gt;Using Python how can I implement a quantum circuit that returns &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; using only &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$RX$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; gates, starting with random parametric gates as parameters and optimizing it using gradient descent or other optimization algorithm?&lt;/p&gt;&#xA;" OwnerUserId="8344" LastEditorUserId="55" LastEditDate="2020-09-15T16:13:42.320" LastActivityDate="2020-09-15T16:13:42.320" Title="Implementing a circuit that returns $|01\rangle$ and $|10\rangle$ with equal probability" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;optimization&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13734" PostTypeId="2" ParentId="13733" CreationDate="2020-09-13T18:46:53.243" Score="2" Body="&lt;p&gt;One potential combo is &lt;span class=&quot;math-container&quot;&gt;$ RY(\theta)$&lt;/span&gt; on qubit 1, &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; from qubit 1 to qubit 2, then &lt;span class=&quot;math-container&quot;&gt;$RX(\pi)$&lt;/span&gt; on qubit 2. This would be the following transformation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This could be implemented in Python with QISKit/Q#/etc.&lt;/p&gt;&#xA;&lt;p&gt;(Matrices for &lt;span class=&quot;math-container&quot;&gt;$RX$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt;: &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rx&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rx&lt;/a&gt; / &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-13T18:46:53.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13735" PostTypeId="1" CreationDate="2020-09-13T19:55:39.840" Score="2" ViewCount="29" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12971" LastEditorUserId="9006" LastEditDate="2020-09-14T06:08:48.317" LastActivityDate="2020-09-14T07:19:43.420" Title="Splitting a quantum task between multiple devices" Tags="&lt;algorithm&gt;&lt;noise&gt;&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13736" PostTypeId="1" CreationDate="2020-09-13T23:08:23.630" Score="1" ViewCount="76" Body="&lt;p&gt;What would be measured if you measure two entangled qubits at exactly the same time?&lt;/p&gt;&#xA;" OwnerUserId="13234" LastEditorUserId="55" LastEditDate="2020-09-15T12:33:40.630" LastActivityDate="2020-09-15T12:33:40.630" Title="What would be measured if you measure two entangled qubits at exactly the same time?" Tags="&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13737" PostTypeId="2" ParentId="13736" CreationDate="2020-09-13T23:36:25.060" Score="4" Body="&lt;p&gt;The same thing as if you hadn't. The ordering of independent measurements never matters, entanglement or no entanglement.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-09-13T23:36:25.060" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13739" PostTypeId="1" AcceptedAnswerId="13744" CreationDate="2020-09-14T04:11:34.930" Score="1" ViewCount="53" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; be the set of all correctable errors and &lt;span class=&quot;math-container&quot;&gt;$E_a, E_b \in E$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert c_1\rangle, \vert c_2\rangle, \ldots \vert c_k\rangle\rbrace$&lt;/span&gt; be the basis of codewords in the codespace. It is necessary that &lt;span class=&quot;math-container&quot;&gt;$$ \langle c_i \vert E^{\dagger}_{a}E_b \vert c_j\rangle = 0, \tag{1}$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$i, j \in \lbrace 1, 2, \ldots, k \rbrace \;\land i \neq j$&lt;/span&gt;. This is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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}$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$i, j \in \lbrace 1, 2, \ldots, k \rbrace$&lt;/span&gt;. Equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; can be combined as (Knill and Laflamme)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \langle c_i \vert E^{\dagger}_{a}E_b \vert c_j\rangle = C_{ab} \delta_{ij},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$C_{ab} \in \mathbb{C}$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$\delta_{ij} = \begin{cases} 1 \text{ if }\, i = j, \\0 \text{ if }\, i \neq j.&#xA;\end{cases}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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)^*,$$&lt;/span&gt;&#xA;for all the codewords in the codespace, we can write &lt;span class=&quot;math-container&quot;&gt;$C_{ab}$&lt;/span&gt; as a Hermitian matrix.&lt;/p&gt;&#xA;&lt;p&gt;The source of the above can be found in &lt;a href=&quot;https://core.ac.uk/download/pdf/159785607.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2.1.3 Criteria for quantum error correction (page 11)&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;I cannot figure out how equations &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; are equivalent&lt;/strong&gt;. My humble explanation suggests that for &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, they are equivalent since &lt;span class=&quot;math-container&quot;&gt;$E^{\dagger}_a E_b$&lt;/span&gt; would cancel out to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and we are left with &lt;span class=&quot;math-container&quot;&gt;$\langle c_i\vert c_j \rangle = 0$&lt;/span&gt;, since they are orthogonal. For &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$E^{\dagger}_a E_b$&lt;/span&gt; would cancel out to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and we are left with &lt;span class=&quot;math-container&quot;&gt;$\langle c_i\vert c_i \rangle = \langle c_j\vert c_j \rangle = 1$&lt;/span&gt;, since we are projecting a state on itself.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;How can we convert &lt;span class=&quot;math-container&quot;&gt;$C_{ab}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; or something else)?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Links to questions two, how would &lt;span class=&quot;math-container&quot;&gt;$\delta_{ij}$&lt;/span&gt; affect the matrix?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 :).&lt;/p&gt;&#xA;" OwnerUserId="7528" LastActivityDate="2020-09-14T21:24:47.183" Title="Obtaining hermitian matrix using Knill and Laflamme condition?" Tags="&lt;mathematics&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13740" PostTypeId="1" CreationDate="2020-09-14T06:35:36.030" Score="3" ViewCount="128" Body="&lt;p&gt;I wanted to implement a non-unitary operation. I came to know that I can do it as a linear combination of unitaries &lt;a href=&quot;https://arxiv.org/abs/1811.11184&quot; rel=&quot;nofollow noreferrer&quot;&gt;from this paper&lt;/a&gt; (&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.99.032331&quot; rel=&quot;nofollow noreferrer&quot;&gt;published version&lt;/a&gt;). Let us say I want to implement an operation like &lt;span class=&quot;math-container&quot;&gt;$\alpha_1 A_1 + i \alpha_2 A_2$&lt;/span&gt; in a quantum circuit,&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_2$&lt;/span&gt; and unitary operators. Coeffient &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; are real. How do you do that&lt;/p&gt;&#xA;" OwnerUserId="13236" LastEditorUserId="55" LastEditDate="2020-09-15T12:34:56.663" LastActivityDate="2020-09-16T06:39:42.007" Title="How to implement linear combination of two unitary gates in a quantum circuit?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13741" PostTypeId="2" ParentId="13735" CreationDate="2020-09-14T07:19:43.420" Score="2" Body="&lt;p&gt;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 &lt;em&gt;can&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;In fact, this is what some practical implementations (specifically, ion traps, see &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/12/3/033031/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) 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 &lt;em&gt;can&lt;/em&gt; be done whatever circuit you supply, and circuit optimisations are going to be very specific to a given implementation.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-14T07:19:43.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13742" PostTypeId="2" ParentId="13740" CreationDate="2020-09-14T07:37:42.160" Score="3" Body="&lt;p&gt;The place where I came to know about this technique was &lt;a href=&quot;https://arxiv.org/abs/1501.01715&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, which will give more details than I'm about to reproduce. In overview, you want to make a unitary &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;B|0\rangle=(\sqrt{\alpha_1}|0\rangle+\sqrt{\alpha_2}|1\rangle)/\sqrt{\alpha_1+\alpha_2},&#xA;$$&lt;/span&gt;&#xA;(I'm assuming the &lt;span class=&quot;math-container&quot;&gt;$\alpha_i$&lt;/span&gt; are positive) and a second unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=|0\rangle\langle 0|\otimes A_1+|1\rangle\langle 1|\otimes A_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A very crude way of implementing the operation would then be to start with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the state that you want to apply the superposition of unitaries. You apply &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to the first qubit, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; across both, then &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; (phase gate) and &lt;span class=&quot;math-container&quot;&gt;$B^\dagger$&lt;/span&gt; on the first qubit. Measure the first qubit, and if it is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you have succeeded.&lt;/p&gt;&#xA;&lt;p&gt;If your amplitudes were negative, you can compensate for that by changing the phase rotation at the point where I applied &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; in that sequence.&lt;/p&gt;&#xA;&lt;p&gt;To see this, the evolution sequence is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|0\rangle|\psi\rangle &amp;amp;\xrightarrow{B} (\sqrt{\alpha_1}|0\rangle+\sqrt{\alpha_2}|1\rangle)|\psi\rangle/\sqrt{\alpha_1+\alpha_2} \\&#xA;&amp;amp;\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} \\&#xA;&amp;amp;\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}&#xA;\end{align*}&lt;/span&gt;&#xA;This gets you up to just before applying &lt;span class=&quot;math-container&quot;&gt;$B^\dagger$&lt;/span&gt; and measuring. This is equivalent to projecting the first qubit onto &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{\alpha_1}\langle 0|+\sqrt{\alpha_2}\langle 1|)/\sqrt{\alpha_1+\alpha_2}$&lt;/span&gt;. This measuremnt result leaves the second qubit in&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{\alpha_1A_1+i\alpha_2A_2}{\alpha_1+\alpha_2}|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;which you can use to assess the success probability.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-09-16T06:39:42.007" LastActivityDate="2020-09-16T06:39:42.007" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13743" PostTypeId="2" ParentId="13732" CreationDate="2020-09-14T07:41:07.047" Score="2" Body="&lt;p&gt;The output of the qubits is either&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I\pm\text{SWAP})|\phi\rangle|\psi\rangle&#xA;$$&lt;/span&gt;&#xA;(up to normalisation). As a general rule, information is lost from this compared to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle|\psi\rangle$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;To demonstrate this, imagine that &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle|\psi\rangle$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. If you get the &lt;span class=&quot;math-container&quot;&gt;$I+\text{SWAP}$&lt;/span&gt; answer, the output state is the same for both, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle+|10\rangle$&lt;/span&gt;. You cannot tell which of the two inputs it was, so you've lost information.&lt;/p&gt;&#xA;&lt;p&gt;It &lt;em&gt;could&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-09-14T09:13:11.637" LastActivityDate="2020-09-14T09:13:11.637" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13744" PostTypeId="2" ParentId="13739" CreationDate="2020-09-14T09:25:33.673" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;I cannot figure out how equations &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; are equivalent&lt;/strong&gt;. My humble explanation suggests that for &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, they are equivalent since &lt;span class=&quot;math-container&quot;&gt;$E^{\dagger}_a E_b$&lt;/span&gt; would cancel out to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and we are left with &lt;span class=&quot;math-container&quot;&gt;$\langle c_i\vert c_j \rangle = 0$&lt;/span&gt;, since they are orthogonal. For &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$E^{\dagger}_a E_b$&lt;/span&gt; would cancel out to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and we are left with &lt;span class=&quot;math-container&quot;&gt;$\langle c_i\vert c_i \rangle = \langle c_j\vert c_j \rangle = 1$&lt;/span&gt;, since we are projecting a state on itself.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Eq. &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; are not necessarily &lt;em&gt;equivalent&lt;/em&gt;, they are just both necessary for a QECC. Eq. &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; states that orthogonality between codewords is preserved, even if one error &lt;span class=&quot;math-container&quot;&gt;$E_{a}$&lt;/span&gt; acts upon one of the codewords, and some other error &lt;span class=&quot;math-container&quot;&gt;$E_{b}$&lt;/span&gt; acts upon the other - that way we can &lt;em&gt;always&lt;/em&gt; tell two error apart, regardless of what exactly the state encoded in the subspace is.&#xA;Eq. &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; 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 &lt;strong&gt;cannot&lt;/strong&gt; depend on what exactly the 'current' codeword (or superposition thereof) is!&lt;/p&gt;&#xA;&lt;p&gt;You can also check out &lt;a href=&quot;https://arxiv.org/abs/0904.2557&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman's introduction to QECC's&lt;/a&gt; (check section &lt;span class=&quot;math-container&quot;&gt;$2.2$&lt;/span&gt; on page &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; and specifically Eq. &lt;span class=&quot;math-container&quot;&gt;$(26)$&lt;/span&gt;) - he has what I believe to be a clear explanation on why we have these conditions exactly.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;How can we convert &lt;span class=&quot;math-container&quot;&gt;$C_{ab}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; or something else)?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;We say that we get a &lt;span class=&quot;math-container&quot;&gt;$|E|\times |E|$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, where the &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt;-th element is the inner product &lt;span class=&quot;math-container&quot;&gt;$\langle c_{i}|E_{a}^{\dagger}E_{b}|c_{i}\rangle$&lt;/span&gt; - Eq. &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; tells us that it does not matter &lt;em&gt;what&lt;/em&gt; codeword &lt;span class=&quot;math-container&quot;&gt;$|c_{i}\rangle$&lt;/span&gt; we use, as every codeword should give the same result. Generally this matrix is in &lt;span class=&quot;math-container&quot;&gt;$C^{|E|\times |E|}$&lt;/span&gt;, but if &lt;span class=&quot;math-container&quot;&gt;$\{E_{1}...E_{|E|}\}$&lt;/span&gt; is the set of correctable errors, you can view this set as a basis for the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; of correctable errors. As &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is Hermitian, there exist a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; becomes diagonal with real entries. These entries are not necessarily &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (they &lt;em&gt;will&lt;/em&gt; be &lt;span class=&quot;math-container&quot;&gt;$\geq 0$&lt;/span&gt; though, and generally speaking they are &lt;span class=&quot;math-container&quot;&gt;$\leq 1$&lt;/span&gt;). However, these scaling factors are relatively meaningless, and for additive (i.e. stabilizer) codes, in this particular basis the entries are normally &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, if our set of correctable errors is &lt;span class=&quot;math-container&quot;&gt;$\{E_{1}...E_{|E|}\}$&lt;/span&gt;, we get for our matrix &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C = &#xA;\begin{bmatrix}&#xA;\langle c_{i*}|E_{1}^{\dagger}E_{1} | c_{i*}\rangle &amp;amp; \langle c_{i*}|E_{1}^{\dagger}E_{2} | c_{i*}\rangle &amp;amp; \cdots &amp;amp; \langle c_{i*}|E_{1}^{\dagger}E_{|E|} | c_{i*}\rangle \\&#xA;\langle c_{i*}|E_{2}^{\dagger}E_{1} | c_{i*}\rangle &amp;amp; \langle c_{i*}|E_{2}^{\dagger}E_{2} | c_{i*}\rangle &amp;amp; \cdots &amp;amp; \langle c_{i*}|E_{2}^{\dagger}E_{|E|} | c_{i*}\rangle \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots \\&#xA;\langle c_{i*}|E_{|E|}^{\dagger}E_{1} | c_{i*}\rangle &amp;amp; \langle c_{i*}|E_{|E|}^{\dagger}E_{2} | c_{i*}\rangle &amp;amp; \dots &amp;amp; \langle c_{i*}|E_{|E|}^{\dagger}E_{|E|} | c_{i*}\rangle \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;Note that this is slightly different than your comment, since I &lt;em&gt;do not&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|c_{i*}\rangle$&lt;/span&gt; is completely arbitrary.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Links to questions two, how would &lt;span class=&quot;math-container&quot;&gt;$\delta_{ij}$&lt;/span&gt; affect the matrix?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\delta_{ij}$&lt;/span&gt; is there to 'take care' of your equation &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; - without it, orthogonality between different codewords would not be preserved. All information about what &lt;em&gt;error&lt;/em&gt; has happened is encoded into &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-09-14T21:24:47.183" LastActivityDate="2020-09-14T21:24:47.183" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="13745" PostTypeId="1" CreationDate="2020-09-14T14:46:39.193" Score="1" ViewCount="44" Body="&lt;p&gt;On pg 376-377 of N&amp;amp;C, it gives 3 different diagrams showing how the various axis of the Bloch sphere will be contracted under the action of the channels, limiting the possible states after it's action. However, it states that the axis was contracted by a factor of &lt;span class=&quot;math-container&quot;&gt;$1-2p$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the probability of the channel doing nothing, and &lt;span class=&quot;math-container&quot;&gt;$1-p$&lt;/span&gt; is the probability that an operation, e.g. a bit flip, would occur.&lt;/p&gt;&#xA;&lt;p&gt;Where are they getting &lt;span class=&quot;math-container&quot;&gt;$1-2p$&lt;/span&gt; from, as no derivation for this value is given? Clearly it's related to the effect on &lt;span class=&quot;math-container&quot;&gt;$r_{x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r_{y}$&lt;/span&gt; in the Bloch vector after the action of the channel, but is there an actual name for this term and how it is arrived at given a channel such as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E_{0}=\sqrt{p}I, E_{1}=\sqrt{1-p}{X}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-09-15T16:15:28.863" LastActivityDate="2020-09-15T16:15:28.863" Title="Deformation of the Bloch sphere and contraction of its planes under the action of channels" Tags="&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13746" PostTypeId="1" CreationDate="2020-09-14T16:24:03.300" Score="2" ViewCount="79" Body="&lt;p&gt;I read some paper about Quantum Circuit Optimization but I am on a low level.&#xA;And have some experience in ML.&lt;/p&gt;&#xA;&lt;p&gt;But what I don't understand is it possible that ML can help to optimize Quantum Circuits and how does that work ?&lt;/p&gt;&#xA;&lt;p&gt;Maybe in QAOA case , what does it bring us to optimize the Circuits ?&lt;/p&gt;&#xA;" OwnerUserId="12711" LastEditorUserId="55" LastEditDate="2020-09-15T12:32:19.377" LastActivityDate="2020-09-15T12:32:19.377" Title="Quantum Circuit Optimization with Machine Learning" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;machine-learning&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-09-21T14:35:12.710" ContentLicense="CC BY-SA 4.0" />
  <row Id="13747" PostTypeId="2" ParentId="13746" CreationDate="2020-09-14T22:48:27.827" Score="2" Body="&lt;p&gt;Yes, some works have been in this area. Here is an example: &amp;quot;Quantum Circuit Learning&amp;quot; &lt;a href=&quot;https://arxiv.org/abs/1803.00745&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1803.00745&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and also this paper, &amp;quot;Learning to learn with quantum neural networks via classical neural networks&amp;quot;  &lt;a href=&quot;https://arxiv.org/abs/1907.05415&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1907.05415&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and also this paper, &amp;quot;Experimental pairwise entanglement estimation for an N-qubit system :A machine learning approach for programming quantum hardware&amp;quot; &lt;a href=&quot;https://arxiv.org/abs/1902.07754&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1902.07754&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-14T22:48:27.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13748" PostTypeId="1" AcceptedAnswerId="13758" CreationDate="2020-09-15T00:07:21.433" Score="3" ViewCount="76" Body="&lt;p&gt;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 &amp;quot;clean&amp;quot; banded, tri-diagonal matrix.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="9006" LastEditDate="2020-09-15T12:50:18.257" LastActivityDate="2021-01-30T23:57:13.207" Title="Is it required to input full matrix when using Qiskit HHL algorithm for sparse matrices?" Tags="&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13749" PostTypeId="1" CreationDate="2020-09-15T00:47:14.657" Score="2" ViewCount="93" Body="&lt;p&gt;The two-qubit eigenvalue (&lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; &amp;gt;= 0, &lt;span class=&quot;math-container&quot;&gt;$i=1,\ldots,4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_4=1-\lambda_1-\lambda_2-\lambda_3$&lt;/span&gt;) condition of Verstraete, Audenaert, de Bie and de Moor&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0011110&quot; rel=&quot;nofollow noreferrer&quot;&gt;AbsoluteSeparability&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(p. 6) for absolute separability is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\lambda_1-\lambda_3 &amp;lt; 2 \sqrt{\lambda_2 \lambda_4},\hspace{.5in}\lambda_1 &amp;gt;\lambda_2 &amp;gt;\lambda_3&amp;gt;\lambda_4.&#xA;\end{equation}&lt;/span&gt;&#xA;Implementing this condition,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0393044008001381&quot; rel=&quot;nofollow noreferrer&quot;&gt;2009paper&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I presented an explicit formula&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;1-\frac{3217542976-5120883075 \pi +16386825840 \tan ^{-1}\left(\sqrt{2}\right)}{32768&#xA;   \sqrt{2}}-\frac{29901918259}{497664}    \approx 0.00365826&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\phi=\cos ^{-1}\left(\frac{1}{3}\right)$&lt;/span&gt;, assisted by V. Jovovic.&amp;quot;)&lt;/p&gt;&#xA;&lt;p&gt;A &amp;quot;typo&amp;quot; in this formula&#xA;was corrected, and a somewhat reexpressed pair of formulas,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} \label{HSabs}&#xA; \frac{29902415923}{497664}+\frac{-3217542976+5120883075 \pi -16386825840 \tan&#xA;   ^{-1}\left(\sqrt{2}\right)}{32768 \sqrt{2}} =&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\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&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;were given in eq.(A2) in&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Quasirandom estimations of two-qubit operator-monotone-based separability probabilities&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1910.07937.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quasirandom&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(We, incidentally observe here that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;5 \pi -16 \tan ^{-1}\left(\sqrt{2}\right)=\cos ^{-1}\left(\frac{5983}{3^8}\right).)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Relatedly, in Table 2 (based on eq. (75) there) of&lt;/p&gt;&#xA;&lt;p&gt;ON THE GEOMETRIC PROBABILITY OF ENTANGLED MIXED STATES&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://link.springer.com/article/10.1007/s10958-015-2542-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;KhvedelidzeRogojin&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;a fully consistent numerical value of &lt;span class=&quot;math-container&quot;&gt;$0.365826 \%$&lt;/span&gt; was given for the Hilbert-Schmidt two-qubit absolute separability probability.&lt;/p&gt;&#xA;&lt;p&gt;In regard to this result,  A. Khvedelidze recently wrote in an email:&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;As far I remember we got this result using two numerical methods:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Evaluating integrals over the absolute separability area ;&lt;/li&gt;&#xA;&lt;li&gt;Generating HS random states and testing them on the absolute separability&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Our attempts to evaluate all integrals analytically fell  down.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;&lt;p&gt;The 2009 analytic derivation of mine was lengthy, &amp;quot;messy&amp;quot;, with no full record of the step-by-step derivation given.&lt;/p&gt;&#xA;&lt;p&gt;A Mathematica formulation of the problem, incorporating the Hilbert-Schmidt measure, proportional to (eq. (15.35) in  &lt;a href=&quot;https://chaos.if.uj.edu.pl/%7Ekarol/geometry.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;GeometryOfQuantumStates&lt;/a&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Pi_{j&amp;lt;k}^4 (\lambda_j-\lambda_k)^2&#xA;\end{equation}&lt;/span&gt;&#xA;is&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ltjy9.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ltjy9.jpg&quot; alt=&quot;MathematicaFormulation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've so far been able to perform the first two integrations (with a large outcome), but not the full three.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="3089" LastEditDate="2020-09-26T14:44:36.553" LastActivityDate="2020-09-26T15:53:32.540" Title="Give an explicit derivation of the exact formula for the two-qubit absolute separability Hilbert-Schmidt probability $\approx 0.00365826$" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13751" PostTypeId="2" ParentId="13440" CreationDate="2020-09-15T01:44:43.447" Score="1" Body="&lt;p&gt;I solved this issue by upgrading my python version:&lt;a href=&quot;https://github.com/Qiskit/qiskit/issues/1040&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit/issues/1040&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11560" LastActivityDate="2020-09-15T01:44:43.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13753" PostTypeId="2" ParentId="13719" CreationDate="2020-09-15T09:31:54.363" Score="1" Body="&lt;p&gt;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) &lt;em&gt;does&lt;/em&gt; have information about what Bob is doing, she can know the results of his measurements.&lt;/p&gt;&#xA;&lt;p&gt;For example, if they both measure in the &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle,|-\rangle\}$&lt;/span&gt; basis, the probability they get both result &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(1+(-1)^b)^2/8$&lt;/span&gt;, which does depend on &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-09-15T09:31:54.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13754" PostTypeId="1" CreationDate="2020-09-15T13:29:34.803" Score="2" ViewCount="65" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;What does longer transpiling time mean?&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-09-22T18:12:23.747" LastActivityDate="2020-09-22T18:12:23.747" Title="What is the significance of transpiling time, validating time, in queue time and running time?" Tags="&lt;ibm-q-experience&gt;&lt;terminology&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13755" PostTypeId="1" CreationDate="2020-09-15T14:12:33.277" Score="2" ViewCount="47" Body="&lt;p&gt;I'm struggling to find an analytic way to solve this problem.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;There are &lt;span class=&quot;math-container&quot;&gt;$4! = 24$&lt;/span&gt; possible classical operations on the four 2-Cbit basis states. How many of these are achievable via the classical operations &lt;span class=&quot;math-container&quot;&gt;$S_{ij}, C_{ij}, X_j$&lt;/span&gt; and compositions thereof.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;C-Bits refer to classical bits (binary states)&#xA;&lt;span class=&quot;math-container&quot;&gt;$S_{ij}$&lt;/span&gt; is the swap operation between bits &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$C_{ij}$&lt;/span&gt; is the control not operation with control &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and target &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$X_j$&lt;/span&gt; is the not operation with target &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13249" LastEditorUserId="13249" LastEditDate="2020-09-15T15:04:45.510" LastActivityDate="2020-09-15T15:56:14.307" Title="Counting Achievable Operations" Tags="&lt;quantum-gate&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13756" PostTypeId="2" ParentId="13754" CreationDate="2020-09-15T14:51:07.057" Score="1" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;Validating time is mostly just tourist information. While it's also backend-specific, the time difference is usually very small.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastEditorUserId="12195" LastEditDate="2020-09-15T15:45:13.113" LastActivityDate="2020-09-15T15:45:13.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13757" PostTypeId="2" ParentId="13754" CreationDate="2020-09-15T15:50:30.750" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = (circuit, backend, optimization_level=3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then transpilation will take longer. More information on transpilation can be found here: &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/backends/queue/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/manage/backends/queue/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-15T15:50:30.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13758" PostTypeId="2" ParentId="13748" CreationDate="2020-09-15T15:53:35.093" Score="3" Body="&lt;p&gt;At the moment this is not possible, however in the near future it will be possible for the case of tridiagonal symmetric Toeplitz matrices.&lt;/p&gt;&#xA;&lt;p&gt;The reason for this being that qiskit does not support QRAM or &amp;quot;black-box&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2020-09-15T15:53:35.093" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13759" PostTypeId="2" ParentId="13755" CreationDate="2020-09-15T15:56:14.307" Score="1" Body="&lt;p&gt;&lt;strong&gt;Why is 4! valid?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$f(01)$&lt;/span&gt; could yield all except &lt;span class=&quot;math-container&quot;&gt;$f(00)$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Universality&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, which of these operations are actually implementable given the desired gate set? Recognize that each of the operations is also a permutation table:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Swap: interchanges the amplitudes of 01, 10&lt;/li&gt;&#xA;&lt;li&gt;CNOT: interchanges the amplitudes of 10, 11 or 01, 11&lt;/li&gt;&#xA;&lt;li&gt;X: interchanges the amplitudes of 00, 10 and 11, 01 or 00, 01 and 10, 11&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So, let's first find sub operations that allow us to selectively swap any two amplitudes. Note that we are seeking &lt;span class=&quot;math-container&quot;&gt;$4C2 = 6$&lt;/span&gt; such operations, and we already have 3 of them (&lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT01$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT10$&lt;/span&gt;). This leaves us with 3 two amplitude swaps: &lt;span class=&quot;math-container&quot;&gt;$(00, 01)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(00, 10)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$(00, 11)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$(00, 01)$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$X_0 CNOT_{0, 1} X_0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$(00, 10)$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$X_1 CNOT_{1, 0} X_1$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$(00, 11)$&lt;/span&gt;: Because every other 2-amplitude swap is implementable, we know that &lt;span class=&quot;math-container&quot;&gt;$(00, 11)$&lt;/span&gt; is also implementable.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;4 inputs invariant (&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;2 inputs invariant (&lt;span class=&quot;math-container&quot;&gt;$4C2 * !2 = 6$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;1 input invariant (&lt;span class=&quot;math-container&quot;&gt;$4C1 * !3 = 8$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;0 inputs invariant (&lt;span class=&quot;math-container&quot;&gt;$!4 = 9$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;(Note that three invariant inputs is not possible; we always need at least one amplitude to swap with).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first case is trivial, and satisfiable with an identity function.&lt;/li&gt;&#xA;&lt;li&gt;We just proved the second case.&lt;/li&gt;&#xA;&lt;li&gt;The third/fourth cases are provable by way of the second case.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-15T15:56:14.307" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13760" PostTypeId="1" CreationDate="2020-09-15T23:03:56.017" Score="1" ViewCount="149" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="9006" LastEditDate="2020-09-16T07:37:35.397" LastActivityDate="2020-10-24T12:37:54.180" Title="What is meaning of 'up to a global phase'?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2020-09-16T13:10:30.293" ContentLicense="CC BY-SA 4.0" />
  <row Id="13761" PostTypeId="1" CreationDate="2020-09-16T01:01:38.243" Score="4" ViewCount="95" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So I want to know what should be the thought process after seeing the matrix?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CWc40.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CWc40.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="45" LastEditDate="2020-09-18T07:53:00.597" LastActivityDate="2020-09-18T07:53:00.597" Title="What is the thought process for circuit making after seeing input and output of a matrix?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13762" PostTypeId="1" CreationDate="2020-09-16T02:50:19.910" Score="3" ViewCount="73" Body="&lt;p&gt;After having a discussion with a quantum computing colleague, a question came up: &lt;strong&gt;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?&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;To explain what I mean by &amp;quot;meaningful&amp;quot;, 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 &lt;em&gt;only interested in low-energy phenomena&lt;/em&gt;, 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 &amp;quot;meaningful&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;A somewhat related question that I posted several years ago about Quantum Fisher Information&#xA;&lt;a href=&quot;https://physics.stackexchange.com/questions/274891/interpreting-the-quantum-fisher-information&quot;&gt;https://physics.stackexchange.com/questions/274891/interpreting-the-quantum-fisher-information&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2260" LastEditorUserId="2260" LastEditDate="2020-09-21T01:38:32.993" LastActivityDate="2020-09-21T01:38:32.993" Title="Is there a measurable of entanglement for a many-body system?" Tags="&lt;entanglement&gt;&lt;experiment&gt;&lt;solid-state&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="13763" PostTypeId="1" CreationDate="2020-09-16T03:55:02.597" Score="2" ViewCount="61" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;Why such a large difference as it does not give a clear picture of simulators' accuracy in comparison to realized of quantum hardware?&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-09-17T18:19:46.380" LastActivityDate="2020-09-17T18:19:46.380" Title="Why running time of qasm simulator is significantly smaller in comparison with quantum machines?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13765" PostTypeId="2" ParentId="13760" CreationDate="2020-09-16T06:48:28.367" Score="2" Body="&lt;p&gt;The point of the phrase &amp;quot;up to a global phase&amp;quot; is that a global phase is not important. It has no observable consequences.&lt;/p&gt;&#xA;&lt;p&gt;So, states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_1\rangle=a|0\rangle+b|1\rangle,\qquad |\psi_2\rangle=e^{i\phi}(a|0\rangle+b|1\rangle)&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;The the N&amp;amp;C exercise, it's the same issue, but for unitaries rather than states: &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}U$&lt;/span&gt; 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-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}U$&lt;/span&gt; are very different.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="9459" LastEditDate="2020-10-24T12:37:54.180" LastActivityDate="2020-10-24T12:37:54.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13766" PostTypeId="2" ParentId="13719" CreationDate="2020-09-16T07:09:32.127" Score="1" Body="&lt;p&gt;If Alice and Bob knew the values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, there would always be measurements they could perform which would allow the middleman to distinguish the value of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;However, the question states that &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_0=\frac{1}{12}\sum_{x\neq y\in\{0,1\}^2}(|x\rangle+|y\rangle)(\langle x|+\langle y|)&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1=\frac{1}{12}\sum_{x\neq y\in\{0,1\}^2}(|x\rangle-|y\rangle)(\langle x|-\langle y|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I believe (although you'll want to check, because I did this quickly, not carefully) that these look like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_0=\frac{1}{12}\left(\begin{array}{cccc} 3 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; 3 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; 1 &amp;amp; 3 &amp;amp; 1 \\ 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 3 \end{array}\right)=\frac{1}{6}I+\frac{1}{3}|++\rangle\langle ++|&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1=\frac{1}{12}\left(\begin{array}{cccc} 3 &amp;amp; -1 &amp;amp; -1 &amp;amp; -1 \\ -1 &amp;amp; 3 &amp;amp; -1 &amp;amp; -1 \\ -1 &amp;amp; -1 &amp;amp; 3 &amp;amp; -1 \\ -1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 3 \end{array}\right)=\frac{1}{3}I-\frac{1}{3}|++\rangle\langle ++|.&#xA;$$&lt;/span&gt;&#xA;These clearly do not have support on orthogonal subspaces, so there is no measurement that can guarantee to distinguish between &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; even if Alice and Bob could perform two-qubit measurements jointly.&lt;/p&gt;&#xA;&lt;p&gt;However, you could ask what the best measurement they could do is. This is called the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4164/what-is-the-helstrom-measurement&quot;&gt;Helstrom measurement&lt;/a&gt;. The probability of success is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12+\frac14\text{Tr}|\rho_0-\rho_1|=\frac34&#xA;$$&lt;/span&gt;&#xA;Moreover, that differentiation is achieved by measuring both qubits in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis: if you get the &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt; answer, you assume you had &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt;), otherwise you assume you had &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt;). Since this optimal basis happens to be a tensor product, this is measured by Alice and Bob independently and resolved by the referee.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-16T07:09:32.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13767" PostTypeId="2" ParentId="13763" CreationDate="2020-09-16T09:20:41.787" Score="3" Body="&lt;p&gt;A simulator executes just an algorithm on a classical hardware as Martin said.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="12386" LastActivityDate="2020-09-16T09:20:41.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13768" PostTypeId="2" ParentId="13728" CreationDate="2020-09-16T11:19:18.053" Score="1" Body="&lt;p&gt;The &lt;code&gt;0.15.2&lt;/code&gt; is actually the version of your &lt;code&gt;qiskit-terra&lt;/code&gt; package not Qiskit itself.&lt;br /&gt;&#xA;I'd suggest you to check the version by  &lt;code&gt;qiskit.__qiskit_version__&lt;/code&gt;. See the &lt;a href=&quot;https://qiskit.org/documentation/install.html#checking-which-version-is-installed&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If all packages have the latest version, you simply need to install &lt;code&gt;pylatexenc&lt;/code&gt; in the same &lt;code&gt;env&lt;/code&gt; where your Qiskit has been installed. Just by typing &lt;code&gt;pip install pylatexenc&lt;/code&gt; in terminal!&lt;/p&gt;&#xA;&lt;p&gt;In case you don't have the latest version of Qiskit.&#xA;You need to upgrade it first by &lt;code&gt;pip install qiskit --upgrade&lt;/code&gt; and then install &lt;code&gt;pylatexenc&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; &lt;br /&gt;&#xA;For Google Colab, this &lt;a href=&quot;https://stackoverflow.com/a/61212861/14162235&quot;&gt;thread&lt;/a&gt; from Stackoverflow might be relevant.&lt;br /&gt;&#xA;&lt;code&gt;%pip install pylatexenc&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2020-09-16T13:02:26.350" LastActivityDate="2020-09-16T13:02:26.350" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="13769" PostTypeId="1" AcceptedAnswerId="13770" CreationDate="2020-09-16T12:16:38.767" Score="1" ViewCount="827" Body="&lt;p&gt;I'm currently able to get state vector in Qiskit using state_vector backend using something like :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend('statevector_simulator')&#xA;job = execute(qc, backend=backend, shots=1, memory=True)&#xA;job_result = job.result()&#xA;print(job_result.get_statevector(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But now I would like to get state vector using qasm_backend, I have seen in the Qiskit doc this sample code :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = QasmSimulator()&#xA;backend_options = {&amp;quot;method&amp;quot;: &amp;quot;statevector&amp;quot;}&#xA;&#xA;# Circuit execution&#xA;job = execute(qc, backend, backend_options=backend_options)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So I tried this backend implementation then trying to get state vector with :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_result = job.result()&#xA;print(job_result.get_statevector(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But it still gives me an error saying that get_statevector is not available, what is the right way to do that ?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="55" LastEditDate="2020-09-17T18:18:21.357" LastActivityDate="2021-05-06T07:46:09.413" Title="How to get state vector from QasmSimulator in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13770" PostTypeId="2" ParentId="13769" CreationDate="2020-09-16T12:58:49.300" Score="4" Body="&lt;p&gt;If you're using the &lt;code&gt;QasmSimulator&lt;/code&gt; class from Aer it does not generate a state vector result. The &lt;code&gt;statevector&lt;/code&gt; 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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.QasmSimulator.html#qiskit.providers.aer.QasmSimulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;QasmSimulator&lt;/code&gt; Docs&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When you were calling &lt;code&gt;Aer.get_backend('statevector_simulator')&lt;/code&gt; that returns a &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.StatevectorSimulator.html#qiskit.providers.aer.StatevectorSimulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;StateVectorSimulator&lt;/code&gt;&lt;/a&gt; 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 &lt;code&gt;get_statevector&lt;/code&gt; works there. If you want to get the state vector while using the &lt;code&gt;QasmSimulator&lt;/code&gt; you can use the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.extensions.SnapshotStatevector.html#qiskit.providers.aer.extensions.SnapshotStatevector&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;SnapshotStatevector&lt;/code&gt;&lt;/a&gt; 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 &lt;code&gt;get_statevector&lt;/code&gt; (that will still fail) it will be in the snapshots under &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.result.Result.html?highlight=result%20result%20data#qiskit.result.Result.data&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Result.data&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastEditorUserId="15119" LastEditDate="2021-05-06T07:46:09.413" LastActivityDate="2021-05-06T07:46:09.413" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13771" PostTypeId="1" CreationDate="2020-09-16T14:35:08.213" Score="2" ViewCount="63" Body="&lt;p&gt;How can I put the unitary matrix &lt;span class=&quot;math-container&quot;&gt;$$e^\frac{i\pi}{2}I$$&lt;/span&gt; to the quantum circuit?&lt;/p&gt;&#xA;&lt;p&gt;I don't know if it is belong to &lt;span class=&quot;math-container&quot;&gt;$$U3(\theta, \phi, \lambda), U2(\phi, \lambda), U1(\lambda)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="12882" LastEditorUserId="55" LastEditDate="2020-09-17T18:17:29.780" LastActivityDate="2020-09-17T18:17:29.780" Title="How can I convert the unitary matrix $e^\frac{i\pi}{2}$ into a quantum circuit in Qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13772" PostTypeId="2" ParentId="13771" CreationDate="2020-09-16T14:48:16.843" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix. In a quantum circuit, it means &amp;quot;do nothing&amp;quot;. You don't need to program it in. The global phase doesn't make a difference to this either.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-16T14:48:16.843" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13773" PostTypeId="1" AcceptedAnswerId="13783" CreationDate="2020-09-16T17:45:11.257" Score="0" ViewCount="36" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;It uses approximations and does not show how to identify those places.&lt;/p&gt;&#xA;&lt;p&gt;I'm referencing pages 479 and 480, how does he know the values of the c and c0, c1, etc.&lt;/p&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="55" LastEditDate="2020-09-21T16:57:04.420" LastActivityDate="2020-09-21T16:57:04.420" Title="Where do errors occur during error syndrome and recovery?" Tags="&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13774" PostTypeId="1" AcceptedAnswerId="13775" CreationDate="2020-09-16T18:39:28.813" Score="2" ViewCount="256" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit import IBMQ&#xA;from qiskit import QuantumCircuit, execute, BasicAer&#xA;import logging&#xA;&#xA;&#xA;logging.basicConfig(filename='log',level=logging.DEBUG)&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')&#xA;&#xA;#SELECT A BACKEND&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;&#xA;#ALGO&#xA;qr = QuantumRegister(3)&#xA;cr = ClassicalRegister(3)&#xA;circuit = QuantumCircuit(qr, cr)&#xA;circuit.x(qr[0])&#xA;circuit.x(qr[1])&#xA;circuit.ccx(qr[0], qr[1], qr[2])&#xA;circuit.cx(qr[0], qr[1])&#xA;circuit.measure(qr, cr)&#xA;&#xA;print('About to run job')   &#xA;job = execute(circuit, backend)&#xA;print('Job Finished')&#xA;result = job.result()&#xA;counts = result.get_counts(circuit)&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In an attempt to debug, I am using &amp;quot;logging.basicConfig&amp;quot; which stops at:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;quot;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&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I go to my IBMQ home page it says that the job has run successfully. It is only at the line &lt;code&gt;result = job.result()&lt;/code&gt; that it fails.&lt;/p&gt;&#xA;&lt;p&gt;So it seems that the websocket is hanging forever. I'd appreciate any help I can get to fix this issue.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="55" LastEditDate="2020-09-21T16:57:21.260" LastActivityDate="2020-09-22T17:35:35.523" Title="My IBMQ job hangs forever?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13775" PostTypeId="2" ParentId="13774" CreationDate="2020-09-16T18:53:11.530" Score="1" Body="&lt;p&gt;The function &lt;code&gt;execute&lt;/code&gt; 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 &lt;code&gt;DONE&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print('About to run job')   &#xA;job = execute(circuit, backend)&#xA;job.status()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;JobStatus.QUEUED&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After waiting some time:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job.status()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;JobStatus.DONE&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, &lt;code&gt;job.result()&lt;/code&gt; will work.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-16T18:53:11.530" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13776" PostTypeId="2" ParentId="13697" CreationDate="2020-09-16T19:07:19.840" Score="1" Body="&lt;p&gt;Qiskit &lt;a href=&quot;https://github.com/Qiskit/qiskit/releases/tag/0.21.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;0.21&lt;/a&gt; has &lt;a href=&quot;https://pypi.org/project/qiskit-ibmq-provider/0.9.0/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit-ibmq-provider 0.9&lt;/a&gt;. This new provider comes with a connector to the RNG service in IBMQ. From the release notes:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You can now access the IBMQ random number services, such as the CQC&#xA;randomness extractor, using the new package&#xA;qiskit.providers.ibmq.random. Note that this feature is still in beta,&#xA;and not all accounts have access to it. It is also subject to heavy&#xA;modification in both functionality and API without backward&#xA;compatibility.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can find the documentation &lt;a href=&quot;https://qiskit.org/documentation/apidoc/ibmq_random.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://github.com/qiskit-community/qiskit_rng&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-16T19:07:19.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13777" PostTypeId="1" CreationDate="2020-09-16T22:57:20.080" Score="1" ViewCount="63" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$U_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_b$&lt;/span&gt; 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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#both independently correct&#xA;circuit2 = QuantumCircuit(3);&#xA;circuit2.u3(1,1,1,2);&#xA;job = execute(circuit2, backend)&#xA;job.result().get_unitary(circuit2, decimals=6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#both independently correct&#xA;circuit2 = QuantumCircuit(3);&#xA;circuit2.h(2)&#xA;job = execute(circuit2, backend)&#xA;job.result().get_unitary(circuit2, decimals=6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;i.e. a three qubit circuit with a Hadamard gate on the final qubit. These produce the following two unitaries&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;   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&#xA;   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&#xA;   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&#xA;   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&#xA;   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&#xA;   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&#xA;   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&#xA;   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&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;    0.7071         0         0         0    0.7071         0         0         0&#xA;         0    0.7071         0         0         0    0.7071         0         0&#xA;         0         0    0.7071         0         0         0    0.7071         0&#xA;         0         0         0    0.7071         0         0         0    0.7071&#xA;    0.7071         0         0         0   -0.7071         0         0         0&#xA;         0    0.7071         0         0         0   -0.7071         0         0&#xA;         0         0    0.7071         0         0         0   -0.7071         0&#xA;         0         0         0    0.7071         0         0         0   -0.7071&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function test=utottest(x)&#xA;x1=[1,1,1];&#xA;Hadamard=1/sqrt(2)*[1 1;1 -1];&#xA;&#xA;R1=kron(U1IBM(x1),eye(4));&#xA;R12=kron(Hadamard,eye(4));&#xA;&#xA;&#xA;test=R12*R1;&#xA;&#xA;function U1=U1IBM(x)&#xA;% single qubit unitary &#xA;th=x(1);&#xA;phi=x(2);&#xA;lam=x(3);&#xA;&#xA;U1=[cos(th/2) -exp(i*lam)*sin(th/2); exp(i*phi)*sin(th/2) exp(i*lam+i*phi)*cos(th/2)];&#xA;end&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the unitary produced is different to that produced by the following IBM circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit2 = QuantumCircuit(3);&#xA;circuit2.u3(1,1,1,2);&#xA;circuit2.h(2)&#xA;job = execute(circuit2, backend)&#xA;job.result().get_unitary(circuit2, decimals=6)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I do not understand what is happening here. Can anyone explain/reconcile this difference?&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-09-21T16:57:36.977" LastActivityDate="2020-09-21T16:57:36.977" Title="Hadamard gate for three qubits; inconsistency between IBM and Matlab" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13778" PostTypeId="1" CreationDate="2020-09-16T23:58:16.213" Score="-1" ViewCount="51" Body="&lt;p&gt;Can someone please help me making these gates on CIRQ programming:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Decrement Gate (-1)&lt;/li&gt;&#xA;&lt;li&gt;Splitter Gate (If possible)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I was having trouble implementing these and was not sure if it's possible either.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="12913" LastEditorUserId="55" LastEditDate="2020-09-21T14:31:12.893" LastActivityDate="2021-01-15T21:02:05.203" Title="Implementing Cirq Coding Gates" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13779" PostTypeId="2" ParentId="13777" CreationDate="2020-09-17T04:32:38.167" Score="2" Body="&lt;p&gt;Someone pointed out where I was going wrong. The two unitaries being produced were the same up to a global phase shift&lt;/p&gt;&#xA;" OwnerUserId="13261" LastActivityDate="2020-09-17T04:32:38.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13780" PostTypeId="2" ParentId="13778" CreationDate="2020-09-17T05:19:22.900" Score="0" Body="&lt;p&gt;I'm not sure what a splitter operation is.&lt;/p&gt;&#xA;&lt;p&gt;There is a class &lt;code&gt;cirq.ArithmeticOperation&lt;/code&gt; which is a helper class for implementing arithmetic. You can implement an increment gate with it like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;class Increment(cirq.ArithmeticOperation):&#xA;    def __init__(self, target_register):&#xA;        self.target_register = target_register&#xA;&#xA;    def registers(self):&#xA;        return [self.target_register]&#xA;&#xA;    def with_registers(self, *new_registers):&#xA;        return Increment(*new_registers)&#xA;&#xA;    def apply(self, target_value):&#xA;        return [target_value + 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;apply&lt;/code&gt; automatically wraps modulo &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the size of the register. Also it is your responsibility to make sure the arithmetic operation is actually reversible.&lt;/p&gt;&#xA;&lt;p&gt;Then you can use it like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;register = cirq.LineQubit.range(2)&#xA;circuit = cirq.Circuit(Increment(register))&#xA;&#xA;print(circuit)&#xA;# 0: ───&amp;lt;__main__.Increment object at 0x000002594B1F03C8&amp;gt;───&#xA;#       │&#xA;# 1: ───#2──────────────────────────────────────────────────&#xA;&#xA;&#xA;print(cirq.unitary(Increment(register)))&#xA;# [[0.+0.j 0.+0.j 0.+0.j 1.+0.j]&#xA;#  [1.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA;#  [0.+0.j 1.+0.j 0.+0.j 0.+0.j]&#xA;#  [0.+0.j 0.+0.j 1.+0.j 0.+0.j]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-09-17T06:23:27.540" LastActivityDate="2020-09-17T06:23:27.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13781" PostTypeId="1" AcceptedAnswerId="13786" CreationDate="2020-09-17T06:39:13.777" Score="0" ViewCount="144" Body="&lt;p&gt;I am trying to implement the partial trace operation on IBMs quantum computer. I am simulating the depolarising channel with the following code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#aim here is to build the decoherence channel&#xA;p=0.1;&#xA;z=0.5+0.5*math.sqrt(1-p);&#xA;desiredvec=[&#xA;    math.sqrt(1-z),&#xA;    math.sqrt(z)]&#xA;circuit2 = QuantumCircuit(4,3);&#xA;circuit2.initialize(desiredvec,0)&#xA;circuit2.initialize(desiredvec,1)&#xA;circuit2.initialize(desiredvec,2)&#xA;circuit2.cx(0,3)&#xA;circuit2.h(3)&#xA;circuit2.s(3)&#xA;circuit2.cx(1,3)&#xA;circuit2.h(3)&#xA;circuit2.s(3)&#xA;circuit2.cx(2,3)&#xA;circuit2.h(3)&#xA;circuit2.s(3)&#xA;circuit2.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-09-20T22:06:34.857" LastActivityDate="2020-09-20T22:06:34.857" Title="Implementing Partial Trace in IBMs quantum computer" Tags="&lt;programming&gt;&lt;decoherence&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13782" PostTypeId="1" AcceptedAnswerId="13784" CreationDate="2020-09-17T06:52:49.807" Score="4" ViewCount="196" Body="&lt;p&gt;From this &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0002039.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link:&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NTsD4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NTsD4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where equation 1 is:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/EZZs0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EZZs0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="55" LastEditDate="2020-09-21T16:57:59.357" LastActivityDate="2020-09-21T16:57:59.357" Title="CNOT expressed with CZ and H gates by taking into account HZH =X" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13783" PostTypeId="2" ParentId="13773" CreationDate="2020-09-17T07:05:13.680" Score="2" Body="&lt;p&gt;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 &amp;quot;slice up&amp;quot; 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, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and the number of qubits involved, &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;. So, the number of places an error can occur is &lt;span class=&quot;math-container&quot;&gt;$c_0= QT$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-17T07:05:13.680" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13784" PostTypeId="2" ParentId="13782" CreationDate="2020-09-17T07:28:24.997" Score="4" Body="&lt;p&gt;Here are three equivalent circuits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gevTK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gevTK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The second equation can be understood from this related &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13337/9459&quot;&gt;answer&lt;/a&gt; about the fact that &lt;span class=&quot;math-container&quot;&gt;$CZ_{1 \rightarrow 2} = CZ_{2 \rightarrow 1}$&lt;/span&gt;, where first index is the control qubit and the second index is the target qubit. The first equation is similar to this related &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12460/9459&quot;&gt;answer&lt;/a&gt;, but let's prove it explicitly where we will use &lt;span class=&quot;math-container&quot;&gt;$HZH = X$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;I \otimes H \; (CZ_{1 \rightarrow 2}) \; I \otimes H=&#xA;\\ = I \otimes H \; (|0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes Z) \; I \otimes H =\\&#xA;= |0\rangle \langle 0 | \otimes H  H + |1\rangle \langle 1 | \otimes HZH =&#xA;\\ = |0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes X = CNOT_{1 \rightarrow 2}&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$HZH = X$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-17T07:57:09.607" LastActivityDate="2020-09-17T07:57:09.607" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13785" PostTypeId="1" CreationDate="2020-09-17T10:54:16.190" Score="6" ViewCount="52" Body="&lt;p&gt;This question is two-fold and considers general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit operations on a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;First, can a general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit operation be implemented on a quantum computer without the use of ancilla qubits?&lt;/p&gt;&#xA;&lt;p&gt;Second, can ancilla qubits help in reducing the depth of such general &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit operations and if yes, what is the relation between the two?&lt;/p&gt;&#xA;" OwnerUserId="2005" LastEditorUserId="55" LastEditDate="2020-09-23T09:31:06.637" LastActivityDate="2020-09-23T09:31:06.637" Title="Reducing the depth of quantum circuits with ancilla qubits" Tags="&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13786" PostTypeId="2" ParentId="13781" CreationDate="2020-09-17T11:21:30.183" Score="1" Body="&lt;p&gt;&lt;code&gt;qiskit.quantum_info&lt;/code&gt; has a &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.partial_trace.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;partial_trace&lt;/a&gt; method you can use for this.&lt;/p&gt;&#xA;&lt;p&gt;It takes as input either a &lt;code&gt;Statevector&lt;/code&gt; or a &lt;code&gt;DensityMatrix&lt;/code&gt; object. Both these classes implement the &lt;code&gt;from_instruction&lt;/code&gt; routine that you can use with the &lt;code&gt;QuantumCircuit&lt;/code&gt; object you already have. You would have to do something along the lines of:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit2 = QuantumCircuit(4,3)&#xA;&#xA;...&#xA;# your operations&#xA;...&#xA;&#xA;statevec = Statevector.from_instruction(circuit2)&#xA;trace = partial_trace(statevec, 3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;&#xA;" OwnerUserId="8955" LastActivityDate="2020-09-17T11:21:30.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13787" PostTypeId="1" AcceptedAnswerId="13791" CreationDate="2020-09-17T12:26:20.787" Score="2" ViewCount="78" Body="&lt;p&gt;I prepared a quadratic optimization task with binary and integer variables and linear and quadratic constraints. I fed it into &lt;code&gt;QuadraticProgram&lt;/code&gt; in Qiskit. After that, I tried to convert the program to binary optimization task with constraints in form of equality only. I used &lt;code&gt;InequalityToEquality&lt;/code&gt; and &lt;code&gt;IntegerToBinary&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My questions are:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is the problem really in the quadratic constraint? Or in other words, are such constraints forbidden when I want to use converters?&lt;/li&gt;&#xA;&lt;li&gt;If so, is there any other way how to convert &lt;code&gt;QuadraticProgram&lt;/code&gt; to QUBO in Qiskit?&#xA;&lt;em&gt;(note that &lt;code&gt;QuadraticProgramToQubo&lt;/code&gt; also does not work since &lt;code&gt;IntegerToBinary&lt;/code&gt; is part of it)&lt;/em&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;from qiskit.optimization import QuadraticProgram&#xA;from qiskit.optimization.converters import InequalityToEquality, IntegerToBinary, QuadraticProgramToQubo&#xA;&#xA;#create empty optimization task (model)&#xA;mod = QuadraticProgram('Quadratic optimization problem') #string in brackets - user defined name of the task&#xA;&#xA;#adding variables&#xA;mod.binary_var(name = 'x') #bin&#xA;mod.integer_var(name = 'y', lowerbound = 0, upperbound = 5) &#xA;mod.integer_var(name = 'z', lowerbound = 0, upperbound = 5) &#xA;#setting objective function&#xA;mod.minimize(constant = 3, linear = [1,0,1], quadratic = [[1, 0, 2],[0,1,0],[2,0,1]])&#xA;#adding constraints&#xA;mod.linear_constraint(linear = {'x': 1, 'y': 1, 'z':1}, sense = '==', rhs = 1, name = 'L1')&#xA;mod.linear_constraint(linear = {'x': -1, 'y': -1, 'z':2}, sense = '&amp;gt;=', rhs = 0, name = 'L2')&#xA;mod.linear_constraint(linear = {'x': 10, 'y': 20, 'z':30}, sense = '&amp;lt;=', rhs = 100, name = 'L3')&#xA;&#xA;#PROBLEMATIC QUADRATIC CONSTAINT&#xA;mod.quadratic_constraint(linear = {'x':1, 'y':1}, quadratic = {('x','y'):1, ('x','z'):-1}, sense = '&amp;lt;=', rhs = 2, name = 'Q1')&#xA;&#xA;modConverted = InequalityToEquality().convert(mod)&#xA;modConverted = IntegerToBinary().convert(modConverted)&#xA;print(modConverted.export_as_lp_string())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And here is the returned error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;KeyError                                  Traceback (most recent call last)&#xA;&amp;lt;ipython-input-13-f345029f5fa8&amp;gt; in &amp;lt;module&amp;gt;&#xA;     20 &#xA;     21 modConverted = InequalityToEquality().convert(mod)&#xA;---&amp;gt; 22 modConverted = IntegerToBinary().convert(modConverted)&#xA;     23 print(modConverted.export_as_lp_string())&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/optimization/converters/integer_to_binary.py in convert(self, problem)&#xA;     96                         )&#xA;     97 &#xA;---&amp;gt; 98             self._substitute_int_var()&#xA;     99 &#xA;    100         else:&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/optimization/converters/integer_to_binary.py in _substitute_int_var(self)&#xA;    199             )&#xA;    200             quadratic, q_linear, q_constant = self._convert_quadratic_coefficients_dict(&#xA;--&amp;gt; 201                 constraint.quadratic.to_dict()&#xA;    202             )&#xA;    203 &#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/optimization/converters/integer_to_binary.py in _convert_quadratic_coefficients_dict(self, coefficients)&#xA;    137         quadratic = {}&#xA;    138         for (name_i, name_j), v in coefficients.items():&#xA;--&amp;gt; 139             x = self._src.get_variable(name_i)&#xA;    140             y = self._src.get_variable(name_j)&#xA;    141 &#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/optimization/problems/quadratic_program.py in get_variable(self, i)&#xA;    243             return self.variables[i]&#xA;    244         else:&#xA;--&amp;gt; 245             return self.variables[self._variables_index[i]]&#xA;    246 &#xA;    247     def get_num_vars(self, vartype: Optional[VarType] = None) -&amp;gt; int:&#xA;&#xA;KeyError: 0&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-09-21T16:58:58.137" LastActivityDate="2020-09-21T16:58:58.137" Title="Quadratic optimization in Qiskit: Error when QuadraticProgram with quadratic constraint converted to QUBO" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13788" PostTypeId="1" CreationDate="2020-09-17T12:55:23.420" Score="0" ViewCount="104" Body="&lt;p&gt;I read about Hadamard gate H and found it's matrix representation as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_1=\frac{1}{\sqrt 2}\begin{pmatrix}1 &amp;amp; 1 \\1 &amp;amp; -1\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I wanted to know what will be the matrix representation of H in computational basis.&lt;/p&gt;&#xA;" OwnerUserId="13266" LastEditorUserId="55" LastEditDate="2020-09-21T17:00:00.713" LastActivityDate="2020-09-21T19:42:09.670" Title="What is the matrix representation of the Hadamard gate in the computational basis?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13790" PostTypeId="2" ParentId="13788" CreationDate="2020-09-17T14:26:40.303" Score="4" Body="&lt;p&gt;This &lt;em&gt;is&lt;/em&gt; the matrix representation of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in the computational basis. The first column is the image of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the second column is the image of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The reason that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; looks the same in both the computational and the &amp;quot;plus/minus&amp;quot; basis is that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a &lt;em&gt;self-adjoint&lt;/em&gt; (or hermitian) unitary, this makes it very special as it means that its self-inverse since we have that &lt;span class=&quot;math-container&quot;&gt;$$H^{−1}=H^\dagger=H\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-09-21T19:42:09.670" LastActivityDate="2020-09-21T19:42:09.670" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13791" PostTypeId="2" ParentId="13787" CreationDate="2020-09-17T14:44:09.480" Score="3" Body="&lt;p&gt;Thank you for your report.&#xA;I investigated the details and fixed the bug with &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/pull/1256&quot; rel=&quot;nofollow noreferrer&quot;&gt;this pull request&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13268" LastEditorUserId="45" LastEditDate="2020-09-18T00:17:28.830" LastActivityDate="2020-09-18T00:17:28.830" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13793" PostTypeId="2" ParentId="12068" CreationDate="2020-09-17T15:22:01.843" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;May be I will try and let you know if it works. But looks possible.&lt;/p&gt;&#xA;" OwnerUserId="13102" LastActivityDate="2020-09-17T15:22:01.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13794" PostTypeId="1" CreationDate="2020-09-17T16:42:16.347" Score="5" ViewCount="89" Body="&lt;p&gt;I was watching some lectures on qubits. They were talking about how to generate a Bell state. They described it as follows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare state 00:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left |0 \right&amp;gt; \otimes \left |0 \right&amp;gt;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply the Hadamard:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (H \otimes I)(\left |0 \right&amp;gt; \otimes \left |0 \right&amp;gt; ) = \left |+0 \right&amp;gt; = \frac{\left|00 \right&amp;gt; + \left |10 \right&amp;gt;}{\sqrt{2}}$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply CNOT to go from state 00 + 10 to state 00 + 11,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT = \left |0 \right&amp;gt; \left &amp;lt;0 \right| \otimes I + \left |1 \right&amp;gt; \left&amp;lt;1 \right| \otimes X $$&lt;/span&gt;&#xA;such that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT\times\frac{\left|00 \right&amp;gt; + \left |10 \right&amp;gt;}{\sqrt{2}}=\frac{\left |0 \right&amp;gt; \left &amp;lt;0|0 \right&amp;gt; \otimes I \left |0 \right&amp;gt; + \left |0 \right&amp;gt; \left &amp;lt;0|1 \right&amp;gt; \otimes I\left |1 \right&amp;gt; + \left |1 \right&amp;gt; \left &amp;lt;1|0 \right&amp;gt; \otimes X \left |0 \right&amp;gt; + \left |1 \right&amp;gt; \left &amp;lt;1|1 \right&amp;gt; \otimes X \left |0 \right&amp;gt;  }{\sqrt{2}} = \left | \Omega \right &amp;gt;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I am not sure I can follow how the product of the CNOT and the state &lt;span class=&quot;math-container&quot;&gt;$\left|00 \right&amp;gt; + \left |10 \right&amp;gt;$&lt;/span&gt; can be expanded out as written above. Hope you guys can help me out.&lt;/p&gt;&#xA;" OwnerUserId="13243" LastEditorUserId="9006" LastEditDate="2020-09-18T07:11:11.813" LastActivityDate="2020-12-23T14:39:16.070" Title="Bell state preparation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;tensor-product&gt;&lt;bell-basis&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13795" PostTypeId="2" ParentId="13794" CreationDate="2020-09-17T16:58:43.150" Score="3" Body="&lt;p&gt;As you wrote at point 3, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is the sum of two tensor products, each one involving two matrices. Consider the first tensor product and apply the two matrices respectively to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-09-17T16:58:43.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13796" PostTypeId="1" CreationDate="2020-09-17T18:54:33.770" Score="1" ViewCount="51" Body="&lt;p&gt;I am designing an experiment which involves solving a linear system of equations of the form &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;. To do this, I am using the HHL algorithm on the IBMQ system. My experiment is scalable such that the size of matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be as large or small as I choose it to be. I would like to tailor the size of my matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Here is a little more information that may be useful. My experiment is adapted from the code in this &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL tutorial&lt;/a&gt; describing the general method to run the algorithm (section 4A). This means that I have &lt;strong&gt;not&lt;/strong&gt; optimized the algorithm in any way. That being said, an example of the resource requirements for a modestly sized matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for my experiment are as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_width:   11&#xA;circuit_depth:   101&#xA;CNOT gates:      54&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My question is, how can I use these numbers to determine the quantum volume required to run my experiment?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="55" LastEditDate="2020-09-21T14:05:21.553" LastActivityDate="2020-09-21T14:05:21.553" Title="How can I use the quantum volume to design the scale of my experiment?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;hhl-algorithm&gt;&lt;quantum-volume&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13797" PostTypeId="2" ParentId="13725" CreationDate="2020-09-17T19:19:32.090" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Statevector&#xA;zero = Statevector([1,0])&#xA;zero_state = zero.tensor(zero) # or zero_state = Statevector([1,0,0,0])&#xA;projector = zero_state.to_operator()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;a href=&quot;https://i.stack.imgur.com/t9D5n.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t9D5n.png&quot; alt=&quot;What a projector operator looks like.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, after making your operator, you can use the method evolve() to apply the projector operator on a statevector:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;statevector.evolve(projector)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-17T19:19:32.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13798" PostTypeId="1" CreationDate="2020-09-17T22:59:47.460" Score="0" ViewCount="171" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;I already tried using &lt;code&gt;QuantumCircuit.to_gate()&lt;/code&gt;, but it does not work, maybe there is a way to it with the &lt;code&gt;Instruction&lt;/code&gt; class?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit 1&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I tried to do something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;&#xA;def mygate():&#xA;    qr = QuantumRegister(4)&#xA;    cr1 = ClassicalRegister(1)&#xA;    cr2 = ClassicalRegister(1)&#xA;    qc = QuantumCircuit(qr, cr1, cr2, name='mygate')&#xA;    qc.measure(qr[0], cr1[0])&#xA;    qc.measure(qr[1], cr2[0])&#xA;    qc.x(qr[-2]).c_if(cr1, 1)&#xA;    qc.x(qr[-1]).c_if(cr2, 1)&#xA;&#xA;    return qc.to_instruction()&#xA;&#xA;&#xA;big = QuantumCircuit(5, 4)&#xA;big.append(mygate(), range(4), range(2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But it does not work.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.exceptions.QiskitError: 'Cannot convert condition in circuit with multiple classical registers to instruction'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9200" LastEditorUserId="55" LastEditDate="2020-09-21T14:05:46.710" LastActivityDate="2021-02-18T17:05:50.563" Title="Custom Gate/Instruction with classical bits in Qiskit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13800" PostTypeId="1" CreationDate="2020-09-17T23:31:04.953" Score="3" ViewCount="57" Body="&lt;p&gt;I am interested in solving a time dependent linear partial differential equation of the form &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; which, in classical computing, would amount to looping over solutions of &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is updated each step.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This question is related to this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12888/is-running-a-for-loop-faster-on-a-quantum-computer-than-a-classical-computer&quot;&gt;post&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="55" LastEditDate="2020-09-21T16:55:08.600" LastActivityDate="2020-09-21T16:55:08.600" Title="What is the best way to use loop statements on a quantum computer?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;classical-computing&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13801" PostTypeId="2" ParentId="13798" CreationDate="2020-09-17T23:31:42.923" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;First, create a circuit will all your gates and instructions, with measurements and conditionals. This will be the custom instruction:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.circuit.library import *&#xA;&#xA;qr = QuantumRegister(2)&#xA;cr = ClassicalRegister(2)&#xA;circuit = QuantumCircuit(qr, cr, name='my_inst')&#xA;circuit.h(qr[0])&#xA;circuit.cx(qr[0], qr[1])&#xA;circuit.measure(qr[1], cr[0])&#xA;circuit.append(XGate(), [qr[0]]).c_if(cr,2)&#xA;circuit.draw('text')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;      ┌───┐         ┌───┐ &#xA;q4_0: ┤ H ├──■──────┤ X ├─&#xA;      └───┘┌─┴─┐┌─┐ └─┬─┘ &#xA;q4_1: ─────┤ X ├┤M├───┼───&#xA;           └───┘└╥┘┌──┴──┐&#xA;c4: 2/═══════════╩═╡ = 2 ╞&#xA;                 0 └─────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, you need to convert this circuit into an instruction:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;my_inst = circuit.to_instruction()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This instruction can be append to another super circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;big_circuit = QuantumCircuit(5, 2)&#xA;big_circuit.h(range(5))&#xA;big_circuit.append(my_inst, range(2), range(2))&#xA;big_circuit.h(range(5))&#xA;big_circuit.draw('text')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐┌──────────┐┌───┐&#xA;q_0: ┤ H ├┤0         ├┤ H ├&#xA;     ├───┤│          │├───┤&#xA;q_1: ┤ H ├┤1         ├┤ H ├&#xA;     ├───┤│          │├───┤&#xA;q_2: ┤ H ├┤          ├┤ H ├&#xA;     ├───┤│          │├───┤&#xA;q_3: ┤ H ├┤  my_inst ├┤ H ├&#xA;     ├───┤│          │├───┤&#xA;q_4: ┤ H ├┤          ├┤ H ├&#xA;     └───┘│          │└───┘&#xA;c_0: ═════╡0         ╞═════&#xA;          │          │     &#xA;c_1: ═════╡1         ╞═════&#xA;          └──────────┘     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There it is. If you decompose the instructions in this circuit, you will see the internal operations:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;big_circuit.decompose().draw('text')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────┐   ┌───┐                         ┌───┐ ┌──────────┐&#xA;q_0: ┤ U2(0,pi) ├───┤ H ├──────■──────────────────┤ X ├─┤ U2(0,pi) ├&#xA;     ├──────────┤   └───┘    ┌─┴─┐┌─┐┌──────────┐ └─┬─┘ └──────────┘&#xA;q_1: ┤ U2(0,pi) ├────────────┤ X ├┤M├┤ U2(0,pi) ├───┼───────────────&#xA;     ├──────────┤┌──────────┐└───┘└╥┘└──────────┘   │               &#xA;q_2: ┤ U2(0,pi) ├┤ U2(0,pi) ├──────╫────────────────┼───────────────&#xA;     ├──────────┤├──────────┤      ║                │               &#xA;q_3: ┤ U2(0,pi) ├┤ U2(0,pi) ├──────╫────────────────┼───────────────&#xA;     ├──────────┤├──────────┤      ║                │               &#xA;q_4: ┤ U2(0,pi) ├┤ U2(0,pi) ├──────╫────────────────┼───────────────&#xA;     └──────────┘└──────────┘      ║             ┌──┴──┐            &#xA;c: 2/══════════════════════════════╩═════════════╡ = 2 ╞════════════&#xA;                                   0             └─────┘            &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to decompose the circuit to a particular base, you can use the transpiler for that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;decomposed = transpile(big_circuit, basis_gates=['cx', 'u3'], optimization_level=0)&#xA;decomposed.draw('text', fold=-1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───────────────┐┌───────────────┐                         ┌─────────────┐┌───────────────┐&#xA;q_0: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──■──────────────────────┤ U3(pi,0,pi) ├┤ U3(pi/2,0,pi) ├&#xA;     ├───────────────┤└───────────────┘┌─┴─┐┌─┐┌───────────────┐└──────┬──────┘└───────────────┘&#xA;q_1: ┤ U3(pi/2,0,pi) ├─────────────────┤ X ├┤M├┤ U3(pi/2,0,pi) ├───────┼────────────────────────&#xA;     ├───────────────┤┌───────────────┐└───┘└╥┘└───────────────┘       │                        &#xA;q_2: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──────╫─────────────────────────┼────────────────────────&#xA;     ├───────────────┤├───────────────┤      ║                         │                        &#xA;q_3: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──────╫─────────────────────────┼────────────────────────&#xA;     ├───────────────┤├───────────────┤      ║                         │                        &#xA;q_4: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──────╫─────────────────────────┼────────────────────────&#xA;     └───────────────┘└───────────────┘      ║                      ┌──┴──┐                     &#xA;c: 2/════════════════════════════════════════╩══════════════════════╡ = 2 ╞═════════════════════&#xA;                                             0                      └─────┘                     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-17T23:46:18.067" LastActivityDate="2020-09-17T23:46:18.067" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13802" PostTypeId="2" ParentId="13728" CreationDate="2020-09-17T23:53:59.163" Score="1" Body="&lt;p&gt;use &lt;code&gt;%matplotlin inline&lt;/code&gt; before executing &lt;code&gt;draw('mpl')&lt;/code&gt; here is the &lt;a href=&quot;https://stackoverflow.com/questions/43027980/purpose-of-matplotlib-inline&quot;&gt;link&lt;/a&gt; for more info&lt;/p&gt;&#xA;" OwnerUserId="8527" LastActivityDate="2020-09-17T23:53:59.163" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13803" PostTypeId="1" CreationDate="2020-09-18T00:56:01.710" Score="0" ViewCount="72" Body="&lt;p&gt;I was able to calculate the one and two-body integrals for the H2 with the following code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;&#xA;atom = 'H .0 .0 .0; H .0 .0 0.74' &#xA;distance_unit = UnitsType.ANGSTROM&#xA;basis = 'sto3g'&#xA;&#xA;driver = PySCFDriver(atom, unit=distance_unit, basis=basis)&#xA;&#xA;molecule = driver.run()&#xA;&#xA;h1 = molecule.one_body_integrals&#xA;h2 = molecule.two_body_integrals&#xA;print( h1 ) &#xA;print( h2 ) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the results is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[-1.25330979  0.          0.          0.        ]&#xA; [ 0.         -0.47506885  0.          0.        ]&#xA; [ 0.          0.         -1.25330979  0.        ]&#xA; [ 0.          0.          0.         -0.47506885]]&#xA;[[[[-0.33737796  0.          0.          0.        ]&#xA;   [ 0.         -0.09060523  0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.         -0.09060523  0.          0.        ]&#xA;   [-0.3318557   0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [-0.33737796  0.          0.          0.        ]&#xA;   [ 0.         -0.09060523  0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.         -0.09060523  0.          0.        ]&#xA;   [-0.3318557   0.          0.          0.        ]]]&#xA;&#xA;&#xA; [[[ 0.         -0.3318557   0.          0.        ]&#xA;   [-0.09060523  0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[-0.09060523  0.          0.          0.        ]&#xA;   [ 0.         -0.34882575  0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.         -0.3318557   0.          0.        ]&#xA;   [-0.09060523  0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [-0.09060523  0.          0.          0.        ]&#xA;   [ 0.         -0.34882575  0.          0.        ]]]&#xA;&#xA;&#xA; [[[ 0.          0.         -0.33737796  0.        ]&#xA;   [ 0.          0.          0.         -0.09060523]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.         -0.09060523]&#xA;   [ 0.          0.         -0.3318557   0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.         -0.33737796  0.        ]&#xA;   [ 0.          0.          0.         -0.09060523]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.         -0.09060523]&#xA;   [ 0.          0.         -0.3318557   0.        ]]]&#xA;&#xA;&#xA; [[[ 0.          0.          0.         -0.3318557 ]&#xA;   [ 0.          0.         -0.09060523  0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.         -0.09060523  0.        ]&#xA;   [ 0.          0.          0.         -0.34882575]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.         -0.3318557 ]&#xA;   [ 0.          0.         -0.09060523  0.        ]]&#xA;&#xA;  [[ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.          0.          0.        ]&#xA;   [ 0.          0.         -0.09060523  0.        ]&#xA;   [ 0.          0.          0.         -0.34882575]]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This immediately raises the question of how qiskit labels the two-body integrals. If we look at the definition of second quantized Hamiltonian&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;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&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then we realize that &lt;span class=&quot;math-container&quot;&gt;$h_{0000}=0$&lt;/span&gt;, whereas qiskit gives -0.33737796. The answer for the integrals is given in the following table. Any helps are really appreciated.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aniw1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aniw1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-09-21T14:07:06.447" LastActivityDate="2021-02-18T16:03:15.410" Title="What is the convention of indices for the one and two-body integrals in qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13804" PostTypeId="2" ParentId="13803" CreationDate="2020-09-18T04:02:37.163" Score="0" Body="&lt;p&gt;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 &lt;em&gt;spins&lt;/em&gt; of the orbitals. I think this is explained well in &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/libraries/chemistry/schema/spec_v_0_2?view=qsharp-preview#symmetries&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft's documents&lt;/a&gt;. For example, if the input file notes &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_0 a^\dagger_1 a_1 a_0$&lt;/span&gt;, we need to consider the potential permutations &lt;em&gt;and&lt;/em&gt; the potential spins. So, we'd consider &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_{0, \sigma} a^\dagger_{1, \rho} a_{1, \rho} a_{0, \sigma} $&lt;/span&gt;, and all of the permutations of the numbers, &lt;strong&gt;and&lt;/strong&gt; all combinations of &lt;span class=&quot;math-container&quot;&gt;$\sigma, \rho \in \{ \uparrow, \downarrow \}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{ \uparrow, \downarrow \}$&lt;/span&gt; are the spins.&lt;/p&gt;&#xA;&lt;p&gt;So, while the &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_0 a^\dagger_0 a_0 a_0$&lt;/span&gt; may be invalid, &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_{0, \uparrow}, a^\dagger_{0, \downarrow} a_{0, \downarrow} a_{0, \uparrow} $&lt;/span&gt; is totally valid after indexing.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-18T04:02:37.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13805" PostTypeId="2" ParentId="13697" CreationDate="2020-09-18T06:50:38.240" Score="1" Body="&lt;p&gt;I suppose you want to generate uniformly distributed sequence of bits. In such case you can apply a Hadamard gates on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is number of bits you want to have in your sequence.&lt;/p&gt;&#xA;&lt;p&gt;Application of Hadamard gates on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; will lead to state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H^{\otimes n}|0\rangle ^{\otimes n} = \frac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1}|i\rangle,&#xA;$$&lt;/span&gt;&#xA;i.e. you get equally distributed superposition of all bit strings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After measurement you will get a random sequence of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-18T06:50:38.240" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13806" PostTypeId="2" ParentId="13794" CreationDate="2020-09-18T07:06:45.137" Score="1" Body="&lt;p&gt;I would recommend to use a direct matrix representation.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;An input state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; can be writen as vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x=&#xA;\begin{pmatrix}&#xA;1\\0\\0\\0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;First step, i.e. Hadamard gate on first qubit and &amp;quot;nothing&amp;quot; on second qubit is described by operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \otimes I = \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;\otimes&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Multiplying vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; with matrix &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt; gives vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y=\&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 \\ 0 \\ 1 \\0&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;which is a first column of the matrix.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, you can apply CNOT gate described by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT}=&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;z=\text{CNOT}\, y=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 \\ 0 \\ 0 \\ 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In computational basis, vector &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;z = \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle),&#xA;$$&lt;/span&gt;&#xA;which is a desired Bell state.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-18T07:06:45.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13807" PostTypeId="2" ParentId="13796" CreationDate="2020-09-18T07:28:09.370" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/3985/is-the-quantum-volume-a-fair-metric-for-future-elaborate-high-value-quantum?rq=1&quot;&gt;Is the &amp;quot;Quantum Volume&amp;quot; a fair metric for future, elaborate, high value quantum computations?&lt;/a&gt;) 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.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2020-09-18T07:28:09.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13808" PostTypeId="2" ParentId="13798" CreationDate="2020-09-18T07:48:50.423" Score="0" Body="&lt;p&gt;I don't see a way to avoid the error you are getting as an &lt;code&gt;Instruction&lt;/code&gt; can't handle multiple classical registers but here is a workaround.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def mygate():&#xA;&#xA;  qr = QuantumRegister(4)&#xA;  cr1 = ClassicalRegister(1)&#xA;  cr2 = ClassicalRegister(1)&#xA;&#xA;  qc = QuantumCircuit(qr, cr1, cr2, &#xA;                      name='mygate')&#xA;&#xA;  qc.measure(qr[0], cr1[0])&#xA;  qc.measure(qr[1], cr2[0])&#xA;&#xA;  qc.x(qr[-2]).c_if(cr1, 1)&#xA;  qc.x(qr[-1]).c_if(cr2, 1)&#xA;&#xA;  return qc&#xA;&#xA;&#xA;&#xA;big = QuantumCircuit(5, 4)&#xA;big.compose(mygate(), &#xA;            qubits=range(4), clbits=range(2), &#xA;            inplace=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-18T07:48:50.423" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13809" PostTypeId="1" CreationDate="2020-09-18T08:57:26.460" Score="1" ViewCount="51" Body="&lt;p&gt;Is there a method to correct an error of the form of &lt;span class=&quot;math-container&quot;&gt;$e^{ix}$&lt;/span&gt;, acted on a two-qubit state without knowing the nature (the value of x) of the error?&lt;/p&gt;&#xA;&lt;p&gt;For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha|00\rangle +\beta|01\rangle+\gamma|10\rangle+e^{ix}\delta|11\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, can I rephrase the above question to:&lt;/p&gt;&#xA;&lt;p&gt;Is there a method to correct an error that results an orthogonal state to deform into a non-orthogonal state?&lt;/p&gt;&#xA;" OwnerUserId="6297" LastEditorUserId="55" LastEditDate="2020-09-21T14:07:36.947" LastActivityDate="2020-09-21T14:07:36.947" Title="How to correct a phase error of the form $e^{ix}$" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13810" PostTypeId="2" ParentId="13728" CreationDate="2020-09-18T10:24:13.173" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;!pip install&#xA;qiskit==0.16.1&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="7889" LastActivityDate="2020-09-18T10:24:13.173" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13811" PostTypeId="2" ParentId="12068" CreationDate="2020-09-18T10:55:00.387" Score="2" Body="&lt;p&gt;You basically have to construct:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A parametrized circuit&lt;/li&gt;&#xA;&lt;li&gt;Objective function which returns the cost&lt;/li&gt;&#xA;&lt;li&gt;Minimize the cost with the classical optimizer eg. COBYLA&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Example:&#xA;&lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#Example-with-a-Single-Qubit-Variational-Form&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#Example-with-a-Single-Qubit-Variational-Form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13277" LastActivityDate="2020-09-18T10:55:00.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13812" PostTypeId="1" CreationDate="2020-09-18T11:13:37.307" Score="1" ViewCount="32" Body="&lt;p&gt;Suppose I have a portfolio optimization problem where I have to minimize,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$qx^T\sum x - \mu^Tx$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where q is the maximum risk and x is {0,1}^n and &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; are the expected returns.&lt;/p&gt;&#xA;&lt;p&gt;Now I have to convert this problem into Hamiltonian and subsequently find the Pauli Basis for it. How can I do so?&lt;/p&gt;&#xA;" OwnerUserId="13277" LastActivityDate="2020-09-18T11:13:37.307" Title="How to construct Hamiltonian for combinatorial optimization problems and then convert into Pauli basis?" Tags="&lt;vqe&gt;&lt;qaoa&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13813" PostTypeId="2" ParentId="11463" CreationDate="2020-09-18T11:29:51.427" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Find more details on:&#xA;&lt;a href=&quot;https://arxiv.org/pdf/1907.04769.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1907.04769.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13277" LastActivityDate="2020-09-18T11:29:51.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13814" PostTypeId="2" ParentId="5769" CreationDate="2020-09-18T12:03:25.497" Score="-3" Body="&lt;p&gt;You can also use Qiskit, as described &lt;a href=&quot;https://medium.com/@arnaldogunzi/how-to-calculate-the-depth-of-a-quantum-circuit-in-qiskit-868505abc104&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;In Qiskit, it can be calculated using &lt;code&gt;QuantumCircuit.depth&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13278" LastEditorUserId="23" LastEditDate="2020-09-18T20:32:16.800" LastActivityDate="2020-09-18T20:32:16.800" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13815" PostTypeId="2" ParentId="9571" CreationDate="2020-09-18T16:30:04.367" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}&#xA;\newcommand{\ket}[1]{\left|#1\right&amp;gt;}&#xA;\newcommand{\sch}[1]{\operatorname{Sch}\left( #1 \right)}&#xA;\newcommand{\cases}[3]{&#xA;#1 =&#xA;\begin{cases}&#xA;#2 \hspace{1em} \text{if} \hspace{1em} i \le \sch{\gamma} \\&#xA;#3 \hspace{1em} \text{otherwise}&#xA;\end{cases}}&#xA;$&lt;/span&gt;If &lt;span class=&quot;math-container&quot;&gt;$\sch{\phi} = \sch{\gamma}$&lt;/span&gt; then we are done because &lt;span class=&quot;math-container&quot;&gt;$\sch{\psi} \ge 0$&lt;/span&gt; always holds for a pure state.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\sch{\phi} \ne \sch{\gamma}$&lt;/span&gt; then let's assume that the statement of the problem does &lt;em&gt;not&lt;/em&gt; hold, so we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sch{\psi} \lt | \sch{\phi} - \sch{\gamma}| \tag{1}\label{1}&#xA;$$&lt;/span&gt;&#xA;Without loss of generality we can assume that &lt;span class=&quot;math-container&quot;&gt;$\sch{\phi} &amp;gt; \sch{\gamma}$&lt;/span&gt;. From this we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sch{\phi} &amp;gt; \sch{\gamma} + \sch{\psi} \tag{2}\label{2}&#xA;$$&lt;/span&gt;&#xA;We can write:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{\phi} = \frac{\beta}{\alpha} \ket{\gamma} - &#xA;\frac{1}{\alpha} \ket{\psi} \tag{3}\label{3}&#xA;$$&lt;/span&gt;&#xA;We can write the Schmidt decomposition of &lt;span class=&quot;math-container&quot;&gt;$\ket{\gamma}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{\gamma} = \sum_{i=1}^{\sch{\gamma}} \gamma_i \ket{a_i^{\gamma}} \ket{b_i^{\gamma}} \\&#xA;\ket{\psi} = \sum_{i=1}^{\sch{\psi}} \psi_i \ket{a_i^{\psi}} \ket{b_i^{\psi}}&#xA;$$&lt;/span&gt;&#xA;Plugging these into &lt;span class=&quot;math-container&quot;&gt;$\eqref{3}$&lt;/span&gt;, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{\phi} = \sum_{i=1}^{\sch{\gamma} + \sch{\psi}} \delta_i \ket{a_i^{\delta}} \ket{b_i^{\delta}} \tag{4}\label{4}&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cases{\delta_i }{\frac{\beta}{\alpha} \gamma_i}{-\frac{1}{\alpha} \psi_i}\\&#xA;\cases{a_i^{\delta}}{a_i^{\gamma}}{a_i^{\psi}}\\&#xA;\cases{b_i^{\delta}}{b_i^{\gamma}}{b_i^{\psi}}&#xA;$$&lt;/span&gt;&#xA;Now we can invoke the result of Problem 2.2 (2) from Nielsen and Chuang. This says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi} = \sum_j \ket{\alpha_j}\ket{\beta_j}$&lt;/span&gt; is a representation for &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\ket{\alpha_j}$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$\ket{\beta_j}$&lt;/span&gt; are (un-normalized) states for systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, respectively. Prove that the number of terms in such a decomposition is greater than or equal to the Schmidt number of &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sch{\psi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Applying this to \eqref{4}, we obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sch{\phi} \le \sch{\gamma} + \sch{\psi} \tag{5}\label{5}&#xA;$$&lt;/span&gt;&#xA;This contradicts &lt;span class=&quot;math-container&quot;&gt;$\eqref{2}$&lt;/span&gt; which is derived from &lt;span class=&quot;math-container&quot;&gt;$\eqref{1}$&lt;/span&gt;, so we must have &lt;span class=&quot;math-container&quot;&gt;$\sch{\psi} \ge | \sch{\phi} - \sch{\gamma}|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12643" LastActivityDate="2020-09-18T16:30:04.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13816" PostTypeId="1" CreationDate="2020-09-18T17:37:15.260" Score="3" ViewCount="25" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ A|{0} \rangle^{\otimes^{n+1}} = |0\rangle |\psi_0\rangle + |1\rangle |\psi_1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was wondering the following:&lt;/p&gt;&#xA;&lt;p&gt;a) If we don't have a guarantee that a solution &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; exists, what happens if we perform amplitude estimation/amplification?.&lt;/p&gt;&#xA;&lt;p&gt;b) Is quantum amplitude estimation bounded by the initial probability of &lt;span class=&quot;math-container&quot;&gt;$|{\psi_1}\rangle$&lt;/span&gt; or is it  bounded with the size of the hillbert space? With the assumption that all &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible states  are initialized with the same amplitude, we would need &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2^n}$&lt;/span&gt; steps to boost the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|{\psi_1}\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{1}{2}}$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\frac{1}{2^n}}$&lt;/span&gt; (using &lt;span class=&quot;math-container&quot;&gt;$\mathbf{Q} = -AS_oA^{-1}S_x$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$S_o$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-09-23T09:28:57.483" LastActivityDate="2020-09-23T09:28:57.483" Title="Amplitude estimation over subspace of problem" Tags="&lt;algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13817" PostTypeId="2" ParentId="13794" CreationDate="2020-09-18T20:54:57.530" Score="1" Body="&lt;p&gt;I will answer the question in a different way. Let's assume your two qubits are represented as below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/T9jJJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/T9jJJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Consider your &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, represented by &lt;span class=&quot;math-container&quot;&gt;$|q_1q_0\rangle$&lt;/span&gt;, is the state of above circuit before applying any gates, this is same as your original state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now applying hadamard in your step 2 is same as applying hadamard on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. We know &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. So if apply hadamard gate on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; it will be transformed to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;. (check this by doing simple matrix multiplication if you are in doubt).&lt;/p&gt;&#xA;&lt;p&gt;Let's see &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; now, no gate is applied to it so it remains as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So now, the combined state is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$&lt;/span&gt; after applying the hadamard gate.&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and target qubit is &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;. So let's apply CNOT on &lt;span class=&quot;math-container&quot;&gt;$|q_1q_0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT(\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle))$&lt;/span&gt; when you apply from rightmost, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; transforms to &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as control qubit (&lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;) is contributing &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; here so the target qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; which is contributing &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; flips to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Similarly if you move left, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; will remain &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; as control qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is contributing &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to this part, so flipping is not required, hence target qubit(&lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;) remains same(&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;). So putting both together you get following&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;CNOT(&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$&lt;/span&gt;) = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This way of thinking would be helpful when you are dealing with bigger transformations and more qubits. Hope it is helpful.&lt;/p&gt;&#xA;" OwnerUserId="13102" LastActivityDate="2020-09-18T20:54:57.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13818" PostTypeId="1" CreationDate="2020-09-18T21:25:36.330" Score="2" ViewCount="26" Body="&lt;p&gt;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!).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4210" LastEditorUserId="55" LastEditDate="2020-09-20T17:30:51.680" LastActivityDate="2020-09-20T17:30:51.680" Title="Keeping data around in an entangled state: use cases" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13819" PostTypeId="2" ParentId="13781" CreationDate="2020-09-18T22:16:18.663" Score="1" Body="&lt;p&gt;On a quantum computer, there is &lt;em&gt;no point&lt;/em&gt; in implementing a partial trace.  Just ignore the qubits which you want to trace.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-09-18T22:16:18.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13820" PostTypeId="1" AcceptedAnswerId="13858" CreationDate="2020-09-18T23:18:21.650" Score="1" ViewCount="107" Body="&lt;p&gt;I am following this &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#B.-Running-HHL-on-a-real-quantum-device:-optimised-example&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL tutorial&lt;/a&gt; to solve the &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; than the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;x&lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; that they use. Is there a general approach to optimizing an HHL circuit?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="55" LastEditDate="2020-09-21T14:12:22.720" LastActivityDate="2020-09-21T14:12:22.720" Title="How to optimize my HHL algorithm on qiskit?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13821" PostTypeId="1" AcceptedAnswerId="13823" CreationDate="2020-09-19T11:15:23.260" Score="3" ViewCount="137" Body="&lt;p&gt;I wish to generate the following unitary&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[1,0,0,0,0,0,0,0;&#xA;0,1,0,0,0,0,0,0;&#xA;0,0,1,0,0,0,0,0;&#xA;0,0,0,0,1,0,0,0;&#xA;0,0,0,1,0,0,0,0;&#xA;0,0,0,0,0,1,0,0;&#xA;0,0,0,0,0,0,1,0;&#xA;0,0,0,0,0,0,0,1;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-09-21T14:13:13.347" LastActivityDate="2020-09-21T15:40:07.587" Title="Generate a 3-qubit SWAP unitary in terms of elementary gates" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13822" PostTypeId="1" AcceptedAnswerId="13832" CreationDate="2020-09-19T12:02:14.917" Score="0" ViewCount="50" Body="&lt;p&gt;I have this program derived from Microsoft Quantum Kata for quantum search (Grover algorithm) (see &lt;a href=&quot;https://gist.github.com/friguzzi/3fb1006d2b81fd97d92858d7ddf5a284&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Quantum.Search {&#xA;&#xA;&#xA;open Microsoft.Quantum.Intrinsic;&#xA;open Microsoft.Quantum.Canon;&#xA;open Microsoft.Quantum.Convert;&#xA;open Microsoft.Quantum.Math;&#xA;open Microsoft.Quantum.Oracles;&#xA;open Microsoft.Quantum.Arithmetic;&#xA;open Microsoft.Quantum.Characterization;&#xA;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Measurement;&#xA;&#xA;&#xA;operation SprinklerAnc (queryRegister:  Qubit[],  target : Qubit) : Unit is Adj+Ctl &#xA;{&#xA;    using (ancilla=Qubit[3 ])&#xA;    {&#xA;        X(queryRegister[2]);&#xA;        X(ancilla[0]);&#xA;        X(ancilla[1]);&#xA;        X(ancilla[2]);&#xA;    &#xA;        CCNOT(queryRegister[0],queryRegister[1],ancilla[0]);&#xA;        CCNOT(queryRegister[1],queryRegister[2],ancilla[1]);&#xA;        CCNOT(queryRegister[0],queryRegister[2],ancilla[2]);&#xA;        (Controlled X)([ancilla[0],ancilla[1],ancilla[2],queryRegister[3]],target);&#xA;        CCNOT(queryRegister[0],queryRegister[2],ancilla[2]);&#xA;        CCNOT(queryRegister[1],queryRegister[2],ancilla[1]);&#xA;        CCNOT(queryRegister[0],queryRegister[1],ancilla[0]);&#xA;&#xA;        X(ancilla[2]);&#xA;        X(ancilla[1]);&#xA;        X(ancilla[0]);&#xA;        X(queryRegister[2]);&#xA;&#xA;    }&#xA;}&#xA;&#xA;operation ApplyMarkingOracleAsPhaseOracle (markingOracle : ((Qubit[], Qubit) =&amp;gt; Unit is Adj+Ctl),  register : Qubit[] ) :  Unit is Adj+Ctl &#xA;{&#xA;    &#xA;    using (target = Qubit()) &#xA;    {&#xA;        // Put the target into the |-⟩ state&#xA;        X(target);&#xA;        H(target);&#xA;            &#xA;        // Apply the marking oracle; since the target is in the |-⟩ state,&#xA;        // flipping the target if the register satisfies the oracle condition will apply a -1 factor to the state&#xA;        markingOracle(register, target);&#xA;            &#xA;        // Put the target back into |0⟩ so we can return it&#xA;        H(target);&#xA;        X(target);&#xA;    }&#xA;}&#xA;&#xA;&#xA;// The Grover iteration&#xA;operation GroverIteration (register : Qubit[], oracle : ((Qubit[],Qubit) =&amp;gt; Unit is Adj+Ctl)) : Unit is Ctl+Adj&#xA;{&#xA;    &#xA;    ApplyMarkingOracleAsPhaseOracle(oracle,register);&#xA;    ApplyToEachCA(H, register);&#xA;    using (ancilla = Qubit()){&#xA;            (ControlledOnInt(0, X))(register, ancilla); // Bit flips the ancilla to |1⟩ if register is |0...0⟩   &#xA;            Z(ancilla);                                 // Ancilla phase (and therefore whole register phase) becomes -1 if above condition is satisfied&#xA;            &#xA;            (ControlledOnInt(0, X))(register, ancilla); // Puts ancilla back in |0⟩  &#xA;    } &#xA;    Ry(2.0 * PI(), register[0]);&#xA;    ApplyToEachCA(H, register);&#xA;}    &#xA;&#xA;&#xA;operation Search() : Result[] &#xA;{&#xA;    &#xA;    using (reg=Qubit[4 ])&#xA;    {&#xA;&#xA;&#xA;  H(reg[0]);&#xA;  H(reg[1]);&#xA;  H(reg[2]);&#xA;  H(reg[3]);&#xA;  for (i in 1 ..2) {&#xA;  GroverIteration(reg, SprinklerAnc);&#xA;  }&#xA;  let state = MultiM(reg);&#xA;&#xA;  ResetAll(reg);&#xA;  return state;&#xA;  }&#xA;&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;with driver&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;using System;&#xA;using Microsoft.Quantum.Simulation.Core;&#xA;using Microsoft.Quantum.Simulation.Simulators;&#xA;using System.Collections.Generic;&#xA;&#xA;namespace Quantum.Search&#xA;{&#xA;class Driver&#xA;{&#xA;    static void Main(string[] args)&#xA;    {&#xA;&#xA;        using (var qsim = new QuantumSimulator())&#xA;        {&#xA;            IDictionary&amp;lt;string, int&amp;gt; dict = new Dictionary&amp;lt;string, int&amp;gt;();&#xA;            for (int i = 0; i &amp;lt; 1000; i++)&#xA;            {&#xA;                IQArray&amp;lt;Result&amp;gt; res = QMPE.Run(qsim).Result;&#xA;                string s = Convert.ToString(res);&#xA;                int result;&#xA;                if (dict.TryGetValue(s, out result))&#xA;                {&#xA;                    dict.Remove(s);&#xA;                    dict.Add(s, result + 1);&#xA;                }&#xA;                else&#xA;                {&#xA;&#xA;                    dict.Add(s, 1);&#xA;                }&#xA;                System.Console.WriteLine($&amp;quot;Res:{s}&amp;quot;);&#xA;&#xA;            }&#xA;            foreach (KeyValuePair&amp;lt;string, int&amp;gt; item in dict)&#xA;            {&#xA;                Console.WriteLine(&amp;quot;Key: {0}, Value: {1}&amp;quot;, item.Key, item.Value);&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It should search for the solutions of the 3 bits formula (not reg[0] or reg[2]) and (not reg&lt;a href=&quot;https://gist.github.com/friguzzi/3fb1006d2b81fd97d92858d7ddf5a284&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; or reg[2]) and (not reg[0] or not reg&lt;a href=&quot;https://gist.github.com/friguzzi/3fb1006d2b81fd97d92858d7ddf5a284&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;) 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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Key: [One,One,One,Zero], Value: 57&#xA;Key: [One,One,Zero,Zero], Value: 63&#xA;Key: [Zero,One,One,One], Value: 58&#xA;Key: [Zero,One,One,Zero], Value: 74&#xA;Key: [One,Zero,One,One], Value: 70&#xA;Key: [One,Zero,One,Zero], Value: 70&#xA;Key: [Zero,Zero,One,Zero], Value: 76&#xA;Key: [One,Zero,Zero,One], Value: 47&#xA;Key: [Zero,Zero,Zero,Zero], Value: 79&#xA;Key: [Zero,One,Zero,Zero], Value: 66&#xA;Key: [One,One,One,One], Value: 52&#xA;Key: [Zero,Zero,Zero,One], Value: 55&#xA;Key: [One,Zero,Zero,Zero], Value: 58&#xA;Key: [Zero,One,Zero,One], Value: 58&#xA;Key: [Zero,Zero,One,One], Value: 63&#xA;Key: [One,One,Zero,One], Value: 54&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="7318" LastEditorUserId="2879" LastEditDate="2020-09-20T02:28:59.873" LastActivityDate="2020-09-20T02:51:13.043" Title="Grover algorithm in Q#" Tags="&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13823" PostTypeId="2" ParentId="13821" CreationDate="2020-09-19T14:10:30.183" Score="3" Body="&lt;p&gt;By using similar ideas from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12440/9459&quot;&gt;answer&lt;/a&gt; I have found this circuit:&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/Siiho.png&quot; width=&quot;400&quot; /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Thought process:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The unitary is a permutation matrix that doesn't change bitstrings except &lt;span class=&quot;math-container&quot;&gt;$U |100\rangle \rightarrow |011\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U |011\rangle \rightarrow |100\rangle$&lt;/span&gt; (identity action on the rest of the bitstrings). Here I am going to use Qiskit's indexing convention (qubit indexing in Qiskit &lt;span class=&quot;math-container&quot;&gt;$|q_2 q_1 q_0 \rangle$&lt;/span&gt;). Note that the Toffoli gate and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; CNOT's after it will do the job for &lt;span class=&quot;math-container&quot;&gt;$U |011\rangle \rightarrow |100\rangle$&lt;/span&gt; and the same Tofalli with &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; CNOTs before it will do the job for &lt;span class=&quot;math-container&quot;&gt;$U |100\rangle \rightarrow |011\rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Qiskit code for prove:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;import qiskit.quantum_info as qi&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;&#xA;circuit.cx(2, 1)&#xA;circuit.cx(2, 0)&#xA;circuit.ccx(0, 1, 2)&#xA;circuit.cx(2, 1)&#xA;circuit.cx(2, 0)&#xA;&#xA;matrix = qi.Operator(circuit)&#xA;print(matrix.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;The output (the matrix that corresponds to the circuit):&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[1 0 0 0 0 0 0 0]&#xA; [0 1 0 0 0 0 0 0]&#xA; [0 0 1 0 0 0 0 0]&#xA; [0 0 0 0 1 0 0 0]&#xA; [0 0 0 1 0 0 0 0]&#xA; [0 0 0 0 0 1 0 0]&#xA; [0 0 0 0 0 0 1 0]&#xA; [0 0 0 0 0 0 0 1]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-21T15:40:07.587" LastActivityDate="2020-09-21T15:40:07.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13824" PostTypeId="2" ParentId="13651" CreationDate="2020-09-19T17:02:55.483" Score="1" Body="&lt;p&gt;Please notice that the previous answer may unnecessarily remove gates.&#xA;It depends on the order you insert them in your circuit.&lt;/p&gt;&#xA;&lt;p&gt;For example, constructing the circuit you provided with the following code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2)&#xA;&#xA;qc.sdg(0)&#xA;qc.h(0)&#xA;&#xA;qc.y(1)&#xA;qc.h(1)&#xA;qc.s(1)&#xA;&#xA;qc.cx(0, 1)&#xA;qc.cx(1, 0)&#xA;&#xA;qc.h(0)&#xA;qc.s(0)&#xA;qc.h(0)&#xA;&#xA;qc.h(1)&#xA;qc.s(1)&#xA;qc.h(1)&#xA;&#xA;print(qc)&#xA;---&#xA;     ┌─────┐┌───┐          ┌───┐┌───┐┌───┐┌───┐&#xA;q_0: ┤ SDG ├┤ H ├───────■──┤ X ├┤ H ├┤ S ├┤ H ├&#xA;     └┬───┬┘├───┤┌───┐┌─┴─┐└─┬─┘├───┤├───┤├───┤&#xA;q_1: ─┤ Y ├─┤ H ├┤ S ├┤ X ├──■──┤ H ├┤ S ├┤ H ├&#xA;      └───┘ └───┘└───┘└───┘     └───┘└───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and after removing the last 2 layers with your method we get&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌─────┐┌───┐          ┌───┐┌───┐&#xA;q_0: ┤ SDG ├┤ H ├───────■──┤ X ├┤ H ├&#xA;     └┬───┬┘├───┤┌───┐┌─┴─┐└─┬─┘└───┘&#xA;q_1: ─┤ Y ├─┤ H ├┤ S ├┤ X ├──■───────&#xA;      └───┘ └───┘└───┘└───┘          &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Notice how the last 3 gates acting on qubit 1 disappear although we should keep one extra Hadamard.&lt;/p&gt;&#xA;&lt;p&gt;For a more robust solution, we should work with a representation of the circuit that captures the topological dependencies present, i.e &lt;code&gt;DAGCircuit&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.converters import circuit_to_dag, dag_to_circuit&#xA;&#xA;dag = circuit_to_dag(qc)&#xA;layers = list(dag.multigraph_layers())&#xA;&#xA;n_remove = 2&#xA;&#xA;# the extra minus 1 since the last layer consists of output nodes (qubits and clbits).&#xA;for layer in layers[- n_remove - 1:]:&#xA;&#xA;    for node in layer:&#xA;        if node.type == 'op':&#xA;            dag.remove_op_node(node)&#xA;                   &#xA;new_qc = dag_to_circuit(dag)&#xA;&#xA;print(new_qc)&#xA;---&#xA;     ┌─────┐┌───┐          ┌───┐┌───┐&#xA;q_0: ┤ SDG ├┤ H ├───────■──┤ X ├┤ H ├&#xA;     └┬───┬┘├───┤┌───┐┌─┴─┐└─┬─┘├───┤&#xA;q_1: ─┤ Y ├─┤ H ├┤ S ├┤ X ├──■──┤ H ├&#xA;      └───┘ └───┘└───┘└───┘     └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-19T17:02:55.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13825" PostTypeId="2" ParentId="9432" CreationDate="2020-09-19T17:48:46.863" Score="1" Body="&lt;p&gt;For doing that in Qiskit, first create a multi qubit gate as a custom gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;x_circuit = QuantumCircuit(3, name='Xs')&#xA;x_circuit.x(range(3))&#xA;&#xA;xs_gate = x_circuit.to_gate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then create a controlled version of that custom gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cxs_gate = xs_gate.control()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, use that controlled custom gate in a circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(8)&#xA;circuit.append(cxs_gate, [0,2,6,4])&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ───■───&#xA;        │&#xA;q_1: ───┼───&#xA;     ┌──┴──┐&#xA;q_2: ┤0    ├&#xA;     │     │&#xA;q_3: ┤     ├&#xA;     │     │&#xA;q_4: ┤2 Xs ├&#xA;     │     │&#xA;q_5: ┤     ├&#xA;     │     │&#xA;q_6: ┤1    ├&#xA;     └─────┘&#xA;q_7: ───────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can decompose one level to see how it works internally:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(circuit.decompose())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ──■────■────■──&#xA;       │    │    │&#xA;q_1: ──┼────┼────┼──&#xA;     ┌─┴─┐  │    │&#xA;q_2: ┤ X ├──┼────┼──&#xA;     └───┘  │    │&#xA;q_3: ───────┼────┼──&#xA;            │  ┌─┴─┐&#xA;q_4: ───────┼──┤ X ├&#xA;            │  └───┘&#xA;q_5: ───────┼───────&#xA;          ┌─┴─┐&#xA;q_6: ─────┤ X ├─────&#xA;          └───┘&#xA;q_7: ───────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-19T17:48:46.863" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13826" PostTypeId="2" ParentId="13821" CreationDate="2020-09-19T18:15:43.937" Score="1" Body="&lt;p&gt;Qiskit supports &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.unitary.html#qiskit.circuit.QuantumCircuit.unitary&quot; rel=&quot;nofollow noreferrer&quot;&gt;gates defined by arbitrary unitary matrices&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/apidoc/quantum_info.html#synthesis&quot; rel=&quot;nofollow noreferrer&quot;&gt;unitary synthesis&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;First, define the matrix as a &lt;a href=&quot;https://numpy.org/doc/stable/reference/arrays.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Numpy array&lt;/a&gt;, convert it into a gate and add it to a circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.extensions import UnitaryGate&#xA;&#xA;matrix = np.array([[1,0,0,0,0,0,0,0],&#xA;                   [0,1,0,0,0,0,0,0],&#xA;                   [0,0,1,0,0,0,0,0],&#xA;                   [0,0,0,0,1,0,0,0],&#xA;                   [0,0,0,1,0,0,0,0],&#xA;                   [0,0,0,0,0,1,0,0],&#xA;                   [0,0,0,0,0,0,1,0],&#xA;                   [0,0,0,0,0,0,0,1]], dtype=np.complex)&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;circuit.append(UnitaryGate(matrix), [0,1,2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, transpile it into your desired basis (the current synthesizer only supports 1q- and 2q-gates basis):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import transpile&#xA;&#xA;new_circuit = transpile(circuit, basis_gates=['cx', 'u1', 'u2', 'u3'])&#xA;new_circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qKFbd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qKFbd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can check the equivalence with &lt;code&gt;Operator&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator&#xA;Operator(new_circuit).equiv(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-20T13:10:55.447" LastActivityDate="2020-09-20T13:10:55.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13827" PostTypeId="1" CreationDate="2020-09-19T19:10:47.180" Score="0" ViewCount="31" Body="&lt;p&gt;Where do I see the diffusion in the Grovers operator?&lt;/p&gt;&#xA;&lt;p&gt;I would think there should be an analogy to classical diffusion but I am not able to see the correspondence.&lt;/p&gt;&#xA;" OwnerUserId="13285" LastEditorUserId="55" LastEditDate="2020-09-20T22:08:09.747" LastActivityDate="2020-09-20T22:08:09.747" Title="Why does Grover's Diffusion Operator have the word &quot;diffusion&quot; in its name?" Tags="&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-09-20T09:24:32.707" ContentLicense="CC BY-SA 4.0" />
  <row Id="13828" PostTypeId="1" AcceptedAnswerId="13831" CreationDate="2020-09-19T20:51:45.900" Score="1" ViewCount="82" Body="&lt;p&gt;I fail to understand Deutsch-Jozsa algorithm.&#xA;As wikipedia suggests: &lt;span class=&quot;math-container&quot;&gt;${\displaystyle f\colon \{0,1\}^{n}\rightarrow \{0,1\}}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I also read here: &lt;a href=&quot;http://www.diva-portal.org/smash/get/diva2:840938/FULLTEXT01.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.diva-portal.org/smash/get/diva2:840938/FULLTEXT01.pdf&lt;/a&gt;:&#xA;Consider that Bob generates a list of arbitrary length from a balanced function. Then the list will contain equally many zeros and&#xA;ones, thus if Alice draws a random element in the list it will be a&#xA;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&#xA;an equal probability of 1/4. If Alice now has to guess whether the&#xA;function was constant or balanced, she will guess correctly half of&#xA;the times. If she instead draws a third element the outcome will&#xA;be a uniform probability distribution over the following possible outcomes ”000”, ”001”, ”010”, ”011”, ”100”, ”101”, ”110” and ”111”. Alice&#xA;will now guess correctly six out of eight times.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Qurstion 2: So if she has ”001” (or eve &amp;quot;01&amp;quot;/&amp;quot;10&amp;quot;) isn't that already a balanced function?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13286" LastActivityDate="2020-09-20T13:28:16.463" Title="Deutsch-Jozsa Misunderstanding" Tags="&lt;algorithm&gt;&lt;quantum-state&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13830" PostTypeId="1" AcceptedAnswerId="13867" CreationDate="2020-09-19T21:42:20.443" Score="0" ViewCount="46" Body="&lt;p&gt;I have run a batch of a few thousand random 2-qubit &lt;code&gt;QuantumCircuit&lt;/code&gt;s 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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Qubits or&lt;/li&gt;&#xA;&lt;li&gt;Quantum Volume(QV)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;results in faster execution. As per my knowledge, this could be explained either by&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;increased parallel execution of the batch with more qubits or&lt;/li&gt;&#xA;&lt;li&gt;systems with higher QV operate at proportionately higher clock speeds (I am more inclined to this explanation as the fastest job executed on &lt;code&gt;ibmq_montreal&lt;/code&gt; despite having fewer qubits than &lt;code&gt;ibmq_rochester&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Are any of these explanations correct or is there an entirely different explanation for this observation?&lt;/p&gt;&#xA;&lt;p&gt;I have used the following backends:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;ibmq_montreal&lt;/code&gt; - 27 qubits with QV 32&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ibmq_vigo&lt;/code&gt; - 5 qubits with QV 16&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ibmq_rochester&lt;/code&gt; - 53 qubits QV 8&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-21T14:18:44.567" LastActivityDate="2020-09-21T19:08:06.953" Title="Why does job execution time vary significantly across different IBMQ Backends?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13831" PostTypeId="2" ParentId="13828" CreationDate="2020-09-20T01:42:21.003" Score="1" Body="&lt;p&gt;Regarding your first question, there are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; inputs to &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and the task is to determine if &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant or balanced (under the promise that it is one or the other); you can do this on a quantum computer with a &lt;em&gt;single&lt;/em&gt; query to &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.  If &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt;, then classically you can do as you suggest, input &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; for one query, and input &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for another query, for a total of two queries, but the quantum computer still wins with only one query.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;guarantee&lt;/em&gt; it's balanced with only a &lt;em&gt;single&lt;/em&gt; query.&lt;/p&gt;&#xA;&lt;p&gt;Classically you need at least two, and up to &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}+1$&lt;/span&gt;, queries, but quantum-mechanically a single query suffices.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-09-20T01:42:21.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13832" PostTypeId="2" ParentId="13822" CreationDate="2020-09-20T02:51:13.043" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Key: [Zero,Zero,One,One], Value: 255&#xA;Key: [Zero,Zero,Zero,One], Value: 251&#xA;Key: [Zero,One,One,One], Value: 233&#xA;Key: [One,Zero,One,One], Value: 261&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The general formula for the number of solutions is &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}\sqrt{\frac{N}{M}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$N = 16$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M = 4$&lt;/span&gt;, gives us &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2} \approx 1.5$&lt;/span&gt;, which can be rounded either up or down.&lt;/p&gt;&#xA;&lt;p&gt;If we look at the derivation of the formula, however, we'll see that the square root is an approximation made assuming that &lt;span class=&quot;math-container&quot;&gt;$M &amp;lt;&amp;lt; N$&lt;/span&gt;, and the optimal number of iterations is &lt;span class=&quot;math-container&quot;&gt;$&amp;gt;&amp;gt; 1$&lt;/span&gt;. The exact formula is &lt;span class=&quot;math-container&quot;&gt;$\frac12 \big( \frac{\pi}{2\arcsin \sqrt{\frac{M}{N}}}-1\big)$&lt;/span&gt;, which will give us &lt;span class=&quot;math-container&quot;&gt;$\arcsin \sqrt{\frac{M}{N}} = \arcsin 0.5 = \frac{\pi}{6}$&lt;/span&gt; and the optimal number of iterations equal to 1.&lt;/p&gt;&#xA;&lt;p&gt;You can see the visual derivation of the formula in &lt;a href=&quot;https://github.com/microsoft/GHC19-GroverSearch/blob/master/GHC19-IntroToQuantumComputing-Grover.pptx&quot; rel=&quot;nofollow noreferrer&quot;&gt;this slide deck&lt;/a&gt; - it shows where these assumptions come from and how they affect the result.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-09-20T02:51:13.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13833" PostTypeId="1" CreationDate="2020-09-20T03:47:34.363" Score="4" ViewCount="45" Body="&lt;p&gt;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 &amp;quot;large enough&amp;quot; number of qubits and low decoherence to be actually useful.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Where does this belief come from? &lt;strong&gt;Are there factual, scientific arguments to support that?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13287" LastEditorUserId="55" LastEditDate="2020-09-21T14:25:40.243" LastActivityDate="2020-09-21T14:25:40.243" Title="Why is there so much hope around quantum computers?" Tags="&lt;research&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="0" ClosedDate="2020-09-29T09:05:49.007" ContentLicense="CC BY-SA 4.0" />
  <row Id="13834" PostTypeId="1" CreationDate="2020-09-20T04:50:14.940" Score="0" ViewCount="100" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How to solve this problem?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="9006" LastEditDate="2020-09-20T06:41:08.223" LastActivityDate="2020-09-20T13:21:20.717" Title="Generate a random bit sequence of 512 bits" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2020-09-20T22:36:33.883" ContentLicense="CC BY-SA 4.0" />
  <row Id="13835" PostTypeId="1" CreationDate="2020-09-20T08:31:48.290" Score="-1" ViewCount="78" Body="&lt;p&gt;Now, I'm implementing Matrix product state method with QasmSimulation in Qiskit.&#xA;following code&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2abcR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2abcR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9jcMB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9jcMB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The problem arise when I set number of qubits. When running it with 27qubits is very fast&#xA;but, for 24, 25, 26qubits it take too much time. Why it happens?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="55" LastEditDate="2020-09-20T22:09:54.767" LastActivityDate="2020-09-20T22:09:54.767" Title="Qiskit implementation for MPS" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13836" PostTypeId="2" ParentId="13834" CreationDate="2020-09-20T08:48:09.733" Score="1" Body="&lt;p&gt;Here is a code that will generate random bitstring. Althoug in the code, I have used &lt;code&gt;qasm_simulator&lt;/code&gt;, it can be replaced with any available quantum hardware from IBM.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;&#xA;def random_bitstring_generator(bit_number, backend):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    Generate a bitstring with one qubit&#xA;    :param bit_number: number of bits that we want to generate&#xA;    :param backend: Qiskit hardware or simulator&#xA;    :return: string object with random bits&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;&#xA;    one_qubit_random_bit_generator_circuit = QuantumCircuit(1, 1)&#xA;    one_qubit_random_bit_generator_circuit.h(0)&#xA;    one_qubit_random_bit_generator_circuit.measure(0, 0)&#xA;&#xA;    for _ in range(bit_number):&#xA;        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1).result().get_counts()&#xA;        bit = list(counts.keys())[0]  # we have only one key because shots=1&#xA;        bitstring += bit&#xA;&#xA;    return bitstring&#xA;&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;print(random_bitstring_generator(512, backend))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;00000000000000000000000000000000000000000000000011111111111111111111111100000000111111111111111111111111000000000000000000000000000000001111111111111111000000000000000011111111000000000000000011111111111111111111111111111111111111111111111111111111111111111111111100000000000000001111111111111111111111111111111100000000111111110000000000000000000000000000000000000000111111110000000000000000000000001111111111111111000000001111111111111111000000001111111111111111111111111111111111111111000000001111111100000000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As one can see the generated bitstring doesn't look random. Maybe it is because of &lt;code&gt;qasm_simulator&lt;/code&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-09-20T08:48:09.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13837" PostTypeId="1" CreationDate="2020-09-20T09:53:38.017" Score="0" ViewCount="66" Body="&lt;p&gt;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?&#xA;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]).&#xA;Here is the Q# code &lt;a href=&quot;https://gist.github.com/friguzzi/833ded93a640ed97a3b281c5542e90ea&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/friguzzi/833ded93a640ed97a3b281c5542e90ea&lt;/a&gt;&#xA;and Qiskit python notebook &lt;a href=&quot;https://gist.github.com/friguzzi/6293793de3d53914dac9e1cb768f9817&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://gist.github.com/friguzzi/6293793de3d53914dac9e1cb768f9817&lt;/a&gt;&#xA;The correct result should be 101 but the output of Qiskit over 1000 runs is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; {'000': 179,&#xA; '001': 135,&#xA; '010': 36,&#xA; '011': 41,&#xA; '100': 152,&#xA; '101': 167,&#xA; '110': 165,&#xA; '111': 125}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7318" LastActivityDate="2020-09-20T09:53:38.017" Title="Different result between Q# and Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;q#&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13838" PostTypeId="1" AcceptedAnswerId="13845" CreationDate="2020-09-20T11:50:04.537" Score="1" ViewCount="54" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I don't know why is this true, could you please explain that, and perhaps give some examples?&lt;/p&gt;&#xA;" OwnerUserId="8009" LastEditorUserId="55" LastEditDate="2020-09-21T14:27:08.180" LastActivityDate="2020-09-21T14:27:08.180" Title="Why is the lowest energy important to simulate a quantum system?" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13839" PostTypeId="2" ParentId="13834" CreationDate="2020-09-20T13:21:20.717" Score="1" Body="&lt;p&gt;Qiskit &lt;a href=&quot;https://github.com/Qiskit/qiskit/releases/tag/0.21.0&quot; rel=&quot;nofollow noreferrer&quot;&gt;0.21&lt;/a&gt; has &lt;a href=&quot;https://pypi.org/project/qiskit-ibmq-provider/0.9.0/&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit-ibmq-provider 0.9&lt;/a&gt;. This new provider comes with a connector to the RNG service in IBMQ. From the release notes:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;You can now access the IBMQ random number services, such as the CQC&#xA;randomness extractor, using the new package&#xA;qiskit.providers.ibmq.random. Note that this feature is still in beta,&#xA;and not all accounts have access to it. It is also subject to heavy&#xA;modification in both functionality and API without backward&#xA;compatibility.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can find the documentation &lt;a href=&quot;https://qiskit.org/documentation/apidoc/ibmq_random.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://github.com/qiskit-community/qiskit_rng&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-20T13:21:20.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13840" PostTypeId="2" ParentId="13828" CreationDate="2020-09-20T13:28:16.463" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here you have some quick resources:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.cs.xu.edu/%7Ekinne/quantum/deutche.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.cs.xu.edu/~kinne/quantum/deutche.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=5xsyx-aNClM&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=5xsyx-aNClM&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It is simpler than Deutsch-Jozsa and a good stepping stone.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-20T13:28:16.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13842" PostTypeId="1" CreationDate="2020-09-20T14:45:30.963" Score="0" ViewCount="42" Body="&lt;p&gt;When executing a batch of circuits using the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBMQJobManager&lt;/a&gt; and attempting to combine all the results of all jobs with &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.ManagedResults.combine_results.html#qiskit.providers.ibmq.managed.ManagedResults.combine_results&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;combine_results&lt;/code&gt;&lt;/a&gt; I get the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQManagedResultDataNotAvailable.html#qiskit.providers.ibmq.managed.IBMQManagedResultDataNotAvailable&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBMQManagedResultDataNotAvailable&lt;/a&gt; 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?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_set = IBMQJobManager().run(batch_of_circuits, backend=ibmq_foo)&#xA;job_set_results = job_set.results() &#xA;job_set_counts = job_set_results.combine_results() # exception thrown on this line&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-21T14:29:09.167" LastActivityDate="2021-02-18T15:05:40.577" Title="How to re-execute failed jobs in qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13843" PostTypeId="2" ParentId="13835" CreationDate="2020-09-20T14:57:24.133" Score="1" Body="&lt;p&gt;This has to do with a parameter that switches between algorithms for measurement. Try changing your backend_opts as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend_opts = {'method':&amp;quot;matrix_product_state&amp;quot;, 'mps_sample_measure_qubits_opt':20}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Perhaps we need to change the threshold in the code. I will check this.&lt;/p&gt;&#xA;" OwnerUserId="13288" LastActivityDate="2020-09-20T14:57:24.133" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13844" PostTypeId="1" AcceptedAnswerId="13847" CreationDate="2020-09-20T17:28:45.983" Score="4" ViewCount="95" Body="&lt;p&gt;Consider a generic bipartite pure state &lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;,&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_k\ge0$&lt;/span&gt; are the Schmidt coefficients, and &lt;span class=&quot;math-container&quot;&gt;$\{\ket{u_k}\}_k\subset\mathcal X,\{\ket{v_k}\}_k\subset\mathcal Y$&lt;/span&gt; are orthonormal sets of states.&lt;/p&gt;&#xA;&lt;p&gt;We known that, for any pair of unitary operations &lt;span class=&quot;math-container&quot;&gt;$U,V$&lt;/span&gt;, the state &lt;span class=&quot;math-container&quot;&gt;$(U\otimes V)\ket{\Psi}$&lt;/span&gt; has the same amount of entanglement as &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt;, as reflected by the invariance of the Schmidt coefficients under such operation.&lt;/p&gt;&#xA;&lt;p&gt;Consider now a &lt;em&gt;local projection&lt;/em&gt; operation. More precisely, suppose &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; also has a bipartite structure, &lt;span class=&quot;math-container&quot;&gt;$\mathcal X=\mathcal X_1\otimes\mathcal X_2$&lt;/span&gt;, take some state &lt;span class=&quot;math-container&quot;&gt;$\ket\gamma\in\mathcal X_1$&lt;/span&gt;, and consider the &lt;em&gt;postselected state&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi'}\equiv \langle \gamma\rvert\Psi\rangle/\|\langle \gamma\rvert\Psi\rangle\|\in\mathcal X_2\otimes\mathcal Y$&lt;/span&gt;.&#xA;If I were to describe this as an operation, I guess this would amount to applying some non-unitary linear operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can the amount of entanglement of &lt;span class=&quot;math-container&quot;&gt;$\ket{\Psi'}$&lt;/span&gt; in the &amp;quot;residual bipartition&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\mathcal X_1\otimes\mathcal Y$&lt;/span&gt; be larger than the initial entanglement in &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt;?&#xA;If so, is there some kind of known characterisation of when this is possible?&lt;/p&gt;&#xA;&lt;p&gt;Intuitively, this would mean that an initially low amount of entanglement can be &amp;quot;enhanced&amp;quot;, or somehow &amp;quot;activated&amp;quot;, conditionally to some observation (&lt;em&gt;i.e.&lt;/em&gt; finding &lt;span class=&quot;math-container&quot;&gt;$\ket\gamma$&lt;/span&gt;) of one party. Such a situation seems strange to me but I'm not sure how to rule out the possibility.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-09-23T12:23:09.327" LastActivityDate="2020-09-23T12:23:09.327" Title="Can local projections increase entanglement?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13845" PostTypeId="2" ParentId="13838" CreationDate="2020-09-20T17:56:28.450" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Born%E2%80%93Oppenheimer_approximation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born-Oppenheimer approximation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A fundamental goal and equation of quantum chemistry is the time-independent, non-relativistic Schrodinger equation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H|\psi\rangle = E|\psi\rangle $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Mean-field_theory&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mean-field theory&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-20T17:56:28.450" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13846" PostTypeId="1" CreationDate="2020-09-20T19:09:49.287" Score="0" ViewCount="38" Body="&lt;p&gt;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:&#xA;In .txt file:&#xA;'h(0)'&#xA;In Qiskit:&#xA;qc=QuantumCircuit(2)&#xA;qc.h(0)&#xA;Which is a method.&#xA;What can I do?&lt;/p&gt;&#xA;" OwnerUserId="10371" LastEditorUserId="55" LastEditDate="2020-09-21T17:45:52.060" LastActivityDate="2020-10-21T18:01:05.193" Title="Converting 'string' to a function/gate in QisKit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13847" PostTypeId="2" ParentId="13844" CreationDate="2020-09-20T20:02:02.610" Score="3" Body="&lt;p&gt;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 &amp;quot;filtering&amp;quot; POVM.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://michaelnielsen.org/papers/majorization_review.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;a review by Nielsen and Vidal&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(I realize you don't talk about POVMs but projections, but Stinespring/Naimark tells us that this is equivalent.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-09-20T20:02:02.610" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13848" PostTypeId="2" ParentId="8504" CreationDate="2020-09-20T20:24:08.027" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/0712.0483&quot; rel=&quot;nofollow noreferrer&quot;&gt;Computing the exchange-correlation functional to sufficiently high accuracy is QMA-hard&lt;/a&gt;, where QMA is the quantum version of NP.  In particular, this means that it is will all likelihood hard even for a quantum computer.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-09-20T20:24:08.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13849" PostTypeId="1" AcceptedAnswerId="13854" CreationDate="2020-09-21T02:35:38.123" Score="1" ViewCount="41" Body="&lt;p&gt;I am aware of a SDP formulation for &lt;em&gt;smooth min-entropy&lt;/em&gt;: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12746/semi-definite-program-for-smooth-min-entropy&quot;&gt;question link.&lt;/a&gt; That program for smooth min-entropy was found in this book by Tomachiel: &lt;a href=&quot;https://arxiv.org/pdf/1504.00233.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;page 91.&lt;/a&gt; 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: &lt;a href=&quot;https://arxiv.org/pdf/1205.5231.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;page 4, lemma 8.&lt;/a&gt; Here is the detailed program for a bipartite density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2^{H_{\text{max}}(A|B)_\rho}$&lt;/span&gt; =&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{minimize }\lambda \\&#xA;\text{subject to} \\&#xA;Z_{AB} \otimes \mathbb{I} \ge \rho_{ABC} \\&#xA;\lambda \mathbb{I}_B \ge \text{tr}_A [Z_{AB}] \\&#xA;Z_{AB} \ge 0 \\&#xA;\lambda \ge 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$Z_{AB}$&lt;/span&gt; runs over all positive semi-definite operators in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{AB}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is a real number. The smooth max-entropy is then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H^{\epsilon}_{\text{max}}(A|B)ρ := \underset{\rho'_{AB} \in \mathcal{B}^\epsilon (\rho_{AB})}{\min}H_{\text{max}}(A|B)_{\rho'}&#xA;$$&lt;/span&gt;&#xA;i.e., just the minimum over all bipartite operators which are at most &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; distance away from &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-09-23T09:29:50.703" LastActivityDate="2020-09-23T09:29:50.703" Title="Semi-definite program for conditional smooth max-entropy" Tags="&lt;density-matrix&gt;&lt;entropy&gt;&lt;semidefinite-programming&gt;&lt;max-entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13851" PostTypeId="1" AcceptedAnswerId="13868" CreationDate="2020-09-21T07:12:22.490" Score="4" ViewCount="284" Body="&lt;p&gt;Lets have two quantum states (single qubits ones for simplicity) &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \alpha_\psi|0\rangle+\mathrm{e^{i\varphi_\psi}}\beta_\psi|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle = \alpha_\phi|0\rangle+\mathrm{e^{i\varphi_\phi}}\beta_\phi|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;These states are equal in case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha_\psi = \alpha_\phi&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\beta_\psi = \beta_\phi&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\varphi_\psi = \varphi_\phi,&#xA;$$&lt;/span&gt;&#xA;i.e. they have same complex amplitudes or same amplitudes expressed by real parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and same phase &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So my question:&lt;/strong&gt; Is there a circuit allowing to compare two quantum states? A result should be some ancilla qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; if states are different and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if states are the same (in sense described above).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-09-21T17:46:55.707" LastActivityDate="2020-09-21T22:22:47.297" Title="Is there a circuit to compare two quantum states?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;tomography&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13852" PostTypeId="2" ParentId="13851" CreationDate="2020-09-21T08:15:52.470" Score="3" Body="&lt;p&gt;The technical term is &amp;quot;quantum state discrimination&amp;quot;. One has to carefully formulate the problem, because it is generally hard to identify an arbitrary state (tomography) as you noticed.&lt;/p&gt;&#xA;&lt;p&gt;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):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \mathrm{Pr}_\mathrm{success} \leq \frac 1 2 \left( 1 + \big\| \lambda \rho_0 - (1-\lambda) \rho_1 \big\|_1 \right)&#xA;$$&lt;/span&gt;&#xA;Here, &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; are the states which are prepared with (known) propability &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(1-\lambda)$&lt;/span&gt;. 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 &lt;em&gt;perfect&lt;/em&gt; discrimination can only be achieved for &lt;em&gt;orthogonal pure states&lt;/em&gt;. Then, the optimal strategy would be to measure that basis.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The answer is:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://arxiv.org/abs/1707.02571&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1707.02571&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Ok, I might have misunderstood the question. If you have access to two pure states at once, you can do the SWAP test.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-09-21T08:36:05.030" LastActivityDate="2020-09-21T08:36:05.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13853" PostTypeId="1" CreationDate="2020-09-21T08:34:52.380" Score="1" ViewCount="148" Body="&lt;p&gt;When I run &lt;code&gt;IBMQ.load_account()&lt;/code&gt;. I have the error information:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;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.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;warnings.warn('Timestamps in IBMQ backend properties, jobs, and job results '&#xA;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.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;My account have two provider:&#xA;(hub='ibm-q', group='open', project='main')&#xA;{hub: 'ibm-q-research', group: 'Cheng-Guo', project: 'main'}&lt;/p&gt;&#xA;&lt;p&gt;I can only use first provider locally. Because of this two question:&amp;quot;https://quantumcomputing.stackexchange.com/questions/12183/ibmqfactory-initialize-providers-error&amp;quot; and &amp;quot;https://quantumcomputing.stackexchange.com/questions/13350/qiskit-ibmq-load-account-fails-on-version-0-20-0&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;I have tried to &lt;code&gt;delete&lt;/code&gt; my account then &lt;code&gt;save&lt;/code&gt; it. But it didn't work.&#xA;I have tried to use qiskit 0.21.0, the newest version in github. But it didn't work.&#xA;I have tried to use qiskit 0.20.1, the version in Quantum Lab(&lt;a href=&quot;https://quantum-computing.ibm.com/jupyter&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/jupyter&lt;/a&gt;). But it didn't work.&lt;/p&gt;&#xA;&lt;p&gt;The same version of qiskit (0.20.1) cannot be used locally but &lt;code&gt;can&lt;/code&gt; be used in quantum lab, so I can only use quantum lab to program now. But quantum lab requires network connection, which is not very convenient.&lt;/p&gt;&#xA;&lt;p&gt;I have tried to change a PC and install qiskit(version 0.21.0 in default), it didn't work.&lt;/p&gt;&#xA;&lt;p&gt;I have read the source code and I still can't understand why only the research provider don't work, and only don't work locally.&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much if you can help me.&lt;/p&gt;&#xA;" OwnerUserId="8901" LastEditorUserId="8901" LastEditDate="2020-09-22T01:52:37.050" LastActivityDate="2021-03-26T10:00:20.060" Title="Unable to instantiate provider for research account locally" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13854" PostTypeId="2" ParentId="13849" CreationDate="2020-09-21T09:05:42.693" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In particular they say that the smoothing constraint &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}_{AB} \in B^\epsilon(\rho_{AB})$&lt;/span&gt; can be reformulated as the triple of constraints&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Tr}[\tilde\rho_{ABC} \rho_{ABC}] \geq 1- \epsilon^2~\\&#xA;\mathrm{Tr}[\tilde\rho_{ABC}] \leq 1 ~\\&#xA;\tilde \rho_{ABC} \geq 0&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABC}$&lt;/span&gt; is any purification of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now we can incorporate these extra constraints with the SDP formulation of &lt;span class=&quot;math-container&quot;&gt;$H_{\max}(A|B)$&lt;/span&gt;. In particular&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;2^{H^\epsilon_{\max}(A|B)_\rho} &amp;amp;= \min_{\tilde{\rho}_{AB} \in B^\epsilon(\rho_{AB})} 2^{H_{\max}(A|B)_{\tilde\rho}} \\&#xA;&amp;amp;= \min_{\tilde{\rho}_{AB} \in B^\epsilon(\rho_{AB})}\min \lambda \\&#xA;&amp;amp;\qquad\mathrm{s.t.} \quad Z_{AB} \otimes I_C \geq \tilde\rho_{ABC} \\&#xA;&amp;amp;\qquad \qquad \lambda I_B \geq \mathrm{Tr}_A[Z_{AB}] \\&#xA;&amp;amp;\qquad\qquad Z_{AB} \geq 0, \quad \lambda \geq 0 \\&#xA;&amp;amp;= \,\,\,\min \quad\lambda \\&#xA;&amp;amp;\qquad\mathrm{s.t.} \quad Z_{AB} \otimes I_C \geq \tilde\rho_{ABC} \\&#xA;&amp;amp;\qquad \qquad \lambda I_B \geq \mathrm{Tr}_A[Z_{AB}] \\&#xA;&amp;amp;\qquad \qquad \mathrm{Tr}[\tilde\rho_{ABC} \rho_{ABC}] \geq 1- \epsilon^2~\\&#xA;&amp;amp;\qquad \qquad \mathrm{Tr}[\tilde\rho_{ABC}] \leq 1 ~\\&#xA;&amp;amp;\qquad\qquad \rho_{ABC} \geq 0, \quad Z_{AB} \geq 0, \quad \lambda \geq 0 \\&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-09-21T09:05:42.693" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13855" PostTypeId="2" ParentId="13846" CreationDate="2020-09-21T12:08:04.670" Score="1" Body="&lt;p&gt;You could try mapping the string input to the function using a dictionary somewhat like what is given &lt;a href=&quot;https://stackoverflow.com/questions/7719466/how-to-convert-a-string-to-a-function-name-in-python&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So considering that your text file has : &lt;code&gt;h(0)&lt;/code&gt; as text, you could declare a dictionary in python as : &lt;code&gt;my_functions = {&amp;quot;h(0)&amp;quot;:qc.h(0)}&lt;/code&gt; to map string input to function&lt;/p&gt;&#xA;&lt;p&gt;And in the python script, suppose variable &lt;code&gt;x&lt;/code&gt; stores the text &lt;code&gt;h[0]&lt;/code&gt; which is retrieved from the text file, to apply the h gate on the quantum circuit, you will just need to do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;my_functions[x]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In a nutshell, the code should be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2, 2) # makes a quantum circuit with 2 qubits&#xA;my_functions = {&amp;quot;h(0)&amp;quot;:qc.h(0)} # maps the string input to function call&#xA;x = &amp;quot;h(0)&amp;quot;&#xA;my_functions[x]  ## this will implement h gate on the first qubit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11868" LastActivityDate="2020-09-21T12:08:04.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13857" PostTypeId="2" ParentId="13842" CreationDate="2020-09-21T12:32:36.970" Score="0" Body="&lt;p&gt;&lt;code&gt;IBMQJobManager&lt;/code&gt; 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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;failed_job = backend.retrieve_job(FAILED_JOB_ID)&#xA;qobj = failed_job.qobj()&#xA;backend.run(qobj, job_name=failed_job.name(), job_tags=failed_job.tags())&#xA;jm = IBMQJobManager()&#xA;job_set = jm.retrieve_job_set(JOB_SET_ID, provider)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There's also &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/issues/636&quot; rel=&quot;nofollow noreferrer&quot;&gt;an issue&lt;/a&gt; open on automatically retrying job submit if it fails.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-09-21T12:32:36.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13858" PostTypeId="2" ParentId="13820" CreationDate="2020-09-21T12:34:50.830" Score="2" Body="&lt;p&gt;There isn't any specific method to optimise HHL other than using the PassManager from Qiskit, but this is a more general circuit optimisation.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;In the last page of &lt;a href=&quot;https://arxiv.org/abs/2009.04484&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2009.04484&lt;/a&gt; you can find the circuits for the example mentioned in the textbook and for the case of a &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrix, maybe this helps to run your circuit.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2020-09-21T12:34:50.830" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13859" PostTypeId="1" AcceptedAnswerId="13873" CreationDate="2020-09-21T13:18:57.210" Score="1" ViewCount="134" Body="&lt;p&gt;I have been looking into the great! video lecture of &lt;a href=&quot;https://www.youtube.com/watch?v=sUQYSy6C1aA&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;CSHS Inequality&amp;quot; by Prof. Umesh V. Vazirani&lt;/a&gt;.&#xA;There are a few things I have to clarify, hope someone will answer me.&lt;/p&gt;&#xA;&lt;p&gt;Suppose Alice and Bob have measured some outcomes in their bases. I am not quite clear how this is linked to the statement &lt;span class=&quot;math-container&quot;&gt;$xy = a + b \pmod 2$&lt;/span&gt;. How are the outputs &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; of Alice and Bobs related to the basis of measurement output?&lt;/p&gt;&#xA;" OwnerUserId="13294" LastEditorUserId="23" LastEditDate="2020-09-25T21:53:32.930" LastActivityDate="2020-09-25T21:53:32.930" Title="Where does $xy = a + b \pmod 2$ come from in the context of CHSH inequalities?" Tags="&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13860" PostTypeId="1" AcceptedAnswerId="13870" CreationDate="2020-09-21T14:46:44.047" Score="2" ViewCount="70" Body="&lt;p&gt;I am reading through the &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/phase-kickback.html#2.2-Kickback-with-the-T-gate-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phase Kickback&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;) on the state &lt;span class=&quot;math-container&quot;&gt;$|1+ \rangle$&lt;/span&gt; is demonstrated mathematically. The formal control qubit would be &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; while the target qubit would be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. As I show in the image, the &amp;quot;target&amp;quot; qubit stays unchanged, while the &amp;quot;control&amp;quot; qubit has got rotated (it has now a relative phase).&lt;/p&gt;&#xA;&lt;p&gt;I then wanted to prove myself that the same result would be delivered when applying the Controlled-T gate on the state &lt;span class=&quot;math-container&quot;&gt;$|+1 \rangle$&lt;/span&gt;, 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 &amp;quot;flipped&amp;quot; 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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uo1B8.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uo1B8.jpg&quot; alt=&quot;symmetry_of_controlled_t_gates&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13295" LastEditorUserId="9459" LastEditDate="2020-09-22T08:45:24.227" LastActivityDate="2020-09-22T15:47:18.647" Title="Phase Kickback and Controlled Rotation - Problem in proving symmetry" Tags="&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13861" PostTypeId="1" CreationDate="2020-09-21T15:19:20.290" Score="3" ViewCount="90" Body="&lt;p&gt;I recently encountered the &lt;a href=&quot;https://arxiv.org/abs/2004.10486&quot; rel=&quot;nofollow noreferrer&quot;&gt;statement&lt;/a&gt; that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Can someone point me to some references about why that is and what kind of classical communication is used?&lt;/p&gt;&#xA;" OwnerUserId="11977" LastEditorUserId="10480" LastEditDate="2020-12-31T08:33:31.507" LastActivityDate="2021-01-30T09:06:20.647" Title="(Why) does every CSS code allow for transversal measurement?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13862" PostTypeId="1" CreationDate="2020-09-21T15:20:32.190" Score="0" ViewCount="164" Body="&lt;p&gt;I'm trying to implement a vqe in cirq and I have sort of a brain knot.&lt;/p&gt;&#xA;&lt;p&gt;I have a 4 qubit chain with periodic boundary condition.&#xA;So in fact a 2x2 qubit grid.&lt;/p&gt;&#xA;&lt;p&gt;Now 2 of them each are coupled.&lt;/p&gt;&#xA;&lt;p&gt;How do I get the correct measurements for the expectation value?&lt;/p&gt;&#xA;" OwnerUserId="13297" LastEditorUserId="55" LastEditDate="2020-09-21T17:47:37.873" LastActivityDate="2020-09-21T18:46:22.570" Title="XX and YY and ZZ Hamiltonians in vqe" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;hamiltonian-simulation&gt;&lt;cirq&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13864" PostTypeId="1" AcceptedAnswerId="13865" CreationDate="2020-09-21T18:11:43.733" Score="1" ViewCount="143" Body="&lt;p&gt;How can the &lt;code&gt;CNOT&lt;/code&gt; gate error between 2 qubits as shown on visual qubit coupling map on the IBMQ Dashboard be retrieved in Qiskit using the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.models.BackendProperties.gate_error.html#qiskit.providers.models.BackendProperties.gate_error&quot; rel=&quot;nofollow noreferrer&quot;&gt;BackendProperties.gate_error&lt;/a&gt; method ?&lt;/p&gt;&#xA;&lt;p&gt;I have been able to retrieve the &lt;code&gt;U2&lt;/code&gt; error rates as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;properties = backend.properties()&#xA;properties.gate_error('u2', 0) # u2 error rate for qubit-0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-22T18:09:50.917" LastActivityDate="2021-04-24T00:32:19.197" Title="How to get the CNOT error rate between 2 qubits on a given IBMQ Backend?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13865" PostTypeId="2" ParentId="13864" CreationDate="2020-09-21T18:40:18.037" Score="2" Body="&lt;p&gt;You can type the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.get_provider(hub='YOUR-HUB-NAME', group='YOUR-GROUP-NAME', project='YOUR-PROJECT_NAME')&#xA;provider.backends.backend&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You should see an interactive widget with 5 tabs. Under the &lt;strong&gt;Multi-Qubit Gates&lt;/strong&gt; tab, you can see the CNOT error rate between any two connected qubits on that given backend.&lt;/p&gt;&#xA;&lt;p&gt;If you don't see the widget, import qiskit.tools.jupyter and then try to run the commands again.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-21T18:40:18.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13866" PostTypeId="2" ParentId="13862" CreationDate="2020-09-21T18:46:22.570" Score="1" Body="&lt;p&gt;There is a type &lt;code&gt;cirq.PauliSum&lt;/code&gt; created when you add together products of Pauli operations. This type has a method &lt;code&gt;expectation_from_state_vector&lt;/code&gt; and &lt;code&gt;expectation_from_density_matrix&lt;/code&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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..&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;qubits = cirq.LineQubit.range(4)&#xA;pauli = cirq.Z&#xA;&#xA;operator: cirq.PauliSum = sum(pauli(qubits[k - 1]) * pauli(qubits[k]) for k in range(4))&#xA;print(&amp;quot;operator&amp;quot;, operator)&#xA;# 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)&#xA;&#xA;a, b, c, d = qubits&#xA;circuit = cirq.Circuit(&#xA;    cirq.H(a),&#xA;    cirq.CNOT(a, b),&#xA;    cirq.CNOT(a, c),&#xA;    cirq.CNOT(a, d),&#xA;)&#xA;final_state = cirq.final_state_vector(circuit, qubit_order=qubits)&#xA;&#xA;expectation = operator.expectation_from_state_vector(&#xA;    final_state,&#xA;    qubit_map={q: q.x for q in qubits})&#xA;print(&amp;quot;z_expectation&amp;quot;, expectation)&#xA;# z_expectation (3.999999761581421+0j)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sampler = cirq.Simulator()  # or a hardware sampler&#xA;&#xA;circuit_x = circuit + [[cirq.H(q), cirq.measure(q)] for q in qubits]&#xA;circuit_y = circuit + [[cirq.X(q)**0.5, cirq.measure(q)] for q in qubits]&#xA;circuit_z = circuit + [cirq.measure(q) for q in qubits]&#xA;&#xA;import numpy as np&#xA;import pandas as pd&#xA;x_samples: pd.DataFrame = sampler.sample(circuit_x, repetitions=1000)&#xA;x_cols = [x_samples[str(q)] for q in qubits]&#xA;x_parity_bits = np.array([x_cols[k-1] ^ x_cols[k] for k in range(4)], dtype=np.int8)&#xA;x_parity_signs = 1 - 2 * x_parity_bits&#xA;x_expectation = np.mean(x_parity_signs)&#xA;print(&amp;quot;x_expectation&amp;quot;, x_expectation)&#xA;# x_expectation -0.011&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-09-21T18:46:22.570" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13867" PostTypeId="2" ParentId="13830" CreationDate="2020-09-21T19:08:06.953" Score="0" Body="&lt;p&gt;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: &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/5_quantum_volume.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/noise/5_quantum_volume.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-21T19:08:06.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13868" PostTypeId="2" ParentId="13851" CreationDate="2020-09-21T22:05:40.117" Score="6" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;which&lt;/em&gt; of the two states has that phase: the global phase applies to the total state, including all tensor factors.)&lt;/p&gt;&#xA;&lt;p&gt;Setting that aside, however, there is a more significant obstacle: the linearity of quantum mechanics.&lt;/p&gt;&#xA;&lt;p&gt;Suppose that you had a unitary circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, which performed the following transformation for inputs &lt;span class=&quot;math-container&quot;&gt;$\lvert x \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert y \rangle$&lt;/span&gt; in the states &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert 1 \rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA; \lvert 0 \rangle \;\lvert x \rangle\; \lvert y \rangle\; \lvert \text{work space} \rangle&#xA;\;\mapsto\;&#xA; \lvert \delta_{x,y} \rangle \;\lvert \psi_{x,y} \rangle,&#xA;\end{align}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\delta_{x,y}$&lt;/span&gt; is the Kronecker delta, &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\text{work space}$&lt;/span&gt;&amp;quot; is some fixed initial state of auxiliary qubits provided as work space, and &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{x,y} \rangle$&lt;/span&gt;  is some (possibly complicated) quantum state that depends on &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.&#xA;We take the first qubit to be the answer qubit.&#xA;Note that the states &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi_{x,y} \rangle$&lt;/span&gt; will be orthogonal to one another for different values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. Then, what happens if we introduce a state which is not in the standard basis?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \lvert 0 \rangle \; \lvert 1 \rangle \; \lvert + \rangle \; \lvert \text{work space} \rangle \mapsto&#xA;\tfrac{1}{\sqrt 2} \Bigl(&#xA; \lvert 0 \rangle \; \lvert \psi_{1,0} \rangle \;+\; \lvert 1 \rangle \; \lvert \psi_{1,1} \rangle&#xA;\Bigr) $$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle$&lt;/span&gt;, which is what you wanted for your procedure.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="124" LastEditorUserId="124" LastEditDate="2020-09-21T22:22:47.297" LastActivityDate="2020-09-21T22:22:47.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13869" PostTypeId="2" ParentId="13864" CreationDate="2020-09-22T01:11:31.177" Score="0" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.get_provider(hub='YOUR-HUB-NAME', group='YOUR-GROUP-NAME', project='YOUR-PROJECT_NAME')&#xA;backend = provider.get_backend('ibmq_**your_device**') &#xA;for gate_i in backend.properties().gates:&#xA;    print(&amp;quot;{} gate on qubits {} error rate is {}{}&amp;quot;.format(gate_i.name, gate_i.qubits, gate_i.parameters[0].value, gate_i.parameters[0].unit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It should print out the list that you got from the Widget.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if you chose &lt;code&gt;ibmq_quito&lt;/code&gt; then you have something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;id0 gate on qubits [0] error rate is 0.00028412406225121944&#xA;id1 gate on qubits [1] error rate is 0.0005023912176917563&#xA;id2 gate on qubits [2] error rate is 0.000588676520188442&#xA;id3 gate on qubits [3] error rate is 0.000441966521247226&#xA;id4 gate on qubits [4] error rate is 0.0015240218468028444&#xA;rz0 gate on qubits [0] error rate is 0&#xA;rz1 gate on qubits [1] error rate is 0&#xA;rz2 gate on qubits [2] error rate is 0&#xA;rz3 gate on qubits [3] error rate is 0&#xA;rz4 gate on qubits [4] error rate is 0&#xA;sx0 gate on qubits [0] error rate is 0.00028412406225121944&#xA;sx1 gate on qubits [1] error rate is 0.0005023912176917563&#xA;sx2 gate on qubits [2] error rate is 0.000588676520188442&#xA;sx3 gate on qubits [3] error rate is 0.000441966521247226&#xA;sx4 gate on qubits [4] error rate is 0.0015240218468028444&#xA;x0 gate on qubits [0] error rate is 0.00028412406225121944&#xA;x1 gate on qubits [1] error rate is 0.0005023912176917563&#xA;x2 gate on qubits [2] error rate is 0.000588676520188442&#xA;x3 gate on qubits [3] error rate is 0.000441966521247226&#xA;x4 gate on qubits [4] error rate is 0.0015240218468028444&#xA;cx3_4 gate on qubits [3, 4] error rate is 0.02203610851266083&#xA;cx4_3 gate on qubits [4, 3] error rate is 0.02203610851266083&#xA;cx1_3 gate on qubits [1, 3] error rate is 0.009826995281347145&#xA;cx3_1 gate on qubits [3, 1] error rate is 0.009826995281347145&#xA;cx1_2 gate on qubits [1, 2] error rate is 0.01104062453060986&#xA;cx2_1 gate on qubits [2, 1] error rate is 0.01104062453060986&#xA;cx0_1 gate on qubits [0, 1] error rate is 0.009345544597316624&#xA;cx1_0 gate on qubits [1, 0] error rate is 0.009345544597316624&#xA;reset0 gate on qubits [0] error rate is 5920ns&#xA;reset1 gate on qubits [1] error rate is 5920ns&#xA;reset2 gate on qubits [2] error rate is 5920ns&#xA;reset3 gate on qubits [3] error rate is 5920ns&#xA;reset4 gate on qubits [4] error rate is 5920ns&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-24T00:32:19.197" LastActivityDate="2021-04-24T00:32:19.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13870" PostTypeId="2" ParentId="13860" CreationDate="2020-09-22T06:01:49.713" Score="0" Body="&lt;p&gt;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) &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is defined as a phase gate &lt;span class=&quot;math-container&quot;&gt;$P(\frac{\pi}{4})$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P |\psi \rangle = P (\alpha |0\rangle + \beta |1\rangle) = \alpha |0\rangle + e^{i\varphi}\beta |1\rangle \\&#xA;P(\varphi) = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0 \\&#xA;0&amp;amp;e^{i \phi}&#xA;\end{pmatrix}&#xA;\qquad &#xA;T = P(\frac{\pi}{4}) = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0 \\&#xA;0&amp;amp;e^{i \frac{\pi}{4}}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is the phase gate, &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are some initial amplitudes, &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is the phase defined by the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; gate. Note that only &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in the superposition state has obtained the phase. The same works for the controlled phase gate: only &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; obtains a phase because the control qubit should be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and the target qubit also should be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CP_{2 \rightarrow 1} |+1 \rangle = CP_{2 \rightarrow 1} \frac{1}{\sqrt{2}} (|01\rangle + |11\rangle) = \\&#xA;= \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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; is the controlled phase gate, &lt;span class=&quot;math-container&quot;&gt;$2 \rightarrow 1$&lt;/span&gt; subscript denotes that the &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; gate is controlled by the second qubit. More general proof for &lt;span class=&quot;math-container&quot;&gt;$CP_{1 \rightarrow 2} = CP_{2 \rightarrow 1}$&lt;/span&gt; can be derived by using matrix representation of the &lt;span class=&quot;math-container&quot;&gt;$CP$&lt;/span&gt; gate. This proof is similar to the proof for &lt;span class=&quot;math-container&quot;&gt;$CZ_{1 \rightarrow 2} = CZ_{2 \rightarrow 1}$&lt;/span&gt; that can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13337/9459&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CP_{1 \rightarrow 2} = |0\rangle \langle 0| &#xA;\otimes I + |1\rangle \langle 1| \otimes P = \\&#xA;= &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{i \varphi} \\&#xA;\end{pmatrix} = \\&#xA;=I \otimes |0\rangle \langle 0| &#xA; + P \otimes |1\rangle \langle 1| = CP_{2 \rightarrow 1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Side note about why the &amp;quot;symmetry&amp;quot; is not true for controlled &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gate in contrast to controlled &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; gate:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If for the general case instead of &lt;span class=&quot;math-container&quot;&gt;$P(\varphi)$&lt;/span&gt; we will use &lt;span class=&quot;math-container&quot;&gt;$R_z(\varphi)$&lt;/span&gt; gate then we will have a different result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CRZ_{1 \rightarrow 2} = |0\rangle \langle 0| &#xA;\otimes I + |1\rangle \langle 1| \otimes R_z&#xA;= &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;e^{-i \frac{\varphi}{2}}&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{i \frac{\varphi}{2}} \\&#xA;\end{pmatrix}\\&#xA;CRZ_{2 \rightarrow 1} = I \otimes |0\rangle \langle 0| + R_z \otimes |1\rangle \langle 1| = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;e^{-i \frac{\varphi}{2}}&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{i \frac{\varphi}{2}} \\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$R_z(\varphi) = \begin{pmatrix}&#xA;e^{-i \frac{\varphi}{2}}&amp;amp;0 \\&#xA;0&amp;amp;e^{i \frac{\varphi}{2}}&#xA;\end{pmatrix}$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$CRZ_{1 \rightarrow 2} \ne CRZ_{2 \rightarrow 1}$&lt;/span&gt;.&#xA;This &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13414/9459&quot;&gt;answer&lt;/a&gt; also might be relevant where the difference between the controlled versions of &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U1 = P$&lt;/span&gt; is discussed.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-22T15:47:18.647" LastActivityDate="2020-09-22T15:47:18.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13872" PostTypeId="1" CreationDate="2020-09-22T08:13:59.373" Score="5" ViewCount="225" Body="&lt;p&gt;Let's say I am given a permutation &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; that maps &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit strings to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit strings. I want to output &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1}(000\cdots1)$&lt;/span&gt; is even and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1}(000\cdots1)$&lt;/span&gt; is odd. It can be proven that this problem requires an exponential number of queries, given access to just &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$000\cdots1$&lt;/span&gt; (but, crucially, not &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1}$&lt;/span&gt; or any oracle that calculates the parity of &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1}$&lt;/span&gt;). 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.&lt;/p&gt;&#xA;&lt;p&gt;I found one &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9701001.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (Theorem &lt;span class=&quot;math-container&quot;&gt;$3.6$&lt;/span&gt;), 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?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2020-09-25T18:40:41.170" LastActivityDate="2020-09-25T20:09:28.963" Title="Proof using hybrid method that inverting a permutation requires exponential queries for BQP machines" Tags="&lt;complexity-theory&gt;&lt;oracles&gt;&lt;bbbv&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13873" PostTypeId="2" ParentId="13859" CreationDate="2020-09-22T08:46:43.007" Score="2" Body="&lt;p&gt;Alice has a choice of two bases in which to measure, we call her choice &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Bob also has a choice of two bases in which to measure, we call his choice &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. When they measure we call Alice's measurement outcome &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and Bob's measurement outcome &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. All &lt;span class=&quot;math-container&quot;&gt;$a,b,x,y \in \{0,1\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then Alice and Bob win if &lt;span class=&quot;math-container&quot;&gt;$xy = a + b \mod 2$&lt;/span&gt;. For example if Alice chooses to measure in her basis &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt; and Bob chooses to measure in his basis &lt;span class=&quot;math-container&quot;&gt;$y=1$&lt;/span&gt; then they will win if their outcomes are the same, i.e. if &lt;span class=&quot;math-container&quot;&gt;$a=b=0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$a=b=1$&lt;/span&gt;. Conversely, they will lose if &lt;span class=&quot;math-container&quot;&gt;$a\neq b \mod 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the CHSH game is defined irrespective of quantum theory -- Alice and Bob can just choose their outputs &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;*Assuming quantum theory is a correct and complete description of reality.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Calculating the winning probability&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose Alice and Bob choose their inputs uniformly at random, i.e., &lt;span class=&quot;math-container&quot;&gt;$p(x,y) = 1/4$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x,y \in \{0,1\}$&lt;/span&gt;. Also let &lt;span class=&quot;math-container&quot;&gt;$V:\{0,1\}^4 \rightarrow \{0,1\}$&lt;/span&gt; be the function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V(a,b,x,y) = \begin{cases}&#xA;1 &amp;amp; \quad \text{if }\,\,xy = a+b \!\!\mod 2 \\&#xA;0 &amp;amp; \quad \text{otherwise}&#xA;\end{cases}.&#xA;$$&lt;/span&gt;&#xA;That is the function outputs &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if Alice and Bob win and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; if they lose.&lt;/p&gt;&#xA;&lt;p&gt;Now you should try to convince yourself that the probability they win the CHSH game is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{\mathrm{win}} = \sum_{abxy} p(x,y) p(a,b|x,y) V(a,b,x,y). &#xA;$$&lt;/span&gt;&#xA;More explicitly we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;p_{\mathrm{win}} &amp;amp;= \frac{1}{4}[p(0,0|0,0) + p(1,1|0,0) + p(0,0|0,1) + p(1,1|0,1) \\&#xA;&amp;amp; \quad \,\, + p(0,0|1,0) + p(1,1|1,0) + p(0,1|1,1) + p(1,0|1,1)].&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So in order to calculate the probability they win we must compute the conditional probability distribution &lt;span class=&quot;math-container&quot;&gt;$p(a,b|x,y)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;An optimal quantum strategy&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now in the Lecture you watched it looks like they presented a quantum system that can achieve the best winning probability &lt;span class=&quot;math-container&quot;&gt;$\cos^2(\pi/8)$&lt;/span&gt;. We use the states and measurements described in the video in order to compute the conditional probability distribution &lt;span class=&quot;math-container&quot;&gt;$p(a,b|x,y)$&lt;/span&gt; for that particular quantum system. The state used is the maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle  = \tfrac{1}{\sqrt{2}}|00\rangle + \tfrac{1}{\sqrt{2}} |11\rangle$&lt;/span&gt;. The measurements may be represented by a collection of matrices &lt;span class=&quot;math-container&quot;&gt;$A_{a|x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_{b|y}$&lt;/span&gt;. As measurement operators sum to the identity we have that for all &lt;span class=&quot;math-container&quot;&gt;$x,y \in \{0,1\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A_{1|x} = \mathbb{1} - A_{0|x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_{1|y} = \mathbb{1} - B_{0|y}$&lt;/span&gt;. Thus we only need to specify the operators for outcome &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. For the strategy discussed in the lecture the operators are (in the computational basis) represented by the matrices&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_{0|0} = \begin{pmatrix} 1&amp;amp;0 \\&#xA;0&amp;amp;0&#xA;\end{pmatrix}, \quad&#xA;A_{0|1} = \begin{pmatrix} 1/2&amp;amp;1/2 \\&#xA;1/2&amp;amp;1/2&#xA;\end{pmatrix}, \\ &#xA;B_{0|0} = \begin{pmatrix} \cos(\pi/8)^2 &amp;amp;\sin(\pi/4)/2 \\&#xA;\sin(\pi/4)/2&amp;amp; \sin(\pi/8)^2&#xA;\end{pmatrix}, \quad&#xA;B_{0|1} = \begin{pmatrix} \cos(\pi/8)^2 &amp;amp; -\sin(\pi/4)/2 \\&#xA;-\sin(\pi/4)/2&amp;amp; \sin(\pi/8)^2&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we can calculate, using the Born rule, the conditional probabilities as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(a,b|x,y) = \langle \psi, (A_{a|x} \otimes B_{b|y}) \psi \rangle. &#xA;$$&lt;/span&gt;&#xA;To demonstrate,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;p(0,0|0,0) &amp;amp;= \begin{pmatrix}&#xA;\frac{1}{\sqrt2} &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt2}&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;\cos(\pi/8)^2 &amp;amp; \sin(\pi/4)/2 &amp;amp;0 &amp;amp;0 \\&#xA;\sin(\pi/4)/2 &amp;amp; \sin(\pi/8)^2 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0&#xA;\end{pmatrix}&#xA;\begin{pmatrix} &#xA;\frac{1}{\sqrt{2}} \\&#xA;0\\&#xA;0\\&#xA;\frac{1}{\sqrt2}&#xA;\end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix}&#xA;\frac{1}{\sqrt2} &amp;amp; 0 &amp;amp; 0 &amp;amp; \frac{1}{\sqrt2}&#xA;\end{pmatrix}&#xA;\begin{pmatrix}&#xA;\frac{\cos(\pi/8)^2}{\sqrt{2}} \\&#xA;\frac{\sin(\pi/4)}{2\sqrt{2}} \\&#xA;0 \\&#xA;0&#xA;\end{pmatrix} \\&#xA;&amp;amp;= \frac{\cos(\pi/8)^2}{2}.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'll leave the rest but after computing the remaining &lt;span class=&quot;math-container&quot;&gt;$p(a,b|x,y)$&lt;/span&gt; you should find that &lt;span class=&quot;math-container&quot;&gt;$p_{\mathrm{win}} = \cos(\pi/8)^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-09-22T21:11:01.250" LastActivityDate="2020-09-22T21:11:01.250" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13874" PostTypeId="1" AcceptedAnswerId="13888" CreationDate="2020-09-22T16:32:32.050" Score="0" ViewCount="64" Body="&lt;p&gt;I am trying to wrap my head around Qiskit Aqua Operators and I stumbled upon this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;t=0.5&#xA;hamiltonian=get_hamiltonian(1,1) #a four 4 qubit hamiltonian (Transverse field Ising model)&#xA;evo_time=Parameter(&amp;quot;t&amp;quot;)&#xA;&#xA;evo_op=(evo_time*hamiltonian).exp_i()&#xA;evo_op1 = evo_op @ (Zero^4)&#xA;&#xA;trotter_op=PauliTrotterEvolution(trotter_mode=Suzuki(reps=10,order=1)).convert(evo_op1)&#xA;trotter_op_values=trotter_op.bind_parameters({evo_time: t})&#xA;&#xA;circuit1=trotter_op_values.to_circuit()&#xA;backend=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;circuit1.measure_all()&#xA;&#xA;counts1=execute(circuit1, backend=backend, shots=10024).result().get_counts()&#xA;&#xA;for key in counts1.keys():&#xA;    counts1[key]=counts1[key]/10024&#xA;&#xA;a=0&#xA;# I had to instantiate again the trotter_op because trotter_op_values.to_circuit()&#xA;#didn't create a new circuit and instead, by having done circuit1.measure_all()&#xA;# trotter_op was modified as well.&#xA;&#xA;trotter_op=PauliTrotterEvolution(trotter_mode=Suzuki(reps=10,order=1)).convert(evo_op1)&#xA;trotter_op_values=trotter_op.bind_parameters({evo_time: t})&#xA;sampler=CircuitSampler(backend=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;))&#xA;sampler.quantum_instance.shots=10024&#xA;results1=sampler.convert(trotter_op_values).primitive&#xA;&#xA;#normalize the results from the circuitsampler&#xA;for key in results1.keys():&#xA;    a+=results1[key]&#xA;for key in results1.keys():&#xA;    results1[key]=results1[key]/a&#xA;&#xA;# assert counts1.keys()==results1.keys()&#xA;assert sum(counts1.values()) #check normalization&#xA;assert sum(results1.values()) #check normalization&#xA;&#xA;for key in results1.keys():&#xA;    print(&amp;quot;state: {} | Counts1: {} | Results1: {}&amp;quot;.format(key,counts1[key], results1[key]))&#xA;&#xA;    &#xA;plot_histogram([counts1, results1], legend=[&amp;quot;Running the circuit&amp;quot;,&amp;quot;CircuitSampler from aqua&amp;quot;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;What I expected&lt;/strong&gt;&#xA;Since the evo_op1 is just a &lt;code&gt;CircuitStateFn&lt;/code&gt; whose initialization was the zero state for the 4 qubits then, passing this into &lt;code&gt;CircuitSampler&lt;/code&gt; the &lt;code&gt;CircuitStateFn&lt;/code&gt; would be replaced by a &lt;code&gt;DictStateFn&lt;/code&gt; whose amplitudes would be the same as measuring all 4 qubits in the trotterization circuit with a zero state initialization (my &lt;code&gt;circuit1&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What I got&lt;/strong&gt;&#xA;The histograms never match, for any value of &lt;code&gt;t&lt;/code&gt; except &lt;code&gt;t=0&lt;/code&gt;. However, there is always a clear similarity between the plots (for small &lt;code&gt;t&lt;/code&gt; the probability for &lt;code&gt;0000&lt;/code&gt; is always the biggest for example and all other states have similiar probabilities, but never exactly equal)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jgmMZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jgmMZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;What am I missing? Was it a bad interpretation of the Operator Flow?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-09-22T17:24:02.847" LastActivityDate="2020-09-23T11:01:17.527" Title="Inconsistency in Qiskit Aqua CircuitSampler from Operator Flow" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13875" PostTypeId="2" ParentId="13774" CreationDate="2020-09-22T17:35:35.523" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.monitor import job_monitor&#xA;job_monitor(job)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;job_monitor shows you ever step, including job initialization, validation, being queued, to running and completion.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-09-22T17:35:35.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13877" PostTypeId="2" ParentId="12564" CreationDate="2020-09-22T17:55:59.410" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;section 3 of this tutorial&lt;/a&gt; to learn more about how it will increase your precision.&lt;/p&gt;&#xA;&lt;p&gt;num_time_slices: I actually have no idea what this is and I stumbled across this question because I was looking for an answer.&lt;/p&gt;&#xA;&lt;p&gt;negative_evals: This is a simple boolean response indicating if you have or expect negative eigenvalues. An input of &amp;quot;True&amp;quot; will increase the number of ancillary qubits by 1 and therefore lead to a circuit of greater depth.&lt;/p&gt;&#xA;&lt;p&gt;If anyone could elaborate on what num_time_slices is exactly than I would appreciate it.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastActivityDate="2020-09-22T17:55:59.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13878" PostTypeId="1" AcceptedAnswerId="13881" CreationDate="2020-09-22T19:27:37.273" Score="1" ViewCount="114" Body="&lt;p&gt;I have submitted a batch of circuits to &lt;code&gt;ibmq_vigo&lt;/code&gt; using the &lt;code&gt;IBMQJobManager&lt;/code&gt; 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 &lt;code&gt;ibmq_rochester&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know what might be the issue?&#xA;Also this is my second unsuccessful attempt at executing on &lt;code&gt;ibmq_vigo&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-09-25T11:50:28.840" LastActivityDate="2020-09-25T11:50:28.840" Title="Why does job appear to be stuck in queue on IBMQ backend?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13879" PostTypeId="2" ParentId="4275" CreationDate="2020-09-22T19:29:17.247" Score="0" Body="&lt;p&gt;I give &lt;a href=&quot;https://github.com/Strilanc/CliffordTableau&quot; rel=&quot;nofollow noreferrer&quot;&gt;working python code&lt;/a&gt; to compute the inverse of a Clifford tableau in &lt;a href=&quot;https://algassert.com/post/2002&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The xz Pauli terms in the inverse table are computed by transposing the xz Pauli terms in the original table and then substituting:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;II -&amp;gt; II&#xA;IX -&amp;gt; IX&#xA;IY -&amp;gt; XX&#xA;IZ -&amp;gt; XI&#xA;XI -&amp;gt; IZ&#xA;XX -&amp;gt; IY&#xA;XY -&amp;gt; XY&#xA;XZ -&amp;gt; XZ&#xA;YI -&amp;gt; ZZ&#xA;YX -&amp;gt; ZY&#xA;YY -&amp;gt; YY&#xA;YZ -&amp;gt; YZ&#xA;ZI -&amp;gt; ZI&#xA;ZX -&amp;gt; ZX&#xA;ZY -&amp;gt; YX&#xA;ZZ -&amp;gt; YI&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for generator, output in list(columns.items()):&#xA;    columns[generator] *= original_operation(output).coefficient&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For example, this tableau:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;      | 0  1  2  3&#xA;------+-xz-xz-xz-xz-&#xA; 0    | ZY ZY XZ _X&#xA; 1    | _Y ZY Z_ ZZ&#xA; 2    | Y_ YX XX XX&#xA; 3    | ZZ ZZ _X XZ&#xA; sign | -- -- -+ +-&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;inverts into this tableau:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;      | 0  1  2  3&#xA;------+-xz-xz-xz-xz-&#xA; 0    | YX XX ZZ Y_&#xA; 1    | YX YX ZY Y_&#xA; 2    | XZ Z_ _Y _X&#xA; 3    | _X Y_ _Y XZ&#xA; sign | ++ -+ +- -+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-09-22T19:29:17.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13880" PostTypeId="1" CreationDate="2020-09-22T19:56:49.073" Score="4" ViewCount="144" Body="&lt;p&gt;I am interested in the smallest nonzero eigenvalue of a quantum state.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does this eigenvalue always increasing after a partial trace i.e.&#xA;the smallest nonzero eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; is always larger than&#xA;that of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;?&#xA;Intuitively, this seems like it must be true since the reduced state has fewer eigenvalues but its trace is still 1. On average,&#xA;the eigenvalues must be larger. How can one prove this statement (or&#xA;perhaps a more refined version of it)?&lt;/li&gt;&#xA;&lt;li&gt;Is there any bound on how much larger this eigenvalue can get? A&#xA;trivial bound is that it cannot increase by more than 1 but is there&#xA;anything better that can be said?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13303" LastEditorUserId="55" LastEditDate="2020-09-25T11:50:41.257" LastActivityDate="2020-12-24T22:21:56.953" Title="Eigenvalues of a quantum state after partial tracing" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13881" PostTypeId="2" ParentId="13878" CreationDate="2020-09-22T22:54:58.953" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-22T22:54:58.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13882" PostTypeId="1" CreationDate="2020-09-23T07:55:13.267" Score="1" ViewCount="38" Body="&lt;p&gt;In quantum computers the following two effects should be seen:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If an operator acts on an arbitrary qubit &lt;span class=&quot;math-container&quot;&gt;$Q_n$&lt;/span&gt; of a quantum system &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; consisting of several qubits than we get a new quantum system &lt;span class=&quot;math-container&quot;&gt;$S'$&lt;/span&gt; where the amplitudes of all qubits have changed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If an operator acts on one qubit of a quantum system &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; consisting of two entangled QuBits than both qubits are affected.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So which one of these is the reason for the exponential speed-up expected from quantum computers?&lt;/p&gt;&#xA;" OwnerUserId="13307" LastEditorUserId="55" LastEditDate="2020-09-23T09:31:15.553" LastActivityDate="2020-09-23T10:39:50.997" Title="What is the reason for the exponential speed-up of quantum computers?" Tags="&lt;quantum-advantage&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2020-09-24T08:54:27.447" ContentLicense="CC BY-SA 4.0" />
  <row Id="13883" PostTypeId="1" AcceptedAnswerId="13885" CreationDate="2020-09-23T08:21:12.640" Score="1" ViewCount="41" Body="&lt;p&gt;Suppose I run the following code：&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;job = execute(qc, backend = backend, shots = 1024, optimization_level = 0)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then the job takes a long time to run. We know that job_id (from &lt;code&gt;job.job_id()&lt;/code&gt;) 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?&lt;/p&gt;&#xA;&lt;p&gt;Or what information can I save that will allow me to get the &lt;code&gt;job.result()&lt;/code&gt; after I drop the line?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;job.result()&lt;/code&gt;. Otherwise, I can only go to &lt;code&gt;https://quantum-computing.ibm.com/&lt;/code&gt; to download the result data, and the data format is not easy to use.&lt;/p&gt;&#xA;&lt;p&gt;thank you for your help!&lt;/p&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2020-09-23T15:53:37.630" Title="Can I get the job variable from the job_id？" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13884" PostTypeId="1" CreationDate="2020-09-23T08:37:41.267" Score="3" ViewCount="180" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="9006" LastEditDate="2020-09-24T06:36:50.197" LastActivityDate="2020-09-25T06:54:01.920" Title="How to perform a time evolution of a quantum state with Qiskit Aqua?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13885" PostTypeId="2" ParentId="13883" CreationDate="2020-09-23T10:26:10.793" Score="2" Body="&lt;p&gt;I take it you're running the jobs on an IBMQ backend and not one of the local simulators.&lt;br /&gt;&#xA;If so, just keep track of &lt;code&gt;job_id&lt;/code&gt;, then use the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.IBMQBackend.retrieve_job.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;retrieve_job&lt;/a&gt; function to retrieve the job at a later point in time and get its result.&lt;/p&gt;&#xA;" OwnerUserId="8955" LastActivityDate="2020-09-23T10:26:10.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13888" PostTypeId="2" ParentId="13874" CreationDate="2020-09-23T11:01:17.527" Score="1" Body="&lt;p&gt;Well, you are right. After &lt;code&gt;CircuitSampler&lt;/code&gt; you are getting a &lt;code&gt;DictStateFn&lt;/code&gt; with phase information lost (see the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.converters.CircuitSampler.html#qiskit.aqua.operators.converters.CircuitSampler&quot; rel=&quot;nofollow noreferrer&quot;&gt;docs&lt;/a&gt;) in the amplitudes and you have to take the square of them for your histogram plot (not normalize).&lt;/p&gt;&#xA;&lt;p&gt;Besides that, just keep in mind that the number of shots are not stored in the &lt;code&gt;QuantumInstance&lt;/code&gt; of &lt;code&gt;CircuitSampler&lt;/code&gt; (in the way you are setting them). You should rather do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qinstance = QuantumInstance(backend, shots=10024)&#xA;sampler = CircuitSampler(qinstance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-23T11:01:17.527" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13889" PostTypeId="2" ParentId="13883" CreationDate="2020-09-23T15:53:37.630" Score="1" Body="&lt;p&gt;In order to fully recover your &lt;code&gt;Job&lt;/code&gt; object from IBMQ, you need two things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the backend name&lt;/li&gt;&#xA;&lt;li&gt;the job id&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Once you sent your job, you can save those like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_id = job.job_id()&#xA;backend_name = job.backend().name()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Later, when the job is done, you can recover the &lt;code&gt;Job&lt;/code&gt; object like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;job = provider.get_backend(backend_name).retrieve_job(job_id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-23T15:53:37.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13890" PostTypeId="1" CreationDate="2020-09-23T15:57:01.270" Score="0" ViewCount="45" Body="&lt;p&gt;I want to test an error model of the convex form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$t \times \text{ideal_state} + (1-t)\times \text{noisy_circuit}.$$&lt;/span&gt;&#xA;In terms of density matrices, this would look like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$t\rho_{\text{idealState}}+(1-t)\times\text{Identity}.$$&lt;/span&gt;&#xA;However, I can only implement circuits on the simulator where I want to test and no density matrices.&lt;/p&gt;&#xA;" OwnerUserId="5705" LastEditorUserId="55" LastEditDate="2020-09-23T19:23:34.143" LastActivityDate="2020-09-23T19:23:34.143" Title="How can I implement a circuit that simulates white noise on $n$ qubits?" Tags="&lt;qiskit&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13891" PostTypeId="1" AcceptedAnswerId="13896" CreationDate="2020-09-23T16:43:39.673" Score="4" ViewCount="66" Body="&lt;p&gt;Lockability and non-lockability are explained in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0404096.pdf&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. 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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\max }(A)_{\rho}= \log \operatorname{tr}(\rho_{A}^{1 / 2})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For a bipartite quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, I would like to know if the max-entropy is non-lockable i.e. is there any relationship of the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{tr}(\rho_{AB}^{1/2}) \leq \text{tr}(\rho_{A}^{1/2})\cdot|B|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which, after taking logs on both sides, would yield&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\max}(AB)\leq H_{\max}(A) + \log|B|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A couple of easy numerical examples suggests this might be true but I have not been able to prove it.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-09-23T17:06:27.293" LastActivityDate="2020-09-24T14:18:52.800" Title="Non-lockability of quantum max-entropy" Tags="&lt;entropy&gt;&lt;partial-trace&gt;&lt;information-theory&gt;&lt;max-entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13892" PostTypeId="2" ParentId="13853" CreationDate="2020-09-23T20:25:28.870" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13312" LastEditorUserId="1859" LastEditDate="2020-10-27T08:13:16.560" LastActivityDate="2020-10-27T08:13:16.560" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13893" PostTypeId="1" AcceptedAnswerId="13954" CreationDate="2020-09-23T21:10:13.127" Score="2" ViewCount="84" Body="&lt;p&gt;I am trying to evolve a quantum state through a &lt;code&gt;PauliTrotterEvolution&lt;/code&gt; in aqua and I'm trying to do so by initializing a random state, by using &lt;code&gt;random_statevector&lt;/code&gt; from &lt;code&gt;qiskit.quantum_info&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My code:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;op=get_hamiltonian(-1,h) # a 4 qubit operator&#xA;evo_op=(t*op).exp_i()&#xA;evo_op=evo_op &#xA;&#xA;trotter_op=PauliTrotterEvolution(trotter_mode=Suzuki(reps=10,order=1)).convert(evo_op)&#xA;qinstance=QuantumInstance(backend=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;), shots=2048)&#xA;sampler=CircuitSampler(qinstance)&#xA;&#xA;trotter_op=trotter_op @ StateFn(state)&#xA;results1=sampler.convert(trotter_op).primitive&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;The error&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;this returns the following error: &lt;code&gt;ValueError: Qiskit circuit Initializer cannot handle non-positive statevectors.&lt;/code&gt; however, by the source code, the &lt;code&gt;Initializer&lt;/code&gt; comes from &lt;code&gt;qiskit.extensions&lt;/code&gt; which I believe is from this .py file (&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/e784e743018676a7d497ec7ab9b8b1265b65fa5a/qiskit/extensions/quantum_initializer/initializer.py#L33&quot; rel=&quot;nofollow noreferrer&quot;&gt;file&lt;/a&gt;) whose docstring states:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;quot;&amp;quot;&amp;quot;Complex amplitude initialization.&#xA;    Class that implements the (complex amplitude) initialization of some&#xA;    flexible collection of qubit registers (assuming the qubits are in the&#xA;    zero state).&#xA;    Note that Initialize is an Instruction and not a Gate since it contains a reset instruction,&#xA;    which is not unitary.&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;what am I missing?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastActivityDate="2020-09-29T17:52:41.807" Title="Simulate a random quantum state time evolution in Qiskit Aqua" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13894" PostTypeId="1" AcceptedAnswerId="13897" CreationDate="2020-09-24T11:43:00.383" Score="1" ViewCount="60" Body="&lt;p&gt;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):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import time&#xA;from typing import List, Optional, Any&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt &#xA;&#xA;from docplex.mp.model import Model&#xA;&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver&#xA;from qiskit.optimization.algorithms import CobylaOptimizer, MinimumEigenOptimizer&#xA;from qiskit.optimization.problems import QuadraticProgram&#xA;from qiskit.optimization.algorithms.admm_optimizer import ADMMParameters, ADMMOptimizer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I started the import this error appeared:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-32-c32e151d13df&amp;gt; in &amp;lt;module&amp;gt;&#xA;     11 &#xA;     12 from qiskit import BasicAer&#xA;---&amp;gt; 13 from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver&#xA;     14 from qiskit.optimization.algorithms import CobylaOptimizer, MinimumEigenOptimizer&#xA;     15 from qiskit.optimization.problems import QuadraticProgram&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/__init__.py in &amp;lt;module&amp;gt;&#xA;     75 from .aqua_globals import aqua_globals&#xA;     76 from .quantum_instance import QuantumInstance&#xA;---&amp;gt; 77 from .algorithms import QuantumAlgorithm&#xA;     78 from ._logging import (QiskitLogDomains,&#xA;     79                        get_logging_level,&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/__init__.py in &amp;lt;module&amp;gt;&#xA;    190 from .eigen_solvers import NumPyEigensolver, ExactEigensolver, EigensolverResult&#xA;    191 from .factorizers import Shor&#xA;--&amp;gt; 192 from .linear_solvers import HHL, NumPyLSsolver, ExactLSsolver&#xA;    193 from .minimum_eigen_solvers import (VQE, VQEResult, QAOA, IQPE, IQPEResult, QPE, QPEResult,&#xA;    194                                     ClassicalCPLEX, CPLEX_Ising, NumPyMinimumEigensolver,&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/__init__.py in &amp;lt;module&amp;gt;&#xA;     15 &amp;quot;&amp;quot;&amp;quot; Linear Solvers Package &amp;quot;&amp;quot;&amp;quot;&#xA;     16 &#xA;---&amp;gt; 17 from .hhl import HHL&#xA;     18 from .numpy_ls_solver import NumPyLSsolver, ExactLSsolver&#xA;     19 &#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in &amp;lt;module&amp;gt;&#xA;     24 from qiskit.aqua import QuantumInstance&#xA;     25 from qiskit.aqua.algorithms import QuantumAlgorithm&#xA;---&amp;gt; 26 from qiskit.ignis.verification.tomography import state_tomography_circuits, \&#xA;     27     StateTomographyFitter&#xA;     28 from qiskit.converters import circuit_to_dag&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/ignis/verification/__init__.py in &amp;lt;module&amp;gt;&#xA;     98 &amp;quot;&amp;quot;&amp;quot;&#xA;     99 from .quantum_volume import qv_circuits, QVFitter&#xA;--&amp;gt; 100 from .randomized_benchmarking import (CNOTDihedral,&#xA;    101                                       randomized_benchmarking_seq,&#xA;    102                                       RBFitter, InterleavedRBFitter,&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/ignis/verification/randomized_benchmarking/__init__.py in &amp;lt;module&amp;gt;&#xA;     19 &#xA;     20 # Randomized Benchmarking functions&#xA;---&amp;gt; 21 from .circuits import randomized_benchmarking_seq&#xA;     22 from .dihedral import (CNOTDihedral, decompose_cnotdihedral, random_cnotdihedral)&#xA;     23 from .fitters import (RBFitter, InterleavedRBFitter, PurityRBFitter,&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/ignis/verification/randomized_benchmarking/circuits.py in &amp;lt;module&amp;gt;&#xA;    204                                 is_purity: bool = False,&#xA;    205                                 group_gates: Optional[str] = None,&#xA;--&amp;gt; 206                                 rand_seed: Optional[Union[int, RandomState]] = None) -&amp;gt; \&#xA;    207         (List[List[qiskit.QuantumCircuit]], List[List[int]],&#xA;    208          Optional[List[List[qiskit.QuantumCircuit]]],&#xA;&#xA;AttributeError: module 'qiskit' has no attribute 'quantum_info'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Since I only copied the code, it seems there is some bug. &lt;strong&gt;Does anybody know how to solve this?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note: I work in Quantum Lab in IBM Q Experience interface&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-09-25T12:03:44.840" LastActivityDate="2020-09-25T12:03:44.840" Title="Qiskit: Error when importing libraries for ADMM optimizer" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13895" PostTypeId="1" CreationDate="2020-09-24T12:21:04.983" Score="3" ViewCount="62" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Variation in Vigo: approx. 0.7&lt;/p&gt;&#xA;&lt;p&gt;Variation in Melbourne: approx. 2.6&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="9006" LastEditDate="2020-09-25T06:50:49.553" LastActivityDate="2020-09-25T06:50:49.553" Title="IBM Melbourne quantum computer performance and errors" Tags="&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;ibm&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13896" PostTypeId="2" ParentId="13891" CreationDate="2020-09-24T14:18:52.800" Score="4" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$D_{\alpha}(\rho\|\sigma):= \frac{1}{\alpha - 1} \log \mathrm{Tr}[\rho^\alpha \sigma^{1-\alpha}]$&lt;/span&gt; be the Petz-Rényi divergence for &lt;span class=&quot;math-container&quot;&gt;$\alpha \in (0,1)\cup(1,\infty)$&lt;/span&gt;. Note that for &lt;span class=&quot;math-container&quot;&gt;$\alpha \in (0,1)\cup(1,2]$&lt;/span&gt; this quantity satisfies the &lt;em&gt;data processing inequality&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D_{\alpha}(\rho\|\sigma) \geq D_{\alpha}(\mathcal{E}(\rho) \| \mathcal{E}(\sigma)),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is any CPTP map.&lt;/p&gt;&#xA;&lt;p&gt;Now let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; be any state and take &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; to be the partial trace over the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; system. Then for &lt;span class=&quot;math-container&quot;&gt;$\alpha = 1/2$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;-2 \log \mathrm{Tr}[\rho^{1/2}_{AB}] &amp;amp;= D_{1/2}(\rho_{AB}\|I_{AB}) \\&#xA;&amp;amp;\geq D_{1/2}(\mathrm{Tr}_{B}[\rho_{AB}]\|\mathrm{Tr}_{B}[I_{AB}]) \\&#xA;&amp;amp;= D_{1/2}(\rho_{A}\||B|I_{A}) \\&#xA;&amp;amp;= -2 \log \mathrm{Tr}[\rho^{1/2}_{A} |B|^{1/2}]&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Rearranging you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\log \mathrm{Tr}[\rho^{1/2}_{AB}] \leq \log \mathrm{Tr}[\rho^{1/2}_{A}] + \log|B|^{1/2}&#xA;$$&lt;/span&gt;&#xA;which is actually a slightly stronger inequality with the exponent of &lt;span class=&quot;math-container&quot;&gt;$|B|$&lt;/span&gt; being only &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-09-24T14:18:52.800" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13897" PostTypeId="2" ParentId="13894" CreationDate="2020-09-24T15:01:38.017" Score="1" Body="&lt;p&gt;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.&#xA;Try to restart the kernel or create a new notebook and run the same imports.&lt;/p&gt;&#xA;" OwnerUserId="13318" LastActivityDate="2020-09-24T15:01:38.017" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13898" PostTypeId="2" ParentId="13895" CreationDate="2020-09-24T15:27:47.827" Score="3" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;ibmq_vigo has a QV of 16:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kyUfL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kyUfL.png&quot; alt=&quot;Snapshot of Vigo's QV from IBMQ Experience website&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where as ibmq_16_melbourne as QV of 8:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zy2yp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zy2yp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can read more about QV here: &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-24T15:27:47.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13899" PostTypeId="1" CreationDate="2020-09-24T15:46:05.403" Score="1" ViewCount="69" Body="&lt;p&gt;Is there a quantum gate that can do the following?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastActivityDate="2020-09-24T15:46:05.403" Title="Is there a quantum gate that can do this?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13900" PostTypeId="2" ParentId="13884" CreationDate="2020-09-24T17:05:23.213" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5567/circuit-construction-for-hamiltonian-simulation&quot;&gt;This Stack Exchange thread&lt;/a&gt; details basic theory of Hamiltonian simulation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;This tutorial&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, I am linking a similar thread &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4017/is-there-a-hamiltonian-simulation-technique-implemented-somewhere&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="9006" LastEditDate="2020-09-25T06:54:01.920" LastActivityDate="2020-09-25T06:54:01.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13901" PostTypeId="1" CreationDate="2020-09-24T18:58:47.357" Score="3" ViewCount="30" Body="&lt;p&gt;I am currently reading this paper about &lt;a href=&quot;https://arxiv.org/pdf/1305.4541.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Key Distribution Protocols which use Franson Interferometers to secure against eavesdroppers&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;I know this is a long slew of questions so any help is greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="13313" LastActivityDate="2020-09-24T18:58:47.357" Title="How are Franson Interferometers used to prove security in Photonic QKD Experiments?" Tags="&lt;entanglement&gt;&lt;photonics&gt;&lt;games&gt;&lt;key-distribution&gt;&lt;qkd&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13902" PostTypeId="5" CreationDate="2020-09-25T00:55:51.400" Score="0" Body="&lt;p&gt;For questions related to the theorem of Bennettl, Bernstein, Brassard, and Vazirani theorem, which states that, relative to a random oracle, a quantum computer can achieve, at best, a quadratic speedup over a classical computer.&lt;/p&gt;&#xA;&lt;p&gt;Pertinent questions may be associated with proof techniques for quantum computing lower bounds, such as the hybrid technique or the adversarial method.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-09-25T12:02:08.703" LastActivityDate="2020-09-25T12:02:08.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13903" PostTypeId="4" CreationDate="2020-09-25T00:55:51.400" Score="0" Body="For questions related to the theorem of Bennettl, Bernstein, Brassard, and Vazirani, which states that, relative to a random oracle, a quantum computer can achieve, at best, a quadratic speedup over a classical computer." OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-09-25T12:01:54.000" LastActivityDate="2020-09-25T12:01:54.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13904" PostTypeId="1" AcceptedAnswerId="13905" CreationDate="2020-09-25T02:25:30.420" Score="3" ViewCount="64" Body="&lt;p&gt;Exercise 2.63 of Nielsen &amp;amp; Chuang asks one to show that if a measurement is described by measurement operators &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt;, there exists unitary &lt;span class=&quot;math-container&quot;&gt;$U_m$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$M_m = U_m \sqrt{E_m}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$E_m$&lt;/span&gt; are the POVM associated to the measurement (that is, &lt;span class=&quot;math-container&quot;&gt;$E_m = M^{\dagger}_m M_m$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I can see that, if &lt;span class=&quot;math-container&quot;&gt;$\sqrt{E_m}$&lt;/span&gt; is invertible, then &lt;span class=&quot;math-container&quot;&gt;$U_m = M_m \sqrt{E_m}^{-1}$&lt;/span&gt; is unitary; indeed, we have (dropping the needless subscript for simplicity) &lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt;&#xA;where I used that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{E}$&lt;/span&gt; is Hermitian (since it is positive).&lt;/p&gt;&#xA;&lt;p&gt;But what if it's not invertible? Perhaps some continuity argument would work?&lt;/p&gt;&#xA;" OwnerUserId="9168" LastEditorUserId="55" LastEditDate="2020-09-25T11:38:55.943" LastActivityDate="2020-09-25T11:38:55.943" Title="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" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13905" PostTypeId="2" ParentId="13904" CreationDate="2020-09-25T05:07:33.180" Score="2" Body="&lt;p&gt;It is just a &lt;a href=&quot;https://en.wikipedia.org/wiki/Polar_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;polar decomposition&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt;.&lt;br /&gt;&#xA;If &lt;span class=&quot;math-container&quot;&gt;$M_m = U P$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$M^{\dagger}_m M_m = P^2$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$P = \sqrt{E_m}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Limiting argument, similar to &lt;a href=&quot;https://en.wikipedia.org/wiki/Cholesky_decomposition#Proof_for_positive_semi-definite_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, also can work.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-09-25T05:07:33.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13906" PostTypeId="1" AcceptedAnswerId="13908" CreationDate="2020-09-25T06:59:29.980" Score="3" ViewCount="121" Body="&lt;p&gt;This is a simple circuit introduced in Moran's book &amp;quot;Mastering Quantum Computing with IBM QX&amp;quot; to demonstrate how &lt;em&gt;if&lt;/em&gt; works in OpenQASM:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[5]; // Quantum Register&#xA;creg c[5]; // Classical Register&#xA; &#xA;x q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;if (c==1) x q[1];&#xA;measure q[1] -&amp;gt; c[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And this is how the circuit visually looks in IBM QX Circuit Composer:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hrtEk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hrtEk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The book states that at the end of the circuit, the classical register should read &lt;em&gt;00011&lt;/em&gt; because after the first measurement it holds a value 1 (as a decimal number), thus satisfying the &lt;em&gt;if&lt;/em&gt; condition. However, when I test this exact circuit in IBM QX's Circuit Composer, the result shows &lt;em&gt;00001&lt;/em&gt; with 100% probability.&lt;/p&gt;&#xA;&lt;p&gt;Interestingly enough, when &lt;code&gt;if (c==1)&lt;/code&gt; is changed to &lt;code&gt;if (c==0)&lt;/code&gt;, the result is now &lt;em&gt;00011&lt;/em&gt; with 100% probability, which I don't think is logically right.&lt;/p&gt;&#xA;&lt;p&gt;What should be an explanation for this discrepancy? The book argues that the &lt;em&gt;if&lt;/em&gt; statement is not supported by IBM QX (as of Jan 2019), so could this be a sort of bug?&lt;/p&gt;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="4204" LastEditorUserId="55" LastEditDate="2020-09-27T15:47:04.760" LastActivityDate="2020-09-28T15:43:46.230" Title="IF statement in OpenQASM on IBM Quantum Experience" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13907" PostTypeId="2" ParentId="13749" CreationDate="2020-09-25T11:41:03.280" Score="1" Body="&lt;p&gt;A highly skillful analysis in Mathematica of the problem has been given by the user &amp;quot;JimB&amp;quot; in his answer to&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://mathematica.stackexchange.com/questions/230127/evaluate-a-certain-three-dimensional-constrained-integral&quot;&gt;MathematicaFormulation&lt;/a&gt;  .&lt;/p&gt;&#xA;&lt;p&gt;That analysis was based on a transformation by Nicolas Tessore of the original 3D constrained integration problem to an unconstrained one.&lt;/p&gt;&#xA;&lt;p&gt;The  answer given by JimB&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\frac{29902415923}{497664}-\frac{50274109}{512 \sqrt{2}}-\frac{3072529845 \pi }{32768&#xA;   \sqrt{2}}+\frac{1024176615 \cos ^{-1}\left(\frac{1}{3}\right)}{4096 \sqrt{2}}&#xA;\end{equation}&lt;/span&gt;&#xA;or in Mathematica notation,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;29902415923/497664 - 50274109/(512 Sqrt[2]) - (3072529845 π)/(32768 Sqrt[2]) +(1024176615 ArcCos[1/3])/(4096 Sqrt[2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;fully agrees with the earlier set of results-shown in the question statement.&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="3089" LastEditDate="2020-09-26T15:53:32.540" LastActivityDate="2020-09-26T15:53:32.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13908" PostTypeId="2" ParentId="13906" CreationDate="2020-09-25T12:12:29.033" Score="2" Body="&lt;p&gt;&lt;del&gt;I think is, indeed, a bug in IQX.&lt;/del&gt; There is an explanation for this, but it is a bit obscure. It will be explained later.&lt;/p&gt;&#xA;&lt;p&gt;Your code is correct:&lt;/p&gt;&#xA;&lt;p&gt;Here is the result in Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;With &lt;code&gt;c==1&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qc = QuantumCircuit.from_qasm_str(&amp;quot;&amp;quot;&amp;quot;&#xA;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[5]; // Quantum Register&#xA;creg c[5]; // Classical Register&#xA; &#xA;x q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;if (c==1) x q[1];&#xA;measure q[1] -&amp;gt; c[1];&#xA;&amp;quot;&amp;quot;&amp;quot;)&#xA;qc.draw('mpl')&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;execute(qc,backend).result().get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'00011': 1024}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;With &lt;code&gt;c==0&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qc = QuantumCircuit.from_qasm_str(&amp;quot;&amp;quot;&amp;quot;&#xA;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[5]; // Quantum Register&#xA;creg c[5]; // Classical Register&#xA; &#xA;x q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;if (c==0) x q[1];&#xA;measure q[1] -&amp;gt; c[1];&#xA;&amp;quot;&amp;quot;&amp;quot;)&#xA;qc.draw('mpl')&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;execute(qc,backend).result().get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'00001': 1024}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;Why this does not work on IQX visualizations&lt;/h2&gt;&#xA;&lt;p&gt;There is note in &lt;a href=&quot;https://quantum-computing.ibm.com/docs/iqx/visualizations&quot; rel=&quot;nofollow noreferrer&quot;&gt;the IQX documentation for visualizations&lt;/a&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JxyJ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JxyJ7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The key part is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The visualizations do not reflect any measurement operations in your circuit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That means that your &lt;code&gt;measure&lt;/code&gt; statement is ignored, leaving your code like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;x q[0];&#xA;if (c==1) x q[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The initial state of &lt;code&gt;c&lt;/code&gt; is 0. Therefore, just &lt;code&gt;x q[0];&lt;/code&gt; resulting in &lt;code&gt;00001&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When you changed to &lt;code&gt;c==0&lt;/code&gt;, then the circuit is &lt;code&gt;x q[0]; x q[1];&lt;/code&gt;, resulting in &lt;code&gt;00011&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-28T15:43:46.230" LastActivityDate="2020-09-28T15:43:46.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13909" PostTypeId="1" CreationDate="2020-09-25T12:51:33.163" Score="1" ViewCount="39" Body="&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$0.7414$&lt;/span&gt; Å) as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{op} = -1.052\, II + 0.397\, IZ -0.397\, ZI -0.011 \, ZZ + 0.180 \,XX$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;PauliExpectation()&lt;/code&gt; function from aqua. For this problem, I assume expectation values are computed for each component (&lt;span class=&quot;math-container&quot;&gt;$II$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZI$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt;) of the above Hamiltonian (multiplied by the pre-factors: &lt;span class=&quot;math-container&quot;&gt;$-1.05, 0.39, 0.39, -0.01, 0.18$&lt;/span&gt;) and then summed up.&lt;/p&gt;&#xA;&lt;p&gt;I am wondering if it's possible to report the expectation values for each component, ie just for the &lt;span class=&quot;math-container&quot;&gt;$IZ$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZI$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; terms, for example. I could very easily then multiply the pre-factors and compute the total expectation value classically.&lt;/p&gt;&#xA;" OwnerUserId="13328" LastEditorUserId="23" LastEditDate="2020-09-25T21:33:56.427" LastActivityDate="2020-09-25T21:33:56.427" Title="Report measurement components for a given Hamiltonian measurement" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13910" PostTypeId="1" CreationDate="2020-09-25T13:09:49.067" Score="2" ViewCount="28" Body="&lt;p&gt;Many quantum processes are formulated in a resource theoretic approach like entanglement, athermality, asymmetry, coherence, etc.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.)&lt;/p&gt;&#xA;" OwnerUserId="13204" LastEditorUserId="45" LastEditDate="2020-09-25T21:26:14.323" LastActivityDate="2020-09-25T21:26:14.323" Title="What applications does single-shot state conversion have?" Tags="&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13911" PostTypeId="2" ParentId="13872" CreationDate="2020-09-25T15:15:39.717" Score="1" Body="&lt;p&gt;The link to the paper in the question is by Bennett, Bernstein, Brassard, and Vazirani (BBBV).&lt;/p&gt;&#xA;&lt;p&gt;The standard BBBV oracular problem to which the OP refers may be recast as, given the value &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; of a permutation &lt;span class=&quot;math-container&quot;&gt;$y=f(x)$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; inputs, find a full preimage &lt;span class=&quot;math-container&quot;&gt;$x=x_1x_2\cdots x_n$&lt;/span&gt; of the permutation which evaluates to &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. BBBV provided a &lt;em&gt;lower&lt;/em&gt; bound, noting that it may take at least &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{2^n})$&lt;/span&gt; calls to the oracle.  Somewhat famously, the same &lt;em&gt;upper bound&lt;/em&gt; was found, almost simultaneously with BBBV, by Grover.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;polynomial method&amp;quot;); there have been a number of improvements such as the as-mentioned &amp;quot;hybrid method&amp;quot; and culminating in the &amp;quot;adversarial method&amp;quot; of Ambainis.  I like O'Donnell's &lt;a href=&quot;https://www.youtube.com/watch?v=XD-fKJswPsI&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt; on ways to prove the BBBV bound.&lt;/p&gt;&#xA;&lt;p&gt;The question of the OP seems not ask for a lower bound not for the &lt;em&gt;full&lt;/em&gt; preimage &lt;span class=&quot;math-container&quot;&gt;$x_1 x_2\cdots x_n$&lt;/span&gt;, but only for the least significant bit (LSB) &lt;span class=&quot;math-container&quot;&gt;$x_n$&lt;/span&gt; of the preimage. But if one has a quick oracle to know the LSB &lt;span class=&quot;math-container&quot;&gt;$x_n$&lt;/span&gt;, I think one can rinse and repeat to find the full preimage &lt;span class=&quot;math-container&quot;&gt;$x_1x_2\cdots x_n$&lt;/span&gt; quickly as well, with only &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; calls to the parity oracle.  For example, one could define a series of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; permutations as in:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f=f_n(x_1x_2\cdots x_n)=y_1y_2\cdots y_n$&lt;/span&gt;; given &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y=00\cdots 01$&lt;/span&gt;, the parity oracle would determine &lt;span class=&quot;math-container&quot;&gt;$x_n$&lt;/span&gt;;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_{n-1}(x_1x_2\cdots x_{n-1})=y_1y_2\cdots y_{n-1}$&lt;/span&gt;;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\ldots$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_2(x_1x_2)=y_1y_2$&lt;/span&gt;;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f_1(x_1)=y_1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and use the oracle for each of the &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; functions so-defined.&lt;/p&gt;&#xA;&lt;p&gt;Thus, if one were to use the hybrid method to prove a lower bound on a parity oracle for the preimage of &lt;span class=&quot;math-container&quot;&gt;$f_n$&lt;/span&gt;, then the proof would carry through to each of the subsequent &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, by simply using the results of this parity oracle to redefine new functions &lt;span class=&quot;math-container&quot;&gt;$f_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\mathrm{poly\:} n)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(n)$&lt;/span&gt;-overhead.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;ADDED IN AN ATTEMPT TO CLARIFY&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you can prove the BBBV theorem  to show that you need an exponential number of calls to a generic oracle to &lt;em&gt;fully&lt;/em&gt; 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 &lt;em&gt;only&lt;/em&gt; the parity of the inverse of a function; if not, then you can still use your oracle to &lt;em&gt;fully&lt;/em&gt; invert a function/permutation in polynomial time, which contradicts exactly what the BBBV theorem proved.&lt;/p&gt;&#xA;&lt;p&gt;For example, assume that you can use a polynomial number of calls, say &lt;span class=&quot;math-container&quot;&gt;$n^3$&lt;/span&gt; calls, to an oracle so that you can determine the parity &lt;span class=&quot;math-container&quot;&gt;$x_n$&lt;/span&gt; of the preimage &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; of a permutation function &lt;span class=&quot;math-container&quot;&gt;$\sigma=f$&lt;/span&gt; which evaluates to a particular value &lt;span class=&quot;math-container&quot;&gt;$y=00\cdots01$&lt;/span&gt;.  You can then repeat such a test to determine &lt;em&gt;each&lt;/em&gt; of the bits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, but you are doing this in polynomial time, say &lt;span class=&quot;math-container&quot;&gt;$n^4$&lt;/span&gt; time.  But this is exactly what BBBV proved you cannot do.&lt;/p&gt;&#xA;&lt;p&gt;Thus we have a way to use the hybrid method, which proved the BBBV theorem for &lt;em&gt;all&lt;/em&gt; bits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, to show that we require an exponential number of calls to an oracle to determine the parity of only &lt;em&gt;one&lt;/em&gt; of the bits of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (e.g. &lt;span class=&quot;math-container&quot;&gt;$x_n$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-09-25T20:09:28.963" LastActivityDate="2020-09-25T20:09:28.963" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13912" PostTypeId="1" CreationDate="2020-09-25T23:35:51.503" Score="2" ViewCount="116" Body="&lt;p&gt;My question might be similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6879/hidden-subgroup-problem&quot;&gt;Hidden subgroup problem&lt;/a&gt;. However, I'm not exactly sure though. In addition, that question doesn't have an answer.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose we have a finite abelian group &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;. In addition, we&#xA;have an arbitrary subgroup &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Find a function, &lt;span class=&quot;math-container&quot;&gt;$f_H : G \to S$&lt;/span&gt;, for some set &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. In addition, &lt;span class=&quot;math-container&quot;&gt;$f_H$&lt;/span&gt;&#xA;is constant, and for simplicity distinct on the cosets of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I know that WLOG, we can assume &lt;span class=&quot;math-container&quot;&gt;$G \ge H$&lt;/span&gt; is such that &lt;span class=&quot;math-container&quot;&gt;$G \cong \mathbb{Z}_{p^{k_1}} \oplus \mathbb{Z}_{p^{k_2}} \dots \oplus \mathbb{Z}_{p^{k_n}}$&lt;/span&gt;, for the same &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. Since the abelian HSP, and thus the problem I mentioned above, can be solved separately for the relatively prime components.&lt;/p&gt;&#xA;&lt;p&gt;My question is about when &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is not a power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. In which can we need to instead look at &lt;span class=&quot;math-container&quot;&gt;$G' \cong \mathbb{Z}_{2^{r_1}} \oplus \mathbb{Z}_{2^{r_2}} \dots \oplus \mathbb{Z}_{2^{r_n}}$&lt;/span&gt; where for each &lt;span class=&quot;math-container&quot;&gt;$k_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p^{2k_{i}} \le 2^{r_i} \le 2p^{2k_{i}}$&lt;/span&gt;, and use the continued fractions algorithm. Given, &lt;span class=&quot;math-container&quot;&gt;$f_H$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$G \ge H$&lt;/span&gt;), how do we extend the support of &lt;span class=&quot;math-container&quot;&gt;$f_H$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$G'$&lt;/span&gt; such that we can still sample from the dual of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;In the case of the order-finding/Shor's function with support &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{\phi(N)}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is Euler's totient function),  the support of &lt;span class=&quot;math-container&quot;&gt;$f(x) = a^k mod N$&lt;/span&gt; can be naturally extended from &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{\phi(N)}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_N$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{2^k}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N^2 \le 2^k \le 2N^2$&lt;/span&gt;. Also Shor proved the extension is valid for this function. But what about an arbitrary &lt;span class=&quot;math-container&quot;&gt;$f_H$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;The set of functions I'm looking at are ones that simply assign a distinct natural number to each coset.&lt;/p&gt;&#xA;&lt;p&gt;I was thinking something like given &lt;span class=&quot;math-container&quot;&gt;$f_H$&lt;/span&gt; as above extend to &lt;span class=&quot;math-container&quot;&gt;$f'_H$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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}}))$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(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}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This doesn't seem to work; I'm not sure it actually makes sense.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$G'$&lt;/span&gt;, as I stated above. In which case we can apply &lt;span class=&quot;math-container&quot;&gt;$f_H$&lt;/span&gt;, as is. However, we still utilized the QFT of &lt;span class=&quot;math-container&quot;&gt;$G'$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; (or QFT for &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_r$&lt;/span&gt; for arbirary &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;), 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.&lt;/p&gt;&#xA;&lt;p&gt;Since, as mentioned here &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0603140.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/0603140.pdf&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;I'm still not sure if this is correct. If it is, I'm not sure of an efficient way of implementing such superpositions.&lt;/p&gt;&#xA;&lt;p&gt;Please let me know if anything isn't clear with my question.&lt;/p&gt;&#xA;" OwnerUserId="8765" LastEditorUserId="8765" LastEditDate="2020-09-28T18:00:05.997" LastActivityDate="2021-02-27T19:01:10.210" Title="Constructing arbitrary functions for the Abelian HSP" Tags="&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;&lt;hidden-subgroup-problem&gt;&lt;fourier-sampling&gt;" AnswerCount="1" CommentCount="15" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13913" PostTypeId="2" ParentId="13168" CreationDate="2020-09-26T00:05:15.947" Score="3" Body="&lt;p&gt;UPDATE: &lt;a href=&quot;https://pypi.org/project/qiskit-terra/0.16&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Terra 0.16&lt;/a&gt; (release Oct 2020) fixes this issue.&lt;/p&gt;&#xA;&lt;p&gt;I just merged &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/4893&quot; rel=&quot;nofollow noreferrer&quot;&gt;PR 4893&lt;/a&gt;, fixing this issue in &lt;s&gt;coming&lt;/s&gt; Qiskit Terra 0.16. This closes &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/4905&quot; rel=&quot;nofollow noreferrer&quot;&gt;4905&lt;/a&gt; and &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/4893&quot; rel=&quot;nofollow noreferrer&quot;&gt;4893&lt;/a&gt; (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 &lt;a href=&quot;https://matplotlib.org/3.3.0/users/whats_new.html#axes3d-no-longer-distorts-the-3d-plot-to-match-the-2d-aspect-ratio&quot; rel=&quot;nofollow noreferrer&quot;&gt;a fix&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-04-23T19:17:34.553" LastActivityDate="2021-04-23T19:17:34.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13914" PostTypeId="2" ParentId="9940" CreationDate="2020-09-26T00:15:04.787" Score="0" Body="&lt;p&gt;If I understand your question correctly, you are looking for a way to create custom gates.&lt;/p&gt;&#xA;&lt;p&gt;For that, first create a circuit that it will be converted to a gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;my_circuit = QuantumCircuit(3, name='mygate')&#xA;my_circuit.x(range(3))&#xA;....&#xA;my_gate = my_circuit.to_gate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, you can use your gate in a bigger circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(5)&#xA;circuit.append(my_gate, [0,2,3])&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────┐&#xA;q_0: ┤0         ├&#xA;     │          │&#xA;q_1: ┤          ├&#xA;     │  my_gate │&#xA;q_2: ┤1         ├&#xA;     │          │&#xA;q_3: ┤2         ├&#xA;     └──────────┘&#xA;q_4: ────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can see your custom gate &amp;quot;content&amp;quot; with &lt;code&gt;circuit.decompose()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-26T00:15:04.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13915" PostTypeId="2" ParentId="10212" CreationDate="2020-09-26T07:43:18.947" Score="3" Body="&lt;p&gt;In this &lt;a href=&quot;https://arxiv.org/pdf/1804.03719.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; they talk primarily about &lt;strong&gt;ibmqx4&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The gates listed in Eq. (26) are provided by IBM for the user’s convenience. However these are&#xA;not the gates that are physically implemented by their quantum computer. IBM has a compiler that&#xA;translates the gates in (26) into products of gates from a physical gate set. The physical gate set&#xA;employed by IBM is essentially composed of three gates [1]:&#xA;{U1(λ), RX (π/2), CNOT} .&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It seems that the link [1] from the paper is broken but I was able to find &lt;a href=&quot;https://github.com/Qiskit/ibmq-device-information/tree/master/backends/rueschlikon/V1&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;, which is device information of &lt;em&gt;IBM Q 16 Rueschlikon&lt;/em&gt; &lt;strong&gt;ibmxq5&lt;/strong&gt; (formerly ibmqx3)&lt;br/&gt;&#xA;They mention:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/exoZp.png&quot; width=&quot;500&quot;&gt;&#xA;&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I believe in the IBM Q Experience platform, the term &amp;quot;basis gates&amp;quot;,&#xA;which you can find in each backend's specification, refers to the&#xA;implemented physical gates on that specific device.&lt;br /&gt; So for Melbourne we'll have &lt;code&gt;id, u1, u2, u3, cx&lt;/code&gt;.&lt;br /&gt; &lt;em&gt;This should be confirmed by someone from IBM Q team though, but I think physical gates, native gates and basis gates are interchangeable terms.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;The above image should explain your second question.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2020-09-26T10:11:15.757" LastActivityDate="2020-09-26T10:11:15.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13916" PostTypeId="2" ParentId="13202" CreationDate="2020-09-26T09:20:47.477" Score="4" Body="&lt;h2&gt;qiskit-terra 0.16 or lower&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13226/1859&quot;&gt;As answered&lt;/a&gt;, probably the most canonical way to do this is with &lt;code&gt;Statevector.from_label&lt;/code&gt; and &lt;code&gt;initialize&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is the full example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;n = 2&#xA;qc = QuantumCircuit(n)&#xA;&#xA;qc.initialize(Statevector.from_label('1'*n).data, range(n))&#xA;qc.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────────────────┐&#xA;q_0: ┤0                     ├&#xA;     │  initialize(0,0,0,1) │&#xA;q_1: ┤1                     ├&#xA;     └──────────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You could confirm the result like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.measure_all()&#xA;execute(qc, backend=BasicAer.get_backend('qasm_simulator')).result().get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;qiskit-terra 0.17 or higher&lt;/h2&gt;&#xA;&lt;p&gt;This questions inspired a new way to initialize a qubits in the basis states of the Pauli eigenstates Z, X, Y (à la &lt;code&gt;Statevector.from_label&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.extensions.quantum_initializer.initializer import Initialize&#xA;&#xA;circuit = QuantumCircuit(6)&#xA;circuit.append(Initialize(&amp;quot;10+-lr&amp;quot;), range(6))&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────────────────────┐&#xA;q_0: ┤0                         ├&#xA;     │                          │&#xA;q_1: ┤1                         ├&#xA;     │                          │&#xA;q_2: ┤2                         ├&#xA;     │  initialize(1,0,+,-,l,r) │&#xA;q_3: ┤3                         ├&#xA;     │                          │&#xA;q_4: ┤4                         ├&#xA;     │                          │&#xA;q_5: ┤5                         ├&#xA;     └──────────────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The decomposition of this gate is the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.decompose().draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;          ┌───┐ ┌───┐ &#xA;q_0: ─|0&amp;gt;─┤ H ├─┤ S ├─&#xA;          ├───┤┌┴───┴┐&#xA;q_1: ─|0&amp;gt;─┤ H ├┤ SDG ├&#xA;          ├───┤└┬───┬┘&#xA;q_2: ─|0&amp;gt;─┤ X ├─┤ H ├─&#xA;          ├───┤ └───┘ &#xA;q_3: ─|0&amp;gt;─┤ H ├───────&#xA;          └───┘       &#xA;q_4: ─|0&amp;gt;─────────────&#xA;          ┌───┐       &#xA;q_5: ─|0&amp;gt;─┤ X ├───────&#xA;          └───┘       &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-10-21T18:46:10.027" LastActivityDate="2020-10-21T18:46:10.027" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13917" PostTypeId="2" ParentId="11436" CreationDate="2020-09-26T10:35:57.883" Score="0" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; terms. Similarly, a &lt;span class=&quot;math-container&quot;&gt;$N\times N$&lt;/span&gt; matrix has &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; independent entries, so in the most general case, you will need &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; terms in your decomposition.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I suggest you check this answer: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis?noredirect=1&amp;amp;lq=1&quot;&gt;Can arbitrary matrices be decomposed using the Pauli basis?&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt;, but in general, you might have fewer terms.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11551" LastActivityDate="2020-09-26T10:35:57.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13918" PostTypeId="1" AcceptedAnswerId="13922" CreationDate="2020-09-26T14:05:00.007" Score="1" ViewCount="117" Body="&lt;p&gt;&lt;strong&gt;Shor's 9 Qubit code.&lt;/strong&gt; Imagine that we encode the state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle$&lt;/span&gt; using Shor's 9 qubit code, then an X error occurs on the 8th qubit of the encoded state &lt;span class=&quot;math-container&quot;&gt;$| E ( \psi ) \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;a) Write down the state following the error.&lt;/p&gt;&#xA;&lt;p&gt;Apparently the answer is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How has this been derived? I cant see how you do this with an error.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Apparently the syndromes are &lt;span class=&quot;math-container&quot;&gt;$00, 00, 10$&lt;/span&gt;. How do I know what measurements to do?&lt;/p&gt;&#xA;&lt;p&gt;c) Now imagine that &lt;span class=&quot;math-container&quot;&gt;$| E( \psi ) \rangle$&lt;/span&gt; is affected by two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors, on the 7th and 8th qubits. What are the syndromes returned this time? What state does the decoding algorithm output?&lt;/p&gt;&#xA;&lt;p&gt;Now the syndromes are &lt;span class=&quot;math-container&quot;&gt;$00, 00, 01$&lt;/span&gt;. The decoding algorithm thus thinks there has been an X error on the 9th qubit. So it &amp;quot;corrects&amp;quot; this by applying an X operation on this qubit, to give the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; now has a minus sign in front of it. After the bit decoding, we are left with &lt;span class=&quot;math-container&quot;&gt;$\alpha | {+++} \rangle - \beta | {---} \rangle$&lt;/span&gt;, which is then decoded to &lt;span class=&quot;math-container&quot;&gt;$\alpha | 0 \rangle - \beta | 1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation to the 9th qubit?&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="15391" LastEditDate="2021-04-06T09:49:34.443" LastActivityDate="2021-04-06T09:49:34.443" Title="Example of Quantum Error Correction" Tags="&lt;error-correction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="2" ClosedDate="2020-09-29T09:06:55.247" ContentLicense="CC BY-SA 4.0" />
  <row Id="13919" PostTypeId="1" AcceptedAnswerId="13927" CreationDate="2020-09-26T15:45:01.820" Score="3" ViewCount="98" Body="&lt;p&gt;Quantum computing is not my field, so answers understandable to a layman will be most useful.  Please forgive any incorrect terminology in my question!&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;unentangled&lt;/em&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$R=B^C$&lt;/span&gt;, containing a superposition of 2^N - M different possible states.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="55" LastEditDate="2020-09-27T11:39:46.183" LastActivityDate="2020-09-27T21:16:02.890" Title="What does a quantum NOT operation do to an entangled set of qubits?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13920" PostTypeId="1" AcceptedAnswerId="13923" CreationDate="2020-09-26T18:15:17.383" Score="2" ViewCount="74" Body="&lt;p&gt;I'm using Qiskit to demonstrate some circuits, and I want to change the position of some gates for better representation.&lt;/p&gt;&#xA;&lt;p&gt;For example, look at this circuit: &lt;a href=&quot;https://i.stack.imgur.com/QhWXf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QhWXf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'd like for the last &lt;span class=&quot;math-container&quot;&gt;$R_x(\frac{-\pi}{2})$&lt;/span&gt; to align with the last Hadamard gate. Is there a way to do this without using barriers?&lt;/p&gt;&#xA;" OwnerUserId="13215" LastEditorUserId="55" LastEditDate="2020-09-26T22:21:51.880" LastActivityDate="2020-09-26T22:21:51.880" Title="Change the position of a gate in Qiskit for better representation" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13921" PostTypeId="1" AcceptedAnswerId="13924" CreationDate="2020-09-26T19:29:46.273" Score="1" ViewCount="67" Body="&lt;p&gt;In this &lt;a href=&quot;https://arxiv.org/pdf/1704.05018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; (&lt;a href=&quot;https://www.nature.com/articles/nature23879&quot; rel=&quot;nofollow noreferrer&quot;&gt;nature version&lt;/a&gt;), the authors state&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We group the Pauli operators into tensor product basis sets that require the same post-rotations.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-09-26T22:19:47.273" LastActivityDate="2020-09-26T22:19:47.273" Title="In Variational Quantum Eigensolvers, what does &quot;grouping Pauli operators into tensor products requiring the same post-rotations&quot; mean?" Tags="&lt;pauli-gates&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13922" PostTypeId="2" ParentId="13918" CreationDate="2020-09-26T20:03:28.203" Score="3" Body="&lt;p&gt;&lt;strong&gt;Answer to a)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Initial encoded state with qubit indexes (I will omit &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2\sqrt{2}}$&lt;/span&gt; for simplicity):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}|\psi\rangle = &amp;amp;\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) + \\ &amp;amp;\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)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After applying &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;th qubit (and after removing indexes):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}|\psi\rangle = &amp;amp;\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) + \\ &amp;amp;\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)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Answer to b)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;One should always do the same operator measurements no matter what error have been acquired. The operators for detecting &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error are &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_2 Z_3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_4 Z_5$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_5 Z_6$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_7 Z_8$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_8 Z_9$&lt;/span&gt;. After measuring all these &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; operators one obtains for each of them either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$00,00,10$&lt;/span&gt; syndrome measurement is wrong (I guess there is a typo in the exercise). The true syndrome is &lt;span class=&quot;math-container&quot;&gt;$00,00,11$&lt;/span&gt; and that means only &lt;span class=&quot;math-container&quot;&gt;$Z_7 Z_8$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_8 Z_9$&lt;/span&gt; operator measurements yielded &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; indicating that the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error has been acquired on &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; qubit. One can apply a &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the same (errored) &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;th qubit in order to correct the error. Here is &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B1,1,1,1,1,1,%22%7Es0r0%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,%22%E2%80%A2%22,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,%22%E2%80%A2%22,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,1,1,1,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7Es0r0%22,%22name%22:%22Encoding%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;the circuit&lt;/a&gt; for all mentioned &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; operator measurements (note that there are &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; measurements).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Answer to c)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;With this error-correcting code, we always assume that we have only &lt;strong&gt;one qubit error&lt;/strong&gt;. If there are &lt;strong&gt;two qubit errors&lt;/strong&gt; then this technique with its syndrome may indicate to do something that will not correct the error. In this example, &lt;span class=&quot;math-container&quot;&gt;$00, 00, 01$&lt;/span&gt; indicates (wrongly, because our assumption of &lt;strong&gt;one qubit error&lt;/strong&gt; is not true for this error example) that &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt;th qubit has got an error.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;I think the main question here is how to do operator measurement for the syndrome&lt;/strong&gt;. If I am correct then I suggest asking separately a question with a focus on this matter (with maybe this title &amp;quot;How to do &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; operator measurement for Shor's 9 qubit code?&amp;quot;).&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-26T21:04:19.007" LastActivityDate="2020-09-26T21:04:19.007" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13923" PostTypeId="2" ParentId="13920" CreationDate="2020-09-26T20:30:46.330" Score="2" Body="&lt;p&gt;The &lt;code&gt;justify=&lt;/code&gt; parameter might help.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.draw('mpl', reverse_bits=True, justify='right')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TR1Gl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TR1Gl.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Other option is to add the &lt;code&gt;barrier&lt;/code&gt; and then remove them from the plot (though that will skip all the barriers)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;qc.barrier(range(4))&#xA;qc.h(3)&#xA;qc.rx(-pi/2, 0)&#xA;qc.draw('mpl', reverse_bits=True, plot_barriers=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eGCxO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eGCxO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-09-26T20:37:57.733" LastActivityDate="2020-09-26T20:37:57.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13924" PostTypeId="2" ParentId="13921" CreationDate="2020-09-26T20:58:19.577" Score="1" Body="&lt;p&gt;Let me show an example for grouping for this Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = 5 \cdot XI + 3 \cdot XZ - 2 \cdot YI + 1.5 \cdot IY$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The expectation value:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle H \rangle = 5 \cdot \langle XI \rangle + 3 \cdot \langle XZ \rangle - 2 \cdot \langle YI \rangle + 1.5 \cdot \langle IY \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here I will group them in this way: the first group &lt;span class=&quot;math-container&quot;&gt;$XI$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$XZ$&lt;/span&gt;, the second group &lt;span class=&quot;math-container&quot;&gt;$YI$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$IY$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h6LxW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h6LxW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the first circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;amp;\langle X I \rangle = p(\text{00 or 01 measurements}) - p(\text{10 or 11 measurement})&#xA;\\&#xA;&amp;amp;\langle X Z \rangle = p(\text{00 or 11 measurements}) - p(\text{10 or 01 measurement})&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the second circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;amp;\langle Y I \rangle = p(\text{00 or 01 measurements}) - p(\text{10 or 11 measurement})&#xA;\\&#xA;&amp;amp;\langle I Y \rangle = p(\text{00 or 10 measurements}) - p(\text{01 or 11 measurement})&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; denotes a probability of a measurement outcome described in parenthesis. The main idea here is: For a given Pauli term &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; the expectation value is equal to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle P \rangle = p_+ - p_-$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p_+$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$p_-$&lt;/span&gt;) is the probability of having an eigenstate that has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;). More details about this can be found in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13675/9459&quot;&gt;answer&lt;/a&gt; about expectation value estimation. About why &lt;span class=&quot;math-container&quot;&gt;$HS^{\dagger}$&lt;/span&gt; is applied in the second circuit can be understood from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11791/9459&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-09-26T21:17:29.123" LastActivityDate="2020-09-26T21:17:29.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13925" PostTypeId="1" AcceptedAnswerId="13926" CreationDate="2020-09-27T15:11:08.570" Score="2" ViewCount="67" Body="&lt;p&gt;In the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulating Molecules using VQE&lt;/a&gt; section of the Qiskit textbook it states an accuracy of &lt;span class=&quot;math-container&quot;&gt;$0.0016$&lt;/span&gt; Hartree between the &lt;code&gt;exact&lt;/code&gt; and &lt;code&gt;VQE&lt;/code&gt; results with Hartree energy values of &lt;span class=&quot;math-container&quot;&gt;$-1.86712098$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1.80040360007339$&lt;/span&gt; for the ground state of &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&lt;p&gt;How is &lt;span class=&quot;math-container&quot;&gt;$0.0016$&lt;/span&gt; computed? and is it an error metric similar to absolute error?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2020-09-27T15:29:50.397" Title="How is the Hartree accuracy calculated between the exact and VQE results?" Tags="&lt;qiskit&gt;&lt;mathematics&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13926" PostTypeId="2" ParentId="13925" CreationDate="2020-09-27T15:29:50.397" Score="2" Body="&lt;p&gt;I think you may have misread the section - the document says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So, the VQE result is not within chemical accuracy, but it is fairly close to chemical accuracy.&lt;/p&gt;&#xA;&lt;p&gt;How is this number derived? As stated on &lt;a href=&quot;https://en.wikipedia.org/wiki/Computational_chemistry&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So, if you convert kcals to Hartrees and mols to molecules, you yield about 0.00159 hartrees/molecule, exactly what IBM says.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-09-27T15:29:50.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13927" PostTypeId="2" ParentId="13919" CreationDate="2020-09-27T21:16:02.890" Score="1" Body="&lt;p&gt;To roll up some of the comments thread, initially we can consider letting our state have &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; qubits entangled in one of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bell_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell states&lt;/a&gt; corresponding to a uniform superposition of the positive sum of &lt;span class=&quot;math-container&quot;&gt;$M=2$&lt;/span&gt; of the four &amp;quot;universal set&amp;quot; basis states on &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits, say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\Phi^+\rangle=\frac{1}{\sqrt{2}}(\vert 00\rangle+\vert 11\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Flipping both qubits together brings us to:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(\vert 11\rangle+\vert 00\rangle);$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;i.e. the same state.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively we could consider acting on another Bell state, say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\Phi^-\rangle=\frac{1}{\sqrt{2}}(\vert 00\rangle-\vert 11\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, such a mapping provides:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(\vert 11\rangle-\vert 00\rangle)=-\vert\Phi^-\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is the same up to a global phase.&lt;/p&gt;&#xA;&lt;p&gt;Thus, the bit-flip/&lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CNOT}$&lt;/span&gt; operation(s).&lt;/p&gt;&#xA;&lt;p&gt;The OP's idea of partitioning a superposition into two sets and &amp;quot;flipping between&amp;quot; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no cloning theorem&lt;/a&gt;, which limits the ability to copy unknown states.&lt;/p&gt;&#xA;&lt;p&gt;Another quick way to see the same is to consider a state such as the uniform superposition over &lt;em&gt;all&lt;/em&gt; basis states - there the &amp;quot;complementary&amp;quot; set is null; thus, it would not make sense to flip between two complimentary sets.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-09-27T21:16:02.890" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13928" PostTypeId="1" AcceptedAnswerId="13931" CreationDate="2020-09-27T22:25:11.967" Score="1" ViewCount="75" Body="&lt;p&gt;I've successfully run the &lt;span class=&quot;math-container&quot;&gt;$LiH$&lt;/span&gt; VQE simulation detailed in &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulating Molecules using VQE&lt;/a&gt; using the &lt;code&gt;statevector_simulator&lt;/code&gt;, however when attempting to run the same simulation on the &lt;code&gt;quantum_instance&lt;/code&gt;(detailed in the same section) using the &lt;code&gt;NoiseModel&lt;/code&gt; for &lt;code&gt;ibmq_manhattan&lt;/code&gt; the simulation seems to run indefinitely without yielding results.&lt;/p&gt;&#xA;&lt;p&gt;Is it expected that the &lt;code&gt;quantum_instance&lt;/code&gt; simulation would be significantly longer (&lt;span class=&quot;math-container&quot;&gt;$&amp;gt;100\times$&lt;/span&gt;) than the &lt;code&gt;statevector_simulator&lt;/code&gt; simulation?&lt;/p&gt;&#xA;&lt;p&gt;Note: I'm using the following optimizer and variational form:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;optimizer = SPSA(maxiter=100)&#xA;var_form = EfficientSU2(qubitOp.num_qubits, entanglement=&amp;quot;linear&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-10-05T13:39:14.307" LastActivityDate="2020-10-05T13:39:14.307" Title="Why is local qasm simulation taking so long for VQE?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;textbook-and-exercises&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13929" PostTypeId="1" CreationDate="2020-09-27T22:27:02.263" Score="2" ViewCount="87" Body="&lt;p&gt;Given a superposition of states &amp;quot;B&amp;quot; which is a subset of the suoerposition &amp;quot;A&amp;quot; of all possible states of a set of qbits, is there a quantum operation that produces superposition &lt;span class=&quot;math-container&quot;&gt;$R= B^C$&lt;/span&gt;, the complementary subset of &amp;quot;A&amp;quot;, and in the process necessarily destroys &amp;quot;B&amp;quot;, to avoid violating the no cloning theorem? If not, is there an operation that can produce an &lt;em&gt;approximate&lt;/em&gt; complement &lt;span class=&quot;math-container&quot;&gt;${B^C}(Approx)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="13320" LastEditDate="2020-09-28T01:17:14.703" LastActivityDate="2020-09-28T01:17:14.703" Title="Is there a quantum operation that can transform a superposition of states into its complement?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13930" PostTypeId="1" AcceptedAnswerId="13939" CreationDate="2020-09-27T22:56:01.890" Score="2" ViewCount="51" Body="&lt;p&gt;I was reading a textbook and I encountered this question. I was wondering why we don't consider &lt;span class=&quot;math-container&quot;&gt;$M^\dagger$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$M^{T}$&lt;/span&gt;, so I didn't show this relation, could you please help me to show below relation?&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$M: \mathcal{H}^{\tilde{A}} \rightarrow \mathcal{H}^{B}$&lt;/span&gt; be a linear map and denote its transpose map by &lt;span class=&quot;math-container&quot;&gt;$M^{T}: \mathcal{H}^{\tilde{B}} \rightarrow \mathcal{H}^{A}$&lt;/span&gt;. Show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I \otimes M\left|\phi_{+}^{A \tilde{A}}\right\rangle=M^{T} \otimes I\left|\phi_{+}^{\tilde{B} B}\right\rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\left|\phi_{+}^{\tilde{A} A}\right\rangle:=\sum_{y=1}^{|A|}|y y\rangle^{\tilde{A} A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\phi_{+}^{\tilde{B} B}\right\rangle:=\sum_{y=1}^{|B|}|y y\rangle^{\tilde{B} B}$&lt;/span&gt; and these are maximally entangled states.&lt;/p&gt;&#xA;" OwnerUserId="13340" LastEditorUserId="55" LastEditDate="2020-09-28T17:27:16.257" LastActivityDate="2020-09-28T17:27:16.257" Title="What linear map is needed for acting on a maximally entangled state?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13931" PostTypeId="2" ParentId="13928" CreationDate="2020-09-27T22:57:14.153" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-27T22:57:14.153" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13932" PostTypeId="1" AcceptedAnswerId="13935" CreationDate="2020-09-28T04:09:27.170" Score="4" ViewCount="304" Body="&lt;p&gt;I am looking for a proof that any unitary matrix can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U = e^{-iH}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is some Hamiltonian with bounded norm. That is &lt;span class=&quot;math-container&quot;&gt;$$||H||_{2} = O(1).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-10-05T13:40:06.833" LastActivityDate="2020-10-05T13:40:06.833" Title="Proof that any unitary can be written as $U=e^{-iH}$ with $H$ Hamiltonian with bounded norm" Tags="&lt;complexity-theory&gt;&lt;hamiltonian-simulation&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13933" PostTypeId="1" AcceptedAnswerId="13934" CreationDate="2020-09-28T05:14:11.753" Score="1" ViewCount="112" Body="&lt;p&gt;I have two questions on UCCSD in qiskit, please see the code below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.aqua import QuantumInstance&#xA;def get_qubit_op( atom , basis , map_type ):&#xA;    driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, &#xA;                         charge=0, spin=0, basis=basis)&#xA;    molecule = driver.run()&#xA;    repulsion_energy = molecule.nuclear_repulsion_energy&#xA;    num_particles = molecule.num_alpha + molecule.num_beta&#xA;    num_spin_orbitals = molecule.num_orbitals * 2&#xA;    ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)&#xA;    qubitOp = ferOp.mapping(map_type=map_type, threshold=0.00000001)&#xA;#     qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)&#xA;    shift = repulsion_energy&#xA;    return qubitOp, num_particles, num_spin_orbitals, shift&#xA;atom='H .0 .0 .0; H .0 .0 0.74'&#xA;qubitOp, num_particles, num_spin_orbitals, shift = get_qubit_op( atom , basis = 'sto3g' , map_type = 'parity' )&#xA;num_qubits = qubitOp.num_qubits&#xA;print( 'num_qubits = ' , num_qubits ) &#xA;from qiskit.chemistry.components.initial_states import HartreeFock    &#xA;init_state = HartreeFock( num_spin_orbitals , num_particles , 'parity' , two_qubit_reduction=False )&#xA;# setup the variational form for VQE&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;var_form_vqe = UCCSD(&#xA;        num_orbitals=num_spin_orbitals,&#xA;        num_particles=num_particles,&#xA;        initial_state=init_state,&#xA;        qubit_mapping='parity' , &#xA;        two_qubit_reduction = False&#xA;    )&#xA;print( 'var_form_vqe.num_parameters = ' , var_form_vqe.num_parameters )&#xA;var_form_vqe.construct_circuit([1,1,1]).draw() # Give some random para&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The outputs are (without the plot of the circuit)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;num_qubits =  4&#xA;var_form_vqe.num_parameters =  3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My questions are&lt;/p&gt;&#xA;&lt;p&gt;1.&lt;br /&gt;&#xA;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?&lt;/p&gt;&#xA;&lt;p&gt;2.&#xA;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?&#xA;Many thanks!&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-10-05T13:40:19.327" LastActivityDate="2020-10-05T13:40:19.327" Title="On number of parameters and operators in UCCSD in qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13934" PostTypeId="2" ParentId="13933" CreationDate="2020-09-28T06:14:50.280" Score="1" Body="&lt;p&gt;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 &amp;quot;nature&amp;quot;. What I mean by that is that you also need to consider these conservation rules which leads to the following scenario in your case:&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0 -&amp;gt; 1&#xA;2 -&amp;gt; 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where I use Qiskit's notation in which spin orbitals are ordered block-wise (i.e. first all alpha orbitals, then all beta ones). &lt;strong&gt;If&lt;/strong&gt; the spin was &lt;strong&gt;not&lt;/strong&gt; conserved, then you would also see excitations such as &lt;code&gt;0 -&amp;gt; 3&lt;/code&gt; and &lt;code&gt;1 -&amp;gt; 2&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The double excitations are a little bit simpler in this case because there is only one possibility regardless:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0, 1 -&amp;gt; 2, 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, if the example was more complex, the same reasoning would apply here, too.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;single_excitations&lt;/code&gt; and &lt;code&gt;double_excitations&lt;/code&gt; attributes of the &lt;code&gt;UCCSD&lt;/code&gt; class.&#xA;I am not aware of any &amp;quot;partial&amp;quot; &lt;code&gt;decompose()&lt;/code&gt; functionality which could otherwise provide that you describe above.&lt;/p&gt;&#xA;" OwnerUserId="13342" LastActivityDate="2020-09-28T06:14:50.280" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="13935" PostTypeId="2" ParentId="13932" CreationDate="2020-09-28T06:53:39.673" Score="11" Body="&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a normal matrix, the spectral theorem applies, i.e. we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\sum_n\lambda_n|\lambda_n\rangle\langle\lambda_n|,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_n$&lt;/span&gt; are the eigenvalues, and &lt;span class=&quot;math-container&quot;&gt;$|\lambda_n\rangle$&lt;/span&gt; are the eigenvectors. Moreover, since &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger=I$&lt;/span&gt;, we know that &lt;span class=&quot;math-container&quot;&gt;$|\lambda_n|^2=1$&lt;/span&gt;, and thus we can write &lt;span class=&quot;math-container&quot;&gt;$\lambda_n=e^{-i\theta_n}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\theta_n$&lt;/span&gt; in the range 0 to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_n\theta_n|\lambda_n\rangle\langle\lambda_n|.&#xA;$$&lt;/span&gt;&#xA;Clearly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{-iH}=U.&#xA;$$&lt;/span&gt;&#xA;Also, &lt;span class=&quot;math-container&quot;&gt;$\|H\|_2$&lt;/span&gt; is the maximum singular value of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Since all eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\theta_i$&lt;/span&gt; are positive, this is just the largest of the &lt;span class=&quot;math-container&quot;&gt;$\theta_i$&lt;/span&gt;, which, being less than &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;, is &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-28T06:53:39.673" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13936" PostTypeId="1" AcceptedAnswerId="13940" CreationDate="2020-09-28T06:59:01.107" Score="0" ViewCount="44" Body="&lt;p&gt;In qiskit backends, there is Matrix_product_state.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="10028" LastActivityDate="2020-09-28T13:00:19.130" Title="Information about two algorithms of Matrix product state" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;programming&gt;&lt;density-matrix&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13937" PostTypeId="1" AcceptedAnswerId="13938" CreationDate="2020-09-28T08:38:59.070" Score="1" ViewCount="77" Body="&lt;p&gt;For some reason I get the following error when attempting to find the inverse of the &lt;code&gt;EfficientSU2&lt;/code&gt; VQE variational form:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;TypeError: 'NoneType' object is not reversible&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;My code is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var_form = EfficientSU2(6, entanglement=&amp;quot;linear&amp;quot;)&#xA;var_form_inv = var_form.inverse() # error thrown of this line&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is there a bug in the implementation of the &lt;code&gt;inverse&lt;/code&gt; method? and if so how can I implement a working &lt;code&gt;inverse&lt;/code&gt; function?&lt;/p&gt;&#xA;&lt;p&gt;Note &lt;code&gt;qiskit.__qiskit_version__&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'qiskit-terra': '0.15.2',&#xA; 'qiskit-aer': '0.6.1',&#xA; 'qiskit-ignis': '0.4.0',&#xA; 'qiskit-ibmq-provider': '0.9.0',&#xA; 'qiskit-aqua': '0.7.5',&#xA; 'qiskit': '0.21.0'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-10-05T13:40:37.477" LastActivityDate="2020-10-05T13:40:37.477" Title="Why is circuit inverse not working for EfficientSU2?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13938" PostTypeId="2" ParentId="13937" CreationDate="2020-09-28T09:31:50.510" Score="2" Body="&lt;p&gt;&lt;code&gt;EfficientSU2&lt;/code&gt; is a &lt;code&gt;BlueprintCircuit&lt;/code&gt; and does not populates its internal &lt;code&gt;data&lt;/code&gt; field until you try to access them.&lt;/p&gt;&#xA;&lt;p&gt;In this case, when you are calling the &lt;code&gt;inverse&lt;/code&gt; function the &lt;code&gt;data&lt;/code&gt; are still empty (&lt;code&gt;None&lt;/code&gt;) and this is the error you are getting. It is probably a bug and should be fixed.&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, as a workaround for now you can try:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var_form = EfficientSU2(6, entanglement=&amp;quot;linear&amp;quot;)&#xA;# build the circuit&#xA;var_form._build() &#xA;# or just print it&#xA;print(var_form)&#xA;var_form_inv = var_form.inverse() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-28T09:31:50.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13939" PostTypeId="2" ParentId="13930" CreationDate="2020-09-28T12:04:04.873" Score="2" Body="&lt;p&gt;Both states live in &lt;span class=&quot;math-container&quot;&gt;$ H_A \otimes H_B $&lt;/span&gt;. We will compute their inner product with the basis states &lt;span class=&quot;math-container&quot;&gt;$ |i \rangle_A | j \rangle_B $&lt;/span&gt; and show that they are equal.&#xA;Indeed:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\big(I \otimes M\big) |\phi_+^{AA} \rangle = \sum_{y=1}^{|A|} |y \rangle_A  M|y\rangle_A \implies \\&#xA;\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} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\big(M^T \otimes I\big) |\phi_+^{BB} \rangle = \sum_{y=1}^{|B|} M^T|y \rangle_B  |y\rangle_B \implies \\&#xA;\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} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-09-28T12:04:04.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13940" PostTypeId="2" ParentId="13936" CreationDate="2020-09-28T13:00:19.130" Score="0" Body="&lt;p&gt;The performance issue that you see occurs in the measurements at the end of your circuit. Until then there is only one algorithm.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here is a link to the closed pull request that introduced this conversion: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/pull/808&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/pull/808&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is also an issue that you can track, following your query: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/issues/944&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/issues/944&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-09-28T13:00:19.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13941" PostTypeId="2" ParentId="8923" CreationDate="2020-09-28T16:39:07.063" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;So is there any way to implement a circuit which has a parameter which varies from shot to shot?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Short answer is &amp;quot;no&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;The shots are there to allow probabilistic results. They are not meant to have different parameters.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8923/vary-parameter-between-shots#comment12237_8923&quot;&gt;As suggested&lt;/a&gt;, you could send a job with several circuits (one circuit per parameter selection) in a single experiment.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-09-28T16:39:07.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13942" PostTypeId="1" AcceptedAnswerId="13947" CreationDate="2020-09-28T17:59:28.903" Score="1" ViewCount="96" Body="&lt;p&gt;When running the VQE simulation for &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; over a range of distances as detailed in the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#Running-VQE-on-a-Noisy-Simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulating Molecules using VQE&lt;/a&gt; section of the Qiskit Textbook, the VQE energy deviation from the exact energy increases with distance as shown in the figure below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/w2qOT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w2qOT.png&quot; alt=&quot;H_2 Energy(Hartree ) vs Distance(Angstrom)&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How is this relation(&lt;span class=&quot;math-container&quot;&gt;$Error \propto distance$&lt;/span&gt;) explained and how can it's effects be minimized?&lt;/p&gt;&#xA;&lt;p&gt;My VQE code is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;distances = np.arange(0.2, 5, 0.5) # for a finer exact_energies plot run with step of 0.1&#xA;exact_energies = []&#xA;vqe_energies = []&#xA;&#xA;optimizer = SPSA(maxiter=1000)&#xA;&#xA;for dist in distances:&#xA;    molecule = &amp;quot;H .0 .0 -&amp;quot; + str(dist) + &amp;quot;; H .0 .0 &amp;quot; + str(dist)&#xA;    driver = PySCFDriver(atom = molecule, unit=UnitsType.ANGSTROM, charge=0, spin=0, basis='sto3g')&#xA;    qmolecule = driver.run()&#xA;    num_particles = qmolecule.num_alpha + qmolecule.num_beta&#xA;    qubitOp = FermionicOperator(h1=qmolecule.one_body_integrals, h2=qmolecule.two_body_integrals).mapping(map_type='parity')&#xA;    qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)&#xA;    &#xA;    result = NumPyEigensolver(qubitOp).run()&#xA;    exact_energies.append(np.real(result.eigenvalues))&#xA;    &#xA;    var_form = EfficientSU2(qubitOp.num_qubits, entanglement=&amp;quot;linear&amp;quot;)&#xA;    vqe = VQE(qubitOp, var_form, optimizer)&#xA;    vqe_result = np.real(vqe.run(backend)['eigenvalue'])&#xA;    vqe_energies.append(vqe_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I expected the error to be very low as &lt;code&gt;maxiter = 1000&lt;/code&gt;. Also note the &lt;code&gt;backend&lt;/code&gt; is a &lt;code&gt;statevector_simulator&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-10-05T13:40:44.900" LastActivityDate="2020-10-05T13:40:44.900" Title="Why is there a significant variation between the exact and VQE energy results?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13943" PostTypeId="1" AcceptedAnswerId="14716" CreationDate="2020-09-28T20:48:29.530" Score="4" ViewCount="75" Body="&lt;p&gt;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, &lt;strong&gt;is there an established mapping between these two models of complexity?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have yet to find a precise account of their relationship, but my reading of work by &lt;a href=&quot;https://ieeexplore.ieee.org/document/366852&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yao (1993)&lt;/a&gt; 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)?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;in practice&lt;/em&gt;. While not a mapping, is that a plausible way of connecting the two or are there additional considerations?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2020-10-06T16:43:23.940" LastActivityDate="2020-11-19T07:17:29.453" Title="What is the relationship between quantum circuit and quantum query complexities?" Tags="&lt;complexity-theory&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13944" PostTypeId="1" CreationDate="2020-09-28T22:38:53.957" Score="1" ViewCount="55" Body="&lt;p&gt;Consider an unrealistic 2-qubit plus 1 ancilla bit-flip error correction code (images generated by &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk&lt;/a&gt;), where I know by some means or other that an error may have happen on qubit0 (represented by the octagon)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dGILC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dGILC.png&quot; alt=&quot;2qubitEC&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Now I know that my ancilla MUST be either |0&amp;gt; or |1&amp;gt; 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.:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rwiu5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rwiu5.png&quot; alt=&quot;2qubit classical&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;" OwnerUserId="13347" LastEditorUserId="55" LastEditDate="2020-10-06T04:52:20.493" LastActivityDate="2020-10-06T04:52:20.493" Title="Is there any difference between a quantum- and classically-controlled gate if I know my basis?" Tags="&lt;circuit-construction&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13945" PostTypeId="2" ParentId="13942" CreationDate="2020-09-28T23:12:09.490" Score="1" Body="&lt;p&gt;I managed to resolve the issue; I'm not sure if this applies to the other VQE optimizers(e.g. &lt;code&gt;SLSQP&lt;/code&gt;) but by placing &lt;code&gt;optimizer = SPSA(maxiter=1000)&lt;/code&gt; inside the loop in order to re-initialize for each iteration of distance the issue(i.e. &lt;span class=&quot;math-container&quot;&gt;$Error∝distance$&lt;/span&gt;) is resolved.&lt;/p&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2020-09-28T23:12:09.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13946" PostTypeId="2" ParentId="13944" CreationDate="2020-09-29T01:26:18.997" Score="1" Body="&lt;p&gt;Be cautious using logic like &amp;quot;it must be A or B, both of which imply C, therefore C&amp;quot; when dealing with quantum circuits. It can fail if A, B, or C don't commute (e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/Hardy%27s_paradox&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hardy's paradox&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Personally, I would say the reason the circuit works is because of the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-communication_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no communication theorem&lt;/a&gt; and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Deferred_Measurement_Principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;deferred measurement principle&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-09-29T01:26:18.997" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13947" PostTypeId="2" ParentId="13942" CreationDate="2020-09-29T06:55:27.900" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Note that the electronic Hamiltonian (using Born-Oppenheimer approximation) is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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|}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-29T06:55:27.900" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13948" PostTypeId="1" AcceptedAnswerId="13965" CreationDate="2020-09-29T11:17:26.440" Score="3" ViewCount="135" Body="&lt;p&gt;I have been trying to implement QAOA with classical optimization of the angles &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, but I I'm failing at the classical part.&lt;/p&gt;&#xA;&lt;p&gt;In paper &lt;a href=&quot;https://arxiv.org/pdf/1812.01041.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Approximate Optimization Algorithm: Performance, Mechanism, and Implementation on Near-Term Devices&lt;/a&gt; QAOA works with variational parameters &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;   which are first chosen randomely and afer thar is in a loop of 3 steps.&lt;/p&gt;&#xA;&lt;p&gt;Step1. Simulating  &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$&lt;/span&gt; with the Quantum Computer.&lt;/p&gt;&#xA;&lt;p&gt;Step2. Measure in the Z basis. And getting &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Step3. Use a classical optimizesers to calculate new angles &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&#xA;In the paper it says that &lt;span class=&quot;math-container&quot;&gt;$F_p(\vec{\gamma},\vec{\beta}) = \langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$&lt;/span&gt; is maximized.&lt;br /&gt;&#xA;My Questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How does the measured expectiaon Value from step 2 is involved in the classical optimization?&lt;/li&gt;&#xA;&lt;li&gt;Are the old &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; involved in the classical optimization?&lt;/li&gt;&#xA;&lt;li&gt;Are step 1 and step 2 only done once? Becuase then the measurement in step 2 will be very unreliable.&lt;/li&gt;&#xA;&lt;li&gt;How is the function &lt;span class=&quot;math-container&quot;&gt;$F_p(\vec{\gamma},\vec{\beta}) = \langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$&lt;/span&gt; written classicaly so that a classical optimizer can work with is?&lt;/li&gt;&#xA;&lt;li&gt;Is there a paper where this is explained or programmed?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="12643" LastEditDate="2020-10-02T10:02:17.410" LastActivityDate="2020-10-02T10:02:17.410" Title="How does the classical optimization of the angles $\gamma$ and $\beta$ in QAOA work?" Tags="&lt;programming&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13949" PostTypeId="1" CreationDate="2020-09-29T12:54:28.857" Score="3" ViewCount="81" Body="&lt;p&gt;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?&#xA;&lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.quantiki.org/wiki/list-qc-simulators&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, I'm doing some research on simulation approaches and read some papers, including:&#xA;&lt;a href=&quot;https://arxiv.org/abs/1805.01450&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.01450&lt;/a&gt;,&#xA;&lt;a href=&quot;https://arxiv.org/abs/1802.06952&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1802.06952&lt;/a&gt;,&#xA;and some others. I found that in these papers, they do not use the simulator toolkit in &lt;a href=&quot;https://www.quantiki.org/wiki/list-qc-simulators&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.quantiki.org/wiki/list-qc-simulators&lt;/a&gt;, so I'm wondering which simulator should I follow now?&lt;/p&gt;&#xA;" OwnerUserId="11765" LastEditorUserId="55" LastEditDate="2020-10-08T17:54:04.313" LastActivityDate="2020-10-08T17:54:04.313" Title="What is the best approach for classically simulating quantum devices?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13950" PostTypeId="2" ParentId="13949" CreationDate="2020-09-29T14:30:38.807" Score="2" Body="&lt;p&gt;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.&#xA;The latter I would go for qiskit or cirq.&lt;/p&gt;&#xA;&lt;p&gt;But if you just want to go for a fast simulation there might be an advantage in C or C++.&#xA;In general you can test the runtimes quite good by for example simulating the Q-FT in the different simulators.&lt;/p&gt;&#xA;" OwnerUserId="13353" LastActivityDate="2020-09-29T14:30:38.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13951" PostTypeId="1" CreationDate="2020-09-29T15:43:35.940" Score="0" ViewCount="57" Body="&lt;p&gt;I've been running VQE experiments locally using both the &lt;code&gt;statevector_simulator&lt;/code&gt; and &lt;code&gt;qasm_simulator&lt;/code&gt;, however I've noticed that the runtimes for the &lt;code&gt;qasm_simulator&lt;/code&gt; are significantly longer than that of &lt;code&gt;statevector_simulator&lt;/code&gt;. According to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13931/12248&quot;&gt;this answer&lt;/a&gt; the &lt;code&gt;statevector_simulator&lt;/code&gt; produces ideal/deterministic results, whereas &lt;code&gt;qasm_simulator&lt;/code&gt; produces non-ideal/probabilistic results. However I don't see why the simulation times should differ significantly(&lt;span class=&quot;math-container&quot;&gt;$&amp;gt;\times 100$&lt;/span&gt;) if the number of &lt;code&gt;shots=1&lt;/code&gt; for the &lt;code&gt;qasm_simulator&lt;/code&gt; even if a &lt;code&gt;NoiseModel&lt;/code&gt; or &lt;code&gt;measurement_error_mitigation_cls=CompleteMeasFitter&lt;/code&gt; is used.&lt;/p&gt;&#xA;&lt;p&gt;Is this in fact expected and how is it explained?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastActivityDate="2021-02-26T17:08:05.760" Title="Why is the local qasm_simulator significantly slower than the statevector_simulator?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13952" PostTypeId="2" ParentId="13949" CreationDate="2020-09-29T16:19:00.600" Score="3" Body="&lt;p&gt;The best simulator depends heavily on the structure of the circuit you are working with.&lt;/p&gt;&#xA;&lt;p&gt;In the &lt;a href=&quot;https://arxiv.org/abs/1910.11333&quot; rel=&quot;nofollow noreferrer&quot;&gt;supremacy experiment&lt;/a&gt; we used &lt;a href=&quot;https://github.com/quantumlib/qsim&quot; rel=&quot;nofollow noreferrer&quot;&gt;qsim&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;We also used &lt;a href=&quot;https://github.com/quantumlib/qsim&quot; rel=&quot;nofollow noreferrer&quot;&gt;qsimh&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-09-29T16:19:00.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13953" PostTypeId="2" ParentId="13951" CreationDate="2020-09-29T17:03:58.393" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Now in term of add noise model and doing measurement_error_mitigation. To be able to do this, you need to generate &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-09-29T17:03:58.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13954" PostTypeId="2" ParentId="13893" CreationDate="2020-09-29T17:52:41.807" Score="1" Body="&lt;p&gt;This seems to be a bug on the &lt;code&gt;Circuit_state_fn&lt;/code&gt;. I added a Issue on the aqua github repo: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/issues/1276&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/issues/1276&lt;/a&gt;, thus in order to solve the problem you should pass the if statement on circuit_state_fn.py:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if not np.all(np.abs(statevector) == statevector):&#xA;            # TODO maybe switch to Isometry?&#xA;            raise ValueError('Qiskit circuit Initializer cannot handle non-positive statevectors.')   &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12095" LastActivityDate="2020-09-29T17:52:41.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13955" PostTypeId="1" CreationDate="2020-09-29T20:06:35.823" Score="1" ViewCount="121" Body="&lt;p&gt;The &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.VQE.run.html#qiskit.aqua.algorithms.VQE.run&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE.run&lt;/a&gt; method only takes a &lt;code&gt;quantum_instance&lt;/code&gt; of type &lt;code&gt;QuantumInstance&lt;/code&gt; or &lt;code&gt;BaseBackend&lt;/code&gt; and &lt;strong&gt;NOT&lt;/strong&gt; &lt;code&gt;IBMQBackend&lt;/code&gt;. How then can I run VQE experiments on actual IBMQ Backends rather than just locally using a &lt;code&gt;qasm_simulator&lt;/code&gt; with the &lt;code&gt;NoiseModel&lt;/code&gt; of an &lt;code&gt;IBMQBackend&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-10-02T14:10:28.310" LastActivityDate="2020-10-02T14:10:28.310" Title="How to run VQE experiments on IBMQ Backends?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13956" PostTypeId="1" CreationDate="2020-09-29T20:45:45.047" Score="1" ViewCount="104" Body="&lt;p&gt;I have been running VQE experiments locally using the &lt;code&gt;qasm_simulator&lt;/code&gt; with actual IBMQBackend NoiseModels as shown in the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#Running-VQE-on-a-Noisy-Simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Textbook&lt;/a&gt;. I have noticed that the simulation runtimes for certain backends(e.g. &lt;code&gt;ibmq_vigo&lt;/code&gt; - 5 qubits/&lt;code&gt;ibmq_rome&lt;/code&gt; - 5 qubits) are significantly faster than others which in fact seem to run indefinitely and do not finish executing(e.g. &lt;code&gt;ibmq_manhattan&lt;/code&gt; - 65 qubits/&lt;code&gt;ibmq_montreal&lt;/code&gt; - 27 qubits).&lt;/p&gt;&#xA;&lt;p&gt;Noting that I am running the same VQE experiments on all 4 &lt;code&gt;NoiseModel&lt;/code&gt;s I do not understand why this extreme simulation runtime variation exists.&lt;/p&gt;&#xA;&lt;p&gt;How is this explained? and if not immediately resolvable would using the NoiseModel for &lt;code&gt;ibmq_vigo&lt;/code&gt; in tandem with the coupling map of say &lt;code&gt;ibmq_manhattan&lt;/code&gt; in the case that the desired VQE variational form exceeds 5 qubits(i.e. the number of qubit on &lt;code&gt;ibmq_vigo&lt;/code&gt;) - e.g. VQE on &lt;span class=&quot;math-container&quot;&gt;$BeH_2$&lt;/span&gt; - result in faster execution?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="12248" LastEditDate="2020-10-03T11:51:00.647" LastActivityDate="2021-03-07T00:07:40.790" Title="Why do the qasm_simulator runtimes vary significantly for different IBMQ CouplingMap/NoiseModels?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13957" PostTypeId="2" ParentId="13955" CreationDate="2020-09-29T22:04:52.510" Score="1" Body="&lt;p&gt;&lt;code&gt;BaseBackend&lt;/code&gt; is the abstract base class all backend classes inherit from, so &lt;code&gt;IBMQBackend&lt;/code&gt; &lt;em&gt;is&lt;/em&gt; actually a &lt;code&gt;BaseBackend&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-09-29T22:04:52.510" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13958" PostTypeId="1" AcceptedAnswerId="13964" CreationDate="2020-09-30T00:19:52.487" Score="6" ViewCount="184" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}\{\ket{u_k}\}_k,\{\ket{v_k}\}_k\subset\mathcal H$&lt;/span&gt; be orthonormal bases in an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional space. It then follows that the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\ket\Psi = C\sum_{k=1}^N \ket{u_k}\otimes\ket{v_k}\tag1$$&lt;/span&gt;&#xA;is maximally entangled (where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is a normalisation constant).&#xA;Or more generally, it means that &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; has rank &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; (which if the embedding space is larger does not correspond to a maximally entangled state).&lt;/p&gt;&#xA;&lt;p&gt;Does the opposite direction hold? In other words, if we know that a state &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; is maximally entangled and can be written as (1), can we conclude that &lt;span class=&quot;math-container&quot;&gt;$\langle u_j|u_k\rangle=\langle v_j|v_k\rangle=\delta_{jk}$&lt;/span&gt;?&#xA;Equivalently, suppose &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; has the form in (1) with &lt;span class=&quot;math-container&quot;&gt;$\{\ket{u_k}\}_k,\{\ket{v_k}\}_k$&lt;/span&gt; &lt;em&gt;not&lt;/em&gt; orthogonal. Can &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; then be maximally entangled?&lt;/p&gt;&#xA;&lt;p&gt;More generally, suppose &lt;span class=&quot;math-container&quot;&gt;$\dim\mathcal H=M$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M&amp;gt;N$&lt;/span&gt; (the vectors are not a basis). If &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; is as in (1), can it have rank &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; even if &lt;span class=&quot;math-container&quot;&gt;$\{\ket{u_k}\}_k,\{\ket{v_k}\}_k$&lt;/span&gt; are not orthogonal?&lt;/p&gt;&#xA;&lt;p&gt;For example, in the simplest case with &lt;span class=&quot;math-container&quot;&gt;$M=2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N&amp;gt;M$&lt;/span&gt;, the question is whether a state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&#xA;can be maximally entangled (or more precisely, have Schmidt coefficients &lt;span class=&quot;math-container&quot;&gt;$(1/\sqrt2,1/\sqrt2,0,...,0)$&lt;/span&gt;) even if &lt;span class=&quot;math-container&quot;&gt;$\langle u_1|u_2\rangle,\langle v_1|v_2\rangle\neq0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I'll show here that it is crucial that &lt;em&gt;both&lt;/em&gt; bases are non-orthogonal for this to be possible.&lt;/p&gt;&#xA;&lt;p&gt;If only one of the two sets, say &lt;span class=&quot;math-container&quot;&gt;$\{\ket{v_k}\}_k$&lt;/span&gt;, is orthonormal, then the matrix of coefficients of &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt;, write it with &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;, has the form &lt;span class=&quot;math-container&quot;&gt;$\Psi = U \sqrt D V^T$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U,V$&lt;/span&gt; are the matrices whose columns equal &lt;span class=&quot;math-container&quot;&gt;$\ket{u_k}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{v_k}$&lt;/span&gt;, respectively, and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is diagonal. The orthonormality of &lt;span class=&quot;math-container&quot;&gt;$\{\ket{v_k}\}_k$&lt;/span&gt; (and thus of &lt;span class=&quot;math-container&quot;&gt;$\{\ket{\bar v_k}\}_k$&lt;/span&gt;) then implies that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Psi\Psi^\dagger = UDU^\dagger,$$&lt;/span&gt;&#xA;which tells us that the Schmidt coefficients of &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; majorize the diagonal of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{D}$&lt;/span&gt;. E.g. if &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is a multiple of the identity then &lt;span class=&quot;math-container&quot;&gt;$\Psi\Psi^\dagger \simeq UU^\dagger\neq I$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; maximally entangled.&lt;/p&gt;&#xA;&lt;p&gt;This would seem to suggest that, if at least one of the bases is orthonormal, then indeed &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; is maximally entangled only if the other basis is also orthonormal.&#xA;But this still leaves open the possibility of it being possible when both bases are not orthonormal.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Here is an example of a pair of non-orthogonal states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\psi\psi\rangle+|\phi\phi\rangle$&lt;/span&gt; has rank 2. Define&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;2\sqrt2 \ket\psi &amp;amp;= \ket1 + (2+i)\ket2 - \ket3 + i \ket4, \\&#xA;2\sqrt2 \ket\phi &amp;amp;= \ket1 + i\ket2 + (1-2i)\ket3 - i \ket4.&#xA;\end{align}&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi\equiv (\ket{\psi\psi}+\ket{\phi\phi})/\sqrt{3/2}$&lt;/span&gt;.&#xA;You can then verify that the corresponding matrix of coefficients is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$C = \frac{1}{2\sqrt{6}}\begin{pmatrix}&#xA;  1 &amp;amp; 1+i &amp;amp; -i &amp;amp; 0 \\&#xA;  1+i &amp;amp; 1+2 i &amp;amp; 0 &amp;amp; i \\&#xA;  -i &amp;amp; 0 &amp;amp; -1-2 i &amp;amp; -1-i \\&#xA;  0 &amp;amp; i &amp;amp; -1-i &amp;amp; -1&#xA;\end{pmatrix}.$$&lt;/span&gt;&#xA;As can be readily checked, the only non-vanishing eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$C^\dagger C$&lt;/span&gt; is a two-fold degenerate &lt;span class=&quot;math-container&quot;&gt;$+1/2$&lt;/span&gt;, hence &lt;span class=&quot;math-container&quot;&gt;$\ket\Psi$&lt;/span&gt; has rank &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It's possible that this is only possible because the states live in a larger space, &lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$M=4$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;. I'm wondering if there is a good way to understand why this can happen, and if it possible also when &lt;span class=&quot;math-container&quot;&gt;$N=M$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-10-01T14:00:46.507" LastActivityDate="2020-10-02T11:00:19.517" Title="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?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13959" PostTypeId="2" ParentId="13955" CreationDate="2020-09-30T05:06:01.407" Score="0" Body="&lt;p&gt;Please find here a code for using IBM Q backend for VQE.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note that the code was tested in IBM Quatum Lab at IBM Q website.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account() #your IBM Q account&#xA;backend = provider.backends(name = 'ibmq_ourense')[0] #getting IBM Q Backend&#xA;&#xA;#connect IBM backend to VQE&#xA;vqe_solver = MinimumEigenOptimizer(VQE(quantum_instance = backend))&#xA;&#xA;#solve a problem (qubo is variable with QUBO problem which construction is not a part of this code)&#xA;vqe_results = vqe_solver.solve(qubo) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-09-30T05:06:01.407" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13961" PostTypeId="1" CreationDate="2020-09-30T07:57:56.620" Score="1" ViewCount="64" Body="&lt;p&gt;I wish to initalise the state &lt;span class=&quot;math-container&quot;&gt;$\rho=(1-\frac{p}{2})|0\rangle \langle0|+\frac{p}{2}|1\rangle\langle1|$&lt;/span&gt;, 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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;r=random.choices([0,1],weights=(1-p/2,p/2),k=1)&#xA;    r.append((r[0]+1)%2)&#xA;    circuit2 = QuantumCircuit(3,3);&#xA;    circuit2.initialize(r,0)&#xA;    circuit2.initialize(r,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-02T14:11:02.077" LastActivityDate="2020-10-02T14:11:02.077" Title="Initialising impure density matrices" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13962" PostTypeId="2" ParentId="13961" CreationDate="2020-09-30T08:04:19.600" Score="2" Body="&lt;p&gt;Why do you need 6 ancilla qubits? Surely you'd just produce the two-qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{1-p/2}|00\rangle+\sqrt{p/2}|11\rangle&#xA;$$&lt;/span&gt;&#xA;by starting with two qubits in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, performing a single qubit unitary that maps &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\rightarrow \sqrt{1-p/2}|0\rangle+\sqrt{p/2}|1\rangle$&lt;/span&gt; (this is a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-09-30T08:21:15.127" LastActivityDate="2020-09-30T08:21:15.127" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13963" PostTypeId="2" ParentId="13958" CreationDate="2020-09-30T08:47:28.703" Score="3" Body="&lt;p&gt;Some thoughts; I am not &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; sure yet and will revisit:&lt;/p&gt;&#xA;&lt;p&gt;A bi-partite (pure) state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle \in \mathcal{H}_{A} \otimes \mathcal{H}_{B}$&lt;/span&gt; is &lt;em&gt;maximally entangled&lt;/em&gt; if the reduced state in either &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{A}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{B}$&lt;/span&gt; is the maximally mixed state.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we have a state&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\hat{\Psi}\rangle = C \sum_{k=1}^{N}|u_{k}\rangle \otimes |v_{k}\rangle,&#xA;\end{equation}&lt;/span&gt;&#xA;where  &lt;span class=&quot;math-container&quot;&gt;$\{|u_{k}\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|v_{k}\rangle\}$&lt;/span&gt; may or may not be orthonormal. Lets assume that they are at least normalized.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, let &lt;span class=&quot;math-container&quot;&gt;$\{|a_{j}\rangle\}$&lt;/span&gt; be an &lt;em&gt;orthonormal&lt;/em&gt; basis for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{A}$&lt;/span&gt;.&#xA;The reduced state &lt;span class=&quot;math-container&quot;&gt;$\rho_{B} = \mathrm{tr}_{A}\big[|\hat{\Psi}\rangle\langle \hat{\Psi}|\big]$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{B}$&lt;/span&gt; is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\rho_{B} &amp;amp;= \sum_{j} \big(\langle{a_{j}}|\otimes I \big) |\hat{\Psi}\rangle\langle \hat{\Psi}| \big(|{a_{j}}\rangle\otimes I \big) \\&#xA;&amp;amp;= |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'}| \\&#xA;&amp;amp;= |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'}| \\&#xA;&amp;amp;= |C|^{2}\sum_{k}\sum_{k'}  \langle u_{k'}| I |u_{k}\rangle  |v_{k}\rangle\langle v_{k'}|. \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;If we put the &lt;span class=&quot;math-container&quot;&gt;$\{|u_{k}\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|v_{k}\rangle\}$&lt;/span&gt; in matrices &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;U &amp;amp;= \begin{bmatrix}|u_{1}\rangle &amp;amp; |u_{2}\rangle \cdots |u_{n}\rangle\end{bmatrix} \\&#xA;V &amp;amp;= \begin{bmatrix}|v_{1}\rangle &amp;amp; |v_{2}\rangle \cdots |v_{n}\rangle\end{bmatrix}&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;we get for:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U^{\dagger}U = \begin{bmatrix} \langle u_{1}|u_{1}\rangle &amp;amp; \cdots &amp;amp; \langle u_{1}|u_{n}\rangle \\ . &amp;amp; \ddots &amp;amp; . \\ &#xA;\langle u_{n}|u_{1}\rangle &amp;amp; \cdots &amp;amp; \langle u_{n}|u_{n}\rangle \\\end{bmatrix} = I + \hat{D}_{U}&#xA;\end{equation}&lt;/span&gt;&#xA;for some off-diagonal (Hermitian, likely sparse) matrix &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}$&lt;/span&gt;. We can do the same for &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, getting &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{V}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That allows us to write for &lt;span class=&quot;math-container&quot;&gt;$\rho_{B}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{split}&#xA;\rho_{B} &amp;amp;= |C|^{2}\sum_{k}\sum_{k'}  \langle u_{k'} |u_{k}\rangle  |v_{k}\rangle\langle v_{k'}|\\&#xA;&amp;amp;= |C|^{2}\sum_{k}\sum_{k'}    |v_{k}\rangle \langle u_{k'} |u_{k}\rangle \langle v_{k'}|\\&#xA;&amp;amp;=   |C|^{2}VU^{\dagger}UV^{\dagger} \\&#xA;\end{split}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The question is now when this is or is not equal to the maximally mixed state i.e. &lt;span class=&quot;math-container&quot;&gt;$|C|I$&lt;/span&gt; (note that the normalisation factor is different because we're in a smaller space!). We know, since &lt;span class=&quot;math-container&quot;&gt;$\{|u_{k}\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|v_{k}\rangle\}$&lt;/span&gt; are in fact bases, both &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; are invertible, such that &lt;span class=&quot;math-container&quot;&gt;$\rho_{B} = |C|^{2}VU^{\dagger}UV^{\dagger}= |C|I$&lt;/span&gt; implies that:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U^{\dagger} U = V^{-1} (V^{\dagger})^{-1} = (V^{\dagger}V)^{-1}&#xA;\end{equation}&lt;/span&gt;&#xA;up to some normalisation factor.&#xA;Lets investigate the three (without loss of generality) options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;The bases &lt;span class=&quot;math-container&quot;&gt;$\{|u_{k}\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|v_{k}\rangle\}$&lt;/span&gt; are orthonormal.&#xA;Then, &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U = V^{\dagger}V = I$&lt;/span&gt; and the state is maximally entangled, as expected.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\{|u_{k}\rangle\}$&lt;/span&gt; is, but &lt;span class=&quot;math-container&quot;&gt;$\{|v_{k}\rangle\}$&lt;/span&gt; isn't orthonormal.&#xA;Then, &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U = I \not = V^{\dagger}V$&lt;/span&gt;. This shows that if only &lt;em&gt;one&lt;/em&gt; of the bases is orthonormal, the state cannot be maximally entangled.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Both &lt;span class=&quot;math-container&quot;&gt;$\{|u_{k}\rangle\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|v_{k}\rangle\}$&lt;/span&gt; aren't orthonormal. Then, &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U,V^{\dagger}V \not = I $&lt;/span&gt;. The state might still be maximally entangled, as long as &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U$&lt;/span&gt; is the inverse of &lt;span class=&quot;math-container&quot;&gt;$V^{\dagger}V$&lt;/span&gt;, or in other words: &lt;span class=&quot;math-container&quot;&gt;$|C|U^{\dagger}UV^{\dagger}V = I$&lt;/span&gt;.&#xA;We can say a little more:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;I &amp;amp;= |C|U^{\dagger}UV^{\dagger}V\\&#xA;&amp;amp;= |C|(I + \hat{D}_{U})(I + \hat{D}_{V}) \\&#xA;&amp;amp;= |C|I +  |C|\hat{D}_{U} + |C|\hat{D}_{V} + |C|\hat{D}_{U}\hat{D}_{V} \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;Both &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{V}$&lt;/span&gt; are purely anti-diagonal, which means that their product &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}\hat{D}_{V}$&lt;/span&gt; has diagonal elements that are equal to &lt;span class=&quot;math-container&quot;&gt;$1-|C|$&lt;/span&gt;. The off-diagonal terms need to cancel out; in higher dimensions this could get messy.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Some extra thoughts about the bi-partite case&lt;/h2&gt;&#xA;&lt;p&gt;For a bi-partite state (and thus &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}\hat{D}_{V}$&lt;/span&gt; purely diagonal) we get that &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U} = -\hat{D}_{V}$&lt;/span&gt;, which means that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle u_{1}|u_{2}\rangle = - \langle v_{1}|v_{2}\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Moreover, for the bi-partite state we also get &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}I = I + \hat{D}_{U}\hat{D}_{V}$&lt;/span&gt; so that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}\hat{D}_{V} = -\frac{1}{2}I$&lt;/span&gt; which leads to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can combine this to say that &lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;. This puts quite strong constraints on the bases.&#xA;Essentially, the bases provided by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13964/8141&quot;&gt;Daftwullies answer&lt;/a&gt; seem to be (up to permutations and some extra phases) the only ones.&lt;/p&gt;&#xA;&lt;h2&gt;An example after &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13964/8141&quot;&gt;Daftwullies answer&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;The relation &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}UV^{\dagger}V = I$&lt;/span&gt; can very well be met even if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; are not unitary; we have (for the bases Daftwullie came up with):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;U &amp;amp;= \begin{bmatrix} \sqrt{2} &amp;amp; 1 \\ 0 &amp;amp; 1&#xA;\end{bmatrix} \\&#xA;V &amp;amp;= \begin{bmatrix} \sqrt{2} &amp;amp; -1 \\ 0 &amp;amp; -1&#xA;\end{bmatrix} \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which can be readily checked to obey &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U V^{\dagger}V = I$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;U^{\dagger}UV^{\dagger}V &amp;amp;= \begin{bmatrix} \sqrt{2} &amp;amp; 0 \\ 1 &amp;amp; 1&#xA;\end{bmatrix} \begin{bmatrix} \sqrt{2} &amp;amp; 1 \\ 0 &amp;amp; 1&#xA;\end{bmatrix} \begin{bmatrix} \sqrt{2} &amp;amp; 0 \\ -1 &amp;amp; -1&#xA;\end{bmatrix} \begin{bmatrix} \sqrt{2} &amp;amp; -1 \\ 0 &amp;amp; -1&#xA;\end{bmatrix} \\&#xA;&amp;amp;= \begin{bmatrix} 2 &amp;amp; \sqrt{2} \\ \sqrt{2} &amp;amp; 2&#xA;\end{bmatrix}  \begin{bmatrix} 2 &amp;amp; -\sqrt{2} \\ -\sqrt{2} &amp;amp; 2&#xA;\end{bmatrix}  \\&#xA;&amp;amp;\sim I&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The states also obey the above equations for the inner products in the bi-partite case.&lt;/p&gt;&#xA;&lt;h2&gt;Old incorrect analysis&lt;/h2&gt;&#xA;&lt;p&gt;Now I first wrote the text below, but this is actually incorrect. After the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13964/8141&quot;&gt;answer of DaftWullie&lt;/a&gt; it became clear that there actually &lt;em&gt;are&lt;/em&gt; examples of this. My error in the below derivation is that the Frobenius inner product &lt;span class=&quot;math-container&quot;&gt;$2\langle VV^{\dagger}, V\hat{D}_{U}V^{\dagger}\rangle$&lt;/span&gt; does &lt;strong&gt;not&lt;/strong&gt; bear a square, and can therefore be negative. That means that the inequality actually does not hold.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I don't actually think that this is possible under the assumption that&#xA;all states need to be normalized. (which means, if you recall, that&#xA;&lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U = I + \hat{D}_{U}$&lt;/span&gt; with that identity being, well, the&#xA;identity).&lt;/p&gt;&#xA;&lt;p&gt;We already had &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U = I + \hat{D}_{U}$&lt;/span&gt;, so that (using the&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Frobenius_inner_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Frobenius norm&lt;/a&gt;): &lt;span class=&quot;math-container&quot;&gt;$$||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},$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\langle I, \hat{D}_{U}\rangle_{F}$&lt;/span&gt; is the Frobenius inner product, which is zero&#xA;here because &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}$&lt;/span&gt; is by definition traceless. Moreover, the&#xA;inequality becomes strict when &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}$&lt;/span&gt; is non-empty and&#xA;therefore &lt;span class=&quot;math-container&quot;&gt;$||\hat{D}_{U}|| &amp;gt; 0$&lt;/span&gt; (the Frobenius norm &lt;em&gt;is&lt;/em&gt; a norm). This&#xA;is only true if the basis encoded in &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is non-orthogonal.&lt;/p&gt;&#xA;&lt;p&gt;For our relation &lt;span class=&quot;math-container&quot;&gt;$\rho_{B} = I = VU^{\dagger}UV^{\dagger} = V(I +&#xA;&amp;gt; \hat{D}_{U})V^{\dagger} = VV^{\dagger} + V\hat{D}_{U}V^{\dagger}$&lt;/span&gt;, we&#xA;get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} \begin{split} ||I||^{2} &amp;amp;= ||VU^{\dagger}UV^{\dagger}||^{2} = ||VV^{\dagger} + V\hat{D}_{U}V^{\dagger}||^{2} \\ &amp;amp;= ||VV^{\dagger}||^{2} + ||V\hat{D}_{U}V^{\dagger}||^{2} + 2\langle VV^{\dagger},V\hat{D}_{U}V^{\dagger}\rangle \\ &amp;amp;\geq ||VV^{\dagger}||^{2} +&#xA; ||V\hat{D}_{U}V^{\dagger}||^{2} \\ &amp;amp; = ||I ||^{2} + ||&#xA; \hat{D}_{V}||^{2} + ||V\hat{D}_{U}V^{\dagger}||^{2} \\ &amp;amp; \geq ||I&#xA; ||^{2} + ||V\hat{D}_{U}V^{\dagger}||^{2} \\ \end{split} \end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with the second bound only an equality if &lt;span class=&quot;math-container&quot;&gt;$||\hat{D}_{V}|| = 0$&lt;/span&gt;, which&#xA;is &lt;strong&gt;not&lt;/strong&gt; the case if the basis encoded in &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is not orthogonal. So&#xA;in that case we have &lt;span class=&quot;math-container&quot;&gt;$||I||^{2} \geq ||I||^{2} + || \hat{D}_{V}||^{2}&#xA;&amp;gt; + ||V\hat{D}_{U}V^{\dagger}||^{2} &amp;gt; ||I||^{2}$&lt;/span&gt;, which is a contradiction. We have to conclude that &lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{V}$&lt;/span&gt;, and conversely&#xA;&lt;span class=&quot;math-container&quot;&gt;$\hat{D}_{U}$&lt;/span&gt; are zero, which means that the bases must be orthogonal.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-10-02T11:00:19.517" LastActivityDate="2020-10-02T11:00:19.517" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="13964" PostTypeId="2" ParentId="13958" CreationDate="2020-09-30T09:42:27.107" Score="6" Body="&lt;p&gt;To my surprise, your statement is not true. Consider the qubit example:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=|00\rangle-|++\rangle.&#xA;$$&lt;/span&gt;&#xA;This is clearly of the correct form but with non-orthogonal states (in case you're worrying about the negative sign, we put &lt;span class=&quot;math-container&quot;&gt;$|u_2\rangle=|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v_2\rangle=-|+\rangle$&lt;/span&gt;). However, it is maximally entangled. To see this, we expand it out:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\frac12\left(|00\rangle-|01\rangle-|10\rangle-|11\rangle\right)=\frac{1}{\sqrt{2}}(|0-\rangle+|1+\rangle),&#xA;$$&lt;/span&gt;&#xA;which is equivalent under local unitaries (Hadamard on the second qubit) to the Bell state, and hence maximally entangled.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-10-02T08:33:06.177" LastActivityDate="2020-10-02T08:33:06.177" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13965" PostTypeId="2" ParentId="13948" CreationDate="2020-09-30T10:54:21.760" Score="4" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Depending on the optimizer if it needs them to update the parameters.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You seem confused between the simulation and measurement part. &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is not written. As said in 3, you estimate it. The optimizer uses that information in its optimization process.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There are many tutorials on many platforms such as &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/qaoa.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt; or &lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_qaoa_maxcut.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pennylane&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-09-30T10:54:21.760" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13966" PostTypeId="2" ParentId="13912" CreationDate="2020-09-30T13:06:34.467" Score="0" Body="&lt;p&gt;I am not sure if this anwers your question but I think this all boils down to whether one can we efficiently implement &lt;span class=&quot;math-container&quot;&gt;$QFT_{\mathbb{Z}_N}$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is not a power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. In this case we can no longer implement the &lt;span class=&quot;math-container&quot;&gt;$QFT$&lt;/span&gt; using the standard gate construction one sees often. However, for any &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; we can approximately implement &lt;span class=&quot;math-container&quot;&gt;$QFT_{\mathbb{Z}_N}$&lt;/span&gt; using the following trick (from section 4.4 of Andrew Childs notes).&lt;/p&gt;&#xA;&lt;p&gt;Recall that &lt;span class=&quot;math-container&quot;&gt;$$F_N:=\frac{1}{\sqrt{N}}\sum_{x,y\in Z_N}\omega_N^{xy} |y\rangle \langle x|$$&lt;/span&gt; is the QFT for &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_N$&lt;/span&gt;. Now, introduce the cyclic shift operator &lt;span class=&quot;math-container&quot;&gt;$$U:=\sum_{x\in Z_n} |{x+1}\rangle\langle x|,$$&lt;/span&gt; and note that the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are the basis for the the &lt;span class=&quot;math-container&quot;&gt;$QFT$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$$F^*_NUF_N=\sum_{x\in \mathbb{Z}_N} (\omega^{x}_N)^{-1}|x\rangle\langle x|.$$&lt;/span&gt; Then running phase estimation with on the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n=O(\log N)$&lt;/span&gt; qubits performs the transformation &lt;span class=&quot;math-container&quot;&gt;$$|\tilde{x}\rangle |0\rangle \mapsto |\tilde{x}\rangle |\widetilde{(\omega^{x}_N)^{-1}}\rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\tilde{x}\rangle$&lt;/span&gt; is an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\widetilde{(\omega^{x}_N)^{-1}}$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit approximation of the eigenvalue corresponding to &lt;span class=&quot;math-container&quot;&gt;$|\tilde{x}\rangle$&lt;/span&gt;. Now observe that if we run the circuit in reverse, we can effectively remove the undesired phase from the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, leaving us with the same states that would be output by the transformation &lt;span class=&quot;math-container&quot;&gt;$F_N$&lt;/span&gt;. Because the phase estimation algorithm is efficient i.e. &lt;span class=&quot;math-container&quot;&gt;$O(poly(n))$&lt;/span&gt;, it follows that this method is efficient with complexity &lt;span class=&quot;math-container&quot;&gt;$O(poly(\log N))$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-09-30T17:06:06.250" LastActivityDate="2020-09-30T17:06:06.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13967" PostTypeId="1" CreationDate="2020-09-30T13:24:02.130" Score="1" ViewCount="54" Body="&lt;p&gt;I am bit confused with calculating the overall state of a quantum gate and the individual wire states.&lt;/p&gt;&#xA;&lt;p&gt;For example, lets say there are two Qubits, where Q1 is in &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(\vert 0\rangle + \vert 1\rangle)$&lt;/span&gt; state and Q2 is in &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; state. Then we have CNOT gate controlled by Q1 on Q2 followed by a Hadamard gate at the Q1 gate.&lt;/p&gt;&#xA;&lt;p&gt;Just after the CNOT gate the total state of the system is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(\vert 00\rangle+\vert 11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then applying the Hadamard gate gives us: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(\vert 00\rangle+\vert 10\rangle+ \vert 01\rangle - \vert 11\rangle)$&lt;/span&gt;. As you can see, we get four possibilities of states.&lt;/p&gt;&#xA;&lt;p&gt;What if I perform the calculations on individual wires? i.e.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We perform Hadamard on the first Q1 bit, &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(\vert 0\rangle + \vert 1\rangle)$&lt;/span&gt; state which gives us &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; state&lt;/li&gt;&#xA;&lt;li&gt;Then for the Q2, apply CNOT which gives &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Then we calculate the overall state which is &lt;span class=&quot;math-container&quot;&gt;$\vert 00\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="13294" LastEditorUserId="5669" LastEditDate="2020-10-01T08:15:45.517" LastActivityDate="2020-10-01T08:15:45.517" Title="Calculation of the system states and the individual wire states in a quantum circuit" Tags="&lt;quantum-gate&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13968" PostTypeId="2" ParentId="13967" CreationDate="2020-09-30T13:43:46.960" Score="1" Body="&lt;p&gt;You cannot do this. I don't quite understand how you think step 1 reduces from &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-09-30T13:43:46.960" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13969" PostTypeId="1" CreationDate="2020-09-30T14:15:48.007" Score="2" ViewCount="93" Body="&lt;p&gt;I tried to implement an extended Heisenberg-Hamiltonian as an extra exercise further than my homework.&lt;/p&gt;&#xA;&lt;p&gt;My Hamiltonian is the following: &lt;span class=&quot;math-container&quot;&gt;$H = \sum_{NN} \sigma_x\sigma_x + \sigma_z\sigma_z$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I try to implement this in Cirq on a GridQubit-square with 4 qubits.&lt;/p&gt;&#xA;&lt;p&gt;Following problem:&#xA;I calculated the ground state via the matrices analytically and tried to implement the problem in a circuit:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I used cirq.XXPow- Gates and cirq.ZZPow Gates and cirq.XPow, cirq.ZPow.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;li&gt;Now I let the simulator run and get the probabilities and signs from the histograms. I sum the probabilities times the sign.&lt;/li&gt;&#xA;&lt;li&gt;Now I sum the expectation values in X-, Y- and Z-basis and use a classical optimizer.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;My problem is that this does not work properly. Either the expectation value is way too big or way too small.&lt;/p&gt;&#xA;&lt;p&gt;Where is my error in reasoning?&lt;/p&gt;&#xA;&lt;p&gt;I think I did something wrong with the mechanism.&lt;/p&gt;&#xA;" OwnerUserId="13353" LastEditorUserId="23" LastEditDate="2020-10-02T22:35:48.903" LastActivityDate="2020-10-02T22:35:48.903" Title="Wrong Expectation value when implementing a VQE for the Heisenberg Hamiltonian" Tags="&lt;programming&gt;&lt;textbook-and-exercises&gt;&lt;cirq&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13970" PostTypeId="2" ParentId="13967" CreationDate="2020-09-30T14:39:21.343" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This non-commutativity can be explicitly verified by showing that the matrices&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT = \begin{pmatrix} 1&amp;amp; 0&amp;amp; 0 &amp;amp; 0 \\ &#xA;0&amp;amp; 1&amp;amp; 0 &amp;amp; 0 \\&#xA;0&amp;amp; 0&amp;amp; 0 &amp;amp; 1 \\&#xA;0&amp;amp; 0&amp;amp; 1 &amp;amp; 0 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H\otimes I = \begin{pmatrix} 1&amp;amp; 0&amp;amp; 1 &amp;amp; 0 \\ &#xA;0&amp;amp; 1&amp;amp; 0 &amp;amp;1 \\&#xA;1&amp;amp; 0&amp;amp; -1 &amp;amp; 0 \\&#xA;0&amp;amp; 1&amp;amp; 0 &amp;amp; -1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;do not commute.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastActivityDate="2020-09-30T14:39:21.343" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13972" PostTypeId="2" ParentId="1385" CreationDate="2020-09-30T16:44:49.417" Score="1" Body="&lt;p&gt;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.&#xA;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.&#xA;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 &amp;quot;inversion about the mean&amp;quot;. 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 &amp;quot;inversion about the mean&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="13359" LastActivityDate="2020-09-30T16:44:49.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13973" PostTypeId="1" AcceptedAnswerId="13975" CreationDate="2020-09-30T18:49:00.850" Score="-1" ViewCount="75" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt2}(\langle0| + \langle1|)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12442" LastEditorUserId="9006" LastEditDate="2020-10-01T08:18:00.660" LastActivityDate="2020-10-01T08:18:00.660" Title="Why is a conjugate transpose of $|+\rangle$ a vector $1/\sqrt{2} (\langle0| + \langle1|)$?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="13975" PostTypeId="2" ParentId="13973" CreationDate="2020-09-30T20:52:04.060" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, becomes &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now you have &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle+|1\rangle$&lt;/span&gt;.&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; is real, so complex conjugation does nothing. However, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt; become &lt;span class=&quot;math-container&quot;&gt;$\langle0|+\langle1|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So overall, you get &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(\langle0|+\langle1|)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2020-09-30T20:52:04.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13976" PostTypeId="1" CreationDate="2020-10-01T06:45:35.517" Score="1" ViewCount="34" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6pfC0.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6pfC0.jpg&quot; alt=&quot;Screenshot of my notebook&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why do we have just one line here in &lt;code&gt;c0&lt;/code&gt; and not 2?&lt;/p&gt;&#xA;" OwnerUserId="13363" LastEditorUserId="55" LastEditDate="2020-10-06T04:55:25.910" LastActivityDate="2020-10-06T04:55:25.910" Title="ClassicalRegister gives out just one line instead of two" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13978" PostTypeId="2" ParentId="11966" CreationDate="2020-10-01T08:05:37.577" Score="0" Body="&lt;p&gt;Most probably &lt;code&gt;IBMQ.load_account()&lt;/code&gt; &lt;strong&gt;was missing&lt;/strong&gt; in your code!&lt;br /&gt;&#xA;&lt;em&gt;I was able to reproduce the same error message by removing &lt;code&gt;IBMQ.load_account()&lt;/code&gt; from my code.&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;A working example would be something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;&#xA;provider = IBMQ.get_provider('ibm-q')&#xA;qdevice = provider.get_backend('ibmq_16_melbourne')&#xA;job = execute(qc, backend= qdevice)&#xA;result = job.result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9318" LastActivityDate="2020-10-01T08:05:37.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13979" PostTypeId="2" ParentId="13976" CreationDate="2020-10-01T08:07:37.737" Score="1" Body="&lt;p&gt;By default, Qiskit visualization bundles together classical bits of the same register. If you would like to draw them separately, do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(2)&#xA;cr = ClassicalRegister(2)&#xA;&#xA;circ = QuantumCircuit(qr, cr)&#xA;circ.draw('mpl', &#xA;          cregbundle=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AJ5yWm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AJ5yWm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-01T08:07:37.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13980" PostTypeId="2" ParentId="12901" CreationDate="2020-10-01T13:11:28.330" Score="3" Body="&lt;p&gt;Since it hasn't been mentioned so far, and I think it's an interesting aspect: A weighted ensemble &lt;span class=&quot;math-container&quot;&gt;$(p_i,U_i)$&lt;/span&gt; of unitaries in &lt;span class=&quot;math-container&quot;&gt;$U(d)$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i p_i U_i X U_i^\dagger = \operatorname{tr}(X) \mathbb{I}/d,&#xA;$$&lt;/span&gt;&#xA;is called a &lt;em&gt;weighted unitary 1-design&lt;/em&gt;. If the weights can be chosen uniformly, i.e. &lt;span class=&quot;math-container&quot;&gt;$p_i \equiv 1/N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the size of the ensemble, this reduces to the definition of a &amp;quot;normal&amp;quot; unitary 1-design.&lt;/p&gt;&#xA;&lt;p&gt;There are many examples for unitary 1-designs:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Unitary 1-designs are exactly tight operator frames with frame constant &lt;span class=&quot;math-container&quot;&gt;$N/d$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;In particular, any orthogonal operator basis of unitaries is a unitary 1-design, e.g. the Weyl operators&lt;/li&gt;&#xA;&lt;li&gt;In fact any irreducible unitary representation of a group is a unitary 1-design, e.g. the Heisenberg-Weyl (=generalised Pauli) and Clifford group.&lt;/li&gt;&#xA;&lt;li&gt;For any large enough Haar-random ensemble of unitaries there are weights such that the above equation holds with high probability.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-10-02T09:27:51.490" LastActivityDate="2020-10-02T09:27:51.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13981" PostTypeId="1" CreationDate="2020-10-01T15:03:05.377" Score="1" ViewCount="53" Body="&lt;p&gt;I found this example code in Qiskit documentation.&lt;/p&gt;&#xA;&lt;p&gt;Does this code signify that it is simulating noise as per the IBM Valencia quantum chip. If &lt;em&gt;yes&lt;/em&gt;, 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, execute&#xA;from qiskit import IBMQ, Aer&#xA;from qiskit.visualization import plot_histogram&#xA;from qiskit.providers.aer.noise import NoiseModel&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_valencia')&#xA;noise_model = NoiseModel.from_backend(backend)&#xA;&#xA;coupling_map = backend.configuration().coupling_map&#xA;&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;circ = QuantumCircuit(3, 3)&#xA;circ.h(0)&#xA;circ.cx(0, 1)&#xA;circ.cx(1, 2)&#xA;circ.measure([0, 1, 2], [0, 1, 2])&#xA;&#xA;result = execute(circ, Aer.get_backend('qasm_simulator'),&#xA;                 coupling_map=coupling_map,&#xA;                 basis_gates=basis_gates,&#xA;                 noise_model=noise_model).result()&#xA;counts = result.get_counts(0)&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-10-06T04:55:56.197" LastActivityDate="2020-10-06T04:55:56.197" Title="Noise model for 3 Qubit $|GHZ \rangle$ state measurement circuit" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;noise&gt;&lt;quantumlab&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13982" PostTypeId="2" ParentId="11943" CreationDate="2020-10-01T17:09:05.973" Score="3" Body="&lt;p&gt;Below you'll find a brief and simple example. I also recommend that you read &lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1811/1811.11538.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Tutorial on Formulating and Using QUBO Models&lt;/a&gt; as it covers the topic in more detail.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h1&gt;Example using switches&lt;/h1&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;: Which switches do you need to flip to produce the maximum amount of heat?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;To solve this problem using a QUBO, first you set it up as a polynomial:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;h = 2x_1 + 3x_2 - 8x_1x_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Our switches are represented as binary variables &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt;and &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is the total heat in watts.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, where the origin is top left.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$2x_1 = 2x_1x_1$&lt;/span&gt;, so the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; it goes in the top left corner at &lt;span class=&quot;math-container&quot;&gt;$(1,1)$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$x_a = x_ax_a$&lt;/span&gt; becuase &lt;span class=&quot;math-container&quot;&gt;$x_a$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$\{0, 1\}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Similarly, &lt;span class=&quot;math-container&quot;&gt;$3x_2 = 3x_2x_2$&lt;/span&gt; so the &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; goes in the bottom right corner at &lt;span class=&quot;math-container&quot;&gt;$(2,2)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$-8x_1x_2 = -8x_2x_1$&lt;/span&gt; you get the two coordinates &lt;span class=&quot;math-container&quot;&gt;$(1,2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2,1)$&lt;/span&gt;. Divide the &lt;span class=&quot;math-container&quot;&gt;$-8$&lt;/span&gt; by two, then put each half at a coordinate. This produces a symmetric QUBO matrix.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This is what our final matrix looks like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;2 &amp;amp; -4\\&#xA;-4 &amp;amp; 3&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now you can find your answer by maximizing &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; in&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;y = x^tQx&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$x^t$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; transposed and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is the QUBO matrix.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Answer&lt;/strong&gt;: &lt;span class=&quot;math-container&quot;&gt;$x_1 = 0, x_2 = 1$&lt;/span&gt;, i.e. the first switch should be off and the second switch should be on.&lt;/p&gt;&#xA;&lt;p&gt;We can put these values into the calculation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;2 &amp;amp; -4\\&#xA;-4 &amp;amp; 3&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;0\\&#xA;1&#xA;\end{bmatrix}&#xA;= 3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can try other combinations of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, but you will find that &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; is indeed the maximum possible value. Obviously this trial and error would be much more time-consuming for larger matrices.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$h = y$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="2903" LastActivityDate="2020-10-01T17:09:05.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13985" PostTypeId="1" CreationDate="2020-10-01T20:31:32.540" Score="4" ViewCount="107" Body="&lt;p&gt;There are a few people who ask how to calculate IBM's &amp;quot;quantum volume&amp;quot;, but it's not clear what the actual mathematical definition of this is. In the answers &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6588/how-to-calculate-the-quantum-volume&quot;&gt;here&lt;/a&gt;, people just point to running some program, which is not helpful for understanding or comparing with other technologies.&lt;/p&gt;&#xA;&lt;p&gt;Is there a straightforward way of calculating this for a simple system?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="55" LastEditDate="2020-10-06T04:56:29.570" LastActivityDate="2020-10-06T04:56:29.570" Title="Is there a straightforward way to calculate the quantum volume for simple systems?" Tags="&lt;physical-realization&gt;&lt;ibm&gt;&lt;quantum-volume&gt;&lt;metrics&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13986" PostTypeId="2" ParentId="13985" CreationDate="2020-10-01T21:32:41.170" Score="2" Body="&lt;p&gt;I believe the calculation steps are quite complex to give a simple formula or even to follow it by hand.&lt;/p&gt;&#xA;&lt;p&gt;Maybe this &lt;a href=&quot;https://medium.com/qiskit/what-is-quantum-volume-anyway-a4dff801c36f&quot; rel=&quot;nofollow noreferrer&quot;&gt;medium article&lt;/a&gt;  and the cited &lt;a href=&quot;https://arxiv.org/pdf/2008.08571.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; gives you a better general understanding.&lt;br/&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Other &lt;a href=&quot;https://arxiv.org/pdf/1811.12926.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;This&#xA;metric takes into account all relevant hardware parameters. This includes the performance parameters (coherence, calibration errors, crosstalk, spectator errors, gate&#xA;fidelity, measurement fidelity, initialization fidelity) as&#xA;well as the design parameters such as connectivity and&#xA;gate set. &lt;strong&gt;It also includes the software behind the circuit optimization&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The simplest explanation from medium article would be:&lt;br&gt; &lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2020-10-01T21:42:35.627" LastActivityDate="2020-10-01T21:42:35.627" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13987" PostTypeId="1" AcceptedAnswerId="13991" CreationDate="2020-10-01T23:41:12.067" Score="3" ViewCount="92" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \sum_{\langle i,j\rangle} t_{ij} c^\dagger_i c_j&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\langle i,j\rangle$&lt;/span&gt; denotes the nearest neighbor coupling with strength &lt;span class=&quot;math-container&quot;&gt;$t_{ij}$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$t_{ij}$&lt;/span&gt; reads, for example,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;t_{1,2} = 1, t_{2,3} = 2 , t_{3,4} = 1 , t_{4,5} = 2, etc&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is alternating.&lt;/p&gt;&#xA;&lt;p&gt;I try to pretend this is a molecular Hamiltonian and realize it in the same way with &amp;quot;FermionicOperator&amp;quot;. However, I am not sure how to properly index the &amp;quot;one-body&amp;quot; integral here, which is the nearest neighbor coupling &lt;span class=&quot;math-container&quot;&gt;$t_{ij}$&lt;/span&gt; here.&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-10-06T04:57:23.740" LastActivityDate="2020-10-06T04:57:23.740" Title="How to realize Su-Schrieffer-Heeger model in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13988" PostTypeId="1" CreationDate="2020-10-02T00:31:37.043" Score="1" ViewCount="38" Body="&lt;p&gt;I wish to run a very simple circuit on the qasm_simulator backend. My circuit is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    circuit2 = QuantumCircuit(2,2);&#xA;    circuit2.u3(pi/2,pi,3*pi/4,1)&#xA;    circuit2.u3(pi/2,pi,7*pi/4,0)&#xA;    #u2&#xA;    circuit2.cx(0,1)&#xA;    #u3&#xA;    circuit2.rz(3*pi/4,1)&#xA;    #u4&#xA;    circuit2.cx(1,0)&#xA;    #u5&#xA;    circuit2.ry(pi/2,0)&#xA;    #u6&#xA;    circuit2.cx(0,1)&#xA;    #u7&#xA;    circuit2.u3(0,pi*0.8252172,-pi*0.4247820,1)&#xA;    circuit2.u3(pi/2,0,pi/2,0)&#xA;    circuit2.measure(0,0);&#xA;    circuit2.measure(1,1);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;for x in range(10):&#xA;    Cfin=circuit2;&#xA;    job = execute(Cfin, backend, shots=1000)&#xA;    res=job.result().get_counts(Cfin)&#xA;    print(res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get a series of results that look something like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'11': 274, '10': 256, '01': 229, '00': 241}&#xA;{'11': 274, '10': 256, '01': 229, '00': 241}&#xA;{'11': 274, '10': 256, '01': 229, '00': 241}&#xA;{'11': 274, '10': 256, '01': 229, '00': 241}&#xA;{'11': 274, '10': 256, '01': 229, '00': 241}&#xA;{'11': 274, '10': 256, '01': 229, '00': 241}&#xA;{'10': 241, '01': 224, '00': 286, '11': 249}&#xA;{'11': 240, '01': 246, '10': 233, '00': 281}&#xA;{'11': 240, '01': 246, '10': 233, '00': 281}&#xA;{'11': 240, '01': 246, '10': 233, '00': 281}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-06T04:57:29.317" LastActivityDate="2020-10-06T04:57:29.317" Title="qasm_simulator generating identical results repeatedly" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13989" PostTypeId="1" CreationDate="2020-10-02T04:45:02.413" Score="3" ViewCount="348" Body="&lt;p&gt;I'm trying to profile qiskit backends and I use &lt;code&gt;randomized_benchmarking&lt;/code&gt; provided by &lt;code&gt;qiskit.ignis&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Initially I ran a circuit with 20 qubits 100 length on &lt;code&gt;statevector_simulator&lt;/code&gt;, which takes around 180s and qubits can go up to 32 and then it runs out of memory. Then I tried &lt;code&gt;qasm_simulator&lt;/code&gt; and it only takes 2s to finish and can run up to 54+ qubits.&lt;/p&gt;&#xA;&lt;p&gt;Why does qasm_simulator perform so much better than statevector_simulator? Does this happen because the circuit only contains simple gates?&lt;/p&gt;&#xA;" OwnerUserId="13374" LastEditorUserId="55" LastEditDate="2020-10-06T04:57:40.310" LastActivityDate="2020-10-06T04:57:40.310" Title="Qiskit - difference between qasm_simulator and statevector_simulator in terms of memory and speed?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13990" PostTypeId="2" ParentId="13985" CreationDate="2020-10-02T10:08:06.870" Score="1" Body="&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$6 = \log_2 64$&lt;/span&gt;). Moreover, maximal depth of your simulation (circuit) has to be less or equal 6.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note that this is relatively rough description what the quantum volume is, however, I think it is sufficient for basic understanding what that means.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-02T10:08:06.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13991" PostTypeId="2" ParentId="13987" CreationDate="2020-10-02T12:58:38.707" Score="1" Body="&lt;p&gt;I don't think it really matter how you index your &lt;span class=&quot;math-container&quot;&gt;$t_{ij}$&lt;/span&gt;. As you mentioned you can use &lt;code&gt;FermionicOperator&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def ssh_ham(gamma, lamda, n): &#xA;    sigmax = np.array([[0,1],[1,0]], dtype=np.complex_)&#xA;    sigmay = np.array([[0,-1j],[1j,0]], dtype=np.complex_)&#xA;&#xA;    op_eye_x = np.eye(n)&#xA;    op_cos_x = 1/2*(np.eye(n, k=1) + np.eye(n,k=-1))&#xA;    op_sin_x = 1j/2*(np.eye(n, k=1) - np.eye(n,k=-1))&#xA;&#xA;    h = np.kron(gamma*op_eye_x + lamda*op_cos_x, sigmax) + np.kron(lamda*op_sin_x, sigmay)&#xA;&#xA;    return h &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This function would return the one-body integral for you. In this function, the &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; degree of freedom represents the two atoms in the unit cell, and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; represents how many unit cells you have in the SSH chain, and for the dimmerized limit you asked for you can take &lt;span class=&quot;math-container&quot;&gt;$\gamma = 1,\ \lambda = 2 $&lt;/span&gt;. You can use the output of this function &lt;code&gt;fer_op = FermionicOperator(h1 = ssh_ham(1,2,10))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; qubits, this is a Hilbert space of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; dimensions, whereas you can diagonalize the the Hamiltonian by diagonalizing the &lt;span class=&quot;math-container&quot;&gt;$2n \times 2n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$t_{ij}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13215" LastEditorUserId="13215" LastEditDate="2020-10-02T18:37:20.460" LastActivityDate="2020-10-02T18:37:20.460" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="13992" PostTypeId="1" AcceptedAnswerId="13993" CreationDate="2020-10-02T13:15:25.173" Score="0" ViewCount="149" Body="&lt;p&gt;I like to use as custom Mixer Hamiltonian for solving the TSP using QAOA.&#xA;The mixer and cost hamiltonians are described here: &lt;a href=&quot;https://arxiv.org/pdf/1709.03489.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1709.03489.pdf&lt;/a&gt; - Chapter 5.1.&lt;/p&gt;&#xA;&lt;p&gt;Therefore I need to write the custom mixer hamiltonian from equations 54 -58.&lt;/p&gt;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import Aer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.quantum_info.operators import Operator, Pauli&#xA;from qiskit.aqua.operators.list_ops import SummedOp&#xA;from qiskit.aqua.algorithms import QAOA&#xA;from qiskit.aqua.components.optimizers import SPSA&#xA;from qiskit.optimization.applications.ising importtsp&#xA;&#xA;&#xA;def pauli(pos, num_qubits, label):&#xA;    label = 'I'*(pos) + label + 'I'*(num_qubits-pos-1)&#xA;    assert(len(label) == num_qubits)&#xA;    return Operator(Pauli(label=label))&#xA;&#xA;def s_plus(number_of_nodes, city, time):&#xA;    num_qubits = number_of_nodes**2&#xA;    qubit = time * number_of_nodes + city&#xA;    return pauli(qubit, num_qubits, &amp;quot;X&amp;quot;) + pauli(qubit, num_qubits, &amp;quot;Y&amp;quot;)&#xA;&#xA;def s_minus(number_of_nodes, city, time):&#xA;    num_qubits = number_of_nodes**2&#xA;    qubit = time * number_of_nodes + city&#xA;    return pauli(qubit, num_qubits, &amp;quot;X&amp;quot;) - pauli(qubit, num_qubits, &amp;quot;Y&amp;quot;)&#xA;&#xA;def create_mixer_operators(n):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    Creates mixer operators for the QAOA.&#xA;    It's based on equations 54 - 58 from https://arxiv.org/pdf/1709.03489.pdf&#xA;    Indexing here comes directly from section 4.1.2 from paper 1709.03489, equations 54 - 58.&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    mixer_operators = []&#xA;    for t in range(n - 1):&#xA;        for city_1 in range(n):&#xA;            for city_2 in range(n):&#xA;                i = t&#xA;                u = city_1&#xA;                v = city_2&#xA;                first_part = 1&#xA;                first_part *= s_plus(n, u, i)&#xA;                first_part *= s_plus(n, v, i+1)&#xA;                first_part *= s_minus(n, u, i+1)&#xA;                first_part *= s_minus(n, v, i)&#xA;&#xA;                second_part = 1&#xA;                second_part *= s_minus(n, u, i)&#xA;                second_part *= s_minus(n, v, i+1)&#xA;                second_part *= s_plus(n, u, i+1)&#xA;                second_part *= s_plus(n, v, i)&#xA;                mixer_operators.append(first_part + second_part)&#xA;    return mixer_operators&#xA;&#xA;seed = 10598&#xA;n = 3&#xA;p = 2&#xA;num_qubits = n ** 2&#xA;&#xA;# Generate random tsp&#xA;ins = tsp.random_tsp(n, seed=seed)&#xA;&#xA;qubitOp, offset = tsp.get_operator(ins)&#xA;&#xA;# Running in quantum simulation&#xA;aqua_globals.random_seed = np.random.default_rng(seed)&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;quantum_instance = QuantumInstance(backend, seed_simulator=seed, seed_transpiler=seed)&#xA;mixer = create_mixer_operators(n)&#xA;mixer_op = SummedOp(mixer)&#xA;&#xA;spsa = SPSA(maxiter=300)&#xA;qaoa = QAOA(operator=qubitOp, mixer=mixer_op, p=p, optimizer=spsa, quantum_instance=quantum_instance)&#xA;&#xA;circuits = qaoa.construct_circuit([0]*(2*p))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When runnning it I get:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    ---------------------------------------------------------------------------&#xA;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-113-bd68aaa30bfc&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 circuits = qaoa.construct_circuit([0]*(2*p))&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in construct_circuit(self, parameter)&#xA;    358             A list of the circuits used to compute the expectation value.&#xA;    359         &amp;quot;&amp;quot;&amp;quot;&#xA;--&amp;gt; 360         expect_op = self.construct_expectation(parameter).to_circuit_op()&#xA;    361 &#xA;    362         circuits = []&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in construct_expectation(self, parameter)&#xA;    331             wave_function = self.var_form.assign_parameters(param_dict)&#xA;    332         else:&#xA;--&amp;gt; 333             wave_function = self.var_form.construct_circuit(parameter)&#xA;    334 &#xA;    335         # Expectation was never created, try to create one&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/var_form.py in construct_circuit(self, parameters, q)&#xA;     96 &#xA;     97         evolution = EvolutionFactory.build(self._cost_operator)&#xA;---&amp;gt; 98         circuit = evolution.convert(circuit)&#xA;     99         return circuit.to_circuit()&#xA;    100 &#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in convert(self, operator)&#xA;    100         #     # Sort into commuting groups&#xA;    101         #     operator = self._grouper.convert(operator).reduce()&#xA;--&amp;gt; 102         return self._recursive_convert(operator)&#xA;    103 &#xA;    104     def _recursive_convert(self, operator: OperatorBase) -&amp;gt; OperatorBase:&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in _recursive_convert(self, operator)&#xA;    127                 return operator.primitive.__class__(converted_ops, coeff=operator.coeff)&#xA;    128         elif isinstance(operator, ListOp):&#xA;--&amp;gt; 129             return operator.traverse(self.convert).reduce()&#xA;    130 &#xA;    131         return operator&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in traverse(self, convert_fn, coeff)&#xA;    161             return ListOp([convert_fn(op) for op in self.oplist],  # type: ignore&#xA;    162                           combo_fn=self.combo_fn, coeff=coeff, abelian=self.abelian)&#xA;--&amp;gt; 163         return self.__class__([convert_fn(op) for op in self.oplist],  # type: ignore&#xA;    164                               coeff=coeff, abelian=self.abelian)&#xA;    165 &#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in &amp;lt;listcomp&amp;gt;(.0)&#xA;    161             return ListOp([convert_fn(op) for op in self.oplist],  # type: ignore&#xA;    162                           combo_fn=self.combo_fn, coeff=coeff, abelian=self.abelian)&#xA;--&amp;gt; 163         return self.__class__([convert_fn(op) for op in self.oplist],  # type: ignore&#xA;    164                               coeff=coeff, abelian=self.abelian)&#xA;    165 &#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in convert(self, operator)&#xA;    100         #     # Sort into commuting groups&#xA;    101         #     operator = self._grouper.convert(operator).reduce()&#xA;--&amp;gt; 102         return self._recursive_convert(operator)&#xA;    103 &#xA;    104     def _recursive_convert(self, operator: OperatorBase) -&amp;gt; OperatorBase:&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in _recursive_convert(self, operator)&#xA;    104     def _recursive_convert(self, operator: OperatorBase) -&amp;gt; OperatorBase:&#xA;    105         if isinstance(operator, EvolvedOp):&#xA;--&amp;gt; 106             if not {'Pauli'} == operator.primitive_strings():&#xA;    107                 logger.warning('Evolved Hamiltonian is not composed of only Paulis, converting to '&#xA;    108                                'Pauli representation, which can be expensive.')&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/evolved_op.py in primitive_strings(self)&#xA;     53 &#xA;     54     def primitive_strings(self) -&amp;gt; Set[str]:&#xA;---&amp;gt; 55         return self.primitive.primitive_strings()  # type: ignore&#xA;     56 &#xA;     57     @property&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in primitive_strings(self)&#xA;    126 &#xA;    127     def primitive_strings(self) -&amp;gt; Set[str]:&#xA;--&amp;gt; 128         return reduce(set.union, [op.primitive_strings() for op in self.oplist])&#xA;    129 &#xA;    130     @property&#xA;&#xA;~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in &amp;lt;listcomp&amp;gt;(.0)&#xA;    126 &#xA;    127     def primitive_strings(self) -&amp;gt; Set[str]:&#xA;--&amp;gt; 128         return reduce(set.union, [op.primitive_strings() for op in self.oplist])&#xA;    129 &#xA;    130     @property&#xA;&#xA;AttributeError: 'Operator' object has no attribute 'primitive_strings'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How do I resolve the error? This is my first project with qiskit and I am not sure where to start.&lt;/p&gt;&#xA;" OwnerUserId="13376" LastEditorUserId="55" LastEditDate="2020-10-06T04:57:47.327" LastActivityDate="2020-10-06T04:57:47.327" Title="Custom Mixer for QAOA: Error 'Operator' object has no attribute 'primitive_strings'" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13993" PostTypeId="2" ParentId="13992" CreationDate="2020-10-02T13:48:48.613" Score="1" Body="&lt;p&gt;&lt;code&gt;Operator&lt;/code&gt; is part of Qiskit-Terra's module quantum-info. You should use &lt;code&gt;PrimitiveOp&lt;/code&gt; from Qiskit-Aqua.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import PrimitiveOp&#xA;&#xA;def pauli(pos, num_qubits, label):&#xA;    label = 'I'*(pos) + label + 'I'*(num_qubits-pos-1)&#xA;    assert(len(label) == num_qubits)&#xA;    return PrimitiveOp(Pauli(label=label))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note however that for composing an Operator in Aqua with another you should use &lt;code&gt;@&lt;/code&gt; and &lt;code&gt;*&lt;/code&gt; for multiplying with a scalar.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Trying to explain the new error you are getting, i think the following is happening: At some point, the &lt;code&gt;QAOA&lt;/code&gt; 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 &lt;code&gt;coeff&lt;/code&gt; (all Operators in Aqua have a coefficient) field to be a complex number. But then, since multiplication of a &lt;code&gt;Parameter&lt;/code&gt; with a &lt;code&gt;complex&lt;/code&gt; is not supported, an error is raising.&lt;/p&gt;&#xA;&lt;p&gt;A simpler example may be helpful in order to see what's going wrong.&#xA;Let's say, we want to build a parameterized circuit corresponding to the evolution of &lt;span class=&quot;math-container&quot;&gt;$ X \otimes X $&lt;/span&gt; operator (i.e &lt;span class=&quot;math-container&quot;&gt;$ e^{-i \beta (X \otimes X)} $&lt;/span&gt;). We will try two different ways. The second one will fail.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import Parameter&#xA;from qiskit.aqua.operators import X, I, EvolutionFactory, EvolvedOp&#xA;&#xA;def evolve(H):&#xA;    beta = Parameter('β')&#xA;    &#xA;    evolution = EvolutionFactory.build(operator=beta * H)&#xA;    eop = EvolvedOp(beta * H)&#xA;    &#xA;    return evolution.convert(eop)&#xA;&#xA;&#xA;H = X ^ X&#xA;print(H.coeff)&#xA;print(type(H.coeff))&#xA;evolve(H)&#xA;---&#xA;1.0&#xA;float&#xA;Works&#xA;&#xA;&#xA;H = (X ^ I) @ (I ^ X)&#xA;print(H.coeff)&#xA;print(type(H.coeff))&#xA;evolve(H)&#xA;---&#xA;1+0j&#xA;complex&#xA;TypeError: unsupported operand type(s) for *: 'complex' and 'Parameter'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Putting all this aside, as a workaround you could do the calculations on eq.58 (as already briefly explained on the orginal &lt;a href=&quot;https://arxiv.org/pdf/1709.03489.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;) and after eliminating some terms you get:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;\frac{1}{2}H_{i, u, v} &amp;amp;= X_{u, i} X_{v, i + 1} X_{u, i + 1} X_{v, i} \\&#xA;&amp;amp; - X_{u, i} X_{v, i + 1} Y_{u, i + 1} Y_{v, i} \\&#xA;&amp;amp; + X_{u, i} Y_{v, i + 1} X_{u, i + 1} Y_{v, i} \\&#xA;&amp;amp; + X_{u, i} Y_{v, i + 1} Y_{u, i + 1} X_{v, i} \\&#xA;&amp;amp; + Y_{u, i} X_{v, i + 1} X_{u, i + 1} Y_{v, i} \\&#xA;&amp;amp; + Y_{u, i} X_{v, i + 1} Y_{u, i + 1} X_{v, i} \\&#xA;&amp;amp; - Y_{u, i} Y_{v, i + 1} X_{u, i + 1} X_{v, i} \\&#xA;&amp;amp; + Y_{u, i} Y_{v, i + 1} Y_{u, i + 1} Y_{v, i}&#xA;\end{align*}&lt;/span&gt;&#xA;and implement this operator as your mixer (sum of 8 &lt;code&gt;PauliOp&lt;/code&gt;s).&lt;/p&gt;&#xA;&lt;p&gt;For convenience, here is my implementation.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from itertools import combinations&#xA;&#xA;def mixer_operators(n):&#xA;    &#xA;    mixer = []&#xA;    n_qubits = pow(n, 2)&#xA;    &#xA;    for i in range(n - 1):&#xA;        for u, v in combinations(range(n), 2):&#xA;                &#xA;                qu = i * n + u&#xA;                qv = i * n + v&#xA;                &#xA;                x = [0] * n_qubits&#xA;                x[qu] = x[qv] = x[qu + n] = x[qv + n] = 1&#xA;                &#xA;                Hi = 0&#xA;                &#xA;                # XXXX term&#xA;                z = [0] * n_qubits&#xA;                pauli = Pauli(z, x)&#xA;                pauli = PrimitiveOp(pauli)&#xA;                &#xA;                Hi += pauli&#xA;                &#xA;                &#xA;                # YYYY term&#xA;                z = [0] * n_qubits&#xA;                z[qu] = z[qv] = z[qu + n] = z[qv + n] = 1&#xA;                pauli = Pauli(z, x)&#xA;                pauli = PrimitiveOp(pauli)&#xA;                &#xA;                Hi += pauli&#xA;                &#xA;                &#xA;                # XXYY and similar terms (two Ys)&#xA;                for q0, q1 in combinations([qu, qv, qu + n, qv + n], 2):&#xA;                    z = [0] * n_qubits&#xA;                    z[q0] = z[q1] = 1&#xA;                    pauli = Pauli(z, x)&#xA;                    &#xA;                    coeff = 1&#xA;                    if (q0, q1) in [(qu, qv), (qu + n, qv + n)]:&#xA;                        coeff = -1                &#xA;                    pauli = PrimitiveOp(pauli, coeff)&#xA;                    &#xA;                    Hi += pauli&#xA;                &#xA;                &#xA;                mixer.append(2 * Hi)&#xA;                &#xA;    return SummedOp(mixer)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-10-04T11:18:35.860" LastActivityDate="2020-10-04T11:18:35.860" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="13994" PostTypeId="1" AcceptedAnswerId="14882" CreationDate="2020-10-02T15:28:33.790" Score="1" ViewCount="42" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-11-28T12:26:25.900" LastActivityDate="2020-11-28T12:26:25.900" Title="Resources on randomized algorithms for analysis and design of quantum algorithms" Tags="&lt;resource-request&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="13995" PostTypeId="1" AcceptedAnswerId="14022" CreationDate="2020-10-02T18:02:21.457" Score="2" ViewCount="34" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5620" LastEditorUserId="55" LastEditDate="2020-10-06T04:59:09.577" LastActivityDate="2020-10-06T04:59:09.577" Title="What are some resources on qubits based on quantum dots?" Tags="&lt;resource-request&gt;&lt;physical-qubit&gt;&lt;quantum-dots&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13996" PostTypeId="2" ParentId="13987" CreationDate="2020-10-02T18:13:12.040" Score="1" Body="&lt;p&gt;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 &amp;quot;unitary_matrix&amp;quot; to change it AAA...BBB... which is the basis for h1_qubit. The construction of &amp;quot;unitary_matrix&amp;quot; can be found in the qiskit function &amp;quot;FermionicOperator&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;lowest energy&amp;quot; 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.linalg import eig&#xA;from qiskit.aqua.algorithms import VQE, NumPyEigensolver&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.aqua.operators import Z2Symmetries&#xA;&#xA;&#xA;t1 = np.random.rand() # intra&#xA;t2 = np.random.rand() # inter&#xA;t0 = np.random.rand() # onsite energy &#xA;&#xA;&#xA;N = 4 # number of unit cell&#xA;&#xA;BC = 1 # BC=1 is PBC, BC=0 is OBC&#xA;&#xA;h1 = np.zeros( (2*N , 2*N ) )&#xA;&#xA;&#xA;for i in range(0,(2*N-1)):&#xA;    if i % 2==1:&#xA;        h1[ i , i ] = t0&#xA;        h1[ i , i+1 ] = t2       &#xA;        h1[ i+1 , i ] = t2        &#xA;    else:&#xA;        h1[ i , i ] = -t0        &#xA;        h1[ i , i+1 ] = t1&#xA;        h1[ i+1 , i ] = t1        &#xA;&#xA;h1[2*N-1,2*N-1] = t0&#xA;&#xA;if BC==1:&#xA;    h1[ 0 , 2*N-1 ] = t2&#xA;    h1[ 2*N-1 , 0 ] = t2    &#xA;        &#xA;        &#xA;print( 'The fermionic Hamiltonian is\n' , h1 ) &#xA;&#xA;eigh1 = eig(h1)[0]&#xA;&#xA;idx = np.argsort(eigh1)&#xA;eigh1 = eigh1[idx]&#xA;&#xA;print( 'The *single* particle spectrum is \n' , eigh1 )&#xA;&#xA;unitary_matrix = np.zeros((h1.shape), h1.dtype)&#xA;n = unitary_matrix.shape[0]&#xA;j = np.arange(n // 2)&#xA;unitary_matrix[j, 2 * j] = 1.0&#xA;unitary_matrix[j + n // 2, 2 * j + 1] = 1.0&#xA;&#xA;h1_qubit = unitary_matrix.dot(h1.dot(unitary_matrix.T.conj()))&#xA;&#xA;&#xA;ferOp = FermionicOperator(h1=h1_qubit )&#xA;&#xA;qubitOp = ferOp.mapping(map_type='parity' , threshold=0.00000001)&#xA;&#xA;numEigenvalue = 1&#xA;result = NumPyEigensolver( qubitOp ,  k = numEigenvalue ).run()&#xA;eigvals = result['eigenvalues']&#xA;eigvecs = result['eigenstates']&#xA;print( 'The *many-body* grond state energy is \n ' , eigvals[0] )&#xA;&#xA;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')&#xA;&#xA;print( eigvals[0] - sum( eigh1[0:int(len(eigh1)/2)]))&#xA;&#xA;      &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastActivityDate="2020-10-02T18:13:12.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="13997" PostTypeId="1" AcceptedAnswerId="14005" CreationDate="2020-10-03T14:05:02.517" Score="1" ViewCount="118" Body="&lt;p&gt;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 &amp;quot;for&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="5217" LastEditorUserId="1859" LastEditDate="2020-10-05T12:53:51.530" LastActivityDate="2020-10-05T12:53:51.530" Title="How can i run a quantum circuit with parameterized gates many times on quantum experience?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="13998" PostTypeId="2" ParentId="13997" CreationDate="2020-10-03T16:05:53.100" Score="-1" Body="&lt;p&gt;A simple example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;variable = [0.2, 0.5, 1.2, -0.4, -1.5, 1.7 ]  &#xA;for i in range(len(variable)):&#xA;    qc = QuantumCircuit(2,2)&#xA;    qc.ry(variable[i],0) &#xA;    qc.cx([0],[1]) &#xA;    qc.measure([0,1], [0,1])&#xA;    print( qc ) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-03T16:05:53.100" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="13999" PostTypeId="1" CreationDate="2020-10-03T18:23:23.000" Score="2" ViewCount="32" Body="&lt;p&gt;In Brassard's et al. work, the &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; operator is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Q =-\mathcal{A}\mathcal{S_0}\mathcal{A}^{-1}\mathcal{S_\chi}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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  &lt;span class=&quot;math-container&quot;&gt;$S_\chi$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="1859" LastEditDate="2020-10-06T05:16:56.803" LastActivityDate="2020-10-06T05:16:56.803" Title="Qiskit implementation of Brassard Amplitude implementaion's Q operator" Tags="&lt;qiskit&gt;&lt;amplitude-amplification&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14000" PostTypeId="1" AcceptedAnswerId="14008" CreationDate="2020-10-03T21:25:17.513" Score="4" ViewCount="83" Body="&lt;p&gt;Shor's &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; Qubit code. Imagine that we encode the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle =α|0\rangle+β|1\rangle$&lt;/span&gt; using Shor's &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; qubit code, then an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error occurs on the 8th qubit of the encoded state &lt;span class=&quot;math-container&quot;&gt;$|E(\psi) \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We now decode the encoded state, starting by applying the bit-flip code decoding algorithm.&lt;/p&gt;&#xA;&lt;p&gt;How do you find the syndromes measured by the algorithm, see &lt;a href=&quot;https://people.maths.bris.ac.uk/%7Ecsxam/teaching/qc2020/lecturenotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://people.maths.bris.ac.uk/~csxam/teaching/qc2020/lecturenotes.pdf&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4336" LastEditorUserId="55" LastEditDate="2020-10-05T13:41:17.417" LastActivityDate="2020-10-05T13:41:17.417" Title="How to measure syndromes in QEC" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14001" PostTypeId="1" AcceptedAnswerId="14003" CreationDate="2020-10-03T21:30:40.570" Score="1" ViewCount="47" Body="&lt;p&gt;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 :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The execution time : this is hard to measure for &amp;quot;big&amp;quot; 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 ?&lt;/li&gt;&#xA;&lt;li&gt;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 ?&lt;/li&gt;&#xA;&lt;li&gt;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# ?&lt;/li&gt;&#xA;&lt;li&gt;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.&#xA;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 :).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-10-04T00:15:35.693" Title="Best way to test the performance of a simulated quantum algorithm in Q#" Tags="&lt;q#&gt;&lt;performance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14002" PostTypeId="2" ParentId="13981" CreationDate="2020-10-04T00:03:20.370" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-04T00:03:20.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14003" PostTypeId="2" ParentId="14001" CreationDate="2020-10-04T00:15:35.693" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Validating your solution.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/main/GraphColoring/&quot; rel=&quot;nofollow noreferrer&quot;&gt;GraphColoring kata&lt;/a&gt; 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.)&lt;/p&gt;&#xA;&lt;p&gt;More specifically, in the &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/a956b54d6f96b4506c43672c9bfbd0609da32d0c/GraphColoring/Tests.qs#L223&quot; rel=&quot;nofollow noreferrer&quot;&gt;test that covers graph coloring oracle&lt;/a&gt; we:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;iterate over all possible classical inputs,&lt;/li&gt;&#xA;&lt;li&gt;encode each of them as a basis state on the input qubits,&lt;/li&gt;&#xA;&lt;li&gt;apply the oracle to the qubits to perform the computation,&lt;/li&gt;&#xA;&lt;li&gt;read out the result,&lt;/li&gt;&#xA;&lt;li&gt;and compare it to the result of the same computation done classically (i.e., validating the graph coloring classically).&lt;/li&gt;&#xA;&lt;li&gt;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 &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/a956b54d6f96b4506c43672c9bfbd0609da32d0c/RippleCarryAdder/Tests.qs#L122&quot; rel=&quot;nofollow noreferrer&quot;&gt;RippleCarryAdder kata&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/machines/toffoli-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Toffoli simulator&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Resource estimation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The other three questions are all tied to resource estimation of a quantum algorithm, so I'll bundle them together.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/tcNickolas/MiscQSharp/tree/master/DecoratingTheTree2019-Optimize#decorating-the-christmas-tree-using-grovers-search&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post&lt;/a&gt;. 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 &amp;quot;around 35 minutes&amp;quot; would be fine.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/machines/resources-estimator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Resource estimation&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-04T00:15:35.693" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14004" PostTypeId="1" AcceptedAnswerId="14013" CreationDate="2020-10-04T02:24:46.653" Score="0" ViewCount="47" Body="&lt;p&gt;Broadly speaking, can we say that quantum circuits are like Fourier Transform/Decomposition?&lt;br/&gt; We use qbit like waves, tune it with quantum gates, to find answer.&lt;br/&gt;&lt;br/&gt; &lt;a href=&quot;https://ars.els-cdn.com/content/image/3-s2.0-B978075067444750042X-f05-16-9780750674447.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ars.els-cdn.com/content/image/3-s2.0-B978075067444750042X-f05-16-9780750674447.gif&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;  &lt;a href=&quot;https://www.sciencedirect.com/topics/engineering/fourier-decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/topics/engineering/fourier-decomposition&lt;/a&gt;&lt;br/&gt;&lt;br/&gt; &lt;a href=&quot;https://youtu.be/spUNpyF58BY?t=106&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/spUNpyF58BY?t=106&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8491" LastEditorUserId="55" LastEditDate="2020-10-08T17:49:45.183" LastActivityDate="2020-10-08T17:49:45.183" Title="Quantum circuit, Fourier Transform/Decomposition?" Tags="&lt;quantum-fourier-transform&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14005" PostTypeId="2" ParentId="13997" CreationDate="2020-10-04T03:08:42.383" Score="1" Body="&lt;p&gt;You first need to &lt;code&gt;pip install qiskit&lt;/code&gt; and get your API Token from &lt;a href=&quot;https://quantum-computing.ibm.com/account&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/account&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h5vxb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h5vxb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, save your token in your configuration:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.save_account('MY_API_TOKEN')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider()&#xA;print(provider.backends())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Choose a device in which your circuit fits and set it as &lt;code&gt;backend&lt;/code&gt;. For example, &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmq_16_melbourne')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, create your circuit with &lt;code&gt;qiskit.circuit.Parameter&lt;/code&gt; for the parametric part. For example, take this dummy scenario:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.circuit import Parameter &#xA;parameter = Parameter('x')&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.ry(parameter, 0)&#xA;circuit.measure_all()&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;        ┌───────┐ ░ ┌─┐&#xA;   q_0: ┤ RY(x) ├─░─┤M├&#xA;        └───────┘ ░ └╥┘&#xA;meas: 1/═════════════╩═&#xA;                     0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can create a set of circuits using different parameters with &lt;code&gt;bind_parameters&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from numpy import pi&#xA;&#xA;circuits = []&#xA;for param in [pi/2, pi/3, pi/5]:&#xA;    circuits.append(circuit.bind_parameters({parameter: param}))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, you are ready to send the job:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(circuits, backend=backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For checking the results, you have to wait until the job is done:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job.wait_for_final_state()&#xA;&#xA;for idx, param in enumerate([pi/2, pi/3, pi/5]):&#xA;    print(param, job.result().get_counts(idx))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;1.5707963267948966 {'1': 504, '0': 520}&#xA;1.0471975511965976 {'0': 770, '1': 254}&#xA;0.6283185307179586 {'0': 918, '1': 106}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-10-04T03:20:20.360" LastActivityDate="2020-10-04T03:20:20.360" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14006" PostTypeId="2" ParentId="13999" CreationDate="2020-10-04T06:30:26.450" Score="1" Body="&lt;p&gt;The minus sign is a global phase. It can be ommited in case of operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; itself, however, it has to be included in controlled version of the operator.&lt;/p&gt;&#xA;&lt;p&gt;Controlled global phase is implemented by gate (I assume IBM Q environment) &lt;span class=&quot;math-container&quot;&gt;$U1 \otimes I$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; gate acts on control qubit and identity operator on target qubit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; gate is given by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; \mathrm{e}^{i\varphi}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In your case &lt;span class=&quot;math-container&quot;&gt;$\varphi = \pi$&lt;/span&gt; which leads to gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;which is actually &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;To sum up: you do not have bother about sign in case of operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; itself, in case of controlled operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, simply put &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on control qubit.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-04T06:30:26.450" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14008" PostTypeId="2" ParentId="14000" CreationDate="2020-10-04T08:23:44.787" Score="3" Body="&lt;p&gt;Is it clear how the syndrome measurement for &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubit bit-flip code is done that is described in the same &lt;a href=&quot;https://people.maths.bris.ac.uk/%7Ecsxam/teaching/qc2020/lecturenotes.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt; with this &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7Ese9b%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B1,1,1,%22Measure%22,%22Measure%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7Erhq8%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ese9b%22,%22name%22:%22Encoding%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt;? If yes then is it clear how this can be done for &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; qubit code with this &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7E7gjp%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22X%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,1,1,1,1,1,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7Erhq8%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ese9b%22,%22name%22:%22Encoding%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7E7gjp%22,%22name%22:%229%20qubit%20code%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt; for bit-flip error? If no here are some ideas that might help.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;A toy model example about what is happening in these codes.&lt;/strong&gt; Imagine we have a Bell state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;. Imagine there is a probability that we will have an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AeMZN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AeMZN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;This is not an error-correcting code, this is a toy model on which one can see how syndrome measurement can be done.&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, otherwise, if we will have an error then we will measure &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. If we had an error, then applying an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on one of the qubits will recreate the initial &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The bit-flip error detecting part here (and in &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubit bit-flip code or &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; qubit code) is a parity check: checks if there are even number of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s in the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; controlling qubits. So if we have &lt;span class=&quot;math-container&quot;&gt;$|00 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle$&lt;/span&gt;)) the parity is even and the output qubit will be in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. If we have &lt;span class=&quot;math-container&quot;&gt;$|01 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle + |01\rangle$&lt;/span&gt;)) the parity is odd and the output qubit will be in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. If this part is clear I suggest looking at two circuit links (created with quirk) provided at the beginning of the answer.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;For the error on the &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;th qubit.&lt;/strong&gt; For &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; qubit code there are &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; parity check measurements for &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; pairs of qubits that can be seen in the mentioned &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7E7gjp%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22X%22%5D,%5B1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22X%22%5D,%5B1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,1,1,1,%22%E2%80%A2%22,%22%E2%80%A2%22,1,1,1,1,1,%22X%22%5D,%5B1,1,1,1,1,1,1,1,1,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7Erhq8%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ese9b%22,%22name%22:%22Encoding%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D%5D%7D%7D,%7B%22id%22:%22%7E7gjp%22,%22name%22:%229%20qubit%20code%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt;. The parity between all &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; pairs of qubits is even when we don't have an error and the measured syndrome is &lt;span class=&quot;math-container&quot;&gt;$00,00,00$&lt;/span&gt;. If an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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 (&lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;th qubit got an error) the parity is odd for last two pairs of qubits that is why we will measure &lt;span class=&quot;math-container&quot;&gt;$00,00,11$&lt;/span&gt; syndrome. If &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt;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 &lt;span class=&quot;math-container&quot;&gt;$00,00,01$&lt;/span&gt;. If the error has acquired on the &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;th qubit then the syndrome will be &lt;span class=&quot;math-container&quot;&gt;$00,00,10$&lt;/span&gt;, because the parity is odd only for the penultimate pair of qubits (pair that consists of &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;th and &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;th qubits). If we know on which qubit an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; error has acquired we can apply on that qubit an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate that will correct the acquired error.&lt;/p&gt;&#xA;&lt;p&gt;The parity checks for Shore's &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; qubit code can also be done with this &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B1,1,1,1,1,1,%22%7Es0r0%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,%22%E2%80%A2%22,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,%22%E2%80%A2%22,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,1,%22%E2%80%A2%22,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B1,1,1,1,1,%22%E2%80%A2%22,1,1,1,1,1,1,1,%22Z%22,%22Z%22%5D,%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D,%5B%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22,%22Measure%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7Es0r0%22,%22name%22:%22Encoding%22,%22circuit%22:%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22,%22H%22%5D%5D%7D%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit&lt;/a&gt; by using an operator measurement technique.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-04T14:13:50.013" LastActivityDate="2020-10-04T14:13:50.013" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14010" PostTypeId="1" CreationDate="2020-10-04T19:02:24.303" Score="1" ViewCount="44" Body="&lt;p&gt;I am currently reading this &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.101.032307&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; 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 &amp;quot; At the end of the circuit, we measure the state of the work system in the subspace where all ancilla registers are &lt;span class=&quot;math-container&quot;&gt;$|0⟩|0⟩_k |0⟩_{kL}$&lt;/span&gt;.&amp;quot; What I am having trouble understanding is how they ensure that the ancilla qubits are in the state &lt;span class=&quot;math-container&quot;&gt;$|0&amp;gt;$&lt;/span&gt;. How do I design my circuit to transform them into this state?&lt;/p&gt;&#xA;" OwnerUserId="13390" LastActivityDate="2020-10-04T19:02:24.303" Title="How to make a measurement in a subspace?" Tags="&lt;measurement&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14011" PostTypeId="1" AcceptedAnswerId="14012" CreationDate="2020-10-04T19:35:47.530" Score="3" ViewCount="538" Body="&lt;p&gt;Hadamard gate matrix is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2}\begin{bmatrix}1 &amp;amp;&amp;amp; 1 \\ 1 &amp;amp;&amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Dirac notation for it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|0\rangle+|1\rangle}{\sqrt 2}\langle0|+\frac{|0\rangle-|1\rangle}{\sqrt 2}\langle1|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am unable to understand, how this gate matrix is translated into dirac notation?&lt;/p&gt;&#xA;" OwnerUserId="13392" LastEditorUserId="55" LastEditDate="2020-10-09T07:00:45.283" LastActivityDate="2020-10-09T07:00:45.283" Title="How to translate the Hadamard gate matrix into Dirac notation?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14012" PostTypeId="2" ParentId="14011" CreationDate="2020-10-04T19:52:26.057" Score="6" Body="&lt;p&gt;First remember that each matrix element can be written as outer products in Dirac notation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle\langle 0| = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{bmatrix},|1\rangle\langle 1| = \begin{bmatrix}0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{bmatrix},|1\rangle\langle 0| = \begin{bmatrix}0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}, |0\rangle\langle 1| = \begin{bmatrix}0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{bmatrix}\tag{1}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This can be verified easily, for example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;zero=[0 ; 1], one=[1; 0]&#xA;one*zero'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;gives:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ans =&#xA;   0   1&#xA;   0   0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So now let's write the matrix as a linear combination of outer products in Dirac notation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{2}&#xA;\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 |.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is what you have in your question, especially if you factor out the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from two terms and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; from the other two terms &lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-10-04T19:52:26.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14013" PostTypeId="2" ParentId="14004" CreationDate="2020-10-04T20:06:34.697" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here is a good textbook to start with &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/defining-quantum-circuits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/defining-quantum-circuits.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5175" LastActivityDate="2020-10-04T20:06:34.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14014" PostTypeId="1" AcceptedAnswerId="14015" CreationDate="2020-10-04T20:45:09.713" Score="2" ViewCount="109" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\newcommand{\coefcos}[0]{c_1 c_2 - s_1 s_2 \hat{n}_1 \cdot \hat{n}_2}&#xA;\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}$&lt;/span&gt;This question relates to Exercise 4.15 from Nielsen &amp;amp; Chuang:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;(Composition of single qubit operations)&lt;/strong&gt; The Bloch&#xA;representation gives a nice way to visualize the effect of composing two rotations.&lt;/p&gt;&#xA;&lt;p&gt;(1) Prove that if a rotation through an angle &lt;span class=&quot;math-container&quot;&gt;$\beta_1$&lt;/span&gt; about the axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_1$&lt;/span&gt; is followed by a rotation through an angle &lt;span class=&quot;math-container&quot;&gt;$\beta_2$&lt;/span&gt; about an axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_2$&lt;/span&gt;, then the overall rotation is&#xA;through an angle &lt;span class=&quot;math-container&quot;&gt;$\beta_{12}$&lt;/span&gt; about an axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_{12}$&lt;/span&gt; given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c_{12} = \coefcos \tag{4.19}\label{4.19}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;s_{12} \hat{n}_{12} = \coefsin, \tag{4.20}\label{4.20}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$c_i = \cos \left( \beta_i/2 \right), s_i = \sin \left( \beta_i/2 \right), c_{12} = \cos \left( \beta_{12}/2 \right),$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_{12}= \sin \left( \beta_{12}/2 \right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_2$&lt;/span&gt; are real unit vectors in three dimensions (as stated earlier in the book).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$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}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}$&lt;/span&gt; denotes the three component vector &lt;span class=&quot;math-container&quot;&gt;$(X, Y, Z)$&lt;/span&gt; of Pauli matrices) and taking the product.&lt;/p&gt;&#xA;&lt;p&gt;Now, assume that &lt;span class=&quot;math-container&quot;&gt;$c_{12} \ne 1$&lt;/span&gt;. Then I'd expect to recover the unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_{12}$&lt;/span&gt; if I divide \eqref{4.20} through by &lt;span class=&quot;math-container&quot;&gt;$s_{12} = \pm \sqrt{1 - c_{12}^2}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{n}_{12} = \frac{\coefsin}{ \pm \sqrt{1 - c_{12}^2} } \tag{1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To check that &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_{12}$&lt;/span&gt; is of unit length, I take the dot product with itself:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{n}_{12} \cdot \hat{n}_{12} = &#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\cos (\theta) = \hat{n}_1 \cdot \hat{n}_2 $&lt;/span&gt;. Expanding &lt;span class=&quot;math-container&quot;&gt;$c_{12}$&lt;/span&gt; in the denominator, I get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{n}_{12} \cdot \hat{n}_{12} =&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which tells me that the following equation should hold in order for the numerator and denominator to balance to 1:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I don't think \eqref{4} holds in general: &lt;span class=&quot;math-container&quot;&gt;$c_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; are functions of &lt;span class=&quot;math-container&quot;&gt;$\beta_i$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; however is a function of &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_i$&lt;/span&gt; which I'm free to tune independently of &lt;span class=&quot;math-container&quot;&gt;$\beta_i$&lt;/span&gt;. So I should be able to conjure up values that violate \eqref{4} easily, which tells me that &lt;span class=&quot;math-container&quot;&gt;$\hat{n}_{12}$&lt;/span&gt; is not a unit vector. This seems implausible to me. Where am I making a mistake?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="12643" LastEditDate="2020-10-04T20:50:43.230" LastActivityDate="2020-10-04T21:02:21.270" Title="Does composition of two single qubit rotations yield a single rotation around a unit vector?" Tags="&lt;mathematics&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14015" PostTypeId="2" ParentId="14014" CreationDate="2020-10-04T21:02:21.270" Score="2" Body="&lt;p&gt;You just missed the fact that &lt;span class=&quot;math-container&quot;&gt;$ \hspace{0.3em}||n_1 \times n_2|| = |\text{sin}(\theta)| $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-04T21:02:21.270" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14016" PostTypeId="2" ParentId="13999" CreationDate="2020-10-05T01:44:47.933" Score="1" Body="&lt;p&gt;As per the description in Brassard paper page 5 &amp;quot; ... Operator S&lt;sub&gt;x&lt;/sub&gt; conditionally changes the sign of the amplitudes of the good states ....while the S&lt;sub&gt;0&lt;/sub&gt; operator changes the sign of the amplitude if and only if the state is the zero state |0&amp;gt;. ...&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;The amplitude is multiplied by e&lt;sup&gt;iƟ&lt;/sup&gt; -&amp;gt; S&lt;sub&gt;x&lt;/sub&gt;(Ɵ=φ) and S&lt;sub&gt;0&lt;/sub&gt; (Ɵ=ϕ) .. as given in Theorem 4 further considered in Lemma 5, to pick  φ = ϕ = π which leads to Z gate&lt;/p&gt;&#xA;&lt;p&gt;This is well explained in &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;&#xA;Brassard is a generalized version of Grover.&lt;/p&gt;&#xA;" OwnerUserId="5175" LastActivityDate="2020-10-05T01:44:47.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14017" PostTypeId="1" AcceptedAnswerId="14021" CreationDate="2020-10-05T04:32:09.550" Score="1" ViewCount="68" Body="&lt;p&gt;I visualize Pauli Gates making rotations by π radians about the x, y, and z axes on the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;If this is the case, then how Pauli-X and Pauli-Y gates applied to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; differ? As both should rotate the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state to same location.&lt;/p&gt;&#xA;" OwnerUserId="13392" LastEditorUserId="2879" LastEditDate="2020-10-05T20:52:59.390" LastActivityDate="2020-10-05T20:52:59.390" Title="How do I visualize the action of Pauli $X$ and $Y$ gates on $|0\rangle$?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14018" PostTypeId="1" AcceptedAnswerId="14019" CreationDate="2020-10-05T05:08:39.950" Score="1" ViewCount="101" Body="&lt;p&gt;Hadamard gate matrix is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt2}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrix for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}1 \\ 0\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am unable to understand, how can I apply Hadamard gate on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;? The matrix representing &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is of dimension 2 * 1 and the matrix representing Hadamard gate is of dimension 2 * 2 (so the matrix multiplication is not possible)&lt;/p&gt;&#xA;" OwnerUserId="13392" LastEditorUserId="55" LastEditDate="2020-10-08T17:52:00.213" LastActivityDate="2020-10-18T17:27:11.327" Title="How do I apply a Hadamard gate on a given qubit, in matrix formalism?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;hadamard&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14019" PostTypeId="2" ParentId="14018" CreationDate="2020-10-05T05:17:30.690" Score="4" Body="&lt;p&gt;Applying quantum gates to quantum states is indeed represented as matrix multiplication. To multiply two matrices, you need only one dimension to match:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt2}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -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}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-05T05:17:30.690" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14020" PostTypeId="2" ParentId="14018" CreationDate="2020-10-05T05:17:47.883" Score="4" Body="&lt;p&gt;|0&amp;gt; is actually a vector, not a matrix. Applying the Hadamard gate (shortly, H) to |0&amp;gt; means computing a matrix vector multiplication:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -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}}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2020-10-05T05:17:47.883" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14021" PostTypeId="2" ParentId="14017" CreationDate="2020-10-05T05:22:29.497" Score="2" Body="&lt;p&gt;Applying X gate to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state gives you &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and applying Y gate to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state gives you &lt;span class=&quot;math-container&quot;&gt;$i|1\rangle$&lt;/span&gt;. These states differ only by a global phase (the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;X and Y gates differ in their effect on most other states, though (except &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, which will give you the same issue).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-05T05:22:29.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14022" PostTypeId="2" ParentId="13995" CreationDate="2020-10-05T07:04:28.703" Score="1" Body="&lt;p&gt;You can find a bibliography in the book &lt;em&gt;Quantum Computing: An Applied Approach&lt;/em&gt; (ISBN: 9783030239213) or try directly google scholar.&lt;/p&gt;&#xA;" OwnerUserId="13366" LastActivityDate="2020-10-05T07:04:28.703" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14024" PostTypeId="1" CreationDate="2020-10-05T12:46:25.847" Score="0" ViewCount="44" Body="&lt;p&gt;Assume Charlie has an entangled state like &lt;span class=&quot;math-container&quot;&gt;$\psi_{00}|00\rangle+\psi_{11}|11\rangle,$&lt;/span&gt;, and he wants to send one of the share qubits to Alice and then Alice does a Bell state measurement and then tells Bob the result of two bits, and then Bob recovers Charlie's state. So if Charlie's state is unentangled and for example one bit like &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, then it is obvious. But my question is about the situation that Charlie's state is entangled and then sends one share qubit to Alice. Now, I have some questions according to &lt;a href=&quot;https://cdn.mathpix.com/snip/images/8Mp9FOlHdEyrvPH_HE2PAvOHx_fFoYoB-1fzB2Kz_cE.original.fullsize.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;this circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;img src=&quot;https://cdn.mathpix.com/snip/images/8Mp9FOlHdEyrvPH_HE2PAvOHx_fFoYoB-1fzB2Kz_cE.original.fullsize.png&quot; width=&quot;300&quot;&gt;&#xA;&lt;p&gt;I should also mention that the Bell state of Alice and Bob's qubits is &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle=(|00\rangle+|11\rangle)/\sqrt2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can I understand the step-by-step change of every single qubit in the below circuit?&lt;/li&gt;&#xA;&lt;li&gt;Assume after recovering Charlie's state by Bob, he sends it back to Charlie. So now, How can Charlie have his entangled state again (I really do not understand that)?&lt;/li&gt;&#xA;&lt;li&gt;What happens if &lt;span class=&quot;math-container&quot;&gt;$\psi_{\imath \imath} \rightarrow 1$&lt;/span&gt; for each &lt;span class=&quot;math-container&quot;&gt;$\imath$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\psi_{00}=\psi_{11}$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I should mention that I want also the resultant state for the input &lt;span class=&quot;math-container&quot;&gt;$\psi_{00}|00\rangle+\psi_{11}|11\rangle,$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\psi_{\imath \imath}$&lt;/span&gt; any complex numbers subject to the normalization condition, subject to any one of the four ebit measurements &lt;span class=&quot;math-container&quot;&gt;$\left|b_{1} b_{2}\right\rangle\left\langle b_{1} b_{2}\right|$&lt;/span&gt;, which &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt; is the share qubit that Alice has and &lt;span class=&quot;math-container&quot;&gt;$b_2$&lt;/span&gt; is the share qubit that Bob has.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="55" LastEditDate="2020-10-08T17:37:44.613" LastActivityDate="2020-10-08T17:37:44.613" Title="How is the Ebit measurement (or Bell state measurement), if Charlie has an entangled state?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14025" PostTypeId="1" AcceptedAnswerId="14031" CreationDate="2020-10-05T15:54:56.633" Score="4" ViewCount="81" Body="&lt;p&gt;Coming more from a computer science background, I never really studied tensor products, covariant/contravariant tensors etc. So until now, I was seeing the &amp;quot;tensor product&amp;quot; operation mostly as (what appears to be) a &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kronecker product&lt;/a&gt; between the matrix representation (in some fixed basis) of my vector/linear operator, i.e. if I have two vectors/matrices&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$A = \begin{pmatrix}a_{11} &amp;amp; a_{12} &amp;amp; \cdots \\ a_{21} &amp;amp; a_{22} &amp;amp; \cdots \\ \vdots\end{pmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$B = \begin{pmatrix}b_{11} &amp;amp; b_{12} &amp;amp; \cdots \\ b_{21} &amp;amp; b_{22} &amp;amp; \cdots \\ \vdots\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A \otimes B = \begin{pmatrix}a_{11}B &amp;amp; a_{12}B &amp;amp; \cdots \\ a_{21}B &amp;amp; a_{22}B &amp;amp; \cdots \\ \vdots\end{pmatrix} $$&lt;/span&gt;&#xA;i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A \otimes B = \begin{pmatrix}&#xA;a_{11}b_{11} &amp;amp; a_{11} b_{12} &amp;amp; \cdots &amp;amp; a_{12}b_{11} &amp;amp; a_{12}b_{12} &amp;amp; \cdots \\ a_{11} b_{21} &amp;amp; a_{11} b_{22} &amp;amp; \cdots  &amp;amp; a_{12}b_{21} &amp;amp; a_{12}b_{22} &amp;amp; \cdots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; \vdots &amp;amp; \vdots \\&#xA;a_{21}b_{11} &amp;amp; a_{21} b_{12} &amp;amp; \cdots &amp;amp; a_{22}b_{11} &amp;amp; a_{22}b_{12} &amp;amp; \cdots \\ a_{21} b_{21} &amp;amp; a_{21} b_{22} &amp;amp; \cdots  &amp;amp; a_{22}b_{21} &amp;amp; a_{22}b_{22} &amp;amp; \cdots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; \vdots &amp;amp; \vdots \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In particular, if we consider &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix}1\\0\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix}0\\1\end{pmatrix}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |1\rangle = \begin{pmatrix}0\\0\\0\\1\end{pmatrix}$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |1\rangle$&lt;/span&gt; is a vector.&lt;/p&gt;&#xA;&lt;p&gt;Now, if I look at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor product&lt;/a&gt; webpage of wikipedia, they seem to define &lt;span class=&quot;math-container&quot;&gt;$v \otimes w \colon= v w^T$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$v \otimes w$&lt;/span&gt; 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 &amp;quot;type&amp;quot; isn't it a bit strange to define it like that?). But on the other hand, when &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; are matrices, we are back to the Kronecher product.&lt;/p&gt;&#xA;&lt;p&gt;So here is my question: why do they define the tensor product like that for vector? Is there different &amp;quot;kinds&amp;quot; of tensors? How are they linked with tensors used in physics?&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="9006" LastEditDate="2020-10-06T06:58:44.090" LastActivityDate="2020-10-06T07:26:25.850" Title="Quantum tensor product closer to Kronecker product?" Tags="&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14026" PostTypeId="1" CreationDate="2020-10-05T19:55:43.230" Score="0" ViewCount="18" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Could not run circuit &amp;quot;&amp;quot;&#xA;Cannot read property 'idCode' of null&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Could you please clarify what this means? I tried logging out and in, but nothing seems to work.&lt;/p&gt;&#xA;" OwnerUserId="13407" LastEditorUserId="55" LastEditDate="2020-10-06T05:16:00.117" LastActivityDate="2020-10-06T05:16:00.117" Title="Issue with running a circuit: Cannot read property 'idCode' of null" Tags="&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14027" PostTypeId="1" AcceptedAnswerId="14050" CreationDate="2020-10-05T21:03:08.637" Score="2" ViewCount="70" Body="&lt;p&gt;While reading an &lt;a href=&quot;https://crypto.stackexchange.com/a/84379/18298&quot;&gt;answer&lt;/a&gt; in Cryptography.SE I saw this&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Is there any product that really uses quantum teleportation?&lt;/li&gt;&#xA;&lt;li&gt;Are there any other methods/principles commercially used other than Heisenberg's principle?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4866" LastEditorUserId="55" LastEditDate="2020-10-08T17:23:52.920" LastActivityDate="2020-10-08T17:23:52.920" Title="The Methodology of Quantum Key Distributions Systems" Tags="&lt;teleportation&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14028" PostTypeId="2" ParentId="13989" CreationDate="2020-10-05T21:14:26.943" Score="2" Body="&lt;p&gt;Well, first off you can check the properties of the statevector simulator and the qasm simulator by doing the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import StatevectorSimulator, QasmSimulator&#xA;StatevectorSimulator.DEFAULT_CONFIGURATION&#xA;QasmSimulator.DEFAULT_CONFIGURATION&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;You can also customize the qasm simulator to act like the statevector simulator by adding the parameter &lt;code&gt;backend_options&lt;/code&gt; to your call to &lt;code&gt;execute()&lt;/code&gt; or &lt;code&gt;run()&lt;/code&gt; your circuit with the value &lt;code&gt;backend_options = {&amp;quot;method&amp;quot;: &amp;quot;statevector&amp;quot;}&lt;/code&gt;, and the qasm simulator will return a statevector.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-10-05T21:14:26.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14029" PostTypeId="1" AcceptedAnswerId="14030" CreationDate="2020-10-05T21:21:34.597" Score="0" ViewCount="55" Body="&lt;p&gt;I am running a simple 3 qubit circuit which produces the following results:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'000': 5, '001': 3, '010': 10, '100': 5, '101': 7, '110': 7, '111': 4}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'000': 5, '001': 3, '010': 10,'011': 0, '100': 5, '101': 7, '110': 7, '111': 4}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-08T17:29:42.773" LastActivityDate="2020-10-08T17:29:42.773" Title="Return outputs with zero counts" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14030" PostTypeId="2" ParentId="14029" CreationDate="2020-10-05T21:55:09.643" Score="2" Body="&lt;p&gt;You can use &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.result.Counts.get.html#qiskit.result.Counts.get&quot; rel=&quot;nofollow noreferrer&quot;&gt;.get()&lt;/a&gt; and return zero as the default value.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;res.get('011', 0)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-05T21:55:09.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14031" PostTypeId="2" ParentId="14025" CreationDate="2020-10-05T23:18:07.213" Score="4" Body="&lt;p&gt;The tensor product of two objects with &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; components is an object with &lt;span class=&quot;math-container&quot;&gt;$mn$&lt;/span&gt; components that consists of the pairwise products of the components of the inputs. The Kronecker product and the &lt;span class=&quot;math-container&quot;&gt;$v w^T$&lt;/span&gt; product (vector outer product) are both tensor products by that definition.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The tensor product of objects with &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; indices should naturally have &lt;span class=&quot;math-container&quot;&gt;$k+\ell$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;In the explicit-index tensor notation used in general relativity and particle physics, there is no operation of &amp;quot;matrix multiplication&amp;quot; and you instead always write it out explicitly. Instead of &lt;span class=&quot;math-container&quot;&gt;$M=NP$&lt;/span&gt; you write &lt;span class=&quot;math-container&quot;&gt;$M_{ac} = \sum_b N_{ab} P_{bc}$&lt;/span&gt;, or just &lt;span class=&quot;math-container&quot;&gt;$M_{ac} = N_{ab} P_{bc}$&lt;/span&gt; where the doubling of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; signals that it should be summed over. There's also no Kronecker product; you instead just generalize the outer product and use &lt;span class=&quot;math-container&quot;&gt;$k+\ell$&lt;/span&gt; indices. Instead of &lt;span class=&quot;math-container&quot;&gt;$|ψ'\rangle = (I\otimes H\otimes I)|ψ\rangle$&lt;/span&gt; you'd write &lt;span class=&quot;math-container&quot;&gt;$ψ'_{ab'c} = H_{b'b} ψ_{abc}$&lt;/span&gt;. 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.)&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2020-10-05T23:18:07.213" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14032" PostTypeId="1" CreationDate="2020-10-06T06:13:52.537" Score="2" ViewCount="66" Body="&lt;ol&gt;&#xA;&lt;li&gt;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...)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w98w2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w98w2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;If so, should I generally expect that arbitrary state preparation algorithms (such as &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;) can be adapted to preparing real-amplitude states by replacing all the single-qubit rotations with &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;'s?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2020-10-06T06:13:52.537" Title="Preparing arbitrary two- and multi-qubit states with real amplitudes" Tags="&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14033" PostTypeId="1" AcceptedAnswerId="14036" CreationDate="2020-10-06T06:21:36.360" Score="1" ViewCount="104" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in \mathbb{C}^{2n}$&lt;/span&gt; be a random quantum state such that &lt;span class=&quot;math-container&quot;&gt;$ |\langle z| \psi \rangle|^{2} $&lt;/span&gt; is distributed according to a &lt;span class=&quot;math-container&quot;&gt;$\text{Dirichlet}(1, 1, \ldots, 1)$&lt;/span&gt; distribution, for &lt;span class=&quot;math-container&quot;&gt;$z \in \{0, 1\}^{n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$z_{1}, z_{2}, \ldots, z_{k}$&lt;/span&gt; be &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; samples from this distribution (not all unique). Choose a &lt;span class=&quot;math-container&quot;&gt;$z^{*}$&lt;/span&gt; that appears most frequently.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I am trying to prove:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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],$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is a random variable that denotes the frequency of &lt;span class=&quot;math-container&quot;&gt;$z^{*}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;I am also trying to prove that for the collection &lt;span class=&quot;math-container&quot;&gt;$z_{1}, z_{2}, \ldots, z_{k}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{i \neq j}\mathrm{Pr}[z_{i} = z_{j}] =  {n \choose k}\frac{2}{2^{n} + 1}. $$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Basically, I am trying to trace the steps of Lemma &lt;span class=&quot;math-container&quot;&gt;$13$&lt;/span&gt; (page 10) of this &lt;a href=&quot;https://arxiv.org/pdf/2008.08721.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum paper&lt;/a&gt;. 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?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-10-08T15:44:57.703" LastActivityDate="2020-10-08T15:44:57.703" Title="Dirichlet distribution: posteriors and priors of distribution" Tags="&lt;complexity-theory&gt;&lt;quantum-advantage&gt;&lt;probability&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14034" PostTypeId="2" ParentId="14025" CreationDate="2020-10-06T07:26:25.850" Score="1" Body="&lt;p&gt;In quantum computing, we compute the tensor product exactly as you specify. This includes the case of taking a tensor product with two vectors.&lt;/p&gt;&#xA;&lt;p&gt;Now, it is also true that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\phi|$&lt;/span&gt; can be thought of as a tensor product between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|$&lt;/span&gt;. But in QC we would never define the tensor product between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; to be that.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-06T07:26:25.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14035" PostTypeId="1" CreationDate="2020-10-06T08:54:54.187" Score="0" ViewCount="62" Body="&lt;p&gt;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&amp;gt;, what happens when the gate fails? What is the state after this?&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-08T15:12:53.363" LastActivityDate="2020-10-08T15:12:53.363" Title="What do the &quot;gate errors rates&quot; mean physically for IBM's quantum computers?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14036" PostTypeId="2" ParentId="14033" CreationDate="2020-10-06T08:55:08.650" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$ p_i = |\langle i | \phi \rangle|^2 \sim Dir(a_1, .., a_{2^n}) = Dir(1, .., 1) $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ m_i $&lt;/span&gt; the occurences of outcome &lt;span class=&quot;math-container&quot;&gt;$ |i\rangle $&lt;/span&gt; on samples &lt;span class=&quot;math-container&quot;&gt;$z_1, .. z_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since the Dirichlet distribution is the conjugate prior of the categorical (see &lt;a href=&quot;https://en.wikipedia.org/w/index.php?title=Dirichlet_distribution&amp;amp;section=8#Conjugate_to_categorical/multinomial&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), meaning&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \bf{p} $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$| Z, (1, .. 1), $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\bf{m} $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$ \sim Dir(2^n, $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\bf{m} + 1$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;and using the formula for the mean value of Dirichlet we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \mathbb{E}[p_{z*} | m] = \frac{m+1}{\sum_{j=1}^{2^n} (m_j + 1)} = \frac{m+1}{2^n + k} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the second claim, take &lt;span class=&quot;math-container&quot;&gt;$ i \neq j $&lt;/span&gt; and compute&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\mathbb{P}[z_i = z_j] &#xA;&amp;amp;= \int \mathbb{P}[z_i = z_j | (p_1, .. p_{2^n})] \cdot f(p_1, .. p_{2^n}) \\&#xA;&amp;amp;= \int \sum_{k=0}^{2^n} p_k^2 \cdot f(p_1, .. p_{2^n}) \\&#xA;&amp;amp;= \sum_{k=0}^{2^n} \mathbb{E}[p_k^2] \\&#xA;&amp;amp;= \sum_{k=0}^{2^n} \frac{2}{2^n(2^n + 1)} = \frac{2}{2^n + 1}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(the last equality holds since &lt;span class=&quot;math-container&quot;&gt;$ \bf{x} $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$ \sim Dir($$\bf{a}$&lt;/span&gt;) &lt;span class=&quot;math-container&quot;&gt;$ \implies \mathbb{E}[x_i^2] = \frac{a_i(a_i + 1)}{a_0(a_0 + 1)} $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ a_0 = \sum_{i=1}^{N} a_i $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$ \sum_{i \neq j} \mathbb{P}[z_i = z_j] = {k \choose 2} \frac{2}{2^n + 1} $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-10-06T09:38:01.977" LastActivityDate="2020-10-06T09:38:01.977" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="14037" PostTypeId="1" CreationDate="2020-10-06T13:29:08.737" Score="6" ViewCount="179" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma\in\text{L}(\mathcal{H}_{XAB})$&lt;/span&gt; be given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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, $$&lt;/span&gt;&#xA;and consider operators &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; be given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ M = \sum_x |x\rangle\langle x|\otimes M_x, \quad\quad M_x\geq 0, \quad \sum_x M_x = id, $$&lt;/span&gt;&#xA;that is &lt;span class=&quot;math-container&quot;&gt;$\{M_x\}$&lt;/span&gt; is a POVM measurement. Now suppose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \lVert M(\rho-\sigma)\rVert_1 = \sum_x \left|\operatorname{Tr}M_x(p_x\rho_x - q_x\sigma_x)\right| = 0 $$&lt;/span&gt;&#xA;for all measurement operators &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; given as above, where &lt;span class=&quot;math-container&quot;&gt;$\{M_x\}$&lt;/span&gt; is implementable by LOCC. Do we necessarily have &lt;span class=&quot;math-container&quot;&gt;$\rho = \sigma$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Using &lt;span class=&quot;math-container&quot;&gt;$M_x = id/|X|$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$p_x = q_x$&lt;/span&gt;, and I have shown it is true for &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma$&lt;/span&gt; pure using Schmidt decomposition, so I do believe it should be possible to prove &lt;span class=&quot;math-container&quot;&gt;$\rho_x = \sigma_x$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, but I have not managed to do so.&lt;/p&gt;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="12421" LastEditorUserId="12421" LastEditDate="2020-10-13T14:15:58.553" LastActivityDate="2021-03-12T15:06:05.603" Title="Are perfectly LOCC-indistinguishable states necessarily identical?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;density-matrix&gt;&lt;locc-operation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14038" PostTypeId="1" AcceptedAnswerId="14039" CreationDate="2020-10-06T14:04:29.787" Score="3" ViewCount="133" Body="&lt;p&gt;Quantum annealers are single purpose machines allowing to solve quadratic unconstrained binary optimization (QUBO) problems. QUBO problems have following objective function:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F=-\sum_{i&amp;lt;j}J_{ij}x_ix_j-\sum_{i=1}^N h_ix_i,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; is a binary varibale and &lt;span class=&quot;math-container&quot;&gt;$h_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$J_{ij}$&lt;/span&gt; are coefficients.&#xA;Such objective function is equivalent to Ising Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{\text{ISING}}=-\sum_{i&amp;lt;j}J_{ij}(\sigma^z_i\otimes\sigma^z_j)-\sum_{i=1}^N h_i\sigma^z_i,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma^z_i$&lt;/span&gt; is Pauli Z gate acting on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit and there are identity operators on other qubits, tensor product &lt;span class=&quot;math-container&quot;&gt;$\sigma^z_i\otimes\sigma^z_j$&lt;/span&gt; means that Z gates act on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;th qubits and there are identity operators on other qubits.&lt;/p&gt;&#xA;&lt;p&gt;Quantum annealers physically implements simulation of Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(t)=\Big(1-\frac{t}{T}\Big)\sum_{i=1}^N h_i\sigma^x_i+\frac{t}{T}H_{\text{ISING}},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is a time, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; total time of simulation and &lt;span class=&quot;math-container&quot;&gt;$\sigma^x_i$&lt;/span&gt; is Pauli X gate acting on &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit.&#xA;Initial state of a quantum annealer is equal superposition of all qubits which is ground state of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(0)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Quantum Approximate Optimization Algorithm (QAOA) is described by an operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\beta, \gamma) = \prod_{i=1}^{p}U_B(\beta_i)U_C(\gamma_i),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is number of iteration of QAOA,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_B(\beta) = \mathrm{e}^{-i\beta\sum_{i=1}^N \sigma^x_i},&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)}.&#xA;$$&lt;/span&gt;&#xA;Initial state for QAOA is &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}|0\rangle ^{\otimes n}$&lt;/span&gt;, i.e. equally distributed superposition as in case of the quantum annealer.&lt;/p&gt;&#xA;&lt;p&gt;Since time evolution of quantum system described by Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; from state &lt;span class=&quot;math-container&quot;&gt;$|\psi(0)\rangle$&lt;/span&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle$&lt;/span&gt; is expressed by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi(t)\rangle = \mathrm{e}^{-iHt}|\psi(0)\rangle,&#xA;$$&lt;/span&gt;&#xA;it seems that operator &lt;span class=&quot;math-container&quot;&gt;$U(\beta, \gamma)$&lt;/span&gt; from QAOA is simply simulation of Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt; describing quantum annealer beacause exponents of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}$&lt;/span&gt; are sums in Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt; is composed of two term containing Pauli matrices X and Z and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{A+B}=\mathrm{e}^A\mathrm{e}^B$&lt;/span&gt; is valid only for commuting matrices &lt;span class=&quot;math-container&quot;&gt;$[A,B]=O$&lt;/span&gt;. But Pauli matrices X and Z fulfil anti-commutation relation &lt;span class=&quot;math-container&quot;&gt;$\{X,Z\}=O$&lt;/span&gt;, not the commutation one.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So my questions are these:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Can QAOA be realy considered as a simulation of quantum annealer on gate-based universal quantum computer?&lt;/li&gt;&#xA;&lt;li&gt;What I am missing in discussion above concerning commutation of Pauli matrices? Or is there any condition for matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; allowing equality &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{A+B}=\mathrm{e}^A\mathrm{e}^B$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-10-07T09:00:21.687" LastActivityDate="2020-10-07T09:00:21.687" Title="Can QAOA be considered as simulation of a quantum annealer on a gate-based quantum computer?" Tags="&lt;pauli-gates&gt;&lt;optimization&gt;&lt;annealing&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14039" PostTypeId="2" ParentId="14038" CreationDate="2020-10-06T16:11:01.830" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;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 &lt;span class=&quot;math-container&quot;&gt;$p \to \infty$&lt;/span&gt; in the operator&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(\beta, \gamma) = \Pi_{i=1}^p U_B(\beta_i)U_C(\gamma_i)  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Your are right about the commutation problem. However, remember that&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \lim_{p \to \infty} \big(e^{A/p}e^{B/p} \big)^p = e^{A+B} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so in a sense, at infinite limit depth, it is not a problem. So you recover the quantum annealing approach.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9006" LastEditDate="2020-10-07T08:59:17.067" LastActivityDate="2020-10-07T08:59:17.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14040" PostTypeId="1" CreationDate="2020-10-06T17:58:47.210" Score="2" ViewCount="132" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import BasicAer&#xA;import logging&#xA;from qiskit.chemistry import set_qiskit_chemistry_logging&#xA;set_qiskit_chemistry_logging(logging.ERROR) &#xA;&#xA;# chemistry related modules&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;&#xA;&#xA;from qiskit.aqua.algorithms import VQE, NumPyEigensolver&#xA;import numpy as np&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.aqua.components.optimizers import L_BFGS_B&#xA;from qiskit.aqua.operators import Z2Symmetries&#xA;&#xA;&#xA;def get_qubit_op(atom,basis,map_type ):&#xA;    driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, &#xA;                         charge=0, spin=0, basis=basis)&#xA;    molecule = driver.run()&#xA;    num_particles = molecule.num_alpha + molecule.num_beta    &#xA;    num_spin_orbitals = molecule.num_orbitals * 2    &#xA;    ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)&#xA;    &#xA;    qubitOp = ferOp.mapping(map_type=map_type, threshold=0.00000001)&#xA;    qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)        &#xA;    &#xA;    return qubitOp, num_particles, num_spin_orbitals&#xA;&#xA;import timeit&#xA;&#xA;start = timeit.default_timer()&#xA;&#xA;&#xA;atom = 'H .0 .0 .0; H .0 .0 1.5 ; H .0 .0 3.0 ; H .0 .0 4.5 '&#xA;&#xA;basis='sto3g'&#xA;&#xA;map_type = 'parity'&#xA;&#xA;qubitOp, num_particles, num_spin_orbitals = get_qubit_op(atom,basis,map_type )&#xA;&#xA;print('Ground state energy is' , NumPyEigensolver( qubitOp ).run().eigenvalues )&#xA;&#xA;    &#xA;init_state = HartreeFock( num_spin_orbitals , num_particles , map_type )&#xA;&#xA;# set the backend for the quantum computation=&#xA;backend = BasicAer.get_backend('statevector_simulator')&#xA;&#xA;# setup a classical optimizer for VQE&#xA;optimizer = L_BFGS_B()&#xA;print( init_state.bitstr )&#xA;&#xA;var_form_vqe = UCCSD(&#xA;        num_orbitals=num_spin_orbitals,&#xA;        num_particles=num_particles,&#xA;        initial_state=init_state,&#xA;        qubit_mapping=map_type &#xA;    )&#xA;&#xA;algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer  )&#xA;&#xA;result_vqe = algorithm_vqe.run(backend)&#xA;&#xA;print( 'eigenvalue = ' , result_vqe['eigenvalue' ] )&#xA;&#xA;stop = timeit.default_timer()&#xA;&#xA;print('The run time of this part: ', stop - start)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output is below, and as you can see, they differ quite significantly.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Ground state energy is [-3.52488449+5.88070795e-18j]&#xA;[False False  True False False  True]&#xA;eigenvalue =  (-3.523526951494827+0j)&#xA;The run time of this part:  57.303660957000034&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2020-10-08T15:07:31.647" LastActivityDate="2020-10-08T15:07:31.647" Title="Why VQE gives an incorrect ground state energy for a chain of 4 hydrogen atoms?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14041" PostTypeId="2" ParentId="14040" CreationDate="2020-10-06T19:59:52.783" Score="1" Body="&lt;p&gt;&lt;strong&gt;I think&lt;/strong&gt; this has to do with the fact that the &lt;code&gt;var_form&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Maybe you should try UCCSDT or some other var_form that have greater expressibility.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9006" LastEditDate="2020-10-07T09:03:25.250" LastActivityDate="2020-10-07T09:03:25.250" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14042" PostTypeId="2" ParentId="14035" CreationDate="2020-10-07T07:08:57.187" Score="1" Body="&lt;p&gt;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 &lt;code&gt;NoiseModel.from_backend&lt;/code&gt;, whose documentation can help you: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.from_backend.html#qiskit.providers.aer.noise.NoiseModel.from_backend&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.from_backend.html#qiskit.providers.aer.noise.NoiseModel.from_backend&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-10-07T07:08:57.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14043" PostTypeId="1" AcceptedAnswerId="14047" CreationDate="2020-10-07T17:58:57.197" Score="3" ViewCount="96" Body="&lt;p&gt;I am new to quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13392" LastEditorUserId="13392" LastEditDate="2020-10-07T18:23:31.317" LastActivityDate="2020-10-08T11:42:01.227" Title="Benefit of phase shift in quantum computing" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14044" PostTypeId="1" AcceptedAnswerId="14045" CreationDate="2020-10-07T19:34:45.627" Score="1" ViewCount="64" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5217" LastEditorUserId="55" LastEditDate="2020-10-09T07:44:30.547" LastActivityDate="2020-10-09T07:44:30.547" Title="How can I run a job as offline on real hardware?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14045" PostTypeId="2" ParentId="14044" CreationDate="2020-10-07T20:46:35.490" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_vigo')&#xA;job = execute(circuits, backend)&#xA;print(job.job_id())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once the job is submitted, you can turn off your laptop. Then when you're ready to get the results, do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result = backend.retrieve_job(job_id).result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you forget to write down the job ID, you can always find it on the IQX dashboard or use &lt;code&gt;backend.jobs()&lt;/code&gt; to query for it.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-10-07T20:46:35.490" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14046" PostTypeId="2" ParentId="14044" CreationDate="2020-10-07T20:55:01.883" Score="1" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job.job_id()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;provider = IBMQ.load_account() #or you can specify the provider with IBMQ.get_provider(hub=..., group=..., project=...)&#xA;backend = provider.backends.&amp;lt;backend_name&amp;gt;&#xA;job = backend.retrieve_job(&amp;lt;job_id&amp;gt;)&#xA;job.status()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And you will have your job stored in the variable &lt;code&gt;job&lt;/code&gt;. The command &lt;code&gt;job.status()&lt;/code&gt; helps you see what stage your job is in. If the output is DONE, then you can retrieve your results.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-10-07T20:55:01.883" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14047" PostTypeId="2" ParentId="14043" CreationDate="2020-10-07T21:05:29.640" Score="4" Body="&lt;p&gt;Note that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ X |0\rangle = |1\rangle \hspace{1 cm} X|1\rangle = |0\rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Y |0\rangle = i|1\rangle \hspace{1 cm} Y|1\rangle = -i|0\rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$X \neq iY$&lt;/span&gt;. In fact, the set &lt;span class=&quot;math-container&quot;&gt;$\{I, X, Y, Z\}$&lt;/span&gt; is an orthogonal basis set for &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; matrices. They are not just some factor off from each other. They are independent from one another.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;As for overall phase on quantum gate, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; v.s &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}U$&lt;/span&gt; , these two are indistinguishable as long as you don't do any control operation. That is, controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not the same as controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{i\theta }U$&lt;/span&gt; . This is because the phase of the target qubit can be kicked back to the controlled-qubit and it is essentially how &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum phase estimation algorithm&lt;/a&gt; works.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-07T21:05:29.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14048" PostTypeId="2" ParentId="13956" CreationDate="2020-10-07T21:24:57.607" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;On the side note, by looking at the code from the linked you provided, I see this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;device = provider.get_backend(&amp;quot;ibmq_vigo&amp;quot;)&#xA;coupling_map = device.configuration().coupling_map&#xA;noise_model = NoiseModel.from_backend(device.properties())&#xA;quantum_instance = QuantumInstance(backend=backend, &#xA;                                   shots=1000, &#xA;                                   noise_model=noise_model, &#xA;                                   coupling_map=coupling_map,&#xA;                                   measurement_error_mitigation_cls=CompleteMeasFitter,&#xA;                                   cals_matrix_refresh_period=30)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I just want to point out that by performing &lt;code&gt;measurement_error_mitigation&lt;/code&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of qubit you are using) matrix to mitigate the measurement error.&lt;/p&gt;&#xA;&lt;p&gt;For the case of Manhattan, assuming that you are using all of the qubit then this is &lt;span class=&quot;math-container&quot;&gt;$2^{65} \times 2^{65}$&lt;/span&gt; matrix! It would takes years (maybe?).&lt;/p&gt;&#xA;&lt;p&gt;As for why do we need to we need to create &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; matrix, this is because you are creating &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; eigenstate and measure each of them. Says you have &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-qubit, and you want to understand how much error is happening in your measurement, what you do is then to prepare the &lt;span class=&quot;math-container&quot;&gt;$2^3$&lt;/span&gt; eigenstates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle, |001\rangle, \cdots, |111\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and make measurement on them. Measuring the first eigenstate will give you some probability distribution  like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix} &#xA;0.80\\&#xA;0.02\\&#xA;0.04\\&#xA;0.01\\&#xA;0.03\\&#xA;0.05\\&#xA;0.04\\&#xA;0.01\\&#xA;\end{pmatrix} \hspace{1 cm} $$&lt;/span&gt;&#xA;You do this for the other 7 eigenstates, and hence you formed an &lt;span class=&quot;math-container&quot;&gt;$2^3 \times 2^3$&lt;/span&gt; matrix, says &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. Then by operate &lt;span class=&quot;math-container&quot;&gt;$M^{-1}$&lt;/span&gt; to the probability vector you generated by measuring some state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;, you will be able to recover (to some extent) the result that doesn't have the read out error.&lt;/p&gt;&#xA;&lt;p&gt;As you can see, this is a very expensive process. And that is why your simulation is taking forever.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-07T22:45:05.740" LastActivityDate="2020-10-07T22:45:05.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14049" PostTypeId="1" AcceptedAnswerId="14052" CreationDate="2020-10-07T21:47:47.023" Score="2" ViewCount="102" Body="&lt;p&gt;Often in quantum computing the idea of quantum &lt;strong&gt;superposition&lt;/strong&gt; is introduced well before the concept of &lt;strong&gt;entanglement&lt;/strong&gt;.  I suspect this may be because our conception of (classical) computing privileges &lt;em&gt;bits&lt;/em&gt;, and hence we also privilege &lt;em&gt;qubits&lt;/em&gt; in a Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;.  It's easy enough to consider a single qubit in superposition, but transitioning to entanglement requires a plurality of such particles.&lt;/p&gt;&#xA;&lt;p&gt;Or does it?&lt;/p&gt;&#xA;&lt;p&gt;For example, suppose we lived in a world that privileged qudits, with &lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt;; 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 &lt;span class=&quot;math-container&quot;&gt;$\{\vert 0\rangle,\vert 1\rangle,\vert 2\rangle,\vert 3\rangle\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can think of a particle in a superposition of &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi\rangle=\frac{1}{\sqrt{2}}\vert 0\rangle\pm\vert 3\rangle$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\vert\Phi\rangle=\frac{1}{\sqrt{2}}\vert 1\rangle\pm\vert 2\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now if we envision our (single) qudit instead as two virtual qubits, with a mapping/isomorphism such as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert 0\rangle_{qudit}=\vert 00\rangle_{qubit}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert 1\rangle_{qudit}=\vert 01\rangle_{qubit}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert 2\rangle_{qudit}=\vert 10\rangle_{qubit}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert 3\rangle_{qudit}=\vert 11\rangle_{qubit},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then we can see that both &lt;span class=&quot;math-container&quot;&gt;$\vert \Psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert \Phi\rangle$&lt;/span&gt; are the Bell states, e.g. are entangled.&lt;/p&gt;&#xA;&lt;p&gt;This works nicely for &lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt; or any other power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.  But would it work for any other dimension, such as &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Can we decompose a qutrit that is in superposition into smaller components, and ask whether the qutrit thusly is in some sense entangled?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-10-08T07:59:34.693" Title="Can a single qutrit in superposition be considered entangled?" Tags="&lt;entanglement&gt;&lt;superposition&gt;&lt;qudit&gt;&lt;qutrit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14050" PostTypeId="2" ParentId="14027" CreationDate="2020-10-08T04:57:35.407" Score="3" Body="&lt;p&gt;&lt;strong&gt;1. Existing Products&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've not yet come across commercial systems using entanglement based schemes.  The commercial products I've seen, like &lt;a href=&quot;https://www.idquantique.com/quantum-safe-security/overview/&quot; rel=&quot;nofollow noreferrer&quot;&gt;ID Quantique&lt;/a&gt; and &lt;a href=&quot;https://www.magiqtech.com/company/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MagiQ&lt;/a&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1008.4593&quot; rel=&quot;nofollow noreferrer&quot;&gt;got hacked&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If you're willing to consider government activity (which will certainly have a commercial aspect), China has accomplished &lt;a href=&quot;https://arxiv.org/abs/1707.01339&quot; rel=&quot;nofollow noreferrer&quot;&gt;satellite-based QKD&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;2. Methods&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Based on the information I've seen, the high-level scheme used in the satellite-based QKD with entanglement noted above is as follows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The satellite generates entangled photon pairs and directs half of each pair to two geographically separated parties.&lt;/li&gt;&#xA;&lt;li&gt;The two parties use incoming entangled photon pairs to perform a &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;CHSH&lt;/a&gt; test.&lt;/li&gt;&#xA;&lt;li&gt;The parties classically/publicly communicate regarding measurement bases used during the test (critically there is no public discussion of measurement outcomes).&lt;/li&gt;&#xA;&lt;li&gt;Based on each party's private measurement outcome data and collective basis information, the parties determine whether the CHSH inequality was violated.&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-10-08T04:57:35.407" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14051" PostTypeId="1" AcceptedAnswerId="14053" CreationDate="2020-10-08T07:08:35.167" Score="3" ViewCount="88" Body="&lt;p&gt;I have two questions regarding the exercise 9.2.8 of Quantum information by Wilde, which is as follows:&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma \in \mathcal{D}(\mathcal{H}_A)$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N: L(H}_A)\rightarrow \mathcal{L(H}_B)$&lt;/span&gt; be a quantum channel. Show that the fidelity is monotone w.r.t. the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho,\sigma)\leq F(\mathcal{N}(\rho),\mathcal{N}(\sigma))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\max_{U} &amp;lt;\phi^\rho|_{RA}(U_R\otimes I_A)|\phi^\sigma&amp;gt; $&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(\rho)$&lt;/span&gt;. Even if using the canonical purification, it needs the square root of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(\rho)$&lt;/span&gt; which I don't know how to obtain.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thanks a lot. I appreciate any help or comment.&lt;/p&gt;&#xA;" OwnerUserId="13426" LastEditorUserId="55" LastEditDate="2020-10-08T17:53:39.800" LastActivityDate="2020-10-08T17:53:39.800" Title="The proof of monotonicity of fidelity for channels and its meaning" Tags="&lt;quantum-state&gt;&lt;fidelity&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14052" PostTypeId="2" ParentId="14049" CreationDate="2020-10-08T07:59:34.693" Score="5" Body="&lt;p&gt;To talk about entanglement, you have to first identify subsystems. In your &lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt; example, you defined an isomorphism &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^4\simeq \mathbb{C}^2\otimes\mathbb{C}^2$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt;, this is never possible. Why? Because you have to single out &lt;em&gt;subsystems&lt;/em&gt; i.e. you have to define a tensor product structure. But necessarily, if your Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$\mathcal H \simeq \mathcal H_1 \otimes \mathcal H_2$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\dim\mathcal H = \dim \mathcal H_1 \times \dim\mathcal H_2$&lt;/span&gt;. So if &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt; has prime dimension, it cannot be factored (non-trivially). The trivial factorisation is of course always possible, this is &lt;span class=&quot;math-container&quot;&gt;$\mathcal H \simeq \mathcal H \otimes \mathbb C$&lt;/span&gt;. But you can easily see that in this case, no entanglement is possible.&lt;/p&gt;&#xA;&lt;p&gt;(Maybe unrelated) note: I have observed multiple times that people confuse subsystems with subspaces. Subspace give rise to a direct sum decomposition, most commonly &lt;span class=&quot;math-container&quot;&gt;$\mathcal H = U\oplus U^\perp$&lt;/span&gt;. This is vastly different from a tensor product structure!&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2020-10-08T07:59:34.693" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14053" PostTypeId="2" ParentId="14051" CreationDate="2020-10-08T09:19:40.957" Score="3" Body="&lt;p&gt;&lt;strong&gt;Part 1&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Monotonicity under channels is sometimes also referred to as satisfying a &lt;em&gt;data-processing inequality&lt;/em&gt;. One way to prove this is to use a variational formula for the fidelity function, see Theorem 3.17 and the subsequent discussions in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;TQI - Watrous&lt;/a&gt;. 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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;F(\rho, \sigma) = \,&amp;amp;\max_{X} \quad\mathrm{Tr}[X + X^*]/2 \\&#xA;&amp;amp;\,\,\mathrm{s.t.} \quad \begin{pmatrix} \rho &amp;amp; X \\ X^* &amp;amp; \sigma \end{pmatrix}\geq 0&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;where the maximization is over all linear operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on the Hibert space which &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; act on.&lt;/p&gt;&#xA;&lt;p&gt;Now take any quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; and take any feasible point &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; for the SDP characterization of &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma)$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; is a completely positive map we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} \rho &amp;amp; X \\ X^* &amp;amp; \sigma \end{pmatrix}\geq 0 \implies \begin{pmatrix} \mathcal{N}(\rho) &amp;amp; \mathcal{N}(X) \\ \mathcal{N}(X)^* &amp;amp; \mathcal{N}(\sigma) \end{pmatrix}\geq 0.&#xA;$$&lt;/span&gt;&#xA;Furthermore we have &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[X + X^*]/2 = \mathrm{Tr}[\mathcal{N}(X) + \mathcal{N}(X)^*]/2$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; is trace-preserving. Thus we have shown that for each feasible point &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; of the SDP for &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma)$&lt;/span&gt; we can define a feasible point &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(X)$&lt;/span&gt; of the SDP for &lt;span class=&quot;math-container&quot;&gt;$F(\mathcal{N}(\rho), \mathcal{N}(\sigma))$&lt;/span&gt; which has the &lt;em&gt;same&lt;/em&gt; objective value. As we are taking a maximization over all feasible points it follows that we must have &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma) \leq F(\mathcal{N}(\rho), \mathcal{N}(\sigma))$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Part 2&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;First note that it is the same channel that is being applied to the two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. So if for example &lt;span class=&quot;math-container&quot;&gt;$\rho = \sigma$&lt;/span&gt; and they have perfect fidelity then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(\rho) = \mathcal{N}(\sigma)$&lt;/span&gt; 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., &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(\rho) = \mathrm{Tr}[\rho] I/d$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}(\rho) = \mathcal{N}(\sigma)$&lt;/span&gt; for any two states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. Thus even those that previously had fidelity &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; will have, after sending them through this maximally noisy channel, perfect fidelity.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma)$&lt;/span&gt; really characterizes our ability to distinguish &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; 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. &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma) \not\geq F(\mathcal{N}(\rho), \mathcal{N}(\sigma))$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-10-08T09:19:40.957" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14054" PostTypeId="2" ParentId="14043" CreationDate="2020-10-08T11:42:01.227" Score="2" Body="&lt;p&gt;You can consider X and Z gates as &amp;quot;inversion&amp;quot; in computational basis and circular and Hadamard bases, respectively.&lt;/p&gt;&#xA;&lt;p&gt;Lets start with X. It holds that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X|0\rangle = |1\rangle\,\,\,\,\,\,\ X|1\rangle = |0\rangle,&#xA;$$&lt;/span&gt;&#xA;so X is analogical to classical negation, i.e. it converts 0 to 1 and conversely.&lt;/p&gt;&#xA;&lt;p&gt;Instead of computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt;, you can express qubits as combination of members of Hadamard basis &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)&#xA;\\&#xA;|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can verify that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z|+\rangle = |-\rangle\,\,\,\,\,\,\ Z|-\rangle = |+\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Circular basis is composed of &lt;span class=&quot;math-container&quot;&gt;$\{|\uparrow\rangle, |\downarrow\rangle\}$&lt;/span&gt; (&lt;em&gt;note that I was not able to find proper symbol for circular arrows&lt;/em&gt;), where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\uparrow\rangle = \frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)&#xA;\\&#xA;|\downarrow\rangle = \frac{1}{\sqrt{2}}(|0\rangle-i|1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can again verify that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z|\uparrow\rangle = |\downarrow\rangle\,\,\,\,\,\,\ Z|\downarrow\rangle = |\uparrow\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;All Pauli gates also define rotation around axes x, y and z. Consider &lt;span class=&quot;math-container&quot;&gt;$A \in \{X,Y,Z\}$&lt;/span&gt; then rotation by angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; around axis &lt;span class=&quot;math-container&quot;&gt;$a \in \{x,y,z\}$&lt;/span&gt; is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_a(\theta) = \mathrm{e}^{-i\frac{\theta}{2}A}&#xA;$$&lt;/span&gt;&#xA;Note that the exponential is so-called &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_exponential&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix exponential&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-08T11:42:01.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14056" PostTypeId="1" AcceptedAnswerId="14057" CreationDate="2020-10-08T13:22:47.940" Score="0" ViewCount="77" Body="&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.ignis.verification.randomized_benchmarking_seq.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;randomized_benchmarking_seq&lt;/code&gt;&lt;/a&gt; do not seem to follow this for the following reasons:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Random circuits do &lt;strong&gt;NOT&lt;/strong&gt; contain T, iSWAP and CZ gates&lt;/li&gt;&#xA;&lt;li&gt;Random circuits do contain CX gates&lt;/li&gt;&#xA;&lt;li&gt;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&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Is this observation correct? and if so what is the actual distribution for &lt;code&gt;randomized_benchmarking_seq&lt;/code&gt;? and how can uniformly distributed random circuits be generated?&lt;/p&gt;&#xA;" OwnerUserId="12248" LastEditorUserId="55" LastEditDate="2020-10-09T07:42:42.820" LastActivityDate="2020-10-09T08:16:33.827" Title="What is the Clifford gates selection probability distribution used in the generation of randomized benchmarking circuits?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;random-quantum-circuit&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14057" PostTypeId="2" ParentId="14056" CreationDate="2020-10-08T13:49:35.113" Score="0" Body="&lt;p&gt;Random Clifford elements are generated using the following function:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.random_clifford.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.quantum_info.random_clifford.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then they are synthesized into basic gates (CX, S, Sdg, H, Paulis) using the following function:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Clifford.to_circuit.html#qiskit.quantum_info.Clifford.to_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Clifford.to_circuit.html#qiskit.quantum_info.Clifford.to_circuit&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is based on the following paper:&lt;/p&gt;&#xA;&lt;p&gt;S. Bravyi and D. Maslov, Hadamard-free circuits expose the structure of the Clifford group. &lt;a href=&quot;https://arxiv.org/abs/2003.09412&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2003.09412&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For a simpler explanation on the structure of the 1-qubit and 2-qubit Clifford groups see the following tutorial:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/terra/qis_adv/Clifford_Group.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/terra/qis_adv/Clifford_Group.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13433" LastEditorUserId="13433" LastEditDate="2020-10-09T08:16:33.827" LastActivityDate="2020-10-09T08:16:33.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14058" PostTypeId="1" AcceptedAnswerId="14060" CreationDate="2020-10-08T15:48:53.230" Score="3" ViewCount="249" Body="&lt;p&gt;I want to use the Qiskit transpile function to decompose an arbitrary unitary matrix/ quantum circuit into a special kind of basis gates.&#xA;(&lt;code&gt;from qiskit.compiler import transpile&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;p&gt;But for me it seems the only accepted basis gates are 'u1', 'u2', 'u3' and 'cx'.&#xA;Is there a way to use for example 'rx', 'ry' and 'cx' as basis gates instead of 'u1', 'u2', 'u3' and 'cx'?&lt;/p&gt;&#xA;&lt;p&gt;The following error&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Exception has occurred: QiskitError&#xA;&amp;quot;Cannot unroll the circuit to the given basis, ['id', 'ry', 'rx', 'cx']. No rule to expand instruction h.&amp;quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;for example is obtained from the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator&#xA;from qiskit.compiler import transpile&#xA;import matplotlib.pyplot as plt&#xA;from qiskit.compiler.transpile import CouplingMap&#xA;&#xA;coupling_string = [[0, 1], [0,2], [1,2]]&#xA;&#xA;CM = CouplingMap(coupling_string)&#xA;&#xA;qc = QuantumCircuit(3)&#xA;&#xA;qc.h(0)&#xA;qc.h(1)&#xA;qc.h(2)&#xA;&#xA;result = transpile(qc, coupling_map=CM, basis_gates=['id', 'ry', 'rx', 'cx'], optimization_level=1, seed_transpiler=1) &#xA;result.draw(output='mpl')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13436" LastEditorUserId="55" LastEditDate="2020-10-09T07:42:35.727" LastActivityDate="2020-10-09T07:42:35.727" Title="Qiskit transpile with different set of basis gates" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14059" PostTypeId="1" CreationDate="2020-10-08T16:00:37.237" Score="1" ViewCount="67" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; -dimensional Hilbert space, and let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle,|\phi\rangle \in \mathcal{H}$&lt;/span&gt; be two quantum states.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Show that if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; are orthogonal, then there exists a projective measurement that distinguishes them. That is, there exists a two-outcome projective measurement &lt;span class=&quot;math-container&quot;&gt;$\left\{P_{0}, P_{1}\right\}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{\psi}\left(P_{0}\right)=1 \quad \text { and } \quad p_{\phi}\left(P_{1}\right)=1&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Show that if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; are not orthogonal, then there is no projective measurement that distinguishes them.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Attemps:&#xA;I form a general Projective operator an two General states, I tried it for a &lt;span class=&quot;math-container&quot;&gt;$2*2$&lt;/span&gt; dimension and then I was wondering why do we say that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; should be orthogonal?&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="55" LastEditDate="2020-10-09T16:05:57.667" LastActivityDate="2020-10-09T16:07:47.040" Title="How does a projective measurement distinguish between two states in a $d$-dimensional Hilbert space?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14060" PostTypeId="2" ParentId="14058" CreationDate="2020-10-08T16:05:46.073" Score="2" Body="&lt;p&gt;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. &lt;a href=&quot;https://i.stack.imgur.com/wprAp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wprAp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wprAp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/3658&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/3658&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wprAp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#qiskit-0-20-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/release_notes.html#qiskit-0-20-0&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-10-08T16:05:46.073" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="14062" PostTypeId="1" AcceptedAnswerId="14064" CreationDate="2020-10-08T17:18:43.663" Score="3" ViewCount="595" Body="&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rm{X=\sigma_x=NOT=|0\rangle\langle 1|+|1\rangle\langle 0|=\begin{bmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rm{Z=\sigma_Z=signflip=|0\rangle\langle 0|-|1\rangle\langle 1|=\begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13440" LastEditorUserId="27" LastEditDate="2020-10-10T07:13:50.973" LastActivityDate="2020-10-10T07:13:50.973" Title="How are the Pauli $X$ and $Z$ matrices expressed in bra-ket notation?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ClosedDate="2020-10-18T19:11:38.893" ContentLicense="CC BY-SA 4.0" />
  <row Id="14064" PostTypeId="2" ParentId="14062" CreationDate="2020-10-08T18:34:47.020" Score="4" Body="&lt;p&gt;Recall that kets &lt;span class=&quot;math-container&quot;&gt;$|\cdot\rangle$&lt;/span&gt; represent column vectors; a bra &lt;span class=&quot;math-container&quot;&gt;$\langle\cdot|$&lt;/span&gt; is a ket's row vector counterpart. For any ket &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, the corresponding bra is its adjoint (conjugate transpose): &lt;span class=&quot;math-container&quot;&gt;$\langle\psi| = |\psi\rangle^\dagger$&lt;/span&gt;. (For a refresher on this, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/91/how-does-bra-ket-notation-work&quot;&gt;this question&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate can be expressed as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$X = |0\rangle\langle1| + |1\rangle\langle0| =&#xA;\begin{bmatrix} 1 \\ 0 \end{bmatrix}\begin{bmatrix} 0 &amp;amp; 1 \end{bmatrix} +&#xA;\begin{bmatrix} 0 \\ 1 \end{bmatrix}\begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix} =&#xA;\begin{bmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix} + \begin{bmatrix} 0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{bmatrix} =&#xA;\begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-08T18:34:47.020" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14066" PostTypeId="1" AcceptedAnswerId="14068" CreationDate="2020-10-08T20:32:23.327" Score="1" ViewCount="177" Body="&lt;p&gt;So in lectures I see lots of these:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eQgQm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eQgQm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/I5EGc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I5EGc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And somehow I intuitively understand it (at least for the 1 qubit case), but I don't understand the math – especially for 2 qubits.&lt;/p&gt;&#xA;" OwnerUserId="13440" LastEditorUserId="45" LastEditDate="2020-10-09T18:26:53.507" LastActivityDate="2020-10-10T07:13:16.777" Title="How do I apply the Hadamard gate to one qubit in a two-qubit pure state?" Tags="&lt;mathematics&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14067" PostTypeId="2" ParentId="14066" CreationDate="2020-10-08T20:42:55.253" Score="1" Body="&lt;p&gt;What don't you understand about the Hadamard? You did the math correctly.&lt;/p&gt;&#xA;&lt;p&gt;For the two qubit states, you can ignore the qubit that the Hadamard is not modifying and factor that in the end. Notably:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ (H \otimes I) | \psi_A \rangle |\psi_B \rangle = H |\psi_A \rangle \otimes I| \psi_B \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Last, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle) $&lt;/span&gt; as a notational shorthand.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Explicit description&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's say we want to apply the Hadamard to the first qubit of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. Then, That's just &lt;span class=&quot;math-container&quot;&gt;$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)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="8343" LastEditDate="2020-10-08T20:56:12.597" LastActivityDate="2020-10-08T20:56:12.597" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14068" PostTypeId="2" ParentId="14066" CreationDate="2020-10-08T23:09:13.343" Score="3" Body="&lt;p&gt;First, you should note that the Hadamaard gate is nothing more than a &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; Discrete Fourier Transform matrix (two-point DFT). That is the reason why, &lt;span class=&quot;math-container&quot;&gt;$H \bigg( \dfrac{|0\rangle + |1\rangle}{2}\bigg) = |0\rangle  $&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$H \bigg( \dfrac{|0\rangle - |1\rangle}{2}\bigg) = |1\rangle  $&lt;/span&gt;. Think &amp;quot;periodicity&amp;quot;...&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, the Hadamard gate, which is again just a two-point DFT, can be written out explicitly as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix}  0 \\&#xA; 1 \end{pmatrix} $&lt;/span&gt;. 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):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H|0\rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} \begin{pmatrix}  1 \\&#xA; 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] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the two-qubit or more generally n-qubit case, where you apply the Hadamard gate to &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;-qubit, then you can think of this operator as: &lt;span class=&quot;math-container&quot;&gt;$I_1 \otimes I_2 \otimes \cdots \otimes H_j \otimes \cdots \otimes I_n $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if you have a two qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |00\rangle = |0\rangle \otimes |0\rangle $&lt;/span&gt; and you want to apply the Hadamard to the second qubit, then this is simply:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(I \otimes H) |00\rangle &amp;amp;= \bigg[ \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; 1\\ \end{pmatrix} \otimes \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} \bigg] \bigg[|0\rangle \otimes |0\rangle \bigg] \\&#xA;&amp;amp;= \begin{pmatrix} 1 \cdot\dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} &amp;amp; 0\cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} \\ 0\cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} &amp;amp; -1\cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix} \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; -1\\ 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 1  \end{pmatrix}\begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\&#xA;&amp;amp;=  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1\\ 0 \\ 0 \\ \end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}} \bigg[ \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} + \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \\ \end{pmatrix} \bigg]\\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}}\big( |00\rangle + |01\rangle \big)\\ &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the last equality is because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \otimes \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix}= \begin{pmatrix} 1 \cdot \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \\&#xA; 0 \cdot \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and similarly&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|01\rangle = |0\rangle \otimes |1\rangle = \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \otimes \begin{pmatrix}  0 \\&#xA; 1 \end{pmatrix}= \begin{pmatrix} 1 \cdot \begin{pmatrix}  0 \\&#xA; 1 \end{pmatrix} \\&#xA; 0 \cdot \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and therefore you have the equality&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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] &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now also note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(I \otimes H) |00\rangle &amp;amp;= (I \otimes H) \big(|0\rangle \otimes |0\rangle \big) = I|0\rangle \otimes H|0\rangle \ \textrm{[by tensor product properties][1]} \\&#xA;&amp;amp;= |0\rangle \otimes \dfrac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big) \\&#xA;&amp;amp;= \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)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is more convenient&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mvGo7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(H \otimes I) |00\rangle &amp;amp;= \bigg[ \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix}  \otimes \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; 1\\ \end{pmatrix}  \bigg] \bigg[|0\rangle \otimes |0\rangle \bigg] \\&#xA;&amp;amp;= \begin{pmatrix} \dfrac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; 1\\ \end{pmatrix}  &amp;amp; \dfrac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; 1\\ \end{pmatrix} \\ \dfrac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; 1\\ \end{pmatrix}  &amp;amp; -\dfrac{1}{\sqrt{2}}\cdot \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; 1\\ \end{pmatrix}  \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1  \end{pmatrix}\begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\&#xA;&amp;amp;=  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0\\ 1 \\ 0 \\ \end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}} \bigg[ \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} + \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \\ \end{pmatrix} \bigg]\\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}}\big( |00\rangle + |10\rangle \big)\\ &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is again, because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|10\rangle = |1\rangle \otimes |0\rangle = \begin{pmatrix}  0 \\&#xA; 1 \end{pmatrix} \otimes \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix}= \begin{pmatrix} 0 \cdot \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \\&#xA; 1 \cdot \begin{pmatrix}  1 \\&#xA; 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 1  \\ 0 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we already know from earlier that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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] &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I think the problem is people tend to drop off tensor notation... They assume that you know what they mean.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Going a little further:&lt;/strong&gt; Since we are already at this point, I thought I should add this extra bit in here too. Suppose you see the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mvGo7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mvGo7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is quantum circuit, starting with the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle = |00\rangle = |0 \rangle \otimes |0\rangle$&lt;/span&gt;. 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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} &#xA;|\psi_1 \rangle &amp;amp;= (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)\\ &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;cannot&lt;/strong&gt; think of it as tensor product from one-qubit gate. The function of CNOT (controlled-NOT) is to apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the target-qubit when the controlled-qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. It is therefore can be written in matrix form explicitly as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\label{CNOT matrix}&#xA;     CNOT = \begin{pmatrix} &#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\  &#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    \end{pmatrix} &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we apply the CNOT gate to &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;, which will give us &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;. That is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT|\psi_1\rangle = |\psi_2\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And explicitly writing this out as matrix and vector multiplication, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_2 \rangle = \begin{pmatrix} &#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\  &#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    \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)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This quantum circuit generate the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}} \big( |00\rangle + |11 \rangle \big)$&lt;/span&gt; which is one of the four Bell states, which are maximal entangled state for two qubit.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-10T07:13:16.777" LastActivityDate="2020-10-10T07:13:16.777" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="14069" PostTypeId="2" ParentId="14059" CreationDate="2020-10-09T07:37:09.467" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P_0=|\psi\rangle\!\langle\psi|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1=I-P_0$&lt;/span&gt;. This is a projective measurement which deterministically distinguishes the two orthogonal states.&lt;/p&gt;&#xA;&lt;p&gt;More generally, consider a projective measurement with operators &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}\{P_i\}_{i=1}^d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\braket}[2]{\langle #1\rvert #2\rangle}\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert} P_i\equiv\ketbra{\eta_i}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\braket{\eta_i}{\eta_j}=\delta_{ij}$&lt;/span&gt;, and a set of (not necessarily orthogonal) states &lt;span class=&quot;math-container&quot;&gt;$\{\ket{\psi_i}\}_{i=1}^\ell$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\ell\le d$&lt;/span&gt;.&#xA;To distinguish the states deterministically we need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}(P_i \ketbra{\psi_j})=|\braket{\eta_i}{\psi_j}|^2=\delta_{ij}.\tag2$$&lt;/span&gt;&#xA;Define the matrices &lt;span class=&quot;math-container&quot;&gt;$\Pi\equiv\sum_{i=1}^d |\eta_i\rangle\!\langle i|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi\equiv\sum_{i=1}^\ell|\psi_i\rangle\!\langle i|$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$\Pi$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$d\times\ell$&lt;/span&gt;.&#xA;Eq. (1) is thus equivalent to &lt;span class=&quot;math-container&quot;&gt;$\Pi^\dagger \Psi=I_{d\times \ell}$&lt;/span&gt; (we can tune the definitions of the states &lt;span class=&quot;math-container&quot;&gt;$\ket{\eta_i}$&lt;/span&gt; to have &lt;span class=&quot;math-container&quot;&gt;$\braket{\eta_i}{\psi_i}\in\mathbb R$&lt;/span&gt; without any loss in generality).&#xA;This is only possible if &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; is &amp;quot;maximally entangled&amp;quot;, &lt;em&gt;i.e.&lt;/em&gt; has rank &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; and all its (nonzero) singular values equal &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (equivalently, &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\Psi^\dagger\Psi=I_{\ell}$&lt;/span&gt;). This is true &lt;em&gt;iff&lt;/em&gt; the states &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_i}$&lt;/span&gt; are orthonormal.&lt;/p&gt;&#xA;&lt;p&gt;The last statement follows from observing that &lt;span class=&quot;math-container&quot;&gt;$\Psi^\dagger\Psi$&lt;/span&gt; has the same nonzero singular values/eigenvalues as &lt;span class=&quot;math-container&quot;&gt;$\Psi\Psi^\dagger=\sum_{i=1}^\ell \ketbra{\psi_i}$&lt;/span&gt;. The latter having an &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt;-fold degenerate eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; means&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Psi\Psi^\dagger = \sum_i\ketbra{\psi_i}=\sum_i\ketbra{\phi_i}$$&lt;/span&gt;&#xA;for some orthonormal set &lt;span class=&quot;math-container&quot;&gt;$\{\ket{\phi_i}\}_{i=1}^\ell$&lt;/span&gt;. This in turns implies that for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\ket{\psi_i}=\sum_j U_{ij}\ket{\phi_j}$&lt;/span&gt;, and thus &lt;span class=&quot;math-container&quot;&gt;$\braket{\psi_i}{\psi_j}=\delta_{ij}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This shows that non-orthogonal states cannot be distinguished deterministically via projective measurements (in fact, they cannot be distinguished deterministically by &lt;em&gt;any&lt;/em&gt; measurement, but that's not what we are showing here).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-10-09T16:07:47.040" LastActivityDate="2020-10-09T16:07:47.040" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14070" PostTypeId="1" CreationDate="2020-10-09T08:41:40.050" Score="1" ViewCount="93" Body="&lt;p&gt;I found Quantum Fourier Transform in the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt;, but I'm looking specifically for how to solve Poisson's equation with the Quantum Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;Are there any references that talk about how to do this?&lt;/p&gt;&#xA;" OwnerUserId="13300" LastEditorUserId="13117" LastEditDate="2020-10-10T07:13:43.803" LastActivityDate="2020-10-10T07:13:43.803" Title="Solving Poisson's equation with Quantum Fourier Transform" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14071" PostTypeId="1" AcceptedAnswerId="14072" CreationDate="2020-10-09T11:00:09.610" Score="2" ViewCount="53" Body="&lt;p&gt;From &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14059/how-does-projective-measurement-distinguishes-between-two-states-in-d-dimensio&quot;&gt;this question&lt;/a&gt;, gls states that given &lt;span class=&quot;math-container&quot;&gt;$\Pi\equiv\sum_i |\eta_i\rangle\!\langle i|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi\equiv\sum_i|\psi_i\rangle\!\langle i|$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$\Pi^\dagger\Psi=I_{d\times\ell}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; is &amp;quot;maximally entangled&amp;quot;, ie has rank &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;Edit: I am assuming &amp;quot;maximally entangled&amp;quot; means in this context it is diagonal up to a certain dimension &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2020-10-09T16:45:53.767" LastActivityDate="2020-10-09T16:45:53.767" Title="How does a $d\times\ell$ matrix of rank $\ell$ and with singular values all equal to 1 imply it is maximally entangled" Tags="&lt;entanglement&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14072" PostTypeId="2" ParentId="14071" CreationDate="2020-10-09T12:06:15.607" Score="2" Body="&lt;p&gt;I think the terminology makes sense if you think the matrix &lt;span class=&quot;math-container&quot;&gt;$ \Psi $&lt;/span&gt;, via the linear bijection &lt;span class=&quot;math-container&quot;&gt;$ vec\big( |b \rangle \langle a|\big) = |b \rangle |a \rangle$&lt;/span&gt;, as a pure bipartite state &lt;span class=&quot;math-container&quot;&gt;$ vec(\Psi) = |\psi \rangle_{AB} = \frac{1}{\sqrt{l}} \sum_{i=1}^{l} | \psi_i \rangle_A | i \rangle_B $&lt;/span&gt; and observe that the reduced density matrix is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if &lt;span class=&quot;math-container&quot;&gt;$ \Psi^\dagger \Psi  = I_l $&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$ \rho_{AB} = |\psi \rangle \langle \psi |_{AB} $&lt;/span&gt; is &amp;quot;maximally entagled&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-10-09T14:02:54.540" LastActivityDate="2020-10-09T14:02:54.540" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14073" PostTypeId="1" AcceptedAnswerId="14079" CreationDate="2020-10-09T12:12:49.900" Score="0" ViewCount="47" Body="&lt;p&gt;What is the best way to get the circuit run time in Q# ?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;&lt;p&gt;Best regards.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastActivityDate="2020-10-09T20:42:03.247" Title="How to get circuit run time in Q#" Tags="&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14074" PostTypeId="2" ParentId="14073" CreationDate="2020-10-09T16:13:31.903" Score="0" Body="&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This was suppose to be a comment but it got too long so I just put it here as an answer.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-09T16:13:31.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14075" PostTypeId="2" ParentId="14071" CreationDate="2020-10-09T16:24:02.037" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14072/55&quot;&gt;other answer&lt;/a&gt; is already pretty on point with what I meant, but just to restate the same thing in different words:&lt;/p&gt;&#xA;&lt;p&gt;Given a matrix &lt;span class=&quot;math-container&quot;&gt;$\Psi\in\mathrm{Lin}(\mathcal X,\mathcal Y)$&lt;/span&gt;, whose singular value decomposition reads &lt;span class=&quot;math-container&quot;&gt;$\Psi=\sum_i \sqrt{p_i}|u_i\rangle\!\langle v_i|$&lt;/span&gt;, we can define the corresponding &lt;em&gt;vectorization&lt;/em&gt; as the vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{vec}(\Psi)=\sum_i\sqrt{p_i}|u_i\rangle\otimes|v_i\rangle\in\mathcal Y\otimes\mathcal X,$$&lt;/span&gt;&#xA;(conventions may vary as to the order of the spaces after the vectorization).&#xA;Notice that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(\Psi)$&lt;/span&gt; is a proper state (i.e. it's normalised) &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\|\Psi\|_2^2=\sum_i p_i=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The entanglement of &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(\Psi)$&lt;/span&gt; as a pure bipartite state (if it is a state) is encoded in its Schmidt coefficients, which are the singular values of &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt;. More generally, &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; might not correspond to a state upon vectorization, in which case calling it &amp;quot;maximally entangled&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-10-09T16:24:02.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14076" PostTypeId="1" AcceptedAnswerId="14086" CreationDate="2020-10-09T17:56:52.790" Score="2" ViewCount="475" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13449" LastEditorUserId="13449" LastEditDate="2020-10-12T00:59:02.540" LastActivityDate="2020-10-12T00:59:02.540" Title="How is a quantum simulator able to simulate a quantum mechanical properties on a classical computer?" Tags="&lt;simulation&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14077" PostTypeId="1" CreationDate="2020-10-09T19:22:23.420" Score="1" ViewCount="75" Body="&lt;p&gt;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 &lt;code&gt;max_evals&lt;/code&gt; 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 &lt;code&gt;max_evals&lt;/code&gt; set to &lt;code&gt;max_iter&lt;/code&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9201" LastEditorUserId="55" LastEditDate="2020-10-12T07:22:52.687" LastActivityDate="2020-10-12T07:22:52.687" Title="An effective way to submit all the jobs for VQE/QAOA at a time to an IBMQ machine?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14078" PostTypeId="2" ParentId="14077" CreationDate="2020-10-09T19:33:51.397" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle H \rangle = \sum_{i} h_i \langle P_i \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So you can evaluate &lt;span class=&quot;math-container&quot;&gt;$\langle P_1 \rangle$&lt;/span&gt; on one machine and &lt;span class=&quot;math-container&quot;&gt;$\langle P_2 \rangle$&lt;/span&gt; on another machine...&lt;/p&gt;&#xA;&lt;p&gt;The problem is &lt;strong&gt;there is only one 65 qubit machine&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-09T19:33:51.397" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14079" PostTypeId="2" ParentId="14073" CreationDate="2020-10-09T20:42:03.247" Score="1" Body="&lt;p&gt;Here is what I did when I was exploring optimizing the code to run as fast as possible in simulation (here is the &lt;a href=&quot;https://github.com/tcNickolas/MiscQSharp/tree/master/DecoratingTheTree2019-Optimize#decorating-the-christmas-tree-using-grovers-search&quot; rel=&quot;nofollow noreferrer&quot;&gt;blog post describing the things I looked into&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add a classical driver to your project that calls your Q# code.&lt;br /&gt;&#xA;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:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;using QuantumSimulator qsim = new QuantumSimulator();&#xA;bool[] result = GroversSearch.Run(qsim).Result.ToArray();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;In this classical driver, wrap the call to quantum operation's &lt;code&gt;Run&lt;/code&gt; in classical code that tracks the start and the end time. Here is C# code for it:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;Stopwatch stopWatch = new Stopwatch();&#xA;stopWatch.Start();&#xA;// ... call quantum operation here ...&#xA;stopWatch.Stop();&#xA;TimeSpan ts = stopWatch.Elapsed;&#xA;string elapsedTime = String.Format(&amp;quot;{0:00}:{1:00}:{2:00}.{3:00}&amp;quot;,&#xA;    ts.Hours, ts.Minutes, ts.Seconds,&#xA;    ts.Milliseconds / 10);&#xA;Console.WriteLine(&amp;quot;RunTime &amp;quot; + elapsedTime);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;You can see the full example &lt;a href=&quot;https://github.com/tcNickolas/MiscQSharp/blob/master/DecoratingTheTree2019-Optimize/Driver.cs#L52&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-09T20:42:03.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14081" PostTypeId="2" ParentId="14076" CreationDate="2020-10-10T07:22:17.507" Score="1" Body="&lt;p&gt;A system composed of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is described by &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;However, there is a special familly of quantum cirucits composed only from so-called Clifford gates &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; which can be simulated efficiently on a classical computer. But to have a quantum computer universal, you also need &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate which is non-Clifford one and cannot be simulated efficiently. This causes that a quantum computer cannot be generally simulated efficiently. See &lt;a href=&quot;http://%20https://en.wikipedia.org/wiki/Gottesman%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman-Knill theorem&lt;/a&gt; for more information.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-10T07:22:17.507" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14082" PostTypeId="1" CreationDate="2020-10-10T10:08:42.970" Score="1" ViewCount="51" Body="&lt;p&gt;In QuantumInstance there are &lt;code&gt;max_parallel_threads&lt;/code&gt;, &lt;code&gt;max_parallel_experiments&lt;/code&gt; in &lt;code&gt;BACKEND_OPTIONS&lt;/code&gt; - 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?&lt;/p&gt;&#xA;" OwnerUserId="9201" LastEditorUserId="55" LastEditDate="2020-10-12T07:22:57.427" LastActivityDate="2020-10-12T07:22:57.427" Title="How to set 'max_parallel_threads', 'max_parallel_experiments' for BACKEND_OPTIONS in QuantumInstance" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14083" PostTypeId="2" ParentId="14082" CreationDate="2020-10-10T11:53:46.503" Score="1" Body="&lt;p&gt;I don't think there is a programmatically way to know the &lt;code&gt;backend_options&lt;/code&gt; supported by each backend. I always check the documentation on each backend to see what are the options. For example for &lt;code&gt;UnitarySimulator&lt;/code&gt;, these are the backend options &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.UnitarySimulator.html?highlight=backend_options&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.aer.UnitarySimulator.html?highlight=backend_options&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-10-10T11:53:46.503" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14085" PostTypeId="1" CreationDate="2020-10-10T17:45:19.950" Score="3" ViewCount="114" Body="&lt;p&gt;I used to think that CNOT flips amplitudes of the target qubit with the chance of &lt;span class=&quot;math-container&quot;&gt;$b^2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; amplitude of the control qubit. This yields that the final(after CNOT) state of the target qubit will be :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&#xA;(the intuition is that with probability &lt;span class=&quot;math-container&quot;&gt;$a^2$&lt;/span&gt; there is no flip, and with probability &lt;span class=&quot;math-container&quot;&gt;$b^2$&lt;/span&gt; flip occurs)&#xA;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.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="13459" LastEditorUserId="9006" LastEditDate="2020-10-11T06:29:02.090" LastActivityDate="2020-10-11T07:46:53.477" Title="Mathematical CNOT interpretation" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14086" PostTypeId="2" ParentId="14076" CreationDate="2020-10-10T18:20:13.703" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^{32}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^{32} * 2 * 16 \text{bits} = 17.2 \text{GB}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastEditorUserId="9006" LastEditDate="2020-10-11T06:25:55.377" LastActivityDate="2020-10-11T06:25:55.377" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14087" PostTypeId="1" AcceptedAnswerId="14093" CreationDate="2020-10-10T19:32:23.870" Score="3" ViewCount="86" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A \cong \mathbb{C}^{n}$&lt;/span&gt; be a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$A,$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Herm}(A)$&lt;/span&gt; be the Hilbert space consisting of all Hermitian matrices on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Give an example of a basis (not necessarily orthogonal) of Herm (A) consisting of pure density matrices in &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{D}(A)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbf A\mathbf t\mathbf t\mathbf e\mathbf m\mathbf p\mathbf t$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;I Started with the case &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; and considered the vectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle,|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|+i\rangle$&lt;/span&gt; , Because I think &lt;span class=&quot;math-container&quot;&gt;$\left|0\right\rangle\left\langle 0\right|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|1\right\rangle\left\langle 1\right|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\left|+\right\rangle\left\langle +\right|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\left|+i\right\rangle\left\langle +i\right|$&lt;/span&gt; are a non-orthogonal basis and all of them are pure density matrices. And as you know,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|+\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|+i\rangle=\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But my question is how can I prove or show that they are form a basis for &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Herm}(A)$&lt;/span&gt;, in this case &lt;span class=&quot;math-container&quot;&gt;$A \cong \mathbb{C}^{2}$&lt;/span&gt; and how can I expand it to &lt;span class=&quot;math-container&quot;&gt;$A \cong \mathbb{C}^{n}$&lt;/span&gt;? I mean how can I determine a basis for &lt;span class=&quot;math-container&quot;&gt;$A \cong \mathbb{C}^{n}$&lt;/span&gt; which are pure density matrices and how can I show that it is a basis?&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="55" LastEditDate="2020-10-12T07:23:21.323" LastActivityDate="2020-10-12T07:23:21.323" Title="What is a basis (not necessarily orthogonal) of Herm(A) consisting of pure density matrices in D(A)?($A \cong \mathbb{C}^{n}$)" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14088" PostTypeId="2" ParentId="14087" CreationDate="2020-10-10T22:51:43.243" Score="1" Body="&lt;p&gt;&lt;em&gt;I will &lt;strong&gt;try&lt;/strong&gt; to take a stab at it from my understanding of your question:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The basis for the space of &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; Hermitian matrices over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 0 \end{pmatrix} \ \ \begin{pmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} \ \ \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} \ \ \begin{pmatrix} 0 &amp;amp; i\\ -i &amp;amp; 0 \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|0\rangle\langle 0| = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 0 \end{pmatrix} \ \ \ \ |1\rangle\langle 1| = \begin{pmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} \ \ \ \ |+\rangle\langle +| =\dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; 1 \end{pmatrix} \ \ \ \ |i\rangle\langle i| =\dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; i\\ i &amp;amp; 1 \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;Well, if we take &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to be the Hermitian matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; i\\ -i &amp;amp; 1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can you form this Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; from your supposedly basis set?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;update:&lt;/strong&gt; As commented, I made a wrong calculation, as &lt;span class=&quot;math-container&quot;&gt;$|i\rangle \langle i|$&lt;/span&gt; should be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|i\rangle\langle i| =\dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; -i\\ i &amp;amp; 1 \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and therefore it can be written as &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{2}|0\rangle\langle 0| + \dfrac{1}{2}|1\rangle\langle 1| - |i\rangle\langle i | $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-11T16:36:19.403" LastActivityDate="2020-10-11T16:36:19.403" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14089" PostTypeId="2" ParentId="14085" CreationDate="2020-10-10T23:49:29.903" Score="3" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert A, B \rangle \rightarrow \vert A, A \oplus B \rangle,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vert A, B \rangle$&lt;/span&gt; is the tensor product of &lt;span class=&quot;math-container&quot;&gt;$\vert A \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert B \rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is addition mod 2.  If this seems foreign to you, just write out the &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$A \oplus A \oplus B = B$&lt;/span&gt;, giving the expected outcome after sequential application.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^2=4$&lt;/span&gt;, giving&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert A, B \rangle \rightarrow U_{CNOT}\vert A,B \rangle, \;\;\; U_{CNOT}=\begin{bmatrix} 1&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;1&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;1&amp;amp;0 \end{bmatrix}.$$&lt;/span&gt;&#xA;This is also well worth working this out by hand if there's any confusion as to why it works, noting that &lt;span class=&quot;math-container&quot;&gt;$U_{CNOT}{}^2=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One of the problematic assumptions implicit in the OP equation is that &lt;span class=&quot;math-container&quot;&gt;$\vert A \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert B \rangle$&lt;/span&gt; are separable after CNOT, which is not generally true.  In other words, if &lt;span class=&quot;math-container&quot;&gt;$\vert A \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert B \rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Edit in response to comment:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Interpretations_of_quantum_mechanics&quot; rel=&quot;nofollow noreferrer&quot;&gt;interpretations&lt;/a&gt; that are consistent with experiment.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-10-11T07:46:53.477" LastActivityDate="2020-10-11T07:46:53.477" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14090" PostTypeId="1" AcceptedAnswerId="14110" CreationDate="2020-10-11T06:24:56.007" Score="2" ViewCount="462" Body="&lt;p&gt;Let's say I am given a Hamiltonian&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H = \sum_{i = 1}^{m} H_{i},&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubits, and each &lt;span class=&quot;math-container&quot;&gt;$H_{i}$&lt;/span&gt; acts non-trivially on at most &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubits. The eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; are between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. As can be seen, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local Hamiltonian. Now, let's say I am given any quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. I want to implement the POVM&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\{H_{i}, \mathbb{1} - H_{i}\}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;li&gt;What is the guarantee this implementation is efficient?&lt;/li&gt;&#xA;&lt;li&gt;Is there any rule regarding when implementing such POVMs is efficient?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-10-12T21:03:20.283" LastActivityDate="2020-10-12T21:03:20.283" Title="How do I efficiently implement a POVM using a fixed universal gate set and the ability to measure in the standard basis?" Tags="&lt;measurement&gt;&lt;hamiltonian-simulation&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14091" PostTypeId="1" AcceptedAnswerId="14097" CreationDate="2020-10-11T08:34:56.037" Score="2" ViewCount="60" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13419" LastEditorUserId="55" LastEditDate="2020-10-12T21:20:46.810" LastActivityDate="2020-10-12T21:20:46.810" Title="How do quantum bits increase computational power?" Tags="&lt;algorithm&gt;&lt;speedup&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14093" PostTypeId="2" ParentId="14087" CreationDate="2020-10-11T11:13:56.347" Score="3" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$ n = 2 $&lt;/span&gt;, it is known that the Pauli matrices together with the identity matrix &lt;span class=&quot;math-container&quot;&gt;$ I $&lt;/span&gt; form a basis.&#xA;Now observe that we can write:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ I = |0 \rangle \langle 0| + |1 \rangle \langle 1| $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ \sigma_z  = 2 \cdot |0  \rangle \langle  0| - I $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ \sigma_x  = 2 \cdot |+  \rangle \langle  +| - I $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ \sigma_y  = 2 \cdot |+i \rangle \langle +i| - I $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This means that also the pure density matrices&#xA;&lt;span class=&quot;math-container&quot;&gt;$|0 \rangle \langle 0|, \hspace{0.3em}&#xA; |1 \rangle \langle 1|, \hspace{0.3em} &#xA; |+ \rangle \langle +|, \hspace{0.3em} &#xA; |+i \rangle \langle +i|  $&lt;/span&gt; are a basis (not orthogonal).&lt;/p&gt;&#xA;&lt;p&gt;For the general case, the matrices &lt;span class=&quot;math-container&quot;&gt;$ H_{a,b} $&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$ 1 \leq a,b \leq n $&lt;/span&gt;, form an orthogonal basis for Herm&lt;span class=&quot;math-container&quot;&gt;$(A)$&lt;/span&gt; (see section &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/LectureNotes/CS766.Fall2011/01.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;1.4.2&lt;/a&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\&#xA;  H_{a,b} =&#xA;  \begin{cases}&#xA;       E_{a,a} &amp;amp; \text{if $a = b $} \\&#xA;       E_{a,b} + E_{b,a} &amp;amp; \text{if $a &amp;lt; b$} \\&#xA;       i (E_{a,b} - E_{b,a}) &amp;amp; \text{if $a &amp;gt; b$}&#xA;  \end{cases}&#xA;\&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$ E_{a,b} = |e_a \rangle \langle e_b| $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ |e_a \rangle $&lt;/span&gt; a state with 1 in the &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;-th entry and all other entries zeros.&lt;/p&gt;&#xA;&lt;p&gt;Now define the states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\&#xA;  |\psi_{a,b} \rangle =&#xA;  \begin{cases}&#xA;       |e_a \rangle &amp;amp; \text{if $a = b $} \\&#xA;       \frac{1}{\sqrt{2}} (|e_a \rangle + |e_b \rangle) &amp;amp; \text{if $a &amp;lt; b$} \\&#xA;       \frac{1}{\sqrt{2}} (i|e_a \rangle + |e_b \rangle) &amp;amp; \text{if $a &amp;gt; b$}&#xA;  \end{cases}&#xA;\&#xA;$$&lt;/span&gt;&#xA;and the pure density matrices &lt;span class=&quot;math-container&quot;&gt;$ \rho_{a,b} = |\psi_{a,b} \rangle \langle \psi_{a,b}| $&lt;/span&gt;. After some calculations we get&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ H_{a, a} = \rho_{a,a} $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ H_{a, b} = 2 \rho_{a,b} - \rho_{a,a} - \rho_{b,b} $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;so &lt;span class=&quot;math-container&quot;&gt;$ \rho_{a,b} $&lt;/span&gt; form a basis.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-11T11:13:56.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14094" PostTypeId="2" ParentId="4989" CreationDate="2020-10-11T12:44:56.313" Score="1" Body="&lt;p&gt;Quantum teleportation actually works with any unitary basis.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;br /&gt;&#xA;Suppose the set of unitaries &lt;span class=&quot;math-container&quot;&gt;$\{ W_{i}, i=1,2,..,d^2 \}$&lt;/span&gt; is a unitary basis in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(H)$&lt;/span&gt;, that is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(W_{i}^\dagger W_j) = d \cdot \delta_{ij}.&#xA;$$&lt;/span&gt;&#xA;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_i \rangle = \frac{1}{\sqrt{d}} \sum_{j=0}^{d-1} W_i |j\rangle \otimes |j\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is an orthonormal basis in &lt;span class=&quot;math-container&quot;&gt;$H \otimes H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose Alice wants to teleport a state &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle_C \in H_C$&lt;/span&gt;, while with Bob they share an entangled state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_{00}\rangle_{AB} = \frac{1}{\sqrt{d}} \sum_{j=0}^{d-1} |j\rangle_A \otimes |j\rangle_B&#xA;$$&lt;/span&gt;&#xA;in the space &lt;span class=&quot;math-container&quot;&gt;$H_A \otimes H_B$&lt;/span&gt;, so the total state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle_C \otimes |\Psi_{00}\rangle_{AB}. &#xA;$$&lt;/span&gt;&#xA;It's not hard to show that this total state equals to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{d} \sum_{i=1}^{d^2} | \Psi_{i} \rangle_{CA} \otimes W_{i}^{-1} | \phi \rangle_B .&#xA;$$&lt;/span&gt;&#xA;So, Alice just needs to perform a measurement in the basis &lt;span class=&quot;math-container&quot;&gt;$\{ |\Psi_{i} \rangle_{CA} \}$&lt;/span&gt; and transmit the result &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; to Bob. Then Bob applies &lt;span class=&quot;math-container&quot;&gt;$W_{i}$&lt;/span&gt; to his state to obtain &lt;span class=&quot;math-container&quot;&gt;$| \phi \rangle_B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-10-11T12:44:56.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14096" PostTypeId="1" AcceptedAnswerId="14123" CreationDate="2020-10-11T15:33:38.797" Score="0" ViewCount="185" Body="&lt;p&gt;I've installed the qiskit_textbook package in Anaconda on Windows 10 using&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/qiskit-community/qiskit-textbook.git#subdirectory=qiskit-textbook-src&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;based on the instructions at &lt;a href=&quot;https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html&lt;/a&gt; .&lt;/p&gt;&#xA;&lt;p&gt;But I don't see any jupyter notebooks to open. How do you begin working with the qiskit tutorial notebooks? Thanks for any guidance.&lt;/p&gt;&#xA;" OwnerUserId="13467" LastEditorUserId="55" LastEditDate="2020-10-12T21:20:04.613" LastActivityDate="2020-10-12T21:20:04.613" Title="Using the qiskit_textbook Package" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14097" PostTypeId="2" ParentId="14091" CreationDate="2020-10-11T17:10:13.330" Score="3" Body="&lt;p&gt;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 &amp;quot;factoring&amp;quot; can be broken down into the question of &amp;quot;period finding&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$QFT |\psi \rangle  = |\phi \rangle$$&lt;/span&gt;&#xA;You can't read-out what &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is directly as postulate by quantum mechanics. That is part of the private world of the quantum state. Also, preparing an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; on a quantum computer is hard. All qubit state initialize at &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;. So you must do some operation to get it to &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;. There is not a way to do this very efficient yet.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-11T17:10:13.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14098" PostTypeId="1" AcceptedAnswerId="14114" CreationDate="2020-10-11T17:36:51.753" Score="4" ViewCount="309" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 (&lt;a href=&quot;https://arxiv.org/pdf/1411.6758.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum factorization of 56153 with only 4 qubits&lt;/a&gt;), 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.&lt;/p&gt;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;" OwnerUserId="13468" LastEditorUserId="55" LastEditDate="2020-10-12T21:19:58.030" LastActivityDate="2020-10-15T11:26:13.487" Title="QUBO, Ising Hamiltonians and VQA" Tags="&lt;programming&gt;&lt;vqe&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14099" PostTypeId="1" AcceptedAnswerId="14111" CreationDate="2020-10-11T18:08:50.647" Score="2" ViewCount="33" Body="&lt;p&gt;In brassard et al. Amplitude Amplification work, they define the Q operator as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{Q} = -AS_{o}A^{-1}S_{\chi}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$S_{o}$&lt;/span&gt; is an operator which flips the sign of the &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;Which is basically a diagonal unitary matrix (in the computational basis) with -1 on the first diagonal element.&lt;/p&gt;&#xA;&lt;p&gt;I was wondering, isn't Quantum amplification's quantum speedup hindered by the realization of   &lt;span class=&quot;math-container&quot;&gt;$S_o$&lt;/span&gt; when the number of qubits in the circuit is too big? Based on Barenco's et al work (&lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.52.3457&quot; rel=&quot;nofollow noreferrer&quot;&gt;Elementary gates for quantum computation&lt;/a&gt;), isn´t the number of gates required for a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit controlled gate exponential in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2020-10-12T21:19:44.973" LastActivityDate="2020-10-12T21:19:44.973" Title="In amplitude amplification, isn't the speedup hindered by the realization of $S_o$?" Tags="&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14100" PostTypeId="1" AcceptedAnswerId="14108" CreationDate="2020-10-11T21:10:20.257" Score="2" ViewCount="79" Body="&lt;p&gt;I'm studying the Shor algorithm as part of my thesis and have a question about the &amp;quot;measured&amp;quot; phases after the QPE.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. I understand, that &lt;span class=&quot;math-container&quot;&gt;$cU$&lt;/span&gt; has multiple eigenvalues with a factor &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. How can be guaranteed that each of the controlled-Us will kickback the same eigenvalue? Or, why it is not important?&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;change&amp;quot; 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)&lt;/p&gt;&#xA;&lt;p&gt;Thank you for your help.&lt;/p&gt;&#xA;" OwnerUserId="13469" LastEditorUserId="55" LastEditDate="2020-10-12T21:18:37.993" LastActivityDate="2020-10-12T21:18:37.993" Title="In Shor's algorithm, how can we guarantee that each controlled-U will kickback to the same eigenvalue?" Tags="&lt;shors-algorithm&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14102" PostTypeId="2" ParentId="14100" CreationDate="2020-10-11T23:55:26.600" Score="1" Body="&lt;p&gt;Have you seen this document? &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/shor.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/shor.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that in Shor's algorithm, we use the quantum computer as a subroutine to essentially find the period of the function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ f(x) = a^x mod N$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is a  guessed value between &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N-1$&lt;/span&gt;. So you have to create &lt;strong&gt;different&lt;/strong&gt; circuit to implement each of the guessed &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;As for the QPE step, this is essentially as follow:&lt;/p&gt;&#xA;&lt;p&gt;Let's suppose that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U|\psi\rangle = e^{2\pi i \phi} |\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The phase-kickback turn each of the ancilla qubit (after going through Hadamard gate) from the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{ |0\rangle + e^{2\pi i 2^j \phi}|1 \rangle}{\sqrt{2}}$&lt;/span&gt; under &lt;span class=&quot;math-container&quot;&gt;$CU^{2^j}$&lt;/span&gt; operator. To be mathematical precise,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now if you apply the inverse QFT to all the ancilla qubit then you will get the binary expression of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-11T23:55:26.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14103" PostTypeId="1" AcceptedAnswerId="14109" CreationDate="2020-10-12T00:03:28.907" Score="3" ViewCount="47" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathfrak{D}(A)$&lt;/span&gt; be a density matrix.&#xA;Show that &lt;span class=&quot;math-container&quot;&gt;$\left|\psi^{A B}\right\rangle \in A B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\phi^{A C}\right\rangle \in A C$&lt;/span&gt; (assuming &lt;span class=&quot;math-container&quot;&gt;$\left.|B| \leqslant|C|\right)$&lt;/span&gt; are two purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathfrak{D}(A)$&lt;/span&gt; if and only if there exists an isometry matrix &lt;span class=&quot;math-container&quot;&gt;$V: B \rightarrow C$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left|\phi^{A C}\right\rangle=I^{A} \otimes V^{B \rightarrow C}\left|\psi^{A B}\right\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbf{attempt}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;I first prove &lt;span class=&quot;math-container&quot;&gt;$\rightarrow$&lt;/span&gt; side of this theorem. So I assume that &lt;span class=&quot;math-container&quot;&gt;$\left|\psi^{A B}\right\rangle \in A B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\phi^{A C}\right\rangle \in A C$&lt;/span&gt; (assuming &lt;span class=&quot;math-container&quot;&gt;$\left.|B| \leqslant|C|\right)$&lt;/span&gt; are two purifications of &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathfrak{D}(A)$&lt;/span&gt;. We can write &lt;span class=&quot;math-container&quot;&gt;$\left|\psi^{A B}\right\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\phi^{A C}\right\rangle $&lt;/span&gt; as follows&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;|\psi\rangle^{A B}=\sum_{x=1}^{|A|}|x\rangle^{A}\left(\sum_{y=1}^{|B|} m_{x y}|y\rangle^{B}\right)\\&#xA;&amp;amp;|\psi\rangle^{A C}=\sum_{z=1}^{|A|}|z\rangle^{A}\left(\sum_{w=1}^{|C|} m^{\prime}_{z w}|w\rangle^{C}\right)&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So then we can right them as follows&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;|\psi\rangle^{A B}=I \otimes M\left|\phi_{+}^{A \tilde{A}}\right\rangle\\&#xA;&amp;amp;|\psi\rangle^{A C}=I \otimes M^{\prime}\left|\phi_{+}^{A \tilde{A}}\right\rangle\\&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which &lt;span class=&quot;math-container&quot;&gt;$M: H^{\tilde{A}} \rightarrow H^{B}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M^{\prime}: H^{\tilde{A}} \rightarrow H^{C}$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;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} \\&#xA;&amp;amp;\left|\phi_{+}^{\tilde{A} A}\right\rangle:=\sum_{x=1}^{|A|} |xx\rangle^{\tilde{A} A}\\&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we want &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle^{A B}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle^{A c}$&lt;/span&gt; to be purification of &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathfrak{D}(A)$&lt;/span&gt;. So according to the definition, we should have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;\psi^{A}=MM^{*}=M^{\prime}(M^{\prime})^{*}=\rho \\&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And we assume &lt;span class=&quot;math-container&quot;&gt;$M^{\prime}=VM$&lt;/span&gt;, So&#xA;So we can write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;M^{\prime}(M^{\prime})^{*}=VMM^{*}V^{*}=V\rho V^{*}&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, what should I do? Is my procedure correct?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbf{Note}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$\left|\phi^{A B}\right\rangle=I^{A} \otimes M \left|\Phi^{A \tilde{A}}\right\rangle$&lt;/span&gt; is called a purification of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; if reduced density matrix &lt;span class=&quot;math-container&quot;&gt;$\psi^A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;\psi^A := M M^* \in Pos(A)&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is equal to our density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. And&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation} &#xA;\begin{aligned}&#xA;&amp;amp;\left|\phi_{+}^{\tilde{A} A}\right\rangle:=\sum_{x=1}^{|A|} |xx\rangle^{\tilde{A} A}&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;at the end I should mention that &lt;span class=&quot;math-container&quot;&gt;$\tilde{A}$&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="55" LastEditDate="2020-10-12T21:17:22.090" LastActivityDate="2020-10-12T21:17:22.090" Title="Prove that different purifications of a state can be mapped into one another via local unitaries" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14104" PostTypeId="1" CreationDate="2020-10-12T03:19:47.357" Score="1" ViewCount="38" Body="&lt;pre&gt;&lt;code&gt;&#xA;&#xA;def random_bitstring_generator(bit_number, backend):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    Generate a bitstring with one qubit&#xA;    :param bit_number: number of bits that we want to generate&#xA;    :param backend: Qiskit hardware or simulator&#xA;    :return: string object with random bits&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;&#xA;    one_qubit_random_bit_generator_circuit = QuantumCircuit(1,1)&#xA;    one_qubit_random_bit_generator_circuit.h(0)&#xA;    one_qubit_random_bit_generator_circuit.measure(0,0)&#xA;&#xA;    for _ in range(bit_number):&#xA;        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1000).result().get_counts()&#xA;        bit = list(counts.keys())[0]  # we have only one key because shots=1&#xA;        bitstring += bit&#xA;&#xA;    return bitstring&#xA;&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;print(random_bitstring_generator(512, backend))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Executed the above code for QRNG using 1 qubit and received a 512 bit sequence &lt;a href=&quot;https://i.stack.imgur.com/FXoiW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FXoiW.png&quot; alt=&quot;512 bit output&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Executing the same circuit for 3 qubit code as given in image received an output of increased length as shown in image&lt;a href=&quot;https://i.stack.imgur.com/4AXst.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4AXst.png&quot; alt=&quot;3 qubit qrng&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ELysb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ELysb.png&quot; alt=&quot;increased length ouptut for 3 qubit qrng implementation of 512 bits&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also how can i change the backend from qasm_simulator to vigo/melbourne/any other quantum machine&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="9800" LastEditDate="2020-10-14T11:20:23.513" LastActivityDate="2020-10-14T11:20:23.513" Title="Difference in length of RNG implementation using same circuit structure but different sizes" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;quantumlab&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14105" PostTypeId="2" ParentId="14104" CreationDate="2020-10-12T05:28:14.663" Score="0" Body="&lt;p&gt;To execute on hardware backend:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_vigo') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-12T05:28:14.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14106" PostTypeId="2" ParentId="14104" CreationDate="2020-10-12T06:41:29.947" Score="2" Body="&lt;p&gt;The number of bits in the &lt;code&gt;counts&lt;/code&gt; 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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;counts = {'0': 400, '1': 600}  # for for 1000 shots&#xA;counts = {'0': 1} # for 1 shot&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the second example, the Jupyter notebook screenshot, you have three qubits. Therefore&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;counts = {'000': 70, '010': 80, '110': 70, ... }  # for for 1000 shots&#xA;counts = {'101': 1} # for 1 shot&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Since you add these bitstrings together, the resulting bitstring will be three times longer in the second case.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Side note:&#xA;You are actually running a 1000 shots, not one, you should change the argument &lt;code&gt;shots=1000&lt;/code&gt; to &lt;code&gt;shots=1&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You might also want to have a look at the &lt;code&gt;get_memory&lt;/code&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-10-12T06:41:29.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14107" PostTypeId="2" ParentId="14103" CreationDate="2020-10-12T06:51:39.627" Score="2" Body="&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;MM^\star=M'(M')^\star=\rho.&#xA;$$&lt;/span&gt;&#xA;However, you then &lt;em&gt;assume&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$M'=VM$&lt;/span&gt;. You cannot do this as what you're trying to prove is that the &lt;em&gt;only&lt;/em&gt; option is for &lt;span class=&quot;math-container&quot;&gt;$M'=VM$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What you could do is assume a singular value decomposition of both &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt;. For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=UDV,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is diagonal (with non-negative entries) and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; are unitaries. Similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M'=U'D'V'.&#xA;$$&lt;/span&gt;&#xA;We calculate &lt;span class=&quot;math-container&quot;&gt;$MM^\star=UD^2U^\star$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$D^2$&lt;/span&gt; must correspond to the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; transforms the computational basis to the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Compare this to the same calculation for &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt;. We see that &lt;span class=&quot;math-container&quot;&gt;$D=D'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U'=e^{i\theta}U$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$D^2$&lt;/span&gt;, and hence we can absorb into the &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; instead).&lt;/p&gt;&#xA;&lt;p&gt;This then proves that the only difference between &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M'$&lt;/span&gt; is a unitary &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}V^\star V'$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-12T06:51:39.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14108" PostTypeId="2" ParentId="14100" CreationDate="2020-10-12T07:02:18.893" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I understand, that cU has multiple eigenvalues with a factor s. How&#xA;can be guaranteed that each of the controlled-Us will kickback the&#xA;same eigenvalue? Or, why it is not important?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;All the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;s in the various controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are the &lt;em&gt;same&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Second, if I run the controlled-U operations and make the QPE, why it&#xA;is possible to get different results?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Remember that, for QPE, if you input an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (and if that eigenvalue has an exact &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-bit representation) then a &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;-bit QPE will give exactly the eigenvalue, no probabilities.&lt;/p&gt;&#xA;&lt;p&gt;However, for Shor's algorithm, we cannot create an eigenvector - it requires knowledge of the value &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;, which is exactly what we're trying to find out! So, instead of inputting an eigenvector, we input &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-12T07:02:18.893" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14109" PostTypeId="2" ParentId="14103" CreationDate="2020-10-12T07:16:09.857" Score="2" Body="&lt;p&gt;I guess that part of the confusion is that you defined the matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = [m_{x,y}] ,\quad  1 \leq x \leq |A|, 1 \leq y \leq |B| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is actually the transpose of the common matrix representation of a linear operator. This later on means that composition of the linear operators &lt;span class=&quot;math-container&quot;&gt;$ V M $&lt;/span&gt; is not the usual matrix multiplication. All this to say, that you should have defined&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M|x\rangle^A = \sum_{y=1}^{|B|}m_{yx} |y\rangle^B $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, with the above definition we have that &lt;span class=&quot;math-container&quot;&gt;$ \hspace{0.2em}|\phi \rangle^{AB} = (I^A \otimes M) \big|\Phi_+^{AA} \big\rangle $&lt;/span&gt; is a purification of &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt; if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = \text{Tr}_B\Big[|\phi^{AB} \rangle \langle \phi^{AB}| \Big] = \big( M^{\dagger} M \big)^T $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After this clarification, let us first prove the reverse direction of the theorem, meaning if &lt;span class=&quot;math-container&quot;&gt;$ V^{B\rightarrow C} $&lt;/span&gt; is an isometry and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then the reduced density matrices of &lt;span class=&quot;math-container&quot;&gt;$ |\phi^{AC} \rangle, |\phi^{AB} \rangle $&lt;/span&gt; are equal.&#xA;Indeed:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_C\Big[|\phi^{AC} \rangle \langle \phi^{AC}| \Big] = &#xA;\text{Tr}_C\Big[ (I^A \otimes V^{B\rightarrow C} M ) \big|\Phi_+^{AA} \big\rangle \Big] =&#xA;\Big( \big(VM \big)^{\dagger} VM \Big)^T = \Big( M^{\dagger} V^{\dagger}V M \Big)^T = \Big( M^{\dagger} M \Big)^T = &#xA;\text{Tr}_B\Big[|\phi^{AB} \rangle \langle \phi^{AB}| \Big]&#xA;$$&lt;/span&gt;&#xA;since &lt;span class=&quot;math-container&quot;&gt;$ V $&lt;/span&gt; is an isometry so &lt;span class=&quot;math-container&quot;&gt;$ V^{\dagger} V = I_B $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For the other direction, if &lt;span class=&quot;math-container&quot;&gt;$ \hspace{0.2em}|\phi \rangle^{AB} = (I^A \otimes M) \big|\Phi_+^{AA} \big\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \hspace{0.2em}|\phi \rangle^{AC} = (I^A \otimes M') \big|\Phi_+^{AA} \big\rangle $&lt;/span&gt; are two purifications of &lt;span class=&quot;math-container&quot;&gt;$ \rho $&lt;/span&gt;, it must hold that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho^T = M^{\dagger} M = M'^{\dagger} M' $$&lt;/span&gt;&#xA;So if &lt;span class=&quot;math-container&quot;&gt;$ \rho^T = \sum_{j=1}^{r} \lambda_j |x_j \rangle \langle x_j| $&lt;/span&gt; is the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$ \rho^T $&lt;/span&gt;, by the singular value theorem it must hold that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M  = \sum_{j=1}^{r} \sqrt{\lambda_j} \cdot |y_j \rangle \langle x_j| $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ M' = \sum_{j=1}^{r} \sqrt{\lambda_j} \cdot |z_j \rangle \langle x_j| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for two orthonormal sets &lt;span class=&quot;math-container&quot;&gt;$\{ |y_j \rangle \} \in H^B $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \{ |z_j \rangle \} \in H^C $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now we can define &lt;span class=&quot;math-container&quot;&gt;$ V: H^B \rightarrow H^C $&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$ V |y_j \rangle = |z_j \rangle $&lt;/span&gt; and extend this matrix, if needed, to an isometry (we can always do this). This means that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M' = V M \implies |\phi^{AC} \rangle = (I^A \otimes V) |\phi^{AB} \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-12T07:16:09.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14110" PostTypeId="2" ParentId="14090" CreationDate="2020-10-12T07:18:14.950" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;What is the guarantee this implementation is efficient? Is there any&#xA;rule regarding when implementing such POVMs is efficient?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The implementation of such a gate will only depend on the parameter &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (which I assume you mean to be fixed), not &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Since efficiency is generally phrased in terms of scaling with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, and you have no dependence on that, it is efficient.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How do I implement this POVM using a fixed universal gate set and the&#xA;ability to measure in the standard basis? What is the unitary that I&#xA;have to apply before measuring in the standard basis&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$H_i=UDU^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is diagonal (with entries between 0 and 1 on the diagonal) and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary. Apply &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; to the appropriate set of qubits. This now reduces you to the problem of performing the measurement &lt;span class=&quot;math-container&quot;&gt;$\{D,1-D\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You'll need to introduce a single ancilla qubit, prepared in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$D=\sum_id_i|i\rangle\langle i|$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$V|i\rangle_S|0\rangle_A=\sqrt{d_i}|i\rangle|0\rangle+\sqrt{1-d_i}|i\rangle|1\rangle$&lt;/span&gt;. You can decompose this unitary via standard techniques. Apply &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, and measure the ancilla.&lt;/p&gt;&#xA;&lt;p&gt;To see that this works, let your input state be &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=U\sum_i\alpha_i|i\rangle$&lt;/span&gt;. You sould get the measurement outcome with probaility&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi|H_i|\psi\rangle=\sum_i|\alpha_i|^2d_i.&#xA;$$&lt;/span&gt;&#xA;This is what we need to check that we get. So, our simulation first applies &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt;, so we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i\alpha_i|i\rangle_S|0\rangle_A.&#xA;$$&lt;/span&gt;&#xA;We apply &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to prepare&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\sum_i\alpha_i|i\rangle_S(\sqrt{d_i}|0\rangle_A+\sqrt{1-d_i}|1\rangle_A).&#xA;$$&lt;/span&gt;&#xA;We calculate the probability of the 0 outcome:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\Psi| 1_S\otimes|0\rangle\langle 0|_A|\Psi\rangle=\sum_i|\alpha_i|^2d_i,&#xA;$$&lt;/span&gt;&#xA;as required.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;and how much error can I tolerate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This depends on what you mean, and is probably an entirely separate question to do justice to.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-10-12T09:09:48.200" LastActivityDate="2020-10-12T09:09:48.200" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14111" PostTypeId="2" ParentId="14099" CreationDate="2020-10-12T08:59:09.773" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$S_0$&lt;/span&gt;, being one), you can construct them in a time that is polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-12T08:59:09.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14112" PostTypeId="1" CreationDate="2020-10-12T11:34:24.273" Score="2" ViewCount="154" Body="&lt;h3&gt;Short version:&lt;/h3&gt;&#xA;&lt;p&gt;I'm trying to solve a traveling salesman problem very similar to the traveling Santa example here: &lt;a href=&quot;http://quantumalgorithmzoo.org/traveling_santa/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://quantumalgorithmzoo.org/traveling_santa/&lt;/a&gt;, which is also included in the samples of the Microsoft Quantum samples here: &lt;a href=&quot;https://github.com/microsoft/Quantum/tree/main/samples/simulation&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/Quantum/tree/main/samples/simulation&lt;/a&gt;.&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$H = -\sum_i h_i \sigma_i^z -\sum_{i,j} J_{i,j} \sigma_i^z \sigma_j^z$&lt;/span&gt;) in qsharp?&lt;/p&gt;&#xA;&lt;h3&gt;What I've tried:&lt;/h3&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\sum_{states} p_{state} E_{state}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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 &lt;code&gt;JordanWignerEncodingData&lt;/code&gt; or a &lt;code&gt;statePrepUnitary&lt;/code&gt; and &lt;code&gt;qpeUnitary&lt;/code&gt;. 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?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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: &lt;a href=&quot;https://github.com/microsoft/Quantum/blob/main/samples/simulation/ising/adiabatic/AdiabaticIsing.qs#L14&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/Quantum/blob/main/samples/simulation/ising/adiabatic/AdiabaticIsing.qs#L14&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I understand the question is very similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8238/ground-state-energy-estimation-vqe-vs-ising-vs-trotter-suzuki&quot;&gt;this one&lt;/a&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="13478" LastEditorUserId="55" LastEditDate="2020-10-12T21:22:52.667" LastActivityDate="2020-10-30T21:20:15.900" Title="How to solve QUBO problems in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;&lt;hamiltonian-simulation&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14113" PostTypeId="1" CreationDate="2020-10-12T11:42:43.107" Score="3" ViewCount="253" Body="&lt;p&gt;I'm trying to figure out the Shor's factoring algorithm. References i've been using &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt; page, the book Quantum Computer Science by David Mermin and the orignal &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;(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 &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9508027&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; i was unable to understand few things, they are:-&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In page 17, the probability[equation 5.7 &amp;amp; 5.8] was changed from summation to integral by introducing a error term in big-O notation and stating that &lt;span class=&quot;math-container&quot;&gt;$\{rc\}_q$&lt;/span&gt; is small enough. Now my question is &lt;strong&gt;how it is done&lt;/strong&gt;? I know that O(.) can be used to quantify algorithmic complexities.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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)$$&lt;/span&gt;&#xA;Also it said&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|\{rc\}_q| ≤ \frac{r}{2}$&lt;/span&gt;, the error term in the above expression&#xA;is easily seen to be bounded by O(1/q).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I could not understand &lt;strong&gt;how the above statement is true?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In page 18&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;this probability is thus asymptotically bounded below by &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{\pi^2r^2}$&lt;/span&gt;, and so is at least &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3r^2}$&lt;/span&gt;&#xA;for sufficiently large n.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I get the &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{\pi^2r^2}$&lt;/span&gt; part and how it is coming into picture, but what i dont get is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3r^2}$&lt;/span&gt;,&lt;br /&gt;&#xA;&lt;strong&gt;How it is at least &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3r^2}$&lt;/span&gt; for large n?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Also i was wondering &lt;strong&gt;if it is possible to get the condition &lt;span class=&quot;math-container&quot;&gt;$|\frac{c}{q} - \frac{d}{r}| \le \frac{1}{2q}$&lt;/span&gt; from the probability calculated from the actual summation&lt;/strong&gt; that is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P(c) = \frac{1}{q^2} \frac{\sin^2{(\frac{\pi mrc}{q})}}{\sin^2{(\frac{\pi rc}{q})}}$$&lt;/span&gt; Where &lt;span class=&quot;math-container&quot;&gt;$m\approx \frac{Q}{r}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It would be really helpful if anybody can help me clear my doubts. Thanks in advance!!&lt;/p&gt;&#xA;" OwnerUserId="12154" LastActivityDate="2020-10-12T18:16:33.873" Title="Problem with Shor's factoring algorithm" Tags="&lt;mathematics&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ClosedDate="2020-10-18T19:09:25.197" ContentLicense="CC BY-SA 4.0" />
  <row Id="14114" PostTypeId="2" ParentId="14098" CreationDate="2020-10-12T11:44:41.463" Score="0" Body="&lt;p&gt;In the definition from this paper [&lt;a href=&quot;https://arxiv.org/abs/1706.02998&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] the cost Hamiltonian is not restricted to the Ising Hamiltonian case. The paper [&lt;a href=&quot;https://arxiv.org/abs/1706.02998&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] has also an answer for the mentioned &amp;quot;general approach for &lt;span class=&quot;math-container&quot;&gt;$3/4$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) body interactions&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;A direct quote from [&lt;a href=&quot;https://arxiv.org/abs/1706.02998&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;]:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;From a classical cost function that is a polynomial in binary variables &lt;span class=&quot;math-container&quot;&gt;$x_1 , . . . , x_n $&lt;/span&gt;, we can construct a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits by first rewriting the cost function in terms of variables &lt;span class=&quot;math-container&quot;&gt;$z_i \in \{−1, 1 \}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x_i = (1 − z_i )/2$&lt;/span&gt; to obtain a polynomial &lt;span class=&quot;math-container&quot;&gt;$f (z) = \sum_{C \subset \{1,...n\}} \alpha_C \prod_{j \in C} z_j$&lt;/span&gt; and then replacing each occurance of &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt; with the Pauli operator &lt;span class=&quot;math-container&quot;&gt;$\sigma_i^z$&lt;/span&gt; . Thus, &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; is diagonal in the &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;-basis and takes the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_C = \sum_{C \subset \{1,...,n\}} \alpha_C \bigotimes_{j \in C} \sigma_i^z \tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is a subset of all qubits, and &lt;span class=&quot;math-container&quot;&gt;$\alpha_C$&lt;/span&gt; is a real coefficient for the many-body coupling between qubits in the subset &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;This means&lt;/strong&gt; that if we have a classical cost function &lt;span class=&quot;math-container&quot;&gt;$f(x) = 4 x_1 +6x_1 x_2 - 2x_2 x_3 x_4$&lt;/span&gt;, we should replace &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;s with &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;s and obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(z) =  2(1 - z_1) + 3 (1 - z_1) (1 - z_2) - (1 - z_2) (1 - z_3) (1 - z_4)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After simplifying replace &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;s with &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;s:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and done. Note that this procedure will work also for QUBO&lt;span class=&quot;math-container&quot;&gt;$\rightarrow$&lt;/span&gt;Ising Hamiltonian (see this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11665/9459&quot;&gt;answer&lt;/a&gt;). This way we will be able to construct the cost Hamiltonian with the desired (in QAOA) property:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_C |x\rangle = f(x)|x\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$x = x_1 x_2 x_3 x_4$&lt;/span&gt; is a bitstring.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt; of the cost Hamiltonian with &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-body coupling between qubits can be found in this paper [&lt;a href=&quot;https://arxiv.org/abs/1412.6062&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;] for the E3LIN2 problem ([&lt;a href=&quot;https://arxiv.org/abs/1412.6062&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;] Eq. &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; with slightly changed notations):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_C = \frac{1}{2} \sum_{a &amp;lt; b &amp;lt; c} d_{abc} \sigma_a^z \sigma_b^z \sigma_c^z \tag{6}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$d_{abc}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; are qubit indexes.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[&lt;a href=&quot;https://arxiv.org/abs/1706.02998&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;] &lt;a href=&quot;https://arxiv.org/abs/1706.02998&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z. Wang, S. Hadfield, Z. Jiang, E. G. Rieffel, &amp;quot;The Quantum Approximation Optimization Algorithm for MaxCut: A Fermionic View&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[&lt;a href=&quot;https://arxiv.org/abs/1412.6062&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt;] &lt;a href=&quot;https://arxiv.org/abs/1412.6062&quot; rel=&quot;nofollow noreferrer&quot;&gt;E. Farhi, J. Goldstone, S. Gutmann, &amp;quot;A Quantum Approximate Optimization Algorithm Applied to a Bounded Occurrence Constraint Problem&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-15T11:26:13.487" LastActivityDate="2020-10-15T11:26:13.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14115" PostTypeId="1" AcceptedAnswerId="14116" CreationDate="2020-10-12T12:55:04.463" Score="2" ViewCount="123" Body="&lt;p&gt;I'm following the YouTube tutorials for Programming on Quantum Computers and I've completed everything until I reach &lt;code&gt;circuit.draw()&lt;/code&gt; since I don't get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or 0 next to &lt;code&gt;q&lt;/code&gt; or &lt;code&gt;c&lt;/code&gt;. Here's my code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;qr = QuantumRegister(2)&#xA;cr = ClassicalRegister(2)&#xA;circuit = QuantumCircuit(qr, cr)&#xA;&#xA;%matplotlib inline&#xA;&#xA;circuit.draw()&#xA;&#xA;[&#xA;q0_0:&#xA;q0_1:&#xA;c0: 2/&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and so when I attempt an H gate, I receive the error  &lt;code&gt;'QuantumRegister' object is not callable&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.h(qr(0))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;TypeError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-55-c8b4318b743b&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 circuit.h(qr(0))&#xA;&#xA;TypeError: 'QuantumRegister' object is not callable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13480" LastEditorUserId="45" LastEditDate="2020-12-19T14:41:01.897" LastActivityDate="2020-12-19T14:41:01.897" Title="I don't get anything when calling circuit.draw()" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14116" PostTypeId="2" ParentId="14115" CreationDate="2020-10-12T13:07:01.867" Score="4" Body="&lt;p&gt;There is probably a change on the default arguments of &lt;code&gt;draw()&lt;/code&gt; function. To reproduce the same visualization as on the youtube video, try:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw(initial_state=True, &#xA;             cregbundle=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and add a Hadamard gate like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.h(qr[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-12T13:07:01.867" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14117" PostTypeId="1" AcceptedAnswerId="14271" CreationDate="2020-10-12T13:39:34.933" Score="2" ViewCount="175" Body="&lt;p&gt;I tried to solve a simple system of two simultaneous linear equations in with HHL algorithm in Qiskit. In particular the system is &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \begin{pmatrix}&#xA;1.5 &amp;amp; 0.5 \\&#xA;0.5 &amp;amp; 1.5&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;b = \begin{pmatrix}&#xA;0.9010 \\&#xA;-0.4339 &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;The matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is Hermitian, so HHL should cope with it without any problems.&lt;/p&gt;&#xA;&lt;p&gt;I wrote following code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;import numpy as np&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;#HHL in Qiskit&#xA;from qiskit.aqua.algorithms import HHL&#xA;&#xA;matrix_A = np.array([[1.5, 0.5],[0.5, 1.5]])&#xA;vector_b = [0.9010, -0.4339]&#xA;#x = [0.8184, -0.5747] #expected result&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;#num_q – Number of qubits required for the matrix Operator instance&#xA;#num_a – Number of ancillary qubits for Eigenvalues instance&#xA;&#xA;hhlObject = HHL(matrix = matrix_A, vector = vector_b, quantum_instance = backend, num_q = 2, num_a = 1)&#xA;&#xA;res = hhlObject.run(quantum_instance = backend)&#xA;print(res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, this error occured&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-4-071684a21c97&amp;gt; in &amp;lt;module&amp;gt;&#xA;      9 hhlObject = HHL(matrix = matrix_A, vector = vector_b, quantum_instance = backend, num_q = 2, num_a = 1)&#xA;     10 &#xA;---&amp;gt; 11 res = hhlObject.run(quantum_instance = backend)&#xA;     12 print(res)&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)&#xA;     68                 self.quantum_instance = quantum_instance&#xA;     69 &#xA;---&amp;gt; 70         return self._run()&#xA;     71 &#xA;     72     @abstractmethod&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in _run(self)&#xA;    399     def _run(self):&#xA;    400         if self._quantum_instance.is_statevector:&#xA;--&amp;gt; 401             self.construct_circuit(measurement=False)&#xA;    402             self._statevector_simulation()&#xA;    403         else:&#xA;&#xA;/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in construct_circuit(self, measurement)&#xA;    204 &#xA;    205         # InitialState&#xA;--&amp;gt; 206         qc += self._init_state.construct_circuit(&amp;quot;circuit&amp;quot;, q)&#xA;    207 &#xA;    208         # EigenvalueEstimation (QPE)&#xA;&#xA;AttributeError: 'NoneType' object has no attribute 'construct_circuit'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I also tried to run &lt;code&gt;construct_circuit&lt;/code&gt; method before &lt;code&gt;run&lt;/code&gt; method, however, same error was returned.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Could you please tell me how to set parameters of HHL algorithm to run it correctly?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-10-12T21:21:08.627" LastActivityDate="2020-10-20T13:34:09.713" Title="Error when running HHL algorithm in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14118" PostTypeId="2" ParentId="14115" CreationDate="2020-10-12T14:05:36.467" Score="2" Body="&lt;p&gt;The following also work for me if it is interest to you:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;%matplotlib inline&#xA;&#xA;circuit = QuantumCircuit(2,2)&#xA;circuit.h(0)&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7oEvA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7oEvA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="1859" LastEditDate="2020-10-12T15:13:22.080" LastActivityDate="2020-10-12T15:13:22.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14119" PostTypeId="1" CreationDate="2020-10-12T14:41:41.827" Score="-1" ViewCount="66" Body="&lt;p&gt;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 &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;, 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 (&lt;code&gt;ibmq_16_melbourne&lt;/code&gt;) in september (but It doesn't work today - the same longrunning time). What is changed?&lt;a href=&quot;https://i.stack.imgur.com/kh4J9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kh4J9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13482" LastEditorUserId="9006" LastEditDate="2020-10-13T14:00:44.183" LastActivityDate="2020-10-13T14:00:44.183" Title="Long running time at job" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14120" PostTypeId="2" ParentId="14119" CreationDate="2020-10-12T14:55:44.460" Score="0" Body="&lt;p&gt;The number of shots is also a factor in the running time of the circuit.&lt;/p&gt;&#xA;&lt;p&gt;If you run a circuit with just one shot (&lt;code&gt;shots = 1&lt;/code&gt;) then you will find that it uses less time than if you use 1000 shots.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-12T14:55:44.460" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14121" PostTypeId="2" ParentId="14113" CreationDate="2020-10-12T18:16:33.873" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Big_O_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Big-O notation&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$O(\cdot)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$O(\cdot)$&lt;/span&gt;. 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This is again a statement about asymptotic behavior of functions.  &lt;span class=&quot;math-container&quot;&gt;$4/\pi^2$&lt;/span&gt; is roughly &lt;span class=&quot;math-container&quot;&gt;$0.4...$&lt;/span&gt;, which is larger than &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt;. The probability is bounded from below by this quantity, but only &lt;strong&gt;asymptotically&lt;/strong&gt;: it could be smaller at first, but sufficiently large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is cannot go below that threshold, and therefore it cannot also go below &lt;span class=&quot;math-container&quot;&gt;$1/3r^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I am not quite sure what your third question is.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13486" LastActivityDate="2020-10-12T18:16:33.873" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14122" PostTypeId="1" CreationDate="2020-10-12T19:40:47.537" Score="0" ViewCount="44" Body="&lt;p&gt;I have used the encoding procedure mentioned on page 35 of &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9705052.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9705052.pdf&lt;/a&gt; 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,&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;{'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} &lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;I have attached my code below,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;import numpy as np&#xA;from sympy.physics.quantum.tensorproduct import  TensorProduct&#xA;&#xA;es=list(range(0,32))&#xA;&#xA;import math&#xA;a=1/math.sqrt(2)&#xA;es[0]=es[18]=es[9]=es[20]=es[10]=a/4&#xA;es[27]=es[6]=es[24]=es[29]=es[3]=es[30]=es[15]=es[17]=es[12]=es[23]=-a/4&#xA;es[5]=a/4&#xA;&#xA;    &#xA;&#xA;b=1/math.sqrt(2)&#xA;es[31]=es[13]=es[22]=es[11]=es[21]=b/4&#xA;es[4]=es[25]=es[7]=es[2]=es[28]=es[1]=es[16]=es[14]=es[19]=es[8]=-b/4&#xA;es[26]=b/4&#xA;&#xA;ph_qr=QuantumRegister(5,&amp;quot;physical_qubits&amp;quot;)&#xA;ph_cr=ClassicalRegister(5,&amp;quot;measured_physical_bits&amp;quot;)&#xA;an_qr=QuantumRegister(4,&amp;quot;ancilla_qubits&amp;quot;)&#xA;an_cr=ClassicalRegister(4,&amp;quot;measured_ancilla_bits&amp;quot;)&#xA;syndrome=QuantumCircuit(ph_qr, an_qr, ph_cr, an_cr)&#xA;syndrome.initialize(es, ph_qr)&#xA;&#xA;syndrome_nf=syndrome.copy()&#xA;syndrome_nf.h(ph_qr[2])&#xA;syndrome_nf.h(ph_qr[3])&#xA;syndrome_nf.h(an_qr[0])&#xA;syndrome_nf.h(an_qr[1])&#xA;syndrome_nf.h(an_qr[2])&#xA;syndrome_nf.h(an_qr[3])&#xA;syndrome_nf.cz(ph_qr[4], an_qr[0])&#xA;syndrome_nf.cz(ph_qr[3], an_qr[0])&#xA;syndrome_nf.h(ph_qr[3])&#xA;syndrome_nf.cz(ph_qr[2], an_qr[0])&#xA;syndrome_nf.h(ph_qr[2])&#xA;syndrome_nf.cz(ph_qr[1], an_qr[0])&#xA;syndrome_nf.h(ph_qr[4])&#xA;syndrome_nf.cz(ph_qr[4], an_qr[1])&#xA;syndrome_nf.h(ph_qr[4])&#xA;syndrome_nf.h(ph_qr[3])&#xA;syndrome_nf.cz(ph_qr[3], an_qr[1])&#xA;syndrome_nf.h(ph_qr[3])&#xA;syndrome_nf.cz(ph_qr[2], an_qr[1])&#xA;syndrome_nf.cz(ph_qr[0], an_qr[1])&#xA;syndrome_nf.h(ph_qr[4])&#xA;syndrome_nf.cz(ph_qr[4], an_qr[2])&#xA;syndrome_nf.h(ph_qr[4])&#xA;syndrome_nf.cz(ph_qr[3], an_qr[2])&#xA;syndrome_nf.cz(ph_qr[1], an_qr[2])&#xA;syndrome_nf.h(ph_qr[0])&#xA;syndrome_nf.cz(ph_qr[0] ,an_qr[2])&#xA;syndrome_nf.cz(ph_qr[4], an_qr[3])&#xA;syndrome_nf.cz(ph_qr[2], an_qr[3])&#xA;syndrome_nf.h(ph_qr[1])&#xA;syndrome_nf.cz(ph_qr[1], an_qr[3])&#xA;syndrome_nf.h(ph_qr[1])&#xA;&#xA;syndrome_nf.cz(ph_qr[0], an_qr[3])&#xA;syndrome_nf.h(ph_qr[0])&#xA;syndrome_nf.h(an_qr[0])&#xA;syndrome_nf.h(an_qr[1])&#xA;syndrome_nf.h(an_qr[2])&#xA;syndrome_nf.h(an_qr[3])&#xA;syndrome_nf.draw()&#xA;&#xA;syndrome_nf.measure(an_qr, an_cr)&#xA;&#xA;simulator=qiskit.Aer.get_backend('qasm_simulator')&#xA;result=execute(syndrome_nf, backend=simulator, shots=10240).result()&#xA;count=result.get_counts()&#xA;&#xA;print(count)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13060" LastEditorUserId="10480" LastEditDate="2021-03-10T04:00:15.493" LastActivityDate="2021-03-10T04:11:18.643" Title="Syndrome showing unexpected results for the [5,1,3] QEC code in qiskit" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14123" PostTypeId="2" ParentId="14096" CreationDate="2020-10-12T20:30:59.713" Score="0" Body="&lt;p&gt;I would recommend trying the other way that they suggest, which is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;git clone https://github.com/qiskit-community/qiskit-textbook.git&#xA;cd qiskit-textbook&#xA;pip install ./qiskit-textbook-src&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can find the juptyer notebooks with the content of the qiskit textbook in &lt;code&gt;qiskit-textbook/content&lt;/code&gt;. There, you will find many different folders, each corresponding to a given chapter in the qiskit textbook.&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;git clone https://github.com/Qiskit/qiskit-tutorials.git&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and in the &lt;code&gt;tutorials&lt;/code&gt; folder you will find a folder corresponding to each category of tutorials.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-10-12T20:30:59.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14124" PostTypeId="2" ParentId="14103" CreationDate="2020-10-12T21:12:16.593" Score="0" Body="&lt;p&gt;This is a special case of the following more general statement:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; be matrices such that &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger=BB^\dagger$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$A=BU$&lt;/span&gt; for some unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;That this is true follows easily looking at the singular value decomposition of the matrices: &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger=BB^\dagger$&lt;/span&gt; implies that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; have the same singular values and same left singular vectors, therefore their SVDs have the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\sum_k s_k |u_k\rangle\!\langle v_k|,&#xA;\qquad B = \sum_k s_k |u_k\rangle\!\langle w_k|.$$&lt;/span&gt;&#xA;We then get the conclusion by simply choosing &lt;span class=&quot;math-container&quot;&gt;$U\equiv\sum_k |w_k\rangle\!\langle v_k|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To see why this statement is relevant to the original statement about states, notice that if &lt;span class=&quot;math-container&quot;&gt;$(\psi_{ij})_{ij}$&lt;/span&gt; is the matrix of coefficients of a bipartite state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_2(|\psi\rangle\!\langle\psi|)=\psi\psi^\dagger$&lt;/span&gt;.&#xA;Therefore &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_2(|\psi\rangle\!\langle\psi|)=\operatorname{Tr}_2(|\phi\rangle\!\langle\phi|)$&lt;/span&gt; implies &lt;span class=&quot;math-container&quot;&gt;$\psi=\phi U$&lt;/span&gt;, which is equivalent to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=(I\otimes U^T)|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-10-12T21:12:16.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14125" PostTypeId="2" ParentId="14122" CreationDate="2020-10-13T00:52:27.303" Score="1" Body="&lt;p&gt;Look at the start of the multiqubit section in &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; corresponds to qubit 0 being in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and qubit 1 in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, contrary to what you might expect.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="10480" LastEditDate="2021-03-10T04:11:18.643" LastActivityDate="2021-03-10T04:11:18.643" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14128" PostTypeId="1" CreationDate="2020-10-13T10:22:55.290" Score="2" ViewCount="248" Body="&lt;h2&gt;Question&lt;/h2&gt;&#xA;&lt;p&gt;Does the below calculation conclusively show the idea of conditional time evolution (if state  measured is &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; I do &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; else I do &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; ) increases the Von Neumann entropy? Has this already been established  in the literature?&lt;/p&gt;&#xA;&lt;h2&gt;Calculation&lt;/h2&gt;&#xA;&lt;p&gt;Let's say I have an isolated system containing a measuring apparatus, an experimenter and a Hamiltonian system:&lt;/p&gt;&#xA;&lt;p&gt;Let the Hamiltonian be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_{sys}= H = \begin{pmatrix}&#xA;E_0 + \mu \cdot E &amp;amp;  - \Delta \\&#xA;- \Delta &amp;amp; E_0 - \mu \cdot E &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; is the dipole moment , &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the electric field and &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; is the ground state energy and &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; is the tunnelling element.&lt;/p&gt;&#xA;&lt;p&gt;Let the energy eigenstates be represented by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H | - \rangle = (E_0 - \sqrt{(\mu \cdot E)^2 + \Delta^2 }) | - \rangle  $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H | + \rangle = (E_0 + \sqrt{(\mu \cdot E)^2 + \Delta^2 }) | + \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, the experimenter play the following game, if he measures the energy and finds the energy in the lower of the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; energy states he will double the electric field else he will half the electric field. Hence,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H'(\pm) = H + \lambda_{\pm} I(\mu \cdot E) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix and &lt;span class=&quot;math-container&quot;&gt;$ \lambda_+ = - 1/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_- = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let the energy eigenstates of &lt;span class=&quot;math-container&quot;&gt;$H'(\pm)$&lt;/span&gt; be represented by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H' (-) | 0  \rangle =  (E_0 - \sqrt{(1+ \lambda_{-})^2(\mu \cdot E)^2 + \Delta^2 }) | 0 \rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H' (-) | 1  \rangle =  (E_0 + \sqrt{(1+ \lambda_{-})^2(\mu \cdot E)^2 + \Delta^2 }) | 1 \rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H' (+) | \tilde 0  \rangle = (E_0- \sqrt{(1+ \lambda_{+})^2(\mu \cdot E)^2 + \Delta^2 }) | \tilde  0 \rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H' (+) | \tilde 1  \rangle = (E_0 + \sqrt{(1+ \lambda_{+})^2(\mu \cdot E)^2 + \Delta^2 }) | \tilde  1 \rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let use the density matrix formalism for a pure state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle + |- \rangle $&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho  = \frac{1}{2} \Big (|-  \rangle \langle -|  + |-  \rangle \langle +| + |+  \rangle \langle -| + |+  \rangle \langle +|  \Big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;OR:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \rho  = \frac{1}{2}&#xA;\begin{bmatrix} &#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; 1 \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now lets say I measure the state and find it in &lt;span class=&quot;math-container&quot;&gt;$|- \rangle$&lt;/span&gt; and the field is changed. Then using the sudden approximation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;OR:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho' (-) = &#xA;\begin{bmatrix} &#xA;|\langle -|0  \rangle |^2 &amp;amp; |\langle -|0  \rangle \langle -|1  \rangle |  \\&#xA;|\langle -|0  \rangle \langle -|1  \rangle |  &amp;amp; \langle -|1  \rangle |^2 \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho' (+) =  \Big (| \tilde 0  \rangle \langle  \tilde  0| \Big (|\langle -| \tilde &#xA; 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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;OR:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho ' (+)= &#xA;\begin{bmatrix} &#xA;|\langle +|0  \rangle |^2 &amp;amp; |\langle -|0  \rangle \langle +|1  \rangle |  \\&#xA;|\langle +|0  \rangle \langle -|1  \rangle |  &amp;amp; \langle +|1  \rangle |^2 \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence, the new density matrix is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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 '(-)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, let write down the explicit Hamiltonian of the isolated system:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_{iso} = H  \otimes I_{\text{experimenter + apparatus}} + I \otimes H_{\text{experimenter + apparatus}} + H_{\text{int}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since, we suddenly change the electric field &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is time dependent and since this energy is supplied by the apparatus and experimenter (since he will expend energy to &amp;quot;calculate&amp;quot; how much to change the energy field by) along with the interaction between the systems. Note: &lt;span class=&quot;math-container&quot;&gt;$H_{iso}$&lt;/span&gt; is time independent (as it is an isolated system)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_{iso} = \rho(t) \otimes \rho_R(t) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is the rest of the isolated system excluding the Hamiltonian system. Since the &lt;span class=&quot;math-container&quot;&gt;$H_{iso}$&lt;/span&gt; is time independent so is &lt;span class=&quot;math-container&quot;&gt;$S(\rho_{iso})$&lt;/span&gt;. Comparing before (&lt;span class=&quot;math-container&quot;&gt;$t_-$&lt;/span&gt;) and after (&lt;span class=&quot;math-container&quot;&gt;$t_+$&lt;/span&gt;) the field is turned on:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  S(\rho_{iso}) =  S(\rho \otimes \rho_R(t_-)) = S(\rho ' \otimes \rho_R(t_+) )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the Von Neumann entropy of both sides:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ S(\rho ' \otimes \rho_R(t_+) ) =  S(\rho \otimes \rho_R(t_-) )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ S(\rho ')  + S( \rho_R(t_+) ) =  S(\rho ) + S( \rho_R(t_-) )  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Substituting &lt;span class=&quot;math-container&quot;&gt;$\rho '$&lt;/span&gt; and using &lt;span class=&quot;math-container&quot;&gt;$\Delta S_R = S( \rho_R(t_+) ) - S( \rho_R(t_-) )  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ S(p_+ \rho '(+) + p_- \rho '(-)) + \Delta S_R  -  S(\rho ) = 0   $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using an entropy &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_entropy#Properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;bound&lt;/a&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ p_+ S( \rho '(+)) + p_- S(\rho '(-)) + \Delta S_R - p_+ \ln p_+ - p_- \ln p_- -  S(\rho ) \leq 0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \Delta S_R  \leq p_+ \ln p_+ + p_- \ln p_-  +  S(\rho ) - p_+ S( \rho '(+)) - p_- S(\rho '(-))  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note the &lt;span class=&quot;math-container&quot;&gt;$p_+ \ln p_+ + p_- \ln p_- = -S_m $&lt;/span&gt; is nothing but the entropy of the Hamiltonian system when measurement is done but the electric field is not changed. We define &lt;span class=&quot;math-container&quot;&gt;$\Delta S_m = S_m - S(\rho )$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho '(-)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho '(+)$&lt;/span&gt; are pure states:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \Delta S_R  \leq - \Delta S_m  $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="5045" LastEditDate="2020-12-26T08:14:03.507" LastActivityDate="2020-12-26T08:14:03.507" Title="Conditional Time Evolution increases entropy?" Tags="&lt;measurement&gt;&lt;entropy&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14130" PostTypeId="2" ParentId="14037" CreationDate="2020-10-13T14:16:26.130" Score="0" Body="&lt;p&gt;We can take, for example, &lt;span class=&quot;math-container&quot;&gt;$ M = |0 \rangle \langle 0| \otimes I $&lt;/span&gt;, right? But then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\Big|\Big| M(\rho - \sigma) \Big|\Big|_1 &#xA;= \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 &#xA;p_0 \rho_0 = q_0 \sigma_0 &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similary, taking &lt;span class=&quot;math-container&quot;&gt;$ M = |x \rangle \langle x| \otimes I $&lt;/span&gt;, we get &lt;span class=&quot;math-container&quot;&gt;$ p_x \rho_x = q_x \sigma_x,  \forall x $&lt;/span&gt;. We conclude that &lt;span class=&quot;math-container&quot;&gt;$ \rho = \sigma $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-13T14:16:26.130" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14131" PostTypeId="1" CreationDate="2020-10-13T14:17:41.183" Score="5" ViewCount="30" Body="&lt;p&gt;Suppose we have two quantum channels &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{A\rightarrow B}, \mathcal{F}_{A\rightarrow B}$&lt;/span&gt; that satisfy&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$D(\rho\|\sigma) = Tr(\rho\log\rho) - Tr(\rho\log\sigma)$&lt;/span&gt;. Is it then true that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The question is due to a claim made in &lt;a href=&quot;https://arxiv.org/abs/1110.5746&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1110.5746&lt;/a&gt;. Proposition 4 is shown to hold for &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt; but on Page 3 (after Eq (8)), the claim is made for all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. I am not sure why. I understand it for the case where &lt;span class=&quot;math-container&quot;&gt;$\rho_{A^n}, \sigma_{A^n}$&lt;/span&gt; are also &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-fold tensor products i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_A^{\otimes n}$&lt;/span&gt; but the statement here is for any pair of states in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{A^n}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13493" LastEditorUserId="13493" LastEditDate="2020-10-13T14:24:15.520" LastActivityDate="2020-10-13T14:24:15.520" Title="Relative entropy inequality for many copies of a channel" Tags="&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14133" PostTypeId="1" AcceptedAnswerId="14134" CreationDate="2020-10-13T17:17:47.200" Score="1" ViewCount="57" Body="&lt;p&gt;The superdense coding protocol requires that A and B share an entangled state. Why is that?&#xA;That is, why does the shared state have to be entangled? Does the protocol (implicitly) use the fact that the state is entangled?&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13495" LastActivityDate="2020-10-13T18:26:11.850" Title="Significance of sharing an entangled state in Superdense Coding" Tags="&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14134" PostTypeId="2" ParentId="14133" CreationDate="2020-10-13T18:20:53.300" Score="1" Body="&lt;p&gt;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.&#xA;It is a corollary of &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's theorem&lt;/a&gt; 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&amp;gt; or |1&amp;gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastEditorUserId="13461" LastEditDate="2020-10-13T18:26:11.850" LastActivityDate="2020-10-13T18:26:11.850" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14135" PostTypeId="1" CreationDate="2020-10-13T19:27:01.830" Score="1" ViewCount="47" Body="&lt;p&gt;I was going through the &lt;a href=&quot;https://grove-docs.readthedocs.io/en/latest/vqe.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grove documentation on the Variational Quantum Eigensolver&lt;/a&gt;. 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 &amp;quot;threshold&amp;quot; (if it is indeed a threshold) be calculated for different ansätze?&lt;/p&gt;&#xA;" OwnerUserId="13461" LastActivityDate="2020-10-13T19:48:25.453" Title="Why is the VQE insensitive to noise?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;noise&gt;&lt;vqe&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14136" PostTypeId="2" ParentId="14135" CreationDate="2020-10-13T19:48:25.453" Score="1" Body="&lt;p&gt;I think it is similar to how Neural Networks are also good at handling noise (up to a certain threshold).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-13T19:48:25.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14138" PostTypeId="1" AcceptedAnswerId="14140" CreationDate="2020-10-14T04:34:36.387" Score="1" ViewCount="28" Body="&lt;p&gt;Let's say I am given a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, whose ground state is efficiently preparable. We know that &lt;span class=&quot;math-container&quot;&gt;$||H|| \leq 1$&lt;/span&gt;. Let that ground state be &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt;, with energy &lt;span class=&quot;math-container&quot;&gt;$E_{0}$&lt;/span&gt;. We also know that the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U |\psi_{0}\rangle |00\cdots0\rangle = |\psi_{0}\rangle |E_{0}\rangle,&#xA;\end{equation}&lt;/span&gt;&#xA;is efficiently preparable.&lt;/p&gt;&#xA;&lt;p&gt;Consider the promise problem. For the yes instances,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_{0} \geq c,&#xA;\end{equation}&lt;/span&gt;&#xA;and for the no instances,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_{0} \leq s,&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$c - s \geq \frac{1}{O\big(2^{poly(n)}\big)}$&lt;/span&gt;. Would this promise problem be in &lt;span class=&quot;math-container&quot;&gt;$BQP$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2020-10-14T06:37:43.583" Title="How precise are BQP measurements?" Tags="&lt;complexity-theory&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14139" PostTypeId="1" AcceptedAnswerId="15146" CreationDate="2020-10-14T04:35:10.950" Score="3" ViewCount="80" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13497" LastActivityDate="2020-12-15T10:01:41.500" Title="Where can I get circuits of interest to quantum chemistry to try and simplify?" Tags="&lt;simulation&gt;&lt;chemistry&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14140" PostTypeId="2" ParentId="14138" CreationDate="2020-10-14T06:37:43.583" Score="2" Body="&lt;p&gt;As you've written it, yes. The implication of what you've written is that &lt;span class=&quot;math-container&quot;&gt;$|E_0\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Thus, I can measure those poly(&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) qubits and exactly determine the value of &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt;. Once I have an exact classical value, it's no problem to compare it to &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, again each expressed using poly(&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;) bits.&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-14T06:37:43.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14141" PostTypeId="1" AcceptedAnswerId="14145" CreationDate="2020-10-14T06:52:02.553" Score="0" ViewCount="66" Body="&lt;p&gt;How do I output a Cirq gate as a Numpy array? For example, I would like to print a Pauli X gate &lt;code&gt;cirq.X&lt;/code&gt; as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;numpy.array([[0,1],[1,0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="9903" LastEditorUserId="55" LastEditDate="2020-10-26T15:27:03.177" LastActivityDate="2020-10-26T15:27:03.177" Title="Output a Cirq gate as a Numpy array?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14142" PostTypeId="2" ParentId="14139" CreationDate="2020-10-14T07:43:17.580" Score="0" Body="&lt;p&gt;You can create an account at IBM Q Experience for free &lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-14T07:43:17.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14143" PostTypeId="1" CreationDate="2020-10-14T09:58:07.133" Score="1" ViewCount="37" Body="&lt;p&gt;We know that &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate is as follows&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T=\left(\begin{array}{cc}1 &amp;amp; 0 \\ 0 &amp;amp; e^{i \pi / 4}\end{array}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And on the other resultant spin-resonance hamiltonian is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{H}{\hbar}=\frac{1}{2} \omega_{0} Z+g(X \cos \omega t+Y \sin \omega t)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if we go into the rotating frame we will have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So for example we can construct NOT operation, if the frequency of the AC magnetic field (&lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;) is equal to the larmor frequncy (&lt;span class=&quot;math-container&quot;&gt;$\omega_0$&lt;/span&gt;), and then we have only &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;Notice that &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; is adjustable and using that we want to achieve &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate. What do you think about that?&lt;/p&gt;&#xA;" OwnerUserId="13403" LastActivityDate="2020-10-14T09:58:07.133" Title="How can I achieve single-qubit $T$ operation using spin resonance?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-realization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14144" PostTypeId="1" CreationDate="2020-10-14T10:59:16.127" Score="2" ViewCount="56" Body="&lt;p&gt;This is in a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14138/how-precise-are-bqp-measurements&quot;&gt;similar spirit&lt;/a&gt; to another question I asked here.&lt;/p&gt;&#xA;&lt;p&gt;Let's say I am given a &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. We know that &lt;span class=&quot;math-container&quot;&gt;$||H|| \leq 1$&lt;/span&gt;. Let the ground state be &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt;, with energy &lt;span class=&quot;math-container&quot;&gt;$E_{0}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U |\psi_{0}\rangle |00\cdots0\rangle = |\psi_{0}\rangle |E_{0}\rangle.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; be an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;V |00\cdots0\rangle = |\psi_{0}\rangle,&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can we implement both &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V'$&lt;/span&gt; be what we can actually implement with exponentially many gates, and let &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}'\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{0}'$&lt;/span&gt; be the ground state and the ground energy we get by applying &lt;span class=&quot;math-container&quot;&gt;$V'$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; respectively. What is the relation between &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0}'\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$E_{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_{0}'$&lt;/span&gt;? Are they also within an inverse exponential additive error to each other?&lt;/p&gt;&#xA;&lt;p&gt;If so, is this an alternative proof that the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local Hamiltonian problem, which is complete for QMA, can be solved in BQPSPACE (the quantum analogue of PSPACE)?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; which requires only polynomially many gates.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2020-10-14T10:59:16.127" Title="How precise are BQPSPACE measurements?" Tags="&lt;complexity-theory&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14145" PostTypeId="2" ParentId="14141" CreationDate="2020-10-14T14:28:45.853" Score="2" Body="&lt;p&gt;This can be done by calling &lt;code&gt;cirq.unitary&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import cirq&#xA;&amp;gt;&amp;gt;&amp;gt; cirq.unitary(cirq.X)&#xA;array([[0.+0.j, 1.+0.j],&#xA;       [1.+0.j, 0.+0.j]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastActivityDate="2020-10-14T14:28:45.853" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14146" PostTypeId="1" AcceptedAnswerId="14153" CreationDate="2020-10-14T14:58:11.037" Score="1" ViewCount="79" Body="&lt;p&gt;I am using &lt;a href=&quot;http://www.qetlab.com/Main_Page&quot; rel=&quot;nofollow noreferrer&quot;&gt;QETLAB&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;An insight about the usage of the functions would be helpful, so as the relationship between superoperators, Kraus operators and Choi matrices.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="55" LastEditDate="2021-04-14T08:39:53.300" LastActivityDate="2021-04-14T08:39:53.300" Title="Choi matrix in QETLAB" Tags="&lt;programming&gt;&lt;quantum-operation&gt;&lt;kraus-representation&gt;&lt;diamond-norm&gt;&lt;qetlab&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14147" PostTypeId="1" AcceptedAnswerId="14157" CreationDate="2020-10-14T16:41:23.610" Score="0" ViewCount="65" Body="&lt;p&gt;I was creating a simple implementation of the Hadamard test when I came across the following, what seems like, strange behavior.&lt;/p&gt;&#xA;&lt;p&gt;Consider the following snippet, which is part of the computating the expected value of the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator with respect to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{2}|0\rangle + \frac{\sqrt{3}}{2}|1\rangle$&lt;/span&gt;. After measuring the ancillary, we compute &lt;span class=&quot;math-container&quot;&gt;$Prob(|0\rangle) - Prob(|1\rangle) = Re(\langle \psi |X|\psi\rangle)$&lt;/span&gt; (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;Circuit 1:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;reg = QuantumRegister(2)&#xA;classical = ClassicalRegister(1)&#xA;qc = QuantumCircuit(reg, classical)&#xA;&#xA;def op():&#xA;    r = QuantumRegister(1)&#xA;    gate = QuantumCircuit(r)&#xA;    gate.append(Operator(Pauli(label='X')), [*r])&#xA;    return gate.to_gate()&#xA;&#xA;qc.initialize([1/2, np.sqrt(3)/2], [reg[1]])&#xA;qc.barrier()&#xA;qc.h(reg[0])&#xA;qc.append(op().control(),[*reg])&#xA;qc.h(reg[0])&#xA;qc.barrier()&#xA;qc.measure(reg[0], classical)&#xA;job = execute(qc, Aer.get_backend('qasm_simulator'), shots=1024)&#xA;print(job.result().get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result from QASM is &lt;span class=&quot;math-container&quot;&gt;$\{'0': 499, '1': 525\}$&lt;/span&gt;, which is not correct. I verified with Qiskit's snapshot expectation that expected value  is &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{3}}{2}$&lt;/span&gt;. This was also verified through density matrix computation with numpy.&lt;/p&gt;&#xA;&lt;p&gt;However, if I replace this with the &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; as opposed to the Pauli-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; from the quantum info package of qiskit.&lt;/p&gt;&#xA;&lt;p&gt;Circuit 2&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;reg = QuantumRegister(2)&#xA;classical = ClassicalRegister(1)&#xA;qc = QuantumCircuit(reg, classical)&#xA;&#xA;qc.initialize([1/2, np.sqrt(3)/2], [reg[1]])&#xA;qc.barrier()&#xA;qc.h(reg[0])&#xA;qc.cx(reg[0], reg[1])&#xA;qc.h(reg[0])&#xA;qc.barrier()&#xA;qc.measure(reg[0], classical)&#xA;job = execute(qc, Aer.get_backend('qasm_simulator'), shots=1024)&#xA;print(job.result().get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I got the following: &lt;span class=&quot;math-container&quot;&gt;$\{'0': 962, '1': 62\}$&lt;/span&gt;, which taking &lt;span class=&quot;math-container&quot;&gt;$(962-62)/1024$&lt;/span&gt; produces an approximation to the correct result.&lt;/p&gt;&#xA;&lt;p&gt;Next I printed out the transpilation of &lt;code&gt;Circui1&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;t = transpile(qc, Aer.get_backend('qasm_simulator'), basis_gates=['u1','u2','u3','cx'])&#xA;t.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m8dbf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m8dbf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;phase difference, not a global phase difference&lt;/strong&gt;.&#xA;If we view the bipartite system as &lt;span class=&quot;math-container&quot;&gt;$reg[0] \otimes reg[1]$&lt;/span&gt;  where &lt;span class=&quot;math-container&quot;&gt;$reg[0]$&lt;/span&gt; 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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;-1 &amp;amp; 0 &amp;amp;0 &amp;amp; 0 \\&#xA; 0 &amp;amp; -1 &amp;amp;0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp;0 &amp;amp; -i \\&#xA; 0 &amp;amp; 0 &amp;amp;-i &amp;amp; 0 \\&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;So this circuit is not the same as &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas as to why I am seeing this?&lt;/p&gt;&#xA;&lt;p&gt;I thought this might be a Qiskit issue, but I posted it here in case I am missing something, which most likely the case.&lt;/p&gt;&#xA;" OwnerUserId="8765" LastEditorUserId="55" LastEditDate="2020-10-26T15:20:38.483" LastActivityDate="2020-10-26T15:20:38.483" Title="Odd behavior with Qiskit Pauli operators" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14148" PostTypeId="1" AcceptedAnswerId="14151" CreationDate="2020-10-14T16:50:42.073" Score="3" ViewCount="263" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Since length is always 1, then what's the point of adding a z axis?&lt;/p&gt;&#xA;" OwnerUserId="13449" LastActivityDate="2020-10-16T03:25:55.877" Title="Why the 3rd dimension of Bloch sphere?" Tags="&lt;bloch-sphere&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14149" PostTypeId="2" ParentId="14148" CreationDate="2020-10-14T17:11:57.090" Score="4" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-14T17:11:57.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14150" PostTypeId="1" AcceptedAnswerId="14158" CreationDate="2020-10-14T17:32:58.323" Score="6" ViewCount="129" Body="&lt;p&gt;I want to evalualte the quantum relative entropy &lt;span class=&quot;math-container&quot;&gt;$S(\rho|| \sigma)=-{\rm tr}(\rho {\rm log}(\sigma))-S(\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\sigma=|\Psi\rangle\langle\Psi|$&lt;/span&gt; is a density matrix corresponding to a pure state and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a density matrix corresponding to an arbitrary mixed state. Here, &lt;span class=&quot;math-container&quot;&gt;$S(\rho)$&lt;/span&gt; simply denotes the Von Neumann entropy of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Given that &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is diagonal, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; it seems that the first term in the quantum relative entropy will in general be infinite. As &lt;span class=&quot;math-container&quot;&gt;$S(\rho)\leq {\rm log}(d)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho \in L({\mathcal H}^{d})$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="9082" LastEditorUserId="55" LastEditDate="2020-10-22T10:50:26.953" LastActivityDate="2020-10-22T10:50:26.953" Title="Quantum relative entropy with respect to a pure state" Tags="&lt;quantum-state&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14151" PostTypeId="2" ParentId="14148" CreationDate="2020-10-14T18:35:37.827" Score="4" Body="&lt;p&gt;A qubit is a two-level quantum system and hence it can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  |\psi \rangle = \alpha |0\rangle + \beta|1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are the computational basis and they defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \ \ \ \ |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt;. So we have that &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \in \mathbb{C}^2 $&lt;/span&gt; and &lt;em&gt;you can think&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^4$&lt;/span&gt;. However, the overall phase in the quantum state doesn't matter, that is, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle $&lt;/span&gt; is equivalent to &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi} |\psi \rangle$&lt;/span&gt;. Thus, you can factor this overall phase out of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and have only 3 parameters left. Essentially now you are considering the space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-14T18:35:37.827" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14153" PostTypeId="2" ParentId="14146" CreationDate="2020-10-14T19:30:59.390" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; damp = 0.3;&#xA;&amp;gt;&amp;gt; K = { diag([1,sqrt(1-damp)]); [0,sqrt(damp);0,0] };&#xA;&amp;gt;&amp;gt; ChoiMatrix(K)&#xA;&#xA;ans =&#xA;&#xA;    1.0000         0         0    0.8367&#xA;         0         0         0         0&#xA;         0         0    0.3000         0&#xA;    0.8367         0         0    0.7000&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13507" LastEditorUserId="13507" LastEditDate="2020-10-15T12:34:16.430" LastActivityDate="2020-10-15T12:34:16.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14155" PostTypeId="1" CreationDate="2020-10-14T20:17:34.737" Score="0" ViewCount="60" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13300" LastActivityDate="2020-10-14T22:45:51.003" Title="Solving mathematical physics equations with Quantum Fourier Transform" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14156" PostTypeId="1" CreationDate="2020-10-14T20:19:58.743" Score="1" ViewCount="62" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The Hamiltonian is given as a sum of tensor products&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H = Z\otimes Z + Z \otimes X + ...$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't understand two main points:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How should I pass the Hamiltonian to the VQE? should I pass it as a list? i.e. &lt;span class=&quot;math-container&quot;&gt;$ H = [Z\^Z, X\^Z]$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="13419" LastEditorUserId="13419" LastEditDate="2020-10-14T20:54:05.170" LastActivityDate="2021-03-14T05:01:40.190" Title="How to use VQE function in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14157" PostTypeId="2" ParentId="14147" CreationDate="2020-10-14T20:38:59.350" Score="1" Body="&lt;p&gt;It is an issue. Adding &lt;code&gt;control()&lt;/code&gt; to the gate introduces a phase difference.&#xA;You can verify that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator, Pauli&#xA;&#xA;gate = QuantumCircuit(1)&#xA;gate.append(Operator(Pauli(label='X')), [0])&#xA;gate = gate.control() &#xA;&#xA;print(Operator(gate).data)&#xA;&#xA;----&#xA;Output:&#xA;&#xA;[[ 1   0   0   0]&#xA; [ 0   0   0  1j]&#xA; [ 0   0   1   0]&#xA; [ 0  1j   0   0]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So circuit 1 actually computes &lt;span class=&quot;math-container&quot;&gt;$ \text{Re}\big(\text{i} \cdot\langle \psi| X |\psi \rangle \big) = 0 $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-14T20:38:59.350" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14158" PostTypeId="2" ParentId="14150" CreationDate="2020-10-14T22:02:53.057" Score="3" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is not full rank, then the correct way to interpret the quantum relative entropy formula you wrote is to assign it the value of &lt;span class=&quot;math-container&quot;&gt;$+\infty$&lt;/span&gt; when the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is not included in the support of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_relative_entropy#Non-finite_(divergent)_relative_entropy&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia has a nice explanation&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\lim_{x\to 0} x \log(x) = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In your case, the support of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is simply the one-dimensional subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to be supported on this subspace, it must hold that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is also pure, so it must be also equal to &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle\!\langle\Psi|$&lt;/span&gt;, and so &lt;span class=&quot;math-container&quot;&gt;$\rho=\sigma$&lt;/span&gt;. In this case, the quantum relative entropy vanishes.&lt;/p&gt;&#xA;&lt;p&gt;So in summary, if &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is pure, than &lt;span class=&quot;math-container&quot;&gt;$S(\rho||\sigma)$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; (when &lt;span class=&quot;math-container&quot;&gt;$\rho=\sigma$&lt;/span&gt;) or &lt;span class=&quot;math-container&quot;&gt;$+\infty$&lt;/span&gt; (in the other cases).&lt;/p&gt;&#xA;" OwnerUserId="13486" LastActivityDate="2020-10-14T22:02:53.057" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14159" PostTypeId="2" ParentId="14156" CreationDate="2020-10-14T22:13:13.550" Score="0" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import WeightedPauliOperator&#xA;dict = {&#xA;    'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.00, &amp;quot;real&amp;quot;: 1 }, &amp;quot;label&amp;quot;: &amp;quot;ZZ&amp;quot; },&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.00, &amp;quot;real&amp;quot;: 1 }, &amp;quot;label&amp;quot;: &amp;quot;XX&amp;quot; }&#xA;              ]&#xA;}&#xA;Operator = WeightedPauliOperator.from_dict(dict)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can pass this operator to your VQE call:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;VQE(operator= Operator, var_form= ... )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-14T22:23:47.757" LastActivityDate="2020-10-14T22:23:47.757" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14160" PostTypeId="2" ParentId="14155" CreationDate="2020-10-14T22:45:51.003" Score="1" Body="&lt;p&gt;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: &lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qiskit-community/qiskit-community-tutorials&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;On the side note about QFT:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;p&gt;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,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$QFT: |\psi \rangle \to |\phi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This doesn't mean we can see what &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle$&lt;/span&gt; is since a quantum measurement collapse a wavefunction into one of the eigenstate.&lt;/p&gt;&#xA;&lt;p&gt;That is why designing quantum algorithm to take advantage of the efficiency of QFT for hard classical problems is no easy task.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-14T22:45:51.003" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14161" PostTypeId="1" AcceptedAnswerId="14169" CreationDate="2020-10-14T23:47:18.067" Score="1" ViewCount="130" Body="&lt;p&gt;Given an arbitrary density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho \in L({\mathcal H_{A}})$&lt;/span&gt;, can one always find a subspace &lt;span class=&quot;math-container&quot;&gt;${\mathcal H_{B}}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;${\mathcal H_{A}}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;${\mathcal H_{A}}={\mathcal H_{B}}\otimes{\mathcal H_{C}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;${\rm tr}_{C}(\rho)=\sigma$&lt;/span&gt; for a fixed density matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma \in L({\mathcal H_{B}})$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;While a purification of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; yields a pure state &lt;span class=&quot;math-container&quot;&gt;$| \Psi \rangle \langle \Psi |$&lt;/span&gt; with the property &lt;span class=&quot;math-container&quot;&gt;${\rm tr}_{C}(| \Psi \rangle \langle \Psi |)=\sigma$&lt;/span&gt;, I am wondering whether one can do the same given a fixed (possibly mixed) state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If this is possible, what would be the restrictions on the dimension of &lt;span class=&quot;math-container&quot;&gt;${\mathcal H_{A}}$&lt;/span&gt; (in relation to the size of &lt;span class=&quot;math-container&quot;&gt;${\mathcal H_{C}}$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="9082" LastActivityDate="2020-10-15T09:10:02.637" Title="Generalized &quot;purification&quot; scheme" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14163" PostTypeId="2" ParentId="14156" CreationDate="2020-10-15T04:47:46.930" Score="0" Body="&lt;p&gt;After few trials, appears that VQE knows how to process this form of expression, so I just passed the mathematical expression as it is.&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13419" LastActivityDate="2020-10-15T04:47:46.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14164" PostTypeId="1" AcceptedAnswerId="14205" CreationDate="2020-10-15T05:21:44.347" Score="1" ViewCount="231" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9903" LastEditorUserId="55" LastEditDate="2020-10-26T15:29:10.977" LastActivityDate="2021-03-03T15:04:31.657" Title="Can I run Cirq on IBMQ?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;cirq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14165" PostTypeId="1" AcceptedAnswerId="14166" CreationDate="2020-10-15T06:27:14.150" Score="1" ViewCount="105" Body="&lt;p&gt;I am learning to do QPE on qiskit. I wanted to choose a simple example to learn, and hence began with the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I initialized &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; this way:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(1)&#xA;&#xA;circ.h(0)&#xA;&#xA;a = Custom(num_qubits=1, state='zero', state_vector=None, circuit=circ) &#xA;&#xA;blah = a.construct_circuit(mode='circuit', register=None) &#xA;&#xA;statevec = Statevector.from_instruction(circ).data &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I then defined &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; this way:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b = MatrixOperator(np.array([[0,1],[1,0]]), basis=None, &#xA;                   z2_symmetries=None, atol=1e-12, name=None) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, I gave the QPE commands:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;qpe = QPE(operator=b, state_in=statevec, iqft=None, &#xA;          num_time_slices=1, num_ancillae=1, &#xA;          expansion_mode='trotter', expansion_order=1, &#xA;          shallow_circuit_concat=False)&#xA;&#xA;quantum_instance = QuantumInstance(backend=backend)&#xA;&#xA;results = qpe.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, when I try running QPE, I run into this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError: 'numpy.ndarray' object has no attribute 'construct_circuit'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If I define my operator instead this way:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b = Operator([[0,1],[1,0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get the error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AquaError: &amp;quot;Unsupported type to convert to WeightedPauliOperator: &amp;lt;class 'qiskit.quantum_info.operators.operator.Operator'&amp;gt;&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I also tried:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;b = Pauli.x&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but ran into:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError: 'property' object has no attribute 'copy'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Can someone help me with defining the state and operator correctly?&lt;/p&gt;&#xA;" OwnerUserId="11697" LastEditorUserId="55" LastEditDate="2020-10-26T15:29:04.620" LastActivityDate="2020-10-26T15:29:04.620" Title="QPE example on Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14166" PostTypeId="2" ParentId="14165" CreationDate="2020-10-15T07:20:55.260" Score="0" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In regard to your issue of defining the operator, as I mentioned in another answer sometime earlier, you can define the operator as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;&#xA;dict = {&#xA;&#xA;    'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.00, &amp;quot;real&amp;quot;: 1 }, &amp;quot;label&amp;quot;: &amp;quot;X&amp;quot; }}]&#xA;}&#xA;&#xA;b = WeightedPauliOperator.from_dict(dict)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can try to pass &lt;code&gt;b&lt;/code&gt; in the &lt;code&gt;QPE(operator = b, , …) &lt;/code&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Try to run this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit &#xA;from qiskit import __qiskit_version__&#xA;from qiskit.aqua.algorithms import QPE&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;from qiskit.aqua.components.initial_states import Custom&#xA;from qiskit import IBMQ, BasicAer, Aer&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.circuit.library import QFT&#xA;&#xA;print(qiskit.__qiskit_version__)&#xA;&#xA;a = Custom(1,state = 'uniform')  #Initial state as you wanted. &#xA;dict = {&#xA;    'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.00, &amp;quot;real&amp;quot;: 1 }, &amp;quot;label&amp;quot;: &amp;quot;X&amp;quot; }]&#xA;}&#xA;&#xA;b = WeightedPauliOperator.from_dict(dict) #Operator for input into QPE &#xA;&#xA;#-------- Setting up Backend --------#&#xA;provider = IBMQ.load_account()&#xA;quantum_instance = QuantumInstance(backend=Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;), shots=1)&#xA;#------------------------------------#&#xA;&#xA;n_ancillae = 3&#xA;iqft = QFT(n_ancillae).inverse()&#xA;qpe = QPE(b, a, iqft, num_time_slices=1, num_ancillae=n_ancillae,&#xA;          expansion_mode='trotter', expansion_order=1, shallow_circuit_concat=False)&#xA;qpe_result = qpe.run(quantum_instance)&#xA;&#xA;qc = qpe.construct_circuit(measurement = True)&#xA;qc.draw( ) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Running the above code I get the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dhmc9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dhmc9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-15T18:27:22.003" LastActivityDate="2020-10-15T18:27:22.003" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14167" PostTypeId="2" ParentId="14161" CreationDate="2020-10-15T07:36:18.017" Score="1" Body="&lt;p&gt;If i understand your question correctly, no, it's not possible. Take for example&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = | 0 \rangle \langle 0|^{\otimes |A|}&#xA;\hspace{0.2em} \in D(\mathcal{H_A}) $$&lt;/span&gt;&#xA;For every choice &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{H_B}, \mathcal{H_C} $&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{H_A} = \mathcal{H_B} \otimes \mathcal{H_C} $&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Tr}_C [ \rho ] = | 0 \rangle \langle 0|^{\otimes |B|} $$&lt;/span&gt;&#xA;so it can not be the case that &lt;span class=&quot;math-container&quot;&gt;$ \text{Tr}_C [ \rho ] = \sigma $&lt;/span&gt; for an arbitary fixed &lt;span class=&quot;math-container&quot;&gt;$ \sigma \in D(\mathcal{H_B}) $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-15T07:36:18.017" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14168" PostTypeId="2" ParentId="14164" CreationDate="2020-10-15T07:49:59.693" Score="3" Body="&lt;p&gt;Good question. I tried to figure this out as well since I saw your question without much success.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://pennylane.ai/plugins.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pennylane.ai/plugins.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://github.com/qiskit-community/qiskit-honeywell-provider&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qiskit-community/qiskit-honeywell-provider&lt;/a&gt;&lt;br /&gt;&#xA;There are a few other external backends that you can use through Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;So even though I wasn't able to find the solution to your question, I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-15T07:49:59.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14169" PostTypeId="2" ParentId="14161" CreationDate="2020-10-15T08:40:10.447" Score="3" Body="&lt;p&gt;First of all, your question should be more carefully formulated, since it is not even possible to always find a non-trivial sub&lt;em&gt;system&lt;/em&gt; (not sub&lt;em&gt;space&lt;/em&gt;) of &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_A$&lt;/span&gt;, see also my comment here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14049/can-a-single-qutrit-in-superposition-be-considered-entangled/14052#14052&quot;&gt;Can a single qutrit in superposition be considered entangled?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, let us assume that &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_A$&lt;/span&gt; does not have prime dimension, &lt;span class=&quot;math-container&quot;&gt;$d_A=\dim\mathcal H_A$&lt;/span&gt;. The question should then be the following:&#xA;Given a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_B$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$d_B=\dim\mathcal H_B$&lt;/span&gt; divides &lt;span class=&quot;math-container&quot;&gt;$d_A$&lt;/span&gt;, and a density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho\in\mathcal H_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma\in\mathcal H_B$&lt;/span&gt;, is there a choice of tensor product &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_A \simeq \mathcal H_B\otimes\mathcal H_C$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_C(\rho)=\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm not so sure why you would call this a &amp;quot;purification&amp;quot;, though.&lt;/p&gt;&#xA;&lt;p&gt;This can sometimes be true. For example, take for simplicity &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_B=\mathcal H_C=\mathbb C^d\otimes\mathbb C^d$&lt;/span&gt; and define &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_A := \mathcal H_B\otimes \mathcal H_C$&lt;/span&gt;.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\phi^+$&lt;/span&gt; be the standard maximally entangled state with respect to the bipartition of &lt;span class=&quot;math-container&quot;&gt;$\mathcal H_C=\mathcal H_B$&lt;/span&gt;.&#xA;Consider the product state &lt;span class=&quot;math-container&quot;&gt;$\rho=|\phi^+\rangle\langle\phi^+|\otimes|\phi^+\rangle\langle\phi^+|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\sigma = \mathbb{I}/d^2$&lt;/span&gt;. Then there is always a different bipartition &lt;span class=&quot;math-container&quot;&gt;$A=B'|C'$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_{C'}(\rho) = \sigma$&lt;/span&gt;. You can explicitly verify this by writing down the state and swapping the second tensor factors of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&#xA;However, in general, this is false since the partial trace make the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; &amp;quot;more mixed&amp;quot;. As pointed put by Danylo, the to states should fulfill some majorisation condition about their spectrum.&lt;/p&gt;&#xA;&lt;p&gt;Here's a counter-example. Take &lt;span class=&quot;math-container&quot;&gt;$\rho = \mathbb{I}/d_A$&lt;/span&gt;. Then, for any choice of bipartition, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_C(\rho) = \mathbb{I}/d_B$&lt;/span&gt;. Take &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; to be any other state, e.g. a pure one.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-10-15T09:10:02.637" LastActivityDate="2020-10-15T09:10:02.637" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14170" PostTypeId="1" AcceptedAnswerId="14171" CreationDate="2020-10-15T11:04:19.710" Score="4" ViewCount="113" Body="&lt;p&gt;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. &lt;code&gt;EfficientSU2&lt;/code&gt; of Qiskit, and I saw many of them use &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13419" LastEditorUserId="55" LastEditDate="2020-10-26T15:28:57.723" LastActivityDate="2021-04-20T06:24:24.133" Title="Intuition behind the construction of an ansatz circuit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14171" PostTypeId="2" ParentId="14170" CreationDate="2020-10-15T11:26:32.760" Score="5" Body="&lt;p&gt;Interesting question!&lt;/p&gt;&#xA;&lt;p&gt;An ansatz circuit is a parameterized circuit, say &lt;span class=&quot;math-container&quot;&gt;$V(\theta)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; are a set of parameters, used to prepare a trial state for your problem:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi(\theta)\rangle = V(\theta)|0\rangle&#xA;$$&lt;/span&gt;&#xA;In a variational algorithm, such as VQE, the trial state encodes your solution and is iteratively updated until some termination criterion is met.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi(\theta_0)\rangle \rightarrow |\Psi(\theta_1)\rangle \rightarrow \dots \rightarrow |\Psi(\theta_n)\rangle&#xA;$$&lt;/span&gt;&#xA;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?&#xA;For example: Does your solution contain complex amplitudes? If yes, you need a circuit that contains complex amplitudes (such as &lt;code&gt;EfficientSU2&lt;/code&gt;). If no, you could use one that has only real amplitudes (such as &lt;code&gt;RealAmplitudes&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Apart from that, I think we can distinguish in two different categories of ansatz circuits: physically motivated ones and heuristic ones.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Physically motivated&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Heuristically motivated&lt;/em&gt; ansatz circuits, are essentially circuit that we tested and they turned out to work well. An interesting class are &lt;em&gt;hardware efficient&lt;/em&gt; circuits (which usually are circuits with 1- and 2-qubit gates) which we can implement efficiently on hardware. &lt;code&gt;EfficientSU2&lt;/code&gt; also falls into this category.&lt;/p&gt;&#xA;&lt;p&gt;Then there are mixtures between these circuits. For instance, Qiskit's &lt;code&gt;ExcitationPreserving&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Cryoris/notebooks/blob/master/Circuits%20in%20Quantum%20Algorithms.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;This notebook&lt;/a&gt;, among other things, discusses this topic.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9800" LastEditDate="2021-04-20T06:24:24.133" LastActivityDate="2021-04-20T06:24:24.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14172" PostTypeId="1" CreationDate="2020-10-15T11:55:31.697" Score="0" ViewCount="62" Body="&lt;p&gt;I'm trying to understand, given a specific Hamiltonian, for example &lt;span class=&quot;math-container&quot;&gt;$H = Z\otimes Z+X\otimes Z$&lt;/span&gt;, does the VQE algorithm calculates the expectation value of &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt; first or does it calculates the expectation value of &lt;span class=&quot;math-container&quot;&gt;$X\otimes Z$&lt;/span&gt; first? couldn't understand it from the source code.&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much!&lt;/p&gt;&#xA;" OwnerUserId="13419" LastActivityDate="2020-11-14T19:05:20.337" Title="How does VQE performs the measurement on a given Hamiltonian?" Tags="&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14174" PostTypeId="1" AcceptedAnswerId="14175" CreationDate="2020-10-15T14:26:23.033" Score="3" ViewCount="95" Body="&lt;p&gt;I was reading the Quanta article &lt;a href=&quot;https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; which shows that there exists a problem which achieves &amp;quot;oracle separation between BQP and PH&amp;quot;. 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).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="2927" LastEditDate="2020-10-15T15:22:29.593" LastActivityDate="2020-10-16T16:04:37.633" Title="BQP and PH separation" Tags="&lt;complexity-theory&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;bqp&gt;&lt;forrelation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14175" PostTypeId="2" ParentId="14174" CreationDate="2020-10-15T15:34:42.247" Score="4" Body="&lt;p&gt;The Deutsch-Josza problem provides an oracle separation between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{EQP}$&lt;/span&gt; (exact quantum-polynomial time) and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;, but there's no preclusion against adding randomization to get an efficient classical algorithm.&lt;/p&gt;&#xA;&lt;p&gt;For example, the Deutsch-Josza problem is trivially in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;Further there is a reasonable derandomization conjecture that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;.  Thus the Deutsch-Josza problem is in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt;, modulo  such a derandomization conjecture.&lt;/p&gt;&#xA;&lt;p&gt;However, the &amp;quot;forrelation problem&amp;quot; considered in the Raz-Tal paper and discussed in the Quanta article provides an oracle separation between &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PH}$&lt;/span&gt;.  This forrelation problem is not likely in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-10-16T16:04:37.633" LastActivityDate="2020-10-16T16:04:37.633" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14176" PostTypeId="1" AcceptedAnswerId="14181" CreationDate="2020-10-15T15:35:30.143" Score="1" ViewCount="44" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="13419" LastEditorUserId="55" LastEditDate="2020-10-26T15:19:39.530" LastActivityDate="2020-10-26T15:19:39.530" Title="Is there any algorithm that implements wavelet?" Tags="&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14177" PostTypeId="1" CreationDate="2020-10-15T15:55:26.250" Score="2" ViewCount="57" Body="&lt;p&gt;I have asked two similar questions &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13899/is-there-a-quantum-gate-that-can-do-this&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13929/is-there-a-quantum-operation-that-can-transform-a-superposition-of-states-into-i&quot;&gt;2&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Given an elementary entangled state of N qubits, is there a quantum operation that produces the complement of the entangled state?&lt;/p&gt;&#xA;&lt;p&gt;By &amp;quot;elementary entangled state of N qubits&amp;quot;, I mean a state in which &lt;em&gt;all&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;By &amp;quot;complement&amp;quot;, I mean a superposition of all states that are orthogonal to the elementary entangled state, where the &amp;quot;weights&amp;quot; of all the independent components of the superposition are the same.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;almost&lt;/em&gt; be good enough (except that the components of that state wouldn't be very easily accessible for downstream operations).&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="55" LastEditDate="2020-10-17T20:29:10.977" LastActivityDate="2020-10-17T20:29:10.977" Title="A quantum operation to form the complement of an &quot;elementary&quot; entanglement of N qbits?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14178" PostTypeId="1" CreationDate="2020-10-15T17:09:40.487" Score="-1" ViewCount="51" Body="&lt;p&gt;Please, help me understand this statement.&#xA;The outer product notation for matrices also gives an intuitive input-output relation for them.&#xA;For instance, the matrix |0⟩ ⟨1| + |1⟩ ⟨0| can be read as &amp;quot;output 0 when given a 1 and output 1 when&#xA;given a 0&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-10-26T15:20:07.617" LastActivityDate="2020-10-26T15:20:07.617" Title="Outer Product Intution" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-10-19T09:44:42.550" ContentLicense="CC BY-SA 4.0" />
  <row Id="14179" PostTypeId="2" ParentId="14178" CreationDate="2020-10-15T17:23:16.457" Score="3" Body="&lt;p&gt;Note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 1| = \begin{pmatrix} 1 \\ 0 \end{pmatrix}  \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix}= \begin{pmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and similarly&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|1\rangle\langle 0| = \begin{pmatrix} 0 \\ 1 \end{pmatrix}  \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix}= \begin{pmatrix} 0 &amp;amp; 0 \\ 1 &amp;amp; 0 \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X =  |0\rangle\langle 1| + |1\rangle\langle 0| = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus you can see that &lt;span class=&quot;math-container&quot;&gt;$X|0\rangle = |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X|1\rangle = |0\rangle$&lt;/span&gt;. So giving the input is the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then the output is the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and vice versa.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-15T17:23:16.457" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14180" PostTypeId="2" ParentId="14172" CreationDate="2020-10-15T17:52:01.670" Score="0" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X\otimes Z$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13419" LastActivityDate="2020-10-15T17:52:01.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14181" PostTypeId="2" ParentId="14176" CreationDate="2020-10-15T18:10:53.177" Score="1" Body="&lt;p&gt;Could you be looking for this: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9809004&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Wavelet Transforms: Fast Algorithms and Complete Circuits&lt;/a&gt;? (this links to arxiv.) In particular, this paper presents efficient circuits for the Haar and Daubechies wavelet transforms.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastActivityDate="2020-10-15T18:10:53.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14182" PostTypeId="2" ParentId="14148" CreationDate="2020-10-15T19:00:02.543" Score="3" Body="&lt;p&gt;The Bloch sphere represents state with the following probability amplitudes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \cos(\theta/2)\  |0\rangle +e^{i\phi} \sin(\theta/2)\  |1 \rangle, $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; are the angles on the Bloch sphere. Each point on the sphere represents a different state.  As mentioned by other answers these &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)  $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi} \sin(\theta/2) $&lt;/span&gt; are not probabilities of the state being in the state &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, rather they represents the probability amplitudes. To get a probability form a probability amplitude, we square the probability amplitudes. That is, &lt;span class=&quot;math-container&quot;&gt;$\cos^2(\theta/2)  $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta/2) $&lt;/span&gt; are the probabilities, and you see they add up to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You also notice that the angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; does not show up in the expressions for probabilities. Does this mean that we can just ignore &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; all together? No. If we could then indeed we wouldn't need a 2-dimensional sphere to represents the states.&lt;/p&gt;&#xA;&lt;p&gt;The reason we cannot ignore the angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; from our considerations is because of&#xA;the superposition principle of quantum mechanics. Suppose we have,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\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.$$&lt;/span&gt;&#xA;Then the superposition principle tells us that we can make a third state out of their superposition,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\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) ,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is some normalization factor written down explicitly in the second equality. Anyway, the point here is now &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is very important. For example the probability of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_3 \rangle$&lt;/span&gt; being in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state is,  &lt;span class=&quot;math-container&quot;&gt;$$P(1) = \frac{1+\cos(\phi)}{3+\cos(\phi)}$$&lt;/span&gt;&#xA;which very much depends on &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. In fact this probability ranges from &lt;span class=&quot;math-container&quot;&gt;$0.5$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\phi = 0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\phi = \pi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13215" LastActivityDate="2020-10-15T19:00:02.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14183" PostTypeId="1" AcceptedAnswerId="14184" CreationDate="2020-10-15T19:56:29.473" Score="2" ViewCount="65" Body="&lt;p&gt;Are there any papers on the classical optimization part of QAOA?&#xA;What is the most efficient method now?&lt;/p&gt;&#xA;&lt;p&gt;And how is the classical optimization classified?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="55" LastEditDate="2020-10-17T20:22:08.323" LastActivityDate="2020-10-17T20:22:08.323" Title="Papers on classical optimization in QAOA" Tags="&lt;resource-request&gt;&lt;classical-computing&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14184" PostTypeId="2" ParentId="14183" CreationDate="2020-10-15T20:03:03.007" Score="6" Body="&lt;p&gt;These papers might help:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2004.03004&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical Optimizers for Noisy Intermediate-Scale Quantum Devices&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1910.14030&quot; rel=&quot;nofollow noreferrer&quot;&gt;Collective optimization for variational quantum eigensolvers&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Also look at these &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/introduction/optimizers.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;optimizers from Pennylane&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9006" LastEditDate="2020-10-16T10:34:41.523" LastActivityDate="2020-10-16T10:34:41.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14185" PostTypeId="1" AcceptedAnswerId="14197" CreationDate="2020-10-15T20:14:06.550" Score="10" ViewCount="416" Body="&lt;p&gt;Given a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; that generates a state &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt; and another circuit &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; that generates &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle$&lt;/span&gt;, is there a way to construct a circuit that outputs&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}(\vert \psi\rangle +\vert\phi\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;using &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; as black boxes?&lt;/p&gt;&#xA;" OwnerUserId="13521" LastActivityDate="2020-10-17T09:54:31.340" Title="Superposition of quantum circuits" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;superposition&gt;&lt;quantum-circuit&gt;" AnswerCount="3" CommentCount="9" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14187" PostTypeId="1" AcceptedAnswerId="14188" CreationDate="2020-10-15T23:49:56.257" Score="0" ViewCount="58" Body="&lt;p&gt;I am working with a matrix of the following form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A =\begin{pmatrix}&#xA;a_{11} &amp;amp;  Q  &amp;amp; \ldots &amp;amp; Q\\&#xA;a_{21} &amp;amp;  Q &amp;amp; \ldots  &amp;amp; Q\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots\\&#xA;a_{n1}  &amp;amp;   Q       &amp;amp;\ldots &amp;amp; Q&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt; elements are real and predetermined, the &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;'s are placeholders and not necessarily equal to one another, and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is square of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;x&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. I am looking to find values for all &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;'s such that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is unitary. To do this I have attempted to set up a system of nonlinear equations of the form &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger=I$&lt;/span&gt; which yields a system of &lt;span class=&quot;math-container&quot;&gt;$n^2-n$&lt;/span&gt; unknown &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;'s, but only &lt;span class=&quot;math-container&quot;&gt;$n^2/2 +n/2$&lt;/span&gt; equations after removing any duplicate equations. Therefore, for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt; the system is over-determined and for &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;3$&lt;/span&gt; the system is under-determined.&lt;/p&gt;&#xA;&lt;p&gt;My question is, is there a method in which I can solve for &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;'s to force &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to be unitary given these constraints for any size n?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastActivityDate="2020-10-16T05:31:40.647" Title="How to force a matrix to be unitary given constraints on some of the elements?" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2020-10-18T23:18:22.947" ContentLicense="CC BY-SA 4.0" />
  <row Id="14188" PostTypeId="2" ParentId="14187" CreationDate="2020-10-16T00:25:28.473" Score="3" Body="&lt;p&gt;How about just performing the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gram-Schmidt Process&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Pick the other &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; arbitrary linear independent vectors and perform Gram_schmidt process.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Caveat:&lt;/strong&gt; This requires that the vector of the first column is already normalized. Otherwise we will have &lt;span class=&quot;math-container&quot;&gt;$AA^* = cI $&lt;/span&gt; instead.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I found another related/exact same question. Here is the link:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/10239/how-can-i-fill-a-unitary-knowing-only-its-first-column&quot;&gt;How can I fill a unitary knowing only its first column?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-16T05:31:40.647" LastActivityDate="2020-10-16T05:31:40.647" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14190" PostTypeId="2" ParentId="11349" CreationDate="2020-10-16T04:35:02.903" Score="0" Body="&lt;p&gt;For 32 bit you only need 5 qubits not 32 qubits. &lt;span class=&quot;math-container&quot;&gt;$2^n=N$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; stands for number of qubits, and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; stands for number of bits.&lt;/p&gt;&#xA;" OwnerUserId="12484" LastEditorUserId="27" LastEditDate="2020-10-16T21:29:05.303" LastActivityDate="2020-10-16T21:29:05.303" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14191" PostTypeId="1" CreationDate="2020-10-16T07:32:46.677" Score="5" ViewCount="76" Body="&lt;p&gt;I understand that a quantum computer is universal if it can compute anything that a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Turing_machine&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum Turing machine&lt;/a&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4126/explicit-conversion-between-universal-gate-sets&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1522/how-are-gates-implemented-in-a-continuous-variable-quantum-computer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="144" LastEditorUserId="55" LastEditDate="2020-10-24T14:35:43.570" LastActivityDate="2020-10-24T14:35:43.570" Title="Is the universality of a qubit based quantum computer different from the universality of a continuous-variable quantum computer?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;&lt;continuous-variable&gt;&lt;quantum-turing-machine&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14192" PostTypeId="2" ParentId="14150" CreationDate="2020-10-16T08:18:15.587" Score="3" Body="&lt;p&gt;I'd like to add to Angelo Lucia's answer slightly. It is not very surprising that &lt;span class=&quot;math-container&quot;&gt;$S(\rho \| \sigma)$&lt;/span&gt; can take the value &lt;span class=&quot;math-container&quot;&gt;$+\infty$&lt;/span&gt; once we realise that the relative entropy is a generalization of the Kullback-Liebler divergence &lt;span class=&quot;math-container&quot;&gt;$D(p \| q)$&lt;/span&gt; between probability distributions &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. Formally, given two distributions &lt;span class=&quot;math-container&quot;&gt;$p,q$&lt;/span&gt; over some finite set &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; the KL-divergence is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D(p\| q) = \begin{cases}&#xA;\sum_{x \in \mathcal{x}} p(x) \log \frac{p(x)}{q(x)} \quad &amp;amp; \text{if } \mathrm{supp}(p) \subseteq \mathrm{supp}(q) \\&#xA;+ \infty &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm{supp}(p) = \{x \in \mathcal{X} : p(x)&amp;gt; 0\}$&lt;/span&gt;. Note that if we fix a basis and consider only diagonal states in that basis, i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_{x} p(x) |x\rangle \langle x |$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma = \sum_x q(x) |x\rangle \langle x |$&lt;/span&gt;, then computing &lt;span class=&quot;math-container&quot;&gt;$S(\rho \| \sigma)$&lt;/span&gt; we recover exactly the KL-divergence &lt;span class=&quot;math-container&quot;&gt;$D(p \| q)$&lt;/span&gt;. The analogous situation to taking &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; to be a pure state is taking &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; to be some point distribution (delta-distribution). In this case we see that &lt;span class=&quot;math-container&quot;&gt;$D(p\| q)$&lt;/span&gt; is finite iff &lt;span class=&quot;math-container&quot;&gt;$p=q$&lt;/span&gt;, which is exactly what we observe in the quantum case for pure states.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-10-16T08:18:15.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14193" PostTypeId="1" CreationDate="2020-10-16T10:12:25.607" Score="0" ViewCount="49" Body="&lt;p&gt;I'm trying to follow tutorial on pulse simulation described in qiskit.org.&#xA;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 (&lt;code&gt;validate_qobj_against_schema&lt;/code&gt;), so I'm struggling to find the reason. Qobj, generated by &lt;code&gt;QuantumCircuit&lt;/code&gt; command, does not raise this error.&lt;/p&gt;&#xA;&lt;p&gt;I connected to real device with APItoken, and qiskit version is up to date (qiskit 0.22.0).&#xA;Below is the trial code with real device, and log after backend.run(PulseQobj)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;&#xA;import numpy as np&#xA;from qiskit.ignis.characterization.calibrations import rabi_schedules, RabiFitter&#xA;from qiskit.pulse import DriveChannel&#xA;from qiskit.compiler import assemble&#xA;from qiskit.qobj.utils import MeasLevel, MeasReturnType&#xA;from qiskit import IBMQ&#xA;&#xA;IBMQ.enable_account(APItoken, proxies = ProxyConfig, verify = certPath)&#xA;provider = IBMQ.get_provider(hub=hub, group=group, project=project)&#xA;backend = provider.get_backend(device)&#xA;&#xA;# qubit list&#xA;qubits = [0]&#xA;&#xA;# drive amplitudes to use&#xA;num_exps = 64&#xA;drive_amps = np.linspace(0, 1.0, num_exps)&#xA;&#xA;# drive shape parameters&#xA;drive_duration = 2048&#xA;drive_sigma = 256&#xA;&#xA;# list of drive channels&#xA;drive_channels = [DriveChannel(0)]&#xA;&#xA;# construct the schedules&#xA;rabi_schedules, xdata = rabi_schedules(amp_list=drive_amps, &#xA;                                       qubits=qubits, &#xA;                                       pulse_width=drive_duration, &#xA;                                       pulse_sigma=drive_sigma,&#xA;                                       drives=drive_channels, &#xA;                                       inst_map=backend.defaults().instruction_schedule_map, &#xA;                                       meas_map=backend.configuration().meas_map)&#xA;&#xA;rabi_qobj = assemble(rabi_schedules, &#xA;                     backend=backend,&#xA;                     meas_level=1, &#xA;                     meas_return='avg',&#xA;                     shots=512)&#xA;&#xA;result = backend.run(rabi_qobj).result()&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;JSONDecodeError                           Traceback (most recent call last)&#xA;&amp;lt;ipython-input-17-16f293a93614&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 result = backend.run(rabi_qobj).result()&#xA;&#xA;JSONDecodeError: Expecting value: line 1 column 1 (char 0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13527" LastEditorUserId="13527" LastEditDate="2020-10-18T23:38:40.810" LastActivityDate="2021-03-18T00:01:35.160" Title="JSONDecodeError with backend.run" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14194" PostTypeId="2" ParentId="14193" CreationDate="2020-10-16T12:08:55.610" Score="0" Body="&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/issues/531&quot; rel=&quot;nofollow noreferrer&quot;&gt;an issue&lt;/a&gt; open to mask this. The good news is it usually goes away if you retry.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-10-16T12:08:55.610" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14195" PostTypeId="2" ParentId="14185" CreationDate="2020-10-16T13:18:21.020" Score="5" Body="&lt;p&gt;&lt;strong&gt;A counterexample&lt;/strong&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14197/9459&quot;&gt;answer&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ C_1 = X \qquad C_2 = -X$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Or one can take &lt;span class=&quot;math-container&quot;&gt;$C_2 = R_y(- \pi)$&lt;/span&gt; and all mentioned below equations will reamin true. So:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_1 |0\rangle = |1\rangle =  |\psi \rangle \qquad C_2 |0\rangle = -|1\rangle = |\phi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But we want to construct a circuit &lt;span class=&quot;math-container&quot;&gt;$C_3$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_3|0\rangle = \frac{|\psi \rangle + |\phi \rangle}{\sqrt{2}} = \frac{|1 \rangle - |1 \rangle}{\sqrt{2}} = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$C_3$&lt;/span&gt; is not unitary (&lt;span class=&quot;math-container&quot;&gt;$C_3$&lt;/span&gt; doesn't preserve the length of the vector) and this shows that for general &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; this kind of circuit cannot be created.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Another counterexample without global phase ambiguity&lt;/strong&gt; between &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_1 = R_y(\frac{\pi}{3}) \qquad C_2 = R_y(-\frac{\pi}{3})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For this case;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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 \\&#xA;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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We want to construct &lt;span class=&quot;math-container&quot;&gt;$C_3$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$C_3 |0\rangle = \frac{|\phi \rangle + |\psi\rangle}{\sqrt{2}} = \frac{\sqrt{3}}{\sqrt{2}} |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And because &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{3}}{\sqrt{2}} \ne 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C_3$&lt;/span&gt; is not a unitary and cannot be constructed.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In some cases &lt;span class=&quot;math-container&quot;&gt;$C_3$&lt;/span&gt; unitary exist: e.g. for &lt;span class=&quot;math-container&quot;&gt;$C_1 = X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2 = Z$&lt;/span&gt; we can have &lt;span class=&quot;math-container&quot;&gt;$C_3 = H = \frac{X + Z}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-16T18:51:26.273" LastActivityDate="2020-10-16T18:51:26.273" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14196" PostTypeId="1" CreationDate="2020-10-16T13:56:39.450" Score="2" ViewCount="62" Body="&lt;p&gt;How exactly does Grovers algorithm &amp;quot;crack&amp;quot; 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?&lt;/p&gt;&#xA;" OwnerUserId="13534" LastActivityDate="2020-10-16T17:19:07.870" Title="How exactly does Grovers algorithm &quot;crack&quot; symmetric key encryption?" Tags="&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14197" PostTypeId="2" ParentId="14185" CreationDate="2020-10-16T13:56:39.640" Score="2" Body="&lt;p&gt;Here's one way to do it. Let's start with some assumptions: here, I'm assuming your circuits &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;), just that the two circuits have the same number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;I also assume that since we have these two circuits &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt;, we can create controlled versions of them. This is not hard to do. [edit after @DaftWullie's comment: &lt;em&gt;the question above starts, &amp;quot;Given a quantum circuit...&amp;quot; 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.&lt;/em&gt;]&lt;/p&gt;&#xA;&lt;p&gt;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&lt;span class=&quot;math-container&quot;&gt;$_0$&lt;/span&gt; in the figure.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cWLL9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cWLL9.png&quot; alt=&quot;quantum circuit for generating the superposition state psi1 + psi2 probabilistically&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Start with all the qubits reset to the state &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle$&lt;/span&gt;. Then, apply a Hadamard gate to ctrl&lt;span class=&quot;math-container&quot;&gt;$_0$&lt;/span&gt;, and you have the combined state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left(\vert0\rangle + \vert1\rangle\right)\otimes \vert0\rangle_n&#xA;$$&lt;/span&gt;&#xA;where the ordering is apparent from above.&lt;/p&gt;&#xA;&lt;p&gt;Next, apply the controlled-&lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; box, which really just contains the circuit &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; that you have given me. The combined state is now&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left(\vert0\rangle\vert0\rangle_n + \vert1\rangle\right\vert\psi_1\rangle_n)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After applying the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left(\vert1\rangle\vert0\rangle_n + \vert0\rangle\right\vert\psi_1\rangle_n)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And so, after applying the controlled-&lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; box, which really just contains the circuit &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; that you have given me&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left(\vert1\rangle\vert\psi_2\rangle_n + \vert0\rangle\right\vert\psi_1\rangle_n)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After applying the Hadamard gate again on ctrl&lt;span class=&quot;math-container&quot;&gt;$_0$&lt;/span&gt;, this becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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] + &#xA;\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]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, if you measured the qubit ctrl&lt;span class=&quot;math-container&quot;&gt;$_0$&lt;/span&gt;, you will either get 0 or 1. If you measured 0, then you know that the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are now in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n + \vert\psi_2\rangle_n\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you measured 1, then you know that the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are now in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n - \vert\psi_2\rangle_n\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Each of these two outcomes has a probability of 1/2. That means if you really only want the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n + \vert\psi_2\rangle_n\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5119" LastEditorUserId="5119" LastEditDate="2020-10-16T15:33:04.850" LastActivityDate="2020-10-16T15:33:04.850" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14198" PostTypeId="1" AcceptedAnswerId="14200" CreationDate="2020-10-16T14:01:22.257" Score="1" ViewCount="38" Body="&lt;p&gt;Is there a good book or paper where they describe how to get the ansatz and gates from a Hamiltonian?&lt;/p&gt;&#xA;" OwnerUserId="13353" LastEditorUserId="55" LastEditDate="2020-10-17T20:24:16.173" LastActivityDate="2020-10-17T20:24:16.173" Title="Good book/paper for finding an ansatz via Trotterization?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14199" PostTypeId="1" CreationDate="2020-10-16T14:52:37.553" Score="-2" ViewCount="98" Body="&lt;pre&gt;&lt;code&gt;def SSGSM(im):&#xA;   log_image=np.log(1+np.float32(im))                                                           &#xA;   gx=cv2.Sobel(log_image,cv2.CV_64F,1,0,ksize=3)&#xA;   gy=cv2.Sobel(log_image,cv2.CV_64F,1,0,ksize=3)&#xA;   ex=np.exp(-1*abs(gx))&#xA;   ey=np.exp(-1*abs(gy))&#xA;   vx=np.multiply(gx,ex)&#xA;   vy=np.multiply(gy,ey)&#xA;   vx=np.multiply(vx,vx)&#xA;   vy=np.multiply(vy,vy)&#xA;   v_=vx+vy&#xA;   v=np.sqrt(v_)&#xA;   return v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I need to convert this code into  a quantum format..could anyone help me please?&lt;/p&gt;&#xA;" OwnerUserId="13399" LastEditorUserId="55" LastEditDate="2020-10-17T20:27:29.823" LastActivityDate="2020-10-19T15:53:31.043" Title="How can I convert arithmetic operations in a code to quantum format?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14200" PostTypeId="2" ParentId="14198" CreationDate="2020-10-16T14:57:14.460" Score="2" Body="&lt;p&gt;&lt;em&gt;I will do my best to answer from my understanding of your question:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am assuming you mean something like Unitary Coupled Cluster variational form where it is implemented the exponential to the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ e^{T - T^\dagger} $$&lt;/span&gt;&#xA;here &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is the cluster operator, which, when acting on &lt;span class=&quot;math-container&quot;&gt;$|\psi$&lt;/span&gt;, produces a linear combination of excited determinants from the reference state. It can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ T = \sum T_i$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; is the operator for all single excitation, &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; is the operator for all double excitation, and so forth.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$T_1 = \sum_{i \in occupied} \sum_{\alpha \in Virtual} t_{\alpha}^i a^\dagger_{\alpha} a_i $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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 $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \vdots $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you only pick &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; then you have what called as UCCSD variational form, which &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.chemistry.components.variational_forms.UCCSD.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;can be implemented very easily through Qiskit.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To understand how to convert exponential of matrix into quantum gates through Trotter, I would suggest you to look at &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5567/circuit-construction-for-hamiltonian-simulation?noredirect=1&amp;amp;lq=1&quot;&gt;this answer&lt;/a&gt;.   In that answer, there are two very good references that you should look into.&lt;/p&gt;&#xA;&lt;p&gt;I also suggest this paper:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1701.02691&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strategies for quantum computing molecular energies using the unitary&#xA;coupled cluster ansatz.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-16T14:57:14.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14201" PostTypeId="1" CreationDate="2020-10-16T15:37:25.500" Score="2" ViewCount="67" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$XP^{\dagger}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$C-XP^{\dagger}$&lt;/span&gt;) gate to be transversal for that specific code.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$C-P$&lt;/span&gt; is a non-Clifford gate and &lt;span class=&quot;math-container&quot;&gt;$C-XP^{\dagger} = CNOT*(C-P^{\dagger})$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$C-XP^{\dagger}$&lt;/span&gt; also is a non-Clifford gate. Doesn't this make the requirement that the (&lt;span class=&quot;math-container&quot;&gt;$C-XP^{\dagger}$&lt;/span&gt;) gate be transversal impossible in the first place?&lt;/p&gt;&#xA;" OwnerUserId="11977" LastEditorUserId="11977" LastEditDate="2020-10-16T18:05:53.110" LastActivityDate="2020-10-16T18:05:53.110" Title="Is there a CSS code for which the controlled phase gate and all Clifford gates are transversal?" Tags="&lt;stabilizer-code&gt;&lt;clifford-group&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14202" PostTypeId="1" AcceptedAnswerId="14204" CreationDate="2020-10-16T16:34:19.893" Score="2" ViewCount="59" Body="&lt;p&gt;Let's say I have 2 density operators &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Now, here is what I am trying to calculate:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\tr}{\operatorname{trace}}&#xA;\tr(A \sqrt{B} A \sqrt{B}).&#xA;$$&lt;/span&gt;&#xA;I saw that this trace can be rewritten as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tr(A \sqrt{B} A \sqrt{B}) = \tr\Bigg(\Big(\sqrt{\sqrt{B}} A \sqrt{\sqrt{B}}\Big)^2\Bigg).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was wondering, which property of trace is being used here. I do not think the cyclic property would help, would it?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-10-17T20:25:07.513" LastActivityDate="2020-10-17T20:25:07.513" Title="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]$?" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14203" PostTypeId="2" ParentId="14196" CreationDate="2020-10-16T17:19:07.870" Score="2" Body="&lt;p&gt;Grover's algorithm is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Circuit_satisfiability_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Circuit SAT&lt;/a&gt; solver that finds a satisfying assignment in around &lt;span class=&quot;math-container&quot;&gt;$2^{n/2}$&lt;/span&gt; evaluations of the circuit, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^{n/2}$&lt;/span&gt; decryptions where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the key length.&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2020-10-16T17:19:07.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14204" PostTypeId="2" ParentId="14202" CreationDate="2020-10-16T17:32:10.143" Score="3" Body="&lt;p&gt;This follows from the cyclicity of trace.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{tr}\left(\left(\sqrt{\sqrt{B}}A\sqrt{\sqrt{B}}\right)^2\right) &amp;amp;= &#xA;\text{tr}\left(\sqrt{\sqrt{B}}A\sqrt{\sqrt{B}}\sqrt{\sqrt{B}}A\sqrt{\sqrt{B}}\right)\\&#xA;&amp;amp;= \text{tr}\left(\sqrt{\sqrt{B}}A\sqrt{B}A\sqrt{\sqrt{B}}\right)\\&#xA;&amp;amp;= \text{tr}\left(A\sqrt{B}A\sqrt{\sqrt{B}}\sqrt{\sqrt{B}}\right)\\&#xA;&amp;amp;= \text{tr}\left(A\sqrt{B}A\sqrt{B}\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5669" LastActivityDate="2020-10-16T17:32:10.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14205" PostTypeId="2" ParentId="14164" CreationDate="2020-10-16T18:24:44.197" Score="2" Body="&lt;p&gt;This task can be accomplished via &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.QasmOutput.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;cirq.QasmOutput&lt;/a&gt;. I've attached an example of how to use the aforementioned functionality to run Cirq circuits on Qiskit's backends.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq &#xA;from typing import Tuple&#xA;from qiskit import QuantumCircuit, execute, Aer&#xA;&#xA;def main():&#xA;    q0 = cirq.LineQubit(1)  &#xA;    cirq_circuit = cirq.Circuit(&#xA;        cirq.H(q0),  &#xA;        cirq.measure(q0)&#xA;    )&#xA;    results, qasm_circuit = run_cirq_circuit_on_qiskit(cirq_circuit, (q0,), 'qasm_simulator')&#xA;    &#xA;    # Returns counts&#xA;    counts = results.get_counts(qasm_circuit)&#xA;    print(&amp;quot;Total count for 00 and 11 are:&amp;quot;, counts)&#xA;    &#xA;def run_cirq_circuit_on_qiskit(circuit: 'cirq.Circuit', qubits: Tuple['cirq.Qid', ...], backend: str):&#xA;    qasm_output = cirq.QasmOutput((circuit.all_operations()), qubits)&#xA;    qasm_circuit = QuantumCircuit().from_qasm_str(str(qasm_output))&#xA;    # Execute the circuit qiskit backend&#xA;    job = execute(qasm_circuit, Aer.get_backend(backend), shots=1000)&#xA;    # Grab results from the job&#xA;    return job.result(), qasm_circuit&#xA;&#xA;if __name__ == '__main__':&#xA;    main()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2021-03-03T15:04:31.657" LastActivityDate="2021-03-03T15:04:31.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14206" PostTypeId="1" CreationDate="2020-10-16T22:32:06.767" Score="0" ViewCount="225" Body="&lt;p&gt;In &lt;a href=&quot;https://www.youtube.com/watch?v=F_Riqjdh2oM&amp;amp;t=3479s&quot; rel=&quot;nofollow noreferrer&quot;&gt;MS presentation&lt;/a&gt;, they describe the process &lt;code&gt;CNOT&lt;/code&gt; gate working with state machine diagram. At first they drew &lt;code&gt;CNOT&lt;/code&gt; gate in black bock as following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/odXyS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/odXyS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This implies, that &lt;code&gt;Input&lt;/code&gt; qbit is not affected, since it is always &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. This also corresponds with what they drew earlier for any irreversible operation made reversible.&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, on next slide they drew, that &amp;quot;Input&amp;quot; qubit (left circle on slide, green state change arrow) is affected&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9rEX7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9rEX7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why?&lt;/p&gt;&#xA;&lt;p&gt;I checked myself of applying &lt;code&gt;CNOT&lt;/code&gt; matrix to depicted state and found that input state changes, while output does not.&lt;/p&gt;&#xA;&lt;p&gt;So this was just error on slides, implying &amp;quot;Input&amp;quot; is not changes?&lt;/p&gt;&#xA;" OwnerUserId="13005" LastEditorUserId="55" LastEditDate="2020-10-22T10:46:50.080" LastActivityDate="2020-10-22T10:46:50.080" Title="Should C-NOT gate affect &quot;input&quot; qubit or not?" Tags="&lt;quantum-gate&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14207" PostTypeId="2" ParentId="14206" CreationDate="2020-10-16T23:31:29.330" Score="3" Body="&lt;p&gt;Short answer: both can be correct, depending on the state to which the CNOT gate is applied.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;At the first slide the presentation talks about the effect of CNOT gate &lt;em&gt;on basis states&lt;/em&gt;. And indeed, if the input to the CNOT gate is a basis state, it only changes the state of the target qubit.&lt;/p&gt;&#xA;&lt;p&gt;At the second slide, the CNOT gate is applied to a &lt;em&gt;superposition of states&lt;/em&gt;. If the input state is &lt;span class=&quot;math-container&quot;&gt;$|-\rangle \otimes |-\rangle$&lt;/span&gt;, as the circles seem to imply, the effect of the CNOT gate on it will be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|-\rangle \otimes |-\rangle = \frac12(|00\rangle - |10\rangle - |01\rangle + |11\rangle) \rightarrow \\&#xA;\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;It is also possible to have the CNOT gate change the state of both input and output qubits. For example, &lt;span class=&quot;math-container&quot;&gt;$\textrm{CNOT}|0\rangle \frac{1}{\sqrt2}(|0\rangle + |1\rangle) = \textrm{CNOT}\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$&lt;/span&gt; - now the input and output qubits don't have individual states of their own, but rather are entangled.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-16T23:31:29.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14208" PostTypeId="2" ParentId="14206" CreationDate="2020-10-16T23:32:26.273" Score="3" Body="&lt;p&gt;This is known as &amp;quot;Phase Kickback&amp;quot; in quantum computing. It is a trick that uses in a many quantum algorithms.&lt;/p&gt;&#xA;&lt;p&gt;The phase of the target qubit can kickback to the control-qubit and changes the phase of it.&lt;/p&gt;&#xA;&lt;p&gt;Take a look here: &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/phase-kickback.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phase Kickback&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xk4IK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xk4IK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-16T23:32:26.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14210" PostTypeId="1" AcceptedAnswerId="14219" CreationDate="2020-10-17T07:07:02.313" Score="4" ViewCount="140" Body="&lt;p&gt;I'm sure I don't fully understand &lt;em&gt;support&lt;/em&gt;, but I am having trouble seeing how it connects to things like density operators. I have an idea that it means, according to Wikipedia:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;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.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;First of all, what would &lt;em&gt;support&lt;/em&gt; be used for in quantum theory? What is the meaning of the &lt;em&gt;support&lt;/em&gt; of a density operator or quantum state? Perhaps someone could explain what &amp;quot;states with support on orthogonal subspaces means&amp;quot; and what implications it has.&lt;/p&gt;&#xA;" OwnerUserId="13538" LastActivityDate="2020-10-17T16:47:07.190" Title="What is the intuition behind &quot;states with support on orthogonal subspaces&quot;?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14212" PostTypeId="1" CreationDate="2020-10-17T07:22:09.033" Score="5" ViewCount="86" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13539" LastEditorUserId="55" LastEditDate="2020-10-17T20:28:33.863" LastActivityDate="2020-10-19T09:24:05.997" Title="What is the difference between no signaling and non locality at operational and ontological level?" Tags="&lt;non-locality&gt;&lt;information-theory&gt;&lt;foundations&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14214" PostTypeId="2" ParentId="14185" CreationDate="2020-10-17T09:54:31.340" Score="7" Body="&lt;p&gt;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 &lt;em&gt;global&lt;/em&gt; phases of the two initial states. However, it is possible to rephrase the question so that is meaningful and has an interesting answer.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; is not sensitive to the arbitrary global phase of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To make sense of addition, note that the desired target state &lt;span class=&quot;math-container&quot;&gt;$\alpha |\psi\rangle + \beta |\phi\rangle$&lt;/span&gt;, for any choice of &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb C$&lt;/span&gt;, lies in the 2-dimensional subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Hence, without loss of generality, we can restrict the problem to this subspace and think of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; as qubit states regardless of their original dimension.&lt;/p&gt;&#xA;&lt;p&gt;Now, consider a more general problem where you want to somehow continuously interpolate between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. That is, you want the desired target state to lie on a path (on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;) connecting the two original states. Say, you could choose something like &lt;span class=&quot;math-container&quot;&gt;$\sin(t) |\psi\rangle + \cos(t) |\phi\rangle$&lt;/span&gt;, appropriately normalized. While this seems like a reasonable choice, the path can vary wildly depending on the global phase of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; as they amount to relative phases in the sum.&lt;/p&gt;&#xA;&lt;p&gt;Given such abundance of possible paths, what would be the most natural choice of a path between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;? From a geometric perspective, the shortest (or geodesic) path along a great circle is a great choice.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\vec{r}, \vec{s} \in \mathbb R^3$&lt;/span&gt; are the Bloch vectors of the two states, the line segment in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^3$&lt;/span&gt; between them is described by &lt;span class=&quot;math-container&quot;&gt;$p \vec{r} + (1-p) \vec{s}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$p \in [0,1]$&lt;/span&gt;. Normalizing this Bloch vector to a unit vector gives you a geodesic path on the surface of the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;To describe this in terms of density matrices, recall that the density matrix associated to Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\vec{r} = (x,y,z)$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho(\vec{r})&#xA;= \frac{1}{2} (I + x X +y Y + z Z)&#xA;= \frac{1}{2} \begin{pmatrix} 1+z &amp;amp; x-iy \\ x+iy &amp;amp; 1-z \end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;You can check that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{Tr}\rho(\vec{r})^2&#xA;= \frac{1}{2} (1 + \vec{r} \cdot \vec{r})&#xA;= \frac{1}{2} (1 + x^2 + y^2 + z^2),&#xA;$$&lt;/span&gt;&#xA;meaning that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\vec{r}\|&#xA;= \sqrt{x^2 + y^2 + z^2}&#xA;= \sqrt{2\operatorname{Tr}\bigr(\rho(\vec{r})^2\bigl)-1}.&#xA;$$&lt;/span&gt;&#xA;For any non-zero vector &lt;span class=&quot;math-container&quot;&gt;$\vec{r} \in \mathbb R^3$&lt;/span&gt;, the density matrix of a normalized pure state in direction &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt; can be obtained as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\biggl(\frac{\vec{r}}{\|\vec{r}\|}\biggr)&#xA;= \frac{1}{2} \Biggl(&#xA;    I + \frac{2\rho(\vec{r})-I}&#xA;    {\sqrt{2\operatorname{Tr}\bigr(\rho(\vec{r})^2\bigl)-1}}&#xA;  \Biggr).&#xA;$$&lt;/span&gt;&#xA;Thus, given two arbitrary density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; of &lt;em&gt;pure qubit states&lt;/em&gt;, the geodesic between them is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} \Biggl(&#xA;  I + \frac{2(p\rho+(1-p)\sigma)-I}&#xA;    {\sqrt{2\operatorname{Tr}\bigl((p\rho+(1-p)\sigma)^2\bigr)-1}}&#xA;\Biggr).&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p \in [0,1]$&lt;/span&gt;. This gives you an unambiguous (while somewhat lengthy) way to interpolate between two pure qubit states.&lt;/p&gt;&#xA;&lt;p&gt;You can also express this in terms of pure states. The key here is to note that the expression&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a |\psi\rangle + b \frac{\langle\phi|\psi\rangle}{|\langle\phi|\psi\rangle|} |\phi\rangle&#xA;$$&lt;/span&gt;&#xA;describes the same state regardless of the global phases of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. By appropriately choosing &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and normalizing the resulting state, you can also unambiguously interpolate between them.&lt;/p&gt;&#xA;&lt;p&gt;Regarding your original question, the problem you are interested in is known as &lt;strong&gt;coherent state addition&lt;/strong&gt;. You can look up Theorem 14 in &lt;a href=&quot;https://arxiv.org/abs/1608.00281&quot; rel=&quot;noreferrer&quot;&gt;my paper&lt;/a&gt; to see how it can be achieved, given enough copies of both states.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lSein.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lSein.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The main idea is to make one of the states evolve according to the Hamiltonian given by the commutator &lt;span class=&quot;math-container&quot;&gt;$i[|\phi\rangle\langle\phi|,|\psi\rangle\langle\psi|]$&lt;/span&gt; of the two states. This can be achieved by repeatedly combining the two states using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Swap_test&quot; rel=&quot;noreferrer&quot;&gt;swap test&lt;/a&gt; (this is reminiscent to what eqb proposed in their answer). The intuition for why this works is similar to &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Grover's algorithm&lt;/a&gt; -- 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.&lt;/p&gt;&#xA;" OwnerUserId="4477" LastActivityDate="2020-10-17T09:54:31.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14215" PostTypeId="1" CreationDate="2020-10-17T10:02:00.357" Score="0" ViewCount="59" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmqx2')&#xA;    noise_model = NoiseModel.from_backend(backend)&#xA;# Get coupling map from backend&#xA;    coupling_map = backend.configuration().coupling_map&#xA;# Get basis gates from noise model&#xA;    basis_gates = noise_model.basis_gates&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; error_1 = noise.depolarizing_error(er1, 1)&#xA;noise_model.add_quantum_error(error_1, ['u1', 'u2', 'u3','h'],[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-22T10:47:48.970" LastActivityDate="2021-03-21T11:04:10.630" Title="Simulation of Noise in a particular quantum computer" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14216" PostTypeId="1" CreationDate="2020-10-17T10:30:36.943" Score="1" ViewCount="72" Body="&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;def random_bitstring_generator(bit_number, backend):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    Generate a bitstring with one qubit&#xA;    :param bit_number: number of bits that we want to generate&#xA;    :param backend: Qiskit hardware or simulator&#xA;    :return: string object with random bits&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;&#xA;    one_qubit_random_bit_generator_circuit = QuantumCircuit(1,1)&#xA;    one_qubit_random_bit_generator_circuit.h(0)&#xA;    one_qubit_random_bit_generator_circuit.measure(0,0)&#xA;&#xA;    for _ in range(bit_number):&#xA;        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1).result().get_counts()&#xA;        bit = list(counts.keys())[0]  # we have only one key because shots=1&#xA;        bitstring += bit&#xA;&#xA;    return bitstring&#xA;&#xA;provider = IBMQ.load_account()&#xA;backend = BasicAer.get_backend('ibmq_santiago')&#xA;&#xA;print(random_bitstring_generator(512, backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;a href=&quot;https://i.stack.imgur.com/O9ndC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O9ndC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-10-22T10:47:54.493" LastActivityDate="2020-10-22T10:47:54.493" Title="Unable to run program on different backends" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;&lt;quantumlab&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14217" PostTypeId="1" CreationDate="2020-10-17T13:44:32.523" Score="1" ViewCount="71" Body="&lt;p&gt;I try to design the circuit for &lt;span class=&quot;math-container&quot;&gt;$b = 11$&lt;/span&gt; and succeeded in running. Therefore, I start to think of the circuit for different secret string &lt;span class=&quot;math-container&quot;&gt;$b = 01$&lt;/span&gt;. The circuit I made is down below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ss83H.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ss83H.png&quot; alt=&quot;The IBM Quantum circuit I made&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the problem: After the first Hadamard operator, if the input &lt;span class=&quot;math-container&quot;&gt;$x = \left|10\right\rangle$&lt;/span&gt;, the   &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; result (That is the measurement of &lt;span class=&quot;math-container&quot;&gt;$q2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q3$&lt;/span&gt;, which is the last two bits of &lt;span class=&quot;math-container&quot;&gt;$\left|y_1y_2y_3y_4\right\rangle$&lt;/span&gt; in Computational basis states) according to my circuit, should be &lt;span class=&quot;math-container&quot;&gt;$\left|11\right\rangle$&lt;/span&gt;, the same as the input &lt;span class=&quot;math-container&quot;&gt;$x = \left|11\right\rangle$&lt;/span&gt;. And the output of &lt;span class=&quot;math-container&quot;&gt;$y1, y2$&lt;/span&gt; should match the condition:&lt;span class=&quot;math-container&quot;&gt;$$b\cdot{y} = 0\,(\,mod\,2\,)$$&lt;/span&gt;Hence, one of the output I believe is &lt;span class=&quot;math-container&quot;&gt;$\left|1011\right\rangle$&lt;/span&gt;, but the calculator gives me a wired (at least I think it is wired) result. What are the issues?&lt;/p&gt;&#xA;" OwnerUserId="13500" LastActivityDate="2021-04-12T17:03:50.303" Title="A Simon's algorithm with secret string b = 01, IBM Quantum experience gives a different result from whay I calculate" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14218" PostTypeId="1" AcceptedAnswerId="14220" CreationDate="2020-10-17T15:48:24.253" Score="3" ViewCount="149" Body="&lt;p&gt;Consider a quantity&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathbb{E}\big[\langle z|\rho|z\rangle\big],&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi \rangle \langle \psi|$&lt;/span&gt; is a Haar-random state &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum state and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is the label of a fixed &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit basis vector. Now, consider&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\sigma = \underset{\text{diagonal}~U}{\mathbb{E}}\big[U\rho U^{*}\big],&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is as defined before, and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a diagonal unitary matrix such that the diagonal entries are uniformly random complex phases. I am trying to prove that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathbb{E}\big[\langle z|\rho|z\rangle\big] = \mathbb{E}\big[\langle z|\sigma|z\rangle\big]&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2020-10-17T15:54:18.523" LastActivityDate="2020-11-08T10:51:11.620" Title="Expected value of a Haar random quantum state multiplied by a unitary" Tags="&lt;quantum-state&gt;&lt;haar-distribution&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14219" PostTypeId="2" ParentId="14210" CreationDate="2020-10-17T16:47:07.190" Score="3" Body="&lt;p&gt;Consider a vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; with an inner product and a linear operator &lt;span class=&quot;math-container&quot;&gt;$A:V\rightarrow V$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The definition of support that you have posted from Wikipedia can be a bit confusing. It says &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(A) = \{u\in V|Au\neq 0\}$&lt;/span&gt;. This is the complement of the kernel where the kernel of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\text{ker}(A) = \{v\in V| Av = 0\}$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(A)$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The definition of the support of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; which is used in quantum information is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Orthogonal_complement&quot; rel=&quot;nofollow noreferrer&quot;&gt;orthogonal complement&lt;/a&gt; of the kernel i.e. &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(A) = \{u\in V| \langle u, v\rangle = 0, v\in \text{ker}(A)\}$&lt;/span&gt;. See for example page 14 of this &lt;a href=&quot;https://arxiv.org/pdf/1504.00233.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;textbook&lt;/a&gt; where it is introduced. Some useful properties are&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For self-adjoint &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, the image of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the same as the support of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. To see this, pick any &lt;span class=&quot;math-container&quot;&gt;$u\in \ker(A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v\in V$&lt;/span&gt;. Then you have &lt;span class=&quot;math-container&quot;&gt;$$0 = \langle Au, v \rangle = \langle u, Av \rangle \implies Av \in \text{supp}(A)$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; have support on orthogonal subspaces, then it means that the &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\sigma)\subseteq \ker{(\rho)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\rho)\subseteq \ker{(\sigma)}$&lt;/span&gt;. You can then construct a projective measurement &lt;span class=&quot;math-container&quot;&gt;$\{P_{\text{supp}(\rho)}, I - P_{\text{supp}(\rho)}\}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\{P_{\text{supp}(\sigma)}, I - P_{\text{supp}(\sigma)}\}$&lt;/span&gt; and this is guaranteed to distinguish perfectly between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastActivityDate="2020-10-17T16:47:07.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14220" PostTypeId="2" ParentId="14218" CreationDate="2020-10-17T17:07:17.443" Score="4" Body="&lt;p&gt;With the chosen structure of &lt;span class=&quot;math-container&quot;&gt;$ U $&lt;/span&gt;, i think it's even possible to prove the stronger statement:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \langle z| \rho|z \rangle = \langle z| \sigma_\rho|z \rangle, \hspace{0.2em} \text{where} \hspace{0.2em}  &#xA;\sigma_\rho = \mathbb{E}_U \big[U\rho U^\dagger\big] &#xA;\text{and} \hspace{0.3em}  &#xA;|z\rangle \hspace{0.3em}  \text{a computational basis vector.}$$&lt;/span&gt;&#xA;You may write &lt;span class=&quot;math-container&quot;&gt;$ U = \sum_{k \in \{0, 1\}^n} e^{i \phi_k} |k\rangle \langle k| $&lt;/span&gt;, for uniform &lt;span class=&quot;math-container&quot;&gt;$ \phi_k \in_R [0, 2\pi] $&lt;/span&gt; and calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA; U\rho U^\dagger &amp;amp;= &#xA;\sum_{k, m} e^{i (\phi_k - \phi_m)} \langle k|\rho|m \rangle \cdot |k\rangle \langle m| \implies \\&#xA;\mathbb{E}_U \big[U\rho U^\dagger\big] &amp;amp;= &#xA;\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\\&#xA;\langle z |\sigma_\rho| z \rangle &amp;amp;=  \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\\&#xA;\langle z |\sigma_\rho| z \rangle &amp;amp;=   \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&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-10-17T17:42:58.223" LastActivityDate="2020-10-17T17:42:58.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14221" PostTypeId="2" ParentId="14216" CreationDate="2020-10-17T17:27:26.483" Score="1" Body="&lt;p&gt;I don't know what do you mean, the error specifically says that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;QiskitBackendNotFoundError: &amp;quot;The 'ibmq_santiago' backend is not installed in your system.&amp;quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This means you don't have access to this machine from your account. This machine is either dedicated to only privilege users.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-17T17:27:26.483" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14222" PostTypeId="2" ParentId="14215" CreationDate="2020-10-17T17:51:44.543" Score="0" Body="&lt;p&gt;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: &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/3_building_noise_models.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Building Noise Models&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-17T17:51:44.543" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14223" PostTypeId="2" ParentId="14217" CreationDate="2020-10-17T18:26:10.503" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qYEJw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qYEJw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So you have the possibility of observing the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;. But we know that &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is trivial so without much checking &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; is what you are looking for...&lt;/p&gt;&#xA;&lt;p&gt;Here is the code to generate the above circuit and histogram plot in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;from qiskit import QuantumCircuit, BasicAer, execute&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;&#xA;qreg_q = QuantumRegister(4, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.h(qreg_q[0])&#xA;circuit.h(qreg_q[1])&#xA;circuit.cx(qreg_q[0], qreg_q[2])&#xA;circuit.cx(qreg_q[0], qreg_q[3])&#xA;circuit.barrier(range(4))&#xA;circuit.h(qreg_q[0])&#xA;circuit.h(qreg_q[1])&#xA;circuit.barrier(range(4))&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;circuit.measure(qreg_q[1], creg_c[1])&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, scale = 1.5, plot_barriers = False)&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots = 20000)&#xA;plot_histogram(job.result().get_counts(), color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;A quick note:&lt;/strong&gt; If I use the &lt;code&gt;statevector_simulator&lt;/code&gt; option then I will either get &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as it just a one-shot simulator.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-13T16:49:06.487" LastActivityDate="2020-11-13T16:49:06.487" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14224" PostTypeId="1" CreationDate="2020-10-18T06:00:57.493" Score="2" ViewCount="123" Body="&lt;p&gt;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 &lt;code&gt;qiskit.providers.BasicAer&lt;/code&gt; and &lt;code&gt;qiskit.providers.Aer&lt;/code&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="9006" LastEditDate="2020-10-18T07:00:36.683" LastActivityDate="2021-03-17T07:04:50.423" Title="Qiskit BasicAer &amp; Aer" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14225" PostTypeId="2" ParentId="14224" CreationDate="2020-10-18T06:35:30.430" Score="0" Body="&lt;p&gt;Regarding to the difference between BasicAer and Aer, take a look at this answer: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4996/9858&quot;&gt;https://quantumcomputing.stackexchange.com/a/4996/9858&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And in term of BasicAer returns incorrect result, take a look here: &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/1838&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/1838&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-18T06:35:30.430" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14226" PostTypeId="1" AcceptedAnswerId="14243" CreationDate="2020-10-18T06:47:24.497" Score="0" ViewCount="95" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;WARNING: quantum error already exists for instruction &amp;quot;u2&amp;quot; on qubits [0] , appending additional error.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I know that some warnings can be suppressed with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;warnings.filterwarnings('ignore', category=DeprecationWarning)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;warnings.filterwarnings('ignore')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;to suppress all warnings does not help.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-22T10:48:54.957" LastActivityDate="2020-10-22T10:48:54.957" Title="Suppress Warnings" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14227" PostTypeId="2" ParentId="14216" CreationDate="2020-10-18T06:52:03.017" Score="3" Body="&lt;p&gt;Try to replace&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = BasicAer.get_backend('ibmq_santiago')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmq_santiago')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Alternativetly, you can also use this code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.backends(name = 'ibmq_santiago')[0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You have to use backends available under you account. There are only simulators in BasicAer while the real quantum machines are under the account.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-10-18T06:57:19.127" LastActivityDate="2020-10-18T06:57:19.127" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14228" PostTypeId="2" ParentId="14226" CreationDate="2020-10-18T07:27:31.080" Score="0" Body="&lt;p&gt;I &lt;strong&gt;don't know&lt;/strong&gt; if this help at all but in term of warning categories, I used &lt;code&gt;?? warnings&lt;/code&gt; and found a few other types:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;category=PendingDeprecationWarning&#xA;category=ImportWarning&#xA;category=ResourceWarning&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I also see a question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13181/suppress-deprecation-warnings-from-qiskit&quot;&gt;related to warning to Qiskit here&lt;/a&gt;. It is not the same as what you are asking but hopefully it will help somehow.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-18T16:58:32.257" LastActivityDate="2020-10-18T16:58:32.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14229" PostTypeId="1" AcceptedAnswerId="14234" CreationDate="2020-10-18T07:59:10.790" Score="1" ViewCount="46" Body="&lt;p&gt;I usually use Qiskit &amp;quot;Aer&amp;quot; to simulate quantum circuit with several methods such as &lt;code&gt;statevector&lt;/code&gt;, &lt;code&gt;density_matrix&lt;/code&gt;, &lt;code&gt;stabilizer&lt;/code&gt;, &lt;code&gt;extended_stabilizer&lt;/code&gt;, and &lt;code&gt;matrix_product_state&lt;/code&gt;. Recenlty I came across another simulator called &amp;quot;BasicAer&amp;quot; and I wonder if the qiskit BasicAer supports above methods.&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="1859" LastEditDate="2020-10-25T17:12:55.263" LastActivityDate="2020-10-25T17:12:55.263" Title="Qiskit BasicAer simulator options" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14230" PostTypeId="2" ParentId="14212" CreationDate="2020-10-18T08:01:17.103" Score="4" Body="&lt;p&gt;No signaling means can't be used for communication. Can't be used to move messages from a sender to a receiver.&lt;/p&gt;&#xA;&lt;p&gt;Local means doesn't require communication to implement.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-10-18T08:01:17.103" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14231" PostTypeId="1" AcceptedAnswerId="14238" CreationDate="2020-10-18T08:59:06.667" Score="3" ViewCount="89" Body="&lt;p&gt;Let us consider&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|T\rangle = |\psi \rangle^{\otimes m}&#xA;\end{equation}&lt;/span&gt;&#xA;for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; be the space of all &lt;span class=&quot;math-container&quot;&gt;$(m + 1)$&lt;/span&gt;-partite states that are invariant under permutations. Consider &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|T\rangle$&lt;/span&gt;, which belongs to the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt;. I am trying to prove:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle |T\rangle$&lt;/span&gt; is almost orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt;, upto an error &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\big(\frac{1}{m}\big)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;There exists a measurement to determine whether &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle |T\rangle$&lt;/span&gt; is in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt;, upto an error &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\big(\frac{1}{m}\big)$&lt;/span&gt;, and when doing so, the state &lt;span class=&quot;math-container&quot;&gt;$|T\rangle$&lt;/span&gt; is only disturbed by &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\big(\frac{1}{m}\big)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;(For reference, these statements are in &lt;a href=&quot;https://arxiv.org/pdf/1404.6898.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, in the last paragraph of page 13).&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-10-22T10:49:07.577" LastActivityDate="2020-10-22T10:49:07.577" Title="Checking whether a state is almost orthogonal to permutation invariant states" Tags="&lt;quantum-state&gt;&lt;information-theory&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14232" PostTypeId="2" ParentId="14231" CreationDate="2020-10-18T13:04:08.280" Score="1" Body="&lt;p&gt;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&lt;/p&gt;&#xA;" OwnerUserId="13081" LastActivityDate="2020-10-18T13:04:08.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14233" PostTypeId="1" AcceptedAnswerId="14235" CreationDate="2020-10-18T13:44:16.460" Score="3" ViewCount="137" Body="&lt;p&gt;I'm trying to get setup with &lt;a href=&quot;https://qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org&lt;/a&gt;, but I'm having a problem.&lt;/p&gt;&#xA;&lt;p&gt;I have dug around the internet for a bit and haven't been able to find anything.&lt;/p&gt;&#xA;&lt;p&gt;When I try to run &lt;code&gt;IBMQ.save_account('api_token')&lt;/code&gt; it says that I already have credentials present, and to set overwrite to true in order to overwrite the current ones.&lt;/p&gt;&#xA;&lt;p&gt;How do I do with that?&lt;/p&gt;&#xA;" OwnerUserId="13547" LastEditorUserId="55" LastEditDate="2020-10-22T10:49:16.033" LastActivityDate="2020-10-22T10:49:16.033" Title="How to set overwrite to true with IBMQ?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14234" PostTypeId="2" ParentId="14229" CreationDate="2020-10-18T13:45:39.997" Score="0" Body="&lt;p&gt;For any provider, you can check the backends with &lt;code&gt;backends()&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import BasicAer&#xA;BasicAer.backends()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;[&amp;lt;QasmSimulatorPy('qasm_simulator') from BasicAer()&amp;gt;,&#xA; &amp;lt;StatevectorSimulatorPy('statevector_simulator') from BasicAer()&amp;gt;,&#xA; &amp;lt;UnitarySimulatorPy('unitary_simulator') from BasicAer()&amp;gt;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Check the doc for each of them:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for backend in BasicAer.backends():&#xA;    print(&amp;quot;%s: %s&amp;quot; % (backend.name(), backend.__doc__))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;qasm_simulator: Python implementation of a qasm simulator.&#xA;statevector_simulator: Python statevector simulator.&#xA;unitary_simulator: Python implementation of a unitary simulator.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-10-18T13:45:39.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14235" PostTypeId="2" ParentId="14233" CreationDate="2020-10-18T13:57:27.827" Score="1" Body="&lt;p&gt;It is in the method documentation, &lt;code&gt;overwrite: Overwrite existing credentials.&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQ.save_account('api_token', overwrite=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-10-18T13:57:27.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14236" PostTypeId="1" CreationDate="2020-10-18T14:07:06.970" Score="0" ViewCount="84" Body="&lt;p&gt;I implemented Grover algorithm with matrix_product_state method in qiskit. But I found something strange. I designed the oracle part come out &lt;span class=&quot;math-container&quot;&gt;$|1111\rangle$&lt;/span&gt; but, real output was &lt;span class=&quot;math-container&quot;&gt;$0011\rangle$&lt;/span&gt;. I check out my code, but there is nothing wrong with it. Even simulating with the other simulation method (such as &lt;code&gt;statevector&lt;/code&gt;, &lt;code&gt;density_matrix&lt;/code&gt; etc.) I got correct output. I really don't understand why only matrix_product_state method's output is strange. My code is below.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/doCYj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/doCYj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LyxZc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LyxZc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kM0Dj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kM0Dj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="55" LastEditDate="2020-10-22T10:49:26.783" LastActivityDate="2021-03-24T15:01:20.120" Title="Grover's algorithm with matrix_product_state method" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14237" PostTypeId="2" ParentId="14226" CreationDate="2020-10-18T14:09:37.087" Score="0" Body="&lt;p&gt;You don't need to provide a category to silence all of the warnings:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;warnings.filterwarnings('ignore')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-10-18T14:09:37.087" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14238" PostTypeId="2" ParentId="14231" CreationDate="2020-10-18T15:31:02.343" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; be the projector onto the symmetric subspace. We want to find&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\max|\langle\gamma|\phi,T\rangle|&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$|\gamma\rangle\in \mathcal{V}$&lt;/span&gt;. This is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\max|\langle\gamma|P|\phi,T\rangle|,&#xA;$$&lt;/span&gt;&#xA;so if we calculate &lt;span class=&quot;math-container&quot;&gt;$P|\phi\rangle|T\rangle$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|\gamma\rangle$&lt;/span&gt; will be the normalised state parallel to that.&lt;/p&gt;&#xA;&lt;p&gt;Now, if we project &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle|T\rangle$&lt;/span&gt; onto the fully symmetric subspace, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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)}.&#xA;$$&lt;/span&gt;&#xA;Hence, the maximum value of the overlap is &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{m+1}$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$1/(m+1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How to perform the measurement? I could just specify measurement projectors &lt;span class=&quot;math-container&quot;&gt;$\{P,I-P\}$&lt;/span&gt;. 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 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407082&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;. 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).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Further explanation of the claimed result:&lt;/p&gt;&#xA;&lt;p&gt;Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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)}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2\pi i/(m+1)}$&lt;/span&gt;. Each of the &lt;span class=&quot;math-container&quot;&gt;$|\omega_j\rangle$&lt;/span&gt; is an eigenvector, eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\omega^j$&lt;/span&gt;, 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, &lt;em&gt;only&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|\omega_0\rangle$&lt;/span&gt; is in the symmetric subspace.&lt;/p&gt;&#xA;&lt;p&gt;We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle|T\rangle=\frac{1}{\sqrt{m+1}}\sum_{j=0}^m|\omega_j\rangle.&#xA;$$&lt;/span&gt;&#xA;Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P|\phi\rangle|T\rangle=\frac{1}{\sqrt{m+1}}|\omega_0\rangle.&#xA;$$&lt;/span&gt;&#xA;The normalised version of this is hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\gamma\rangle=|\omega_0\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-10-19T06:18:37.380" LastActivityDate="2020-10-19T06:18:37.380" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14239" PostTypeId="2" ParentId="14018" CreationDate="2020-10-18T17:27:11.327" Score="0" Body="&lt;p&gt;Here's a link to a great matrix multiplier tool:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://matrixcalc.org/en/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://matrixcalc.org/en/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13081" LastActivityDate="2020-10-18T17:27:11.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14240" PostTypeId="1" AcceptedAnswerId="14242" CreationDate="2020-10-18T18:31:25.700" Score="0" ViewCount="41" Body="&lt;p&gt;question: &amp;quot;A spin right &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|0\rangle + |1\rangle)$&lt;/span&gt; is sent through a Hadamard gate, creating the superposition of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, given by &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt 2}(|+\rangle + |-\rangle)$&lt;/span&gt;. By making a basis change substitution, show that this is equivalent to producing a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;How do I represent a basis change substitution mathematically?&lt;/p&gt;&#xA;" OwnerUserId="13081" LastEditorUserId="55" LastEditDate="2020-10-22T10:49:36.540" LastActivityDate="2020-10-22T10:49:36.540" Title="Basis Change Substitution" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14241" PostTypeId="1" AcceptedAnswerId="14529" CreationDate="2020-10-18T18:33:51.490" Score="0" ViewCount="119" Body="&lt;p&gt;I could manage to produce 3 qubit ghz state in Cirq. But I don't know how I can produce &lt;span class=&quot;math-container&quot;&gt;$|GHZ\rangle\langle GHZ|$&lt;/span&gt;  in Cirq&#xA;Here is my code for 3 qubit ghz state&#xA;Can you help me please for improving my code from &lt;span class=&quot;math-container&quot;&gt;$|GHZ\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|GHZ\rangle\langle GHZ|$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n = 3&#xA;qubits = cirq.LineQubit.range ( n )&#xA;&#xA;def circuit ():&#xA;  circuit = cirq.Circuit ()&#xA;  circuit.append (cirq.H(qubits[0]))&#xA;  for i in range (n-1):&#xA;    circuit.append ( cirq.CNOT ( qubits [i] , qubits [i+1]) )&#xA;  circuit.append (cirq.measure (* qubits , key ='x') )&#xA;  print (circuit)&#xA;  return circuit&#xA;&#xA;def simulation (circuit):&#xA;  simulator = cirq.Simulator()&#xA;  results = simulator.run ( circuit , repetitions = 200)&#xA;  counts = cirq.plot_state_histogram (results)&#xA;&#xA;def main():&#xA;  simulation (circuit())&#xA;if __name__ == &amp;quot;__main__ &amp;quot;:&#xA;   main ()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="9006" LastEditDate="2020-11-08T06:48:53.970" LastActivityDate="2020-11-08T12:06:46.423" Title="Producing $|ghz\rangle\langle ghz|$ State in Cirq" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="14242" PostTypeId="2" ParentId="14240" CreationDate="2020-10-18T18:38:18.707" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; represented by &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; basis vectors:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle) \qquad |-\rangle = \frac{1}{\sqrt{2}} (|0\rangle - |1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By substituting these expressions that are written in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; basis will prove what is wanted:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}} (|+\rangle + |-\rangle) = \frac{1}{2}(|0\rangle + |1\rangle + |0\rangle - |1\rangle) = |0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-18T18:44:25.063" LastActivityDate="2020-10-18T18:44:25.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14243" PostTypeId="2" ParentId="14226" CreationDate="2020-10-19T01:52:02.747" Score="2" Body="&lt;p&gt;Qiskit's &lt;code&gt;NoiseModel&lt;/code&gt; class processes warnings through a logger from the &lt;code&gt;logging&lt;/code&gt; package, not through the &lt;code&gt;warnings&lt;/code&gt; package, so suppressing warnings as in other answers won't help.&lt;/p&gt;&#xA;&lt;p&gt;However, each method in &lt;code&gt;NoiseModel&lt;/code&gt;  provides a &lt;code&gt;warnings&lt;/code&gt; parameter; it defaults to &lt;code&gt;True&lt;/code&gt; but you can set it to &lt;code&gt;False&lt;/code&gt; to prevent the warnings from being logged.&lt;/p&gt;&#xA;&lt;p&gt;Example: &lt;code&gt;myNoiseModel.add_quantum_error(..., warnings=False)&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="13553" LastActivityDate="2020-10-19T01:52:02.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14245" PostTypeId="1" CreationDate="2020-10-19T03:54:19.127" Score="7" ViewCount="290" Body="&lt;p&gt;The figure of a circuit and the state are as follows.&lt;/p&gt;&#xA;&lt;p&gt;The final state before the measurement is &lt;span class=&quot;math-container&quot;&gt;$|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)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Measuring the first qubit of this state produces outcome 1, how can I get the probability &lt;span class=&quot;math-container&quot;&gt;$\frac12(1-|\langle\phi|\psi\rangle|^2)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qxU6o.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qxU6o.jpg&quot; alt=&quot;figure of a circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZeGst.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZeGst.jpg&quot; alt=&quot;the description of the state&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="6155" LastEditorUserId="55" LastEditDate="2020-10-22T07:34:22.900" LastActivityDate="2020-10-22T07:34:22.900" Title="How to compute the measurement probability in swap test?" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14246" PostTypeId="2" ParentId="14245" CreationDate="2020-10-19T04:26:53.867" Score="6" Body="&lt;p&gt;It's a fantastic question because the typical measurement intuition we apply no longer is sufficient - it's really necessary to formalize measurement.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, we create a set of nonlinear operators &lt;span class=&quot;math-container&quot;&gt;$M_\psi = |\psi \rangle \langle \psi |$&lt;/span&gt;, where the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; on an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle $&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\langle \phi | M^\dagger M | \phi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In our case, we have a measurement operator &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; we are interested in. However, we can actually apply &lt;span class=&quot;math-container&quot;&gt;$M_0$&lt;/span&gt; for simplicity, and then subtract this probability from 1. Thus, where &lt;span class=&quot;math-container&quot;&gt;$| \varphi \rangle $&lt;/span&gt; is the state provided above:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;   \langle \varphi | M^\dagger M | \varphi \rangle &amp;amp;= \langle \varphi |0\rangle \langle 0| 0\rangle \langle 0|\varphi\rangle \\&#xA;&amp;amp;= \langle \varphi|0\rangle\langle 0|\varphi\rangle \\&#xA;&amp;amp;= \frac{1}{4} (\langle \phi|\langle \psi| + \langle \psi|\langle \phi|)( |\phi \rangle |\psi \rangle + |\psi \rangle |\phi \rangle) \\&#xA;&amp;amp;= \frac{1}{4}(2 \langle\phi| \langle\psi|\phi\rangle |\psi\rangle + 2) \\&#xA;&amp;amp;= \frac{1}{2}\Big(|\langle\psi|\phi\rangle|^2 + 1 \Big)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, because this is the zero probability, we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;   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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As desired.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-10-19T04:26:53.867" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14247" PostTypeId="2" ParentId="14245" CreationDate="2020-10-19T06:27:50.727" Score="2" Body="&lt;p&gt;I assume you're happy with the idea that the state before measurement is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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).$$&lt;/span&gt;&#xA;Now you want to measure qubit 1 in the 0/1 basis. There's a couple of different ways you might approach this.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Define the two measurement projectors to be &lt;span class=&quot;math-container&quot;&gt;$P_0=|0\rangle\langle 0|\otimes I\otimes I$&lt;/span&gt; (i.e. measure first qubit in 0, and do nothing to the other two), and &lt;span class=&quot;math-container&quot;&gt;$P_1=|1\rangle\langle 1|\otimes I\otimes I$&lt;/span&gt;. The probability of getting the 0 answer is &lt;span class=&quot;math-container&quot;&gt;$\langle O_{out}|P_0|O_{out}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alternative, rewrite your state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|O_{out}\rangle=\gamma_0|0\rangle|\sigma\rangle+\gamma_1|1\rangle|\tau\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\sigma\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\tau\rangle$&lt;/span&gt; are properly normalised vectors, and the coefficients &lt;span class=&quot;math-container&quot;&gt;$\gamma_{0/1}$&lt;/span&gt; compensate for that normalisation. The probability of getting the answer 0 when you measure the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|\gamma_0|^2$&lt;/span&gt;. So, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\gamma_0|\sigma\rangle=\frac12(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle).&#xA;$$&lt;/span&gt;&#xA;Take the inner product of that equation with itself and you get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|\gamma_0|^2&amp;amp;=\frac14(\langle\phi |\langle\psi |+\langle\psi |\langle\phi|)(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle) \\&#xA;&amp;amp;=\frac14(2+2|\langle\phi|\psi\rangle|^2).&#xA;\end{align*}&lt;/span&gt;&#xA;The actual question requires the probability of getting answer 1. This is left as an exercise for the reader.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-10-19T08:47:03.503" LastActivityDate="2020-10-19T08:47:03.503" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14249" PostTypeId="1" CreationDate="2020-10-19T07:13:21.157" Score="1" ViewCount="87" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmqx2')&#xA;noise_model = NoiseModel.from_backend(backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Ideally I would want something like above which allows me to easily call the noise properties of for example Bristlecone or Sycamore.&lt;/p&gt;&#xA;&lt;p&gt;If this is not possible does anyone know the best way to approach simulating the noise of any of googles quantum computers in qiskit?&lt;/p&gt;&#xA;&lt;p&gt;I am asking because I wish to compare Google and IBMs quantum computers for implementing a simple circuit.&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2020-10-22T07:34:11.363" LastActivityDate="2020-10-22T07:34:11.363" Title="Simulating noise of googles quantum computers" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;noise&gt;&lt;ibm&gt;&lt;google-sycamore&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14250" PostTypeId="1" CreationDate="2020-10-19T08:25:51.870" Score="2" ViewCount="71" Body="&lt;p&gt;Does anyone know any good resource where I can study about how quantum walk is performed on non-regular graph?&#xA;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.&#xA;If anyone have any source, it will be helpful.&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="13517" LastEditDate="2020-11-13T17:51:30.223" LastActivityDate="2020-11-13T17:51:30.223" Title="Quantum Walk Study Resource for Non-regular Graph" Tags="&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14251" PostTypeId="2" ParentId="14212" CreationDate="2020-10-19T09:24:05.997" Score="4" Body="&lt;p&gt;I think the best way to understand this is by showing that one can violate (ontological) locality while respecting (operational) no-signalling.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;quantum equilibrium&amp;quot; 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 &amp;quot;quantum equilibrium&amp;quot; axiom, simply by knowing the value of a hidden variable before the measurement, you can use this knowledge to signal faster than light.&lt;/p&gt;&#xA;&lt;p&gt;I hope this makes it clear that &amp;quot;no-signalling&amp;quot; is really about what you can do with the theory, it's an intrinsically operational definition. As for &amp;quot;locality&amp;quot;, 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.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-10-19T09:24:05.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14252" PostTypeId="1" CreationDate="2020-10-19T14:21:13.980" Score="3" ViewCount="40" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14191/is-the-universality-of-a-qubit-based-quantum-computer-different-from-the-univers&quot;&gt;this question&lt;/a&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;This doubt stems from the definition of universality in the CV quantum case (see for example the original article &lt;a href=&quot;https://link.springer.com/chapter/10.1007/978-94-015-1258-9_2&quot; rel=&quot;nofollow noreferrer&quot;&gt;by Lloyd&lt;/a&gt;): Universality of the CV model is defined as the ability to approximate arbitrary transformations of the form &lt;span class=&quot;math-container&quot;&gt;$U_H = e^{−it H}$&lt;/span&gt;, where the generator &lt;span class=&quot;math-container&quot;&gt;$H = H (x, p)$&lt;/span&gt; is a polynomial function&#xA;of &lt;span class=&quot;math-container&quot;&gt;$(x, p)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$e^{−it H(x,p)}$&lt;/span&gt;, but I'm not sure about this last point.&lt;/p&gt;&#xA;" OwnerUserId="13528" LastActivityDate="2020-10-19T14:21:13.980" Title="Is continuous-variable quantum computing a model of a quantum universal Turing machine?" Tags="&lt;continuous-variable&gt;&lt;quantum-turing-machine&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14253" PostTypeId="2" ParentId="14249" CreationDate="2020-10-19T14:27:54.847" Score="1" Body="&lt;p&gt;It is possible from looing at here:&#xA;&lt;a href=&quot;https://github.com/quantumlib/Cirq/tree/master/cirq/devices&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/tree/master/cirq/devices&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.NoiseModel.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cirq.readthedocs.io/en/stable/generated/cirq.NoiseModel.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Also look at these answers on how to implement noise:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8661/how-to-add-noise-to-existing-gates-in-cirq&quot;&gt;How to add noise to existing gates in Cirq?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/1704&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/issues/1704&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-19T14:27:54.847" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14254" PostTypeId="2" ParentId="14199" CreationDate="2020-10-19T15:53:31.043" Score="0" Body="&lt;p&gt;The code I'll be referencing here is Qiskit, IBM's Quantum SDK (Software Development Kit).&lt;/p&gt;&#xA;&lt;p&gt;First, you would have to make a circuit, so a good place to start is with the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;from qiskit import *&#xA;qc = Quantum Circuit (n, m)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import WeightedAdder&#xA;adder = WeightedAdder(num_state_qubits, weights, name)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where num_state_qubits are your input qubits, there are no weights, and name is 'adder' or whatever you want to name it.&lt;/p&gt;&#xA;&lt;p&gt;The other arithmetic operation that's built into Qiskit is the IntegerComparison, but otherwise you have to build them yourself.&lt;/p&gt;&#xA;&lt;p&gt;Here is a link to how to build a multiplication gate in Qiskit : &lt;a href=&quot;https://medium.com/@sashwat.anagolum/arithmetic-on-quantum-computers-multiplication-4482cdc2d83b&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/@sashwat.anagolum/arithmetic-on-quantum-computers-multiplication-4482cdc2d83b&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Textbook&lt;/a&gt; and the &lt;a href=&quot;https://qiskit.org/documentation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-10-19T15:53:31.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14255" PostTypeId="2" ParentId="12483" CreationDate="2020-10-19T16:28:07.177" Score="3" Body="&lt;p&gt;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&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; or BS2&lt;span class=&quot;math-container&quot;&gt;$^-$&lt;/span&gt; are there, so that we can actually use the different measurements to probe the state of the hidden variables. This assumption is known as &amp;quot;no superdeterminism&amp;quot; or &amp;quot;no conspiracy&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;possibilistic nonlocality&amp;quot;. I find &lt;a href=&quot;https://arxiv.org/abs/1105.1819&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; about it quite clear.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy)$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$a,b,x,y$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy) &amp;gt; 0$&lt;/span&gt; and for some other &lt;span class=&quot;math-container&quot;&gt;$p(ab|xy) = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For convenience, let's rename the settings: if BS2&lt;span class=&quot;math-container&quot;&gt;$^+$&lt;/span&gt; is there Alice has setting 1, and if it's not there it has setting 0. Same for Bob. The quantum correlations are then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;p(cc|00) = 0 \\&#xA;p(dd|01) = 0 \\&#xA;p(dd|10) = 0 \\&#xA;p(dd|11) &amp;gt; 0&#xA;\end{align*}&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$(c,d,c,d)$&lt;/span&gt;, which means that Alice gets result &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; when she doesn't use BS2, result &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; when she does use it, and the same for Bob.&lt;/p&gt;&#xA;&lt;p&gt;Now, from the condition &lt;span class=&quot;math-container&quot;&gt;$p(dd|11) &amp;gt; 0$&lt;/span&gt;, we see that the LHV model must have nonzero weight in one of the four assignments &lt;span class=&quot;math-container&quot;&gt;$(c,d,c,d)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(c,d,d,d)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(d,d,c,d)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$(d,d,d,d)$&lt;/span&gt;, as these are the only ones with output &lt;span class=&quot;math-container&quot;&gt;$d,d$&lt;/span&gt; for settings &lt;span class=&quot;math-container&quot;&gt;$1,1$&lt;/span&gt;. But the fact that &lt;span class=&quot;math-container&quot;&gt;$p(cc|00) = 0$&lt;/span&gt; implies that &lt;span class=&quot;math-container&quot;&gt;$(c,d,c,d)$&lt;/span&gt; is forbidden. Likewise, &lt;span class=&quot;math-container&quot;&gt;$p(dd|01) = 0$&lt;/span&gt; implies that &lt;span class=&quot;math-container&quot;&gt;$(d,d,c,d)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$(d,d,d,d)$&lt;/span&gt; are forbidden, and &lt;span class=&quot;math-container&quot;&gt;$p(dd|10) = 0$&lt;/span&gt; implies that &lt;span class=&quot;math-container&quot;&gt;$(c,d,d,d)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(d,d,d,d)$&lt;/span&gt; are forbidden. Therefore, all four possibilities must have zero weight, and no LHV can reproduce those four characteristics of the quantum correlation.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-10-19T16:28:07.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14256" PostTypeId="1" AcceptedAnswerId="14273" CreationDate="2020-10-19T16:35:21.587" Score="4" ViewCount="114" Body="&lt;p&gt;For &lt;strong&gt;learning&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$a^k \bmod N$&lt;/span&gt; with the ultimate goal of finding the k that solves &lt;span class=&quot;math-container&quot;&gt;$a^k \bmod N = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;What confuses me is that when I calculate the values of &lt;span class=&quot;math-container&quot;&gt;$a^k \bmod N$&lt;/span&gt; to feed into the FFT, it is not that much harder skip the FFT and just find &lt;span class=&quot;math-container&quot;&gt;$a^k \bmod N = 1$&lt;/span&gt; by brute force (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/5398/13559&quot;&gt;similar to this question&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;What am I missing here? Alternatively, if I had a black box that could calculate FFTs instantaneously, how would this change Shor's algorithm?&lt;/p&gt;&#xA;" OwnerUserId="13559" LastEditorUserId="2927" LastEditDate="2020-10-19T18:31:16.283" LastActivityDate="2020-10-20T22:00:12.270" Title="How to write a classical version of Shor's algorithm" Tags="&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14257" PostTypeId="2" ParentId="14250" CreationDate="2020-10-19T18:29:26.490" Score="2" Body="&lt;p&gt;Some important references could be the following: &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0012090&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Walks On Graphs&lt;/a&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1201.4780&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum walks: a comprehensive review&lt;/a&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0303081&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum random walks - an introductory overview&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastActivityDate="2020-10-19T18:29:26.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14258" PostTypeId="1" AcceptedAnswerId="14263" CreationDate="2020-10-20T00:21:33.593" Score="5" ViewCount="80" Body="&lt;p&gt;Can every bipartite quantum state (including entangled ones) be written in the following way&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{AB} = \sum_{ij} c_{ij}\sigma_A^i\otimes \omega_B^j$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_A^i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega_B^j$&lt;/span&gt; are density matrices? And if &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is a quantum state, must it also be the case that &lt;span class=&quot;math-container&quot;&gt;$c_{ij}$&lt;/span&gt; are nonnegative? If the answers are yes, how can one show this?&lt;/p&gt;&#xA;&lt;p&gt;I ask this because of a claim that the set of product states &lt;span class=&quot;math-container&quot;&gt;$\rho_A\otimes\rho_B$&lt;/span&gt; span the vector space of all operators acting on &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt; in an answer here - &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5066/4831&quot;&gt;https://quantumcomputing.stackexchange.com/a/5066/4831&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13561" LastEditorUserId="55" LastEditDate="2020-10-23T06:21:20.710" LastActivityDate="2020-10-23T06:21:20.710" Title="Can every bipartite state be written as $\rho_{AB} = \sum_{ij} c_{ij}\sigma_A^i\otimes \omega_B^j$?" Tags="&lt;quantum-state&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14259" PostTypeId="1" AcceptedAnswerId="14290" CreationDate="2020-10-20T02:17:47.967" Score="6" ViewCount="148" Body="&lt;p&gt;Suppose Alice and Bob share a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. Let us denote the reduced states as &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \text{Tr}_B(\rho_{AB})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B = \text{Tr}_A(\rho_{AB})$&lt;/span&gt;. Bob applies a projector so the new global state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho'_{AB} = (I_A\otimes \Pi_B)\rho_{AB}(I_A\otimes \Pi_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us denote the new (subnormalized) reduced state on Alice's system as &lt;span class=&quot;math-container&quot;&gt;$\rho'_{A}$&lt;/span&gt;. I am given two facts about Bob's projector&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Pi_B$&lt;/span&gt; is diagonal in the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;It is gentle i.e. &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\Pi_B\rho_B) \geq \text{Tr}(\rho_B) - \varepsilon$&lt;/span&gt; for some small &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I would like to know how the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho'_A$&lt;/span&gt; are related to those of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;. So far, the only conclusion I have is that &lt;span class=&quot;math-container&quot;&gt;$\rho'_A\leq \rho_A$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A \leq B$&lt;/span&gt; means that &lt;span class=&quot;math-container&quot;&gt;$B-A$&lt;/span&gt; is positive semidefinite.&lt;/p&gt;&#xA;&lt;p&gt;In particular, I am interested in any inequality relating the smallest nonzero eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and the smallest nonzero eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\rho'_A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-10-23T06:31:48.407" LastActivityDate="2020-10-23T09:29:12.947" Title="Bob applies a projector - what happens to eigenvalues of Alice's reduced state?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14261" PostTypeId="1" AcceptedAnswerId="14262" CreationDate="2020-10-20T03:28:24.363" Score="-1" ViewCount="58" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="11697" LastActivityDate="2020-10-20T05:12:44.377" Title="Depth for UCC ansatz" Tags="&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14262" PostTypeId="2" ParentId="14261" CreationDate="2020-10-20T05:12:44.377" Score="1" Body="&lt;p&gt;It is a bit strange that they decided to include &amp;quot;depth&amp;quot; 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, &amp;quot;depth&amp;quot; is not called &amp;quot;reps&amp;quot; which, obviously, stands for repetition .&lt;/p&gt;&#xA;&lt;p&gt;Also note that UCCSD is a chemically motivated Ansatz, so it only makes sense that the starting state, &amp;quot;initial_state&amp;quot; start out as the Hartree-Fock state.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-20T05:12:44.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14263" PostTypeId="2" ParentId="14258" CreationDate="2020-10-20T07:14:43.417" Score="3" Body="&lt;p&gt;If all &lt;span class=&quot;math-container&quot;&gt;$c_{ij}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You probably could use this description to cover entangled states if you let the &lt;span class=&quot;math-container&quot;&gt;$c_{ij}$&lt;/span&gt; be negative. Here's a simple argument for bipartite states of qubits: the Pauli matrices form a basis, meaning that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}=\sum q_{ij}\sigma_i\otimes\sigma_j&#xA;$$&lt;/span&gt;&#xA;(I'm using &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; here for Pauli matrices, NOT density matrices). Since &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is Hermitian, the &lt;span class=&quot;math-container&quot;&gt;$q_{ij}$&lt;/span&gt; are real. Now, I can always rewrite this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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).&#xA;$$&lt;/span&gt;&#xA;Now note that every term &lt;span class=&quot;math-container&quot;&gt;$I\pm\sigma_i\otimes\sigma_j$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-20T07:14:43.417" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14264" PostTypeId="1" AcceptedAnswerId="14443" CreationDate="2020-10-20T08:40:31.943" Score="5" ViewCount="351" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}\newcommand{\ket}[1]{\left|#1\right&amp;gt;}\newcommand{\bk}[2]{\left&amp;lt;#1\middle|#2\right&amp;gt;}\newcommand{\bke}[3]{\left&amp;lt;#1\middle|#2\middle|#3\right&amp;gt;}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In Nielsen&amp;amp;Chuang on quantum error-correction codes they give a 5 qubit one as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\small&#xA;\ket{0_L}=\frac14\left(&#xA;\color{red}{&#xA;+\ket{00000}&#xA;-\ket{00011}&#xA;+\ket{00101}&#xA;-\ket{00110}&#xA;}&#xA;%&#xA;\color{blue}{&#xA;+\ket{01001}&#xA;+\ket{01010}&#xA;-\ket{01100}&#xA;-\ket{01111}}\\ \hspace{.47in}&#xA;%&#xA;\color{green}{&#xA;-\ket{10001}&#xA;+\ket{10010}&#xA;+\ket{10100}&#xA;-\ket{10111}}&#xA;%&#xA;-\ket{11000}&#xA;-\ket{11011}&#xA;-\ket{11101}&#xA;-\ket{11110}&#xA;\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\small&#xA;\ket{1_L}=\frac14\left( &#xA;\color{red}{&#xA;+\ket{11111}&#xA;-\ket{11100}&#xA;+\ket{11010}&#xA;-\ket{11001}&#xA;}&#xA;%&#xA;\color{blue}{&#xA;+\ket{10110}&#xA;+\ket{10101}&#xA;-\ket{10011}&#xA;-\ket{10000}}\\ \hspace{.47in}&#xA;%&#xA;\color{green}{&#xA;-\ket{01000}&#xA;+\ket{01011}&#xA;+\ket{01101}&#xA;-\ket{01110}&#xA;}&#xA;%&#xA;-\ket{00001}&#xA;-\ket{00010}&#xA;-\ket{00100}&#xA;-\ket{00111}&#xA;\right)&#xA;$$&lt;/span&gt;&#xA;(I reshuffled entries w.r.t. to equal bits of information...colors represents equal patterns of signs, which remind me on a &lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt; gate)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How to implement the encoding gate for this?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I can't find that specific one anywhere in the online available literature...&lt;/p&gt;&#xA;&lt;p&gt;Update: I can take &lt;span class=&quot;math-container&quot;&gt;$\ket{00000}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\ket0_L$&lt;/span&gt; by that &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22X%22%5D,%5B%22H%22,%22H%22%5D,%5B%22%E2%80%A6%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%80%A6%22%5D,%5B1,1,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22H%22,%22H%22%5D,%5B1,1,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%97%A6%22,1,%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%80%A6%22,1,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%80%A2%22,%22H%22,%22H%22%5D,%5B1,1,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%80%A2%22,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%80%A2%22,1,%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%97%A6%22,%22%E2%80%A2%22,%22X%22,%22X%22,%22X%22%5D,%5B%22%E2%80%A6%22%5D,%5B1,1,%22X%22,%22X%22%5D,%5B%22%E2%80%A2%22,%22%E2%97%A6%22,%22H%22,%22H%22%5D,%5B1,1,%22X%22,%22X%22%5D,%5B%22%E2%80%A2%22,%22%E2%97%A6%22,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,%22%E2%97%A6%22,1,%22%E2%80%A2%22,%22X%22%5D,%5B%22%E2%80%A2%22,%22%E2%97%A6%22,%22X%22,%22X%22,%22X%22%5D%5D,%22init%22:%5B0%5D%7D&quot; rel=&quot;nofollow noreferrer&quot; title=&quot;greateast online tool...&quot;&gt;quirk&lt;/a&gt; (modulus some sign errors for the other transfer to &lt;span class=&quot;math-container&quot;&gt;$\ket{1_L}$&lt;/span&gt;)...&lt;/p&gt;&#xA;" OwnerUserId="5280" LastEditorUserId="55" LastEditDate="2020-10-23T06:33:00.910" LastActivityDate="2020-11-06T08:53:58.480" Title="Nielsen&amp;Chuang 5-qubit quantum error-correction encoding gate" Tags="&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14265" PostTypeId="1" CreationDate="2020-10-20T08:53:14.633" Score="2" ViewCount="55" Body="&lt;p&gt;While reading about Grover's mean estimation algorithm, I came across &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1967/how-is-grovers-algorithm-used-to-estimate-the-mean-and-median-of-a-set-of-numbe&quot;&gt;this post&lt;/a&gt; on StackExchange. As an undergrad, there are several points I don't quite understand.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the role of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;. Consider I have a list of numbers, such as &lt;span class=&quot;math-container&quot;&gt;$0.1, 0.2, 0.3, 0.4$&lt;/span&gt; and I want to calculate the mean. What exactly is &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; mapping? What exactly is &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; here? My wildest guess is that the above numbers are labelled as &lt;span class=&quot;math-container&quot;&gt;$00, 01, 10, 11$&lt;/span&gt; and these binary strings are referred to as &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. In this sense &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; behaves more like a table to associate &lt;span class=&quot;math-container&quot;&gt;$00 \rightarrow 0.1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$00 \rightarrow 0.2$&lt;/span&gt;, etc. Is this the correct understanding?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What computation on the ancilla? The aforementioned post also suggest that &lt;em&gt;perform a computation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; on an ancilla register&lt;/em&gt;. What does the &lt;em&gt;computation&lt;/em&gt; mean?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13563" LastEditorUserId="55" LastEditDate="2020-10-23T06:33:57.997" LastActivityDate="2020-10-23T06:33:57.997" Title="How to perform computation on an ancilla register in Grover's mean estimation algorithm?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14266" PostTypeId="1" AcceptedAnswerId="14267" CreationDate="2020-10-20T10:00:40.977" Score="0" ViewCount="96" Body="&lt;p&gt;How do I create an arbitrary unitary gate for an arbitrary number of qubits in Cirq?&lt;/p&gt;&#xA;&lt;p&gt;Note: A solution for creating a single qubit gate is answered by Thomas W from this post.&#xA;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4521/how-do-i-create-my-own-unitary-matrices-that-i-can-apply-to-a-circuit-in-cirq&quot;&gt;How do I create my own unitary matrices that I can apply to a circuit in Cirq?&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9903" LastEditorUserId="55" LastEditDate="2020-10-23T06:34:44.957" LastActivityDate="2020-10-23T06:34:44.957" Title="Cirq: Creating an arbitrary gate for an arbitrary number of qubits" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14267" PostTypeId="2" ParentId="14266" CreationDate="2020-10-20T11:47:20.840" Score="1" Body="&lt;p&gt;You have 2 options depending on what your needs are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Use &lt;code&gt;cirq.MatrixGate&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pros: you can easily instantiate the gate based on a unitary matrix.&lt;/li&gt;&#xA;&lt;li&gt;Cons: you can't customize it that easily.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Create your own Gate class&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pros: full flexibility, you can customize the features, diagram info, etc.&lt;/li&gt;&#xA;&lt;li&gt;Cons: it's a bit more involved.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Using &lt;code&gt;cirq.MatrixGate&lt;/code&gt;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;cirq.MatrixGate&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    QFT2 = np.array([[1, 1, 1, 1],&#xA;                     [1, 1j, -1, -1j],&#xA;                     [1, -1, 1, -1],&#xA;                     [1, -1j, -1, 1j]]) * 0.5&#xA;    my_qft2 = cirq.MatrixGate(QFT2)&#xA;    print(cirq.Circuit(my_qft2(q[0],q[1])))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Resulting in:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;      ┌                                       ┐&#xA;      │ 0.5+0.j   0.5+0.j   0.5+0.j   0.5+0.j │&#xA;0: ───│ 0.5+0.j   0. +0.5j -0.5+0.j   0. -0.5j│───&#xA;      │ 0.5+0.j  -0.5+0.j   0.5+0.j  -0.5+0.j │&#xA;      │ 0.5+0.j   0. -0.5j -0.5+0.j   0. +0.5j│&#xA;      └                                       ┘&#xA;      │&#xA;1: ───#2──────────────────────────────────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;Creating your own gate class&lt;/h2&gt;&#xA;&lt;p&gt;You will have to create a subclass of &lt;code&gt;cirq.Gate&lt;/code&gt; and implement one of the following methods mandatorily: &lt;code&gt;_num_qubits_&lt;/code&gt;, &lt;code&gt;_qid_shape&lt;/code&gt; or &lt;code&gt;num_qubits&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then you can create magic methods to enrich your class with cirq protocols, like &lt;code&gt;cirq.SupportsUnitary&lt;/code&gt; (implement the &lt;code&gt;_unitary_&lt;/code&gt; method) or &lt;code&gt;cirq.SupportsCircuitDiagramInfo&lt;/code&gt; (implement the &lt;code&gt;_circuit_diagram_info_&lt;/code&gt; method).&lt;/p&gt;&#xA;&lt;p&gt;An example implementing X gates applied to arbitrary number of qubits:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    from typing import Union, Iterable&#xA;    &#xA;    import numpy as np&#xA;    &#xA;    import cirq&#xA;    from cirq.type_workarounds import NotImplementedType&#xA;    &#xA;    &#xA;    class MultiXGate(cirq.Gate):&#xA;        def __init__(self, num_qubits):&#xA;            if num_qubits &amp;lt;= 0:&#xA;                raise ValueError(&amp;quot;num_qubits should be &amp;gt; 0&amp;quot;)&#xA;            self.num_qubits = num_qubits&#xA;    &#xA;        # this is mandatory (or alternatively, _qid_shape_ or num_qubits)&#xA;        def _num_qubits_(self) -&amp;gt; int:&#xA;            return self.num_qubits&#xA;    &#xA;        ## These are not mandatory but pretty important&#xA;    &#xA;        def _circuit_diagram_info_(self, _) -&amp;gt; Union[str, Iterable[str],&#xA;                                                     cirq.CircuitDiagramInfo]:&#xA;            return [&amp;quot;multi-X&amp;quot;] * self.num_qubits&#xA;    &#xA;        def _unitary_(self) -&amp;gt; Union[np.ndarray, NotImplementedType]:&#xA;            x = cirq.unitary(cirq.X)&#xA;            return cirq.kron(*([x] * self.num_qubits))&#xA;    &#xA;    &#xA;    if __name__ == '__main__':&#xA;        q = cirq.LineQubit.range(4)&#xA;        circuit = cirq.Circuit(MultiXGate(len(q))(*q))&#xA;        print(circuit)&#xA;        c2 = cirq.Circuit([cirq.X(qubit) for qubit in q])&#xA;        assert np.allclose(circuit.unitary(), c2.unitary())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will print the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0: ───multi-X───&#xA;      │&#xA;1: ───multi-X───&#xA;      │&#xA;2: ───multi-X───&#xA;      │&#xA;3: ───multi-X───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4986" LastEditorUserId="4986" LastEditDate="2020-10-20T12:02:20.740" LastActivityDate="2020-10-20T12:02:20.740" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14268" PostTypeId="1" CreationDate="2020-10-20T12:12:36.920" Score="1" ViewCount="50" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tNXWQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tNXWQ.png&quot; alt=&quot;qrng code in quantum lab&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What is the reason for results not being obtained as I think there is no error in the code?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-10-23T06:34:50.573" LastActivityDate="2020-10-23T06:34:50.573" Title="Unable to run a QRNG code" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14269" PostTypeId="2" ParentId="14264" CreationDate="2020-10-20T12:19:38.490" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;. You take 4 ancilla qubits,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=|\phi\rangle|0000\rangle,&#xA;$$&lt;/span&gt;&#xA;and you measure the 4 stabilizers &lt;span class=&quot;math-container&quot;&gt;$\{K_i\}$&lt;/span&gt; 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.)&lt;/p&gt;&#xA;&lt;p&gt;The circuit that you need for each stabilizer looks like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/p6dsZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p6dsZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/OyULr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OyULr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;(the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in this picture actually refers to what I've called &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; in this answer.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-20T12:19:38.490" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14270" PostTypeId="2" ParentId="14268" CreationDate="2020-10-20T12:42:30.697" Score="2" Body="&lt;p&gt;The warning messages just inform you of interface change and has no impact to your code.&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/backends/queue/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/manage/backends/queue/&lt;/a&gt;). 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.&lt;/p&gt;&#xA;&lt;p&gt;You can reduce the number of jobs by using more qubits in each circuit, and more circuits/shots for each job.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-10-20T12:42:30.697" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14271" PostTypeId="2" ParentId="14117" CreationDate="2020-10-20T13:34:09.713" Score="2" Body="&lt;p&gt;Based on &lt;em&gt;tsgeorgios&lt;/em&gt; information about Qiskit manual and the manual content, I created the code below which works as expected.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#BASED ON: https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#4.-Qiskit-Implementation&#xA;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import Aer&#xA;from qiskit.circuit.library import QFT&#xA;from qiskit.aqua.components.eigs import EigsQPE&#xA;from qiskit.aqua.components.reciprocals import LookupRotation&#xA;from qiskit.aqua.operators import MatrixOperator&#xA;from qiskit.aqua.components.initial_states import Custom&#xA;import numpy as np&#xA;#Linear equations solvers&#xA;from qiskit.aqua.algorithms import HHL, NumPyLSsolver #HHL - quantum, NumPyLSolver - classical&#xA;&#xA;def create_eigs(matrix, num_ancillae, num_time_slices, negative_evals):&#xA;    ne_qfts = [None, None]&#xA;    if negative_evals:&#xA;        num_ancillae += 1&#xA;        ne_qfts = [QFT(num_ancillae - 1), QFT(num_ancillae - 1).inverse()]&#xA;    &#xA;    #Construct the eigenvalues estimation using the PhaseEstimationCircuit&#xA;    return EigsQPE(MatrixOperator(matrix=matrix),&#xA;                   QFT(num_ancillae).inverse(),&#xA;                   num_time_slices=num_time_slices,&#xA;                   num_ancillae=num_ancillae,&#xA;                   expansion_mode='suzuki',&#xA;                   expansion_order=2,&#xA;                   evo_time=None,&#xA;                   negative_evals=negative_evals,&#xA;                   ne_qfts=ne_qfts)&#xA;&#xA;def HHLsolver(matrix, vector, backend, no_ancillas, no_time_slices):&#xA;    orig_size = len(vector_b)&#xA;    #adapt the matrix to have dimension 2^k&#xA;    matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix_A, vector_b)&#xA;&#xA;    #find eigenvalues of the matrix wih phase estimation (i.e. calc. exponential of A, apply &#xA;    #phase estimation) to get exp(lamba) and then inverse QFT to get lambdas themselves&#xA;    eigs = create_eigs(matrix, no_ancillas, no_time_slices, False)&#xA;    #num_q – Number of qubits required for the matrix Operator instance&#xA;    #num_a – Number of ancillary qubits for Eigenvalues instance&#xA;    num_q, num_a = eigs.get_register_sizes()&#xA;&#xA;    #construct circuit for finding reciprocals of eigenvalues&#xA;    reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)&#xA;&#xA;    #preparing init state for HHL, i.e. the state containing vector b&#xA;    init_state = Custom(num_q, state_vector=vector)&#xA;&#xA;    #construct circuit for HHL based on matrix A, vector B and reciprocals of eigenvalues&#xA;    algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,&#xA;               init_state, reci, num_q, num_a, orig_size)&#xA;    &#xA;    #solution on quantum computer&#xA;    result = algo.run(quantum_instance = backend)&#xA;    print(&amp;quot;Solution:\t\t&amp;quot;, np.round(result['solution'], 5))&#xA;    print(&amp;quot;Probability:\t\t %f&amp;quot; % result['probability_result'])&#xA;&#xA;    #refence solution - NumPyLSsolver = Numpy LinearSystem algorithm (classical).&#xA;    result_ref = NumPyLSsolver(matrix, vector).run()&#xA;    print(&amp;quot;Classical Solution:\t&amp;quot;, np.round(result_ref['solution'], 5))&#xA;&#xA;matrix_A = np.array([[1.5, 0.5],[0.5, 1.5]])&#xA;vector_b = [0.9010, -0.4339]&#xA;#x = A^(-1)b = [0.78420, -0.55066] #expected result&#xA;&#xA;processor = Aer.get_backend('statevector_simulator')&#xA;&#xA;no_ancillas = 3 #number of ancilla qubits&#xA;no_time_slices = 50 #number of timeslices in exponential of matrix A (exp(i*A*t))&#xA;&#xA;HHLsolver(matrix_A, vector_b, processor, no_ancillas, no_time_slices)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Acknowledgement:&lt;/strong&gt; The code is based on &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#4.-Qiskit-Implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit manual on HHL&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-20T13:34:09.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14272" PostTypeId="2" ParentId="14268" CreationDate="2020-10-20T15:28:00.487" Score="1" Body="&lt;p&gt;As the other answer stated, there is nothing wrong. The reason for long time for the job to be completed is coming from the &lt;strong&gt;queuing time&lt;/strong&gt; and not the actual execution time itself.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;maximum_circuits&lt;/strong&gt; (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.&lt;/p&gt;&#xA;&lt;p&gt;One other way to get around this, you can use build a noise_model that mimics Ourense with &lt;strong&gt;qasm_simulator&lt;/strong&gt;. Look at this documentation here on how to do that: &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/3_building_noise_models.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Building Noise-Model&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-20T15:28:00.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14273" PostTypeId="2" ParentId="14256" CreationDate="2020-10-20T22:00:12.270" Score="2" Body="&lt;p&gt;In Shor's (quantum) algorithm, you compute the modular exponent only a small number of times—far smaller than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. The algorithm is probabilistic, and if you're lucky you may compute it only once.&lt;/p&gt;&#xA;&lt;p&gt;After the modular exponentiation step, in principle the qubits encode the value of &lt;span class=&quot;math-container&quot;&gt;$a^k\text{ mod }N$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, but you can't just search through the wave function for a value of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. If you could do that (sometimes called &amp;quot;postselection&amp;quot;), 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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2020-10-20T22:00:12.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14279" PostTypeId="2" ParentId="14258" CreationDate="2020-10-21T10:31:49.983" Score="5" Body="&lt;p&gt;I know the question is already answered, but there was some question on my comment and I wanted to elaborate on that.&lt;/p&gt;&#xA;&lt;p&gt;First, let us consider one system only. The &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt;-span of all states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the space of Hermitian operators. Indeed, by the spectral decomposition, already the set of pure states is enough. This also implies that the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt;-span contains all linear operators, since we can decompose any operator into a Hermitian and anti-Hermitian part and expand those in states.&lt;/p&gt;&#xA;&lt;p&gt;For two (or more) systems, the dimension of &lt;span class=&quot;math-container&quot;&gt;$L(H_A\otimes H_B)=L(H_A)\otimes L(H_B)$&lt;/span&gt; is the product of the individual dimensions, &lt;span class=&quot;math-container&quot;&gt;$\dim L(H_A) \times \dim L(H_B)$&lt;/span&gt;. This implies that taking tensor products of generating sets of &lt;span class=&quot;math-container&quot;&gt;$L(H_A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L(H_B)$&lt;/span&gt; has to yield a generating set, too. Just reduce the generating set to a basis of &lt;span class=&quot;math-container&quot;&gt;$L(H_A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L(H_B)$&lt;/span&gt; and you'll get a product basis which lies in the product of the generating sets.&lt;/p&gt;&#xA;&lt;p&gt;Note that this also shows that this is not as special property of states. Any generating set will do.&lt;/p&gt;&#xA;&lt;p&gt;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)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; A = \sum_{i,j} c_{i,j} \rho_i \otimes \rho_{j} \quad \Rightarrow \quad \sum_{ij} c_{ij} = 1.&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;BTW, this is the geometric background for the &lt;em&gt;robustness of entanglement&lt;/em&gt; which is an entanglement monotone defined as the minimum negativity in an affine decomposition of a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; into product states.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-10-21T11:39:51.383" LastActivityDate="2020-10-21T11:39:51.383" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14280" PostTypeId="1" AcceptedAnswerId="14282" CreationDate="2020-10-21T12:36:06.243" Score="1" ViewCount="439" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5217" LastEditorUserId="55" LastEditDate="2020-10-23T06:34:56.020" LastActivityDate="2020-10-23T06:34:56.020" Title="How can I obtain transformation matrix of a quantum circuit in the Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14281" PostTypeId="2" ParentId="14280" CreationDate="2020-10-21T15:03:36.977" Score="3" Body="&lt;p&gt;In qiskit, you can get the unitary transformation matrix from a quantum circuit by running the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;#circuit already defined&#xA;backend = Aer.get_backend('unitary_simulator')&#xA;job = execute(circuit, backend)&#xA;result = job.result()&#xA;print(result.get_unitary(circ, decimals=3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the matrix will output. As you increase the number of qubits in your circuit, the size of the unitary matrix will increase exponentially.&lt;/p&gt;&#xA;" OwnerUserId="13117" LastActivityDate="2020-10-21T15:03:36.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14282" PostTypeId="2" ParentId="14280" CreationDate="2020-10-21T15:40:56.797" Score="2" Body="&lt;p&gt;The other answer is great.&lt;/p&gt;&#xA;&lt;p&gt;But here is a link that walk you through the process step-by-step: &lt;a href=&quot;https://medium.com/mdr-inc/checking-the-unitary-matrix-of-the-quantum-circuit-on-qiskit-5968c6019a45&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://medium.com/mdr-inc/checking-the-unitary-matrix-of-the-quantum-circuit-on-qiskit-5968c6019a45&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-21T15:40:56.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14283" PostTypeId="2" ParentId="14280" CreationDate="2020-10-21T16:04:50.353" Score="3" Body="&lt;p&gt;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 &lt;code&gt;Operator&lt;/code&gt; class in the &lt;code&gt;qiskit.quantum_info&lt;/code&gt; library.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.quantum_info as qi&#xA;&#xA;op = qi.Operator(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want the numpy array of the operator, this can be obtained via the &lt;code&gt;data&lt;/code&gt; attribute (&lt;code&gt;array = op.data&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Operator.html#qiskit.quantum_info.Operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;API Documentation&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/2_operators_overview.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Operator tutorial&lt;/a&gt; for additional info on this class.&lt;/p&gt;&#xA;" OwnerUserId="8650" LastActivityDate="2020-10-21T16:04:50.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14284" PostTypeId="1" CreationDate="2020-10-21T19:23:51.687" Score="4" ViewCount="37" Body="&lt;p&gt;What are the bounds on quantum speedups under the various models of complexity? How big or small can they be?&lt;/p&gt;&#xA;&lt;p&gt;Under the query model, my understanding is that the lower bound is &lt;span class=&quot;math-container&quot;&gt;$\Omega(\sqrt{N})$&lt;/span&gt; as discussed in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9701001&quot; rel=&quot;nofollow noreferrer&quot;&gt;BBBV97&lt;/a&gt; and established by Grover's algorithm. The upper bound is established by Forrelation, as shown by &lt;a href=&quot;https://arxiv.org/abs/1411.5729&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson and Ambainis&lt;/a&gt;. Using these, we can then define a quantum speedup as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S={C(N)\over{Q(N)}}$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is some appropriately selected classical algorithm, &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; our quantum algorithm, and the quantum speedup is bounded by &lt;span class=&quot;math-container&quot;&gt;$\Omega(\sqrt{N}) \le S \le {\Omega(\sqrt{N}/ \log N)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="10480" LastEditDate="2021-01-15T22:05:57.147" LastActivityDate="2021-01-15T22:05:57.147" Title="Bound on quantum speedups under various models of complexity" Tags="&lt;resource-request&gt;&lt;complexity-theory&gt;&lt;speedup&gt;&lt;forrelation&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14285" PostTypeId="1" AcceptedAnswerId="15122" CreationDate="2020-10-21T20:04:12.460" Score="3" ViewCount="108" Body="&lt;p&gt;Consider a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; with reduced states &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \text{Tr}_B(\rho_{AB})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B = \text{Tr}_A(\rho_{AB})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose one obtains states &lt;span class=&quot;math-container&quot;&gt;$\rho'_{A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho'_{B}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\|\rho'_A - \rho_A\|_1 \leq \delta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\|\rho'_B - \rho_B\|_1 \leq \delta$&lt;/span&gt;. That is, we have perturbed the reduced states slightly. In the specific problem I am looking at &lt;span class=&quot;math-container&quot;&gt;$\rho'_A$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho'_B$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; but perhaps this is not relevant.&lt;/p&gt;&#xA;&lt;p&gt;Does there exist a global state &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB}$&lt;/span&gt; with marginals &lt;span class=&quot;math-container&quot;&gt;$\rho'_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho'_B$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\|\rho'_{AB} - \rho_{AB}\|_1\leq \varepsilon(\delta)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lim_{\delta\rightarrow 0}\varepsilon(\delta) = 0$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-10-23T06:44:33.807" LastActivityDate="2020-12-13T00:53:10.553" Title="Quantum marginal problem - constructing a global state from reduced states" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;&lt;information-theory&gt;&lt;trace-distance&gt;&lt;state-space-geometry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14286" PostTypeId="1" AcceptedAnswerId="14287" CreationDate="2020-10-21T20:38:47.253" Score="0" ViewCount="26" Body="&lt;p&gt;I am trying to create this state:&#xA;rho =  = q . rho_{1,2} + r . rho_{2,3} + s . rho{1,3} + (1-q-r-s) . rho_separable&lt;/p&gt;&#xA;&lt;p&gt;And I wrote this code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;   import random&#xA;import numpy as np&#xA;import cirq&#xA;&#xA;circuit, circuit2, circuit3   = cirq.Circuit()&#xA;p = 0.2&#xA;q = 0.1&#xA;r = 0.3&#xA;alice, bob, charlie = cirq.LineQubit.range(1, 4)&#xA;rho_12 = circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)]) &#xA;#circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)]) &#xA;rho_23 = circuit.append([cirq.H(bob), cirq.CNOT(bob, charlie)]) &#xA;rho_13 = circuit.append([cirq.H(alice), cirq.CNOT(alice, charlie)]) &#xA;circuit = rho_12 + rho_23 + rho_13&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In here I have 2 problem:&lt;/p&gt;&#xA;&lt;p&gt;1)This line is not working: &lt;code&gt;circuit = rho_12 + rho_23 + rho_13&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;2)I cannot multiply the state with p or q or r. What I mean is that I can't write this line:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;rho_12 = circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)]) * q &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Could you please show me how I can write this state?&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2020-10-23T06:35:14.100" LastActivityDate="2020-10-23T06:35:14.100" Title="Multiple Bipartite Entangled State in Cirq" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14287" PostTypeId="2" ParentId="14286" CreationDate="2020-10-21T21:28:22.017" Score="0" Body="&lt;p&gt;You seem to think &lt;code&gt;append&lt;/code&gt; is returning a circuit, instead of modifying the circuit you called it on. &lt;code&gt;circuit.append(op)&lt;/code&gt; doesn't return anything, it adds an operation to &lt;code&gt;circuit&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;alice, bob, charlie = cirq.LineQubit.range(1, 4)&#xA;circuit = cirq.Circuit()&#xA;circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)])&#xA;circuit.append([cirq.H(bob), cirq.CNOT(bob, charlie)]) &#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Alternatively, you can make a new circuit for each of the pieces and then add them together:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;rho_12 = cirq.Circuit(&#xA;    cirq.H(alice),&#xA;    cirq.CNOT(alice, bob),&#xA;)&#xA;...&#xA;circuit = rho_12 + rho_23 + rho_13&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-10-21T21:28:22.017" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14288" PostTypeId="1" AcceptedAnswerId="14289" CreationDate="2020-10-21T23:24:10.483" Score="1" ViewCount="48" Body="&lt;p&gt;1)I want to use noise model for my state and bit_flip is not defined on cirq.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    rho_13 = cirq.Circuit(&#xA;    cirq.H(alice),&#xA;    cirq.CNOT(alice, charlie),&#xA;    #cirq.bit_flip([r]),&#xA;    cirq.measure(alice,charlie),&#xA;) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I wrote this code, I had the error: &amp;quot; bit_flip is not defined&amp;quot; (I used import cirq)&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    ghz = cirq.Circuit(  &#xA;   cirq.H(qubits[0]),&#xA;   for i in range (n-1):&#xA;       cirq.CNOT ( qubits [i] , qubits [i+1]),&#xA;   cirq.final_density_matrix(circuit),&#xA;   cirq.measure (* qubits , key ='x'),. &#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The syntax error is just after the &amp;quot;for&amp;quot; and &amp;quot;Invalid syntax&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;3)My original state is |GHZ&amp;gt;&amp;lt;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&amp;gt;&amp;lt;GHZ and then (1-P)rho, and then I will write circuit =|GHZ&amp;gt;&amp;lt;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&amp;gt;&amp;lt;GHZ too&lt;/p&gt;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;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&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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&amp;gt;&amp;lt;GHZ| and then I will measure P*rho and after that I will add my circuit like circuit =|GHZ&amp;gt;&amp;lt;GHZ|+(1-P)rho and simulate or Should I directly add and after that measure the all circuit?&lt;/p&gt;&#xA;&lt;p&gt;Many thanks from now&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2020-10-23T06:35:08.703" LastActivityDate="2020-10-23T06:35:08.703" Title="Bit Flip, Seperable state and Several Question about Cirq" Tags="&lt;programming&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;noise&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14289" PostTypeId="2" ParentId="14288" CreationDate="2020-10-22T01:29:03.070" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;You are running into basic python issues: trying to call a function with a list &lt;code&gt;[r]&lt;/code&gt; instead of a float parameter. Also, the bit_flip channel then needs to be applied on a qubit. A potential fix is here:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;alice, bob, charlie = cirq.LineQubit.range(3)&#xA;rho_13 = cirq.Circuit(&#xA;    cirq.H(alice),&#xA;    cirq.CNOT(alice, charlie),&#xA;    # you need a probability to have the channel defined&#xA;    # then you'll need to apply the channel to a qubit&#xA;    cirq.bit_flip(p=0.6)(charlie),&#xA;    cirq.&#xA;measure(alice,charlie),&#xA;) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;This is also fraught with Python issues. You are trying to create a circuit - but then passing in a for loop as an argument? &lt;code&gt;cirq.final_density_matrix&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Summing states together only makes sense in the density matrix representation. From your three last questions (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14241/producing-ghzghz-state-in-cirq&quot;&gt;Producing |GHZ&amp;gt;&amp;lt;GHZ| State in Cirq&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14286/multiple-bipartite-entangled-state-in-cirq&quot;&gt;Multiple Bipartite Entangled State in Cirq&lt;/a&gt; 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&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;create the density matrix for each of them,&lt;/li&gt;&#xA;&lt;li&gt;multiply them with the required probabilities&lt;/li&gt;&#xA;&lt;li&gt;sum them together.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You need to tell us more about what kind of separable state you would like. |000&amp;gt;&amp;lt;000| is one of the simplest separable ones - as it is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle0| \otimes|0\rangle\langle0|\otimes|0\rangle\langle0|$&lt;/span&gt; - 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;There are two major ways that I can think of to solve this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;using density matrices directly&lt;/li&gt;&#xA;&lt;li&gt;using mixtures of unitaries&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here is an example for both - at the end the final density matrix is exactly the same.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;from typing import Union, Sequence, Tuple, Any&#xA;&#xA;import cirq&#xA;import numpy as np&#xA;&#xA;from cirq.type_workarounds import NotImplementedType&#xA;&#xA;&#xA;# ======== Density matrix based method ============&#xA;&#xA;a, b, c = cirq.LineQubit.range(3)&#xA;GHZ_circuit = cirq.Circuit(cirq.H(a),&#xA;                           cirq.CNOT(a, b),&#xA;                           cirq.CNOT(b, c))&#xA;&#xA;GHZ = cirq.final_density_matrix(GHZ_circuit)&#xA;&#xA;&#xA;def density_matrix_bipartite_entangled(i, j, qs):&#xA;    circuit = biparty_entangle_circuit(i, j, qs)&#xA;    return cirq.final_density_matrix(circuit, qubit_order=qs)&#xA;&#xA;&#xA;def biparty_entangle_circuit(i, j, qs):&#xA;    return cirq.Circuit(cirq.H(qs[i]), cirq.CNOT(qs[i], qs[j]))&#xA;&#xA;&#xA;qs = [a, b, c]&#xA;&#xA;rho01 = density_matrix_bipartite_entangled(0, 1, qs)&#xA;rho02 = density_matrix_bipartite_entangled(0, 2, qs)&#xA;rho12 = density_matrix_bipartite_entangled(1, 2, qs)&#xA;&#xA;# creates the |+&amp;gt; ⊗ |1&amp;gt; ⊗ |0&amp;gt; state&#xA;circuit_separable = cirq.Circuit(cirq.H(a), cirq.X(b))&#xA;rho_separable = cirq.final_density_matrix(circuit_separable, qubit_order=qs)&#xA;&#xA;p, q, r, s = 0.5, 0.3, 0.2, 0.1&#xA;assert 0 &amp;lt;= q + r + s &amp;lt;= 1&#xA;assert 0 &amp;lt;= p &amp;lt;= 1&#xA;&#xA;rho = q * rho01 + r * rho02 + s * rho12 + (1 - q - r - s) * rho_separable&#xA;state = p * GHZ + (1 - p) * rho&#xA;&#xA;print(f&amp;quot;final state: \n {state}&amp;quot;)&#xA;&#xA;print(cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))&#xA;&#xA;&#xA;# ======== Mixture based method ============&#xA;&#xA;class MixtureGate(cirq.Gate):&#xA;    def __init__(self, p, q, r, s):&#xA;        self.p = p&#xA;        self.q = q&#xA;        self.r = r&#xA;        self.s = s&#xA;&#xA;    def _num_qubits_(self) -&amp;gt; int:&#xA;        return 3&#xA;&#xA;    def _mixture_(self) -&amp;gt; Union[Sequence[Tuple[float, Any]],&#xA;                                 NotImplementedType]:&#xA;        p, q, r, s = self.p, self.q, self.r, self.s&#xA;        rho01_gate = biparty_entangle_circuit(0, 1, qs).unitary(&#xA;            qubits_that_should_be_present=qs)&#xA;        rho02_gate = biparty_entangle_circuit(0, 2, qs).unitary(&#xA;            qubits_that_should_be_present=qs)&#xA;        rho12_gate = biparty_entangle_circuit(1, 2, qs).unitary(&#xA;            qubits_that_should_be_present=qs)&#xA;        separable_gate = circuit_separable.unitary(&#xA;            qubits_that_should_be_present=qs)&#xA;&#xA;        return [&#xA;            (p, GHZ_circuit.unitary()),&#xA;            ((1 - p) * q, rho01_gate),&#xA;            ((1 - p) * r, rho02_gate),&#xA;            ((1 - p) * s, rho12_gate),&#xA;            ((1 - p) * (1 - q - r - s), separable_gate),&#xA;        ]&#xA;&#xA;&#xA;final_circuit = cirq.Circuit(&#xA;    MixtureGate(p, q, r, s)(a, b, c)&#xA;)&#xA;circuit_based_state = cirq.final_density_matrix(final_circuit)&#xA;&#xA;print(circuit_based_state)&#xA;&#xA;# we can do measurements here as well&#xA;&#xA;final_circuit.append(cirq.measure(a, b, c))&#xA;&#xA;r = cirq.DensityMatrixSimulator().run(program=final_circuit, repetitions=10)&#xA;print(&amp;quot;Measurement results: &amp;quot;, r)&#xA;&#xA;## They are the same, yay!&#xA;assert np.allclose(circuit_based_state, state)&#xA;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4986" LastEditorUserId="4986" LastEditDate="2020-10-22T02:04:28.837" LastActivityDate="2020-10-22T02:04:28.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14290" PostTypeId="2" ParentId="14259" CreationDate="2020-10-22T09:10:32.433" Score="4" Body="&lt;p&gt;Just notice that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho'_{AB}) = \text{Tr}(\Pi_B\rho_{B}).&#xA;$$&lt;/span&gt;&#xA;One way to see this is to consider any decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB} = \sum_i A_i \otimes B_i,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A_i, B_i$&lt;/span&gt; just some matrices, not states.&lt;br /&gt;&#xA;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho'_{AB}) = &#xA;\text{Tr}\big(\sum_i A_i \otimes \Pi_BB_i\Pi_B\big) =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \sum_i \text{Tr}(A_i)\text{Tr}(\Pi_BB_i\Pi_B) = &#xA;\sum_i \text{Tr}(A_i)\text{Tr}(\Pi_BB_i)&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\Pi_B\rho_{B}) = \text{Tr}(\Pi_B \sum_i \text{Tr}(A_i)B_i) =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \sum_i \text{Tr}(A_i)\text{Tr}(\Pi_BB_i). &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we can deduce that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho_{AB} - \rho'_{AB}) = 1 - \text{Tr}(\Pi_B\rho_{B}) \le \varepsilon&#xA;$$&lt;/span&gt;&#xA;and hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho_{A} - \rho'_{A}) \le \varepsilon&#xA;$$&lt;/span&gt;&#xA;since &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho'_{AB}) = \text{Tr}(\rho'_{A})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This bounds &lt;span class=&quot;math-container&quot;&gt;$\rho'_{A}$&lt;/span&gt; from below (in contrast to &lt;span class=&quot;math-container&quot;&gt;$0 \le \rho_{A} - \rho'_{A}$&lt;/span&gt;). It can be seen now that &lt;span class=&quot;math-container&quot;&gt;$\rho'_{A} \rightarrow \rho_{A}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\varepsilon \rightarrow 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;From trace inequality and positivity of &lt;span class=&quot;math-container&quot;&gt;$\rho_A - \rho'_A$&lt;/span&gt; we can deduce&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;0 \le \rho_A - \rho'_A \le \varepsilon I,&#xA;$$&lt;/span&gt;&#xA;so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho'_A \le \rho_A \le \rho'_A + \varepsilon I.&#xA;$$&lt;/span&gt;&#xA;Hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda'_i \le \lambda_i \le \lambda'_i + \varepsilon,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{ \lambda_i \}, \{ \lambda'_i \}$&lt;/span&gt; are sorted eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho_A, \rho'_A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now if &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; is the first non-zero eigenvalue and &lt;span class=&quot;math-container&quot;&gt;$\varepsilon &amp;lt; \lambda_k$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\lambda'_k \ge \lambda_k - \varepsilon &amp;gt; 0$&lt;/span&gt;, which means &lt;span class=&quot;math-container&quot;&gt;$\lambda'_k$&lt;/span&gt; will be the first non-zero eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\rho'_A$&lt;/span&gt;. For it we know that &lt;span class=&quot;math-container&quot;&gt;$\lambda_k - \varepsilon \le \lambda'_k \le \lambda_k$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-10-23T09:29:12.947" LastActivityDate="2020-10-23T09:29:12.947" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14291" PostTypeId="1" CreationDate="2020-10-22T10:34:30.030" Score="2" ViewCount="55" Body="&lt;p&gt;Say we want to apply CNOT, and the control register &amp;quot;c&amp;quot; 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*?&lt;/p&gt;&#xA;&lt;p&gt;I checked &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0211100.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Classical Concepts in Quantum Programming&amp;quot;&lt;/a&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="13584" LastActivityDate="2020-10-23T12:24:24.420" Title="How to apply control on a register if that register is equal to a specific n-bit string c*?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14292" PostTypeId="2" ParentId="11580" CreationDate="2020-10-22T12:17:43.517" Score="0" Body="&lt;p&gt;For an n-qubit operation it means:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare n Bell pairs &lt;span class=&quot;math-container&quot;&gt;$a_k, b_k = |00\rangle + |11\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Take one qubit &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt; from each pair, and apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to those qubits &lt;span class=&quot;math-container&quot;&gt;$a_1, a_2, ..., a_n$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The state of all of the qubits &lt;span class=&quot;math-container&quot;&gt;$a_1, b_1, ... a_n, b_n$&lt;/span&gt; now encodes the operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Quirk makes this particularly blatant, because the way it displays superpositions results in the final state even &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22inc2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;looking like&lt;/em&gt;&lt;/a&gt; the matrix of the operation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22inc2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RvnXH.png&quot; alt=&quot;Quirk example&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-10-22T12:17:43.517" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14293" PostTypeId="1" CreationDate="2020-10-22T15:40:06.623" Score="2" ViewCount="28" Body="&lt;p&gt;In this &lt;a href=&quot;https://dl.acm.org/doi/pdf/10.1145/992287.992296?casa_token=ricyOrOozKIAAAAA:I4Ks3m3amLLdP1Z5reOT1P3wiY6EUUX-sZOMJoIfaYcpJdX2ThhRZDAELfoM0CLIMfQSEvMYlR5n&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{1.329...^n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the original algorithm by Schöning, the algorithm is repeated for &lt;span class=&quot;math-container&quot;&gt;$1.329^n$&lt;/span&gt; time to obtain a constant success probability. Ambainis states the following: &amp;quot;To obtain a quantum algorithm, we just use quantum amplitude amplification instead of classical repetition.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="7986" LastActivityDate="2020-10-22T16:04:54.937" Title="Grover's Search applied to Schöning's Algorithm" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14294" PostTypeId="2" ParentId="7035" CreationDate="2020-10-22T15:56:15.397" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Knot_theory#Knot_diagrams&quot; rel=&quot;nofollow noreferrer&quot;&gt;knot diagrams&lt;/a&gt;/grid diagrams, and labeling edges with various &lt;a href=&quot;https://en.wikipedia.org/wiki/Reidemeister_move&quot; rel=&quot;nofollow noreferrer&quot;&gt;Reidemeister moves&lt;/a&gt; that go from one diagram to another.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/P9BCe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P9BCe.png&quot; alt=&quot;Cleve et al + Reidemeister&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Walking along the tree may be somewhat akin to trying to untangle/untie a complicated knot.&lt;/p&gt;&#xA;&lt;p&gt;For example, one could identify the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ENTRANCE}$&lt;/span&gt; node with a given knot diagram, and the target &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EXIT}$&lt;/span&gt; node with some canonical labeling of the given knot. Each edge corresponds to a Reidemeister move.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Walking from the left &lt;span class=&quot;math-container&quot;&gt;$\mathrm{ENTRANCE}$&lt;/span&gt; to the middle glued region might correspond to performing Reidemeister Type I/II moves that increase the number of crossings, up to an &lt;em&gt;a-priori&lt;/em&gt; given maximum crossing number;&lt;/li&gt;&#xA;&lt;li&gt;Walking within the middle corresponds to Type III moves that don't change the crossing number but rather just do over/under slides; and&lt;/li&gt;&#xA;&lt;li&gt;Walking from the middle to the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{EXIT}$&lt;/span&gt; node corresponds to performing Type I/II moves that &lt;em&gt;decrease&lt;/em&gt; the crossing number.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;As opposed to the tree considered by Childs et al., such a Reidemeister graph is not of degree &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, nor is it even regular, but I sense that the graph is sufficiently sparse that much of the exponential speedup would carry through.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-01-06T01:27:39.410" LastActivityDate="2021-01-06T01:27:39.410" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14295" PostTypeId="2" ParentId="14293" CreationDate="2020-10-22T16:04:54.937" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Given an oracle (Schoning's algorithm) which accepts &lt;span class=&quot;math-container&quot;&gt;$(3/4)^n$&lt;/span&gt; of its possible inputs, you only need &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{(4/3)^n)})$&lt;/span&gt; Grover steps to find one of those satisfying inputs.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-10-22T16:04:54.937" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14296" PostTypeId="1" CreationDate="2020-10-22T16:26:41.763" Score="2" ViewCount="44" Body="&lt;p&gt;Reading the quantum phase estimation algorithm on &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, I am wondering how exactly the measurements are used to obtain the phase &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;. 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., &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; in the notation used on Wikipedia, what I obtain is a list of probabilities for each state. (Imagine the case &lt;span class=&quot;math-container&quot;&gt;$\delta\neq 0$&lt;/span&gt;). How exactly can I get this &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; from these probabilities? Since the probability &lt;span class=&quot;math-container&quot;&gt;$\text{Pr}(a)$&lt;/span&gt; is what I get and is expressed in terms of &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;, do I have to inverse the following function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{Pr}(a) = \frac{1}{2^{2^{n}}}\frac{|\sin(\pi 2^{n}\delta)|^{2}}{|\sin(\pi\delta)|^{2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in order to get &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Meanwhile, how does the algorithm recognise the nearest integer to &lt;span class=&quot;math-container&quot;&gt;$2^{n}\theta$&lt;/span&gt;? 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, &lt;span class=&quot;math-container&quot;&gt;$\textit{a priori}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2^{n}\theta = a + 2^{n}\delta$&lt;/span&gt;, then what I obtain is this list of probabilities for each &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. It appears I can use any of them to estimate the phase. In this case, which probability shall I use?&lt;/p&gt;&#xA;" OwnerUserId="13563" LastEditorUserId="55" LastEditDate="2020-10-23T06:45:26.430" LastActivityDate="2020-10-23T06:45:26.430" Title="How to use the measurement in quantum phase estimation?" Tags="&lt;algorithm&gt;&lt;measurement&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14297" PostTypeId="2" ParentId="11881" CreationDate="2020-10-22T17:36:04.120" Score="2" Body="&lt;p&gt;Cirq has now a DOI published through Zenodo - please refer to &lt;a href=&quot;https://github.com/quantumlib/Cirq#how-to-cite-cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq#how-to-cite-cirq&lt;/a&gt; for citation.&lt;/p&gt;&#xA;" OwnerUserId="4986" LastActivityDate="2020-10-22T17:36:04.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14299" PostTypeId="2" ParentId="14291" CreationDate="2020-10-22T18:45:55.707" Score="2" Body="&lt;p&gt;&lt;strong&gt;Let me consider this example&lt;/strong&gt;: if we have &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; then the circuit should give us at the output &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}(|00\rangle +|01\rangle - |11\rangle)$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; must be unitary and that means it should keep the length of the vector, but in this example, the length didn't preserve (was &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, became &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;). 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;If we assume that there is no superposition of bitstrings&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; state then apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on the first qubit in order to obtain &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, 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):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PaEj6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PaEj6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first part can be understood from this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11674/9459&quot;&gt;answer&lt;/a&gt;, the second part uses ancillary qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; that will be in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if only the first two qubits are in &lt;span class=&quot;math-container&quot;&gt;$|01 \rangle$&lt;/span&gt; state. In the second part, a CNOT gate is applied to make sure that the first two qubits will be in &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; state at the end.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Did I understand the question right?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-23T12:24:24.420" LastActivityDate="2020-10-23T12:24:24.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14301" PostTypeId="1" AcceptedAnswerId="14302" CreationDate="2020-10-22T21:51:47.927" Score="0" ViewCount="54" Body="&lt;p&gt;The T Gate is defined as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1&amp;amp;0 \\ 0&amp;amp;e^{i\pi/4} \end{bmatrix} = \begin{bmatrix} 1&amp;amp;0 \\ 0&amp;amp;\frac{\sqrt{2}}{2}(1+i) \end{bmatrix}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1&amp;amp;0 \\ 0&amp;amp;\frac{\sqrt{2}}{2}(1+i) \end{bmatrix} \vert 1 \rangle = \begin{bmatrix} 1&amp;amp;0 \\ 0&amp;amp;\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}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But the following code for the T Gate gives a slightly different output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;from qiskit_textbook.tools import array_to_latex&#xA;&#xA;qc = QuantumCircuit(1)&#xA;qc.initialize([0,1],0)  # initialize to |1&amp;gt;&#xA;qc.t(0)&#xA;display(qc.draw('mpl'))&#xA;backend = Aer.get_backend('statevector_simulator')  # simulate the circuit&#xA;state = execute(qc,backend).result().get_statevector()  # get final state&#xA;array_to_latex(state, pretext=&amp;quot;\\text{Output} = &amp;quot;)  # show final state vector&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which is &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0 \\ \frac{1}{\sqrt{2}}(1+i) \end{bmatrix}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why do these two results differ? Thanks for any insights.&lt;/p&gt;&#xA;" OwnerUserId="13467" LastEditorUserId="55" LastEditDate="2020-10-24T16:59:16.827" LastActivityDate="2020-10-24T16:59:16.827" Title="State Vector Output for T$|1\rangle$ in Qiskit differs from manual calculation. Why is this so?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14302" PostTypeId="2" ParentId="14301" CreationDate="2020-10-22T22:07:51.540" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{2}}{2}(1+i) $&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(1+i)$&lt;/span&gt;. To see how this is the case, multiply the numerator and denominator of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; by  &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{2}}{\sqrt{2}}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\frac {\sqrt{2}}{\sqrt{2}} \frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{{2}}$&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;p&gt;The result doesn't differ; only how it's displayed in comparison to your manual calculation does.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2020-10-22T22:28:40.797" LastActivityDate="2020-10-22T22:28:40.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14303" PostTypeId="1" AcceptedAnswerId="14316" CreationDate="2020-10-22T23:12:09.393" Score="2" ViewCount="62" Body="&lt;p&gt;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'?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2020-10-24T16:58:30.830" LastActivityDate="2020-10-24T16:58:30.830" Title="Is there a clear boundary between quantum coupling and quantum entanglement?" Tags="&lt;entanglement&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14304" PostTypeId="1" CreationDate="2020-10-23T04:20:46.527" Score="3" ViewCount="95" Body="&lt;p&gt;In a paper called &lt;a href=&quot;https://arxiv.org/abs/1308.2493&quot; rel=&quot;nofollow noreferrer&quot;&gt;On quantum circuits employing roots of the Pauli matrices&lt;/a&gt;, 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?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BKZpR.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BKZpR.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="10495" LastEditorUserId="55" LastEditDate="2020-10-24T14:36:33.253" LastActivityDate="2020-10-24T14:36:33.253" Title="Optimizations in quantum circuits" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14305" PostTypeId="1" CreationDate="2020-10-23T07:18:05.130" Score="1" ViewCount="122" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;How to do the same on Qiskit using Python?&lt;/p&gt;&#xA;" OwnerUserId="13588" LastEditorUserId="1859" LastEditDate="2020-10-23T18:57:42.453" LastActivityDate="2020-10-23T18:57:42.453" Title="Partial Measurement of Quantum Circuit in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14306" PostTypeId="2" ParentId="14291" CreationDate="2020-10-23T09:20:30.123" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8682/trying-to-build-a-circuit-for-quantum-teleportation-on-ibmq-i-get-error-running&quot;&gt;this thread&lt;/a&gt; for more information.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-23T09:20:30.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14308" PostTypeId="2" ParentId="14305" CreationDate="2020-10-23T16:08:59.667" Score="2" Body="&lt;p&gt;Consider the maximal entangled state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \dfrac{1}{\sqrt{2}} \big( |00\rangle + |11\rangle \big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I make a measurement on the first qubit and a zero is returned then this implies my state has collapsed into the eigenvector &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and so the second qubit measurement will definitely returned a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as that the only possibility.&lt;/p&gt;&#xA;&lt;p&gt;However, if you consider the another entangled state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\phi  \rangle = \dfrac{1}{\sqrt{2}} \big( |01\rangle + |10\rangle \big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then measuring the first qubit and receiving a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; means the quantum state has collapsed onto the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, and so measuring the second qubit will now definitely returned a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as that the only possibility.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;code&gt;get_statevector()&lt;/code&gt; in the Aer's &lt;code&gt;statevector_simulator&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So for example, suppose I want to do this on the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; defined above, which can be implemented on the quantum circuit as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐     &#xA;q_0: ┤ H ├──■──&#xA;     └───┘┌─┴─┐&#xA;q_1: ─────┤ X ├&#xA;          └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now I can will make the measurement on the first qubit and extract out the state after the measurement:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, execute, QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;backend = Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;)&#xA;qc = QuantumCircuit(2, 2)&#xA;qc.h(0)&#xA;qc.cx(0,1)&#xA;qc.measure([0], [0])&#xA;print(qc)&#xA;result = execute(qc, backend=backend, shots=1).result()&#xA;print('State after first measurement:', result.get_statevector() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐     ┌─┐&#xA;q_0: ┤ H ├──■──┤M├&#xA;     └───┘┌─┴─┐└╥┘&#xA;q_1: ─────┤ X ├─╫─&#xA;          └───┘ ║ &#xA;c: 2/═══════════╩═&#xA;                0 &#xA;State after first measurement: [1.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="1859" LastEditDate="2020-10-23T18:57:15.557" LastActivityDate="2020-10-23T18:57:15.557" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14309" PostTypeId="2" ParentId="14304" CreationDate="2020-10-23T17:30:41.933" Score="1" Body="&lt;p&gt;For circuit equalities I find using &lt;a href=&quot;https://github.com/Strilanc/Quirk/wiki/How-to-use-Quirk#view-the-unitary-matrix-of-a-circuit-via-the-state-channel-duality&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk with the state-channel duality&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;In the given equality this is my thinking:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm going to ignore the equivalent prefix of the two circuits&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;this circuit is CNOT gates, that permute the subspaces and phaser gates (T / S are all just phasing the |1&amp;gt; subspace of the given qubit) - you can think about &amp;quot;commuting&amp;quot; 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 =&amp;gt; this explains why the S gate can be commuted over to the end&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now, if we ignore the phaser gates for a second, we get this circuit (see in &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22QFT4%22%5D,%5B%22inputA4%22,1,1,1,%22+=A4%22%5D,%5B1,1,1,1,1,%22X%22,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,1,%22X%22,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,%22X%22,1,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,%22X%22,1,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B1,1,1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,1,1,%22X%22,1,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,%22X%22,1,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,1,%22X%22,1,%22%E2%80%A2%22%5D,%5B1,1,1,1,1,%22X%22,1,%22%E2%80%A2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk state-channel duality&lt;/a&gt; to play around with)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xHl9P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xHl9P.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the question becomes why is this equivalent to&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sREns.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sREns.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We can remove the identities, after which the question becomes:&#xA;Why is&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HLIBE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HLIBE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;equivalent to&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/piDjZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/piDjZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;this last one can be understood by the CNOT mirroring rule (rule VI in &lt;a href=&quot;https://arxiv.org/pdf/1110.2998.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;adding two CNOTs is an identity&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tj7i9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tj7i9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;mirroring over the first CNOT results in adding the new CNOT&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H7Y0D.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H7Y0D.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;after which we can just commute the CNOTs to their places&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/piDjZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/piDjZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I'm sure there's simpler explanations :)&lt;/p&gt;&#xA;" OwnerUserId="4986" LastActivityDate="2020-10-23T17:30:41.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14310" PostTypeId="1" CreationDate="2020-10-23T18:50:40.163" Score="2" ViewCount="119" Body="&lt;p&gt;I am interested in executing multi-control gates and I have found two methods to do so as explained below.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2(n-1)$&lt;/span&gt; Toffoli gates and a single &lt;span class=&quot;math-container&quot;&gt;$CU$&lt;/span&gt; gate where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of control qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PtdeW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PtdeW.png&quot; alt=&quot;Figure 4.10&quot; /&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;The second method from &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9503016.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Barenco et al. (1995)&lt;/a&gt; (on their page 17) uses a total of &lt;span class=&quot;math-container&quot;&gt;$2^{n}-1$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; gates and &lt;span class=&quot;math-container&quot;&gt;$2^{n}-2$&lt;/span&gt; CNOT gates where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of control qubits and &lt;span class=&quot;math-container&quot;&gt;$V^4=U$&lt;/span&gt; in this example.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XU6ZI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XU6ZI.png&quot; alt=&quot;Barenco (1995)&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastActivityDate="2020-10-25T14:09:47.567" Title="Which method of executing a multi-control gate is more efficient?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14311" PostTypeId="2" ParentId="14310" CreationDate="2020-10-23T19:06:31.727" Score="2" Body="&lt;p&gt;As many things in life, the answer is &amp;quot;it depends&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If a method for decomposing a MCU is general enough, then it should be a task for the &lt;em&gt;circuit compiler&lt;/em&gt;. 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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, transpile&#xA;from qiskit.circuit.library.standard_gates import C3XGate&#xA;qc = QuantumCircuit(4)&#xA;qc.append(C3XGate(), [0, 1, 2, 3])&#xA;print(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ──■──&#xA;       │  &#xA;q_1: ──■──&#xA;       │  &#xA;q_2: ──■──&#xA;     ┌─┴─┐&#xA;q_3: ┤ X ├&#xA;     └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;With &lt;code&gt;optimization_level=3&lt;/code&gt; should give you the best result, considering a &lt;code&gt;['u', 'cx']&lt;/code&gt; basis:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpiled = transpile(qc, basis_gates=['u', 'cx'], optimization_level=3)&#xA;print('depth:', transpiled.depth())&#xA;print('gates:', sum(transpiled.count_ops().values()))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;depth: 35&#xA;gates: 42&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you also add a coupling map:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpiled = transpile(qc, basis_gates=['u', 'cx'], coupling_map=[[0,1], [1,2], [2,3]], optimization_level=3)&#xA;print('depth:', transpiled.depth())&#xA;print('gates:', sum(transpiled.count_ops().values()))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;depth: 79&#xA;gates: 127&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you have a concrete backend:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;transpiled = transpile(qc, backend=backend, optimization_level=3)&#xA;print('depth:', transpiled.depth())&#xA;print('gates:', sum(transpiled.count_ops().values()))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;depth: 48&#xA;gates: 68&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-10-25T14:09:47.567" LastActivityDate="2020-10-25T14:09:47.567" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14313" PostTypeId="2" ParentId="14304" CreationDate="2020-10-23T21:06:48.307" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/r7RYq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/r7RYq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT4%22%5D%2C%5B%22inputA4%22%2C1%2C1%2C1%2C%22%2B%3DA4%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KuW2E.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And this can be decomposed into a circuit using four T gates (instead of eight) &lt;a href=&quot;https://arxiv.org/pdf/1709.06648&quot; rel=&quot;nofollow noreferrer&quot;&gt;by using an ancilla&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT4%22%5D%2C%5B%22inputA4%22%2C1%2C1%2C1%2C1%2C%22%2B%3DA4%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22%7Ejjnb%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C%22X%22%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22Z%5E-%C2%BC%22%2C%22Z%5E-%C2%BC%22%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22X%22%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%5E%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Measure%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22Z%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A6%22%5D%2C%5B1%2C%22%E2%80%A6%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B%22inputA4%22%2C1%2C1%2C1%2C1%2C%22-%3DA4%22%5D%2C%5B%22QFT%E2%80%A04%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22%7Ejjnb%22%2C%22name%22%3A%22%7C0%3E%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XiHX1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-10-24T00:35:29.273" LastActivityDate="2020-10-24T00:35:29.273" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14314" PostTypeId="2" ParentId="5432" CreationDate="2020-10-23T23:33:29.453" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}&#xA;\newcommand{\ket}[1]{\left|#1\right&amp;gt;}$&lt;/span&gt;Consider the following linear operator:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \left[&#xA;\begin{matrix}&#xA;a &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; c\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;b &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; d\\&#xA;\end{matrix}&#xA;\right] \tag{1}\label{1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a 2-level matrix, acting non-trivially only on states &lt;span class=&quot;math-container&quot;&gt;$\ket{000}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{111}$&lt;/span&gt;. You are asking to show that this can be decomposed into the following 3 steps:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Permute the computational basis states such that &lt;span class=&quot;math-container&quot;&gt;$\ket{000}$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$\ket{011}$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$\ket{111}$&lt;/span&gt; remains &lt;span class=&quot;math-container&quot;&gt;$\ket{111}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Apply a single qubit gate on the first qubit if the second and third qubits are 1.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Undo step 1.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; This can be given the following representation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S = \underbrace{\ket{011}\bra{000} + \ket{000}\bra{001} + \ket{001}\bra{011}}_{\text{permutation of Gray codes}} + \\&#xA;+ \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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is just a permutation of the computational basis states. Its main purpose is to ensure that &lt;span class=&quot;math-container&quot;&gt;$\ket{000}$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$\ket{110}$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$\ket{111}$&lt;/span&gt; remains &lt;span class=&quot;math-container&quot;&gt;$\ket{111}$&lt;/span&gt;. There are also the transitions &lt;span class=&quot;math-container&quot;&gt;$\ket{001} \rightarrow \ket{000}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{011} \rightarrow \ket{001}$&lt;/span&gt; which I &lt;em&gt;think&lt;/em&gt; 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 &amp;amp; Chuang 10th edition on pages 192-193.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: We condition the single qubit gate's action on the second and third qubits being 1. There are only 2 states of this form: &lt;span class=&quot;math-container&quot;&gt;$\ket{011}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{111}$&lt;/span&gt;. Consider how a single qubit operation on the first qubit acts on these states:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\ket{011} \rightarrow \left(a\ket{0} + b\ket{1}\right)\ket{11} = a\ket{011} + b\ket{111}\\&#xA;\ket{111} \rightarrow \left(c\ket{0} + d\ket{1}\right)\ket{11} = c\ket{011} + d\ket{111} \tag{3}\label{3}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;All other states are left alone. Now we can write the full action of this single qubit gate as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bar{U} = \underbrace{\left(a\ket{011} + b\ket{111}\right) \bra{011} +&#xA;\left(c\ket{011} + d\ket{111}\right) \bra{111}}_{\text{action of single qubit gate}} + \\&#xA;+ \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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; We just need to undo step 1., which means that we need to take the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; unitary's inverse, which is its Hermitian conjugate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S^{\dagger} = \underbrace{\ket{000}\bra{011} + \ket{001}\bra{000} + \ket{011}\bra{001}}_{\text{undoing permutation of Gray codes}} + \\&#xA;+ \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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We want to show that &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}\bar{U}S=U$&lt;/span&gt;. Calculating &lt;span class=&quot;math-container&quot;&gt;$\bar{U}S$&lt;/span&gt;, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bar{U}S = \left(a\ket{011} + b\ket{111}\right) \bra{000} +&#xA;\left(c\ket{011} + d\ket{111}\right) \bra{111} + \\&#xA;+ \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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Left multiplying this by &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; yields:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}} + \\&#xA;+ \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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$\ket{000} \rightarrow a\ket{000}+b\ket{111}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\ket{111} \rightarrow c\ket{000}+d\ket{111}$&lt;/span&gt;. All other states are left alone. Therefore, \eqref{7} and \eqref{1} are equal.&lt;/p&gt;&#xA;" OwnerUserId="12643" LastEditorUserId="12643" LastEditDate="2020-10-23T23:38:40.470" LastActivityDate="2020-10-23T23:38:40.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14315" PostTypeId="1" AcceptedAnswerId="14319" CreationDate="2020-10-24T00:00:35.917" Score="2" ViewCount="33" Body="&lt;p&gt;On &lt;a href=&quot;https://en.wikipedia.org/wiki/R%C3%A9nyi_entropy#Hartley_or_max-entropy&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;, the max-entropy for classical systems is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{0}(A)_{\rho}=\log \operatorname{rank}\left(\rho_{A}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The term max-entropy in quantum information is reserved for the following definition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\max }(A)_{\rho}=2 \cdot \log \operatorname{tr}\left[\rho_{A}^{1 / 2}\right]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;While these are just definitions, they go by the same name so is there a relationship between them?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What I know&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The only thing I managed to prove was that &lt;span class=&quot;math-container&quot;&gt;$H_0(A)_\rho \geq H_{\max}(A)_\rho$&lt;/span&gt;. The proof is below. Let &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; be the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; be the rank of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;. We have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;H_{\max}(A)_\rho &amp;amp;= 2\log(\lambda_1^{1/2} + .. + \lambda_n^{1/2})\\&#xA;&amp;amp;\leq 2\log \left(\frac{1}{r^{1/2}}\cdot r\right)\\&#xA;&amp;amp;=H_0&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there perhaps a reverse version of this inequality&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_{\max}(A)_\rho\geq H_0(A)_\rho + \text{something}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which would justify using the same name for both quantities?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-10-26T08:38:16.490" LastActivityDate="2020-10-26T08:38:16.490" Title="What is the relationship between these two definitions for the max-entropy?" Tags="&lt;entropy&gt;&lt;information-theory&gt;&lt;linear-algebra&gt;&lt;max-entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14316" PostTypeId="2" ParentId="14303" CreationDate="2020-10-24T06:40:25.003" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Is there a clear boundary between quantum coupling and quantum entanglement?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If two qubits (or more) are coupled, they can influence each other. This means that they are entangled.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If two quantum systems are coupled, do they need to be restricted to a certain distance?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is there a difference between 'coupling the two qubits' and 'entangling' them using a Hadamard Gate?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Hadamard gate does not produce entangled state. It changes qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt; and state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$&lt;/span&gt;. 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. &lt;span class=&quot;math-container&quot;&gt;$HH=I$&lt;/span&gt;, so if it is applied on qubit in state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt;, a result is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In Schrodinger's cat thought experiment, are we saying the cat and radioactive source are 'entangled' or 'coupled'?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;See the answer to the first question.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-10-24T06:40:25.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14317" PostTypeId="2" ParentId="6639" CreationDate="2020-10-24T06:41:24.700" Score="1" Body="&lt;p&gt;&lt;strong&gt;For quantum software, all you need is matrix multiplication, complex numbers and basic probability for the base model&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;By &amp;quot;base model&amp;quot; I mean: how a programmer views a quantum computer program, and how outputs are calculated given input.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I also tried to highlight that in my tutorial for example: &lt;a href=&quot;https://cirosantilli.com/#programmer-s-model-of-quantum-computers&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cirosantilli.com/#programmer-s-model-of-quantum-computers&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And you can confirm it by playing for an hour with a software simulator like &lt;a href=&quot;https://en.wikipedia.org/wiki/Qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; (which has many tutorials, see the &lt;a href=&quot;https://qiskit.org/learn/&quot; rel=&quot;nofollow noreferrer&quot;&gt;official page&lt;/a&gt;) or even a toy graphical browser based one like &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; (highly recommended).&lt;/p&gt;&#xA;&lt;p&gt;Of course, then you will need to learn &amp;quot;as much maths and Physics as needed by your specific application&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;But this will vary widely by application, and 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 &amp;quot;quantum computing&amp;quot;. Some of the simpler existing algorithms (arguably not killer apps) don't require basically anything extra.&lt;/p&gt;&#xA;&lt;p&gt;It is also worth mentioning that any non theoretical (&amp;quot;proving things about an algorithm&amp;quot;) 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;For quantum hardware, you will need some theoretical Physics, and a lot of experimental Physics&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't work in the field, so I'm not entirely sure about how much theory is needed.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Superconducting_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;superconducting&lt;/a&gt; and a &lt;a href=&quot;https://en.wikipedia.org/wiki/Linear_optical_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;photonic&lt;/a&gt; QC will require widely different understandings.&lt;/p&gt;&#xA;&lt;p&gt;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 is likely currently impossible outside of a PhD setting as you won't have the money to do the experiments otherwise.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=7wCBkAQYBZA&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=7wCBkAQYBZA&lt;/a&gt; Jeremy O'Brien: &amp;quot;Quantum Technologies&amp;quot; at GoogleTechTalks (2014) is a fantastic introduction to a photonic quantum computer&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;More precise and practical understanding of the implementations will increasingly enter a mixture of journal publications + intellectual property and trade secret territory however.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Quantum error correction might need a bit more maths&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum error correction&lt;/a&gt; kind of lies in the middle of hardware and software, so maybe it is worth having a look at it separately.&lt;/p&gt;&#xA;&lt;p&gt;My wife who is a number theory PhD interested in quantum computing was telling me that there is some &amp;quot;relatively deep maths&amp;quot; needed for some of the proposed approaches, but I don't know the details.&lt;/p&gt;&#xA;&lt;p&gt;But I doubt it comes come anywhere near &amp;quot;research level pure mathematics&amp;quot;, and I'm pretty confident that it would be possible to understand the required mathematics without working full time on it.&lt;/p&gt;&#xA;&lt;p&gt;There is perhaps one exception: cryptography. One of the major &amp;quot;applications&amp;quot; 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: &lt;a href=&quot;https://csrc.nist.gov/projects/post-quantum-cryptography&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://csrc.nist.gov/projects/post-quantum-cryptography&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What should I study at university to maximize my changes of getting into quantum computing?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I would bet on focusing as much as possible on experimental physics areas that are used in the most promising quantum computer approaches:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;condensed matter (for superconducting)&lt;/li&gt;&#xA;&lt;li&gt;optics&lt;/li&gt;&#xA;&lt;li&gt;anything related to controlling states of individual atoms (which usually comes down to optics + semiconductors)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;we don't have enough qubits&amp;quot; rather than &amp;quot;we don't have enough ideas what to do with the qubits we have&amp;quot; as of 2020.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4243" LastEditorUserId="4243" LastEditDate="2021-05-03T15:38:47.980" LastActivityDate="2021-05-03T15:38:47.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14318" PostTypeId="1" AcceptedAnswerId="14320" CreationDate="2020-10-24T06:57:30.837" Score="1" ViewCount="90" Body="&lt;p&gt;I'm studying - well trudging through - &lt;em&gt;Quantum Computing for Everyone&lt;/em&gt; by Bernhardt. Towards the bottom of the book's physical page 41 he states, &amp;quot;spins are given by either,&amp;quot; and then shows an up state ket &lt;span class=&quot;math-container&quot;&gt;$|\uparrow\rangle$&lt;/span&gt; and then a negative up state ket &lt;span class=&quot;math-container&quot;&gt;$-| \uparrow \rangle$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;I've looked on the Internet, but to no avail.&lt;/p&gt;&#xA;&lt;p&gt;What does a negative ket &lt;span class=&quot;math-container&quot;&gt;$-| \uparrow \rangle$&lt;/span&gt;, or negative bra (if exists) for that matter, mean/represent within the introductory scope of Bernhardt's book?&lt;/p&gt;&#xA;&lt;p&gt;Much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13598" LastEditorUserId="55" LastEditDate="2020-10-26T08:36:11.890" LastActivityDate="2020-10-26T08:36:11.890" Title="What does a negative ket state represent?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14319" PostTypeId="2" ParentId="14315" CreationDate="2020-10-24T07:21:11.537" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;The term max-entropy in quantum information is reserved for the following definition&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;No it's not, many papers like &lt;a href=&quot;https://arxiv.org/abs/0803.2770&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0803.2770&lt;/a&gt; use the term to refer to the quantity &lt;span class=&quot;math-container&quot;&gt;$\log \mathrm{rank}(\rho)$&lt;/span&gt;. Your first definition comes from the Rényi entropy of order 0, while the second one comes from the Rényi entropy of order &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;, and you should always check which one the authors are referring to.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2020-10-24T07:21:11.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14320" PostTypeId="2" ParentId="14318" CreationDate="2020-10-24T12:37:42.027" Score="2" Body="&lt;p&gt;At the beginning of &lt;span class=&quot;math-container&quot;&gt;$40$&lt;/span&gt; page of the same book an arbitrary spin state is written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c_1| \uparrow \rangle + c_2|\downarrow \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|c_1|^2 + |c_2|^2 = 1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; are in general complex numbers, but how I understand from the parts of the book the author uses only real &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; here for some (maybe more pedagogical) reasons. There are infinite combinations of &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; 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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13765/9459&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;At the &lt;span class=&quot;math-container&quot;&gt;$41$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$42$&lt;/span&gt; pages, the author shows an example of states that are not distinguishable. Both &lt;span class=&quot;math-container&quot;&gt;$| \uparrow \rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$c_1 = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2 = 0$&lt;/span&gt;)  and &lt;span class=&quot;math-container&quot;&gt;$-| \uparrow \rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$c_1 = -1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2 = 0$&lt;/span&gt;) are valid quantum states that cannot be distinguished with some measurement procedure. There is no measurement procidure that will say if we have &lt;span class=&quot;math-container&quot;&gt;$| \uparrow \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-| \uparrow \rangle$&lt;/span&gt;. Moreover this two (equivalently valid) states are also not distinguishable (similar and more general example is shown in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13765/9459&quot;&gt;answer&lt;/a&gt; (replace &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow |\uparrow\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \rightarrow |\downarrow\rangle$&lt;/span&gt; in order to have the same notations):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_1 \rangle = c_1| \uparrow \rangle + c_2|\downarrow \rangle \qquad |\psi_2 \rangle = -(c_1| \uparrow \rangle + c_2|\downarrow \rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; discussed in the book): there is no experiment that will indicate if there is a minus sign before the state or not.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Also&lt;/strong&gt;: ket vectors by definition of allowed values of &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; can have a minus sign before them and hence their coresponding bra vectors also will have a minus sign: &lt;span class=&quot;math-container&quot;&gt;$(\pm |\uparrow \rangle)^\dagger = \pm\langle \uparrow |$&lt;/span&gt;. In the vector representation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\uparrow \rangle = \begin{pmatrix} 1 \\0 \end{pmatrix} \qquad -|\uparrow \rangle = \begin{pmatrix} -1 \\0 \end{pmatrix} \qquad \langle\uparrow | = \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} \qquad -\langle \uparrow | = \begin{pmatrix} -1 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-24T13:06:46.050" LastActivityDate="2020-10-24T13:06:46.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14321" PostTypeId="1" AcceptedAnswerId="14322" CreationDate="2020-10-24T16:29:52.203" Score="2" ViewCount="78" Body="&lt;p&gt;I am stuck with a question from the book Quantum theory by Asher Peres.&lt;/p&gt;&#xA;&lt;p&gt;Excercise (9.11):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Three different preparation procedures of a spin 1/2 particle are represented by the vectors &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;1 \\&#xA;0&#xA;\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \begin{pmatrix}&#xA;-1\\&#xA;\pm \sqrt{3}&#xA;\end{pmatrix}   $&lt;/span&gt;. If they are equally likely, the Shannon entropy is &lt;span class=&quot;math-container&quot;&gt;$\log{3}$&lt;/span&gt;, and the von Neumann entropy is &lt;span class=&quot;math-container&quot;&gt;$\log{2}$&lt;/span&gt;. Show that if there are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such particles, all prepared in the same way, the von Neumann entropy asymptotically tends to &lt;span class=&quot;math-container&quot;&gt;$\log{3}$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$n \to \infty$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Hint&lt;/strong&gt;: Consider three real unit vectors making equal angles: &lt;span class=&quot;math-container&quot;&gt;$\langle u_i,u_j \rangle = c $&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$ i \neq j$&lt;/span&gt; . Show that the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sum u_i u_i^\dagger$&lt;/span&gt; are 1-c, 1-c and 1+2c.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The Shannon entropy can be easily calculated to be &lt;span class=&quot;math-container&quot;&gt;$\log{3}$&lt;/span&gt;. The density matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\hat\rho$&lt;/span&gt; comes out to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA;\frac{1}{2} &amp;amp; 0\\&#xA;0 &amp;amp; \frac{1}{2}&#xA;\end{pmatrix}. &#xA;$$&lt;/span&gt;&#xA;Therefore, the von Neumann entropy also comes out to be &lt;span class=&quot;math-container&quot;&gt;$\log{2}$&lt;/span&gt;. However, in the second part, I am not able to get von Neumann entropy equal to &lt;span class=&quot;math-container&quot;&gt;$\log{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13602" LastEditorUserId="55" LastEditDate="2020-10-26T08:35:03.257" LastActivityDate="2020-10-26T08:35:03.257" Title="von Neumann entropy in a limiting case" Tags="&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14322" PostTypeId="2" ParentId="14321" CreationDate="2020-10-24T19:11:17.130" Score="3" Body="&lt;p&gt;Let us first prove the hint.&lt;/p&gt;&#xA;&lt;p&gt;Consider three &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;- dimensional unit vectors &lt;span class=&quot;math-container&quot;&gt;$u_i$&lt;/span&gt; and define &lt;span class=&quot;math-container&quot;&gt;$ A = \sum_{i=1}^{3} u_i u_i^{\dagger} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A simple calculation shows that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;A \big(u_1 + u_2 + u_3\big) &amp;amp; = (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) \\ &#xA;&amp;amp;= (1 + 2c) \cdot \big(u_1 + u_2 + u_3\big)&#xA;\end{align*}&lt;/span&gt;&#xA;meaning &lt;span class=&quot;math-container&quot;&gt;$ \xi = u_1 + u_2 + u_3 $&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$ A $&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$ 1 + 2c $&lt;/span&gt; eigenvalue.&lt;/p&gt;&#xA;&lt;p&gt;A similar calculation shows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;A \big(u_1 - u_2\big) = (1 - c) \cdot \big(u_1 - u_2\big), \hspace{1.5em} &#xA;A \big(u_1 - u_3\big) = (1 - c) \cdot \big(u_1 - u_3\big)&#xA;$$&lt;/span&gt;&#xA;Thus we have found 3-linear independent eigenvectors with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$ 1-c, 1-c, 1+2c $&lt;/span&gt;.&#xA;The other &lt;span class=&quot;math-container&quot;&gt;$ d - 3 $&lt;/span&gt; eigenvalues are, of course, zero with eigenvectors  orthogonal to &lt;span class=&quot;math-container&quot;&gt;$ V = \text{span}\{u_1, u_2, u_3\} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This means that the Von-Neumann entropy of the density matrix &lt;span class=&quot;math-container&quot;&gt;$ \rho = \frac{1}{3} \sum_{i=1}^{3} u_i u_i^{\dagger} $&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;S_{\rho} = &#xA;&amp;amp;- 2 \cdot \frac{1 - c}{3} \cdot \text{log}\big( \frac{1 - c}{3} \big) &#xA;- \frac{1 + 2c}{3} \cdot \text{log}\big( \frac{1 + 2c}{3} \big) \\= &#xA;&amp;amp;- 2 \cdot \frac{1 - c}{3} \cdot \text{log}\big(1 - c\big) &#xA;- \frac{1 + 2c}{3} \cdot \text{log}\big(1 + 2c\big) + \text{log}(3)&#xA;\end{align*}&lt;/span&gt;&#xA;and so &lt;span class=&quot;math-container&quot;&gt;$ S_{\rho} \to  \text{log}(3) $&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$ c \to 0 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why is this enough?&lt;/p&gt;&#xA;&lt;p&gt;Because for n particles the states are&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;1 \\&#xA;0&#xA;\end{pmatrix}^{\otimes n} $&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n} \begin{pmatrix}&#xA;-1\\&#xA;\pm \sqrt{3}&#xA;\end{pmatrix}^{\otimes n} $&lt;/span&gt;&#xA;with dot product &lt;span class=&quot;math-container&quot;&gt;$ v_i^{\dagger} v_j = \big(-\frac{1}{2}\big)^n $&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$ i \neq j $&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$ c \to 0 $&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$ n \to \infty $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-24T19:11:17.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14323" PostTypeId="1" AcceptedAnswerId="14342" CreationDate="2020-10-24T19:27:52.717" Score="3" ViewCount="86" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;One I could find was this  &lt;a href=&quot;https://arxiv.org/abs/1302.1035&quot; rel=&quot;nofollow noreferrer&quot;&gt;fault tolerant computing&lt;/a&gt;. In that case automorphism group for underlying codes to CSS codes are mainly considered.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;automorphism group&amp;quot; of relavance?&lt;/p&gt;&#xA;" OwnerUserId="8132" LastEditorUserId="8623" LastEditDate="2020-10-26T15:35:56.653" LastActivityDate="2020-10-26T16:40:22.213" Title="Are there any implications of the automorphism group in QECC?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14324" PostTypeId="1" AcceptedAnswerId="14325" CreationDate="2020-10-24T20:04:11.843" Score="4" ViewCount="77" Body="&lt;p&gt;In chapter 1 of &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; by &lt;em&gt;Michael A. Nielsen &amp;amp; Isaac L. Chuang&lt;/em&gt;, I came across this paragraph on quantum teleportation,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Intuitively, things look pretty bad for Alice. She doesn’t know the state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; of the&#xA;qubit she has to send to Bob, and the laws of quantum mechanics prevent her from&#xA;determining the state when she only has a single copy of &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; in her possession. What’s&#xA;worse, even if she did know the state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;, describing it precisely takes an infinite amount&#xA;of classical information since &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; takes values in a continuous space. So even if she did&#xA;know &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;, it would take forever for Alice to describe the state to Bob.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So Alice and Bob share a qubit each from an EPR pair created long ago and now Alice wishes to teleport the state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; to Bob by only sending classical information.&lt;/p&gt;&#xA;&lt;p&gt;I do not understand why describing &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt; takes an infinite amount of classical information, since to my knowledge, only the amplitudes of the basis vectors need to be known(&lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle=\alpha \lvert 0\rangle+\beta \lvert 1\rangle$&lt;/span&gt;). Maybe I did not understand properly what it means for Alice to know a state &lt;span class=&quot;math-container&quot;&gt;$\lvert\psi\rangle$&lt;/span&gt;. Any guidance would be helpful. Thank you.&lt;/p&gt;&#xA;&lt;p&gt;PS: I'm not from a Quantum mechanics background.&lt;/p&gt;&#xA;" OwnerUserId="13098" LastEditorUserId="55" LastEditDate="2020-10-25T03:54:57.270" LastActivityDate="2020-10-25T03:54:57.270" Title="Why does describing a quantum state take an infinite amount of classical information?" Tags="&lt;quantum-state&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-10-27T11:13:29.047" ContentLicense="CC BY-SA 4.0" />
  <row Id="14325" PostTypeId="2" ParentId="14324" CreationDate="2020-10-24T21:04:21.990" Score="2" Body="&lt;p&gt;Amplitudes &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; in the description of Alice's state are complex numbers; to describe them &lt;em&gt;precisely&lt;/em&gt;, you're going to need infinite number of bits of information. If you're only using a finite number of bits, you get an &lt;em&gt;approximation&lt;/em&gt; of the state, which can be a very good one but still not an exact representation.&lt;/p&gt;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-10-24T21:04:21.990" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14326" PostTypeId="1" AcceptedAnswerId="14328" CreationDate="2020-10-25T04:44:57.130" Score="1" ViewCount="48" Body="&lt;p&gt;I'm trying to create the teleportation circuit in IBM Qiskit Circuit Composer.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[3];&#xA;creg a[3];   // should be crz&#xA;creg b[4];   // should be crx&#xA;&#xA;h q[1];&#xA;cx q[1],q[2];&#xA;barrier q; //[0];&#xA;&#xA;cx q[0],q[1];&#xA;h q[0];&#xA;barrier q;&#xA;&#xA;measure q[0] -&amp;gt; a[0];&#xA;measure q[1] -&amp;gt; b[0];&#xA;barrier q;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This gives me the following circuit till the 3rd measurement barrier. How do I add &lt;code&gt;CRX&lt;/code&gt; and &lt;code&gt;CRZ&lt;/code&gt; gates - to obtain the circuit as shown in the picture? Also, how to change the names of the classical registers from &lt;code&gt;a3&lt;/code&gt;, &lt;code&gt;b4&lt;/code&gt; to &lt;code&gt;crz&lt;/code&gt; and &lt;code&gt;crx&lt;/code&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TIZmN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TIZmN.png&quot; alt=&quot;Teleportation Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12667" LastEditorUserId="55" LastEditDate="2020-10-26T08:19:52.747" LastActivityDate="2020-10-26T08:19:52.747" Title="Composing teleportation circuit in Qiskit Circuit Composer" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14327" PostTypeId="2" ParentId="9044" CreationDate="2020-10-25T05:41:15.563" Score="2" Body="&lt;p&gt;Let's say, you've the &lt;code&gt;Qiskit&lt;/code&gt; code for the circuit that you want to implement in Circuit Composer as shown below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(3, name=&amp;quot;q&amp;quot;)&#xA;crz, crx = ClassicalRegister(1, name=&amp;quot;crz&amp;quot;), ClassicalRegister(1, name=&amp;quot;crx&amp;quot;)&#xA;qc = QuantumCircuit(qr, crz, crx)&#xA;&#xA;qc.h(1) # Put qubit a into state |+&amp;gt;&#xA;qc.cx(1,2) # CNOT with a as control and b as target&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then use &lt;code&gt;print(qc.qasm())&lt;/code&gt; to get the circuit equivalent, which is as follows&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[3];&#xA;creg crz[1];&#xA;creg crx[1];&#xA;&#xA;h q[1];&#xA;cx q[1],q[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can run this code in QASM / Circuit Composer.&lt;/p&gt;&#xA;" OwnerUserId="12667" LastActivityDate="2020-10-25T05:41:15.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14328" PostTypeId="2" ParentId="14326" CreationDate="2020-10-25T06:28:15.503" Score="2" Body="&lt;p&gt;&lt;code&gt;crx&lt;/code&gt; and &lt;code&gt;crz&lt;/code&gt; are classical register. The gates &lt;code&gt;CRX&lt;/code&gt; or &lt;code&gt;CRZ&lt;/code&gt; mean that you apply the &lt;code&gt;X&lt;/code&gt; gate on qubit 2 if the measurement on the classical register &lt;code&gt;crx&lt;/code&gt; is a 1, that is if qubit 1 (&lt;code&gt;q1&lt;/code&gt;) is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state; and you will apply the &lt;code&gt;Z&lt;/code&gt; gate on qubit 2 if the classical register &lt;code&gt;crz&lt;/code&gt; is 1.&lt;/p&gt;&#xA;&lt;p&gt;This can be done in qiskit with &lt;code&gt;c_if&lt;/code&gt; operation. You can see example of the teleportation code in Qiskit here: &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/teleportation.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt; &#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Anyway, if you want to use OPENQASM, then you can do it as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[3];&#xA;creg crzz[3];   // since crz is already taken I use crzz instead&#xA;creg crxx[4];   // Again I use crxx instead of crx&#xA;&#xA;h q[1];&#xA;cx q[1],q[2];&#xA;barrier q; //[0];&#xA;&#xA;cx q[0],q[1];&#xA;h q[0];&#xA;barrier q;&#xA;&#xA;measure q[0] -&amp;gt; crzz[0];&#xA;measure q[1] -&amp;gt; crxx[0];&#xA;barrier q;&#xA;&#xA;if(crzz==1) z q[2];&#xA;if(crxx==1) x q[2]; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is the image of the circuit when using Circuit_Composer option within IBMQ Experience environment.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fqkoE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fqkoE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-25T06:28:15.503" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14329" PostTypeId="1" AcceptedAnswerId="14333" CreationDate="2020-10-25T09:34:32.627" Score="2" ViewCount="59" Body="&lt;p&gt;In this circuit (&lt;a href=&quot;https://quantum-computing.ibm.com/composer/new-experiment?initial=N4IgdghgtgpiBcICOEDOUC0AXGAbGGAxgE4BepGAjCADTJpQIgDyACgKIByAigIIDKAWQAEAJgB0ABgDcAHTABLMIVwBXACYxhs5HgUAjSuKWEdcsPKTEYAc2FIA2gGYAuuZK3hEBwFY38jzsScmd-ZWsg4gAPKIcAFjD5AAt7B0owwijU9JpHUTD9CGJiBRhie3MArMdJF1y0sJSagqKSsor5eVg0VWtU2uEMAD5hYNIHWvNu1F6tR3TBkZIYiZbi0vKkSsUAM2EACmWogF5jygBKYWqHfPMFPcOyUlOL4VJU2-lC9fatzrBprMPi5Fl4GtJaCBNKgSAoAA5YBQAezATBAAF8gA&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;), &lt;code&gt;q0&lt;/code&gt; is Alice's qubit and &lt;code&gt;q1&lt;/code&gt;, &lt;code&gt;q2&lt;/code&gt; are entangled qubits given to Alice and Bob respectively. After measuring &lt;code&gt;q2&lt;/code&gt; in this circuit, how can it be verified that the state of &lt;code&gt;q0&lt;/code&gt; and &lt;code&gt;q2&lt;/code&gt; are the same?&lt;/p&gt;&#xA;&lt;p&gt;By default, &lt;code&gt;q0&lt;/code&gt; is in ground state, I assume. So, shouldn't &lt;code&gt;q2&lt;/code&gt; be also in the ground state if the state was teleported.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zWsqs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zWsqs.png&quot; alt=&quot;teleportation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12667" LastEditorUserId="55" LastEditDate="2020-10-26T08:19:30.547" LastActivityDate="2020-10-26T08:19:30.547" Title="How to verify teleportation was successful in this circuit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14330" PostTypeId="2" ParentId="14329" CreationDate="2020-10-25T13:18:31.860" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13081" LastActivityDate="2020-10-25T13:18:31.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14332" PostTypeId="2" ParentId="14236" CreationDate="2020-10-25T13:33:36.450" Score="0" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13288" LastActivityDate="2020-10-25T13:33:36.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14333" PostTypeId="2" ParentId="14329" CreationDate="2020-10-25T18:07:26.150" Score="1" Body="&lt;p&gt;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. &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html#real_qc&quot; rel=&quot;nofollow noreferrer&quot;&gt;See here.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Essentially, your circuit becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3oKq7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3oKq7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The state of &lt;span class=&quot;math-container&quot;&gt;$q2$&lt;/span&gt; will depends on the state of &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; starts in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then measurement in &lt;span class=&quot;math-container&quot;&gt;$q2$&lt;/span&gt; will always (assume no noise) be 0. If instead I add the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operation on &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; to turn it into the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then measurement on &lt;span class=&quot;math-container&quot;&gt;$q2$&lt;/span&gt; will registered a 1.&lt;/p&gt;&#xA;&lt;p&gt;For example: if I initialize &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then I will have&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wBbNz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wBbNz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt; &#xA;&lt;hr /&gt;&#xA;&lt;br&gt; &#xA;&lt;p&gt;but &lt;strong&gt;if I initialize &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then I will have&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Sfonr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Sfonr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-25T18:07:26.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14334" PostTypeId="1" CreationDate="2020-10-25T19:13:32.030" Score="2" ViewCount="41" Body="&lt;p&gt;I am trying to implement the Mixer of the Max-Independent Set from The Quantum Alternating Operator Ansatz.&#xA;From this paper: &lt;a href=&quot;https://arxiv.org/pdf/1709.03489.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1709.03489.pdf&lt;/a&gt; in Chapter 4.2 page 15 to 17.&lt;/p&gt;&#xA;&lt;p&gt;For every verice &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; in the Graph this operator &lt;span class=&quot;math-container&quot;&gt;$H_{CX,v}$&lt;/span&gt; is definded. (&lt;span class=&quot;math-container&quot;&gt;$nbhd(v)$&lt;/span&gt; are all the neighbors of v)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;    H_{CX,v} &amp;amp;= X_{v} H_{NOR(x_{nbhd(v)})} \\&#xA;    &amp;amp;= 2^{-D_{v}}X_{v}\prod_{w \in nbhd(v)}(I + Z_{w})\\&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then the operators for all vertices are summed up.&#xA;Are there any rules how to sum up operators?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_{CX} = \sum_{i = 0}^{n-1}H_{CX,v_{i}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After that the exponential of the Matrix is calculated.&#xA;I have no clue how to do that.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_{sim-CX}(\beta) = e^{-i\beta H_{CX}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Should I maybe do a Hamiltonian-simulation or are there other ways for doing this?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for reading :)&lt;/p&gt;&#xA;" OwnerUserId="11646" LastActivityDate="2020-10-25T19:13:32.030" Title="How to implement the Mixer of Quantum Alternating Operator Ansatz for Max-Independent-Set" Tags="&lt;programming&gt;&lt;mathematics&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14335" PostTypeId="1" AcceptedAnswerId="14373" CreationDate="2020-10-25T21:56:35.063" Score="1" ViewCount="62" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I am considering T gates because they can be a universal gate when paired with the Clifford group which is easy to simulate.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for reading !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="55" LastEditDate="2020-10-28T11:01:31.080" LastActivityDate="2020-10-28T17:15:52.500" Title="Average execution time for T gate" Tags="&lt;physical-realization&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14336" PostTypeId="1" CreationDate="2020-10-26T00:15:47.500" Score="3" ViewCount="58" Body="&lt;p&gt;I had asked a question similar to this one &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13912/constructing-arbitrary-functions-for-the-abelian-hsp&quot;&gt;here&lt;/a&gt; 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 &lt;a href=&quot;https://www.cs.umd.edu/%7Eamchilds/qa/qa.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Andrew Child's notes&lt;/a&gt; section 4.4 (also mentioned in more detail &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0212002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; section 3.4) .&lt;/p&gt;&#xA;&lt;p&gt;Method 1:&#xA;To summarize the approach, this method utilizes the ability to prepare arbitrary uniform super-positions (i.e. algorithm used by &lt;code&gt;Qiskit.initialize&lt;/code&gt;) and controlled phase-shifts to produce the operation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|x, 0\rangle \mapsto |x, y\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = QFT_{p^n}(|x\rangle).$&lt;/span&gt; (1)&lt;/p&gt;&#xA;&lt;p&gt;Then given the phase-estimation applied to the cyclic-shift operator, &lt;span class=&quot;math-container&quot;&gt;$U_{p^n}: |x\rangle \mapsto |x + 1 \rangle $&lt;/span&gt;, produces the operation &lt;span class=&quot;math-container&quot;&gt;$|0,y\rangle \mapsto |\tilde{\frac{x}{p^n}}, y\rangle$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$QFT_{p_n}(|x\rangle)$&lt;/span&gt;)). Multiplying the left register by &lt;span class=&quot;math-container&quot;&gt;$p^n$&lt;/span&gt; produces:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0,y\rangle \mapsto |\tilde{x}, y\rangle$&lt;/span&gt; (2)&lt;/p&gt;&#xA;&lt;p&gt;and inverting this allows us to clear out the left&#xA;register containing &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in (1), and thus approximate &lt;span class=&quot;math-container&quot;&gt;$QFT_{p^n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, even in a simulator, with small examples like &lt;span class=&quot;math-container&quot;&gt;$p^n = 9$&lt;/span&gt;, 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 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205095&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Method 2:&#xA;However, I found a possible alternative mentioned &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9903071.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (page 9), which states quote:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If we use &lt;span class=&quot;math-container&quot;&gt;$F^{−1}_{p^{m_j}}$&lt;/span&gt;we would determine &lt;span class=&quot;math-container&quot;&gt;$t_j$&lt;/span&gt; [an element of the dual group/character] exactly,or we could use the simpler &lt;span class=&quot;math-container&quot;&gt;$F^{−1}_{2^{k}}$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$k &amp;gt;log_2(p^{m_j})$&lt;/span&gt;, and obtain &lt;span class=&quot;math-container&quot;&gt;$t_j$&lt;/span&gt; with high probability [...] In practice we could use &lt;span class=&quot;math-container&quot;&gt;$F^{−1}_{2^{k}}$&lt;/span&gt; for a large enough &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; so that the probability of error is sufficiently small.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Thus it seems this is a similar approach to Shor's: apply &lt;span class=&quot;math-container&quot;&gt;$QFT_{2^k}$&lt;/span&gt; for large enough &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, and then apply continued fractions. However, Shor's is for the HSP in  &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt;. So I'm not sure how to properly apply this method to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{p^n}$&lt;/span&gt;; I just tried to use &lt;span class=&quot;math-container&quot;&gt;$QFT_{2^k}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$p^{2n} &amp;lt; 2^k &amp;lt; 2p^{2n}$&lt;/span&gt; like in Shor's, which didn't seem to work. There also seems to be no proof of its validity for &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{p^n}$&lt;/span&gt;. The paper mentions it briefly, and there is no reference annotated. I also couldn't find this method referenced anywhere else.&lt;/p&gt;&#xA;&lt;p&gt;So my questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the correct way to apply 'method 2' (assuming my understanding of it is correct)?&lt;/li&gt;&#xA;&lt;li&gt;Is there any known way to speed up the multiplication required for 'method 1'?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If there is an entirely other way of going about this, please feel free to mention as well.&#xA;I'm trying to implement some small examples for learning purposes that are feasible on simulators.&lt;/p&gt;&#xA;" OwnerUserId="8765" LastActivityDate="2020-10-26T00:15:47.500" Title="Abelian Hidden Subgroup Problem for arbitrary cyclic p-Groups" Tags="&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;&lt;hidden-subgroup-problem&gt;&lt;fourier-sampling&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14337" PostTypeId="1" CreationDate="2020-10-26T08:52:06.993" Score="0" ViewCount="65" Body="&lt;p&gt;When I use &lt;code&gt;job.result().get_counts&lt;/code&gt; I am getting this result:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;bound method Result.get_counts of &amp;lt;qiskit.result.result.Result object at ...&amp;gt;&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8388" LastEditorUserId="55" LastEditDate="2020-10-27T09:08:38.880" LastActivityDate="2020-10-27T09:08:38.880" Title="Cannot get the counts of a job in Qiskit with the usual command" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14338" PostTypeId="2" ParentId="14337" CreationDate="2020-10-26T08:55:50.777" Score="2" Body="&lt;p&gt;You are missing the &lt;code&gt;()&lt;/code&gt; at the end of &lt;code&gt;job.result().get_counts()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="332" LastEditorUserId="1859" LastEditDate="2020-10-27T05:41:35.380" LastActivityDate="2020-10-27T05:41:35.380" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14339" PostTypeId="2" ParentId="14337" CreationDate="2020-10-26T08:57:15.660" Score="1" Body="&lt;p&gt;Always in Python you need to put brakcets whenever you call a function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job.result().get_counts(&amp;lt;function parameters&amp;gt;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The parameter is a circuit name or index. If you run a single circuit then it should be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job.result().get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7659" LastEditorUserId="1859" LastEditDate="2020-10-26T18:31:15.020" LastActivityDate="2020-10-26T18:31:15.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14340" PostTypeId="1" AcceptedAnswerId="14341" CreationDate="2020-10-26T12:00:55.207" Score="6" ViewCount="96" Body="&lt;p&gt;With reference to a similar question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2111/what-integers-have-been-factored-with-shors-algorithm&quot;&gt;here&lt;/a&gt;, I would like to know what is the maximal number which has been factored with Shor's algorithm so far on actual quantum hardware.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1411.6758&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum factorization of 56153 with only 4 qubits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/1808.08927&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Factoring&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I also found &lt;em&gt;adapted&lt;/em&gt; Shor's algorithm described in &lt;a href=&quot;https://arxiv.org/abs/1903.00768&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Experimental Study of Shor's Factoring Algorithm on IBM Q&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;I would appreciate it if anyone can me provide a link to the paper(s) discussing progress in Shor's algorithm implementation.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="7429" LastEditDate="2021-01-21T17:59:42.793" LastActivityDate="2021-01-21T17:59:42.793" Title="What is a maximal number factored by Shor's algorithm so far?" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14341" PostTypeId="2" ParentId="14340" CreationDate="2020-10-26T15:11:25.180" Score="4" Body="&lt;p&gt;For what it is worth, here is a paper by Craig Gidney on &lt;a href=&quot;https://arxiv.org/pdf/1905.09749v2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;how to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits.&lt;/a&gt;&#xA;Hopefully others will be able to add more related papers.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-26T15:18:44.853" LastActivityDate="2020-10-26T15:18:44.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14342" PostTypeId="2" ParentId="14323" CreationDate="2020-10-26T15:29:46.120" Score="1" Body="&lt;p&gt;In the case of stabilizer codes, one generally starts with the group, &lt;span class=&quot;math-container&quot;&gt;$\cal{G}$&lt;/span&gt;, of tensor products of basis vectors on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.  On one qubit the applicable group is the &lt;a href=&quot;https://people.maths.bris.ac.uk/%7Ematyd/GroupNames/1/C4oD4.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli Group&lt;/a&gt;, which is order 16, call it &lt;span class=&quot;math-container&quot;&gt;$\cal{G}_0$&lt;/span&gt;.  So at the general level &lt;span class=&quot;math-container&quot;&gt;$\cal{G} = \bigotimes_{i=1}^n \cal{G}_0$&lt;/span&gt;.  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.&lt;/p&gt;&#xA;&lt;p&gt;The stabilizer subgroup, &lt;span class=&quot;math-container&quot;&gt;$\cal{S} &amp;lt; \cal{G}$&lt;/span&gt;, is an Abelian subgroup of &lt;span class=&quot;math-container&quot;&gt;$\cal{G}$&lt;/span&gt; that fixes the codespace, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}$&lt;/span&gt;.  Note that &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}$&lt;/span&gt; doesn't necessarily have a group structure, so it's a subspace of &lt;span class=&quot;math-container&quot;&gt;$\cal{G}$&lt;/span&gt;.  Since &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}$&lt;/span&gt; is the space of vectors fixed by &lt;span class=&quot;math-container&quot;&gt;$\cal{S}$&lt;/span&gt;, the action of &lt;span class=&quot;math-container&quot;&gt;$\cal{S}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}$&lt;/span&gt; is the trivial automorphism of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{T}$&lt;/span&gt; (i.e. the identity).&lt;/p&gt;&#xA;&lt;p&gt;As indicated by the name, it's generally the structure of &lt;span class=&quot;math-container&quot;&gt;$\cal{S}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{Aut}(\cal{S})$&lt;/span&gt; that are most interesting and useful.  &lt;span class=&quot;math-container&quot;&gt;$\text{Aut}(\cal{S})$&lt;/span&gt; determines the set of valid fault-tolerant encoded operations, so codes with large &lt;span class=&quot;math-container&quot;&gt;$\text{Aut}(\cal{S})$&lt;/span&gt; are desireable.  Since &lt;span class=&quot;math-container&quot;&gt;$\cal{S}$&lt;/span&gt; is Abelian there are no non-trivial inner automorphisms of &lt;span class=&quot;math-container&quot;&gt;$\cal{S}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\text{Aut}({\cal{S}})=\text{Out}(\cal{S})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9705052&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman's Thesis&lt;/a&gt;, which reads like a textbook on the subject.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\cal{S}$&lt;/span&gt; plays an important role.  The standard reference for OQECC from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0508131v4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Poulin&lt;/a&gt; is also very helpful in understanding the group structure of conventional stabilizer codes.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-10-26T16:40:22.213" LastActivityDate="2020-10-26T16:40:22.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14343" PostTypeId="1" AcceptedAnswerId="14344" CreationDate="2020-10-26T19:12:20.837" Score="2" ViewCount="83" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{I, Z_1Z_2, Z_2Z_3, Z_1Z_3\}$&lt;/span&gt;, can I just measure &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z_2Z_3$&lt;/span&gt;, and then find the expectation value of &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_3$&lt;/span&gt; from the expectation values of &lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_2Z_3$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12785" LastActivityDate="2020-10-26T21:17:00.823" Title="Measuring Pauli strings using generators" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14344" PostTypeId="2" ParentId="14343" CreationDate="2020-10-26T20:55:52.303" Score="3" Body="&lt;p&gt;Here I am going to show why &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_3 \rangle$&lt;/span&gt; generally cannot be estimated from &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_2 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_2 Z_3 \rangle$&lt;/span&gt;. Let's start with an arbitrary three-qubit state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|\psi \rangle = c_{000} &amp;amp;|000\rangle + c_{001} |001\rangle + c_{010} |010\rangle + c_{011} |011\rangle + &#xA;\\&#xA;+c_{100} &amp;amp;|100\rangle + c_{101} |101\rangle + c_{110} |110\rangle + c_{111} |111\rangle&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And because of this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13675/9459&quot;&gt;answer&lt;/a&gt; the expectation value for &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_2 Z_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_3$&lt;/span&gt; (I am using this convention for qubit indexes &lt;span class=&quot;math-container&quot;&gt;$|q_1 q_2 q_3 \rangle$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;\\&#xA;\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&#xA;\\&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From this expressions one can see that &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_3 \rangle$&lt;/span&gt; generally cannot be estimated from &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_2 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_3 \rangle$&lt;/span&gt;. For prove let's consider this conterexample when &lt;span class=&quot;math-container&quot;&gt;$|c_{000}| = |c_{010}|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|c_{001}| = |c_{011}|$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;\langle Z_1 Z_2 \rangle = - |c_{100}|^2 - |c_{101}|^2 + |c_{110}|^2 + |c_{111}|^2&#xA;\\&#xA;\langle Z_2 Z_3 \rangle = |c_{100}|^2 - |c_{101}|^2 - |c_{110}|^2 + |c_{111}|^2&#xA;\\&#xA;\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&#xA;\end{equation*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So for the same &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_2 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_2 Z_3 \rangle$&lt;/span&gt; there can be many different possible values for &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_3\rangle$&lt;/span&gt; because by varying the values &lt;span class=&quot;math-container&quot;&gt;$|c_{000}| = |c_{010}|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|c_{001}| = |c_{011}|$&lt;/span&gt; the expectations &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_2 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_2 Z_3 \rangle$&lt;/span&gt; will not be changed but  &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_3 \rangle$&lt;/span&gt; will be changed. So &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_3 \rangle$&lt;/span&gt; cannot be estimated from &lt;span class=&quot;math-container&quot;&gt;$\langle Z_1 Z_2 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle Z_2 Z_3 \rangle$&lt;/span&gt; in this conterexample.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-10-26T21:17:00.823" LastActivityDate="2020-10-26T21:17:00.823" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="14345" PostTypeId="1" AcceptedAnswerId="14346" CreationDate="2020-10-26T21:27:43.907" Score="4" ViewCount="133" Body="&lt;p&gt;I have the following gate (as represented by its matrix) on &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; qubits which I hope to use in an error-detection code&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$M=\left(&#xA;\begin{array}{cccccccccccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Naively, it is possible to make this gate using the following configuration of generalized toffoli gates and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GEeA7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GEeA7.png&quot; alt=&quot;Naive way&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, this is already past what is feasible to do on current machines. My question is: Is there a better way to implement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; or has previous research been done to create gates whose matrix representations consist solely of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s. This is not the only gate that I could implement that would serve my purposes (in fact, there are &lt;span class=&quot;math-container&quot;&gt;$(4!)^4=24^4=331176$&lt;/span&gt; matrices that would work), but this is the 'simplest' one (simplest as in it presents the most symmetry).&lt;/p&gt;&#xA;" OwnerUserId="9696" LastEditorUserId="55" LastEditDate="2020-10-28T09:13:32.687" LastActivityDate="2020-10-29T11:57:22.233" Title="Creating a custom gate (given by a matrix) more efficiently" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14346" PostTypeId="2" ParentId="14345" CreationDate="2020-10-26T22:19:25.057" Score="5" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.quantum_info import Operator&#xA;&#xA;qc = QuantumCircuit(4)&#xA;&#xA;qc.cx(2, 0)&#xA;qc.cx(3, 0)&#xA;&#xA;print(qc)&#xA;U = Operator(qc).data&#xA;print(U.real)&#xA;---&#xA;Output:&#xA;     ┌───┐┌───┐&#xA;q_0: ┤ X ├┤ X ├&#xA;     └─┬─┘└─┬─┘&#xA;q_1: ──┼────┼──&#xA;       │    │  &#xA;q_2: ──■────┼──&#xA;            │  &#xA;q_3: ───────■──&#xA;               &#xA;array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-26T22:19:25.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14348" PostTypeId="1" AcceptedAnswerId="14349" CreationDate="2020-10-27T06:27:43.080" Score="1" ViewCount="63" Body="&lt;p&gt;Let's say I have a pair of states among three parties Alice(A), Bob(B) and Eve(E), &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABE}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{UUE}$&lt;/span&gt; where the first two parties hold uniform values U.}&lt;/p&gt;&#xA;&lt;p&gt;I know that the trace distance between them is upper bounded by some small quantity &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. Like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;||\rho_{ABE} - \rho_{UUE} ||\le \epsilon .&#xA;$$&lt;/span&gt;&#xA;Now, I take the partial trace on B's subsystem, leaving only operators &lt;span class=&quot;math-container&quot;&gt;$\rho_{AE}, \rho_{UE}$&lt;/span&gt;. 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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;||\rho_{AE} - \rho_{UE} || \le \epsilon.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-10-27T08:49:42.743" Title="Trace distance bound after partial trace" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14349" PostTypeId="2" ParentId="14348" CreationDate="2020-10-27T08:49:42.743" Score="3" Body="&lt;p&gt;Yes, the trace distance can only decrease under partial trace. One can see this via the variational characterization of the trace norm&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\rho\|_1 = \max_{-I \leq M \leq I} \mathrm{Tr}[M\rho]&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is some hermitian operator satisfying the two operator inequalities &lt;span class=&quot;math-container&quot;&gt;$M \leq I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M \geq - I$&lt;/span&gt;. This is sometimes also known as the duality between conjugate norms as &lt;span class=&quot;math-container&quot;&gt;$\| M \|_{\infty} \leq 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now if we have a bipartite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; we find&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\|\rho_{A} - \sigma_A\| &amp;amp;= \max_{-I_A \leq M_A \leq I_A} \mathrm{Tr}[M_A(\rho_A - \sigma_A)] \\&#xA;&amp;amp;= \max_{-I_A \leq M_A \leq I_A} \mathrm{Tr}[(M_A \otimes I_B)(\rho_{AB} - \sigma_{AB})] \\&#xA;&amp;amp;\leq \max_{-I_{AB} \leq M_{AB} \leq I_{AB}} \mathrm{Tr}[M_{AB}(\rho_{AB} - \sigma_{AB})] \\&#xA;&amp;amp;= \| \rho_{AB} - \sigma_{AB} \|_{1}.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;The second line follows from the identity &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[\mathrm{Tr}_A[X_{AB}]] = \mathrm{Tr}[X_{AB}]$&lt;/span&gt; and the third line from the fact that &lt;span class=&quot;math-container&quot;&gt;$-I_{AB} \leq M_{A} \otimes I_B \leq I_{AB}$&lt;/span&gt; is satisfied for all &lt;span class=&quot;math-container&quot;&gt;$-I_A \leq M_A \leq I_A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Actually you can even prove a stronger result: the trace distance decreases under CPTP maps of which the partial trace is a special case.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-10-27T08:49:42.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14350" PostTypeId="1" CreationDate="2020-10-27T10:26:52.160" Score="4" ViewCount="154" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0005031.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;entangling power&amp;quot;&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I'm struggling to understand how to do this.&lt;/p&gt;&#xA;&lt;p&gt;I feel the approach should be somewhat similar to what one would need to do to solve this Exercise from Preskill's notes&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MQQgp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MQQgp.png&quot; alt=&quot;Preskill Exercise&quot; /&gt;&lt;/a&gt;&#xA;but the jump of sampling from one to two Bloch Spheres does not seem obvious or simple to me.&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://cds.cern.ch/record/449961/files/0008011.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, a sample over one Bloch Sphere is taken also.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas of how I should approach this?&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="10480" LastEditDate="2021-01-27T18:51:25.150" LastActivityDate="2021-01-27T18:51:25.150" Title="How to sample from the uniform distribution over the tensor product of two Bloch spheres?" Tags="&lt;entanglement&gt;&lt;bloch-sphere&gt;&lt;concurrence&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14351" PostTypeId="1" CreationDate="2020-10-27T10:29:52.087" Score="7" ViewCount="95" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1608.00263.pdf&quot; rel=&quot;noreferrer&quot;&gt;1&lt;/a&gt;,&lt;a href=&quot;https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=927073&quot; rel=&quot;noreferrer&quot;&gt;2&lt;/a&gt;,&lt;a href=&quot;https://drops.dagstuhl.de/opus/volltexte/2017/7527/pdf/LIPIcs-CCC-2017-22.pdf&quot; rel=&quot;noreferrer&quot;&gt;3&lt;/a&gt; for this). Paper 2 in that list says that the hardness result comes from a reduction to computing the permanent of a random matrix.&lt;/p&gt;&#xA;&lt;p&gt;Based on a quick search, computing an &lt;em&gt;approximation&lt;/em&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-10-28T14:50:32.393" Title="Could random quantum circuits be efficiently approximately simulated?" Tags="&lt;complexity-theory&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14352" PostTypeId="2" ParentId="12261" CreationDate="2020-10-27T11:04:33.523" Score="1" Body="&lt;p&gt;I have been doing some work on understanding the thermodynamics of quantum algorithms for my undergraduate thesis.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Where is the Heat coming from?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;A relationship between entanglement and thermodynamics was explored by Marcus Huber, Marti Perarnau-Llobet and others in &lt;a href=&quot;https://arxiv.org/pdf/1404.2169.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How do you measure the entanglement of a Quantum Algorithm?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;It is very difficult to determine the amount of entanglement in an algorithm (in fact here's a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8536/how-to-measure-entanglement-in-an-algorithm&quot;&gt;question&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;You can also take an algorithm independent approach to examining the thermodynamics like some lovely people from Google did &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.122.200601&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; by looking at Quantum Channels in a general sense.&lt;/p&gt;&#xA;&lt;p&gt;Whilst I know that wasn't a direct answer to your question, I hope it was still informative.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastActivityDate="2020-10-27T11:04:33.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14353" PostTypeId="1" CreationDate="2020-10-27T12:25:23.427" Score="4" ViewCount="55" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$T: M_n \to M_n$&lt;/span&gt; be a quantum channel. If I understand Definition 13.5.1 of the book &amp;quot;Quantum information theory&amp;quot; of Wilde, the coherent information &lt;span class=&quot;math-container&quot;&gt;$Q(T)=\max_{\phi_{AA'}} I(A \rangle B)_\rho$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Q(T)&#xA;=\sup_{\rho \textrm{ pure}} \Big\{H\big((\mathrm{tr} \otimes T)(\rho)\big)-H\big((\mathrm{Id} \otimes T)(\rho)\big)\Big\} &#xA;\end{equation}&lt;/span&gt;&#xA;where the supremum is taken over all bipartite &lt;em&gt;pure&lt;/em&gt; states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$M_n \otimes M_n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It is true that we can replace the supremum by a supemum on all states (not necessarily pure) ?&lt;/p&gt;&#xA;" OwnerUserId="13624" LastEditorUserId="55" LastEditDate="2020-10-28T09:14:17.617" LastActivityDate="2020-10-28T09:14:17.617" Title="Alternative definition of the coherent information of a quantum channel" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14354" PostTypeId="2" ParentId="14353" CreationDate="2020-10-27T17:18:37.997" Score="2" Body="&lt;p&gt;I follow Wilde's notation here. The coherent information of a channel &lt;span class=&quot;math-container&quot;&gt;$N:A' \rightarrow B$&lt;/span&gt; is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Q(N) \equiv \max_{\phi_{A A^{\prime}}} I(A\rangle B)_{\rho},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}=N_{A^{\prime} \rightarrow B}\left(\phi_{A A^{\prime}}\right)$&lt;/span&gt;. Notice that the channel only acts on the &lt;span class=&quot;math-container&quot;&gt;$A'$&lt;/span&gt; register. The &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; register is used to purify the input to the channel.&lt;/p&gt;&#xA;&lt;p&gt;So yes, you can consider mixed states on &lt;span class=&quot;math-container&quot;&gt;$\phi_{AA'}$&lt;/span&gt; but then you can just purify this to some &lt;span class=&quot;math-container&quot;&gt;$\phi_{RAA'}$&lt;/span&gt; and relabel the &lt;span class=&quot;math-container&quot;&gt;$RA$&lt;/span&gt; register as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, a side point but note that the coherent information is obtained by taking the maximum over all input pure states, not the supremum.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastActivityDate="2020-10-27T17:18:37.997" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14355" PostTypeId="1" CreationDate="2020-10-27T18:27:08.487" Score="5" ViewCount="102" Body="&lt;p&gt;I'm trying to do something similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/4907/qiskit-is-there-any-way-to-discard-the-results-of-a-measurement?rq=1&quot;&gt;this question&lt;/a&gt;, 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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Measure the 2 qubits.&lt;/li&gt;&#xA;&lt;li&gt;Perform a partial trace on those two qubits (so that my output vector only has &lt;span class=&quot;math-container&quot;&gt;$2^2$&lt;/span&gt; components instead of &lt;span class=&quot;math-container&quot;&gt;$2^4$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Call the statevector function to get the state on my other 2 qubits.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;My question is: Is there a way to collapse the wavefunction and then get the statevector out on &lt;em&gt;only&lt;/em&gt; the remaining qubits without having the system calculate the whole statevector beforehand?&lt;/p&gt;&#xA;&lt;p&gt;I don't know if this is a reasonable question, but I was wondering if it could be done.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastActivityDate="2021-05-09T18:03:45.347" Title="Can I partially collapse the wavefunction in Qiskit?" Tags="&lt;qiskit&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14356" PostTypeId="1" CreationDate="2020-10-27T20:21:27.947" Score="5" ViewCount="96" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cuHkW.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cuHkW.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;whatever it is&lt;/em&gt; and wouldn't need one of its inputs to be predetermined?&lt;/p&gt;&#xA;&lt;p&gt;Granted, the 'output' qubit is for output, but it's value still needs to be predetermined going into the operation?&lt;/p&gt;&#xA;&lt;p&gt;Image is from &lt;a href=&quot;https://medium.com/free-code-camp/almost-everything-you-ever-wanted-to-know-about-quantum-computers-5ee6bc2f40ba#978c&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog&lt;/a&gt; but I've seen it come up in &lt;a href=&quot;https://medium.com/dataseries/quantum-computings-internals-demystified-53326d6c3098#1375&quot; rel=&quot;nofollow noreferrer&quot;&gt;other blogs&lt;/a&gt; and &lt;a href=&quot;https://youtu.be/F_Riqjdh2oM?t=2581&quot; rel=&quot;nofollow noreferrer&quot;&gt;videos&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13628" LastEditorUserId="55" LastEditDate="2020-11-03T16:47:46.500" LastActivityDate="2021-04-02T17:04:25.500" Title="Why do the constant operations in a quantum computer need second qubits?" Tags="&lt;circuit-construction&gt;&lt;quantum-operation&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14357" PostTypeId="1" CreationDate="2020-10-27T23:51:05.503" Score="7" ViewCount="200" Body="&lt;p&gt;Shor's algorithm (for factoring integers) and Grover's algorithm (for searches) are the two most well-known quantum algorithms. &lt;strong&gt;I was wondering if there was a similar result in QC that dealt with the Graph Isomorphism problem?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can't seem to find a consensus online. I've found two references:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1304.5773&quot; rel=&quot;noreferrer&quot;&gt;This paper&lt;/a&gt; published in the &lt;em&gt;Physical Review&lt;/em&gt; 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1901.06530&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13618" LastEditorUserId="55" LastEditDate="2020-11-03T16:50:28.377" LastActivityDate="2021-02-10T02:14:36.377" Title="What is known about quantum algorithms for graph isomorphism?" Tags="&lt;algorithm&gt;&lt;adiabatic-model&gt;&lt;graph-isomorphism&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14358" PostTypeId="1" AcceptedAnswerId="14368" CreationDate="2020-10-28T00:01:04.970" Score="2" ViewCount="151" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$A\in L(X,Y)$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$||\cdot||$&lt;/span&gt; denotes spectral norm and denotes the largest singular value of a matrix, i.e. the largest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{A^*A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$||\cdot||_{tr}$&lt;/span&gt; denotes trace norm. We have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$||A||_{tr}=tr\sqrt{A^*A}$$&lt;/span&gt;&#xA;So I would like to prove the statement that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$||A||_{tr}=\max\{|tr(A^*B)|: B\in L(X,Y), ||B||=1 \}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I know that from Nielsen and Chuang lemma 9.5 that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|tr(AU)|\le tr |A|$$&lt;/span&gt; and equality is achieved by a unitary.&lt;/p&gt;&#xA;&lt;p&gt;We have by definition that &lt;span class=&quot;math-container&quot;&gt;$|A|=\sqrt{A^*A}$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$||A||_{tr}=tr|A|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I think my question is if &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is not a unitary but has norm 1, can we have that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|tr(AB)|&amp;gt; tr |A|\ge |tr(AU)|$$&lt;/span&gt; for any unitary? And if yes, why the maximum is still achieved by a unitary?&lt;/p&gt;&#xA;" OwnerUserId="13616" LastEditorUserId="55" LastEditDate="2020-11-03T17:10:50.700" LastActivityDate="2020-11-03T17:10:50.700" Title="Prove that the trace norm is dual to the spectral norm" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14359" PostTypeId="1" CreationDate="2020-10-28T02:50:11.087" Score="2" ViewCount="49" Body="&lt;h2&gt;&lt;em&gt;does Shannon meet Feynman?&lt;/em&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Bits underlie &lt;strong&gt;classical information&lt;/strong&gt; measurements in information theory, while qubits underlie &lt;strong&gt;quantum information&lt;/strong&gt; measurements in, what I can only assume to be called, quantum information theory.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Information theory&lt;/strong&gt; is a field attributed to Claude Shannon, who calculates bits as &lt;em&gt;logarithmic probabilities&lt;/em&gt;, which are what I mean here by &lt;strong&gt;Shannon information.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are Shannon information and what everyone here is calling &amp;quot;classical information&amp;quot; the same?&lt;/li&gt;&#xA;&lt;li&gt;What is the analogue of Shannon's information theory for quantum information? I have more often heard the term &lt;em&gt;&amp;quot;quantum theory of information&amp;quot;&lt;/em&gt;, but not sure if this exactly corresponds to what I have in mind as to what &lt;em&gt;&amp;quot;quantum information theory&amp;quot;&lt;/em&gt; would mean in the Shannon sense.&lt;/li&gt;&#xA;&lt;li&gt;How does quantum information relate to, diverge from or reduce to Shannon information, which used log probabilities?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="55" LastEditDate="2020-11-03T17:11:34.130" LastActivityDate="2020-11-03T17:11:34.130" Title="Is &quot;classical information&quot; the same as &quot;Shannon information&quot;?" Tags="&lt;entropy&gt;&lt;information-theory&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14360" PostTypeId="1" AcceptedAnswerId="14370" CreationDate="2020-10-28T03:10:28.367" Score="2" ViewCount="61" Body="&lt;p&gt;1980s. John Wheeler at the University of Texas would tell his students, “Give an &lt;strong&gt;information theoretic&lt;/strong&gt; derivation of quantum theory!” Information theoretic is an adjective for Claude Shannon's &lt;strong&gt;information theory&lt;/strong&gt;, which used log probabilities to represent bits.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;unnaturally&lt;/em&gt; linked to &amp;quot;quantum theory of information&amp;quot;? In other words, is the connection between them man-made (superficial) and quantitatively &lt;em&gt;contrived&lt;/em&gt;? or are classical and quantum information &lt;em&gt;naturally&lt;/em&gt; bonded?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="55" LastEditDate="2020-10-28T09:21:27.820" LastActivityDate="2020-10-28T15:41:08.307" Title="Wheeler's &quot;information theoretic&quot; derivation of quantum information" Tags="&lt;resource-request&gt;&lt;information-theory&gt;&lt;history&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14361" PostTypeId="1" AcceptedAnswerId="14365" CreationDate="2020-10-28T04:07:36.207" Score="2" ViewCount="62" Body="&lt;p&gt;The &lt;strong&gt;quantum max-relative entropy&lt;/strong&gt; between two states is &lt;a href=&quot;https://arxiv.org/pdf/0803.2770.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;defined&lt;/a&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho\leq \sigma$&lt;/span&gt; should be read as &lt;span class=&quot;math-container&quot;&gt;$\sigma - \rho$&lt;/span&gt; is positive semidefinite. In other words, &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; is the logarithm of the smallest positive real number that satisfies &lt;span class=&quot;math-container&quot;&gt;$\rho\leq\lambda\sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In classical information theory, the &lt;strong&gt;maximum entropy principle&lt;/strong&gt; designates the Normal distribution as being the best choice distribution amongst other candidates because it maximizes Shannon entropy,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H(X) = -\int_{-\infty}^{\infty} f(x) \ln f(x) \enspace dx$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is a probability distribution of random variable &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastActivityDate="2020-10-29T12:38:53.900" Title="Relating quantum max-relative entropy to classical maximum entropy" Tags="&lt;entropy&gt;&lt;information-theory&gt;&lt;classical-quantum&gt;&lt;max-entropy&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14362" PostTypeId="1" CreationDate="2020-10-28T07:20:02.023" Score="2" ViewCount="58" Body="&lt;p&gt;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: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14280/how-can-i-obtain-transformation-matrix-of-a-quantum-circuit-in-the-qiskit&quot;&gt;How can I obtain transformation matrix of a quantum circuit in the Qiskit?&lt;/a&gt;) and now I want to do this work as a parametric. For example, I want to define gate T as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; w&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$w=\frac{(1+i)}{\sqrt{2}}$&lt;/span&gt;, and I want to obtain the transformation matrix of the circuit with parameter &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; and not as numeric. How can I do this?&lt;/p&gt;&#xA;" OwnerUserId="5217" LastEditorUserId="55" LastEditDate="2020-10-28T09:28:27.927" LastActivityDate="2020-10-28T09:28:27.927" Title="How can I obtain a unitary matrix of quantum circuit with angles as parametric?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14363" PostTypeId="2" ParentId="14362" CreationDate="2020-10-28T07:43:13.217" Score="1" Body="&lt;p&gt;As of Qiskit 0.23.0 that's not yet supported.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Operator.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;quantum_info.Operator&lt;/code&gt;&lt;/a&gt; that uses straightforward NumPy multiplications and could probably be generalized easily.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-10-28T07:43:13.217" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14364" PostTypeId="2" ParentId="14359" CreationDate="2020-10-28T08:24:56.663" Score="2" Body="&lt;p&gt;I don't think there is a canonical &amp;quot;right&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;The term &amp;quot;bit&amp;quot; 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 &amp;quot;if I had to write down this information, how many bits would I need to store the data&amp;quot;. 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 &amp;quot;surprise&amp;quot; of getting a particular outcome, whether that's tossing a coin, rolling a die, or measuring a qubit.)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Are Shannon information and what everyone here is calling &amp;quot;classical information&amp;quot; the same&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If they're talking about a specific calculation of the information, then yes. &amp;quot;classical information&amp;quot; might instead be referring to the broader theory. It depends on context.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How does quantum information relate to, diverge from or reduce to Shannon information, which used log probabilities?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &amp;quot;0&amp;quot; and &amp;quot;1&amp;quot; of a bit), there's a continuous range of possibilities, which change the actual calculations a bit.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What is the analogue of Shannon's information theory for quantum information? I have more often heard the term &amp;quot;quantum theory of information&amp;quot;, but not sure if this exactly corresponds to what I have in mind as to what &amp;quot;quantum information theory&amp;quot; would mean in the Shannon sense.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The term &amp;quot;quantum information theory&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-28T08:24:56.663" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14365" PostTypeId="2" ParentId="14361" CreationDate="2020-10-28T09:36:49.587" Score="3" Body="&lt;p&gt;As far as I'm aware there isn't much of a meaningful connection. The corresponding entropy for &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; is the min-entropy (written &lt;span class=&quot;math-container&quot;&gt;$H_{\min}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$H_{\infty}$&lt;/span&gt;). 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 &lt;span class=&quot;math-container&quot;&gt;$D_{\infty}$&lt;/span&gt; for &lt;a href=&quot;https://arxiv.org/pdf/1206.2459.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;continuous variables&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/R%C3%A9nyi_entropy#R%C3%A9nyi_divergence&quot; rel=&quot;nofollow noreferrer&quot;&gt;discrete&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reply to comment&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Relative entropies (also called divergences) are not entropies like the standard Shannon entropy. Notice that they take in two arguments &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. The Kullback-leibler divergence is defined (for discrete distributions) as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D(p\| q) = \sum_x p(x) \log\frac{p(x)}{q(x)}.&#xA;$$&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;D(p\| U) &amp;amp;= \sum_x p(x) \log |X| p(x) \\&#xA;&amp;amp;= \sum_x p(x) (\log p(x) + \log|X|) \\&#xA;&amp;amp;= -H(X) +log|X|.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Rearranging we get &lt;span class=&quot;math-container&quot;&gt;$H(X) = \log|X| - D(p\| U)$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$D_{\max}$&lt;/span&gt; (quantum or classical) to define a min-entropy &lt;span class=&quot;math-container&quot;&gt;$H_{\min}$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&lt;p&gt;You can think of a divergence as measuring a distance between its two arguments (Note it is &lt;strong&gt;not&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H_{\min}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H_{\min}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H_{\min}$&lt;/span&gt; returns the smallest uncertainty for the adversary. For security it's best to overestimate the knowledge of an eavesdropper.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-10-29T12:38:53.900" LastActivityDate="2020-10-29T12:38:53.900" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14366" PostTypeId="2" ParentId="14358" CreationDate="2020-10-28T10:14:24.377" Score="3" Body="&lt;p&gt;We still have &lt;span class=&quot;math-container&quot;&gt;$ \big| \langle B, A \rangle \big| = \big|\text{Tr}(AB^{\dagger}) \big| \leq \text{Tr}|A| $&lt;/span&gt; for any operator &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; with operator norm &lt;span class=&quot;math-container&quot;&gt;$ ||B|| \leq 1 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;First observe that &lt;span class=&quot;math-container&quot;&gt;$ ||B|| \leq 1 $&lt;/span&gt; implies that  for any positive semi-definite operator &lt;span class=&quot;math-container&quot;&gt;$ Q = \sum_i \lambda_i |\psi_i \rangle\langle \psi_i|  \in L(X, X) $&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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  =&#xA;\sum_i \lambda_i \text{Tr} \big( B|\psi_i \rangle \langle \psi_i|B^{\dagger} \big) =&#xA;\text{Tr}(B Q B^{\dagger}) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now a similar proof to Nielsen and Chuang lemma 9.5 is possible:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Tr}(AB^{\dagger}) =  \text{Tr}(V|A|B^{\dagger}) = &#xA;\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 &#xA;\sqrt{\text{Tr}|A| \cdot  \text{Tr}|A|} = \text{Tr}|A|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we wrote &lt;span class=&quot;math-container&quot;&gt;$ A = V |A| $&lt;/span&gt; for an isometry &lt;span class=&quot;math-container&quot;&gt;$ V \in L(X, Y) $&lt;/span&gt; based on the SVD decomposition, the first inequality is the Cauchy–Schwarz and the second is our previous 'observation' with &lt;span class=&quot;math-container&quot;&gt;$ Q = |A| $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Together with equality for &lt;span class=&quot;math-container&quot;&gt;$ B = V $&lt;/span&gt; we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ max\{ \big| \langle B, A \rangle \big|, B\in L(X,Y), ||B|| \leq 1\} =  \text{Tr}|A| $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-10-28T11:18:30.643" LastActivityDate="2020-10-28T11:18:30.643" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14367" PostTypeId="1" CreationDate="2020-10-28T13:40:13.633" Score="2" ViewCount="67" Body="&lt;p&gt;In QAOA, for the MaxCut problem, one tries to find a good ratio, as close to 1 as possible, of &lt;span class=&quot;math-container&quot;&gt;$\epsilon = \frac{C_{approx}}{C_{opt}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$C_{approx}$&lt;/span&gt; is the approximate value of the cost function for some configuration of spins and &lt;span class=&quot;math-container&quot;&gt;$C_{opt}$&lt;/span&gt; is the optimum cost value for the given graph. I want to calculate &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; for some random instances of the MaxCut problem (with small number of vertices) and test how good the algorithm behaves.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="12408" LastActivityDate="2020-11-03T07:27:12.233" Title="Optimum Solution calculation for QAOA" Tags="&lt;algorithm&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14368" PostTypeId="2" ParentId="14358" CreationDate="2020-10-28T13:54:45.560" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Once you have this, the inequality you are trying to prove follows pretty easily. In particular, consider a singular value decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_k s_k |\psi_k\rangle \langle \phi_k|.&#xA;$$&lt;/span&gt;&#xA;For any choice of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; we have, by the triangle inequality and a simple property of the spectral norm, that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\operatorname{Tr}(A^{\ast} B)|&#xA;= \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|&#xA;\leq \sum_k s_k \|B\| = \| A \|_{\text{tr}} \| B \|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-10-28T13:54:45.560" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14369" PostTypeId="2" ParentId="14351" CreationDate="2020-10-28T14:24:24.500" Score="2" Body="&lt;p&gt;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 &lt;strong&gt;BosonSampling&lt;/strong&gt; hinges on the assumption that there is no &lt;span class=&quot;math-container&quot;&gt;$\text{BPP}^{\text{NP}}$&lt;/span&gt; (this is BPP relative to an NP oracle) algorithm for &lt;em&gt;estimating&lt;/em&gt; the permanent of an &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with entries from an &lt;span class=&quot;math-container&quot;&gt;$N(0,1)$&lt;/span&gt; Gaussian distribution. Now, I am not an complexity theorist so I don't know how &lt;span class=&quot;math-container&quot;&gt;$\text{BPP}^{\text{NP}}$&lt;/span&gt; relates to &lt;span class=&quot;math-container&quot;&gt;$\#\text{P}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\text{NP}$&lt;/span&gt; but anyways onto computing permanents.&lt;/p&gt;&#xA;&lt;p&gt;So it turns out that if your matrix has arbitrary number of negative entries then it is even &lt;span class=&quot;math-container&quot;&gt;$\#\text{P}$&lt;/span&gt; hard just to determined the sign of the permanent and this fact rules out multiplicative approximations. This is all according to  &lt;a href=&quot;https://arxiv.org/pdf/1711.09457.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1711.09457.pdf&lt;/a&gt; in which they state that approximating the permanent is worst case &lt;span class=&quot;math-container&quot;&gt;$\#\text{P}$&lt;/span&gt; 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 &lt;em&gt;quasipolynomial&lt;/em&gt; time algorithm for approximating the permanent for many types of matrices (including &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;). This result, as they remark goes against the belief that it is still &lt;span class=&quot;math-container&quot;&gt;$\#\text{P}$&lt;/span&gt; hard to approximate the permanent of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the average case. In section 1.6.1 they discuss their result in the context of the &lt;strong&gt;BosonSampling&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;It also appears that this quasipolynomial time algorithm for approximating permanents of matrices with entries distributed Gaussian &lt;span class=&quot;math-container&quot;&gt;$N(0,1)$&lt;/span&gt; has been simplified/improved in &lt;a href=&quot;https://arxiv.org/pdf/1911.11962.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1911.11962.pdf&lt;/a&gt;. The authors of this work also show that if their algorithm can be improved from working on matrices with mean at least &lt;span class=&quot;math-container&quot;&gt;$1/poly(log(n))$&lt;/span&gt; to mean at least &lt;span class=&quot;math-container&quot;&gt;$1/poly(n)$&lt;/span&gt; then this would disprove the hardness conjecture needed for quantum supremacy.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-10-28T14:50:32.393" LastActivityDate="2020-10-28T14:50:32.393" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14370" PostTypeId="2" ParentId="14360" CreationDate="2020-10-28T15:33:01.627" Score="2" Body="&lt;p&gt;There is a natural and direct link between information theory and quantum theory in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncertainty_principle#Quantum_entropic_uncertainty_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Entropic Uncertainty Principle&lt;/a&gt;.  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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Many-worlds_interpretation&quot; rel=&quot;nofollow noreferrer&quot;&gt;MWI&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://space.mit.edu/home/tegmark/everett/everett18_austin.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;a seminar&lt;/a&gt;.  In 1985 Deutsch published his landmark paper &lt;a href=&quot;https://royalsocietypublishing.org/doi/abs/10.1098/rspa.1985.0070&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum theory, the Church-Turing principle and the universal quantum computer&lt;/a&gt;.  This paper introduced the quantum circuit model that we still use today, and it relies heavily on Everett's formulation of quantum mechanics (MWI).&lt;/p&gt;&#xA;&lt;p&gt;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.  &lt;a href=&quot;https://www.nobelprize.org/prizes/physics/1965/feynman/lecture/&quot; rel=&quot;nofollow noreferrer&quot;&gt;According to Feynman&lt;/a&gt;&lt;span class=&quot;math-container&quot;&gt;${}^\dagger$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${}^\dagger$&lt;/span&gt; If you don't want to read the whole Nobel Lecture, search &amp;quot;Because, they are all the same electron!&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-10-28T15:41:08.307" LastActivityDate="2020-10-28T15:41:08.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14371" PostTypeId="1" CreationDate="2020-10-28T16:03:03.463" Score="0" ViewCount="41" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/g2HxL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g2HxL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;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 &amp;quot;This account has no backends assigned&amp;quot;. This is a rather new problem, as I was able to access backends before but now I am unable to run my circuits anymore.&lt;/p&gt;&#xA;" OwnerUserId="13637" LastEditorUserId="55" LastEditDate="2020-11-03T17:13:27.527" LastActivityDate="2021-04-02T19:05:25.527" Title="No backends assigned to my Account" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14372" PostTypeId="2" ParentId="14371" CreationDate="2020-10-28T16:58:16.213" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AsVtP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AsVtP.png&quot; alt=&quot;This my quantum experience screen.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is my quantum experience screen for past hour. No matter which circuit I open, I get the same error and &amp;quot;Loading&amp;quot; where Run settings and backends should be.&lt;/p&gt;&#xA;" OwnerUserId="13639" LastActivityDate="2020-10-28T16:58:16.213" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14373" PostTypeId="2" ParentId="14335" CreationDate="2020-10-28T17:10:05.820" Score="2" Body="&lt;p&gt;In the surface code there are two major costs to T gates: the spacetime cost and the reaction time cost.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1812.01238&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1812.01238&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1905.06903&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1905.06903&lt;/a&gt;. For scale:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z4bxp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z4bxp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1210.4626&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1210.4626&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1905.08916&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1905.08916&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h00hg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h00hg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-10-28T17:15:52.500" LastActivityDate="2020-10-28T17:15:52.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14375" PostTypeId="1" AcceptedAnswerId="14377" CreationDate="2020-10-28T21:12:31.643" Score="2" ViewCount="99" Body="&lt;p&gt;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 &amp;quot;noisy&amp;quot; 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?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="55" LastEditDate="2020-11-03T17:20:07.947" LastActivityDate="2020-11-03T17:20:07.947" Title="How to intentionally add noise to a Qiskit circuit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;noise&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14377" PostTypeId="2" ParentId="14375" CreationDate="2020-10-28T21:58:00.463" Score="1" Body="&lt;p&gt;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 &lt;code&gt;optimization_level=0&lt;/code&gt; kwarg for &lt;code&gt;transpile()&lt;/code&gt; and &lt;code&gt;execute()&lt;/code&gt;. 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 &lt;code&gt;execute()&lt;/code&gt; it would be: &lt;code&gt;qiskit.execute(circuit, backend, optimization_level=0)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to experiment with the transpiler you can just call &lt;code&gt;qiskit.transpile(circuit, backend)&lt;/code&gt; 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 &lt;code&gt;execute()&lt;/code&gt; prior to sending a job to the backend so you can see what transforms are happening and tune things for your use case.&lt;/p&gt;&#xA;&lt;p&gt;The documentation on transpiler covers how the transpiler works pretty well: &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/transpiler.html&lt;/a&gt; and the tutorial &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html&lt;/a&gt; has examples on how you can work with it.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-10-28T21:58:00.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14378" PostTypeId="2" ParentId="5311" CreationDate="2020-10-28T22:09:40.767" Score="2" Body="&lt;p&gt;This is an interesting question. I was looking into optimize the number of samples needed in VQE as well.&lt;/p&gt;&#xA;&lt;p&gt;We know that that the number of samples in VQE to get accuracy error of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; scales as &lt;span class=&quot;math-container&quot;&gt;$O(1/\epsilon^2)$&lt;/span&gt;. To be more precise, if&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \sum_{i=1}^N h_i P_i $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; represent the pauli string then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle H \rangle = \sum_{i=1}^N h_i \langle P_i \rangle $$&lt;/span&gt;&#xA;by linearity and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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 $$&lt;/span&gt;&#xA;So the error of &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle$&lt;/span&gt; after taking &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; samples is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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 \} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;After looking around, I found this paper:  &lt;strong&gt;&lt;a href=&quot;https://arxiv.org/abs/1802.00171&quot; rel=&quot;nofollow noreferrer&quot;&gt;Accelerated Variational Quantum Eigensolver&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It claims to have up-to-exponential reduction on the number of samples required.&lt;/p&gt;&#xA;&lt;p&gt;Maybe you already know about this but I thought to put this here anyway.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-28T22:09:40.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14379" PostTypeId="2" ParentId="14375" CreationDate="2020-10-28T22:21:33.330" Score="1" Body="&lt;p&gt;I am assuming you are probably trying to do error mitigation using extrapolation technique giving in this paper: &lt;a href=&quot;https://arxiv.org/abs/1801.03897&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1801.03897&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The other answer is great and perfectly fine.&lt;/p&gt;&#xA;&lt;p&gt;I just want to add that, you could also use &lt;strong&gt;circuit barrier&lt;/strong&gt; as a way to tell Qiskit not to optimize the consecutive CNOT gates.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/V02Dx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V02Dx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-28T22:21:33.330" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14380" PostTypeId="1" CreationDate="2020-10-28T23:19:54.723" Score="2" ViewCount="78" Body="&lt;p&gt;When running the attached Bernstein-Vazirani gate on IBM Q, with 1024 shots on ibmq_16_melbourne, I receive the expected result of &amp;quot;00110&amp;quot; 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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IsPi5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IsPi5.png&quot; alt=&quot;Bernstein-Vazirani&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lY3p6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lY3p6.png&quot; alt=&quot;Results&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13642" LastEditorUserId="55" LastEditDate="2020-11-03T17:20:02.757" LastActivityDate="2020-11-03T17:20:02.757" Title="Bernstein-Vazirani Gate IBM Q Noise" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;noise&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14381" PostTypeId="2" ParentId="14380" CreationDate="2020-10-29T00:11:06.513" Score="2" Body="&lt;p&gt;How many shots were you using? and on which device?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;It is important to note that not all devices are the same. Some are more noisy than other.&lt;/p&gt;&#xA;&lt;p&gt;One way to improve your result is through &lt;strong&gt;error mitigations&lt;/strong&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; eigenstates and measure them to create a calibration matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. In your case, it would be &lt;span class=&quot;math-container&quot;&gt;$2^5 = 32$&lt;/span&gt; additional circuits to do this. Look here at this document for more detail and how to do it within Qiskit setting: &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the code to do this for your circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ , BasicAer, Aer, QuantumCircuit,  ClassicalRegister, QuantumRegister, execute&#xA;from qiskit.compiler import transpile&#xA;from qiskit.transpiler import PassManager&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.ignis.mitigation.measurement import complete_meas_cal, CompleteMeasFitter, MeasurementFilter&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_16_melbourne') &#xA;&#xA;&#xA;quantum_instance = QuantumInstance(backend, shots = 8192,&#xA;                                   pass_manager = None, initial_layout = None, optimization_level = 3,&#xA;                                   measurement_error_mitigation_cls = CompleteMeasFitter, cals_matrix_refresh_period = 0)&#xA;&#xA;qc = QuantumCircuit(6,6)&#xA;qc.x(5)&#xA;qc.barrier(range(6))&#xA;for i in range(6):&#xA;    qc.h(i)&#xA;qc.barrier(range(6))&#xA;qc.cx(2,5)&#xA;qc.cx(1,5)&#xA;qc.barrier(range(6))&#xA;for i in range(6):&#xA;    qc.h(i)&#xA;qc.measure([0,1,2,3,4],[0,1,2,3,4])&#xA;qc.draw('mpl', plot_barriers=False ) &#xA;Result = quantum_instance.execute(qc)&#xA;counts = Result.get_counts(qc)&#xA;print('This is the counts result of the simulation:' ,counts)&#xA;plot_histogram(counts) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope this help.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-10-29T00:38:49.987" LastActivityDate="2020-10-29T00:38:49.987" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14382" PostTypeId="1" AcceptedAnswerId="14384" CreationDate="2020-10-29T00:16:22.110" Score="1" ViewCount="99" Body="&lt;p&gt;I have this state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p |\text{GHZ}\rangle \langle \text{GHZ}| + (1-p)\rho$$&lt;/span&gt;&#xA;And after creating this state I have this code lines:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;state = p * GHZ+(1-p)* rho&#xA;state = p * GHZ + (1 - p) * rho&#xA;print(f&amp;quot;final state: \n {state}&amp;quot;)&#xA;print(cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now I want to measure this state. I know we have &lt;code&gt;cirq.measure&lt;/code&gt; 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??)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cirq.measure(a, b, c)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have 3 questions&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I want to choose x and Y randomly and I want to do measurement&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Which kind of measurement is used by Cirq.measure() and (cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))&lt;/p&gt;&#xA;&lt;p&gt;cirq.measure(a, b, c)&#xA;(cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Best and thanks&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2020-11-03T17:13:48.987" LastActivityDate="2020-11-03T17:13:48.987" Title="Cirq-Measuring a State with Rotation Matrix" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14383" PostTypeId="1" CreationDate="2020-10-29T00:56:26.600" Score="2" ViewCount="42" Body="&lt;p&gt;Below is a question and an answer.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How does quantum information relate to, diverge from or reduce to&#xA;Shannon information, which used log probabilities?&lt;/p&gt;&#xA;&lt;p&gt;What people are more often interested in are averaged quantities such&#xA;as entropies, conditional entropies and mutual information. These have&#xA;direct quantum analogues, calculated based on density matrices of&#xA;qubits rather than classical probability distributions. The density&#xA;matrix still represents a probability distribution but, rather than&#xA;using a single fixed basis (i.e. the &amp;quot;0&amp;quot; and &amp;quot;1&amp;quot; of a bit), there's a&#xA;continuous range of possibilities, which change the actual&#xA;calculations a bit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Information theoretic measures are all based on log probabilities. What do log probabilities in classical information theory become in quantum information theory?&lt;/p&gt;&#xA;&lt;p&gt;What are the quantum analogues of entropy, conditional entropy and mutual information? their formulas, and how are they computed from &lt;strong&gt;density matrices of qubits&lt;/strong&gt; (rather than probability distributions)?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastActivityDate="2020-10-29T00:56:26.600" Title="Quantum analogues of information theoretic measures: are log probabilities replaced with the density matrix?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;entropy&gt;&lt;information-theory&gt;&lt;classical-quantum&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14384" PostTypeId="2" ParentId="14382" CreationDate="2020-10-29T01:23:21.187" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;cirq.rx&lt;/code&gt; &lt;code&gt;ry&lt;/code&gt;, &lt;code&gt;rz&lt;/code&gt; exist for rotation around X, Y and Z axes on the Bloch sphere&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you have to measure in non-computational bases, you will have to do the rotations yourself. In my answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14288/bit-flip-seperable-state-and-several-question-about-cirq&quot;&gt;previous your question&lt;/a&gt; I wrote two versions: one with density matrices the other one with &lt;code&gt;cirq.Circuit&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;In case of the circuit model you can use &lt;code&gt;circuit.append(cirq.rx(np.pi/3)(a))&lt;/code&gt; for example before the measurement, where &lt;code&gt;a&lt;/code&gt; is the first qubit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;in case of the density matrix you'll have to calculate the tensored unitaries with &lt;code&gt;cirq.kron&lt;/code&gt; and &lt;code&gt;cirq.unitary&lt;/code&gt; and then multiply the density as usual: &lt;code&gt;unitary @ density_matrix @ unitary.conj().T&lt;/code&gt;. For example:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;pre&gt;&lt;code&gt;  # this is rx(pi/3) ⊗ I ⊗ I - the first qubit gets rotated, the other&#xA;  # two remains the same&#xA;  u = cirq.kron(cirq.unitary(cirq.rx(np.pi/3)), np.eye(2), np.eye(2))&#xA;  # this applies the unitary evolution on the state density matrix &#xA;  rotated_state = u @ state @ u.conj().T&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;code&gt;cirq.measure&lt;/code&gt; measures in the computational basis. &lt;code&gt;cirq.sample_density_matrix&lt;/code&gt; samples in the computational basis repeatedly see &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.sample_density_matrix.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference docs&lt;/a&gt; - it simulates &amp;quot;preparing the state and measuring it&amp;quot; multiple times. If you want the state after the measurement then probably &lt;code&gt;cirq.measure_density_matrix&lt;/code&gt; is better suited.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4986" LastEditorUserId="4986" LastEditDate="2020-10-29T04:11:23.777" LastActivityDate="2020-10-29T04:11:23.777" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="14385" PostTypeId="1" AcceptedAnswerId="14390" CreationDate="2020-10-29T03:29:29.513" Score="4" ViewCount="112" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_{a,b}=\sum^{d-1}_{x=0}\omega^{bx}|x+a\rangle\langle x|$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$\omega=e^{\frac{2\pi i}{d}}$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$a,b\in\{0,1,2,...,d-1\}$&lt;/span&gt;&#xA;Can someone please give me the pic of the quantum circuit?&lt;/p&gt;&#xA;" OwnerUserId="13644" LastEditorUserId="55" LastEditDate="2020-11-03T17:16:52.810" LastActivityDate="2020-11-03T17:16:52.810" Title="How to perform this $d$-dimensional unitary operation on IBM Q?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14387" PostTypeId="2" ParentId="14345" CreationDate="2020-10-29T11:57:22.233" Score="-1" Body="&lt;p&gt;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.&#xA;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-10-29T11:57:22.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14388" PostTypeId="2" ParentId="9895" CreationDate="2020-10-29T12:09:32.617" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m2Roh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m2Roh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-10-29T12:09:32.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14389" PostTypeId="1" CreationDate="2020-10-29T13:07:28.440" Score="0" ViewCount="26" Body="&lt;p&gt;While studying quantum walk on graphs, I am able to find how d-regular graphs state can be constructed in quantum domain. But not able to find anything on non-regular graph. For ex-: how this graph quantum state can be represented:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Zn3o6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zn3o6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13517" LastActivityDate="2020-10-29T13:07:28.440" Title="Quantum State for Non-Regular Graphs" Tags="&lt;quantum-state&gt;&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14390" PostTypeId="2" ParentId="14385" CreationDate="2020-10-29T14:39:42.700" Score="3" Body="&lt;p&gt;Since we are talking about a unitary operation on qubits, i assume &lt;span class=&quot;math-container&quot;&gt;$ d = 2^n $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$ n $&lt;/span&gt; is the number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;We define the unitary operations&#xA;&lt;span class=&quot;math-container&quot;&gt;$ V_{a} = \sum_{x=0}^{d - 1} | x + a \rangle \langle x| $&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$ D_{b} = \sum_{x=0}^{d - 1} \omega_d^{bx} | x \rangle \langle x| $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notice that we can write &lt;span class=&quot;math-container&quot;&gt;$ U_{a, b} = V_a \cdot D_b $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the Fourier basis (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Fourier_transform&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;)&#xA;we have &lt;span class=&quot;math-container&quot;&gt;$ QFT^{\dagger} \cdot V_a \cdot QFT = D_{-a} $&lt;/span&gt; since for a basis state &lt;span class=&quot;math-container&quot;&gt;$ |x \rangle $&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;V_a \cdot QFT \cdot |x \rangle &amp;amp;= V_a \cdot \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k \rangle \\&#xA;&amp;amp; = \frac{1}{\sqrt{d}}  \sum_{k=0}^{d-1} \omega_d^{kx} |k + a\rangle \\&#xA;&amp;amp; = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{(k - a)x} |k \rangle \\  &#xA;&amp;amp; = \omega_d^{-ax} QFT \cdot |x \rangle&#xA;\end{align*}&lt;/span&gt;&#xA;and so &lt;span class=&quot;math-container&quot;&gt;$QFT^{\dagger} \cdot V_a \cdot QFT \cdot |x \rangle = D_{-a} \cdot |x \rangle $&lt;/span&gt; which proves the previous identity.&lt;/p&gt;&#xA;&lt;p&gt;We conclude that is enough to implement &lt;span class=&quot;math-container&quot;&gt;$ D_b $&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$ U_{a, b} = QFT \cdot D_{-a} \cdot QFT^{\dagger} \cdot D_b $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But since &lt;span class=&quot;math-container&quot;&gt;$ \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} $&lt;/span&gt;,  it holds that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ D_b |x \rangle = &#xA;\omega_d^{b x} |x \rangle = &#xA;\Big( \prod_{k=0}^{n-1} \omega_d^{b 2^k x_k} \Big)  |x_{n-1} .. x_1 \rangle = &#xA;\otimes_{k=0}^{n-1} \Big( \omega_d^{b 2^k x_k} |x_k \rangle \Big) =&#xA;\otimes_{k=0}^{n-1} P_k |x_k \rangle &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ P_k $&lt;/span&gt; are the single qubit phase gates&#xA;&lt;span class=&quot;math-container&quot;&gt;$P_k = &#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\frac{2 \pi b \cdot 2^k}{d}}&#xA;\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to implement this in Qiskit, see&#xA;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.QFT.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QFT&lt;/a&gt;&#xA;and&#xA;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.PhaseGate.html#qiskit.circuit.library.PhaseGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phase Gate&lt;/a&gt;&#xA;and be careful with Qiskit convention that &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is the least significant qubit.&lt;/p&gt;&#xA;&lt;p&gt;Here is the circuit for &lt;span class=&quot;math-container&quot;&gt;$ n = 3, a, b = 1 $&lt;/span&gt; made in IBM Q:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cPDES.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cPDES.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;For different values of &lt;span class=&quot;math-container&quot;&gt;$a, b$&lt;/span&gt; just multiply then angles of &lt;span class=&quot;math-container&quot;&gt;$ U1 $&lt;/span&gt; gates in &lt;span class=&quot;math-container&quot;&gt;$ D_{-a}, D_b $&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$a, b$&lt;/span&gt; accordingly.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-10-29T17:50:24.173" LastActivityDate="2020-10-29T17:50:24.173" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14391" PostTypeId="1" AcceptedAnswerId="14407" CreationDate="2020-10-29T15:41:19.360" Score="5" ViewCount="112" Body="&lt;p&gt;This question is perhaps philosophical but it's been confusing me. Suppose Alice is teleporting some qubit state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$1/2 (|0\rangle\langle0| + |1\rangle\langle1|)$&lt;/span&gt;. After she transmits her measurement outcome to Bob, however, it seems like Bob's state changes to some pure state, e.g. &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; if Alice happened to measure &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;. It's not important what exactly the state is, just that it seems to have changed from a mixed state to a pure state.&lt;/p&gt;&#xA;&lt;p&gt;This seems to favor the thought that quantum states are not &amp;quot;really real&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="9168" LastEditorUserId="9118" LastEditDate="2020-10-30T20:21:23.000" LastActivityDate="2020-10-30T20:21:23.000" Title="Quantum teleportation and the reality of quantum states" Tags="&lt;quantum-state&gt;&lt;teleportation&gt;&lt;communication&gt;&lt;foundations&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14392" PostTypeId="2" ParentId="14391" CreationDate="2020-10-29T16:26:07.000" Score="0" Body="&lt;p&gt;Yes, you're right. That is why there is no commonly accepted interpretation of the quantum theory.&lt;/p&gt;&#xA;&lt;p&gt;A simpler paradoxes, such as with Wigner's friend, also show that quantum state is not quite objective thing.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-10-29T16:26:07.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14393" PostTypeId="1" AcceptedAnswerId="14406" CreationDate="2020-10-29T19:37:57.080" Score="1" ViewCount="65" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{PreciseBQP}$&lt;/span&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$\text{BQP}$&lt;/span&gt; with inverse exponentially close completeness and soundness bounds (for a better definition, see Section 3.1 &lt;a href=&quot;https://arxiv.org/abs/1805.11139&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, in the paper by Gharibian et al). Similarly, &lt;span class=&quot;math-container&quot;&gt;$\text{PreciseQMA}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\text{QMA}$&lt;/span&gt; with inverse exponentially close completeness and soundness gaps (for more details, see Remark 5 &lt;a href=&quot;https://arxiv.org/abs/1601.01975&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, in the paper by Fefferman and Lin). It is known that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\text{PreciseBQP} = \text{PP}, \\&#xA;\text{PreciseQMA} = \text{PSPACE}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For more details, see Figure 1 &lt;a href=&quot;https://arxiv.org/abs/2007.11582&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (paper by Deshpande et al). However, it seems obvious to me that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\text{PreciseQMA} \subseteq \text{PreciseBQP}.&#xA;\end{equation}&lt;/span&gt;&#xA;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 &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\text{PreciseBQP}$&lt;/span&gt;, to begin with, we do not care.&lt;/p&gt;&#xA;&lt;p&gt;However, if this is true, then it implies &lt;span class=&quot;math-container&quot;&gt;$\text{PP} = \text{PSPACE}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2020-10-30T05:19:51.063" LastActivityDate="2020-10-30T10:34:39.307" Title="PreciseQMA = PreciseBQP gives PP = PSPACE" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14394" PostTypeId="2" ParentId="14391" CreationDate="2020-10-29T22:39:31.140" Score="0" Body="&lt;p&gt;The ontology of pure states is tricky, but if you believe in pure states then mixed states are fairly straightforward, I think.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, but he doesn't know which.&lt;/p&gt;&#xA;&lt;p&gt;His knowledge can then be represented by a classical Bayesian probability distribution over possible values of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are equally likely, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;A mixed state is just a compact way of representing this &amp;quot;classical knowledge about a pure state modulo distinguishability via experiments on the state&amp;quot;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$0.9|+\rangle\langle+|\,+\,0.1|-\rangle\langle-|$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2020-10-29T22:39:31.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14395" PostTypeId="1" CreationDate="2020-10-29T23:56:34.893" Score="3" ViewCount="185" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The issue is that I'd like to perform an algorithm like so:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare in an initial state&lt;/li&gt;&#xA;&lt;li&gt;Apply a circuit &lt;code&gt;U&lt;/code&gt; repeatedly n_iter times&lt;/li&gt;&#xA;&lt;li&gt;Measure&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I also want this algorithm to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Be reasonably efficient with gates (specifically noisy CNOTs)&lt;/li&gt;&#xA;&lt;li&gt;Have the same error for &lt;code&gt;U&lt;/code&gt; for each iteration of it&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This turns out to be a headche. When &lt;code&gt;U&lt;/code&gt; is complicated, it becomes difficult for the transpiler to efficiently decompose it to native gates. This difficulty goes up for &lt;code&gt;U*U&lt;/code&gt; and &lt;code&gt;U*U*U&lt;/code&gt; since they're longer. So if I were to transpile the whole algorithm at once (with many &lt;code&gt;U&lt;/code&gt;'s), it certainly won't give an efficient gate decomposition, and won't have the same error for each iteration of &lt;code&gt;U&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The solution I thought would be reasonable is to transpile &lt;code&gt;U&lt;/code&gt; on its own, then compose it with itself. But this hits a problem. The transpiler likes to &lt;strong&gt;switch qubit identities&lt;/strong&gt; (and add global phase, and maybe more?) while searching for a more efficient circuit. So if I follow my algorithm as stated above, &lt;code&gt;U&lt;/code&gt; will not line up correctly with the prep or measurement, and my results will be wrong.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;final_layout&lt;/code&gt; of the qubits.&lt;/p&gt;&#xA;&lt;p&gt;I've been trying to determine the &lt;code&gt;final_layout&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone have either working code to determine the &lt;code&gt;final_layout&lt;/code&gt;, or a better approach to implementing this algorithm?&lt;/p&gt;&#xA;&lt;p&gt;(EDIT: Code and more info is included in my answer below)&lt;/p&gt;&#xA;" OwnerUserId="8385" LastEditorUserId="8385" LastEditDate="2021-01-14T23:08:30.377" LastActivityDate="2021-02-14T00:04:00.543" Title="How to repeat circuit efficiently and reliably in IBM Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14396" PostTypeId="1" AcceptedAnswerId="14398" CreationDate="2020-10-30T00:04:11.003" Score="3" ViewCount="173" Body="&lt;p&gt;When testing my quantum programs, I wonder how many shots I must take to get a specific accuracy.&lt;/p&gt;&#xA;&lt;p&gt;Are there any papers that you can recommend that analyze this?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="9118" LastEditDate="2020-11-05T00:41:07.820" LastActivityDate="2020-11-16T09:59:49.197" Title="How many shots should one take to get a reliable estimate in a quantum program?" Tags="&lt;programming&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14397" PostTypeId="1" AcceptedAnswerId="14409" CreationDate="2020-10-30T00:50:03.263" Score="2" ViewCount="201" Body="&lt;p&gt;I am trying to use the &lt;code&gt;statevector_gpu&lt;/code&gt; simulation method in Qiskit Aer (see &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.StatevectorSimulator.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; page). I installed &lt;code&gt;qiskit-aer-gpu&lt;/code&gt; according to the instructions on &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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 &lt;code&gt;qiskit.providers.aer.aererror.AerError: &amp;quot;Invalid simulation method statevector_gpu. Available methods are: ['automatic', 'statevector']&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance for the help!&lt;/p&gt;&#xA;&lt;p&gt;Here is the relevant system information:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It is a shared computer running &lt;code&gt;Ubuntu 18.04.4 LTS&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;I have &lt;code&gt;qiskit 0.23.0&lt;/code&gt;, &lt;code&gt;qiskit-aer 0.7.0&lt;/code&gt;, &lt;code&gt;qiskit-aer-gpu 0.7.0&lt;/code&gt; installed in an environment in &lt;code&gt;conda 4.8.5&lt;/code&gt; with &lt;code&gt;python 3.8.5&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nvcc --version&lt;/code&gt; gives &lt;code&gt;Cuda compilation tools, release 10.0, V10.0.130&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;nvidia-smi&lt;/code&gt; shows 4 GPUs available and indicates &lt;code&gt;CUDA Version: 10.2&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13653" LastEditorUserId="55" LastEditDate="2020-11-04T07:47:48.047" LastActivityDate="2020-11-04T07:47:48.047" Title="Qiskit &quot;statevector_gpu&quot; method not available" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14398" PostTypeId="2" ParentId="14396" CreationDate="2020-10-30T03:03:58.533" Score="3" Body="&lt;p&gt;This is depends on what algorithm you are executing.&lt;/p&gt;&#xA;&lt;p&gt;For example, if you look at the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/bernstein-vazirani.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bernstein-Vazirani algorithm&lt;/a&gt; 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 &amp;quot;essentially&amp;quot; guarantee to fails, then additional shots will not help.&lt;/p&gt;&#xA;&lt;p&gt;The above discussion is for quantum algorithms that only need &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt; shots/samples. This is not true for algorithm like VQE. For VQE, we need to do &lt;span class=&quot;math-container&quot;&gt;$O(1/\epsilon^2)$&lt;/span&gt; shots to achieve error of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;. For chemical accuracy, which is for &lt;span class=&quot;math-container&quot;&gt;$\epsilon = 10^{-3}$&lt;/span&gt;, you would need to do ~&lt;span class=&quot;math-container&quot;&gt;$10^6$&lt;/span&gt; shots at each iteration... which is insane!&lt;/p&gt;&#xA;&lt;p&gt;Now if you just create a random circuit, which output a state that could be in super-position of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; eigenbasis then you will need &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; eigenbasis... Extracting out this state would take exponential amount of samples which then defeat the entire purpose.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-30T03:03:58.533" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14399" PostTypeId="2" ParentId="14396" CreationDate="2020-10-30T07:03:15.413" Score="-1" Body="&lt;p&gt;One way of this estimation is to analyze how many states will be there. Suppose there will be &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; states and the shots are &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, then the average observation of each should be 1, which is easy to forget some states, while if you change to &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; shots the risk is decreased.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; states, if you take &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; shots, the probability that a state has not been detected is &lt;span class=&quot;math-container&quot;&gt;$n \choose 1$&lt;/span&gt;=&lt;span class=&quot;math-container&quot;&gt;$(\frac{1}{N})^n$&lt;/span&gt;, where degeneracy is ignored.&lt;/p&gt;&#xA;&lt;p&gt;Another way is rather interesting, I think the shots number &lt;strong&gt;only influence the running time slightly&lt;/strong&gt;. Here comes my observation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8On19.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8On19.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first case is to search the number 24 from the range &lt;code&gt;[0,31]&lt;/code&gt;, the second case is to search number 64 from the range &lt;code&gt;[0,127]&lt;/code&gt;, the last one is printed on the figure (in my code, the number of qubits needed is &lt;code&gt;3*len(bin(24/64/128)[2:])&lt;/code&gt;, three times of the binary length).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;want to save the running time of your script&lt;/strong&gt;, maybe you do not need to change the number of shots.&lt;/p&gt;&#xA;&lt;p&gt;NOTICE that this test is not sophisticated, loopholes maybe continue hidden.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-16T09:59:49.197" LastActivityDate="2020-11-16T09:59:49.197" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14400" PostTypeId="1" AcceptedAnswerId="14402" CreationDate="2020-10-30T07:05:28.450" Score="1" ViewCount="69" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="55" LastEditDate="2020-11-04T07:45:06.397" LastActivityDate="2020-11-04T07:45:06.397" Title="How to represent the state vector form of a qubit in density matrix representation?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2020-11-06T12:12:49.437" ContentLicense="CC BY-SA 4.0" />
  <row Id="14401" PostTypeId="2" ParentId="14400" CreationDate="2020-10-30T07:54:01.427" Score="3" Body="&lt;p&gt;If we have a pure state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \alpha |0 \rangle + \beta |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The corresponding density matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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| = &#xA;\begin{pmatrix} &#xA;|\alpha|^2 &amp;amp; \alpha \beta^* \\ &#xA;\alpha^* \beta &amp;amp; |\beta|^2 &#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If the state is not pure and we have &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt; probability of haveing &lt;span class=&quot;math-container&quot;&gt;$\psi_1$&lt;/span&gt; state and with &lt;span class=&quot;math-container&quot;&gt;$p_2$&lt;/span&gt; probability of having &lt;span class=&quot;math-container&quot;&gt;$\psi_2$&lt;/span&gt; state (and this can be extended to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; cases: &lt;span class=&quot;math-container&quot;&gt;$p_n$&lt;/span&gt; probability of &lt;span class=&quot;math-container&quot;&gt;$\psi_n$&lt;/span&gt; state):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = p_1 |\psi_1 \rangle \langle \psi_1| + p_2 |\psi_2 \rangle \langle \psi_2| = p_1 &#xA;\begin{pmatrix} &#xA;|\alpha_1|^2 &amp;amp; \alpha_1 \beta_1^* \\ &#xA;\alpha_1^* \beta_1 &amp;amp; |\beta_1|^2 &#xA;\end{pmatrix} + p_2 &#xA;\begin{pmatrix} &#xA;|\alpha_2|^2 &amp;amp; \alpha_2 \beta_2^* \\ &#xA;\alpha_2^* \beta_2 &amp;amp; |\beta_2|^2 \end{pmatrix} = &#xA;\\&#xA;=\begin{pmatrix} &#xA;p_1|\alpha_1|^2 + p_2|\alpha_2|^2 &amp;amp; p_1 \alpha_1 \beta_1^* + p_2 \alpha_2 \beta_2^* \\ &#xA;p_1 \alpha_1^* \beta_1 + p_2 \alpha_2^* \beta_2 &amp;amp; p_1|\beta_1|^2 + p_2 |\beta_2|^2&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastActivityDate="2020-10-30T07:54:01.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14402" PostTypeId="2" ParentId="14400" CreationDate="2020-10-30T07:54:28.087" Score="2" Body="&lt;p&gt;A qubit  state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in \mathbb{C}^{2^n} \ \ \textrm{for} \ \ n\in\mathbb{N}$&lt;/span&gt; can be represented as a density operator/matrix as &lt;span class=&quot;math-container&quot;&gt;$\rho = | \psi \rangle \langle \psi |$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example: If &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |1\rangle$&lt;/span&gt;  then &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi \rangle \langle \psi | = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix} = \begin{pmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} $&lt;/span&gt; is the density matrix representation of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus, density matrix representation offers  a general way of expressing a quantum state. As you can see, a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha | 0 \rangle + \beta |1 \rangle $&lt;/span&gt;  are just the states on the surface of the Blochsphere. The states inside the Blochsphere are known as mixed states.&lt;/p&gt;&#xA;&lt;p&gt;To go even deeper, states are &lt;a href=&quot;https://en.wikipedia.org/wiki/Positive_linear_functional&quot; rel=&quot;nofollow noreferrer&quot;&gt;positive linear functional&lt;/a&gt; of unit norm.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-30T07:54:28.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14403" PostTypeId="2" ParentId="14391" CreationDate="2020-10-30T08:18:24.440" Score="2" Body="&lt;p&gt;Remember that mixed states can be a &lt;em&gt;subjective&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-30T08:18:24.440" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14404" PostTypeId="1" AcceptedAnswerId="14405" CreationDate="2020-10-30T08:24:17.343" Score="2" ViewCount="65" Body="&lt;p&gt;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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/n8cbT.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n8cbT.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, start qubit is &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; and after 'X' gate, the result will be &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;. And I checked if the result of quantum circuit and density matrix form of &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; are different. As you can see, they are different.&lt;/p&gt;&#xA;&lt;p&gt;Here are my questions.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why it occurs?&lt;/li&gt;&#xA;&lt;li&gt;If they are different, is my calculation wrong?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="9118" LastEditDate="2020-10-31T07:27:47.570" LastActivityDate="2020-10-31T07:27:47.570" Title="Computation of qubits with quantum gates using density matrix form" Tags="&lt;quantum-gate&gt;&lt;simulation&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14405" PostTypeId="2" ParentId="14404" CreationDate="2020-10-30T08:30:19.107" Score="5" Body="&lt;p&gt;When you evolve a pure state under the action of a gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, it evolves from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\rightarrow U|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;However, a density matrix such as &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\langle\psi|$&lt;/span&gt; evolves differently. You must calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho\rightarrow U\rho U^\dagger.&#xA;$$&lt;/span&gt;&#xA;So, in this case, you must calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{array}\right)\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{array}\right)\left(\begin{array}{cc} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{array}\right)=\left(\begin{array}{cc} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-10-30T08:30:19.107" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14406" PostTypeId="2" ParentId="14393" CreationDate="2020-10-30T10:34:39.307" Score="3" Body="&lt;p&gt;I guess a similar argument used&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in &lt;span class=&quot;math-container&quot;&gt;$\big[$&lt;/span&gt; Marriot, Watrous &lt;span class=&quot;math-container&quot;&gt;$\big] $&lt;/span&gt; &lt;a href=&quot;https://arxiv.org/abs/cs/0506068&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;&#xA;to prove QMA&lt;span class=&quot;math-container&quot;&gt;$_{log}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\subseteq$&lt;/span&gt; BQP&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in &lt;span class=&quot;math-container&quot;&gt;$\big[$&lt;/span&gt; Fefferman, Lin &lt;span class=&quot;math-container&quot;&gt;$\big]$&lt;/span&gt; &lt;a href=&quot;https://arxiv.org/abs/1601.01975&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;&#xA;to prove QMA&lt;span class=&quot;math-container&quot;&gt;$_{exp}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\subseteq$&lt;/span&gt; PSPACE&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;does not carry over since for L &lt;span class=&quot;math-container&quot;&gt;$\in $&lt;/span&gt; QMA&lt;span class=&quot;math-container&quot;&gt;$_{exp}$&lt;/span&gt; = PreciseQMA you get&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ x \in $&lt;/span&gt; L &lt;span class=&quot;math-container&quot;&gt;$ \implies \text{tr}[Q_x] \geq c $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ x \notin $&lt;/span&gt; L &lt;span class=&quot;math-container&quot;&gt;$ \implies \text{tr}[Q_x] \leq 2^m s $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$ c - s = \frac{1}{exp} $&lt;/span&gt; and so using the totally mixed state &lt;span class=&quot;math-container&quot;&gt;$2^{-m} \mathbb{I}_m $&lt;/span&gt; you accept with probability &lt;span class=&quot;math-container&quot;&gt;$ \text{tr}[2^{-m} Q_x] $&lt;/span&gt; but does not yield any meaningful bound.&lt;/p&gt;&#xA;&lt;p&gt;Both papers essentially apply an amplification procedure before the argument.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-10-30T10:34:39.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14407" PostTypeId="2" ParentId="14391" CreationDate="2020-10-30T10:40:00.143" Score="2" Body="&lt;p&gt;The state of Bob's pair is not &lt;span class=&quot;math-container&quot;&gt;$1/2 (|0\rangle\langle0| + |1\rangle\langle1|)$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;The question remains, however, what &lt;em&gt;is&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;There is, however, a solution: the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9906007&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Hayden&lt;/a&gt; model was designed to represent quantum mechanics (and quantum teleportation specifically) in a completely local way. It can assign &amp;quot;really real&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;In quantum teleportation specifically, Bob's state doesn't change to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; when he learns that Alice's measurement result is 00. Instead, &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;The Deutsch-Hayden paper uses rather archaic notation, I find &lt;a href=&quot;https://arxiv.org/abs/2001.09646&quot; rel=&quot;nofollow noreferrer&quot;&gt;this review&lt;/a&gt; more intelligible. Appendix A specifically.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-10-30T10:40:00.143" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14408" PostTypeId="1" CreationDate="2020-10-30T10:44:15.710" Score="2" ViewCount="69" Body="&lt;p&gt;According to its &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/tagged/density-matrix&quot;&gt;tag description&lt;/a&gt;, a &lt;strong&gt;density matrix&lt;/strong&gt; is the quantum-mechanical analogue to a &lt;strong&gt;phase-space probability measure&lt;/strong&gt; (probability distribution of position and momentum) in classical statistical mechanics.&lt;/p&gt;&#xA;&lt;p&gt;How can I reconcile the concept and intuition behind a &amp;quot;probability distribution based on both position and momentum&amp;quot; found in statistical mechanics, with that of a matrix ensemble of 1's and 0's found in the quantum density matrix?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="9118" LastEditDate="2020-11-04T10:20:12.720" LastActivityDate="2020-11-04T10:20:12.720" Title="What is the relation between density matrices and phase-space probability distributions?" Tags="&lt;density-matrix&gt;&lt;classical-quantum&gt;&lt;wigner-function&gt;&lt;probability&gt;" AnswerCount="0" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="14409" PostTypeId="2" ParentId="14397" CreationDate="2020-10-30T10:57:58.600" Score="2" Body="&lt;p&gt;The &lt;code&gt;qiskit-aer&lt;/code&gt; and &lt;code&gt;qiskit-aer-gpu&lt;/code&gt; are mutually exclusive packages. They contain the same code except that the &lt;code&gt;qiskit-aer-gpu&lt;/code&gt; 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 &lt;code&gt;qiskit-terra&lt;/code&gt; and &lt;code&gt;qiskit-aer-gpu&lt;/code&gt; manually with &lt;code&gt;pip install -U qiskit-terra qiskit-aer-gpu&lt;/code&gt; (and add &lt;code&gt;qiskit-ignis&lt;/code&gt;, &lt;code&gt;qiskit-aqua&lt;/code&gt;, and &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt; if they're needed). If you still have issues with only qiskit-aer-gpu installed in the environment please file an issue at &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/issues&lt;/a&gt; and we can work on debugging it there.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-10-30T10:57:58.600" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14411" PostTypeId="1" AcceptedAnswerId="14414" CreationDate="2020-10-30T16:29:13.860" Score="2" ViewCount="41" Body="&lt;p&gt;The max-relative entropy between two states is defined as &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho\|\sigma) = \log\lambda$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is the smallest real number that satisfies &lt;span class=&quot;math-container&quot;&gt;$\rho\leq \lambda\sigma$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A\leq B$&lt;/span&gt; is used to denote that &lt;span class=&quot;math-container&quot;&gt;$B-A$&lt;/span&gt; is positive semidefinite.&lt;/p&gt;&#xA;&lt;p&gt;An alternative way to express the max relative entropy is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D_{\max}(\rho\|\sigma) = \|\sigma^{-1/2}\rho\sigma^{-1/2}\|_{\infty},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|_\infty$&lt;/span&gt; is the operator norm which essentially picks out the largest eigenvalue. I see that the essential idea is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho &amp;amp;\leq \lambda\sigma \\&#xA;\sigma^{-1/2}\rho\sigma^{-1/2}&amp;amp;\leq \lambda I &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Choosing the smallest possible &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; results in equality and hence one recovers &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho\|\sigma)$&lt;/span&gt; this way.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I assumed that &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1}$&lt;/span&gt; here is obtained by&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Diagonalizing &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Taking the reciprocal of all nonzero eigenvalues and leaving zero eigenvalues as they are&lt;/li&gt;&#xA;&lt;li&gt;Undiagonalizing &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; again.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;However, this doesn't make sense because to me because when the support of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is bigger than the support of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho\|\sigma) = \infty$&lt;/span&gt;. However, it looks like &lt;span class=&quot;math-container&quot;&gt;$\|\sigma^{-1/2}\rho\sigma^{1/2}\|_\infty$&lt;/span&gt; can never be infinity.&lt;/p&gt;&#xA;&lt;p&gt;So how does one obtain &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-10-30T18:40:02.950" Title="Pseudoinverse of a quantum state" Tags="&lt;mathematics&gt;&lt;information-theory&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14412" PostTypeId="2" ParentId="14395" CreationDate="2020-10-30T18:21:41.220" Score="0" Body="&lt;p&gt;I found a partial answer that I'll share to clarify what the problem is, and provide a hacky fix.&lt;/p&gt;&#xA;&lt;p&gt;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 measurments are present, but when they aren’t it causes the circuit to just throw away swaps at the end of the circuit for no reason.&lt;/p&gt;&#xA;&lt;p&gt;I also found a strange partial fix for this: It seems that if I transpile a second time after adding those missing swaps by hand, the second transpile won’t wrongly delete the swaps, and will partially absorb them into the circuit like I wanted. Unsure why this works.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Here is code demonstrating the problem:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc_foo = QuantumCircuit(n_q, n_q)&#xA;qubit_list = [0,1,2]&#xA;qc_foo.swap(0,1)&#xA;qc_foo.swap(0,2)&#xA;qc_foo.barrier()&#xA;qc_foo.measure(qubit_list, qubit_list)&#xA;qc_foo_trans = transpile(qc_foo, backend=sant, optimization_level=3)&#xA;qc_foo_trans.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Notice the transpiled circuit has turned the 0-2 swap into a 1-2 swap, 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.&lt;/p&gt;&#xA;&lt;p&gt;A developer has also confirmed for me that this is likely a bug.&lt;/p&gt;&#xA;" OwnerUserId="8385" LastEditorUserId="8385" LastEditDate="2020-11-06T05:34:55.720" LastActivityDate="2020-11-06T05:34:55.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14413" PostTypeId="2" ParentId="14112" CreationDate="2020-10-30T18:39:39.753" Score="1" Body="&lt;p&gt;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. &lt;code&gt;scipy.optimize&lt;/code&gt; any other of your favorite optimization tools.&lt;/p&gt;&#xA;&lt;p&gt;Your second question is regarding measuring the energy of the quantum state.&#xA;Indeed, Q# does not allow inspection of the quantum state, because as you noted this is not possible on physical hardware either.&lt;/p&gt;&#xA;&lt;p&gt;However, there are some ways to retrieve this info.&lt;/p&gt;&#xA;&lt;p&gt;In an experiment on real hardware, what you would do is simply measure all qubits over and over again, let's say &lt;code&gt;N&lt;/code&gt; times, which gives you a list of &lt;code&gt;N&lt;/code&gt; bitstrings. If &lt;code&gt;N&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// Allowed states&#xA;let state1 = [One, One, One, One, Zero, Zero];&#xA;let state2 = [Zero, One, Zero, One, One, One];&#xA;let state3 = [One, Zero, One, Zero, One, One];&#xA;let states = [state1, state2, state3];&#xA;mutable result = new Double[Length(states) + 1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We'll keep track of the probability of getting an invalid state as the results come in by subtracting these values from 1.0.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;mutable otherProb = 1.0; // Probability of any invalid state&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;result&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for ((index, state) in Enumerated(states)) {&#xA;    let prob = MeasureProbabilityForState(state, numSegments, weights, couplings, timeX, timeZ, numMeasurements);&#xA;    set result w/= index &amp;lt;- prob;&#xA;    set otherProb -= prob;&#xA;}&#xA;&#xA;set result w/= Length(states) &amp;lt;- otherProb;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The energy, or cost that we want to minimize, can then be calculated by multiplying the probabilities by the cost of each state.&lt;/p&gt;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;&lt;p&gt;So, how to implement &lt;code&gt;MeasureProbabilityForState&lt;/code&gt;?&lt;/p&gt;&#xA;&lt;p&gt;We can use the operation &lt;code&gt;EstimateFrequency&lt;/code&gt; for this. This operation measures the probability of getting a &lt;code&gt;Zero&lt;/code&gt; result for given state prep and measurement operations.&#xA;See docs here:&#xA;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.characterization.estimatefrequency&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.characterization.estimatefrequency&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The implementation can look something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    operation MeasureProbabilityForState(&#xA;        state : Result[],&#xA;        numSegments: Int, &#xA;        weights : Double[], &#xA;        couplings : Double[], &#xA;        timeX : Double[], &#xA;        timeZ : Double[],&#xA;        numMeasurements: Int&#xA;    ) : Double {&#xA;        return EstimateFrequency(&#xA;            ApplyQAOA(_, numSegments, weights, couplings, timeX, timeZ), &#xA;            MeasureRegisterIsInState(_, state),&#xA;            numSegments, &#xA;            numMeasurements&#xA;        );&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where we have to check if the register is in the desired state and return &lt;code&gt;Zero&lt;/code&gt; if it is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    operation MeasureRegisterIsInState(register : Qubit[], state : Result[]) : Result {&#xA;        let result = MultiM(register);&#xA;        if (All&amp;lt;(Result, Result)&amp;gt;(EqualR, Zipped(result, state))) {&#xA;            return Zero;&#xA;        } else {&#xA;            return One;&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    operation ApplyQAOA(&#xA;            x: Qubit[],&#xA;            numSegments: Int, &#xA;            weights : Double[], &#xA;            couplings : Double[], &#xA;            timeX : Double[], &#xA;            timeZ : Double[]&#xA;        ) : Unit {&#xA;        ApplyToEach(H, x); // prepare the uniform distribution&#xA;        for ((tz, tx) in Zipped(timeZ, timeX))&#xA;        {&#xA;            ApplyInstanceHamiltonian(numSegments, tz, weights, couplings, x); // do Exp(-i H_C tz)&#xA;            ApplyDriverHamiltonian(tx, x); // do Exp(-i H_0 tx)&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is just one way of using &lt;code&gt;EstimateFrequency&lt;/code&gt; to solve this problem; I hope this example helps you figure out the best way that works for your quantum application.&lt;/p&gt;&#xA;" OwnerUserId="13663" LastEditorUserId="13663" LastEditDate="2020-10-30T21:20:15.900" LastActivityDate="2020-10-30T21:20:15.900" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14414" PostTypeId="2" ParentId="14411" CreationDate="2020-10-30T18:40:02.950" Score="2" Body="&lt;p&gt;There is a problem in the derivation you presented, since &lt;span class=&quot;math-container&quot;&gt;$\rho \leq \lambda \sigma$&lt;/span&gt; is only equivalent to &lt;span class=&quot;math-container&quot;&gt;$\sigma^{-1/2} \rho \sigma^{-1/2} \leq \lambda I$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is invertible (or at least when &lt;span class=&quot;math-container&quot;&gt;$\mathrm{supp}(\rho) \subset \mathrm{supp}(\sigma)$&lt;/span&gt;, so that you can restrict the space to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{supp}(\sigma)$&lt;/span&gt; instead of the whole Hilbert space). The property is not true otherwise: consider e.g. &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle+| \leq \lambda |0\rangle\langle 0|$&lt;/span&gt; as a counterexample.&lt;/p&gt;&#xA;&lt;p&gt;All in all, only when the condition &lt;span class=&quot;math-container&quot;&gt;$\mathrm{supp}(\rho) \subset \mathrm{supp}(\sigma)$&lt;/span&gt; is satisfied can we conclude that &lt;span class=&quot;math-container&quot;&gt;$D_{\max}(\rho \| \sigma) = \log \| \sigma^{-1/2} \rho \sigma^{-1/2} \|_\infty$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13507" LastActivityDate="2020-10-30T18:40:02.950" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14415" PostTypeId="1" CreationDate="2020-10-30T18:59:59.743" Score="3" ViewCount="71" Body="&lt;p&gt;Consider a standard circuit to Hamiltonian reduction in QMA. For example, refer &lt;a href=&quot;https://people.eecs.berkeley.edu/%7Evazirani/s07quantum/notes/qma.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (Vazirani's lecture notes) or page 235 of &lt;a href=&quot;https://arxiv.org/abs/1401.3916&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (survey by Gharibian et al).&lt;/p&gt;&#xA;&lt;p&gt;The history state of the Kitaev clock Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; |\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}},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$V = V_{T} V_{T-1}\cdots V_{1}$&lt;/span&gt; is the circuit that the QMA verifier, and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the state sent by the prover. Note that &lt;span class=&quot;math-container&quot;&gt;$|\psi_{\text{history}}\rangle$&lt;/span&gt; is not the ground state of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. But how close is it to the ground state?&lt;/p&gt;&#xA;&lt;p&gt;In other words, if &lt;span class=&quot;math-container&quot;&gt;$|\psi_{\text{ground}}\rangle$&lt;/span&gt; is the ground state of the Kitaev clock Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, I am trying to find&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|| |\psi_{\text{ground}}\rangle - |\psi_{\text{history}}\rangle ||.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2020-10-30T20:21:34.467" LastActivityDate="2020-11-02T05:03:17.847" Title="How close is the history state to the ground state in the Kitaev clock construction?" Tags="&lt;complexity-theory&gt;&lt;hamiltonian-simulation&gt;&lt;qma&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14417" PostTypeId="1" AcceptedAnswerId="14479" CreationDate="2020-10-31T06:04:52.687" Score="0" ViewCount="55" Body="&lt;p&gt;I am submitting a job to ibmq_qasm_simulator and after the validation I repeatedly get the error &amp;quot;&lt;strong&gt;Error running job on a simulator. [5204]&lt;/strong&gt;&amp;quot; The site with error descriptions &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/errors&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/docs/manage/errors&lt;/a&gt; &lt;strong&gt;does not have an entry&lt;/strong&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="13667" LastEditorUserId="55" LastEditDate="2020-11-04T07:41:21.247" LastActivityDate="2020-11-04T10:35:27.240" Title="Unknown error code [5204] when running job on IBM's qasm_simulator" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14418" PostTypeId="1" CreationDate="2020-10-31T06:54:44.500" Score="1" ViewCount="82" Body="&lt;p&gt;How do I implement the HHL with negative eigenvalues?&lt;/p&gt;&#xA;&lt;p&gt;This paper (&lt;a href=&quot;https://arxiv.org/abs/1803.01486&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1803.01486&lt;/a&gt;) says that:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;what if &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;lt;0$&lt;/span&gt;? This problem actually does not hard to solve, since we can choose &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; small enough, such that &lt;span class=&quot;math-container&quot;&gt;$|\lambda t| &amp;lt; \pi$&lt;/span&gt;. So if &lt;span class=&quot;math-container&quot;&gt;$2 \pi y/N &amp;gt; \pi$&lt;/span&gt;, then we believe that &lt;span class=&quot;math-container&quot;&gt;$\lambda t = 2 \pi y/N − 2\pi=−2\pi (N−y)/N$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;However, doing so introduces a problem at &lt;span class=&quot;math-container&quot;&gt;$\lambda = 0$&lt;/span&gt;, where the solution diverges.&lt;/p&gt;&#xA;&lt;p&gt;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?&#xA;&lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note 2: in Qiskit,the quantum phase estimation EigsQPE has an input &lt;code&gt;negative_evals&lt;/code&gt;. It seems this adds one more ancilla qubit. What do that they do here?&#xA;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.components.eigs.EigsQPE.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.aqua.components.eigs.EigsQPE.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9903" LastEditorUserId="55" LastEditDate="2020-11-04T07:41:14.610" LastActivityDate="2020-11-04T07:41:14.610" Title="Implementing the HHL algorithm with negative eigenvalues (Cirq)" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;cirq&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14420" PostTypeId="2" ParentId="9826" CreationDate="2020-10-31T15:31:40.977" Score="2" Body="&lt;p&gt;I had the same issue. Removed Python 3.9 and installed the 3.8 version. That did the trick.&lt;/p&gt;&#xA;" OwnerUserId="13669" LastActivityDate="2020-10-31T15:31:40.977" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14422" PostTypeId="1" AcceptedAnswerId="14423" CreationDate="2020-10-31T19:40:08.787" Score="1" ViewCount="87" Body="&lt;p&gt;I am new to Quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;I see &lt;span class=&quot;math-container&quot;&gt;$|\mbox{+}i\rangle$&lt;/span&gt; state maps to y-axis on bloch sphere (&lt;span class=&quot;math-container&quot;&gt;$\theta = 90$&lt;/span&gt; degree and &lt;span class=&quot;math-container&quot;&gt;$\phi = 90$&lt;/span&gt; degree) while &lt;span class=&quot;math-container&quot;&gt;$i|1\rangle$&lt;/span&gt; maps on x-axis, &lt;span class=&quot;math-container&quot;&gt;$i|1\rangle$&lt;/span&gt; is stated as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with global phase &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\theta = 180$&lt;/span&gt; degree and &lt;span class=&quot;math-container&quot;&gt;$\phi = 90$&lt;/span&gt; degree).&lt;/p&gt;&#xA;&lt;p&gt;But both the notation ie. &lt;span class=&quot;math-container&quot;&gt;$i|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\mbox{+}i\rangle$&lt;/span&gt; looks very similar to me. How do we interpret that something is global phase while reading it.&lt;/p&gt;&#xA;" OwnerUserId="13392" LastEditorUserId="55" LastEditDate="2020-11-04T07:37:13.757" LastActivityDate="2020-11-04T07:37:13.757" Title="What is the difference between the states $i|1\rangle$ and $|+i\rangle$?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;bloch-sphere&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14423" PostTypeId="2" ParentId="14422" CreationDate="2020-10-31T19:59:14.203" Score="4" Body="&lt;p&gt;It is just the convention that people use the notation &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle $&lt;/span&gt; to represent the vector &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; to represents the matrix &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt;. Similarly, people use the notation &lt;span class=&quot;math-container&quot;&gt;$|i\rangle $&lt;/span&gt; to represent the vector &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix}$&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;p&gt;I could have very much use a different notation, say &lt;span class=&quot;math-container&quot;&gt;$|k\rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix}$&lt;/span&gt;, instead. Maybe this would lessen the confusion.&lt;/p&gt;&#xA;&lt;p&gt;So by looking at the vector itself, it would be less confusing. That is, if you look at the state &lt;span class=&quot;math-container&quot;&gt;$i|1\rangle$&lt;/span&gt; you have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ i|1\rangle = i \begin{pmatrix} 0 \\ 1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which you can see that &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; here is the global phase. But if you look at the state &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; you have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|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]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as you can see here, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is not a global phase but rather a relative phase.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-31T19:59:14.203" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14424" PostTypeId="1" AcceptedAnswerId="14425" CreationDate="2020-10-31T22:07:25.313" Score="2" ViewCount="44" Body="&lt;p&gt;Is it wrong to say in &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = a|0 \rangle +b|1 \rangle $&lt;/span&gt;? And by that definition how can &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; be imaginary numbers?&lt;/p&gt;&#xA;" OwnerUserId="13670" LastEditorUserId="55" LastEditDate="2020-11-04T16:01:20.150" LastActivityDate="2020-11-04T16:01:20.150" Title="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 $?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14425" PostTypeId="2" ParentId="14424" CreationDate="2020-10-31T23:18:26.747" Score="1" Body="&lt;p&gt;A qubit is a two-level quantum system, hence the state of a qubit can be written as &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = a|0\rangle + b|1\rangle$&lt;/span&gt;  with &lt;span class=&quot;math-container&quot;&gt;$a, b \in \mathbb{C}$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$|a|^2 + |b|^2 = 1 $&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$|a|^2$&lt;/span&gt; is always a real number even if &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is complex because &lt;span class=&quot;math-container&quot;&gt;$|a|^2 = a\cdot \bar{a} $&lt;/span&gt;. And yes, the probability to observe the qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Pr(|0\rangle) = |a|^2$&lt;/span&gt;. Similarly the probability to observe the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Pr(|1\rangle ) = |b|^2$&lt;/span&gt;. This should shed some light into why we have the constraint &lt;span class=&quot;math-container&quot;&gt;$|a|^2 + |b|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-10-31T23:18:26.747" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14427" PostTypeId="1" AcceptedAnswerId="14432" CreationDate="2020-11-01T01:13:15.533" Score="3" ViewCount="64" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$A, B$&lt;/span&gt; be (finite-dimensional) Hilbert spaces, and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; some mixed state of &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt;. I am trying to show that a measurement performed on the '&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;-subsystem' does not affect &lt;span class=&quot;math-container&quot;&gt;$\rho^B = \text{Tr}_A(\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I understand a 'measurement performed on the &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;-subsystem' as given by some observable &lt;span class=&quot;math-container&quot;&gt;$X \otimes I$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is a self-adjoint operator on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; which decomposes as &lt;span class=&quot;math-container&quot;&gt;$X = \sum m P_m$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is the orthogonal projection on the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-eigenspace). If this measurement results in outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, the resulting state should be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho' = \frac{(P_m \otimes I) \rho (P_m \otimes I)}{\text{Tr}((P_m \otimes I) \rho)}$$&lt;/span&gt;&#xA;and I wish to see that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_A(\rho') = \text{Tr}_A(\rho)$&lt;/span&gt;. Now I can use the cyclicity of trace to see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_A(\rho') = \frac{\text{Tr}_A((P_m \otimes I) \rho)}{\text{Tr}((P_m \otimes I) \rho)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but why should this be equal to &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_A(\rho)$&lt;/span&gt;? I did check this is the case if &lt;span class=&quot;math-container&quot;&gt;$\rho = \rho^A \otimes \rho^B$&lt;/span&gt; decomposes as a product. And I know a general &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; 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 &lt;em&gt;not&lt;/em&gt; hold). Hopefully someone can point to the mistake in my thinking.&lt;/p&gt;&#xA;" OwnerUserId="9168" LastEditorUserId="55" LastEditDate="2020-11-04T16:00:12.910" LastActivityDate="2020-11-04T16:00:12.910" Title="Proof of the no-communication theorem" Tags="&lt;measurement&gt;&lt;density-matrix&gt;&lt;communication&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14428" PostTypeId="1" AcceptedAnswerId="14429" CreationDate="2020-11-01T04:29:58.150" Score="1" ViewCount="38" Body="&lt;p&gt;I'm really confused with the interpretation of those equations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$1.$&lt;/span&gt; The evolution of states under unitary operations can be expressed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \sum_k\exp(i\phi_k)|\psi_k\rangle\langle\psi_k|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$2.$&lt;/span&gt; The controlled operation in quantum computing is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes e^{i\alpha}I = \begin{bmatrix}&#xA;1 &amp;amp; 0\\&#xA;0 &amp;amp; e^{i\alpha}&#xA;\end{bmatrix}&#xA;\otimes I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2020-11-04T15:59:06.220" LastActivityDate="2020-11-04T15:59:06.220" Title="What are the physical meanings of the outer product when writing expressions for unitary gates?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;unitarity&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14429" PostTypeId="2" ParentId="14428" CreationDate="2020-11-01T05:40:46.807" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;This is simply the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;spectral decomposition&lt;/a&gt; of a unitary operator. The eigenvalues of a unitary operator are phases, i.e., of the form &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta}$&lt;/span&gt;. And the rank-1 projectors are the eigenprojectors (again from the spectral theorem) and have the form &lt;span class=&quot;math-container&quot;&gt;$| \psi_{k} \rangle \langle  \psi_{k} |$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;This is clearly wrong. The action of this is to provide a trivial &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12772/whats-the-purpose-of-phases-in-quantum-mechanics/12773#12773&quot;&gt;global phase&lt;/a&gt;. I think you mean something like &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|\otimes I+| 1\rangle\langle 1| \otimes R_z(\alpha)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$R_z(\alpha)$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Phase_shift_(%7F%27%22%60UNIQ--postMath-00000037-QINU%60%22%27%7F)_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;phase-shift gate&lt;/a&gt;? Or more generally, any two-qubit controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate can be written as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|\otimes I+| 1\rangle\langle 1| \otimes U$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Does this help?&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-11-01T05:40:46.807" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14430" PostTypeId="2" ParentId="6840" CreationDate="2020-11-01T06:38:21.290" Score="0" Body="&lt;p&gt;Here comes an illustration code written by myself.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute&#xA;from qiskit.providers.aer import QasmSimulator&#xA;qr=QuantumRegister(1)&#xA;cr0=ClassicalRegister(5)&#xA;circ=QuantumCircuit(qr,cr0)&#xA;circ.measure(qr,cr0[0])&#xA;circ.x(qr)&#xA;circ.measure(qr,cr0[2])&#xA;circ.measure(qr,cr0[3])&#xA;circ.x(qr)&#xA;circ.measure(qr,cr0[3])&#xA;circ.x(qr)&#xA;circ.measure(qr,cr0[4])&#xA;circ.h(qr)&#xA;circ.x(qr)&#xA;print(execute(circ,Aer.get_backend('qasm_simulator')).result().get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tEKMN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tEKMN.png&quot; alt=&quot;Quantum Circuit for the upper instruction&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-05T12:51:55.040" LastActivityDate="2020-11-05T12:51:55.040" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14431" PostTypeId="1" AcceptedAnswerId="14434" CreationDate="2020-11-01T06:48:32.570" Score="9" ViewCount="852" Body="&lt;p&gt;I'm using Qiskit to create quantum circuits wherein I've this attribute called &lt;code&gt;depth&lt;/code&gt;. The documentation states it is the length of the critical path &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.depth.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. What does it represent and how to find it out manually?&lt;/p&gt;&#xA;" OwnerUserId="12667" LastEditorUserId="45" LastEditDate="2020-11-02T09:53:01.730" LastActivityDate="2021-04-03T15:21:11.773" Title="What's meant by the depth of a quantum circuit?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14432" PostTypeId="2" ParentId="14427" CreationDate="2020-11-01T07:46:39.593" Score="2" Body="&lt;p&gt;What you've denoted as &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; is just an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th possible outcome. We have to write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho'_m = \frac{(P_m \otimes I) \rho (P_m \otimes I)}{\text{Tr}((P_m \otimes I) \rho)}.&#xA;$$&lt;/span&gt;&#xA;Now, since Bob doesn't know the value of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; he has to assume that the new state is a mixture of &lt;span class=&quot;math-container&quot;&gt;$\rho'_m$&lt;/span&gt; with corresponding probabilities &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}((P_m \otimes I) \rho)$&lt;/span&gt;. So, the actual &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho' = \sum_m \rho'_m \text{Tr}((P_m \otimes I) \rho) = \sum_m (P_m \otimes I) \rho (P_m \otimes I).&#xA;$$&lt;/span&gt;&#xA;Finally, you can see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_A(\rho') = &#xA;\sum_m \text{Tr}_A((P_m \otimes I) \rho (P_m \otimes I)) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \sum_m \text{Tr}_A(\rho (P_m \otimes I)) = &#xA;\text{Tr}_A(\rho \sum_m (P_m \otimes I)) = \text{Tr}_A(\rho).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-11-01T07:53:16.010" LastActivityDate="2020-11-01T07:53:16.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14433" PostTypeId="2" ParentId="14427" CreationDate="2020-11-01T07:53:53.573" Score="2" Body="&lt;p&gt;Indeed, this equation does not hold. Take for example &lt;span class=&quot;math-container&quot;&gt;$\rho = |\phi^+\rangle\langle \phi^+|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle = \frac1{\sqrt2}(|00\rangle+|11\rangle)$&lt;/span&gt;. If Alice obtains outcome 0, then &lt;span class=&quot;math-container&quot;&gt;$\rho' = |00\rangle\langle 00|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\rho^B = |0\rangle\langle0|$&lt;/span&gt;, and if Alice obtains outcome 1, then &lt;span class=&quot;math-container&quot;&gt;$\rho' = |11\rangle\langle 11|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\rho^B = |1\rangle\langle1|$&lt;/span&gt;. This is the typical example of the nonlocality of wavefunction collapse.&lt;/p&gt;&#xA;&lt;p&gt;The statement of the no-communication theorem is that when you &lt;em&gt;average&lt;/em&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_m = \frac{(P_m \otimes I) \rho (P_m \otimes I)}{\text{Tr}((P_m \otimes I) \rho)},$$&lt;/span&gt;&#xA;the collapsed state after obtaining measurement result &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^B_m = \operatorname{tr}_A (\rho_m).$$&lt;/span&gt;&#xA;The theorem is then that &lt;span class=&quot;math-container&quot;&gt;$$\sum_m p(m) \rho^B_m = \rho^B = \operatorname{tr}_A\rho,$$&lt;/span&gt;&#xA;for all possible projectors &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt;, or even POVM elements.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-11-01T07:53:53.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14434" PostTypeId="2" ParentId="14431" CreationDate="2020-11-01T08:02:24.443" Score="14" Body="&lt;p&gt;The &lt;strong&gt;depth&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;For example, the following circuit has depth 3:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jC0Ye.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jC0Ye.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A depth 3 example could be the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OSN6u.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OSN6u.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, the above circuit would have depth of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; after optimization. This is because a CNOT gate followed by another CNOT gate is the same as doing nothing. That is, CNOT &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; CNOT &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; CNOT = CNOT. So you don't really need to do an additional two CNOTs.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Another example, consider this other circuit which has &lt;strong&gt;depth = 5&lt;/strong&gt; (Can you now see why this circuit has a depth of 5? ):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aakik.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aakik.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o2SFJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o2SFJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because &lt;strong&gt;not all the qubits are connected&lt;/strong&gt; and &lt;strong&gt;not all the gates&lt;/strong&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ho0pD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ho0pD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This circuit has depth 29, instead of depth 5 like the circuit we originally defined.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The point I wanted to make is that the &lt;strong&gt;depth of your circuit might change under the optimization and transpilation process&lt;/strong&gt; so make sure you keep this in mind.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;qc = QuantumCircuit(1,1)&#xA;qc.x(0)&#xA;qc.y(0)&#xA;qc.rz(1,0)&#xA;print(qc)&#xA;print(&amp;quot;The circuit depth is:&amp;quot;, qc.depth())&#xA;qc_transpiled = transpile(qc, provider.get_backend('ibmq_ourense') , optimization_level=3)&#xA;print(&amp;quot;The TRANSPILED circuit depth is:&amp;quot;, qc_transpiled.depth())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I see that there is another similar question here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5769/how-to-calculate-circuit-depth-properly&quot;&gt;How to calculate circuit depth properly?&lt;/a&gt;&#xA;There are a couple of really good answers there as well. So I hope it helps!&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="4947" LastEditDate="2021-04-03T15:21:11.773" LastActivityDate="2021-04-03T15:21:11.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14436" PostTypeId="1" AcceptedAnswerId="14440" CreationDate="2020-11-01T11:31:06.647" Score="1" ViewCount="43" Body="&lt;p&gt;Hello I am using measure density matrix function like that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for i in range (10):&#xA;    measurement_result = cirq.measure_density_matrix(state,indices=[0, 1, 2])&#xA;    print(&amp;quot;measurement&amp;quot;,measurement_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And my results are like that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cboKU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cboKU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, I have &lt;code&gt;([0, 0, 0], array([[0.36107099-0.36107099j, 0.        +0.j        ,&lt;/code&gt;  and I want to extract first part &lt;code&gt;[0, 0, 0]&lt;/code&gt; (the qubit part) and then I will count how many &lt;code&gt;[0, 0, 0]&lt;/code&gt; , &lt;code&gt;[0, 0, 1]&lt;/code&gt; &lt;code&gt;[0, 1, 0]&lt;/code&gt; … But I could not extract the first part of array. How can I get the first part &lt;code&gt;[0, 0, 0]&lt;/code&gt; ?&#xA;Thanks ...&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2020-11-04T15:57:23.823" LastActivityDate="2020-11-04T15:57:23.823" Title="Cirq - Measure Density Matrix Function Getting First Element" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;measurement&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14438" PostTypeId="1" CreationDate="2020-11-01T13:54:02.547" Score="2" ViewCount="76" Body="&lt;p&gt;Can someone please explain rigorously the reasoning behing non-ideal (&lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-concealing and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;-binding) bit commitment scheme and the impossibility of coin tossing.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Lo-Chau paper &amp;quot;Why quantum bit commitment and ideal coin tossing are impossible&amp;quot; has some of the details, but it looks like it omits a lot of details we could add 22 years later.&lt;/p&gt;&#xA;&lt;p&gt;And I could not understand Mayers' work &amp;quot;Trouble with quantum bit commitment&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;" OwnerUserId="13616" LastActivityDate="2020-12-16T17:37:01.787" Title="Non-ideal bit commitment and coin tossing" Tags="&lt;textbook-and-exercises&gt;&lt;cryptography&gt;&lt;fidelity&gt;&lt;communication&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14439" PostTypeId="1" CreationDate="2020-11-01T17:45:12.170" Score="1" ViewCount="68" Body="&lt;p&gt;I have followed an example that Qiskit provides &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/legacy_tutorials/aqua/linear_systems_of_equations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&#xA;I tried to increase the matrix size to 16x16 and change &lt;code&gt;num_ancillae&lt;/code&gt; and &lt;code&gt;num_time_slices&lt;/code&gt; in &lt;code&gt;create_eigs()&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# set the random seed to get the same pseudo-random matrix for every run&#xA;aqua_globals.random_seed = 0&#xA;matrix = random_hermitian(16)&#xA;vector = matrix.dot(np.array([1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1]))&#xA;&#xA;m = np.array(matrix)&#xA;&#xA;orig_size = len(vector)&#xA;matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix, vector)&#xA;&#xA;# Initialize eigenvalue finding module&#xA;eigs = create_eigs(matrix, 2, 2, True)&#xA;num_q, num_a = eigs.get_register_sizes()&#xA;&#xA;# Initialize initial state module&#xA;init_state = Custom(num_q, state_vector=vector)&#xA;&#xA;# Initialize reciprocal rotation module&#xA;reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)&#xA;&#xA;algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,&#xA;           init_state, reci, num_q, num_a, orig_size)&#xA;result = algo.run(QuantumInstance(Aer.get_backend('statevector_simulator'),&#xA;                                  seed_simulator=aqua_globals.random_seed,&#xA;                                  seed_transpiler=aqua_globals.random_seed))&#xA;print(&amp;quot;solution &amp;quot;, np.round(result['solution'], 5))&#xA;&#xA;result_ref = NumPyLSsolver(matrix, vector).run()&#xA;print(&amp;quot;classical solution &amp;quot;, np.round(result_ref['solution'], 5))&#xA;&#xA;print(&amp;quot;probability %f&amp;quot; % result['probability_result'])&#xA;fidelity(result['solution'], result_ref['solution'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;solution  [ 0.19079-0.95092j  0.26228+0.11189j -0.30868-0.55258j -0.7612 +1.61692j&#xA;  0.64665-0.26533j  1.20938-0.40916j -0.51564+1.98277j -0.08177-2.63386j&#xA;  1.14807-0.1218j   0.87798+1.39184j  0.8494 +0.00695j -0.0529 -0.11107j&#xA;  0.28287+0.74082j  1.3964 +0.23344j -2.15506+1.25378j  1.07591-0.70505j]&#xA;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&#xA; 3.+0.j 1.-0.j 1.+0.j 2.-0.j 3.-0.j 1.+0.j]&#xA;probability 0.000000&#xA;fidelity 0.040951&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I got very low fidelity when I change &lt;code&gt;num_ancillae&lt;/code&gt; to 2, if &lt;strong&gt;I increase &lt;code&gt;num_ancillae&lt;/code&gt; to 3, my kernel just died without showing any error.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;My questions are,&lt;/p&gt;&#xA;&lt;p&gt;What cause my kernel died? Is it normal?&lt;/p&gt;&#xA;&lt;p&gt;How does &lt;code&gt;num_ancillae&lt;/code&gt; and &lt;code&gt;num_time_slices&lt;/code&gt; affect the fidelity?&lt;/p&gt;&#xA;" OwnerUserId="13676" LastEditorUserId="55" LastEditDate="2020-11-04T15:55:42.433" LastActivityDate="2020-11-04T15:55:42.433" Title="How to increase matrix size and getting high fidelity for HHL algorithm in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14440" PostTypeId="2" ParentId="14436" CreationDate="2020-11-01T17:57:20.363" Score="0" Body="&lt;p&gt;This is more of a basic python usage question. You want&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;first_part = measurement_result[0]&lt;/code&gt; or &lt;code&gt;first_part, second_part = measurement_result&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-01T17:57:20.363" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14441" PostTypeId="2" ParentId="14439" CreationDate="2020-11-01T19:03:53.493" Score="1" Body="&lt;p&gt;If you are using &lt;strong&gt;IBMQ Experience&lt;/strong&gt; jupyter notebook environment, then there is a max memory of 8 GB that you can use.&lt;/p&gt;&#xA;&lt;p&gt;You can use the command: &lt;code&gt;!free -h&lt;/code&gt; to see how much memory you have left.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rdQ14.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rdQ14.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If your notebook is using more than this 8GB allocation memory, the Kernel will dies and restart automatically.&lt;/p&gt;&#xA;&lt;p&gt;I also see that you are using &lt;code&gt;statevector_simulator&lt;/code&gt; is can be very expensive. Instead, switched to &lt;code&gt;qasm_simulator&lt;/code&gt; or &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;. See if doing that will fix the memory problem.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-01T19:03:53.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14442" PostTypeId="2" ParentId="14395" CreationDate="2020-11-01T23:46:41.427" Score="0" Body="&lt;p&gt;If i understand your question correctly, i guess you could get, after transpiling &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, the final layout from &lt;code&gt;_layout&lt;/code&gt; property of a circuit  and remap the qubits in initial state preparation circuit &lt;span class=&quot;math-container&quot;&gt;$ V $&lt;/span&gt; to enforce this layout.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$ V $&lt;/span&gt; but if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is much more 'complicated' than &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, it should be fine.&lt;/p&gt;&#xA;&lt;p&gt;Here is some working code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import transpile, execute, Aer, IBMQ&#xA;&#xA;from qiskit.circuit import QuantumCircuit, ClassicalRegister&#xA;from qiskit.circuit.random import random_circuit&#xA;&#xA;from qiskit.transpiler import PassManager&#xA;from qiskit.transpiler.passes.layout import ApplyLayout, SetLayout&#xA;&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.quantum_info.random import random_unitary&#xA;&#xA;qasm  = Aer.get_backend('qasm_simulator')&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;device = provider.get_backend('ibmq_santiago')&#xA;&#xA;gates = device.configuration().basis_gates&#xA;coupling_map = device.configuration().coupling_map&#xA;&#xA;n = 3&#xA;n_iter = 2&#xA;&#xA;# init state&#xA;V = QuantumCircuit(n)&#xA;V.h(0)&#xA;for i in range(n - 1):&#xA;    V.cx(i, i + 1)&#xA;    &#xA;# random U&#xA;U = random_circuit(n, depth=5)&#xA;&#xA;# full algorithm - no optimization - just for reference&#xA;qc = U.repeat(n_iter)&#xA;qc.compose(V, front=True, inplace=True)&#xA;qc.measure_all()&#xA;&#xA;# transpile U&#xA;Utr = transpile(U, &#xA;                basis_gates=gates, &#xA;                coupling_map=coupling_map, &#xA;                optimization_level=3)&#xA;&#xA;layout = Utr._layout&#xA;mapping = layout.get_virtual_bits() # a map from virtual to physical qubits&#xA;&#xA;# enforce layout in V&#xA;passes_ = [SetLayout(layout), ApplyLayout()]&#xA;pm = PassManager(passes_)&#xA;Vm = pm.run(V)&#xA;&#xA;# full algorithm&#xA;circ = Utr.repeat(n_iter)&#xA;circ.compose(Vm, front=True, inplace=True)&#xA;&#xA;# add measurements&#xA;cr = ClassicalRegister(n)&#xA;circ.add_register(cr)&#xA;&#xA;# re-order classical registers &#xA;for q in U.qubits:&#xA;    circ.measure(mapping[q], &#xA;                 cr[q.index])&#xA;&#xA;&#xA;def simulate(qc):&#xA;    return execute(qc, qasm).result().get_counts()&#xA;&#xA;print(simulate(qc))&#xA;---&#xA;{'000': 484, '001': 17, '010': 6, '011': 47, '100': 10, '110': 19, '111': 441}&#xA;&#xA;print(simulate(circ))&#xA;---&#xA;{'000': 496, '001': 23, '010': 7, '011': 37, '100': 12, '101': 1, '110': 14, '111': 434}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-11-01T23:46:41.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14443" PostTypeId="2" ParentId="14264" CreationDate="2020-11-02T07:22:22.430" Score="4" Body="&lt;p&gt;To access and edit the quantum circuit and view the Bloch sphere of the quantum state online, click the &lt;a href=&quot;https://quantum-computing.ibm.com/composer/new-experiment?initial=N4IgdghgtgpiBcICsBaAjgVwEYEsAuABAM54S4A2OAXjAE4EDGA9gCYwEDmMYdEeTtEABoQaCESgIQAeQAKAUQByARQCCAZQCyBAEwA6AAwBuADpgcYBuQxsCJ0TEpYAjHosN7psGbS0YHAjQAbSQAXS8GPwCGEPCzMwALQKCDOLAAD2SAFjSGDGcACgAHHABKbNChYIBmNKJk1IjM4JyqoNqIqgbK4Odc-OKyiraOswZmoNaa3K7g1JHcgE9utpyvJN6Z5L62nS3Nhabtnsm0jaC9o%2BC91f2gneuz5NHLWZSTy7N66c7km5%2BxstprdfnMTh1hCA2ERIjgingcEwwFIQABfIA&quot; rel=&quot;nofollow noreferrer&quot;&gt;hyperlink&lt;/a&gt;(to run and see the Bloch sphere you have to sign in). The final code is also posted on the &lt;a href=&quot;https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit/blob/main/qiskit_code/5-qubitStabilizerCode.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;git-hub&lt;/a&gt;(some self-written script of the project is called in that file).&#xA;The circuit is as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ure0Y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ure0Y.png&quot; alt=&quot;IBM Q quantum circuit&quot; /&gt;&lt;/a&gt;&#xA;and the quantum circuit from the &lt;a href=&quot;https://shubhamchandak94.github.io/reports/stabilizer_code_report.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference&lt;/a&gt; is&#xA;&lt;a href=&quot;https://i.stack.imgur.com/61Q16.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/61Q16.png&quot; alt=&quot;circuit from reference&quot; /&gt;&lt;/a&gt;&#xA;(Chandak, S., Mardia, J., &amp;amp; Tolunay, M. Implementation and analysis of stabilizer codes in pyQuil.).&lt;/p&gt;&#xA;&lt;p&gt;After I completed the construction follows the upper reference, a global phase factor pi shows up for the logical state of |1&amp;gt;, so I appended a controlled-phase flip operation(CU1(pi), CX, CU1(pi), CX). To get the logical state of |0&amp;gt;, just remove the leftmost X gate.&lt;/p&gt;&#xA;&lt;p&gt;Here comes another reference:&#xA;&lt;a href=&quot;https://thesis.library.caltech.edu/2900/2/THESIS.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman, Daniel. &amp;quot;Stabilizer codes and quantum error correction.&amp;quot; arXiv preprint quant-ph/9705052 (1997).&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here comes my code, first I generated the physical qubits&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute&#xA;from qiskit.providers.aer import QasmSimulator&#xA;from qiskit.circuit.library.standard_gates import CU1Gate&#xA;from numpy import pi&#xA;def physicalQubits(ipt):&#xA;    qr=QuantumRegister(5)&#xA;    circ=QuantumCircuit(qr)&#xA;    if ipt==1:&#xA;        circ.x(qr[0])&#xA;    # controlled phase flip - if the input state is |1&amp;gt;,&#xA;    # then flip the global phase by pi&#xA;    CU1=CU1Gate(pi)&#xA;    circ.append(CU1,[qr[0],qr[1]])&#xA;    circ.cx(qr[0],qr[1])&#xA;    circ.append(CU1,[qr[0],qr[1]])&#xA;    circ.cx(qr[0],qr[1])&#xA;    &#xA;    circ.h(qr[4])&#xA;    circ.s(qr[4])&#xA;    # g1&#xA;    circ.cz(qr[4],qr[3])&#xA;    circ.cz(qr[4],qr[1])&#xA;    circ.cy(qr[4],qr[0])&#xA;    &#xA;    circ.h(qr[3])&#xA;    #g2&#xA;    circ.cz(qr[3],qr[2])&#xA;    circ.cz(qr[3],qr[1])&#xA;    circ.cx(qr[3],qr[0])&#xA;&#xA;    circ.h(qr[2])&#xA;    #g3&#xA;    circ.cz(qr[2],qr[4])&#xA;    circ.cz(qr[2],qr[3])&#xA;    circ.cx(qr[2],qr[0])&#xA;&#xA;    circ.h(qr[1])&#xA;    circ.s(qr[1])&#xA;    #g4&#xA;    circ.cz(qr[1],qr[4])&#xA;    circ.cz(qr[1],qr[2])&#xA;    circ.cy(qr[1],qr[0])&#xA;    return circ.to_gate()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fP5jP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fP5jP.png&quot; alt=&quot;result&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import StateFn,I&#xA;def ini(circ,qr,ipt):&#xA;    # Input binary form, and append [0] ahead for qr1 block.&#xA;    for i in range(len(ipt)):&#xA;        if ipt[len(ipt)-i-1]:&#xA;            circ.x(qr[i])&#xA;    return 0&#xA;&#xA;def Dec2Bi(num):&#xA;# Decimal to binary list.&#xA;    res=list(bin(num)[2:])&#xA;    return [int(res[i]) for i in range(len(res))]&#xA;&#xA;def checkPhases():&#xA;    operator=I.tensorpower(5)&#xA;    for i in range(32):&#xA;        qr=QuantumRegister(5)&#xA;        circ=QuantumCircuit(qr)&#xA;        ini(circ,qr,Dec2Bi(i))&#xA;        psi=StateFn(circ)&#xA;        phi1=StateFn(physicalQubits(0))&#xA;        print('expectation value for state '+bin(i)[2:]+' and the physical qubits of 0:')&#xA;        print((~psi@operator@phi1).eval())&#xA;        phi2=StateFn(physicalQubits(1))&#xA;        print('expectation value for state '+bin(i)[2:]+' and the physical qubits of 1:')&#xA;        print((~psi@operator@phi2).eval())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then call the function--&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;checkPhases()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You'll get the result and if the phase is non-zero, the result of the corresponding one should be a negative one.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;lt;psi0|psi1&amp;gt; equals one. I have checked the result but the code is omitted(you can still access the corresponding on &lt;a href=&quot;https://github.com/OccumRazor/implement-quantum-algotirhms-with-qiskit/blob/main/qiskit_code/5-qubitStabilizerCode.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;git-hub&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-03T01:31:40.300" LastActivityDate="2020-11-03T01:31:40.300" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14444" PostTypeId="2" ParentId="2372" CreationDate="2020-11-02T09:14:02.760" Score="0" Body="&lt;p&gt;I suggest you read &lt;a href=&quot;https://link.springer.com/article/10.1007/s10994-012-5316-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;Here comes an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UPSMe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UPSMe.png&quot; alt=&quot;Algo 1. find maximum distance&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For n points, this algorithm searches the distances(up to n^2 different distances) and it can get the distance_maximum in &lt;em&gt;O(n)&lt;/em&gt; expected time with high probability. For proof of this claim, see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9607014&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-03T13:43:47.030" LastActivityDate="2020-11-03T13:43:47.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14446" PostTypeId="1" AcceptedAnswerId="14447" CreationDate="2020-11-02T14:54:22.867" Score="3" ViewCount="91" Body="&lt;p&gt;Why does applying the following circuit on a &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt; state produce&#xA;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes  |+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$&lt;/span&gt;. Shouldn't it produce &lt;span class=&quot;math-container&quot;&gt;$ |+\rangle \otimes  |0\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DWlyj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DWlyj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13688" LastEditorUserId="1859" LastEditDate="2020-11-03T14:13:22.890" LastActivityDate="2020-11-03T14:13:22.890" Title="Confused about the application of Hadamard gate to uncorrelated qubits" Tags="&lt;qiskit&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-11-06T12:29:21.767" ContentLicense="CC BY-SA 4.0" />
  <row Id="14447" PostTypeId="2" ParentId="14446" CreationDate="2020-11-02T15:06:18.830" Score="4" Body="&lt;p&gt;Qubit ordering in Qiskit: qubit 0 is the rightmost one, i.e., the least significant bit.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-11-02T15:06:18.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14449" PostTypeId="2" ParentId="14264" CreationDate="2020-11-02T15:43:45.157" Score="1" Body="&lt;p&gt;I think &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22Z%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C1%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B1%2C1%2C%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%5D%2C%5B%22%E2%80%A2%22%2C1%2C1%2C1%2C%22Z%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt;&#xA;is another valid solution.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lfZk6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lfZk6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let me try to explain the thought process:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ | 0_L \rangle $&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\big( | 1_L \rangle \big)$&lt;/span&gt; is a superposition of all states with an even (odd) number of 1s. From &lt;span class=&quot;math-container&quot;&gt;$ | 0 \rangle^{\otimes 5} $&lt;/span&gt; state, we map the first 4 - qubits in a uniform superposition and we fix the parity with &lt;span class=&quot;math-container&quot;&gt;$ CNOT $&lt;/span&gt; gates. This will give even 1s if we begin from &lt;span class=&quot;math-container&quot;&gt;$ | 0 \rangle^{\otimes 4} |0 \rangle $&lt;/span&gt; and odd 1s from &lt;span class=&quot;math-container&quot;&gt;$ | 0 \rangle^{\otimes 4} |1 \rangle $&lt;/span&gt;. Now we should just fix the phases. We observe that a state in &lt;span class=&quot;math-container&quot;&gt;$ | 0_L \rangle $&lt;/span&gt; has -1 iff the number of pairs of 'adjacent' (in a ring topology) qubits both in &lt;span class=&quot;math-container&quot;&gt;$ |1 \rangle $&lt;/span&gt; state is odd. But we can compute this with a collection of &lt;span class=&quot;math-container&quot;&gt;$ CZ $&lt;/span&gt; gates. The only caveat is that &lt;span class=&quot;math-container&quot;&gt;$ | 0 \rangle^{\otimes 4} |1 \rangle $&lt;/span&gt; will be mapped to &lt;span class=&quot;math-container&quot;&gt;$ - |1_L \rangle $&lt;/span&gt;. But we can easily fix this with a &lt;span class=&quot;math-container&quot;&gt;$ Z $&lt;/span&gt; gate acting on the last qubit right in the beginning.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2020-11-06T08:53:58.480" LastActivityDate="2020-11-06T08:53:58.480" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14450" PostTypeId="1" CreationDate="2020-11-02T16:20:47.027" Score="1" ViewCount="94" Body="&lt;p&gt;In the paper by &lt;a href=&quot;https://arxiv.org/abs/1905.02666&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stamatopoulos et al.&lt;/a&gt;, the authors say that it is possible to load a distribution on a three qubit state to obtain:&lt;a href=&quot;https://i.stack.imgur.com/oaYZ0m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oaYZ0m.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In Qiskit finance this is performed using the uncertainty model function. My question is, how do you encode random numbers on qubit states?&lt;/p&gt;&#xA;&lt;p&gt;Later is their paper they report that you can use controlled-Y rotations to load a random distribution, this way:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mObqjm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mObqjm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;but I don't know how they pick the angle for the controlled rotation in order to obtain the desired number.&lt;/p&gt;&#xA;" OwnerUserId="13418" LastActivityDate="2021-05-02T00:06:55.673" Title="Loading a random distribution using controlled-Y rotations" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;applications&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14451" PostTypeId="2" ParentId="14450" CreationDate="2020-11-02T18:50:30.027" Score="0" Body="&lt;p&gt;From this paper: &lt;a href=&quot;https://arxiv.org/pdf/1903.01940.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entanglement types for two-qubit states with real amplitudes&lt;/a&gt;&#xA;there is a theorem on page 3 that said that:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If we consider the subsets of two qubits states &lt;span class=&quot;math-container&quot;&gt;$RQ_2$&lt;/span&gt; given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{ |w\rangle = w_1 |00 \rangle + w_2 |01\rangle + w_2|10 \rangle + w_4|11\rangle : w_i \in \mathbb{R}  \} $$&lt;/span&gt;&#xA;then for any pair of states &lt;span class=&quot;math-container&quot;&gt;$|\phi_1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_2 \rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$RQ_2$&lt;/span&gt; thre exists angleds &lt;span class=&quot;math-container&quot;&gt;$\theta_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_3$&lt;/span&gt; such that the circuit &lt;br&gt;&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9tNP8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9tNP8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt; &lt;br&gt; &lt;br&gt;&#xA;send &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle$&lt;/span&gt; tp &lt;span class=&quot;math-container&quot;&gt;$|\phi_2\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;We can decompose the CZ gate into &lt;span class=&quot;math-container&quot;&gt;$(I \otimes H) CNOT (I \otimes H)$&lt;/span&gt; and absorbed the Hadamard gate into the RY rotation as well to get to the formed in the paper you posted.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In term of determine the specific angles to obtain the right amplitude, I am not sure. But I guess you can use optimization techniques like VQE type technique to find the paprameters that can generates a state with amplitudes that is close to the one you have in mind.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Hopefully other people will provide more in depth answer :)&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-02T18:50:30.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14452" PostTypeId="1" CreationDate="2020-11-02T19:40:12.083" Score="1" ViewCount="71" Body="&lt;p&gt;I was running instances of &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-regular graphs with small number of vertices on Qiskit, and for &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt; ? Do we know the limits of QAOA for &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt; in order to decide with certainty that extra layers are required, given the graph?&lt;/p&gt;&#xA;" OwnerUserId="12408" LastEditorUserId="9118" LastEditDate="2020-11-03T14:13:03.677" LastActivityDate="2020-11-03T14:13:03.677" Title="Quantum Approximate Optimization Algorithm for $p=1$" Tags="&lt;qaoa&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14453" PostTypeId="2" ParentId="14452" CreationDate="2020-11-02T20:03:59.697" Score="2" Body="&lt;p&gt;We don't in general.&lt;/p&gt;&#xA;&lt;p&gt;There are instances where &lt;span class=&quot;math-container&quot;&gt;$p=2,3$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;You should take a look at this paper: &lt;a href=&quot;https://arxiv.org/pdf/1812.01041.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;Quantum Approximate Optimization Algorithm: Performance, Mechanism, andImplementation on Near-Term Devices&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-02T20:03:59.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14454" PostTypeId="1" CreationDate="2020-11-02T22:32:18.027" Score="2" ViewCount="22" Body="&lt;p&gt;Can someone please check if the following makes sense?&lt;/p&gt;&#xA;&lt;p&gt;We have a non-ideal coin-tossing scheme as follows. Alice and Bob know what &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt; are. Bob wins when the coin is 1.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Honest Alice commits a random bit &lt;span class=&quot;math-container&quot;&gt;$a\in \{0,1\}$&lt;/span&gt;. The state of their joint system with Bob is &lt;span class=&quot;math-container&quot;&gt;$|a\rangle ,$&lt;/span&gt; while Bob has &lt;span class=&quot;math-container&quot;&gt;$\rho_a^B=Tr{|a\rangle\langle a|}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Bob chooses a bit &lt;span class=&quot;math-container&quot;&gt;$a'\in\{0,1\}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Alice reveals her guess.&lt;/li&gt;&#xA;&lt;li&gt;The coin is &lt;span class=&quot;math-container&quot;&gt;$c=a\oplus a'$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Probability that &lt;span class=&quot;math-container&quot;&gt;$c=0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; and similarly, the probability that &lt;span class=&quot;math-container&quot;&gt;$c=1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;. I need to determine bias Bob can achieve, i.e. bounds on &lt;span class=&quot;math-container&quot;&gt;$\max|p_0-p_1|$&lt;/span&gt; if Bob is dishonest.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho_a^B$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\rho_0^B$&lt;/span&gt; and from &lt;span class=&quot;math-container&quot;&gt;$\rho_1^B$&lt;/span&gt;.&#xA;By Holevo-Helstrom his probability of guessing correctly is at most &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2}+\frac{1}{4}||\rho_0^B-\rho_1^B||_1.$$&lt;/span&gt; Suppose, we are given that &lt;span class=&quot;math-container&quot;&gt;$F(\rho_0^B,\rho_1^B)\ge 1-\delta.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have the inequalities:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any feedback, any additional comments, references and suggestions are greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13616" LastEditorUserId="13616" LastEditDate="2020-11-03T14:00:11.310" LastActivityDate="2020-11-03T14:00:11.310" Title="Non-ideal coin tossing" Tags="&lt;textbook-and-exercises&gt;&lt;fidelity&gt;&lt;communication&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14455" PostTypeId="1" CreationDate="2020-11-03T00:12:59.307" Score="3" ViewCount="53" Body="&lt;p&gt;The k-state is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |⟩ = \dfrac{\sqrt{3}|100⟩ − ^{π/4}|010⟩ + \sqrt{2}|001⟩}{ \sqrt{6}}$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="13695" LastEditorUserId="55" LastEditDate="2020-11-04T15:47:10.303" LastActivityDate="2020-11-04T15:47:10.303" Title="What is k-state and how to go about creating a circuit?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14456" PostTypeId="1" CreationDate="2020-11-03T02:35:42.100" Score="2" ViewCount="122" Body="&lt;p&gt;Given two arbitrary density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma\in \mathcal{H}$&lt;/span&gt; (they have unit trace and are positive), how do I go about finding a possible quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho)=\sigma$&lt;/span&gt;? &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and one would like to manipulate it ( &lt;span class=&quot;math-container&quot;&gt;$\leftrightarrow$&lt;/span&gt;  subject it to a given quantum channel) such that it ends up in a target state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. As such, this question must be addressed in a plethora of quantum experiments... (Maybe someone can also simply point me to some relevant literature?)&lt;/p&gt;&#xA;" OwnerUserId="9082" LastEditorUserId="55" LastEditDate="2020-11-04T15:49:47.117" LastActivityDate="2020-11-04T15:49:47.117" Title="How can I find a quantum channel connecting two arbitrary quantum states?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14457" PostTypeId="1" AcceptedAnswerId="14459" CreationDate="2020-11-03T05:56:48.520" Score="4" ViewCount="47" Body="&lt;p&gt;For the Hadarmard Hamiltonian, &lt;span class=&quot;math-container&quot;&gt;$\hat H = (\hat X+\hat Z)/\sqrt 2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\hat X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat Z$&lt;/span&gt; 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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat n = \frac{1}{\sqrt2}\begin{bmatrix}&#xA;           1 \\&#xA;           0 \\&#xA;           1 \\&#xA;         \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I'm wondering if I have another Hamiltonian defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat H_1 = \frac{1}{\sqrt3}(\hat X +\hat Z +\hat I)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\hat I$&lt;/span&gt; is the identity operator. Then what the role &lt;span class=&quot;math-container&quot;&gt;$\hat I$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2020-11-04T15:50:49.087" LastActivityDate="2020-11-04T15:50:49.087" Title="How does adding an identity to an Hamiltonian affect the corresponding time-evolution in the Bloch sphere?" Tags="&lt;hamiltonian-simulation&gt;&lt;bloch-sphere&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14458" PostTypeId="2" ParentId="14367" CreationDate="2020-11-03T07:27:12.233" Score="2" Body="&lt;p&gt;Until a better solution is provided, I hope this suggestion is helpful.&lt;/p&gt;&#xA;&lt;p&gt;Reducing MaxCut to Max-2SAT is straightforward (&lt;a href=&quot;https://cs.stackexchange.com/a/93492/115012&quot;&gt;https://cs.stackexchange.com/a/93492/115012&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;And there are many free, highly optimized MaxSAT solvers.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2020-11-03T07:27:12.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14459" PostTypeId="2" ParentId="14457" CreationDate="2020-11-03T07:39:41.333" Score="3" Body="&lt;p&gt;The identity operator does not change the axis of rotation, because it does not change the eigenvectors of your Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; not &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;), nothing changes in the Bloch sphere picture.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-03T07:39:41.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14460" PostTypeId="2" ParentId="14455" CreationDate="2020-11-03T07:54:54.170" Score="2" Body="&lt;p&gt;I did the following: let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be the single-qubit unitary&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\frac{1}{\sqrt{3}}\left(\begin{array}{cc} \sqrt{2} &amp;amp; 1 \\ -1 &amp;amp; \sqrt{2}\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;This is a partial rotation about the y axis. We use this definition to construct a circuit&lt;a href=&quot;https://i.stack.imgur.com/CsiV1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CsiV1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's the thinking: after the Hadamard, I've got &lt;span class=&quot;math-container&quot;&gt;$(|000\rangle+|100\rangle)/\sqrt{2}$&lt;/span&gt;, so the &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, we achieve that lack of disturbance. Thus, really what we have to concentrate on is a circuit that converts &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; on the last two qubits into &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2}|01\rangle-e^{i\pi/4}|10\rangle)/\sqrt{3}$&lt;/span&gt;. We'll be able to get the phase right with a &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate at the end, so you just needed to convert &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2}|01\rangle-e^{i\pi/4}|10\rangle)/\sqrt{3}$&lt;/span&gt;. The gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a large part of doing that.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-11-03T12:47:20.877" LastActivityDate="2020-11-03T12:47:20.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14461" PostTypeId="1" AcceptedAnswerId="14475" CreationDate="2020-11-03T11:59:55.643" Score="4" ViewCount="56" Body="&lt;p&gt;The generalization of probability distributions on &lt;strong&gt;density matrices&lt;/strong&gt; allows to define &lt;a href=&quot;https://en.wikipedia.org/wiki/Jensen%E2%80%93Shannon_divergence#Quantum_Jensen%E2%80%93Shannon_divergence&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum Jensen–Shannon divergence&lt;/a&gt; (QJSD), which uses von Neumann entropy. Does QJSD appear in any quantum algorithms or texts on quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="9118" LastEditorUserId="55" LastEditDate="2020-11-04T20:37:02.443" LastActivityDate="2020-11-04T20:37:02.443" Title="Does the quantum Jensen-Shannon divergence appear in any quantum algorithms or texts on quantum computing?" Tags="&lt;resource-request&gt;&lt;density-matrix&gt;&lt;entropy&gt;&lt;information-theory&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14462" PostTypeId="2" ParentId="14452" CreationDate="2020-11-03T12:47:20.507" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1907.04769&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. One could try to characterize such situations with a few graph properties that can help decide whether or not QAOA at depth 1 is &amp;quot;enough&amp;quot; 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 &lt;a href=&quot;https://arxiv.org/abs/2001.08271&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-11-03T12:47:20.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14463" PostTypeId="1" CreationDate="2020-11-03T13:39:19.027" Score="4" ViewCount="62" Body="&lt;p&gt;I have read in several &lt;a href=&quot;https://arxiv.org/abs/0801.1544&quot; rel=&quot;nofollow noreferrer&quot;&gt;papers&lt;/a&gt; now that information-theoretically secure multi-party quantum computation (MQPC) with a dishonest majority (&lt;span class=&quot;math-container&quot;&gt;$t \geq n/2$&lt;/span&gt;) 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.&lt;/p&gt;&#xA;" OwnerUserId="11977" LastEditorUserId="11977" LastEditDate="2020-11-04T16:11:14.620" LastActivityDate="2020-11-04T16:49:53.697" Title="(Why) does unconditionally secure multi-party quantum computation imply quantum bit commitment?" Tags="&lt;cryptography&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14464" PostTypeId="1" AcceptedAnswerId="14465" CreationDate="2020-11-03T14:14:35.407" Score="2" ViewCount="29" Body="&lt;p&gt;I am confused about one point in the proof on the lower bounds in Kaye, Laflamme Mosca's lemma 9.3.6.&lt;/p&gt;&#xA;&lt;p&gt;Context: &lt;span class=&quot;math-container&quot;&gt;$|\psi_T\rangle$&lt;/span&gt; is the final state of the search algorithm that started on the all-zero string.&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi^x_T\rangle$&lt;/span&gt; is the final state of the search algorithm that started on the non-zero string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. We want to distinguish the two states with probability at least 2/3.&lt;/p&gt;&#xA;&lt;p&gt;Need to show that &lt;span class=&quot;math-container&quot;&gt;$|||\psi_T\rangle-|\psi^x_T\rangle||\ge c&amp;gt;0.338$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Tools to use:&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|||\psi_T\rangle-|\psi^x_T\rangle||\le d,$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi_T | \psi_T^x\rangle|\ge 1-\frac{d^2}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Any procedure that on input &lt;span class=&quot;math-container&quot;&gt;$|\psi_z\rangle$&lt;/span&gt; guesses whether &lt;span class=&quot;math-container&quot;&gt;$z=x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$z=y$&lt;/span&gt; guesses with the maximum achievable probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}+\frac{1}{2}\sqrt{1-|\langle\psi_x | \psi_y\rangle |^2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My reasoning: Suppose instead that &lt;span class=&quot;math-container&quot;&gt;$|||\psi_T\rangle-|\psi^x_T\rangle||&amp;lt; c$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{3}=\frac{1}{2}+\frac{1}{2}\sqrt{1-|\langle\psi_T | \psi_t^x \rangle |^2}&amp;lt; \frac{1}{2}+\frac{c}{2\sqrt{2}}$&lt;/span&gt;, so we need &lt;span class=&quot;math-container&quot;&gt;$c&amp;gt;\frac{\sqrt{2}}{3}\simeq 0.4714$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Question. how did the book get 0.338? Am I misisng something?&lt;/p&gt;&#xA;" OwnerUserId="13616" LastEditorUserId="13616" LastEditDate="2020-11-03T14:44:20.347" LastActivityDate="2020-11-03T14:44:20.347" Title="Hybrid lower bound proof Kaye Laflamme Mosca (lemma 9.3.6)" Tags="&lt;grovers-algorithm&gt;&lt;complexity-theory&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14465" PostTypeId="2" ParentId="14464" CreationDate="2020-11-03T14:41:13.940" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ |\langle \psi_T | \psi_t^x \rangle| \geq 1 - \frac{c^2}{2} \implies &#xA;  |\langle \psi_T | \psi_t^x \rangle|^2 \geq \big(1 - \frac{c^2}{2} \big)^2 \implies \\&#xA;\frac{2}{3} = \frac{1}{2} + \frac{1}{2} \sqrt{1 - |\langle \psi_T | \psi_t^x \rangle|^2 } \leq &#xA;\frac{1}{2} + \frac{1}{2} \sqrt{1 - \big(1 - \frac{c^2}{2} \big)^2 } \implies&#xA;c \geq \sqrt{2 - \frac{4\sqrt{2}}{3}} \approx 0.338$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-11-03T14:41:13.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14467" PostTypeId="1" AcceptedAnswerId="14468" CreationDate="2020-11-03T16:24:06.677" Score="2" ViewCount="91" Body="&lt;p&gt;I 'm trying to reproduce the code given in the Qiskit summer school &lt;a href=&quot;https://www.youtube.com/watch?v=iJX794qJIpY&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The code is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# initialization&#xA;&#xA;import numpy as np&#xA;&#xA;# import Qiskit&#xA;&#xA;from qiskit import IBMQ, BasicAer&#xA;from qiskit.providers.ibmq import least_busy&#xA;from qiskit import QuantumCircuit, execute&#xA;from qiskit.tools.jupyter import *&#xA; provider= iBMQ.load.account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but I am getting this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; NameError                                 Traceback (most recent call last)&#xA; &amp;lt;ipython-input-9-5e15427b4944&amp;gt; in &amp;lt;module&amp;gt;&#xA;  9 from qiskit import QuantumCircuit, execute&#xA;  10 from qiskit.tools.jupyter import *&#xA;  ---&amp;gt; 11 provider= iBMQ.load.account()&#xA;  12 &#xA;  13 #import basic plot tools&#xA;&#xA;  NameError: name 'iBMQ' is not defined&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The same question was asked so I tried the answer to install IBM Q provider using the command&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  pip install qiskit-ibmq-provider &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but still I am getting the same error.&lt;/p&gt;&#xA;&lt;p&gt;My python version is 3.8.3 and qiskit version is '0.16.0'&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;   {'qiskit-terra': '0.16.0',&#xA;   'qiskit-aer': '0.7.0',&#xA;   'qiskit-ignis': '0.5.0',&#xA;   'qiskit-ibmq-provider': '0.11.0',&#xA;   'qiskit-aqua': '0.8.0',&#xA;   'qiskit': '0.23.0'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13698" LastEditorUserId="9006" LastEditDate="2020-11-04T08:03:17.343" LastActivityDate="2020-11-04T08:03:17.343" Title="A problem with IBM Q, NameError: name 'iBMQ' is not defined" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14468" PostTypeId="2" ParentId="14467" CreationDate="2020-11-03T16:26:27.083" Score="3" Body="&lt;p&gt;The error is you have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;provider= iBMQ.load.account()&lt;/code&gt; &lt;strong&gt;instead of&lt;/strong&gt; &lt;code&gt;provider= IBMQ.load_account()&lt;/code&gt; on &lt;strong&gt;line 11&lt;/strong&gt; of the code.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-03T16:30:49.080" LastActivityDate="2020-11-03T16:30:49.080" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14469" PostTypeId="2" ParentId="14356" CreationDate="2020-11-03T16:49:59.550" Score="1" Body="&lt;p&gt;Indeed, the second qubit is doing nothing in these circuits, so you can ignore it.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-11-03T16:49:59.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14470" PostTypeId="1" CreationDate="2020-11-03T17:39:24.813" Score="0" ViewCount="79" Body="&lt;p&gt;To my understanding, the &lt;code&gt;WeightedPauliOperator&lt;/code&gt; class in discontinued, and should no longer be used when dealing with Pauli operators. So how should I perform arithmetic with paulis?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;( 3 X_1 Y_3 + 5 Z_2 X_0 ) (Z_3+2X_2X_4) = \ \text{(expanded version)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-11-04T15:55:37.053" LastActivityDate="2020-11-04T15:55:37.053" Title="What is the proper way of doing Pauli arithmetic in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14471" PostTypeId="2" ParentId="14470" CreationDate="2020-11-03T18:13:37.643" Score="1" Body="&lt;p&gt;The legacy operators in Qiskit Aqua (like &lt;code&gt;WeightedPauliOperator&lt;/code&gt;) were replaced by&#xA;the operator flow function. The documentation for that replacement is here: &lt;a href=&quot;https://github.com/Qiskit/rfcs/blob/master/0003-Aqua_0.7_operator_redesign.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/rfcs/blob/master/0003-Aqua_0.7_operator_redesign.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, the class is not deprecated and you are free to use it, even when it lives in the legacy module.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-11-03T18:24:54.860" LastActivityDate="2020-11-03T18:24:54.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14472" PostTypeId="1" AcceptedAnswerId="14473" CreationDate="2020-11-03T20:49:55.843" Score="2" ViewCount="132" Body="&lt;p&gt;Can anyone explain me the behaviour of these two circuits? They contain Hadmard and rotation gates before the Toffoli gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jfQPq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jfQPq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Results of simulation:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/GdKhw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GdKhw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13137" LastEditorUserId="55" LastEditDate="2020-11-10T17:19:04.933" LastActivityDate="2020-11-10T17:19:04.933" Title="Toffoli circuit explanation" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ClosedDate="2020-11-16T18:54:52.047" ContentLicense="CC BY-SA 4.0" />
  <row Id="14473" PostTypeId="2" ParentId="14472" CreationDate="2020-11-03T21:17:40.587" Score="4" Body="&lt;p&gt;&lt;strong&gt;In the first circuit&lt;/strong&gt; after Hadamard gates (I suppose that initial state is &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and I will use Qiskit's convention for labeling the qubits &lt;span class=&quot;math-container&quot;&gt;$|q_2 q_1 q_0 \rangle$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle \xrightarrow[]{\text{Hadamards}} \frac{1}{2}|0\rangle(|00\rangle + |01\rangle+|10\rangle + |11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$R_x(0) = I$&lt;/span&gt;, so it does noting. Then comes Toffoli gate (apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on the &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; qubit if the other two (control qubits) are in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\xrightarrow[]{\text{Toffoli}} \frac{1}{2}|0\rangle(|00\rangle + |01\rangle+|10\rangle) + \frac{1}{2}|111\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;In the second circuit&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi) = -iX$&lt;/span&gt; (we can neglect &lt;span class=&quot;math-container&quot;&gt;$-i $&lt;/span&gt; term because it is a global phase here) and the combained action of Hadamards plus &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|000\rangle \xrightarrow[]{\text{Hadamards + }R_x(\pi)} \frac{1}{2}|1\rangle(|00\rangle + |01\rangle+|10\rangle + |11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then Toffoli:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\xrightarrow[]{\text{Toffoli}} \frac{1}{2} |1\rangle (|00\rangle + |01\rangle+|10\rangle) + \frac{1}{2}|011\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2020-11-03T21:35:47.510" LastActivityDate="2020-11-03T21:35:47.510" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14474" PostTypeId="2" ParentId="14456" CreationDate="2020-11-03T22:25:59.983" Score="2" Body="&lt;p&gt;Given two states &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt;, consider their spectral decomposition, &lt;span class=&quot;math-container&quot;&gt;$$\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} |. $$&lt;/span&gt; I'm assuming, for simplicity, that &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\rho \mapsto \sigma$&lt;/span&gt; breaks down into two steps: (i) transforming their eigenvectors and (ii) transforming their eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;To transform their eigenvectors, consider the following unitary, &lt;span class=&quot;math-container&quot;&gt;$U = \sum\limits_{j=1}^{d} | \phi_{j} \rangle \langle  \psi_{j} | $&lt;/span&gt;. It is easy to check that the action of the unitary channel is to transform the eigenvectors, &lt;span class=&quot;math-container&quot;&gt;$$\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.$$&lt;/span&gt;&#xA;Therefore, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}(\rho) = \sum\limits_{j=1}^{d} p_{j} | \phi_{j} \rangle \langle  \phi_{j} | $&lt;/span&gt;, that is, the eigenvectors have been transformed. More generally, any time one wants to transform an orthonormal set of states &lt;span class=&quot;math-container&quot;&gt;$\{ |\psi_{j} \rangle \} \mapsto \{ |\phi_{j} \rangle \}$&lt;/span&gt;, we construct a unitary of the form above.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt; above, both &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}(\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; are in the same eigenbasis, so transforming the eigenvalues has a &amp;quot;classical&amp;quot; flavor to it. I can't think of an answer for the most general case (off the top of my head), but if &lt;span class=&quot;math-container&quot;&gt;$\{ p_{j} \}$&lt;/span&gt; is ``less disordered'' than &lt;span class=&quot;math-container&quot;&gt;$\{ q_{j} \}$&lt;/span&gt; (in the sense of &lt;a href=&quot;https://en.wikipedia.org/wiki/Majorization&quot; rel=&quot;nofollow noreferrer&quot;&gt;vector majorization&lt;/a&gt;), then, one can show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{spec}(\rho) \succ \operatorname{spec}(\sigma) \Longleftrightarrow \exists \mathcal{E}(\rho)=\sigma, $$&lt;/span&gt;&#xA;where, &lt;span class=&quot;math-container&quot;&gt;$\vec{v} \succ \vec{w}$&lt;/span&gt; is vector majorization, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is a unital CPTP map, and &lt;span class=&quot;math-container&quot;&gt;$\text{spec}(\rho)$&lt;/span&gt; the spectrum of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. A proof of this can be found in &lt;a href=&quot;https://michaelnielsen.org/blog/talks/2002/maj/book.ps&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen's (other!) book&lt;/a&gt; (warning: the book is in a .ps format).&lt;/p&gt;&#xA;&lt;p&gt;Therefore, given two states, &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt;, if &lt;span class=&quot;math-container&quot;&gt;$\operatorname{spec}(\rho) \succ \operatorname{spec}(\sigma)$&lt;/span&gt; then this transformation can be achieved by using a unitary channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt; to transform the eigenvectors and a non-unitary channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; to transform the eigenvalues; composing these two, we have, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E} \circ \mathcal{U}$&lt;/span&gt; is the channel that does the transformation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; For &lt;span class=&quot;math-container&quot;&gt;$\rho,\sigma$&lt;/span&gt; pure, the above construction tells us that we only need a unitary transformation to connect them, as expected.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-11-04T08:12:45.583" LastActivityDate="2020-11-04T08:12:45.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14475" PostTypeId="2" ParentId="14461" CreationDate="2020-11-03T22:32:49.650" Score="5" Body="&lt;p&gt;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].&lt;/p&gt;&#xA;&lt;p&gt;More generally the Holevo information is an upper bound for a quantity called &amp;quot;accessible information&amp;quot; which is (roughly speaking) the maximum information you can learn from an optimal measurement performed on an ensemble of quantum states.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[1] Holevo, A. S. (1973). Bounds for the quantity of information transmitted by a quantum communication channel. Problemy Peredachi Informatsii, 9(3), 3-11.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-11-03T22:32:49.650" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14476" PostTypeId="1" CreationDate="2020-11-04T09:17:20.090" Score="1" ViewCount="85" Body="&lt;p&gt;Why 2 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate acts like a superposition generator?&lt;/p&gt;&#xA;" OwnerUserId="13670" LastEditorUserId="55" LastEditDate="2020-11-10T17:18:33.307" LastActivityDate="2020-11-10T17:18:33.307" Title="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?" Tags="&lt;quantum-gate&gt;&lt;hadamard&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14477" PostTypeId="2" ParentId="14476" CreationDate="2020-11-04T09:25:03.057" Score="10" Body="&lt;p&gt;The reason for this is because the inverse of Hadamard gate is itself. That is, giving that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H^{-1} =  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so therefore, &lt;span class=&quot;math-container&quot;&gt;$$HH|\psi\rangle = H H^{-1} |\psi \rangle = I |\psi \rangle = |\psi\rangle \ \ \ \textrm{where $I$ is the Identity operator.}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now when &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |0 \rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Thus giving you a 100% probability is it the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To see this in the geometric sense, applying two consecutive Hadamard gates to the qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is like doing the following rotations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p92dO.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p92dO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first Hadamard gate rotate the qubit in the red trajectory to the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \dfrac{|0 \rangle + |1 \rangle}{\sqrt{2}} $&lt;/span&gt;. Then the second Hadamard gate rotate the qubit in the blue trajectory, back to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; again.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-04T09:30:12.890" LastActivityDate="2020-11-04T09:30:12.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14478" PostTypeId="2" ParentId="14456" CreationDate="2020-11-04T10:09:40.887" Score="3" Body="&lt;p&gt;Given a state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;, the replacement channel is defined by the action&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}_{\sigma}(\rho) = \mathrm{Tr}(\rho) \sigma.&#xA;$$&lt;/span&gt;&#xA;This channel trivially connects any state to &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. Indeed, we can view this channel as the composition of the trace channel &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}: \mathcal{H}_1 \rightarrow \mathbb{C}$&lt;/span&gt; and a preparation channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{\mathrm{prep}} : \mathbb{C} \rightarrow \mathcal{H}_2$&lt;/span&gt; where the action of the second channel is defined as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{\mathrm{prep}}(\alpha) \rightarrow \alpha \sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To show the replacement channel is indeed a channel, by the spectral theorem we can define an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle \}_i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sigma = \sum_i \lambda_i |\psi_i \rangle \langle \psi_i |$&lt;/span&gt;. Then take an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle\}_i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; and define the Kraus operators&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K_{i,j} = \sqrt{\lambda_i} |\psi_i \rangle \langle j |.&#xA;$$&lt;/span&gt;&#xA;Then we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\mathcal{E}(\rho) &amp;amp;= \sum_{i,j} K_{i,j} \rho K_{i,j}^* \\&#xA;&amp;amp;= \sum_{i,j} \lambda_i |\psi_i \rangle \langle j | \rho |j \rangle \langle\psi_i | \\&#xA;&amp;amp;= \sum_i \lambda_i |\psi_i \rangle \langle \psi_i | \sum_j \langle j | \rho | j \rangle \\&#xA;&amp;amp;= \mathrm{Tr}[\rho] \sigma&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;and also&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\sum_{i,j} K_{i,j}^* K_{i,j} &amp;amp;= \sum_{i,j} \lambda_i |j \rangle \langle \psi_i | \psi_i \rangle \langle j | \\&#xA;&amp;amp;= \sum_{i,j} \lambda_i |j \rangle \langle j | \\&#xA;&amp;amp;= \sum_j |j \rangle \langle j | \\&#xA;&amp;amp;= I&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-04T10:09:40.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14479" PostTypeId="2" ParentId="14417" CreationDate="2020-11-04T10:35:27.240" Score="1" Body="&lt;p&gt;Thank you all for your help tracking this down. For future reference, the culprit was the usage of the function &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.initialize.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantumCircuit.initialize(params, qubits)&lt;/a&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="13667" LastActivityDate="2020-11-04T10:35:27.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14480" PostTypeId="1" CreationDate="2020-11-04T13:01:00.307" Score="4" ViewCount="133" Body="&lt;p&gt;In matrix notation, say I have the vector &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1 \\ 0 \end{bmatrix}$&lt;/span&gt;. It is currently represented in the computational basis &lt;span class=&quot;math-container&quot;&gt;$\{\begin{bmatrix} 1 \\ 0\end{bmatrix}, \begin{bmatrix} 0 \\ 1\end{bmatrix}\}$&lt;/span&gt;. I want to now represent it in the basis &lt;span class=&quot;math-container&quot;&gt;$\{\begin{bmatrix} \frac{1}{\sqrt 2} \\ \frac{1}{\sqrt 2}\end{bmatrix}, \begin{bmatrix} \frac{1}{\sqrt 2} \\ \frac{-1}{\sqrt 2}\end{bmatrix}\}$&lt;/span&gt;. To accomplish this, I use the correct change of basis matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix} \frac{1}{\sqrt 2} &amp;amp; \frac{1}{\sqrt 2} \\ \frac{1}{\sqrt 2} &amp;amp;\frac{-1}{\sqrt 2}\end{bmatrix} \begin{bmatrix} 1 \\ 0\end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt 2} \\ \frac{1}{\sqrt 2}\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When I see that final vector, I &lt;em&gt;know&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Now, when I do the same thing with bra-ket notation, I have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(|0\rangle \langle + | + |1 \rangle \langle -|\right)|0\rangle = \frac{|0\rangle + |1\rangle}{\sqrt 2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When I see the final result here, do I internally read &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;The explicit writing of bases in the bra-ket notation I find slightly confusing.&lt;/p&gt;&#xA;" OwnerUserId="2832" LastEditorUserId="55" LastEditDate="2021-02-21T13:19:17.290" LastActivityDate="2021-02-21T13:19:17.290" Title="Difference between change of basis in bra-ket notation and matrix notation" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;matrix-representation&gt;&lt;notation&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14481" PostTypeId="2" ParentId="14480" CreationDate="2020-11-04T14:24:09.353" Score="3" Body="&lt;p&gt;Expressing your first equality in bra-ket notation is simply &lt;span class=&quot;math-container&quot;&gt;$$H \vert 0 \rangle = \vert + \rangle.$$&lt;/span&gt;  In the spirit of your second equality, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be expressed as &lt;span class=&quot;math-container&quot;&gt;$$H \equiv \vert + \rangle \langle 0 \vert + \vert - \rangle \langle 1 \vert.$$&lt;/span&gt;  The advantage of this more verbose expression of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is that it makes it very clear how &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; transforms the computational basis states:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H \vert 0 \rangle = \vert + \rangle \langle 0 \vert 0 \rangle + \vert - \rangle \langle 1 \vert 0 \rangle = \vert + \rangle,$$&lt;/span&gt;&#xA;since the value of the inner products, &lt;span class=&quot;math-container&quot;&gt;$\langle 0 \vert 0 \rangle = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle 1 \vert 0 \rangle = 0$&lt;/span&gt;, should be immediately recognized.  Note that the RHS of this equation gives the state in terms of the &lt;span class=&quot;math-container&quot;&gt;$\lbrace \vert + \rangle, \, \vert - \rangle \rbrace$&lt;/span&gt; basis.  In the RHS of your second equality, the state is still represented over the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-11-04T15:03:53.140" LastActivityDate="2020-11-04T15:03:53.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14482" PostTypeId="2" ParentId="14463" CreationDate="2020-11-04T16:49:53.697" Score="5" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$f(a_0,a_1,b_0,b_1)$&lt;/span&gt; that takes as input two private bits &lt;span class=&quot;math-container&quot;&gt;$a_0,a_1$&lt;/span&gt; from Alice (the two different messages) and two bits &lt;span class=&quot;math-container&quot;&gt;$b_0,b_1$&lt;/span&gt; from Bob (first bit being Bob's choice of message to read and second a private key), and produces &lt;span class=&quot;math-container&quot;&gt;$$f(a_0,a_1,b_0,b_1)=a_{b_0}\oplus b_1$$&lt;/span&gt; To get OT out of this, Bob simply has to randomize &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="13715" LastActivityDate="2020-11-04T16:49:53.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14483" PostTypeId="1" AcceptedAnswerId="14513" CreationDate="2020-11-04T16:55:50.663" Score="0" ViewCount="34" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; # initialization&#xA;&#xA;import numpy as np&#xA;&#xA;# import Qiskit&#xA;&#xA;from qiskit import IBMQ, BasicAer&#xA;from qiskit.providers.ibmq import least_busy&#xA;from qiskit import QuantumCircuit, execute&#xA;from qiskit.tools.jupyter import *&#xA;#provider= IBMQ.load.account()&#xA; provider= IBMQ.load_account()&#xA;&#xA;#import basic plot tools&#xA;from qiskit.visualization import plot_histogram&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is the Dj function&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; def dj_oracle(case, n):&#xA;#We need to make a QuantumCircuit object to return&#xA;#This circuit has n+1 qubits: the size of the input,&#xA;#plus one output qubit&#xA;oracle_qc=QuantumCircuit(n+1)&#xA;&#xA;#First, let's deal with the case in which oracle is balanced&#xA;&#xA;if case == &amp;quot;balanced&amp;quot;:&#xA;    # We apply controlled-NOT gates for each qubit, using the&#xA;    #output qubit as target&#xA;    &#xA;    for qubit in range(n):&#xA;        oracle_qc.cx(qubit, n)&#xA;        &#xA; # case in oracle is constant&#xA;if case == &amp;quot;constant&amp;quot;:&#xA;&#xA;# First decide what the fixed output of the oracle will be&#xA;# (either always 0 or always 1)&#xA; &#xA;    output = np.random.randint(2)&#xA;    &#xA;if output == 1:&#xA;    &#xA;    oracle_qc.x(n)&#xA;    &#xA;oracle_gate = oracle_qc.to_gate()&#xA;oracle_gate.name =&amp;quot;Oracle&amp;quot;&#xA;return oracle_gate&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and Here is the dj_algorithm&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  def dj_algorithm(n, case='random'):&#xA;dj_circuit=QuantumCircuit(n+1, n)&#xA;# Set up the input register:&#xA;for qubit in range(n):&#xA;    dj_circuit.h(qubit)&#xA;#And set up the output qubit:&#xA;dj_circuit.x(n)&#xA;dj_circuit.h(n)&#xA;#Let's append the oracle gate to our circuit:&#xA;&#xA;if case == 'random':&#xA;    random = np.random.randint(2)&#xA;    if random == 0:&#xA;        case = 'constant'&#xA;else: &#xA;    case = 'balanced'&#xA;    oracle = dj_oracle(case, n)&#xA;    dj_circuit.append(oracle, range(n+1))&#xA; # Finally, perform the H-gates again and measure:&#xA;for i in range(n):&#xA;        dj_circuit.h(i)&#xA;        dj_circuit.measure(i,i)&#xA;return dj_circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now when I want to use the local simulator to get the results, I face the UnboundLocalError, Can anybody help me to solve it?&lt;/p&gt;&#xA;&lt;p&gt;This is the error I get:&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;pre&gt;&lt;code&gt;  UnboundLocalError                         Traceback (most recent call last)&#xA;  &amp;lt;ipython-input-112-f0c5e2ae7e9a&amp;gt; in &amp;lt;module&amp;gt;&#xA;  2 backend = BasicAer.get_backend('qasm_simulator')&#xA;  3 shots = 1024&#xA;  ----&amp;gt; 4 dj_circuit = dj_algorithm(n,'constant')&#xA;  5 results = execute(dj_circuit, backend=backend, shots=shots).result()&#xA;  6 answer = results.get_counts()&#xA;&#xA; &amp;lt;ipython-input-89-6104e1173619&amp;gt; in dj_algorithm(n, case)&#xA; 15     else:&#xA; 16         case = 'balanced'&#xA; ---&amp;gt; 17         oracle = dj_oracle(case, n)&#xA; 18         dj_circuit.append(oracle, range(n+1))&#xA; 19      # Finally, perform the H-gates again and measure:&#xA;&#xA; &amp;lt;ipython-input-110-75bb51aa8b15&amp;gt; in dj_oracle(case, n)&#xA; 22         output = np.random.randint(2)&#xA; 23 &#xA; ---&amp;gt; 24     if output == 1:&#xA; 25 &#xA; 26         oracle_qc.x(n)&#xA;&#xA; UnboundLocalError: local variable 'output' referenced before assignment&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13698" LastEditorUserId="13698" LastEditDate="2020-11-04T18:51:38.910" LastActivityDate="2020-11-06T17:58:57.113" Title="How do I fix the UnboundLocalError?" Tags="&lt;programming&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14484" PostTypeId="1" AcceptedAnswerId="14485" CreationDate="2020-11-04T18:48:05.883" Score="2" ViewCount="84" Body="&lt;p&gt;I have problem with implementation of the circuit below. How can I write down the conditional X-gate in the following circuit?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QjGfv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QjGfv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13137" LastEditorUserId="55" LastEditDate="2020-11-10T17:17:51.047" LastActivityDate="2020-11-10T17:17:51.047" Title="Applying conditional X-gate in Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14485" PostTypeId="2" ParentId="14484" CreationDate="2020-11-04T18:52:55.543" Score="3" Body="&lt;p&gt;This can be done in qiskit with &lt;code&gt;c_if&lt;/code&gt; operation.&lt;/p&gt;&#xA;&lt;p&gt;To construct the circuit that you are interested in in OPENQASM, you can do it as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[2];&#xA;creg cw[1];&#xA;creg cw2[1];&#xA;&#xA;&#xA;z q[0];&#xA;h q[1];&#xA;h q[0];&#xA;h q[1];&#xA;z q[0];&#xA;barrier q[0],q[1];&#xA;measure q[0] -&amp;gt; cw[0];&#xA;barrier q[0],q[1];&#xA;if (cw==1) x q[1];&#xA;barrier q[0],q[1];&#xA;measure q[1] -&amp;gt; cw2[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result circuit is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wgt4b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wgt4b.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Also look at this question and answer: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14326/composing-teleportation-circuit-in-qiskit-circuit-composer/14328#14328&quot;&gt;Composing teleportation circuit in Qiskit Circuit Composer&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; You can also run this with Qiskit as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_cw = ClassicalRegister(1, 'cw')&#xA;creg_cw2 = ClassicalRegister(1, 'cw2')&#xA;circuit = QuantumCircuit(qreg_q, creg_cw, creg_cw2)&#xA;&#xA;circuit.z(qreg_q[0])&#xA;circuit.h(qreg_q[1])&#xA;circuit.h(qreg_q[0])&#xA;circuit.h(qreg_q[1])&#xA;circuit.z(qreg_q[0])&#xA;circuit.barrier(qreg_q[0], qreg_q[1])&#xA;circuit.measure(qreg_q[0], creg_cw[0])&#xA;circuit.barrier(qreg_q[0], qreg_q[1])&#xA;circuit.x(qreg_q[1]).c_if(creg_cw, 1)&#xA;circuit.barrier(qreg_q[0], qreg_q[1])&#xA;circuit.measure(qreg_q[1], creg_cw2[0])&#xA;&#xA;circuit.draw('mpl', style={'name': 'iqx'})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zIhjv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zIhjv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-04T19:09:06.503" LastActivityDate="2020-11-04T19:09:06.503" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14486" PostTypeId="1" AcceptedAnswerId="14492" CreationDate="2020-11-04T21:53:40.973" Score="6" ViewCount="88" Body="&lt;p&gt;In &lt;a href=&quot;http://www.scholarpedia.org/article/Bell%27s_theorem#The_CHSH.E2.80.93Bell_inequality:_Bell.27s_theorem_without_perfect_correlations&quot; rel=&quot;noreferrer&quot;&gt;this&lt;/a&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="9168" LastEditorUserId="55" LastEditDate="2020-11-10T17:28:21.010" LastActivityDate="2020-11-10T17:28:21.010" Title="Difference between Bell's inequality and CHSH" Tags="&lt;entanglement&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;&lt;foundations&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14487" PostTypeId="2" ParentId="9826" CreationDate="2020-11-04T22:09:18.493" Score="1" Body="&lt;p&gt;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:&#xA;&lt;code&gt;conda install python=3.8.3&lt;/code&gt;&#xA;and then run&#xA;&lt;code&gt;pip install qiskit&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="13449" LastActivityDate="2020-11-04T22:09:18.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14488" PostTypeId="2" ParentId="14476" CreationDate="2020-11-05T07:39:06.753" Score="1" Body="&lt;p&gt;Simply speaking, &lt;span class=&quot;math-container&quot;&gt;$H^2 = HH = I$&lt;/span&gt; which is identity (you can verify this by direct matrix multiplication). As a result, such operator does not change anything in a quantum state.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-05T07:39:06.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14489" PostTypeId="1" AcceptedAnswerId="14494" CreationDate="2020-11-05T07:45:21.747" Score="1" ViewCount="57" Body="&lt;p&gt;Let's say I have a classical-quantum(cq) state &lt;span class=&quot;math-container&quot;&gt;$\rho_{XE}$&lt;/span&gt;, where the classical part &lt;span class=&quot;math-container&quot;&gt;$(X)$&lt;/span&gt; is orthogonal. It's trace distance from another  uniform density operator is defined to be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}||\rho_{XE} - \rho_U \otimes \rho_E||_1. &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now I apply a hash function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; distributed according to probability &lt;span class=&quot;math-container&quot;&gt;$p_f$&lt;/span&gt; on the first register and get a new state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{F(X)E}:= \sum_f p_f \; \rho_{f(X)E}.&#xA;$$&lt;/span&gt;&#xA;Then I notice that its trace distance has the following upper bound:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}||\rho_{F(X)E} - \rho_U \otimes \rho_E|| \le \epsilon .&#xA;$$&lt;/span&gt;&#xA;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}||\rho_{XE} - \rho_U \otimes \rho_E|| \le \epsilon.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-11-05T09:43:06.417" Title="Trace distance of two classical-quantum state with hashing" Tags="&lt;density-matrix&gt;&lt;tensor-product&gt;&lt;partial-trace&gt;&lt;classical-quantum&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14490" PostTypeId="1" CreationDate="2020-11-05T07:55:33.890" Score="-2" ViewCount="41" Body="&lt;p&gt;I want to make sure my code word has a minus sign or not, but when I use the &lt;code&gt;get_count()&lt;/code&gt; function from Qiskit, I  only can get back the sequence consisting of &lt;span class=&quot;math-container&quot;&gt;$0's$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1's$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example:&#xA;'0000000000000 000000 000000', '1001000010100 000000 000000', '1001000111101 000000 000000', '1001001001110 000000 000000', '1001001100111 000000 000000', '1001010000000 000000 000000', '1001010101001 000000 000000', '1001011011010 000000 000000', '1001011110011 000000 000000', '1011100011101 000000 000000', '1011100110100 000000 000000', '1011101000111 000000 000000', '1011101101110 000000 000000', '1011110001001 000000 000000', '1011110100000 000000 000000', '1011111010011 000000 000000', '1011111111010 000000 000000', '1100100001110 000000 000000'&lt;/p&gt;&#xA;&lt;p&gt;Before the circuit is the encoding process, the last step is the measurement.&lt;/p&gt;&#xA;" OwnerUserId="13723" LastEditorUserId="9858" LastEditDate="2020-11-05T08:11:50.287" LastActivityDate="2020-11-05T09:18:45.183" Title="qiskit:how can i get negative sign in encoding process simulation of error correction code" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="14491" PostTypeId="1" AcceptedAnswerId="14520" CreationDate="2020-11-05T07:57:12.027" Score="3" ViewCount="276" Body="&lt;p&gt;I am trying to solve Traveling Salesman Problem (TSP) in Qiskit based on Qiskit Tutorial.&lt;/p&gt;&#xA;&lt;p&gt;I used TSP for four cities described by this distance matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D = &#xA;\begin{pmatrix}&#xA;0 &amp;amp; 207 &amp;amp; 92 &amp;amp; 131 \\&#xA;207 &amp;amp; 0 &amp;amp; 300 &amp;amp; 350 \\&#xA;92 &amp;amp; 300 &amp;amp; 0 &amp;amp; 82\\&#xA;131 &amp;amp; 350 &amp;amp; 82&amp;amp; 0 \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With brute force I found two optimal solutions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$0 \rightarrow 1 \rightarrow 2 \rightarrow 3 \rightarrow 0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$0 \rightarrow 3 \rightarrow 2 \rightarrow 1 \rightarrow 0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;A total distance is 720 for both solutions.&lt;/p&gt;&#xA;&lt;p&gt;However, when I run the problem on &lt;code&gt;qasm_simulator&lt;/code&gt; with &lt;code&gt;TSP&lt;/code&gt; algorithm in &lt;code&gt;qiskit.optimization.applications.ising&lt;/code&gt; library, the returned solution is &lt;span class=&quot;math-container&quot;&gt;$0 \rightarrow 2 \rightarrow 3 \rightarrow 1 \rightarrow 0$&lt;/span&gt; with distance 873. But according to matrix &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, the total distance should be 731.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So my questions is what wrong in my code?&lt;/strong&gt; Just note that solution for example in Qiskit Tutorial was found correctly.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;My second question is how to set TSP solver to reach an optimal solution?&lt;/em&gt; I would expect that since I use a simulator, there is no noise and in the end I would reach the optimal solution.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;It seems that if the code is rerun, the results are different. I reached the distance 731, user &lt;em&gt;Egretta Thua&lt;/em&gt; 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 &lt;em&gt;Egretta&lt;/em&gt; code rerun.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;Here is my code:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;#visualization tools&#xA;import matplotlib.pyplot as plt&#xA;import matplotlib.axes as axes&#xA;#other tool&#xA;import numpy as np&#xA;import networkx as nx&#xA;from itertools import permutations&#xA;#quadratic program&#xA;from qiskit.optimization import QuadraticProgram&#xA;#TSP libraries&#xA;from qiskit.optimization.applications.ising import tsp&#xA;from qiskit.optimization.applications.ising.common import sample_most_likely&#xA;#quantum computing optimization&#xA;from qiskit.optimization.converters import IsingToQuadraticProgram&#xA;from qiskit.aqua.algorithms import VQE, QAOA, NumPyMinimumEigensolver&#xA;from qiskit.optimization.algorithms import MinimumEigenOptimizer&#xA;&#xA;#function for solving the TSP with brute force, i.e. generate all permutations and calc distances&#xA;def brute_force_tsp(w):&#xA;    N = len(w)&#xA;    #generate tuples with all permutation of numbers 1,2...N-1&#xA;    #first index is zero but we want to start our travel in the first city (i.e. with index 0)&#xA;    a = list(permutations(range(1,N)))&#xA;    &#xA;    best_dist = 1e10 #distance at begining&#xA;    &#xA;    for i in a: #for all permutations&#xA;        distance = 0&#xA;        pre_j = 0 #starting in city 0&#xA;        for j in i: #for each element of a permutation&#xA;            distance = distance + w[pre_j,j] #going from one city to another&#xA;            pre_j = j #save previous city&#xA;        distance = distance + w[pre_j,0] #going back to city 0&#xA;        order = (0,) + i #route description (i is permutation, 0 at the begining - the first city)&#xA;        print('Order: ', order, ' Distance: ', distance) #show solutions&#xA;        if distance &amp;lt; best_dist:&#xA;            best_dist = distance&#xA;            best_order = order           &#xA;        &#xA;    print('Route length: ', best_dist)&#xA;    print('Route: ', best_order)    &#xA;    &#xA;    return best_dist, best_order&#xA;&#xA;#showing resulting route in graph&#xA;def show_tsp_graph(route):&#xA;    n = len(route)&#xA;    #showing the route in graph&#xA;    G = nx.Graph() #graph&#xA;    G.add_nodes_from(range(0,n)) #add nodes&#xA;    #adding edges based on solution    &#xA;    for i in range(0,n-1):&#xA;        G.add_edge(route[i], route[i+1])&#xA;    G.add_edge(route[n-1], 0)&#xA;    nx.draw_networkx(G) #show graph&#xA;&#xA;#decoding binary output of QAOA to actual solution&#xA;def decodeQAOAresults(res):&#xA;    n = int(len(res)**0.5)&#xA;    results = np.zeros(n)&#xA;    k = 0&#xA;    for i in range(0,n): #each n elements refers to one time point i&#xA;        for j in range(0,n): #in each time points there are all cities&#xA;            #when x = 1 then the city j is visited in ith time point&#xA;            if res[k] == 1: results[i] = j&#xA;            k = k + 1&#xA;    return results&#xA;&#xA;def tspQuantumSolver(distances, backendName):&#xA;    citiesNumber = len(distances)&#xA;    coordinates = np.zeros([citiesNumber, 2])&#xA;    for i in range(0, citiesNumber): coordinates[i][0] = i + 1&#xA;    &#xA;    tspTask = tsp.TspData(name = 'TSP', dim = citiesNumber, w = distances, coord = coordinates)&#xA;    &#xA;    isingHamiltonian, offset = tsp.get_operator(tspTask)&#xA;    &#xA;    tspQubo = QuadraticProgram()&#xA;    tspQubo.from_ising(isingHamiltonian, offset)&#xA;    &#xA;    quantumProcessor = Aer.backends(name = backendName)[0]&#xA;    qaoa = MinimumEigenOptimizer(QAOA(quantum_instance = quantumProcessor))&#xA;    results = qaoa.solve(tspQubo)&#xA;    print('Route length: ', results.fval)&#xA;    route = decodeQAOAresults(results.x)&#xA;    print('Route: ', route)&#xA;    &#xA;    return results.fval, route&#xA;&#xA;distMatrix = np.array([[0,207,92,131],&#xA;                       [207,0,300,350],&#xA;                       [92,300,0,82],&#xA;                       [131,350,82,0]&#xA;                       ])&#xA;&#xA;#brute force solution&#xA;lengthBrute, routeBrute = brute_force_tsp(distMatrix)&#xA;show_tsp_graph(routeBrute)&#xA;&#xA;#quantum solution&#xA;lengthQuantum, routeQuantum = tspQuantumSolver(distMatrix, 'qasm_simulator')&#xA;show_tsp_graph(routeQuantum)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2020-11-10T17:17:23.820" LastActivityDate="2020-11-10T17:17:23.820" Title="Traveling salesman problem in Qiskit: cannot find a solution on simulator" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14492" PostTypeId="2" ParentId="14486" CreationDate="2020-11-05T09:07:05.307" Score="5" Body="&lt;p&gt;The difference is as follows:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;the original Bell inequality &lt;em&gt;requires&lt;/em&gt; that outcomes from the same setting are always perfectly anti-correlated. It says nothing about the case where they are even marginally different.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;by contrast, in CHSH, the &lt;em&gt;ideal&lt;/em&gt; (giving maximum violation) is that outcomes from the same setting would be anti-correlated, but it is not required.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Thus, in an experiment with imperfections, CHSH still applies, but the original may not.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-05T09:07:05.307" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14493" PostTypeId="2" ParentId="14490" CreationDate="2020-11-05T09:18:45.183" Score="0" Body="&lt;p&gt;For just measurement, this will never work, e.g. when you are measuring &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-&amp;gt;$&lt;/span&gt; you may get either 00 or 11, not -11(I'll omit the normalization 1/sqrt(2) from time to time).&lt;/p&gt;&#xA;&lt;p&gt;To detect this minus sign, we need to use the fact that &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;11|\Phi^-&amp;gt;=-11$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here comes my codes.&lt;/p&gt;&#xA;&lt;p&gt;First, produce the state |11&amp;gt; and generate the corresponding state vector.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister,QuantumCircuit&#xA;from qiskit.aqua.operators import StateFn&#xA;qr0=QuantumRegister(2)# &amp;lt;11|&#xA;circ0=QuantumCircuit(qr0)&#xA;circ0.x(qr0)&#xA;psi=~StateFn(circ0)# Get state vector&#xA;# ~ calls the operation of transpose&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next, get the Bell state &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-&amp;gt;$&lt;/span&gt; and its' state vector.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qr1=QuantumRegister(2)# |00&amp;gt;-|11&amp;gt;&#xA;circ1=QuantumCircuit(qr1)&#xA;circ1.h(qr1[0])&#xA;circ1.z(qr1[0])&#xA;circ1.cx(qr1[0],qr1[1])&#xA;phi=StateFn(circ1)# Get state vector&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, the expectation value comes:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;exp=(psi@phi).eval()&#xA;print(exp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the output is&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BqL3w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BqL3w.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;this is -1/sqrt(2), which satisfies our expectation, and now you can say that there is a minus sign in the Bell state &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-05T09:18:45.183" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14494" PostTypeId="2" ParentId="14489" CreationDate="2020-11-05T09:43:06.417" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and just focus on the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; system. The basic idea is that we can always pad &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; with extra information such that the min-entropy stays constant but the distance from uniform grows.&lt;/p&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is a random bit string of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that the first bit &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; is chosen uniformly at random and then &lt;span class=&quot;math-container&quot;&gt;$x_2, \dots, x_n$&lt;/span&gt; are all &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Now the min-entropy is &lt;span class=&quot;math-container&quot;&gt;$- \log \max_{(x_1,\dots,x_n)} p(x_1,\dots, x_n) = 1$&lt;/span&gt;. Using, for example, Lemma 1 from &lt;a href=&quot;https://arxiv.org/abs/1002.2436&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt; there is a hashing procedure such that we can extract 1 bit (i.e. &lt;span class=&quot;math-container&quot;&gt;$F(X)$&lt;/span&gt; is a single bit) and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12 \| F(X) - U_1\|_1 \leq 1/2&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; denotes a uniformly distributed random variable over &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; bits.&#xA;But now we can calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\frac12 \| X - U_n\|_1 &amp;amp;= \frac12\sum_{(x_1,\dots, x_n) \in \{0,1\}^n} |p(x_1,\dots,x_n) - 2^{-n}| \\&#xA;&amp;amp;= \frac12\left(2 |\frac12 - 2^{-n}| + 2(2^{n-1} - 1)|2^{-n}| \right) \\&#xA;&amp;amp;= 1 - 2^{1-n}. &#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Thus as &lt;span class=&quot;math-container&quot;&gt;$n\rightarrow \infty$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$\frac12 \| X - U_n\|_1 \rightarrow 1$&lt;/span&gt; but it can always be hashed down to a single bit that is distance &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; away from uniform. By considering larger uniform sequences at the beginning of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-05T09:43:06.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14495" PostTypeId="1" CreationDate="2020-11-05T12:05:53.417" Score="2" ViewCount="128" Body="&lt;p&gt;I have a problem when attempting to set up a PySCF driver for a hydrogen molecule from the QISKIT Chemistry tutorial: &lt;a href=&quot;https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;&#xA;molecule = Molecule(geometry = [['H', [0., 0., 0.]],&#xA;                                ['H', [0., 0., 0.735]]],&#xA;                    charge = 0 , multiplicity = 1)&#xA;&#xA;driver = PySCFDriver(molecule = molecule, unit = UnitsType.ANGSTROM, basis = 'sto3g')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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_&lt;em&gt;init&lt;/em&gt;_.py)&#xA;I am not entirely sure what is causing this error and any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13724" LastEditorUserId="55" LastEditDate="2020-11-10T17:17:18.143" LastActivityDate="2021-04-09T19:02:40.400" Title="ImportError when setting up PySCF driver" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14496" PostTypeId="2" ParentId="14495" CreationDate="2020-11-05T12:28:37.583" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="2000" LastActivityDate="2020-11-05T12:28:37.583" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14497" PostTypeId="1" CreationDate="2020-11-05T13:45:38.967" Score="2" ViewCount="83" Body="&lt;p&gt;I want to get a &lt;code&gt;jordan_wigner_hamiltonians&lt;/code&gt; of a molecule-ion by using &lt;code&gt;jordan_wignerget_fermion_operator(molecule.get_molecular_hamiltonian())&lt;/code&gt;. But I can only get the molecular Hamiltonians no matter how I set the charge and multiplicity.&lt;/p&gt;&#xA;&lt;p&gt;How I can get a molecular Hamiltonians which have more (or less) electrons for example HeH+?&lt;/p&gt;&#xA;" OwnerUserId="13725" LastEditorUserId="55" LastEditDate="2020-11-10T17:17:13.137" LastActivityDate="2020-11-10T17:17:13.137" Title="How to get a molecular Hamiltonians in OpenFermion" Tags="&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;openfermion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14499" PostTypeId="1" AcceptedAnswerId="14500" CreationDate="2020-11-05T15:53:17.053" Score="1" ViewCount="44" Body="&lt;p&gt;Let us take the initial state with the particle located at the origin &lt;span class=&quot;math-container&quot;&gt;$|n=0\rangle$&lt;/span&gt; and the coin state with&#xA;spin up &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. So,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi(0)\rangle = |0\rangle|n=0\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\psi(0)\rangle$&lt;/span&gt; denotes the at the initial time and &lt;span class=&quot;math-container&quot;&gt;$|\psi(t)\rangle$&lt;/span&gt; denotes the state of the quantum walk at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Please, help me understand that, if on RHS we have a matrix product of two column vectors?&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-10T17:17:07.003" LastActivityDate="2020-11-10T17:17:07.003" Title="What does the notation $|\psi(0)\rangle = |0\rangle|n=0\rangle$ mean?" Tags="&lt;quantum-state&gt;&lt;notation&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14500" PostTypeId="2" ParentId="14499" CreationDate="2020-11-05T15:56:21.753" Score="2" Body="&lt;p&gt;This is common shorthand for the tensor product. That is, you should read it as &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle \otimes | n=0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-05T15:56:21.753" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14501" PostTypeId="1" AcceptedAnswerId="14502" CreationDate="2020-11-05T17:07:39.723" Score="2" ViewCount="67" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/luJ1a.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/luJ1a.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-06T08:30:01.560" LastActivityDate="2020-11-06T08:35:21.860" Title="Why, in a discrete-time quantum walk,we first apply the tensor product of the coin operation with the identity?" Tags="&lt;quantum-walks&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14502" PostTypeId="2" ParentId="14501" CreationDate="2020-11-05T17:15:01.653" Score="4" Body="&lt;p&gt;You started with the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |0\rangle \otimes |0\rangle $&lt;/span&gt; which belongs to the space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2 \otimes \mathbb{C}^2$&lt;/span&gt;. To operate state on this space, your operator must also have the same dimension. Thus, you need to have &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt; and not just &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; if you want to operate the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt; does that. It makes sure you have the right dimension along with doing exactly what you were looking to do, by applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to the first qubit and leave the second qubit alone.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To be more explicit, we have the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = \begin{pmatrix} 1 \\0 \\ 0 \\ 0 \end{pmatrix}$&lt;/span&gt;. The Hadamard gate, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, can be written in the computational basis as &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} $&lt;/span&gt;.  We can't apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; directly, since the there is a mismatched in the dimensionality. However,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H \otimes  I =  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} \otimes   \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp;  1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{pmatrix} $$&lt;/span&gt;&#xA;Now they have the same dimension, and if you apply this to the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} (H\otimes I) (|0\rangle \otimes |0\rangle) &amp;amp;= \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp;  1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\end{pmatrix} \begin{pmatrix} 1 \\0 \\ 0 \\ 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\0 \\ 1 \\ 0 \end{pmatrix} \\&#xA;&amp;amp;= \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 &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear mapping property of tensor product&lt;/a&gt;, which tells us that  &lt;span class=&quot;math-container&quot;&gt;$$(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 $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-05T19:16:26.237" LastActivityDate="2020-11-05T19:16:26.237" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14503" PostTypeId="2" ParentId="13629" CreationDate="2020-11-05T21:05:30.250" Score="4" Body="&lt;p&gt;In addition to the accepted answer and @user1271772's examples, here is a circuit primitive referred to explicitly as a &amp;quot;T-gate gadget&amp;quot; in [1] (originally appearing in [2]):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MsaSx.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MsaSx.png&quot; alt=&quot;T-gate gadget: IMAGE SOURCE:arXiv:1601.07601&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;where application of the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate is conditioned on measuring a &amp;quot;1&amp;quot; on the ancilla. The way this works is, for &lt;span class=&quot;math-container&quot;&gt;$|A\rangle  = \frac{1}{\sqrt{2}} (|0\rangle + e^{i\pi/4} |1\rangle)$&lt;/span&gt;, an input state &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle = a|0\rangle + b|1\rangle$&lt;/span&gt; coming in from the left is transformed like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(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 \\&#xA;= (a|0 \rangle + b e^{i\pi/4} |1\rangle )|0\rangle + (a e^{i\pi/4} |0\rangle + b|1\rangle)|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If the ancilla is measured as &amp;quot;0&amp;quot;, the input state is projected onto &lt;span class=&quot;math-container&quot;&gt;$(a|0 \rangle + b e^{i\pi/4} |1\rangle ) = T|\psi\rangle$&lt;/span&gt; and the gate succeeds. If the ancilla is measured as &amp;quot;1&amp;quot; you apply an &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate on the input register to get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which recovers the desired &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate up to a global phase.&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$|A\rangle = T\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; contains the effects of the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate that we want to apply.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[1] Bravyi, S., &amp;amp; Gosset, D. (2016). Improved classical simulation of quantum circuits dominated by Clifford gates. Physical review letters, 116(25), 250501.&lt;/p&gt;&#xA;&lt;p&gt;[2] Zhou, X., Leung, D. W., &amp;amp; Chuang, I. L. (2000). Methodology for quantum logic gate construction. Physical Review A, 62(5), 052316.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-11-05T21:05:30.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14504" PostTypeId="2" ParentId="14497" CreationDate="2020-11-05T21:42:32.607" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                              ['H', [0., 0., ed]]],&#xA;                             charge=0, multiplicity=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next, you can do this to get the Pauli operators:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qubit_op, _ = fermionic_transformation.transform(driver)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally this code gives you a dictionary of the weights and the decompositions of the Hamiltonian:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    decompositions = {}&#xA;    for el in qubit_op.oplist:&#xA;        ceof, pauli = [x.strip() for x in str(el).split('*')]&#xA;        decompositions[pauli] = ceof&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This tutorial explains every detail. Just make sure you have the latest version of Qiskit installed.&#xA;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12489" LastActivityDate="2020-11-05T21:42:32.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14505" PostTypeId="1" CreationDate="2020-11-06T02:35:03.910" Score="0" ViewCount="108" Body="&lt;p&gt;How do I get the amplitude of each qubit, like &lt;code&gt;plot_bloch_multivector()&lt;/code&gt;, but not output the tensor product of all qubits.&lt;a href=&quot;https://i.stack.imgur.com/qVvHN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qVvHN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this case I need output &lt;code&gt;[0.707, -0.707], [0, 1], [0.707, 0.707], [0.707, 0.707]&lt;/code&gt;. How can I get this?&lt;/p&gt;&#xA;" OwnerUserId="13723" LastEditorUserId="55" LastEditDate="2020-11-10T17:35:16.673" LastActivityDate="2020-11-10T17:35:16.673" Title="Qiskit get qubits from statevector" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14506" PostTypeId="2" ParentId="14505" CreationDate="2020-11-06T03:06:12.777" Score="2" Body="&lt;p&gt;You mean something like this?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, execute, QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;backend = Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;)&#xA;qc = QuantumCircuit(1, 1)&#xA;qc.h(0)&#xA;print(qc)&#xA;result = execute(qc, backend=backend, shots=1).result()&#xA;print('State Vector:', result.get_statevector() )&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SAU4u.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SAU4u.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; If you have two qubits or more, then you can also use this function as shown here:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, execute, QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;backend = Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;)&#xA;qc = QuantumCircuit(2, 2)&#xA;qc.h(0)&#xA;qc.h(1)&#xA;print(qc)&#xA;result = execute(qc, backend=backend, shots=1).result()&#xA;print('State Vector:', result.get_statevector() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CapWk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CapWk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \in \mathbb{C}^4$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |\phi_1 \rangle \otimes |\phi_2 \rangle $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_2\rangle$&lt;/span&gt; belongs to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;. For example, if you look at this circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bZwB3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bZwB3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can't write each qubit state individually! That is the state &lt;span class=&quot;math-container&quot;&gt;$|\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}  $&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d \in \mathbb{C}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|a|^2 + |b|^2 =1 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|c|^2 + |d|^2 = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now the state is separable and you want to measure on one of them, you can do this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, execute, QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;backend = Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;)&#xA;qc = QuantumCircuit(2, 1)&#xA;qc.h(0)&#xA;qc.h(1)&#xA;qc.measure([1],[0])&#xA;print(qc)&#xA;result = execute(qc, backend=backend, shots=1).result()&#xA;print('State Vector:', result.get_statevector() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pYyjH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pYyjH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, the qubit that got measured will collapsed its state to either the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;....  Now, if it collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then the State Vector now is &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \otimes  |0\rangle$&lt;/span&gt; . Similarly, if it collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; then you get &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle  \otimes | 1 \rangle$&lt;/span&gt;. Either way, this allow you to observe what &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is now... For instance, the State vector above tells you that &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;  is the the superposition state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$&lt;/span&gt;, which is what you expected as you applied the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to it.&lt;/p&gt;&#xA;&lt;p&gt;And I can extend this to higher system as well... Just measured the other states.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-06T03:54:03.690" LastActivityDate="2020-11-06T03:54:03.690" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14507" PostTypeId="1" AcceptedAnswerId="14508" CreationDate="2020-11-06T03:55:49.567" Score="4" ViewCount="411" Body="&lt;p&gt;Suppose I want to perform the time-evolution simulation on the following Hamiltonians:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{1} = X_1+ Y_2 + Z_1\otimes Z_2&#xA;\\&#xA;H_{2} = X_1\otimes Y_2 + Z_1\otimes Z_2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; are Pauli matrices. Since &lt;span class=&quot;math-container&quot;&gt;$[X_1,Y_2] = 0$&lt;/span&gt;, I can simultaneously perform the time evolution simulation of &lt;span class=&quot;math-container&quot;&gt;$X_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y_2$&lt;/span&gt;. Thus, it seems like both Hamiltonians could be simulated using the following circuit (&lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; is just a random number):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Tv7gQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Tv7gQ.png&quot; alt=&quot;Enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this circuit looks right? If so, how can I tell the difference between these two Hamiltonians just by looking at the circuit?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2020-11-10T17:35:09.387" LastActivityDate="2020-11-10T17:35:09.387" Title="How can I simulate Hamiltonians composed of Pauli matrices?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14508" PostTypeId="2" ParentId="14507" CreationDate="2020-11-06T05:24:25.323" Score="4" Body="&lt;p&gt;The circuit to simulate the term &lt;span class=&quot;math-container&quot;&gt;$e^{i Z \otimes Z t}$&lt;/span&gt; can be construct as&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Rlapd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Rlapd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the circuit to simulate the term &lt;span class=&quot;math-container&quot;&gt;$e^{i X \otimes Y t}$&lt;/span&gt; can be construct as&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zDvnE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zDvnE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now to simulate &lt;span class=&quot;math-container&quot;&gt;$H = X \otimes Y + Z \otimes Z$&lt;/span&gt;, we can use &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_product_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trotter approx&lt;/a&gt; with one time slice to get the following circuit to approximate &lt;span class=&quot;math-container&quot;&gt;$e^{i (X \otimes Y + Z \otimes Z) t}$&lt;/span&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F9GyM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F9GyM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now as commented by @tsgeorgios, in fact, &lt;span class=&quot;math-container&quot;&gt;$X \otimes Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt; are commute. That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ [X\otimes Y, Z \otimes Z] = X\otimes Y \cdot Z \otimes Z - Z \otimes Z \cdot X\otimes Y = \boldsymbol{0}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;you can see this explicitly as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ X \otimes Y = &#xA;\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -i\\&#xA;0 &amp;amp; 0 &amp;amp; i &amp;amp; 0\\&#xA;0 &amp;amp; -i &amp;amp; 0 &amp;amp; 0\\&#xA;i &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix} \ \ \ \ \ \ \textrm{and} \ \ \ \ &#xA;Z \otimes Z = &#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;\end{pmatrix} &#xA;$$&lt;/span&gt;&#xA;hence you can see that &lt;span class=&quot;math-container&quot;&gt;$$ X \otimes Y \cdot Z \otimes Z - Z \otimes Z \cdot  X \otimes Y = \begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;that is they are commute with one another. This is &lt;strong&gt;important&lt;/strong&gt; because if two matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are commute then we have that (&lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_exponential#The_exponential_of_sums&quot; rel=&quot;nofollow noreferrer&quot;&gt;See here.&lt;/a&gt; )&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{A + B} = e^{A}e^{B}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What this tells us is that the above circuit is the &lt;strong&gt;exact representation&lt;/strong&gt; of the term &lt;span class=&quot;math-container&quot;&gt;$e^{i (X \otimes Y + Z \otimes Z) t}$&lt;/span&gt; and not just an approximation!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, the circuit to simulate &lt;span class=&quot;math-container&quot;&gt;$e^{i X \otimes I t}$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/J1aDv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/J1aDv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the circuit to simulate &lt;span class=&quot;math-container&quot;&gt;$e^{i I \otimes Y t}$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ELDo3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ELDo3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, the &lt;strong&gt;Identity operator&lt;/strong&gt; doesn't do anything! so you can ignore them out of the circuit.&lt;/p&gt;&#xA;&lt;p&gt;Thus, the trotter approx circuit for &lt;span class=&quot;math-container&quot;&gt;$e^{i (X \otimes I + I \otimes Y + Z \otimes Z) t}$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WuLzD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WuLzD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I would like to linked  a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5567/circuit-construction-for-hamiltonian-simulation?noredirect=1&amp;amp;lq=1&quot;&gt;very good and detail answer&lt;/a&gt; by @Davit Khachatryan to a similar question here.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-06T16:05:07.413" LastActivityDate="2020-11-06T16:05:07.413" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="14509" PostTypeId="2" ParentId="14501" CreationDate="2020-11-06T08:35:06.750" Score="1" Body="&lt;p&gt;A (discrete-time) &lt;em&gt;quantum walk&lt;/em&gt; can be thought of as the direct &amp;quot;quantization&amp;quot; of a classical random walk.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The quantum generalisation of this is to think of the &amp;quot;coin&amp;quot; as a &amp;quot;coin state&amp;quot;, that is, a qubit, and to make the &amp;quot;coin flip&amp;quot; into a similarly unbiased quantum gate (although one can generalises this to allow for arbitrary quantum gates as coin operations).&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;coin operation&amp;quot; gate must therefore, by conception, be an operation &lt;em&gt;that only affects the coin space&lt;/em&gt;. In your notation, a state such as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\otimes|0\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U\otimes I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-11-06T08:35:06.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14510" PostTypeId="2" ParentId="14501" CreationDate="2020-11-06T08:35:21.860" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;To see this in a very crude way, imagine applying Hadamard to a qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. You get a state &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle+|1\rangle)/\sqrt{2}$&lt;/span&gt; which, if we were to measure it, would be equivalent to a coin giving heads or tails with 50:50 probability.&lt;/p&gt;&#xA;&lt;p&gt;The shift operator then says &amp;quot;depending on whether the coin is in heads or tails, update the position register appropriately&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-06T08:35:21.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14512" PostTypeId="2" ParentId="14491" CreationDate="2020-11-06T17:00:37.427" Score="1" Body="&lt;p&gt;May be this should be added as a comment, but I do not have the privilege to add comments.&#xA;&lt;br&gt;Any way, I ran your code as it is and there was no errors:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Order:  (0, 1, 2, 3)  Distance:  720&#xA;Order:  (0, 1, 3, 2)  Distance:  731&#xA;Order:  (0, 2, 1, 3)  Distance:  873&#xA;Order:  (0, 2, 3, 1)  Distance:  731&#xA;Order:  (0, 3, 1, 2)  Distance:  873&#xA;Order:  (0, 3, 2, 1)  Distance:  720&#xA;Route length:  720&#xA;Route:  (0, 1, 2, 3)&#xA;Route length:  720.0&#xA;Route:  [1. 2. 3. 0.]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;OS: Windows 10&lt;br&gt;Qiskit version: 0.23.0&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2020-11-06T17:06:23.737" LastActivityDate="2020-11-06T17:06:23.737" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14513" PostTypeId="2" ParentId="14483" CreationDate="2020-11-06T17:58:57.113" Score="1" Body="&lt;p&gt;This is a Python related question. I think it should be asked in &lt;a href=&quot;https://stackoverflow.com/&quot;&gt;stackoverflow&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;br&gt;This error happens because you try to check the value of the variable &lt;code&gt;output&lt;/code&gt; before assigning a value to it.&#xA;&lt;br&gt;As you may know, Python is space sensitive. Hence, the line where you check if &lt;code&gt;output&lt;/code&gt; equals 1 will be executed regardless of &lt;code&gt;case&lt;/code&gt; value. On the other hand,&#xA;the variable &lt;code&gt;output&lt;/code&gt; will be initialized only if &lt;code&gt;case&lt;/code&gt; equals &lt;code&gt;&amp;quot;constant&amp;quot;&lt;/code&gt;.&#xA;&lt;br&gt;This means this error will happen whenever &lt;code&gt;case&lt;/code&gt; equals &lt;code&gt;&amp;quot;balanced&amp;quot;&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2020-11-06T17:58:57.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14514" PostTypeId="1" CreationDate="2020-11-06T20:40:07.863" Score="2" ViewCount="71" Body="&lt;p&gt;In the example on the Qiskit page (&lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#A.-Some-mathematical-background&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#A.-Some-mathematical-background&lt;/a&gt;) section 3 for the HHL algorithm the author is trying to solve the system of equations written as &lt;span class=&quot;math-container&quot;&gt;$A \vec{x}=\vec{b}$&lt;/span&gt;, where:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\left(\begin{array}{cc}&#xA;1 &amp;amp; -1 / 3 \\&#xA;-1 / 3 &amp;amp; 1&#xA;\end{array}\right), \quad \vec{b}=\left(\begin{array}{c}&#xA;1 \\&#xA;0&#xA;\end{array}\right) \quad \text { and } \quad \vec{x}=\left(\begin{array}{c}&#xA;x_{1} \\&#xA;x_{2}&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The final state of the system implementing the algorithm is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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\|}.&#xA;$$&lt;/span&gt;&#xA;Given that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle={\frac{3}{2 \sqrt{2}}\left|u_{1}\right\rangle+\frac{3}{4 \sqrt{2}}\left|u_{2}\right\rangle}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left|u_{1}\right\rangle=\left(\begin{array}{c}&#xA;1 \\&#xA;-1&#xA;\end{array}\right) \quad \text { and } \quad\left|u_{2}\right\rangle=\left(\begin{array}{l}&#xA;1 \\&#xA;1&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do i determine the solution to the system which is &lt;span class=&quot;math-container&quot;&gt;$\left[\begin{array}{ll}1.125 &amp;amp; 0.375\end{array}\right]$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13418" LastActivityDate="2020-11-06T21:27:50.487" Title="HHL example solution on Qiskit" Tags="&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14516" PostTypeId="1" CreationDate="2020-11-06T22:59:23.160" Score="1" ViewCount="95" Body="&lt;p&gt;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 &lt;strong&gt;do not see the histogram of states anywhere&lt;/strong&gt; - 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?&lt;/p&gt;&#xA;&lt;p&gt;![screenshot from IBM Q Experience showing circuit but no histogram of results]&lt;a href=&quot;https://i.stack.imgur.com/758Wa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/758Wa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13734" LastEditorUserId="55" LastEditDate="2020-11-10T17:33:34.053" LastActivityDate="2020-11-10T17:33:34.053" Title="No histogram appears in my job results" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14517" PostTypeId="2" ParentId="14516" CreationDate="2020-11-06T23:23:01.020" Score="1" Body="&lt;p&gt;What is the status of the job? Can you screenshot and upload the image of what you see.&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;If your job is completed running, you will be able to see this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E4ukg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E4ukg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kIhCn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kIhCn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-states/representing-qubit-states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;notebook tutorial&lt;/a&gt; here.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-06T23:23:01.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14518" PostTypeId="2" ParentId="14218" CreationDate="2020-11-07T08:01:58.360" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The first term is &lt;span class=&quot;math-container&quot;&gt;$\mathbb{E}_{\mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho := U | \psi_{0} \rangle \langle  \psi_{0} | U^{\dagger} $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; distributed Haar-uniformly, and &lt;span class=&quot;math-container&quot;&gt;$| \psi_{0} \rangle, | z \rangle$&lt;/span&gt; are some fixed states.&lt;/p&gt;&#xA;&lt;p&gt;Let's start by rewriting,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\left\langle z | \rho | z \right\rangle &amp;amp;= \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) \\&#xA;&amp;amp;= \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),&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\hat{S}$&lt;/span&gt; is the SWAP operator and in the last equality, I've used the lemma,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \operatorname{Tr}\left( X Y \right) = \operatorname{Tr}\left( \hat{S} X \otimes Y \right).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, Haar-averaging the expectation value is equivalent to,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] &amp;amp;=  \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].  &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using another (wonderful) lemma,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \int_{U \sim \mathrm{Haar}} dU U \otimes U^{\dagger} = \frac{\hat{S}}{d},&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and noticing that the trace is linear, we can perform the Haar-average above to obtain,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;   \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).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Moreover &lt;span class=&quot;math-container&quot;&gt;$\hat{S}^{2} = I$&lt;/span&gt;, that is, swapping twice does nothing, and so we have,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;   \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),&#xA;\end{align}&lt;/span&gt;&#xA;where we've used &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}\left( A \otimes B \right) = \operatorname{Tr}\left( A \right) \operatorname{Tr}\left( B \right)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since both &lt;span class=&quot;math-container&quot;&gt;$| z \rangle, | \psi_{0} \rangle$&lt;/span&gt; are normalized, we have,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;   \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] = \frac{1}{d}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What does this mean? Note that &lt;span class=&quot;math-container&quot;&gt;$\left\langle z | \rho | z \right\rangle = \left| \left\langle z | U | \psi_{0} \right\rangle \right|^{2}$&lt;/span&gt;, that is, it measures the probability to find a random state &lt;span class=&quot;math-container&quot;&gt;$U | \psi_{0} \rangle$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$| z \rangle$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$U| \psi_{0} \rangle$&lt;/span&gt; is (Haar-)uniformly distributed, the probability to find it in some state &lt;span class=&quot;math-container&quot;&gt;$| z \rangle$&lt;/span&gt; is also uniformly distributed, i.e., &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{d}$&lt;/span&gt;. Also, note that, the final result does &lt;em&gt;not&lt;/em&gt; depend on either the choice of the initial state &lt;span class=&quot;math-container&quot;&gt;$| \psi_{0} \rangle$&lt;/span&gt; or the state &lt;span class=&quot;math-container&quot;&gt;$| z \rangle$&lt;/span&gt;, reflecting our choice of the uniform measure.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For the second quantity, we follow a similar calculation. We have, &lt;span class=&quot;math-container&quot;&gt;$\sigma = \mathbb{E}_{U \sim \mathrm{diag}} \left[ U \rho U^{\dagger} \right] $&lt;/span&gt;, i.e., we average over diagonal unitaries uniformly distributed in some basis, let's call it &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consider the spectral decomposition &lt;span class=&quot;math-container&quot;&gt;$U = \sum\limits_{j=1}^{d} e^{i \phi_{j}} \Pi_{j}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{ \Pi_{j} \} = \mathbb{B}$&lt;/span&gt;. Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \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] .&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, the uniform distribution over unitaries diagonal in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}$&lt;/span&gt; is essentially a uniform distribution over the phases &lt;span class=&quot;math-container&quot;&gt;$\{ \phi \}$&lt;/span&gt;. An average over these phases gives us &lt;span class=&quot;math-container&quot;&gt;$\int_{\phi \sim \mathrm{uniform}[0, 2\pi]} d \phi e^{i \left( \phi_{j} - \phi_{k} \right)} = \delta_{j,k}$&lt;/span&gt;. Therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \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),&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}_{\mathbb{B}} (\cdot) \equiv \sum\limits_{j=1}^{d} \Pi_{j} \left( \cdot \right) \Pi_{j}$&lt;/span&gt; is the dephasing superoperator. Putting it all together, we have that the action of averaging uniformly over diagonal unitaries in a basis &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}$&lt;/span&gt; is to dephase the state in the basis &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}$&lt;/span&gt;, i.e.,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;   \sigma = \mathbb{E}_{U \sim \mathrm{diag}} \left[ U \rho U^{\dagger} \right] = \mathcal{D}_{\mathbb{B}}(\rho).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We're now ready to evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \sigma | z \right\rangle &amp;amp;=   \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) &#xA;\\ &amp;amp;= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \rho \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle  z |  \right)  \right),&#xA;\end{align}&lt;/span&gt;&#xA;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 &amp;quot;transfer&amp;quot; its action onto &lt;span class=&quot;math-container&quot;&gt;$| z \rangle \langle  z | $&lt;/span&gt; instead.&lt;/p&gt;&#xA;&lt;p&gt;Now this quantity is in a form as the first one, namely,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \sigma | z \right\rangle &amp;amp;= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \rho \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle  z |  \right)  \right) \\&#xA;&amp;amp;=   \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) \\&#xA;&amp;amp;=  \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), &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where in the last line I've used the SWAP trick as above. Then, performing the Haar average, and using &lt;span class=&quot;math-container&quot;&gt;$\hat{S}^{2} = I$&lt;/span&gt;, we have,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \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},&#xA;\end{align}&lt;/span&gt;&#xA;since both traces above are equal to one.&lt;/p&gt;&#xA;&lt;p&gt;What does this quantity mean? Since &lt;span class=&quot;math-container&quot;&gt;$\left\langle z | \sigma | z \right\rangle = \left\langle z | \mathcal{D}_{\mathbb{B}} (\rho) | z \right\rangle$&lt;/span&gt;, this is equal to the fidelity between a fixed state &lt;span class=&quot;math-container&quot;&gt;$| z \rangle$&lt;/span&gt; and a random state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; dephased in some basis &lt;span class=&quot;math-container&quot;&gt;$\mathbb{B}$&lt;/span&gt;. Once again, because the state &lt;span class=&quot;math-container&quot;&gt;$U | \psi_{0} \rangle$&lt;/span&gt; is uniformly distributed, the fidelity equals that between two random states.&lt;/p&gt;&#xA;&lt;p&gt;In closing, both averages are equal to &lt;span class=&quot;math-container&quot;&gt;$1/d$&lt;/span&gt;. That is,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;   \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&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I'm also listing some references for the &amp;quot;swap trick&amp;quot; used above. It can be used for &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0401067&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measuring polynomial functions of states&lt;/a&gt;. In the &lt;a href=&quot;https://arxiv.org/abs/hep-th/0405152&quot; rel=&quot;nofollow noreferrer&quot;&gt;high-energy literature&lt;/a&gt;, this has been dubbed the &amp;quot;replica trick&amp;quot; (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 &lt;a href=&quot;https://arxiv.org/abs/1509.01160&quot; rel=&quot;nofollow noreferrer&quot;&gt;ground-breaking experiment&lt;/a&gt; and &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.104.157201&quot; rel=&quot;nofollow noreferrer&quot;&gt;Monte-Carlo simulations&lt;/a&gt;. And finally, it can be used to linearize the measurement of the &lt;a href=&quot;http://www.scholarpedia.org/article/Quantum_entropies#R.C3.A9nyi_entropy&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;-Renyi entropies&lt;/a&gt;, see this &lt;a href=&quot;https://arxiv.org/abs/1612.08630&quot; rel=&quot;nofollow noreferrer&quot;&gt;wonderful paper&lt;/a&gt;; although there might be earlier (and better) references.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastEditorUserId="1108" LastEditDate="2020-11-08T10:51:11.620" LastActivityDate="2020-11-08T10:51:11.620" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="14519" PostTypeId="1" CreationDate="2020-11-07T09:54:10.930" Score="3" ViewCount="140" Body="&lt;p&gt;How can I construct the below 2-qubit state using suitable single qubit gates (maximum 3) and one CNOT gate starting with state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\omega\rangle=\frac{1}{3}(2|00\rangle+|01\rangle+2|11\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13735" LastEditorUserId="55" LastEditDate="2020-11-10T17:33:22.920" LastActivityDate="2020-11-10T17:33:22.920" Title="How can I construct a 2-qubit state using single qubit gates and CNOT gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14520" PostTypeId="2" ParentId="14491" CreationDate="2020-11-07T09:59:54.533" Score="1" Body="&lt;p&gt;Qiskit has a &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/6_examples_max_cut_and_tsp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial documentation&lt;/a&gt; about TSP, you can find more detail at that site.&#xA;As for the problem of your code, I suggest you use the qiskit-built function&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;tsp.random_tsp(3,seed=123) # 3 for three cities&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;to generate the route, instead of a single distance matrix you have written. Because &lt;code&gt;tsp.random_tsp(3,seed=123)&lt;/code&gt; generates the coordinates and distance matrix correspondingly, while your coordinates are simply a &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; iteration.&lt;/p&gt;&#xA;&lt;p&gt;To see the difference between the two methods,&#xA;&lt;a href=&quot;https://i.stack.imgur.com/5QyHV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5QyHV.png&quot; alt=&quot;tsp right coordinate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;you can use the coordinates to calculate your density matrix, while your own method will be problematic at this phase.&lt;/p&gt;&#xA;&lt;p&gt;(A list of coordinates &lt;code&gt;[[1,0],[2,0],[3,0],[4,0]]&lt;/code&gt; cannot generate a distance matrix &lt;code&gt;[[0,207,92,131],[207,0,300,350],[92,300,0,82],[131,350,82,0]]&lt;/code&gt; unless your tsp space is highly inhomogeneous.)&lt;/p&gt;&#xA;&lt;p&gt;Here ends my investigation, I have not tested further. Discussions are welcomed.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="9006" LastEditDate="2020-11-08T06:47:51.183" LastActivityDate="2020-11-08T06:47:51.183" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14521" PostTypeId="2" ParentId="14519" CreationDate="2020-11-07T17:20:12.770" Score="2" Body="&lt;p&gt;Below is a circuit that can generate the state &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; that you wanted. However, &lt;strong&gt;It is NOT what you are looking for&lt;/strong&gt;  as it is using 2 CNOTs gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ttKRv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ttKRv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if you look at the state vector output, you can see that it is indeed the correct state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/10Wbj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/10Wbj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Hopefully someone will be able give you an answer that you are looking for  :)&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-07T17:20:12.770" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14522" PostTypeId="1" CreationDate="2020-11-07T17:55:43.887" Score="0" ViewCount="69" Body="&lt;p&gt;To perform quantum walk first we need to define combine hilbert space for the position and coin, which is represented by: &lt;span class=&quot;math-container&quot;&gt;$H=H_p\bigotimes H_c$&lt;/span&gt;&lt;br /&gt;&#xA;Now, my question is what is the use of above representation, if all the operation are defined on initial state. For example here,  &lt;span class=&quot;math-container&quot;&gt;$| \psi(0)\rangle = |0\rangle\bigotimes\mid n=0\rangle$&lt;/span&gt;&lt;br /&gt;&#xA;Here, first vector is coin with initial state &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and second vector is walker at initial node &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="1859" LastEditDate="2020-11-08T06:03:11.357" LastActivityDate="2020-11-10T17:32:58.590" Title="Use of Position Hilbert Space in Quantum Walk" Tags="&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14523" PostTypeId="1" CreationDate="2020-11-07T18:21:08.247" Score="1" ViewCount="43" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Usually we denote a quantum code by parameters &lt;span class=&quot;math-container&quot;&gt;$[[n,k,d]]$&lt;/span&gt;. Where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of physcial qubits used, &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; - number of encoded (or logical) qubits, and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; the code distance.&lt;/p&gt;&#xA;&lt;p&gt;Besides the definitions, how are block length and error rate related to those parameters &lt;span class=&quot;math-container&quot;&gt;$n,k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13616" LastActivityDate="2020-11-13T09:04:39.543" Title="Quantum error correction: block length and error rate definitions" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14524" PostTypeId="2" ParentId="14519" CreationDate="2020-11-07T19:20:00.013" Score="3" Body="&lt;p&gt;Using only one CNOT gate and 3 single qubit gates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MXzW9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MXzW9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{U3}(\theta,\phi,\lambda)=&#xA;\begin{pmatrix}&#xA;\cos(\theta/2) &amp;amp; -\mathrm{e}^{i\lambda}\sin(\theta/2) \\&#xA;\mathrm{e}^{i\phi}\sin(\theta/2) &amp;amp; \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;br&gt;To prepare a state, you can use Qiskit's &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.initialize.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantumCircuit.initialize&lt;/a&gt;. But when I used this method, the constructed circuit contains 2 CNOTs even with maximum optimization_level.&#xA;Qiskit provides another method, &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantumCircuit.iso&lt;/a&gt;, which yields the circuit shown above.&#xA;&lt;br&gt;&lt;br&gt;Code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Using QuantumCircuit.initialize&#xA;qc = QuantumCircuit(2)&#xA;qc.initialize([2/3, 1/3, 0, 2/3], [0, 1])&#xA;&#xA;qc_by_initialize = transpile(qc, basis_gates=['u3','cx'], optimization_level = 3)&#xA;qc_by_initialize.draw('mpl')&#xA;&#xA;&#xA;# Using QuantumCircuit.iso&#xA;qc = QuantumCircuit(2)&#xA;qc.iso([2/3, 1/3, 0, 2/3], [0, 1], [])&#xA;&#xA;qc_by_isometry = transpile(qc, basis_gates=['u3','cx'], optimization_level = 3)&#xA;qc_by_isometry.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2020-11-07T19:20:00.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14525" PostTypeId="1" CreationDate="2020-11-07T22:58:08.967" Score="2" ViewCount="71" Body="&lt;p&gt;I have been learning about quantum error correction using the zero-noise extrapolation method from &lt;a href=&quot;https://arxiv.org/pdf/1801.03897.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; 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 &lt;code&gt;qc.x(0), qc.h(0), qc.cx(0,1), qc.x(0)&lt;/code&gt; and added noise to it in the form of pairs of CNOT gates (a noisey identity matrix). I am plotting the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ze4Zd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ze4Zd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EpJ2L.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EpJ2L.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ri7is.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ri7is.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="13244" LastEditDate="2020-11-08T02:11:34.320" LastActivityDate="2020-11-08T02:11:34.320" Title="Why and how is quantum noise predictable?" Tags="&lt;qiskit&gt;&lt;error-correction&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14526" PostTypeId="2" ParentId="14525" CreationDate="2020-11-07T23:53:11.193" Score="1" Body="&lt;p&gt;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 .&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GapDs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GapDs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can probably use T1 and T2 to predict the curve.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-11-08T00:12:04.927" LastActivityDate="2020-11-08T00:12:04.927" CommentCount="5" CommunityOwnedDate="2020-11-08T00:03:15.037" ContentLicense="CC BY-SA 4.0" />
  <row Id="14527" PostTypeId="1" CreationDate="2020-11-08T00:30:33.910" Score="2" ViewCount="70" Body="&lt;p&gt;I've been trying to perform Grover's algorithm on entangled states, e.g. &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |11\rangle$&lt;/span&gt;. However, the algorithm apparently doesn't seem to amplify the amplitude of the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; 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, &amp;quot;pure&amp;quot; states?&lt;/p&gt;&#xA;" OwnerUserId="9633" LastEditorUserId="1859" LastEditDate="2020-11-08T01:31:14.383" LastActivityDate="2020-11-08T06:55:58.963" Title="Is Grover's algorithm only applicable to a pure state?" Tags="&lt;entanglement&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14528" PostTypeId="2" ParentId="14527" CreationDate="2020-11-08T06:55:58.963" Score="2" Body="&lt;p&gt;The problem is that you have only two states in your &lt;em&gt;database&lt;/em&gt;. So when you mark state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; its amplitude is &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; while the other state has amplitued &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. As a result, you cannot increase a probability of the marked state.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-08T06:55:58.963" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14529" PostTypeId="2" ParentId="14241" CreationDate="2020-11-08T12:06:46.423" Score="0" Body="&lt;p&gt;Since you can produce the GHZ state, I will skip the corresponding code and just use that QuantumCircuit object to build a density matrix &lt;span class=&quot;math-container&quot;&gt;$|GHZ&amp;gt;&amp;lt;GHZ|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import DensityMatrix&#xA;DM=DensityMatrix.from_instruction(circuit)&#xA;# here circuit denotes the circuit that contains your GHZ state.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or there is another way to do so(not recommended, just for reference).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import StateFn&#xA;psi=StateFn(circuit)# produce the state vector&#xA;DM=(psi@~psi).eval()# state ket tensor state bra =density matrix&#xA;# When calling StateFn function, the quantum circuit must not contain classical register&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-08T12:06:46.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14530" PostTypeId="1" AcceptedAnswerId="14535" CreationDate="2020-11-08T13:42:32.530" Score="2" ViewCount="117" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zYLuQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zYLuQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How to convert from current state:  &lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle =\dfrac{ |01 \rangle + |10 \rangle - |11 \rangle}{\sqrt{3}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;into a target state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi \rangle = \dfrac{|01 \rangle - |10 \rangle + |11 \rangle}{\sqrt{3}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;using only &lt;strong&gt;X, Z &amp;amp; H gates&lt;/strong&gt;? TIA.&lt;/p&gt;&#xA;" OwnerUserId="13749" LastEditorUserId="1859" LastEditDate="2020-11-10T12:36:28.777" LastActivityDate="2020-11-10T17:39:54.917" Title="Transforming $|01 \rangle + |10 \rangle - |11 \rangle \to |01 \rangle - |10 \rangle + |11 \rangle$" Tags="&lt;quantum-gate&gt;&lt;quantum-operation&gt;&lt;pauli-gates&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14531" PostTypeId="2" ParentId="14530" CreationDate="2020-11-08T15:04:15.543" Score="4" Body="&lt;p&gt;Apply a Z gate to the first qubit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2020-11-08T15:04:15.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14532" PostTypeId="1" AcceptedAnswerId="14536" CreationDate="2020-11-08T17:01:46.223" Score="2" ViewCount="77" Body="&lt;p&gt;I suppose a quantum state with density matrix like the following is not valid.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, let's say I have a valid density operator representing the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1 \rangle)$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\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 &amp;amp; 1 \\ 1 &amp;amp; 1 \end{bmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now I send this state to depolarizing channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;. Because &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is linear:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|)).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering what the depolarization of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(|0\rangle \langle 1|)$&lt;/span&gt; would mean. By definition of depolarizing channel, for noise parameter &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho) = (1 - p)\rho + \frac{pI}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But then, what is the meaning of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(|0\rangle \langle 1|)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-11-08T19:53:24.677" Title="Depolarization of density operator with zeros in diagonal" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;noise&gt;&lt;linear-algebra&gt;&lt;depolarizing-channel&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14533" PostTypeId="2" ParentId="14519" CreationDate="2020-11-08T17:10:49.720" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\alpha|00\rangle+\beta|11\rangle$&lt;/span&gt;. Now, can you answer your own question for this state?&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-08T17:10:49.720" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14534" PostTypeId="2" ParentId="9826" CreationDate="2020-11-08T17:34:10.630" Score="2" Body="&lt;p&gt;Looks like &lt;code&gt;qiskit&lt;/code&gt; 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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create your virtual environment:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ conda create -n my-quantum-env python=3.8&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Activate your environment:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ conda activate my-quantum-env&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Install &lt;code&gt;qiskit&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;(my-quantum-env) $ pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13751" LastActivityDate="2020-11-08T17:34:10.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14535" PostTypeId="2" ParentId="14530" CreationDate="2020-11-08T18:27:59.977" Score="4" Body="&lt;p&gt;&lt;strong&gt;The other answer by @chrysaor4 is exactly right!&lt;/strong&gt; 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...  :)&lt;/p&gt;&#xA;&lt;p&gt;First of, we know that the Paulis &lt;span class=&quot;math-container&quot;&gt;$X,Z$&lt;/span&gt; and Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; take the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{pmatrix} \ \ \ \ \ \ \ \&#xA;Z = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1  \end{pmatrix} \ \ \ \ \ \ \ \&#xA;H= \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1  \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Taking the computation basis &lt;span class=&quot;math-container&quot;&gt;$\{ |0 \rangle, |1\rangle\}$&lt;/span&gt; which defined as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt; then we can see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ X|0 \rangle = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1 \rangle \ \ \ \ \textrm{and} \ \ \ \   &#xA; X|1 \rangle = \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0  \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;similarly&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Z|0 \rangle = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1  \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0 \rangle \ \ \ \ \textrm{and} \ \ \ \   &#xA;Z|1 \rangle = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1  \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ -1 \end{pmatrix} =-|1 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and you can also show that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H|0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \ \ \ \ \textrm{and} \ \ \ \&#xA;H|1 \rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From the computations above, we have found out what each of the gates &lt;span class=&quot;math-container&quot;&gt;$X,Z, H$&lt;/span&gt; do to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now your goal is to transform the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{ |01\rangle + |10 \rangle - |11\rangle}{\sqrt{3}} $&lt;/span&gt; to the state  &lt;span class=&quot;math-container&quot;&gt;$\dfrac{ |01\rangle - |10 \rangle + |11\rangle}{\sqrt{3}} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;gate &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;&lt;/strong&gt; is something that we would want to use. As it keep the basis state fixed and only change the sign when the state is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This tells us that we should apply the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate on the first qubit.&lt;/p&gt;&#xA;&lt;p&gt;Now, applying &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on the first qubit and do nothing on the second qubit is simply the operation &lt;span class=&quot;math-container&quot;&gt;$Z \otimes I$&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the idenity matrix so it tells us to do nothing to the second qubit. In the circuit representation, this is simply:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zDXS3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zDXS3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And this operation &lt;span class=&quot;math-container&quot;&gt;$Z \otimes I$&lt;/span&gt; does explicitly the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ (Z \otimes I) |01\rangle = Z|0\rangle \otimes I |1\rangle = |0\rangle \otimes |1 \rangle = |0 1\rangle $$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (Z \otimes I) |10\rangle = Z|1\rangle \otimes I |0\rangle = -|1\rangle \otimes |0 \rangle = -|1 0\rangle $$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (Z \otimes I) |11\rangle = Z|1\rangle \otimes I |1\rangle = -|1\rangle \otimes |1\rangle = -|1 1\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And because of linearity we have then ,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Z \otimes I \bigg( \dfrac{|01\rangle + |10 \rangle - |11\rangle}{\sqrt{3}} \bigg) =   \dfrac{|01\rangle - |10 \rangle + |11\rangle}{\sqrt{3}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the above circuit is exactly what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="13760" LastEditDate="2020-11-10T17:39:54.917" LastActivityDate="2020-11-10T17:39:54.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14536" PostTypeId="2" ParentId="14532" CreationDate="2020-11-08T19:53:24.677" Score="4" Body="&lt;p&gt;Quantum channels are &lt;em&gt;foremost&lt;/em&gt;, linear operators. So given a basis for the Hilbert-Schmidt operator space (for example the states &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle\langle 0|,|0\rangle\langle 1|,|1\rangle\langle 0|,|1\rangle\langle 1|\}$&lt;/span&gt; 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, &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(X) = \sum\limits_{j}^{} K_{j} X K_{j}^{\dagger}$$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sum\limits_{j}^{} K_{j}^{\dagger}  K_{j} = \mathbb{I}$&lt;/span&gt;, where its linear action is more &amp;quot;transparent&amp;quot; (I'm assuming the convex-combination way of writing is what's confusing you here). With this, the action of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle \langle  1 | $&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(| 0 \rangle \langle  1 | ) = \sum\limits_{j}^{} K_{j} | 0 \rangle \langle  1 | K_{j}^{\dagger}$&lt;/span&gt;, whatever that's equal to.&lt;/p&gt;&#xA;&lt;p&gt;There is no &amp;quot;meaning&amp;quot; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(|0\rangle\langle 1|)$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 1|$&lt;/span&gt; is not a state; so don't worry about interpreting it.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-11-08T19:53:24.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14537" PostTypeId="1" AcceptedAnswerId="14540" CreationDate="2020-11-08T22:23:19.797" Score="4" ViewCount="124" Body="&lt;p&gt;I'm trying to implement the same Jupyter notebook Jin-Sung Kim gave in his YouTube video &lt;a href=&quot;http://The%20Variational%20Quantum%20Eigensolver%20%E2%80%94%20Programming%20on%20Quantum%20Computers%20%E2%80%94%20Coding%20with%20Qiskit%20S2E4&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Variational Quantum Eigensolver — Programming on Quantum Computers — Coding with Qiskit S2E4&lt;/a&gt;; however, I'm facing the error as below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Error:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;step 0&#xA;/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.&#xA;  super().__init__()&#xA;/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.&#xA;  warnings.warn('Processing a dictionary result is deprecated,'&#xA;---------------------------------------------------------------------------&#xA;TypeError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-3-66becf9098c9&amp;gt; in &amp;lt;module&amp;gt;&#xA;     13     # exact classical result&#xA;     14     exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops)&#xA;---&amp;gt; 15     exact_result = operator.process_algorithm_result(exact_result)&#xA;     16 &#xA;     17     # VQE&#xA;&#xA;~/.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)&#xA;     88             return self._process_algorithm_result(algo_result)&#xA;     89         else:&#xA;---&amp;gt; 90             lines, result = self._process_algorithm_result(algo_result)&#xA;     91             result['algorithm_retvals'] = algo_result&#xA;     92             return lines, result&#xA;&#xA;~/.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)&#xA;    374             # TODO return self._process_algorithm_result_excited_states(algo_result)&#xA;    375         else:&#xA;--&amp;gt; 376             return self._process_algorithm_result_deprecated(algo_result)&#xA;    377 &#xA;    378     def _process_algorithm_result_ground_state(self, algo_result: MinimumEigensolverResult) \&#xA;&#xA;~/.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)&#xA;    419 &#xA;    420         # Ground state energy&#xA;--&amp;gt; 421         egse = algo_result['energy'] + self._energy_shift + self._ph_energy_shift&#xA;    422         result['energy'] = egse&#xA;    423         lines = ['=== GROUND STATE ENERGY ===']&#xA;&#xA;TypeError: 'NumPyMinimumEigensolver' object is not subscriptable&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Source-code:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# %%&#xA;import numpy as np &#xA;import pylab &#xA;import copy&#xA;from qiskit import BasicAer &#xA;from qiskit.aqua import aqua_globals, QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE &#xA;from qiskit.aqua.components.optimizers import SLSQP &#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver &#xA;from qiskit.chemistry.core import Hamiltonian, QubitMappingType&#xA;# %%&#xA;molecule = 'H .0 .0 -{0}; Li .0 .0 {0}'&#xA;distances = np.arange(0.5, 4.25, 0.25)&#xA;vqe_energies = []&#xA;hf_energies = []&#xA;exact_energies = []&#xA;# %%&#xA;for i, d in enumerate(distances):&#xA;    print('step', i)&#xA;&#xA;    # set up experiment:&#xA;    driver = PySCFDriver(molecule.format(d/2), basis='sto3g')&#xA;    qmolecule = driver.run()&#xA;    operator = Hamiltonian(qubit_mapping=QubitMappingType.PARITY,&#xA;                           two_qubit_reduction=True, &#xA;                           freeze_core=True,&#xA;                           orbital_reduction=[-3, -2])&#xA;    qubit_op, aux_ops = operator.run(qmolecule)&#xA;&#xA;    # exact classical result&#xA;    exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops)&#xA;    exact_result = operator.process_algorithm_result(exact_result)&#xA;&#xA;    # VQE&#xA;    optimzer = SLSQP(maxiter=1000)&#xA;    initial_state = HartreeFock(operator.molecule_info['num_orbitals'],&#xA;                                 operator.molecule_info['num_particles'],&#xA;                                 qubit_mapping=operator._qubit_mapping,&#xA;                                 two_qubit_reduction=operator._two_qubit_reduction)&#xA;    var_form = UCCSD(num_orbitals=operator.molecule_info['num_orbitals'],&#xA;                     num_particles=operator.molecule_info['num_particles'],&#xA;                     initial_state=initial_state,&#xA;                     qubit_mapping=operator._qubit_mapping,&#xA;                     two_qubit_reduction=operator._two_qubit_reduction)&#xA;    algo = VQE(qubit_op, var_form, optimzer, aux_operators=aux_ops)&#xA;&#xA;    vqe_result = algo.run(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;    vqe_result = operator.process_algorithm_result(vqe_result)&#xA;&#xA;    exact_energies.append(exact_result.energy)&#xA;    vqe_energies.append(vqe_result.energy)&#xA;    hf_energies.append(vqe_result.hartree_fock_energy)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="13751" LastEditorUserId="55" LastEditDate="2020-11-10T17:29:46.597" LastActivityDate="2020-11-10T17:29:46.597" Title="TypeError: 'NumPyMinimumEigensolver' object is not subscriptable" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14538" PostTypeId="2" ParentId="14476" CreationDate="2020-11-08T22:27:19.150" Score="1" Body="&lt;p&gt;The answers above noting that &lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt; neatly capture this. If you want an alternative way of seeing this, you can look at what &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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.)&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;When &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is applied to &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle \equiv \begin{bmatrix}1\\0\end{bmatrix}$&lt;/span&gt;, matrix multiplication means you can read off the first column of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to see what the coefficients of &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; are in the standard basis after applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to it. Specifically, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; takes &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is applied to &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle \equiv \begin{bmatrix}0\\1\end{bmatrix}$&lt;/span&gt;, matrix multiplication means you can read off the second column of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to see what the coefficients of &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; are in the standard basis after applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to it. Specifically, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; takes &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;To apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to each of the computational basis states a second time, we can just re-use the results from above:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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.$$&lt;/span&gt;&#xA;Since applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; twice to both computational basis states results in no change, applying &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to any state results in no change, i.e., &lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13752" LastActivityDate="2020-11-08T22:27:19.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14539" PostTypeId="2" ParentId="9035" CreationDate="2020-11-08T22:48:10.090" Score="2" Body="&lt;p&gt;I would also like to mention these:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://www.coursera.org/learn/quantum-computing-algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Introduction to Quantum Computing&lt;/a&gt;&lt;/strong&gt;: 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.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0521876583&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computer Science: An Introduction&lt;/a&gt;&lt;/strong&gt;: 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.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0262015064&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing: A Gentle Introduction&lt;/a&gt;&lt;/strong&gt;: 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:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13752" LastActivityDate="2020-11-08T22:48:10.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14540" PostTypeId="2" ParentId="14537" CreationDate="2020-11-08T22:56:34.930" Score="3" Body="&lt;p&gt;The line:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;should be&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops).run()&lt;/code&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Here is the full code that I ran and its output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# %%&#xA;import numpy as np &#xA;import pylab &#xA;import copy&#xA;from qiskit import BasicAer &#xA;from qiskit.aqua import aqua_globals, QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE &#xA;from qiskit.aqua.components.optimizers import SLSQP &#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver &#xA;from qiskit.chemistry.core import Hamiltonian, QubitMappingType&#xA;import matplotlib.pyplot as plt&#xA;%matplotlib inline&#xA;%config InlineBackend.figure_format = 'svg' # Makes the images look nice&#xA;&#xA;&#xA;molecule = 'H .0 .0 -{0}; Li .0 .0 {0}'&#xA;distances = np.arange(0.5, 4.25, 0.25)&#xA;vqe_energies = []&#xA;hf_energies = []&#xA;exact_energies = []&#xA;# %%&#xA;for i, d in enumerate(distances):&#xA;    print('step', i)&#xA;&#xA;    # set up experiment:&#xA;    driver = PySCFDriver(molecule.format(d/2), basis='sto3g')&#xA;    qmolecule = driver.run()&#xA;    operator = Hamiltonian(qubit_mapping=QubitMappingType.PARITY,&#xA;                           two_qubit_reduction=True, &#xA;                           freeze_core=True,&#xA;                           orbital_reduction=[-3, -2])&#xA;    qubit_op, aux_ops = operator.run(qmolecule)&#xA;&#xA;    # exact classical result&#xA;    exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops).run()&#xA;    exact_result = operator.process_algorithm_result(exact_result)&#xA;&#xA;    # VQE&#xA;    optimzer = SLSQP(maxiter=1000)&#xA;    initial_state = HartreeFock(operator.molecule_info['num_orbitals'],&#xA;                                 operator.molecule_info['num_particles'],&#xA;                                 qubit_mapping=operator._qubit_mapping,&#xA;                                 two_qubit_reduction=operator._two_qubit_reduction)&#xA;    var_form = UCCSD(num_orbitals=operator.molecule_info['num_orbitals'],&#xA;                     num_particles=operator.molecule_info['num_particles'],&#xA;                     initial_state=initial_state,&#xA;                     qubit_mapping=operator._qubit_mapping,&#xA;                     two_qubit_reduction=operator._two_qubit_reduction)&#xA;    algo = VQE(qubit_op, var_form, optimzer, aux_operators=aux_ops)&#xA;&#xA;    vqe_result = algo.run(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;    vqe_result = operator.process_algorithm_result(vqe_result)&#xA;&#xA;    exact_energies.append(exact_result.energy)&#xA;    vqe_energies.append(vqe_result.energy)&#xA;    hf_energies.append(vqe_result.hartree_fock_energy)&#xA;    &#xA;fig = plt.figure()&#xA;plt.plot(distances,vqe_energies, label ='Mean Values')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8oBXj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8oBXj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-08T22:56:34.930" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14541" PostTypeId="1" AcceptedAnswerId="14549" CreationDate="2020-11-09T09:53:10.830" Score="0" ViewCount="113" Body="&lt;p&gt;I work on comparing QSVM and Classic SVM (SKlearnSVM) with using Qiskit. I have to show&#xA;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).&#xA;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).&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13482" LastEditorUserId="55" LastEditDate="2020-11-10T17:29:52.670" LastActivityDate="2020-11-10T17:29:52.670" Title="Comparing QSVM &amp; Classic SVM on BigData. Quantum Supremacy" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;quantum-advantage&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14542" PostTypeId="1" CreationDate="2020-11-09T10:33:19.137" Score="-1" ViewCount="111" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;The UN Sustainable Development Goals:&#xA;1-No poverty&#xA;2-Zero hunger&#xA;3-Good health and well-being&#xA;4-Quality education&#xA;5-Gender equality&#xA;6-Clean water and sanitation&#xA;7-Affordable and clean energy&#xA;8-Decent work and economic growth&#xA;9-Industry, innovation and infrastructure&#xA;10-Reduced inequalities&#xA;11-Sustainable cities and communities&#xA;12-Responsible consumption and production&#xA;13-Climate action&#xA;14-Life below water&#xA;15-Life on land&#xA;16-Peace, justice and strong institutions&#xA;17-Partnerships for the goals&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="13756" LastEditorUserId="1937" LastEditDate="2020-11-11T08:31:29.400" LastActivityDate="2020-11-12T21:20:18.097" Title="University Project - Quantum computing and it's social impact?" Tags="&lt;resource-request&gt;&lt;applications&gt;" AnswerCount="3" CommentCount="0" ClosedDate="2020-11-10T12:20:02.713" ContentLicense="CC BY-SA 4.0" />
  <row Id="14543" PostTypeId="1" CreationDate="2020-11-09T11:25:21.283" Score="3" ViewCount="49" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;For instance, which kind of two qubit gate they physically implement. Their quality, etc.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-11-10T17:30:13.797" LastActivityDate="2020-11-10T17:30:13.797" Title="Gate characteristics of different platforms" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14544" PostTypeId="1" AcceptedAnswerId="15747" CreationDate="2020-11-09T12:02:04.043" Score="3" ViewCount="73" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state which is not known to him. Bob then does a projective measurement with &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; outcomes. The measurement is known to both parties before the protocol starts. I am interested in the communication cost of simulating this protocol.&lt;/p&gt;&#xA;&lt;p&gt;Option 1: Alice teleports her state to Bob with the cost of &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; classical bits of communication. Bob applies the unitary correction required and then measures the state.&lt;/p&gt;&#xA;&lt;p&gt;Option 2: Alice does the projective measurement herself and simply communicates &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; bit of information to Bob.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-bit (or at least fewer than &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; bits) of communication?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="10480" LastEditDate="2021-01-30T07:07:29.147" LastActivityDate="2021-01-30T07:07:29.147" Title="Teleportation followed by measurement: Lowering communication cost" Tags="&lt;teleportation&gt;&lt;communication&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14545" PostTypeId="2" ParentId="14542" CreationDate="2020-11-09T14:27:13.207" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Decent work and economic growth&lt;/em&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Industry, innovation, and infrastructure&lt;/em&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Climate action&lt;/em&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Partnerships for the goals&lt;/em&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12624" LastActivityDate="2020-11-09T14:27:13.207" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14546" PostTypeId="2" ParentId="14542" CreationDate="2020-11-09T14:36:52.097" Score="1" Body="&lt;p&gt;I believe these links will be useful:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://publications.iadb.org/en/quantum-technologies-digital-transformation-social-impact-and-cross-sector-disruption&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Technologies: Digital Transformation, Social Impact, and Cross-sector Disruption&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://epsrc.ukri.org/newsevents/pubs/epsrc-quantum-technologies-public-dialogue-full-report/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Technologies - Public Dialogue Report&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/pdf/1712.05380.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Potential Impact of Quantum Computers on Society&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2020-11-09T14:36:52.097" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14547" PostTypeId="1" CreationDate="2020-11-09T15:34:58.790" Score="5" ViewCount="91" Body="&lt;p&gt;The QFT on the group &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_N$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;QFT\,|k\rangle =\frac{1}{\sqrt{N}} \sum_{j=0}^{N-1} e^{2\pi i\,jk/N}|j\rangle\,.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The usual circuit implements the QFT with &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Does anyone know how to realize this transformation when &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is not a power of 2? I have found an algorithm that approximates a QFT with arbitrary &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$N=p$&lt;/span&gt; is a prime number.&lt;/p&gt;&#xA;&lt;p&gt;I'm interested in particular on the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_3$&lt;/span&gt; transform, which corresponds to the matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;   \frac{1}{\sqrt{3}}\,\begin{pmatrix}&#xA;         1&amp;amp;1&amp;amp;1 \\ 1&amp;amp;e^{2\pi i/3}&amp;amp;e^{-2\pi i/3} \\ 1&amp;amp;e^{-2\pi i/3}&amp;amp;e^{2\pi i/3}&#xA;    \end{pmatrix}\,.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^2$&lt;/span&gt; dimensional Hilbert space. One possibility could be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;  \begin{pmatrix}&#xA;    \frac{1}{\sqrt3 }&#xA;        \begin{pmatrix}&#xA;        1&amp;amp;1&amp;amp;1 \\ 1&amp;amp;e^{2\pi i/3}&amp;amp;e^{-2\pi i/3} \\ 1&amp;amp;e^{-2\pi i/3}&amp;amp;e^{2\pi i/3}&#xA;        \end{pmatrix} &amp;amp;  \\&#xA;                     &amp;amp; 1&#xA;    \end{pmatrix}\,,&#xA;\end{equation}&lt;/span&gt;&#xA;but then how can we realize it exactly? When &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; we can get the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}$&lt;/span&gt; prefactor with the n Hadamard gates that prepare the uniform superpositions, but now that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{3}$&lt;/span&gt; factor is really bothering me.&lt;/p&gt;&#xA;" OwnerUserId="13748" LastEditorUserId="13748" LastEditDate="2020-11-10T10:08:44.987" LastActivityDate="2020-11-10T10:08:44.987" Title="Quantum Fourier Transform for general cyclic groups" Tags="&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14548" PostTypeId="1" AcceptedAnswerId="14551" CreationDate="2020-11-09T15:56:30.420" Score="3" ViewCount="87" Body="&lt;p&gt;A passage on page 86 of &lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt; by &lt;em&gt;Michael A. Nielsen &amp;amp; Isaac L. Chuang&lt;/em&gt; has been bugging me for a while,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose the states &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_i\rangle$&lt;/span&gt; are orthonormal. Then Bob can do a quantum measurement to distinguish these states, using the following procedure. Define measurement operators &lt;span class=&quot;math-container&quot;&gt;$M_i\equiv \vert \psi_i\rangle\langle\psi_i\vert$&lt;/span&gt;, one for each possible index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, and an additional measurement operator &lt;span class=&quot;math-container&quot;&gt;$M_0$&lt;/span&gt; defined as the positive square root of the positive operator &lt;span class=&quot;math-container&quot;&gt;$I-\sum_{i\ne0}\vert \psi_i\rangle\langle\psi_i\vert$&lt;/span&gt;. These operators satisfy the completeness relation, and if the state &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_i\rangle$&lt;/span&gt; is prepared then &lt;span class=&quot;math-container&quot;&gt;$p(i)=\langle\psi_i\vert M_i\vert\psi_i\rangle=1$&lt;/span&gt;, so the result &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; occurs with certainty. Thus, it is possible to reliably distinguish the orthonormal states &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here Bob is presented with a state &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_i\rangle$&lt;/span&gt; from orthonormal states &lt;span class=&quot;math-container&quot;&gt;$\{\vert \psi_i\rangle\}_{1\le i\le n}$&lt;/span&gt; and his task is to identify the index correctly.&lt;/p&gt;&#xA;&lt;p&gt;The setup seems very strange to me. When Bob &amp;quot;measures&amp;quot; the state &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_i\rangle$&lt;/span&gt;, 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 &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; occurs with certainty&amp;quot; even mean? Does it mean that &lt;span class=&quot;math-container&quot;&gt;$\vert \psi_i\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13098" LastActivityDate="2020-11-10T20:17:22.347" Title="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}$?" Tags="&lt;measurement&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14549" PostTypeId="2" ParentId="14541" CreationDate="2020-11-09T16:17:17.347" Score="1" Body="&lt;p&gt;There is a difference between &lt;strong&gt;Quantum Supremacy&lt;/strong&gt; and &lt;strong&gt;Quantum Advantage&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Quantum Supremacy has been shown on a quantum computer, first by Google in 2019 through their paper &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum supremacy using a programmable superconducting processor&lt;/a&gt;. Roughly speaking, quantum supremacy test is about generating random states that is not at all efficient classical simulatable.&lt;/p&gt;&#xA;&lt;p&gt;Quantum advantage is about solving practical problems with speed-up over classical computer even against the world's best supercomputer. This is &lt;strong&gt;no where&lt;/strong&gt; 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!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6hqTF.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6hqTF.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;a href=&quot;http://%20https://arxiv.org/abs/2009.12472&quot; rel=&quot;nofollow noreferrer&quot;&gt;How will quantum computers provide an industrially relevant computational advantage in quantum chemistry?&lt;/a&gt;  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 &lt;a href=&quot;https://arxiv.org/abs/2011.03494&quot; rel=&quot;nofollow noreferrer&quot;&gt;new proposed techniques&lt;/a&gt; that can shorten the computational time for the quantum computers on these problems but the quantum resource (number of qubits) is very high.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;So if you are looking for quantum advantage on your problem with current devices, then I don't you will find it.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-09T16:17:17.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14550" PostTypeId="2" ParentId="14548" CreationDate="2020-11-09T16:17:37.523" Score="2" Body="&lt;p&gt;Here note that &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; with the positive operator &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle\langle \psi_i|$&lt;/span&gt; the resulting state is &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-11-09T16:20:48.743" LastActivityDate="2020-11-09T16:20:48.743" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="14551" PostTypeId="2" ParentId="14548" CreationDate="2020-11-09T16:22:01.373" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When Bob &amp;quot;measures&amp;quot; the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, shouldn't the state collapse to a computational basis assuming the measurement was done in it with probabilities given by the coefficients?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The measurement is not* being done in the computational basis, the measurement operators are explicitly defined as &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}_i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$M_i = |\psi_i\rangle \langle \psi_i |$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi_i \rangle$&lt;/span&gt; and the measurement gave outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; then the post-measument state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;And what does &amp;quot; occurs with certainty&amp;quot; even mean?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This means suppose that Bob is given the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i \rangle$&lt;/span&gt; and performs the measurement corresponding to the operators &lt;span class=&quot;math-container&quot;&gt;$\{M_i \}_i$&lt;/span&gt;. Then with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; he will get the outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. To see this we just use the Born rule: the probability getting outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; given he received the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;p(j|i) &amp;amp;= \mathrm{Tr}[ M_j |\psi_i \rangle \langle \psi_i |]\\&#xA;&amp;amp;= \mathrm{Tr}[ |\psi_j \rangle \langle \psi_j |\psi_i \rangle \langle \psi_i |] \\&#xA;&amp;amp;= \delta_{ij}&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\delta_{ij}$&lt;/span&gt; equals &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i=j$&lt;/span&gt; and zero otherwise.&lt;/p&gt;&#xA;&lt;p&gt;*Really we can choose any basis to be the computational basis so this is up to however you define computational.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Response to comments&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; satisfy &lt;span class=&quot;math-container&quot;&gt;$0 \leq M_i \leq I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_i M_i = I$&lt;/span&gt;. When I measure some state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with the measurement &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}_i$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$p(j)$&lt;/span&gt;, tell me that it measured the outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. The probability with which it reports the outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; is given by the Born rule,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(j) = \mathrm{Tr}[M_j \rho].&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; the state after measurement is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{M_j^{1/2} \rho M_{j}^{1/2}}{\mathrm{Tr}[M_j \rho]}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-11-09T20:15:18.997" LastActivityDate="2020-11-09T20:15:18.997" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="14552" PostTypeId="1" CreationDate="2020-11-09T16:30:50.547" Score="3" ViewCount="39" Body="&lt;p&gt;Even though Trotterized Hamiltonians have polynomial time scaling directly, the process of quantum phase estimation means that the controlled unitaries &lt;span class=&quot;math-container&quot;&gt;$ CU$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="55" LastEditDate="2020-11-10T17:31:02.923" LastActivityDate="2020-11-10T17:31:02.923" Title="Reducing cost of Phase Estimation for Trotterization" Tags="&lt;algorithm&gt;&lt;hamiltonian-simulation&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14554" PostTypeId="2" ParentId="14543" CreationDate="2020-11-09T19:57:37.950" Score="2" Body="&lt;p&gt;For &lt;strong&gt;IBM&lt;/strong&gt; 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 &lt;code&gt;ibmq_santiago&lt;/code&gt; machine specification I can run:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_santiago')&#xA;backend&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which will output the following Widget:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9VUOC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9VUOC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There you can see that the two qubit gate that is &lt;strong&gt;native&lt;/strong&gt; to this machine is &lt;strong&gt;CNOT gate&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print('Gate Pulse Duration Time on Different Qubit: \n')&#xA;for gate in backend.properties().gates:&#xA;    print(&amp;quot;{} gate on qubits {} duration is {}{}&amp;quot;.format(gate.name, gate.qubits, gate.parameters[1].value, gate.parameters[1].unit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which will print out something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fhiJ1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fhiJ1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-09T19:57:37.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14555" PostTypeId="2" ParentId="14547" CreationDate="2020-11-09T20:50:55.450" Score="3" Body="&lt;p&gt;Kitaev &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9511026&quot; rel=&quot;nofollow noreferrer&quot;&gt;gave&lt;/a&gt; an algorithm to approximate Quantum Fourier Transform over an arbitrary cyclic group.&lt;/p&gt;&#xA;&lt;p&gt;Later, Mosca and Zalka &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301093&quot; rel=&quot;nofollow noreferrer&quot;&gt;showed&lt;/a&gt; how his construction can be made exact.&lt;/p&gt;&#xA;&lt;p&gt;You can find a nice description for Kitaev algorithm in &lt;a href=&quot;https://courses.cs.washington.edu/courses/cse599d/06wi/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dave Bacon&lt;/a&gt; lecture notes for example.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2020-11-09T20:50:55.450" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14556" PostTypeId="1" AcceptedAnswerId="14559" CreationDate="2020-11-09T22:59:44.733" Score="4" ViewCount="503" Body="&lt;p&gt;The following are the matrices for SWAP and iSWAP gates.&lt;/p&gt;&#xA;&lt;p&gt;SWAP =&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;            1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;            0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;        \end{pmatrix}&lt;/span&gt;&#xA;iSWAP =&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;            1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; i &amp;amp; 0 \\&#xA;            0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;        \end{pmatrix}&lt;/span&gt;&#xA;Both are similar except iSWAP adds a phase to &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; amplitudes.&lt;/p&gt;&#xA;&lt;p&gt;How can the SWAP operation be realized using the iSWAP gate?&lt;/p&gt;&#xA;" OwnerUserId="4722" LastEditorUserId="55" LastEditDate="2020-11-24T14:20:18.197" LastActivityDate="2020-11-24T14:20:18.197" Title="How to realize SWAP operation using iSWAP gate?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14557" PostTypeId="2" ParentId="14542" CreationDate="2020-11-09T23:46:38.990" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;No Poverty&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Zero hunger&lt;/strong&gt;: 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, &lt;a href=&quot;https://en.wikipedia.org/wiki/Haber_process#Economic_and_environmental_aspects&quot; rel=&quot;nofollow noreferrer&quot;&gt;which is estimated to account for 1-2% of world energy consumption&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Good health&lt;/strong&gt;: 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 &lt;em&gt;in silico&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quality education&lt;/strong&gt;: I have nothing for you here, maybe someone else has some ideas.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Gender equality&lt;/strong&gt;: See number 4.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clean water and sanitation&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Affordable clean energy&lt;/strong&gt;: 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).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decent work and economic growth&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Industry, innovation, and infrastructure&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reduced inequalities&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sustainable cities and communities&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Responsible consumption and production&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Climate action&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Life below water&lt;/strong&gt;: Unclear.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Life on land&lt;/strong&gt;: Unclear.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Peace, justice, and strong institutions&lt;/strong&gt;: 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Partnerships for the goals&lt;/strong&gt;: N/A?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2020-11-12T21:20:18.097" LastActivityDate="2020-11-12T21:20:18.097" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14559" PostTypeId="2" ParentId="14556" CreationDate="2020-11-09T23:55:35.643" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;But you can do it with three:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22QFT2%22%5D%2C%5B%22inputA2%22%2C1%2C%22%2B%3DA2%22%5D%2C%5B%22%E2%80%A6%22%5D%2C%5B%22%E2%80%A6%22%5D%2C%5B%22Amps4%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22%7Ed691%22%5D%2C%5B1%2C%22X%5E%C2%BD%22%5D%2C%5B%22%7Ed691%22%5D%2C%5B%22X%5E%C2%BD%22%5D%2C%5B%22%7Ed691%22%5D%2C%5B1%2C%22X%5E%C2%BD%22%5D%2C%5B%22Amps4%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22%7Ed691%22%2C%22name%22%3A%22iSwap%22%2C%22matrix%22%3A%22%7B%7B1%2C0%2C0%2C0%7D%2C%7B0%2C0%2Ci%2C0%7D%2C%7B0%2Ci%2C0%2C0%7D%2C%7B0%2C0%2C0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8oIaq.png&quot; alt=&quot;iswap circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-09T23:55:35.643" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14560" PostTypeId="1" CreationDate="2020-11-10T00:36:10.040" Score="2" ViewCount="40" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I have come accross the followng paper &lt;a href=&quot;https://export.arxiv.org/ftp/arxiv/papers/1908/1908.07943.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Optimized Quantum Maximum or Minimum Searching Algorithm and its Circuits&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The paper proposes this QUMMSA algorithm to find the minimum or maximum in a dataset.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;How do I best implement the circut?&lt;/p&gt;&#xA;" OwnerUserId="13729" LastEditorUserId="55" LastEditDate="2020-11-24T14:19:56.080" LastActivityDate="2020-11-24T14:19:56.080" Title="How to implement the Maximum or Minimum Searching Algorithm (QUMMSA) circuit in Quirk?" Tags="&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14561" PostTypeId="2" ParentId="14556" CreationDate="2020-11-10T00:38:26.803" Score="2" Body="&lt;p&gt;Using matrix multiplication,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}&#xA;            1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;            0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;        \end{pmatrix}&#xA;=&#xA;\begin{pmatrix}&#xA;            1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; i &amp;amp; 0 \\&#xA;            0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;        \end{pmatrix}&#xA;\begin{pmatrix}&#xA;            1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; -i &amp;amp; 0 &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; -i &amp;amp; 0 \\&#xA;            0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;        \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;So the question is which gates does the second matrix in the matrix multiplication on the right represent?&lt;/p&gt;&#xA;&lt;p&gt;A starting point is that the phase gate is &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{pmatrix}$&lt;/span&gt; and that the Z-gate is &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{pmatrix}\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{pmatrix} = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -i \end{pmatrix}$&lt;/span&gt;. This gets us the upper left portion of the second matrix.&lt;/p&gt;&#xA;&lt;p&gt;Once we have &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -i \end{pmatrix}$&lt;/span&gt;, we can use the X-gate &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt; and pre-and post-multiply it:&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}\begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -i \end{pmatrix}\begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} =  \begin{pmatrix} -i &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix}$&lt;/span&gt;. This gets the lower right portion of the second matrix.&lt;/p&gt;&#xA;" OwnerUserId="13752" LastActivityDate="2020-11-10T00:38:26.803" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14562" PostTypeId="1" CreationDate="2020-11-10T07:56:55.537" Score="1" ViewCount="366" Body="&lt;p&gt;Quantum gates are basically matrices belonging to &lt;span class=&quot;math-container&quot;&gt;$C_{2\times2}$&lt;/span&gt;. 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).&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;So that means any unitary matrix is a rotation?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;One funny thing, is this similar to rotation matrices similar to &lt;span class=&quot;math-container&quot;&gt;$R^{3}$&lt;/span&gt; with determinant 1 etc?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2020-11-24T14:18:53.620" LastActivityDate="2020-11-24T14:18:53.620" Title="What are the properties of the matrices representing quantum gates?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14563" PostTypeId="1" CreationDate="2020-11-10T08:10:07.763" Score="1" ViewCount="28" Body="&lt;p&gt;I am trying to change the appearance of the circuit_drawer in output='mpl' mode. The registers of the Quantum Circuit are named like (&lt;span class=&quot;math-container&quot;&gt;$q0_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q0_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q1_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q2_0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q2_1$&lt;/span&gt;,..) 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?&lt;/p&gt;&#xA;&lt;p&gt;To be clear what I would like to change:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0QE2K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0QE2K.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13659" LastEditorUserId="55" LastEditDate="2020-11-24T14:18:22.740" LastActivityDate="2020-11-24T14:18:22.740" Title="How to change the names of the registers displayed with circuit_drawer (output='mpl')" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14564" PostTypeId="2" ParentId="14563" CreationDate="2020-11-10T08:24:56.767" Score="3" Body="&lt;p&gt;When initializing the registers for the quantum circuit you need to set the parameter 'name'. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;f_in = QuantumRegister(n, name='f_in')&#xA;###add other registers here### &#xA;qc = QuantumCircuit(f_in, ...)&#xA;qc.draw(ouput='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Gives the output:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vdmJi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vdmJi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13659" LastActivityDate="2020-11-10T08:24:56.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14565" PostTypeId="2" ParentId="14562" CreationDate="2020-11-10T09:20:50.137" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A unitary matrix with a real numbers is exactly an orthogonal matrix. We have &lt;span class=&quot;math-container&quot;&gt;$U^\dagger = (\overline{U})^T$&lt;/span&gt; for any matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, for unitary we have &lt;span class=&quot;math-container&quot;&gt;$UU^\dagger=I$&lt;/span&gt;, and for real we have &lt;span class=&quot;math-container&quot;&gt;$U=\overline{U}$&lt;/span&gt;. Hence &lt;span class=&quot;math-container&quot;&gt;$UU^T=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Their determinant can be any complex number with modulus &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2020-11-10T09:20:50.137" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14566" PostTypeId="2" ParentId="14548" CreationDate="2020-11-10T09:33:04.323" Score="2" Body="&lt;p&gt;Perhaps it's more illuminating to look at &lt;em&gt;how&lt;/em&gt; the measurement is made.&lt;/p&gt;&#xA;&lt;p&gt;Since the set of states &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}_{1\le i\le n}$&lt;/span&gt; is not assumed to form a complete basis, we need to first complete them. Assume that the dimension of the Hilbert space is &lt;span class=&quot;math-container&quot;&gt;$d \ge n+1$&lt;/span&gt;, and define states &lt;span class=&quot;math-container&quot;&gt;$|\psi_{n+1}\rangle,|\psi_{n+2}\rangle,\ldots,|\psi_{d}\rangle$&lt;/span&gt; so that the set &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}_{1\le i\le d}$&lt;/span&gt; is a complete basis. This can always be done, for example with the Gram-Schmidt procedure.&lt;/p&gt;&#xA;&lt;p&gt;We want to do a measurement in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}_{1\le i\le d}$&lt;/span&gt;, but we cannot do that, we can only make a measurement in the computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle\}_{1\le i\le n}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;What we do then is apply the unitary &lt;span class=&quot;math-container&quot;&gt;$$ U = \sum_{i=1}^d |i\rangle\langle \psi_i|$$&lt;/span&gt; to his initial state, and then make a measurement in the computational basis. It is easy to check that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is in fact a unitary, as &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = U U^\dagger = I$&lt;/span&gt;, so it is always possible to implement it. How to implement it, and how difficult it is, depends of course on the specific set &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}_{1\le i\le d}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now suppose the initial state is one of these states, say &lt;span class=&quot;math-container&quot;&gt;$|\psi_3\rangle$&lt;/span&gt;. What happens? Bob applies &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to it, and gets &lt;span class=&quot;math-container&quot;&gt;$U|\psi_3\rangle = |3\rangle$&lt;/span&gt;. Now he measures &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;With this procedure the probability of outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is given by the measurement operators defined in the question:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_i := |\psi_i\rangle\langle\psi_i|$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$1\le i \le n$&lt;/span&gt;, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_0 := \sum_{k=n+1}^d |\psi_k\rangle\langle\psi_k| = I-\sum_{k=1}^n |\psi_k\rangle\langle\psi_k|.$$&lt;/span&gt;&#xA;The post-measurement state will not be given by them, though, as they give a post-measurement state in the set &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_i\rangle\}_{1\le i\le d}$&lt;/span&gt; , but the procedure here gives one in the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastEditorUserId="12541" LastEditDate="2020-11-10T20:17:22.347" LastActivityDate="2020-11-10T20:17:22.347" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14567" PostTypeId="2" ParentId="14562" CreationDate="2020-11-10T11:49:11.497" Score="1" Body="&lt;p&gt;Since I think question 1 is solved well by the upper answer, I will skip to question 2.&lt;/p&gt;&#xA;&lt;p&gt;They have some similar property with the rotation in &lt;span class=&quot;math-container&quot;&gt;$R^3$&lt;/span&gt;, but from a group theory point of view, the quantum gates(2D unitary matrix) belong to a larger group, &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, while 3D rotations belong to &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt;, and there is a two-to-one map between &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; contains &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt;). For a detailed explanation, see &lt;a href=&quot;https://en.wikipedia.org/wiki/3D_rotation_group#Connection_between_SO(3)_and_SU(2)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$R^3$&lt;/span&gt; case, this is nonsense.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-10T11:49:11.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14568" PostTypeId="2" ParentId="14438" CreationDate="2020-11-10T14:51:49.340" Score="1" Body="&lt;p&gt;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 &amp;quot;backward induction proof&amp;quot; of the ideal quantum coin tossing is impossible theorem in &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9711065.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9711065.pdf&lt;/a&gt; to ultimately give a contradiction.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-concealing and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;-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.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-12-16T17:37:01.787" LastActivityDate="2020-12-16T17:37:01.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14569" PostTypeId="1" CreationDate="2020-11-10T15:40:11.887" Score="1" ViewCount="30" Body="&lt;p&gt;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?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CxzvZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CxzvZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import time&#xA;from typing import List, Optional, Any&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt &#xA;&#xA;from docplex.mp.model import Model&#xA;&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver&#xA;from qiskit.optimization.algorithms import CobylaOptimizer, MinimumEigenOptimizer&#xA;from qiskit.optimization.problems import QuadraticProgram&#xA;from qiskit.optimization.algorithms.admm_optimizer import ADMMParameters, ADMMOptimizer&#xA;&#xA;# If CPLEX is installed, you can uncomment this line to import the CplexOptimizer.&#xA;# CPLEX can be used in this tutorial to solve the convex continuous problem, &#xA;# but also as a reference to solve the QUBO, or even the full problem.&#xA;# &#xA;# from qiskit.optimization.algorithms import CplexOptimizer&#xA;&#xA;# define COBYLA optimizer to handle convex continuous problems.&#xA;cobyla = CobylaOptimizer()&#xA;&#xA;# define QAOA via the minimum eigen optimizer&#xA;qaoa = MinimumEigenOptimizer(QAOA(quantum_instance=BasicAer.get_backend('statevector_simulator')))&#xA;&#xA;# exact QUBO solver as classical benchmark&#xA;exact = MinimumEigenOptimizer(NumPyMinimumEigensolver()) # to solve QUBOs&#xA;&#xA;# in case CPLEX is installed it can also be used for the convex problems, the QUBO, &#xA;# or as a benchmark for the full problem.&#xA;#&#xA;# cplex = CplexOptimizer()&#xA;&#xA;# construct model using docplex&#xA;mdl = Model('ex6')&#xA;&#xA;v = mdl.binary_var(name='a')&#xA;w = mdl.binary_var(name='w')&#xA;t = mdl.binary_var(name='t')&#xA;u = mdl.continuous_var(name='u')&#xA;&#xA;mdl.minimize(v + w + t + 5 * (u-2)**2)&#xA;mdl.add_constraint(v + 2 * w + t + u &amp;lt;= 3, &amp;quot;cons1&amp;quot;)&#xA;mdl.add_constraint(v + w + t &amp;gt;= 1, &amp;quot;cons2&amp;quot;)&#xA;mdl.add_constraint(v + w == 1, &amp;quot;cons3&amp;quot;)&#xA;&#xA;# load quadratic program from docplex model&#xA;qp = QuadraticProgram()&#xA;#qp.from_docplex(mdl)&#xA;print(qp.export_as_lp_string())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And here is the link to the tutorial: &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/optimization/5_admm_optimizer.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/optimization/5_admm_optimizer.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13765" LastEditorUserId="9858" LastEditDate="2020-11-10T16:24:16.913" LastActivityDate="2020-11-10T16:24:16.913" Title="Tutorial, optimization part, 5_admm_optimizer has attribute error" Tags="&lt;programming&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2020-12-14T14:16:38.123" ContentLicense="CC BY-SA 4.0" />
  <row Id="14572" PostTypeId="2" ParentId="14522" CreationDate="2020-11-10T17:32:58.590" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Now, my question is what is the use of above representation, if all the operation are defined on initial state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-11-10T17:32:58.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14573" PostTypeId="1" CreationDate="2020-11-10T18:36:18.040" Score="4" ViewCount="37" Body="&lt;p&gt;In the HHL algorithm, we need to estimate the eigenvalues of a matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. The result is stored in a register with &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; qubits. Let &lt;span class=&quot;math-container&quot;&gt;$T = 2^l$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; cannot be too small, otherwise the result would have a large error. How large should &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; be?&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/pdf/0811.3171.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper&lt;/a&gt; (p. 11) states: we make the assumption that &lt;span class=&quot;math-container&quot;&gt;$\delta \leq T/10$&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$\delta = \lambda_jt_0 - 2\pi k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_j$&lt;/span&gt; is any eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; is another parameter to be chosen, and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an integer that ranges from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$T - 1$&lt;/span&gt;. However, this means that &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; may be anything between &lt;span class=&quot;math-container&quot;&gt;$\lambda_jt_0 - 2\pi T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_jt_0$&lt;/span&gt;. How is it possible to guarantee that &lt;span class=&quot;math-container&quot;&gt;$\delta \leq T/10$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13769" LastEditorUserId="55" LastEditDate="2020-11-24T14:17:04.240" LastActivityDate="2020-11-24T14:17:04.240" Title="In the HHL algorithm, how large should the eigenvalue estimation register be?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14574" PostTypeId="1" CreationDate="2020-11-10T20:37:52.437" Score="3" ViewCount="36" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wrz6N.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wrz6N.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this possible? What is the best way to go about creating this plot?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="13770" LastEditorUserId="1859" LastEditDate="2020-11-10T21:46:07.830" LastActivityDate="2020-11-11T01:19:10.067" Title="Is it possible to plot the average counts from two jobs with multiple circuits on a single histogram in Qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14575" PostTypeId="2" ParentId="14574" CreationDate="2020-11-11T01:19:10.067" Score="1" Body="&lt;p&gt;Yes, I have checked the code and find out that this is possible.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here comes a simple illustration.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.visualization import plot_histogram&#xA;dict1={'00':2,'01':3,'10':1,'11':5}&#xA;dict2={'00':0,'01':6,'10':7,'11':4}&#xA;plot_histogram([dict1,dict2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the resulting bar plot will be&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eCM0U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eCM0U.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-11T01:19:10.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14576" PostTypeId="1" CreationDate="2020-11-11T01:25:27.917" Score="3" ViewCount="130" Body="&lt;p&gt;There are thousands of articles, books and web sites describing the Hadamard Gate from a theoretical point of view.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Only some articles speaking about optical implementation of Hadamard gates.&#xA;(&lt;a href=&quot;https://ieeexplore.ieee.org/document/5612120%20https://arxiv.org/pdf/quant-ph/9706022.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;An approach to realize a quantum Hadamard gate through optical implementation&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;Maybe the following is the only one I've found with some information, though quite theoretical too (&lt;a href=&quot;https://www.nature.com/articles/s41598-019-49657-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Realization of efficient quantum gates with a superconducting qubit-qutrit circuit&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;How are the IBM and Google Hadamard gates fabricated (or created in the laboratory) and operated?&lt;/p&gt;&#xA;" OwnerUserId="5138" LastEditorUserId="55" LastEditDate="2020-11-11T14:51:19.420" LastActivityDate="2020-11-12T05:39:27.637" Title="How are the IBM's and Google's Hadamard gates fabricated and operated?" Tags="&lt;physical-realization&gt;&lt;hadamard&gt;&lt;ibm&gt;&lt;superconducting-quantum-computing&gt;&lt;google-sycamore&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14577" PostTypeId="1" CreationDate="2020-11-11T05:06:04.930" Score="1" ViewCount="74" Body="&lt;p&gt;I found that how to make CRY Gates.&#xA;But I don't know how to make Controlled-CRY Gates.&#xA;Please show me a figure.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VPXlF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VPXlF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;Sorry for the poor English.&lt;/p&gt;&#xA;" OwnerUserId="13730" LastEditorUserId="55" LastEditDate="2020-11-13T16:22:22.607" LastActivityDate="2020-11-13T16:22:22.607" Title="How to make Controlled-CRY Gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14578" PostTypeId="2" ParentId="14577" CreationDate="2020-11-11T05:25:24.870" Score="2" Body="&lt;p&gt;If you are asking about the gate decomposition of &lt;span class=&quot;math-container&quot;&gt;$CCR_Y$&lt;/span&gt; then it is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qrjuE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qrjuE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The picture above was &lt;a href=&quot;https://arxiv.org/pdf/1912.01618.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;taken from this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The more generalize case is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sheJS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sheJS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is from &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this textbook&lt;/a&gt; on page 182.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-11T05:25:24.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14579" PostTypeId="2" ParentId="14576" CreationDate="2020-11-11T07:43:20.633" Score="3" Body="&lt;p&gt;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=BZ+\Omega(t)X,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are the standard Pauli matrices, and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is a constant.&lt;/p&gt;&#xA;&lt;p&gt;The goal is &amp;quot;simply&amp;quot; to specify the function &lt;span class=&quot;math-container&quot;&gt;$\Omega(t)$&lt;/span&gt; to generate whatever unitary evolution you want according to the differential equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;i\frac{d|\psi\rangle}{dt}=H|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the specific case of Hadamard, you can just set &lt;span class=&quot;math-container&quot;&gt;$\Omega(t)=B$&lt;/span&gt; (assuming this is possible given the system constraints) for a fixed length of time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt;. Your evolution is then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}}&#xA;$$&lt;/span&gt;&#xA;So, if I pick &lt;span class=&quot;math-container&quot;&gt;$B\sqrt{2}t_0=\pi/2$&lt;/span&gt;, we get the evolution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=-i\frac{X+Z}{\sqrt{2}},&#xA;$$&lt;/span&gt;&#xA;which is Hadamard up to an (irrelevant) global phase.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-11T07:43:20.633" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14580" PostTypeId="1" CreationDate="2020-11-11T10:09:12.087" Score="0" ViewCount="96" Body="&lt;p&gt;I try to run HHL algorithm on qasm_simulator. I took the example from &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/legacy_tutorials/aqua/linear_systems_of_equations.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I try to solve 8x8 random matrix and adjust some parameters in &lt;code&gt;create_eigs&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;aqua_globals.random_seed = 0&#xA;matrix = random_hermitian(8)&#xA;vector = matrix.dot(np.array([1, 2, 3, 4, 5, 6,7,8]))&#xA;&#xA;orig_size = len(vector)&#xA;matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix, vector)&#xA;&#xA;# Initialize eigenvalue finding module&#xA;eigs = create_eigs(matrix, 3, 10, False)&#xA;num_q, num_a = eigs.get_register_sizes()&#xA;&#xA;# Initialize initial state module&#xA;init_state = Custom(num_q, state_vector=vector)&#xA;&#xA;# Initialize reciprocal rotation module&#xA;reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)&#xA;&#xA;algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,&#xA;           init_state, reci, num_q, num_a, orig_size)&#xA;result = algo.run(QuantumInstance(Aer.get_backend('qasm_simulator')))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, this error occur.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;BrokenProcessPool                         Traceback (most recent call last)&#xA;&amp;lt;ipython-input-8-105a0b6b991d&amp;gt; in &amp;lt;module&amp;gt;&#xA;     18 algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,&#xA;     19            init_state, reci, num_q, num_a, orig_size)&#xA;---&amp;gt; 20 result = algo.run(QuantumInstance(Aer.get_backend('qasm_simulator')))&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)&#xA;     69                 self.quantum_instance = quantum_instance&#xA;     70 &#xA;---&amp;gt; 71         return self._run()&#xA;     72 &#xA;     73     @abstractmethod&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in _run(self)&#xA;    407         else:&#xA;    408             self.construct_circuit(measurement=False)&#xA;--&amp;gt; 409             self._state_tomography()&#xA;    410         # Adding a bit of general result information&#xA;    411         self._ret[&amp;quot;matrix&amp;quot;] = self._resize_matrix(self._matrix)&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in _state_tomography(self)&#xA;    341 &#xA;    342         # Extracting the probability of successful run&#xA;--&amp;gt; 343         results = self._quantum_instance.execute(tomo_circuits)&#xA;    344         probs = []&#xA;    345         for circ in tomo_circuits:&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/aqua/quantum_instance.py in execute(self, circuits, had_transpiled)&#xA;    268         # maybe compile&#xA;    269         if not had_transpiled:&#xA;--&amp;gt; 270             circuits = self.transpile(circuits)&#xA;    271 &#xA;    272         # assemble&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/aqua/quantum_instance.py in transpile(self, circuits)&#xA;    229                                   the length is one.&#xA;    230         &amp;quot;&amp;quot;&amp;quot;&#xA;--&amp;gt; 231         transpiled_circuits = compiler.transpile(circuits, self._backend, **self._backend_config,&#xA;    232                                                  **self._compile_config)&#xA;    233         if not isinstance(transpiled_circuits, list):&#xA;&#xA;~/.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)&#xA;    241 &#xA;    242     # Transpile circuits in parallel&#xA;--&amp;gt; 243     circuits = parallel_map(_transpile_circuit, list(zip(circuits, transpile_args)))&#xA;    244 &#xA;    245     if len(circuits) == 1:&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/tools/parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)&#xA;    133             # Otherwise just reset parallel flag and error&#xA;    134             os.environ['QISKIT_IN_PARALLEL'] = 'FALSE'&#xA;--&amp;gt; 135             raise error&#xA;    136 &#xA;    137         Publisher().publish(&amp;quot;terra.parallel.finish&amp;quot;)&#xA;&#xA;~/.local/lib/python3.8/site-packages/qiskit/tools/parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)&#xA;    123                 future = executor.map(_task_wrapper, param)&#xA;    124 &#xA;--&amp;gt; 125             results = list(future)&#xA;    126             Publisher().publish(&amp;quot;terra.parallel.done&amp;quot;, len(results))&#xA;    127 &#xA;&#xA;/usr/lib/python3.8/concurrent/futures/process.py in _chain_from_iterable_of_lists(iterable)&#xA;    482     careful not to keep references to yielded objects.&#xA;    483     &amp;quot;&amp;quot;&amp;quot;&#xA;--&amp;gt; 484     for element in iterable:&#xA;    485         element.reverse()&#xA;    486         while element:&#xA;&#xA;/usr/lib/python3.8/concurrent/futures/_base.py in result_iterator()&#xA;    609                     # Careful not to keep a reference to the popped future&#xA;    610                     if timeout is None:&#xA;--&amp;gt; 611                         yield fs.pop().result()&#xA;    612                     else:&#xA;    613                         yield fs.pop().result(end_time - time.monotonic())&#xA;&#xA;/usr/lib/python3.8/concurrent/futures/_base.py in result(self, timeout)&#xA;    430                 raise CancelledError()&#xA;    431             elif self._state == FINISHED:&#xA;--&amp;gt; 432                 return self.__get_result()&#xA;    433 &#xA;    434             self._condition.wait(timeout)&#xA;&#xA;/usr/lib/python3.8/concurrent/futures/_base.py in __get_result(self)&#xA;    386     def __get_result(self):&#xA;    387         if self._exception:&#xA;--&amp;gt; 388             raise self._exception&#xA;    389         else:&#xA;    390             return self._result&#xA;&#xA;BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Please tell me how to fix this error.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13676" LastActivityDate="2021-04-10T12:00:55.070" Title="Qiskit HHL algorithm BrokenProcessPool error" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14581" PostTypeId="2" ParentId="14580" CreationDate="2020-11-11T11:37:00.540" Score="0" Body="&lt;p&gt;Multiprocessing in Python 3.8 sometimes has some hiccups, especially when used in combination with Matplotlib and Qiskit. You could try several things:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Run Python 3.7 instead of 3.8 (that's also likely to be faster since there's less overhead in the parallelization)&lt;/li&gt;&#xA;&lt;li&gt;Check if you used Matplotlib somewhere and try to avoid it before the running the algorithm.&lt;/li&gt;&#xA;&lt;li&gt;Disable parallelization by setting&#xA;&lt;pre&gt;&lt;code&gt;import os&#xA;os.environ['QISKIT_IN_PARALLEL'] = True  # pretends the code already runs in parallel&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The first option is probably the best. The third option disables parallelization so it will slow down the computation if the circuits are large!&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-11-11T11:37:00.540" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14582" PostTypeId="1" AcceptedAnswerId="14608" CreationDate="2020-11-11T12:40:55.193" Score="2" ViewCount="82" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\vert\Phi\rangle_{AR} = \frac{1}{\sqrt{|D|}}\sum_{i\in D} \vert ii\rangle_{AR}$&lt;/span&gt; is the maximally entangled state. Let &lt;span class=&quot;math-container&quot;&gt;$V_{A\rightarrow BE}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde{V}_{A\rightarrow BE}$&lt;/span&gt; be two isometries from &lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$H_B\otimes H_E$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle\Phi_{AR}\vert I_R\otimes \tilde{V}^\dagger V\vert\Phi_{AR}\rangle\geq 1- \varepsilon$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My questions are about the map &lt;span class=&quot;math-container&quot;&gt;$\tilde{V}^\dagger V$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Is &lt;span class=&quot;math-container&quot;&gt;$\tilde{V}^\dagger V\leq I_A$&lt;/span&gt; in a positive semidefinite sense? Following Rammus' comment, perhaps this doesn't make sense. Instead, how can one show that &lt;span class=&quot;math-container&quot;&gt;$\|I - \tilde{V}^\dagger V\|_1 = \text{tr}(I - \tilde{V}^\dagger V)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How can one show that &lt;span class=&quot;math-container&quot;&gt;$\|I_A - \tilde{V}^\dagger V \|_1\leq \varepsilon|D|$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Both these claims are made in Lemma 14 of &lt;a href=&quot;https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=6757002&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-11-11T15:03:15.700" LastActivityDate="2020-11-12T16:17:52.537" Title="Properties of composition of isometry and a perturbed adjoint" Tags="&lt;fidelity&gt;&lt;trace-distance&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14583" PostTypeId="1" CreationDate="2020-11-11T13:11:48.007" Score="3" ViewCount="64" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What are the matrices that has &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{\pi}{8}\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|\frac{5 \pi}{8}\right&amp;gt;$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{1,-1\}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I can relate an operator with eigenbasis geometrically, but I do not know how to represent the operator matrix using these eigenbases and eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="13783" LastActivityDate="2020-11-14T07:28:31.437" Title="How to find original matrix from eigenbasis and eigenvalues?" Tags="&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14584" PostTypeId="2" ParentId="14583" CreationDate="2020-11-11T13:16:53.727" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-11T13:16:53.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14585" PostTypeId="1" CreationDate="2020-11-11T14:15:52.850" Score="1" ViewCount="143" Body="&lt;p&gt;In order to explore whether it is possible to train a Qiskit Quantum circuit with tensorflow I built a small toy model.&#xA;The purpose of this toy model is to find via tensorflow the correct angle to get &amp;quot;zero&amp;quot; output independent of the input.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import qiskit&#xA;from qiskit.circuit import QuantumCircuit, QuantumRegister&#xA;import tensorflow as tf&#xA;from tensorflow.keras.layers import Input, Dense, Layer&#xA;&#xA;def QuantumCircuit(thetas, n_qubits=1):&#xA;   &#xA;   simulator = qiskit.Aer.get_backend('qasm_simulator')&#xA;   shots=1024&#xA;&#xA;   circuit= qiskit.QuantumCircuit(n_qubits)&#xA;   circuit.h(0)&#xA;   circuit.ry(float(thetas),0)&#xA;   circuit.measure_all()&#xA;   &#xA;   job = qiskit.execute(circuit,backend=simulator,shots=shots)&#xA;   result = job.result().get_counts(circuit)&#xA;&#xA;   counts = np.array(list(result.values()))&#xA;   states = np.array(list(result.keys())).astype(float)&#xA;&#xA;   # Compute probabilities for each state&#xA;   probabilities = counts / shots&#xA;   # Get state expectation&#xA;   expectation = np.sum(states * probabilities)&#xA;&#xA;   return np.array(expectation)&#xA;&#xA;class Linear(Layer):&#xA;   def __init__(self,units=1,input_dim=1):&#xA;       super(Linear,self).__init__()&#xA;       self.w = self.add_weight(shape=(input_dim,units),initializer='random_uniform', trainable=True)        &#xA;       &#xA;   def call(self, inputs, input_dim=1):&#xA;       if (tf.executing_eagerly()):&#xA;           return QuantumCircuit(self.w)           &#xA;       return inputs&#xA;&#xA;x_train = np.arange(10)&#xA;y_train = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])&#xA;&#xA;inputs=Input(shape=(1,))&#xA;outputs=Linear()(inputs)&#xA;model=tf.keras.models.Model(inputs=inputs,outputs=outputs)&#xA;model.summary()&#xA;model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.01),&#xA;loss=tf.keras.losses.MeanSquaredError())&#xA;model.fit(x_train, y_train, epochs=100, batch_size=1, verbose=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Unfortunately the toy model doesn't work and I get the following error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;optimizer_v2.py:1219 _filter_grads&#xA;([v.name for _, v in grads_and_vars],))&#xA;ValueError: No gradients provided for any variable: ['Variable:0'].&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;So I tried to calculate the gradient &amp;quot;by myself&amp;quot;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@tf.custom_gradient&#xA;def custom_activation(w):&#xA;    result  = QuantumCircuit(w)&#xA;    &#xA;    def grad(dy):&#xA;        eps=0.0001&#xA;        result1=QuantumCircuit(w)&#xA;        result2=QuantumCircuit(w+eps)&#xA;        grad=(result2-result1)/eps&#xA;        return dy * [grad]&#xA;&#xA;    return result, grad&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;as an intermediate step before the Quantum circuit is called. But this works out neither :-(&lt;/p&gt;&#xA;&lt;p&gt;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 ?&#xA;Thanks a lot !!&lt;/p&gt;&#xA;" OwnerUserId="7545" LastActivityDate="2020-11-11T16:47:27.827" Title="Usage of Tensorflow/Keras to train Qiskit circuits" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14586" PostTypeId="2" ParentId="10126" CreationDate="2020-11-11T14:36:33.167" Score="3" Body="&lt;p&gt;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, &lt;a href=&quot;https://arxiv.org/abs/0904.4483&quot; rel=&quot;nofollow noreferrer&quot;&gt;link product&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal E:A\to B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal F:B\to C$&lt;/span&gt; be two linear maps, and &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal E)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal F)$&lt;/span&gt; their Choi representations. The Choi representation of their composition &lt;span class=&quot;math-container&quot;&gt;$\mathcal F \circ \mathcal E$&lt;/span&gt; is then given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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],$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$T_B$&lt;/span&gt; is the partial transposition over subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-11-11T14:36:33.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14587" PostTypeId="2" ParentId="6144" CreationDate="2020-11-11T14:58:48.493" Score="1" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is positive but not completely positive, then it gives an operator that has positive trace with separable quantum states, that is, an entanglement witness.&lt;/p&gt;&#xA;&lt;p&gt;To see that, let &lt;span class=&quot;math-container&quot;&gt;$|\Omega\rangle := \sum_i |ii\rangle$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$J(\Phi) = I \otimes \Phi ( |\Omega\rangle\langle\Omega|)$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; be positive semidefinite operators of the appropriate dimensions. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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,$$&lt;/span&gt;&#xA;as the adjoint of a positive map is always positive.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-11-11T14:58:48.493" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14588" PostTypeId="1" CreationDate="2020-11-11T15:09:54.403" Score="4" ViewCount="99" Body="&lt;p&gt;&lt;em&gt;&lt;a href=&quot;https://mathoverflow.net/questions/376200/is-the-set-of-two-qubit-absolutely-separable-states-convex-and-if-so-what-are&quot;&gt;Companion question&lt;/a&gt; on MathOverflow&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us order the four nonnegative eigenvalues, summing to 1, of a two-qubit density matrix (&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;) as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;1 \geq x \geq y \geq z \geq (1-x-y-z) \geq 0.&#xA;\end{equation}&lt;/span&gt;&#xA;The set (&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;) of absolutely separable states (those that can not be &amp;quot;entangled&amp;quot; by global unitary transformations) is defined by the additional inequality (eq. (1) in &lt;a href=&quot;https://arxiv.org/abs/1911.13145&quot; rel=&quot;nofollow noreferrer&quot;&gt;Halder&lt;/a&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;x - z \leq 2 \sqrt{y (1-x-y-z)}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is the set &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, that is,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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)}, &#xA;\end{equation}&lt;/span&gt;&#xA;convex?&lt;/p&gt;&#xA;&lt;p&gt;If so, I would like to seek to determine the John ellipsoids &lt;a href=&quot;https://mathematica.stackexchange.com/questions/230127/evaluate-a-certain-three-dimensional-constrained-integral&quot;&gt;JohnEllipoids&lt;/a&gt; containing and contained within &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;  and see if they are simply the same as the circumscribed (&lt;span class=&quot;math-container&quot;&gt;$\mbox{Tr}(\rho^2) \leq \frac{3}{8}$&lt;/span&gt;) and inscribed (&lt;span class=&quot;math-container&quot;&gt;$\mbox{Tr}(\rho^2) \leq \frac{1}{3}$&lt;/span&gt;) sets, respectively &lt;a href=&quot;https://arxiv.org/abs/2007.00891&quot; rel=&quot;nofollow noreferrer&quot;&gt;Adhikari&lt;/a&gt;  .&lt;/p&gt;&#xA;&lt;p&gt;These two sets are determined by the constraints&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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}.&#xA;\end{equation}&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;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}.&#xA;\end{equation}&lt;/span&gt;&#xA;(The latter set corresponds to the separable &amp;quot;maximal ball&amp;quot; inscribed in the set of two-qubit states (sec. 16.7 &lt;a href=&quot;https://www.researchgate.net/profile/Karol_Zyczkowski/publication/325707595_Geometry_of_quantum_states_An_introduction_to_quantum_entanglement/links/5e6ab206299bf12e23c03ea7/Geometry-of-quantum-states-An-introduction-to-quantum-entanglement.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;GeometryQuantumStates&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Further, I am interested in the Hilbert-Schmidt probabilities (relative volumes) &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0305-4470/36/39/310/meta?casa_token=fwoPejONTqAAAAAA:lLOen_ZF-qPZxA0BpVDC03MA6-Cy2zHRHJFUssRFxYN_G8sHHllthiDt_XTVVUMDpbr4AHxSmc82Up0WpWk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hilbert-Schmidt&lt;/a&gt; of these various sets. These probabilities are obtained by integrating over these sets the expression&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;9081072000 \left(\lambda _1-\lambda _2\right){}^2 \left(\lambda _1-\lambda _3\right){}^2 \left(\lambda&#xA;   _2-\lambda _3\right){}^2 \left(2 \lambda _1+\lambda _2+\lambda _3-1\right){}^2 \left(\lambda _1+2&#xA;   \lambda _2+\lambda _3-1\right){}^2 \left(\lambda _1+\lambda _2+2 \lambda _3-1\right){}^2,&#xA;\end{equation}&lt;/span&gt;&#xA;where the four eigenvalues are indicated. (This integrates to 1, when only the eigenvalue-ordering constraint--given at the very outset--is imposed.)&lt;/p&gt;&#xA;&lt;p&gt;In the answer to &lt;a href=&quot;https://mathematica.stackexchange.com/questions/234086/find-the-probability-relative-volume-of-a-certain-4-ball-with-respect-to-hilbe&quot;&gt;4-ball&lt;/a&gt;, we report formulas for the Hilbert-Schmidt probabilities (relative volumes) of these inscribed and circumscribed sets, that is,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\frac{35 \pi }{23328 \sqrt{3}} \approx 0.00272132&#xA;\end{equation}&lt;/span&gt;&#xA;and the considerably larger&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\frac{35 \sqrt{\frac{1}{3} \left(2692167889921345-919847607929856 \sqrt{6}\right)} \pi}{27518828544} \approx 0.0483353.&#xA;\end{equation}&lt;/span&gt;&#xA;(We also have given an exact--but still quite cumbersome--formula [&lt;span class=&quot;math-container&quot;&gt;$\approx 0.00484591$&lt;/span&gt;] for &lt;span class=&quot;math-container&quot;&gt;$\mbox{Tr}(\rho^2) \leq \frac{17}{50}$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Further, in the answers to &lt;a href=&quot;https://mathematica.stackexchange.com/questions/230127/evaluate-a-certain-three-dimensional-constrained-integral&quot;&gt;AbsSepVol1&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13749/give-an-explicit-derivation-of-the-exact-formula-for-the-two-qubit-absolute-sepa&quot;&gt;AbsSep2&lt;/a&gt; ,&#xA;the formula for the Hilbert-Schmidt volume (confirming and rexpressing the one given in&#xA;&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0393044008001381#bb16&quot; rel=&quot;nofollow noreferrer&quot;&gt;2009paper&lt;/a&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\frac{29902415923}{497664}-\frac{50274109}{512 \sqrt{2}}-\frac{3072529845 \pi }{32768&#xA;   \sqrt{2}}+\frac{1024176615 \cos ^{-1}\left(\frac{1}{3}\right)}{4096 \sqrt{2}} \approx 0.00365826&#xA;\end{equation}&lt;/span&gt;&#xA;of the intermediate absolutely separable set &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; has been given.&lt;/p&gt;&#xA;&lt;p&gt;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{8}{33} \approx 0.242424$&lt;/span&gt; &lt;a href=&quot;https://link.springer.com/article/10.1007/s11128-018-1854-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;MasterLovasAndai&lt;/a&gt; . (One can also enquire as to the John ellipsoids for this [known-to-be] convex set &lt;a href=&quot;https://mathoverflow.net/questions/369287/what-are-the-john-ellipsoids-for-a-pair-of-9-and-15-dimensional-convex-sets-o&quot;&gt;JohnEllipsoid2&lt;/a&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Here is a joint plot of the three sets of central interest here.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.wolframcloud.com/obj/paulslater/Published/ThreeSetPlot&quot; rel=&quot;nofollow noreferrer&quot;&gt;ThreeSetPlot&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="3089" LastEditorUserId="2927" LastEditDate="2020-11-14T14:15:20.353" LastActivityDate="2020-11-14T14:15:20.353" Title="Is the set of two-qubit absolutely separable states convex?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;mathematics&gt;&lt;density-matrix&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14589" PostTypeId="2" ParentId="14585" CreationDate="2020-11-11T16:24:29.217" Score="0" Body="&lt;p&gt;I would use &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/introduction/pennylane.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pennylane&lt;/a&gt; to do that. And Pennylane offers a &lt;a href=&quot;https://pennylaneqiskit.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;plugin to Qiskit&lt;/a&gt; so you can run your circuit on IBM's hardware.&lt;/p&gt;&#xA;&lt;p&gt;Although with the new Qiskit release, they provide a gradient frame work within Qiskit if you are interested. Here is the &lt;a href=&quot;https://medium.com/qiskit/introducing-the-new-qiskit-chemistry-module-and-gradients-framework-for-next-level-quantum-ebaf2be4c1a&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to the announcement.&lt;/a&gt;. And here is the &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/operators/02_gradients_framework.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to  their tutorial notebook on gradient framework&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-11T16:40:24.410" LastActivityDate="2020-11-11T16:40:24.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14590" PostTypeId="1" CreationDate="2020-11-11T16:34:54.433" Score="3" ViewCount="40" Body="&lt;p&gt;I am reading through the following article &lt;a href=&quot;https://arxiv.org/abs/1601.02036&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1601.02036&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Eq. (22) describes one of the terms of the gradient of the log-likelihood cost function, which can be estimated using Boltzmann averaging.&lt;/p&gt;&#xA;&lt;p&gt;Eq. (22) looks like this&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{Tr[e^{-H}\delta_\theta H]}{Tr[e^{-H}]},$$&lt;/span&gt;&#xA;and the article states that this term can be estimated by sampling from eq. (12).&lt;/p&gt;&#xA;&lt;p&gt;Eq. (12) looks like this&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = \frac{e^{-H}}{Tr[e^{-H}]}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can someone give me an explanation of how this is done on a quantum computer?&#xA;I was thinking that the expectation of the truncated Taylor expansion term &lt;span class=&quot;math-container&quot;&gt;$e^{-H} \approx I - H$&lt;/span&gt; could be evaluated&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \langle v| I - H |v \rangle, $$&lt;/span&gt;&#xA;for every basis state &lt;span class=&quot;math-container&quot;&gt;$|v \rangle$&lt;/span&gt; and this would make it possible to estimate the diagonal of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. However, this task would be exponential in the number of qubits so I suspect that this is not how to do it. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="5632" LastEditorUserId="55" LastEditDate="2020-11-13T17:05:39.003" LastActivityDate="2020-11-13T17:05:39.003" Title="Quantum Boltzmann machine: How do you sample from the Boltzmann distribution on a quantum computer?" Tags="&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;quantum-boltzmann-machine&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14591" PostTypeId="2" ParentId="14585" CreationDate="2020-11-11T16:47:27.827" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For the specific use case, &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/code/api/pennylane.qnn.KerasLayer.html?highlight=keraslayer#pennylane.qnn.KerasLayer&quot; rel=&quot;nofollow noreferrer&quot;&gt;using PennyLane you could create a KerasLayer natively&lt;/a&gt;, to create a quantum layer. Such a quantum layer can then be used together with classical layers defined using Keras.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Additional direct references that would be helpful:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://pennylaneqiskit.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;PennyLane-Qiskit Plugin:&lt;/a&gt; allows using Qiskit devices (e.g., Aer devices with the &lt;code&gt;qasm_simulator&lt;/code&gt; backend)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/introduction/interfaces/tf.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The TensorFlow interface of PennyLane:&lt;/a&gt; allows interfacing with TensorFlow and using TensorFlow optimizers&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer: I'm one of the developers working on PennyLane.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="8786" LastActivityDate="2020-11-11T16:47:27.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14592" PostTypeId="1" CreationDate="2020-11-11T18:31:48.380" Score="2" ViewCount="104" Body="&lt;p&gt;I was trying to solve an exercise from Vazirani's course &amp;quot;Qubits, Quantum Mechanics and Computers&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;A mathematically nice, but unphysical, way to detect entanglement is to use the state inversion operator, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, which, for all states &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; acts as &lt;span class=&quot;math-container&quot;&gt;$T\vert n\rangle = \vert -n\rangle$&lt;/span&gt;. Why can’t this operator be realized physically?&lt;/p&gt;&#xA;&lt;p&gt;Can anyone help me with this problem? Many thanks! The problem is from &lt;a href=&quot;https://inst.eecs.berkeley.edu/%7Ecs191/fa10/homework/hw7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://inst.eecs.berkeley.edu/~cs191/fa10/homework/hw7.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13785" LastEditorUserId="1108" LastEditDate="2020-11-12T14:28:17.623" LastActivityDate="2020-11-12T19:18:55.960" Title="Can the (universal) state inversion operator be physically realized?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-realization&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14593" PostTypeId="2" ParentId="14576" CreationDate="2020-11-11T20:02:34.790" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3fX23.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3fX23.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-11-11T20:11:30.190" LastActivityDate="2020-11-11T20:11:30.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14594" PostTypeId="1" AcceptedAnswerId="14595" CreationDate="2020-11-11T23:44:54.610" Score="4" ViewCount="106" Body="&lt;p&gt;I had a question last week regarding the simulation of Hamiltonians composed of the sum of Pauli products: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14507/how-can-i-simulate-hamiltonians-composed-of-pauli-matrices&quot;&gt;How can I simulate Hamiltonians composed of Pauli matrices?&lt;/a&gt; I'm having a follow-up question: still for those two Hamiltonians:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{1} = X_1+ Y_2 + Z_1\otimes Z_2&#xA;\\&#xA;H_{2} = X_1\otimes Y_2 + Z_1\otimes Z_2&#xA;$$&lt;/span&gt;&#xA;How can I perform the 'controlled version' of them? The thing really confused me is the 'tensor product term': for both &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2020-11-12T00:17:02.893" LastActivityDate="2020-11-12T05:30:06.190" Title="Simulate Hamiltonians with Pauli operations (controlled time evolution)" Tags="&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14595" PostTypeId="2" ParentId="14594" CreationDate="2020-11-12T01:01:16.690" Score="2" Body="&lt;p&gt;So we know that &lt;span class=&quot;math-container&quot;&gt;$e^{i t H_2}$&lt;/span&gt; has the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nYQh5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nYQh5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;From &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11406/9858&quot;&gt;this answer&lt;/a&gt; along with page 13 from &lt;a href=&quot;https://arxiv.org/abs/1001.3855&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; we can try to build the controlled-version of &lt;span class=&quot;math-container&quot;&gt;$e^{i t H_2}$&lt;/span&gt; as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ovdat.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ovdat.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-12T05:30:06.190" LastActivityDate="2020-11-12T05:30:06.190" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14596" PostTypeId="1" CreationDate="2020-11-12T01:46:26.393" Score="0" ViewCount="74" Body="&lt;p&gt;Is there a quantum circuit (preferably on Quirk as an example) that will enable me to find the maximum from two inputs?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;input A: 11011&lt;/li&gt;&#xA;&lt;li&gt;input B: 11100&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Expected output:&lt;/strong&gt; 11100&lt;/p&gt;&#xA;" OwnerUserId="13729" LastEditorUserId="55" LastEditDate="2020-11-13T16:18:45.423" LastActivityDate="2020-11-13T16:18:45.423" Title="Is there a quantum circuit to find the maximum of two inputs?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14597" PostTypeId="1" CreationDate="2020-11-12T02:32:10.193" Score="2" ViewCount="78" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For instance, see the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def swappedOp(obj,qr0,qr1,index):&#xA;    circ=QuantumCircuit(qr0,qr1)&#xA;    circ.swap(qr0[qr0.__len__()-1],qr1[index])&#xA;    circ.append(obj,[qr0[i] for i in range(qr0.__len__())]+[qr1[i] for i in range(qr1.__len__())])&#xA;    circ.swap(qr0[qr0.__len__()-1],qr1[index])&#xA;    return Operator(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;qr0&lt;/code&gt; and &lt;code&gt;qr1[index]&lt;/code&gt;) and the latter swap makes sure that in other operations the sequence is unchanged.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;QuantumCircuit object only takes QuantumRegsiter as&#xA;input (not qubit)&lt;/strong&gt; and this is computationally inefficient.&lt;/p&gt;&#xA;&lt;p&gt;So what I want to know is: is there a way to convert between &lt;code&gt;qubit&lt;/code&gt; object and &lt;code&gt;QuantumRegister&lt;/code&gt; object? If so, this can be time-saving!&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="9006" LastEditDate="2020-11-13T10:22:40.687" LastActivityDate="2020-11-17T12:14:20.287" Title="Qiskit programming: convert qubit to quantum register" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14598" PostTypeId="2" ParentId="14576" CreationDate="2020-11-12T05:39:27.637" Score="1" Body="&lt;p&gt;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;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4VurL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4VurL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then on the device, the qubit is being act on by the following microwave pulse:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jnkOU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jnkOU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/pulse/6_pulse_scheduler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;strong&gt;More details can be found here on the qiskit documentation page&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-12T05:39:27.637" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14599" PostTypeId="2" ParentId="9408" CreationDate="2020-11-12T06:42:29.630" Score="0" Body="&lt;p&gt;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. &lt;a href=&quot;https://algassert.com/quantum/2014/05/03/Storing-Bandwidth-with-Superdense-Coding.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/quantum/2014/05/03/Storing-Bandwidth-with-Superdense-Coding.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also use it to turn a two way link into a faster one way link. &lt;a href=&quot;https://algassert.com/quantum/2015/01/17/Superdense-Coding-on-the-Fly-and-in-Reverse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/quantum/2015/01/17/Superdense-Coding-on-the-Fly-and-in-Reverse.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-12T06:42:29.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14600" PostTypeId="2" ParentId="14597" CreationDate="2020-11-12T07:42:34.080" Score="1" Body="&lt;p&gt;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, &lt;code&gt;[Qubit]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;However&lt;/em&gt; you don't have to use the &lt;code&gt;Qubit&lt;/code&gt; or &lt;code&gt;QuantumRegister&lt;/code&gt; types at all. You can instead work with indices, which is often much more convenient. E.g. you code above could be written as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def swappedOp(obj, qr0, qr1, index):&#xA;    m, n = len(qr0), len(qr1)  # store the number of qubits&#xA;    circ = QuantumCircuit(m + n)&#xA;    circ.swap(m - 1, m + index)&#xA;    circ.append(obj, circ.qubits)  # circ.qubits are just all qubits in the circuit&#xA;    circ.swap(m - 1, m + index)&#xA;    return Operator(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm not quite sure what &lt;code&gt;obj&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;I hope this gives you the tools you need!&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-11-12T07:42:34.080" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14601" PostTypeId="2" ParentId="14583" CreationDate="2020-11-12T07:49:10.747" Score="2" Body="&lt;p&gt;Any normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; and respective eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle$&lt;/span&gt; can be writen as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_{i=1}^{n} \lambda_i |u_i\rangle\langle u_i|.&#xA;$$&lt;/span&gt;&#xA;This is called spectral decomposition.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note that a matrix is normal if &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger=A^\dagger A$&lt;/span&gt; holds. Hermitian and unitary matrices are special cases of normal ones.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-11-14T07:28:31.437" LastActivityDate="2020-11-14T07:28:31.437" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14602" PostTypeId="2" ParentId="14596" CreationDate="2020-11-12T08:41:14.397" Score="1" Body="&lt;p&gt;The easiest way is with a temporary comparison to decide which input to copy over:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22inputA4%22,1,1,1,%22inputB4%22,1,1,1,%22%5EA%3CB%22%5D,%5B%22inputA4%22,1,1,1,1,1,1,1,%22%E2%97%A6%22,%22%5E=A4%22%5D,%5B1,1,1,1,%22inputA4%22,1,1,1,%22%E2%80%A2%22,%22%5E=A4%22%5D,%5B%22inputA4%22,1,1,1,%22inputB4%22,1,1,1,%22%5EA%3CB%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y7xmE.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-12T08:41:14.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14603" PostTypeId="1" CreationDate="2020-11-12T09:19:08.363" Score="5" ViewCount="108" Body="&lt;p&gt;Using &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cirq&lt;/code&gt;&lt;/a&gt;, I have the following quantum circuit, with three parameters: phi, alpha and beta:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q0 = cirq.GridQubit(0,0)&#xA;q1 = cirq.GridQubit(0,1)&#xA;&#xA;phi = sp.Symbol('phi')&#xA;alpha = sp.Symbol('alpha')&#xA;beta = sp.Symbol('beta')&#xA;circuit = cirq.Circuit([&#xA;                cirq.H(q0),&#xA;                cirq.CNOT(q0,q1),&#xA;                cirq.XPowGate(exponent=phi)(q0),&#xA;                cirq.H(q1),&#xA;                cirq.X(q1) ** (alpha*phi),&#xA;                cirq.XX(q0,q1) ** (beta*phi),&#xA;                cirq.measure(q0, q1, key='m')&#xA;                ])&#xA;SVGCircuit(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XVmI7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XVmI7.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This circuit is just some randomness I was playing with, so please don't take it too seriously...&lt;/p&gt;&#xA;&lt;p&gt;If I fix the values of alpha=2 and beta=-3 and perform a scan over phi from &lt;span class=&quot;math-container&quot;&gt;$[0,2\pi]$&lt;/span&gt; I can generate a distribution of the number of times the system is measured in state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; (actually not 100% sure I am right here)...&lt;/p&gt;&#xA;&lt;p&gt;Example scan with phi=0.25&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; resolver = cirq.ParamResolver({'phi':0.25,'alpha':alpha,'beta':beta})              &#xA;&amp;gt;&amp;gt;&amp;gt; trials = cirq.Simulator().run(circuit, resolver, repetitions=1000)&#xA;&amp;gt;&amp;gt;&amp;gt; trials.histogram(key='m')&#xA;Counter({0: 726, 2: 124, 3: 122, 1: 28})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Plotting &lt;code&gt;trials.histogram(key='m')[0]&lt;/code&gt; as a function of phi, I get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rZV04.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rZV04.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Finally, my question...&lt;/h2&gt;&#xA;&lt;p&gt;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?&#xA;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&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.tensorflow.org/quantum/api_docs/python/tfq&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;tfq&lt;/code&gt;&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Any suggestions? Or suggestions to move to qiskit/pennylane?&lt;/p&gt;&#xA;" OwnerUserId="13792" LastEditorUserId="4986" LastEditDate="2020-11-16T08:34:40.540" LastActivityDate="2020-11-16T10:30:45.693" Title="How to learn parameters in a quantum circuit, given an interference pattern?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;machine-learning&gt;&lt;tfq&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14604" PostTypeId="2" ParentId="14603" CreationDate="2020-11-12T14:04:03.803" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;But a critical problem arises, &lt;strong&gt;is the correct answer always possible&lt;/strong&gt;?&lt;/p&gt;&#xA;&lt;p&gt;For example, in a two-dimensional rotation case, we know that R(&lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;)R(&lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;)=R(&lt;span class=&quot;math-container&quot;&gt;$\alpha+\beta$&lt;/span&gt;), so consider the R(&lt;span class=&quot;math-container&quot;&gt;$\alpha+\beta$&lt;/span&gt;) as the oracle, it is impossible to learn the value of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; (but &lt;span class=&quot;math-container&quot;&gt;$\alpha+\beta$&lt;/span&gt; is possible). This example is rather coarse, maybe you can extend it to a more general case.&lt;/p&gt;&#xA;&lt;p&gt;And there is intentionally another difficulty, that is, how can we reduce the oracle from the QNN?&lt;/p&gt;&#xA;&lt;p&gt;E.g., the oracle is a two-qubit Hadamard gate (&lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt;) and the QNN architecture is &lt;code&gt;[2,3,2]&lt;/code&gt;, then what we get is a network of unitaries or a large unitary with dimension &lt;span class=&quot;math-container&quot;&gt;$2^7\times2^7$&lt;/span&gt;, then is it an easy job to reduce the two-qubit Hadamard gate (&lt;span class=&quot;math-container&quot;&gt;$2^2\times2^2$&lt;/span&gt;)?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.nature.com/articles/s41467-020-14454-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; is great.&lt;/p&gt;&#xA;&lt;p&gt;I am new to QNN and looking for more discussion.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-12T14:04:03.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14605" PostTypeId="2" ParentId="14350" CreationDate="2020-11-12T14:05:13.250" Score="2" Body="&lt;p&gt;The Hilbert space of a two-qubit system is &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-dimensional complex vector space. An arbitrary normalized vector in this space can be written as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\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}}$$&lt;/span&gt;&#xA;Since an overall phase doesn't change the state of the system, we may choose the first component &lt;span class=&quot;math-container&quot;&gt;$w_0$&lt;/span&gt; as real, thus if we define (for &lt;span class=&quot;math-container&quot;&gt;$w_0\ne 0$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$z_i = \frac{w_i}{w_0}$$&lt;/span&gt;&#xA;We obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle= \frac{[1 \, z_1 \, z_2 \, z_3]^t}{\sqrt{1+|z_1|^2+|z_2|^2+|z_3|^2}}$$&lt;/span&gt;&#xA;The coordinate functions &lt;span class=&quot;math-container&quot;&gt;$z_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$z_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$z_3$&lt;/span&gt; parametrize almost everywhere the complex projective space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^3$&lt;/span&gt; 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.&#xA;The Euclidean measure on the complex four-dimensional vector space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^4$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$d_{\mu_{\mathbb{C}^4}} = \prod_{k=1}^4 \frac{d\text{Re}(w_k)d\text{Im}(w_k)}{2\pi}$$&lt;/span&gt;&#xA;Obviously, this measure is invariant under the &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-dimensional unitary group. The normalization condition defines a seven-dimensional sphere &lt;span class=&quot;math-container&quot;&gt;$S^7$&lt;/span&gt;, a measure on &lt;span class=&quot;math-container&quot;&gt;$S^7$&lt;/span&gt; can be constructed as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&#xA;(&lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is the Dirac delta function which restrict the measure to a unit spherical shell). Obviously, this measure is also invariant under the &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-dimensional unitary group, thus it is a Haar-measure.&#xA;Substituting the equations for &lt;span class=&quot;math-container&quot;&gt;$z_i$&lt;/span&gt; and integrating over &lt;span class=&quot;math-container&quot;&gt;$w_0$&lt;/span&gt;, we obtain a Haar-measure over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}P^3$&lt;/span&gt;, i.e., the two-qubit state space:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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}$$&lt;/span&gt;&#xA;Performing the &lt;span class=&quot;math-container&quot;&gt;$w_0$&lt;/span&gt; integration in polar coordinates:&#xA;We have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&#xA;Thus:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&#xA;In summary, we have a representation of a random two-qubit state vector together with a Haar probability measure on the state space.&lt;/p&gt;&#xA;&lt;p&gt;Of course, repeating this construction for a single qubit, we get the usual Bloch vector and the round measure on the Bloch sphere:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle= \frac{[1 \, z]^t}{\sqrt{1+|z|^2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$d_{\mu_{S^2}} = \frac{1}{(1+|z|^2)^2}\frac{d\text{Re}(z)d\text{Im}(z)}{\pi}$$&lt;/span&gt;&#xA;The Cartesian product of two Bloch spheres is the state space of a random separable two-qubit state, the state vector is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle= \frac{[1 \, z_1]^t \otimes [1 \, z_2]^t }{\sqrt{(1+|z_1|^2)( 1+|z_2|^2)}}$$&lt;/span&gt;&#xA;And the corresponding measure:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Practically, integrals of polynomial functions over the Haar measures &lt;span class=&quot;math-container&quot;&gt;$d_{\mu_{\mathbb{C}P^3}}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$d_{\mu_{S^2\times S^2}}$&lt;/span&gt; can be exactly evaluated e.g. by passing to polar coordinates.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastActivityDate="2020-11-12T14:05:13.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14606" PostTypeId="2" ParentId="14592" CreationDate="2020-11-12T14:59:20.717" Score="1" Body="&lt;p&gt;If you're talking about a single-qubit transformation where the Bloch vector is changed from &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$-\vec{n}$&lt;/span&gt;, then I would way think about how the Bloch vector is changing. You want it to go from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(n_x,n_y,n_z)\rightarrow(-n_x,-n_y,-n_z).&#xA;$$&lt;/span&gt;&#xA;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-&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. Hence we have achieved the transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(n_x,n_y,n_z)\rightarrow(-n_x,n_y,-n_z),&#xA;$$&lt;/span&gt;&#xA;and the only step left is an effective&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(n_x,n_y,n_z)\rightarrow(n_x,-n_y,n_z).&#xA;$$&lt;/span&gt;&#xA;However, &lt;em&gt;this&lt;/em&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; on one qubit does not leave a proper quantum state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="8141" LastEditDate="2020-11-12T18:56:55.330" LastActivityDate="2020-11-12T18:56:55.330" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14607" PostTypeId="2" ParentId="14582" CreationDate="2020-11-12T15:01:33.913" Score="3" Body="&lt;p&gt;I'll use &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\tilde V$&lt;/span&gt;. I believe there must be more constraints in the paper as to relation between &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; because as it stands the inequality is not true. For example take &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to be the identity matrix and let &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; also be the identity matrix except we make the penultimate and final elements on the diagonal of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; be &lt;span class=&quot;math-container&quot;&gt;$e^{i \alpha}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e^{-i \alpha}$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\alpha \in [0,2\pi)$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Tr}[ W^* V] = (|D|-2) + 2 \cos(\alpha).&#xA;$$&lt;/span&gt;&#xA;So, using the identity &lt;span class=&quot;math-container&quot;&gt;$\langle \Phi_{AR} | I_A \otimes M_R | \Phi_{AR} \rangle = \frac{1}{|D|} \mathrm{Tr}[M_R]$&lt;/span&gt;, the constraint in the question is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|D|-2) + 2 \cos(\alpha) \geq  |D|(1-\epsilon).&#xA;$$&lt;/span&gt;&#xA;Rearranging we find this is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\epsilon \geq \frac{2 - 2 \cos(\alpha)}{|D|} = \frac{4 \sin(\alpha/2)^2}{|D|}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now let &lt;span class=&quot;math-container&quot;&gt;$K = \begin{pmatrix} 1-e^{-i \alpha} &amp;amp; 0 \\ 0 &amp;amp; 1-e^{i \alpha} \end{pmatrix}$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\| I - W^* V \|_1 = \| K \|_1 = 4 \sin(\alpha / 2).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The claim is that if &lt;span class=&quot;math-container&quot;&gt;$|D| \epsilon \geq 4 \sin(\alpha/2)^2$&lt;/span&gt; then we also have &lt;span class=&quot;math-container&quot;&gt;$|D|\epsilon \geq 4 \sin(\alpha/2)$&lt;/span&gt; but notice that if &lt;span class=&quot;math-container&quot;&gt;$\alpha \in (0, \pi/2)$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\sin(\alpha/2)^2 &amp;lt; \sin(\alpha/2)$&lt;/span&gt;. Thus we can choose values of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; such that the constraint holds but the conclusion does not.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-12T15:01:33.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14608" PostTypeId="2" ParentId="14582" CreationDate="2020-11-12T16:17:52.537" Score="3" Body="&lt;p&gt;After @Rammus answer explaining that the given inequality does not hold in general, i'll try to prove a weaker statement.&lt;/p&gt;&#xA;&lt;p&gt;Define &lt;span class=&quot;math-container&quot;&gt;$ \Delta = V - \tilde{V} $&lt;/span&gt;.&#xA;The assumption is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Tr}[I - \tilde{V}^{\dagger} V] \leq \epsilon \cdot |D| \implies &#xA;\text{Tr}[V^{\dagger}V - \tilde{V}^{\dagger} V] \leq \epsilon \cdot |D| \implies &#xA;\text{Tr}[\Delta^{\dagger} V] \leq \epsilon \cdot |D| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since our assumption still holds if we exchange &lt;span class=&quot;math-container&quot;&gt;$V, \tilde{V}$&lt;/span&gt; we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \hspace{0.3em} \text{Tr}[(- \Delta)^{\dagger} \tilde{V}] \leq \epsilon \cdot |D| $&lt;/span&gt;.&#xA;The two inequalities combined give&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \text{Tr}[\Delta^{\dagger}\Delta] \leq 2 \epsilon \cdot |D| $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;&amp;amp;&#xA;||I - \tilde{V}^{\dagger} V ||_1 = ||\Delta^{\dagger} V||_1 = ||\Delta^{\dagger}||_1 = \\&#xA;&amp;amp; &#xA;\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|&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ s_k $&lt;/span&gt; the singular values of &lt;span class=&quot;math-container&quot;&gt;$ \Delta $&lt;/span&gt; and we used Cauchy-Schwarz inequality and the fact that trace norm is isometrically invariant.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-11-12T16:17:52.537" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14609" PostTypeId="1" AcceptedAnswerId="14611" CreationDate="2020-11-12T16:35:07.363" Score="0" ViewCount="77" Body="&lt;p&gt;The QPE on IBM platform finds the eigenvalue of a unitary operator, i.e &lt;span class=&quot;math-container&quot;&gt;$$U|\phi\rangle=e^{2\pi i\theta}|\phi\rangle$$&lt;/span&gt;&#xA;and uses the rotation operators as &lt;span class=&quot;math-container&quot;&gt;$$U(\theta)=\begin{bmatrix}0 &amp;amp; 1\\&#xA;1 &amp;amp;e^{i\theta}\end{bmatrix}$$&lt;/span&gt;&#xA;My question is we can write &lt;span class=&quot;math-container&quot;&gt;$U|\phi\rangle=e^{2\pi i\theta}|\phi\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$$U|\phi\rangle=e^{2e i\theta}|\phi\rangle$$&lt;/span&gt; where, since even then the magnitude of the eigenvalue remains same. Of course that would require more number of measurement qubits. For instance for &lt;span class=&quot;math-container&quot;&gt;$\theta=0.5$&lt;/span&gt;, we had &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;, so this time we can increase the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and get closer to &lt;span class=&quot;math-container&quot;&gt;$\theta=0.5$&lt;/span&gt;. My question is can this be done.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="1859" LastEditDate="2020-11-12T16:49:05.817" LastActivityDate="2020-11-12T20:25:49.723" Title="Quantum Phase estimation with $2\pi$ replaced with $2e$" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14610" PostTypeId="2" ParentId="14592" CreationDate="2020-11-12T19:18:55.960" Score="0" Body="&lt;p&gt;Well for starters it &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22Chance%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%5E%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Bloch%22%5D%2C%5B%22__unstable__UniversalNot%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Bloch%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%5E-%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Chance%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;violates the no-communication theorem&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22Chance%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%5E%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Bloch%22%5D%2C%5B%22__unstable__UniversalNot%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Bloch%22%5D%2C%5B1%2C1%2C1%2C1%2C%22X%5E-%C2%BD%22%5D%2C%5B1%2C1%2C1%2C1%2C%22Chance%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5IPt5.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle + i|1\rangle$&lt;/span&gt; and noticing the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; component changing w.r.t. the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; component.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-12T19:18:55.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14611" PostTypeId="2" ParentId="14609" CreationDate="2020-11-12T20:25:49.723" Score="3" Body="&lt;p&gt;No - the key intuition of QPE is that &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i \theta} $&lt;/span&gt; holds for &lt;span class=&quot;math-container&quot;&gt;$\theta \in [0, 1) $&lt;/span&gt;, and the reading out the ancilla provides the binary representation of the fraction.&lt;/p&gt;&#xA;&lt;p&gt;If you changed the operator to &lt;span class=&quot;math-container&quot;&gt;$e^{2 e i \theta}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta \not \in [0, 1)$&lt;/span&gt; necessarily. Instead, you should just use the typical QPE approach, but then find &lt;span class=&quot;math-container&quot;&gt;$\zeta$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$2 e i \zeta = 2 \pi i \theta \implies \zeta = \frac{\pi}{e}\theta$&lt;/span&gt;, and correct for symmetries afterwards.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-11-12T20:25:49.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14612" PostTypeId="2" ParentId="4977" CreationDate="2020-11-12T22:47:51.370" Score="1" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;QuISP, Keio/WIDE&#xA;&lt;a href=&quot;https://github.com/sfc-aqua/quisp&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/sfc-aqua/quisp&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;SimulaQron, QuTech&#xA;&lt;a href=&quot;http://www.simulaqron.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.simulaqron.org/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;NetSquid, QuTech&#xA;&lt;a href=&quot;https://netsquid.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://netsquid.org/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;SeQueNCe, Suchara, Argonne&#xA;&lt;a href=&quot;https://cpb-us-w2.wpmucdn.com/voices.uchicago.edu/dist/0/2327/files/2019/11/SeQUeNCe.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cpb-us-w2.wpmucdn.com/voices.uchicago.edu/dist/0/2327/files/2019/11/SeQUeNCe.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;SQUANCH, Bartlett&#xA;&lt;a href=&quot;https://pypi.org/project/SQUANCH/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pypi.org/project/SQUANCH/&lt;/a&gt;&#xA;&lt;a href=&quot;https://arxiv.org/abs/1808.07047&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1808.07047&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;QuNetSim, DiAdamo&#xA;&lt;a href=&quot;https://arxiv.org/abs/2003.06397&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2003.06397&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;QKD simulator in ns-3, including routing, Mehic et al&#xA;&lt;a href=&quot;https://ieeexplore.ieee.org/document/8935373&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://ieeexplore.ieee.org/document/8935373&lt;/a&gt;&#xA;&lt;a href=&quot;https://www.qkdnetsim.info/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.qkdnetsim.info/&lt;/a&gt;&#xA;&lt;a href=&quot;https://twitter.com/mickeyze2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://twitter.com/mickeyze2&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Physical-layer, online calculator for SPDC&#xA;&lt;a href=&quot;http://spdcalc.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://spdcalc.org/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4733" LastEditorUserId="4733" LastEditDate="2020-11-14T13:51:21.447" LastActivityDate="2020-11-14T13:51:21.447" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14614" PostTypeId="2" ParentId="10057" CreationDate="2020-11-13T08:10:02.140" Score="1" Body="&lt;p&gt;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 &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.85.052327&quot; rel=&quot;nofollow noreferrer&quot;&gt;Physical Review&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;The fidelity of the CNOT gate as a function of the allowed time (t) in the case of Ising interactions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CNqwr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CNqwr.png&quot; alt=&quot;The fidelity of the CNOT gate as a function of the allowed time t&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The fidelity of the √swap gate as a function of the allowed time (t) in the case of Heisenberg interactions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oWFlF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oWFlF.png&quot; alt=&quot;The fidelity of the √swap gate for the pulse obtained as a function of the allowed time t&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-11-13T08:10:02.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14615" PostTypeId="2" ParentId="14139" CreationDate="2020-11-13T08:33:52.943" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit_chemistry.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;API reference&lt;/a&gt; would be very helpful to understand the sample Qiskit.chemistry circuits.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-11-13T08:33:52.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14616" PostTypeId="2" ParentId="14523" CreationDate="2020-11-13T09:04:39.543" Score="1" Body="&lt;p&gt;The &lt;strong&gt;block length&lt;/strong&gt; is defined as the number of physical qubits you are using to encode the logical qubit. Thus in the parameters &lt;span class=&quot;math-container&quot;&gt;$[n,k,d]$&lt;/span&gt; the value &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is your block length.&lt;/p&gt;&#xA;&lt;p&gt;You can see &lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.87.020304&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper here&lt;/a&gt; for confirmation on what I just stated.&lt;/p&gt;&#xA;&lt;p&gt;The error rate here is &lt;em&gt;probably&lt;/em&gt; the error rate of the qubit.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-13T09:04:39.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14617" PostTypeId="1" CreationDate="2020-11-13T11:41:10.720" Score="3" ViewCount="136" Body="&lt;p&gt;I have came across many books online that all explain that if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is large enough, then the average number of checks in &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; but is there a mathematical explanation or derivation for why this is true?&lt;/p&gt;&#xA;&lt;p&gt;I have considered when &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; and tried to use logarithms but am not getting anywhere with this. Any help would be greatly appreciated&lt;/p&gt;&#xA;&lt;p&gt;Sorry, I should have made it clear... I was referring to Grover's search algorithm and how I can show that if &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is large enough, then the average number of checks is &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt;. I know I will have to check &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; objects in the worst-case scenario&lt;/p&gt;&#xA;" OwnerUserId="13796" LastEditorUserId="55" LastEditDate="2020-11-19T10:03:24.910" LastActivityDate="2020-12-05T15:24:36.050" Title="Is there an explanation for why, to search through an unstructured database, the average number of checks is $\frac{N}{2}$ in classical computation?" Tags="&lt;grovers-algorithm&gt;&lt;classical-computing&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14618" PostTypeId="2" ParentId="14617" CreationDate="2020-11-13T13:44:13.027" Score="1" Body="&lt;p&gt;It depends how formal you want to be about this. You might just start by saying that if you select &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; items out of a database of size &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, you've got a probability of 1/2 of finding the element you want. That gives a pretty good hint.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n^{th}$&lt;/span&gt; round? It's given by (probability of not matching on 1st round)&lt;span class=&quot;math-container&quot;&gt;$\times$&lt;/span&gt;(probability of not matching on 2nd round)&lt;span class=&quot;math-container&quot;&gt;$\times\ldots\times$&lt;/span&gt;(probability of not matching on (n-1)th round)&lt;span class=&quot;math-container&quot;&gt;$\times$&lt;/span&gt;(prob of matching on nth round).&lt;/p&gt;&#xA;&lt;p&gt;Assuming we got to the nth round, we have &lt;span class=&quot;math-container&quot;&gt;$N+1-n$&lt;/span&gt; samples to pick from, of which 1 is a match and the other &lt;span class=&quot;math-container&quot;&gt;$N-n$&lt;/span&gt; do not match. Thus, the probability of ending on the nth round is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}.&#xA;$$&lt;/span&gt;&#xA;If you look through all these terms, most cancel and you just get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(n)=\frac{1}{N}.&#xA;$$&lt;/span&gt;&#xA;You're equally likely to find the answer on each selection (perhaps feels obvious now we've calculated it!).&lt;/p&gt;&#xA;&lt;p&gt;The average number of runs that you need is then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_nnp(n)=\frac{N+1}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-13T13:44:13.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14619" PostTypeId="2" ParentId="14617" CreationDate="2020-11-13T13:53:26.777" Score="1" Body="&lt;p&gt;I think what you are talking about must an unstructured database, which can be improved by Grover search algorithm to &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; and structured can be faster.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{n}$&lt;/span&gt;, then if you tested another case and found that it is wrong, then you guess again. At this time the probability of failing is &lt;span class=&quot;math-container&quot;&gt;$1-\frac{1}{n-1}$&lt;/span&gt;. If you are failing continuously, then the corresponding possibility is &lt;span class=&quot;math-container&quot;&gt;$\displaystyle\prod_{i=n-x+1}^{n}\frac{i-1}{i}$&lt;/span&gt; at step x.&lt;/p&gt;&#xA;&lt;p&gt;Given the probability formula, then at step &lt;span class=&quot;math-container&quot;&gt;$x=\frac{n}{2}$&lt;/span&gt;, the failure probability is &lt;span class=&quot;math-container&quot;&gt;$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}$&lt;/span&gt;, which equals 0.5 when &lt;span class=&quot;math-container&quot;&gt;$n\rightarrow\infty$&lt;/span&gt; (at step n you can see that the success possibility is 1).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-13T13:53:26.777" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14620" PostTypeId="2" ParentId="14139" CreationDate="2020-11-13T14:12:42.433" Score="0" Body="&lt;p&gt;You can see the recent &lt;a href=&quot;https://science.sciencemag.org/content/369/6507/1084&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google paper&lt;/a&gt;, but I have to say beforehand that &lt;strong&gt;this paper doesn't suit you&lt;/strong&gt;. 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).&lt;/p&gt;&#xA;&lt;p&gt;Maybe &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/6_examples_max_cut_and_tsp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this qiskit documentation&lt;/a&gt; better suits you. With a background of CS, you should be familiar with the &lt;strong&gt;travelling salesman problem&lt;/strong&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;(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.)&lt;/p&gt;&#xA;&lt;p&gt;I have to admit that this answer may not be that helpful to you.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-13T14:12:42.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14621" PostTypeId="1" CreationDate="2020-11-13T14:50:31.790" Score="1" ViewCount="50" Body="&lt;p&gt;We define the quantum state on a complex network in the form,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mid\psi(t)\rangle=\sum_{i=1}^{N}\sum_{j=1}^{k_i}\psi_{i,j}(t)\lvert&#xA; i\to j\rangle, $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the total number of nodes, the state &lt;span class=&quot;math-container&quot;&gt;$|i \to j⟩$&lt;/span&gt; resides on the node &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and is to hop to the adjacent site &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, while &lt;span class=&quot;math-container&quot;&gt;$k_i$&lt;/span&gt; is the number of links attached to the node &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is how this &lt;span class=&quot;math-container&quot;&gt;$|i \to j \rangle$&lt;/span&gt;, can be represented using binary coded bit string?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reference:&lt;/strong&gt; Discrete-time quantum walk on complex networks for community detection by Kanae Mukai&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-19T09:59:36.377" LastActivityDate="2020-11-19T09:59:36.377" Title="How to encode $|i \rightarrow j \rangle$ using binary string?" Tags="&lt;quantum-state&gt;&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14622" PostTypeId="1" AcceptedAnswerId="14624" CreationDate="2020-11-13T17:21:49.503" Score="3" ViewCount="98" Body="&lt;p&gt;You are given a function &lt;span class=&quot;math-container&quot;&gt;$f : \{0,1\}^n \to \{0,1\}$&lt;/span&gt; and a quantum circuit, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, computing the signed implementation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$I_0$&lt;/span&gt; be the input bit-strings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; where the first bit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$I_1$&lt;/span&gt; be the&#xA;remaining ones (i.e., the first bit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;You are given the promise that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is one of these two types:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$f(x) = 0 $&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; belonging to &lt;span class=&quot;math-container&quot;&gt;$I_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; belonging to &lt;span class=&quot;math-container&quot;&gt;$I_1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The total number of strings in &lt;span class=&quot;math-container&quot;&gt;$I_0$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; plus the total number of strings in &lt;span class=&quot;math-container&quot;&gt;$I_1$&lt;/span&gt; for which &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;Give an algorithm (i.e., quantum circuit) to distinguish between these two cases by calling &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; only once.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13798" LastEditorUserId="55" LastEditDate="2020-11-17T10:17:34.757" LastActivityDate="2020-11-17T10:17:34.757" Title="How to solve this Deutsch Jozsa variant?" Tags="&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14623" PostTypeId="1" CreationDate="2020-11-13T19:21:37.957" Score="0" ViewCount="27" Body="&lt;p&gt;In a non-regular graph the degree of each node is different.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$C^2$&lt;/span&gt; for every node.&lt;/p&gt;&#xA;&lt;p&gt;Any idea.&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-19T09:59:05.440" LastActivityDate="2020-11-19T09:59:05.440" Title="How to make a Node dependent coin operator?" Tags="&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14624" PostTypeId="2" ParentId="14622" CreationDate="2020-11-13T20:11:04.613" Score="3" Body="&lt;p&gt;I like this one!&lt;/p&gt;&#xA;&lt;p&gt;Hint: Can you transform the function into another one that is closer to the type of functions Deutsch-Jozsa algorithm deals with?&lt;/p&gt;&#xA;&lt;p&gt;Answer under spoiler, so as not to ruin the fun for others:&lt;/p&gt;&#xA;&lt;blockquote class=&quot;spoiler&quot;&gt;&#xA;&lt;p&gt; Implement the following phase oracle based on the oracle given for &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$g(x) = f(x)$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x \in I_0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$g(x) = 1 - f(x)$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x \in I_1$&lt;/span&gt;. You can do that by applying the &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; oracle and then doing a Z gate on the first qubit.&#xA; &lt;br/&gt;&#xA; Now you have one of the two cases:&#xA; &lt;br/&gt;&#xA; 1. &lt;span class=&quot;math-container&quot;&gt;$g(x) = 0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (constant!)&#xA; &lt;br/&gt;&#xA; 2. The total number of strings for which &lt;span class=&quot;math-container&quot;&gt;$g(x) = 1$&lt;/span&gt; equals &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; (balanced!)&#xA; &lt;br/&gt;&#xA; And this is exactly the Deutsch-Jozsa problem!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-11-13T20:11:04.613" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14626" PostTypeId="1" CreationDate="2020-11-13T20:56:50.647" Score="2" ViewCount="108" Body="&lt;p&gt;Given a matrix, say &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 1.5 &amp;amp; 0.5\\&#xA;0.5&amp;amp; 1.5&#xA;\end{bmatrix}$&lt;/span&gt;, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, how do I proceed with the quantum phase estimation algorithm?&#xA;In particular, how do I choose &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;In the text I am reading it says fix &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi/3$&lt;/span&gt; for the eigenvalues. How do they get this?&#xA;Can somebody explain?&lt;/p&gt;&#xA;&lt;p&gt;Edit: is it linked by the approximation that &lt;span class=&quot;math-container&quot;&gt;$ \theta= 2\arcsin(C/\lambda_j)$&lt;/span&gt;, if so then why is &lt;span class=&quot;math-container&quot;&gt;$C=1$&lt;/span&gt; in this matrix case?&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-11-19T09:56:11.067" LastActivityDate="2020-11-19T09:56:11.067" Title="Given a matrix, how do I proceed with the quantum phase estimation algorithm and choose $\theta$?" Tags="&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14627" PostTypeId="2" ParentId="1568" CreationDate="2020-11-13T21:27:32.110" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://www.academia.edu/resource/work/44494922&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.academia.edu/resource/work/44494922&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;Wheeler's delayed-choice experiment&amp;quot; not so much an &amp;quot;eraser&amp;quot; experiment. The difference is addressed in the paper.&lt;/p&gt;&#xA;" OwnerUserId="13802" LastActivityDate="2020-11-13T21:27:32.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14628" PostTypeId="2" ParentId="1568" CreationDate="2020-11-13T21:36:14.107" Score="2" Body="&lt;p&gt;Quirk includes a mockup of the delayed choice eraser &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C%22H%22%5D%2C%5B1%2C%22%E2%80%A2%22%2C1%2C1%2C%22X%22%5D%2C%5B1%2C%22%7Eslits%22%2C%22QFT7%22%5D%2C%5B1%2C1%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22Chance7%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22H%22%5D%2C%5B%22Measure%22%5D%2C%5B%22%7Echoice%22%5D%2C%5B%22%E2%80%A2%22%2C%22X%5E%C2%BD%22%5D%2C%5B1%2C%22Measure%22%5D%2C%5B1%2C%22%7Eresult%22%2C1%2C1%2C1%2C%22%7Eflat%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%97%A6%22%2C%22Chance7%22%5D%2C%5B%22%E2%97%A6%22%2C%22%E2%80%A2%22%2C%22Chance7%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C%22%7Ewaves%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%97%A6%22%2C%22Chance7%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22Chance7%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22%7Echoice%22%2C%22name%22%3A%22choice%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22%7Eresult%22%2C%22name%22%3A%22result%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22%7Eflat%22%2C%22name%22%3A%22flat%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22%7Ewaves%22%2C%22name%22%3A%22waves%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%2C%7B%22id%22%3A%22%7Eslits%22%2C%22name%22%3A%22slits%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;as an example circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2ShmV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2ShmV.png&quot; alt=&quot;example circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://algassert.com/quantum/2016/01/07/Delayed-Choice-Quantum-Erasure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;down to fewer qubits&lt;/a&gt; if you're willing to give up the more visually direct waves in the output expectation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://algassert.com/assets/2016-01-07-Delayed-Choice-Quantum-Erasure/cycle-revealed.gif&quot; alt=&quot;reveal&quot; /&gt;&#xA;&lt;img src=&quot;https://algassert.com/assets/2016-01-07-Delayed-Choice-Quantum-Erasure/cycle-erased.gif&quot; alt=&quot;erase&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;In fact you can &lt;a href=&quot;https://algassert.com/post/1720&quot; rel=&quot;nofollow noreferrer&quot;&gt;even make classical analogues&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GFQwk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GFQwk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-13T21:36:14.107" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14629" PostTypeId="1" CreationDate="2020-11-13T22:10:03.090" Score="0" ViewCount="99" Body="&lt;p&gt;Consider the following generalization of Simon's problem: the input is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit binary string, and&#xA;we are given a function &lt;span class=&quot;math-container&quot;&gt;$f : \{0,1\}^n \to \{0,1\}^n$&lt;/span&gt; (and a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; implementing it) with the&#xA;property that there is some unknown subspace &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$⊆$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}^n$&lt;/span&gt; such that f(x) = f(y) if and only if&#xA;&lt;span class=&quot;math-container&quot;&gt;$x + y \in V$&lt;/span&gt; (all additions are mod 2). The usual definition of Simon's problem corresponds to the&#xA;case where the subspace &lt;span class=&quot;math-container&quot;&gt;$V = \{0,s\}$&lt;/span&gt; has dimension at most 1.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;We need to find an efficient quantum algorithm to identify a basis of V and also calculate the expected number of calls to C by this circuit.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I gave a lot of thought and also refereed to the research paper &lt;a href=&quot;https://arxiv.org/pdf/1905.08549.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1905.08549.pdf&lt;/a&gt; but couldn't comprehend much. Any help would be appreciated. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="13798" LastActivityDate="2020-11-13T22:10:03.090" Title="Generalized Simon's Problem" Tags="&lt;algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14630" PostTypeId="2" ParentId="11796" CreationDate="2020-11-13T23:28:05.903" Score="1" Body="&lt;p&gt;There is a &lt;a href=&quot;https://arstechnica.com/science/2020/09/d-wave-releases-its-next-generation-quantum-annealing-chip/&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent article&lt;/a&gt; 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 &lt;strong&gt;no &amp;quot;quantum advantage&amp;quot;&lt;/strong&gt; over classical thus far on any of the problems they have considered.&lt;/p&gt;&#xA;&lt;p&gt;I like the comment made by Malibu Stacey in the comment section... and I quote&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It's really not. Is D-Wave's new hardware &amp;quot;faster&amp;quot; than using a &amp;quot;classical&amp;quot; solution like Fujitsu's Digital Annealer hardware? &lt;br&gt;&#xA;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.&#xA;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).&#xA;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. &lt;br&gt; &lt;br&gt;&#xA;So it's a pretty simple answer. It's not faster, cheaper or &amp;quot;better&amp;quot; than the purely classical solution which has been publicly available for almost 2 years now.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-13T23:28:05.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14631" PostTypeId="2" ParentId="11796" CreationDate="2020-11-14T01:26:15.203" Score="0" Body="&lt;p&gt;If there is any quantum advantage, &lt;a href=&quot;https://arxiv.org/abs/1510.06356&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Lockheed Martin paper&lt;/a&gt; must show a clue.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here is two of their plot.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W191A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W191A.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-14T01:26:15.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14634" PostTypeId="1" AcceptedAnswerId="14638" CreationDate="2020-11-14T11:24:48.563" Score="1" ViewCount="102" Body="&lt;p&gt;I want to perform the following operation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U|0\rangle =1/\sqrt{n}\sum_{i=0}^{n}(|i\rangle).$$&lt;/span&gt;&#xA;I know that Hadmard gate can give me the superposition of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. But it can only be applied to a single-qubit system.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone have any idea for a multi-qubit system?&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-19T09:53:43.373" LastActivityDate="2020-11-19T09:53:43.373" Title="Which Gate set can be used to perform the function $U|0\rangle =\frac{1}{\sqrt{n}}\sum_{i=0}^{n}(|i\rangle)$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14635" PostTypeId="2" ParentId="14634" CreationDate="2020-11-14T11:46:25.240" Score="2" Body="&lt;p&gt;In fact, you just need to implement a lot of Hadamard gates(if lg(n) gives an integer).&lt;/p&gt;&#xA;&lt;p&gt;E.G.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/75HTN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/75HTN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-14T11:46:25.240" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14636" PostTypeId="1" CreationDate="2020-11-14T13:48:28.227" Score="1" ViewCount="54" Body="&lt;p&gt;I would like to construct a quantum circuit s.t.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It maps a certain (relatively small) subset of computational basis vectors onto a different subset of those, e.g.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0101001\rangle \to |1000010\rangle, \; |1001011\rangle \to |0111011\rangle, \ldots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(I was tempted to call such action &amp;quot;a permutation&amp;quot;, but I guess it not necessarily is one.)&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;I don't care what circuit's action is on the rest of the basis vectors.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;How can I do that? Of course, ideally I would like to achieve this with a minimum number of single-qubit gates and CNOTs.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2020-11-19T10:05:17.163" LastActivityDate="2020-11-19T10:05:17.163" Title="How do I construct a circuit to reshuffle some computational basis vectors?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14637" PostTypeId="1" AcceptedAnswerId="14646" CreationDate="2020-11-14T14:03:36.087" Score="1" ViewCount="48" Body="&lt;p&gt;Excuse me if this question is absurd. I discovered logic gates a few weeks ago.&lt;/p&gt;&#xA;&lt;p&gt;two-qubis Logic gates are represented by 4x4 matrices.&#xA;Can they mimic a general density matrix of pairs of spin 1/2 particles?&#xA;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.&#xA;I suppose that we can measure the 16 elements of the logic gate matrix.&#xA;Does it help to find a similar procedure for Bob and Alice?&lt;/p&gt;&#xA;" OwnerUserId="13807" LastEditorUserId="8141" LastEditDate="2020-11-15T10:54:04.750" LastActivityDate="2020-11-15T10:54:04.750" Title="How to measure a general two-qubits gate? Does it help to Bob and Alice?" Tags="&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14638" PostTypeId="2" ParentId="14634" CreationDate="2020-11-14T17:06:25.033" Score="1" Body="&lt;p&gt;&lt;strong&gt;If&lt;/strong&gt; your question implementation of the operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that it create a equally superposition state, that is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|0\rangle^{\otimes n} =\dfrac{1}{\sqrt{2^n}} \sum_{i=0}^{2^n-1}|i\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be implemented as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = H \otimes H \otimes \cdots \otimes H = H^{\otimes n}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the Hadamard gate defined as &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; represents the tensor product operation as usual. For example,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H \otimes H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix} \otimes  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix} = \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1\\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1\\ 1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{pmatrix}  $$&lt;/span&gt;&#xA;and note that by the property of &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor product of linear map&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(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} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence, we see that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$H\otimes H$&lt;/span&gt; takes &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;hr /&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Now&lt;/strong&gt; if you trying to implement a &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that it takes the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{n}} \sum_{i =0}^{n-1} |i\rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for instance:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I call the transformative state &lt;span class=&quot;math-container&quot;&gt;$|W\rangle $&lt;/span&gt; because it is similar to the &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;W-state&lt;/a&gt;. 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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |P \rangle = \dfrac{1}{\sqrt{3}} \big( |00 \rangle + |01\rangle + |10 \rangle ) $$&lt;/span&gt;&#xA;I call this state &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; because of it is a &lt;em&gt;partial&lt;/em&gt; entanglement state,  The circuit to implement the state transformation from &lt;span class=&quot;math-container&quot;&gt;$|00\rangle \to  |P \rangle$&lt;/span&gt; is as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zYVAX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zYVAX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can see the statevector amplitude here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PEaTS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PEaTS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TODQ8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TODQ8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And  we can look at the statevector and see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mVROo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mVROo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|0000\rangle \to &amp;amp;\dfrac{1}{\sqrt{4}} \big(|0000\rangle + |0001\rangle + |0010\rangle + |0011\rangle \big) \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{4}} |00\rangle \otimes \big( |00\rangle + |01\rangle + |10\rangle + |11\rangle \big)  \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{4}} |00\rangle \otimes \big(H \otimes H \big) |00\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus the circuit would just be&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/smdCP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/smdCP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the state vector here is&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/uDVzH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uDVzH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;From here&lt;/strong&gt; you can see that for any qubit system &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$n = 2^N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N \in \mathbb{N}$&lt;/span&gt; then it will be something like the above case. That is, if you have &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; qubit, then your transformation would be something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|00000000\rangle \to |00000\rangle \otimes \bigg[ (H \otimes H \otimes H)|000\rangle \bigg] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which has the circuit representation of&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vG7Xy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vG7Xy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;And if you extend this to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state where &lt;span class=&quot;math-container&quot;&gt;$n \neq 2^N $&lt;/span&gt; then can built the circuit to from the &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;-qubit case. For instance, if &lt;span class=&quot;math-container&quot;&gt;$n=5$&lt;/span&gt;-qubit then we are looking for the transformation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|00000 \rangle \to &amp;amp;\dfrac{1}{\sqrt{4}} \big(|00000\rangle + |00001\rangle + |00010\rangle + |00011\rangle + |00100\rangle \big) \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{5}} |00\rangle \otimes \big( |000\rangle + |001\rangle + |010\rangle + |011\rangle + |100\rangle \big)  \\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To create the state &lt;span class=&quot;math-container&quot;&gt;$| P_5 \rangle = \dfrac{1}{\sqrt{5}}  \big( |000\rangle + |001\rangle + |010\rangle + |011\rangle + |100\rangle \big)$&lt;/span&gt; we can use the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Cf0jX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cf0jX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then adding another two additional qubit to the above circuit give you what you want.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-14T19:14:29.593" LastActivityDate="2020-11-14T19:14:29.593" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14639" PostTypeId="1" CreationDate="2020-11-14T17:20:29.023" Score="1" ViewCount="36" Body="&lt;p&gt;I am reading the following article, &lt;a href=&quot;https://arxiv.org/abs/1812.08767&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1812.08767&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;I am confused about going from this equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EoCBh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EoCBh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;to this equation (assuming real &lt;span class=&quot;math-container&quot;&gt;$\theta_i$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Em5L9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Em5L9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; at the end is a typo. What I dont understand is how the variation &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; removes the need to sum over &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, going from eq. (120) to (123). They also remove the &lt;span class=&quot;math-container&quot;&gt;$\dot{\theta}_i$&lt;/span&gt; factor and seem to replace it with &lt;span class=&quot;math-container&quot;&gt;$\delta \theta_i$&lt;/span&gt;. I also dont understand why the final term in eq. (120) disappears.&lt;/p&gt;&#xA;&lt;p&gt;I think I am overall a little confused as to what the variation &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; actually does to an equation. Could anyone explain?&lt;/p&gt;&#xA;" OwnerUserId="5632" LastActivityDate="2020-11-14T17:20:29.023" Title="Variational imaginary time evolution: confused with derivation" Tags="&lt;quantum-boltzmann-machine&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14640" PostTypeId="2" ParentId="14172" CreationDate="2020-11-14T19:05:20.337" Score="1" Body="&lt;p&gt;For a VQE, the circuit applies &lt;span class=&quot;math-container&quot;&gt;$Z \otimes Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X \otimes Z$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-11-14T19:05:20.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14641" PostTypeId="2" ParentId="14603" CreationDate="2020-11-15T02:12:37.633" Score="2" Body="&lt;p&gt;I think there might be a lot to unpack here. Just making sure my understanding of the problem is correct:&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;my_symbols = ...&#xA;my_circuit = cirq.Circuit(...) # created containing `my_symbols`&#xA;&#xA;true_parameters = [1,2,3]&#xA;guess_parameters = [4,5,6]&#xA;&#xA;# guess_distribution is a ragged tensor of shape [n_circuits, n_samples, n_qubits]&#xA;guess_distribution = tfq.layers.Sample(my_circuit, symbol_names=my_symbols, symbol_values = guess_parameters, repetitions=10000)&#xA;&#xA;# true_distribution is a ragged tensor of shape [n_circuits, n_samples, n_qubits]&#xA;true_distribution = tfq.layers.Sample(my_circuit, symbol_names=my_symbols, symbol_values = true_parameters, repetitions=10000)&#xA;&#xA;# Compute the histograms. [n_circuits, 2^n_qubits + 1]&#xA;guess_probs = tf.math.bincount(tf.cast(guess_distribution.to_tensor(), tf.dtypes.int32)) / 10000&#xA;true_probs = tf.math.bincount(tf.cast(true_distribution.to_tensor(), tf.dtypes.int32)) / 10000&#xA;&#xA;# Measure the distribution overlap between your parameter guess and the true parameters. scalar tensor.&#xA;kl_overlap = tf.keras.losses.KLDivergence()(guess_probs, true_probs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You could go a lot of different ways with this snippet. For example:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You could remain focused on the single circuit case and attempt to optimize the values of &lt;code&gt;guess_parameters&lt;/code&gt; using an optimizer of your choice (gradient free ones like &lt;a href=&quot;https://www.tensorflow.org/probability/api_docs/python/tfp/optimizer/nelder_mead_minimize&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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 &amp;quot;measuring distribution closeness&amp;quot; (since sampling on it's own is not differentiable) using the &lt;code&gt;@tf.custom_gradient&lt;/code&gt; tag. This would then be compatible with your standard &lt;code&gt;GradientTape&lt;/code&gt; workflow:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;x = tf.constant(my_guess)&#xA;with tf.GradientTape() as g:&#xA;  g.watch(x)&#xA;  y = my_closeness_function_decorated_with_custom_gradient(x)&#xA;&#xA;# Can now optimize x values using this tensor here.&#xA;# Along with any of `tf.optimizers`.&#xA;dy_dx = g.gradient(y, x)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This is a far more complex problem and could function very similarly to the example you &lt;a href=&quot;https://www.tensorflow.org/quantum/tutorials/hello_many_worlds#2_hybrid_quantum-classical_optimization&quot; rel=&quot;nofollow noreferrer&quot;&gt;linked&lt;/a&gt; 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 &lt;code&gt;@tf.custom_gradient&lt;/code&gt; into that tutorial plus some structural modifications to the &lt;code&gt;tf.keras.Model&lt;/code&gt;, but is in principle very doable. There are some more complex TFQ examples &lt;a href=&quot;https://github.com/tensorflow/quantum/tree/research&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; that we also walk through &lt;a href=&quot;https://arxiv.org/abs/2003.02989&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/2010.11983.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's&lt;/a&gt; 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 :).&lt;/p&gt;&#xA;" OwnerUserId="11700" LastEditorUserId="9006" LastEditDate="2020-11-15T07:24:46.093" LastActivityDate="2020-11-15T07:24:46.093" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14642" PostTypeId="1" AcceptedAnswerId="14645" CreationDate="2020-11-15T05:21:14.673" Score="3" ViewCount="103" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eegNx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eegNx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hi, How to convert &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; 3-qubit quantum state into &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$&lt;/span&gt; state using only Hadamard and CNOT gates? Also, is output state an entangled one?&lt;/p&gt;&#xA;" OwnerUserId="13749" LastEditorUserId="55" LastEditDate="2020-11-17T16:24:10.177" LastActivityDate="2020-11-17T16:24:10.177" Title="Transforming $|100\rangle$ state into $|000\rangle + |111\rangle$ state using only Hadamard and CNOT gates" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;&lt;hadamard&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14643" PostTypeId="2" ParentId="14642" CreationDate="2020-11-15T06:11:23.433" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rKVX6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rKVX6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The upper figure shows the quantum circuit to do so, the first &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is to let the first qubit be in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state coherently.&lt;/p&gt;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$\frac{|000\rangle+|111\rangle}{\sqrt2}$&lt;/span&gt; is the GHZ state, it is one of the most famous tri-qubit entangled state (another one is the W state), you may see &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; for detail.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="9006" LastEditDate="2020-11-15T07:29:29.760" LastActivityDate="2020-11-15T07:29:29.760" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="14644" PostTypeId="1" CreationDate="2020-11-15T06:31:43.690" Score="0" ViewCount="76" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; be a quantum code and corresponding GF(2) linear code be &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; represented by generatir matrix (or parity check matrix M). Now given &lt;span class=&quot;math-container&quot;&gt;$aut(C)$&lt;/span&gt; that is &lt;span class=&quot;math-container&quot;&gt;$\lbrace A,P \in GL(F_2) \times S_n \rbrace$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8132" LastEditorUserId="8132" LastEditDate="2020-11-16T09:12:05.757" LastActivityDate="2020-11-17T14:29:46.653" Title="Considering quantum codes as codes over $F_2$" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14645" PostTypeId="2" ParentId="14642" CreationDate="2020-11-15T07:38:44.233" Score="4" Body="&lt;p&gt;If the first qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, i.e. the input state &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt; then resulting GHZ state is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$&lt;/span&gt;, i.e. the phase is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;. To have phase &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; has to be applied but this gate is not allowed. But you can use controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; which is composed only with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;. The circuit is this&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f3nG5.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f3nG5.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;A part before orange line produces the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|100\rangle$&lt;/span&gt;, a part after the line is controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is a resulting state from IBM Q:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5vSfs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5vSfs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, the phase is correct.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-15T07:38:44.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14646" PostTypeId="2" ParentId="14637" CreationDate="2020-11-15T10:53:46.113" Score="2" Body="&lt;p&gt;Long story short: if you want to characterize a circuit or operation, you have to perform &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography#Quantum_process_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum process tomography&lt;/a&gt; (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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11691/8141&quot;&gt;this answer to a previous question&lt;/a&gt; for a general overview.&lt;/p&gt;&#xA;&lt;h2&gt;A note on the relation of states/density matrices and unitaries&lt;/h2&gt;&#xA;&lt;p&gt;First a note on the correspondence between two-qubit states and two-qubit operations. You are right in saying that both are represented by &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrices, but, as Rammus points out, the sets of valid density matrices and valid operations are not the same.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;A density matrix must have unit trace and only positive eigenvalues; the only way for a density matrix to have an eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is when all others are zero, which means that the matrix is rank &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; (this is a &lt;em&gt;pure&lt;/em&gt; state).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;A unitary matrix has only unit eigenvalues (up to a phase) and is necessarily full rank.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;We can conclude that no density matrix can be a unitary matrix and vice versa.&lt;/p&gt;&#xA;&lt;h2&gt;Back to the question at hand&lt;/h2&gt;&#xA;&lt;p&gt;If Alice and Bob share a (possibly entangled) pair of spin-&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; particles (we generally refer to the particles as &lt;em&gt;qubits&lt;/em&gt;), 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 &lt;span class=&quot;math-container&quot;&gt;$X, Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, so that they obtain &lt;span class=&quot;math-container&quot;&gt;$3^2 = 9$&lt;/span&gt; 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 &lt;em&gt;local&lt;/em&gt; measurements; they only have to coordinate and communicate classically. This procedure is known as &lt;em&gt;quantum state tomography&lt;/em&gt; (QST), please check &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/9026/8141&quot;&gt;this answer&lt;/a&gt; for further details.&lt;/p&gt;&#xA;&lt;p&gt;If they know that their particles always go through some &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$\geq 4^{2} = 16$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The main take away is that, yes, it is possible to reconstruct a unitary matrix from measurement results, coordination and some smart thinking alone.&lt;/p&gt;&#xA;&lt;h2&gt;Direct answers to your questions for quick reference&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Can they mimic a general density matrix of pairs of spin 1/2 particles?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As pointed out, no, because the sets of density matrices and unitary operations is strictly disjoint.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As hinted at above, the direct elements from a unitary can not be measured, but we &lt;em&gt;can&lt;/em&gt; reconstruct the elements through smart measurements on the output states of the unitary.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Does it help to find a similar procedure for Bob and Alice?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Excuse me if this question is absurd.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Absolutely not!&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-11-15T10:53:46.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14647" PostTypeId="1" AcceptedAnswerId="14648" CreationDate="2020-11-15T12:58:37.720" Score="1" ViewCount="38" Body="&lt;p&gt;Commutation operation is essential in quantum mechanics, but when I was trying to use the commutator of IBM qiskit I find something confusing.&lt;/p&gt;&#xA;&lt;p&gt;Here comes the problematic code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.quantum_info import DensityMatrix&#xA;from qiskit.aqua.operators.legacy import commutator&#xA;&#xA;qr0=QuantumCircuit(1)&#xA;qr1=QuantumCircuit(1)&#xA;circ0.x(0)&#xA;dm0=DensityMatrix.from_instruction(circ0)&#xA;circ1.z(0)&#xA;dm1=DensityMatrix.from_instruction(circ1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The upper codes generates two Density Matrices, and since they are matrices, mathematically we can compute their commutator, but then after you run &lt;code&gt;commutator(dm0,dm1)&lt;/code&gt; you'll find that it's not working. Even if you try some other types like input two Operators or input the detailed matrices(&lt;code&gt;dm.data&lt;/code&gt;) but it is just raised an error. E.g. in the lower code when the detailed matrices case returns an error.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dm0=Operator(dm0)&#xA;dm1=Operator(dm1)&#xA;commutator(dm0.data,dm1.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The errors that qiskit reports are nearly identical so I just put one of them as an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/q1ai0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q1ai0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="1859" LastEditDate="2020-11-15T23:32:01.093" LastActivityDate="2020-11-15T23:32:01.093" Title="How does Qiskit Aqua commutator work?" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14648" PostTypeId="2" ParentId="14647" CreationDate="2020-11-15T13:19:26.517" Score="2" Body="&lt;p&gt;According with &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.legacy.commutator.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the &lt;code&gt;commutator&lt;/code&gt; documentation&lt;/a&gt;, it works on &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.legacy.WeightedPauliOperator.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;WeightedPauliOperator&lt;/code&gt;&lt;/a&gt;, not on numpy arrays.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators.legacy import commutator&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;from qiskit.quantum_info import Pauli&#xA;&#xA;pauli_a = 'X'&#xA;pauli_b = 'Z'&#xA;coeff_a = 0.5&#xA;coeff_b = 0.5&#xA;pauli_term_a = [coeff_a, Pauli.from_label(pauli_a)]&#xA;pauli_term_b = [coeff_b, Pauli.from_label(pauli_b)]&#xA;op_a = WeightedPauliOperator(paulis=[pauli_term_a])&#xA;op_b = WeightedPauliOperator(paulis=[pauli_term_b])&#xA;&#xA;print(commutator(op_a, op_b))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;Representation: paulis, qubits: 1, size: 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-11-15T13:31:06.107" LastActivityDate="2020-11-15T13:31:06.107" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14650" PostTypeId="1" AcceptedAnswerId="14652" CreationDate="2020-11-15T17:04:35.770" Score="3" ViewCount="224" Body="&lt;p&gt;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? &lt;a href=&quot;https://i.stack.imgur.com/UDXV2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UDXV2.png&quot; alt=&quot;QFT&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13081" LastEditorUserId="55" LastEditDate="2020-11-18T09:05:34.833" LastActivityDate="2020-11-18T09:05:34.833" Title="Qiskit Inverse of a quantum fourier transformation" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14651" PostTypeId="1" CreationDate="2020-11-15T17:34:30.880" Score="2" ViewCount="223" Body="&lt;p&gt;I confused about how to calculate the &lt;em&gt;probabilities&lt;/em&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;given &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt2} (|01⟩ + |10⟩)$&lt;/span&gt; as the state and&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sigma_x = \left[\begin{matrix}0&amp;amp;1\\1&amp;amp;0\\\end{matrix}\right]$&lt;/span&gt; as the observable.&lt;/p&gt;&#xA;&lt;p&gt;if the probability is 1/2, how to calculate them actually? What is the state after measurement?&lt;/p&gt;&#xA;" OwnerUserId="13823" LastEditorUserId="55" LastEditDate="2020-11-18T21:10:18.840" LastActivityDate="2020-11-18T21:10:18.840" Title="What is the result of measuring $\sigma_x$ on the state $|01\rangle+|10\rangle$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14652" PostTypeId="2" ParentId="14650" CreationDate="2020-11-15T17:55:19.283" Score="3" Body="&lt;p&gt;From linear algebra we know that &lt;span class=&quot;math-container&quot;&gt;$(AB)^{-1} = B^{-1} A^{-1}$&lt;/span&gt;. This is because &lt;span class=&quot;math-container&quot;&gt;$(AB)*(AB)^{-1} = ABB^{-1}A^{-1} = AIA^{-1} = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hence, if you have the circuit to generate the Bell state from the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; which takes the form of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y3A0k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y3A0k.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then its inverse would be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ihmX8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ihmX8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Putting them together gives you:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DZrhT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DZrhT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This makes sense as the inverse of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, so they would formed Identity operator. Similarly, the inverse of Hadamard gate is itself... so altogether they will cancel each other out completely.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Thus, if I generate the QFT circuit for 4 qubit without the SWAP at the end, I would have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iBHAa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iBHAa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then similarly to the above explanation with respect to the bell circuit and its inverse, the inverse QFT would be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yQIf8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yQIf8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the reason why you see that you see in your circuit. hope that helps...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-15T17:55:19.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14653" PostTypeId="1" AcceptedAnswerId="14657" CreationDate="2020-11-15T22:22:29.307" Score="9" ViewCount="945" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Before studying about quantum computing in depth, I have been seeing that quantum computer can perform &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is qubits count) process same time thanks to qubits superposition in various videos on YouTube.&lt;/p&gt;&#xA;&lt;p&gt;I have two question:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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?&lt;/li&gt;&#xA;&lt;li&gt;How to develop quantum algorithm? Isn't it very difficult that developing an algorithm by thinking the state of matrices?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13826" LastEditorUserId="55" LastEditDate="2020-11-17T10:16:29.157" LastActivityDate="2020-11-17T10:16:29.157" Title="Where is the parallelism in Deutsch-Jozsa algorithm?" Tags="&lt;quantum-gate&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14654" PostTypeId="2" ParentId="14651" CreationDate="2020-11-15T23:08:29.943" Score="3" Body="&lt;p&gt;The way to do this first requires rewriting whatever state you have in terms of the eigenstates of the operator in question.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle = \frac{1}{\sqrt{2}} (|+\rangle + |-\rangle)\\&#xA;|1\rangle = \frac{1}{\sqrt{2}} (|+\rangle - |-\rangle)&#xA;$$&lt;/span&gt;&#xA;so that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; becomes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|\psi\rangle &amp;amp;= \frac{1}{\sqrt{2}} \Big( \frac{1}{2} (|+\rangle + |-\rangle)(|+\rangle - |-\rangle) + \frac{1}{2} (|+\rangle - |-\rangle)(|+\rangle + |-\rangle) \Big) \\&#xA;&amp;amp;= \frac{1}{2\sqrt{2}} (2|++\rangle - 2|--\rangle) \\&#xA;&amp;amp;= \frac{1}{\sqrt{2}} (|++\rangle - |--\rangle) &#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that this state still looks entangled in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{X on the first qubit} \rightarrow X \otimes I\\&#xA;\text{X on the second qubit} \rightarrow I \otimes X&#xA;$$&lt;/span&gt;&#xA;Here it actually doesn't matter which qubit of the entangled pair we measure, because their states are maximally correlated in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; (+1) or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; (-1) with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; on either qubit we choose to measure.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;See @KAJ226's post for the probability/measuring, below I'll explain how to get the eigenvectors&lt;/p&gt;&#xA;&lt;p&gt;For the operators &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; the procedure is the same.  Note that the computational state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; &lt;em&gt;are&lt;/em&gt; the eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator, so you don't need to rewrite them.  The eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operator are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|y+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + i|1\rangle)\\&#xA;|y-\rangle = \frac{1}{\sqrt{2}} (|0\rangle - i|1\rangle)&#xA;$$&lt;/span&gt;&#xA;so that the computational states, rewritten in the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-basis, are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle = \frac{1}{\sqrt{2}} (|y+\rangle + |y-\rangle)\\&#xA;|1\rangle = \frac{1}{i\sqrt{2}} (|y+\rangle - |y-\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To obtain the eigenvectors of any matrix (operator), you look for solutions of the following equation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A|v\rangle = \lambda |v\rangle\\&#xA;(A - \lambda I) |v\rangle = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an operator, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix, &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is a vector, and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is an eigenvalue.  This equation has solutions when the determinant of the matrix &lt;span class=&quot;math-container&quot;&gt;$A - \lambda I$&lt;/span&gt; is 0.  As an example, for the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;det(X - \lambda I) = 0\\&#xA;det\begin{bmatrix} -\lambda &amp;amp; 1 \\ 1 &amp;amp; -\lambda \end{bmatrix} = 0\\&#xA;\lambda^2 - 1 = 0\\&#xA;\lambda = \pm 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Knowing the eigenvalues, we plug them back into the original equation to find the eigenvectors.  For the first eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda = +1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A|v\rangle = +1 |v\rangle\\&#xA;\begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}\begin{bmatrix} a \\ b\end{bmatrix} = \begin{bmatrix} a \\ b\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which says that &lt;span class=&quot;math-container&quot;&gt;$a=b$&lt;/span&gt;, so that the eigenvectors of eigenvalue +1 are the vectors &lt;span class=&quot;math-container&quot;&gt;$a\begin{bmatrix} 1 \\ 1 \end{bmatrix}$&lt;/span&gt; for some scalar &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;.  But remember, these vectors are quantum states, which must be normalized, so we can find &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle v | v \rangle = 1 = a^* a \begin{bmatrix} 1 &amp;amp; 1\end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = 2|a|^2  \\&#xA;\frac{1}{2} = |a|^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that a simple solution is just that &lt;span class=&quot;math-container&quot;&gt;$a = \frac{1}{\sqrt{2}}$&lt;/span&gt;, which is the familiar normalization factor.  The state we have found is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1\end{bmatrix} &amp;amp;= \frac{1}{\sqrt{2}} \bigg( \begin{bmatrix} 1 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 1 \end{bmatrix} \bigg) \\&#xA;&amp;amp;= \frac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big) \equiv |+\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, then applying &lt;span class=&quot;math-container&quot;&gt;$X \otimes I$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle \otimes |\phi\rangle$&lt;/span&gt; for arbitrary &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$+1 |+\rangle |\phi\rangle$&lt;/span&gt;, which is an eigenvector of eigenvalue +1.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2020-11-16T12:13:59.023" LastActivityDate="2020-11-16T12:13:59.023" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14655" PostTypeId="1" AcceptedAnswerId="14671" CreationDate="2020-11-16T00:01:46.130" Score="1" ViewCount="49" Body="&lt;p&gt;How do I prove that for a general tri-partite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABE}$&lt;/span&gt;, the following holds:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(\rho_{AB}) = H(\rho_{E}), H(\rho_{AE}) = H(\rho_{B}),&#xA;$$&lt;/span&gt;&#xA;where, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the Von Neumann entropy. Would Schmidt decomposition help? But I can only do it in a bi-partite scenario. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-11-17T10:16:10.863" LastActivityDate="2020-11-17T10:16:10.863" Title="Prove that for a general tri-partite state $\rho_{ABE}$, $H(AB) = H(E)$" Tags="&lt;quantum-state&gt;&lt;entropy&gt;&lt;information-theory&gt;&lt;trace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14656" PostTypeId="1" CreationDate="2020-11-16T01:14:40.093" Score="-1" ViewCount="47" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$|ψ⟩ = \frac{1}{\sqrt2} (|01⟩ + |10⟩)$&lt;/span&gt; as the state and &lt;span class=&quot;math-container&quot;&gt;$σy   = \left(\begin{matrix}0&amp;amp;-i\\i&amp;amp;0\\\end{matrix}\right)$&lt;/span&gt; as the observable.&lt;/p&gt;&#xA;&lt;p&gt;How to calculate probability on the first qubit actually? What is the state after measurement?&lt;/p&gt;&#xA;" OwnerUserId="13823" LastEditorUserId="2879" LastEditDate="2020-11-16T03:23:32.350" LastActivityDate="2020-11-16T07:41:39.383" Title="Probabilities of entangled state. Quantum measurement" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2020-11-18T06:28:20.363" ContentLicense="CC BY-SA 4.0" />
  <row Id="14657" PostTypeId="2" ParentId="14653" CreationDate="2020-11-16T01:18:02.780" Score="7" Body="&lt;p&gt;In fact, in the &lt;a href=&quot;https://royalsocietypublishing.org/doi/10.1098/rspa.1992.0167&quot; rel=&quot;noreferrer&quot;&gt;original paper&lt;/a&gt; of Deutsch and Jozsa they actually implemented two oracles, here comes their procedure. If you omit the second &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; and get a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\prime&amp;gt;=\displaystyle\sum_{i=0}^{2N-1}(-1)^{f(i)}|i,f(i)&amp;gt;$&lt;/span&gt;, when quering the expectation value you need to put another &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\phi&amp;gt;$&lt;/span&gt; to get a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\prime&amp;gt;=\displaystyle\sum_{i=0}^{2N-1}|i,f(i)&amp;gt;$&lt;/span&gt;. Otherwise, &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;\phi|\psi\prime&amp;gt;$&lt;/span&gt; always equals 0.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jzziQ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jzziQ.png&quot; alt=&quot;Deutsch-Jozsa&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For your first question, the ability to using n qubits to evaluate say &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; functions is parallelism. You see that for a classical computer, there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; operations to evaluate while for the quantum computer you only need to perform the operation once (in this case if you applied n &lt;strong&gt;Hadamard gate&lt;/strong&gt; beforehand). As for how the procedure works, I think what you mean is to perform a measurement and that won't work.&lt;/p&gt;&#xA;&lt;p&gt;For the Deutsch-Jozsa, after you prepared the state &lt;span class=&quot;math-container&quot;&gt;$|\psi&amp;gt;$&lt;/span&gt;, what you need to do to extract the result is to get the &lt;strong&gt;expectation value&lt;/strong&gt;, &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;\phi|\psi&amp;gt;$&lt;/span&gt;, while if you perform a direct measurement &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;\psi|\psi&amp;gt;$&lt;/span&gt; you can not get the phase factor because there is no phase difference.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;First read &lt;a href=&quot;https://dl.acm.org/doi/abs/10.1145/602382.602408&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;. 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 &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/6_examples_max_cut_and_tsp.html&quot; rel=&quot;noreferrer&quot;&gt;using a quantum computer to solve travelling salesman problem&lt;/a&gt;), or some simulation algorithm for quantum systems.&lt;/p&gt;&#xA;&lt;p&gt;Also, there are different approaches to implement quantum computing, like the quantum Turing machine, quantum annealing, quantum circuit, quantum random walk, and so on.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-16T02:22:33.757" LastActivityDate="2020-11-16T02:22:33.757" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14658" PostTypeId="1" AcceptedAnswerId="14669" CreationDate="2020-11-16T02:50:39.403" Score="3" ViewCount="75" Body="&lt;p&gt;The quantum conditional entropy &lt;span class=&quot;math-container&quot;&gt;$S(A|B)\equiv S(AB)-S(A)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S(AB)=S(\rho_{\rm AB})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S(B)=S(\rho_{\rm B})$&lt;/span&gt; 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 &lt;a href=&quot;https://arxiv.org/pdf/1703.01059.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1703.01059.pdf&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9610005.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9610005.pdf&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="9082" LastEditorUserId="55" LastEditDate="2020-11-17T10:15:56.190" LastActivityDate="2020-11-17T10:15:56.190" Title="Positive conditional quantum entropy for entangled state" Tags="&lt;entanglement&gt;&lt;entropy&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14659" PostTypeId="1" AcceptedAnswerId="14858" CreationDate="2020-11-16T03:38:14.420" Score="5" ViewCount="68" Body="&lt;p&gt;I have a Q# operation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    operation init_and(a: Qubit, b: Qubit, target: Qubit) : Unit is Adj {&#xA;        // Uncomment this when using Toffoli simulator.&#xA;        // CCNOT(a, b, target);&#xA;&#xA;        // Uncomment this when doing resource estimates.&#xA;        body(...) {&#xA;            CCNOT(a, b, target);&#xA;        }&#xA;        adjoint(...) {&#xA;            H(target);&#xA;            if (M(target) == One) {&#xA;                CZ(a, b);&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;Is there some way to get the best of both worlds? For example, some way to say &amp;quot;when testing correctness use this, when doing cost estimates use this&amp;quot;? Some way to query &amp;quot;Is the Hadamard available?&amp;quot;?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="55" LastEditDate="2020-11-17T10:15:34.300" LastActivityDate="2020-11-27T05:15:12.130" Title="Simulator-dependent implementations in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14660" PostTypeId="2" ParentId="14653" CreationDate="2020-11-16T03:46:52.420" Score="5" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Where is the parallelism in Deutsch-Jozsa algorithm?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle \right)$&lt;/span&gt; into the black box.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;As I understand, the reason why this problem can be solved in one&#xA;iteration is qubits can be put any position via quantum gates on Bloch&#xA;sphere. Is it true?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 :)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;How to develop quantum algorithm? Isn't it very difficult that&#xA;developing an algorithm by thinking the state of matrices?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;David Deutsch was a genius, and even he didn't come up with what we now call the Deutsch-Josza 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 Josza 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.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, you are correct, it's not easy to come up with something like the Deutsch-Josza algorithm out of thin air. Even Deutsch didn't do it, and even his version with Josza 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.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-11-16T03:46:52.420" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14661" PostTypeId="1" AcceptedAnswerId="14662" CreationDate="2020-11-16T04:24:55.063" Score="3" ViewCount="38" Body="&lt;p&gt;I'm reading a Hamiltonian simulation example proposed in &lt;a href=&quot;https://quantum-journal.org/wp-content/uploads/2020/09/q-2020-09-12-322.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. From their notation, the operator &lt;span class=&quot;math-container&quot;&gt;$D_y$&lt;/span&gt; (sometimes it's called &lt;span class=&quot;math-container&quot;&gt;$H_y$&lt;/span&gt;) serves the function to diagonalize the Pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma_y(Y)$&lt;/span&gt; (the corresponding circuit is illustrated below):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D_y\ (or\ H_y)=HSX=\frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;i &amp;amp; 1\\&#xA;-i &amp;amp; 1&#xA;\end{bmatrix}&#xA;\quad\quad\quad [A] &#xA;$$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RvtLp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RvtLp.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, unlike &lt;span class=&quot;math-container&quot;&gt;$D_x$&lt;/span&gt;, which is the Hadamard gate, I found &lt;span class=&quot;math-container&quot;&gt;$D_y$&lt;/span&gt; is sometimes written in different ways, like in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11391/12334&quot;&gt;this answer&lt;/a&gt; by @Craig Gidney:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D_y\ (or\ H_{YZ}) = \frac{Y+Z}{\sqrt{2}} = \frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;1 &amp;amp; -i\\&#xA;i &amp;amp; -1&#xA;\end{bmatrix}&#xA;\quad\quad\quad [B] &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11403/12334&quot;&gt;this answer&lt;/a&gt; by @Davit Khachatryan:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D_y\ (or \ 'Y'_{not\ pauli\ here}) = U_2(0,\pi/2) =\frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;1 &amp;amp; -i\\&#xA;1 &amp;amp; i&#xA;\end{bmatrix}&#xA;\quad\quad\quad [C] &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus I'm wondering are those different versions of &lt;span class=&quot;math-container&quot;&gt;$D_y$&lt;/span&gt; the same thing? Are they essentially all belong to &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; gate?&lt;/p&gt;&#xA;&lt;p&gt;Also, when should we use two &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gates outside of the CNOT gates to perform the time-evolution simulation (like in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14595/12334&quot;&gt;this case&lt;/a&gt;, the answer from @KAJ226)?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2020-11-16T18:28:30.060" LastActivityDate="2020-11-16T18:28:30.060" Title="Definitions of $D_y$ gate in Hamiltonian simulation: are they the same?" Tags="&lt;quantum-gate&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14662" PostTypeId="2" ParentId="14661" CreationDate="2020-11-16T07:36:33.887" Score="2" Body="&lt;p&gt;A and C are technically the same thing, they only differ by a global phase, which makes no difference.&lt;/p&gt;&#xA;&lt;p&gt;B is technically different, but serves the same purpose. Note that if&#xA;&lt;span class=&quot;math-container&quot;&gt;$UYU^\dagger=Z$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$$R_zUYU^\dagger R_z^\dagger=R_zZR_z^\dagger=ZR_zR_z^\dagger=Z$$&lt;/span&gt;&#xA;so if the only effect you're interested in is the diagonalisation of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, there is a freedom of an arbitrary &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotation &lt;span class=&quot;math-container&quot;&gt;$R_z=e^{i\theta Z/2}$&lt;/span&gt; in the definition of your unitary.&lt;/p&gt;&#xA;&lt;p&gt;In the end, we have the relations&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D^C=-iD^A=S^\dagger D^B.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-16T07:36:33.887" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14663" PostTypeId="2" ParentId="14656" CreationDate="2020-11-16T07:41:39.383" Score="1" Body="&lt;p&gt;The matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma_Y$&lt;/span&gt; has two eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, so the one-qubit projectors for the measurement are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12(I\pm\sigma_Y).&#xA;$$&lt;/span&gt;&#xA;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{\pm}=\frac12(I\pm\sigma_Y)\otimes I.&#xA;$$&lt;/span&gt;&#xA;You can check that &lt;span class=&quot;math-container&quot;&gt;$P_++P_-=I\otimes I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now measurement follows the standard formalism. The probabilities of getting either outcome are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_{\pm}=\langle\psi|P_{\pm}|\psi\rangle&#xA;$$&lt;/span&gt;&#xA;and the possible states after the measurement are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{\pm}\rangle=P_{\pm}|\psi\rangle/\sqrt{p_{\pm}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-16T07:41:39.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14664" PostTypeId="1" CreationDate="2020-11-16T09:07:27.117" Score="0" ViewCount="74" Body="&lt;p&gt;For a n-qubit quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\displaystyle\sum_{i=0}^{2^N-1}|i\rangle$&lt;/span&gt;, by definition it's density matrix is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|=\displaystyle\sum_{i,j=0}^{2^N-1}|j\rangle\langle i|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Recently I am trying to implement a quantum neural network given by a &lt;a href=&quot;https://www.nature.com/articles/s41467-020-14454-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, and one step of it is required so, maybe up to a normalization constant(at supplementary note 2, when calculating the derivative).&lt;/p&gt;&#xA;&lt;p&gt;For a &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; dimensional identity matrix, it &lt;strong&gt;does not violate&lt;/strong&gt; the &lt;a href=&quot;https://homepage.univie.ac.at/reinhold.bertlmann/pdfs/T2_Skript_Ch_9corr.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;requirements of being a density matrix&lt;/a&gt;,  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?&lt;/p&gt;&#xA;&lt;p&gt;An additional requirement of mine is that the density matrix &lt;strong&gt;must be produced by some qubits&lt;/strong&gt; or this problem might be truly tedious.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="1859" LastEditDate="2020-11-21T17:07:13.160" LastActivityDate="2020-11-21T17:07:13.160" Title="Produce a quantum state with its density matrix an identity matrix up to an constant" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;state-preparation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14665" PostTypeId="1" CreationDate="2020-11-16T09:15:57.320" Score="0" ViewCount="108" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import QasmSimulator&#xA;backend = QasmSimulator(method=&amp;quot;automatic&amp;quot;, max_parallel_threads=6, max_parallel_shots=6)&#xA;&#xA;... the rest of the code...&#xA;&#xA;job = execute(circ, backend, shots=nshots)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &amp;quot;thinks&amp;quot; that indeed you have one core only. Any suggestion?&lt;/p&gt;&#xA;&lt;p&gt;I am using Qiskit 0.23.0&lt;/p&gt;&#xA;&lt;p&gt;(Note that I asking specifically about parallel shots and not parallel circuits, although that might also help with another issue I have)&lt;/p&gt;&#xA;" OwnerUserId="11551" LastActivityDate="2021-04-15T11:49:28.453" Title="Parallel shots on Qiskit" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14666" PostTypeId="2" ParentId="14603" CreationDate="2020-11-16T09:25:16.913" Score="0" Body="&lt;p&gt;Here's an update for those interested (&amp;amp; before I had read Michael's comment)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://www.tensorflow.org/quantum/api_docs/python/tfq/layers/ControlledPQC&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;ControlledPQC&lt;/code&gt;&lt;/a&gt; to have non-trainable values (&lt;code&gt;phi&lt;/code&gt;) and trainable values &lt;code&gt;alpha&lt;/code&gt; and &lt;code&gt;beta&lt;/code&gt; .. I think it's doable but it really does get tricky.&lt;/p&gt;&#xA;&lt;p&gt;Anyway, here is the modified problem and solution I found adapting TensorFlow Quantum's examples ....&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I now have this circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# define two qubits&#xA;q0 = cirq.GridQubit(0,0)&#xA;q1 = cirq.GridQubit(0,1)&#xA;&#xA;# make a PauliSum gate that will return [1] if the state is a bell state b00 (|00&amp;gt;)&#xA;z0 = cirq.Z(q0)&#xA;z1 = cirq.Z(q1)&#xA;z00 = (((1+z0)/2)*((1+z1)/2) )&#xA;&#xA;# define three parameters, x will be varied - a,b are fixed&#xA;phi = sp.Symbol('phi')&#xA;alpha = sp.Symbol('alpha')&#xA;beta = sp.Symbol('beta')&#xA;&#xA;&#xA;circuit = cirq.Circuit([&#xA;                cirq.rx(phi)(q0),&#xA;                cirq.ry(-2*phi)(q1),&#xA;                cirq.H(q0),&#xA;                cirq.CNOT(q0,q1),&#xA;                cirq.rx(alpha)(q0),&#xA;                cirq.ry(beta)(q1),&#xA;                ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which looks like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ki0fV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ki0fV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can calculate the z00 expectation which is going to give me the same distribution as would running measurements on the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; (obviously)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#fix two values of alpha and beta&#xA;a = 1.8&#xA;b = -3&#xA;&#xA;#loop over phi from -6 to 6&#xA;x_values = np.arange(-6,6,0.05)&#xA;y_expectations = []&#xA;&#xA;for j in x_values:&#xA;    #resolve the circuit for different values of phi&#xA;    resolver = cirq.ParamResolver({'alpha':a,'beta':b,'phi':j})&#xA;&#xA;    #calcuclate the expectation value&#xA;    result = cirq.Simulator().simulate(cirq.resolve_parameters(circuit,resolver))&#xA;    e = z00.expectation_from_state_vector(result.final_state_vector,{q0:0,q1:1})&#xA;    y_expectations.append(e)&#xA;&#xA;plt.scatter(x_values,y_expectations,label=f'Expected, &lt;span class=&quot;math-container&quot;&gt;$\\alpha$&lt;/span&gt;={a}, &lt;span class=&quot;math-container&quot;&gt;$\\beta$&lt;/span&gt;={b}')&#xA;plt.xlabel('&lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;')&#xA;plt.ylabel('Expectation')&#xA;plt.legend()&#xA;plt.show();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Gives the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rOfYi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rOfYi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can split the circuit into two parts:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Input qubits with rotations by the angle &lt;code&gt;\phi&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;input_circuit = cirq.Circuit([&#xA;                cirq.rx(phi)(q0),&#xA;                cirq.ry(-2*phi)(q1)&#xA;                ])&#xA;&amp;gt;&amp;gt;&amp;gt; input_circuit&#xA;(0, 0): ───Rx(phi)──────&#xA;&#xA;(0, 1): ───Ry(-2*phi)───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;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.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;model_circuit = cirq.Circuit([&#xA;                cirq.H(q0),&#xA;                cirq.CNOT(q0,q1),&#xA;                cirq.rx(alpha)(q0),&#xA;                cirq.ry(beta)(q1),&#xA;              ])&#xA;&amp;gt;&amp;gt;&amp;gt; model_circuit&#xA;&#xA;(0, 0): ───H───@───Rx(alpha)───&#xA;               │&#xA;(0, 1): ───────X───Ry(beta)────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Using &lt;code&gt;tfq&lt;/code&gt; I can make a really simple model based on the &lt;code&gt;model_circuit&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#building a keras model&#xA;#- the input is the input_circuit &#xA;#- the PQC outputs the expectation to be in state |00&amp;gt; from the model circuit, given the input circuit&#xA;model = tf.keras.Sequential([&#xA;    tf.keras.layers.Input(shape=(), dtype=tf.string),&#xA;    tfq.layers.PQC(model_circuit, z00),&#xA;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also, need to convert the input circuits (one circuit per value of phi) into tensors:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#generate a series of input circuits, with different x values (values of phi)&#xA;input_circuits =  tfq.convert_to_tensor([&#xA;                                        cirq.resolve_parameters(input_circuit, cirq.ParamResolver({'phi':x}))&#xA;                                        ] for x in x_values)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I can test the model (randomly initialised values of &lt;code&gt;alpha&lt;/code&gt; and &lt;code&gt;beta&lt;/code&gt; given my input circuits:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#test the model &#xA;y_test = model([input_circuits]).numpy()&#xA;#plot how a randomly initiated model compares with the expected&#xA;plt.plot(x_values,y_expected,lw=4,label=f'Expected, $\\alpha$={a}, $\\beta$={b}')&#xA;plt.plot(x_values,y_test,'ro',label='Pre-trained NN output')&#xA;plt.xlabel('$\phi$')&#xA;plt.ylabel('Expectation')&#xA;plt.legend()&#xA;plt.show();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FypfW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FypfW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next is to compile the model, using a basic optimiser and loss, e.g.:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;optimizer = tf.keras.optimizers.Adam(learning_rate=0.01)&#xA;loss = tf.keras.losses.MeanSquaredError()&#xA;model.compile(optimizer=optimizer, loss=loss)&#xA;model.summary()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then the model can be fitted given now the &lt;code&gt;y_expected&lt;/code&gt; from the original expectations (this could easily be the original 'measurements' distribution instead)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;y_expected = np.array(y_expectations)&#xA;history = model.fit(&#xA;      input_circuits, y_expected,&#xA;      epochs=20,&#xA;      verbose=0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After the model has been trained, I can make the predictions again and see how it's easily learnt what the parameters were:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TiahD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TiahD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="13792" LastEditorUserId="13792" LastEditDate="2020-11-16T10:30:45.693" LastActivityDate="2020-11-16T10:30:45.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14667" PostTypeId="2" ParentId="14651" CreationDate="2020-11-16T09:31:24.903" Score="3" Body="&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$ \sigma_x = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt; has two eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|+ \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix}  $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|- \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix}  $&lt;/span&gt; with the corresponding eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&lt;p&gt;According to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born rule&lt;/a&gt;, the probability that we will get &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; on the first qubit which correspond to the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$Tr( \rho M)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the density matrix and in this case it is &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi \rangle \langle \psi|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the projection operator onto the basis vector corresponding to the measurement outcome of &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; on the first qubit in this case. Calculating it out explicitly:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = |\psi \rangle \langle \psi | = \begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\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 &amp;amp; 1 \end{pmatrix} \bigg] \otimes  \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} &amp;amp;=  \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; 1  \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0  &amp;amp; 1\end{pmatrix} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho M) = Tr\bigg(\begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0  &amp;amp; 1\end{pmatrix} \bigg) = \dfrac{1}{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; The state after measurement, &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post}\rangle $&lt;/span&gt;, is going to be&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\psi_{post}\rangle  = \dfrac{ M |\psi \rangle }{ \sqrt{prob(+1)}} = \dfrac{ \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0  &amp;amp; 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 &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$|++\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} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This can be extended to measurement in &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis as well. But &lt;span class=&quot;math-container&quot;&gt;$ \sigma_y = \begin{pmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0 \end{pmatrix} $&lt;/span&gt; and hence its two eigenvectors&#xA;are &lt;span class=&quot;math-container&quot;&gt;$|i \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix}  $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|-i \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -i \end{pmatrix}  $&lt;/span&gt; with corresponding eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; respectively. Then the probability to see &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; on the first qubit can be again calculated by &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho M)$&lt;/span&gt; but here &lt;span class=&quot;math-container&quot;&gt;$M = |i\rangle \langle i| \otimes I $&lt;/span&gt; which can be calculated explicitly as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\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 &amp;amp; -i \end{pmatrix} \bigg] \otimes  \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} &amp;amp;=  \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; -i \\ i &amp;amp; 1  \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; -i &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -i\\ i &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; i &amp;amp; 0  &amp;amp; 1\end{pmatrix} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and hence&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho M) = Tr\bigg(\begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; -i &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -i\\ i &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; i &amp;amp; 0  &amp;amp; 1\end{pmatrix} \bigg) = \dfrac{1}{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to measure in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis then it's trivial as you can already see the answer but we can follow the same procedure for  confirmation. &lt;span class=&quot;math-container&quot;&gt;$\sigma_z = \begin{pmatrix} 1 &amp;amp; 0\\ 1 &amp;amp; -1 \end{pmatrix} $&lt;/span&gt; and it has two eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0  \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle = \begin{pmatrix} 0 \\ 1  \end{pmatrix}$&lt;/span&gt; with two associate eigenvalues &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; respectively. Now to know the probability of getting the first qubit to be measured with &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho M)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is similar as before, and &lt;span class=&quot;math-container&quot;&gt;$M = |0\rangle \langle 0| \otimes I$&lt;/span&gt;, which works out explicitly as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} M = |0\rangle \langle 0| \otimes I = \bigg[ \begin{pmatrix} 1 \\ 0 \end{pmatrix} \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} \bigg] \otimes  \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} &amp;amp;=   \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0  \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\end{pmatrix} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho M) = Tr\bigg(\begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\end{pmatrix} \bigg) = \dfrac{1}{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the state after collapsed is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\psi_{post}\rangle   = \dfrac{ \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 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 &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This makes sense because we have &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}} $&lt;/span&gt; and so if the first qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; after measurement then this means that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; has collapsed onto the eigenvector &lt;span class=&quot;math-container&quot;&gt;$|01 \rangle$&lt;/span&gt;, hence the reason why our calculation show &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post}\rangle$&lt;/span&gt;. Similarly, if the read out indicates that the first qubit is a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post}\rangle$&lt;/span&gt; would have been &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-18T19:58:47.480" LastActivityDate="2020-11-18T19:58:47.480" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="14668" PostTypeId="2" ParentId="14665" CreationDate="2020-11-16T09:32:54.847" Score="0" Body="&lt;p&gt;There is a &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14396/how-many-shots-should-one-take-to-get-a-reliable-estimate-in-a-quantum-program/14399#14399&quot;&gt;question&lt;/a&gt; which is quite alike to your problem in Quantum Computing-stack exchange. I have answered it before, you may see that.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-16T10:00:49.483" LastActivityDate="2020-11-16T10:00:49.483" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14669" PostTypeId="2" ParentId="14658" CreationDate="2020-11-16T09:42:07.690" Score="4" Body="&lt;p&gt;As you mention pure states will not do. So lets look at a simple example of mixed entangled states, two-qubit Werner states. Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = q |\Psi^- \rangle \langle \Psi^-| + (1-q) I / 4$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$| \Psi^- \rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q \in [0,1]$&lt;/span&gt;. It is known that this family of states is separable iff &lt;span class=&quot;math-container&quot;&gt;$q \in [0, 1/3]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So let's calculate their conditional entropy. We have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(AB) = 2 - \frac34 (1-q) \log(1-q) - \frac14 (1+3q)\log(1+3q)&#xA;$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$H(B) = 1$&lt;/span&gt;. Putting this together we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(A|B) = g(q) &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$g(q) = 1 - \frac34 (1-q) \log(1-q) - \frac14 (1+3q)\log(1+3q)$&lt;/span&gt;. Now you can check that for a range of values greater than &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt; the conditional entropy is positive. E.g. &lt;span class=&quot;math-container&quot;&gt;$g(1/2) \approx 0.549$&lt;/span&gt;. Plotting &lt;span class=&quot;math-container&quot;&gt;$g(q)$&lt;/span&gt; it looks like the entropy becomes positive somewhere just below &lt;span class=&quot;math-container&quot;&gt;$q = 3/4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/h0evQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/h0evQ.png&quot; alt=&quot;werner entropy plot&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-16T09:42:07.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14670" PostTypeId="1" CreationDate="2020-11-16T09:42:31.300" Score="2" ViewCount="35" Body="&lt;p&gt;I am trying to understand a part from the article &amp;quot;Restrictions on Transversal Encoded Quantum Gate Sets&amp;quot;. in the article they talk about the importance of transversal encoded gates for fault tolerant quantum computing. They prove that their cant be a gate set that works on a non trivial quantum code Space C that is also universal and the gates are transversal.&#xA;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.&#xA;can someone help me understand the following paragraph from the article?&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;An outline of the argument is as follows:&lt;/p&gt;&#xA;&lt;p&gt;The set of logical unitary product operators, G, is a Lie subgroup of the Lie group of unitary product operators, T. As a Lie group,G can be partitioned into cosets of the con-nected component of the identity,C; these cosets form adiscrete set, Q. Using the fact that the Lie algebra of C is a subalgebra of T, it can be shown that the connected component of the identity acts trivially for anylocal-error-detecting code. This implies that the number of logically distinct operators implemented by elements of G is limited to the cardinality of Q. Due to to the compactness of T, this number must be finite. A finite number of operators can approximate infinitely many only up to some fixed accuracy; thus, 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.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;thank you for any help :)&lt;/p&gt;&#xA;" OwnerUserId="13832" LastActivityDate="2020-11-16T09:42:31.300" Title="Understanding &quot;Restrictions on Transversal Encoded Quantum Gate Sets&quot;" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14671" PostTypeId="2" ParentId="14655" CreationDate="2020-11-16T10:13:14.500" Score="4" Body="&lt;p&gt;This is &lt;strong&gt;not&lt;/strong&gt; true for general tripartite states. Take the trivial example where &lt;span class=&quot;math-container&quot;&gt;$ABE$&lt;/span&gt; share a maximally mixed state and each parties subsystem is of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. The reduced states of a two-party subsystem are maximally mixed of dimension &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; and of a single party system are maximally mixed of dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. As the dimensions are different and they are maximally mixed they cannot have the same entropy.&lt;/p&gt;&#xA;&lt;p&gt;However, the result does hold if &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABE} = |\psi\rangle \langle \psi|$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H_{A} \otimes H_B$&lt;/span&gt; just &lt;span class=&quot;math-container&quot;&gt;$H_{D}$&lt;/span&gt;. Then we can view &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as a state in &lt;span class=&quot;math-container&quot;&gt;$H_D \otimes H_E$&lt;/span&gt; and use the Schmidt decomposition. That is we know there exists orthonormal bases &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle_D\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle_E\}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; respectively such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle_{DE} = \sum_i \sqrt{\lambda_i} |ii\rangle.&#xA;$$&lt;/span&gt;&#xA;As a consequence the reduced states have the same spectrum,&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\rho_D = \sum_i \lambda_i |i \rangle \langle i |$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_E = \sum_i \lambda_i |i \rangle \langle i |$&lt;/span&gt; and hence &lt;span class=&quot;math-container&quot;&gt;$H(D) = H(E)$&lt;/span&gt;. If you want to make this proof more formal you can do the identifying &lt;span class=&quot;math-container&quot;&gt;$H_A \otimes H_B$&lt;/span&gt; with a single Hilbert space &lt;span class=&quot;math-container&quot;&gt;$H_D$&lt;/span&gt; step using an isometry map &lt;span class=&quot;math-container&quot;&gt;$V : H_{A} \otimes H_{B} \rightarrow H_D$&lt;/span&gt; and then note that the von Neumann entropy is invariant under isometries.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-16T10:13:14.500" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14672" PostTypeId="2" ParentId="9716" CreationDate="2020-11-16T10:14:26.300" Score="0" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1903.06035.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;). Indeed, a red node labelled with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; means &amp;quot;project on 0&amp;quot; and the red node labeled with &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; means &amp;quot;project on &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&amp;quot;. That way, I can write directly a red node labelled &lt;span class=&quot;math-container&quot;&gt;$a\pi$&lt;/span&gt;, which is equivalent to saying that I measured an &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This approach is equivalent to writing two diagrams, one with a red node &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and one with a red node &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. 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 &lt;a href=&quot;http://personal.strath.ac.uk/ross.duncan/papers/gflow.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt; and when &lt;span class=&quot;math-container&quot;&gt;$a=1$&lt;/span&gt;, and here you go!&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="5969" LastActivityDate="2020-11-16T10:14:26.300" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14673" PostTypeId="1" CreationDate="2020-11-16T11:21:43.117" Score="2" ViewCount="116" Body="&lt;p&gt;What is a unitary operator that makes all the amplitudes all negative on the arbitrary state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits?&#xA;For example suppose, &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, the arbitrary state is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$a_1|00\rangle+a_2|01\rangle-a_3|10\rangle+a_4|11\rangle$&lt;/span&gt;  then the unitary operator will give the result&#xA;&lt;span class=&quot;math-container&quot;&gt;$-a_1|00\rangle-a_2|01\rangle-a_3|10\rangle-a_4|11\rangle$&lt;/span&gt;  on the above state (where &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; are real positive numbers that are the amplitudes).&lt;/p&gt;&#xA;&lt;p&gt;In other words the amplitudes are not complex numbers and the negative signs are randomly distributed regarding the &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;; a similar statement is true for any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Also we do not know for which &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt;is negative or positive without measuring the state (which will destroy the state and we do not want to destroy the state).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13834" LastEditorUserId="55" LastEditDate="2020-11-17T10:14:41.200" LastActivityDate="2020-11-20T19:04:23.073" Title="What is a unitary operator that makes all the amplitudes all negative on the arbitrary state of $n$ qubits?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14675" PostTypeId="2" ParentId="14673" CreationDate="2020-11-16T12:24:26.407" Score="0" Body="&lt;p&gt;First, apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on second qubit and then controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate. The resulting state would be &lt;span class=&quot;math-container&quot;&gt;$a_1|00\rangle + a_2|01\rangle + a_3|10\rangle + a_4|11\rangle$&lt;/span&gt;. Now, you can apply operator &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; which is a global phase &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In fact, you do not have to apply global phase operator as states which differ in global phase only as indistinguishable.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-16T12:24:26.407" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14676" PostTypeId="2" ParentId="14673" CreationDate="2020-11-16T12:36:05.343" Score="6" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(|0\rangle-|1\rangle)=-|0\rangle-|1\rangle,\qquad U(|0\rangle+|1\rangle)=-|0\rangle-|1\rangle.&#xA;$$&lt;/span&gt;&#xA;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).&lt;/p&gt;&#xA;&lt;p&gt;(Technically, I should allow for the introduction of ancilla qubits as well. This will not change the conclusion).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-16T12:36:05.343" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14677" PostTypeId="1" CreationDate="2020-11-16T15:07:47.377" Score="0" ViewCount="50" Body="&lt;pre&gt;&lt;code&gt;      from qiskit import QuantumRegister, QuantumCircuit&#xA;      import numpy as np&#xA;&#xA;      t = 2  # This is not optimal; As an exercise, set this to the&#xA;      # value that will get the best results. See section 8 for solution.&#xA;&#xA;      nqubits = 4  # Total number of qubits&#xA;      nb = 1  # Number of qubits representing the solution&#xA;      nl = 2  # Number of qubits representing the eigenvalues&#xA;&#xA;      theta = 0  # Angle defining |b&amp;gt;&#xA;&#xA;      a = 1  # Matrix diagonal&#xA;      b = -1/3  # Matrix off-diagonal&#xA;&#xA;     # Initialise the quantum and classical registers&#xA;     qr = QuantumRegister(nqubits)&#xA;&#xA;     # Create a Quantum Circuit&#xA;     qc = QuantumCircuit(qr)&#xA;&#xA;     qrb = qr[0:nb]&#xA;     qrl = qr[nb:nb+nl]&#xA;     qra = qr[nb+nl:nb+nl+1]&#xA;&#xA;    # State preparation. &#xA;    qc.ry(2*theta, qrb[0])&#xA;&#xA;    # QPE with e^{iAt}&#xA;    for qu in qrl:&#xA;    qc.h(qu)&#xA;&#xA;    qc.u1(a*t, qrl[0])&#xA;    qc.u1(a*t*2, qrl[1])&#xA;&#xA;    qc.u3(b*t, -np.pi/2, np.pi/2, qrb[0])&#xA;&#xA;&#xA;   # Controlled e^{iAt} on \lambda_{1}:&#xA;   params=b*t&#xA;&#xA;   qc.u1(np.pi/2,qrb[0])&#xA;   qc.cx(qrl[0],qrb[0])&#xA;   qc.ry(params,qrb[0])&#xA;   qc.cx(qrl[0],qrb[0])&#xA;   qc.ry(-params,qrb[0])&#xA;   qc.u1(3*np.pi/2,qrb[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question regarding this part of the code is&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;What is &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt; and controlled-&lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, and why is controlled U gates based on different angles &lt;span class=&quot;math-container&quot;&gt;$at,2at$&lt;/span&gt;. There are many questions regarding this.&lt;/p&gt;&#xA;&lt;p&gt;Can somebody explain this code to me, on this site or can somebody share his/her mail. I really am have trouble regarding this HHL algorithm and its implementation.&lt;/p&gt;&#xA;" OwnerUserId="6070" LastEditorUserId="55" LastEditDate="2020-11-17T10:14:13.723" LastActivityDate="2020-11-17T10:14:13.723" Title="HHL algorithm Qiskit version" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14678" PostTypeId="1" AcceptedAnswerId="14680" CreationDate="2020-11-16T15:17:20.193" Score="2" ViewCount="70" Body="&lt;p&gt;The diamond distance between two channels &lt;span class=&quot;math-container&quot;&gt;$\Phi_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_1$&lt;/span&gt; is defined in this &lt;a href=&quot;https://cstheory.stackexchange.com/a/4920/50851&quot;&gt;answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \| \Phi_0 - \Phi_1 \|_{\diamond} = \sup_{\rho} \: \| (\Phi_0 \otimes \operatorname{Id}_k)(\rho) - (\Phi_1 \otimes \operatorname{Id}_k)(\rho) \|_1 $$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Id}_k$&lt;/span&gt; denotes the identity channel from &lt;span class=&quot;math-container&quot;&gt;$M_k(\mathbb{C})$&lt;/span&gt; (the set of &lt;span class=&quot;math-container&quot;&gt;$k\times k$&lt;/span&gt; complex matrices) to itself, &lt;span class=&quot;math-container&quot;&gt;$\| \cdot \|_1$&lt;/span&gt; denotes the trace norm, and the supremum is taken over all &lt;span class=&quot;math-container&quot;&gt;$k \geq 1$&lt;/span&gt; and all density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; chosen from &lt;span class=&quot;math-container&quot;&gt;$M_{nk}(\mathbb{C}) = M_n(\mathbb{C}) \otimes M_{k}(\mathbb{C})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$N_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N_2$&lt;/span&gt; be two completely positive trace nonincreasing maps that satisfy&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\|N_1 - N_2\|_\diamond\leq \varepsilon.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For any channel &lt;span class=&quot;math-container&quot;&gt;$N_{A\rightarrow B}$&lt;/span&gt;, we define its Stinespring dilation to be an isometry &lt;span class=&quot;math-container&quot;&gt;$V_{A\rightarrow BE}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_E(V\rho_A V^\dagger) = N(\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can one show that there exist Stinespring dilations &lt;span class=&quot;math-container&quot;&gt;$V_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_2$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$N_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N_2$&lt;/span&gt; respectively such that we also have a bound on&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\|V_1 - V_2\|_\diamond$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in terms of &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-11-16T16:17:45.157" LastActivityDate="2020-11-17T20:22:22.277" Title="Diamond norm distance bound on Stinespring dilations of channels" Tags="&lt;information-theory&gt;&lt;linear-algebra&gt;&lt;diamond-norm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14679" PostTypeId="2" ParentId="14659" CreationDate="2020-11-16T16:06:24.410" Score="5" Body="&lt;p&gt;One possibility is to override a default implementation using an alternative one for a specific simulator. Here, &lt;code&gt;init_and&lt;/code&gt; would be the default implementation as in the uncommented code and &lt;code&gt;CCNOT&lt;/code&gt; would be the alternative.&lt;/p&gt;&#xA;&lt;p&gt;In the Q# libraries, we have the exact same case for &lt;code&gt;Microsoft.Quantum.Canon.ApplyAnd&lt;/code&gt; and &lt;code&gt;Microsoft.Quantum.Canon.ApplyLowDepthAnd&lt;/code&gt;. Here is a cut down version of&#xA;&lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/main/Standard/src/Canon/And.cs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/microsoft/QuantumLibraries/blob/main/Standard/src/Canon/And.cs&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#nullable enable&#xA;&#xA;using System;&#xA;using Microsoft.Quantum.Simulation.Core;&#xA;using Microsoft.Quantum.Simulation.Simulators;&#xA;&#xA;namespace SameNameSpaceAsQSharpInitAnd {&#xA;    public partial class init_and {&#xA;        public class Native : init_and {&#xA;            private bool use_classical_adjoint;&#xA;&#xA;            public Native(IOperationFactory m) : base(m) {&#xA;                use_classical_adjoint = m is ToffoliSimulator;&#xA;            }&#xA;&#xA;            public override Func&amp;lt;(Qubit, Qubit, Qubit), QVoid&amp;gt; __AdjointBody__ {&#xA;                get {&#xA;                    if (use_classical_adjoint) {&#xA;                        return base.__Body__;&#xA;                    }&#xA;                    return base.__AdjointBody__;&#xA;                }&#xA;            }&#xA;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In your case overrides for &lt;code&gt;__ControlledBody__&lt;/code&gt; and &lt;code&gt;__ControlledAdjointBody__&lt;/code&gt; are not required.&lt;/p&gt;&#xA;&lt;p&gt;The C# code needs to be implemented in the same project and namespace where you implement the &lt;code&gt;init_and&lt;/code&gt; Q# operation.&lt;/p&gt;&#xA;" OwnerUserId="13836" LastEditorUserId="119" LastEditDate="2020-11-16T18:08:49.197" LastActivityDate="2020-11-16T18:08:49.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14680" PostTypeId="2" ParentId="14678" CreationDate="2020-11-16T16:23:39.327" Score="3" Body="&lt;p&gt;Yes, in fact there exits Stinespring dilations such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}}$$&lt;/span&gt; where the distance between the isometries is the in terms of the operator norm and &lt;span class=&quot;math-container&quot;&gt;$N_1,N_2$&lt;/span&gt; are completely positive maps and &lt;span class=&quot;math-container&quot;&gt;$V_1,V_2$&lt;/span&gt; are their Stinespring isometries. See &lt;a href=&quot;https://arxiv.org/pdf/0710.2495.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/0710.2495.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: above the &lt;span class=&quot;math-container&quot;&gt;$cb$&lt;/span&gt;-norm is the completely bounded &amp;quot;operator&amp;quot; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|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}},$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the dimension of the space on which &lt;span class=&quot;math-container&quot;&gt;$(V_1-V_2)\otimes id_{B(H)}$&lt;/span&gt; acts, and &lt;span class=&quot;math-container&quot;&gt;$B(H)$&lt;/span&gt; is the set of bounded operators on &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-11-17T20:22:22.277" LastActivityDate="2020-11-17T20:22:22.277" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14681" PostTypeId="1" AcceptedAnswerId="14682" CreationDate="2020-11-16T18:01:10.543" Score="1" ViewCount="62" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastEditorUserId="55" LastEditDate="2020-11-17T10:13:58.823" LastActivityDate="2020-11-17T10:13:58.823" Title="IBM Q - Individual Run Results" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14682" PostTypeId="2" ParentId="14681" CreationDate="2020-11-16T19:28:59.837" Score="2" Body="&lt;p&gt;You can set &lt;code&gt;memory=True&lt;/code&gt; in &lt;code&gt;assemble()&lt;/code&gt; or &lt;code&gt;execute()&lt;/code&gt;. Then use &lt;code&gt;result.get_memory()&lt;/code&gt; to get the per-shot measurement.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(circs, memory=True, shots=4)&#xA;result = job.result()&#xA;print(result.get_counts(0))  # prints {'00': 3, '11': 1}&#xA;print(result.get_memory(0))  # prints ['00', '00', '11', '00']  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-11-16T19:28:59.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14683" PostTypeId="2" ParentId="14681" CreationDate="2020-11-16T19:32:14.527" Score="2" Body="&lt;p&gt;It seems like this documentation will help you: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.result.Result.html#qiskit.result.Result.get_memory&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.result.Result.html#qiskit.result.Result.get_memory&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;provider = IBMQ.load_account()&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;&#xA;circuit.h(0)&#xA;circuit.h(1)&#xA;circuit.cx(0, 1)&#xA;circuit.cx(0, 2)&#xA;circuit.barrier(range(3))&#xA;circuit.h(0)&#xA;circuit.h(1)&#xA;circuit.barrier(range(3))&#xA;circuit.measure_all()&#xA;print(circuit)&#xA;&#xA;job = execute(circuit, Aer.get_backend('qasm_simulator'), shots=10, memory=True)&#xA;&#xA;print('result for each shot:', job.result().get_memory() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐           ░ ┌───┐ ░ ┌─┐      &#xA;q_0: ┤ H ├──■────■───░─┤ H ├─░─┤M├──────&#xA;     ├───┤┌─┴─┐  │   ░ ├───┤ ░ └╥┘┌─┐   &#xA;q_1: ┤ H ├┤ X ├──┼───░─┤ H ├─░──╫─┤M├───&#xA;     └───┘└───┘┌─┴─┐ ░ └───┘ ░  ║ └╥┘┌─┐&#xA;q_2: ──────────┤ X ├─░───────░──╫──╫─┤M├&#xA;               └───┘ ░       ░  ║  ║ └╥┘&#xA;c: 3/═══════════════════════════╩══╩══╩═&#xA;                                0  1  2 &#xA;result for each shot: ['101', '001', '100', '100', '101', '101', '001', '100', '101', '100']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="1859" LastEditDate="2020-11-16T22:15:33.967" LastActivityDate="2020-11-16T22:15:33.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14684" PostTypeId="2" ParentId="14626" CreationDate="2020-11-16T20:29:31.233" Score="3" Body="&lt;p&gt;Quantum phase estimation does not have anything to do with &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. I feel that you are confusing phase estimation with the implementation of HHL as given in the paper &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.03719&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As for quantum phase estimation, it works only on unitary matrices. Given a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and and eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with some eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i\theta}$&lt;/span&gt; (which we do not know), quantum phase estimation allows one to estimate &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. To do this we assume that we have some way of preparing the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (maybe we are given the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. The circuit for phase estimation then looks like the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/htdTW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/htdTW.png&quot; alt=&quot;Circut for quantum phase estimation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U^{j}$&lt;/span&gt; denotes that the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has been applied &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; times consecutively and &lt;span class=&quot;math-container&quot;&gt;$QFT$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$2^n\theta$&lt;/span&gt; from where we can obtain the value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;Notice that except for a method to prepare the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and the controlled version of the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you do not need anything else explicitly.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Image Credits: Qiskit&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-11-16T20:29:31.233" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14685" PostTypeId="2" ParentId="14664" CreationDate="2020-11-17T00:35:36.880" Score="1" Body="&lt;p&gt;In fact, I figured out by myself. When I was reading &lt;a href=&quot;https://www.sciencedirect.com/topics/mathematics/density-matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;this website&lt;/a&gt;, it posts a density matrix that I want(that is a long website, to find the corresponding part, just search the keyword 'identity').&lt;/p&gt;&#xA;&lt;p&gt;Here comes the method. To produce a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; dimensional density matrix, you need n qubits as ancilla and n qubits as the target. In the case of &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt;, implement the &lt;span class=&quot;math-container&quot;&gt;$\hat H$&lt;/span&gt; on the ancilla, then use a &lt;span class=&quot;math-container&quot;&gt;$cx$&lt;/span&gt; gate with ancilla as the target.&lt;/p&gt;&#xA;&lt;p&gt;The density matrix of the whole system is &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}=(\frac{|00\rangle+|11\rangle}{\sqrt2})(\frac{\langle 00|+ \langle 11|}{\sqrt2})$&lt;/span&gt;, and the density matrix of the target(the reduced density matrix) is &lt;span class=&quot;math-container&quot;&gt;$\rho_A=Tr_B(\rho_{AB})=\frac{1}{2}(|0\rangle\langle0|+|1\rangle\langle1|)=\frac{I_A}{2}$&lt;/span&gt;, which satisfies my requirement.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="1859" LastEditDate="2020-11-21T17:07:09.713" LastActivityDate="2020-11-21T17:07:09.713" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14687" PostTypeId="1" CreationDate="2020-11-17T07:13:36.700" Score="1" ViewCount="38" Body="&lt;p&gt;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(&lt;a href=&quot;https://quantum-computing.ibm.com/login&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/login&lt;/a&gt;) and after that the page would give no response no matter  which button I click. What is the problem?&lt;/p&gt;&#xA;" OwnerUserId="13842" LastEditorUserId="55" LastEditDate="2020-11-18T22:33:03.710" LastActivityDate="2020-11-18T22:33:03.710" Title="Can Not Login IBM Quantum Experience!" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-11-21T17:08:00.293" ContentLicense="CC BY-SA 4.0" />
  <row Id="14688" PostTypeId="1" AcceptedAnswerId="15244" CreationDate="2020-11-17T07:41:20.377" Score="0" ViewCount="67" Body="&lt;p&gt;Let's say I do something to a qubit, and I want to entangle it to a 2nd one, like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐     &#xA;q_0: ┤ ? ├──■──&#xA;     └───┘┌─┴─┐&#xA;q_1: ─────┤ X ├&#xA;          └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐      ░ ┌───┐ ░      &#xA;q_0: ┤ ? ├──■───░─┤???├─░───■──&#xA;     └───┘┌─┴─┐ ░ └───┘ ░ ┌─┴─┐&#xA;q_1: ─────┤ X ├─░──|0&amp;gt;──░─┤ X ├&#xA;          └───┘ ░       ░ └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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)?&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="7598" LastEditDate="2020-11-17T08:23:52.417" LastActivityDate="2020-12-23T11:09:53.760" Title="Is there a way to entangle to a dirty qubit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14689" PostTypeId="1" AcceptedAnswerId="14706" CreationDate="2020-11-17T08:09:52.177" Score="0" ViewCount="72" Body="&lt;p&gt;From what I understand, any circuit can be combined to make a gate, which has a square, unitary matrix form that acts on the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; row of the qubits state column vector. For example, the circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐     &#xA;q_0: ┤ H ├──■──&#xA;     ├───┤┌─┴─┐&#xA;q_1: ┤ H ├┤ X ├&#xA;     └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;has the matrix form &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;\tfrac{1}{2} &amp;amp; \tfrac{1}{2} &amp;amp; \tfrac{1}{2} &amp;amp; \tfrac{1}{2}  \\&#xA;\tfrac{1}{2} &amp;amp; -\tfrac{1}{2} &amp;amp; -\tfrac{1}{2} &amp;amp; \tfrac{1}{2}  \\&#xA;\tfrac{1}{2} &amp;amp; \tfrac{1}{2} &amp;amp; -\tfrac{1}{2} &amp;amp; -\tfrac{1}{2}  \\&#xA;\tfrac{1}{2} &amp;amp; -\tfrac{1}{2} &amp;amp; \tfrac{1}{2} &amp;amp; -\tfrac{1}{2}  \\&#xA;\end{bmatrix}$&lt;/span&gt;&#xA;which acts on the vector &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 \\ 0 \\ 0 \\ 0 \end{bmatrix}$&lt;/span&gt; of the initial &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. But when I try to &lt;code&gt;get_unitary()&lt;/code&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;&lt;p&gt;Edit: The circuit I'm trying to find the matrix form for is i.e. like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐          &#xA;q_0: ┤ H ├──■───────&#xA;     ├───┤┌─┴─┐     &#xA;q_1: ┤ H ├┤ X ├─|0&amp;gt;─&#xA;     └───┘└───┘     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="7598" LastEditDate="2020-11-17T11:20:28.067" LastActivityDate="2020-11-17T18:32:48.800" Title="What is the effect of the reset gate on the matrix form of a gate/circuit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14690" PostTypeId="2" ParentId="14689" CreationDate="2020-11-17T08:27:33.223" Score="0" Body="&lt;p&gt;You can use:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit,  execute, BasicAer, Aer&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.h(qreg_q[0])&#xA;circuit.h(qreg_q[1])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;print(circuit)&#xA;&#xA;backend = Aer.get_backend('unitary_simulator')&#xA;job = execute(circuit, backend)&#xA;result = job.result()&#xA;print(result.get_unitary(circuit, decimals=3))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and you will get the output&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐     &#xA;q_0: ┤ H ├──■──&#xA;     ├───┤┌─┴─┐&#xA;q_1: ┤ H ├┤ X ├&#xA;     └───┘└───┘&#xA;c: 2/══════════&#xA;               &#xA;[[ 0.5+0.0000000e+00j  0.5-6.1232340e-17j  0.5-6.1232340e-17j&#xA;   0.5-1.2246468e-16j]&#xA; [ 0.5+0.0000000e+00j -0.5+6.1232340e-17j -0.5+6.1232340e-17j&#xA;   0.5-1.2246468e-16j]&#xA; [ 0.5+0.0000000e+00j  0.5-6.1232340e-17j -0.5+6.1232340e-17j&#xA;  -0.5+1.2246468e-16j]&#xA; [ 0.5+0.0000000e+00j -0.5+6.1232340e-17j  0.5-6.1232340e-17j&#xA;  -0.5+1.2246468e-16j]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;But you can also use the &lt;code&gt;quantum_info&lt;/code&gt; option.. by running the following code using the above circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.quantum_info as qi&#xA;operator = qi.Operator(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output of &lt;code&gt;operator&lt;/code&gt; will be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Operator([[ 0.5+0.j,  0.5+0.j,  0.5+0.j,  0.5+0.j],&#xA;          [ 0.5+0.j, -0.5+0.j, -0.5+0.j,  0.5+0.j],&#xA;          [ 0.5+0.j,  0.5+0.j, -0.5+0.j, -0.5+0.j],&#xA;          [ 0.5+0.j, -0.5+0.j,  0.5+0.j, -0.5+0.j]],&#xA;         input_dims=(2, 2), output_dims=(2, 2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope this is what you are looking for.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;update:&lt;/strong&gt; The above description is of course without having the &lt;strong&gt;reset&lt;/strong&gt; operation being applied.  Resetting a qubit is not a unitary operation as &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle = |0\rangle$&lt;/span&gt;, hence it is not a reversible operation.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-17T18:18:20.000" LastActivityDate="2020-11-17T18:18:20.000" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14691" PostTypeId="1" AcceptedAnswerId="14693" CreationDate="2020-11-17T08:33:28.900" Score="2" ViewCount="47" Body="&lt;p&gt;I am working on a &lt;a href=&quot;https://arxiv.org/abs/1711.08500v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; about Continuous Variable QKD. (&lt;a href=&quot;https://arxiv.org/abs/1711.08500v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1711.08500v2&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;I read about direct and reverse reconciliation in this paper. I don't understand what exactly &lt;em&gt;Reconciliation&lt;/em&gt; is? Reconciliation algorithms, reconciliation protocols and so on.&lt;/p&gt;&#xA;&lt;p&gt;I am really confused. Can any one explain reconciliation to me?&lt;/p&gt;&#xA;" OwnerUserId="10371" LastEditorUserId="10371" LastEditDate="2020-11-19T06:55:30.667" LastActivityDate="2020-11-19T06:55:30.667" Title="What is meant with &quot;reconciliation&quot; in CV QKD?" Tags="&lt;information-theory&gt;&lt;continuous-variable&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14692" PostTypeId="2" ParentId="14687" CreationDate="2020-11-17T08:34:03.047" Score="0" Body="&lt;p&gt;There is no reason I an think of to why they would blocked you...&lt;/p&gt;&#xA;&lt;p&gt;I would suggest you post this issue to their support team through the &lt;a href=&quot;https://quantum-computing.ibm.com/support&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Slack channel&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It can be problematic sometime to get connected to IBM Quantum Experience... but these issues are fixed rather quickly.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-17T08:34:03.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14693" PostTypeId="2" ParentId="14691" CreationDate="2020-11-17T10:34:02.860" Score="4" Body="&lt;p&gt;I assume the paper you are reading is referring to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_key_distribution#Information_reconciliation_and_privacy_amplification&quot; rel=&quot;nofollow noreferrer&quot;&gt;information reconciliation.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In that sense, it is a form of (&lt;strong&gt;classical&lt;/strong&gt;) error-correction, and, broadly speaking, it works like this:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Alice and Bob run a QKD protocol together and both obtain a &lt;em&gt;raw key&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$k_{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k_{b}$&lt;/span&gt; of whatever length.&lt;/li&gt;&#xA;&lt;li&gt;In real world scenarios, &lt;span class=&quot;math-container&quot;&gt;$k_{a} \not = k_{b}$&lt;/span&gt; due to measurement errors, imperfect channels etc. Alice and Bob want the &lt;em&gt;exact&lt;/em&gt; same key, so they need to fix this.&lt;/li&gt;&#xA;&lt;li&gt;However, &lt;span class=&quot;math-container&quot;&gt;$k_{a} \simeq k_{b}$&lt;/span&gt;; we can write &lt;span class=&quot;math-container&quot;&gt;$k_{b} = k_{a} + \epsilon$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is the error/difference between Alice and Bob, and therefore &lt;span class=&quot;math-container&quot;&gt;$\epsilon \simeq \overrightarrow{0}$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is a bitstring with almost all entries equal to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; because there are not that many errors).&lt;/li&gt;&#xA;&lt;li&gt;Alice and Bob have (in advance) agreed to use a certain &lt;em&gt;error code&lt;/em&gt; to perform error correction. This error code is some linear function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; that calculates the &lt;em&gt;syndrome&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; of a key. Note that the error code may or may not be secret to Alice and Bob.&lt;/li&gt;&#xA;&lt;li&gt;It is &lt;strong&gt;hard&lt;/strong&gt; to reverse this function in general. &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is of considerably shorter length than &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. So, there are multiple &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; with the same &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Alice calculates &lt;span class=&quot;math-container&quot;&gt;$s_{a} = f(k_{a})$&lt;/span&gt; and publicly communicates &lt;span class=&quot;math-container&quot;&gt;$s_{a}$&lt;/span&gt;. Any Eve cannot do anything with this because the function is in general hard to reverse.&lt;/li&gt;&#xA;&lt;li&gt;Bob receives &lt;span class=&quot;math-container&quot;&gt;$s_{a}$&lt;/span&gt; and calculates &lt;span class=&quot;math-container&quot;&gt;$s_{b}$&lt;/span&gt;. The function is linear, so &lt;span class=&quot;math-container&quot;&gt;$s_{b} = f(k_{b}) = f(k_{a} + \epsilon) = f(k_{a}) + f(\epsilon) = s_{a} + s_{\epsilon}$&lt;/span&gt;. Therefore, the 'error syndrome' &lt;span class=&quot;math-container&quot;&gt;$s_{\epsilon} = s_{a} - s_{b}$&lt;/span&gt; encodes only information about &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Only Bob can calculate &lt;span class=&quot;math-container&quot;&gt;$s_{\epsilon}$&lt;/span&gt;. Because the code was designed properly (and for this exact function), and because &lt;span class=&quot;math-container&quot;&gt;$\epsilon \simeq \overrightarrow{0}$&lt;/span&gt;, Bob can &lt;em&gt;decode&lt;/em&gt; the error syndrome to estimate &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\hat{\epsilon} = f^{-1}(s_{\epsilon})$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Finally, Bob calculates &lt;span class=&quot;math-container&quot;&gt;$\hat{k_{a}} = k_{b} - \hat{\epsilon}$&lt;/span&gt;. If the code is any good,&#xA;&lt;span class=&quot;math-container&quot;&gt;$\hat{k_{a}} - k_{a} \rightarrow 0$&lt;/span&gt;, i.e. Alices key and Bobs corrected key are very close/almost always the same.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There are &lt;strong&gt;a lot&lt;/strong&gt; 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 &lt;a href=&quot;https://arxiv.org/abs/1007.1616&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the above is error-correction for &lt;em&gt;general&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-11-17T11:39:22.423" LastActivityDate="2020-11-17T11:39:22.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14694" PostTypeId="2" ParentId="14597" CreationDate="2020-11-17T12:14:20.287" Score="0" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.quantum_info.operators import Operator&#xA;def swappedOp(obj,qr0):&#xA;    qr1=QuantumRegister(1)&#xA;    circ=QuantumCircuit(qr0,qr1)&#xA;    circ.swap(qr0[qr0.__len__()-1],qr1)&#xA;    IN=[qr0[i] for i in range(qr0.__len__())]+[qr1[0]]&#xA;    circ.append(obj,IN)&#xA;    circ.swap(qr0[qr0.__len__()-1],qr1)&#xA;    return Operator(circ)&#xA;&#xA;qr0=QuantumRegister(2)&#xA;qr1=QuantumRegister(2)&#xA;circ=QuantumCircuit(qr0,qr1)&#xA;from qiskit.quantum_info import random_unitary&#xA;numQubits=3&#xA;obj=random_unitary(2**numQubits)&#xA;newObj=swappedOp(obj,qr0)&#xA;circ.append(newObj,[qr0[i] for i in range(2)]+[qr1[0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case, since I returned an operator, I can use a one-qubit quantum register together with the size-varying quantum register &lt;code&gt;qr0&lt;/code&gt; to generate an Operator object and this technique can be also useful if I returned &lt;code&gt;circ.to_instruction()&lt;/code&gt; or &lt;code&gt;circ.to_gate()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So at least in my case, the function to convert a qubit to a single-qubit quantum register is not meaningful.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-17T12:14:20.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14695" PostTypeId="1" AcceptedAnswerId="14697" CreationDate="2020-11-17T12:48:46.570" Score="0" ViewCount="104" Body="&lt;p&gt;I am reading the following paper: &lt;a href=&quot;http://DOI:%2010.1103/PhysRevA.72.052323&quot; rel=&quot;nofollow noreferrer&quot;&gt;Optimal two-qubit quantum circuits using exchange interactions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I have a problem with the calculation of the unitary evolution operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (Maybe it is stupid):&lt;/p&gt;&#xA;&lt;p&gt;I have figure out the matrix of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H = J \begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;       0 &amp;amp; -1 &amp;amp; 2  &amp;amp; 0\\&#xA;       0 &amp;amp; 2  &amp;amp; -1 &amp;amp; 0\\&#xA;       0 &amp;amp; 0  &amp;amp; 0  &amp;amp; 1\\&#xA;\end{bmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I cannot write the matrix of Operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and get the result of &lt;span class=&quot;math-container&quot;&gt;$(SWAP)^α$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Could you please help me to calculate it? I really want to know how to get the matrix of U.&lt;/p&gt;&#xA;&lt;p&gt;Thank you so much.&lt;/p&gt;&#xA;&lt;p&gt;The figure is shown as below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Fgjte.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fgjte.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zD0SP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zD0SP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user13341" LastEditorUserId="8141" LastEditDate="2020-11-17T13:18:35.210" LastActivityDate="2020-11-17T13:28:05.753" Title="Quick question about Two-qubit SWAP gate from the Exchange interaction" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;matrix-representation&gt;&lt;pauli-gates&gt;&lt;entanglement-swapping&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14696" PostTypeId="1" CreationDate="2020-11-17T13:12:03.170" Score="1" ViewCount="89" Body="&lt;p&gt;There are two popular initial states, in general, for VQEs: the unitary coupled cluster ansatz and the hardware efficient ansatz (for details, see here: &lt;a href=&quot;https://quantaggle.com/algorithms/ansatz/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantaggle.com/algorithms/ansatz/&lt;/a&gt;). Intuitively, what are the main differences between these two and when do we prefer one to the other?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-11-18T22:35:48.333" LastActivityDate="2020-11-19T03:59:38.053" Title="What are the main differences between the &quot;unitary coupled cluster&quot; and the &quot;hardware efficient&quot; ansatzes in VQE?" Tags="&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14697" PostTypeId="2" ParentId="14695" CreationDate="2020-11-17T13:24:18.510" Score="1" Body="&lt;p&gt;You need to calculate &lt;span class=&quot;math-container&quot;&gt;$U=e^{-iHt}$&lt;/span&gt;. The trick to doing this is working out the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;: there's &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; with eigenvalues J, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi^{\pm}\rangle=(|01\rangle\pm|10\rangle)/\sqrt{2}&#xA;$$&lt;/span&gt;&#xA;with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$(-1\pm 2)J$&lt;/span&gt;. In particular, notice that this means 3 of the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;. Hence, there are two eigenspaces of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle\langle\Psi^-|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I-|\Psi^-\rangle\langle\Psi^-|$&lt;/span&gt;. Hence, we can find&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=e^{-iJt}(I-|\Psi^-\rangle\langle\Psi^-|)+e^{3iJt}|\Psi^-\rangle\langle\Psi^-|.&#xA;$$&lt;/span&gt;&#xA;If you remove an irrelevant global phase, this is just the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=(I-|\Psi^-\rangle\langle\Psi^-|)+e^{4iJt}|\Psi^-\rangle\langle\Psi^-|.&#xA;$$&lt;/span&gt;&#xA;This is exactly what you were after, with &lt;span class=&quot;math-container&quot;&gt;$4Jt=\pi\alpha$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="8141" LastEditDate="2020-11-17T13:28:05.753" LastActivityDate="2020-11-17T13:28:05.753" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14698" PostTypeId="1" AcceptedAnswerId="14699" CreationDate="2020-11-17T13:31:01.773" Score="3" ViewCount="65" Body="&lt;p&gt;I would like to implement &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; gate in Q# and I would like the best way to do it, is it correct to say that &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; is equivalent to &lt;code&gt;R1( -Pi()/2 , q)&lt;/code&gt; ? Is it also correct to say that &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; is equivalent to &lt;code&gt;Rz( -Pi()/2 , q)&lt;/code&gt; but with a global phase ?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="1859" LastEditDate="2020-11-18T06:16:28.587" LastActivityDate="2020-11-18T06:16:28.587" Title="$S^{\dagger}$ gate in Q#" Tags="&lt;q#&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14699" PostTypeId="2" ParentId="14698" CreationDate="2020-11-17T13:56:13.820" Score="1" Body="&lt;p&gt;It is correct. Since you have &lt;span class=&quot;math-container&quot;&gt;$R_1(\theta) = \begin{bmatrix}1 &amp;amp; 0\\ 0 &amp;amp; e^{i\theta}\end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta) = \begin{bmatrix}e^{-i\theta/2} &amp;amp; 0\\ 0 &amp;amp; e^{i\theta/2}\end{bmatrix}$&lt;/span&gt; just using the value of &lt;span class=&quot;math-container&quot;&gt;$\theta = -\pi/2$&lt;/span&gt; gives you &lt;span class=&quot;math-container&quot;&gt;$R_1(-\pi/2) = \begin{bmatrix}1 &amp;amp; 0\\ 0 &amp;amp; -i\end{bmatrix} = S^{\dagger}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z(-\pi/2) = e^{i\pi/4}\begin{bmatrix}1 &amp;amp; 0\\ 0 &amp;amp; -i\end{bmatrix}$&lt;/span&gt; which works exactly the same as &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; but with a global phase of &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi/4}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-11-17T13:56:13.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14700" PostTypeId="2" ParentId="14644" CreationDate="2020-11-17T14:29:46.653" Score="2" Body="&lt;p&gt;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 &amp;quot;Quantum Error Correction Via Codes Over GF(4)&amp;quot; by Calderbank, Rains, Shor, and Sloane for the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_4$&lt;/span&gt; formulation or &amp;quot;Quantum error-correcting codes and their geometries&amp;quot; by Ball, Centelles, and Huber for a &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_2$&lt;/span&gt; formulation.&lt;/p&gt;&#xA;&lt;p&gt;I assume that you know that any element of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli group &lt;span class=&quot;math-container&quot;&gt;$P_n$&lt;/span&gt; can be written uniquely as &lt;span class=&quot;math-container&quot;&gt;$W(z,x,t) = i^t Z(z)X(x)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t\in\mathbb{Z}_4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$z,x\in\mathbb{F}_2^{n}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; are defined as usual as &lt;span class=&quot;math-container&quot;&gt;$Z(z)|u\rangle = (-1)^{z\cdot u}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X(x)|u\rangle = |u+x\rangle$&lt;/span&gt;. Note that the centre of &lt;span class=&quot;math-container&quot;&gt;$P_n$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\langle i \mathbb{I}\rangle$&lt;/span&gt;. We get a projection:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\pi : \; P_n \rightarrow \mathbb{F}_2^{2n}, \quad W(z,x,t) \mapsto (z,x).&#xA;$$&lt;/span&gt;&#xA;Another way of seeing this is that &lt;span class=&quot;math-container&quot;&gt;$P_n$&lt;/span&gt; is a group of order &lt;span class=&quot;math-container&quot;&gt;$2^{2n+2}$&lt;/span&gt; which is &amp;quot;almost&amp;quot; extraspecial, i.e. the quotient &lt;span class=&quot;math-container&quot;&gt;$P_n/Z(P_n)$&lt;/span&gt; is a (discrete symplectic) vector space. It is symplectic since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W(v,t)W(u,s) = (-1)^{[v,u]}W(u,s)W(v,s)&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$[v,u]:= v_z\cdot u_x - v_x \cdot u_z$&lt;/span&gt; the standard symplectic product on &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_2^{2n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; is a homomorphism, subgroups &lt;span class=&quot;math-container&quot;&gt;$S\subset P_n$&lt;/span&gt; project to linear subspaces &lt;span class=&quot;math-container&quot;&gt;$\bar S:=\pi(S)\subset\mathbb F_2^{2n}$&lt;/span&gt;. By the above commutation relation, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is Abelian if and only if &lt;span class=&quot;math-container&quot;&gt;$\bar S$&lt;/span&gt; is &lt;em&gt;isotropic&lt;/em&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$S\subset S^\perp$&lt;/span&gt; (&lt;em&gt;self-orthogonal&lt;/em&gt; in coding language).&#xA;Now it should be clear that any &lt;span class=&quot;math-container&quot;&gt;$[[n,k]]$&lt;/span&gt; stabiliser code &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; given by a stabiliser group &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; projects to an isotropic subspace &lt;span class=&quot;math-container&quot;&gt;$\bar S$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; has rank &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt;, the dimension of &lt;span class=&quot;math-container&quot;&gt;$\bar S$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt;, too.&lt;/p&gt;&#xA;&lt;p&gt;A code word &lt;span class=&quot;math-container&quot;&gt;$s\in\bar S$&lt;/span&gt; is of the form &lt;span class=&quot;math-container&quot;&gt;$s=(z_1,\dots,z_n,x_1,\dots,x_n)$&lt;/span&gt;. Its &lt;em&gt;weight&lt;/em&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$\mathrm{wt}(s)=|\{(z_i,x_i)\neq 0\}|$&lt;/span&gt;.&#xA;The automorphism group of &lt;span class=&quot;math-container&quot;&gt;$\bar S$&lt;/span&gt; is then defined within the symplectic weight-preserving transformations on &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_2^{2n}$&lt;/span&gt;. The latter are exactly the pair-wise coordinate permutations &lt;span class=&quot;math-container&quot;&gt;$S_n$&lt;/span&gt; times the &amp;quot;local&amp;quot; symplectic group &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Sp}_2(\mathbb F_2)$&lt;/span&gt; acting on each symplectic pair independently, i.e. it has order &lt;span class=&quot;math-container&quot;&gt;$6^n n!$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now for the automorphism group of &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;.&#xA;Any symplectic map on &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_2^{2n}$&lt;/span&gt; is induced from a Clifford unitary and any two Cliffords induce the same map if and only if they differ by a Pauli operator.&#xA;This means that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Aut}(\bar S)$&lt;/span&gt; &lt;em&gt;is&lt;/em&gt; basically &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Aut}(Q)$&lt;/span&gt; up to multiplication with Pauli operators.&#xA;More precisely, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Aut}(\bar S) = \mathrm{Aut}(Q)/S$&lt;/span&gt;.&#xA;The only difference between the two comes from the projection &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, let me remark that by mapping &lt;span class=&quot;math-container&quot;&gt;$(1,0) \mapsto 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(0,2)\mapsto \omega$&lt;/span&gt; we get an additive mapping between &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_2^{2n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_4^n$&lt;/span&gt; which maps the isotropic linear codes in the above sense to self-orthogonal additive codes over &lt;span class=&quot;math-container&quot;&gt;$\mathbb F_4$&lt;/span&gt;. In this way, stabiliser codes fit better into the framework of coding theory, but this does not change the structure.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2020-11-17T14:29:46.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14701" PostTypeId="2" ParentId="14698" CreationDate="2020-11-17T16:09:57.033" Score="4" Body="&lt;p&gt;Since the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.intrinsic.s&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;S&lt;/code&gt; operation&lt;/a&gt; supports the &lt;a href=&quot;https://docs.microsoft.com/quantum/user-guide/using-qsharp/operations-functions#adjoint-functor&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Adjoint&lt;/code&gt; functor&lt;/a&gt;, the Q# call &lt;code&gt;Adjoint S(target)&lt;/code&gt; is the easiest way to call the &lt;span class=&quot;math-container&quot;&gt;$S^{\dagger}$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;To verify that this is the same as the suggestion made above by Tharrmashastha V, you can use the &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.diagnostics.assertoperationsequalreferenced&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;AssertOperationsEqualReferenced&lt;/code&gt; operation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AssertOperationsEqualReferenced(1,&#xA;    ApplyToEachCA(Adjoint S, _),&#xA;    ApplyToEachCA(Rz(-PI() / 2.0, _), _)&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2020-11-17T16:09:57.033" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14702" PostTypeId="1" CreationDate="2020-11-17T16:54:42.150" Score="7" ViewCount="298" Body="&lt;p&gt;I am trying to understand Shor's algorithm. I am not quite sure why the initialization, indicated as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HYibT.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HYibT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12480" LastEditorUserId="55" LastEditDate="2020-11-18T22:36:29.790" LastActivityDate="2020-11-18T22:36:29.790" Title="Shor's algorithm: initialization of second register" Tags="&lt;circuit-construction&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14703" PostTypeId="2" ParentId="14696" CreationDate="2020-11-17T16:59:56.767" Score="1" Body="&lt;p&gt;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: &lt;a href=&quot;https://arxiv.org/ftp/quant-ph/papers/0604/0604193.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulated Quantum Computation of Molecular Energies&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/1001.3855&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulation of Electronic Structure Hamiltonians Using Quantum Computers&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Variational_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;variational principle.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/e9Wki.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e9Wki.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that calculate &lt;span class=&quot;math-container&quot;&gt;$\langle \psi(\theta) | H| \psi (\theta) \rangle$&lt;/span&gt; you have to use many quantum circuits as &lt;span class=&quot;math-container&quot;&gt;$H = \sum_{i}^{poly(N)} \alpha_i P_i$&lt;/span&gt; and so  &lt;span class=&quot;math-container&quot;&gt;$\langle H\rangle_{\psi(\theta)} = \sum_{i}^{poly(N)} \alpha_i \langle P_i \rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to Pauli strings is only in &lt;span class=&quot;math-container&quot;&gt;$O(poly(N))$&lt;/span&gt; for the certain problems (like the molecular electronic Hamiltonian). But for a general Hamiltonian, you would need &lt;span class=&quot;math-container&quot;&gt;$4^N$&lt;/span&gt; terms.&lt;/p&gt;&#xA;&lt;p&gt;In any case, the question now is, what is the implementation of &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt;? The space of unitary matrices is huge (there are uncountable many unitary matrices)... but motivated by classical methods, the &lt;a href=&quot;https://arxiv.org/abs/1304.3061&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper of VQE&lt;/a&gt; proposed to implement &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; through the use of UCCSD, which is chemically motivated. Furthermore. this can be implement efficiently on a quantum computer. This is great, &lt;strong&gt;but&lt;/strong&gt; it is still &lt;strong&gt;way too expensive&lt;/strong&gt; for current quantum hardware! To see why, let's look at the UCCSD circuit for the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$LiH$&lt;/span&gt; problem&lt;/a&gt; that being used as an example in the Qiskit tutorial.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ySqd2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ySqd2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://www1.phys.vt.edu/%7Eefbarnes/s41534-019-0240-1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/2002.00035&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/1905.10876&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and many more) to find ways to design quantum circuit( &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; ) 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 &lt;em&gt;usually&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-19T03:59:38.053" LastActivityDate="2020-11-19T03:59:38.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14704" PostTypeId="1" AcceptedAnswerId="14709" CreationDate="2020-11-17T17:06:58.183" Score="7" ViewCount="155" Body="&lt;p&gt;If I have two projectors &lt;span class=&quot;math-container&quot;&gt;$\pi_1, \pi_2$&lt;/span&gt; such that for some &lt;span class=&quot;math-container&quot;&gt;$|{\phi}\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle {\phi}| \pi_1 |{\phi}\rangle \geq e$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle {\phi}| \pi_2 | {\phi}\rangle \geq e$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What can I conclude about the following quantity?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it also &lt;span class=&quot;math-container&quot;&gt;$\geq e$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="11830" LastEditorUserId="55" LastEditDate="2020-11-18T22:37:30.277" LastActivityDate="2020-11-19T17:02:26.490" Title="What can I conclude about $\langle \phi|\pi_1\pi_2|\phi\rangle$ if $\langle \phi|\pi_i|\phi\rangle\ge e$?" Tags="&lt;measurement&gt;&lt;projection-operator&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14705" PostTypeId="2" ParentId="14704" CreationDate="2020-11-17T17:39:56.547" Score="3" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\pi_1 = \begin{pmatrix}&#xA;1&amp;amp;0\\&#xA;0&amp;amp;0\\&#xA;\end{pmatrix}\\&#xA;\pi_2 = \begin{pmatrix}&#xA;0&amp;amp;0\\&#xA;0&amp;amp;1\\&#xA;\end{pmatrix}\\&#xA;\rho = \frac{1}{\sqrt{2}} \begin{pmatrix}&#xA;1\\&#xA;1\\&#xA;\end{pmatrix}\\&#xA;e = \frac{1}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="434" LastActivityDate="2020-11-17T17:39:56.547" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14706" PostTypeId="2" ParentId="14689" CreationDate="2020-11-17T18:32:48.800" Score="1" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-17T18:32:48.800" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14707" PostTypeId="1" AcceptedAnswerId="14708" CreationDate="2020-11-17T19:08:15.823" Score="2" ViewCount="59" Body="&lt;p&gt;For any completely positive trace nonincreasing map &lt;span class=&quot;math-container&quot;&gt;$N_{A\rightarrow B}$&lt;/span&gt;, the adjoint map is the unique completely positive linear map &lt;span class=&quot;math-container&quot;&gt;$N^\dagger_{B\rightarrow A}$&lt;/span&gt; that satisfies&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle N^\dagger(\sigma), \rho\rangle = \langle \sigma, N(\rho)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all linear operators &lt;span class=&quot;math-container&quot;&gt;$\sigma \in \mathcal{L}(\mathcal{H}_B)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathcal{L}(\mathcal{H}_A)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$V_{A\rightarrow BE}$&lt;/span&gt; be any isometry such that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_E(V\rho V^\dagger) = N(\rho)$&lt;/span&gt;. This is the Stinespring representation of any completely positive map. Since &lt;span class=&quot;math-container&quot;&gt;$N^\dagger$&lt;/span&gt; is also a completely positive map, it also has a Stinespring representation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;: Given &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, can one write down the Stinespring representation of &lt;span class=&quot;math-container&quot;&gt;$N^\dagger$&lt;/span&gt;? Naively taking the transpose conjugate of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to write down something like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_E(V^\dagger\sigma V) = N^\dagger(\sigma)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;doesn't even make sense since &lt;span class=&quot;math-container&quot;&gt;$V^\dagger_{BE\rightarrow A}$&lt;/span&gt; whereas the isometry we are after should go from &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$AE'$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-11-18T22:39:13.370" LastActivityDate="2020-11-18T22:39:13.370" Title="What is the Stinespring representation of the adjoint of a channel?" Tags="&lt;information-theory&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14708" PostTypeId="2" ParentId="14707" CreationDate="2020-11-17T21:08:58.437" Score="3" Body="&lt;p&gt;An adjoint to partial trace is just tensoring by &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_2^\dagger(\sigma) = \sigma \otimes I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So in this case we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;N^\dagger(\sigma) = V^\dagger (\sigma \otimes I_E)V.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It still can be written as &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_{E'}(U\sigma U^\dagger)$&lt;/span&gt; for an isometry &lt;span class=&quot;math-container&quot;&gt;$U:B \rightarrow AE'$&lt;/span&gt;, but I don't think there is a simple expression for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-11-17T21:52:58.907" LastActivityDate="2020-11-17T21:52:58.907" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14709" PostTypeId="2" ParentId="14704" CreationDate="2020-11-17T23:00:59.813" Score="5" Body="&lt;p&gt;Based on those relations there's nothing more that you can conclude.  Consider the two extremes.&lt;/p&gt;&#xA;&lt;p&gt;At one extreme &lt;span class=&quot;math-container&quot;&gt;$\pi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi_2$&lt;/span&gt; project onto the same subspace, in which case:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At the other extreme &lt;span class=&quot;math-container&quot;&gt;$\pi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi_2$&lt;/span&gt; project onto perpendicular subspaces, in which case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle = 0, \;\; \pi_1 \pi_2 = 0.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Based on the stated relationships, the projectors could exist anywhere between and including these two extremes.  If &lt;span class=&quot;math-container&quot;&gt;$e&amp;gt;0$&lt;/span&gt;, you could at least say that &lt;span class=&quot;math-container&quot;&gt;$\vert \phi \rangle$&lt;/span&gt; is not perpendicular to either the &lt;span class=&quot;math-container&quot;&gt;$\pi_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\pi_2$&lt;/span&gt; subspaces, but that alone still doesn't tell you any more about the value of &lt;span class=&quot;math-container&quot;&gt;$\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14721/8623&quot;&gt;DaftWullie's answer&lt;/a&gt; makes an important point that I missed.  If &lt;span class=&quot;math-container&quot;&gt;$e&amp;gt;\frac{1}{\sqrt{2}}$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$\vert \phi \rangle$&lt;/span&gt; normalized), &lt;span class=&quot;math-container&quot;&gt;$\pi_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi_2$&lt;/span&gt; cannot be orthogonal projectors, in which case &lt;span class=&quot;math-container&quot;&gt;$e$&lt;/span&gt; imposes the lower bound &lt;span class=&quot;math-container&quot;&gt;$2e^2-1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-11-19T17:02:26.490" LastActivityDate="2020-11-19T17:02:26.490" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14710" PostTypeId="2" ParentId="14702" CreationDate="2020-11-18T01:29:23.340" Score="3" Body="&lt;p&gt;The initial state of Shor's algorithm is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt N}\displaystyle\sum_{a=0}^{N-1}|a\rangle$&lt;/span&gt;, and it is OK to move this state to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt N}\displaystyle\sum_{a=0}^{N-1}|a,x\rangle$&lt;/span&gt; as our initial state since the modular exponentiation takes &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as one of its input.&lt;/p&gt;&#xA;&lt;p&gt;Here shows the model of a &lt;span class=&quot;math-container&quot;&gt;$\text{controlled}-U$&lt;/span&gt; gate, and a circuit for factoring (figure comes from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0205095&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nOJ8A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nOJ8A.png&quot; alt=&quot;C-U&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/naJm9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/naJm9.png&quot; alt=&quot;shor&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So I think the &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; denoted here directs to &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, although I do not know why they are doing so.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="9006" LastEditDate="2020-11-18T07:54:38.670" LastActivityDate="2020-11-18T07:54:38.670" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14711" PostTypeId="2" ParentId="14702" CreationDate="2020-11-18T09:39:43.960" Score="4" Body="&lt;p&gt;For preference, in a phase estimation algorithm, you would set the state of the second register equal to an eigenstate of the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, the plan being to find its eigenvalue, which depends on the period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. In fact, any of the eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|u_s\rangle$&lt;/span&gt; would do for values &lt;span class=&quot;math-container&quot;&gt;$s=0,1,\ldots r-1$&lt;/span&gt; as these have eigenvalues related to &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, the eigenstates themselves depend on &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, so without knowing &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, you cannot make the eigenstate, and so you cannot find &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. That's a problem.&lt;/p&gt;&#xA;&lt;p&gt;The way to circumvent the problem is that you &lt;em&gt;can&lt;/em&gt; prepare the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, and it turns out that this state is an equal superposition of all the vectors &lt;span class=&quot;math-container&quot;&gt;$|u_s\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt; eigenvalues at random (with equal probability). (You then use the continued fractions algorithm to figure out which &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; it was.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-18T09:39:43.960" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14713" PostTypeId="1" CreationDate="2020-11-18T16:45:04.680" Score="3" ViewCount="51" Body="&lt;p&gt;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 &amp;quot;orthogonal,&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13618" LastActivityDate="2020-11-19T14:36:21.443" Title="What is the intuitive reason for why Abelian HSPs are much easier than Non-Abelian HSPs?" Tags="&lt;hidden-subgroup-problem&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14714" PostTypeId="2" ParentId="14713" CreationDate="2020-11-18T17:55:47.100" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The notes on Quantum Algorithms by Andrew Childs (&lt;a href=&quot;https://www.cs.umd.edu/%7Eamchilds/qa/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cs.umd.edu/~amchilds/qa/&lt;/a&gt;) seem to be the most detailed on this subject if you are interested in reading more.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2020-11-19T14:36:21.443" LastActivityDate="2020-11-19T14:36:21.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14715" PostTypeId="1" AcceptedAnswerId="14717" CreationDate="2020-11-19T00:41:49.247" Score="3" ViewCount="480" Body="&lt;p&gt;I have a silly question as I am an absolute beginner! So as described in Qiskit:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;It performs the NOT operation (equivalent to applying an X gate) on the second qubit only when the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and otherwise leaves it unchanged.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;in the piece of the related program we have :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Let's do an CX-gate on |00&amp;gt;&#xA;q = QuantumRegister(2)&#xA;qc = QuantumCircuit(q)&#xA;qc.cx(q[0],q[1])&#xA;qc.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In my mind I need 2 inputs for a CX gate A &amp;amp; B as (&lt;code&gt;q[0]&lt;/code&gt; and &lt;code&gt;q[1]&lt;/code&gt;) so that it can control B and NOT A, and also a third qubit as an output. But here we have &lt;code&gt;q[0]&lt;/code&gt; as an input and &lt;code&gt;q[1]&lt;/code&gt; as an output apparently. Can anybody help me please to understand the logic?&lt;/p&gt;&#xA;" OwnerUserId="13698" LastEditorUserId="55" LastEditDate="2020-11-22T16:53:49.127" LastActivityDate="2020-11-22T16:53:49.127" Title="How does the CX gate work?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14716" PostTypeId="2" ParentId="13943" CreationDate="2020-11-19T00:42:48.923" Score="0" Body="&lt;p&gt;I've come across a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0511117&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; (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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The quantum query and circuit models of complexity are &amp;quot;perfectly equivalent&amp;quot;&lt;/strong&gt;, meaning that they can simulate one another with:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Zero error&lt;/li&gt;&#xA;&lt;li&gt;A constant time overhead&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Regarding the second point, this is my interpretation of &amp;quot;perfectly equivalent&amp;quot; – put another way, &lt;em&gt;&lt;strong&gt;my interpretation may not be correct&lt;/strong&gt;&lt;/em&gt; and it may be that they can simulate one another with zero error and a &lt;em&gt;polynomial time&lt;/em&gt;, rather than constant time, overhead.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2020-11-19T07:17:29.453" LastActivityDate="2020-11-19T07:17:29.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14717" PostTypeId="2" ParentId="14715" CreationDate="2020-11-19T01:26:18.823" Score="4" Body="&lt;p&gt;When you apply the CNOT gate on the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; what you will get out is the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, as the CNOT gate logically do the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$CNOT|00\rangle = |00\rangle, \ \ \ CNOT|01\rangle = |01\rangle, \ \ \  CNOT|10\rangle = |11\rangle, \ \ \ CNOT|11\rangle = |10\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\bigg\{|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} , |1\rangle\ = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \bigg\}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then you apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\label{CNOT matrix}&#xA;     CNOT = \begin{pmatrix} &#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\  &#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so that is what you implement when you run the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CWF4E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CWF4E.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;as always, all state in quantum computer starts at the state &lt;span class=&quot;math-container&quot;&gt;$|00\cdots 0\rangle$&lt;/span&gt;. Hence, this means that for our  circuit above &lt;span class=&quot;math-container&quot;&gt;$q_0 = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1 = |0\rangle$&lt;/span&gt;, so the starting state is &lt;span class=&quot;math-container&quot;&gt;$|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} $&lt;/span&gt;. Notice that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT|00\rangle = \begin{pmatrix} &#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\  &#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\0 \\0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\0 \\0 \end{pmatrix} = |00\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The input is the state of &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and the output is also &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that: &lt;code&gt;circuit.cx(qreg_q[0], qreg_q[1])&lt;/code&gt; indicates that the controlled qubit is in the quantum register &lt;code&gt;qreg_q[0]&lt;/code&gt; and it will act on the target qubit which is in the quantum register &lt;code&gt;qreg_q[1]&lt;/code&gt;. And this can be changed. That is, you can make the qubit in the quantum register &lt;code&gt;qreg_q[1]&lt;/code&gt; as your controlled qubit and the qubit in the quantum register &lt;code&gt;qreg_q[0]&lt;/code&gt; as your target qubit by simply switch the 5th line of the code to: &lt;code&gt;circuit.cx(qreg_q[1], qreg_q[0])&lt;/code&gt;.  The circuit will look like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XUjJb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XUjJb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you instead input a different state, says &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; then the result would be different, it would be &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; in this case. That is, if you execute the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3UnjC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3UnjC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate here is to put the qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; from the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. That is, we are making the input state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. The output state now would be &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; as the controlled qubit is now in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; so it will act on the target qubit by applying the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (NOT) gate. If you run this on the simulator, you will see something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j3U6z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j3U6z.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the code to generate the following circuit and plot in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, BasicAer, execute&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.x(qreg_q[0])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;circuit.measure(qreg_q[1], creg_c[1])&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, scale = 1)&#xA;backend = BasicAer.get_backend('statevector_simulator')&#xA;job = execute(circuit, backend, shots = 1)&#xA;plot_histogram(job.result().get_counts(), color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And you can work this out explicitly in matrix algebra as well:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT|10\rangle = \begin{pmatrix} &#xA;    1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\  &#xA;    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;    0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;    \end{pmatrix} \begin{pmatrix} 0 \\ 0 \\1 \\0 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\0 \\1 \end{pmatrix} = |11\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="12667" LastEditDate="2020-11-19T05:32:55.620" LastActivityDate="2020-11-19T05:32:55.620" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14718" PostTypeId="1" AcceptedAnswerId="14722" CreationDate="2020-11-19T07:20:31.720" Score="1" ViewCount="60" Body="&lt;p&gt;I am trying to solve the first question on the qiskit test which is writing a code for a full adder.&lt;/p&gt;&#xA;&lt;p&gt;So based on my research if I have &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; &lt;code&gt;q[0]&lt;/code&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; &lt;code&gt;q[1]&lt;/code&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; in &lt;code&gt;q[2]&lt;/code&gt; as input and &lt;code&gt;Sum&lt;/code&gt; and &lt;code&gt;Cout&lt;/code&gt; as output, I should be able to produce the correct outputs by the following gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q[0] XOR1 q[1] ---&amp;gt; q[4]&#xA;&#xA;q[0] AND1 q[1] ---&amp;gt; q[3]&#xA;&#xA;q[2] XOR2 q[4] ---&amp;gt; q[5] (SUM)&#xA;&#xA;q[2] AND2 q[4] ---&amp;gt; q[6]&#xA;&#xA;q[3] OR q[6] ---&amp;gt; q[7] (COUT)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Writing the following program I get that my answer is producing wrong results :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit import IBMQ, Aer, execute&#xA;&#xA;##### build your quantum circuit here&#xA;&#xA;#Define registers and a quantum circuit&#xA;q = QuantumRegister(8) &#xA;c = ClassicalRegister(2)&#xA;qc = QuantumCircuit(q,c)&#xA;&#xA;# Preparing inputs&#xA;qc.x(q[0])  # Comment this line to make Qbit0 = |0&amp;gt;&#xA;qc.x(q[1])  # Comment this line to make Qbit1 = |0&amp;gt;&#xA;qc.x(q[2])  # Comment this line to make Qbit2 = |0&amp;gt; ( carry-in bit )&#xA;qc.barrier()&#xA;&#xA;# AND gate1 implementation&#xA;qc.ccx(q[0],q[1],q[3])&#xA;qc.barrier()&#xA;&#xA;# XOR gate1 implementation&#xA;qc.cx(q[0],q[4])&#xA;qc.cx(q[1],q[4])&#xA;qc.barrier()&#xA;&#xA;# XOR gate2 implementation&#xA;qc.cx(q[2],q[5])&#xA;qc.cx(q[4],q[5])&#xA;qc.barrier()&#xA;&#xA;# AND gate2 implementation&#xA;qc.ccx(q[2],q[4],q[6])&#xA;qc.barrier()&#xA;&#xA;#OR gate implementation&#xA;qc.cx(q[3],q[7])&#xA;qc.cx(q[6],q[7])&#xA;qc.ccx(q[3],q[6],q[7])&#xA;qc.barrier()&#xA;&#xA;# Measuring and put result to classical bit&#xA;# ( sum )&#xA;qc.measure(q[5],c[0])&#xA;# ( carry-out )&#xA;qc.measure(q[7],c[1])&#xA;&#xA;# execute the circuit by qasm_simulator&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;job = execute(qc, backend, shots=1000)&#xA;result = job.result()&#xA;count = result.get_counts()&#xA;print(count)&#xA;qc.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Grading tells me that my results are not matching, but I cannot figure out what is wrong with my code.&#xA;Thank you so much for help.&lt;/p&gt;&#xA;" OwnerUserId="13698" LastEditorUserId="55" LastEditDate="2020-11-22T16:53:42.250" LastActivityDate="2020-11-22T16:53:42.250" Title="How do I check what is wrong in my full-adder code?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14719" PostTypeId="1" AcceptedAnswerId="14760" CreationDate="2020-11-19T08:37:33.283" Score="1" ViewCount="260" Body="&lt;p&gt;I have successfully installed the Qiskit in Anaconda by using &lt;code&gt;pip install qiskit&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But I can't import Qiskit and get the following error.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    ---------------------------------------------------------------------------&#xA;OSError                                   Traceback (most recent call last)&#xA;&amp;lt;ipython-input-5-578b7f7e9727&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 import qiskit&#xA;&#xA;~\anaconda3\envs\quantum_computing\lib\site-packages\qiskit\__init__.py in &amp;lt;module&amp;gt;&#xA;     29 &#xA;     30 # The main qiskit operators&#xA;---&amp;gt; 31 from qiskit.circuit import ClassicalRegister&#xA;     32 from qiskit.circuit import QuantumRegister&#xA;     33 from qiskit.circuit import AncillaRegister&#xA;&#xA;~\anaconda3\envs\quantum_computing\lib\site-packages\qiskit\circuit\__init__.py in &amp;lt;module&amp;gt;&#xA;    212    random.random_circuit&#xA;    213 &amp;quot;&amp;quot;&amp;quot;&#xA;--&amp;gt; 214 from .quantumcircuit import QuantumCircuit&#xA;    215 from .classicalregister import ClassicalRegister, Clbit&#xA;    216 from .quantumregister import QuantumRegister, Qubit, AncillaRegister, AncillaQubit&#xA;&#xA;~\anaconda3\envs\quantum_computing\lib\site-packages\qiskit\circuit\quantumcircuit.py in &amp;lt;module&amp;gt;&#xA;     23 from collections import OrderedDict, defaultdict&#xA;     24 from typing import Union&#xA;---&amp;gt; 25 import numpy as np&#xA;     26 from qiskit.exceptions import QiskitError&#xA;     27 from qiskit.util import is_main_process&#xA;&#xA;~\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py in &amp;lt;module&amp;gt;&#xA;    138 &#xA;    139     # Allow distributors to run custom init code&#xA;--&amp;gt; 140     from . import _distributor_init&#xA;    141 &#xA;    142     from . import core&#xA;&#xA;~\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py in &amp;lt;module&amp;gt;&#xA;     24                 # NOTE: would it change behavior to load ALL&#xA;     25                 # DLLs at this path vs. the name restriction?&#xA;---&amp;gt; 26                 WinDLL(os.path.abspath(filename))&#xA;     27                 DLL_filenames.append(filename)&#xA;     28     if len(DLL_filenames) &amp;gt; 1:&#xA;&#xA;~\anaconda3\envs\quantum_computing\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)&#xA;    379 &#xA;    380         if handle is None:&#xA;--&amp;gt; 381             self._handle = _dlopen(self._name, mode)&#xA;    382         else:&#xA;    383             self._handle = handle&#xA;&#xA;OSError: [WinError 193] %1 is not a valid Win32 application&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So what should I do to solve this problem?&lt;/p&gt;&#xA;" OwnerUserId="13859" LastEditorUserId="55" LastEditDate="2020-11-22T16:53:36.687" LastActivityDate="2020-11-22T16:53:36.687" Title="Import Qiskit fails" Tags="&lt;qiskit&gt;&lt;programming&gt;" AnswerCount="4" CommentCount="2" ClosedDate="2020-11-21T17:07:33.737" ContentLicense="CC BY-SA 4.0" />
  <row Id="14720" PostTypeId="2" ParentId="14719" CreationDate="2020-11-19T08:41:50.527" Score="2" Body="&lt;p&gt;Try the following command and get back if errors persist&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;from qiskit import *&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="13860" LastEditorUserId="9006" LastEditDate="2020-11-19T09:48:59.703" LastActivityDate="2020-11-19T09:48:59.703" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14721" PostTypeId="2" ParentId="14704" CreationDate="2020-11-19T08:45:56.217" Score="4" Body="&lt;p&gt;Let's assume&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\pi_i|\phi\rangle=e_i|\phi\rangle+\sqrt{1-e_i^2}|\phi_i^\perp\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\phi_i^\perp\rangle=0$&lt;/span&gt; and, for simplicity, let's assume the &lt;span class=&quot;math-container&quot;&gt;$e_i$&lt;/span&gt; are real. We can immediately expand&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&#xA;This simplifies to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f_1f_2+\sqrt{1-f_1^2}\sqrt{1-f_2^2}\langle\phi_1^\perp|\phi_2^\perp\rangle,&#xA;$$&lt;/span&gt;&#xA;which is bounded between&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f_1f_2\pm\sqrt{1-f_1^2}\sqrt{1-f_2^2}.&#xA;$$&lt;/span&gt;&#xA;Thus, we can say&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$f_i=\cos\theta_i$&lt;/span&gt;. Then, we want&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\min_{\theta_1,\theta_2}\cos(\theta_1+\theta_2).&#xA;$$&lt;/span&gt;&#xA;If we assume that &lt;span class=&quot;math-container&quot;&gt;$\theta_1+\theta_2&amp;lt;\pi$&lt;/span&gt;, the minimum is achieved by setting both &lt;span class=&quot;math-container&quot;&gt;$\theta_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_2$&lt;/span&gt; as large as possible, corresponding with &lt;span class=&quot;math-container&quot;&gt;$f_i=e$&lt;/span&gt;. Thus, provided &lt;span class=&quot;math-container&quot;&gt;$e&amp;gt;0$&lt;/span&gt;, the minimum value is &lt;span class=&quot;math-container&quot;&gt;$2e^2-1$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\phi|\pi_1\pi_2|\phi\rangle\geq 2e^2-1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-11-19T12:09:02.617" LastActivityDate="2020-11-19T12:09:02.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14722" PostTypeId="2" ParentId="14718" CreationDate="2020-11-19T09:28:49.670" Score="2" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X=1$&lt;/span&gt;. However, I think as per your code, you are preparing the qubits to be &lt;span class=&quot;math-container&quot;&gt;$|ABX\rangle = |111\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;. Baring that, your circuit works perfectly fine from what I could analyze.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastEditorUserId="9006" LastEditDate="2020-11-19T09:50:46.083" LastActivityDate="2020-11-19T09:50:46.083" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14724" PostTypeId="2" ParentId="14719" CreationDate="2020-11-19T11:47:46.573" Score="0" Body="&lt;p&gt;OS Error refers to an operating system error. On this &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;page&lt;/a&gt;, you can see that&#xA;&lt;code&gt;qiskit&lt;/code&gt; is tested on 64-bit os solely.&lt;/p&gt;&#xA;&lt;p&gt;The report says that your operating system is 32-bit, this should be the reason. When I was first &lt;code&gt;pip install qiskit&lt;/code&gt;, it fails. Later I changed my python from a 32-bit version to a 64-qubits one and then &lt;code&gt;pip&lt;/code&gt; succeeds(my laptop is 64-bit). If your &lt;strong&gt;CPU is 64-bit you can use a windows 64-bit virtual machine&lt;/strong&gt;, to see more detail follow this stack overflow &lt;a href=&quot;https://stackoverflow.com/questions/56124/can-i-run-a-64-bit-vmware-image-on-a-32-bit-machine&quot;&gt;link&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you cannot you the win64 virtual machine maybe you can rent a VPS or submit your script to the IBM Q server.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-19T11:47:46.573" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14725" PostTypeId="2" ParentId="14715" CreationDate="2020-11-19T12:01:04.950" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13479" LastActivityDate="2020-11-19T12:01:04.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14726" PostTypeId="2" ParentId="14719" CreationDate="2020-11-19T12:53:04.973" Score="2" Body="&lt;p&gt;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 &lt;code&gt;conda install&lt;/code&gt; to install &lt;code&gt;numpy&lt;/code&gt; and &lt;code&gt;scipy&lt;/code&gt; then pip install qiskit. So something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;conda create new-qiskit&#xA;conda activate new-qiskit&#xA;conda install numpy scipy&#xA;pip install qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2020-11-19T12:53:04.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14728" PostTypeId="1" CreationDate="2020-11-19T21:22:39.850" Score="1" ViewCount="61" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 %?&lt;/p&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#initialization&#xA;import matplotlib.pyplot as plt&#xA;import math&#xA;import numpy as np&#xA;&#xA;# importing Qiskit&#xA;from qiskit import ClassicalRegister, QuantumRegister&#xA;from qiskit.providers.ibmq import least_busy&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.providers.aer import QasmSimulator&#xA;&#xA;# import basic plot tools&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;def initialize_s(qc,qubits):&#xA;    &amp;quot;&amp;quot;&amp;quot;Apply a H-gate to 'qubits' in qc&amp;quot;&amp;quot;&amp;quot;&#xA;    for q in qubits:&#xA;        qc.h(q)&#xA;    return qc&#xA;&#xA;def numberofiterations(nqubits):&#xA;    temp = 2 ** nqubits;&#xA;    squareRoot = math.sqrt(temp)&#xA;    iterations = round(squareRoot)&#xA;    return iterations&#xA;&#xA;def oracle(nqubits):&#xA;    q = QuantumRegister(nqubits)&#xA;    qc = QuantumCircuit(q)&#xA;    #set the oracle's 0 bits&#xA;    qc.x(q[1])&#xA;    qc.x(q[2])&#xA;    #qc.x(q[5])&#xA;    #qc.x(q[7])&#xA;    #qc.x(q[8])&#xA;    #qc.x(q[12])&#xA;    #qc.x(q[13])&#xA;    #qc.x(q[15])&#xA;    #qc.x(q[19])&#xA;    #qc.x(q[20])&#xA;    #qc.x(q[21])&#xA;    #qc.x(q[22])&#xA;    #qc.x(q[24])&#xA;    qc.h(q[nqubits-1])&#xA;    #[0,3,4,6,9,10,11,14,16,17,18,23,26,27],30,ancilla_qubits=None, mode='noancilla')&#xA;    #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')&#xA;    #qc.cx([0],[1])&#xA;    qc.mcx([0,1,2],q[nqubits-1],ancilla_qubits=None, mode='noancilla')&#xA;    qc.x(q[1])&#xA;    qc.x(q[2])&#xA;    #qc.x(q[5])&#xA;    #qc.x(q[7])&#xA;    #qc.x(q[8])&#xA;    #qc.x(q[12])&#xA;    #qc.x(q[13])&#xA;    #qc.x(q[15])&#xA;    #qc.x(q[19])&#xA;    #qc.x(q[20])&#xA;    #qc.x(q[21])&#xA;    #qc.x(q[22])&#xA;    #qc.x(q[24])&#xA;    qc.h(q[nqubits-1])&#xA;    #return the oracle as a gate.&#xA;    oracle = qc.to_gate()&#xA;    oracle.name = &amp;quot;U&lt;span class=&quot;math-container&quot;&gt;$_\omega$&lt;/span&gt;&amp;quot;&#xA;    return oracle&#xA;&#xA;&#xA;def diffuser(nqubits):&#xA;    qc = QuantumCircuit(nqubits)&#xA;    # Apply transformation |s&amp;gt; -&amp;gt; |00..0&amp;gt; (H-gates)&#xA;    for qubit in range(nqubits):&#xA;        qc.h(qubit)&#xA;    # Apply transformation |00..0&amp;gt; -&amp;gt; |11..1&amp;gt; (X-gates)&#xA;    for qubit in range(nqubits):&#xA;        qc.x(qubit)&#xA;    # Do multi-controlled-Z gate&#xA;    qc.h(nqubits-1)&#xA;    qc.mcx(list(range(nqubits-1)), nqubits-1)  # multi-controlled-toffoli&#xA;    #qc.cx([0],[1])&#xA;    qc.h(nqubits-1)&#xA;    # Apply transformation |11..1&amp;gt; -&amp;gt; |00..0&amp;gt;&#xA;    for qubit in range(nqubits):&#xA;        qc.x(qubit)&#xA;    # Apply transformation |00..0&amp;gt; -&amp;gt; |s&amp;gt;&#xA;    for qubit in range(nqubits):&#xA;        qc.h(qubit)&#xA;    # We will return the diffuser as a gate&#xA;    U_s = qc.to_gate()&#xA;    U_s.name = &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt;&amp;quot;&#xA;    return U_s&#xA;&#xA;n = 4&#xA;qr = QuantumRegister(n-1, 'register')&#xA;anc = QuantumRegister(1, 'ancilla')&#xA;cr = ClassicalRegister(n-1, 'classical')&#xA;grover_circuit = QuantumCircuit(qr,anc)&#xA;grover_circuit = initialize_s(grover_circuit, list(range(n)))&#xA;iterations = numberofiterations(n-1)&#xA;for j in range(iterations ):&#xA;    grover_circuit.append(oracle(n), list(range(n)))&#xA;    grover_circuit.append(diffuser(n), list(range(n)))&#xA;measure_circuit = QuantumCircuit(qr,cr)&#xA;measure_circuit.measure(qr,cr)&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13881" LastEditorUserId="55" LastEditDate="2020-11-23T17:07:49.060" LastActivityDate="2020-11-23T17:07:49.060" Title="Length / transpilation issues with Grover's algorithm" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;&lt;simulation&gt;&lt;compiling&gt;" AnswerCount="0" CommentCount="11" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14729" PostTypeId="1" CreationDate="2020-11-19T21:39:33.447" Score="1" ViewCount="75" Body="&lt;p&gt;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 (&amp;gt;1000 jobs), for VQC - in the beginning. Does it are problems of site or my code?&#xA;Sorry for my english.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qeXEm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qeXEm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;import numpy as np&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import VQC&#xA;from qiskit.aqua.components.optimizers import SPSA, COBYLA&#xA;from qiskit.aqua.components.feature_maps import RawFeatureVector&#xA;from qiskit.circuit.library import TwoLocal, ZZFeatureMap&#xA;from qiskit import IBMQ&#xA;&#xA;&#xA;#I read file where data look so:&#xA;#1234&#xA;#28313&#xA;#2145&#xA;#27216&#xA;#...&#xA;&#xA;def get_bd(str):&#xA;    f = open(str,'r')&#xA;    data = f.read()&#xA;    _true = []&#xA;    _false = []&#xA;    for i in range(3):&#xA;        m = []&#xA;        a,none,data = data.partition('\n')&#xA;        b,none,data = data.partition('\n')&#xA;        m.append(int(a))&#xA;        m.append(int(b))&#xA;        _false.append(m)&#xA;    &#xA;    for i in range(3):&#xA;        m = []&#xA;        a,none,data = data.partition('\n')&#xA;        b,none,data = data.partition('\n')&#xA;        m.append(int(a))&#xA;        m.append(int(b))&#xA;        _true.append(m)&#xA;    return _false, _true&#xA;&#xA;&#xA;def get_tr(name,n):&#xA;    f = open(name,'r')&#xA;    data = f.read()&#xA;    test = []&#xA;    for i in range(n):&#xA;        m = []&#xA;        a,none,data = data.partition('\n')&#xA;        b,none,data = data.partition('\n')&#xA;        m.append(int(a))&#xA;        m.append(int(b))&#xA;        test.append(m)&#xA;    return test&#xA;&#xA;train_false,train_true = get_bd('spectrain.txt')&#xA;test_false,test_true = get_bd('spectest.txt')&#xA;&#xA;warnings.filterwarnings(&amp;quot;ignore&amp;quot;, category=DeprecationWarning)&#xA;&#xA;IBMQ.enable_account('0adb8fad54503818021e5540edd831eb17ff2b794c33f544630a57041a7f808140fd5bf21be60984b652025147b4ee5fded6f0783763b0fc9c18dbfcf61cdfdc')&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;&#xA;&#xA;shots = 8192&#xA;feature_dim = 2&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;optimizer = SPSA(max_trials=1000, c0=4.0, skip_calibration=True)&#xA;optimizer.set_options(save_steps=1)&#xA;#feature_map = RawFeatureVector(feature_dimension=feature_dim)&#xA;feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2,entanglement='linear')&#xA;#feature_map = SecondOrderExpansion(feature_dimension=2,depth=2,entanglement='linear')&#xA;&#xA;var_form = TwoLocal(feature_dim, ['ry', 'rz'], 'cz', reps=3)&#xA;&#xA;training_data = {'A': np.asarray(train_false),'B': np.asarray(train_true)}&#xA;#test_false,test_true = get_bd('test_data')&#xA;testing_data = {'A': np.asarray(test_false),'B': np.asarray(test_true)}&#xA;&#xA;&#xA;&#xA;vqc = VQC(optimizer, feature_map, var_form, training_data, testing_data)&#xA;quantum_instance = QuantumInstance(backend, shots=shots,skip_qobj_validation=False)&#xA;&#xA;result = vqc.run(quantum_instance)&#xA;print(&amp;quot;testing success ratio: &amp;quot;, result['testing_accuracy'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Update 21.11.2020&#xA;I try run VQC algorithm 1000-norm,1000-anomaly samples and get this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Pjozj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Pjozj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13482" LastEditorUserId="55" LastEditDate="2020-11-23T17:07:25.563" LastActivityDate="2020-11-23T17:07:25.563" Title="State bug in IBM Quantum Experience" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14730" PostTypeId="1" AcceptedAnswerId="14731" CreationDate="2020-11-19T22:57:09.630" Score="1" ViewCount="56" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13449" LastActivityDate="2020-11-20T22:05:21.920" Title="Why does the phase of the eigenstate get kicked up to the ancilla qubit?" Tags="&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14731" PostTypeId="2" ParentId="14730" CreationDate="2020-11-20T01:18:44.153" Score="1" Body="&lt;p&gt;Here is a basic example of a two system that might help you to see this better. Suppose I have these two circuits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Circuit 1:&lt;/strong&gt; Which put the &amp;quot;Controlled qubit&amp;quot; in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and the &amp;quot;Target qubit&amp;quot; state in &lt;span class=&quot;math-container&quot;&gt;$H \big(X|0\rangle \big)  = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $&lt;/span&gt;. Note that this state, &lt;span class=&quot;math-container&quot;&gt;$|psi \rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $&lt;/span&gt; is an eigenvector of the NOT gate &lt;span class=&quot;math-container&quot;&gt;$X = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix}$&lt;/span&gt; since  &lt;span class=&quot;math-container&quot;&gt;$ 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  $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K3Gyw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K3Gyw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;so here the state before the Controlled-NOT (CNOT) operation is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) =  \dfrac{|10\rangle - |11\rangle}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;hence&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt; &#xA;&lt;p&gt;But as you know, the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle =  - \bigg( |1\rangle \otimes \dfrac{  |0\rangle - |1\rangle}{\sqrt{2}} \bigg) $&lt;/span&gt; and the state &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle = |1\rangle \otimes \dfrac{  |0\rangle - |1\rangle}{\sqrt{2}}$&lt;/span&gt;  are equivalent.&lt;/p&gt;&#xA;&lt;p&gt;&lt;br&gt; &lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Circuit 2:&lt;/strong&gt; Which put the &amp;quot;Controlled qubit&amp;quot; in the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt;, and &amp;quot;Target qubit&amp;quot; still in &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QcDRQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QcDRQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;here the state before the Controlled-NOT (CNOT) operation is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&#xA;Hence&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align} CNOT \bigg( \dfrac{|00\rangle - |01\rangle + |10\rangle - |11\rangle}{2} \bigg) &amp;amp;=  \dfrac{|00\rangle - |01\rangle + |11\rangle - |10\rangle}{2}\\&#xA;&amp;amp;= \bigg( \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) \otimes \bigg( \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From here we can see that the controlled qubit started in the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; but ended in the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle - |1\rangle}{\sqrt{2}}$&lt;/span&gt;. Thus, &lt;strong&gt;it has picked up&lt;/strong&gt; the overall phase of the state:  &lt;span class=&quot;math-container&quot;&gt;$ -1 \bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg)  $&lt;/span&gt; as its relative phase.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="13449" LastEditDate="2020-11-20T22:05:21.920" LastActivityDate="2020-11-20T22:05:21.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14732" PostTypeId="1" AcceptedAnswerId="14734" CreationDate="2020-11-20T04:30:48.150" Score="3" ViewCount="62" Body="&lt;p&gt;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 &lt;a href=&quot;https://quantum-journal.org/papers/q-2020-09-12-322/pdf/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. In the following diagram, Figure (b) is a simplified circuit of Figure (a):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/c3vsL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c3vsL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;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)&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2020-11-20T06:29:14.467" Title="Gate cancellations in Hamiltonian simulation" Tags="&lt;hamiltonian-simulation&gt;&lt;quantum-control&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14733" PostTypeId="1" CreationDate="2020-11-20T05:24:02.787" Score="1" ViewCount="81" Body="&lt;p&gt;Is the following unitary transformation possible? If so, what will be the value of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|i,j_1\rangle = 1/\sqrt{k}(|i,j_1\rangle+|i,j_2\rangle+|i,j_3\rangle...+|i,j_k\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is a node in a graph and &lt;span class=&quot;math-container&quot;&gt;$j_1,j_2....j_k$&lt;/span&gt; are the nodes to which node &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is attached. &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the degree of node.&lt;/p&gt;&#xA;&lt;p&gt;For example:  Consider we have 8 nodes in the graph and Node 0(&lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;) is attached to node 1(&lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt;) ,node 7(&lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;) and node 5(&lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;).&#xA;So, what I want is a single &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operator which does this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|000,001\rangle=1/\sqrt{3}(|000,001\rangle+|000,111\rangle+|000,101\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U|000,111\rangle=1/\sqrt{3}(|000,001\rangle+|000,111\rangle+|000,101\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U|000,101\rangle=1/\sqrt{3}(|000,001\rangle+|000,111\rangle+|000,101\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-23T17:06:21.313" LastActivityDate="2020-11-23T17:06:21.313" Title="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)$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14734" PostTypeId="2" ParentId="14732" CreationDate="2020-11-20T06:21:45.397" Score="4" Body="&lt;p&gt;It is true that these two circuits are equivalent:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AYtEd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AYtEd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;as the the controlled qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is the same. So if &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then you can see that it will apply two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates to &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; and they will cancel each other out.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-20T06:29:14.467" LastActivityDate="2020-11-20T06:29:14.467" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14735" PostTypeId="1" CreationDate="2020-11-20T07:09:57.337" Score="2" ViewCount="86" Body="&lt;p&gt;I &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/14577/9858&quot;&gt;asked&lt;/a&gt; about decomposition gate of CCRY last week, and the answer was:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xtI7U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xtI7U.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I now also want to do this for CCCRY. Please someone tell me.&lt;/p&gt;&#xA;" OwnerUserId="13730" LastEditorUserId="9858" LastEditDate="2020-11-20T07:39:55.787" LastActivityDate="2020-11-20T07:57:43.283" Title="How to make the gate decomposition of CCCRY" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14736" PostTypeId="2" ParentId="14735" CreationDate="2020-11-20T07:44:25.697" Score="1" Body="&lt;p&gt;There is an automatic way to design a gate, utilizing &lt;code&gt;qiskit&lt;/code&gt;. When drawing the figure of a quantum, you can use the code &lt;code&gt;circ.decompose().draw()&lt;/code&gt; to show a decomposed circuit.&lt;/p&gt;&#xA;&lt;p&gt;Code first:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.circuit.library.standard_gates import RYGate&#xA;from qiskit.circuit import Parameter&#xA;import matplotlib.pyplot as plt&#xA;qr=QuantumRegister(4)&#xA;circ=QuantumCircuit(qr)&#xA;a=Parameter('a') # You can replace a with theta here&#xA;CCCRY=RYGate(a).control(3)&#xA;circ.append(CCCRY,qr)&#xA;circ.decompose().draw('mpl')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And this gives the following decomposition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xfytR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xfytR.png&quot; alt=&quot;CCCRY&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this figure, &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta,\phi,\lambda)=RZ(\phi)RX(-\pi/2)RZ(\theta)RX(\pi/2)RZ(\lambda)$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta,0,0)=RY(\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-20T07:44:25.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14737" PostTypeId="2" ParentId="14735" CreationDate="2020-11-20T07:55:23.960" Score="0" Body="&lt;p&gt;You can use the same trick by replacing &lt;span class=&quot;math-container&quot;&gt;$RY(\theta)$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$CRY(\theta)$&lt;/span&gt; i.e&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CCCRY = CC(CRY) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then you can continue the simplification process till you find an excutable circuit.&lt;/p&gt;&#xA;" OwnerUserId="13479" LastActivityDate="2020-11-20T07:55:23.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14738" PostTypeId="2" ParentId="14735" CreationDate="2020-11-20T07:57:43.283" Score="1" Body="&lt;p&gt;In general, you can design &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-controlled &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate, &lt;span class=&quot;math-container&quot;&gt;$CCC\cdots CU = C^{n}U $&lt;/span&gt;, using the technique from &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mike and Ike&lt;/a&gt; on page 184, starting with&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sWFio.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sWFio.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0b37j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0b37j.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and here your &lt;span class=&quot;math-container&quot;&gt;$Controlled-U$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$CR_y$&lt;/span&gt; which is&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cplkC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cplkC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-20T07:57:43.283" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14739" PostTypeId="2" ParentId="3971" CreationDate="2020-11-20T11:27:49.470" Score="1" Body="&lt;p&gt;Quantum computing is totally understandable without physics background for several reasons:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantum computing is sufficiently written in abstract mathematical language (Linear Algebra).&lt;/li&gt;&#xA;&lt;li&gt;Quantum computing does not include dynamical equations such as Schrodinger equations. Moreover, all operations can be understood as logical gates instead of physical entities.&lt;/li&gt;&#xA;&lt;li&gt;Quantum mechanics itself made a bridge between physics and information in a such way that information scientist can understand it from his/her perspective.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;However, quantum mechanics and quantum computing includes new concepts that are hard to accept by everyone including physicists. So don't worry.&lt;/p&gt;&#xA;" OwnerUserId="13479" LastActivityDate="2020-11-20T11:27:49.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14740" PostTypeId="2" ParentId="12615" CreationDate="2020-11-20T13:23:50.197" Score="1" Body="&lt;p&gt;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: &lt;a href=&quot;https://www.preprints.org/manuscript/201804.0164/v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;10.20944/preprints201804.0164.v2&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="13888" LastActivityDate="2020-11-20T13:23:50.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14741" PostTypeId="2" ParentId="14733" CreationDate="2020-11-20T13:39:13.957" Score="4" Body="&lt;p&gt;There is a question that has something in common with your question, see the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14673/what-is-a-unitary-operator-that-makes-all-the-amplitudes-all-negative-on-the-arb&quot;&gt;answer&lt;/a&gt; by @DaftWullie.&lt;/p&gt;&#xA;&lt;p&gt;Since all three input states after the operation, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;Maybe, after you appended some ancilla and enlarge the operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; your requirement is possible.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-20T13:39:13.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14742" PostTypeId="2" ParentId="14733" CreationDate="2020-11-20T13:57:30.637" Score="2" Body="&lt;p&gt;To compute the values of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; matrix representation you should calculate its elements &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;{i, j}|U|{i', j'}&amp;gt;$&lt;/span&gt; for all values of &lt;span class=&quot;math-container&quot;&gt;$i, i', j, j'$&lt;/span&gt;.&#xA;For instance:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U_{i,j_1,i,j_1} = &amp;lt;{i, j_1}|U|{i, j_1}&amp;gt; = 1/\sqrt{k} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U_{i,j_2,i,j_1} = &amp;lt;{i, j_2}|U|{i, j_1}&amp;gt; = 1/\sqrt{k} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so on..&lt;/p&gt;&#xA;&lt;p&gt;You should also define the state &lt;span class=&quot;math-container&quot;&gt;$U|i,j&amp;gt;$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; to completely determine the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; matrix. Otherwise, it will contain unknown elements.&lt;/p&gt;&#xA;&lt;p&gt;However, your example shows that your transformation is not unitary:&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$U|x&amp;gt; = U |y&amp;gt;$&lt;/span&gt; while &lt;span class=&quot;math-container&quot;&gt;$&amp;lt;x|y&amp;gt; = 0$&lt;/span&gt;, it implies that&#xA;if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, then &lt;span class=&quot;math-container&quot;&gt;$$ &amp;lt;x|U^\dagger U|y&amp;gt; = 0$$&lt;/span&gt; which is contradiction since &lt;span class=&quot;math-container&quot;&gt;$U|x&amp;gt; = U |y&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13479" LastEditorUserId="13479" LastEditDate="2020-11-20T18:47:23.960" LastActivityDate="2020-11-20T18:47:23.960" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14743" PostTypeId="1" CreationDate="2020-11-20T14:48:15.997" Score="1" ViewCount="75" Body="&lt;p&gt;I want to record the time that a VQE solver takes to find the ground state. At the moment I am using:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;import numpy as np&#xA;import matplotlib.pyplot as plt&#xA;import time&#xA;&#xA;# Loading your IBM Q account(s) and assigning backend&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider('ibm-q')&#xA;qcomp = provider.get_backend('ibmq_valencia')&#xA;&#xA;#Imports for algorithm&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;&#xA;        &#xA;#Define molecule&#xA;molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                              ['H', [0., 0., 0.735]]],&#xA;                     charge=0, multiplicity=1)&#xA;&#xA;driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;&#xA;#Map fermionic hamiltonian to qubit hamiltonian&#xA;transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.PARITY,&#xA;                                        two_qubit_reduction=True,&#xA;                                        freeze_core=True)&#xA;&#xA;&#xA;#Initialize the VQE solver&#xA;vqe_solver = VQEUCCSDFactory(QuantumInstance(backend = qcomp))&#xA;&#xA;#Ground state algorithm&#xA;calculation_VQE = GroundStateEigensolver(transformation, vqe_solver)&#xA;        &#xA;#Calculate results&#xA;start = time.time()&#xA;VQE_result = calculation_VQE.solve(driver)&#xA;end = time.time()&#xA;time_difference = (end - start)&#xA;print(VQE_result.total_energies)&#xA;print(time_difference)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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).&#xA;Is there any way to record the time taken by the VQE to compute the ground state energy without including queue time.&lt;/p&gt;&#xA;" OwnerUserId="13724" LastEditorUserId="55" LastEditDate="2020-11-23T17:05:20.333" LastActivityDate="2020-11-23T17:05:20.333" Title="Recording the time taken by a VQE to find ground state energy" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14744" PostTypeId="2" ParentId="14743" CreationDate="2020-11-20T16:00:07.903" Score="2" Body="&lt;p&gt;You are correct that your current strategy will include the time spent in queue and other overhead processes.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;You can enable Aqua's logging by running this snippet of code with your imports:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import logging&#xA;from qiskit.aqua import set_qiskit_aqua_logging&#xA;set_qiskit_aqua_logging(logging.DEBUG)  # choose INFO, DEBUG to see the log&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;An example of what one of the iteration's logs would look like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;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&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2020-11-20T16:00:07.903" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14745" PostTypeId="1" AcceptedAnswerId="14747" CreationDate="2020-11-20T16:13:23.690" Score="2" ViewCount="70" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9vzeq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9vzeq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I created two qubits in IBM quantum experience and measured the second qubit without applying any gate.&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="13890" LastEditorUserId="55" LastEditDate="2020-11-23T17:05:14.947" LastActivityDate="2020-11-23T17:05:14.947" Title="Measurement of 1 qubit in a two qubit system" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14746" PostTypeId="2" ParentId="14745" CreationDate="2020-11-20T16:18:45.497" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13081" LastEditorUserId="13081" LastEditDate="2020-11-20T16:24:31.400" LastActivityDate="2020-11-20T16:24:31.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14747" PostTypeId="2" ParentId="14745" CreationDate="2020-11-20T16:19:28.820" Score="1" Body="&lt;p&gt;If you had run this on the &lt;code&gt;statevector_simulator&lt;/code&gt; then you will only see &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. However, due to hardware noise, which in this case coming out from the measurement error, you will have some &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; in your measurement on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;. Depends on the hardware noise level, you might see 'more' or 'less' of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; appearing in your result. If you want to improve your output probabilities result, just add more shots.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Why would we would we only see the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; in the ideal world, like if we have used the &lt;code&gt;statevector_simulator&lt;/code&gt; instead of the hardware?&lt;/p&gt;&#xA;&lt;p&gt;The reason is because the starting/initial state on a quantum computer always start in the state &lt;span class=&quot;math-container&quot;&gt;$|000\cdots 0\rangle$&lt;/span&gt;.  That is, every qubit initialize with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. That is &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|q_1 \rangle = |0 \rangle$&lt;/span&gt;. So now without doing any operation on this qubit, you ask the quantum computer, what state is the second qubit, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; in? The answer should be  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; if you have a measurement process with no noise! Because the state the qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle = |0\rangle$&lt;/span&gt;. There is no other answer it can give you. However, if there is noise presence, it might change this answer from a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and 5 time it will return a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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 &amp;quot;YUP&amp;quot;, he/she might hear as a &amp;quot;NOPE&amp;quot; instead.... so if you have say&amp;quot;YUP&amp;quot;, &amp;quot;YUP&amp;quot;,.... &amp;quot;YUP&amp;quot; 100 times, he/she might pick up a &amp;quot;NOPE&amp;quot; 5 time out of the 100 time. This is what you see in your histogram plot... sometime the measurement process pick-up a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; because of the noise in the measurement process as your friend has picked up a &amp;quot;NOPE&amp;quot; from bad signal.&lt;/p&gt;&#xA;&lt;p&gt;Note that this should not be confusing with the state &lt;span class=&quot;math-container&quot;&gt;$|q_1 \rangle = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$&lt;/span&gt;... In this case, when you ask the quantum computer, &amp;quot;Hey QC, what state is &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; in? It will return you with a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; probability. This is &lt;strong&gt;not&lt;/strong&gt; because of the noise in your system. If you run this experiment &lt;span class=&quot;math-container&quot;&gt;$100,000$&lt;/span&gt; time, you might get &lt;span class=&quot;math-container&quot;&gt;$49820$&lt;/span&gt; time it will returns a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$50,180$&lt;/span&gt; time it will returns a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This is because your state &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt; is in superposition of both &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so when making a measurement, it will collapse onto either one of these state. And in this case, where &lt;span class=&quot;math-container&quot;&gt;$|q_1 \rangle = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$&lt;/span&gt;, the probability of collapsing onto the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is 50% probability and the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is also 50%. This is similar to &lt;strong&gt;tossing a coin&lt;/strong&gt; if you think about it...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-20T17:17:23.077" LastActivityDate="2020-11-20T17:17:23.077" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14748" PostTypeId="2" ParentId="10150" CreationDate="2020-11-20T16:29:38.460" Score="0" Body="&lt;p&gt;To add to the circuit by @Craig, the reason why papers tend to mention that some gate is obtainable by &lt;span class=&quot;math-container&quot;&gt;$\sqrt{swap}$&lt;/span&gt; upto a few single qubit gates is because the set that contains the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{swap}$&lt;/span&gt; gate and all the one qubit gates is considered to be a universal set of quantum gates. That is, by just using just the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{swap}$&lt;/span&gt; gate and some single qubit gates, it is possible to construct any single or multi qubit quantum gate.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-11-20T16:29:38.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14749" PostTypeId="2" ParentId="14745" CreationDate="2020-11-20T16:45:50.037" Score="1" Body="&lt;p&gt;What you are seeing here is coming from the fact that quantum computation on real machines is not perfect.&lt;/p&gt;&#xA;&lt;p&gt;In a perfect world, since you did not put any gates on your circuit, the state it should return is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, the common initial state on any machine by default.&lt;br /&gt;&#xA;However, on real quantum machines, qubits can experience noise from the operations you are doing. Here, the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Does that answer your question or do you need more explanation on something? Feel free to ask :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-11-20T16:45:50.037" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14750" PostTypeId="1" CreationDate="2020-11-20T17:46:55.160" Score="0" ViewCount="54" Body="&lt;p&gt;I am trying to work out how to program a simulation of a quantum&#xA;computer program. I think I understand all the steps, of implementing a simulation, except&#xA;the simulation of the measurement.&#xA;I will use 2 qubit states to illustrate;though the illustration below extends in&#xA;an obvious way to n qubits.&#xA;Suppose after we are up to the state just before measurement it is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a_0|00\rangle+a_1|01\rangle+a_2|10\rangle+a_3|11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose there exist a unique maximum from the real numbers&#xA;&lt;span class=&quot;math-container&quot;&gt;$a_0,a_1,a_2,a_3$&lt;/span&gt; let refer to this as m; and that the sum of squares&#xA;of the 4 amplitudes sum to 1.&#xA;and we want to know what is the most likely state that will be measured.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; Is the most likely state to me measured&#xA;the one with maximum squared amplitude of &lt;span class=&quot;math-container&quot;&gt;$a_0,a_1,a_2,a_3$&lt;/span&gt;&#xA;in other words the most likely state has probability &lt;span class=&quot;math-container&quot;&gt;$m^2$&lt;/span&gt; of being measured&#xA;-for example out of 100 repeated measurement &lt;span class=&quot;math-container&quot;&gt;$(100*(m^2))$&lt;/span&gt;, to nearest integer, will be the likely state.&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;B)&lt;/strong&gt; Is the most likely state to be measured the one that has the highest ratios&#xA;regarding the amplitudes, compared to every other state,&#xA;the ratio measures how many time more likely one state is to be measured when&#xA;compared to another state,suppose that &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt; is near to one, and &lt;span class=&quot;math-container&quot;&gt;$a_0,a_1,a_3$&lt;/span&gt; are near to&#xA;zero then computing the absolute values of&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|a_3/a_2|,|a_3/a_1|, |a_3/a_0|$&lt;/span&gt; I assume, not sure but assuming here, will give the largest 3 values when compared&#xA;to any of the values in the two lists of amplitude ratios&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|a_2/a_3| ,|a_2/a_1|, |a_2/a_0|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|a_1/a_2|,|a_1/a_0|, |a_1/a_3|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;therefore &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt; is most likely to  measured and suppose &lt;span class=&quot;math-container&quot;&gt;$a_3/a_2, a_3/a_1, a_3/a_0$&lt;/span&gt; are all largest than some integer I&#xA;then if I is large enough the simulation then we can ignore how many times, referred to as T, we measure&#xA;the state because we can conclude &lt;span class=&quot;math-container&quot;&gt;$a_3$&lt;/span&gt; is measured ever time.&lt;/p&gt;&#xA;&lt;p&gt;So is the answer A or B?&lt;/p&gt;&#xA;" OwnerUserId="13834" LastEditorUserId="1859" LastEditDate="2020-11-20T19:15:25.073" LastActivityDate="2021-04-20T02:44:32.327" Title="Details for implementing the measurement of a simulation" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14751" PostTypeId="1" AcceptedAnswerId="14758" CreationDate="2020-11-20T18:35:36.683" Score="4" ViewCount="96" Body="&lt;p&gt;Let's say I need to find the state &lt;span class=&quot;math-container&quot;&gt;$111$&lt;/span&gt; in a &amp;quot;database&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$\{000, 010, 001, 000, 000, 110\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How can I adjust Grover's algorithm for this kind of search? I would like a Qiskit implementation of this case.&lt;/p&gt;&#xA;" OwnerUserId="13893" LastEditorUserId="55" LastEditDate="2020-11-23T17:08:15.060" LastActivityDate="2020-12-08T11:29:03.597" Title="Qiskit: How can I modify Grover's algorithm to search for a state that doesn't belong to a basis set?" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14752" PostTypeId="2" ParentId="14673" CreationDate="2020-11-20T19:04:23.073" Score="0" Body="&lt;p&gt;You should know that amplitudes are not OBSERVABLES (They cannot be measured). In general, the minus sign is just a phase factor (&lt;span class=&quot;math-container&quot;&gt;$ -1 = e^{\pi}$&lt;/span&gt;) which is irrelevant to the statistical outcome since &lt;span class=&quot;math-container&quot;&gt;$ |a|^2 = |-a|^2 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, we cannot find a unitary operation that distinguishes between a minus signed amplitude and a positive one (or either the amplitude of bigger magnitude from others).&lt;/p&gt;&#xA;" OwnerUserId="13479" LastActivityDate="2020-11-20T19:04:23.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14753" PostTypeId="2" ParentId="14750" CreationDate="2020-11-21T01:43:36.343" Score="0" Body="&lt;p&gt;A pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \sum c_i |e_i\rangle $&lt;/span&gt; is a superposition state of the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_\rangle$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$|c_i|^2$&lt;/span&gt; is probability that one would observe &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; when measured.&lt;/p&gt;&#xA;&lt;p&gt;For example: Suppose we have  &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{3}{5}|0\rangle + \dfrac{4}{5}|1\rangle  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then this state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; will be measured as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis (computational basis, the usual basis one deals with when thinking about quantum computing) with probability &lt;span class=&quot;math-container&quot;&gt;$\bigg| \dfrac{3}{5} \bigg|^2 = \dfrac{9}{25}$&lt;/span&gt;. And similarly, it has probability &lt;span class=&quot;math-container&quot;&gt;$\bigg| \dfrac{4}{5} \bigg|^2 = \dfrac{16}{25}$&lt;/span&gt; being measured as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$\dfrac{9}{25} + \dfrac{16}{25} = 1 $&lt;/span&gt;. This makes sense because there are only 2 possible states (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; ) that you can measure, so their probability must sum up to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. In this case, we see that we will see the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; collapsed onto the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; more often than it will collapse to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. However, there is no pattern to this collapse. That is, you don't expect them to alternate, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; of that sort. It will be random. But after doing maybe 1000 experiment, you find that you recorded 355 times that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; collapse to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the other 645 it has collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hence giving &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \sum c_i |e_i\rangle $&lt;/span&gt;, the largest &lt;span class=&quot;math-container&quot;&gt;$|c_i|^2$&lt;/span&gt; value do tells us that we will observe that particular &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; state more than the other states in our experiments.&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, can we look at the absolute ratio of these two states &lt;span class=&quot;math-container&quot;&gt;$( |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle )$&lt;/span&gt; and say which one it will collapse to more often? Yes, at least mathematically. And you can see here &lt;span class=&quot;math-container&quot;&gt;$\bigg| \dfrac{4}{5}/\dfrac{3}{5} \bigg| &amp;gt; \bigg| \dfrac{3}{5}/\dfrac{4}{5} \bigg|$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle $&lt;/span&gt; we would never know what &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is. And  to retrieve this information of &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;, we do many many measurements to get a statistical distribution. This is how quantum mechanics was postulate. It is not a problem of engineering.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-21T01:43:36.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14754" PostTypeId="1" AcceptedAnswerId="14757" CreationDate="2020-11-21T03:14:31.187" Score="1" ViewCount="31" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gCmnB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gCmnB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13890" LastActivityDate="2020-11-21T06:29:47.273" Title="State vector after applying CNOT" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14755" PostTypeId="1" AcceptedAnswerId="14756" CreationDate="2020-11-21T03:29:56.850" Score="2" ViewCount="57" Body="&lt;p&gt;I got another follow-up question about Hamiltonian simulation from the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/14594/12334&quot;&gt;previous post&lt;/a&gt;: if I perform the controlled time-evolution of the Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{3} = \alpha\ X_1\otimes Y_2 + \beta \ Z_1\otimes Z_2&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are real constants. When they're both equal to 1, &lt;span class=&quot;math-container&quot;&gt;$H_3$&lt;/span&gt; could be simulated via the following quantum circuit (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14595/1859&quot;&gt;answer from @KAJ226&lt;/a&gt;):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/clq24.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/clq24.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;However, how can I introduce those constants when they're not equal to 1? &lt;a href=&quot;https://arxiv.org/pdf/1811.08017.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; 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  &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; when they are generic real numbers?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="1859" LastEditDate="2020-11-21T16:33:05.510" LastActivityDate="2020-11-21T16:33:05.510" Title="Hamiltonian simulation: how can I incorporate the constant before each term?" Tags="&lt;hamiltonian-simulation&gt;&lt;quantum-control&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14756" PostTypeId="2" ParentId="14755" CreationDate="2020-11-21T05:41:06.013" Score="2" Body="&lt;p&gt;You'll place the phase within the CRz gate.&lt;/p&gt;&#xA;&lt;p&gt;The approach you've taken essentially argues that: &lt;span class=&quot;math-container&quot;&gt;$$ e^{it H_3} \approx e^{it \alpha X_1 \otimes Y_2} e^{it \beta Z_1 \otimes Z_2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, when you're applying the Rz gate, you can select the &lt;span class=&quot;math-container&quot;&gt;$it \alpha$&lt;/span&gt; coefficient to align with the necessary phase (likely you'll use &lt;span class=&quot;math-container&quot;&gt;$\theta = -2 t \alpha$&lt;/span&gt;, depending on the definition of your &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rz&quot; rel=&quot;nofollow noreferrer&quot;&gt;Rz&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;Something to keep in mind with the approach that you're leveraging is that it is a form of exponentiated Hamiltonian splitting. Namely, &lt;span class=&quot;math-container&quot;&gt;$$ e^{-i \sum H_j t} = \prod_{j = 1}^m e^{-i H_j t} + \mathcal{O}(m^2 t^2) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(From &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/libraries/chemistry/concepts/algorithms&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft&lt;/a&gt;) This is important to keep in mind because the circuit that you're implementing does not perfectly simulate the Hamiltonian, and the selection of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; has significant impacts on the accuracy of the realized circuit.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-11-21T05:41:06.013" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14757" PostTypeId="2" ParentId="14754" CreationDate="2020-11-21T06:29:47.273" Score="1" Body="&lt;p&gt;You are right, that &lt;span class=&quot;math-container&quot;&gt;$CNOT |11\rangle = |10\rangle $&lt;/span&gt; in the usual setting. But the reason why you see the answer as &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; instead is because Qiskit uses &lt;strong&gt;little endian&lt;/strong&gt; convention.&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CXGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation&lt;/a&gt; to clear thing up.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-21T06:29:47.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14758" PostTypeId="2" ParentId="14751" CreationDate="2020-11-21T09:18:55.560" Score="2" Body="&lt;p&gt;I will quickly reexplain how Grover's Algorithm works :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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 : &lt;span class=&quot;math-container&quot;&gt;$|\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$&lt;/span&gt;. You will assign one of these basis states for each element of your database.&lt;/li&gt;&#xA;&lt;li&gt;Then you run the phase-flip oracle gate : &lt;span class=&quot;math-container&quot;&gt;$|U_\omega\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;You also run Grover's diffusion operator : &lt;span class=&quot;math-container&quot;&gt;$|U_s\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;You repeat the two last steps until the complex amplitude of the state that &lt;strong&gt;corresponds&lt;/strong&gt; to the searched element of your database, has a high enough probability to be measured&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As you can see you need at least as many basis states as you have elements in your database, because you &lt;strong&gt;assign&lt;/strong&gt; an element of you database to each basis set. But since you system &lt;strong&gt;starts&lt;/strong&gt; in an equal superposition, every basis state is searchable, as is every element of your database as long as you &lt;strong&gt;link&lt;/strong&gt; a basis state to an element of your database.&lt;/p&gt;&#xA;&lt;p&gt;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 !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-11-21T09:18:55.560" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14759" PostTypeId="1" CreationDate="2020-11-21T09:48:47.317" Score="0" ViewCount="54" Body="&lt;p&gt;I am reading the following paper: &lt;strong&gt;Discrete-time quantum walk on complex networks&#xA;for community detection by Kanae Mukai&lt;/strong&gt;&lt;br /&gt;&#xA;We define the Coin operator &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; by: &lt;span class=&quot;math-container&quot;&gt;$C=C_1\otimes C_2....C_n$&lt;/span&gt;  , We define coin operator for Node &lt;span class=&quot;math-container&quot;&gt;$i, C_i:H_i\to H_i$&lt;/span&gt;  is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$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 &amp;amp; 1 &amp;amp; 1 &amp;amp; ... &amp;amp; 1\\ 1 &amp;amp; e^{\iota\theta/k_i} &amp;amp; e^{2\iota\theta/k_i} &amp;amp; ... &amp;amp; e^{(k_i-1)\iota\theta/k_i}\\ 1 &amp;amp; e^{2\iota\theta/k_i} &amp;amp; e^{4\iota\theta/k_i} &amp;amp; ... &amp;amp; e^{2(k_i-1)\iota\theta/k_i}\\ . &amp;amp; . &amp;amp; . &amp;amp; . &amp;amp; .\\. &amp;amp; . &amp;amp; . &amp;amp; . &amp;amp; .\\. &amp;amp; . &amp;amp; . &amp;amp; . &amp;amp; .\\ 1 &amp;amp; e^{(k_i-1)\iota\theta/k_i} &amp;amp; e^{2(k_i-1)\iota\theta/k_i} &amp;amp; ... &amp;amp; e^{(k_i-1)(k_i-1)\iota\theta/k_i}\end{pmatrix}$&lt;/span&gt;&lt;br /&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$k_i$&lt;/span&gt; is the degree of &lt;span class=&quot;math-container&quot;&gt;$i^{th}$&lt;/span&gt; node and &lt;span class=&quot;math-container&quot;&gt;$\theta=2\pi$&lt;/span&gt;. The author called this coin as &lt;strong&gt;Fourier Coin&lt;/strong&gt;. And this &lt;span class=&quot;math-container&quot;&gt;$i\to j$&lt;/span&gt; implies that Node &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is going to hope to adjacent Node &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&#xA;Now, What is going on with this equation?&lt;/p&gt;&#xA;" OwnerUserId="13517" LastActivityDate="2020-11-21T17:12:51.270" Title="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" Tags="&lt;quantum-state&gt;&lt;quantum-fourier-transform&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14760" PostTypeId="2" ParentId="14719" CreationDate="2020-11-21T10:13:22.903" Score="0" Body="&lt;p&gt;Reinstalling numpy didn't work for me.&lt;/p&gt;&#xA;&lt;p&gt;I delete the &lt;code&gt;C:\Users\USERNAME\AppData\Roaming\Python\Python38\*&lt;/code&gt; folder because that was left behind by a previous Python which I had uninstalled.&lt;/p&gt;&#xA;&lt;p&gt;And this work for me.&lt;/p&gt;&#xA;&lt;p&gt;Thanks to everyone who all answered my questions and I appreciate it.&lt;/p&gt;&#xA;" OwnerUserId="13859" LastActivityDate="2020-11-21T10:13:22.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14762" PostTypeId="1" CreationDate="2020-11-21T12:12:44.990" Score="2" ViewCount="42" Body="&lt;p&gt;I'm currently working on &lt;strong&gt;QRAC&lt;/strong&gt; and was wondering if there's an encoding protocol in &lt;span class=&quot;math-container&quot;&gt;$3 \rightarrow 1$&lt;/span&gt; such that the receiver is able to retrieve any one of the &lt;em&gt;&lt;strong&gt;XOR&lt;/strong&gt;&lt;/em&gt; combinations of the bits, along with the original bits itself ( a grand total of &lt;strong&gt;7&lt;/strong&gt; functions; if &lt;strong&gt;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&lt;/strong&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Is this even possible? My initial guess would be to use some kind of &lt;em&gt;POVM&lt;/em&gt; measurements in the decoding part but don't how to proceed with that.&lt;/p&gt;&#xA;&lt;p&gt;If you have any ideas on this then please let me know. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="13591" LastEditorUserId="55" LastEditDate="2020-11-22T16:54:49.623" LastActivityDate="2020-11-22T21:13:53.190" Title="$3 \rightarrow 1$ QRAC encoding for XOR functions" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;semidefinite-programming&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14763" PostTypeId="1" AcceptedAnswerId="14783" CreationDate="2020-11-21T13:26:16.810" Score="4" ViewCount="116" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit Haar-random quantum state. I am trying to show that in the limit of large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, for each &lt;span class=&quot;math-container&quot;&gt;$z_{i} \in \{0, 1\}^{n}$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\langle z_{i}|\psi\rangle|^{2} \sim \text{PorterThomas}(\alpha),$$&lt;/span&gt;&#xA;where the probability density function for the Porter Thomas distribution is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ f(\alpha) = 2^{n} e^{-2^{n} \alpha}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, look at Fact 10 of &lt;a href=&quot;https://arxiv.org/abs/2008.08721&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper. I am specifically interested in why we need a large enough &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; to have the i.i.d approximation.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="55" LastEditDate="2020-11-22T16:56:23.900" LastActivityDate="2020-11-23T08:04:20.850" Title="Question about Haar random quantum states" Tags="&lt;quantum-state&gt;&lt;information-theory&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14764" PostTypeId="1" CreationDate="2020-11-21T15:14:40.947" Score="1" ViewCount="252" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;From &lt;a href=&quot;https://github.com/ttlion/ShorAlgQiskit/blob/master/Shor_Sequential_QFT.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/ttlion/ShorAlgQiskit/blob/master/Shor_Sequential_QFT.py&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    &amp;quot;&amp;quot;&amp;quot; Cycle to create the Sequential QFT, measuring qubits and applying the right gates according to measurements &amp;quot;&amp;quot;&amp;quot;&#xA;    for i in range(0, 2*n):&#xA;        &amp;quot;&amp;quot;&amp;quot;reset the top qubit to 0 if the previous measurement was 1&amp;quot;&amp;quot;&amp;quot;&#xA;        circuit.x(up_reg).c_if(c_aux, 1)&#xA;        circuit.h(up_reg)&#xA;        cMULTmodN(circuit, up_reg[0], down_reg, aux, a**(2**(2*n-1-i)), N, n)&#xA;        &amp;quot;&amp;quot;&amp;quot;cycle through all possible values of the classical register and apply the corresponding conditional phase shift&amp;quot;&amp;quot;&amp;quot;&#xA;        for j in range(0, 2**i):&#xA;            &amp;quot;&amp;quot;&amp;quot;the phase shift is applied if the value of the classical register matches j exactly&amp;quot;&amp;quot;&amp;quot;&#xA;            circuit.u1(getAngle(j, i), up_reg[0]).c_if(up_classic, j)&#xA;        circuit.h(up_reg)&#xA;        circuit.measure(up_reg[0], up_classic[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The obvious way of using &lt;code&gt; c_if(up_classic[j],j)&lt;/code&gt; doesn't work. I've tried using an if statement as in&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for j in range(0, i):&#xA;    &amp;quot;&amp;quot;&amp;quot;the phase shift is applied if the value of the classical register matches j exactly&amp;quot;&amp;quot;&amp;quot;&#xA;    if up_classic[j]:&#xA;        circuit.u1(getAngle(2**j,i), up_reg[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but test runs fail to find the correct factor for small semiprimes like 21 or 33.&lt;/p&gt;&#xA;" OwnerUserId="9305" LastEditorUserId="55" LastEditDate="2020-11-22T17:02:25.323" LastActivityDate="2020-11-22T17:02:25.323" Title="Simplifying Qiskit circuit with c_if()" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14765" PostTypeId="1" AcceptedAnswerId="14902" CreationDate="2020-11-21T16:15:59.580" Score="5" ViewCount="150" Body="&lt;p&gt;Uhlmann's theorem states that if two states &lt;span class=&quot;math-container&quot;&gt;$\rho_A, \sigma_A$&lt;/span&gt; satisfy &lt;span class=&quot;math-container&quot;&gt;$F(\rho_A, \sigma_A)\geq 1 - \varepsilon$&lt;/span&gt;, then there for any purification &lt;span class=&quot;math-container&quot;&gt;$\Psi_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;, one can find a purification &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\Psi_{AR}, \Phi_{AR})\geq 1 - \varepsilon$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The purification &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AR}$&lt;/span&gt; can be found by optimizing over unitaries on the purifying register alone i.e. the following holds for any choice of purification &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AR}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sup_{U_R}F(\Psi_{AR}, (I_A\otimes U_R)\Phi_{AR})\geq 1- \varepsilon$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since the trace distance and fidelity are &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states#Relationship_to_trace_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;closely related&lt;/a&gt;, one can translate Uhlmann's theorem into the following. Given &lt;span class=&quot;math-container&quot;&gt;$\|\rho_A - \sigma_A\|_1 \leq \varepsilon$&lt;/span&gt;, for any purification &lt;span class=&quot;math-container&quot;&gt;$\Psi_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; , we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\inf_{U_R}\|\Psi_{AR} - (I_A\otimes U_R)\Phi_{AR}\|_1\leq \delta(\varepsilon),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lim_{\varepsilon \rightarrow 0}\delta(\varepsilon) = 0$&lt;/span&gt;. Crucially, &lt;span class=&quot;math-container&quot;&gt;$\delta(\varepsilon)$&lt;/span&gt; has no dependence on the dimension of the state.&lt;/p&gt;&#xA;&lt;p&gt;Question: Is the above statement true for any other Schatten p-norm. Given &lt;span class=&quot;math-container&quot;&gt;$\rho_A, \sigma_A$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\|\rho_A - \sigma_A\|_p\leq \varepsilon$&lt;/span&gt; and for any purifications &lt;span class=&quot;math-container&quot;&gt;$\Psi_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt;, is it true that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\inf_{U_R}\|\Psi_{AR} - (I_A\otimes U_R)\Phi_{AR} \|_p \leq \delta(\varepsilon)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am particularly interested in the above statement for the operator norm i.e. &lt;span class=&quot;math-container&quot;&gt;$p = \infty$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-11-23T16:56:25.430" LastActivityDate="2020-11-29T20:49:02.377" Title="Closeness of purifications of states" Tags="&lt;information-theory&gt;&lt;fidelity&gt;&lt;trace-distance&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14766" PostTypeId="2" ParentId="14764" CreationDate="2020-11-21T16:21:40.570" Score="1" Body="&lt;p&gt;The conditional &lt;code&gt;c_if&lt;/code&gt; on Qiskit checks a condition on a classical register, not a classical bit. Therefore, &lt;code&gt;up_classic[j]&lt;/code&gt; is not valid.&lt;/p&gt;&#xA;&lt;p&gt;Doing the &lt;code&gt;if&lt;/code&gt; at construction time (like on your second case) makes no sense, since &lt;code&gt;up_classic[j]&lt;/code&gt; is unknown at that time. Notice that, in the original code, &lt;code&gt;up_classic&lt;/code&gt; is set at the end of the loop, with &lt;code&gt;circuit.measure(up_reg[0], up_classic[i])&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-11-21T16:21:40.570" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14768" PostTypeId="1" AcceptedAnswerId="14770" CreationDate="2020-11-21T17:05:44.387" Score="6" ViewCount="192" Body="&lt;p&gt;Assuming two qubits start in the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt 2}|00\rangle +  \frac{1}{2}|10\rangle- \frac{1}{2}|11\rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$|00⟩$&lt;/span&gt; have a 50% chance?  And I don't really understand the second question, any suggestion on where to review or study?&lt;/p&gt;&#xA;" OwnerUserId="13081" LastEditorUserId="55" LastEditDate="2020-11-22T17:01:26.117" LastActivityDate="2021-02-07T18:10:30.153" Title="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 $?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14769" PostTypeId="2" ParentId="14759" CreationDate="2020-11-21T17:12:51.270" Score="1" Body="&lt;p&gt;The operator &lt;strong&gt;Fourier Coin&lt;/strong&gt; is &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-point Discrete Fourier Transform (DFT) of node &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&#xA;The m&lt;a href=&quot;https://en.wikipedia.org/wiki/DFT_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;atrix representation of a general &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-point DFT&lt;/a&gt; can be found here.&lt;/p&gt;&#xA;&lt;p&gt;The implementation of DFT on the quantum computer is what we know as QFT, and it can be found in &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mike and Ik&lt;/a&gt;e on pg.219. More specifically, an &lt;a href=&quot;https://en.wikipedia.org/wiki/DFT_matrix#Eight-point&quot; rel=&quot;nofollow noreferrer&quot;&gt;eight-point DFT&lt;/a&gt; can be implemented on the quantum computer as&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CReC9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CReC9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-21T17:12:51.270" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14770" PostTypeId="2" ParentId="14768" CreationDate="2020-11-21T18:53:28.910" Score="8" Body="&lt;p&gt;If we have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{2}}|00\rangle + \dfrac{1}{2}|10\rangle - \dfrac{1}{2}|11\rangle$&lt;/span&gt; then the probability of the second qubit being in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the probability of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; having &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on the second qubit. In this case, it is from the states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. So The probability of measuring the second qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\bigg| \dfrac{1}{\sqrt{2}} \bigg|^2 + \bigg| \dfrac{1}{2} \bigg|^2 = \dfrac{3}{4} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can also work this out more explicitly as well. That is, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle = \begin{pmatrix} 1/\sqrt{2} \ \ \\ 0 \\ 1/2 \\ -1/2 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We are looking for the probability that the second qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; so the projective measurement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;M = I \otimes |0\rangle \langle 0 | = \begin{pmatrix}  &#xA;     1   &amp;amp;  0   &amp;amp;  0  &amp;amp;   0\\&#xA;     0  &amp;amp;   0   &amp;amp;  0   &amp;amp;  0\\&#xA;     0   &amp;amp;  0   &amp;amp;  1 &amp;amp;    0\\&#xA;     0    &amp;amp; 0   &amp;amp;  0   &amp;amp;  0&#xA; \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and so according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born's rule&lt;/a&gt; we have that the probability to measure the second qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \langle \psi | M | \psi \rangle =  \begin{bmatrix} 1/\sqrt{2} &amp;amp; 0 &amp;amp; 1/2  &amp;amp;-1/2 \end{bmatrix} &#xA;\begin{bmatrix}  &#xA;     1   &amp;amp;  0   &amp;amp;  0  &amp;amp;   0\\&#xA;     0  &amp;amp;   0   &amp;amp;  0   &amp;amp;  0\\&#xA;     0   &amp;amp;  0   &amp;amp;  1 &amp;amp;    0\\&#xA;     0    &amp;amp; 0   &amp;amp;  0   &amp;amp;  0&#xA; \end{bmatrix} \begin{bmatrix} 1/\sqrt{2} \ \ \\ 0 \\ 1/2 \\ -1/2 \end{bmatrix} = \dfrac{1}{2} + \dfrac{1}{4} = \dfrac{3}{4}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;Also, the state post measurement is &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post} \rangle = \dfrac{M|\psi\rangle}{\sqrt{3/4}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can extend this to the case where the first qubit is mesured in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; too. In this case, the projective measurement &lt;span class=&quot;math-container&quot;&gt;$M = |1\rangle \langle 1| \otimes I$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-07T18:10:30.153" LastActivityDate="2021-02-07T18:10:30.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14771" PostTypeId="1" AcceptedAnswerId="14782" CreationDate="2020-11-21T19:54:40.933" Score="3" ViewCount="75" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\expectation}[1]{\mathop{\mathbb{E}} \left[ #1 \right] }&#xA;\newcommand{\Var}{\mathrm{Var}}$&lt;/span&gt; From Nielsen &amp;amp; Chuang 10th edition page 261:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Consider a classical algorithm for the counting problem which samples uniformly and independently &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times from the search space, and let &lt;span class=&quot;math-container&quot;&gt;$X1, \dots, X_k$&lt;/span&gt; be the results of the oracle calls, that is, &lt;span class=&quot;math-container&quot;&gt;$X_j = 1$&lt;/span&gt; if the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;th oracle call revealed a solution to the problem, and &lt;span class=&quot;math-container&quot;&gt;$X_j = 0$&lt;/span&gt; if the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;th oracle call did not reveal a solution to the problem. This algorithm returns the estimate &lt;span class=&quot;math-container&quot;&gt;$S \equiv N \times \sum_j X_j/k$&lt;/span&gt; for the number of solutions to the search problem. Show that the standard deviation in &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\bigtriangleup S = \sqrt{ M(N − M)/k }$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Var(S) = \expectation{S^2} - \expectation{S}^2 \tag1\label1&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\expectation{S} = N \times \sum_j \expectation{X_j}/k = \frac{N}{k} \sum_{j=1}^k \frac{M}{N} = M \tag2\label2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is an unbiased estimator of M.&lt;/p&gt;&#xA;&lt;p&gt;Now:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To calculate &lt;span class=&quot;math-container&quot;&gt;$\expectation{X_i X_j}$&lt;/span&gt; we need to consider 2 cases:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$i=j \implies \expectation{X_i X_i}=P(X_i=1)=M/N \tag4\label4$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$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$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Case 1 happens &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times, therefore case 2 must happen &lt;span class=&quot;math-container&quot;&gt;$k^2-k$&lt;/span&gt; times. So we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Putting \eqref{2} and \eqref{6} together, after some tedious algebra I got:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Var(S) = \frac{M}{k} \frac{(N-M)(N-k)}{N-1} \tag7\label7&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$k \ll N$&lt;/span&gt;, 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?&lt;/p&gt;&#xA;" OwnerUserId="12643" LastActivityDate="2020-11-22T13:07:42.040" Title="Nielsen &amp; Chuang Exercise 6.13: Standard deviation of classical counting algorithm" Tags="&lt;nielsen-and-chuang&gt;&lt;textbook-and-exercises&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14772" PostTypeId="2" ParentId="6728" CreationDate="2020-11-22T01:09:58.683" Score="0" Body="&lt;p&gt;Since you can get the state vector of the 5-qubit state, you can use the technique of -----&lt;strong&gt;partial-trace&lt;/strong&gt; to get the state of a specific qubit(This git-hub code implements partial trace using only &lt;code&gt;NumPy&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Here comes an example. Suppose you have a two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|0\rangle|0\rangle$&lt;/span&gt;. Then you produced a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=CNOT(H|0\rangle|0\rangle)$&lt;/span&gt; where the control of &lt;code&gt;CNOT&lt;/code&gt; is the first qubit. This produces one of the  Bell states, &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt;. Then you traced out the first qubit, the remaining matrix, &lt;strong&gt;I/2&lt;/strong&gt; is the density matrix of the second qubit, and you can read the probability of getting each result(50% for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The code for the upper example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.quantum_info import DensityMatrix&#xA;import numpy as np&#xA;def partial_trace(rho,qubit2keep):&#xA;#https://gist.github.com/neversakura/d6a60b4bb2990d252e9e89e5629d5553&#xA;    num_qubit=int(np.log2(rho.shape[0]))&#xA;    for i in range(len(qubit2keep)):&#xA;            qubit2keep[i]=num_qubit-1-qubit2keep[i]&#xA;    qubit_axis=[(i,num_qubit+i) for i in range(num_qubit)&#xA;                    if i not in qubit2keep]&#xA;    minus_factor=[(i,2*i) for i in range(len(qubit_axis))]&#xA;    minus_qubit_axis=[(q[0]-m[0],q[1]-m[1])&#xA;                        for q, m in zip(qubit_axis,minus_factor)]&#xA;    rho_res=np.reshape(rho,[2,2]*num_qubit)&#xA;    qubit_left=num_qubit-len(qubit_axis)&#xA;    for i,j in minus_qubit_axis:&#xA;        rho_res=np.trace(rho_res,axis1=i,axis2=j)&#xA;    if qubit_left&amp;gt;1:&#xA;        rho_res=np.reshape(rho_res,[2**qubit_left]*2)&#xA;    return rho_res&#xA;qr=QuantumRegister(2)&#xA;circ=QuantumCircuit(qr)&#xA;circ.h(qr[0])&#xA;circ.cx(qr[0],qr[1])&#xA;DM=DensityMatrix.from_instruction(circ)&#xA;print(DM.data)&#xA;PT=partial_trace(DM.data,[0])&#xA;print(PT)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I used a different to generate the state vector and the density matrix, besides I have done tiny adjustment on the &lt;code&gt;partial_trace' code to reverse it's qubit alignment to fit my own code. The two &lt;/code&gt;print` operation prints&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0.5&amp;amp;0&amp;amp;0&amp;amp;0.5\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0.5&amp;amp;0&amp;amp;0&amp;amp;0.5&amp;amp;\end{pmatrix}$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0.5&amp;amp;0.5\\0.5&amp;amp;0.5\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-22T01:37:59.693" LastActivityDate="2020-11-22T01:37:59.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14773" PostTypeId="2" ParentId="6842" CreationDate="2020-11-22T01:26:51.207" Score="2" Body="&lt;p&gt;Nielsen and Chuang Box 5.2 does indeed need more elaborate explanation.&lt;/p&gt;&#xA;&lt;p&gt;I’m going to describe the architecture of efficient &lt;span class=&quot;math-container&quot;&gt;$O(n^3)$&lt;/span&gt; modular exponentiation circuit from the paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9511018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;‘Quantum Networks for Elementary Arithmetic Operations’ – Vedral, Barenco, Ekert, 1995&lt;/a&gt;, for the case &lt;span class=&quot;math-container&quot;&gt;$n = 3$&lt;/span&gt; using specific 3-bit numeric values in order to make general approach more illustrative. It seems to be exactly what you need, since&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The circuit's efficiency is &lt;span class=&quot;math-container&quot;&gt;$O(n^3)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;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)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;The Idea&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let’s first revisit the idea which is used to construct the circuit of the interest. Using the property of modular multiplication &lt;span class=&quot;math-container&quot;&gt;$(A\times B) \mod{N} = (A \mod{N}\times B \mod{N}) \mod{N}$&lt;/span&gt;, we can see that modular exponentiation is a succession of modular multiplications:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y^x \mod{N} =(y^{x_02^0}\times y^{x_12^1}\times ...  \times y^{x_{n−1}2^{n−1}} ) \mod{N}=$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=(...([(y^{x_02^0 }\times y^{x_12^1} ) \mod{N}] \times ...  \times y^{x_{n−1}2^{n−1}} )\mod{N}...) \mod{N},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$x = x_02^0 + x_12^1 + ... + x_{n-1}2^{n-1}$&lt;/span&gt;.&#xA;Now, any modular multiplication operation can be represented by modular additions in the following way:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$zm \mod{N}=(z_0 2^0 m+z_1 2^1 m+..+z_{n−1}2^{n−1}m)\mod{N},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$z = z_02^0 + z_12^1 + ... + z_{n-1}2^{n-1}$&lt;/span&gt;.&#xA;Finally, modular addition can be represented using addition and logical operations, as you will see later in the text.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The Circuit&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Some comments on notations&lt;/em&gt;: wires marked in &lt;strong&gt;blue&lt;/strong&gt; 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 &lt;strong&gt;red&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;3-qubit addition circuit ADDER.&lt;/strong&gt;&lt;/em&gt;&#xA;We will use circuits CARRY and SUM which implement bitwise carry and sum operations.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mld3E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mld3E.png&quot; alt=&quot;CARRY and SUM&quot; /&gt;&lt;/a&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;CARRY and SUM are used to construct 3-qubit addition transformation ADDER&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BGM7P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BGM7P.png&quot; alt=&quot;ADDER&quot; /&gt;&lt;/a&gt;&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the number decoded with 3 qubits, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is the number decoded with 3 qubits, but the register &lt;span class=&quot;math-container&quot;&gt;$|b\rangle_b$&lt;/span&gt; contains additional qubit to account for the possibility of 4-bit result of addition.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;3-qubit modular addition circuit ADDER_MOD.&lt;/strong&gt;&lt;/em&gt;&#xA;Modular addition has two blocks: Block 1 and Block 2.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/XBjXv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XBjXv.png&quot; alt=&quot;ADDER_MOD&quot; /&gt;&lt;/a&gt;&#xA;The logic of the Block 1 is the following: firstly, ADDER acts&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&#xA;Then 3 SWAP gates swap the register &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; with the register &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&#xA;Then reverse ADDER extracts &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&#xA;At that point we are interested in the sign of &lt;span class=&quot;math-container&quot;&gt;$a+b-N$&lt;/span&gt;. If it is greater than 0, we want to keep the result in the register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, but if it is less than 0, we want to make addition of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; once again to get &lt;span class=&quot;math-container&quot;&gt;$a+b$&lt;/span&gt; in the register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, and this is why see CNOTs, the third ADDER and SWAPS in the rest of Block 1.&lt;/p&gt;&#xA;&lt;p&gt;Note that CNOTs denoted by red color are there to make transformation &lt;span class=&quot;math-container&quot;&gt;$|N\rangle_a\rightarrow |0\rangle_a$&lt;/span&gt; before ADDER if the value of register &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_t$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$N=5=101_2$&lt;/span&gt; we need 2 CNOTs before ADDER and 2 CNOTS after ADDER, but if &lt;span class=&quot;math-container&quot;&gt;$N=6=111_2$&lt;/span&gt;, we would have to use 3 red CNOTs before ADDER and 3 red CNOTS after ADDER.&lt;/p&gt;&#xA;&lt;p&gt;The role of the Block 2 is to uncompute the value &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_t$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_t$&lt;/span&gt;, if it appears.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;3-qubit controlled modular multiplication circuit Ctrl_MULT_MOD.&lt;/strong&gt;&lt;/em&gt;&#xA;Block Ctrl_MULT_MOD implements the following transformation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&#xA;For this particular block we use &lt;span class=&quot;math-container&quot;&gt;$m=3=11_2, N=5=101_2$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/RonVe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RonVe.png&quot; alt=&quot;Ctrl_MULT_MOD&quot; /&gt;&lt;/a&gt;&#xA;The role of red Toffoli gates is to replace zeros in the register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_a$&lt;/span&gt; with the state &lt;span class=&quot;math-container&quot;&gt;$|m\times z_i 2^ \mod{N}\rangle_a$&lt;/span&gt; to further add up all this numbers to get &lt;span class=&quot;math-container&quot;&gt;$|z\times  \mod{N}\rangle_b$&lt;/span&gt;. Red Toffoli gates put values &lt;span class=&quot;math-container&quot;&gt;$m\times 2^i \mod{N}$&lt;/span&gt; in the register &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; conditionally on values in registers &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. Note that numbers &lt;span class=&quot;math-container&quot;&gt;$m\times 2^i \mod{N}$&lt;/span&gt; can be classically and efficiently computed. Also note that this is the second time when classically known information affects configuration of the circuit itself.&lt;/p&gt;&#xA;&lt;p&gt;The last block of CNOTs is used to put value &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; in the register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_b$&lt;/span&gt; if control &lt;span class=&quot;math-container&quot;&gt;$|c\rangle_x$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_x$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;3-qubit modular exponentiation circuit MODULAR_EXPONENTIATION.&lt;/strong&gt;&lt;/em&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$(...)^{−1}\mod{N}$&lt;/span&gt; is for modular inverse, which can be efficiently classically precomputed using Euclid’s algorithm.&lt;/p&gt;&#xA;&lt;p&gt;To sum up, this Ctrl_MULT_MOD blocks implement the following chain of transformations which lead to the desired result:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|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$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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,$$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fVmjh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fVmjh.png&quot; alt=&quot;MODULAR_EXPONENTIATION&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The last thing I want to mention is that if the size of the register &lt;span class=&quot;math-container&quot;&gt;$|N\rangle_N$&lt;/span&gt; is n, then the size of the register &lt;span class=&quot;math-container&quot;&gt;$|x\rangle_x$&lt;/span&gt; should be &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; to make MODULAR_EXPONENTIATION circuit usable in Shor's algorithm. As one can see from the last picture, going to &lt;span class=&quot;math-container&quot;&gt;$2n = 6$&lt;/span&gt; qubits in &lt;span class=&quot;math-container&quot;&gt;$|x\rangle_x$&lt;/span&gt; for this particular case requires just additional 3 wires for &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and additional 3 blocks of [Ctrl_MULT_MOD - SWAPs - inverse Ctrl_MULT_MOD].&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Regarding your question&lt;/strong&gt; about changes which occur when we go from &lt;span class=&quot;math-container&quot;&gt;$11^x \mod{15}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$7^x \mod{21}$&lt;/span&gt;: for &lt;span class=&quot;math-container&quot;&gt;$N=15$&lt;/span&gt; we need 4 bits to encode this number, so the current architecture requires 8 or less qubits for the register &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, 4 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, 4 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, 4+1 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, 4 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, 4 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and 1 qubit for control &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. If we use &lt;span class=&quot;math-container&quot;&gt;$N=21$&lt;/span&gt;, then it will be 10 or less qubits for the register &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, 5 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, 5 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, 5+1 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, 5 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, 5 qubits for the register &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and 1 qubit for control &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;. So one can see that number of qubits grows as &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;, which is acceptable according to the original paper&lt;/p&gt;&#xA;" OwnerUserId="13812" LastEditorUserId="13812" LastEditDate="2020-11-24T01:18:05.560" LastActivityDate="2020-11-24T01:18:05.560" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14774" PostTypeId="1" AcceptedAnswerId="14875" CreationDate="2020-11-22T01:40:51.257" Score="2" ViewCount="56" Body="&lt;p&gt;Consider a circuit acting on &lt;span class=&quot;math-container&quot;&gt;$n\geq2p+1$&lt;/span&gt; qubits. The first &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; qubits encode some unknown state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Next &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; qubits encode a fixed given basis state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=|\ldots f_2f_1f_0\rangle$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$(2p+1)$&lt;/span&gt;th qubit is initialized in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. Using the standard set of gates, how can I check if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and put the result of this comparison into the &lt;span class=&quot;math-container&quot;&gt;$2p+1$&lt;/span&gt;th qubit? (I wrote &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\geq$&lt;/span&gt;&amp;quot; in case we need ancillas).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Please note that my question is &lt;strong&gt;NOT&lt;/strong&gt; about comparing two arbitrary states. One state is a known state from the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2020-11-27T20:32:55.010" LastActivityDate="2020-11-28T07:20:45.460" Title="Check if $|\psi\rangle$ is equal to a fixed basis state using the standard set of gates" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14775" PostTypeId="2" ParentId="14774" CreationDate="2020-11-22T03:14:14.793" Score="1" Body="&lt;p&gt;Yes, SWAP can be used, &lt;a href=&quot;https://www.nature.com/articles/s41467-020-14454-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;There are two metrics to compare the similarity between two quantum states, trace distance &lt;span class=&quot;math-container&quot;&gt;$D(p_x,q_x)=\frac{1}{2}\displaystyle\sum_x|p_x-q_x|$&lt;/span&gt; where ps and qs are probility distribution, and fidelity &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma)=tr\sqrt{\rho^{1/2}\sigma\rho^{1/2}}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are density matrices, see &lt;a href=&quot;https://aapt.scitation.org/doi/abs/10.1119/1.1463744?journalCode=ajp&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielson's book&lt;/a&gt; for more detail.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-22T03:14:14.793" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14776" PostTypeId="1" AcceptedAnswerId="14780" CreationDate="2020-11-22T03:22:56.407" Score="4" ViewCount="80" Body="&lt;p&gt;From my understanding, a qubit is entangled when the state of one qubit depends on the other, and &lt;em&gt;vice versa&lt;/em&gt;. Can the following bell states have probability amplitudes other than 1/2 and still be entangled?:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ |\Phi^\pm\rangle = \frac{1}{\sqrt{2}} (|0\rangle_A \otimes |0\rangle_B \pm |1\rangle_A \otimes |1\rangle_B) $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${\displaystyle &#xA;|\Psi ^{\pm }\rangle ={\frac {1}{\sqrt {2}}}(|0\rangle _{A}\otimes |1\rangle _{B}\pm |1\rangle _{A}\otimes |0\rangle _{B})}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, is it possible to have bell pairs with probability amplitudes that are not &lt;span class=&quot;math-container&quot;&gt;$ \dfrac{1}{\sqrt{2}}$&lt;/span&gt;, but rather something like this: &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle = \frac{\sqrt{3}}{2} (|00 \rangle + \frac{1}{2} |11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13081" LastEditorUserId="55" LastEditDate="2020-11-23T19:40:48.603" LastActivityDate="2021-01-27T18:53:47.200" Title="Can the following Bell states have probability amplitudes other than 1/2 and still be entangled?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14777" PostTypeId="2" ParentId="14776" CreationDate="2020-11-22T04:39:02.997" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;But they can be entangled. Assuming that you wanted a state like: &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle = \frac{\sqrt{3}}{2} |00\rangle + \frac{1}{2} |11\rangle$&lt;/span&gt;, it is indeed entangled. You can look up &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peres-Horodecki&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;The state that you have mentioned at the end, &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;, is not a valid quantum state. The squared sum of amplitudes must be 1.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="2403" LastEditDate="2020-11-22T04:45:17.493" LastActivityDate="2020-11-22T04:45:17.493" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14778" PostTypeId="2" ParentId="6728" CreationDate="2020-11-22T04:51:27.260" Score="0" Body="&lt;p&gt;The formula should be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle h |( \mathbb{I} \otimes |1\rangle\langle1| \otimes \mathbb{I}\otimes \mathbb{I}\otimes \mathbb{I})|h\rangle.&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-11-22T04:51:27.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14779" PostTypeId="1" CreationDate="2020-11-22T05:29:52.353" Score="-1" ViewCount="47" Body="&lt;p&gt;How can I perform an operation similar to &lt;code&gt;Numpy.exp()&lt;/code&gt; in qiskit?&lt;/p&gt;&#xA;" OwnerUserId="13399" LastEditorUserId="5955" LastEditDate="2020-11-23T13:21:41.867" LastActivityDate="2020-11-23T13:21:41.867" Title="How to calculate the exponential of all elements in an input array using qiskit?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;algorithm&gt;&lt;mathematics&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="9" ClosedDate="2020-11-29T15:04:47.977" ContentLicense="CC BY-SA 4.0" />
  <row Id="14780" PostTypeId="2" ParentId="14776" CreationDate="2020-11-22T05:39:33.990" Score="1" Body="&lt;p&gt;Absolutely.&lt;/p&gt;&#xA;&lt;p&gt;Given an arbitrary two-qubit  state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle $&lt;/span&gt;, it is NOT entangled if we can write &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle  $&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = |a\rangle \otimes |b\rangle  \hspace{.75 cm} \textrm{where} \ \ |a\rangle, |b \rangle \in \mathbb{C}^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{\sqrt{3}}{2}|00\rangle + \dfrac{1}{2}|11\rangle $&lt;/span&gt; is less entangled than the Bell states. In fact, we can quantify this using the concept of &amp;quot;Concurrence&amp;quot; which is directly related to the concept of &amp;quot;Entanglement of Formation&amp;quot; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9709029&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here is the original paper on these concepts&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;For the Bell state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{Bell} \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $&lt;/span&gt;, the Concurrence measurement is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, which is the same for entanglement of formation.&lt;/p&gt;&#xA;&lt;p&gt;For another state, say the one you interested in, &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle = \dfrac{\sqrt{3}}{2}|00\rangle + \dfrac{1}{2}|11\rangle $&lt;/span&gt;, you can work out the Concurrence measurement value for this state to be &lt;span class=&quot;math-container&quot;&gt;$\dfrac{3}{4}$&lt;/span&gt; which is less than &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Thus, one would say that this state is less entangled than the Bell state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{Bell} \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="10480" LastEditDate="2021-01-27T18:53:47.200" LastActivityDate="2021-01-27T18:53:47.200" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14781" PostTypeId="2" ParentId="14779" CreationDate="2020-11-22T05:45:05.387" Score="2" Body="&lt;p&gt;Just import numpy and use it as usual. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;array = [1, 2 , 3]&#xA;exp_array = np.exp(array)&#xA;print('expoential of array:', exp_array)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;expoential of array: [ 2.71828183  7.3890561  20.08553692]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-22T05:45:05.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14782" PostTypeId="2" ParentId="14771" CreationDate="2020-11-22T13:07:42.040" Score="4" Body="&lt;p&gt;Since the classical algorithm samples &amp;quot;uniformly and &lt;em&gt;independently&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$$&lt;/span&gt; times from the search space&amp;quot;, equation &lt;span class=&quot;math-container&quot;&gt;$(5)$&lt;/span&gt; should be, &lt;span class=&quot;math-container&quot;&gt;$P(X_i=1, X_j=1)= P(X_i=1)P(X_j=1)=\frac{M^2}{N^2}$&lt;/span&gt; instead. If you substitute &lt;span class=&quot;math-container&quot;&gt;$(5)$&lt;/span&gt; with this, you would arrive at the book's standard deviation.&lt;/p&gt;&#xA;" OwnerUserId="7460" LastActivityDate="2020-11-22T13:07:42.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14783" PostTypeId="2" ParentId="14763" CreationDate="2020-11-22T13:35:00.063" Score="4" Body="&lt;p&gt;In the following, I'll show the evaluation of the probability densities of the transition probabilities: &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi | z\rangle^2$&lt;/span&gt; and their pairwise independence. I didn't work out the full mutual independence.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit pure states span the complex projective space &lt;span class=&quot;math-container&quot;&gt;$CP^{N-1}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt;. Pure &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit states can be parametrized almost everywhere as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle  = \frac{[1, \zeta _1,.,.,., \zeta _{N-1}]^t}{\sqrt{1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta} }}$$&lt;/span&gt;&#xA;(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)&lt;/p&gt;&#xA;&lt;p&gt;The Haar volume element of &lt;span class=&quot;math-container&quot;&gt;$CP^{N-1}$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is normalized to a unit total volume.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\int_{CP^{N-1}} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta})} = 1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the scalar product &lt;span class=&quot;math-container&quot;&gt;$\langle z_k|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle $&lt;/span&gt; only one term &lt;span class=&quot;math-container&quot;&gt;$\zeta_k$&lt;/span&gt; survives. It is exactly at the index &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; whose binary representation contains ones in the places where the string &lt;span class=&quot;math-container&quot;&gt;$z_k$&lt;/span&gt; has ones and zeros where the string &lt;span class=&quot;math-container&quot;&gt;$z_k$&lt;/span&gt; has zeros.&lt;/p&gt;&#xA;&lt;p&gt;Thus, we get the following expression for the transition squared amplitude (for an arbitrary &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the probability density of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is the Dirac delta function.&#xA;Defining:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x = \sum_{j\ne k} \bar{\zeta_j} \zeta_j$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$u_k = \bar{\zeta_k} \zeta_k $$&lt;/span&gt;&#xA;and in addition, expressing the integration elements over &lt;span class=&quot;math-container&quot;&gt;$\bar{\zeta_k}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\zeta_k$&lt;/span&gt; in polar coordinates:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ d\zeta_k d\bar{\zeta}_k = \frac{1}{2} du_k d\theta_k$$&lt;/span&gt;&#xA;We obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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}$$&lt;/span&gt;&#xA;Performing another change of variables:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$v_k = \frac{u_k}{1+x}$$&lt;/span&gt;&#xA;We obtain:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&#xA;Using the properties of the Dirac delta function:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\delta\left(\alpha - \frac{v_k }{(1+v_k)}\right) = (1+v_k) \delta\left(v_k- \frac{\alpha }{(1-\alpha)}\right) $$&lt;/span&gt;&#xA;Substituting into the integral (and performing the trivial integral over &lt;span class=&quot;math-container&quot;&gt;$\theta_k$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\int d{\theta_k}  = 2\pi$&lt;/span&gt;, we obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}}$$&lt;/span&gt;&#xA;The integral with its pre-factor is just the normalized volume element of &lt;span class=&quot;math-container&quot;&gt;$CP^{N-2}$&lt;/span&gt;. i.e., equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&#xA;Thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f_{\alpha}(\alpha) = (N-1) (1-\alpha)^{N-3}$$&lt;/span&gt;&#xA;In the limit &lt;span class=&quot;math-container&quot;&gt;$N\rightarrow \infty$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Pairwise independence&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$l\ne k$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&#xA;The joint probability density:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Pursuing the same method as above, separation of the coordinates &lt;span class=&quot;math-container&quot;&gt;$\zeta_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\zeta_l$&lt;/span&gt; from the other coordinates and defining:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$x = \sum_{j\ne k,l} \bar{\zeta_j} \zeta_j,$$&lt;/span&gt;&#xA;then performing the necessary changes of variables and the polar angular trivial integrations, we arrive at:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Again, using the transformation properties of the delta functions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&#xA;and after the substitution, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$dv_k dv_l = \frac{d\alpha d\beta}{(1-\alpha - \beta)^3 }$$&lt;/span&gt;&#xA;Thus, we are left with:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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}}$$&lt;/span&gt;&#xA;Again, the integral with its pre-factor is just the normalized volume element of &lt;span class=&quot;math-container&quot;&gt;$CP^{N-3}$&lt;/span&gt;.&#xA;Thus, we are left with:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f_{\alpha, \beta}(\alpha, \beta) = (N-1)(N-2) (1-\alpha-\beta)^{N-6}$$&lt;/span&gt;&#xA;In the limit &lt;span class=&quot;math-container&quot;&gt;$N\rightarrow \infty$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the random variables are pairwise independent.&lt;/p&gt;&#xA;&lt;p&gt;Without the large &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; approximation, the joint distribution function is not equal to the product of the individual distributions.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2020-11-23T08:04:20.850" LastActivityDate="2020-11-23T08:04:20.850" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14784" PostTypeId="1" CreationDate="2020-11-22T14:31:00.760" Score="0" ViewCount="23" Body="&lt;p&gt;My question is very related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6935/intuition-about-knill-laflamme-qec-conditions&quot;&gt;Intuition about Knill-Laflamme QEC conditions&lt;/a&gt; but in the particular case of Stabilizer code.&lt;/p&gt;&#xA;&lt;p&gt;In Nielsen&amp;amp;Chuang, the theorem 10.8 on page 466 gives error-correction conditions for stabilizer codes. It is stated as the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Let S be the stabilizer for a stabilizer code &lt;span class=&quot;math-container&quot;&gt;$C(S)$&lt;/span&gt;. Suppose &lt;span class=&quot;math-container&quot;&gt;$\{E_j\}$&lt;/span&gt; is a set of operators in &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\forall (j,k), E_j^{\dagger} E_k \notin N(S)-S$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$\{E_j\}$&lt;/span&gt; is a set of correctable error for the code &lt;span class=&quot;math-container&quot;&gt;$C(S)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Notations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt;: n-Pauli group&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;: Stabilizer group associated to &lt;span class=&quot;math-container&quot;&gt;$C(S)$&lt;/span&gt;. I assume &lt;span class=&quot;math-container&quot;&gt;$S=&amp;lt;g_1,...,g_l&amp;gt;$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$g_i$&lt;/span&gt; are independant generators.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt;: normalizer, which is actually equal to the centralizer of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z(S)$&lt;/span&gt; (the set of all element in &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; which commute with &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;h2&gt;My question:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;I want to have an intuitive feeling about what it means&lt;/strong&gt;. For me the conditions here are much more restrictive than what it is enough to have. Which is not necesseraly absurd as it is only a sufficient condition that is provided but I want to check.&lt;/p&gt;&#xA;&lt;p&gt;Let's assume that a potential error &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; occured. What happens is that we will measure all the generators. Different scenario can occur:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; commute with all generators.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$II$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; anticommute with at least one of them.&lt;/p&gt;&#xA;&lt;p&gt;In &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;: two subcases:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I.a$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\forall |\psi\rangle \in C(S)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$E_j |\psi \rangle = |\psi \rangle$&lt;/span&gt;: no error actually occured.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I.b$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\exists|\psi\rangle \in C(S)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$E_j |\psi \rangle \neq |\psi \rangle$&lt;/span&gt;: an error occured.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$I.a$&lt;/span&gt; is not a problem, &lt;span class=&quot;math-container&quot;&gt;$I.b$&lt;/span&gt; would lead to an uncorrectable error.&lt;/p&gt;&#xA;&lt;p&gt;Now, for &lt;span class=&quot;math-container&quot;&gt;$II$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;Let's assume that for us, &lt;span class=&quot;math-container&quot;&gt;$\forall i \in A, E_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_j$&lt;/span&gt; would give the same measurement for the generators (but those error are different). This is how the ensemble &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is defined here. What is important is that if I apply the &amp;quot;wrong&amp;quot; correction: &lt;span class=&quot;math-container&quot;&gt;$E_i^{\dagger}$&lt;/span&gt;, I will fix the state.&lt;/p&gt;&#xA;&lt;p&gt;Thus the condition should be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\forall i \in A, E_i^{\dagger} E_j$&lt;/span&gt; should commute with all the generators (such that after error+correction we are in &lt;span class=&quot;math-container&quot;&gt;$C(S)$&lt;/span&gt; and verify: &lt;span class=&quot;math-container&quot;&gt;$\forall |\psi \rangle \in C(S): E_i^{\dagger} E_j |\psi\rangle = |\psi \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the questions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Do you at least agree with how I understand the physics here ?&lt;/li&gt;&#xA;&lt;li&gt;Is it possible to get more intuition on the exact condition provided by the book then, as they are different from what I see ? I know that from them we can prove they imply the Knill-Laflamme conditions. But isn't it possible to have intuition directly from the conditions on stabilizer codes ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2020-11-22T14:31:00.760" Title="Intuition behind Stabilizer code conditions" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14785" PostTypeId="1" AcceptedAnswerId="15080" CreationDate="2020-11-22T16:06:09.377" Score="1" ViewCount="42" Body="&lt;p&gt;Suppose I have three different operators &lt;span class=&quot;math-container&quot;&gt;$U_1, U_2,U_3$&lt;/span&gt;. Now, these three operators will be applied if my current state of the system is &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle,|\psi_1\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&lt;p&gt;Now suppose I started with some initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{initial}\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;I know we can't measure the state as it will collapse the system. So, what method can be applied here?&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2020-11-27T19:09:26.420" LastActivityDate="2020-12-10T09:26:44.933" Title="How to apply a operator to qubit system on the basis of current state of system?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;quantum-state&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14786" PostTypeId="1" CreationDate="2020-11-22T19:03:49.957" Score="2" ViewCount="112" Body="&lt;p&gt;When calculating the probability of getting +1 on X-basis on the first qubit of Bell's state  &lt;span class=&quot;math-container&quot;&gt;$|01\rangle+|10\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When calculating the probability of getting +1 on Z-basis on the first qubit of Bell's state  &lt;span class=&quot;math-container&quot;&gt;$|01\rangle+|10\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What is other possible result of measuring X and Z, for example, XX, XZ, ZX, ZZ ?&lt;/p&gt;&#xA;&lt;p&gt;How to build a table to compile all of the possible results?&lt;/p&gt;&#xA;" OwnerUserId="13823" LastEditorUserId="55" LastEditDate="2020-11-27T19:09:50.340" LastActivityDate="2021-02-12T22:05:34.820" Title="What are the possible results of measuring $X$ and $Z$ on the state $|01\rangle+|10\rangle$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14787" PostTypeId="1" AcceptedAnswerId="14791" CreationDate="2020-11-22T19:05:04.547" Score="2" ViewCount="66" Body="&lt;p&gt;In this example implementation of Grovers Algorithm from the Qiskit Textbook which solves a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; sudoku puzzle:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The circuit iterates twice (see picture)&lt;/p&gt;&#xA;&lt;p&gt;My question is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;How is the data in the &lt;span class=&quot;math-container&quot;&gt;$c_0 - c_3$&lt;/span&gt; and out0 qubits utilised.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;To me it looks like &lt;span class=&quot;math-container&quot;&gt;$c_0 - c_3$&lt;/span&gt; and out are never fed back into the &lt;span class=&quot;math-container&quot;&gt;$v_0 - v_3$&lt;/span&gt; qubits, and &lt;span class=&quot;math-container&quot;&gt;$v_0 - v_3$&lt;/span&gt; are the only ones that are measured at the end.&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure if I've misinterpreted how entanglement works here, or how the CX gates work.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dsrLs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dsrLs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13909" LastEditorUserId="55" LastEditDate="2020-11-27T19:10:03.247" LastActivityDate="2020-11-27T19:10:03.247" Title="How does feedback work in simple Grovers algorithm where $n=4$?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14788" PostTypeId="2" ParentId="14786" CreationDate="2020-11-22T19:30:16.417" Score="2" Body="&lt;p&gt;Starting with the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|01\rangle + |10 \rangle }{\sqrt{2}} =   \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix}   $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you want to find the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in observable &lt;span class=&quot;math-container&quot;&gt;$X  = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt; for the first qubit, and &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in the observable   &lt;span class=&quot;math-container&quot;&gt;$Z  = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1 \end{pmatrix} $&lt;/span&gt; for the second qubit then you can calculate it as &lt;span class=&quot;math-container&quot;&gt;$\langle \psi| M | \psi \rangle  = Tr(\rho M)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi \rangle \langle \psi |$&lt;/span&gt; and here &lt;span class=&quot;math-container&quot;&gt;$M = |+\rangle\langle +| \otimes |0\rangle\langle 0 |$&lt;/span&gt;  since &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} $&lt;/span&gt; is the eigenvector corresponding to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} $&lt;/span&gt; is the eigenvector corresponding to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. So explicitly&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} M = |+\rangle \langle+| \otimes |0\rangle\langle 0| &amp;amp;= \bigg[ \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}  \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1 \end{pmatrix} \bigg] \otimes \bigg[ \begin{pmatrix} 1 \\ 0 \end{pmatrix}  \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} \bigg] \\ &#xA;&amp;amp;=  \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; 1  \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0\end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\end{pmatrix} &#xA;\end{align}&lt;/span&gt;&#xA;Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi| M | \psi \rangle =  \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\end{pmatrix}     \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} = \dfrac{1}{4} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also note that, the above is the same if we have done &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho M)$&lt;/span&gt; since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr\bigg( \rho M  \bigg) = Tr\bigg(  \begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 1/2 &amp;amp; 1/2 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\end{pmatrix}  \bigg) = \dfrac{1}{4}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;You can extend this to other cases as well.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to do sequential measurement, then you can find the the post measurement state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{post}$&lt;/span&gt; then follow the same procedure.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if we again start with &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|01\rangle + |10 \rangle }{\sqrt{2}} =   \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix}   $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we want to  find the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in observable &lt;span class=&quot;math-container&quot;&gt;$X  = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt; for the first qubit. Then afterward, finding the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in observable &lt;span class=&quot;math-container&quot;&gt;$X $&lt;/span&gt; for the first qubit, and &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in the observable   &lt;span class=&quot;math-container&quot;&gt;$Z = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1 \end{pmatrix} $&lt;/span&gt; for the second qubit on this collapsed state then we can do it as follow:&lt;/p&gt;&#xA;&lt;p&gt;First Step: To find the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in observable &lt;span class=&quot;math-container&quot;&gt;$X $&lt;/span&gt; we can construct &lt;span class=&quot;math-container&quot;&gt;$M  $&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;\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 &amp;amp; 1 \end{pmatrix} \bigg] \otimes  \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} &amp;amp;=  \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; 1  \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0  &amp;amp; 1\end{pmatrix} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi| M | \psi \rangle = \dfrac{1}{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the state after measurement, &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post}\rangle $&lt;/span&gt;, is going to be&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\psi_{post}\rangle  = \dfrac{ M |\psi \rangle }{ \sqrt{prob(+1)}} = \dfrac{ \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0  &amp;amp; 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} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Second Step: Now the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in observable &lt;span class=&quot;math-container&quot;&gt;$X $&lt;/span&gt; for the first qubit, and &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; in the observable   &lt;span class=&quot;math-container&quot;&gt;$Z $&lt;/span&gt; for the second qubit on this collapsed state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post} \rangle$&lt;/span&gt; can be calculated as &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_{post} | M | \psi_{post} \rangle $&lt;/span&gt; where again &lt;span class=&quot;math-container&quot;&gt;$M = |+\rangle\langle +| \otimes |0\rangle\langle 0 |$&lt;/span&gt; (as indicated why on the top of this answer). Hence this probability is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \psi_{post} | M | \psi_{post} \rangle = \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 0\end{pmatrix} \dfrac{1}{2} \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} = \dfrac{1}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the post state after this process, &lt;span class=&quot;math-container&quot;&gt;$|\psi_{post 2} \rangle$&lt;/span&gt; is now in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{post 2} \rangle = \dfrac{ \dfrac{1}{2}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0  &amp;amp; 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}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-11-23T20:15:56.130" LastActivityDate="2020-11-23T20:15:56.130" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14790" PostTypeId="2" ParentId="14762" CreationDate="2020-11-22T21:13:53.190" Score="1" Body="&lt;p&gt;I found a way to do it for the &lt;span class=&quot;math-container&quot;&gt;$2\to1$&lt;/span&gt; QRAC. I simply guessed that we could leave the measurement bases as they are, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; for the first bit, and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; for the second bit, and added &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;|\psi_{00}\rangle &amp;amp; = \sqrt{p}|0\rangle + \sqrt{1-p}\ e^{\frac{\pi i}4}|1\rangle \\&#xA;|\psi_{01}\rangle &amp;amp; = \sqrt{p}|0\rangle + \sqrt{1-p}\ e^{-\frac{3\pi i }4}|1\rangle \\&#xA;|\psi_{10}\rangle &amp;amp; = \sqrt{1-p}|0\rangle + \sqrt{p}\ e^{-\frac{\pi i}4}|1\rangle \\&#xA;|\psi_{11}\rangle &amp;amp; = \sqrt{1-p}|0\rangle + \sqrt{p}\ e^{\frac{3\pi i}4}|1\rangle,&#xA;\end{align*}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p=\frac{3+\sqrt3}{6}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Now for the &lt;span class=&quot;math-container&quot;&gt;$3\to1$&lt;/span&gt; case such a simply idea cannot work, as you want to extract 7 different functions, but there are only these 3 &lt;a href=&quot;https://en.wikipedia.org/wiki/Mutually_unbiased_bases&quot; rel=&quot;nofollow noreferrer&quot;&gt;mutually unbiased bases&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-11-22T21:13:53.190" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14791" PostTypeId="2" ParentId="14787" CreationDate="2020-11-23T00:59:47.500" Score="1" Body="&lt;p&gt;The quantum register &lt;code&gt;c&lt;/code&gt; can be regarded as ancilla. For the first part of each iteration(before the &lt;code&gt;CCCC-NOT&lt;/code&gt;), each two &lt;code&gt;cx&lt;/code&gt; compares if the state of the two qubits is identical, if not, one ancilla will be converted to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The &lt;code&gt;CCCC-NOT&lt;/code&gt; checks whether the four ancillae are all &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, if so, a phase-flip operation is implemented.&lt;/p&gt;&#xA;&lt;p&gt;The second part of each iteration(between &lt;code&gt;CCCC-NOT&lt;/code&gt; and the diffusion unitary) converts the ancillae into its original state(&lt;span class=&quot;math-container&quot;&gt;$|0000\rangle$&lt;/span&gt;, for reversibility). The action of diffusion unitary should be familiar to you.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-23T00:59:47.500" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14793" PostTypeId="1" CreationDate="2020-11-23T06:02:06.350" Score="2" ViewCount="54" Body="&lt;p&gt;I'm reading about surface code theory recently (&lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1208/1208.0928.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. A 86, 032324&lt;/a&gt;). 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(&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0403025.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Phys. Rev. A 71, 022316&lt;/a&gt;). But when back to the circuits below, I still can not figure out the process how it work.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/B4cTo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B4cTo.png&quot; alt=&quot;Distillation circuit for the |YL&amp;gt; ancilla state&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/twjaW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/twjaW.png&quot; alt=&quot;Distillation circuit for the |AL&amp;gt; ancilla state&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11562" LastEditorUserId="55" LastEditDate="2020-11-25T09:04:43.573" LastActivityDate="2020-11-25T09:04:43.573" Title="How to understand the circuits used for magic state distillation in surface code?" Tags="&lt;circuit-construction&gt;&lt;surface-code&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14796" PostTypeId="1" CreationDate="2020-11-23T19:46:28.230" Score="2" ViewCount="34" Body="&lt;p&gt;There are numerous questions that asks about practical application demonstration of the Grover algorithm for arrays and databases.&lt;/p&gt;&#xA;&lt;p&gt;However examples are not seen anywhere.&lt;/p&gt;&#xA;&lt;p&gt;While searching for its practicality, I came across with study &lt;a href=&quot;https://www.researchgate.net/publication/3422744_Is_Quantum_Search_Practical&quot; rel=&quot;nofollow noreferrer&quot;&gt;Is Quantum Search Practical&lt;/a&gt; which states that creation of the oracle is a hardware level aspect (section 4 - Oracle implementation).&lt;/p&gt;&#xA;&lt;p&gt;Can I get please get some support in clarifying this?&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="55" LastEditDate="2020-11-25T09:05:25.317" LastActivityDate="2020-11-25T09:05:25.317" Title="Is Grovers Algorithm Oracle creation a hardware level aspect?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;physical-realization&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14797" PostTypeId="2" ParentId="14796" CreationDate="2020-11-23T19:55:56.393" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-23T19:55:56.393" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14798" PostTypeId="1" CreationDate="2020-11-23T21:08:01.107" Score="3" ViewCount="64" Body="&lt;p&gt;Suppose we have the normalised states &lt;span class=&quot;math-container&quot;&gt;$|\phi_{1}\rangle,|\phi_{2}\rangle \in A \otimes B$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional complex vector spaces.&lt;/p&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$|\langle\phi_{2}|\phi_{1}\rangle|  &amp;lt; 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can we say what is the upper bound of &lt;span class=&quot;math-container&quot;&gt;$\| \mathrm{Tr}_{B} (|\phi_{1}\rangle\langle\phi_{2}| )\|_{1}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="11616" LastEditorUserId="55" LastEditDate="2020-11-25T09:06:49.013" LastActivityDate="2020-11-25T09:06:49.013" Title="How can we upper bound the norm of a partial trace?" Tags="&lt;mathematics&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;&lt;trace-distance&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14799" PostTypeId="2" ParentId="13592" CreationDate="2020-11-23T21:13:30.127" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; are two measurement of decoherence on a qubit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; is known as the &amp;quot;relaxation time&amp;quot; or &amp;quot;longitudinal coherence time&amp;quot; or &amp;quot;amplitude damping&amp;quot;.... It measures the loss of energy from the system. You can calibrate/measure/determine the &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; time by first initialize the qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, where &lt;span class=&quot;math-container&quot;&gt;$X = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} = |0\rangle\langle 1| + |1\rangle \langle 0|$&lt;/span&gt;  and wait for certain amount of time and measure the probability of the state being in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; eigenstate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; is known as the &amp;quot;dephasing time&amp;quot; or &amp;quot;transverse coherence time&amp;quot; or &amp;quot;phase coherence time&amp;quot; or &amp;quot;phase damping&amp;quot; ... and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; can be determined by again initialize the qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then apply the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt; to the inital qubit state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. We will also wait for some time, &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, and then apply another Hadamard gate, then measure the probability of the qubit being in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Here, as you can see, if we have no decoherence then the qubit will ended up back to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with 100% probability, as &lt;span class=&quot;math-container&quot;&gt;$HH|0\rangle = |0\rangle$&lt;/span&gt;. But of course this is not the case with qubit, the longer the wait time, the closer this probability will get to &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; as the qubit will go/dephase from the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; &lt;strong&gt;before&lt;/strong&gt; the second Hadamard gate. Which will then put the qubit back in the superposition state.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-23T21:13:30.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14800" PostTypeId="2" ParentId="14798" CreationDate="2020-11-23T21:29:31.307" Score="6" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-norm decreases under partial trace and so we have an upper bound of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; when the states are normalized,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathrm{Tr}_B[|\psi_1\rangle \langle \psi_2|]\|_1 \leq \||\psi_1\rangle \langle \psi_2|\|_1 = 1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This bound cannot be improved upon without extra information about the states. Here is a counterexample. Take &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle = |00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle = |10\rangle$&lt;/span&gt;. Then we have &lt;span class=&quot;math-container&quot;&gt;$\langle \psi_1 |\psi_2\rangle = 0$&lt;/span&gt;. Moreover we have,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\mathrm{Tr}_B[|\psi_1\rangle \langle \psi_2|]\|_1 = \||0 \rangle \langle 1|\|_1 = 1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-23T21:29:31.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14801" PostTypeId="1" CreationDate="2020-11-23T21:56:18.200" Score="1" ViewCount="75" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13823" LastEditorUserId="55" LastEditDate="2020-11-25T09:07:58.217" LastActivityDate="2020-12-24T01:50:33.690" Title="What is the meaning of measuring a Bell state with Pauli operators?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14802" PostTypeId="2" ParentId="14801" CreationDate="2020-11-24T00:14:39.200" Score="1" Body="&lt;p&gt;&lt;strong&gt;Postulates of Quantum Mechanics:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The state of quantum mechanical system, including all the information you can know about it. It is represented by a normalized ket &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;A physical observable is represented mathematically by an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; that acts on kets.&lt;/li&gt;&#xA;&lt;li&gt;The only possible result of a measurement of an observable is one of the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_n$&lt;/span&gt; of the corresponding operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;probability&lt;/strong&gt; of obtaining the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_n$&lt;/span&gt; in a measurement of the observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on the system in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\langle \lambda_n | \psi \rangle|^2 $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|a_n\rangle$&lt;/span&gt; is the normalized eigenvector of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; corresponding to the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$a_n$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;After measurement of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; that yields the result of &lt;span class=&quot;math-container&quot;&gt;$a_n$&lt;/span&gt;, the quantum system is in a new state that is normalized &lt;strong&gt;projection&lt;/strong&gt; of the original system ket onto the ket (or kets) corresponding to the result of the measurement:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_{post} \rangle = \dfrac{P_n |\psi \rangle}{ \sqrt{ \langle \psi | P_n | \psi \rangle} } $$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;(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 &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt; through the Schrodinger equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ i\hbar \dfrac{d}{dt} |\psi(t) \rangle = H(t)|\psi(t) \rangle $$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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. &lt;strong&gt;These postulate cannot be proven&lt;/strong&gt;, but hey have successfully tested by many experiments, and so we accept them as an accurate way to describe quantum mechanical systems.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Reference:&lt;/strong&gt;&lt;/em&gt; Quantum Mechanics by David H. McIntyre.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-24T01:50:33.690" LastActivityDate="2020-12-24T01:50:33.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14803" PostTypeId="1" CreationDate="2020-11-24T03:47:38.653" Score="1" ViewCount="77" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13921" LastEditorUserId="55" LastEditDate="2020-11-25T09:09:34.173" LastActivityDate="2020-11-25T09:09:34.173" Title="How can I verify that the Pauli group is a group? And is it abelian?" Tags="&lt;mathematics&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2020-11-29T15:00:47.100" ContentLicense="CC BY-SA 4.0" />
  <row Id="14804" PostTypeId="1" CreationDate="2020-11-24T04:54:12.763" Score="-2" ViewCount="50" Body="&lt;p&gt;Multiplication of two arrays in quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="13922" LastActivityDate="2020-11-24T05:50:01.317" Title="How can I multiply two arrays like [1,2,3] and [4,5,6] in quantum computing aspects?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;programming&gt;&lt;algorithm&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-11-29T15:01:30.117" ContentLicense="CC BY-SA 4.0" />
  <row Id="14805" PostTypeId="2" ParentId="14804" CreationDate="2020-11-24T05:50:01.317" Score="1" Body="&lt;p&gt;If you are asking how to multiply two arrays &lt;span class=&quot;math-container&quot;&gt;$u = [1,2,3]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v = [4,5,6]$&lt;/span&gt; in Qiskit setting  then you can do this as would normally do... by import numpy.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;u = [1,2,3]&#xA;v = [4,5,6]&#xA;product_uv = np.multiply(u,v)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;If you want to learn more about quantum computing, I suggest the &lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Textbook&lt;/a&gt;, and Prof. John Preskill's &lt;a href=&quot;http://theory.caltech.edu/%7Epreskill/ph229/notes/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lecture note&lt;/a&gt;  or &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this textbook&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-24T05:50:01.317" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14806" PostTypeId="2" ParentId="14803" CreationDate="2020-11-24T07:07:49.267" Score="3" Body="&lt;p&gt;For the three Pauli matrices, {&lt;span class=&quot;math-container&quot;&gt;${\sigma_1,\sigma_2}=0$&lt;/span&gt;}, so certainly this can not form an abelian group. The Pauli group is an isomorphism with &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The elements of the Pauli group are {&lt;span class=&quot;math-container&quot;&gt;${I, \sigma_x, \sigma_y, i\sigma_z, -I, -\sigma_x, -\sigma_y, -i\sigma_z}$&lt;/span&gt;}, so the order of this group is 8. In variant subgroups are {&lt;span class=&quot;math-container&quot;&gt;${I, -I}$&lt;/span&gt;}, {&lt;span class=&quot;math-container&quot;&gt;${I, -I, \sigma_{x/y}, -\sigma_{x/y}}$&lt;/span&gt;} and {&lt;span class=&quot;math-container&quot;&gt;${I, -I, i\sigma_z, -i\sigma_z}$&lt;/span&gt;}. &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; is the only emelemt in its class. {&lt;span class=&quot;math-container&quot;&gt;$\pm\sigma_{x/y}$&lt;/span&gt;} and {&lt;span class=&quot;math-container&quot;&gt;$\pm i\sigma_z$&lt;/span&gt;} forms a class( totally 5 classes).&#xA;Order 1 element: &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. Order 2 elements: &lt;span class=&quot;math-container&quot;&gt;$\sigma_x, \sigma_2, -I, -\sigma_x, -\sigma_y$&lt;/span&gt;. And Order 3 elements: &lt;span class=&quot;math-container&quot;&gt;$\pm i\sigma_z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Group_(mathematics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; for more detail.&lt;/p&gt;&#xA;&lt;p&gt;Here comes the group table of the Pauli group.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gSaks.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gSaks.png&quot; alt=&quot;Group table&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also see Wikipedia and check it is identical to the group table of &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt;(in fact the tables are different because the ordering of elements is different).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-11-24T08:22:51.813" LastActivityDate="2020-11-24T08:22:51.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14807" PostTypeId="1" AcceptedAnswerId="14808" CreationDate="2020-11-24T07:31:58.783" Score="1" ViewCount="317" Body="&lt;p&gt;Is it possible for me to construct a gate that inverse everything (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow -|0\rangle, |1\rangle \rightarrow -|1\rangle$&lt;/span&gt;, etc. basically like a &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; gate) from the basic &lt;span class=&quot;math-container&quot;&gt;$X, Y, Z, CX,...$&lt;/span&gt; gates, for any number of qubits? How do I do so if it's possible?&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="7598" LastActivityDate="2020-11-24T11:10:10.910" Title="How do I create an inverse identity gate?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;pauli-gates&gt;&lt;universal-gates&gt;&lt;clifford-group&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14808" PostTypeId="2" ParentId="14807" CreationDate="2020-11-24T07:44:16.743" Score="7" Body="&lt;p&gt;As a general rule, you wouldn't bother constructing this: it is just a global phase that has no observable consequence.&lt;/p&gt;&#xA;&lt;p&gt;If you really insist on doing this, introduce an ancilla qubit in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and apply a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate to it.&lt;/p&gt;&#xA;&lt;p&gt;PS &amp;quot;inverse identity gate&amp;quot; is a really bad name for it. The identity operation is its own inverse.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-24T07:44:16.743" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14809" PostTypeId="2" ParentId="14793" CreationDate="2020-11-24T08:24:07.873" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The 15-to-1 T state distillation circuit is &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B1%2C%22Z%22%2C%22Z%22%2C%22Z%22%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C%22Z%22%2C%22Z%22%2C1%2C%22Z%22%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C%22Z%22%2C1%2C%22Z%22%2C%22Z%22%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C1%2C%22Z%22%2C%22Z%22%2C%22Z%22%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C%22Z%22%2C%22Z%22%2C%22Z%22%2C%22Z%22%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C1%2C1%2C%22Z%22%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C1%2C%22Z%22%2C1%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C%22Z%22%2C1%2C1%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C1%2C%22Z%22%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C%22Z%22%2C1%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B%22Z%22%2C%22Z%22%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%8A%96%22%5D%2C%5B1%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%2C%22Z%5E%C2%BC%22%5D%2C%5B1%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B1%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%2C%22Measure%22%5D%2C%5B1%2C%22X%22%2C%22X%22%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22X%22%2C%22X%22%2C1%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C%22X%22%2C1%2C%22X%22%2C%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22X%22%2C%22X%22%2C%22X%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C%22X%22%2C%22X%22%2C%22X%22%2C%22X%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C1%2C1%2C%22X%22%2C%22X%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C1%2C%22X%22%2C1%2C%22X%22%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C%22X%22%2C1%2C1%2C%22X%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C1%2C%22X%22%2C%22X%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C%22X%22%2C1%2C%22X%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C%22X%22%2C%22X%22%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C%22Chance4%22%5D%2C%5B%22Amps1%22%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%2C%22%7C0%E2%9F%A9%E2%9F%A80%7C%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;an example circuit in Quirk&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-24T08:24:07.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14810" PostTypeId="2" ParentId="14807" CreationDate="2020-11-24T11:10:10.910" Score="3" Body="&lt;p&gt;You might be interested in controlled version of &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt;. Despite the fact that you can neglect global phase in case of non-controlled gates, you cannot do so in case of controlled version.&lt;/p&gt;&#xA;&lt;p&gt;The controled gate &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; is described by matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1\\&#xA;\end{pmatrix}&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This gate set a phase to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; (note that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{i\pi} = -1$&lt;/span&gt;) if control qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To implement the gate simply put &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$Z \otimes I$&lt;/span&gt; and hence the proposed construction really implements the requested gate.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-24T11:10:10.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14811" PostTypeId="1" AcceptedAnswerId="14812" CreationDate="2020-11-24T14:25:07.833" Score="-1" ViewCount="37" Body="&lt;p&gt;Can we create a Controlled gate with below functionality?&lt;/p&gt;&#xA;&lt;p&gt;if {a==|1&amp;gt; &amp;amp;&amp;amp; b==|1&amp;gt;} then {qc.x(b)}&lt;/p&gt;&#xA;&lt;p&gt;Basically, a CCX gate but the output Qubit is actually one of the input Qubits. Apparently, In ccx/mct repetition isn't allowed!&lt;/p&gt;&#xA;&lt;p&gt;Please do let me know. TIA!&lt;/p&gt;&#xA;" OwnerUserId="13749" LastEditorUserId="55" LastEditDate="2020-11-24T18:57:06.650" LastActivityDate="2020-11-24T18:57:06.650" Title="How to create a gate with functionality CCX(a,b,b)?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14812" PostTypeId="2" ParentId="14811" CreationDate="2020-11-24T15:13:53.467" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-24T15:13:53.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14813" PostTypeId="1" CreationDate="2020-11-24T19:07:45.343" Score="1" ViewCount="67" Body="&lt;p&gt;Let us write the possible states of a qubit in the Bloch representation as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\newcommand{\bs}[1]{{\boldsymbol{#1}}}\rho_{\bs r}\equiv \frac{I+\bs r\cdot\bs \sigma}{2},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\bs\sigma=(\sigma_1,\sigma_2,\sigma_3)$&lt;/span&gt; are the Pauli matrices.&#xA;I can then represent &lt;span class=&quot;math-container&quot;&gt;$\rho_{\bs r}$&lt;/span&gt; as the vector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{\bs r}\doteq \frac12\begin{pmatrix}1 \\ \bs r\end{pmatrix}.$$&lt;/span&gt;&#xA;In this representation, I can represent a linear operator acting on &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices, &lt;span class=&quot;math-container&quot;&gt;$\mathcal E\in\mathrm{Lin}(\mathrm{Lin}( \mathbb C^2))$&lt;/span&gt;, as a matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E\doteq \begin{pmatrix}1 &amp;amp; \bs 0^T \\ \bs t &amp;amp; \Delta\end{pmatrix},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Delta\in\mathrm{Lin}(\mathbb C^2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bs t\in\mathbb R^2$&lt;/span&gt;.&#xA;This form of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; automatically preserves the normalisation.&#xA;The action of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\rho_{\bs r}$&lt;/span&gt; can then be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal E(\rho_{\bs r}) = \rho_{\Delta\bs r + \bs t}.$$&lt;/span&gt;&#xA;Is there a good way to see how the CPTP constraint on &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt; translates into constraints on &lt;span class=&quot;math-container&quot;&gt;$\bs t$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; in this representation?&lt;/p&gt;&#xA;&lt;p&gt;Clearly, for &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\rho)$&lt;/span&gt; to still be a state we need &lt;span class=&quot;math-container&quot;&gt;$\|\Delta \bs r+\bs t\|\le 1$&lt;/span&gt;. Is this the only requirement?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-11-25T00:12:37.143" Title="How does the CPTP constraint reflect on the matrix representation of a qubit channel in the Pauli basis?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;quantum-operation&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14814" PostTypeId="1" CreationDate="2020-11-24T19:17:04.107" Score="-1" ViewCount="38" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13928" LastActivityDate="2020-11-24T19:35:03.060" Title="Where are my Results?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14815" PostTypeId="2" ParentId="14814" CreationDate="2020-11-24T19:35:03.060" Score="2" Body="&lt;p&gt;With out seeing what you see, I can't say much. How many qubits were you using? If you use &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; and measure all the qubit then you don't expect to see the histogram plot, and you shouldn't since there are &lt;span class=&quot;math-container&quot;&gt;$2^{15} = 32768$&lt;/span&gt; eigenbasis.... I believe in those cases, you can download the generated &lt;code&gt;cvs&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CXgQ9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CXgQ9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and when I go to my &lt;code&gt;Result&lt;/code&gt; tab on IBMQ Experience, I clicked on the result for this run and still see the histogram plot:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/m4M53.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/m4M53.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-24T19:35:03.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14816" PostTypeId="1" AcceptedAnswerId="14822" CreationDate="2020-11-24T21:30:40.237" Score="4" ViewCount="128" Body="&lt;p&gt;In chapter 9 of Scott Aaronson's book &lt;em&gt;Quantum Computing Since Democritus&lt;/em&gt; (see online progenitor lecture notes &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), he introduces a strange (to me) conceptualization of applying two Hadamard-like operations to a qbit, summed up in this diagram:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k3E8M.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k3E8M.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I had the opportunity to &lt;a href=&quot;https://news.ycombinator.com/item?id=17427119&quot; rel=&quot;nofollow noreferrer&quot;&gt;ask him about this&lt;/a&gt; and he made three interesting statements:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;This is called the &amp;quot;Feynman&amp;quot; or &amp;quot;sum-over-paths&amp;quot; picture of quantum mechanics&lt;/li&gt;&#xA;&lt;li&gt;This picture is interesting because it reveals the effect of destructive interference&lt;/li&gt;&#xA;&lt;li&gt;If a QC is simulated using the sum-over-paths method, it takes exponential time instead of space&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;Also, do any of the main quantum languages/frameworks include a sum-over-paths simulator?&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2020-11-25T13:38:08.460" LastActivityDate="2020-11-26T14:04:45.567" Title="What is the &quot;sum-over-paths&quot; picture of quantum computing?" Tags="&lt;resource-request&gt;&lt;simulation&gt;&lt;interpretations&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14817" PostTypeId="1" AcceptedAnswerId="14830" CreationDate="2020-11-24T21:39:29.990" Score="2" ViewCount="42" Body="&lt;p&gt;In multiple sources, e.g. &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0502064.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;RGK&lt;/a&gt;, &lt;a href=&quot;https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.95.080501?casa_token=nHKPuJlj_5cAAAAA%3ArWMQwDLRObR4htYOHIAD4-X2xf1wpUAoE3iI17SCWxxsARLEBV5hiCjNmfd6agCx0az3crk-8V4Kyb8&quot; rel=&quot;nofollow noreferrer&quot;&gt;KGR&lt;/a&gt;,  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 &lt;a href=&quot;https://www.quantiki.org/wiki/bell-diagonal-state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bell-diagonal state&lt;/a&gt;. I understand that a bipartite Bell-diagonal state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; has the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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^-|,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle, |\Psi^-\rangle, |\Phi^+\rangle, |\Phi^-\rangle$&lt;/span&gt; are the usual Bell states.&#xA;The action of a depolarizing channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; on two qubits is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho_{AB}) = \sum_i (E_i \otimes E_i) \rho_{AB} (E_i \otimes E_i)^\dagger,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$E_i \in \{\mathbb{I}, \sigma_x, \sigma_y, \sigma_z\}$&lt;/span&gt; are the Pauli operators.&#xA;However, I don't see why &lt;em&gt;ANY&lt;/em&gt; bipartite density operator would be transformed into a Bell-diagonal state. Is there any proof of this claim?&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-11-25T08:17:47.927" Title="Two qubit state + Depolarizing channel = Bell diagonal state?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;bell-basis&gt;&lt;depolarizing-channel&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14818" PostTypeId="1" AcceptedAnswerId="14819" CreationDate="2020-11-24T21:50:11.403" Score="2" ViewCount="80" Body="&lt;p&gt;The question is basically the title but given a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and a computational basis, can we say anything about the complex number below?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c = \sum_{i}\langle i \vert U \vert j\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I expected that it would be &lt;span class=&quot;math-container&quot;&gt;$|c| = 1$&lt;/span&gt; but this does not seem to generally hold.&lt;/p&gt;&#xA;" OwnerUserId="13931" LastEditorUserId="55" LastEditDate="2020-11-26T11:27:16.887" LastActivityDate="2020-11-26T11:27:16.887" Title="What is $\sum_{i}\langle i \vert U \vert j\rangle$ for unitary $U$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14819" PostTypeId="2" ParentId="14818" CreationDate="2020-11-24T22:13:29.653" Score="2" Body="&lt;p&gt;Welcome to the quantum computing stack exchange.&lt;/p&gt;&#xA;&lt;p&gt;If you view &lt;span class=&quot;math-container&quot;&gt;$\sum_{i} \langle i |$&lt;/span&gt; as a (non-properly normalized) (bra) state &lt;span class=&quot;math-container&quot;&gt;$\sqrt{d}\langle \psi |$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{d}}\sum_{x \in \{0,1\}^{n}}|x\rangle$&lt;/span&gt;, the quantity &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; becomes just the inner product of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{d}\langle \psi |U|j\rangle$&lt;/span&gt;. Here, &lt;span class=&quot;math-container&quot;&gt;$d =2^{n}$&lt;/span&gt; is the proper normalization constant.&lt;/p&gt;&#xA;&lt;p&gt;Without imposing any other constraints on &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U|j\rangle$&lt;/span&gt; just becomes some random state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$c = \sqrt{d}\langle \psi|\phi\rangle$&lt;/span&gt; and the only thing we can conclude is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;0 \leq |c| \leq \sqrt{d}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-11-25T16:09:48.353" LastActivityDate="2020-11-25T16:09:48.353" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14820" PostTypeId="1" AcceptedAnswerId="14823" CreationDate="2020-11-24T22:40:05.530" Score="1" ViewCount="179" Body="&lt;p&gt;I want to simulate the final state of an ansatz in cirq using simulate.&#xA;Now I want to calculate the expectation value of a Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there a function in cirq I can use or how could I do this?&lt;/p&gt;&#xA;" OwnerUserId="13353" LastEditorUserId="55" LastEditDate="2020-11-26T11:27:35.163" LastActivityDate="2020-12-26T12:05:55.520" Title="Cirq.simulate expectation value of a Hamiltonian" Tags="&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14821" PostTypeId="2" ParentId="14813" CreationDate="2020-11-24T23:19:08.773" Score="2" Body="&lt;p&gt;This representation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is also known as the &lt;em&gt;Pauli transfer matrix&lt;/em&gt; or PTM; see &lt;a href=&quot;https://arxiv.org/abs/1509.02921&quot; rel=&quot;nofollow noreferrer&quot;&gt;this document by Greenbaum&lt;/a&gt; for a brief introduction.&lt;/p&gt;&#xA;&lt;p&gt;As stated in section &lt;span class=&quot;math-container&quot;&gt;$2.3.2$&lt;/span&gt; of that document, the TP constraint is automatically met by having the top row be &lt;span class=&quot;math-container&quot;&gt;$(1,0\ldots 0)$&lt;/span&gt;. This is because trace preservation dictates that for &lt;span class=&quot;math-container&quot;&gt;$\rho_{\boldsymbol{r}}$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\mathcal{E}(\rho_{\boldsymbol{r}})) = \mathrm{tr}(\rho_{\boldsymbol{r}})$&lt;/span&gt;. By linearity of the trace it must thus also hold for &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{e}_{i}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i \in \{0,1,2,3\}$&lt;/span&gt;, which are just the Paulis &lt;span class=&quot;math-container&quot;&gt;$\boldsymbol{\sigma}$&lt;/span&gt; in the space where the PTM acts upon. Since they are traceless, TP gives &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\mathcal{E}(\boldsymbol{e}_{i})) = \mathrm{tr}(\boldsymbol{e}_{i}) = d\delta_{0i}$&lt;/span&gt;, which is evidently only true if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{PTM}_{0,i} = \delta_{0i}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As also stated in the section &lt;span class=&quot;math-container&quot;&gt;$2.3.2$&lt;/span&gt;, the CP constraint doesn't work as nicely. The constraint &lt;span class=&quot;math-container&quot;&gt;$||\Delta\boldsymbol{r} + \boldsymbol{t}||\leq 1$&lt;/span&gt; actually also permits positive (but not-completely positive) maps. The classical example of the transpose gives:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\boldsymbol{\Delta}=\begin{bmatrix}1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -1 &amp;amp; 0 \\ 0 &amp;amp;0 &amp;amp; 1&#xA;\end{bmatrix}, \boldsymbol{t}= \boldsymbol{0}&#xA;$$&lt;/span&gt;&#xA;for which &lt;span class=&quot;math-container&quot;&gt;$||\Delta\boldsymbol{r} + \boldsymbol{t}|| \leq 1$&lt;/span&gt; obviously holds.&lt;/p&gt;&#xA;&lt;p&gt;I would rephrase the channel into some other representation for which the CP constraint &lt;em&gt;does&lt;/em&gt; work nicely. However, matters are made worse because, for instance, conversion between the PTM and &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;-representation is not always trivial (See section &lt;span class=&quot;math-container&quot;&gt;$2.1.3$&lt;/span&gt; of the document).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-11-25T00:12:37.143" LastActivityDate="2020-11-25T00:12:37.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14822" PostTypeId="2" ParentId="14816" CreationDate="2020-11-24T23:33:26.040" Score="4" Body="&lt;p&gt;Initially perhaps it is best to compare and contrast a couple of different approaches to simulating the output of a random quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of about &lt;span class=&quot;math-container&quot;&gt;$m=1000$&lt;/span&gt; gates acting on, say, &lt;span class=&quot;math-container&quot;&gt;$n=53$&lt;/span&gt; qubits initialized to &lt;span class=&quot;math-container&quot;&gt;$\vert 0^{53}\rangle$&lt;/span&gt;, as in Sycamore.  Suppose we execute our circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the &lt;span class=&quot;math-container&quot;&gt;$53$&lt;/span&gt; qubits of Sycamore, and we sample to get an output string &lt;span class=&quot;math-container&quot;&gt;$b\in\{0,1\}^{53}$&lt;/span&gt;.  We wish to determine the probability of getting an output &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, e.g. determine &lt;span class=&quot;math-container&quot;&gt;$\Vert\langle b\vert U\vert 0^{53}\rangle\Vert^2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In a first &amp;quot;Schrödinger&amp;quot; approach, we can store all &lt;span class=&quot;math-container&quot;&gt;$2^{53}$&lt;/span&gt; amplitudes in memory, and update each amplitude based on the &lt;span class=&quot;math-container&quot;&gt;$m=1000$&lt;/span&gt; gates, one for each step.  This requires memory on the order of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; (e.g. a lookup table for each amplitude), but time on the order of &lt;span class=&quot;math-container&quot;&gt;$m 2^n$&lt;/span&gt; (just keep updating the wavefunction for each gate), followed by a quick look-up of the amplitude/probability for &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In a second &amp;quot;Feynman&amp;quot; approach, one instead puts primacy on the actual output &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; that is sampled, and performs the sum-over-paths calculations to determine the corresponding probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Because only the measured output string &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is stored, memory usage is much improved to about &lt;span class=&quot;math-container&quot;&gt;$m+n$&lt;/span&gt;, but time takes roughly &lt;span class=&quot;math-container&quot;&gt;$4^m$&lt;/span&gt; (doubling for each branch).&lt;/li&gt;&#xA;&lt;li&gt;One can combine the two approaches as considered by &lt;a href=&quot;https://arxiv.org/abs/1612.05903&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson and Chen&lt;/a&gt; - into what they termed the &amp;quot;Schrödinger-Feynman&amp;quot; hybrid algorithm, that uses &lt;span class=&quot;math-container&quot;&gt;$\mathrm{poly}(m,n)$&lt;/span&gt; space and &lt;span class=&quot;math-container&quot;&gt;$m^{O(n)}$&lt;/span&gt; time.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Given a decision problem, we can put the output of the decision into a register &lt;span class=&quot;math-container&quot;&gt;$b\in\{0,1\}$&lt;/span&gt;; say &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; if the decision is NO but &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt; if the decision is YES.  If we have a quantum circuit to determine &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, we can see that we can run a Schrödinger algorithm or a Feynman algorithm to determine whether &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;Feynman won his Nobel by proving &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}\subseteq\mathrm{P}^\mathrm{\#P}$&lt;/span&gt;&amp;quot;, well before &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; was even defined.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-11-25T00:22:16.407" LastActivityDate="2020-11-25T00:22:16.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14823" PostTypeId="2" ParentId="14820" CreationDate="2020-11-25T00:32:05.650" Score="2" Body="&lt;p&gt;You can get the wavefunction from &lt;code&gt;cirq.final_state_vector(circuit)&lt;/code&gt;. Then you can define your observable as an instance of &lt;code&gt;cirq.PauliSum&lt;/code&gt;, on which you will be able to use the &lt;code&gt;expectation_from_state_vector()&lt;/code&gt; method to get the expectation value.&lt;/p&gt;&#xA;" OwnerUserId="4986" LastEditorUserId="4986" LastEditDate="2020-11-25T01:37:44.170" LastActivityDate="2020-11-25T01:37:44.170" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14824" PostTypeId="1" CreationDate="2020-11-25T03:24:58.120" Score="0" ViewCount="100" Body="&lt;p&gt;I have been trying to execute the quantum circuit in the backend of the IBM 16 qubit Melbourne machine. I end up getting&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQBackendApiError: 'Error submitting job: &amp;quot;HTTPSConnectionPool(): Max retries exceeded with url: **** SignedHeaders= ** Signature= ****(Caused by SSLError(SSLError(1, \'[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)\')))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but when I check my IBMQ account the status of the job is &lt;code&gt;Creating&lt;/code&gt;. I do not understand why I get such an error. Can someone help to identify what exactly the issue is?&lt;/p&gt;&#xA;" OwnerUserId="9778" LastEditorUserId="5955" LastEditDate="2020-11-27T15:55:21.683" LastActivityDate="2020-12-03T14:38:11.610" Title="Error while trying to execute the Quantum Circuits in IBMQ" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14825" PostTypeId="1" AcceptedAnswerId="14829" CreationDate="2020-11-25T03:29:08.200" Score="2" ViewCount="81" Body="&lt;p&gt;I am now studying QEC and feel confused. If I have a density matrix before the correction:&lt;/p&gt;&#xA;&lt;p&gt;The circuit is: &lt;a href=&quot;https://i.stack.imgur.com/Zv3Fu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zv3Fu.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My answer is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\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|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After the circuit works, what is the &lt;strong&gt;probability to find the logical qubit in the state&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|ψ\rangle$&lt;/span&gt; and why the system is &lt;strong&gt;not&lt;/strong&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$|ψ\rangle = α|000\rangle + β |111\rangle$&lt;/span&gt; with probability 1 after the error correction procedure of random bit flips? It makes me confused.&lt;/p&gt;&#xA;&lt;p&gt;Hope someone can help me with my problems.&lt;/p&gt;&#xA;&lt;p&gt;By the way, Nielsen's book has little examples for a newbie to learn, where could I find more exercises and examples?&lt;/p&gt;&#xA;&lt;p&gt;Sorry about the pictures, I just draw this quick picture by my hand.&lt;/p&gt;&#xA;" OwnerDisplayName="user13341" LastEditorUserId="2403" LastEditDate="2020-11-26T02:52:10.463" LastActivityDate="2020-11-26T02:52:10.463" Title="Question about quantum error correction and density matrixs" Tags="&lt;measurement&gt;&lt;error-correction&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14826" PostTypeId="2" ParentId="14818" CreationDate="2020-11-25T04:05:50.990" Score="1" Body="&lt;p&gt;You know that the columns of a unitary matrix are orthonormal: &lt;a href=&quot;https://math.stackexchange.com/questions/1688950/why-do-the-columns-of-a-unitary-matrix-form-an-orthonormal-basis&quot;&gt;https://math.stackexchange.com/questions/1688950/why-do-the-columns-of-a-unitary-matrix-form-an-orthonormal-basis&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;For example, you could have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix},$$&lt;/span&gt;&#xA;which is clearly unitary.&lt;/p&gt;&#xA;&lt;p&gt;The squared elements of the first half column add up to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}+\frac{1}{2}=1$&lt;/span&gt; as do the squared elements of the second column.&#xA;However, the elements of the first column itself add up to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}+ \frac{1}{\sqrt{2}} = \frac{2}{\sqrt{2}}$&lt;/span&gt; while the elements of the second column add up to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} - \frac{1}{\sqrt{2}} = 0.$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13752" LastActivityDate="2020-11-25T04:05:50.990" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14829" PostTypeId="2" ParentId="14825" CreationDate="2020-11-25T07:51:47.690" Score="1" Body="&lt;p&gt;The error correcting code that you are using is the 3-qubit majority vote. In other words:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If 0 or 1 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors occur, error correction returns the original state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;If 2 or 3 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors occur, error correction returns the bit-flipped state &lt;span class=&quot;math-container&quot;&gt;$XXX|\psi\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$XXX|\psi\rangle$&lt;/span&gt; is a valid state, so error correction should never change it, and a pair of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; errors are equivalent to a single error on &lt;span class=&quot;math-container&quot;&gt;$XXX|\psi\rangle$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Hence, the state that you get after error is (sort of)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=(1-p)^2(1+2p)|\psi\rangle\langle\psi|+p^2(3-2p)XXX|\psi\rangle\langle\psi|XXX.&#xA;$$&lt;/span&gt;&#xA;Why do I say &amp;quot;sort of&amp;quot;? 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 &lt;span class=&quot;math-container&quot;&gt;$(1-p)^3|\psi\rangle\langle\psi|$&lt;/span&gt; case or the &lt;span class=&quot;math-container&quot;&gt;$p^3XXX|\psi\rangle\langle\psi|XXX$&lt;/span&gt;. Hence, your density matrix in this case should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{00}=\frac{(1-p)^3|\psi\rangle\langle\psi|+p^3XXX|\psi\rangle\langle\psi|XXX}{(1-p)^3+p^3}&#xA;$$&lt;/span&gt;&#xA;If the measurement results were anything else, you're choosing between a one-error case and a two-error case. Hence&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho_{xy}&amp;amp;=\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)} \\&#xA;&amp;amp;=(1-p)|\psi\rangle\langle\psi|+pXXX|\psi\rangle\langle\psi|XXX&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-11-25T14:57:47.777" LastActivityDate="2020-11-25T14:57:47.777" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14830" PostTypeId="2" ParentId="14817" CreationDate="2020-11-25T08:17:47.927" Score="2" Body="&lt;p&gt;Firstly, note that every Bell state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ij}\rangle=(|0i\rangle+(-1)^j|1\bar i\rangle)/\sqrt{2}$&lt;/span&gt; is an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$E_i\otimes E_i$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (the eigenvalues are either &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;). 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.&lt;/p&gt;&#xA;&lt;p&gt;Consider an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. This can be decomposed in the Bell basis,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=\sum_{i,j}a_{ij}|\psi_{ij}\rangle.&#xA;$$&lt;/span&gt;&#xA;We have &lt;span class=&quot;math-container&quot;&gt;$XX|\psi_{i1}\rangle=-|\psi_{i,1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$XX|\psi_{i0}\rangle=|\psi_{i,0}\rangle$&lt;/span&gt;. So, for example, if I calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle\langle\Psi|+XX|\Psi\rangle\langle\Psi|XX,&#xA;$$&lt;/span&gt;&#xA;then this knocks out any cross terms such as &lt;span class=&quot;math-container&quot;&gt;$|\psi_{i0}\rangle\langle\psi_{j1}|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly, &lt;span class=&quot;math-container&quot;&gt;$ZZ|\psi_{0i}\rangle=|\psi_{0,i}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ZZ|\psi_{1i}\rangle=-|\psi_{1i}\rangle$&lt;/span&gt;, so terms such as &lt;span class=&quot;math-container&quot;&gt;$|\psi_{0i}\rangle\langle\psi_{1j}|$&lt;/span&gt; will also be knocked out. Ultimately, the only terms that are left are &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ij}\rangle\langle\psi_{ij}|$&lt;/span&gt;, i.e. the state is Bell diagonal.&lt;/p&gt;&#xA;&lt;p&gt;Strictly, to put all this together carefully, you want to say&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_x=\rho+XX\rho XX&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho)=\rho_x+ZZ\rho_xZZ&#xA;$$&lt;/span&gt;&#xA;two see how the two separate steps that I've made fit together.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-25T08:17:47.927" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14831" PostTypeId="1" AcceptedAnswerId="14844" CreationDate="2020-11-25T09:30:18.520" Score="0" ViewCount="67" Body="&lt;p&gt;I'm stumped by these questions in Chuang's book.&lt;/p&gt;&#xA;&lt;p&gt;If I have a state &lt;span class=&quot;math-container&quot;&gt;$|ψ\rangle=1/2\sqrt2(1+M_0)(1+M_1)(1+M_2)|0\rangle_7$&lt;/span&gt;, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_0=X_0X_4X_5X_6; M_1=X_1X_3X_5X_6; M_2=X_2X_3X_4X_6$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I rewrite its superposition expression without operators on the computational basis:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|ψ\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)] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am not sure if it is right. Hope you guys can give me some suggestions.&lt;/p&gt;&#xA;&lt;p&gt;Also, I am not sure &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operations are fault-tolerant. I learned from Chuang's book that a complete set of gates consisting of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gate, phase-gate, C-NOT, and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates can be constructed using fault-tolerant procedures. In my opinion, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is not fault-tolerant and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is fault-tolerant, since &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is one of the phase gates.&lt;/p&gt;&#xA;&lt;p&gt;Am I wrong? Hope someone can help me with my problems!&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13938" LastEditorUserId="55" LastEditDate="2020-11-26T11:30:55.380" LastActivityDate="2020-11-29T01:11:33.420" Title="Pauli Matrix tolerant and encoding" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;error-correction&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14833" PostTypeId="1" CreationDate="2020-11-25T13:32:56.787" Score="2" ViewCount="58" Body="&lt;p&gt;I am working now on a quantum neural network project and want a deep explanation on the &lt;strong&gt;Repeat Until Success circuit&lt;/strong&gt;.  What I know about this circuit is that it allows a nonlinear activation function to be applied by rotating around the &lt;span class=&quot;math-container&quot;&gt;$\hat y$&lt;/span&gt; axis by an angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. But I don't understand till now how this circuit works?  Can someone help me to clarify how it works?&lt;/p&gt;&#xA;&lt;p&gt;Thank you&lt;/p&gt;&#xA;" OwnerUserId="13940" LastEditorUserId="55" LastEditDate="2020-11-26T11:35:54.437" LastActivityDate="2021-04-20T10:52:23.993" Title="What is a &quot;repeat until success quantum circuit&quot; in quantum neural networks?" Tags="&lt;quantum-gate&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;quantum-neural-network&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14834" PostTypeId="1" AcceptedAnswerId="14838" CreationDate="2020-11-25T13:51:59.150" Score="4" ViewCount="79" Body="&lt;p&gt;In QAOA &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;, why do we pick the initial Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; applied to each qubit? Would it be possible to pick &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to be an application of &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt;'s instead? Then &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; would be both diagonal in the Z-basis. What is preventing us from taking this choice for &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;?&#xA;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="12047" LastEditorUserId="55" LastEditDate="2020-11-26T11:36:36.633" LastActivityDate="2020-11-26T11:36:36.633" Title="In QAOA, why do we pick the initial Hamiltonian $B$ to be $\sigma_x$ applied to each qubit?" Tags="&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14835" PostTypeId="1" AcceptedAnswerId="14841" CreationDate="2020-11-25T14:17:40.787" Score="2" ViewCount="72" Body="&lt;p&gt;If I &lt;code&gt;from qiskit.quantum_info import random_unitary&lt;/code&gt; and then &lt;code&gt;random_unitary(2**number_of_qubits)&lt;/code&gt; What returns is a unitary matrix with dimension &lt;span class=&quot;math-container&quot;&gt;$(2^{number\_of\_qubits},2^{number\_of\_qubits})$&lt;/span&gt;, and if I stimulating the unitary operation on a classical computer it is matrix computation.&lt;/p&gt;&#xA;&lt;p&gt;Here comes my question: what quantum computers do to implement this random unitary?&lt;/p&gt;&#xA;&lt;p&gt;From the universality of quantum gate set, we know that an arbitrary single-qubit operation can be decomposed into the set of &lt;span class=&quot;math-container&quot;&gt;$\{H, S, T\}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\hat U=\hat\Phi(\delta)\hat R_z(\alpha)\hat R_y(\theta)\hat R_z(\beta)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\hat \Phi(\delta)=\begin{pmatrix}e^{i\delta}&amp;amp;0\\0&amp;amp;e^{i\delta}\end{pmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat R_z(\alpha)=\begin{pmatrix}e^{i\alpha/2}&amp;amp;0\\0&amp;amp;e^{-i\alpha/2}\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat R_y(\theta)=\begin{pmatrix}cos\frac{\theta}{2}&amp;amp;sin\frac{\theta}{2}\\-sin\frac{\theta}{2}&amp;amp;cos\frac{\theta}{2}\end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But when considering &lt;strong&gt;physical realizations&lt;/strong&gt;, 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 &lt;code&gt;CNOT&lt;/code&gt; here to form the universal quantum gate set for an arbitrary number of qubits?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="55" LastEditDate="2021-05-18T08:03:19.607" LastActivityDate="2021-05-18T08:03:19.607" Title="How do quantum computers implement a random unitary gate?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14836" PostTypeId="2" ParentId="14824" CreationDate="2020-11-25T14:36:21.780" Score="1" Body="&lt;p&gt;Update: This is caused by &lt;code&gt;safebrowse.io&lt;/code&gt; blocking the url and sending back a http response (which the client interpreted as a TLS version it didn't understand). Unfortunately &lt;code&gt;safebrowse.io&lt;/code&gt; doesn't allow whitelisting a single url, so you'll need to disable it entirely. Here’s a link on how to do it: &lt;a href=&quot;https://howtoremove.guide/safebrowse-io-virus/#:%7E:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://howtoremove.guide/safebrowse-io-virus/#:~:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;use a VPN or&lt;/li&gt;&#xA;&lt;li&gt;use a different network or&lt;/li&gt;&#xA;&lt;li&gt;submit your jobs through IBM Quantum Experiment Quantum Lab (jupyter notebook)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12195" LastEditorUserId="12195" LastEditDate="2020-12-03T14:38:11.610" LastActivityDate="2020-12-03T14:38:11.610" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14837" PostTypeId="1" CreationDate="2020-11-25T16:21:14.223" Score="3" ViewCount="58" Body="&lt;p&gt;Consider a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and two observables &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there a good way to characterise how correlated the associated expectation values are? Be it in terms of mutual information or something else.&lt;/p&gt;&#xA;&lt;p&gt;As an example, if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a qubit and &lt;span class=&quot;math-container&quot;&gt;$P_i=|i\rangle\!\langle i|$&lt;/span&gt; projectors onto the computational basis states, then we know that &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; are fully correlated, as &lt;span class=&quot;math-container&quot;&gt;$\langle P_1\rangle = 1- \langle P_0\rangle$&lt;/span&gt;. Knowing one tells the value of the other.&#xA;On the other hand of the spectrum, if &lt;span class=&quot;math-container&quot;&gt;$P_+\equiv |+\rangle\!\langle +|$&lt;/span&gt;, then knowledge of &lt;span class=&quot;math-container&quot;&gt;$\langle P_0\rangle$&lt;/span&gt; imposes the bound&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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)}.$$&lt;/span&gt;&#xA;This can be seen starting from writing &lt;span class=&quot;math-container&quot;&gt;$\rho=\frac12(I+\sum_k c_k \sigma_k)$&lt;/span&gt;, observing that &lt;span class=&quot;math-container&quot;&gt;$\langle P_0\rangle = (1+c_z)/2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle P_+\rangle = (1+c_x)/2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$c_z^2+c_x^2\le1$&lt;/span&gt;, and thus concluding that &lt;span class=&quot;math-container&quot;&gt;$|c_x|\le \sqrt{1-c_z^2}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$c_z=2\langle P_0\rangle-1$&lt;/span&gt;.&#xA;Thus, in the case of &lt;span class=&quot;math-container&quot;&gt;$P_+$&lt;/span&gt;, we have a continuous freedom compatible with an observed value of &lt;span class=&quot;math-container&quot;&gt;$\langle P_0\rangle$&lt;/span&gt;, albeit with constrained bounds.&lt;/p&gt;&#xA;&lt;p&gt;Can similar characterisations be made in the general case of an arbitrary pair of observables &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;?&#xA;To be more precise, I'm asking, given &lt;span class=&quot;math-container&quot;&gt;$\alpha=\langle P\rangle$&lt;/span&gt;, what is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{\langle Q\rangle_\rho\equiv \mathrm{Tr}(\rho Q) : \rho\in\mathrm D(\mathcal X)\text{ such that } \langle P\rangle_\rho=\alpha\},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\mathrm D(\mathcal X)$&lt;/span&gt; is the set of all states in the relevant Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-11-26T12:32:33.820" LastActivityDate="2020-11-26T12:32:33.820" Title="Can we characterise how correlated the expectation values associated with a pair of observables are?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;projection-operator&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14838" PostTypeId="2" ParentId="14834" CreationDate="2020-11-25T17:35:47.343" Score="5" Body="&lt;p&gt;We don't really need &lt;span class=&quot;math-container&quot;&gt;$B = \sum \sigma_j^x$&lt;/span&gt; in our QAOA algorithm. As long as you pick it in such a way that it doesn't commute with &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$U(\beta, B)$&lt;/span&gt; as a driver, it helps to navigate the Ansatze from getting stuck.&lt;/p&gt;&#xA;&lt;p&gt;In term of the reason why  &lt;span class=&quot;math-container&quot;&gt;$B = \sum \sigma_j^x$&lt;/span&gt; in the first place is because QAOA is sort of a discretization of &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/c_gs_2.html&quot; rel=&quot;noreferrer&quot;&gt;Quantum Annealing&lt;/a&gt; so that is why we see that the Ansatze of QAOA takes the form: &lt;span class=&quot;math-container&quot;&gt;$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} $&lt;/span&gt; which is a trotter approximation of the time evolution in the quantum annealing.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-25T17:35:47.343" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14841" PostTypeId="2" ParentId="14835" CreationDate="2020-11-25T20:08:11.803" Score="3" Body="&lt;p&gt;In terms of decomposing an arbitrary unitary matrix on n-qubit system, this paper &lt;a href=&quot;https://arxiv.org/pdf/1501.06911.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Quantum Circuits for Isometries&amp;quot;&lt;/a&gt; might be a helpful guide. As well as this paper: &lt;a href=&quot;https://arxiv.org/pdf/1904.01072.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Introduction to UniversalQCompiler&amp;quot;&lt;/a&gt; which is implemented in the &lt;a href=&quot;https://www-users.york.ac.uk/%7Erc973/UniversalQCompiler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;UniversalQCompiler package for Mathematica&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And how to implement single qubit and CNOT gates on hardware, i guess a good place to look at is the &lt;a href=&quot;https://arxiv.org/pdf/2004.06755.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit documentation on Openpulse&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-25T20:08:11.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14842" PostTypeId="1" AcceptedAnswerId="14854" CreationDate="2020-11-25T20:57:09.137" Score="2" ViewCount="62" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/1111.6950&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1111.6950&lt;/a&gt;) as I didn't find any quantum info book describing it. I was wondering if given two Choi operators &lt;span class=&quot;math-container&quot;&gt;$\Lambda_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Lambda_2$&lt;/span&gt;, it was possible to construct a new Choi operator &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; as a convex linear combination of the two. i.e.  &lt;span class=&quot;math-container&quot;&gt;$\Lambda = (1-a)\Lambda_1 +  a \Lambda_2$&lt;/span&gt; as one would do with the states &lt;span class=&quot;math-container&quot;&gt;$(1-a)\rho_1 +  a \rho_2$&lt;/span&gt;. If it is possible to what process &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; would correspond?&lt;/p&gt;&#xA;" OwnerUserId="13945" LastActivityDate="2020-11-26T18:12:53.537" Title="Does it make sense to sum two Choi operators?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14843" PostTypeId="2" ParentId="14842" CreationDate="2020-11-25T22:34:31.663" Score="2" Body="&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_operation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kraus Operators&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Lambda_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Lambda_2$&lt;/span&gt; be described as (on some density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda_1 (\rho) = \sum_i E_i \rho E_i^\dagger, \\\Lambda_2 (\rho) = \sum_j F_j \rho F_j^\dagger.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, you can see that a convex combination of these two channels would be another channel with action as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2403" LastActivityDate="2020-11-25T22:34:31.663" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14844" PostTypeId="2" ParentId="14831" CreationDate="2020-11-25T23:44:36.120" Score="1" Body="&lt;p&gt;The state that you should obtain is a superposition of all possible products of (&lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and) &lt;span class=&quot;math-container&quot;&gt;$M_{0},M_{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_{2}$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_{7}$&lt;/span&gt;. That is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;III |0\rangle_{7}&amp;amp;= |0\rangle_{7} \\&#xA;M_{0}II|0\rangle_{7} = X_{0}X_{4}X_{5}X_{6}|0\rangle_{7} &amp;amp;= |1000111\rangle \\&#xA;IM_{1}I|0\rangle_{7} = X_{1}X_{3}X_{5}X_{6}|0\rangle_{7} &amp;amp;= |0101011\rangle \\&#xA;IIM_{2}|0\rangle_{7} = X_{2}X_{3}X_{4}X_{6}|0\rangle_{7} &amp;amp;= |0011101\rangle \\&#xA;M_{0}M_{1}I|0\rangle_{7} = X_{0}X_{1}X_{3}X_{4}|0\rangle_{7} &amp;amp;= |1101100\rangle \\&#xA;M_{0}IM_{2}|0\rangle_{7} = X_{0}X_{2}X_{3}X_{5}|0\rangle_{7} &amp;amp;= |1011010\rangle \\&#xA;IM_{1}M_{2}|0\rangle_{7} = X_{1}X_{2}X_{4}X_{5}|0\rangle_{7} &amp;amp;= |0110110\rangle \\&#xA;M_{0}M_{1}M_{2}|0\rangle_{7} = X_{0}X_{1}X_{2}X_{6}|0\rangle_{7} &amp;amp;= |1110001\rangle \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You just sum up these terms (including the proper normalization factor of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{8}=2\sqrt{2}$&lt;/span&gt; of course) and that's the state that you get.&lt;/p&gt;&#xA;&lt;p&gt;Then, fault-tolerance only makes sense in the scope of QEC's and the &lt;strong&gt;logical operations&lt;/strong&gt; you perform on encoded &lt;strong&gt;logical&lt;/strong&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;Saying that the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate is not and the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-11-25T23:50:41.357" LastActivityDate="2020-11-25T23:50:41.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14845" PostTypeId="1" AcceptedAnswerId="14848" CreationDate="2020-11-26T01:30:53.983" Score="4" ViewCount="137" Body="&lt;ol&gt;&#xA;&lt;li&gt;Consider two multipartite states &lt;span class=&quot;math-container&quot;&gt;$\rho_{A_1A_2..A_L}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{A_1A_2..A_L}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{A_1} \otimes\mathcal{H}_{A_2} \otimes...\mathcal{H}_{A_L} $&lt;/span&gt;. For an arbitrary permutation &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$\{ 1, \ldots ,L\}$&lt;/span&gt;, is it true that&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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?&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;If 1. is not true, is the following true:&#xA;If &lt;span class=&quot;math-container&quot;&gt;$\rho_{A_1A_2..A_LB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{A_1A_2..A_LB}$&lt;/span&gt; are two calssical-quantum states in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_{A_1} \otimes\mathcal{H}_{A_2} \otimes...\mathcal{H}_{A_L} \otimes  \mathcal{H}_{B}$&lt;/span&gt;, i.e., one can write  &lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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,&#xA;$$&lt;/span&gt;&#xA;where the position of the subscript &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is arbitrary on the righthand side.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13709" LastEditorUserId="55" LastEditDate="2020-11-26T17:58:14.653" LastActivityDate="2020-11-26T17:58:14.653" Title="Is the trace distance between multipartite states invariant under permutations?" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;&lt;trace-distance&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14847" PostTypeId="2" ParentId="14816" CreationDate="2020-11-26T02:26:44.540" Score="4" Body="&lt;p&gt;Expanding on Mark S's answer with some math:&lt;/p&gt;&#xA;&lt;p&gt;Let's take Aaronson's example, where you are applying the following unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; twice to a qbit initialized to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U =&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The conventional (Schrödinger) picture would represent this computation as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UU|0\rangle = &#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;1 \\ 0&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{-1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}} &amp;amp; \frac{1}{\sqrt{2}} \\&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}}&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA;0 \\ 1&#xA;\end{bmatrix} =&#xA;|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-sized state vector around in memory? Turns out yes, you can, with the the Feynman (or sum-over-paths) picture. Consider the following equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x\rangle = U_m \ldots U_1|\psi\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do we calculate the value of the final amplitude &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|x\rangle[i]$&lt;/span&gt;? It's a simple recursive algorithm. Let's define the recursive function &lt;span class=&quot;math-container&quot;&gt;$f(|\psi\rangle, U, i)$&lt;/span&gt;, which returns the value of amplitude &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; after the (1-qbit (2x2) or 2-qbit (4x4)) unitary operations in &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are applied to initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Base case: &lt;span class=&quot;math-container&quot;&gt;$U = [\ ]$&lt;/span&gt;, return &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle[i]$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;General case: &lt;span class=&quot;math-container&quot;&gt;$U = [U_m, \ldots, U_{1}]$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_m$&lt;/span&gt; is a 1-qbit 2x2 matrix: in the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th row of the full matrix &lt;span class=&quot;math-container&quot;&gt;$M = \mathbb{I}_2 \otimes \ldots \otimes U_m \otimes \ldots \otimes \mathbb{I_2}$&lt;/span&gt; (which would be multiplied against the state vector) there will be at most two nonzero entries at some indices &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;; this means we need the amplitudes at index &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; for the state prior to &lt;span class=&quot;math-container&quot;&gt;$U_m$&lt;/span&gt; being applied, so return:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M[i,a]\cdot f(|\psi\rangle, Tail(U), a) + M[i,b] \cdot f(|\psi\rangle, Tail(U), b)&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;General case: &lt;span class=&quot;math-container&quot;&gt;$U = [U_m, \ldots, U_{1}]$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_m$&lt;/span&gt; is a 2-qbit 4x4 matrix: in the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th row of the full matrix &lt;span class=&quot;math-container&quot;&gt;$M = \mathbb{I}_2 \otimes \ldots \otimes U_m \otimes \ldots \otimes \mathbb{I_2}$&lt;/span&gt; (which would be multiplied against the state vector) there will be at most four nonzero entries at some indices &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;; this means we need the amplitudes at index &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; for the state prior to &lt;span class=&quot;math-container&quot;&gt;$U_m$&lt;/span&gt; being applied, so return:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For our example above, this looks as follows; calculating the value of &lt;span class=&quot;math-container&quot;&gt;$f(|0\rangle, [U, U], 2)$&lt;/span&gt; (aka the final amplitude for state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(|0\rangle, [U, U], 2) = U[2,1] f(|0\rangle, [U], 1) + U[2,2] f(|0\rangle, [U], 2)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(|0\rangle, [U, U], 2) = \frac{1}{\sqrt{2}} f(|0\rangle, [U], 1) + \frac{1}{\sqrt{2}} f(|0\rangle, [U], 2)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(|0\rangle, [U, U], 2) = 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; unitary operations on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbits, this will clearly take &lt;span class=&quot;math-container&quot;&gt;$O(4^m)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$O(m)$&lt;/span&gt; space, since the recursive call stack will grow to length proportional to &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; (other sources say &lt;span class=&quot;math-container&quot;&gt;$O(m + n)$&lt;/span&gt; but I'm not sure where the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; term comes in).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2020-11-26T14:04:45.567" LastActivityDate="2020-11-26T14:04:45.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14848" PostTypeId="2" ParentId="14845" CreationDate="2020-11-26T08:35:09.607" Score="6" Body="&lt;p&gt;A permutation of the qubits is a unitary operation. The trace distance is invariant under unitaries (&lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_distance#Properties&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Trace_distance#Properties&lt;/a&gt;). Thus, statement 1 is true.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-26T08:35:09.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14849" PostTypeId="2" ParentId="14845" CreationDate="2020-11-26T12:12:47.213" Score="5" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$A_1, \dots, A_n$&lt;/span&gt; which we are told contain the parts of either the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; or the state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability of each. Tasked with guessing whether we got &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; we know by the HHT that our probability of guessing correctly using the optimal strategy is a function of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lVert \rho_{A_1A_2..A_n} - \sigma_{A_1A_2..A_n} \lVert_1.&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; the probability of guessing correctly when we're given boxes &lt;span class=&quot;math-container&quot;&gt;$A_{\pi(1)},\dots,A_{\pi(n)}$&lt;/span&gt; should be the same and hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please note that this is in no way a proof and &lt;span class=&quot;math-container&quot;&gt;$=_{\mathrm{operationally}}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-11-26T15:28:53.617" LastActivityDate="2020-11-26T15:28:53.617" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14850" PostTypeId="1" CreationDate="2020-11-26T12:57:28.447" Score="0" ViewCount="61" Body="&lt;p&gt;I'm using Qiskit and after running the circuit, as we all know, we get a count dictionary such as&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'0000': 66,&#xA; '0001': 71,&#xA; '0010': 68,&#xA; '0011': 70,&#xA; '0100': 77,&#xA; '0101': 64,&#xA; '0110': 64,&#xA; '0111': 51,&#xA; '1000': 52,&#xA; '1001': 67,&#xA; '1010': 43,&#xA; '1011': 64,&#xA; '1100': 61,&#xA; '1101': 59,&#xA; '1110': 73,&#xA; '1111': 74} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here the minimum count is &lt;code&gt;1010:43&lt;/code&gt;.  I want the same output just reversed &lt;code&gt;[1024-(count)]&lt;/code&gt;. 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?&lt;/p&gt;&#xA;" OwnerUserId="12154" LastEditorUserId="55" LastEditDate="2020-11-30T11:53:14.807" LastActivityDate="2020-11-30T11:53:14.807" Title="Quantum Circuit to inverse the probability distribution" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14851" PostTypeId="1" AcceptedAnswerId="14866" CreationDate="2020-11-26T14:21:56.423" Score="2" ViewCount="82" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13952" LastEditorUserId="13952" LastEditDate="2020-11-27T11:01:15.940" LastActivityDate="2020-11-30T12:19:37.180" Title="How to generate all stabilizer states numerically?" Tags="&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14852" PostTypeId="1" AcceptedAnswerId="14860" CreationDate="2020-11-26T14:30:24.063" Score="2" ViewCount="60" Body="&lt;p&gt;When finding the best angles for QAOA we optimize over &lt;span class=&quot;math-container&quot;&gt;$F_{p}(\beta , \gamma) = \langle \psi_p(\gamma,\beta)|C|\psi_p(\gamma,\beta)\rangle $&lt;/span&gt;.&lt;br /&gt;&#xA;In each optimization step we simulate the circuit &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; times and then calculate the mean &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; of the outcomes which is &lt;span class=&quot;math-container&quot;&gt;$F_{p}(\beta , \gamma) = \langle \psi_p(\gamma,\beta)|C|\psi_p(\gamma,\beta)\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What would happen if we don't optimize over the mean but on the maximum of the results of the simulation&lt;/p&gt;&#xA;&lt;p&gt;Wouldn't it be much more efficient as fewer shots are needed for each simulation?&lt;/p&gt;&#xA;&lt;p&gt;Are there any papers or work about this?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="9006" LastEditDate="2020-11-27T07:51:10.800" LastActivityDate="2020-11-27T08:00:38.987" Title="To find the best angles in QAOA why we do not optimize over a maximum ofall shots instead of a mean?" Tags="&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14853" PostTypeId="2" ParentId="14850" CreationDate="2020-11-26T17:11:24.937" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;counts = {'0000': 66, '0001': 71, '0010': 68, '0011': 70,&#xA;          '0100': 77, '0101': 64, '0110': 64, '0111': 51,&#xA;          '1000': 52, '1001': 67, '1010': 43, '1011': 64,&#xA;          '1100': 61, '1101': 59, '1110': 73, '1111': 74} &#xA;&#xA;shots = 1024&#xA;counts = { k:(shots-v) for k,v in counts.items()}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-11-26T17:11:24.937" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14854" PostTypeId="2" ParentId="14842" CreationDate="2020-11-26T18:12:53.537" Score="4" Body="&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \Lambda_i =\mathbb 1_A\otimes\mathcal E_B^i |\Omega\rangle_{AB}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\Omega\rangle_{AB}$&lt;/span&gt; is the unnormalized maximally entangled state, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so you can see that the linear combination &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}p_i \Lambda_i$&lt;/span&gt; is the Choi state of the map &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}p_i \mathcal E_B^i$&lt;/span&gt;. It remains to see whether this map is a channel. It is trace preserving because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr} \left(\sum_{i}p_i \mathcal E_B^i(\rho)\right)=\sum_i p_i=1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and completely positive because a sum of CP maps is CP.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="5125" LastActivityDate="2020-11-26T18:12:53.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14855" PostTypeId="1" CreationDate="2020-11-27T00:03:16.320" Score="0" ViewCount="61" Body="&lt;p&gt;I have some Q# code which I'm editing using visual studio code. The codebase is divided into a &lt;code&gt;src/&lt;/code&gt; folder and a &lt;code&gt;test/&lt;/code&gt; 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 &lt;code&gt;src/&lt;/code&gt; folder is invalid.&lt;/p&gt;&#xA;&lt;p&gt;For example, in this screen shot you can see red underlines as if there are errors, but actually the project builds and runs fine:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DExCK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DExCK.png&quot; alt=&quot;sample&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is quite annoying, and I can't figure out what about my setup is causing it.&lt;/p&gt;&#xA;&lt;p&gt;Here is &lt;code&gt;src/example.qs&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Example {&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;&#xA;    @EntryPoint()&#xA;    operation main() : Unit {&#xA;        Message(&amp;quot;main&amp;quot;);&#xA;    }&#xA;&#xA;    operation op() : Int {&#xA;        return 42;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is &lt;code&gt;test/test.qs&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Example.Tests {&#xA;    &#xA;    open Example;&#xA;    open Microsoft.Quantum.Diagnostics;&#xA;&#xA;    @Test(&amp;quot;ToffoliSimulator&amp;quot;)&#xA;    operation test_op() : Unit {&#xA;        if (op() != 42) {&#xA;            fail &amp;quot;wrong result&amp;quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is &lt;code&gt;src/src_project.csproj&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Project Sdk=&amp;quot;Microsoft.Quantum.Sdk/0.13.20111004&amp;quot;&amp;gt;&#xA;  &amp;lt;PropertyGroup&amp;gt;&#xA;    &amp;lt;OutputType&amp;gt;Exe&amp;lt;/OutputType&amp;gt;&#xA;    &amp;lt;TargetFramework&amp;gt;netcoreapp3.1&amp;lt;/TargetFramework&amp;gt;&#xA;  &amp;lt;/PropertyGroup&amp;gt;&#xA;&amp;lt;/Project&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is &lt;code&gt;test/test_project.cs_proj&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;Project Sdk=&amp;quot;Microsoft.Quantum.Sdk/0.13.20111004&amp;quot;&amp;gt;&#xA;&#xA;  &amp;lt;PropertyGroup&amp;gt;&#xA;    &amp;lt;TargetFramework&amp;gt;netcoreapp3.1&amp;lt;/TargetFramework&amp;gt;&#xA;    &amp;lt;IsPackable&amp;gt;false&amp;lt;/IsPackable&amp;gt;&#xA;  &amp;lt;/PropertyGroup&amp;gt;&#xA;&#xA;  &amp;lt;ItemGroup&amp;gt;&#xA;    &amp;lt;PackageReference Include=&amp;quot;Microsoft.Quantum.Xunit&amp;quot; Version=&amp;quot;0.13.20111004&amp;quot; /&amp;gt;&#xA;    &amp;lt;PackageReference Include=&amp;quot;Microsoft.NET.Test.Sdk&amp;quot; Version=&amp;quot;16.4.0&amp;quot; /&amp;gt;&#xA;    &amp;lt;PackageReference Include=&amp;quot;xunit&amp;quot; Version=&amp;quot;2.4.1&amp;quot; /&amp;gt;&#xA;    &amp;lt;PackageReference Include=&amp;quot;xunit.runner.visualstudio&amp;quot; Version=&amp;quot;2.4.1&amp;quot; /&amp;gt;&#xA;    &amp;lt;DotNetCliToolReference Include=&amp;quot;dotnet-xunit&amp;quot; Version=&amp;quot;2.3.1&amp;quot; /&amp;gt;&#xA;    &amp;lt;ProjectReference Include=&amp;quot;..\src\src_project.csproj&amp;quot; /&amp;gt;&#xA;  &amp;lt;/ItemGroup&amp;gt;&#xA;&amp;lt;/Project&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is &lt;code&gt;.vscode/tasks.json&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;    &amp;quot;version&amp;quot;: &amp;quot;2.0.0&amp;quot;,&#xA;    &amp;quot;tasks&amp;quot;: [&#xA;        {&#xA;            &amp;quot;label&amp;quot;: &amp;quot;run tests&amp;quot;,&#xA;            &amp;quot;command&amp;quot;: &amp;quot;dotnet&amp;quot;,&#xA;            &amp;quot;type&amp;quot;: &amp;quot;process&amp;quot;,&#xA;            &amp;quot;args&amp;quot;: [&#xA;                &amp;quot;test&amp;quot;,&#xA;                &amp;quot;${workspaceFolder}/test/test_project.csproj&amp;quot;,&#xA;            ],&#xA;            &amp;quot;group&amp;quot;: {&#xA;                &amp;quot;kind&amp;quot;: &amp;quot;test&amp;quot;,&#xA;                &amp;quot;isDefault&amp;quot;: true&#xA;            }&#xA;        },&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And finally here is &lt;code&gt;.vscode/launch.json&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{&#xA;   &amp;quot;version&amp;quot;: &amp;quot;0.2.0&amp;quot;,&#xA;   &amp;quot;configurations&amp;quot;: [&#xA;        {&#xA;            &amp;quot;name&amp;quot;: &amp;quot;debug&amp;quot;,&#xA;            &amp;quot;program&amp;quot;: &amp;quot;dotnet&amp;quot;,&#xA;            &amp;quot;type&amp;quot;: &amp;quot;coreclr&amp;quot;,&#xA;            &amp;quot;args&amp;quot;: [&#xA;                &amp;quot;run&amp;quot;,&#xA;                &amp;quot;--project&amp;quot;,&#xA;                &amp;quot;${workspaceFolder}/src/src_project.csproj&amp;quot;,&#xA;                &amp;quot;-s&amp;quot;,&#xA;                &amp;quot;ToffoliSimulator&amp;quot;,&#xA;            ],&#xA;            &amp;quot;request&amp;quot;:&amp;quot;launch&amp;quot;,&#xA;            &amp;quot;logging&amp;quot;: {&#xA;                &amp;quot;moduleLoad&amp;quot;: false&#xA;            },&#xA;        },&#xA;    ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="55" LastEditDate="2020-11-30T11:53:39.200" LastActivityDate="2021-05-02T01:03:35.777" Title="Correctly configuring a Q# test project in Visual Studio Code" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14856" PostTypeId="1" AcceptedAnswerId="14872" CreationDate="2020-11-27T00:08:49.620" Score="2" ViewCount="47" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;For example, what changes do I have to make to the code below?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Tests {&#xA;    open Microsoft.Quantum.Diagnostics;&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;&#xA;    operation op() : Unit {&#xA;        using (qs = Qubit[3]) {&#xA;            for (k in 0..10) {&#xA;                CCNOT(qs[0], qs[1], qs[2]);&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    @Test(&amp;quot;ResourcesEstimator&amp;quot;)&#xA;    operation test_op_toffoli_count_at_most_10() : Unit {&#xA;        ...?&#xA;        op();&#xA;        ...?&#xA;        if (tof_count &amp;gt; 10) {&#xA;            fail &amp;quot;Too many Toffolis&amp;quot;;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="55" LastEditDate="2020-11-30T11:53:57.573" LastActivityDate="2020-11-30T11:53:57.573" Title="Creating a resource count unit test in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14858" PostTypeId="2" ParentId="14659" CreationDate="2020-11-27T05:15:12.130" Score="2" Body="&lt;p&gt;Here is currently how I get this done. I have a Q# file that defines an operation &lt;code&gt;is_toffoli_simulator&lt;/code&gt; 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 &lt;code&gt;is_toffoli_simulator&lt;/code&gt; returns a value, it prevents the automatic creation of an adjoint.&lt;/p&gt;&#xA;&lt;p&gt;In Q#:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Hackery {&#xA;    operation is_toffoli_simulator() : Bool {&#xA;        // HACK: overriden in C# file.&#xA;        return false;&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In C#:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#nullable enable&#xA;&#xA;using System;&#xA;using Microsoft.Quantum.Simulation.Core;&#xA;using Microsoft.Quantum.Simulation.Simulators;&#xA;&#xA;namespace Hackery {&#xA;    public partial class is_toffoli_simulator {&#xA;        public class Native : is_toffoli_simulator {&#xA;            private Func&amp;lt;QVoid, bool&amp;gt; _body;&#xA;&#xA;            public Native(IOperationFactory m) : base(m) {&#xA;                var b = m is ToffoliSimulator;&#xA;                _body = args =&amp;gt; b;&#xA;            }&#xA;&#xA;            public override Func&amp;lt;QVoid, bool&amp;gt; __Body__ =&amp;gt; _body;&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;At which point you can do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    operation init_and(a: Qubit, b: Qubit, target: Qubit) : Unit is Adj {&#xA;        body(...) {&#xA;            CCNOT(a, b, target);&#xA;        }&#xA;        adjoint(...) {&#xA;            if (is_toffoli_simulator()) {&#xA;                CCNOT(a, b, target);&#xA;            } else {&#xA;                H(target);&#xA;                if (M(target) == One) {&#xA;                    CZ(a, b);&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-11-27T05:15:12.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14859" PostTypeId="1" CreationDate="2020-11-27T06:42:41.557" Score="8" ViewCount="105" Body="&lt;p&gt;As far as I understood from a series of papers, minimizing the &lt;code&gt;T-count&lt;/code&gt; in &lt;code&gt;Clifford+T&lt;/code&gt; circuits is essential for fault-tolerant quantum computing:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;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&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For example see &lt;a href=&quot;https://arxiv.org/pdf/1612.07330.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/1903.10477.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But do I understand correctly that while minimizing &lt;code&gt;T-count&lt;/code&gt; (incl. in &lt;code&gt;Clifford+T&lt;/code&gt; circuits) does not give a significant gain for the current &lt;strong&gt;IBM&lt;/strong&gt; &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/backends/#open-quantum-systems&quot; rel=&quot;noreferrer&quot;&gt;open quantum systems&lt;/a&gt; (real hardware, not simulations!), in particular, due to the fact that at the moment &lt;code&gt;T&lt;/code&gt; gate (like &lt;code&gt;T†&lt;/code&gt;, &lt;code&gt;U1&lt;/code&gt;/&lt;code&gt;P&lt;/code&gt; and &lt;code&gt;RZ&lt;/code&gt; gates)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;can be implemented virtually in hardware via framechanges (i.e. &lt;strong&gt;at zero error and duration&lt;/strong&gt;)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;See the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.PhaseGate.html&quot; rel=&quot;noreferrer&quot;&gt;documentation&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12416" LastEditorUserId="1859" LastEditDate="2020-11-27T23:04:31.390" LastActivityDate="2020-11-27T23:04:31.390" Title="Is there a good reason to use T-count minimization for circuits executed on current IBM open quantum systems (real hardware)?" Tags="&lt;error-correction&gt;&lt;architecture&gt;&lt;ibm&gt;&lt;clifford-group&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14860" PostTypeId="2" ParentId="14852" CreationDate="2020-11-27T08:00:38.987" Score="2" Body="&lt;p&gt;In QAOA we are looking for a ground state of a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. This means that we want to find a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; for which a energy is minimal, or in other words, a state asociated with a minimal eigenvalue.&lt;/p&gt;&#xA;&lt;p&gt;Suppose that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is our  eigenstate, hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|\psi\rangle = \lambda|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is respective eigenvalue. Multiplying by &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|$&lt;/span&gt; we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi|H|\psi\rangle = \langle\psi|\lambda|\psi\rangle = \lambda,&#xA;$$&lt;/span&gt;&#xA;since &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\lambda|\psi\rangle = \lambda\langle\psi|\psi\rangle = \lambda$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\psi\rangle = 1$&lt;/span&gt; comes from requirement that a quantum state is a unit vector).&lt;/p&gt;&#xA;&lt;p&gt;As we want &lt;span class=&quot;math-container&quot;&gt;$\lambda \rightarrow \min$&lt;/span&gt;, we have to minimize &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|H|\psi\rangle$&lt;/span&gt;, i.e. the mean.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-27T08:00:38.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14861" PostTypeId="1" AcceptedAnswerId="14864" CreationDate="2020-11-27T08:18:51.483" Score="2" ViewCount="79" Body="&lt;p&gt;Recently, I came across the article &lt;a href=&quot;https://www.nature.com/articles/s41598-019-49657-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Realization of efficient quantum gates with a superconducting qubit-qutrit circuit&lt;/a&gt; where its authors proposed a physical implementation of three qubits quantum gates with two physical qubits and one physical qutrit controlled by microwave pulses.&lt;/p&gt;&#xA;&lt;p&gt;As a result, they were able to implement physically CCZ gate which when accompanied by two Hadamards implements Toffoli gate.&lt;/p&gt;&#xA;&lt;p&gt;They also proposed configuration implementing Fredking gate, another three qubits gate which together with Hadamard gate form universal set.&lt;/p&gt;&#xA;&lt;p&gt;Finally, they showed that their design can be used for implementation of &lt;span class=&quot;math-container&quot;&gt;$CC-U$&lt;/span&gt; gate, where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=&#xA;\begin{pmatrix}&#xA;\cos(\theta) &amp;amp; \mathrm{e}^{i\varphi}\sin(\theta)\\&#xA;\mathrm{e}^{-i\varphi}\sin(\theta) &amp;amp; -\cos(\theta)\\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;which is more or less similar to &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate on IBM Q (to be precise &lt;span class=&quot;math-container&quot;&gt;$U(\theta, \varphi) = U3(2\theta,-\varphi,\pi+\varphi)$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;strong&gt;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.&lt;/strong&gt; I highly appreciate any links.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="1859" LastEditDate="2020-11-27T20:04:41.150" LastActivityDate="2020-12-07T12:09:18.470" Title="Is there a quantum processor with physically implemented Toffoli gate?" Tags="&lt;physical-realization&gt;&lt;ibm&gt;&lt;google-sycamore&gt;&lt;qutrit&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14862" PostTypeId="2" ParentId="14861" CreationDate="2020-11-27T08:23:53.897" Score="1" Body="&lt;p&gt;Not quite what you're asking, but...&lt;/p&gt;&#xA;&lt;p&gt;With something like the IBM processors, if you have the right permissions, you can get &amp;quot;pulse level&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-11-27T08:23:53.897" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14863" PostTypeId="2" ParentId="14856" CreationDate="2020-11-27T09:22:56.323" Score="0" Body="&lt;p&gt;The way I can think of is using the ressource estimator. By using a python or C# host file, you can use the &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/machines/resources-estimator&quot; rel=&quot;nofollow noreferrer&quot;&gt;ressource simulator&lt;/a&gt; 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 &lt;code&gt;[QubitClifford]&lt;/code&gt;. You could then use a simple &lt;code&gt;if&lt;/code&gt; condition to check if the number of Pauli gates is under 10. If you want to know more about unit tests, I asked &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14001/best-way-to-test-the-performance-of-a-simulated-quantum-algorithm-in-q&quot;&gt;this question&lt;/a&gt; a couple of weeks ago.&lt;/p&gt;&#xA;&lt;p&gt;I hope this could help.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-11-27T09:22:56.323" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14864" PostTypeId="2" ParentId="14861" CreationDate="2020-11-27T09:38:00.510" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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. &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;) qubits, so that one would get a coupled Hamiltonian between &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubits simultaneously. I, however, am not knowledgeable enough to judge the feasibility of this.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-12-07T12:09:18.470" LastActivityDate="2020-12-07T12:09:18.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14865" PostTypeId="1" CreationDate="2020-11-27T12:08:03.057" Score="2" ViewCount="55" Body="&lt;p&gt;In Qiskit, for a given &lt;code&gt;QuantumCircuit&lt;/code&gt; object, you can compute its Choi-matrix via the corresponding &lt;code&gt;Choi&lt;/code&gt; object, for example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;myCircuit = QuantumCircuit(q1,q2)&#xA;myChoi = Choi(myCircuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&#xA;What can I do?&lt;/p&gt;&#xA;&lt;p&gt;I would like to do something like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;myChoi = Choi(myCircuit, q1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="2293" LastEditDate="2021-02-24T14:54:46.223" LastActivityDate="2021-02-24T14:54:46.223" Title="Getting Choi-matrix of a subsystem" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-operation&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14866" PostTypeId="2" ParentId="14851" CreationDate="2020-11-27T13:33:07.317" Score="4" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (like &lt;span class=&quot;math-container&quot;&gt;$p^{O(n^2)}$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;We consider stabiliser states in prime dimension &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; (if you want prime-power, like e.g. for MUBs, that's similar). Define &lt;span class=&quot;math-container&quot;&gt;$\omega:=\exp(2\pi i /p)$&lt;/span&gt; to be the standard choice of a primitive &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-th root of unity.&lt;/p&gt;&#xA;&lt;h2&gt;State vector representation&lt;/h2&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$p\neq 2$&lt;/span&gt;, the Hilbert space vectors representing stabiliser states can be chosen to be of the following form (Refs. [1,2])&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; |K, q, b\rangle := \frac{1}{|K|} \sum_{x\in K} \omega^{q(x)+b\cdot x} |x\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$K\subset\mathbb F_p^n$&lt;/span&gt; is an affine subspace, &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is a quadratic form on &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$b\in\mathbb F_p^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$p=2$&lt;/span&gt;, this is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; |K, q, b \rangle := \frac{1}{|K|} \sum_{x\in K} i^{b\cdot x}\omega^{q(x)} |x\rangle,&#xA;$$&lt;/span&gt;&#xA;i.e. the linear part is computed mod 4 instead of mod 2.&lt;/p&gt;&#xA;&lt;p&gt;Now you can enumerate all stabiliser state by iterating over all possible affine subspaces &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, and then over quadratic and linear forms on &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;. The later part is easy once you have fixed a basis of &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Density matrix representation&lt;/h2&gt;&#xA;&lt;p&gt;The projectors of stabiliser states are determined by their stabiliser group &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; as follows&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(S) = \frac{1}{p^n} \sum_{g\in S} g.&#xA;$$&lt;/span&gt;&#xA;The stabiliser groups modulo signs correspond to so-called &lt;em&gt;Lagrangian subspaces&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$L\subset \mathbb F_p^{2n}$&lt;/span&gt; (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14644/considering-quantum-codes-as-codes-over-f-2/14700#14700&quot;&gt;my answer here&lt;/a&gt;). These are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional linear subspaces such that the symplectic form of any two elements vanishes (Ref. [3]):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; 0 = [v,w] := \sum_{i=1}^{n} v_i w_{n+i} - w_i v_{n+i}, \quad \forall v,w\in L.&#xA;$$&lt;/span&gt;&#xA;Any vector &lt;span class=&quot;math-container&quot;&gt;$v\in L$&lt;/span&gt; correspond to a Pauli/Weyl operator &lt;span class=&quot;math-container&quot;&gt;$W(v)$&lt;/span&gt; and the above equation expresses that those should commute.&lt;/p&gt;&#xA;&lt;p&gt;Now, for &lt;span class=&quot;math-container&quot;&gt;$p\neq 2$&lt;/span&gt;, we can rewrite the projector as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(S) = P(L,h) = \frac{1}{p^n} \sum_{v\in L} \omega^{[h,v]} W(v).&#xA;$$&lt;/span&gt;&#xA;From this representation, we can see that the coefficients of &lt;span class=&quot;math-container&quot;&gt;$P(L,h)$&lt;/span&gt; in the Weyl basis (i.e. its Bloch vector) are given by &lt;span class=&quot;math-container&quot;&gt;$\omega^{[h,v]}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$v\in L$&lt;/span&gt; and 0 otherwise.&#xA;Hence, one can again iterate over Lagrangian subspaces &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;, and then over the vectors &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt;. The latter part is again simplest in a basis of &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;.&#xA;In the case &lt;span class=&quot;math-container&quot;&gt;$p\neq 2$&lt;/span&gt;, one can alternatively use the representation of stabiliser states by their Wigner functions.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$p= 2$&lt;/span&gt;, this is a bit uglier. The coefficients here have the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(S) = P(L,h) = \frac{1}{2^n} \sum_{v\in L} (-1)^{\alpha(v)} W(v).&#xA;$$&lt;/span&gt;&#xA;For a suitable function &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;.&#xA;To compute &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, one can fix it arbitrarily on a basis of &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; (i.e. choose signs for the generators of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;) and then compute the coefficients of all other elements from that using&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha(v+w) = \beta(v,w) - \alpha(v) - \alpha(w)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is some horrible function determining whether you get an additional sign when you multiply two Pauli operators.&#xA;Its explicit form is e.g. given in a paper of mine (Ref. [4, App. A])), but also elsewhere.&lt;/p&gt;&#xA;&lt;p&gt;Literature&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;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). &lt;a href=&quot;https://doi.org/10.1103/PhysRevA.68.042318&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1103/PhysRevA.68.042318&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Gross, D., and M. Van den Nest. “The LU-LC Conjecture, Diagonal Local Operations and Quadratic Forms over GF(2),” (2007). &lt;a href=&quot;https://arxiv.org/abs/0707.4000v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0707.4000v2&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Gross, D. “Hudson’s Theorem for Finite-Dimensional Quantum Systems.” Journal of Mathematical Physics 47, no. 12 (2006): 122107. &lt;a href=&quot;https://doi.org/10.1063/1.2393152&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1063/1.2393152&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;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). &lt;a href=&quot;http://arxiv.org/abs/2011.11651&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://arxiv.org/abs/2011.11651&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-11-30T12:19:37.180" LastActivityDate="2020-11-30T12:19:37.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14867" PostTypeId="1" CreationDate="2020-11-27T14:44:38.970" Score="1" ViewCount="126" Body="&lt;p&gt;I'm trying to run a VQE for a specific custom Anzats. The Anzats is built up of an unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U_H$&lt;/span&gt;, which I'm trying to created in this way:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.circuit import Parameter&#xA;from qiskit.quantum_info import Operator&#xA;import math as m&#xA;&#xA;u_circuit = QuantumCircuit(2)&#xA;&#xA;# This does not work&#xA;theta = Parameter('θ')&#xA;&#xA;U_H = Operator([&#xA;[m.cos(2 * theta) - 1j * m.sin(2 * theta), 0, 0, 0],&#xA;[0, m.cos(2 * theta), -1j * m.sin(2 * theta), 0],&#xA;[0, -1j * m.sin(2 * theta), m.cos(2 * theta), 0],&#xA;[0, 0, 0, m.cos(2 * theta) - 1j * m.sin(2 * theta)]&#xA;])&#xA;&#xA;u_circuit.unitary(U_H, [0, 1], label='U_H(θ)')&#xA;&#xA;U_H_gate = u_circuit.to_gate(label='U_H(θ)')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, for the VQE to work, the circuit needs to be parameterized, and because of that, so does the unitary gate &lt;code&gt;U_H&lt;/code&gt;. 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 &lt;code&gt;theta&lt;/code&gt; so that it only exists between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. Whenever I try to build a circuit using this function to generate the gates in the Ansatz, I get the following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ParameterExpression with unbound parameters ({Parameter(θ)}) cannot be cast to a float.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Does anyone know how I can create a parameterized circuit consisting of parameterized gates of the form described by the matrix the &lt;code&gt;U_H&lt;/code&gt; operator, where &lt;code&gt;theta&lt;/code&gt; ranges from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13960" LastEditorUserId="55" LastEditDate="2020-11-30T11:55:17.830" LastActivityDate="2020-11-30T20:37:52.787" Title="Creating a parameterized Operator in Qiskit" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14868" PostTypeId="2" ParentId="14867" CreationDate="2020-11-27T16:06:18.253" Score="1" Body="&lt;p&gt;If I follow this correctly, the problem is that operator does not currently support parameters. This is a reported issue &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/4751&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/issues/4751&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-11-27T16:06:18.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14870" PostTypeId="1" AcceptedAnswerId="14871" CreationDate="2020-11-27T19:15:32.870" Score="1" ViewCount="98" Body="&lt;p&gt;Executing the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import IBMQ, QuantumCircuit, Aer, execute&#xA;from qiskit.quantum_info import Operator&#xA;from qiskit.providers.ibmq import least_busy&#xA;from qiskit.visualization import plot_histogram&#xA;from qiskit.tools.jupyter import *&#xA;provider = IBMQ.load_account() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get the following error which I do not know what to do about, does anybosy know what I can do?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ibmqfactory.load_account:WARNING:2020-11-27 &#xA;13:08:45,170: Credentials are already in use. The &#xA;existing account in the session will be replaced.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13698" LastEditorUserId="55" LastEditDate="2020-11-30T11:55:22.667" LastActivityDate="2020-11-30T11:55:22.667" Title="IBMQ: &quot;Credentials are already in use&quot;" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14871" PostTypeId="2" ParentId="14870" CreationDate="2020-11-27T19:25:10.353" Score="1" Body="&lt;p&gt;This is &lt;strong&gt;NOT&lt;/strong&gt; an error.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-27T19:25:10.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14872" PostTypeId="2" ParentId="14856" CreationDate="2020-11-27T20:24:32.460" Score="2" Body="&lt;p&gt;There are multiple ways to do this, depending on what exactly you want to check.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using AllowAtMostNCallsCA library operation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.allowatmostncallsca&quot; rel=&quot;nofollow noreferrer&quot;&gt;AllowAtMostNCallsCA&lt;/a&gt; operation that enforces exactly that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;namespace Tests {&#xA;    open Microsoft.Quantum.Diagnostics;&#xA;    open Microsoft.Quantum.Intrinsic;&#xA;&#xA;    operation op() : Unit {&#xA;        using (qs = Qubit[3]) {&#xA;            for (k in 0..10) {&#xA;                CCNOT(qs[0], qs[1], qs[2]);&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    @Test(&amp;quot;ResourcesEstimator&amp;quot;)&#xA;    operation test_op_toffoli_count_at_most_10() : Unit {&#xA;        within {&#xA;            AllowAtMostNCallsCA(10, CCNOT, &amp;quot;Too many Toffolis&amp;quot;);&#xA;        } apply {&#xA;            op();&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;Controlled X([qs[0], qs[1]], qs[2]);&lt;/code&gt; (which is exactly the same gate), the test will happily pass irrespective of how many times you use the gate.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Using resource estimator.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/machines/resources-estimator#programmatically-retrieving-the-estimated-data&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation&lt;/a&gt;. This approach has the advantage of matching the resource estimates done by ResourcesEstimator exactly, rather than tracking specific gates.&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Using custom simulator.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://github.com/microsoft/QuantumKatas/blob/main/utilities/Common/CounterSimulator.cs&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (some tasks in the Quantum Katas use tests like &amp;quot;prohibit all multi-qubit operations except Measure&amp;quot;, so this simulator comes handy).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2020-11-27T20:24:32.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14873" PostTypeId="2" ParentId="8702" CreationDate="2020-11-27T22:14:27.867" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I am on a mac and following the instructions listed here: &lt;a href=&quot;https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13961" LastActivityDate="2020-11-27T22:14:27.867" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14874" PostTypeId="1" AcceptedAnswerId="14877" CreationDate="2020-11-27T22:54:10.053" Score="0" ViewCount="178" Body="&lt;p&gt;I checked this code multiple times, I am trying to reproduce the same code using Grover's algorithm from qiskit summerschool:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; import numpy as np&#xA; from qiskit import IBMQ, QuantumCircuit, Aer, execute&#xA; from qiskit.quantum_info import Operator&#xA; from qiskit.providers.ibmq import least_busy&#xA; from qiskit.visualization import plot_histogram&#xA; from qiskit.tools.jupyter import *&#xA; provider = IBMQ.load_account()&#xA;&#xA;def phase_oracle(n, indices_to_mark, name='Oracle'):&#xA;qc = QuantumCircuit(n, name=name)&#xA;oracle_matrix = np.identity(2**n)&#xA;for index_to_mark in indices_to_mark:&#xA;    oracle_matrix[index_to_mark, index_to_mark]= -1&#xA;qc.unitary(operator(oracle_matrix), range(n))&#xA;return qc&#xA;&#xA;def diffuser(n):&#xA;qc=QuantumCircuit(n,name='Diff - &amp;quot;V&amp;quot;')&#xA;qc.h(range(n))&#xA;qc.append(phase_oracle(n,[0]),range(n))&#xA;qc.h(range(n))&#xA;return qc&#xA;&#xA;def Grover(n, marked):&#xA;qc=QuantumCircuit(n,n)&#xA;r = int(np.round(np.pi/&#xA;(4*np.arcsin(np.sqrt(len(marked)/2**n)))-1/2))&#xA;print(f'{n} qubits, basis state {marked} marked, {r} &#xA;rounds')&#xA;qc.h(range(n))&#xA;for _ in range(r):&#xA;    qc.append(phase_oracle(n,marked),range(n))&#xA;    qc.append(diffuser(n),range(n))&#xA;qc.measure(range(n),range(n))&#xA;return qc&#xA;&#xA;n = 5&#xA;x = np.random.randint(2**n)&#xA;marked = [x]&#xA;qc = Grover(n, marked)&#xA;&#xA;qc.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get the name operator error which I cannot figure out the reason:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; NameError                                 Traceback &#xA;(most recent call last)&#xA; &amp;lt;ipython-input-22-96635782dc30&amp;gt; in &amp;lt;module&amp;gt;&#xA;  2 x = np.random.randint(2**n)&#xA;  3 marked = [x]&#xA;  ----&amp;gt; 4 qc = Grover(n, marked)&#xA;  5 &#xA;  6 qc.draw()&#xA;&#xA; &amp;lt;ipython-input-20-f14e47e0af5d&amp;gt; in Grover(n, marked)&#xA; 20     qc.h(range(n))&#xA; 21     for _ in range(r):&#xA;  ---&amp;gt; 22         &#xA; qc.append(phase_oracle(n,marked),range(n))&#xA; 23         qc.append(diffuser(n),range(n))&#xA; 24     qc.measure(range(n),range(n))&#xA;&#xA;  &amp;lt;ipython-input-20-f14e47e0af5d&amp;gt; in phase_oracle(n, &#xA;  indices_to_mark, name)&#xA;  4     for index_to_mark in indices_to_mark:&#xA;  5         oracle_matrix[index_to_mark, &#xA;  index_to_mark]= -1&#xA;   ----&amp;gt; 6     qc.unitary(operator(oracle_matrix), &#xA;   range(n))&#xA;  7     return qc&#xA;  8 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;NameError: name 'operator' is not defined. Can anybody help me woth this?&lt;/p&gt;&#xA;" OwnerUserId="13698" LastActivityDate="2020-11-28T01:18:00.717" Title="Why do I get the error name operator is not defined?" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14875" PostTypeId="2" ParentId="14774" CreationDate="2020-11-27T23:08:45.857" Score="1" Body="&lt;p&gt;I guess you assume that &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is a bit string, so &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is not fully arbitrary   (there is no way to compare with an arbitrary state without measurements).&lt;/p&gt;&#xA;&lt;p&gt;Logically, it's just &lt;span class=&quot;math-container&quot;&gt;$(\phi_0=\psi_0 ~AND~ \phi_1=\psi_1 ~AND~ ...)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To implement the first comparison you can use &lt;span class=&quot;math-container&quot;&gt;$CNOT_{0a} \cdot CNOT_{pa} \cdot X_{a}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is the index of an ancilla qubit (0-initialized). &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is basically a sum modulo 2 (in the target qubit), so the value of the ancilla &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; will be &lt;span class=&quot;math-container&quot;&gt;$\phi_0 \oplus \psi_0 \oplus 1$&lt;/span&gt;, which is the same as &lt;span class=&quot;math-container&quot;&gt;$\phi_0=\psi_0$&lt;/span&gt;. Similarly for other comparisons.&lt;/p&gt;&#xA;&lt;p&gt;To accumulate results in the ancillas &lt;span class=&quot;math-container&quot;&gt;$a, a+1, a+2, ..., a+p-1$&lt;/span&gt; you can use a multiply controlled &lt;span class=&quot;math-container&quot;&gt;$NOT$&lt;/span&gt; gate (Toffoli generalization) where the target is &lt;span class=&quot;math-container&quot;&gt;$(2p+1)$&lt;/span&gt;-th qubit. To implement such gate you can use a bunch of Toffoli gates &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; a standard scheme, see e.g. Nielsen&amp;amp;Chuang book.&lt;/p&gt;&#xA;&lt;p&gt;And it's good practice to uncompute, even if &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is just a bit string.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2020-11-28T07:20:45.460" LastActivityDate="2020-11-28T07:20:45.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14876" PostTypeId="1" AcceptedAnswerId="14884" CreationDate="2020-11-28T01:17:28.317" Score="2" ViewCount="84" Body="&lt;p&gt;Could someone help me with &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$Problem-10.52$&lt;/span&gt;&lt;/strong&gt; in Nielsen and Isaac Chuang‘s book?&lt;/p&gt;&#xA;&lt;p&gt;The screenshot is shown below. I have no idea about that.&lt;/p&gt;&#xA;&lt;p&gt;Hope someone can give me some suggestions.&lt;/p&gt;&#xA;&lt;p&gt;By the way, if I want to know whether an operator is fault-tolerant, what should I DO to check it? For example, the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HoW6J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HoW6J.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user13341" LastEditorDisplayName="user13341" LastEditDate="2020-11-28T13:30:18.027" LastActivityDate="2020-11-28T13:30:18.027" Title="CSS Code and Fault-tolerant Problem in Nielsen and Isaac Chuang‘s book" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14877" PostTypeId="2" ParentId="14874" CreationDate="2020-11-28T01:18:00.717" Score="1" Body="&lt;p&gt;That is because on &lt;code&gt;line 14&lt;/code&gt; of your program, you wrote:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;qc.unitary(operator(oracle_matrix), range(n))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;when it should be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt; qc.unitary(Operator(oracle_matrix), range(n))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;You should have capitalized the &lt;code&gt;O&lt;/code&gt; in operator.  Changing that, I get the following output when executed your code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;5 qubits, basis state [15] marked, 4 rounds&#xA;     ┌───┐┌─────────┐┌─────────────┐┌─────────┐┌─────────────┐┌─────────┐»&#xA;q_0: ┤ H ├┤0        ├┤0            ├┤0        ├┤0            ├┤0        ├»&#xA;     ├───┤│         ││             ││         ││             ││         │»&#xA;q_1: ┤ H ├┤1        ├┤1            ├┤1        ├┤1            ├┤1        ├»&#xA;     ├───┤│         ││             ││         ││             ││         │»&#xA;q_2: ┤ H ├┤2 Oracle ├┤2 Diff - &amp;quot;V&amp;quot; ├┤2 Oracle ├┤2 Diff - &amp;quot;V&amp;quot; ├┤2 Oracle ├»&#xA;     ├───┤│         ││             ││         ││             ││         │»&#xA;q_3: ┤ H ├┤3        ├┤3            ├┤3        ├┤3            ├┤3        ├»&#xA;     ├───┤│         ││             ││         ││             ││         │»&#xA;q_4: ┤ H ├┤4        ├┤4            ├┤4        ├┤4            ├┤4        ├»&#xA;     └───┘└─────────┘└─────────────┘└─────────┘└─────────────┘└─────────┘»&#xA;c: 5/════════════════════════════════════════════════════════════════════»&#xA;                                                                         »&#xA;«     ┌─────────────┐┌─────────┐┌─────────────┐┌─┐            &#xA;«q_0: ┤0            ├┤0        ├┤0            ├┤M├────────────&#xA;«     │             ││         ││             │└╥┘┌─┐         &#xA;«q_1: ┤1            ├┤1        ├┤1            ├─╫─┤M├─────────&#xA;«     │             ││         ││             │ ║ └╥┘┌─┐      &#xA;«q_2: ┤2 Diff - &amp;quot;V&amp;quot; ├┤2 Oracle ├┤2 Diff - &amp;quot;V&amp;quot; ├─╫──╫─┤M├──────&#xA;«     │             ││         ││             │ ║  ║ └╥┘┌─┐   &#xA;«q_3: ┤3            ├┤3        ├┤3            ├─╫──╫──╫─┤M├───&#xA;«     │             ││         ││             │ ║  ║  ║ └╥┘┌─┐&#xA;«q_4: ┤4            ├┤4        ├┤4            ├─╫──╫──╫──╫─┤M├&#xA;«     └─────────────┘└─────────┘└─────────────┘ ║  ║  ║  ║ └╥┘&#xA;«c: 5/══════════════════════════════════════════╩══╩══╩══╩══╩═&#xA;«                                               0  1  2  3  4 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-28T01:18:00.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14878" PostTypeId="1" AcceptedAnswerId="14880" CreationDate="2020-11-28T03:04:56.547" Score="5" ViewCount="131" Body="&lt;p&gt;Let's say I have a density matrix of the following form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho := \frac{1}{2} (|a \rangle \langle a| + |b \rangle \langle b|), &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; are quantum states. I saw that the eigenvalues of this matrix are:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2} \pm \frac{|\langle a | b \rangle|}{2}.&#xA;$$&lt;/span&gt;&#xA;I was just wondering how this is derived. It seems logical, i.e if &lt;span class=&quot;math-container&quot;&gt;$|\langle a | b \rangle| = 1$&lt;/span&gt; then the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, otherwise if &lt;span class=&quot;math-container&quot;&gt;$|\langle a | b \rangle| = 0$&lt;/span&gt; then they are half and half. This means that the entropy of the system would either be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. But I was just wondering how to calculate the eigenvalues from &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="10480" LastEditDate="2021-02-07T00:50:36.253" LastActivityDate="2021-02-07T00:50:36.253" Title="How are the eigenvalues of $\rho=\frac12(|a\rangle\!\langle a| +|b\rangle\!\langle b|)$ derived?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;&lt;eigenvalue&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14879" PostTypeId="1" CreationDate="2020-11-28T06:36:36.933" Score="3" ViewCount="132" Body="&lt;p&gt;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:&#xA;&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are three steps to solve a problem using Grovers' algorith :&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Create a reversible classical circuit that identifies a correct solution&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use phase kickback and uncomputation to turn this circuit into an oracle&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Use Grover's algorithm to solve this oracle&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;If I start with an input [101000010] for a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;x&lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; puzzle in which &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; means off and one means lit, what would be the possible gates I can use to turn off all the lights eventually?&lt;/p&gt;&#xA;&lt;p&gt;(I know the mathematical algebric solution to the lights out problem, should I probably use that as the reversible classical circuit?)&lt;/p&gt;&#xA;&lt;p&gt;I appreciate it if anyone can guide me through this&lt;/p&gt;&#xA;" OwnerUserId="13698" LastEditorUserId="9318" LastEditDate="2020-11-28T21:39:25.920" LastActivityDate="2020-11-28T21:39:25.920" Title="How to write the classical algorithm for lights out problem?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14880" PostTypeId="2" ParentId="14878" CreationDate="2020-11-28T07:49:13.953" Score="2" Body="&lt;p&gt;For this it suffices to consider the two-dimensional subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; be an orthonormal basis of this subspace. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;|a\rangle =&amp;amp; a_0 |0\rangle + a_1 |1\rangle\\&#xA;|b\rangle =&amp;amp; b_0 |0\rangle + b_1 |1\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{1}{2}\left(\begin{array}{cc}&#xA;a_0 a_0^*+b_0b_0^* &amp;amp; a_0a_1^* + b_0 b_1^*\\&#xA;a_1 a_0^*+ b_1b_0^* &amp;amp; a_1a_1^*+b_1b_1^*&#xA;\end{array}\right).$$&lt;/span&gt;&#xA;That is, now you have a 2x2 Hermitian matrix and calculate its eigenvalues as usual. Hint: A Hermitian matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left(\begin{array}{cc}&#xA;a &amp;amp; c + d i\\&#xA;c - d i &amp;amp; b&#xA;\end{array}\right)$$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(a + b \pm \sqrt{(a-b)^2+ 4 (c^2+d^2)})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2020-11-28T07:49:13.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14881" PostTypeId="1" CreationDate="2020-11-28T08:47:42.797" Score="4" ViewCount="52" Body="&lt;p&gt;In the original QAOA paper from Farhi&#xA;&lt;a href=&quot;https://arxiv.org/pdf/1411.4028.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1411.4028.pdf&lt;/a&gt;,&#xA;it is stated in chapter 2 last paragraph (page 6) that: when measuring &lt;span class=&quot;math-container&quot;&gt;$F_{p}(\beta , \gamma)$&lt;/span&gt;  we get an outcome of at least &lt;span class=&quot;math-container&quot;&gt;$F_{p}(\beta , \gamma) - 1$&lt;/span&gt; with probability of &lt;span class=&quot;math-container&quot;&gt;$1 - 1/m$&lt;/span&gt; with order &lt;span class=&quot;math-container&quot;&gt;$m \log(m)$&lt;/span&gt; repetitions.&lt;br /&gt;&#xA;Where is this proven? Or what is the idea behind that?&lt;/p&gt;&#xA;&lt;p&gt;Thanks:))&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="13945" LastEditDate="2020-11-29T00:55:58.200" LastActivityDate="2020-11-29T00:55:58.200" Title="In QAOA why do we need $m \log(m)$ repititions to get at least $F_{p}(\beta , \gamma) - 1$ with probability of $1 - 1/m$?" Tags="&lt;qaoa&gt;&lt;probability&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14882" PostTypeId="2" ParentId="13994" CreationDate="2020-11-28T10:44:55.453" Score="2" Body="&lt;p&gt;&lt;a href=&quot;https://www.google.co.in/books/edition/Probability_and_Randomness/YbDACwAAQBAJ&quot; rel=&quot;nofollow noreferrer&quot;&gt;Probability And Randomness: Quantum Versus Classical&lt;/a&gt; by By Andrei Yu Khrennikov is a great book on the foundations of quantum randomness. &lt;a href=&quot;https://www.google.co.in/books/edition/Introduction_to_Random_Time_and_Quantum/EYmnLvMTVLgC&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Random Time and Quantum Randomness&lt;/a&gt; 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 &lt;a href=&quot;https://dspace.mit.edu/handle/1721.1/122846&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent work on quantum randomness&lt;/a&gt; by Liu, Zi-Wen.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2020-11-28T10:44:55.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14883" PostTypeId="1" CreationDate="2020-11-28T10:48:17.027" Score="4" ViewCount="77" Body="&lt;p&gt;When trying to execute complex quantum circuits on IBMQ real devices, one can encounter a typical error (&lt;code&gt;ERROR_RUNNING_JOB&lt;/code&gt;) with the message &lt;code&gt;'Circuit runtime is greater than the device repetition rate [8020]'.&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;What's more, how can I calculate the circuit runtime depending on its depth (and I suppose types and number of gates being required)?&lt;/p&gt;&#xA;&lt;p&gt;For example, someone &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11647/error-while-running-the-circuit-on-a-real-device-on-ibmq&quot;&gt;asked 7 months ago&lt;/a&gt; how to fix the 8020 error, which is &amp;quot;simply&amp;quot; fixed by reducing the circuit size, but at which point does someone have to reduce it depending on the real device (like &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; or &lt;code&gt;ibmq_manhattan&lt;/code&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="13967" LastEditorUserId="55" LastEditDate="2020-11-30T11:20:26.903" LastActivityDate="2021-05-21T20:02:17.900" Title="IBMQ backends: How can I know the repetition rate and depth limits of real devices?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14884" PostTypeId="2" ParentId="14876" CreationDate="2020-11-28T12:41:05.683" Score="1" Body="&lt;p&gt;I think you just get stuck, this is an easy job. For stabilizer codes, the logical state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_L$&lt;/span&gt; are just superposition of states(maintaining the same state under stabilizer operation).&lt;/p&gt;&#xA;&lt;p&gt;To verify &lt;span class=&quot;math-container&quot;&gt;$\bar Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bar X$&lt;/span&gt; are logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators, just notice that &lt;span class=&quot;math-container&quot;&gt;$\bar Z|0\rangle_L=|0\rangle_L,\ \bar Z|1\rangle_L=-|1\rangle_L,\ \bar X|0\rangle_L=|1\rangle_L,$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bar X|1\rangle_L=|0\rangle_L$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;These two are the logical states for Steane code(or see the &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0034-4885/76/7/076001&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5FAEr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5FAEr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can see that all superposition states of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_L$&lt;/span&gt; contains even number of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle's$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\bar Z|0\rangle_L=|0\rangle_L$&lt;/span&gt;, while for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_L$&lt;/span&gt; the number of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is odd-definite. I'll leave the &lt;span class=&quot;math-container&quot;&gt;$\bar X$&lt;/span&gt; part of work for you(it's quite tedious).&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-11-28T12:41:05.683" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14885" PostTypeId="1" AcceptedAnswerId="14886" CreationDate="2020-11-28T13:34:26.287" Score="2" ViewCount="58" Body="&lt;p&gt;In the proof of Uhlmann's theorem, the book writes the polar decomposition: &lt;span class=&quot;math-container&quot;&gt;$A = |A|V$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$|A| = \sqrt{A^\dagger A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Shouldn't it be &lt;span class=&quot;math-container&quot;&gt;$V|A|$&lt;/span&gt; instead?&#xA;The former case is &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A = V^\dagger|A||A|V$&lt;/span&gt; while the latter case is &lt;span class=&quot;math-container&quot;&gt;$A^\dagger A = |A|V^\dagger V|A| = |A||A| = A^\dagger A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2020-11-30T11:17:46.397" LastActivityDate="2020-11-30T11:17:46.397" Title="In Uhlmann's theorem, should the polar decomposition be written as $A=|A|V$ or $A=V|A|$?" Tags="&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14886" PostTypeId="2" ParentId="14885" CreationDate="2020-11-28T14:15:57.737" Score="2" Body="&lt;p&gt;Ok I confused myself in the first version of this answer.&lt;/p&gt;&#xA;&lt;p&gt;With the definition &lt;span class=&quot;math-container&quot;&gt;$|A|:=\sqrt{A^\dagger A}$&lt;/span&gt;, it should be &lt;span class=&quot;math-container&quot;&gt;$A=U|A|$&lt;/span&gt;. If you define instead &lt;span class=&quot;math-container&quot;&gt;$|A|:=\sqrt{A A^\dagger}$&lt;/span&gt;, then it is &lt;span class=&quot;math-container&quot;&gt;$A=|A|U$&lt;/span&gt;. Both definitions are common.&lt;/p&gt;&#xA;&lt;p&gt;There is a left and a right polar decomposition &lt;span class=&quot;math-container&quot;&gt;$A=PU=UP'$&lt;/span&gt; which are related to the SVD &lt;span class=&quot;math-container&quot;&gt;$A=V\Sigma W^\dagger$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P=V\Sigma V^\dagger, \quad U = VW^\dagger, \quad P' = W\Sigma W^\dagger.&#xA;$$&lt;/span&gt;&#xA;Note that &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; is the diagonal matrix with the singular values of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, i.e. the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$|A|=\sqrt{A^\dagger A}$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$\sqrt{A A^\dagger}$&lt;/span&gt;, they are the same), on its diagonal. Clearly, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A^\dagger A = P'U^\dagger U P' = W\Sigma^2 W, \quad AA^\dagger = V\Sigma^2 V^\dagger&#xA;$$&lt;/span&gt;&#xA;hence &lt;span class=&quot;math-container&quot;&gt;$P'=\sqrt{A^\dagger A}=|A|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P=\sqrt{AA^\dagger}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-11-28T14:27:07.687" LastActivityDate="2020-11-28T14:27:07.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14887" PostTypeId="1" AcceptedAnswerId="14896" CreationDate="2020-11-28T15:48:51.423" Score="3" ViewCount="146" Body="&lt;p&gt;In a lot of presentation I always see people say that &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbit are approximately &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; classical bit.&#xA;Those talks where oriented for a broad audience, so they left out a lot of things.&#xA;Deep down I felt that this couldn't be possible, but I didn't know anythings about qc so maybe this was the problem.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbit equal &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; classical bits.(If it's not this let me know)&lt;/p&gt;&#xA;&lt;p&gt;I've understood what the topic is about, but I still think that the association &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbit equal &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; classical bits is &lt;strong&gt;wrong&lt;/strong&gt; or at least misleading.&lt;/p&gt;&#xA;&lt;p&gt;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.&#xA;Just by reading this is clear that &lt;strong&gt;2 bit actually correspond to 1 qbit + 1eqbit&lt;/strong&gt;, 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.&#xA;Isn't this a flawed way to think? When someone say &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbit equal &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; bit, they are implicitly stating that there is a way to encode the information of &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; bits in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qbit, but if you actually study the theory is not like this.&lt;/p&gt;&#xA;&lt;p&gt;Also saying that &lt;strong&gt;1qbit +1eqbit =2 bit&lt;/strong&gt;, is not too much different than saying &lt;strong&gt;1qbit+1qbit=2qbit=2bit&lt;/strong&gt;, 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'.&#xA;I also know that approximating 1 eqbit  with 1 qbit is a strong affirmation, but stating that 1qbit = 2bit is stronger imo.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is my way of thinking flawed? Why and where?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also there is another thing that I couldn't understand on my own.&#xA;In the textbook that I'm using (Quantum Computation and Quantum Information) one thing that they say is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose Alice and Bob initially share a pair of qubits in the entangled&#xA;state..&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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?&#xA;In essence I don't understand the temporal window of the algorithm. I understand how it works, but not when. &lt;strong&gt;Can you clarify this?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9285" LastEditorUserId="55" LastEditDate="2020-11-30T11:17:24.083" LastActivityDate="2020-11-30T14:33:15.847" Title="Does 1 qubit correspond to 2 bits?" Tags="&lt;classical-computing&gt;&lt;superdense-coding&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14888" PostTypeId="1" CreationDate="2020-11-28T16:41:57.540" Score="5" ViewCount="58" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13972" LastEditorUserId="55" LastEditDate="2020-11-30T11:12:53.330" LastActivityDate="2020-11-30T11:12:53.330" Title="How do we realise photonic gates?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14889" PostTypeId="2" ParentId="11857" CreationDate="2020-11-28T17:39:03.650" Score="2" Body="&lt;p&gt;I totally agree with the comments of Sam Jaques and Sam Palmer. I would just elaborate a little bit more on that.&lt;/p&gt;&#xA;&lt;p&gt;The idea is that there is indeed no approximation in the step 3, but there is &amp;quot;some kind&amp;quot; of approximation between steps 3 and 4. To understand what kind of approximation it is and why &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; should be an integer multiple of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, let's start from the step 3:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After rearrangement of the last expression and multiplication&amp;amp;division by &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; in the power of the exponent, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now recall that the Fourier transform of the quantum state &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^t}}\sum_{x=0}^{2^t-1} e^{2\pi i (j)\frac{x}{2^t}}|x\rangle$&lt;/span&gt;. Keep in mind that &lt;span class=&quot;math-container&quot;&gt;$(j)$&lt;/span&gt; in the exponent's power is an &lt;strong&gt;integer&lt;/strong&gt;, and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; is a binary representation of an integer &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; by a quantum state (for instance, if &lt;span class=&quot;math-container&quot;&gt;$j=5$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|j\rangle = |1\rangle|0\rangle|1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, notice that if &lt;span class=&quot;math-container&quot;&gt;$(l2^t/r)$&lt;/span&gt; is &lt;strong&gt;integer (i.e. if &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; is an integer multiple of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;)&lt;/strong&gt;, then the expression inside round brackets from step 3 is exactly the Fourier transform of the state &lt;span class=&quot;math-container&quot;&gt;$|l2^t/r\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this case, there is no need for approximations at all, because moving from step 3 to step 4 we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you compare it with what is written in Nielsen and Chuang step 4, you will notice that &lt;span class=&quot;math-container&quot;&gt;$|\tilde{l/r}\rangle$&lt;/span&gt; is exactly a quantum state &lt;span class=&quot;math-container&quot;&gt;$|l2^t/r\rangle$&lt;/span&gt; for binary representation of integer &lt;span class=&quot;math-container&quot;&gt;$l2^t/r$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But if &lt;span class=&quot;math-container&quot;&gt;$l2^t/r$&lt;/span&gt; is &lt;strong&gt;not an integer (i.e. if &lt;span class=&quot;math-container&quot;&gt;$2^t$&lt;/span&gt; is not an integer multiple of &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;)&lt;/strong&gt;, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;since for rational &lt;span class=&quot;math-container&quot;&gt;$l2^t/r$&lt;/span&gt; there is no integer binary representation, and thus, no quantum state &lt;span class=&quot;math-container&quot;&gt;$|l2^t/r\rangle$&lt;/span&gt;. In this case, what we get from &lt;span class=&quot;math-container&quot;&gt;$|\tilde{l/r}\rangle$&lt;/span&gt; in step 4 is only an approximation.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13812" LastActivityDate="2020-11-28T17:39:03.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14890" PostTypeId="1" AcceptedAnswerId="14894" CreationDate="2020-11-28T17:57:34.177" Score="1" ViewCount="116" Body="&lt;p&gt;For quantum states &lt;span class=&quot;math-container&quot;&gt;$\vert\psi_1\rangle, \vert\psi_2\rangle, \vert\phi\rangle$&lt;/span&gt;, is it true that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My argument is that each number &lt;span class=&quot;math-container&quot;&gt;$c_i = \langle\phi\vert\psi_i\rangle$&lt;/span&gt; is a complex number with modulus smaller than 1 since it is the square root of a probability. So we have to show:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$2|c_1|^2|c_2|^2 \leq c_1c_2^* + c_1^*c_2\tag{2}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13973" LastEditorUserId="2293" LastEditDate="2020-12-12T16:57:39.623" LastActivityDate="2020-12-13T21:40:03.123" Title="Inequality in overlap of quantum states" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14891" PostTypeId="1" AcceptedAnswerId="14897" CreationDate="2020-11-28T21:20:34.320" Score="2" ViewCount="77" Body="&lt;p&gt;I have noticed one identity in case of tensor product from this &lt;a href=&quot;https://physics.stackexchange.com/questions/129280/inner-products-containing-the-tensor-product-of-two-operators&quot;&gt;post&lt;/a&gt;. But I can't understand why it is true.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now if I consider &lt;span class=&quot;math-container&quot;&gt;$\langle v_i|$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$[a,b]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle w_j|$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$[c,d]$&lt;/span&gt;. (note these are &lt;span class=&quot;math-container&quot;&gt;$1 \times 2$&lt;/span&gt;) then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle v_i| \otimes \langle w_j| = [a,b] \otimes [c,d]&#xA;   = [ac,ad,bc,bd]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly &lt;span class=&quot;math-container&quot;&gt;$|w_k\rangle \otimes |v_m\rangle = [e,f]^T \otimes [g,h]^T = [eg, eh, fg, fh]^T $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Scalar product between them = &lt;span class=&quot;math-container&quot;&gt;$[ac,ad,bc,bd] . [eg, eh, fg, fh]^T = aceg+ adeh+ bcfg+ bdfh$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now as per the identity if we do&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle v_i|v_m\rangle = [a,b] . [g,h]^T = ag+bh$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle w_j|w_k\rangle = [c,d] . [e,f]^T = ce+df$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$\langle v_i|v_m\rangle \cdot \langle w_j|w_k\rangle = (ag+bh).(ce+df)= aceg + adfg + bceh + bdfh$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now they are not the same. What is the reason for this behavior?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2020-11-30T11:11:38.217" LastActivityDate="2020-11-30T11:11:38.217" Title="Discrepancy in inner product between tensor products" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;tensor-product&gt;&lt;inner-product&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14894" PostTypeId="2" ParentId="14890" CreationDate="2020-11-29T03:10:12.810" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle a | b \rangle$&lt;/span&gt; is usually a scalar, so you can move such objects around on the left side, and arrive at (assuming all wavefunctions are normalized):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\tag{1}&#xA;  \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  &amp;amp;= 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 \\&#xA;&amp;amp;=2|c_1|^2|c_2|^2 \tag{2}\\&#xA;&amp;amp;\le2.\tag{3}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the case where &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; are &lt;em&gt;&lt;strong&gt;positive&lt;/strong&gt;&lt;/em&gt; and real-valued, which does actually happen quite often in quantum mechanics, you'd get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;2(c_1c_2)^2 ~~~~~&amp;amp;\textrm{vs.} ~~~~~2 c_1c_2\tag{4}  \\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then since &lt;span class=&quot;math-container&quot;&gt;$c_1 c_2 \le 1$&lt;/span&gt;, you would be correct that the left side is &lt;span class=&quot;math-container&quot;&gt;$\le$&lt;/span&gt; the right side. However there's cases where the inequality is &lt;em&gt;not&lt;/em&gt; true, for example:&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;&lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; purely real and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; purely imaginary:&lt;/h3&gt;&#xA;&lt;p&gt;The right-hand side (of your inequality in Eq. 2) becomes:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;c_1c_2^* + c_1^*c_2 = c_1(c_2 - c_2) = 0\tag{5},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but the left-hand side is bigger than 0 because &lt;span class=&quot;math-container&quot;&gt;$|c_2|^2&amp;gt;0.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h3&gt;&lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; have different signs:&lt;/h3&gt;&#xA;&lt;p&gt;The right-side (of your inequality in Eq. 2) can be negative while the left-side is positive.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-12-13T21:40:03.123" LastActivityDate="2020-12-13T21:40:03.123" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="14896" PostTypeId="2" ParentId="14887" CreationDate="2020-11-29T08:00:18.597" Score="4" Body="&lt;p&gt;Lets start with notion that &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits are equivalent to &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; classical bits. This is wrong. However, it is true that to describe a quantum state composed of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits we need &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex numbers since &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits state is superposition containing all combination of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical qubits (&lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;). Writen by formula, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q_0q_1...q_{n-1}\rangle = \sum_{i=0}^{2^n}a_{i}|i\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; represent basis states (e.g. &lt;span class=&quot;math-container&quot;&gt;$|0...00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0...01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0...10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0...11\rangle$&lt;/span&gt; etc. until &lt;span class=&quot;math-container&quot;&gt;$|1...11\rangle$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$a_{i} \in \mathbb{C}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Concerning information contained in qubits. Any qubit can be described as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \alpha|0\rangle + \beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt;. Since paraeters &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-11-29T08:00:18.597" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14897" PostTypeId="2" ParentId="14891" CreationDate="2020-11-29T10:37:31.873" Score="2" Body="&lt;p&gt;The identity is wrong. It should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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. &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-11-29T10:37:31.873" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14898" PostTypeId="1" AcceptedAnswerId="15676" CreationDate="2020-11-29T13:13:01.290" Score="5" ViewCount="127" Body="&lt;p&gt;From Nielsen and Chuang's book: &lt;span class=&quot;math-container&quot;&gt;$\textit{Quantum computation and quantum information}$&lt;/span&gt;, how can (5.34) equal (5.33)?  I.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{2} \int_{e-1}^{2^{t-1}-1} dl \dfrac{1}{l^2} = \dfrac{1}{2(e-1)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="8623" LastEditDate="2020-11-30T21:22:18.437" LastActivityDate="2021-01-25T20:49:33.293" Title="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}$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="14899" PostTypeId="1" AcceptedAnswerId="14901" CreationDate="2020-11-29T14:33:26.430" Score="2" ViewCount="66" Body="&lt;p&gt;I have recently started with quantum computing and created a quantum teleportation circuit to transmit a qubit state from &lt;code&gt;q_0&lt;/code&gt; to &lt;code&gt;q_2&lt;/code&gt; using Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;I understand that I can transmit any state information from &lt;code&gt;q_0&lt;/code&gt; to &lt;code&gt;q_2&lt;/code&gt;. Is it then fair to expect that I can also transmit a morse code like string of 0s and 1s (say 1001)?&#xA;This is the circuit I built after watching/reading Qiskit tutorials.&lt;a href=&quot;https://i.stack.imgur.com/JLGGx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JLGGx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13983" LastEditorUserId="55" LastEditDate="2020-11-30T10:48:44.607" LastActivityDate="2020-11-30T10:48:44.607" Title="Can I teleport a string of 0s and 1s?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14900" PostTypeId="1" CreationDate="2020-11-29T17:44:31.523" Score="4" ViewCount="111" Body="&lt;p&gt;A paper &lt;a href=&quot;https://arxiv.org/abs/1801.04255&quot; rel=&quot;nofollow noreferrer&quot;&gt;Three-dimensional surface codes: Transversal gates and fault-tolerant architectures&lt;/a&gt; discusses 3D surface codes and shows that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;CZ and CCZ gates are transversal in [these] codes.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;They give a small example in Appendix A.&#xA;I'm a bit confused by some of the parameters. There are three codes listed there; each is &lt;span class=&quot;math-container&quot;&gt;$[[12,1,2]]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So does that mean that the &amp;quot;overall code&amp;quot; acts on 36 qubits? In that case how are the three codes&#xA;&amp;quot;stitched&amp;quot; together to form the bigger code? Alternatively, if I have some &lt;span class=&quot;math-container&quot;&gt;$[[n,k,d]]$&lt;/span&gt; code, how do&#xA;I check if it can implement a CZ,CCZ,CCCZ,...gate or not?&lt;/p&gt;&#xA;" OwnerUserId="12265" LastEditorUserId="9006" LastEditDate="2020-11-30T07:52:06.153" LastActivityDate="2020-11-30T07:52:06.153" Title="Which codes can implement transversal non-Clifford gates" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;surface-code&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14901" PostTypeId="2" ParentId="14899" CreationDate="2020-11-29T18:42:07.677" Score="1" Body="&lt;p&gt;As you noticed, the first thing you do is to put the &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; to the state you want to teleport to &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. For instance, if you want to transport &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; then you would first apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to flip &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/njndB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/njndB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is because the initial state of a quantum computer is usually starts in the state &lt;span class=&quot;math-container&quot;&gt;$|000\cdots0\rangle$&lt;/span&gt;. Thus, if you want to teleport &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; then apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; in the beginning, if you want to  teleport &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; then do nothing.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;from qiskit import QuantumCircuit, execute, BasicAer, IBMQ&#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;&#xA;def teleported_circuit(code):&#xA;    qreg_q = QuantumRegister(3, 'q')&#xA;    creg_c = ClassicalRegister(1, 'c')&#xA;    circuit = QuantumCircuit(qreg_q, creg_c)&#xA;    if code == 1:&#xA;        circuit.x(qreg_q[0])&#xA;    circuit.barrier(range(3))&#xA;    circuit.h(qreg_q[1])&#xA;    circuit.cx(qreg_q[1], qreg_q[2])&#xA;    circuit.cx(qreg_q[0], qreg_q[1])&#xA;    circuit.h(qreg_q[0])&#xA;    circuit.barrier(range(3))&#xA;    circuit.cx(qreg_q[1], qreg_q[2])&#xA;    circuit.cz(qreg_q[0], qreg_q[2])&#xA;    circuit.measure(qreg_q[2], creg_c[0])&#xA;    backend = BasicAer.get_backend('statevector_simulator')&#xA;    job = execute(circuit, backend, shots = 1)&#xA;    return job.result().get_counts()&#xA;&#xA;#### Example #### &#xA;code_string = [1,0,0,1,1,1]&#xA;teleported_code = [ teleported_circuit(code_string[i]) for i in range(len(code_string)) ]&#xA;print('Here is your telported code:', teleported_code)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Here is your telported code: [{'1': 1}, {'0': 1}, {'0': 1}, {'1': 1}, {'1': 1}, {'1': 1}]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-11-29T18:42:07.677" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14902" PostTypeId="2" ParentId="14765" CreationDate="2020-11-29T20:49:02.377" Score="8" Body="&lt;p&gt;No dimension-independent bound is possible.&lt;/p&gt;&#xA;&lt;p&gt;Consider states &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; that are close in &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-norm (for &lt;span class=&quot;math-container&quot;&gt;$p&amp;gt;1$&lt;/span&gt;) but have relatively low fidelity. Specifically, assume&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\rho_A - \sigma_A\|_p = \varepsilon&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{F}(\rho_A,\sigma_A) &#xA;= \bigl\|\sqrt{\rho_A}\sqrt{\sigma_A}\bigr\|_1 = \delta,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is small and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is bounded away from 1. I'll give a specific example below.&lt;/p&gt;&#xA;&lt;p&gt;The maximal fidelity between purifications &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi_{AB}$&lt;/span&gt; is also equal to &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;, so the minimal trace norm of the difference between purifications is bounded as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_1 \geq 2 \sqrt{1 - \delta^2},&#xA;$$&lt;/span&gt;&#xA;with equality when the purifications are chosen optimally.&lt;/p&gt;&#xA;&lt;p&gt;Now the key is that the operator &lt;span class=&quot;math-container&quot;&gt;$\Phi_{AB} - \Psi_{AB}$&lt;/span&gt; has rank equal to 2 (assuming the two states are not equal, which we get from &lt;span class=&quot;math-container&quot;&gt;$\delta &amp;lt;1$&lt;/span&gt;). Thus, for any choice of &lt;span class=&quot;math-container&quot;&gt;$p\in[1,\infty]$&lt;/span&gt;, we obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_p&#xA;\geq \frac{1}{2} \bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_1&#xA;\geq \sqrt{1 - \delta^2},&#xA;$$&lt;/span&gt;&#xA;which is not small when &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is bounded away from 1.&lt;/p&gt;&#xA;&lt;p&gt;As an extreme example, choose &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; to be a large positive integer and define states in &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; dimensions like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A &#xA;= \frac{1}{n}\sum_{k=1}^n |k\rangle\langle k|&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_A &#xA;= \frac{1}{n}\sum_{k=n+1}^{2n} |k\rangle\langle k|.&#xA;$$&lt;/span&gt;&#xA;These states are close in &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;-norm when &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is large,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\varepsilon = \bigl\|\rho_A - \sigma_A\|_{\infty} = \frac{1}{n},&#xA;$$&lt;/span&gt;&#xA;and because they are orthogonal their fidelity is zero: &lt;span class=&quot;math-container&quot;&gt;$\delta = 0$&lt;/span&gt;. The minimal &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;-norm between two purifications is therefore at least &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, which obviously exceeds any constant factor times &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-11-29T20:49:02.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14903" PostTypeId="1" AcceptedAnswerId="14904" CreationDate="2020-11-29T21:38:13.797" Score="1" ViewCount="135" Body="&lt;p&gt;I am trying to implement a basic quantum computing emulator. In the chapter on Grover's algorithm, we're shown the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CuN4s.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CuN4s.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;They demonstrate Grover's algorithm with a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; that picks out &lt;span class=&quot;math-container&quot;&gt;$101$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$f(101)=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; otherwise. They start with &lt;span class=&quot;math-container&quot;&gt;$\psi_{1}=[1, 0, 0, 0, 0, 0, 0, 0]^{T}$&lt;/span&gt;. The Hadamard gate (specifically H tensored with itself &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times) gives &lt;span class=&quot;math-container&quot;&gt;$\psi_{2}=1/\sqrt8 [1, 1, 1, 1, 1, 1, 1, 1]^{T}$&lt;/span&gt;. This is as far as I've come. They don't show explicitly how to get to &lt;span class=&quot;math-container&quot;&gt;$\psi_{3}$&lt;/span&gt;, which should be &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt8 [1, 1, 1, 1, 1, -1, 1, 1]^{T}$&lt;/span&gt;. I am not sure how to interpret the circuit.&lt;/p&gt;&#xA;&lt;p&gt;My best guess was to take the tensor product of &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle=|000 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle = [0, 1]^{T}$&lt;/span&gt;, then apply &lt;span class=&quot;math-container&quot;&gt;$I_{2^{n}} \otimes H$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$U_{f}$&lt;/span&gt;. However, I have two problems:&lt;/p&gt;&#xA;&lt;p&gt;The book says that, at that stage in the calculation, &lt;span class=&quot;math-container&quot;&gt;$\psi_{3} = 1/\sqrt8 [1, 1, 1, 1, 1, -1, 1, 1]^{T}$&lt;/span&gt;, which has length &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;, instead of &lt;span class=&quot;math-container&quot;&gt;$16$&lt;/span&gt;. I don't know how to &amp;quot;extract&amp;quot; the &amp;quot;top&amp;quot; qubits. Furthermore, my answer is &lt;span class=&quot;math-container&quot;&gt;$1/4[1, 1..., 1]^{T}$&lt;/span&gt;, which doesn't suggest the correct answer (especially given the fact that every entry is &lt;span class=&quot;math-container&quot;&gt;$1/4$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Am I misinterpreting this circuit? What is the correct way to go from &lt;span class=&quot;math-container&quot;&gt;$\psi_{2}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\psi_{3}$&lt;/span&gt;, from a programmatic point of view?&lt;/p&gt;&#xA;" OwnerUserId="13987" LastEditorUserId="13987" LastEditDate="2020-11-30T14:08:26.650" LastActivityDate="2020-11-30T14:08:26.650" Title="Question about a circuit from &quot;Quantum Computing for Computer Scientists&quot;" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14904" PostTypeId="2" ParentId="14903" CreationDate="2020-11-30T01:31:35.167" Score="2" Body="&lt;p&gt;Have you &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Amps3%22%5D%5D%2C%22init%22%3A%5B0%2C0%2C0%2C1%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;tried Quirk&lt;/a&gt;? 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%97%A6%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B%22Amps3%22%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C%22%E2%80%A2%22%5D%2C%5B%22X%22%2C%22X%22%2C%22X%22%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22Amps3%22%5D%5D%2C%22init%22%3A%5B0%2C0%2C0%2C1%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/13R3h.png&quot; alt=&quot;grover circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-11-30T01:42:51.977" LastActivityDate="2020-11-30T01:42:51.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14905" PostTypeId="2" ParentId="14903" CreationDate="2020-11-30T09:46:47.063" Score="2" Body="&lt;p&gt;As you have read, Grover's Algorithm consists of starting in an equal superposition and the applying two gates, &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{n}$&lt;/span&gt; times where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of elements.&lt;/p&gt;&#xA;&lt;p&gt;You are looking on how to implement &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; which gets from state &lt;span class=&quot;math-container&quot;&gt;$\psi_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\psi_3$&lt;/span&gt;. This is called a phase flipping oracle since it adds a phase of &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi} = -1$&lt;/span&gt; to the basis state which represents the correct element. The best way to do so is to apply an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to a &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$&lt;/span&gt; to a separate allocated qubit, when you recognize that it is the correct basis states. This &lt;a href=&quot;https://docs.microsoft.com/en-us/learn/modules/solve-graph-coloring-problems-grovers-search/1-introduction&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; describes how do implement this gate for a graph coloring problem in Q#.&lt;/p&gt;&#xA;&lt;p&gt;To answer some of your other questions :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The state vector is of length 8 since there are 3 qubits which gives &lt;span class=&quot;math-container&quot;&gt;$2^3 = 8$&lt;/span&gt; basis states.&lt;/li&gt;&#xA;&lt;li&gt;To implement &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13313/how-can-you-decompose-grovers-diffusion-operator-into-gates&quot;&gt;here&lt;/a&gt; is a question which shows how to implement it in basic gates&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-11-30T09:46:47.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14906" PostTypeId="1" CreationDate="2020-11-30T12:21:54.150" Score="4" ViewCount="139" Body="&lt;p&gt;I wrote a circuit that makes use of Toffoli gates, but it is too inefficient for my purpose.&lt;/p&gt;&#xA;&lt;p&gt;In my circuit the states of control qubits are fixed to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. So I wanted to know if there is an efficient way to realize a Toffoli for that fixed case.&lt;/p&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="8954" LastEditDate="2020-12-01T15:45:17.683" LastActivityDate="2020-12-16T17:38:12.883" Title="Is there an efficient way to realize a Toffoli with control qubits fixed at $|+\rangle$?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14907" PostTypeId="2" ParentId="14887" CreationDate="2020-11-30T14:33:15.847" Score="4" Body="&lt;p&gt;There are two different things at play here: (i) &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding&quot; rel=&quot;nofollow noreferrer&quot;&gt;superdense coding&lt;/a&gt; and (ii) &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's bound&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Holevo's bound tells us that &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can only store &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits of information. See for example, this answer:  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13140/how-can-the-holevo-bound-be-used-to-show-that-n-qubits-cannot-transmit-more-th/13191#13191&quot;&gt;How can the Holevo bound be used to show that $n$ qubits cannot transmit more than $n$ classical bits?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Superdense coding allows us to send 2 bits of information using a single qubit &lt;strong&gt;in the presence of&lt;/strong&gt; preshared entanglement. This is not the same as 1 qubit being &amp;quot;equal&amp;quot; to 2 bits of information.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-11-30T14:33:15.847" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14908" PostTypeId="2" ParentId="14906" CreationDate="2020-11-30T17:10:52.287" Score="6" Body="&lt;p&gt;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, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B1,%22Z%5E%C2%BC%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,%22Z%5E-%C2%BC%22,%22H%22%5D,%5B1,%22X%22,%22%E2%80%A2%22%5D,%5B1,%22Z%5E%C2%BC%22,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,%22Z%5E-%C2%BC%22%5D,%5B1,%22X%5E-%C2%BD%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22H%22,%22H%22,%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this circuit&lt;/a&gt; outputs the same thing as applying a Toffoli:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B1,%22Z%5E%C2%BC%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,%22Z%5E-%C2%BC%22,%22H%22%5D,%5B1,%22X%22,%22%E2%80%A2%22%5D,%5B1,%22Z%5E%C2%BC%22,%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B1,%22Z%5E-%C2%BC%22%5D,%5B1,%22X%5E-%C2%BD%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,%22%E2%80%A6%22%5D,%5B%22%E2%80%A2%22,%22%E2%80%A2%22,%22X%22%5D,%5B1,1,%22%E2%80%A2%22,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22H%22,%22H%22,%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ulktS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(Of course if you input a state other than &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; for that second qubit, the result won't be correct.)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and the target is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. 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 &lt;a href=&quot;https://arxiv.org/abs/1904.01124&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1904.01124&lt;/a&gt; says that the Tof-from-T conversion rate is somewhere between 3.63 and 4).&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2020-12-16T17:38:12.883" LastActivityDate="2020-12-16T17:38:12.883" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="14910" PostTypeId="1" AcceptedAnswerId="14918" CreationDate="2020-11-30T20:01:07.070" Score="4" ViewCount="133" Body="&lt;p&gt;I'm reading &lt;a href=&quot;https://arxiv.org/abs/2002.08953&quot; rel=&quot;nofollow noreferrer&quot;&gt;Huang et al. (2020)&lt;/a&gt; (&lt;a href=&quot;https://www.nature.com/articles/s41567-020-0932-7&quot; rel=&quot;nofollow noreferrer&quot;&gt;nature physics&lt;/a&gt;), where the authors present a version of Aaronson's &lt;em&gt;shadow tomography&lt;/em&gt; scheme as follows (see page 11 in the arXiv version):&lt;/p&gt;&#xA;&lt;p&gt;We want to estimate a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. We apply a number of random unitary evolutions, &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto U\rho U^\dagger$&lt;/span&gt;, picking &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; from an ensemble &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt;. For each choice of unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we perform a measurement, observing a state &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. We then apply the inverse evolution to this state, obtaining &lt;span class=&quot;math-container&quot;&gt;$U^\dagger|b\rangle$&lt;/span&gt;. On average, this procedure leaves us with the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal M(\rho) =\mathbb E_{U\sim\mathcal U}\Bigg[&#xA;  \sum_b \underbrace{\langle b|U\rho U^\dagger|b\rangle}_{\text{prob of observing $|b\rangle$}} \!\!\!\!\!\!\!&#xA;  \overbrace{(U^\dagger |b\rangle\!\langle b|U)}^{\text{post-measurement state}}&#xA;\Bigg].$$&lt;/span&gt;&#xA;The claim is then that &lt;span class=&quot;math-container&quot;&gt;$\mathcal M$&lt;/span&gt; can be inverted to obtain, on average, the original state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \hat\rho=\mathcal M^{-1}(U^\dagger |\hat b\rangle\!\langle \hat b| U)&#xA;  \,\,\text{ is such that } \,\, \mathbb E[\hat \rho]=\rho.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there an easy way to see how one would go in performing such inversion? The authors mention that we are thinking here of &lt;span class=&quot;math-container&quot;&gt;$\mathcal M$&lt;/span&gt; as a linear map, so I suppose we represent &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal M(\sigma_i)$&lt;/span&gt; for some complete basis of Hermitians &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_i\}_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-12-01T09:14:58.523" LastActivityDate="2020-12-02T08:57:22.150" Title="In shadow tomography, how is the state reconstructed from its shadows?" Tags="&lt;quantum-state&gt;&lt;tomography&gt;&lt;shadow-tomography&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14911" PostTypeId="2" ParentId="14867" CreationDate="2020-11-30T20:37:52.787" Score="0" Body="&lt;p&gt;Could you try this as an alternative?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit import Parameter, Gate&#xA;&#xA;&#xA;class UHGate(Gate):&#xA;    def __init__(self, theta, label=None):&#xA;        super().__init__('U', 2, [theta], label=label)&#xA;        &#xA;        &#xA;    def _define(self):&#xA;        qc = QuantumCircuit(2)&#xA;        qc.unitary(self.to_matrix(), [0, 1])&#xA;        &#xA;        self.definition = qc&#xA;        &#xA;    def to_matrix(self):&#xA;        t = float(self.params[0])&#xA;        a = np.exp(-2j * t)&#xA;        c = np.cos(2 * t)&#xA;        s = -1j * np.sin(2 * t)&#xA;&#xA;        return np.array([[a, 0, 0, 0], &#xA;                         [0, c, s, 0], &#xA;                         [0, s, c, 0],&#xA;                         [0, 0, 0, a]])&#xA;&#xA;&#xA;t = Parameter('θ')&#xA;qc = QuantumCircuit(2)&#xA;qc.append(UHGate(t), [0, 1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The idea is to 'delay' the building of the unitary gate to the point where you have available the values of the unbound parameters.&lt;/p&gt;&#xA;&lt;p&gt;Another option is to manually decompose the unitary operator into 1 and 2-qubit gates that Qiskit natively supports and can be parameterized.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-11-30T20:37:52.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14912" PostTypeId="2" ParentId="12611" CreationDate="2020-11-30T21:59:16.430" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here are some examples of the qubit requirement to represent the electronic Hamiltonian of &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$LiH$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2O$&lt;/span&gt; using both STO-3G or cc-pVDZ (correlation-consistent poralized valence only double zeta) basis set  under Jordan-Wigner transformation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JKLdQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JKLdQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;p&gt;Many literature papers seem to indicate &amp;quot;Chemical accuracy&amp;quot; calculation on quantum computer using STO-3G, and this might be the confusion... because what they ought to say is &amp;quot;Chemical precision&amp;quot;. 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.&lt;/p&gt;&#xA;&lt;p&gt;So in conclusion, we only use STO-3G because of the restriction we have with current quantum hardware. Not because it is better.&lt;/p&gt;&#xA;&lt;p&gt;It should be noted that the graph showing the required qubits above is not taking into different qubit reduction techniques like  &lt;a href=&quot;https://arxiv.org/abs/1701.08213&quot; rel=&quot;nofollow noreferrer&quot;&gt;qubit tapering&lt;/a&gt; and etc. People have been and are working on different quantum resource reduction schemes ( for example: &lt;a href=&quot;https://arxiv.org/abs/2009.01872&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/1907.01493&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-01T01:00:57.803" LastActivityDate="2020-12-01T01:00:57.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14913" PostTypeId="2" ParentId="13361" CreationDate="2020-12-01T03:34:39.747" Score="1" Body="&lt;p&gt;One naive way is based from this paper, &lt;a href=&quot;https://arxiv.org/abs/1801.03897&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cloud Quantum Computing of an Atomic Nucleus&lt;/a&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;So let's say your original circuit is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YkCuZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YkCuZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here you have 1 CNOT gate. Then you would perform another execution using a longer but identical circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YSJcp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YSJcp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here you have 3 CNOT gates. At this point, you use the two results to do your extrapolation.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-01T03:34:39.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14914" PostTypeId="1" CreationDate="2020-12-01T06:56:40.107" Score="0" ViewCount="29" Body="&lt;p&gt;I need the optimal encoding protocol for 3 &lt;span class=&quot;math-container&quot;&gt;$\rightarrow$&lt;/span&gt; 1 Classical RAC such that the receiver is able to retrieve any &lt;strong&gt;one&lt;/strong&gt; of the initial bits, as well as the &lt;em&gt;XOR&lt;/em&gt; combinations of those bits.  ( If a, b, c are the bits in the string, then Bob would be asked to predict one of the &lt;strong&gt;seven&lt;/strong&gt; possible functions, namely, a, b, c, a&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;b, b&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;c, a&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;c, a&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;b&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;c).&lt;/p&gt;&#xA;&lt;p&gt;The maximum that I got was 0.66 by encoding 000, 001, 110, 010, 101 as 0, and the rest of the strings as 1. Some other encodings have also given the same success probabilities.&lt;/p&gt;&#xA;&lt;p&gt;But is this optimal? If so, how do I prove it?&lt;/p&gt;&#xA;" OwnerUserId="13591" LastEditorUserId="55" LastEditDate="2020-12-07T11:55:55.647" LastActivityDate="2020-12-07T11:55:55.647" Title="RAC for XOR functions" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;probability&gt;&lt;qrac&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14915" PostTypeId="2" ParentId="14910" CreationDate="2020-12-01T07:16:12.393" Score="3" Body="&lt;p&gt;This is not a complete answer but a couple of comments that should help clarify these details:&lt;/p&gt;&#xA;&lt;p&gt;(i) &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; invertible as a quantum channel but as a linear map; namely, even though the inverse exists, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^{-1}$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\{ e^{t \mathcal{L}} \}_{t \geq 0}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}$&lt;/span&gt; is the Lindbladian; clearly &lt;span class=&quot;math-container&quot;&gt;$e^{-t \mathcal{L}}$&lt;/span&gt; is the inverse, but it is not CP.&lt;/p&gt;&#xA;&lt;p&gt;(ii) The authors assume ``tomographic completeness,'' that is, for each &lt;span class=&quot;math-container&quot;&gt;$\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$&lt;/span&gt; which ensures that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^{-1}$&lt;/span&gt; exists and is unique.&lt;/p&gt;&#xA;&lt;p&gt;(iii) The classical shadow, &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho}$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; necessarily positive semidefinite since it originates from the application of a not CP map on some state.&lt;/p&gt;&#xA;&lt;p&gt;(iv) &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}^{-1}$&lt;/span&gt; is applied to the &lt;em&gt;classically stored&lt;/em&gt; measurement outcomes, &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger} | \hat{b} \rangle \langle  \hat{b} | U$&lt;/span&gt; and not the quantum states themselves.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-12-01T07:16:12.393" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14917" PostTypeId="1" CreationDate="2020-12-01T11:06:07.647" Score="1" ViewCount="88" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result = job.result() &#xA;execution_time = result.time_taken&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but in this particular case what I need is more like a &amp;quot;signal&amp;quot;, 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.&lt;/p&gt;&#xA;" OwnerUserId="13893" LastEditorUserId="55" LastEditDate="2020-12-10T08:41:53.663" LastActivityDate="2020-12-10T08:41:53.663" Title="How to measure a quantum circuit's execution time on a real IBM device?" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14918" PostTypeId="2" ParentId="14910" CreationDate="2020-12-01T11:33:31.257" Score="3" Body="&lt;p&gt;Under the assumption that the ensemble &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;Define:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta_b = U^{\dagger}|b\rangle\langle b| U$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{M}(\rho) = \int d\mu_{\small{HARR}}  \sum_b \mathrm{Tr}(\rho \theta_b) \theta_b$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(&lt;span class=&quot;math-container&quot;&gt;$d\mu_{\small{HARR}} $&lt;/span&gt; is normalized to a unit volume). Suppose that we need to measure the expectation of an operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. We measure this operator in the final state average the expectations over the ensemble and the computational basis projectors, we obtain the following result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}(\mathcal{M}(\rho) O) = \int d\mu_{\small{HARR}} \sum_b \mathrm{Tr}(\rho \theta_b) \mathrm{Tr}(O \theta_b)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using the following identity:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the dimension of the Hilbert space), thus we obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}(\mathcal{M}(\rho) O) = \frac{ \mathrm{Tr}(O)+ \mathrm{Tr}(\rho O) }{(N+1)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From which the required expectation &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(\rho O)$&lt;/span&gt; can be computed.&lt;/p&gt;&#xA;&lt;p&gt;Of course, we can repeat the procedure for a complete basis of the Lie algebra &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{u}(N)$&lt;/span&gt; for a full tomography of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Explanation of the integration formula&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\theta_b = U^{\dagger}|b\rangle\langle b| U$&lt;/span&gt; is a one-dimensional projector can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\theta_b = |\Psi \rangle\langle\Psi|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ |\Psi\rangle$&lt;/span&gt; is a unit vector&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; uniformly scans the unitary group manifold, &lt;span class=&quot;math-container&quot;&gt;$ |\Psi\rangle$&lt;/span&gt; will uniformly scan a &lt;span class=&quot;math-container&quot;&gt;$2N-1$&lt;/span&gt; dimensional round sphere. This is because the metric of a round sphere is Haar. Thus, we need to evaluate an integral of the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\int_{S^{2N-1} }\langle\Psi| A |\Psi \rangle  \langle\Psi| B |\Psi\rangle  d\mu_{\small{ROUND}}(S^{2N-1}) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The integrand is a homogeneous polynomial of the components of the unit vector &lt;span class=&quot;math-container&quot;&gt;$ |\Psi\rangle = \sum_{a=1}^N \psi_a |a\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eJa6z.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eJa6z.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The constant can be evaluated by taking &lt;span class=&quot;math-container&quot;&gt;$A=B=I_{N\times N}$&lt;/span&gt;, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Const.} = \frac{1}{N(N+1)}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2020-12-02T08:57:22.150" LastActivityDate="2020-12-02T08:57:22.150" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14919" PostTypeId="1" CreationDate="2020-12-01T12:08:47.147" Score="3" ViewCount="101" Body="&lt;p&gt;I am executing a quantum circuit on an IBM quantum device. The circuit is simple:&lt;/p&gt;&#xA;&lt;p&gt;A single qubit (start from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;),&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Rx(&lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Measure (in z)&#xA;3 .Rx(&lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Measure (in z)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The final measurement probabilities should be&#xA;Prob:1/2, result:0; Prob:1/2, result:1.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13997" LastEditorUserId="55" LastEditDate="2020-12-10T08:41:58.123" LastActivityDate="2020-12-10T08:41:58.123" Title="IBMQ: Can I implement a quantum measurement in the middle of a quantum circuit?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14920" PostTypeId="1" CreationDate="2020-12-01T12:37:40.727" Score="1" ViewCount="51" Body="&lt;p&gt;I was reading a paper &lt;a href=&quot;https://arxiv.org/abs/1302.0398&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Polar codes by Mark M. Wilde&lt;/a&gt;, where he discusses the N uses of the channel in the classical-quantum channel setting. What does he mean by &amp;quot;multiple channel uses&amp;quot;?&lt;/p&gt;&#xA;&lt;p&gt;In the above context I want to use a depolarization channel &lt;span class=&quot;math-container&quot;&gt;$\Delta_{\lambda}$&lt;/span&gt; [&lt;a href=&quot;https://i.stack.imgur.com/Ywjx8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt;](&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_depolarizing_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Quantum_depolarizing_channel&lt;/a&gt;) over which &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Two options:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Should I evolve each of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits by &lt;span class=&quot;math-container&quot;&gt;$\Delta_{\lambda}(\rho_i)$&lt;/span&gt; indivisually and then do a tensor &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho_i}\bigotimes\hat{\rho_{i+1}}\bigotimes,...,\bigotimes\hat{\rho_N}$&lt;/span&gt;,to get final state&lt;/li&gt;&#xA;&lt;li&gt;Or should I input a composite state first and the evolve it as&#xA;&lt;span class=&quot;math-container&quot;&gt;$\Delta_{\lambda}(\rho^{\otimes N}) = \lambda\rho^{\otimes N}+\frac{1- \lambda}{2^N}I_{(2^N X \,2^N)}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ywjx8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ywjx8.png&quot; alt=&quot;A rough sketch about what I am want to do&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13996" LastEditorUserId="13996" LastEditDate="2020-12-02T11:12:01.997" LastActivityDate="2020-12-02T11:12:01.997" Title="What does it mean &quot;the N uses of classical-quantum channel&quot;?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;error-correction&gt;&lt;povm&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14921" PostTypeId="2" ParentId="14917" CreationDate="2020-12-01T13:28:51.113" Score="1" Body="&lt;p&gt;&lt;code&gt;result.time_taken&lt;/code&gt; &lt;em&gt;is&lt;/em&gt; the execution time. There is also &lt;code&gt;job.time_per_step()&lt;/code&gt; that gives you the timestamps of each step of the job's life cycle.&lt;/p&gt;&#xA;&lt;p&gt;If you're looking to set some variable locally in your program, the best you can do is probably use job status. &lt;code&gt;job.wait_for_final_state()&lt;/code&gt; supports a callback function that you can use to set the variable when status changes.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-12-01T13:28:51.113" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14922" PostTypeId="2" ParentId="14919" CreationDate="2020-12-01T16:08:16.243" Score="2" Body="&lt;p&gt;If you start with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and apply &lt;span class=&quot;math-container&quot;&gt;$Rx(\pi/2)$&lt;/span&gt; gate to it, which is the following circuit,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HwDgZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HwDgZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Your qubit is now in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|0\rangle - i|1\rangle}{\sqrt{2}}$&lt;/span&gt;. If you are making a measurement at this step,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mI0yg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mI0yg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then you qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; will collapsed onto one of the eigenstate &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. In this case, it will have &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{2}$&lt;/span&gt; probability of collapsing into either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$\bigg| \dfrac{1}{\sqrt{2} } \bigg|^2 = \dfrac{1}{2} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\bigg| \dfrac{-i}{\sqrt{2} } \bigg|^2 = \dfrac{1}{2} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So after the measurement, you have two possible results:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In either case, if you are making another measurement here, then you will guarantee to collapsed into that particular state with &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; probability. That is, if you your qubit collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; after the first measurement, then the second measurement will reads out the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; probability (assuming that there is no noise of course). And if you your qubit collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; after the first measurement, then the second measurement will reads out the state &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$100\%$&lt;/span&gt; probability.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jygWo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jygWo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$10,000$&lt;/span&gt; times then you expect &lt;span class=&quot;math-container&quot;&gt;$5000$&lt;/span&gt; times it will be in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$5000$&lt;/span&gt; times is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, if there is no noise... but because of noise we will deviate from these numbers a bit. We can test this with the &lt;code&gt;qasm_simulator&lt;/code&gt; from Qiskit on the circuit above:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XhXiK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XhXiK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;from qiskit import QuantumCircuit, BasicAer, execute&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;&#xA;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.rx(pi/2, qreg_q[0])&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots = 10000)&#xA;print('Counts of experiment:', job.result().get_counts())&#xA;plot_histogram(job.result().get_counts(), color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;code&gt;reset&lt;/code&gt; function in Qiskit to first put the qubit to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then do some operation in follow to get the qubit to that particular state.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if you have some 1 qubit quantum circuit, and we want to reset it back to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, then we can do the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dEySb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dEySb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The operation &lt;code&gt;reset&lt;/code&gt; is indicated by the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; symbol on the circuit. This put your qubit back to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Then by applying the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate (denoted as &lt;span class=&quot;math-container&quot;&gt;$U_3(\pi, 0 , \pi)$&lt;/span&gt; on the circuit) to it, you put your qubit back to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. So now, if you are making a measurement here, you will get a readout of the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$100 \%$&lt;/span&gt; probability.&lt;/p&gt;&#xA;&lt;p&gt;Here is the code to generate the circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;&#xA;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.rx(pi/2, qreg_q[0])&#xA;circuit.t(qreg_q[0])&#xA;circuit.s(qreg_q[0])&#xA;circuit.reset(qreg_q[0])&#xA;circuit.x(qreg_q[0])&#xA;circuit.decompose().draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update after comment:&lt;/strong&gt; To implement a &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi/4)$&lt;/span&gt; if the first measurement outcome is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and a &lt;span class=&quot;math-container&quot;&gt;$R_x(\pi/8)$&lt;/span&gt; if the first outcome is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; we can use &lt;code&gt;c_if&lt;/code&gt; operation. The circuit is the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ud4yj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ud4yj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I don't think this is implementable on hardware yet. Below is the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;from qiskit import QuantumCircuit, BasicAer, execute&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;&#xA;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.rx(pi/2, qreg_q[0])&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;circuit.rx(pi/4, qreg_q[0]).c_if(creg_c, 0)&#xA;circuit.rx(pi/8, qreg_q[0]).c_if(creg_c, 1)&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots = 1)&#xA;print('Counts of experiment:', job.result().get_counts())&#xA;plot_histogram(job.result().get_counts(), color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-02T03:06:37.830" LastActivityDate="2020-12-02T03:06:37.830" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14923" PostTypeId="1" AcceptedAnswerId="14924" CreationDate="2020-12-01T20:26:19.917" Score="1" ViewCount="70" Body="&lt;p&gt;Applying the Hadamard gate twice in a row, it restores the original input:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wbRIF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wbRIF.png&quot; alt=&quot;Two Hadamard gayes&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22%5D,%5B%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22H%22]]}&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, if a CNOT control is added between the two Hadamard gates, the output of the second Hadamard gate changes:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ymUWQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ymUWQ.png&quot; alt=&quot;A CxNOT gate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B%22Chance%22%5D,%5B%22H%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22%E2%80%A2%22,%22X%22],[%22Chance%22],[%22H%22]]}&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can't understand the behavior of the second Hadamard gate: the input has remaining &lt;span class=&quot;math-container&quot;&gt;$\frac{|0\rangle+|1\rangle}{\sqrt{2}}$&lt;/span&gt; and the gate does not seem to have any effect.&lt;/p&gt;&#xA;" OwnerUserId="13982" LastEditorUserId="13982" LastEditDate="2020-12-01T20:31:34.747" LastActivityDate="2020-12-01T21:52:57.470" Title="A CNOT between two Hadamard gates: why does the CNOT changed the output of the second Hadamard gate?" Tags="&lt;quantum-gate&gt;&lt;hadamard&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14924" PostTypeId="2" ParentId="14923" CreationDate="2020-12-01T21:11:17.503" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; anymore.&lt;/p&gt;&#xA;&lt;p&gt;That is consider the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nPDHh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nPDHh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$q_0 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; both start in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. So you start with the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{init} = |0\rangle \otimes |0\rangle = |00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;By first applying the Hadamard gate on the first qubit put the system in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_0 = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \otimes |0\rangle = \dfrac{|00\rangle + |10\rangle}{\sqrt{2}}$&lt;/span&gt;. Here you can say that your first qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$|q_0 \rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; and your second qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle = |0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;br&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Then, applying the CNOT gate here with the controlled-qubit being &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and target qubit being &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; puts the state in &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_1 = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $&lt;/span&gt;.&#xA;Note that you can no longer can write &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_1 = |q_0 \rangle \otimes |q_1\rangle$&lt;/span&gt;. That is, you can't say that the first qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; and the second qubit in some state &lt;span class=&quot;math-container&quot;&gt;$|q_1\rangle$&lt;/span&gt;. They are &lt;strong&gt;entangled&lt;/strong&gt; to one another.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;br&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Lastly, if you apply the Hadamard gate to the first qubit, which is applying the operation &lt;span class=&quot;math-container&quot;&gt;$H \otimes I = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp;-1 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} $&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle =  \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1\\ 0 \\ 0 \\1 \end{pmatrix} $&lt;/span&gt;&#xA;we will get the final state&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{final} = \dfrac{|00\rangle + |01\rangle + |10\rangle - |11\rangle}{2} = \dfrac{1}{2} \begin{pmatrix} 1\\ 1 \\ 1 \\-1 \end{pmatrix}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This is the reason why you see that you have &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability of measuring the first qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; probability of measuring it in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-01T21:52:57.470" LastActivityDate="2020-12-01T21:52:57.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14925" PostTypeId="1" CreationDate="2020-12-02T04:15:27.877" Score="3" ViewCount="46" Body="&lt;p&gt;Say I have a qubit in the state (ignoring normalization) &lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle = \alpha|0\rangle + e^{i\alpha}\beta|1\rangle.$$&lt;/span&gt;&#xA;How can I invert the sign of its phase, thus making it &lt;span class=&quot;math-container&quot;&gt;$$\alpha|0\rangle + e^{-i\alpha}\beta|1\rangle$$&lt;/span&gt; using only the basic gates &lt;span class=&quot;math-container&quot;&gt;$\{X,Y,Z,H,S\}?$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14005" LastEditorUserId="55" LastEditDate="2020-12-10T08:40:35.723" LastActivityDate="2020-12-10T08:40:35.723" Title="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$?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14926" PostTypeId="1" CreationDate="2020-12-02T07:54:44.860" Score="2" ViewCount="31" Body="&lt;p&gt;I need to optimize a general version of 3&lt;span class=&quot;math-container&quot;&gt;$\rightarrow$&lt;/span&gt;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&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;B, A&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;c, B&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;C, A&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;B&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;C). I know that build in optimization in Mathematica could be used for this kind of stuff, but I'm unsure how to proceed.&lt;/p&gt;&#xA;&lt;p&gt;Kindly ask if you have any confusion regarding my problem. Thanks&lt;/p&gt;&#xA;" OwnerUserId="13591" LastActivityDate="2020-12-03T10:38:06.763" Title="Numerical optimization of QRAC" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;bloch-sphere&gt;&lt;qrac&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14927" PostTypeId="1" CreationDate="2020-12-02T08:48:16.673" Score="2" ViewCount="399" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="14007" LastEditorUserId="55" LastEditDate="2020-12-10T08:41:25.067" LastActivityDate="2020-12-10T08:41:25.067" Title="Maximum number of qubits suppoted by the Qasm simulator" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14928" PostTypeId="2" ParentId="14927" CreationDate="2020-12-02T09:24:03.217" Score="0" Body="&lt;p&gt;If you use &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt; then the maximum number of qubit supported is 32. And you can't increase this number. Here is &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/backends/simulators/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit documentation&lt;/a&gt; on this simulator.&lt;/p&gt;&#xA;&lt;p&gt;Remember that simulating quantum system is very resource extensive, and being able to simulating a system with 32 qubits is pretty impressive.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-02T09:24:03.217" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14929" PostTypeId="1" CreationDate="2020-12-02T09:31:37.170" Score="4" ViewCount="119" Body="&lt;p&gt;Consider two &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit Haar-random quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$D_{|\psi\rangle}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D_{|\phi\rangle}$&lt;/span&gt; be the two probability distributions (over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit strings) obtained by measuring &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; respectively, in the standard basis. I had two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What can we say about the total variation distance between &lt;span class=&quot;math-container&quot;&gt;$D_{|\psi\rangle}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D_{|\phi\rangle}$&lt;/span&gt; (with some probability over the choice of a particular &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;)?&lt;/li&gt;&#xA;&lt;li&gt;Are &lt;span class=&quot;math-container&quot;&gt;$D_{|\psi\rangle}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D_{|\phi\rangle}$&lt;/span&gt; computationally/statistically indistinguishable (again with some probability over the choice of a particular &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;EDIT: I managed to prove that they are not statistically indistinguishable, with overwhelming probability. However, are they computationally indistinguishable?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2020-12-03T03:08:32.427" LastActivityDate="2020-12-05T19:02:16.343" Title="How close or far apart are the distributions generated by two Haar random states?" Tags="&lt;quantum-state&gt;&lt;haar-distribution&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14930" PostTypeId="2" ParentId="14925" CreationDate="2020-12-02T09:31:48.837" Score="4" Body="&lt;p&gt;This very much depends on whether you know the phase &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; (which I assume is not intended to be the same as the amplitude &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;!).&lt;/p&gt;&#xA;&lt;p&gt;If you do not know the phase &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, 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).&lt;/p&gt;&#xA;&lt;p&gt;If you know &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, then the gate you need to implement is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cc} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{-2i\alpha} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\alpha=\pm\pi/4,\pm\pi/2$&lt;/span&gt;, corresponding to the operations &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; respectively I've left out some &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; factors as you can consider them as signs incorporated into the &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-02T09:31:48.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14931" PostTypeId="2" ParentId="14927" CreationDate="2020-12-02T09:31:53.423" Score="3" Body="&lt;p&gt;Actually, the maximum number of qubits in the local &lt;code&gt;qasm_simulator&lt;/code&gt; is 30, and 32 for the &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;. You can see this 30-limit by running &lt;code&gt;Aer.get_backend('qasm_simulator').configuration().to_dict()&lt;/code&gt; and you can see the configuration for the simulator, including the max number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/7_matrix_product_state_method.html?highlight=matrix%20product%20state&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tuto&lt;/a&gt; from Qiskit, they might go through it :)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.QasmSimulator.html?highlight=backend_option&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation from Qiskit&lt;/a&gt; that explains pretty much everything there is to know!&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="12396" LastEditDate="2020-12-02T10:37:51.043" LastActivityDate="2020-12-02T10:37:51.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14932" PostTypeId="1" AcceptedAnswerId="14995" CreationDate="2020-12-02T17:02:35.220" Score="3" ViewCount="96" Body="&lt;p&gt;Given two states &lt;span class=&quot;math-container&quot;&gt;$\rho_A, \sigma_A$&lt;/span&gt;, Uhlmann's theorem states that the fidelity between them is achieved in the following way&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho_A, \sigma_A) = \max_{U_{R'}}F(\rho_{AR'}, (I\otimes U_{R'})\sigma_{AR'})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U_{R'}$&lt;/span&gt; are unitary operators and &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR'}, \sigma_{AR'}$&lt;/span&gt; are arbitrary purifications.&lt;/p&gt;&#xA;&lt;p&gt;Instead of purifications, let us consider extensions of the state. That is, let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR}$&lt;/span&gt; (possibly a mixed state) satisfy &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_R(\rho_{AR}) = \rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}$&lt;/span&gt; (possibly a  mixed state) satisfy &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_R(\sigma_{AR}) = \sigma_A$&lt;/span&gt;. I am aware of the following fact (5.33 of &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/QIT-notes/QIT-notes.05.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;these notes&lt;/a&gt;): For any fixed extension &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR}$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho_A, \sigma_A) = \max_{\sigma_{AR}}\{F(\rho_{AR}, \sigma_{AR}) : \text{Tr}_R(\sigma_{AR}) = \sigma_A\} \tag{1}$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\sigma^*_{AR}$&lt;/span&gt; be the state that achieves the maximum above.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How is &lt;span class=&quot;math-container&quot;&gt;$\sigma^*_{AR}$&lt;/span&gt; related to an arbitrary extension &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}$&lt;/span&gt;? If they were purifications, one had the simple fact that they were related by a unitary on &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|R|$&lt;/span&gt; was large enough that there exist pure extension states &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}$&lt;/span&gt;, then is &lt;span class=&quot;math-container&quot;&gt;$\sigma^*_{AR}$&lt;/span&gt;, the extension that achieves the maximum in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, also pure?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2020-12-04T17:06:08.380" LastActivityDate="2020-12-05T16:43:58.907" Title="Fidelity of extensions of states" Tags="&lt;quantum-state&gt;&lt;information-theory&gt;&lt;fidelity&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14933" PostTypeId="1" CreationDate="2020-12-02T18:47:28.850" Score="4" ViewCount="85" Body="&lt;p&gt;According to the tutorial &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt; I understand the mathematical principle of diffusion operator:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{equation}&#xA;\begin{split}&#xA;U_s&amp;amp;=2\left|s\right\rangle\left\langle s\right|-I \\&#xA;&amp;amp;=H^{\otimes n}U_0H^{\otimes n} \\&#xA;&amp;amp;=H^{\otimes n}\left(2\left|0\right\rangle\left\langle 0\right|-I\right)H^{\otimes n} \\&#xA;&amp;amp;=H^{\otimes n}\begin{bmatrix}1 &amp;amp; &amp;amp; &amp;amp; \\ &amp;amp; -1 &amp;amp; &amp;amp; \\ &amp;amp; &amp;amp; \ddots &amp;amp; \\ &amp;amp; &amp;amp; &amp;amp; -1\end{bmatrix}H^{\otimes n}&#xA;\end{split}&#xA;\end{equation}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, for two qubits&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}&#xA;\begin{pmatrix}1 \\ 1 \\ -1 \\ 1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;applying the diffusion operator and we got&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes 2}U_0H^{\otimes 2}\frac{1}{2}&#xA;\begin{pmatrix}1 \\ 1 \\ -1 \\ 1 \end{pmatrix}=\begin{pmatrix}0 \\ 0 \\ 1 \\ 0 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H^{\otimes 2}=\begin{bmatrix}1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1 \\1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So far this transformation is working well, it reflected the states of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left|s\right\rangle\left\langle s\right|=H^{\otimes n}\left|0\right\rangle\left\langle 0\right|H^{\otimes n}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13982" LastEditorUserId="13982" LastEditDate="2020-12-03T07:14:48.287" LastActivityDate="2020-12-03T11:18:08.643" Title="How to understand intuitively the Grover diffusion operator?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14934" PostTypeId="1" AcceptedAnswerId="14999" CreationDate="2020-12-02T20:00:23.350" Score="3" ViewCount="165" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$3 \times 3$&lt;/span&gt; (Hermitian) Hamiltonian matrix into a qubit operator and then use the built-in VQE solver for evaluating the minimum eigenvalue for said matrix.&lt;/p&gt;&#xA;&lt;p&gt;I have been successful in doing something similar using the &lt;code&gt;qiskit.chemistry.FermionicOperator&lt;/code&gt; built-in class (see example below) but for this example the Hamiltonian is mapped to a Fermionic one-body qubit Hamiltonian which has &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; eigenvalues instead of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; eigenvalues (where &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt; 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 &lt;code&gt;FermionicOperator&lt;/code&gt; class but it did not help me much).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import scipy&#xA;import h5py&#xA;&#xA;from qiskit.aqua.algorithms import VQE, NumPyEigensolver&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit import Aer&#xA;&#xA;backend = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;&#xA;c1=1&#xA;c2=2&#xA;c3=3&#xA;&#xA;ff=np.zeros((3,3))&#xA;ff[1,1]=2&#xA;ff[2,2]=1&#xA;&#xA;n=3&#xA;&#xA;Hamil=np.zeros((n,n))&#xA;Hamil[1,1]=c2&#xA;Hamil[2,2]=-c3/2+c2&#xA;Hamil[0,2]=np.sqrt(2)*c1&#xA;Hamil[1,2]=np.sqrt(2)*c1&#xA;Hamil[2,0]=np.sqrt(2)*c1&#xA;Hamil[2,1]=np.sqrt(2)*c1&#xA;&#xA;vals,vecs=np.linalg.eig(Hamil)&#xA;&#xA;print(&amp;quot;Standard Eigenvalues: &amp;quot;)&#xA;print(vals)&#xA;&#xA;Hamil_op = FermionicOperator(h1=Hamil)&#xA;Hamil_ops = Hamil_op.mapping(map_type='parity', threshold=1e-12)&#xA;result = NumPyEigensolver(Hamil_ops,k=int(2**n)).run()&#xA;&#xA;print(&amp;quot;Quibit Eigenvalues=&amp;quot;)&#xA;print(result['eigenvalues'])&#xA;&#xA;vqe = VQE(operator=Hamil_ops)&#xA;vqe_result = np.real(vqe.run(backend)['eigenvalue'])&#xA;print(&amp;quot;VQE Eigenvalue&amp;quot;)&#xA;print(vqe_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;With result:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Standard Eigenvalues:&#xA;[-1.45426242  0.90078898  3.05347344]&#xA;Quibit Eigenvalues=&#xA;[-1.45426242+0.j -0.55347344+0.j  0.        +0.j  0.90078898+0.j&#xA;  1.59921102+0.j  2.5       +0.j  3.05347344+0.j  3.95426242+0.j]&#xA;VQE Eigenvalue&#xA;0.18608074335373637&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14009" LastEditorUserId="55" LastEditDate="2020-12-10T08:41:46.163" LastActivityDate="2020-12-10T08:41:46.163" Title="Using Qiskit VQE for solving an eigenvalue problem" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;vqe&gt;&lt;eigenvalue&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14935" PostTypeId="2" ParentId="14933" CreationDate="2020-12-02T20:17:16.477" Score="2" Body="&lt;p&gt;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 : &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = [\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$$&lt;/span&gt; When we apply &lt;span class=&quot;math-container&quot;&gt;$U_\omega$&lt;/span&gt; we will flip (&amp;quot;add a minus&amp;quot;) to the 3rd number : &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = [\frac{1}{2}, \frac{1}{2}, -\frac{1}{2}, \frac{1}{2}]$$&lt;/span&gt; When we apply Grover's diffusion operator, we take the mean/average : &lt;span class=&quot;math-container&quot;&gt;$$a = \frac{3*\frac{1}{2}-\frac{1}{2}}{4}=\frac{1}{4}$$&lt;/span&gt; When we do the inversion around the mean of a number &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;, we do &lt;span class=&quot;math-container&quot;&gt;$-v+2*a$&lt;/span&gt; which gives us : &lt;span class=&quot;math-container&quot;&gt;$$-\frac{1}{2}+(2*\frac{1}{4})=0$$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$$-(-\frac{1}{2})+(2*\frac{1}{4})=1$$&lt;/span&gt;. If we do this for every element, this gives us : &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = [0, 0, 1, 0]$$&lt;/span&gt; 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 &lt;em&gt;quantum computing for computer scientists&lt;/em&gt;. If you have any more questions, please write a coment !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2020-12-02T20:17:16.477" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14936" PostTypeId="1" CreationDate="2020-12-02T22:40:30.303" Score="6" ViewCount="64" Body="&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/1511.02306&quot; rel=&quot;noreferrer&quot;&gt;Childs et al. (2017)&lt;/a&gt; algorithm can solve the quantum linear systems problem (QLSP) in &lt;span class=&quot;math-container&quot;&gt;$\operatorname{poly}(\log N, \log(1/\epsilon))$&lt;/span&gt; time while the HHL algorithm solves it in &lt;span class=&quot;math-container&quot;&gt;$\operatorname{poly}(\log N, 1/\epsilon)$&lt;/span&gt; time. So, if the Childs algorithm is superior, then why is the HHL more popular?&lt;/p&gt;&#xA;&lt;p&gt;Additionally, are there any examples of the Childs algorithm being used to solve a system of equations on a real or simulated quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="55" LastEditDate="2020-12-03T09:58:41.400" LastActivityDate="2020-12-03T09:58:41.400" Title="Why is HHL the popular choice to solve QLSP and not the Childs et al. (2017) algorithm?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14937" PostTypeId="2" ParentId="14855" CreationDate="2020-12-02T23:01:07.073" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="12864" LastActivityDate="2020-12-02T23:01:07.073" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14938" PostTypeId="1" CreationDate="2020-12-02T23:32:39.550" Score="1" ViewCount="34" Body="&lt;p&gt;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?&#xA;Also, are measurements on qubits simultaneous? Does it differ with devices?&lt;/p&gt;&#xA;" OwnerUserId="12967" LastEditorUserId="55" LastEditDate="2020-12-10T08:44:01.097" LastActivityDate="2020-12-10T08:44:01.097" Title="Mechanism of measurement in IBM quantum devices" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14939" PostTypeId="2" ParentId="14938" CreationDate="2020-12-03T01:05:26.350" Score="2" Body="&lt;p&gt;&lt;em&gt;I don't know if this is what you are looking for but I will try to write out what I see.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you are thinking of a circuit like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IZobP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IZobP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then the gates on the first qubit, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3IOSC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3IOSC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, if you looking at a circuit that have entangled gate between the two qubits,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5L3wA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5L3wA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then the measurement on the second qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;. The result won't change.&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;Also, if you have a circuit like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TM9qR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TM9qR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then the Hadamard gate on the second qubit, &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-03T01:05:26.350" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14940" PostTypeId="1" AcceptedAnswerId="14941" CreationDate="2020-12-03T01:11:27.283" Score="5" ViewCount="384" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\Psi^+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Phi^-\rangle$&lt;/span&gt;, but I'm not exactly sure if there's a way to create the superposition of all the possible states.&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="9006" LastEditDate="2020-12-03T13:26:43.540" LastActivityDate="2020-12-03T13:26:43.540" Title="Is there a way to create a superposition of all the possible states?" Tags="&lt;circuit-construction&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14941" PostTypeId="2" ParentId="14940" CreationDate="2020-12-03T01:17:35.150" Score="9" Body="&lt;p&gt;Do you mean mapping the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle $&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;If that is the case then you can just apply &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;. That is, you apply a Hadamard gate to each of the qubit.&lt;/p&gt;&#xA;&lt;p&gt;The reason for this is &lt;span class=&quot;math-container&quot;&gt;$H |0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} \overbrace{H|0\rangle \otimes H|0\rangle \otimes \cdots \otimes H|0\rangle}^{n \ \textrm{times}} &amp;amp;= \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}} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2^{n}}}\big( \overbrace{ |00\cdots0\rangle + |00\cdots1\rangle + \cdots + |11\cdots 1\rangle }^{2^n \ \textrm{terms} } \big)\\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-03T01:27:34.093" LastActivityDate="2020-12-03T01:27:34.093" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="14942" PostTypeId="2" ParentId="14933" CreationDate="2020-12-03T07:46:42.243" Score="1" Body="&lt;p&gt;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 &lt;em&gt;reflection&lt;/em&gt; of the state-vector about the state &lt;span class=&quot;math-container&quot;&gt;$|u\rangle = \frac{1}{2^{n/2}}\sum_x\lvert x\rangle$&lt;/span&gt;, which is the equal superposition of all the basis states for an n-qubit system.&lt;/p&gt;&#xA;&lt;p&gt;To understand this, consider the general state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Flipping the amplitudes about the mean (&lt;span class=&quot;math-container&quot;&gt;$\mu = \frac{\alpha+\beta}{2}$&lt;/span&gt;) would yield the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\prime\rangle = \beta|0\rangle + \alpha|1\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;To reflect about the state &lt;span class=&quot;math-container&quot;&gt;$|u\rangle = \frac{1}{\sqrt{2}}{|0\rangle}+\frac{1}{\sqrt{2}}{|1\rangle}$&lt;/span&gt;, you would first have to find the angle between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;, and then rotate &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; by twice that angle. You can verify using the general &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; rotation matrix that this yields &lt;span class=&quot;math-container&quot;&gt;$|\psi\prime\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now, to answer your question about the presence of the Hadamard Gate -&lt;/p&gt;&#xA;&lt;p&gt;When you want to reflect a given state about the equal superposition over all basis states &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;, the easy way to think about it is using these 3 steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Transform &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^n$&lt;/span&gt; - This is achieved by applying the Hadamard Transform to all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/li&gt;&#xA;&lt;li&gt;Reflect your vector (which would also have been transformed by the application of the Hadamard transform) about &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^n$&lt;/span&gt;. The matrix for this is &lt;span class=&quot;math-container&quot;&gt;$diag_n(1, -1, -1, ..., -1)$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Transform  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle ^n$&lt;/span&gt; back to &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; to reverse what you did in the first step. Since the Hadamard gate is its own inverse, this is equivalent to repeating Step 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Putting it all together, the diffusion operator is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H^{\otimes n} \begin{bmatrix}1 &amp;amp; &amp;amp; &amp;amp; \\ &amp;amp; -1 &amp;amp; &amp;amp; \\ &amp;amp; &amp;amp; \ddots &amp;amp; \\ &amp;amp; &amp;amp; &amp;amp; -1\end{bmatrix} H^{\otimes n}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8955" LastEditorUserId="8955" LastEditDate="2020-12-03T11:18:08.643" LastActivityDate="2020-12-03T11:18:08.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14943" PostTypeId="2" ParentId="14926" CreationDate="2020-12-03T10:38:06.763" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The algorithm normally used in this case is the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0107093&quot; rel=&quot;nofollow noreferrer&quot;&gt;see-saw&lt;/a&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;More precisely, the probability of success is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_\text{succ} := \sum_{x,y,b} c_{xyb} \operatorname{tr} \rho_x E^b_y,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho_x$&lt;/span&gt; will be the 8 different states you use to encode the bits, and &lt;span class=&quot;math-container&quot;&gt;$\{E^0_y,E^1_y\}$&lt;/span&gt; the 7 different POVMs that should get the functions you want. The coefficients &lt;span class=&quot;math-container&quot;&gt;$c_{xyb}$&lt;/span&gt; are then determined by the functions.&lt;/p&gt;&#xA;&lt;p&gt;Define then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ A^b_y := \sum_{x} c_{xyb} \rho_x $$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ B_x:= \sum_{y,b} c_{xyb} E^b_y,$$&lt;/span&gt;&#xA;so that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_\text{succ} = \sum_{x} \operatorname{tr} \rho_x B_x = \sum_{yb} \operatorname{tr} A^b_y E^b_y. $$&lt;/span&gt;&#xA;Then a given choice of observables determines &lt;span class=&quot;math-container&quot;&gt;$B_x$&lt;/span&gt;, and you get the optimal states for them by maximizing &lt;span class=&quot;math-container&quot;&gt;$\sum_{x} \operatorname{tr} \rho_x B_x $&lt;/span&gt;, and a given choice of states determines &lt;span class=&quot;math-container&quot;&gt;$A^b_y$&lt;/span&gt;, and you get the optimal observables for them by maximizing &lt;span class=&quot;math-container&quot;&gt;$\sum_{yb} \operatorname{tr} A^b_y E^b_y$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-12-03T10:38:06.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14944" PostTypeId="1" CreationDate="2020-12-03T11:18:33.083" Score="4" ViewCount="52" Body="&lt;p&gt;I have been trying to implement a QAOA for solving a traveling salesman problem (TSP) using &lt;code&gt;qulacs&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt;. However, even for 3 cities, the implementation fails. Within QAOA, we try to minimise&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{equation}&#xA;F_p(\gamma,\beta) = \langle \gamma,\beta | C | \gamma,\beta\rangle,&#xA;\end{equation}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is the cost function of the TSP, and &lt;span class=&quot;math-container&quot;&gt;$|\gamma,\beta\rangle$&lt;/span&gt; is a quantum state depending on these two angles. I had a closer look at my classical optimisation of the angles &lt;span class=&quot;math-container&quot;&gt;$\beta, \gamma$&lt;/span&gt;, for which I used the &lt;code&gt;scipy.optimize.minimize&lt;/code&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. It seems like the optimisation got stuck in many local minima.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13925" LastEditorUserId="55" LastEditDate="2020-12-10T08:45:40.233" LastActivityDate="2021-01-05T22:22:16.333" Title="Classical optimisation of angles in QAOA for TSP gets stuck in local minima?" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14945" PostTypeId="1" AcceptedAnswerId="14949" CreationDate="2020-12-03T14:40:54.270" Score="1" ViewCount="79" Body="&lt;p&gt;I created a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state then applied &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate to get &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt; and then I meausred my state. But I always found 1.&#xA;I expected to find 0 and 1 uniformly random like the case of beam splitter.&lt;/p&gt;&#xA;&lt;p&gt;Here is my code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qubit = cirq.NamedQubit(&amp;quot;myqubit&amp;quot;)&#xA;circuit = cirq.Circuit(cirq.H(qubit))&#xA;for i in range(10):&#xA;    result2 = cirq.measure(qubit, key='myqubit')&#xA;    print(result2)&#xA;print(circuit)&#xA;# run simulation&#xA;result = cirq.Simulator().simulate(circuit)&#xA;print(&amp;quot;result:&amp;quot;)&#xA;print(result)&#xA;print(result2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can I find uniformly random result ?&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2020-12-10T08:45:45.093" LastActivityDate="2020-12-10T08:45:45.093" Title="Why is the Measurement Result Always 1? (expected to find uniformly random measurement)" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;measurement&gt;&lt;cirq&gt;&lt;random-quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14946" PostTypeId="1" CreationDate="2020-12-03T14:46:10.277" Score="2" ViewCount="41" Body="&lt;p&gt;I have an evolved quantum composite state &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho}^{\otimes{N}}$&lt;/span&gt; that I retrieved from a quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, Now I do know how to define a POVM for the evolved states &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho}$&lt;/span&gt; that the channel outputs one by one. But how can I define POVM for composite quantum state.&lt;/p&gt;&#xA;&lt;p&gt;Suppose I embed &lt;span class=&quot;math-container&quot;&gt;$X = [1,0,1,1]$&lt;/span&gt; classical information into &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho_0 = \begin{pmatrix} &#xA;0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1   &#xA;\end{pmatrix}\rightarrow for \; x_0=1, \\ \rho_1 = \begin{pmatrix} &#xA;1 &amp;amp; 0 \\ &#xA;0 &amp;amp; 0   &#xA;\end{pmatrix} \rightarrow for \; x_1=0, \\\rho_2 = \begin{pmatrix} &#xA;0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1   &#xA;\end{pmatrix}\rightarrow for \; x_2=1, \\\rho_3 = \begin{pmatrix} &#xA;0 &amp;amp; 0 \\ &#xA;0 &amp;amp; 1   &#xA;\end{pmatrix} \rightarrow for \; x_3=1,$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now each of the &lt;span class=&quot;math-container&quot;&gt;$\rho_i^N$&lt;/span&gt; evolves when &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is applied and we get respective &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho_i}^N$&lt;/span&gt;, I tensor the evolved states and retrieve a composite quantum state as &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho_i}^{\otimes{N}}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$dXd$&lt;/span&gt; square matrix where &lt;span class=&quot;math-container&quot;&gt;$d=2^N$&lt;/span&gt;.&#xA;Now, how can I define POVM measurements to get the classical information back?&lt;/p&gt;&#xA;" OwnerUserId="13996" LastEditorUserId="55" LastEditDate="2020-12-10T08:45:54.863" LastActivityDate="2020-12-10T08:45:54.863" Title="How to define POVM measurement operators for a composite quantum state" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14947" PostTypeId="1" AcceptedAnswerId="14948" CreationDate="2020-12-03T15:26:44.643" Score="0" ViewCount="63" Body="&lt;p&gt;Give the following input:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A: 1110 \\&#xA;B: 0111 \\&#xA;\text{indicator}: 0 \text{ or } 1&#xA;$$&lt;/span&gt;&#xA;How do I copy the value of A or B to target qubits if indicator is 0 or 1 respectively?&lt;/p&gt;&#xA;&lt;p&gt;In the image below, the &lt;code&gt;indicator=0&lt;/code&gt; so the value of the &lt;code&gt;copy_of_a_or_b&lt;/code&gt; qubits should resemble &lt;code&gt;a_input&lt;/code&gt; qubits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/besC9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/besC9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I do this in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="13729" LastEditorUserId="55" LastEditDate="2020-12-10T08:46:53.777" LastActivityDate="2021-01-22T19:08:36.847" Title="Coping values based on indicator qubit in Qiskit" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14948" PostTypeId="2" ParentId="14947" CreationDate="2020-12-03T15:56:56.067" Score="0" Body="&lt;p&gt;It seems you are looking for a classical operation called &lt;em&gt;multiplexer&lt;/em&gt;. It is possible to build such operation with Qiskit's uniformly controlled gates (&lt;code&gt;UCGate&lt;/code&gt;). More info in &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.uc&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, this way might not be the easier way. After reading Cryoris' answer, here is my version of your example (which piggyback on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14950/1859&quot;&gt;Cryoris' great answer&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;Let's set your current circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;a_input = QuantumRegister(4, name='a')&#xA;b_input = QuantumRegister(4, name='b')&#xA;&#xA;inputs = QuantumCircuit(a_input, b_input)&#xA;&#xA;inputs.initialize('1110', a_input)&#xA;inputs.initialize('0111', b_input)&#xA;&#xA;inputs.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/izoPi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/izoPi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(side note, if your run &lt;code&gt;inputs.decompose().draw('mpl')&lt;/code&gt; you will notice that the order of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates are going to be &amp;quot;in reverse&amp;quot;. That's because &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8244/big-endian-vs-little-endian-in-qiskit&quot;&gt;Qiskit endianness&lt;/a&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Now, time to create the multiplexer. This scales up the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14950/1859&quot;&gt;Cryoris' answer&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import CXGate&#xA;&#xA;indicator = QuantumRegister(1, name='indicator')&#xA;a_or_b = QuantumRegister(4, name='aORb')&#xA;&#xA;multiplexer = QuantumCircuit(a_input, b_input, indicator, a_or_b)&#xA;for i in range(4):&#xA;    # If indicator is 0, copy from A&#xA;    multiplexer.append(CXGate().control(1, ctrl_state='0'), [indicator, a_input[i], a_or_b[i]])&#xA;    &#xA;multiplexer.barrier(a_input, b_input)&#xA;&#xA;for i in range(4):&#xA;    # If indicator is 1, copy from B&#xA;    multiplexer.append(CXGate().control(1, ctrl_state='1'), [indicator, b_input[i], a_or_b[i]])&#xA;&#xA;multiplexer.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FbNQ8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FbNQ8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The register &lt;code&gt;a_or_b&lt;/code&gt; needs to be measured:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;output = ClassicalRegister(4, name='output')&#xA;measure = QuantumCircuit(a_or_b)&#xA;measure.measure_all(a_or_b)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The composed result:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = inputs + multiplexer + measure&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aaLEc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aaLEc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, we need to &amp;quot;set&amp;quot; the &lt;code&gt;indicator&lt;/code&gt; qubit. Once circuit for each possibility:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;indicator0 = QuantumCircuit(indicator)&#xA;indicator0.initialize('0', indicator)&#xA;&#xA;indicator1 = QuantumCircuit(indicator)&#xA;indicator1.initialize('1', indicator)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Time to test how it works:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(indicator0 + circuit, backend=BasicAer.get_backend('qasm_simulator'))&#xA;job.result().get_counts().keys()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;dict_keys(['1110'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(indicator1 + circuit, backend=BasicAer.get_backend('qasm_simulator'))&#xA;job.result().get_counts().keys()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;dict_keys(['0111'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-12-03T17:48:32.840" LastActivityDate="2020-12-03T17:48:32.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14949" PostTypeId="2" ParentId="14945" CreationDate="2020-12-03T16:32:25.503" Score="0" Body="&lt;p&gt;You are not measuring your qubit. Look at what your &lt;code&gt;print(circuit)&lt;/code&gt; is returning&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;myqubit: ───H───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You need to add the measurement gate to the circuit like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = cirq.Circuit(cirq.H(qubit), cirq.measure(qubit, key='myqubit'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Printing this circuit returns &lt;code&gt;myqubit: ───H───M───&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;In your case, with the loop; you can append the gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(10):&#xA;    circuit.append(cirq.measure(qubit, key='myqubit'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Printing this one returns &lt;code&gt;myqubit: ───H───M───M───M───M───M───M───M───M───M───M───M───&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Both programs will get you the expected uniform random measurements.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2020-12-03T17:22:39.520" LastActivityDate="2020-12-03T17:22:39.520" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14950" PostTypeId="2" ParentId="14947" CreationDate="2020-12-03T16:34:37.123" Score="1" Body="&lt;p&gt;&amp;quot;Copying&amp;quot; a bit value from one qubit to another in this sense means applying a &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$CCX$&lt;/span&gt; or Toffoli. If you use an &amp;quot;ordinary&amp;quot; or closed control, the bit value will be copied if the indicator is 1. If you sandwich the control with two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates however -- an open control -- it will copy when the indicator is 0.&#xA;In your case you could just apply two &lt;span class=&quot;math-container&quot;&gt;$CCX$&lt;/span&gt; gates per bit where once you use an open control on the indicator and once a closed control on the indicator.&lt;/p&gt;&#xA;&lt;p&gt;In circuits (for only one bit, for several qubits just repeat this operation):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; from qiskit import QuantumCircuit, QuantumRegister&#xA;&amp;gt;&amp;gt;&amp;gt; from qiskit.circuit.library import XGate&#xA;&amp;gt;&amp;gt;&amp;gt; qr_a, qr_b, qr_i, qr_t = QuantumRegister(1, 'a'), QuantumRegister(1, 'b'), QuantumRegister(1, 'indicator'), QuantumRegister(1, 'target')&#xA;&amp;gt;&amp;gt;&amp;gt; circuit = QuantumCircuit(qr_a, qr_b, qr_i, qr_t)&#xA;&amp;gt;&amp;gt;&amp;gt; open_ccx = XGate().control(2, ctrl_state='01')&#xA;&amp;gt;&amp;gt;&amp;gt; closed_ccx = XGate().control(2)  # per default ctrl_state='00'&#xA;&amp;gt;&amp;gt;&amp;gt; circuit.append(open_ccx, [qr_a, qr_i, qr_t])  # copy A if indicator is 0&#xA;&amp;gt;&amp;gt;&amp;gt; circuit.append(closed_ccx, [qr_b, qr_i, qr_t])  # copy B if indicator is 1&#xA;&amp;gt;&amp;gt;&amp;gt; circuit.draw()&#xA;&#xA;        a_0: ──■───────&#xA;               │&#xA;        b_0: ──┼────■──&#xA;               │    │&#xA;indicator_0: ──o────■──&#xA;             ┌─┴─┐┌─┴─┐&#xA;   target_0: ┤ X ├┤ X ├&#xA;             └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And now the nicer solution by using a blockwise control. Since Qiskit can control arbitrary operations we can just define our custom &lt;code&gt;copy&lt;/code&gt; operation consisting of 4 $CX$ gates and then control this, once open and once closed. Like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; qr_a, qr_b, qr_i, qr_t = QuantumRegister(4, 'a'), QuantumRegister(4, 'b'), QuantumRegister(1, 'indicator'), QuantumRegister(4, 'target')&#xA;&amp;gt;&amp;gt;&amp;gt; circuit = QuantumCircuit(qr_a, qr_b, qr_i, qr_t)&#xA;&amp;gt;&amp;gt;&amp;gt; copy = QuantumCircuit(8)  # circuit to copy 4 bits&#xA;&amp;gt;&amp;gt;&amp;gt; copy.cx(range(4), range(4, 8))&#xA;&amp;gt;&amp;gt;&amp;gt; open_copy = copy.control(1, ctrl_state='0')&#xA;&amp;gt;&amp;gt;&amp;gt; closed_copy = copy.control(1, ctrl_state='1')&#xA;&amp;gt;&amp;gt;&amp;gt; circuit.append(open_copy, qr_i[:] + qr_a[:] + qr_t[:])&#xA;&amp;gt;&amp;gt;&amp;gt; circuit.append(closed_copy, qr_i[:] + qr_b[:] + qr_t[:])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9800" LastEditDate="2021-01-22T19:08:36.847" LastActivityDate="2021-01-22T19:08:36.847" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14951" PostTypeId="1" AcceptedAnswerId="14953" CreationDate="2020-12-03T16:46:54.753" Score="0" ViewCount="44" Body="&lt;p&gt;I've been receiving &amp;quot;Circuit runtime is greater than the device repetition rate [8020]&amp;quot; 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!&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Clarification:&lt;/em&gt;&lt;/strong&gt; 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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nA1y7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nA1y7.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14019" LastEditorUserId="55" LastEditDate="2020-12-10T08:47:13.397" LastActivityDate="2020-12-10T08:47:13.397" Title="Device Repitition Rate on Melbourne" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14952" PostTypeId="2" ParentId="14945" CreationDate="2020-12-03T16:51:46.177" Score="1" Body="&lt;p&gt;@Victory Omole already answered the question.&lt;/p&gt;&#xA;&lt;p&gt;But here is the fixed code if you are interested.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qubit = cirq.NamedQubit(&amp;quot;myqubit&amp;quot;)&#xA;circuit = cirq.Circuit()&#xA;circuit = cirq.Circuit(cirq.H(qubit))&#xA;circuit.append(cirq.measure(qubit, key='result'))&#xA;print(circuit)&#xA;s=cirq.Simulator()&#xA;samples=s.run(circuit, repetitions=1000)&#xA;print('Single measurement result:' ,samples.histogram(key='result'))&#xA;&#xA;print('****************************************')&#xA;circuit2 = cirq.Circuit(cirq.H(qubit))&#xA;for i in range(10):&#xA;    circuit2.append(cirq.measure(qubit, key='myqubit'))&#xA;print(circuit2)&#xA;samples2 = s.run(circuit, repetitions=1000)&#xA;print('Hadamard follows by 10 measurements result:' ,samples2.histogram(key='result'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;myqubit: ───H───M('result')───&#xA;Single measurement result: Counter({0: 501, 1: 499})&#xA;****************************************&#xA;myqubit: ───H───M───M───M───M───M───M───M───M───M───M───&#xA;Hadamard follows by 10 measurements result: Counter({1: 502, 0: 498})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; 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 &lt;code&gt;cirq&lt;/code&gt;...)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;samples2 = [s.run(circuit, repetitions=1) for i in range(10) ]&#xA;samples2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[result=1,&#xA; result=0,&#xA; result=1,&#xA; result=1,&#xA; result=1,&#xA; result=0,&#xA; result=1,&#xA; result=0,&#xA; result=0,&#xA; result=0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-03T17:43:13.750" LastActivityDate="2020-12-03T17:43:13.750" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14953" PostTypeId="2" ParentId="14951" CreationDate="2020-12-03T17:10:09.070" Score="2" Body="&lt;p&gt;The error &lt;code&gt;Circuit runtime is greater than the device repetition rate [8020]&lt;/code&gt; is associate with the fact that your circuit is too deep. The device can't handle that many quantum operations.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For example: Consider this depth 6 random circuit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3rXrS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3rXrS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can create this random circuit with some fixed depth through Qiskit as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.random import random_circuit&#xA;num_qubits = 11&#xA;circuit_depth = 5&#xA;max_operands = 3 #between 0 and 3&#xA;measurement_all_qubit = True&#xA;qc_random = random_circuit(num_qubits, circuit_depth, max_operands=max_operands, measure=measurement_all_qubit)&#xA;print( 'original ircuit depth', qc_random.depth() )&#xA;qc_random.draw( 'mpl',style={'name': 'bw'},  scale = 1, filename = 'random depth 6', plot_barriers= False, initial_state = True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;The above doesn't take into account the hardware connectivity issues. But if we are going to map this onto real hardware, like the &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; then it would get larger. In fact, it would translate to a circuit of &lt;strong&gt;depth of 108&lt;/strong&gt;. Below is the transpiled circuit being mapped to &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9BGKk.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9BGKk.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the code for that transpilation process if you are interested:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;from qiskit.compiler import transpile&#xA;Circuit_Transpile = transpile(qc_random, provider.get_backend('ibmq_16_melbourne') , optimization_level=3)&#xA;print('Transpiled circuit depth', Circuit_Transpile.depth() )&#xA;Circuit_Transpile.draw( 'mpl',style={'name': 'bw'}, filename = 'random transpiled', plot_barriers= False, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-03T22:24:49.990" LastActivityDate="2020-12-03T22:24:49.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14955" PostTypeId="1" AcceptedAnswerId="14957" CreationDate="2020-12-03T18:57:11.123" Score="2" ViewCount="66" Body="&lt;p&gt;I noticed that in QAOA the problem hamiltonian always consists of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gates. But isn't QAOA a form of Adiabatic Programming? Where the idea is just to go from one ground state to another?&#xA;Does that not mean that every Hamiltonian can be the problem Hamiltonian?&lt;/p&gt;&#xA;&lt;p&gt;And the Mixer consists always just of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates. Why not &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gates for example?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="4127" LastEditDate="2020-12-03T19:21:31.113" LastActivityDate="2020-12-03T19:33:53.547" Title="Why does the problem Hamiltonian of QAOA always consist of $Z$ and $I$ gates?" Tags="&lt;programming&gt;&lt;qaoa&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14957" PostTypeId="2" ParentId="14955" CreationDate="2020-12-03T19:33:53.547" Score="2" Body="&lt;p&gt;QAOA was first introduced as a quantum algorithm to tackle combinatorial optimization problems. Hence, there is a direct translation of these to Hamiltonians with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators. And you always see the mixer as just &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators because&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the equal-superposition state (obtained by Hadamard transform on &lt;span class=&quot;math-container&quot;&gt;$| 0\rangle^{\otimes N}$&lt;/span&gt;) is a ground state of the mixer (which is a requirement in adiabatic computing)&lt;/li&gt;&#xA;&lt;li&gt;the type of problems tackled do not include constraints.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;However, other mixers can be used depending what one wants to solve (see &lt;a href=&quot;https://arxiv.org/abs/1709.03489&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article on modifying the mixers for constrained combinatorial optimization problems&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-12-03T19:33:53.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14958" PostTypeId="2" ParentId="5164" CreationDate="2020-12-03T19:48:34.563" Score="1" Body="&lt;p&gt;I have written a collection of C programs together with a python interface that satisfies most of the requiremets listed above. Documentation see section&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://mmgroup.readthedocs.io/en/latest/api.html#the-subgroup-2-1-24-co-1-of-the-monster-and-the-clifford-group&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mmgroup.readthedocs.io/en/latest/api.html#the-subgroup-2-1-24-co-1-of-the-monster-and-the-clifford-group&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;in&#xA;&lt;a href=&quot;https://mmgroup.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://mmgroup.readthedocs.io/en/latest/&lt;/a&gt; .&lt;/p&gt;&#xA;&lt;p&gt;My motivation for doing so was that high-speed computation in the Clifford group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_{12}$&lt;/span&gt; of 12 qubits is useful for computations in the monster group.&lt;/p&gt;&#xA;" OwnerUserId="14018" LastActivityDate="2020-12-03T19:48:34.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14959" PostTypeId="1" AcceptedAnswerId="14960" CreationDate="2020-12-03T21:23:56.027" Score="2" ViewCount="179" Body="&lt;p&gt;When uploading a QASM-file with &lt;code&gt;ÒPENQASM 3.0;&lt;/code&gt; as first line, the code editor on quantum-computing.ibm.com will throw an error.&lt;/p&gt;&#xA;&lt;p&gt;However the qiskit Python library doesn't support the new features (e.g. for-loops) of OPENQASM 3 either.&lt;/p&gt;&#xA;&lt;p&gt;So where can I run an OPENQASM 3.0 file?&lt;/p&gt;&#xA;" OwnerUserId="14022" LastEditorUserId="55" LastEditDate="2020-12-10T08:47:24.617" LastActivityDate="2020-12-10T08:47:24.617" Title="How to run a OpenQASM 3.0 file?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14960" PostTypeId="2" ParentId="14959" CreationDate="2020-12-03T22:10:28.990" Score="3" Body="&lt;p&gt;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 &lt;a href=&quot;https://qiskit.github.io/openqasm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;live specification&lt;/a&gt;. 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 &lt;a href=&quot;https://github.com/Qiskit/openqasm&quot; rel=&quot;nofollow noreferrer&quot;&gt;language specification repository&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9863" LastActivityDate="2020-12-03T22:10:28.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14961" PostTypeId="1" CreationDate="2020-12-04T00:11:26.847" Score="2" ViewCount="71" Body="&lt;h2&gt;Question&lt;/h2&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;h2&gt;Attempted Proof&lt;/h2&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi(x,t)|^2 = \psi(x,t)^* \psi(x,t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us expand around &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi(x,t)|^2 = \Big( \psi(z,t)^* + (x -z)\psi'(z,t)^* + \frac{(x -z)^{2}}{2!}\psi''(z,t )^* +\dots \Big )$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\cdot \Big (\psi(z,t) + (x -z)\psi'(z,t) + \frac{(x -z)^{2}}{2!}\psi''(z,t)+\dots \big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Multiplying the R.H.S brackets together. We will refer to the below equation as equation &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us substitute  &lt;span class=&quot;math-container&quot;&gt;$x \to z + c/(2N) \int_{-N}^N dz$&lt;/span&gt; in equation &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Multiplying &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; both sides , rearranging terms and taking the limit &lt;span class=&quot;math-container&quot;&gt;$N \to \infty$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The R.H.S can be now expressed as a function of momentum averages as it has terms such as &lt;span class=&quot;math-container&quot;&gt;$\int_{-\infty}^\infty \psi'(z)\psi(z) dz$&lt;/span&gt;. Hence,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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)  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly if we define &lt;span class=&quot;math-container&quot;&gt;$\tilde \psi(p,t)$&lt;/span&gt; in momentum space:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \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)  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can compare powers of &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and learn something about the wavefunction.&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="5045" LastEditDate="2020-12-04T01:13:02.663" LastActivityDate="2021-01-12T15:12:22.393" Title="Given averages of powers of position and momentum in quantum mechanics what information can be secured about the wave-function?" Tags="&lt;resource-request&gt;&lt;classical-quantum&gt;&lt;probability&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14962" PostTypeId="1" AcceptedAnswerId="14963" CreationDate="2020-12-04T05:05:50.423" Score="1" ViewCount="73" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{3}}|00\rangle + \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle $&lt;/span&gt; get the expected value of the situation at gate &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; for the quantum gate.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{3}}|00\rangle + \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle $&lt;/span&gt; get the expected value of the situation at gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; for the quantum gate.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I couldn't find the right answer. Would you help me please?&lt;/p&gt;&#xA;" OwnerUserId="14027" LastEditorUserId="55" LastEditDate="2020-12-10T08:51:19.197" LastActivityDate="2020-12-10T08:51:19.197" Title="How to measure expectation values of $Z$ and $X$ on the given states?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="5" FavoriteCount="1" ClosedDate="2020-12-14T14:16:57.643" ContentLicense="CC BY-SA 4.0" />
  <row Id="14963" PostTypeId="2" ParentId="14962" CreationDate="2020-12-04T05:27:43.867" Score="2" Body="&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$|\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} $&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix} 0 \\ 1\end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we also have that &lt;span class=&quot;math-container&quot;&gt;$Z = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1\end{pmatrix}$&lt;/span&gt; then note that &lt;span class=&quot;math-container&quot;&gt;$Z|0\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z|1\rangle = -|1\rangle$&lt;/span&gt;. Hence&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle \psi | ZZ |\psi \rangle &amp;amp;= \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)\\&#xA;&amp;amp;=\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)\\&#xA;&amp;amp;=\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)\\&#xA;&amp;amp;= \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}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also notice that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle \psi | ZZ |\psi \rangle &amp;amp;= \begin{pmatrix} \dfrac{1}{\sqrt{3}} &amp;amp; \dfrac{1}{\sqrt{6}} &amp;amp; 0 &amp;amp; \dfrac{1}{\sqrt{2}} \end{pmatrix}&#xA;\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp;0 &amp;amp; 1\end{pmatrix}&#xA; \begin{pmatrix} \dfrac{1}{\sqrt{3}} \\ \dfrac{1}{\sqrt{6}} \\ 0 \\ \dfrac{1}{\sqrt{2}} \end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix} \dfrac{1}{\sqrt{3}} &amp;amp; \dfrac{1}{\sqrt{6}} &amp;amp; 0 &amp;amp; \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}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly if we are consider &lt;span class=&quot;math-container&quot;&gt;$\langle \psi |XX| \psi\rangle$&lt;/span&gt;. Now, just replace &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; for the computation where &lt;span class=&quot;math-container&quot;&gt;$X = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0\end{pmatrix}$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$X|0\rangle = |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X|1\rangle = |0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-04T05:27:43.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14964" PostTypeId="1" AcceptedAnswerId="14968" CreationDate="2020-12-04T05:37:49.570" Score="2" ViewCount="105" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(q_0,q_1,...,q_n,anc_0,..anc_m)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After some quantum operations, I'd like to get a unitary matrix representation of the data qubits. Is this possible?&lt;/p&gt;&#xA;" OwnerUserId="13527" LastEditorUserId="55" LastEditDate="2020-12-10T08:53:30.863" LastActivityDate="2020-12-10T08:53:30.863" Title="How to get subspace of quantum circuit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14966" PostTypeId="1" CreationDate="2020-12-04T08:09:47.547" Score="-2" ViewCount="84" Body="&lt;p&gt;How can I get this situation entangled on IBMQ experience?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle:\\&#xA;|01\rangle:\\&#xA;|10\rangle:\\&#xA;|11\rangle:&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14029" LastEditorUserId="1859" LastEditDate="2020-12-04T12:11:35.777" LastActivityDate="2020-12-05T09:10:52.867" Title="How can I get $|00\rangle |01\rangle |10\rangle |11\rangle$ entangled on IBMQ experience?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;entanglement&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14967" PostTypeId="1" AcceptedAnswerId="15485" CreationDate="2020-12-04T08:19:26.777" Score="3" ViewCount="92" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;http://homer2.kitp.ucsb.edu/online/qinfo17/crosson/pdf/Crosson_QInfo17_KITP.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2020-12-04T09:38:33.547" LastActivityDate="2021-01-12T09:17:33.460" Title="Sign problem and stoquastic Hamiltonians" Tags="&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14968" PostTypeId="2" ParentId="14964" CreationDate="2020-12-04T08:43:50.000" Score="2" Body="&lt;p&gt;What you are looking for is the partial trace of a density matrix, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|q_0,q_1,...,ac_0,ac_1,...\rangle$&lt;/span&gt;. This matrix is surely a unitary matrix, and it can be viewed as a tensor product of all the density matrices of each qubit.&lt;/p&gt;&#xA;&lt;p&gt;To get a subspace of a quantum circuit, you have to partial trace over all the irrelevant qubits, in your case, &lt;span class=&quot;math-container&quot;&gt;$Tr_{ac}(|\psi\rangle\langle\psi|)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you are using &lt;code&gt;qiskit&lt;/code&gt;, see the lower code as an example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.quantum_info import DensityMatrix,partial_trace&#xA;import numpy as np&#xA;qr=QuantumRegister(2)&#xA;circ=QuantumCircuit(qr)&#xA;circ.h(qr[0])&#xA;circ.cx(qr[0],qr[1])&#xA;DM=DensityMatrix.from_instruction(circ)&#xA;print(DM.data)&#xA;PT=partial_trace(DM,[0])&#xA;print(PT.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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(&lt;code&gt;qiskit&lt;/code&gt; is again used to generate the density matrix, but I provide another function for partial trace in this place):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def partial_trace(rho,qubit2keep):&#xA;    num_qubit=int(np.log2(rho.shape[0]))&#xA;    for i in range(len(qubit2keep)):&#xA;            qubit2keep[i]=num_qubit-1-qubit2keep[i]&#xA;    qubit_axis=[(i,num_qubit+i) for i in range(num_qubit)&#xA;                    if i not in qubit2keep]&#xA;    minus_factor=[(i,2*i) for i in range(len(qubit_axis))]&#xA;    minus_qubit_axis=[(q[0]-m[0],q[1]-m[1])&#xA;                        for q, m in zip(qubit_axis,minus_factor)]&#xA;    rho_res=np.reshape(rho,[2,2]*num_qubit)&#xA;    qubit_left=num_qubit-len(qubit_axis)&#xA;    for i,j in minus_qubit_axis:&#xA;        rho_res=np.trace(rho_res,axis1=i,axis2=j)&#xA;    if qubit_left&amp;gt;1:&#xA;        rho_res=np.reshape(rho_res,[2**qubit_left]*2)&#xA;    return rho_res&#xA;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.quantum_info import DensityMatrix&#xA;import numpy as np&#xA;qr=QuantumRegister(2)&#xA;circ=QuantumCircuit(qr)&#xA;circ.h(qr[0])&#xA;circ.cx(qr[0],qr[1])&#xA;DM=DensityMatrix.from_instruction(circ)&#xA;print(DM.data)&#xA;PT=partial_trace(DM.data,[0])&#xA;print(PT)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;(Note that the &lt;code&gt;partial_trace&lt;/code&gt; function is a rewritten of &lt;a href=&quot;https://gist.github.com/neversakura/d6a60b4bb2990d252e9e89e5629d5553&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;, the default sequence in this code and mine are reversed.)&lt;/p&gt;&#xA;&lt;p&gt;The two codes give identical results. In &lt;code&gt;PT=partial_trace(DM.data,[0])&lt;/code&gt;, &lt;code&gt;[0]&lt;/code&gt; denotes&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-12-04T08:43:50.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14969" PostTypeId="1" AcceptedAnswerId="15397" CreationDate="2020-12-04T09:02:54.913" Score="5" ViewCount="69" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Is there any paper or there a part on it in Nielsen and Chuang ?&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="8746" LastEditDate="2021-04-01T09:23:36.393" LastActivityDate="2021-04-01T09:23:36.393" Title="Resources and references about phase kickback trick" Tags="&lt;resource-request&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14971" PostTypeId="2" ParentId="14966" CreationDate="2020-12-04T10:40:55.840" Score="1" Body="&lt;p&gt;I &lt;em&gt;am not sure&lt;/em&gt; what you are looking for but if you are looking for how to get the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to become an entangled state and I am assuming a maximal entangled state like a Bell-state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $&lt;/span&gt; then it is pretty simple. Just apply the Hadamard gate to the first qubit follow by CNOT gate. That is something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0nGcZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0nGcZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, QuantumCircuit&#xA;%matplotlib inline&#xA;&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.h(qreg_q[0])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, scale = 1, initial_state = True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now if you want to put the state &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; into the same maximal entangled Bell-state as the one above, you can first flip the second qubit to get it back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;... so now you are back the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; hence you can apply the same circuit as the one above.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-04T10:40:55.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14972" PostTypeId="2" ParentId="14967" CreationDate="2020-12-04T11:49:59.177" Score="3" Body="&lt;p&gt;Stoquastic Hamiltonians have only non-positive off-diagonal terms, see for instance the abstract of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0606140&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper by Bravyi et al.&lt;/a&gt; The diagonal terms may be zero, but may also be stricly positive.&lt;/p&gt;&#xA;&lt;p&gt;The sign problem is not restricted to only an appearance in quantum computing; it even stems from more general physics - check for instance &lt;a href=&quot;https://physics.stackexchange.com/questions/11605/when-is-the-minus-sign-problem-in-quantum-simulations-an-obstacle&quot;&gt;this question and answer by user wsc&lt;/a&gt; on the physics stack exchange. The answer also links to &lt;a href=&quot;https://arxiv.org/abs/cond-mat/0408370&quot; rel=&quot;nofollow noreferrer&quot;&gt;this text by Troyer and Wiese&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My understanding is limited, but I know that it is closely correlated with &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Monte_Carlo&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Monte Carlo&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-01-12T09:17:33.460" LastActivityDate="2021-01-12T09:17:33.460" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14973" PostTypeId="1" AcceptedAnswerId="14982" CreationDate="2020-12-04T16:56:13.443" Score="1" ViewCount="160" Body="&lt;p&gt;When I create a circuit using Qiskit and then transpile it using &lt;code&gt;transpiled_circuit = transpile(circuit, ibm_backend, optimization_level=1)&lt;/code&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;For example,&lt;/strong&gt; I have the following circuit :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FcNoc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FcNoc.png&quot; alt=&quot;Quantum circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;when I transpile it in my qiskit code&#xA;&lt;code&gt;transpiled_circuit = transpile(circuit, provider.get_backend('ibmq_athens'), optimization_level=1)&lt;/code&gt; I got the following circuit :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bp6Xf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bp6Xf.png&quot; alt=&quot;qiskit_transpiled_circuit&quot; /&gt;&lt;/a&gt;&#xA;Using the IBMQ experience circuit composer I got the following transpiled circuit when I run using &lt;code&gt;ibmq_athens&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UM0hs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UM0hs.png&quot; alt=&quot;transpile_circuit_qasm&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I tried different optimization levels in qiskit and the transpiled circuit is also different.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="10495" LastEditorUserId="55" LastEditDate="2020-12-10T08:54:17.357" LastActivityDate="2020-12-10T08:54:17.357" Title="How to transpile a circuit using Qiskit as done in IBMQ experience" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14974" PostTypeId="2" ParentId="14973" CreationDate="2020-12-04T17:27:22.530" Score="0" Body="&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$U_1, U_2, U_3$&lt;/span&gt; ); and furthermore NOT all the qubits are connected to one another.&lt;/p&gt;&#xA;&lt;p&gt;For Athen, you have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/COF6g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/COF6g.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And so when you execute your CCNOT gate, you must decompose it to the hardware native set of  gates. This can be done as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y1hrf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y1hrf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-04T17:27:22.530" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="14976" PostTypeId="1" AcceptedAnswerId="15011" CreationDate="2020-12-04T19:11:50.827" Score="6" ViewCount="105" Body="&lt;p&gt;Suppose I have access to a pretty typical gate set, for example &lt;span class=&quot;math-container&quot;&gt;$\{\text{CNOT}, \text{SWAP}, \text{R}_{x}, \text{R}_{y}, \text{R}_{z}, \text{CR}_x, \text{CR}_y, \text{CR}_z\}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\text{CR}$&lt;/span&gt; is a controlled single-qubit rotation. I'm curious about decompositions of gates in the following forms:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_1 = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; a &amp;amp; b &amp;amp; 0 \\&#xA;0 &amp;amp; c &amp;amp; d &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &#xA;\end{pmatrix} \qquad &#xA;U_2 = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&amp;amp; e &amp;amp; f \\&#xA;0 &amp;amp; 0 &amp;amp; g &amp;amp; h &#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;where all constants are real. It seems like these decompositions should be straightforward since &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; has a &lt;em&gt;similar&lt;/em&gt; form to &lt;span class=&quot;math-container&quot;&gt;$\exp{(i\theta \text{SWAP})}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; has a &lt;em&gt;similar&lt;/em&gt; form to &lt;span class=&quot;math-container&quot;&gt;$\exp{(i\theta \text{CNOT}})$&lt;/span&gt;. However I'm having difficulty getting rid of the imaginary coefficients that are a necessary result of the exponential generator.&lt;/p&gt;&#xA;&lt;p&gt;Is there a straightforward way to find decompositions when the block form of a desired unitary with &lt;strong&gt;real&lt;/strong&gt; coefficients is the same as an exponentiated member of the desired gateset?&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="10480" LastEditDate="2021-03-10T03:56:54.273" LastActivityDate="2021-03-10T03:56:54.273" Title="Decomposing gates resembling exponentiated members of desired gateset" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;&lt;matrix-representation&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14977" PostTypeId="1" CreationDate="2020-12-04T20:08:58.123" Score="2" ViewCount="40" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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&amp;gt;|b&amp;gt; and then applying a circuit that takes |&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&amp;gt;|&lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;&amp;gt; to |&lt;span class=&quot;math-container&quot;&gt;$y\oplus g^a x^{-b}$&lt;/span&gt;&amp;gt;, where &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is a generator and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the number whose logarithm we want to find.  (The computation is be reduced mod &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.)  (Of course, &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is to be initialized to zero.)&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt; and so the QFT would only serve to amplify the states that are interesting.&lt;/p&gt;&#xA;&lt;p&gt;As you can see, more than examples, I'm looking for careful steps and explanations.  I'll appreciate any help on this.&lt;/p&gt;&#xA;" OwnerUserId="14021" LastEditorUserId="55" LastEditDate="2020-12-10T08:54:57.700" LastActivityDate="2020-12-10T08:54:57.700" Title="Is there an example of Shor's algorithm for the discrete log problem with concrete numbers anywhere?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14978" PostTypeId="2" ParentId="14973" CreationDate="2020-12-04T20:34:57.103" Score="1" Body="&lt;p&gt;I was able to obtain similar results to your IQX output using the &lt;code&gt;routing_method='sabre'&lt;/code&gt; and &lt;code&gt;layout_method='sabre&lt;/code&gt;' options.&lt;/p&gt;&#xA;" OwnerUserId="14041" LastActivityDate="2020-12-04T20:34:57.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14979" PostTypeId="2" ParentId="14966" CreationDate="2020-12-04T21:51:28.320" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Now to answer your question, There is one thing not clear about the circuit  in your description.&lt;/p&gt;&#xA;&lt;p&gt;What do the vectors &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; represent?&lt;/p&gt;&#xA;&lt;p&gt;Is it 2 qubit in super position (with 0 input and 2 hadamard gates) or 8 individual qubits?&lt;/p&gt;&#xA;&lt;p&gt;If it is 2 qubits in superposition adding a simple cx gate as user KAJ226 mentioned will put it into an entangled bell state.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/v3epY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/v3epY.png&quot; alt=&quot;Circuit for 8 quibit entanglement&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This circuit will result in either all zero state or all one state as shown below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Y29U0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y29U0.png&quot; alt=&quot;entangled state&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14047" LastEditorUserId="9006" LastEditDate="2020-12-05T09:10:52.867" LastActivityDate="2020-12-05T09:10:52.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14980" PostTypeId="1" CreationDate="2020-12-04T22:09:04.480" Score="1" ViewCount="68" Body="&lt;p&gt;I have two (unrelated) questions when I run circuits on IBM Q Expierence.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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!&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yzqr0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yzqr0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rMEcN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rMEcN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastActivityDate="2020-12-05T22:58:24.993" Title="Two questions on circuit composer on IBM Q Experience" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-12-14T14:17:11.840" ContentLicense="CC BY-SA 4.0" />
  <row Id="14981" PostTypeId="2" ParentId="14980" CreationDate="2020-12-04T23:20:38.180" Score="0" Body="&lt;p&gt;&lt;strong&gt;Answer to question 1:&lt;/strong&gt; There are two circuits being executed because you are trying to find the expectation value of the Hamiltonian, &lt;span class=&quot;math-container&quot;&gt;$\langle \psi |H|\psi\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | \sum_i \alpha_i P_i | \psi \rangle = \sum_i \alpha_i \langle \psi|P_i|\psi\rangle $&lt;/span&gt;. So naively each circuit is representing one of the calculation of &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|P_i|\psi\rangle $&lt;/span&gt;. For example, the electronic Hamiltonian for &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; at bond distance 1.5 Angstrom under Parity Mapping with two-qubit reduction can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = -1.009II + 0.1291IZ + -0.1291ZI -0.0041ZZ +  0.2295XX $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but since &lt;span class=&quot;math-container&quot;&gt;$II, IZ, ZI, ZZ$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\langle XX \rangle$&lt;/span&gt; need to have its own circuit. Hence the reason why you see two circuits here.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Regarding to question 2:&lt;/strong&gt; I don't see how you do the transpilation process so I can't say much. When I see your orginial circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xC5Ly.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xC5Ly.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and look at &lt;code&gt;ibmq_16_device&lt;/code&gt; which has qubit layout as&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fbB1q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fbB1q.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I would map &lt;span class=&quot;math-container&quot;&gt;$q_0 \to 1, q_5 \to 2, q_1 \to 3, q_2 \to 4, q_3 \to 5, q_4 \to 6 $&lt;/span&gt; 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 &lt;code&gt;optimization_level = 3&lt;/code&gt; in Qiskit, I have the following transpiled circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yg2ih.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yg2ih.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE AFTER COMMENT BY OP ON CREATING HIS/HER OWN ANSATZE FOR VQE EVALUATIONS:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, QuantumRegister&#xA;from qiskit.circuit import QuantumCircuit, ParameterVector&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.visualization import *&#xA;provider = IBMQ.load_account()&#xA;&#xA;var_form = QuantumCircuit(6)&#xA;params = ParameterVector('a', 6)&#xA;for i in range(6):&#xA;    var_form.ry(params[i],i)&#xA;var_form.cx(1,2)&#xA;var_form.cx(3,4)&#xA;var_form.cx(0,5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will give you the following parametrized circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nWzbA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nWzbA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can now pass this into your VQE function! Hope this helps. :)&lt;/p&gt;&#xA;&lt;p&gt;Also note that Qiskit does offer a few Heuristic Ansatze, like EfficientSU2 or ExcitationPreserving, TwoLocal, etc...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-05T22:58:24.993" LastActivityDate="2020-12-05T22:58:24.993" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="14982" PostTypeId="2" ParentId="14973" CreationDate="2020-12-05T00:45:14.367" Score="0" Body="&lt;p&gt;&lt;code&gt;transpiled_circuit = transpile(circuit, ibm_backend, seed_transpiler=13)&lt;/code&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="10495" LastActivityDate="2020-12-05T00:45:14.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14983" PostTypeId="2" ParentId="14966" CreationDate="2020-12-05T08:09:38.813" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-05T08:09:38.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14984" PostTypeId="1" AcceptedAnswerId="15000" CreationDate="2020-12-05T09:28:46.633" Score="2" ViewCount="59" Body="&lt;p&gt;In the article &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405001&quot; rel=&quot;nofollow noreferrer&quot;&gt;Is Quantum Search Pratical&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Let's assume that we are able to prepare an oracle composed from Clifford gates only (i.e. CNOT, Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, phase gate &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and Pauli gates &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;). Naturaly, such oracle would be very simple, for example XOR function implemented by CNOT gate.&lt;/p&gt;&#xA;&lt;p&gt;Now, turn to Grover diffusion operator. The operator is composed of Hadamard gates and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates. These are Clifford ones. But the issue is controled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;To sum up, my ideas so far, for simple &amp;quot;Cliffordian&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;However, what about &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit Grover diffusion operator? It seems to me that to implement controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates with &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So, my question is if this statement is right:&lt;/strong&gt; &lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-05T20:42:24.483" Title="Is it possible to construct Grover search from Clifford gates only?" Tags="&lt;grovers-algorithm&gt;&lt;simulation&gt;&lt;oracles&gt;&lt;clifford-group&gt;&lt;gottesman-knill&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14985" PostTypeId="2" ParentId="13143" CreationDate="2020-12-05T11:41:04.157" Score="1" Body="&lt;p&gt;The matrix form of a Toffoli gate with control qubits &lt;span class=&quot;math-container&quot;&gt;$q_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_b$&lt;/span&gt; and a target qubit &lt;span class=&quot;math-container&quot;&gt;$q_x$&lt;/span&gt; applied on a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-sized qubit register may be described as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T = \left[ \begin{array}{ccccc} &#xA;t_{1,1} &amp;amp;  &amp;amp; \cdots &amp;amp; &amp;amp; t_{1,2^n}\\&#xA; &amp;amp; \ddots &amp;amp; &amp;amp; \\&#xA;\vdots &amp;amp; &amp;amp; t_{i,j} &amp;amp; &amp;amp;  \vdots \\&#xA;&amp;amp; &amp;amp; &amp;amp; \ddots &amp;amp; \\&#xA;t_{2^n,1} &amp;amp; &amp;amp; \cdots &amp;amp; &amp;amp;  t_{2^n,2^n} &#xA;\end{array} \right]&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$t_{i,j} \in \left \{ 0,1 \right \}$&lt;/span&gt; defined by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;t_{i,j} = \left \{ \begin{array}{rlcl}&#xA;  1  &amp;amp; \mbox{if } (i-1) \land M \neq M &amp;amp; { and } &amp;amp; j = i \\&#xA;1  &amp;amp; \mbox{if } (i-1) \land M = M &amp;amp; { and } &amp;amp; j = \delta_i + i \\&#xA; 0  &amp;amp; \mbox{otherwise}&#xA;\end{array} \right. &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\land$&lt;/span&gt; represents the bitwise AND operator, &lt;span class=&quot;math-container&quot;&gt;$M = 2^{n-a} + 2^{n-b}$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\delta_i = \left \{ \begin{array}{rl}&#xA; (2^{n-x})  &amp;amp; \mbox{if } 2^{n-x} \land (i-1) = 0 \\ &#xA;-(2^{n-x})  &amp;amp; \mbox{otherwise}&#xA;\end{array} \right. &#xA;$$&lt;/span&gt;&#xA;The matrix &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is an identiy matrix with some rows/cols switched to implement the controlled NOT gate: &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; represents the mask used to identify the rows to be remapped and &lt;span class=&quot;math-container&quot;&gt;$\delta_i$&lt;/span&gt; represents the shift applied to remap them.&lt;/p&gt;&#xA;&lt;p&gt;I have prepared a short pyhton code snippet to calulate &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;def T(n,a,b,x) :&#xA;    m = 2**(n-a)+2**(n-b)&#xA;    d = lambda i : 2**(n-x) if (2**(n-x)) &amp;amp; i == 0 else -(2**(n-x))&#xA;    T = np.array([([0] * 2**n)] * 2**n)&#xA;    for i in range(2**n) :&#xA;        for j in range(2**n) :&#xA;            T[i][j] = 1 if (i &amp;amp; m == m and j == d(i) + i) or (i &amp;amp; m != m and j == i) else 0&#xA;    return T&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For example, the Toffoli matrix T(4,3,2,1) is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;array([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],&#xA;       [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13818" LastActivityDate="2020-12-05T11:41:04.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14986" PostTypeId="1" AcceptedAnswerId="14988" CreationDate="2020-12-05T11:44:17.113" Score="1" ViewCount="95" Body="&lt;p&gt;I am looking for a quantum circuit which maps state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\frac{1}{\sqrt{2}} |00\rangle+\frac{1}{\sqrt{2}}|1+\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The circuit should only apply quantum gates from the Clifford group (specifically, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;) and the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT = \begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{bmatrix}, \quad&#xA;H = \frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{bmatrix}, \quad&#xA;P = \begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; i&#xA;\end{bmatrix}, \quad&#xA;T = \begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i \pi / 4}&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;My Thoughts&lt;/h3&gt;&#xA;&lt;p&gt;Because these gates are universal for quantum computation (as stated &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807006&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), I know that a circuit which approximates &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; must exist. I am hoping that I can produce &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; exactly, but I was not able to find the corresponding circuit.&lt;/p&gt;&#xA;&lt;p&gt;I already figured out the the circuit needs to apply &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; at least one, as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="2444" LastEditorUserId="2444" LastEditDate="2020-12-05T17:38:55.303" LastActivityDate="2020-12-05T17:38:55.303" Title="Prepare state $|00\rangle+|1+\rangle$ using Clifford gates and the T-gate" Tags="&lt;circuit-construction&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="14987" PostTypeId="1" AcceptedAnswerId="14989" CreationDate="2020-12-05T13:51:25.233" Score="0" ViewCount="47" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\left|\psi_1\right\rangle=\alpha_1\left|0\right\rangle+\beta_1\left|1\right\rangle$&lt;/span&gt; , and &lt;span class=&quot;math-container&quot;&gt;$\psi_2=\alpha_2\left|0\right\rangle+\beta_2\left|1\right\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Assume that &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle$&lt;/span&gt; is a mixed state of &lt;span class=&quot;math-container&quot;&gt;$w_1*\left|\psi_1\right\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w_2*\left|\psi_2\right\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$w_1+w_2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How to calculate the state vector of &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="13982" LastEditorUserId="55" LastEditDate="2020-12-07T11:54:59.600" LastActivityDate="2020-12-07T11:54:59.600" Title="How to calculate the state vector of a mixed state of two superposition state?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14988" PostTypeId="2" ParentId="14986" CreationDate="2020-12-05T14:31:24.357" Score="2" Body="&lt;p&gt;The circuit is a Hadamard + a Controlled - Hadamard gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nsZzH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nsZzH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$ S $&lt;/span&gt; gate is &lt;span class=&quot;math-container&quot;&gt;$ P $&lt;/span&gt; gate in your notation.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-12-05T14:31:24.357" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="14989" PostTypeId="2" ParentId="14987" CreationDate="2020-12-05T14:35:39.103" Score="2" Body="&lt;p&gt;If the state is a mixed state of &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt; (or any two states) it cannot be written as a state vector; state vectors only describe &lt;em&gt;pure&lt;/em&gt; states, as opposed to mixed states.&lt;/p&gt;&#xA;&lt;p&gt;If it is a &lt;em&gt;coherent&lt;/em&gt; superposition of &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt;, you can write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The implicit assumption here is that &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$1+\sqrt{w_{1}w_{2}}|\langle\psi_{1}|\psi_{2}\rangle|^{2}$&lt;/span&gt; (as you already pointed out in your comment):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If it is &lt;em&gt;not&lt;/em&gt; a coherent superposition but indeed a (statistical) mixture of the two, a good (but wieldy) description of the state is:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;I am not certain what the state of the qubit is. It is either &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt;, but not a proper superposition of the two. With probability &lt;span class=&quot;math-container&quot;&gt;$w_{1}$&lt;/span&gt; it is &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt;, and with probability &lt;span class=&quot;math-container&quot;&gt;$w_{2}$&lt;/span&gt; it is &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt;.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; describing the state is&lt;/p&gt;&#xA;&lt;p&gt;(with &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_{1}|$&lt;/span&gt; the complex transpose of &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;\rho &amp;amp;= w_{1}|\psi_{1}\rangle \langle\psi_{1}| + w_{2}|\psi_{2}\rangle \langle\psi_{2}| \\&#xA;&amp;amp;= w_{1} \begin{bmatrix}\alpha_{1}\alpha^{*}_{1} &amp;amp; \alpha_{1}\beta^{*}_{1} \\ \alpha^{*}_{1}\beta_{1} &amp;amp; \beta_{1}\beta_{1}^{*}\end{bmatrix} + w_{2} \begin{bmatrix}\alpha_{2}\alpha^{*}_{2} &amp;amp; \alpha_{2}\beta^{*}_{2} \\ \alpha^{*}_{2}\beta_{2} &amp;amp; \beta_{2}\beta_{2}^{*}\end{bmatrix} \\&#xA;\end{split}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For more info you could check, for instance, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix#:%7E:text=A%20density%20matrix%20is%20a,density%20matrix%20for%20that%20system.&amp;amp;text=Density%20matrices%20that%20are%20not%20pure%20states%20are%20mixed%20states.&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page on density matrices&lt;/a&gt; or a good Quantum mechanics or quantum computing book.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-12-05T15:18:49.937" LastActivityDate="2020-12-05T15:18:49.937" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="14990" PostTypeId="1" AcceptedAnswerId="15001" CreationDate="2020-12-05T14:52:50.543" Score="3" ViewCount="67" Body="&lt;p&gt;I'm reading &lt;a href=&quot;https://books.google.com.br/books?id=QqegDwAAQBAJ&quot; rel=&quot;nofollow noreferrer&quot;&gt;Programming Quantum Computers&lt;/a&gt; trying to understand Shor's algorithm.  I learned there that we prepare a state &lt;span class=&quot;math-container&quot;&gt;$|x^i \bmod N\rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$x^i \bmod N$&lt;/span&gt;.  For example, here's a graph of the amplitudes after applying the QFT with &lt;span class=&quot;math-container&quot;&gt;$N = 35$&lt;/span&gt;.  That's on page 241.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E1Qqf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E1Qqf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?)&lt;/p&gt;&#xA;" OwnerUserId="14021" LastEditorUserId="2927" LastEditDate="2020-12-05T16:02:07.573" LastActivityDate="2020-12-05T22:07:22.840" Title="What are the interesting spikes in this after-QFT graph (page 241) of Programming Quantum Computers?" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14992" PostTypeId="2" ParentId="14617" CreationDate="2020-12-05T15:24:36.050" Score="0" Body="&lt;p&gt;Experiment - is ours Friend!&lt;/p&gt;&#xA;&lt;p&gt;See, I've wrote a little script, to test this theory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/python3&#xA;&#xA;import time&#xA;import random&#xA;&#xA;li      = [ ]&#xA;size        = 1000000&#xA;size        = 100000&#xA;size        = 10000     # 3 seconds&#xA;# size      = 1000      # 0.2 seconds&#xA;# size      = 100&#xA;&#xA;&#xA;DEBUG       = False&#xA;# DEBUG     = True&#xA;&#xA;start_time  = time.time( )&#xA;for i in range( 0, size ):&#xA;    li.append( i )&#xA;random.shuffle( li )&#xA;speed       = time.time( ) - start_time&#xA;&#xA;print( &amp;quot;gen done in:&amp;quot;, speed, &amp;quot;seconds&amp;quot; )&#xA;&#xA;if DEBUG:&#xA;    print( li )&#xA;&#xA;def find_i( i ):&#xA;    N = 0&#xA;    for j in li:&#xA;        if i == j:&#xA;            return N&#xA;        N += 1&#xA;&#xA;start_time  = time.time( )&#xA;&#xA;accum_N     = 0&#xA;for i in range( 0, size ):&#xA;    accum_N += find_i( i )&#xA;&#xA;speed       = time.time( ) - start_time&#xA;print( &amp;quot;find done in:&amp;quot;, speed, &amp;quot;seconds&amp;quot; )&#xA;&#xA;#--------------------------------------------------------&#xA;average     = accum_N / size&#xA;&#xA;relation    = size / average&#xA;&#xA;print( &amp;quot;accum_N:&amp;quot;, accum_N )&#xA;print( &amp;quot;size:&amp;quot;, size )&#xA;print( &amp;quot;average:&amp;quot;, average )&#xA;print( &amp;quot;size relate to average number of steps as&amp;quot;, int( relation ), &amp;quot;to 1&amp;quot; )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ python3 script.py&#xA;gen done in: 0.004632234573364258 seconds&#xA;find done in: 3.0313122272491455 seconds&#xA;accum_N: 49995000&#xA;size: 10000&#xA;average: 4999.5&#xA;size relate to average number of steps as 2 to 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On the &lt;code&gt;gen&lt;/code&gt; stage, we are simply pushing every &lt;code&gt;int&lt;/code&gt; from range 0 to &lt;code&gt;size&lt;/code&gt; === &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Thereafter, shuffle the result list.&lt;/li&gt;&#xA;&lt;li&gt;Thereafter, we are goin to find each integer, from range 0 to &lt;code&gt;size&lt;/code&gt; in this list, and accumulate number of comparisons / steps in &lt;code&gt;accum_N&lt;/code&gt; variable&lt;/li&gt;&#xA;&lt;li&gt;as you can see, the number - is &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="14063" LastActivityDate="2020-12-05T15:24:36.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14993" PostTypeId="1" AcceptedAnswerId="14996" CreationDate="2020-12-05T16:18:49.060" Score="1" ViewCount="49" Body="&lt;p&gt;My question is linked to the Nielsen Chuang book. Particularly equation 2.216 on basis change from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to orthonormal &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. How do we get the equation from the following?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VI9PY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VI9PY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand everything except why we get the negative sign in the coefficient.&lt;/p&gt;&#xA;" OwnerUserId="14064" LastEditorUserId="55" LastEditDate="2020-12-07T11:53:25.213" LastActivityDate="2020-12-07T11:53:25.213" Title="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$?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14994" PostTypeId="1" AcceptedAnswerId="14998" CreationDate="2020-12-05T16:37:41.727" Score="3" ViewCount="138" Body="&lt;p&gt;I &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14990&quot;&gt;asked about how to identify the period looking at a Fourier transform plot&lt;/a&gt;.  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&amp;gt; and |11&amp;gt;.  These are the highest spikes (after the first highest in |0&amp;gt;.)  How would I figure out the period 12 out of 5 and 11?  Can you show an example of the calculation?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E1Qqf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E1Qqf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;An attempted solution&lt;/strong&gt;.  Reading Peter Shor's paper (on page 320), we find that his &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$q=64$&lt;/span&gt; here in our example.  Shor is saying we can obtain a fraction &lt;span class=&quot;math-container&quot;&gt;$d/r$&lt;/span&gt; in lowest terms (where &lt;span class=&quot;math-container&quot;&gt;$r = 12$&lt;/span&gt; here) by rounding &lt;span class=&quot;math-container&quot;&gt;$c/q$&lt;/span&gt; to the nearest fraction having a denominator smaller than &lt;span class=&quot;math-container&quot;&gt;$n=35$&lt;/span&gt; here.  Our possible &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; here is &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let's try that.  After the QFT, we got &lt;span class=&quot;math-container&quot;&gt;$c = 5$&lt;/span&gt; and we have &lt;span class=&quot;math-container&quot;&gt;$q = 64$&lt;/span&gt;.  So we get &lt;span class=&quot;math-container&quot;&gt;$5/64 = 0.078125$&lt;/span&gt; and we want to round that to the nearest fraction having a denominator smaller than &lt;span class=&quot;math-container&quot;&gt;$35$&lt;/span&gt;.  For &lt;span class=&quot;math-container&quot;&gt;$5/64$&lt;/span&gt;, I find the continued fraction &lt;span class=&quot;math-container&quot;&gt;$[0,12,1,4]$&lt;/span&gt;. (I checked that &lt;span class=&quot;math-container&quot;&gt;$5/64 = 1/(12 + 1/(1 + 1/4))$&lt;/span&gt;, so that's correct.)  Now, from this continued fraction (in list form) I get the following sequence of fractions: &lt;span class=&quot;math-container&quot;&gt;$1/4, 5/4, 64/5, 5/64$&lt;/span&gt;. (I'm not sure what I'm doing.) Perhaps &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; is bad luck?  But, no, trying the same thing with &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt; will also produce &lt;span class=&quot;math-container&quot;&gt;$11/64$&lt;/span&gt;.  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.&lt;/p&gt;&#xA;" OwnerUserId="14021" LastEditorUserId="14021" LastEditDate="2020-12-06T17:18:34.753" LastActivityDate="2020-12-06T17:18:34.753" Title="Shor's algorithm: what to do after reading the QFT's result twice?" Tags="&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14995" PostTypeId="2" ParentId="14932" CreationDate="2020-12-05T16:43:58.907" Score="5" Body="&lt;p&gt;Let's start with the second question. There is nothing special about an extension &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}^{\ast}$&lt;/span&gt; that allows it to be optimal for the right-hand side of (1); any extension &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; could happen to be optimal for the right choice of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR}$&lt;/span&gt;. For example, if we suppose that &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}$&lt;/span&gt; is any given extension of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt;, and we take &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR} = \sigma_{AR}$&lt;/span&gt;, then the unique optimizing extension is &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}^{\ast} = \sigma_{AR}$&lt;/span&gt;. We may therefore not conclude that this optimal extension is pure.&lt;/p&gt;&#xA;&lt;p&gt;For the first question, now that we know that an arbitrary choice of an extension &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AR}$&lt;/span&gt; could maximize the right-hand side of (1) for an appropriate choice of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR}$&lt;/span&gt;, we see that the question is equivalent to asking how &lt;em&gt;any&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-12-05T16:43:58.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14996" PostTypeId="2" ParentId="14993" CreationDate="2020-12-05T18:42:02.107" Score="1" Body="&lt;p&gt;This is just algebra because &lt;span class=&quot;math-container&quot;&gt;$(a-b)|u\rangle + (c-d)|v\rangle = (a-b)|u\rangle - (d-c)|v\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;To be more explicit to the problem, first note that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|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&#xA;\end{align}&lt;/span&gt;&#xA;and similarly&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|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&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\dfrac{|01\rangle - |10\rangle}{\sqrt{2}} &amp;amp;= \dfrac{\alpha \gamma |aa\rangle + \alpha \delta |ab\rangle + \beta \gamma |ba\rangle + \beta \delta |bb\rangle}{\sqrt{2}} \\ &#xA;&amp;amp;- \\&#xA;&amp;amp;\hspace{0.6 cm}\frac{\gamma \delta|aa\rangle + \gamma \beta |ab\rangle + \delta \alpha |ba\rangle +  \delta \beta |bb\rangle}{\sqrt{2}} \\&#xA;&amp;amp;= 0 + \dfrac{\big(\alpha \delta - \gamma \beta \big)|ab\rangle}{\sqrt{2}} + \dfrac{\big( \beta\gamma - \delta \alpha\big) |ba\rangle}{\sqrt{2}}  + 0 \\&#xA;&amp;amp;= \dfrac{\big(\alpha \delta - \gamma \beta \big)|ab\rangle - \big(  \delta \alpha -\beta\gamma \big) |ba\rangle}{\sqrt{2}} \\&#xA;&amp;amp;= \dfrac{\big(\alpha \delta - \gamma \beta \big)|ab\rangle - \big(   \alpha \delta -\gamma \beta\big) |ba\rangle}{\sqrt{2}} \\&#xA;&amp;amp;= \big(\alpha \delta - \gamma \beta \big)  \dfrac{|ab\rangle - |ba\rangle}{\sqrt{2}}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-05T18:42:02.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="14997" PostTypeId="1" CreationDate="2020-12-05T19:21:19.663" Score="2" ViewCount="86" Body="&lt;p&gt;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.&#xA;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?&lt;/p&gt;&#xA;&lt;p&gt;Here is the Python code I am using. It implements a generalized Grover's algorithm for n qubits.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;from math import *&#xA;from qiskit import *&#xA;from qiskit.tools.visualization import circuit_drawer, plot_histogram&#xA;from qiskit.quantum_info.operators import Operator&#xA;&#xA;&#xA;def computational_basis(number_of_qubits, space_dimension):&#xA;&#xA;    basis = []&#xA;    for i in range(space_dimension):&#xA;        a = bin(i)[2:]&#xA;        l = len(a)&#xA;        b = str(0) * (number_of_qubits - l) + a&#xA;        basis.append(b)&#xA;&#xA;    return basis&#xA;&#xA;&#xA;def scalar_product(a, b):  # Where a and b are two items of the &amp;quot;basis&amp;quot; list&#xA;&#xA;    if a == b:&#xA;        return 1&#xA;    else:&#xA;        return 0&#xA;&#xA;&#xA;def oracle_generator(space_dimension, winner_state):&#xA;&#xA;    for i in range(space_dimension):&#xA;        if basis[i] == winner_state:&#xA;            mark = basis.index(basis[i])&#xA;&#xA;    oracle_matrix = np.identity(space_dimension)&#xA;    oracle_matrix[mark, mark] = -1&#xA;&#xA;    oracle = Operator(oracle_matrix)&#xA;    return oracle&#xA;&#xA;&#xA;def diffuser_generator(space_dimension):&#xA;&#xA;    diffuser_matrix = np.empty((space_dimension, space_dimension))&#xA;    for i in range(space_dimension):&#xA;        for j in range(space_dimension):&#xA;            diffuser_matrix[i, j] = (2 * scalar_product(basis[i], basis[0]) * scalar_product(basis[0], basis[j])) - scalar_product(basis[i], basis[j])&#xA;&#xA;    diffuser = Operator(diffuser_matrix)&#xA;    return diffuser&#xA;&#xA;&#xA;def grover_iteration(number_of_qubits, circuit, qr):&#xA;&#xA;    all_qubits_list = []&#xA;    for i in range(n):&#xA;        all_qubits_list.append(i)&#xA;&#xA;    circuit.unitary(oracle, all_qubits_list, label='oracle')&#xA;&#xA;    for i in range(number_of_qubits):&#xA;        circuit.h(qr[i])&#xA;&#xA;    circuit.unitary(diffuser, all_qubits_list, label='diffuser')&#xA;&#xA;    for i in range(number_of_qubits):&#xA;        circuit.h(qr[i])&#xA;&#xA;&#xA;# Number of qubits&#xA;n = 3&#xA;# Space dimension&#xA;N = int(pow(2, n))&#xA;# Winner state&#xA;winner = '111'&#xA;&#xA;&#xA;# Make a list of computational basis vectors (strings)&#xA;basis = computational_basis(n, N)&#xA;&#xA;&#xA;# Build a quantum circuit for n-qubit Grover's algorithm&#xA;oracle = oracle_generator(N, winner)&#xA;diffuser = diffuser_generator(N)&#xA;&#xA;qr = QuantumRegister(n, 'q')&#xA;cr = ClassicalRegister(n, 'c')&#xA;&#xA;grover_circuit = QuantumCircuit(qr, cr)&#xA;&#xA;for i in range(n):&#xA;    grover_circuit.h(qr[i])&#xA;&#xA;if n == 2:&#xA;    grover_iteration(n, grover_circuit, qr)&#xA;else:&#xA;    for i in range(int(sqrt(N))):&#xA;        grover_iteration(n, grover_circuit, qr)&#xA;&#xA;grover_circuit.measure(qr, cr)&#xA;&#xA;&#xA;# Draw Grover circuit&#xA;circuit_drawer(grover_circuit, output='mpl')&#xA;plt.show()&#xA;&#xA;&#xA;# Execute circuit&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider('ibm-q')&#xA;qcomp = provider.get_backend('ibmq_valencia')&#xA;job = execute(grover_circuit, backend=qcomp, shots=8192)&#xA;result = job.result()&#xA;&#xA;&#xA;# Results&#xA;plot_histogram(result.get_counts(grover_circuit))&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13893" LastEditorUserId="55" LastEditDate="2020-12-07T11:53:05.210" LastActivityDate="2020-12-07T11:53:05.210" Title="Connectivity in Grover's algorithm on real quantum computers" Tags="&lt;qiskit&gt;&lt;programming&gt;&lt;grovers-algorithm&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="14998" PostTypeId="2" ParentId="14994" CreationDate="2020-12-05T19:24:27.087" Score="3" Body="&lt;p&gt;This is the continued fraction part of the algorithm, step 5 on Wikipedia. What you've measured is &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\frac{yr}{Q}\approx c$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is some unknown integer, &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the hidden period (in this case 12), and &lt;span class=&quot;math-container&quot;&gt;$Q=64$&lt;/span&gt; is the size of the QFT. This means that &lt;span class=&quot;math-container&quot;&gt;$\frac{y}{Q}\approx \frac{c}{r}$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$y=5$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{64}\approx \frac{1}{12}$&lt;/span&gt;, and for &lt;span class=&quot;math-container&quot;&gt;$y=11$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$\frac{11}{64}\approx \frac{2}{12}$&lt;/span&gt;. So that's the relation between the measured values and the period.&lt;/p&gt;&#xA;&lt;p&gt;How do we actually find the period from those values, though (since we don't know &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;)? With continued fractions. A continued fraction for a number &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is defined recursively, with &lt;span class=&quot;math-container&quot;&gt;$a_0=x$&lt;/span&gt;, then with &lt;span class=&quot;math-container&quot;&gt;$b_n=\lfloor a_n\rfloor$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$a_n=\frac{1}{a_{n-1}-b_{n-1}}$&lt;/span&gt;. Applied to this problem with &lt;span class=&quot;math-container&quot;&gt;$x=\frac{5}{64}$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ a = (\frac{5}{64},\frac{64}{5},\frac{5}{4},4,0,\dots)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ b = (0,12,1,4,0,\dots)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From this, we can reconstruct approximations, and the denominator of these approximations will likely be the period. The &lt;a href=&quot;https://en.wikipedia.org/wiki/Continued_fraction#Some_useful_theorems&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page on continued fractions&lt;/a&gt; explains that we get a series of approximate fractions &lt;span class=&quot;math-container&quot;&gt;$\frac{h_n}{k_n}$&lt;/span&gt;, where we set a numerator &lt;span class=&quot;math-container&quot;&gt;$h_n=b_nh_{n-1}+h_{n-2}$&lt;/span&gt; and denominator &lt;span class=&quot;math-container&quot;&gt;$k_n=b_nk_{n-1}+k_{n-2}$&lt;/span&gt;, with initial values &lt;span class=&quot;math-container&quot;&gt;$h_{-1}=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$h_{-2}=0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$k_{-1}=0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$k_{-2}=1$&lt;/span&gt;. This gives two sequences:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$h = (0, 1, 0, 1, 1, 5)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ k = (1,0, 1, 12, 13, 64)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which gives three approximate fractions: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{12}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{13}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\frac{5}{64}$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-12-05T19:24:27.087" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="14999" PostTypeId="2" ParentId="14934" CreationDate="2020-12-05T20:23:43.017" Score="1" Body="&lt;p&gt;I believe to have answered my own question through further attempts. Per the comment from KAJ226, it is true that a &lt;span class=&quot;math-container&quot;&gt;$(3 \times 3)$&lt;/span&gt; matrix cannot be represented as a string of Paulis so I have nested the &lt;span class=&quot;math-container&quot;&gt;$(3 \times 3)$&lt;/span&gt; matrix into a &lt;span class=&quot;math-container&quot;&gt;$(4 \times 4)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$(3 \times 3)$&lt;/span&gt; matrix.&lt;/p&gt;&#xA;&lt;p&gt;My solution mostly came from using the &lt;code&gt;WeightedPauliOperator&lt;/code&gt;, &lt;code&gt;MatrixOperator&lt;/code&gt;, and &lt;code&gt;op_converter&lt;/code&gt; classes. Below is a sample of my code with corresponding outputs. Thanks to those who gave suggestions to help me out!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import scipy&#xA;import h5py&#xA;&#xA;from qiskit.aqua.algorithms import VQE, NumPyEigensolver&#xA;from qiskit.aqua.operators import WeightedPauliOperator, MatrixOperator, op_converter&#xA;from qiskit import Aer&#xA;&#xA;backend = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;&#xA;c1=-0.5&#xA;c2=.75&#xA;c3=2&#xA;&#xA;n1=3&#xA;Hamil=np.zeros((n1,n1))&#xA;Hamil[1,1]=c2&#xA;Hamil[2,2]=-c3/2+c2&#xA;Hamil[0,2]=c1&#xA;Hamil[1,2]=c1&#xA;Hamil[2,0]=c1&#xA;Hamil[2,1]=c1&#xA;&#xA;print(&amp;quot;(3x3) Hamiltonian&amp;quot;)&#xA;print(Hamil)&#xA;&#xA;vals,vecs=np.linalg.eig(Hamil)&#xA;&#xA;print(&amp;quot;Standard Eigenvalues: &amp;quot;)&#xA;print(vals)&#xA;&#xA;n2=4&#xA;Hamil=np.zeros((n2,n2))&#xA;Hamil[1,1]=c2&#xA;Hamil[2,2]=-c3/2+c2&#xA;Hamil[0,2]=c1&#xA;Hamil[1,2]=c1&#xA;Hamil[2,0]=c1&#xA;Hamil[2,1]=c1&#xA;&#xA;print(&amp;quot;(4x4) Hamiltonian&amp;quot;)&#xA;print(Hamil)&#xA;&#xA;Hamil_Mat=MatrixOperator(Hamil)&#xA;Hamil_Qop = op_converter.to_weighted_pauli_operator(Hamil_Mat)&#xA;&#xA;q_vals = NumPyEigensolver(Hamil_Qop,k=4).run()&#xA;&#xA;print(&amp;quot;Qubit Op Eigenvalues: &amp;quot;)&#xA;print(q_vals['eigenvalues'])&#xA;&#xA;vqe=VQE(Hamil_Qop)&#xA;vqe_result=vqe.run(backend)&#xA;&#xA;print(&amp;quot;VQE Eigenvalue: &amp;quot;)&#xA;print(vqe_result['eigenvalue'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;With result:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;(3x3) Hamiltonian&#xA;[[ 0.    0.   -0.5 ]&#xA; [ 0.    0.75 -0.5 ]&#xA; [-0.5  -0.5  -0.25]]&#xA;Standard Eigenvalues:&#xA;[-0.75  0.25  1.  ]&#xA;(4x4) Hamiltonian&#xA;[[ 0.    0.   -0.5   0.  ]&#xA; [ 0.    0.75 -0.5   0.  ]&#xA; [-0.5  -0.5  -0.25  0.  ]&#xA; [ 0.    0.    0.    0.  ]]&#xA;Qubit Op Eigenvalues:&#xA;[-0.75+0.j  0.  +0.j  0.25+0.j  1.  +0.j]&#xA;VQE Eigenvalue:&#xA;(-0.705078125+0j)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14009" LastActivityDate="2020-12-05T20:23:43.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15000" PostTypeId="2" ParentId="14984" CreationDate="2020-12-05T20:42:24.483" Score="3" Body="&lt;p&gt;The diffusion operator is a multi controlled not operation (modulo some hadamards). It's not a Clifford operation.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-12-05T20:42:24.483" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15001" PostTypeId="2" ParentId="14990" CreationDate="2020-12-05T22:07:22.840" Score="3" Body="&lt;p&gt;Looking at the graphs you've reproduced, the left graph shows the evaluation of &lt;span class=&quot;math-container&quot;&gt;$2^x\bmod 35$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,\dots 63\}$&lt;/span&gt; while the right graph illustrates the amplitude of the discrete Fourier transform for &lt;span class=&quot;math-container&quot;&gt;$\hat{x}\in\{0,\dots 63\}$&lt;/span&gt;.  The comment that there are &amp;quot;12 evenly spaced spikes&amp;quot; indicates that the local maxima of the right graph repeat every &lt;span class=&quot;math-container&quot;&gt;$64/12=5.33$&lt;/span&gt; values.&lt;/p&gt;&#xA;&lt;p&gt;You are correct, you do not have access to &lt;span class=&quot;math-container&quot;&gt;$\hat{x}$&lt;/span&gt; in a manner that lets you observe this periodicity in &lt;span class=&quot;math-container&quot;&gt;$\hat{x}$&lt;/span&gt; immediately; however, what you &lt;em&gt;do&lt;/em&gt; have access to is a way to sample &lt;span class=&quot;math-container&quot;&gt;$\hat{x}_i$&lt;/span&gt; for multiple &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in a manner that returns &lt;span class=&quot;math-container&quot;&gt;$\hat{x}_i$&lt;/span&gt; with probability given by the (square of the) height of the respective &lt;span class=&quot;math-container&quot;&gt;$\hat{x}_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; with higher probability than &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;, with higher probability than &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt;, with higher probability than &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;, with higher probability than &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt;, etc.&lt;/p&gt;&#xA;&lt;p&gt;From these respective samplings of &lt;span class=&quot;math-container&quot;&gt;$\hat{x}_i$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\hat{x}$&lt;/span&gt;, giving you the period of &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$2^x\bmod 35$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-12-05T22:07:22.840" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15002" PostTypeId="2" ParentId="12382" CreationDate="2020-12-06T11:17:53.673" Score="2" Body="&lt;p&gt;&lt;strong&gt;Use this command to install qiskit-textbook module&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/qiskit-community/qiskit-textbook.git#subdirectory=qiskit-textbook-src&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14070" LastActivityDate="2020-12-06T11:17:53.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15003" PostTypeId="1" CreationDate="2020-12-06T13:07:58.103" Score="1" ViewCount="51" Body="&lt;p&gt;I consider a process &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; that is at least CP and hermitian preserving.&lt;/p&gt;&#xA;&lt;p&gt;I know that the Choi matrix then has the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \sum_k |M_k \rangle \rangle \langle \langle M_k | $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|M_k \rangle \rangle$&lt;/span&gt; are the Kraus operators of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; in the &amp;quot;vectorized&amp;quot; form from Choi isomorphism.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;How from this fact can I show that the &lt;strong&gt;only&lt;/strong&gt; different set of Kraus operator can be related through unitary transformations ?&lt;/p&gt;&#xA;&lt;p&gt;I know that if I write &lt;span class=&quot;math-container&quot;&gt;$|M_k \rangle \rangle=\sum_{i} U_{ik} |A_i \rangle \rangle$&lt;/span&gt; I can see that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ M = \sum_i |A_i \rangle \rangle \langle \langle A_i|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But how can I proove that it is the only possibility to find other Kraus operator, based on the Choi matrix ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2020-12-25T23:32:31.897" LastActivityDate="2020-12-25T23:32:31.897" Title="Prove that different Kraus decompositions are related through a unitary, using the Choi isomorphism" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15004" PostTypeId="1" AcceptedAnswerId="15005" CreationDate="2020-12-06T13:10:31.213" Score="3" ViewCount="109" Body="&lt;p&gt;I am trying to understand the state given here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{n}} \sum_{j=0}^{n-1} |j\rangle |j\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$n = 4$&lt;/span&gt;, I would interpret this state as being &lt;span class=&quot;math-container&quot;&gt;$1/2(|00\rangle + |11\rangle + |22\rangle + |33\rangle)$&lt;/span&gt;. Is this correct? And if so, what does &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt; mean?&lt;/p&gt;&#xA;" OwnerUserId="14072" LastEditorUserId="55" LastEditDate="2020-12-25T23:32:43.980" LastActivityDate="2020-12-25T23:32:43.980" Title="What does $|j\rangle$ mean, when $j &gt; 1$?" Tags="&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15005" PostTypeId="2" ParentId="15004" CreationDate="2020-12-06T14:04:04.397" Score="4" Body="&lt;p&gt;Each &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; is a multi-qbit state. So if &lt;span class=&quot;math-container&quot;&gt;$n = 4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; respectively. For &lt;span class=&quot;math-container&quot;&gt;$n = 4$&lt;/span&gt; your final formula would be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{4}} \left( |00\rangle|00\rangle + |01\rangle|01\rangle + |10\rangle|10\rangle + |11\rangle|11\rangle \right)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{4}} \left( |0000\rangle + |0101\rangle + |1010\rangle + |1111\rangle \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4153" LastActivityDate="2020-12-06T14:04:04.397" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15007" PostTypeId="2" ParentId="14997" CreationDate="2020-12-06T17:11:29.733" Score="2" Body="&lt;p&gt;After ran your code, which have a circuit structure of the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XozhX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XozhX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, mapping it to Valencia, which has qubit connectivity map as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wkjtt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wkjtt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then the transpiled circuit takes the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vTEz8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vTEz8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which after asking Qiskit to spit out the &lt;code&gt;circuit depth&lt;/code&gt; and all the gate operations we have:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Transpiled circuit depth 122&#xA;&#xA;Quantum operations used: OrderedDict([('cx', 73), ('u2', 59), ('u1', 21), ('u3', 9), ('measure', 3), ('barrier', 1)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;As a note on how to get the transpiled circuit and its depth and different operations, you can do the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;provider = IBMQ.load_account()&#xA;Circuit_Transpile = transpile(grover_circuit, provider.get_backend('ibmq_valencia') , optimization_level=3)&#xA;print('Transpiled circuit depth', Circuit_Transpile.depth() )&#xA;print('Quantum operations used:', Circuit_Transpile.count_ops())&#xA;Circuit_Transpile.draw( 'mpl',style={'name': 'bw'}, filename = 'transpiled circuit', plot_barriers= False, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-06T17:11:29.733" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15008" PostTypeId="2" ParentId="14973" CreationDate="2020-12-06T17:59:29.010" Score="1" Body="&lt;p&gt;Consider that the transpilation process is not deterministic and the output might vary in every run (&lt;code&gt;seed_transpiler&lt;/code&gt; sets the PRNG seed).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;circuit = QuantumCircuit(5, 5)&#xA;circuit.ccx(1,2,4)&#xA;circuit.ccx(2,3,4)&#xA;circuit.measure(4, 4)&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qkwQg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qkwQg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpile(circuit, provider.get_backend('ibmq_athens'), seed_transpiler=13).draw('mpl', fold=0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mOuAd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mOuAd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-12-06T18:09:00.153" LastActivityDate="2020-12-06T18:09:00.153" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15009" PostTypeId="1" AcceptedAnswerId="15036" CreationDate="2020-12-06T20:17:08.650" Score="1" ViewCount="40" Body="&lt;p&gt;I have been trying to build myself an example of Shor's computations for the discrete log.  &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14977&quot;&gt;I started out with this objective&lt;/a&gt; and I realized I should understand the factorization first, which I &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14990&quot;&gt;did&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14994&quot;&gt;did&lt;/a&gt;.  Having a clue about the factorization, perhaps now I can tackle the discrete log, but it's still not that easy.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;. Find &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$2^a = 7 \bmod 29$&lt;/span&gt;.  (We know &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; is a generator of &lt;span class=&quot;math-container&quot;&gt;$Z_{29}$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;Peter Shor tells us to find &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;, a power of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; that is close to &lt;span class=&quot;math-container&quot;&gt;$29$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$29 &amp;lt; q &amp;lt; 2\times29$&lt;/span&gt;.  So &lt;span class=&quot;math-container&quot;&gt;$q = 32 = 2^5$&lt;/span&gt; suffices.  Next he tells us to put two register |&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&amp;gt; and |&lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;&amp;gt; in uniform superposition &lt;span class=&quot;math-container&quot;&gt;$\bmod 28$&lt;/span&gt;.  (Why &lt;span class=&quot;math-container&quot;&gt;$\kern-0.4em\bmod 28$&lt;/span&gt;? Why not &lt;span class=&quot;math-container&quot;&gt;$\kern-0.4em\bmod 29$&lt;/span&gt;?)  Then in a third register compute |&lt;span class=&quot;math-container&quot;&gt;$2^a 7^{-b} \bmod 29$&lt;/span&gt;&amp;gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^a 7^{-b} \bmod 29$&lt;/span&gt;), I find &lt;span class=&quot;math-container&quot;&gt;$[1, 25, 16, 23, 24, 20, 7, 1, 25, 16, 23, 24, 20, 7, 1, ...]$&lt;/span&gt;  So, I can see the period is &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What is the calculation that I must do now to extract the solution &lt;span class=&quot;math-container&quot;&gt;$a = 12$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14021" LastEditorUserId="55" LastEditDate="2020-12-25T23:32:53.990" LastActivityDate="2020-12-25T23:32:53.990" Title="How to build an example of Shor's algorithm for the discrete log?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15010" PostTypeId="2" ParentId="14976" CreationDate="2020-12-06T23:54:12.407" Score="3" Body="&lt;p&gt;If we can implement the second unitary &lt;span class=&quot;math-container&quot;&gt;$ U^{(2)} $&lt;/span&gt;, we immediately have a decomposition for the first since:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U^{(1)} = CNOT_{1, 0} \cdot U^{(2)}_{0, 1} \cdot CNOT_{1, 0} $$&lt;/span&gt;&#xA;if we set &lt;span class=&quot;math-container&quot;&gt;$ (e, f, g, h) = (d, c, b, a) $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ U^{(2)} $&lt;/span&gt; is a controlled - &lt;span class=&quot;math-container&quot;&gt;$ V $&lt;/span&gt; gate where &lt;span class=&quot;math-container&quot;&gt;$ V $&lt;/span&gt; is the unitary matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$ V = \begin{bmatrix} e &amp;amp; f \\ g &amp;amp; h \end{bmatrix} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now since &lt;span class=&quot;math-container&quot;&gt;$ e^2 + g^2 = 1, e, g \in \mathbb{R} $&lt;/span&gt;, we can write &lt;span class=&quot;math-container&quot;&gt;$ e = \text{cos}(\phi) $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ g = \text{sin}(\phi) $&lt;/span&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$ f = \text{sin}(\theta) $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ h = \text{cos}(\theta) $&lt;/span&gt;. The two vectors must be orthogonal so:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;e \cdot f + g \cdot h = 0 \implies &#xA;\text{cos}(\phi) \cdot \text{sin}(\theta) + \text{sin}(\phi) \cdot \text{cos}(\theta) = 0 \implies &#xA;\text{sin}(\phi + \theta) = 0 &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This means that either&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \theta = -\phi \implies &#xA;V = \begin{bmatrix} \text{cos}(\phi) &amp;amp; -\text{sin}(\phi) \\ &#xA;                    \text{sin}(\phi) &amp;amp; \text{cos}(\phi) &#xA;     \end{bmatrix}&#xA;= R_y(2\phi) \implies U^{(2)} = CR_y(2\phi) $&lt;/span&gt;, or&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \theta = \pi -\phi \implies &#xA;V = \begin{bmatrix} \text{cos}(\phi) &amp;amp; \text{sin}(\phi) \\ &#xA;                    \text{sin}(\phi) &amp;amp; -\text{cos}(\phi) &#xA;     \end{bmatrix}&#xA;= R_y(2\phi) \cdot Z = e^{i \frac{\pi}{2}} \cdot R_y(2\phi) \cdot R_z(\pi) &#xA;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Once we obtain these decompositions of &lt;span class=&quot;math-container&quot;&gt;$ V $&lt;/span&gt; it's straight-forward to implement it as a controlled operatiion.&#xA;(see for example Nielsen and Chuang section on Controlled Operations).&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-12-06T23:54:12.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15011" PostTypeId="2" ParentId="14976" CreationDate="2020-12-07T00:08:55.060" Score="4" Body="&lt;p&gt;The key idea is to use Y-rotations, because they include the imaginary unit which cancels the imaginary unit present in the exponential formula.&lt;/p&gt;&#xA;&lt;p&gt;Start with &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt;. Note that it is an orthogonal matrix, because &lt;span class=&quot;math-container&quot;&gt;$e, f, g, h \in \mathbb{R}$&lt;/span&gt;. Therefore there exists angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cos \theta/2 &amp;amp; -\sin \theta/2 \\&#xA;0 &amp;amp; 0 &amp;amp; \sin \theta/2 &amp;amp; \cos \theta/2&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cos \theta/2 &amp;amp; \sin \theta/2 \\&#xA;0 &amp;amp; 0 &amp;amp; \sin \theta/2 &amp;amp; -\cos \theta/2&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;These two forms correspond to the two connected components of &lt;span class=&quot;math-container&quot;&gt;$O(2)$&lt;/span&gt;, i.e. to a rotation and a rotoreflection, respectively. Noting that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y(\theta) = \exp(-i\theta Y/2) = I \cos \frac{\theta}{2} - i Y \sin \frac{\theta}{2} = \begin{pmatrix}&#xA;\cos \theta/2 &amp;amp; -\sin \theta/2 \\&#xA;\sin \theta/2 &amp;amp; \cos \theta/2&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;we see that in the rotation case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2(\theta) = C^{(1)}R_y^{(2)}(\theta)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and in the rotoreflection case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2(\theta) = C^{(1)}R_y^{(2)}(\theta) \, C^{(1)}Z^{(2)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$C^{(i)}$&lt;/span&gt; indicates that the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit is the control and &lt;span class=&quot;math-container&quot;&gt;$R_y^{(j)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^{(j)}$&lt;/span&gt; indicate that the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;th qubit is the target.&lt;/p&gt;&#xA;&lt;p&gt;We can extend the above result to &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; using the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate. Specifically, we exploit the fact that the matrix of the &lt;span class=&quot;math-container&quot;&gt;$C^{(2)}NOT^{(1)}$&lt;/span&gt; gate is the permutation matrix that swaps the second and fourth basis elements&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C^{(2)}NOT^{(1)} = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As before, we notice that &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; is orthogonal due to the requirement that &lt;span class=&quot;math-container&quot;&gt;$a, b, c, d \in \mathbb{R}$&lt;/span&gt; and therefore there exists angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_1(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \cos \theta/2 &amp;amp; -\sin \theta/2 &amp;amp; 0 \\&#xA;0 &amp;amp; \sin \theta/2 &amp;amp; \cos \theta/2 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_1(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \cos \theta/2 &amp;amp; \sin \theta/2 &amp;amp; 0 \\&#xA;0 &amp;amp; \sin \theta/2 &amp;amp; -\cos \theta/2 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where once again the two forms correspond to a rotation and a rotoreflection, respectively. We reduce the rotation case of &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; to the rotation case of &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; using&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_1(\theta) = C^{(2)}NOT^{(1)} \, U_2(-\theta) \, C^{(2)}NOT^{(1)} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the rotoreflection case of &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; to the rotoreflection case of &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; using&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_1(\theta) = C^{(2)}NOT^{(1)} \, U_2(-\theta) \, Z^{(1)} \, C^{(2)}NOT^{(1)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$Z^{(1)}$&lt;/span&gt; is the single-qubit &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate applied to the first qubit.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-07T00:08:55.060" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15012" PostTypeId="2" ParentId="15004" CreationDate="2020-12-07T00:58:31.400" Score="2" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Qutrit&quot; rel=&quot;nofollow noreferrer&quot;&gt;qutrit&lt;/a&gt; has a three-dimensional Hilbert space and its computational basis states are often labeled &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle, |2\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;a system of two qubits has a Hilbert space with four dimensions and even though the basis states are often labeled as &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle, |11\rangle$&lt;/span&gt;, one could also named them &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle, |2\rangle, |3\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits has a Hilbert space with dimension &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum harmonic oscillator&lt;/a&gt; has countably infinite dimensional Hilbert space.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Answering your question more directly: Your expansion of the sum in the question is correct and &lt;span class=&quot;math-container&quot;&gt;$|2\rangle, |3\rangle$&lt;/span&gt; simply refer to the third and fourth  states in the computational basis of the four-dimensional Hilbert space.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-07T01:23:29.860" LastActivityDate="2020-12-07T01:23:29.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15013" PostTypeId="1" AcceptedAnswerId="15021" CreationDate="2020-12-07T03:49:59.057" Score="3" ViewCount="157" Body="&lt;p&gt;I am trying to understand the integration on page 4 of &lt;a href=&quot;https://arxiv.org/abs/1910.12085&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper. Consider a Haar random circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and a fixed basis &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. Each output probability of a Haar random circuit (given by &lt;span class=&quot;math-container&quot;&gt;$|\langle z | C |0^{n} \rangle |^{2}$&lt;/span&gt;, for each fixed z) is distributed according to the Porter Thomas distribution, given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\text{PorterThomas}(x) = 2^{n} e^{-2^{n} x}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The paper claims that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}] = \int_{0}^{\infty} \frac{x}{2^{n}} x e^{-x} \,dx = \frac{2}{2^{n}}.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I do not understand the integration at all. Shouldn't the integration instead be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}] = \int_{0}^{\infty}  x ~2^{n} e^{-2^{n} x} \,dx = \frac{1}{2^{n}},&#xA;\end{equation}&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;Where are all the extra terms coming from and why is the answer &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{2^{n}}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="10480" LastEditDate="2021-01-21T19:16:39.147" LastActivityDate="2021-01-21T19:16:39.147" Title="Question regarding integration of Haar random state" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;quantum-advantage&gt;&lt;probability&gt;&lt;haar-distribution&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15014" PostTypeId="1" AcceptedAnswerId="15016" CreationDate="2020-12-07T04:32:48.730" Score="3" ViewCount="89" Body="&lt;p&gt;I'm trying to use &lt;a href=&quot;https://quantumai.google/cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt; with &lt;a href=&quot;https://www.tensorflow.org/quantum&quot; rel=&quot;nofollow noreferrer&quot;&gt;TensorFlow Quantum&lt;/a&gt; to simulate a variational quantum classifier. There's a &lt;a href=&quot;https://www.tensorflow.org/quantum/tutorials/mnist&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt; on the TFQ website on building a quantum neural network to classify a simplified version of MNIST, which I've been using for reference.&lt;/p&gt;&#xA;&lt;p&gt;The classifier that I'm building requires building my own &lt;a href=&quot;https://quantumai.google/cirq/custom_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom gates&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After encoding the data as quantum circuits, the next step is to convert these Cirq circuits to tensors using &lt;a href=&quot;https://www.tensorflow.org/quantum/api_docs/python/tfq/convert_to_tensor&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;tfq.convert_to_tensor&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;ValueError: Cannot serialize op &amp;lt;__main__.Custom_Gate object at...&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's some watered down code that gives the gist of my attempts:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def simple_func(x):&#xA;    return x*cirq.z&#xA;&#xA;class Custom_Gate(cirq.Gate):&#xA;    def __init__(self, x, n):&#xA;        self.x = x&#xA;        self.n = n&#xA;    def _unitary_(self):&#xA;        return simple_func(self.x)&#xA;    def _num_qubits_(self):&#xA;        return self.n&#xA;    def _circuit_diagram_info_(self, args: 'cirq.CircuitDiagramInfoArgs'):&#xA;        return ['U']&#xA;&#xA;x = 3&#xA;n = 1&#xA;U = Custom_Gate(x, n)&#xA;q0 = cirq.GridQubit(0, 0)&#xA;test_circuit = cirq.Circuit()&#xA;test_circuit.append(U.on(q0))&#xA;SVGCircuit(test_circuit)&#xA;&#xA;tfq.convert_to_tensor([test_circuit])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Am I making a mistake somewhere? Or does &lt;code&gt;tfq.convert_to_tensor&lt;/code&gt; just not work for custom gates?&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2020-12-07T21:54:10.910" LastActivityDate="2020-12-07T21:54:10.910" Title="Does TensorFlow Quantum tfq.convert_to_tensor work on custom gates?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;tfq&gt;&lt;quantum-neural-network&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15015" PostTypeId="1" AcceptedAnswerId="15022" CreationDate="2020-12-07T05:13:55.430" Score="1" ViewCount="79" Body="&lt;p&gt;I have a pure quantum state &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and another state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|i\rangle + |j\rangle)$&lt;/span&gt;. A state orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Among these states, I know the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle i | \psi \rangle = \frac{1}{\sqrt{2}} \\&#xA;\langle \phi | \psi \rangle = 0. \\&#xA;$$&lt;/span&gt;&#xA;Then, what can I say about the inner product of &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;? I.e., is there a way to find:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle i | \phi \rangle&#xA;$$&lt;/span&gt;.&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="55" LastEditDate="2020-12-25T23:33:26.697" LastActivityDate="2020-12-25T23:33:26.697" Title="Find inner product of two states given inner product of an orthogonal state" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;inner-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15016" PostTypeId="2" ParentId="15014" CreationDate="2020-12-07T06:02:26.930" Score="4" Body="&lt;p&gt;I'm the engineer who looks after TensorFlow Quantum. Serializing custom gates is not supported. There is an active issue on the GitHub here: &lt;a href=&quot;https://github.com/tensorflow/quantum/issues/354&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/tensorflow/quantum/issues/354&lt;/a&gt; . A quick workaround would be to try and determine the gate decomposition for your custom gate in terms of &lt;code&gt;tfq.util.get_supported_gates&lt;/code&gt; gate instances. A good place to start might be the &lt;a href=&quot;https://cirq.readthedocs.io/en/stable/generated/cirq.kak_decomposition.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;cirq.kak_decomposition&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Michael&lt;/p&gt;&#xA;" OwnerUserId="11700" LastActivityDate="2020-12-07T06:02:26.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15017" PostTypeId="1" CreationDate="2020-12-07T06:07:56.357" Score="2" ViewCount="52" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-12-25T23:33:43.850" LastActivityDate="2021-05-25T02:04:15.500" Title="Is Noise model for quantum prototypes accurate in Qiskit" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;noise&gt;&lt;ibm&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15018" PostTypeId="1" AcceptedAnswerId="15019" CreationDate="2020-12-07T06:14:24.277" Score="1" ViewCount="36" Body="&lt;p&gt;I had a question about &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13584/how-can-i-print-out-the-probability-of-a-certain-state-in-histogram&quot;&gt;obtaining the probability of a certain state from the histogram&lt;/a&gt;, 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:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Yveyk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yveyk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;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.&lt;/p&gt;&#xA;&lt;p&gt;ps: The structure of my function looks something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;provider = IBMQ.load_account()&#xA;sim = provider.backends.ibmq_qasm_simulator&#xA;def qc(Variable):&#xA;    qcz = QuantumCircuit(qrz,crz)&#xA;    ......&#xA;    job_sim = execute(qcz, sim)&#xA;    result_sim = job_sim.result()&#xA;    counts = result_sim.get_counts()&#xA;    probs = counts['0010'] / sum(counts.values())&#xA;    return probs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After that I want to call the function using each of the elements in my linspace.&lt;/p&gt;&#xA;&lt;p&gt;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:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2020-12-07T06:49:27.887" LastActivityDate="2020-12-07T07:39:19.757" Title="Is there a faster way to get 'a list of' result from 'a list of inputs'?" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15019" PostTypeId="2" ParentId="15018" CreationDate="2020-12-07T06:28:08.697" Score="1" Body="&lt;p&gt;You can do something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, QuantumRegister,  IBMQ, ClassicalRegister&#xA;from qiskit.circuit import QuantumCircuit, ParameterVector&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.providers.ibmq.managed import IBMQJobManager&#xA;from qiskit.visualization import *&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_valencia')&#xA;&#xA;def qc(Variable):&#xA;    var_form = QuantumCircuit(2,2)&#xA;    var_form.u1(Variable,0)&#xA;    var_form.cx(0,1) &#xA;    var_form.measure([0,1],[0,1])&#xA;    return var_form&#xA;&#xA;Variables = [1,2,3,4,5]&#xA;circuits = []&#xA;for i in range(len(Variables) ):&#xA;    circuit =  QuantumCircuit(2,2)&#xA;    circuit = qc(Variables[i])&#xA;    circuits.append( circuit   )&#xA;&#xA;circuits = transpile(circuits, backend=backend) &#xA;job_manager = IBMQJobManager()&#xA;MyExperiments = job_manager.run(circuits, backend=backend, name='MyExperiment')&#xA;results = MyExperiments.results()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that &lt;code&gt;qc(Variable)&lt;/code&gt; is spitting out circuit output of the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dxGtE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dxGtE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;so the Ry gate is taking in the variable. You can modify the circuit to your choice.&lt;/p&gt;&#xA;&lt;p&gt;Now when I run this, and look in the IBMQX &lt;code&gt;results&lt;/code&gt; tabs I see the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BfA8U.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BfA8U.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-07T07:39:19.757" LastActivityDate="2020-12-07T07:39:19.757" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15020" PostTypeId="2" ParentId="15017" CreationDate="2020-12-07T06:41:54.667" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In term your second question/point. After designing my quantum algorithm/circuit, I would first test it on the simulator &lt;strong&gt;without&lt;/strong&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-07T06:41:54.667" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15021" PostTypeId="2" ParentId="15013" CreationDate="2020-12-07T06:53:34.080" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;To see this, consider the following example procedure that yields &lt;span class=&quot;math-container&quot;&gt;$\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}]$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Run the quantum circuit on a noiseless quantum computer or simulator and obtain the output bitstring &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Simulate the quantum circuit on a classical computer to compute the value of the probability &lt;span class=&quot;math-container&quot;&gt;$|\langle z | C |0^{n} \rangle |^{2}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Repeat steps 1 and 2 to obtain the average of probabilities computed in step 2 across many output bistrings sampled in step 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;We can make this reasoning more rigorous (following section IV C of &lt;a href=&quot;https://arxiv.org/abs/1910.11333&quot; rel=&quot;nofollow noreferrer&quot;&gt;QS paper supplement&lt;/a&gt;). The fact that the distribution of output bitstring probabilities is Porter-Thomas means that the fraction of output bitstrings with probability in &lt;span class=&quot;math-container&quot;&gt;$[p, p+dp]$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Pr(p) \, dp \approx 2^n e^{-2^np} dp.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible output bitstrings, the number of bitstrings with probability in &lt;span class=&quot;math-container&quot;&gt;$[p, p+dp]$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;N(p) \, dp \approx 4^n e^{-2^np} dp.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, the probability that in step 1 above we see a bitstring whose probability lies in &lt;span class=&quot;math-container&quot;&gt;$[p, p+dp]$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(p) \, dp \approx p \, 4^n e^{-2^np} dp.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$f(p)$&lt;/span&gt; is the probability density function for the output bitstring probability. Therefore, the average output bitstring probability is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as expected.&lt;/p&gt;&#xA;&lt;p&gt;You may object that &lt;span class=&quot;math-container&quot;&gt;$f(p)$&lt;/span&gt; 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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(2^n - 1) (1 - p)^{2^n - 2} \approx 2^n e^{-2^np}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In practice, this approximation is very good for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; above a dozen or so.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2/2^n$&lt;/span&gt; according to the fidelity obtained in the experiment. This is the key idea behind linear cross-entrpy benchmarking.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-07T06:53:34.080" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15022" PostTypeId="2" ParentId="15015" CreationDate="2020-12-07T07:17:00.577" Score="4" Body="&lt;p&gt;The answer depends on the dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; of the Hilbert space.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$d = 2$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \frac{e^{i\theta}}{\sqrt{2}} (|i\rangle - |j\rangle)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\theta \in [0, 2\pi)$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$\langle i | \phi \rangle = \frac{e^{i\theta}}{\sqrt{2}}$&lt;/span&gt;. In other words, it can be any complex number of absolute value &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$d &amp;gt; 2$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \frac{a}{\sqrt{2}} (|i\rangle - |j\rangle) + b|k\rangle$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$a, b \in \mathbb{C}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^2 + b^2 = 1$&lt;/span&gt; and any &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt;. Therefore, &lt;span class=&quot;math-container&quot;&gt;$\langle i | \phi \rangle = \frac{a}{\sqrt{2}}$&lt;/span&gt;. In other words, it can be any complex number whose absolute value is in &lt;span class=&quot;math-container&quot;&gt;$[0, \frac{1}{\sqrt{2}}]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(I assume that &lt;span class=&quot;math-container&quot;&gt;$\langle i|j \rangle = 0$&lt;/span&gt; and  all kets are normalized.)&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-07T07:17:00.577" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15023" PostTypeId="2" ParentId="15004" CreationDate="2020-12-07T07:50:07.410" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-07T07:50:07.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15024" PostTypeId="2" ParentId="14976" CreationDate="2020-12-07T08:09:07.787" Score="3" Body="&lt;p&gt;What you're really recognising in the structure here is that your matrix decomposes into two &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;, I need to change&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;00\rightarrow 00, 01\rightarrow 11, 10\rightarrow 10, 11\rightarrow 01.&#xA;$$&lt;/span&gt;&#xA;This is achieved by a controlled-not controlled from the second qubit and targeting the first qubit. In other words, &lt;span class=&quot;math-container&quot;&gt;$U_1=CU_2C$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is the aforementioned controlled-not. Of course, once you have a circuit representation of &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt;, there may be some manipulations you can do to reduce the gate count.&lt;/p&gt;&#xA;&lt;p&gt;To do &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt;, there's a standard technique. You're familiar with the idea that any single-qubit unitary can be implemented with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=e^{i\theta}R_z(\alpha)R_y(\beta)R_z(\gamma),&#xA;$$&lt;/span&gt;&#xA;and hopefully with the identity &lt;span class=&quot;math-container&quot;&gt;$XR_Y(\alpha)X=R_Y(-\theta)$&lt;/span&gt; (and similarly for &lt;span class=&quot;math-container&quot;&gt;$R_Z$&lt;/span&gt;). So, let's assume we've found &lt;span class=&quot;math-container&quot;&gt;$\theta,\alpha,\beta,\gamma$&lt;/span&gt; corresponding to the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block that you want to implement. To gate &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt;, i.e. controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, we start by apply a phase gate &lt;span class=&quot;math-container&quot;&gt;$R_Z(\theta)$&lt;/span&gt; on the first qubit. Then we write a decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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),&#xA;$$&lt;/span&gt;&#xA;noting that if you remove the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; rotations, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_z(\alpha)R_Y(\beta/2)R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)R_z((\gamma-\alpha)/2)=I.&#xA;$$&lt;/span&gt;&#xA;So, this means that we could perform the sequence &lt;span class=&quot;math-container&quot;&gt;$R_z((\gamma-\alpha)/2)$&lt;/span&gt; on qubit 2, controlled-not targeting qubit 2, &lt;span class=&quot;math-container&quot;&gt;$R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)$&lt;/span&gt; on qubit 2, controlled-not targeting qubit 2 and finally &lt;span class=&quot;math-container&quot;&gt;$R_z(\alpha)$&lt;/span&gt; on qubit 2. Note that if qubit 1, the control qubit, is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the controlled-nots do nothing and the sequence on qubit 2 is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_z(\alpha)R_Y(\beta/2)R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)R_z((\gamma-\alpha)/2)=I.&#xA;$$&lt;/span&gt;&#xA;while if the control qubit is in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the sequence on qubit 2 is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-07T08:09:07.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15025" PostTypeId="1" CreationDate="2020-12-07T09:17:21.390" Score="3" ViewCount="37" Body="&lt;p&gt;I am trying to write down this &lt;a href=&quot;https://youtu.be/teraaPiaG8s?list=PLPvKnT7dgEsujrrP7i_mgbkivBN3J6A8u&amp;amp;t=2322&quot; rel=&quot;nofollow noreferrer&quot;&gt;problem&lt;/a&gt; (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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does anyone have any idea how to replicate this problem in a polynomial matrix?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="13981" LastEditorUserId="9006" LastEditDate="2020-12-07T11:26:45.920" LastActivityDate="2020-12-07T11:26:45.920" Title="D-WAVE QUBO Matrix Form" Tags="&lt;programming&gt;&lt;matrix-representation&gt;&lt;d-wave&gt;&lt;annealing&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15026" PostTypeId="1" CreationDate="2020-12-07T10:30:49.253" Score="1" ViewCount="46" Body="&lt;p&gt;I'm curious about for which &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; there exists a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; such that for &lt;span class=&quot;math-container&quot;&gt;$1 \le k \le n$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$|U^k_{1,0}(n)|^2 = \frac kn,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U^k_{1,0}(n)$&lt;/span&gt; is the lower left element of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;th power of &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The idea is that if such a matrix exists, then applying it &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times to the quantum state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; will produce the quantum state &lt;span class=&quot;math-container&quot;&gt;$\sqrt{1-k/n}|0\rangle + \sqrt{k/n}|1\rangle$&lt;/span&gt; modulo some phases, a &amp;quot;quantum coin&amp;quot; with probability &lt;span class=&quot;math-container&quot;&gt;$k/n$&lt;/span&gt; of giving outcome 1.&lt;/p&gt;&#xA;&lt;p&gt;It's easy to see that it exists for &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, with an example being&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(2) = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; -1 \\ 1 &amp;amp; 1 \end{pmatrix},$$&lt;/span&gt;&#xA;but I couldn't find an example for any other &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. A bit of brute force shows that no such matrices exist for &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;, and suggests that indeed no other &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; works. Perhaps there's an elegant way to prove this? Or maybe there is a construction that I missed?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I originally posted this question on &lt;a href=&quot;https://math.stackexchange.com/q/3931577&quot;&gt;Mathematics Stack Exchange&lt;/a&gt;, but nobody was interested about it there.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-12-07T16:06:56.640" Title="Existence of unitary matrix that produces quantum coin with given frequencies via iteration" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15027" PostTypeId="2" ParentId="15026" CreationDate="2020-12-07T10:55:36.193" Score="1" Body="&lt;p&gt;Let's try a general construction. We know that, to satisfy the &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; instance, we need &lt;span class=&quot;math-container&quot;&gt;$U_{1,0}=1/\sqrt{n}$&lt;/span&gt;, up to a possible phase. But we can always take one of the elements of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be real by removing a global phase.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\frac{1}{\sqrt{n}}\left(\begin{array}{cc} \sqrt{n-1}e^{i\theta_1} &amp;amp; -e^{i(\theta_4+\theta_1)} \\&#xA;1 &amp;amp; \sqrt{n-1}e^{i\theta_4} \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Now we just start multiplying it together. We find that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|U_{1,0}^2(n)|^2=\frac{4(n-1)}{n^2}\cos^2((\theta_1-\theta_4)/2).&#xA;$$&lt;/span&gt;&#xA;So, for all &lt;span class=&quot;math-container&quot;&gt;$n\geq 2$&lt;/span&gt;, there's a solution for &lt;span class=&quot;math-container&quot;&gt;$\theta_1-\theta_4$&lt;/span&gt; that gives a working &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;. Next, &lt;span class=&quot;math-container&quot;&gt;$k=3$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|U_{1,0}^3(n)|^2=\frac{(2 (n-1) \cos (\theta_1-\theta_4)+n-2)^2}{n^3}&#xA;$$&lt;/span&gt;&#xA;Since we already know the value of &lt;span class=&quot;math-container&quot;&gt;$\cos^2((\theta_1-\theta_4)/2)=n/(2(n-1))$&lt;/span&gt;, we can use the double angle formula to find &lt;span class=&quot;math-container&quot;&gt;$\cos (\theta_1-\theta_4)=1/(n-1)$&lt;/span&gt;. Hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|U_{1,0}^3(n)|^2=\frac{1}{n}\neq\frac{3}{n}.&#xA;$$&lt;/span&gt;&#xA;Hence, this &lt;em&gt;only&lt;/em&gt; works for &lt;span class=&quot;math-container&quot;&gt;$n=1,2$&lt;/span&gt; where we do not require that the &lt;span class=&quot;math-container&quot;&gt;$k=3$&lt;/span&gt; condition is satisfied.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For a more elegant version, note that if the relation holds for &lt;span class=&quot;math-container&quot;&gt;$k=n$&lt;/span&gt;, it must be that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^n=e^{i\phi}\left(\begin{array}{cc} 0 &amp;amp; e^{-i\theta} \\ e^{i\theta} &amp;amp; 0 \end{array}\right)=e^{i\phi}(\cos\theta X+\sin\theta Y).&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; must be an &lt;span class=&quot;math-container&quot;&gt;$n^{th}$&lt;/span&gt; root of this, so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^k=e^{ik\phi/n}\left(I\cos(k\pi/(2n))+i\sin(k\pi/(2n))(\cos\theta X+\sin\theta Y)\right).&#xA;$$&lt;/span&gt;&#xA;In other words,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|U^k_{1,0}|^2=\sin^2(k\pi/(2n))\neq \frac{k}{n},&#xA;$$&lt;/span&gt;&#xA;with the exception of &lt;span class=&quot;math-container&quot;&gt;$k=1,n=2$&lt;/span&gt; which, as we already know, &lt;em&gt;does&lt;/em&gt; work.&#xA;(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.)&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2020-12-07T13:54:10.303" LastActivityDate="2020-12-07T13:54:10.303" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15028" PostTypeId="1" AcceptedAnswerId="15040" CreationDate="2020-12-07T12:02:58.890" Score="4" ViewCount="65" Body="&lt;p&gt;A few days ago, Atos company published new benchmark for quantum computers. The benchmark is called &lt;em&gt;Q-Score&lt;/em&gt; and it is defined as follows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &lt;em&gt;quantum volume&lt;/em&gt; is.&lt;/p&gt;&#xA;&lt;p&gt;Atos also said that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;Source of quotes: &lt;a href=&quot;https://atos.net/en/2020/press-release_2020_12_04/atos-announces-q-score-the-only-universal-metrics-to-assess-quantum-performance-and-superiority&quot; rel=&quot;nofollow noreferrer&quot;&gt;Atos press release&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Based on the quotes above, I have these objections against the Atos benchmark:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is whether my objections are justified and make sense.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-07T22:00:55.123" Title="Could a new benchmark of quantum processors Q-Score by Atos be more useful than quantum volume?" Tags="&lt;quantum-advantage&gt;&lt;randomised-benchmarking&gt;&lt;quantum-volume&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15029" PostTypeId="1" AcceptedAnswerId="15030" CreationDate="2020-12-07T12:26:37.573" Score="0" ViewCount="66" Body="&lt;p&gt;I have a system of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits and want to construct a quantum operator &lt;span class=&quot;math-container&quot;&gt;$Z_i Z_j + Z_k$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$Z_i$&lt;/span&gt; denotes the Pauli-Z operator acting on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit. Is there any direct way in qiskit, how I could implement this?&lt;/p&gt;&#xA;&lt;p&gt;I know that I can construct an operator by e.g. saying &lt;code&gt;op = Z^Z&lt;/code&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; should act on (such that on all the other qubits Identity is applied).&lt;/p&gt;&#xA;&lt;p&gt;My way so far consists of constructing a Quantum Circuit and converting this to an operator by&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circZZ = QuantumCircuit(N)  # circuit for Z_i Z_j&#xA;circZ = QuantumCircuit(N)  # circuit for Z_k&#xA;circZZ.z(i)&#xA;circZZ.z(j)&#xA;circZ.z(k)&#xA;opZZ = CircuitOp(circZZ)  # convert circuit to operator&#xA;opZ = CircuitOp(circZ)  # convert circuit to operator&#xA;op = opZZ + opZ&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13925" LastEditorUserId="55" LastEditDate="2020-12-25T23:34:13.083" LastActivityDate="2020-12-25T23:34:13.083" Title="qiskit: How to get an operator acting on a certain qubit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15030" PostTypeId="2" ParentId="15029" CreationDate="2020-12-07T12:45:10.923" Score="1" Body="&lt;p&gt;The class &lt;code&gt;Operator&lt;/code&gt; has a &lt;code&gt;from_label&lt;/code&gt; method: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Operator.html?highlight=operator%20from_label#qiskit.quantum_info.Operator.from_label&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Operator.html?highlight=operator%20from_label#qiskit.quantum_info.Operator.from_label&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;That means you could do something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;opZZ = Operator.from_label('ZZ')&#xA;opZ = Operator.from_label('Z')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It's possible to &lt;em&gt;add&lt;/em&gt; &lt;code&gt;opZZ&lt;/code&gt; and &lt;code&gt;opZ&lt;/code&gt; into N-sized &lt;code&gt;op&lt;/code&gt;. However, you have to call the &lt;code&gt;_add&lt;/code&gt; by hand:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;op = 0 * Operator.from_label('I' * N)  # Set the initial operator to zero&#xA;op = op._add(opZZ, qargs=[i,j])&#xA;op = op._add(opZ, qargs=[k])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="13925" LastEditDate="2020-12-10T18:43:39.240" LastActivityDate="2020-12-10T18:43:39.240" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15031" PostTypeId="1" CreationDate="2020-12-07T13:41:16.860" Score="1" ViewCount="124" Body="&lt;p&gt;I was reading the book by Nielsen &amp;amp; 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:-&lt;/p&gt;&#xA;&lt;p&gt;The sets &lt;span class=&quot;math-container&quot;&gt;$|{\tilde\psi_i} \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|{\tilde\phi_j} \rangle$&lt;/span&gt;generate the same density matrix if and only if&#xA;&lt;span class=&quot;math-container&quot;&gt;$|{\tilde\psi_i} \rangle= u_{i,j} |{\tilde\phi_j} \rangle$&lt;/span&gt;, (2.166)&#xA;where &lt;span class=&quot;math-container&quot;&gt;$u_{i,j}$&lt;/span&gt; is a unitary matrix of complex numbers, with indices &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, and we ‘pad’ whichever set of vectors &lt;span class=&quot;math-container&quot;&gt;$|{\tilde\psi_i} \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|{\tilde\phi_j} \rangle$&lt;/span&gt; is smaller with additional vectors 0 so that the two sets have the same number of elements.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Or if we think a bit more we can say that suppose we find one set of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;If you see I am saying something wrong, please correct me.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2020-12-25T23:34:24.070" LastActivityDate="2020-12-25T23:34:24.070" Title="Unitary freedom in the ensemble for density matrices" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15032" PostTypeId="2" ParentId="15026" CreationDate="2020-12-07T16:06:56.640" Score="1" Body="&lt;p&gt;This is a correct version of the &amp;quot;elegant&amp;quot; version of DaftWullie's answer.&lt;/p&gt;&#xA;&lt;p&gt;If the relation holds for &lt;span class=&quot;math-container&quot;&gt;$k=n$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U^n = \begin{pmatrix} 0 &amp;amp; e^{-i\theta} \\ e^{i\theta} &amp;amp; 0 \end{pmatrix}, $$&lt;/span&gt; modulo a global phase. Since the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$U^n$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, we have that &lt;span class=&quot;math-container&quot;&gt;$(I+U)/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(I-U)/2$&lt;/span&gt; are orthogonal projectors, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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$$&lt;/span&gt;&#xA;for some integers &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;th power is then just&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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$$&lt;/span&gt;&#xA;Modulo a global phase, &lt;span class=&quot;math-container&quot;&gt;$U^k$&lt;/span&gt; is then equal to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ {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,$$&lt;/span&gt;&#xA;for some integer &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;, which implies that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|U^k_{1,0}|^2 = \sin^2\left(\frac{k\pi}{n}\left(\frac12+l\right)\right).$$&lt;/span&gt; This will be equal to &lt;span class=&quot;math-container&quot;&gt;$k/n$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$l=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=2k$&lt;/span&gt;, for example. In general it doesn't work, though, because for &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; we need that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\pi}{n}\left(\frac12+l\right) = \pm\arcsin\frac{1}{\sqrt{n}}, $$&lt;/span&gt;&#xA;but &lt;span class=&quot;math-container&quot;&gt;$\arcsin\frac{1}{\sqrt{n}}$&lt;/span&gt; is only a rational multiple of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$n=1,2,$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The cases &lt;span class=&quot;math-container&quot;&gt;$n=1,2$&lt;/span&gt; do work, but for &lt;span class=&quot;math-container&quot;&gt;$n=4$&lt;/span&gt; we would need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\pi}{4}\left(\frac12+l\right) = \pm\frac{\pi}{6}, $$&lt;/span&gt;&#xA;which is not possible for integer &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-12-07T16:06:56.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15033" PostTypeId="2" ParentId="15029" CreationDate="2020-12-07T16:09:07.147" Score="1" Body="&lt;p&gt;You could use the feature that the Opflow in Aqua can take integers as tensorpower, like &lt;code&gt;Z ^ 5&lt;/code&gt; and then fill the blanks with identities.&#xA;In a short function that could look like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import Z, I&#xA;&#xA;def get_term(i, j, k, n):&#xA;    &amp;quot;&amp;quot;&amp;quot;i, j and k as in your description and n is the number of qubits.&amp;quot;&amp;quot;&amp;quot;&#xA;    zz = (I ^ i) ^ Z ^ (I ^ j - i - 1) ^ Z ^ (I ^ (n - j - i - 1))&#xA;    z = (I ^ k) ^ Z ^ (I ^ (n - k - 1))&#xA;    return zz + z&#xA;&#xA;print(get_term(0, 2, 4, 5))&#xA;# 1.0 * ZIZII&#xA;# + 1.0 * IIIIZ&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;get_term(n - i - 1, n - j - 1, n - k - 1, n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-12-07T16:09:07.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15034" PostTypeId="1" AcceptedAnswerId="15035" CreationDate="2020-12-07T16:13:09.857" Score="2" ViewCount="71" Body="&lt;p&gt;Suppose I have the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(|0\rangle + |1\rangle)$&lt;/span&gt;, how can I refer to ket 0 and ket 1 in general within a state? Would &amp;quot;term 1&amp;quot; and &amp;quot;term 2&amp;quot; work?&lt;/p&gt;&#xA;" OwnerUserId="14072" LastEditorUserId="55" LastEditDate="2020-12-25T23:36:46.073" LastActivityDate="2020-12-25T23:36:46.073" Title="Is there a name for the terms that make up a state?" Tags="&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15035" PostTypeId="2" ParentId="15034" CreationDate="2020-12-07T16:22:43.450" Score="3" Body="&lt;p&gt;If you have &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha |0\rangle + \beta|1\rangle$&lt;/span&gt; then you can refer to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as the basis states. This is generalize to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit system as well.&lt;/p&gt;&#xA;&lt;p&gt;And yes, you can just just refer to them as the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &amp;quot;ket 0&amp;quot; state, and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or &amp;quot;ket 1&amp;quot; state.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-07T16:29:13.250" LastActivityDate="2020-12-07T16:29:13.250" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15036" PostTypeId="2" ParentId="15009" CreationDate="2020-12-07T16:44:27.647" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Fermat's little theorem says that for a prime &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a^{p-1}\equiv 1\mod p$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; co-prime to &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. This means the order of the group of powers of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; will divide &lt;span class=&quot;math-container&quot;&gt;$p-1$&lt;/span&gt;, rather than &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, hence why the algorithm uses &lt;span class=&quot;math-container&quot;&gt;$28$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The &amp;quot;input&amp;quot; is two-dimensional here; it should be all pairs &lt;span class=&quot;math-container&quot;&gt;$(a,b)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0\leq a\leq 27$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0\leq b\leq 27$&lt;/span&gt;. The period you're looking for is a pair of integers &lt;span class=&quot;math-container&quot;&gt;$(r_1,r_2)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$2^a7^{-b}\equiv 2^{a+r_1}7^{-b-r_2}\mod p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; be the discrete log, i.e., &lt;span class=&quot;math-container&quot;&gt;$7\equiv 2^x\mod p$&lt;/span&gt;. Then we can re-write this as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ 2^a2^{-bx}\equiv 2^{a+r_1}2^{-x(b+r_2)}\mod p$$&lt;/span&gt;&#xA;Since we know that &lt;span class=&quot;math-container&quot;&gt;$2^{28}\equiv 1\mod p$&lt;/span&gt;, we can treat the exponents as integers modulo &lt;span class=&quot;math-container&quot;&gt;$28$&lt;/span&gt;, i.e.,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a-bx \equiv a+r_1-x(b+r_2)\mod 28$$&lt;/span&gt;&#xA;We can cancel out terms with &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}0\equiv &amp;amp;r_1-xr_2\mod 28\\&#xA;-r_1r_2^{-1}\equiv &amp;amp;x\mod 28\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the discrete log is &lt;span class=&quot;math-container&quot;&gt;$-r_1r_2^{-1}\mod 28$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This means what you really want to do is take a two-dimensional array of results for different values of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, and find a period in that.&lt;/p&gt;&#xA;&lt;p&gt;It looks like what you've actually found is that the order of &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$7$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$7^7\equiv 1\mod p$&lt;/span&gt;. 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Pohlig%E2%80%93Hellman_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Pohlig-Hellman algorithm&lt;/a&gt; to reduce composite-order discrete logs to smaller prime-order discrete logs.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2020-12-07T16:44:27.647" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15037" PostTypeId="1" AcceptedAnswerId="15053" CreationDate="2020-12-07T17:52:26.813" Score="3" ViewCount="65" Body="&lt;p&gt;In my research, I stumbled on a smooth map:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\pi_{\rho_0}: B \setminus \{\rho_0\} \to \partial B$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the open Bloch ball, corresponding to the set of mixed states of a single qubit and &lt;span class=&quot;math-container&quot;&gt;$\partial B$&lt;/span&gt; is the Bloch sphere proper, consisting of the set of pured states of a single qubit and &lt;span class=&quot;math-container&quot;&gt;$\rho_0 \in B$&lt;/span&gt; is a fixed mixed state of a single qubit. The map is defined as follows.&lt;/p&gt;&#xA;&lt;p&gt;After fixing &lt;span class=&quot;math-container&quot;&gt;$\rho_0 \in B$&lt;/span&gt;, you define the image of a mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho \in B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho \neq \rho_0$&lt;/span&gt; as the intersection of the ray starting from &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and passing through &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\partial B$&lt;/span&gt; (the Bloch sphere proper). This can be characterized as follows. It is the unique pure state which can be written as a linear combination&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a \rho_0 + b \rho$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$a, b \in \mathbb{R}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a + b = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b &amp;gt; 1$&lt;/span&gt; (and therefore &lt;span class=&quot;math-container&quot;&gt;$a &amp;lt; 0$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; can be viewed as a map&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ B \times B \setminus \Delta \to \partial B $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;mapping &lt;span class=&quot;math-container&quot;&gt;$(\rho_0, \rho)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\pi_{\rho_0}(\rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Delta \subset B \times B$&lt;/span&gt; is the diagonal (i.e. &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt; consists of all pairs &lt;span class=&quot;math-container&quot;&gt;$(\rho, \rho)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho \in B$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Then if &lt;span class=&quot;math-container&quot;&gt;$G = \mathrm{SU}(2)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$B \times B$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ g.(\rho_0, \rho) := (g \rho_0 g^{-1}, g \rho g^{-1}). $$&lt;/span&gt;&#xA;Moreover, &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$\partial B$&lt;/span&gt; by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ g.\nu = g \nu g^{-1}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, if I am not mistaken, &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;-equivariant.&lt;/p&gt;&#xA;&lt;p&gt;This map &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; seems natural. I know it appears in the literature when &lt;span class=&quot;math-container&quot;&gt;$\rho_0 = \frac{1}{2}I$&lt;/span&gt; is at the &amp;quot;origin&amp;quot; of the Bloch ball. But did the more general &lt;span class=&quot;math-container&quot;&gt;$\pi_{\rho_0}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; is any fixed mixed state of the qubit, appear in the quantum information theory literature please?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14062" LastActivityDate="2020-12-09T08:41:42.070" Title="Does this point-projection of a mixed state onto a pure state appear in the quantum information theory literature?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15038" PostTypeId="1" CreationDate="2020-12-07T18:27:02.983" Score="1" ViewCount="51" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-side.&lt;/p&gt;&#xA;&lt;p&gt;How to interpret this, or have I just made a mistake? Here's my result:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} \left.\begin{matrix}&#xA; 1&amp;amp;  0&amp;amp;  1&amp;amp;  1&amp;amp;  1&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  1\\&#xA; 0&amp;amp;  1&amp;amp;  0&amp;amp;  1&amp;amp;  1&amp;amp;  1&amp;amp;  0&amp;amp;  1&amp;amp;  1\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&#xA;\end{matrix}\right|&#xA;\begin{matrix}&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  1&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  1&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  -1\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  1&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  1\\&#xA; 1&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  1&amp;amp;  0&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  1&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  1&amp;amp;  0&amp;amp;  0\\&#xA; 0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  0&amp;amp;  1&amp;amp;  0&#xA;\end{matrix} \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13661" LastEditorUserId="10480" LastEditDate="2021-01-25T02:34:50.940" LastActivityDate="2021-01-25T02:34:50.940" Title="Standard form Shor's code" Tags="&lt;error-correction&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15039" PostTypeId="1" CreationDate="2020-12-07T20:05:44.030" Score="2" ViewCount="52" Body="&lt;p&gt;I am reading Grover's paper &amp;quot;&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.95.150501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fixed-Point Quantum Search&lt;/a&gt;,&amp;quot; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0503205&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv version with a different name&lt;/a&gt;) 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!&lt;/p&gt;&#xA;" OwnerUserId="14084" LastEditorUserId="14084" LastEditDate="2020-12-09T14:40:55.477" LastActivityDate="2020-12-09T14:40:55.477" Title="A question about Grover's paper &quot;Fixed-Point Quantum Search&quot;" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;unitarity&gt;&lt;amplitude-amplification&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15040" PostTypeId="2" ParentId="15028" CreationDate="2020-12-07T22:00:55.123" Score="3" Body="&lt;p&gt;(3) is a solid objection. I'm not sure what specifically is meant by &amp;quot;number of variables within a problem that a quantum technology can optimize&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;If the benchmark is meant as &amp;quot;the quantum computer performed better than random guessing&amp;quot; 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 &lt;em&gt;supposed to&lt;/em&gt; approach optimal performance with large &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. Alternatively, if the benchmark is to be interpreted as &amp;quot;the quantum computer performed better than classical problems of the same size&amp;quot; it seems like the Q-score threshold of 60 contradicts claims from [2], which suggests hundreds to thousands of qubits required for demonstrating advantage.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;square&amp;quot; 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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[1] Arute, F., Arya, K., Babbush, R., Bacon, D., Bardin, J. C., Barends, R., ... &amp;amp; Burkett, B. (2020). Quantum approximate optimization of non-planar graph problems on a planar superconducting processor. &lt;a href=&quot;https://arxiv.org/abs/2004.04197&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2004.04197&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[2] Guerreschi, G.G., Matsuura, A.Y. (2019). QAOA for Max-Cut requires hundreds of qubits for quantum speed-up. Sci Rep 9, 6903 &lt;a href=&quot;https://www.nature.com/articles/s41598-019-43176-9&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41598-019-43176-9&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[3] Hamerly, R., Inagaki, T., McMahon, P. L., Venturelli, D., Marandi, A., Onodera, T., ... &amp;amp; Enbutsu, K. (2019). Experimental investigation of performance differences between coherent Ising machines and a quantum annealer. Science advances, 5(5) . &lt;a href=&quot;https://arxiv.org/abs/1805.05217&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.05217&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-12-07T22:00:55.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15041" PostTypeId="1" CreationDate="2020-12-08T00:13:19.563" Score="1" ViewCount="70" Body="&lt;p&gt;Is there a way that can obtain sparse matrix of quantum circuit? I used to check my quantum circuit with &lt;code&gt;quantum_info.Operator&lt;/code&gt;, 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!&lt;/p&gt;&#xA;" OwnerUserId="13527" LastEditorUserId="55" LastEditDate="2020-12-19T09:14:45.583" LastActivityDate="2020-12-19T09:14:45.583" Title="Get a sparse matrix of quantum circuit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15042" PostTypeId="2" ParentId="15041" CreationDate="2020-12-08T03:53:03.547" Score="1" Body="&lt;p&gt;There are classes for Operators, States, Channels, Measures, Randomness, Analysis and Synthesis in Quantum Information ( qiskit.quantum_info ).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.SparsePauliOp.html#qiskit.quantum_info.SparsePauliOp&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; 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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.legacy.MatrixOperator.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Aqua API specifications&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="4501" LastEditDate="2020-12-08T05:16:44.523" LastActivityDate="2020-12-08T05:16:44.523" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15043" PostTypeId="2" ParentId="13728" CreationDate="2020-12-08T05:01:34.360" Score="0" Body="&lt;p&gt;In my case, running same command ( with &lt;code&gt;!pip  install pylatexenc&lt;/code&gt;) inside the jupyter notebook solved the issue!&lt;/p&gt;&#xA;" OwnerUserId="14086" LastEditorUserId="1859" LastEditDate="2020-12-08T11:22:52.370" LastActivityDate="2020-12-08T11:22:52.370" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15045" PostTypeId="1" AcceptedAnswerId="15046" CreationDate="2020-12-08T07:47:51.290" Score="7" ViewCount="512" Body="&lt;p&gt;When simulating a quantum circuit using the &lt;code&gt;qiskit&lt;/code&gt; &lt;code&gt;qasm_simulator&lt;/code&gt;, the qubits that you assign to the quantum circuit may be connected to all other qubits. In other words, if there are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits in the quantum circuit, a single qubit can interact with all other &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;This is quite an unpractical hypothesis for real quantum computation. &lt;strong&gt;k-locality&lt;/strong&gt; is a common criterion for a quantum computer and the only quantum computer I know of that has full qubit-connectivity is &lt;a href=&quot;https://www.nature.com/articles/s41467-019-13534-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;(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.&lt;/p&gt;&#xA;&lt;p&gt;So here arises my question: when designing a quantum circuit we have to take qubit connectivity into consideration, but how does &lt;code&gt;qiskit&lt;/code&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="15408" LastEditDate="2021-05-08T15:40:23.060" LastActivityDate="2021-05-08T15:40:23.060" Title="Qubit Connectivity of IBM Quantum Computer" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;physical-qubit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15046" PostTypeId="2" ParentId="15045" CreationDate="2020-12-08T08:32:35.380" Score="7" Body="&lt;p&gt;You can pass the parameter &lt;code&gt;coupling_map&lt;/code&gt; to &lt;code&gt;execute&lt;/code&gt; or &lt;code&gt;transpile&lt;/code&gt;. This allows simulating a specific connectivity scheme as a list of edges.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;coupling_map&lt;/code&gt; parameter. You can also control parts of that adaptation with parameters like &lt;code&gt;initial_layout&lt;/code&gt; (you can define to which physical qubits you want to allocate your circuit).&lt;/p&gt;&#xA;&lt;p&gt;Consider the following example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;circuit.cx(0, 1)&#xA;circuit.cx(1, 2)&#xA;circuit.cx(2, 0)&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZIDvw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZIDvw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This circuit requires a directed circular connectivity map. By default, transpiling this circuit takes a fully connected map, so it has no changes:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpiled = transpile(circuit)&#xA;transpiled.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CiU1f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CiU1f.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to add the restriction of a particular connectivity map, you can do so with the argument &lt;code&gt;coupling_map&lt;/code&gt;. In this case, it is a directed linear connectivity &lt;span class=&quot;math-container&quot;&gt;$ 0 \rightarrow 1 \rightarrow 2$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpiled = transpile(circuit, coupling_map=[[0,1], [1,2]])&#xA;transpiled.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ACyA1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ACyA1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that a &lt;em&gt;SWAP&lt;/em&gt; gate was added and the direction of &lt;em&gt;CNOT&lt;/em&gt; was corrected. Also, the qubit allocation is showed on the left-hand side (e.g. logical qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; was allocated to physical qubit &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can control the qubit allocation with the parameter &lt;code&gt;initial_layout&lt;/code&gt;. In the following example, logical &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is forced to be allocated to physical qubit 0 and so on:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpiled = transpile(circuit, coupling_map=[[0,1], [1,2]], initial_layout=[0, 1, 2])&#xA;transpiled.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZROqU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZROqU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="5955" LastEditDate="2021-05-08T10:33:21.487" LastActivityDate="2021-05-08T10:33:21.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15047" PostTypeId="2" ParentId="15045" CreationDate="2020-12-08T08:34:59.860" Score="4" Body="&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler.html?highlight=initial%20layout#supplementary-information&quot; rel=&quot;nofollow noreferrer&quot;&gt;brief explanation&lt;/a&gt;  on the &lt;em&gt;Initial Layout&lt;/em&gt; part related to the optimisation level here. You will find explanation as well about this in the &lt;em&gt;Mapping circuits to hardware technology&lt;/em&gt; part about the importance of a good layout for optimising the circuit and having the best results possible in the end.&lt;/p&gt;&#xA;&lt;p&gt;You can also do it yourself. &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler_passes.html?highlight=layout&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;, 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 &lt;code&gt;execute&lt;/code&gt; function.&lt;br /&gt;&#xA;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 &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.transpiler.CouplingMap.html#qiskit.transpiler.CouplingMap&quot; rel=&quot;nofollow noreferrer&quot;&gt;the CouplingMap&lt;/a&gt; and see where this leads you !&lt;/p&gt;&#xA;&lt;p&gt;I hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-12-08T08:34:59.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15048" PostTypeId="1" AcceptedAnswerId="15049" CreationDate="2020-12-08T10:16:22.390" Score="2" ViewCount="95" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/okXsw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/okXsw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.backends.ibmq_armonk&#xA;&#xA;&#xA;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.u(pi/2, pi/2, pi/2, qreg_q[0])&#xA;circuit.x(qreg_q[0])&#xA;circuit.y(qreg_q[0])&#xA;circuit.x(qreg_q[0])&#xA;circuit.y(qreg_q[0])&#xA;circuit.u(pi/2, pi/2, pi/2, qreg_q[0]).inverse()&#xA;&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;&#xA;&#xA;qobj = assemble(transpile(circuit, backend=backend), backend=backend)&#xA;job = backend.run(qobj)&#xA;retrieved_job = backend.retrieve_job(job.job_id())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14088" LastEditorUserId="55" LastEditDate="2020-12-19T09:15:05.993" LastActivityDate="2020-12-19T09:15:05.993" Title="Conjugate transpose of a U-gate" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15049" PostTypeId="2" ParentId="15048" CreationDate="2020-12-08T10:49:02.790" Score="1" Body="&lt;p&gt;Indeed, your circuit can be reduced to an identity circuit as @KAJ226 nicely explains &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15056/1859&quot;&gt;here&lt;/a&gt;. The transpilation process notices that and reduces your gates to idle during circuit depth optimization:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.u(pi/2, pi/2, pi/2, qreg_q[0])&#xA;circuit.x(qreg_q[0])&#xA;circuit.y(qreg_q[0])&#xA;circuit.x(qreg_q[0])&#xA;circuit.y(qreg_q[0])&#xA;circuit.u(pi/2, pi/2, pi/2, qreg_q[0]).inverse()&#xA;&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;&#xA;transpile(circuit, backend=backend).draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k96rK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k96rK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can avoid the optimization by reducing the optimization level to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpile(circuit, backend=backend, optimization_level=0).draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QouBl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QouBl.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In your example, you need to modify the &lt;code&gt;transpile&lt;/code&gt; call like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qobj = assemble(transpile(circuit, backend=backend, optimization_level=0), backend=backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-12-09T10:18:46.817" LastActivityDate="2020-12-09T10:18:46.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15050" PostTypeId="1" CreationDate="2020-12-08T11:18:56.407" Score="1" ViewCount="41" Body="&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Search a 'known' element in an 'unknown' quantum database&lt;/li&gt;&#xA;&lt;li&gt;Alternatively, show this is fundamentally impossible (somehow related to the Holevo bound or P &amp;lt; NP?)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Related yet different:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Grover Search (and related improvements): single element marked in a 'full' superposition.&lt;/li&gt;&#xA;&lt;li&gt;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).&lt;/li&gt;&#xA;&lt;li&gt;Quantum Counting (and related improvements): assumes either full superposition or knowledge of database.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Formulation:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Database structure of &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; (qu)bits of tag and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; (qu)bits of data&lt;/li&gt;&#xA;&lt;li&gt;An initial state with a equal superposition of tag qubits and zero in the data qubits: &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle = \sum_{x \in 2^t} (\dfrac{1}{\sqrt{2^t}} |tag_x\rangle \otimes |0\rangle^d)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that evolves &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_{x \in 2^t} (\dfrac{1}{\sqrt{2^t}} |tag_x\rangle\otimes |data_x\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Thus, every binary encoded tag is unique and has an associated data, however, the data may not be unique&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Given &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and the knowledge of which qubits encode the tag and the data&lt;/li&gt;&#xA;&lt;li&gt;Given access to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$t+d$&lt;/span&gt; qubits without explicit knowledge of the superposition state&lt;/li&gt;&#xA;&lt;li&gt;Search/sample associated tag/s of corresponding &lt;span class=&quot;math-container&quot;&gt;$|data_i\rangle$&lt;/span&gt; with high probability&lt;/li&gt;&#xA;&lt;li&gt;Count the number of tags storing a specific &lt;span class=&quot;math-container&quot;&gt;$|data_i\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$t = 2$&lt;/span&gt; qubit tag and &lt;span class=&quot;math-container&quot;&gt;$d = 3$&lt;/span&gt; qubit data&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \dfrac{1}{2} (|00.010\rangle + |01.110\rangle + |10.100\rangle + |11.110\rangle)$&lt;/span&gt;. The dot is notational denoting the &lt;span class=&quot;math-container&quot;&gt;$tag.data$&lt;/span&gt; encoding.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|data_i\rangle = 110$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Search aim: amplify the corresponding tags towards the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}} (|01.110\rangle + |11.110\rangle)$&lt;/span&gt;. 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.&lt;/li&gt;&#xA;&lt;li&gt;Count aim: counting the number of tags &lt;span class=&quot;math-container&quot;&gt;$\rvert|tag_i\rangle\rvert= 2$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Motivation&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;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).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1153" LastEditorUserId="1859" LastEditDate="2020-12-08T13:15:17.597" LastActivityDate="2020-12-08T13:15:17.597" Title="Quantum Search/Count on an unknown superposition state" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15051" PostTypeId="2" ParentId="14751" CreationDate="2020-12-08T11:29:03.597" Score="1" Body="&lt;p&gt;You can use the Quantum Associative Memory algorithm which does not require every element to be present in the database:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807053&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9807053&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There are various improvements over it:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.sciencedirect.com/science/article/abs/pii/S0020025500000578&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/science/article/abs/pii/S0020025500000578&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://link.springer.com/article/10.1007/s10773-012-1237-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://link.springer.com/article/10.1007/s10773-012-1237-0&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You mentioned, the same element can be present multiple times.&#xA;This can be taken care by the improvement of Grover search:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807027&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9807027&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="1153" LastActivityDate="2020-12-08T11:29:03.597" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15052" PostTypeId="2" ParentId="15034" CreationDate="2020-12-08T11:39:14.280" Score="1" Body="&lt;p&gt;Generally, a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is composed of basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n}$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is a number of qubits in the state), term &lt;em&gt;basis&lt;/em&gt; states is more than appropriate.&lt;/p&gt;&#xA;&lt;p&gt;You can also call these states ZERO and ONE in this particular case (a basis composed of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is called computational basis).&lt;/p&gt;&#xA;&lt;p&gt;Just note that your state is not normalized, it should be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle +|1\rangle)$&lt;/span&gt;. Maybe, you were confused by notion that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="13996" LastEditDate="2020-12-08T15:06:17.067" LastActivityDate="2020-12-08T15:06:17.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15053" PostTypeId="2" ParentId="15037" CreationDate="2020-12-08T13:37:52.953" Score="3" Body="&lt;p&gt;I am not aware of a direct application of this projection. However, maybe the following geometrical construction is nevertheless of interest to you.&lt;/p&gt;&#xA;&lt;p&gt;Similar ray constructions appear in resource theories, namely in the definition of &lt;em&gt;robustness&lt;/em&gt; and &lt;em&gt;generalised robustness&lt;/em&gt; monotones.&lt;/p&gt;&#xA;&lt;p&gt;Consider a convex set of states &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; which we call the &lt;em&gt;free states&lt;/em&gt; in the resource theory. Let us denote by &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; the convex set of all states. Then, given a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we define the following functions&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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\},&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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\}.&#xA;$$&lt;/span&gt;&#xA;In the definitions, we optimise over all rays going through &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; which include &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure, than &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the projection of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1$&lt;/span&gt; w.r.t to &lt;span class=&quot;math-container&quot;&gt;$\sigma_0$&lt;/span&gt; under your map.&lt;/p&gt;&#xA;&lt;p&gt;The monotones have the following geometrical interpretation:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\sigma_0$&lt;/span&gt; is the closest state in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; measured w.r.t. to the length of the ray segment which lies in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; (the diameter of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; in this direction)&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$GR$&lt;/span&gt;: similar, but compared to the distance of &lt;span class=&quot;math-container&quot;&gt;$\sigma_0$&lt;/span&gt; to the opposite boundary of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The generalised robustness is equivalent to what is called the &lt;em&gt;max-relative entropy&lt;/em&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{D}_\mathrm{max}(\rho) := \inf_{\sigma\in\mathcal{F}} D_\mathrm{max}(\rho||\sigma) = \log\left( 1 + GR(\rho) \right)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$D_\mathrm{max}(\rho||\sigma)=\log \inf\{\lambda\geq 0 \, | \, \rho \leq \lambda\sigma\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After your remark, I changed &lt;span class=&quot;math-container&quot;&gt;$\min$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\inf$&lt;/span&gt;. However, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; is  usually compact.&lt;/p&gt;&#xA;&lt;p&gt;Here is a review on resource theories which appeared recently in RMP. The above functions and more appear in Sec. VI.&lt;/p&gt;&#xA;&lt;p&gt;Chitambar and Goul: &amp;quot;Quantum Resource Theories&amp;quot;. &lt;a href=&quot;https://arxiv.org/abs/1806.06107&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1806.06107&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2020-12-09T08:41:42.070" LastActivityDate="2020-12-09T08:41:42.070" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15054" PostTypeId="1" CreationDate="2020-12-08T14:32:55.133" Score="3" ViewCount="64" Body="&lt;p&gt;In my previous question on this, I managed to come up with a simple &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14847/4153&quot;&gt;recursive algorithm&lt;/a&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;Also, how does such an algorithm map semantically onto a diagram like this, from &lt;a href=&quot;https://www.scottaaronson.com/democritus/lec9.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson's quantum computing lecture 9&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Wvkm4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Wvkm4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4153" LastEditorUserId="4153" LastEditDate="2020-12-08T15:03:13.333" LastActivityDate="2020-12-08T15:03:13.333" Title="What is the non-recursive form of the sum-over-paths simulation algorithm?" Tags="&lt;simulation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15055" PostTypeId="2" ParentId="15045" CreationDate="2020-12-08T16:20:19.210" Score="0" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Fr example, let's us take a similar circuit to the one given by @Luciano:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iw1VO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iw1VO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;setting &lt;code&gt;basis_gates=  ['u1', 'u2', 'u3', 'cx']&lt;/code&gt; in your transpile call, you &lt;em&gt;might&lt;/em&gt; get something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sI8pZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sI8pZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-08T16:20:19.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15056" PostTypeId="2" ParentId="15048" CreationDate="2020-12-08T20:56:32.790" Score="3" Body="&lt;p&gt;Just want to add a small additional detail here that might be useful for future encounter.&lt;/p&gt;&#xA;&lt;p&gt;The reason why you see the circuit with only measurement after the transpilation process is because &lt;span class=&quot;math-container&quot;&gt;$(XY)^\dagger = Y^\dagger X^\dagger = -XY$&lt;/span&gt;. Since&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ XY = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix}\begin{pmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0 \end{pmatrix} = \begin{pmatrix} -i &amp;amp; 0\\ 0 &amp;amp; i \end{pmatrix}$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (XY)^\dagger = Y^\dagger X^\dagger =  \begin{pmatrix} 0 &amp;amp; -i\\ i &amp;amp; 0 \end{pmatrix}  \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} =  \begin{pmatrix} i &amp;amp; 0\\ 0 &amp;amp; -i \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now note that &lt;span class=&quot;math-container&quot;&gt;$(XY)(XY)^\dagger =I $&lt;/span&gt; because of definition of Unitary, and so &lt;span class=&quot;math-container&quot;&gt;$ XYXY = -XY(XY)^\dagger = -I $&lt;/span&gt; but in quantum computing, global phase doesn't matter, so &lt;span class=&quot;math-container&quot;&gt;$-I = I$&lt;/span&gt;... since there is no experiment you can do to distinguish &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$-|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, looking at your circuit, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$UXYXYU^\dagger = UXY[-(XY)^\dagger] U^\dagger = -[UXY(XY)^\dagger U^\dagger] = -[U I U^\dagger] = -[UU^\dagger] = -I \equiv I $$&lt;/span&gt;&lt;br /&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-08T20:56:32.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15057" PostTypeId="1" AcceptedAnswerId="15083" CreationDate="2020-12-08T21:28:08.163" Score="3" ViewCount="59" Body="&lt;p&gt;I've come across &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9511007.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Now what I assumed is that the measurement before the gate would have been made in the &lt;span class=&quot;math-container&quot;&gt;$\{|0⟩,|1⟩\}$&lt;/span&gt; basis and the measurement after the gate would have been made in the &lt;span class=&quot;math-container&quot;&gt;$\{|+⟩,|-⟩\}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;However, I came across these conflicting sources about the term &amp;quot;Computational Basis&amp;quot; regarding measurement:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Qubit#Standard_representation&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Wikipedia page&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1410/what-is-meant-by-the-term-computational-basis/1411#1411?newreg=3f4dda63599c4e4e924acc911c2a22d3&quot;&gt;this question&lt;/a&gt; in this stack exchange.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.quantum-inspire.com/kbase/qubit-basis-states/&quot; rel=&quot;nofollow noreferrer&quot;&gt;This site&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So my questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Does saying &amp;quot;measure in the computational basis&amp;quot; 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?&lt;/li&gt;&#xA;&lt;li&gt;If it is the latter then how does the claim hold when we know that &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle=\frac{1}{\sqrt 2}(|0⟩+|1⟩)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle=\frac{1}{\sqrt 2}(|0⟩-|1⟩)$&lt;/span&gt; so the probabilities of measuring an outcome after H should be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; regardless of the original state of the qubit?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14095" LastActivityDate="2020-12-10T11:13:11.893" Title="Measuring in the computational basis in the single qubit gate QFT implementation" Tags="&lt;measurement&gt;&lt;quantum-fourier-transform&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15058" PostTypeId="1" AcceptedAnswerId="15069" CreationDate="2020-12-08T21:34:11.570" Score="1" ViewCount="68" Body="&lt;p&gt;If we have a composite system over five qubits (&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |a\rangle|b\rangle|c\rangle|d\rangle|e\rangle$&lt;/span&gt;), and I want to project into a specific subspace of the first three systems, I can build a projector of the form &lt;span class=&quot;math-container&quot;&gt;$|011\rangle\langle011| \otimes I_{de}$&lt;/span&gt; (for example). Before projecting, state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be thought of as an array with length &lt;span class=&quot;math-container&quot;&gt;$2^5 = 32$&lt;/span&gt;. My goal is to do the projection &lt;em&gt;and&lt;/em&gt; 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 &amp;quot;011&amp;quot;). This is what I've done so far:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Since the projectors are diagonal, I convert the string &amp;quot;011&amp;quot; into an integer. In this case, it's 3. The corresponding matrix will look like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{pmatrix} .$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Because the subspace is like this, the identity matrix &lt;span class=&quot;math-container&quot;&gt;$I_{de}$&lt;/span&gt; will just be a matrix of size &lt;span class=&quot;math-container&quot;&gt;$2^2\times2^2$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$32\times32$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I have my state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the position of the 1 in my matrix above is given by &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and my state is an array called &lt;code&gt;psi&lt;/code&gt;, then I want to say that the projection is given by simply slicing my array as such:&#xA;&lt;code&gt;projected = psi[(2**2)p:(2**2)*(p+1)]&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="1923" LastEditorUserId="1939" LastEditDate="2020-12-10T08:53:19.037" LastActivityDate="2020-12-10T08:53:19.037" Title="How to project a composite system down into a smaller subspace in Python?" Tags="&lt;programming&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15059" PostTypeId="2" ParentId="15058" CreationDate="2020-12-08T22:30:56.993" Score="0" Body="&lt;p&gt;In your slicing, your taking the elements of the `integers' &lt;span class=&quot;math-container&quot;&gt;$\{4p, 4p+1, 4p+2, 4p+3\}$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$p = 3$&lt;/span&gt;, that's &lt;span class=&quot;math-container&quot;&gt;$\{12, 13, 14, 15\}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\{01100,01101,01110,01111\}$&lt;/span&gt; in binary - so that's definitely correct. However, this method breaks down if you want to project to any other qubits, for instance.&lt;/p&gt;&#xA;&lt;p&gt;This can be done fairly easy if you don't make the 'full' projector &lt;span class=&quot;math-container&quot;&gt;$|011\rangle \langle 011| \otimes I_{de}$&lt;/span&gt;, but just &lt;span class=&quot;math-container&quot;&gt;$\langle011|\otimes I_{de}$&lt;/span&gt;. Or, better yet, define the projector on any set of qubits you want:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Get some nice tools&#xA;from numpy import kron, mat, eye&#xA;&#xA;# Define the subspace to project to. &#xA;# You can also have higher-dimensional subspace by summing over a basis.&#xA;subspace_1 = np.mat([[1, 0]]) # Project on 0 state&#xA;subspace_2 = np.mat([[0, 1]]) # Project on 1 state&#xA;subspace_3 = np.mat([[0, 1]]) # Project on 1 state&#xA;subspace_4 = eye(2)           # Don't project here!&#xA;subspace_5 = eye(2)           # Don't project here!&#xA;&#xA;# Make the projector&#xA;# Quick and dirty, this can be coded more elegantly&#xA;sub12 = kron(subpace_1, subpace_2)&#xA;sub123 = kron(sub12, subpace_3)&#xA;sub1234 = kron(sub123, subpace_4)&#xA;projector = kron(sub1234, subpace_5)&#xA;&#xA;# Project&#xA;projected = matmul(projector, psi)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This method alows for more manageability. You can easily define the projector, for instance, for &lt;span class=&quot;math-container&quot;&gt;$|0+1\rangle_{123}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;subspace_1 = np.mat([[1, 0]])             # Project on 0 state&#xA;subspace_2 = (2)**(-1/2)*np.mat([[1, 1]]) # Project on + state&#xA;subspace_3 = np.mat([[0, 1]])             # Project on 1 state&#xA;subspace_4 = eye(2)                       # Don't project here!&#xA;subspace_5 = eye(2)                       # Don't project here!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or &lt;span class=&quot;math-container&quot;&gt;$|010\rangle_{145}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;subspace_1 = np.mat([[1, 0]]) # Project on 0 state&#xA;subspace_2 = eye(2)           # Don't project here!&#xA;subspace_3 = eye(2)           # Don't project here!&#xA;subspace_4 = np.mat([[0, 1]]) # Project on 1 state&#xA;subspace_5 = np.mat([[1, 0]]) # Project on 0 state&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-12-08T22:30:56.993" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15061" PostTypeId="1" AcceptedAnswerId="15065" CreationDate="2020-12-09T01:20:52.837" Score="8" ViewCount="559" Body="&lt;p&gt;I was reading a book and then I found this statement. I will put the text as well as a screenshot of the text.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The expectation value of an operator is the mean or average value of that operator&#xA;with respect to a given quantum state. In other words, we are asking the following&#xA;question: If a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is prepared many times, and we measure a given&#xA;operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; each time, what is the average of the measurement results?&#xA;This is the expectation value and we write this as&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle A\rangle    =\langle  ψ|A|ψ \rangle$&lt;/span&gt; (3.39)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here is the screenshot,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SVHGk.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SVHGk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2020-12-11T08:46:48.463" LastActivityDate="2020-12-11T14:11:41.253" Title="What does it mean to &quot;measure an operator&quot;?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15062" PostTypeId="2" ParentId="15061" CreationDate="2020-12-09T02:43:28.750" Score="3" Body="&lt;p&gt;In this case, &amp;quot;measuring an operator&amp;quot; is meant to describe measuring the observable associated with the operator. More commonly one would put a &amp;quot;using&amp;quot; or &amp;quot;with&amp;quot; or &amp;quot;with respect to&amp;quot; between &amp;quot;measure&amp;quot; and &amp;quot;a given operator&amp;quot;. 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 &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; being associated with an eigenvalue of 1 and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt; being associated with an eigenvalue of -1, and the Pauli X operator is similarly associated with the Hadamard basis, to name two.&lt;/p&gt;&#xA;&lt;p&gt;The reason the expectation value for this is given by &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi\right|A\left|\psi\right&amp;gt;$&lt;/span&gt; can be seen through noticing what happens when &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; acts on each of its associated eigenstates, which &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; is in general in a superposition of. For the finite case, with the set of eigenvalues of the operator being denoted &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, you can represent the quantum state as &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \sum_{\lambda \in S}a_\lambda\left|s{_\lambda}\right&amp;gt;$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A\left|s_{\lambda}\right&amp;gt; = \lambda\left|s_{\lambda}\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_\lambda$&lt;/span&gt; are the associated probability amplitudes. Then &lt;span class=&quot;math-container&quot;&gt;$A\left|\psi\right&amp;gt; = \sum_{\lambda \in S} \lambda a_\lambda \left|s_\lambda\right&amp;gt;$&lt;/span&gt;. With &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi\right| = \sum_{\lambda \in S}\bar a_\lambda\ \left&amp;lt;s_\lambda\right|$&lt;/span&gt; and all the different &lt;span class=&quot;math-container&quot;&gt;$\left|s_\lambda\right&amp;gt;$&lt;/span&gt; being orthogonal, we get &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi\right|A\left|\psi\right&amp;gt; = \sum_{\lambda \in S} \lambda a_\lambda \bar a_\lambda$&lt;/span&gt;. With the probability amplitudes multiplied by their complex conjugates being the probability of measurement, this is the traditional expected value formula.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2020-12-11T14:11:41.253" LastActivityDate="2020-12-11T14:11:41.253" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15063" PostTypeId="1" AcceptedAnswerId="15072" CreationDate="2020-12-09T03:38:03.110" Score="1" ViewCount="84" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14100" LastEditorUserId="55" LastEditDate="2020-12-11T08:49:32.963" LastActivityDate="2020-12-11T08:49:32.963" Title="Does Cirq support GPU acceleration?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15064" PostTypeId="1" CreationDate="2020-12-09T04:15:37.247" Score="1" ViewCount="78" Body="&lt;pre&gt;&lt;code&gt;qiskit.providers.ibmq.exceptions.IBMQBackendApiError: 'Error submitting job:....&#xA;&#xA;(Caused by SSLError(SSLError(1, \'[SSL: &#xA;WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)....&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I used a basic Qiskit tutorial within a Conda environment, Python3.7, Ubuntu 18.&#xA;The was no problem getting it to load account with token and display the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ibmq_qasm_simulator has 0 queued and simulated qubits&#xA;ibmqx2 has 241 queued and 5 qubits&#xA;ibmq_16_melbourne has 3681 queued and 15 qubits&#xA;ibmq_vigo has 393 queued and 5 qubits&#xA;ibmq_ourense has 507 queued and 5 qubits&#xA;ibmq_valencia has 0 queued and 5 qubits&#xA;ibmq_armonk has 3 queued and 1 qubits&#xA;ibmq_athens has 13 queued and 5 qubits&#xA;ibmq_santiago has 17 queued and 5 qubits&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is the section of code which generated the error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.tools.monitor import job_monitor&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;config = backend.configuration()&#xA;job = q.execute(circuit, backend, shots=10)&#xA;job_monitor(job)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QisKit Version:&#xA;qiskit-terra: 0.16.1&#xA;qiskit-aer: 0.7.1 &#xA;qiskit-ignis: 0.5.1 &#xA;qiskit-ibmq-provider: 0.11.1&#xA;qiskit-aqua: 0.8.1 &#xA;qiskit: 0.23.1 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14101" LastEditorUserId="14101" LastEditDate="2020-12-09T14:21:39.887" LastActivityDate="2020-12-09T14:21:39.887" Title="IBMQ qiskit SSL error submitting job" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2020-12-09T14:21:56.453" ContentLicense="CC BY-SA 4.0" />
  <row Id="15065" PostTypeId="2" ParentId="15061" CreationDate="2020-12-09T07:54:22.377" Score="8" Body="&lt;p&gt;Any operator Hermitian &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be described using its eigenvalue decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\sum_\lambda\lambda P_\lambda,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\{\lambda\}$&lt;/span&gt; are the distinct eigenvalues and &lt;span class=&quot;math-container&quot;&gt;$P_{\lambda}$&lt;/span&gt; are the projectors onto the corresponding eigenspaces. So, to talk about measuring an operator means to make a measurement using the basis &lt;span class=&quot;math-container&quot;&gt;$\{P_{\lambda}\}$&lt;/span&gt;. It also assigns a label of &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; to an outcome from the projector &lt;span class=&quot;math-container&quot;&gt;$P_{\lambda}$&lt;/span&gt; and, since this is a numerical value, you can ask for the expected value of that number. For an initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; you get answer &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|P_\lambda|\psi\rangle$&lt;/span&gt;, so the expected value is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{\lambda}\lambda\langle\psi|P_\lambda|\psi\rangle=\langle\psi|A|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-09T07:54:22.377" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15066" PostTypeId="1" AcceptedAnswerId="15081" CreationDate="2020-12-09T12:12:45.743" Score="-2" ViewCount="65" Body="&lt;p&gt;I read &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2299/how-to-interpret-a-quantum-circuit-as-a-matrix?newreg=8e691487c9aa473299aa562079d1280a&quot;&gt;here&lt;/a&gt; that we use matrices to represent quantum logical gates.&lt;/p&gt;&#xA;&lt;p&gt;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. &lt;br&gt;I want to understand how to build matrices with quantum logical gates as real quantum circuits.&lt;br&gt;&lt;br&gt;&#xA;In other words, we let's start with some physical quantum logical gates and we want to build a matrix with those circuits.&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can you give me some material explaining how to build a Hilbert space with quantum circuits?&lt;/p&gt;&#xA;" OwnerUserId="14110" LastActivityDate="2020-12-11T08:20:52.453" Title="How to build a Hilbert space when do we already have concrete quantum logic gates available?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15067" PostTypeId="2" ParentId="15064" CreationDate="2020-12-09T13:14:56.043" Score="1" Body="&lt;p&gt;This is duplicate of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14824/error-while-trying-to-execute-the-quantum-circuits-in-ibmq&quot;&gt;Error while trying to execute the Quantum Circuits in IBMQ&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My answer from the other post:&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;a href=&quot;https://howtoremove.guide/safebrowse-io-virus/#:%7E:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://howtoremove.guide/safebrowse-io-virus/#:~:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2020-12-09T13:14:56.043" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15068" PostTypeId="2" ParentId="15031" CreationDate="2020-12-09T14:05:31.300" Score="2" Body="&lt;p&gt;The key point is that two &lt;em&gt;different&lt;/em&gt; ensembles can give rise to the &lt;em&gt;same&lt;/em&gt; density matrix. And, given knowledge of only the density matrix, we cannot assign a unique ensemble to it.&lt;/p&gt;&#xA;&lt;p&gt;Let's consider a simple example, the density matrix corresponding to the maximally mixed state for a qubit is &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathbb{I}}{2}$&lt;/span&gt;, which can be expressed via two different ensembles, say,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\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  - | .&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Should we, then, think of the state &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathbb{I}}{2}$&lt;/span&gt; as states &lt;span class=&quot;math-container&quot;&gt;$\{ | 0 \rangle, | 1 \rangle \}$&lt;/span&gt; with equal probability or states &lt;span class=&quot;math-container&quot;&gt;$\{ | + \rangle, \{ - \} \}$&lt;/span&gt; with equal probability? The point is, we cannot distinguish these two ensembles.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;infinitely&lt;/em&gt; many ensembles that correspond to the density matrix &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathbb{I}}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\left|\tilde{\psi}_{i}\right\rangle=\sum_{j} u_{i j}\left|\tilde{\varphi}_{j}\right\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$u_{ij}$&lt;/span&gt; is a unitary.&lt;/p&gt;&#xA;" OwnerUserId="1108" LastActivityDate="2020-12-09T14:05:31.300" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15069" PostTypeId="2" ParentId="15058" CreationDate="2020-12-09T15:22:50.057" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;def return_indices(subspace):&#xA;    n_qubits = len(subspace)&#xA;    indices = np.array(range(32)).reshape((2,)*n_qubits)&#xA;    output_indices = indices[subspace].reshape(-1)&#xA;    return output_indices&#xA;&#xA;# building a test psi to see if the code works well&#xA;psi = np.zeros(32, dtype=np.complex)&#xA;psi[12:16] = list(range(1,5))&#xA;&#xA;# representing the subspace that we would like to project on&#xA;subspace = (0,1,1,slice(0,2),slice(0,2))&#xA;&#xA;output_indices = return_indices(subspace) #returns array([12, 13, 14, 15])&#xA;&#xA;psi[output_indices] #returns array([1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j])&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I also ran another test, by taking&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;subspace2 = (1,0,slice(0,2),1,slice(0,2))&#xA;output_indices2 = return_indices(subspace2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then output_indices2 is &lt;code&gt;array([18, 19, 22, 23])&lt;/code&gt;, as it should.&lt;/p&gt;&#xA;&lt;p&gt;Edit: In case you are interested in projecting on the subspace where the first qubit is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, the second qubit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and the third quibit is &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt;, then you can simply use linear superposition. Indeed, this is &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt; times the projection of the state on the &lt;span class=&quot;math-container&quot;&gt;$|010::\rangle$&lt;/span&gt; subspace plus &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt{2}$&lt;/span&gt; times the projection of the state on the &lt;span class=&quot;math-container&quot;&gt;$|011::\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; state. However, the code is written assuming you are mostly interested in &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; states.&lt;/p&gt;&#xA;" OwnerUserId="14062" LastEditorUserId="14062" LastEditDate="2020-12-09T22:17:35.380" LastActivityDate="2020-12-09T22:17:35.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15070" PostTypeId="1" AcceptedAnswerId="15111" CreationDate="2020-12-09T17:35:25.530" Score="4" ViewCount="146" Body="&lt;p&gt;In the HHL algorithm, how do you efficiently do the &lt;span class=&quot;math-container&quot;&gt;$\lambda-$&lt;/span&gt;controlled rotation on the ancillary qubit ? It seems to me after reading around some answers that this can be done in two steps :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First, we map &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle\mapsto |\frac{1}{\pi}\arcsin(\frac{C}{\lambda})\rangle$&lt;/span&gt;, defining &lt;span class=&quot;math-container&quot;&gt;$|\frac{1}{\pi}\arcsin(\frac{C}{\lambda})\rangle$&lt;/span&gt; to be a binary representation &lt;span class=&quot;math-container&quot;&gt;$|\frac{1}{\pi}\arcsin(\frac{C}{\lambda})\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits.&lt;/li&gt;&#xA;&lt;li&gt;Then perform a controlled rotation &lt;span class=&quot;math-container&quot;&gt;$U_y(|\theta\rangle \otimes |0\rangle)\mapsto |\theta\rangle \otimes \big(\cos(\theta)|0\rangle + \sin{(\theta})|1\rangle\big)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U_y$&lt;/span&gt; is simply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_y(|\theta\rangle \otimes |0\rangle) = \prod_{j=1}^m (I^{\otimes^m}\otimes R_y(2\pi\theta_j/2^j))&#xA;$$&lt;/span&gt;&#xA;i.e.  a sequence of controlled rotations where we successively halve the angle of rotation conditionally of the digits of the binary representation of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;My question is the following how can one implement efficiently the first step in an environment such as Qiskit ?&lt;/p&gt;&#xA;" OwnerUserId="14113" LastEditorUserId="55" LastEditDate="2020-12-11T08:49:48.470" LastActivityDate="2020-12-11T12:24:55.697" Title="How to effectively compute eigenvalue rotation in HHL" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15071" PostTypeId="1" CreationDate="2020-12-09T18:35:01.510" Score="5" ViewCount="77" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Do I misunderstand sth?&lt;/p&gt;&#xA;" OwnerUserId="14115" LastEditorUserId="55" LastEditDate="2020-12-11T08:50:06.540" LastActivityDate="2020-12-11T08:50:06.540" Title="In quantum computation, if the fidelity is high enough to promise over 50% success rate, is quantum error-correction still needed?" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15072" PostTypeId="2" ParentId="15063" CreationDate="2020-12-09T21:24:02.730" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://github.com/quantumlib/Cirq&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt;'s mainline doesn't have this but you can use &lt;a href=&quot;https://github.com/qulacs/cirq-qulacs&quot; rel=&quot;nofollow noreferrer&quot;&gt;cirq-qulacs&lt;/a&gt;; which has a Variational Quantum Circuit Simulator and supports CUDA for high performance simulation.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2020-12-09T21:30:43.620" LastActivityDate="2020-12-09T21:30:43.620" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15073" PostTypeId="1" CreationDate="2020-12-09T21:50:57.070" Score="2" ViewCount="99" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IlnuO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IlnuO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why am I getting here a measurement outcome of &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;? I measure after the first &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate in a separate output bit &lt;code&gt;c[1]&lt;/code&gt; which should result in a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and I measure again after a second &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate in a separate output bit &lt;code&gt;c[0]&lt;/code&gt; which should result in a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; in total. Why do I get the output &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt; as if both measurements are performed after the whole circuit? And how can I do intermediate measurements as expected?&lt;/p&gt;&#xA;" OwnerUserId="14117" LastEditorUserId="55" LastEditDate="2020-12-11T08:50:44.123" LastActivityDate="2020-12-11T08:50:44.123" Title="IBM quantum experience: Why are intermediate measurements ignored?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15074" PostTypeId="2" ParentId="15073" CreationDate="2020-12-09T22:33:18.717" Score="0" Body="&lt;p&gt;The first measurement is not being ignored.&lt;/p&gt;&#xA;&lt;p&gt;Your quantum state started in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and after the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, it is now in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Measuring the qubit collapsed it into the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; again... since &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is already an eigenvector of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; Pauli operator.&lt;/p&gt;&#xA;&lt;p&gt;So your state never changes after the first measurement, you still in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Thus, after applying another &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, you get back to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. That is the reason why you only see &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is being measured.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; My comment about the first measurement &lt;strong&gt;&amp;quot;not&amp;quot;&lt;/strong&gt; being ignored when looking at the measurement probabilities is &lt;strong&gt;incorrect&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, the first measurement is not being ignore in the experiment overall...  That is, say you start in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then apply Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to it, make a measurement, apply another Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and then make another measurement. If the first measurement is being ignored, then you would get back &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.. but in fact we don't:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VpmkW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VpmkW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, if you put the first measurement in the first cbit&lt;a href=&quot;https://i.stack.imgur.com/VpmkW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;1&lt;/a&gt; and the second measurement on the second cbit&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html#real_qc&quot; rel=&quot;nofollow noreferrer&quot;&gt;2&lt;/a&gt; then you get something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ON1IK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ON1IK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html#real_qc&quot; rel=&quot;nofollow noreferrer&quot;&gt;can't perform any additional operations&lt;/a&gt; after the first measurement.&lt;/p&gt;&#xA;&lt;p&gt;Another note is that if you do this in the circuit composer environment, you get something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YG1Ps.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YG1Ps.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-10T16:41:31.320" LastActivityDate="2020-12-10T16:41:31.320" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15075" PostTypeId="2" ParentId="15071" CreationDate="2020-12-10T01:09:11.477" Score="4" Body="&lt;p&gt;The comments said well. There is a difference between quantum error correction and your idea.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0034-4885/76/7/076001&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum error correction for beginners&lt;/a&gt;, 10.4.).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit case into a &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt;-qubit case?&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-12-10T01:09:11.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15076" PostTypeId="1" AcceptedAnswerId="15077" CreationDate="2020-12-10T01:53:07.100" Score="6" ViewCount="170" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JsNE7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JsNE7.png&quot; alt=&quot;Simple quantum circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4197" LastEditorUserId="55" LastEditDate="2020-12-11T08:54:11.950" LastActivityDate="2020-12-11T08:54:11.950" Title="Trying to understand this measurement of a simple quantum circuit" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;measurement&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15077" PostTypeId="2" ParentId="15076" CreationDate="2020-12-10T03:06:29.553" Score="7" Body="&lt;p&gt;You can think of the circuit operation as follows. Remembering that for Hadamard matrix: &lt;span class=&quot;math-container&quot;&gt;$H \times H = \mathbb{I}$&lt;/span&gt;, your circuit looks like the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \otimes \mathbb{I} \otimes \mathbb{I}(CCNOT(H|0\rangle \otimes H|0\rangle \otimes |0\rangle ))&#xA;$$&lt;/span&gt;&#xA;Let's focus on the inner-most part first:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|0\rangle \otimes H|0\rangle \otimes |0\rangle \\&#xA;=\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes |0\rangle \\&#xA;= \frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |110\rangle).&#xA;$$&lt;/span&gt;&#xA;Now, the action of &lt;span class=&quot;math-container&quot;&gt;$CCNOT$&lt;/span&gt; gate is that, if the first two qubits are &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then the third qubit would be flipped. But notice that in the above state, only the last term has two &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s in it, i.e. the &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; term. So, the action of &lt;span class=&quot;math-container&quot;&gt;$CCNOT$&lt;/span&gt; on the above state would be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CCNOT(\frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |110\rangle)) \\&#xA;= \frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |111\rangle). &#xA;$$&lt;/span&gt;&#xA;Now we apply the Hadamard matrix on the first qubit only:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H \otimes \mathbb{I} \otimes \mathbb{I}(\frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |111\rangle)) \\&#xA;= \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)).&#xA;$$&lt;/span&gt;&#xA;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.&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="2403" LastEditDate="2020-12-10T07:06:42.970" LastActivityDate="2020-12-10T07:06:42.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15079" PostTypeId="2" ParentId="15073" CreationDate="2020-12-10T09:11:54.520" Score="3" Body="&lt;p&gt;The problem is that IBM Q shows results of measurement of a final quantum state (&lt;em&gt;I found this after some trial and error&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;When you apply first &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, qubits switches from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. The measurement result is of course 1 and this value is stored in classical register, hence you see 10 in &lt;em&gt;Measurement probabilities&lt;/em&gt; window.&lt;/p&gt;&#xA;&lt;p&gt;Now you apply another &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate and this switches your qubit back to state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. So, after measurement you see 0 in classical register. As I mentioned above, only final state probabilities is shown &lt;em&gt;Measurement probabilities&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-10T09:11:54.520" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15080" PostTypeId="2" ParentId="14785" CreationDate="2020-12-10T09:26:44.933" Score="1" Body="&lt;p&gt;I assume that you have a qubit register &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; and given that the state of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; you want to apply &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=0,1,2$&lt;/span&gt;. If this is what you wish to do, then unfortunately if the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;'s are not orthogonal to each other, then this kind of operations are not possible in a quantum setting in for any general &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;'s. This is not possible because such an operator is not unitary. For instance take the simple case of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; being in either the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; and I wish to apply &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; if it is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; if the state of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;. This mathematically would mean that I need an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that works as follows: &lt;span class=&quot;math-container&quot;&gt;$$U|0\rangle=|0\rangle \text{ and } U|+\rangle = \frac{1}{\sqrt{2}}(U|0\rangle + U|1\rangle) =|0\rangle.$$&lt;/span&gt; It is quite obvious that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not reversible and hence is not a unitary. So such a quantum operation does not exist.&lt;/p&gt;&#xA;&lt;p&gt;However, if the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;'s are orthogonal to each other and the state in &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; of your choice.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-10T09:26:44.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15081" PostTypeId="2" ParentId="15066" CreationDate="2020-12-10T09:29:14.300" Score="1" Body="&lt;p&gt;The Hilbert space in quantum computation is used to express quantum states. In particular, they are vectors in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C} ^ {2^n}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is number of qubits the state is composed of. Any mapping from one state to another one is expressed by a unitary matrix.&#xA;This is (a very rough) description of basics behind mathematical model of quantum computation.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Hope this helps, as the question is a little bit unclear.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so input-output map has this form:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle \rightarrow |00\rangle$&lt;/span&gt; (control in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, target is not negated)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle \rightarrow |01\rangle$&lt;/span&gt; (control in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, target is not negated)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle \rightarrow |11\rangle$&lt;/span&gt; (control in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, target is negated)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle \rightarrow |10\rangle$&lt;/span&gt; (control in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, target is negated)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Since&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle = \begin{pmatrix}1 \\ 0 \\ 0 \\ 0 \end{pmatrix}&#xA;|01\rangle = \begin{pmatrix}0 \\ 1 \\ 0 \\ 0 \end{pmatrix}&#xA;|10\rangle = \begin{pmatrix}0 \\ 0 \\ 1 \\ 0 \end{pmatrix}&#xA;|11\rangle = \begin{pmatrix}0 \\ 0 \\ 0 \\ 1 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;a matrix describing CNOT gate is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;i.e. outputs are simply put one beside another. The first column of the matrix represent reactio of the gate on &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; input, second reaction on &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; etc.&lt;/p&gt;&#xA;&lt;p&gt;Concerning software, I use IBM Q Experience environment and Qiskit language.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2020-12-11T08:20:52.453" LastActivityDate="2020-12-11T08:20:52.453" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15082" PostTypeId="2" ParentId="15071" CreationDate="2020-12-10T10:21:46.960" Score="2" Body="&lt;p&gt;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 &lt;strong&gt;very&lt;/strong&gt; low one could, in principle, do without this extra layer of suppressions.&lt;/p&gt;&#xA;&lt;p&gt;However, as already pointed out, the scaling is exponential: for (an unphysical picture of) uncorrelated layers in the computation (let's say &lt;span class=&quot;math-container&quot;&gt;$\sim 10000$&lt;/span&gt;), with an error rate of &lt;span class=&quot;math-container&quot;&gt;$p = 10^{-2}$&lt;/span&gt;, the probability of no error happening is &lt;span class=&quot;math-container&quot;&gt;$(1-p)^{10000} ~= 10^{-42}$&lt;/span&gt;. That's not a lot.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;QECC's generally suppress the error rate with an exponential factor of &lt;span class=&quot;math-container&quot;&gt;$2-3$&lt;/span&gt;; so we get &lt;span class=&quot;math-container&quot;&gt;$(1-p^{2})^{10000} \sim  (1-p^{3})^{10000} = 0.37 \sim 0.99$&lt;/span&gt;. That is a tremendous improvement.&lt;/p&gt;&#xA;&lt;p&gt;Remember, some computations that QC's are envisioned to perform are &lt;strong&gt;even hard to validate&lt;/strong&gt;. Consider, for instance, some very big Hamiltonian, of which we ask the QC to give us its ground state energy. We have &lt;em&gt;no way&lt;/em&gt; of checking, with a classical computer, if any returned answer even &lt;strong&gt;is&lt;/strong&gt; the ground state.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-12-10T10:21:46.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15083" PostTypeId="2" ParentId="15057" CreationDate="2020-12-10T11:13:11.893" Score="1" Body="&lt;p&gt;Measuring in the 'Computational Basis' always means to measure in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}^n$&lt;/span&gt; basis for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;As for your second question, I feel that you misinterpreted the author. It is certainly true that on applying the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; you would get the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with equal probabilities. But the underlying idea is this: let &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; be a qubit in the circuit given in the paper. Let &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; many gates are applied on &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. For some &lt;span class=&quot;math-container&quot;&gt;$k\le m$&lt;/span&gt;, see that if only the first &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; gates actually transform the state of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; (by some rotation) and if for the rest of the &lt;span class=&quot;math-container&quot;&gt;$m-k$&lt;/span&gt; gates &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; just acts as a control qubit, then the last &lt;span class=&quot;math-container&quot;&gt;$m-k$&lt;/span&gt; gates cannot change the state of &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;. So, if the probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on measuring the qubit &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; was &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; before applying the last &lt;span class=&quot;math-container&quot;&gt;$m-k$&lt;/span&gt; gates, then even after applying the &lt;span class=&quot;math-container&quot;&gt;$m-k$&lt;/span&gt; gates, the probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on measuring &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; remains &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lfYQx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lfYQx.png&quot; alt=&quot;GHZ Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this circuit, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; just after the first gate, you would get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with equal probabilities. But if you measure &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; after all the gates have been applied, the probabilities of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; still remain the same.&lt;/p&gt;&#xA;&lt;p&gt;Next, notice that the output of this circuit is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$&lt;/span&gt;. So you get the states &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; just after &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, then apply an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; only if the measured outcome of &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is 1 and then measure the qubits &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. Now, if the measurement of &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then the other two gates have no effect on &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. So after the final measurement, the complete measured state would be &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;. Similarly, if the measurement of &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then the other two gates flips the qubit state in &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;. So after the final measurement, the complete measured state would be &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;. Now, if you perform this for some &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; times, then for an expected &lt;span class=&quot;math-container&quot;&gt;$d/2$&lt;/span&gt; times you obtain &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; during the first measurement and so obtain &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; as the final measurement and for an expected &lt;span class=&quot;math-container&quot;&gt;$d/2$&lt;/span&gt; times you obtain &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; during the first measurement and so obtain &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-10T11:13:11.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15084" PostTypeId="1" CreationDate="2020-12-10T11:57:22.970" Score="2" ViewCount="104" Body="&lt;p&gt;Consider a system composed of two subsystems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; living in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}=\mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt;. The density matrix of the system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; is defined to be &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. The entanglement negativity of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{N}_A(\rho) := \frac12(\|\rho^{T_A}\|_1 -1),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A}$&lt;/span&gt; is the partial transposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|_1$&lt;/span&gt; is the trace norm, measures by how much &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A}$&lt;/span&gt; fails to be positive semidefinite. This is useful since would &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be separable, &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A}$&lt;/span&gt; would be positive semidefinite, hence &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_A(\rho)=0$&lt;/span&gt;. This, along with some other nice properties makes &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; a nice entanglement measure.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I have read that if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_A(\rho)\neq 0$&lt;/span&gt; then one can claim &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is entangled with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. This is what I don’t understand. By definition, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_A(\rho)$&lt;/span&gt; measures by how much &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A}$&lt;/span&gt; fails to be positive semidefinite, an essential property of a separable and hence a non-entangled system. Great, we know whether &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is entangled or not. However, just because we are told &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is entangled it doesn’t necessarily mean that the degrees of freedom in &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; are entangled with those in &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; right? I guess my problem could steem from the fact that I don’t understand the physical consequences of taking a partial transpose of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; w.r.t. some subsystem (i.e. what is the physical significance of &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A}$&lt;/span&gt;?).&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14122" LastEditorUserId="10480" LastEditDate="2021-03-26T04:42:26.860" LastActivityDate="2021-03-26T04:42:26.860" Title="In a bipartite system $AB$, why does the entanglement negativity $\mathcal{N}(\rho^{T_A})$ measure the entanglement between $A$ and $B$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;partial-transpose&gt;&lt;entanglement-negativity&gt;" AnswerCount="1" CommentCount="13" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15085" PostTypeId="2" ParentId="14961" CreationDate="2020-12-10T12:20:43.433" Score="0" Body="&lt;p&gt;After thinking about it ... I came up with a peculiar answer. Consider the problem in density matrix formulation. We are given:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle \hat O^s \rangle = \text{Tr } \rho \hat O^s $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us write in terms of eigenvalues &lt;span class=&quot;math-container&quot;&gt;$ O_i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\hat O$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \langle  \hat O^s \rangle = \sum_{i,j =1}^N \rho_{i,j} O_j^s $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us scalar multiply with a constant &lt;span class=&quot;math-container&quot;&gt;$k_0$&lt;/span&gt; raise to the power &lt;span class=&quot;math-container&quot;&gt;$1/s$&lt;/span&gt; and take limit &lt;span class=&quot;math-container&quot;&gt;$s \to \infty$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \lim_{s \to \infty}\langle k_0 \hat O^s \rangle^{1/s}  = \begin{cases} &#xA;      O_{max} &amp;amp; k_0 \sum_{i=1}^N \rho_{i,max} \geq 1  \\&#xA;      0  &amp;amp; \text{otherwise}  &#xA;   \end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To convince yourself of the above consider the toy version with &lt;span class=&quot;math-container&quot;&gt;$s \to \infty$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$a&amp;gt; b&amp;gt;1$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \lim_{s \to \infty}(a5^s + b3^s)^{1/s}  = 5$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us assume we are lucky or finetune &lt;span class=&quot;math-container&quot;&gt;$k_0$&lt;/span&gt; and do not get &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Now to get the next eigenvalue we can subtract by &lt;span class=&quot;math-container&quot;&gt;$ (k_1 O_{max})^s$&lt;/span&gt;. Then we will fine tune &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; such that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \lim_{s \to \infty} (  \langle k_0 \hat O^s \rangle - (k_0 k_1 O_{max})^s )^{1/s}  = \begin{cases} &#xA;      O_{max - 1} &amp;amp; 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}  \\&#xA;      0  &amp;amp; \text{otherwise}  &#xA;   \end{cases} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Keep repeating until all eigenvalues are found and all summation of columns (out of order) of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are found. The columns must be now arranged in a way such that &lt;span class=&quot;math-container&quot;&gt;$\text{ Tr} \rho = 1$&lt;/span&gt;. I suspect this is the best we can do&lt;/p&gt;&#xA;" OwnerUserId="5045" LastActivityDate="2020-12-10T12:20:43.433" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15086" PostTypeId="2" ParentId="15084" CreationDate="2020-12-10T13:14:41.670" Score="4" Body="&lt;p&gt;There is no good definition of what is an &amp;quot;amount of entanglement&amp;quot;. 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.&lt;/p&gt;&#xA;&lt;p&gt;There is a nice interpretation of entanglement negativity, though, in the case that &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A}$&lt;/span&gt; only has a single negative eigenvalue. Let it be &lt;span class=&quot;math-container&quot;&gt;$-\lambda$&lt;/span&gt;. Then by construction &lt;span class=&quot;math-container&quot;&gt;$\mathcal N(\rho) = \lambda$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$d\mathcal N(\rho)$&lt;/span&gt; almost coincides with the amount of white noise you must add to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; before it becomes separable.&lt;/p&gt;&#xA;&lt;p&gt;This is another measure of entanglement, called random robustness, defined more precisely as &lt;span class=&quot;math-container&quot;&gt;$R(\rho)$&lt;/span&gt; being the minimal &lt;span class=&quot;math-container&quot;&gt;$s \ge 0$&lt;/span&gt; such that the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho' = \frac1{1+s}(\rho + s I/d)$$&lt;/span&gt;&#xA;is separable.&lt;/p&gt;&#xA;&lt;p&gt;I'm saying almost because &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_A} \ge 0$&lt;/span&gt; in general does not imply that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is separable. But in the cases when it does, &lt;span class=&quot;math-container&quot;&gt;$R(\rho)$&lt;/span&gt; is the minimal &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$${\rho'}^{T_A} = \frac1{1+s}(\rho^{T_A} + s I/d) \ge 0,$$&lt;/span&gt; which is precisely &lt;span class=&quot;math-container&quot;&gt;$d\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;More generally, I don't know any nice interpretation for entanglement negativity.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastEditorUserId="12541" LastEditDate="2020-12-10T15:59:57.380" LastActivityDate="2020-12-10T15:59:57.380" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="15087" PostTypeId="1" AcceptedAnswerId="15088" CreationDate="2020-12-10T17:13:47.513" Score="1" ViewCount="33" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;probsu = []&#xA;circuits = []&#xA;&#xA;for i in range(len(Variable)):&#xA;    circuit =  QuantumCircuit(qrz,crz)&#xA;    circuit =  qc(Variable[i])&#xA;    circuits.append(circuit)&#xA;    prob = counts['1001'] / sum(counts.values()) **Issue here**&#xA;    probsu.append(prob)                          **Issue here**&#xA;&#xA;circuits = transpile(circuits, backend=backend) &#xA;job_manager = IBMQJobManager()&#xA;MyExperiments = job_manager. run(circuits, backend=backend, name='MyExperiment')&#xA;results = MyExperiments.results()&#xA;counts = results.get_counts(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2020-12-10T17:57:37.937" Title="How can I resolve this get_count issue from running multiple circuits?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15088" PostTypeId="2" ParentId="15087" CreationDate="2020-12-10T17:45:27.253" Score="1" Body="&lt;p&gt;You &lt;em&gt;mean&lt;/em&gt; something like this?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, QuantumRegister,  IBMQ, ClassicalRegister&#xA;from qiskit.circuit import QuantumCircuit, ParameterVector&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.providers.ibmq.managed import IBMQJobManager&#xA;from qiskit.visualization import *&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;&#xA;def qc(Variable):&#xA;    var_form = QuantumCircuit(2,2)&#xA;    var_form.ry(Variable,0)&#xA;    var_form.cx(0,1) &#xA;    var_form.h(1)&#xA;    var_form.measure([0,1],[0,1])&#xA;    return var_form&#xA;&#xA;Variables = [1,2,3,4,5]&#xA;circuits = []&#xA;for i in range(len(Variables) ):&#xA;    circuit =  QuantumCircuit(2,2)&#xA;    circuit = qc(Variables[i])&#xA;    circuits.append( circuit   )&#xA;&#xA;&#xA;circuits = transpile(circuits, backend=backend) &#xA;job_manager = IBMQJobManager()&#xA;MyExperiments = job_manager.run(circuits, backend=backend, shots =1000, name='MyExperiment')&#xA;results = MyExperiments.results()&#xA;&#xA;probsu = []&#xA;for i in range(len(Variables) ):&#xA;    prob = results.get_counts(i)['11']/sum( results.get_counts(i).values() ) &#xA;    probsu.append(prob) &#xA;print('probability of getting |11&amp;gt; at each circuit:', probsu)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which generate the output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;probability of getting |11&amp;gt; at each circuit: [0.121, 0.33, 0.458, 0.417, 0.178]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the output above corresponds to the probabilities of reading out &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; on each of the 5 circuits... You can modify this circuit to your purpose... as this is only an example.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-10T17:57:37.937" LastActivityDate="2020-12-10T17:57:37.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15089" PostTypeId="1" AcceptedAnswerId="15091" CreationDate="2020-12-10T19:20:42.570" Score="5" ViewCount="80" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_{A\rightarrow B}$&lt;/span&gt; be a quantum channel and consider its &lt;span class=&quot;math-container&quot;&gt;$n-$&lt;/span&gt;fold tensor product &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes n}_{A^n\rightarrow B^n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Any isometry &lt;span class=&quot;math-container&quot;&gt;$V_{A\rightarrow BE}$&lt;/span&gt; that satisfies &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_E(V\rho V^\dagger) = \mathcal{E}(\rho)$&lt;/span&gt; can be used to construct a Stinespring dilation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes n}$&lt;/span&gt;. Indeed, a valid Stinespring dilation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes n}$&lt;/span&gt; is simply &lt;span class=&quot;math-container&quot;&gt;$V^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there any other Stinespring dilation of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}^{\otimes n}$&lt;/span&gt; that has a smaller environment size than &lt;span class=&quot;math-container&quot;&gt;$|E|^n$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2020-12-11T08:55:29.387" LastActivityDate="2020-12-11T08:55:29.387" Title="Stinespring dilation: Size of environment" Tags="&lt;quantum-operation&gt;&lt;tensor-product&gt;&lt;information-theory&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15091" PostTypeId="2" ParentId="15089" CreationDate="2020-12-10T20:38:19.507" Score="7" Body="&lt;p&gt;No.&lt;/p&gt;&#xA;&lt;p&gt;The minimal size of the environment is just the rank of the Choi matrix of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;, call it &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal E)$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal E^{\otimes n}) = \big(J(\mathcal E)\big)^{\otimes n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{rank}(A \otimes B) = \text{rank}(A)\text{rank}(B)$&lt;/span&gt;, the minimal size of the environment is just &lt;span class=&quot;math-container&quot;&gt;$\text{rank}\big(J(\mathcal E)\big)^n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-12-10T20:38:19.507" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15092" PostTypeId="1" CreationDate="2020-12-10T22:27:08.673" Score="4" ViewCount="56" Body="&lt;p&gt;In Neilsen and Chuang, chapter 4.5.2 (~p.193), why did the authors come to the conclusion that complexity of operations &lt;span class=&quot;math-container&quot;&gt;$C^n(X)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C^n(\tilde{U})$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/UkchT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UkchT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;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?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; using no work qubits:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/z7rwq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z7rwq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13812" LastEditorUserId="55" LastEditDate="2020-12-11T08:56:11.263" LastActivityDate="2020-12-11T08:56:11.263" Title="Complexity of controlled operations in a two-level unitary operation" Tags="&lt;textbook-and-exercises&gt;&lt;complexity-theory&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15093" PostTypeId="1" CreationDate="2020-12-10T23:00:39.460" Score="2" ViewCount="75" Body="&lt;p&gt;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. &lt;strong&gt;Is it possible to overwrite the transpiler?&lt;/strong&gt; Can someone explain how the transpiler works?&lt;/p&gt;&#xA;" OwnerUserId="12967" LastEditorUserId="55" LastEditDate="2020-12-15T09:03:56.247" LastActivityDate="2020-12-15T09:03:56.247" Title="Transpiler in IBM Quantum devices" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-12-14T14:17:06.363" ContentLicense="CC BY-SA 4.0" />
  <row Id="15094" PostTypeId="2" ParentId="15093" CreationDate="2020-12-10T23:09:46.770" Score="3" Body="&lt;p&gt;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., &lt;code&gt;circuit = transpile(circuit, backend, optimization_level=0)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9863" LastActivityDate="2020-12-10T23:09:46.770" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15095" PostTypeId="1" AcceptedAnswerId="15100" CreationDate="2020-12-11T00:08:18.590" Score="2" ViewCount="86" Body="&lt;p&gt;Is it possible to design a circuit implementing the unitary matrix&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U-\begin{bmatrix}&#xA;R_{\Theta_1} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; R_{\Theta_2} &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; R_{\Theta_3} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; R_{\Theta_4} \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for given four angles &lt;span class=&quot;math-container&quot;&gt;$\Theta_1,...,\Theta_4$&lt;/span&gt; , where 0 is 2×2-dimensional zero matrix and &lt;span class=&quot;math-container&quot;&gt;$R_{\Theta}$&lt;/span&gt; is the rotation matrix with angle &lt;span class=&quot;math-container&quot;&gt;$\Theta$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;If so, can we implement it on the available quantum programming platforms such as Qiskit, CirQ, PyQuil, or ProjectQ?&lt;/p&gt;&#xA;" OwnerUserId="14089" LastEditorUserId="2005" LastEditDate="2020-12-11T08:00:56.110" LastActivityDate="2020-12-11T08:00:56.110" Title="Design a circuit implementing the unitary matrix" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15096" PostTypeId="1" AcceptedAnswerId="15097" CreationDate="2020-12-11T00:48:25.463" Score="0" ViewCount="54" Body="&lt;p&gt;Does CirQ support classically controlled quantum operators where the classical values obtained by the measurement?&lt;/p&gt;&#xA;" OwnerUserId="14089" LastActivityDate="2020-12-11T05:37:53.983" Title="Classically controlled quantum operators" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15097" PostTypeId="2" ParentId="15096" CreationDate="2020-12-11T05:37:53.983" Score="1" Body="&lt;p&gt;Currently, there is no mechanism for performing classical feedback in cirq. It is on the roadmap. It will probably look something like &lt;code&gt;cirq.X(q)**measurement_result(key)&lt;/code&gt; in the end, but for now it doesn't exist.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-12-11T05:37:53.983" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15098" PostTypeId="1" AcceptedAnswerId="15103" CreationDate="2020-12-11T05:38:42.273" Score="2" ViewCount="78" Body="&lt;p&gt;It appears that controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; type operation is the bedrock to many quantum algorithms, for instance, phase estimation and amplitude estimation. These algorithms systematically employs the controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; type operation on the a state, say &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, stored in an &lt;em&gt;oracle&lt;/em&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; an eigenstate of operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, meaning &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle = |\phi\rangle$&lt;/span&gt;. Now, we execute the controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operation to have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 'squeezes' out a phase factor &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle = e^{\theta}|\psi\rangle$&lt;/span&gt; and once this phase factor is considered &lt;em&gt;back-kicked&lt;/em&gt; to state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the states in computational and oracle registers are separable.)&lt;/p&gt;&#xA;&lt;p&gt;Here is what puzzles me. First, when we retain another bit in computational register as the control bit and apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the oracle register, to what state are we actually applying this operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;? 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-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operator look like? To be more concrete, take the following 3-bit computational register as example,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;retaining the second bit as control and apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (on the oracle register), how does that matrix look like?&lt;/p&gt;&#xA;" OwnerUserId="13563" LastEditorUserId="13563" LastEditDate="2020-12-11T05:56:17.867" LastActivityDate="2020-12-11T09:52:33.197" Title="How does a generic controlled-U operation work?" Tags="&lt;quantum-gate&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15100" PostTypeId="2" ParentId="15095" CreationDate="2020-12-11T07:46:24.537" Score="2" Body="&lt;p&gt;At worst, you could perform the construction&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LaOZf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LaOZf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$R_1$&lt;/span&gt; on the first qubit without controlling it off anything, and then applying &lt;span class=&quot;math-container&quot;&gt;$R_iR_1^\dagger$&lt;/span&gt; for the other three controlled-controlled operations.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-11T07:46:24.537" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15101" PostTypeId="2" ParentId="15098" CreationDate="2020-12-11T07:53:52.367" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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 &amp;quot;state of qubit 1, and state of qubit 2&amp;quot; but they are a single, unified state.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here, you're doing nothing on the first qubit, so that means apply identity &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on that qubit. Hence the operator looks like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I\otimes |0\rangle\langle 0|\otimes I+I\otimes |1\rangle\langle 1|\otimes U.&#xA;$$&lt;/span&gt;&#xA;Writing this as a matrix, it looks like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(\begin{array}{cccc}&#xA;I &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; U &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; I &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; U&#xA;\end{array}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-11T07:53:52.367" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15102" PostTypeId="1" CreationDate="2020-12-11T08:09:01.583" Score="2" ViewCount="81" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; whereas in the Bloch sphere it showed &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; with an angle of 180 degrees. What is the reason behind this as the output states should be &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; but then it is showing &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; in the histogram and it showed me the same when I ran that circuit on the quantum computer that is &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;.&#xA;This is the photo of the circuit, histogram, and Bloch Sphere.&lt;/p&gt;&#xA;" OwnerUserId="14137" LastEditorUserId="9097" LastEditDate="2020-12-11T09:31:21.250" LastActivityDate="2020-12-11T15:34:38.703" Title="Output of Bell State Measurement" Tags="&lt;ibm-q-experience&gt;&lt;bell-basis&gt;&lt;bell-experiment&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15103" PostTypeId="2" ParentId="15098" CreationDate="2020-12-11T08:10:43.933" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. For instance, take the two-qubit entangled state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt;. Now, say, I would like to apply a &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate on the first qubit. If I ask the state on which I will be applying the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate, it does not make sense because the state of the first qubit alone is not defined for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. This is true whenever we try to apply any &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits that are part of some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit entanglement state where &lt;span class=&quot;math-container&quot;&gt;$m&amp;lt; n$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;For any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, the matrix of its controlled version &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be given as &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;    I &amp;amp; 0 \\&#xA;    0 &amp;amp; U \\&#xA;\end{bmatrix}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is the zero matrix of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. This is quite simple. But when you try to obtain the matrix corresponding to the operation where you have 3 registers and the &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|+\rangle |+\rangle |\phi\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state. Then on the assumption that the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; matrix is of the form &lt;span class=&quot;math-container&quot;&gt;$U = [u_{i,j}]_{2^n\times 2^n}$&lt;/span&gt;, the matrix representation of the above operation looks like the following:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$M_u = \begin{bmatrix}&#xA;    I_{2^n} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;    0 &amp;amp; I_{2^n} &amp;amp; 0 &amp;amp; 0 \\&#xA;    0 &amp;amp; 0 &amp;amp; U &amp;amp; 0\\&#xA;    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; U\\&#xA;\end{bmatrix}_{(2^{n+2})\times (2^{n+2})}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I_{2^n}$&lt;/span&gt; is the identity matrix of size &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. Notice that this is a 3-qubit unitary and it is not possible to write &lt;span class=&quot;math-container&quot;&gt;$M_u$&lt;/span&gt; as a tensor product of two matrices. This can be viewed as the operator &lt;span class=&quot;math-container&quot;&gt;$$|0\rangle\langle 0| \otimes I_2 \otimes I_{2^n} + |1\rangle\langle 1| \otimes I_2 \otimes U.$$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$$M_u = (SWAP_{\{1,2\}}\otimes I_{2^n})\cdot (I_2\otimes cU_{\{2,3\}}) \cdot (SWAP_{\{1,2\}}\otimes I_{2^n})$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$SWAP_{\{1,2\}}$&lt;/span&gt; is the matrix corresponding to the &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt; gate. This can be generalized even to cases where you have &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; many gates in between the control and the target qubits very easily.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastEditorUserId="9097" LastEditDate="2020-12-11T09:28:36.913" LastActivityDate="2020-12-11T09:28:36.913" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15105" PostTypeId="2" ParentId="15102" CreationDate="2020-12-11T08:36:48.180" Score="2" Body="&lt;p&gt;I tried to prepare Bell state with circuit described by &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT} (H \otimes I)$&lt;/span&gt; and the result is state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt; as expected.&lt;/p&gt;&#xA;&lt;p&gt;Here is my circuit in the composer (including the code):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H8H4d.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H8H4d.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;After measurement on simulator I get these results&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ybSGP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ybSGP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please make sure that you measure correctly, i.e. each qubit to separate classical bit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;measure q[0] -&amp;gt; c[0];&#xA;measure q[1] -&amp;gt; c[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="1859" LastEditDate="2020-12-11T14:58:52.607" LastActivityDate="2020-12-11T14:58:52.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15106" PostTypeId="1" CreationDate="2020-12-11T09:21:55.900" Score="-3" ViewCount="175" Body="&lt;p&gt;Have you ever seen the preparation of the state &lt;span class=&quot;math-container&quot;&gt;$a^{\star}|0\rangle+b^{\star}|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle+b|1\rangle$&lt;/span&gt; from one initial state?&lt;/p&gt;&#xA;" OwnerUserId="14136" LastEditorUserId="55" LastEditDate="2020-12-15T09:06:23.830" LastActivityDate="2020-12-15T09:06:23.830" Title="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?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;state-preparation&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15108" PostTypeId="2" ParentId="15098" CreationDate="2020-12-11T09:52:33.197" Score="1" Body="&lt;p&gt;It appears that the answers from Tharrmashastha V and DaftWullie can be combined to give a rather general solution. Consider a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit computational register that stores an equally weighted superposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and a generic state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is stored in an oracle register (doesn't have to be a qubit state). Let's assume state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; -- as a vector -- has &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; components.&lt;/p&gt;&#xA;&lt;p&gt;Now, retain the &lt;span class=&quot;math-container&quot;&gt;$i^\text{th}$&lt;/span&gt; qubit (in the computational register) as a control bit and apply an operator &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; on state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. This operation can be represented as the following matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$I_{m}$&lt;/span&gt; denotes a &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-by-&lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; identity matrix.&lt;/p&gt;&#xA;" OwnerUserId="13563" LastActivityDate="2020-12-11T09:52:33.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15109" PostTypeId="1" AcceptedAnswerId="15490" CreationDate="2020-12-11T10:49:11.277" Score="0" ViewCount="90" Body="&lt;p&gt;How can we get rid of runtime next error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &amp;quot;C:\Users\Marija\Anaconda3\lib\site-packages\projectq\types\_qubit.py&amp;quot;, line 135, in __del__&#xA;    self.engine.deallocate_qubit(weak_copy)&#xA;  File &amp;quot;C:\Users\Marija\Anaconda3\lib\site-packages\projectq\cengines\_basics.py&amp;quot;, line 153, in deallocate_qubit&#xA;    tags=[DirtyQubitTag()] if is_dirty else [])])&#xA;  File &amp;quot;C:\Users\Marija\Anaconda3\lib\site-packages\projectq\cengines\_main.py&amp;quot;, line 288, in send&#xA;    raise compact_exception  # use verbose=True for more info&#xA;RuntimeError: Qubit has not been measured / uncomputed. Cannot access its classical value and/or deallocate a qubit in superposition!&#xA; raised in:&#xA;'  File &amp;quot;C:\\Users\\Marija\\Anaconda3\\lib\\site-packages\\projectq\\backends\\_sim\\_pysim.py&amp;quot;, line 139, in get_classical_value'&#xA;'    raise RuntimeError(&amp;quot;Qubit has not been measured / &amp;quot;'```&#xA;&#xA; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14089" LastEditorUserId="14089" LastEditDate="2020-12-28T13:05:27.630" LastActivityDate="2021-01-12T01:06:10.470" Title="ProjectQ - Error messages" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15110" PostTypeId="1" AcceptedAnswerId="15318" CreationDate="2020-12-11T11:28:31.113" Score="4" ViewCount="274" Body="&lt;p&gt;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 ?&lt;/p&gt;&#xA;&lt;p&gt;Let's say I have :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;psi = QuantumCircuit(5)&#xA;psi.ry(np.pi/4.,0)&#xA;psi.x(0)&#xA;psi.x(1)&#xA;    &#xA;psi2 = QuantumCircuit(5)&#xA;psi2.ry(np.pi/4.,0)&#xA;psi2.x(0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm looking for a function which returns True when qubit 0 has the same state vector in both circuits.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;I get the right result with this function :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def QuantumCircuits_Statevectors_AreEquals(QuantumCircuit1, QuantumCircuit2, QubitIndex):&#xA;&#xA;        statevector1_arr = np.empty([1,2]).astype(complex)&#xA;        statevector2_arr = np.empty([1,2]).astype(complex)&#xA;&#xA;        QuantumCircuit1.snapshot(&amp;quot;qbsnap&amp;quot;, qubits=[QubitIndex])&#xA;        QuantumCircuit2.snapshot(&amp;quot;qbsnap&amp;quot;, qubits=[QubitIndex])&#xA;&#xA;        backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;        snapshot1 = execute(QuantumCircuit1, backend).result().data()['snapshots']['statevector']['qbsnap']&#xA;        snapshot2 = execute(QuantumCircuit2, backend).result().data()['snapshots']['statevector']['qbsnap']&#xA;&#xA;        statevector1_arr[0][0] = snapshot1[0][0]&#xA;        statevector1_arr[0][1] = snapshot1[0][1]&#xA;&#xA;        statevector2_arr[0][0] = snapshot2[0][0]&#xA;        statevector2_arr[0][1] = snapshot2[0][1]&#xA;&#xA;        return np.array_equal(statevector1_arr, statevector2_arr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But maybe a cleaner solution is possible?&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="45" LastEditDate="2020-12-29T11:36:22.450" LastActivityDate="2021-02-18T12:36:35.687" Title="Get state vector of a single qubit in a circuit in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15111" PostTypeId="2" ParentId="15070" CreationDate="2020-12-11T12:24:55.697" Score="4" Body="&lt;p&gt;There is a new approach that will be merged soon in qiskit terra (&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/5364&quot; rel=&quot;nofollow noreferrer&quot;&gt;here for the PR&lt;/a&gt;) that uses polynomial approximation to compute &lt;span class=&quot;math-container&quot;&gt;$\arcsin(C/\lambda)$&lt;/span&gt;, and asymptotically this would be the efficient implementation.&lt;/p&gt;&#xA;&lt;p&gt;In practice if you are solving a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix or a very small system it would be better to hard code the rotations.&lt;/p&gt;&#xA;&lt;p&gt;The theory and error analyses of this approach are explained in Section VI of &lt;a href=&quot;https://arxiv.org/abs/2009.04484&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2020-12-11T12:24:55.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15112" PostTypeId="2" ParentId="15106" CreationDate="2020-12-11T13:52:29.860" Score="5" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\langle \psi|$&lt;/span&gt; is not a quantum state, but a linear functional on the set of quantum states. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a quantum state, any gates that you can apply to it can only take it to quantum states, so in particular not to &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Of course, mathematically it is trivial to transform &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|$&lt;/span&gt; and vice-versa, but this is not a physical transformation.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2020-12-11T13:52:29.860" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15113" PostTypeId="2" ParentId="15102" CreationDate="2020-12-11T15:34:38.703" Score="1" Body="&lt;p&gt;You &lt;em&gt;probably&lt;/em&gt; did something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7uKFD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7uKFD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since you are only measuring the top qubit, and a Bell state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; probability of the first qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; probability of it being in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Hence, you got the above probabilities readout plot.&lt;/p&gt;&#xA;&lt;p&gt;If you also put in the second measurement like @MartinVesely did, then you will get the right answer.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-11T15:34:38.703" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15115" PostTypeId="1" CreationDate="2020-12-11T22:04:30.497" Score="1" ViewCount="99" Body="&lt;p&gt;Can someone explain the EPR argument with a simple description using Pauli matrices?&lt;/p&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Either the Quantum Mechanic description of reality given by the wave function is not complete;&lt;/li&gt;&#xA;&lt;li&gt;Or the physical quantities associated with non-commuting operators cannot have simultaneous reality.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;To clarify the ideas involved, let us consider a fundamental concept of state which is characterized by state vector, &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; which describe the particle’s behavior. Corresponding to every physical observable, there is an operator which operates on the state vector.&#xA;&lt;span class=&quot;math-container&quot;&gt;$\hat{A}|a\rangle = a|a\rangle$&lt;/span&gt;&#xA;For an eigenstate &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; of Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$\hat{A}$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;How to explain the momentum and coordinate in the EPR paper using pauli matrices?&lt;/p&gt;&#xA;" OwnerUserId="13823" LastEditorUserId="55" LastEditDate="2021-01-05T20:38:02.590" LastActivityDate="2021-01-05T20:38:02.590" Title="Understanding the EPR argument with a simple description using Pauli matrices" Tags="&lt;pauli-gates&gt;&lt;non-locality&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15116" PostTypeId="2" ParentId="15106" CreationDate="2020-12-12T00:17:52.023" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\psi\right|$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$\left&amp;lt;\phi|\psi\right&amp;gt;$&lt;/span&gt; is a scalar (inner product) while &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;\left&amp;lt;\phi\right|$&lt;/span&gt; is a matrix (outer product).&lt;/p&gt;&#xA;&lt;p&gt;You may have wanted instead to convert &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt; to another ket that has all of its probability amplitudes on a basis complex conjugated, without transposing the vector, e.g. turning &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \sum_{x = 0}^Na_x\left|x\right&amp;gt;$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sum_{x = 0}^N \bar a_x\left|x\right&amp;gt;$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;If, however, you know in advance what the probability amplitudes of &lt;span class=&quot;math-container&quot;&gt;$\left|\psi \right&amp;gt;$&lt;/span&gt; are in the computational basis, then a unitary transform that will complex conjugate at least that quantum state is &lt;span class=&quot;math-container&quot;&gt;$C_{jk} = \delta_{jk}e^{-2i \phi_j}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\phi_j$&lt;/span&gt; is the argument of &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt;$&lt;/span&gt;. If you want to convert the probability amplitudes of &lt;span class=&quot;math-container&quot;&gt;$U\left|p_0\right&amp;gt;$&lt;/span&gt; to their conjugates given knowledge of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|p_0\right&amp;gt;$&lt;/span&gt;, then such a transformation is &lt;span class=&quot;math-container&quot;&gt;$\bar U C\left|p_0\right&amp;gt;$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; conjugates the amplitudes of &lt;span class=&quot;math-container&quot;&gt;$\left|p_0\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2020-12-12T17:18:24.947" LastActivityDate="2020-12-12T17:18:24.947" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15117" PostTypeId="2" ParentId="14890" CreationDate="2020-12-12T01:00:21.473" Score="3" Body="&lt;p&gt;This is wrong, just take &lt;span class=&quot;math-container&quot;&gt;$c_1&amp;gt;0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2&amp;lt;0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-12-12T01:00:21.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15122" PostTypeId="2" ParentId="14285" CreationDate="2020-12-13T00:53:10.553" Score="3" Body="&lt;p&gt;If perturbations are sufficiently small and &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; has sufficiently broad support then a desired global state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}'$&lt;/span&gt; exists. Define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}' = \rho_{AB} + (\rho_A' - \rho_A) \otimes \rho_B + \rho_A \otimes (\rho_B' - \rho_B) \tag1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}'$&lt;/span&gt; is Hermitian and trace one, but may not be positive. However, &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}'$&lt;/span&gt; is positive if &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; has broad support and perturbations are not too large. For example, if&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\rho_A' - \rho_A\|_2 + \|\rho_B' - \rho_B\|_2 \leq \lambda_{min}(\rho_{AB})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(X)$&lt;/span&gt; denotes the smallest eigenvalue of operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, then for any &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle\psi|\rho_{AB}'|\psi\rangle&#xA;&amp;amp; =&#xA;\langle\psi|\rho_{AB}|\psi\rangle +&#xA;\langle\psi|(\rho_A' - \rho_A) \otimes \rho_B|\psi\rangle +&#xA;\langle\psi|\rho_A \otimes (\rho_B' - \rho_B)|\psi\rangle \\&#xA;&amp;amp; \geq&#xA;\lambda_{min}(\rho_{AB}) - \|\rho_A' - \rho_A\|_2 - \|\rho_B' - \rho_B\|_2 \geq 0.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho_{AB}') = 0$&lt;/span&gt;, then it may be possible to restrict the support of the perturbations so that an analogous inequality holds.&lt;/p&gt;&#xA;&lt;p&gt;The reduced states of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}'$&lt;/span&gt; are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;{\rm tr}_A(\rho_{AB}')&#xA;&amp;amp; = {\rm tr}_A(\rho_{AB}) + \rho_B \, {\rm tr}(\rho_A' - \rho_A) + (\rho_B' - \rho_B) \, {\rm tr}(\rho_A) \\&#xA;&amp;amp; = \rho_B +  \rho_B' - \rho_B \\&#xA;&amp;amp; = \rho_B'&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and similarly &lt;span class=&quot;math-container&quot;&gt;${\rm tr}_B(\rho_{AB}') = \rho_A'$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, the distance&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\|\rho_{AB}' - \rho_{AB}\|_1&#xA;&amp;amp; = \|(\rho_A' - \rho_A) \otimes \rho_B + \rho_A \otimes (\rho_B' - \rho_B)\|_1 \\&#xA;&amp;amp; \leq \|(\rho_A' - \rho_A) \otimes \rho_B\|_1 + \| \rho_A \otimes (\rho_B' - \rho_B)\|_1 \\&#xA;&amp;amp; = \|\rho_A' - \rho_A\|_1 + \|\rho_B' - \rho_B\|_1 \\&#xA;&amp;amp; \leq 2\delta&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lim_{\delta\rightarrow 0}\varepsilon(\delta) = \lim_{\delta\rightarrow 0} 2\delta = 0&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as required.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; will contain negative elements that are not compensated for by &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-13T00:53:10.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15123" PostTypeId="1" CreationDate="2020-12-13T02:31:57.737" Score="3" ViewCount="266" Body="&lt;p&gt;I read Qiskit quantum admm on &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/optimization/algorithms/admm_optimizer.html#ADMMOptimizer&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; website.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14153" LastEditorUserId="55" LastEditDate="2020-12-14T08:39:17.680" LastActivityDate="2020-12-14T08:39:17.680" Title="Does the Qiskit ADMM optimizer really run on quantum computers?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15124" PostTypeId="2" ParentId="15123" CreationDate="2020-12-13T03:03:21.423" Score="4" Body="&lt;p&gt;The ADMM optimizer is a classical optimizer that will be execute on the classical computer.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Variational_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;variational principle&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GHt1I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GHt1I.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-13T03:03:21.423" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15125" PostTypeId="2" ParentId="15123" CreationDate="2020-12-13T07:36:40.247" Score="2" Body="&lt;p&gt;ADMN optimizer is used for functions having shape&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x,y) = q(x) + \varphi(y),&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$q(x)$&lt;/span&gt; is quadratic function with binary variables and &lt;span class=&quot;math-container&quot;&gt;$\varphi(x)$&lt;/span&gt; is convex continuous function.&lt;/p&gt;&#xA;&lt;p&gt;For optimization of &lt;span class=&quot;math-container&quot;&gt;$\varphi(y)$&lt;/span&gt; a classical optimization method is used while &lt;span class=&quot;math-container&quot;&gt;$q(x)$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$f(x,y)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# classical optimizer for phi function&#xA;cobyla=CobylaOptimizer()&#xA;# QAOA for q function&#xA;qaoa=MinimumEigenOptimizer(QAOA(quantum_instance=BasicAer.get_backend('statevector_simulator')))&#xA;&#xA;qubo_optimizer = qaoa&#xA;convex_optimizer= cobyla&#xA;&#xA;# initialize ADMM with classical QUBO and convex optimizer&#xA;admm=ADMMOptimizer(params=admm_params,qubo_optimizer=qubo_optimizer,continuous_optimizer=convex_optimizer)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-13T07:36:40.247" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15126" PostTypeId="1" AcceptedAnswerId="15128" CreationDate="2020-12-13T17:57:31.053" Score="2" ViewCount="82" Body="&lt;p&gt;I try to decompose ansatz into gate set in order to create a circuit in qiskit for QAOA algorithm.&#xA;I don't understand how represent  parametrized 2 qubit ansatz as circuit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ H{_B} = \sum_{j=1}^{n} {\sigma_j^x} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ H_{A} = \frac{1}{2}\sigma_z^1 + \frac{1}{2}\sigma_z^1\otimes\sigma_z^2 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Ansatz for p=1&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \left| \gamma_1,\beta_1 \right\rangle = e^{-i\beta_1H_B} e^{-i\gamma_1H_A} \left| ++ \right\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is clear how a circuit for &lt;span class=&quot;math-container&quot;&gt;$ e^{-i\beta_1H_B} $&lt;/span&gt; looks like, but I stuck in decomposing &lt;span class=&quot;math-container&quot;&gt;$ e^{-i\gamma_1H_A} $&lt;/span&gt;(more precisely it second term) into  parametrised circuit acting on both qubits and depends on &lt;span class=&quot;math-container&quot;&gt;$\gamma_1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any help would be appreciated as well as any insight on multiple qubit decomposition.&lt;/p&gt;&#xA;" OwnerUserId="14161" LastEditorUserId="14161" LastEditDate="2020-12-13T18:07:37.120" LastActivityDate="2020-12-13T18:32:53.697" Title="Decomposition of 2-qubit Hamiltonian into standard gate set for QAOA" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15127" PostTypeId="1" CreationDate="2020-12-13T18:18:17.467" Score="3" ViewCount="84" Body="&lt;p&gt;I'm trying to prove Bell's inequality by following the one made by Wigner, that is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(+_a,+_b) \le P(+_a,+_c) + P(+_c,+_b)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And that this proof is NOT satisfied for angles between the various axes &lt;span class=&quot;math-container&quot;&gt;$\hat a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat c$&lt;/span&gt;.&#xA;In particular I have chosen the coplanar axes (plane x-y) and that the &lt;span class=&quot;math-container&quot;&gt;$\hat c$&lt;/span&gt; axis is the bisector of &lt;span class=&quot;math-container&quot;&gt;$\hat a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So I'm in the situation in the picture &lt;a href=&quot;https://i.stack.imgur.com/ewmKL.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$\hat a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat c$&lt;/span&gt;) and the other qubit on one of the remaining axes in in such a way as to make all possible combinations.&lt;/p&gt;&#xA;&lt;p&gt;In the specific situation represented in the graph, the angle that I can choose between the various axes must be a value between &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac \pi2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;The entangled state I create it like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(2,2)&#xA;circ.x(0)&#xA;circ.x(1)&#xA;&#xA;circ.h(0)&#xA;circ.cx(0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Referring to the graph I put earlier, if I wanted to now measure a long qubit &lt;span class=&quot;math-container&quot;&gt;$\hat a$&lt;/span&gt; and a long &lt;span class=&quot;math-container&quot;&gt;$\hat b$&lt;/span&gt; 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?&lt;/p&gt;&#xA;&lt;p&gt;I thought about doing it this way&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Long a-axis for qubit 1&#xA;circ.h(0) &#xA;&#xA;# Long b-axis for qubit 2&#xA;circ.rz(pi/3, 1) &#xA;circ.h(1)&#xA;&#xA;&#xA;circ.measure(range(2),range(2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I wonder if these steps are correct or I forgot something or I can do it in another way.&#xA;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?&lt;/p&gt;&#xA;&lt;p&gt;I hope I was clear enough and that we can resolve my doubts!&#xA;Thank you for your time!&lt;/p&gt;&#xA;" OwnerUserId="14162" LastEditorUserId="55" LastEditDate="2020-12-14T08:39:32.823" LastActivityDate="2020-12-14T08:39:32.823" Title="How can I measure a qubit on a generic axis on Qiskit?" Tags="&lt;programming&gt;&lt;measurement&gt;&lt;bell-basis&gt;&lt;bell-experiment&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15128" PostTypeId="2" ParentId="15126" CreationDate="2020-12-13T18:32:53.697" Score="2" Body="&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\sigma_z^1 = I \otimes Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_z^1 \otimes \sigma_z^2 = Z \otimes Z$&lt;/span&gt; are commute with one another, that is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ [\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} $$&lt;/span&gt;&#xA;we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 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  }  $$&lt;/span&gt;&#xA;and now note that &lt;span class=&quot;math-container&quot;&gt;$e^{i \gamma \frac{1}{2}\sigma_z^1  }$&lt;/span&gt; has circuit construction as: (look &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9858&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/1001.3855.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; page 7 and 8)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t3BFr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t3BFr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and similarly, &lt;span class=&quot;math-container&quot;&gt;$ e^{i \gamma \frac{1}{2}\sigma_z^1 \otimes \sigma_z^2  } $&lt;/span&gt; have the circuit construction as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SeMbF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SeMbF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and put them together, we have the circuit construction for &lt;span class=&quot;math-container&quot;&gt;$e^{i \gamma \frac{1}{2}(\sigma_z^1  + \sigma_z^1 \otimes \sigma_z^2 ) }$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/trI3r.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/trI3r.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-13T18:32:53.697" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15129" PostTypeId="1" AcceptedAnswerId="15130" CreationDate="2020-12-13T18:49:59.063" Score="4" ViewCount="162" Body="&lt;p&gt;Say we want to swap qubits &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; in the same register, where &lt;span class=&quot;math-container&quot;&gt;$a,b \in \left \{ 0, 1,\cdots, n-1 \right \}$&lt;/span&gt;. What would be the corresponding matrix.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For instance it is common knowledge that for &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt; (a two-qubit register) the matrix is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$SWAP=\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ &#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ &#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand how this acts on &lt;span class=&quot;math-container&quot;&gt;$\langle 10| \equiv \left [ 0, 1, 0, 0 \right ] \leftrightarrow  \langle 01| \equiv \left [ 0, 0, 1, 0 \right ] $&lt;/span&gt; but I fail to see where exactly to place the two off-diagonal &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s in the general case.&lt;/p&gt;&#xA;" OwnerUserId="13987" LastActivityDate="2020-12-13T19:46:45.653" Title="What is the matrix for a SWAP operation on two qubits?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;matrix-representation&gt;&lt;quantum-fourier-transform&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15130" PostTypeId="2" ParentId="15129" CreationDate="2020-12-13T19:46:45.653" Score="6" Body="&lt;p&gt;In the general case I think it's easier to consider the matrix in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|,&#xA;$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$i_1, \dots, i_n,j_1, \dots, j_n$&lt;/span&gt; are all binary and the &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; for brevity as &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; is a big subscript). Now suppose we want to swap system &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; with system &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$1 \leq p &amp;lt; q \leq n$&lt;/span&gt;. We know exactly what transformation we are after so it shouldn't be too difficult to write down the transformation in the above form.&lt;/p&gt;&#xA;&lt;p&gt;We know that if our state is &lt;span class=&quot;math-container&quot;&gt;$|i_1 \dots i_p \dots i_q \dots i_n\rangle$&lt;/span&gt; then we want the map to output the state &lt;span class=&quot;math-container&quot;&gt;$|i_1 \dots i_q \dots i_p \dots i_n \rangle$&lt;/span&gt;. Well such a map is precisely defined by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\mathrm{SWAP}_{p,q} &amp;amp;= \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| \\&amp;amp;= \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|.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;outer[i_, j_] := &#xA;  Transpose[{UnitVector[2, i + 1]}].{UnitVector[2, j + 1]};&#xA;(* Let's swap systems 2 and 3 in a 3 qubit system *)&#xA;&#xA;M = ConstantArray[0, {8, 8}];&#xA;For[i1 = 0, i1 &amp;lt;= 1, i1++,&#xA;  For[i2 = 0, i2 &amp;lt;= 1, i2++,&#xA;   For[i3 = 0, i3 &amp;lt;= 1, i3++,&#xA;    M = M + &#xA;       KroneckerProduct[outer[i1, i1] , outer[i3, i2], &#xA;        outer[i2, i3]];&#xA;    ]&#xA;   ]&#xA;  ];&#xA;M // MatrixForm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This outputs&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(&#xA;\begin{array}{cccccccc}&#xA; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right).&#xA;$$&lt;/span&gt;&#xA;which is what we expect &lt;span class=&quot;math-container&quot;&gt;$I \otimes \mathrm{SWAP}$&lt;/span&gt; (do nothing on the first system and do a two qubit swap on the second and third systems).&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-12-13T19:46:45.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15131" PostTypeId="1" AcceptedAnswerId="15136" CreationDate="2020-12-13T20:25:05.930" Score="0" ViewCount="49" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13030" LastActivityDate="2020-12-14T08:14:38.777" Title="Why is it important to be in the basis in which measurements will be performed?" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15132" PostTypeId="1" CreationDate="2020-12-13T21:11:34.650" Score="3" ViewCount="50" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10153" LastEditorUserId="55" LastEditDate="2020-12-14T08:46:01.520" LastActivityDate="2020-12-14T08:46:01.520" Title="Are there any detailed designs for Quantum Computing hardware?" Tags="&lt;resource-request&gt;&lt;physical-realization&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15133" PostTypeId="1" AcceptedAnswerId="15139" CreationDate="2020-12-09T18:13:04.447" Score="5" ViewCount="96" Body="&lt;p&gt;In &lt;a href=&quot;http://arXiv.org/abs/quant-ph/0611001v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Quick Background:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us consider a quantum system for which the Hilbert space can be factorised into &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; different &amp;quot;sites&amp;quot;. That is to say &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \bigotimes_{k=1}^{m} \mathcal{H}_k$&lt;/span&gt; where all the individual Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_k$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$2d$&lt;/span&gt; dimensional for some fixed &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_k = \mathbb{C}^{2d}$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Now let us define a set of localised two outcome observables &lt;span class=&quot;math-container&quot;&gt;$M_{k,i}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$i=1,2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k=1,2,...,m$&lt;/span&gt; such that they only have &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; as their eigenvalues, and are traceless. The authors go on to show that it is possible to choose a basis in which both &lt;span class=&quot;math-container&quot;&gt;$M_{k,1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_{k,2}$&lt;/span&gt; take the block diagonal form &lt;span class=&quot;math-container&quot;&gt;$\oplus_{j=1}^{d}\mathbb{C}^2$&lt;/span&gt; simultaneously for all &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. The quantity of interest is the Bell correlation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$B = \langle{\psi|\mathcal{B}|\psi}\rangle.$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&#xA;is the Bell operator for some fixed &lt;span class=&quot;math-container&quot;&gt;$c_{i_1...i_m}$&lt;/span&gt; coefficients. We're taking &lt;span class=&quot;math-container&quot;&gt;$M_{k,0}=1$&lt;/span&gt; as the identity operator. As I understand it, this is useful in having terms in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; that have operators from, say, only two sites a la the CHSH case. The authors claim that &amp;quot;the maximum quantum value of the Bell inequality is achieved by a state that has support on a qubit at each site&amp;quot;. I'm assuming by &amp;quot;value of Bell inequality&amp;quot; they mean value &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Moreover I'm assuming by &amp;quot;support over one qubit&amp;quot;, they mean when the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; lies entirely in exactly one &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; sector in all &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_k$&lt;/span&gt;'s. Please correct me if either of these assumptions are incorrect or unreasonable.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be some state in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;. In the second to last paragraph in page 2, the authors define &lt;span class=&quot;math-container&quot;&gt;$\rho_{k,j}$&lt;/span&gt; as the &amp;quot;reduced density matrix obtained by projecting &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; onto the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;’th &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; factor of the &lt;span class=&quot;math-container&quot;&gt;$\bigoplus_{j=1}^{d}\mathbb{C}^2$&lt;/span&gt; subspace induced by &lt;span class=&quot;math-container&quot;&gt;$M_{k,1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_{k,2}$&lt;/span&gt; at site &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&amp;quot; Now they state that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$$B = \sum_{j=1}^{d} \text{tr} (\mathcal{B}\rho_{j,k}).$$&lt;/span&gt; They further argue since this is a convex sum over the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; sectors, &amp;quot;it follows that the maximum is achieved by a state with support on a qubit at site &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;.&amp;quot; I'm assuming they're talking about projecting &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; on the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;'th &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; subspace of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;'th site. Here are my questions.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;What does the &lt;span class=&quot;math-container&quot;&gt;$\rho_{j,k}$&lt;/span&gt; mean? It couldn't possibly mean an actual reduced density matrix obtained by tracing out all the degrees of freedom apart from &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; because then the formula &lt;span class=&quot;math-container&quot;&gt;$\langle{\psi|\mathcal{B}|\psi}\rangle = \text{tr} \mathcal{B} \rho_{j,k}$&lt;/span&gt; wouldn't hold as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How does said convexity mean that &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is maximised with support only on one sector? What is the corresponding theorem being used here?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;My Attempt at a solution&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's define a projector &lt;span class=&quot;math-container&quot;&gt;$P_{j,k}$&lt;/span&gt; which projects a state in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;'th &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; sector of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;'th site. For a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, I'm assuming &lt;span class=&quot;math-container&quot;&gt;$\rho_{j,k}\equiv P_{j,k}|\psi\rangle \langle \psi | P_{j,k}$&lt;/span&gt;. This may not be, and in all possibility isn't, the &lt;span class=&quot;math-container&quot;&gt;$\rho_{j,k}$&lt;/span&gt; the paper is talking about, but I couldn't find another reasonable interpretation. Now, since both &lt;span class=&quot;math-container&quot;&gt;$M_{k,1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_{k,2}$&lt;/span&gt; are block diagonal in the sectors we obtain the required form &lt;span class=&quot;math-container&quot;&gt;$B = \sum_{j=1}^{d} \text{tr} (\mathcal{B}\rho_{j,k})$&lt;/span&gt;. Now assuming a dot product structure on the space of all operators on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; given by &lt;span class=&quot;math-container&quot;&gt;$A\cdot B \equiv \text{tr}(AB)$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$B = \sum_{j=1}^{d} \mathcal{B} \cdot \rho_{j,k}$&lt;/span&gt;.&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$\rho_{j,k}\cdot \rho_{j',k}=0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$j\neq j'$&lt;/span&gt;, all the &lt;span class=&quot;math-container&quot;&gt;$\rho_{j,k}$&lt;/span&gt;'s are orthogonal vectors. I guess now there is some argument with which we can say that the maximum value of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; can be achieved when &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; is aligned perfectly parallel to one of the &lt;span class=&quot;math-container&quot;&gt;$\rho_{j,k}$&lt;/span&gt; and it's only that &lt;span class=&quot;math-container&quot;&gt;$\rho_{jk}$&lt;/span&gt; that's nonzero. But this doesn't seem to be a particularly strong argument since it suggests that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; lives is a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensional vector space, which is obviously not true because we can arbitrary increase the degrees of freedom in its definition by increasing &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Moreover this argument doesn't seem to use convexity anywhere so this is probably not what the authors are getting at.&lt;/p&gt;&#xA;&lt;p&gt;Any help regarding elucidating this proof will be of great help. Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="14177" OwnerDisplayName="Tuneer Chakraborty" LastEditorUserId="14177" LastEditDate="2020-12-16T20:10:33.153" LastActivityDate="2020-12-16T20:10:33.153" Title="Role of convexity in proof of Monogamy of Bell correlations" Tags="&lt;entanglement&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15134" PostTypeId="1" AcceptedAnswerId="15135" CreationDate="2020-12-13T23:17:00.007" Score="1" ViewCount="70" Body="&lt;p&gt;I'm trying to perform QPE on the T-gate in &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22,%22H%22,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,%22Z%5E%C2%BC%22%5D,%5B1,%22%E2%80%A2%22,1,%22Z%5E%C2%BC%22%5D,%5B1,%22%E2%80%A2%22,1,%22Z%5E%C2%BC%22%5D,%5B1,1,%22%E2%80%A2%22,%22Z%5E%C2%BC%22%5D,%5B1,1,%22%E2%80%A2%22,%22Z%5E%C2%BC%22%5D,%5B1,1,%22%E2%80%A2%22,%22Z%5E%C2%BC%22%5D,%5B1,1,%22%E2%80%A2%22,%22Z%5E%C2%BC%22%5D,%5B%22Swap%22,1,%22Swap%22%5D,%5B%22H%22%5D,%5B%22%E2%80%A2%22,%22%7Egf1o%22%5D,%5B1,%22H%22%5D,%5B%22%E2%80%A2%22,1,%22%7E16c9%22%5D,%5B1,%22%E2%80%A2%22,%22%7Egf1o%22%5D,%5B1,1,%22H%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7Egf1o%22,%22name%22:%22U(-pi/4)%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,%E2%88%9A%C2%BD-%E2%88%9A%C2%BDi%7D%7D%22%7D,%7B%22id%22:%22%7E16c9%22,%22name%22:%22U(-pi/2)%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,-i%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ql3gm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ql3gm.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've modeled my implementation directly from the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit QPE tutorial&lt;/a&gt;. For the unitary I am using &lt;span class=&quot;math-container&quot;&gt;$U(\lambda) = \begin{bmatrix}1 &amp;amp; 0\\0 &amp;amp; e^{i \lambda}\end{bmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Where did I go wrong here? Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2020-12-13T23:50:37.183" Title="Trying to perform Quantum Phase Estimation on T-gate" Tags="&lt;qiskit&gt;&lt;simulation&gt;&lt;quantum-fourier-transform&gt;&lt;phase-estimation&gt;&lt;quirk&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15135" PostTypeId="2" ParentId="15134" CreationDate="2020-12-13T23:50:37.183" Score="3" Body="&lt;p&gt;Your implementation is really close - on the website, here's the diagram that they used:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cFuur.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cFuur.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, I think you reversed the angles - it should be &lt;span class=&quot;math-container&quot;&gt;$-\pi/2, -\pi/4, -\pi/2$&lt;/span&gt;. (Also: there's a QFT inverse that Quirk has, so you can verify that the first half of your circuit is correct).&lt;/p&gt;&#xA;" OwnerUserId="8343" LastActivityDate="2020-12-13T23:50:37.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15136" PostTypeId="2" ParentId="15131" CreationDate="2020-12-14T08:14:38.777" Score="1" Body="&lt;p&gt;I'm guessing that what you mean is the following: if you have a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to be measured in an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|\phi_+\rangle,|\phi_-\rangle$&lt;/span&gt;, then you should express &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=a|\phi_+\rangle+b|\phi_-\rangle.&#xA;$$&lt;/span&gt;&#xA;(I assume this is what you mean by being &amp;quot;in the basis&amp;quot;?)&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$|a|^2,|b|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But, really, it's not that important. You could have &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; expressed in any basis, because all you have to calculate is &lt;span class=&quot;math-container&quot;&gt;$|\langle\phi_+|\psi\rangle|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\langle\phi_-|\psi\rangle|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Equally, as you mention, you could just perform a basis transformation. Imagine that you had&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\alpha|0\rangle+\beta|1\rangle,&#xA;$$&lt;/span&gt;&#xA;then if you construct&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=|0\rangle\langle\phi_+|+|1\rangle\langle\phi_-|,&#xA;$$&lt;/span&gt;&#xA;calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi\rangle=a|0\rangle+b|1\rangle,&#xA;$$&lt;/span&gt;&#xA;so reading off the amplitudes of the 0 and 1 components gives you exactly the components you need. To see this, note&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle0|U|\psi\rangle=\langle\phi_+|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-14T08:14:38.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15137" PostTypeId="1" CreationDate="2020-12-14T08:35:09.213" Score="1" ViewCount="52" Body="&lt;p&gt;In quantum chemistry, there are concepts about one-particle reduced density matrix (1-RDM) and similarly, the two-particle reduced density matrix (2-RDM).&#xA;Generally, for an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; particle wavefunction &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; and the corresponding density matrix is &lt;span class=&quot;math-container&quot;&gt;${}^nD=|\Psi\rangle\langle\Psi|$&lt;/span&gt;. Then there are two definitions of the 1-RDM and 2-RDM. The first is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;{}^1D= \begin{pmatrix}&#xA;1 \\&#xA;n&#xA;\end{pmatrix} tr_{2,3,\cdots,n} {}^nD&#xA;\end{equation}&lt;/span&gt;&#xA;where will resulting &lt;span class=&quot;math-container&quot;&gt;$C_n^1=n$&lt;/span&gt; density matrix. Another method is to define the element of 1-RDM as:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;{}^1D_{ij} = \langle \Psi|a_i^{\dagger} a_j|\Psi\rangle&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; run over  &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; and the matrix will be a &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; one. Is there any connection or difference between the two representations?&lt;/p&gt;&#xA;" OwnerUserId="6128" LastEditorUserId="55" LastEditDate="2020-12-15T09:30:14.240" LastActivityDate="2020-12-15T09:30:14.240" Title="Is there a connection between the definitions of one- and two-particle reduced density matrices?" Tags="&lt;chemistry&gt;&lt;many-body-systems&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15138" PostTypeId="1" CreationDate="2020-12-14T14:28:27.463" Score="7" ViewCount="130" Body="&lt;p&gt;I read about the photonic QC &lt;em&gt;Jiŭzhāng&lt;/em&gt; that showed &lt;a href=&quot;https://science.sciencemag.org/content/early/2020/12/02/science.abe8770&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum advantage by Gaussian boson sampling&lt;/a&gt;. 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).&lt;/p&gt;&#xA;&lt;p&gt;I know the term &amp;quot;squeezed states&amp;quot; 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?&lt;/p&gt;&#xA;" OwnerUserId="13925" LastEditorUserId="2927" LastEditDate="2020-12-16T18:35:01.867" LastActivityDate="2020-12-20T16:00:33.790" Title="Is Gaussian boson sampling (used for showing quantum advantage) a subcategory of the continuous variable approach?" Tags="&lt;quantum-advantage&gt;&lt;photonics&gt;&lt;continuous-variable&gt;&lt;boson-sampling&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15139" PostTypeId="2" ParentId="15133" CreationDate="2020-12-14T14:47:18.880" Score="3" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/pdf/1303.3081v3.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Scarani15&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;To start we are considering a two-input, two-output, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-party Bell-inequality with outputs &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt;. Working from now on in this basis we have that for party &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_{k,1} = \bigoplus_n M_{k,1,n} \\&#xA;M_{k,2} = \bigoplus_n M_{k,2,n}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$M_{k,i,n}$&lt;/span&gt; are qubit observables with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now consider a single term in the Bell-operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; (without the coefficient). This is something of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M_{1,i_1} \otimes M_{2,i_2} \otimes \dots \otimes M_{m,i_m}&#xA;$$&lt;/span&gt;&#xA;which is equal to by the block diagonalization&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}.&#xA;$$&lt;/span&gt;&#xA;Now this tensor product of block diagonal operators is itself a block diagonal operator, one block for each tuple &lt;span class=&quot;math-container&quot;&gt;$(n_1,\dots, n_m)$&lt;/span&gt;, so at this point I think its cleanest to just define some indexing over the tuples &lt;span class=&quot;math-container&quot;&gt;$n = (n_1,\dots, n_m)$&lt;/span&gt; and redefine this as something of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bigoplus_n M_{1,i_1,n_1} \otimes M_{2,i_2,n_2} \otimes \dots \otimes M_{m,i_m,n_m}. &#xA;$$&lt;/span&gt;&#xA;Notice that for each index &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; the operator in the block is a &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; eigenvalued observable on &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; 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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\mathcal{B} &amp;amp;= \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} \\&#xA;&amp;amp;= \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} \\&#xA;&amp;amp;= \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} \\&#xA;&amp;amp;= \sum_n \mathcal{B}_n.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Where on the final line we have defined &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}_n$&lt;/span&gt; to be the operator that is the same as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; on block &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; but is zero elsewhere. If we let &lt;span class=&quot;math-container&quot;&gt;$\Pi_n$&lt;/span&gt; be the projector onto block &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\Pi_{n_1} \mathcal{B}_r \Pi_{n_2} = \delta_{r n_1} \delta_{n_1 n_2} \mathcal{B}_r$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now consider an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; for the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; parties and its projection onto the blocks i.e. &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho} = \sum_n \Pi_n \rho \Pi_n$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$\hat \rho$&lt;/span&gt; is also a state. Then the expected Bell-value for the projected state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;B &amp;amp;= \mathrm{Tr}[\mathcal{B} \hat\rho] \\&#xA;&amp;amp;= \sum_n \mathrm{Tr}[ \mathcal{B}_n  \hat\rho ] \\&#xA;&amp;amp;= \sum_n \mathrm{Tr}[ \mathcal{B}_n \sum_{r} \Pi_{r} \rho \Pi_{r}] \\&#xA;&amp;amp;= \sum_n \sum_{r}\mathrm{Tr}[\Pi_{r} \mathcal{B}_n \Pi_{r} \rho] \\&#xA;&amp;amp;= \sum_n \mathrm{Tr}[\Pi_n \mathcal{B}_n \Pi_n \rho] \\&#xA;&amp;amp;= \mathrm{Tr}[\sum_n \Pi_n \mathcal{B}_n \Pi_n \rho] \\&#xA;&amp;amp;= \mathrm{Tr}[\mathcal{B} \rho].&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Thus the expected Bell-value does not change when we consider a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and the projection of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; onto the blocks. For the purposes of computing the maximum Bell-value it is sufficient to consider states that are also block diagonal.&lt;/p&gt;&#xA;&lt;p&gt;In the same vein as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}_n$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$\rho_n = \Pi_n \rho \Pi_n$&lt;/span&gt;. Note that the restriction  of &lt;span class=&quot;math-container&quot;&gt;$\rho_n$&lt;/span&gt; to its support is a subnormalized &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit state with a trace &lt;span class=&quot;math-container&quot;&gt;$p(n) = \mathrm{Tr}[\Pi_n \rho \Pi_n]$&lt;/span&gt;. So now we want to try to compute the maximum violation. Lets begin with the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit problem&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\max \mathrm{Tr}[\mathcal{B}_0 \tau]&#xA;$$&lt;/span&gt;&#xA;where we maximize over all possible &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit measurements and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit states &lt;span class=&quot;math-container&quot;&gt;$\tau$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}^*_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tau^*$&lt;/span&gt; be the optimal choice for this maximization.&lt;/p&gt;&#xA;&lt;p&gt;Now back to the full problem. Let &lt;span class=&quot;math-container&quot;&gt;$\tilde \rho_n := \frac{\rho_n}{p(n)}$&lt;/span&gt; be the normalized version of &lt;span class=&quot;math-container&quot;&gt;$\rho_n$&lt;/span&gt;. Taking the maximum over all measurements and states we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\max_{\mathcal{B}, \rho} \mathrm{Tr}[\mathcal{B} \rho] &amp;amp;= \max_{\mathcal{B}_n, \rho_n} \sum_n \mathrm{Tr}[\mathcal{B}_n \rho_n] \\&#xA;&amp;amp;= \max_{\mathcal{B}_n, \tilde{\rho}_n, p(n)} \sum_n p(n) \mathrm{Tr}[\mathcal{B}_n \tilde\rho_n] \\&#xA;&amp;amp;\leq \max_{p(n)} \sum_n p(n) \max_{\mathcal{B}_n, \tilde{\rho}_n} \mathrm{Tr}[\mathcal{B}_n \tilde\rho_n] \\&#xA;&amp;amp; = \max_{p(n)} \sum_n p(n) \mathrm{Tr}[\mathcal{B}_0^* \tau^*] \\&#xA;&amp;amp; = \mathrm{Tr}[\mathcal{B}_0^* \tau^*]&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$\max \mathrm{Tr}[\mathcal{B}_n \tilde\rho_n]$&lt;/span&gt; is effectively an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit problem as the operators in the trace have support only on some &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit subspace and that &lt;span class=&quot;math-container&quot;&gt;$(\mathcal{B}_0^*, \tau)$&lt;/span&gt; is the optimizer of the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit problem. Then on the final line we just have &lt;span class=&quot;math-container&quot;&gt;$\sum_n p(n) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So we have found that the maximum Bell-value can always be upper bounded by the maximum Bell-value for an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit system hence it is sufficient to consider an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit system when considering the maximum Bell-value. And moreoever, the maximum Bell-value can always be achieved by an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit system.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-12-15T15:39:06.080" LastActivityDate="2020-12-15T15:39:06.080" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15140" PostTypeId="1" CreationDate="2020-12-14T22:38:50.733" Score="4" ViewCount="121" Body="&lt;p&gt;I'm learning VQE(variational quantum eigensolver) of qiskit, but I have a question about how it measures the expected value of the energy (&lt;span class=&quot;math-container&quot;&gt;$\left \langle H \right \rangle$&lt;/span&gt;). I saw in other question and they comment that qiskit use &lt;span class=&quot;math-container&quot;&gt;$\left \langle H \right \rangle = \langle \psi | H |\psi \rangle = \sum_{i} \lambda_{i} P_{i} $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P_{i}=|\langle \phi_{i}|\psi \rangle|^2$&lt;/span&gt;. 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?&lt;/p&gt;&#xA;" OwnerUserId="14171" LastEditorUserId="13647" LastEditDate="2020-12-15T03:56:28.423" LastActivityDate="2020-12-15T03:56:28.423" Title="Expected value in a VQE qiskit" Tags="&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15141" PostTypeId="2" ParentId="15140" CreationDate="2020-12-15T01:12:35.983" Score="2" Body="&lt;p&gt;The output of variational quantum eigensolver(VQE) is a number(the ground state energy of molecules), see &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit document&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum state tomography&lt;/a&gt;(an expensive technique). For example, for a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state, mathematically it can be described by a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; dimensional normed-one vector, and what state tomography do is to extract all these, say numbers.&lt;/p&gt;&#xA;&lt;p&gt;So if you are &lt;strong&gt;using a classical computer to simulate a quantum computer&lt;/strong&gt;, then VQE is not useful because you do have all the matrices and vectors. But if you are &lt;strong&gt;using real quantum devices&lt;/strong&gt; then to avoid the resource-consuming quantum tomography then you have to choose your target wisely.&lt;/p&gt;&#xA;&lt;p&gt;I am new to the field of quantum tomography, so if you have problems or my statement is confusing, give me some time, please.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-12-15T01:12:35.983" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15142" PostTypeId="1" AcceptedAnswerId="15172" CreationDate="2020-12-15T04:31:12.000" Score="5" ViewCount="91" Body="&lt;p&gt;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). &lt;a href=&quot;https://doi.org/10.1038/nature09416&quot; rel=&quot;noreferrer&quot;&gt;https://doi.org/10.1038/nature09416&lt;/a&gt; (open access preprint: &lt;a href=&quot;https://arxiv.org/abs/1004.4324&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1004.4324&lt;/a&gt;) and came across a quantum circuit symbol that I did not recognize and couldn't find online.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b2tz8.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b2tz8.png&quot; alt=&quot;Figure 3a&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am wondering about the symbols after the zero kets, before the rotation gates. The caption reads, &amp;quot;Gate sequences producing states with increasing number of entangled qubits: (a) the ground state (no entanglement)&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="119" LastEditDate="2020-12-15T04:36:39.947" LastActivityDate="2020-12-17T00:28:58.910" Title="Unknown quantum circuit symbol" Tags="&lt;quantum-operation&gt;&lt;tomography&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15144" PostTypeId="1" CreationDate="2020-12-15T07:46:35.673" Score="6" ViewCount="546" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hqrqD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hqrqD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="8901" LastActivityDate="2021-04-24T06:07:25.680" Title="My IBM quantum account has been disabled" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15145" PostTypeId="2" ParentId="9956" CreationDate="2020-12-15T09:58:08.093" Score="0" Body="&lt;p&gt;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 &lt;a href=&quot;https://arxiv.org/abs/2003.01664&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; (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.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2020-12-15T09:58:08.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15146" PostTypeId="2" ParentId="14139" CreationDate="2020-12-15T10:01:41.500" Score="1" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://arxiv.org/abs/2007.10515&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Generic Compilation Strategy for the Unitary Coupled Cluster Ansatz&lt;/a&gt; they benchmark on a bunch of chemistry circuits that can be found &lt;a href=&quot;https://github.com/CQCL/tket_benchmarking/tree/master/compilation_strategy/TLOS_qasm_files&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. 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.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2020-12-15T10:01:41.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15147" PostTypeId="1" CreationDate="2020-12-15T14:55:02.327" Score="2" ViewCount="35" Body="&lt;p&gt;What are advantages of a fault-tolerant qudit computation compared with fault-tolerant quantum computation for qubits?&lt;/p&gt;&#xA;" OwnerUserId="5693" LastEditorUserId="8141" LastEditDate="2020-12-15T15:35:04.510" LastActivityDate="2020-12-15T15:35:04.510" Title="Fault-tolerant qudit computation: advantage?" Tags="&lt;fault-tolerance&gt;&lt;qudit&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ClosedDate="2020-12-17T14:12:50.850" ContentLicense="CC BY-SA 4.0" />
  <row Id="15149" PostTypeId="1" AcceptedAnswerId="15150" CreationDate="2020-12-15T17:47:26.110" Score="7" ViewCount="104" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{ABC}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{C}$&lt;/span&gt; be arbitrary quantum states and &lt;span class=&quot;math-container&quot;&gt;$\lambda\in \mathbb{R}$&lt;/span&gt; be minimal such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{ABC}\leq \lambda \rho_{AB}\otimes\sigma_C$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We assume there are no issues with support in the above statement to avoid infinities. Now, one traces out the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; register. Let &lt;span class=&quot;math-container&quot;&gt;$\mu\in \mathbb{R}$&lt;/span&gt; be minimal so that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{AC}\leq \mu\rho_A\otimes \sigma_C$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Clearly, &lt;span class=&quot;math-container&quot;&gt;$\lambda\geq\mu$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\lambda = \mu$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14178" LastEditorUserId="55" LastEditDate="2020-12-21T09:56:18.727" LastActivityDate="2020-12-21T09:56:18.727" Title="Positive semidefinite relationship after partial trace" Tags="&lt;quantum-operation&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15150" PostTypeId="2" ParentId="15149" CreationDate="2020-12-15T18:55:04.413" Score="9" Body="&lt;p&gt;No, not necessarily. For example, take &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to be a GHZ state and let &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; be the completely mixed state of one qubit. We then have &lt;span class=&quot;math-container&quot;&gt;$\lambda=4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu=2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1764" LastActivityDate="2020-12-15T18:55:04.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15151" PostTypeId="1" AcceptedAnswerId="15152" CreationDate="2020-12-15T19:38:57.077" Score="2" ViewCount="72" Body="&lt;p&gt;The Renyi entropy of order &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, for a discrete probability distribution &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_{\beta}(p) = \frac{1}{1 - \beta} ~\log \left( \sum_{i \in S} p(i)^{\beta} \right),&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the set of all strings in the support of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As is mentioned &lt;a href=&quot;https://perimeterinstitute.ca/personal/tfritz/2015/entropy.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, for two discrete distributions &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; the Renyi entropy of the product distribution &lt;span class=&quot;math-container&quot;&gt;$p \times r$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_{\beta}(p \times r) = H_{\beta}(p) + H_{\beta}(r).&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What might be a proof of this fact?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2020-12-15T20:30:04.017" Title="Additivity of Renyi entropy" Tags="&lt;entropy&gt;&lt;information-theory&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15152" PostTypeId="2" ParentId="15151" CreationDate="2020-12-15T20:30:04.017" Score="4" Body="&lt;p&gt;This only holds if the two distributions are independent. In this case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;H_{\beta}(p \times q) &amp;amp;= \frac{1}{1-\beta} \log\left( \sum_{i,j}(p(i) q(j))^{\beta} \right) \\&#xA;&amp;amp;= \frac{1}{1-\beta} \log\left( \left(\sum_{i}p(i)^{\beta}\right) \left(\sum_jq(j)^{\beta}\right) \right) \\&#xA;&amp;amp;= \frac{1}{1-\beta} \left(\log \left(\sum_{i}p(i)^{\beta}\right) + \log \left(\sum_{j}q(j)^{\beta}\right)\right) \\&#xA;&amp;amp;= H_{\beta}(p) + H_{\beta}(q) .&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2020-12-15T20:30:04.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15154" PostTypeId="1" AcceptedAnswerId="15155" CreationDate="2020-12-15T23:39:51.070" Score="2" ViewCount="57" Body="&lt;p&gt;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 &lt;code&gt;Aer.get_backend('qasm_simulator')&lt;/code&gt;, it seems to give an error &lt;code&gt;'numpy.float64' object is not iterable&lt;/code&gt;. Please see the minimal working code and the error message below. This is rather confusing, because the backend &lt;code&gt;BasicAer.get_backend('statevector_simulator')&lt;/code&gt; works perfectly fine. Thanks for the help!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.algorithms import VQE, NumPyEigensolver&#xA;&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;from qiskit import Aer, BasicAer&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.aqua.operators import Z2Symmetries&#xA;from qiskit.aqua.components.optimizers import L_BFGS_B&#xA;&#xA;optimizer = L_BFGS_B()&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;# backend = BasicAer.get_backend('statevector_simulator')&#xA;&#xA;atom='H .0 .0 .0; H .0 .0 0.74'&#xA;map_type = 'parity'&#xA;&#xA;driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, basis='sto3g')    &#xA;molecule = driver.run()&#xA;&#xA;num_alpha = molecule.num_alpha &#xA;num_beta = molecule.num_beta     &#xA;#     num_particles = molecule.num_alpha + molecule.num_beta&#xA;num_particles = [ num_alpha , num_beta ] &#xA;num_spin_orbitals = molecule.num_orbitals * 2&#xA;ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)&#xA;&#xA;numOp = ferOp.total_particle_number()        &#xA;&#xA;qubitOp = ferOp.mapping(map_type=map_type)&#xA;&#xA;qubitNumOp = numOp.mapping(map_type=map_type )&#xA;&#xA;qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)    &#xA;qubitNumOp = Z2Symmetries.two_qubit_reduction(qubitNumOp, num_particles)&#xA;&#xA;print('Ground state energy without shift is ' , NumPyEigensolver( qubitOp , k=2 ).run().eigenvalues.real )&#xA;&#xA;&#xA;init_state = HartreeFock( num_spin_orbitals , num_particles , map_type )&#xA;print( 'HF =  ' , init_state.bitstr )&#xA;&#xA;# setup the variational form for VQE&#xA;&#xA;&#xA;&#xA;var_form_vqe = UCCSD(&#xA;        num_orbitals=num_spin_orbitals,&#xA;        num_particles=num_particles,&#xA;        initial_state=init_state,&#xA;        qubit_mapping=map_type , &#xA;        two_qubit_reduction = True , &#xA;    )&#xA;&#xA;&#xA;algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer , aux_operators = [qubitNumOp] )&#xA;&#xA;result_vqe = algorithm_vqe.run(backend)&#xA;&#xA;&#xA;print( 'para_vqe = ' , result_vqe['optimal_point' ] )&#xA;&#xA;print( 'eigenvalue_vqe = ' , result_vqe['eigenvalue' ].real )&#xA;&#xA;print( result_vqe  )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;error message is attached below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;TypeError                                 Traceback (most recent call last)&#xA;&amp;lt;ipython-input-1-5fb4d9ac0b3c&amp;gt; in &amp;lt;module&amp;gt;&#xA;     59 algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer , aux_operators = [qubitNumOp] )&#xA;     60 &#xA;---&amp;gt; 61 result_vqe = algorithm_vqe.run(backend)&#xA;     62 &#xA;     63 &#xA;&#xA;~/&amp;lt;redacted&amp;gt;/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)&#xA;     68                 self.quantum_instance = quantum_instance&#xA;     69 &#xA;---&amp;gt; 70         return self._run()&#xA;     71 &#xA;     72     @abstractmethod&#xA;&#xA;~/&amp;lt;redacted&amp;gt;/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in _run(self)&#xA;    425 &#xA;    426         if self.aux_operators:&#xA;--&amp;gt; 427             self._eval_aux_ops()&#xA;    428             # TODO remove when ._ret is deprecated&#xA;    429             result.aux_operator_eigenvalues = self._ret['aux_ops'][0]&#xA;&#xA;~/&amp;lt;redacted&amp;gt;/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in _eval_aux_ops(self, threshold)&#xA;    445         # Deal with the aux_op behavior where there can be Nones or Zero qubit Paulis in the list&#xA;    446         self._ret['aux_ops'] = [None if is_none else [result]&#xA;--&amp;gt; 447                                 for (is_none, result) in zip(self._aux_op_nones, aux_op_results)]&#xA;    448         self._ret['aux_ops'] = np.array([self._ret['aux_ops']])&#xA;    449 &#xA;&#xA;TypeError: 'numpy.float64' object is not iterable&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="1859" LastEditDate="2020-12-17T12:39:43.917" LastActivityDate="2020-12-17T12:39:43.917" Title="Is it possible to measure &quot;aux_operators&quot; in built-in VQE with backend &quot;qasm_simulator&quot;" Tags="&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15155" PostTypeId="2" ParentId="15154" CreationDate="2020-12-16T00:53:41.767" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\langle \psi^{optimal} | O_{particle \ number} |\psi^{optimal} \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.algorithms import VQE, NumPyEigensolver&#xA;&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;from qiskit import Aer, BasicAer&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.aqua.operators import Z2Symmetries&#xA;from qiskit.aqua.components.optimizers import L_BFGS_B&#xA;&#xA;optimizer = L_BFGS_B()&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;# backend = BasicAer.get_backend('statevector_simulator')&#xA;&#xA;atom='H .0 .0 .0; H .0 .0 0.74'&#xA;map_type = 'parity'&#xA;&#xA;driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, basis='sto3g')    &#xA;molecule = driver.run()&#xA;&#xA;num_alpha = molecule.num_alpha &#xA;num_beta = molecule.num_beta     &#xA;#     num_particles = molecule.num_alpha + molecule.num_beta&#xA;num_particles = [ num_alpha , num_beta ] &#xA;num_spin_orbitals = molecule.num_orbitals * 2&#xA;ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)&#xA;&#xA;numOp = ferOp.total_particle_number()        &#xA;&#xA;qubitOp = ferOp.mapping(map_type=map_type)&#xA;&#xA;qubitNumOp = numOp.mapping(map_type=map_type )&#xA;&#xA;qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)    &#xA;qubitNumOp = Z2Symmetries.two_qubit_reduction(qubitNumOp, num_particles)&#xA;&#xA;print('Ground state energy without shift is ' , NumPyEigensolver( qubitOp , k=2 ).run().eigenvalues.real )&#xA;&#xA;&#xA;init_state = HartreeFock( num_spin_orbitals , num_particles , map_type )&#xA;print( 'HF =  ' , init_state.bitstr )&#xA;&#xA;# setup the variational form for VQE&#xA;&#xA;&#xA;&#xA;var_form_vqe = UCCSD(&#xA;        num_orbitals=num_spin_orbitals,&#xA;        num_particles=num_particles,&#xA;        initial_state=init_state,&#xA;        qubit_mapping=map_type , &#xA;        two_qubit_reduction = True , &#xA;    )&#xA;&#xA;&#xA;algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer ,  include_custom = True )&#xA;from qiskit.aqua import QuantumInstance&#xA;quantum_instance = QuantumInstance(backend = backend, shots= 10000, optimization_level= 3)&#xA;result_vqe = algorithm_vqe.run(quantum_instance)&#xA;&#xA;&#xA;print( 'para_vqe = ' , result_vqe['optimal_point' ] )&#xA;print('VQE energy =', result_vqe['optimal_value'] )&#xA;print('eigenstate:', result_vqe['eigenstate'])&#xA;&#xA;print('**************** Finding Particle Number *************************')&#xA;from qiskit.aqua.components.optimizers import COBYLA&#xA;optimizer = COBYLA(maxiter= 0,tol=0.0001)   &#xA;initial_point = result_vqe['optimal_point' ]&#xA;particle_number_vqe = VQE(qubitNumOp, var_form_vqe, optimizer , include_custom = True, initial_point = initial_point )&#xA;particle_number = particle_number_vqe.run(quantum_instance)&#xA;print( 'Particle_number = ' , particle_number['optimal_value'] )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Ground state energy without shift is  [-1.85238817 -1.2458777 ]&#xA;HF =   [False  True]&#xA;para_vqe =  [-7.22409784e-09  1.35083082e-08 -1.12782817e-01]&#xA;VQE energy = -1.852388173569581&#xA;eigenstate: {'01': 9888, '10': 112}&#xA;**************** Finding Particle Number *************************&#xA;Particle_number =  1.999999999999998&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-16T00:53:41.767" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="15156" PostTypeId="1" AcceptedAnswerId="15157" CreationDate="2020-12-16T08:08:58.550" Score="2" ViewCount="217" Body="&lt;p&gt;I have one qubit and I apply two gates to it: H and T, which yields the following superposition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}} |0\rangle + \frac{1+i}{2}|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now I want to calculate probability of 0 and 1 state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(A_1\right)^2 = \left(\frac{1}{\sqrt{2}}\right)^2 = \frac{1}{2}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(A_2\right)^2 = \left(\frac{i+1}{2}\right)^2 = \frac{i}{2}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S = \left(A_1\right)^2 + \left(A_2\right)^2 = \frac{1+i}{2}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(A_i) = \frac{A_i^2}{S}&#xA;$$&lt;/span&gt;&#xA;according to prior equations i receive following values&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(0) = \frac{1}{1+i}  \land  P(1) = \frac{i}{i+1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was expecting to get &lt;span class=&quot;math-container&quot;&gt;$A_i=0.5$&lt;/span&gt; however &lt;span class=&quot;math-container&quot;&gt;$P(0) + P(1) = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I interpret this results?&lt;/p&gt;&#xA;" OwnerUserId="14183" LastEditorUserId="10480" LastEditDate="2020-12-16T11:51:56.367" LastActivityDate="2020-12-16T12:29:23.440" Title="How to interpret complex probability of superposition state?" Tags="&lt;quantum-state&gt;&lt;probability&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15157" PostTypeId="2" ParentId="15156" CreationDate="2020-12-16T08:28:02.257" Score="4" Body="&lt;p&gt;You forgot to take the absolute value.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born rule&lt;/a&gt; for computing measurement outcome probability from the state vector amplitudes says that the probability is the square of the &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Absolute_value#Complex_numbers&quot; rel=&quot;nofollow noreferrer&quot;&gt;magnitude&lt;/a&gt;&lt;/em&gt; of the amplitude.&lt;/p&gt;&#xA;&lt;p&gt;In your case, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(A_1\right)^2 = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left(A_2\right)^2 = \left|\frac{i+1}{2}\right|^2 = \left(\frac{\sqrt{2}}{2}\right)^2 =\frac{1}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as expected.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-16T08:28:02.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15158" PostTypeId="1" AcceptedAnswerId="15159" CreationDate="2020-12-16T10:56:41.947" Score="3" ViewCount="39" Body="&lt;p&gt;From the two main generalizations of the von Neumann entropy:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;S(\rho)=-\operatorname{Tr}(\rho \log \rho)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;meaning Rényi:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;R_{\alpha}(\rho)=\frac{1}{1-\alpha} \log \operatorname{Tr}\left(\rho^{\alpha}\right), \alpha \in(0,1) \cup(1, \infty)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and Tsallis:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;T_{q}(\rho)=\frac{1}{1-q}\left(\operatorname{Tr}\left(\rho^{q}\right)-1\right), q \in(0,1) \cup(1, \infty)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;we know that in both cases the limit to 1 for the entropic parameters gives us back the von Neumann entropy:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;S(\rho)=\lim _{q \rightarrow 1} T_{q}(\rho)=\lim _{\alpha \rightarrow 1} R_{\alpha}(\rho).&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the case of the quantum Rényi entropy we also know its two limits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;R_{0}(\rho)=\lim _{\alpha \rightarrow 0} R_{\alpha}(\rho)=\log \operatorname{rank}(\rho)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;R_{\infty}(\rho)=\lim _{\alpha \rightarrow \infty} R_{\alpha}(\rho)=-\log \|\rho\|.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I couldn't find anything similar for the quantum Tsallis case? Is there something that is considered trivial?&lt;/p&gt;&#xA;" OwnerUserId="14166" LastEditorUserId="12541" LastEditDate="2020-12-16T12:58:59.133" LastActivityDate="2020-12-16T12:59:55.347" Title="Do we know the limits of the quantum Tsallis entropy?" Tags="&lt;entropy&gt;&lt;max-entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15159" PostTypeId="2" ParentId="15158" CreationDate="2020-12-16T11:46:19.010" Score="1" Body="&lt;p&gt;Well for &lt;span class=&quot;math-container&quot;&gt;$q \to 0$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lim_{q \to 0} T_q(\rho) = \mathrm{rank}(\rho) - 1.&#xA;$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$q \to \infty$&lt;/span&gt; it's not really interesting as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lim_{q \to \infty} T_{q}(\rho) = 0.&#xA;$$&lt;/span&gt;&#xA;For the second result note &lt;span class=&quot;math-container&quot;&gt;$\lim_{q\to\infty} \mathrm{Tr}[\rho^q] \leq \lim_{q \to \infty} \mathrm{rank}(\rho)\lambda_{\max}(\rho)^q \leq 1$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a quantum state. And so the numerator is finite but the denominator blows up to &lt;span class=&quot;math-container&quot;&gt;$-\infty$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2020-12-16T12:59:55.347" LastActivityDate="2020-12-16T12:59:55.347" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15160" PostTypeId="2" ParentId="15156" CreationDate="2020-12-16T12:29:23.440" Score="4" Body="&lt;p&gt;Just to note that the complex number also specify a quantum phase of a qubit. In this particular case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1+i}{2} = \frac{1}{\sqrt{2}}\mathrm{e}^{i\frac{\pi}{4}},&#xA;$$&lt;/span&gt;&#xA;so the relative phase is &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can rewrite your qubit state as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \frac{1}{\sqrt{2}}(|0\rangle + \mathrm{e}^{i\frac{\pi}{4}} |1\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, you easily see that probability of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} = \Big(\frac{1}{\sqrt{2}}\Big)^2$&lt;/span&gt; in both cases and the phase is &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-16T12:29:23.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15161" PostTypeId="1" CreationDate="2020-12-16T13:09:26.480" Score="1" ViewCount="74" Body="&lt;p&gt;If Grover algorithm has a better speed than classical search algorithms, would it be an example of where Quantum computers outruns classical computers?&lt;/p&gt;&#xA;&lt;p&gt;Can we use Grover Algorithm in real world problems?&lt;/p&gt;&#xA;" OwnerUserId="13294" LastEditorUserId="9006" LastEditDate="2020-12-16T14:38:28.377" LastActivityDate="2020-12-16T14:38:28.377" Title="Grover Algorithm vs Classical Search Algorithms" Tags="&lt;grovers-algorithm&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15162" PostTypeId="2" ParentId="15161" CreationDate="2020-12-16T14:38:13.097" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-16T14:38:13.097" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15163" PostTypeId="1" CreationDate="2020-12-16T14:54:40.790" Score="2" ViewCount="226" Body="&lt;p&gt;I tried to implement the traveling salesman problem (TSP) using QAOA with qiskit. I worked with &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/6_examples_max_cut_and_tsp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this qiskit QAOA tutorial&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/3_minimum_eigen_optimizer.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this qiskit minimum eigen optimizer tutorial&lt;/a&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p=2$&lt;/span&gt;, both versions give me the same wrong result. I also used the &lt;code&gt;qasm_simulator&lt;/code&gt;instead of the &lt;code&gt;statevector_simulator&lt;/code&gt;, since for 16 qubits the latter is infeasable.&lt;/p&gt;&#xA;&lt;p&gt;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-&amp;gt;2-&amp;gt;3 and no city visited in fourth time step).&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know, why this slight change in the problem makes the algorithm fail? Is there anything wrong in my code?&lt;/p&gt;&#xA;&lt;p&gt;My code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer&#xA;from qiskit.optimization.applications.ising import tsp&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, QAOA&#xA;from qiskit.aqua import aqua_globals, QuantumInstance&#xA;from qiskit.optimization.algorithms import MinimumEigenOptimizer&#xA;from qiskit.optimization.problems import QuadraticProgram&#xA;&#xA;# Generating a TSP instance of n cities&#xA;n = 4&#xA;num_qubits = n ** 2&#xA;ins = tsp.random_tsp(n, seed=123)&#xA;print('distance\n', ins.w)&#xA;&#xA;# Create a random TSP Hamiltonian&#xA;qubitOp, offset = tsp.get_operator(ins)&#xA;qp = QuadraticProgram()&#xA;qp.from_ising(qubitOp, offset, linear=True)&#xA;&#xA;aqua_globals.random_seed = 10598&#xA;quantum_instance = QuantumInstance(Aer.get_backend('qasm_simulator'),&#xA;                                   seed_simulator=aqua_globals.random_seed,&#xA;                                   seed_transpiler=aqua_globals.random_seed)&#xA;qaoa_mes = QAOA(quantum_instance=quantum_instance, initial_point=[0., 0.])&#xA;exact_mes = NumPyMinimumEigensolver()&#xA;&#xA;# solving Quadratic Program using exact classical eigensolver&#xA;exact = MinimumEigenOptimizer(exact_mes)&#xA;exact_result = exact.solve(qp)&#xA;print(&amp;quot;\nExact:\n&amp;quot;, exact_result)&#xA;&#xA;# solving the Problem using QAOA&#xA;qaoa = MinimumEigenOptimizer(qaoa_mes) &#xA;qaoa_result = qaoa.solve(qp)&#xA;print(&amp;quot;\nQAOA:\n&amp;quot;, qaoa_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As a result I get:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;distance&#xA; [[ 0. 48. 91. 33.]&#xA; [48.  0. 63. 71.]&#xA; [91. 63.  0. 92.]&#xA; [33. 71. 92.  0.]]&#xA;&#xA;Exact:&#xA;optimal function value: 236.0&#xA;optimal value: [0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0.]&#xA;status: SUCCESS&#xA;&#xA;QAOA:&#xA;optimal function value: 200111.0&#xA;optimal value: [1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]&#xA;status: SUCCESS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13925" LastEditorUserId="13925" LastEditDate="2020-12-16T15:23:53.060" LastActivityDate="2020-12-16T15:23:53.060" Title="qiskit: Traveling Salesman Problem using QAOA fails for more than 3 cities" Tags="&lt;qiskit&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15164" PostTypeId="2" ParentId="5096" CreationDate="2020-12-16T17:50:30.830" Score="0" Body="&lt;p&gt;Q# now has a &lt;code&gt;BigInt&lt;/code&gt; type included: &lt;a href=&quot;https://docs.microsoft.com/en-us/quantum/user-guide/language/typesystem/#available-types&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/quantum/user-guide/language/typesystem/#available-types&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-12-16T17:50:30.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15165" PostTypeId="2" ParentId="15138" CreationDate="2020-12-16T18:54:26.233" Score="1" Body="&lt;p&gt;@gIS's comment effectively answers the question, but to provide a bit more detail Aaronson at &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=5159&quot; rel=&quot;nofollow noreferrer&quot;&gt;shtetl-optimized&lt;/a&gt; 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 (&lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;/&lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;) perspective of quantum computation.&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;a state that’s exponential in some quadratic polynomial in the creation operators&amp;quot;, which is (apparently) significantly easier to tune.&lt;/p&gt;&#xA;&lt;p&gt;It's not clear to me yet whether in the end this corresponds to a &amp;quot;continuous variable approach&amp;quot; mentioned in the question.  Nonetheless, as the OP suggests it is very likely that neither (Fock state) Boson Sampling nor Gaussian Boson Sampling are &lt;em&gt;universal&lt;/em&gt; in the sense of being able to perform arbitrary functions.  Indeed, quantum machines that perform Boson Sampling may not even be &lt;em&gt;classically&lt;/em&gt; universal, much less capable of performing arbitrary quantum computations.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2020-12-20T16:00:33.790" LastActivityDate="2020-12-20T16:00:33.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15166" PostTypeId="1" AcceptedAnswerId="15167" CreationDate="2020-12-16T21:33:37.767" Score="2" ViewCount="68" Body="&lt;p&gt;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 &lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/aqua/vqe_convergence.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/aqua/vqe_convergence.ipynb&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab&#xA;&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;from qiskit.aqua import QuantumInstance, aqua_globals&#xA;from qiskit.aqua.algorithms import VQE, NumPyMinimumEigensolver&#xA;from qiskit.aqua.components.initial_states import Zero&#xA;from qiskit.aqua.components.optimizers import COBYLA, L_BFGS_B, SLSQP&#xA;from qiskit.circuit.library import TwoLocal&#xA;&#xA;pauli_dict = {&#xA;    'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -1.052373245772859}, &amp;quot;label&amp;quot;: &amp;quot;II&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: 0.39793742484318045}, &amp;quot;label&amp;quot;: &amp;quot;ZI&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -0.39793742484318045}, &amp;quot;label&amp;quot;: &amp;quot;IZ&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -0.01128010425623538}, &amp;quot;label&amp;quot;: &amp;quot;ZZ&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: 0.18093119978423156}, &amp;quot;label&amp;quot;: &amp;quot;XX&amp;quot;}&#xA;              ]&#xA;}&#xA;&#xA;qubit_op = WeightedPauliOperator.from_dict(pauli_dict)&#xA;&#xA;&#xA;num_qubits = qubit_op.num_qubits&#xA;init_state = Zero(num_qubits)&#xA;var_form = TwoLocal(num_qubits, 'ry', 'cz', initial_state=init_state)&#xA;&#xA;counts = []&#xA;values = []&#xA;para = []&#xA;def store_intermediate_result(eval_count, parameters, mean, std):&#xA;    counts.append(eval_count)&#xA;    values.append(mean)&#xA;    para.append( parameters )&#xA;&#xA;algo = VQE(qubit_op, var_form, COBYLA(), callback=store_intermediate_result)&#xA;backend = BasicAer.get_backend('statevector_simulator')&#xA;quantum_instance = QuantumInstance(backend=backend)  &#xA;algo_result = algo.run(quantum_instance)&#xA;&#xA;counts = np.asarray(counts)&#xA;values = np.asarray(values)&#xA;para = np.asarray( para )&#xA;&#xA;# print( 'counts' , counts )&#xA;# print( 'values' , values )&#xA;print( para) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is in fact exactly the same code as in this answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12066/vqe-restart-from-a-previous-computation/12524#12524&quot;&gt;VQE restart from a previous computation&lt;/a&gt; (I have also browsed other answers with keyword &amp;quot;callback&amp;quot;), 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?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512&#xA;   6.81040957  3.23410408]&#xA; [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512&#xA;   6.81040957  3.23410408]&#xA; [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512&#xA;   6.81040957  3.23410408]&#xA; [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512&#xA;   6.81040957  3.23410408]&#xA; [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512&#xA;   6.81040957  3.23410408] ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="9006" LastEditDate="2020-12-17T07:29:23.093" LastActivityDate="2020-12-19T19:05:29.203" Title="Callback function in VQE do not return the intermediate values of the parameters" Tags="&lt;qiskit&gt;&lt;vqe&gt;&lt;callback&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15167" PostTypeId="2" ParentId="15166" CreationDate="2020-12-16T22:49:57.563" Score="1" Body="&lt;p&gt;&lt;strong&gt;Not an answer&lt;/strong&gt; to your issue but it is too long for comment so I put it here.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Very interesting. One thing for sure, if you print out the parameters at each optimization step, then you can see it.&lt;/p&gt;&#xA;&lt;p&gt;You can do this by adding a an extra line to the &lt;code&gt;store_intermediate_result&lt;/code&gt; function definition.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def store_intermediate_result(eval_count, parameters, mean, std):&#xA;    counts.append(eval_count)&#xA;    values.append(mean)&#xA;    para.append( parameters )&#xA;    print(parameters) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If I do this then I can see the changes in the parameters. For example, with two iterations:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[-4.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001&#xA;  4.19536837  4.18612614]&#xA;[-3.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001&#xA;  4.19536837  4.18612614]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But if I print-out the &lt;code&gt;para&lt;/code&gt; variable then I get the same thing you got:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[-3.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001&#xA;   4.19536837  4.18612614]&#xA; [-3.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001&#xA;   4.19536837  4.18612614]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-16T22:49:57.563" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15168" PostTypeId="1" AcceptedAnswerId="15176" CreationDate="2020-12-16T23:12:23.613" Score="5" ViewCount="115" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}$&lt;/span&gt; be a classical-quantum state, i.e., &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}  = \sum_{x} p(x)  |x\rangle \langle x|  \otimes \rho_A^x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How to prove that the conditional von Neumann entropy &lt;span class=&quot;math-container&quot;&gt;$S(X|A) = S(\rho_{XA}) - S(\rho_A)$&lt;/span&gt; is non-negative?&lt;/p&gt;&#xA;" OwnerUserId="13709" LastEditorUserId="55" LastEditDate="2020-12-21T23:37:56.593" LastActivityDate="2020-12-21T23:37:56.593" Title="Prove that the conditional entropy of a classical-quantum state is non-negative" Tags="&lt;quantum-state&gt;&lt;entropy&gt;&lt;information-theory&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15169" PostTypeId="1" AcceptedAnswerId="15171" CreationDate="2020-12-16T23:47:48.107" Score="4" ViewCount="238" Body="&lt;p&gt;Suppose I have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U^2=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The projection operators with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$−1$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$P_+$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_-$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How can I prove that &lt;span class=&quot;math-container&quot;&gt;$P_+=\frac{1}{2}(1+U)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_-=\frac{1}{2}(1-U)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I think &lt;span class=&quot;math-container&quot;&gt;$\sum P=1$&lt;/span&gt; but I have no idea to get this conclusion.&lt;/p&gt;&#xA;" OwnerDisplayName="user13341" LastEditorUserId="55" LastEditDate="2020-12-19T19:37:55.890" LastActivityDate="2020-12-19T19:37:55.890" Title="How do I prove that $P_\pm=\frac12(1\pm U)$ if $U^2=I$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;projection-operator&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15170" PostTypeId="1" CreationDate="2020-12-17T00:25:42.377" Score="3" ViewCount="55" Body="&lt;p&gt;When I specify the RX or RY gate to rotate by say &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; in the circuit composer, the gate disappears off the circuit. Is there any reason why if I leave it with &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; default then it stays?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;If I edit theta the gate disappears.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here's some screenshots to show what happens:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6cwFS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6cwFS.png&quot; alt=&quot;I add the gate RX the default Theta is pi/2 &quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/nQUqL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nQUqL.png&quot; alt=&quot;I double click on the gate and change Theta to pi/4&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/7pzpY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7pzpY.png&quot; alt=&quot;ave/implement the change I click on &amp;quot;Your circuit&amp;quot; to go back to the circuit, and the gate is gone&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Ok solution is to erase the whole field &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; and reenter &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; but leaving &lt;span class=&quot;math-container&quot;&gt;$\pi/$&lt;/span&gt; and then denominator &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; will not work. Also the denominator is bounded between 1 and 9.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EZFWa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EZFWa.png&quot; alt=&quot;Update and disable &quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14191" LastEditorUserId="14209" LastEditDate="2020-12-20T14:02:50.750" LastActivityDate="2020-12-20T14:02:50.750" Title="Circuit composer RX or RY gate disappears" Tags="&lt;quantum-gate&gt;&lt;quantum-inspire&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15171" PostTypeId="2" ParentId="15169" CreationDate="2020-12-17T00:28:03.260" Score="5" Body="&lt;p&gt;First, we can start with &lt;span class=&quot;math-container&quot;&gt;$U = P_+ - P_-$&lt;/span&gt;, since the Hermitian is the sum of the projection operators of the eigenspaces scaled by their eigenvalues. If &lt;span class=&quot;math-container&quot;&gt;$U^2 = I$&lt;/span&gt;, that means &lt;span class=&quot;math-container&quot;&gt;$I = (P_+ - P_-)(P_+ - P_-) = P_+P_+ - P_+P_- - P_-P_+ + P_-P_-$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$P_+ + P_- = I$&lt;/span&gt;. With &lt;span class=&quot;math-container&quot;&gt;$P_+ + P_- = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_+ - P_- = U$&lt;/span&gt;, we can add the two equations to get &lt;span class=&quot;math-container&quot;&gt;$P_+ = \frac{1}{2}(I + U)$&lt;/span&gt; or subtract the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; from the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; to get &lt;span class=&quot;math-container&quot;&gt;$P_- = \frac{1}{2}(I - U)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2020-12-17T13:52:37.970" LastActivityDate="2020-12-17T13:52:37.970" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15172" PostTypeId="2" ParentId="15142" CreationDate="2020-12-17T00:28:58.910" Score="5" Body="&lt;p&gt;The picture has two parts: The first goes until the dots. It is simply three &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; states. (The ground state.)&lt;/p&gt;&#xA;&lt;p&gt;You will recognize that the same picture -- but &lt;em&gt;only&lt;/em&gt; until the dot -- is used in panel b) and c) of the same figure.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;At first, this was just my interpretation of the pictures, but then I re-read the caption carefully, and indeed, later it says: &lt;em&gt;&amp;quot;The state tomography sequence shown in a is also applied in b and c.&amp;quot;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;As to the symbol, this is simply the &amp;quot;connection&amp;quot; between the preparation and the measurement part, i.e., feeding the result of the preparation into the measurement device.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-12-17T00:28:58.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15173" PostTypeId="1" CreationDate="2020-12-17T01:05:55.323" Score="3" ViewCount="68" Body="&lt;p&gt;Can QAOA solve a &lt;strong&gt;constraint&lt;/strong&gt; binary optimization problem? QAOA is short for Quantum Approximate Optimization Algorithm. I read the information &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/qaoa.html&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But I'm not sure whether it can solve a &lt;strong&gt;constraint&lt;/strong&gt; binary optimization problem.&lt;/p&gt;&#xA;" OwnerUserId="14153" LastEditorUserId="9006" LastEditDate="2020-12-17T07:28:37.937" LastActivityDate="2020-12-17T07:28:37.937" Title="Can QAOA solve a constraint optimization problem?" Tags="&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15174" PostTypeId="5" CreationDate="2020-12-17T05:35:46.800" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_depolarizing_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Depolarizing channel&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}$&lt;/span&gt; is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{D}(\rho) = \lambda \rho + (1 - \lambda)\frac{I}{d}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the density matrix of the input state, &lt;span class=&quot;math-container&quot;&gt;$\lambda \in [-\frac{1}{d^2 - 1}, 1]$&lt;/span&gt; is a parameter and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the dimension of the Hilbert space of the system on which the channel acts. For an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit system, this is equivalent to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{D}(\rho) = (1 - p) \rho + \frac{p}{4^n-1}\sum_{i=1}^{4^n-1} P_i \rho P_i^\dagger&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are non-identity &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-fold tensor products of the Pauli operators and &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the probability of a Pauli error occurring.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-17T11:08:33.297" LastActivityDate="2020-12-17T11:08:33.297" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15175" PostTypeId="4" CreationDate="2020-12-17T05:35:46.800" Score="0" Body="A model for noise in quantum systems such as a decohering qubit that has particularly nice symmetry properties. The depolarizing channel is a “worst-case scenario” channel. It assumes that we just completely&#xD;&#xA;lose the input qubit with some probability, i.e., it replaces the lost qubit with the maximally mixed&#xD;&#xA;state. " OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:49:41.967" LastActivityDate="2021-04-15T17:49:41.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15176" PostTypeId="2" ParentId="15168" CreationDate="2020-12-17T06:07:28.220" Score="3" Body="&lt;p&gt;We will use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_entropy#Properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;upper bound&lt;/a&gt; on the entropy of a mixture (for proof see for example theorem 11.10 on p.518 in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen &amp;amp; Chuang&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S\left(\sum_k p_k \rho_k\right) \leq H(p) + \sum_k p_k S(\rho_k)\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H(p) = -\sum_k p_k \log p_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Set &lt;span class=&quot;math-container&quot;&gt;$p_x := p(x)$&lt;/span&gt;. Note that if &lt;span class=&quot;math-container&quot;&gt;$|\psi_y^x\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho_A^x$&lt;/span&gt; associated to eigenvalue &lt;span class=&quot;math-container&quot;&gt;$q_y^x$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\otimes|\psi_y^x\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho_{XA}$&lt;/span&gt; associated to eigenvalue &lt;span class=&quot;math-container&quot;&gt;$p_x q_y^x$&lt;/span&gt;. Therefore&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;S(\rho_{XA}) &amp;amp;= -\sum_x \sum_y p_x q_y^x \log(p_x q_y^x) \\&#xA;&amp;amp;= -\sum_x p_x \log p_x - \sum_x p_x \sum_y q_y^x \log q_y^x \\&#xA;&amp;amp;= H(p) + \sum_x p_x S(\rho_A^x)\tag2.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, compute &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A = {\rm tr}_X \rho_{XA} = \sum_x p_x \rho_A^x&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho_A) = S\left(\sum_x p_x \rho_A^x\right)\tag3.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, recognize &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; as the left and right hand sides of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; with the appropriate substitution to get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S(\rho_A) \leq H(p) + \sum_x p_x S(\rho_A^x) \\&#xA;0 \leq S(\rho_{XA}) - S(\rho_A)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is the desired inequality.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-17T15:19:12.837" LastActivityDate="2020-12-17T15:19:12.837" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15177" PostTypeId="2" ParentId="15173" CreationDate="2020-12-17T06:52:47.280" Score="3" Body="&lt;p&gt;It can actually and this is done by adding penalties to include the constraints in the cost function. See &lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article on formulations of different problems&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There also exist an adaptation for constrained problems. See &lt;a href=&quot;https://arxiv.org/abs/1709.03489&quot; rel=&quot;nofollow noreferrer&quot;&gt;this articla on the Quantum Alternating Operator Ansatz&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2020-12-17T06:52:47.280" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15178" PostTypeId="1" CreationDate="2020-12-13T09:09:19.303" Score="2" ViewCount="107" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerDisplayName="Rasha rashed" LastEditorUserId="23" LastEditDate="2020-12-21T17:41:47.747" LastActivityDate="2021-01-07T10:13:37.640" Title="Quantum bit error rate" Tags="&lt;key-distribution&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15179" PostTypeId="1" AcceptedAnswerId="15182" CreationDate="2020-12-17T12:16:04.747" Score="2" ViewCount="145" Body="&lt;p&gt;I want to load a lognormal distribution and then use an IntegerComparator to flip a qubit (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) if its value is less than a threshold. Then I want to use an Quantum Amplitude Estimation algorithm to calculate the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My code so far is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;from qiskit import Aer, QuantumCircuit, QuantumRegister, execute&#xA;from qiskit.aqua.algorithms import IterativeAmplitudeEstimation&#xA;from qiskit.circuit.library import LogNormalDistribution, IntegerComparator&#xA;&#xA;&#xA;&#xA;num_uncertainty_qubits = 3&#xA;&#xA;S = 100&#xA;vol = 0.4&#xA;r = 0.04&#xA;T = 3*(30/365)&#xA;&#xA;&#xA;mu = np.log(S) + (r-0.5*vol**2)*T&#xA;sigma = vol*np.sqrt(T)&#xA;&#xA;mean = np.exp(mu - 0.5*sigma**2)&#xA;variance = (np.exp(sigma**2)-1)*np.exp(2*mu + sigma**2)&#xA;stddev = np.sqrt(variance)&#xA;&#xA;low = np.maximum(0, mean-3*stddev)&#xA;high = mean + 3*stddev&#xA;&#xA;uncertainty_model = LogNormalDistribution(num_uncertainty_qubits, mu=mu, sigma=sigma**2, bounds=(low, high))&#xA;&#xA;# 3 qubit LogNormalDistribution model&#xA;uncertainty_model = LogNormalDistribution(3, mu=mu, sigma=sigma, bounds=(low, high))&#xA;&#xA;# function to create the quantum circuit of the IntegerComparator and the uncertainty model&#xA;# x_eval is the threshold below which the qubit should be flipped&#xA;def get_cdf_circuit(x_eval):&#xA;    qr_state = QuantumRegister(uncertainty_model.num_qubits, 'state')&#xA;    qr_obj = QuantumRegister(1, 'obj')&#xA;    qr_comp = QuantumRegister(2, 'compare')&#xA;    state_preparation = QuantumCircuit(qr_state, qr_obj, qr_comp)&#xA;    &#xA;    state_preparation.append(uncertainty_model, qr_state)&#xA;    comparator = IntegerComparator(uncertainty_model.num_qubits, x_eval, geq=False)&#xA;    &#xA;    state_preparation.append(comparator, qr_state[:]+qr_obj[:]+qr_comp[:])&#xA;    &#xA;    return state_preparation&#xA;&#xA;# Function to implement the Amplitude Estimation algorithm&#xA;&#xA;def run_ae_for_cdf(x_eval, epsilon=0.01, alpha=0.05, simulator='qasm_simulator'):&#xA;&#xA;    state_preparation = get_cdf_circuit(x_eval)&#xA;&#xA;    ae_var = IterativeAmplitudeEstimation(state_preparation=state_preparation,&#xA;                                          epsilon=epsilon, alpha=alpha,&#xA;                                          objective_qubits=[len(qr_state)]) &#xA;    result_var = ae_var.run(quantum_instance=Aer.get_backend(simulator), shots=100)&#xA;    &#xA;    return result_var['estimation']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Broadly speaking, I want to flip the objective qubit to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if the state is less than or equal to x_eval.&lt;/p&gt;&#xA;&lt;p&gt;On running this, I'm getting the same amplitude estimation every time, even when I use different threshold values.&lt;/p&gt;&#xA;&lt;p&gt;I'm missing something. Please help me out.&lt;/p&gt;&#xA;&lt;p&gt;PS: &lt;a href=&quot;https://imgur.com/a/qAjzzEz&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://imgur.com/a/qAjzzEz&lt;/a&gt; This is the link to the QuantumCircuit. P(X) is the LogNormalDistribution and Cmp is the comparator.&lt;/p&gt;&#xA;&lt;p&gt;PPS: Using LinearAmplitudeFunction to compare floating numbers:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def get_comparator(threshold, num_qubits, low, high):&#xA;    breakpoints = [low, threshold]&#xA;    offsets = [0,0]&#xA;    slopes = [0,0]&#xA;    f_min = 1&#xA;    f_max = 0&#xA;    objective = LinearAmplitudeFunction(&#xA;        num_qubits,&#xA;        slopes,&#xA;        offsets,&#xA;        domain=(low, high),&#xA;        image=(f_min, f_max),&#xA;        breakpoints=breakpoints&#xA;    )&#xA;    return objective&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14198" LastEditorUserId="55" LastEditDate="2020-12-21T23:38:41.927" LastActivityDate="2020-12-21T23:38:41.927" Title="Computing the CDF with QAE in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;amplitude-amplification&gt;&lt;quantum-computing-for-finance&gt;&lt;quantum-circuit&gt;" AnswerCount="3" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15180" PostTypeId="1" CreationDate="2020-12-17T13:56:33.150" Score="1" ViewCount="61" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; different observables say &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and do &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is a large number) such measurements in time &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$(\frac{T}{2N})^2$&lt;/span&gt;. Is there something like this in the literature?&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="5045" LastEditDate="2020-12-20T10:22:32.230" LastActivityDate="2020-12-20T10:22:32.230" Title="Time accuracy required to reconstruct the density matrix?" Tags="&lt;measurement&gt;&lt;resource-request&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15181" PostTypeId="2" ParentId="15179" CreationDate="2020-12-17T20:09:01.510" Score="1" Body="&lt;p&gt;I am also working with &lt;code&gt;IterativeAmplitudeEstimation&lt;/code&gt; in &lt;code&gt;qiskit&lt;/code&gt;. I was able to run QAE for 'Credit Analysis with Quantum Computing' as described in&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/finance/09_credit_risk_analysis.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/finance/09_credit_risk_analysis.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;From which library are you loading &lt;code&gt;LogNormalDistribution&lt;/code&gt;? I use&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import IntegerComparator&#xA;from qiskit.aqua.algorithms.amplitude_estimators.iqae import IterativeAmplitudeEstimation&#xA;from qiskit.aqua.components.uncertainty_models import NormalDistribution&#xA;from qiskit.aqua.components.uncertainty_models import LogNormalDistribution&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I for example get the following error for &lt;code&gt;LogNormalDistribution&lt;/code&gt; when I load the model from  &lt;code&gt;qiskit.aqua.components.uncertainty_models&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;__init__() got an unexpected keyword argument 'bounds'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or &lt;code&gt;'LogNormalDistribution' object has no attribute 'num_qubits'&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope to get the libraries running to help you dig into your question.&lt;/p&gt;&#xA;" OwnerUserId="14130" LastActivityDate="2020-12-17T20:09:01.510" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15182" PostTypeId="2" ParentId="15179" CreationDate="2020-12-17T20:12:53.567" Score="1" Body="&lt;p&gt;I think it would be also useful to see your Quantum Circuit using &lt;code&gt;%matplotlib inline&lt;/code&gt;&lt;br /&gt;&#xA;and &lt;code&gt;qc.draw('mpl')&lt;/code&gt; 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 &lt;code&gt;IntegerComparator&lt;/code&gt; onto was wrong. Cheers&lt;/p&gt;&#xA;" OwnerUserId="14130" LastActivityDate="2020-12-17T20:12:53.567" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15184" PostTypeId="1" AcceptedAnswerId="15188" CreationDate="2020-12-17T20:50:35.467" Score="2" ViewCount="80" Body="&lt;p&gt;When I read documentations about quantum error correction, it generally speak about bit flip error, and phase flip on &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, so for example, let's say my initial state is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a|0\rangle+b|1\rangle$&lt;/span&gt;, bit flip error correction &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = b|0\rangle+a|1\rangle$&lt;/span&gt; or phase flip error correction &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = a|0\rangle-b|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering why the phase flip error correction &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = -a|0\rangle+b|1\rangle$&lt;/span&gt; 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 &amp;quot;in real life&amp;quot;?&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="2879" LastEditDate="2020-12-18T19:28:36.573" LastActivityDate="2020-12-18T19:28:36.573" Title="Phase flip error correction on state $|0\rangle$" Tags="&lt;quantum-state&gt;&lt;error-correction&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15185" PostTypeId="2" ParentId="15184" CreationDate="2020-12-17T21:31:56.467" Score="3" Body="&lt;p&gt;An error that negates the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is observationally indistinguishable from an error that negates the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, so there's no need to consider both. By arbitrary historical convention the Z gate negates the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and so things are done in those terms.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-12-17T21:31:56.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15186" PostTypeId="2" ParentId="15184" CreationDate="2020-12-18T07:47:22.383" Score="3" Body="&lt;p&gt;The difference between &lt;span class=&quot;math-container&quot;&gt;$a|0\rangle-b|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-a|0\rangle+b|1\rangle$&lt;/span&gt; is a global phase which has no observational consequences. In other words, to all intents and purposes, those two errors &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-Z$&lt;/span&gt; are the same. An error correcting code that corrects for one also corrects for the other (although the global phase may remain).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-18T07:47:22.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15187" PostTypeId="1" AcceptedAnswerId="15228" CreationDate="2020-12-18T10:31:32.297" Score="4" ViewCount="45" Body="&lt;p&gt;The &lt;a href=&quot;https://quantumai.google/cirq/simulation#stepping_through_a_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; for Cirq mentions the possibility to step through a circuit's moments, and access the exact wavefunction via &lt;code&gt;step.state_vector()&lt;/code&gt;, and edit set it via &lt;code&gt;step.set_state()&lt;/code&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;How can I change the wavefunction used for the next moment simulation?&lt;/p&gt;&#xA;" OwnerUserId="14208" LastEditorUserId="55" LastEditDate="2020-12-21T23:39:46.423" LastActivityDate="2020-12-21T23:39:46.423" Title="Access and set_state during quantum computation simulation in cirq" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15188" PostTypeId="2" ParentId="15184" CreationDate="2020-12-18T11:49:32.793" Score="1" Body="&lt;p&gt;The bit- and phase-flip error you are asking for, i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = b|0\rangle-a|1\rangle$&lt;/span&gt; does indeed exist, and error correction for them have been constructed. The phase flip is associated to the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; Pauli matrix and the bit flip to the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; pauli matrix. The error you are asking for is associated to the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; pauli matrix. Not that its action is &lt;span class=&quot;math-container&quot;&gt;$Y|\psi\rangle=-i(b|0\rangle-a|1\rangle)$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;&lt;p&gt;I recommend this &lt;a href=&quot;https://ieeexplore.ieee.org/abstract/document/9201447&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt; for a better understanding of the decoherence models. In such you can see discussions about the Pauli channel (a channel with errors &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt;) and also an example of a QECC that does indeed correct all of those kinds of errors with weight one.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastActivityDate="2020-12-18T11:49:32.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15189" PostTypeId="1" AcceptedAnswerId="15191" CreationDate="2020-12-18T18:17:26.110" Score="3" ViewCount="109" Body="&lt;p&gt;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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})] $$&lt;/span&gt;&#xA;and we can take the XY hamiltonian to be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_{XY} = \sum^{N}_{i = 1} [J(S^{x}_{i}S^{x}_{i+1} + S^{y}_{i}S^{y}_{i+1})]$$&lt;/span&gt;&#xA;as I understand. I know that the matrix representation of this hamiltonian's time evolution takes the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$XY(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; \cos[{\theta}/2] &amp;amp; i\sin[{\theta}/2] &amp;amp; 0\\&#xA;0 &amp;amp; i\sin[{\theta}/2] &amp;amp; \cos[{\theta}/2] &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;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 &lt;span class=&quot;math-container&quot;&gt;$XY(\theta = \pi)$&lt;/span&gt;, but is there a way to implement &lt;span class=&quot;math-container&quot;&gt;$XY(\theta)$&lt;/span&gt; for arbitrary angles?&lt;/p&gt;&#xA;" OwnerUserId="13364" LastEditorUserId="55" LastEditDate="2020-12-21T23:39:58.597" LastActivityDate="2020-12-21T23:39:58.597" Title="XY Hamiltonian in a 1D Heisenberg Chain" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15190" PostTypeId="1" AcceptedAnswerId="15192" CreationDate="2020-12-18T18:41:21.340" Score="2" ViewCount="77" Body="&lt;p&gt;For a quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, the Choi state is defined by the action of the channel on one half of an unnormalized maximally entangled state as below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$J(\mathcal{E}) = (\mathcal{E}\otimes I)\sum_{ij}\vert i\rangle\langle j\vert\otimes \vert i\rangle\langle j\vert$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2020-12-21T23:46:30.110" Title="When is the Choi matrix of a channel pure?" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15191" PostTypeId="2" ParentId="15189" CreationDate="2020-12-18T19:51:35.587" Score="3" Body="&lt;p&gt;Here is an implementation&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit, Parameter&#xA;&#xA;theta = Parameter('θ')&#xA;&#xA;qc = QuantumCircuit(2)&#xA;qc.cx(0, 1)&#xA;qc.crx(-1 * theta, 1, 0)&#xA;qc.cx(0, 1)&#xA;&#xA;print(qc)&#xA;---&#xA;          ┌────────┐     &#xA;q_0: ──■──┤ RX(-θ) ├──■──&#xA;     ┌─┴─┐└───┬────┘┌─┴─┐&#xA;q_1: ┤ X ├────■─────┤ X ├&#xA;     └───┘          └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and to evaluate that it works:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator&#xA;&#xA;def XY(theta):&#xA;    c = np.cos(theta / 2)&#xA;    s = 1j * np.sin(theta / 2)&#xA;    &#xA;    return np.array([[1, 0, 0, 0], &#xA;                     [0, c, s, 0], &#xA;                     [0, s, c, 0], &#xA;                     [0, 0, 0, 1]])&#xA;&#xA;val = pi / 14&#xA;circ = qc.bind_parameters({theta: val})&#xA;np.allclose(Operator(circ).data, &#xA;            XY(val))&#xA;---&#xA;True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2020-12-18T19:51:35.587" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15192" PostTypeId="2" ParentId="15190" CreationDate="2020-12-18T20:02:07.280" Score="2" Body="&lt;p&gt;It works the other way around too. A pure state is rank &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and any channel with more than one Kraus operator will give a higher-rank Choi matrix, which can be easily seen from the definition.&lt;/p&gt;&#xA;&lt;p&gt;You can also work it out on a different condition for pure states:&lt;/p&gt;&#xA;&lt;p&gt;For any pure state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\rho^{2} = \rho.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(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|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so if &lt;span class=&quot;math-container&quot;&gt;$J(\mathcal{E})$&lt;/span&gt; is pure then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|&#xA;$$&lt;/span&gt;&#xA;which, when relabeling &lt;span class=&quot;math-container&quot;&gt;$j &amp;lt;-&amp;gt; l$&lt;/span&gt; on the right hand side, leads to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|&#xA;$$&lt;/span&gt;&#xA;Since all different &lt;span class=&quot;math-container&quot;&gt;$|i\rangle\langle j |$&lt;/span&gt; are orthogonal, this needs to hold term-by-term:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(|i\rangle \langle j|) = \sum_{l}\mathcal{E}(|i\rangle \langle l|)\mathcal{E}(|l\rangle \langle j|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Writing &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; in it's Kraus decomposition &lt;span class=&quot;math-container&quot;&gt;$\{A_{k}\}$&lt;/span&gt; sheds some extra light:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;noting that &lt;span class=&quot;math-container&quot;&gt;$\sum_{l} \langle l| A^{\dagger}_{k'} A_{k''}|l\rangle = \mathrm{tr}[A^{\dagger}_{k'} A_{k''}]$&lt;/span&gt;, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and taking the trace and using its cyclic property on either side we get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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  &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Importantly, this works for &lt;em&gt;every&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|i\rangle, | j \rangle$&lt;/span&gt;, so the above equation can only hold if &lt;span class=&quot;math-container&quot;&gt;$\delta_{k'k''} = \mathrm{tr}[A^{\dagger}_{k'} A_{k''}]$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-12-18T20:02:07.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15193" PostTypeId="1" AcceptedAnswerId="15195" CreationDate="2020-12-19T13:49:56.943" Score="2" ViewCount="61" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="13030" LastEditorUserId="8141" LastEditDate="2020-12-19T16:19:14.227" LastActivityDate="2020-12-19T19:25:31.987" Title="How to show that amount of qubits needed to crack the RSA-2048 protocol using Shor's algorithm?" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15194" PostTypeId="1" CreationDate="2020-12-19T14:40:45.083" Score="4" ViewCount="67" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma \in \mathfrak{D}(A)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\operatorname{supp}(\rho) \subseteq \operatorname{supp}(\sigma),$&lt;/span&gt; and spectral decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|&#xA;$$&lt;/span&gt;&#xA;For any integer &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; denote by &lt;span class=&quot;math-container&quot;&gt;$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,$&lt;/span&gt; and for any &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;&#xA;the subspace &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{T}_{n, \epsilon} \subset A^{n}$&lt;/span&gt; is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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\}&#xA;$$&lt;/span&gt;&#xA;Finally, denote by &lt;span class=&quot;math-container&quot;&gt;$\Pi_{n, \epsilon}$&lt;/span&gt; the projection onto the subspace &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{T}_{n, \epsilon}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$A^{n}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, I want to show two things. First, I want to show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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}&#xA;$$&lt;/span&gt;&#xA;And I also want to show that for any &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;gt;0$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lim _{n \rightarrow \infty} \operatorname{Tr}\left[\rho^{\otimes n} \Pi_{n, \epsilon}\right]=1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textbf{ATTEMPT}$&lt;/span&gt;:&#xA;I think I should start as follows. I denoted &lt;span class=&quot;math-container&quot;&gt;$r_{y}:=\left\langle\phi_{y}|\rho| \phi_{y}\right\rangle,$&lt;/span&gt; and by &lt;span class=&quot;math-container&quot;&gt;$\tilde{Y}$&lt;/span&gt; the random variable whose alphabet is the same as that of &lt;span class=&quot;math-container&quot;&gt;$Y,$&lt;/span&gt; but his corresponding distribution is &lt;span class=&quot;math-container&quot;&gt;$\left\{r_{y}\right\} .$&lt;/span&gt; Then, I want to show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\operatorname{Tr}[\rho \log \sigma]=\mathbb{E}\left(\log q_{\tilde{Y}}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm really confused and struggling with this problem. Could you please help me?&lt;/p&gt;&#xA;" OwnerUserId="13403" LastEditorUserId="55" LastEditDate="2020-12-20T15:16:21.960" LastActivityDate="2020-12-20T15:16:21.960" Title="A question in classical and quantum information" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15195" PostTypeId="2" ParentId="15193" CreationDate="2020-12-19T15:28:59.007" Score="6" Body="&lt;p&gt;I assume you mean the result from &lt;a href=&quot;https://arxiv.org/abs/1905.09749&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;, where the authors (including 'our very own' &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/119/craig-gidney&quot;&gt;Craig Gidney&lt;/a&gt;) have &lt;em&gt;estimated&lt;/em&gt; that if you have &lt;span class=&quot;math-container&quot;&gt;$\sim20$&lt;/span&gt; million noisy qubit it would take you around &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; hours to 'run' Shor's algorithm for a &lt;span class=&quot;math-container&quot;&gt;$2048$&lt;/span&gt; bit key.&lt;/p&gt;&#xA;&lt;p&gt;For a 'proof' you can read the paper, but there are a few important things to realize here:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This is an &lt;em&gt;estimate&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;This number is for &lt;strong&gt;physical&lt;/strong&gt; qubits, that are noisy, and that are therefore combined into logical qubits using QECC&lt;/li&gt;&#xA;&lt;li&gt;The estimate depends on (what where then) current noise levels - lower noise levels means less need for error correction, which means less overhead&lt;/li&gt;&#xA;&lt;li&gt;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&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you care only about logical qubits, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5048/how-many-logical-qubits-are-needed-to-run-shors-algorithm-efficiently-on-large?rq=1&quot;&gt;this question &amp;amp; answer&lt;/a&gt; might be what you are looking for. However, remember, that there is no definite single answer to this question.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2020-12-19T19:25:31.987" LastActivityDate="2020-12-19T19:25:31.987" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15196" PostTypeId="2" ParentId="15166" CreationDate="2020-12-19T19:05:29.203" Score="1" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab&#xA;&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;from qiskit.aqua import QuantumInstance, aqua_globals&#xA;from qiskit.aqua.algorithms import VQE, NumPyMinimumEigensolver&#xA;from qiskit.aqua.components.initial_states import Zero&#xA;from qiskit.aqua.components.optimizers import COBYLA, L_BFGS_B, SLSQP&#xA;from qiskit.circuit.library import TwoLocal&#xA;&#xA;pauli_dict = {&#xA;    'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -1.052373245772859}, &amp;quot;label&amp;quot;: &amp;quot;II&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: 0.39793742484318045}, &amp;quot;label&amp;quot;: &amp;quot;ZI&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -0.39793742484318045}, &amp;quot;label&amp;quot;: &amp;quot;IZ&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: -0.01128010425623538}, &amp;quot;label&amp;quot;: &amp;quot;ZZ&amp;quot;},&#xA;              {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: 0.18093119978423156}, &amp;quot;label&amp;quot;: &amp;quot;XX&amp;quot;}&#xA;              ]&#xA;}&#xA;&#xA;qubit_op = WeightedPauliOperator.from_dict(pauli_dict)&#xA;&#xA;&#xA;num_qubits = qubit_op.num_qubits&#xA;init_state = Zero(num_qubits)&#xA;var_form = TwoLocal(num_qubits, 'ry', 'cz', initial_state=init_state)&#xA;&#xA;counts = []&#xA;values = []&#xA;para3 = []&#xA;with open('out.txt', 'w') as f: &#xA;    pass&#xA;def store_intermediate_result(eval_count, parameters, mean, std):&#xA;    counts.append(eval_count)&#xA;    values.append(mean)&#xA;    para3.append( parameters ) &#xA;#     print( parameters )&#xA;    with open('out.txt', 'a') as f:&#xA;        for item in parameters:&#xA;            f.write( &amp;quot;%f &amp;quot; % item )&#xA;        f.write( &amp;quot;\n&amp;quot; )&#xA;    &#xA;&#xA;algo = VQE(qubit_op, var_form, COBYLA(), include_custom=True , callback=store_intermediate_result)&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;algo_result = algo.run(backend)&#xA;&#xA;with open('out.txt' ) as f:&#xA;    para2 = [line.split() for line in f]        &#xA;&#xA;para = []&#xA;for x in para2:&#xA;    para.append( [float(y) for y in x ] )&#xA;&#xA;&#xA;counts = np.asarray(counts)&#xA;values = np.asarray(values)&#xA;&#xA;values2 = []&#xA;for x in counts:&#xA;    algo = VQE(qubit_op, var_form, COBYLA(maxiter= 0), include_custom=True , initial_point = para[x-1])&#xA;    backend = Aer.get_backend('qasm_simulator')&#xA;    algo_result = algo.run(backend)&#xA;&#xA;    values2.append( algo_result['eigenvalue'] )&#xA;&#xA;values3 = []    &#xA;for x in para3:&#xA;    algo = VQE(qubit_op, var_form, COBYLA(maxiter= 0), include_custom=True , initial_point = x )&#xA;    backend = Aer.get_backend('qasm_simulator')&#xA;    algo_result = algo.run(backend)&#xA;&#xA;    values3.append( algo_result['eigenvalue'] )&#xA;    &#xA;fig,ax = pylab.subplots()&#xA;Numval = 60&#xA;ax.plot( counts[:Numval]  , values[:Numval] , 'ro' , label ='energy output by call-back')&#xA;ax.plot( counts[:Numval]  , values2[:Numval] , 'bx' , label = 'energy recalculated with para print-out (correct)')&#xA;ax.plot( counts[:Numval]  , values3[:Numval] , 'k*' , label = 'energy recalculated with para by the calle-back (wrong)')&#xA;pylab.legend(loc='upper right')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eibsN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eibsN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastActivityDate="2020-12-19T19:05:29.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15197" PostTypeId="1" CreationDate="2020-12-19T19:15:54.330" Score="2" ViewCount="127" Body="&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm having trouble seeing how &lt;a href=&quot;http://arXiv.org/abs/quant-ph/0611001v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper claims the following identity to be true for a three qubit system (labelled by &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;) under a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; with real coefficients&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are the three Pauli matrices and the subscript is the qubit label. The expectation values have the usual meaning &lt;span class=&quot;math-container&quot;&gt;$\langle X_A X_B \rangle \equiv \text{tr} \rho X_A \otimes X_B \otimes 1$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho \equiv \text{tr}_C |\psi \rangle \langle \psi |$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My Guess:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm thinking that this identity arises out of something like &lt;span class=&quot;math-container&quot;&gt;$X^2 + Y^2 + Z^2=3$&lt;/span&gt; but that approach leads me nowhere since the square is outside the expectation brackets. Another problem is that while on the LHS the &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; space is being traced over, on the RHS it's either &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance. Cheers.&lt;/p&gt;&#xA;" OwnerUserId="14177" LastEditorUserId="14177" LastEditDate="2020-12-20T06:00:27.103" LastActivityDate="2020-12-20T06:00:27.103" Title="Three qubit identity" Tags="&lt;entanglement&gt;&lt;non-locality&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15198" PostTypeId="1" AcceptedAnswerId="15202" CreationDate="2020-12-19T20:14:30.060" Score="4" ViewCount="76" Body="&lt;p&gt;Consider a bipartite quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; over a product of finite-dimensional Hilbert spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt;. Does there exists a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt; such that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For any bipartite &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, the reduced density matrix over &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is preserved &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B{[U(\rho_{AB})U^*]} = \rho_A$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For some &lt;em&gt;a priori&lt;/em&gt; given &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt;, the output is a product state: &lt;span class=&quot;math-container&quot;&gt;$U(\sigma_{AB})U^* = \sigma_A \otimes \omega_B$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\omega_B$&lt;/span&gt; can be anything).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I'm also interested in the case where such properties might only hold up to some arbitrary &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;gt;0$&lt;/span&gt; accuracy.&lt;/p&gt;&#xA;" OwnerUserId="9900" LastEditorUserId="9900" LastEditDate="2020-12-20T17:09:22.497" LastActivityDate="2020-12-20T17:09:22.497" Title="Unitary over bipartite states that can turn a non-product state into a product state" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;unitarity&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15199" PostTypeId="1" AcceptedAnswerId="15267" CreationDate="2020-12-19T20:18:55.153" Score="2" ViewCount="96" Body="&lt;p&gt;I'm trying to apply the diffusion operator to this state (normalization factors excluded):&#xA;&lt;span class=&quot;math-container&quot;&gt;$|000\rangle + |001\rangle - |010\rangle - |011\rangle - |100\rangle - |101\rangle - |110\rangle  -|111\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I get the resulting state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$|001\rangle+|001\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RiMoy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RiMoy.png&quot; alt=&quot;phases&quot; /&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Nz4po.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nz4po.png&quot; alt=&quot;result&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9633" LastActivityDate="2020-12-24T20:18:11.713" Title="Grover's algorithm for finding 6/8 states" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15200" PostTypeId="2" ParentId="4580" CreationDate="2020-12-19T22:14:52.360" Score="2" Body="&lt;p&gt;For drawing in your browser, &lt;a href=&quot;https://quantikz.krastanov.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;there is a demo of the &lt;code&gt;Quantikz.jl&lt;/code&gt; package you can use&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Oz00K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Oz00K.png&quot; alt=&quot;A quantikz example&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://krastanov.github.io/Quantikz/stable/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantikz.jl library&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5601" LastEditorUserId="5601" LastEditDate="2021-04-24T19:10:25.430" LastActivityDate="2021-04-24T19:10:25.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15202" PostTypeId="2" ParentId="15198" CreationDate="2020-12-20T00:20:23.893" Score="3" Body="&lt;p&gt;The first condition is satisfied for example by unitaries of the form &lt;span class=&quot;math-container&quot;&gt;$U = e^{i\theta}I_A \otimes U_B$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I_A$&lt;/span&gt; is identity on subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_B$&lt;/span&gt; is any unitary on subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and the phase factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; is irrelevant.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Let us consider the second condition. It turns out that the condition cannot be guaranteed for all states &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt;. More precisely, there are states &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt; such that for every unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and every state &lt;span class=&quot;math-container&quot;&gt;$\omega_B$&lt;/span&gt; of subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$U\sigma_{AB}U^* \ne \sigma_A \otimes \omega_B$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;More formally, we can state the first fact by saying that for every unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is an eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; if and only if it is an eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$U\rho U^*$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In order to show the second fact, first note that the eigenvalues of an &lt;span class=&quot;math-container&quot;&gt;$n \times n$&lt;/span&gt; density matrix lie in an &lt;span class=&quot;math-container&quot;&gt;$(n-1)$&lt;/span&gt;-simplex. Let &lt;span class=&quot;math-container&quot;&gt;$n_A = \dim \mathcal{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n_B = \dim \mathcal{H}_B$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\lambda^A_i$&lt;/span&gt; denotes the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda^B_j$&lt;/span&gt; denotes the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\omega_B$&lt;/span&gt; then the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A \otimes \omega_B$&lt;/span&gt; are the products &lt;span class=&quot;math-container&quot;&gt;$\lambda^{AB}_{ij} = \lambda^A_i \lambda^B_j$&lt;/span&gt;. Thus, the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sigma_A \otimes \omega_B$&lt;/span&gt; lie in the Cartesian product of two simplices that can be described using &lt;span class=&quot;math-container&quot;&gt;$(n_A - 1) (n_B - 1)$&lt;/span&gt; real parameters. On the other hand, the eigenvalues of an arbitrary joint density matrix on systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; lie in an &lt;span class=&quot;math-container&quot;&gt;$(n_An_B - 1)$&lt;/span&gt;-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.&lt;/p&gt;&#xA;&lt;p&gt;For a concrete example, suppose that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are qubits and that &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0, \frac{1}{4}, \frac{1}{4}, \frac{1}{2}$&lt;/span&gt;. Note that there do not exist two sets of numbers &lt;span class=&quot;math-container&quot;&gt;$\{\lambda^A_1, \lambda^A_2\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{\lambda^B_1, \lambda^B_2\}$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{\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}\}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Consequently, there is no unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U\sigma_{AB}U^* = \sigma_A \otimes \omega_B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-20T02:51:58.437" LastActivityDate="2020-12-20T02:51:58.437" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15203" PostTypeId="1" AcceptedAnswerId="15204" CreationDate="2020-12-20T00:36:43.907" Score="3" ViewCount="101" Body="&lt;p&gt;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 &amp;quot;moment&amp;quot; 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 &lt;code&gt;tfq.util.get_supported_gates&lt;/code&gt; :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{cirq.X: 1,&#xA; cirq.XX: 2,&#xA; cirq.Y: 1,&#xA; cirq.YY: 2,&#xA; cirq.Z: 1,&#xA; cirq.ZZ: 2,&#xA; cirq.H: 1,&#xA; cirq.CZ: 2,&#xA; cirq.CNOT: 2,&#xA; cirq.SWAP: 2,&#xA; cirq.ISWAP: 2,&#xA; cirq.FSimGate(theta=0.123, phi=0.456): 2,&#xA; cirq.I: 1,&#xA; cirq.PhasedXPowGate(phase_exponent=0.123): 1,&#xA; cirq.PhasedISwapPowGate(phase_exponent=0.123): 2}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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 &lt;code&gt;cirq.two_qubit_matrix_to_operations&lt;/code&gt; to decompose this quasi-two-qubit operation into Z/XY/CZ gates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tSqwz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tSqwz.png&quot; alt=&quot;short-depth circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are either of these the correct representation for &lt;span class=&quot;math-container&quot;&gt;$Rz(\gamma)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Ry(\theta)$&lt;/span&gt; rotations in registers one and two respectively?&lt;/p&gt;&#xA;&lt;p&gt;1.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix} \cos{\theta} &amp;amp; -\sin{\theta} &amp;amp; 0 &amp;amp; 0 \\ \sin{\theta} &amp;amp; \cos{\theta} &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; e^{-i\gamma/2} &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\gamma/2} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;2.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix} e^{-i\gamma/2}\cos{\theta} &amp;amp; 0 &amp;amp; -e^{-i\gamma/2}\sin{\theta} &amp;amp; 0 \\ 0 &amp;amp; e^{i\gamma/2}\cos{\theta} &amp;amp; 0 &amp;amp; -e^{i\gamma/2}\sin{\theta} \\ e^{-i\gamma/2}\sin{\theta} &amp;amp; 0 &amp;amp; e^{-i\gamma/2}\cos{\theta} &amp;amp; 0 \\ 0 &amp;amp; e^{i\gamma/2}\sin{\theta} &amp;amp; 0 &amp;amp; e^{i\gamma/2}\cos{\theta} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="10480" LastEditDate="2021-04-29T20:41:49.843" LastActivityDate="2021-04-29T20:41:49.843" Title="How do you represent one-qubit rotations in two registers as a $4\times 4$ unitary matrix?" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;matrix-representation&gt;&lt;cirq&gt;&lt;tfq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15204" PostTypeId="2" ParentId="15203" CreationDate="2020-12-20T01:15:14.757" Score="5" Body="&lt;p&gt;Note 100% sure if this is what you are asking but when you have a circuit like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/adLb1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/adLb1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and you want to write it as a &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; Unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; then you can do it as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ U = R_y(a[0]) \otimes  R_z(a[1]) $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This can be generalized to any size as well. So if you have&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8kvM1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8kvM1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then it can be written as an &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$U = R_y(a[0]) \otimes  R_z(a[1]) \otimes H $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$ A = \begin{pmatrix} a_1 &amp;amp; a_2 \\ a_3 &amp;amp; a_4 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ B = \begin{pmatrix} b_1 &amp;amp; b_2 \\ b_3 &amp;amp; b_4 \end{pmatrix}$&lt;/span&gt; then&#xA;&lt;span class=&quot;math-container&quot;&gt;$A \otimes B = \begin{pmatrix} a_1 \cdot B &amp;amp; a_2 \cdot B\\ a_3 \cdot B &amp;amp; a_4 \cdot B \end{pmatrix}  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; So to be explicit, we can see that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; R_y(2\theta_1) \otimes  R_z(2 \theta_2) &amp;amp;= \begin{pmatrix} \cos\theta_1 &amp;amp; -\sin\theta_1 \\ \sin\theta_1 &amp;amp; \cos\theta_1 \end{pmatrix} \otimes \begin{pmatrix} e^{-i \theta_2} &amp;amp; 0 \\ 0 &amp;amp; e^{i \theta_2} \end{pmatrix}\\&#xA;&amp;amp;= \begin{pmatrix} \cos\theta_1 \begin{pmatrix} e^{-i \theta_2} &amp;amp; 0 \\ 0 &amp;amp; e^{i \theta_2} \end{pmatrix} &amp;amp; -\sin \theta_1 \begin{pmatrix} e^{-i \theta_2} &amp;amp; 0 \\ 0 &amp;amp; e^{i \theta_2} \end{pmatrix} \\ \sin \theta_1 \begin{pmatrix} e^{-i \theta_2} &amp;amp; 0 \\ 0 &amp;amp; e^{i \theta_2} \end{pmatrix} &amp;amp; \cos \theta_1 \begin{pmatrix} e^{-i \theta_2} &amp;amp; 0 \\ 0 &amp;amp; e^{i \theta_2} \end{pmatrix} \end{pmatrix}\\&#xA;&amp;amp;= \begin{pmatrix} \cos\theta_1 e^{-i \theta_2} &amp;amp; 0 &amp;amp; -\sin \theta_1 e^{-i \theta_2} &amp;amp; 0\\ &#xA;0 &amp;amp; \cos \theta_1 e^{i \theta_2} &amp;amp; 0 &amp;amp; -\sin\theta_1 e^{i\theta_2}\\&#xA;\sin\theta_1 e^{-i \theta_2} &amp;amp; 0 &amp;amp; \cos \theta_1 e^{-i \theta_2} &amp;amp; 0\\ &#xA;0 &amp;amp; \sin \theta_1 e^{i \theta_2} &amp;amp; 0 &amp;amp; \cos\theta_1 e^{i\theta_2}\\&#xA; \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if you don't want to do this by hand in the future, then you can do this operation pretty fast in python:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np &#xA;import sympy as sym&#xA;&#xA;x1 = sym.Symbol('x1')&#xA;x2 = sym.Symbol('x2')&#xA;i = sym.Symbol('i')&#xA;&#xA;Ry = [[sym.cos(x1), -sym.sin(x1)], [sym.sin(x1),sym.cos(x1)]] &#xA;Rz = [[sym.exp(-i*x2),0], [0,sym.exp(i*x2)]]&#xA;U = np.kron(Ry,Rz)&#xA;print(U) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-20T03:30:45.193" LastActivityDate="2020-12-20T03:30:45.193" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15205" PostTypeId="1" AcceptedAnswerId="15207" CreationDate="2020-12-20T03:41:24.310" Score="2" ViewCount="70" Body="&lt;p&gt;Given two &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional states &lt;span class=&quot;math-container&quot;&gt;$QFT|i\rangle(i\in\{0,1,2,...,d-1\})$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle=|0\rangle$&lt;/span&gt;. If I perform &lt;span class=&quot;math-container&quot;&gt;$CNOT(QFT|i\rangle,|\varphi\rangle)$&lt;/span&gt;, and then perform &lt;span class=&quot;math-container&quot;&gt;$QFT^{-1}|\varphi\rangle$&lt;/span&gt;, can I get &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with measurement on&lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; in base &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle,\ldots,|d-1\rangle\}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="11523" LastEditorUserId="55" LastEditDate="2020-12-21T23:48:36.927" LastActivityDate="2020-12-21T23:48:36.927" Title="A simple question about QFT and CNOT" Tags="&lt;quantum-state&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15206" PostTypeId="2" ParentId="15170" CreationDate="2020-12-20T03:46:03.610" Score="1" Body="&lt;p&gt;This is really weird and it is probably a bug within the IBM Quantum Experience Circuit Composer.&lt;/p&gt;&#xA;&lt;p&gt;So if you change the gate angle like what you did, by clicking on the gate and change the parameter there directly then it &lt;strong&gt;definitely disappeared&lt;/strong&gt; from the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L52F2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L52F2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;hr /&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;But if you &lt;strong&gt;changed the parameters from the QASM Code Editor&lt;/strong&gt; then the gates  &lt;strong&gt;DO NOT disappeared&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vn5Wr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vn5Wr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-20T03:46:03.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15207" PostTypeId="2" ParentId="15205" CreationDate="2020-12-20T06:03:32.750" Score="2" Body="&lt;p&gt;Yes, with probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{d}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Begin by computing the output state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|\psi\rangle &amp;amp;= (I\otimes QFT^{-1} \circ CNOT \circ QFT \otimes I)|i\rangle|0\rangle \\&#xA;&amp;amp;= (I\otimes QFT^{-1} \circ CNOT)\frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij}|j\rangle|0\rangle \\&#xA;&amp;amp;= \frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij} (I\otimes QFT^{-1} \circ CNOT)|j\rangle|0\rangle \\&#xA;&amp;amp;= \frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij} I\otimes QFT^{-1}|j\rangle|j\rangle \\&#xA;&amp;amp;= \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 \\&#xA;&amp;amp;= \frac{1}{d}\sum_{j,k=0}^{d-1}\omega^{(i-k)j} |j\rangle|k\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\omega = e^{2\pi i/d}$&lt;/span&gt;. The probability of obtaining result &lt;span class=&quot;math-container&quot;&gt;$|l\rangle$&lt;/span&gt; when measuring the second register in the computational basis is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;P_l &amp;amp;= \langle\psi|l\rangle\langle l|\psi\rangle \\&#xA;&amp;amp;= \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 \\&#xA;&amp;amp;= \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} \\&#xA;&amp;amp;= \frac{1}{d^2}\sum_{j=0}^{d-1}\omega^{(l-i)j}\omega^{(i-l)j} \\&#xA;&amp;amp;= \frac{1}{d}.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I suppose it may be interesting to consider why we did not obtain &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; with probability 1 as we would have if we had applied &lt;span class=&quot;math-container&quot;&gt;$QFT$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$QFT^{-1}$&lt;/span&gt; on the same register. In the latter case (without &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;), we recover &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; because of interference (constructive on &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; and destructive on &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$j \ne i$&lt;/span&gt;). However, interference is prevented in the present case (with &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;) by entanglement. Specifically, as the calculation shows, entanglement introduced by the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate causes different phase factors to land on different kets and therefore prevents their interference.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-20T06:34:30.897" LastActivityDate="2020-12-20T06:34:30.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15208" PostTypeId="1" AcceptedAnswerId="15213" CreationDate="2020-12-20T10:54:56.817" Score="5" ViewCount="78" Body="&lt;p&gt;Before the start of a quantum algorithm qubits need to be initialized into a quantum register. How fast can a quantum register of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; be initialized in a way that all possible superpositions of the &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; basis states exist with equal amplitudes.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$N=2^{1024}$&lt;/span&gt; basis states than that with &lt;span class=&quot;math-container&quot;&gt;$N=2^{256}$&lt;/span&gt; basis states in an equal superposition.&lt;/p&gt;&#xA;" OwnerUserId="8605" LastEditorUserId="9006" LastEditDate="2020-12-20T13:41:47.697" LastActivityDate="2020-12-21T17:14:23.113" Title="How instantaneous is state preparation in a quantum register, if all possible superpositions are to be initialized equally?" Tags="&lt;quantum-state&gt;&lt;physical-qubit&gt;&lt;superposition&gt;&lt;state-preparation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15209" PostTypeId="2" ParentId="15179" CreationDate="2020-12-20T12:20:06.387" Score="1" Body="&lt;p&gt;I had to exchange &lt;code&gt;len(qr_state)&lt;/code&gt; with &lt;code&gt;num_uncertainty_qubits&lt;/code&gt; in the code you posted&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    # in run_ae_for_cdf&#xA;    ae_var = IterativeAmplitudeEstimation(state_preparation=state_preparation,&#xA;                                          epsilon=epsilon, alpha=alpha,&#xA;                                          objective_qubits=[num_uncertainty_qubits])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but then for me it seems to work just fine.&lt;/p&gt;&#xA;&lt;p&gt;The output is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# executing your script with python -i and then:&#xA;&amp;gt;&amp;gt;&amp;gt; run_ae_for_cdf(1)&#xA;0.03904972139433151&#xA;&amp;gt;&amp;gt;&amp;gt; run_ae_for_cdf(3)&#xA;0.35743729093195115&#xA;&amp;gt;&amp;gt;&amp;gt; run_ae_for_cdf(6)&#xA;0.8437041835749457&#xA;&amp;gt;&amp;gt;&amp;gt; run_ae_for_cdf(70)&#xA;0.9999743710958622&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You have 3 qubits in your system so the largest integer you can represent is 7 (&lt;span class=&quot;math-container&quot;&gt;$ = 2^3 - 1$&lt;/span&gt;) so for values &lt;span class=&quot;math-container&quot;&gt;$\geq 8$&lt;/span&gt; the CDF should be 1. That's because the CDF &lt;span class=&quot;math-container&quot;&gt;$F(x)$&lt;/span&gt; is the probability of measuring a state smaller than &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(x) = \mathrm{Pr}(\text{measure any state } |i\rangle \text{ with } i \leq x)&#xA;$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; can reach 7 at most, we should see&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(x) = \begin{cases} \text{some increasing function, if } x \leq 7 \\&#xA;1 \text{, if } x &amp;gt; 7 &#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With your code you can generate the following plot&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; from matplotlib import pyplot as plt&#xA;&amp;gt;&amp;gt;&amp;gt; i = list(range(20))&#xA;&amp;gt;&amp;gt;&amp;gt; f = [run_ae_for_cdf(val) for val in i]&#xA;&amp;gt;&amp;gt;&amp;gt; plt.axhline(1, color=&amp;quot;k&amp;quot;, linestyle=&amp;quot;-&amp;quot;)  # the max we reach&#xA;&amp;gt;&amp;gt;&amp;gt; plt.axvline(8, color=&amp;quot;k&amp;quot;, linestyle=&amp;quot;:&amp;quot;)  # from here on it should be 1&#xA;&amp;gt;&amp;gt;&amp;gt; plt.xlabel(&amp;quot;x&amp;quot;)&#xA;&amp;gt;&amp;gt;&amp;gt; plt.ylabel(&amp;quot;CDF, $F(x)$&amp;quot;)&#xA;&amp;gt;&amp;gt;&amp;gt; plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which seems to meet what we expected.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4ykdg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4ykdg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2020-12-20T12:20:06.387" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15210" PostTypeId="1" CreationDate="2020-12-20T12:22:48.820" Score="3" ViewCount="67" Body="&lt;p&gt;We know that the noise of the &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; gate varies depending on the input state before it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;?&lt;/strong&gt; &lt;a href=&quot;https://i.stack.imgur.com/8J3Gj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8J3Gj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;For example, if I just place a Hadamard gate then &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state is the input to &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; and this might be noisier than other states. What are the possible gates that I can put before &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; to vary the input state?&#xA;I know that &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T^\dagger$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates do not change the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state if I put them. and if I use a general &lt;code&gt;u3&lt;/code&gt; gate then Qiskit divides it into multiple gate operations and that can be even noisier to start with.&lt;/p&gt;&#xA;" OwnerUserId="12967" LastEditorUserId="1859" LastEditDate="2020-12-20T19:19:32.040" LastActivityDate="2021-05-23T18:07:30.823" Title="What are the possible gates that I can use to vary input states before CNOT?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;entanglement&gt;&lt;noise&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15211" PostTypeId="2" ParentId="15208" CreationDate="2020-12-20T13:41:19.147" Score="3" Body="&lt;p&gt;You can prepare equal superposition by application of Hadamard gate on each qubit. The result will be state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle=\frac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n}|i\rangle,&#xA;$$&lt;/span&gt;&#xA;i.e. the desired equally distributed superposition.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-20T13:41:19.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15212" PostTypeId="1" AcceptedAnswerId="15215" CreationDate="2020-12-20T15:33:20.130" Score="3" ViewCount="71" Body="&lt;p&gt;I am trying to trace out the second qubit of the Werner State:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;W &amp;amp;=\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]&amp;amp;=&#xA;\left(&#xA;\begin{array}{cccc}&#xA; (1+s)/4 &amp;amp; 0 &amp;amp; 0 &amp;amp; s/2 \\&#xA; 0 &amp;amp; (1-s)/4 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; (1-s)/4 &amp;amp; 0 \\&#xA; s/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; (1+s)/4 \\&#xA;\end{array}&#xA;\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I write down &lt;span class=&quot;math-container&quot;&gt;$I_{4}=|11\rangle \langle11|+|00\rangle \langle00|+|10\rangle \langle10|+|01\rangle \langle01|$&lt;/span&gt; and the result is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;W&amp;amp;=\frac{1+s}{4}|0\rangle \langle0|\otimes|0\rangle \langle0|+\frac{1+s}{4}|1\rangle \langle1|\otimes|1\rangle \langle1|\\ &amp;amp;+\frac{1-s}{4}|0\rangle \langle0|\otimes|1\rangle \langle1|+\frac{1-s}{4}|1\rangle \langle 1|\otimes|0\rangle \langle0| \\&#xA;&amp;amp;+\frac{s}{2}|0\rangle \langle1|\otimes|0\rangle \langle1|+\frac{s}{2}|1\rangle \langle0|\otimes|1\rangle \langle0|&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus tracing out the second qubit results to:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;W_{A}&amp;amp;=\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|\\&#xA;&amp;amp;=\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|\\&#xA;&amp;amp;=\frac{1}{2}\left(&#xA;\begin{array}{cc}&#xA; 1 &amp;amp; s \\&#xA; s &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;\end{align}&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However the result in the notes seems to be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left(&#xA;\begin{array}{cc}&#xA; 1/2 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1/2 \\&#xA;\end{array}&#xA;\right)&#xA;\end{equation}&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I am stuck and I try to find my mistake but i can't. Any help?&lt;/p&gt;&#xA;" OwnerUserId="14166" LastEditorUserId="14166" LastEditDate="2020-12-20T15:44:35.093" LastActivityDate="2020-12-20T17:43:04.027" Title="Partial Trace of Werner State" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15213" PostTypeId="2" ParentId="15208" CreationDate="2020-12-20T16:56:06.253" Score="5" Body="&lt;p&gt;We know that giving a  single qubit  starting in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, which is a state one can initialize very fast with high fidelity, then we can put it in the superposition state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; by applying a Hadamard gate. That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H |0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And we can do for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit by applying each Hadmard gate to each qubit individually. That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} \overbrace{H|0\rangle \otimes H|0\rangle \otimes \cdots \otimes H|0\rangle}^{n \ \textrm{times}} &amp;amp;= \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}} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2^{n}}}\big( \overbrace{ |00\cdots0\rangle + |00\cdots1\rangle + \cdots + |11\cdots 1\rangle }^{2^n \ \textrm{terms} } \big)\\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can do these &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; 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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zsoow.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zsoow.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;All these Hadamard gates can be and will be execute at the same time on the quantum processor.&lt;/p&gt;&#xA;&lt;p&gt;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)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/83qCS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/83qCS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-21T17:14:23.113" LastActivityDate="2020-12-21T17:14:23.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15214" PostTypeId="1" CreationDate="2020-12-20T17:04:18.843" Score="1" ViewCount="46" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;It is &lt;a href=&quot;http://www.soulphysics.org/2013/09/paulis-theorem-is-not-a-theorem-not-as-pauli-stated-it/&quot; rel=&quot;nofollow noreferrer&quot;&gt;known&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In all physical systems in which energy is bounded below, there is no&#xA;self-adjoint observable that tracks the time parameter t.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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) &lt;span class=&quot;math-container&quot;&gt;$| x \rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U(\Delta t)| x \rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$| x \rangle $&lt;/span&gt; is the position eigenket and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary operator for a generic Hamiltonian. In light of that I constructed the following inequality.&lt;/p&gt;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&lt;p&gt;I can show for a position eigenstate &lt;span class=&quot;math-container&quot;&gt;$| x \rangle $&lt;/span&gt; if it evolves in time &lt;span class=&quot;math-container&quot;&gt;$U(\Delta t) | x\rangle$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary operator for a generic Hamiltonian). Then one can bound the time elapsed by finding the probability amplitude &lt;span class=&quot;math-container&quot;&gt;$|  \langle x | U^\dagger(\Delta t)| x + \Delta x \rangle |^2 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|  \langle x | U^\dagger(\Delta t)| x  \rangle |^2 $&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$\Delta x$&lt;/span&gt; is the translation in space by an amount  &lt;span class=&quot;math-container&quot;&gt;$\Delta x &amp;gt; 0$&lt;/span&gt;) and knows in advance the rate of change of momentum &lt;span class=&quot;math-container&quot;&gt;$|\langle x | \dot p | x \rangle |$&lt;/span&gt; then one can bound &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; 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}&lt;/span&gt;&#xA;Similarly for a momentum eigenstate &lt;span class=&quot;math-container&quot;&gt;$|p \rangle $&lt;/span&gt; and the rate of change of position &lt;span class=&quot;math-container&quot;&gt;$|\langle p | \dot x | p \rangle |$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; 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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there any realistic experiment one can do to realise this quantum mechanical watch-stop?&lt;/p&gt;&#xA;&lt;h2&gt;Proof&lt;/h2&gt;&#xA;&lt;p&gt;Consider the following limit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence, we  multiply the first two equations (adjoint of one times the other) and substract:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;&amp;amp; \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} \\ &amp;amp;= - \frac{1}{\hbar^2} \langle x | [ \hat H,\hat p] | x \rangle \tag{5}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using Heisenberg's equation of motion:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \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}  &#xA; - \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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Replacing &lt;span class=&quot;math-container&quot;&gt;$\delta x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta t$&lt;/span&gt; with finite but small values:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \frac{\langle x |U^\dagger (\Delta t)| x + \Delta x \rangle - \langle x + \Delta x|U (\Delta t)| x \rangle}{\Delta x \Delta t}  &#xA; - \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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Taking the modulus and using the triangle inequality:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\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}  &#xA; \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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let  us consider square of the first term:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We use the following inequality which uses &lt;span class=&quot;math-container&quot;&gt;$|  \langle x |U^\dagger (\Delta t)| x + \Delta x \rangle| = |z|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ \langle x |U^\dagger (\Delta t)| x + \Delta x \rangle = z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \langle  x + \Delta x |U(\Delta t)| x \rangle = z^*$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$z = a+ib$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;  \frac{4 |  \langle x|  x + \Delta x \rangle |^2 }{\Delta x^2 \Delta t^2}  \geq  T_1^2 \tag{10} \end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since all quantities are positive:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \frac{2 |  \langle x| U^\dagger (\Delta t) | x + \Delta x \rangle | }{\Delta x \Delta t}  \geq  T_1 \tag{11} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly, we define:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; 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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; \frac{ 2 | \langle x | U^\dagger (\Delta t) | x \rangle| }{\Delta x \Delta t}  \geq T_2  \tag{13}\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence, substituting the &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; inequality:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; \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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Or in terms of &lt;span class=&quot;math-container&quot;&gt;$\Delta t$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; 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}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly for momentum eigenkets:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; 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}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="5045" LastEditDate="2020-12-28T04:52:30.580" LastActivityDate="2020-12-28T04:52:30.580" Title="Is this inequality related to time-energy uncertainty true or testable?" Tags="&lt;quantum-state&gt;&lt;probability&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15215" PostTypeId="2" ParentId="15212" CreationDate="2020-12-20T17:21:00.577" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{s}{2}|0\rangle\langle1|\otimes|0\rangle\langle1|+\frac{s}{2}|1\rangle\langle0|\otimes|1\rangle\langle0|$&lt;/span&gt; should disappear when you take the trace over them, as &lt;span class=&quot;math-container&quot;&gt;$\langle0|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle1|0\rangle = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Edit: To give a simpler example, if your traced out the second qubit of &lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}|00\rangle+|11\rangle$$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}|00\rangle\langle11|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}|11\rangle\langle00|$&lt;/span&gt; would also disappear.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2020-12-20T17:21:00.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15216" PostTypeId="1" CreationDate="2020-12-20T17:24:51.160" Score="5" ViewCount="73" Body="&lt;p&gt;Inequalities cannot be directly converted into a qubo form&lt;/p&gt;&#xA;&lt;p&gt;0⩽ Expression ⩽ N&lt;/p&gt;&#xA;&lt;p&gt;We can introduce a slack variable and convert it to an equality problem:&lt;/p&gt;&#xA;&lt;p&gt;⟹ Expression + s = N&#xA;where:&#xA;s ∈ Z,&#xA;s ∈ [0,N]&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;" OwnerUserId="14221" LastEditorUserId="55" LastEditDate="2020-12-21T23:50:24.693" LastActivityDate="2021-05-20T05:10:52.153" Title="Inequality constraints on D'Wave (using PyQUBO)" Tags="&lt;programming&gt;&lt;d-wave&gt;&lt;pyqubo&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15217" PostTypeId="2" ParentId="15212" CreationDate="2020-12-20T17:29:57.883" Score="2" Body="&lt;p&gt;Note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so the two terms marked red below disappear when you take the partial trace&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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|}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once these terms are gone, the rest of the calculations yields&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;W_{A}&amp;amp;=\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|\\&#xA;&amp;amp;=\frac{1}{2}|0\rangle \langle0|+\frac{1}{2}|1\rangle \langle1|\\&#xA;&amp;amp;=\frac{1}{2}\left(&#xA;\begin{array}{cc}&#xA; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 \\&#xA;\end{array}&#xA;\right)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as expected.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;There is another way of computing the partial trace from the full density matrix that works particularly well in this case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W_A = \mathrm{tr}_B\begin{pmatrix}&#xA; (1+s)/4 &amp;amp; 0 &amp;amp; 0 &amp;amp; s/2 \\&#xA; 0 &amp;amp; (1-s)/4 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; (1-s)/4 &amp;amp; 0 \\&#xA; s/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; (1+s)/4 \\&#xA;\end{pmatrix} = \begin{pmatrix}&#xA; \mathrm{tr}\begin{pmatrix}&#xA;(1+s)/4 &amp;amp; 0 \\&#xA;0 &amp;amp; (1-s)/4&#xA;\end{pmatrix} &amp;amp; \mathrm{tr}\begin{pmatrix}&#xA;0 &amp;amp; s/2 \\&#xA;0 &amp;amp; 0&#xA;\end{pmatrix} \\&#xA;\mathrm{tr}\begin{pmatrix}&#xA;0 &amp;amp; 0 \\&#xA;s/2 &amp;amp; 0&#xA;\end{pmatrix} &amp;amp; \mathrm{tr}\begin{pmatrix}&#xA;(1-s)/4 &amp;amp; 0 \\&#xA; 0 &amp;amp; (1+s)/4&#xA;\end{pmatrix}&#xA;\end{pmatrix} = \begin{pmatrix}&#xA;\frac{1}{2} &amp;amp; 0 \\&#xA;0 &amp;amp; \frac{1}{2}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-20T17:43:04.027" LastActivityDate="2020-12-20T17:43:04.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15218" PostTypeId="1" AcceptedAnswerId="15223" CreationDate="2020-12-21T11:13:15.620" Score="3" ViewCount="62" Body="&lt;p&gt;I'm currently writing my thesis and I'd like to know which computer is based on a superconductive architecture to run some simulations.&#xA;Thanks for help in advance.&lt;/p&gt;&#xA;" OwnerUserId="14229" LastEditorUserId="8141" LastEditDate="2020-12-21T15:27:44.283" LastActivityDate="2020-12-22T17:02:39.267" Title="Is every computer in IBM's fleet based on superconductivity?" Tags="&lt;ibm&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15219" PostTypeId="1" CreationDate="2020-12-21T13:59:35.887" Score="2" ViewCount="40" Body="&lt;p&gt;Can quantum computers offer Grover-like speed ups in parsing of context-free languages? For instance, general CFLs can be parsed in &lt;span class=&quot;math-container&quot;&gt;$O(n^3)$&lt;/span&gt; with standard algorithm like &lt;a href=&quot;https://en.wikipedia.org/wiki/CYK_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/CYK_algorithm&lt;/a&gt;. Could Grover's algorithm be used to speed up the search at each level of the CYK table to produce an &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; algorithm?&lt;/p&gt;&#xA;&lt;p&gt;It doesn't appear anyone has published anything on parsing speed-ups.&lt;/p&gt;&#xA;" OwnerUserId="9305" LastEditorUserId="55" LastEditDate="2020-12-23T09:03:38.577" LastActivityDate="2020-12-23T09:03:38.577" Title="Can quantum computers speed up parsing?" Tags="&lt;speedup&gt;&lt;quantum-advantage&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15220" PostTypeId="2" ParentId="8741" CreationDate="2020-12-21T14:35:27.687" Score="2" Body="&lt;p&gt;QMA verification includes three registers, with appropriate bounds on the length of each register:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, a (classical) description of the (quantum) circuit used for verification, along with the promised gap;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert w\rangle$&lt;/span&gt;, the (quantum) witness provided by Merlin; and&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\vert\eta\rangle$&lt;/span&gt;, the ancilla workspace used by Arthur.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It seems as if you are asking what problems may arise (for example, in the strong error-reduction of Marriott-Watrous), if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; where quantum rather than classical (for example, if &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; where in some superposition of states).&lt;/p&gt;&#xA;&lt;p&gt;But the classical description of the circuit is meant to be agreed-upon by Arthur and Merlin &lt;em&gt;a-priori&lt;/em&gt;.  If Merlin were to send &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; in superposition, Arthur could initially start his verification procedure by measuring &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; to get a classical string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.  Merlin doesn't gain anything by sending &lt;span class=&quot;math-container&quot;&gt;$\vert x\rangle$&lt;/span&gt; itself in superposition, and cannot improve his completeness/soundness.&lt;/p&gt;&#xA;&lt;p&gt;Sevag Gharibian has a very good lecture (clocking in at about 2 hours and 40 minutes) on QMA and MW &lt;a href=&quot;https://www.youtube.com/watch?v=1f01u7yMimw&amp;amp;t=8925s&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.  I've been enjoying this lecture series very much.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-01-13T22:02:32.510" LastActivityDate="2021-01-13T22:02:32.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15221" PostTypeId="1" CreationDate="2020-12-21T15:24:01.777" Score="4" ViewCount="144" Body="&lt;p&gt;I have some working knowledge in Machine Learning and Deep Learning. I am currently in the process of studying Quantum Computing fundamentals.&lt;/p&gt;&#xA;&lt;p&gt;I would like to know whether there are any Quantum Machine Learning beginner level resources I can read on?&lt;/p&gt;&#xA;&lt;p&gt;Appreciate if any one can share any articles/books/courses/lecture notes I can read in the subject.&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="13294" LastEditorUserId="55" LastEditDate="2020-12-23T09:03:52.553" LastActivityDate="2020-12-25T03:59:07.833" Title="Getting started with Quantum Machine Learning" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15222" PostTypeId="2" ParentId="15199" CreationDate="2020-12-21T16:32:44.793" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3Ebc3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3Ebc3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;000 : 0.3535533905932739&lt;br /&gt;&#xA;001 : 0.35355339059327384&lt;br /&gt;&#xA;010 : -0.35355339059327384&lt;br /&gt;&#xA;011 : -0.35355339059327384&lt;br /&gt;&#xA;100 : -0.353553390593274&lt;br /&gt;&#xA;101 : -0.3535533905932739&lt;br /&gt;&#xA;110 : -0.35355339059327384&lt;br /&gt;&#xA;111 : -0.35355339059327384&lt;/p&gt;&#xA;&lt;p&gt;After having marked the states with a negative phase, the average amplitude will be &lt;span class=&quot;math-container&quot;&gt;$\frac{(2/\sqrt{8} - 6/\sqrt{8})}{8} = -0.177$&lt;/span&gt;. If you now apply the diffusion operator, you will perform a reflection around that average and receive the following amplitudes:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\left| \psi \right&amp;gt; - 2*(\left| \psi \right&amp;gt; - \left| r \right&amp;gt;) = -0.707$&lt;/span&gt; (for the states with positive amplitude)&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$-\left| \psi \right&amp;gt; - 2*(-\left| \psi \right&amp;gt; + \left| r \right&amp;gt;) = 0$&lt;/span&gt; (for the states with negative amplitude)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\left| r \right&amp;gt; = \frac{(2/\sqrt{8} - 6/\sqrt{8})}{8} = \lvert \frac{1/\sqrt{8}}{2} \rvert$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I also found versions that can search for more than one particular states, like in &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What you could do is to re-phrase the problem and search for the states &lt;span class=&quot;math-container&quot;&gt;$\left| 000 \right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| 001 \right&amp;gt;$&lt;/span&gt;. Then you immediately know the 'location' of the others.&lt;/p&gt;&#xA;" OwnerUserId="14130" LastEditorUserId="14130" LastEditDate="2020-12-21T19:18:05.380" LastActivityDate="2020-12-21T19:18:05.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15223" PostTypeId="2" ParentId="15218" CreationDate="2020-12-21T16:43:25.613" Score="4" Body="&lt;p&gt;Yes. IBM uses superconducting Transmon qubit. Here is a quote from &lt;a href=&quot;https://www.ibm.com/quantum-computing/quantum-computing-at-ibm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM's website&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Maybe you are looking for something like this list:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t0ENH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t0ENH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-22T17:02:39.267" LastActivityDate="2020-12-22T17:02:39.267" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15224" PostTypeId="2" ParentId="15221" CreationDate="2020-12-21T16:51:14.580" Score="3" Body="&lt;p&gt;Here is a good resource:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1804.10068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum machine learning for data scientists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Here is another one that discusses different techniques people are proposing for QML in the literature and etc.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.2017.0551&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum machine learning:a classical perspective&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-21T16:51:14.580" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15225" PostTypeId="1" AcceptedAnswerId="15226" CreationDate="2020-12-21T18:11:00.050" Score="3" ViewCount="56" Body="&lt;p&gt;The X gate is given by &lt;span class=&quot;math-container&quot;&gt;$\big(\begin{smallmatrix}&#xA;  0 &amp;amp; 1 \\&#xA;  1 &amp;amp; 0&#xA;\end{smallmatrix}\big)$&lt;/span&gt; in the computational basis. In the Hadamard basis, the gate is &lt;span class=&quot;math-container&quot;&gt;$X_H = \big(\begin{smallmatrix}&#xA;  1 &amp;amp; 0\\&#xA;  0 &amp;amp; -1&#xA;\end{smallmatrix}\big) = |+ \rangle \langle +|  - |-\rangle \langle-|$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X_H |+\rangle = (|+ \rangle \langle +|  - |-\rangle \langle-|)|+\rangle = |+ \rangle \langle +|+\rangle  - |-\rangle \langle-|+\rangle = |+\rangle(1) - |-\rangle(0) = |+\rangle$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$X_H |-\rangle = (|+ \rangle \langle +|  - |-\rangle \langle-|)|-\rangle = |+ \rangle \langle +|-\rangle  - |-\rangle \langle-|-\rangle = |+\rangle (0) -|-\rangle(1) = -|-\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Meanwhile, in matrix notation,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X_H|+\rangle = \big(\begin{smallmatrix}&#xA;  1 &amp;amp; 0\\&#xA;  0 &amp;amp; -1&#xA;\end{smallmatrix}\big) \frac{1}{\sqrt{2}}\big( \begin{smallmatrix}&#xA;1 \\&#xA;1&#xA;\end{smallmatrix}\big) = \frac{1}{\sqrt{2}}\big( \begin{smallmatrix}&#xA;1 \\&#xA;-1&#xA;\end{smallmatrix}\big) = |-\rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X_H|-\rangle = \big(\begin{smallmatrix}&#xA;  1 &amp;amp; 0\\&#xA;  0 &amp;amp; -1&#xA;\end{smallmatrix}\big) \frac{1}{\sqrt{2}}\big( \begin{smallmatrix}&#xA;1 \\&#xA;-1&#xA;\end{smallmatrix}\big) = \frac{1}{\sqrt{2}}\big( \begin{smallmatrix}&#xA;1 \\&#xA;1&#xA;\end{smallmatrix}\big) = |+\rangle&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14184" LastEditorUserId="55" LastEditDate="2020-12-23T09:09:53.490" LastActivityDate="2020-12-23T09:09:53.490" Title="Mistake in using dirac notation when applying $X$ gate to vector" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;matrix-representation&gt;&lt;hadamard&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15226" PostTypeId="2" ParentId="15225" CreationDate="2020-12-21T18:30:21.860" Score="2" Body="&lt;p&gt;The basis states should &lt;strong&gt;not&lt;/strong&gt; flip, as these two basis states are the eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. The &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate flips the computational basis states, the &lt;span class=&quot;math-container&quot;&gt;$Z = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix}$&lt;/span&gt; gate flips the Hadamard basis states.&lt;/p&gt;&#xA;&lt;h2&gt;Expressing everything in the computational basis&lt;/h2&gt;&#xA;&lt;p&gt;In the computational basis, we have &lt;span class=&quot;math-container&quot;&gt;$X = \begin{bmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}$&lt;/span&gt;. Thus the states (&lt;strong&gt;expressed in the computational basis&lt;/strong&gt;) &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \begin{bmatrix}1 \\ 1\end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \begin{bmatrix}1 \\ -1\end{bmatrix}$&lt;/span&gt; are the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstates respectively, as you can readily check.&lt;/p&gt;&#xA;&lt;h2&gt;Expressing everything in the Hadamard basis&lt;/h2&gt;&#xA;&lt;p&gt;If you express everything in the Hadamard basis, the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate becomes &lt;span class=&quot;math-container&quot;&gt;$X_{H} = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;But, the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; states should now also be expressed in this basis&lt;/strong&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle_{H} = \begin{bmatrix}1 \\ 0\end{bmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle_{H} = \begin{bmatrix}0 \\ 1\end{bmatrix}$&lt;/span&gt;. It's now obvious that these states are indeed the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenstates of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, expressed in whatever basis.&lt;/p&gt;&#xA;&lt;h2&gt;To summarize your notation&lt;/h2&gt;&#xA;&lt;p&gt;So you dirac notation is correct, and in your matrix notation you expressed the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator in the Hadamard basis, but the states in the computational basis.&lt;/p&gt;&#xA;&lt;h2&gt;But wait, then what are these states if not the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; states?&lt;/h2&gt;&#xA;&lt;p&gt;So what are the states &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 \\ 1\end{bmatrix}_{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}1 \\ -1\end{bmatrix}_{H}$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate - they are the computational basis states/eigenstates of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator!&lt;/p&gt;&#xA;&lt;p&gt;Of course, you can write this out mathematically as well:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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}&#xA;$$&lt;/span&gt;&#xA;As you can see, I've been very sloppy with the normalization factor - the above equation is a factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; off.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2020-12-21T18:30:21.860" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15227" PostTypeId="2" ParentId="15203" CreationDate="2020-12-21T19:19:08.873" Score="3" Body="&lt;p&gt;The easiest way to get the unitary matrix of a couple of operations in Cirq is the &lt;code&gt;unitary&lt;/code&gt; method on the &lt;code&gt;Circuit&lt;/code&gt; class. In your case:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;a, b = cirq.LineQubit.range(2) &#xA;&#xA;theta = 0.4&#xA;phi = 0.123&#xA;u = cirq.Circuit(cirq.rx(phi)(a), cirq.rz(theta)(b)).unitary()&#xA;print(u)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Will give you the 4x4 unitary matrix&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[ 0.97821373-0.19829374j  0.        +0.j         -0.01221046-0.06023611j   0.        +0.j        ]&#xA; [ 0.        +0.j          0.97821373+0.19829374j  0.        +0.j   0.01221046-0.06023611j]&#xA; [-0.01221046-0.06023611j  0.        +0.j          0.97821373-0.19829374j   0.        +0.j        ]&#xA; [ 0.        +0.j          0.01221046-0.06023611j  0.        +0.j   0.97821373+0.19829374j]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4986" LastActivityDate="2020-12-21T19:19:08.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15228" PostTypeId="2" ParentId="15187" CreationDate="2020-12-21T19:38:14.567" Score="1" Body="&lt;p&gt;You found a bug in the docs, the method is &lt;code&gt;set_state_vector()&lt;/code&gt; - I opened &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/3623&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/issues/3623&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The methods are only available on the &lt;code&gt;SparseSimulatorStep&lt;/code&gt; which is the default simulator in Cirq.&lt;/p&gt;&#xA;&lt;p&gt;They are available in the API docs though set_state_vector has no docstring:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumai.google/reference/python/cirq/sim/SparseSimulatorStep?hl=en#state_vector&quot; rel=&quot;nofollow noreferrer&quot;&gt;state_vector()&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://quantumai.google/reference/python/cirq/sim/SparseSimulatorStep?hl=en#set_state_vector&quot; rel=&quot;nofollow noreferrer&quot;&gt;set_state_vector()&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="4986" LastActivityDate="2020-12-21T19:38:14.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15229" PostTypeId="2" ParentId="15178" CreationDate="2020-12-21T20:21:58.000" Score="1" Body="&lt;p&gt;I do not know how the crosstalk matrix works. But the way I understand QBER is the following:&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QBER = \frac{5}{60} + \frac{7}{60}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does it help a little? I welcome the community members to comment on this answer to confirm my understanding too!&lt;/p&gt;&#xA;" OwnerUserId="2403" LastEditorUserId="2403" LastEditDate="2020-12-22T00:35:10.457" LastActivityDate="2020-12-22T00:35:10.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15230" PostTypeId="1" AcceptedAnswerId="15231" CreationDate="2020-12-21T20:57:40.077" Score="3" ViewCount="49" Body="&lt;p&gt;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.&#xA;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;angle = np.deg2rad(104.45/2)&#xA;dist = 0.9584&#xA;molecule = Molecule(geometry=[['O', [0., 0., 0.]],&#xA;                              ['H', [dist*np.sin(angle), -dist*np.cos(angle), 0.]],&#xA;                              ['H', [-dist*np.sin(angle), -dist*np.sin(angle), 0.]]],&#xA;                     charge=0, multiplicity=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5065" LastEditorUserId="55" LastEditDate="2020-12-23T09:09:38.220" LastActivityDate="2020-12-23T09:09:38.220" Title="Kernel stopping when solving water molecule ground state" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15231" PostTypeId="2" ParentId="15230" CreationDate="2020-12-21T21:26:01.903" Score="3" Body="&lt;p&gt;Here is the working code. Because of the symmetry in water molecule, I used the &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Z-matrix_(chemistry)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z Matrix&lt;/a&gt;&lt;/strong&gt; representation instead of the usual XYZ format.  You can and should be able to execute this within the IBM Quantum Experience.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import os&#xA;os.environ['QISKIT_SETTINGS']=''&#xA;import matplotlib.pyplot as plt&#xA;%matplotlib inline&#xA;%config InlineBackend.figure_format = 'svg' # Makes the images look nice&#xA;import numpy as np&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE, NumPyEigensolver&#xA;from qiskit.aqua.components.optimizers import COBYLA&#xA;from qiskit.aqua.components.initial_states import Custom&#xA;from qiskit import IBMQ, BasicAer, Aer&#xA;from qiskit.chemistry.qmolecule import QMolecule&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.chemistry.core import Hamiltonian, TransformationType, QubitMappingType&#xA;from qiskit.circuit.library import TwoLocal&#xA;import warnings&#xA;warnings.filterwarnings(&amp;quot;ignore&amp;quot;,category=DeprecationWarning)&#xA;&#xA;provider = IBMQ.load_account()&#xA;simulator_backend = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;hardware_backend = provider.get_backend('ibmq_valencia')&#xA;quantum_instance = QuantumInstance(backend = simulator_backend, shots= 1, optimization_level= 3)&#xA;&#xA;atom_structure = &amp;quot;H; O 1 0.958; H 2 0.958 1 104.47&amp;quot;  &#xA;orbital_reduction=[ ] &#xA;[unit, charge, spin, basis]= [UnitsType.ANGSTROM, 0, 0, 'sto6g'] &#xA;driver = PySCFDriver(atom= atom_structure, unit=unit,charge=charge, spin=spin, basis=basis)&#xA;qmolecule = driver.run()&#xA;ferOp = Hamiltonian(transformation = TransformationType.FULL , &#xA;                    qubit_mapping = QubitMappingType.PARITY,&#xA;                    two_qubit_reduction = True,&#xA;                    freeze_core = True, &#xA;                    orbital_reduction = [ ], &#xA;                    z2symmetry_reduction = 'auto')&#xA;qubitOp, aux_ops = ferOp.run(qmolecule)&#xA;&#xA;energy_shift = ferOp._energy_shift&#xA;nuclear_repulsion_energy = ferOp._nuclear_repulsion_energy &#xA;total_shift = energy_shift + nuclear_repulsion_energy &#xA;&#xA;print('HF Energy is:' , ferOp._hf_energy )&#xA;print('\n *********************************Exact Eigensolver*************************************** \n')&#xA;exact_result = NumPyMinimumEigensolver(qubitOp).run() &#xA;ee_result = ferOp.process_algorithm_result(exact_result)&#xA;print(ee_result)&#xA;&#xA;    &#xA;#----------------------- VQE PROCESSED ---------------------------# &#xA;var_form= TwoLocal(qubitOp.num_qubits, ['ry'], ['cx'], entanglement= 'linear',&#xA;                    reps= 2,skip_unentangled_qubits=True, skip_final_rotation_layer = False, insert_barriers=True,&#xA;                    initial_state = None) &#xA;&#xA;&#xA;optimizer = COBYLA(maxiter= 50,tol=0.000000001)   &#xA;vqe = VQE(qubitOp, var_form, optimizer, initial_point = None, &#xA;          include_custom = True, aux_operators=aux_ops)&#xA;vqe_result = vqe.run(quantum_instance)&#xA;vqe_processed_result = ferOp.process_algorithm_result(vqe_result)&#xA;vqe_energy = vqe_result['eigenvalue'] + total_shift&#xA;total_ang_moment = vqe_processed_result['total_angular_momentum'] &#xA;print('Optimal VQE energy at this step is:', vqe_energy)&#xA;print('The corresponding Total Angular Momentum is', total_ang_moment)&#xA;vqe.get_optimal_circuit().draw('mpl', style = {'name': 'bw'}, scale = 0.75, plot_barriers = False) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Ran this gave me the output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;HF Energy is: -75.6787913259016&#xA;&#xA; *********************************Exact Eigensolver*************************************** &#xA;&#xA;=== GROUND STATE ENERGY ===&#xA; &#xA;* Electronic ground state energy (Hartree): -84.916233233599&#xA;  - computed part:      -23.633272241623&#xA;  - frozen energy part: -61.282960991976&#xA;  - particle hole part: 0.0&#xA;~ Nuclear repulsion energy (Hartree): 9.187404411009&#xA;&amp;gt; Total ground state energy (Hartree): -75.72882882259&#xA;Optimal VQE energy at this step is: (-72.69078459811197+0j)&#xA;The corresponding Total Angular Momentum is 1.2057181036792375&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the optimal circuit:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CGHf9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CGHf9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;code&gt;entanglement= 'linear'&lt;/code&gt; 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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var_form= TwoLocal(qubitOp.num_qubits, ['ry'], ['cx'], entanglement= [ [0,1],[2,3],[4,5],[6,7] ],&#xA;                    reps= 1,skip_unentangled_qubits=True, skip_final_rotation_layer = False, insert_barriers=True,&#xA;                    initial_state = None) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then you would get something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────┐ ░       ░  ┌──────────┐&#xA;q_0: ┤ RY(θ[0]) ├─░───■───░──┤ RY(θ[8]) ├&#xA;     ├──────────┤ ░ ┌─┴─┐ ░  ├──────────┤&#xA;q_1: ┤ RY(θ[1]) ├─░─┤ X ├─░──┤ RY(θ[9]) ├&#xA;     ├──────────┤ ░ └───┘ ░ ┌┴──────────┤&#xA;q_2: ┤ RY(θ[2]) ├─░───■───░─┤ RY(θ[10]) ├&#xA;     ├──────────┤ ░ ┌─┴─┐ ░ ├───────────┤&#xA;q_3: ┤ RY(θ[3]) ├─░─┤ X ├─░─┤ RY(θ[11]) ├&#xA;     ├──────────┤ ░ └───┘ ░ ├───────────┤&#xA;q_4: ┤ RY(θ[4]) ├─░───■───░─┤ RY(θ[12]) ├&#xA;     ├──────────┤ ░ ┌─┴─┐ ░ ├───────────┤&#xA;q_5: ┤ RY(θ[5]) ├─░─┤ X ├─░─┤ RY(θ[13]) ├&#xA;     ├──────────┤ ░ └───┘ ░ ├───────────┤&#xA;q_6: ┤ RY(θ[6]) ├─░───■───░─┤ RY(θ[14]) ├&#xA;     ├──────────┤ ░ ┌─┴─┐ ░ ├───────────┤&#xA;q_7: ┤ RY(θ[7]) ├─░─┤ X ├─░─┤ RY(θ[15]) ├&#xA;     └──────────┘ ░ └───┘ ░ └───────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2020-12-22T17:04:35.913" LastActivityDate="2020-12-22T17:04:35.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15232" PostTypeId="2" ParentId="15190" CreationDate="2020-12-21T23:46:30.110" Score="0" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; have Kraus representation &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\sum_a A_a X A_a^\dagger$&lt;/span&gt;.&#xA;Its Choi then has the form &lt;span class=&quot;math-container&quot;&gt;$J(\Phi) = \sum_a \mathrm{vec}(A_a)\mathrm{vec}(A_a)^\dagger$&lt;/span&gt;. This works both ways: if the Choi has this form, then the &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; are Kraus operators for &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; (note that the normalization condition on the Kraus operators translates into the condition &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_1(J(\Phi))=I$&lt;/span&gt; for the Choi).&lt;/p&gt;&#xA;&lt;p&gt;Therefore, if the Choi has rank one, &lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=\mathrm{vec}(A)\mathrm{vec}(A)^\dagger$&lt;/span&gt; for some linear operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=AXA^\dagger$&lt;/span&gt;. This implies that &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is an isometric channel.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-12-21T23:46:30.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15233" PostTypeId="1" AcceptedAnswerId="15238" CreationDate="2020-12-22T19:20:59.653" Score="2" ViewCount="58" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I know that within Qiskit, I can specify:&#xA;&lt;code&gt;backend._configuration.max_shots= shots &lt;/code&gt; to change the number of max_shots but this only works for simulator. I &lt;strong&gt;can't&lt;/strong&gt; increase the &lt;code&gt;shots&lt;/code&gt; parameter to go over &lt;strong&gt;8192 shots&lt;/strong&gt; when I set my backend as one of the real hardware. That is, if I specify the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;hardware_backend = provider.get_backend('ibmq_valencia ')&#xA;maxshots = 20000&#xA;hardware_backend._configuration.max_shots= maxshots&#xA;quantum_instance = QuantumInstance(hardware_backend, shots = maxshots, initial_layout = None,&#xA;                                   optimization_level = 3)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then upon executing the circuit, I will have an error message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Error is : The number of shots in the Qobj (20000) is higher than the number of shots supported by the device (8192). &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is there a quick and elegant way to overcome this issue within Qiskit?&lt;/strong&gt; Thank you!&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-23T07:34:54.580" Title="Increase maximum shots on IBM Hardware when running Quantum Variational Algorithms" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15234" PostTypeId="1" AcceptedAnswerId="15236" CreationDate="2020-12-22T22:40:40.763" Score="4" ViewCount="38" Body="&lt;p&gt;The fidelity of a qubit is nicely defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Fidelity_of_quantum_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and gate fidelity as &amp;quot;the average fidelity of the output state&#xA;over pure input states&amp;quot; (&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/0953-8984/27/15/154205/ampdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;defined here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;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: &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma)=\left|\left\langle\psi_{\rho} \mid \psi_{\sigma}\right\rangle\right|^{2}$&lt;/span&gt; for comparing the input state to the output state. It is easy to work with. A solution explained in these terms is much preferred.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="14239" LastEditDate="2020-12-22T22:48:44.537" LastActivityDate="2020-12-23T02:06:03.397" Title="How to Aggregate Multiple Gate Fidelities" Tags="&lt;quantum-gate&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15235" PostTypeId="1" AcceptedAnswerId="15257" CreationDate="2020-12-23T01:38:42.163" Score="7" ViewCount="175" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Deutsch-Jozsa algorithm&lt;/a&gt; can compute if some function &lt;span class=&quot;math-container&quot;&gt;$f : \{0,1\}^n \rightarrow \{0,1\} $&lt;/span&gt; is constant. This goes exponentially faster than on classical computers.&lt;/p&gt;&#xA;&lt;p&gt;If we consider the set of all boolean functions &lt;span class=&quot;math-container&quot;&gt;$f : \{0,1\}^n \rightarrow \{0,1\} $&lt;/span&gt; is there a characterizations or intuition about the properties of boolean functions, which achieve such a speedup compared to classical computations?&lt;/p&gt;&#xA;&lt;p&gt;Consider for example the AND gate, which ANDs all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; 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?&lt;/p&gt;&#xA;" OwnerUserId="14240" LastEditorUserId="2927" LastEditDate="2020-12-26T14:20:39.647" LastActivityDate="2021-04-16T23:01:46.083" Title="What kind of boolean functions are faster to compute on qc?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;speedup&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15236" PostTypeId="2" ParentId="15234" CreationDate="2020-12-23T02:06:03.397" Score="2" Body="&lt;p&gt;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 &lt;strong&gt;bound&lt;/strong&gt; the total gate fidelity. This is the &amp;quot;chaining property for fidelity&amp;quot; ( e.g. Nielsen and Chuang Section 9.3).&lt;/p&gt;&#xA;&lt;p&gt;Suppose you intend to apply &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as the first gate in a sequence, but the actual operation you apply is the CPTP map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_1(\rho)$&lt;/span&gt; which is some noisy version of &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;. A natural way to measure the error is in the operation you applied is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E(U_1, \mathcal{E}_1) = \max_\rho D(U_1 \rho U_1^\dagger, \mathcal{E}_1(\rho))&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$D(\rho, \sigma) = \arccos \sqrt{F(\rho, \sigma)}$&lt;/span&gt; is a possible choice for &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt;, but you can use any &lt;em&gt;metric&lt;/em&gt; over quantum states. Finding the maximum distance between &lt;span class=&quot;math-container&quot;&gt;$U_1 \rho U_1^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_1(\rho)$&lt;/span&gt; over density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; tells you the worst possible outcome you can get from your noisy implementation of the gate. Then, if you define the error similarly for &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; and its noisy implementation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_2$&lt;/span&gt; then you can guarantee that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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 ) &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately the fidelity &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma) =\text{Tr}( \rho \sigma)$&lt;/span&gt; that you give isn't a proper metric over states so you can't substitute that into the chaining property above.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-12-23T02:06:03.397" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15237" PostTypeId="2" ParentId="15221" CreationDate="2020-12-23T02:14:13.023" Score="1" Body="&lt;p&gt;The textbook &lt;a href=&quot;https://www.springer.com/gp/book/9783319964232&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supervised Learning with Quantum Computers&lt;/a&gt; (Schuld and Petruccione) is very pedagogical and gives a broad survey of the field (at least up to 2018). They have a preprint  &lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;nofollow noreferrer&quot;&gt;An introduction to quantum machine learning&lt;/a&gt; that covers a lot of the same material but with less depth.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-12-23T02:14:13.023" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15238" PostTypeId="2" ParentId="15233" CreationDate="2020-12-23T07:34:54.580" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;To get &lt;em&gt;better&lt;/em&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-23T07:34:54.580" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15239" PostTypeId="1" AcceptedAnswerId="15242" CreationDate="2020-12-23T08:23:16.623" Score="0" ViewCount="51" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&lt;p&gt;As per my workout, it should be one. But It seems they are doing something fishy here.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gUu51.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gUu51.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;To be honest I would be surprised if this book is giving wrong solutions.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-02T10:54:04.197" LastActivityDate="2021-02-02T10:54:04.197" Title="Compute the squared overlap between different given qubit states" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;inner-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15240" PostTypeId="1" CreationDate="2020-12-23T08:41:48.727" Score="1" ViewCount="70" Body="&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;&#xA;def random_bitstring_generator(bit_number, backend):&#xA;   &#xA;&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;&#xA;    one_qubit_random_bit_generator_circuit = QuantumCircuit(1, 1)&#xA;    one_qubit_random_bit_generator_circuit.h(0)&#xA;    one_qubit_random_bit_generator_circuit.measure(0, 0)&#xA;&#xA;    for _ in range(bit_number):&#xA;        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=8192).result().get_counts()&#xA;        bit = list(counts.keys())[0]  &#xA;        bitstring += bit&#xA;&#xA;    return bitstring&#xA;&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;print(random_bitstring_generator(1024, backend))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How can i insert a noise model replicating IBM melbourne quantum machine for the circuit execution on simulator&lt;/li&gt;&#xA;&lt;li&gt;Is there a way to be able export the sequence received as output to an text/csv file&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2020-12-25T23:38:07.833" LastActivityDate="2021-05-25T00:05:40.477" Title="Qiskit: simulate a circuit using a backend noise model" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;noise&gt;&lt;export-output&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15241" PostTypeId="2" ParentId="15240" CreationDate="2020-12-23T08:49:26.103" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/2_device_noise_simulation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/simulators/2_device_noise_simulation.html&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bitstring&lt;/code&gt; is a string, you can manipulate it and save it using Python commands.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2020-12-23T08:49:26.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15242" PostTypeId="2" ParentId="15239" CreationDate="2020-12-23T09:02:08.357" Score="2" Body="&lt;p&gt;Let's decompose each of the calculation.&lt;/p&gt;&#xA;&lt;p&gt;By having in mind that &lt;span class=&quot;math-container&quot;&gt;$\langle 0 | 0\rangle = \langle 1 | 1\rangle = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle 0 | 1\rangle =\langle 1 | 0\rangle = 0$&lt;/span&gt;, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &amp;amp;\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} \\&#xA;&amp;amp; \Longrightarrow |\langle \psi_0 | \psi_1\rangle|^2 = \left( \frac{-1}{2} \right)^2 = \frac{1}{4}&#xA;\end{align*}&lt;/span&gt;&#xA;You do the exact same thing for &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi_0 | \psi_2\rangle|^2$&lt;/span&gt;, the only thing changing being the sign in front of &lt;span class=&quot;math-container&quot;&gt;$\frac{\sqrt{3}}{2}$&lt;/span&gt;, but since it &amp;quot;becomes&amp;quot; 0, nothing changes.&lt;/p&gt;&#xA;&lt;p&gt;As for the last one :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &#xA;\langle \psi_1 | \psi_2\rangle &amp;amp;= \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)  \\&#xA;&amp;amp;= \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} \\&#xA;&amp;amp;= -\frac{1}{2} \\&#xA;&amp;amp; \Longrightarrow |\langle \psi_1 | \psi_2\rangle|^2 = \left( \frac{-1}{2} \right)^2 = \frac{1}{4}&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please tell me if there is something you don't understand in this, I hope this helps ! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2020-12-23T09:02:08.357" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15243" PostTypeId="2" ParentId="15240" CreationDate="2020-12-23T10:47:31.790" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;Add this code to your current code.&#xA;This creates a simulator &lt;code&gt;backend&lt;/code&gt; with the noise model from &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import QasmSimulator&#xA;&#xA;provider = IBMQ.load_account()&#xA;ibmq_melbourne = provider.get_backend('ibmq_16_melbourne')&#xA;backend = QasmSimulator.from_backend(ibmq_melbourne)&#xA;&#xA;print(random_bitstring_generator(1024, backend))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Your output is already a string. If you want to dump that in a file, you can do this (this is a &lt;a href=&quot;https://stackoverflow.com/a/5214587/8146172&quot;&gt;general Python question&lt;/a&gt;, not related to Qiskit:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;with open(&amp;quot;output.txt&amp;quot;, &amp;quot;w&amp;quot;) as text_file:&#xA;    text_file.write(random_bitstring_generator(1024, backend))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note:&#xA;If you are trying generate a random number generator, probably you should have a look to &lt;a href=&quot;https://qiskit.org/documentation/apidoc/ibmq_random.html#module-qiskit.providers.ibmq.random&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;qiskit.providers.ibmq.random&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-12-23T10:47:31.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15244" PostTypeId="2" ParentId="14688" CreationDate="2020-12-23T11:09:53.760" Score="2" Body="&lt;p&gt;&lt;strong&gt;Short Answer&lt;/strong&gt;: There is no universal gate that can entangle the output state for any given ? and ??? operators in the circuit given in the question.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Long Answer&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;Say you have the entangle state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha |00\rangle + \beta |11\rangle$&lt;/span&gt; before applying the ??? operator. Let the ??? operator correspond to the matrix &lt;span class=&quot;math-container&quot;&gt;$M = \begin{bmatrix}m_1 &amp;amp; m_2 \\ m_3 &amp;amp; m_4\end{bmatrix}$&lt;/span&gt;. So once you apply &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; on the first qubit of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, you get the state &lt;span class=&quot;math-container&quot;&gt;$$\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.$$&lt;/span&gt; Now, we need an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that acts on the second qubit of &lt;span class=&quot;math-container&quot;&gt;$\hat{|\psi\rangle}$&lt;/span&gt; to give us a state of the form &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = \alpha' |00\rangle + \beta' |11\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$U = \begin{bmatrix}u_1 &amp;amp; u_2 \\ u_3 &amp;amp; u_4\end{bmatrix}$&lt;/span&gt;. The operation of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the second qubit of &lt;span class=&quot;math-container&quot;&gt;$\hat{|\psi\rangle}$&lt;/span&gt; can be given as &lt;span class=&quot;math-container&quot;&gt;$$\begin{align}(I \times U)\hat{|\psi\rangle} &amp;amp;= \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] \\&#xA;&amp;amp;= (\alpha~m_1 u_1 + \beta~m_2u_2)|00\rangle + (\alpha~m_1 u_3 + \beta~m_2u_4)|01\rangle\\&#xA;&amp;amp; ~~~~+ (\alpha~m_3 u_1 + \beta~m_4u_2)|10\rangle + (\alpha~m_3 u_3 + \beta~m_4u_4)|11\rangle  \end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, notice that if the operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is such that the amplitudes of &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; are zero then we achieve an entangled state. Mathematically, we need &lt;span class=&quot;math-container&quot;&gt;$$\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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is a well known fact that any single qubit operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be represented as &lt;span class=&quot;math-container&quot;&gt;$A = \begin{bmatrix}\cos{(\theta/2)} &amp;amp; -e^{i\lambda}\sin{(\theta/2)}\\ e^{i\phi}\sin{(\theta/2)} &amp;amp; e^{i(\lambda+\phi)}\cos{(\theta/2)}\end{bmatrix}$&lt;/span&gt; (For more information on this check &lt;a href=&quot;https://qiskit.org/textbook/ch-states/single-qubit-gates.html#7.-General-U-gates--&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gates&lt;/a&gt;.) Using this notation we can write the operators &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$$M = \begin{bmatrix}\cos{(\theta_m/2)} &amp;amp; -e^{i\lambda_m}\sin{(\theta_m/2)}\\ e^{i\phi_m}\sin{(\theta_m/2)} &amp;amp; e^{i(\lambda_m+\phi_m)}\cos{(\theta_m/2)}\end{bmatrix} \text{ ; } U = \begin{bmatrix}\cos{(\theta_u/2)} &amp;amp; -e^{i\lambda_u}\sin{(\theta_u/2)}\\ e^{i\phi_u}\sin{(\theta_u/2)} &amp;amp; e^{i(\lambda_u+\phi_u)}\cos{(\theta_u/2)}\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using this notation and solving for the first equation of (&lt;span class=&quot;math-container&quot;&gt;$\ref{eqn:1}$&lt;/span&gt;), we get &lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&#xA;Similarly for the second equation of (&lt;span class=&quot;math-container&quot;&gt;$\ref{eqn:1}$&lt;/span&gt;), we get &lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if you apply an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that satisfies the conditions (&lt;span class=&quot;math-container&quot;&gt;$\ref{eqn:2}$&lt;/span&gt;) and (&lt;span class=&quot;math-container&quot;&gt;$\ref{eqn:3}$&lt;/span&gt;), then the final state will still be an entangled state of the form &lt;span class=&quot;math-container&quot;&gt;$\alpha'|00\rangle + \beta' |11\rangle$&lt;/span&gt;. If any gate that violates (&lt;span class=&quot;math-container&quot;&gt;$\ref{eqn:2}$&lt;/span&gt;) and (&lt;span class=&quot;math-container&quot;&gt;$\ref{eqn:3}$&lt;/span&gt;) is applied to the circuit, then you will not get an entangled state of the form &lt;span class=&quot;math-container&quot;&gt;$\alpha'|00\rangle + \beta' |11\rangle$&lt;/span&gt;. Hence you will need to know the ? and the ??? gates to get the output in the form &lt;span class=&quot;math-container&quot;&gt;$\alpha'|00\rangle + \beta' |11\rangle$&lt;/span&gt; with certainty.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-23T11:09:53.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15245" PostTypeId="2" ParentId="15235" CreationDate="2020-12-23T11:14:03.720" Score="2" Body="&lt;p&gt;Deutsch-Jozsa algorithm is about &lt;em&gt;classifying&lt;/em&gt; an oracle &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; as constant/balanced. The complexity of executing the oracle &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; itself is not directly relevant for that classification. What it is relevant is how many executions of the oracle &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; are needed to answer the constant/balanced question.&lt;/p&gt;&#xA;&lt;p&gt;An example: Let's take an &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;. You don't know it yet, but &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is defined as the classical XOR gate, therefore it is &lt;em&gt;balanced&lt;/em&gt;. You need, classically, to execute &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; 3 times (&lt;span class=&quot;math-container&quot;&gt;$2^{{n-1}}+1$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2020-12-23T21:50:37.300" LastActivityDate="2020-12-23T21:50:37.300" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15246" PostTypeId="1" CreationDate="2020-12-23T12:46:56.697" Score="1" ViewCount="50" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H5FAN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H5FAN.png&quot; alt=&quot;the csv file was added in the Quantum Lab&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/982pN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/982pN.png&quot; alt=&quot;Screenshot of what I am doing&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I uploaded a CSV file using import in Quantum Computing Lab folder. It is uploaded, I can see it. When I write &amp;quot;import filename&amp;quot; in my notebook, it shows an error.&#xA;I have tried doing the same in my local PC. It is working fine.&#xA;What am I doing wrong? Is there any other way to upload a CSV file and use it?&lt;/p&gt;&#xA;" OwnerUserId="14245" LastEditorUserId="55" LastEditDate="2020-12-25T23:38:27.707" LastActivityDate="2020-12-25T23:38:27.707" Title="I am uploading a CSV file but cannot access it in the notebook" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="4" ClosedDate="2020-12-28T13:38:28.617" ContentLicense="CC BY-SA 4.0" />
  <row Id="15247" PostTypeId="2" ParentId="13794" CreationDate="2020-12-23T14:39:16.070" Score="-1" Body="&lt;p&gt;There is another technique to prove the BELL STATE MEASUREMENT.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mw3uH.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mw3uH.jpg&quot; alt=&quot;Here after multiplying the gate matrix we used the truth table for CNOT and got the answer and because of the H gate the probability will be 1/2 for |00&amp;gt; and |11&amp;gt;. See the image to understand better. Rule of CNOT Gate:- When control is 0 target remains the same but when the control is 1 the target flips.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14137" LastActivityDate="2020-12-23T14:39:16.070" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15248" PostTypeId="2" ParentId="15221" CreationDate="2020-12-23T14:39:16.670" Score="2" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;This interesting &lt;a href=&quot;https://dl.acm.org/doi/10.1145/602382.602408&quot; rel=&quot;nofollow noreferrer&quot;&gt;thesis&lt;/a&gt; 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 &lt;strong&gt;polynomial speedup for P problems&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;Sometimes the quantum computer(or the quantum annealer) might only be a &lt;strong&gt;subroutine&lt;/strong&gt;. For example, this &lt;a href=&quot;https://arxiv.org/abs/1510.06356&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lockheed Martin research&lt;/a&gt; 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 &lt;a href=&quot;http://yann.lecun.com/exdb/mnist/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MNIST&lt;/a&gt;), 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.&lt;/p&gt;&#xA;&lt;p&gt;Then I move on to works that quantum computing plays most of the job, supervised and unsupervised learning are both contained.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;strong&gt;linear&lt;/strong&gt;(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 &lt;span class=&quot;math-container&quot;&gt;$\hat w_j(t+1)=\hat w_j(t)+\eta(|d\rangle-|y(y)\rangle)\langle x_j|$&lt;/span&gt; isn't unitary-preserving since matrices composed of the addition of unitary matrices may not be unitary, see &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0107012.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; as the reference. So I think using a quantum neural network to classify classical data, like MNIST, is impossible.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|=U|\phi\rangle\langle\phi|U^\dagger$&lt;/span&gt;. A &lt;a href=&quot;https://www.nature.com/articles/s41467-020-14454-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum neural network&lt;/a&gt; is sufficient to learn the unknown operation, and but it is inefficient(no faster than an already inefficient &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0702131&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum process tomography&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;For both supervised and unsupervised learning, &lt;a href=&quot;https://arxiv.org/abs/1409.3097&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; 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, &lt;a href=&quot;https://link.springer.com/article/10.1007/s10994-012-5316-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; gives a handful of algorithms that teaches you how to use Grover search to faster the unsupervised algorithms.&lt;/p&gt;&#xA;&lt;p&gt;There is also the quantum mechanical implementation of decision tree algorithms(&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9706062&quot; rel=&quot;nofollow noreferrer&quot;&gt;see this paper&lt;/a&gt;). 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).&lt;/p&gt;&#xA;&lt;p&gt;Finally, machine learning facilitated quantum computing. First, there is a &lt;a href=&quot;https://journals.aps.org/pra/abstract/10.1103/PhysRevA.102.012601&quot; rel=&quot;nofollow noreferrer&quot;&gt;recent stud&lt;/a&gt;y that utilizes a machine learning algorithm(I haven't seen the paper so I do not know which algorithm they used) to achieve a &lt;strong&gt;Toffoli gate&lt;/strong&gt; with higher fidelity. &lt;a href=&quot;https://arxiv.org/abs/1103.0855&quot; rel=&quot;nofollow noreferrer&quot;&gt;This work&lt;/a&gt; is called CRAB, it accepts multiple methods to optimize the quantum control of real quantum experiments, the gradient descent(BFGS, BGD) is included.&lt;/p&gt;&#xA;&lt;p&gt;The above is all I know, and I hope this might be helpful.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastEditorUserId="13647" LastEditDate="2020-12-24T01:07:26.203" LastActivityDate="2020-12-24T01:07:26.203" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15249" PostTypeId="1" CreationDate="2020-12-23T15:48:31.917" Score="3" ViewCount="325" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Original Question:&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/algorithms/03_vqe_simulation_with_noise.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/algorithms/03_vqe_simulation_with_noise.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;result = vqe.compute_minimum_eigenvalue(operator=H2_op)&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.python.org/downloads/release/python-391rc1/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.python.org/downloads/release/python-391rc1/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: 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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;import time&#xA;&#xA;toc = time.perf_counter()&#xA;molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                              ['H', [0., 0., 0.735]]],&#xA;                     charge=0, multiplicity=1)&#xA;driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER)&#xA;vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;&#xA;calc = GroundStateEigensolver(transformation, vqe_solver)&#xA;toc = time.perf_counter()&#xA;res = calc.solve(driver)&#xA;tic = time.perf_counter()&#xA;print('program completed in {} seconds'.format(tic-toc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver&#xA;import time&#xA;&#xA;molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                              ['H', [0., 0., 0.735]]],&#xA;                     charge=0, multiplicity=1)&#xA;driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER)&#xA;&#xA;numpy_solver = NumPyMinimumEigensolver()&#xA;&#xA;calc = GroundStateEigensolver(transformation, numpy_solver)&#xA;toc = time.perf_counter()&#xA;res = calc.solve(driver)&#xA;tic = time.perf_counter()&#xA;print('program complered in {} seconds'.format(tic-toc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14247" LastEditorUserId="14247" LastEditDate="2020-12-28T23:25:48.133" LastActivityDate="2021-05-05T13:02:40.353" Title="Qiskit issues with Apple Silicon?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15251" PostTypeId="1" CreationDate="2020-12-23T18:22:11.937" Score="0" ViewCount="149" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Question:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/kvtBk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kvtBk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Answer:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/508dH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/508dH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QSNDo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QSNDo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Why is there two &lt;code&gt;H&lt;/code&gt; over here? I thought it would be just &lt;code&gt;H * Cnot&lt;/code&gt;?&lt;/li&gt;&#xA;&lt;li&gt;Where from do we get these representations?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YOcwh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YOcwh.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-01-24T03:02:38.130" Title="Explanation of NOT gate in Hadamard basis" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="2" CommentCount="2" ClosedDate="2021-01-25T12:15:40.493" ContentLicense="CC BY-SA 4.0" />
  <row Id="15252" PostTypeId="2" ParentId="15251" CreationDate="2020-12-23T19:48:34.800" Score="3" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right&amp;gt; = \alpha \left|0\right&amp;gt; + \beta \left|1\right&amp;gt;$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\alpha = \left&amp;lt;0|\psi\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta = \left&amp;lt;1|\psi\right&amp;gt;$&lt;/span&gt;. A 1-qubit unitary operator can be written as &lt;span class=&quot;math-container&quot;&gt;$U = a\left|0\right&amp;gt;\left&amp;lt;0\right| + b\left|0\right&amp;gt;\left&amp;lt;1\right| + c\left|1\right&amp;gt;\left&amp;lt;0\right| + d\left|1\right&amp;gt;\left&amp;lt;1\right|$&lt;/span&gt; and this will correspond to a matrix &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}a &amp;amp; b\\c &amp;amp; d\end{pmatrix}$&lt;/span&gt;: to see this, notice that through the projection form &lt;span class=&quot;math-container&quot;&gt;$U \left|\psi\right&amp;gt; = (a \left&amp;lt;0|\psi\right&amp;gt; + b \left&amp;lt;1|\psi\right&amp;gt;)\left|0\right&amp;gt; + (c\left&amp;lt;0|\psi\right&amp;gt; + d\left&amp;lt;1|\psi\right&amp;gt;)\left|1\right&amp;gt;$&lt;/span&gt;. To get the values of the matrix out of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and bras and kets of the computational basis states, notice &lt;span class=&quot;math-container&quot;&gt;$U\left|0\right&amp;gt; = a\left|0\right&amp;gt; + c\left|1\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U\left|1\right&amp;gt; = b\left|0\right&amp;gt; + d\left|1\right&amp;gt;$&lt;/span&gt;: from this, the general matrix form can be given as &lt;span class=&quot;math-container&quot;&gt;$U = \begin{pmatrix}\left&amp;lt;0\right|U\left|0\right&amp;gt; &amp;amp; \left&amp;lt;0\right|U\left|1\right&amp;gt; \\\left&amp;lt;1\right|U\left|0\right&amp;gt; &amp;amp; \left&amp;lt;1\right|U\left|1\right&amp;gt; \end{pmatrix}$&lt;/span&gt;: this gives the answer to your second question when &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is said operator.&lt;/p&gt;&#xA;&lt;p&gt;For the other question, if &lt;span class=&quot;math-container&quot;&gt;$T = \begin{pmatrix}\left&amp;lt;+|0\right&amp;gt; &amp;amp; \left&amp;lt;+|1\right&amp;gt; \\\left&amp;lt;-|0\right&amp;gt; &amp;amp; \left&amp;lt;-|1\right&amp;gt; \end{pmatrix}$&lt;/span&gt;, then an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;'s form in the new basis is given by &lt;span class=&quot;math-container&quot;&gt;$U^T = \begin{pmatrix}\left&amp;lt;+\right|U\left|+\right&amp;gt; &amp;amp; \left&amp;lt;+\right|U\left|-\right&amp;gt; \\\left&amp;lt;-\right|U\left|+\right&amp;gt; &amp;amp; \left&amp;lt;-\right|U\left|-\right&amp;gt; \end{pmatrix}$&lt;/span&gt;, and it represents the operation's matrix when &lt;span class=&quot;math-container&quot;&gt;$\left|+\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|-\right&amp;gt;$&lt;/span&gt; are treated as &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1 \\0\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0 \\ 1\end{pmatrix}$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$\left|0\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;. Then, &lt;span class=&quot;math-container&quot;&gt;$U^T = T U T^{-1}$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$T^{-1}$&lt;/span&gt; turns the representation in terms of the new basis back to its representation in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; runs the operator in the computational basis, and then &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; converts it back to the new basis. As stated in the text, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is its own inverse, so &lt;span class=&quot;math-container&quot;&gt;$H U_{NOT}H^{-1} = HU_{NOT}H$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2020-12-23T23:53:56.547" LastActivityDate="2020-12-23T23:53:56.547" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15253" PostTypeId="1" CreationDate="2020-12-23T20:00:59.517" Score="6" ViewCount="141" Body="&lt;p&gt;If I look at the circuit diagram of the Deutsch–Jozsa Algorithm:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SottO.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SottO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now given the fact that Hadamard matrix or gate is its own inverse (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_(H)_gate&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;), shouldn't the output (top wire) simply give back &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14251" LastEditorUserId="9006" LastEditDate="2020-12-24T07:41:54.103" LastActivityDate="2020-12-25T02:42:52.717" Title="Why isn't output of Deutsch–Jozsa Algorithm simply $|0\rangle$?" Tags="&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="5" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15254" PostTypeId="2" ParentId="15253" CreationDate="2020-12-23T20:25:15.480" Score="3" Body="&lt;p&gt;Not really. You can't cancel the H gates on the first qubit because the order of gates matters. Similiar to matrix multiplication, A&lt;em&gt;B&lt;/em&gt;C is not equal to A&lt;em&gt;C&lt;/em&gt;B.&lt;/p&gt;&#xA;" OwnerUserId="13209" LastActivityDate="2020-12-23T20:25:15.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15255" PostTypeId="1" CreationDate="2020-12-23T22:33:03.047" Score="1" ViewCount="37" Body="&lt;p&gt;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:&#xA;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?&#xA;What will change in privacy amplification?&#xA;If what happens, privacy amplification will be completed?&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="13548" LastEditDate="2021-01-01T19:36:39.167" LastActivityDate="2021-01-01T19:36:39.167" Title="Differences between Extractors and Privacy Amplification for Quantum Random Generators" Tags="&lt;programming&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15256" PostTypeId="2" ParentId="15253" CreationDate="2020-12-23T23:46:25.230" Score="6" Body="&lt;p&gt;This is because of what known as Phase kickback.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ga1Wb.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ga1Wb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Quantum Phase Estimation algorithm&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-23T23:46:25.230" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15257" PostTypeId="2" ParentId="15235" CreationDate="2020-12-23T23:57:18.237" Score="6" Body="&lt;p&gt;Following up on @luciano's answer, I think you are envisioning a quantum computer as being fast at &lt;em&gt;evaluating functions&lt;/em&gt;, when in actuality, quantum computers are better at evaluating &lt;em&gt;global properties&lt;/em&gt; of functions (and not, necessarily, the function themselves.)&lt;/p&gt;&#xA;&lt;p&gt;For example referring to the Deutsch-Jozsa problem, consider two separate bags containing Boolean functions on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; variables.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In one bag (called &amp;quot;constant&amp;quot;) we put in the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; functions that either evaluate to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; inputs, or to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; inputs; and&lt;/li&gt;&#xA;&lt;li&gt;In another bag (called &amp;quot;balanced&amp;quot;) we put in the functions that evaluate to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; for precisely &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}$&lt;/span&gt; inputs (and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; otherwise).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$2^{n-1}+1$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;This &amp;quot;balanced&amp;quot; vs. &amp;quot;constant&amp;quot; property is a &lt;em&gt;global&lt;/em&gt; property of the functions, closer to what a Fourier transform evaluates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;ADDED&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are &lt;span class=&quot;math-container&quot;&gt;$2^{2^n}$&lt;/span&gt; individual Boolean functions with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; inputs and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; output.  However, of all of these, there is only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; function on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; variables that performs the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt; of all inputs (namely the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{AND}$&lt;/span&gt; function), and only &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; that performs the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{XOR}$&lt;/span&gt; of all inputs (namely the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{XOR}$&lt;/span&gt; function).&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;one weird trick&lt;/em&gt; 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 &amp;quot;DC component&amp;quot; of the FT is large (&amp;quot;constant&amp;quot;) or small (&amp;quot;balanced&amp;quot;).&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2293" LastEditDate="2021-04-16T23:01:46.083" LastActivityDate="2021-04-16T23:01:46.083" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15258" PostTypeId="1" AcceptedAnswerId="15259" CreationDate="2020-12-24T01:41:00.733" Score="2" ViewCount="103" Body="&lt;p&gt;Let's assume that the quantum state of the system is written in a standard basis {&lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt;} and when we performed a measurement we got &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as an outcome of measurement so we ensure that the system will be in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; after measurement even if we make this measurement (in this basis) many times.&lt;/p&gt;&#xA;&lt;p&gt;My question is, how we get something else than &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; {&lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;} when we are measuring in different basis {&lt;span class=&quot;math-container&quot;&gt;$|+\rangle, |-\rangle$&lt;/span&gt;} despite we didn't change the system?&lt;/p&gt;&#xA;" OwnerUserId="14252" LastEditorUserId="14252" LastEditDate="2021-01-01T23:42:51.317" LastActivityDate="2021-01-01T23:42:51.317" Title="How does the outcome of measurement of a qubit change when we use different basis despite the system hasn't changed?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ClosedDate="2020-12-29T23:50:29.083" ContentLicense="CC BY-SA 4.0" />
  <row Id="15259" PostTypeId="2" ParentId="15258" CreationDate="2020-12-24T03:01:08.677" Score="4" Body="&lt;p&gt;It is a postulate of quantum mechanics that any device that measures a two-state quantum system (a qubit) must have two preferred states &lt;span class=&quot;math-container&quot;&gt;$\{|e_1\rangle, |e_2\rangle \}$&lt;/span&gt; that form an orthonormal basis for the associated vector space (here would be &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;A measurement on the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; transforms &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into one of the these basis vectors &lt;span class=&quot;math-container&quot;&gt;$|e_1 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt;. The probability that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is measured as &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt; is the square of the magnitude of the amplitude of the component of the state in the direction of the basis vector  &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt; . Hence the name projection.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QVCJ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QVCJ7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you are in the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and your measurement is in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$\{ |0\rangle, |1\rangle \}$&lt;/span&gt;, then the probability of observing the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the magnitude square of the component of the projected vector. When you project the vector &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; onto the vector &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; you get the vector &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}}|0\rangle$&lt;/span&gt;. Thus the probability of observing the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|1/\sqrt{2}|^2 = \dfrac{1}{2}$&lt;/span&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; can be projected to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and the resultant vector is &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;, hence the probability of observing &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is also &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, if you measure in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle \}$&lt;/span&gt; then the projection of &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; onto itself is itself. That is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; will be just transforms to &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;. Thus the probability of observing &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle \}$&lt;/span&gt; is 1.&lt;/p&gt;&#xA;&lt;p&gt;From here we can see that the notion of &lt;em&gt;superposition&lt;/em&gt; is &lt;strong&gt;basis-dependent&lt;/strong&gt;. All states are superposition with respect to some bases but not with respect to others. That is, a state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; is only a superposition with respect to the  computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle \}$&lt;/span&gt; but not a superposition with respect to the bases &lt;span class=&quot;math-container&quot;&gt;$\{ \alpha |0\rangle + \beta |1\rangle, \beta^* |0\rangle - \alpha^* |1\rangle \}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since measuring a superposition state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle =  \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; is probabilisitc, it is tempted to say that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is a probabilistic mixture of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and we just don't know which, when in fact, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is actually a definite state. That is, if we measure &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in certain bases, we will get a deterministic result.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-24T03:01:08.677" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15260" PostTypeId="2" ParentId="15253" CreationDate="2020-12-24T07:38:55.037" Score="3" Body="&lt;p&gt;Just to add that the Oracle in the algorithm causes entanglement among first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and the last one. As you can see, the last qubit is in state &lt;span class=&quot;math-container&quot;&gt;$f(x) \oplus y$&lt;/span&gt;.This means that it is influenced by values of first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. As a result these qubits are also influenced by the last qubit. So, despite the double application of Hadamard, also first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits contains information about the last qubit.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-24T07:38:55.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15261" PostTypeId="2" ParentId="15253" CreationDate="2020-12-24T08:37:11.020" Score="2" Body="&lt;p&gt;This answer is a little supplementation of @Martin Vesely.&lt;/p&gt;&#xA;&lt;p&gt;It has been proven that &amp;quot;it is not possible to build a fixed, general quantum computer which can be programmed to perform an arbitrary quantum computation&amp;quot; by &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.79.321&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To be more specific, suppose &lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt; is a data register &lt;span class=&quot;math-container&quot;&gt;$|P\rangle$&lt;/span&gt; is a program(control) register, and denote the quantum program, which is a unitary operation act on both &lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|P\rangle$&lt;/span&gt;, by &lt;span class=&quot;math-container&quot;&gt;$\hat G$&lt;/span&gt;, there is not general guarantee that &lt;span class=&quot;math-container&quot;&gt;$\hat G(|d\rangle\otimes|P\rangle)=(\hat U|d\rangle)\otimes|P\rangle$&lt;/span&gt; is possible, where &lt;span class=&quot;math-container&quot;&gt;$\hat U$&lt;/span&gt; acts solely on &lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If the &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is your question is such a quantum program &lt;span class=&quot;math-container&quot;&gt;$\hat G$&lt;/span&gt;(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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-12-24T08:37:11.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15262" PostTypeId="1" AcceptedAnswerId="15296" CreationDate="2020-12-24T14:44:11.947" Score="3" ViewCount="63" Body="&lt;p&gt;I am following &lt;a href=&quot;http://theory.caltech.edu/%7Epreskill/ph229/notes/chap7.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Preskill notes&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What I want to understand is why it is in general &lt;strong&gt;enough&lt;/strong&gt; to be able to correct n-qubit Pauli errors to say that an arbitrary error can be corrected.&lt;/p&gt;&#xA;&lt;p&gt;I call: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}(\rho)=\sum_a M_a \rho M_a^{\dagger}$&lt;/span&gt; an error map, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; the code space.&lt;/p&gt;&#xA;&lt;p&gt;A CPTP recovery operation exists &lt;strong&gt;if and only if&lt;/strong&gt;, the Kraus operator of the error map verify the Knill-Laflamme condition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall (i,j) \in C : \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j}  \rangle = C_{\delta \mu} \delta_{ij}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$C_{\delta \mu}$&lt;/span&gt; an Hermitian matrix and &lt;span class=&quot;math-container&quot;&gt;$\langle \overline{i} | \overline{j} \rangle=\delta_{ij}$&lt;/span&gt; (the family &lt;span class=&quot;math-container&quot;&gt;$| \overline{i} \rangle$&lt;/span&gt; forms an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;I call &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; the set of n-qubit Pauli operators on which we can decompose any of the &lt;span class=&quot;math-container&quot;&gt;$M_a$&lt;/span&gt;'s.&lt;/p&gt;&#xA;&lt;p&gt;He says on page 10, just below (7.26)&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;since each &lt;span class=&quot;math-container&quot;&gt;$E_a$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is a linear combination of &lt;span class=&quot;math-container&quot;&gt;$M_{\mu}$&lt;/span&gt;'s, then&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\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}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And I don't understand this. I could imagine &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}(\rho)=U \rho U^{\dagger}, U \notin \mathcal{E}$&lt;/span&gt; (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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="10480" LastEditDate="2020-12-25T16:34:01.587" LastActivityDate="2020-12-27T10:06:39.507" Title="Arbitrary error correctable iff Pauli error are: misunderstanding from Preskill notes" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15263" PostTypeId="1" CreationDate="2020-12-24T15:09:12.160" Score="3" ViewCount="28" Body="&lt;h2&gt;Context of my question&lt;/h2&gt;&#xA;&lt;p&gt;I call: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}(\rho)=\sum_a M_a \rho M_a^{\dagger}$&lt;/span&gt; an error map, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; the code space.&lt;/p&gt;&#xA;&lt;p&gt;A CPTP recovery operation exists &lt;strong&gt;if and only if&lt;/strong&gt;, the Kraus operator of the error map verify the Knill-Laflamme condition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall (i,j) \in C : \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j}  \rangle = C_{\delta \mu} \delta_{ij}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$C_{\delta \mu}$&lt;/span&gt; an Hermitian matrix and &lt;span class=&quot;math-container&quot;&gt;$\langle \overline{i} | \overline{j} \rangle=\delta_{ij}$&lt;/span&gt; (the family &lt;span class=&quot;math-container&quot;&gt;$| \overline{i} \rangle$&lt;/span&gt; forms an orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;From this condition we can distinguish two cases:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Non degenerated quantum code: &lt;span class=&quot;math-container&quot;&gt;$C_{\delta \mu}=\delta_{\delta \mu}$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Degenerated quantum code otherwise&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;Additional remarks&lt;/h2&gt;&#xA;&lt;p&gt;There always exist a set of Kraus operator such that &lt;span class=&quot;math-container&quot;&gt;$C_{\delta \mu} = C_{\delta} \delta_{\delta \mu}$&lt;/span&gt;: using the freedom to choose the Kraus we can show that diagonalizing &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt;, we can in principle have a set of Kraus satisfying:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall (i,j) \in C : \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j}  \rangle = C_{\mu} \delta_{\delta \mu} \delta_{ij}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The distinction between degenerated and non degenerated can then be rephrased as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Non degenerated quantum code: &lt;span class=&quot;math-container&quot;&gt;$C_{\mu}=1$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Degenerated quantum code otherwise&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&lt;p&gt;Because of this last remark, &lt;strong&gt;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&lt;/strong&gt; (we can generalize by linearity to any two vector living in &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Thus for me what remains is that the &amp;quot;conceptual&amp;quot; difference between degenerated and non degenerated code is that:&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;For degenerated code it is not always the case but &lt;strong&gt;there exists&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Would you agree ?&lt;/p&gt;&#xA;&lt;p&gt;Can we give a physical meaning to this change in length when we work with &amp;quot;the good Kraus&amp;quot; for degenerated code ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2020-12-24T15:09:12.160" Title="Degenerated vs non degenerated code: for both there always exist Kraus bringing to different orthogonal subspaces?" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15264" PostTypeId="2" ParentId="15210" CreationDate="2020-12-24T17:23:05.510" Score="0" Body="&lt;p&gt;Contrary to what you have mentioned in the question, when you use a &lt;span class=&quot;math-container&quot;&gt;$u_3$&lt;/span&gt; gate, Qiskit does not break it up into multiple gates. In fact &lt;span class=&quot;math-container&quot;&gt;$u_3$&lt;/span&gt; gate is one of the basis gates for all Qiskit backends and all the single qubit gates are ultimately implemented as &lt;span class=&quot;math-container&quot;&gt;$u_1, u_2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$u_3$&lt;/span&gt; gates (You can check more about those gates &lt;a href=&quot;https://qiskit.org/textbook/ch-states/single-qubit-gates.html#7.-General-U-gates--&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). Since &lt;span class=&quot;math-container&quot;&gt;$u_3$&lt;/span&gt; gate is the most generalized single qubit gate, using &lt;span class=&quot;math-container&quot;&gt;$u_3$&lt;/span&gt; gates in place of the &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; gates will give you more freedom to vary you input to the &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-24T17:23:05.510" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15265" PostTypeId="2" ParentId="15246" CreationDate="2020-12-24T17:35:17.177" Score="0" Body="&lt;p&gt;So I went to the IBM Quantum Experience to download a calibration data for Valencia just to have csv file.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/syyOi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/syyOi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then I was able to read it in the Jupyter notebook through the IBM Quantum Lab environment as shown below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TVx4b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TVx4b.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-24T17:35:17.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15266" PostTypeId="2" ParentId="15199" CreationDate="2020-12-24T19:37:20.383" Score="0" Body="&lt;p&gt;If you recall from the analysis of Grover's algorithm, if the success probability of obtaining an item of interest is &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta)$&lt;/span&gt; just before a Grover iteration, then just after one iteration of Grover's iterate the probability of obtaining an item of interest goes from &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\sin^2(3\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now in the case in the question, you mark &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; out of &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; items, i.e., you have &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; items of interest out of the total &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; elements. So the probability of obtaining an item of interest on measurement is &lt;span class=&quot;math-container&quot;&gt;$\sin^2(\theta) = \frac{6}{8} = \frac{3}{4}.$&lt;/span&gt; So we get &lt;span class=&quot;math-container&quot;&gt;$\theta = \sin^{-1}{\sqrt{\frac{3}{4}}} = \frac{\pi}{3}$&lt;/span&gt; in radians. Then after one iteration of Grover's algorithm, the success probability of obtaining an item of interest becomes &lt;span class=&quot;math-container&quot;&gt;$\sin^2(3\cdot \frac{\pi}{3}) = 0$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; elements that you have marked.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-24T19:37:20.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15267" PostTypeId="2" ParentId="15199" CreationDate="2020-12-24T20:18:11.713" Score="1" Body="&lt;p&gt;This is a well known behavior of Grover's algorithm.&#xA;It is described in &amp;quot;Quantum Computation and Quantum Information&amp;quot; book under section 6.1.4&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[...] the number of iterations needed by the search algorithm&#xA;increases with &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, for &lt;span class=&quot;math-container&quot;&gt;$M ≥ N/2$&lt;/span&gt;. Intuitively, this is a silly property&#xA;for a search algorithm to have: we expect that it should become easier&#xA;to find a solution to the problem as the number of solutions&#xA;increases.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You will find also a workaround for this issue:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[...] by adding a single qubit &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; to the search index, doubling the number&#xA;of items to be searched to &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt;. A new augmented oracle &lt;span class=&quot;math-container&quot;&gt;$O'$&lt;/span&gt; is&#xA;constructed which marks an item only if it is a solution to the search&#xA;problem and the extra bit is set to zero.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2020-12-24T20:18:11.713" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15268" PostTypeId="2" ParentId="13880" CreationDate="2020-12-24T22:15:36.640" Score="1" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$(0, 1]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho)$&lt;/span&gt; denote the smallest non-zero eigenvalue of operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Fix a real &lt;span class=&quot;math-container&quot;&gt;$p \in (0, \frac{1}{2}]$&lt;/span&gt; and consider the pure two-qubit state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \sqrt{p}|00\rangle + \sqrt{1 - p}|11\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = |\psi\rangle\langle\psi|$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0, 0, 0, 1$&lt;/span&gt; so &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho_{AB}) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A = \mathrm{tr}_B(\rho_{AB}) = p|0\rangle\langle 0| + (1 - p)|1\rangle\langle 1|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$p, 1 - p$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho_A) = p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, not only can partial trace decrease the value of &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}$&lt;/span&gt; (as already noted in the comments), but there is no positive lower bound on &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\mathrm{tr}_B\rho)$&lt;/span&gt;. More precisely, for any &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;gt; 0$&lt;/span&gt; we can find a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}^\epsilon$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho_{AB}^\epsilon) = 1$&lt;/span&gt; yet &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\mathrm{tr}_B \rho_{AB}^\epsilon) = \epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$p \in (0, \frac{1}{2}]$&lt;/span&gt; and consider the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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|).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that its eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$0, 0, p, 1-p$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho_{AB}) = p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A = \mathrm{tr}_B(\rho_{AB}) = |0\rangle\langle 0|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0, 1$&lt;/span&gt; and so &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}(\rho_A) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, upon taking the partial trace &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}$&lt;/span&gt; can increase all the way to the maximum &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; regardless of &lt;span class=&quot;math-container&quot;&gt;$\lambda_{min}$&lt;/span&gt; of the original state.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-24T22:21:56.953" LastActivityDate="2020-12-24T22:21:56.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15269" PostTypeId="2" ParentId="15253" CreationDate="2020-12-25T00:11:30.443" Score="3" Body="&lt;p&gt;It may naively seem that gates like &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; whose action is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_f|x\rangle|y\rangle = |x\rangle|y\oplus f(x)\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;have no effect on the first register holding the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;entanglement&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As a consequence, one cannot move the second Hadamard on the first register through &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to cancel it with the first Hadamard (or vice versa) as that would change the entanglement produced by &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;It is instructive to see how things play out in a concrete case. We will use the CNOT gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT|x\rangle|y\rangle = |x\rangle|y \oplus x\rangle \tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is a simple variant of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with certainty. We have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;(H \otimes I) \circ CNOT \circ (H \otimes I) |0\rangle |0\rangle &amp;amp;= \frac{1}{\sqrt{2}}(H \otimes I) \circ CNOT (|0\rangle + |1\rangle)|0\rangle \\&#xA;&amp;amp;= \frac{1}{\sqrt{2}}(H \otimes I) (|0\rangle|0\rangle + |1\rangle|1\rangle) \\&#xA;&amp;amp;= \frac{1}{2} \left[|0\rangle + |1\rangle)|0\rangle + (|0\rangle - |1\rangle)|1\rangle\right] \\&#xA;&amp;amp;= \frac{1}{2} \left[|0\rangle|0\rangle + |1\rangle|0\rangle + |0\rangle|1\rangle - |1\rangle|1\rangle\right] \\&#xA;&amp;amp;= \frac{1}{2} \left[|0\rangle(|0\rangle + |1\rangle) + |1\rangle\color{red}{\underline{(|0\rangle - |1\rangle)}}\right] \\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we collected the terms that correspond to the first qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states. Compare the calculation to what happens in the absence of the CNOT gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;(H \otimes I) \circ (H \otimes I) |0\rangle |0\rangle &amp;amp;= \frac{1}{\sqrt{2}}(H \otimes I) (|0\rangle + |1\rangle)|0\rangle \\&#xA;&amp;amp;= \frac{1}{2} \left[|0\rangle + |1\rangle)|0\rangle + (|0\rangle - |1\rangle)|0\rangle\right] \\&#xA;&amp;amp;= \frac{1}{2} \left[|0\rangle|0\rangle + |1\rangle|0\rangle + |0\rangle|0\rangle - |1\rangle|0\rangle\right] \\&#xA;&amp;amp;= \frac{1}{2} \left[|0\rangle(|0\rangle + |0\rangle) + |1\rangle\color{red}{\underline{(|0\rangle - |0\rangle)}}\right] \\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where as before we collected the terms corresponding to the first qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states. In the absence of CNOT, destructive interference zeroes out the amplitude of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; 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).&lt;/p&gt;&#xA;&lt;p&gt;Therefore, in the presence of CNOT, it is possible for the first register to read &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; even though naive reading of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; might suggest this should not happen.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that gates such as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_c|x\rangle|y\rangle = |x\rangle|y\oplus f(c)\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$U_c = I \otimes V$&lt;/span&gt; for a unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and so the two Hadamards on the first register would cancel.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-25T02:42:52.717" LastActivityDate="2020-12-25T02:42:52.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15270" PostTypeId="2" ParentId="15221" CreationDate="2020-12-25T03:59:07.833" Score="1" Body="&lt;p&gt;In addition to &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/1107002176&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computation and Quantum Information by Nielson &amp;amp; Chuang&lt;/a&gt;, I would recommend the &lt;a href=&quot;https://inst.eecs.berkeley.edu/%7Ecs191/fa14/&quot; rel=&quot;nofollow noreferrer&quot;&gt;UC Berkeley CS191 lecture notes&lt;/a&gt; and &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/0521876583&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computer Science (An Introduction) by Mermin&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2020-12-25T03:59:07.833" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15271" PostTypeId="2" ParentId="5936" CreationDate="2020-12-25T10:32:47.363" Score="2" Body="&lt;p&gt;Say you have two bases &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be the unitary that transforms the orthonormal basis vectors in &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; to the basis vectors in &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;. So, it is obvious that &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}$&lt;/span&gt; will be the unitary that transforms the basis vectors in &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt; to that in &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt;. For instance let &lt;span class=&quot;math-container&quot;&gt;$B_1 = \{|0\rangle, |1\rangle\}$&lt;/span&gt; (the computational basis) and let &lt;span class=&quot;math-container&quot;&gt;$B_2 = \{|\uparrow\rangle, |\downarrow\rangle\}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\uparrow\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\ i\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\downarrow\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\ -i\end{pmatrix}$&lt;/span&gt;. Notice that the matrix &lt;span class=&quot;math-container&quot;&gt;$U = \frac{1}{\sqrt{2}}\begin{bmatrix}1&amp;amp; 1\\ i &amp;amp; -i\end{bmatrix}$&lt;/span&gt; is the matrix that transforms the basis vectors in &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; to that in &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = |\uparrow\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle = |\downarrow\rangle$&lt;/span&gt;. So we also have &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}|\uparrow\rangle = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}|\downarrow\rangle = |1\rangle$&lt;/span&gt;. Also notice that &lt;span class=&quot;math-container&quot;&gt;$U\neq U^{\dagger}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For notational convenience, let &lt;span class=&quot;math-container&quot;&gt;$$|0\rangle = \begin{pmatrix}1\\ 0\end{pmatrix}_{B_1} ~~\text{ and }~~~~  |1\rangle = \begin{pmatrix}0\\ 1\end{pmatrix}_{B_1}.$$&lt;/span&gt; Also let, &lt;span class=&quot;math-container&quot;&gt;$$|\uparrow\rangle = \begin{pmatrix}1\\ 0\end{pmatrix}_{B_2} ~~\text{ and }~~~~ |\downarrow\rangle = \begin{pmatrix}0\\ 1\end{pmatrix}_{B_2}.$$&lt;/span&gt; Now, if you have a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in basis &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt;, say &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt; we can represent this as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \begin{pmatrix}\alpha \\ \beta\end{pmatrix}_{B_1}$&lt;/span&gt;. Now notice that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can also be given as &lt;span class=&quot;math-container&quot;&gt;$$|\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).$$&lt;/span&gt; This in vector notation can be given as &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = U^{\dagger} \begin{pmatrix}\alpha\\ \beta\end{pmatrix}_{B_1} = \begin{pmatrix}\alpha'\\ \beta'\end{pmatrix}_{B_2}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So for a state that is given in basis &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt;, to represent the state in &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt; basis, we apply &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}$&lt;/span&gt; on the state vector corresponding to the basis &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt;. Similarly for a state that is given in basis &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;, to represent the state in &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; basis, we apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the state vector corresponding to the basis &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the matrix that transforms the basis vectors of basis &lt;span class=&quot;math-container&quot;&gt;$B_1$&lt;/span&gt; to the basis vectors of the basis &lt;span class=&quot;math-container&quot;&gt;$B_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-25T10:32:47.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15272" PostTypeId="2" ParentId="15246" CreationDate="2020-12-25T10:37:34.477" Score="0" Body="&lt;p&gt;File names are case sensitive. &lt;code&gt;Shared_capstone_Model_csv.csv&lt;/code&gt; is not the same as &lt;code&gt;Shared_Capstone_Model_csv.csv&lt;/code&gt;. Change &lt;code&gt;open&lt;/code&gt; code for &lt;code&gt;Shared_Capstone_Model_csv.csv&lt;/code&gt; (note the &lt;code&gt;C&lt;/code&gt; in &lt;code&gt;Capstone&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2020-12-25T10:37:34.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15273" PostTypeId="2" ParentId="15003" CreationDate="2020-12-25T23:30:06.043" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; be a channel and denote with &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}J(\Phi)\equiv (\Phi\otimes I)\mathbb P_m$&lt;/span&gt; its Choi representation, where &lt;span class=&quot;math-container&quot;&gt;$\mathbb P_m\equiv\lvert m\rangle\!\langle m\rvert$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lvert m\rangle\equiv\sum_i \lvert ii\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Given arbitrary operators &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt;, we have a representation &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\sum_a A_a X A_a^\dagger$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=\sum_a \mathrm{vec}(A_a)\mathrm{vec}(A_a)^\dagger$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A_a\in\mathrm{Lin}(\mathcal X,\mathcal Y)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{vec}(A_a)\in\mathcal Y\otimes\mathcal X$&lt;/span&gt; are related by &lt;span class=&quot;math-container&quot;&gt;$\mathrm{vec}(A_a)_{ij}=(A_a)_{ij}$&lt;/span&gt; (to relate with your notation, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{vec}(A_a)\equiv\lvert A_a\rangle\!\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{vec}(A_a)^\dagger\equiv\langle\!\langle A_a\rvert$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;This follows from simple index juggling. Or from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\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.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the question is, suppose &lt;span class=&quot;math-container&quot;&gt;$\Phi(X)=\sum_a B_a X B_a^\dagger$&lt;/span&gt;. Are &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_a$&lt;/span&gt; unitarily related?&lt;/p&gt;&#xA;&lt;p&gt;Given an operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; which decomposes as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H=\sum_a |u_a\rangle\!\langle u_a| = \sum_a |v_a\rangle\!\langle v_a|,\tag1$$&lt;/span&gt;&#xA;we must have &lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle = \sum_j c_{ij} |v_j\rangle$&lt;/span&gt; for some coefficients &lt;span class=&quot;math-container&quot;&gt;$c_{ij}$&lt;/span&gt;, as otherwise the two expressions would result in operators with different ranges/supports. The coefficients must then satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{ijk}c_{ij}\bar c_{ik} |v_j\rangle\!\langle v_k| = \sum_i |v_i\rangle\!\langle v_i|.$$&lt;/span&gt;&#xA;If the &lt;span class=&quot;math-container&quot;&gt;$|v_a\rangle$&lt;/span&gt; are orthogonal, then multiplying the expression by &lt;span class=&quot;math-container&quot;&gt;$\langle v_a|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v_b\rangle$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$\sum_i c_{ia}\bar c_{ib} = \delta_{ab}$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. This is equivalent to &lt;span class=&quot;math-container&quot;&gt;$C^\dagger C=I$&lt;/span&gt;, which means that &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is an isometry (has orthonormal columns). But &lt;span class=&quot;math-container&quot;&gt;$|u_i\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v_i\rangle$&lt;/span&gt; are vectors of the same length, thus &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is also unitary.&lt;/p&gt;&#xA;&lt;p&gt;Now, any positive semidefinite operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, and thus unitarily related between themselves.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2020-12-25T23:30:06.043" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15274" PostTypeId="1" AcceptedAnswerId="15277" CreationDate="2020-12-26T04:33:54.830" Score="1" ViewCount="69" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;code&gt;q4-7&lt;/code&gt; are all supposed to be eigenstates of the operation, why is it just that &lt;code&gt;q7&lt;/code&gt; is in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;? Shouldn't all qubits 4 to 7 be in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state to kick back phases from the &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gates applied?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uPbd9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uPbd9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Et6VV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Et6VV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13449" LastEditorUserId="55" LastEditDate="2021-01-06T14:23:11.163" LastActivityDate="2021-01-06T14:23:11.163" Title="Shor's implementation problem on qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;shors-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15275" PostTypeId="1" AcceptedAnswerId="15276" CreationDate="2020-12-26T05:44:37.957" Score="0" ViewCount="27" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;provider = IBMQ.load_account()&#xA;sim = provider.backends.ibmq_qasm_simulator&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;&#xA;probsu = []&#xA;for i in range(L):&#xA;&#xA;    circuit = circuit.assign_parameters({Ei: EWi[i]})&#xA;    circuit = qc(Ei) &#xA;    &#xA;    job_manager = IBMQJobManager()&#xA;    **MExperiment = job_manager.run(circuit, backend=backend, name='MExperiment')**&#xA;    result = MExperiment.result()&#xA;&#xA;    Ta = '1'*N&#xA;    counts = result.get_counts(circuit)&#xA;    if Ta in counts:&#xA;        prob = counts[Ta]/sum(counts.values())&#xA;    else:&#xA;        prob = 0&#xA;    probsu.append(prob) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CircuitError: &amp;quot;Cannot bind parameters (['Ei']) not present in the circuit.&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2020-12-26T06:29:00.197" LastActivityDate="2020-12-26T07:28:51.257" Title="How can I fix this parametrization error in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;&lt;parametrization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15276" PostTypeId="2" ParentId="15275" CreationDate="2020-12-26T07:28:51.257" Score="1" Body="&lt;p&gt;If you want to create a parametrized quantum circuit in Qiskit, you can do it as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from iqx import *&#xA;from qiskit.circuit import  ParameterVector&#xA;# Loading your IBM Q account(s)&#xA;provider = IBMQ.load_account()&#xA;&#xA;param_circuit = QuantumCircuit(4)&#xA;params = ParameterVector('a', 4)&#xA;for i in range(4):&#xA;    param_circuit.ry(params[i], i)&#xA;param_circuit.cx(0,1)&#xA;param_circuit.cx(2,3)&#xA;param_circuit.cx(1,2)&#xA;param_circuit.cx(0,1)&#xA;param_circuit.cx(2,3)&#xA;param_circuit.draw('mpl',style={'name': 'bw'},  scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wDJsQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wDJsQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can pass the parameters in this circuit and update them through a classical optimizer etc.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-26T07:28:51.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15277" PostTypeId="2" ParentId="15274" CreationDate="2020-12-26T09:04:34.380" Score="1" Body="&lt;p&gt;&lt;strong&gt;First question&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are two implementation of Shor algorithm. The first one is depicted in this picture:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nvKLX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nvKLX.png&quot; alt=&quot;Shor 1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this case, a function &lt;span class=&quot;math-container&quot;&gt;$a^x \mod N$&lt;/span&gt; is implemented in &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; gate and you are trying to find period in such function.&lt;/p&gt;&#xA;&lt;p&gt;Another implementation (yours one) uses phase estimation for finding the period. See thsis implementation on &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm#Quantum_part:_period-finding_subroutine&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiki&lt;/a&gt; for example.&lt;/p&gt;&#xA;&lt;p&gt;In the first case, all qubits are initialized to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. In second case as you can see in Wiki link, qubits used as input to an &amp;quot;operator which phase is estimated&amp;quot; are initialized at &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. It seems that part of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates are included into controlled operators (&lt;em&gt;sorry I have not enought time to reconstruct the opeators&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Second question&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As the operators are &lt;strong&gt;controlled&lt;/strong&gt; ones, &lt;em&gt;bottom&lt;/em&gt; qubits are entangled with &lt;em&gt;top&lt;/em&gt; qubits which allow phase kick-back. As a result, you are able to measure the phase on &lt;em&gt;top&lt;/em&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;Concerning swap gate, even such gates are able to perform calculation. You can see &lt;a href=&quot;https://quantum-computing.ibm.com/docs/iqx/guide/shors-algorithm#quantum-circuits-for-modular-multiplication&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; how swap gates implement modular multiplication used in the Shor algorithm.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-26T09:04:34.380" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15279" PostTypeId="1" CreationDate="2020-12-26T11:23:53.213" Score="6" ViewCount="356" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-01-06T07:41:08.683" Title="Superposition of quantum gates" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;superposition&gt;&lt;foundations&gt;" AnswerCount="4" CommentCount="5" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15280" PostTypeId="1" AcceptedAnswerId="15282" CreationDate="2020-12-26T13:53:41.147" Score="2" ViewCount="81" Body="&lt;p&gt;How does this circuit map &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|7x \space mod15\rangle$&lt;/span&gt;? 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.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CKIim.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CKIim.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13449" LastEditorUserId="55" LastEditDate="2021-01-06T15:00:12.260" LastActivityDate="2021-01-06T15:00:12.260" Title="How does this represent modular multiplication" Tags="&lt;qiskit&gt;&lt;shors-algorithm&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15281" PostTypeId="1" CreationDate="2020-12-26T17:15:24.947" Score="2" ViewCount="68" Body="&lt;p&gt;Consider we have a quantum system which has two possible states (as double-slit experiment):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the photon could be pass through the first slit&lt;/li&gt;&#xA;&lt;li&gt;the photon could be pass through the second slit&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;And we decided to represent the first state as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the second state as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Assume that the quantum state is in a superposition state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sqrt(1/2) |0\rangle + \sqrt(1/2) |1\rangle$&lt;/span&gt;. So, we have a probability 50% to get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as outcome and also a probability 50% to get  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as outcome.&lt;/p&gt;&#xA;&lt;p&gt;Then we measured the state of the system in the standard basis {&lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt;} and get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as outcome.&lt;/p&gt;&#xA;&lt;p&gt;My question is, how we can get &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; as outcome if we measured in basis {&lt;span class=&quot;math-container&quot;&gt;$|+\rangle,|-\rangle$&lt;/span&gt;}? in other words, our system has only two states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (first slit) and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (second slit) so how by changing basis we get state which is not one of the two possible states of our system {&lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt;}?&lt;/p&gt;&#xA;&lt;p&gt;I know that I miss something important regarding concept of measurement but I am beginner and would like to clearly understand this concept.&lt;/p&gt;&#xA;" OwnerUserId="14252" LastEditorUserId="55" LastEditDate="2021-01-06T14:59:54.143" LastActivityDate="2021-01-06T14:59:54.143" Title="How changing the basis of measurement produces a state which is not in the possible system states?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15282" PostTypeId="2" ParentId="15280" CreationDate="2020-12-26T17:17:44.813" Score="3" Body="&lt;p&gt;Applying a NOT gate to every qubit in an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit register performs the transformation &lt;span class=&quot;math-container&quot;&gt;$f(x) = 2^n - 1 - x$&lt;/span&gt;. In this case that's &lt;span class=&quot;math-container&quot;&gt;$f(x) = 16-1-x = -x \pmod{15}$&lt;/span&gt;. So the NOT gates are equivalent to negating.&lt;/p&gt;&#xA;&lt;p&gt;The triplets of CNOTs are performing swaps and the swaps implement a right-rotate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9BdFt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9BdFt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;An &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit right-rotate is equivalent to multiplying by the multiplicative inverse of 2 mod &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt;, which is &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; in our case.&lt;/p&gt;&#xA;&lt;p&gt;Together these two multiplications multiply by &lt;span class=&quot;math-container&quot;&gt;$-1 \cdot 8 = -8 = -8 + 15 = 7 \pmod{15}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the circuit isn't &lt;em&gt;quite&lt;/em&gt; correct. There is a degeneracy where &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$|15\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; so it's fine.&lt;/p&gt;&#xA;&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1rfko.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1rfko.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-12-26T17:17:44.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15283" PostTypeId="2" ParentId="15274" CreationDate="2020-12-26T17:28:43.507" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What makes you think swap gates can't have phase kickback? The swap operation has both +1 and -1 eigenspaces. &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Chance%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22Swap%22%2C%22Swap%22%5D%2C%5B%22H%22%5D%2C%5B%22Chance%22%5D%2C%5B%22%E2%80%A2%22%2C%22Amps2%22%5D%2C%5B%5D%2C%5B%22%E2%97%A6%22%2C%22Amps2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;For example&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22Chance%22%2C%22X%22%5D%2C%5B%22H%22%5D%2C%5B%22%E2%80%A2%22%2C%22Swap%22%2C%22Swap%22%5D%2C%5B%22H%22%5D%2C%5B%22Chance%22%5D%2C%5B%22%E2%80%A2%22%2C%22Amps2%22%5D%2C%5B%5D%2C%5B%22%E2%97%A6%22%2C%22Amps2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oKZUV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2020-12-26T17:28:43.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15284" PostTypeId="1" AcceptedAnswerId="15297" CreationDate="2020-12-26T21:36:29.970" Score="3" ViewCount="54" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;provider = IBMQ.load_account()&#xA;sim = provider.backends.ibmq_qasm_simulator&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;&#xA;E = np.linspace(-5,5,10)                # Parameters&#xA;circuits = []&#xA;nuni = 10.                              # Number of the circuits in each set. &#xA;&#xA;for i in range(10):&#xA;    circuitsi = []&#xA;    for j in range (nuni):&#xA;        circuit =  QuantumCircuit(qrz,crz)&#xA;        circuit =  qc(E[i])             # qc is a function with both parameters and random numbers.&#xA;        circuitsi.append(circuit)&#xA;    circuits.append(circuitsi)&#xA;&#xA;for i in range (len(circuits)):&#xA;    for j in range (nuni):&#xA;        circuits[i][j] = transpile(circuits[i][j],backend=backend)&#xA;&#xA;&#xA;for i in range (10):&#xA;    job_manager = IBMQJobManager()&#xA;    MExperiments = job_manager.run(circuits[i], backend=backend, shots = nshot)&#xA;    results = MExperiments.results()&#xA;&#xA;    for j in range (nuni):&#xA;        &#xA;        counts = results.get_counts(circuits[i][j])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;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:)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;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!&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2020-12-27T01:08:00.037" LastActivityDate="2020-12-27T10:45:32.103" Title="How can I run a set of circuits, each of which has 100 shots?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;parametrization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15285" PostTypeId="1" AcceptedAnswerId="15287" CreationDate="2020-12-26T22:13:25.810" Score="2" ViewCount="63" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from iqx import *&#xA;&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;sv01 = Statevector.from_label('01')&#xA;print(sv01)&#xA;plot_state_qsphere(sv01.data)&#xA;&#xA;h0circuit = QuantumCircuit(2)&#xA;h0circuit.h(0)&#xA;h0circuit.draw(&amp;quot;mpl&amp;quot;)&#xA;&#xA;final01 = sv01.evolve(h0circuit)&#xA;print(final01)&#xA;plot_state_qsphere(final01.data)&#xA;#Shouldn't the output be state 1/sqrt(2) (|01&amp;gt; + |11&amp;gt;)  ???? &#xA;#And why is the phase on the state |00&amp;gt; pi? &#xA;#Shouldn't the phase be pi for |01&amp;gt; instead on the qsphere (ambiguous, probably doesn't matter)?&#xA;&#xA;h1circuit = QuantumCircuit(2)&#xA;h1circuit.h(1)&#xA;h1circuit.draw(&amp;quot;mpl&amp;quot;)&#xA;&#xA;final01 = sv01.evolve(h1circuit)&#xA;print(final01)&#xA;plot_state_qsphere(final01.data)&#xA;#Shouldn't the output be state 1/sqrt(2) (|00&amp;gt; - |01&amp;gt;)  ???? &#xA;&#xA;#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.&#xA;&#xA;sv01 = Statevector.from_label('01')&#xA;print(sv01)&#xA;plot_state_qsphere(sv01.data)&#xA;&#xA;c0xCircuit = QuantumCircuit(2)&#xA;c0xCircuit.cx(0,1)&#xA;c0xCircuit.draw('mpl')&#xA;&#xA;final01 = sv01.evolve(c0xCircuit)&#xA;print(final01)&#xA;plot_state_qsphere(final01.data)&#xA;#Shouldn't this result be  |01&amp;gt; ?&#xA;&#xA;c1xCircuit = QuantumCircuit(2)&#xA;c1xCircuit.cx(1,0)&#xA;c1xCircuit.draw('mpl')&#xA;&#xA;final01 = sv01.evolve(c1xCircuit)&#xA;print(final01)&#xA;plot_state_qsphere(final01.data)&#xA;#Shouldn't this result be  |11&amp;gt; ?&#xA;&#xA;#Conclusion of the above. The cnot (0,1) gate actually acts as a cnot (1,0) gate. The cnot (1,0) gate actually &#xA;#acts as a cnot (0,1) gate. The states 0 and 1 are flipped somehow.&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14270" LastActivityDate="2020-12-27T00:30:05.870" Title="How do Hadamard and CNOT gates work on Qiskit SDK? Why is the output reversed?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15286" PostTypeId="1" CreationDate="2020-12-26T23:05:25.677" Score="3" ViewCount="34" Body="&lt;p&gt;Theorem 8.10 in Chapter 8 of &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Theory of Quantum Information&lt;/em&gt;&lt;/a&gt; asserts that the Holevo capacity of a quantum channel (between density operators on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^d$&lt;/span&gt;) can be achieved by an ensemble consisting of &lt;span class=&quot;math-container&quot;&gt;${d^2}$&lt;/span&gt; pure states.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt; and therefore we can always pick the ensemble to have at most &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; states.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; bound on the number of states in the ensemble. Any insight into this argument would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastActivityDate="2020-12-26T23:05:25.677" Title="Pure state ensembles achieving the Holevo $\chi$-quantity with at most $d^2$ states" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;information-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15287" PostTypeId="2" ParentId="15285" CreationDate="2020-12-27T00:30:05.870" Score="1" Body="&lt;p&gt;This has to do with Qiskit uses  little-endian for  ordering. In Qiskit’s convention, higher qubit indices are more significant (little endian convention).&lt;/p&gt;&#xA;&lt;p&gt;Thus the CNOT (CX)  gate matrix representation in Qiskit is actually:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;        CX\ q_0, q_1 =&#xA;            I \otimes |0\rangle\langle0| + X \otimes |1\rangle\langle1| =&#xA;            \begin{pmatrix}&#xA;                1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;                0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;                0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;                0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0&#xA;            \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CXGate.html#qiskit.circuit.library.CXGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;link to the Qiskit's documentation.&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-27T00:30:05.870" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15288" PostTypeId="2" ParentId="15279" CreationDate="2020-12-27T00:47:16.727" Score="2" Body="&lt;p&gt;Putting something as massive as even the simplest gate-device into a superposition goes beyond currently understood physics.  At a &amp;quot;device-scale&amp;quot; general relativistic considerations may become significant because the two device-states will have different mass-distributions and distinct gravitational self-energies.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;Fashion, Faith, and Fantasy&lt;/em&gt;, with ample references therein).&lt;/p&gt;&#xA;&lt;p&gt;This takes the analysis of such a system &amp;quot;outside the normal framework of quantum mechanics, and there does not seem to be an unambiguous way to proceed.&amp;quot;  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 &amp;quot;illegal&amp;quot; superpositions and treating it as a form of energy uncertainty.&lt;/p&gt;&#xA;&lt;p&gt;The approach outlined by Penrose is manifestly falsifiable, and my understanding is that there are several groups attempting to devise experiments to test it.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2021-01-05T15:40:25.180" LastActivityDate="2021-01-05T15:40:25.180" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15289" PostTypeId="2" ParentId="15281" CreationDate="2020-12-27T00:55:14.837" Score="1" Body="&lt;p&gt;This is a Prologue taken from &lt;a href=&quot;https://logatelro7.com/uploads/uploads/book/n1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;David McIntyre's Quantum Mechanics textbook&lt;/a&gt; (the link should lead you to the pdf version of the textbook) that I thought is &lt;strong&gt;pretty neat and shows the counter intuitive of QM&lt;/strong&gt;. Also, section 1.1  describes the measurement phenomena of QM really nicely. I encourage you to read through it.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;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. &lt;br&gt;  &lt;br&gt;&#xA;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. &lt;br&gt;   &lt;br&gt;&#xA;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 &amp;quot;forgotten&amp;quot; the color that Erwin had determined previously. &lt;br&gt; &lt;br&gt;&#xA;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 &amp;quot;forgotten&amp;quot; whether they were long or short. &lt;br&gt; &lt;br&gt;&#xA;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. &lt;br&gt; &lt;br&gt;&#xA;After many years of daydreaming about the mystery socks, Erwin Schrodinger proposed his theory of &amp;quot;Quantum Socks&amp;quot; and become famous. And this is the beginning of the story of the quantum socks. &lt;br&gt; &lt;br&gt;&#xA;&lt;strong&gt;Farfetched?? You bet&lt;/strong&gt;. But Erwin's adventure with his socks &lt;strong&gt;is the way quantum mechanics works&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-27T00:55:14.837" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15290" PostTypeId="1" AcceptedAnswerId="15294" CreationDate="2020-12-27T03:21:01.047" Score="3" ViewCount="139" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;However, I don't see how this &amp;quot;frequency domain&amp;quot; notion applies to the quantum fourier transform. How does the Fourier basis represent this frequency domain?&lt;/p&gt;&#xA;&lt;p&gt;If we apply a QFT on a quantum &amp;quot;sin wave&amp;quot; will it output a certain frequency?&lt;/p&gt;&#xA;" OwnerUserId="13449" LastActivityDate="2020-12-30T01:46:41.900" Title="How does the QFT represent the frequency domain?" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15291" PostTypeId="2" ParentId="15279" CreationDate="2020-12-27T04:28:57.203" Score="2" Body="&lt;h2&gt;Gate superposition&lt;/h2&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;h2&gt;Quantum computer in superposition&lt;/h2&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_d$&lt;/span&gt;. If at time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; the control register is in state &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and the data register is in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt; then at a later time &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; the data register is in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_1\rangle = U(r) |\psi_0\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We also assume that application of quantum gates to the data register does not change the control register.&lt;/p&gt;&#xA;&lt;p&gt;In this model, a quantum computation is performed by initializing the data register, loading values &lt;span class=&quot;math-container&quot;&gt;$r_0, r_1, \dots, r_n$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_c$&lt;/span&gt; and the state space of our computer is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_c \otimes \mathcal{H}_d$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For simplicity, let us first consider the situation where at time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; the control register is in a classical state &lt;span class=&quot;math-container&quot;&gt;$|r\rangle$&lt;/span&gt; and the data register is in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt;. By the &lt;a href=&quot;https://en.wikipedia.org/wiki/Correspondence_principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;correspondence principle&lt;/a&gt;, at time &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; the computer will be in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I \otimes U(r))|r\rangle  |\psi_0\rangle = |r\rangle |\psi_1\rangle.\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the states &lt;span class=&quot;math-container&quot;&gt;$|r\rangle$&lt;/span&gt; form a basis of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_c$&lt;/span&gt;. In the case where the control register is binary, these can be identified as the computational basis states in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_c$&lt;/span&gt;. Now, since these states form a basis, the equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; provides us with the full specification of the action of the quantum computer. This operation can be written as a matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C = \begin{pmatrix}&#xA;U(0) &amp;amp; 0 &amp;amp; 0 &amp;amp; \dots &amp;amp; 0 \\&#xA;0 &amp;amp; U(1) &amp;amp; 0 &amp;amp; \dots &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; U(2) &amp;amp; \dots &amp;amp; 0 \\&#xA;\dots \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \dots &amp;amp; U(N-1)&#xA;\end{pmatrix}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or more succinctly as the direct sum&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C = U(0) \oplus U(1) \oplus \dots \oplus U(N-1)\tag{2'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$U(k)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=0, \dots, N-1$&lt;/span&gt; are the gates that our quantum computer can natively perform (this is often called the &amp;quot;gateset&amp;quot;).&lt;/p&gt;&#xA;&lt;p&gt;Suppose now that at time &lt;span class=&quot;math-container&quot;&gt;$t_0$&lt;/span&gt; the control register is in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|s\rangle = \alpha |r\rangle + \beta |r'\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for appropriate &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and that the data register is in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle$&lt;/span&gt;. By the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_superposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;superposition principle&lt;/a&gt;, at a later time &lt;span class=&quot;math-container&quot;&gt;$t_1$&lt;/span&gt; the computer will be in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;C |s\rangle|\psi_0\rangle &amp;amp;= C (\alpha |r\rangle + \beta |r'\rangle)|\psi_0\rangle \\&#xA;&amp;amp;= \alpha \,C |r\rangle|\psi_0\rangle  + \beta \,C |r'\rangle|\psi_0\rangle \\&#xA;&amp;amp;= \alpha \,(I \otimes U(r))|r\rangle|\psi_0\rangle + \beta \,(I \otimes U(r'))|r'\rangle|\psi_0\rangle \\&#xA;&amp;amp;= \alpha \,|r\rangle|\psi_1\rangle + \beta\,|r'\rangle|\psi_1'\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\psi_1'\rangle = U(r')|\psi_0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This operation can be viewed as a quantum analogue of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Switch_statement&quot; rel=&quot;nofollow noreferrer&quot;&gt;classical &lt;code&gt;switch&lt;/code&gt; statement&lt;/a&gt; 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. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;gate superposition&amp;quot;. 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.&lt;/p&gt;&#xA;&lt;h2&gt;Naive linear algebra&lt;/h2&gt;&#xA;&lt;p&gt;Naively forming a &amp;quot;superposition&amp;quot; of two unitary gates &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; by taking&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = \alpha U + \beta V&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt; does not generally result in &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; 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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Polar_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;polar decomposition&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = WP&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is positive and &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; unitary. However, this lacks the physical meaning associated with superposition.&lt;/p&gt;&#xA;&lt;h2&gt;State-channel duality&lt;/h2&gt;&#xA;&lt;p&gt;One could also seek a way to define gate &amp;quot;superposition&amp;quot; by looking at the superposition of the corresponding states under &lt;a href=&quot;https://en.wikipedia.org/wiki/Channel-state_duality&quot; rel=&quot;nofollow noreferrer&quot;&gt;state-channel duality&lt;/a&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1, \dots, d$&lt;/span&gt; denote an orthonormal basis of a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle|i\rangle$&lt;/span&gt; be a maximally entangled state. Denote by &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; two unitary gates on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;. The corresponding states are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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 \\&#xA;\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.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\rho_U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_V$&lt;/span&gt; are pure. Their superposition with amplitudes &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|\psi_M\rangle &amp;amp;= \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) \\&#xA;&amp;amp;= \frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle \otimes (\alpha U + \beta V)|i\rangle \\&#xA;&amp;amp;= \frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle \otimes M|i\rangle \\&#xA;&amp;amp;= (I \otimes M) |\psi\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where as before &lt;span class=&quot;math-container&quot;&gt;$M = \alpha U + \beta V$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$|\psi_M\rangle$&lt;/span&gt; is not normalized. In fact, when &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is singular, it may be impossible to normalize it. However, even when &lt;span class=&quot;math-container&quot;&gt;$|\psi_M\rangle$&lt;/span&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-28T00:28:37.220" LastActivityDate="2020-12-28T00:28:37.220" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15292" PostTypeId="2" ParentId="15290" CreationDate="2020-12-27T06:51:01.390" Score="3" Body="&lt;p&gt;If you apply the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit QFT defined as &lt;span class=&quot;math-container&quot;&gt;$\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&amp;gt;$&lt;/span&gt; acting on a state &lt;span class=&quot;math-container&quot;&gt;$\sum_{x = 0}^{N - 1}a_x\left|x\right&amp;gt;$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$N = 2^{n}$&lt;/span&gt; on a sin wave with a frequency &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{(n - 1)/2}}\sum_{x = 0}^{N -1}\sin(\frac{2 \pi x k}{N})\left|x\right&amp;gt;$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k \neq 0$&lt;/span&gt; to avoid having only zero values, the result will be &lt;span class=&quot;math-container&quot;&gt;$\frac{i}{\sqrt{2}}\left|k\right&amp;gt; - \frac{i}{\sqrt{2}}\left|N - k\right&amp;gt;$&lt;/span&gt;. This intuitively matches the regular Fourier transform which gives &lt;span class=&quot;math-container&quot;&gt;$\frac{i \sqrt{\pi}}{\sqrt{2}}\delta(\omega - 2 \pi k) - \frac{i \sqrt{\pi}}{\sqrt{2}}\delta(\omega + 2 \pi k)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$sin(2 \pi kx)$&lt;/span&gt; if using the modern physics form (&lt;span class=&quot;math-container&quot;&gt;$\hat f(\omega) = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}f(t)e^{i \omega t}dt$&lt;/span&gt;) and with &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; denoting frequency. On the other hand, the wave &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{N}}\sum_{x = 0}^{N - 1}e^{-2 \pi x k/N}\left|x\right&amp;gt;$&lt;/span&gt; that combines a real cosine wave with an imaginary sin wave is much more naturally transformed directly into &lt;span class=&quot;math-container&quot;&gt;$\left|k\right&amp;gt;$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The correspondence to the &amp;quot;time variable&amp;quot; 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 &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; evenly spaced points on the complex unit circle that together go across the entire circle (&lt;span class=&quot;math-container&quot;&gt;$e^{-2\pi i x/N}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$N - 1$&lt;/span&gt; goes through clockwise), then with the probability amplitude &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt; each frequency &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$\frac{a_k}{\sqrt{N}}\sum_{x=0}^{N - 1}e^{-2 \pi i x k /N}\left|x\right&amp;gt;$&lt;/span&gt;: the intuitive link to traditional &amp;quot;frequency&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2020-12-30T01:46:41.900" LastActivityDate="2020-12-30T01:46:41.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15293" PostTypeId="1" CreationDate="2020-12-27T07:23:57.607" Score="0" ViewCount="53" Body="&lt;pre&gt;&lt;code&gt;def random_bitstring_generator(bit_number, backend):&#xA;    &#xA;&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;&#xA;    one_qubit_random_bit_generator_circuit = QuantumCircuit(4,4)&#xA;    one_qubit_random_bit_generator_circuit.h(3)&#xA;    one_qubit_random_bit_generator_circuit.measure(3,3)&#xA;&#xA;    for _ in range(bit_number):&#xA;        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=8000).result().get_counts()&#xA;        bit = list(counts.keys())[0]  &#xA;        bitstring += bit&#xA;&#xA;    return bitstring&#xA;&#xA;from qiskit.providers.aer import QasmSimulator&#xA;&#xA;provider = IBMQ.load_account()&#xA;ibmq_melbourne = provider.get_backend('ibmq_16_melbourne')&#xA;backend = QasmSimulator.from_backend(ibmq_melbourne)&#xA;&#xA;print(random_bitstring_generator(512, backend))```&#xA;&#xA;Using the above  code,&#xA;I am only getting an output bit string with all 0's even with changing number of shots.&#xA;what is the error leading to incorrect output.&#xA;I am trying to generate a long random sequence &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13172" LastActivityDate="2020-12-27T08:05:20.313" Title="how to generate a random sequence" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;quantumlab&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2020-12-28T13:37:58.613" ContentLicense="CC BY-SA 4.0" />
  <row Id="15294" PostTypeId="2" ParentId="15290" CreationDate="2020-12-27T07:39:16.543" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;em&gt;Fourier basis&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;In the computational basis, integers are represented in binary form (with the MSB on the left by convention). So for four qubits&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert 0 \rangle=\vert 0000 \rangle, \;\;\vert 1 \rangle=\vert 0001 \rangle, \;\; \vert 2 \rangle=\vert 0010 \rangle,\;\; ..., \;\; \vert 15 \rangle =\vert 1111 \rangle.$$&lt;/span&gt;&#xA;Algebraically this is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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.$$&lt;/span&gt;&#xA;On the four Bloch spheres associated with &lt;span class=&quot;math-container&quot;&gt;$\vert abcd \rangle$&lt;/span&gt;, counting from &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert 15 \rangle$&lt;/span&gt; looks like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/s5aJn.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s5aJn.gif&quot; alt=&quot;Computational Basis Counting&quot; /&gt;&lt;/a&gt;&#xA;(&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html#counting-fourier&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Source&lt;/a&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\vert d \rangle=\text{qubit 0}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert c \rangle=\text{qubit 1}$&lt;/span&gt;, ...)&lt;/p&gt;&#xA;&lt;p&gt;You can see that in the Bloch spheres representation, distinct values of &lt;span class=&quot;math-container&quot;&gt;$\vert n \rangle$&lt;/span&gt; are distinguished by ordered sets of qubits at either their north pole, &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt;, or their south pole, &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;.  Intuitively, while counting, the qubit associated with the LSB, &lt;span class=&quot;math-container&quot;&gt;$\vert d \rangle$&lt;/span&gt;, changes state every step, whereas the qubit associated with the MSB, &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;, are represented by antipodal points.]&lt;/p&gt;&#xA;&lt;p&gt;The same 16 integers represented over the Fourier basis, &lt;span class=&quot;math-container&quot;&gt;$ \text{QFT} \vert n \rangle = \vert \tilde n \rangle =\vert \tilde a \tilde b \tilde c \tilde d \rangle $&lt;/span&gt;, is given algebraically by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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).$$&lt;/span&gt;&#xA;Now as we count in the Fourier basis from &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde n \rangle = \vert \tilde a \tilde b \tilde c \tilde d \rangle = \vert \tilde 0 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde {15} \rangle$&lt;/span&gt; all four qubits change state every step, with &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde a \rangle$&lt;/span&gt; taking the largest steps (i.e. swapping between &lt;span class=&quot;math-container&quot;&gt;$\vert + \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert - \rangle$&lt;/span&gt;, which is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; of a turn per step) and &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde d \rangle$&lt;/span&gt; taking the smallest steps (&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{16}$&lt;/span&gt; of a turn per step).&lt;/p&gt;&#xA;&lt;p&gt;On the four Bloch spheres associated with &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde a \tilde b \tilde c \tilde d \rangle$&lt;/span&gt;, counting in the Fourier basis appears as each qubit state rotating in the equatorial plane with decreasing frequency from &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde a \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde d \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eWz5n.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eWz5n.gif&quot; alt=&quot;Fourier Basis Counting&quot; /&gt;&lt;/a&gt;&#xA;(&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html#counting-fourier&quot; rel=&quot;nofollow noreferrer&quot;&gt;Image Source&lt;/a&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde d \rangle=\text{qubit 0}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde c \rangle=\text{qubit 1}$&lt;/span&gt;, ..., &lt;span class=&quot;math-container&quot;&gt;$\vert + \rangle = x$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;In a single counting sequence from &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde 0 \rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde {16} = \tilde 0 \, (\text{mod} \, \tilde {16}) \rangle$&lt;/span&gt; the qubits associated with &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde a \rangle, \, \vert \tilde b \rangle, \, \vert \tilde c \rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde d \rangle$&lt;/span&gt; make exactly &lt;span class=&quot;math-container&quot;&gt;$2^3, \, 2^2, \, 2^1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$2^0$&lt;/span&gt; full rotations in their respective equatorial planes.  Similarly, if we consider &amp;quot;no rotation&amp;quot; in the equatorial plane as the state &lt;span class=&quot;math-container&quot;&gt;$H\vert 0 \rangle=\vert+\rangle$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde 0 \rangle = \vert ++++ \rangle$&lt;/span&gt; gives all qubits unrotated, while &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde {15} \rangle$&lt;/span&gt; gives all qubits at their maximal rotation (in the positive direction). [Note that the single qubit QFT is just the Hadamard gate, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.  In turn, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is simply the 2-level DFT as noted in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/8471/8623&quot;&gt;this previous answer&lt;/a&gt;.]&lt;/p&gt;&#xA;&lt;p&gt;In this example you can see how the high &lt;em&gt;magnitude&lt;/em&gt; associated with &lt;span class=&quot;math-container&quot;&gt;$\vert a \rangle$&lt;/span&gt; as a constituent of &lt;span class=&quot;math-container&quot;&gt;$\vert n \rangle$&lt;/span&gt; in the computational basis corresponds to a high &lt;em&gt;frequency&lt;/em&gt; associated with &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde a \rangle$&lt;/span&gt; as a constituent of &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde n \rangle$&lt;/span&gt; in the Fourier basis, and so forth for &lt;span class=&quot;math-container&quot;&gt;$\vert b \rangle \,, \vert c \rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vert d \rangle$&lt;/span&gt;.  Hopefully this helps to make the analogy between QFT and DFT more tangible.&lt;/p&gt;&#xA;&lt;p&gt;The equations used above were specific to the example of a four-qubit system.  They generalize naturally to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit systems as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you're looking for additional familiarity and comfort with the QFT, it's a great exercise to convince yourself that both &lt;span class=&quot;math-container&quot;&gt;$\vert n \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert \tilde n \rangle$&lt;/span&gt; are orthonormal bases for &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^N}$&lt;/span&gt;.  Another great exercise is to convince yourself that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$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$$&lt;/span&gt;&#xA;is a unitary operator on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^N}$&lt;/span&gt;.  (Note that the validity of either of the statements in these two excercises implies the validity of the other.)&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-12-27T12:08:36.073" LastActivityDate="2020-12-27T12:08:36.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15295" PostTypeId="2" ParentId="15293" CreationDate="2020-12-27T08:05:20.313" Score="1" Body="&lt;p&gt;How about:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def random_bitstring_generator(bit_number, backend):&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;&#xA;    one_qubit_random_bit_generator_circuit = QuantumCircuit(1, 1)&#xA;    one_qubit_random_bit_generator_circuit.h(0)&#xA;    one_qubit_random_bit_generator_circuit.measure(0, 0)&#xA;&#xA;    for _ in range(bit_number):&#xA;        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1).result().get_counts()&#xA;        bit = list(counts.keys())[0]  &#xA;        bitstring += bit&#xA;&#xA;    return bitstring&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;random_bitstring_length = 100&#xA;print(random_bitstring_generator(random_bitstring_length, backend) ) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This would output something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0000010000010010001000111010001110001000000100110011110110101010111011001100100001100100001101100000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that the number of &lt;strong&gt;shot is 1&lt;/strong&gt; since we just creating some random number and not finding the probability of seeing &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-27T08:05:20.313" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15296" PostTypeId="2" ParentId="15262" CreationDate="2020-12-27T10:06:39.507" Score="1" Body="&lt;p&gt;I think it probably helps to explore the specific example you asked about. Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be the unitary error&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=\alpha 1+\beta X+\gamma Y+\delta Z&#xA;$$&lt;/span&gt;&#xA;for some complex parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta,\gamma,\delta$&lt;/span&gt;, 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:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=a|0_L\rangle+b|1_L\rangle.&#xA;$$&lt;/span&gt;&#xA;If I apply the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then obviously I have the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|\psi\rangle=\alpha|\psi\rangle+\beta X|\psi\rangle+\gamma Y|\psi\rangle+\delta Z|\psi\rangle.&#xA;$$&lt;/span&gt;&#xA;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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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.&#xA;$$&lt;/span&gt;&#xA;When we measure the ancilla, it will return one of those values. Perhaps &lt;span class=&quot;math-container&quot;&gt;$|Y,1\rangle$&lt;/span&gt;. In which case, you know your system is in the state &lt;span class=&quot;math-container&quot;&gt;$Y|\psi\rangle$&lt;/span&gt; after measurement, and you can correct it by applying &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; on qubit 1 as the syndrome extraction told you to.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully you can now see, thanks to linearity + measurement, how the decomposition of any error map in terms of Pauli errors works.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2020-12-27T10:06:39.507" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15297" PostTypeId="2" ParentId="15284" CreationDate="2020-12-27T10:45:32.103" Score="1" Body="&lt;p&gt;In your code, &lt;code&gt;circuits&lt;/code&gt; is an array of array of quantum circuits and each element of &lt;code&gt;circuits&lt;/code&gt; is an array of quantum circuits. In the code, you are using a for loop to run each element of the &lt;code&gt;circuits&lt;/code&gt; 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 &lt;code&gt;all_circuits&lt;/code&gt; and append all the quantum circuits of each of the &lt;code&gt;circuitsi&lt;/code&gt;. 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:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;all_circuits = []&#xA;for i in range(10):&#xA;    all_circuits += circuits[i][:]&#xA;&#xA;from qiskit.tools.monitor import job_monitor&#xA;qjob = execute(all_circuits,shots=shots,backend=backend)&#xA;job_monitor(qjob)&#xA;result = qjob.result()&#xA;&#xA;counts = []&#xA;for i in range(10):&#xA;    count_i = []&#xA;    for j in range(nuni):&#xA;        count_i.append(result.get_counts(all_circuits[(nuni*i)+j]))&#xA;    counts.append(count_i)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Since you execute all the circuits at one, this would reduce the time of execution quite a lot.&#xA;Also, if you are using &lt;code&gt;execute&lt;/code&gt;, you could also skip &lt;code&gt;transpile&lt;/code&gt; since &lt;code&gt;transpile&lt;/code&gt; will also be performed as a part of &lt;code&gt;execute&lt;/code&gt;. This might not decrease the run time but might help in writing the code simpler. I hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="9097" LastActivityDate="2020-12-27T10:45:32.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15298" PostTypeId="1" CreationDate="2020-12-27T18:45:51.953" Score="3" ViewCount="109" Body="&lt;p&gt;I am trying to understand how does the gate-level implementation of eigenvalue-inversion step in the HHL algorithm works.&lt;/p&gt;&#xA;&lt;p&gt;I am following this &lt;a href=&quot;https://arxiv.org/pdf/1802.08227.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;reference&lt;/a&gt;, where it is stated (Lemma 4) that this can be accomplished by the use of controlled rotations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U_\theta: |\widetilde{\theta} \rangle |0 \rangle \rightarrow |\widetilde{\theta} \rangle \left(\cos \widetilde{\theta} |0\rangle + sin \widetilde{\theta} |1 \rangle \right ) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_\theta = \sum_{\widetilde{\theta} \in \{0,1\}^n} |\widetilde{\theta}\rangle \langle \widetilde{\theta}| \otimes \exp \left(-i \widetilde{\theta} \sigma_y \right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\widetilde{\theta}$&lt;/span&gt; is the n-bit finite precision representation of the angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_y$&lt;/span&gt; the Y Pauli matrix.&lt;/p&gt;&#xA;&lt;p&gt;My question is, how are the rotation angles &lt;span class=&quot;math-container&quot;&gt;$\widetilde{\theta}$&lt;/span&gt; for the unitary &lt;span class=&quot;math-container&quot;&gt;$U_\theta$&lt;/span&gt; calculated/applied without a-priori knowledge of the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_j$&lt;/span&gt; of the system matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I understand that the state-vector &lt;span class=&quot;math-container&quot;&gt;$|\widetilde{\theta} \rangle$&lt;/span&gt; is obtained in the previous step of the algorithm by extracting the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$|\lambda_j \rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; using QPE (and then applying an inverse + arcsin function as described &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15070/how-to-effectively-compute-eigenvalue-rotation-in-hhl&quot;&gt;here&lt;/a&gt;), but I am not sure how are these angles also applied as the parameters for the controlled-rotation gates (exponent parameter in &lt;span class=&quot;math-container&quot;&gt;$U_\theta$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;FYI, I did see this other &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11422/problem-with-controlled-rotation-in-hhl&quot;&gt;post&lt;/a&gt; where it is stated: &amp;quot;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.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;So my question is &lt;em&gt;how&lt;/em&gt; do you &amp;quot;use it [the register containing &lt;span class=&quot;math-container&quot;&gt;$|\widetilde{\theta} \rangle$&lt;/span&gt;] to decide the angle of the rotation [&lt;span class=&quot;math-container&quot;&gt;$\widetilde{\theta}$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\exp$&lt;/span&gt; function of &lt;span class=&quot;math-container&quot;&gt;$U_\theta$&lt;/span&gt;]&amp;quot;?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="8731" LastEditorUserId="8731" LastEditDate="2020-12-27T19:40:49.417" LastActivityDate="2020-12-28T11:25:52.930" Title="Gate-level implementation of Eigenvalue-Inversion in HHL" Tags="&lt;gate-synthesis&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15299" PostTypeId="1" CreationDate="2020-12-27T18:59:36.860" Score="2" ViewCount="79" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\psi = \frac{|01\rangle-|10\rangle}{\sqrt 2}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now let &lt;span class=&quot;math-container&quot;&gt;$\vec{v} = k(2,3,5)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is just normalization factor (equal to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt {38}}$&lt;/span&gt;) so that length of &lt;span class=&quot;math-container&quot;&gt;$\vec{v}$&lt;/span&gt; is 1. Can someone now tell me what does it even mean that Alice will measure &lt;span class=&quot;math-container&quot;&gt;$\vec{v} \cdot \vec{\sigma}$&lt;/span&gt; on her qubit?&lt;/p&gt;&#xA;&lt;p&gt;And what happens when Bob measures &lt;span class=&quot;math-container&quot;&gt;$\vec{v} \cdot \vec{\sigma}$&lt;/span&gt; on his qubit?&lt;/p&gt;&#xA;&lt;p&gt;I am looking for a worked out answer with numbers in it rather than mathematical symbols.&lt;/p&gt;&#xA;" OwnerUserId="14251" LastEditorUserId="55" LastEditDate="2020-12-29T11:30:44.097" LastActivityDate="2020-12-29T11:30:44.097" Title="EPR Experiment: What does it mean for Alice to measure $\vec{v} \cdot \vec{\sigma}$ on her qubit?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15300" PostTypeId="1" AcceptedAnswerId="15303" CreationDate="2020-12-27T20:10:26.567" Score="9" ViewCount="1746" Body="&lt;p&gt;It seems to me that the &amp;quot;disjunction gate&amp;quot; (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 &lt;span class=&quot;math-container&quot;&gt;$G1 = G3 = ¬_a \otimes ¬_b \otimes I_c$&lt;/span&gt;. For context, see the bottom two rows of the following figure that I created in draw.io:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/QZh8L.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QZh8L.png&quot; alt=&quot;Quantum computing summary&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a name for the gate &lt;span class=&quot;math-container&quot;&gt;$¬_a \otimes ¬_b \otimes I_c$&lt;/span&gt; (the one I'm calling NaNbIc)?&lt;/p&gt;&#xA;" OwnerUserId="14276" LastEditorUserId="2293" LastEditDate="2020-12-28T04:38:48.130" LastActivityDate="2020-12-28T16:06:35.723" Title="Is there a name for the 3-qubit gate that does NOT NOT NOTHING?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15301" PostTypeId="1" AcceptedAnswerId="15305" CreationDate="2020-12-27T22:47:21.067" Score="3" ViewCount="159" Body="&lt;p&gt;I know that for Steane code, we can implement transversally some gates like cNOT, Hadamard and Pauli.&lt;/p&gt;&#xA;&lt;p&gt;What I am looking for is a resource in which it is explained why implementing those gate give rise to the good logical operation.&lt;/p&gt;&#xA;&lt;p&gt;If this is a result more general than Steane I would be interested in a &amp;quot;general enough&amp;quot; approach showing it.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="10480" LastEditDate="2021-03-26T20:20:02.280" LastActivityDate="2021-03-26T20:20:02.280" Title="Transversal logical gate for Stabilizer (or at least Steane code)" Tags="&lt;error-correction&gt;&lt;resource-request&gt;&lt;stabilizer-code&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15302" PostTypeId="2" ParentId="15300" CreationDate="2020-12-27T23:14:42.843" Score="6" Body="&lt;p&gt;Welcome to QCSE.  You seem to have gotten some of the gist of quantum gates but don't be surprised if every such gate is promoted to having a specific, universally recognized name.&lt;/p&gt;&#xA;&lt;p&gt;A reason some gates such as &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; (Toffoli) or &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCSWAP}$&lt;/span&gt; (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 &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCNOT}$&lt;/span&gt; gate and the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CCSWAP}$&lt;/span&gt; gates were investigated in the context of &lt;em&gt;reversible (classical) computing&lt;/em&gt; as studied in the 70's/early 80's, prior to/parallel to the beginnings of quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore other lessons from classical computer engineering may form a context for quantum computing.  For example, you properly identified a quantum &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; gate, but classically promoting such an operation to a formal &amp;quot;gate&amp;quot; appears to be overkill.  A classical computer engineer wishing to implement such a classical &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; is something entirely different from a classical swap; thus it's appropriate for us to give it a formal name.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\vert a\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\vert b\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vert c\rangle$&lt;/span&gt; were unentangled prior to the operation of the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{HOCKING}$&lt;/span&gt; gate, they would be afterwards.&lt;/p&gt;&#xA;&lt;p&gt;Thus don't be surprised if your gate doesn't have a specific, universally recognized name.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2020-12-27T23:14:42.843" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15303" PostTypeId="2" ParentId="15300" CreationDate="2020-12-27T23:36:00.073" Score="10" Body="&lt;p&gt;The gate in which you're interested:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/GF0Nwm.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GF0Nwm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;br&gt;&#xA;would more often be called &lt;span class=&quot;math-container&quot;&gt;$X_1X_2I_3$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$¬_a ¬_b I_c$&lt;/span&gt;, because we use &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to denote the NOT gate more often than we use &lt;span class=&quot;math-container&quot;&gt;$¬$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However it is very unlikely that &lt;span class=&quot;math-container&quot;&gt;$X_1X_2I_3$&lt;/span&gt; is given a new name, because there's nothing going on other than just two &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates. CNOT has a name because the &amp;quot;C&amp;quot; part in CNOT denotes something that isn't quite so easily captured by something like &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. 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?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2020-12-27T23:36:00.073" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15304" PostTypeId="2" ParentId="15279" CreationDate="2020-12-28T01:19:03.223" Score="1" Body="&lt;p&gt;This is nothing but a controlled-unitary gate. The only difference to an &amp;quot;ordinary&amp;quot; controlled-unitary is that now, the control qubit is encoded in the overall state of the device that implements the unitary.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2020-12-28T01:19:03.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15305" PostTypeId="2" ParentId="15301" CreationDate="2020-12-28T04:08:05.967" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; be the Hilbert space of a set of physical qubits and let &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; be the stabilizer group of a stabilizer code &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G} \subset \mathcal{H}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A transversal operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; implements a logical operator on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; if it maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; back to itself. This can be established by showing that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; does not change the stabilizer group &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt;. In order to do this, we need to know how stabilizers transform under unitary gates. Suppose that &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is an operator that stabilizes &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$g|\psi\rangle = |\psi\rangle$&lt;/span&gt;. Then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UgU^\dagger U|\psi\rangle = Ug|\psi\rangle = U|\psi\rangle\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that &lt;span class=&quot;math-container&quot;&gt;$UgU^\dagger$&lt;/span&gt; stabilizes &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt;. 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 &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; to determine the action of those transversal operators within the code subspace by analyzing their effect on the logical Pauli operators.&lt;/p&gt;&#xA;&lt;h2&gt;Controlled-NOT&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Claim:&lt;/strong&gt; If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}=CSS(C_1, C_2)$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/CSS_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Calderbank-Shor-Steane&lt;/a&gt; code for classical linear codes &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp \subset C_1$&lt;/span&gt; then transversal CNOT is a logical CNOT on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark 1:&lt;/strong&gt; There is ambiguity in the use of the &lt;span class=&quot;math-container&quot;&gt;$CSS(C_1, C_2)$&lt;/span&gt; notation in the literature. For example, Wikipedia and Nielsen &amp;amp; Chuang put &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp$&lt;/span&gt; in the second position rather than &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark 2:&lt;/strong&gt; The condition &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp \subset C_1$&lt;/span&gt; is not an additional restriction on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt;. It is part of the definition of a CSS code necessary to make sure that the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; type and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; type stabilizer generators commute. Consequently, the claim says that CNOT admits transversal implementation for any CSS code.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof sketch:&lt;/strong&gt; Let &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; be a tensor product of identity &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators and similarly for &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a CSS code, we can choose stabilizer generators that are either of the form &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; or of the form &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt;. Calculate that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{CNOT} \circ (g_x \otimes I) \circ \mathrm{CNOT} = g_x \otimes g_x \\&#xA;\mathrm{CNOT} \circ (I \otimes g_x) \circ \mathrm{CNOT} = I \otimes g_x \\&#xA;\mathrm{CNOT} \circ (g_z \otimes I) \circ \mathrm{CNOT} = g_z \otimes I \\&#xA;\mathrm{CNOT} \circ (I \otimes g_z) \circ \mathrm{CNOT} = g_z \otimes g_z.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$g_x, g_z \in S$&lt;/span&gt; then all operators on the right hand sides of the four equations above are in &lt;span class=&quot;math-container&quot;&gt;$S \times S$&lt;/span&gt;. Moreover, every operator in &lt;span class=&quot;math-container&quot;&gt;$S \times S$&lt;/span&gt; can be obtained as a composition of operators of the form &lt;span class=&quot;math-container&quot;&gt;$g_x \otimes I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_z \otimes I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I \otimes g_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I \otimes g_z$&lt;/span&gt;. We conclude that transversal CNOT preserves &lt;span class=&quot;math-container&quot;&gt;$S \times S$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;By analyzing the action of transversal CNOT on the logical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; 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. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Hadamard&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Claim:&lt;/strong&gt; If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}=CSS(C_1, C_2)$&lt;/span&gt; is a Calderbank-Shor-Steane code where the two classical linear codes are the same &lt;span class=&quot;math-container&quot;&gt;$C_1 = C_2$&lt;/span&gt; then transversal Hadamard is a logical Hadamard on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark:&lt;/strong&gt; The definition of the CSS code requires that &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp \subset C_1$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; cannot be arbitrary. It necessarily contains its own dual.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof sketch:&lt;/strong&gt; As before, let &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; be a tensor product of identity &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators. We see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H g_x H = g_z \\&#xA;H g_z H = g_x.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt; is obtained from &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; by replacing &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators in the tensor product with &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators. Note that since &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a CSS code, we can choose stabilizer generators that are either of the form &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; or of the form &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt;. Moreover, since &lt;span class=&quot;math-container&quot;&gt;$C_1 = C_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$g_x \in S$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$g_z \in S$&lt;/span&gt;. Consequently, transversal Hadamard preserves the stabilizer.&lt;/p&gt;&#xA;&lt;p&gt;As before, the analysis extends to logical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators and therefore transversal &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on physical qubits implements the logical Hadamard gate. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Phase gate&lt;/h2&gt;&#xA;&lt;p&gt;(For completeness we include the phase gate even though it is not mentioned in the question.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Claim:&lt;/strong&gt; If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}=CSS(C_1, C_2)$&lt;/span&gt; is a Calderbank-Shor-Steane code for classical linear codes &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp \subset C_1$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp$&lt;/span&gt; is &lt;a href=&quot;https://en.wikipedia.org/wiki/Even_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;doubly-even&lt;/a&gt; (i.e. all its codewords have Hamming weight divisible by four) then transversal phase gate &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; preserves the stabilizer &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof sketch:&lt;/strong&gt; Since the phase gate commutes with the Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator it is clear that all &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt; stabilizers are preserved. For any &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt;, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P g_x P^\dagger = i^{w(g_x)} g_x g_z&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$w(g_x)$&lt;/span&gt; is the weight of stabilizer &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt;, i.e. the number of non-identity factors in it. Since &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp$&lt;/span&gt; is doubly-even, we see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P g_x P^\dagger = g_x g_z&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and thus &lt;span class=&quot;math-container&quot;&gt;$P g_x P^\dagger \in S$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the transversal phase operator is not necessarily the logical phase gate. However, &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp$&lt;/span&gt; is an even code so the transversal &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; belongs to the normalizer &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt;. Thus, as long as transversal &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is not in the stabilizer we can choose it to play the role of the logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. Under this choice transversal phase operator commutes with the logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and therefore its action on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a diagonal gate. Moreover, applying transversal phase operator twice yields the logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. We conclude that in this case the transversal phase operator is either a logical phase gate or its inverse.&lt;/p&gt;&#xA;&lt;h2&gt;Pauli operators&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Claim:&lt;/strong&gt; If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a stabilizer code, then logical Pauli operators are transversal.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof sketch:&lt;/strong&gt; This follows immediately from the fact that logical Pauli operators are chosen from the normalizer &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; of the stabilizer group &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli group &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}_n$&lt;/span&gt; since all operators in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}_n$&lt;/span&gt; are transversal by definition. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Steane code&lt;/h2&gt;&#xA;&lt;p&gt;Steane code is &lt;span class=&quot;math-container&quot;&gt;$CSS(C_1, C_2)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$C_1 = C_2$&lt;/span&gt; is the Hamming &lt;span class=&quot;math-container&quot;&gt;$[7, 4, 3]$&lt;/span&gt; code.&lt;/p&gt;&#xA;&lt;p&gt;Since it is a stabilizer code, Pauli operators are transversal. Since it is a CSS code, CNOT is transversal. Since &lt;span class=&quot;math-container&quot;&gt;$C_1 = C_2$&lt;/span&gt;, Hadamard is transversal. Since &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; is doubly-even, the phase gate is transversal.&lt;/p&gt;&#xA;&lt;p&gt;Thus, the entire Clifford group admits a transversal implementation in the Steane code. By &lt;a href=&quot;https://en.wikipedia.org/wiki/Eastin%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eastin-Knill&lt;/a&gt; theorem, we cannot extend the set of transversal gates to a universal gateset. In particular, the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate does not have a transversal implementation in the Steane code.&lt;/p&gt;&#xA;&lt;h2&gt;References&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9702029&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9702029&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9705052&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9705052&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/0904.2557&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0904.2557&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-28T23:07:59.637" LastActivityDate="2020-12-28T23:07:59.637" CommentCount="18" ContentLicense="CC BY-SA 4.0" />
  <row Id="15306" PostTypeId="1" AcceptedAnswerId="15312" CreationDate="2020-12-28T09:57:32.983" Score="1" ViewCount="47" Body="&lt;p&gt;I have read some papers talking about Pauli operator grouping for simultaneous measurement in VQE. I was wondering can this &amp;quot;simultaneous measurement&amp;quot; approach be used in other variational quantum algorithms? Like variational quantum classifier?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2020-12-29T11:32:44.863" LastActivityDate="2020-12-29T11:32:44.863" Title="Applications of pauli operator grouping for simultaneous measurement in VQE" Tags="&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15307" PostTypeId="2" ParentId="15298" CreationDate="2020-12-28T11:25:52.930" Score="1" Body="&lt;p&gt;Using the register to decide the angle of rotation means the following: you have a register &lt;span class=&quot;math-container&quot;&gt;$|\tilde{\theta}\rangle$&lt;/span&gt; (composed of potentially more than one qubit) and you apply rotations of another register controlled on the value of the qubits of &lt;span class=&quot;math-container&quot;&gt;$|\tilde{\theta}\rangle$&lt;/span&gt;. Different rotations that you apply result in different functions being implemented on your ancilla qubits. But that was possibly already known to you.&lt;/p&gt;&#xA;&lt;p&gt;The question of &lt;em&gt;which rotations to do for applying a specific function&lt;/em&gt; is much more complicated, and I am not aware of any general solution. For once, &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/algorithms/linear_solvers/hhl.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; 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 &amp;quot;easy&amp;quot; to implement, for instance, the eigenvalue inversion function required for HHL. In &lt;a href=&quot;https://arxiv.org/abs/1806.11463&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, the authors implement an approximation of the eigenvalue inversion subroutine (the code in &lt;code&gt;Quil&lt;/code&gt; can be found in &lt;a href=&quot;https://gitlab.com/apozas/bayesian-dl-quantum/-/blob/master/HHL_Rigetti.py#L168&quot; rel=&quot;nofollow noreferrer&quot;&gt;the associated GitLab repository&lt;/a&gt;) 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 &lt;a href=&quot;https://arxiv.org/abs/1207.2485&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;). But, as I said before, I am not aware of general ways of implementing large classes of functions, so far.&lt;/p&gt;&#xA;" OwnerUserId="1917" LastActivityDate="2020-12-28T11:25:52.930" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15308" PostTypeId="2" ParentId="11422" CreationDate="2020-12-28T11:34:21.220" Score="0" Body="&lt;p&gt;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 &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/algorithms/linear_solvers/hhl.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; 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, &lt;a href=&quot;https://arxiv.org/abs/1806.11463&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; implements an approximation of the eigenvalue inversion subroutine (the code in &lt;code&gt;Quil&lt;/code&gt; can be found in &lt;a href=&quot;https://gitlab.com/apozas/bayesian-dl-quantum/-/blob/master/HHL_Rigetti.py#L168&quot; rel=&quot;nofollow noreferrer&quot;&gt;the associated GitLab repository&lt;/a&gt;) 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 &lt;a href=&quot;https://arxiv.org/abs/1207.2485&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;). 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.&lt;/p&gt;&#xA;" OwnerUserId="1917" LastActivityDate="2020-12-28T11:34:21.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15309" PostTypeId="1" CreationDate="2020-12-28T14:10:52.133" Score="2" ViewCount="57" Body="&lt;p&gt;To repeat the titular question: &amp;quot;What is the largest absolute value attainable by an off-diagonal real or complex component of a &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; density matrix?&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="3089" LastActivityDate="2020-12-29T11:01:22.930" Title="What is the largest absolute value attainable by an off-diagonal real or complex component of a $4 \times 4$ density matrix?" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15310" PostTypeId="2" ParentId="15309" CreationDate="2020-12-28T15:27:34.853" Score="3" Body="&lt;p&gt;Consider a &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; Hermitian matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$ A \equiv \begin{pmatrix}a &amp;amp; b \\ \bar b &amp;amp; c\end{pmatrix}.$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to be positive semidefinite (PSD), we clearly need &lt;span class=&quot;math-container&quot;&gt;$a,c\in\mathbb R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a,c\ge0$&lt;/span&gt;.&#xA;The eigenvalues are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$2\lambda_\pm = (a+c)\pm\sqrt{(a-c)^2+4|b|^2}.$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$A\ge0$&lt;/span&gt; we thus need &lt;span class=&quot;math-container&quot;&gt;$(a+c)^2 \ge (a-c)^2 + 4|b|^2$&lt;/span&gt; &lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$ac\ge |b|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b|\le \sqrt{ac}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose now &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; density matrix. A matrix is PSD &lt;em&gt;iff&lt;/em&gt; all its principal minors are. For any &lt;span class=&quot;math-container&quot;&gt;$i&amp;lt;j$&lt;/span&gt;, we must thus have &lt;span class=&quot;math-container&quot;&gt;$|\rho_{ij}|\le \sqrt{\rho_{ii}\rho_{jj}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This reduces the problem to figuring out the maximum value of &lt;span class=&quot;math-container&quot;&gt;$pq$&lt;/span&gt; over all &lt;span class=&quot;math-container&quot;&gt;$p,q\ge0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$p+q\le1$&lt;/span&gt;. This is achieved by the choice &lt;span class=&quot;math-container&quot;&gt;$p=q=1/2$&lt;/span&gt;, and thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\max_{\rho\in\mathrm D(\mathcal H)}|\rho_{ij}| = \frac12,$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathrm D(\mathcal H)$&lt;/span&gt; denotes the set of density matrices over a space of dimensions &lt;span class=&quot;math-container&quot;&gt;$\ge2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In short, the maximum value of any coherence is &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, achieved with a state of the form &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\!\langle +|$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; the Bell state defined over the appropriate subspace).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2020-12-29T11:01:22.930" LastActivityDate="2020-12-29T11:01:22.930" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15312" PostTypeId="2" ParentId="15306" CreationDate="2020-12-28T17:16:50.540" Score="2" Body="&lt;p&gt;I don't see why not since in VQE the only thing that being done on the quantum computer is the  evaluation of &lt;span class=&quot;math-container&quot;&gt;$ \langle H \rangle $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is some Hermitian matrix. For quantum chemistry purpose, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; usually represents the electronic Hamiltonian of the molecular system.&lt;/p&gt;&#xA;&lt;p&gt;Because &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle$&lt;/span&gt; cannot be measured directly on a quantum computer, but instead it must be decompose into linear combination of Pauli strings &lt;span class=&quot;math-container&quot;&gt;$P_i \in \{I,X,Y,Z\}^{\otimes N}$&lt;/span&gt;. For example, &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle = \langle ZZ \rangle + \langle IZ \rangle + \langle IZ \rangle + \langle XX \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The number of Pauli strings scales as &lt;span class=&quot;math-container&quot;&gt;$O(N^4)$&lt;/span&gt; (this can be reduced through various techniques) so to save the number of evaluations, we grouped the Pauli strings, &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt;, that commutes with each other. For example, &lt;span class=&quot;math-container&quot;&gt;$IXZ$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ZXZ$&lt;/span&gt; commute, since &lt;span class=&quot;math-container&quot;&gt;$[IXZ, ZXZ] = IXZ\cdot ZXZ - ZXZ \cdot IXZ = 0$&lt;/span&gt;. So you can find a whole family of these commutative terms. Then within this family, you can just measure in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis for 1st qubit, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis for 2nd qubit, and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis for 3rd qubit.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\langle M \rangle$&lt;/span&gt; for some matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; through evaluating the expectation of the linear combination of the Pauli strings then this technique can be applied.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-28T17:16:50.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15313" PostTypeId="2" ParentId="15299" CreationDate="2020-12-28T23:54:21.030" Score="1" Body="&lt;h2&gt;The Physical System (Background)&lt;/h2&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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 (&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \hbar$&lt;/span&gt;).  In a spin singlet state one electron has up-spin, and the other has down-spin.&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;The combination of spin and electric charge in an electron gives it a magnetic dipole moment.  To determine the spin state of an electron, &lt;a href=&quot;https://en.wikipedia.org/wiki/Stern%E2%80%93Gerlach_experiment&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stern-Gerlach&lt;/a&gt; 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.&lt;/p&gt;&#xA;&lt;h2&gt;Choice of Measurement Basis, &lt;span class=&quot;math-container&quot;&gt;$\vec v \cdot \vec \sigma$&lt;/span&gt; (Answer)&lt;/h2&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\vec v$&lt;/span&gt;, which is equivalent to picking a point on a unit sphere.  Here, the Pauli matrices (&lt;span class=&quot;math-container&quot;&gt;$\vec \sigma$&lt;/span&gt;) can be thought of as a convenient basis for real 3-space.&lt;/p&gt;&#xA;&lt;p&gt;In your example, Alice has chosen&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A = \vec v \cdot \vec \sigma = \frac{1}{\sqrt{38}} (2,3,5) \cdot \vec \sigma = \frac{1}{\sqrt{38}} \begin{bmatrix} 5 &amp;amp; 2-3i \\ 2+3i &amp;amp; -5 \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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 &amp;quot;real&amp;quot; (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&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A \otimes A = \frac{1}{38}\begin{bmatrix} 25 &amp;amp; 10-15i &amp;amp; 10-15i &amp;amp; -5-12i \\ 10+15i &amp;amp; -25 &amp;amp; 13 &amp;amp; -10+15i \\ 10+15i &amp;amp; 13 &amp;amp; -25 &amp;amp;-10+15i \\ -5+12i &amp;amp; -10-15i &amp;amp; -10-15i &amp;amp; 25 \end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The wavefunction of a singlet states is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\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}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we have everything we need to evaluate the wavefunction over the joint spin measurement operator with nothing more than matrix multiplication.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi \vert A \otimes A \vert  \psi \rangle = -1,$$&lt;/span&gt;&#xA;where the value &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; represents perfect anti-correlation (as claimed in Box 2.7).&lt;/p&gt;&#xA;&lt;p&gt;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, &lt;span class=&quot;math-container&quot;&gt;$A' = U^\dagger A U$&lt;/span&gt;, and unitary transformations preserve inner products.&lt;/p&gt;&#xA;&lt;p&gt;If you want to go through the calculations, here's the Matlab script I used to double check it myself.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt; A=1/38^.5*[5,2-3i;2+3i,-5]&#xA;&#xA;A =&#xA;&#xA;0.8111 + 0.0000i   0.3244 - 0.4867i&#xA;0.3244 + 0.4867i  -0.8111 + 0.0000i&#xA;&#xA;&amp;gt;&amp;gt; AoA=kron(A,A)&#xA;&#xA;AoA =&#xA;&#xA;0.6579 + 0.0000i   0.2632 - 0.3947i   0.2632 - 0.3947i  -0.1316 - 0.3158i&#xA;0.2632 + 0.3947i  -0.6579 + 0.0000i   0.3421 + 0.0000i  -0.2632 + 0.3947i&#xA;0.2632 + 0.3947i   0.3421 + 0.0000i  -0.6579 + 0.0000i  -0.2632 + 0.3947i&#xA;-0.1316 + 0.3158i  -0.2632 - 0.3947i  -0.2632 - 0.3947i   0.6579 + 0.0000i&#xA;&#xA;&amp;gt;&amp;gt; psi=1/2^.5*[0;1;-1;0]&#xA;&#xA;psi =&#xA;&#xA;     0&#xA;0.7071&#xA;-0.7071&#xA;     0&#xA;&#xA;&amp;gt;&amp;gt; psi'*AoA*psi&#xA;&#xA;ans =&#xA;&#xA;-1.0000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2020-12-29T00:55:57.717" LastActivityDate="2020-12-29T00:55:57.717" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15314" PostTypeId="1" AcceptedAnswerId="15317" CreationDate="2020-12-29T06:25:48.407" Score="5" ViewCount="112" Body="&lt;p&gt;Show that the Hadamard gate is equivalent to a 180 degree rotation about the axis defined by &lt;span class=&quot;math-container&quot;&gt;$(\vec{e_x} - \vec{e_z}) / \sqrt{2}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\vec{e_x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{e_z}$&lt;/span&gt; are unit vectors pointing along the x and z axes.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14184" LastEditorUserId="55" LastEditDate="2020-12-30T10:49:31.077" LastActivityDate="2020-12-30T10:49:31.077" Title="Show that the Hadamard gate is equivalent to a 180 degree rotation of a certain axis" Tags="&lt;textbook-and-exercises&gt;&lt;bloch-sphere&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15316" PostTypeId="1" CreationDate="2020-12-29T08:35:39.183" Score="4" ViewCount="58" Body="&lt;p&gt;Let's say we have the following circuit (picture and code shown below), and now the &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is an ancilla qubit. If the system of interest has only two qubits, Is there a way to use only &lt;span class=&quot;math-container&quot;&gt;$q_{1,2}$&lt;/span&gt; as my ansatz and plug it into the built-in VQE in qiskit?&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$I+g$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity operator and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is the translation operator that moves the qubits as &lt;span class=&quot;math-container&quot;&gt;$q_0\rightarrow q_1,q_1\rightarrow q_2,q_2\rightarrow q_0$&lt;/span&gt;. According to this paper, &lt;a href=&quot;https://arxiv.org/abs/1202.5822&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1202.5822&lt;/a&gt;, 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 &lt;span class=&quot;math-container&quot;&gt;$I+g$&lt;/span&gt; without ancilla qubit, I will be very happy to learn that!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import ParameterVector&#xA;from qiskit import QuantumCircuit&#xA;theta = ParameterVector( 'theta' , 2 )&#xA;qc = QuantumCircuit( 3 ) &#xA;q = qc.qubits&#xA;qc.h(q) &#xA;qc.crx( theta[0] , q[0], q[1] )&#xA;qc.cry( theta[1] , q[1], q[2] )&#xA;qc.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/95D8C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/95D8C.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2021-04-27T11:01:56.390" LastActivityDate="2021-04-27T11:01:56.390" Title="Run VQE for parametrized quantum circuit with ancilla qubits" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15317" PostTypeId="2" ParentId="15314" CreationDate="2020-12-29T08:50:35.073" Score="3" Body="&lt;p&gt;First confirm that &lt;span class=&quot;math-container&quot;&gt;$\vert \psi \rangle = (\vec{e_x} - \vec{e_z}) / \sqrt{2}$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.  Indeed, the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$H \vert \psi \rangle = (-1) \vert \psi \rangle$&lt;/span&gt;, confirming this axis is fixed by &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.  An equivalent statement is that &lt;span class=&quot;math-container&quot;&gt;$H \vert \psi \rangle = \vert \psi \rangle$&lt;/span&gt;, up to global phase.&lt;/p&gt;&#xA;&lt;p&gt;Second, note that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is an involution (&lt;span class=&quot;math-container&quot;&gt;$H^2=I$&lt;/span&gt;) with both eigenvectors fixed up to global phase, so it's action on the Bloch sphere must be equivalent to a rotation by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.  It's worth pointing out that the Bloch sphere is a complex projective line, not a Euclidean 2-sphere where &lt;span class=&quot;math-container&quot;&gt;$\det(H)=-1$&lt;/span&gt; would have signaled a reflection.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-12-29T08:50:35.073" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15318" PostTypeId="2" ParentId="15110" CreationDate="2020-12-29T13:22:00.807" Score="0" Body="&lt;p&gt;For a boolean-valued result, your code works.&lt;/p&gt;&#xA;&lt;p&gt;If you are looking for a &amp;quot;more quantum mechanical&amp;quot; approach, then the &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.87.167902&quot; rel=&quot;nofollow noreferrer&quot;&gt;swap trick&lt;/a&gt; best suits you.&lt;/p&gt;&#xA;&lt;p&gt;The quantum circuit of the swap trick is as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ivfXQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ivfXQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(figure comes from the cited paper.) In this circuit, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; are the two states that you want to compare, then the probability that measuring the uppermost qubit(the control qubit) returns a &amp;quot;0&amp;quot; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}+\frac{1}{2}F(|\psi\rangle,|\phi\rangle)$&lt;/span&gt;, where is the fidelity I mentioned in the comment.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-12-29T13:22:00.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15319" PostTypeId="1" AcceptedAnswerId="15322" CreationDate="2020-12-29T19:14:56.900" Score="7" ViewCount="1094" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="10388" LastEditorUserId="10480" LastEditDate="2020-12-31T08:04:15.040" LastActivityDate="2021-01-07T19:20:44.653" Title="What makes representing qubits in a 3D real vector space possible?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15320" PostTypeId="2" ParentId="15319" CreationDate="2020-12-29T19:38:07.783" Score="6" Body="&lt;p&gt;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.&#xA;And its not exactly a 3D real space. Its similar but not exactly same.&lt;/p&gt;&#xA;" OwnerUserId="14291" LastActivityDate="2020-12-29T19:38:07.783" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15321" PostTypeId="2" ParentId="15319" CreationDate="2020-12-29T19:39:31.200" Score="12" Body="&lt;p&gt;Three real parameters are sufficient due to the constraint that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\alpha|^2 + |\beta|^2 = 1\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are the two components of a 2D complex vector describing the qubit state. This constraint ultimately derives from the fact that &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; are probabilities of the two possible outcomes of the computational basis measurement.&lt;/p&gt;&#xA;&lt;p&gt;In order to see how the constraint &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; implies that three real parameters are sufficient write &lt;span class=&quot;math-container&quot;&gt;$\alpha = r e^{i\theta}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta = s e^{i\zeta}$&lt;/span&gt; and substitute into &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; to get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;r^2 + s^2 = 1.\tag{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This means that &lt;span class=&quot;math-container&quot;&gt;$r, \theta, \zeta \in \mathbb{R}$&lt;/span&gt; are sufficient to specify &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb{C}$&lt;/span&gt; satisfying &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the global phase is unobservable and can be ignored, so we can in fact choose &lt;span class=&quot;math-container&quot;&gt;$\theta = 0$&lt;/span&gt; (i.e. &lt;span class=&quot;math-container&quot;&gt;$\alpha\ge 0$&lt;/span&gt;). 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).&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="491" LastEditDate="2021-01-07T19:20:44.653" LastActivityDate="2021-01-07T19:20:44.653" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15322" PostTypeId="2" ParentId="15319" CreationDate="2020-12-29T19:44:57.557" Score="12" Body="&lt;p&gt;Mathematically a qubit's coefficients &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; must have the following properties:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|c_1|^2 + |c_2|^2 =1 \tag{1}\\&#xA;|c_1|, |c_2| \in [0,1], \tag{2}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;However we know:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sin^2\theta + \cos^2\theta = 1\tag{3}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so we can set &lt;span class=&quot;math-container&quot;&gt;$c_1=\sin\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2=\cos\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However also remember that &lt;span class=&quot;math-container&quot;&gt;$|e^{\textrm{i}\phi}|=1$&lt;/span&gt;, so we can add that to one of the coefficients, so that: &lt;span class=&quot;math-container&quot;&gt;$c_1=\sin\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2=e^{\textrm{i}\phi}\cos\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Any more factors like &lt;span class=&quot;math-container&quot;&gt;$e^{\textrm{i}x}$&lt;/span&gt; for different real-valued angles &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; 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.&lt;/p&gt;&#xA;&lt;p&gt;Therefore there's only two real-valued angles necessary: &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. We can add more, but they can always be factored out into what is known as a &amp;quot;global phase&amp;quot; which is something that doesn't make any difference in the outcomes of measurements.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2020-12-30T14:26:22.453" LastActivityDate="2020-12-30T14:26:22.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15323" PostTypeId="1" AcceptedAnswerId="15373" CreationDate="2020-12-29T21:10:25.133" Score="2" ViewCount="36" Body="&lt;p&gt;Suppose we have a &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.legacy.WeightedPauliOperator.html#qiskit.aqua.operators.legacy.WeightedPauliOperator&quot; rel=&quot;nofollow noreferrer&quot;&gt;PauliWeightedOperator&lt;/a&gt; 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.&lt;/p&gt;&#xA;" OwnerUserId="13457" LastEditorUserId="55" LastEditDate="2020-12-30T10:52:14.163" LastActivityDate="2021-01-02T04:38:49.083" Title="Qiskit PauliWeightedOperator in the matrix representation?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-operation&gt;&lt;matrix-representation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15325" PostTypeId="1" AcceptedAnswerId="15326" CreationDate="2020-12-30T01:23:02.120" Score="1" ViewCount="71" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tmpeW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tmpeW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the picture above, the last layer with dot-shape, is called 1D ladder of controlled Z gates. It is stated in &lt;a href=&quot;https://www.nature.com/articles/s41467-018-07090-4&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; to show the barren plateau issue. I want to know which is the control qubit, the higher one or the lower one?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-01-02T10:31:55.123" LastActivityDate="2021-01-02T10:31:55.123" Title="What is the control qubit in this 1D ladder of controlled Z gates?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15326" PostTypeId="2" ParentId="15325" CreationDate="2020-12-30T01:27:56.683" Score="4" Body="&lt;p&gt;Controlled Z gate is symmetric with respect to the two qubits.&lt;/p&gt;&#xA;&lt;p&gt;Its action in the computational basis is to leave the states &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; unchanged and to flip the phase of the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Consequently, it does not matter which qubit we designate as control: it flips the phase only if both qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can also see this from its matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CZ = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-30T01:33:05.840" LastActivityDate="2020-12-30T01:33:05.840" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15327" PostTypeId="1" AcceptedAnswerId="15329" CreationDate="2020-12-30T01:32:29.290" Score="3" ViewCount="69" Body="&lt;p&gt;This exercise wants me to prove the equivalence of the two circuits using their mathematical representations.&lt;/p&gt;&#xA;&lt;p&gt;Circuit 1:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BRKVW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BRKVW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Circuit 2:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZjMPY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZjMPY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Circuit 1 (&lt;code&gt;q1&lt;/code&gt; CNOT &lt;code&gt;q0&lt;/code&gt;) should be represented by &lt;span class=&quot;math-container&quot;&gt;$I \otimes P_0 + X \otimes P_1$&lt;/span&gt;. Circuit 2 (Hadamard &lt;code&gt;q0&lt;/code&gt; and &lt;code&gt;q1&lt;/code&gt;, &lt;code&gt;q0&lt;/code&gt; CNOT &lt;code&gt;q1&lt;/code&gt;, Hadamard &lt;code&gt;q0&lt;/code&gt; and &lt;code&gt;q1&lt;/code&gt;) should be &lt;span class=&quot;math-container&quot;&gt;$(H \otimes H)(P_0 \otimes I + P_1 \otimes X)(H \otimes H)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I use the following identities&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_0 + P_1 = I = P_{+} + P_{-}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X = P_{+} - P_{-}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Z = P_0 - P_1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{+} = HP_0H$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$P_{-} = HP_1H$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$P_0, P_1, P_{+}, P_{-}$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \langle 1|$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle \langle +|$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$| - \rangle \langle - |$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&lt;p&gt;I take circuit 1 and get this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$I \otimes P_0 + X \otimes P_1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= (P_{+} + P_{-}) \otimes P_0 + (P_{+} - P_{-}) \otimes P_1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= P_{+} \otimes (P_0 + P_1) + P_{-} \otimes (P_0 - P_1)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= P_{+} \otimes I + P_{-} \otimes Z$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$= HP_0H \otimes I + HP_1H \otimes Z$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are my circuit representations correct to begin with? If so, should the Z operator be there? Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14184" LastEditorUserId="55" LastEditDate="2021-01-02T10:32:17.120" LastActivityDate="2021-01-02T10:32:17.120" Title="Show that the two circuits are equivalent mathematically" Tags="&lt;textbook-and-exercises&gt;&lt;tensor-product&gt;&lt;hadamard&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15328" PostTypeId="1" CreationDate="2020-12-30T01:36:56.127" Score="8" ViewCount="89" Body="&lt;p&gt;HHL solves the linear equation &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; by the quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle=A^{-1} |b\rangle$&lt;/span&gt;. However, the quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is normalized and thus diffs a normalization constant from the solution vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. My question is how to recover the missing normalization constant?&lt;/p&gt;&#xA;&lt;p&gt;Especially, HHL is supposed to be applied to a scenario which does not need &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; itself by some number &lt;span class=&quot;math-container&quot;&gt;$x^T M x$&lt;/span&gt;. In this case, normalization constant matters to compute &lt;span class=&quot;math-container&quot;&gt;$x^TMx$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\langle x|M|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14297" LastActivityDate="2021-01-25T08:03:11.590" Title="How to recover the normalization constant of the HHL solution" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15329" PostTypeId="2" ParentId="15327" CreationDate="2020-12-30T01:40:03.400" Score="2" Body="&lt;p&gt;Your derivation is correct and is just missing the final step:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\dots &amp;amp;= HP_0H \otimes I + HP_1H \otimes Z \\&#xA;&amp;amp;= HP_0H \otimes HH + HP_1H \otimes HXH \\&#xA;&amp;amp;= (H\otimes H) (P_0 \otimes I) (H\otimes H) + (H\otimes H) (P_1 \otimes X) (H \otimes H) \\&#xA;&amp;amp;= (H\otimes H) (P_0 \otimes I + P_1 \otimes X) (H \otimes H)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we used the identity &lt;span class=&quot;math-container&quot;&gt;$HXH=Z$&lt;/span&gt; which is easy to check.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-30T01:40:03.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15330" PostTypeId="2" ParentId="15327" CreationDate="2020-12-30T02:27:02.627" Score="4" Body="&lt;p&gt;You can also just convert it to matrix representation and show that the two matrix are the same.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Circuit 1:&lt;/strong&gt; This have &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; as the controlled qubit and so it has the matrix representation as unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U_1 = CNOT_{q_1, q_0} &amp;amp;= I \otimes |0\rangle\langle0| + X \otimes |1 \rangle \langle 1| = \begin{pmatrix}  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$X = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0| = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\langle 1| = \begin{pmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;Circuit 2:&lt;/strong&gt; Here we have &lt;span class=&quot;math-container&quot;&gt;$U_2 = H\otimes H \cdot CNOT_{q_0, q_1} \cdot H \otimes H$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1\\ \end{pmatrix}$&lt;/span&gt; and hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$H \otimes H = \dfrac{1}{2} \begin{pmatrix}  1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1\\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1\\1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{pmatrix} $&lt;/span&gt;.&#xA;Therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_2 =\begin{pmatrix}  1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1\\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1\\1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{pmatrix} \begin{pmatrix}  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix} \begin{pmatrix}  1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\ 1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1\\ 1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1\\1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \end{pmatrix} = \begin{pmatrix}  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{pmatrix}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;Thus, &lt;span class=&quot;math-container&quot;&gt;$U_1 = U_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-30T02:27:02.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15331" PostTypeId="2" ParentId="15314" CreationDate="2020-12-30T03:10:03.730" Score="3" Body="&lt;p&gt;A brute force way to do this is to use rotation matrices. You can rewrite the Hadamard matrix as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;H &amp;amp;= \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; \text{-}1 \end{pmatrix} \\&#xA;&amp;amp;= \frac{1}{\sqrt{2}}\begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} \begin{pmatrix} 1 &amp;amp; \text{-}1 \\ 1 &amp;amp; 1 \end{pmatrix}  \\&#xA;&amp;amp;= R_x(\pi)R_y\left(\frac{\pi}{2}\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So its just the composition of two rotation matrices. If you write out the &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; matrix representations for these rotations you get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;R_x(\pi)R_y\left(\frac{\pi}{2}\right) &amp;amp;\rightarrow \begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 \\ &#xA;0 &amp;amp; \cos \pi &amp;amp; \text{-}\sin \pi \\ &#xA;0 &amp;amp; \sin \pi &amp;amp; \cos \pi&#xA;\end{pmatrix} \begin{pmatrix} \cos \frac{\pi}{2} &amp;amp; 0 &amp;amp; \sin \frac{\pi}{2}\\ &#xA;0 &amp;amp; 1 &amp;amp; 0 \\ &#xA;\text{-}\sin \frac{\pi}{2} &amp;amp; 0 &amp;amp; \cos \frac{\pi}{2}\end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix} &#xA;0 &amp;amp; 0 &amp;amp; 1\\ &#xA;0 &amp;amp; \text{-}1  &amp;amp; 0 \\ &#xA;1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can compare this to the rotation matrix for an arbitrary 3D rotation matrix &lt;span class=&quot;math-container&quot;&gt;$R_{\vec{n}}(\theta)$&lt;/span&gt; around a unit vector &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt; (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Rotation_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; for example) to get an overconstrained system of equations. However in this case its easy to confirm that &lt;span class=&quot;math-container&quot;&gt;$\vec{n} = (1, 0, 1)/\sqrt{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi$&lt;/span&gt; is the correct choice.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2020-12-30T03:10:03.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15332" PostTypeId="1" AcceptedAnswerId="15333" CreationDate="2020-12-30T04:08:13.890" Score="3" ViewCount="379" Body="&lt;p&gt;I was reading some material on &lt;a href=&quot;https://courses.cs.washington.edu/courses/csep590/05su/hw2sol.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;QC online&lt;/a&gt; and I found some material that explain how to show that Bell states are orthonormal but without details.&lt;/p&gt;&#xA;&lt;p&gt;I understand that we  need to check &lt;span class=&quot;math-container&quot;&gt;$\langle state1|state2\rangle = 0$&lt;/span&gt; but I'm not really sure how to calculate that with Dirac notation.&lt;/p&gt;&#xA;&lt;p&gt;In the link below 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?&lt;/p&gt;&#xA;" OwnerUserId="13569" LastEditorUserId="55" LastEditDate="2021-01-02T10:34:12.313" LastActivityDate="2021-01-02T10:34:12.313" Title="How to show that Bell states are orthonormal" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;&lt;linear-algebra&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15333" PostTypeId="2" ParentId="15332" CreationDate="2020-12-30T04:31:16.690" Score="6" Body="&lt;p&gt;First, note that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt; and therefore &lt;span class=&quot;math-container&quot;&gt;$\langle 0 |1\rangle = \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix}= 0 $&lt;/span&gt; and similarly, &lt;span class=&quot;math-container&quot;&gt;$ \langle 1|0\rangle = 0$&lt;/span&gt;. Also note that &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = |0\rangle \otimes |0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle = |0\rangle \otimes |1\rangle$&lt;/span&gt; etc. Hence, &lt;span class=&quot;math-container&quot;&gt;$\langle 00| 11\rangle = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle 00| 10 \rangle = 0$&lt;/span&gt;, etc. But &lt;span class=&quot;math-container&quot;&gt;$\langle 00| 00\rangle = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle 11 | 11\rangle = 1$&lt;/span&gt; should be obvious.&lt;/p&gt;&#xA;&lt;p&gt;The four Bell states are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^+ \rangle = \dfrac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle \big) $&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^- \rangle = \dfrac{1}{\sqrt{2}}\big(|00\rangle - |11\rangle \big) $&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^+ \rangle = \dfrac{1}{\sqrt{2}}\big(|01\rangle + |10 \rangle \big) $&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^- \rangle = \dfrac{1}{\sqrt{2}}\big(|01\rangle - |10 \rangle \big) $&lt;/span&gt; &lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;So therefore we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} &#xA;\langle \Phi^- |\Phi^+ \rangle &amp;amp;= \dfrac{1}{\sqrt{2}}\bigg(\langle 00 | - \langle 11|\bigg) \dfrac{1}{\sqrt{2}}\bigg(|00\rangle + |11\rangle \bigg) \\&#xA;&amp;amp;= \dfrac{1}{2} \bigg( \langle 00 |00\rangle + \langle 00 | 11\rangle - \langle 11 | 00\rangle - \langle 11| 11 \rangle \bigg) \\&#xA;&amp;amp;=  \dfrac{1}{2}\bigg( 1 + 0 - 0 - 1 \bigg) \\&#xA;&amp;amp;= 0&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} &#xA;\langle \Phi^- |\Psi^+ \rangle &amp;amp;= \dfrac{1}{\sqrt{2}}\bigg(\langle 00 | - \langle 11|\bigg)  \dfrac{1}{\sqrt{2}}\bigg(|01\rangle + |10 \rangle \bigg)\\&#xA; &amp;amp;= \dfrac{1}{2} \bigg( \langle 00 |01\rangle + \langle 00 | 10\rangle - \langle 11 | 01\rangle - \langle 11| 10 \rangle \bigg) \\&#xA;&amp;amp;=  \dfrac{1}{2}\bigg( 0 + 0 - 0 - 0 \bigg) \\&#xA;&amp;amp;= 0&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And you can show that this is true for the others.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2020-12-30T04:31:16.690" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15334" PostTypeId="2" ParentId="15332" CreationDate="2020-12-30T08:09:55.460" Score="3" Body="&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\langle\Phi^+|\Psi^-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;One way to do this is to switch from Dirac notation to standard linear algebra by replacing the kets and bras with &lt;a href=&quot;https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation#Bras_and_kets_as_row_and_column_vectors&quot; rel=&quot;nofollow noreferrer&quot;&gt;appropriate column and row vectors&lt;/a&gt;. After this conversion you employ the formula for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dot_product#Complex_vectors&quot; rel=&quot;nofollow noreferrer&quot;&gt;complex dot product&lt;/a&gt;. Alternatively, you can perform the entire calculation in Dirac notation using known orthonormality relations such as those for the computational basis.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;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&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This way the task of verifying orthonormality of the Bell states becomes the task of checking that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, i.e. that &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In some contexts (e.g. Nielsen &amp;amp; Chuang, section 1.3.6, p. 26) Bell states are introduced as the output of the quantum circuit&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT \circ (H \otimes I) \,|x\rangle|y\rangle\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;on the four computational basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle, |0\rangle|1\rangle, |1\rangle|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|1\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;) preserve inner products.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Finally, Bell states can be represented as simple &lt;a href=&quot;https://arxiv.org/abs/1708.00006&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor networks&lt;/a&gt;. In this view, &lt;span class=&quot;math-container&quot;&gt;$|\Phi^+\rangle$&lt;/span&gt; represents a &amp;quot;cup&amp;quot; and the other three Bell states differ from it by a Pauli operator. Inner product of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; links up the two open ports of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with the two open ports of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$I/2$&lt;/span&gt;, i.e. one. Otherwise, it equals the trace of a Pauli operator, i.e. zero.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-30T08:09:55.460" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15335" PostTypeId="2" ParentId="15319" CreationDate="2020-12-30T09:16:00.553" Score="7" Body="&lt;p&gt;For vector representation of any qubit it is true that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;it has to be a unit vector&lt;/li&gt;&#xA;&lt;li&gt;global phase does not matter and can be fixed at any value&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;As a result two degress of freedom are eliminated and as a result you are left with only two free parameters.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-30T09:16:00.553" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15336" PostTypeId="2" ParentId="15332" CreationDate="2020-12-30T09:28:06.730" Score="3" Body="&lt;p&gt;To avoid long computation of all pair-wise inner products in Bell basis, you can think as follow.&lt;/p&gt;&#xA;&lt;p&gt;Switching from computational basis to the Bell basis is done by transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT(H \otimes I)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2020-12-30T09:28:06.730" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15337" PostTypeId="2" ParentId="6940" CreationDate="2020-12-30T10:25:51.697" Score="0" Body="&lt;p&gt;I think it can be done with the method in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6011/calculating-the-expectation-value-of-a-unitary-operator-on-a-quantum-computer&quot;&gt;this question&lt;/a&gt;(The first answer).&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$V^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Measure in a basis for which &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is one of the elements&lt;/li&gt;&#xA;&lt;li&gt;Repeat until you have a suitably accurate estimate of the probability of getting the answer &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Substitue &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; will work.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U(\theta)|0\rangle = |\psi \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13968" LastActivityDate="2020-12-30T10:25:51.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15338" PostTypeId="1" AcceptedAnswerId="15340" CreationDate="2020-12-30T13:15:46.743" Score="2" ViewCount="55" Body="&lt;p&gt;My question is highly related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15301/transversal-logical-gate-for-stabilizer-or-at-least-steane-code&quot;&gt;this topic&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is about defining logical operation on a Stabilizer code.&lt;/p&gt;&#xA;&lt;p&gt;I call &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; the stabilizer group of a code space &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, and I assumed it is generated by a family &lt;span class=&quot;math-container&quot;&gt;$S=\langle s_1,...,s_p \rangle$&lt;/span&gt;. I call &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-Pauli matrix group (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; being the dimension of the full Hilbert space).&lt;/p&gt;&#xA;&lt;p&gt;A &lt;strong&gt;definition&lt;/strong&gt; of logical operation is as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; is a logical operation if &lt;span class=&quot;math-container&quot;&gt;$\forall |\psi \rangle \in C$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_L | \psi \rangle \in C$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And, we realize that if &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is stabilized by &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_L |\psi \rangle$&lt;/span&gt; will be stabilized by &lt;span class=&quot;math-container&quot;&gt;$U_L g U_L^{\dagger}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Questions: which condition to ensure &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; is a logical operation&lt;/h2&gt;&#xA;&lt;p&gt;A &lt;strong&gt;sufficient&lt;/strong&gt; condition is to have &lt;span class=&quot;math-container&quot;&gt;$U_L S U_L^{\dagger} = S$&lt;/span&gt;, which means that &lt;span class=&quot;math-container&quot;&gt;$U_L \in N(S)$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; is the normalizer of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Indeed, this way we would be certain that &lt;span class=&quot;math-container&quot;&gt;$U_L |\psi\rangle$&lt;/span&gt; will be stabilized by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and thus be in the codespace.&lt;/p&gt;&#xA;&lt;p&gt;What disturbs me is that according to the comments &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15301/transversal-logical-gate-for-stabilizer-or-at-least-steane-code&quot;&gt;here&lt;/a&gt; (and some of the sources attached), the logical operation are actually &lt;strong&gt;exactly&lt;/strong&gt; elements of &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt;. I see the sufficient condition but not the necessary one.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; is non clifford, for &lt;span class=&quot;math-container&quot;&gt;$s \in S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_L s U_L^{\dagger}$&lt;/span&gt; might not even be an n-Pauli matrix, thus &lt;span class=&quot;math-container&quot;&gt;$U_L S U_L^{\dagger} \neq S$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$S \subset G_n$&lt;/span&gt;. In this case obviously &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; wouldn't be in the normalizer of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. But wouldn't it be possible to have a non n-Pauli matrix that still stabilize appropriately &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So my question is: Why is it sufficient &lt;em&gt;&lt;strong&gt;and necessary&lt;/strong&gt;&lt;/em&gt; to have &lt;span class=&quot;math-container&quot;&gt;$U_L \in N(S)$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; is a logical operation ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2020-12-30T18:54:57.290" LastActivityDate="2020-12-30T18:54:57.290" Title="Necessary and sufficient condition to define logical operation (stabilizer code)" Tags="&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15339" PostTypeId="1" AcceptedAnswerId="15341" CreationDate="2020-12-30T16:21:23.377" Score="2" ViewCount="61" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;" OwnerUserId="14301" LastEditorUserId="10480" LastEditDate="2020-12-31T08:32:59.470" LastActivityDate="2020-12-31T08:32:59.470" Title="Understanding transversal gates for the 7 qubit steane code" Tags="&lt;error-correction&gt;&lt;universal-gates&gt;&lt;fault-tolerance&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15340" PostTypeId="2" ParentId="15338" CreationDate="2020-12-30T16:33:06.767" Score="3" Body="&lt;p&gt;You are correct that there are logical operators (i.e. ones that preserve &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;) outside &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt;. Also, your argument is sound and can be stated rigorously as follows. Let &lt;span class=&quot;math-container&quot;&gt;$U \in N(S)$&lt;/span&gt;. Then for any &lt;span class=&quot;math-container&quot;&gt;$s \in S$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$UsU^\dagger \in S$&lt;/span&gt;. Now, diagonalize &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;s = VdV^\dagger&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V(\theta) = V \, \mathrm{diag}(1, \dots, 1, e^{i\theta}) \, V^\dagger.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$V(\theta)$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. Now, define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta) = U V(\theta)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta) s U(\theta)^\dagger = UV(\theta)sV(\theta)^\dagger U^\dagger = UsU^\dagger.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we found a continuous, one-parameter group of operators that preserve &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. It cannot be a subset of &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; is discrete.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The requirement that &lt;span class=&quot;math-container&quot;&gt;$U\in N(S)$&lt;/span&gt; is sufficient, but not necessary for &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be a logical operator. However, when one restricts their consideration to the Pauli group &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; the requirement is both necessary and sufficient.&lt;/p&gt;&#xA;&lt;p&gt;In quantum error correction one sometimes restricts consideration to &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt;, because of &lt;em&gt;discretization of quantum errors&lt;/em&gt;. This result says that if an error correction operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{R}$&lt;/span&gt; recovers from errors in a set &lt;span class=&quot;math-container&quot;&gt;$\{E_i\}$&lt;/span&gt; then it recovers from errors &lt;span class=&quot;math-container&quot;&gt;$\{F_j\}$&lt;/span&gt; which are linear combinations of &lt;span class=&quot;math-container&quot;&gt;$\{E_i\}$&lt;/span&gt;. Thus, for the purposes of establishing whether an error is a logical operator (and thus uncorrectable) it is sufficient to consider errors in &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; since every operator can be written as a linear combination of elements of &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;See for example theorem 10.2 on p.438 in section 10.3.1 of Nielsen &amp;amp; Chuang and the discussion following the proof. A good summary is also section IX &amp;quot;Digitization of quantum errors&amp;quot; in &lt;a href=&quot;https://arxiv.org/abs/0905.2794&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/0905.2794&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-30T16:33:06.767" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15341" PostTypeId="2" ParentId="15339" CreationDate="2020-12-30T17:16:48.547" Score="1" Body="&lt;p&gt;By &lt;a href=&quot;https://en.wikipedia.org/wiki/Eastin%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eastin-Knill theorem&lt;/a&gt;, no quantum error correcting code capable of detecting arbitrary errors implements a universal gate set transversally (see &lt;a href=&quot;https://arxiv.org/abs/0811.4262&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;). Clifford group together with any non-Clifford operator is universal (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403025&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;). 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.&lt;/p&gt;&#xA;&lt;p&gt;Now, since the 7-qubit Steane code implements all Clifford operators transversally (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15301/transversal-logical-gate-for-stabilizer-or-at-least-steane-code&quot;&gt;this answer&lt;/a&gt;, the introduction in &lt;a href=&quot;https://arxiv.org/abs/0706.1382&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; or section 10.6.2 of Nielsen &amp;amp; Chuang), we conclude that no operator outside the Clifford group admits a transversal implementation in Steane code.&lt;/p&gt;&#xA;&lt;p&gt;Thus, your list of transversal operators is already complete.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-30T20:13:57.913" LastActivityDate="2020-12-30T20:13:57.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15344" PostTypeId="1" CreationDate="2020-12-30T23:44:40.433" Score="1" ViewCount="49" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;I read some information on swap test including this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8511/how-and-why-does-swap-test-works&quot;&gt;link here&lt;/a&gt; and I noticed that the probability of cswap test is:&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$|\phi _{x}\rangle =\ |\phi _{y}\rangle$&lt;/span&gt; then we observe a 0 with &lt;span class=&quot;math-container&quot;&gt;$prob(0) = 1$&lt;/span&gt; according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_fingerprinting&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So I was wondering what are the probabilities of a false positive and false negative in quantum fingerprinting?&lt;/p&gt;&#xA;&lt;p&gt;According to what I saw I'm guessing:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Probability to get a false positive (a 0 even if both states don't match) is 1 - P(getting 0) so it's 0?&lt;/li&gt;&#xA;&lt;li&gt;Probability of getting a false negative (a 1 even if both states match) is 1/2?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;But I'm not sure if my conclusion is correct, could someone please confirm this and give some explanation?&lt;/p&gt;&#xA;" OwnerUserId="13569" LastEditorUserId="10480" LastEditDate="2020-12-31T10:07:14.060" LastActivityDate="2020-12-31T10:07:14.060" Title="What is the probability of error in quantum fingerprinting using cswap test?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15345" PostTypeId="2" ParentId="15344" CreationDate="2020-12-31T02:07:36.680" Score="2" Body="&lt;p&gt;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).&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41467-020-14454-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; gives a detailed reduction using density matrix at SUPPLEMENTARY NOTE 4.&lt;/p&gt;&#xA;&lt;p&gt;I'll just sketch the conclusion. The probability that the measurement of the control qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state is &lt;span class=&quot;math-container&quot;&gt;$p_0=\frac{1}{2}+\frac{1}{2}F(|\phi\rangle,rho)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is the state vector of one state, and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the density matrix. Thus the fidelity of the two states is &lt;span class=&quot;math-container&quot;&gt;$F(|\phi\rangle, rho)=2*p_0-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since by its definition, fidelity can be a number varting continuously from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, 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.&lt;/p&gt;&#xA;" OwnerUserId="13647" LastActivityDate="2020-12-31T02:07:36.680" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15346" PostTypeId="1" CreationDate="2020-12-31T02:25:01.797" Score="1" ViewCount="140" Body="&lt;p&gt;Looking for a starter point for a professional training as a &lt;em&gt;Quantum Computer programmer&lt;/em&gt;. Is a master in &lt;em&gt;Computer Science&lt;/em&gt; &lt;code&gt;XOR&lt;/code&gt; &lt;em&gt;Applied Physics&lt;/em&gt; a good starting point?&lt;/p&gt;&#xA;" OwnerUserId="14274" LastEditorUserId="55" LastEditDate="2021-01-02T10:37:45.140" LastActivityDate="2021-01-02T10:37:45.140" Title="What is the best learning path for quantum computing?" Tags="&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2021-01-03T12:53:25.990" ContentLicense="CC BY-SA 4.0" />
  <row Id="15347" PostTypeId="2" ParentId="13861" CreationDate="2020-12-31T06:48:26.303" Score="0" Body="&lt;p&gt;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 &amp;quot;cat&amp;quot; states &lt;span class=&quot;math-container&quot;&gt;$(|0\dots 0\rangle + |1\dots 1\rangle)/\sqrt{2}$&lt;/span&gt; is described in section 10.6.3 in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;&lt;p&gt;However, the quote in the question and the subsequent reference on the following page to the use of &amp;quot;error correcting procedure for the classical linear codes&amp;quot; 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.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; sectors to replace quantum error correction with classical error correction on measurement results.&lt;/p&gt;&#xA;&lt;p&gt;Consider a logical qubit encoded into a block of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; physical qubits using a &lt;span class=&quot;math-container&quot;&gt;$CSS(C_1, C_2)$&lt;/span&gt; code for two classical linear codes &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$C_2^\perp \subset C_1$&lt;/span&gt;. Denote the Hilbert space of the block by &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; and the code subspace by &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G} \subset \mathcal{H}$&lt;/span&gt; (thus, &lt;span class=&quot;math-container&quot;&gt;$\dim \mathcal{G} = 2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\dim \mathcal{H} = 2^n$&lt;/span&gt;). Let &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; be the stabilizer group of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; the normalizer of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli group &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;All operators in &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; are transversal, so stabilizers and logical Pauli operators are transversal. Moreover, since &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a CSS code, we can choose stabilizer generators that are tensor products of identity and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or identity and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. Similarly, we can choose the logical &lt;span class=&quot;math-container&quot;&gt;$\overline X$&lt;/span&gt; to be a tensor product of identity and physical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators and logical &lt;span class=&quot;math-container&quot;&gt;$\overline Z$&lt;/span&gt; to be a tensor product of identity and physical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators. For a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; type stabilizer generator &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt;, define &lt;span class=&quot;math-container&quot;&gt;$b(g_z) \in \mathbb{Z}_2^n$&lt;/span&gt; to be a binary vector with &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; in positions corresponding to identity and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in positions corresponding to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. Define &lt;span class=&quot;math-container&quot;&gt;$b(\overline Z)$&lt;/span&gt; similarly.&lt;/p&gt;&#xA;&lt;p&gt;First, take the tensor product of per-qubit operators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I_i = \sum_{k_i\in\{0, 1\}}|k_i\rangle\langle k_i|=|0\rangle\langle 0| + |1\rangle\langle 1| \\&#xA;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|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; identifies a qubit, to compute the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizer generators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; represents the dot product in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2^n$&lt;/span&gt; (i.e. componentwise multiplication modulo &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The procedure begins by measuring each qubit individually in the computational basis. The results form a binary vector &lt;span class=&quot;math-container&quot;&gt;$m \in \mathbb{Z}_2^n$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m_i \in \{0, 1\}$&lt;/span&gt; corresponding to the measurement outcome on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit. From equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; we see that given &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; we can classically compute the measurement outcomes associated with all &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizer generators using the formula &lt;span class=&quot;math-container&quot;&gt;$(-1)^{m\cdot b(g_z)}$&lt;/span&gt;. Next, we employ the classical error correction techniques using the code &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; which is the classical code associated with the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; sector of the stabilizer to identify and correct a certain number of bit flip and measurement errors in &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; producing a corrected vector of measurement outcomes &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt;. From equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; we see that given &lt;span class=&quot;math-container&quot;&gt;$m'$&lt;/span&gt; we can compute the outcome of logical measurement using formula &lt;span class=&quot;math-container&quot;&gt;$(-1)^{m'\cdot b(\overline Z)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt;. In particular, it is neither &lt;span class=&quot;math-container&quot;&gt;$|\overline 0\rangle$&lt;/span&gt; nor &lt;span class=&quot;math-container&quot;&gt;$|\overline 1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2020-12-31T08:09:47.637" LastActivityDate="2020-12-31T08:09:47.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15348" PostTypeId="1" CreationDate="2020-12-31T13:57:24.343" Score="3" ViewCount="28" Body="&lt;p&gt;My question is related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15301/transversal-logical-gate-for-stabilizer-or-at-least-steane-code&quot;&gt;this topic&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I consider working with error correcting code on which I want to define logical operations.&lt;/p&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15338/necessary-and-sufficient-condition-to-define-logical-operation-stabilizer-code/15340?noredirect=1#comment21216_15340&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But this is not enough, we must also verify that the logical gate, once ensured it preserves the code space does the &lt;strong&gt;appropriate&lt;/strong&gt; operation.&lt;/p&gt;&#xA;&lt;h2&gt;Some general requirements&lt;/h2&gt;&#xA;&lt;p&gt;I call &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; the gate I want to implement logically under &lt;span class=&quot;math-container&quot;&gt;$A_L$&lt;/span&gt;. I call &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; the code space.&lt;/p&gt;&#xA;&lt;p&gt;One condition I must have is to ensure: &lt;span class=&quot;math-container&quot;&gt;$\forall |\psi \rangle \in C, A_L |\psi \rangle \in C$&lt;/span&gt;.&#xA;But this is not enough, I must &amp;quot;preserve&amp;quot; the action of this operation on the logical space.&lt;/p&gt;&#xA;&lt;p&gt;One &lt;strong&gt;necessary&lt;/strong&gt; condition would be to make sure that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \forall X: [A,X] \rightarrow [A_L,X_L]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't know how to phrase it precisely mathematically but basically it is to say that the commutator of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with any other operator has the same &amp;quot;shape&amp;quot; as in the logical space.&lt;/p&gt;&#xA;&lt;p&gt;And as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-Pauli matrices form a basis of &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt;, I guess this condition would by linearity be equivalent to say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \forall E \in G_n, [A,E] \rightarrow [A_L, E_L] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$G_n$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-Pauli matrices group. But still: is ensuring commutation rule &lt;strong&gt;enough&lt;/strong&gt; or is it only &lt;strong&gt;necessary&lt;/strong&gt; to preserve the meaning of the operation ?&lt;/p&gt;&#xA;&lt;h2&gt;My question in the end&lt;/h2&gt;&#xA;&lt;p&gt;What is a rigorous way to define logical operation on a quantum error correcting code. And if there are some &amp;quot;nice&amp;quot; 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.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2020-12-31T14:02:47.600" LastActivityDate="2020-12-31T14:02:47.600" Title="Proper definition of logical operation in Q.E.C" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15349" PostTypeId="1" AcceptedAnswerId="15355" CreationDate="2020-12-31T17:13:02.470" Score="6" ViewCount="87" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;" OwnerUserId="14084" LastEditorUserId="55" LastEditDate="2021-01-02T10:38:51.967" LastActivityDate="2021-01-02T10:38:51.967" Title="Are there any algorithms that take measurements in an intermediate step?" Tags="&lt;circuit-construction&gt;&lt;measurement&gt;&lt;deferred-measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15350" PostTypeId="5" CreationDate="2020-12-31T17:27:23.460" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2020-12-31T17:27:23.460" LastActivityDate="2020-12-31T17:27:23.460" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15351" PostTypeId="4" CreationDate="2020-12-31T17:27:23.460" Score="0" Body="The &quot;principle of deferred measurement&quot; refers to the idea that in almost all cases measurement may be performed as a last step in a quantum computation.  This tag is dedicated to questions that explore the concept and/or potential exceptions to the concept." OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-01-01T05:46:33.530" LastActivityDate="2021-01-01T05:46:33.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15352" PostTypeId="2" ParentId="15346" CreationDate="2020-12-31T17:42:36.573" Score="3" Body="&lt;p&gt;From my experience, the best entry point to learning Quantum Computing is working through &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_and_Quantum_Information&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielsen and Chuang&lt;/a&gt;.  This book is a phenomenal introduction to the core concepts in quantum computing, and assumes very little from the reader except &amp;quot;mathematical maturity.&amp;quot;  Even if you're planning to start a graduate program, I would recommend working through this book during the admissions process.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;New options requiring less commitment than graduate school are also becoming available, like Chicago's &lt;a href=&quot;https://professional.uchicago.edu/find-your-fit/professional-education/certificate-programs-quantum-engineering-and-technology&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Certificate Program&lt;/a&gt; and MIT's &lt;a href=&quot;https://learn-xpro.mit.edu/quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;QC Fundamentals Course&lt;/a&gt;.  The government (mostly DOE and NSF) is also now investing heavily in developing a quantum workforce (see, e.g. &lt;a href=&quot;https://www.energy.gov/articles/white-house-office-technology-policy-national-science-foundation-and-department-energy&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, and &lt;a href=&quot;https://www.energy.gov/articles/department-energy-announces-625-million-new-quantum-centers&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), largely to ensure we're competitive with China.  There may be opportunities to get your training subsidized by Uncle Sam.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2020-12-31T17:42:36.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15353" PostTypeId="1" CreationDate="2020-12-31T18:59:42.940" Score="1" ViewCount="90" Body="&lt;p&gt;I fail to understand the EPR experiment. From &lt;a href=&quot;https://en.wikipedia.org/wiki/EPR_paradox&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Alice now measures the spin along the z-axis. She can obtain one of&#xA;two possible outcomes: +z or −z. Suppose she gets +z. Informally&#xA;speaking, the quantum state of the system collapses into state I. The&#xA;quantum state determines the probable outcomes of any measurement&#xA;performed on the system. In this case, if Bob subsequently measures&#xA;spin along the z-axis, there is 100% probability that he will obtain&#xA;−z. Similarly, if Alice gets −z, Bob will get +z.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I emphatically do not reproduce above claim. As example I consider measurement of spin along an arbitrary axis. Specially I consider measuring spin along &lt;span class=&quot;math-container&quot;&gt;$\vec{v} = \frac{1}{\sqrt{38}}(2,3,5)$&lt;/span&gt; and with input state &lt;span class=&quot;math-container&quot;&gt;$\psi = \frac{1}{\sqrt 2}(|01\rangle - |10\rangle)$&lt;/span&gt;. Here are my steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice wants to measure sping along &lt;span class=&quot;math-container&quot;&gt;$\vec{v}$&lt;/span&gt;. This means we create the observable &lt;span class=&quot;math-container&quot;&gt;$M = \vec{v} \cdot \vec{\sigma}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma}$&lt;/span&gt; is the general Pauli matrix equal to sum of the individual Pauli matrices i.e., &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma} = X + Y + Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; matrix and &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$4\times1$&lt;/span&gt; vector. To make a measurement corresponding to &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; on the first qubit we need to create a tensor product of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; identity matrix &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;. So let &lt;span class=&quot;math-container&quot;&gt;$O = M \otimes I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now to perform the measurement we will do a eigen decomposition of &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;. Note that gives me 4 eigenvalues not 2. Its true that there are 2 unique eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{+1, -1\}$&lt;/span&gt; and I understand these to mean spin &amp;quot;up&amp;quot; or spin &amp;quot;down&amp;quot;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I get following probabilities of the 4 eigenvalues:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;Alice's Eigenvalues (i.e., possible measurement outcomes)&#xA;[-1.00000000000000, -1.00000000000000, 1.00000000000000, 1.00000000000000]&#xA;Alice's probabilities&#xA;[0.452776776413453, 0.0472232235865468, 0.0472232235865468, 0.452776776413453]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Now suppose Alice measures the first eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; (spin &amp;quot;down&amp;quot;).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We then collapse the wavefunction &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; to the corresponding eigenvector of &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\psi^{'}$&lt;/span&gt; be the collapsed wavefunction after Alice's measurement.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Now Bob will measure spin along the &lt;span class=&quot;math-container&quot;&gt;$\vec{v}$&lt;/span&gt; axis on the second qubit. The observable corresponding to this is &lt;span class=&quot;math-container&quot;&gt;$O^{'} = I \otimes M$&lt;/span&gt; and input to this observable is &lt;span class=&quot;math-container&quot;&gt;$\psi^{'}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And now the kick: when I simulate Bob's measurement I do not get a spin &amp;quot;up&amp;quot; outcome with 100% probability. I find that there are 2 unique eigenvalues associated with non-zero probabilities.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;Bob's Eigenvalues&#xA;[-1.00000000000000, -1.00000000000000, 1.00000000000000, 1.00000000000000]&#xA;Bob's probabilities&#xA;[0.00892013138361998, 0.0855263157894737, 0.0855263157894737, 0.820027237037433]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And this is my dilemma. My whole simluation can be found at:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/siddjain/epr-experiment&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/siddjain/epr-experiment&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Aside: If part of the answer is that &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; should be &lt;span class=&quot;math-container&quot;&gt;$M \otimes M$&lt;/span&gt; I emphatically consider that as cheating. The experiment states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Alice now measures the spin along the z-axis...&#xA;the quantum state of the system collapses into state I...&#xA;Bob subsequently measures&#xA;spin along the z-axis, there is 100% probability that he will obtain&#xA;−z. Similarly, if Alice gets −z, Bob will get +z.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="14251" LastActivityDate="2021-01-31T19:01:25.147" Title="Trouble understanding the EPR Experiment" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15354" PostTypeId="2" ParentId="12964" CreationDate="2020-12-31T21:03:08.453" Score="2" Body="&lt;p&gt;Consider a nearest-neighbor Ising Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$$H = \sum_{i=1}^n J_i \sigma_i^z \sigma_{i+1}^z.$$&lt;/span&gt; Let &lt;span class=&quot;math-container&quot;&gt;$X = \sum_{i=1}^n \sigma_i^x$&lt;/span&gt;. The QAOA ansatz is &lt;span class=&quot;math-container&quot;&gt;$$|\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}$$&lt;/span&gt;&#xA;The expectation value of an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; under this ansatz is &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle = \langle\mathbf{\beta}, \mathbf{\gamma}|A|\mathbf{\beta}, \mathbf{\gamma}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let's say that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is supported only on sites &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;. And consider &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt;. Then we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\langle A \rangle &amp;amp;= \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} \\&#xA;&amp;amp;= \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} \\&#xA;&amp;amp;= \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\\&amp;amp;\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} \\&#xA;\end{align*}&lt;/span&gt;&#xA;where:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in the second line we used that all the other &lt;span class=&quot;math-container&quot;&gt;$\sigma_i^x$&lt;/span&gt; terms commuted through &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and canceled, since &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is only supported on 2 and 3.&lt;/li&gt;&#xA;&lt;li&gt;in the third line we used that all the other &lt;span class=&quot;math-container&quot;&gt;$\sigma_i^z \sigma_{i+1}^z$&lt;/span&gt; terms in &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; commute through &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and canceled.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now look at the last line. Imagine if &lt;span class=&quot;math-container&quot;&gt;$p=2$&lt;/span&gt;. Then we would have another &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \beta_2 X)$&lt;/span&gt; to worry about. This time though, the &lt;span class=&quot;math-container&quot;&gt;$\sigma_1^z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_4^z$&lt;/span&gt; terms would get in the way of &lt;span class=&quot;math-container&quot;&gt;$\sigma_1^x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_4^x$&lt;/span&gt; commuting all the way through &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and canceling out. And then similarly, when we add the &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \gamma_2 H)$&lt;/span&gt; term, the &lt;span class=&quot;math-container&quot;&gt;$\sigma_4^z \sigma_5^z$&lt;/span&gt; term would not commute all the way through and cancel, because now we have a &lt;span class=&quot;math-container&quot;&gt;$\sigma_4^x$&lt;/span&gt; term that gets in the way. You can imagine doing this again with &lt;span class=&quot;math-container&quot;&gt;$p=3$&lt;/span&gt;, and so on.&lt;/p&gt;&#xA;&lt;p&gt;So in summary:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;we want to determine the expectation value of some local observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;when we look at &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt;, almost all of the terms commute through &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and cancel. So only the qubits very close to the support of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; actually contribute to &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;for each successive &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, you get more terms (e.g. &lt;span class=&quot;math-container&quot;&gt;$\sigma_i^x$&lt;/span&gt; terms) &amp;quot;in the way&amp;quot;, so the full expression for &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle$&lt;/span&gt; includes qubit terms that are less local to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;eventually, &lt;em&gt;all the qubits&lt;/em&gt; will contibute to &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle$&lt;/span&gt;, even though &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; itself is only supported locally on a small number of qubits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Potentially this is everything you already knew. For the TSP specifically, the exact meaning of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; depends on the particular Ising/QUBO formulation of the TSP. But certainly &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; would only take into account nodes to are somehow &lt;span class=&quot;math-container&quot;&gt;$f(p)$&lt;/span&gt;-local to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is just some monotonically increasing function. But recall with QAOA that you are trying to optimize &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is composed of a sum of local observables. So I don't think it is right to say that level-&lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; gives you something related to a &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-locally optimized solution. I think it is much more complicated, because you are optimizing a global sum of a bunch of &lt;span class=&quot;math-container&quot;&gt;$f(p)$&lt;/span&gt;-local quantities, which is itself still somehow global.&lt;/p&gt;&#xA;&lt;p&gt;So in summary, how exactly &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is related to properties of the resulting solution to TSP is very nontrivial. Truthfully, it may be that this is a &lt;em&gt;good&lt;/em&gt; thing. If we could say something as definite as &amp;quot;QAOA&lt;span class=&quot;math-container&quot;&gt;${}_p$&lt;/span&gt; gives a &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-locally optimized solution&amp;quot;, then we would almost definitely find that classical &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;&amp;quot;-local greedy methods would compete with and/or outperform QAOA&lt;span class=&quot;math-container&quot;&gt;${}_p$&lt;/span&gt;. The complicated behavior of how a solution is related to &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is potentially a reason that QAOA could give us heuristically better performance than classical approximation methods.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;This is all just my impression, which could of course be wrong.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5467" LastEditorUserId="5467" LastEditDate="2020-12-31T21:08:33.277" LastActivityDate="2020-12-31T21:08:33.277" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15355" PostTypeId="2" ParentId="15349" CreationDate="2020-12-31T21:15:05.947" Score="3" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;Here are a few prominent examples:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation&lt;/a&gt; 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,&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_gate_teleportation&quot; rel=&quot;nofollow noreferrer&quot;&gt;gate teleportation&lt;/a&gt; technique for applying a gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; using quantum teleportation where the recovery step is modified to obtain &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt; rather than the original state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/KLM_protocol&quot; rel=&quot;nofollow noreferrer&quot;&gt;KLM protocol&lt;/a&gt; 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,&lt;/li&gt;&#xA;&lt;li&gt;quantum error correction using &lt;a href=&quot;https://en.wikipedia.org/wiki/Stabilizer_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;stabilizer codes&lt;/a&gt; where measurements are used to detect and identify errors as they are occurring during quantum computation,&lt;/li&gt;&#xA;&lt;li&gt;fault-tolerant constructions that use &lt;a href=&quot;https://en.wikipedia.org/wiki/Magic_state_distillation#Magic_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;magic states&lt;/a&gt; to perform gates that do not admit a transversal implementation in a given quantum error correcting code.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;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 &lt;a href=&quot;https://en.wikipedia.org/wiki/Deferred_Measurement_Principle&quot; rel=&quot;nofollow noreferrer&quot;&gt;principle of deferred measurement&lt;/a&gt;. It is described on p.186 in section 4.4 in Nielsen &amp;amp; Chuang as follows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Principle of deferred measurement:&lt;/strong&gt; 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.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 1 (replacing classical control with quantum control):&lt;/strong&gt; A simple, but very useful case occurs when the measurement result is immediately used to control a unitary gate. Consider two qubits &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in a state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle$&lt;/span&gt;. Suppose we measure &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the computational basis and then apply a unitary &lt;span class=&quot;math-container&quot;&gt;$U_B$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; conditioned on the result of the measurement. Neglecting normalization, if we measure &lt;span class=&quot;math-container&quot;&gt;$|0_A\rangle$&lt;/span&gt;, the state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_B^0 \langle 0_A|\psi_{AB}\rangle = I_B \langle 0_A|\psi_{AB}\rangle = \langle 0_A|\psi_{AB}\rangle \tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if we measure &lt;span class=&quot;math-container&quot;&gt;$|1_A\rangle$&lt;/span&gt; the state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_B^1 \langle 1_A|\psi_{AB}\rangle = \langle 1_A |U_B|\psi_{AB}\rangle. \tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now suppose we instead apply controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to both qubits with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as control and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as target and then measure &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as the final step in the circuit. First note that the unitary of controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as control and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as target is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CU_{AB} = |0_A\rangle\langle 0_A| \otimes I_B + |1_A\rangle\langle 1_A| \otimes U_B.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once again, neglecting normalization, if we measure &lt;span class=&quot;math-container&quot;&gt;$|0_A\rangle$&lt;/span&gt; the state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;&amp;amp;\langle 0_A|CU_{AB}|\psi_{AB}\rangle \\&#xA;&amp;amp;=\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 \\&#xA;&amp;amp;=\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 \\&#xA;&amp;amp;=\langle 0_A|\psi_{AB}\rangle&#xA;\end{align}\tag{1'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;whereas if we measure &lt;span class=&quot;math-container&quot;&gt;$|1_A\rangle$&lt;/span&gt; the state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;&amp;amp;\langle 1_A|CU_{AB}|\psi_{AB}\rangle \\&#xA;&amp;amp;=\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 \\&#xA;&amp;amp;= \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\\&#xA;&amp;amp;= \langle 1_A|U_B|\psi_{AB}\rangle.&#xA;\end{align}\tag{2'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we see that the post-measurement state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the same for each outcome of measurement on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. 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.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example 2 (replacing measurement with CNOT gate and auxiliary qubit):&lt;/strong&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; starts in &lt;span class=&quot;math-container&quot;&gt;$|\psi_B\rangle$&lt;/span&gt; and the original circuit applies a gate &lt;span class=&quot;math-container&quot;&gt;$U_B$&lt;/span&gt;, followed by a measurement in the computational basis, followed by a gate &lt;span class=&quot;math-container&quot;&gt;$V_B$&lt;/span&gt;. As before, we neglect normalization. If we measure &lt;span class=&quot;math-container&quot;&gt;$|0_B\rangle$&lt;/span&gt; then the post-measurement state of the qubit is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V_B |0_B\rangle\langle 0_B| U_B|\psi_B\rangle \tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if we measure &lt;span class=&quot;math-container&quot;&gt;$|1_B\rangle$&lt;/span&gt; then it is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V_B |1_B\rangle\langle 1_B| U_B|\psi_B\rangle. \tag4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The corresponding circuit with terminal measurements is constructed by adding an auxiliary qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; initialized in state &lt;span class=&quot;math-container&quot;&gt;$|0_A\rangle$&lt;/span&gt;, replacing the measurement with a CNOT with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as control and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as the target and finally measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the computational basis. The unitary part of the circuit computes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;&amp;amp;(I_A \otimes V_B) \circ CNOT_{BA} \circ (I_A \otimes U_B) |0_A\rangle|\psi_B\rangle \\&#xA;&amp;amp;= (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 \\&#xA;&amp;amp;= \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 \\&#xA;&amp;amp;= |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&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so if we measure &lt;span class=&quot;math-container&quot;&gt;$|0_A\rangle$&lt;/span&gt; then the post-measurement state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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 = \\&#xA;V_B |0_B\rangle\langle 0_B|U_B|\psi_B\rangle \tag{3'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if we measure &lt;span class=&quot;math-container&quot;&gt;$|1_A\rangle$&lt;/span&gt; then the post-measurement state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\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 = \\&#xA;V_B |1_B\rangle\langle 1_B|U_B|\psi_B\rangle \tag{4'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;once again in agreement with the original circuit.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-31T21:15:05.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15356" PostTypeId="1" AcceptedAnswerId="15357" CreationDate="2020-12-31T21:21:12.153" Score="3" ViewCount="64" Body="&lt;p&gt;The italicized section below is referring to chapter 3 of &amp;quot;Quantum Mechanics: The Theoretical Minimum&amp;quot; by Leonard Susskind and Art Friedman.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;It is written that the operator that corresponds to measuring spin in the &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; direction is &lt;span class=&quot;math-container&quot;&gt;$\sigma_\hat{n} = n_x X + n_y Y + n_z Z$&lt;/span&gt;. The book gives an example where &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; lies in the z-x plane,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{n} = \begin{pmatrix}\sin(\theta) \\ 0\\ \cos(\theta)\end{pmatrix}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the angle between &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; axis. In matrix form, this gives:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sigma_\hat{n}=&#xA;\begin{pmatrix}&#xA;\cos(\theta) &amp;amp; \sin(\theta) \\&#xA;\sin(\theta) &amp;amp; -\cos(\theta)&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;with eigenvalues and eigenvectors &lt;span class=&quot;math-container&quot;&gt;$[1, &#xA;\big(\begin{smallmatrix}&#xA;\cos(\theta/2) \\&#xA;\sin(\theta/2) &#xA;\end{smallmatrix}\big)]$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$[-1, &#xA;\big(\begin{smallmatrix}&#xA;-\sin(\theta/2) \\&#xA;\cos(\theta/2)&#xA;\end{smallmatrix}\big)]$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, if a state, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, is pointing in the direction &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;, it has an angle of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; from the Z axis, then it's state vector in the Z basis should be &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = &#xA;\big(\begin{smallmatrix}&#xA;\cos(\theta) \\&#xA;\sin(\theta) &#xA;\end{smallmatrix}\big) = \hat{n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why do the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\sigma_n$&lt;/span&gt; not align with the vector for &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;? My thinking is that measuring the spin in the direction &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; should leave a state either in &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; or a state orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My guess is that I'm making a mental error going from the Cartesian system to Bloch Sphere system.&lt;/p&gt;&#xA;" OwnerUserId="11635" LastEditorUserId="10480" LastEditDate="2021-01-24T22:13:58.833" LastActivityDate="2021-01-24T22:13:58.833" Title="Why do the eigenvectors of a spin observable not align with the direction of the spin?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15357" PostTypeId="2" ParentId="15356" CreationDate="2020-12-31T22:09:43.527" Score="3" Body="&lt;p&gt;The key idea is to distinguish between the physical space and the Hilbert space.&lt;/p&gt;&#xA;&lt;p&gt;The observable &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\hat n}$&lt;/span&gt; is associated with the physical space, here modeled as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;. Consequently, &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\hat n}$&lt;/span&gt; has &lt;em&gt;three real&lt;/em&gt; components &lt;span class=&quot;math-container&quot;&gt;$n_x, n_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n_z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; lives in the Hilbert space, here modeled as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;. Consequently, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; has &lt;em&gt;two complex&lt;/em&gt; components. Note that the eigenvectors you found, e.g. &lt;span class=&quot;math-container&quot;&gt;$(\cos\frac{\theta}{2}, \sin\frac{\theta}{2})$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$n_y$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\hat n}$&lt;/span&gt; points along (and the answer is &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt;). This is related to the physical significance of the components of vectors in the two spaces.&lt;/p&gt;&#xA;&lt;p&gt;The physical significance of the components of &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\hat n}$&lt;/span&gt; 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 &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; lies in &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;determining&lt;/a&gt; the probabilities of various measurement outcomes. For example, since the first component of your first eigenvector is &lt;span class=&quot;math-container&quot;&gt;$\cos \frac{\theta}{2}$&lt;/span&gt; we know that if we were to measure &lt;span class=&quot;math-container&quot;&gt;$\sigma_z$&lt;/span&gt; we would obtain the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; or &amp;quot;spin up&amp;quot; result with probability &lt;span class=&quot;math-container&quot;&gt;$\cos^2 \frac{\theta}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2020-12-31T22:09:43.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15358" PostTypeId="1" AcceptedAnswerId="15360" CreationDate="2021-01-01T04:12:55.297" Score="2" ViewCount="48" Body="&lt;p&gt;I was reading about quantum postulates, and I have a few questions about the second postulate that describes the evolution of a quantum system.&lt;/p&gt;&#xA;&lt;p&gt;For a system S, we describe the evolution after applying the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; by the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|S'\rangle = U|S\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand the idea a bit, I saw a couple of simple examples like H,  but I would like to see it in action on a slightly more complex unitary (with a tensor product).&lt;/p&gt;&#xA;&lt;p&gt;For example, can someone please give the detailed steps to calculate the following evolution for &lt;span class=&quot;math-container&quot;&gt;$|S\rangle = |00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What would be the state for &lt;span class=&quot;math-container&quot;&gt;$|S'\rangle$&lt;/span&gt;  with &lt;span class=&quot;math-container&quot;&gt;$U = CNOT\circ (H\otimes I)$&lt;/span&gt;, I'm bit confused by the tensor product...&lt;/li&gt;&#xA;&lt;li&gt;What happens if we apply &lt;span class=&quot;math-container&quot;&gt;$|S''\rangle = U'|S'\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; this time &lt;span class=&quot;math-container&quot;&gt;$U'=(H\otimes I) \circ CNOT$&lt;/span&gt;  (different order).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Thanks in advance and happy new year :)&lt;/p&gt;&#xA;" OwnerUserId="13569" LastEditorUserId="55" LastEditDate="2021-01-02T10:25:43.743" LastActivityDate="2021-01-02T10:25:43.743" Title="How to find the output state after evolution through a unitary?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15360" PostTypeId="2" ParentId="15358" CreationDate="2021-01-01T08:50:06.827" Score="3" Body="&lt;p&gt;First note that &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle =  \begin{pmatrix} 1 \\ 0 \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle =  \begin{pmatrix} 0 \\ 1 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix}  = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we have that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\big( H\otimes I \big) |00 \rangle = H|0\rangle \otimes I|0\rangle = \bigg(\dfrac{|0\rangle + |1\rangle}{\sqrt{2} } \bigg)\otimes |0\rangle = \dfrac{|00\rangle + |10\rangle}{\sqrt{2} } $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now note that &lt;span class=&quot;math-container&quot;&gt;$CNOT = |0\rangle\langle 0| \otimes  I  +|1 \rangle \langle 1| \otimes  X  =\begin{pmatrix}  1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt;. Thus, the CNOT gate here just apply the bit flip gate, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, to the target qubit when the controlled-qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and do nothing otherwise.&lt;/p&gt;&#xA;&lt;br&gt; &#xA;&lt;p&gt;Therefore, if you apply &lt;span class=&quot;math-container&quot;&gt;$U = CNOT \cdot H\otimes I$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|S\rangle = |00\rangle$&lt;/span&gt; then you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \big( CNOT \cdot H\otimes I\big) |00\rangle = CNOT \cdot \bigg( \big(H \otimes I \big) |00\rangle \bigg) = CNOT \cdot \bigg(\dfrac{|00\rangle + |10\rangle}{\sqrt{2} } \bigg) = \dfrac{|00\rangle + |11\rangle}{\sqrt{2} } $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is, &lt;span class=&quot;math-container&quot;&gt;$U |00\rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2} } $&lt;/span&gt;. On a quantum circuit, this can be realized as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JgxY5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JgxY5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that for the figure above, &lt;span class=&quot;math-container&quot;&gt;$|\psi_0 \rangle = |S\rangle = |00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle = \dfrac{|00\rangle + |10\rangle}{\sqrt{2} }  $&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle = |S'\rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2} } $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, if you apply &lt;span class=&quot;math-container&quot;&gt;$\big( H \otimes I \big) \cdot CNOT $&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|S'\rangle$&lt;/span&gt; then this is equivalent to applying &lt;span class=&quot;math-container&quot;&gt;$U_1 = CNOT \cdot \big(H\otimes I\big) \cdot \big( H \otimes I \big) \cdot CNOT $&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|S\rangle = |00\rangle$&lt;/span&gt; since&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align} &#xA;\bigg( \big( H \otimes I \big) \cdot CNOT \bigg) |S'\rangle &amp;amp;= \bigg( \big( H \otimes I \big) \cdot CNOT \bigg)  \bigg(  CNOT \cdot \big( H\otimes I\big) |00\rangle \bigg) \\&#xA;&amp;amp;= \big( H \otimes I \big) \cdot CNOT  \cdot CNOT \cdot \big(H\otimes I\big) |00\rangle \\&#xA;&amp;amp;= \big( H \otimes I \big) \cdot \big(H\otimes I\big) |00\rangle \\&#xA;&amp;amp;= |00\rangle &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note: &lt;span class=&quot;math-container&quot;&gt;$CNOT \cdot CNOT = I$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; is its own inverse. Similarly, &lt;span class=&quot;math-container&quot;&gt;$H \otimes I$&lt;/span&gt; is its own inverse hence &lt;span class=&quot;math-container&quot;&gt;$\big( H \otimes I \big) \cdot \big( H \otimes I \big) = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can see this on the quantum circuit as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/66zDp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/66zDp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-01T08:50:06.827" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15361" PostTypeId="1" CreationDate="2021-01-01T12:30:50.670" Score="4" ViewCount="232" Body="&lt;p&gt;I am running the simplest Hadamard circuit possible - one qubit, initialised to 0, apply H gate, measure in Z basis. When I run the circuit on the simulator I obtain the expected result (50% in 0, 50% in 1) but the &amp;quot;measurement probability&amp;quot; and &amp;quot;state vector&amp;quot; from the IBM Circuit Composer indicate I am in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, with 100% probability to measure 0. Am I understanding this visualisation wrong? Why don't I see the 50%/50% measurement probabilities and the state vector to be &lt;span class=&quot;math-container&quot;&gt;$(\frac{1}{\sqrt{2}})(|0\rangle + |1\rangle)$&lt;/span&gt;?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Z6stH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Z6stH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14317" LastEditorUserId="55" LastEditDate="2021-01-02T10:30:12.087" LastActivityDate="2021-01-02T10:30:12.087" Title="Simple Hadamard Circuit gives incorrect results?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15362" PostTypeId="2" ParentId="15361" CreationDate="2021-01-01T12:52:08.217" Score="2" Body="&lt;p&gt;You use the measurement operator, which means the state will collapse.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastActivityDate="2021-01-01T12:52:08.217" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15363" PostTypeId="2" ParentId="15361" CreationDate="2021-01-01T14:02:16.647" Score="3" Body="&lt;p&gt;Just to a little bit expand answer provided by &lt;em&gt;Zhaoyi Zhou&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;First, try to put only reset gate and Hadamard gate on the qubit. In this case, you will see probability of measuring 0 and 1 equal to 50 % and state vector will be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;. &lt;em&gt;Note that you do not have to use reset gate as the qubit is initially in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, add the measurement gate. When you do so, the state collapses to 0 or 1 which is indicated by 100 % probability in the histogram.&lt;/p&gt;&#xA;&lt;p&gt;Overall, the visualization shows state vector of the circuit only in case, there is no measurement gates.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-01T14:02:16.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15364" PostTypeId="1" AcceptedAnswerId="15365" CreationDate="2021-01-01T16:00:04.967" Score="2" ViewCount="88" Body="&lt;p&gt;I was implementing controlled S and T gates in qiskit and was wondering if there is any difference between using the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CU1Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cu1&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CRZGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;crz&lt;/code&gt;&lt;/a&gt; gates for this purpose. Qiskit doesn't seem to include explicit versions of these two gates.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = qiskit.QuantumCircuit(2)&#xA;# a)&#xA;circuit.crz(theta=math.pi/2, control_qubit=0, target_qubit=1)&#xA;# b)&#xA;circuit.cu1(theta=math.pi/2, control_qubit=0, target_qubit=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In terms of the unitary the &lt;code&gt;cu1&lt;/code&gt; gate seems closer to what one would want, I would assume. Are there any other consequences I should be aware of?&lt;/p&gt;&#xA;" OwnerUserId="10225" LastEditorUserId="55" LastEditDate="2021-01-02T10:30:17.010" LastActivityDate="2021-01-02T20:20:13.627" Title="Qiskit Controlled S and Controlled T Gates" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15365" PostTypeId="2" ParentId="15364" CreationDate="2021-01-01T18:11:45.983" Score="2" Body="&lt;p&gt;In Qiskit you can get the controlled version of any gate with the method &lt;code&gt;control&lt;/code&gt;.&#xA;For S and T, here is the example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library.standard_gates import SGate, TGate&#xA;&#xA;csgate = SGate().control(1) # the parameter is the amount of control points you want&#xA;ctgate = TGate().control(1)&#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.append(csgate, [0, 1])&#xA;circuit.append(ctgate, [0, 1])&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ──■────■──&#xA;     ┌─┴─┐┌─┴─┐&#xA;q_1: ┤ S ├┤ T ├&#xA;     └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to compare these gates with &lt;code&gt;cu1&lt;/code&gt; or &lt;code&gt;crz&lt;/code&gt;, you can use the &lt;code&gt;Operator&lt;/code&gt; class:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library.standard_gates import CRZGate, CU1Gate&#xA;from math import pi&#xA;&#xA;from qiskit.quantum_info import Operator&#xA;print(Operator(CU1Gate(pi/2)) == Operator(csgate))&#xA;print(Operator(CRZGate(pi/4)) == Operator(ctgate))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;True&#xA;False&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-01-02T20:20:13.627" LastActivityDate="2021-01-02T20:20:13.627" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15366" PostTypeId="2" ParentId="15353" CreationDate="2021-01-01T18:24:14.530" Score="0" Body="&lt;p&gt;I suspect that there is a bug in the code. Here is a short analysis following the steps of your scenario. First, diagonalize &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = |a\rangle\langle a| - |b\rangle\langle b| = P_a - P_b&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|a\rangle = \alpha_0|0\rangle + \alpha_1|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|b\rangle = \beta_0|0\rangle + \beta_1|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_a = |a\rangle\langle a|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_b = |b\rangle\langle b|$&lt;/span&gt; are the projectors onto the eigenspaces of the two eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&lt;p&gt;Probability that Alice measures &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle\psi | P_b \otimes I |\psi\rangle &amp;amp;= \frac{1}{2}(\langle 01|-\langle 10|) P_b \otimes I (|01\rangle - |10\rangle) \\&#xA;&amp;amp;= \frac{1}{2}\left(\langle 01|P_b \otimes I|01\rangle -\langle 01| P_b \otimes I |10\rangle \\&#xA;- \langle 10|P_b \otimes I|01\rangle + \langle 10|P_b \otimes I|10\rangle\right) \\&#xA;&amp;amp;= \frac{1}{2} \left(|\beta_0|^2 - 0 - 0 + |\beta_1|^2\right) \\&#xA;&amp;amp;= \frac{1}{2}&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and similarly for &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, as in your scenario let us compute the collapsed state following Alice measuring &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi'\rangle = \frac{P_b \otimes I |\psi\rangle}{\sqrt{\langle\psi | P_b \otimes I |\psi\rangle}} = P_b \otimes I (|01\rangle - |10\rangle) = \beta_0^*|b1\rangle - \beta_1^*|b0\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, let us find the probability that Bob measures &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle\psi' | I \otimes P_b |\psi'\rangle &amp;amp;= (\beta_0\langle b1| - \beta_1\langle b0|) I \otimes P_b (\beta_0^*|b1\rangle - \beta_1^*|b0\rangle) \\&#xA;&amp;amp;= |\beta_0|^2\langle b1|I \otimes P_b|b1\rangle -&#xA;\beta_0\beta_1^*\langle b1|I \otimes P_b|b0\rangle\\&#xA;&amp;amp;- \beta_0^*\beta_1\langle b0|I \otimes P_b|b1\rangle +&#xA;|\beta_1|^2\langle b0|I \otimes P_b|b0\rangle\\&#xA;&amp;amp;= |\beta_0|^2|\beta_1|^2 - |\beta_0|^2|\beta_1|^2 - |\beta_0|^2|\beta_1|^2 + |\beta_0|^2|\beta_1|^2 \\&#xA;&amp;amp;= 0&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the probability that he measures &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle\psi' | I \otimes P_a |\psi'\rangle &amp;amp;= (\beta_0\langle b1| - \beta_1\langle b0|) I \otimes P_a (\beta_0^*|b1\rangle - \beta_1^*|b0\rangle) \\&#xA;&amp;amp;= |\beta_0|^2\langle b1|I \otimes P_a|b1\rangle -&#xA;\beta_0\beta_1^*\langle b1|I \otimes P_a|b0\rangle\\&#xA;&amp;amp;- \beta_0^*\beta_1\langle b0|I \otimes P_a|b1\rangle +&#xA;|\beta_1|^2\langle b0|I \otimes P_a|b0\rangle\\&#xA;&amp;amp;= |\beta_0|^2|\alpha_1|^2 - \beta_0\beta_1^*\alpha_0^*\alpha_1 - \beta_0^*\beta_1\alpha_0\alpha_1^* + |\beta_1|^2|\alpha_0|^2 \\&#xA;&amp;amp;= (\alpha_1\beta_0 - \alpha_0\beta_1)(\alpha_1^*\beta_0^* - \alpha_0^*\beta_1^*) \\&#xA;&amp;amp;= \left|\det \begin{pmatrix}&#xA;\alpha_1 &amp;amp; \alpha_0 \\&#xA;\beta_1 &amp;amp; \beta_0&#xA;\end{pmatrix}\right|^2 \\&#xA;&amp;amp;= 1.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, Bob's measurement of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; on the collapsed state has deterministic outcome, as expected.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark on &amp;quot;cheating&amp;quot;:&lt;/strong&gt; The calculations above hint at the fact that we can skip the computation of the collapsed state &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; and instead go directly for the Bob's measurement outcome probabilities, for example&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi' | I \otimes P_a |\psi'\rangle = \frac{\langle\psi| (P_b \otimes I) \circ (I \otimes P_a) \circ (P_b \otimes I) |\psi\rangle}{\langle\psi | P_b \otimes I |\psi\rangle} = 2 \langle\psi| P_b \otimes P_a |\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note the appearance of an eigenspace projector for the joint observable &lt;span class=&quot;math-container&quot;&gt;$M\otimes M$&lt;/span&gt;.  This suggests that using the joint observable &lt;span class=&quot;math-container&quot;&gt;$M \otimes M$&lt;/span&gt; is not &amp;quot;cheating&amp;quot;. On the contrary, calculations with the joint observable &lt;span class=&quot;math-container&quot;&gt;$M \otimes M$&lt;/span&gt; and the step-by-step calculations that first use &lt;span class=&quot;math-container&quot;&gt;$M\otimes I$&lt;/span&gt; and then use &lt;span class=&quot;math-container&quot;&gt;$I \otimes M$&lt;/span&gt; are mathematically equivalent.&lt;/p&gt;&#xA;&lt;p&gt;In general, the joint probability distribution over Alice's and Bob's measurement outcomes as well as the post-measurements state are the same whether you&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;first measure &lt;span class=&quot;math-container&quot;&gt;$M \otimes I$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$I \otimes M$&lt;/span&gt; or&lt;/li&gt;&#xA;&lt;li&gt;first measure &lt;span class=&quot;math-container&quot;&gt;$I \otimes M$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$M \otimes I$&lt;/span&gt; or&lt;/li&gt;&#xA;&lt;li&gt;measure &lt;span class=&quot;math-container&quot;&gt;$M \otimes M$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The three ways of doing calculations are mathematically equivalent because &lt;span class=&quot;math-container&quot;&gt;$M\otimes I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I \otimes M$&lt;/span&gt; commute and therefore their eigenspace projectors like &lt;span class=&quot;math-container&quot;&gt;$P_a \otimes I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I \otimes P_b$&lt;/span&gt; also commute.&lt;/p&gt;&#xA;&lt;p&gt;Note that this equivalence follows from linear algebra and does not involve relativity. In particular, it holds regardless of whether Alice's and Bob's measurements are timelike, null or spacelike separated. The order independence property is reassuring though since it means that quantum mechanics and special relativity do not come into conflict over the fact that &lt;em&gt;if&lt;/em&gt; Alice's and Bob's measurements are spacelike separated then the order in which the measurements take place is observer-dependent due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Relativity_of_simultaneity&quot; rel=&quot;nofollow noreferrer&quot;&gt;relativity of simultaneity&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-01T18:29:21.730" LastActivityDate="2021-01-01T18:29:21.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15367" PostTypeId="2" ParentId="15361" CreationDate="2021-01-01T18:29:12.240" Score="1" Body="&lt;p&gt;IBM Quantum Composer shows the measurement probability after the gate have been applied.&lt;/p&gt;&#xA;&lt;p&gt;Hence, if you apply the Hadamard gate to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nhQ4m.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nhQ4m.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then you will see the probability as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mLvsQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mLvsQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But now, if you add the measurement to the circuit, then Qiskit will collapse your state to either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. Then the &lt;strong&gt;post measurement&lt;/strong&gt; state will be either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with 100% probability. &lt;strong&gt;However&lt;/strong&gt;, this doesn't seems to happen within the circuit composer. That is the state will always collapse to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; by default. That is, the following circuit will always seem to collapse to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; by default.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iDOSe.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iDOSe.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if you reset the qubit after the measurement to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; again then apply the Hadamard gate then measure,  it will always collapse to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; by default, interestingly.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2ra54.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2ra54.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;hr /&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;For this reason, my proposal solution would just to run your circuit in Qiskit through the Jupyter notebook setting in QuantumLab environment and use the &lt;code&gt;qasm_simulator&lt;/code&gt;. This will fix this issue. So you can compose your circuit in the Quantum Composer as normal, then just get the generated Qiskit code:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XmgdT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XmgdT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then you can run this Qiskit code in the Jupyter notebook within the QuantumLab for better visualization. You can do this simply by adding the code below additional to the code you got earlier.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import BasicAer, execute&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots = 1000)&#xA;plot_histogram(job.result().get_counts(), color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2moka.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2moka.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You could actually execute your circuit through the quantum composer and select&lt;code&gt;ibmq_qasm_simulator&lt;/code&gt; as your backend but I think it is faster and more flexible if you just migrate your circuit to Qiskit code and execute it through the Jupyter notebook in quantum lab.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-01T18:29:12.240" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15368" PostTypeId="1" AcceptedAnswerId="15371" CreationDate="2021-01-02T00:56:22.677" Score="4" ViewCount="78" Body="&lt;p&gt;Given that a qubit in equal superposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is represented by following wave function&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Psi = \frac{1}{\sqrt 2}(|0\rangle + |1\rangle)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and associated density matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_1 = |\Psi\rangle \langle\Psi| = \frac{1}{2} \begin{pmatrix} 1 &amp;amp;&amp;amp; 1 \\ 1 &amp;amp;&amp;amp; 1 \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Further a qubit in this state is considered to be in a &lt;strong&gt;pure state&lt;/strong&gt; (even though its in a superposition) since the density matrix can be cleanly factored into a product.&lt;/p&gt;&#xA;&lt;p&gt;Fact &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; : When measured this qubit will turn out to be 0 or 1 with 50% probability each.&lt;/p&gt;&#xA;&lt;p&gt;But there exists another density matrix consistent with the same fact &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho_2 = \frac{1}{2} (|0\rangle \langle0|) + \frac{1}{2} (|1\rangle \langle1|)&#xA;       = \frac{1}{2} \begin{pmatrix} 1 &amp;amp;&amp;amp; 0 \\ 0 &amp;amp;&amp;amp; 1 \end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and this matrix corresponds to a &lt;strong&gt;mixed state&lt;/strong&gt;. Clearly &lt;span class=&quot;math-container&quot;&gt;$\rho_1 \neq \rho_2$&lt;/span&gt; but they have same physical characteristics which is the fact &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My Question: What is a physical fact or property that can be used to distinguish &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14251" LastEditorUserId="55" LastEditDate="2021-01-04T23:25:22.830" LastActivityDate="2021-01-04T23:25:22.830" Title="How is a qubit in superposition between $|0\rangle$ and $|1\rangle$ different from a mixture of $|0\rangle$ and $|1\rangle$?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ClosedDate="2021-01-04T20:08:46.120" ContentLicense="CC BY-SA 4.0" />
  <row Id="15369" PostTypeId="1" AcceptedAnswerId="15389" CreationDate="2021-01-02T01:19:35.497" Score="3" ViewCount="110" Body="&lt;p&gt;I'm trying to reconcile (i) the statement that swapping two subsystems constitutes a rotation by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; and (ii) the angle that is implied by the Hermitian generator of a SWAP gate.&lt;/p&gt;&#xA;&lt;p&gt;I haven't tracked down an explicit statement of (i) but I think the idea is, using Dirac's &amp;quot;&lt;a href=&quot;https://www.youtube.com/watch?v=Vfh21o-JW9Q&quot; rel=&quot;nofollow noreferrer&quot;&gt;belt trick&lt;/a&gt;&amp;quot; one can show that the ends of a belt must be swapped &lt;em&gt;twice&lt;/em&gt; to remove &lt;span class=&quot;math-container&quot;&gt;$4\pi$&lt;/span&gt; worth of twist (rotations) applied to the belt buckle. So for Fermions (antisymmetric with respect to particle exchange) the SWAP of two subsystems results in a &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; rotation and some relative phase between the systems.&lt;/p&gt;&#xA;&lt;p&gt;The statement (ii) is just that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP} = \exp (i \frac{\pi}{4} (XX + YY + ZZ))&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; are pauli operators. By analogy with the relationship between &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; this seems to imply a rotation of some kind, but I'm not confident in this analogy. So my questions are&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Does the analogy for understanding single-qubit rotation gates in terms of &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; extend to understanding multi-qubit gates in terms of some other rotation group?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If not, how should I understand the &lt;span class=&quot;math-container&quot;&gt;$\text{SWAP}$&lt;/span&gt; gate in terms of rotations in the context of quantum computing (since there does seem to be a physics explanation connecting the two)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="10480" LastEditDate="2021-03-09T18:44:18.517" LastActivityDate="2021-03-09T18:44:18.517" Title="Can we understand multi-qubit gates in terms of rotation groups?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15370" PostTypeId="1" AcceptedAnswerId="15372" CreationDate="2021-01-02T01:30:57.397" Score="3" ViewCount="75" Body="&lt;p&gt;I am trying to understand the section on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page for GHZ states&lt;/a&gt; entitled &amp;quot;Pairwise entanglement&amp;quot;. In this section, it is claimed that measuring the third particle in a GHZ state in the X basis can leave behind a maximally entangled Bell state. However, there is no source cited and I am having some trouble understanding this, so I was wondering if anyone could perhaps explain this further.&lt;/p&gt;&#xA;&lt;p&gt;Also, how would the measurement outcome of this X-basis measurement affect the state produced?&lt;/p&gt;&#xA;" OwnerUserId="14322" LastEditorUserId="55" LastEditDate="2021-01-04T00:07:58.903" LastActivityDate="2021-01-04T00:07:58.903" Title="How can measuring a particle in a GHZ state leave behind a maximally entangled pair?" Tags="&lt;entanglement&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15371" PostTypeId="2" ParentId="15368" CreationDate="2021-01-02T01:31:56.777" Score="4" Body="&lt;p&gt;The mixed state is invariant under unitary operations; no choice of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that you might apply to &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; will change its output statistics from 50/50 distribution of &amp;quot;0&amp;quot; versus &amp;quot;1&amp;quot;. You can see this since &lt;span class=&quot;math-container&quot;&gt;$U \rho_2 U^\dagger = \rho_2 U U^\dagger = \rho_2$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; is proportional to the identity and therefore commutes with any operator.&lt;/p&gt;&#xA;&lt;p&gt;Meanwhile, you can apply the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; to change its statistics since &lt;span class=&quot;math-container&quot;&gt;$H\rho_1 H = |0\rangle \langle 0|$&lt;/span&gt;, resulting in measurement of &amp;quot;0&amp;quot; 100% of the time.  So you can use certainly use unitary operations to distinguish &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The more general idea at play here is that &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; (and mixed states in general) describes a &lt;em&gt;classical probability distribution&lt;/em&gt;, not a quantum state with probability amplitudes. The whole idea of quantum computing is that we can manipulate probability amplitudes and take advantage of superposition and interference effects (among others) to manipulate the state into doing something useful for us. Classical probability distributions don't have these interesting effects so there's a lot less we can use them for algorithmically.&lt;/p&gt;&#xA;&lt;p&gt;This doesn't mean classical distributions or mixed states are uninteresting for quantum computing. For example, classically random distributions are an essential part of many quantum communication protocols.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-01-02T01:31:56.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15372" PostTypeId="2" ParentId="15370" CreationDate="2021-01-02T02:00:57.740" Score="4" Body="&lt;p&gt;As mentioned in the article, you can rewrite the GHZ state as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\frac{1}{\sqrt{2}} (|000\rangle + |111)&amp;amp;= \frac{1}{2\sqrt{2}}(|000\rangle + |111 \rangle + \overbrace{|001\rangle  + |110 \rangle - |001\rangle - |110\rangle}^{=0} + |000\rangle + |111\rangle ) \\&#xA;&amp;amp;= \frac{1}{2\sqrt{2}}\left[(|000\rangle + |111 \rangle + |001\rangle  + |110 \rangle) + (|000\rangle - |001\rangle - |110\rangle + |111\rangle ) \right] \\&#xA;&amp;amp;= \frac{1}{2\sqrt{2}}  \left[\left( |00\rangle + |11\rangle \right) \otimes(|0\rangle + |1\rangle)+ \left( |00\rangle - |11\rangle \right) \otimes(|0\rangle - |1\rangle) \right] \\&#xA;&amp;amp;= \frac{1}{2} \left[\left( |00\rangle + |11\rangle \right) \otimes |+\rangle + \left( |00\rangle - |11\rangle \right) \otimes |-\rangle\right]&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where I've used &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle \equiv \frac{1}{\sqrt{2}}(|0\rangle \pm |1\rangle)$&lt;/span&gt;  instead of the article's &lt;span class=&quot;math-container&quot;&gt;$|L\rangle, |R\rangle$&lt;/span&gt;. So you can see that if you measure qubit 3 in the X-basis (where measurement of &amp;quot;+&amp;quot; results in outcome &amp;quot;0&amp;quot; and &amp;quot;-&amp;quot; gives &amp;quot;1&amp;quot;) you will end up with either the Bell state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |11\rangle$&lt;/span&gt; if you measure &amp;quot;0&amp;quot;, or the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle - |11\rangle$&lt;/span&gt; if you measure &amp;quot;1&amp;quot;. In the latter case you can apply a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation to qubit 1 or 2 to recover the Bell state.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="9006" LastEditDate="2021-01-02T08:28:28.273" LastActivityDate="2021-01-02T08:28:28.273" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15373" PostTypeId="2" ParentId="15323" CreationDate="2021-01-02T04:38:49.083" Score="1" Body="&lt;p&gt;I think this is what you are looking for:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import WeightedPauliOperator&#xA;import numpy as np&#xA;&#xA;pauli_dict = {'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: -1.0, &amp;quot;real&amp;quot;: 1.0 }, &amp;quot;label&amp;quot;: &amp;quot;XX&amp;quot;}&#xA;                         ]}&#xA;operator = WeightedPauliOperator.from_dict(pauli_dict)&#xA;&#xA;Op = operator.to_opflow()&#xA;MatrixOp = Op.to_matrix()&#xA;MatrixRepresentation = np.real(MatrixOp)&#xA;print(MatrixRepresentation)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;array([[0., 0., 0., 1.],&#xA;       [0., 0., 1., 0.],&#xA;       [0., 1., 0., 0.],&#xA;       [1., 0., 0., 0.]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-02T04:38:49.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15375" PostTypeId="2" ParentId="15364" CreationDate="2021-01-02T07:17:20.777" Score="1" Body="&lt;p&gt;&lt;code&gt;cu1&lt;/code&gt; and &lt;code&gt;crz&lt;/code&gt; are different gates and the difference is explained in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13414/9459&quot;&gt;answer&lt;/a&gt;. One can express &lt;span class=&quot;math-container&quot;&gt;$cS$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$cT$&lt;/span&gt; gates with &lt;code&gt;cu1&lt;/code&gt; gate, but it is impossible to express them with &lt;code&gt;crz&lt;/code&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;cS = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;i \\&#xA;\end{pmatrix} =&#xA;cu1(\pi/2)&#xA;\qquad&#xA;cT = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;1&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{i \pi/4} \\&#xA;\end{pmatrix} =&#xA;cu1(\pi/4)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;while&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;cRz(\alpha) = &#xA;\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;1&amp;amp;0&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;e^{-i \alpha/2}&amp;amp;0 \\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;e^{i \alpha/2} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and there is no way to choose such &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$cRz(\alpha)$&lt;/span&gt; to be equal to &lt;span class=&quot;math-container&quot;&gt;$cS$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$cT$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2021-01-02T07:24:57.663" LastActivityDate="2021-01-02T07:24:57.663" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15376" PostTypeId="1" AcceptedAnswerId="15410" CreationDate="2021-01-02T09:35:21.967" Score="2" ViewCount="57" Body="&lt;p&gt;The problem starts with the given the input state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{in} \rangle = |0 \rangle |1 \rangle$&lt;/span&gt;, I'm asked to calculate &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = H_d \otimes H_d |\psi_{in} \rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; is the Hadamard gate for &lt;span class=&quot;math-container&quot;&gt;$d=4$&lt;/span&gt; dimensional system.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_d = \frac{1}{2} \begin{pmatrix}&#xA;  1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1\\&#xA;  1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1\\&#xA;  1 &amp;amp; 1 &amp;amp; -1 &amp;amp; -1\\&#xA;  1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1&#xA;\end{pmatrix}$$&lt;/span&gt;&#xA;Well, &lt;span class=&quot;math-container&quot;&gt;$H_d|0\rangle = |0\rangle + |1\rangle + |2\rangle + |3\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_d |1 \rangle = |0\rangle - |1\rangle + |2 \rangle - |3 \rangle$&lt;/span&gt;. So &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = H_d \otimes H_d |\psi_{in} \rangle = \frac{1}{4} \sum_{x,y=0}^{d-1} (-1)^{y} |x\rangle |y \rangle$&lt;/span&gt;. The problem suggests that the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt; is not part of the new state, but I think it is.&lt;/p&gt;&#xA;&lt;p&gt;Now the question I'm stuck on is using the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U_f | x,y \rangle = |x, y \oplus f(x) \rangle$&lt;/span&gt;, show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_f|\psi'\rangle = \Big( \sum_{x=0}^{d-1}(-1)^{x} |x\rangle \Big) |1 \rangle_H$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle_H$&lt;/span&gt; is not defined in the problem but I'm guessing it's equivalent to &lt;span class=&quot;math-container&quot;&gt;$H_d|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My problem is we don't know what &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is, only that it might be constant or balanced. So why is &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; always transformed into &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_H$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Here, a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensions is defined as constant if &lt;span class=&quot;math-container&quot;&gt;$f(0) \oplus f(1) \oplus \ldots \oplus f(d-1) = 0$&lt;/span&gt; and it is balanced if &lt;span class=&quot;math-container&quot;&gt;$f(0) \oplus f(1) \oplus \ldots \oplus f(d-1) = \frac{d}{2}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is addition mod &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14184" LastEditorUserId="2293" LastEditDate="2021-04-16T23:01:20.083" LastActivityDate="2021-04-16T23:01:20.083" Title="How does $U_f$ act on a qudit state in the Deutsch-Jozsa Algorithm" Tags="&lt;textbook-and-exercises&gt;&lt;hadamard&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15377" PostTypeId="1" CreationDate="2021-01-02T13:57:04.480" Score="1" ViewCount="40" Body="&lt;p&gt;There are certain codes which have transversal non-Clifford gates. My question is, what are the simplest examples of such codes and how does one check for a non-Clifford gate? Is it a computationally intensive question, compared to checking for Clifford gates?&lt;/p&gt;&#xA;" OwnerUserId="14301" LastEditorUserId="55" LastEditDate="2021-01-04T00:10:33.543" LastActivityDate="2021-01-05T08:30:11.007" Title="What are the simplest examples of codes with transversal non-Clifford gates?" Tags="&lt;universal-gates&gt;&lt;fault-tolerance&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15378" PostTypeId="1" AcceptedAnswerId="15380" CreationDate="2021-01-02T16:31:20.577" Score="2" ViewCount="47" Body="&lt;p&gt;Starting from a state stabilized by Pauli matrices, and using only Clifford operations Gottesman Knill theorem ensures us that such algorithm can be classically simulated.&lt;/p&gt;&#xA;&lt;p&gt;Indeed, if I call my initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;, I can define a Stabilizer group &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; having for generators elements of the n-Pauli matrix group. I have &lt;span class=&quot;math-container&quot;&gt;$S=\langle g_1,...,g_n \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I consider &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; a clifford gate. Then &lt;span class=&quot;math-container&quot;&gt;$U |\psi \rangle$&lt;/span&gt; is stabilized by the stabilizer group &lt;span class=&quot;math-container&quot;&gt;$U S U^{\dagger}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then &lt;span class=&quot;math-container&quot;&gt;$U |\psi \rangle$&lt;/span&gt; is stabilized by &lt;span class=&quot;math-container&quot;&gt;$USU^{\dagger} = \langle U g_1 U^{\dagger},...,U g_n U^{\dagger}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I simply have to compute &lt;span class=&quot;math-container&quot;&gt;$\{U g_i U^{\dagger}\}_{i=1..n}$&lt;/span&gt; to keep track of my state.&lt;/p&gt;&#xA;&lt;h2&gt;My question:&lt;/h2&gt;&#xA;&lt;p&gt;It is said that such operation requires &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; classical operations (for instance in Nielsen &amp;amp; Chuang). Where does this &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; comes from ? I can understand that I have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; calculations to compute each &lt;span class=&quot;math-container&quot;&gt;$U g_i U^{\dagger}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$1 \leq i \leq n$&lt;/span&gt;, but why exactly computing each of those would require additional &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; calculations giving rise to the &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; ? I guess it depends on what we call an elementary operation.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2021-01-02T18:05:58.430" Title="Gottesman Knill theorem: why $O(n^2)$ classical operation to keep track of a Clifford gate" Tags="&lt;stabilizer-state&gt;&lt;gottesman-knill&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15379" PostTypeId="1" CreationDate="2021-01-02T16:31:59.583" Score="8" ViewCount="115" Body="&lt;p&gt;Classical complexity theory makes much of the study of so-called &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/NP-intermediate&quot; rel=&quot;nofollow noreferrer&quot;&gt;intermediate&lt;/a&gt;&lt;/em&gt; problems - that is, problems that are in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; but are nonetheless not known to be in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; and further not expected to be &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete.&lt;/p&gt;&#xA;&lt;p&gt;Commonly discussed examples of likely intermediate problems include, e.g., GRAPH-ISOMORPHISM and FACTORING.  One reason why GRAPH-ISOMORPHISM and FACTORING are both thought to be of intermediate complexity is that neither are known to have an algorithm in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BPP}$&lt;/span&gt;, while both are known to be in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{coNP}$&lt;/span&gt; (or rather, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{coAM}$&lt;/span&gt; in the case of GRAPH-ISOMPORPHISM) - thus if, for example, FACTORING/GRAPH-ISOMPORPHISM were &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete, then one would have the conclusion that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP=coNP}$&lt;/span&gt;/the polynomial-time hierarchy &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PH}$&lt;/span&gt; collapse, both of which are believed to be unlikely.&lt;/p&gt;&#xA;&lt;p&gt;Turning now to the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; complexity class, noting the fact that FACTORING is both in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt; with witnesses being the factors, and in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; by Shor's algorithm, a conclusion is that FACTORING is &lt;em&gt;not&lt;/em&gt; likely to be (promise) &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;-complete.  If FACTORING were complete for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; then, for example, &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}\subseteq\mathsf{NP}$&lt;/span&gt;, which may be ruled out by the recent breakthrough of &lt;a href=&quot;https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Raz and Tal&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus it may be natural to ask:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What is stopping FACTORING from being complete for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;GRAPH-ISOMORPHISM can be generalized/altered to SUBGRAPH-ISOMORPHISM, which is &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete. Can FACTORING be generalized or altered in any way such that it is complete for &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;, in much the same way that SUBGRAPH-ISOMORPHISM generalizes GRAPH-ISOMORPHISM to be &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NP}$&lt;/span&gt;-complete?&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-03-14T01:22:21.900" LastActivityDate="2021-03-14T01:22:21.900" Title="What is stopping FACTORING from being BQP-complete?" Tags="&lt;complexity-theory&gt;&lt;shors-algorithm&gt;&lt;bqp&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15380" PostTypeId="2" ParentId="15378" CreationDate="2021-01-02T17:58:27.340" Score="3" Body="&lt;p&gt;You can pretty easily prove by counting that specifying a stabilizer operation or a stabilizer state requires &lt;span class=&quot;math-container&quot;&gt;$\Omega(n^2)$&lt;/span&gt; bits. If you're not tracking some of those bits, your simulator is definitely wrong. So clearly tracking one generator or ten generators (&lt;span class=&quot;math-container&quot;&gt;$\Theta(n)$&lt;/span&gt; bits) is not enough. The tricky trouble then is that for certain gates we don't know how to avoid looking at the majority of the bits to simulate that gate.&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Improved Simulation of Stabilizer Circuits&amp;quot; by Aaronson and Gottesman&lt;/a&gt;, only measurements require &lt;span class=&quot;math-container&quot;&gt;$\Theta(n^2)$&lt;/span&gt; operations. CNOT, H, and S use &lt;span class=&quot;math-container&quot;&gt;$\Theta(n)$&lt;/span&gt; operations. In fact, although they don't do it in that paper, I'm pretty sure only the measurements with random results truly require &lt;span class=&quot;math-container&quot;&gt;$\Theta(n^2)$&lt;/span&gt; operations. I believe measurement being expensive is also the case in more recent papers. For example, in &lt;a href=&quot;https://arxiv.org/abs/1808.00128&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Simulation of quantum circuits by low-rank stabilizer decompositions&amp;quot; by Bravyi and others&lt;/a&gt;, everything is linear cost except measurement and Hadamards being quadratic.&lt;/p&gt;&#xA;&lt;p&gt;I don't know of a proof that &lt;span class=&quot;math-container&quot;&gt;$\Omega(n^2)$&lt;/span&gt; operations are &lt;em&gt;required&lt;/em&gt; to simulate at least one of the stabilizer gates. But to me it appears that the basic obstacle is that measurements that are individually random can form groups with deterministic parity. The problem of finding these parity groups looks extremely similar to the problem of doing a partial Gaussian elimination of a boolean matrix (with measuring all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits corresponding to a full elimination). Gaussian elimination of an &lt;span class=&quot;math-container&quot;&gt;$n \times n$&lt;/span&gt; matrix &lt;a href=&quot;https://crypto.stackexchange.com/questions/83659/complexity-of-gaussian-elimination-over-a-finite-field&quot;&gt;apparently requires &lt;span class=&quot;math-container&quot;&gt;$\tilde{\Omega}(n^3)$&lt;/span&gt; operations&lt;/a&gt;, which suggests some of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; measurements have to cost &lt;span class=&quot;math-container&quot;&gt;$\Omega(n^2)$&lt;/span&gt;. That being said, I don't know how to turn this intuition into a proper reduction proof that reduces a Gaussian elimination problem into a stabilizer circuit simulation problem in a way that makes the Gaussian elimination run faster than &lt;span class=&quot;math-container&quot;&gt;$\tilde{\Omega}(n^3)$&lt;/span&gt; if the stabilizer simulation outperforms &lt;span class=&quot;math-container&quot;&gt;$\tilde{\Omega}(n^2)$&lt;/span&gt; per measurement.&lt;/p&gt;&#xA;&lt;p&gt;It's also conceivable that there may be a distinction between online simulations (which must provide measurement results as they are requested) and offline simulations (which can delay returning results, allowing them to e.g. combine measurements into groups in some hypothetical beneficial fashion). Also, when you want multiple samples from a circuit, you may be able to deal with the core quadratic difficulty once overall instead of once per sample. Oh, and there are contexts in error correction where you can simulate a noisy circuit while only tracking whether or not measurements are &lt;em&gt;flipped&lt;/em&gt; relative to their (unknown) true value, and these simulations are constant time per operation instead of linear or quadratic.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-01-02T18:05:58.430" LastActivityDate="2021-01-02T18:05:58.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15381" PostTypeId="1" AcceptedAnswerId="15383" CreationDate="2021-01-02T18:31:04.990" Score="6" ViewCount="187" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Square_root_of_a_matrix&quot; rel=&quot;noreferrer&quot;&gt;There exists many different matrices square root&lt;/a&gt;. For instance I can define either of the two for square root of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{X}^{(1)} \equiv \frac{1}{\sqrt{2 i}} \begin{pmatrix} 1 &amp;amp; i \\ i &amp;amp; 1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Or &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;noreferrer&quot;&gt;as suggested on wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{X}^{(2)} \equiv \sqrt{NOT} = \frac{1}{2} \begin{pmatrix} 1+i &amp;amp; 1-i \\ 1-i &amp;amp; 1+i \end{pmatrix} \neq \sqrt{X}^{(1)} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We notice that those two matrices &lt;strong&gt;do not differ by a global phase&lt;/strong&gt;: they really act &lt;em&gt;differently&lt;/em&gt; on quantum state.&lt;/p&gt;&#xA;&lt;p&gt;Now, it is frequent in the litterature to simply see &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Y}$&lt;/span&gt; without further explanations. To be generic I consider &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; a matrix in which I will consider its square root.&lt;/p&gt;&#xA;&lt;p&gt;As long as we do &lt;span class=&quot;math-container&quot;&gt;$\sqrt{M} \sqrt{M}$&lt;/span&gt; whatever the definition taken it doesn't matter. However I if we have calculations involving &lt;span class=&quot;math-container&quot;&gt;$\sqrt{M}$&lt;/span&gt; without having it directly squared, the result might depend on the choice we took for the square root.&lt;/p&gt;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&lt;p&gt;Is there a uniform convention in quantum information to define square root of matrices ? Or more specifically square roots of Pauli ? Or each reference must specify which convention they take ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2021-01-04T00:41:22.013" Title="Square root of Pauli operators: is there a common convention to define them uniquely?" Tags="&lt;quantum-gate&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15382" PostTypeId="2" ParentId="15381" CreationDate="2021-01-02T19:14:40.903" Score="4" Body="&lt;p&gt;Mathematically a natural choice is to take the square root of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Polar_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Polar decomposition&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$A=UP$&lt;/span&gt;. Recalling that any complex matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$UP$&lt;/span&gt; for unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and positive-semidefinite matrix &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. The polar decomposition is unique so &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; has a unique well-defined square root as a positive hermitian matrix. As the convention here is to take the square root of the positive real eigenvalues, which gives a unique square root matrix &lt;span class=&quot;math-container&quot;&gt;$P^\tfrac{1}{2}$&lt;/span&gt; (up to change of basis of course). As for the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, its eigenvalues are all of the form &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; and so taking the square root takes them all to &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, in quantum computing &lt;a href=&quot;https://arxiv.org/pdf/1206.5236.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;number theory&lt;/a&gt; starts to come into play. It turns out that depending on your choice of universal gate set it's better to perform your arithmetic (gates) over certain number fields. This means that picking the best square root matrix comes down to finding one in the number field that you are working over, which may not be the one that comes from the approach above. So it really depends on the audience you are trying to reach and the type of work you are doing.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2021-01-02T21:43:09.700" LastActivityDate="2021-01-02T21:43:09.700" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15383" PostTypeId="2" ParentId="15381" CreationDate="2021-01-02T19:54:40.570" Score="3" Body="&lt;p&gt;In Quirk and in Cirq, the convention used is that the +1 eigenvalue square roots into 1 (as opposed to -1) and that the -1 eigenvalue square roots into &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (as opposed to &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;). More generally, you pick some convention for mapping a unitary eigenvalue &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; into an angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$e^{i \theta} = c$&lt;/span&gt;, and then define the gate raised to the power &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; to use the corresponding eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{i p \theta}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, the Z operation decomposes like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix} = (+1) |0\rangle \langle 0| + (-1) |1\rangle \langle 1|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the +1 and the -1 on the right hand side are the eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;Square rooting the operation will square root the eigenvalues. +1 says +1 and -1 becomes &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z} = \sqrt{+1} |0\rangle \langle 0| + \sqrt{-1} |1\rangle \langle 1| = (+1) |0\rangle \langle 0| + (i) |1\rangle \langle 1| = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now let's do &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X = \begin{bmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{bmatrix} = (+1) |+\rangle \langle +| + (-1) |-\rangle \langle -|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{X} = (+1) |+\rangle \langle +| + (i) |-\rangle \langle -| = \begin{bmatrix} 0.5 + 0.5i &amp;amp; 0.5 - 0.5i \\ 0.5 - 0.5i &amp;amp; 0.5 + 0.5i\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And now &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Y = \begin{bmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{bmatrix} = (+1) |i\rangle \langle i| + (-1) |-i\rangle \langle -i|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|i\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle = \frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{Y} = (+1) |i\rangle \langle i| + (i) |-i\rangle \langle -i| = \begin{bmatrix} 0.5 + 0.5i &amp;amp; -0.5 - 0.5i \\ 0.5 + 0.5i &amp;amp; 0.5 + 0.5i\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Another way to end up at the same convention is to start from the convention that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Z} = S = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{bmatrix}$&lt;/span&gt;, extend to other exponents using continuity and &lt;span class=&quot;math-container&quot;&gt;$Z^{a+b} = Z^{a} Z^{b}$&lt;/span&gt;, extend to &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; by declaring that &lt;span class=&quot;math-container&quot;&gt;$X = HZH$&lt;/span&gt; generalizes into &lt;span class=&quot;math-container&quot;&gt;$X^t = H Z^t H$&lt;/span&gt;, and extend to &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; using the right hand rule. Alternatively, you can extend to &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; by defining the &amp;quot;swap Y for Z&amp;quot; operation &lt;span class=&quot;math-container&quot;&gt;$H_{yz} = (Y + Z) / \sqrt{2}$&lt;/span&gt; and declaring &lt;span class=&quot;math-container&quot;&gt;$Y^t = H_{yz} Z^t H_{yz}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-01-02T19:59:51.257" LastActivityDate="2021-01-02T19:59:51.257" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15384" PostTypeId="1" CreationDate="2021-01-02T19:59:45.200" Score="1" ViewCount="49" Body="&lt;p&gt;The third order autocorrelation is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\bar g^{(3)} = \frac{\langle \hat a^\dagger \hat a^\dagger\hat a^\dagger \hat a\hat a\hat a\rangle}{\bar n^3}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How is this quantity measured in quantum optics, and how can it be interpreted in terms of probabilities?&lt;/p&gt;&#xA;&lt;p&gt;What happens to this value, if we consider a monomode field coherent&#xA;state, a Fock state, or a thermal state?&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/em&gt;****************&lt;/p&gt;&#xA;&lt;p&gt;For measuring this quantity in quantum optics, we need 3 detectors and we need it for processes where we are interested in the possibility to have three photons at the same time. And g3 is proportional to &amp;lt;n(n-1)(n-2)&amp;gt; with n the operator&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="13548" LastEditDate="2021-01-12T21:08:04.437" LastActivityDate="2021-01-12T21:08:04.437" Title="How is the third-order autocorrelation measured in quantum optics?" Tags="&lt;quantum-state&gt;&lt;correlations&gt;&lt;quantum-optics&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15385" PostTypeId="1" CreationDate="2021-01-02T22:21:50.193" Score="5" ViewCount="56" Body="&lt;p&gt;It seems like there are a number of &lt;a href=&quot;https://arxiv.org/pdf/1611.09347.pdf&quot; rel=&quot;noreferrer&quot;&gt;different speed-ups&lt;/a&gt; for different machine learning algorithms:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/80eeq.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/80eeq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But has anyone created an algorithm showing speed-up for neural networks? A &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1404/will-deep-learning-neural-networks-run-on-quantum-computers&quot;&gt;similar question&lt;/a&gt; was asked a few years ago, but the answer is not so clear. It seems like it is an &lt;a href=&quot;https://arxiv.org/pdf/1409.3097.pdf&quot; rel=&quot;noreferrer&quot;&gt;open problem&lt;/a&gt; as of 2014, and was interested in knowing if there have been any recent developments that demonstrate speedup.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2021-02-14T20:49:45.930" Title="Are there quantum algorithms demonstrating speedup computing classical neural networks (in 2021)?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15386" PostTypeId="1" CreationDate="2021-01-02T22:31:48.713" Score="4" ViewCount="82" Body="&lt;p&gt;A number of ML algorithms have demonstrated to have &lt;a href=&quot;https://arxiv.org/pdf/1611.09347.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;polynomial speed-up&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w6k3C.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w6k3C.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But this (I'm assuming) is without error correcting qubits. How practical are algorithms that only exhibit polynomial speed-up when error correction is taken into account? For example, will we need millions and millions of qubits to be able to even compete with modern computers?&lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2021-02-14T06:38:29.433" Title="Are applications with only polynomial speedup worth chasing after? (since error correction adds a heavy overhead)" Tags="&lt;algorithm&gt;&lt;error-correction&gt;&lt;grovers-algorithm&gt;&lt;speedup&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15387" PostTypeId="1" CreationDate="2021-01-03T00:29:56.903" Score="1" ViewCount="75" Body="&lt;p&gt;I'm running a set of quantum circuits using the &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;. However, sometimes my code works for the simulation, but sometimes it doesn't, and the system shows me the following message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I don't know why am I always getting this error. My Python version is 3.7.8, is there a way I can fix this issue? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-01-05T10:58:36.780" LastActivityDate="2021-01-05T10:58:36.780" Title="How can I fix the BrokenProcessPool error in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="0" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15388" PostTypeId="2" ParentId="15328" CreationDate="2021-01-03T00:31:48.467" Score="2" Body="&lt;p&gt;I'm not sure of the formal answer to your question, but for simulation purposes, this approach worked for me:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a function that scales a matrix down by its largest eigenvalue if this eigenvalue is greater than &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. This is so QPEs &amp;quot;angle truncation&amp;quot; doesn't cause HHL to output an incorrect answer.&lt;/li&gt;&#xA;&lt;li&gt;Scale the input matrix A by the constant returned by this function.&lt;/li&gt;&#xA;&lt;li&gt;Perform HHL&lt;/li&gt;&#xA;&lt;li&gt;Scale up the output vector by the same constant and return the result.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&lt;p&gt;To extract the unnormalized vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\left| x \right\rangle$&lt;/span&gt; (a normalized quantum state) you would have to do full state tomography, which is a bigger problem than extracting the normalization constant. To extract the normalization constant, notice in the HHL paper that the normalization constant that we do not know &amp;quot;pops out&amp;quot; after measuring an ancilla qubit in a success basis state. So to &lt;span class=&quot;math-container&quot;&gt;$\textit{estimate}$&lt;/span&gt; the normalization we could do HHL over and over again and take the number of times we measure success on the ancilla qubit divided by the total number of runs. Alternatively, we know the vector &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is normalized to make &lt;span class=&quot;math-container&quot;&gt;$\left| b \right\rangle$&lt;/span&gt; and we know this normalization constant. Then &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; is applied to &lt;span class=&quot;math-container&quot;&gt;$\left| b \right\rangle$&lt;/span&gt;, during which, the known normalization constant is multiplied by another constant that is unknown. These constants together make up the overall normalization constant.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-01-14T06:20:25.823" LastActivityDate="2021-01-14T06:20:25.823" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15389" PostTypeId="2" ParentId="15369" CreationDate="2021-01-03T03:19:41.933" Score="4" Body="&lt;p&gt;&lt;strong&gt;Extending the relationship between &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; to higher dimensions&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The analogy for understanding single-qubit gates in terms of &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; is provided by an &lt;a href=&quot;https://en.wikipedia.org/wiki/Exceptional_isomorphism&quot; rel=&quot;nofollow noreferrer&quot;&gt;accidental isomorphism&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$Spin(3)\cong SU(2)$&lt;/span&gt; where the &lt;a href=&quot;https://en.wikipedia.org/wiki/Spin_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;spin group&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$Spin(n)$&lt;/span&gt; is the double cover of &lt;span class=&quot;math-container&quot;&gt;$SO(n)$&lt;/span&gt;. As the name suggests, the isomorphism is not part of a recurring pattern, so the answer to the first question is negative in general.&lt;/p&gt;&#xA;&lt;p&gt;However, &lt;span class=&quot;math-container&quot;&gt;$Spin(3)\cong SU(2)$&lt;/span&gt; isn't the only accidental isomorphism. Other interesting examples include &lt;span class=&quot;math-container&quot;&gt;$Spin(4) \cong SU(2) \times SU(2)$&lt;/span&gt; which is related to the fact any 4D real rotation can be described by two quaternions (one acting by left-multiplication and the other by right-multiplication) and &lt;span class=&quot;math-container&quot;&gt;$Spin(6) \cong SU(4)$&lt;/span&gt; (see &lt;a href=&quot;https://math.stackexchange.com/questions/2985224/the-map-from-su4-to-so6/2985598#2985598&quot;&gt;this answer&lt;/a&gt; for details of this isomorphism). Nevertheless, real rotations in 4D and 6D are not as intuitive as those in 2D and 3D. A better approach to gaining intuitive understanding of multi-qubit gates is implicit in the second question: identify an interesting type of gate which is easier to describe.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;General remark about understanding unitary gates as rotations&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A key realization that aids in understanding quantum gates in terms of rotations is that all operators in &lt;span class=&quot;math-container&quot;&gt;$SU(n)$&lt;/span&gt; can be diagonalized in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt;, but a generic element of &lt;span class=&quot;math-container&quot;&gt;$SO(n)$&lt;/span&gt; cannot be diagonalized in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^n$&lt;/span&gt;. A geometric consequence of this fact is that a generic element of &lt;span class=&quot;math-container&quot;&gt;$SO(n)$&lt;/span&gt; changes direction of some basis vectors. By contrast, in the appropriate basis the action of a unitary operator is the multiplication of all vector components by various scalar phase factors. In a sense, the action of the operator is decomposed into 2D rotations in the field of complex numbers.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Origin of the &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; angle in the formula for SWAP&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Perhaps the most familiar example of a unitary gate understood via its counterpart in &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt; is the single-qubit rotation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{\hat n}(\alpha) = \exp\left(-i\frac{\alpha}{2}(n_x X + n_y Y + n_z Z)\right) = I\cos\frac{\alpha}{2} -i (n_x X + n_y Y + n_z Z)\sin\frac{\alpha}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\hat n = (n_x, n_y, n_z)$&lt;/span&gt; is a real 3-vector of unit length. This can be generalized as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(i\frac{\beta}{2} A\right) = I \cos\frac{\beta}{2} + i A \sin\frac{\beta}{2}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\beta\in\mathbb{R}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is a matrix such that &lt;span class=&quot;math-container&quot;&gt;$A^2 = I$&lt;/span&gt; (see exercise 4.2. on p.175 in section 4.2 of Nielsen &amp;amp; Chuang). This formula has the benefit of making it clear which values of the angle &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; correspond to the identity and to the unitary &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, before we write the SWAP gate in the form of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; let us first generalize it to a single-parameter group&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}(\theta) = \exp\left(i \frac{\theta}{4} (XX + YY + ZZ)\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately, the naive attempt of writing the gate as &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; by setting &lt;span class=&quot;math-container&quot;&gt;$A = XX + YY + ZZ$&lt;/span&gt; fails because as we see from the multiplication table&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|ccc}&#xA; &amp;amp; XX &amp;amp; YY &amp;amp; ZZ\\&#xA;\hline&#xA;XX &amp;amp; II &amp;amp; -ZZ &amp;amp; -YY\\&#xA;YY &amp;amp; -ZZ &amp;amp; II &amp;amp; -XX\\&#xA;ZZ &amp;amp; -YY &amp;amp; -XX &amp;amp; II&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;the non-identity terms in &lt;span class=&quot;math-container&quot;&gt;$(XX + YY + ZZ)^2$&lt;/span&gt; do not cancel. However, since the global phase has no physical meaning, we can multiply any unitary matrix by a phase factor without changing the corresponding quantum gate. In our case, we multiply by &lt;span class=&quot;math-container&quot;&gt;$\exp\left(i\frac{\theta}{4}\right)$&lt;/span&gt; to obtain&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}(\theta) = \exp\left(i \frac{\theta}{4} (II + XX + YY + ZZ)\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with exponent that squares to a multiple of identity as can be seen from the new multiplication table&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|cccc}&#xA; &amp;amp; II &amp;amp; XX &amp;amp; YY &amp;amp; ZZ\\&#xA;\hline&#xA;II &amp;amp; II &amp;amp; XX &amp;amp; YY &amp;amp; ZZ\\&#xA;XX &amp;amp; XX &amp;amp; II &amp;amp; -ZZ &amp;amp; -YY\\&#xA;YY &amp;amp; YY &amp;amp; -ZZ &amp;amp; II &amp;amp; -XX\\&#xA;ZZ &amp;amp; ZZ &amp;amp; -YY &amp;amp; -XX &amp;amp; II&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The table shows that &lt;span class=&quot;math-container&quot;&gt;$(II + XX + YY + ZZ)^2 = 4II$&lt;/span&gt; and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}(\theta) = II \cos\frac{\theta}{2} + i \frac{II + XX + YY + ZZ}{2} \sin\frac{\theta}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This explains why &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; is divided by &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; in the exponential formula given in the question. One factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; normalizes &lt;span class=&quot;math-container&quot;&gt;$II + XX + YY + ZZ$&lt;/span&gt; and the other factor of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; comes from formula &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. Consequently, &lt;span class=&quot;math-container&quot;&gt;$\text{SWAP}(\theta)$&lt;/span&gt; behaves analogously to &lt;span class=&quot;math-container&quot;&gt;$R_{\hat n}(\alpha)$&lt;/span&gt;: rotation by &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$-I$&lt;/span&gt; and a rotation by &lt;span class=&quot;math-container&quot;&gt;$4\pi$&lt;/span&gt; returns to &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, just as expected from the &amp;quot;belt trick&amp;quot;. Note however that the full SWAP takes place for &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta=3\pi$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;. This is analogous to how the full bit-flip is effected by &lt;span class=&quot;math-container&quot;&gt;$R_X(\alpha)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\alpha=\pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Limited application of the Bloch sphere to multi-qubit gates&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another way of understanding gates in terms of rotations is available when the gate in question acts non-trivially on a subspace of dimension two. In this case, we can use the Bloch sphere to get a limited intuitive picture of the action of the gate. For example, &lt;span class=&quot;math-container&quot;&gt;$\text{SWAP}(\theta)$&lt;/span&gt; can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{SWAP}(\theta) = \begin{pmatrix}&#xA;e^{i\frac{\theta}{2}} &amp;amp; &amp;amp; &amp;amp; \\&#xA;  &amp;amp; \cos\frac{\theta}{2} &amp;amp; i\sin\frac{\theta}{2} &amp;amp; \\&#xA;  &amp;amp; i\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2} &amp;amp; \\&#xA;  &amp;amp; &amp;amp; &amp;amp; e^{i\frac{\theta}{2}} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we recognize the middle &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block as &lt;span class=&quot;math-container&quot;&gt;$R_X(-\theta) \in SU(2)$&lt;/span&gt;. In other words, if we relabel the North Pole of the Bloch sphere to &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and the South Pole to &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; then the action of &lt;span class=&quot;math-container&quot;&gt;$\text{SWAP}(\theta)$&lt;/span&gt; on the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|01\rangle, |10\rangle)$&lt;/span&gt; subspace is the same as the action of &lt;span class=&quot;math-container&quot;&gt;$R_X(-\theta)$&lt;/span&gt; on a qubit. Note however, that this interpretation ignores the change in relative phase imparted by the gate between &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|01\rangle, |10\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|00\rangle, |11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-03T03:19:41.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15390" PostTypeId="1" AcceptedAnswerId="15392" CreationDate="2021-01-03T03:32:20.223" Score="3" ViewCount="49" Body="&lt;p&gt;I am attempting to use Grover's to find elements in an array that satisfy a comparative query (=, &amp;lt;, &amp;gt;, etc). I am using Qiskit, and am using a qRAM to encode my array.&lt;/p&gt;&#xA;&lt;p&gt;I have experimented with several quantum comparators, all of which seem to be working well offline (i.e. they indeed produce 1 when the query is satisfied). I settled for the &lt;code&gt;IntegerComparator&lt;/code&gt; present in Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;Things start getting weird once I inject my comparator into the oracle of my algorithm. For the array is &lt;span class=&quot;math-container&quot;&gt;$[7,6,5,4,3,2,1,0]$&lt;/span&gt;, the following happens when testing the query &lt;span class=&quot;math-container&quot;&gt;$&amp;lt; n$&lt;/span&gt; for some predetermined &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The algorithm produces sensible results for &lt;span class=&quot;math-container&quot;&gt;$n \in \{0, 1, 2,3\}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n = 4$&lt;/span&gt;, the algorithm doesn't produce any conclusive solutions.&lt;/li&gt;&#xA;&lt;li&gt;For &lt;span class=&quot;math-container&quot;&gt;$n \in \{5,6,7\}$&lt;/span&gt;, it produces answers the &lt;span class=&quot;math-container&quot;&gt;$\geq n$&lt;/span&gt; instead!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Analogous behavior was observed for &lt;span class=&quot;math-container&quot;&gt;$&amp;gt; n$&lt;/span&gt;. The algorithm works perfectly for the query &lt;span class=&quot;math-container&quot;&gt;$==n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I have been debugging this for several days, and I can't seem to figure it out. I highly appreciate any kind of help.&lt;/p&gt;&#xA;&lt;p&gt;This is the high level design of my algorithm:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gEXM7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gEXM7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14326" LastEditorUserId="55" LastEditDate="2021-01-05T10:59:06.600" LastActivityDate="2021-01-05T10:59:06.600" Title="Weird Grover's Algorithm Behavior" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15391" PostTypeId="1" CreationDate="2021-01-03T05:22:03.123" Score="5" ViewCount="76" Body="&lt;p&gt;In the &lt;a href=&quot;http://arxiv.org/pdf/1411.4028.pdf&quot; rel=&quot;noreferrer&quot;&gt;QAOA paper&lt;/a&gt;, it is shown that the optimal value of the p-ansatz &lt;span class=&quot;math-container&quot;&gt;$M_p$&lt;/span&gt; converges to &lt;span class=&quot;math-container&quot;&gt;$\max_z C(z)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$p \rightarrow \infty$&lt;/span&gt; on page 10. The proof is to relate to QAOA by considering the time-dependent Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(t) = (1 − t/T)B + (t/T)C$&lt;/span&gt;, which I don't follow.&lt;/p&gt;&#xA;&lt;p&gt;First, I guess the QAOA paper is to use the Trotterization to approximate &lt;span class=&quot;math-container&quot;&gt;$e^{-i H(t)}$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$e^{-i \beta B}e^{-i \gamma C}\cdots e^{-i \beta B}e^{-i \gamma C}$&lt;/span&gt;. But this approximation is only for a &lt;span class=&quot;math-container&quot;&gt;${\bf fixed}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, right? So how can this Trotterized approximation be close to &lt;span class=&quot;math-container&quot;&gt;$e^{-i C}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Second, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; has many eigenstates, and why should the state &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; with the largest value of &lt;span class=&quot;math-container&quot;&gt;$C(z)$&lt;/span&gt; be returned?&lt;/p&gt;&#xA;" OwnerUserId="14084" LastEditorUserId="9006" LastEditDate="2021-01-03T07:37:36.707" LastActivityDate="2021-01-03T22:52:23.970" Title="Why QAOA with $p \rightarrow \infty $ gives the optimal solution?" Tags="&lt;hamiltonian-simulation&gt;&lt;optimization&gt;&lt;qaoa&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15392" PostTypeId="2" ParentId="15390" CreationDate="2021-01-03T07:28:27.043" Score="2" Body="&lt;p&gt;I don't think it's an issue with the algorithm implementation (though I haven't checked the circuit in detail), but rather a typical behavior of Grover's algorithm. The algorithm analysis that tells you the number of iterations that need to be done based on the size of the search space &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and the number of solutions to your problem &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; assumes that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is much smaller than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Once &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; grows to be large enough, the algorithm starts to misbehave.&lt;/p&gt;&#xA;&lt;p&gt;In your case, &lt;span class=&quot;math-container&quot;&gt;$N = 8$&lt;/span&gt;, and when you set &lt;span class=&quot;math-container&quot;&gt;$n = 4$&lt;/span&gt; for your query, you have &lt;span class=&quot;math-container&quot;&gt;$M = 4 = \frac{N}{2}$&lt;/span&gt; solutions to the search problem. In this case the initial (pre-iteration) probability of obtaining a solution is &lt;span class=&quot;math-container&quot;&gt;$\frac{M}{N} = 0.5$&lt;/span&gt;, and each Grover's iteration leaves it unchanged, so effectively you're always drawing from a uniform distribution.&lt;/p&gt;&#xA;&lt;p&gt;When you set &lt;span class=&quot;math-container&quot;&gt;$n = 5$&lt;/span&gt; or more, you have &lt;span class=&quot;math-container&quot;&gt;$M &amp;gt; \frac{N}{2}$&lt;/span&gt;, and your oracle which marks all elements that are less than &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; differs from an oracle that marks all elements greater than or equal to &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; only by a global phase of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. Grover's algorithm is not sensitive to this global phase, so it amplifies the probability of the less probable group of outcomes - in this case the probability of getting a &lt;em&gt;non-solution&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can read more about this in Nielsen and Chuang, section 6.1.4, as quoted in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12790/grovers-algorithm-on-a-database-with-more-than-50-matching-entries&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-01-03T07:28:27.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15393" PostTypeId="2" ParentId="6038" CreationDate="2021-01-03T08:22:41.240" Score="3" Body="&lt;h2&gt;Prohibited device&lt;/h2&gt;&#xA;&lt;p&gt;Such a circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; would enable faster-than-light communication and therefore does not exist.&lt;/p&gt;&#xA;&lt;p&gt;Suppose Alice and Bob share a Bell pair &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$&lt;/span&gt; and Alice has a classical bit &lt;span class=&quot;math-container&quot;&gt;$b \in \{0, 1\}$&lt;/span&gt; she wishes to communicate to Bob. She proceeds as follows. If &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; Alice measures her half of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt; basis. Otherwise, she measures it in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle, |-\rangle$&lt;/span&gt; basis. Note that for any single-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$(U \otimes U)|\psi\rangle = (\det U)|\psi\rangle$&lt;/span&gt;, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle) = \frac{1}{\sqrt{2}}(|{-+}\rangle - |{+-}\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, after the measurement, if &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; then the Bell pair is in the state &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, otherwise it is in the state &lt;span class=&quot;math-container&quot;&gt;$|{-+}\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|{+-}\rangle$&lt;/span&gt;. In order to receive &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, Bob uses &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; to compute the fidelity between his half of the shared Bell pair and the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; the circuit outputs &lt;span class=&quot;math-container&quot;&gt;$F(|0\rangle, |0\rangle) = 1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$F(|0\rangle, |1\rangle) = 0$&lt;/span&gt;. Otherwise the circuit outputs &lt;span class=&quot;math-container&quot;&gt;$F(|0\rangle, |+\rangle) = F(|0\rangle, |-\rangle) = \frac{1}{2}$&lt;/span&gt;. No classical communication is used in the protocol and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is transmitted instantaneously. Therefore, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; does not exist.&lt;/p&gt;&#xA;&lt;p&gt;A more rigorous proof that distinguishing non-orthogonal quantum states is impossible is in Box 2.3 on p.87 in section 2.2.4 in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;&lt;h2&gt;Allowed device&lt;/h2&gt;&#xA;&lt;p&gt;However, there is a quantum circuit that given &lt;span class=&quot;math-container&quot;&gt;$O(4^n)$&lt;/span&gt; copies of two &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit mixed states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; estimates &lt;span class=&quot;math-container&quot;&gt;$F(\rho, \sigma)$&lt;/span&gt;. The circuit first performs quantum state tomography on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; to estimate the two density matrices and then computes an estimate of fidelity using the formula &lt;span class=&quot;math-container&quot;&gt;$\left(\mathrm{tr}\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right)^2$&lt;/span&gt;. The last step is possible, because quantum circuits subsume classical computers.&lt;/p&gt;&#xA;&lt;p&gt;In practice, the cost of fidelity estimation is smaller than the cost of full state tomography, especially if we have additional knowledge about one of the states, see for example &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15562/10480&quot;&gt;this answer&lt;/a&gt; or &lt;a href=&quot;https://arxiv.org/abs/1104.4695&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;No faster-than-light communication with allowed device&lt;/h2&gt;&#xA;&lt;p&gt;It is interesting to consider why the second device does not allow faster-than-light communication. The reason is that due to random outcomes of measurements Bob detects the maximally mixed state regardless of &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Specifically, if &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; he receives&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{2}\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&#xA;\end{pmatrix} + \frac{1}{2}\begin{pmatrix}&#xA;0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix} = \frac{1}{2}\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt; he receives&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{4}\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; 1&#xA;\end{pmatrix} + \frac{1}{4}\begin{pmatrix}&#xA;1 &amp;amp; -1 \\&#xA;-1 &amp;amp; 1&#xA;\end{pmatrix} = \frac{1}{2}\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-18T01:32:07.200" LastActivityDate="2021-01-18T01:32:07.200" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15394" PostTypeId="2" ParentId="1265" CreationDate="2021-01-03T14:51:41.333" Score="0" Body="&lt;p&gt;What if using only &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt N)$&lt;/span&gt; queries of oracle? Note that the sorted sequence is minimum or maximum, so we can use the way in &lt;a href=&quot;http://arxiv.org/pdf/quant-ph/9607014.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;: to find the minimum or maximum, the time complexity is &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt N)$&lt;/span&gt; query of the oracle.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastActivityDate="2021-01-03T14:51:41.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15395" PostTypeId="1" AcceptedAnswerId="15398" CreationDate="2021-01-03T18:06:00.567" Score="3" ViewCount="769" Body="&lt;p&gt;Or alternatively phrased, is it believed that the complexity class &lt;strong&gt;P&lt;/strong&gt; is a complete subset of &lt;strong&gt;BQP&lt;/strong&gt;?&#xA;Consider the following diagram à la &lt;a href=&quot;https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-845-quantum-complexity-theory-fall-2010/&quot; rel=&quot;nofollow noreferrer&quot;&gt;MIT OpenCourseWare&lt;/a&gt;, which seems to explicitly state as much.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cvwuv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cvwuv.png&quot; alt=&quot;Complexity Zoo - MIT OpenCourseWare&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14333" LastEditorUserId="10480" LastEditDate="2021-01-04T13:27:50.890" LastActivityDate="2021-01-22T05:29:55.470" Title="Do there exist problems known to be computationally intractable for quantum computer, but tractable for classical computer?" Tags="&lt;complexity-theory&gt;&lt;bqp&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15396" PostTypeId="2" ParentId="15395" CreationDate="2021-01-03T18:21:15.567" Score="2" Body="&lt;p&gt;I would think that if a problem is tractable on a classical computer then it is tractable on a quantum computer as any classical circuit can be replaced by an equivalent circuit containing only reversible gates with little overhead and thus can be simulated on a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;You can look at Mike and Ike &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Quantum Computation and Quantum Information&amp;quot;&lt;/a&gt; section 1.4.1, 'Classical Computations on a quantum computer' for more details.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="10480" LastEditDate="2021-01-22T05:29:55.470" LastActivityDate="2021-01-22T05:29:55.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15397" PostTypeId="2" ParentId="14969" CreationDate="2021-01-03T19:03:44.710" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/phase-kickback.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Qiskit text&lt;/a&gt; has a section on this that you may find useful.&lt;/p&gt;&#xA;&lt;p&gt;For something more &amp;quot;academic&amp;quot; &lt;a href=&quot;https://www.google.com/books/edition/Quantum_Computer_Science/q2S9APxFdUQC?hl=en&amp;amp;gbpv=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mermin&lt;/a&gt; Sections 4.2-4.5, &lt;a href=&quot;https://www.google.com/books/edition/Supervised_Learning_with_Quantum_Compute/1zpsDwAAQBAJ?hl=en&amp;amp;gbpv=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schuld and Petruccione&lt;/a&gt; Sections 3.5.1-3.5.3, or &lt;a href=&quot;https://books.google.com/books/about/Quantum_Computation_and_Quantum_Informat.html?id=65FqEKQOfP8C&quot; rel=&quot;nofollow noreferrer&quot;&gt;Nielson and Chuang&lt;/a&gt; Sections 6.1-6.2 may have what you're looking for.&lt;/p&gt;&#xA;&lt;p&gt;Schuld and Petruccione also have references at the end of each chapter, which could be worth looking into.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-01-03T19:32:51.140" LastActivityDate="2021-01-03T19:32:51.140" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15398" PostTypeId="2" ParentId="15395" CreationDate="2021-01-03T20:42:57.177" Score="9" Body="&lt;p&gt;It is indeed true that &lt;span class=&quot;math-container&quot;&gt;$P \subset BQP$&lt;/span&gt; and so any problem solvable on a classical computer is solvable on a quantum computer.&lt;/p&gt;&#xA;&lt;h2&gt;Physics intuition&lt;/h2&gt;&#xA;&lt;p&gt;The physics intuition behind &lt;span class=&quot;math-container&quot;&gt;$P \subset BQP$&lt;/span&gt; is based on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Correspondence_principle&quot; rel=&quot;noreferrer&quot;&gt;correspondence principle&lt;/a&gt; which says that under suitable conditions quantum mechanics reproduces classical physics. The principle is grounded in the common sense observation that most of the time macroscopic world behaves classically despite being fundamentally quantum mechanical at the microscopic level. Therefore, any classical computer can be viewed as a quantum system and thus simulated by a quantum computer to any accuracy with reasonable overhead.&lt;/p&gt;&#xA;&lt;h2&gt;Computer science argument&lt;/h2&gt;&#xA;&lt;p&gt;A more rigorous argument is provided by computer science and consists of two parts. First, we establish that any classical computation can be performed reversibly. Second, we establish that any reversible classical computation can performed on a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;Any classical computation can be viewed as a function &lt;span class=&quot;math-container&quot;&gt;$f: \{0, 1\}^n \to \{0, 1\}^m$&lt;/span&gt;. Each component &lt;span class=&quot;math-container&quot;&gt;$f_i$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1,2,\dots,m$&lt;/span&gt; is a boolean function for which we can write down the &lt;a href=&quot;https://en.wikipedia.org/wiki/Truth_table&quot; rel=&quot;noreferrer&quot;&gt;truth table&lt;/a&gt;. Given the truth tables we can build a classical circuit consisting of the AND, OR and NOT gates that computes &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. Now, AND, OR and NOT gates can all be implemented using the NAND gate. Thus, NAND gate is &lt;a href=&quot;https://en.wikipedia.org/wiki/NAND_logic#Making_other_gates_by_using_NAND_gates&quot; rel=&quot;noreferrer&quot;&gt;universal&lt;/a&gt; for classical computation.&lt;/p&gt;&#xA;&lt;p&gt;Next, we prove that any classical computation can be done reversibly. This follows from the fact that the NAND gate - which is not reversible - can be implemented reversibly using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate&quot; rel=&quot;noreferrer&quot;&gt;Toffoli&lt;/a&gt; gate. This is done by setting the control bits of the Toffoli gate to the inputs of the NAND gate and by setting Toffoli's target bit to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Fully rigorous argument also shows that the overhead incurred by &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncomputation&quot; rel=&quot;noreferrer&quot;&gt;uncomputation&lt;/a&gt; is polynomial.&lt;/p&gt;&#xA;&lt;p&gt;Finally, quantum computer can implement the classical Toffoli gate using the quantum Toffoli gate. In essence, the quantum computer simulates the classical computater using only computational basis states such as &lt;span class=&quot;math-container&quot;&gt;$|01011\dots0\rangle$&lt;/span&gt; without ever entering in superposition. Each such state directly corresponds to the state of a classical binary register.&lt;/p&gt;&#xA;&lt;h2&gt;Practicality&lt;/h2&gt;&#xA;&lt;p&gt;Quantum computers lack the benefit of decades of improvements that have made classical computers very fast. Moreover, quantum computers require error correction which incurs significant time and space overhead and indeed requires a fast classical computer running alongside the quantum device. Therefore, in practice quantum computers are very unlikely to be competitive with classical computers on classically tractable problems. Consequently, quantum computers are likely to remain special-purpose devices for solving problems for which quantum mechanics offers exponential speed-up that overcomes the overheads of quantum error correction.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-03T20:42:57.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15399" PostTypeId="2" ParentId="15391" CreationDate="2021-01-03T22:52:23.970" Score="3" Body="&lt;p&gt;The Quantum Approximate Optimization Algorithm is closely related to the Quantum Adiabatic Algorithm. Let's say we have a simple Hamiltonian (in our case &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt;) with a known ground state and another Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;, whose ground state we want to calculate. Consider the time-dependent Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H(t) = \left(1-\frac{t}{T}\right)H_B(t) + \frac{t}{T} H_C&#xA;\end{equation}&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt; the system is described by &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; while for &lt;span class=&quot;math-container&quot;&gt;$t=T$&lt;/span&gt; it is described by &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;adiabatic theorem&lt;/em&gt; states that if we start in the ground state of &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; and slowly start to increase &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; up to time &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, then throughout the process the system will always remain in the ground state of &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt;, which means that at the end of the evolution the system will be in the ground state of &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The Trotterization is defined as :&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;e^{A+B} = lim_{n \rightarrow \infty} \left(e^{\frac{A}{n}}e^{\frac{B}{n}}\right)^n&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now consider the time evolution of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U(t) = e^{iH(t)t}$&lt;/span&gt;. It is straightforward to see the why in the limit of &lt;span class=&quot;math-container&quot;&gt;$p\rightarrow \infty$&lt;/span&gt; you get an approximation ratio of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Quantum Approximate Optimization Algorithm can be seen as truncated version of QAA. That is, we choose up to what layers we wish to make the Trotterization, but that comes with a cost. It is instance dependent what approximation ratio you will get for fixed layers and it is always smaller that &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Our goal is to make it as large as possible!&lt;/p&gt;&#xA;&lt;p&gt;As for the second part of the question, it is NOT always the eigenstate of &lt;span class=&quot;math-container&quot;&gt;$C(z)$&lt;/span&gt; with the largest value returned and that is the reason why you are aiming for a big approximation value. If it close to 1, the expectation value is concentrated near the optimal value and you will get most of the times the desired bitstring.&lt;/p&gt;&#xA;" OwnerUserId="12408" LastActivityDate="2021-01-03T22:52:23.970" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15400" PostTypeId="2" ParentId="15381" CreationDate="2021-01-04T00:41:22.013" Score="2" Body="&lt;p&gt;You can also characterise the full set of (normal) square roots of a normal matrix via its eigendecomposition. Let &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}A=\sum_k \lambda_k \ketbra{\lambda_k}$&lt;/span&gt; be a matrix with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_k\in\mathbb C$&lt;/span&gt; and eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|\lambda_k\rangle$&lt;/span&gt;.&#xA;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt A = \sum_k \sqrt{\lambda_k} \ketbra{\lambda_k}.$$&lt;/span&gt;&#xA;You should now notice that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\lambda_k}$&lt;/span&gt; are &lt;em&gt;not&lt;/em&gt; uniquely defined (cue the usual considerations of complex analysis). Different choices of square roots for the eigenalues correspond to (potentially) different square roots of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As an example, consider &lt;span class=&quot;math-container&quot;&gt;$A=X$&lt;/span&gt; (the Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix). You have &lt;span class=&quot;math-container&quot;&gt;$X=\ketbra+-\ketbra-$&lt;/span&gt;, and therefore the four possible normal square roots&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt X = \pm\ketbra+ \pm i\ketbra-.$$&lt;/span&gt;&#xA;One can then choose any convention to decide which root to take.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-01-04T00:41:22.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15402" PostTypeId="1" CreationDate="2021-01-04T07:27:47.860" Score="3" ViewCount="78" Body="&lt;p&gt;I've been reading Peter Wittek's &lt;a href=&quot;https://www.researchgate.net/publication/264825604_Quantum_Machine_Learning_What_Quantum_Computing_Means_to_Data_Mining&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Machine Learning&lt;/a&gt;. In chapter 10.2 of this book, the author explains how we can calculate the dot product of two states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;To evaluate the dot product of two training instances, we need to do the following&#xA;(Lloyd et al., 2013a):&lt;br /&gt;&#xA;● Generate two states, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, with an ancilla variable;&lt;br /&gt;&#xA;● Estimate the parameter Z = &lt;span class=&quot;math-container&quot;&gt;$\|x_i\|^2$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\|x_j\|^2$&lt;/span&gt;, the sum of the squared norms of the two instances;&lt;br /&gt;&#xA;● Perform a projective measurement on the ancilla alone, comparing the two states.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The author further goes on explaining the process:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Z times the probability of the success of the measurement yields the square of the Euclidean distance between the two training instances: &lt;span class=&quot;math-container&quot;&gt;$\|x_i - x_j\|^2$&lt;/span&gt;. We calculate the dot product in the linear kernel as &lt;span class=&quot;math-container&quot;&gt;$x_i^Tx_j = \frac{Z-\|x_i-x_j\|^2}{2}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I am not sure what does 'success of measurement' means in this context. From my understanding, we first need to estimate Z (which is done while preparing &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle$&lt;/span&gt;) and then using the prepared states, along with an ancilla, we measure the distance(?) between the two training instances by using a swap test on the above-prepared state. Just for reference, the states are:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \frac{|0\rangle|x_i\rangle + |1\rangle|x_j\rangle}{\sqrt 2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi \rangle = \frac{\|x_i\| |0\rangle - \|x_j\| |1\rangle}{Z}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="55" LastEditDate="2021-01-05T11:26:59.347" LastActivityDate="2021-01-05T11:26:59.347" Title="Calculating Dot Product of Two States" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;machine-learning&gt;&lt;inner-product&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15403" PostTypeId="1" AcceptedAnswerId="15405" CreationDate="2021-01-04T07:39:27.777" Score="-1" ViewCount="131" Body="&lt;p&gt;Find a &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_H$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$e^{iH_H}$&lt;/span&gt; equals the Hadamard matrix and a &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_{CNOT}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$e^{-iH_{CNOT}}$&lt;/span&gt; equals the matrix of the CNOT gate.&lt;/p&gt;&#xA;&lt;p&gt;I have been trying to solve this but couldn't come to any conclusion. Any help would be really appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13798" LastEditorUserId="10480" LastEditDate="2021-01-05T17:32:59.047" LastActivityDate="2021-01-05T17:32:59.047" Title="What Hamiltonians generate Hadamard and CNOT?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2021-01-06T02:17:22.273" ContentLicense="CC BY-SA 4.0" />
  <row Id="15404" PostTypeId="1" AcceptedAnswerId="15406" CreationDate="2021-01-04T08:32:57.300" Score="1" ViewCount="55" Body="&lt;p&gt;Suppose you have a quantum state &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt; consisting of &lt;span class=&quot;math-container&quot;&gt;$m + n$&lt;/span&gt; qubits, and you set up a measurement that measures the first &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits in the standard basis. What are the matrices in the corresponding POVM?&lt;/p&gt;&#xA;" OwnerUserId="13798" LastEditorUserId="55" LastEditDate="2021-01-05T11:29:26.190" LastActivityDate="2021-01-05T11:29:26.190" Title="What are the matrices in the POVM for measuring the first $m$ qubits?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15405" PostTypeId="2" ParentId="15403" CreationDate="2021-01-04T08:54:50.573" Score="3" Body="&lt;p&gt;Let us denote Hadamard with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and the two Hamiltonians as &lt;span class=&quot;math-container&quot;&gt;$H_H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_{CNOT}$&lt;/span&gt;, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \exp (-iH_H) \\&#xA;CNOT = \exp (-iH_{CNOT}).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We will make use of the fact that for any normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with eigendecomposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_i \lambda_i |i\rangle\langle i|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and for any analytic function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, we can compute &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt; by applying it to eigenvalues&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(A) = \sum_i f(\lambda_i) |i\rangle\langle i|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Hadamard&lt;/h2&gt;&#xA;&lt;p&gt;Hadamard has zero trace and determinant &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, so its eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;. Therefore, we can write it as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;H &amp;amp;= |a\rangle\langle a| - |b\rangle\langle b| \\&#xA;&amp;amp;= e^0 |a\rangle\langle a| + e^{-i\pi} |b\rangle\langle b| \\&#xA;&amp;amp;= \exp \left (-i\pi |b\rangle\langle b|\right)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_H = \pi |b\rangle\langle b|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; is the normalized eigenvector of Hadamard associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Controlled-NOT&lt;/h2&gt;&#xA;&lt;p&gt;CNOT leaves &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; states unchanged, so these are two eigenvectors associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Also, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X = |+\rangle\langle +| - |-\rangle\langle -|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;CNOT &amp;amp;= |00\rangle\langle 00| + |01\rangle\langle 01| + |{1+}\rangle\langle{1+}| - |{1-}\rangle\langle{1-}| \\&#xA;&amp;amp; = e^0|00\rangle\langle 00| + e^0|01\rangle\langle 01| + e^0|{1+}\rangle\langle{1+}| + e^{-i\pi}|{1-}\rangle\langle{1-}| \\&#xA;&amp;amp; = \exp(-i\pi |{1-}\rangle\langle{1-}|)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{CNOT} = \pi |{1-}\rangle\langle{1-}|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-04T09:11:53.617" LastActivityDate="2021-01-04T09:11:53.617" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15406" PostTypeId="2" ParentId="15404" CreationDate="2021-01-04T09:03:58.440" Score="3" Body="&lt;p&gt;Well, since these are projective measurements on the subspace of the first &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits, we can just list all projectors on the computational basis of this first subspace and 'pad' them with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;'s on the second subspace:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_{j} = |j\rangle\langle j|_{m} \otimes I_{|n|},\,\,\, \forall j \in \{0,1\}^{m},&#xA;$$&lt;/span&gt;&#xA;which gives exactly &lt;span class=&quot;math-container&quot;&gt;$|\{0,1\}^{m}| = 2^{m}$&lt;/span&gt; different operators for the POVM.&#xA;If you identify distinct measurement outcomes with every operator, say &lt;span class=&quot;math-container&quot;&gt;$\lambda_{j} = j_{d}$&lt;/span&gt; (e.g. &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; in decimal form), you can easily write down a measurement operator as well:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = \sum_{j} \lambda_{j}P_{j} = \sum_{j} j_{d}|j\rangle \langle j \otimes I_{n}|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;See also, for instance, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13398/8141&quot;&gt;this nice answer&lt;/a&gt; by Daftwullie for a different measurement operator. Note that that answer omits the extra subspace of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, but you can just treat that by padding with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;'s again.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-01-04T09:03:58.440" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15407" PostTypeId="1" CreationDate="2021-01-04T10:06:58.343" Score="3" ViewCount="121" Body="&lt;p&gt;A pure state is separable (unentangled) if it can be written as a tensor product of states of each qubit.&lt;/p&gt;&#xA;&lt;p&gt;A mixed state is separable, if it can be written as a probability distribution over separable pure states.&lt;/p&gt;&#xA;&lt;p&gt;Consider the mixed state which is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt; with the probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle+|10\rangle)$&lt;/span&gt; with the probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How to show that this mixed state is separable?&lt;/p&gt;&#xA;" OwnerUserId="13798" LastEditorUserId="55" LastEditDate="2021-01-05T11:31:09.967" LastActivityDate="2021-01-05T11:31:09.967" Title="How to show that a given mixed two-qubit state is separable?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ClosedDate="2021-01-08T13:42:51.097" ContentLicense="CC BY-SA 4.0" />
  <row Id="15410" PostTypeId="2" ParentId="15376" CreationDate="2021-01-04T14:39:21.343" Score="1" Body="&lt;p&gt;&lt;strong&gt;This is how I understand exercise 9.6  from the &lt;a href=&quot;https://books.google.am/books?hl=en&amp;amp;lr=&amp;amp;id=bDXwFHJNKFAC&amp;amp;oi=fnd&amp;amp;pg=PR5&amp;amp;dq=Quantum+Computing+Explained&amp;amp;ots=ivkK2xiFIZ&amp;amp;sig=BOpwIxQPYOj0c4I1D2ZvhYadda0&amp;amp;redir_esc=y#v=onepage&amp;amp;q=Quantum%20Computing%20Explained&amp;amp;f=false&quot; rel=&quot;nofollow noreferrer&quot;&gt;book&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Firstly note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|1_H\rangle =  |0\rangle - |1\rangle + |2\rangle -|3\rangle = \sum_{y = 0}^{d-1} (-1)^{y}|y\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so let's write &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; in a slightly different way:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi'\rangle = H_d \otimes H_d |01 \rangle =  \sum_{x,y=0}^{d-1} (-1)^{y} |x\rangle |y \rangle = \sum_{x}^{d-1} |x\rangle |1_H \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here I drop the normalization factors (&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;) like in the book. Also I assume that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is a binary function &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;, and when we have this definition for &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_f |x,y\rangle = |x,y \oplus f(x)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_f |\psi'\rangle = \sum_{x}^{d-1} |x\rangle |1_H \oplus f(x)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|1_H \oplus f(x)\rangle = |1_H \rangle$&lt;/span&gt; and if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$|1_H \oplus f(x)\rangle = -|1_H \rangle$&lt;/span&gt;, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_f |\psi'\rangle = \Big( \sum_{x=0}^{d-1}(-1)^{f(x)} |x\rangle \Big) |1_H \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Here I have a difference with the book. In the book instead of &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(x)}$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x}$&lt;/span&gt; that I guess is a typo in the exercise&lt;/strong&gt;. If &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is constant then it can be proved that either &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; always with the given definition for the constant functions and by taking into account my assumption that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is a binary function. So in the constant case:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U_f |\psi'\rangle = \Big( \sum_{x=0}^{d-1}(-1)^{f(x)} |x\rangle \Big) |1 \rangle_H = \pm\Big( \sum_{x=0}^{d-1} |x\rangle \Big) |1_H \rangle = \pm |0_H\rangle |1_H\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if we will apply an &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; on the first qudit &lt;span class=&quot;math-container&quot;&gt;$H_d|0_d\rangle = |0\rangle$&lt;/span&gt; we will always obtain &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If it's a balanced function with the given definition and the assumption that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is a binary function it can be proved that in the half cases (2) &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt; and in the other half cases (2) &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{x=0}^{d-1}(-1)^{f(x)} |x\rangle = \pm |1_H\rangle \text{ or } \pm |2_H\rangle \text{ or } \pm |3_H\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In all cases if we will apply &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt; we will never obtain &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; after the measurement, so the measurement will indicate that we had a balanced function. Here I have used the definition from the exercise for &lt;span class=&quot;math-container&quot;&gt;$H_d$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_d |x\rangle = \frac{1}{\sqrt{d}}\sum_{y = 0}^{d-1} (-1)^{x \cdot y} |y\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And hence &lt;span class=&quot;math-container&quot;&gt;$H_d^2|j\rangle = H_d |j_H\rangle = |j\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$j \in \{0,1,2,3\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the end the author writes that &lt;em&gt;&amp;quot;Finally, apply qudit Hadamard gates to the first set of qudits&amp;quot;&lt;/em&gt; and I don't see from where in the exercise the first qudit became qudit&lt;strong&gt;S&lt;/strong&gt;, but I imagine that it can be generalized in a similar fashion to the multiple input qudit case.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2021-01-04T16:02:09.553" LastActivityDate="2021-01-04T16:02:09.553" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15411" PostTypeId="2" ParentId="2004" CreationDate="2021-01-04T15:39:48.620" Score="0" Body="&lt;p&gt;I can't comment on previous answers but I would like to comment on the BHT.&lt;/p&gt;&#xA;&lt;p&gt;You first choose &lt;span class=&quot;math-container&quot;&gt;$n^{1/3}$&lt;/span&gt; inputs. Check for collison there.&#xA;If there's no collision, than as Wikipedia says, all f values are distinct.&#xA;Now you know there're &lt;span class=&quot;math-container&quot;&gt;$n^{1/3}$&lt;/span&gt; inputs that are pairs to those you first chose and weren't tested.&lt;/p&gt;&#xA;&lt;p&gt;How many do you have to sample to get a collision? by randomly sampling an input from the &lt;span class=&quot;math-container&quot;&gt;$n-n^{1/3}$&lt;/span&gt; not tested inputs, you get chances of &lt;span class=&quot;math-container&quot;&gt;$\frac{n^{1/3}}{n}$&lt;/span&gt; to find collision.&lt;/p&gt;&#xA;&lt;p&gt;If you sample &lt;span class=&quot;math-container&quot;&gt;$n^{2/3}$&lt;/span&gt; inputs you get that with constant probability you find a collision.&#xA;Use Grover to make a speedup to &lt;span class=&quot;math-container&quot;&gt;$n^{1/3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A more formal solution will be to think of how many iterations Grover algorithm takes when you have a promise that &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; of the &amp;quot;oracle elements&amp;quot; are 1 (and not 1 only which is the worst case). When computing the number of iteration we use the initial angle between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (defined later) and you can see the relation to &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ A = \frac{1}{\sqrt n} \sum_{i\in[n]} |i&amp;gt; $&lt;/span&gt; (super position on all possible inputs)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ B = {\frac{1}{\sqrt K}} \sum_{i \in [n] \land O_i=1} |i&amp;gt; $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14379" LastEditorUserId="14379" LastEditDate="2021-01-07T10:11:32.690" LastActivityDate="2021-01-07T10:11:32.690" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15412" PostTypeId="1" CreationDate="2021-01-04T16:37:41.733" Score="3" ViewCount="30" Body="&lt;p&gt;Montanaro A. 2015 &lt;a href=&quot;https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.2015.0301&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum speedup of Monte Carlo methods&lt;/a&gt; makes the following claim of an algorithm to estimate the mean output &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; of an arbitrary algorithm A, with near-quadratic speedup over classical methods:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;An  important  aspect  of  this  construction  is  that  the&#xA;underlying  subroutine need  not  be a  classical  randomized&#xA;procedure,  but  can  itself  be  a  quantum  algorithm.  This&#xA;enables  any quantum  speedup  obtained  by A to  be  used  within  the&#xA;overall  framework  of  the  algorithm&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So, a few questions relating to nesting quantum algorithms in this way:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Does this statement also hold for previous algorithms of this type such as Brassard's algorithm for computing the mean of A?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does this statement hold for Grover search and hence quantum computation of minimum also?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Does this statement hold for the quadratic quantum improvements on Markov chain Monte Carlo algorithms presented later in the Montanaro paper?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5174" LastActivityDate="2021-01-04T16:37:41.733" Title="Is it possible to nest quantum Markov chain Monte Carlo, mean and minimum algorithms?" Tags="&lt;grovers-algorithm&gt;&lt;amplitude-amplification&gt;&lt;quantum-walks&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15413" PostTypeId="2" ParentId="15407" CreationDate="2021-01-04T18:23:49.857" Score="4" Body="&lt;p&gt;Begin by writing down the density matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho_{AB} &amp;amp;= \frac{1}{4}\left[(|00\rangle+|11\rangle)(\langle00|+\langle11|)\right] + \frac{1}{4}\left[(|01\rangle+|10\rangle)(\langle01|+\langle0|)\right] \\&#xA;&amp;amp;=\frac{1}{4}\left(\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix} + \begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}\right) \\&#xA;&amp;amp;= \frac{1}{4}\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At this stage we already see that &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; satisfies the &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peres–Horodecki criterion&lt;/a&gt;: if we transpose all four &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; blocks then we obtain&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I \otimes T)\rho_{AB} = \frac{1}{4}\begin{pmatrix}&#xA;\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix}^T &amp;amp; \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}^T \\&#xA;\begin{pmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}^T &amp;amp; \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix}^T \\&#xA;\end{pmatrix} = \frac{1}{4}\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix} = \rho_{AB}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is a state. In case of two qubit (and qubit-qutrit) pairs the criterion is both necessary and sufficient, so &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is separable.&lt;/p&gt;&#xA;&lt;p&gt;Note that for larger systems, the criterion is necessary, but not sufficient.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In this case, it is also not too difficult to see how &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; may be expressed as a convex combination of product states&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho_{AB} &amp;amp;= \frac{1}{4}\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix} \\&#xA;&amp;amp;= \frac{1}{8}\begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1&#xA;\end{pmatrix} + \frac{1}{8}\begin{pmatrix}&#xA;1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1 \\&#xA;-1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -1 \\&#xA;-1 &amp;amp; 1 &amp;amp; 1 &amp;amp; -1 \\&#xA;1 &amp;amp; -1 &amp;amp; -1 &amp;amp; 1&#xA;\end{pmatrix} \\&#xA;&amp;amp;= \frac{1}{2}\left(|+\rangle\langle+| \otimes |+\rangle\langle+| \,+\, |-\rangle\langle-| \otimes |-\rangle\langle-|\right).&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-04T18:23:49.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15415" PostTypeId="1" AcceptedAnswerId="15422" CreationDate="2021-01-04T21:42:02.203" Score="6" ViewCount="115" Body="&lt;p&gt;Circuits consisting entirely of Clifford operations in &lt;span class=&quot;math-container&quot;&gt;$\{X, Y, Z, H, S, \text{CNOT} \}$&lt;/span&gt; are &amp;quot;easy&amp;quot; to simulate classically since there is a method that can fully compute such circuits over &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits with &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; complexity.&lt;/p&gt;&#xA;&lt;p&gt;I'm curious if circuits that are &lt;em&gt;almost&lt;/em&gt; entirely Clifford operations can be shown to approach some lower complexity&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; with respect to some &lt;em&gt;continuous&lt;/em&gt; parameter that dictates how non-Clifford that circuit is. This is different than some work (e.g. &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.116.250501&quot; rel=&quot;noreferrer&quot;&gt;Bravyi and Gosset&lt;/a&gt;) that has shown efficient simulation methods when a small number of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gates are inserted into an otherwise Clifford circuit.&lt;/p&gt;&#xA;&lt;p&gt;For example, suppose I have a circuit consisting entirely of Clifford operations but has a set of &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}^x$&lt;/span&gt; gates. Can I show either of the following?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;The complexity of simulating this circuit continuously approaches some asymptotically lower function in the limit that &lt;span class=&quot;math-container&quot;&gt;$x\rightarrow 0$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the distribution over results from my almost-Clifford circuit and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; is the distribution over results from the corresponding Clifford circuit taking &lt;span class=&quot;math-container&quot;&gt;$x=0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$d(p, q) \leq \epsilon$&lt;/span&gt; for some small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; and some choice of statistical distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. Of course this would also depend on the number of parameterized &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt;'s occurring in the circuit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If no such behavior exists - i.e. my circuit is generally &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; complexity even for infinitesmal &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; - why not?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; This lower limit doesn't need to be &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt;. Instead of a stabilizer based simulation I could instead use tensor-based simulation for which there is still a large speedup for computing &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; compared to &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}^x$&lt;/span&gt;. It seems like this might be more approachable to show something like (1) since the Clifford simulation techniques I'm aware of simply don't generalize to the non-integer &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; case.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-01-07T09:28:51.190" Title="Are almost-Clifford circuits almost easy to simulate?" Tags="&lt;simulation&gt;&lt;complexity-theory&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15416" PostTypeId="1" CreationDate="2021-01-05T02:30:16.220" Score="3" ViewCount="122" Body="&lt;p&gt;I try to apply QAOA algorithm to find minimal energy state of the Hamiltonian:&#xA;&lt;span class=&quot;math-container&quot;&gt;$H_A = \frac{1}{2}\sigma_z^1 + \frac{1}{2}\sigma_z^1\sigma_z^2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is expected that with p=2 my  variational should satisfy the eigenstate of the smallest eigenvalue.&#xA;The problem is that something went wrong in my code and I cannot find mistake.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister&#xA;from qiskit.aqua.operators import WeightedPauliOperator&#xA;from qiskit.aqua.operators.state_fns import CircuitStateFn&#xA;from qiskit.aqua.algorithms import NumPyEigensolver&#xA;#from qiskit import BasicAer, execute&#xA;from qiskit import Aer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.operators import PauliExpectation, CircuitSampler, StateFn&#xA;import itertools&#xA;import math&#xA;import matplotlib.pyplot as plt&#xA;from matplotlib import cm&#xA;import numpy as np&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ H_B $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def prepare_Hb(a,b):&#xA;  pauli_dict = {&#xA;    'paulis': [&#xA;               {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: a}, &amp;quot;label&amp;quot;: &amp;quot;XI&amp;quot;},&#xA;               {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: b}, &amp;quot;label&amp;quot;: &amp;quot;IX&amp;quot;}&#xA;              ]}&#xA;  return WeightedPauliOperator.from_dict(pauli_dict)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$H_A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def prepare_Ha(a, b):enter preformatted text here    &#xA;pauli_dict = {&#xA;    'paulis': [&#xA;               {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: a}, &amp;quot;label&amp;quot;: &amp;quot;ZI&amp;quot;},&#xA;               {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0.0, &amp;quot;real&amp;quot;: b}, &amp;quot;label&amp;quot;: &amp;quot;ZZ&amp;quot;},&#xA;              ]&#xA;}&#xA;return WeightedPauliOperator.from_dict(pauli_dict)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Ansatz&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def add_ansatz_layer(circuit, gamma, beta):&#xA;    q = circuit.qregs[0]&#xA;    circuit = add_U_Ha(circuit, gamma)&#xA;    circuit = add_U_Hb(circuit, beta)&#xA;    return circuit&#xA;&#xA;def ansatz(arr_gamma, arr_beta):&#xA;    &#xA;    p = len(arr_gamma)&#xA;      &#xA;    q = QuantumRegister(2)&#xA;    circuit = QuantumCircuit(q)&#xA;    &#xA;    # quantum state preparation&#xA;    circuit.h(q[0])&#xA;    circuit.h(q[1])&#xA;    &#xA;    &#xA;    for ind in range(p):&#xA;        circuit = add_ansatz_layer(circuit, arr_gamma[ind], arr_beta[ind])&#xA;    return circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Expectation calculation&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def expectation(ansatz,Hamiltonian):&#xA;    H_operator = Hamiltonian.to_opflow()&#xA;    psi = CircuitStateFn(ansatz)&#xA;   &#xA;    backend = Aer.get_backend('qasm_simulator') &#xA;    q_instance = QuantumInstance(backend, shots=1024)&#xA;&#xA;    measurable_expression = StateFn(H_operator, is_measurement=True).compose(psi) &#xA;    expectation = PauliExpectation().convert(measurable_expression)  &#xA;    sampler = CircuitSampler(q_instance).convert(expectation) &#xA;&#xA;    # evaluate&#xA;    result = sampler.eval().real&#xA;    &#xA;    return result&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;def evaluation2(variables,p=1):&#xA;    if p not in [1,2]:&#xA;        print(&amp;quot;Invalid p&amp;quot;)&#xA;        return&#xA;    if len(variables) != 2:&#xA;        variables = [[variables[0],variables[1]],[variables[2],variables[3]]]&#xA;   &#xA;    gamma = variables[0]&#xA;    beta  = variables[1]&#xA;    #print(variables,'-----')&#xA;    if p != 2:&#xA;        gamma = [gamma]&#xA;        beta = [beta]&#xA;    Ha = prepare_Ha(0.5, 0.5)&#xA;    test = ansatz(gamma,beta)&#xA;    &#xA;    res = expectation(test, Ha)&#xA;    return res&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;1)Compute the expectation value of the energy &lt;span class=&quot;math-container&quot;&gt;$ &amp;lt;\gamma,\:\beta\:|\:H\:|\:\gamma,\:\beta\:&amp;gt; $&lt;/span&gt;  and plot it as a function of the variational parameters &lt;span class=&quot;math-container&quot;&gt;$ \gamma  $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \beta   $&lt;/span&gt; ;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gamma = np.arange(-np.pi, np.pi, 0.05)&#xA;beta = np.arange(-np.pi, np.pi, 0.05)&#xA;func = np.zeros( (gamma.size, beta.size) )&#xA;print(gamma.shape, beta.shape)&#xA;counter_y = 0&#xA;&#xA;for j in beta:&#xA;    counter_x = 0&#xA;    for i in gamma:&#xA;        func[counter_x, counter_y] = evaluation2([i,j],1)&#xA;        counter_x += 1&#xA;    counter_y += 1&#xA;&#xA;X, Y = np.meshgrid(beta, gamma)&#xA;&#xA;fig = plt.figure(figsize=(15,15))&#xA;ax = fig.gca(projection='3d')&#xA;#ax = fig.add_subplot(111, projection = '3d')&#xA;ax.plot_surface(X, Y, func, cmap=cm.coolwarm,&#xA;                       linewidth=0, antialiased=False)&#xA;&#xA;plt.xlabel('gamma')&#xA;plt.ylabel('beta')&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/X3ErK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/X3ErK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;2)Minimize the energy. What are the optimal angles ∗&#xA;, ∗&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; bound_g1 = (0,np.pi)&#xA;bound_b1 = (0,np.pi)&#xA;initial_guess = (0, np.pi/2)&#xA;result = optimize.minimize(evaluation2,  x0=initial_guess , bounds=[bound_g1,bound_b1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;em&gt;3)Compute the variational state obtained for the optimal angles &lt;span class=&quot;math-container&quot;&gt;$ |\:\gamma\ast,\:\beta\ast&amp;gt; $&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_opt = ansatz([opt_angles[0]],[opt_angles[1]])&#xA;circuit_opt.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gn56i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gn56i.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;4)Compute the success probability &lt;span class=&quot;math-container&quot;&gt;$ |&amp;lt;1,0|\:\gamma\ast,\:\beta\ast&amp;gt;|^2 $&lt;/span&gt;;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# one-zero state&#xA;q10 = QuantumRegister(2)&#xA;one_zero_circuit = QuantumCircuit(q10)&#xA;one_zero_circuit.x(q10[0])&#xA;one_zero_state = CircuitStateFn(one_zero_circuit)&#xA;psi = CircuitStateFn(circuit_opt)&#xA;result = (abs(one_zero_state.adjoint().compose(psi).eval()))**2&#xA;print('Probability =',result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Answer: &lt;strong&gt;Probability = 0.24999999175977444&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;5)Show numerically that with p=2 a success probability of 100% is obtained.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;#Gradient based optimization&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;initial_guess = (np.pi, 0, 0, 0)&#xA;bound_g1 = (0,np.pi)&#xA;bound_g2 = (0,np.pi)&#xA;bound_b1 = (0,np.pi)&#xA;bound_b2 = (0,np.pi)&#xA;result = optimize.minimize(evaluation2,  x0=initial_guess, args=(2), bounds=[bound_g1,bound_g2,bound_b1,bound_b2])&#xA;opt_angles_p2 = result.x&#xA;&#xA;'''&#xA;# Annealing&#xA;import scipy.optimize as spo&#xA;initial_guess = (np.pi, 0, 0, 0)&#xA;anneal_solution = spo.dual_annealing(evaluation2, x0=initial_guess, maxiter = 100, args=(2,), bounds=[bound_g1,bound_g2,bound_b1,bound_b2])&#xA;#print(anneal_solution)&#xA;opt_angles_p2 = anneal_solution.x&#xA;print(opt_angles_p2)&#xA;'''&#xA;&#xA;opt_g1 = opt_angles_p2[0]&#xA;opt_g2 = opt_angles_p2[1]&#xA;opt_b1 = opt_angles_p2[2]&#xA;opt_b2 = opt_angles_p2[3]&#xA;circuit_opt_p2 = ansatz([opt_g1 ,opt_g2],[opt_b1 ,opt_b2])&#xA;circuit_opt_p2.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/n35ju.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/n35ju.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;chi = CircuitStateFn(circuit_opt_p2)&#xA;result = (abs(one_zero_state.adjoint().compose(chi).eval()))**2&#xA;print('Probability =',result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Answer: &lt;strong&gt;Probability = 0.2500000000000261&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The graph in 1) seems to be strange&lt;/p&gt;&#xA;&lt;p&gt;In 2)and 5) minimization doesn't work. Minimizer returns initial guess.&lt;/p&gt;&#xA;&lt;p&gt;It is expected 100% success probability in 5) but I got 25% and even worse.&lt;/p&gt;&#xA;&lt;p&gt;Any help would be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14161" LastEditorUserId="14161" LastEditDate="2021-01-06T17:33:12.867" LastActivityDate="2021-01-06T17:33:12.867" Title="Implemented QAOA returns wrong result" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15417" PostTypeId="1" CreationDate="2021-01-05T02:47:02.577" Score="0" ViewCount="74" Body="&lt;p&gt;I have implemented Shor's algorithm in Qiskit, and everything works as expected within the IBM Q experience for both the IBM qasm_simulator and real hardware. However, after I've implemented Shors in both Q# and within Braket and attempt to run on either local simulator, the behavior is much more deterministic. On the Q# local simulator, Braket local simulator, Braket managed simulator, and Rigetti Aspen-8 hardware via Braket, however, I get the same results every time. Is this a difference in simulator behavior between IBM and others, or have I messed up somewhere in implementation? Any help would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14019" LastEditorUserId="55" LastEditDate="2021-01-06T15:05:16.713" LastActivityDate="2021-02-05T15:05:40.410" Title="Braket and Q# Simulators" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;q#&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15419" PostTypeId="1" CreationDate="2021-01-05T04:37:36.630" Score="7" ViewCount="115" Body="&lt;p&gt;From this &lt;a href=&quot;https://arxiv.org/abs/2011.04149&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt; (provided by @KAJ226's comment in this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15386/are-applications-with-only-polynomial-speedup-worth-chasing-after-since-error&quot;&gt;question&lt;/a&gt;), it appears as though current error correction methods are not enough to get practical speedup out of algorithms that have quadratic speedups (before taking error correction into account).&lt;/p&gt;&#xA;&lt;p&gt;In another post, I showed a chart of speedups of different machine learning algorithms. All of these algorithms do not have quartic or higher speedups (and therefore will not be practical with error correction).&lt;/p&gt;&#xA;&lt;p&gt;Is there a list of practical algorithms that have quartic or higher speedup? I found one such list called the &lt;a href=&quot;https://quantumalgorithmzoo.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum zoo&lt;/a&gt;, but it only provides if a given algorithm is &amp;quot;polynomial&amp;quot; or &amp;quot;superpolynomial.&amp;quot; Also it doesn't seem very up-to-date and the impact or practicality of these algorithms is not mentioned (a lot of these seem useless or are very vague).&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="55" LastEditDate="2021-01-06T15:34:52.207" LastActivityDate="2021-01-10T16:04:24.103" Title="List of practical quantum computing algorithms that have speed-up higher than quadratic speed-up?" Tags="&lt;algorithm&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15420" PostTypeId="2" ParentId="15417" CreationDate="2021-01-05T05:22:33.480" Score="0" Body="&lt;p&gt;If you always get the same answer that means the algorithm is running correctly every time, which indeed is the case for simulators that don't incorporate noise characteristics.&lt;/p&gt;&#xA;&lt;p&gt;One way to check if your system simulates noise is to do a simple program that applies a sequence of effective identity (&lt;em&gt;I&lt;/em&gt;) operators with increasing amounts; so for example, in pseudocode:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// Initialize the qubit in the 1 state&#xA;X(qubit)&#xA;// Artificially wait for time t = numGates * gate time&#xA;for (numGates in 1..10) {&#xA;    for (iteration in 1..numGates) {&#xA;        // Apply an effective I gate&#xA;        X(qubit);&#xA;        X(qubit);&#xA;    }&#xA;    M(qubit); // Measure the qubit. For a non-noisy simulator, this should always return 1.&#xA;// For a noisy system, this will return 1 for the first iteration, and after that decay to 0.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then measure the qubit and plot the number of gates (times 2 * the X-gate time) on the X axis and the qubit amplitude on the Y axis. If the simulator incorporates noise (and hence qubit decoherence), it will look like an exponentially decaying function. If not, it will return a constant value of 1.&lt;/p&gt;&#xA;" OwnerUserId="13663" LastActivityDate="2021-01-05T05:22:33.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15421" PostTypeId="2" ParentId="15377" CreationDate="2021-01-05T08:30:11.007" Score="1" Body="&lt;p&gt;Here's a semi-stupid (partial) answer: the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; qubit majority vote codes, which have logical codewords&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0_L\rangle=|0\rangle^{\otimes k},\qquad |1_L\rangle=|1\rangle^{\otimes k}.&#xA;$$&lt;/span&gt;&#xA;Of course, logical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is just &lt;span class=&quot;math-container&quot;&gt;$X^{\otimes k}$&lt;/span&gt;. However, for phase gates, you can apply and logical version of &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; just by applying &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta/k)$&lt;/span&gt; on every qubit. Of course, it's not much use as an error correcting code if you have to protect against phase noise because a single-qubit phase gate is also a logical phase gate.&lt;/p&gt;&#xA;&lt;p&gt;Part of your question asks how you can check for the existence of a non-Clifford transversal gate (or, at least, that is how I interpret your question). As a general rule, I would expect this to come out by construction - you design your code with respect to certain parameters, and if this is the one you're interested in, you've probably built it in by construction. Anyway, perhaps the best starting point is the Eastin-Knill theorem - if you've got a set of transversal operations that only require one more gate to make them universal, that additional gate cannot be implemented in a transversal manner. This tends to rule out a vast array of logical operations that you might search for. For instance, say that I know how to do logical H and X transversally. I want to know what phase gates I might be able to implement. Certainly T is impossible because that would let you implement a continuous set of gates. As would any phase angle that is not a rational multiple of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;. Most other rational fractions of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; are also impossible (off the top of my head, I don't know the exact characterisation, but it may be that the only options open are S, Z and S&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-01-05T08:30:11.007" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15422" PostTypeId="2" ParentId="15415" CreationDate="2021-01-05T17:14:47.727" Score="7" Body="&lt;p&gt;Short answer: Yes, this should be possible. However, the details have to be filled out. The key is to relate this to magic monotones.&lt;/p&gt;&#xA;&lt;p&gt;There has been some development since the 2016 Bravyi-Gosset paper. I think one can use an argumentation based on stabiliser / Clifford extent and the results in the  &lt;a href=&quot;https://quantum-journal.org/papers/q-2019-09-02-181/&quot; rel=&quot;nofollow noreferrer&quot;&gt;BBCCGH paper&lt;/a&gt; from 2019. Similarly, one can also argue for noisy quantum circuits / arbitrary quantum channels using mixed state versions like &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.118.090501&quot; rel=&quot;nofollow noreferrer&quot;&gt;Howard-Campbell&lt;/a&gt;, &lt;a href=&quot;https://royalsocietypublishing.org/doi/10.1098/rspa.2019.0251&quot; rel=&quot;nofollow noreferrer&quot;&gt;Seddon-Campbell&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/2002.06181&quot; rel=&quot;nofollow noreferrer&quot;&gt;Seddon et al.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us focus on a single non-Clifford gate, given by a continuous family &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt; such that (wlog)  &lt;span class=&quot;math-container&quot;&gt;$G(t)\rightarrow \mathbb{I}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t\rightarrow 0$&lt;/span&gt; . Then, expand it as a linear combination of Clifford unitaries:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G(t) = \sum_i a_i(t) C_i,&#xA;$$&lt;/span&gt;&#xA;with coefficients &lt;span class=&quot;math-container&quot;&gt;$a_i(t)\in\mathbb{C}$&lt;/span&gt;. Now, the minimal value of &lt;span class=&quot;math-container&quot;&gt;$\|a(t)\|_1^2$&lt;/span&gt; over all possible decompositions of &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt; is called the &lt;em&gt;Clifford extent&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\xi(G(t))$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose the input to the whole circuit is, say &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and we measure in the computational basis in the end. Using the stabiliser extent method descriped in the mentioned paper (Sec. 2.3.2), it is possible to sample bitstrings &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; which approximate the exact outcome distribution.&#xA;More precisely, for any &lt;span class=&quot;math-container&quot;&gt;$\delta &amp;gt; 0$&lt;/span&gt; there is an algorithm with runtime &lt;span class=&quot;math-container&quot;&gt;$\tilde O(\delta^{-2}\xi(G(t)))$&lt;/span&gt; which samples bitstrings according to a probability distribution &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; which is &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;-close to the exact distribution &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; in total variation distance:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\| p -q \|_1 \leq \delta.&#xA;$$&lt;/span&gt;&#xA;If we have multiple &lt;span class=&quot;math-container&quot;&gt;$G(t)$&lt;/span&gt;, then the number of those enters as an exponent of &lt;span class=&quot;math-container&quot;&gt;$\xi(G(t))$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, it should not be hard to show that &lt;span class=&quot;math-container&quot;&gt;$\xi(G(t))$&lt;/span&gt; depends continously on &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;, in particular &lt;span class=&quot;math-container&quot;&gt;$\xi(G(t))\rightarrow 1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t\rightarrow 0$&lt;/span&gt;. This reduces the complexity to the Clifford case (&lt;em&gt;EDIT: well, almost. As I said, the details have to be filled out.&lt;/em&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-01-07T09:28:51.190" LastActivityDate="2021-01-07T09:28:51.190" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15424" PostTypeId="2" ParentId="14944" CreationDate="2021-01-05T22:22:16.333" Score="1" Body="&lt;p&gt;Yes it is. It's not only on TSP but in most (if not all) NP-hard combinatorial problems.&lt;/p&gt;&#xA;&lt;p&gt;The landscape of the loss-function is highly non-convex and is filled with local minima. That is, starting an optimization from different initial points will lead in different minima. A way to address this problem is with multi-start methods (i.e. start from many different initial points). An interesting paper I've found is this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1905.08768&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1905.08768&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another way for addressing the point is with Reinforcement Learning methods, because even if you stuck in a local minimum, with some small probability you will still explore in the parameter landscape and thus find a better local or a global minimum.&lt;/p&gt;&#xA;" OwnerUserId="12408" LastActivityDate="2021-01-05T22:22:16.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15425" PostTypeId="1" AcceptedAnswerId="15430" CreationDate="2021-01-05T23:17:02.097" Score="1" ViewCount="129" Body="&lt;p&gt;I am looking for an easy-to-use framework for simulating a quantum channel that can accept the desired average fidelity of the channel as input.&lt;/p&gt;&#xA;&lt;p&gt;For example, if I want a channel with 98% average fidelity, I can just call a function like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;new_channel = create_channel(0.98)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, I can pass individual qubits into that channel and get an output, like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;almost_the_same_as_arbitrary_state_1 = new_channel(arbitrary_state_1)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any suggestions? I prefer matlab and python but can work with any language.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;: as outlined in a comment below, this question may have 2 answers, one where:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;the underlying physical process of the channel is unimportant&lt;/li&gt;&#xA;&lt;li&gt;the underlying physical process of the channel is important&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Suggestions on how to implement either one of these from scratch is also much appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="55" LastEditDate="2021-01-06T15:35:16.760" LastActivityDate="2021-01-07T20:07:52.343" Title="Simulate a quantum channel with a certain fidelity" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;quantum-operation&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15427" PostTypeId="1" AcceptedAnswerId="15428" CreationDate="2021-01-06T05:22:04.927" Score="2" ViewCount="65" Body="&lt;p&gt;I was experimenting with quantum circuits in IBM Quantum Experience. I know that the Hadamard gate creates superposition in the qubit, so I created the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9FiBH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9FiBH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, when I looked at the measurement probabilities, it looked like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UDQ0k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UDQ0k.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't think this is supposed to be the case, as superposition distributes the probability of being 0 and 1. When I removed the measurement like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tsOh3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tsOh3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The measurement probability was:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1nlIr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1nlIr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;What is the right way to create superposition? What is the point of the measurement operator?&lt;/p&gt;&#xA;&lt;p&gt;Please excuse me if my questions are obvious, I'm new to quantum computing.&lt;/p&gt;&#xA;" OwnerUserId="14390" LastActivityDate="2021-01-06T07:09:07.593" Title="What's the point of a measurement operator?" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-01-08T13:44:13.407" ContentLicense="CC BY-SA 4.0" />
  <row Id="15428" PostTypeId="2" ParentId="15427" CreationDate="2021-01-06T07:09:07.593" Score="2" Body="&lt;p&gt;It is true that the hadamard gate create the superposition state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; when applied to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and you should see the state collapses to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; upon measurement with 50% probability. That is, you should see something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wYqMQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wYqMQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, if you apply the measurement operator within the Circuit Composer within IBM Quantum Experience, then you might not experience this. That is, you will see that it always collapses to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; instead. However, you can fix this issue by changing the &lt;strong&gt;Simulator seed&lt;/strong&gt; within the composer as commented by @luciano in this related question here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15367/9858&quot;&gt;https://quantumcomputing.stackexchange.com/a/15367/9858&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z6xWy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z6xWy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;By doing this, you will see that the state will collapse to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Another work-around is to port your circuit to Qiskit Code and run it in Jupyter notebook using &lt;code&gt;qasm_simulator&lt;/code&gt;. You can automatically create Qiskit code for your quantum circuit within the composer as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xk8Uq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xk8Uq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Port the above code to Jupyter notebook in IBM Quantum Lab, then execute the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import BasicAer, execute&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots = 1000)&#xA;plot_histogram(job.result().get_counts(), color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will give you the probability plot I shown at the beginning.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-06T07:09:07.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15429" PostTypeId="2" ParentId="15279" CreationDate="2021-01-06T07:20:18.953" Score="1" Body="&lt;p&gt;Just to sort of &amp;quot;talk out&amp;quot; the conceptual difficulty of a &amp;quot;superposition of gates&amp;quot; would be (which was discusssed in a more abstract way by @Adam Zalcman), let's try to conceptually think of an experiment where it would be reasonable to say there's a &amp;quot;superposition of two gate operations.&amp;quot; Consider the following experiment:&lt;/p&gt;&#xA;&lt;p&gt;Our quantum computer first &amp;quot;flips a quantum coin&amp;quot;. It just makes a measurement of the qubit &lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{2}}\Big(|H\rangle+|T\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;if heads &lt;span class=&quot;math-container&quot;&gt;$|H\rangle$&lt;/span&gt;, we rotate state &amp;quot;a&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_a$&lt;/span&gt; with unitary operation &lt;span class=&quot;math-container&quot;&gt;$U_H$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle_a\xrightarrow{U_H} \frac{1}{\sqrt{2}}\Big(|0\rangle_a+|1\rangle_a \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;if tails we do nothing:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle_a\xrightarrow{U_T} |0\rangle_a $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From this we can see that in the quantum computer's perspective we are in a mixed state of 50%  &lt;span class=&quot;math-container&quot;&gt;$U_H|0\rangle_a$&lt;/span&gt; and 50% &lt;span class=&quot;math-container&quot;&gt;$U_T|0\rangle_a$&lt;/span&gt;. But (through the Wigner's friend paradox), our quantum computers state (before we, an external observer, checks it) is in a superposition state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$   U_H|0\rangle_a |F_H\rangle + U_T|0\rangle_a |F_T\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we can see that our quantum computer really is in a superposition of performing two different gate operations.  And in fact, this superpositionness is physical, as I can come up with a  observable Q that can observe nonclassical quantum interference &amp;quot;fringes&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Writing out &lt;span class=&quot;math-container&quot;&gt;$ |\langle Q|\psi\rangle|^2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\langle Q| \frac{1}{\sqrt{2}} \Big(U_H|0\rangle_a |F_H\rangle + U_T|0\rangle_a |F_T\rangle \Big)|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{\sqrt{2}} \Big( \langle  0 | U_H^\dagger \langle F_H | +  \langle 0 | U_T^\dagger \langle F_T| | Q\rangle \Big) |\langle Q| \frac{1}{\sqrt{2}} \Big(U_H|0\rangle_a |F_H\rangle + U_T|0\rangle_a |F_T\rangle \Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ =\frac{1}{2} \Big( \langle  0 | U_H^\dagger \langle F_H || Q\rangle \langle Q| U_H|0\rangle_a |F_H\rangle &#xA;+ \langle 0 | U_T^\dagger \langle F_T| | Q\rangle \langle Q|U_T|0\rangle_a |F_T\rangle&#xA;+ \langle  0 | U_H^\dagger \langle F_H || Q\rangle \langle Q|U_T|0\rangle_a |F_T\rangle &#xA;+ \langle 0 | U_T^\dagger \langle F_T| | Q\rangle \langle Q| U_H|0\rangle_a |F_H\rangle&#xA;\Big)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ =\underbrace{\frac{1}{2} |Q_H|^2&#xA;+ \frac{1}{2}|Q_T|^2}_{\text{Terms via Normal Probability}}&#xA;+ \underbrace{ \frac{1}{2}Q_H^*Q_T&#xA;+  \frac{1}{2}Q_H Q_T^*}_{\text{Quantum Interference Terms}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One important point here is that we don't actually observe these &amp;quot;Quantum interference terms&amp;quot; if we measure in the origional basis of the state. For instance if we make a measurement of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_a |F_H\rangle$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_a |F_T\rangle$&lt;/span&gt;  (assuming &lt;span class=&quot;math-container&quot;&gt;$\langle F_H|F_T\rangle = 0$&lt;/span&gt;), then these quantum terms drop out.&lt;/p&gt;&#xA;&lt;p&gt;So the reality is that this observable Q needs be a projection on a state like &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\Big(|F_T\rangle + |F_H\rangle\Big)$&lt;/span&gt;, which doesn't seem easy. Most likely this will require some kind of interference between the two states of the quantum computer. (You're going to do an interference experiment using the entire quantum computer, measurement devices and gates included??)&lt;/p&gt;&#xA;&lt;p&gt;This to me is the main difficulty with refering to such things as &amp;quot;superpositions of gates.&amp;quot; To get some interesting observable evidence of the &amp;quot;superpositionness&amp;quot; you really need to reference (and interfere) the entire computer as a state when normally we only refer to individual parts of the quantum computer as being in superpositions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;ALSO a different type of answer:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A sort of different interpretation of &amp;quot;superposition of gates&amp;quot; is simply what happens if you have a gate that interacts with a superposition state.&lt;/p&gt;&#xA;&lt;p&gt;For example if you consider the operation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|1\rangle \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle+|1\rangle\Big) \rightarrow |1\rangle \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle-|1\rangle\Big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle+|1\rangle\Big) \rightarrow |0\rangle  \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle+|1\rangle\Big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here you can see that if our gate interacts with a superposition state, in the first qubit, both possiblites happen simultaneously:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\left(\alpha|0\rangle + \beta|1\rangle \right) \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle+|1\rangle\Big) \rightarrow &amp;amp; \alpha |0\rangle  \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle-|1\rangle\Big) \\&#xA;&amp;amp; + \beta |1\rangle  \otimes \frac{1}{\sqrt{2}}\Big(|0\rangle+|1\rangle\Big)&#xA;\end{align}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So I think also here this is, in some sense, a &amp;quot;superposition of gates,&amp;quot; as mentioned by Norbert.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="2660" LastEditDate="2021-01-06T07:41:08.683" LastActivityDate="2021-01-06T07:41:08.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15430" PostTypeId="2" ParentId="15425" CreationDate="2021-01-06T07:32:29.393" Score="3" Body="&lt;p&gt;In the first case, when the details of the physical process do not matter, you can choose any quantum channel type that can achieve your target average fidelity. &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_depolarizing_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Depolarizing channel&lt;/a&gt; may be a good choice.&lt;/p&gt;&#xA;&lt;p&gt;In the second case, you need to know what class of physical processes are acceptable. For example, if you are modeling energy decay, &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_damping_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;amplitude damping channel&lt;/a&gt; may be appropriate. Once you describe the relevant processes as a parametrized quantum channel, then the next step is to identify the parameter values that yield your target average fidelity. In general, this can be done by solving the following equation for parameters &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; of the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_p$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\overline F(\mathcal{E}_p) = F\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is the target fidelity and &lt;span class=&quot;math-container&quot;&gt;$\overline F$&lt;/span&gt; is the average fidelity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\overline F(\mathcal{E}_p) = \int \langle\psi|\mathcal{E}_p(|\psi\rangle\langle\psi|)|\psi\rangle d\psi\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the integral is with respect to the Haar measure normalized so that &lt;span class=&quot;math-container&quot;&gt;$\int d\psi=1$&lt;/span&gt; over the entire state space.&lt;/p&gt;&#xA;&lt;p&gt;In order to illustrate the procedure, we are going to solve &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; for depolarizing channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}_\lambda$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{D}_\lambda(\rho) = \lambda\rho + (1 - \lambda) \frac{I}{N}\tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is a parameter and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; the input quantum state on a &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional Hilbert space. Using &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; we obtain the following expression for the average fidelity of a depolarizing channel&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\overline F(\mathcal{D}_\lambda) &amp;amp;= \int \langle\psi|\left(\lambda|\psi\rangle\langle\psi| + (1 - \lambda) \frac{I}{N}\right)|\psi\rangle d\psi \\&#xA;&amp;amp;= \int \lambda\langle\psi|\psi\rangle\langle\psi|\psi\rangle d\psi + \int (1 - \lambda) \frac{\langle\psi|I|\psi\rangle}{N} d\psi \\&#xA;&amp;amp;= \lambda \int d\psi + (1 - \lambda) \frac{1}{N}\int d\psi \\&#xA;&amp;amp;= \lambda + (1 - \lambda) \frac{1}{N} \\&#xA;&amp;amp;= \frac{N-1}{N}\lambda + \frac{1}{N}&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we used the facts that &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\psi\rangle = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\int d\psi=1$&lt;/span&gt;. Substituting this into &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{N-1}{N}\lambda + \frac{1}{N} = F&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which we solve to get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda = \frac{FN - 1}{N - 1}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, if you are targeting &lt;span class=&quot;math-container&quot;&gt;$98\%$&lt;/span&gt; average fidelity on a qubit (&lt;span class=&quot;math-container&quot;&gt;$N = 2$&lt;/span&gt;) then you can use depolarizing channel with &lt;span class=&quot;math-container&quot;&gt;$\lambda = 0.96$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can implement the channel in software using equation &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt;. For example, in python using numpy arrays to store density matrices&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def make_depolarizing_channel(p: float) -&amp;gt; Callable[[np.ndarray], np.ndarray]:&#xA;&#xA;    def depolarizing_channel(rho: np.ndarray) -&amp;gt; np.ndarray:&#xA;        N = rho.shape[0]&#xA;        return p * rho + (1 - p) * np.eye(N) / N&#xA;&#xA;    return depolarizing_channel&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;p&lt;/code&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-07T20:07:52.343" LastActivityDate="2021-01-07T20:07:52.343" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15431" PostTypeId="1" CreationDate="2021-01-06T08:02:54.760" Score="2" ViewCount="130" Body="&lt;p&gt;I'm trying to get started with Qiskit but the installation process has been horrendous and the official instructions are unusable. The latest python doesnt work with the install instructions at: &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/install.html&lt;/a&gt; (qiskit devs lurking here: can you please update the instructions on the official website or atleast add links to fixes for known issues for novices like me?)&lt;/p&gt;&#xA;&lt;p&gt;qiskit-aer didnt install until I deprecated python to 3.8 for the qiskit env via: conda create -n name_of_my_env python=3.8&lt;/p&gt;&#xA;&lt;p&gt;Then, the jupyter notebook didn't recognize the new environment until I tried: python -m ipykernel install --user --name myenv --display-name &amp;quot;Python (myenv)&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Now, the jupyter notebook in the qiskit env wouldnt connect to the kernel and I'm not sure what to do. The error message I get on the jupyter nb is: A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.&lt;/p&gt;&#xA;&lt;p&gt;I'm not a software engineer and I'm getting tired of poking randomly on the internet for hours with error messages I don't understand.&#xA;Suggestions on how I can get jupyter nb in qiskit env to connect to the kernel? Should I expect more such software nuisance with qiskit?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14392" LastEditorUserId="55" LastEditDate="2021-01-18T20:00:29.273" LastActivityDate="2021-01-19T06:04:42.433" Title="Qiskit installation" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15432" PostTypeId="1" CreationDate="2021-01-06T08:09:05.173" Score="5" ViewCount="140" Body="&lt;p&gt;Suppose I have a quantum error correcting code described by a set of stabilizers. Is there any easy way of checking whether or not it is equivalent to a code constructed using the CSS construction, using local Clifford transformations?&lt;/p&gt;&#xA;" OwnerUserId="14393" LastEditorUserId="10480" LastEditDate="2021-03-26T20:19:51.993" LastActivityDate="2021-03-26T20:19:51.993" Title="CSS Code in disguise" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;fault-tolerance&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15433" PostTypeId="2" ParentId="15432" CreationDate="2021-01-06T19:05:03.523" Score="2" Body="&lt;p&gt;Yes. We will define a procedure for checking whether a given stabilizer code &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/CSS_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;Calderbank-Shor-Steane&lt;/a&gt; (CSS) code using the following&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Theorem.&lt;/strong&gt; Stabilizer code &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a CSS code if and only if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; has transversal CNOT.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof sketch:&lt;/strong&gt; Suppose &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a CSS code on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits with stabilizer &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. We can choose a set of stabilizer generators that splits into the X and Z sectors. In other words, we can select generators so that each is a tensor product of identity and Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-type generators) or identity and Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators (&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type generators). Suppose &lt;span class=&quot;math-container&quot;&gt;$g_x\in S$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-type stabilizer generator and &lt;span class=&quot;math-container&quot;&gt;$g_z\in S$&lt;/span&gt; a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-type stabilizer generator. Then we see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT^{\otimes n} \circ (g_x \otimes I) \circ CNOT^{\otimes n} = g_x \otimes g_x \\&#xA;CNOT^{\otimes n} \circ (I \otimes g_x) \circ CNOT^{\otimes n} = I \otimes g_x \\&#xA;CNOT^{\otimes n} \circ (g_z \otimes I) \circ CNOT^{\otimes n} = g_z \otimes I \\&#xA;CNOT^{\otimes n} \circ (I \otimes g_z) \circ CNOT^{\otimes n} = g_z \otimes g_z&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are all in &lt;span class=&quot;math-container&quot;&gt;$S \times S$&lt;/span&gt;. Therefore, transversal CNOT preserves the code subspace of the encoded control and target qubits.&lt;/p&gt;&#xA;&lt;p&gt;Conversely, write &lt;span class=&quot;math-container&quot;&gt;$g\in S$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$g = g_x g_z$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; is a tensor product of identity and Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators and &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt; is a tensor product of identity and Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators. Calculate that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT^{\otimes n} \circ (g \otimes I) \circ CNOT^{\otimes n} = g \otimes g_x \\&#xA;CNOT^{\otimes n} \circ (I \otimes g) \circ CNOT^{\otimes n} = g_z \otimes g.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, if transversal CNOT preserves the code subspace then &lt;span class=&quot;math-container&quot;&gt;$g_x \in S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g_z \in S$&lt;/span&gt;. Thus, we can split stabilizer generators into the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; sectors, so &lt;span class=&quot;math-container&quot;&gt;$\mathcal{G}$&lt;/span&gt; is a CSS code. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also find the proof on p.16 of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9702029&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. Our procedure for determining whether a given stabilizer code is a CSS code follows the second part of the proof above.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Procedure.&lt;/strong&gt; For every stabilizer generator &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; form the tensor products &lt;span class=&quot;math-container&quot;&gt;$g \otimes I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I \otimes g$&lt;/span&gt; and apply transversal CNOT&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT^{\otimes n} \circ (g \otimes I) \circ CNOT^{\otimes n} = g \otimes g_x \\&#xA;CNOT^{\otimes n} \circ (I \otimes g) \circ CNOT^{\otimes n} = g_z \otimes g.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, verify that &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt; belong to the stabilizer. If for any &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, the corresponding &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt; is not in the stabilizer then the code is not a CSS code. If for every &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, both &lt;span class=&quot;math-container&quot;&gt;$g_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g_z$&lt;/span&gt; are in the stabilizer, then it is a CSS code.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark on results.&lt;/strong&gt; Note that the above procedure not only determines whether or not a stabilizer code is a CSS code, but also finds the stabilizer generators of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; types. These generators determine the two classical codes used in the CSS construction of the code.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark on complexity.&lt;/strong&gt; Note that checking membership in a group specified by &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; generators scales exponentially with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. In practice, stabilizer groups are often small allowing exhaustive search or have symmetries that can be exploited to establish or rule out membership.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example: 5-qubit Shor's code.&lt;/strong&gt; The stabilizer generators are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;g_1 = XZZXI \\&#xA;g_2 = IXZZX \\&#xA;g_3 = XIXZZ \\&#xA;g_4 = ZXIXZ&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(see for example Figure 10.12 on p.469 of Nielsen &amp;amp; Chuang). Calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT^{\otimes 5} \circ (g_1 \otimes IIIII) \circ CNOT^{\otimes 5} = g_1 \otimes XIIXI&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which does not belong to the stabilizer by the following&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Lemma.&lt;/strong&gt; Every non-identity element of the stabilizer group of the 5-qubit Shor's code is a tensor product that includes exactly one identity operator.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof.&lt;/strong&gt; Partition the fifteen non-identity elements of the group into disjoint subsets &lt;span class=&quot;math-container&quot;&gt;$A_k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=1, 2, 3, 4$&lt;/span&gt; according to the minimum number of generators necessary to represent them. It is clear that the lemma is true for all &lt;span class=&quot;math-container&quot;&gt;$g \in A_1$&lt;/span&gt;. By examining pairs of generators above it is easy to see that it is also true for all &lt;span class=&quot;math-container&quot;&gt;$g \in A_2$&lt;/span&gt;. Now, &lt;span class=&quot;math-container&quot;&gt;$A_4 = \{ZZXIX\}$&lt;/span&gt;. Finally, by comparing each generator above against the sole member of &lt;span class=&quot;math-container&quot;&gt;$A_4$&lt;/span&gt; we see that it is also true for &lt;span class=&quot;math-container&quot;&gt;$A_3$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus, we see that the 5-qubit Shor's code is not a CSS code. An alternative approach is to compute all sixteen elements of the stabilizer and verify that &lt;span class=&quot;math-container&quot;&gt;$XIIXI$&lt;/span&gt; does not belong to it.&lt;/p&gt;&#xA;&lt;p&gt;Incidentally we just showed that the 5-qubit Shor's code does not admit transversal CNOT gate.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-06T19:05:03.523" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15434" PostTypeId="1" AcceptedAnswerId="15435" CreationDate="2021-01-06T21:27:58.173" Score="3" ViewCount="42" Body="&lt;p&gt;I've been using a circuit that needs a specific initialization in the beginning, and to do so I've been using qc.initialize() as mentioned in previously asked similar questions (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13529/how-can-i-create-an-arbitrary-superposition-state-of-two-qubits-in-qiskit&quot;&gt;How can I create an arbitrary superposition state of two qubits in Qiskit?&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;However, I've noticed that even when using qc.initialize() to initialize some very simple states (|000&amp;gt;, etc.) it takes roughtly 3-4 seconds to just execute the circuit (something that would only take ~0.2 sec if I just start the circuit at |000&amp;gt; without qc.initialize()). The time for me is important because I need to execute the circuit many times (different than shots, each time I execute, the circuit is modified slightly). Regardless, the extra 3-4 seconds seems abnormal, because even when I use qc.initialize() on even just one qubit in the circuit, it still takes the extra 3 seconds to execute.&lt;/p&gt;&#xA;&lt;p&gt;One property about the initialization I need for the circuit is that its kind of &amp;quot;sparse&amp;quot;. With n qubits, my initial state is only built with a linear combination of ~2n basis vectors (as opposed to &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Given this is there some known algorithm or workaround to make an arbitrary initialization that avoids qc.initialize()? Perhaps is there some way other way through Qiskit I can use?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastActivityDate="2021-01-08T16:25:50.427" Title="Issue with Speed of Qiskit Arbitrary Initialization" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15435" PostTypeId="2" ParentId="15434" CreationDate="2021-01-06T23:28:02.100" Score="2" Body="&lt;p&gt;I noticed something about Qiskit initialize functionality, it doesn't always find the best possible circuit to prepare the state. For instance, if I want to put the state into uniform superposition state, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|00\rangle + |01\rangle + |10\rangle + |11\rangle }{4}$&lt;/span&gt; by specifying the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;provider = IBMQ.load_account()&#xA;qc = QuantumCircuit(2,2)&#xA;vector = [0.5, 0.5, 0.5, 0.5]&#xA;qc.initialize(vector, [0,1])&#xA;qc.x(0)&#xA;qc.measure(range(2), range(2))&#xA;qc.draw('mpl', style = {'name': 'bw'}, scale = 0.75, initial_state = False,plot_barriers = True) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output is something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────────────────────────┐┌───┐┌─┐&#xA;q_0: ┤0                             ├┤ X ├┤M├&#xA;     │  initialize(0.5,0.5,0.5,0.5) │└┬─┬┘└╥┘&#xA;q_1: ┤1                             ├─┤M├──╫─&#xA;     └──────────────────────────────┘ └╥┘  ║ &#xA;c: 2/══════════════════════════════════╩═══╩═&#xA;                                       1   0 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now if you this on one of the machine, and look at the circuit being submitted then you can see that it does it not in a very efficient way. For instance, I submitted the above circuit to a hardware, and the circuit below is what being submitted:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bFNXh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bFNXh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So instead of preparing the initial state &lt;strong&gt;by simply apply two Hadamard gate to each qubit individually&lt;/strong&gt;,&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JZ0TU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JZ0TU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;it actually doing something else that is equivalent but less efficient. This might be the reason you see longer experiment time as well.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you tried this for 3 qubits, that is, if you want to create a uniform superposition state for 3 qubits, then you will get something even worst... That is if you tried to submit this circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;«     ┌──────────────────────────────────────────────────────────────────────────────┐»&#xA;«q_0: ┤0                                                                             ├»&#xA;«     │                                                                              │»&#xA;«q_1: ┤1 initialize(0.35355,0.35355,0.35355,0.35355,0.35355,0.35355,0.35355,0.35355) ├»&#xA;«     │                                                                              │»&#xA;«q_2: ┤2                                                                             ├»&#xA;«     └──────────────────────────────────────────────────────────────────────────────┘»&#xA;«c: 3/════════════════════════════════════════════════════════════════════════════════»&#xA;«                                                                                     »&#xA;«     ┌───┐   ┌─┐&#xA;«q_0: ┤ X ├───┤M├&#xA;«     └┬─┬┘   └╥┘&#xA;«q_1: ─┤M├─────╫─&#xA;«      └╥┘ ┌─┐ ║ &#xA;«q_2: ──╫──┤M├─╫─&#xA;«       ║  └╥┘ ║ &#xA;«c: 3/══╩═══╩══╩═&#xA;«       1   2  0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which is can simply being done as:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/IUxwf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IUxwf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But instead what being submitted to the hardware is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/staQG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/staQG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This is probably just because the stochastic part of the transpiler within Qiskit. So it might be better than you design a function that make the circuit more efficient yourself. This issue is the same if one tried to use the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.components.initial_states.Custom.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Custom&lt;/code&gt; function&lt;/a&gt;... If you tried to specified a custom vector here, like what we did above, it will also prepare that initial state in a very convoluted way that is not always efficient.&lt;/p&gt;&#xA;&lt;p&gt;I think Qiskit uses technique from this paper: &lt;a href=&quot;https://arxiv.org/pdf/1501.06911.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuits for Isometries&lt;/a&gt; to create the circuit for an arbitrary state that you gave it.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h1&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/h1&gt;&#xA;&lt;p&gt;For the two qubit case, funny enough, I just check Qiskit and they actually have recently changed their &lt;strong&gt;native gates&lt;/strong&gt; on their device! So that, it used to be &lt;span class=&quot;math-container&quot;&gt;$U_1, U_2, U_3, CNOT$&lt;/span&gt;, but now it is &lt;span class=&quot;math-container&quot;&gt;$CNOT, ID, RZ, SX, X$&lt;/span&gt; and so what you saw on the circuit &lt;span class=&quot;math-container&quot;&gt;$RZ(\pi/2) \ S_X \ RZ(\pi/2)$&lt;/span&gt; is actually the native level implementation of the Hadamard gate now!&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-08T16:25:50.427" LastActivityDate="2021-01-08T16:25:50.427" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15436" PostTypeId="1" AcceptedAnswerId="15439" CreationDate="2021-01-07T02:11:00.350" Score="3" ViewCount="80" Body="&lt;p&gt;I'm aware that to randomly initialize a quantum circuit with Qiskit, we can simply write qc.initialize(rand_state, q[0]...). However, when drawing the circuit, I see that the &amp;quot;initialize&amp;quot; function is treated as one big gate that takes in an input and outputs the initialized state.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DkFiF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DkFiF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to decompose this &amp;quot;initialization gate&amp;quot; through python/Qiskit and run a circuit that is composed of the individual smaller gates that actually make up this large gate?&lt;/p&gt;&#xA;" OwnerUserId="11644" LastActivityDate="2021-01-07T06:41:52.673" Title="How to decompose/unroll a Qiskit Arbitrary initialization" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15437" PostTypeId="1" CreationDate="2021-01-07T05:47:23.393" Score="1" ViewCount="78" Body="&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;def qrng(bit_num, backend):&#xA;    bitstring = &amp;quot;&amp;quot;&#xA;    qrng_circuit = QuantumCircuit(5, 5)&#xA;    qrng_circuit.h(4)&#xA;    qrng_circuit.measure(4, 4)&#xA;    for _ in range(bit_num):&#xA;        counts = execute(qrng_circuit, backend, shots=8192).result().get_counts()&#xA;        bit = list(counts.keys())[0]  &#xA;        bitstring += bit&#xA;    return bitstring&#xA;&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;print(qrng(1024, backend))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For the above code is supposed to generate a random sequence by measurement of some specific qubits. For example if i have a quantum circuit with 10 qubits which are all put in superposition using Hadamard gate but I want that the measurement method&#xA;would be random (to be able to select say 2, 3, 5, 7, 8th qubit) leading to random bitstring being generated.&lt;/p&gt;&#xA;" OwnerUserId="13172" LastEditorUserId="55" LastEditDate="2021-01-18T20:01:13.647" LastActivityDate="2021-01-18T20:01:13.647" Title="Random measurement of qubits" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;measurement&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15438" PostTypeId="2" ParentId="15437" CreationDate="2021-01-07T06:27:57.303" Score="1" Body="&lt;p&gt;I am not sure exactly what you are trying to do by doing this but this does what you are looking for:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;from numpy.random import randint&#xA;from numpy.random import shuffle&#xA;&#xA;num_qubits  = 10&#xA;qreg_q = QuantumRegister(num_qubits, 'q')&#xA;creg_c = ClassicalRegister(num_qubits, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;for i in range(num_qubits):&#xA;    circuit.h(qreg_q[i])&#xA;    &#xA;sequence = [i for i in range(num_qubits)]&#xA;shuffle(sequence)&#xA;&#xA;&#xA;num_measurements = 6&#xA;for i in range(num_measurements):&#xA;    circuit.measure(qreg_q[sequence[i] ], creg_c[sequence[i] ])&#xA;&#xA;circuit.draw( ) &#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will create a layer of Hadamard gate on n-qubits then you can select the number of measurements you want to execute. It will then place those measurement randomly on different qubits. Thus, if you run the above code, you might generate a circuit something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;      ┌───┐                  &#xA; q_0: ┤ H ├──────────────────&#xA;      ├───┤            ┌─┐   &#xA; q_1: ┤ H ├────────────┤M├───&#xA;      ├───┤            └╥┘   &#xA; q_2: ┤ H ├─────────────╫────&#xA;      ├───┤             ║    &#xA; q_3: ┤ H ├─────────────╫────&#xA;      ├───┤         ┌─┐ ║    &#xA; q_4: ┤ H ├─────────┤M├─╫────&#xA;      ├───┤         └╥┘ ║    &#xA; q_5: ┤ H ├──────────╫──╫────&#xA;      ├───┤   ┌─┐    ║  ║    &#xA; q_6: ┤ H ├───┤M├────╫──╫────&#xA;      ├───┤   └╥┘    ║  ║ ┌─┐&#xA; q_7: ┤ H ├────╫─────╫──╫─┤M├&#xA;      ├───┤┌─┐ ║     ║  ║ └╥┘&#xA; q_8: ┤ H ├┤M├─╫─────╫──╫──╫─&#xA;      ├───┤└╥┘ ║ ┌─┐ ║  ║  ║ &#xA; q_9: ┤ H ├─╫──╫─┤M├─╫──╫──╫─&#xA;      └───┘ ║  ║ └╥┘ ║  ║  ║ &#xA;c: 10/══════╩══╩══╩══╩══╩══╩═&#xA;            8  6  9  4  1  7 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated:&lt;/strong&gt; So now, if we want to read-out the random bitstring, we can do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = BasicAer.get_backend('qasm_simulator')&#xA;counts = execute(circuit, backend, shots=1).result().get_counts()&#xA;bit_strings = list(counts.keys())[0]  &#xA;print('random bit_strings:', bit_strings)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which would output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;random bit_strings: 0011010010&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-07T16:16:38.463" LastActivityDate="2021-01-07T16:16:38.463" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15439" PostTypeId="2" ParentId="15436" CreationDate="2021-01-07T06:41:52.673" Score="2" Body="&lt;p&gt;In your example you can do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.decompose().draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The method &lt;code&gt;decompose&lt;/code&gt; decomposes every gate in the circuit. This will do a single level. If you want to do another level of decomposition, call the method again.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.decompose().decompose().draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-01-07T06:41:52.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15440" PostTypeId="2" ParentId="15432" CreationDate="2021-01-07T08:02:24.393" Score="4" Body="&lt;p&gt;If it were me, I'd write out the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit stabilizer generators in a &lt;span class=&quot;math-container&quot;&gt;$k\times 2N$&lt;/span&gt; binary matrix, where each row corresponds to a stabilizer generator, with the first &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; bits being the positions of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; rotations, and the second &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; being the positions of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;s.&lt;/p&gt;&#xA;&lt;p&gt;A CSS code can be converted into a block structure where there are rows with only &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operations, and rows with only &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operations, and no mixing. So you simply have the task of using row operations (modulo 2) to see if you can convert it into that form (a standard row reduction will get you about half way). If you cannot, the code is not a stabilizer code. If you can, then this instantly gives you the two classical codes that are used. One should probably check the required relations between parity check matrices, although I guess these will generally be satisfied.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-01-07T08:02:24.393" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15442" PostTypeId="1" CreationDate="2021-01-07T10:01:37.960" Score="2" ViewCount="123" Body="&lt;p&gt;I am suposed to solve following problem:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Calculate the probability &lt;span class=&quot;math-container&quot;&gt;$P_n(x &amp;gt; X)$&lt;/span&gt; that a particle in then n-th eigenstate is found at a position with an x-value larger than X.  Here it is convenient to formulate  it  as  an  expectation  value  of  an  operator.   We  make  an  operator &lt;span class=&quot;math-container&quot;&gt;$P(x &amp;gt; X)$&lt;/span&gt; which is a matrix with unity on the diagonal if &lt;span class=&quot;math-container&quot;&gt;$x &amp;gt; X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;To do this  I  used  the  command &lt;code&gt;&amp;gt;&lt;/code&gt; which  returns True if  the  number  on  the  left  is larger than the one on the right and False otherwise. To turn the True or False into 0 or 1 we use the method &lt;code&gt;astype(int)&lt;/code&gt; on the &lt;code&gt;NumPy&lt;/code&gt; array, which we then transform to an operator.T ake  a  few  values  of X,  e.g. X=  3,  5,  and  7,  and  plot &lt;span class=&quot;math-container&quot;&gt;$P_n(x &amp;gt; X)$&lt;/span&gt;  as  a function of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; (make sure that the box size &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is somewhat larger than &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The excercise continues as follow&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Explain what you see:  Why is it low when &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is small?  At which value ofnwould you expect &lt;span class=&quot;math-container&quot;&gt;$P_n(x &amp;gt; X)$&lt;/span&gt; to grow from a small to a large value? Hint :which energy would it require classically?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question is: How do I find the expectation value of the operator?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="14402" LastEditorUserId="9006" LastEditDate="2021-01-07T10:17:54.443" LastActivityDate="2021-02-06T18:03:55.320" Title="Expectation value of operator - python" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15443" PostTypeId="1" AcceptedAnswerId="15445" CreationDate="2021-01-07T10:14:55.517" Score="8" ViewCount="310" Body="&lt;p&gt;Training of variational circuits needs to calculate the derivative to be optimized. Several methods were proposed &lt;a href=&quot;https://arxiv.org/pdf/2008.06517.pdf&quot; rel=&quot;noreferrer&quot;&gt;(1)&lt;/a&gt;, the most famous ones being &lt;em&gt;the finite difference&lt;/em&gt; and the &lt;em&gt;parameter shift rule&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What's the difference between the two methods? Is one more convenient than the other?&lt;/li&gt;&#xA;&lt;li&gt;Do other methods exist for taking the derivative, besides these two?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="55" LastEditDate="2021-01-18T20:02:26.190" LastActivityDate="2021-01-18T20:02:26.190" Title="Comparing method of differentiation in variational quantum circuit" Tags="&lt;machine-learning&gt;&lt;optimization&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15444" PostTypeId="2" ParentId="7106" CreationDate="2021-01-07T11:56:16.350" Score="2" Body="&lt;p&gt;What you should take from your previous question is a basic protocol. If you measure the ends of two Bell pairs using a Bell measurement, and if you apply the appropriate connection, what you are left with is a Bell state between the two unmeasured qubits. I could draw this diagrammatically as:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0Ej7p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0Ej7p.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;So, this is a repeating trick:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mw0Cb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mw0Cb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;So far, this appears to ignore the unitary that Alice did. However, note that there is a general identity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U\otimes U(|01\rangle-|10\rangle)=|01\rangle-|10\rangle,&#xA;$$&lt;/span&gt;&#xA;which I can rewrite as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U\otimes 1(|01\rangle-|10\rangle)=(1\otimes U^\dagger)(|01\rangle-|10\rangle).&#xA;$$&lt;/span&gt;&#xA;Hence, Alice applying &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to qubit 1 is equivalent to Bob applying &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; on qubit 2. Furthermore, we can arrange it that (apart from Bob's final measurement, which is not part of the sequence of my diagram) Bob never does anything to his qubit 2 - the corrections can be performed upon qubits 5 and 3. So, it wouldn't matter if the unitary were applied by Bob before or after the sequence of measurements. Thus, we know that Bob has the Bell pair with &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; applied on qubit 2. Thus, if &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is one of the Pauli operators, Bob has one of the four Bell states, and his measurement will determine which one.&lt;/p&gt;&#xA;&lt;p&gt;If you're looking for a more concrete mathematical statement, I suggest starting by finding exactly the structure of my diagrams and seeing within that the mathematics that you've already understood.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-01-07T11:56:16.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15445" PostTypeId="2" ParentId="15443" CreationDate="2021-01-07T13:08:52.220" Score="11" Body="&lt;p&gt;Both finite differences and the parameter-shift rule can be used to compute quantum gradients on quantum hardware. However, there are several reasons that lead to the parameter-shift rule being preferred.&lt;/p&gt;&#xA;&lt;h3&gt;Numerical differentiation&lt;/h3&gt;&#xA;&lt;p&gt;One method to compute gradients is &lt;a href=&quot;https://en.wikipedia.org/wiki/Finite_difference&quot; rel=&quot;nofollow noreferrer&quot;&gt;finite difference&lt;/a&gt;, a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Numerical_differentiation&quot; rel=&quot;nofollow noreferrer&quot;&gt;numerical differentiation&lt;/a&gt;. Here we treat the function to be differentiated as a 'black box', and approximate the gradient of a function via:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d f(x)}{dx}\approx \frac{f(x+\epsilon)-f(x-\epsilon)}{2\epsilon}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that it gives an approximation of the derivative, whose quality depends on &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In general, we require &lt;span class=&quot;math-container&quot;&gt;$\epsilon\ll 1$&lt;/span&gt; for the result to be accurate&lt;/li&gt;&#xA;&lt;li&gt;However, finite-differences can be quite unstable when used iteratively, e.g., for gradient descent.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Parameter shift&lt;/h3&gt;&#xA;&lt;p&gt;Another method is the &lt;a href=&quot;https://pennylane.ai/qml/glossary/parameter_shift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;parameter-shift rule&lt;/a&gt;. The idea here appears the same on the surface; we want to express the gradient as a linear combination of the function evaluated at two separate points. However, it is important to point out that, unlike finite differences, there are several differences:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Parameter shift is &lt;strong&gt;exact&lt;/strong&gt;, it is not an approximation.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The shift does &lt;em&gt;not&lt;/em&gt; have to be small or infinitesimal like in finite differences.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Whereas finite differences can be applied to any function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, the parameter-shift rule can only be used to determine &lt;span class=&quot;math-container&quot;&gt;$f'(x)$&lt;/span&gt; if the function satisfies certain constraints.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For example, consider &lt;span class=&quot;math-container&quot;&gt;$f(x)=\sin(x)$&lt;/span&gt;. Using the trig identity &lt;span class=&quot;math-container&quot;&gt;$\sin(a+b)-\sin(a-b) = 2\cos(a)\sin(b)$&lt;/span&gt;, its derivative, &lt;span class=&quot;math-container&quot;&gt;$\cos(x)$&lt;/span&gt;, can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{df(x)}{dx} = \cos(x) = \frac{\sin(x+s)-\sin(x-s)}{2\sin(s)},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for (almost) &lt;strong&gt;any value&lt;/strong&gt; of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;. So in this case, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d f(x)}{dx}=\frac{f(x+s)-f(x-s)}{2\sin(s)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is simply taking advantage of the fact that we know that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; satisfies a particular trig identity. Notice that the &amp;quot;shift&amp;quot; from &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is not required to be tiny and the equation is exact, i.e., it is not an approximation. Typically, we would choose a value like &lt;span class=&quot;math-container&quot;&gt;$s=\pi/2$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d f(x)}{dx}=\frac{f(x+\pi/2)-f(x-\pi/2)}{2}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A similar trick can be used for gradients of quantum gates.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Why do we prefer the parameter shift rule over finite differences?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Since near term quantum hardware is noisy, we typically cannot rely on finite differences to provide us with accurate results; if we choose &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; to be sufficiently small (usually we aim for &lt;span class=&quot;math-container&quot;&gt;$\epsilon\approx 10^{-7}$&lt;/span&gt; or so), the two shifted evaluations of the circuit are swamped by noise.&lt;/p&gt;&#xA;&lt;p&gt;In contrast, the parameter shift rule is (a) exact, and (b) doesn't require a small shift. We can optimize by choosing the shift so as to &lt;em&gt;maximise&lt;/em&gt; the distance in the parameter-space between the two circuit evaluations.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; of course, if using near term quantum hardware, we are restricted to a finite number of shots, so we can only ever approximate the gradient, even with the parameter-shift rule (with the approximation becoming more accurate as the number of shots increases).&lt;/p&gt;&#xA;&lt;p&gt;The macroscopic shift, as well as the fact that the parameter-shift rule provides an unbiased estimator of the gradient, still makes it preferable to finite differences. In fact, convergence is still guaranteed &lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_doubly_stochastic.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;even in the extreme case of estimating the gradient with a single shot&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Do other methods exist for taking the derivative, besides these two?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes!&lt;/p&gt;&#xA;&lt;p&gt;If we are restricted to simulators, we can use &lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_backprop.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard backpropagation&lt;/a&gt; or a form of backpropagation that is more memory efficient for reversible/unitary computations.&lt;/p&gt;&#xA;&lt;p&gt;If you mean methods that support quantum hardware, other methods also exist:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;There are extensions or generalizations of the parameter-shift rule, including a &lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_stochastic_parameter_shift.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;stochastic parameter-shift rule&lt;/a&gt; that applies to additional gates, a parameter-shift rule for noisy channels, and parameter-shift rules for controlled operations that require more than the standard two terms.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Further, there are approaches that involve modifying the circuit structure to compute the gradient (as opposed to the parameter-shift rule, which requires multiple evaluations of the same circuit structure).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3&gt;Relevant papers&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1811.11184&quot; rel=&quot;nofollow noreferrer&quot;&gt;Evaluating analytic gradients on quantum hardware&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1803.00745&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum circuit learning&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2008.06517&quot; rel=&quot;nofollow noreferrer&quot;&gt;Estimating the gradient and higher-order derivatives on quantum hardware&lt;/a&gt;high&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2005.10299&quot; rel=&quot;nofollow noreferrer&quot;&gt;Measuring Analytic Gradients of General Quantum Evolution with the Stochastic Parameter Shift Rule&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1905.13311&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gradients of parameterized quantum gates using the parameter-shift rule and gate decomposition&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1910.01155&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stochastic gradient descent for hybrid quantum-classical optimization&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="371" LastEditorUserId="371" LastEditDate="2021-01-10T16:13:12.197" LastActivityDate="2021-01-10T16:13:12.197" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15446" PostTypeId="2" ParentId="15442" CreationDate="2021-01-07T17:08:40.300" Score="0" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Expectation_value_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;expectation&lt;/a&gt; of an observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with respect to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; can be calculated as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi |A| \psi \rangle = Tr( \langle \psi | A| \psi \rangle) = Tr( A|\psi \rangle \langle \psi|) = Tr(A \rho) = Tr(\rho A)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = | \psi \rangle \langle \psi |$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;density matrix formulation&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, if giving a &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and you want to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | A| \psi \rangle$&lt;/span&gt; in Python, you can do it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np &#xA;norm_psi = [1., 1., 1., 1.]/np.linalg.norm(psi)&#xA;A  = np.matrix( '3,0,0,1; 0,-1,0,0; 0,0,-1,0; 1,0,0,1' )&#xA;print('Operator A=\n', A)&#xA;expectation  = np.inner(np.conj(norm_psi).T, np.matmul(A,norm_psi) ) #Calculate &amp;lt;norm_psi|A|norm_psi&amp;gt; &#xA;print('\n expectation value calculated by &amp;lt;norm_psi|A|norm_psi&amp;gt; :\n ' , expectation)&#xA;#-------&#xA;rho =  np.outer(norm_psi, np.conj(norm_psi) )&#xA;expectation = np.trace(rho*A)&#xA;print('\n expectation value calculated by Tr(rho*A):\n ' , expectation)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Operator A=&#xA; [[ 3  0  0  1]&#xA; [ 0 -1  0  0]&#xA; [ 0  0 -1  0]&#xA; [ 1  0  0  1]]&#xA;&#xA; expectation value calculated by &amp;lt;norm_psi|A|norm_psi&amp;gt; :&#xA;  [[1.]]&#xA;&#xA; expectation value calculated by Tr(rho*A):&#xA;  1.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;You can use Qiskit to do this as well. And it is quite simply if your operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is straight forward decomposition of Pauli strings, like &lt;span class=&quot;math-container&quot;&gt;$A = Z\otimes Z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$A = X \otimes Z$&lt;/span&gt; etc. For instance, if&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A =  X \otimes Z = \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1 \end{pmatrix} = \begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0&amp;amp; 0 &amp;amp; -1 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is the same as previously: &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{2}\begin{pmatrix} 1 \\ 1 \\ 1\\ 1 \end{pmatrix}$&lt;/span&gt;. Note that this state can be prepared on a quantum circuit as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pUWQ7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pUWQ7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then you can calculate the expectation as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.aqua.operators import X, Y, Z, I&#xA;from qiskit.aqua.operators import StateFn&#xA;&#xA;operator = X ^ Z  #Note that ^ represents tensor product &#xA;qc = QuantumCircuit(2)&#xA;qc.h(0)&#xA;qc.h(1)&#xA;psi = StateFn(qc) &#xA;expectation = (~psi @ operator @ psi).eval()&#xA;print('expectation value is:', expectation)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;output: &lt;code&gt;expectation value is: 0j&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is what you would expect by looking at the matrix form of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-07T17:37:30.897" LastActivityDate="2021-01-07T17:37:30.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15447" PostTypeId="2" ParentId="15437" CreationDate="2021-01-08T08:12:24.667" Score="2" Body="&lt;p&gt;To add some information to &lt;em&gt;KAJ226&lt;/em&gt; answer.&lt;/p&gt;&#xA;&lt;p&gt;To generate random bit string having uniform distribution with quantum computer, you do not need to perform random measurement. Lets say you want to generate bit string of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. Then simply put Hadamard gate on each qubit, then apply measurement and send your circuit to quantum computer with one shot as proposed by &lt;em&gt;KAJ226&lt;/em&gt;. Repeat this &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; times. In the end, you will have &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; uniformly distributed random bit strings with length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. The reason why this works is that Hadamard gate prepares equally distributed superposition.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-08T08:12:24.667" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15448" PostTypeId="1" CreationDate="2021-01-08T08:25:38.437" Score="4" ViewCount="241" Body="&lt;p&gt;What is the meaning of the topology graphs of IBM's quantum computers? How should it be interpreted?&#xA;For example, how should I understand the following graph?&lt;a href=&quot;https://i.stack.imgur.com/PU3VN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PU3VN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8031" LastActivityDate="2021-01-08T17:21:53.833" Title="Topology graphs of IBM's quantum computers" Tags="&lt;physical-realization&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15449" PostTypeId="2" ParentId="15448" CreationDate="2021-01-08T08:40:10.087" Score="7" Body="&lt;p&gt;The graph shows you how the physical qubits are connected together on the real device you will be using. For example, on the graph you put, qubit 0 has a physical connection to qubit 1 and qubit 14 on the quantum device but is not connected to qubit 12.&lt;/p&gt;&#xA;&lt;p&gt;This graph is really important when Qiskit tries to map a circuit to the quantum device because it shows how qubits are connected and this is a huge step in transforming circuits to run in devices. For example, since 0 and 1 are connected, it will have no problem executing a C-NOT between the two. But if you wish to do the same between 0 and 12, this will be harder because of the lack of connection.&lt;/p&gt;&#xA;&lt;p&gt;The process of rewriting circuits is what we call &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler.html?&quot; rel=&quot;noreferrer&quot;&gt;transpilation&lt;/a&gt;. Without it, we won't be able to run circuits on quantum devices. You should check the link I just put, it explains it quite well! All in all, the main objective of this is to transform your circuit so it matches the device you are using, and the topology of the qubits (the graph) plays quite a important role in this.&lt;/p&gt;&#xA;&lt;p&gt;If you have any question regarding this, feel free to ask! I hope this helps :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-01-08T08:40:10.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15450" PostTypeId="1" CreationDate="2021-01-08T09:25:10.673" Score="4" ViewCount="107" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AR}$&lt;/span&gt; be some &lt;span class=&quot;math-container&quot;&gt;$d-$&lt;/span&gt;dimensional pure quantum state. Consider a channel &lt;span class=&quot;math-container&quot;&gt;$N_{A\rightarrow B}$&lt;/span&gt; that outputs a constant state in &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. We now consider the Stinespring dilation of this channel with some environment register &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and trace out the &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; register. This gives us the state below&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_{RE} = \sum\limits_{k, k'=1}^{d} \langle k_A \vert \ \rho_{AR} \vert k'_A\ \rangle\otimes \vert k_E\rangle\langle k'_E \vert,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\vert k\rangle, \vert k'\rangle$&lt;/span&gt; denote basis vectors from any fixed basis. How can one calculate the von Neumann entropy of &lt;span class=&quot;math-container&quot;&gt;$\sigma_{RE}$&lt;/span&gt; given by &lt;span class=&quot;math-container&quot;&gt;$S(\sigma_{RE}) = \text{Tr}(\sigma_{RE}\log\sigma_{RE})$&lt;/span&gt;? I am unable to simplify my expression beyond the definition so any hints are appreciated. I would like to express the answer in terms of &lt;span class=&quot;math-container&quot;&gt;$S(\rho_R)$&lt;/span&gt; (and maybe other terms as pointed out in the comment).&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2021-01-09T06:53:58.830" LastActivityDate="2021-01-09T06:53:58.830" Title="Calculating the entropy of a quantum state" Tags="&lt;entropy&gt;&lt;information-theory&gt;&lt;partial-trace&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15451" PostTypeId="1" CreationDate="2021-01-08T12:07:21.427" Score="-3" ViewCount="84" Body="&lt;p&gt;I would, like to know for my company, as we are looking to start the process of moving towards quantum  safeness.&lt;/p&gt;&#xA;" OwnerUserId="14408" LastEditorUserId="8141" LastEditDate="2021-01-08T13:37:06.420" LastActivityDate="2021-01-08T22:01:21.933" Title="Do quantum computers have any security risks associated with them?" Tags="&lt;cryptography&gt;&lt;qkd&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2021-01-09T15:13:14.343" ContentLicense="CC BY-SA 4.0" />
  <row Id="15453" PostTypeId="2" ParentId="15448" CreationDate="2021-01-08T17:21:53.833" Score="5" Body="&lt;p&gt;To add onto &lt;em&gt;Lena&lt;/em&gt; answer.&lt;/p&gt;&#xA;&lt;p&gt;The plot topology graph of the device represents the qubit layout of the hardware. The qubits on IBM hardware are fixed. They don't move around as trapped-ion qubits built by &lt;a href=&quot;https://techcrunch.com/2020/10/29/honeywell-announces-its-h1-quantum-computer-with-10-qubits/&quot; rel=&quot;noreferrer&quot;&gt;Honeywell system&lt;/a&gt;. Hence, IBM hardware doesn't have what you would call all-to-all connectivity between qubits. Note that IBM uses &lt;a href=&quot;https://en.wikipedia.org/wiki/Transmon&quot; rel=&quot;noreferrer&quot;&gt;superconducting transmon qubit&lt;/a&gt; rather than &lt;a href=&quot;https://en.wikipedia.org/wiki/Trapped_ion_quantum_computer&quot; rel=&quot;noreferrer&quot;&gt;trapped ions qubits&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When you design a quantum circuit, you don't usually don't think about the specific hardware specifications. That is, you would rather put your focus on designing a circuit to do the task at hand rather than thinking about what the qubit layout is on the QPU and the native gates that can be executed on the QPU. Once you finished designing your circuit, and want to execute it on a specific QPU, then you need to find an equivalent circuit to the circuit that you came up with, that can be executed on that specific QPU. This is known as the transpilation process. Fortunately, Qiskit do this automatically for you. Furthermore, you can also specify the level of optimization during this transpilation process.&lt;/p&gt;&#xA;&lt;p&gt;For example, let's suppose that the following quantum circuit solve that problem that you are interested in:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/p1spQ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/p1spQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and you want to execute this on &lt;code&gt;ibmq_vigo&lt;/code&gt; which has the following specifications:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;qubit layout:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mcl8P.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mcl8P.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;p&gt;Basis gates (the gates that can be executed on hardware):&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;CX, ID, RZ, SX, X&lt;/strong&gt; (This just changed actually, it used to be U1,U2,U3,CX )&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;First, we must note that the Hadamard gate can't be implement directly on &lt;code&gt;ibmq_vigo&lt;/code&gt; since it is not part of the native gate. So it need to be decomposed into RZ  and SX gates.&lt;/p&gt;&#xA;&lt;p&gt;Second, we should note that qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is not connected to &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; in the above qubit layout. But we do have a &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; gate between &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; hence there must be some overhead swapping operations need to be done for us to be able to execute the above circuit on the hardware.&lt;/p&gt;&#xA;&lt;p&gt;But as I said before, IBM do this transpilation for you automatically, so you don't have to worry about it. And they do it at different level of optimization. At the lowest level, that is, you just map the your circuit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; to the device qubit number &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and your circuit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; to the device qubit number &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and so on, then you would have a transpiled circuit like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NcBbk.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NcBbk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note how you don't see the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; being executed but rather a sequence of &lt;span class=&quot;math-container&quot;&gt;$RZ$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SX$&lt;/span&gt; gates putting together... again this is because the QPU &lt;code&gt;ibmq_vigo&lt;/code&gt; doesn't have &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; as the native gate.&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;This is all good, but you might look at your circuit, and say to yourself: well... since &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; need to have to an entangled gate, &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;, and the other qubits only have single qubit rotation (&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate). Why don't we map qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; of the circuit to qubit number &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; on the QPU, but now mapping qubit &lt;span class=&quot;math-container&quot;&gt;$q_4$&lt;/span&gt; of the circuit to qubit number &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; of the device, and qubit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; of the circuit to qubit number &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; of the device and etc. This will reduce the overhead. This is a higher level of optimization, and it is a default option in Qiskit (I believe). So doing what I just said above will give is the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/shu9Y.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/shu9Y.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note how much simpler it is now compare to the our first transpiled circuit. This is why having a good transpilation process is really important and one that is very critical in this NISQ (Noisy Intermediate-Scale Quantum) era.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you are interested in recreating the above circuits, and their respective transpiled version, here is the &lt;strong&gt;code&lt;/strong&gt; to do so in Qiskit. I executed them in the &lt;a href=&quot;https://quantum-computing.ibm.com/jupyter&quot; rel=&quot;noreferrer&quot;&gt;IBMQ Lab environment&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;Importing Qiskit packages:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from iqx import *&#xA;from qiskit.visualization import plot_histogram, plot_gate_map, plot_circuit_layout&#xA;provider = IBMQ.load_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;Creating the original circuit and draw it out:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qreg_q1 = QuantumRegister(5, 'q')&#xA;creg_c = ClassicalRegister(5, 'c' )&#xA;qc = QuantumCircuit(qreg_q1)&#xA;qc.h(0)&#xA;for i in [1,2,3,4]:&#xA;    qc.x(i)&#xA;qc.cx(0,4)&#xA;qc.draw('mpl', style = {'name': 'bw'}, scale = 1, initial_state = True,plot_barriers = False) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;Pick ibmq_vigo as our QPU to transpile the original circuit to, also transpile it naively (lowest level of optimization):&lt;/strong&gt; (This is create that humongous long circuit we saw earlier)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;hardware_backend = provider.get_backend('ibmq_vigo')&#xA;transpiled_qc_lvl0 = transpile(qc, backend = hardware_backend , optimization_level=0)&#xA;transpiled_qc_lvl0.draw('mpl', style = {'name': 'bw'}, scale = 0.6, initial_state = True,plot_barriers = False) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;strong&gt;Transpile the original circuit with highest level of optimization:&lt;/strong&gt; (This spit out the shorter/much more compact transpiled circuit that we saw earlier. Not we just change the optimization_level from 0 to 3.)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpiled_qc_lvl3 = transpile(qc, backend = hardware_backend , optimization_level=3)&#xA;transpiled_qc_lvl3.draw('mpl', style = {'name': 'bw'}, scale = 0.75, initial_state = True,plot_barriers = False) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-08T17:21:53.833" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15454" PostTypeId="2" ParentId="15432" CreationDate="2021-01-08T17:26:10.677" Score="1" Body="&lt;p&gt;Every &lt;span class=&quot;math-container&quot;&gt;$[[n,k,d]]$&lt;/span&gt; stabilizer code can be mapped to a &lt;span class=&quot;math-container&quot;&gt;$[[4n,2k,2d]]$&lt;/span&gt; CSS code.&#xA;This may not be what you want if you want to keep &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; fixed, but look at this&#xA;paper for possible clues; it&#xA;gives explicit mappings from one to the other (with fermionic codes as an intermediate step) : Majorana Fermion Codes &lt;a href=&quot;https://arxiv.org/abs/1004.3791&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1004.3791&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12265" LastActivityDate="2021-01-08T17:26:10.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15455" PostTypeId="2" ParentId="15451" CreationDate="2021-01-08T22:01:21.933" Score="1" Body="&lt;p&gt;Quantum computing is so far away from anything that would ever have to worry about security risks.&lt;/p&gt;&#xA;&lt;p&gt;It's very much debated how far away we are from having a quantum computer, but I personally think it'll be decades before &amp;quot;security risks&amp;quot; are even worth speculating about.&lt;/p&gt;&#xA;&lt;p&gt;There is an effort to build a &lt;a href=&quot;https://www.nature.com/articles/nature07127&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;quantum internet&amp;quot;&lt;/a&gt; which connects quantum computers with entangled qubits, and could connect long distance networks for QKD. But to be frank, connecting the world with QKD is not as useful as just switching to post-quantum protocols for normal cryptography. In my opinion, the appeal of a &amp;quot;quantum internet&amp;quot; is for applications that need distributed entanglement (or for connecting quantum computers), not for QKD.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2021-01-08T22:01:21.933" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15457" PostTypeId="2" ParentId="14961" CreationDate="2021-01-09T17:31:01.717" Score="1" Body="&lt;p&gt;The covariance matrix is a function of the expectation values of powers of position and momentum associated to some state in a continuous-variable system.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \mathbf{\sigma} = \begin{pmatrix} \langle\hat{x}^2\rangle &amp;amp; \frac{1}{2}\langle \{ \hat{x} ,\hat{p}\} \rangle \\ \frac{1}{2}\langle \{ \hat{x} ,\hat{p}\}\rangle &amp;amp;   \langle\hat{p}^2\rangle\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For states which are fully describable by their first and second moments, like Gaussian States, there is an equivalence between the Wigner Function of the state and its covariance matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$W(\mathbf{r}) =\frac{\exp\left( -\frac{1}{2} (\mathbf{r} -\bar{ \mathbf{r}}) \mathbf{\sigma}^{-1}&#xA;(\mathbf{r}-\bar{\mathbf{r}} ) \right)}{(2 \pi)^N \sqrt{\text{det} \mathbf{\sigma}}}$$&lt;/span&gt;&#xA;where in this case &lt;span class=&quot;math-container&quot;&gt;$\mathbf{r} =(\hat{x},\hat{p})$&lt;/span&gt;. So for a given Gaussian State, given some average expectation values, you could generate the average covariance matrix and from that your Wigner Function.&lt;/p&gt;&#xA;&lt;p&gt;Depending on how many of these &amp;quot;powers&amp;quot; you know, the more statistical moments of your Wavefunction you know allowing you to reconstruct the Wignerfunction of such a wavefunction from its covariance matrix more faithfully in a numerical way.&lt;/p&gt;&#xA;&lt;p&gt;In Quantum Computing, there is the idea of &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum State Tomography&lt;/a&gt; which is to construct a state from measurements of a statistical ensemble of states so this might be worth looking into also.&lt;/p&gt;&#xA;" OwnerUserId="4373" LastEditorUserId="4373" LastEditDate="2021-01-12T15:12:22.393" LastActivityDate="2021-01-12T15:12:22.393" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15458" PostTypeId="1" CreationDate="2021-01-10T01:57:51.707" Score="2" ViewCount="53" Body="&lt;p&gt;I read the details of Shor's algorithm implementation at the link &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/shor.html#2.-The-Solution&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/shor.html#2.-The-Solution&lt;/a&gt; and had a question. As a concept, when Unitary is applied with a Control Qubit, because of Phase kickback, the Phase gets applied to Control Qubit instead of the target register. So, that means there should not be any impact of the Unitary operator on the target register. But in Shor's algorithm application, we see that the impact is seen in both the Control bit and the target register. If we measure the target Qubit, we see the superposition of 1, 2, 4 and 8 (for the example taken as Qiskit implementation) along with impact Phase rotations in Control register too.&lt;/p&gt;&#xA;&lt;p&gt;Is my understanding correct? Have tried a lot to search and get information on this but could not find. So, can someone please help me understand this?&lt;/p&gt;&#xA;" OwnerUserId="14409" LastEditorUserId="55" LastEditDate="2021-01-18T20:05:33.490" LastActivityDate="2021-01-18T20:05:33.490" Title="Unitary Operator impact on both - the Control Qubit and the Target Register in Shor's Algorithm" Tags="&lt;shors-algorithm&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15459" PostTypeId="1" CreationDate="2021-01-10T02:03:04.807" Score="2" ViewCount="113" Body="&lt;p&gt;Can Qiskit's &lt;code&gt;c_if&lt;/code&gt; be used on a real quantum computer of IBM? And if it can, can it put a condition only on Qiskit gates like X, H, U1, U2, etc, or is there some way to make the conditioned operation to be a user defined operation, like a block of code, or a user defined gate? Is there other ways to do operations which are conditioned on the classical register measurements results, which will work on real quantum devices (or at least on a simulator)?&lt;/p&gt;&#xA;" OwnerUserId="8031" LastEditorUserId="55" LastEditDate="2021-01-18T20:05:11.307" LastActivityDate="2021-01-18T20:05:11.307" Title="Qiskit's c_if and conditioned operations on a real quantum computer" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15460" PostTypeId="2" ParentId="15459" CreationDate="2021-01-10T02:43:13.003" Score="3" Body="&lt;p&gt;As far as I know, &lt;code&gt;c_if&lt;/code&gt; operation is not implementable on IBM's hardware currently. But it should be implementable on simulator.&lt;/p&gt;&#xA;&lt;p&gt;For instance, if I tried to execute this &amp;quot;teleportation&amp;quot; circuit on the hardware:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mhJzj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mhJzj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I would get the following error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9bJ3g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9bJ3g.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that I was able to execute the same circuit on the IBM qasm_simulator.&lt;/p&gt;&#xA;&lt;br&gt; &#xA;&lt;p&gt;However, thanks to principle of deferred measurement, we can push the measurement all the way back to the end of the circuit. That is, you can convert the above circuit into an equivalent circuit with measurement operations being executed at the very end of the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ItzoS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ItzoS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-10T02:43:13.003" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15461" PostTypeId="2" ParentId="15458" CreationDate="2021-01-10T03:15:53.173" Score="3" Body="&lt;p&gt;The key idea in understanding phase kickback is that phase factors do not belong to one register or the other, but instead belong to terms in superposition and are &lt;em&gt;shared&lt;/em&gt; by the registers.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the phase kickback due to CNOT applied to &lt;span class=&quot;math-container&quot;&gt;$|{+-}\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT |+\rangle|-\rangle = \frac{1}{\sqrt{2}}\left(CNOT|0\rangle|-\rangle + CNOT |1\rangle|-\rangle\right) = \frac{1}{\sqrt{2}}\left(|0\rangle|-\rangle - |1\rangle|-\rangle\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the minus sign between the two terms comes from the fact that &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; is the eigenvector of the quantum NOT gate associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. It is not correct to say that the sign belongs to the target register or to the control register. Instead, it belongs to the ket &lt;span class=&quot;math-container&quot;&gt;$|1\rangle|-\rangle$&lt;/span&gt; which spans both registers. This is consistent with your observation that we see its effect on both registers.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Mathematically, this is a manifestation of one of the defining properties of the tensor product&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(c|x\rangle) \otimes |y\rangle = |x\rangle \otimes (c|y\rangle) = c|x\rangle \otimes |y\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;See for example the properties listed in &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Using_the_free_vector_space_to_%22forget%22_about_the_basis&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; in Wikipedia.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-10T03:50:12.570" LastActivityDate="2021-01-10T03:50:12.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15462" PostTypeId="1" AcceptedAnswerId="15482" CreationDate="2021-01-10T04:12:25.393" Score="2" ViewCount="43" Body="&lt;p&gt;We can make use of the Qbit to make a random string of bytes then as I have an office laptop and I can do some espionage by copying the files to my local disk from the network share and upload it to some online board.&lt;/p&gt;&#xA;&lt;p&gt;It Leaves a shadow file if I choose to delete it and or encrypt the file. If forensics is performed then that file can be retrieved in its entirity( best case), partially(most cases), encrypted entirety( rarely), or a sign that the file was attempted to be shredded and implementation may vary from OS to OS and File system to file system.&lt;/p&gt;&#xA;&lt;p&gt;My proposal is that we expose an online service where we input the remaining size of our harddisk, let's suppose I have a disk size of 2TB and 1.5TB is remaining so I shall download a file with Quantum random numbers of size 1.5TB hence overriding all the memory cell even if the disk firmware is ware balanced it will not be able to preserve the fragments of the previously deleted files as we are filling all the leftover disk space with random quantum numbers.&lt;/p&gt;&#xA;" OwnerUserId="9003" LastActivityDate="2021-01-11T08:32:54.990" Title="Quantum PRGN against Hard disk Forensics" Tags="&lt;programming&gt;&lt;random-quantum-circuit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15463" PostTypeId="1" AcceptedAnswerId="15602" CreationDate="2021-01-10T05:02:26.360" Score="2" ViewCount="138" Body="&lt;p&gt;I know how to change the special unitary matrix in &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; to the matrix in &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt;, and I found one way to change the state(vector) from &lt;span class=&quot;math-container&quot;&gt;$2\times 1$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$3\times 1$&lt;/span&gt;, but I don't know why.&lt;/p&gt;&#xA;&lt;p&gt;The method is shown below:&lt;/p&gt;&#xA;&lt;p&gt;For any vector&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \equiv (a+bi,c+di)^T$&lt;/span&gt;, the corresponding one is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{equation}&#xA;\tag{1}&#xA;\begin{pmatrix} &#xA;2(ac + bd) \\ &#xA;2(-bc + ad)\\&#xA;a^2+b^2-c^2-d^2&#xA;\end{pmatrix}&#xA;\end{equation}&#xA;$$&lt;/span&gt;&#xA;The process is :&lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\vec{\sigma} |\psi\rangle$&lt;/span&gt;, and the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; component of it is the first line in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; component of it is the second line in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and so on, where &lt;span class=&quot;math-container&quot;&gt;$\sigma $&lt;/span&gt; stands for Pauli operator&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma _x = \begin{pmatrix}0&amp;amp;1\\1&amp;amp;0\end{pmatrix},\sigma _y = \begin{pmatrix}0&amp;amp;-i\\i&amp;amp;0\end{pmatrix}, \sigma _z=\begin{pmatrix}1&amp;amp;0\\0&amp;amp;-1\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, if the &lt;span class=&quot;math-container&quot;&gt;$2\times 1$&lt;/span&gt; vector is &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}\cos(\theta/2)\\ \sin(\theta /2)e^{i\phi}\end{pmatrix}$&lt;/span&gt; then using transformation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; the corresponding &lt;span class=&quot;math-container&quot;&gt;$3\times 1$&lt;/span&gt; vector is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}\sin(\theta)\cos(\phi)\\ \sin(\theta)\sin(\phi)\\ \cos(\theta)\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I don't understand how to prove (1).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/606545/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="10480" LastEditDate="2021-01-19T22:17:31.930" LastActivityDate="2021-01-19T22:17:31.930" Title="Vector from SU(2) to SO(3)?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15464" PostTypeId="1" AcceptedAnswerId="15487" CreationDate="2021-01-10T05:04:12.723" Score="2" ViewCount="123" Body="&lt;p&gt;I'm trying to simulate a basic circuit using the &lt;code&gt;PulseSimulator&lt;/code&gt; in Qiskit. The following Qiskit Pulse code works when I run it on the real device, but not when using the &lt;code&gt;PulseSimulator&lt;/code&gt;.  The job monitor tells me &lt;code&gt;Job Status: job incurred error&lt;/code&gt; and nothing else.&lt;/p&gt;&#xA;&lt;p&gt;Trying to run any gates native to the device causes an issue. If I remove &lt;code&gt;schedule += inst_sched_map.get('u2', [qubit], P0=0.0, P1=np.pi)&lt;/code&gt; then it runs fine, but I can't figure out what I'm doing wrong. I'd deeply appreciate any support. I'm using &lt;code&gt;qiskit 0.23.2&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#Essential Imports &#xA;import numpy as np&#xA;# Qiskit Imports&#xA;from qiskit.providers.aer import PulseSimulator&#xA;from qiskit import IBMQ, assemble&#xA;from qiskit.tools.monitor import job_monitor&#xA;import qiskit.pulse as pulse&#xA;&#xA;# Connect to an IBMQ Account and Backend&#xA;API_TOKEN = ''&#xA;IBMQ.save_account(API_TOKEN, overwrite=True)&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider()&#xA;backend = provider.get_backend(&amp;quot;ibmq_armonk&amp;quot;)&#xA;backend_pulse_simulator = PulseSimulator.from_backend(backend) #backend&#xA;&#xA;# Get information about the backend&#xA;qubit = 0&#xA;backend_defaults = backend.defaults()&#xA;backend_properties = backend.properties()&#xA;qubit_frequency_updated = backend_properties.qubit_property(qubit, 'frequency')[0]&#xA;inst_sched_map = backend_defaults.instruction_schedule_map&#xA;measure_schedule = inst_sched_map.get('measure', qubits=[qubit])&#xA;&#xA;# Assemble a job - circuit with a single qubit-&amp;gt; u2 gate -&amp;gt; measurement&#xA;num_shots_per_point = 1024&#xA;drive_chan = pulse.DriveChannel(qubit)&#xA;schedule = pulse.Schedule()&#xA;schedule += inst_sched_map.get('u2', [qubit], P0=0.0, P1=np.pi) # Removing this solves the issue - why?&#xA;schedule += measure_schedule &amp;lt;&amp;lt; schedule.duration               &#xA;pulse_program = assemble(schedule, &#xA;                        backend=backend_pulse_simulator, &#xA;                        meas_level=2, meas_return=&amp;quot;single&amp;quot;,&#xA;                        shots=num_shots_per_point,&#xA;                        schedule_los=[{drive_chan: qubit_frequency_updated}])&#xA;&#xA;# Run the job&#xA;job = backend_pulse_simulator.run(pulse_program)&#xA;job_monitor(job)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14424" LastEditorUserId="55" LastEditDate="2021-01-18T20:02:51.910" LastActivityDate="2021-01-18T20:02:51.910" Title="Job fails when using PulseSimulator: Job Status: job incurred error" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15465" PostTypeId="1" AcceptedAnswerId="15466" CreationDate="2021-01-10T09:26:14.210" Score="1" ViewCount="38" Body="&lt;p&gt;The source code for the graph state simulator from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504117&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Fast simulation of stabilizer circuits using a graph state representation&amp;quot;&lt;/a&gt; is supposed to be at &lt;a href=&quot;http://homepage.uibk.ac.at/homepage/c705/c705213/work/graphsim.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://homepage.uibk.ac.at/homepage/c705/c705213/work/graphsim.html&lt;/a&gt; but the link is dead and the WayBack machine did not archive it.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know where another copy can be found?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="55" LastEditDate="2021-01-18T20:02:36.913" LastActivityDate="2021-01-18T20:02:36.913" Title="Source code for graphsim" Tags="&lt;programming&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15466" PostTypeId="2" ParentId="15465" CreationDate="2021-01-10T09:29:47.433" Score="1" Body="&lt;p&gt;There appears to be a copy on GitHub at &lt;a href=&quot;https://github.com/marcusps/GraphSim&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/marcusps/GraphSim&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-01-10T09:29:47.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15467" PostTypeId="2" ParentId="15419" CreationDate="2021-01-10T16:04:24.103" Score="2" Body="&lt;p&gt;I think your best bet as of now is to derive such a table from the &lt;a href=&quot;https://quantumalgorithmzoo.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithm Zoo&lt;/a&gt;, which, as you mention although partly dated, would serve as a good starting point but would require reading between the lines.  For example, the Zoo mentions a speedup in &lt;a href=&quot;https://arxiv.org/abs/0804.1109&quot; rel=&quot;nofollow noreferrer&quot;&gt;solving exponential congruences&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$\tilde{O}(q^{3/8})$&lt;/span&gt; quantum, but a &lt;span class=&quot;math-container&quot;&gt;$\tilde{O}(q^{9/8})$&lt;/span&gt; classical algorithm.&lt;/p&gt;&#xA;&lt;p&gt;The Quantum Approximate Optimization Algorithm (QAOA) initially appears promising to get the speedups on NISQ-error devices, but it happens that &lt;em&gt;lower bounds&lt;/em&gt; on classical algorithms may also be dated and can be significantly improved once a quantum algorithm comes along. This is what has happened with QAOA for Max-E3LIN.  See the nice Quanta article &lt;a href=&quot;https://www.quantamagazine.org/quantum-computers-struggle-against-classical-algorithms-20180201/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-01-10T16:04:24.103" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15468" PostTypeId="1" AcceptedAnswerId="15469" CreationDate="2021-01-10T19:53:58.150" Score="4" ViewCount="94" Body="&lt;p&gt;Section 2.5 (4.3) of the Qiskit textbook, &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/proving-universality.html#4.3-Expanding-the-Gate-Set-&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt;, discusses the conjugation of &lt;span class=&quot;math-container&quot;&gt;$R_x(\theta)$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;. The following expression is given:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CX_{j,k}(R_x(\theta)\otimes 1) CX_{j,k}=\color{brown}{CX_{j,k}e^{i\frac{\theta}{2}(X\otimes1)}CX_{j,k}=e^{i\frac{\theta}{2}CX_{j,k}(X\otimes 1)CX_{j,k}}}=e^{i\frac{\theta}{2}X\otimes X}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am confused by the part highlighted in yellow. What exponentiation rules allow this? Could someone show me the intermediate steps or the relevant identities/rules to take us from the LHS to RHS of the highlighted part?&lt;/p&gt;&#xA;" OwnerUserId="14427" LastEditorUserId="14427" LastEditDate="2021-01-11T19:35:31.967" LastActivityDate="2021-01-11T19:35:31.967" Title="Conjugation of $R_x(\theta)$ with $CNOT$" Tags="&lt;quantum-gate&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15469" PostTypeId="2" ParentId="15468" CreationDate="2021-01-10T20:38:29.163" Score="4" Body="&lt;p&gt;This is an application of the following identity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Be^AB^{-1} = e^{BAB^{-1}}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is any &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; real or complex matrix and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is any invertible &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; real or complex matrix.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/strong&gt; First, recall that the &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_exponential&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix exponential&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^A = \sum_{k=0}^\infty \frac{1}{k!}A^k.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, note that for any integer &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(BAB^{-1})^k = BAB^{-1}BAB^{-1}\dots BAB^{-1} = BAA\dots AB^{-1} = BA^kB^{-1}\tag2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{BAB^{-1}} = \sum_{k=0}^\infty \frac{1}{k!}(BAB^{-1})^k = \sum_{k=0}^\infty \frac{1}{k!}BA^kB^{-1} = B \left(\sum_{k=0}^\infty \frac{1}{k!}A^k\right) B^{-1} = Be^AB^{-1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we used &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; in the second step. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-10T20:38:29.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15470" PostTypeId="1" CreationDate="2021-01-10T21:46:12.790" Score="2" ViewCount="131" Body="&lt;p&gt;From my understanding, Grover's algorithm is often misinterpreted as being able to find elements in lists. And when people try to understand the oracle function in terms of this, it leads to confusion.&lt;/p&gt;&#xA;&lt;p&gt;I understand that &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7037/grovers-algorithm-in-a-nutshell&quot;&gt;Grover's algorithm&lt;/a&gt; finds the input to a function that returns true in &lt;span class=&quot;math-container&quot;&gt;$\sqrt{n}$&lt;/span&gt; steps. (And that this is the more general purpose where it's useful.) But I don't see why this can't be used to also efficiently find elements in unsorted lists.&lt;/p&gt;&#xA;&lt;p&gt;For example, if the function is &lt;span class=&quot;math-container&quot;&gt;$x == 5$&lt;/span&gt; (that is, it returns TRUE when the input is 5, and false otherwise) and I have the list &lt;span class=&quot;math-container&quot;&gt;$\{4, 8, 2, 3, 1, 9, 10, 12, 5 \}$&lt;/span&gt; (so no duplicates of 5).  Grover's algorithm CAN find this in 3 steps, no?&lt;/p&gt;&#xA;&lt;p&gt;I guess the issue is that the efficiency of writing this function to return true if x==5 and return false if x &lt;span class=&quot;math-container&quot;&gt;$\neq 5$&lt;/span&gt; is costly enough that you don't actually get speedup (similar to what is said &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2149/grovers-algorithm-what-to-input-to-oracle&quot;&gt;here&lt;/a&gt;)?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&#xA;To try to make my question more clear. In a nutshell it is: &amp;quot;What exactly in the math of grover's algorithm prevents it from being used to efficiently find an element in an unsorted list?&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Possible answers:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Based on this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2110/grovers-algorithm-where-is-the-list&quot;&gt;question&lt;/a&gt;: &lt;strong&gt;Grover's cannot efficiently find elements in lists because the oracle specifically requires knowing where the state is in the database&lt;/strong&gt;, and by doing so makes it impossible to actually find something that was not already known.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;My confusion: Is it really impossible to write an oracle as I've written above that simply checks for a value in a set of inputs? (If what I wrote above isn't clear, then I think it's better explained in @gIS's answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/1419/does-the-oracle-in-grovers-algorithm-need-to-contain-information-about-the-enti?rq=1&quot;&gt;here&lt;/a&gt;. ) So there really is no algorithmic way of constructing a function to find a specific element in a list? Seems far fetched to say that it's impossible for a quantum computer to do this.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Grover's algorithm isn't efficient because encoding the classical information to quantum data is slow and makes the overall process inefficient.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;My confusion: then if everything is uploaded at first in a sort of &amp;quot;QuantumRAM&amp;quot; you only have to deal with this overhead once - so it would be efficient if multiple searches are performed.&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;&lt;strong&gt;Grover's algorithm isn't efficient because the oracle function that would check for the actual desired value in the list is prohibitively costly.&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;My confusion: Can this be made a bit more explicitly if it's true? How costly is such a function to check an element in a list. It seems very counterintuitive such a simple function would be too costly to be worth implementing.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="2660" LastEditDate="2021-01-12T01:42:19.327" LastActivityDate="2021-01-12T14:50:38.253" Title="Can Grover's algorithm be used to efficiently find elements in unsorted lists?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="4" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15471" PostTypeId="2" ParentId="15470" CreationDate="2021-01-11T03:48:29.140" Score="2" Body="&lt;p&gt;If I understand your question correctly, you want to know if you could use Grover's Algorithm to determine whether an unsorted list contains an element or not.&lt;/p&gt;&#xA;&lt;p&gt;Grover's Algorithm works by amplifying the amplitude of the state that produces the desired output. In this case, you are describing a quantum operation that &amp;quot;returns true&amp;quot; (i.e. flips a target qubit) when the input &amp;quot;==5&amp;quot; (perhaps the input is a four-qubit register and 5 is encoded with &lt;span class=&quot;math-container&quot;&gt;$|0101\rangle$&lt;/span&gt;). That is very easy to implement.&lt;/p&gt;&#xA;&lt;p&gt;Where the question becomes trickier is when you introduce the concept of an &amp;quot;unsorted list&amp;quot;. If you want to perform a search with Grover's Algorithm, you would need to encode the elements of this list in a qubit register (e.g. &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{n}}(|4\rangle + |8\rangle + ...)$&lt;/span&gt;). After running the algorithm for &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi\sqrt{n}}{4}$&lt;/span&gt; iterations and measuring the input register, you will get &lt;span class=&quot;math-container&quot;&gt;$|5\rangle$&lt;/span&gt; with high probability if it was part of the original superposition.&lt;/p&gt;&#xA;&lt;p&gt;So, you still need to go though all the elements of the list and encode it into the qubit register, which is &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt;, so you don't get a speedup. That is, unless the list is already encoded as a quantum register.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Tl;dr:&lt;/strong&gt; No, this is not a good application of Grover's Algorithm.&lt;/p&gt;&#xA;" OwnerUserId="12654" LastActivityDate="2021-01-11T03:48:29.140" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15472" PostTypeId="1" CreationDate="2021-01-11T05:38:25.367" Score="2" ViewCount="42" Body="&lt;p&gt;I'm trying to calcaute the eigenstates for the &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; gate, and I can follow the process up to finding eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, but I don't understand where the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; coefficient comes from for the answer:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;-\lambda &amp;amp; 1\\&#xA;1 &amp;amp; -\lambda&#xA;\end{bmatrix}v = 0 \implies v = \frac{1}{\sqrt{2}} \begin{bmatrix} 1\\ 1 \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the solution &lt;span class=&quot;math-container&quot;&gt;$\lambda = 1$&lt;/span&gt;, why does that &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt; show up?&lt;/p&gt;&#xA;" OwnerUserId="14432" LastEditorUserId="55" LastEditDate="2021-01-12T18:40:26.073" LastActivityDate="2021-01-12T18:40:26.073" Title="How to find the normalization factor of the eigenvectors of the $\sigma_x$ Pauli gate?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15473" PostTypeId="2" ParentId="15472" CreationDate="2021-01-11T06:04:12.310" Score="4" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{2}}$&lt;/span&gt; is the normalization constant to make sure the state/eigenvector is a unit vector.&lt;/p&gt;&#xA;&lt;p&gt;Note that: if &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} $&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\bigg| \bigg| |\psi \rangle \bigg| \bigg| = |1/\sqrt{2}|^2 + |1/\sqrt{2}|^2 = 1 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The reason for this is because in quantum mechanics, states are always normalized. It is one of the &lt;a href=&quot;https://theory.physics.manchester.ac.uk/%7Ejudith/AQMI/PHYS30201se1.xhtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;postulates of quantum mechanics&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-11T06:04:12.310" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15474" PostTypeId="2" ParentId="15472" CreationDate="2021-01-11T06:06:19.540" Score="0" Body="&lt;p&gt;It is normalized by dividing with the modulus or magnitude which is sqrt of (eigenvalue1 * 2 + eigenvalue2 * 2) = sqrt(2)&lt;/p&gt;&#xA;" OwnerUserId="13743" LastActivityDate="2021-01-11T06:06:19.540" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15475" PostTypeId="1" AcceptedAnswerId="15478" CreationDate="2021-01-11T07:21:14.697" Score="0" ViewCount="87" Body="&lt;p&gt;This message pops up when I run an mcrx gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;The mcrx gate needs a single qubit as target.&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is a part of code I run:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QC.mcrx(np.pi,[0,1,2],3)&#xA;   QC.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;'&lt;a href=&quot;https://i.stack.imgur.com/FleZX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FleZX.png&quot; alt=&quot;code with error&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14433" LastEditorUserId="55" LastEditDate="2021-01-12T18:40:35.803" LastActivityDate="2021-01-12T18:40:35.803" Title="A problem with application of multi controlled rotation gates" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-01-17T23:01:08.007" ContentLicense="CC BY-SA 4.0" />
  <row Id="15476" PostTypeId="2" ParentId="15470" CreationDate="2021-01-11T07:29:37.823" Score="3" Body="&lt;p&gt;There are two issues here. The first is the input requirements of Grover's algorithm. Let's take your specified example. You've got a list, say &lt;span class=&quot;math-container&quot;&gt;$\{4,8,2,3,1,9,10,12,5\}$&lt;/span&gt;, and you want to know if the element 5 is in it. In order to run Grover's search, you need a unitary operation that is capable of producing&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|0\rangle=(|4\rangle+|8\rangle+|2\rangle+|3\rangle+|1\rangle+|9\rangle+|10\rangle+|12\rangle+|5\rangle)/3.&#xA;$$&lt;/span&gt;&#xA;Let me emphasise that you do not know this list to the extent of being able to use it to create the unitary, otherwise you'd already know if 5 were in it. So, this seems like a rather big assumption.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, it depends on what you mean by &amp;quot;efficiently&amp;quot;. Normally, we'd say that if your list has &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; elements, and your running time is &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{n})$&lt;/span&gt;, that is &lt;em&gt;inefficient&lt;/em&gt; because we really measure running time as a function of the number of bits require to represent an element of the list, &lt;span class=&quot;math-container&quot;&gt;$N=\lceil\log_2(n)\rceil$&lt;/span&gt;, and hence the number of oracle calls is &lt;span class=&quot;math-container&quot;&gt;$\sim 2^{N/2}$&lt;/span&gt;, i.e. exponential (The running time of each oracle call in this case is &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt;, giving an overall run time of &lt;span class=&quot;math-container&quot;&gt;$~N2^{N/2}$&lt;/span&gt;). The key about Grover's is not that it gives you an efficient algorithm, but that the square root improvement in running time is actually really valuable.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-01-12T07:48:46.693" LastActivityDate="2021-01-12T07:48:46.693" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15477" PostTypeId="1" CreationDate="2021-01-11T07:36:33.563" Score="4" ViewCount="123" Body="&lt;p&gt;While going through the IBM qiskit textbook online, I came across the following question in section 2.2:&lt;/p&gt;&#xA;&lt;p&gt;Write the state: &lt;span class=&quot;math-container&quot;&gt;$ |\Psi⟩ =\frac{1}{\sqrt{2}}|00⟩+\frac{i}{\sqrt{2}}|01⟩$&lt;/span&gt; as two separate qubits.&lt;/p&gt;&#xA;&lt;p&gt;I understand tensor products with qubits, but I don't know how to even begin this problem. Does anyone have some advice on how to separate a state into its constituent qubits?&lt;/p&gt;&#xA;" OwnerUserId="14432" LastEditorUserId="10480" LastEditDate="2021-03-10T03:17:25.307" LastActivityDate="2021-03-10T03:17:25.307" Title="Writing state $ |\Psi⟩ =\frac{1}{\sqrt{2}}|00⟩+\frac{i}{\sqrt{2}}|01⟩$ as separate qubits (qiskit textbook)" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;tensor-product&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15478" PostTypeId="2" ParentId="15475" CreationDate="2021-01-11T07:45:52.753" Score="3" Body="&lt;p&gt;Here is a way to implement multi-controlled RX gate if you interested:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.circuit.library.standard_gates import RXGate&#xA;from qiskit.circuit import Parameter&#xA;import matplotlib.pyplot as plt&#xA;qr=QuantumRegister(4)&#xA;circ=QuantumCircuit(qr)&#xA;a=Parameter('a') # You can replace a with pi here &#xA;CCCRX=RXGate(a).control(3)&#xA;circ.append(CCCRX,qr)&#xA;print(circ)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;                &#xA;q0: ────■────&#xA;        │    &#xA;q1: ────■────&#xA;        │    &#xA;q2: ────■────&#xA;    ┌───┴───┐&#xA;q3: ┤ RX(a) ├&#xA;    └───────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can decompose this circuit to looks what is being implement underneath by executing the line of code: &lt;code&gt;circ.decompose().draw() &lt;/code&gt; which will output:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AHKc5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AHKc5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt; &#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you absolutely want to use &lt;strong&gt;&lt;code&gt;mcrx&lt;/code&gt; method&lt;/strong&gt; then this should do it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library.standard_gates import mcrx&#xA;import numpy as np&#xA;qr= QuantumRegister(4)&#xA;circ=QuantumCircuit(qr)&#xA;circ.mcrx(np.pi,[ qr[0], qr[1], qr[2] ],qr[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;note that if I decompose this circuit (like we did earlier), I will get the exact same circuit as the decomposed circuit on top (by replacing 'a' with &lt;code&gt;pi&lt;/code&gt; to the top circuit):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a8ewv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a8ewv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-11T08:16:40.200" LastActivityDate="2021-01-11T08:16:40.200" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15479" PostTypeId="2" ParentId="15477" CreationDate="2021-01-11T07:51:35.290" Score="2" Body="&lt;p&gt;Giving &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{2}}|00\rangle + \dfrac{i}{\sqrt{2}}|01\rangle$&lt;/span&gt; we can see that the first qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; so we can rewrite the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as a tensor product:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = |0\rangle \otimes \bigg( \dfrac{|0\rangle + i|1\rangle}{\sqrt{2}}\bigg)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the first qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the second qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + i|1\rangle}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-11T07:51:35.290" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15480" PostTypeId="2" ParentId="15477" CreationDate="2021-01-11T07:51:45.687" Score="7" Body="&lt;p&gt;As is the case with ordinary multiplication, tensor product distributes over addition, so we can pull &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on the first qubit out in front&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|\Psi⟩ &amp;amp;= \frac{1}{\sqrt{2}}|\color{red}{0}0\rangle+\frac{i}{\sqrt{2}}|\color{red}{0}1\rangle \\&#xA;&amp;amp;= \frac{1}{\sqrt{2}}\color{red}{|0\rangle}\otimes|0\rangle+\frac{i}{\sqrt{2}}\color{red}{|0\rangle}\otimes|1\rangle \\&#xA;&amp;amp;= \color{red}{|0\rangle}\otimes\left(\frac{1}{\sqrt{2}}|0\rangle+\frac{i}{\sqrt{2}}|1\rangle\right) \\&#xA;&amp;amp;= \color{red}{|0\rangle}\left(\frac{1}{\sqrt{2}}|0\rangle+\frac{i}{\sqrt{2}}|1\rangle\right)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and what remains in parenthesis is the state of the second qubit.&lt;/p&gt;&#xA;&lt;p&gt;Note that people generally tend to make &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product&quot; rel=&quot;noreferrer&quot;&gt;tensor product&lt;/a&gt; signs &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; implicit. I marked them explicitly to highlight the &lt;a href=&quot;https://en.wikipedia.org/wiki/Distributive_property&quot; rel=&quot;noreferrer&quot;&gt;distributive law&lt;/a&gt; familiar from ordinary multiplication.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-11T07:51:45.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15481" PostTypeId="2" ParentId="15470" CreationDate="2021-01-11T08:16:25.720" Score="0" Body="&lt;p&gt;Just to add few words. The Grover algorithm complexity is &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{n})$&lt;/span&gt; but the probem is complexity of the oracle. In this case, if you want to mark number 5, it can be done easily with logical function &lt;span class=&quot;math-container&quot;&gt;$f(5) = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x \ne 5$&lt;/span&gt;. Such function can be implemented with four-input AND gate, which is CCCC-NOT gate in quantum world. This gate can be composed of Toffoli gates. You would need three Toffoli gates to make implement 4 input AND and two Toffoli gate to uncompute ancilla qubits. As you probably know, Toffoli gates increases complexity of a quantum circuit and in current state of quantum computer development such circuit would suffer heavily from decoherence.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-11T08:16:25.720" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15482" PostTypeId="2" ParentId="15462" CreationDate="2021-01-11T08:32:54.990" Score="2" Body="&lt;p&gt;To erase a HDD with a random numbers generated by quantum computer is in theory possible. Lets imagine you want to generate bit strings of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, then you can simply put Hadamard gates on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Such simple circuit prepares equal superposition of all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit long strings. When you put measurement after the Hadamard gates and run the circuit on a quantum computer you will get a random bit string coming from uniform distribution.&lt;/p&gt;&#xA;&lt;p&gt;However, nowadays there are two main obstacles:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;A small number of qubits in current quantum processors (as far as I know, IBM offers 63 qubit processor). But this can be easily overcame but producing higher number of shorter bitstrings.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most importantly, you would need to run your circuit many times to produce 1.5 TB of random bits. Since 1.5 TB = 12 Tb and suppose that you are able to produce at 63 bits long stings (on the IBM computer I mentioned above), this will take 190 million of runs. This is possible, however, I do not think that IBM would allow such load of their systems now.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;To conclude, yes it is possible but because of small capacity of current quantum computer it is difficult to do so.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Just suggestion: try to use some physical generator of random numbers. They are based on measuring thermal noise. Produced random numbers are really random as in case of quantum computer. No algorithms like linear congruential generator is used.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-11T08:32:54.990" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15485" PostTypeId="2" ParentId="14967" CreationDate="2021-01-11T12:10:07.217" Score="2" Body="&lt;p&gt;Stoquastic Hamiltonians do not suffer from the &amp;quot;sign problem&amp;quot; since for any observable A &lt;span class=&quot;math-container&quot;&gt;$ \langle A \rangle = \frac{1}{Z} \cdot \text{Tr } Ae^{-\beta H} = \frac{1}{Z} \cdot \sum_c A(c)p(c) $&lt;/span&gt; and all weights &lt;span class=&quot;math-container&quot;&gt;$ p(c) \geq 0 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A simple proof:&lt;/p&gt;&#xA;&lt;p&gt;Define &lt;span class=&quot;math-container&quot;&gt;$ G = d I - H $&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$ d = \text{max}_i H_{ii} $&lt;/span&gt;. All matrix elements of &lt;span class=&quot;math-container&quot;&gt;$ G $&lt;/span&gt; are non-negative and so this holds for &lt;span class=&quot;math-container&quot;&gt;$G^n, \forall n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\langle A \rangle &amp;amp; = &#xA;\frac{1}{Z} \cdot \text{Tr } A e^{-\beta H} \\ &amp;amp;=  &#xA;\frac{1}{Z} \cdot \text{Tr } A e^{-\beta (dI - G)} \\ &amp;amp;= &#xA;\frac{e^{-\beta d}}{Z} \cdot \text{Tr } A e^{\beta G} \\ &amp;amp;=  &#xA;\frac{e^{-\beta d}}{Z} \cdot \sum_n  \frac{\beta^n}{n!} \text{Tr }A G^n \\ &amp;amp;= &#xA;\frac{e^{-\beta d}}{Z} \cdot \sum_{n} \sum_{x, y} \frac{\beta^n}{n!} \cdot \langle x|A|y \rangle \langle y|G^n|x \rangle&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and all weights &lt;span class=&quot;math-container&quot;&gt;$ e^{-\beta d} \cdot \frac{\beta^n}{n!} \cdot \langle y|G^n|x \rangle $&lt;/span&gt; are non-negative.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastEditorUserId="13109" LastEditDate="2021-01-11T14:20:17.603" LastActivityDate="2021-01-11T14:20:17.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15486" PostTypeId="1" CreationDate="2021-01-11T14:18:43.473" Score="8" ViewCount="122" Body="&lt;p&gt;Given an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit register &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, does there exist an efficient circuit implementing unitary operation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U |x\rangle|0\rangle = |x\rangle\Big(\sqrt{1 - x/2^n}\, |0\rangle + \sqrt{x/2^n}\, |1\rangle\Big)?$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I've found &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12104/preparing-a-quantum-state-from-a-classical-probability-distribution&quot;&gt;this related question&lt;/a&gt; from which the answer suggests to rotate and apply an &lt;span class=&quot;math-container&quot;&gt;$\arccos$&lt;/span&gt; approximation (which is very complicated, and only provides an approximation). Is there not an exact circuit implementing this from simple gates plus &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The context of this question is trying to implement Algorithm 1 from &lt;a href=&quot;https://arxiv.org/abs/1504.06987&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum speedup of Monte Carlo methods&lt;/a&gt; by Ashley Montanaro. They say (paraphrased):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Also observe that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be implemented efficiently, as it is a controlled rotation of one qubit dependent on the value of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; [59]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I did not find the linked reference (Quantum algorithm for approximating partition functions by Wocjan et al) particularly enlightening. And I don't believe they used the &lt;span class=&quot;math-container&quot;&gt;$\arccos$&lt;/span&gt; approximation either, as they did not include this in the error analysis. So I am confused as to how &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is actually implemented.&lt;/p&gt;&#xA;" OwnerUserId="9273" LastEditorUserId="55" LastEditDate="2021-01-12T18:42:59.417" LastActivityDate="2021-01-12T18:42:59.417" Title="Is there an efficient circuit implementing the unitary $U|x\rangle|0\rangle=|x\rangle\Big(\sqrt{1 - x/2^n}\,|0\rangle+\sqrt{x/2^n}|1\rangle\Big)?$" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;state-preparation&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15487" PostTypeId="2" ParentId="15464" CreationDate="2021-01-11T14:55:06.013" Score="3" Body="&lt;p&gt;The job incurred error with pulse can be the result of a timing problem in the different pulses execution,  but in your code the PulseSimulator() class must get backends provided by Terra such as FakeArmonk(), FakeParis()..etc. Here below an example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.test.mock import FakeArmonk&#xA;backend=FakeArmonk()&#xA;backend_pulse_simulator = PulseSimulator.from_backend(backend) # using FakeArmonk() backend&#xA;print(type(backend_pulse_simulator))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The FakeBackends() have the properties of the IBM Quantum devices data and are stored in  Qiskit Terra.&lt;/p&gt;&#xA;&lt;p&gt;Another way is to specify a PulseSystemModel() from a reel backend this time and pass the system model to the execution, here below an example with ibmq_armonk .&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;armonk_backend= provider.get_backend(&amp;quot;ibmq_armonk&amp;quot;)&#xA;armonk_model = PulseSystemModel.from_backend(armonk_backend)&#xA;backend_pulse_simulator=PulseSimulator()&#xA;job = backend_pulse_simulator.run(pulse_program, armonk_model)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;hope this helps&lt;/p&gt;&#xA;&lt;p&gt;Patrick&lt;/p&gt;&#xA;" OwnerUserId="9934" LastEditorUserId="9934" LastEditDate="2021-01-11T15:03:41.280" LastActivityDate="2021-01-11T15:03:41.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15489" PostTypeId="1" AcceptedAnswerId="15493" CreationDate="2021-01-11T23:15:56.307" Score="-2" ViewCount="68" Body="&lt;p&gt;I keep on getting this error no matter how many circuits I run in the backend 'ibmq_athens'. It says 'Max retries exceeded with URL'. Can someone explain why I am getting this error message.&lt;/p&gt;&#xA;&lt;p&gt;The main error message is as follows:&lt;/p&gt;&#xA;&lt;p&gt;IBMQBackendApiError: 'Error submitting job: 'HTTPSConnectionPool(host=\'s3.us-east.cloud-object-storage.appdomain.cloud\', port=443): Max retries exceeded with url: /us-east-quantum-computing-user-jobs-prod/qObject-5ffc48c0c3d09157546c8092.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;X-Amz-Credential=21ce861c64cc417e9a95f95263ecf8f7%2F20210111%2Fus-east%2Fs3%2Faws4_request&amp;amp;X-Amz-Date=20210111T124657Z&amp;amp;X-Amz-Expires=604800&amp;amp;X-Amz-SignedHeaders=host&amp;amp;X-Amz-Signature=6715779f30e144ac7e6e1f8ae316960473e57b251c6360b02d881fb8e9a47333 (Caused by SSLError(SSLError(&amp;quot;bad handshake: SysCallError(60, \'ETIMEDOUT\')&amp;quot;)))''&lt;/p&gt;&#xA;" OwnerUserId="12967" LastEditorUserId="12967" LastEditDate="2021-01-25T05:53:13.127" LastActivityDate="2021-01-25T05:53:13.127" Title="How to deal with job submission error in IBM?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-01-15T12:19:21.580" ContentLicense="CC BY-SA 4.0" />
  <row Id="15490" PostTypeId="2" ParentId="15109" CreationDate="2021-01-12T01:06:10.470" Score="0" Body="&lt;p&gt;By measuring all the qubits at the end of the code, I avoided the above-mentioned error message.&lt;/p&gt;&#xA;" OwnerUserId="14089" LastActivityDate="2021-01-12T01:06:10.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15491" PostTypeId="1" AcceptedAnswerId="15503" CreationDate="2021-01-12T10:59:59.753" Score="1" ViewCount="139" Body="&lt;p&gt;I am confused about the qubit ordering in circuit diagrams and endianness used in qiskit. As far as I understand, qiskit uses little endian (least significant qubit is rightmost) and while drawing circuits, qiskit plots least siginificant qubit at the top. So, we have the following table:&lt;/p&gt;&#xA;&lt;div class=&quot;s-table-container&quot;&gt;&#xA;&lt;table class=&quot;s-table&quot;&gt;&#xA;&lt;thead&gt;&#xA;&lt;tr&gt;&#xA;&lt;th&gt;qubits&lt;/th&gt;&#xA;&lt;th&gt;decimal representaion&lt;/th&gt;&#xA;&lt;th&gt;ckt&lt;/th&gt;&#xA;&lt;th&gt;statevector&lt;/th&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/thead&gt;&#xA;&lt;tbody&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;a href=&quot;https://i.stack.imgur.com/kUwaA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kUwaA.png&quot; alt=&quot;00_code&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&#xA;&lt;td&gt;[1 0 0 0]&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;a href=&quot;https://i.stack.imgur.com/VMEKJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VMEKJ.png&quot; alt=&quot;01_code&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&#xA;&lt;td&gt;[0 1 0 0]&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;a href=&quot;https://i.stack.imgur.com/KnnE5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KnnE5.png&quot; alt=&quot;10_code&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&#xA;&lt;td&gt;[0 0 1 0]&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt;&lt;/td&gt;&#xA;&lt;td&gt;&lt;a href=&quot;https://i.stack.imgur.com/tIjpu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tIjpu.png&quot; alt=&quot;11_code&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&#xA;&lt;td&gt;[0 0 0 1]&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;But, when I use QFT on the 2 qubit state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle(i.e.|2\rangle)$&lt;/span&gt;, the result I expect is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\Sigma_{y=0}^{3}exp(\frac{2\pi j*2y}{4})|y\rangle = \frac{1}{2}(|0\rangle - |1\rangle + |2\rangle - |3\rangle)$&lt;/span&gt; i.e. statevector [0.5,-0.5,0.5,-0.5], however the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit.library import QFT&#xA;from qiskit import Aer,execute&#xA;&#xA;qc2 = QuantumCircuit(2)&#xA;qc2.x(1)&#xA;# prepare the state |10&amp;gt;&#xA;&#xA;two_qbit_QFT_ckt = QFT(2)&#xA;qft_ckt_2 = qc2+two_qbit_QFT_ckt&#xA;# apply QFT on the state |10&amp;gt;&#xA;&#xA;state_backend = Aer.get_backend('statevector_simulator')&#xA;qft_res_2 = execute(qft_ckt_2,state_backend).result().get_statevector()&#xA;print(qft_res_2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;outputs [0.5,-0.5,0.5j,-0.5j]. I believe there is some qubit ordering problem that I am not getting right, but I can't figure out what it is. I have also seen the following two questions, but they didn't help much.&lt;br /&gt;&#xA;Q1: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/8244/12465&quot;&gt;Big Endian vs. Little Endian in Qiskit&lt;/a&gt;&lt;br /&gt;&#xA;Q2: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/10174/12465&quot;&gt;qiskit: IQFT acting on subsystem of reversed-ordered qubits state&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can you please help me find the problem?&lt;/p&gt;&#xA;" OwnerUserId="12465" LastActivityDate="2021-01-13T09:48:00.447" Title="Qubit ordering in qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15492" PostTypeId="1" CreationDate="2021-01-12T12:51:25.223" Score="3" ViewCount="182" Body="&lt;p&gt;In the Nielsen &amp;amp; Chuang book, section 5.3.1 page 226, there is a statement which goes like this:- (&lt;strong&gt;statement-1)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The quantum algorithm for order-finding is just the phase estimation&#xA;algorithm applied to the unitary operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$U|y\rangle ≡ |xy(mod N)\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Well, this statement is not a trivial one. And then one more,&#xA;(&lt;strong&gt;statement-2&lt;/strong&gt;)&#xA;(Eqn 5.37) defines the eigenstates of the unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|u_s\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}\exp\left(\frac{-2\pi isk}{r}\right)\left|x^k\text{ mod } N\right\rangle \text{ for integer } 0 \leq s \leq r-1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now, there are two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do we know &lt;strong&gt;statement-1&lt;/strong&gt;? How do we know that the unitary operator which we have defined here, would give us the solution to the order finding problem?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How do we arrive at &lt;strong&gt;statement-2&lt;/strong&gt;? Eigenstates of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are just the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, so somebody might have calculated them, right? (For example, by solving &lt;span class=&quot;math-container&quot;&gt;$U-\lambda I= 0$&lt;/span&gt;). However, I don't see how one would arrive at something so elegant. Or is it just some of those &amp;quot;define&amp;quot; statements?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I would be glad if I get an answer to any of these questions.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="10480" LastEditDate="2021-03-09T18:35:07.833" LastActivityDate="2021-03-09T18:35:07.833" Title="Application of QFT to Order-finding" Tags="&lt;algorithm&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;quantum-fourier-transform&gt;&lt;order-finding&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15493" PostTypeId="2" ParentId="15489" CreationDate="2021-01-12T13:37:45.327" Score="1" Body="&lt;p&gt;This is duplicate of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14824/error-while-trying-to-execute-the-quantum-circuits-in-ibmq&quot;&gt;Error while trying to execute the Quantum Circuits in IBMQ&lt;/a&gt; . It's caused by your ISP blocking IBM Cloud object storage URL (used by IBM Q).&lt;/p&gt;&#xA;&lt;p&gt;My answer from the other post:&lt;/p&gt;&#xA;&lt;p&gt;This is caused by &lt;code&gt;safebrowse.io&lt;/code&gt; 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: &lt;a href=&quot;https://howtoremove.guide/safebrowse-io-virus/#:%7E:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://howtoremove.guide/safebrowse-io-virus/#:~:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2021-01-12T13:37:45.327" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15494" PostTypeId="1" AcceptedAnswerId="15496" CreationDate="2021-01-12T14:01:07.793" Score="2" ViewCount="42" Body="&lt;p&gt;The textbook on Qiskit.org has&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;When the H-gate is applied to first qubit, it creates superposition and we get the state &lt;span class=&quot;math-container&quot;&gt;$|0+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Shouldn't it be:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as explained in some answers here: (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14066/how-do-i-apply-the-hadamard-gate-to-one-qubit-in-a-two-qubit-pure-state/14068#14068?newreg=85fcc5ecdfcb40c88148a9863d14533b&quot;&gt;How do I apply the Hadamard gate to one qubit in a two-qubit pure state?&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="14446" LastEditorUserId="55" LastEditDate="2021-01-13T11:42:41.617" LastActivityDate="2021-01-13T11:42:41.617" Title="Is there an error on Qiskit.org textbook with the superdense coding section?" Tags="&lt;qiskit&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15496" PostTypeId="2" ParentId="15494" CreationDate="2021-01-12T14:20:57.817" Score="2" Body="&lt;p&gt;Qiskit's coding of the qubits is  made such that Qiskit's least significant bit has the lowest index (0) and will be written at the right of the state, so instead of writing a qubit like &lt;span class=&quot;math-container&quot;&gt;$ |q_0 q_1 ... q_n \rangle $&lt;/span&gt;, it will rather be &lt;span class=&quot;math-container&quot;&gt;$ |q_n q_{n-1} ... q_0 \rangle $&lt;/span&gt;, explaining the difference between the Qiskit explanation and the explanation from the question you pointed. The first qubit is on the far right, so Hadamard will be applied on the one in the far right, thus you have the first result you pointed.&lt;/p&gt;&#xA;&lt;p&gt;Hope this clears your question, if not please tell me :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-01-12T14:20:57.817" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15497" PostTypeId="2" ParentId="15470" CreationDate="2021-01-12T14:50:38.253" Score="0" Body="&lt;p&gt;The problem is that you simplified the question too much, to the point of uselessness. What does it even mean to &amp;quot;find&amp;quot; the element 5? What are you searching for? Don't you already know that the answer is 5?&lt;/p&gt;&#xA;&lt;p&gt;Perhaps what you have in mind is a phone-book search, where you have an unsorted database of pairs &amp;quot;person&amp;quot;-&amp;quot;phone number&amp;quot;? In this case the question makes sense: your oracle recognizes the &amp;quot;person&amp;quot;, and with Grover you find their associated &amp;quot;phone number&amp;quot;. The &amp;quot;possible answer 1&amp;quot; poses no obstacle, an oracle can be easily constructed that returns 1 if the person is the one you want, and you don't need to know their phone number in order to construct the oracle. The &amp;quot;possible answer 3&amp;quot; also poses no obstacle, the oracle is obviously efficient.&lt;/p&gt;&#xA;&lt;p&gt;There are several problems with making Grover work here, though. The first is &amp;quot;possible answer 2&amp;quot;: you need first to read this data, which takes time &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, which is the same time you need to actually find the phone number, and is anyway larger than Grover's &lt;span class=&quot;math-container&quot;&gt;$\sqrt{n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You mention the possibility of pre-loading this data, so that Grover would be actually useful if you make several queries to the database. It's not. First of all, you need to create efficiently the huge superposition of all the database entries. How are you going to do that efficiently? In the case where Grover is actually useful you just need to create a superposition of all bitstrings, and that is very easy to do, you just apply a Hadamard in each qubit individually.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, if you want to do several queries to your database, what you should actually do is sort it. It takes time &lt;span class=&quot;math-container&quot;&gt;$O(n\log n)$&lt;/span&gt;, and subsequent queries take time &lt;span class=&quot;math-container&quot;&gt;$O(\log n)$&lt;/span&gt; each. With Grover you'd need time &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; to read the database, and subsequent queries would take time &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{n})$&lt;/span&gt; each.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-01-12T14:50:38.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15500" PostTypeId="1" AcceptedAnswerId="15501" CreationDate="2021-01-12T20:09:42.140" Score="-1" ViewCount="59" Body="&lt;p&gt;I have been reading &amp;quot;&lt;strong&gt;Introduction to Quantum Information Science&lt;/strong&gt;&amp;quot; by &lt;em&gt;Masahito Hayashi, Satoshi Ishizaka,Akinori Kawachi, Gen Kimura and Tomohiro Ogawa&lt;/em&gt;; Springer Publication. I'm currently in the density operator section, page 96. There they are considering two ensemble states as follows &lt;span class=&quot;math-container&quot;&gt;$s_1 = \left\{ \frac{1}{2}, \frac{1}{2}; |0\rangle,|1\rangle \right\}$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$s_2 = \left\{ \frac{1}{2}, \frac{1}{2}; |+\rangle,|-\rangle \right\}$&lt;/span&gt;. Let there be a arbitary physical quantity be &lt;span class=&quot;math-container&quot;&gt;$A = \sum_a aP_a$&lt;/span&gt; (Spectral Decomposition). Hence they are doing this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;Pr(A=a|s_2) = \frac{1}{2} \langle+|P_a|+\rangle + \frac{1}{2} \langle-|P_a|-\rangle = \frac{1}{2} \langle0|P_a|0\rangle + \frac{1}{2} \langle1|P_a|1\rangle = Pr(A=a|s_1)\tag1&#xA; $$&lt;/span&gt;&#xA;They are concluding that that the uniqueness of the states &lt;span class=&quot;math-container&quot;&gt;$s_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_2$&lt;/span&gt; are getting lost in equation (1), hence they are suggesting below form(2):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Pr(A=a|s) = \sum_i p_iPr(A=a|\text{ }|\psi_i\rangle) = \sum_i p_i \langle\psi_i|P_a|\psi_i\rangle \tag2&#xA;$$&lt;/span&gt;&#xA;They are claiming that the above representation[2] is unique&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In order to get rid of non-uniqueness defect...&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;. But i cant understand how? To me both(1) &amp;amp; (2) are same. I'm adding the snapshot too.&lt;a href=&quot;https://i.stack.imgur.com/aAxmB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aAxmB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12154" LastEditorUserId="55" LastEditDate="2021-01-13T11:45:04.510" LastActivityDate="2021-01-13T11:45:04.510" Title="Uniqueness of Density Operator" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15501" PostTypeId="2" ParentId="15500" CreationDate="2021-01-12T20:35:02.607" Score="2" Body="&lt;p&gt;Write an ensemble as &lt;span class=&quot;math-container&quot;&gt;$\{(p_i,\psi_i)\}_i$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; probabilities and &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; pure states. Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_1\equiv \{(p_i,\psi_i)\}_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_2\equiv \{(q_i,\phi_i)\}_i$&lt;/span&gt; be two such ensembles.&#xA;Suppose that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_i p_i \lvert \psi_i\rangle\!\langle\psi_i\rvert&#xA;= \sum_i q_i \lvert \phi_i\rangle\!\langle\phi_i\rvert$$&lt;/span&gt;&#xA;(you can verify that this is the case in your example).&lt;/p&gt;&#xA;&lt;p&gt;Your statement amounts to observing that, performing some measurement &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, the probability of getting the outcome &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; with the ensemble &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_1$&lt;/span&gt; is the same as that with the ensemble &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This probability reads, for &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_1$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Pr}(A=a|\mathcal I_1) = \sum_j p_j \mathrm{Pr}(A=a|\psi_j)&#xA;= \sum_j p_j \langle\psi_j|P_a|\psi_j\rangle&#xA;= \mathrm{Tr}\left(P_a \sum_j p_j |\psi_j\rangle\!\langle\psi_j|\right).\tag A$$&lt;/span&gt;&#xA;You similarly get for &lt;span class=&quot;math-container&quot;&gt;$\mathcal I_2$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Pr}(A=a|\mathcal I_2) = \mathrm{Tr}\left(P_a \sum_j q_j |\phi_j\rangle\!\langle\phi_j|\right).\tag B$$&lt;/span&gt;&#xA;But by assumption the sum in the parentheses of (A) and (B) is the same, hence the conclusion&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-01-12T20:35:02.607" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15502" PostTypeId="2" ParentId="5661" CreationDate="2021-01-12T21:24:43.527" Score="2" Body="&lt;p&gt;&lt;strong&gt;CW from self-answer&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Reviewing Farhi et al. on quantum money from knots, one can say that the Markov chain applied by the verification algorithm that walks along the Reidemeister graph is far from ergodic, as the graph includes &lt;em&gt;many&lt;/em&gt; individual connected components corresponding to separate knots.  Each bill corresponds to a uniform superposition over individual knots; however, although each bill is an eigenstate of the Markov chain, &lt;strong&gt;the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; of each eigenstate must be &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&lt;/strong&gt;.  Up to some technicalities, the Alexander polynomial serves to index each connected component of the Reidemeister graph.&lt;/p&gt;&#xA;&lt;p&gt;Similarly the putative quantum money from graphs considered by Farhi et al. includes bills corresponding to eigenstates of a Markov chain of a walk along the Cayley graph of permutations of adjacency matrices, with the graph spectrum of the adjacency matrix serving to index the eigenstate; nonetheless &lt;strong&gt;the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; of each eigenstate is also &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Turning now to quantum money from modular forms considered by Kane, the Hecke operators used therein are all commuting, and although they share an eigenbasis (because they commute), individual Hecke operators and individual bills must have &lt;strong&gt;different eigenvalues&lt;/strong&gt;; indeed for security purposes Kane requires a sufficient separation of eigenvalues of the Hecke operators.  These eigenvalues of the Hecke operators are what serve to index the quantum money (as opposed to the knot invariants/graph invariants considered above).&lt;/p&gt;&#xA;&lt;p&gt;Kane constructs a Hermitian matrix based on the number of ideal classes to correspond to the Hecke operators; this Hermitian matrix is easy enough to work with so that he can perform Hamiltonian simulation thereon (to create his commuting unitary operators), and he applies quantum phase estimation with his operators &lt;span class=&quot;math-container&quot;&gt;$U_p$&lt;/span&gt; and samples therefrom to determine the specific eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_1,\lambda_2,\cdots$&lt;/span&gt; for the different Hecke operators/various primes &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(I still only have a limited/next-to-nil understanding of modular forms/Hecke operators, and only rarely have a fleeting sense of their beauty!)&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-01-12T21:24:43.527" CommentCount="0" CommunityOwnedDate="2021-01-12T21:24:43.527" ContentLicense="CC BY-SA 4.0" />
  <row Id="15503" PostTypeId="2" ParentId="15491" CreationDate="2021-01-13T09:48:00.447" Score="3" Body="&lt;p&gt;I looked at what you pointed out and I think I figured it out. So if you look at the general form of the circuit for the QFT you have this (from &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt; )&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fRi6p.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fRi6p.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;and if you compare with the circuit from the QFT class in Qiskit, you notice they are the same. However, if you look at the implementation they do &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html#8.-Qiskit-Implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, notice they say « Note: Remember that Qiskit's least significant bit has the lowest index (0), thus the circuit will be mirrored through the horizontal in relation to the image in section 5. » and then they build the mirror of what we have in the first picture.&lt;/p&gt;&#xA;&lt;p&gt;This seems to be a known issue since it has been pointed out &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/4849&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but in the meantime I found two workarounds. The first one is to use the implementation they create in the Qiskit textbook, just take their functions and you have the QFT working with the little endian. The second one is to still use the QFT class but with some tricks. For example with the code you put:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit.library import QFT&#xA;from qiskit import Aer,execute&#xA;&#xA;qc2 = QuantumCircuit(2)&#xA;qc2.x(1)&#xA;# prepare the state |10&amp;gt;&#xA;&#xA;two_qbit_QFT_ckt = QFT(2,do_swaps=False,inverse=True) #here are the changes&#xA;qft_ckt_2 = qc2+two_qbit_QFT_ckt&#xA;rev_qft_ckt_2 = qft_ckt_2.reverse_bits() #same as putting swaps in the end of the circuit&#xA;# apply QFT on the state |10&amp;gt;&#xA;&#xA;state_backend = Aer.get_backend('statevector_simulator')&#xA;qft_res_2 = execute(rev_qft_ckt_2,state_backend).result().get_statevector()&#xA;print(qft_res_2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You take the inverse QFT without the swaps, giving actually the right QFT with the Qiskit notations, then add yourself the swaps in the end by reversing the qubits, and it gives you the result you want :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[ 0.5-6.123234e-17j -0.5+6.123234e-17j  0.5-6.123234e-17j&#xA; -0.5+6.123234e-17j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I hope this will help you, if you need anything else feel free to ask! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-01-13T09:48:00.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15504" PostTypeId="1" AcceptedAnswerId="15516" CreationDate="2021-01-13T10:00:38.467" Score="3" ViewCount="117" Body="&lt;p&gt;Given Bell states &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B} = \{\left\vert \phi^{\pm} \right\rangle,  \left\vert \psi^{\pm} \right\rangle\}$&lt;/span&gt;, show that Quantum Fourier Transform(QFT) maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}\rightarrow \mathcal{B}$&lt;/span&gt; by keeping &lt;span class=&quot;math-container&quot;&gt;$\left\vert \psi^{-} \right\rangle $&lt;/span&gt; invariant.&lt;/p&gt;&#xA;&lt;p&gt;After applying the QFT on Bell states, I found&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT \left\vert \phi^{+} \right\rangle = \frac{1}{2\sqrt{2}}(2\left\vert0 \right\rangle + (1-i)\left\vert 1 \right\rangle + (1+i) \left\vert3 \right\rangle) \\&#xA;QFT \left\vert \phi^{-} \right\rangle = \frac{1}{2\sqrt{2}}((1+i) \left\vert1 \right\rangle +2\left\vert2 \right\rangle + (1-i)\left\vert 3 \right\rangle ) \\&#xA;QFT \left\vert \psi^{+} \right\rangle = \frac{1}{2\sqrt{2}}(2\left\vert0 \right\rangle + (i-1)\left\vert 1 \right\rangle - (1+i) \left\vert3 \right\rangle) \\&#xA;QFT \left\vert \psi^{-} \right\rangle = \frac{1}{2\sqrt{2}}((1+i) \left\vert1 \right\rangle -2\left\vert2 \right\rangle + (1-i)\left\vert 3 \right\rangle ).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can anyone please help, how to proceed from here ?&lt;/p&gt;&#xA;" OwnerUserId="14275" LastEditorUserId="10480" LastEditDate="2021-01-14T05:38:54.700" LastActivityDate="2021-01-14T05:38:54.700" Title="Show that Quantum Fourier Transform maps Bell states to Bell states" Tags="&lt;quantum-state&gt;&lt;quantum-fourier-transform&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15505" PostTypeId="1" AcceptedAnswerId="15514" CreationDate="2021-01-13T10:46:37.293" Score="0" ViewCount="75" Body="&lt;p&gt;How can I get statevector and/or blochsphere representation of qubits of my choice. For example I have 3 qubits with different gates being applied on each qubit. the qiskit state_vector simulator gives bloch sphere representation of states for all qubits in the circuit and qasm simulator also plots histogram of probability for all qubits in the circuit. How can I get the single, for instance, second qubit's probability histogram and/or bloch sphere representation?&lt;/p&gt;&#xA;&lt;p&gt;Secondly, can we use 15 qubits for simulation and plot probability histogram and/or bloch sphere or two qubits only, because qiskit is giving memory error since it takes the whole circuit for plotting.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11539" LastEditorUserId="55" LastEditDate="2021-01-17T22:05:55.610" LastActivityDate="2021-01-17T22:05:55.610" Title="how to plot probability histogram and/or bloch sphere of single qubit in multi-qubit quantum circuit in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;bloch-sphere&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15506" PostTypeId="1" AcceptedAnswerId="15513" CreationDate="2021-01-13T14:39:01.700" Score="3" ViewCount="103" Body="&lt;p&gt;I'm trying to implement a circuit wich prepare this three qubits state :&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}(|100\rangle + |010\rangle + |001\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems that the three qubits W-state can produce this state, and I found this &lt;a href=&quot;https://notebook.community/antoniomezzacapo/qiskit-tutorial/community/teach_me_qiskit_2018/w_state/W%20State%201%20-%20Multi-Qubit%20Systems&quot; rel=&quot;nofollow noreferrer&quot;&gt;code&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But I have seen a simple circuit &lt;a href=&quot;https://medium.com/transilvaniaquantum/simulating-the-monty-hall-problem-on-a-quantum-computer-71613f54f0bf&quot; rel=&quot;nofollow noreferrer&quot;&gt;on this page&lt;/a&gt; wich seems to work, but I don't understand how the person find the Ry rotation of 1.321, does someone could explain me how 1.321 is found?&lt;/p&gt;&#xA;" OwnerUserId="12910" LastEditorUserId="9006" LastEditDate="2021-01-14T11:59:56.653" LastActivityDate="2021-01-14T11:59:56.653" Title="Three qubits W-state" Tags="&lt;quantum-state&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15508" PostTypeId="1" CreationDate="2021-01-13T16:15:18.507" Score="2" ViewCount="57" Body="&lt;p&gt;Using the Qiskit textbook I have been using a VQE to find the ground state energy of Hydrogen at different interatomic distances on a quantum machine. However, the average energy value I will always calculate at a interatomic distance of 0.735 A (groundstate) is ~ 1.06 Hartrees while the exact value calculated with the NumpyEigensolver is 1.1373... Hartrees. I am unable to see what is causing this inaccuracy and at higher interatomic distances this inaccuracy increases. In some cases the VQE values for the ground energy are above even above the HartreeFock energy given by:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;VQE_result.hartree_fock_energy&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I was under the impression that the qubits are initialised in the HartreeFock initial state so how can the VQE energy given by:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;VQE_result.total_energies&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;be above its initial state if the VQE is meant to be minimizing the value? Unless I am miss understanding how the algorithm is working? Is this inaccuracy just an effect of quantum noise and decoherence in NISQ era machinery or is this an error with my method.&lt;/p&gt;&#xA;&lt;p&gt;This is a graph of my VQE results (Blue) and the exact values (Orange) to demonstrate the inaccuracy:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZJfy2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZJfy2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The main loop of my code which retrieves these values is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for i in np.arange(0.25,4.25,0.25):&#xA;        molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                                      ['H', [0., 0., i]]],&#xA;                            charge=0, multiplicity=1)&#xA;&#xA;        driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;&#xA;        #Map fermionic hamiltonian to qubit hamiltonian&#xA;        transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.PARITY,&#xA;                                        two_qubit_reduction=True,&#xA;                                        freeze_core=True)&#xA;&#xA;&#xA;        numpy_solver = NumPyMinimumEigensolver()&#xA;            &#xA;        #Initialize the VQE solver&#xA;            &#xA;        vqe_solver = VQEUCCSDFactory(QuantumInstance(backend = backend, shots = 1024))&#xA;&#xA;        #Ground state algorithm&#xA;        calculation_VQE = GroundStateEigensolver(transformation, vqe_solver)&#xA;       &#xA;            &#xA;        calculation_numpy = GroundStateEigensolver(transformation, numpy_solver)&#xA;&#xA;        #Calculate results&#xA;        VQE_result = calculation_VQE.solve(driver)&#xA;        VQE_results_array.append(VQE_result.total_energies)&#xA;        hf_energies.append(VQE_result.hartree_fock_energy)&#xA;        NRE.append(VQE_result.nuclear_repulsion_energy)&#xA;            &#xA;&#xA;        Numpy_result = calculation_numpy.solve(driver)&#xA;        Numpy_result_array.append(Numpy_result.total_energies)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13724" LastEditorUserId="55" LastEditDate="2021-01-17T22:06:11.787" LastActivityDate="2021-02-16T23:02:40.203" Title="How to improve accuracy of ground energy values from a VQE" Tags="&lt;programming&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15509" PostTypeId="2" ParentId="15508" CreationDate="2021-01-13T16:42:31.113" Score="1" Body="&lt;p&gt;One way to improve the accuracy of your answer is to increase the number of shots. I see that you set your shots to 1024, so you might want to increase that to 8192 shots (the maximum shots allowed by Qiskit).&lt;/p&gt;&#xA;&lt;p&gt;You are right that noise is the problem. The noise are being introduced both by the gate operations and the read-out/measurement process. To fix the noise at the read-out stage, you can use &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurement error mitigation&lt;/a&gt; technique. Since you are using Aqua, this can be implement directly through your quantum instance as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.ignis.mitigation.measurement import CompleteMeasFitter&#xA;&#xA;quantum_instance = QuantumInstance(backend,&#xA;                                   shots = 8192,&#xA;                                   initial_layout = None,&#xA;                                   optimization_level = 3,&#xA;                                   measurement_error_mitigation_cls = CompleteMeasFitter,&#xA;                                   cals_matrix_refresh_period = 0)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then if you want to go a step further, and try to correct the errors from the quantum circuit, you can use the technique from this paper: &lt;a href=&quot;http://%20https://arxiv.org/pdf/1805.04492.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Extending the computational reach of a noisy superconducting quantum processor&lt;/a&gt;&#xA;Which is essentially, pro-long the circuit execution time to allow more decoherence, then use that bad result along with the good result (when you didn't pro-long the circuit execution time) to do an extrapolation to obtain a better result. There is a naive implementation of this, by essentially, extending your circuit execution time by executing the exact but longer version of the circuit . That is, suppose of executing the circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ──■──&#xA;     ┌─┴─┐&#xA;q_1: ┤ X ├&#xA;     └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;you instead execute the circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;           ░       ░      &#xA;q_0: ──■───░───■───░───■──&#xA;     ┌─┴─┐ ░ ┌─┴─┐ ░ ┌─┴─┐&#xA;q_1: ┤ X ├─░─┤ X ├─░─┤ X ├&#xA;     └───┘ ░ └───┘ ░ └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;How did your result look like when you execute this on the &lt;code&gt;qasm_simulator&lt;/code&gt;? Was it better? One of the thing about VQE is also about figuring out the right Ansatz or Variation_form (the parameterized quantum circuit to create your trial state) but it seems like you are already using UCCSD Ansatz and for &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; that should be more than enough. However, UCCSD usually have a long circuit representation so be careful of that as you move forward to larger system... What is your circuit depth anyway for this particular problem?&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-13T16:49:44.383" LastActivityDate="2021-01-13T16:49:44.383" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15510" PostTypeId="2" ParentId="1365" CreationDate="2021-01-13T16:47:27.457" Score="1" Body="&lt;p&gt;Mathematically pure and mixed state can be distinguished by computing &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho^2)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the density matrix of the given state. In case of a pure state &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho^2)=1$&lt;/span&gt; and for mixed state it is less than &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14460" LastEditorUserId="10480" LastEditDate="2021-01-14T05:29:03.900" LastActivityDate="2021-01-14T05:29:03.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15511" PostTypeId="2" ParentId="1276" CreationDate="2021-01-13T17:00:05.973" Score="1" Body="&lt;p&gt;As your question suggests there is little literature on the subject. Also I wrote a blog post about an algorithm I created that can sort a list of numbers using a quantum algorithm.&lt;/p&gt;&#xA;&lt;p&gt;You can find it &lt;a href=&quot;http://128mots.com/index.php/en/2021/01/13/quantum-sort-algorithm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this article, I propose a quantum sort algorithm that allows you to sort a list of integers coded on two qubits. I have found that there is little literature on the subject. This algorithm can be used and can be used as a basis for solving sorting problems on an unsorted list of integers.&lt;/p&gt;&#xA;&lt;p&gt;To solve this problem we will first create a quantum circuit that allows you to measure if a figure is lower than another for this the intuition is to be based on a circuit similar to a classic circuit of comparison of magnitude at 2 qubit.&lt;/p&gt;&#xA;&lt;p&gt;The idea of ​​my algorithm is to permute 4 digits using control qubits which will be in superimposed state.&lt;/p&gt;&#xA;&lt;p&gt;4 Hadamard quantum gates are used to implement these permutations and take advantage of the superposition of the Qubit ‘control’ register&lt;/p&gt;&#xA;&lt;p&gt;In other words in the circuit above we see that we start the circuit by initializing the registers &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; with its list of unsorted numbers, here (&lt;span class=&quot;math-container&quot;&gt;$a = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b = 2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$m = 3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$n = 1$&lt;/span&gt;) .&lt;/p&gt;&#xA;&lt;p&gt;The permutation circuit which is controlled by a superimposed qubit register allows the list to be permuted in quantum superposition.&lt;/p&gt;&#xA;&lt;p&gt;Thus we obtain on the qubit q0 the quantum state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; if the permuted list is sorted in a decreasing way otherwise the quantum state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this article you will find the implementation of the algorithm in python and in OpenQASM. If you have any further questions, please do not hesitate to contact me.&lt;/p&gt;&#xA;" OwnerUserId="14462" LastEditorUserId="9006" LastEditDate="2021-01-14T11:49:26.600" LastActivityDate="2021-01-14T11:49:26.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15512" PostTypeId="2" ParentId="15477" CreationDate="2021-01-13T17:00:30.363" Score="1" Body="&lt;p&gt;Other important methods to check if a state is a separable or entangled are the Peres-Horodecki criterion and Schmidt decomposition.&lt;/p&gt;&#xA;" OwnerUserId="14461" LastEditorUserId="10480" LastEditDate="2021-01-14T05:42:51.837" LastActivityDate="2021-01-14T05:42:51.837" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15513" PostTypeId="2" ParentId="15506" CreationDate="2021-01-13T18:24:50.940" Score="2" Body="&lt;p&gt;This is because &lt;span class=&quot;math-container&quot;&gt;$RY(1.321)$&lt;/span&gt; put the qubit from the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0\rangle = |0\rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle = \sqrt{\dfrac{2}{3}} |0\rangle + \sqrt{\dfrac{1}{3}} |1\rangle $&lt;/span&gt;. One of the thing to note here is also that &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; is rotating around the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; axis so it is the rotation gate that we want to use if we want to keep the amplitude of the quantum state real.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6rGKo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6rGKo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;From there you can work out the rest of the circuit.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-13T18:24:50.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15514" PostTypeId="2" ParentId="15505" CreationDate="2021-01-13T18:30:42.947" Score="1" Body="&lt;p&gt;For the statevector, I do not think there is an official way to print out only the statevector of a single or multiple qubits in a circuit. You can probably do it by parsing through the statevector that is returned for the whole circuit, and doing some math based on the statevector returned and the state the qubit(s) is in for each state in the statevector.&lt;/p&gt;&#xA;&lt;p&gt;For the probability though, it is much easier to do this.&lt;/p&gt;&#xA;&lt;h3&gt;Plotting probability of specific qubits&lt;/h3&gt;&#xA;&lt;p&gt;If you only care about the probability of certain qubits, and will not need the probability for the others, you can set up the circuit to only measure the qubits you care about:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(15, 2)&#xA;qc.x(0)&#xA;&#xA;# This will only measure qubit 0 and qubit 5&#xA;qc.measure([0, 5], [0, 1])&#xA;&#xA;state_sim = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;job = execute(qc, sim)&#xA;counts = job.result().get_counts(qc)&#xA;&#xA;print(counts)&#xA;'''&#xA;Output:&#xA;{'01': 1024}&#xA;Right qubit is qubit 0, left qubit is qubit 5. &#xA;You can then call plot_histogram on counts.&#xA;'''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to measure the whole circuit but then want to view the probability of only a single qubit, you can parse through the &lt;code&gt;counts&lt;/code&gt; dictionary to retrieve the data for only the qubit you care about:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3, 3)&#xA;qc.h(range(3))&#xA;qc.measure(range(3), range(3))&#xA;&#xA;state_sim = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;job = execute(qc, sim)&#xA;counts = job.result().get_counts(qc)&#xA;&#xA;print(counts)&#xA;&#xA;'''&#xA;Output&#xA;{&#xA;'000': 127, '001': 127, '010': 133, '011': 108, &#xA;'100': 115, '101': 146, '110': 132, '111': 136&#xA;}&#xA;'''&#xA;&#xA;# New dictionary to store out results in.&#xA;new_counts = {'0': 0,&#xA;              '1': 0}&#xA;&#xA;# The qubit we want the probability for&#xA;show_qubit = 1&#xA;&#xA;# Loop through the counts dictionary, adding the value to the &#xA;#  respective key in new_counts based on what state the show_qubit is in&#xA;for count in counts:&#xA;    count_idx = (len(count) - 1) - show_qubit&#xA;    new_counts[count[count_idx]] = new_counts[count[count_idx]] + counts[count]&#xA;&#xA;print(new_counts)&#xA;plot_histogram(new_counts)&#xA;&#xA;'''&#xA;Output:&#xA;{'0': 515, '1': 509}&#xA;~Histogram picture below~&#xA;'''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zp0TP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zp0TP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to view the probability of multiple qubits in this way, it is possible, but you will need to edit the loop and new_dictionary a bit to allow for multiple qubits.&lt;/p&gt;&#xA;&lt;h3&gt;&lt;/h3&gt;&#xA;" OwnerUserId="6180" LastActivityDate="2021-01-13T18:30:42.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15515" PostTypeId="1" CreationDate="2021-01-13T20:35:29.013" Score="1" ViewCount="85" Body="&lt;p&gt;I'm not able to find any sources. Can you point me to some?&lt;/p&gt;&#xA;" OwnerUserId="14458" LastEditorUserId="23" LastEditDate="2021-01-15T12:24:25.123" LastActivityDate="2021-01-15T14:43:28.133" Title="How the various quantum gates are implemented physically in quantum computer?" Tags="&lt;quantum-gate&gt;&lt;resource-request&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15516" PostTypeId="2" ParentId="15504" CreationDate="2021-01-13T21:03:31.823" Score="3" Body="&lt;p&gt;Your calculation is correct. It is not true that QFT maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;. It is also not true that QFT keeps &lt;span class=&quot;math-container&quot;&gt;$|\psi^-\rangle$&lt;/span&gt; fixed.&lt;/p&gt;&#xA;&lt;p&gt;For a proof by contradiction assume that QFT maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;. Then QFT&lt;sup&gt;2&lt;/sup&gt; = CNOT also maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;. However, CNOT maps every Bell state to a product state. The contradiction proves that QFT does not map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The argument that QFT does not fix &lt;span class=&quot;math-container&quot;&gt;$|\psi^-\rangle$&lt;/span&gt; is analogous.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Equality of QFT&lt;sup&gt;2&lt;/sup&gt; and CNOT&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to see the equality between QFT&lt;sup&gt;2&lt;/sup&gt; on two qubits and CNOT first write down two copies of the QFT circuit&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT = SWAP \circ (I \otimes H) \circ CS \circ (H \otimes I).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$CS = \mathrm{diag}(1, 1, 1, i)$&lt;/span&gt;. Next, move the final SWAP gate from the second QFT circuit backward to cancel the SWAP gate of the first QFT circuit. Next, cancel the Hadamards and combine the CS gates into the CZ gate. Finally, combine CZ with the two remaining Hadamards to obtain CNOT.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, we can also see that QFT&lt;sup&gt;2&lt;/sup&gt;=CNOT using matrix multiplication&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT^2 = \left(\frac{1}{2}\begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; i &amp;amp; -1 &amp;amp; -i \\&#xA;1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\&#xA;1 &amp;amp; -i &amp;amp; -1 &amp;amp; i&#xA;\end{pmatrix}\right)^2 = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In any case, this is a restatement of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Discrete_Fourier_transform#Eigenvalues_and_eigenvectors&quot; rel=&quot;nofollow noreferrer&quot;&gt;well-known property&lt;/a&gt; of the Discrete Fourier Transform that applying it twice fixes the first input and reverses the order of the other inputs.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Direct calculation&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Direct calculation yields the same result. The matrix of QFT on two qubits is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT = \frac{1}{2}\begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; i &amp;amp; -1 &amp;amp; -i \\&#xA;1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\&#xA;1 &amp;amp; -i &amp;amp; -1 &amp;amp; i&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the column vector representations of the Bell states are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi^+\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 0 \\ 1\end{pmatrix}  \,\,\,\,&#xA;|\phi^-\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 0 \\ -1\end{pmatrix} \,\,\,\,&#xA;|\psi^+\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0\end{pmatrix} \,\,\,\,&#xA;|\psi^-\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ -1 \\ 0\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By matrix multiplication we find&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT |\phi^+\rangle = \frac{1}{2\sqrt{2}} \begin{pmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 1 &amp;amp; 1 \\&#xA;1 &amp;amp; i &amp;amp; -1 &amp;amp; -i \\&#xA;1 &amp;amp; -1 &amp;amp; 1 &amp;amp; -1 \\&#xA;1 &amp;amp; -i &amp;amp; -1 &amp;amp; i&#xA;\end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 1\end{pmatrix} =&#xA;\frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ \frac{1-i}{2} \\ 0 \\ \frac{1+i}{2}\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in agreement with your result and in disagreement with the claim that QFT maps &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;. Similarly, for the other vectors in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-13T23:49:26.410" LastActivityDate="2021-01-13T23:49:26.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15517" PostTypeId="1" AcceptedAnswerId="15518" CreationDate="2021-01-14T00:19:00.727" Score="9" ViewCount="965" Body="&lt;p&gt;I understand the theoretical concept of an entanglement and what it means for our computation to have two entangled qubits, but what does it really mean when two qubits are entangled? How are they entangled in the first place? I mean in the physical world, not in theory. Right now I think of entanglement as a &amp;quot;synchronization&amp;quot; of two quantum mechanical properties that can be encoded as a qubit.&lt;/p&gt;&#xA;&lt;p&gt;I tried to understand what happens when the spin of two electrons are entangled, but I could not grasp it. Maybe someone could explain how we achieve an entangled state of qubits if the qubits are encoded in the spin of an electron?&lt;/p&gt;&#xA;&lt;p&gt;I would be very grateful for any help because I am slowly getting &lt;em&gt;crazy and not crazy at the same time&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14430" LastEditorUserId="10480" LastEditDate="2021-01-14T05:24:01.823" LastActivityDate="2021-01-27T13:33:27.243" Title="How can one imagine entanglement in a non-mathematical way?" Tags="&lt;entanglement&gt;&lt;physical-qubit&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15518" PostTypeId="2" ParentId="15517" CreationDate="2021-01-14T01:06:15.923" Score="7" Body="&lt;p&gt;&lt;strong&gt;What is entanglement?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Briefly, entanglement is a type of &lt;em&gt;dependence&lt;/em&gt; between subsystems of a composite system.&lt;/p&gt;&#xA;&lt;p&gt;Quantum mechanics can be &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0101012&quot; rel=&quot;noreferrer&quot;&gt;viewed&lt;/a&gt; as a variant or extension of probability theory. In this view, state vectors are analogous to probability distributions, superpositions correspond to distributions that are non-deterministic (i.e. that do not assign &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; to a single outcome), composite states correspond to joint distributions, the partial trace corresponds to marginalization and entanglement corresponds to &lt;a href=&quot;https://en.wikipedia.org/wiki/Correlation_and_dependence&quot; rel=&quot;noreferrer&quot;&gt;correlation and dependence&lt;/a&gt;. States that lack entanglement, i.e. the product states correspond to independent distributions.&lt;/p&gt;&#xA;&lt;p&gt;The similarity extends to some of the metrics used to quantify the amount of entanglement. For example, classical information theory measures the amount of dependence between random variables using quantities such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Entropy_(information_theory)&quot; rel=&quot;noreferrer&quot;&gt;entropy&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Mutual_information&quot; rel=&quot;noreferrer&quot;&gt;mutual information&lt;/a&gt;. Quantum entanglement is measured using analogous quantities of &lt;a href=&quot;https://en.wikipedia.org/wiki/Von_Neumann_entropy&quot; rel=&quot;noreferrer&quot;&gt;von Neumann entropy&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_mutual_information&quot; rel=&quot;noreferrer&quot;&gt;quantum mutual information&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the above is not meant to imply that entanglement is classical correlation. However, probabilistic dependence is a familiar, classical concept that is most closely &lt;em&gt;analogous&lt;/em&gt; to entanglement. The differences between classical probabilistic dependence and quantum entanglement are studied by quantum information theory.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How systems become entangled?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Entanglement arises and disappears as a result of interaction. Therefore, it can be thought of as quantum correlations that exist between two systems due to their past interactions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How to imagine entanglement?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Part of the difficulty of imagining entanglement is that its closest classical analog - dependence between probability distributions - is also nontrivial to imagine. However, there are many effective ways to think about dependence of classical random variables. For example, one can represent it using &lt;a href=&quot;https://en.wikipedia.org/wiki/Tree_diagram_(probability_theory)&quot; rel=&quot;noreferrer&quot;&gt;tree diagrams&lt;/a&gt;. Such tools can be repurposed to represent quantum states by replacing probabilities with amplitudes. Visualization of amplitudes is admittedly harder than of probabilities, but it can be done using techniques such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Domain_coloring&quot; rel=&quot;noreferrer&quot;&gt;domain coloring&lt;/a&gt; from complex analysis.&lt;/p&gt;&#xA;&lt;p&gt;Any technique used to imagine or represent a superposition can be used to imagine or represent entanglement. The key is to use &lt;em&gt;composite&lt;/em&gt; states in superposition. This is related to the fact that there is no mention of or provision for entanglement in the postulates of quantum mechanics. Instead, entanglement arises as a byproduct of superpositions of composite states.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What happens when the spins of two electrons are entangled?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The spins interact and as a result the joint state picks up the type of quantum correlations described above. For example, an interaction might make the spins parallel without making them point in any particular direction.&lt;/p&gt;&#xA;&lt;p&gt;In a sense, the interaction determines the composite state without fixing the states of the subsystems. This possibility has a more precise formulation in terms of von Neumann entropy which in this case is zero for the composite state and non-zero for the subsystems. One way this is often expressed is that in quantum mechanics it is possible to know everything there is to know about a composite system without knowing anything about the parts.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, when one of the spins is measured, a measurement result associated with the other can be inferred.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;A little bit of math beyond this point&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The analogy above becomes a very close visual resemblance if we allow a little bit of math back into the picture. Specifically, when we consider probability density functions (PDFs) and how they capture lack or presence of dependence we see an analogy to the way expressions for state vectors capture lack or presence of entanglement. In classical probability, a joint PDF of two independent variables is a &lt;em&gt;product&lt;/em&gt; of individual PDFs&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(x, y) = p(x) p(y)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and every PDF which cannot be written this way incorporates some dependence between the variables. Similarly, a state vector of unentangled systems is a &lt;em&gt;product&lt;/em&gt; of individual state vectors&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{x,y}\rangle = |\psi_{x}\rangle|\psi_{y}\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and every state which cannot be written this way incorporates some entanglement between the subsystems.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-14T08:04:55.867" LastActivityDate="2021-01-14T08:04:55.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15519" PostTypeId="1" AcceptedAnswerId="15521" CreationDate="2021-01-14T04:10:30.597" Score="1" ViewCount="58" Body="&lt;p&gt;Here's the code I'm working on:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;!pip install pylatexenc&#xA;!pip install pillow&#xA;&#xA;qc = QuantumCircuit(2)&#xA;qc.x(0)&#xA;qc.cz(0,1)&#xA;qc.x(0)&#xA;qc.draw('latex')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However there's an error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FileNotFoundError: [Errno 2] No such file or directory: 'pdflatex': 'pdflatex'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What should I do to make it work? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-01-17T22:01:26.770" LastActivityDate="2021-01-17T22:01:26.770" Title="An issue in plotting the quantum circuit using latex" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15520" PostTypeId="2" ParentId="15519" CreationDate="2021-01-14T04:52:35.433" Score="1" Body="&lt;p&gt;If you want to output the circuit in latex format, you can set the &lt;code&gt;output = 'latex'&lt;/code&gt; within the &lt;code&gt;draw&lt;/code&gt; function of Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;For instance, suppose I want to plot the following circuit in latex:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;           ░       ░      &#xA;q_0: ──■───░───■───░───■──&#xA;     ┌─┴─┐ ░ ┌─┴─┐ ░ ┌─┴─┐&#xA;q_1: ┤ X ├─░─┤ X ├─░─┤ X ├&#xA;     └───┘ ░ └───┘ ░ └───┘&#xA;c: 2/═════════════════════&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I can do it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;import matplotlib.pyplot as plt&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circ = QuantumCircuit(qreg_q, creg_c)&#xA;circ.cx(0,1)&#xA;circ.barrier(range(2))&#xA;circ.cx(0,1)&#xA;circ.barrier(range(2))&#xA;circ.cx(0,1)&#xA;circ.draw( style={'name': 'bw'}, output = 'latex', plot_barriers= True, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/O3AJb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O3AJb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;You can look into &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.visualization.circuit_drawer.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this documentation here&lt;/a&gt; for more detail.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-14T06:05:08.857" LastActivityDate="2021-01-14T06:05:08.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15521" PostTypeId="2" ParentId="15519" CreationDate="2021-01-14T10:23:54.230" Score="2" Body="&lt;p&gt;It seems like you forgot to install a &lt;span class=&quot;math-container&quot;&gt;$\LaTeX$&lt;/span&gt; processor.&lt;/p&gt;&#xA;&lt;p&gt;To solve the issue, install any &lt;span class=&quot;math-container&quot;&gt;$\LaTeX$&lt;/span&gt; distribution. Below are the two main ones that can be installed both on Windows and Linux:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://www.tug.org/texlive/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.tug.org/texlive/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://miktex.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://miktex.org/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2021-01-14T10:23:54.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15522" PostTypeId="2" ParentId="15515" CreationDate="2021-01-14T10:33:36.543" Score="1" Body="&lt;p&gt;I found this interesting article that talks about creating a Fredkin quantum gate (controlled SWAP) : &lt;a href=&quot;https://advances.sciencemag.org/content/2/3/e1501531&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://advances.sciencemag.org/content/2/3/e1501531&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope this can help you in your search.&lt;/p&gt;&#xA;" OwnerUserId="14462" LastActivityDate="2021-01-14T10:33:36.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15523" PostTypeId="2" ParentId="15515" CreationDate="2021-01-14T11:53:59.793" Score="0" Body="&lt;p&gt;You can find some information about gates implementation here in this article:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41598-019-49657-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;Realization of efficient quantum gates with a superconducting qubit-qutrit circuit&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Although the proposed setup is rather experimental, it may give you some ideas how to implement gates on computers with superconducting qubits.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-14T11:53:59.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15524" PostTypeId="2" ParentId="15506" CreationDate="2021-01-14T11:57:06.240" Score="1" Body="&lt;p&gt;I would recommend reading this article:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1807.05572&quot; rel=&quot;nofollow noreferrer&quot;&gt;Effient quantum algorithms for GHZ and W states, and implementation on the IBM Q&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It provides general algorithm for constructing a circuit producing W-state with arbitrary number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;Here is a code based on the article:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def _w_state_circuit(circuit, nn, mm, qubitC):    &#xA;    global qubitT #reference to global variable qubitT&#xA;    &#xA;    if nn == 0 and mm == 1:&#xA;        pass #do nothing in this case&#xA;    elif nn == 1 and mm == 2: #case (1,2)&#xA;        circuit.cu3(m.pi/2, 0, 0, q[qubitC], q[qubitT])&#xA;        circuit.cx(q[qubitT], q[qubitC])&#xA;        qubitT = qubitT + 1&#xA;    else: #otherwise&#xA;        theta = 2*np.arccos(m.sqrt(nn/mm))&#xA;        circuit.cu3(theta, 0, 0, q[qubitC], q[qubitT])&#xA;        circuit.cx(q[qubitT], q[qubitC])&#xA;        &#xA;        qubitTRecurse = qubitT #saving target qubit index, used as control qubit for lower child&#xA;        qubitT = qubitT + 1&#xA;        &#xA;        a = m.floor(nn/2)&#xA;        b = m.floor(mm/2)&#xA;        c = m.ceil(nn/2)&#xA;        d = m.ceil(mm/2)&#xA;        &#xA;        if a == 1 and b == 1: #upper child (1,1) =&amp;gt; (1,2) became upper child&#xA;            circuit = _w_state_circuit(circuit, 1, 2, qubitC)&#xA;            #there is no lower child&#xA;        elif c == 1 and d == 1: #lower child (1,1) =&amp;gt; (1,2) became lower child&#xA;            circuit = _w_state_circuit(circuit, 1, 2, qubitTRecurse)&#xA;            #there is no upper child&#xA;        else:                       &#xA;            #upper child&#xA;            circuit = _w_state_circuit(circuit, a, b, qubitC)                 &#xA;            #lower child&#xA;            circuit = _w_state_circuit(circuit, c, d, qubitTRecurse)&#xA;                &#xA;    return circuit&#xA;        &#xA;def w_state_circuit (qubits, qRegister, cRegister):&#xA;    global qubitT&#xA;    qubitT = 1 #index of a qubit a new gate acts on (hard to compute inside recursion =&amp;gt; global variable)&#xA;    circuit = QuantumCircuit(qRegister, cRegister)&#xA;    circuit.x(q[0])&#xA;    circuit = _w_state_circuit(circuit, m.floor(qubits/2), qubits, 0)&#xA;    return circuit&#xA;&#xA;#construction of 6 qubits W-state&#xA;qubits = 6&#xA;&#xA;q = QuantumRegister(qubits, name = 'q')&#xA;c = ClassicalRegister(qubits, name = 'c')&#xA;&#xA;circuit = w_state_circuit(qubits, q, c)&#xA;&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-14T11:57:06.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15525" PostTypeId="2" ParentId="15517" CreationDate="2021-01-14T12:10:26.883" Score="3" Body="&lt;p&gt;&lt;strong&gt;Using shadow puppets.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Imagine making shadow puppets.  However in this setup, instead of one you have two screens and two torches (US:  flashlights), pointing 90 degrees apart so that the image formed by torch 1 is projected onto screen 1 and the image formed by torch 2 is simultaneously projected onto screen 2.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; screen 1   screen 2&#xA;   /           \&#xA;  /             \&#xA; /               \&#xA;        mm              &amp;lt;-  hand&#xA;&#xA;      /    \&#xA;torch 2    torch 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;(Apologies for the terrible ASCII art.)&lt;/p&gt;&#xA;&lt;p&gt;Now any movement of your hand changes both images in a correlated way.  In a sense, the images are &lt;em&gt;entangled&lt;/em&gt; - if you observe image 1 to have a certain configuration, then only a small subset of possibilities in the total configuration space of image 2 are valid, and vice versa.&lt;/p&gt;&#xA;&lt;p&gt;The analogy is imperfect, because you cannot for example poke image 1 with a stick and have correlated changes occur in image 2.  But at least no maths.&lt;/p&gt;&#xA;" OwnerUserId="14467" LastEditorUserId="45" LastEditDate="2021-01-15T12:17:27.730" LastActivityDate="2021-01-15T12:17:27.730" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15526" PostTypeId="1" AcceptedAnswerId="15528" CreationDate="2021-01-14T12:14:02.420" Score="2" ViewCount="50" Body="&lt;p&gt;In the article &lt;a href=&quot;https://arxiv.org/abs/1908.07943&quot; rel=&quot;nofollow noreferrer&quot;&gt;An Optimized Quantum Maximum or Minimum Searching Algorithm and its Circuits&lt;/a&gt; I found statement (pg. 4):&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Preparing an initial state takes &lt;span class=&quot;math-container&quot;&gt;$\log_2(N)$&lt;/span&gt; steps.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In this case the initial state is uniformly distributed superposition of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits where some states from computational basis are missing (example for two qubits: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}(|00\rangle + |01\rangle+|11\rangle)$&lt;/span&gt;). Since &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; the statement above means that complexity of preparing such state is linear in number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;In case all computational basis states are present in the required state, it is possible to use &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; gate for preparing such state and in this case number of steps is even constant under assumpation that all Hadamard gates can be applied at once on all qubits.&lt;/p&gt;&#xA;&lt;p&gt;However, since some computational basis states are missing, more complex circuit involving CNOT gates has to be constructed. In article &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;, a general method how to produce arbitrary quantum state is proposed. Of course, this method is also suitable for preparing equally distributed states. However, the method leads to exponential incerease in gates number with increasing number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So, my question is: What is a complexity of preparing uniformlly distributed states with some missing computational basis states?&lt;/strong&gt; Is it really linear in number of qubits?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="55" LastEditDate="2021-01-17T22:01:49.567" LastActivityDate="2021-01-17T22:01:49.567" Title="What is a complexity of producing arbitrary equally distributed superposition?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15527" PostTypeId="1" CreationDate="2021-01-14T12:36:27.960" Score="2" ViewCount="90" Body="&lt;p&gt;Why are &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;s raised to successive powers of two in quantum phase estimation circuit diagram when we use &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; register qubits &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle|0\rangle$&lt;/span&gt;? &lt;a href=&quot;https://i.stack.imgur.com/AhRUG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AhRUG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14469" LastEditorUserId="9006" LastEditDate="2021-01-15T07:53:14.737" LastActivityDate="2021-01-15T07:54:22.547" Title="A question regarding quantum phase estimation algorithm" Tags="&lt;quantum-gate&gt;&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15528" PostTypeId="2" ParentId="15526" CreationDate="2021-01-14T12:56:08.870" Score="1" Body="&lt;p&gt;Because the family of states you are describing has &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; entries, and each state must have a distinct circuit, you need &lt;span class=&quot;math-container&quot;&gt;$\tilde \Omega(n)$&lt;/span&gt; gates for some of the states just to ensure the circuits are different.&lt;/p&gt;&#xA;&lt;p&gt;If you limit your scope to &amp;gt;25% dense states with an efficient predicate, then you can use amplitude amplification over the predicate to prepare the superposition quickly. For example, you can prepare a uniform superposition of all states from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; in this way in &lt;span class=&quot;math-container&quot;&gt;$O(\lg k + \lg \frac{1}{\epsilon})$&lt;/span&gt; operations.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-01-14T12:56:08.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15529" PostTypeId="2" ParentId="15527" CreationDate="2021-01-14T13:28:07.917" Score="3" Body="&lt;p&gt;The objective of all those gates is to put the quantum state in a &amp;quot;nice form&amp;quot; to manipulate. Let me explain. Let's note &lt;span class=&quot;math-container&quot;&gt;$U |\psi \rangle = e^{2i\pi\theta}|\psi\rangle$&lt;/span&gt; all the variables we are interested in, meaning we want to find &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; here. After applying all the Hadamard gates and the &lt;span class=&quot;math-container&quot;&gt;$U^{2^j}$&lt;/span&gt;, the state looks like this :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}{2^{n/2}}\left( |0\rangle + e^{2i\pi2^{t-1}\theta}|1\rangle \right)\left( |0\rangle + e^{2i\pi2^{t-2}\theta}|1\rangle \right) ... \left( |0\rangle + e^{2i\pi2^{0}\theta}|1\rangle \right) \otimes|\psi\rangle= \frac{1}{2^{n/2}}\sum_{k = 0}^{2^n-1} e^{2i\pi\theta k} |k\rangle \otimes |\psi\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now if you are familiar with the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Fourier Transform&lt;/a&gt; (if not you can check this Qiskit tutorial, I believe it is well-explained here), you'll notice that the expression looks a lot like the QFT of the state &lt;span class=&quot;math-container&quot;&gt;$|2^n \theta \rangle $&lt;/span&gt;. This way, since applying the inverse QFT is easily done, you can &amp;quot;easily&amp;quot; access the phase you are looking for.&lt;/p&gt;&#xA;&lt;p&gt;I believe &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Qiskit tuto&lt;/a&gt; (especially the first part, &lt;em&gt;1. Overview&lt;/em&gt;) and &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book (page 221)&lt;/a&gt; will explain this better than I do, plus with Qiskit you can see an implementation, and in the book notice it is presented as an application of the QFT.&lt;/p&gt;&#xA;&lt;p&gt;If you need anything else please feel free to ask :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="9006" LastEditDate="2021-01-15T07:54:22.547" LastActivityDate="2021-01-15T07:54:22.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15530" PostTypeId="2" ParentId="15527" CreationDate="2021-01-14T14:02:56.257" Score="1" Body="&lt;p&gt;The unitary operations of the phase estimation algorithm are mainly controlled phase rotations of an angle that must be specified in the algorithm.&lt;/p&gt;&#xA;&lt;p&gt;This angle that you specify is the phase that you want to estimate.&lt;/p&gt;&#xA;&lt;p&gt;So the first counting qubit will make one rotation the second will make two, qubit 3 will make 4 rotations ... up to 2 ^ t-1 rotations on the register.&lt;/p&gt;&#xA;" OwnerUserId="14462" LastActivityDate="2021-01-14T14:02:56.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15532" PostTypeId="1" AcceptedAnswerId="15534" CreationDate="2021-01-15T00:19:53.463" Score="4" ViewCount="98" Body="&lt;p&gt;I would like to implement the operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(a,b) = \exp\left(i \frac{a}{2} (XX + YY)  + i \frac{b}{2} (XY - YX) \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(&lt;span class=&quot;math-container&quot;&gt;$a,b \in \mathbb{R}$&lt;/span&gt;) without using Baker-Campbell-Hausdorf expansion, which at first seems necessary since &lt;span class=&quot;math-container&quot;&gt;$[(XY - YX), (XX + YY)] \neq 0$&lt;/span&gt;. My intuition is that this can be done in the same way that &lt;span class=&quot;math-container&quot;&gt;$\exp(i(aX + bY))$&lt;/span&gt; does not require a BCH expansion to implement. The above operation is generated by these two matrices:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; i \frac{a}{2} (XX + YY)\rightarrow i a&#xA;\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &#xA;\end{pmatrix} \\&#xA; i \frac{b}{2} (XY - YX)\rightarrow i b\begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \text{-}i &amp;amp; 0 \\&#xA;0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &#xA;\end{pmatrix}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since sum of these matrices is proportional to the operator &lt;span class=&quot;math-container&quot;&gt;$(aX - bY)$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$(|01\rangle,|10\rangle)$&lt;/span&gt; subspace it seems possible that the operation can be done with a general single-qubit rotation &lt;span class=&quot;math-container&quot;&gt;$\text{R}_\hat{n}$&lt;/span&gt; in that subspace. Taking the (unnormalized) unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat{n} = a\hat{x} - b\hat{y}$&lt;/span&gt; this rotation is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{R}_\hat{n} (\theta) = \cos\frac{\theta}{2} + i \sin \frac{\theta}{2} (a X - b Y)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so that the operation can be implemented as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(a, b) = \text{CNOT}^{2\rightarrow 1} \text{CR}_{\hat{n}}(\theta)^{1\rightarrow 2} \text{CNOT}^{2\rightarrow 1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\text{CR}_{\hat{n}}(\theta)$&lt;/span&gt; is a controlled version of &lt;span class=&quot;math-container&quot;&gt;$\text{R}_\hat{n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i\rightarrow j$&lt;/span&gt; indicates an operation on qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; controlled by qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. My main concern is that since neither &lt;span class=&quot;math-container&quot;&gt;$(XY - YX)$&lt;/span&gt; nor &lt;span class=&quot;math-container&quot;&gt;$(XX + YY)$&lt;/span&gt; has support in the &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |11\rangle$&lt;/span&gt; subspace that there's something missing or wrong in this process.&lt;/p&gt;&#xA;&lt;p&gt;My question is, is this a valid decomposition for &lt;span class=&quot;math-container&quot;&gt;$U(a, b)$&lt;/span&gt; or is there something wrong in the above reasoning?&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="10480" LastEditDate="2021-03-12T19:10:43.387" LastActivityDate="2021-03-12T19:10:43.387" Title="Single-qubit rotations on a subspace within two-qubit unitary" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;matrix-representation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15533" PostTypeId="1" CreationDate="2021-01-15T01:48:16.357" Score="2" ViewCount="109" Body="&lt;p&gt;In section 5.2.1 of Nielsen Chuang, Performance and Requirements, there is an idea, that what happens if we can't prepare eigen state &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and instead have a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; which is represented by &lt;span class=&quot;math-container&quot;&gt;$\sum_{u} c_{u}|u\rangle$&lt;/span&gt;. Output state is &lt;span class=&quot;math-container&quot;&gt;$\sum_{u} c_{u} |\phi_{u}\rangle|u\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we will measure the first qubit and it will turn out to be &lt;span class=&quot;math-container&quot;&gt;$|\phi_{u} \rangle$&lt;/span&gt; with probability proportional to &lt;span class=&quot;math-container&quot;&gt;$c_{u}^{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But I am curious, what will be the state of the second qubit? (Is it entangled with the first qubit?)&lt;/p&gt;&#xA;&lt;p&gt;Some excerpts from the book itself:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Cyo6z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Cyo6z.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/CnkRa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CnkRa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="13763" LastEditDate="2021-01-15T12:44:46.550" LastActivityDate="2021-01-26T20:49:43.343" Title="Output of Quantum Phase Estimation Algorithm" Tags="&lt;quantum-state&gt;&lt;nielsen-and-chuang&gt;&lt;phase-estimation&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15534" PostTypeId="2" ParentId="15532" CreationDate="2021-01-15T02:55:54.127" Score="4" Body="&lt;p&gt;Your approach is correct. In particular, sandwiching a controlled rotation between two CNOT gates is a common technique for implementing rotations on the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle, |10\rangle$&lt;/span&gt; subspace on hardware that does not implement it natively.&lt;/p&gt;&#xA;&lt;p&gt;We can justify your approach using the fact that if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has eigendecomposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_i \lambda_i|i\rangle\langle i|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then &lt;span class=&quot;math-container&quot;&gt;$e^A$&lt;/span&gt; has eigendecomposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^A = \sum_i e^{\lambda_i}|i\rangle\langle i|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Consequently, if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is block diagonal&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \begin{pmatrix}&#xA;A_1 &amp;amp; &amp;amp; &amp;amp; \\&#xA;&amp;amp; A_2 &amp;amp; &amp;amp; \\&#xA;&amp;amp; &amp;amp; \ddots &amp;amp; \\&#xA;&amp;amp; &amp;amp; &amp;amp; A_k \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then so is &lt;span class=&quot;math-container&quot;&gt;$e^A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^A = \begin{pmatrix}&#xA;e^{A_1} &amp;amp; &amp;amp; &amp;amp; \\&#xA;&amp;amp; e^{A_2} &amp;amp; &amp;amp; \\&#xA;&amp;amp; &amp;amp; \ddots &amp;amp; \\&#xA;&amp;amp; &amp;amp; &amp;amp; e^{A_k} \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the present case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{a}{2}(XX + YY) + \frac{b}{2}(XY - YX) = \begin{pmatrix}&#xA;0 &amp;amp; &amp;amp; \\&#xA;&amp;amp; aX - bY &amp;amp; \\&#xA;&amp;amp; &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(i\frac{a}{2}(XX + YY) + i\frac{b}{2}(XY - YX)\right) = \begin{pmatrix}&#xA;e^0 &amp;amp; &amp;amp; \\&#xA;&amp;amp; e^{iaX-ibY} &amp;amp; \\&#xA;&amp;amp; &amp;amp; e^0&#xA;\end{pmatrix} = \begin{pmatrix}&#xA;1 &amp;amp; &amp;amp; \\&#xA;&amp;amp; R_{\hat n}(2t) &amp;amp; \\&#xA;&amp;amp; &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;  is the normalized real 3-vector &lt;span class=&quot;math-container&quot;&gt;$(-a, b, 0) / t = (-\alpha, \beta, 0)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat n = \beta Y-\alpha X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$t = \|n\|_2 = \sqrt{a^2 + b^2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In particular, we do not need to be concerned about the subspace &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |11\rangle$&lt;/span&gt; because it is the eigenspace of the operator in the exponent associated with eigenvalue zero which means that &lt;span class=&quot;math-container&quot;&gt;$U(a, b)$&lt;/span&gt; acts on it as identity.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that in practice it is sometimes possible to avoid using Baker-Campbell-Hausdorff by bringing the terms of the exponent into a form in which they commute, e.g. by regrouping the terms&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;U(a,b) &amp;amp;= \exp\left(i \frac{a}{2} (XX + YY)  + i \frac{b}{2} (XY - YX) \right) \\&#xA;&amp;amp;= \exp\left(\frac{i}{2} X\otimes(aX + bY)  + \frac{i}{2} Y\otimes(aY - bX) \right) \\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X\otimes(aX+bY)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y\otimes(aY-bX)$&lt;/span&gt; commute. Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;U(a, b) &amp;amp;= \exp\left(\frac{i}{2} X\otimes(aX + bY)\right) \exp\left(\frac{i}{2} Y \otimes(aY - bX)\right) \\&#xA;&amp;amp;= \exp\left(\frac{it}{2} X\otimes(\alpha X + \beta Y)\right) \exp\left(\frac{it}{2} Y\otimes(\alpha Y - \beta X)\right)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$t = \sqrt{a^2 + b^2}, \alpha = \frac{a}{t},\beta = \frac{b}{t}$&lt;/span&gt; as before. Notice that &lt;span class=&quot;math-container&quot;&gt;$[X\otimes(\alpha X + \beta Y)]^2 = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[Y\otimes(\alpha Y - \beta X)]^2 = I$&lt;/span&gt; so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(\frac{it}{2} X\otimes(\alpha X + \beta Y)\right) = I \cos\frac{t}{2} + i X\otimes(\alpha X + \beta Y) \sin\frac{t}{2} \\&#xA;\exp\left(\frac{it}{2} Y\otimes(\alpha Y - \beta X)\right) = I \cos\frac{t}{2} + i Y\otimes(\alpha Y - \beta X) \sin\frac{t}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(c.f. equation &lt;span class=&quot;math-container&quot;&gt;$(4.7)$&lt;/span&gt;  on p.175 in Nielsen &amp;amp; Chuang). Thus,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(a, b) = II \cos^2\frac{t}{2} + ZZ\sin^2\frac{t}{2} + i\left(\frac{\alpha}{2}(XX + YY) + \frac{\beta}{2}(XY - YX)\right)\sin t.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In matrix representation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(a, b) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \cos t &amp;amp; (-\beta + i\alpha)\sin t &amp;amp; 0 \\&#xA;0 &amp;amp; (\beta + i\alpha)\sin t &amp;amp;\cos t &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we recognize the middle &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block as &lt;span class=&quot;math-container&quot;&gt;$R_{\hat n}(2t)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\hat n = \beta Y-\alpha X$&lt;/span&gt; as before.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-15T02:55:54.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15535" PostTypeId="2" ParentId="15533" CreationDate="2021-01-15T04:28:51.470" Score="1" Body="&lt;p&gt;The second register state stay as the state you prepared it in, that is, it is left unchanged. Note that if &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; is a eigenstate of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i \theta}$&lt;/span&gt; then when you apply &lt;span class=&quot;math-container&quot;&gt;$U^{2^j}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;, you will get &lt;span class=&quot;math-container&quot;&gt;$U^{2^j} |u\rangle = e^{2\pi i \theta 2^j}|u\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/00n7P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/00n7P.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And no, the state in the first register is not entangled to the state in the second register as you can see the output state is written as &lt;span class=&quot;math-container&quot;&gt;$\sum_u c_u |\varphi_u\rangle  |u\rangle  = \sum_u c_u |\varphi_u\rangle \otimes |u\rangle $&lt;/span&gt;, that is they can be written as a tensor product (not entangled).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For a quick example, consider the first part of the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nOqXU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nOqXU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In particular, let's suppose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli-Z operator&lt;/a&gt; and &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; is just the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. More specifically, we are considering the circuit below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Da2q8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Da2q8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the second qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; after application of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. The first qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; after the application of the Hadamard gate. Then we applied the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CZGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controlled-Z gate&lt;/a&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is an eigenstate of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli-Z operator&lt;/a&gt; with &lt;span class=&quot;math-container&quot;&gt;$Z|1\rangle = -|1\rangle$&lt;/span&gt;.  The state of the overall system is now:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \dfrac{|01\rangle - |11\rangle}{\sqrt{2}} $$&lt;/span&gt;&#xA;note the negative is resulted from the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; when we apply Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.  It might be tempted to say that this state is entangled but it is not... because we can rewrite it as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \overbrace{\bigg( \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg)}^{\textrm{first qubit}} \otimes \overbrace{ |1\rangle}^{\textrm{second qubit}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the state of the second qubit stays the same. No changes. The state of the first qubit pick up a relative phase factor coming from the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; when we apply &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can now try to look at:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WpsBj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WpsBj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is now the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LII84.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LII84.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once you worked it out, you will see that you can write the state of the system as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \overbrace{\bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg)}^{\textrm{first qubit}} \otimes  \overbrace{\bigg( \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg)}^{\textrm{2nd qubit}} \otimes \overbrace{ |1\rangle}^{\textrm{3rd qubit}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, the state of the qubit &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt; stays the same. And they are not entangled to one another at all.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-15T05:48:36.920" LastActivityDate="2021-01-15T05:48:36.920" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15536" PostTypeId="1" AcceptedAnswerId="15537" CreationDate="2021-01-15T11:10:46.613" Score="2" ViewCount="110" Body="&lt;p&gt;I need to perform some tests for my thesis in real quantum computers, however, I only have access to IBM's free quantum devices (the maximum number of qubits I can use is 15, in &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;). I mainly have two problems:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;To factor N=15 using Shor's algorithm using the &lt;code&gt;Shor&lt;/code&gt; class provided by Qiskit, I'd need 18 qubits.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Using &lt;a href=&quot;https://github.com/ttlion/ShorAlgQiskit/blob/master/Shor_Sequential_QFT.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;this version of the algorithm&lt;/a&gt;, I only need 11 qubits, but when I try to execute it in &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;, I get the following error message:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Circuit runtime is greater than the device repetition rate. Error code: 8020.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Which basically means I'm using too many gates.&lt;/p&gt;&#xA;&lt;p&gt;I know that I can see data about the circuit by writing&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;shor_compiled = transpile(result['circuit'], backend=server, optimization_level=3)&#xA;print('gates = ', shor_compiled.count_ops())&#xA;print('depth = ', shor_compiled.depth())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, if I want to know about the depth and gate number of a circuit in another computer, first I need to have access to it. &lt;strong&gt;Is there any way I could at least find device specifications for the more powerful, paying devices?&lt;/strong&gt; I might get access to them in the near future through the company that's financing my PhD, but I've been asked to analyze whether Shor's algorithm might be tested in those devices.&lt;/p&gt;&#xA;" OwnerUserId="14479" LastEditorUserId="55" LastEditDate="2021-01-17T22:04:11.483" LastActivityDate="2021-01-17T22:04:11.483" Title="Can I access device specifications of IBMQ paying devices?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;shors-algorithm&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15537" PostTypeId="2" ParentId="15536" CreationDate="2021-01-15T11:24:39.877" Score="4" Body="&lt;p&gt;The first thing that comes to my mind with your problem is the &lt;strong&gt;fake devices&lt;/strong&gt; available in Qiskit. &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/2_device_noise_simulation.html#&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is how to use it, the main idea is that Qiskit stored device properties in Terra and with it, you create simulators that will mimic exactly what the devices would do.&lt;br /&gt;&#xA;Basically, you can call them the same way you would a real device in &lt;code&gt;qiskit.test.mock&lt;/code&gt;, for example &lt;code&gt;from qiskit.test.mock import FakeVigo&lt;/code&gt; and then you havee your fake device just with &lt;code&gt;fake_vigo = FakeVigo()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/test/mock/fake_provider.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;a list&lt;/a&gt; of every fake provider available in Qiskit. If you need more explanation, you can also check this &lt;a href=&quot;https://www.youtube.com/watch?v=8xJiUoPYDaY&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit video&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps, feel free to ask if you need anything else ;)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-01-15T11:24:39.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15538" PostTypeId="1" AcceptedAnswerId="15542" CreationDate="2021-01-15T13:10:59.043" Score="2" ViewCount="81" Body="&lt;p&gt;Please, pardon the caption. No intention of making new theories. I am a bit confused about the quantum teleportation. I missed a hadamard gate before CNOT gate for creating the EPR pair. But the circuit seems to bee working and copying  q0 to q2.&lt;/p&gt;&#xA;&lt;p&gt;Circuit without entanglement and initial Hadamard gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/edPJK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/edPJK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Results consistent with q0 wave function:&#xA;This is measurement of q2 for multiple shots&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0S4zK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0S4zK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am new to quantumn mechanics domain, any guide or help would mean a lot. Thank you for your help :).&lt;/p&gt;&#xA;" OwnerUserId="14481" LastEditorUserId="9006" LastEditDate="2021-01-15T15:34:59.020" LastActivityDate="2021-01-15T21:50:16.353" Title="Quantum teleportaion seems to occuring without entanglement in circuit (what's wrong)" Tags="&lt;qiskit&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15539" PostTypeId="2" ParentId="15515" CreationDate="2021-01-15T14:43:28.133" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/playlist?list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&quot; rel=&quot;nofollow noreferrer&quot;&gt;This playlist by QuTech Academy&lt;/a&gt; on the 'building blocks' of a quantum computer might offer some nice insights.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Video &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt; introduce spin qubits, with &lt;a href=&quot;https://www.youtube.com/watch?v=fBnKec6uI0U&amp;amp;list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&amp;amp;index=11&quot; rel=&quot;nofollow noreferrer&quot;&gt;the second video&lt;/a&gt; specifically on the &lt;strong&gt;operations on spin qubits&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Video &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$13$&lt;/span&gt; introduce NV centre qubits, with &lt;a href=&quot;https://www.youtube.com/watch?v=tWd0SkoI0HY&amp;amp;list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&amp;amp;index=13&quot; rel=&quot;nofollow noreferrer&quot;&gt;again the second video&lt;/a&gt; specifically on the &lt;strong&gt;operations on spin qubits&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Video &lt;span class=&quot;math-container&quot;&gt;$14$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$19$&lt;/span&gt; introduce the widely used &lt;strong&gt;transmon qubits&lt;/strong&gt;, with &lt;a href=&quot;https://www.youtube.com/watch?v=KDANvtOkEc4&amp;amp;list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&amp;amp;index=17&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurements&lt;/a&gt;, &lt;a href=&quot;https://www.youtube.com/watch?v=_MfABBLtBd0&amp;amp;list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&amp;amp;index=18&quot; rel=&quot;nofollow noreferrer&quot;&gt;single-qubit operations&lt;/a&gt; and the &lt;a href=&quot;https://www.youtube.com/watch?v=vwjlEdwi2LU&amp;amp;list=PL5jmbd6SJYnPiYlM6pHAm2M3FL40D9otZ&amp;amp;index=19&quot; rel=&quot;nofollow noreferrer&quot;&gt;two-qubit operation&lt;/a&gt; in separate videos.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Video &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; through &lt;span class=&quot;math-container&quot;&gt;$25$&lt;/span&gt; introduce the concepts behind a majorana-based topological quantum computer, but so far there's little 'physical' about that (unfortunately)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Notable omissions include (as QuTech doesn't work on these technologies):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Trapped ion systems. Check for instance &lt;a href=&quot;https://www.youtube.com/watch?v=lJOuPmI--5c&quot; rel=&quot;nofollow noreferrer&quot;&gt;this video by MIT Opencourseware&lt;/a&gt; for the basics.&lt;/li&gt;&#xA;&lt;li&gt;Photon-based systems, most notably the &lt;a href=&quot;https://en.wikipedia.org/wiki/KLM_protocol&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear KLM model&lt;/a&gt;. Check the (wiki)link for the introduction on how the gates are implemented (hint: beam splitters and mirrors).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Of course there's also adiabatic-style quantum computers, but there you don't perform 'gates', you just tune the coupling between qubit neighbour pairs.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-01-15T14:43:28.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15540" PostTypeId="2" ParentId="15492" CreationDate="2021-01-15T20:34:11.540" Score="3" Body="&lt;p&gt;&lt;strong&gt;Answer to question 1&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are many ways the first quantum algorithm for order finding could have been conceived and I don't know how it really happened. However, here is a plausible though entirely fictional account of how one might have arrived at it:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Alice:&lt;/strong&gt; Hey, I was imagining doing arithmetic on a quantum computer and made a unitary that computes multiplication modulo a given integer &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;br /&gt;&#xA;&lt;strong&gt;Bob:&lt;/strong&gt; Hey, that's cool! What is it?&lt;br /&gt;&#xA;&lt;strong&gt;Alice:&lt;/strong&gt; Well, it really just permutes the computational basis states like this&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|y\rangle = |xy\pmod N\rangle\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;when &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; are coprime to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and acts as identity otherwise.&lt;br /&gt;&#xA;&lt;strong&gt;Bob:&lt;/strong&gt; Right. I wonder what &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;'s eigenvalues are...&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;See the answer to question 2 below for details of what occurs here. Some time later:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Alice:&lt;/strong&gt; So the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\exp\frac{2\pi i s}{r}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$s=0,\dots,r-1$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the order of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; modulo &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;br /&gt;&#xA;&lt;strong&gt;Bob:&lt;/strong&gt; Interesting... Wait, what?!... We can use the Quantum Phase Estimation algorithm to compute eigenvalues of any unitary. This means we could use QPE to find &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;!&lt;br /&gt;&#xA;&lt;strong&gt;Alice:&lt;/strong&gt; You're right! Wasn't finding &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; supposed to be computationally hard?&lt;br /&gt;&#xA;&lt;strong&gt;Bob:&lt;/strong&gt; On a &lt;em&gt;classical&lt;/em&gt; computer? As far as we know, yeah.&lt;br /&gt;&#xA;&lt;strong&gt;Alice:&lt;/strong&gt; Looks like it's computationally easy on a quantum computer!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Answer to question 2&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As in question 1, there are many ways one can arrive at the result. The following elementary approach is loosely inspired by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Power_iteration&quot; rel=&quot;nofollow noreferrer&quot;&gt;power iteration algorithm&lt;/a&gt; for finding eigenvectors and eigenvalues. Note that if &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^k|v\rangle = \lambda^k|v\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, from the definition of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; we know that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U^k|y\rangle = |x^k y\pmod N\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for a computational basis state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; encoding a &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; coprime to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Now, let &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; be the order of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; modulo &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$x^r = 1\pmod N$&lt;/span&gt;. Then,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda^r|v\rangle = U^r|v\rangle = |v\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is a number such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda^r = 1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In other words, the eigenvalues are the &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;th &lt;a href=&quot;https://en.wikipedia.org/wiki/Root_of_unity&quot; rel=&quot;nofollow noreferrer&quot;&gt;roots of unity&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda = \exp\frac{2\pi i s}{r}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$s = 0,\dots,r-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Having found the eigenvalues, we now want to find the corresponding eigenvectors. We begin with the observation that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; permutes the states &lt;span class=&quot;math-container&quot;&gt;$|x^0\pmod N\rangle,\dots|x^{r-1}\pmod N\rangle$&lt;/span&gt;. Consequently, the uniform superposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v_0\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}|x^k\pmod N\rangle\tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is an eigenvector associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Hoping that &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; might be a special case of a more general pattern, we next try&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v_{a_0,\dots,a_{r-1}}\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a_k|x^k\pmod N\rangle\tag4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for some complex numbers &lt;span class=&quot;math-container&quot;&gt;$a_0,\dots,a_{r-1}$&lt;/span&gt;. If we apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to both sides of &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U|v_{a_0,\dots,a_{r-1}}\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a_k|x^{k+1}\pmod N\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which shifts the kets by one position cyclically relative to the coefficients &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt;. However, by definition of eigenvector, we need this reshuffling to allow us to pull a constant out in front of the sum, so we see that we need &lt;span class=&quot;math-container&quot;&gt;$a_k = a^k$&lt;/span&gt; for some constant &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v_a\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a^k|x^k\pmod N\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us try it&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;U|v_a\rangle &amp;amp;= \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a^k|x^{k+1}\pmod N\rangle \\&#xA;&amp;amp;= a^{-1}\frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a^{k+1}|x^{k+1}\pmod N\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so if &lt;span class=&quot;math-container&quot;&gt;$a^r=1$&lt;/span&gt; then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;U|v_a\rangle &amp;amp;= a^{-1}\frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a^{k+1}|x^{k+1}\pmod N\rangle \\&#xA;&amp;amp;= a^{-1}\frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}a^k|x^k\pmod N\rangle \\&#xA;&amp;amp;= a^{-1} |v_a\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$|v_a\rangle$&lt;/span&gt; is an eigenvector associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda = a^{-1}$&lt;/span&gt;. This is reassuring, because it means that our assumption that &lt;span class=&quot;math-container&quot;&gt;$a^r=1$&lt;/span&gt; is satisfied. It also means that &lt;span class=&quot;math-container&quot;&gt;$a = \exp\left(-\frac{2\pi i s}{r}\right)$&lt;/span&gt;. Putting it all together, we see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|u_s\rangle = |v_{e^{-2\pi is/r}}\rangle = \sum_{k=0}^{r-1}\exp\left(-\frac{2\pi isk}{r}\right)|x^k \pmod N\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\exp\left(\frac{2\pi i s}{r}\right)$&lt;/span&gt; in agreement with &lt;span class=&quot;math-container&quot;&gt;$(5.37)$&lt;/span&gt; on p.227 in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-15T22:02:23.427" LastActivityDate="2021-01-15T22:02:23.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15541" PostTypeId="2" ParentId="13342" CreationDate="2021-01-15T21:27:38.683" Score="0" Body="&lt;p&gt;The main appeal of quantum computing is that it can do some tasks faster than a classical computer. This relies on unique quantum phenomena such as entanglement, phase interference, etc. This requires that all qubits in the quantum memory can &amp;quot;talk&amp;quot; to each other. If subsets of qubits are physically separated and only linked through classical channels, you lose this property since the qubits from distinct subsets cannot be entangled.&lt;/p&gt;&#xA;&lt;p&gt;Another way to look at this is if you have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; small quantum computers, then they can do at most &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times the work of one of those computers. So this model does not allow anything better than a linear improvement over what a single of the small quantum computers can achieve. Any quantum algorithm with better than linear speedup (e.g. Grover or Shor) cannot be implemented in this model.&lt;/p&gt;&#xA;" OwnerUserId="5425" LastActivityDate="2021-01-15T21:27:38.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15542" PostTypeId="2" ParentId="15538" CreationDate="2021-01-15T21:50:16.353" Score="3" Body="&lt;p&gt;Your circuit gets lucky on the probabilities for this one particular value, but doesn't work for any other. It also produces the wrong state, as you can confirm in &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7Ek88t%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22Bloch%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B%22H%22%5D,%5B%22Measure%22,%22Measure%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,1,%22Bloch%22%5D,%5B1,1,1,1,%22%7Ef7c0%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E87lj%22,%22name%22:%22message%22,%22circuit%22:%7B%22cols%22:%5B%5B%22e%5E-iYt%22%5D,%5B%22X%5Et%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ef7c0%22,%22name%22:%22received%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,1%7D%7D%22%7D,%7B%22id%22:%22%7Ek88t%22,%22name%22:%22init%22,%22matrix%22:%22%7B%7B0.8661839,0.4997253%7D,%7B-0.4997253,0.8661839%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;this adjusted version of the quirk teleportation circuit&lt;/a&gt;. Compared to the &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22%7Ek88t%22,%22H%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22Bloch%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B%22H%22%5D,%5B%22Measure%22,%22Measure%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,1,%22Bloch%22%5D,%5B1,1,1,1,%22%7Ef7c0%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E87lj%22,%22name%22:%22message%22,%22circuit%22:%7B%22cols%22:%5B%5B%22e%5E-iYt%22%5D,%5B%22X%5Et%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ef7c0%22,%22name%22:%22received%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,1%7D%7D%22%7D,%7B%22id%22:%22%7Ek88t%22,%22name%22:%22init%22,%22matrix%22:%22%7B%7B0.8661839,0.4997253%7D,%7B-0.4997253,0.8661839%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;original initialized with your value&lt;/a&gt; your phase is off.&lt;/p&gt;&#xA;&lt;p&gt;The difference becomes even clearer when you use the rotating message from the &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B1,%22H%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22%7E87lj%22%5D,%5B%22Bloch%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B%22H%22%5D,%5B%22Measure%22,%22Measure%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,1,%22Bloch%22%5D,%5B1,1,1,1,%22%7Ef7c0%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E87lj%22,%22name%22:%22message%22,%22circuit%22:%7B%22cols%22:%5B%5B%22e%5E-iYt%22%5D,%5B%22X%5Et%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ef7c0%22,%22name%22:%22received%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;original quirk teleportation circuit&lt;/a&gt; and &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22%E2%80%A6%22,%22%E2%80%A6%22,1,1,%22%E2%80%A6%22%5D,%5B%22%7E87lj%22%5D,%5B%22Bloch%22%5D,%5B%22%E2%80%A2%22,%22X%22%5D,%5B%22H%22%5D,%5B%22Measure%22,%22Measure%22%5D,%5B1,%22%E2%80%A2%22,1,1,%22X%22%5D,%5B%22%E2%80%A2%22,1,1,1,%22Z%22%5D,%5B1,1,1,1,%22Bloch%22%5D,%5B1,1,1,1,%22%7Ef7c0%22%5D%5D,%22gates%22:%5B%7B%22id%22:%22%7E87lj%22,%22name%22:%22message%22,%22circuit%22:%7B%22cols%22:%5B%5B%22e%5E-iYt%22%5D,%5B%22X%5Et%22%5D%5D%7D%7D,%7B%22id%22:%22%7Ef7c0%22,%22name%22:%22received%22,%22matrix%22:%22%7B%7B1,0%7D,%7B0,1%7D%7D%22%7D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;remove the the Hadamard&lt;/a&gt; as in your circuit. To no great surprise, there is a value at which the probabilities are correct, but as you can see from the receiving qubit sadly moving up and down the Z axis the state is not correctly teleported.&lt;/p&gt;&#xA;&lt;p&gt;There are infinitely many states that produce the same probability distribution, because:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a * a^{\ast} = (\alpha + i \beta) * (\alpha - i \beta) = \alpha^2 + \beta^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also recall that you can multiply with an arbitrary global phase and that shifts along the x or y axis are orthogonal and thus don't influence the outcome when measuring along the z axis. The QFT is a nice example of this property, where, depending on the input, the different qubits have a different phase (essentially rotating on the x,y-circle), but they have equal probability for all inputs.&lt;/p&gt;&#xA;" OwnerUserId="10225" LastActivityDate="2021-01-15T21:50:16.353" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15543" PostTypeId="1" CreationDate="2021-01-16T03:56:08.157" Score="1" ViewCount="59" Body="&lt;p&gt;I am using the &amp;quot;execute&amp;quot; in qiskit to run experiments for two circuits, and it turns out that &amp;quot;execute&amp;quot; runs much slower if the two circuits are run simultaneously, compared to if the circuits are run one at a time. Please see the codes below. Any idea why this happens and how to improve it?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;import numpy as np&#xA;import time&#xA;&#xA;pi = np.pi&#xA;&#xA;num_qubits = 2&#xA;theta = np.random.rand(1,2)[0]&#xA;&#xA;qc = QuantumCircuit(num_qubits)&#xA;qc.u1( theta[0] , 0 )&#xA;qc.cx( 0,1 )&#xA;qc.u3( -pi/2 , -pi/2 , pi/2 , 0 )&#xA;qc.u2( 0 , pi , 1 )    &#xA;qc.cx( 0,1 )&#xA;qc.u1( theta[1] , 1 )&#xA;&#xA;qcz = qc.copy()&#xA;qcz.measure_all()&#xA;&#xA;qcx = qc.copy()&#xA;qcx.h(qcx.qubits)&#xA;qcx.measure_all()&#xA;&#xA;# Using execute for the two circuits together&#xA;start_time = time.time()&#xA;results = execute([qcx,qcz], Aer.get_backend('qasm_simulator'), shots = 8192 ).result()&#xA;print( results.get_counts() )&#xA;print(&amp;quot;--- %s seconds ---&amp;quot; % (time.time() - start_time))&#xA;&#xA;# Using execute for one circuit at a time&#xA;start_time = time.time()&#xA;resultx = execute(qcx, Aer.get_backend('qasm_simulator'), shots = 8192 ).result()&#xA;resultz = execute(qcz, Aer.get_backend('qasm_simulator'), shots = 8192 ).result()&#xA;print( resultx.get_counts() )&#xA;print( resultz.get_counts() )&#xA;print(&amp;quot;--- %s seconds ---&amp;quot; % (time.time() - start_time))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the outputs are&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[{'00': 4114, '01': 4063, '10': 9, '11': 6}, {'00': 2027, '01': 2055, '10': 2074, '11': 2036}]&#xA;--- 11.244265079498291 seconds ---&#xA;{'00': 4099, '01': 4084, '10': 5, '11': 4}&#xA;{'00': 2047, '01': 2034, '10': 2073, '11': 2038}&#xA;--- 0.29702305793762207 seconds ---&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2021-01-17T22:04:23.730" LastActivityDate="2021-01-17T22:04:23.730" Title="Why qiskit.execute runs much slower for inputs with multiple circuits, and how to speed it up?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15544" PostTypeId="1" AcceptedAnswerId="15548" CreationDate="2021-01-16T05:43:05.217" Score="4" ViewCount="39" Body="&lt;p&gt;The paper can be found &lt;a href=&quot;https://arxiv.org/pdf/1802.06002.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1802.06002.pdf&lt;/a&gt; here.&#xA;They say that for each binary label function &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$l(z)=−1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$l(z)=1$&lt;/span&gt;, there exists a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that, for all input strings &lt;span class=&quot;math-container&quot;&gt;$z=z_0z_1...z_{n−1}$&lt;/span&gt; (where each &lt;span class=&quot;math-container&quot;&gt;$z\in \{−1,1\}$&lt;/span&gt;),&#xA;The predicted output is defined as, &lt;span class=&quot;math-container&quot;&gt;$$&amp;lt;z, 1|U^\dagger&#xA;(&#xA;θ )Y_{n+1}U(&#xA;θ )|z, 1&amp;gt;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Y_{n+1}$&lt;/span&gt; is the Pauli y operator on the last qubit.&#xA;loss is defined as &lt;span class=&quot;math-container&quot;&gt;$$&#xA;loss(~θ, z) = 1 − l(z)\langle z, 1|U^\dagger ( θ )Y_{n+1}U( θ )|z, 1&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In &lt;strong&gt;Representation&lt;/strong&gt; section it is said that, &lt;em&gt;Before discussing learning we want to establish that our quantum neural network is capable&#xA;of expressing any two valued label function. There are 2&lt;sup&gt;n&lt;/sup&gt;&#xA;, n-bit strings and accordingly there are 2&lt;sup&gt;2&lt;sup&gt;n&lt;/sup&gt;&lt;/sup&gt;&#xA;possible label functions l(z).&lt;/em&gt; Another operator is defined as following, &lt;span class=&quot;math-container&quot;&gt;$U_l&#xA;|z, z_{n+1}\rangle = e^{il(z) π X_{n+1}/4}|z, z_{n+1}\rangle$&lt;/span&gt; Further &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; is obtained as following, &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle z, 1|U^\dagger_l Y_{n+1}U_l|z, 1\rangle = l(z)$$&lt;/span&gt;&#xA;I do not understand what &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; exactly is(true label I believe) and how there are 2&lt;sup&gt;2&lt;sup&gt;n&lt;/sup&gt;&lt;/sup&gt; possible functions for it.&lt;/p&gt;&#xA;" OwnerUserId="13129" LastEditorUserId="1939" LastEditDate="2021-01-16T19:49:07.653" LastActivityDate="2021-01-16T20:39:28.523" Title="Label function for a QNN designed to classify bit strings" Tags="&lt;quantum-neural-network&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15545" PostTypeId="1" CreationDate="2021-01-16T17:12:03.887" Score="2" ViewCount="30" Body="&lt;p&gt;I am trying to and understand a statement of a paper I am reading &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.140504&quot; rel=&quot;nofollow noreferrer&quot;&gt;URL&lt;/a&gt;. Figure 3c shows the circuit.&#xA;&lt;span class=&quot;math-container&quot;&gt;$\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}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is mentioned that the result of an quantum circuit can be read out by measure the expectation value of the coherent term of the ancillary qubit &lt;span class=&quot;math-container&quot;&gt;$\ket{000}\bra{000} \otimes \ket{1}_A \bra{0}_A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What is the coherent term?&lt;br /&gt;&#xA;Is'n the solution of this equation a matrix? How does a matrix have an expectation value that can be read out of a measurement of a quantum circuit?&lt;/p&gt;&#xA;" OwnerUserId="14487" LastActivityDate="2021-01-16T17:12:03.887" Title="Expectation value of the coherent term" Tags="&lt;quantum-state&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15546" PostTypeId="1" CreationDate="2021-01-16T19:37:43.543" Score="1" ViewCount="85" Body="&lt;p&gt;I am confused about how to calculate the probabilities of getting a certain result when measuring a Pauli observable on a Bell state. When you measure an observable the state is projected onto an eigenstate of the observable.&lt;/p&gt;&#xA;&lt;p&gt;For example, given &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = (|{+-}\rangle + |{-+}\rangle)/\sqrt{2}$&lt;/span&gt; as the state and &lt;span class=&quot;math-container&quot;&gt;$\sigma_x = \begin{pmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{pmatrix}$&lt;/span&gt; as the observable, if the probability is &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, how to calculate actually it? What is the state after measurement?&lt;/p&gt;&#xA;" OwnerUserId="13823" LastEditorUserId="10480" LastEditDate="2021-01-17T22:10:03.437" LastActivityDate="2021-01-17T22:10:03.437" Title="Probability on measuring bell state in x-basis with pauli operator sigma x" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2021-01-17T06:40:01.830" ContentLicense="CC BY-SA 4.0" />
  <row Id="15548" PostTypeId="2" ParentId="15544" CreationDate="2021-01-16T20:39:28.523" Score="3" Body="&lt;p&gt;Yes, &lt;span class=&quot;math-container&quot;&gt;$l(z)$&lt;/span&gt; is the true label, and so  &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; is the target function that you want to learn in order for the machine learning model to be correct. The set of functions &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; that the model is capable of learning describes the expressiveness of the classifier, and they use the construction of &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt; to argue that there is a quantum circuit composed of two-qubit gates that can learn to represent any possible binary function on finite strings &lt;span class=&quot;math-container&quot;&gt;$l: \{0,1\}^n\rightarrow \{-1, 1\}$&lt;/span&gt; and is therefore highly expressive.&lt;/p&gt;&#xA;&lt;p&gt;Note that the quantum circuit &lt;em&gt;predicts&lt;/em&gt; a label of &lt;span class=&quot;math-container&quot;&gt;$\hat{y} = \langle z, 1|U^\dagger (\theta)Y_{n+1}U(\theta)|z, 1\rangle$&lt;/span&gt;, and the goal of training circuit to find a set of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\hat{y} = l(z)$&lt;/span&gt; as often as possible. You can see that the loss function provided is minimum for &lt;span class=&quot;math-container&quot;&gt;$\hat{y} = l(z)$&lt;/span&gt; and maximum for &lt;span class=&quot;math-container&quot;&gt;$\hat{y} = -l(z)$&lt;/span&gt;, and from learning theory we know that minimizing this loss on a sample of possible datapoints (&amp;quot;empirical risk minimization&amp;quot;) will often result in a classifier that generalizes well to unseen datapoints.&lt;/p&gt;&#xA;&lt;p&gt;The reason why there are &lt;span class=&quot;math-container&quot;&gt;$2^{2^n}$&lt;/span&gt; possible functions for &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; is because there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible length-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bitstrings, and you want to count all of the ways you can assign one of two labels to each one. Say you want to design an arbitrary &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;: There are &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; ways to label the string &lt;span class=&quot;math-container&quot;&gt;$0\dots 00$&lt;/span&gt;, times &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; possible ways to label the string &lt;span class=&quot;math-container&quot;&gt;$0\dots 01$&lt;/span&gt;, times &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; possible ways to label &lt;span class=&quot;math-container&quot;&gt;$0 \dots 10$&lt;/span&gt; and so on. Multiplying out the possibilities you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\underbrace{2 \times 2 \times \dots \times 2}_{2^n} = 2^{2^n}&#xA;$$&lt;/span&gt;&#xA;possible labeling &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; schemes to choose from.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-01-16T20:39:28.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15550" PostTypeId="1" CreationDate="2021-01-16T21:25:12.130" Score="1" ViewCount="27" Body="&lt;p&gt;I'm trying to use IBMQ job manager to submit a list of quantum circuits (300 of them in total) to 'ibmq_16_melbourne'. This is what the job status looks like on IBM Quantum Experience: &lt;a href=&quot;https://i.stack.imgur.com/5ryaf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5ryaf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't know why my code doesn't work on this real quantum computer. If I use the ibmq_qasm_simulator instead then no error has occurred. Here's the structure of my code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider()&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;job_manager = IBMQJobManager()&#xA;&#xA;all_circuits = [...]    # A list with 300 elements.&#xA;MyExperiments = job_manager.run(all_circuits, backend=backend, shots = 100)&#xA;results = MyExperiments.results()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I tried another list with 5 simple circuits and it worked fine, but I'm wondering how can I make  it work in my case with 300 circuits? What should I do? Thanks a lot for your help:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-01-16T21:25:12.130" Title="Why do I get the error 'IBMQManagedResultDataNotAvailable'?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;qasm&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15551" PostTypeId="2" ParentId="15546" CreationDate="2021-01-16T23:13:32.277" Score="2" Body="&lt;h2&gt;General procedure&lt;/h2&gt;&#xA;&lt;p&gt;First, write down the eigendecomposition of your observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_{m} \lambda_m P_m&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_m$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;th eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; is the associated projector. Next, compute the projections of the input state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; on the eigenspaces of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_m\rangle = P_m|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$|\psi_m\rangle$&lt;/span&gt; is not normalized. The square of its norm is the probability of the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;th measurement outcome and normalized &lt;span class=&quot;math-container&quot;&gt;$|\psi_m\rangle$&lt;/span&gt; is the post-measurement state.&lt;/p&gt;&#xA;&lt;p&gt;Explicitly, the probability of obtaining the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;th outcome is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m) = \|\,|\psi_m\rangle\,\|^2 = \langle\psi_m|\psi_m\rangle = \langle\psi|P_m^2|\psi\rangle = \langle\psi|P_m|\psi\rangle \tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born rule&lt;/a&gt; and the post-measurement state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_m'\rangle = \frac{|\psi_m\rangle}{\|\,|\psi_m\rangle\,\|} = \frac{P_m|\psi\rangle}{\sqrt{p(m)}}.\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Remark on measuring composite states&lt;/h2&gt;&#xA;&lt;p&gt;An important technicality is that when &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a composite state and we measure a subsystem, then &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; acts only on the subsystem being measured. Thus, we can extend &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; to a tensor product &lt;span class=&quot;math-container&quot;&gt;$P_m\otimes I$&lt;/span&gt; to obtain an equivalent operator acting on the composite system.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, we can use the fact that Dirac notation makes it easy to keep track of which bras and kets are acted on by the projector. This can be done implicitly by relying on the order of bra and ket labels or explicitly by adding subscripts to states and operators. Below, we do this implicitly, but add color for readability.&lt;/p&gt;&#xA;&lt;h2&gt;Example&lt;/h2&gt;&#xA;&lt;p&gt;Let us apply the above to the measurement of &lt;span class=&quot;math-container&quot;&gt;$A = \sigma_x$&lt;/span&gt; on the first qubit of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = (|{+-}\rangle+|{-+}\rangle)/\sqrt{2}$&lt;/span&gt;. Eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sigma_x = |+\rangle\langle+| - |-\rangle\langle-|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Substituting into &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;p(+1) &amp;amp;= \langle\psi\color{red}{|+\rangle\langle+|}\psi\rangle \\&#xA;&amp;amp;= \frac{1}{2}(\langle{+-}|+\langle{-+}|)\color{red}{|+\rangle\langle+|}(|{+-}\rangle+|{-+}\rangle) \\&#xA;&amp;amp;= \frac{1}{2}(\langle+\color{red}{|+\rangle\langle+|}+\rangle \langle-|-\rangle \\&#xA;&amp;amp;+ \langle+\color{red}{|+\rangle\langle+|}-\rangle \langle-|+\rangle \\&#xA;&amp;amp;+ \langle-\color{red}{|+\rangle\langle+|}+\rangle \langle+|-\rangle \\&#xA;&amp;amp;+ \langle-\color{red}{|+\rangle\langle+|}-\rangle \langle+|+\rangle) \\&#xA;&amp;amp;= \frac{1}{2}(1 + 0 + 0 + 0) \\&#xA;&amp;amp;= \frac{1}{2}&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we the projector &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle+|$&lt;/span&gt; acts on the first qubit. From &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;, the post-measurement state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|\psi_+'\rangle &amp;amp;= \frac{|+\rangle\langle+|\psi\rangle}{\sqrt{p(m)}} \\&#xA;&amp;amp;= \frac{|+\rangle\langle+|\frac{|{+-}\rangle+|{-+}\rangle}{\sqrt{2}}}{\sqrt{\frac{1}{2}}} \\&#xA;&amp;amp;= |{+}\rangle\langle+|{+-}\rangle + |+\rangle\langle+|{-+}\rangle \\&#xA;&amp;amp;= |{+-}\rangle + 0 \\&#xA;&amp;amp;= |{+-}\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where as before the projector &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle+|$&lt;/span&gt; acts on the first qubit in the two-qubit kets.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-16T23:13:32.277" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15552" PostTypeId="1" CreationDate="2021-01-17T08:33:19.220" Score="3" ViewCount="30" Body="&lt;p&gt;I have recently found papers on approximate quantum adders. However, the papers do not seem to mention the computational complexities of their algorithms. What are their complexities, in terms of big O notation?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.116.110403&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.116.110403&lt;/a&gt;&#xA;&lt;a href=&quot;https://www.degruyter.com/view/journals/qmetro/4/1/article-p1.xml?language=en&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.degruyter.com/view/journals/qmetro/4/1/article-p1.xml?language=en&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9903" LastEditorUserId="55" LastEditDate="2021-01-18T13:31:01.843" LastActivityDate="2021-01-18T13:31:01.843" Title="What is the computational complexity of approximate quantum adders, in terms of big O notation?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15553" PostTypeId="1" CreationDate="2021-01-17T10:38:25.723" Score="1" ViewCount="55" Body="&lt;p&gt;how can I measure any qubit state in Y-basis in qiskit. there is this solution here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13605/how-to-measure-in-another-basis&quot;&gt;How to measure in another basis&lt;/a&gt; but it gives the qubit's position on bloch sphere in z-axis where as I think it should be on y-axis just like in X-measurement basis (created by H,Z-measure,H) the qubit position is always on x-axis.&lt;/p&gt;&#xA;&lt;p&gt;The y-basis measurement in solution (link above) uses the initial state of |+⟩ and if we change the qubit initial state  to 0 or 1 it collapses onto z-axis whereas it should remain on y-axis , if it is correctly measuring in y-basis, right?&lt;/p&gt;&#xA;&lt;p&gt;Any guidance about how we can measure in y-basis using qiskit would be appreciated.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11539" LastActivityDate="2021-01-17T10:38:25.723" Title="Measurement of any qubit state in Y-basis" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-01-19T12:30:50.290" ContentLicense="CC BY-SA 4.0" />
  <row Id="15554" PostTypeId="1" CreationDate="2021-01-17T16:12:26.133" Score="1" ViewCount="157" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ttMoK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ttMoK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Describe the state of the qubit at points A, B and C. How does this demonstrate that we need the “ket” (or the vector) representation of qubits, rather than just describing them in terms of probabilities (e.g. “this is a qubit with a 50% probability of being a 1”).&lt;/p&gt;&#xA;" OwnerUserId="14491" LastEditorUserId="55" LastEditDate="2021-01-18T13:31:30.940" LastActivityDate="2021-01-18T13:31:30.940" Title="How to describe the state of a qubit passing through two Hadamard gates?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;&lt;superposition&gt;" AnswerCount="2" CommentCount="3" FavoriteCount="1" ClosedDate="2021-01-20T23:45:01.653" ContentLicense="CC BY-SA 4.0" />
  <row Id="15555" PostTypeId="2" ParentId="15554" CreationDate="2021-01-17T16:58:24.157" Score="4" Body="&lt;p&gt;By definition, the Hadamard gate can be written in the computational basis as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, note that applying a Hadamard gate to the state, says, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |0\rangle$&lt;/span&gt;, then it is equivalent to be doing the following rotation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qvPkv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qvPkv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So what if you apply another Hadamard gate? What would happen? Well, firs note that he inverse of Hadamard gate is itself. That is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H^{-1} =  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix} = H $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, you apply another Hadamard gate then you will get back to the same spot as indicated by the picture below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kk2YT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kk2YT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The takeaway is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$HH|\psi\rangle = H H^{-1} |\psi \rangle = I |\psi \rangle = |\psi\rangle \ \ \ \textrm{where $I$ is the Identity operator.}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence, applying the Hadmard gate twice to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; will keep the state as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This doesn't change even if  &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is in some superposition state. That is, suppose, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \sqrt{\dfrac{2}{3}}|0\rangle + \sqrt{\dfrac{2}{3}}|1\rangle  $&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SCuiT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SCuiT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if you apply a Hadamard gate, then geometrically, it is equivalent as doing:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zbdHT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zbdHT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if you apply another Hadamard gate  you will get back to the original vector/state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \sqrt{\dfrac{2}{3}}|0\rangle + \sqrt{\dfrac{2}{3}}|1\rangle  $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Qqz1W.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qqz1W.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;So if starting at the stage &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, you have arbitrary state  &lt;span class=&quot;math-container&quot;&gt;$|\psi_A \rangle = \begin{pmatrix} \cos \dfrac{\theta}{2} \\ e^{i \phi} \sin \dfrac{\theta}{2} \end{pmatrix}$&lt;/span&gt; then by applying Hadamard gate you get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H |\psi \rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix} \begin{pmatrix} \cos \dfrac{\theta}{2} \\ e^{i \phi} \sin \dfrac{\theta}{2} \end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} \cos \dfrac{\theta}{2} + e^{i \phi} \sin \dfrac{\theta}{2} \\ \cos \dfrac{\theta}{2} - e^{i \phi} \sin \dfrac{\theta}{2} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So at stage &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, your qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_B \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} \cos \dfrac{\theta}{2} + e^{i \phi} \sin \dfrac{\theta}{2} \\ \cos \dfrac{\theta}{2} - e^{i \phi} \sin \dfrac{\theta}{2} \end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and like what we discussed above, applying another Hadamard gate will get it back to the starting vector &lt;span class=&quot;math-container&quot;&gt;$|\psi_A\rangle$&lt;/span&gt;. That is, the qubit at stage &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;  have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_C \rangle = |\psi_A\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-17T17:19:09.423" LastActivityDate="2021-01-17T17:19:09.423" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15556" PostTypeId="2" ParentId="15554" CreationDate="2021-01-17T17:27:26.527" Score="4" Body="&lt;p&gt;&lt;strong&gt;Qubit states at points A, B and C&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let the input pure state be &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = a|0\rangle + b|1\rangle$&lt;/span&gt;. At point A the state is simply&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_A\rangle = |\psi\rangle = a|0\rangle + b|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;since there are no gates that change the input state before the point A. At point B the state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_B\rangle = H|\psi\rangle = \frac{a}{\sqrt{2}}(|0\rangle + |1\rangle) + \frac{b}{\sqrt{2}}(|0\rangle - |1\rangle) = \frac{a+b}{\sqrt{2}}|0\rangle + \frac{a-b}{\sqrt{2}}|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;due to the action of the first Hadamard&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, at point C the state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_C\rangle = HH|\psi\rangle = a|0\rangle + b|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because Hadamard is self-inverse, i.e. &lt;span class=&quot;math-container&quot;&gt;$HH = I$&lt;/span&gt;, as can be  checked by matrix multiplication.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Why superpositions cannot be described as probabilistic mixtures?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The behavior of the quantum circuit in the question rules out description of quantum superpositions as probabilistic mixtures (e.g. the qubit is in the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; state with probability 50% and in the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; state with probability 50%), because the process of forming a probabilistic mixture is not invertible. In particular, applying it twice does not return back to the initial state as it does in the case of the Hadamard gate. There are two compatible explanations of this fact: one from purely mathematical perspective and the other from the physics point of view.&lt;/p&gt;&#xA;&lt;p&gt;Mathematically, a process of forming an equal probabilistic mixture is described by the stochastic matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\frac{1}{2} &amp;amp; \frac{1}{2} \\&#xA;\frac{1}{2} &amp;amp; \frac{1}{2}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This does not describe a quantum gate because - unlike the Hadamard above - it is not invertible. In particular, applying it twice to a vector does not return it to its original state. Note that by the postulates of quantum mechanics evolution of any closed quantum system is unitary and hence invertible.&lt;/p&gt;&#xA;&lt;p&gt;Physically, the description of superpositions as probabilistic mixtures turns out to be insufficient because probabilities cannot interfere destructively whereas amplitudes of a quantum states can. Indeed, we can see destructive interference in action as it cancels out the amplitude of the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state when we compute &lt;span class=&quot;math-container&quot;&gt;$HH|0\rangle$&lt;/span&gt; step by step&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;HH|0\rangle &amp;amp;= \frac{1}{\sqrt{2}}H|0\rangle + \frac{1}{\sqrt{2}}H|1\rangle\\&#xA;&amp;amp;= \frac{1}{2}(|0\rangle +|1\rangle)+ \frac{1}{2}(|0\rangle -|1\rangle)\\&#xA;&amp;amp;= \left(\frac{1}{2} + \frac{1}{2}\right)|0\rangle +&#xA;   \left(\color{red}{\frac{1}{2} - \frac{1}{2}}\right)|1\rangle\\&#xA;&amp;amp;= 1|0\rangle + \color{red}{0}|1\rangle =\\&#xA;&amp;amp; = |0\rangle.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Probabilities of terms in a mixture are never subtracted this way, because probabilities cannot be negative.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-17T18:12:23.710" LastActivityDate="2021-01-17T18:12:23.710" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15558" PostTypeId="1" CreationDate="2021-01-17T19:17:57.230" Score="3" ViewCount="53" Body="&lt;p&gt;I tried to submit around 2000 circuits with &amp;quot;job_manager&amp;quot;, and it turns out that some jobs are not submitted. Please see the code and error message below. I understand that we can submit max 5 jobs at a time, so it is not surprised to get the WARNING, but those jobs should be submitted when the previous ones are finished. Also please note that the &amp;quot;experiment 375&amp;quot; (the one triggers the error message) is not failed, but it is not submitted at all.&lt;/p&gt;&#xA;&lt;p&gt;I also checked the job history, see the screenshot below. Indeed, &amp;quot;L_3_vqe_qc_5&amp;quot; was missed, and never submitted afterwards, which exactly corresponds to the 375th experiment. Is there any way to avoid this?&lt;/p&gt;&#xA;&lt;p&gt;Many thanks for the help!&lt;/p&gt;&#xA;&lt;p&gt;(EDIT: A bit of search leads to me the &amp;quot;timeout&amp;quot; error discussed here &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/issues/1169&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/issues/1169&lt;/a&gt;. Has this issue been solved?)&lt;/p&gt;&#xA;&lt;p&gt;(EDIT2: See the post &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15578/why-did-job-manager-submit-the-same-job-twice-and-how-to-fix-it/15579#15579&quot;&gt;Why did &amp;quot;job_manager&amp;quot; submit the same job twice and how to fix it?&lt;/a&gt;, for a workaround of the issue here.)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Need to transpile the circuits first.&#xA;qclist = transpile(qclist, backend=backend)&#xA;&#xA;# Use Job Manager to break the circuits into multiple jobs.&#xA;job_manager = IBMQJobManager()&#xA;job_set = job_manager.run(qclist, backend=backend, name='L_3_vqe_qc')&#xA;&#xA;&#xA;result_qc = job_set.results()&#xA;result_qc = [ result_qc.get_counts(ind) for ind in range(len(qclist)) ]&#xA;print( result_qc )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the error message is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;managedjob._async_submit:WARNING:2021-01-17 00:07:26,619: Job limit reached, waiting for job 6003f01db16bee437192eab7 to finish before submitting the next one.&#xA;/Users/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedjob.py:133: UserWarning: Unable to submit job for experiments 375-449: 'Timeout while waiting for job 6003f01db16bee437192eab7.'&#xA;  warnings.warn(&amp;quot;Unable to submit job for experiments {}-{}: {}&amp;quot;.format(&#xA;managedjob._async_submit:WARNING:2021-01-17 00:12:27,968: Job limit reached, waiting for job 6003f01db16bee437192eab7 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:13:32,341: Job limit reached, waiting for job 6003f022c4547b677c533108 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:17:32,482: Job limit reached, waiting for job 6003f02a9110da92007c4c14 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:18:36,084: Job limit reached, waiting for job 6003f0319110dadeec7c4c15 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:20:12,296: Job limit reached, waiting for job 6003f037c4547b774953310b to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:24:15,390: Job limit reached, waiting for job 6003f1a9b16beeb3de92eac4 to finish before submitting the next one.&#xA;/Users/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedjob.py:133: UserWarning: Unable to submit job for experiments 825-899: 'Timeout while waiting for job 6003f1a9b16beeb3de92eac4.'&#xA;  warnings.warn(&amp;quot;Unable to submit job for experiments {}-{}: {}&amp;quot;.format(&#xA;managedjob._async_submit:WARNING:2021-01-17 00:29:17,112: Job limit reached, waiting for job 6003f1a9b16beeb3de92eac4 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:29:44,659: Job limit reached, waiting for job 6003f2992159c385a834e9bc to finish before submitting the next one.&#xA;/Users/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedjob.py:133: UserWarning: Unable to submit job for experiments 975-1049: 'Timeout while waiting for job 6003f2992159c385a834e9bc.'&#xA;  warnings.warn(&amp;quot;Unable to submit job for experiments {}-{}: {}&amp;quot;.format(&#xA;managedjob._async_submit:WARNING:2021-01-17 00:34:45,966: Job limit reached, waiting for job 6003f2992159c385a834e9bc to finish before submitting the next one.&#xA;/Users/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedjob.py:133: UserWarning: Unable to submit job for experiments 525-599: 'Timeout while waiting for job 6003f2992159c385a834e9bc.'&#xA;  warnings.warn(&amp;quot;Unable to submit job for experiments {}-{}: {}&amp;quot;.format(&#xA;managedjob._async_submit:WARNING:2021-01-17 00:39:47,453: Job limit reached, waiting for job 6003f2992159c385a834e9bc to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:43:01,237: Job limit reached, waiting for job 6003f2d9cf834acf2a506bb9 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:43:57,144: Job limit reached, waiting for job 6003f338b16bee9d0892eace to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:45:06,760: Job limit reached, waiting for job 6003f42ccf834a050f506bc7 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:50:02,826: Job limit reached, waiting for job 6003f5762f13a0c4006406c1 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 00:52:24,291: Job limit reached, waiting for job 6003f8924ae4e577be32c9a2 to finish before submitting the next one.&#xA;/Users/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedjob.py:133: UserWarning: Unable to submit job for experiments 1500-1574: 'Timeout while waiting for job 6003f8924ae4e577be32c9a2.'&#xA;  warnings.warn(&amp;quot;Unable to submit job for experiments {}-{}: {}&amp;quot;.format(&#xA;managedjob._async_submit:WARNING:2021-01-17 00:57:25,735: Job limit reached, waiting for job 6003f8924ae4e577be32c9a2 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:01:09,173: Job limit reached, waiting for job 6003f8cbcf834a4441506bef to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:01:53,181: Job limit reached, waiting for job 6003f910cf834a4424506bf2 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:02:35,367: Job limit reached, waiting for job 6003fa384ae4e5712332c9b1 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:03:18,686: Job limit reached, waiting for job 6003fac6b16bee172792eb14 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:04:29,024: Job limit reached, waiting for job 6003fcd32f13a0533b640708 to finish before submitting the next one.&#xA;/Users/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedjob.py:133: UserWarning: Unable to submit job for experiments 1950-2024: 'Timeout while waiting for job 6003fcd32f13a0533b640708.'&#xA;  warnings.warn(&amp;quot;Unable to submit job for experiments {}-{}: {}&amp;quot;.format(&#xA;managedjob._async_submit:WARNING:2021-01-17 01:09:30,436: Job limit reached, waiting for job 6003fcd32f13a0533b640708 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:09:54,575: Job limit reached, waiting for job 6003fcfe2159c3caa234ea17 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:10:38,221: Job limit reached, waiting for job 6003fd299e0e7f25ffb32405 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:11:21,017: Job limit reached, waiting for job 6003fd542f13a0689b64070c to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:12:03,256: Job limit reached, waiting for job 6003fd984ae4e536e332c9d2 to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:13:10,995: Job limit reached, waiting for job 6003fee0b16bee44e092eb3a to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:13:53,037: Job limit reached, waiting for job 6003ff0bb16bee98bf92eb3c to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:14:36,193: Job limit reached, waiting for job 6003ff36b16bee443992eb3f to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:15:18,779: Job limit reached, waiting for job 6003ff602159c3817c34ea2f to finish before submitting the next one.&#xA;managedjob._async_submit:WARNING:2021-01-17 01:16:01,750: Job limit reached, waiting for job 6003ffa44ae4e50f2032c9e5 to finish before submitting the next one.&#xA;---------------------------------------------------------------------------&#xA;IBMQManagedResultDataNotAvailable         Traceback (most recent call last)&#xA;&amp;lt;ipython-input-50-229aa73320ab&amp;gt; in &amp;lt;module&amp;gt;&#xA;      8 &#xA;      9 result_qc = job_set.results()&#xA;---&amp;gt; 10 result_qc = [ result_qc.get_counts(ind) for ind in range(len(qclist)) ]&#xA;     11 print( result_qc )&#xA;&#xA;&amp;lt;ipython-input-50-229aa73320ab&amp;gt; in &amp;lt;listcomp&amp;gt;(.0)&#xA;      8 &#xA;      9 result_qc = job_set.results()&#xA;---&amp;gt; 10 result_qc = [ result_qc.get_counts(ind) for ind in range(len(qclist)) ]&#xA;     11 print( result_qc )&#xA;&#xA;~/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedresults.py in get_counts(self, experiment)&#xA;    125                 be found.&#xA;    126         &amp;quot;&amp;quot;&amp;quot;&#xA;--&amp;gt; 127         result, exp_index = self._get_result(experiment)&#xA;    128         return result.get_counts(exp_index)&#xA;    129 &#xA;&#xA;~/psi4conda/envs/env_for_qiskit/lib/python3.8/site-packages/qiskit/providers/ibmq/managed/managedresults.py in _get_result(self, experiment)&#xA;    226         (job, exp_index) = self._job_set.job(experiment)&#xA;    227         if job is None:&#xA;--&amp;gt; 228             raise IBMQManagedResultDataNotAvailable(&#xA;    229                 'Job for experiment {} was not successfully submitted.'.format(experiment))&#xA;    230 &#xA;&#xA;IBMQManagedResultDataNotAvailable: 'Job for experiment 375 was not successfully submitted.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Vh4Nr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vh4Nr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="9816" LastEditDate="2021-01-18T20:44:48.737" LastActivityDate="2021-01-19T13:30:58.223" Title="Why &quot;job_manager&quot; did not submit some of the jobs?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15559" PostTypeId="2" ParentId="15558" CreationDate="2021-01-17T20:21:48.907" Score="1" Body="&lt;p&gt;This might has to do with the fact that you can only submit 900 circuits in a particular job.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PP1ES.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PP1ES.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and since you are trying to submit 2000 circuits, this might be a problem. What you can do is split these circuits into different jobs.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-17T20:21:48.907" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15562" PostTypeId="2" ParentId="10012" CreationDate="2021-01-17T22:57:59.507" Score="0" Body="&lt;h2&gt;Ideal measurement&lt;/h2&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; denote the state resulting from the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; preparation. The fidelity of &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F: = F(|0\rangle, \rho_0) = \langle 0|\rho_0|0\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, the probability of obtaining &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; when measuring &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; in the computational basis is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(0|\rho_0) = \mathrm{tr}\left(|0\rangle\langle 0|\rho_0\right) = \langle 0|\rho_0|0\rangle.\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the fidelity is simply the probability of obtaining the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; outcome upon measuring the output &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; of the preparation in the computational basis. This suggests that if we prepare and measure &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times, counting the number &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; of times when &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is obtained then the fraction &lt;span class=&quot;math-container&quot;&gt;$\frac{k}{n}$&lt;/span&gt; approximates &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;. However, as pointed out by @nippon in the comments, this procedure assumes error-free measurement.&lt;/p&gt;&#xA;&lt;h2&gt;SPAM errors&lt;/h2&gt;&#xA;&lt;p&gt;In practice, measurements are not error-free and &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(0|\rho_0) = \mathrm{tr}(E_0\rho_0)\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; are POVM elements describing the real measurement. Note that &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; depends on both state preparation and measurement (SPAM) errors. For a full description of SPAM errors, we also require terms for the other computational basis state. These are usually collected into the so-called T matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T := \begin{pmatrix}&#xA;\mathrm{tr}(E_0\rho_0) &amp;amp; \mathrm{tr}(E_0\rho_1) \\&#xA;\mathrm{tr}(E_1\rho_0) &amp;amp; \mathrm{tr}(E_1\rho_1)&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where each column provides the measurement outcome distribution for the corresponding preparation. In the ideal case, &lt;span class=&quot;math-container&quot;&gt;$T = I$&lt;/span&gt;. See &lt;a href=&quot;https://arxiv.org/abs/2001.09980&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&lt;p&gt;Even though this quantity fails to separate preparation and measurement errors, it is easier to obtain than pure preparation fidelity and is also more useful in practice since every quantum state used in the course of a quantum algorithm is both prepared and measured and thus affected once by each type of error.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-25T18:10:14.167" LastActivityDate="2021-01-25T18:10:14.167" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15563" PostTypeId="1" AcceptedAnswerId="15564" CreationDate="2021-01-17T23:14:06.043" Score="6" ViewCount="186" Body="&lt;p&gt;I have trouble understanding two equations in the Nielsen &amp;amp; Chuang textbook. Suppose we perform a measurement described by the operator &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt;. If the initial state is &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, then the probability of getting result m is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m|i)=\langle\psi_i|M_m^\dagger M_m|\psi_i\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The form of this equation looks like the overlap between two states, but I'm not exactly sure what &lt;span class=&quot;math-container&quot;&gt;$ M_m|\psi_i\rangle$&lt;/span&gt; means? Is this relevant to the projection operator?&lt;/p&gt;&#xA;&lt;p&gt;Also, given the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, the state after obtaining the result m is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_i^m\rangle = \frac{M_m|\psi_i\rangle}{\sqrt{\langle\psi_i|M_m^\dagger M_m|\psi_i\rangle}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why is this the case?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/608382/58382&quot;&gt;&lt;em&gt;&lt;strong&gt;Cross-posted on physics.SE&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-01-18T23:23:59.277" LastActivityDate="2021-01-18T23:23:59.277" Title="What does $M_m |\psi_i\rangle$ mean in the equation $p(m|i)=\langle\psi_i|M_m^\dagger M_m|\psi_i\rangle$?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15564" PostTypeId="2" ParentId="15563" CreationDate="2021-01-18T00:04:56.283" Score="7" Body="&lt;h2&gt;Measurement postulate&lt;/h2&gt;&#xA;&lt;p&gt;The statement you are asking about is a &lt;em&gt;postulate&lt;/em&gt; of quantum mechanics, so it cannot be mathematically derived from other facts in the theory. Instead, it is justified by its agreement with observation in the sense that it allows us to mathematically describe every measurement we can perform in practice.&lt;/p&gt;&#xA;&lt;h2&gt;Intuitive interpretation&lt;/h2&gt;&#xA;&lt;p&gt;The meaning of &lt;span class=&quot;math-container&quot;&gt;$M_m|\psi_i\rangle$&lt;/span&gt; is that this is the unnormalized post-measurement state. The measurement postulate provides a prescription for computing two quantities: measurement outcome probability &lt;span class=&quot;math-container&quot;&gt;$p(m|i)$&lt;/span&gt; and post-measurement state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i^m\rangle$&lt;/span&gt;. Both are derived from &lt;span class=&quot;math-container&quot;&gt;$M_m|\psi_i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, the measurement outcome probability &lt;span class=&quot;math-container&quot;&gt;$p(m|i)$&lt;/span&gt; is the squared norm of &lt;span class=&quot;math-container&quot;&gt;$M_m|\psi_i\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m|i) = \| M_m|\psi_i\rangle \|^2 = \langle \psi_i | M_m^\dagger M_m|\psi_i\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The reason it looks like state overlap is because the norm is the defined  in terms of the inner product as &lt;span class=&quot;math-container&quot;&gt;$\| |\psi\rangle \| = \sqrt{\langle\psi|\psi\rangle}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The post-measurement (or collapsed) state is the normalized &lt;span class=&quot;math-container&quot;&gt;$M_m|\psi_i\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_i^m\rangle = \frac{M_m|\psi_i\rangle}{\| M_m|\psi_i\rangle \|} = \frac{M_m|\psi_i\rangle}{\sqrt{\langle \psi_i | Mm^\dagger M_m|\psi_i\rangle}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Relationship to projective measurement&lt;/h2&gt;&#xA;&lt;p&gt;This form of measurement postulate defines a more general type of measurement than the projective measurement. The latter is a special case in which &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt; are projectors. In this case, &lt;span class=&quot;math-container&quot;&gt;$M_m^\dagger = M_m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_m^\dagger M_m = M_m$&lt;/span&gt; and we recover the familiar projective measurement. In general though the measurement operators &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt; do not need to be projectors.&lt;/p&gt;&#xA;&lt;p&gt;A prominent example of non-projective measurements that can be described using the general form of the postulate are the &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;noreferrer&quot;&gt;POVM measurements&lt;/a&gt;. However, even though the general form subsumes the projective measurement, it is possible to implement the general measurement using  projective measurement, unitary evolution and auxillary subsystems, see p.94 in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-18T00:20:29.950" LastActivityDate="2021-01-18T00:20:29.950" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15565" PostTypeId="1" AcceptedAnswerId="15566" CreationDate="2021-01-18T06:06:13.027" Score="8" ViewCount="251" Body="&lt;p&gt;I have been through the Young's double slit experiment. It's a direct proof or instance of showing that a wave is collapsed via observation or measurement, and shows no interference patterns.&lt;/p&gt;&#xA;&lt;p&gt;I want to do something similar in a quantum circuit, not visual interference but something to distinguish between a collapsed qubit and an uncertain qubit. So that I can notice the difference while alternatively putting and omitting measurement on the pathway of a superposed qubit.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Update:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;I followed @AdamZalcman 's  answer and coded the whole thing up on a &lt;a href=&quot;https://github.com/sayan1999/quantum-computing-with-qiskit/blob/master/Measurement%20and%20Collapse.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;notebook&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/b3XC3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/b3XC3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14481" LastEditorUserId="55" LastEditDate="2021-05-02T11:22:46.697" LastActivityDate="2021-05-02T11:22:46.697" Title="How to distinguish between collapsed and uncertain qubits in a quantum circuit?" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;measurement&gt;&lt;superposition&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15566" PostTypeId="2" ParentId="15565" CreationDate="2021-01-18T07:17:03.690" Score="9" Body="&lt;p&gt;Consider a quantum circuit on one qubit initialized in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and consisting of two Hadamard gates where we can insert a measurement between the Hadamards.&lt;/p&gt;&#xA;&lt;p&gt;The input state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, so the state after the first Hadamard gate is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is an equal superposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with zero relative phase.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Case 1: measurement absent&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the absence of measurement, the second Hadamard causes constructive interference of amplitudes on the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state (in green below) and destructive interference of the amplitudes on the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state (in red below)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;H\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)&#xA;&amp;amp;= \frac{1}{2}(|0\rangle +|1\rangle)+ \frac{1}{2}(|0\rangle -|1\rangle)\\&#xA;&amp;amp;= \left(\color{green}{\frac{1}{2} + \frac{1}{2}}\right)|0\rangle +&#xA;   \left(\color{red}{\frac{1}{2} - \frac{1}{2}}\right)|1\rangle\\&#xA;&amp;amp;= \color{green}{1}|0\rangle + \color{red}{0}|1\rangle =\\&#xA;&amp;amp; = |0\rangle.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Case 2: measurement present&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now suppose we insert a measurement in the computational basis between the Hadamards. Since we are measuring &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; in the computational basis, we have an equal chance of collapsing the qubit into the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state and the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. After state collapse we end up in&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in the former case and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in the letter case. Regardless of which case takes place, the interference observed previously does not occur.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Comparison to Young's experiment&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In practice, in order to observe the difference in behavior, we need to add a terminal measurement after the second Hadamard to both circuits. As in the case of interference patterns in the double slit experiment, the difference manifests itself in the different output probability distribution.&lt;/p&gt;&#xA;&lt;p&gt;In the case of Young's experiment it is the distribution of photon locations and in the case of the above circuits it is the distribution of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s output from the terminal measurement. The first circuit yields measurement outcome &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; every time it is executed. The second circuit yields the outcome &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; half the time and the outcome &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; half the time.&lt;/p&gt;&#xA;&lt;p&gt;In a sense, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; corresponds to the bright band in the interference pattern and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; corresponds to the dark band. When a measurement is added between the Hadamards, the pattern disappears and both bands register half of the &amp;quot;brightness&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-18T07:17:03.690" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15567" PostTypeId="1" AcceptedAnswerId="15568" CreationDate="2021-01-18T10:09:39.433" Score="3" ViewCount="104" Body="&lt;p&gt;I have to implement Simon's algorithm in Cirq. I have problems determining the oracle &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; defined such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=f(x\oplus a)$&lt;/span&gt; from a certain value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Given a random &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, is there a general way to define the oracle &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;? Or at least, how can I determine the oracle from a certain &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I think the following code (from &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/examples/simon_algorithm.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq Github repo&lt;/a&gt;) answers my question but I cannot understand it.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def make_oracle(input_qubits, output_qubits, secret_string):&#xA;&amp;quot;&amp;quot;&amp;quot;Gates implementing the function f(a) = f(b) iff a ⨁ b = s&amp;quot;&amp;quot;&amp;quot;&#xA;# Copy contents to output qubits:&#xA;for control_qubit, target_qubit in zip(input_qubits, output_qubits):&#xA;    yield cirq.CNOT(control_qubit, target_qubit)&#xA;&#xA;# Create mapping:&#xA;if sum(secret_string):  # check if the secret string is non-zero&#xA;    # Find significant bit of secret string (first non-zero bit)&#xA;    significant = list(secret_string).index(1)&#xA;&#xA;    # Add secret string to input according to the significant bit:&#xA;    for j in range(len(secret_string)):&#xA;        if secret_string[j] &amp;gt; 0:&#xA;            yield cirq.CNOT(input_qubits[significant], output_qubits[j])&#xA;# Apply a random permutation:&#xA;pos = [&#xA;    0,&#xA;    len(secret_string) - 1,&#xA;]  # Swap some qubits to define oracle. We choose first and last:&#xA;yield cirq.SWAP(output_qubits[pos[0]], output_qubits[pos[1]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14495" LastEditorUserId="55" LastEditDate="2021-01-20T20:03:46.997" LastActivityDate="2021-01-20T20:03:46.997" Title="In Simon's algorithm, is there a general method to define an oracle given a certain periodicity?" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;cirq&gt;&lt;oracles&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15568" PostTypeId="2" ParentId="15567" CreationDate="2021-01-18T10:35:45.810" Score="4" Body="&lt;p&gt;Assuming &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits, here's a simple procedure: take &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; ancilla qubits, all prepared in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Do a transversal controlled-not (i.e. bit by bit controlled-not) from the register with &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; to the ancilla register. THis means that if you started wuth&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_xa_x|x\rangle,&#xA;$$&lt;/span&gt;&#xA;you now have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_xa_x|x\rangle|x\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, find a bit of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; which is 1. Let's say this is bit &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Do a controlled-not from qubit b of the original register, targeting all the qubits &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; of the second register for which &lt;span class=&quot;math-container&quot;&gt;$a_q=1$&lt;/span&gt;. This means that for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$x_b=0$&lt;/span&gt;, the second register is still &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, while if &lt;span class=&quot;math-container&quot;&gt;$x_b=1$&lt;/span&gt;, the second register has become &lt;span class=&quot;math-container&quot;&gt;$x\oplus a$&lt;/span&gt;. In particular, the &lt;span class=&quot;math-container&quot;&gt;$b^{th}$&lt;/span&gt; qubit of the ancilla register must be 0, and that qubit can be dropped.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-01-18T10:35:45.810" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15569" PostTypeId="2" ParentId="15517" CreationDate="2021-01-18T12:09:35.003" Score="2" Body="&lt;p&gt;This is a good question, but one that probably doesn't have a satisfying answer, as of yet.&lt;/p&gt;&#xA;&lt;p&gt;One can say what entanglement &lt;em&gt;is not&lt;/em&gt;; how you should not imagine it. In particular, it is not a &lt;em&gt;causal link&lt;/em&gt; between observations/systems (as per &lt;a href=&quot;https://en.wikipedia.org/wiki/No-communication_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;no-communication theorem&lt;/a&gt; etc.). It is, instead, a form of &lt;em&gt;correlation&lt;/em&gt; between observations made on different systems.&lt;/p&gt;&#xA;&lt;p&gt;You can imagine classical correlation with an example such as the following: you have a bunch of coloured red and blue marbles. You distribute these into two boxes, close the boxes, and give them to Alice and Bob, which then go on their separate ways. Now the content of the boxes are &lt;em&gt;correlated&lt;/em&gt;: whenever Alice opens her box to observe the number of marbles in her box, assuming she knows the total amount of marbles distributed between her and Bob, she can &amp;quot;instantaneously&amp;quot; infer which marbles are in Bob's box.&lt;/p&gt;&#xA;&lt;p&gt;That's the same way entanglement works: measuring a state on one part of an entangled system you immediately know something about the state of the other part. You are not &lt;em&gt;transferring information&lt;/em&gt;, you are just &lt;em&gt;learning&lt;/em&gt; something about the other side of the system due to prior knowledge about their underlying correlations. Except in the quantum case it is not &lt;em&gt;quite&lt;/em&gt; that simple. You &lt;em&gt;cannot&lt;/em&gt; think of the situation as there being some shared classical correlation which allows you to learn properties of B's state by observing something about A's state. Quantum correlations are (can be) stronger than that. This is what allows to perform shenanigans such as teleportation or superdense coding.&#xA;A system is &lt;em&gt;entangled&lt;/em&gt; precisely when the above picture of &amp;quot;classical correlations&amp;quot; stops being sufficient to describe observations.&lt;/p&gt;&#xA;&lt;p&gt;In particular, the intrinsically destructive nature of quantum measurements oughts to be taken into account. You see this from the fact that entanglement cannot be observed without comparing correlations observed in different measurement bases.&#xA;This is I think something that makes understanding entanglement tricky: it's not about correlations between measurement results; it's about correlations between the states themselves, that is, between measurement results in any choice of measurement basis.&lt;/p&gt;&#xA;&lt;p&gt;I don't think one can say much more than this without entering into the realm of speculation and less-than-mainstream physical interpretations. I personally never found/stumbled upon a satisfying (and accurate) way to visualise entanglement without relying on the underlying math (but of course, whether one finds a given visualisation &amp;quot;satisfying&amp;quot; is subjective).&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-01-18T12:17:22.550" LastActivityDate="2021-01-18T12:17:22.550" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15571" PostTypeId="1" CreationDate="2021-01-18T16:06:27.503" Score="-3" ViewCount="56" Body="&lt;p&gt;This is a question regarding the Qiskit Aqua package. I have been studying&lt;a href=&quot;https://i.stack.imgur.com/Es6Mg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Es6Mg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt; HHL algorithm from QISKIT textbook and after understanding the math I finally got to the code part, I am having a hard time understanding what is going on. I know how to write code in order to create gates and making a Quantum Circuit, but &lt;strong&gt;I can't find good resources for Aqua. If you guys could point me to some examples or something helpful&lt;/strong&gt;, it will be greatly appreciated. I have also posted a screenshot where I got confused.&lt;/p&gt;&#xA;" OwnerUserId="14500" LastEditorUserId="23" LastEditDate="2021-02-12T10:56:22.050" LastActivityDate="2021-02-12T10:56:22.050" Title="Query on the HHL Algorithm in the Qiskit Aqua Library" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;resource-request&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-01-20T23:46:07.177" ContentLicense="CC BY-SA 4.0" />
  <row Id="15572" PostTypeId="1" CreationDate="2021-01-18T16:15:06.850" Score="6" ViewCount="102" Body="&lt;p&gt;I am trying to write  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+i|1\rangle$&lt;/span&gt; in terms of elementary gates like H, CNOT, Pauli Y, using the IBM QE circuit composer.&lt;/p&gt;&#xA;&lt;p&gt;I was thinking some kind of combination of H and Y since &lt;span class=&quot;math-container&quot;&gt;$Y|0\rangle=i|1\rangle$&lt;/span&gt;, so it is close but not quite.&lt;/p&gt;&#xA;&lt;p&gt;Please help!&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="14502" LastEditorUserId="8623" LastEditDate="2021-01-18T19:27:18.567" LastActivityDate="2021-01-18T19:27:18.567" Title="How to create the state $\vert 0 \rangle+i \vert 1 \rangle$ using elementary gates?" Tags="&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;gate-synthesis&gt;&lt;pauli-gates&gt;&lt;ibm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15573" PostTypeId="2" ParentId="15571" CreationDate="2021-01-18T16:16:13.000" Score="1" Body="&lt;p&gt;I'd suggest the tutorials, they are always up-to-date and running:&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/tree/master/tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/tree/master/tutorials&lt;/a&gt;.&#xA;Aqua specific tutorials are e.g. in the chemistry, finance or algorithms subdirectories.&lt;/p&gt;&#xA;&lt;p&gt;(In fact, this particular example that you posted from the textbook is being refactored, as it is a bit confusing indeed!)&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-01-18T16:16:13.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15574" PostTypeId="2" ParentId="15572" CreationDate="2021-01-18T16:21:49.003" Score="1" Body="&lt;p&gt;H then S do the trick, it gives me this : &lt;a href=&quot;https://i.stack.imgur.com/uAPgW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uAPgW.png&quot; alt=&quot;Statevector&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-01-18T16:21:49.003" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15575" PostTypeId="2" ParentId="15572" CreationDate="2021-01-18T16:40:09.410" Score="0" Body="&lt;p&gt;It helps to know the action of various gates on the computational basis states. For example, the S gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S = \begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; i&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;keeps &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; fixed while phasing &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. This means that if we had the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$S(|0\rangle+|1\rangle)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+ i|1\rangle$&lt;/span&gt;, i.e. the state we need. We can obtain &lt;span class=&quot;math-container&quot;&gt;$|0\rangle+|1\rangle$&lt;/span&gt; by applying Hadamard&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;In summary, you can apply Hadamard and the S gate to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;SH|0\rangle = S\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = \frac{1}{\sqrt{2}}(S|0\rangle + S|1\rangle) = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we included normalization factors.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is not the only way to obtain &lt;span class=&quot;math-container&quot;&gt;$|0\rangle + i|1\rangle$&lt;/span&gt;. For example, the &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt; Y rotation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y\left(\frac{\pi}{2}\right) = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;1 &amp;amp; -1 \\&#xA;1 &amp;amp; 1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;can be used in place of the Hadamard. This is useful on hardware platforms that may not implement Hadamard natively.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-18T16:40:09.410" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15576" PostTypeId="2" ParentId="15572" CreationDate="2021-01-18T16:40:36.073" Score="7" Body="&lt;p&gt;Starting with the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0 \rangle = |0\rangle$&lt;/span&gt;, and we want to get to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_f \rangle = \dfrac{|0\rangle + i|1\rangle}{\sqrt{2}}$&lt;/span&gt; then we must realize that we need to create some sort of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_superposition&quot; rel=&quot;noreferrer&quot;&gt;superposition&lt;/a&gt; between the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. This is where the Hadamard gate will come into play. The Hadamard gate which defined in the computational basis &lt;span class=&quot;math-container&quot;&gt;$\bigg\{ |0\rangle = \begin{pmatrix} 1\\ 0 \\ \end{pmatrix} , |1\rangle = \begin{pmatrix} 0 \\ 1 \\ \end{pmatrix}  \bigg\}$&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix}$$&lt;/span&gt;&#xA;and it takes the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt;. This can be workout explicitly as through Matrix algebra as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H|0\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix}\begin{pmatrix} 1\\ 0 \\ \end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1\\ 1 \\ \end{pmatrix} = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we need to change the relative phase from of the above state. That is we want to change the state from &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + i|1\rangle}{\sqrt{2}} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1\\ i \\ \end{pmatrix} $&lt;/span&gt;. If you look at it closely, you will see that the unitary matrix (quantum gate) you want to apply should take the form as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; i \\ \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;since&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; i \\ \end{pmatrix}\dfrac{1}{\sqrt{2}}\begin{pmatrix} 1\\ 1 \\ \end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1\\ i \\ \end{pmatrix} = \dfrac{|0\rangle + i|1\rangle}{\sqrt{2}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrix &lt;span class=&quot;math-container&quot;&gt;$ \begin{pmatrix} 1&amp;amp; 0\\ 0 &amp;amp; i \\ \end{pmatrix}$&lt;/span&gt; has a special name, it is  called the &lt;strong&gt;Phase gate (or S gate)&lt;/strong&gt; in quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;So to summarize, we first apply the &lt;strong&gt;Hadamard gate&lt;/strong&gt; follows by the &lt;strong&gt;Phase gate&lt;/strong&gt; (As Lena pointed out in her answer as well) to get from the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_0 \rangle = |0\rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_f \rangle = \dfrac{|0\rangle + i|1\rangle}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The quantum circuit looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OHvh2.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OHvh2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-18T16:40:36.073" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15577" PostTypeId="1" AcceptedAnswerId="15588" CreationDate="2021-01-18T16:59:45.550" Score="4" ViewCount="53" Body="&lt;p&gt;Suppose that I have one noisy channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; and I want to fit it with another one &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_0(p)$&lt;/span&gt; that depends on some fitting parameter &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As both of this processes for me are represented by matrices, I would simply minimize the distance that I define as &lt;span class=&quot;math-container&quot;&gt;$$d(p) = ||\mathcal{E} - \mathcal{E}_0(p)||_2$$&lt;/span&gt; where for the norm &lt;span class=&quot;math-container&quot;&gt;$||\cdot||_2 $&lt;/span&gt; I would just take the square difference between the elements of the two matrices that represent the processes.&lt;/p&gt;&#xA;&lt;p&gt;Would it be correct using this distance? I read in Gilchrist et al. PRA 71, 062310 (2005)(&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0408063.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/0408063.pdf&lt;/a&gt;) that there are several metrics for processes, but I think that they should be all equivalent, as I have a finite Hilbert space. Am I missing something?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="13945" LastEditorUserId="55" LastEditDate="2021-01-20T20:04:47.020" LastActivityDate="2021-01-20T20:04:47.020" Title="How can I fit an unknown quantum channel?" Tags="&lt;quantum-operation&gt;&lt;noise&gt;&lt;quantum-process-tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15578" PostTypeId="1" AcceptedAnswerId="15597" CreationDate="2021-01-18T19:13:18.320" Score="1" ViewCount="29" Body="&lt;p&gt;In order to avoid the problem posted in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15558/why-job-manager-did-not-submit-some-of-the-jobs/15559?noredirect=1#comment21565_15559&quot;&gt;Why &amp;quot;job_manager&amp;quot; did not submit some of the jobs?&lt;/a&gt;, (the current issue is related but quite different, so I think it is more appropriate to ask separately), I divide the job to batches, with each batch having 75*5=375 circuits. Then I use (&amp;quot;item&amp;quot; below contains a list of 375 circuits)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_set = job_manager.run(item, backend=backend, name='L_5_vqe_qc' , shots = 8192 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;with the hope that &amp;quot;job_mamager&amp;quot; will submit the 5 jobs, each with 75 circuits. However, it turns out that the same job was submitted twice. See the screenshot below, where &amp;quot;L_5_vqe_qc_2&amp;quot; was submitted twice. Is this normal?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Fu16h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Fu16h.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2021-01-20T20:04:55.607" LastActivityDate="2021-01-20T20:04:55.607" Title="Why did &quot;job_manager&quot; submit the same job twice and how to fix it?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15579" PostTypeId="2" ParentId="15578" CreationDate="2021-01-18T20:43:26.997" Score="0" Body="&lt;p&gt;This is not an answer to the question above, but it is a workaround for the issue, and the one posted in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15558/why-job-manager-did-not-submit-some-of-the-jobs?noredirect=1&amp;amp;lq=1&quot;&gt;Why &amp;quot;job_manager&amp;quot; did not submit some of the jobs?&lt;/a&gt;. Essentially, I notice that after we submit the job with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_set = job_manager.run(item, backend=backend, name='L_5_vqe_qc' , shots = 8192 )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;we can continue to do other stuff. Previously I thought that the notebook will be occupied and we have to wait until the result comes back before we can run the subsequent code. Fortunately this is not the case. Thus, we can do the following, where &amp;quot;qclist&amp;quot; is a list, with each item contains 375 circuits. In this way, I think we can fully make use of the available resources in a controlled way.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result_qc = []&#xA;for item_ind in range(len(qclist)):&#xA;    item = qclist[item_ind]&#xA;    &#xA;    job_set_list = []&#xA;&#xA;    # This for loop will submit five jobs, each at a time&#xA;    # After that, the notebook will proceed to the next for loop&#xA;    for i in range(5): &#xA;        job_set_list.append( job_manager.run(item[i*75 : (i+1)*75], backend=backend, shots = 8192 ) )&#xA;    &#xA;    # This for loop will collect the results&#xA;    # We have to wait until the result comes back here&#xA;    for i in range(5):&#xA;        result_qc.append( job_set_list[i].results().get_counts(0) )&#xA;        &#xA;print( result_qc )&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastActivityDate="2021-01-18T20:43:26.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15580" PostTypeId="1" AcceptedAnswerId="15585" CreationDate="2021-01-18T21:17:54.507" Score="1" ViewCount="28" Body="&lt;p&gt;I am trying to to call &lt;code&gt;ApplyMultiplyControlledAnd()&lt;/code&gt;, and I'm receiving an error saying &amp;quot;The callable ApplyMultiplyControlledAnd exists in an open namespace, but is not accessible from here.&amp;quot; I have opened Microsoft.Quantum.Canon already, but I'm still getting the error. Any advice as to why this is happening would be greatly appreciated!&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="14019" LastActivityDate="2021-02-18T00:04:45.590" Title="Q# Callable Not Accessible from Open Namespace" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15581" PostTypeId="1" AcceptedAnswerId="15616" CreationDate="2021-01-18T21:32:01.877" Score="4" ViewCount="80" Body="&lt;p&gt;Suppose we perform a measurement described by measurement operators &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt;. If the initial state is &lt;span class=&quot;math-container&quot;&gt;$|{\psi_i}\rangle$&lt;/span&gt;, then the probability of getting result &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;    p(m|i)=\| M_m|\psi_i\rangle \|^2 = \langle\psi_i|M_m^\dagger M_m|\psi_i\rangle =tr(M_m^\dagger M_m|\psi_i\rangle\langle\psi_i|).&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;After a measurement that yields the result &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, we have an ensemble of states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i^m\rangle$&lt;/span&gt; with respective probabilities &lt;span class=&quot;math-container&quot;&gt;$p(i|m)$&lt;/span&gt;. The corresponding density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_m$&lt;/span&gt; is therefore&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho_m = \sum_ip(i|m)|\psi_i^m\rangle\langle\psi_i^m|.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering whether &lt;span class=&quot;math-container&quot;&gt;$p(i|m)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p(m|i)$&lt;/span&gt; refer to the inverse procedure? How are those two procedures connected? Is &lt;span class=&quot;math-container&quot;&gt;$|\psi_i^m\rangle$&lt;/span&gt; a subset of the initial ensemble &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;? Can I rewrite &lt;span class=&quot;math-container&quot;&gt;$\rho_m$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho_m = \sum_{ij}p(j|m)p(m|i)|\psi_{ij}^m\rangle\langle\psi_{ij}^m|&#xA;\end{align}&lt;/span&gt;&#xA;?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="10480" LastEditDate="2021-01-20T23:04:53.533" LastActivityDate="2021-01-20T23:04:53.533" Title="What's the difference between $p(i|m)$ and $p(m|i)$ in measurement?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15582" PostTypeId="1" AcceptedAnswerId="15583" CreationDate="2021-01-18T21:44:32.167" Score="3" ViewCount="30" Body="&lt;p&gt;I don't know very much the NISQ algorithms, but the ones that I know are based on kind of &amp;quot;Hybrid&amp;quot; calculation between a quantum computer and a classical computer.&lt;/p&gt;&#xA;&lt;p&gt;Indeed, for instance in QAOA, we can try to find the fundamental of some Hamiltonian.&#xA;To do this, we run a circuit with a given set of gates. We measure the qubit and &amp;quot;feed&amp;quot; it to some classical processing that either say &amp;quot;fundamental may have been found: stop&amp;quot;, or &amp;quot;make more iterations&amp;quot;. When &amp;quot;more iterations&amp;quot; occurs the circuit is changed according to a classical algorithm and the quantum algorithm is run again. And so on until we believe we found the solution (my summary is probably a little bit short/exagerated as I don't have in full memory the details but from what I remember it is something roughly like this)&lt;/p&gt;&#xA;&lt;p&gt;In this algorithm there are two important features:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There is a classical processing around that is used in parallel of the quantum which goal is to &amp;quot;update&amp;quot; the quantum circuit.&lt;/li&gt;&#xA;&lt;li&gt;We basically cannot know when the algorithm will stop &amp;quot;theoretically&amp;quot;. It is not like in fault tolerant quantum computing where an algorithm has a fixed Depth so that we can deduce when it will stop.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I wanted to know if all (seriously considered) NISQ algorithms are based on those two elements: circuit updated from classical processing AND you don't know &amp;quot;in advance&amp;quot; when the algorithm will stop ?&lt;/p&gt;&#xA;&lt;p&gt;From the example I read I think this is true but I don't know enough to be sure.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2021-01-18T22:54:43.427" LastActivityDate="2021-01-18T22:54:43.427" Title="NISQ algorithm: do they all have circuit updated between each run AND impossible to predict when they will stop?" Tags="&lt;algorithm&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15583" PostTypeId="2" ParentId="15582" CreationDate="2021-01-18T22:31:00.460" Score="5" Body="&lt;p&gt;What you described is the class of Variational Quantum Algorithms. Variational Quantum Eigensolver (VQE) and QAOA (Quantum Approximate Optimization Algorithm) are belong into this class. Says, you want to solve the following eigenvalue problem for some Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H|\psi \rangle = E|\psi\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In particular, you want to find the smallest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, then you can define a functional&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ E\big[ |\psi \rangle \big] = \langle \psi|H|\psi\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then base on the variational principle, minimizing this functional &lt;span class=&quot;math-container&quot;&gt;$\min E\big[ |\psi \rangle \big] $&lt;/span&gt; gives you approximately the lowest eigenvalue.&lt;/p&gt;&#xA;&lt;p&gt;The key ingredient on why these type of problems is appropriate on NISQ is because you can prepare &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and potentially evalutating &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|H|\psi\rangle $&lt;/span&gt; much faster on a quantum computer. This is especially true for some problems, like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Electronic_structure&quot; rel=&quot;noreferrer&quot;&gt;electronic structure problem&lt;/a&gt; in quantum chemistry.&lt;/p&gt;&#xA;&lt;p&gt;Now, during the classical minimization process, you can absolutely stuck at a local minimum. And you are right that we don't know when this optimization process will stop, but you can place a threshold in your algorithm. That is you can set the maximum number of iterations to be says 1000.&lt;/p&gt;&#xA;&lt;p&gt;It should also be noted that if your parameterized circuit (the circuit that one uses to prepare the trial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; ) has a lot of variables then you tends to run into the problem of  &lt;a href=&quot;https://arxiv.org/pdf/2001.00550.pdf&quot; rel=&quot;noreferrer&quot;&gt;Barren Plateaus&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/haDr1.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/haDr1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-18T22:34:27.550" LastActivityDate="2021-01-18T22:34:27.550" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15584" PostTypeId="1" CreationDate="2021-01-18T23:00:36.327" Score="4" ViewCount="60" Body="&lt;p&gt;I am wondering if a random unitary matrix taken from a Haar measure (as in, it is uniformly sampled at random) can yield a uniformly sampled random state vector.&lt;/p&gt;&#xA;&lt;p&gt;In section 3 of &lt;a href=&quot;https://arxiv.org/pdf/1502.03644.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; it says &amp;quot;It is worthwhile mentioning that, although not advantageous, it is possible to use the rows or columns of such a random unitary matrix as random state vector&amp;quot; and also says in the previous section that &amp;quot; Another manner of obtaining samples with similar properties is by using the rows or columns of random unitary matrices, which we shall discuss in the next section.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;I am a bit confused by the wording of this paper. Is it explicitly saying that taking a column or row from a random unitary matrix sampled uniformly will in fact give a random state vector with respect to the Haar measure?&lt;/p&gt;&#xA;" OwnerUserId="14239" LastActivityDate="2021-01-23T00:12:38.303" Title="Is the column vector of a uniformly sampled random unitary matrix a uniformly sampled random state vector?" Tags="&lt;quantum-state&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;&lt;qudit&gt;&lt;haar-distribution&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15585" PostTypeId="2" ParentId="15580" CreationDate="2021-01-18T23:17:10.920" Score="1" Body="&lt;p&gt;Looking at the &lt;a href=&quot;https://github.com/microsoft/QuantumLibraries/blob/c4f69418a55f3c93f1725a7b090523af28d08885/Standard/src/Canon/And.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code of ApplyMultiplyControlledAnd&lt;/a&gt;,  it is defined as &lt;code&gt;internal&lt;/code&gt;, so it's only available to the libraries code, not to the user code.&lt;/p&gt;&#xA;&lt;p&gt;The non-internal version of this operation seems to be controlled variant of &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applyand&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyAnd&lt;/a&gt; or &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.applylowdepthand&quot; rel=&quot;nofollow noreferrer&quot;&gt;ApplyLowDepthAnd&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-01-18T23:17:10.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15587" PostTypeId="2" ParentId="15584" CreationDate="2021-01-18T23:45:24.890" Score="4" Body="&lt;p&gt;Yes.&lt;/p&gt;&#xA;&lt;p&gt;A uniformly (Haar random) sampled state vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is characterized by the fact that the probability measure is invariant under any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, i.e., colloquially, &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt; is just as likely as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, a Haar random unitary &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is defined the same way: &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$UV$&lt;/span&gt; is just as likely as &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, for any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Thus, a column of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, let's call is &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle$&lt;/span&gt;, has again the property that  &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|\chi\rangle$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are &amp;quot;equally likely&amp;quot;, that is, &lt;span class=&quot;math-container&quot;&gt;$|\chi\rangle$&lt;/span&gt; is distributed Haar random.&lt;/p&gt;&#xA;&lt;p&gt;(As stated in the beginning, the colloquial &amp;quot;equally likely&amp;quot; should be understood as an invariance property of the measure.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-01-18T23:45:24.890" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15588" PostTypeId="2" ParentId="15577" CreationDate="2021-01-18T23:50:25.067" Score="5" Body="&lt;p&gt;The 2-norm difference typically isn't particularly physical.  So no, this is most likely not the right distance.  What you want from a physical point of view is a distance measure which measures the maximal distance between the two channels on any possible input (possibly on a larger system), such as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Diamond_norm&quot; rel=&quot;noreferrer&quot;&gt;diamond norm&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the fact that &amp;quot;norms are equivalent&amp;quot; just means that they are bounded with respect to each other, but this does by no means imply that the minimum distance is obtained at the same point, or takes the same value!  (Just consider the 1- and &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt;-norm in &lt;span class=&quot;math-container&quot;&gt;$\mathbb R^2$&lt;/span&gt;, where one is a square, where the lines of constant distance are a square and a diamond, respectively.)&lt;/p&gt;&#xA;&lt;p&gt;One reason why people might be using the 2-norm distance, though, is that this is a quadratic problem, so it is easy to minimize by solving an eigenvalue problem. But this is a purely pragmatic reason.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-01-18T23:50:25.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15589" PostTypeId="1" AcceptedAnswerId="15590" CreationDate="2021-01-19T03:11:31.867" Score="4" ViewCount="130" Body="&lt;p&gt;In many descriptions of order finding, but also in this answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15492/application-of-qft-to-order-finding/15540#15540&quot;&gt;here&lt;/a&gt;, it is shown that the superposition of all states is an eigenvector for eigenvalue 1.0. To cite:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Having found the eigenvalues, we now want to find the corresponding eigenvectors. We begin with the observation that  permutes the states &lt;span class=&quot;math-container&quot;&gt;$|x^0\pmod N\rangle,\dots|x^{r-1}\pmod N\rangle$&lt;/span&gt;. Consequently, the uniform superposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|v_0\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}|x^k\pmod N\rangle\tag3$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is an eigenvector associated with eigenvalue 1.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Sometimes this is being phrased as all eigenvectors adding up to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I really don't get this conclusion. Any insights / pointers?&lt;/p&gt;&#xA;&lt;p&gt;Thanks&lt;/p&gt;&#xA;" OwnerUserId="11582" LastEditorUserId="55" LastEditDate="2021-01-20T10:47:41.673" LastActivityDate="2021-01-20T10:47:41.673" Title="Why is the superposition of all states an eigenvector, with eigenvalue 1, of the QFT?" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15590" PostTypeId="2" ParentId="15589" CreationDate="2021-01-19T05:12:08.480" Score="5" Body="&lt;p&gt;Perhaps a simpler example will help. Let the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; permute &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt;. That means &lt;span class=&quot;math-container&quot;&gt;$U\vert 0\rangle = \vert 1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U\vert 1\rangle = \vert 0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then clearly, &lt;span class=&quot;math-container&quot;&gt;$$U\left(\frac{\vert 0\rangle +\vert 1 \rangle}{\sqrt{2}}\right) = \frac{U\vert 0\rangle + U\vert 1\rangle}{\sqrt{2}} = \frac{\vert 1\rangle + \vert 0\rangle}{\sqrt{2}} = \frac{\vert 0\rangle + \vert 1\rangle}{\sqrt{2}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus you have that the equal superposition is an eigenvector with eigenvalue 1. Now extend this argument to a permutation acting on &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; states.&lt;/p&gt;&#xA;" OwnerUserId="5669" LastEditorUserId="5669" LastEditDate="2021-01-19T05:17:14.397" LastActivityDate="2021-01-19T05:17:14.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15591" PostTypeId="2" ParentId="15431" CreationDate="2021-01-19T05:49:50.890" Score="3" Body="&lt;p&gt;Although this is already late, still I am writing an answer, because I was too stuck for hours early at the same problem.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I don't think qiskit is not yet supported in python3.9 because &lt;a href=&quot;https://github.com/Qiskit/qiskit/issues/1111&quot; rel=&quot;nofollow noreferrer&quot;&gt;because for 3.9 there's no qiskit-aer build available&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Regarding installing it with python 3.8 following steps should be sufficient:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;1. conda create -n &amp;lt;new env&amp;gt; python=3.8&#xA;2. conda activate &amp;lt;new env&amp;gt;&#xA;3.a conda install notebook ipykernel&#xA;3.b python -m ipykernel install --user --name=&amp;lt;new env&amp;gt;&#xA;3.c jupyter kernelspec list (new env should be available in the list)&#xA;4. python -m pip install --upgrade qiskit&#xA;// no need to have jupyter in the corresponding env&#xA;5. Open jupyter from any environment or even outside conda (but while opening jupyter you have to be in the environment which has the jupyter installed in it)&#xA;6. Open a notebook using &amp;lt;new env&amp;gt; kernel&#xA;7. import qiskit as q&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;3 and 4th steps to be executed while &lt;code&gt;new env&lt;/code&gt; is activated only.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Also&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For jupyter notebook, the following python package is useful for managing which python kernel / anaconda environment to run a notebook with:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;pip install environment_kernels&lt;/code&gt; (you have to be in the environment which has the jupyter installed in it)&lt;/p&gt;&#xA;&lt;p&gt;If you open the jupyter from this environment, you can change kernel in two ways after opening jupyter:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Kernel options to start a new notebook&lt;/li&gt;&#xA;&lt;li&gt;In the kernel &amp;gt; change kernel dropdown for an existing notebook.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14481" LastEditorUserId="14481" LastEditDate="2021-01-19T06:04:42.433" LastActivityDate="2021-01-19T06:04:42.433" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15592" PostTypeId="1" CreationDate="2021-01-19T11:44:48.187" Score="4" ViewCount="55" Body="&lt;p&gt;I am working on a problem related to average secret key rate calculation in satellite quantum key distribution (QKD). The problem is similar to a paper on &lt;a href=&quot;https://arxiv.org/abs/1712.09722&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1712.09722&lt;/a&gt; (P. No. 21).&lt;/p&gt;&#xA;&lt;p&gt;In a single mode transfer version of entanglement based QKD, we send one of the modes to the satellite via atmospheric fading channel, while the other mode is retained at the ground. We assume that the atmospheric fading channel transmissivity &lt;span class=&quot;math-container&quot;&gt;$\eta$&lt;/span&gt; is distributed according to probability distribution &lt;span class=&quot;math-container&quot;&gt;$P(\eta)$&lt;/span&gt; with maximum transmissivity &lt;span class=&quot;math-container&quot;&gt;$\eta_0$&lt;/span&gt;. The resultant mixed state can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$   &#xA;\rho_t^{\prime} = \int_0^{\eta_0} P(\eta) \rho^{\prime}(\eta) d \eta.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The average secret key rate can be calculated as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K = \int_0^{\eta_0} P(\eta) K[\rho^{\prime}(\eta) ]d \eta.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I am unable to follow the above equation. I first tried to see how the mutual information can be evaluated in such a scenario. I came to know that ``the mutual information is neither convex nor concave in the joint distribution or density matrix&amp;quot; Ref:    &lt;a href=&quot;https://arxiv.org/abs/1404.6496&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1404.6496&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I don't know how to proceed further in this special case also. Any help will be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13602" LastEditorUserId="55" LastEditDate="2021-01-20T10:54:47.347" LastActivityDate="2021-01-20T10:54:47.347" Title="Average secret key rate calculation" Tags="&lt;information-theory&gt;&lt;key-distribution&gt;&lt;qkd&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15593" PostTypeId="1" CreationDate="2021-01-19T12:08:17.940" Score="5" ViewCount="424" Body="&lt;p&gt;I am trying to use the circuit composer of the IBM QE. I am doing the inverse QFT on 3 qubits and therefore need a control on T and S dagger gates, but it won't let me.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know why or know a way around it? I've been stuck on this for a while now and have no idea what to do.&#xA;Thanks&lt;/p&gt;&#xA;" OwnerUserId="14502" LastActivityDate="2021-01-20T08:51:13.667" Title="Why can I not apply a control gate/function to a gate like T, S, S dagger, ... (using IBM Quantum Experience)? Is there another option?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;quantum-fourier-transform&gt;&lt;quantum-circuit&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15594" PostTypeId="2" ParentId="15593" CreationDate="2021-01-19T12:30:41.217" Score="4" Body="&lt;p&gt;I am not sure why, but you cannot add controls to &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; (and their inverses) in the composer. What you &lt;em&gt;can&lt;/em&gt; do is instead use the Phase gate (which you can add a control to) and set these angles for identical behaviour:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$P(\pi/2)  = S$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$P(\pi/4)  = T$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$P(-\pi/2) = S^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$P(-\pi/4) = T^\dagger$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="10415" LastEditorUserId="9459" LastEditDate="2021-01-19T13:32:47.670" LastActivityDate="2021-01-19T13:32:47.670" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15595" PostTypeId="2" ParentId="15593" CreationDate="2021-01-19T13:30:52.450" Score="2" Body="&lt;p&gt;&lt;strong&gt;A way around :)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Controlled-&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; version for any &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.PhaseGate.html#qiskit.circuit.library.PhaseGate.control&quot; rel=&quot;nofollow noreferrer&quot;&gt;phase&lt;/a&gt; gate. Note that as is mentioned in the previous &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15594/9459&quot;&gt;answer&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$P(\pi/2) = S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P(\pi/4) = T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P^\dagger (a) = P(-a)$&lt;/span&gt;. The circuit for controlled-&lt;span class=&quot;math-container&quot;&gt;$P(a)$&lt;/span&gt; looks like this&lt;/p&gt;&#xA;&lt;img src=&quot;https://i.stack.imgur.com/LTVyR.png&quot; width=&quot;500&quot; /&gt;&#xA;&lt;p&gt;where &lt;code&gt;q[0]&lt;/code&gt; is the control qubit. The proof:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I P(a/2) \big[|0\rangle \langle 0|I + |1\rangle \langle 1| X \big] I P(-a/2) \big[|0\rangle \langle 0|I + |1\rangle \langle 1| X \big]  P(a/2) I = \\ ={|0\rangle \langle 0|I + |1\rangle \langle 1| e^{a/2} P(a/2) X P(-a/2) X} = \\ = |0\rangle \langle 0|I + |1\rangle \langle 1| P(a) = \text{cotrolled-}P(a)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where I have omitted the &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; sign  (e.g. &lt;span class=&quot;math-container&quot;&gt;$I P = I \otimes P$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Like was mentioned in the previous &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.PhaseGate.html#qiskit.circuit.library.PhaseGate.control&quot; rel=&quot;nofollow noreferrer&quot;&gt;answer&lt;/a&gt; one can &lt;em&gt;add control&lt;/em&gt; to the &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; gate in IBM QE circuit composer without using the decomposition of controlled-&lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; shown here.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2021-01-20T08:51:13.667" LastActivityDate="2021-01-20T08:51:13.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15596" PostTypeId="2" ParentId="15558" CreationDate="2021-01-19T13:30:58.223" Score="0" Body="&lt;p&gt;This is not due to the size of the circuits, as Job Manager will divide the circuits into multiple jobs for you (the main reason to use Job Manager).&lt;/p&gt;&#xA;&lt;p&gt;This is related to the limit of 5 active jobs per backend. If the limit is reached, Job Manager waits for the &amp;quot;oldest running&amp;quot; job to finish. Based on the error message you received, it looks like this issue: &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/issues/737&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-ibmq-provider/issues/737&lt;/a&gt;, where the wait times out after 5 minutes and the job is never submitted. The fix was included in Qiskit 0.22 (or &lt;code&gt;qiskit-ibmq-provider&lt;/code&gt; 0.10).&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2021-01-19T13:30:58.223" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15597" PostTypeId="2" ParentId="15578" CreationDate="2021-01-19T13:50:32.827" Score="1" Body="&lt;p&gt;Job Manager submits the same job twice because there was a partial failure in the first submit. The latest Qiskit (0.23.2) has a fix that will cancel these phantom jobs earlier so they do not consume the job limit.&lt;/p&gt;&#xA;&lt;p&gt;Details:&lt;/p&gt;&#xA;&lt;p&gt;Submitting a job is actually a 2-step process:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;inform the server a job is to be submitted&lt;/li&gt;&#xA;&lt;li&gt;actually upload the data&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If Job Manager receives an error at step 1 (i.e. due to networking issues), it'd retry the step. However, sometimes the original request would actually make it to the server even though it gave an error. In such case you will see the same job twice in the dashboard, but the first instance will be stuck in &lt;code&gt;CREATING&lt;/code&gt; and never processed (since step 2 was not performed). The server will eventually cancel the phantom job.&lt;/p&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2021-01-19T13:50:32.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15599" PostTypeId="2" ParentId="15593" CreationDate="2021-01-19T19:02:57.810" Score="1" Body="&lt;p&gt;To add on top of @Davit answer. Suppose you want to do certain operations, in this case is Controlled-S or Controlled-T, and it is not directly implement on the circuit composer. But you want to use the circuit composer to have better visualization of the circuit. What you can do is to create these gate directly in Qiskit and decompose to &lt;code&gt;OpenQASM&lt;/code&gt; code, which then you can import it directly to the circuit composer.&lt;/p&gt;&#xA;&lt;h3&gt;Here is an example:&lt;/h3&gt;&#xA;&lt;p&gt;Suppose we want to create Controlled-S gate, then we can just use the &lt;a href=&quot;https://quantum-computing.ibm.com/jupyter&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Lab&lt;/a&gt; to create this gate as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c' )&#xA;circuit = QuantumCircuit(qreg_q)&#xA;circuit.s(qreg_q[0])&#xA;print(circuit)&#xA;&#xA;     ┌───┐&#xA;q_0: ┤ S ├&#xA;     └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is just to create the S gate. We then can create the Controlled-S gate by&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;xs_gate = circuit.to_gate()&#xA;cxs_gate = xs_gate.control()&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q)&#xA;circuit.append(cxs_gate, [0,1])&#xA;print(circuit)&#xA;&#xA;q_0: ──────■──────&#xA;     ┌─────┴─────┐&#xA;q_1: ┤ circuit23 ├&#xA;     └───────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now we can decompose this circuit into elementary gates as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qasm_circuit = circuit.decompose()&#xA;print( qasm_circuit )&#xA;&#xA;     ┌────────┐                                     &#xA;q_0: ┤ P(π/4) ├──■───────────────────■──────────────&#xA;     ├────────┤┌─┴─┐┌─────────────┐┌─┴─┐┌──────────┐&#xA;q_1: ┤ P(π/4) ├┤ X ├┤ U(0,0,-π/4) ├┤ X ├┤ U(0,0,0) ├&#xA;     └────────┘└───┘└─────────────┘└───┘└──────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can see that the above circuit is similar to what Davit suggested. Now you can convert this circuit into &lt;code&gt;OpenQASM&lt;/code&gt; using:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(circuit.decompose().qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which will output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[2];&#xA;p(pi/4) q[0];&#xA;p(pi/4) q[1];&#xA;cx q[0],q[1];&#xA;u(0,0,-pi/4) q[1];&#xA;cx q[0],q[1];&#xA;u(0,0,0) q[1];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can take this and import it to your circuit composer under the &lt;code&gt;OpenQASM&lt;/code&gt; Code editor&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gTq7b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gTq7b.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-19T19:02:57.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15600" PostTypeId="1" AcceptedAnswerId="15603" CreationDate="2021-01-19T21:09:52.320" Score="1" ViewCount="65" Body="&lt;p&gt;I'm doing an exercise to trace out the second qubit to find the reduced density operator for the first qubit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$tr_2|11\rangle\langle00| = |1\rangle\langle0|\langle0|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm just wondering if I do trace for the first qubit, should I have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$tr_1|11\rangle\langle00| = |1\rangle\langle0|\langle0|1\rangle$&lt;/span&gt; or&#xA;&lt;span class=&quot;math-container&quot;&gt;$tr_1|11\rangle\langle00| = \langle0|1\rangle|1\rangle\langle0|$&lt;/span&gt;  ?&lt;/p&gt;&#xA;&lt;p&gt;In the Nielsen-and-Chuang textbook, we have &lt;span class=&quot;math-container&quot;&gt;$tr(|b_1\rangle\langle b_2|)=\langle b_2|b_1\rangle$&lt;/span&gt;. Can I say the left and right hand side are just two ways to locate an element in a matrix?&#xA;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-01-19T21:37:04.113" LastActivityDate="2021-01-19T22:41:18.273" Title="How do I trace out the second qubit to find the reduced density operator?" Tags="&lt;textbook-and-exercises&gt;&lt;partial-trace&gt;&lt;trace&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ClosedDate="2021-01-21T03:24:20.580" ContentLicense="CC BY-SA 4.0" />
  <row Id="15601" PostTypeId="2" ParentId="15600" CreationDate="2021-01-19T21:36:43.573" Score="1" Body="&lt;p&gt;If you split your state into a bipartite system &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} \in \mathcal{H}_A \otimes \mathcal{H}_B$&lt;/span&gt; then one general formula for a partial trace is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B (\rho) = \sum_{j} (I_A \otimes  \langle j |_B) \rho (I_A \otimes | j \rangle_B)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\{ |j\rangle \}$&lt;/span&gt; is a basis for system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. In your case, for the first statement you can use this formula to find&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{Tr}_B (|11\rangle\langle00|) &amp;amp;= \sum_{j} (I_A \otimes  \langle j |_B) |11\rangle\langle00| (I_A \otimes | j \rangle_B) \\&#xA;&amp;amp;= (I_A \otimes  \langle 0 |_B) |1\rangle_A |1\rangle_B \langle0|_A \langle0|_B (I_A \otimes | 0 \rangle_B) \\&#xA;&amp;amp;\qquad+ (I_A \otimes  \langle 1 |_B) |1\rangle_A |1\rangle_B \langle0|_A \langle0|_B (I_A \otimes | 1 \rangle_B)\\&#xA;&amp;amp;= |1\rangle\langle0|_A (\langle 0|1\rangle\langle 0|0\rangle) + |1\rangle\langle 0|_A(\langle1|1\rangle\langle0|1\rangle) \\&#xA;&amp;amp;= |1\rangle\langle0|_A \langle 0| 1\rangle (\langle 0|0\rangle + \langle 1|1\rangle) \\&#xA;&amp;amp;= 0&#xA;\end{align}&lt;/span&gt;&#xA;and you can do a similar calculation to derive the second statement.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-01-19T21:36:43.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15602" PostTypeId="2" ParentId="15463" CreationDate="2021-01-19T22:10:34.917" Score="2" Body="&lt;h2&gt;TL;DR&lt;/h2&gt;&#xA;&lt;p&gt;You have rediscovered the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;! :-)&lt;/p&gt;&#xA;&lt;h2&gt;Interesting special cases&lt;/h2&gt;&#xA;&lt;p&gt;Before we prove that the map defined by equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is the representation of single-qubit quantum states as points on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;, it is instructive to consider a few special cases. Let us denote the map with &lt;span class=&quot;math-container&quot;&gt;$\phi: \mathcal{H} \to \mathbb{R}^3$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; is the Hilbert space of a qubit. We calculate that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\phi(|0\rangle) = \phi\left(\begin{pmatrix}1 \\ 0\end{pmatrix}\right) = \begin{pmatrix}&#xA;2 \cdot (1 \cdot 0 + 0 \cdot 0) \\&#xA;2 \cdot (-0 \cdot 0 + 1 \cdot 0) \\&#xA;1^2 + 0^2 - 0^2 - 0^2&#xA;\end{pmatrix} = \begin{pmatrix} 0\\0\\1 \end{pmatrix} \\&#xA;\phi(|1\rangle) = \phi\left(\begin{pmatrix}0 \\ 1\end{pmatrix}\right) = \begin{pmatrix}&#xA;2 \cdot (0 \cdot 1 + 0 \cdot 0) \\&#xA;2 \cdot (-0 \cdot 1 + 0 \cdot 0) \\&#xA;0^2 + 0^2 - 1^2 - 0^2&#xA;\end{pmatrix} = \begin{pmatrix} 0\\0\\-1 \end{pmatrix} \\&#xA;\phi(|+\rangle) = \phi\left(\begin{pmatrix}\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}}\end{pmatrix}\right) = \begin{pmatrix}&#xA;2 \cdot \left(\frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}} + 0 \cdot 0\right) \\&#xA;2 \cdot \left(-0 \cdot \frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}} \cdot 0\right) \\&#xA;\left(\frac{1}{\sqrt{2}}\right)^2 + 0^2 - \left(\frac{1}{\sqrt{2}}\right)^2 - 0^2&#xA;\end{pmatrix} = \begin{pmatrix} 1\\0\\0 \end{pmatrix} \\&#xA;\phi(|-\rangle) = \phi\left(\begin{pmatrix}\frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}}\end{pmatrix}\right) = \begin{pmatrix}&#xA;2 \cdot \left(\frac{1}{\sqrt{2}} \cdot \left(-\frac{1}{\sqrt{2}}\right) + 0 \cdot 0\right) \\&#xA;2 \cdot \left(-0 \cdot \left(-\frac{1}{\sqrt{2}}\right) + \frac{1}{\sqrt{2}} \cdot 0\right) \\&#xA;\left(\frac{1}{\sqrt{2}}\right)^2 + 0^2 - \left(-\frac{1}{\sqrt{2}}\right)^2 - 0^2&#xA;\end{pmatrix} = \begin{pmatrix} -1\\0\\0 \end{pmatrix} \\&#xA;\phi(|{+i}\rangle) = \phi\left(\begin{pmatrix}\frac{1}{\sqrt{2}} \\ \frac{i}{\sqrt{2}}\end{pmatrix}\right) = \begin{pmatrix}&#xA;2 \cdot \left(\frac{1}{\sqrt{2}} \cdot 0 + 0 \cdot \frac{1}{\sqrt{2}}\right) \\&#xA;2 \cdot \left(-0 \cdot 0 + \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}}\right) \\&#xA;\left(\frac{1}{\sqrt{2}}\right)^2 + 0^2 - 0^2 - \left(\frac{1}{\sqrt{2}}\right)^2&#xA;\end{pmatrix} = \begin{pmatrix}0\\1\\0 \end{pmatrix} \\&#xA;\phi(|{-i}\rangle) = \phi\left(\begin{pmatrix}\frac{1}{\sqrt{2}} \\ -\frac{i}{\sqrt{2}}\end{pmatrix}\right) = \begin{pmatrix}&#xA;2 \cdot \left(\frac{1}{\sqrt{2}} \cdot 0 + 0 \cdot \left(-\frac{1}{\sqrt{2}}\right)\right) \\&#xA;2 \cdot \left(-0 \cdot 0 + \frac{1}{\sqrt{2}} \cdot \left(-\frac{1}{\sqrt{2}}\right)\right) \\&#xA;\left(\frac{1}{\sqrt{2}}\right)^2 + 0^2 - 0^2 - \left(-\frac{1}{\sqrt{2}}\right)^2&#xA;\end{pmatrix} = \begin{pmatrix}0\\-1\\0 \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Though not a proof, the above equalities are very suggestive.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, these equalities explain why the three components of &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|\vec{\sigma}|\psi\rangle$&lt;/span&gt; correspond to the three components of &lt;span class=&quot;math-container&quot;&gt;$\phi(|\psi\rangle)$&lt;/span&gt;. For example, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; are eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; maps them to vectors that are fixed by the corresponding 3D rotation of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Proof in the general case&lt;/h2&gt;&#xA;&lt;p&gt;You have almost obtained the proof in the general case when you switched from representing an arbitrary quantum state as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=(a + bi, c + di)^T$&lt;/span&gt; to representing it as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=(\cos\frac{\theta}{2}, e^{i\phi}\sin\frac{\theta}{2})$&lt;/span&gt; and calculated that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\phi(|\psi\rangle) &amp;amp;= \phi\left(\begin{pmatrix}\cos\frac{\theta}{2} \\ e^{i\phi}\sin\frac{\theta}{2}\end{pmatrix}\right) \\&#xA;&amp;amp; =\begin{pmatrix}&#xA;2 \cos\frac{\theta}{2} \sin\frac{\theta}{2} \cos\phi \\&#xA;2 \cos\frac{\theta}{2} \sin\frac{\theta}{2} \sin\phi\\&#xA;\cos^2\frac{\theta}{2} - \sin^2\frac{\theta}{2} \cos^2\phi - \sin^2\frac{\theta}{2} \sin^2\phi&#xA;\end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix}&#xA;\sin\theta\cos\phi \\&#xA;\sin\theta\sin\phi \\&#xA;\cos\theta&#xA;\end{pmatrix}.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the only missing step is to notice that the last result is the point on the unit sphere in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt; with azimutal angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and polar angle &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}$&lt;/span&gt;, exactly as on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Relationship to the Lie group homomorphism &lt;span class=&quot;math-container&quot;&gt;$SU(2)\to SO(3)$&lt;/span&gt;&lt;/h2&gt;&#xA;&lt;p&gt;A key property of the Bloch sphere is that for any unitary &lt;span class=&quot;math-container&quot;&gt;$U \in SU(2)$&lt;/span&gt; and any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in \mathcal{H}$&lt;/span&gt;, the 3-vector &lt;span class=&quot;math-container&quot;&gt;$\phi(U|\psi\rangle)$&lt;/span&gt; can be obtained from the 3-vector &lt;span class=&quot;math-container&quot;&gt;$\phi(|\psi\rangle)$&lt;/span&gt; by rotating the latter using &lt;span class=&quot;math-container&quot;&gt;$\Phi(U)\in SO(3)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\Phi: SU(2) \to SO(3)$&lt;/span&gt; denotes the Lie group homomorphism that maps single-qubit unitaries in &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; to 3D rotations in &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This fact can be expressed as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\phi(U|\psi\rangle) = \Phi(U)\phi(|\psi\rangle)\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or by saying that the following diagram&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{ccccc}&#xA;&amp;amp;\mathcal{H}      &amp;amp; \xrightarrow{\phi}   &amp;amp; S^2             &amp;amp; \\&#xA;U&amp;amp;\Bigg\downarrow &amp;amp;                      &amp;amp; \Bigg\downarrow &amp;amp; \Phi(U) \\&#xA;&amp;amp;\mathcal{H}      &amp;amp; \xrightarrow[\phi]{} &amp;amp; S^2             &amp;amp; \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;commutes for every &lt;span class=&quot;math-container&quot;&gt;$U\in SU(2)$&lt;/span&gt;. The proof of &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; is a straightforward, but somewhat lengthy calculation.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-19T22:10:34.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15603" PostTypeId="2" ParentId="15600" CreationDate="2021-01-19T22:41:18.273" Score="2" Body="&lt;p&gt;Suppose you have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} $&lt;/span&gt; then its density matrix representation is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = |\psi \rangle \langle \psi | = \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, if we want to &lt;em&gt;trace out&lt;/em&gt; the subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to find the density operator of the system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; denoted as &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; then we can do the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = Tr_B(\rho) = \dfrac{1}{2} \begin{pmatrix} Tr\begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 0 \end{pmatrix} &amp;amp;  Tr\begin{pmatrix} 0 &amp;amp; 1\\ 0 &amp;amp; 0 \end{pmatrix}\\ Tr\begin{pmatrix} 0 &amp;amp; 0\\ 1 &amp;amp; 0 \end{pmatrix} &amp;amp; Tr\begin{pmatrix} 0 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} \end{pmatrix} = \dfrac{1}{2} \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It turns out that &lt;span class=&quot;math-container&quot;&gt;$\rho_B = Tr_A(\rho)$&lt;/span&gt; is the same as &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; here and from looking at the state, you might expect why that is the case.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;More generally, giving a density operator&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \rho =  \begin{pmatrix} \rho_{11} &amp;amp; \rho_{12} &amp;amp; \rho_{13} &amp;amp; \rho_{14}\\ \rho_{21} &amp;amp; \rho_{22} &amp;amp; \rho_{23} &amp;amp; \rho_{24}\\ \rho_{31} &amp;amp; \rho_{32} &amp;amp; \rho_{33} &amp;amp; \rho_{34} \\ \rho_{41} &amp;amp; \rho_{42} &amp;amp; \rho_{43} &amp;amp; \rho_{44} \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = Tr_B(\rho) = \begin{pmatrix} Tr\begin{pmatrix} \rho_{11} &amp;amp; \rho_{12}\\\rho_{21} &amp;amp; \rho_{22}  \end{pmatrix} &amp;amp;  Tr\begin{pmatrix} \rho_{13} &amp;amp; \rho_{14} \\ \rho_{23} &amp;amp; \rho_{24} \end{pmatrix}\\ Tr\begin{pmatrix} \rho_{31} &amp;amp; \rho_{32}  \\ \rho_{41} &amp;amp; \rho_{42} \end{pmatrix} &amp;amp; Tr\begin{pmatrix}\rho_{33} &amp;amp; \rho_{34} \\ \rho_{43} &amp;amp; \rho_{44} \end{pmatrix} \end{pmatrix} =  \begin{pmatrix} \rho_{11} + \rho_{22} &amp;amp; \rho_{13} + \rho_{24} \\ \rho_{31} + \rho_{42} &amp;amp; \rho_{33} + \rho_{44} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_B = Tr_A(\rho) = \begin{pmatrix} Tr\begin{pmatrix} \rho_{11} &amp;amp; \rho_{13}\\\rho_{31} &amp;amp; \rho_{33}  \end{pmatrix} &amp;amp;  Tr\begin{pmatrix} \rho_{12} &amp;amp; \rho_{14} \\ \rho_{32} &amp;amp; \rho_{34} \end{pmatrix}\\ Tr\begin{pmatrix} \rho_{21} &amp;amp; \rho_{23}  \\ \rho_{41} &amp;amp; \rho_{43} \end{pmatrix} &amp;amp; Tr\begin{pmatrix}\rho_{22} &amp;amp; \rho_{24} \\ \rho_{42} &amp;amp; \rho_{44} \end{pmatrix} \end{pmatrix} =  \begin{pmatrix} \rho_{11} + \rho_{33} &amp;amp; \rho_{12} + \rho_{34} \\ \rho_{21} + \rho_{43} &amp;amp; \rho_{22} + \rho_{44} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-19T22:41:18.273" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15604" PostTypeId="2" ParentId="9851" CreationDate="2021-01-20T02:01:28.417" Score="0" Body="&lt;p&gt;TL/DR: The QFT is a powerful (indeed in a sense BQP-complete) subroutine but has a lot of asterisks to its applicability.  I think an issue may be that the QFT in conjunction with Hamiltonian simulation is powerful especially on large matrices that have certain, potentially restrictive, properties on the eigenvalues such as condition number, etc. and separately properties on the access to entries of the underlying matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; such as sparsity, etc. that may limit their applicability in a certain sense.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In more detail, these limitations may come from (A) requirements on the Hamiltonian simulation of the underlying matrix and (B) the specific implementation of the QFT, which in Shor's algorithm allows for exponential precision but otherwise may only allow for polynomial precision.&lt;/p&gt;&#xA;&lt;p&gt;For example a &lt;a href=&quot;https://arxiv.org/abs/0705.1180&quot; rel=&quot;nofollow noreferrer&quot;&gt;number&lt;/a&gt; &lt;a href=&quot;https://theoryofcomputing.org/articles/v003a004/&quot; rel=&quot;nofollow noreferrer&quot;&gt;of&lt;/a&gt; &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0610235&quot; rel=&quot;nofollow noreferrer&quot;&gt;algorithms&lt;/a&gt; from Janzing and Wocjan show that computation of entries of (small) powers of (large) matrices can be done efficiently with a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;Much as HHL performs eigenvalue surgery on the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; of a large matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to determine &lt;span class=&quot;math-container&quot;&gt;$\lambda^{-1}$&lt;/span&gt;, Janzing and Wocjan calculate the expectation of &lt;span class=&quot;math-container&quot;&gt;$\lambda^m$&lt;/span&gt; for integral &lt;span class=&quot;math-container&quot;&gt;$m\ge 1$&lt;/span&gt; to compute elements of &lt;span class=&quot;math-container&quot;&gt;$A^m$&lt;/span&gt;. Both rely critically on Hamiltonian simulation to work with &lt;span class=&quot;math-container&quot;&gt;$U=e^{-iAt}$&lt;/span&gt;, and the QFT to determine &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; with phase estimation.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, HHL requires a small enough condition number (~smallest eigenvalue) to make sure that &lt;span class=&quot;math-container&quot;&gt;$\lambda^{-1}$&lt;/span&gt; doesn't go crazy while Janzing and Wocjan require a bound on the operator norm (~largest eigenvalue) to make sure that &lt;span class=&quot;math-container&quot;&gt;$\lambda^m$&lt;/span&gt; is also reasonable.&lt;/p&gt;&#xA;&lt;p&gt;Additionally compared to Shor's algorithm, HHL and Janzing and Wocjan's algorithms, Shor's algorithm uses fast modular exponentiation by repeated squaring; HHL and other algorithms can only achieve a polynomial precision when they compute powers of respective Hamiltonians to perform the Quantum Phase Estimation (QPE).&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-01-20T14:25:46.953" LastActivityDate="2021-01-20T14:25:46.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15605" PostTypeId="1" AcceptedAnswerId="15635" CreationDate="2021-01-20T04:25:27.560" Score="2" ViewCount="73" Body="&lt;p&gt;Qiskit Aqua raises the following exception:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ImportError: dlopen: cannot load any more object with static TLS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I don't understand what might be causing this. I currently have a Ubuntu 14.04 Linux distribution and am using Anaconda Navigator, which I have downloaded with Conda. See code and full error log below.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from numpy import *&#xA;import qiskit as q&#xA;from math import pi&#xA;import numpy as np&#xA;from numpy.fft import fft&#xA;import scipy.fftpack&#xA;import matplotlib.pyplot as plt&#xA;import matplotlib.pyplot as plt1&#xA;import matplotlib.pyplot as plt2&#xA;import matplotlib.pyplot as circuit&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.quantum_info import DensityMatrix&#xA;from qiskit.visualization import plot_bloch_multivector, plot_histogram&#xA;from qiskit.visualization import plot_state_city&#xA;from typing import List, Union&#xA;from qiskit.quantum_info import Pauli&#xA;import time&#xA;from itertools import combinations&#xA;from qiskit.compiler import assemble&#xA;from qiskit.test.mock import FakeVigo&#xA;from qiskit.circuit import Parameter&#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit.tools.visualization import circuit_drawer&#xA;from matplotlib import style &#xA;from qiskit import execute, BasicAer&#xA;from qiskit.compiler import transpile&#xA;from qiskit.quantum_info.operators import Operator, Pauli&#xA;from qiskit.quantum_info import process_fidelity&#xA;from qiskit.extensions import RXGate, XGate, CXGate&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.circuit import ParameterExpression&#xA;from typing import Union, Set, List&#xA;import numpy as np&#xA;&#xA;from qiskit.circuit import ParameterExpression&#xA;from qiskit.aqua.operators import PrimitiveOp&#xA;&#xA;&#xA;&#xA;%matplotlib inline&#xA;#%matplotlib tk&#xA;&#xA;&#xA;#style.use(&amp;quot;classic&amp;quot;)&#xA;COLOR = 'white'&#xA;COLOR1 = 'black'&#xA;plt.rcParams['text.color'] = COLOR1&#xA;plt.rcParams['axes.labelcolor'] = COLOR&#xA;plt.rcParams['xtick.color'] = COLOR&#xA;plt.rcParams['ytick.color'] = COLOR&#xA;&#xA;plt1.rcParams['text.color'] = COLOR1&#xA;plt1.rcParams['axes.labelcolor'] = COLOR&#xA;plt1.rcParams['xtick.color'] = COLOR&#xA;plt1.rcParams['ytick.color'] = COLOR&#xA;&#xA;plt2.rcParams['text.color'] = COLOR1&#xA;plt2.rcParams['axes.labelcolor'] = COLOR&#xA;plt2.rcParams['xtick.color'] = COLOR&#xA;plt2.rcParams['ytick.color'] = COLOR&#xA;&#xA;&#xA;#style.use(&amp;quot;seaborn-whitegrid&amp;quot;)&#xA;&#xA;&#xA;&#xA;plt.rc('legend',fontsize=20) # using a size in points&#xA;plt1.rc('legend',fontsize=20) # using a size in points&#xA;plt2.rc('legend',fontsize=20) # using a size in points&#xA;&#xA;#Rotation Parameters:&#xA;#N = .5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;ImportError                               Traceback (most recent call last)&#xA;&amp;lt;ipython-input-4-f30f52024441&amp;gt; in &amp;lt;module&amp;gt;&#xA;     35 &#xA;     36 from qiskit.circuit import ParameterExpression&#xA;---&amp;gt; 37 from qiskit.aqua.operators import PrimitiveOp&#xA;     38 &#xA;     39 &#xA;&#xA;~/anaconda3/lib/python3.8/site-packages/qiskit/aqua/__init__.py in &amp;lt;module&amp;gt;&#xA;     74 from .missing_optional_library_error import MissingOptionalLibraryError&#xA;     75 from .aqua_globals import aqua_globals&#xA;---&amp;gt; 76 from .quantum_instance import QuantumInstance&#xA;     77 from .algorithms import QuantumAlgorithm&#xA;     78 from ._logging import (QiskitLogDomains,&#xA;&#xA;~/anaconda3/lib/python3.8/site-packages/qiskit/aqua/quantum_instance.py in &amp;lt;module&amp;gt;&#xA;     32 &#xA;     33 from .aqua_error import AquaError&#xA;---&amp;gt; 34 from .utils.backend_utils import (is_ibmq_provider,&#xA;     35                                   is_statevector_backend,&#xA;     36                                   is_simulator_backend,&#xA;&#xA;~/anaconda3/lib/python3.8/site-packages/qiskit/aqua/utils/__init__.py in &amp;lt;module&amp;gt;&#xA;     58 from .subsystem import get_subsystem_density_matrix, get_subsystems_counts&#xA;     59 from .entangler_map import get_entangler_map, validate_entangler_map&#xA;---&amp;gt; 60 from .dataset_helper import (get_feature_dimension, get_num_classes,&#xA;     61                              split_dataset_to_data_and_labels,&#xA;     62                              map_label_to_class_name, reduce_dim_to_via_pca)&#xA;&#xA;~/anaconda3/lib/python3.8/site-packages/qiskit/aqua/utils/dataset_helper.py in &amp;lt;module&amp;gt;&#xA;     16 from copy import deepcopy&#xA;     17 import numpy as np&#xA;---&amp;gt; 18 from sklearn.decomposition import PCA&#xA;     19 &#xA;     20 &#xA;&#xA;~/anaconda3/lib/python3.8/site-packages/sklearn/__init__.py in &amp;lt;module&amp;gt;&#xA;     79     from . import __check_build  # noqa: F401&#xA;     80     from .base import clone&#xA;---&amp;gt; 81     from .utils._show_versions import show_versions&#xA;     82 &#xA;     83     __all__ = ['calibration', 'cluster', 'covariance', 'cross_decomposition',&#xA;&#xA;~/anaconda3/lib/python3.8/site-packages/sklearn/utils/_show_versions.py in &amp;lt;module&amp;gt;&#xA;     10 import importlib&#xA;     11 &#xA;---&amp;gt; 12 from ._openmp_helpers import _openmp_parallelism_enabled&#xA;     13 &#xA;     14 &#xA;&#xA;ImportError: dlopen: cannot load any more object with static TLS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13364" LastEditorUserId="10480" LastEditDate="2021-01-20T19:02:38.240" LastActivityDate="2021-01-22T09:12:53.943" Title="Error When Importing from qiskit.aqua" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15606" PostTypeId="1" AcceptedAnswerId="15608" CreationDate="2021-01-20T06:20:28.490" Score="2" ViewCount="95" Body="&lt;p&gt;Suppose there're two systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, if we're in a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb{H}_a\otimes\mathbb{H}_b$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\hat A$&lt;/span&gt; be an operator acting on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{H}_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_{i,j}\psi_{i,j}|a_i\rangle|b_j\rangle$&lt;/span&gt;. The expectation value of A with respect to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be calculated as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A\rangle_{\psi}= Tr_{\mathbb{H}_a\otimes\mathbb{H}_b}(A|\psi\rangle\langle\psi|)=\sum_{i,j}\langle a_i|\langle b_j|A\otimes\mathbb{1}_B|\psi\rangle\langle\psi|a_i\rangle|b_j\rangle=...&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm very confused about where these two equalities coming from? In particular, where does the term &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; in the sum come from? Can I understand its function as generating a &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; matrix with different constants &lt;span class=&quot;math-container&quot;&gt;$\psi_{i,j}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-01-25T11:57:29.690" LastActivityDate="2021-01-25T11:57:29.690" Title="Where does the term $|\psi\rangle\langle\psi|$ come from while calculating the expectation value?" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15607" PostTypeId="2" ParentId="15606" CreationDate="2021-01-20T08:04:57.693" Score="3" Body="&lt;p&gt;It is a variant of the formula for the average &lt;span class=&quot;math-container&quot;&gt;$\langle A\rangle_\rho$&lt;/span&gt; of an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; measured on a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A\rangle_\rho = \mathrm{tr}(A\rho).\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this case we are measuring an operator acting on the first subsystem, so &lt;span class=&quot;math-container&quot;&gt;$\rho = \mathrm{tr}_B(|\psi\rangle\langle\psi|)$&lt;/span&gt;. Substituting into &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle A\rangle_\psi &amp;amp;= \mathrm{tr}(A \,\mathrm{tr}_B(|\psi\rangle\langle\psi|)) \\&#xA;&amp;amp;= \mathrm{tr}(\mathrm{tr}_B(A\otimes I |\psi\rangle\langle\psi|)) \\&#xA;&amp;amp;= \mathrm{tr}(A\otimes I |\psi\rangle\langle\psi|) \\&#xA;&amp;amp;= \mathrm{tr}(A|\psi\rangle\langle\psi|)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the first equality is the substitution, the second follows from the properties of partial trace, the third from the fact that tracing over subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; followed by tracing over subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is equivalent to tracing over both of the subsystems and finally the fourth is a shortcut notation that allows to make identity implicit when composing operators defined on subsystems of a composite system.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The second equality follows from the fact that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr} A = \sum_k \langle k|A|k\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; is any orthonormal basis. This can be proven by first choosing the eigenbasis of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and then appealing to basis-independence of the trace.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-20T08:04:57.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15608" PostTypeId="2" ParentId="15606" CreationDate="2021-01-20T08:06:58.507" Score="3" Body="&lt;p&gt;You haven't really specified what you're happy with as a starting point. I suppose&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A\rangle_\psi=\langle\psi|A\otimes 1_B|\psi\rangle?&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To see that the other expressions are equivalent, I usually find it more helpful to work backwards. Let's say we start from&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(A\otimes 1|\psi\rangle\langle \psi|),&#xA;$$&lt;/span&gt;&#xA;well mathematically, we can take the trace by performing a sum over any orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|u_i\rangle\}$&lt;/span&gt; in the Hilbert space,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(B)=\sum_i\langle u_i|B|u_i\rangle.&#xA;$$&lt;/span&gt;&#xA;One such basis is the separable basis &lt;span class=&quot;math-container&quot;&gt;$|a_i\rangle|b_j\rangle$&lt;/span&gt; which immediately gives you the second equality.&lt;/p&gt;&#xA;&lt;p&gt;Another choice of basis has &lt;span class=&quot;math-container&quot;&gt;$|u_1\rangle=|\psi\rangle$&lt;/span&gt;, and all other states orthogonal. In this case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle u_i|A\otimes 1|\psi\rangle\langle\psi|u_i\rangle=\delta_{i,1}\langle\psi|A\otimes 1|\psi\rangle,&#xA;$$&lt;/span&gt;&#xA;as required to get the first equality, using the definition I gave above.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-01-20T08:06:58.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15609" PostTypeId="1" CreationDate="2021-01-20T08:12:32.017" Score="5" ViewCount="215" Body="&lt;p&gt;Suppose that I have a bijective function &lt;span class=&quot;math-container&quot;&gt;$f: \mathbb{Z}_N → Y$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is a finite set. Suppose that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, but not its inverse, can be computed efficiently classically.&lt;/p&gt;&#xA;&lt;p&gt;I would like to apply the following diagonal unitary transformation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{j,k \in \mathbb{Z}_N} \alpha_{j,k} \vert j, f(k) \rangle \mapsto \sum_{j,k \in \mathbb{Z}_N} \omega_N^{-jk} \alpha_{j,k} \vert j, f(k) \rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$\omega_N = e^{\frac{2 \pi i}{N}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is: if I want to apply this transformation, does that require &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to be inverted classically, or is that not needed because my sum goes over &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="14512" LastEditorUserId="14512" LastEditDate="2021-01-26T18:56:26.323" LastActivityDate="2021-01-30T20:07:10.263" Title="Does applying the transformation $\sum\alpha_{jk}|j,f(k)\rangle\mapsto\sum\omega_N^{-jk}\alpha_{jk}|j,f(k)\rangle$ require computing $f^{-1}$?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15610" PostTypeId="2" ParentId="15605" CreationDate="2021-01-20T08:18:29.353" Score="1" Body="&lt;p&gt;&lt;strong&gt;Hypothesis&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;OpenMP uses static &lt;a href=&quot;https://en.wikipedia.org/wiki/Thread-local_storage&quot; rel=&quot;nofollow noreferrer&quot;&gt;Thread Local Storage&lt;/a&gt; which requires slots in a data structure called &lt;a href=&quot;https://uclibc.org/docs/tls.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dynamic Thread Vector&lt;/a&gt;. Unfortunately, DTV is allocated based on the needs of the libraries statically linked into the executable. The needs of dynamically loaded libraries are served from a fixed surplus of slots on the first come first served basis. If a library loaded using &lt;code&gt;dlopen&lt;/code&gt; uses static TLS but no more DTV slots are available then &lt;code&gt;dlopen&lt;/code&gt; &lt;a href=&quot;https://chromium.googlesource.com/chromiumos/third_party/glibc/+/3014465a7c64cb5e46b86ccdb51a6e074bee4ddc/elf/dl-open.c#468&quot; rel=&quot;nofollow noreferrer&quot;&gt;fails&lt;/a&gt; the way you see.&lt;/p&gt;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://au.mathworks.com/matlabcentral/answers/125117-openmp-mex-files-static-tls-problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://lists.freebsd.org/pipermail/freebsd-arch/2016-February/017699.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Potential workaround&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;You may be able to work around the problem by forcing OpenMP to be loaded earlier, when DTV slots are still available. First, find out what OpenMP library you are using and where it is. A common OpenMP library is GOMP and the file is usually called &lt;code&gt;libgomp.so&lt;/code&gt; etc. Next, set the &lt;code&gt;LD_PRELOAD&lt;/code&gt; environment variable to its absolute path using&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;export LD_PRELOAD=&amp;quot;/absolute/path/to/libgomp.so&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and then re-run your code.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-20T08:18:29.353" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15612" PostTypeId="1" CreationDate="2021-01-20T11:24:08.073" Score="2" ViewCount="64" Body="&lt;pre&gt;&lt;code&gt;import sympy&#xA;import cirq&#xA;from cirq.contrib.svg import SVGCircuit&#xA;import tensorflow_quantum as tfq&#xA;import tensorflow as tf&#xA;import numpy as np&#xA;import pandas as pd&#xA;from sklearn.model_selection import train_test_split&#xA;from tensorflow.keras.utils import to_categorical&#xA;from tensorflow.keras import layers&#xA;import os&#xA;&#xA;class CircuitLayerBuilder():&#xA;     def __init__(self,data_qubits,readout):&#xA;         self.data_qubits=data_qubits&#xA;         self.readout=readout&#xA;         &#xA;     def add_layer(self,circuit,gate,prefix):&#xA;         for i,qubit in enumerate(self.data_qubits):&#xA;             symbol=sympy.Symbol(prefix+ '-' +str(i))&#xA;             circuit.append(gate(qubit,self.readout)**symbol)&#xA;                              &#xA;&#xA;&#xA;demo_builder=CircuitLayerBuilder(data_qubits=cirq.GridQubit.rect(32,32),readout=cirq.GridQubit(-1,1))&#xA;circuit=cirq.Circuit()&#xA;demo_builder.add_layer(circuit,gate=cirq.XX,prefix='xx')&#xA;SVGCircuit(circuit)&#xA;&#xA;&#xA;def create_quantum_model():&#xA;    data_qubits=cirq.GridQubit.rect(32,32)&#xA;    readout=cirq.GridQubit(-1,1)&#xA;    circuit=cirq.Circuit()&#xA;    &#xA;    circuit.append(cirq.X(readout))&#xA;    circuit.append(cirq.H(readout))&#xA;    &#xA;    builder=CircuitLayerBuilder(data_qubits=data_qubits,readout=readout)&#xA;    &#xA;    builder.add_layer(circuit,cirq.XX, &amp;quot;xx1&amp;quot;)&#xA;    builder.add_layer(circuit,cirq.ZZ ,&amp;quot;zz1&amp;quot;)&#xA;    &#xA;    circuit.append(cirq.H(readout))&#xA;    &#xA;    return circuit,cirq.Z(readout)&#xA;&#xA;&#xA;&#xA;def convert_to_circuit(filename):&#xA;    values=np.ndarray.flatten(filename)&#xA;    qubits=cirq.GridQubit.rect(32,32)&#xA;    circuit=cirq.Circuit()&#xA;    for i,value in enumerate(values):&#xA;        if value:&#xA;            circuit.append(cirq.X(qubits[i]))&#xA;            &#xA;    return circuit&#xA;        &#xA;&#xA;file =np.load('CWRU_48k_load_1_CNN_data.npz')&#xA;data = file['data']&#xA;labels = file['labels']&#xA;category_labels = np.unique(labels)&#xA;labels = pd.Categorical(labels, categories = category_labels).codes&#xA;train_data, test_data, train_labels, test_labels = train_test_split(data, labels, test_size = 1000, random_state = 829, &#xA;  stratify = labels)&#xA;&#xA;# reshape data&#xA;train_data = train_data.reshape(len(train_data),32,32,1)&#xA;test_data = test_data.reshape(len(test_data),32,32,1)&#xA;&#xA;#train_labels = to_categorical(train_labels)&#xA;#test_labels = to_categorical(test_labels)&#xA;&#xA;x_train_circ=[convert_to_circuit(x) for x in train_data]&#xA;x_test_circ=[convert_to_circuit(x) for x in test_data]&#xA;x_train_tfcirc=tfq.convert_to_tensor(x_train_circ)&#xA;x_test_tfcirc=tfq.convert_to_tensor(x_test_circ)&#xA;&#xA;model_circuit,model_readout=create_quantum_model()&#xA;&#xA;&#xA;model=tf.keras.Sequential([tf.keras.layers.Input(shape=(),dtype=tf.string),&#xA;                           tfq.layers.PQC(model_circuit,model_readout),&#xA;                           ])&#xA;&#xA;index = np.random.permutation(len(train_labels))&#xA;trian_data, trian_labels = train_data[index], train_labels[index]&#xA;&#xA;&#xA;&#xA;SVGCircuit(x_train_circ[0])&#xA;&#xA;y_train_hinge=2.0*test_data-1.0&#xA;y_test_hinge=2.0*test_labels-1.0&#xA;&#xA;def hinge_accuracy(y_true, y_pred):&#xA;    y_true = tf.squeeze(y_true) &amp;gt; 0.0&#xA;    y_pred = tf.squeeze(y_pred) &amp;gt; 0.0&#xA;    result = tf.cast(y_true == y_pred, tf.float32)&#xA;&#xA;    return tf.reduce_mean(result)&#xA;&#xA;model.compile(loss=tf.keras.losses.Hinge(),&#xA;              optimizer=tf.keras.optimizers.Adam(),&#xA;              metrics=[hinge_accuracy])&#xA;&#xA;epochs=25&#xA;batch_size=16&#xA;num_examples=len(x_train_tfcirc)&#xA;x_train_tfcirc_sub=x_train_tfcirc[:num_examples]&#xA;y_train_hinge_sub=y_train_hinge[:num_examples]&#xA;history = model.fit(x=x_train_tfcirc_sub,&#xA;                         y=y_train_hinge_sub,&#xA;                         batch_size=16,&#xA;                         epochs=25,&#xA;                         verbose=1,validation_data=(x_test_tfcirc,y_test_hinge))&#xA;print(model.summary())                   &#xA;qnn_results=model.evaluate(x_test_tfcirc,test_labels)&#xA;print(qnn_results)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14514" LastEditorUserId="55" LastEditDate="2021-01-24T14:16:03.473" LastActivityDate="2021-01-24T14:16:03.473" Title="How to convert a dataset of different values in [0,1000] to quantum data for training a model using Tensorflow QuantumHaving?" Tags="&lt;quantum-gate&gt;&lt;programming&gt;&lt;circuit-construction&gt;&lt;cirq&gt;&lt;tfq&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15613" PostTypeId="2" ParentId="15584" CreationDate="2021-01-20T20:12:42.623" Score="4" Body="&lt;p&gt;Suppose that was not the case. Then taking the first column of a uniformly random unitary matrix gives you a &lt;em&gt;non&lt;/em&gt;uniformly random state.&lt;/p&gt;&#xA;&lt;p&gt;That means that there is some state, call it &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, that is relatively more likely to be found when sampling states with such procedure. But that would mean that the unitaries whose first column is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; are relatively more likely to be found than others. This is clearly against the assumption that the unitaries are &lt;em&gt;uniformly&lt;/em&gt; sampled. We conclude that taking the first (or any other) column of a uniformly sampled unitary matrix gives a uniformly sampled quantum state.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-01-23T00:12:38.303" LastActivityDate="2021-01-23T00:12:38.303" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15614" PostTypeId="1" AcceptedAnswerId="15615" CreationDate="2021-01-20T22:32:28.153" Score="2" ViewCount="130" Body="&lt;p&gt;I am looking for a compiler to compile a high-level quantum circuit for the Trapped-Ion Quantum Computing architecture, i.e. a compiler that can translate a high-level circuit to native gates of the TI hardware (single-qubit rotations and 2-qubit MS gate) in an optimized manner.&lt;/p&gt;&#xA;" OwnerUserId="4722" LastEditorUserId="55" LastEditDate="2021-01-24T14:16:08.950" LastActivityDate="2021-01-24T14:16:08.950" Title="What are the available compilers for Trapped-Ion Quantum Computing Architecture?" Tags="&lt;programming&gt;&lt;trapped-ion&gt;&lt;compiling&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15615" PostTypeId="2" ParentId="15614" CreationDate="2021-01-20T22:52:30.310" Score="3" Body="&lt;p&gt;You can compile gates to native trapped ion gates via &lt;a href=&quot;https://quantumai.google/reference/python/cirq/ion/ConvertToIonGates&quot; rel=&quot;nofollow noreferrer&quot;&gt;cirq.ion.ConvertToIonGates&lt;/a&gt;. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;q0, q1 = cirq.LineQubit.range(2)&#xA;&#xA;circuit = cirq.Circuit(&#xA;    cirq.H(q0),&#xA;    cirq.CNOT(q0, q1),&#xA;    cirq.measure(q0, key='m')&#xA;)&#xA;&#xA;print(&amp;quot;Circuit:&amp;quot;)&#xA;print(circuit)&#xA;# Prints&#xA;# Circuit:&#xA;# 0: ───H───@───M('m')───&#xA;#           │&#xA;# 1: ───────X────────────&#xA;&#xA;ion_circuit = cirq.ion.ConvertToIonGates().convert_circuit(circuit)&#xA;print(&amp;quot;Ion Circuit:&amp;quot;)&#xA;print(ion_circuit)&#xA;# Prints&#xA;# Ion Circuit:&#xA;# 0: ───PhX(1)───────────MS(0.25π)───PhX(-0.5)^0.5───S^-1───M('m')───&#xA;#                        │&#xA;# 1: ────────────────────MS(0.25π)───PhX(1)^0.5──────────────────────&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="362" LastActivityDate="2021-01-20T22:52:30.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15616" PostTypeId="2" ParentId="15581" CreationDate="2021-01-20T22:59:04.997" Score="4" Body="&lt;p&gt;These are classical &lt;a href=&quot;https://en.wikipedia.org/wiki/Conditional_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;conditional probabilities&lt;/a&gt; used extensively in &lt;a href=&quot;https://en.wikipedia.org/wiki/Bayesian_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bayesian probability&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose Alice can prepare any of a number of pure states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;. She chooses &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; randomly from distribution &lt;span class=&quot;math-container&quot;&gt;$p(i)$&lt;/span&gt;, prepares a system in state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; and gives it to Bob without telling him the random choice &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. Suppose also that Bob knows the distribution &lt;span class=&quot;math-container&quot;&gt;$p(i)$&lt;/span&gt; and the pure states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;. Thus, in Bob's description the system is in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_i p(i)|\psi_i\rangle\langle \psi_i|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Bob performs a measurement described by operators &lt;span class=&quot;math-container&quot;&gt;$M_k$&lt;/span&gt; and obtains the result &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. He does not tell Alice the result &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, but Alice does know the measurement operators &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt; that Bob uses.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$p(i|m)$&lt;/span&gt;: What Bob learns about preparation &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; from measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that the outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; may be more likely in some states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; than in others. Learning the measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; alters Bob's knowledge of the original state: before the measurement he assigns probability &lt;span class=&quot;math-container&quot;&gt;$p(i)$&lt;/span&gt; to Alice having selected &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, but after the measurement he assigns &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; the probability&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(i|m) = \frac{p(i, m)}{p(m)}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p(i, m)$&lt;/span&gt; is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Joint_probability_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;joint probability&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. An extreme case of this occurs if the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; form an orthonormal basis and &lt;span class=&quot;math-container&quot;&gt;$M_k = |\psi_k\rangle\langle\psi_k|$&lt;/span&gt; are the associated projectors. In this case, Bob can identify &lt;span class=&quot;math-container&quot;&gt;$i = m$&lt;/span&gt; with certainty.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$p(m|i)$&lt;/span&gt;: What Alice predicts about measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; from her knowledge of preparation &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Before performing the measurement, Bob assigns to each outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; probability&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m) = \mathrm{tr}(M_m^\dagger M_m \rho).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, Alice knows &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and assigns different probabilities to each outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m|i) = \langle\psi_i|M_m^\dagger M_m|\psi_i\rangle = \frac{p(i, m)}{p(i)}.\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once again, an extreme case occurs if the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; form an orthonormal basis and &lt;span class=&quot;math-container&quot;&gt;$M_k = |\psi_k\rangle\langle\psi_k|$&lt;/span&gt; are the associated projectors. In this case, Alice can predict measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m = i$&lt;/span&gt; with certainty.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Connection between &lt;span class=&quot;math-container&quot;&gt;$p(i|m)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p(m|i)$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the two quantities do not refer to inverse procedures. Instead, they refer to the same procedure, but describe knowledge about one uncertain variable provided by the knowledge of another. Namely, &lt;span class=&quot;math-container&quot;&gt;$p(m|i)$&lt;/span&gt; captures the knowledge about the measurement result of someone who knows the preparation while &lt;span class=&quot;math-container&quot;&gt;$p(i|m)$&lt;/span&gt; captures the knowledge inferred about the preparation of someone who knows the measurement result.&lt;/p&gt;&#xA;&lt;p&gt;Mathematically, the connection between the two conditional probabilities is given by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bayesian_probability&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bayes' theorem&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(i|m) \, p(m) = p(m|i) \, p(i).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Post-measurement state&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The last equality in the question is not correct. In particular, it is not clear what multiplying the two conditional probabilities means since they are normalized to different events (c.f. denominators in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;). Also, it is not clear what the double subscript in &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ij}^m\rangle$&lt;/span&gt; indicates.&lt;/p&gt;&#xA;&lt;p&gt;The correct formula for post-measurement state from the perspective of Alice who knows preparation &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; but does not know measurement outcome is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_i = \sum_m p(m|i)|\psi_i^m\rangle\langle\psi_i^m|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;whereas from the perspective of Bob who knows measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; but does not know preparation &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_m = \sum_i p(i|m)|\psi_i^m\rangle\langle\psi_i^m|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\psi_i^m\rangle=\frac{M_m|\psi_i\rangle}{\|M_m|\psi_i\rangle\|}$&lt;/span&gt; is the post-measurement state associated with outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; and the pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;. In particular, &lt;span class=&quot;math-container&quot;&gt;$|\psi_i^m\rangle$&lt;/span&gt; is not in general a member of the initial ensemble &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;. Compare the last equation to &lt;span class=&quot;math-container&quot;&gt;$(2.145)$&lt;/span&gt; in Nielsen &amp;amp; Chuang.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-20T22:59:04.997" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15617" PostTypeId="2" ParentId="15614" CreationDate="2021-01-20T23:53:55.647" Score="2" Body="&lt;p&gt;I believe that you can do this actually can be done with Qiskit as well. You just need to specify the &lt;em&gt;basis gates&lt;/em&gt; sets you want to use under the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.compiler.transpile.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;transpile function.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt; If I have the following circuit&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HYv1z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HYv1z.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which can be generated with Qiskit as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.h(qreg_q[0])&#xA;circuit.x(qreg_q[1])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;circuit.measure(qreg_q[1], creg_c[1])&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= True, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, if I am targeting a Trapped-ion system then instead of using CNOT as part of the native gate, we use Mølmer–Sørensen gate but this gate is equivalent to &lt;span class=&quot;math-container&quot;&gt;$R_{XX}$&lt;/span&gt; gate when using two qubits. So I can transpile my circuit using this &lt;span class=&quot;math-container&quot;&gt;$R_{XX}$&lt;/span&gt; gate and single qubit rotation as my native gates. We can do that as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, transpile&#xA;trans_qc = transpile(circuit, backend = None, basis_gates = ['rx', 'ry', 'rz', 'rxx'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the transpiled circuit, &lt;code&gt;tans_qc&lt;/code&gt;, is now have the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TP3nP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TP3nP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Furthermore,  if you want to actually simulate this on a trapped-ion hardware and potentially running on one then I would suggest you to sign-up for a &lt;strong&gt;free&lt;/strong&gt; account with &lt;a href=&quot;https://www.aqt.eu/&quot; rel=&quot;nofollow noreferrer&quot;&gt;AQT&lt;/a&gt; (Alpine Quantum Technologies). Now you can actually set your &lt;code&gt;backend&lt;/code&gt; using AQT system and transpile your circuit based on that.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit_aqt_provider import AQTProvider&#xA;aqt = AQTProvider('***********************')&#xA;AQT_backend = aqt.backends.aqt_qasm_simulator&#xA;&#xA;trans_qc = transpile(circuit, backend = AQT_backend,  optimization_level = 3)&#xA;trans_qc.draw( 'mpl',style={'name': 'bw'}, plot_barriers= True, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which will output:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VMxwz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VMxwz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Use this &lt;a href=&quot;https://github.com/qiskit-community/qiskit-aqt-provider&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation here&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-20T23:53:55.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15618" PostTypeId="1" AcceptedAnswerId="15620" CreationDate="2021-01-21T01:36:38.900" Score="3" ViewCount="118" Body="&lt;p&gt;I am unsure how exactly it can be inferred that the following sequence of logic gates and rotation operators acting on a three-qubit state &lt;span class=&quot;math-container&quot;&gt;$\lvert abc\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ R_{y,c}\left(\frac{\pi}{4}\right)CNOT(b,c)R_{y,c}\left(\frac{\pi}{4}\right)CNOT(a,c)R_{y,c}\left(-\frac{\pi}{4}\right)CNOT(b,c) R_{y,c}\left(-\frac{\pi}{4}\right) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(Where, for example, &lt;span class=&quot;math-container&quot;&gt;$R_{y,c}(\frac{\pi}{4})$&lt;/span&gt; represents a &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; rotation of qubit c about the y-axis and CNOT(b,c) represents the CNOT gate acting on the qubits b and c (b is the control and c is the target).)&lt;/p&gt;&#xA;&lt;p&gt;Can represent that of a Toffoli gate but with relative phases.&lt;/p&gt;&#xA;&lt;p&gt;My specific problem with understanding this sequence are the &lt;em&gt;rotation operators&lt;/em&gt;. If I neglect the rotation operators and just apply the three CNOT logic gates for some state &lt;span class=&quot;math-container&quot;&gt;$\lvert abc\rangle$&lt;/span&gt; (e.g. &lt;span class=&quot;math-container&quot;&gt;$\lvert 110\rangle$&lt;/span&gt;), it is apparent that the sequence of the three CNOT gates acts as a single Toffoli gate. But I'm confused by trying to understand what effect the rotation operators have on each c qubit. Do they cancel each other out? Do they impose a net rotation on some state &lt;span class=&quot;math-container&quot;&gt;$\lvert abc\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I've tried to make sense of it all by envisioning rotations on a Bloch sphere but it hasn't helped. If anyone could provide an explanation as to what effect a rotation operator has on a qubit, that would be helpful. Thank you.&lt;/p&gt;&#xA;" OwnerUserId="14494" LastEditorUserId="10480" LastEditDate="2021-01-21T02:26:37.353" LastActivityDate="2021-01-21T02:26:37.353" Title="How does a rotation about the y-axis on a Bloch sphere affect the state of a qubit?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15619" PostTypeId="1" AcceptedAnswerId="15641" CreationDate="2021-01-21T02:04:07.580" Score="4" ViewCount="165" Body="&lt;p&gt;There is something very strange and absurd for me about the power of a quantum computer. Let me briefly states the following facts:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Fact 1: theoretical computer scientists believe (very likely to happen) that quantum computer cannot solve NP-complete problems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Fact 2: In BQP, there are problems that is harder than NP, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Boson_sampling&quot; rel=&quot;nofollow noreferrer&quot;&gt;Boson sampling distribution&lt;/a&gt; which is known to be &lt;span class=&quot;math-container&quot;&gt;$\#P$$-hard$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Fact 3: If Boson sampling distribution (and other problems such as Quantum Sampling) belong to &lt;span class=&quot;math-container&quot;&gt;$PH$&lt;/span&gt;, then the polynomial time hierarchy collapsed. So, it is unlikely that these problems belongs to &lt;span class=&quot;math-container&quot;&gt;$PH$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Now, by these facts it is said that BQP is greater class than &lt;span class=&quot;math-container&quot;&gt;$PH$&lt;/span&gt;. I.e. since all NP problems lies in PH, then BQP contains all NP problems including the NP-complete problems. But, at the same time, theoretical computer scientists (such as Scott Aaronson) conjectured that quantum computer cannot solve NP-complete problems efficiently, i.e. they are trying to say the following: BQP should be smaller than class PH.&lt;/p&gt;&#xA;&lt;p&gt;Can someone explain to me whether I'm wrong about something or not.&lt;/p&gt;&#xA;" OwnerUserId="9016" LastEditorUserId="9016" LastEditDate="2021-01-26T10:54:55.107" LastActivityDate="2021-01-26T10:54:55.107" Title="CS conjecture that Quantum Computer cannot solve NP-complete problems, but Boson Samplers do a #P-hard problem. How is it?" Tags="&lt;complexity-theory&gt;&lt;bqp&gt;&lt;boson-sampling&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15620" PostTypeId="2" ParentId="15618" CreationDate="2021-01-21T02:24:35.563" Score="3" Body="&lt;p&gt;The key observation is that commuting &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; through a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; rotation changes the sign of the rotation angle&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;XR_y(\theta) = R_y(-\theta)X.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In order to understand how the circuit gives rise to a Toffoli-like gate, we consider three cases.&lt;/p&gt;&#xA;&lt;p&gt;First, suppose that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$CNOT(a, c)$&lt;/span&gt; acts as identity and the sequence simplifies as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{y,c}\left(\frac{\pi}{4}\right)CNOT(b,c)R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(-\frac{\pi}{4}\right)CNOT(b,c) R_{y,c}\left(-\frac{\pi}{4}\right) = \\&#xA;R_{y,c}\left(\frac{\pi}{4}\right)CNOT(b,c)CNOT(b,c) R_{y,c}\left(-\frac{\pi}{4}\right) = \\&#xA;R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(-\frac{\pi}{4}\right) = \\&#xA;I.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, suppose that qubits &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; are in the state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$CNOT(a, c)$&lt;/span&gt; acts as Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and each &lt;span class=&quot;math-container&quot;&gt;$CNOT(b, c)$&lt;/span&gt; acts as identity and the sequence simplifies as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(\frac{\pi}{4}\right)X_cR_{y,c}\left(-\frac{\pi}{4}\right) R_{y,c}\left(-\frac{\pi}{4}\right) = \\&#xA;R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(\frac{\pi}{4}\right) R_{y,c}\left(\frac{\pi}{4}\right)X_c = \\&#xA;R_{y,c}(\pi) X_c = -iY_cX_c = Z_c.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, suppose that qubits &lt;span class=&quot;math-container&quot;&gt;$ab$&lt;/span&gt; are in the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Then all three CNOTs act as Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and the sequence simplifies as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{y,c}\left(\frac{\pi}{4}\right)X_cR_{y,c}\left(\frac{\pi}{4}\right)X_cR_{y,c}\left(-\frac{\pi}{4}\right)X_cR_{y,c}\left(-\frac{\pi}{4}\right) = \\&#xA;R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(-\frac{\pi}{4}\right)X_cX_cR_{y,c}\left(-\frac{\pi}{4}\right)R_{y,c}\left(\frac{\pi}{4}\right)X_c = \\&#xA;R_{y,c}\left(\frac{\pi}{4}\right)R_{y,c}\left(-\frac{\pi}{4}\right)R_{y,c}\left(-\frac{\pi}{4}\right)R_{y,c}\left(\frac{\pi}{4}\right)X_c = X_c&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have shown that the action of the circuit on the computational basis is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{ccc}&#xA;|000\rangle &amp;amp; \to &amp;amp; |000\rangle \\&#xA;&amp;amp; \dots &amp;amp; \\&#xA;|011\rangle &amp;amp; \to &amp;amp; |011\rangle \\&#xA;|100\rangle &amp;amp; \to &amp;amp; |100\rangle \\&#xA;|101\rangle &amp;amp; \to &amp;amp; -|101\rangle \\&#xA;|110\rangle &amp;amp; \to &amp;amp; |111\rangle \\&#xA;|111\rangle &amp;amp; \to &amp;amp; |110\rangle&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which neglecting the phase change on &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt; is that of the Toffoli gate. Action of an operator on a basis completely determines the operator.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that it is not true that without the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; rotations the circuit is equivalent to a Toffoli with phases. In that case, the two &lt;span class=&quot;math-container&quot;&gt;$CNOT(b, c)$&lt;/span&gt; gates cancel and all we are left with is &lt;span class=&quot;math-container&quot;&gt;$CNOT(a, c)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-21T02:24:35.563" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15621" PostTypeId="1" AcceptedAnswerId="15628" CreationDate="2021-01-21T05:06:45.507" Score="2" ViewCount="74" Body="&lt;p&gt;If Alice and Bob share only classical communication resources such as noisy or perfect classical channels, is shared entanglement always equivalent to shared randomness?&lt;/p&gt;&#xA;&lt;p&gt;In other words, must there be a quantum channel in order to exploit the power of shared entanglement? If yes, how can one prove this?&lt;/p&gt;&#xA;" OwnerUserId="14178" LastEditorUserId="55" LastEditDate="2021-01-22T09:24:57.113" LastActivityDate="2021-01-22T16:39:44.937" Title="If Alice and Bob share only classical communication resources, is shared entanglement always equivalent to shared randomness?" Tags="&lt;entanglement&gt;&lt;information-theory&gt;&lt;communication&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15622" PostTypeId="1" CreationDate="2021-01-21T08:08:02.797" Score="5" ViewCount="50" Body="&lt;p&gt;I'm very new to quantum computing, sorry if this is a dumb question.&lt;/p&gt;&#xA;&lt;p&gt;I was reading in some lecture notes I found online that a quantum network could be created by using teleportation multiple times to move a qubit from one node to the next until it reaches its destination. So, like if you wanted to get a qubit from point A to point D, you could send it from A to B, B to C, and then C to D. At each step, you would send 2 classical bits and use them for quantum teleportation of a qubit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;2 bits  A -&amp;gt; B&#xA;1 qubit A -&amp;gt; B&#xA;2 bits  B -&amp;gt; C&#xA;1 qubit B -&amp;gt; C&#xA;2 bits  C -&amp;gt; D&#xA;1 qubit C -&amp;gt; D&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So I guess my question is, would it be possible to send the necessary classical bits from A to B to C to D, and then use those to directly perform quantum teleportation from A to D? And if so, what is the advantage of performing quantum teleportation at each step?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;2 bits  A -&amp;gt; B&#xA;2 bits  B -&amp;gt; C&#xA;2 bits  C -&amp;gt; D&#xA;1 qubit A -&amp;gt; D&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14526" LastEditorUserId="55" LastEditDate="2021-01-24T14:56:39.350" LastActivityDate="2021-01-24T17:35:10.047" Title="Why do quantum networks matter?" Tags="&lt;teleportation&gt;&lt;communication&gt;&lt;quantum-networks&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15623" PostTypeId="1" AcceptedAnswerId="15624" CreationDate="2021-01-21T09:08:21.517" Score="2" ViewCount="69" Body="&lt;p&gt;The class QAOA from qiskit:&#xA;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.QAOA.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.QAOA.html&lt;/a&gt;&lt;br /&gt;&#xA;has the parameter initial_state from the type InitialState.&#xA;&lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.aqua.components.initial_states.html#module-qiskit.aqua.components.initial_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/qiskit.aqua.components.initial_states.html#module-qiskit.aqua.components.initial_states&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class QAOA(operator=None, optimizer=None, p=1, initial_state=None, mixer=None, initial_point=None, gradient=None, expectation=None, include_custom=False, max_evals_grouped=1, aux_operators=None, callback=None, quantum_instance=None) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But this doesnt work.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qaoa_mes = QAOA(H, p=p, optimizer=optimizer, initial_state = Zero, quantum_instance=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;))&#xA;results = qaoa_mes.run()  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Any Ideas?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastActivityDate="2021-01-21T10:59:18.330" Title="How to use Initial States in Qiskits QAOA?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15624" PostTypeId="2" ParentId="15623" CreationDate="2021-01-21T09:17:00.993" Score="4" Body="&lt;p&gt;You need to add the number of qubits for the initial state, this worked for me :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n_qubits = 2 #or whatever you want for your example &#xA;qaoa_mes = QAOA(H, p=p, optimizer=optimizer, initial_state = Zero(n_qubits), quantum_instance=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can also pass a list for the initial point, for example :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qaoa_mes = QAOA(H, p=p, optimizer=optimizer, initial_state = [0.,0.], quantum_instance=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can even pass a circuit for the initial point, there :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n_qubits = 2&#xA;initial = QuantumCircuit(n_qubits)&#xA;#add any gate you want in the circuit, for example :&#xA;initial.h(0)&#xA;initial.cx(0,1)&#xA;&#xA;qaoa_mes = QAOA(H, p=p, optimizer=optimizer, initial_state = initial, quantum_instance=Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you need something else feel free to ask ! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="12396" LastEditDate="2021-01-21T10:59:18.330" LastActivityDate="2021-01-21T10:59:18.330" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15625" PostTypeId="2" ParentId="15622" CreationDate="2021-01-21T10:41:19.397" Score="0" Body="&lt;p&gt;I guess that there is no direct connection between A and D and this is a reason why qubit is firstly sent to B, then to C and finnaly to D. Of, course you can use classical bits generated at A to teleport a state to D but you need to have entangled qubits between A and D.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-21T10:41:19.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15626" PostTypeId="2" ParentId="6986" CreationDate="2021-01-21T12:39:57.580" Score="1" Body="&lt;p&gt;They did use them in the &lt;a href=&quot;https://arxiv.org/abs/1511.03190&quot; rel=&quot;nofollow noreferrer&quot;&gt;Vienna&lt;/a&gt; loophole-free Bell test, which is a pre-condition for implementing DIQKD. Their benefit is that you can do a loophole-free violation of the CHSH inequality efficiency down to &lt;span class=&quot;math-container&quot;&gt;$2/3$&lt;/span&gt;, whereas if you use maximally entangled states the required efficiency is much higher, &lt;span class=&quot;math-container&quot;&gt;$2\sqrt2-2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore I fully expect them to be used for DIQKD based on photons. Note that the &lt;a href=&quot;https://arxiv.org/abs/1508.05949&quot; rel=&quot;nofollow noreferrer&quot;&gt;Delft&lt;/a&gt; loophole-free Bell test used maximally entangled states, though, as they were using NV centres instead.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-01-21T12:39:57.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15627" PostTypeId="1" CreationDate="2021-01-21T16:49:31.813" Score="1" ViewCount="18" Body="&lt;p&gt;Having been part of the mainframe, client-server, and now containers scale out architecture, I can observe the parallel and resemblance of today's quantum computers (massive) to that of the mainframe era where everyone hooks onto this massive mainframe for computational power.&lt;/p&gt;&#xA;&lt;p&gt;How does one design a fundamentally distributed scale-out quantum computing architecture?&lt;/p&gt;&#xA;" OwnerUserId="166" LastActivityDate="2021-01-21T16:49:31.813" Title="A distributed, scale-out quantum computing architecture?" Tags="&lt;architecture&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15628" PostTypeId="2" ParentId="15621" CreationDate="2021-01-21T17:18:40.643" Score="3" Body="&lt;p&gt;As @Rammus has mentioned in the comments one does not need a quantum channel to utilize entanglement as a resource. One can utilize quantum correlations to aptly perform tasks that are impossible to perform with classical correlations (i.e. shared randomness). For example in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_refereed_game&quot; rel=&quot;nofollow noreferrer&quot;&gt;nonlocal game&lt;/a&gt;, two players share entanglement (but don't need any kind of quantum channel) and they can use their entanglement to satisfy certain constraints that are impossible with only classical corrlations.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastActivityDate="2021-01-21T17:18:40.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15629" PostTypeId="2" ParentId="15619" CreationDate="2021-01-21T18:59:43.140" Score="3" Body="&lt;p&gt;This is a well-framed question that highlights subtleties about what is known and unknown on the strengths and limitations of quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;Initially, it is completely consistent with what we know, and indeed what we expect, for both NP and BQP to be incomparable.  That is, there are problems such as the TSP that are known to be in NP that are not expected to be solvable efficiently on a quantum computer, and perhaps more interestingly problems that are efficiently solvable with a BQP machine that are not even expected to be efficiently verifiable with a classical computer.  Accordingly I would lightly revise Fact 1 to state:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In BQP, theoretical computer scientists believe (very likely to happen) that quantum computers cannot &lt;strong&gt;efficiently&lt;/strong&gt; solve NP-complete problems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;However, Fact 2 is not entirely correct as stated.  Although it is true that BQP likely includes problems such as forrelation that are outside of the polynomial hierarchy and in a sense &amp;quot;harder&amp;quot; than NP, and although in order to verify the output of a Boson Sampler one has to solve the (likely) very hard problem of calculating permanents of various matrices with entries in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt;, it is not the case that the specific sampling task performed by a Boson Sampler is #P-hard.&lt;/p&gt;&#xA;&lt;p&gt;That is, the Boson Sampler does not calculate the permanents of an &lt;em&gt;a-priori&lt;/em&gt; given matrix.  Rather, given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; photons on &lt;span class=&quot;math-container&quot;&gt;$m\gg n$&lt;/span&gt; modes, the Boson Sampler outputs the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; photons in the various output modes in a way corresponding to a &lt;span class=&quot;math-container&quot;&gt;$n\times n$&lt;/span&gt; submatrix.  One does not have control over the submatrix of input and output modes sampled by the Boson Sampler, and all one can say is that the submatrix has a large permanent.&lt;/p&gt;&#xA;&lt;p&gt;I like to think of BosonSampling as a bit like the Texas sharpshooter who shoots a gun onto the side of a barn, and then later on paints a bullseye on the barn.  Here one shoots bosons (photons) through a bunch of beam-splitters and phase-shifters, and then based on the output one calculates the permanent of the corresponding submatrix.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-01-24T04:52:52.813" LastActivityDate="2021-01-24T04:52:52.813" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15630" PostTypeId="1" AcceptedAnswerId="15632" CreationDate="2021-01-21T19:36:32.903" Score="2" ViewCount="100" Body="&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;POVM&lt;/a&gt; is typically defined as a collection of operators &lt;span class=&quot;math-container&quot;&gt;$\{\mu(a)\}_{a\in\Sigma}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mu(a)\in\mathrm{Pos}(\mathcal X)$&lt;/span&gt; positive operators such that &lt;span class=&quot;math-container&quot;&gt;$\sum_{a\in\Sigma}\mu(a)=I$&lt;/span&gt;, where I take here &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; to be some finite set and &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; some vector space (using the notation from &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' TQI&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, when discussing &lt;em&gt;observables&lt;/em&gt; in a measure-theoretic framework, given a nonempty set &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;, a &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;-algebra &lt;span class=&quot;math-container&quot;&gt;$\mathcal F$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; (in other words, given a measurable space &lt;span class=&quot;math-container&quot;&gt;$(\Omega,\mathcal F)$&lt;/span&gt;), and denoting with &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(\mathcal X)$&lt;/span&gt; the set of &lt;em&gt;effects&lt;/em&gt; on the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;, that is, the set of Hermitian operators &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$0\le E\le I$&lt;/span&gt;, we say that a mapping &lt;span class=&quot;math-container&quot;&gt;$\mathrm A:\mathcal F\to\mathcal E(\mathcal X)$&lt;/span&gt; is an &lt;em&gt;observable&lt;/em&gt; if, for any state &lt;span class=&quot;math-container&quot;&gt;$\psi\in\mathcal X$&lt;/span&gt;, the function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal F\ni X\mapsto \langle \psi|\mathrm A(X)\psi\rangle\in\mathbb R$$&lt;/span&gt;&#xA;is a probability measure. Here I'm taking definition and notation from &lt;a href=&quot;https://arxiv.org/abs/0811.0783&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heinosaari et al. (2008)&lt;/a&gt;.&#xA;In other words, &lt;span class=&quot;math-container&quot;&gt;$\mathrm A$&lt;/span&gt; is an observable iff, for all &lt;span class=&quot;math-container&quot;&gt;$\psi\in\mathcal X$&lt;/span&gt;, the triple &lt;span class=&quot;math-container&quot;&gt;$(\Omega,\mathcal F,\mathrm A_\psi)$&lt;/span&gt; is a probability space, with &lt;span class=&quot;math-container&quot;&gt;$\mathrm A_\psi$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$\mathrm A_\psi(X)=\langle \psi|\mathrm A(X)\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to get a better understanding of how these two different formalisms match.&#xA;In particular, an &lt;em&gt;observable&lt;/em&gt; as thus defined is closer to a POVM than an &amp;quot;observable&amp;quot; as usually defined in physics (which is just a Hermitian operator), right?&lt;/p&gt;&#xA;&lt;p&gt;Are these &lt;em&gt;observables&lt;/em&gt; equivalent to POVMs? That is, does any such &lt;em&gt;observable&lt;/em&gt; correspond to a POVM, and &lt;em&gt;vice versa&lt;/em&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I can see that a POVM can be thought of as/is the map &lt;span class=&quot;math-container&quot;&gt;$\mu:\Sigma\to\mathrm{Pos}(\mathcal X)$&lt;/span&gt;, which then extends to a map &lt;span class=&quot;math-container&quot;&gt;$\tilde\mu:2^{\Sigma}\to\mathrm{Pos}(\mathcal X)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\tilde\mu(2^\Sigma)=1$&lt;/span&gt;, which is then an &lt;em&gt;observable&lt;/em&gt;.&#xA;However, I'm not sure whether any &lt;em&gt;observable&lt;/em&gt; also corresponds to such a POVM.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-01-22T00:50:57.707" LastActivityDate="2021-01-22T04:56:08.480" Title="What is the relation between observables (as defined in the measure-theoretic framework) and POVMs?" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;notation&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15631" PostTypeId="2" ParentId="15630" CreationDate="2021-01-21T23:50:08.883" Score="1" Body="&lt;p&gt;Upon some more reflection, the answer is probably as follows.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathrm A$&lt;/span&gt; be an observable according to the definition in the question, and assume &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; is finite. Then any &lt;span class=&quot;math-container&quot;&gt;$X\in\mathcal F$&lt;/span&gt; is also some finite subset of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;. By definition of observable, we require the mapping &lt;span class=&quot;math-container&quot;&gt;$\mathrm A_\psi$&lt;/span&gt; to be additive and non-negative, and therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle \psi|\mathrm A(X)\psi\rangle = \sum_{\omega\in X}\langle \psi|\mathrm A(\{\omega\})\psi\rangle \ge0.$$&lt;/span&gt;&#xA;It follows that, for any &lt;span class=&quot;math-container&quot;&gt;$\omega\in\Omega$&lt;/span&gt;, the operator &lt;span class=&quot;math-container&quot;&gt;$\mathrm A(\{\omega\})$&lt;/span&gt; is positive semi-definite: &lt;span class=&quot;math-container&quot;&gt;$\mathrm A(\{\omega\})\ge0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, asking &lt;span class=&quot;math-container&quot;&gt;$\mathrm A_\psi$&lt;/span&gt; to be a &lt;em&gt;probability&lt;/em&gt; measure also means that &lt;span class=&quot;math-container&quot;&gt;$\mathrm A_\psi(\Omega)=1$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$\sum_{\omega\in\Omega}A(\{\omega\})$&lt;/span&gt; to be an operator whose expectation value is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on any state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;. This implies &lt;span class=&quot;math-container&quot;&gt;$\sum_{\omega\in\Omega}A(\{\omega\})=I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It follows that, defining &lt;span class=&quot;math-container&quot;&gt;$\mu(\omega)\equiv A(\{\omega\})$&lt;/span&gt;, we get the definition of POVM as collection of positive semi-definite operators summing to the identity.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-01-21T23:50:08.883" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15632" PostTypeId="2" ParentId="15630" CreationDate="2021-01-21T23:51:09.597" Score="2" Body="&lt;p&gt;These two definitions define the same concept: the POVM measurement. The &lt;em&gt;observable&lt;/em&gt; definition is how POVM is defined for use in the case of infinite index set and dimension (see e.g. &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;POVM&lt;/a&gt;) and &lt;em&gt;POVM&lt;/em&gt; definition in the question is how it is simplified for use in the finite case. If you are working in finite dimensions, the two constructions are equivalent.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;POVM from observable&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;We will construct a POVM &lt;span class=&quot;math-container&quot;&gt;$\{\mu(a)\}_{a\in\Sigma}$&lt;/span&gt; from the observable &lt;span class=&quot;math-container&quot;&gt;$A: \mathcal{F} \to \mathcal{E}(\mathcal{X})$&lt;/span&gt;. Begin by choosing a finite &lt;span class=&quot;math-container&quot;&gt;$\Sigma \subset \mathcal{F}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\cup_{a\in\Sigma}a = \Omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a \cap b = \emptyset$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$a, b\in\Sigma$&lt;/span&gt;. This serves as the index set for the POVM and establishes the connection between the two definitions. Define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mu(a) := A(a).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that this defines valid POVM elements because &lt;span class=&quot;math-container&quot;&gt;$0 \le A(X) \le I$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$X\in\mathcal{F}$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{a\in\Sigma} \mu(a) = \sum_{a\in\Sigma} A(a) = A\left(\bigcup_{a\in\Sigma} a\right) = A(\Omega) = I&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where in the second equality we used &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;-additivity of &lt;span class=&quot;math-container&quot;&gt;$A_\psi$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and in the last step we used the fact that &lt;span class=&quot;math-container&quot;&gt;$A_\psi$&lt;/span&gt; is a probability measure for every &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Observable from POVM&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;(This merely fills in some details in the construction you sketched in the question.)&lt;/p&gt;&#xA;&lt;p&gt;We will construct an observable from the POVM &lt;span class=&quot;math-container&quot;&gt;$\{\mu(a)\}_{a\in\Sigma}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\Omega = \Sigma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F} = \mathcal{P}(\Sigma)$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$X\in\mathcal{F}$&lt;/span&gt; define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A(X) := \sum_{a\in X}\mu(a)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we are using the fact that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is finite. Note that the right-hand side is a valid effect. We need to show that for every &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A_\psi$&lt;/span&gt; is a probability measure. It is clear that for every &lt;span class=&quot;math-container&quot;&gt;$X\in\mathcal{F}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A_\psi(X) \in [0, 1]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_\psi(\emptyset) = 0$&lt;/span&gt;. Now, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; is finite, because &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; is finite. Thus, to show &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;-additivity we just need to show additivity. Let &lt;span class=&quot;math-container&quot;&gt;$X_{i=1,\dots,k}$&lt;/span&gt; be a collection of disjoint subsets of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A_\psi\left(\bigcup_{i=1}^k X_i\right) = \sum_{a\in\cup_{i=1}^k X_i} \mu_\psi(a) = \sum_{i=1}^k \sum_{a\in X_i} \mu_\psi(a) = \sum_{i=1}^k A_\psi(X_i)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mu_\psi(a) = \langle\psi|\mu(a)\psi\rangle$&lt;/span&gt; and in the second equality we used the fact that &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt; are disjoint.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark:&lt;/strong&gt; Note that the definition of observable appears to be more flexible: it doesn't just give rise to a single POVM. Instead, every partitioning of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; using the elements of the &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;-algebra gives rise to a potentially different POVM. However, this fact corresponds to the trivial observation that you can obtain a new POVM by grouping and adding elements of a given POVM.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-22T04:56:08.480" LastActivityDate="2021-01-22T04:56:08.480" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15633" PostTypeId="1" CreationDate="2021-01-22T06:39:19.570" Score="3" ViewCount="57" Body="&lt;p&gt;I have recently been interested in the field of 'Econophysics' which as I understand it is the practice of basically applying results of physics in areas such as non-linear dynamics and stochastic physics to already known facts of economics (i.e. it is not a field of new discoveries but just a different perspective on economics).&lt;/p&gt;&#xA;&lt;p&gt;I am also a lover of all things &lt;em&gt;Quantum&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I was wondering if there have been any attempts to use QC to simulate economic models, which tend to be really difficult on classical computers. The field of &amp;quot;Quantum Finance&amp;quot; (how much more buzzword-y can a field get...), is able to describe many phenomena in finance and monetary supply management using quantum concepts like Hilbert Spaces and state collapses (this has nothing to do with quantum mechanics, it just uses the same formalism). Maybe in the same way that Hamiltonian simulation can be done easily on a quantum computer, because it just naturally lends itself to the medium, these Quantum Finance models can also be done easily?&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="9006" LastEditDate="2021-01-22T12:22:30.180" LastActivityDate="2021-01-22T12:35:18.380" Title="Applications of Quantum Computing to Economics" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;models&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15634" PostTypeId="1" CreationDate="2021-01-22T08:51:02.060" Score="2" ViewCount="43" Body="&lt;p&gt;Imagine one wants to represent the &lt;em&gt;and&lt;/em&gt; function for any number of qubits in Dirac notation. The &lt;em&gt;and&lt;/em&gt; gate flips the target qubit if all the control qubits are in state 1. This is its matrix representation :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin {bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \ddots &amp;amp; &amp;amp; \vdots &amp;amp; \vdots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It can be decomposed into two parts :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \ddots &amp;amp; &amp;amp; \vdots &amp;amp; \vdots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{bmatrix}=&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; &amp;amp; \vdots \\&#xA;0 &amp;amp; 0 &amp;amp;  &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{bmatrix} \otimes I =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; &amp;amp; \vdots \\&#xA;0 &amp;amp; 0 &amp;amp;  &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix} \otimes I-&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; &amp;amp; \vdots \\&#xA;0 &amp;amp; 0 &amp;amp;  &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix} \otimes I&#xA;= (I-|1\cdots1\rangle\langle1\cdots1| ) \otimes I&#xA;\tag{1}$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin {bmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; \ddots &amp;amp; &amp;amp; \vdots &amp;amp; \vdots \\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{bmatrix} = \begin{bmatrix}&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 0\\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; &amp;amp; \vdots \\&#xA;0 &amp;amp; 0 &amp;amp;  &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{bmatrix} \otimes X =&#xA;|1\cdots1\rangle\langle1\cdots1| \otimes X&#xA;\tag{2}$$&lt;/span&gt;&#xA;So combining (1) and (2), we get : &lt;span class=&quot;math-container&quot;&gt;$$U_{and} = (I-|1\cdots1\rangle\langle1\cdots1| ) \otimes I + |1\cdots1\rangle\langle1\cdots1| \otimes X$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is still pretty easy to see, the example complicates a lot when we have an &lt;em&gt;or&lt;/em&gt; gate : &lt;span class=&quot;math-container&quot;&gt;$$U_{or} = U_{or} = |0...0\rangle\langle 0...0|\otimes I + \big(I - |0...0\rangle\langle 0...0|\big) \otimes X$$&lt;/span&gt; which applies the X gate on the target qubit if there is at least 1 control qubits in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;My question is : is there any way to see these transformations in Dirac notation to use them in a program ? To gain some intuition on the decomposition.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2021-01-22T08:51:02.060" Title="Representation of multiple qubit matrices in Dirac notation" Tags="&lt;gate-synthesis&gt;&lt;matrix-representation&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15635" PostTypeId="2" ParentId="15605" CreationDate="2021-01-22T09:12:53.943" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15610/1386&quot;&gt;@Adam Zalcman answer&lt;/a&gt; explains well why the issue happens.&lt;/p&gt;&#xA;&lt;p&gt;According to &lt;a href=&quot;https://github.com/tensorforce/tensorforce/issues/303&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensorforce/issues/303&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Linux has a static limit on the number of shared libraries with TLS (Thread-Local Storage, to support C++'s __thread storage class) that can be loaded into a process. Gym itself doesn't use shared libraries, but OpenGL and Tensorflow both have several libraries. The limit is small, like 14 or 32 depending on OS version (it's the version of glibc that matters).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The issue was solved by upgrading from Ubuntu 14 to Ubuntu 16.&lt;/p&gt;&#xA;&lt;p&gt;This could potentially solve the issue as upgrading the OS will likely also upgrade the &lt;code&gt;glibc&lt;/code&gt; shipped with the OS. It seems like the version of &lt;code&gt;glibc&lt;/code&gt; shipped with Ubuntu 16 increased the &amp;quot;static limit on the number of shared libraries with TLS&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2021-01-22T09:12:53.943" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15636" PostTypeId="1" AcceptedAnswerId="15638" CreationDate="2021-01-22T12:32:29.330" Score="2" ViewCount="43" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;Let us restrict our discussion to bosons and adopt the convention First Quantised &lt;span class=&quot;math-container&quot;&gt;$\leftrightarrow $&lt;/span&gt; Second Quantised Theory (we are following these Ashok Sen's Quantum Field Theory I of HRI institute's &lt;a href=&quot;http://www.hri.res.in/%7Esen/QFT1_lectures.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;notes&lt;/a&gt; also on my &lt;a href=&quot;https://drive.google.com/file/d/1lC-B4mTtZQm_iO-qe_vriClaw0pfRzrd/view&quot; rel=&quot;nofollow noreferrer&quot;&gt;google drive&lt;/a&gt;). Consider a single particle system's hamiltonian &lt;span class=&quot;math-container&quot;&gt;$\hat h$&lt;/span&gt; and energy operator &lt;span class=&quot;math-container&quot;&gt;$\hat E$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat h \psi = \hat E \psi $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with energy eigenstates &lt;span class=&quot;math-container&quot;&gt;$u_i$&lt;/span&gt; and eigenvalues &lt;span class=&quot;math-container&quot;&gt;$e_n$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat h u_n = e_n u_n$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now moving to an assembly of quantum mechanical Hamiltonians (many body system)  &lt;span class=&quot;math-container&quot;&gt;$\sum_i h_i$&lt;/span&gt; with an interacting potential &lt;span class=&quot;math-container&quot;&gt;$\hat v_{ik}$&lt;/span&gt; (between two particles corresponds to a second quantised version (Page 16):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hat H_N = \sum_{i=1}^N \hat h_i + \frac{1}{2}\sum_{\substack i\neq j &#xA; \\ i,j=1 }^N \hat v_{i,j} \leftrightarrow \sum_{n=1}^\infty e_n a_n^\dagger a_n  + \frac{1}{2} \sum_{m,n,p,q=1}^\infty \Big(\int \int  d^3 r_1 d^3 r_2 u_{m}(\vec r_1)^* u_{n}(\vec r_2)^* \hat v_{12} u_{m}(\vec r_1) u_{p}(\vec r_2) \Big) a^\dagger_m a^\dagger_n  a_p a_q$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$e_n$&lt;/span&gt; i the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;th energy eigevalue,  &lt;span class=&quot;math-container&quot;&gt;$u_i$&lt;/span&gt; are the one-particle eigenstates and &lt;span class=&quot;math-container&quot;&gt;$a_i^\dagger$&lt;/span&gt; is the creation operator of the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;'th particle and they obey the energy eigenvalue system &lt;span class=&quot;math-container&quot;&gt;$h_i u_n = e_n u_n$&lt;/span&gt;. The symmetric wave function for &lt;span class=&quot;math-container&quot;&gt;$H_N$&lt;/span&gt; corresponds as a second quantised version (Page 6):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ u_{n_1,n_2,\dots n_N} \equiv \frac{1}{\sqrt{N!}} \sum_{\text{permutations of $r_1,\dots,r_N$}}u_{n_1} (\vec r_1) \dots u_{n_N} (\vec r_N) \leftrightarrow (a_1^\dagger)^{n_1} (a_2^\dagger)^{n_2} \dots (a_N^\dagger)^{n_N} |0 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, in QM one can derive the &lt;a href=&quot;https://www.youtube.com/watch?v=2jfoaZpS2io&amp;amp;t=922s&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lieb-Robinson bound&lt;/a&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ || [ O_A(t), O_B(0) ] || &amp;lt; C e^{- \frac{L-vt}{\eta}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$|| A ||$&lt;/span&gt; is the norm of the operator, &lt;span class=&quot;math-container&quot;&gt;$ O_A(t) = e^{ i H t} O e^{- i H t} $&lt;/span&gt; where the operators &lt;span class=&quot;math-container&quot;&gt;$O_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$O_B$&lt;/span&gt; act non-trivially on the subsystems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and identity outside it.&lt;/p&gt;&#xA;&lt;h2&gt;Question&lt;/h2&gt;&#xA;&lt;p&gt;Since the mathematical machinery is only different (QFT vs QM) and the physical system is the same. How does one derive the Lieb-Robinson (or equivalent) bound in the Second Quantized Theory?&lt;/p&gt;&#xA;" OwnerUserId="5045" LastActivityDate="2021-01-22T12:47:58.713" Title="Lieb-Robinson Bound in 2nd quantized description?" Tags="&lt;many-body-systems&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15637" PostTypeId="2" ParentId="15633" CreationDate="2021-01-22T12:35:18.380" Score="3" Body="&lt;p&gt;There is a lot of proposition how to use quantum computers in finance, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9576/quantum-computing-in-finance-list-of-articles&quot;&gt;see this question&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Your are right that you can simulate Hamiltonians on a quantum computer easier than on classical computer. However, in some cases it is difficult to construct respective quantum circuit. On the other hand, circuits for so-called Ising Hamiltonians used for solution of quadratic binary problems can be easily prepared. See for example this article: &lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising formulations of many NP problems&lt;/a&gt;. As you can see in the article, for example Travelling salesman problem can be described by Ising Hamiltonian. Since many task from economics and finance can be converted to TSP (e.g. currency arbitrage or production schedulling), you can see possibilities of Ising Hamiltonians simulation on QC for business applications.&lt;/p&gt;&#xA;&lt;p&gt;Generally speaking, if you are able to prepare a quantum circuit for a Hamitonian describing some economic problem efficiently, you receive an advantage in the simulation performance in comparison with classical computers.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Just one note, Hilbert space is not quantum concept, but rather mathematical one as Hilbert spaces are used also outside quantum mechanics.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-22T12:35:18.380" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15638" PostTypeId="2" ParentId="15636" CreationDate="2021-01-22T12:47:58.713" Score="4" Body="&lt;p&gt;In the Lieb-Robinson bound, the velocity depends on the strength (operator norm) of the interaction. This is intuitive: Twice as strong couplings will propagate information twice as fast (effectively, you can think of this as renormalizing time).&lt;/p&gt;&#xA;&lt;p&gt;Here comes the catch with bosonic systems: For bosons, the norm of interactions is unbounded (e.g. &lt;span class=&quot;math-container&quot;&gt;$a^\dagger a$&lt;/span&gt; can take any value &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;).  Thus, the proof of Lieb-Robinson bounds cannot be transferred to bosonic systems.&lt;/p&gt;&#xA;&lt;p&gt;This allows to for instance construct bosonic systems&#xA;where information can travel at arbitrary speed, if you just put enough energy into the system: &lt;a href=&quot;https://arxiv.org/abs/0808.3581&quot; rel=&quot;nofollow noreferrer&quot;&gt;Supersonic quantum communication&lt;/a&gt;. What this result tells you is that Lieb-Robinson bounds for bosonic systems will only make sense in a setup where the energy is bounded (which is indeed generally necessary to get well-behaved physics with bosons, and also physically reasonable).&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, one can prove Lieb-Robinson type bounds in certain scenarios, namely when it is about the propagation of the bosons themselves into an initially unoccupied region, rather about the propagation of information in a general bosonic system:  &lt;a href=&quot;https://arxiv.org/abs/1010.4576&quot; rel=&quot;nofollow noreferrer&quot;&gt;Information propagation for interacting particle systems&lt;/a&gt; (disclaimer: I'm an author).&lt;/p&gt;&#xA;&lt;p&gt;To the best of my knowledge, the general question -- whether information in a bosonic system in a general state can only travel at a finite speed, as long as the energy is suitable bounded -- is still an open question.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; Since the question got cross-posted to physics, I also cross-posted the answer.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-01-22T12:47:58.713" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15639" PostTypeId="1" CreationDate="2021-01-20T06:20:09.463" Score="0" ViewCount="57" Body="&lt;p&gt;Suppose there're two systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, if we're in a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\in\mathbb{H}_a\otimes\mathbb{H}_b$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$\hat A$&lt;/span&gt; be an operator acts on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{H}_a$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sum_{i,j}\psi_{i,j}|a_i\rangle|b_j\rangle$&lt;/span&gt;. Then, the expectation value of A with respect to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be calculated as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A\rangle_{\psi}= Tr_{\mathbb{H}_a\otimes\mathbb{H}_b}(A|\psi\rangle\langle\psi|)=\sum_{i,j}\langle a_i|\langle b_j|A\otimes\mathbb{1}_B|\psi\rangle\langle\psi|a_i\rangle|b_j\rangle=...&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm very confused how those two equalities coming from? Especially for the term &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; in the sum, can I understand their function as generating a &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; matrix with different constants &lt;span class=&quot;math-container&quot;&gt;$\psi_{i,j}$&lt;/span&gt;? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" OwnerDisplayName="Zhengrong" LastEditorUserId="2293" LastEditDate="2021-01-25T23:53:28.960" LastActivityDate="2021-01-25T23:53:28.960" Title="How does the term $|\psi\rangle\langle\psi|$ come from while calculating the expectation value?" Tags="&lt;trace&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2021-01-23T07:28:55.467" ContentLicense="CC BY-SA 4.0" />
  <row Id="15640" PostTypeId="2" ParentId="15639" CreationDate="2021-01-20T06:31:00.793" Score="2" Body="&lt;p&gt;I’m not sure I understand your question:&lt;/p&gt;&#xA;&lt;p&gt;That is the definition of the expectation value of an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; using the trace&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle A \rangle = Tr (\rho A)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the density matrix is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \mid \psi \rangle \langle \psi \mid $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.m.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;density matrix&lt;/a&gt; is ubiquitous in quantum mechanics.&lt;/p&gt;&#xA;" OwnerUserId="14686" OwnerDisplayName="Dr jh" LastActivityDate="2021-01-20T06:31:00.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15641" PostTypeId="2" ParentId="15619" CreationDate="2021-01-22T16:32:02.950" Score="6" Body="&lt;p&gt;Boson sampling &lt;em&gt;samples&lt;/em&gt; from a distribution, but does not compute the full distribution.  While computing the distribution is linked to computing permanents,  which is #P-hard, we would expect that sampling from such a distribution is considerably less powerful. Even if such sampling a number &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; of times would allow us to estimate the permanent of a specific matrix - which it doesn't here - such as estimate would only be accurate to a relative error of &lt;span class=&quot;math-container&quot;&gt;$1/\mathrm{poly(N)}$&lt;/span&gt;, which is much weaker than #P (in fact, such approximations of #P-problems lie inside BPP^NP).&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2021-01-22T16:38:27.610" LastActivityDate="2021-01-22T16:38:27.610" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15642" PostTypeId="2" ParentId="15621" CreationDate="2021-01-22T16:39:44.937" Score="4" Body="&lt;p&gt;Entanglement + a classical channels allows you to build a quantum channel using teleportation. Thus, adding a quantum channel does not give you additional power.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-01-22T16:39:44.937" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15643" PostTypeId="1" CreationDate="2021-01-22T19:06:33.330" Score="2" ViewCount="41" Body="&lt;p&gt;Is it possible to modify a pulse schedule of a circuit compiled using QASM? I know this is possible using OpenPulse, but it seems none of the IBM backends support OpenPulse. So is it possible to do this through QASM? &lt;a href=&quot;https://arxiv.org/abs/1809.03452&quot; rel=&quot;nofollow noreferrer&quot;&gt;This paper&lt;/a&gt; gives me the impression that I would only be able to modify the QASM command order, but not the actual pulse schedule. Is this correct?&lt;/p&gt;&#xA;" OwnerUserId="14536" LastEditorUserId="362" LastEditDate="2021-01-22T21:23:24.300" LastActivityDate="2021-01-22T21:23:24.300" Title="Is it possible to modify pulse schedules in QASM?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;&lt;qasm&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15644" PostTypeId="2" ParentId="15643" CreationDate="2021-01-22T21:21:49.443" Score="2" Body="&lt;p&gt;If you mean at the circuit schedule level, then yes the transpiler supports scheduling a circuit and resolving all timing by inserting appropriate delays on all qubits according to the selected scheduling policy.  See the transpiler option &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.compiler.transpile.html#qiskit-compiler-transpile&quot; rel=&quot;nofollow noreferrer&quot;&gt;scheduling_method here&lt;/a&gt;. As KAJ226 notes, for more explicit control you may use the pulse level &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.pulse.Schedule.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schedule&lt;/a&gt; representation which may be obtained as shown in this &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/10_pulse_scheduler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt;. However, only ibmq_armonk currently supports public pulse access.&lt;/p&gt;&#xA;" OwnerUserId="9863" LastActivityDate="2021-01-22T21:21:49.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15646" PostTypeId="1" CreationDate="2021-01-22T23:20:53.447" Score="2" ViewCount="33" Body="&lt;p&gt;I see sideband pulses used all over the place when looking up implementation techniques especially in Trapped Ion QC. Is there a layman's explanation of what they actually are? I understand what they do in terms of Energy Transitions, and how that is then used for gates; but I am struggling with understanding how these pulses can be tweaked to do nearly everything (In the case of the Cirac-Zoller Gate for instance).&lt;/p&gt;&#xA;&lt;p&gt;My reference text has been Nielsen and Chuang, where they introduce sideband pulses in chapter 7.6; just for some context on where I am. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="55" LastEditDate="2021-01-24T15:42:23.390" LastActivityDate="2021-01-24T15:42:23.390" Title="What are Sideband Pulses" Tags="&lt;physical-realization&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15647" PostTypeId="1" CreationDate="2021-01-23T00:35:08.757" Score="4" ViewCount="42" Body="&lt;p&gt;I'm trying to estimate the fidelity of some family of unitaries &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; implemented on a noisy quantum computer. To do so, I start from an uninitialized state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and run the circuit &lt;span class=&quot;math-container&quot;&gt;$U(\theta)^\dagger U(\theta)$&lt;/span&gt;, and then measure the probability of returning to the all-zeros bitstring as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_\theta (0) = |\langle 0| \mathcal{E}_{U(\theta)^\dagger} \mathcal{E}_{U(\theta)} |0 \rangle |^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_U$&lt;/span&gt; is the (noisy) process that results from trying to run &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$P(0) \neq 1$&lt;/span&gt; then I have some idea that my operation ran with lower fidelity. But I would like to know more about how well this kind of reasoning generalizes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How well does &lt;span class=&quot;math-container&quot;&gt;$P_\theta(0)$&lt;/span&gt; track the fidelity of this process, &lt;span class=&quot;math-container&quot;&gt;$F(\mathcal{E}_{U(\theta)} , U(\theta))$&lt;/span&gt;, if at all?&lt;/li&gt;&#xA;&lt;li&gt;Can I expect any kind of relationship between &lt;span class=&quot;math-container&quot;&gt;$P_\theta(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_\theta(\psi) \equiv |\langle \psi| \mathcal{E}_{U(\theta)^\dagger} \mathcal{E}_{U(\theta)} |\psi \rangle |^2$&lt;/span&gt;, i.e. the same experiment repeated for a different input state?&lt;/li&gt;&#xA;&lt;li&gt;Can I expect any kind of relationship between &lt;span class=&quot;math-container&quot;&gt;$P_\theta(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_\phi (0)\equiv |\langle 0| \mathcal{E}_{U(\phi)^\dagger} \mathcal{E}_{U(\phi)} |0 \rangle |^2$&lt;/span&gt; i.e. the same experiment repeated on a &lt;em&gt;similar&lt;/em&gt; unitary &lt;span class=&quot;math-container&quot;&gt;$U(\phi)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I can think of specific counterexamples that show that some of these relationships fail to hold but ideally there would be a way to assess the likelihood of this being a good (or bad!) metric.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2021-01-23T00:46:40.333" LastActivityDate="2021-01-23T05:34:53.320" Title="Is un-computing $U$ a good proxy for circuit fidelity?" Tags="&lt;quantum-operation&gt;&lt;noise&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15648" PostTypeId="2" ParentId="15647" CreationDate="2021-01-23T05:34:53.320" Score="3" Body="&lt;p&gt;Here are my thoughts.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I would think the final probability gives the histogram that can help calculate the average fidelity of the circuit. The machine itself does not recognize that it is implementing an identity operator, therefore whatever you get after running the circuit can be used to track the fidelity. (I hope I understand your question correctly.) If you are using some circuit optimizer that can reduce the circuit into identity before running, in the end of course you would get nothing useful to get the fidelity since you will always get 100% fidelity.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$P_\theta(\psi) = |\langle \psi| \varepsilon_{U(\theta)^\dagger}\varepsilon_{U(\theta)}|\psi\rangle|^2 =|\langle 0| \varepsilon_{U(\phi)^\dagger}\varepsilon_{U(\theta)^\dagger}\varepsilon_{U(\theta)}\varepsilon_{U(\phi)}|0\rangle|^2$&lt;/span&gt;, I believe it has the similar behavior as  having &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as input.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Generally the longer circuit you run, the lower fidelity you get. So I would expect they have the similar behavior but without the same fidelity, since the actual implementation of the unitary would have different depth of the circuit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I'd like to know what are the counterexamples that you mentioned.&lt;/p&gt;&#xA;" OwnerUserId="14542" LastActivityDate="2021-01-23T05:34:53.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15649" PostTypeId="1" AcceptedAnswerId="15662" CreationDate="2021-01-23T11:31:52.303" Score="2" ViewCount="65" Body="&lt;p&gt;I am creating a 2 qubit entangled state:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    def density_matrix_chsh(i, j, qs):&#xA;        circuit = chsh_circuit(i, j, qs)&#xA;        return cirq.final_density_matrix(circuit, qubit_order=qs)&#xA;&#xA;&#xA;    def chsh_circuit(i, j, qs):&#xA;        return cirq.Circuit(cirq.H(qs[i]), cirq.CNOT(qs[i], qs[j]))&#xA;&#xA;&#xA;    qs = [a, b]&#xA;&#xA;    state = density_matrix_chsh(0, 1, qs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then I am applying rotation for maximum violation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;th = np.pi/(-2)&#xA;th1 = np.pi/(4)&#xA;th2 = 0 &#xA;random_angles = []&#xA;newlist = []&#xA;b_big = cirq.kron(cirq.unitary(cirq.ry(th)),cirq.unitary(cirq.ry(th)))&#xA;results = []&#xA;for choosen in itertools.product([th2, th1], repeat=2): &#xA;        random_angles.append(choosen)&#xA;for i in range (1000):&#xA;    choosen_combination = random.choice(random_angles)&#xA;    a_big = cirq.kron(cirq.unitary(cirq.rz(choosen_combination[0])),cirq.unitary(cirq.rz(choosen_combination[1])))    &#xA;    rotated_state = b_big @ a_big @ state @ b_big.conj().T&#xA;    measurement_rotated = cirq.measure_density_matrix(rotated_state,indices=[0, 1])&#xA;    print(&amp;quot;measuring qubits &amp;quot;,measurement_rotated)&#xA;    qubit_result = measurement_rotated[0]&#xA;    results.append(qubit_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For instance here I tried 1000 times and both qubits are either 0 or 1 at the sma time but I could never see one of them 1 and the other one is 0 after measurement. Probably I am doing something wrong and I can't see&#xA;Thanks for helps&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2021-01-24T15:42:52.300" LastActivityDate="2021-01-24T15:42:52.300" Title="Cirq: Result of rotating qubit measurements never come [0 1] or [1 0 ], always come as [0,0] or [1,1]" Tags="&lt;programming&gt;&lt;measurement&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15650" PostTypeId="1" AcceptedAnswerId="15652" CreationDate="2021-01-23T15:59:27.110" Score="4" ViewCount="73" Body="&lt;p&gt;I'm implementing a quantum support vector machine on qiskit and I was wondering what the quantum part of the algorithm actually does. I'm aware that it's a feature map that executes the kernel function but what is the significance of using quantum computers for that if the kernel trick is already effective classically? And how does the quantum feature map work?&lt;/p&gt;&#xA;" OwnerUserId="13449" LastActivityDate="2021-01-27T12:44:59.173" Title="What does the quantum part of the quantum support vector machine actually do?" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15651" PostTypeId="1" AcceptedAnswerId="15993" CreationDate="2021-01-23T18:49:06.300" Score="5" ViewCount="132" Body="&lt;p&gt;I would like to read the unitary matrix of a quantum circuit in ProjectQ.&#xA;Is there any way to do it?&lt;/p&gt;&#xA;" OwnerUserId="14089" LastEditorUserId="10480" LastEditDate="2021-01-31T20:26:16.960" LastActivityDate="2021-02-11T15:57:29.997" Title="How to read the unitary matrix of a quantum circuit in ProjectQ?" Tags="&lt;programming&gt;&lt;projectq&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15652" PostTypeId="2" ParentId="15650" CreationDate="2021-01-23T19:25:46.870" Score="4" Body="&lt;p&gt;The basic idea of how the quantum feature map works is that you're using a quantum computer to map each input datapoint &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from your training domain &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; into a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\phi(x)\rangle = U(x)|0\rangle$&lt;/span&gt; in the (presumably) high dimensional quantum state space, and then evaluating a set of kernel functions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;k_Q(x_i, x_j) = |\langle 0|U(x_j)^\dagger U(x_i)|0\rangle|^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all pairs &lt;span class=&quot;math-container&quot;&gt;$x_i,x_j \in \mathcal{X}$&lt;/span&gt;. The Support Vector Machine (SVM) that classifies &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; can then be treated as a black box that takes in the kernel matrix &lt;span class=&quot;math-container&quot;&gt;$K_{ij} = k_Q(x_i, x_j)$&lt;/span&gt; and returns a model &lt;span class=&quot;math-container&quot;&gt;$f_Q: \mathcal{X} \rightarrow \{0,1\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;kernel trick&amp;quot; is the substitution that allows us to use the SVM (ordinarily a linear classifier on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt;) to classify the data using &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; to achieve non-linear decision boundaries. But regardless of whether &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is generated by a classical or a quantum computer, this doesn't guarantee an effective classifier. An example of a kernel that can be shown to fail is the quadratic polynomial kernel&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;k_C(x_i, x_j) = (\langle x_i, x_j \rangle + b)^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which will be generally incapable of classifying data that is labelled by a function of degree 3 or higher. So if you can find a quantum kernel &lt;span class=&quot;math-container&quot;&gt;$k_Q$&lt;/span&gt; that results in a kernelized SVM that successfully classifies data labeled by those functions for which &lt;span class=&quot;math-container&quot;&gt;$k_C$&lt;/span&gt; fails, you've found at least some evidence to support the use of your quantum feature map.&lt;/p&gt;&#xA;&lt;p&gt;More generally, the motivation to use quantum feature maps is that they &lt;em&gt;might&lt;/em&gt; be more  expressive than some classical counterparts. For instance (&lt;a href=&quot;https://arxiv.org/abs/2008.08605&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schuld, 2020&lt;/a&gt;) uses Fourier analysis to connect the spectrum of a classifier &lt;span class=&quot;math-container&quot;&gt;$f_Q$&lt;/span&gt; to the number of local rotations in the circuit &lt;span class=&quot;math-container&quot;&gt;$U(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But justifying the use of quantum kernels also requires finding a feature map that is inefficient to compute classically, otherwise you would just simulate the unitaries &lt;span class=&quot;math-container&quot;&gt;$U(x) \forall x$&lt;/span&gt; to evaluate your kernels&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt;. Some recent work (&lt;a href=&quot;https://arxiv.org/abs/2011.01938&quot; rel=&quot;nofollow noreferrer&quot;&gt;Huang, 2020&lt;/a&gt;) takes steps towards evaluating the power of quantum kernels compared to some classical counterparts but overall this is still a very open question.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; keep in mind that if you can simulate &lt;span class=&quot;math-container&quot;&gt;$U(x)$&lt;/span&gt; efficiently then you can do &amp;quot;one-shot&amp;quot; evaluation of the kernel matrix so that the number of circuit simulations is only  &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; instead of the &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; needed to evaluate &lt;span class=&quot;math-container&quot;&gt;$k_Q(x, x')$&lt;/span&gt; on hardware. This raises the bar for demonstrating speedup using this kind of quantum SVM.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-01-23T19:25:46.870" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15653" PostTypeId="1" CreationDate="2021-01-23T20:10:13.327" Score="4" ViewCount="53" Body="&lt;p&gt;I'm interested in getting an overview of the leading approaches to quantum computing from a physics perspective. I've read most of Nielsen and Chuang, but its chapter on physical realizations looks extremely out of date.&lt;/p&gt;&#xA;&lt;p&gt;Is there a resource at a similar level that covers the approaches used by, e.g. Google, Microsoft, Pan's group, and IBM? I've seen a lot of qualitative material, but it's usually aimed at computer science people and thus physics-free. I'm looking for something at the level of &amp;quot;here's the Hamiltonian describing a single qubit, here's the interaction Hamiltonian describing a gate, here's how readout is done&amp;quot;, and so on.&lt;/p&gt;&#xA;" OwnerUserId="187" LastActivityDate="2021-01-27T12:41:46.327" Title="Up to date overview of experimental approaches to quantum computing" Tags="&lt;resource-request&gt;&lt;physical-realization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15654" PostTypeId="2" ParentId="15653" CreationDate="2021-01-23T20:57:43.190" Score="4" Body="&lt;p&gt;If you are interesting in superconducting qubit architecture then these might be helpful:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1905.13641.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superconducting Qubits:Current State of Play&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1904.06560.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Engineer’s Guide to Superconducting Qubits&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The other things you can do is probably follow people in the field that working on these technologies and read their publications. For example, you can follow &lt;a href=&quot;https://web.physics.ucsb.edu/%7Emartinisgroup/index.shtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;John Martinis's group&lt;/a&gt; and go over their publications, presentations, etc. The other things that might be very helpful is to go through his students &lt;a href=&quot;https://web.physics.ucsb.edu/%7Emartinisgroup/theses.shtml&quot; rel=&quot;nofollow noreferrer&quot;&gt;PhD dissertations&lt;/a&gt; which is where you probably find the most details work.&lt;/p&gt;&#xA;&lt;p&gt;For trapped-ion system, you can follow &lt;a href=&quot;http://iontrap.umd.edu/publications/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Chris Monroe's group&lt;/a&gt;. Again, he put up all of his &lt;a href=&quot;http://iontrap.umd.edu/publications/theses/&quot; rel=&quot;nofollow noreferrer&quot;&gt;past student's dissertations&lt;/a&gt; on his website so you can go through them as well.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-23T20:57:43.190" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15655" PostTypeId="2" ParentId="6201" CreationDate="2021-01-23T22:23:18.197" Score="2" Body="&lt;p&gt;Let me plug my pet project: &lt;a href=&quot;https://attilakun.net/bloch&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://attilakun.net/bloch&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It allows you to enter arbitrary 2x2 matrices and visualize how the quantum state is affected by them.&lt;/p&gt;&#xA;&lt;p&gt;In the below example the red arc shows how the H matrix transforms the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state (yellow arrow) into &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/e3kzh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/e3kzh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, it's open source if you want to play around with the code: &lt;a href=&quot;https://github.com/attila-kun/bloch&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/attila-kun/bloch&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12643" LastActivityDate="2021-01-23T22:23:18.197" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15656" PostTypeId="1" AcceptedAnswerId="15658" CreationDate="2021-01-23T23:45:06.900" Score="8" ViewCount="394" Body="&lt;p&gt;I'm reading 'Why the partial trace' section on page 107 in Nielsen and Chuang textbook. Here's part of their explanations that I don't quite understand:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Physical consistency requires that any prescription for associating a ‘state’, &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt;, to system A, must have the property that measurement averages be the same whether computed via &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; : &lt;span class=&quot;math-container&quot;&gt;$\text{tr}(Mf(\rho^{AB}))=\text{tr}((M\otimes I_B)\rho^{AB})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is any observable on system A. I'm wondering what 'physical consistency' and 'measurement average' are?&lt;/p&gt;&#xA;&lt;p&gt;It is also argued that &lt;span class=&quot;math-container&quot;&gt;$f(\rho^{AB})=\rho^A=\text{tr}_B(\rho^{AB})$&lt;/span&gt; is a uniquely determined map. I'm also confused about this point. Could someone give me some more explanations? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-04-08T15:13:29.230" LastActivityDate="2021-04-08T15:13:29.230" Title="What's the 'physical consistency' in the partial trace scenario?" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15657" PostTypeId="2" ParentId="15656" CreationDate="2021-01-24T00:46:51.230" Score="5" Body="&lt;p&gt;The point of physical consistency is about how we can define the operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as acting on system &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt;, or we can define the operator &lt;span class=&quot;math-container&quot;&gt;$M \otimes \mathbb{1}_B$&lt;/span&gt; as acting on the system &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt;, and both must 'do the same thing', as it relates to expected value and uncertainty, I believe this is what 'measurement average' is referring to.&lt;/p&gt;&#xA;&lt;p&gt;So since we know that what the expectation value of &lt;span class=&quot;math-container&quot;&gt;$M \otimes \mathbb{1}_B$&lt;/span&gt; must be acting on the composite systems density matrix, we know that it must be the same as &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; acting on the subsystems density matrix. In other words:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}\left((M \otimes \mathbb{1}_B)(\rho^{AB})\right)=\text{Tr}(M \rho^A)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we want to find some operation &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, which can take &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB} \rightarrow \rho^A$&lt;/span&gt;, such that the above trace condition remains true. Notice at this point we have no idea what &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; actually is, we just know it has to obey that trace condition so that observations are consistent between measuring one subsystem vs measuring the whole system but not actually doing anything to the second subsystem (this is the action of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{1}_B$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;We can try to derive this operation, and it is a good exercise to do so (hint: write out the trace in terms of sums over diagonals), or we can simply show that the partial trace does this for us:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{Tr}_B(\rho^{AB}) &amp;amp;=&#xA;\text{Tr}_B \left( \sum_{i,j, k, l}\rho_{i,j, k, l}^{AB} |a_i \rangle |b_j \rangle \langle b_k | \langle a_l | \right)\\&#xA;&amp;amp;= \sum_r \left\langle b_r \left| \left( \sum_{i,j, k, l}\rho_{i,j, k, l}^{AB} |a_i \rangle |b_j \rangle \langle b_k | \langle a_l | \right) \right| b_r \right\rangle\\&#xA;&amp;amp;=\sum_{i,j, k, l, r} \rho_{i,j, k, l}^{AB} \delta_{r, k} \delta_{r, j} |a_i \rangle \langle a_l |\\&#xA;&amp;amp;=\sum_{i,l,r} \rho_{i,r, r, l}^{AB} |a_i \rangle \langle a_l |\\&#xA;&amp;amp;=\rho^A&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we can easily show that for an operator &lt;span class=&quot;math-container&quot;&gt;$M = \sum_{i,j}m_{i,j} | a_i \rangle \langle a_l |$&lt;/span&gt;  acting on Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}^A$&lt;/span&gt;; the expectation values consistency shown in the trace condition holds. So the partial trace accurately does what we wish for it to do.&lt;/p&gt;&#xA;&lt;p&gt;As for the uniqueness, the proof is a bit more involved, but the variant I have seen involves the fact that the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}^{AB}$&lt;/span&gt; is spanned by the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}^{A} \otimes \mathcal{H}^{B}$&lt;/span&gt;, and you can use linearity of the outer product space to show a bijection between a set of subsystem density matrices and their composite system density matrix. The uniqueness however never comes up in practice since you just do the partial trace to find the subsystem.&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="55" LastEditDate="2021-01-25T14:15:43.280" LastActivityDate="2021-01-25T14:15:43.280" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15658" PostTypeId="2" ParentId="15656" CreationDate="2021-01-24T01:06:33.150" Score="9" Body="&lt;h2&gt;Measurement average&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;Measurement average&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle M \rangle_\rho$&lt;/span&gt; of observable (a Hermitian operator) &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; on the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is the average of measurement outcomes &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; in the limit of infinite number of measurements. It is straightforward to show that &lt;span class=&quot;math-container&quot;&gt;$\langle M \rangle_\rho = \mathrm{tr}(M\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Physical consistency&lt;/h2&gt;&#xA;&lt;p&gt;Suppose we have a theory which provides more than one mathematical procedure for predicting the outcome of an observation. &lt;em&gt;Physical consistency&lt;/em&gt; in this context is the constraint that all these procedures agree with experiment. Consequently, all the procedures must make the same prediction.&lt;/p&gt;&#xA;&lt;p&gt;Note that physical consistency requires more than merely equality of measurement averages computed in two different ways. Measurement outcome distributions computed according to each procedure must be the same and agree with observations. However, for the purposes of justifying the partial trace we only need the agreement of measurement averages.&lt;/p&gt;&#xA;&lt;h2&gt;Uniqueness of partial trace&lt;/h2&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H})$&lt;/span&gt; denote the real vector space of Hermitian operators on the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$f: L_H(\mathcal{H}_{AB}) \to L_H(\mathcal{H}_A)$&lt;/span&gt; map the state of the composite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; to the corresponding state of the subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. In other words, if &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is in state &lt;span class=&quot;math-container&quot;&gt;$\rho_A = f(\rho_{AB})$&lt;/span&gt;. We will show that &lt;span class=&quot;math-container&quot;&gt;$f = \mathrm{tr}_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We begin with the observation that quantum mechanics provides two procedures for predicting the average of measurement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; on the subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; of a composite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;. We can measure &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; or we can measure &lt;span class=&quot;math-container&quot;&gt;$\tilde M = M \otimes I$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. Physical consistency requires that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}(M\rho_A) = \mathrm{tr}(\tilde M \rho_{AB})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which after substitutions becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}(Mf(\rho_{AB})) = \mathrm{tr}((M\otimes I) \rho_{AB}).\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$f(\rho_{AB}) \in L_H(\mathcal{H}_A)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H}_A)$&lt;/span&gt; is a vector space. This space is equipped with &lt;a href=&quot;https://en.wikipedia.org/wiki/Hilbert%E2%80%93Schmidt_operator#Space_of_Hilbert%E2%80%93Schmidt_operators&quot; rel=&quot;noreferrer&quot;&gt;Hilbert-Schmidt inner product&lt;/a&gt; defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A, B\rangle = \mathrm{tr}(A^\dagger B) = \mathrm{tr}(AB).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The significance of the inner product in this context is that it provides the means of computing the coefficients in the expansion of &lt;span class=&quot;math-container&quot;&gt;$f(\rho_{AB})$&lt;/span&gt; in an orthonormal basis. So let &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; denote some orthonormal basis of &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H}_A)$&lt;/span&gt;. Then we can write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;f(\rho_{AB}) &amp;amp;= \sum_i M_i \,\langle M_i, f(\rho_{AB}) \rangle \\&#xA;&amp;amp;= \sum_i M_i \,\mathrm{tr}(M_i f(\rho_{AB})) \\&#xA;&amp;amp;= \sum_i M_i \,\mathrm{tr}((M_i\otimes I) \rho_{AB})&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where in the last equality we used &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. The last equation determines &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; uniquely. It is straightforward to check that the partial trace &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B$&lt;/span&gt; satisfies the last equation. We conclude that &lt;span class=&quot;math-container&quot;&gt;$f = \mathrm{tr}_B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-24T01:44:56.080" LastActivityDate="2021-01-24T01:44:56.080" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15659" PostTypeId="2" ParentId="15251" CreationDate="2021-01-24T03:02:38.130" Score="0" Body="&lt;p&gt;Joseph's answer explains a lot of this already but I just want to give a much simpler answer in case others have the same question:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Why is there two H over here? I thought it would be just H * Cnot?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;To put the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix into the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; basis, simply calculate &lt;span class=&quot;math-container&quot;&gt;$H^{-1}XH$&lt;/span&gt; &lt;a href=&quot;https://math.stackexchange.com/a/2605706/202425&quot;&gt;as you can see here&lt;/a&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$H^{-1} = H$&lt;/span&gt;, the expression is as given in the answer you found in that book :)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Where from do we get these representations?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In the basis containing &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, each of the 4 elements of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix will be given by &lt;span class=&quot;math-container&quot;&gt;$\langle 0| X |0\rangle$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$\langle 0| X |1\rangle$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$\langle 1| X |0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle 1| X |1\rangle$&lt;/span&gt; int he exact positions shown in the screenshot you gave us. If you do the matrix multiplication of a row vector, times a matrix, times a column vector (from left-to-right), combined with knowledge of how &amp;quot;Dirac notation works&amp;quot;, you'll see why this is the case :).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-01-24T03:02:38.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15660" PostTypeId="2" ParentId="11908" CreationDate="2021-01-24T03:23:21.833" Score="2" Body="&lt;p&gt;By a large margin, I would recommend VQLS rather than H-HHL. VQLS is significantly more well-tested, is a more significant leap from the previous state-of-the-art for hybrid quantum/classical linear solvers, and is far more in the &lt;a href=&quot;https://quantumcomputing.meta.stackexchange.com/q/280/2293&quot;&gt;&amp;quot;mainstream&amp;quot;&lt;/a&gt; realm of quantum computing, meaning that your study will be more relevant in today's quantum computing research climate if you implement VQLS instead of H-HHL.&lt;/p&gt;&#xA;&lt;p&gt;You could also try both and compare the two!&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-01-24T03:23:21.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15661" PostTypeId="1" CreationDate="2021-01-24T04:38:47.760" Score="3" ViewCount="96" Body="&lt;p&gt;Has anyone tried any quantum computing programming code that shows or demonstrates the advantage of a quantum computer over classical computers? Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="14551" LastEditorUserId="14551" LastEditDate="2021-01-24T07:19:41.070" LastActivityDate="2021-01-25T17:01:13.697" Title="Question on practical quantum computing programming code" Tags="&lt;programming&gt;&lt;classical-computing&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ClosedDate="2021-01-27T13:55:26.760" ContentLicense="CC BY-SA 4.0" />
  <row Id="15662" PostTypeId="2" ParentId="15649" CreationDate="2021-01-24T07:04:57.383" Score="3" Body="&lt;p&gt;As Craig said, you applied b_big and a_big differently. The adjoint a_big is missing from your product. Try &lt;code&gt;rotated_state = b_big @ a_big @ state @ a_big.conj().T @ b_big.conj().T&lt;/code&gt;. But Craig's right. Using Circuits would be much simpler:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import itertools&#xA;import random&#xA;import cirq&#xA;import numpy as np&#xA;&#xA;def chsh_circuit(i, j, qs):&#xA;    return cirq.Circuit(cirq.H(qs[i]), cirq.CNOT(qs[i], qs[j]))&#xA;&#xA;qs = cirq.NamedQubit(&amp;quot;a&amp;quot;), cirq.NamedQubit(&amp;quot;b&amp;quot;)&#xA;&#xA;th = np.pi/(-2)&#xA;th1 = np.pi/(4)&#xA;th2 = 0&#xA;random_angles = []&#xA;newlist = []&#xA;b_big = cirq.Circuit(cirq.ry(th)(qs[0]), cirq.ry(th)(qs[1]))&#xA;results = []&#xA;for choosen in itertools.product([th2, th1], repeat=2):&#xA;        random_angles.append(choosen)&#xA;&#xA;print(random_angles)&#xA;for i in range (1000):&#xA;    choosen_combination = random.choice(random_angles)&#xA;    a_big = cirq.Circuit(cirq.rz(choosen_combination[0])(qs[0]),&#xA;                         cirq.rz(choosen_combination[1])(qs[1]))&#xA;    rotated_state = cirq.Circuit(chsh_circuit(0,1, qs), a_big, b_big, cirq.measure(*qs))&#xA;    res = cirq.Simulator().run(program=rotated_state, repetitions=1)&#xA;    print(&amp;quot;measuring qubits &amp;quot;,res.measurements)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4986" LastActivityDate="2021-01-24T07:04:57.383" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15663" PostTypeId="2" ParentId="15661" CreationDate="2021-01-24T07:28:33.570" Score="2" Body="&lt;p&gt;Any implementation of an algorithm showing theoretical advantage is the case you are looking for (e.g. Shor algorithm has exponential speed-up in comparison with classical algorithms). However, in NISQ era there is a problem with noise which can hinder a performance of the algorithm and in the end you are not able to show the advantage.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-24T07:28:33.570" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15664" PostTypeId="2" ParentId="15661" CreationDate="2021-01-24T09:05:09.557" Score="3" Body="&lt;p&gt;&lt;strong&gt;There are nothing &lt;em&gt;practical&lt;/em&gt; that current quantum computers can do that has &lt;em&gt;advantage&lt;/em&gt; over classical computers&lt;/strong&gt;. But these machines do provide potential speed-up over certain problems like factoring through Shor's algorithm. The biggest number being successful factored through Shor's algorithm is 21. This can be seen in this paper: &lt;a href=&quot;http://%20%20https://journals.aps.org/pra/pdf/10.1103/PhysRevA.100.012305&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Experimental study of Shor’s factoring algorithm using the IBM Q Experience&amp;quot;&lt;/a&gt;. They tried to factor 35 on that paper there but it wasn't successful. You might have seen larger numbers claimed to be factored by a quantum computer but these methods does not use shor's factoring algorithm, which means you don't have the exponential speed-up that you would get. For instance, factoring a number through the &lt;a href=&quot;https://arxiv.org/abs/1808.08927&quot; rel=&quot;nofollow noreferrer&quot;&gt;Variational Quantum Factoring&lt;/a&gt; algorithm would not give you the speed-up that you want... just because you use a quantum computer, it doesn't mean your computation will be faster. These large number claimed to be factored on a quantum computer sometime are chosen because they fit certain category... so it is easier and the result looks more cooler.&#xA;Craig Gidney did something pretty funny that you can read about it here: &lt;a href=&quot;https://algassert.com/post/2000&quot; rel=&quot;nofollow noreferrer&quot;&gt;Factoring the largest number ever with a quantum computer&lt;/a&gt;. :)&lt;/p&gt;&#xA;&lt;p&gt;Now, there is recent paper by Craig Gidney (serious this time) presented a hypothetical estimation of the time it would take to factor 2048-bit RSA integers using 20 millions qubits. You can read about it here: &lt;a href=&quot;https://arxiv.org/abs/1905.09749v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits&amp;quot;&lt;/a&gt;. This gives you an idea of the speed-up you would get if you have a quantum computer that meets those specifications.&lt;/p&gt;&#xA;&lt;p&gt;Again, &lt;strong&gt;there are nothing &lt;em&gt;practical&lt;/em&gt; that current quantum computers can do that has &lt;em&gt;advantage&lt;/em&gt; over classical computers.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If quantum chemistry is what you are interested in, then I would point you to this paper: &lt;a href=&quot;https://arxiv.org/pdf/2009.12472.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;How will quantum computers provide an industrially relevant computationaladvantage in quantum chemistry?&lt;/a&gt; (It might not presented the most fair comparison but it does show that we are still have quite a long way from achieving quantum advantage in this area as well given what we have currently...)&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-25T17:01:13.697" LastActivityDate="2021-01-25T17:01:13.697" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15665" PostTypeId="2" ParentId="9534" CreationDate="2021-01-24T09:17:10.090" Score="2" Body="&lt;p&gt;Well, it seems that the question is still unanswered. In general, there are different ways of encoding, but -- as I understand it -- you are asking for a unitary way of doing it.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we have a &lt;span class=&quot;math-container&quot;&gt;$[[n,k]]$&lt;/span&gt; stabiliser code &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; with generators &lt;span class=&quot;math-container&quot;&gt;$g_1,\dots,g_{n-k}$&lt;/span&gt;.&#xA;This code is Clifford-equivalent to the code &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Z}_k:=|0^{n-k}\rangle\otimes (\mathbb{C}^2)^{\otimes k}$&lt;/span&gt; stabilised by &lt;span class=&quot;math-container&quot;&gt;$Z_{1},\dots, Z_{n-k}$&lt;/span&gt;.&#xA;The encoding construction is given by a choice of Clifford unitary mapping &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Z}_k$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In general, this Clifford unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is not unique since we can redefine it by any Clifford &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; which acts trivially on &lt;span class=&quot;math-container&quot;&gt;$\mathsf{Z}_k$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; respectively).&#xA;However, any choice of stabiliser basis of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; induces a &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. This is simply because a choice of logical basis &lt;span class=&quot;math-container&quot;&gt;$|\bar x\rangle$&lt;/span&gt; corresponds to a maximal completion &lt;span class=&quot;math-container&quot;&gt;$g_1,\dots,g_{n-k},g_{n-k+1},\dots,g_n$&lt;/span&gt; of the generators and the logical basis is determined by the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$g_{n-k+1},\dots,g_n$&lt;/span&gt;. The Clifford unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is defined by the following equations:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; U Z_i U^\dagger = g_i, \qquad \forall i = 1,\dots,n.&#xA;$$&lt;/span&gt;&#xA;Since the Paulis on the left and right hand side are maximally commuting sets, this indeed defines a Clifford unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. It is straightforward to check that any input state is transformed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0^{n-k}\rangle\otimes |\psi\rangle = \sum_{x\in\mathbb F_2^{k}} \psi_x |0^{n-k}\rangle\otimes |x\rangle \stackrel{U}{\longmapsto} \sum_{x\in\mathbb F_2^{k}} \psi_x |0^{n-k}\rangle\otimes |\bar{x}\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Final remarks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The binary/symplectic description of the global Clifford unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is evident from the definition.&lt;/li&gt;&#xA;&lt;li&gt;This can be used to compile &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; into generators via standard methods.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2021-01-24T09:17:10.090" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15667" PostTypeId="1" AcceptedAnswerId="15671" CreationDate="2021-01-24T10:53:29.623" Score="2" ViewCount="62" Body="&lt;p&gt;Suppose I run the Qiskit's QAOA algorithm.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qaoa = QAOA(operator=qubit_operator, p=p, optimizer=optimizer)&#xA;result = qaoa.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There is a built-in method that gets me the most likely binary solution for this problem. &lt;code&gt;sample_most_likely(result['eigenstate'])&lt;/code&gt; But how do I get the whole probability distribution of binary solutions? Ultimately, I would like to calculate the expected value for my problem, not the value based solely on the most likely string.&lt;/p&gt;&#xA;" OwnerUserId="13457" LastEditorUserId="55" LastEditDate="2021-01-26T23:33:28.523" LastActivityDate="2021-01-26T23:33:28.523" Title="Qiskit: getting QAOA expectation" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15668" PostTypeId="1" AcceptedAnswerId="15694" CreationDate="2021-01-24T14:59:06.453" Score="3" ViewCount="108" Body="&lt;p&gt;Can someone provide me with an example about how to implement VQE with OpenFermion, for example, use the UCCSD ansatz to get the ground state energy of LiH. I have checked some code, but none of them is up to date (deprecated). Also, there is no demo code in the official document for VQE implementation.&lt;/p&gt;&#xA;&lt;p&gt;Also, can somebody show me how to calculate energy with 1-electron and 2-electron reduced density matrix with OpenFermion using the following formula (A14).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j26Xm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j26Xm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="10480" LastEditDate="2021-01-24T21:59:17.097" LastActivityDate="2021-01-26T20:53:29.563" Title="implement variational quantum eigensolver with openfermion" Tags="&lt;resource-request&gt;&lt;vqe&gt;&lt;openfermion&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15669" PostTypeId="1" CreationDate="2021-01-24T15:53:37.930" Score="3" ViewCount="65" Body="&lt;p&gt;The &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;chapter about solving linear systems&lt;/a&gt; in the qiskit textbook describes the last (6th) step of the HHL algorithm as follows&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Apply an observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; to calculate &lt;span class=&quot;math-container&quot;&gt;$F(x):=\langle x |M|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How is this observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; chosen? What are the considerations?&lt;/p&gt;&#xA;" OwnerUserId="12480" LastEditorUserId="10480" LastEditDate="2021-01-25T07:39:52.623" LastActivityDate="2021-01-25T07:39:52.623" Title="HHL and choice of observable for calculating the expectation value thereof" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15670" PostTypeId="2" ParentId="15622" CreationDate="2021-01-24T17:35:10.047" Score="1" Body="&lt;p&gt;Indeed a better strategy is to create an entangled state between A and D, then use teleportation to transfer any quantum state from A to D. Creating such a long range entanglement may require an &lt;em&gt;entanglement swapping&lt;/em&gt; protocol, involving intermediate nodes.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2021-01-24T17:35:10.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15671" PostTypeId="2" ParentId="15667" CreationDate="2021-01-24T17:46:26.830" Score="2" Body="&lt;p&gt;You should be able to use: &lt;code&gt;result['eigenstate']&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;That should spit out something like (if you are using 4 qubits):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'0001': 27,&#xA; '0010': 20,&#xA; '0011': 1821,&#xA; '0100': 25,&#xA; '0101': 591,&#xA; '0110': 46,&#xA; '0111': 5347,&#xA; '1001': 18,&#xA; '1010': 2,&#xA; '1011': 226,&#xA; '1101': 11,&#xA; '1111': 58}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-24T17:46:26.830" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15673" PostTypeId="1" AcceptedAnswerId="15677" CreationDate="2021-01-24T20:38:40.657" Score="3" ViewCount="100" Body="&lt;p&gt;I read in a book that (&lt;a href=&quot;https://hub.packtpub.com/quantum-expert-robert-sutor-explains-the-basics-of-quantum-computing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://hub.packtpub.com/quantum-expert-robert-sutor-explains-the-basics-of-quantum-computing/&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;160 qubits (quantum bits) could hold &lt;span class=&quot;math-container&quot;&gt;$2^{160} \approx1.46\times 10^{48}$&lt;/span&gt; bits while the qubits were involved in computation.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;How does this calculation come about?&lt;/p&gt;&#xA;&lt;p&gt;The context of the statement is that a caffine molecule would require &lt;span class=&quot;math-container&quot;&gt;$10^{48}$&lt;/span&gt; bits to be represented by a classical computer. However a quantum computer would require 160 qubits and is thus well suited for such representation.&lt;/p&gt;&#xA;&lt;p&gt;If I look at this question on Quora, a 512 bit computer (which I suppose are real) would give a largest 155 digit number (&lt;a href=&quot;https://www.quora.com/How-many-digits-are-in-a-512-bit-number&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.quora.com/How-many-digits-are-in-a-512-bit-number&lt;/a&gt;). Isn't that big enough to represent atoms, molecules etc.?&lt;/p&gt;&#xA;" OwnerUserId="14554" LastEditorUserId="14554" LastEditDate="2021-01-25T11:13:17.390" LastActivityDate="2021-01-26T00:45:47.613" Title="No. of bits in 160 qubits computer" Tags="&lt;quantum-state&gt;&lt;simulation&gt;&lt;classical-computing&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ClosedDate="2021-01-27T11:52:38.223" ContentLicense="CC BY-SA 4.0" />
  <row Id="15674" PostTypeId="2" ParentId="15669" CreationDate="2021-01-24T21:28:47.247" Score="2" Body="&lt;p&gt;The main limitation of the HHL algorithm is that the solution to the linear system &lt;span class=&quot;math-container&quot;&gt;$Ax = b$&lt;/span&gt; is obtained as a quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. Thus, we cannot determine the full vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; directly without running the algorithm an exponential number of times.&lt;/p&gt;&#xA;&lt;p&gt;However, we can estimate &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is any function of the solution which can be expressed as &lt;span class=&quot;math-container&quot;&gt;$f(x) = \langle x|M|x \rangle$&lt;/span&gt; for a Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; which we know how to measure. The HHL algorithm is useful in applications where we know how to cast the quantity of interest as such a function. Designing and implementing an observable &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; appropriate for a given application is one of the key tasks in using the algorithm.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example of what can be computed&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A fairly general example of a quantity we know how to efficiently estimate from &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is the overlap &lt;span class=&quot;math-container&quot;&gt;$f_\psi(x) = \langle x| \psi\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; with any quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; for which we know the preparation, e.g. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = U|0\rangle$&lt;/span&gt;. We can accomplish this using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard test&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We start with an auxiliary qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state and a quantum register &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$|0\dots0\rangle$&lt;/span&gt; state. Using controlled operations we apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; we put &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; into the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; using the HHL algorithm. These operations result in the entangled state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}(|0\rangle|\psi\rangle + |1\rangle|x\rangle).\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, in order to estimate the real part of &lt;span class=&quot;math-container&quot;&gt;$\langle x|\psi\rangle$&lt;/span&gt; we first apply Hadamard to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, obtaining&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}|0\rangle(|\psi\rangle + |x\rangle) + \frac{1}{2}|1\rangle(|\psi\rangle - |x\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and then we measure &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the computational basis. The output probabilities are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_0 = \langle\phi|0\rangle\langle 0|\phi\rangle = \frac{1}{4}(\langle\psi|\psi\rangle + \langle\psi|x\rangle + \langle x|\psi\rangle + \langle x|x\rangle) = \frac{1}{2} + \frac{\mathrm{Re} \, \langle x|\psi\rangle}{2} \\&#xA;p_1 = \langle\phi|1\rangle\langle 1|\phi\rangle = \frac{1}{4}(\langle\psi|\psi\rangle - \langle\psi|x\rangle - \langle x|\psi\rangle + \langle x|x\rangle) = \frac{1}{2} - \frac{\mathrm{Re} \, \langle x|\psi\rangle}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In order to estimate the imaginary part of &lt;span class=&quot;math-container&quot;&gt;$\langle x|\psi\rangle$&lt;/span&gt; we first apply the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate and then Hadamard to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, obtaining&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}|0\rangle(|\psi\rangle + i|x\rangle) + \frac{1}{2}|1\rangle(|\psi\rangle - i|x\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and then we measure &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in the computational basis. This time, the output probabilities are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_0 = \langle\phi|0\rangle\langle 0|\phi\rangle = \frac{1}{4}(\langle\psi|\psi\rangle + i\langle\psi|x\rangle - i\langle x|\psi\rangle + \langle x|x\rangle) = \frac{1}{2} + \frac{\mathrm{Im} \, \langle x|\psi\rangle}{2} \\&#xA;p_1 = \langle\phi|1\rangle\langle 1|\phi\rangle = \frac{1}{4}(\langle\psi|\psi\rangle - i\langle\psi|x\rangle + i\langle x|\psi\rangle + \langle x|x\rangle) = \frac{1}{2} - \frac{\mathrm{Im} \, \langle x|\psi\rangle}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A simple special case of the above is the efficient estimation of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;th component &lt;span class=&quot;math-container&quot;&gt;$x_k$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Another is the determination whether solutions &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_2$&lt;/span&gt; to two linear systems &lt;span class=&quot;math-container&quot;&gt;$A_1x_1=b_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_2x_2=b_2$&lt;/span&gt; are orthogonal.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-24T21:28:47.247" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15675" PostTypeId="2" ParentId="15328" CreationDate="2021-01-25T08:03:11.590" Score="1" Body="&lt;p&gt;HHL is solving the problem &lt;span class=&quot;math-container&quot;&gt;$x^\prime = A^{-1}\frac{b}{||b||}$&lt;/span&gt;, so your solution will always be normalised as &lt;span class=&quot;math-container&quot;&gt;$x^\prime=x/||b||$&lt;/span&gt;.&#xA;You always have access to this information because HHL is a probabilistic algorithm, and the probability of success is &lt;span class=&quot;math-container&quot;&gt;$||x^\prime||=||x||/||b||$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It can happen that your solution is normalised by other factors, but these will then depend on your algorithm and it should be possible to calculate them &lt;em&gt;a priori&lt;/em&gt;. E.g. in the rotation step, if you perform the operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\lambda\rangle|0\rangle\mapsto|\lambda\rangle(\sqrt{1-\frac{C^2}{\lambda^2}}|0\rangle+\frac{C}{\lambda}|1\rangle),&#xA;$$&lt;/span&gt;&#xA;then your solution will become &lt;span class=&quot;math-container&quot;&gt;$x^\prime=\frac{Cx}{||b||}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2021-01-25T08:03:11.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15676" PostTypeId="2" ParentId="14898" CreationDate="2021-01-25T10:45:11.817" Score="2" Body="&lt;p&gt;It is a typo as mentioned in the comments by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14898/in-nielsen-and-chuang-how-can-frac12e-1-result-from-frac12-int-e-1#comment20510_14898&quot;&gt;M Stern&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9UEKR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9UEKR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="462" LastEditorUserId="2293" LastEditDate="2021-01-25T20:49:33.293" LastActivityDate="2021-01-25T20:49:33.293" CommentCount="0" CommunityOwnedDate="2021-01-25T10:45:11.817" ContentLicense="CC BY-SA 4.0" />
  <row Id="15677" PostTypeId="2" ParentId="15673" CreationDate="2021-01-25T10:52:33.083" Score="4" Body="&lt;p&gt;If you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits you can combine them in &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; different bit string (this come from combinatorics). Now take &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. As any qubit can in superposition of two state, i.e. 0 and 1, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can be in superposition representing all &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible bit strings.&lt;/p&gt;&#xA;&lt;p&gt;The notion that &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can hold &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; classical bits is unfortunately misleading because when you measure the qubits, they will collapse to one particular state. This means that information content of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; classical bits.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="10480" LastEditDate="2021-01-26T00:45:47.613" LastActivityDate="2021-01-26T00:45:47.613" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="15678" PostTypeId="1" AcceptedAnswerId="15680" CreationDate="2021-01-25T15:35:38.043" Score="9" ViewCount="931" Body="&lt;p&gt;I am very new to quantum computing and currently studying quantum computing on my own through various resources (Youtube Qiskit, Qiskit website, book).&lt;/p&gt;&#xA;&lt;p&gt;As my mindset is still &amp;quot;locked&amp;quot; with classical computation, where input and output are very certain, I can confirm my output given a certain input. There are some confusion for me to understand quantum computing properly.&lt;/p&gt;&#xA;&lt;p&gt;Then many described what are state vector, superposition, measurement, etc. I understand what they meant (or maybe not fully). State vector is probability of being 0 or 1. Superposition is linear combination between two basis (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; or any orthogonal basis). Measurement, to get the outcome of a qubit given the probability of the qubit.&lt;/p&gt;&#xA;&lt;p&gt;However what doesn't make me feel satisfy or &amp;quot;ahha&amp;quot; is that I don't understand, since quantum computing always give an uncertain outcome after measurement (e.g. &lt;a href=&quot;https://www.youtube.com/watch?v=a1NZC5rqQD8&amp;amp;ab_channel=Qiskit&quot; rel=&quot;noreferrer&quot;&gt;this video&lt;/a&gt; about 2:40 the pong game shows when Hadamard gate is applied, then the probability of plane 000 and 001 are half-half and causing the loss because the ball didn't hit the plane), why we still want to use the uncertain outcome?&lt;/p&gt;&#xA;&lt;p&gt;I understand (or maybe partially understand) that quantum computing is very fast, we can compute many things at once (since we have superposition or something), and we can simulate an experiment many times to get the result. However I don't think this solved my confusion.&lt;/p&gt;&#xA;&lt;p&gt;So my question is, why do we still need quantum computing since it always gives uncertain measurement?&lt;/p&gt;&#xA;" OwnerUserId="14565" LastEditorUserId="10480" LastEditDate="2021-01-25T20:09:57.080" LastActivityDate="2021-01-27T11:44:19.167" Title="If quantum computing always return random measurement (or uncertain measurement), why do we still need it?" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;classical-computing&gt;&lt;information-theory&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15679" PostTypeId="1" CreationDate="2021-01-25T16:25:20.037" Score="4" ViewCount="52" Body="&lt;p&gt;In trapped ion quantum computers, especially in systems with multiple traps, you may need at some point to perform a &amp;quot;chain reordering&amp;quot;, in which you change an ion's position within the ion chain like in the figure below (&lt;a href=&quot;https://arxiv.org/abs/2004.04706&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VvgUZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VvgUZ.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is basically a SWAP between two qubits, you can either do it by applying a SWAP gate or by physically rotating the ions. Of course, both methods have time and reliability overheads but, is there (currently) a consensus of which one is generally better than the other?.&lt;/p&gt;&#xA;" OwnerUserId="14548" LastEditorUserId="14548" LastEditDate="2021-01-26T13:46:28.420" LastActivityDate="2021-01-26T13:46:28.420" Title="Gate SWAP vs Physical SWAP in Trapped Ions for chain reordering" Tags="&lt;nisq&gt;&lt;performance&gt;&lt;trapped-ion&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15680" PostTypeId="2" ParentId="15678" CreationDate="2021-01-25T16:48:17.933" Score="6" Body="&lt;h3&gt;&lt;strong&gt;Short answer:&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;p&gt;Assuming you are measuring in the computational basis (Z basis), &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle \}$&lt;/span&gt;, there is no randomness upon measurement in the following quantum circuit (you will always get back the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hBY8G.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hBY8G.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, measurement needs not be random. However, if you try this following circuit, you will have 50% to see a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and 50% to see &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CelMX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CelMX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So your answer is not so deterministic here... when designing a quantum algorithm, we want somehow create interference within the system and so upon measurement, we have something like the first circuit. Where the result is deterministic.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;&lt;strong&gt;Long answer:&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;p&gt;A &lt;strong&gt;state vector&lt;/strong&gt; is a vector describing the state of the system. In quantum computing, your system is a qubit, hence a two-level quantum system. Thus, it can be described by a complex Euclidian space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;. Thus, the state of a qubit, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \alpha|0\rangle + \beta|1\rangle \hspace{1 cm} \alpha, \beta \in \mathbb{C}, \hspace{0.5 cm} |0\rangle = \begin{pmatrix} 1 \\ 0\end{pmatrix}, \hspace{0.25 cm} |1\rangle = \begin{pmatrix} 0 \\ 1\end{pmatrix}  \hspace{1cm} |\alpha|^2 +|\beta|^2 = 1$$&lt;/span&gt;&#xA;And if you have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit state then it can be written as a normalized vector in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2 ^{\otimes n}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So suppose you have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2}  \end{pmatrix} $&lt;/span&gt; then you can see that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be written as a &lt;strong&gt;superposition&lt;/strong&gt; (in a linear combination) of the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \dfrac{1}{\sqrt{2}}|0\rangle + \dfrac{1}{\sqrt{2}}|1\rangle $$&lt;/span&gt;&#xA;Now, it is a &lt;strong&gt;postulate of quantum mechanics&lt;/strong&gt; that any device that &lt;strong&gt;measures&lt;/strong&gt; a two-state quantum system (a qubit) must have two preferred states &lt;span class=&quot;math-container&quot;&gt;$\{|e_1\rangle, |e_2\rangle \}$&lt;/span&gt; that form an orthonormal basis for the associated vector space (here would be &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;). A measurement on the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; transforms &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into one of the these basis vectors &lt;span class=&quot;math-container&quot;&gt;$|e_1 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt;. The probability that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is measured as &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt; is the square of the magnitude of the amplitude of the component of the state in the direction of the basis vector  &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So if we picked &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle = 0 $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|e_2 \rangle = |1\rangle$&lt;/span&gt; then upon measuring the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{2}}|0\rangle + \dfrac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;, you will have 50% observing the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and 50% observing the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. In this case, &lt;strong&gt;a single measurement&lt;/strong&gt; doesn't tell you anything... you need many, many measurements to build up a statistical distribution.&lt;/p&gt;&#xA;&lt;p&gt;But the &lt;em&gt;uncertainty&lt;/em&gt; described above is only because we have picked &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$e_2\rangle$&lt;/span&gt; the way we did. If we have picked, &lt;span class=&quot;math-container&quot;&gt;$|e_1\rangle = |+\rangle =  \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|e_2\rangle = |-\rangle =  \begin{pmatrix} 1/\sqrt{2} \\ -1/\sqrt{2} \end{pmatrix}$&lt;/span&gt; then upon measuring, we will observe the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; with a 100% probability (assuming no noise). There is no randomness here. This is because &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is NOT in a superposition in the &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle \}$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, the notion of &lt;em&gt;superposition&lt;/em&gt; is &lt;strong&gt;basis-dependent&lt;/strong&gt;. All states are superposition with respect to some bases but not with respect to others. That is, a state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; is only a superposition with respect to the  computational basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle \}$&lt;/span&gt; but not a superposition with respect to the bases &lt;span class=&quot;math-container&quot;&gt;$\{ \alpha |0\rangle + \beta |1\rangle, \beta^* |0\rangle - \alpha^* |1\rangle \}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since measuring a superposition state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle =  \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; is probabilisitc, it is tempted to say that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is a probabilistic mixture of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and we just don't know which, when in fact, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is actually a definite state. That is, if we measure &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in certain bases, we will get a deterministic result.&lt;/p&gt;&#xA;&lt;p&gt;Thus, when designing a quantum algorithm, we want the final state which contains the answer we are looking for be in a single eigenstate and not in superposition with respect to the computational basis (Z basis). For instance, the following circuit will create a state that is NOT in superposition in the computational basis...&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fF955.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fF955.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;so if you run the above circuit on a quantum computer, you will only need to measure it &lt;em&gt;ONCE&lt;/em&gt; to obtain your result... This circuit is constructed to solve the problem of &amp;quot;secret bitstring&amp;quot;. In fact, the state upon measurement is the state &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;, which tells you that the secret bitstring is &lt;code&gt;11&lt;/code&gt;... This is known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Bernstein%E2%80%93Vazirani_algorithm&quot; rel=&quot;noreferrer&quot;&gt;Bernstein–Vazirani algorithm&lt;/a&gt;. I would recommend you to read up on it as it will help you to understand where the advantage of quantum computation come about.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-25T19:25:06.427" LastActivityDate="2021-01-25T19:25:06.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15681" PostTypeId="2" ParentId="15678" CreationDate="2021-01-25T16:51:20.290" Score="2" Body="&lt;p&gt;The result is random is the resulting state is a superposition of states, but this is not always the case. Indeed, the idea with quantum computing is to exploit the phenomenon of &lt;em&gt;interference&lt;/em&gt;, which is the core of quantum mechanics. In a good quantum algorithm, the computational paths that lead to a wrong answer cancel out, while the paths leading to a correct answer reinforce.&lt;/p&gt;&#xA;&lt;p&gt;A nice reference is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.cs.virginia.edu/%7Erobins/The_Limits_of_Quantum_Computers.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cs.virginia.edu/~robins/The_Limits_of_Quantum_Computers.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2021-01-25T16:51:20.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15682" PostTypeId="2" ParentId="15679" CreationDate="2021-01-25T18:04:24.460" Score="3" Body="&lt;p&gt;Prelim: I am no expert on implementation techniques or the frontier of what gate technology is being used in current renditions of Trapped Ion QC.&lt;/p&gt;&#xA;&lt;p&gt;The Molmer-Sorensen gate is generally what is used in Hot Trapped Ion QC since it does not require the phonon mode of the Ion trap to be in the ground state; this gate forms a universal set of gates.&lt;/p&gt;&#xA;&lt;p&gt;The gate operates by 'physically rotating the Qubits' (loosely), and through those operations applied at different times we can trivially obtain the SWAP and also C-NOT, C-Z, etc. So it's not a question of 'either rotate the bits or apply the SWAP gate', since the rotation is itself the SWAP gate.&lt;/p&gt;&#xA;&lt;p&gt;Now if we are using other types of gates, like the Cirac-Zoller gate; then yes we would have to apply the gate in different ways to obtain the SWAP operation (Cirac-Zoller is just a C-NOT so this is quite trivial), and if we only have access to the Cirac-Zoller gate then there is no way to 'rotate' the Qubit. It is all a question of what tools are available for the technology you are working with.&lt;/p&gt;&#xA;" OwnerUserId="14513" LastActivityDate="2021-01-25T18:04:24.460" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15683" PostTypeId="2" ParentId="15678" CreationDate="2021-01-25T19:58:34.370" Score="3" Body="&lt;p&gt;&lt;strong&gt;Deterministic case&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;As the other answers point out, quantum circuits may in fact have deterministic or nearly deterministic output distributions. In those cases, the probability of obtaining some value of interest &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; is very high and after a few executions of the algorithm we can be very confident what &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; is.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Non-deterministic case&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;More generally however, non-deterministic computation (quantum or otherwise) can be inherently useful if an output probability is equal to a quantity of interest &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; denote the probability that a non-deterministic computer outputs &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt; that it outputs &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Suppose that we have found a non-deterministic algorithm with the property that &lt;span class=&quot;math-container&quot;&gt;$p_0 = v$&lt;/span&gt;. If we execute the algorithm &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; times counting the number &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; of cases where the computer returned &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, then we can estimate &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;v = p_0 \approx \frac{k}{n}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we can improve the quality of the estimate by increasing &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. In fact, there are many classical probabilistic algorithms, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Monte_Carlo_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Monte Carlo&lt;/a&gt;, that work this way.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A concrete example of a useful quantum algorithm with non-deterministic output is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL algorihtm&lt;/a&gt; for solving linear equations. Suppose we would like to compute the first component &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; of the solution to a very large linear system &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;. Combining the HHL algorithm with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard test&lt;/a&gt; as described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15669/hhl-and-choice-of-observable-for-calculating-the-expectation-value-thereof/15674#15674&quot;&gt;this answer&lt;/a&gt; we can create a quantum circuit for which&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Re}\,x_0 = p_0 - p_1 \approx \frac{2k-n}{n}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the number of times the computer output &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; among &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; executions.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-25T19:58:34.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15684" PostTypeId="1" AcceptedAnswerId="15685" CreationDate="2021-01-25T21:15:24.753" Score="3" ViewCount="237" Body="&lt;p&gt;I have read some articles about Shor's code (e.g. &lt;a href=&quot;https://arxiv.org/abs/0905.2794&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;). It is said that Shor's code can correct a single-qubit error. What about two qubit errors? Three qubit errors? It confused me a lot...&lt;/p&gt;&#xA;" OwnerUserId="14585" LastEditorUserId="14585" LastEditDate="2021-01-29T18:01:58.480" LastActivityDate="2021-01-29T18:01:58.480" Title="Can Shor‘s code correct two- or three-qubit errors?" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15685" PostTypeId="2" ParentId="15684" CreationDate="2021-01-25T22:34:28.800" Score="4" Body="&lt;p&gt;We can combine weaker codes to obtain stronger codes using concatenation (see &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9608012&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; or chapter X B in &lt;a href=&quot;https://arxiv.org/abs/0905.2794&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Suppose we have a quantum error correcting code that encodes a logical qubit in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; physical qubits in a way that enables us to correct any &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; errors. We can use this code to encode &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; logical qubits in &lt;span class=&quot;math-container&quot;&gt;$n^2$&lt;/span&gt; physical qubits and then we can add a second level of encoding to encode a second-level logical qubit into the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; first-level logical qubits.&lt;/p&gt;&#xA;&lt;p&gt;How many errors can the resulting two-level code correct? For an error to occur at the second level, at least &lt;span class=&quot;math-container&quot;&gt;$t+1$&lt;/span&gt; first-level encoded qubits must suffer an error. For an error to occur in any first level encoded qubit, at least &lt;span class=&quot;math-container&quot;&gt;$t+1$&lt;/span&gt; physical qubits must suffer an error. Thus, for an error to occur at the second level, there must be at least &lt;span class=&quot;math-container&quot;&gt;$(t+1)^2$&lt;/span&gt; physical errors. Consequently, the two-level concatenated code can correct any&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(t+1)^2 - 1 = t^2 + 2t&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;physical errors. For example, the two level Shor's code can correct any three physical errors.&lt;/p&gt;&#xA;&lt;p&gt;Concatenation can be continued to any number of levels and if the physical error rate is low enough it allows us to bring the logical error rate below any desired target value. This last result is known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;threshold theorem&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-25T22:34:28.800" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="15686" PostTypeId="1" AcceptedAnswerId="15687" CreationDate="2021-01-25T22:52:52.183" Score="6" ViewCount="191" Body="&lt;p&gt;I am attempting to run a series of tests on a Q# program I'm running on the local simulator, but I'm not seeing any way to use &amp;gt;1 shot and collect the results of those shots at once, as in essentially every other quantum language/system I've seen. Is this not a feature at all in the Q#/Azure Quantum system? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="14019" LastActivityDate="2021-01-25T23:14:20.333" Title="Q# Simulation Behavior" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15687" PostTypeId="2" ParentId="15686" CreationDate="2021-01-25T23:14:20.333" Score="5" Body="&lt;p&gt;Thanks for your question! If you're interested in running multiple shots of a quantum operation, Q# allow for doing that with conventional programming techniques such as a &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Measurement;&#xA;&#xA;operation SampleRandomBit() : Result {&#xA;    using (q = Qubit()) {&#xA;        return MResetX(q);&#xA;    }&#xA;}&#xA;&#xA;operation SampleManyRandomBits(nBits : Int) : Result[] {&#xA;    mutable results = EmptyArray&amp;lt;Result&amp;gt;();&#xA;    for (_ in 1..nBits) {&#xA;        set results += [SampleRandomBit()];&#xA;    }&#xA;    return results;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The Q# standard library also provides some convenience operations for repeating operations in this way, such as &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.arrays.drawmany&quot; rel=&quot;noreferrer&quot;&gt;&lt;code&gt;DrawMany&lt;/code&gt;&lt;/a&gt; or &lt;code&gt;EstimateFrequency&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Characterization;&#xA;&#xA;operation SampleManyRandomBits(nBits : Int) : Result[] {&#xA;    return DrawMany(SampleRandomBit, nBits, ());&#xA;}&#xA;&#xA;operation EstimateHeadsProbability(nShots : Int) : Double {&#xA;    return EstimateFrequency(ApplyToEach(H, _), Measure([PauliZ], _), 1, nShots);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2021-01-25T23:14:20.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15688" PostTypeId="2" ParentId="15684" CreationDate="2021-01-26T07:41:27.847" Score="2" Body="&lt;p&gt;Shor's code is specifically designed to correct all possible single-qubit errors. There are some two-qubit errors that it can correct for (e.g. Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on one qubit and Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on another). You will also be able to find specific combinations of multiple-qubit errors for which it can correct, but those will be the exception rather than the rule. Instead, if you want to protect against two-qubit errors, you employ different strategies - either code concatenation, or just find a different error correcting code with a larger distance.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-01-26T07:41:27.847" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15689" PostTypeId="2" ParentId="15533" CreationDate="2021-01-26T15:19:53.860" Score="2" Body="&lt;p&gt;Quick side note before proceeding to answering your question: &lt;span class=&quot;math-container&quot;&gt;$|\phi_u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; are &lt;em&gt;registers&lt;/em&gt; of qubits since they can represent a set of qubits (and not necessarily a single qubit).&lt;/p&gt;&#xA;&lt;p&gt;Now on to answering your question: at the end of the phase estimation algorithm, if we make a measurement and the first register collapses to &lt;span class=&quot;math-container&quot;&gt;$|\phi_u\rangle$&lt;/span&gt; then the second register will collapse to &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;. This is because, as you mentioned, they are entangled. To make this more apparent, here is the state before the measurement written out explicitly: &lt;span class=&quot;math-container&quot;&gt;$$\sum_{u=1}^n c_u |\phi_u\rangle |u\rangle =  c_1|\phi_1\rangle|1\rangle + c_2|\phi_2\rangle|2\rangle + ... + c_n|\phi_n\rangle|n\rangle.$$&lt;/span&gt; Therefore whichever &lt;span class=&quot;math-container&quot;&gt;$|\phi_u\rangle$&lt;/span&gt; you measure in the first register, the second register will collapse to the corresponding &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastEditorUserId="10480" LastEditDate="2021-01-26T20:49:43.343" LastActivityDate="2021-01-26T20:49:43.343" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15691" PostTypeId="1" AcceptedAnswerId="16384" CreationDate="2021-01-26T16:03:38.853" Score="6" ViewCount="257" Body="&lt;p&gt;Quick question concerning the probability of success after a phase estimation algorithm vs an amplitude estimation algorithm.&lt;/p&gt;&#xA;&lt;p&gt;Given the calculation on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm#Measurement&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page&lt;/a&gt;, the probability of measuring the desired output in a phase estimation algorithm is at least &lt;span class=&quot;math-container&quot;&gt;$\frac{4}{\pi^2}$&lt;/span&gt;. This is something that I think I have a pretty good handle on.&lt;/p&gt;&#xA;&lt;p&gt;However, when looking at the &lt;em&gt;amplitude&lt;/em&gt; estimation algorithm, we see that the probability of measuring the desired output is at least &lt;span class=&quot;math-container&quot;&gt;$\frac{8}{\pi^2}$&lt;/span&gt; (i.e. twice as likely). The only proof that I have found was in Theorem 11 from the &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0005055.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;original paper&lt;/a&gt;. To be honest I am still working through this paper but it is quite terse and a bit difficult to read. Does anyone either have a good intuitive explanation for the difference in success probabilities between phase estimation and amplitude estimation? Or can someone maybe recommend a resource that describes this difference in a nice way? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14597" LastEditorUserId="14597" LastEditDate="2021-03-04T10:54:10.637" LastActivityDate="2021-05-04T09:27:55.693" Title="Quantum Amplitude Estimation vs Quantum Phase Estimation" Tags="&lt;grovers-algorithm&gt;&lt;phase-estimation&gt;&lt;probability&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15692" PostTypeId="1" AcceptedAnswerId="15703" CreationDate="2021-01-26T17:18:37.020" Score="4" ViewCount="66" Body="&lt;p&gt;I had a question earlier about generating the superposition of all the possible states: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/14941/12334&quot;&gt;Here&lt;/a&gt;. In that case, we could apply &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;, and each state has the same amplitude in the superposition: &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle $&lt;/span&gt;. However, it is possible for us to tune the amplitude of certain states in the superposition? Say if I have 4 qubits and 4 Hadamard gates (one on each), that would generate a superposition of 16 states. Can I add some additional procedures to increase the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|0110\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1001\rangle$&lt;/span&gt; and the rest states have the same and reduced amplitude?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-01-27T11:57:58.387" Title="Is it possible to tune the amplitude of superposition generated by Hadamard gates?" Tags="&lt;hadamard&gt;&lt;superposition&gt;&lt;amplitude-amplification&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15693" PostTypeId="2" ParentId="15678" CreationDate="2021-01-26T17:18:57.107" Score="5" Body="&lt;p&gt;Summary: Quantum computing is believed to give uncertain measurements &lt;em&gt;fast&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you delve a little bit into computational theory, you'll find that there are problems that cannot be solved exactly and efficiently with traditional computational tools. However, for some of these problems, if we have a solution we can check if it is correct efficiently with a classical computer. For some of these problems we already use &lt;em&gt;probabilistic&lt;/em&gt; or approximation approaches to get &amp;quot;close-enough&amp;quot; solutions.&lt;/p&gt;&#xA;&lt;p&gt;As some of the other answers mention, there are some affordances in the way we construct quantum circuits that kind of gloss over the noise inherent in the individual qubits. But, with all due respect, the real promise of QC is that we can get an answer quickly that would be hard to find by classical means, &lt;em&gt;and then&lt;/em&gt; check its correctness using a classical computer.&lt;/p&gt;&#xA;&lt;p&gt;For example, Shor's algorithm can be naively thought of as a random number generator that is likely to output factors of large numbers. The best algorithm for factorization on a classical computer is given as&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LVRSC.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LVRSC.png&quot; alt=&quot;exponetial time&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(see &lt;a href=&quot;https://en.wikipedia.org/wiki/Integer_factorization&quot; rel=&quot;noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Integer_factorization&lt;/a&gt;), but Shor's can give an answer in &lt;span class=&quot;math-container&quot;&gt;$O(b^3)$&lt;/span&gt;. Of course, we have to check if the answer is correct, but that's easy, it's just multiplication.&lt;/p&gt;&#xA;" OwnerUserId="14602" LastActivityDate="2021-01-26T17:18:57.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15694" PostTypeId="2" ParentId="15668" CreationDate="2021-01-26T18:28:59.123" Score="2" Body="&lt;p&gt;I recommend using OpenFermion in conjunction with QCOR, a quantum programming language being developed at Oak Ridge National Laboratory. This tool offers python bindings and has abstractions for variational quantum algorithms. &lt;a href=&quot;https://github.com/ORNL-QCI/qcor/blob/master/python/examples/openfermion_integration.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;'s an example showing QCOR with OpenFermion. Although I don't know anything about the LiH Hamiltonian, here's an example using QCOR with OpenFermion to do VQE to find the ground state of the Hubbard Hamiltonian:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from openfermion.hamiltonians import fermi_hubbard&#xA;from openfermion.ops import FermionOperator as FOp&#xA;from openfermion.ops import QubitOperator&#xA;from openfermion.transforms import jordan_wigner, normal_ordered&#xA;from openfermion.linalg import get_sparse_operator, get_ground_state, eigenspectrum&#xA;from openfermion.utils import hermitian_conjugated, commutator, count_qubits&#xA;from qcor import *&#xA;import numpy as np&#xA;from types import MethodType&#xA;&#xA;#Define openFermion model&#xA;Nlat = 2 #number of lattice sites&#xA;x_dimension = 2 #two sites like this *--*&#xA;y_dimension = 1&#xA;tunneling = 1.0 #t&#xA;coulomb = 3 &#xA;nfill = 1.0&#xA;chemical_potential = nfill*coulomb/2.0&#xA;periodic = 1&#xA;spinless = 0 #spinfull case&#xA;hubbard_r = fermi_hubbard(x_dimension, y_dimension, tunneling, coulomb, chemical_potential, spinless = 0)&#xA;hubbard_r.compress(abs_tol=1e-12)&#xA;print(f'  {Nlat:d} site Hubbard model: {len(hubbard_r.terms):d} terms in the Hamiltonian')&#xA;#perform jordan wigner transform&#xA;hubbard_rjw = jordan_wigner(hubbard_r)&#xA;&#xA;sparse_operator = get_sparse_operator(hubbard_rjw, n_qubits = Nlat*2)&#xA;gs = get_ground_state(sparse_operator)&#xA;E0 = gs[0]&#xA;#define the quantum circuit (kernel) for your &amp;quot;ansatz&amp;quot; or initial guess wavefunction, this is factorized UCC ansatz&#xA;#exp_i_theta does implicit first order trotterization&#xA;@qjit&#xA;def ansatz(q: qreg, x: List[float], exp_args: List[FermionOperator]):&#xA;    X(q[0])&#xA;    X(q[1])&#xA;    for i, exp_arg in enumerate(exp_args):&#xA;        exp_i_theta(q, x[i], exp_args[i])&#xA; &#xA;# Create OpenFermion operators for our quantum kernel...&#xA;exp_args_openfermion = [FOp('2^ 3^ 1 0') - FOp('0^ 1^ 3 2'),&#xA;                        FOp('2^ 0') - FOp('0^ 2'), &#xA;                        FOp('3^ 1') - FOp('1^ 3')]&#xA;print(exp_args_openfermion)&#xA;print(type(exp_args_openfermion[0]))&#xA;# We need to translate OpenFermion ops into qcor Operators to use with kernels...&#xA;exp_args_qcor = [createOperator('fermion', fop) for fop in exp_args_openfermion]&#xA;&#xA;# translates arguments between quantum kernel and optimizer&#xA;def ansatz_translate(self, q: qreg, x: List[float]):&#xA;    ret_dict = {}    &#xA;    ret_dict[&amp;quot;q&amp;quot;] = q&#xA;    ret_dict[&amp;quot;x&amp;quot;] = x&#xA;    ret_dict[&amp;quot;exp_args&amp;quot;] = exp_args_qcor&#xA;    return ret_dict&#xA;ansatz.translate = MethodType(ansatz_translate, qjit)&#xA;n_params = len(exp_args_qcor)&#xA;x_init  = np.random.rand(n_params).tolist()&#xA;ansatz.print_kernel(qalloc(4), [1.0, 1.0, 1.0], exp_args_qcor)&#xA;u_mat = ansatz.as_unitary_matrix(qalloc(4), [1.0, 1.0, 1.0], exp_args_qcor)&#xA;print(&amp;quot;unitary mat: &amp;quot;, u_mat)&#xA;#VQE is an example of an &amp;quot;objectiveFunction&amp;quot;, where we seek to minimize &amp;lt;U(x)|H|U(x)&amp;gt;&#xA;obj = createObjectiveFunction(ansatz, hubbard_rjw, n_params, {'gradient-strategy': 'parameter-shift'})&#xA;optimizer = createOptimizer('nlopt', {'algorithm': 'l-bfgs', 'initial-parameters':x_init})&#xA;results = optimizer.optimize(obj)&#xA;print(results)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2800" LastEditorUserId="10480" LastEditDate="2021-01-26T20:53:29.563" LastActivityDate="2021-01-26T20:53:29.563" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15695" PostTypeId="1" AcceptedAnswerId="15733" CreationDate="2021-01-26T18:54:28.677" Score="3" ViewCount="61" Body="&lt;p&gt;When wanting to find the groundstate of this Hamiltonian with QAOA:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;    H_{C} =\sum_{i }^{n}(1 - Z_{i})/2 + \sum_{\{i,j\}\in \overline{E} } - 2(1 - Z_{i})(1 - Z_{j})/4 &#xA;\end{equation}&lt;/span&gt;&#xA;whose the Hamiltonian Simulation is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\label{eq:qubo}&#xA;    e^{ -i\gamma H_{C}} =\prod_{i}^{n} U1(-\gamma)_{i}\prod_{\{i,j\}\in \overline{E} }  CU1(2\gamma)_{(i,j)}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is &lt;span class=&quot;math-container&quot;&gt;$\gamma \in [0,2 \pi]$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\gamma \in [0,\pi]$&lt;/span&gt; because of &lt;span class=&quot;math-container&quot;&gt;$2 \gamma$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$CU1(2\gamma)_{(i,j)} $&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;And how are &lt;span class=&quot;math-container&quot;&gt;$ U1(2\pi -\gamma)_{i}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U1(-\gamma)_{i}$&lt;/span&gt; distinguished?&lt;/p&gt;&#xA;" OwnerUserId="11646" LastEditorUserId="1859" LastEditDate="2021-01-26T21:15:39.503" LastActivityDate="2021-01-28T20:53:29.327" Title="Is $\gamma \in [0,2 \pi]$ or $\gamma \in [0,\pi]$ in $CU1(2\gamma)_{(i,j)} $?" Tags="&lt;hamiltonian-simulation&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15696" PostTypeId="1" AcceptedAnswerId="15698" CreationDate="2021-01-26T19:30:56.150" Score="5" ViewCount="1501" Body="&lt;p&gt;Qubits have 3 states: 1, 0, and 1 and 0 at the same time. If a qubit can have 3 states, then how come they are seen as different from ternary computing, which also has 3 states?&lt;/p&gt;&#xA;&lt;p&gt;Is it that the 3 states are represented in different ways, or what?&lt;/p&gt;&#xA;" OwnerUserId="14605" LastEditorUserId="55" LastEditDate="2021-01-31T19:16:02.437" LastActivityDate="2021-02-13T21:38:38.677" Title="Aren't qubits just ternary?" Tags="&lt;quantum-state&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15697" PostTypeId="2" ParentId="15696" CreationDate="2021-01-26T20:01:14.713" Score="4" Body="&lt;p&gt;Simple answer: no.&lt;/p&gt;&#xA;&lt;p&gt;Qubits are the same as regular bits in almost every way; except two fundamental differences, superposition and entanglement (I will only address superposition since it is the focus of your question). Qubits can only be observed in &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt;, something you have probably heard as 'wave function collapse', but the basic idea is that when we observe qubits, they carry the same information as regular bits. Which begs the question; what is superposition?&lt;/p&gt;&#xA;&lt;p&gt;The way quantum mechanics works generally, is that there are certain states we can observe for a given system; whether that be energy, spin, angular momentum, etc. And observations do not commute, this means that our state in fact &lt;em&gt;cannot&lt;/em&gt; be described as existing in a single state, rather it must be a in a 'distribution' of states; or better said a 'superposition' of states.&lt;/p&gt;&#xA;&lt;p&gt;There are many nuances and subtleties as to how these probabilities come up, and why they are represented by complex numbers, but the basic idea is as follows; a Qubit &lt;span class=&quot;math-container&quot;&gt;$| x \rangle$&lt;/span&gt; is written as :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$| x \rangle = \alpha| 0 \rangle +  \beta| 1 \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have a probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; of finding it in &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; and probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt; of finding it in &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;, we can never actually measure it &amp;quot;in between 0 and 1&amp;quot;. Notice also that superposition is a fundamental aspect of quantum physics, which is nature. It is how nature works as hard as that may be to understand, and we use our engineering and computer-science techniques to take advantage of this superposition for the implementation of various algorithms.&lt;/p&gt;&#xA;&lt;p&gt;Since your question was about why qubits are not ternary this would be a good place to stop, but you might at this point be wondering, that just seems like a more complicated way to do normal computing... in part you would be correct. However, the idea of superposition and entanglement opens a new Pandora's box of computational methods, and allows us to approach some problems in different ways, which is what makes quantum computers so cool!&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="14610" LastEditDate="2021-01-27T03:57:38.343" LastActivityDate="2021-01-27T03:57:38.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15698" PostTypeId="2" ParentId="15696" CreationDate="2021-01-26T20:10:02.893" Score="13" Body="&lt;p&gt;Qubits have more than three distinct states. Here are six examples of such states:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|0\rangle\tag{1}\\&#xA;|1\rangle\tag{2}\\&#xA;|+\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}\tag{3} \\&#xA;|-\rangle = \frac{|0\rangle - |1\rangle}{\sqrt{2}} \tag{4}\\&#xA;|{+i}\rangle = \frac{|0\rangle +i |1\rangle}{\sqrt{2}} \tag{5}\\&#xA;|{-i}\rangle = \frac{|0\rangle -i |1\rangle}{\sqrt{2}}\tag{6}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In fact, a qubit has an infinite number of distinct states. For every &lt;span class=&quot;math-container&quot;&gt;$\theta \in [0, 4\pi)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi \in [0, 2\pi)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{7}&#xA;\cos\frac{\theta}{2} |0\rangle + e^{i\phi}\sin\frac{\theta}{2} |1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is a distinct &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state#Pure_states&quot; rel=&quot;nofollow noreferrer&quot;&gt;pure state&lt;/a&gt; of a qubit.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="2293" LastEditDate="2021-02-13T21:37:14.997" LastActivityDate="2021-02-13T21:37:14.997" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15699" PostTypeId="1" AcceptedAnswerId="15701" CreationDate="2021-01-26T21:13:01.207" Score="3" ViewCount="114" Body="&lt;p&gt;I was quite fascinated when I learned about gate teleportation, but I am struggling with understanding what it may be used for.&lt;/p&gt;&#xA;&lt;p&gt;Sure, one can use ancillae bits to teleport gates into various parts of a circuit... but why? In general would it not be more difficult to add extra qubits to the system as opposed to performing extra gate operations?&lt;/p&gt;&#xA;&lt;p&gt;Gate teleportation looks great to me on paper (by this I mean drawing the physical circuits... it's so cool!), but when I think about an ion trap I can't seem to convince myself of a time where one would really use it if they have access to the proper lasers to implement gates.&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="55" LastEditDate="2021-01-31T19:16:37.583" LastActivityDate="2021-01-31T19:16:37.583" Title="What can gate teleportation be used for in practice?" Tags="&lt;quantum-gate&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15700" PostTypeId="2" ParentId="12438" CreationDate="2021-01-27T00:42:45.540" Score="1" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is finite-dimensional (e.g. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the state space of a qubit), the procedure amounts to expanding the quantum state in an appropriately chosen basis.&lt;/p&gt;&#xA;&lt;p&gt;Choose an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|u_1\rangle, \dots |u_k\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and extend it to an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|u_1\rangle, \dots, |u_k\rangle, |u_{k+1}\rangle, \dots, |u_n\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$H = H_1\oplus H_2$&lt;/span&gt;. Expand &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; in the basis&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle = \underbrace{a_1 |u_1\rangle + \dots a_k |u_k\rangle}_{|v_1\rangle\in H_1} + \underbrace{a_{k+1} |u_{k+1}\rangle + \dots + a_n |u_n\rangle}_{|v_2\rangle\in H_2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to see that &lt;span class=&quot;math-container&quot;&gt;$|v\rangle = |v_1\rangle + |v_2\rangle$&lt;/span&gt; is the desired decomposition.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is infinite-dimensional (e.g. &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the state space of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_harmonic_oscillator&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum harmonic oscillator&lt;/a&gt;), we can use projectors instead of a basis.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; denote the orthogonal projector onto &lt;span class=&quot;math-container&quot;&gt;$H_k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=1,2$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$H_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_2$&lt;/span&gt; are eigenspaces of &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; associated with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; respectively and of &lt;span class=&quot;math-container&quot;&gt;$P_2$&lt;/span&gt; associated with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; respectively. Consequently, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the eigenspace of &lt;span class=&quot;math-container&quot;&gt;$P_1+P_2$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Therefore, &lt;span class=&quot;math-container&quot;&gt;$P_1+P_2 = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, let &lt;span class=&quot;math-container&quot;&gt;$|v_1\rangle = P_1|v\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v_2\rangle = P_2|v\rangle$&lt;/span&gt;. Then,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|v\rangle = I |v\rangle = P_1|v\rangle + P_2|v\rangle = |v_1\rangle + |v_2\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is the desired decomposition.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-27T03:09:55.103" LastActivityDate="2021-01-27T03:09:55.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15701" PostTypeId="2" ParentId="15699" CreationDate="2021-01-27T08:17:56.610" Score="3" Body="&lt;p&gt;The key practical value of gate teleportation lies in the fact that it provides a simple and fairly general protocol for reliable and fault-tolerant execution of a wide range of gates.&lt;/p&gt;&#xA;&lt;p&gt;Depending on the quantum architecture, some gates may be difficult or impossible to execute reliably or fault-tolerantly. The operations that make up the teleportation protocol are often simpler to implement fault-tolerantly than the gate being teleported (see application 1 below). Also, gate teleportation enables us to achieve scalability by performing unreliable operations offline where failures do not restart the entire computation (see application 2 below).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Application 1: Fault-tolerant implementation of non-transversal gates&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;By the &lt;a href=&quot;https://en.wikipedia.org/wiki/Eastin%E2%80%93Knill_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Eastin-Knill theorem&lt;/a&gt;, no quantum error correcting code admits transversal implementation of a universal set of gates. While transversality is a simple way to ensure fault-tolerance, it is not the only way. However, most other techniques are &lt;em&gt;ad hoc&lt;/em&gt; and do not generalize to many types of gates. Gate teleportation provides fault-tolerant implementation of a large class of gates called the Clifford hierarchy.&lt;/p&gt;&#xA;&lt;p&gt;The Clifford hierarchy is defined recursively. The first level &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_1$&lt;/span&gt; is the Pauli group and for &lt;span class=&quot;math-container&quot;&gt;$k&amp;gt;1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{C}_k = \{U\,|\,U\mathcal{C}_1U^\dagger \subset \mathcal{C}_{k-1}\}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;All levels of the hierarchy contain potentially useful gates. For example, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_2$&lt;/span&gt; is the Clifford group, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_3$&lt;/span&gt; contains the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate and the Toffoli gate and each &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_k$&lt;/span&gt; contains the controlled rotations used in Shor's algorithm.&lt;/p&gt;&#xA;&lt;p&gt;The key fact about gate teleportation and the Clifford hierarchy is that to achieve teleportation of &lt;span class=&quot;math-container&quot;&gt;$U\in\mathcal{C}_k$&lt;/span&gt; we only need gates in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_{k-1}$&lt;/span&gt; (together with measurements and classical control). Consequently, recursive application of the gate teleportation scheme allow us to implement any gate in the Clifford hierarchy. The recursion terminates at &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_2$&lt;/span&gt; in codes such as the 7-qubit Steane code that implement the Clifford group transversally. In other stabilizer codes it terminates at &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_1$&lt;/span&gt; or at &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}_2$&lt;/span&gt; if other techniques provide fault-tolerant implementation of the Clifford group.&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9908010&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for details.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Application 2: Reliable implementation of two-qubit gates using linear optics&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/KLM_protocol&quot; rel=&quot;nofollow noreferrer&quot;&gt;KLM protocol&lt;/a&gt; enables universal quantum computation using only linear optical elements by using post-selection to implement a non-deterministic two-qubit gate. However, if a gate which succeeds with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is used directly in the execution of a quantum algorithm &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; times then the chance of the overall success of the computation is &lt;span class=&quot;math-container&quot;&gt;$p^k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can overcome this exponentially small chance of success by replacing gate application with gate teleportation. The advantage of this approach lies in the fact that failures of the non-deterministic gate do not force a computation to restart. Instead, they merely slow down the offline process of collecting the special states for teleportation.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-27T18:44:41.970" LastActivityDate="2021-01-27T18:44:41.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15702" PostTypeId="2" ParentId="15678" CreationDate="2021-01-27T11:44:19.167" Score="4" Body="&lt;p&gt;Indeed that is an excellent question! Since measurements always lead to a probabilistic outcome, why should we think quantum computing is useful? I definitely second the answer by Michele Amoretti and recommend the reference he pointed out, and will add a few things:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Firstly we know that quantum computers can, in principle, perform &lt;em&gt;all&lt;/em&gt; calculations that a classical computer can at least just as efficiently (proof in [1]). Not such a surprising statement but important to establish nonetheless.&lt;/li&gt;&#xA;&lt;li&gt;Now we come onto the question of if they perfom calculations &lt;em&gt;more&lt;/em&gt; efficiently than classical computers. As Michele mentioned, we can use the concept of &lt;em&gt;interference&lt;/em&gt;, or another way to equivalently state it is the concepts of &lt;em&gt;superposition&lt;/em&gt; and &lt;em&gt;entanglement&lt;/em&gt; to come up with clever (and so far admittedly very unintuitive) ways of finding ways to perform certain calculations faster on quantum computers despite the fact that (as you mention) the outcomes of measurements are probabilistic. A simple (but not so practical) example that demonstrates this is Deutch's algorithm. Ref [2] has a clear explanation on this. The most famous example is probably Shor's algorithm [3] which can find prime factors of large numbers exponentially faster than a classical computer can.&lt;/li&gt;&#xA;&lt;li&gt;However so far we haven't discovered have very many other algorithms that demonstrate such a speed up, and this may be as Peter Shor suggested because it's just really difficult: &amp;quot;quantum computers operate in a manner so different from classical computers that our techniques for designing algorithms and our intuitions for understanding the process of computation no longer work&amp;quot; [4]. But hey, we keep trying and hopefully there are more algorithms out there to find!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;References&lt;/p&gt;&#xA;&lt;p&gt;[1] &lt;a href=&quot;http://people.cs.uchicago.edu/%7Efortnow/papers/quantum.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://people.cs.uchicago.edu/~fortnow/papers/quantum.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[2] &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[3] &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://en.wikipedia.org/wiki/Shor%27s_algorithm&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;[4] &lt;a href=&quot;https://cs.brynmawr.edu/Courses/cs380/fall2012/Shor2003.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://cs.brynmawr.edu/Courses/cs380/fall2012/Shor2003.pdf&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-01-27T11:44:19.167" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15703" PostTypeId="2" ParentId="15692" CreationDate="2021-01-27T11:57:58.387" Score="3" Body="&lt;p&gt;Yes indeed you can!&lt;/p&gt;&#xA;&lt;p&gt;First a simple example: if you want to increase all the amplitudes of the all the states that look like &lt;span class=&quot;math-container&quot;&gt;$|\cdot \cdot \cdot 1\rangle$&lt;/span&gt; then you just need to apply an &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gate on the final qubit.&lt;/p&gt;&#xA;&lt;p&gt;If on the other hand you want to increase the amplitudes of the specific states &lt;span class=&quot;math-container&quot;&gt;$|0110\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1001\rangle$&lt;/span&gt; by specific amounts, then you need to apply a series of controlled &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates which isn't so trivial, and generically takes an exponential depth. If you want to increase their amplitudes, but you don't care by how much specifically, you can use Grover's algorithm as mentioned by Bertrand Einstein IV.&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-01-27T11:57:58.387" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15704" PostTypeId="2" ParentId="15653" CreationDate="2021-01-27T12:41:46.327" Score="1" Body="&lt;p&gt;Yes I would highly recommend Appendix B, C and D of this book written by the National Academy of Sciences: &lt;a href=&quot;https://www.nap.edu/catalog/25196/quantum-computing-progress-and-prospects&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nap.edu/catalog/25196/quantum-computing-progress-and-prospects&lt;/a&gt; (you can click on Download Free PDF for an electronic copy). Even though it is about 3 years old, I don't believe there have been huge advancements in terms of the fundamentals since then. I actually would recommend reading the whole thing :)&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-01-27T12:41:46.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15705" PostTypeId="2" ParentId="15650" CreationDate="2021-01-27T12:44:59.173" Score="1" Body="&lt;p&gt;Short answer: SVMs and Quantum SVMs are the same except you use kernels that are not efficient to compute using a classical computer but that can be computed efficiently using a quantum computer. There haven't been any smoking-gun use cases so far but a very interesting paper on proof-of-concept example can be found here: &lt;a href=&quot;https://arxiv.org/abs/2010.02174&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2010.02174&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-01-27T12:44:59.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15706" PostTypeId="2" ParentId="15517" CreationDate="2021-01-27T13:33:27.243" Score="1" Body="&lt;p&gt;A great (but slightly lengthy) explanation that's very understandable and with minimal math written by John Bell: &lt;a href=&quot;https://hal.archives-ouvertes.fr/jpa-00220688/document&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://hal.archives-ouvertes.fr/jpa-00220688/document&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-01-27T13:33:27.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15707" PostTypeId="1" CreationDate="2021-01-27T14:46:14.113" Score="3" ViewCount="108" Body="&lt;p&gt;How is a two qubit mixed state represented in the form of Bloch vector?&lt;/p&gt;&#xA;" OwnerUserId="13039" LastEditorUserId="55" LastEditDate="2021-01-31T19:17:29.793" LastActivityDate="2021-01-31T19:17:29.793" Title="How is a two qubit mixed state represented in the form of Bloch vector?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15708" PostTypeId="1" CreationDate="2021-01-27T15:31:45.023" Score="0" ViewCount="57" Body="&lt;p&gt;I am trying to understand the relation between Fidelity and Concurrence for a two qubit maximally mixed state. When I calculate the Fidelity and Concurrence, I observe that Concurrence is zero whereas Fidelity is one.&lt;/p&gt;&#xA;&lt;p&gt;In some of the papers, I read that the relation between Fidelity and Concurrence is &lt;span class=&quot;math-container&quot;&gt;$F = (c+2/3)$&lt;/span&gt;. But this violates the above observation.&lt;/p&gt;&#xA;&lt;p&gt;Please let me know if I miss anything.&lt;/p&gt;&#xA;" OwnerUserId="13039" LastEditorUserId="10480" LastEditDate="2021-01-31T20:22:32.593" LastActivityDate="2021-01-31T20:22:32.593" Title="What is the relation between fidelity and concurrence for a two qubit maximally mixed state?" Tags="&lt;entanglement&gt;&lt;fidelity&gt;&lt;resource-theories&gt;&lt;concurrence&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15709" PostTypeId="2" ParentId="15707" CreationDate="2021-01-27T18:13:06.867" Score="4" Body="&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is impossible in general, because the space of two-qubit mixed states is significantly more complicated than the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Dimension&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The space &lt;span class=&quot;math-container&quot;&gt;$D_N$&lt;/span&gt; of all mixed states of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-level quantum system has &lt;span class=&quot;math-container&quot;&gt;$N^2-1$&lt;/span&gt; real dimensions. For a qubit &lt;span class=&quot;math-container&quot;&gt;$D_2$&lt;/span&gt; has only three dimensions and can be readily visualized as a subset of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;. However, for two qubits &lt;span class=&quot;math-container&quot;&gt;$N=2^2 = 4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;-dimensional. Consequently, there is no visualization aid analogous to the Bloch sphere that allows us to imagine the full space all at once.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Algebraic representation&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, we can use other techniques to study &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt;. Algebraically, the Bloch sphere can be thought of as a map that takes a state &lt;span class=&quot;math-container&quot;&gt;$\rho_1 \in D_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x_{\rho_1} \in \mathbb{R}^3$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1 = \frac{I + x_{\rho_1} \cdot \sigma_1}{2}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_1 = (\sigma_x, \sigma_y, \sigma_z)^T$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-vector of Pauli operators. This representation is unique because &lt;span class=&quot;math-container&quot;&gt;$\{I, \sigma_x, \sigma_y, \sigma_z\}$&lt;/span&gt; is a basis of the real vector space of Hermitian operators in two dimensions. Similarly, we can map every two-qubit state &lt;span class=&quot;math-container&quot;&gt;$\rho_2\in D_4$&lt;/span&gt; to a &lt;span class=&quot;math-container&quot;&gt;$x_{\rho_2} \in \mathbb{R}^{15}$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_2 = \frac{I + \sqrt{3}\,x_{\rho_2} \cdot \sigma_2}{2}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_2 = \begin{pmatrix}&#xA;I \otimes \sigma_x\\&#xA;I \otimes \sigma_y\\&#xA;I \otimes \sigma_z\\&#xA;\sigma_x \otimes I\\&#xA;\sigma_x \otimes \sigma_x\\&#xA;\sigma_x \otimes \sigma_y\\&#xA;\sigma_x \otimes \sigma_z\\&#xA;\sigma_y \otimes I\\&#xA;\sigma_y \otimes \sigma_x\\&#xA;\sigma_y \otimes \sigma_y\\&#xA;\sigma_y \otimes \sigma_z\\&#xA;\sigma_z \otimes I\\&#xA;\sigma_z \otimes \sigma_x\\&#xA;\sigma_z \otimes \sigma_y\\&#xA;\sigma_z \otimes \sigma_z\\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is a &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt;-vector of non-identity two-qubit Pauli operators and the scaling factor &lt;span class=&quot;math-container&quot;&gt;$\sqrt{3}$&lt;/span&gt; ensures that &lt;span class=&quot;math-container&quot;&gt;$\|x\|_2 \le 1$&lt;/span&gt; for convenience. As before, &lt;span class=&quot;math-container&quot;&gt;$x_{\rho_2}$&lt;/span&gt; is unique for a given state &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Back to geometry&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;An immediate consequence of &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; that distinguishes the shape of &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$D_2$&lt;/span&gt; is that &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt; is not symmetric with respect to the maximally mixed state. This is a first sign that the shape of &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt; is more complicated than a sphere.&lt;/p&gt;&#xA;&lt;p&gt;Even though &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt; cannot be visualized all at once, we can visualize various cross-sections through &lt;span class=&quot;math-container&quot;&gt;$D_4$&lt;/span&gt;. Some &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;-dimensional cross sections turn out to be balls, some are tetrahedrons and others have more complicated shapes.&lt;/p&gt;&#xA;&lt;p&gt;See the paper &lt;a href=&quot;https://arxiv.org/abs/1901.06688&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;An elementary introduction to the geometry of quantum states with pictures&amp;quot;&lt;/a&gt; or the book &amp;quot;Geometry of Quantum States: An Introduction to Quantum Entanglement&amp;quot; by Ingemar Bengtsson and Karol Życzkowski for more details.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-27T18:13:06.867" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15710" PostTypeId="1" CreationDate="2021-01-27T18:21:10.380" Score="4" ViewCount="38" Body="&lt;p&gt;I am trying to understand the creation of qubits through the use of quantum dots, but I have always had some trouble understanding the function of the gate electrode. I know it can control the chemical potential of the dot itself, but how does it actually work?&lt;/p&gt;&#xA;" OwnerUserId="14621" LastEditorUserId="14621" LastEditDate="2021-01-27T20:28:24.647" LastActivityDate="2021-05-03T10:05:30.500" Title="What does a gate electrode do in the context of a quantum dot?" Tags="&lt;physical-qubit&gt;&lt;quantum-dots&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15711" PostTypeId="1" AcceptedAnswerId="15712" CreationDate="2021-01-27T20:01:57.553" Score="3" ViewCount="64" Body="&lt;p&gt;I am trying to write &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; party GHZ state but at the end of the day, it seems like bi partite state. I am missing a detail. Here is my code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;number =6&#xA;qubits = cirq.LineQubit.range(number) &#xA;def n_party_GHZ_circuit(qubits)&#xA;      GHZ_circuit = cirq.Circuit(cirq.H(qubits[i]),&#xA;                           cirq.CNOT(qubits[i], qubits[j]))&#xA;&#xA;GHZ = cirq.final_density_matrix(n_party_GHZ_circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I can write it by hand with indexes but suppose that we have 10 qubits and in that case I do not want to write it by hand for all combinations. So I am trying to write a function but I couldn't.&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2021-01-31T19:14:38.150" LastActivityDate="2021-01-31T19:14:38.150" Title="Cirq: n-qubit GHZ state" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15712" PostTypeId="2" ParentId="15711" CreationDate="2021-01-27T20:23:12.243" Score="3" Body="&lt;p&gt;How about:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;number = 6&#xA;qubits = cirq.LineQubit.range(number) &#xA;GHZ_circuit = cirq.Circuit(cirq.H(qubits[0]))&#xA;for i in range(number-1):&#xA;    C = cirq.Circuit(cirq.CX(qubits[i], qubits[i+1] ) )&#xA;    GHZ_circuit = GHZ_circuit + C                     &#xA;&#xA;print(GHZ_circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which outputs:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0: ───H───@───────────────────&#xA;          │&#xA;1: ───────X───@───────────────&#xA;              │&#xA;2: ───────────X───@───────────&#xA;                  │&#xA;3: ───────────────X───@───────&#xA;                      │&#xA;4: ───────────────────X───@───&#xA;                          │&#xA;5: ───────────────────────X───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will produce the state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aOZLd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aOZLd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is what 6 qubit GHZ state you want.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-27T20:23:12.243" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15713" PostTypeId="1" AcceptedAnswerId="15714" CreationDate="2021-01-27T23:37:36.143" Score="6" ViewCount="399" Body="&lt;p&gt;Concerning the Hadamard gate and the Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates for qubits, it is straightforward to show the following relationship via direct substitution:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ HXH = Z.\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And I would like to demonstrate this relationship for higher dimensions (I know that this still holds for higher dimensions but I haven't found a proof for it anywhere).&lt;/p&gt;&#xA;&lt;p&gt;I know that the &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimension generalization of the X and Z Pauli gates for qudits are given by &lt;span class=&quot;math-container&quot;&gt;$X_d\lvert j\rangle = \lvert j\bigoplus1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_d\lvert j\rangle = \exp^{\frac{i2\pi j}{d}}\lvert j\rangle$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$j = 0,1,2,\dots,d-1 $&lt;/span&gt;). My approach to finding the d-dimension generalization of equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is to make use of these operators, but unfortunately I cannot find a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional analogue of the Hadamard gate like I have for the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; Pauli gates. I have considered using the relationship &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt2}(X + Z)$&lt;/span&gt; but I don't know for certain if this is just true for qubits.&lt;/p&gt;&#xA;&lt;p&gt;If anyone could provide any suggestions or hints as to how I should prove the generalization of equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, it will be much appreciated (my biggest problem specifically is expressing H in an alternate form).&lt;/p&gt;&#xA;" OwnerUserId="14494" LastEditorUserId="10480" LastEditDate="2021-03-20T23:16:11.673" LastActivityDate="2021-03-20T23:16:11.673" Title="How to generalize the relationship HXH = Z for higher dimensions" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;&lt;quantum-fourier-transform&gt;&lt;hadamard&gt;&lt;qudit&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15714" PostTypeId="2" ParentId="15713" CreationDate="2021-01-28T00:06:08.707" Score="4" Body="&lt;p&gt;The appropriate &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional analogue of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; turns out to be the Quantum Fourier Transform. This is obscured by the fact that even though &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is conjugation the inverse is written implicitly since &lt;span class=&quot;math-container&quot;&gt;$H^\dagger = H$&lt;/span&gt;. Thus, &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional generalization of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;QFT \circ X_d \circ QFT^\dagger = Z_d.\tag{1'}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The following calculation shows that both sides of &lt;span class=&quot;math-container&quot;&gt;$(1')$&lt;/span&gt; agree on the computational basis and therefore are equal&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;QFT \circ X_d \circ QFT^\dagger |j\rangle &amp;amp;= QFT \circ X_d \left(\frac{1}{\sqrt{d}}\sum_{k=0}^{d-1} \exp\left(-\frac{2\pi ijk}{d}\right)|k\rangle\right) \\&#xA;&amp;amp; = QFT \left(\frac{1}{\sqrt{d}}\sum_{k=0}^{d-1} \exp\left(-\frac{2\pi ijk}{d}\right)|k\oplus 1\rangle\right) \\&#xA;&amp;amp; = QFT \left(\frac{1}{\sqrt{d}}\sum_{k=0}^{d-1} \exp\left(-\frac{2\pi ij(k-1)}{d}\right)|k\rangle\right) \\&#xA;&amp;amp; = \frac{1}{d}\sum_{k=0}^{d-1} \exp\left(-\frac{2\pi ij(k-1)}{d}\right)\sum_{l=0}^{d-1}\exp\left(\frac{2\pi ikl}{d}\right)|l\rangle \\&#xA;&amp;amp; = \frac{1}{d}\exp\left(\frac{2\pi ij}{d}\right)\sum_{k,l=0}^{d-1} \exp\left(\frac{2\pi ik(l-j)}{d}\right)|l\rangle \\&#xA;&amp;amp; = \frac{1}{d}\exp\left(\frac{2\pi ij}{d}\right)\cdot d\,|j\rangle \\&#xA;&amp;amp; = Z_d |j\rangle.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-28T00:06:08.707" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15715" PostTypeId="2" ParentId="15713" CreationDate="2021-01-28T00:20:14.787" Score="3" Body="&lt;p&gt;The correct generalization is the discrete Fourier transform &lt;span class=&quot;math-container&quot;&gt;$F_d$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensions defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F_d = \sum_{jk} e^{i2\pi jk / d} |j\rangle \langle k|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;up to a sign convention. I'll show &lt;span class=&quot;math-container&quot;&gt;$F_d^\dagger Z_d F_d = X_d$&lt;/span&gt; since its equivalent and a bit easier. Letting &lt;span class=&quot;math-container&quot;&gt;$\omega_d \equiv \exp(i2\pi/d)$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;F_d^\dagger Z_d F_d &amp;amp;= \left(\sum_{j,k}\omega^{jk}|j\rangle \langle k|\right)^\dagger \left(\sum_\ell \omega^\ell |\ell \rangle \langle \ell |\right) \left(\sum_{m,n}\omega^{mn}|m\rangle \langle n|\right) \\&#xA;&amp;amp;= \sum_{j,k,\ell, m,n} \omega^{-jk}\omega^\ell \omega^{mn} \delta_j^\ell \delta_\ell^m |k \rangle \langle n| \\&#xA;&amp;amp;= \sum_{k,n} |k \rangle \langle n| \left(\sum_\ell \omega^{\ell(1 + n - k)} \right) \\&#xA;&amp;amp;= \sum_{k,n}|k \rangle \langle n| \delta_k^{n+1 \text{ mod d}} \\&#xA;&amp;amp;=  \sum_{k,n}|n+1 \text{ mod d}\rangle \langle n| &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where in the third line I used an identity for the sum over roots of unity, and for simplicity I've left out a host of factors of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{d}}$&lt;/span&gt; that are required for unitarity. That last operator is &lt;span class=&quot;math-container&quot;&gt;$X_d$&lt;/span&gt;, and so the same proof shows that &lt;span class=&quot;math-container&quot;&gt;$F_d X_d F_d^\dagger = Z_d$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-01-28T00:20:14.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15716" PostTypeId="2" ParentId="15609" CreationDate="2021-01-28T00:29:39.080" Score="1" Body="&lt;p&gt;In order to apply the conditional rotation by &lt;span class=&quot;math-container&quot;&gt;$\omega_{N}^{-jk}$&lt;/span&gt;, you will need to know &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, therefore you will need to have access to both &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (for the phase) and &lt;span class=&quot;math-container&quot;&gt;$f(k)$&lt;/span&gt; (for the basis vector).&lt;/p&gt;&#xA;&lt;p&gt;An easier way to see that is to set &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$\alpha_{j,k}$&lt;/span&gt; be &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt;.  There are only two bijective functions &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; - the identity, or the inverse.&lt;/p&gt;&#xA;&lt;p&gt;You end up with two different states, depending on whether &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is the identity or the inverse.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-01-30T20:07:10.263" LastActivityDate="2021-01-30T20:07:10.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15717" PostTypeId="1" AcceptedAnswerId="15719" CreationDate="2021-01-28T01:13:28.310" Score="7" ViewCount="456" Body="&lt;p&gt;According to &lt;a href=&quot;https://en.wikipedia.org/wiki/No-hiding_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The no-hiding theorem proves that if information is lost from a system via decoherence, then it moves to the subspace of the environment and it cannot remain in the correlation between the system and the environment. This is a fundamental consequence of the linearity and unitarity of quantum mechanics. Thus, information is never lost. This has implications in black hole information paradox and in fact any process that tends to lose information completely. The no-hiding theorem is robust to imperfection in the physical process that seemingly destroys the original information.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;My understanding is that reading a qubit destroys some information. For example, a qubit which is in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\left| 0 \right&amp;gt; + \left| 1 \right&amp;gt;}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;has a 50% chance of being sampled as a 0, and a 50% chance of being read as a 1. If you read this qubit, doesn't this destroy information?&lt;/p&gt;&#xA;&lt;p&gt;Here's my argument for why this destroys information. If you had an unrelated qubit, in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\left| 0 \right&amp;gt; - \left| 1 \right&amp;gt;}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;that would have the same probability of getting a zero or one when you read it. If the two are different before sampling, and indistinguishable afterwards, isn't this a loss of information?&lt;/p&gt;&#xA;&lt;p&gt;While researching this question, I found &lt;a href=&quot;https://arxiv.org/abs/1707.09462&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;, but I don't understand their argument.&lt;/p&gt;&#xA;" OwnerUserId="14608" LastEditorUserId="14608" LastEditDate="2021-01-28T15:14:00.113" LastActivityDate="2021-01-28T15:14:00.113" Title="Does the no-hiding theorem suggest that quantum information is never destroyed?" Tags="&lt;measurement&gt;&lt;unitarity&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15719" PostTypeId="2" ParentId="15717" CreationDate="2021-01-28T06:52:59.257" Score="7" Body="&lt;p&gt;It is true that unitary evolution cannot destroy information. This is the content of the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-cloning_theorem&quot; rel=&quot;noreferrer&quot;&gt;no-cloning theorem&lt;/a&gt; and its time reversal - the &lt;a href=&quot;https://en.wikipedia.org/wiki/No-deleting_theorem&quot; rel=&quot;noreferrer&quot;&gt;no-deleting theorem&lt;/a&gt;. The no-hiding theorem says something different and more subtle.&lt;/p&gt;&#xA;&lt;h2&gt;Information hiding&lt;/h2&gt;&#xA;&lt;p&gt;In order to understand what it says it helps to start with the observation that classical information residing in a composite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; may be absent from &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and absent from &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; simultaneously. The information may be hiding in the correlations between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. The example used by Braunstein and Pati in &lt;a href=&quot;https://arxiv.org/abs/gr-qc/0603046&quot; rel=&quot;noreferrer&quot;&gt;their paper&lt;/a&gt; is a message encrypted with the &lt;a href=&quot;https://en.wikipedia.org/wiki/One-time_pad&quot; rel=&quot;noreferrer&quot;&gt;one-time pad cipher&lt;/a&gt;. In this case &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the cryptogram and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the key. Clearly, the message resides in &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;. However, as was shown by Shannon, neither &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; nor &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; alone carries any information about the encrypted message.&lt;/p&gt;&#xA;&lt;h2&gt;No-hiding theorem&lt;/h2&gt;&#xA;&lt;p&gt;The no-hiding theorem says that the above situation is not possible for quantum information. More precisely, suppose we have a system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and wish to hide this state by having it unitarily interact with environment &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in such a way that the post-interaction state of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is constant, i.e. independent of &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;. The no-hiding theorem asserts that there exists a subspace of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; that is in state &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;. Consequently, and in contrast to the classical case, the initial state &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; may be recovered by local operations on &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; only.&lt;/p&gt;&#xA;&lt;p&gt;Thus, the only way to hide quantum information is by moving it to another system. Unlike in the case of classical information, hiding information in the correlations between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is not an option.&lt;/p&gt;&#xA;&lt;h2&gt;Measurement&lt;/h2&gt;&#xA;&lt;p&gt;The situation described in the question is not a counterexample to the no-hiding theorem because the theorem concerns consequences of unitarity and measurement is not unitary.&lt;/p&gt;&#xA;&lt;p&gt;(N.B. measurement followed by a classically controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate also appears to accomplish &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|\psi\rangle \to |0\rangle|\psi\rangle$&lt;/span&gt; which is prohibited by the no-deleting theorem. Once again, this is not a counterexample since the no-deleting theorem concerns unitary processes.)&lt;/p&gt;&#xA;&lt;p&gt;That said, the restriction of applicability to unitary processes is weaker than it might first appear. Generally speaking, when we describe a situation using quantum mechanics we designate - usually implicitly - one of the systems as the observer. This choice determines how the postulates of quantum mechanics are applied. Specifically, when two systems interact neither of which is designated as the observer then we apply the postulate of unitary evolution to describe the interaction. However, to describe an interaction involving the observer we use a different rule - the measurement postulate - and this is where non-unitarity, non-determinism and wavefunction collapse all enter the picture.&lt;/p&gt;&#xA;&lt;p&gt;Now, the reason that non-unitarity of measurement is a weaker restriction on the no-go theorems than may initially appear is that every measurement may be described as a deterministic, unitary process by reassigning the designation of the observer to a different system. This is demonstrated by the &lt;a href=&quot;https://en.wikipedia.org/wiki/Wigner%27s_friend&quot; rel=&quot;noreferrer&quot;&gt;Wigner's friend&lt;/a&gt; thought experiment.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-28T07:03:24.350" LastActivityDate="2021-01-28T07:03:24.350" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15720" PostTypeId="1" AcceptedAnswerId="15721" CreationDate="2021-01-28T10:25:13.030" Score="4" ViewCount="46" Body="&lt;p&gt;Can anyone explain why the &lt;span class=&quot;math-container&quot;&gt;$l_1$&lt;/span&gt; distance has the property that probability distributions &lt;span class=&quot;math-container&quot;&gt;$P,Q$&lt;/span&gt; with orthogonal support (meaning that the product &lt;span class=&quot;math-container&quot;&gt;$p_iq_i$&lt;/span&gt; vanishes for each value of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;) are at a maximal distance from each other?&#xA;Consider &lt;span class=&quot;math-container&quot;&gt;$$ \|P-Q\|_1=\frac{1}{2}\sum_{i=1}^{N}|p_i-q_i|$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13843" LastEditorUserId="55" LastEditDate="2021-01-31T19:07:27.993" LastActivityDate="2021-01-31T19:07:27.993" Title="Why do probablity distribution with orthogonal suppor have maximal Kolmogorov distance?" Tags="&lt;information-theory&gt;&lt;trace-distance&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15721" PostTypeId="2" ParentId="15720" CreationDate="2021-01-28T10:44:10.143" Score="3" Body="&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$p_{i}q_{i} = 0\,\,\forall i$&lt;/span&gt;, then for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; either &lt;span class=&quot;math-container&quot;&gt;$p_{i} = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$q_{i} = 0$&lt;/span&gt;, or both are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Divide &lt;span class=&quot;math-container&quot;&gt;$\{i\} = \{1,\ldots,N\}$&lt;/span&gt;  into those &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; for which these three different things happen: &lt;span class=&quot;math-container&quot;&gt;$\{N_{p_{i}}\} = \{i|p_{i} = 0\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\{N_{q_{i}}\} = \{i|q_{i} = 0\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\{N_{pq_{i}}\} = \{i|p_{i} = q_{i} = 0\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;\|P-Q\|_{1} =&amp;amp; \frac{1}{2}\sum_{i=1}^{N}|p_{i}-q_{i}| \\ &#xA;=&amp;amp; \frac{1}{2}\sum_{i\in N_{p_{i}}}|p_{i}-q_{i}| + \frac{1}{2}\sum_{i\in N_{q_{i}}}|p_{i}-q_{i}| + \frac{1}{2}\sum_{i\in N_{pq_{i}}}|p_{i}-q_{i}| \\&#xA;=&amp;amp; \frac{1}{2}\sum_{i\in N_{p_{i}}}|q_{i}| + \frac{1}{2}\sum_{i\in N_{q_{i}}}|p_{i}| + \frac{1}{2}\sum_{i\in N_{pq_{i}}}|0| \\&#xA;=&amp;amp; \frac{1}{2}\Big(\sum_{i \in \{N\}}q_{i} + \sum_{i \in \{N\}} p_{i}\Big) = 1,&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the last line follows from the fact that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;1 = \sum_{i\in \{N\}}|q_{i}| = \sum_{i\in N_{p_{i}}}|q_{i}| + \sum_{i\in N_{q_{i}}}|q_{i}| + \sum_{i\in N_{pq_{i}}}|q_{i}| = \sum_{i\in N_{p_{i}}}|q_{i}| + 0 + 0 = \sum_{i\in N_{p_{i}}}|q_{i}|,&#xA;$$&lt;/span&gt;&#xA;and likewise for &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}p_{i}$&lt;/span&gt;. That is, we can add these other terms of &lt;span class=&quot;math-container&quot;&gt;$q_{i}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$p_{i}$&lt;/span&gt;) because they are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; by construction anyway.&lt;/p&gt;&#xA;&lt;p&gt;This is the maximum value that &lt;span class=&quot;math-container&quot;&gt;$\|P-Q\|_{1}$&lt;/span&gt; can take for &lt;em&gt;any&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$|p_{i} - q_{i}| \leq |p_{i}| + |-q_{i}| = p_{i} + q_{i}$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$p_{i},q_{i}$&lt;/span&gt; imaginable, and as such:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|P-Q\|_{1} = \frac{1}{2}\sum_{i=1}^{N}|p_{i}-q_{i}| \leq \frac{1}{2}\big(\sum_{i=1}^{N}p_{i}+q_{i}\big) = \frac{1}{2}\sum_{i=1}^{N}p_{i} + \frac{1}{2}\sum_{i=1}^{N}q_{i} = \frac{1}{2}+\frac{1}{2} = 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="10480" LastEditDate="2021-01-29T06:36:58.013" LastActivityDate="2021-01-29T06:36:58.013" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15722" PostTypeId="1" CreationDate="2021-01-28T12:28:24.637" Score="3" ViewCount="15" Body="&lt;p&gt;Obviously this specific topic had not been thoroughly studied, and the best we can do are empirical deductions based on past experience with quantum algorithms.&lt;/p&gt;&#xA;&lt;p&gt;The security of lattice-based public-key encryption and digital signature schemes are based on the intractability of reducing algebraic lattice, with concrete estimates of the security levels based on BKZ family of algorithms.&lt;/p&gt;&#xA;&lt;p&gt;The rough idea is that, BKZ operates with a siever/enumerator that finds short lattice vectors in a particular block size, and BKZ use that to reduce the lattice to certain desirable norm. Typically, the larger the block size, the smaller the norm of the output of BKZ. The siever/enumerator here, have running time that's typically exponential to the block size.&lt;/p&gt;&#xA;&lt;p&gt;However, what if there's a quantum version of BKZ that's capable of producing lattice with small norm using siever/enumerator operating with small block size? That brings us to the questions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What would be the theoretical obstacles for such BKZ-like quantum algorithm?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1203" LastEditorUserId="1203" LastEditDate="2021-01-29T10:57:55.587" LastActivityDate="2021-01-29T10:57:55.587" Title="Theoretical obstacles for a BZK-like quantum algorithm instantiated with a subroutine operates at small block size?" Tags="&lt;cryptography&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15723" PostTypeId="1" CreationDate="2021-01-28T13:04:16.063" Score="4" ViewCount="79" Body="&lt;p&gt;My physics master thesis is about variational quantum optimization and I have to run algorithms with more qubits than 15. Is it possible to make any requests to use larger IBM real quantum computers?&lt;/p&gt;&#xA;" OwnerUserId="14632" LastActivityDate="2021-01-29T01:29:26.417" Title="Is it possible to have access to real quantum computers that have more than 15 qubits for my master thesis?" Tags="&lt;physical-realization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15724" PostTypeId="2" ParentId="15723" CreationDate="2021-01-28T14:24:33.843" Score="4" Body="&lt;p&gt;I don't think there is any system in the free tier of IBM Q, the park of IBM's quantum systems, with more than &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; qubits. The larger systems are reserved for 'partners', which in general are business that pay (a considerable amount at that).&lt;/p&gt;&#xA;&lt;p&gt;You could try and request access to it, but as far as I am aware there is no paved road to do so, and you most likely will need some in-house contacts that you could ask.&#xA;To be honest, I expect the chances of this approach succeeding to be slim, but don't let me stop you of course. If you find anyone, contact them preferably through your professor or some senior staff.&lt;/p&gt;&#xA;&lt;p&gt;If the systems don't necessarily need to be from IBM, you could request access to Rigetti's system(s) via &lt;a href=&quot;https://qcs.rigetti.com/request-access&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;. It is not strictly speaking open access, but since you are a MSc. student I expect you to have a university email. Use that email and your chances of getting access are quite considerable, I would say.&lt;/p&gt;&#xA;&lt;p&gt;You can program these machine(s) using python just as with qiskit &amp;lt;-&amp;gt; IBM Q, and their &lt;a href=&quot;https://qcs.rigetti.com/qpus/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aspen-8 QPU&lt;/a&gt; has &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt; qubits (in a rather interesting architecture, but I'm not sure what you need in that regard).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-01-28T14:32:28.970" LastActivityDate="2021-01-28T14:32:28.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15725" PostTypeId="1" CreationDate="2021-01-28T15:51:52.357" Score="5" ViewCount="115" Body="&lt;p&gt;For measurement, we know&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle M \rangle = \sum_j p_j \langle \psi_j|M|\psi_j \rangle = \sum_j p_j \operatorname{tr}\left(|\psi_j \rangle \langle \psi_j|M\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is, how can we go from the first expression to the second one with trace operation? What's the math behind it?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2021-01-31T19:08:05.657" LastActivityDate="2021-01-31T19:08:05.657" Title="Derivation of the identity $\sum_j p_j \langle \psi_j|M|\psi_j \rangle = \sum_j p_j \operatorname{tr}\left(|\psi_j \rangle \langle \psi_j|M\right)$" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15726" PostTypeId="1" AcceptedAnswerId="15821" CreationDate="2021-01-28T16:06:35.217" Score="4" ViewCount="189" Body="&lt;p&gt;I am having trouble rigorously proving that a two qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=a|00\rangle+b|01\rangle+c|10\rangle+d|11\rangle$&lt;/span&gt; is unentangled/separable if &lt;span class=&quot;math-container&quot;&gt;$ad-bc=0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I currently have fairly little exposure to quantum information theory.&#xA;I've heard 'Schmidt decomposition' mentioned as a possible solution.&#xA;Alternately, this is problem 16b in &lt;a href=&quot;https://www.cl.cam.ac.uk/teaching/1617/QuantComp/exercise1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this document&lt;/a&gt;&#xA;which also gives the hint to apply a unitary matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\phi}\begin{bmatrix}&#xA;c&amp;amp; -a \\ a^* &amp;amp; c^*&#xA;\end{bmatrix}$$&lt;/span&gt;&#xA;to one of the qubits. Any solution is appreciated but the preference is for one that uses less machinery, and in particular I'd be interested to see how to use the above hint to prove the result.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;To be clear, I know that separable &lt;span class=&quot;math-container&quot;&gt;$\implies ad-bc=0$&lt;/span&gt; - this is not difficult to show. It is the other implication (&lt;span class=&quot;math-container&quot;&gt;$ad-bc=0\implies$&lt;/span&gt; separable) that I am having trouble with.&lt;/p&gt;&#xA;" OwnerUserId="14634" LastEditorUserId="55" LastEditDate="2021-01-31T19:09:36.823" LastActivityDate="2021-02-03T21:15:07.947" Title="Prove that $a|00\rangle+b|01\rangle+c|10\rangle+d|11\rangle$ is separable iff $ad-bc=0$" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="3" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15727" PostTypeId="2" ParentId="15725" CreationDate="2021-01-28T16:29:47.083" Score="1" Body="&lt;p&gt;This involves two steps. In the first, we use the fact that the trace of a number, thought of as a &lt;span class=&quot;math-container&quot;&gt;$1 \times 1$&lt;/span&gt; martix, is that number. In the second, we use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Trace_(linear_algebra)#Cyclic_property&quot; rel=&quot;nofollow noreferrer&quot;&gt;cyclic property&lt;/a&gt; of the trace.&lt;/p&gt;&#xA;&lt;p&gt;Explicitly, the steps are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle M \rangle = \sum_j p_j \langle \psi_j|M|\psi_j \rangle = \sum_j p_j \operatorname{tr}\left(\langle \psi_j|M|\psi_j \rangle\right) = \sum_j p_j \operatorname{tr}\left(|\psi_j \rangle \langle \psi_j|M\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-28T19:32:53.140" LastActivityDate="2021-01-28T19:32:53.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15728" PostTypeId="2" ParentId="15725" CreationDate="2021-01-28T16:39:09.370" Score="4" Body="&lt;p&gt;First, note that by definition:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr(X) = \sum_i X_{ii} = \sum_i \langle i| X | i\rangle $$&lt;/span&gt;&#xA;then now let &lt;span class=&quot;math-container&quot;&gt;$Y = |\psi\rangle \langle\psi| $&lt;/span&gt; then this implies that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$Tr(YX) = Tr(XY) = \sum_i \langle i|XY|i\rangle = \sum_i  \langle i|X |\psi\rangle \langle\psi |i\rangle  = \sum_i \langle \psi| i \rangle \langle i|X |\psi\rangle  = \langle\psi|X|\psi\rangle = \langle X \rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-29T16:25:44.793" LastActivityDate="2021-01-29T16:25:44.793" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15729" PostTypeId="2" ParentId="15726" CreationDate="2021-01-28T17:05:25.177" Score="4" Body="&lt;p&gt;&lt;em&gt;Maybe this will help.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose we have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = a|00\rangle+b|01\rangle+c|10\rangle+d|11\rangle = \begin{pmatrix} a \\ b \\ c \\d \end{pmatrix} $&lt;/span&gt;, then by &lt;strong&gt;definition&lt;/strong&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is &lt;strong&gt;separable&lt;/strong&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |\phi_1\rangle \otimes |\phi_2\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\phi_1\rangle, |\phi_2\rangle \in \mathbb{C}^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now let &lt;span class=&quot;math-container&quot;&gt;$|\phi_1 \rangle = \begin{pmatrix} x \\ y \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_2 \rangle = \begin{pmatrix} u \\ v \end{pmatrix} $&lt;/span&gt; then we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi_1 \rangle  \otimes |\phi_2 \rangle = \begin{pmatrix} xu\\ xv\\ yu\\yv \end{pmatrix}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;this implies that if &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |\phi_1\rangle \otimes |\phi_2\rangle$&lt;/span&gt; then&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} a \\ b \\ c \\d \end{pmatrix} = \begin{pmatrix} xu\\ xv\\ yu\\yv \end{pmatrix} $&lt;/span&gt;  then after a few algebra steps you should arrive at &lt;span class=&quot;math-container&quot;&gt;$ad = bc$&lt;/span&gt; must be the neccesary condition for this to be true...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-28T17:05:25.177" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15731" PostTypeId="1" AcceptedAnswerId="15796" CreationDate="2021-01-28T17:26:37.533" Score="6" ViewCount="83" Body="&lt;p&gt;Quantum annealing can be thought of as a black box solver that can find approximate solutions to hard optimization problems. For example, D-Wave quantum annealers can approximately solve quadratic unconstrained binary optimization (QUBO) problems, which are known to be NP-hard.&lt;/p&gt;&#xA;&lt;p&gt;In this context, what is the computational complexity of quantum annealing? More specifically:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If the size of my problem is &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, how long will I need to run the quantum annealing process (as a function of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;) to obtain the exact solution?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Under an approximation algorithm / randomized algorithm setting, how many repetitions of quantum annealing will I have to perform to obtain an approximate solution that is within &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; error of the exact solution (for example, &lt;span class=&quot;math-container&quot;&gt;$\epsilon = 0.1$&lt;/span&gt; for getting a &lt;span class=&quot;math-container&quot;&gt;$10\%$&lt;/span&gt; error)?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In my experience running problems on the D-Wave, I have noticed that a constant annealing time in conjunction with a constant number of repetitions can find exact solutions for smaller-sized problems. However, quantum annealing is not as accurate on larger-sized problems.&lt;/p&gt;&#xA;" OwnerUserId="12614" LastEditorUserId="55" LastEditDate="2021-01-31T19:09:59.107" LastActivityDate="2021-02-02T02:15:40.943" Title="What is the computational complexity of quantum annealing?" Tags="&lt;complexity-theory&gt;&lt;d-wave&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15732" PostTypeId="2" ParentId="12334" CreationDate="2021-01-28T19:10:53.320" Score="3" Body="&lt;p&gt;There is no way to disable multiprocessing in TensorFlow Quantum without also affecting TensorFlow. That being said, there are still some workarounds to your problem that might be worth trying. It might help to take a look at changing the &lt;a href=&quot;https://www.tensorflow.org/api_docs/python/tf/config/threading/set_inter_op_parallelism_threads&quot; rel=&quot;nofollow noreferrer&quot;&gt;inter and intra op parallelism in tensorflow&lt;/a&gt; . If you are finding that TFQ isn't making full use of multiprocessing you might want to turn down the intra op parallelism.&lt;/p&gt;&#xA;&lt;p&gt;In the past when I've seen patterns like that in my code, a lot of times it had to do with other things like waiting for the &lt;code&gt;tfq.convert_to_tensor&lt;/code&gt; function to finish running in between each epoch and the fast C++ portion of my model finished so quickly that it just looked like a little blip on all the cores. Another common hiccup I'd hit is accidentally gathering the contents of a tensor and doing something like printing it, in between &amp;quot;hot paths&amp;quot; in the model. A good way to make these kinds of problems more apparent is to temporarily crank up the number of qubits and then try to isolate the major stages of your training loop to find the bottleneck. My personal guess in your case is that pure python code like &lt;code&gt;tfq.convert_to_tensor&lt;/code&gt; is being called in between the training epochs and the epochs themselves are still very fast.&lt;/p&gt;&#xA;&lt;p&gt;There was no code provided so I can't give any more help than just general advice, but if you are absolutely convinced it is not any of the things I mentioned above then you could use TensorBoard (tutorial with TFQ &lt;a href=&quot;https://www.tensorflow.org/quantum/tutorials/research_tools&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) to profile the underlying model code and see where things might be slowing down.&lt;/p&gt;&#xA;" OwnerUserId="11700" LastEditorUserId="10480" LastEditDate="2021-01-28T19:27:30.940" LastActivityDate="2021-01-28T19:27:30.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15733" PostTypeId="2" ParentId="15695" CreationDate="2021-01-28T20:53:29.327" Score="4" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; should still go from &lt;span class=&quot;math-container&quot;&gt;$[0, 2\pi]$&lt;/span&gt;, as &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; also has domain on &lt;span class=&quot;math-container&quot;&gt;$[0, 2\pi]$&lt;/span&gt;. See &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U1Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U1Gate.html&lt;/a&gt;. &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt; is cyclic mod &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; so in general one cannot distinguish &lt;span class=&quot;math-container&quot;&gt;$U1(x \pm 2\pi)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2800" LastActivityDate="2021-01-28T20:53:29.327" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15734" PostTypeId="1" CreationDate="2021-01-28T23:27:21.927" Score="3" ViewCount="131" Body="&lt;p&gt;How can I construct a controlled-Hadamard gate using single qubit gates and controlled phase-shift?&lt;/p&gt;&#xA;&lt;p&gt;I am stuck in this and any help would be appreciated.&lt;/p&gt;&#xA;" OwnerDisplayName="user14639" LastEditorUserId="10480" LastEditDate="2021-03-07T07:45:49.443" LastActivityDate="2021-03-07T07:45:49.443" Title="How to construct a controlled-Hadamard gate using single qubit gates and controlled phase-shift?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;textbook-and-exercises&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15735" PostTypeId="1" CreationDate="2021-01-28T23:27:21.923" Score="0" ViewCount="28" Body="&lt;p&gt;I am stuck in this and any help would be appreciated.&lt;/p&gt;&#xA;" OwnerDisplayName="user14639" LastActivityDate="2021-01-28T23:27:21.923" Title="How can I construct a Controlled-Hadamard gate using single qubit gates and Controlled phase-shift?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2021-01-29T08:01:03.423" ContentLicense="CC BY-SA 4.0" />
  <row Id="15736" PostTypeId="2" ParentId="15723" CreationDate="2021-01-29T01:29:26.417" Score="4" Body="&lt;p&gt;You can try to sign-up for the &lt;a href=&quot;https://www.ibm.com/quantum-computing/researchers-program/&quot; rel=&quot;nofollow noreferrer&quot;&gt;The IBM Quantum Researchers Program&lt;/a&gt; to have more flexibility to your account, but I don't think you will have access to their premium devices even with this option.&lt;/p&gt;&#xA;&lt;p&gt;However, someone asked about this not too long ago here &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/15536/9858&quot;&gt;in this question&lt;/a&gt; and the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15537/9858&quot;&gt;answered by Lena&lt;/a&gt; is to use &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/2_device_noise_simulation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;fake devices&lt;/a&gt; (simulators that are trying to mimic real hardware). The provided &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/test/mock/fake_provider.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;list of fake devices&lt;/a&gt; as pointed out by Lena's answer can be found here. So for instance, you can import in &lt;code&gt;FakeToronto&lt;/code&gt; and use it to mimic the results you would get when running your circuit through &lt;code&gt;imq_toronto&lt;/code&gt;. Of course, there will be differences but this at least give you some insight on what you might expect.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully this helps.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-29T01:29:26.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15737" PostTypeId="2" ParentId="15734" CreationDate="2021-01-29T02:06:18.370" Score="4" Body="&lt;p&gt;One strategy is to find a single-qubit rotation &lt;span class=&quot;math-container&quot;&gt;$R_{\hat n}$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{\hat n}(\theta) \, P(\phi) \, R_{\hat n}(-\theta) = H\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\hat n = (n_x, n_y, n_z)^T$&lt;/span&gt; is a real 3-vector of unit norm and &lt;span class=&quot;math-container&quot;&gt;$P(\phi) = \mathrm{diag}(1, e^{i\phi})$&lt;/span&gt; is a phase gate. The motivation behind this approach is the observation that when the phase gate &lt;span class=&quot;math-container&quot;&gt;$P(\phi)$&lt;/span&gt; is controlled by another qubit the sequence turns into the Hadamard gate when the control is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and into &lt;span class=&quot;math-container&quot;&gt;$R_1(\theta) R_1(-\theta) = I$&lt;/span&gt; when it is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;Now, we recognize &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; as &lt;a href=&quot;https://en.wikipedia.org/wiki/Diagonalizable_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix diagonalization&lt;/a&gt; which means that &lt;span class=&quot;math-container&quot;&gt;$P(\phi) = Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_{\hat n}(\theta)$&lt;/span&gt; is the matrix whose columns are the eigenvectors of the Hadamard.&lt;/p&gt;&#xA;&lt;p&gt;At this point, we could compute the eigenvectors. However, we notice that both the eigenvalues and the entries of the Hadamard matrix are real numbers. Therefore, the eigenvectors have real entries, too. We recall that among the rotations around &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axes, one has real entries&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y(\beta) = \begin{pmatrix}&#xA;\cos\frac{\beta}{2} &amp;amp; -\sin\frac{\beta}{2} \\&#xA;\sin\frac{\beta}{2} &amp;amp; \cos\frac{\beta}{2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so we are led to guess that a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; rotation might work. We try it out by substituting into &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}&#xA;\end{pmatrix} \begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix} \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; \sin\frac{\theta}{2} \\&#xA;-\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}&#xA;\end{pmatrix} \\= \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}&#xA;\end{pmatrix} \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; \sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp; -\cos\frac{\theta}{2}&#xA;\end{pmatrix} \\= \begin{pmatrix}&#xA;\cos\theta &amp;amp; \sin\theta \\&#xA;\sin\theta &amp;amp; -\cos\theta&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that we obtain the Hadamard if &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y\left(\frac{\pi}{4}\right) \circ CZ \circ R_y\left(-\frac{\pi}{4}\right) = CH\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CH$&lt;/span&gt; denote the controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and controlled-Hadamard gates.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-29T02:59:36.997" LastActivityDate="2021-01-29T02:59:36.997" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15738" PostTypeId="1" AcceptedAnswerId="15752" CreationDate="2021-01-29T06:48:44.707" Score="1" ViewCount="50" Body="&lt;p&gt;I'm reading an article about environmental monitoring and information transfer. Suppose &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; represents a quantum system and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is the environment. Assume at time &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt; there are no correlations between &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\rho_{SE}(0)=\rho_{S}(0)\otimes\rho_{E}(0)$&lt;/span&gt;, and this composite density operator evolved under the action of &lt;span class=&quot;math-container&quot;&gt;$U(t) = e^{-iHt/h}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the total Hamiltonian. Let &lt;span class=&quot;math-container&quot;&gt;$P_\alpha$&lt;/span&gt; be a projective operator on &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. Then, the probability of obtaining outcome &lt;span class=&quot;math-container&quot;&gt;$α$&lt;/span&gt; in this measurement when &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is described by the density operator &lt;span class=&quot;math-container&quot;&gt;$\rho_s(t)$&lt;/span&gt; is given as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Prob}(\alpha|\rho_s(t))=\text{Tr}_E (P_αρ_E(t))&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the density matrix of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; conditioned on the particular outcome &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_s^{\alpha}(t)= \frac{\text{Tr}_E\{(I\otimes P_\alpha)\rho_{SE}(t)(I\otimes P_\alpha)\}}{\text{Prob}(\alpha|\rho_s(t))}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering how those two equations coming from? Also, since the indirect measurement aims to yield information about S without performing a projective (and thus destructive) direct measurement on S, why there's &lt;span class=&quot;math-container&quot;&gt;$P_\alpha$&lt;/span&gt; in the equation? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="10480" LastEditDate="2021-01-30T03:59:45.337" LastActivityDate="2021-01-30T05:36:27.887" Title="How can I understand these two equations about the indirect measurement?" Tags="&lt;measurement&gt;&lt;decoherence&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="15739" PostTypeId="2" ParentId="15731" CreationDate="2021-01-29T08:12:51.010" Score="3" Body="&lt;p&gt;Currently, it is not preciselly known whether quantum annealers bring any significant speed up. Lets take some task having exponential complexity on classical computer. If you run it on quantum annealer it will probably run faster. However the reason is not reduced complexity (it is still exponential) but smaller constants in function decribing the task complexity.&lt;/p&gt;&#xA;&lt;p&gt;Concerning difficulties with reaching an optimum for large problems. This can be caused by a noise because inreasing the task size incerease a number of qubits involved. As a result, the level of noise is also increasing. Moreover, there is probably more entanglements in the larger problems. As entangled systems are fragile, this again probably causes difficulties with reaching the optimum.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-01-29T08:12:51.010" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15740" PostTypeId="2" ParentId="15725" CreationDate="2021-01-29T16:09:31.237" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle M\rangle=\sum_{j}p_{j}\langle\psi_{j}|M|\psi_{j}\rangle=\sum_{j}p_{j}\langle\psi_{j}|M\sum_{i}|e_{j}\rangle\langle e_{j}|\psi_{j}\rangle=\sum_{j}p_{j}\sum_{i}\langle e_{j}|\psi_{j}\rangle\langle\psi_{j}|M|e_{j}\rangle=\sum_{j}p_{j} tr(|\psi_{j}\rangle\langle\psi_{j}|M)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2021-01-29T16:09:31.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15741" PostTypeId="1" CreationDate="2021-01-29T16:20:14.000" Score="2" ViewCount="402" Body="&lt;p&gt;How do I find out what version of qiskit I am running?&lt;/p&gt;&#xA;" OwnerUserId="14646" LastEditorUserId="55" LastEditDate="2021-01-31T19:11:30.813" LastActivityDate="2021-05-13T07:46:21.530" Title="What qiskit version?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="5" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15742" PostTypeId="2" ParentId="15725" CreationDate="2021-01-29T16:33:27.110" Score="3" Body="&lt;p&gt;I think the easiest way to see this is through the fact that the trace is &lt;strong&gt;independent of the basis&lt;/strong&gt; in which we take it. That is, for any operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;strong&gt;any&lt;/strong&gt; orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|i\rangle\}_i$&lt;/span&gt; we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Tr}[A] = \sum_i \langle i | A | i \rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if &lt;span class=&quot;math-container&quot;&gt;$|\psi_j\rangle$&lt;/span&gt; is normalised we can just choose any orthonormal basis which includes &lt;span class=&quot;math-container&quot;&gt;$|\psi_j\rangle$&lt;/span&gt;, let's write such a basis as &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_j\rangle, |\psi_{j,1}^{\perp}\rangle, |\psi_{j,2}^{\perp}\rangle, \dots\}$&lt;/span&gt;. Then we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\mathrm{Tr}[|\psi_j\rangle \langle\psi_j|M] &amp;amp;= \langle\psi_j|\psi_j\rangle\langle\psi_j|M|\psi_j\rangle + \sum_{i} \langle\psi_{j,i}^{\perp}|\psi_j\rangle\langle\psi_j|M|\psi_{j,i}^{\perp}\rangle  \\&#xA;&amp;amp;= \langle\psi_j|\psi_j\rangle\langle\psi_j|M|\psi_j\rangle \\&#xA;&amp;amp;= \langle\psi_j|M|\psi_j\rangle,&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;where on the second line we used the fact that &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_{j,i}^{\perp}|\psi_j\rangle = 0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; as they form an orthonormal basis and on the final line we used normalization &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_j|\psi_j\rangle = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="4991" LastEditDate="2021-01-29T16:57:44.047" LastActivityDate="2021-01-29T16:57:44.047" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15743" PostTypeId="2" ParentId="15741" CreationDate="2021-01-29T16:34:21.630" Score="5" Body="&lt;p&gt;You can use the command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.__qiskit_version__&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Current qiskit version is 0.23.4 as you can see below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'qiskit-terra': '0.16.3',&#xA; 'qiskit-aer': '0.7.3',&#xA; 'qiskit-ignis': '0.5.1',&#xA; 'qiskit-ibmq-provider': '0.11.1',&#xA; 'qiskit-aqua': '0.8.1',&#xA; 'qiskit': '0.23.4'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to see the changes in different versions then you can check the &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html&quot; rel=&quot;noreferrer&quot;&gt;Release Note&lt;/a&gt; posted by the IBM team when there is an update to the system.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-29T16:34:21.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15744" PostTypeId="2" ParentId="15741" CreationDate="2021-01-29T16:35:50.467" Score="2" Body="&lt;p&gt;Here is the code you need to run to know which version you have:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.tools.jupyter&#xA;%qiskit_version_table&#xA;%qiskit_copyright&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to check the latest version, you can go read the &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;release notes&lt;/a&gt; :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-01-29T16:35:50.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15747" PostTypeId="2" ParentId="14544" CreationDate="2021-01-29T21:17:16.540" Score="1" Body="&lt;p&gt;Yes, Alice and Bob can do better than option 1. However, Alice needs to send 2 classical bits to Bob. This is more than in option 2, but is still independent of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The idea is that instead of performing a measurement Alice applies a unitary to rotate the measured subspace onto an auxiliary qubit and then teleports the auxiliary qubit to Bob who performs the measurement.&lt;/p&gt;&#xA;&lt;p&gt;Note that option 2 only succeeds in transmitting measurement outcome and not the post-measurement state, so we assume that this is the goal of the protocol.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Alice's unitary&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose Alice has an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi_R\rangle$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; be the measurement projectors. By definition, the projectors satisfy the completeness and orthogonality relations&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P_0 + P_1 = I\\&#xA;P_0P_1 = 0.\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Define the &lt;span class=&quot;math-container&quot;&gt;$(n+1)$&lt;/span&gt;-qubit operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on the input register &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and an auxiliary qubit &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U |\psi_R\rangle|0_M\rangle = P_0|\psi_R\rangle|0_M\rangle + P_1|\psi_R\rangle|1_M\rangle \\&#xA;U |\psi_R\rangle|1_M\rangle = P_0|\psi_R\rangle|1_M\rangle + P_1|\psi_R\rangle|0_M\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;or in block matrix form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{pmatrix}&#xA;P_0 &amp;amp; P_1\\&#xA;P_1 &amp;amp; P_0&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; it is easily checked that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Protocol&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Alice prepares an auxiliary qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0_M\rangle$&lt;/span&gt; state and applies the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi_R\rangle|0_M\rangle$&lt;/span&gt;. Next, she teleports the state of the auxiliary qubit &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; to Bob at the cost of transmitting two classical bits and consuming a Bell pair &lt;span class=&quot;math-container&quot;&gt;$(|0_A0_B\rangle + |1_A1_B\rangle)/\sqrt{2}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the Alice's half of the pair and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the Bob's half. Note that teleportation preserves entanglement, so after teleportation the joint state of &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\gamma_{RB}\rangle = P_0|\psi_R\rangle|0_B\rangle + P_1|\psi_R\rangle|1_B\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, Bob measures &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in computational basis.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Correctness&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;We need to prove that measuring &lt;span class=&quot;math-container&quot;&gt;$P_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_1$&lt;/span&gt; on the input state &lt;span class=&quot;math-container&quot;&gt;$|\psi_R\rangle$&lt;/span&gt; has the same output statistics as measuring the post-teleportation state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in computational basis. The probability of the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; outcome in the former case is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(0|\psi_R) = \langle\psi_R|P_0|\psi_R\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and in the latter case it is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(0|\rho_B) = \langle 0|\rho_B|0\rangle = \langle\psi_R|P_0|\psi_R\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_B = \mathrm{tr}_R(|\gamma_{RB}\rangle\langle\gamma_{RB}|) = \langle\psi_R|P_0|\psi_R\rangle|0_B\rangle\langle 0_B| + \langle\psi_R|P_1|\psi_R\rangle|1_B\rangle\langle 1_B|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is the post-teleportation state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Teleportation preserves entanglement&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Teleportation is often described as a protocol on three qubits &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in an arbitrary single-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi_B\rangle = \alpha|0_B\rangle + \beta|1_B\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CD$&lt;/span&gt; in the Bell state &lt;span class=&quot;math-container&quot;&gt;$(|0_C0_D\rangle + |1_C1_D\rangle)/\sqrt{2}$&lt;/span&gt; at the end of which the qubit &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_D\rangle = \alpha|0_D\rangle + \beta|1_D\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose that the input qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is entangled with a qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in a joint state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_{AB}\rangle = \alpha|0_A0_B\rangle + \beta|0_A1_B\rangle + \gamma|1_A0_B\rangle + \delta|1_A1_B\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We will show that at the end of the standard teleportation protocol the qubits &lt;span class=&quot;math-container&quot;&gt;$AD$&lt;/span&gt; are in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi_{AD}\rangle = \alpha|0_A0_D\rangle + \beta|0_A1_D\rangle + \gamma|1_A0_D\rangle + \delta|1_A1_D\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;thus proving that any entanglement the input qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; has with another system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is preserved by the teleportation channel.&lt;/p&gt;&#xA;&lt;p&gt;The initial state of the composite system &lt;span class=&quot;math-container&quot;&gt;$ABCD$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\frac{1}{\sqrt{2}} (&amp;amp;\alpha|00\rangle(|00\rangle +|11\rangle)\, + \\&#xA;&amp;amp; \beta|01\rangle(|00\rangle +|11\rangle)\, +\\&#xA;&amp;amp; \gamma|10\rangle(|00\rangle +|11\rangle)\, +\\&#xA;&amp;amp; \delta|11\rangle(|00\rangle +|11\rangle))&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we have elided subsystem labels for legibility. After the CNOT gate with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as the control and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; as the target and the Hadamard gate on &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, the state of &lt;span class=&quot;math-container&quot;&gt;$ABCD$&lt;/span&gt; becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;&amp;amp; \frac{1}{2}(\alpha|0000\rangle + \beta|0001\rangle + \gamma|1000\rangle + \delta|1001\rangle)\, + \\&#xA;&amp;amp; \frac{1}{2}(\alpha|0011\rangle + \beta|0010\rangle + \gamma|1011\rangle + \delta|1010\rangle)\, + \\&#xA;&amp;amp; \frac{1}{2}(\alpha|0100\rangle - \beta|0101\rangle + \gamma|1100\rangle - \delta|1101\rangle)\, + \\&#xA;&amp;amp; \frac{1}{2}(\alpha|0111\rangle - \beta|0110\rangle + \gamma|1111\rangle - \delta|1110\rangle)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we have grouped the terms according to the state of the &lt;span class=&quot;math-container&quot;&gt;$BC$&lt;/span&gt; subsystem. It is immediate that if measurement of &lt;span class=&quot;math-container&quot;&gt;$BC$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$AD$&lt;/span&gt; collapses to &lt;span class=&quot;math-container&quot;&gt;$|\phi_{AD}\rangle$&lt;/span&gt; as promised. Similarly, we see that the usual &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; corrections on &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; conditioned on the measurement results transform each of the other three groups into &lt;span class=&quot;math-container&quot;&gt;$|\phi_{AD}\rangle$&lt;/span&gt; as well. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-30T03:39:34.340" LastActivityDate="2021-01-30T03:39:34.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15748" PostTypeId="1" AcceptedAnswerId="15749" CreationDate="2021-01-29T22:23:12.870" Score="3" ViewCount="62" Body="&lt;p&gt;This is what drawing a circuit looks like in the Qiskit textbook:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/fIVoY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fIVoY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and this is the ugly version I am stuck with in my own notebooks:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TGFwE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TGFwE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;On their &lt;a href=&quot;https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Prerequisites&lt;/a&gt; page they write:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mHkou.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mHkou.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, there is no .qiskit file in my home directory, and I can't locate it anywhere else. I installed it simply with the usual pip install command, without setting up any virtual environment, so that may be the issue. I am not a Linux expert so perhaps there is something simple I am missing.&lt;/p&gt;&#xA;&lt;p&gt;How can I set up this configuration file? Creating a .qiskit directory manually doesn't do the job.&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="55" LastEditDate="2021-01-31T19:11:45.693" LastActivityDate="2021-01-31T19:11:45.693" Title="Visualizing nice circuits in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15749" PostTypeId="2" ParentId="15748" CreationDate="2021-01-29T23:17:06.183" Score="0" Body="&lt;p&gt;As James noted in the comment. You can use the &lt;code&gt;.draw( output = 'mpl', ... )&lt;/code&gt;  or  to help you to get a nicer figure. That is, suppose I have the following circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ┤ X ├┤M├─────────&#xA;     ├───┤└╥┘┌─┐      &#xA;q_1: ┤ X ├─╫─┤M├──────&#xA;     ├───┤ ║ └╥┘┌─┐   &#xA;q_2: ┤ H ├─╫──╫─┤M├───&#xA;     ├───┤ ║  ║ └╥┘┌─┐&#xA;q_3: ┤ H ├─╫──╫──╫─┤M├&#xA;     └───┘ ║  ║  ║ └╥┘&#xA;c: 4/══════╩══╩══╩══╩═&#xA;           0  1  2  3 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which can be created by running the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from numpy import pi&#xA;&#xA;qreg_q = QuantumRegister(4, 'q')&#xA;creg_c = ClassicalRegister(4, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.x(qreg_q[0])&#xA;circuit.x(qreg_q[1])&#xA;circuit.h(qreg_q[2])&#xA;circuit.h(qreg_q[3])&#xA;circuit.measure(qreg_q[0], creg_c[0])&#xA;circuit.measure(qreg_q[1], creg_c[1])&#xA;circuit.measure(qreg_q[2], creg_c[2])&#xA;circuit.measure(qreg_q[3], creg_c[3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then by specifying:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw( output = 'mpl', style={'name': 'bw'}, plot_barriers= True, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I will get the figure:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/o1s5T.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o1s5T.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if i specify:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw( output = 'latex',style={'name': 'bw'}, plot_barriers= True, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I will get the figure:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BUC9t.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BUC9t.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if you want to &lt;strong&gt;save the image file&lt;/strong&gt;, then include the file name in the option. That is, something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw( 'mpl',style={'name': 'bw'},filename= 'MyCircuit', plot_barriers= True, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-29T23:17:06.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15750" PostTypeId="1" AcceptedAnswerId="15753" CreationDate="2021-01-30T04:13:56.237" Score="4" ViewCount="144" Body="&lt;p&gt;In PennyLane, the following circuit returns the expectation value of the &lt;code&gt;PauliZ&lt;/code&gt; observable on qubit (wire) 1:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def my_quantum_function(x, y):&#xA;    qml.RZ(x, wires=0)&#xA;    qml.CNOT(wires=[0, 1])&#xA;    qml.RY(y, wires=1)&#xA;    return qml.expval(qml.PauliZ(1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What if I instead wanted to return the expectation value of an operator &lt;span class=&quot;math-container&quot;&gt;$H = Z_1Z_2$&lt;/span&gt; that acts on the first and the second qubit? How might I do that?&lt;/p&gt;&#xA;&lt;p&gt;It is my understanding that qubits 1 and 2 are &amp;quot;correlated&amp;quot; because of the CNOT, so &lt;span class=&quot;math-container&quot;&gt;$\left\langle Z_1 Z_2 \right\rangle \neq \left\langle Z_1 \right\rangle \left\langle Z_2 \right\rangle$&lt;/span&gt;. Does this mean I have to define a custom operator? Or does &lt;code&gt;[qml.expval(qml.PauliZ(i)) for i in range(2)]&lt;/code&gt; achieve what I want? Thanks for any help.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: The above example function was taken from the &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/introduction/measurements.html&quot; rel=&quot;noreferrer&quot;&gt;PennyLane measurements documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-01-30T13:51:20.723" Title="Computing expectation value of product of observables in PennyLane" Tags="&lt;programming&gt;&lt;measurement&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;pennylane&gt;&lt;quantum-neural-network&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15751" PostTypeId="2" ParentId="15750" CreationDate="2021-01-30T04:48:43.827" Score="4" Body="&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; the following should work:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n_qubits = 2&#xA;Z = [ [1,0], [0,-1]]&#xA;ZZ = np.kron(Z,Z)&#xA;&#xA;@qml.qnode(dev)&#xA;def circuit(params):&#xA;    qml.RY(params[0], wires=0)&#xA;    qml.CNOT(wires=[0, 1])&#xA;    qml.RY(params[1], wires=1)    &#xA;    return qml.expval(qml.Hermitian(ZZ, wires=[0, 1]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-30T04:48:43.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15752" PostTypeId="2" ParentId="15738" CreationDate="2021-01-30T05:36:27.887" Score="2" Body="&lt;p&gt;The two equations are part of the measurement postulate of quantum mechanics which states that probability of the outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; in a measurement described by operators &lt;span class=&quot;math-container&quot;&gt;$M_m$&lt;/span&gt; on a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m) = \mathrm{tr}(M_m^\dagger M_m \rho)\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(c.f. &lt;span class=&quot;math-container&quot;&gt;$(2.159)$&lt;/span&gt; in Nielsen &amp;amp; Chuang) and the post-measurement state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{M_m\rho M_m^\dagger}{\mathrm{tr}(M_m^\dagger M_m \rho)}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(c.f. &lt;span class=&quot;math-container&quot;&gt;$(2.160)$&lt;/span&gt; in Nielsen &amp;amp; Chuang).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The first equation in the question follows from substitutions&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;m = \alpha \\&#xA;\rho = \rho_E(t) \\&#xA;M_m = P_\alpha&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. The second follows from substitutions&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \rho_{SE}(t) \\&#xA;M_m = I\otimes P_\alpha&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;followed by partial trace over the environment on the post-measurement state.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-01-30T05:36:27.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15753" PostTypeId="2" ParentId="15750" CreationDate="2021-01-30T09:32:03.357" Score="5" Body="&lt;p&gt;PennyLane supports measurements of tensor products of observable via the &lt;code&gt;@&lt;/code&gt; operator, like so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@qml.qnode(dev)&#xA;def my_quantum_function(x, y):&#xA;    qml.RZ(x, wires=0)&#xA;    qml.CNOT(wires=[0, 1])&#xA;    qml.RY(y, wires=1)&#xA;    return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This should return the same result as the solution by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15751/371&quot;&gt;KAJ226&lt;/a&gt; above, but will be slightly more efficient as it is avoiding creating a potentially large dense matrix.&lt;/p&gt;&#xA;&lt;p&gt;There are some examples on &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/introduction/measurements.html#tensor-observables&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor observables&lt;/a&gt; in the PennyLane documentation.&lt;/p&gt;&#xA;" OwnerUserId="371" LastEditorUserId="371" LastEditDate="2021-01-30T13:51:20.723" LastActivityDate="2021-01-30T13:51:20.723" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15754" PostTypeId="1" AcceptedAnswerId="15798" CreationDate="2021-01-30T10:08:20.303" Score="2" ViewCount="152" Body="&lt;p&gt;Consider a Haar random quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;. I was confused between two facts about &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;, which appear related:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Consider the output distribution of a &lt;em&gt;&lt;strong&gt;particular &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;. For a large enough &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, the probability of what fraction of strings in the output distribution of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; lie between &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^{n}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{2^{n}}$&lt;/span&gt; (or between any two numbers)? According to the formulas in the &lt;a href=&quot;https://arxiv.org/pdf/1910.11333.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;supplement&lt;/a&gt; of the Google paper (section IV C, page 9) and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15013/question-regarding-integration-of-haar-random-state&quot;&gt;this&lt;/a&gt; answer, the answer is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int_\frac{1}{2^{n}}^\frac{2}{2^{n}} 2^n e^{-2^np} dp.$$&lt;/span&gt;&#xA;How to prove this? Also, is this statement true for &lt;em&gt;any&lt;/em&gt; Haar-random &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, or only &lt;em&gt;with high probability over&lt;/em&gt; a particular choice of a Haar-random &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;? For example, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; could be something trivial like &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; and this statement would not hold.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;We know that for a &lt;em&gt;&lt;strong&gt;particular output string &lt;span class=&quot;math-container&quot;&gt;$z \in \{0, 1\}^{n}$&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;, if we define &lt;span class=&quot;math-container&quot;&gt;$p_z = |\langle z| \psi \rangle|^{2}$&lt;/span&gt;, then the random variable &lt;span class=&quot;math-container&quot;&gt;$p_z$&lt;/span&gt; (for a fixed &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;, but for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; chosen uniformly at random from the Haar measure) follows the Porter-Thomas distribution, for every such fixed &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. The probability density function of the Porter-Thomas distribution is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\text{PorterThomas}(p) \sim 2^{n} e^{-2^{n}p}.&#xA;\end{equation}&lt;/span&gt;&#xA;The same density function also appears inside the integration in the first item. Is this just a coincidence, or are these facts related? The two situations do not seem related (we are interested in a particular &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; for the first one and a particular &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; for the second one) and I do not see an obvious way of going from one to another.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="10480" LastEditDate="2021-02-02T18:38:18.020" LastActivityDate="2021-02-02T18:38:18.020" Title="Confusion about the output distribution of Haar random quantum states" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;quantum-advantage&gt;&lt;probability&gt;&lt;haar-distribution&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15755" PostTypeId="1" CreationDate="2021-01-30T13:48:49.340" Score="3" ViewCount="145" Body="&lt;p&gt;I am trying to compute the ground state energy of He-He using VQE. For this purpose I have utilized Qskit and have written the following script:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.aqua.algorithms import VQE&#xA;from qiskit.circuit.library import TwoLocal&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;&#xA;molecule = Molecule(geometry=[['He', [0., 0., 0.]],&#xA;                              ['He', [0., 0., 3.1]]],&#xA;                     charge=0, multiplicity=1)&#xA;&#xA;driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER)&#xA;&#xA;numpy_solver = NumPyMinimumEigensolver()&#xA;vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;&#xA;&#xA;num_qubits = 4&#xA;tl_circuit = TwoLocal(num_qubits, ['h', 'rx'], 'cz',&#xA;                      entanglement='full', reps=3, parameter_prefix = 'y')&#xA;&#xA;tl_circuit.draw(output = 'mpl')&#xA;&#xA;another_solver = VQE(var_form = tl_circuit,&#xA;                     quantum_instance = QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;&#xA;&#xA;calc = GroundStateEigensolver(transformation, vqe_solver)&#xA;res = calc.solve(driver)&#xA;&#xA;print(transformation)&#xA;print(res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I run it I get a following error message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &amp;quot;test_remove.py&amp;quot;, line 37, in &amp;lt;module&amp;gt;&#xA;    res = calc.solve(driver)&#xA;  File &amp;quot;/Users/monica/miniconda3/lib/python3.7/site-packages/qiskit/chemistry/algorithms/ground_state_solvers/ground_state_eigensolver.py&amp;quot;, line 94, in solve&#xA;    solver = self._solver.get_solver(self.transformation)&#xA;  File &amp;quot;/Users/monica/miniconda3/lib/python3.7/site-packages/qiskit/chemistry/algorithms/ground_state_solvers/minimum_eigensolver_factories/vqe_uccsd_factory.py&amp;quot;, line 212, in get_solver&#xA;    same_spin_doubles=self._same_spin_doubles)&#xA;  File &amp;quot;/Users/monica/miniconda3/lib/python3.7/site-packages/qiskit/chemistry/components/variational_forms/uccsd.py&amp;quot;, line 153, in __init__&#xA;    excitation_type=self._excitation_type,)&#xA;  File &amp;quot;/Users/monica/miniconda3/lib/python3.7/site-packages/qiskit/chemistry/components/variational_forms/uccsd.py&amp;quot;, line 509, in compute_excitation_lists&#xA;    raise ValueError('No unoccupied orbitals')&#xA;ValueError: No unoccupied orbitals&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Can anyone explain to me what is going on? What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="14660" LastEditorUserId="10480" LastEditDate="2021-01-30T22:56:10.820" LastActivityDate="2021-03-01T23:10:41.253" Title="Simulation of a helium molecule using Qskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15756" PostTypeId="1" CreationDate="2021-01-30T13:54:30.550" Score="2" ViewCount="35" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/1411.4028.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;QAOA&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0001106.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;AQC&lt;/a&gt;  the problem Hamiltonian is always a Phase Hamiltonian (meaning only phases are added)&lt;/p&gt;&#xA;&lt;p&gt;Is that part of the QAOA and AQC definition or it is only used because it is convenient and work?&lt;/p&gt;&#xA;&lt;p&gt;If one uses non phase Hamiltonians with  QAOA or AQC, (theoretically the Adiabatic theorem would still work) would it still be considered to be QAOA and AQC?&lt;/p&gt;&#xA;&lt;p&gt;Thanks for reading.&lt;/p&gt;&#xA;" OwnerUserId="11646" LastActivityDate="2021-01-30T13:54:30.550" Title="Is the problem Hamiltonian in QAOA and AQC always a phase Hamiltonian?" Tags="&lt;qaoa&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15757" PostTypeId="1" CreationDate="2021-01-30T14:00:53.067" Score="3" ViewCount="46" Body="&lt;p&gt;I'm doing a university thesis using IBM's quantum backends. In my analysis I am making some considerations on what differentiates one backend from another other than the &lt;strong&gt;number of qubits&lt;/strong&gt; and &lt;strong&gt;quantum volume&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The parameters that come into play are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Frequency&lt;/strong&gt;: the difference in energy between the ground and exicted states&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Readout Error&lt;/strong&gt;: the error in measuring qubit&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;T1&lt;/strong&gt;: the relaxation time&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;T2&lt;/strong&gt;: the coherence time&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CNOT error&lt;/strong&gt;: the error on operating the 2-qubit gate&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Sqrt-x (sx) error&lt;/strong&gt;: ?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Anharmonicity&lt;/strong&gt;: ?&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Gate time&lt;/strong&gt;: ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The last three I have not yet understood.&lt;/p&gt;&#xA;&lt;p&gt;Is each single qubit powered individually or does it follow the topological configuration of the backend?&lt;/p&gt;&#xA;&lt;p&gt;For example if I used a 5 qubit system and used the linear configuration 0-1-2-3-4 and used 0-1 and 3-4. Does the current have to go from 2 to get to 3-4? Or are they powered individually?&lt;/p&gt;&#xA;&lt;p&gt;I tried to look for articles and information on the internet that gave me these answers but I did not find anything, if you have any material that may be useful to me, please link it to me!&lt;/p&gt;&#xA;" OwnerUserId="14162" LastActivityDate="2021-01-30T14:00:53.067" Title="IBM QE - Parameters that differentiate the various backends" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15758" PostTypeId="2" ParentId="15755" CreationDate="2021-01-30T14:44:38.800" Score="0" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.components.optimizers import COBYLA&#xA;from qiskit.aqua.algorithms import VQE&#xA;from qiskit.circuit.library import TwoLocal&#xA;from qiskit.chemistry.qmolecule import QMolecule&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType&#xA;from qiskit.chemistry import FermionicOperator&#xA;from qiskit.chemistry.core import Hamiltonian, TransformationType, QubitMappingType&#xA;&#xA;import warnings&#xA;warnings.filterwarnings(&amp;quot;ignore&amp;quot;,category=DeprecationWarning)&#xA;&#xA;&#xA;##### Defining Molecular Structure #######&#xA;atom_structure = &amp;quot;He 0. 0. 0.; He 3.1 0. 0&amp;quot;  &#xA;[unit, charge, spin, basis]= [UnitsType.ANGSTROM, 0, 0, 'sto3g'] &#xA;driver = PySCFDriver(atom= atom_structure, unit=unit,charge=charge, spin=spin, basis=basis)&#xA;qmolecule = driver.run()&#xA;ferOp = Hamiltonian(transformation = TransformationType.FULL , &#xA;                    qubit_mapping = QubitMappingType.PARITY,&#xA;                    two_qubit_reduction = True,&#xA;                    freeze_core = True, &#xA;                    orbital_reduction = [ ], &#xA;                    z2symmetry_reduction = None)&#xA;qubitOp, aux_ops = ferOp.run(qmolecule)&#xA;print( qubitOp.print_details() )&#xA;&#xA;##### Exact Diagonalization Result ########&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver&#xA;exact_result = NumPyMinimumEigensolver(qubitOp).run() &#xA;print('THis is the exact result:', exact_result)&#xA;&#xA;&#xA;##### VQE Result #######&#xA;tl_circuit = TwoLocal(qubitOp.num_qubits, ['h', 'rx'], 'cz',&#xA;                      entanglement='full', reps=3, parameter_prefix = 'y')&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_qasm_simulator')&#xA;quantum_instance = QuantumInstance(backend,&#xA;                                   shots = 8192,&#xA;                                   initial_layout = None,&#xA;                                   optimization_level = 3)  &#xA;&#xA;optimizer = COBYLA(maxiter= 100,tol=0.000000001)   &#xA;vqe = VQE(qubitOp, tl_circuit, optimizer,initial_point= None)&#xA;vqe_result = vqe.run(quantum_instance)&#xA;vqe_result&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that by specifying &lt;code&gt;freeze_core = True&lt;/code&gt; and &lt;code&gt;z2symmetry_reduction = 'auto' &lt;/code&gt; will help with reducing the number of qubits needed to solve your problem.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-01-30T15:07:22.890" LastActivityDate="2021-01-30T15:07:22.890" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15759" PostTypeId="1" AcceptedAnswerId="15760" CreationDate="2021-01-30T15:15:26.267" Score="3" ViewCount="46" Body="&lt;p&gt;I am working on designing quantum error mitigation algorithms for simulating chemical systems. Therefore, a necessary component is to add noisy to the ideal circuit when using a quantum simulator. But I notice there is no such features in the official documentation of openfermion.&#xA;Is there a way to add noise to the circuit in openfermion?&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="55" LastEditDate="2021-01-31T19:12:34.290" LastActivityDate="2021-01-31T19:12:34.290" Title="noisy circuit by openfermion" Tags="&lt;programming&gt;&lt;simulation&gt;&lt;noise&gt;&lt;openfermion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15760" PostTypeId="2" ParentId="15759" CreationDate="2021-01-30T16:38:11.523" Score="2" Body="&lt;p&gt;Note that OpenFermion interoperates with cirq to provide many features that are not specific to quantum chemistry. You can add noise to your circuits like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;noisy = ideal.with_noise(cirq.depolarize(p=0.01))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;ideal&lt;/code&gt; and &lt;code&gt;noisy&lt;/code&gt; are instances of &lt;code&gt;cirq.Circuit&lt;/code&gt;. Alternatively, you can use a simulator such as &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/cirq/sim/density_matrix_simulator.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cirq.DensityMatrixSimulator&lt;/code&gt;&lt;/a&gt; which allows you to add noise to the simulation, e.g.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;noise = cirq.ConstantQubitNoiseModel(cirq.depolarize(0.01))&#xA;noisy_simulator = cirq.DensityMatrixSimulator(noise=noise)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/master/docs/noise.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this notebook&lt;/a&gt; for more details and code examples for both approaches.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-30T16:43:28.340" LastActivityDate="2021-01-30T16:43:28.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15762" PostTypeId="1" AcceptedAnswerId="15763" CreationDate="2021-01-31T00:14:49.663" Score="3" ViewCount="54" Body="&lt;p&gt;We know that the entangled states cannot be expressed like product state, e.g. &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle = |\psi\rangle\otimes|\phi\rangle$&lt;/span&gt;. In the density matrix describing the correlations between system &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and environment &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; we sometimes assume that there are no correlations between &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; at &lt;span class=&quot;math-container&quot;&gt;$t=0$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$\rho_{SE}(0)=\rho_S(0)\otimes\rho_E(0)$&lt;/span&gt;. I'm wondering what 'correlation' means here? Is this equation implying there's 'no coupling' or 'no entanglement' between &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;? (I'm still a bit confused with the difference)&lt;/p&gt;&#xA;&lt;p&gt;Also in a quantum circuit, can we say that the qubits are coupled as long as there's some gate(s) acting on each qubit, but they are entangled only if some states in the final simulation result cannot be decomposed like the product state?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="10480" LastEditDate="2021-01-31T07:32:06.767" LastActivityDate="2021-01-31T17:11:11.483" Title="$\rho_{SE}(0)=\rho_S(0)\otimes\rho_E(0)$: No coupling or no entanglement?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;correlations&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15763" PostTypeId="2" ParentId="15762" CreationDate="2021-01-31T05:00:11.827" Score="3" Body="&lt;p&gt;&lt;em&gt;Coupling&lt;/em&gt; is a dynamic concept that characterizes the evolution of a composite system. It means that the evolution involves an interaction between subsystems. In a quantum circuit, coupling corresponds to multi-qubit gates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Entanglement&lt;/em&gt; is a static concept that characterizes the state of a system. It is related to coupling in that it arises due to coupled evolution.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Correlation&lt;/em&gt; is an overloaded term. In statistics and probability, it usually refers to a linear dependence between two random variables, but in the broadest sense it &lt;a href=&quot;https://en.wikipedia.org/wiki/Correlation_and_dependence&quot; rel=&quot;nofollow noreferrer&quot;&gt;denotes&lt;/a&gt; non-linear dependence also. In quantum physics, the term also encompasses entanglement, because like classical correlation entanglement gives rise to dependence between observables.&lt;/p&gt;&#xA;&lt;p&gt;Quantum states can exhibit either type of correlation. For example, two qubits &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; in the joint state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB} = \frac{1}{2}\begin{pmatrix}&#xA;0 &amp;amp; &amp;amp; &amp;amp; \\&#xA;&amp;amp; 1 &amp;amp; &amp;amp; \\&#xA;&amp;amp; &amp;amp; 1 &amp;amp; \\&#xA;&amp;amp; &amp;amp; &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are correlated, because the knowledge that the qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; reveals that qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. However, the correlation is classical since the state describes a probability distribution over product states&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{AB} = \frac{|01\rangle\langle 01| + |10\rangle\langle 10|}{2},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;not a superposition. It contains no entanglement, in contrast to a state such as &lt;span class=&quot;math-container&quot;&gt;$\beta_{AB} = (|01\rangle + |10\rangle)/\sqrt{2}$&lt;/span&gt; which is a superposition in the joint Hilbert space of the qubits.&lt;/p&gt;&#xA;&lt;p&gt;Product states like &lt;span class=&quot;math-container&quot;&gt;$\rho_S \otimes \rho_E$&lt;/span&gt; contain neither classical correlations (like those in &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;) nor entanglement (like that in &lt;span class=&quot;math-container&quot;&gt;$\beta_{AB}$&lt;/span&gt;). Consequently, outcome distributions of any pair of measurements on &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; are independent. Therefore, people often say that these states have no correlations.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-31T17:11:11.483" LastActivityDate="2021-01-31T17:11:11.483" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15764" PostTypeId="1" AcceptedAnswerId="15785" CreationDate="2021-01-31T11:50:54.233" Score="3" ViewCount="62" Body="&lt;p&gt;I was trying to calculate the threshold of &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt;-qubit Shor's code. The error channel is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$E=(1-p)I+p/3X+p/3Y+p/3Z.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I got the threshold is equal to 1. How can I get the right threshold (I believe it will be smaller than 0.5)? I tried to code by Qiskit but still wrong...&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AG0nH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AG0nH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14585" LastEditorUserId="55" LastEditDate="2021-02-02T10:29:56.993" LastActivityDate="2021-02-02T10:29:56.993" Title="How to compute the error threshold for the $9$-qubit Shor code?" Tags="&lt;algorithm&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15765" PostTypeId="1" CreationDate="2021-01-31T11:56:16.570" Score="3" ViewCount="61" Body="&lt;p&gt;I recently came to know that there is a connection between Bures Fidelity &lt;span class=&quot;math-container&quot;&gt;$(F_B)$&lt;/span&gt; and Quantum Fisher Information &lt;span class=&quot;math-container&quot;&gt;$(F_Q)$&lt;/span&gt; given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F_{B}(\rho, \rho_\theta) = 1 - \frac{\theta^2}{4} F_Q[\rho, A] + \text{order}(\theta^3),$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho_\theta = \exp(-iA\theta)\rho \exp(iA\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$F_B(\rho_1, \rho_2) = \mathrm{Tr}\Big[ \sqrt{\sqrt{\rho_1}~ \rho_2~ \sqrt{\rho_1}}\Big]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How can one derive this result?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;http://optics.szfki.kfki.hu/%7Etoth/Transparencies/Talk_DPG2019_Rostock_Tutorial.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here is the link to my source&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14671" LastEditorUserId="55" LastEditDate="2021-02-02T10:30:10.793" LastActivityDate="2021-02-02T10:30:10.793" Title="How is the connection between Bures fidelity and quantum Fisher information derived?" Tags="&lt;information-theory&gt;&lt;fidelity&gt;&lt;quantum-fisher-information&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15766" PostTypeId="1" AcceptedAnswerId="15838" CreationDate="2021-01-31T17:27:45.220" Score="2" ViewCount="92" Body="&lt;p&gt;In general I understand Grover's algorithm, how we can think of two separated state spaces, a space &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; with no solutions and a space &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle$&lt;/span&gt; with only solutions, and how the Grover operator rotates the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into the solution space &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the implementation of grover, we use &lt;span class=&quot;math-container&quot;&gt;$|000...0\rangle$&lt;/span&gt; as the state to reflect about. The math and how the inversion around the mean operator is constructed, this appears to be an easy and elegant way. The math adds up. I'm not clear how to justify the use of this particular state. Can't we use others as axes, and if not, why not?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="11582" LastEditorUserId="11582" LastEditDate="2021-02-03T06:13:02.353" LastActivityDate="2021-02-04T15:27:19.047" Title="Why does Grover's algorithm rotate around $|000...0\rangle$?" Tags="&lt;algorithm&gt;&lt;textbook-and-exercises&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15767" PostTypeId="2" ParentId="15741" CreationDate="2021-01-31T17:32:43.813" Score="2" Body="&lt;p&gt;I believe the &lt;strong&gt;qiskit_version&lt;/strong&gt; command only works inside of a python virtual env with qiskit installed.&lt;/p&gt;&#xA;&lt;p&gt;So, I recommended to install qiskit inside of a Python virtual environment for better experience and performance as suggested &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and that should help with your question too.&lt;/p&gt;&#xA;&lt;p&gt;Once a Python virtual environment is created using conda (Anaconda), install qiskit using pip install qiskit. Then import qiskit into your virtual environment and run &lt;strong&gt;qiskit_version&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;open the directory in which you want to work in the terminal and then...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;conda create -n qiskit_virtualenv python=3.8&#xA;&#xA;conda activate qiskit_virtualenv&#xA;&#xA;pip install qiskit&#xA;&#xA;import qiskit&#xA;&#xA;__qiskit_version__&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14673" LastActivityDate="2021-01-31T17:32:43.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15768" PostTypeId="1" CreationDate="2021-01-31T17:43:48.670" Score="1" ViewCount="51" Body="&lt;p&gt;I'm thinking about a modified version of the CHSH game and I'm trying to convince myself that in this case, entanglement cannot be used to gain an advantage or else it would imply signalling is possible through entanglement (i.e. contradicting the no-signalling theorem).&lt;/p&gt;&#xA;&lt;p&gt;The rules are: the referee generates &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; uniformly from &lt;span class=&quot;math-container&quot;&gt;$\{0, 1\}$&lt;/span&gt; and computes &lt;span class=&quot;math-container&quot;&gt;$a\oplus b = w$&lt;/span&gt;. The referee sends &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; to Alice and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; to Bob. The game is won if both Alice and Bob can each send a bit &lt;span class=&quot;math-container&quot;&gt;$w_a, w_b$&lt;/span&gt; back to the referee such that &lt;span class=&quot;math-container&quot;&gt;$w_a=w$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w_b = w$&lt;/span&gt;. Alice and Bob cannot classically communicate but they can distribute entanglement before the game starts.&lt;/p&gt;&#xA;&lt;p&gt;What I have tried is assuming Alice and Bob share an entangled state &lt;span class=&quot;math-container&quot;&gt;$\rho \in \mathcal{H}_A\otimes\mathcal{H}_B$&lt;/span&gt; and have arbitrary measurements &lt;span class=&quot;math-container&quot;&gt;$\{ M_a \}, \{M_b\}$&lt;/span&gt;. Assume Alice and Bob coordinate with a distribution &lt;span class=&quot;math-container&quot;&gt;$c(x_a, x_b|a,b)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$x_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_b$&lt;/span&gt; are variables to help them decide for &lt;span class=&quot;math-container&quot;&gt;$w_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w_b$&lt;/span&gt;. Then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;c(x_a, x_b|a,b) &amp;amp;= tr((M_a\otimes M_b) \rho) \\&#xA;&amp;amp;= tr_A(tr_B((M_a\otimes M_b) \rho))\\&#xA;&amp;amp;= \dots\\&#xA;&amp;amp;= tr(\rho)?&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This isn't correct as it is, but I'm looking for something that would imply that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; wouldn't affect &lt;span class=&quot;math-container&quot;&gt;$x_a, x_b$&lt;/span&gt;, or that they are uniformly random which would then imply Alice and Bob couldn't strategize any better than guessing. I'm not sure if this argument makes sense at all since I think it would also contradict that there is an advantage to the normal CHSH game.&lt;/p&gt;&#xA;&lt;p&gt;Any tips to showing if there is an advantage or not would be helpful. Thanks.&lt;/p&gt;&#xA;" OwnerUserId="509" LastEditorUserId="509" LastEditDate="2021-01-31T18:10:17.437" LastActivityDate="2021-01-31T18:10:17.437" Title="Modified CHSH game - Does entanglement help?" Tags="&lt;entanglement&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;&lt;games&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15769" PostTypeId="1" CreationDate="2021-01-31T19:47:22.343" Score="1" ViewCount="46" Body="&lt;p&gt;I try to follow &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/algorithms/03_vqe_simulation_with_noise.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/algorithms/03_vqe_simulation_with_noise.ipynb&lt;/a&gt; to perform measurement error mitigation for calculating H2 energy with VQE. With some modification, I did the calculation on &amp;quot;qasm_simulator&amp;quot; with the noise model built from &amp;quot;ibmq_santiago&amp;quot;. However, it does not seem to improve the result. Please see below. I tried a separate experiment, and for the computational basis, the error mitigation seems to work really well. So in principle I could have measured the expectation values of ZZ,XX, etc and the calibration matrix myself, followed by calculating the energy. However, I expect that &amp;quot;VQE&amp;quot; should be able to do these for me. So is there any way that we can improve it further?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.components.optimizers import COBYLA&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.circuit.library import TwoLocal&#xA;from qiskit.aqua.algorithms import VQE, NumPyMinimumEigensolver&#xA;from qiskit.aqua.operators import X, Y, Z, I&#xA;from qiskit import Aer, IBMQ &#xA;from qiskit.ignis.mitigation.measurement import CompleteMeasFitter&#xA;from qiskit.providers.aer.noise import NoiseModel&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(group='open', project='main')&#xA;backend = provider.get_backend('ibmq_santiago')&#xA;&#xA;&#xA;H2_op = (-1.052373245772859 * I ^ I) + \&#xA;        (0.39793742484318045 * I ^ Z) + \&#xA;        (-0.39793742484318045 * Z ^ I) + \&#xA;        (-0.01128010425623538 * Z ^ Z) + \&#xA;        (0.18093119978423156 * X ^ X)&#xA;&#xA;npme = NumPyMinimumEigensolver()&#xA;result = npme.compute_minimum_eigenvalue(operator=H2_op)&#xA;ref_value = result.eigenvalue.real&#xA;print( 'reference result = ' , ref_value )&#xA;&#xA;optimizer = COBYLA  # COBYLA, L_BFGS_B, SLSQP &#xA;&#xA;var_form = TwoLocal(rotation_blocks='ry', entanglement_blocks='cz')            &#xA;Ham_vqe = VQE(H2_op, var_form , optimizer(maxiter=1000) , include_custom=True ) &#xA;&#xA;noise_model = NoiseModel.from_backend(backend)&#xA;# Get coupling map from backend&#xA;coupling_map = backend.configuration().coupling_map&#xA;# Get basis gates from noise model&#xA;basis_gates = noise_model.basis_gates&#xA;&#xA;&#xA;# Noisy simulation&#xA;quantum_instance = QuantumInstance( Aer.get_backend('qasm_simulator'),&#xA;             coupling_map=coupling_map,&#xA;             basis_gates=basis_gates,&#xA;             noise_model=noise_model,&#xA;             shots = 8192  )&#xA;&#xA;result = Ham_vqe.run( quantum_instance )&#xA;&#xA;print( 'noisy result = ' , result.eigenvalue.real )&#xA;print( 'noisy result - reference result = ' , result.eigenvalue.real-ref_value )&#xA;&#xA;# Noisy simulation with mitigation&#xA;&#xA;quantum_instance = QuantumInstance( Aer.get_backend('qasm_simulator'),&#xA;             coupling_map=coupling_map,&#xA;             basis_gates=basis_gates,&#xA;             noise_model=noise_model,&#xA;             shots = 8192 ,&#xA;             measurement_error_mitigation_cls=CompleteMeasFitter , &#xA;             cals_matrix_refresh_period=30 )&#xA;&#xA;result = Ham_vqe.run( quantum_instance )&#xA;&#xA;print( 'with mitigation, noisy result = ' , result.eigenvalue.real )&#xA;print( 'with mitigation, noisy result - reference result = ' , result.eigenvalue.real-ref_value )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the output is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;reference result =  -1.8572750302023824&#xA;noisy result =  -1.8406772338912365&#xA;noisy result - reference result =  0.016597796311145885&#xA;with mitigation, noisy result =  -1.841906128159805&#xA;with mitigation, noisy result - reference result =  0.015368902042577348&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9816" LastEditorUserId="55" LastEditDate="2021-02-02T10:37:11.517" LastActivityDate="2021-02-02T10:37:11.517" Title="Why Measurement Error Mitigation does not seem to improve the result of VQE?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15770" PostTypeId="5" CreationDate="2021-01-31T20:33:07.717" Score="0" Body="&lt;p&gt;ProjectQ is an open source python framework for creating, manipulating and executing quantum circuits. See &lt;a href=&quot;https://projectq.ch/&quot; rel=&quot;nofollow noreferrer&quot;&gt;project website&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1612.08091&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; and &lt;a href=&quot;https://github.com/ProjectQ-Framework/ProjectQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;github repository&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-01-31T22:22:00.787" LastActivityDate="2021-01-31T22:22:00.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15771" PostTypeId="4" CreationDate="2021-01-31T20:33:07.717" Score="0" Body="ProjectQ is an open source software framework for quantum computing, interfacing python with various back-end simulators and quantum processors" OwnerUserId="10480" LastEditorUserId="23" LastEditDate="2021-01-31T22:21:51.203" LastActivityDate="2021-01-31T22:21:51.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15772" PostTypeId="1" AcceptedAnswerId="15773" CreationDate="2021-01-31T21:04:31.193" Score="4" ViewCount="214" Body="&lt;p&gt;The computational basis is also known as the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis as the kets &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt; are chosen as the eigenstates of the Pauli gate&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;Z=\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{pmatrix}.&#xA;\end{equation}&lt;/span&gt;&#xA;I've got a quick question. As &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; has eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;, according to the postulates of quantum mechanics &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; are the results of the measurement. So why is it that in every text the results are written as &lt;span class=&quot;math-container&quot;&gt;$&quot;0&quot;$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$&quot;1&quot;$&lt;/span&gt;? Is it simply because of a conventional correspondence &lt;span class=&quot;math-container&quot;&gt;$&quot;0&quot;\leftrightarrow +1,&quot;1&quot;\leftrightarrow -1$&lt;/span&gt; that no one ever even bothers to write explicitly?&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="55" LastEditDate="2021-02-02T10:37:51.170" LastActivityDate="2021-02-02T10:37:51.170" Title="If the eigenvalues of $Z$ are $\pm1$, why are the computational basis states labeled with &quot;$0$&quot; and &quot;$1$&quot;?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;&lt;notation&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15773" PostTypeId="2" ParentId="15772" CreationDate="2021-01-31T21:37:44.690" Score="4" Body="&lt;p&gt;The reason is when you make measurement on the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;, the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; will collapsed onto whether the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If it collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then it is indeed belongs to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, and you record it as an event occurred in that  space. If instead it collapsed to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then it is belonging to the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace. In any case, the idea is upon measurement in the computational basis, your state will always be in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state or the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, hence the statement &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Note that after many measurements, you will have a statistical distribution of how many times your prepared state has collapsed into the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-01-31T21:37:44.690" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15774" PostTypeId="1" AcceptedAnswerId="15776" CreationDate="2021-01-31T22:14:49.520" Score="3" ViewCount="72" Body="&lt;p&gt;All observables admit a spectral decomposition in terms of projectors &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; into the eigenspace corresponding to the eigenvalue &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. So given for example a collection of kets &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle,..., |n\rangle$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$a_0,a_1,...,a_n$&lt;/span&gt; I can always perform a measurement on a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha_0|0\rangle+...+\alpha_n|n\rangle$&lt;/span&gt; by a projection such as &lt;span class=&quot;math-container&quot;&gt;$$P_0|\psi\rangle=| 0\rangle\langle 0|\psi\rangle=\alpha_0|0\rangle$$&lt;/span&gt; (to be eventually renormalized) with outcome &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt;. But what if I wanted to see if the system is in a superposition of certain eigenstates? For example, I may wish to apply the projector &lt;span class=&quot;math-container&quot;&gt;$$P=\frac{1}{2}(|0\rangle+|1\rangle)(\langle 0|+\langle 1|)=\frac{P_0+|0\rangle\langle1|+|1\rangle\langle 0|+P_1}{2}.$$&lt;/span&gt;&#xA;Clearly &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; doesn't belong to the set &lt;span class=&quot;math-container&quot;&gt;$\{P_m\}$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are associated to different eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;My question is: is such a measurement possible, and what would be the outcome of the measurement?&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="55" LastEditDate="2021-02-02T10:44:19.810" LastActivityDate="2021-02-02T10:44:19.810" Title="Is a projective measurements over a superposition of eigenstates possible?" Tags="&lt;measurement&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15775" PostTypeId="2" ParentId="15765" CreationDate="2021-01-31T22:34:32.573" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$ \rho = \sum_n \rho_n |\psi_n \rangle \langle \psi_n | $&lt;/span&gt; be the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. We will calculate everything in terms of &lt;span class=&quot;math-container&quot;&gt;$ |\psi_n \rangle$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \frac{d \rho_\theta}{d \theta} = i [\rho_\theta, A] $&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \frac{d^2 \rho_\theta}{d \theta^2} = -\big[[\rho_\theta, A], A\big] $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now we write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{ \sqrt{\rho} \rho_\theta \sqrt{\rho} } = \rho + \theta \cdot X + \theta^2 \cdot Y + O(\theta^3) \\&#xA;$$&lt;/span&gt;&#xA;for some matrices &lt;span class=&quot;math-container&quot;&gt;$ X, Y $&lt;/span&gt; to be determined.&lt;/p&gt;&#xA;&lt;p&gt;Squaring the above equation we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sqrt{\rho} \rho_\theta \sqrt{\rho} = \rho^2 + \theta \cdot (X \rho + \rho X) + \theta^2 \cdot (X^2 +  Y \rho + \rho Y) + O(\theta^3)&#xA;$$&lt;/span&gt;&#xA;This means that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ X \rho + \rho X = &#xA;\sqrt{\rho} \frac{d \rho_\theta}{d \theta}\Big|_{\theta=0} \sqrt{\rho} = &#xA;i \sqrt{\rho} [\rho, A] \sqrt{\rho} \implies \\&#xA;X_{nm} = i \frac{\sqrt{\rho_n \rho_m}}{\rho_n + \rho_m} \langle \psi_n | [\rho, A] |\psi_m \rangle &#xA;= i \frac{\sqrt{\rho_n \rho_m}}{\rho_n + \rho_m} (\rho_n - \rho_m) \langle \psi_n | A |\psi_m \rangle $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \text{Tr}[X] = \sum_n X_{nn} =  0 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Similarly:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ Y \rho + \rho Y + X^2 = &#xA;\sqrt{\rho} \frac{d^2 \rho_\theta}{d \theta^2}\Big|_{\theta=0} \sqrt{\rho} = &#xA;-\sqrt{\rho} \Big[[\rho, A], A\Big] \sqrt{\rho} \implies \\&#xA;Y_{nm} = &#xA;- \frac{(X^2)_{nm}}{\rho_n + \rho_m} - \frac{\sqrt{\rho_n \rho_m}}{\rho_n + \rho_m} \langle \psi_n | \Big[[\rho, A], A\Big] |\psi_m \rangle &#xA;$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \text{Tr}[Y] = \sum_n Y_{nn} = &#xA;-  \sum_n \frac{(X^2)_{nn}}{2\rho_n} - \frac{1}{2} \text{Tr}\Big[\big[[\rho, A], A\big]\Big] &#xA;= - \sum_n \frac{(X^2)_{nn}}{2\rho_n} &#xA;= - \sum_{n,k} \frac{X_{nk}X_{kn}}{2\rho_n} \\&#xA;= - \frac{1}{2} \sum_{n,k} \frac{\rho_k}{(\rho_n + \rho_k)^2}  (\rho_n - \rho_k)^2 |\langle \psi_n | A |\psi_k \rangle|^2 \\&#xA;= - \frac{1}{4} \sum_{n,k} \frac{\rho_k}{(\rho_n + \rho_k)^2}  (\rho_n - \rho_k)^2 |\langle \psi_n | A |\psi_k \rangle|^2 - \frac{1}{4} \sum_{n,k} \frac{\rho_n}{(\rho_n + \rho_k)^2}  (\rho_n - \rho_k)^2 |\langle \psi_n | A |\psi_k \rangle|^2  \\&#xA;= - \frac{1}{4} \sum_{n,k} \frac{(\rho_n - \rho_k)^2}{\rho_n + \rho_k} |\langle \psi_n | A |\psi_k \rangle|^2 = -\frac{1}{8} F_Q[\rho, A] $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally:&#xA;&lt;span class=&quot;math-container&quot;&gt;$&#xA;F_B(\rho, \rho_\theta) = &#xA;\Big(\text{Tr}\big[\sqrt{ \sqrt{\rho} \rho_\theta \sqrt{\rho} } \big]\Big)^2 = \Big(\text{Tr}\rho + \theta^2 \cdot \text{Tr}Y + O(\theta^3) \Big)^2 = \\&#xA;\Big(1 - \theta^2 \frac{F_Q[\rho, A]}{8} + O(\theta^3) \Big)^2 = &#xA;1 - \theta^2 \frac{F_Q[\rho, A]}{4}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2021-01-31T22:34:32.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15776" PostTypeId="2" ParentId="15774" CreationDate="2021-01-31T22:53:08.137" Score="5" Body="&lt;p&gt;Yes, such a measurement is possible and the outcomes can be mapped to the outcomes of a computational basis measurement.&lt;/p&gt;&#xA;&lt;p&gt;This is accomplished by the use a unitary to transform from the basis we wish to measure in to the basis we know how to measure in. In the example from the question, we wish to measure in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}} \\&#xA;|-\rangle = \frac{|0\rangle - |1\rangle}{\sqrt{2}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;corresponding to the projector &lt;span class=&quot;math-container&quot;&gt;$P=|+\rangle\langle+|$&lt;/span&gt; and its orthogonal complement &lt;span class=&quot;math-container&quot;&gt;$|-\rangle\langle-|$&lt;/span&gt;. We can perform this measurement by applying the Hadamard gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H = |0\rangle\langle +| + |1\rangle\langle -|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;followed by the computational basis measurement. If we care about obtaining the appropriate post-measurement state, then after the computational basis measurement we apply &lt;span class=&quot;math-container&quot;&gt;$H^\dagger$&lt;/span&gt; to the collapsed state.&lt;/p&gt;&#xA;&lt;p&gt;In general, any measurement specified by a complete set of orthogonal projectors &lt;span class=&quot;math-container&quot;&gt;$Q_k = |\psi_k\rangle\langle\psi_k|$&lt;/span&gt; can be implemented using computational basis measurement &lt;span class=&quot;math-container&quot;&gt;$P_k = |k\rangle\langle k|$&lt;/span&gt; and the unitary &lt;span class=&quot;math-container&quot;&gt;$U = \sum_k |k\rangle\langle\psi_k|$&lt;/span&gt;. This follows from the identity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Q_k = U^\dagger P_k U.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-01T00:10:45.717" LastActivityDate="2021-02-01T00:10:45.717" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15777" PostTypeId="1" AcceptedAnswerId="15783" CreationDate="2021-02-01T03:09:28.777" Score="2" ViewCount="98" Body="&lt;p&gt;I am running the code, which gets the ground state energy with different atomic distances of LiH. However, I encountered this error. The code is as follow&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np import pylab import copy&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE&#xA;from qiskit.aqua.components.optimizers import SLSQP&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.transformations import (FermionicTransformation,&#xA;                                              FermionicTransformationType,&#xA;                                              FermionicQubitMappingType)&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;&#xA;molecule = 'H .0 .0 -{0}; Li .0 .0 {0}'&#xA;distances = np.arange(0.5,4.25,0.25)&#xA;vqe_energies = []&#xA;hf_energies = []&#xA;exact_energies = []&#xA;for i,d in enumerate(distances):&#xA;    print('step', i)&#xA;    #set up the experiment&#xA;    driver = PySCFDriver(molecule.format(d/2), basis='sto3g')&#xA;    fermionic_transformation = FermionicTransformation(&#xA;            transformation=FermionicTransformationType.FULL,&#xA;            qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER,&#xA;            two_qubit_reduction=False,&#xA;            freeze_core=False)&#xA;    qubit_op, aux_ops = fermionic_transformation.transform(driver)&#xA;    #VQE&#xA;    optimizer = SLSQP(maxiter=1000)&#xA;    initial_state = HartreeFock(fermionic_transformation.molecule_info['num_orbitals'],&#xA;                                        fermionic_transformation.molecule_info['num_particles'],&#xA;                                        qubit_mapping=fermionic_transformation.qubit_mapping,&#xA;                                        two_qubit_reduction=fermionic_transformation._two_qubit_reduction)&#xA;    #VQE&#xA;    vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')),&#xA;                                 optimizer,&#xA;                                 initial_state)&#xA;    calc = GroundStateEigensolver(fermionic_transformation, vqe_solver)&#xA;    res = calc.solve(driver)&#xA;    print(res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The traceback is here&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  File &amp;quot;/home/ironmanaudi/research/VQE/VQE_tutorial/LiH_VQE.py&amp;quot;, line 76, in &amp;lt;module&amp;gt;&#xA;    res = calc.solve(driver)&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/chemistry/algorithms/ground_state_solvers/ground_state_eigensolver.py&amp;quot;, line 102, in solve&#xA;    raw_mes_result = solver.compute_minimum_eigenvalue(operator, aux_operators)&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py&amp;quot;, line 494, in compute_minimum_eigenvalue&#xA;    return self._run()&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py&amp;quot;, line 429, in _run&#xA;    vqresult = self.find_minimum(initial_point=self.initial_point,&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/aqua/algorithms/vq_algorithm.py&amp;quot;, line 172, in find_minimum&#xA;    if initial_point is not None and len(initial_point) != nparms:&#xA;TypeError: object of type 'HartreeFock' has no len()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When change the syntax of getting the result to&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;res = calc.solve(driver, aux_ops)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the error becomes&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;File &amp;quot;/home/ironmanaudi/research/VQE/VQE_tutorial/LiH_VQE.py&amp;quot;, line 70, in &amp;lt;module&amp;gt;&#xA;    res = calc.solve(driver, aux_ops)&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/chemistry/algorithms/ground_state_solvers/ground_state_eigensolver.py&amp;quot;, line 90, in solve&#xA;    operator, aux_operators = self.transformation.transform(driver, aux_operators)&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/chemistry/transformations/fermionic_transformation.py&amp;quot;, line 152, in transform&#xA;    ops, aux_ops = self._do_transform(q_molecule, aux_operators)&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/chemistry/transformations/fermionic_transformation.py&amp;quot;, line 358, in _do_transform&#xA;    _add_aux_op(aux_op, name)&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/chemistry/transformations/fermionic_transformation.py&amp;quot;, line 289, in _add_aux_op&#xA;    aux_qop = FermionicTransformation._map_fermionic_operator_to_qubit(&#xA;  File &amp;quot;/home/ironmanaudi/anaconda3/lib/python3.8/site-packages/qiskit/chemistry/transformations/fermionic_transformation.py&amp;quot;, line 645, in _map_fermionic_operator_to_qubit&#xA;    qubit_op = fer_op.mapping(map_type=qubit_mapping, threshold=0.00000001)&#xA;AttributeError: 'SummedOp' object has no attribute 'mapping'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Can anybody tell me how to work this out?&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="55" LastEditDate="2021-02-02T10:44:25.680" LastActivityDate="2021-02-02T10:44:25.680" Title="error when running VQE in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15778" PostTypeId="1" CreationDate="2021-02-01T04:19:20.830" Score="2" ViewCount="32" Body="&lt;p&gt;Here, I want to ask a basic question about how to compute the fault tolerance threshold of quantum codes. As I know, maybe, the most usual way is to do some simulations. Howvever, I am more intersted with the theoretical computation. More specificly, I am interested with the quantum LDPC relted codes, e.g., &lt;a href=&quot;https://arxiv.org/abs/1412.6172&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1412.6172&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1711.08351&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1711.08351&lt;/a&gt;, and &lt;a href=&quot;https://arxiv.org/abs/1310.2984&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1310.2984&lt;/a&gt;. For example, let us talk about&lt;/p&gt;&#xA;&lt;p&gt;Efficient decoding of random errors for quantum expander codes, by Fawzi,Grospellier,and Leverrier, STOC’18.&lt;/p&gt;&#xA;&lt;p&gt;My first question is about the failure probability &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; (or success probability &lt;span class=&quot;math-container&quot;&gt;$1-\epsilon$&lt;/span&gt; in verse). I am confused by the computation of that. Do we need to count &lt;strong&gt;all&lt;/strong&gt; the random errors that can not be corrected succesfully? In that paper, the authors can correct random errors of linear weight with a very high probability &lt;span class=&quot;math-container&quot;&gt;$1-\epsilon$&lt;/span&gt;. Denote by &lt;span class=&quot;math-container&quot;&gt;$\delta n$&lt;/span&gt; the weight of the random errors, where &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;\delta\leq1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the block length. In general, we can assume that &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;\delta&amp;lt;0.5$&lt;/span&gt; (Is it right or necessary?). Then do we need to deal with the random errors of weight larger than &lt;span class=&quot;math-container&quot;&gt;$\delta n$&lt;/span&gt; up to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="8096" LastEditorUserId="55" LastEditDate="2021-02-02T10:26:46.103" LastActivityDate="2021-02-02T10:26:46.103" Title="How to do the counting when computing the fault tolerant threshold of quantum codes?" Tags="&lt;error-correction&gt;&lt;physical-realization&gt;&lt;fault-tolerance&gt;&lt;topological-quantum-computing&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15779" PostTypeId="2" ParentId="15772" CreationDate="2021-02-01T07:04:58.643" Score="3" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Is it simply because of a conventional correspondence &amp;quot;0&amp;quot;↔+1,&amp;quot;1&amp;quot;↔−1 that no one ever even bothers to write explicitly?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes.  Labels can be chosen arbitrary, so long as they are clear.  This particular convention is convenient simply because it makes the labels of the eigenstates look like classical binary strings.   Note that the labels can be seen as powers of (-1) in the Z eigenvalues: &lt;span class=&quot;math-container&quot;&gt;$(-1)^0 = 1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$(-1)^1 = -1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14679" LastActivityDate="2021-02-01T07:04:58.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15780" PostTypeId="2" ParentId="15777" CreationDate="2021-02-01T08:38:47.947" Score="3" Body="&lt;p&gt;Seems like you are mixing a couple of things here. The &lt;code&gt;VQEUCCSDFactory&lt;/code&gt; uses the &lt;code&gt;HartreeFock&lt;/code&gt; state as an initial_state by default. See also here &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/7775410f4dabf09ec9f933bf411ead434550accf/qiskit/chemistry/algorithms/ground_state_solvers/minimum_eigensolver_factories/vqe_uccsd_factory.py#L216-L217&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQEUCCSDFactory&lt;/a&gt;. The &lt;code&gt;initial_point&lt;/code&gt; that you are specifying is the initial values of the variational parameters to start the optimization from.&lt;/p&gt;&#xA;&lt;p&gt;One more point, seeing you snippet seems like you want to calculate a PES and you may want to take a look also to our BOPES Sampler tutorials here &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/chemistry/05_Sampling_potential_energy_surfaces.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;BOPES tutorial&#xA;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;&#xA;" OwnerUserId="2000" LastActivityDate="2021-02-01T08:38:47.947" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15781" PostTypeId="1" CreationDate="2021-02-01T08:59:58.657" Score="4" ViewCount="66" Body="&lt;p&gt;From the paper &lt;a href=&quot;https://reader.elsevier.com/reader/sd/pii/S037596012030462X?token=341DFB233CC9E10AE9650DF6683807615693ADE6B9F4A8F400F594A1487EDA46868B04B6130D3ACD38282B91943A2F79&quot; rel=&quot;nofollow noreferrer&quot;&gt;A survey on HHL algorithm: From theory to application in quantum machine learning &lt;/a&gt;,&#xA;I use qasm code from &lt;a href=&quot;https://github.com/dreamingangela/ibmq_hhl/blob/master/hhl.qasm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&#xA;I try to follow the example in page 7. with Ax = b&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BJdj3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BJdj3.png&quot; alt=&quot;matrix A&quot; /&gt;&lt;/a&gt; &lt;br&gt;&#xA;and &lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/c5zlq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c5zlq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt; &lt;br&gt;&#xA;the answer x should be&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iYJdZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iYJdZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;From the algorithm 2 in page 7 from the paper, They applied measurement on qubit q[0]. &lt;br&gt;&#xA;If  q[0] = &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the answer will be stored in q[.3] or register b.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wCDHF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wCDHF.png&quot; alt=&quot;HHL circuit from page 7&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But in the example &lt;a href=&quot;https://github.com/dreamingangela/ibmq_hhl/blob/master/hhl.qasm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, I got state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; from ancilla bit if I use the same rotation angle as the example.&lt;/p&gt;&#xA;&lt;p&gt;When I measure register b, I always got  state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;  even if the result on ancilla bit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (I change ancilla bit rotation angel from the example to 3.6591 and 1.8296).&lt;/p&gt;&#xA;&lt;p&gt;Does the problem is the rotation angle on ancilla bit? &lt;br&gt;&#xA;How can I get the correct result on register b? Can you give me a good example to do this?&lt;/p&gt;&#xA;" OwnerUserId="13676" LastEditorUserId="8746" LastEditDate="2021-02-01T11:27:02.973" LastActivityDate="2021-02-01T17:18:08.040" Title="HHL algorithm, How can I get result from register $|b\rangle$?" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15782" PostTypeId="2" ParentId="15777" CreationDate="2021-02-01T09:12:56.657" Score="0" Body="&lt;p&gt;The first method is as the following&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab&#xA;import copy&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE&#xA;from qiskit.aqua.components.optimizers import SLSQP&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.transformations import (FermionicTransformation,&#xA;                                              FermionicTransformationType,&#xA;                                              FermionicQubitMappingType)&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;&#xA;&#xA;distances = np.arange(0.5,4.25,0.25)&#xA;vqe_energies = []&#xA;hf_energies = []&#xA;exact_energies = []&#xA;&#xA;&#xA;for i,d in enumerate(distances):&#xA;    print('step', i)&#xA;    &#xA;    #set up the experiment&#xA;    molecule = Molecule(geometry=[['H', [0., 0., -1*(d/2)]],&#xA;                              ['H', [0., 0., (d/2)]]],&#xA;                     charge=0, multiplicity=1)&#xA;    driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;    fermionic_transformation = FermionicTransformation(&#xA;            transformation=FermionicTransformationType.FULL,&#xA;            qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER,&#xA;            two_qubit_reduction=False,&#xA;            freeze_core=False)&#xA;    &#xA;    # qubit_op, aux_ops = fermionic_transformation.transform(driver)&#xA;    driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;&#xA;    #VQE&#xA;    optimizer = SLSQP(maxiter=1000)&#xA;    vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')), optimizer)&#xA;    &#xA;    calc = GroundStateEigensolver(fermionic_transformation, vqe_solver)&#xA;    res = calc.solve(driver)&#xA;    vqe_energies.append(res.computed_energies[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The second method :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab&#xA;import copy&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE&#xA;from qiskit.aqua.components.optimizers import SLSQP&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.transformations import (FermionicTransformation,&#xA;                                              FermionicTransformationType,&#xA;                                              FermionicQubitMappingType)&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;&#xA;&#xA;distances = np.arange(0.5,4.25,0.25)&#xA;vqe_energies = []&#xA;hf_energies = []&#xA;exact_energies = []&#xA;&#xA;&#xA;for i,d in enumerate(distances):&#xA;    print('step', i)&#xA;    &#xA;    #set up the experiment&#xA;    molecule = Molecule(geometry=[['H', [0., 0., -1*(d/2)]],&#xA;                              ['H', [0., 0., (d/2)]]],&#xA;                     charge=0, multiplicity=1)&#xA;    driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;    fermionic_transformation = FermionicTransformation(&#xA;            transformation=FermionicTransformationType.FULL,&#xA;            qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER,&#xA;            two_qubit_reduction=False,&#xA;            freeze_core=False)&#xA;    &#xA;    qubit_op, aux_ops = fermionic_transformation.transform(driver)&#xA;    driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;&#xA;&#xA;    vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;    &#xA;    #VQE&#xA;    optimizer = SLSQP(maxiter=1000)&#xA;    initial_state = HartreeFock(fermionic_transformation.molecule_info['num_orbitals'],&#xA;                                        fermionic_transformation.molecule_info['num_particles'],&#xA;                                        qubit_mapping=fermionic_transformation.qubit_mapping,&#xA;                                        two_qubit_reduction=fermionic_transformation._two_qubit_reduction)&#xA;    var_form = UCCSD(num_orbitals=fermionic_transformation.molecule_info['num_orbitals'],&#xA;                              num_particles=fermionic_transformation.molecule_info['num_particles'],&#xA;                              initial_state=initial_state,&#xA;                              qubit_mapping=fermionic_transformation.qubit_mapping,&#xA;                              two_qubit_reduction=fermionic_transformation._two_qubit_reduction)&#xA;    vqe_solver = VQE(qubit_op,var_form,optimizer,initial_state)&#xA;    vqe_solver = vqe_solver.run(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;    &#xA;    &#xA;    &#xA;    calc = GroundStateEigensolver(fermionic_transformation, vqe_solver)&#xA;    res = calc.solve(driver)&#xA;    vqe_energies.append(res.computed_energies[0])&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8611" LastActivityDate="2021-02-01T09:12:56.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15783" PostTypeId="2" ParentId="15777" CreationDate="2021-02-01T11:56:48.100" Score="2" Body="&lt;p&gt;Again here you are mixing some things. The &lt;code&gt;initial_state&lt;/code&gt; in the &lt;code&gt;VQE&lt;/code&gt; (that again you assign in the &lt;code&gt;initial_points&lt;/code&gt;) is the starting values of the variational parameters. You have already specified the initial_state in the var_form. Then you should provide a solver in the calc and not run the solver manually. The code that works is here:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab&#xA;import copy&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE&#xA;from qiskit.aqua.components.optimizers import SLSQP&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.transformations import (FermionicTransformation,&#xA;                                              FermionicTransformationType,&#xA;                                              FermionicQubitMappingType)&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;&#xA;&#xA;distances = np.arange(0.5,4.25,0.25)&#xA;vqe_energies = []&#xA;hf_energies = []&#xA;exact_energies = []&#xA;&#xA;&#xA;for i,d in enumerate(distances):&#xA;    print('step', i)&#xA;    &#xA;    #set up the experiment&#xA;    molecule = Molecule(geometry=[['H', [0., 0., -1*(d/2)]],&#xA;                              ['H', [0., 0., (d/2)]]],&#xA;                     charge=0, multiplicity=1)&#xA;    driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;    fermionic_transformation = FermionicTransformation(&#xA;            transformation=FermionicTransformationType.FULL,&#xA;            qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER,&#xA;            two_qubit_reduction=False,&#xA;            freeze_core=False)&#xA;    &#xA;    qubit_op, aux_ops = fermionic_transformation.transform(driver)&#xA;&#xA;    #VQE&#xA;    optimizer = SLSQP(maxiter=1)&#xA;    initial_state = HartreeFock(fermionic_transformation.molecule_info['num_orbitals'],&#xA;                                        fermionic_transformation.molecule_info['num_particles'],&#xA;                                        qubit_mapping=fermionic_transformation.qubit_mapping,&#xA;                                        two_qubit_reduction=fermionic_transformation._two_qubit_reduction)&#xA;    var_form = UCCSD(num_orbitals=fermionic_transformation.molecule_info['num_orbitals'],&#xA;                              num_particles=fermionic_transformation.molecule_info['num_particles'],&#xA;                              initial_state=initial_state,&#xA;                              qubit_mapping=fermionic_transformation.qubit_mapping,&#xA;                              two_qubit_reduction=fermionic_transformation._two_qubit_reduction)&#xA;    &#xA;    vqe_solver = VQE(qubit_op,var_form,optimizer, quantum_instance=QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;    &#xA;    calc = GroundStateEigensolver(fermionic_transformation, vqe_solver)&#xA;    &#xA;    res = calc.solve(driver)&#xA;    &#xA;    vqe_energies.append(res.computed_energies[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I also removed the double definition of the driver. Maybe consider the tutorials here: &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/chemistry/03_ground_state_solvers.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ground_state_solver&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2000" LastActivityDate="2021-02-01T11:56:48.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15785" PostTypeId="2" ParentId="15764" CreationDate="2021-02-01T12:06:20.040" Score="2" Body="&lt;p&gt;To compute a threshold, you need to figure out the probability of an error occurring despite the error-correction (&lt;span class=&quot;math-container&quot;&gt;$\bar{p}$&lt;/span&gt;), and then compare it to the chance without error-correction (&lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;).  The threshold is given by &lt;span class=&quot;math-container&quot;&gt;$\bar{p}&amp;lt;p$&lt;/span&gt;.  For the Shor code, we know that it can correct an arbitrary single-qubit error on any one of the 9 qubits, so the chance that the code &lt;em&gt;correctly&lt;/em&gt; functions is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(1-p)^9 \quad[\text{no error}] + 9p(1-p)^8 \quad[\text{9 ways of having 1 error}]&#xA;\end{align}&lt;/span&gt;&#xA;The chance that the code fails is the complement of this probability, i.e. when two or more errors occur&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\bar{p} &amp;amp;= 1 - ((1-p)^9 + 9p(1-p)^8)\\&#xA;&amp;amp;= 1 -((1-p)^8 - p(1-p)^8 + 9p(1-p)^8)\\&#xA;&amp;amp;= 1 - (1+8p)(1-p)^8&#xA;\end{align}&lt;/span&gt;&#xA;which is the bound that Shor computes in his original &lt;a href=&quot;https://www.cs.miami.edu/home/burt/learning/Csc670.052/pR2493_1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;.  The threshold is when the logical error rate just beats out the physical error rate, which comes out to around 3.23%.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-02-01T12:06:20.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15786" PostTypeId="1" CreationDate="2021-02-01T12:12:25.903" Score="4" ViewCount="144" Body="&lt;p&gt;I have a question about Shor's algorithm with respect to the eigenvector representation of the second (lower) register. In the following I use the notation of Nielsen, M., Chuang, I., 2016, Quantum Computation and Quantum Information, p. 232 on Quantum order-finding. I am using the quantum phase estimation approach to Shor's algorithm.&lt;/p&gt;&#xA;&lt;p&gt;Starting off with the following preparation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}\sum_{j=0}^{2^n-1}|j\rangle|1\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;and applying the controlled &lt;span class=&quot;math-container&quot;&gt;$U^j$&lt;/span&gt; gates,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}\sum_{j=0}^{2^n-1}|j\rangle|a^j\text{ mod }N\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;rewritten in terms of eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|u_0\rangle,|u_1\rangle,...,|u_{r-1}\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of the second register&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{r2^n}}\sum_{s=0}^{r-1}\sum_{j=0}^{2^n-1}e^{2\pi ijs/r}|j\rangle|u_s\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and then applying the inverse QFT, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}|\widetilde{\frac{s}{r}}\rangle| u_s\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\widetilde{\frac{s}{r}}\rangle$&lt;/span&gt; is considered an approximation to an integer.&lt;/p&gt;&#xA;&lt;p&gt;Would the application of the &lt;span class=&quot;math-container&quot;&gt;$QFT^{\dagger}$&lt;/span&gt; to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2^n}}\sum_{j=0}^{2^n-1}|j\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;irrespective of the second register (which is in a superposition of states &lt;span class=&quot;math-container&quot;&gt;$|a^j\text{ mod }N\rangle$&lt;/span&gt;) yield &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; for the upper register before measurement, thinking of the inverse QFT as the quantum equivalent to the discrete Fourier transform? If measured would that not result in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, which does not make sense to me, at all, as a result. How are these two approaches reconciled? Am I missing something basic here?&lt;/p&gt;&#xA;" OwnerUserId="12480" LastEditorUserId="55" LastEditDate="2021-02-02T10:45:05.867" LastActivityDate="2021-02-06T17:20:24.697" Title="Shor's algorithm - modular exponentiation and Quantum Fourier transform and quantum phase estimation method" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15787" PostTypeId="1" CreationDate="2021-02-01T15:40:42.020" Score="2" ViewCount="49" Body="&lt;p&gt;I am now working on designing quantum error mitigation with variational quantum eigensolvers (VQE). I need  to get the 1&amp;amp;2-RDM from Qiskit, which has already been realized by &lt;a href=&quot;http://openqemist.1qbit.com/docs/_modules/openqemist/quantum_solvers/qiskit/qiskit_parametric_solver.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Openchemist pakages for Qiskit to get RMDS&lt;/a&gt;.  The question is how to get the energy function in the following formula (A14) from appendix A of &lt;a href=&quot;https://arxiv.org/pdf/2004.04174.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Google Hartree Fock paper&lt;/a&gt;. I need (A14) to be the objective function for gradient descent, then the VQE algorithm can be implemented.&lt;/p&gt;&#xA;&lt;p&gt;Because the problem here is to calculate the ground state energy for a quantum chemistry problem, the first step is to extract the molecular information, which is contained in the tensors, h_ij and V_ijkl in (A14). I already got the 1&amp;amp;2-electron integrals by the PySCFDriver. Then, the objective function can be defined for gradient descent. Is there a way to realize the second step in Qiskit?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NCufz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NCufz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="8611" LastEditDate="2021-02-06T07:54:42.317" LastActivityDate="2021-02-06T07:54:42.317" Title="Calculating energy function with 1&amp;2-RDM (reduced density matrix) in Qiskit" Tags="&lt;qiskit&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15788" PostTypeId="2" ParentId="15781" CreationDate="2021-02-01T17:18:08.040" Score="3" Body="&lt;p&gt;In your code the measure clause means one shot, so the state collapses to one basis state as here:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jqVCf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jqVCf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;By removing that last line the Statevector option shows the state before measurement, i.e. as a superposition of basis states:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/OpZp2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OpZp2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;Now you can see that for the basis states with &lt;code&gt;q[0]=1&lt;/code&gt; (that is &lt;code&gt;0001&lt;/code&gt; and &lt;code&gt;1001&lt;/code&gt;) we get the right components of the solution vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (you can check that the numbers coincide with those reported in Table 2, row 1 of the paper you mentioned).&lt;/p&gt;&#xA;&lt;p&gt;The &amp;quot;right&amp;quot; thing to do here if you want to avoid statevectors would be to do a few measurements and calculate the probabilities of obtaining &lt;code&gt;0001&lt;/code&gt; and &lt;code&gt;1001&lt;/code&gt;, which is what they explain in Section 3.3.2. of the paper. The more measurements you do, the closer the probabilities you calculate will be to those from the statevector simulation.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2021-02-01T17:18:08.040" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15789" PostTypeId="1" AcceptedAnswerId="15795" CreationDate="2021-02-01T18:07:37.897" Score="2" ViewCount="52" Body="&lt;p&gt;In the book Quantum computation and quantum information, it says to evaluate &lt;span class=&quot;math-container&quot;&gt;$tr(A|\psi\rangle\langle\psi|)$&lt;/span&gt; using Gram-Schmidt procedure to extend &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; which includes &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as the first element. Then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$tr(A|\psi\rangle\langle\psi|)=\sum_i\langle i|A|\psi\rangle\langle\psi|i\rangle\tag{2.60}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\langle\psi|A|\psi\rangle\tag{2.61}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understood that equation 2.61 that uses the special basis &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; described. But &lt;strong&gt;in equation 2.60, how &lt;span class=&quot;math-container&quot;&gt;$\sum_i\langle i|M|i\rangle$&lt;/span&gt; is correlated to &lt;span class=&quot;math-container&quot;&gt;$tr(M)$&lt;/span&gt; ?&lt;/strong&gt; Can you help me with a more detailed description of it ?&lt;/p&gt;&#xA;" OwnerUserId="14037" LastEditorUserId="55" LastEditDate="2021-02-02T10:46:21.550" LastActivityDate="2021-02-02T10:46:21.550" Title="How is $\sum_i\langle i|M|i\rangle$ correlated to $\mathrm{tr}(M)$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;trace&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15790" PostTypeId="1" CreationDate="2021-02-01T19:33:33.757" Score="2" ViewCount="28" Body="&lt;p&gt;This question consists of the basic calculations which are often referred to as &amp;quot;trivial&amp;quot; in most references in circuit-QED. However, are not so trivial for anyone who starts fresh into the quantum optics involved for studying the input/output (I/O), and therefore the measurements in actual architecture of QC.&#xA;(With some quality answer this can become a resource for starters to refer to). The starting point is to study the Quantum Langevin Equations from some 'rare' quantum optics texts. The notation is standard:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Omega:$&lt;/span&gt; Cavity Frequency&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\Gamma$&lt;/span&gt;: Dissipation/decay rate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$b_{\text{in/out}}$&lt;/span&gt;: Input/Output field operators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$a^\dagger$&lt;/span&gt;: Cavity modes&lt;/p&gt;&#xA;&lt;p&gt;The solution to the Langevin equation reads:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a(t)=a(0)\text{e}^{-(i\Omega +\Gamma/2)}-\sqrt{\Gamma}\int_0^tds$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\text{e}^{-(i\Omega+\Gamma/2)(t-s)}b_{\text{in}}(s)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt; Prove the commutators:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[a^\dagger(t),b_{\text{in}}(t')]=0 \quad$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t&amp;lt;t'$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[a^\dagger(t),b_{\text{in}}(t)]=-\frac{1}{2}\sqrt{\Gamma} \quad$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[a^\dagger(t'),b_{\text{in}}(t')]=-\sqrt{\Gamma}\text{e}^{-(i\Omega+\Gamma/2)(t-t')} \quad$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$t&amp;gt;t'$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$[a^\dagger(t),a^\dagger(s)]=\text{e}^{-\frac{1}{2}\Gamma|t-s|}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;(2)&lt;/strong&gt; Given the time reversed Langevin equation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\dot{a}(t)=(-i\Omega+\Gamma/2)a(t)-\sqrt{\Gamma}b_{\text{out}}(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;find the solution for &lt;span class=&quot;math-container&quot;&gt;$a(t)$&lt;/span&gt; in terms of the output field at a future time &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;(3)&lt;/strong&gt; Prove the relation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\tilde{a}(\omega)=\frac{\sqrt{\Gamma}}{i(\omega-\Omega)-\Gamma/2}\tilde{b}_{\text{in}}(\omega)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the standard Fourier transform is defined as: &lt;span class=&quot;math-container&quot;&gt;$\tilde{f}(\omega)=\frac{1}{2\pi} \int_{-\infty}^{\infty}\text{e}^{i\omega t}f(t)dt$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;(4)&lt;/strong&gt; Given the I/O relation and boundary condition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$b_{\text{out}}(t)=b_{\text{in}}(t)+\sqrt{\Gamma}a(t)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Prove the simpler relation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\tilde{b}_{\text{out}}(\omega)=\text{e}^{i\delta(\omega)}\tilde{b}_{\text{in}}(\omega)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\delta(\omega)$&lt;/span&gt; is a phase shift which preserves the commutation relations for the I/O operators under the Fourier transform.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="4889" LastEditDate="2021-02-01T20:13:46.313" LastActivityDate="2021-02-01T20:13:46.313" Title="Solution for the &quot;Input and Output theory&quot; for circuit/cavity-QED Quantum Architecture" Tags="&lt;architecture&gt;&lt;superconducting-quantum-computing&gt;&lt;quantum-optics&gt;&lt;circuit-qed&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="0" ClosedDate="2021-02-04T07:30:36.390" ContentLicense="CC BY-SA 4.0" />
  <row Id="15791" PostTypeId="2" ParentId="2057" CreationDate="2021-02-01T20:21:21.097" Score="0" Body="&lt;p&gt;Boosting Algorithms are considered as iterative functional gradient descent algorithms. These algorithms optimize a cost function over function space by iteratively choosing a function (weak hypothesis) that points in the negative gradient direction. Like other boosting methods, gradient boosting combines weak &amp;quot;learners&amp;quot; into a single strong learner in an iterative fashion.&lt;/p&gt;&#xA;&lt;p&gt;In the quantum realm, it may be a good idea to invoke the Grover search algorithm to construct the gradient boosting algorithms in an unstructured database with the data structure of a binary tree or another suitable tree structure. &lt;a href=&quot;https://github.com/RudreshVeerkhare/CustomXGBoost/blob/master/CustomXGBoost.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;Following sample code&lt;/a&gt; is an interesting customization of XGBoost in the classical setting. There is a reference implementation of Grover Search in Q# in the &lt;a href=&quot;https://github.com/microsoft/Quantum/blob/master/samples/algorithms/database-search/DatabaseSearch.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;following repository&lt;/a&gt;.  Instead of a single marked state as in this Q# example, we could construct a tree state as an input to implement Grover Search to run through a decision tree to realize quantum gradient tree boosting.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastActivityDate="2021-02-01T20:21:21.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15792" PostTypeId="1" CreationDate="2021-02-01T21:59:07.907" Score="7" ViewCount="653" Body="&lt;p&gt;For simplicity, let's take a density matrix for a single qubit, written in the &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt; basis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = \begin{pmatrix} \rho_{00} &amp;amp; \rho_{01} \\ \rho_{10}^* &amp;amp; 1-\rho_{00} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The diagonal elements give us the probabilities of measuring the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states. And this is true for both pure and mixed states.&lt;/p&gt;&#xA;&lt;p&gt;What about the off-diagonal elements? What information does the numerical value of &lt;span class=&quot;math-container&quot;&gt;$\rho_{01}$&lt;/span&gt; tell us about the quantum state?&lt;/p&gt;&#xA;&lt;p&gt;And how does this generalize to systems with more than one qubit?&lt;/p&gt;&#xA;" OwnerUserId="14685" LastActivityDate="2021-02-02T18:19:54.373" Title="What do the off-diagonal elements of a density matrix physically represent?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;density-matrix&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15793" PostTypeId="2" ParentId="15792" CreationDate="2021-02-01T22:30:56.150" Score="3" Body="&lt;p&gt;A good way to think about density matrices is to think about them as Bloch Vectors (I assume you are familiar with the Bloch Sphere). This won't tackle your question head on; but I hope will give some motivation for &lt;em&gt;what&lt;/em&gt; each of the numbers in the density matrix means.&lt;/p&gt;&#xA;&lt;p&gt;You see, every &lt;span class=&quot;math-container&quot;&gt;$2\text{x}2$&lt;/span&gt; matrix can be decomposed into a linear superposition of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{1}, \sigma_z, \sigma_x. \sigma_y$&lt;/span&gt;; they form a basis over the space of &lt;span class=&quot;math-container&quot;&gt;$2\text{x}2$&lt;/span&gt; matrices. Therefore we can rewrite every density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as such:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned}\rho &amp;amp;={\frac {1}{2}}\left(I+{\vec {a}}\cdot {\vec {\sigma }}\right)\\&amp;amp;={\frac {1}{2}}{\begin{pmatrix}1&amp;amp;0\\0&amp;amp;1\end{pmatrix}}+{\frac {a_{x}}{2}}{\begin{pmatrix}0&amp;amp;1\\1&amp;amp;0\end{pmatrix}}+{\frac {a_{y}}{2}}{\begin{pmatrix}0&amp;amp;-i\\i&amp;amp;0\end{pmatrix}}+{\frac {a_{z}}{2}}{\begin{pmatrix}1&amp;amp;0\\0&amp;amp;-1\end{pmatrix}}\\&amp;amp;={\frac {1}{2}}{\begin{pmatrix}1+a_{z}&amp;amp;a_{x}-ia_{y}\\a_{x}+ia_{y}&amp;amp;1-a_{z}\end{pmatrix}}\end{aligned}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$(a_x,a_y,a_z)$&lt;/span&gt; are real numbers representing the vector of our state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; on the Bloch sphere. Of course there are many ways to interpret this information; the relative probability of measuring the state in any basis comes to mind. But something that is really interesting is that the shorter the Bloch vector, the more mixed our state; for a Bloch vector of norm &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; we have a pure state.&lt;/p&gt;&#xA;&lt;p&gt;This is a bit more general than what your question was asking about; but clearly you can see that the diagonal elements of the matrix play a role in our analysis here.&lt;/p&gt;&#xA;&lt;p&gt;For multi Qubit systems; there are various ways of approaching the problem; one which Linear Algebra afficonatos will enjoy is using higher dimensional Bloch Bodies, and doing the same style of matrix decomposition, only now you have a larger basis, and a different geometric structure to interpret your decomposition by (not a sphere). This style of thinking about the problem emphasizes very well how mixedness changes with higher dimensional quantum systems; and in fact your maximally mixed state in a system of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Qubits has Purity &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n}$&lt;/span&gt;, this result is geometrically obvious using Bloch Bodies&lt;/p&gt;&#xA;&lt;p&gt;A more common way to think about multi Qubit Systems is through partial traces of the overall density matrix; this has been answered many times on this SE, I will link some posts.&lt;/p&gt;&#xA;" OwnerUserId="14513" LastActivityDate="2021-02-01T22:30:56.150" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15794" PostTypeId="2" ParentId="15792" CreationDate="2021-02-01T22:32:30.043" Score="4" Body="&lt;p&gt;It can represent 'various' things depending upon the physical system and the context.&#xA;For instance:&lt;/p&gt;&#xA;&lt;p&gt;(1) For a 'closed and isolated' system (let us say a qubit), it represents the 'coherence' between the energy levels by the virtue of the relative phase of the amplitudes. For instance starting with a pure state (in this case): &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\cos \theta|0\rangle+ \text{e}^{i\phi}\sin \theta |1\rangle$&lt;/span&gt;, we would have &lt;span class=&quot;math-container&quot;&gt;$\rho_{01}=\text{e}^{-i\phi}\cos \theta \sin \theta $&lt;/span&gt; which contains the 'relative phase' information. Here, &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle \langle\psi|.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(2) For a general mixed state, which can be seen as 'partially traced' version of a pure state (over a larger composite Hilbert space) over the 'environmental degrees of freedom'. In this case, the off-diagonal entries of the reduced density matrix would contain the information about the decoherence as well. For instance, &lt;span class=&quot;math-container&quot;&gt;$\rho_{01}(t) \sim \text{e}^{-\gamma t}$&lt;/span&gt;, along with the system information as in above example. Here, the decay constant &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; can be seen as a coupling to the environment via the operator &lt;span class=&quot;math-container&quot;&gt;$\sigma^-$&lt;/span&gt; (in this example) which causes the decay of an excited level into the ground state by emitting a quanta to the environment. The information here was of 'decoherence'. Notice that the system evolution is taken into account in this case, unlike the case (1) of stationary qubit with no evolution.&lt;/p&gt;&#xA;&lt;p&gt;In general, these two viewpoints are enough for the context of a qubit with &lt;span class=&quot;math-container&quot;&gt;$2 \times2$&lt;/span&gt; density matrix. For a larger Hilbert space more information can be deduced from off-diagonal terms related to various energy levels and interactions between the levels.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2021-02-01T22:32:30.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15795" PostTypeId="2" ParentId="15789" CreationDate="2021-02-02T01:58:57.340" Score="2" Body="&lt;p&gt;Thanks for the comments, so &lt;span class=&quot;math-container&quot;&gt;$tr(M)$&lt;/span&gt; is exactly &lt;span class=&quot;math-container&quot;&gt;$\sum_i\langle i|M|i\rangle$&lt;/span&gt; as pointed. I just discovered the same question answered with a proof in the physics stackexchange: &lt;a href=&quot;https://physics.stackexchange.com/a/104155/273977&quot;&gt;https://physics.stackexchange.com/a/104155/273977&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14037" LastActivityDate="2021-02-02T01:58:57.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15796" PostTypeId="2" ParentId="15731" CreationDate="2021-02-02T02:15:40.943" Score="1" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For a problem of size &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, computational complexity of quantum annealing is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(e^{\sqrt{N}})$&lt;/span&gt;. This is better than simulated annealing, which has a complexity of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(e^{N})$&lt;/span&gt;. Both these complexities are mentioned in &lt;a href=&quot;https://link.springer.com/article/10.1140/epjst/e2015-02339-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;More analysis needs to be done to answer this question quantitatively. But, qualitatively, we can expect to have exponential number of iterations (&lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(e^{\sqrt{N}})$&lt;/span&gt;) to be within &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;-error.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12614" LastActivityDate="2021-02-02T02:15:40.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15797" PostTypeId="1" CreationDate="2021-02-02T04:01:48.767" Score="5" ViewCount="71" Body="&lt;p&gt;I'm trying to deploy a simple Quantum App written using Python on Heroku Server which is also using Microsoft's Q#, but getting the below error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError: module 'qsharp' has no attribute 'clients'&#xA;Traceback:&#xA;File &amp;quot;/app/.heroku/python/lib/python3.6/site-packages/streamlit/script_runner.py&amp;quot;, line 332, in _run_script&#xA;    exec(code, module.__dict__)&#xA;File &amp;quot;/app/qrng_final.py&amp;quot;, line 18, in &amp;lt;module&amp;gt;&#xA;    import qsharp&#xA;File &amp;quot;/app/.heroku/python/lib/python3.6/site-packages/qsharp/__init__.py&amp;quot;, line 123, in &amp;lt;module&amp;gt;&#xA;    client = _start_client()&#xA;File &amp;quot;/app/.heroku/python/lib/python3.6/site-packages/qsharp/clients/__init__.py&amp;quot;, line 31, in _start_client&#xA;    client = qsharp.clients.iqsharp.IQSharpClient()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Log from the docker image:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ovyan@7ca97f8365fb: /appjovyan@7ca97f8365fb:/app&lt;span class=&quot;math-container&quot;&gt;$ ls&#xA;Dockerfile  Operation.qs  README.md  qrng_final.py     runtime.txt&#xA;LICENSE     Procfile      obj        requirements.txt  setup.sh&#xA;ovyan@7ca97f8365fb: /appjovyan@7ca97f8365fb:/app$&lt;/span&gt; ls &lt;span class=&quot;math-container&quot;&gt;$HOME/.local/bin&#xA;base58     f2py3         pip3             pybind11-config  virtualenv&#xA;cygdb      f2py3.7       pip3.7           sample           virtualenv-clone&#xA;cython     get_objgraph  pipenv           streamlit        watchmedo&#xA;cythonize  isympy        pipenv-resolver  streamlit.cmd&#xA;f2py       pip           plasma_store     undill&#xA;ovyan@7ca97f8365fb: /appjovyan@7ca97f8365fb:/app$&lt;/span&gt; ls &lt;span class=&quot;math-container&quot;&gt;$HOME/.local/binls $&lt;/span&gt;HOME/.local/bin &lt;span class=&quot;math-container&quot;&gt;$HOME/.local/bin $&lt;/span&gt;HOME/.local/binc &lt;span class=&quot;math-container&quot;&gt;$HOME/.local/bind $&lt;/span&gt;HOME/.local/bin &lt;span class=&quot;math-container&quot;&gt;$HOME/.local/bin$&lt;/span&gt;HOME/.local/bin&#xA;ovyan@7ca97f8365fb: ~/.local/binjovyan@7ca97f8365fb:~/.local/bin&lt;span class=&quot;math-container&quot;&gt;$ ls streamlit&#xA;streamlit&#xA;ovyan@7ca97f8365fb: ~/.local/binjovyan@7ca97f8365fb:~/.local/bin$&lt;/span&gt; ls streamlit/streamltit&#xA;ls: cannot access 'streamlit/streamlit': Not a directory&#xA;ovyan@7ca97f8365fb: ~/.local/binjovyan@7ca97f8365fb:~/.local/bin&lt;span class=&quot;math-container&quot;&gt;$ ls streamlit/streamlit streamlit/streamlit streamlit/streamlitc streamlit/streamlita streamlit/streamlitt streamlit/streamlit&#xA;cat: streamlit/streamlit: Not a directory&#xA;ovyan@7ca97f8365fb: ~/.local/binjovyan@7ca97f8365fb:~/.local/bin$&lt;/span&gt; cat steeamlit&#xA;#!/usr/local/bin/python&#xA;# -*- coding: utf-8 -*-&#xA;import re&#xA;import sys&#xA;from streamlit.cli import main&#xA;if __name__ == '__main__':&#xA;    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?&lt;span class=&quot;math-container&quot;&gt;$', '', sys.argv[0])&#xA;sys.exit(main())&#xA;ovyan@7ca97f8365fb: ~/.local/binjovyan@7ca97f8365fb:~/.local/bin$&lt;/span&gt; cd ..&#xA;ovyan@7ca97f8365fb: ~/.localjovyan@7ca97f8365fb:~/.local&lt;span class=&quot;math-container&quot;&gt;$ vfcf f ..cd /app&#xA;ovyan@7ca97f8365fb: /appjovyan@7ca97f8365fb:/app$&lt;/span&gt; ls&#xA;Dockerfile  Operation.qs  README.md  qrng_final.py     runtime.txt&#xA;LICENSE     Procfile      obj        requirements.txt  setup.sh&#xA;ovyan@7ca97f8365fb: /appjovyan@7ca97f8365fb:/app&lt;span class=&quot;math-container&quot;&gt;$ $&lt;/span&gt;HOME/.local/bin/streamlit run qrng_final.py &#xA;2021-02-06 23:56:11.279 &#xA;Warning: the config option 'server.enableCORS=false' is not compatible with 'server.enableXsrfProtection=true'.&#xA;As a result, 'server.enableCORS' is being overridden to 'true'.&#xA;&#xA;More information:&#xA;In order to protect against CSRF attacks, we send a cookie with each request.&#xA;To do so, we must specify allowable origins, which places a restriction on&#xA;cross-origin resource sharing.&#xA;&#xA;If cross origin resource sharing is required, please disable server.enableXsrfProtection.&#xA;            &#xA;2021-02-06 23:56:13.041 &#xA;Warning: the config option 'server.enableCORS=false' is not compatible with 'server.enableXsrfProtection=true'.&#xA;As a result, 'server.enableCORS' is being overridden to 'true'.&#xA;&#xA;More information:&#xA;In order to protect against CSRF attacks, we send a cookie with each request.&#xA;To do so, we must specify allowable origins, which places a restriction on&#xA;cross-origin resource sharing.&#xA;&#xA;If cross origin resource sharing is required, please disable server.enableXsrfProtection.&#xA;            &#xA;&#xA;  You can now view your Streamlit app in your browser.&#xA;&#xA;  Network URL: http://172.17.0.2:8501&#xA;  External URL: http://106.51.241.244:8501&#xA;&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:107: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  z = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:108: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  x = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:107: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  z = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:108: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  x = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:107: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  z = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:108: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  x = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:107: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  z = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:108: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  x = np.zeros(len(label), dtype=np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;/home/jovyan/.local/lib/python3.7/site-packages/qiskit/quantum_info/operators/pauli.py:30: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.&#xA;Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations&#xA;  arr = np.asarray(arr).astype(np.bool)&#xA;2021-02-06 23:56:17.792 Starting IQ# kernel...&#xA;2021-02-06 23:56:23.896 Exception while checking if IQ# is ready.&#xA;Traceback (most recent call last):&#xA;  File &amp;quot;/usr/local/lib/python3.7/site-packages/qsharp/clients/iqsharp.py&amp;quot;, line 97, in is_ready&#xA;    result = self.component_versions(timeout=6)&#xA;  File &amp;quot;/usr/local/lib/python3.7/site-packages/qsharp/clients/iqsharp.py&amp;quot;, line 193, in component_versions&#xA;    self._execute(&amp;quot;%version&amp;quot;, output_hook=capture, _quiet_=True, **kwargs)&#xA;  File &amp;quot;/usr/local/lib/python3.7/site-packages/qsharp/clients/iqsharp.py&amp;quot;, line 270, in _execute&#xA;    reply = self.kernel_client.execute_interactive(input, output_hook=_output_hook, **kwargs)&#xA;  File &amp;quot;/usr/local/lib/python3.7/site-packages/jupyter_client/blocking/client.py&amp;quot;, line 321, in execute_interactive&#xA;    raise TimeoutError(&amp;quot;Timeout waiting for output&amp;quot;)&#xA;TimeoutError: Timeout waiting for output&#xA;Preparing Q# environment...&#xA;2021-02-06 23:56:27.619 Q# version&#xA;{'iqsharp': LooseVersion ('0.15.2101126940'), 'Jupyter Core': LooseVersion ('1.5.0.0'), '.NET Runtime': LooseVersion ('.NETCoreApp,Version=v3.1')}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have already given Q#package name in &lt;code&gt;requirements.txt&lt;/code&gt; but still not able to resolve it. Is there any solution around how can I install Q# binded with Python on any remote server?&lt;/p&gt;&#xA;" OwnerUserId="9365" LastEditorUserId="9365" LastEditDate="2021-02-06T23:59:32.777" LastActivityDate="2021-02-06T23:59:32.777" Title="Q# installation on Heroku" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15798" PostTypeId="2" ParentId="15754" CreationDate="2021-02-02T09:22:29.587" Score="2" Body="&lt;p&gt;The two facts are connected in that they both arise as a result of rotational invariance of the Haar measure.&lt;/p&gt;&#xA;&lt;p&gt;We will derive them in the case of large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; since this is when the Porter-Thomas distribution takes the exponential form given in the question. Also, this case admits an intuitive proof backed by a geometric picture. For small &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, Porter-Thomas distribution is a Beta distribution. In this case, the proof turns into a lengthy calculation.&lt;/p&gt;&#xA;&lt;p&gt;Consider a Haar-random quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Let &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt;. Commonly, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is thought of as a complex vector &lt;span class=&quot;math-container&quot;&gt;$(a_0+ib_0, a_1+ib_1, \dots, a_{N-1}+ib_{N-1})^T \in \mathbb{C}^{N}$&lt;/span&gt; of unit norm, but we will think of it as a real vector&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;v = \sqrt{2N}(a_0, b_0, a_1, b_1, \dots, a_{N-1}, b_{N-1})^T\in\mathbb{R}^{2N}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is drawn from the Haar measure, &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; is uniformly distributed over a sphere of radius &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2N}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^{2N}$&lt;/span&gt;. We would like to characterize the distribution of the real coordinates &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An easy observation is that all coordinates &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_j$&lt;/span&gt; have the same distribution. This follows from the fact that Haar measure is unitarily invariant and permutations are unitary matrices. We can say more using the following&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Theorem&lt;/strong&gt; (Diaconis-Freedman). &lt;em&gt;The first &lt;span class=&quot;math-container&quot;&gt;$k=o(d)$&lt;/span&gt; coordinates of a point uniformly distributed over the surface of the &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-sphere of radius &lt;span class=&quot;math-container&quot;&gt;$\sqrt{d}$&lt;/span&gt; are independent standard normal variables in the limit of &lt;span class=&quot;math-container&quot;&gt;$d\to\infty$&lt;/span&gt;&lt;/em&gt;.&lt;sup&gt;[1]&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;p&gt;In our case, permutation invariance means that &lt;em&gt;any&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$k=o(N)$&lt;/span&gt; coordinates of &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; are independent standard normal variables, &lt;span class=&quot;math-container&quot;&gt;$a_j\sqrt{2N} \sim \mathcal{N}(0, 1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_j\sqrt{2N} \sim \mathcal{N}(0, 1)$&lt;/span&gt;. Consequently,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2Np_j = 2N|\langle j|\psi\rangle|^2 = \left(a_j\sqrt{2N}\right)^2 + \left(b_j\sqrt{2N}\right)^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is the sum of squares of two standard normal variables. In other words, &lt;span class=&quot;math-container&quot;&gt;$2Np_j$&lt;/span&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Chi-square_distribution&quot; rel=&quot;nofollow noreferrer&quot;&gt;chi-square&lt;/a&gt; random variable with two degrees of freedom &lt;a href=&quot;https://en.wikipedia.org/wiki/Chi-square_distribution#Related_distributions&quot; rel=&quot;nofollow noreferrer&quot;&gt;which is the same&lt;/a&gt; distribution as the exponential distribution with rate parameter &lt;span class=&quot;math-container&quot;&gt;$\lambda = \frac{1}{2}$&lt;/span&gt;. Thus, the probability density function of &lt;span class=&quot;math-container&quot;&gt;$2Np_j$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\exp(-\frac{1}{2}p)$&lt;/span&gt;, so probability density function of &lt;span class=&quot;math-container&quot;&gt;$p_j$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$N\exp(-Np)$&lt;/span&gt;, establishing fact 1 in the question.&lt;/p&gt;&#xA;&lt;p&gt;Now suppose we independently draw two quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; from the Haar measure. Fix an output bitstring &lt;span class=&quot;math-container&quot;&gt;$j \in \{0, 1\}^n$&lt;/span&gt; and consider the output probabilities &lt;span class=&quot;math-container&quot;&gt;$|\langle j|\psi_1\rangle|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\langle j|\psi_2\rangle|^2$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; have been drawn independently from the Haar measure, the two probabilities are independent from each other. Moreover, by the arguments above both have the same distribution with density function &lt;span class=&quot;math-container&quot;&gt;$N\exp(-Np)$&lt;/span&gt;, establishing fact 2 in the question.&lt;/p&gt;&#xA;&lt;p&gt;The key point to explain the symmetry between facts 1 and 2 is the independence of different coordinates of a uniformly distributed point on a sphere. As long as we only have access to a small number &lt;span class=&quot;math-container&quot;&gt;$k=o(2^n)$&lt;/span&gt; of output probabilities of a Haar-random quantum state they are all independent and identically distributed random variables with Porter-Thomas distribution. In other words, for any quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi_j\rangle$&lt;/span&gt; chosen independently from the Haar measure and any &lt;span class=&quot;math-container&quot;&gt;$k=o(2^n)$&lt;/span&gt; bitstrings &lt;span class=&quot;math-container&quot;&gt;$z_i\in\{0, 1\}^n$&lt;/span&gt;, also chosen independently, each of the probabilities &lt;span class=&quot;math-container&quot;&gt;$|\langle z_i|\psi_j\rangle|^2$&lt;/span&gt; constitutes an independent sample from the same distribution with density function &lt;span class=&quot;math-container&quot;&gt;$N\exp(-Np)$&lt;/span&gt;. This highlights the very high degree of symmetry of the Haar measure.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The observation that some states with non-zero probability density, such as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt;, do not exhibit Porter-Thomas output distribution is correct. One might be tempted to dismiss this case as a zero-measure set. However, there is a small, but positive measure set of states in the vicinity of  &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; that also do not exhibit Porter-Thomas output distribution.&lt;/p&gt;&#xA;&lt;p&gt;The key point is that &lt;em&gt;typical&lt;/em&gt; Haar-random states do. This can probably be made more rigorous by deriving an appropriate concentration inequality, e.g. bounding the probability that the total variation distance between the output distribution of a Haar-random state and the Porter-Thomas distribution exceeds a threshold. However, the following informal argument illustrates the point. One way to think of the process of drawing a Haar-random state is as a long sequence of draws of the real and imaginary parts of each amplitude from (approximate) standard normal distribution: &lt;span class=&quot;math-container&quot;&gt;$a_0, b_0, a_1, b_1, \dots$&lt;/span&gt;. A quantum state in the vicinity of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; can be thought of as a sequence in which &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; is approximately &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and all other numbers are approximately &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Probability of obtaining such a result from a sequence of draws from (approximate) standard normal distribution is extremely small, because the dimension of the Hilbert space and thus the length of the sequence is very large.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sup&gt;[1] Persi Diaconis and David Freedman. &lt;em&gt;&lt;a href=&quot;http://www.numdam.org/item/AIHPB_1987__23_S2_397_0/&quot; rel=&quot;nofollow noreferrer&quot;&gt;A dozen de Finetti-style results in search of a theory.&lt;/a&gt;&lt;/em&gt; Ann. Inst. H. Poincar´e Probab. Statist., 23(2, suppl.), p.397–423, 1987.&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-02T09:22:29.587" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15799" PostTypeId="1" CreationDate="2021-02-02T09:30:26.517" Score="3" ViewCount="75" Body="&lt;p&gt;The Quantum Phase Estimation algorithm wants to approximate the phase &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; of an eigenvalue  &lt;span class=&quot;math-container&quot;&gt;$\lambda = e^{2\pi i \varphi}$&lt;/span&gt; of a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&#xA;Besides &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; an eigenvector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; corresponding to &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is given, that is, we know,&#xA;&lt;span class=&quot;math-container&quot;&gt;$U x = \lambda x$&lt;/span&gt;.&#xA;However, isn't computing the eigenvalue of a given eigenvector fairly simple?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Let &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; be an index with &lt;span class=&quot;math-container&quot;&gt;$x_i \neq 0$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;compute &lt;span class=&quot;math-container&quot;&gt;$U x$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;compute &lt;span class=&quot;math-container&quot;&gt;$\frac{(Ux)_i}{x_i}$&lt;/span&gt;​​  which equals &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What am I missing?&#xA;Is it the fact that it might not be easy to find an index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$x_i \neq 0$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="14690" LastEditorUserId="55" LastEditDate="2021-02-03T10:24:44.153" LastActivityDate="2021-02-03T12:30:14.650" Title="In the quantum phase estimation algorithm, why can't we directly compute the eigenvalue from the known eigenvector?" Tags="&lt;algorithm&gt;&lt;phase-estimation&gt;&lt;eigenvalue&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15800" PostTypeId="2" ParentId="15792" CreationDate="2021-02-02T10:28:05.427" Score="6" Body="&lt;p&gt;To put it very shortly, non-zero off-diagonal elements of the density matrix signify that your system features a &lt;strong&gt;quantum superposition&lt;/strong&gt; between the elements of the basis that you chose to represent &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. In other words, your state is not only a statistical mixture of your basis states (which can be understood as representing &lt;em&gt;your&lt;/em&gt; ignorance about the system), but an actual quantum superposition in which those basis elements are &amp;quot;coexisting&amp;quot;. Of course there can be a combination between those two situations (different degrees of coherence/mixture), and all this is basis dependent (something that looks like a quantum superposition in one basis, can be described in terms of a single basis element in a different basis).&lt;/p&gt;&#xA;" OwnerUserId="14691" LastEditorUserId="10480" LastEditDate="2021-02-02T18:19:54.373" LastActivityDate="2021-02-02T18:19:54.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15801" PostTypeId="2" ParentId="15774" CreationDate="2021-02-02T10:44:05.833" Score="1" Body="&lt;p&gt;Given an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, be it a superposition of computational basis states or not, you can always (in principle) measure in a basis that contains &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Mathematically, a trivial example is using the pair of projectors &lt;span class=&quot;math-container&quot;&gt;$(P,I-P)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$P=|\psi\rangle\!\langle\psi|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-02T10:44:05.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15802" PostTypeId="2" ParentId="15797" CreationDate="2021-02-02T18:10:37.940" Score="3" Body="&lt;p&gt;I believe that Heroku does not currently support installing additional software, such as the IQ# kernel used by the &lt;code&gt;qsharp&lt;/code&gt; Python package. That said, &lt;a href=&quot;https://help.heroku.com/IYRYW6VB/how-do-i-install-additional-software-packages-that-my-application-requires&quot; rel=&quot;nofollow noreferrer&quot;&gt;Heroku's documentation suggests&lt;/a&gt; that using Docker can allow for providing additional dependencies. The Quantum Development Kit is published along with a Docker image, &lt;code&gt;iqsharp-base&lt;/code&gt;, that provides everything you need to use Q# and Python together within a Docker environment:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FROM mcr.microsoft.com/quantum/iqsharp-base:0.15.2101125897&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2021-02-02T18:10:37.940" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15803" PostTypeId="1" CreationDate="2021-02-02T19:43:07.037" Score="2" ViewCount="93" Body="&lt;p&gt;I have to write a report on &amp;quot;Classical Interaction Cannot Replace a Quantum Message&amp;quot; by Gavinsky (arxiv &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0703215&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The author gave a &lt;a href=&quot;http://pirsa.org/displayFlash.php?id=07030026&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture&lt;/a&gt;, and at 14:55 explains that a communication problem exists where Alice has input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, Bob has input &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and together they produce an output &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. This problem is relational so every &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; there are multiple output &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. In the video he explains that a table(galois field) exists in the communication channel which stores the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and then calculates &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; by taking the bitwise XOR and giving orthogonal bits to the resultant.&lt;/p&gt;&#xA;&lt;p&gt;After watching that part of the video and reading through some of the paper,&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I also want to know if Alice and Bob have a fixed number of rows  and columns dedicated to them for calculating the output, and are the  number of elements in each cell fixed or variable?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How are the elements placed in the table?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These definitions are provided in the paper on page 3:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Definition 1. Let &lt;span class=&quot;math-container&quot;&gt;$x, y⊂[n^2]$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$|x|=n/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y|=n$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$z \in \mathcal{G} \mathcal{F}_{2}^{2 \log n} \backslash\{\overline{0}\}$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\Sigma=\left\{\sigma_{2^{2 i}}\right\}_{i=1}^{\infty}$&lt;/span&gt; be a set of reversible mappings from [2&lt;span class=&quot;math-container&quot;&gt;$^{2i}$&lt;/span&gt;] to GF&lt;span class=&quot;math-container&quot;&gt;$^{2i}_2$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$(x, y, z) ∈ P^Σ_{1×1}$&lt;/span&gt; if either &lt;span class=&quot;math-container&quot;&gt;$|x \cap y| \neq 2$&lt;/span&gt; or〈z, a+b〉= 0, where &lt;span class=&quot;math-container&quot;&gt;$\sigma_{n^{2}}(x \cap y)=\{a, b\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Sigma_{0}$&lt;/span&gt; be the set of reversible mappings from &lt;span class=&quot;math-container&quot;&gt;$\left[2^{2 i}\right] \text { to } \mathcal{G} \mathcal{F}_{2}^{2 i}$&lt;/span&gt;, preserving the lexicographic ordering of the elements.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Definition 2. Let &lt;span class=&quot;math-container&quot;&gt;$x \subset\left[2 n^{2}\right],|x|=n$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$y = (y_1, . . . , y_{n/4})$&lt;/span&gt; be a tuple of disjoint subsets of [n&lt;span class=&quot;math-container&quot;&gt;$^{2}$&lt;/span&gt;], each of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\left|x \cap y_{j}\right|=2$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$1 \leq j \leq n / 4$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$z \in \mathcal{G} \mathcal{F}_{2}^{2 \log n+1} \backslash\{\overline{0}\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1 \leq i \leq n / 4$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$(x, y,(i, z)) \in P^{(n)} \text { if }\langle z, a+b\rangle=0$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\sigma_{0}\left(x \cap y_{i}\right)=\{a, b\}$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\sigma_{0} \in \Sigma_{0}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In the rest of the paper we will implicitly assume equivalence between the arguments and the corresponding values of every &lt;span class=&quot;math-container&quot;&gt;$\sigma_{0} \in \Sigma_{0}$&lt;/span&gt;. We will show that P is easy to solve in Q&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt; and is hard for R. In order to prove the lower bound we will use the following modification of &lt;span class=&quot;math-container&quot;&gt;$P_{1 \times 1}^{\Sigma}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Definition 3. Let &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$y⊂[n^2]$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$|x|=n/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y|=n$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$z\subset[n^2]$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$(x, y, z) ∈ P^{search}_{1×1}$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x∩y=z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="14698" LastEditorUserId="2927" LastEditDate="2021-02-04T00:14:59.130" LastActivityDate="2021-02-04T00:14:59.130" Title="How are inputs during the quantum communication between Alice and Bob placed in the Galois Field?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;entanglement&gt;&lt;cryptography&gt;&lt;communication&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15804" PostTypeId="1" AcceptedAnswerId="15805" CreationDate="2021-02-02T20:10:28.237" Score="9" ViewCount="506" Body="&lt;p&gt;Let's say I have a matrix representation, e.g.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I determine whether a quantum circuit can be constructed given said matrix representation? Is unitarity a sufficient and necessary condition?&lt;/p&gt;&#xA;" OwnerUserId="13570" LastEditorUserId="10480" LastEditDate="2021-02-02T21:44:33.850" LastActivityDate="2021-02-08T21:56:27.600" Title="How to check if a quantum circuit can be constructed for a given matrix representation?" Tags="&lt;mathematics&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15805" PostTypeId="2" ParentId="15804" CreationDate="2021-02-02T21:42:14.293" Score="9" Body="&lt;p&gt;Correct, unitarity is a sufficient and necessary condition. From Nielson and Chuang page 18:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Amazingly, this &lt;em&gt;unitary&lt;/em&gt; constraint is the &lt;em&gt;only&lt;/em&gt; constraint on&#xA;quantum gates. Any unitary matrix specifies a valid quantum gate! The&#xA;interesting implication is that in contrast to the classical case,&#xA;where only one non-trivial single bit gate exists - the NOT gate -&#xA;there are many non-trivial single qubit gates.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-02-08T21:56:27.600" LastActivityDate="2021-02-08T21:56:27.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15806" PostTypeId="2" ParentId="15804" CreationDate="2021-02-02T21:54:12.993" Score="7" Body="&lt;p&gt;Right. But when you build a quantum computer, you want to have a certain set of gates that you want to implement, and all other gates (unitary matrices) can be built from that set of gates. This is known as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;universal set&lt;/a&gt;. Surprisingly (or not), it is quite small. One example of a universal set is: &lt;span class=&quot;math-container&quot;&gt;$G = \{H, S, T, CNOT \}$&lt;/span&gt; where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix}, \hspace{.25 cm} T =\begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; e^{i\pi/4} \end{pmatrix}, \hspace{.25 cm} S = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; i \end{pmatrix}, \hspace{.25 cm} CNOT = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is just an example of one of many universal sets. These are the native gates you can say on your quantum hardware. For instance, on IBM hardware, the native gates are: { &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CXGate.html#qiskit.circuit.library.CXGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;CNOT&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.IGate.html#qiskit.circuit.library.IGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;I&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.RZGate.html#qiskit.circuit.library.RZGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;RZ&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.SXGate.html#qiskit.circuit.library.SXGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;SX&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.XGate.html#qiskit.circuit.library.XGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;X&lt;/a&gt; }. The point is every unitary matrix can be approximated to an arbitrary, &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, error using those gates. This formed your quantum circuit.&lt;/p&gt;&#xA;&lt;p&gt;The matrix example you gave is the matrix representation of the &lt;em&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.SwapGate.html#qiskit.circuit.library.SwapGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;SWAP&lt;/a&gt;&lt;/em&gt; gate. It is not a native gate on a quantum hardware but this is because you can simply implement it as a sequence of CNOT gates as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ane55.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ane55.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="10480" LastEditDate="2021-02-03T18:04:13.733" LastActivityDate="2021-02-03T18:04:13.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15807" PostTypeId="1" AcceptedAnswerId="15810" CreationDate="2021-02-03T07:09:15.167" Score="3" ViewCount="79" Body="&lt;p&gt;The Hadamard gate allows us to construct an equal superposition of states. If one wants to construct an arbitrary superposition e.g. &lt;span class=&quot;math-container&quot;&gt;$\alpha\vert 0\rangle + \beta\vert 1\rangle + ..$&lt;/span&gt;, how does one create the corresponding unitary?&lt;/p&gt;&#xA;&lt;p&gt;Such a unitary should act on &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; and output the desired state. Also, in more generality, it should take in &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle^{\otimes n}$&lt;/span&gt; and output some coherent superposition state of my choice.&lt;/p&gt;&#xA;&lt;p&gt;I ask this question since many quantum algorithms encode a classical vector &lt;span class=&quot;math-container&quot;&gt;$(x_1, x_2,... x_n)$&lt;/span&gt; into a quantum state &lt;span class=&quot;math-container&quot;&gt;$\sum_i x_i\vert i\rangle$&lt;/span&gt; but this step itself seems hard to achieve.&lt;/p&gt;&#xA;" OwnerUserId="14708" LastEditorUserId="55" LastEditDate="2021-02-03T11:10:31.637" LastActivityDate="2021-02-04T18:12:33.733" Title="How does one create the unitary sending $|0\rangle$ into a target quantum state?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15808" PostTypeId="2" ParentId="15766" CreationDate="2021-02-03T08:13:01.553" Score="2" Body="&lt;p&gt;In practice, you're not really rotating about &lt;span class=&quot;math-container&quot;&gt;$|00\ldots 0\rangle$&lt;/span&gt;. &lt;em&gt;Really&lt;/em&gt;, you're rotating around &lt;span class=&quot;math-container&quot;&gt;$U|00\ldots 0\rangle$&lt;/span&gt; which is some superposition of &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle$&lt;/span&gt;. If you have another method that prepares such a superposition by acting &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; on some state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;, that's perfectly fine too.&lt;/p&gt;&#xA;&lt;p&gt;That said, in a standard search, you don't know what it is you're search for, so you have to allow for it to be any possibility, and hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V|\Psi\rangle=\frac{1}{\sqrt{2^n}}\sum_x|x\rangle&#xA;$$&lt;/span&gt;&#xA;makes a lot of sense, and the most natural way to implement this is &lt;span class=&quot;math-container&quot;&gt;$(H|0\rangle)^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-03T08:13:01.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15810" PostTypeId="2" ParentId="15807" CreationDate="2021-02-03T11:10:03.087" Score="2" Body="&lt;p&gt;If you want to generate a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you can use any unitary whose first column is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (assuming you are using a convention in which &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; represents the first row/column, as is usually done).&lt;/p&gt;&#xA;&lt;p&gt;More generally, if you are looking for a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle=|\phi\rangle$&lt;/span&gt; for some given &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, you can choose any &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U = |\phi\rangle\!\langle\psi| + U'$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$U'=\sum_j |\phi_j\rangle\!\langle \psi_j|$&lt;/span&gt; for any choice of orthonormal bases &lt;span class=&quot;math-container&quot;&gt;$\{|\phi_j\rangle\}_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_j\rangle\}_j$&lt;/span&gt; which span the spaces &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle_\perp$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_\perp$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-03T11:10:03.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15812" PostTypeId="2" ParentId="15799" CreationDate="2021-02-03T12:30:14.650" Score="1" Body="&lt;p&gt;There are two different issues at play here. First is the difficulty of the calculation. If you have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then to evaluate &lt;span class=&quot;math-container&quot;&gt;$Ux$&lt;/span&gt;, you have to multiply a &lt;span class=&quot;math-container&quot;&gt;$2^n\times 2^n$&lt;/span&gt; matrix with a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-element vector. This takes a long time (by naive methods, &lt;span class=&quot;math-container&quot;&gt;$O(4^n)$&lt;/span&gt;), even if you understand that the method seems simple and straightforward. There's just so much data. In comparison, phase estimation is much quicker (depending on what assumptions you make, based on how easily you can produce controlled-&lt;span class=&quot;math-container&quot;&gt;$U^{2^k}$&lt;/span&gt;). But sometimes, as in the case of order finding, you get down to something that's polynomial in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The second issue is the application. Yes, it can seem pretty dumb that if you know the eigenvector, you have to make the eigenvector to find the eigenvalue. That, as a general rule, is not how the algorithms that use phase estimation actually work. For example, order finding does not input an eigenstate, it's just that you need the understanding of how it works on eigenstates in order to be able to process the overall function. Much the same is true of other algorithms such as HHL. Indeed, these algorithms use phase estimation to decompose an input state in terms of the eigenbasis even though you don't know what that basis is.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-03T12:30:14.650" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15813" PostTypeId="2" ParentId="15807" CreationDate="2021-02-03T13:42:26.903" Score="2" Body="&lt;p&gt;To create arbitrary one qubit state you can use combination of &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; gates. &lt;span class=&quot;math-container&quot;&gt;$Ry(\theta)$&lt;/span&gt; gate takes state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle$&lt;/span&gt;. By setting angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; you achive desired probabilities of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. If you now apply &lt;span class=&quot;math-container&quot;&gt;$Rz(\varphi)$&lt;/span&gt; gate you get state &lt;span class=&quot;math-container&quot;&gt;$\mathrm{e}^{-i\varphi/2}\cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi/2}\sin(\theta/2)|1\rangle$&lt;/span&gt; which is equivalent to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi}\sin(\theta/2)|1\rangle&#xA;$$&lt;/span&gt;&#xA;because global phase can be neglected. Hence by setting angles &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; you can set any phase you want. Overall, the state above is the most general description of a qubit. So, this method allows you to prepare one qubit in any state you want.&lt;/p&gt;&#xA;&lt;p&gt;Note that on IBM Q you can employ gate &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; instead.&lt;/p&gt;&#xA;&lt;p&gt;To prepare multiqubit state is more difficult. You can follow a method in this article:&#xA;&lt;a href=&quot;https://cds.cern.ch/record/749895/files/0407010.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In Qiskit, you can use a method &lt;code&gt;initialize&lt;/code&gt; to set a quantum circuit input state:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;quantumState = [&#xA;    1 / math.sqrt(2) * complex(1, 0),&#xA;    1 / 2 * complex(1, 1)]&#xA;&#xA;q = QuantumRegister(1, name = 'q')&#xA;c = ClassicalRegister(1, name = 'c')&#xA;&#xA;circuit = QuantumCircuit(q,c)&#xA;&#xA;circuit.initialize(quantumState, [q[0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case, one qubit state is prepared, however, matrix &lt;code&gt;quantumState&lt;/code&gt; can be for example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[1 / math.sqrt(2), 0, 0, 1 / math.sqrt(2)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;for Bell state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-03T13:42:26.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15815" PostTypeId="1" CreationDate="2021-02-03T14:32:35.943" Score="4" ViewCount="46" Body="&lt;p&gt;I am a Physics student that just entered the field of quantum computing. I am obviously lacking in the electronic engineering side of things and would love to learn more! Any advice for good books?&lt;/p&gt;&#xA;" OwnerUserId="14621" LastEditorUserId="55" LastEditDate="2021-02-05T16:59:20.947" LastActivityDate="2021-02-05T16:59:20.947" Title="Does anyone know of any good books to learn about the electronics/electrical engineering side of quantum computing?" Tags="&lt;resource-request&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15816" PostTypeId="1" AcceptedAnswerId="15820" CreationDate="2021-02-03T15:12:48.910" Score="4" ViewCount="61" Body="&lt;p&gt;In Nielsen &amp;amp; Chuang's book &amp;quot;Quantum Computation and Quantum Information&amp;quot; section 10.5.6, page 467 there is the following statement&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Consider the familiar three-qubit bit-flip code spanned by the states &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;, with&#xA;stabilizer generated by &lt;span class=&quot;math-container&quot;&gt;$Z_{1}Z_{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_{2}Z_{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;How do we find these stabilizer generators?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Is this stabilizer set is unique? ( code spanned by &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;, have only &lt;span class=&quot;math-container&quot;&gt;$Z_{1}Z_{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_{2}Z_{3}$&lt;/span&gt; as generator stabilizer nothing else?)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-05T17:00:24.513" LastActivityDate="2021-02-05T17:00:24.513" Title="How do we find the stabilizer generators for the three-qubit bit-flip code spanned by $|000\rangle$ and $|111\rangle$?" Tags="&lt;error-correction&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15817" PostTypeId="1" AcceptedAnswerId="15885" CreationDate="2021-02-03T15:16:54.593" Score="1" ViewCount="39" Body="&lt;p&gt;State vectors take more space when we have to specify certain states. In stabilizer formalism, we can specify these states in a much more compact way.&lt;/p&gt;&#xA;&lt;p&gt;But in error correction then we say that the error of a particular code can be measured by measuring the generators.&lt;/p&gt;&#xA;&lt;p&gt;How does it help? What does it give us extra in terms of error detection? (Finding these generators is difficult as well).&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="10480" LastEditDate="2021-02-06T16:07:11.767" LastActivityDate="2021-02-06T16:10:51.700" Title="Stabilizer code: error detection why does it matter?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15818" PostTypeId="1" AcceptedAnswerId="15864" CreationDate="2021-02-03T15:24:13.307" Score="3" ViewCount="84" Body="&lt;p&gt;The HHL algorithm lies on an implementation of the Quantum Phase Estimation algorithm. One popular implementation is based on the Quantum Fourier Transform which can be divided in three steps. Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; be a unitary matrix and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; an eigenvector s.t. &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle = e^{2\pi i\theta}|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n }|\psi\rangle$&lt;/span&gt; the initial state of the system.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit Hadamard gate operation &lt;span class=&quot;math-container&quot;&gt;$H^{{\otimes}n}$&lt;/span&gt; to the first register&lt;/strong&gt;. The state of system becomes &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt N} (|0\rangle + |1\rangle)^{\otimes n} |\psi\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apply controlled unitary operations &lt;span class=&quot;math-container&quot;&gt;$C-U$&lt;/span&gt; to the first register&lt;/strong&gt;. More precisely, we want to apply a &lt;span class=&quot;math-container&quot;&gt;$C-U^{2^{j}}$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$(n-j)^{th}$&lt;/span&gt; qubit of the first register for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. Now the state of the first register is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt N} \underbrace{ \left (|0\rangle + e^{2\pi i 2^{n-1} \theta}|1\rangle \right )}_{1^{st} \ qubit} \otimes \cdots \otimes \underbrace{\left (|0\rangle + e^{2\pi i 2^1 \theta}|1\rangle \right )}_{n-1^{th} \ qubit} \otimes\underbrace{\left (|0\rangle + e^{2\pi i 2^{0} \theta}|1\rangle \right )}_{n^{th} \ qubit}  = \frac{1}{\sqrt N}\sum_{k=0}^{2^n -1} e^{2\pi i \theta k} |k\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apply inverse Quantum Fourier Transform on the first register&lt;/strong&gt;, which yields to a binary approximation of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; stored in the first register.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The following picture summarize all these steps :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YfOBG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YfOBG.png&quot; alt=&quot;Wikipedia&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt; : how do one implement efficiently the circuit &lt;span class=&quot;math-container&quot;&gt;$C-U^{2^{j}}$&lt;/span&gt; ? A naive approach would be to use &lt;span class=&quot;math-container&quot;&gt;$2^j$&lt;/span&gt; circuit &lt;span class=&quot;math-container&quot;&gt;$C-U$&lt;/span&gt; and apply them successfully but the overall complexity would be of order &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; which is not what we want in the HHL algorithm.&lt;/p&gt;&#xA;" OwnerUserId="14113" LastEditorUserId="55" LastEditDate="2021-02-05T17:02:23.727" LastActivityDate="2021-02-05T17:02:23.727" Title="Efficient QFT-based QPEA complexity" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;quantum-fourier-transform&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15820" PostTypeId="2" ParentId="15816" CreationDate="2021-02-03T17:56:10.273" Score="2" Body="&lt;p&gt;&lt;strong&gt;Finding stabilizers&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;By definition, a stabilizer group of a subspace of the Hilbert space of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is a subgroup of the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_group&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli group&lt;/a&gt;. It is easy to see that stabilizers can only have &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; phase. Therefore, there are &lt;span class=&quot;math-container&quot;&gt;$2 \cdot 4^n$&lt;/span&gt; candidate operators that could be stabilizers for the subspace. This seems large, but in practice one can quickly eliminate a large set of possibilities and then check which remaining operators fix the vectors in the subspace. It is useful to know that a &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;-dimensional subspace has &lt;span class=&quot;math-container&quot;&gt;$n-k$&lt;/span&gt; stabilizer generators. In particular, every stabilizer state defines a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;-dimensional subspace and therefore has exactly &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; stabilizer generators.&lt;/p&gt;&#xA;&lt;p&gt;For example, the three-qubit bit-flip code encodes one logical qubit, so &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; and we are looking for two stabilizer generators. We notice that any operator that acts as Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or Pauli &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; on any of the three qubits fails to fix &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;. This observation immediately rules out &lt;span class=&quot;math-container&quot;&gt;$112$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$128$&lt;/span&gt; candidate operators leaving only&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{cccc}&#xA;III &amp;amp; IIZ &amp;amp; IZI &amp;amp; ZII \\&#xA;ZZI &amp;amp; ZIZ &amp;amp; ZZI &amp;amp; ZZZ \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and their negations. The identity operator belongs to every subgroup of the Pauli group but is not a generator. Its negation has no eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; so it is not a stabilizer of any state. Operators with an odd number of Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; stabilize &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt;, but fail to stabilize &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;. Among the remaining operators all those with positive phase stabilize both states. Therefore, the stabilizer group of the three-qubit bit-flip code is &lt;span class=&quot;math-container&quot;&gt;$$S=\{III, IZZ, ZIZ, ZZI\}.$$&lt;/span&gt;Finally, we see that any two non-identity operators in &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; generate &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that this approach works for small &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. However, in practice when &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is large we never write down individual states, because they are often exponentially large superpositions of computational basis states. In fact, the very objective of stabilizer formalism is to allow us not to do that. Therefore, for large &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; stabilizer generators are used to provide initial description of a subspace or state and then are used directly in analysis to derive properties, design circuits, find transversal gates etc.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Uniqueness of stabilizers&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Care should be taken to distinguish two concepts: stabilizer &lt;em&gt;group&lt;/em&gt; and stabilizer &lt;em&gt;generators&lt;/em&gt;. Stabilizer group of a subspace contains all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Pauli operators that fix vectors in that subspace. Therefore, it is unique. However, this group has many different sets of independent generators. Suppose that &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is generated by &lt;span class=&quot;math-container&quot;&gt;$g_1, g_2, \dots, g_m$&lt;/span&gt; and that &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is any operator generated by &lt;span class=&quot;math-container&quot;&gt;$g_2, \dots, g_m$&lt;/span&gt;. Then the operators &lt;span class=&quot;math-container&quot;&gt;$gg_1, g_2, \dots g_m$&lt;/span&gt; are generators of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;. Therefore, a set of independent stabilizer generators is not unique.&lt;/p&gt;&#xA;&lt;p&gt;For example, we saw earlier that the stabilizer group of the three-qubit bit-flip code has three different sets of generators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G_1 = \{IZZ, ZIZ\} \\&#xA;G_2 = \{ZIZ, ZZI\} \\&#xA;G_3 = \{ZZI, IZZ\}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-03T17:56:10.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15821" PostTypeId="2" ParentId="15726" CreationDate="2021-02-03T18:14:45.683" Score="2" Body="&lt;p&gt;Here is a complete and elementary answer - the discussion in the comments was basically there.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$&lt;/span&gt; be given such that &lt;span class=&quot;math-container&quot;&gt;$ad-bc=0$&lt;/span&gt;.&#xA;Additionally, we have &lt;span class=&quot;math-container&quot;&gt;$\| \psi\|^2=|a|^2+|b|^2+|c|^2+|d|^2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now the latter condition implies that &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d$&lt;/span&gt; are not all zero. So WLOG assume &lt;span class=&quot;math-container&quot;&gt;$a\neq 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now we have a decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = |v\rangle\otimes |w\rangle= \left(a|0\rangle + c|1\rangle\right)\otimes\left(|0\rangle +\frac{b}{a}|1\rangle\right)=a|00\rangle+b|01\rangle+c|10\rangle+\frac{cb}{a}|11\rangle$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\frac{cb}{a}=d$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this decomposition, &lt;span class=&quot;math-container&quot;&gt;$\|v\|^2=|a|^2+|c|^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\|w\|^2=1+\left|\frac{b}{a} \right|^2$&lt;/span&gt;.&#xA;So the vectors &lt;span class=&quot;math-container&quot;&gt;$v,w$&lt;/span&gt; are not normalised in general.&#xA;Hence introduce a rescaling parameter, say &lt;span class=&quot;math-container&quot;&gt;$\lambda\in \mathbb{R}_{&amp;gt;0}$&lt;/span&gt;, such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\lambda |v\rangle \otimes \frac{1}{\lambda}|w\rangle&#xA;=\left(\lambda a|0\rangle + \lambda c|1\rangle\right)\otimes\left(\frac{1}{\lambda}|0\rangle +\frac{b}{\lambda a}|1\rangle\right)&#xA;.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now note that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\|\lambda v\|^2 \|\frac{1}{\lambda }w\|^2&#xA;&amp;amp;=\|v\|^2\|w\|^2\\&#xA;&amp;amp;=(|a|^2+|c|^2)\left(1+\left|\frac{b}{a} \right|^2\right)\\&#xA;&amp;amp;=|a|^2+|b|^2+|c|^2+\left|\frac{cb}{a}\right|^2\\&#xA;&amp;amp;=|a|^2+|b|^2+|c|^2+|d|^2=1.&#xA;\end{align*}&lt;/span&gt;&#xA;So if we pick &lt;span class=&quot;math-container&quot;&gt;$\lambda=\frac{1}{\|v\|}=\frac{1}{\sqrt{|a|^2+|c|^2}}$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\|\lambda v\|=1$&lt;/span&gt;, and the above also gives &lt;span class=&quot;math-container&quot;&gt;$\|\frac{1}{\lambda}w\|=1$&lt;/span&gt;.&#xA;This now gives a valid decomposition and shows &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is separable.&lt;/p&gt;&#xA;&lt;p&gt;(At a higher level, what we used in this last renormalisation step is actually the fact that for tensor products of Hilbert spaces, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle v_1\otimes w_1| v_2\otimes w_2\rangle_{H\otimes K}&#xA;=\langle v_1|v_2\rangle_H \cdot \langle w_1|w_2\rangle_K$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$v_1,v_2 \in H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$w_1,w_2\in K$&lt;/span&gt;.&#xA;In our case this gave &lt;span class=&quot;math-container&quot;&gt;$\|\psi\|^2=\|v\|^2\|w\|^2$&lt;/span&gt;.&#xA;)&lt;/p&gt;&#xA;&lt;p&gt;Analogous decompositions hold in the case that we assume &lt;span class=&quot;math-container&quot;&gt;$b,c$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; nonzero instead.&lt;/p&gt;&#xA;" OwnerUserId="14634" LastEditorUserId="10480" LastEditDate="2021-02-03T21:15:07.947" LastActivityDate="2021-02-03T21:15:07.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15822" PostTypeId="1" AcceptedAnswerId="15823" CreationDate="2021-02-03T18:16:36.203" Score="3" ViewCount="53" Body="&lt;p&gt;According to this &lt;a href=&quot;https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia page&lt;/a&gt; the initial state in Deutsch–Jozsa algorithm is written as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle^{\otimes n} |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;shouldn't it look like this?:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle^{\otimes n} \otimes |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14714" LastEditorUserId="55" LastEditDate="2021-02-05T17:07:41.620" LastActivityDate="2021-02-05T17:07:41.620" Title="Shouldn't the input state of Deutsh-Jozsa's algorithm look like $|0\rangle^{\otimes n}\otimes |1\rangle$ rather than $|0\rangle^{\otimes n}|1\rangle$?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;textbook-and-exercises&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15823" PostTypeId="2" ParentId="15822" CreationDate="2021-02-03T18:27:32.037" Score="5" Body="&lt;p&gt;This is just a convention. People tend to write &lt;span class=&quot;math-container&quot;&gt;$|01 \rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle \otimes |1\rangle $&lt;/span&gt;, but they mean the same thing. In this case,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \overbrace{|0\rangle \otimes |0\rangle \otimes \cdots \otimes |0\rangle}^{n \ \ times} \otimes|1\rangle = |0\rangle^{\otimes n} \otimes |1\rangle = |0\rangle^{\otimes n} |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So it is just a matter of notation.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-03T18:27:32.037" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15824" PostTypeId="1" CreationDate="2021-02-03T18:32:56.763" Score="4" ViewCount="105" Body="&lt;p&gt;I'm working through the Qiskit textbook right now, and wanted to complete part 1 of exercise 3.4, which asks me to use qiskit to produce the Bell state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|01\rangle + |10\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is equivalent to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;0 \\&#xA;\frac{1}{\sqrt2} \\&#xA;\frac{1}{\sqrt2}\\&#xA;0&#xA;\end{bmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you apply a CNOT to this, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;0 \\&#xA;0 \\&#xA;\frac{1}{\sqrt2}\\&#xA;\frac{1}{\sqrt2}&#xA;\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is just &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\otimes |+\rangle$&lt;/span&gt;. However, I can't figure out how to set my qubits up in the right way.&lt;/p&gt;&#xA;&lt;p&gt;Any tips on how to use qiskit to get that last matrix?&lt;/p&gt;&#xA;" OwnerUserId="14432" LastEditorUserId="55" LastEditDate="2021-02-05T17:08:14.967" LastActivityDate="2021-02-05T17:08:14.967" Title="Preparing Bell state $(1/\sqrt{2}) (|01\rangle + |10\rangle)$ in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15825" PostTypeId="2" ParentId="15824" CreationDate="2021-02-03T18:44:54.210" Score="5" Body="&lt;p&gt;The circuit to prepare the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}} $&lt;/span&gt; is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐          &#xA;q_0: ┤ H ├──■───────&#xA;     └───┘┌─┴─┐┌───┐&#xA;q_1: ─────┤ X ├┤ X ├&#xA;          └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This can be written in matrix notation as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} &#xA;U &amp;amp;= (I \otimes X)\cdot CNOT \cdot (H\otimes I) \\&#xA;&amp;amp;= \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix} \otimes \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} \cdot \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1  &amp;amp; 0 &amp;amp; 0 \\  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix} \cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix} \\&#xA;&amp;amp;= \begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; 0  &amp;amp; 0 &amp;amp; 0 \\  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix} \cdot \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1  &amp;amp; 0 &amp;amp; 0 \\  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix} \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 1  &amp;amp; 0 &amp;amp; 1 \\  1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\ 1 &amp;amp; 0  &amp;amp; 1 &amp;amp; 0 \\  1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And &lt;span class=&quot;math-container&quot;&gt;$$ U |00\rangle =\dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\ 1 &amp;amp; 0  &amp;amp; 1 &amp;amp; 0 \\  1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}}  \begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to generate this circuit with qiskit you can do it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.h(qreg_q[0])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.x(qreg_q[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="1859" LastEditDate="2021-02-04T07:29:43.680" LastActivityDate="2021-02-04T07:29:43.680" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15826" PostTypeId="2" ParentId="15726" CreationDate="2021-02-03T20:57:34.210" Score="1" Body="&lt;p&gt;An easy way to see it is to notice that &lt;span class=&quot;math-container&quot;&gt;$ad-bc$&lt;/span&gt; is the determinant of the matrix of coefficients of the state. This matrix is singular, and thus has rank &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, if and only if it has zero determinant.&lt;/p&gt;&#xA;&lt;p&gt;But the rank of this matrix is also equal to the number of nonzero coefficients in the Schmidt decomposition of the state.&lt;/p&gt;&#xA;&lt;p&gt;It follows that the state has the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|u\rangle|v\rangle$&lt;/span&gt; for some states &lt;span class=&quot;math-container&quot;&gt;$|u\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; if and only if &lt;span class=&quot;math-container&quot;&gt;$ad-bc=0$&lt;/span&gt;.&#xA;A pure two-qubit state is separable if and only it is a product state, hence the conclusion.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-03T20:57:34.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15827" PostTypeId="2" ParentId="15786" CreationDate="2021-02-03T21:24:01.900" Score="1" Body="&lt;p&gt;To expand a bit more on the comments, measurement of the second (lower) register after preparing this register to be in &lt;span class=&quot;math-container&quot;&gt;$\vert a^j\bmod N\rangle$&lt;/span&gt; and prior to performing the inverse QFT of the first register is not necessary, but may be a useful fiction we tell ourselves.&lt;/p&gt;&#xA;&lt;p&gt;For example I'll quote whole-cloth from Greg Kuperberg on &lt;a href=&quot;https://www.scottaaronson.com/blog/?p=5151&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shtetl-Optimized&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;You can measure the output qubits.&lt;/li&gt;&#xA;&lt;li&gt;The janitor can fish the output qubits out of the trash and measure them for you.&lt;/li&gt;&#xA;&lt;li&gt;You can secretly not measure the output qubits and say you did.&lt;/li&gt;&#xA;&lt;li&gt;You can keep the output qubits and say you threw them away.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The reason it may be convenient to think of measuring the second (lower) register prior to the inverse QFT of the first (upper) register is that, if you measure the second register and get an output &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, this enables you to picture the first upper register as collapsing to a comb corresponding to the uniform superposition of all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$a^j\bmod N=y$&lt;/span&gt;.  These &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; are just binary numbers, but magically they are spaced evenly at &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; steps apart.  The inverse QFT, plus the other classical tricks with continued fractions, enables you to figure out what this &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is.&lt;/p&gt;&#xA;&lt;p&gt;Notice that if you had measured the second register and had gotten a different &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;, then your comb would have been shifted over, but your spacing would still be &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, if you do &lt;em&gt;not&lt;/em&gt; want to picture measuring the second register to get &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and collapsing the first register to the uniform superposition of all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$y=a^j\bmod N$&lt;/span&gt;, then after the QFT the first register will still be in a state inversely proportional to &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.  The global phase of this state would be dependent on the specific &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; that you would have measured, if you had measured the second register, but you didn't measure the second register.  This global phase can I think be thought of the amount of shifting mentioned above, but importantly this &lt;em&gt;global phase is irrelevant&lt;/em&gt; to the state of the first register.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;ADDED&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Trying to relate an intuition about classical discrete/fast Fourier transforms to quantum Fourier transforms, there is always a risk that there are subtleties that are left behind.  Nonetheless one could consider the wavefunction, after calculating the modular exponentiation in the second register, as something similar to a &lt;span class=&quot;math-container&quot;&gt;$1\times N$&lt;/span&gt; array, such as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[5,8,2,10,13,4,6,9,5,8,2,10,13,4,6,9,5,8,2,10,13,4,6,9,5,8,2,10,13,4,6,9\ldots]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where each index corresponds to the first register, and the value of the index corresponds to the second register.  (I made up these numbers, but note that there is a period of &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;, for example).&lt;/p&gt;&#xA;&lt;p&gt;You may also think of the wavefunction as having &lt;em&gt;another&lt;/em&gt; array parallel to this &lt;span class=&quot;math-container&quot;&gt;$1\times N$&lt;/span&gt; array; this parallel wavefunction corresponds to the amplitude of each basis state.  Thus this parallel array might initially be a normalized version of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1\ldots]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It appears the OP is trying to envision this above probability array as independent of the above array of values.  For example, clearly treated in isolation a Fourier transform of this array will indeed return &lt;span class=&quot;math-container&quot;&gt;$[1,0,0,0,0,0\ldots]$&lt;/span&gt;. But critically this probability amplitude array is &lt;em&gt;tied to&lt;/em&gt; the above array of values of this matrix.&lt;/p&gt;&#xA;&lt;p&gt;For example suppose we now we &lt;em&gt;measure&lt;/em&gt; the second register and get, say, &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; as an output.  This collapses the wavefunction and changes our array of probability amplitudes to a normalized version of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0\ldots]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Certainly when we do the QFT on the above amplitudes, we will recognize the periodicity of &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively if we had measured and gotten output of &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt;, then our array of probability amplitudes would be a normalized version of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0\ldots]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The QFT in either case gives the same periodicity.  The difference between measuring and returning the value of &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; vs. the value of &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; is only reflected in the physically irrelevant global phase of the output register.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-02-06T17:20:24.697" LastActivityDate="2021-02-06T17:20:24.697" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15828" PostTypeId="1" CreationDate="2021-02-03T21:45:54.247" Score="2" ViewCount="59" Body="&lt;p&gt;I tried to obtain the gates after fusion in Qiskit-aer statevector simulator. What I can find now is that it provides a backend option saying fusion_verbose (bool): Output gates generated in fusion optimization into metadata [Default: False]. While I set it, I couldn't figure out a way to get the &amp;quot;metadata&amp;quot;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; simulator = aer.StatevectorSimulator(max_parallel_threads=128,fusion_verbose=True)&#xA; result = execute(circuit,simulator).result()&#xA; statevector = result.get_statevector(circuit)&#xA; config = simulator.configuration()&#xA; print(config.to_dict())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;That information is not in the configuration. I am wondering how I can get those gates.&lt;/p&gt;&#xA;&lt;p&gt;Another related question is that if I set the highest optimization level in the qiskit transpile function, do I get the same circuits as I was running it in the statevector simulator?&lt;/p&gt;&#xA;&lt;p&gt;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="14716" LastEditorUserId="55" LastEditDate="2021-02-05T17:08:27.323" LastActivityDate="2021-03-14T19:09:31.000" Title="Get the gates after fusion optimization in Qiskit statevector simulator" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15829" PostTypeId="1" CreationDate="2021-02-04T02:33:23.463" Score="2" ViewCount="46" Body="&lt;p&gt;I have just finished multiple readings of &lt;em&gt;Applying Grover’s algorithm to AES: quantum resource estimates&lt;/em&gt;, a 2015 paper by Markus Grassl, Brandon Langenberg, Martin Roetteler, and Rainer Steinwandt.  There are many copies of it online; I used this one: &lt;a href=&quot;https://arxiv.org/abs/1512.04965&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1512.04965&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The authors construct quantum gate implementations of AES-128, AES-192 and AES-256. They Do it with Clifford+&lt;em&gt;T&lt;/em&gt; gates &amp;quot;as the underlying fault-tolerant logical quantum gate set.&amp;quot; Table 1 has their gate estimates and qubit estimates for the key expansion.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZrPjB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZrPjB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Table 2 has the quantum resource estimates for the AES-128 implementation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F6MZy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F6MZy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Table 3 has the resources for AES-192:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QwX28.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QwX28.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And Table 4 has the resource estimates for AES-256:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hzAHC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hzAHC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Cracking AES with Grover's algorithm requires a (plaintext, ciphertext) pair --- that is, you perform a &lt;em&gt;known plaintext attack&lt;/em&gt;, which is easier than a ciphertext-only attack. In this case, Grover's algorithm is used find the key that produces the ciphertext from the plaintext (or vice-versa). One of the things that the authors note is that you actually need multiple blocks to perform the attack, since the block size is 128-bits, so for the vast majority of 128-bit blocks there will be multiple AES-192 and AES-256 bit keys that produce the same (plaintext,ciphertext) pair. (I had not realized this before reading the paper, but it is a straightforward application of the pigeonhole principle.)&lt;/p&gt;&#xA;&lt;p&gt;The part of the paper that I do not understand is the time estimates, and this probably goes back to some confusion that I have regarding Grover's algorithm. The challenge in cracking AES with Grover is not the complexity of the circuit (which results primarily from unwinding the multiple rounds), but from the number of &amp;quot;Grover iterations&amp;quot; that are required.&lt;/p&gt;&#xA;&lt;p&gt;The key paragraph is at the bottom of p. 10 and the top of p. 11:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PGej7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PGej7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/1freT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1freT.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;What I'm confused about is how we actually implement a 'Grover iteration' on a suitably large quantum computer. If we were to use a scaled up version of the superconducting quantum computers with artificial atoms, then the qubits are the wires and the gates are radio pulses that are fed into the circuit, right? So does each &amp;quot;iteration&amp;quot; mean that we play the gates from beginning to end &lt;span class=&quot;math-container&quot;&gt;$1.19 \times 2^{86}$&lt;/span&gt; times?&lt;/p&gt;&#xA;&lt;p&gt;If we do need to play the gates &lt;span class=&quot;math-container&quot;&gt;$1.19 \times 2^{86}$&lt;/span&gt; times, do we store the results of each of those iterations in a classical computer that's controlling the quantum computer, and then take the result that was selected the most number of times, or do the results accumulate in the quantum circuit itself? If we accumulate the results, then don't we also need to have room to store &lt;span class=&quot;math-container&quot;&gt;$2^{128}$&lt;/span&gt; 128-bit solutions to see which one comes up the most times?&lt;/p&gt;&#xA;&lt;p&gt;Here is Table 5, which computes the time resources required for attacking AES with Grover's algorithm:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j7IKo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j7IKo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The paper concludes &amp;quot;it seems prudent to move away from 128-bit keys when expecting the availability of at least a moderate size quantum computer.&amp;quot; Presumably this is because we can perform &lt;span class=&quot;math-container&quot;&gt;$2^{86}$&lt;/span&gt; iterations (even with today's technology!!!) but we won't be able to perform &lt;span class=&quot;math-container&quot;&gt;$2^{151}$&lt;/span&gt; iterations of anything, ever. In fact, we won't ever be able to perform &lt;span class=&quot;math-container&quot;&gt;$2^{128}$&lt;/span&gt; iterations of anything, ever.&lt;/p&gt;&#xA;&lt;p&gt;But what exactly are we iterating?&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2021-02-04T15:50:03.807" Title="Where does the time complexity come from when applying Grover's algorithm to AES?" Tags="&lt;grovers-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15830" PostTypeId="1" CreationDate="2021-02-04T04:00:48.647" Score="2" ViewCount="142" Body="&lt;p&gt;Section 2.3 of the Qiskit textbook shows us that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT|0+\rangle \ = \ \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which I was able to translate to a circuit as such:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2)&#xA;qc.h(1)&#xA;qc.cx(1,0)&#xA;qc.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KpcHs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KpcHs.png&quot; alt=&quot;Resulting circuit&quot; /&gt;&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to see how to come to the same result by hand, but no order of operations is saving me here. In other words, could someone step through the process? To the best of my understanding, the convention is to tensor product upwards and multiply right to left, e.g.:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ [CNOT (H ⊗ I)] |0+\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Could someone step through the math as a guided example?&lt;/p&gt;&#xA;" OwnerUserId="14432" LastEditorUserId="55" LastEditDate="2021-02-07T14:28:34.623" LastActivityDate="2021-02-07T14:28:34.623" Title="Qiskit order of multiplication and tensor product" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;mathematics&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15832" PostTypeId="1" AcceptedAnswerId="15834" CreationDate="2021-02-04T04:56:02.623" Score="1" ViewCount="124" Body="&lt;p&gt;How can I arrange the following states in decreasing order based on their entanglement?&lt;/p&gt;&#xA;&lt;p&gt;i) &lt;span class=&quot;math-container&quot;&gt;$\rho_1 = \frac{1}{2}|0\rangle \langle0|\otimes  |+\rangle \langle+| +\frac{1}{2}|+\rangle \langle+|\otimes |1\rangle \langle1|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;ii) &lt;span class=&quot;math-container&quot;&gt;$\rho_2 = |\psi\rangle \langle\psi|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\sqrt{0.99}|00\rangle+0.1|11\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerDisplayName="user14639" LastEditorUserId="55" LastEditDate="2021-02-05T17:17:26.857" LastActivityDate="2021-02-05T17:17:26.857" Title="How do I arrange these two-qubit states based on their entanglement?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15833" PostTypeId="2" ParentId="15830" CreationDate="2021-02-04T05:56:30.170" Score="4" Body="&lt;p&gt;Note that usually, the state &lt;span class=&quot;math-container&quot;&gt;$|0+\rangle$&lt;/span&gt; can denote apply the operator &lt;span class=&quot;math-container&quot;&gt;$(I \otimes H)$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. Hence, it would be the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{8cm}$&lt;/span&gt; Figure 1:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{6.5 cm}$&lt;/span&gt; &lt;a href=&quot;https://i.stack.imgur.com/6vgK0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6vgK0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and also in a standard textbook, this can be written as &lt;span class=&quot;math-container&quot;&gt;$I \otimes H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But because qiskit uses &lt;strong&gt;little-endian&lt;/strong&gt; convention, the state &lt;span class=&quot;math-container&quot;&gt;$|0+\rangle$&lt;/span&gt; actually actually means the first qubit is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and the second qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. That is, it is in reverse order. Thus, the circuit representation for this state is actually:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{8cm}$&lt;/span&gt;Figure 2:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{7 cm}$&lt;/span&gt;&lt;a href=&quot;https://i.stack.imgur.com/RE2KU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RE2KU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In term of tensor notation, this (gate operation in Figure 2) can be written as &lt;span class=&quot;math-container&quot;&gt;$(I \otimes H) |00\rangle$&lt;/span&gt;. That is, we read from bottom up instead of top to bottom like what we would have done in standard setting. That is because we reversed the qubit ordering so  by doing this we make sure that the gate operation written in tensor notation stay the same as what we would have in standard textbook setting.&lt;/p&gt;&#xA;&lt;p&gt;And now applying CNOT gate to this circuit we get:&lt;/p&gt;&#xA;&lt;br&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{8cm}$&lt;/span&gt;Figure 3:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hspace{6cm}$&lt;/span&gt; &lt;a href=&quot;https://i.stack.imgur.com/VREkz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VREkz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In term of the math, first note that usually the matrix representation for CNOT is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$CNOT = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1  &amp;amp; 0 &amp;amp; 0 \\  0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but with little-endian, its matrix representation is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT_{little \ endian} = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0  &amp;amp; 0 &amp;amp; 1 \\  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so overall, we applying the operation &lt;span class=&quot;math-container&quot;&gt;$U = CNOT_{little \ endian} \cdot (I \otimes H)$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. So if we use matrix notation to work this out, we will have the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CNOT_{little \ endian} \cdot (I \otimes H) = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0  &amp;amp; 0 &amp;amp; 1 \\  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix} \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 1 &amp;amp; -1  &amp;amp; 0 &amp;amp; 0 \\  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1\end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0  &amp;amp; 1 &amp;amp; -1 \\  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\ 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and now the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} $&lt;/span&gt; so therefore &lt;span class=&quot;math-container&quot;&gt;$CNOT_{little \ endian} \cdot (I \otimes H) |00\rangle$&lt;/span&gt; can be worked out as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\big( CNOT_{little \ endian} \cdot (I \otimes H) \big) |00\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0  &amp;amp; 1 &amp;amp; -1 \\  0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\ 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\end{pmatrix}  \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} =  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-04T06:13:44.730" LastActivityDate="2021-02-04T06:13:44.730" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15834" PostTypeId="2" ParentId="15832" CreationDate="2021-02-04T06:03:58.800" Score="1" Body="&lt;p&gt;In decreasing order: &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;, because no state is less entangled than a &lt;a href=&quot;https://en.wikipedia.org/wiki/Separable_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;separable state&lt;/a&gt; like &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;. We know that &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; is separable, because it is a convex combination of product states.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt; is entangled because its &lt;a href=&quot;https://en.wikipedia.org/wiki/Schmidt_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schmidt rank&lt;/a&gt; is &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. Moreover, its density matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_2 = \begin{pmatrix}&#xA;0.99 &amp;amp; &amp;amp; &amp;amp; 0.1\sqrt{0.99} \\&#xA;&amp;amp; &amp;amp; &amp;amp; \\&#xA;&amp;amp; &amp;amp; &amp;amp; \\&#xA;0.1\sqrt{0.99} &amp;amp; &amp;amp; &amp;amp; 0.01&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;fails &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Peres-Horodecki criterion&lt;/a&gt;, because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;0.99 &amp;amp; &amp;amp; &amp;amp;  \\&#xA;&amp;amp; &amp;amp; 0.1\sqrt{0.99} &amp;amp; \\&#xA;&amp;amp; 0.1\sqrt{0.99}&amp;amp; &amp;amp; \\&#xA;&amp;amp; &amp;amp; &amp;amp; 0.01&#xA;\end{pmatrix} \begin{pmatrix}0 \\ 1 \\ -1 \\ 0 \end{pmatrix} = &#xA;-0.1\sqrt{0.99}\begin{pmatrix}0 \\ 1 \\ -1 \\ 0 \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-04T06:03:58.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15835" PostTypeId="2" ParentId="15824" CreationDate="2021-02-04T07:39:24.800" Score="2" Body="&lt;p&gt;To provide general answer, Bell states are prepared with circuit described by matrix &lt;span class=&quot;math-container&quot;&gt;$CNOT(H \otimes I)$&lt;/span&gt;. Which Bell state is returned depends on input to the circuit:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; returns &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; returns &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; returns &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;input &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; returns &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Clearly, value of the second input qubit specifies whether both output qubits will be same (the second input qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) or opposite (the second input qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;). The first qubit specifies a phase - when the qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the phase is 0, when it is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the phase is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$\mathrm{e^{i\pi}}=-1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Concerning the input, to obtain for example &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, put &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on second qubit and then apply the circuit for Bell state. Similarly for other inputs.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-04T07:39:24.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15836" PostTypeId="1" AcceptedAnswerId="15845" CreationDate="2021-02-04T10:48:09.883" Score="7" ViewCount="80" Body="&lt;p&gt;I'm exploring quantum computers for a semester project. I'm mainly interested in making faster matrix calculations than a regular computer.&lt;/p&gt;&#xA;&lt;p&gt;I was wondering what arithmetic operations (irrespective of how simple or complex they are) are faster on a quantum computer? Also, by what factor does the time complexity improve?&lt;/p&gt;&#xA;&lt;p&gt;Note - I'm a newbie to quantum computers. So, apologies if this question is too vague than the usual questions here.&lt;/p&gt;&#xA;" OwnerUserId="14726" LastEditorUserId="4501" LastEditDate="2021-02-06T20:49:22.263" LastActivityDate="2021-02-06T20:49:22.263" Title="what matrix operations have better known time complexity on a quantum computer?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;classical-computing&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15838" PostTypeId="2" ParentId="15766" CreationDate="2021-02-04T15:27:19.047" Score="2" Body="&lt;p&gt;DaftWullie's answer makes a lot of sense, and just wanted to add a little bit.&lt;/p&gt;&#xA;&lt;p&gt;First a bit of context: We start by defining &lt;span class=&quot;math-container&quot;&gt;$U|00...0\rangle = |\psi\rangle$&lt;/span&gt;. In the Grover operator you have two reflections - the first reflection is around &lt;span class=&quot;math-container&quot;&gt;$|\alpha\rangle$&lt;/span&gt; followed by the second reflection (as already stated by DaftWullie) around &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (and not &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;However it is usually not possible to directly reflect across &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. On the other hand in most cases we have access to the operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (and &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}$&lt;/span&gt;). So what is usually done is to rotate to a reference frame where we make the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \rightarrow |00...0\rangle$&lt;/span&gt; and to do that we can apply &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}$&lt;/span&gt; to the current state. Then you can reflect across &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt; and revert the reference frame back i.e. &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle \rightarrow |\psi\rangle$&lt;/span&gt; by applying the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; operator.&lt;/p&gt;&#xA;&lt;p&gt;So rotating around &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt; is actually an artifact of not being able to rotate directly around &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;... but it's usually the best we have!&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-04T15:27:19.047" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15839" PostTypeId="1" CreationDate="2021-02-04T15:47:24.597" Score="2" ViewCount="80" Body="&lt;p&gt;I am trying to build the Grover circuit using the Qiskit circuit composer. The Grover example has a cz gate. I can't find that gate in circuit composer.&lt;/p&gt;&#xA;&lt;p&gt;I am new at this.&lt;/p&gt;&#xA;" OwnerUserId="14732" LastActivityDate="2021-02-04T15:59:17.847" Title="Where is CZ gate in Qiskit circuit composer" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15840" PostTypeId="2" ParentId="15829" CreationDate="2021-02-04T15:50:03.807" Score="1" Body="&lt;p&gt;You accumulate the results quantumly and only measure at the end.&lt;/p&gt;&#xA;&lt;p&gt;Remember, Grover’s algorithm is not progress-free. Every iteration gets you quadratically closer to the key.  Further you run the risk of overshooting by doing too many iterations.&lt;/p&gt;&#xA;&lt;p&gt;You iterate the evaluation of the circuit with the controlled rotation and the inversion about the mean.  A quantum computer would apply iterations consisting of the gates used in the evaluation of the entire AES function, followed by the conditional rotation and the inversion about the mean.&lt;/p&gt;&#xA;&lt;p&gt;Critically, you have to maintain coherence throughout.&lt;/p&gt;&#xA;&lt;p&gt;The speed of this evaluation is dependent on how fast each gate - each laser pulse/microwave pulse/etc. - can be applied, which is technology dependent.  I believe this is reasonably at milliseconds or maybe microseconds.  See also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8441/does-a-quantum-computer-have-a-clock-signal-and-if-yes-how-big-is-it&quot;&gt;this question&lt;/a&gt; about clock speed.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-02-04T15:50:03.807" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15841" PostTypeId="2" ParentId="15839" CreationDate="2021-02-04T15:59:17.847" Score="3" Body="&lt;p&gt;There is no Controlled-Z in the circuit composer by default because this gate can be built from CNOT (&lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;) and Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. This is because we have the identity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Z = HXH$$&lt;/span&gt;&#xA;This implies that &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; can be constructed as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UJCbY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UJCbY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, in the qiskit composer, there is a button &lt;em&gt;+ Add&lt;/em&gt; that allows you to add this gate operation as a pre-defined gate and you can named it as CZ gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wExtB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wExtB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-04T15:59:17.847" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15842" PostTypeId="1" AcceptedAnswerId="15847" CreationDate="2021-02-04T18:08:33.893" Score="1" ViewCount="37" Body="&lt;p&gt;I'm hoping to obtain a larger picture of the calibration figure. The original command is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;meas_fitter.plot_calibration()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I tried to use&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;meas_fitter.plot_calibration(figsize=(10,10))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but that doesn't work. How can I make it bigger? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-02-04T22:53:52.103" Title="How can I adjust calibration figure size?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15843" PostTypeId="2" ParentId="15807" CreationDate="2021-02-04T18:12:33.733" Score="2" Body="&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; Really good question! We know how to do it in exponential time (details below) but there is a lot of ongoing research on how to do it in polynomial time.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Longer answer:&lt;/strong&gt; If you want to use gates, you can always encode it in exponentially many time steps using a combination of controlled &lt;span class=&quot;math-container&quot;&gt;$R_x, R_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gates. As an example, try creating the state &lt;span class=&quot;math-container&quot;&gt;$$\sqrt{\frac{1}{8}}|00\rangle + \sqrt{\frac{1}{8}}|01\rangle + \sqrt{\frac{5}{8}}|10\rangle + \sqrt{\frac{1}{8}}|11\rangle$$&lt;/span&gt; using only &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; and controlled-&lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; gates. However for a general case with more quibts this can quickly turn into a very long circuit! There are some ways to load the right state in polynomial time given certain assumptions about the state. But this is an ongoing research question that many of us are working on! For a few ideas out there you can see e.g. the following references:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0208112&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0208112&lt;/a&gt; (whole paper)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2005.04351&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2005.04351&lt;/a&gt; (whole paper)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/2012.03819&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2012.03819&lt;/a&gt; (section IV.B)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-04T18:12:33.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15844" PostTypeId="2" ParentId="15815" CreationDate="2021-02-04T18:28:29.313" Score="2" Body="&lt;p&gt;I suppose electrical engineering plays two roles in quantum computing.  The first role is that generally all quantum hardware needs a stack of various classical components for the control and readout of qubits, like any physics experiment.  But I imagine you are more interested in something like superconducting qubits, where electrical circuits themselves form the qubits in use.  If this is the case, as far as textbooks go, I can suggest &amp;quot;Quantum Engineering: Theory and Design of Quantum Coherent Structures&amp;quot; by A.M. Zagoskin, which provides ample details on Josephson junctions, circuit quantum electrodynamics (cQED), and quantum noise, though it's a bit of a deep dive if you are new to this stuff.  There are a lot of review papers on these topics as well, that are arguably a better way to learn the subject.&lt;/p&gt;&#xA;&lt;p&gt;As @KAJ226 commented, &amp;quot;&lt;a href=&quot;http://arxiv.org/abs/1904.06560.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Engineer's Guide to Superconducting Qubits&lt;/a&gt;&amp;quot; is a great place to start, and it covers a bit of everything in good detail.&lt;/p&gt;&#xA;&lt;p&gt;The same group from MIT has a couple other very nice review articles, such as &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1905.13641.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Superconducting Qubits: Current State of Play&lt;/a&gt;&amp;quot;, which focuses on recent research and results in the field (various gates, qubit designs, algorithm demonstration, etc.) and &amp;quot;&lt;a href=&quot;https://arxiv.org/pdf/1906.11146.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;3D integration and packaging for solid-state qubits&lt;/a&gt;&amp;quot; which goes into everything that sits between the qubits and the data traces on our computers.&lt;/p&gt;&#xA;&lt;p&gt;If you want to know more about quantizing circuits and how to actually get qubits out of inductors, Josephson junctions, capacitors, etc., then check out &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1610.03438.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction to Quantum Electromagnetic Circuits&lt;/a&gt;&amp;quot;, which is one of the original reviews on cQED.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-02-04T18:28:29.313" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15845" PostTypeId="2" ParentId="15836" CreationDate="2021-02-04T21:10:37.980" Score="4" Body="&lt;p&gt;&lt;strong&gt;ANSWER MADE CW&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Arguably the one thing that a quantum computer can do quickly, as long as the matrix is defined in the appropriate manner, is the quantum Fourier transform (QFT).  Much as the classical fast Fourier transform (FFT) is the workhouse of many classical matrix algorithms, the QFT is the basis for many such quantum matrix algorithms.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;For example, a standard answer about quantum algorithms for matrices is the quantum algorithm for linear systems - the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_algorithm_for_linear_systems_of_equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;HHL algorithm&lt;/a&gt; of Harrow, Hassidm, and Lloyd.  This algorithm allows one to &lt;em&gt;invert&lt;/em&gt; a matrix.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another interesting matrix algorithm is that of &lt;a href=&quot;https://www.researchgate.net/publication/220295493_A_Simple_PromiseBQP-complete_Matrix_Problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Janzing and Wocjan&lt;/a&gt; on determining the elements of a power of a matrix.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;One algorithm that I haven't studied in detail but nonetheless seems interesting is Wang's &lt;a href=&quot;https://arxiv.org/abs/1311.1851&quot; rel=&quot;nofollow noreferrer&quot;&gt;method&lt;/a&gt; of determining the effective resistance between two nodes in a graph - if the network were considered to be an adjacency matrix of resistors.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Without knowing more about the OP's background, at least hearing of the importance of the QFT and its embodiment for quantum phase estimation (QPE) is critical to understand how quantum computers can be useful for matrix algorithms.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-02-05T00:12:48.920" LastActivityDate="2021-02-05T00:12:48.920" CommentCount="0" CommunityOwnedDate="2021-02-05T00:12:48.920" ContentLicense="CC BY-SA 4.0" />
  <row Id="15846" PostTypeId="2" ParentId="15830" CreationDate="2021-02-04T22:08:53.670" Score="1" Body="&lt;p&gt;KAJ226 gave a very thorough answer! I thought it might be useful to give a summarized version here:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;|0+\rangle &amp;amp;= (I \otimes H) |00\rangle \\&#xA;&amp;amp;= I|0\rangle\otimes H|0\rangle \\&#xA;&amp;amp; =|0\rangle \otimes \frac{1}{\sqrt2}\left(|0\rangle+|1\rangle\right) \\&#xA;&amp;amp;= \frac{1}{\sqrt2}\left(|00\rangle+|01\rangle\right) \\&#xA;CNOT|0+\rangle &amp;amp;= CNOT\left[\frac{1}{\sqrt2}\left(|00\rangle+|01\rangle\right)\right] \\&#xA;&amp;amp;=\frac{1}{\sqrt2}\left(CNOT|00\rangle+CNOT|01\rangle\right) \\&#xA;&amp;amp;=\frac{1}{\sqrt2}\left(|00\rangle+|11\rangle\rangle\right)&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;Here I am inferring that the convention is that a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate acting on 2 qubits is using the 2nd qubit as the control qubit and the 1st qubit as the target qubit.&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-04T22:08:53.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15847" PostTypeId="2" ParentId="15842" CreationDate="2021-02-04T22:53:52.103" Score="2" Body="&lt;p&gt;It seems you tried to recreate the plot of the calibration matrix &lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/3_measurement_error_mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;from this tutorial&lt;/a&gt;. Which output a plot like something like below when you execute &lt;code&gt;meas_fitter.plot_calibration()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/OcSwk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/OcSwk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But you want the image above to be larger. If that is the case, then you can change the image size as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;fig, ax = plt.subplots(figsize=(10, 10))&#xA;meas_fitter.plot_calibration(ax)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-04T22:53:52.103" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15849" PostTypeId="1" CreationDate="2021-02-05T00:55:15.780" Score="0" ViewCount="16" Body="&lt;p&gt;This &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0311008.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; shows a way to produce optimal circuits. I haver verified most of them and they are correct except this procedure:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;procedure ProduceArray(n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I cannot even produce a correct result by using the returned value of ProduceArray(3). Could you please review that procedure to verify if it is correct? It is just 3 qubits. The decomposed matrices cannot compute the original matrix.&lt;/p&gt;&#xA;" OwnerUserId="9768" LastActivityDate="2021-02-05T00:55:15.780" Title="Compiling Quantum Circuits using the Palindrome Transform" Tags="&lt;gate-synthesis&gt;&lt;matrix-representation&gt;&lt;unitarity&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15850" PostTypeId="1" AcceptedAnswerId="15854" CreationDate="2021-02-05T01:26:03.657" Score="5" ViewCount="97" Body="&lt;p&gt;I understood quantum interference as a heart of quantum computing, because it enables two possibilities to cancel each other. Quantum algorithms utilize this property to reduce the probability of returning wrong answers and thus give higher chance to returning correct answers compared to classical algorithms. And quantum interference is possible because wave function can have complex value, not just non-negative value like classical probability.&lt;/p&gt;&#xA;&lt;p&gt;But according to many articles about quantum mechanics, wave function is not actual existence - and wave function itself does not have any physical meaning. Only its absolute value squared has a meaning of possibility to be in a specific quantum state. But still, quantum interference happen in real quantum world and quantum computers use this phenomenon to be effective.&lt;/p&gt;&#xA;&lt;p&gt;How is this possible?&lt;/p&gt;&#xA;" OwnerUserId="14737" LastEditorUserId="10480" LastEditDate="2021-02-05T16:21:06.283" LastActivityDate="2021-02-07T14:39:17.260" Title="How can quantum interference happen in real world if a wave function does not have any physical meaning?" Tags="&lt;algorithm&gt;&lt;interpretations&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15851" PostTypeId="1" AcceptedAnswerId="15852" CreationDate="2021-02-05T05:44:08.450" Score="2" ViewCount="156" Body="&lt;p&gt;I'm coding using the Jupyter Notebook in the IBM Quantum Lab. However, I don't know why I see the following repeated message every time when I execute a quantum circuit: &lt;a href=&quot;https://i.stack.imgur.com/uCloG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uCloG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This message shows thousands of times and occupied a significant amount of memory. However, it shows that the job I submitted could be successfully executed, but I'm not able to access the result.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3pV2x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3pV2x.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know what happened? What can I do to fix this issue? Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="1859" LastEditDate="2021-02-05T11:26:03.987" LastActivityDate="2021-02-05T11:26:03.987" Title="Numpy DeprecationWarning flooding in IBM Quantum Lab" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15852" PostTypeId="2" ParentId="15851" CreationDate="2021-02-05T06:31:31.680" Score="3" Body="&lt;p&gt;NumPy 1.20 is deprecating part of their API. You have three options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Wait for the next Qiskit release (0.24). It should be around the corner (the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/5758&quot; rel=&quot;nofollow noreferrer&quot;&gt;PR fixing this&lt;/a&gt; was merged already).&lt;/li&gt;&#xA;&lt;li&gt;Downgrade NumPy running &lt;code&gt;!pip install numpy==0.19&lt;/code&gt; in the notebook and restart it.&lt;/li&gt;&#xA;&lt;li&gt;Ignore warnings:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;pre&gt;&lt;code&gt;import warnings&#xA;warnings.filterwarnings('ignore')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-05T08:41:47.180" LastActivityDate="2021-02-05T08:41:47.180" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15853" PostTypeId="1" AcceptedAnswerId="15857" CreationDate="2021-02-05T06:44:21.400" Score="1" ViewCount="29" Body="&lt;p&gt;Suppose I have the following calibration matrix generated using 4 qubits:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.ignis.mitigation.measurement import (complete_meas_cal, CompleteMeasFitter)&#xA;cal_circuits, state_labels = complete_meas_cal(qr = qc.qregs[0],circlabel = 'measerrormitigationcal')&#xA;cal_job = execute(cal_circuits, &#xA;                 backend = device,&#xA;                 shots = 1024,&#xA;                  optimization_level = 0&#xA;                 )&#xA;print(cal_job.job_id())&#xA;job_monitor(cal_job)&#xA;cal_results = cal_job.result()&#xA;meas_fitter = CompleteMeasFitter(cal_results, state_labels)&#xA;import matplotlib.pyplot as plt&#xA;fig, ax = plt.subplots(figsize=(10, 10))&#xA;meas_fitter.plot_calibration(ax)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ol2Bd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ol2Bd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Is there a way I can use this filter to reduce another quantum circuit with 3 qubits? (i.e. A subset with 8 elements)&lt;/strong&gt;&lt;/em&gt; (I was wondering if I could add a &lt;code&gt;'0'&lt;/code&gt; after the keys but it seems like this won't work since the additional qubit might 'flip'. )&lt;/p&gt;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-02-05T09:02:27.947" Title="Can I only use a 'subset' of calibration matrix to reduce measurement errors?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15854" PostTypeId="2" ParentId="15850" CreationDate="2021-02-05T07:03:35.067" Score="5" Body="&lt;p&gt;The assertion that the wavefunction has no physical meaning might mean different things in different contexts.&lt;/p&gt;&#xA;&lt;p&gt;In one interpretation the assertion simply means that the wavefunction is unobservable. This is a scientific fact that can be proven for example by showing that the ability to observe it would allow faster-than-light communication (e.g. using arguments similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6038/quantum-circuit-for-computing-fidelity/15393#15393&quot;&gt;those&lt;/a&gt; that rule out single-shot fidelity measurements). The impossibility to observe the wavefunction together with its central role in quantum mechanics raises some tricky questions.&lt;/p&gt;&#xA;&lt;p&gt;So in another view, the assertion means that the wavefunction admits interpretations as an incomplete description of a more fundamental reality or as a description of an observer's imperfect knowledge of reality. Note that quantum mechanics &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0101012&quot; rel=&quot;noreferrer&quot;&gt;can be thought of&lt;/a&gt; as an extension of the theory of probability. In this view, the wavefunction corresponds to probability distribution. Do probability distributions have &amp;quot;actual existence&amp;quot;? In one interpretation, a probability distribution does not describe a state of a system, but an observer's imperfect knowledge of it. In another, it does describe a state, albeit incompletely. Finally, a probability distribution might be &amp;quot;all there is&amp;quot; if a system is inherently non-deterministic. These views on the nature of a probability distribution find counterparts in various interpretations of the wavefunction. In the hidden variables research program the respective types of models are sometimes &lt;a href=&quot;https://arxiv.org/abs/0706.2661&quot; rel=&quot;noreferrer&quot;&gt;called&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;-epistemic, &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;-ontic and &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;-complete.&lt;/p&gt;&#xA;&lt;p&gt;Finally, someone making the assertion might be recognizing that physical theories are abstract systems of concepts and rules that aim to reproduce results of observations. Some of the concepts correspond to observations. Others, such as the wavefunction, make no direct contact with empirical reality but are included to make the theory work. In a sense, they represent intermediate steps in calculations. In this view, ascribing &amp;quot;actual existence&amp;quot; to them is moot. Consider for example two quantum engineers: Alice who is a &amp;quot;wavefunction skeptic&amp;quot; and Bob who is a &amp;quot;wavefunction believer&amp;quot;. Faced with a task of predicting the output distribution of a quantum circuit they will both compute the wavefunction &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as an intermediate step before applying the Born rule. They might tell themselves different stories about the quantity they computed. Alice might attach little meaning to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, treating it as an intermediate step in her calculations. Bob on the other hand might regard &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; as something real even if unobservable. The key point is that regardless of the adopted narrative each computes the same outcome distribution.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Regardless of the ontological status we assign to the wavefunction, it is clear that to make the theory agree with observations the rules we use to compute it must account for the possibility of interference of different amplitudes. In other words, whatever the wavefunction is - something real, an incomplete picture of some other more fundamental reality or a reflection of our imperfect knowledge - it interferes.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-05T07:53:34.083" LastActivityDate="2021-02-05T07:53:34.083" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15855" PostTypeId="1" AcceptedAnswerId="15856" CreationDate="2021-02-05T07:45:38.013" Score="0" ViewCount="62" Body="&lt;pre&gt;&lt;code&gt;execute(circuit, backend = simulator).result()&#xA;plot_histogram(result.get_counts(circuit))&#xA;&#xA;Error: module 'qiskit.result' has no attribute 'get_counts'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14741" LastEditorUserId="1859" LastEditDate="2021-02-05T09:49:07.930" LastActivityDate="2021-02-05T09:49:07.930" Title="How to fix an error: 'module 'qiskit.result' has no attribute 'get_counts''" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-02-06T18:23:28.737" ContentLicense="CC BY-SA 4.0" />
  <row Id="15856" PostTypeId="2" ParentId="15855" CreationDate="2021-02-05T07:55:56.453" Score="1" Body="&lt;p&gt;You did not assign the variable &lt;code&gt;result&lt;/code&gt;. Try the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result = execute(circuit, backend = simulator).result() &#xA;plot_histogram(result.get_counts(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-05T07:55:56.453" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15857" PostTypeId="2" ParentId="15853" CreationDate="2021-02-05T09:02:27.947" Score="1" Body="&lt;p&gt;Yes, I think this can be done through redefine a new meas_fitter that is a subset of the original one.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;fig, ax = plt.subplots(figsize=(10, 10))&#xA;subset_meas_fitter = meas_fitter.subset_fitter([0,1,2]) #defining new meas_fitter for a set of qubits&#xA;subset_meas_fitter.plot_calibration(ax)&#xA;subset_meas_fitter.plot_calibration(ax)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which should give you something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Hiz0J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Hiz0J.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-05T09:02:27.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15858" PostTypeId="1" CreationDate="2021-02-05T10:00:19.133" Score="4" ViewCount="58" Body="&lt;p&gt;Consider page 2 of Toth's paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0501020&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;'Entanglement detection in the stabilizer formalism (2005)'&lt;/em&gt;&lt;/a&gt;. To detect entanglement close to &lt;em&gt;GHZ&lt;/em&gt; states, they construct entanglement witnesses of the form &lt;span class=&quot;math-container&quot;&gt;$$\mathcal{W} := c_0 I - \tilde{S}_{k}^{(GHZ_N)} - \tilde{S}_{l}^{(GHZ_N)},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\tilde{S}_{k/l}^{(GHZ_N)}$&lt;/span&gt; are elements of the stabilizer group and &lt;span class=&quot;math-container&quot;&gt;$$c_0 := \text{max}_{\rho \in \mathcal{P}}\big( \big\langle \tilde{S}_{k}^{(GHZ_N)} + \tilde{S}_{l}^{(GHZ_N)} \big\rangle_{\rho} \big),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{P}$&lt;/span&gt; denotes the set of product states.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Definition:&lt;/strong&gt; Two correlation operators of the form &lt;span class=&quot;math-container&quot;&gt;$$K = K^{(1)} \otimes K^{(2)} \otimes \cdot \cdot \cdot \otimes K^{(N)}~~~~~~\text{and}~~~~~~L = L^{(1)} \otimes L^{(2)} \otimes \cdot \cdot \cdot \otimes L^{(N)}$$&lt;/span&gt; &lt;em&gt;commute locally&lt;/em&gt; if for every &lt;span class=&quot;math-container&quot;&gt;$n \in \{1,...,N\}$&lt;/span&gt; it follows &lt;span class=&quot;math-container&quot;&gt;$K^{(n)}L^{(n)} = L^{(n)}K^{(n)}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt;&#xA;In the paper, an observation which follows states:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Hence it follows that if &lt;span class=&quot;math-container&quot;&gt;$\tilde{S}_{k}^{(GHZ_N)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\tilde{S}_{l}^{(GHZ_N)}$&lt;/span&gt; commute locally then the maximum of &lt;span class=&quot;math-container&quot;&gt;$\big\langle \tilde{S}_{k}^{(GHZ_N)} + \tilde{S}_{l}^{(GHZ_N)} \big\rangle$&lt;/span&gt; for separable and entangled states coincide.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Is it clear why this statement holds true?&#xA;Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastActivityDate="2021-02-07T11:33:44.577" Title="Entanglement Witnesses close to GHZ states" Tags="&lt;entanglement&gt;&lt;stabilizer-state&gt;&lt;graph-states&gt;&lt;entanglement-witness&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15859" PostTypeId="1" CreationDate="2021-02-05T12:02:53.193" Score="2" ViewCount="69" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kJiCq.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kJiCq.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have solved this question by this, but can't able to get my mistake in it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YiuxQ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YiuxQ.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Jj2G0.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Jj2G0.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14744" LastActivityDate="2021-02-05T12:18:55.580" Title="proof that the gate U is equivalent to the given circuit mathematically" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;linear-algebra&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15860" PostTypeId="2" ParentId="15859" CreationDate="2021-02-05T12:18:55.580" Score="2" Body="&lt;p&gt;To start with, you only know that &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta A/2}=\cos\frac{\theta}{2} I+i\sin\frac{\theta}{2} A$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt;. Since your &lt;span class=&quot;math-container&quot;&gt;$A^2\neq I$&lt;/span&gt;, that doesn't work. (It does, however, work on the central &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block.) So, in your final matrix, you should end up with the top-left and bottom-right matrix elements being 1.&lt;/p&gt;&#xA;&lt;p&gt;Of course, that does not sort everything out. I don't see another problem jumping out at me....&lt;/p&gt;&#xA;&lt;p&gt;In fact, I'm pretty confident that what you've been asked to prove is not correct. I've convinced myself of this by working backwards -- supplying &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to the output of both. &lt;span class=&quot;math-container&quot;&gt;$U^\dagger(\theta)|00\rangle=|00\rangle$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$XY-YX$&lt;/span&gt;. For the circuit, however, cNOT takes &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, and then the single-qubit unitaries convert it to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle(R_Y(-\theta)|0\rangle)$&lt;/span&gt;, which is certainly not &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-05T12:18:55.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15861" PostTypeId="1" AcceptedAnswerId="15862" CreationDate="2021-02-05T12:58:20.513" Score="0" ViewCount="97" Body="&lt;p&gt;I am trying to run the Quantum Teleportation Algorithm using Qiskit on Jupyter Notebook.&#xA;Here is my code below where I am finding an error -&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.measure(2,2)&#xA;simulator = Aer.get_backend('qasm-simulator')&#xA;result = execute(circuit, backend = simulator, shots = 1024).result()&#xA;counts = result.get_counts()&#xA;from qiskit.tools.visualization import plot_histogram&#xA;plot_histogram(counts)&#xA;&#xA;Error: QiskitBackendNotFoundError: 'No backend matches the criteria'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14741" LastEditorUserId="12396" LastEditDate="2021-02-05T13:31:23.177" LastActivityDate="2021-02-05T22:29:01.763" Title="How to fix an error : &quot; QiskitBackendNotFoundError: 'No backend matches the criteria' &quot;" Tags="&lt;qiskit&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15862" PostTypeId="2" ParentId="15861" CreationDate="2021-02-05T13:20:02.000" Score="1" Body="&lt;p&gt;It is qasm_simulator with an underscore.&lt;/p&gt;&#xA;" OwnerUserId="332" LastActivityDate="2021-02-05T13:20:02.000" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15863" PostTypeId="1" AcceptedAnswerId="15865" CreationDate="2021-02-05T13:37:54.933" Score="0" ViewCount="35" Body="&lt;p&gt;Below is the cost Hamiltonian for an unweighted max-cut problem, I don't understand what the point of the half coefficient is. Why couldn't we omit it?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$C_\alpha = \frac{1}{2}\left(1-\sigma_{z}^j\sigma_{z}^k\right),$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13449" LastActivityDate="2021-02-05T14:36:40.477" Title="What's the point of the half coefficient in the max-cut cost Hamiltonian" Tags="&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15864" PostTypeId="2" ParentId="15818" CreationDate="2021-02-05T13:45:56.333" Score="2" Body="&lt;p&gt;In most cases you would have to apply the circuit &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; times, where for an error tolerance on the solution of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; we have to choose &lt;span class=&quot;math-container&quot;&gt;$n=\mathcal{O}(\log_21/\epsilon)$&lt;/span&gt;. This is why most HHL algorithms based on QPE scale as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1/\epsilon)=\mathcal{O}(2^n)$&lt;/span&gt;, and the reason many works try to circumvent QPE to achieve a runtime &lt;span class=&quot;math-container&quot;&gt;$polylog(1/\epsilon)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This problem is well explained in the Introduction section to &lt;a href=&quot;https://arxiv.org/abs/1511.02306&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, which also presents a different quantum algorithm (not based on QPE) to solve systems of linear equations with a better dependency on &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2021-02-05T13:45:56.333" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15865" PostTypeId="2" ParentId="15863" CreationDate="2021-02-05T14:36:40.477" Score="2" Body="&lt;p&gt;You are correct that a constant factor in the cost Hamiltonian isn't relevant. This factor is included so that the eigenvalues of the cost Hamiltonian can be interpreted in terms of the number of cuts in the graph. In this simple case of a two-node graph, the eigenvalues are 0 or 1 when the factor of 1/2 is included, which correspond to 0 or 1 cuts.&lt;/p&gt;&#xA;" OwnerUserId="4294" LastActivityDate="2021-02-05T14:36:40.477" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15866" PostTypeId="1" CreationDate="2021-02-05T17:02:05.933" Score="2" ViewCount="69" Body="&lt;p&gt;I know that quantum algorithms can be useful for machine learning (&amp;quot;ML&amp;quot;) methods, and &lt;em&gt;vice versa&lt;/em&gt;. For example if we use QAOA we can use for the optimization part different types of ML methods, like SGD, Bayesian etc.&lt;/p&gt;&#xA;&lt;p&gt;Now we can hold on that the both topics can be useful for each of them but is it possible that we can convert any ML method to a quantum ML method ?&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to use QML in NISQ era?&lt;/p&gt;&#xA;" OwnerUserId="12711" LastEditorUserId="55" LastEditDate="2021-02-06T20:50:23.963" LastActivityDate="2021-02-06T20:50:23.963" Title="Quantum Machine Learning in NISQ era" Tags="&lt;algorithm&gt;&lt;machine-learning&gt;&lt;qaoa&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;nisq&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15867" PostTypeId="1" AcceptedAnswerId="15870" CreationDate="2021-02-05T19:21:10.553" Score="3" ViewCount="89" Body="&lt;p&gt;I'm trying to self-study some topics about quantum computing and I came across a topic of state separability. Talking about that, I wanted to determine separability on the following state (from Qiskit Textbook):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\left|00\right&amp;gt; + \frac{i}{\sqrt{2}}\left|01\right&amp;gt;&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I know, that it is separable, as it can be rewritten as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| 0\right&amp;gt; \otimes \frac{\left|0 \right&amp;gt; + i\left| 1\right&amp;gt;}{\sqrt{2}},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but &lt;strong&gt;what's the way to determine if the state is separable or entangled without guessing?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It's stated in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8378/is-there-an-algorithm-for-determining-if-a-given-vector-is-separable-or-entangle?rq=1&quot;&gt;Is there an algorithm for determining if a given vector is separable or entangled?&lt;/a&gt; , there are ways to do this and&lt;/p&gt;&#xA;&lt;p&gt;I came also across Peres-Horodecki separability criterion, often called also &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;PPT Criterion&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I must admit, that due to my little previous experience, I don't understand everything well, so I'd appreciate an explanation on the abovementioned state, preferably with algebraic steps written, as they're mostly missing in many explanations of this topic.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;My attempt&lt;/h3&gt;&#xA;&lt;p&gt;As I understand it, the very first thing is to rewrite the state-vector as a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \psi\right&amp;gt; = \left| 0\right&amp;gt; \otimes \frac{\left|0 \right&amp;gt; + i\left| 1\right&amp;gt;}{\sqrt{2}} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1\\ i\\ 0\\ 0\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \left| \psi \right &amp;gt; \left&amp;lt; \psi \right| = \begin{bmatrix}&#xA;\frac{1}{2} &amp;amp; -\frac{i}{2} &amp;amp; 0 &amp;amp; 0\\&#xA;\frac{i}{2} &amp;amp; \frac{1}{2} &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And now I should perform &amp;quot;partial transform&amp;quot; and find eigenvalues of the partially transformed matrix. But I'm really confused here about A and B &amp;quot;party&amp;quot;, as I have only one state &lt;span class=&quot;math-container&quot;&gt;$\left| \psi \right&amp;gt;$&lt;/span&gt;. &lt;strong&gt;How am I supposed to proceed now?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;My attempt 2&lt;/h3&gt;&#xA;&lt;p&gt;I also tried to utilize a reduced density matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left| \psi \right&amp;gt; = \frac{1}{\sqrt{2}}\left|00\right&amp;gt; + \frac{i}{\sqrt{2}}\left|01\right&amp;gt; = \frac{1}{\sqrt{2}} \left( \left| 0\right&amp;gt;_A \otimes \left| 0\right&amp;gt;_B + i\left(\left| 0\right&amp;gt;_A \otimes \left| 1 \right&amp;gt;_B \right)\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A = Tr_B \left( \left|\psi \right&amp;gt; \left&amp;lt;\psi \right| \right) = \frac{1}{2} \left( \left| 0\right&amp;gt; \left&amp;lt; 0\right| + i\left( \left|0\right&amp;gt;\left&amp;lt;1\right| \right) \right) = \frac{1}{2} \begin{bmatrix}1 &amp;amp; i\\ 0 &amp;amp; 0 \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Tr(\rho_A^2) = \frac{1}{4} Tr\left( \begin{bmatrix} 1 &amp;amp; i\\ 0 &amp;amp; 0 \end{bmatrix} \right) = \frac{1}{4}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As we can see, my results seems to be &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;, while it should be 1 for a separable state. What am I doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="8099" LastEditorUserId="8099" LastEditDate="2021-02-05T20:38:53.817" LastActivityDate="2021-02-06T03:44:12.003" Title="How do I determine if a given pure two-qubit state is separable?" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15868" PostTypeId="1" AcceptedAnswerId="15869" CreationDate="2021-02-05T20:27:10.587" Score="1" ViewCount="49" Body="&lt;p&gt;I'd like to be able to apply &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle \langle 0|$&lt;/span&gt; to project a qubit to the state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; in the middle of qiskit circuit (see, for example, the attached circuit).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ASmA3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ASmA3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I wonder if, in general, one can customize those orange boxes in some way and if that works in the real hardware.&lt;/p&gt;&#xA;" OwnerUserId="11626" LastActivityDate="2021-02-05T21:59:42.987" Title="Applying a projector to a qubit in a qiskit circuit" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;error-correction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15869" PostTypeId="2" ParentId="15868" CreationDate="2021-02-05T21:59:42.987" Score="1" Body="&lt;p&gt;I &lt;em&gt;hope&lt;/em&gt; this is what you are looking for.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Within IBM hardware, there is a new option called &amp;quot;reset&amp;quot; that allows you to reset a certain qubit back to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. For instance,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;qreg_q = QuantumRegister(3, 'q')&#xA;creg_c = ClassicalRegister(3, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.x(qreg_q[0])&#xA;circuit.h(qreg_q[2])&#xA;circuit.cswap(qreg_q[2], qreg_q[0], qreg_q[1])&#xA;circuit.h(qreg_q[2])&#xA;circuit.reset(qreg_q[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ycERx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ycERx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Within the circuit composer, you can find the reset method as well with the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; symbol:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QsOmW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QsOmW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-05T21:59:42.987" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15870" PostTypeId="2" ParentId="15867" CreationDate="2021-02-05T22:24:47.650" Score="2" Body="&lt;p&gt;Your approach is correct, but you are taking the partial trace wrong:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_A=\text{Tr}_B\big( \rho \big) = \sum_{i} \langle i_B | \rho |i_B \rangle = \langle 0_B | \rho |0_B \rangle + \langle 1_B | \rho |1_B \rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{2}|0_A \rangle \langle 0_A | + \frac{1}{2}|0_A \rangle \langle 0_A | = &#xA; |0_A \rangle \langle 0_A | $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Clearly you can see now: &lt;span class=&quot;math-container&quot;&gt;$\rho_A^2=\rho_A$&lt;/span&gt; and so the subsystem is pure, therefore the composite system is unentangled.&lt;/p&gt;&#xA;&lt;p&gt;A really easy way to remember partial traces in the computational basis for 2-bit systems is the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iauol.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iauol.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This picture is not mine, it is from Prof. Michele Mosca's Lecture Notes at University of Waterloo; publicly available.&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="14513" LastEditDate="2021-02-06T03:44:12.003" LastActivityDate="2021-02-06T03:44:12.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15871" PostTypeId="2" ParentId="15861" CreationDate="2021-02-05T22:29:01.763" Score="1" Body="&lt;p&gt;This maybe useful for you as it will list out all the devices that are available to you and theirs name. This way you can call them through the correct name and not running into the same error in the future.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ, Aer&#xA;provider = IBMQ.load_account()&#xA;available_cloud_backends = provider.backends() &#xA;print('\nHere is the list of cloud backends that are available to you:')&#xA;for i in available_cloud_backends: print(i)&#xA;&#xA;available_local_backends = Aer.backends() &#xA;print('\nHere is the list of local backends that are available to you: ')&#xA;for i in available_local_backends: print(i)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will output something like the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Here is the list of cloud backends that are available to you:&#xA;ibmq_qasm_simulator&#xA;ibmqx2&#xA;ibmq_16_melbourne&#xA;ibmq_vigo&#xA;ibmq_ourense&#xA;ibmq_valencia&#xA;ibmq_armonk&#xA;ibmq_athens&#xA;ibmq_santiago&#xA;&#xA;Here is the list of local backends that are available to you: &#xA;qasm_simulator&#xA;statevector_simulator&#xA;unitary_simulator&#xA;pulse_simulator&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-05T22:29:01.763" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15872" PostTypeId="1" AcceptedAnswerId="15883" CreationDate="2021-02-05T23:34:51.783" Score="1" ViewCount="32" Body="&lt;p&gt;I've been trying to find in textbooks a discussion on the action of arbitrary single qubit gates on a lexicographic state.  That is, given an operator &lt;span class=&quot;math-container&quot;&gt;$G_{l}= 1\otimes 1...\otimes G \otimes ... \otimes 1$&lt;/span&gt; which acts on the &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;-th qubit and a state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum \alpha_{J} |J\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$ 0 \leq J &amp;lt; 2^N $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of qubits, &lt;span class=&quot;math-container&quot;&gt;$J \in \mathbb{Z}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|J\rangle$&lt;/span&gt; is standard product state representing &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; in binary, and the sum runs through the range of J, what can be said about:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$G_{l} |\psi \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;in terms of the single qubit operator &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; and how do the original &lt;span class=&quot;math-container&quot;&gt;$\alpha_{J}$&lt;/span&gt; map.&lt;/p&gt;&#xA;&lt;p&gt;It shouldn't be too difficult to derive some formulas (there will likely be some transitions between &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; and it's bit flipped int) but I figured since this seems like a basic thing it would have been discussed somewhere.&lt;/p&gt;&#xA;&lt;p&gt;Edit: Using the notation of the answer below it's can be shown that if:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$G = g_{00} |0\rangle \langle 0| + g_{01} |0\rangle \langle 1| + g_{10} |1\rangle \langle 0| + g_{11} |1\rangle \langle 1|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then the coefficent mappings are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha'_{J} = \alpha_J g_{00} + \alpha_{f_l(J)} g_{01}  $&lt;/span&gt;   if   &lt;span class=&quot;math-container&quot;&gt;$J_{l} = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha'_{J} = \alpha_J g_{11} + \alpha_{f_l(J)} g_{10}  $&lt;/span&gt;   if   &lt;span class=&quot;math-container&quot;&gt;$J_{l} = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f_l(J)$&lt;/span&gt; flips the &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt;-th bit of &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1287" LastEditorUserId="1287" LastEditDate="2021-02-06T18:37:48.967" LastActivityDate="2021-02-06T18:37:48.967" Title="Formula for a single unit gate acting on a lexicographically represented state" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15873" PostTypeId="1" CreationDate="2021-02-05T23:47:30.783" Score="3" ViewCount="81" Body="&lt;p&gt;How can I calculate Logarithmic Negativity for the given state?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{2} |0\rangle \langle0| \otimes |+\rangle \langle+| +\frac{1}{2} |+\rangle \langle+| \otimes |1\rangle \langle1| $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user14749" LastEditorUserId="55" LastEditDate="2021-02-07T14:25:48.460" LastActivityDate="2021-02-07T19:31:17.953" Title="How do I calculate Logarithmic Negativity for the given bipartite state?" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;entanglement-negativity&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15874" PostTypeId="1" AcceptedAnswerId="15891" CreationDate="2021-02-06T00:07:48.200" Score="3" ViewCount="79" Body="&lt;p&gt;Why do the unitary gates on the measurement qubits have &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;?  Why do we need to apply the unitary gates for any power at all?  What would happen if we applied the controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; only once, for example, for each control qubit, prior to the inverse QFT?&lt;/p&gt;&#xA;&lt;p&gt;For example, from Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Specifically the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm#/media/File:PhaseCircuit-crop.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;circuit diagram&lt;/a&gt; illustrated in Wikipedia.&lt;/p&gt;&#xA;&lt;p&gt;Another resource that shows this is the Qiskit &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13030" LastEditorUserId="2927" LastEditDate="2021-02-06T14:40:39.143" LastActivityDate="2021-02-06T21:25:07.403" Title="Why do the controlled unitary operations in quantum phase estimation have $2^n$ in their exponents?" Tags="&lt;algorithm&gt;&lt;measurement&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15875" PostTypeId="2" ParentId="15873" CreationDate="2021-02-06T02:06:26.567" Score="2" Body="&lt;p&gt;If we defined the &lt;a href=&quot;https://en.wikipedia.org/wiki/Negativity_(quantum_mechanics)#Logarithmic_negativity&quot; rel=&quot;nofollow noreferrer&quot;&gt;logarithmic negativity&lt;/a&gt; as &lt;span class=&quot;math-container&quot;&gt;$E_N(\rho)= \log_2 \|\rho^{\Gamma_A} \|_1$&lt;/span&gt; then given that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{1}{2} |0\rangle \langle0| \otimes |+\rangle \langle+| +\frac{1}{2} |+\rangle \langle+| \otimes |1\rangle \langle1|  = \begin{pmatrix} 1/4 &amp;amp; 1/4 &amp;amp; 0 &amp;amp; 0\\ 1/4 &amp;amp; 1/2 &amp;amp; 0 &amp;amp; 1/4\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/4 &amp;amp; 0 &amp;amp; 1/4  \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and since  given a matrix &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; then its partial transpose with respect to the first system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X^{\Gamma_A} $&lt;/span&gt;  is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X = \begin{pmatrix} x_{11} &amp;amp; x_{12} &amp;amp; x_{13} &amp;amp; x_{14}\\ x_{21} &amp;amp; x_{22} &amp;amp; x_{23} &amp;amp; x_{24}\\ x_{31} &amp;amp; x_{32} &amp;amp; x_{33} &amp;amp; x_{34}\\x_{41} &amp;amp; x_{42} &amp;amp; x_{43} &amp;amp; x_{44}  \end{pmatrix} \hspace{0.5cm}  X^{\Gamma_A} = \begin{pmatrix} x_{11} &amp;amp; x_{12} &amp;amp; x_{31} &amp;amp; x_{32}\\ x_{21} &amp;amp; x_{22} &amp;amp; x_{41} &amp;amp; x_{42}\\ x_{13} &amp;amp; x_{14} &amp;amp; x_{33} &amp;amp; x_{34}\\x_{23} &amp;amp; x_{24} &amp;amp; x_{43} &amp;amp; x_{44}  \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;we have that the partial transpose of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with respect to the first system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is itself. That is,  &lt;span class=&quot;math-container&quot;&gt;$\rho^{\Gamma_A} = \rho$&lt;/span&gt;. Hence, &lt;span class=&quot;math-container&quot;&gt;$\|\rho^{\Gamma_A}\|_1 = 1$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;$ \log_2 \|\rho^{\Gamma_A} \|_1 = \log_2(1) = 0$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|_1$&lt;/span&gt; is the trace norm, that is, the sum of the absolute value of the eigenvalues -- but since &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a density matrix, all eigenvalues are positive, so itis just the trace (which equals &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="491" LastEditDate="2021-02-07T19:31:17.953" LastActivityDate="2021-02-07T19:31:17.953" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15876" PostTypeId="1" AcceptedAnswerId="15882" CreationDate="2021-02-06T03:14:27.143" Score="5" ViewCount="52" Body="&lt;p&gt;I had a question earlier about the Numpy DeprecationWarning flooding issue. I just updated the Python in my regular jupyter notebook and have trouble running the following cell:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cal_job = execute(cal_circuits, &#xA;                 backend = backend,&#xA;                 shots = 1024,&#xA;                  optimization_level = 0&#xA;                 )&#xA;***cal_results = cal_job.result()***&#xA;meas_fitter = CompleteMeasFitter(cal_results, state_labels)&#xA;fig, ax = plt.subplots(figsize=(10, 10))&#xA;meas_fitter.plot_calibration(ax)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My code worked fine before upgrading but now it shows the following error message (The line with the error is marked with***):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;On the IBMQ Experience page it shows my job has been successfully executed, but I cannot obtain any result from the notebook. What should I do? Thanks so much for the help!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="1859" LastEditDate="2021-02-06T16:50:11.657" LastActivityDate="2021-02-06T16:50:11.657" Title="CERTIFICATE_VERIFY_FAILED after updating Python when trying to access results in IBM QE" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15877" PostTypeId="1" AcceptedAnswerId="15892" CreationDate="2021-02-06T08:14:51.270" Score="2" ViewCount="154" Body="&lt;p&gt;When simulating a circuit using qasm simulator, if there is a depolarizing channel in the noise model, then the results could be mixed states. How can I calculate the density matrix of the mixed states?&lt;/p&gt;&#xA;" OwnerUserId="14751" LastActivityDate="2021-02-06T21:34:51.857" Title="How to simulate the density matrix in Qiskit when using the qasm simulator?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15878" PostTypeId="2" ParentId="15866" CreationDate="2021-02-06T08:20:51.950" Score="3" Body="&lt;p&gt;I will give you a partial answer cocerning using quantum machine learning methods in NISQ era. As any other quantum algorithm, QML algorithms can be used on current NISQ processors. However, there is a problem with noise leading to quick decoherence of qubits. Especially entangled qubits (which are crucial for quantum computing) are very sussceptible to noise.&#xA;Moreover, there is a problem with low number of qubits currently available (see &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;This all means that you can use QML for small tasks only. Generally, vast mojority of quantum algorithms can be used for toy models (tasks) only.&lt;/p&gt;&#xA;&lt;p&gt;You probably heard that some breakthroughts (quantum supremacy/advantage) have been achived by Google or some Chinese firms (&lt;em&gt;sorry that I cannot remember the names&lt;/em&gt;), however, in these cases we are talking about quantum processors designed for a particular task. What I stated above about noise and decoherence is concerning universal quantum processors&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-06T08:20:51.950" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15879" PostTypeId="1" AcceptedAnswerId="15884" CreationDate="2021-02-06T08:30:56.623" Score="1" ViewCount="78" Body="&lt;p&gt;I was reading the book &amp;quot;Quantum Computing Since Democritus&amp;quot;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;The set of ordinal numbers has the important property of being well&#xA;ordered,which means that every subset has a minimum element. This is&#xA;unlike the integers or the positive real numbers, where any element&#xA;has another that comes before it.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Unlike integers? Let's consider a set &lt;span class=&quot;math-container&quot;&gt;$\{1,2,3\}$&lt;/span&gt; This has a minimum element.&lt;/p&gt;&#xA;&lt;p&gt;What does the author want to say here?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-07T14:45:20.793" LastActivityDate="2021-02-07T17:28:07.663" Title="Why isn't $\{1,2,3\}$ well ordered?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2021-02-07T17:49:23.133" ContentLicense="CC BY-SA 4.0" />
  <row Id="15880" PostTypeId="1" CreationDate="2021-02-06T13:28:19.680" Score="0" ViewCount="44" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zxM11.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zxM11.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this circuit, if the two qubits are initial in state 0, then after the oracle they are entangled and in state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$0.5 * (|00\rangle+|01\rangle+|10\rangle-|11\rangle)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is how do the two H gates act on them? Do they act like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$0.25 * [(|0\rangle+|1\rangle)\otimes(|0\rangle+|1\rangle) + (|0\rangle+|1\rangle)\otimes(|0\rangle-|1\rangle) + (|0\rangle-|1\rangle)\otimes(|0\rangle+|1\rangle) - (|0\rangle-|1\rangle)\otimes(|0\rangle-|1\rangle)]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which in the end nothing has changed. My intuition tells me that it's wrong.&lt;/p&gt;&#xA;&lt;p&gt;Update: The figure above is from a circuit to implement Grover's algorithm. The whole figure is given below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/izNXQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/izNXQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have seen the answer that the state is indeed not changed after the two H gates, why they add them here?&lt;/p&gt;&#xA;" OwnerUserId="14755" LastEditorUserId="10480" LastEditDate="2021-02-06T15:38:28.927" LastActivityDate="2021-02-06T15:38:28.927" Title="How do two H gates act on two entangled qubits?" Tags="&lt;quantum-gate&gt;&lt;grovers-algorithm&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15881" PostTypeId="2" ParentId="15880" CreationDate="2021-02-06T14:13:40.560" Score="1" Body="&lt;p&gt;Probably the best way to play and learn about the effect of specific gates on a state is with &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quirk&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22%5D,%5B%22Z%22,%22%E2%80%A2%22%5D,%5B%22Amps2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt; is the first situation you are describing (the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ubpcf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ubpcf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can hover over the amplitude graph to see the amplitude value for &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$-0.5$&lt;/span&gt; as you correctly have.&lt;/p&gt;&#xA;&lt;p&gt;Add the second layer of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;s to see its effect (&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22:%5B%5B%22H%22,%22H%22%5D,%5B%22Z%22,%22%E2%80%A2%22%5D,%5B%22H%22,%22H%22%5D,%5B%22Bloch%22,%22Bloch%22%5D,%5B%22Amps2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nlEkE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nlEkE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Not change! Your math is correct (and the intuition is not, as almost always when dealing with quantum computing :) )&lt;/p&gt;&#xA;&lt;p&gt;The reason to add that layer in Grover is because the &lt;em&gt;initialization&lt;/em&gt;, &lt;em&gt;oracle&lt;/em&gt;, and &lt;em&gt;diffuser&lt;/em&gt; are different stages that are meant to be generic. They situation you are described happens specifically with this oracle, but you could change the oracle and Grover will continue working.&lt;/p&gt;&#xA;&lt;p&gt;The compilation process takes care of these redundancies and cancel them out. Here is your example on Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit = QuantumCircuit(2)&#xA;# Initialization &#xA;circuit.h([0, 1])&#xA;# oracle&#xA;circuit.cz(0, 1)&#xA;# diffuser&#xA;circuit.h([0, 1])&#xA;circuit.z([0, 1])&#xA;circuit.cz(0, 1)&#xA;circuit.h([0, 1])&#xA;&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐   ┌───┐┌───┐   ┌───┐&#xA;q_0: ┤ H ├─■─┤ H ├┤ Z ├─■─┤ H ├&#xA;     ├───┤ │ ├───┤├───┤ │ ├───┤&#xA;q_1: ┤ H ├─■─┤ H ├┤ Z ├─■─┤ H ├&#xA;     └───┘   └───┘└───┘   └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Before running, the circuit is optimized in a process that Qiskit calls &amp;quot;transpilation&amp;quot;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;optimized_circuit = transpile(circuit, basis_gates=['cx', 'u3'], optimization_level=3)&#xA;print(optimized_circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌─────────────┐     ┌─────────────┐      ┌─────────────┐&#xA;q_0: ┤ U3(π/2,0,π) ├──■──┤ U3(π/2,π,π) ├───■──┤ U3(π/2,0,π) ├&#xA;     └─────────────┘┌─┴─┐├─────────────┴┐┌─┴─┐└─────────────┘&#xA;q_1: ───────────────┤ X ├┤ U3(π/2,0,2π) ├┤ X ├───────────────&#xA;                    └───┘└──────────────┘└───┘               &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This final circuit is equivalent to yours and it is closer to the circuit that will run. However, presenting you this circuit as part of the Grover explanation is not very pedagogic, as it is important to first understand each stage.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-06T15:02:56.287" LastActivityDate="2021-02-06T15:02:56.287" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15882" PostTypeId="2" ParentId="15876" CreationDate="2021-02-06T14:26:20.743" Score="1" Body="&lt;p&gt;If running on MacOS, did you try to &lt;code&gt;Install Certificates&lt;/code&gt;? You can execute the following line in a terminal, replacing &lt;code&gt;&amp;lt;version&amp;gt;&lt;/code&gt; with your Python version.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/Applications/Python\ &amp;lt;version&amp;gt;/Install\ Certificates.command&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-06T16:36:46.580" LastActivityDate="2021-02-06T16:36:46.580" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15883" PostTypeId="2" ParentId="15872" CreationDate="2021-02-06T14:32:49.947" Score="1" Body="&lt;p&gt;That &lt;span class=&quot;math-container&quot;&gt;$G_{l}$&lt;/span&gt; action is linear, so you can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G_{l} |\psi \rangle = G_{l} \sum \alpha_{J} |J\rangle = \sum \alpha_{J} G_{l} |J\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To calculate &lt;span class=&quot;math-container&quot;&gt;$G_{l} |J\rangle$&lt;/span&gt; you can use tensor mixed-product property:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G_{l} |J\rangle = \big(1\otimes ...\otimes G \otimes ... \otimes 1\big) ~\cdot~ \big(|J_1\rangle \otimes ... \otimes |J_l\rangle  \otimes ... \otimes |J_N\rangle\big) =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= |J_1\rangle \otimes ... \otimes G|J_l\rangle  \otimes ... \otimes |J_N\rangle, &#xA;$$&lt;/span&gt;&#xA;here &lt;span class=&quot;math-container&quot;&gt;$J_i$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th bit of &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can simplify the total sum by grouping terms in two groups based on the value of &lt;span class=&quot;math-container&quot;&gt;$J_l$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G_{l} |\psi \rangle = \sum_{J_l=0} \alpha_{J} |J_1... J_{l-1}\rangle \otimes G|0\rangle \otimes |J_{l+1} ...J_n\rangle + &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;+ \sum_{J_l=1} \alpha_{J} |J_1... J_{l-1}\rangle \otimes G|1\rangle \otimes |J_{l+1} ...J_n\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-02-06T14:32:49.947" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15884" PostTypeId="2" ParentId="15879" CreationDate="2021-02-06T15:36:20.760" Score="2" Body="&lt;p&gt;An ordered set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is &lt;a href=&quot;https://en.wikipedia.org/wiki/Well-order&quot; rel=&quot;nofollow noreferrer&quot;&gt;well-ordered&lt;/a&gt; if &lt;em&gt;every&lt;/em&gt; non-empty subset of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; has a least element.&lt;/p&gt;&#xA;&lt;p&gt;As stated in the quote, the set &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt; of integers is not well-ordered (under the usual order relation). An example of a subset of the integers &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt; which fails to have a least element is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{\dots, -8, -6, -4, -2, 0\},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;another is &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}$&lt;/span&gt; itself.&lt;/p&gt;&#xA;&lt;p&gt;The set &lt;span class=&quot;math-container&quot;&gt;$\{1, 2, 3\}$&lt;/span&gt; is well-ordered since all seven non-empty subsets of it have a least element. Note that the quote does not deny well-ordering of &lt;span class=&quot;math-container&quot;&gt;$\{1, 2, 3\}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-07T17:28:07.663" LastActivityDate="2021-02-07T17:28:07.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15885" PostTypeId="2" ParentId="15817" CreationDate="2021-02-06T16:05:00.290" Score="1" Body="&lt;p&gt;Suppose you have a logical qubit encoded using a stabilizer code with generators &lt;span class=&quot;math-container&quot;&gt;$g_1, g_2, \dots, g_k$&lt;/span&gt;. If you measure all the generators and each of the measurements yields &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; then you know that the state of your logical qubit belongs to the code subspace. On the other hand, if one or more of then measurements of the generators returns &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; then you know that the state is outside the code subspace and you can conclude that an error occurred. In other words, we achieved the most basic function of an error correcting code: we detected an error. In fact, we can often conclude more: by looking at exactly which generators returned &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; we can sometimes identify and locate the error.&lt;/p&gt;&#xA;&lt;p&gt;Consider for example the 3-qubit bit-flip code with stabilizer generators &lt;span class=&quot;math-container&quot;&gt;$IZZ, ZZI$&lt;/span&gt; and suppose that the measurement of &lt;span class=&quot;math-container&quot;&gt;$IZZ$&lt;/span&gt; returned &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and the measurement of &lt;span class=&quot;math-container&quot;&gt;$ZZI$&lt;/span&gt; returned &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. Assuming (as is more likely) that only a single bit-flip occurred, we see that the only possibility compatible with the measurements is &lt;span class=&quot;math-container&quot;&gt;$XII$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In designing stabilizer codes, a major goal is to find codes with the property that the knowledge of the outcomes of the measurements of stabilizer generators provides sufficient information to uniquely identify and locate as many errors as possible.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-06T16:10:51.700" LastActivityDate="2021-02-06T16:10:51.700" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15886" PostTypeId="2" ParentId="15866" CreationDate="2021-02-06T16:16:01.647" Score="1" Body="&lt;p&gt;Quantum Machine Learning in this NISQ Era is making progress in the problems related classification, categorisation, clustering, and optimisation areas for specific type of datasets in chemistry, finance, travel and transportation domain.&lt;/p&gt;&#xA;&lt;p&gt;For example, the Microsoft Q# Quantum Machine Learning Toolkit uses Pauli X,and Z gates to construct a Classifier Algorithms titled Half Moon and Full Moon. The Pauli gates are the Single Qubit Gates based on the better-known Pauli matrices (i.e., Pauli spin matrices) which are incredibly useful for calculating changes to the spin of a single electron. Please find the implementation in this &lt;a href=&quot;https://github.com/microsoft/Quantum/blob/main/samples/machine-learning/half-moons/Training.qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Tensorflow Quantum by Google has a collection of interesting quantum machine learning models for optimising gradient based algorithms. NetKet is a another collection of interesting quantum machine learning algorithms such as Quantum State Tomography for Quantum State Reconstruction. Please find a reference implementation from Netket in &lt;a href=&quot;https://github.com/netket/netket/blob/master/Tutorials/QuantumStateTomography.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;this GitHub repository&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4501" LastEditorUserId="4501" LastEditDate="2021-02-06T16:35:46.770" LastActivityDate="2021-02-06T16:35:46.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15887" PostTypeId="1" AcceptedAnswerId="15893" CreationDate="2021-02-06T16:21:23.223" Score="2" ViewCount="53" Body="&lt;p&gt;Consider a circuit built as follows: take two ancilla states and an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; made of a series of controlled gates which act on a pure state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; if the ancilla is in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; if the ancilla is in &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; if the ancilla is in &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; if the ancilla is in &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Prepare the ancilla in the state &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle_{A}=\alpha|00\rangle+\beta|01\rangle+\gamma|10\rangle+\delta|11\rangle.$$&lt;/span&gt;I want to find &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt; using the operator-sum formalism. Using the notation &lt;span class=&quot;math-container&quot;&gt;$C^2_O$&lt;/span&gt; for a double-controlled gate, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E_{ij}=\langle ij|C_Z^2C_Y^2C_X^2(\alpha|00\rangle+\beta|01\rangle+\gamma|10\rangle+\delta|11\rangle) \\ =\langle ij|00\rangle\alpha X+\langle ij|01\rangle\beta Y\langle ij|10\rangle\gamma Z+\langle ij|11\rangle\delta \mathbb{I},&#xA;\end{equation}&lt;/span&gt;&#xA;so that, for example, &lt;span class=&quot;math-container&quot;&gt;$E_{00}=\alpha X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$E_{00}^\dagger=\alpha^*X$&lt;/span&gt;. Therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho'=\sum_{i,j\in\{0,1\}}E_{ij}\rho E_{ij}^\dagger=|\alpha|^2X\rho X+|\beta|^2 Y\rho Y+|\gamma|^2Z\rho Z+|\delta|^2\rho.&#xA;\end{equation}&lt;/span&gt; &lt;em&gt;(as a side note: what is the standard notation to indicate a doubly controlled quantum gate?)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This model can be used to study several noisy channels. In particular, &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2=|\beta|^2=|\gamma|^2=p/3$&lt;/span&gt; gives the so-called depolarizing channel: &lt;span class=&quot;math-container&quot;&gt;$$\rho'=\frac{p}{3}(X\rho X+Y\rho Y+Z \rho Z)+(1-p)\rho.$$&lt;/span&gt; To see this, I should be able to write the first term as &lt;span class=&quot;math-container&quot;&gt;$p\mathbb{I}/2$&lt;/span&gt;. The problem is, I can't. I haven't tried anything fancy, just writing &lt;span class=&quot;math-container&quot;&gt;$$\rho=\begin{pmatrix} a &amp;amp; b \\ c &amp;amp; d \end{pmatrix} $$&lt;/span&gt;&#xA;and doing the calculations explicitly. What's the best way to show it?&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="10480" LastEditDate="2021-02-06T22:13:09.810" LastActivityDate="2021-02-06T22:27:15.500" Title="Deriving the depolarizing channel" Tags="&lt;quantum-operation&gt;&lt;information-theory&gt;&lt;depolarizing-channel&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15889" PostTypeId="2" ParentId="15887" CreationDate="2021-02-06T18:25:15.070" Score="1" Body="&lt;p&gt;If you expand &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in terms of its Bloch vector, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho = \frac{1}{2}(I + r_x X + r_y Y + r_z Z)&#xA;\end{align}&lt;/span&gt;&#xA;Plug this into your expression, and work out all of the terms like &lt;span class=&quot;math-container&quot;&gt;$XPX, YPY, ZPZ$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P \in {I,X,Y,Z}$&lt;/span&gt;, using the standard Pauli identities (such as those listed on slide 14 of &lt;a href=&quot;http://www.vcpc.univie.ac.at/%7Eian/hotlist/qc/talks/bloch-sphere-rotations.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this powerpoint&lt;/a&gt;).  This should yield the desired result.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-02-06T18:25:15.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15890" PostTypeId="1" AcceptedAnswerId="16198" CreationDate="2021-02-06T19:36:55.863" Score="3" ViewCount="140" Body="&lt;p&gt;I have a sketch of the proof of Bell's theorem that goes as follows: Alice measures an observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; along a direction &lt;span class=&quot;math-container&quot;&gt;$\vec a$&lt;/span&gt; with possible outcomes &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt;, and Bob does the same for an observable &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; along &lt;span class=&quot;math-container&quot;&gt;$\vec b$&lt;/span&gt; with the same outcomes. Both observables possess the same hidden variable &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; with normalized probability distribution &lt;span class=&quot;math-container&quot;&gt;$\int p(\lambda)d\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The expectation value for their measurements once &lt;span class=&quot;math-container&quot;&gt;$\vec a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec b$&lt;/span&gt; have been fixed is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;E(\vec a,\vec b)=\int d\lambda p(\lambda)A(\vec a,\lambda)B(\vec b,\lambda).&#xA;\end{equation}&lt;/span&gt;&#xA;If we assume that Bob measures in two different directions &lt;span class=&quot;math-container&quot;&gt;$\vec b, \vec b'$&lt;/span&gt; without change in the paramter &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\tag{$*$}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b')=\int d\lambda(A(\vec a,\lambda)B(\vec b,\lambda)-A(\vec a,\lambda)B(\vec b',\lambda)).&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;strong&gt;My question&lt;/strong&gt;: how do we get from &lt;span class=&quot;math-container&quot;&gt;$(*)$&lt;/span&gt; to the estimate&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b')\le \left|\int d\lambda p(\lambda)(1-A(\vec a', \lambda)B(\vec b',\lambda))\right|+  \left|\int d\lambda p(\lambda)(1-A(\vec a', \lambda)B(\vec b',\lambda))\right| \\ \le 2-| E(\vec a',\vec b')+ E(\vec a',\vec b)|\ ?&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="55" LastEditDate="2021-02-07T14:11:34.150" LastActivityDate="2021-02-24T15:57:50.640" Title="Formal proof of Bell's inequality in CHSH form" Tags="&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15891" PostTypeId="2" ParentId="15874" CreationDate="2021-02-06T21:25:07.403" Score="0" Body="&lt;p&gt;I also struggled with this question initially and I understood it really well after looking through these set of slides starting at &amp;quot;Quantum Phase Estimation&amp;quot; (page 120 in the pdf): &lt;a href=&quot;https://drive.google.com/file/d/14G_0TwdxBFpI_Ylj5lb_imVtcnunrQcB/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://drive.google.com/file/d/14G_0TwdxBFpI_Ylj5lb_imVtcnunrQcB/view?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But the short answer is that for every extra level of accuracy in binary, you need an extra power of 2 of unitaries.&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-06T21:25:07.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15892" PostTypeId="2" ParentId="15877" CreationDate="2021-02-06T21:34:51.857" Score="3" Body="&lt;p&gt;The easiest way to do this would be to probably use the density matrix snapshot instruction: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.extensions.SnapshotDensityMatrix.html#qiskit.providers.aer.extensions.SnapshotDensityMatrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.aer.extensions.SnapshotDensityMatrix.html#qiskit.providers.aer.extensions.SnapshotDensityMatrix&lt;/a&gt; basically just add &lt;code&gt;circuit.snapshot_density_matrix('density_matrix')&lt;/code&gt; to your circuit where you want to get the density matrix. That will store the density matrix in the output results. Here is an example script:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.test.mock import FakeVigo&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.providers.aer import extensions  # import aer snapshot instructions&#xA;from qiskit import execute&#xA;&#xA;&#xA;qc = QuantumCircuit(2)&#xA;qc.h(0)&#xA;qc.cx(0, 1)&#xA;qc.snapshot_density_matrix('density_matrix')&#xA;result = execute(qc, FakeVigo()).result()&#xA;# Extract density matrix snapshot from result object:&#xA;density_matrix = result.data()['snapshots']['density_matrix']['density_matrix'][0]['value']&#xA;print(density_matrix)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In that script &lt;code&gt;FakeVigo&lt;/code&gt; is just running Aer under the covers with a noise model taken from a snapshot of the backend properties from the IBMQ vigo device.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2021-02-06T21:34:51.857" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15893" PostTypeId="2" ParentId="15887" CreationDate="2021-02-06T22:09:14.677" Score="2" Body="&lt;p&gt;Consider the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}: L_H \to L_H$&lt;/span&gt; given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{E}(\rho) = \frac{1}{4} (\rho + X\rho X + Y\rho Y + Z\rho Z)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$L_H$&lt;/span&gt; denotes the four-dimensional real vector space of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; Hermitian matrices with complex entries.&lt;/p&gt;&#xA;&lt;p&gt;It is straightforward to calculate that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(I) = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(X) = \mathcal{E}(Y) = \mathcal{E}(Z) = 0$&lt;/span&gt;. However, &lt;span class=&quot;math-container&quot;&gt;$I, X, Y, Z$&lt;/span&gt; form a basis of &lt;span class=&quot;math-container&quot;&gt;$L_H$&lt;/span&gt;, so any &lt;span class=&quot;math-container&quot;&gt;$\rho \in L_H$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$\rho = aI + bX + cY + dZ$&lt;/span&gt; and then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho) = aI$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a density matrix then &lt;span class=&quot;math-container&quot;&gt;$a = \frac{1}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho) = I/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can use this result to extract the term proportional to the identity in&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho'&amp;amp;=\frac{p}{3}(X\rho X+Y\rho Y+Z \rho Z)+(1-p)\rho \\&#xA;&amp;amp;= \frac{p}{3}(\rho + X\rho X+Y\rho Y+Z \rho Z) + \left(1 - \frac{4p}{3}\right)\rho \\&#xA;&amp;amp; = \frac{4p}{3} \frac{I}{2} + \left(1 - \frac{4p}{3}\right)\rho \\&#xA;&amp;amp; = \lambda \frac{I}{2} + (1 - \lambda)\rho&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$p \in [0, 1]$&lt;/span&gt; is the Pauli error probability and &lt;span class=&quot;math-container&quot;&gt;$\lambda = \frac{4p}{3} \in [0, \frac{4}{3}]$&lt;/span&gt; is the depolarization parameter. These two parameters are different because the maximally mixed state &lt;span class=&quot;math-container&quot;&gt;$I/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(X\rho X + Y\rho Y + Z\rho Z)/3$&lt;/span&gt; are different states.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-06T22:27:15.500" LastActivityDate="2021-02-06T22:27:15.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15894" PostTypeId="2" ParentId="14878" CreationDate="2021-02-06T23:56:01.500" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt; denote the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 + \lambda_2 = \mathrm{tr}\rho = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 \lambda_2 = \det \rho$&lt;/span&gt;. We can compute the determinant using trace of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho^2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\det\rho = \lambda_1\lambda_2 = \frac{1}{2}\left[(\lambda_1 + \lambda_2)^2 - (\lambda_1^2 + \lambda_2^2)\right] = \frac{1}{2}\left[(\mathrm{tr}\rho)^2 - \mathrm{tr}\rho^2\right].&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(N.B. this useful &lt;a href=&quot;https://en.wikipedia.org/wiki/Determinant#Relation_to_eigenvalues_and_trace&quot; rel=&quot;nofollow noreferrer&quot;&gt;relationship&lt;/a&gt; underlies the &lt;a href=&quot;https://en.wikipedia.org/wiki/Faddeev%E2%80%93LeVerrier_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Faddeev-LeVerrier algorithm&lt;/a&gt;.) Now, calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}\rho^2 = \frac{1}{4}\mathrm{tr}(|a\rangle\langle a| + \langle a|b\rangle |a\rangle\langle b| + \langle b|a\rangle |b\rangle\langle a| + |b\rangle\langle b|) \\&#xA;= \frac{1}{2} + \frac{|\langle a|b\rangle|^2}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda_1 \lambda_2 = \frac{1}{2}\left[(\mathrm{tr}\rho)^2 - \mathrm{tr}\rho^2\right] = \frac{1}{4} - \frac{|\langle a|b\rangle|^2}{4}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;from which we see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda_i = \frac{1}{2} \pm \frac{|\langle a|b\rangle|}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-07T00:23:17.620" LastActivityDate="2021-02-07T00:23:17.620" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15895" PostTypeId="1" AcceptedAnswerId="15914" CreationDate="2021-02-07T00:00:04.967" Score="4" ViewCount="61" Body="&lt;p&gt;I've already generated a filter for readout error mitigation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cal_results = cal_job.result()&#xA;meas_fitter = CompleteMeasFitter(cal_results, state_labels)  &#xA;fig, ax = plt.subplots(figsize=(10, 10))&#xA;meas_fitter.plot_calibration(ax)&#xA;meas_filter = meas_fitter.filter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qJ00B.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qJ00B.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have a set of circuits executed using the IBM job manager, the list is called &lt;code&gt;all_circuits&lt;/code&gt;. After transpling the list, I tried:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;MExperiments = job_manager.run(all_circuits, backend=backend, shots = nshots)&#xA;results = MExperiments.results() &#xA;**mitigated_results = meas_filter.apply(results)**&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm hoping to use the filter to mitigate the errors for each circuit in the list, but the last line doesn't quite work. It shows me&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QiskitError: 'Unrecognized type for raw_data.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can I fix this issue? Thanks:)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rule{4cm}{0.4pt}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;PS:&lt;/strong&gt;&#xA;From the &lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/3_measurement_error_mitigation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial&lt;/a&gt;, there're 4 types of raw data that match the requirement:&lt;/p&gt;&#xA;&lt;p&gt;Form1: A counts dictionary from results.get_counts,&lt;/p&gt;&#xA;&lt;p&gt;Form2: A list of counts of length=len(state_labels),&lt;/p&gt;&#xA;&lt;p&gt;Form3: A list of counts of length=M*len(state_labels) where M is an integer (e.g. for use with the tomography data),&lt;/p&gt;&#xA;&lt;p&gt;Form4: A qiskit Result.&lt;/p&gt;&#xA;&lt;p&gt;I'm not pretty sure why the &lt;code&gt;results&lt;/code&gt; in my code doesn't fit any one of them.&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-02-07T21:07:51.703" LastActivityDate="2021-02-08T00:17:10.737" Title="Filtering a set of results obtained from job manager" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;error-mitigation&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15896" PostTypeId="1" CreationDate="2021-02-07T00:19:17.557" Score="6" ViewCount="51" Body="&lt;p&gt;I am currently reading Shor's algorithm on my own and I come across a paper via this &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0205095.pdf&quot; rel=&quot;noreferrer&quot;&gt;link&lt;/a&gt;. It shows the circuit for implementing Shor's alogrithm. Here it depicts that taking a QFT circuit on the number a on the qubits b that are already in fourier space would result in the addition of a and b in Fourier space.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/u5Jlj.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/u5Jlj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The addition is quite intuitive. However, when it comes the subtraction, I am stuck.Why taking an inverse QFT circuit would result in the &lt;span class=&quot;math-container&quot;&gt;$b-a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$2^{n+1} - (a-b)$&lt;/span&gt;? Wouldn't it return &lt;span class=&quot;math-container&quot;&gt;$a+b$&lt;/span&gt; as the second stage output is &lt;span class=&quot;math-container&quot;&gt;$\Phi(a+b)$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5kLjU.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5kLjU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14670" LastActivityDate="2021-03-11T08:04:45.400" Title="How does the subtraction gate work in Fourier space" Tags="&lt;quantum-gate&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15897" PostTypeId="1" AcceptedAnswerId="15898" CreationDate="2021-02-07T00:40:18.007" Score="3" ViewCount="47" Body="&lt;p&gt;How can I construct a circuit that measures PVM &lt;span class=&quot;math-container&quot;&gt;$\{|\psi\rangle\langle\psi|\},|\psi^\perp\rangle\langle\psi^\perp| \}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\cos\frac{\theta}{2}+e^{i\phi}\sin\frac{\theta}{2}|1\rangle$&lt;/span&gt; by using only computational basis measurement and Pauli-axis rotation.&lt;/p&gt;&#xA;" OwnerDisplayName="user14749" LastEditorUserId="10480" LastEditDate="2021-02-07T01:32:17.620" LastActivityDate="2021-02-07T01:32:17.620" Title="Circuit that measures PVM" Tags="&lt;circuit-construction&gt;&lt;measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15898" PostTypeId="2" ParentId="15897" CreationDate="2021-02-07T01:31:40.430" Score="1" Body="&lt;p&gt;Recall that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_Y(\theta) = \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp;-\sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp;\cos\frac{\theta}{2}&#xA;\end{pmatrix} \\&#xA;R_Z(\phi) = \begin{pmatrix}&#xA;e^{-\frac{i\phi}{2}} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{\frac{i\phi}{2}}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta, \phi) = R_Z(\phi) R_Y(\theta) \equiv\begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\&#xA;e^{i\phi}\sin\frac{\theta}{2} &amp;amp; e^{i\phi}\cos\frac{\theta}{2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\equiv$&lt;/span&gt; denotes equivalence up to unobservable global phase. We see that &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = |\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle = |\psi^\perp\rangle$&lt;/span&gt;. Therefore&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\langle\psi| = U|0\rangle\langle 0|U^\dagger \\&#xA;|\psi^\perp\rangle\langle\psi^\perp| = U|1\rangle\langle 1|U^\dagger.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We conclude that to reproduce output statistics of the PVM &lt;span class=&quot;math-container&quot;&gt;$\{|\psi\rangle\langle\psi|\},|\psi^\perp\rangle\langle\psi^\perp| \}$&lt;/span&gt; we should apply &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; followed by a measurement in the computational basis. If we also want to obtain the appropriate post-measurement state we then need to apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-07T01:31:40.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15900" PostTypeId="1" CreationDate="2021-02-07T08:27:02.830" Score="3" ViewCount="64" Body="&lt;p&gt;There are a few options already discussed and suggested how to pass the initial state to the QAOA module.&#xA;I tried all but no one works in my case. Maybe, there are any other ideas?&lt;/p&gt;&#xA;&lt;p&gt;So, I created the initial state as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(4)&#xA;circ.h(0)&#xA;circ.h(1)&#xA;circ.h(2)&#xA;circ.h(3)&#xA;backend=Aer.get_backend('statevector_simulator')&#xA;job = execute(circ, backend)&#xA;result = job.result()&#xA;init_state = result.get_statevector(circ)&#xA;print(init_state)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then, by passing it to QAOA:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qaoa = QAOA(qubitOp, optimizer, p=3, initial_state=init_state,&#xA;                mixer=mixerop, initial_point=init_point,&#xA;                callback=store_intermediate_result, quantum_instance=qi)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I got the error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\minimum_eigen_solvers\qaoa\var_form.py in construct_circuit(self, parameters, q)&#xA;     83         # initialize circuit, possibly based on given register/initial state&#xA;     84         if self._initial_state is not None:&#xA;---&amp;gt; 85             stateVector = CircuitStateFn(self._initial_state.construct_circuit('circuit'))&#xA;     86             circuit = stateVector.to_circuit_op()&#xA;     87         else:&#xA;&#xA;AttributeError: 'numpy.ndarray' object has no attribute 'construct_circuit'&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14517" LastEditorUserId="55" LastEditDate="2021-02-08T23:00:05.833" LastActivityDate="2021-02-08T23:00:05.833" Title="Initial state definition for QAOA" Tags="&lt;programming&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15901" PostTypeId="1" CreationDate="2021-02-07T08:49:19.643" Score="5" ViewCount="53" Body="&lt;p&gt;To my understanding, entanglement distillations is transformation of several copies of weakly entangled states into fewer copies of more strongly entangled states using local operations and classical communication.&#xA;My question is, what is the difference between &amp;quot;entanglement distillation&amp;quot; and &amp;quot;entanglement purification&amp;quot;?&#xA;I've checked some papers, but I thought these words are used interchangeably.&lt;/p&gt;&#xA;" OwnerUserId="14762" LastEditorUserId="491" LastEditDate="2021-02-07T19:35:09.100" LastActivityDate="2021-02-07T19:35:09.100" Title="What is the difference between &quot;entanglement distillation&quot; and &quot;entanglement purification&quot;?" Tags="&lt;entanglement&gt;&lt;state-distillation&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15902" PostTypeId="2" ParentId="15900" CreationDate="2021-02-07T10:10:03.147" Score="1" Body="&lt;p&gt;Try this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.components.initial_states import Custom&#xA;initial_state = Custom(num_qubits , state = 'zero') #if you want to start with zero state&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;note if you to specify an initial state in equal superposition, you just need to change &lt;code&gt;state = 'uniform' &lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And if you want a custom state_vector then you can specify it as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;initial_state = Custom(num_qubits , state_vector = [1,0,0,0,...] ) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that the length of the vector is &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number qubits.. so this might not be the most practical way to do thing.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Once you specify all of that, you can just specify it in your QAOA class parameters:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qaoa = QAOA(qubit_op,optimizer, initial_state = initial, quantum_instance=quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Below is a full working script from end to end: (I took the script from one of the Qiskit's tutorial and modified it to have an initial state like you wanted)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import networkx as nx&#xA;&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver&#xA;from qiskit.optimization.applications.ising import graph_partition&#xA;from qiskit.optimization.applications.ising.common import random_graph, sample_most_likely&#xA;&#xA;num_nodes = 4&#xA;w = random_graph(num_nodes, edge_prob=0.8, weight_range=10, seed=48)&#xA;print(w)&#xA;&#xA;&#xA;G = nx.from_numpy_matrix(w)&#xA;layout = nx.random_layout(G, seed=10)&#xA;colors = ['r', 'g', 'b', 'y']&#xA;nx.draw(G, layout, node_color=colors)&#xA;labels = nx.get_edge_attributes(G, 'weight')&#xA;nx.draw_networkx_edge_labels(G, pos=layout, edge_labels=labels);&#xA;&#xA;&#xA;def brute_force():&#xA;    # use the brute-force way to generate the oracle&#xA;    def bitfield(n, L):&#xA;        result = np.binary_repr(n, L)&#xA;        return [int(digit) for digit in result]  # [2:] to chop off the &amp;quot;0b&amp;quot; part&#xA;&#xA;    L = num_nodes&#xA;    max = 2**L&#xA;    minimal_v = np.inf&#xA;    for i in range(max):&#xA;        cur = bitfield(i, L)&#xA;&#xA;        how_many_nonzero = np.count_nonzero(cur)&#xA;        if how_many_nonzero * 2 != L:  # not balanced&#xA;            continue&#xA;&#xA;        cur_v = graph_partition.objective_value(np.array(cur), w)&#xA;        if cur_v &amp;lt; minimal_v:&#xA;            minimal_v = cur_v&#xA;    return minimal_v&#xA;&#xA;sol = brute_force()&#xA;print(f'Objective value computed by the brute-force method is {sol}')&#xA;&#xA;qubit_op, offset = graph_partition.get_operator(w)&#xA;&#xA;&#xA;from qiskit.aqua import aqua_globals&#xA;from qiskit.aqua.algorithms import QAOA&#xA;from qiskit.aqua.components.optimizers import COBYLA&#xA;from qiskit.circuit.library import TwoLocal&#xA;from qiskit.aqua import QuantumInstance&#xA;&#xA;aqua_globals.random_seed = 10598&#xA;quantum_instance = QuantumInstance(BasicAer.get_backend('qasm_simulator'), shots = 10000)    &#xA;optimizer = COBYLA(maxiter= 1,tol=0.000000001)  &#xA;initial =  Custom(4 , state = 'zero')&#xA;qaoa = QAOA(qubit_op,optimizer, initial_state = initial, quantum_instance=quantum_instance)&#xA;&#xA;result = qaoa.compute_minimum_eigenvalue()&#xA;&#xA;x = sample_most_likely(result.eigenstate)&#xA;ising_sol = graph_partition.get_graph_solution(x)&#xA;&#xA;print(ising_sol)&#xA;print(f'Objective value computed by QAOA is {graph_partition.objective_value(x, w)}')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-07T10:10:03.147" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15903" PostTypeId="2" ParentId="15858" CreationDate="2021-02-07T11:33:44.577" Score="2" Body="&lt;p&gt;A partial explanation is motivated by the proof in Theorem 1 (bottom of page 2).&lt;/p&gt;&#xA;&lt;p&gt;Assuming two locally non-commuting stabilizing operators, using the Cauchy-Schwarz inequality, for pure product states it is shown that &lt;span class=&quot;math-container&quot;&gt;$$\langle S_{l}^{(GHZ_N)} + S_{m}^{(GHZ_N)} \rangle \leq 1.$$&lt;/span&gt; But since we also assume these are stabilizer operators (&lt;em&gt;GHZ&lt;/em&gt; eigenstate with eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;), we know the &lt;em&gt;GHZ&lt;/em&gt; state gives an entangled state example where &lt;span class=&quot;math-container&quot;&gt;$\langle S_{l}^{(GHZ_N)} + S_{m}^{(GHZ_N)} \rangle &amp;gt; 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore,&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\lnot$&lt;/span&gt; locally commuting stabilizers &lt;span class=&quot;math-container&quot;&gt;$S_l^{(GHZ_N)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_k^{(GHZ_N)}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\Leftrightarrow$&lt;/span&gt;  no pure common product eigenstates &lt;span class=&quot;math-container&quot;&gt;$\Rightarrow$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\text{max}_{\rho_{separable}} \langle S_l^{(GHZ_N)} + S_k^{(GHZ_N)} \rangle &amp;lt; 1 \leq \text{max}_{\rho_{entangled}} \langle S_l^{(GHZ_N)} + S_k^{(GHZ_N)} \rangle \Rightarrow \text{valid entanglement witness}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastActivityDate="2021-02-07T11:33:44.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15904" PostTypeId="1" AcceptedAnswerId="15908" CreationDate="2021-02-07T12:56:54.337" Score="3" ViewCount="63" Body="&lt;p&gt;I am new to quantum information and I am trying to work on some problems but I have confused myself over a qubit problem. I have the state of two qubits &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{AB}=a_{00}|00\rangle+a_{01}|01\rangle+a_{10}|10\rangle+a_{11}|11\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_{j,k} |a_{j,k}|^2=1$&lt;/span&gt;. If I am to measure qubit B  in the basis {&lt;span class=&quot;math-container&quot;&gt;$|0\rangle_{B},|1\rangle_{B}$&lt;/span&gt;}, what is the probability of getting &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_B$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I am not familiar with measuring only one of the qubits. From my understating, the entire state will not collapse after the measurement, and only one of the subsystems will collapse. Am I wrong?&lt;/p&gt;&#xA;" OwnerDisplayName="user14766" LastEditorUserId="55" LastEditDate="2021-02-08T23:01:16.490" LastActivityDate="2021-02-08T23:01:16.490" Title="Probability of measuring one qubit from the state of two qubits" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15905" PostTypeId="2" ParentId="8893" CreationDate="2021-02-07T13:27:42.377" Score="0" Body="&lt;p&gt;Notice one thing that the index number of a qubit represents the significance of that bit. So, &lt;span class=&quot;math-container&quot;&gt;$|q_0\rangle$&lt;/span&gt; is always the LSB and &lt;span class=&quot;math-container&quot;&gt;$|q_2\rangle$&lt;/span&gt; will always be your MSB.&#xA;As per your circuit, the output displayed by qiskit is correct. But, I think you were expecting a &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; based on the circuit that qiskit drew:&lt;a href=&quot;https://i.stack.imgur.com/z5cBx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z5cBx.png&quot; alt=&quot;qiskit circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, why qiskit draws the circuit in this way, I've no idea!&#xA;But,from now on, whenever you draw a circuit use the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw(reverse_bits='true')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This time you will get something like this:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pClU9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pClU9.png&quot; alt=&quot;qiskit circuit 2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And, this would remove the confusion.&lt;/p&gt;&#xA;" OwnerUserId="13162" LastActivityDate="2021-02-07T13:27:42.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15906" PostTypeId="2" ParentId="15850" CreationDate="2021-02-07T14:39:17.260" Score="1" Body="&lt;p&gt;I don't think it is particularly meaningful to say that a wavefunction &amp;quot;does not have physical meaning&amp;quot;. It absolutely does: it tells you the probabilities of observing different outcomes in different measurement scenarios.&lt;/p&gt;&#xA;&lt;p&gt;Sure, it's not the (possibly complex) components themselves that are directly related to the outcome probabilities, but so what? Why is that a requirement for something to be physically meaningful? The components &lt;span class=&quot;math-container&quot;&gt;$c_j\in\mathbb C$&lt;/span&gt; of a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; tell you the expectation value associated with an observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; via &lt;span class=&quot;math-container&quot;&gt;$\sum_{ij}\bar c_i c_j A_{ij}$&lt;/span&gt;. That means that &lt;span class=&quot;math-container&quot;&gt;$(c_j)_j$&lt;/span&gt; describe a very much physical reality.&lt;/p&gt;&#xA;&lt;p&gt;Note that it's just straight-up false to say that only the squared moduli have physical meaning. Sure, &lt;span class=&quot;math-container&quot;&gt;$|c_j|^2$&lt;/span&gt; give you the outcome probabilities in the computational basis, but the phase of &lt;span class=&quot;math-container&quot;&gt;$c_j$&lt;/span&gt; is also required for a full description of the state, and gives you information about outcome probabilities in different measurement bases.&lt;/p&gt;&#xA;&lt;p&gt;Now, this said, there might be &amp;quot;non-physical&amp;quot; aspects in a wavefunction, in the sense of parameters which do not directly translate into observable differences. For example, global phases don't matter in a wavefunction. But one can easily redefine the wavefunction to get rid of these redundancies anyway.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-07T14:39:17.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15907" PostTypeId="1" AcceptedAnswerId="15935" CreationDate="2021-02-07T17:20:32.263" Score="5" ViewCount="79" Body="&lt;p&gt;Take the following simple quantum function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def my_quantum_function(params, wires=None):&#xA;&#xA;    for i in range(wires):&#xA;        random_rot = params[i]&#xA;        qml.RY(random_rot, wires=i)&#xA;        &#xA;    qml.broadcast(qml.CZ, wires=range(wires), pattern=&amp;quot;chain&amp;quot;)&#xA;     &#xA;    return qml.expval(qml.PauliZ(0))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let's say I want to make QNode objects using this function for wires=2 and wires=3. My understanding is that I can either leave the function as it is and write,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;params = [np.random.uniform(0, 2*np.pi) for _ in range(wires)]&#xA;&#xA;dev1 = qml.device(&amp;quot;default.qubit&amp;quot;, wires=2)&#xA;circuit1 = qml.QNode(my_quantum_function, dev1)&#xA;result1 = circuit1(params, wires=2)&#xA;&#xA;dev2 = qml.device(&amp;quot;default.qubit&amp;quot;, wires=3)&#xA;circuit2 = qml.QNode(my_quantum_function, dev2)&#xA;result2 = circuit2(params, wires=3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or, I can make two copies of the function and use the QNode decorator:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dev1 = qml.device(&amp;quot;default.qubit&amp;quot;, wires=2)&#xA;dev2 = qml.device(&amp;quot;default.qubit&amp;quot;, wires=2)&#xA;&#xA;@qml.qnode(dev1)&#xA;def circuit1(params):&#xA;&#xA;    wires = 2&#xA;    for i in range(wires):&#xA;        random_rot = params[i]&#xA;        qml.RY(random_rot, wires=i)&#xA;        &#xA;    qml.broadcast(qml.CZ, wires=range(wires), pattern=&amp;quot;chain&amp;quot;)&#xA;     &#xA;    return qml.expval(qml.PauliZ(0))&#xA;&#xA;@qml.qnode(dev2)&#xA;def circuit2(params):&#xA;&#xA;    wires = 3&#xA;    for i in range(wires):&#xA;        random_rot = params[i]&#xA;        qml.RY(random_rot, wires=i)&#xA;        &#xA;    qml.broadcast(qml.CZ, wires=range(wires), pattern=&amp;quot;chain&amp;quot;)&#xA;     &#xA;    return qml.expval(qml.PauliZ(0))&#xA;&#xA;params = [np.random.uniform(0, 2*np.pi) for _ in range(wires)]&#xA;result1 = circuit1(params)&#xA;result2 = circuit2(params)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Fair enough. But let's say I wanted to create QNode objects using this function for wires=2,3,4,...,20. What is the most idiomatic way to do this? I know QNodes collections is a way to define families of QNodes, but this still requires explicitly defining all $N$ devices you need, which doesn't end up saving any time, as it appears. Right now what I'm doing is using the top function I gave and a for-loop, defining a new device/QNode on each iteration:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n_wires = [i+2 for i in range(19)]&#xA;for n in n_wires:&#xA;    params = [np.random.uniform(0, 2*np.pi) for _ in range(n)]&#xA;    dev = qml.device(&amp;quot;default.qubit&amp;quot;, wires=n)&#xA;    circuit = qml.QNode(my_quantum_function, dev)&#xA;    result = circuit(thetas, wires=n)&#xA;    ...&#xA;    # Do some computations&#xA;    ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Using the QNode decorator is the recommended approach, and QNodes can be set to mutable, but I can't find an example in the documentation where you can adjust the number of wires on the fly. Maybe there isn't a more elegant way to do this, but I thought I would ask. Sorry for the long-winded question.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-02-08T22:13:40.133" Title="Pennylane: creating QNodes for large numbers of circuits that only differ by number of wires" Tags="&lt;programming&gt;&lt;quantum-circuit&gt;&lt;pennylane&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15908" PostTypeId="2" ParentId="15904" CreationDate="2021-02-07T17:30:14.180" Score="1" Body="&lt;p&gt;If we have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = a_{00}|00\rangle +a_{01}|01\rangle +a_{10}|10\rangle +a_{11}|11\rangle  $&lt;/span&gt; then the probability of the second qubit being in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is the probability of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; having &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on the second qubit. In this case, it is from the states &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. So The probability of measuring the second qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\bigg| a_{01} \bigg|^2 + \bigg| a_{11} \bigg|^2 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, the probability of the second qubit of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;  being measured in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is then &lt;span class=&quot;math-container&quot;&gt;$\bigg| a_{00} \bigg|^2 + \bigg| a_{10} \bigg|^2 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can work this out explicitly as well. First, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle = a_{00}|00\rangle +a_{01}|01\rangle +a_{10}|10\rangle +a_{11}|11\rangle  = \begin{pmatrix} a_{00} \ \ \\ a_{01} \\ a_{10} \\ a_{11} \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;since we taken &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix} 0 \\ 1\end{pmatrix}$&lt;/span&gt;. The computational basis. And now we are looking for the probability that the second qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and ignore the first qubit, then the measurement &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; can be described as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;M = I \otimes |0\rangle \langle 0 | = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0\end{pmatrix}= \begin{pmatrix}  &#xA;     1   &amp;amp;  0   &amp;amp;  0  &amp;amp;   0\\&#xA;     0  &amp;amp;   0   &amp;amp;  0   &amp;amp;  0\\&#xA;     0   &amp;amp;  0   &amp;amp;  1 &amp;amp;    0\\&#xA;     0    &amp;amp; 0   &amp;amp;  0   &amp;amp;  0&#xA; \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; corresponds to the identity operator, and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle 0|$&lt;/span&gt; corresponds to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Outer_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;outer product operation.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And so according to &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;Born's rule&lt;/a&gt; the probability to measure the second qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \langle \psi | M | \psi \rangle =  \begin{pmatrix} a_{00}^* &amp;amp; a_{01}^* &amp;amp; a_{10}^* &amp;amp; a_{11}^* \end{pmatrix} &#xA;\begin{pmatrix}  &#xA;     1   &amp;amp;  0   &amp;amp;  0  &amp;amp;   0\\&#xA;     0  &amp;amp;   0   &amp;amp;  0   &amp;amp;  0\\&#xA;     0   &amp;amp;  0   &amp;amp;  1 &amp;amp;    0\\&#xA;     0    &amp;amp; 0   &amp;amp;  0   &amp;amp;  0&#xA; \end{pmatrix} \begin{pmatrix} a_{00}  \ \ \\ a_{01}  \\ a_{10}  \\ a_{11}  \end{pmatrix} = |a_{00}|^2 + |a_{10}|^2 &#xA;$$&lt;/span&gt;&#xA;here &lt;span class=&quot;math-container&quot;&gt;$a^*$&lt;/span&gt; indicates the conjugate of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and hence &lt;span class=&quot;math-container&quot;&gt;$a^*a = |a|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now if you want to construct &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; for the second qubit being measured in the state &lt;span class=&quot;math-container&quot;&gt;$1\rangle$&lt;/span&gt; and not measuring the first qubit then you can do construct it as &lt;span class=&quot;math-container&quot;&gt;$M = I \otimes |1\rangle \langle 1|$&lt;/span&gt;. Where &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \langle 1| = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix} = \begin{pmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-07T17:39:00.217" LastActivityDate="2021-02-07T17:39:00.217" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15909" PostTypeId="1" CreationDate="2021-02-07T20:36:52.473" Score="4" ViewCount="56" Body="&lt;p&gt;The QAOA algorithm consists of two elements:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The outer loop, basically a classical optimization algorithm&lt;/li&gt;&#xA;&lt;li&gt;The quantum circuit, taking &lt;span class=&quot;math-container&quot;&gt;$2p$&lt;/span&gt; parameters (where &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is the number of layers, where each layer is a gate representation of the cost and mixer Hamiltonian)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In each iteration of the outer loop, the quantum circuit is sampled with candidate variational parameters which yields a classical bit string (after a measurement, then the bit string's cost is classicaly evaluated and finally the parameters are accordingly updated through some optimization approach.&lt;/p&gt;&#xA;&lt;p&gt;Usually, QAOA is presented as a potential candidate for quantum advantage, esp. for NP-hard problems. &lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are only three ways how an approximation algorithm can improve the state-of-the-art:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It can find better solutions (approximation ratio)&lt;/li&gt;&#xA;&lt;li&gt;It requires less iterations to find acceptable solutions&lt;/li&gt;&#xA;&lt;li&gt;Per iteration, less time is required (or any other important resources, e.g. space, ...)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;ad 1) As far as I know, currently no problem is known for which QAOA performs better than classical algorithms (but of course, such problems can exist)&lt;/p&gt;&#xA;&lt;p&gt;ad 2) I assume that this entirely depends on the optimization algorithm in the outer loop&lt;/p&gt;&#xA;&lt;p&gt;ad 3) The quantum circuit does two things: it computes part of the cost function (in the form of the cost Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;) and stochastically maps the &lt;span class=&quot;math-container&quot;&gt;$2p$&lt;/span&gt; parameters to a bit string (via qubit rotation and measurement). If &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; can be classicaly evaluated in an efficient way (and this should almost always be the case, maybe even always as cost Hamiltonians that are not efficiently computable are probably not constructuable with sums of Pauli tensor products, I guess), I don't see a chance of structural improvement (as the mapping from parameters to a candidate solution bit string is also done efficiently by many classical optimization algorithms)&lt;/p&gt;&#xA;&lt;p&gt;So, QAOA can not be faster per iteration (in terms of time complexity) than a classical algorithm and it can not require less iterations than a classical algorithm. It only may have better approximation ratios for certain problems. &lt;strong&gt;Is my thought process correct?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;PS. Yes, there are papers stating a QAOA advantage once a certain amount of qubits are available, but those compare deterministic solver algorithms (always correct/optimal solutions) with the stochastic approximations algorithm QAOA.&lt;/p&gt;&#xA;" OwnerUserId="14772" LastActivityDate="2021-02-07T20:36:52.473" Title="Properties of QAOA" Tags="&lt;complexity-theory&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15910" PostTypeId="1" CreationDate="2021-02-07T21:22:51.113" Score="2" ViewCount="88" Body="&lt;p&gt;I'm trying to write a code so that if the token exists then it loads the account or else it asks the user for the API token. Below is the code for reference:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;try:&#xA;    IBMQ.load_account()&#xA;except Exception as e:&#xA;    api_key = input(&amp;quot;Enter IBMQ API Key&amp;quot;)&#xA;    IBMQ.save_account(api_key, overwrite=True)&#xA;    IBMQ.load_account()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, even after using the exception handling, still getting below errors:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;RequestsApiError: '401 Client Error: Unauthorized for url: https://auth.quantum-computing.ibm.com/api/users/loginWithToken. Login failed., Error code: 3446.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQAccountCredentialsInvalidToken: 'Invalid IBM Quantum Experience token found: &amp;quot;&amp;quot; of type &amp;lt;class \'str\'&amp;gt;.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Any work around this to resolve this issue?&lt;/p&gt;&#xA;" OwnerUserId="9365" LastEditorUserId="55" LastEditDate="2021-02-08T23:27:19.813" LastActivityDate="2021-03-28T07:04:00.360" Title="API error when trying to access IBM Quantum Computer using IBMQ API Token" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15912" PostTypeId="1" AcceptedAnswerId="15913" CreationDate="2021-02-07T23:02:03.147" Score="4" ViewCount="147" Body="&lt;p&gt;Suppose I have a quantum state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle+\frac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;. Also I have a mixture of two quantum states&#xA;&lt;span class=&quot;math-container&quot;&gt;$S_{1} = |0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_{2} = |1\rangle$&lt;/span&gt;. In this mixture &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; chance of getting &lt;span class=&quot;math-container&quot;&gt;$S_{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt; chance of getting &lt;span class=&quot;math-container&quot;&gt;$S_{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If I give you these two situation one by one, is there anyway you can tell which is what?&lt;/li&gt;&#xA;&lt;li&gt;Also what is the difference between them?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="8746" LastEditDate="2021-02-09T12:19:25.603" LastActivityDate="2021-02-09T12:19:25.603" Title="What is the difference between $|0\rangle+|1\rangle$ and a balanced mixture of $|0\rangle$ and $|1\rangle$?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-02-09T16:39:51.603" ContentLicense="CC BY-SA 4.0" />
  <row Id="15913" PostTypeId="2" ParentId="15912" CreationDate="2021-02-08T00:01:48.923" Score="5" Body="&lt;p&gt;The &lt;em&gt;pure&lt;/em&gt; state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} $&lt;/span&gt; is only in superposition in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$\bigg\{ |0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \bigg\}$&lt;/span&gt;,   but it is &lt;strong&gt;not&lt;/strong&gt; in superposition with respect to another basis. In other words, it is a &lt;strong&gt;definite state&lt;/strong&gt;. To see this, note that if we measured &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$\{ |+\rangle, |-\rangle \} $&lt;/span&gt; basis then the result is not probabilistic, where we defined &lt;span class=&quot;math-container&quot;&gt;$|+\rangle = \dfrac{|0 \rangle + |1\rangle}{\sqrt{2} }$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle = \dfrac{|0 \rangle - |1\rangle}{\sqrt{2} }$&lt;/span&gt;, then we will see that it is in the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; 100% of the time.&lt;/p&gt;&#xA;&lt;p&gt;And also note that if I applied a unitary transformation defined as &lt;span class=&quot;math-container&quot;&gt;$H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix} $&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; then I will get back the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. That is, &lt;span class=&quot;math-container&quot;&gt;$ H |\psi \rangle = |0\rangle $&lt;/span&gt;. Now upon measuring in the regular computational basis,  &lt;span class=&quot;math-container&quot;&gt;$\{ |0\rangle, |1\rangle \}$&lt;/span&gt;, I will see that 100% I will see the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. All pure states are superpositions with respect to some basies and not with respect to others. Because the result of measuring a state in superposition is probabilistic (like the case &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; being measured in the computational basis), it is tempted to think the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = a|0\rangle + b|1\rangle$&lt;/span&gt; as a probabilistic mixture of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; when it is NOT. The state, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, is a &lt;strong&gt;definite state&lt;/strong&gt;, and when we &lt;strong&gt;measured in certain bases&lt;/strong&gt;, we will have &lt;strong&gt;deterministic results&lt;/strong&gt;, while in other bases we will have random results.&lt;/p&gt;&#xA;&lt;p&gt;Now, if I have a mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho = \begin{pmatrix} 1/2 &amp;amp; 0\\ 0 &amp;amp; 1/2 \end{pmatrix}$&lt;/span&gt; like what you described in your second case, then no matter what basis I measure it in, either the computational basis &lt;span class=&quot;math-container&quot;&gt;$\{ |0\rangle, |1\rangle \}$&lt;/span&gt; or  &lt;span class=&quot;math-container&quot;&gt;$\{ |+\rangle, |-\rangle \} $&lt;/span&gt; the result is the same.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-08T08:12:17.777" LastActivityDate="2021-02-08T08:12:17.777" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15914" PostTypeId="2" ParentId="15895" CreationDate="2021-02-08T00:17:10.737" Score="3" Body="&lt;p&gt;As mentioned above, there're 4 types of data that match the requirement. The &lt;code&gt;results&lt;/code&gt; in this case obtained from the job manager is not the same as the results shown in the tutorial since it contains a set of results from different quantum circuits. (I'm still confused why this is not considered as a qiskit result, i.e Form 4 above.)&lt;/p&gt;&#xA;&lt;p&gt;As I tried to print the type, it shows me&lt;code&gt;qiskit.providers.ibmq.managed.managedresults.ManagedResults&lt;/code&gt; . Then I searched more information from &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.ManagedResults.html#qiskit.providers.ibmq.managed.ManagedResults&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. There's a method called &lt;code&gt;combine_results()&lt;/code&gt; that allows us to combine results from all jobs into a single Result, which is the same result in the tutorial's example. So I just did:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;MExperiments = job_manager.run(all_circuits, backend=backend, shots = nshots)&#xA;results = MExperiments.results() &#xA;cresults = results.combine_results()&#xA;mitigated_results = meas_filter.apply(cresults)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-02-08T00:17:10.737" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15915" PostTypeId="1" AcceptedAnswerId="15923" CreationDate="2021-02-08T01:27:17.857" Score="4" ViewCount="38" Body="&lt;p&gt;This is a follow-up question to my &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15914/12334&quot;&gt;earlier post&lt;/a&gt;. I'm trying to filter a set of results obtained from job manager, and the following code works when my circuit list doesn't contain too many elements:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;MExperiments = job_manager.run(all_circuits, backend=backend, shots = nshots)&#xA;results = MExperiments.results() &#xA;cresults = results.combine_results()&#xA;mitigated_results = meas_filter.apply(cresults)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;combine_results()&lt;/code&gt; method is used to help us combine a set of results so that the final single result matches the requirements of &lt;code&gt;apply&lt;/code&gt;. The prerequisite is that all jobs need to succeed. However, when my list &lt;code&gt;all_circuits&lt;/code&gt; gets large, it shows me this error message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;IBMQManagedResultDataNotAvailable: 'Results cannot be combined since some of the jobs failed.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I checked my job status in IBMQ and it shows all the circuits have been successfully executed. How can I fix this issue? Is there a way I can make the job monitor retry the jobs that failed? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-02-08T14:30:13.707" Title="Is there a 'retry' logic in job manager?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15916" PostTypeId="1" AcceptedAnswerId="15917" CreationDate="2021-02-08T06:49:42.720" Score="4" ViewCount="304" Body="&lt;p&gt;I've just started to learn Quantum computing with Qiskit: I'm reading the &lt;a href=&quot;https://qiskit.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; documentation and the book &amp;quot;&lt;a href=&quot;https://www.packtpub.com/product/quantum-computing-in-practice-with-qiskit-and-ibm-quantum-experience/9781838828448&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing in Practice with Qiskit® and IBM Quantum Experience®&lt;/a&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;In this book, on page 79 we can read: &amp;quot;&lt;em&gt;..., as we set up our qubit to start as 0, ...&lt;/em&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Can we set up the start value for a quantum register?&lt;/p&gt;&#xA;&lt;p&gt;Because I think I have read that they have its default value to 0, and we only can set it to one using the NOT gate.&lt;/p&gt;&#xA;&lt;p&gt;I have tried to set it to 0 in Quantum Experience and I haven't found how to do it, and also with Python and I haven't found it.&lt;/p&gt;&#xA;" OwnerUserId="14770" LastActivityDate="2021-02-08T08:21:01.343" Title="What's the default value for a quantum register?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;physical-qubit&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15917" PostTypeId="2" ParentId="15916" CreationDate="2021-02-08T07:17:18.700" Score="3" Body="&lt;p&gt;One of the seven &lt;a href=&quot;https://en.wikipedia.org/wiki/DiVincenzo%27s_criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;DiVincenzo's criteria&lt;/a&gt; is the  ability to initialize the state of the qubits to a simple fiducial state. In most quantum hardware, this is taken to be the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n} = \overbrace{|0\rangle \otimes |0\rangle \otimes \cdots \otimes |0\rangle}^{n \ times} = |0 0 \cdots 0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you create a quantum circuit on IBM hardware and pretty much all other hardware platforms, then the initial state is taken exactly to be this &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n} $&lt;/span&gt; state. For example, a 3 qubit circuit will starts out like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LdhBq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LdhBq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then you can operate on this initial state by applying different quantum gates. For example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ix6pv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ix6pv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that the basis in quantum computing is taken to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} $&lt;/span&gt;. This is known as the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-08T07:17:18.700" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15919" PostTypeId="2" ParentId="15910" CreationDate="2021-02-08T08:09:18.320" Score="0" Body="&lt;p&gt;The way I would do this is slight different:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;&#xA;api_key = None&#xA;for attempt in range(3):                                                # &amp;lt;- (1)&#xA;    try:                                                                # &amp;lt;- (3)&#xA;        if api_key:&#xA;            IBMQ.save_account(api_key, overwrite=True)&#xA;        else:&#xA;            IBMQ.load_account()&#xA;        break                                                           # &amp;lt;- (4)&#xA;    except Exception:&#xA;        api_key = input(&amp;quot;Enter IBMQ API Key (attempt %s): &amp;quot; % attempt)  # &amp;lt;- (2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This 3-time-loop (line &lt;code&gt;(1)&lt;/code&gt;, you can replace it for &lt;code&gt;while True:&lt;/code&gt; if you prefer infinite looping over this) sets a variable &lt;code&gt;api_key&lt;/code&gt; (line &lt;code&gt;(2)&lt;/code&gt;) continuously asking for the key while &lt;em&gt;something&lt;/em&gt; goes wrong (line &lt;code&gt;(3)&lt;/code&gt;). The things that can go wrong are &lt;code&gt;save_account&lt;/code&gt; and &lt;code&gt;load_account&lt;/code&gt;. If nothing goes wrong (line &lt;code&gt;(4)&lt;/code&gt;), then get out of the loop.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-26T06:32:28.563" LastActivityDate="2021-02-26T06:32:28.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15920" PostTypeId="2" ParentId="15916" CreationDate="2021-02-08T08:21:01.343" Score="2" Body="&lt;p&gt;The &lt;em&gt;default&lt;/em&gt; value for a quantum register depends on the hardware. In the case of most of the IBM hardware, that's &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, Qiskit is hardware agnostic and do not assume an initial state. In order to initialize your circuit, you need to use the instruction &lt;code&gt;Initialize&lt;/code&gt;. You can initialize with the values &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; (&lt;code&gt;0&lt;/code&gt;), &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (&lt;code&gt;1&lt;/code&gt;), &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; ( &lt;code&gt;+&lt;/code&gt;), &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; (&lt;code&gt;-&lt;/code&gt;), &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;  (&lt;code&gt;r&lt;/code&gt;), and &lt;span class=&quot;math-container&quot;&gt;$|\mbox{-}i\rangle$&lt;/span&gt; (&lt;code&gt;l&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.extensions.quantum_initializer.initializer import Initialize&#xA;&#xA;circuit = QuantumCircuit(6)&#xA;circuit.append(Initialize(&amp;quot;10+-lr&amp;quot;), range(6))&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────────────────────┐&#xA;q_0: ┤0                         ├&#xA;     │                          │&#xA;q_1: ┤1                         ├&#xA;     │                          │&#xA;q_2: ┤2                         ├&#xA;     │  initialize(1,0,+,-,l,r) │&#xA;q_3: ┤3                         ├&#xA;     │                          │&#xA;q_4: ┤4                         ├&#xA;     │                          │&#xA;q_5: ┤5                         ├&#xA;     └──────────────────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Notice that the instruction &lt;code&gt;Initialize&lt;/code&gt;, when decomposed, starts with a &lt;code&gt;Reset&lt;/code&gt; instruction (&lt;code&gt;|0&amp;gt;&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.decompose().draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;          ┌───┐ ┌───┐ &#xA;q_0: ─|0&amp;gt;─┤ H ├─┤ S ├─&#xA;          ├───┤┌┴───┴┐&#xA;q_1: ─|0&amp;gt;─┤ H ├┤ SDG ├&#xA;          ├───┤└┬───┬┘&#xA;q_2: ─|0&amp;gt;─┤ X ├─┤ H ├─&#xA;          ├───┤ └───┘ &#xA;q_3: ─|0&amp;gt;─┤ H ├───────&#xA;          └───┘       &#xA;q_4: ─|0&amp;gt;─────────────&#xA;          ┌───┐       &#xA;q_5: ─|0&amp;gt;─┤ X ├───────&#xA;          └───┘       &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-08T08:21:01.343" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15921" PostTypeId="1" CreationDate="2021-02-08T08:33:49.950" Score="7" ViewCount="244" Body="&lt;p&gt;Lots of beginners are starting to learn quantum computing. But there are also experienced people that have been working in this field for many years.&lt;/p&gt;&#xA;&lt;p&gt;What are some topics that might be considered important for a beginner to learn thoroughly?&lt;/p&gt;&#xA;&lt;p&gt;By beginner, I mean someone who didn't work in the field, and who does not have a Ph.D. in the field (for example, someone who has just been reading about Quantum Computing for the last 3-4 months).&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="13763" LastEditDate="2021-02-09T01:41:55.093" LastActivityDate="2021-04-16T23:00:57.870" Title="What are tentpole topics in quantum computing?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;interpretations&gt;" AnswerCount="1" CommentCount="11" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15922" PostTypeId="1" CreationDate="2021-02-08T10:37:38.317" Score="2" ViewCount="74" Body="&lt;p&gt;I am having issues solving Simon's problem for a projection function.&lt;/p&gt;&#xA;&lt;p&gt;The function &lt;span class=&quot;math-container&quot;&gt;$f: \{0,1\}^2 \mapsto \{0,1\}$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$f(x_0,x_1) = x_0$&lt;/span&gt; returns the least significant bit of its argument.&lt;/p&gt;&#xA;&lt;p&gt;How can I solve Simon's problem for this function? And write down the corresponding number &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14756" LastEditorUserId="55" LastEditDate="2021-02-10T09:29:38.900" LastActivityDate="2021-02-10T09:29:38.900" Title="How can I solve Simon's problem for the projection function $f(x_0,x_1)=x_0$?" Tags="&lt;simons-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15923" PostTypeId="2" ParentId="15915" CreationDate="2021-02-08T14:30:13.707" Score="2" Body="&lt;p&gt;When you do &lt;code&gt;results = MExperiments.results()&lt;/code&gt;, it should issue a warning message telling you which job result could not be retrieved. The message is only issued for the first &lt;code&gt;.result()&lt;/code&gt; though, since subsequent calls just use cached data. You can do &lt;code&gt;results = MExperiments.results(refresh=True)&lt;/code&gt; to force it to re-fetch results from the server (and hence re-issue warning messages). It is possible that the job completed but fetching of the result failed (e.g. due to networking error). &lt;code&gt;.result(refresh=True)&lt;/code&gt; also serves as a retry mechanism.&lt;/p&gt;&#xA;&lt;p&gt;Another possibility is that the job submit failed. In which case the job won't show up in IBMQ dashboard. You can use &lt;code&gt;print(MExperiments.report())&lt;/code&gt; to see which set of circuits doesn't have a successful job.&lt;/p&gt;&#xA;&lt;p&gt;To answer your last question, job manager today doesn't retry failed jobs (there is an &lt;a href=&quot;https://github.com/Qiskit/qiskit-ibmq-provider/issues/636&quot; rel=&quot;nofollow noreferrer&quot;&gt;issue&lt;/a&gt; open for that though). You can, however, do it manually by&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;use &lt;code&gt;print(MExperiments.report())&lt;/code&gt; to find out which job failed&lt;/li&gt;&#xA;&lt;li&gt;use &lt;code&gt;qobj = job.qobj()&lt;/code&gt; to get the qobj and then re-submit it with &lt;code&gt;new_job = backend.run(qobj)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;combine the results yourself and replace the failed job result with the new job result. The report from step 1 tells you the indexes of the experiments that belong to the failed job. Then you can do &lt;code&gt;result.results[failed_start_index:failed_end_index+1] = new_job.result().results&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12195" LastActivityDate="2021-02-08T14:30:13.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15924" PostTypeId="1" CreationDate="2021-02-08T15:29:40.900" Score="6" ViewCount="33" Body="&lt;p&gt;Similar to &lt;a href=&quot;https://cstheory.stackexchange.com/questions/1215/np-hard-problems-on-trees&quot;&gt;this list&lt;/a&gt; over at &lt;em&gt;cstheory&lt;/em&gt;, I'm looking for a list of computational problems in the query complexity model for which it is known that no super-polynomial quantum speedups exist. What are some &lt;em&gt;natural&lt;/em&gt; problems for which quantum computers are known to have only 'limited' advantage?&lt;/p&gt;&#xA;" OwnerUserId="5710" LastActivityDate="2021-02-09T12:10:23.220" Title="List of problems in the query complexity model with no super-polynomial quantum speedup" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;speedup&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15925" PostTypeId="1" AcceptedAnswerId="15927" CreationDate="2021-02-08T15:48:52.830" Score="1" ViewCount="90" Body="&lt;p&gt;I'm currently going through Lab1 of the &lt;a href=&quot;https://qiskit.org/learn/intro-qc-qh?learnLevel=All%20resources&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Quantum Computing Course&lt;/a&gt;, where one task is to create the Bell State&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(\vert01\rangle + \vert10\rangle\right)$$&lt;/span&gt;&#xA;Technically it should be achived by applying a Hadamard, followed by a CNOT gate on the initial state &lt;span class=&quot;math-container&quot;&gt;$\vert01\rangle$&lt;/span&gt;, if I understand it correctly. My Qiskit implementation is the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sv = Statevector.from_label('01')&#xA;mycircuit = QuantumCircuit(2)&#xA;mycircuit.h(0)&#xA;mycircuit.cx(0,1)&#xA;new_sv = sv.evolve(mycircuit)&#xA;plot_state_qsphere(new_sv.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm only confused about the resulting Q-Sphere image:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ewed3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ewed3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The way I understood the Q-Sphere, this image should correspond to the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\left(\vert11\rangle - \vert00\rangle\right)$$&lt;/span&gt; and not to the requested one. Was my creation of the asked Bell State wrong, or my interpretation of the Q-Sphere? Thanks for any help!&lt;/p&gt;&#xA;" OwnerUserId="9950" LastEditorUserId="55" LastEditDate="2021-02-10T09:30:20.303" LastActivityDate="2021-02-10T09:30:20.303" Title="Q-Sphere representation of Bell States" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15926" PostTypeId="2" ParentId="15925" CreationDate="2021-02-08T16:21:01.507" Score="4" Body="&lt;p&gt;The circuit you shown is to create the state &lt;span class=&quot;math-container&quot;&gt;$ \dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt; have you started from the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = |0\rangle \otimes |0\rangle$&lt;/span&gt;.  Now to get this state to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}} $&lt;/span&gt; you need to apply another &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to any of the two qubits in addition to what you had before. The circuit is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;         ┌───┐          &#xA;q_0:|0&amp;gt;  ┤ H ├──■───────&#xA;         └───┘┌─┴─┐┌───┐&#xA;q_1:|0&amp;gt;  ─────┤ X ├┤ X ├&#xA;              └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to generate this circuit with qiskit you can do it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;&#xA;qreg_q = QuantumRegister(2, 'q')&#xA;creg_c = ClassicalRegister(2, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;circuit.h(qreg_q[0])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.x(qreg_q[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The reason for this is because upon applying the operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to the first qubit and do nothing to the second is the same as applying the operator  &lt;span class=&quot;math-container&quot;&gt;$X \otimes I$&lt;/span&gt; (note I am writing the tensor product in term of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15833/9858&quot;&gt;qiskit's standard where they used little endian&lt;/a&gt;) to the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt;. Explicitly, we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ (X \otimes I)\dfrac{|00\rangle + |11\rangle}{\sqrt{2}} = \dfrac{X|0\rangle \otimes I |0\rangle + X|1\rangle \otimes I|1\rangle}{\sqrt{2}} = \dfrac{|1\rangle \otimes |0\rangle + |0\rangle \otimes |1\rangle }{\sqrt{2} } = \dfrac{|1 0\rangle + |01\rangle }{\sqrt{2} }= \dfrac{|01\rangle + |10 \rangle }{\sqrt{2} }  $$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-08T16:35:39.720" LastActivityDate="2021-02-08T16:35:39.720" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15927" PostTypeId="2" ParentId="15925" CreationDate="2021-02-08T16:28:50.623" Score="4" Body="&lt;p&gt;If you want to create &lt;span class=&quot;math-container&quot;&gt;$\frac{|01\rangle + |01\rangle }{\sqrt{2}} $&lt;/span&gt;, you actually need to start from the state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;, not  &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;. Quickly written, the calculation is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |10\rangle \xrightarrow{I\otimes H} \frac{1}{\sqrt{2}}|1\rangle (|0\rangle + |1\rangle) \xrightarrow{CX} \frac{1}{\sqrt{2}}(|10\rangle + |01\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |01\rangle \xrightarrow{I\otimes H} \frac{1}{\sqrt{2}}|0\rangle (|0\rangle - |1\rangle) \xrightarrow{CX} \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So change this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sv = Statevector.from_label('10')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;should be enough to solve your issue, I tried and it worked! ;)&lt;/p&gt;&#xA;&lt;p&gt;I hope this is clear enough, please tell me if not :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-02-08T16:28:50.623" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15928" PostTypeId="2" ParentId="13528" CreationDate="2021-02-08T17:06:06.403" Score="0" Body="&lt;p&gt;Exchanging the two qubits swaps the basis states &lt;span class=&quot;math-container&quot;&gt;$|01\rangle \leftrightarrow |10\rangle$&lt;/span&gt;, but keeps &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; unchanged. Suppose you have a gate whose action on the computational basis is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle \to a|00\rangle \\&#xA;|01\rangle \to b|01\rangle \\&#xA;|10\rangle \to c|10\rangle \\&#xA;|11\rangle \to d|11\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you swap the inputs you obtain the gate whose action on the computational basis is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00\rangle \to a|00\rangle \\&#xA;|01\rangle \to \color{red}{c}|01\rangle \\&#xA;|10\rangle \to \color{red}{b}|10\rangle \\&#xA;|11\rangle \to d|11\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, all such gates are unchanged under exchange of qubits if and only if &lt;span class=&quot;math-container&quot;&gt;$b=c$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is just such a gate with &lt;span class=&quot;math-container&quot;&gt;$a=b=c=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d=-1$&lt;/span&gt;. In fact, all controlled rotations around the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis such as the controlled-&lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate have  &lt;span class=&quot;math-container&quot;&gt;$b=c=1$&lt;/span&gt; and are therefore symmetric under qubit exchange and so we do not generally label their inputs as control and target.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-08T18:12:42.363" LastActivityDate="2021-02-08T18:12:42.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15929" PostTypeId="1" AcceptedAnswerId="15931" CreationDate="2021-02-08T18:51:55.030" Score="7" ViewCount="131" Body="&lt;p&gt;In the paper &lt;a href=&quot;https://arxiv.org/abs/1602.07674&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Supremacy through the Quantum Approximate Optimization Algorithm&lt;/a&gt; the authors claim (last sentence of page 15):&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;If [...] the QAOA outperforms all known classical algorithms then it will achieve Quantum Supremacy in an algorithmic sense.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;To support this, they prove that any classical (stochastic) algorithm that produces a similar (up to a small multiplicative error) output distribution as QAOA, cannot do this in poly-time (or in other words: sampling from the QAOA distribution cannot be done efficiently on classical computer).&lt;/p&gt;&#xA;&lt;p&gt;Can someone explain how this point supports their supremacy claim?&lt;/p&gt;&#xA;&lt;p&gt;I mean, according to their proof it is still possible that a (potentially not yet known) classical algorithm can have a completely different output distribution that however might have even a much higher probability for the correct answer.&lt;/p&gt;&#xA;&lt;p&gt;Of course, this also depends on the definition of quantum supremacy but for me quantum supremacy would mean that no classical algorithm can exist &lt;strong&gt;at all&lt;/strong&gt; that solves the problem in a better way than a quantum algorithm. So, is this just a different understanding of the supremacy term in the sense that they mean that supremacy is reached once all &lt;strong&gt;known&lt;/strong&gt; classical algorithms are beaten?&lt;/p&gt;&#xA;" OwnerUserId="14772" LastEditorUserId="55" LastEditDate="2021-02-10T09:38:55.410" LastActivityDate="2021-02-14T16:32:03.447" Title="Why does QAOA achieve quantum supremacy in an algorithmic sense?" Tags="&lt;complexity-theory&gt;&lt;qaoa&gt;&lt;quantum-advantage&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15930" PostTypeId="1" AcceptedAnswerId="15933" CreationDate="2021-02-08T19:50:58.767" Score="5" ViewCount="378" Body="&lt;p&gt;With density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_{a,b=0}^1\rho_{a,b}|a\rangle\langle b|$&lt;/span&gt; and it's transpose &lt;span class=&quot;math-container&quot;&gt;$\rho^T=\sum_{a,b=0}^1\rho_{a,b}|b\rangle\langle a|$&lt;/span&gt;. How to confirm  that &lt;span class=&quot;math-container&quot;&gt;$\rho^T$&lt;/span&gt; is positive and trace preserving.&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-02-09T11:50:09.710" LastActivityDate="2021-02-09T12:00:41.767" Title="Why is the transpose of a density matrix positive and trace preserving?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15931" PostTypeId="2" ParentId="15929" CreationDate="2021-02-08T19:57:20.640" Score="7" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;but for me quantum supremacy would mean that no classical algorithm can exist at all that solves the problem in a better way than a quantum algorithm.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If that were the case, then &amp;quot;quantum supremacy&amp;quot; would almost not exist at all.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Even Shor's algorithm for factoring numbers in polynomial time would not be considered &amp;quot;superior&amp;quot; to what classical computation can do because it is still unknown whether or not classical computers can factor numbers in polynomial time&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But the word &amp;quot;quantum supremacy&amp;quot; should be avoided for exactly the confusion you're undergoing here. It's better to be specific about what you mean. Instead of using a &lt;a href=&quot;https://en.wikipedia.org/wiki/Buzzword&quot; rel=&quot;noreferrer&quot;&gt;buzz word&lt;/a&gt; like &amp;quot;quantum supremacy&amp;quot;, you can just say &amp;quot;no &lt;em&gt;known&lt;/em&gt; classical algorithm can do this calculation as efficiently&amp;quot;. Or in the case of the Deutsch problem, where a perfect quantum computer needs to evaluate the blackbox function only once, and a classical computer would need to evalue it twice, then you can say &amp;quot;the quantum computer can solve the problem with a small number of evaluations of the blackbox which is impossible to match by a classical computer.&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-02-08T19:57:20.640" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15932" PostTypeId="2" ParentId="15930" CreationDate="2021-02-08T20:05:14.320" Score="7" Body="&lt;h3&gt;Trace preservation&lt;/h3&gt;&#xA;&lt;p&gt;The trace must be preserved in the transpose of a matrix, because the trace is the sum of the diagonal elements. When transposing a matrix, you do not change the diagonals at all! Only the off-diagonals change when you transpose a matrix.&lt;/p&gt;&#xA;&lt;h3&gt;&amp;quot;Positive&amp;quot; preservation&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nonnegative_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;A positive matrix is a matrix in which all the elements are strictly greater than zero.&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Neither the density matrix not its transpose has to be positive in general, but if you're talking about &lt;a href=&quot;https://en.wikipedia.org/wiki/Completely_positive_map&quot; rel=&quot;nofollow noreferrer&quot;&gt;positive maps&lt;/a&gt; which are transformations that send positive elements to positive elements, then again if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is positive, then &lt;span class=&quot;math-container&quot;&gt;$\rho^T$&lt;/span&gt; must be too, because &lt;strong&gt;transposing does nothing to the sign of the elements&lt;/strong&gt; it only rearranges them.&lt;/li&gt;&#xA;&lt;li&gt;Alternatively, if you're using the word &amp;quot;positive&amp;quot; as a synonym for &amp;quot;positive-semi-definite&amp;quot; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15930/why-is-the-transpose-of-a-density-matrix-positive-and-trace-preserving/15932?noredirect=1#&quot;&gt;as Adam Zalcman pointed out some people do&lt;/a&gt; then I would recommend not to do that in the future, because you can just write &amp;quot;positive semi-definite&amp;quot; and no one will get confused about what you mean. If this is what you mean by &amp;quot;positive&amp;quot;, then you mean that the eigenvalues of the matrix are all more than or equal to zero. Since the transpose operation does not change the eigenvalues, it will also preserve positive semi-definiteness.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-02-08T22:53:52.887" LastActivityDate="2021-02-08T22:53:52.887" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="15933" PostTypeId="2" ParentId="15930" CreationDate="2021-02-08T20:14:22.267" Score="8" Body="&lt;p&gt;Transposing a matrix is trace preserving since for &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_{a,b} \rho_{a,b} | a \rangle \langle b |$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(\rho)= \sum_c \langle c| \big( \sum_{a,b} \rho_{a,b} | a \rangle \langle b |  \big) | c \rangle = \sum_{a,b,c} \rho_{a,b} \delta_{a,c} \delta_{b,c} = \sum_c \rho_{c,c}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(\rho^T)= \sum_c \langle c| \big( \sum_{a,b} \rho_{a,b} | b \rangle \langle a |  \big) | c \rangle = \sum_{a,b,c} \rho_{a,b} \delta_{b,c} \delta_{a,c} = \sum_c \rho_{c,c}$$&lt;/span&gt;&#xA;Therefore:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}(\rho^T) = \text{Tr}(\rho)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For positivity, assuming &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is nonnegative, which it should be since it is a density matrix, we know that for all &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle \psi| \rho |\psi \rangle \geq 0 \rightarrow \big( \langle \psi| \rho |\psi \rangle \big)^T \geq 0 \rightarrow \langle \psi| \rho^T |\psi \rangle \geq 0 \rightarrow \rho^T$&lt;/span&gt; must be nonnegative.&lt;/p&gt;&#xA;" OwnerUserId="14513" LastEditorUserId="14513" LastEditDate="2021-02-08T20:22:50.167" LastActivityDate="2021-02-08T20:22:50.167" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="15934" PostTypeId="1" CreationDate="2021-02-08T21:52:07.797" Score="4" ViewCount="52" Body="&lt;p&gt;Reading Nielsen and Chuang, I am under the impression that a linear operator on the tensor product can be written in two ways:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;(\left|a\right&amp;gt; \otimes \left|b\right&amp;gt;)(\left&amp;lt;c\right| \otimes \left&amp;lt;d\right|) = \left|a\right&amp;gt;\left&amp;lt;c\right| \otimes \left|b\right&amp;gt;\left&amp;lt;d\right|&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As if I take a vector &lt;span class=&quot;math-container&quot;&gt;$\left|e\right&amp;gt; \otimes \left|f\right&amp;gt;$&lt;/span&gt; from a tensor product and apply the operator, I get in the first case:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(\left|a\right&amp;gt; \otimes \left|b\right&amp;gt;)(\left&amp;lt;c\right| \otimes \left&amp;lt;d\right|) (\left|e\right&amp;gt; \otimes \left|f\right&amp;gt;) =&amp;amp; (\left|a\right&amp;gt; \otimes \left|b\right&amp;gt;) \left&amp;lt;c|e\right&amp;gt; \left&amp;lt;d|f\right&amp;gt;\\&#xA;=&amp;amp; \left&amp;lt;c|e\right&amp;gt; \left&amp;lt;d|f\right&amp;gt; \left|a\right&amp;gt; \otimes \left|b\right&amp;gt;&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And, in the second case,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(\left|a\right&amp;gt;\left&amp;lt;c\right| \otimes \left|b\right&amp;gt;\left&amp;lt;d\right|) (\left|e\right&amp;gt; \otimes \left|f\right&amp;gt;) =&amp;amp; \left|a\right&amp;gt;\left&amp;lt;c|e\right&amp;gt; \otimes \left|b\right&amp;gt;\left&amp;lt;d|f\right&amp;gt; \\&#xA;=&amp;amp; \left&amp;lt;c|e\right&amp;gt; \left&amp;lt;d|f\right&amp;gt; \left|a\right&amp;gt; \otimes \left|b\right&amp;gt;&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the first case, I consider an operator on the tensor product, and in the second case, a tensor product of operators. Are the two equivalent ? All state vectors considered are arbitrary.&lt;/p&gt;&#xA;" OwnerUserId="14414" LastEditorUserId="55" LastEditDate="2021-02-08T23:23:25.220" LastActivityDate="2021-02-08T23:28:58.320" Title="Are the two ways of interpreting the expression $(|a\rangle\otimes|b\rangle)(\langle c|\otimes\langle d|)(|e\rangle\otimes |f\rangle)$ equivalent?" Tags="&lt;mathematics&gt;&lt;tensor-product&gt;&lt;notation&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15935" PostTypeId="2" ParentId="15907" CreationDate="2021-02-08T22:13:40.133" Score="3" Body="&lt;p&gt;I received a great answer to my question &lt;a href=&quot;https://discuss.pennylane.ai/t/creating-qnodes-for-large-numbers-of-circuits-that-only-differ-by-number-of-wires/831?u=ryanhill1&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, through the Xanadu Discussion Forum:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I’d say that your approach of having a quantum function that depends&#xA;on the number of wires, creating separate QNodes and devices is a good&#xA;one. PennyLane doesn’t have any further conveniences for such a use&#xA;case, other than creating a &lt;code&gt;QNodeCollection&lt;/code&gt; which you’ve mentioned.&lt;/p&gt;&#xA;&lt;p&gt;When considering the exact use case, each of these quantum functions&#xA;would actually be equivalent to running a quantum circuit of size &lt;span class=&quot;math-container&quot;&gt;$N=2..20$&lt;/span&gt;&#xA;on a quantum device that is capable of simulating exactly &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;The implied alternative to this would have to involve creating a&#xA;single quantum device with 20 qubits, running the quantum circuits one&#xA;by one on that device and resetting the device in between circuit runs&#xA;(can be achieved by calling &lt;code&gt;dev.reset()&lt;/code&gt;). Both for simulators and&#xA;for hardware devices it can be costly to have unused ancillae&#xA;subsystems. One simulator that could be interesting is &lt;a href=&quot;https://pennylane-forest.readthedocs.io/en/latest/devices/wavefunction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;The&#xA;Wavefunction device&lt;/a&gt; from the PennyLane-Forest plugin, which only&#xA;keeps track of the active subsystems in memory.&lt;/p&gt;&#xA;&lt;p&gt;It could be interesting to see in which cases a tradeoff could be made&#xA;between the two approaches.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Credit to &lt;a href=&quot;https://discuss.pennylane.ai/u/antalszava/summary&quot; rel=&quot;nofollow noreferrer&quot;&gt;@antalszava&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-02-08T22:13:40.133" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15936" PostTypeId="2" ParentId="15934" CreationDate="2021-02-08T23:21:30.340" Score="2" Body="&lt;p&gt;Yes they are equivalent, as you correctly computed. You are essentially just observing that&#xA;&lt;span class=&quot;math-container&quot;&gt;$|a\rangle\!\langle c|d\rangle$&lt;/span&gt;&#xA;can be understood either as an inner product (&lt;span class=&quot;math-container&quot;&gt;$\langle c|d\rangle$&lt;/span&gt;) multiplied scalarly with a vector (&lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt;), or as an outer product (&lt;span class=&quot;math-container&quot;&gt;$|a\rangle\!\langle c|$&lt;/span&gt;) applied to a vector (&lt;span class=&quot;math-container&quot;&gt;$|d\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;A more formal way to observe that this is not completely trivial might be using a more standard algebraic notation. Let &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; be a Hilbert space, and &lt;span class=&quot;math-container&quot;&gt;$u,v,w\in V$&lt;/span&gt; arbitrary vectors. Denote with &lt;span class=&quot;math-container&quot;&gt;$v^*\in V^*$&lt;/span&gt; elements of the dual of &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; (&lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$v^*:V\to\mathbb C$&lt;/span&gt; is the linear functional such that &lt;span class=&quot;math-container&quot;&gt;$v^*(v)=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v^*(v_\perp)=0$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\langle v,v_\perp\rangle=0$&lt;/span&gt;).&#xA;Denote with &lt;span class=&quot;math-container&quot;&gt;$uv^*$&lt;/span&gt; the &lt;em&gt;outer product&lt;/em&gt; between &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;. You can understand this as the linear operator &lt;span class=&quot;math-container&quot;&gt;$(uv^*): V\ni x\mapsto u \langle v,x\rangle \in V$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then the observation is that (I'll be pedantic with the parentheses to clarify the order of operations):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(uv^*)(w) = u \cdot (v^*(w)).$$&lt;/span&gt;&#xA;Note that in the RHS &lt;span class=&quot;math-container&quot;&gt;$v^*(w)\in\mathbb C$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; denotes a scalar product in &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, whereas in the LHS we have the operator &lt;span class=&quot;math-container&quot;&gt;$(uv^*)$&lt;/span&gt; acting on its input &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-08T23:21:30.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15937" PostTypeId="2" ParentId="15934" CreationDate="2021-02-08T23:28:58.320" Score="3" Body="&lt;p&gt;Indeed, they are equivalent.  The relation you start with is a special case of the following identity:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;(A \otimes B)(C \otimes D) = (AC) \otimes (BD)&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A,B,C,D$&lt;/span&gt; are all operators in some Hilbert space with a tensor product structure &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \mathcal{H}_1\otimes\mathcal{H}_2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$A,C$&lt;/span&gt; are operators that belong to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$B,D$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2$&lt;/span&gt;.  Operators that act on different Hilbert spaces commute, i.e. &lt;span class=&quot;math-container&quot;&gt;$[M_1 \otimes I, I \otimes M_2]=0$&lt;/span&gt;, because anything you do to objects in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; cannot affect &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2$&lt;/span&gt; and vice versa.  This is why you are allowed to &amp;quot;pass&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; to the left, through &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and combine the operators in &amp;quot;like&amp;quot; Hilbert spaces.&lt;/p&gt;&#xA;&lt;p&gt;In the example you provided, the operators take the form of projectors onto 1-dimensional subspaces with these Hilbert spaces, i.e. kets and bras.  Kets are column vectors which operate on row vectors, and bras are row vectors which operate on column vectors.  In both cases, the output space is the complex numbers.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-02-08T23:28:58.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15938" PostTypeId="2" ParentId="15921" CreationDate="2021-02-09T00:25:15.057" Score="7" Body="&lt;p&gt;&lt;strong&gt;Made Community Wiki&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Much as there's no royal road to geometry, getting familiar with quantum computing usually takes a lot of hard work.  I would consider anyone who can answer Bertrand's questions in the comments to be pretty knowledgeable, at least having completed the first parts of a good semester of an advanced undergraduate/graduate course or have otherwise engaged in many many hours of self-study.&lt;/p&gt;&#xA;&lt;p&gt;But there are many good lecture series on-line.  YMMV.&lt;/p&gt;&#xA;&lt;p&gt;Nonetheless knowledge of some topics that may be at least important to have a cocktail-level conversation of quantum computing might start off and include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Qubits, two state quantum systems&lt;/li&gt;&#xA;&lt;li&gt;The representation of a qubit on the complex plane&lt;/li&gt;&#xA;&lt;li&gt;Superposition and the difference between a qubit and a bit&lt;/li&gt;&#xA;&lt;li&gt;The Born rule of measurement and post-measurement states, with side topics about interpretations such as Copenhagen and Many-Worlds&lt;/li&gt;&#xA;&lt;li&gt;The difference between the computational basis and the Hadamard basis&lt;/li&gt;&#xA;&lt;li&gt;The no-cloning theorem&lt;/li&gt;&#xA;&lt;li&gt;The Bloch sphere and the representation of a qubit in three dimensions&lt;/li&gt;&#xA;&lt;li&gt;Neat applications like the Elitzur-Vaidman bomb tester&lt;/li&gt;&#xA;&lt;li&gt;Other applications of qubits in product states, such as quantum money (Wiesner's scheme) and/or quantum cryptography (the BB84 scheme)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Moving on:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Entanglement and the EPR paper&lt;/li&gt;&#xA;&lt;li&gt;The Bell inequality and/or the CHSH game and/or the Mermin-Peres magic square&lt;/li&gt;&#xA;&lt;li&gt;Neat applications like teleportation and superdense coding&lt;/li&gt;&#xA;&lt;li&gt;Other applications of Bell pairs like the E91 quantum cryptography scheme&lt;/li&gt;&#xA;&lt;li&gt;Perhaps the GHZ state and/or the W state&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Further on to quantum algorithms you have the greatest hits like:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Brenstein-Vazirani algorithm&lt;/li&gt;&#xA;&lt;li&gt;The Deutsch-Jozsa algorithm&lt;/li&gt;&#xA;&lt;li&gt;The BQP complexity class&lt;/li&gt;&#xA;&lt;li&gt;Simon's algorithm&lt;/li&gt;&#xA;&lt;li&gt;Hamiltonian simulation&lt;/li&gt;&#xA;&lt;li&gt;Quantum error correction&lt;/li&gt;&#xA;&lt;li&gt;The crown jewels of Shor's algorithm/Grover's algorithm&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;etc.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2293" LastEditDate="2021-04-16T23:00:57.870" LastActivityDate="2021-04-16T23:00:57.870" CommentCount="1" CommunityOwnedDate="2021-02-09T00:25:15.057" ContentLicense="CC BY-SA 4.0" />
  <row Id="15939" PostTypeId="1" AcceptedAnswerId="15940" CreationDate="2021-02-09T05:28:08.043" Score="1" ViewCount="44" Body="&lt;p&gt;I am currently trying to implement a multi-controlled Toffoli/multi-controlled X gate in Braket, but I am confused as to the general concept of cascaded X gates and other implementations. I've read Barenco, Shors, et al's work &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9503016&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Elementary Gates for Quantum Computation&amp;quot;&lt;/a&gt;, which touches on this, but it's not really illuminating the concept for me. I am partial to the V-gate method used in Barenco, as no ancillary qubits are required, but I'm open to the cascaded-X method as well. Any additional sources or ideas would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14019" LastEditorUserId="1859" LastEditDate="2021-02-09T06:06:57.433" LastActivityDate="2021-02-09T06:06:57.433" Title="Multiply-Controlled X Gate/MCT Gate Implementation" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15940" PostTypeId="2" ParentId="15939" CreationDate="2021-02-09T05:46:54.070" Score="2" Body="&lt;p&gt;Section 4.3 &amp;quot;Controlled Operations&amp;quot; from &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computation and Quantum Information&lt;/a&gt; (linked to pdf version of the text) by Mike and Ike may provide some good additional details.&lt;/p&gt;&#xA;&lt;p&gt;In particular, page 183 and 184 goes into details on how to implement a general implementation of &lt;span class=&quot;math-container&quot;&gt;$C^nX$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$C^nU$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-09T05:46:54.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15941" PostTypeId="2" ParentId="15896" CreationDate="2021-02-09T07:36:44.350" Score="0" Body="&lt;p&gt;In the paper they mention that a thick bar drawn on the left of a gate is their notation for its inverse. So in the second circuit they have drawn the inverse of &lt;span class=&quot;math-container&quot;&gt;$\phi ADD(a)$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\phi ADD(-a)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$QFT^{-1}$&lt;/span&gt; is there to un-Fourier transform the result, not to actually perform the substraction.&lt;/p&gt;&#xA;" OwnerUserId="4223" LastActivityDate="2021-02-09T07:36:44.350" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15942" PostTypeId="1" AcceptedAnswerId="15946" CreationDate="2021-02-09T11:20:00.123" Score="1" ViewCount="157" Body="&lt;p&gt;Very quick question, I am trying to implement SAT solving in Q# using Grover's Algorithm. I want to take every second element from an array starting at the second element, represented with a range element : &lt;code&gt;1..2..Length(array)&lt;/code&gt;. I am not very experienced and I am trying to find a nice and clean way to do so, without too much unnecessary for loop. Could someone help ?&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="55" LastEditDate="2021-02-10T09:39:13.997" LastActivityDate="2021-02-10T09:39:13.997" Title="Take every second element of the array in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15943" PostTypeId="2" ParentId="15930" CreationDate="2021-02-09T12:00:41.767" Score="3" Body="&lt;p&gt;Given an arbitrary matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, its trace equals the sum of its diagonal elements. Because the transpose leaves the diagonal elements invariant, we must have &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(A)=\operatorname{Tr}(A^T)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The trace can also be seen to equal the sum of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, counted with their multiplicities. But again, the transposition doesn't affect the eigenvalues of a matrix, as seen &lt;em&gt;e.g.&lt;/em&gt; from the fact that &lt;span class=&quot;math-container&quot;&gt;$\det(A-\lambda I)=\det(A^T-\lambda I)$&lt;/span&gt;. Therefore any property of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; which depends on the eigenvalues is unaffected by transposition.&lt;/p&gt;&#xA;&lt;p&gt;In particular, a normal matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is positive semi-definite, &lt;span class=&quot;math-container&quot;&gt;$H\ge0$&lt;/span&gt;, &lt;em&gt;&lt;strong&gt;iff&lt;/strong&gt;&lt;/em&gt; its eigenvalues are all real positive numbers. Because &lt;span class=&quot;math-container&quot;&gt;$H^T$&lt;/span&gt; will have the same eigenvalues, we have &lt;span class=&quot;math-container&quot;&gt;$H^T\ge0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-09T12:00:41.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15944" PostTypeId="2" ParentId="15924" CreationDate="2021-02-09T12:10:23.220" Score="2" Body="&lt;p&gt;&lt;em&gt;Disclaimer: I am not sure if this is your are looking for, so I do not pretend this to be an answer.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;As far as I know, one example is calculation of a binary function parity. Binary function has odd parity in case it returns one for odd number of inputs. In other case it has even parity. In this task, a quantum computer is as fast as classical computer.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-09T12:10:23.220" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15945" PostTypeId="1" AcceptedAnswerId="15947" CreationDate="2021-02-09T14:17:58.350" Score="3" ViewCount="132" Body="&lt;p&gt;I want to turn a state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_1⟩ = \frac{1}{\sqrt{8}}(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩+|101⟩+|110⟩+|111⟩)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;into&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_2⟩ = \frac{1}{\sqrt{8}}(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩-|101⟩-|110⟩+|111⟩)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;using a phase oracle before applying Grover's amplification.&lt;/p&gt;&#xA;&lt;p&gt;One example from &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit's official page for Grover's Algorithm&lt;/a&gt; does this by manually building a circuit with Controlled-Z gates, but &lt;a href=&quot;https://qiskit.org/documentation/tutorials/algorithms/07_grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;another Qiskit document&lt;/a&gt; simply uses a class &lt;em&gt;Statevector.from_label&lt;/em&gt; to mark the target state &lt;span class=&quot;math-container&quot;&gt;$|11⟩$&lt;/span&gt; without constructing a circuit, which I assume can only assign single state.&lt;/p&gt;&#xA;&lt;p&gt;Having the desired states in a form of Python list, i.e. &lt;code&gt;[101, 110]&lt;/code&gt;, can I directly convert this into a phase oracle that does the intended job in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="4204" LastEditorUserId="55" LastEditDate="2021-02-10T09:39:22.633" LastActivityDate="2021-03-28T20:17:38.410" Title="Implementing Grover's oracle with multiple solutions in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15946" PostTypeId="2" ParentId="15942" CreationDate="2021-02-09T15:14:28.263" Score="5" Body="&lt;p&gt;You can create an array with every second element starting from the second one using the expression &lt;code&gt;array[1..2...]&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13836" LastActivityDate="2021-02-09T15:14:28.263" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15947" PostTypeId="2" ParentId="15945" CreationDate="2021-02-09T16:26:30.840" Score="6" Body="&lt;p&gt;There are different ways to achieve that, my favorite is probably this one: The oracle you describe above is just a classical function (&amp;quot;True if my bitstring is 101 or 110&amp;quot;) converted to a quantum phase flip. So essentially you only have to build a circuit that implements that classical logic plus some gates to do the phase flip.&lt;/p&gt;&#xA;&lt;h2&gt;Option A: Via classical logic&lt;/h2&gt;&#xA;&lt;p&gt;Step 1: Create the classical logic circuit in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import classical_function, Int1&#xA;&#xA;# define a classical function that can be turned into a circuit&#xA;@classical_function&#xA;def oracle(x1: Int1, x2: Int1, x3: Int1) -&amp;gt; Int1:&#xA;    return (x1 and not x2 and x3) or (x1 and x2 and not x3)&#xA;&#xA;bitcircuit = oracle.synth()  # turn it into a circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you have something looking like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ──■────■──&#xA;       │    │&#xA;q_1: ──■────┼──&#xA;       │    │&#xA;q_2: ──┼────■──&#xA;     ┌─┴─┐┌─┴─┐&#xA;q_3: ┤ X ├┤ X ├&#xA;     └───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It flips the output bit (the one at the bottom) if the qubits are in state &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Step 2: To change this into a phaseflip oracle you can sandwich the bottom qubit in between X and H gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;&#xA;phaseoracle = QuantumCircuit(4)&#xA;phaseoracle.x(3)&#xA;phaseoracle.h(3)&#xA;phaseoracle.compose(bitoracle, inplace=True)&#xA;phaseoracle.h(3)&#xA;phaseoracle.x(3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;to get this circuit, which implements your oracle:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q_0: ────────────■────■────────────&#xA;                 │    │&#xA;q_1: ────────────■────┼────────────&#xA;                 │    │&#xA;q_2: ────────────┼────■────────────&#xA;     ┌───┐┌───┐┌─┴─┐┌─┴─┐┌───┐┌───┐&#xA;q_3: ┤ X ├┤ H ├┤ X ├┤ X ├┤ H ├┤ X ├&#xA;     └───┘└───┘└───┘└───┘└───┘└───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So all together:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import classical_function, Int1, QuantumCircuit&#xA;&#xA;# define a classical function that can be turned into a circuit&#xA;@classical_function&#xA;def oracle(x1: Int1, x2: Int1, x3: Int1) -&amp;gt; Int1:&#xA;    return (x1 and not x2 and x3) or (x1 and x2 and not x3)&#xA;&#xA;bitcircuit = oracle.synth()  # turn it into a circuit&#xA;&#xA;&#xA;phaseoracle = QuantumCircuit(4)&#xA;phaseoracle.x(3)&#xA;phaseoracle.h(3)&#xA;phaseoracle.compose(bitoracle, inplace=True)&#xA;phaseoracle.h(3)&#xA;phaseoracle.x(3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2&gt;Option B: Via looking hard&lt;/h2&gt;&#xA;&lt;p&gt;You could see that the oracle is implemented by two controlled Z gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;&#xA;phaseoracle = QuantumCircuit(3)&#xA;phaseoracle.cz(0, 2)&#xA;phaseoracle.cz(0, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="9800" LastEditDate="2021-02-09T16:31:41.467" LastActivityDate="2021-02-09T16:31:41.467" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="15948" PostTypeId="1" AcceptedAnswerId="15951" CreationDate="2021-02-09T17:13:08.353" Score="4" ViewCount="108" Body="&lt;p&gt;In a much cited paper by Lloyd et al &lt;a href=&quot;https://arxiv.org/abs/1307.0411&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithm for Supervised and Unsupervised Machine Learning&lt;/a&gt;, they proposed a rather cute quantum algorithm to evaluate the distance between an input feature vector &lt;span class=&quot;math-container&quot;&gt;$\vec{u}$&lt;/span&gt; and the centroid of a set of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; training vectors &lt;span class=&quot;math-container&quot;&gt;$\{\vec{v}_{j}\}$&lt;/span&gt;, i.e. an average &lt;span class=&quot;math-container&quot;&gt;$(1/M)\sum_{j=1}^{M}\vec{v}_{j}$&lt;/span&gt;. On page 3 of this paper, after they have constructed state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; for &amp;quot;system and ancilla&amp;quot;, they proceeded to &amp;quot;... use a swap test to perform a projective measurement on the ancilla alone to see if it is in the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; ...&amp;quot;. I have three closely related questions.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Which part of state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is due to the ancilla? If state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; there represents part of the ancilla, it seems this ancilla state in &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is not a single qubit, as it must have the same length as &lt;span class=&quot;math-container&quot;&gt;$|j\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What states are involved in this the swap test? My wild guess is state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and the projection &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\psi\rangle$&lt;/span&gt; is a state whose norm is the desired distance.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;How is this swap test performed in this setting? I guess an extra single qubit is needed to be the ancilla.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Your wisdom will be highly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="13563" LastEditorUserId="13563" LastEditDate="2021-02-09T17:33:07.650" LastActivityDate="2021-02-10T00:56:20.933" Title="SWAP Test as a Projective Measurement" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ClosedDate="2021-02-11T16:00:24.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="15949" PostTypeId="2" ParentId="1419" CreationDate="2021-02-09T19:10:10.777" Score="0" Body="&lt;p&gt;It only needs to have information about the correct answer, and for that answer, all it needs to know is that the answer is correct.&lt;/p&gt;&#xA;&lt;p&gt;For all of the other answers, it needs no information.&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2021-02-09T19:10:10.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15950" PostTypeId="2" ParentId="2149" CreationDate="2021-02-09T19:19:34.353" Score="0" Body="&lt;p&gt;Let me try to answer your question with a simple, direct answer:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Q: Don't we need to input what we are looking for and where to find what we are looking for to Oracle, in addition to the superpositioned quantum states?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;No, you only need to have an oracle that outputs a 1 when it is provided with the correct answer and a 0 when provided with an incorrect answer.&lt;/p&gt;&#xA;&lt;p&gt;If you have a list that has the input names &lt;code&gt;{&amp;quot;Alice&amp;quot;, &amp;quot;Bob&amp;quot;, &amp;quot;Corey&amp;quot;, &amp;quot;Dio&amp;quot;}&lt;/code&gt; and you want to recognize the if the word &lt;code&gt;Dio&lt;/code&gt; is on the list, then you need a way to encode the list's contents as input for the oracle. So the question is not what is on this list, the question is how many different inputs do you want to be able to encode? What is the total vocabulary?&lt;/p&gt;&#xA;&lt;p&gt;If there are 4 possible names (Alice, Bob, Corey and Dio), and you want to be able to encode any list with 4 of these names, then your input is four elements of two bits each: &lt;code&gt;abcdefgh&lt;/code&gt; and the encoding is &lt;code&gt;Alice=00&lt;/code&gt;, &lt;code&gt;Bob=01&lt;/code&gt;, &lt;code&gt;Corey=10&lt;/code&gt; and &lt;code&gt;Dio=11&lt;/code&gt;. You then would have an oracle that returns &lt;code&gt;1&lt;/code&gt; if &lt;code&gt;ab=11&lt;/code&gt;, &lt;code&gt;cd=11&lt;/code&gt;, &lt;code&gt;ef=11&lt;/code&gt; or &lt;code&gt;gh=11&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If the inputs can be any 5-character string, encoded in 8-bit ASCII, then the input to the oracle is going to be &lt;span class=&quot;math-container&quot;&gt;$5\times8\times N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the maximum number of items that might be in your list. So the input could be quite large. However, the Oracle doesn't need to know all possible inputs; it merely needs to return 1 if any of the inputs contain &amp;quot;Dio&amp;quot; in any allowable position.&lt;/p&gt;&#xA;" OwnerUserId="9482" LastActivityDate="2021-02-09T19:19:34.353" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15951" PostTypeId="2" ParentId="15948" CreationDate="2021-02-10T00:56:20.933" Score="5" Body="&lt;p&gt;There are two different ancillas floating around, one used in &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and another to conduct the swap test later on:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pJXuh.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pJXuh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the above picture with subsystems explicitly labeled we have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|\psi \rangle_{A_2 B} &amp;amp;= \frac{1}{2} \left( |0\rangle_{A_2} |u\rangle_B + \frac{1}{\sqrt{M}} \sum_{j=1}^M |j\rangle_{A_2} |v_j\rangle_B\right) \\&#xA;|\phi\rangle_C &amp;amp;= \frac{1}{\sqrt{Z}} \left( ||\vec{u}|| |0\rangle_C - \frac{1}{\sqrt{M}} \sum_{j=1}^M ||\vec{v}_j||  |j\rangle_C \right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Its tedious to work out the SWAP test in this case, but you can verify that this makes sense by just choosing &lt;span class=&quot;math-container&quot;&gt;$M=1$&lt;/span&gt; corresponding to a single vector &lt;span class=&quot;math-container&quot;&gt;$\vec{v}$&lt;/span&gt; that you're comparing to &lt;span class=&quot;math-container&quot;&gt;$\vec{u}$&lt;/span&gt;. After the swap and final &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate are performed your goal is to rewrite the state as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle_{A_1} \left(|\psi_{A_2 B}\rangle |\phi\rangle_C + |\phi\rangle_{A_2} |\psi_{BC}\rangle \right) + \dots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which you will recognize from a typical SWAP test as having the readout probability of &amp;quot;0&amp;quot; in register &lt;span class=&quot;math-container&quot;&gt;$A_1$&lt;/span&gt; being a function of &lt;span class=&quot;math-container&quot;&gt;$\langle \psi |\phi\rangle$&lt;/span&gt;. However the &lt;span class=&quot;math-container&quot;&gt;$|\psi_{BC}\rangle$&lt;/span&gt; will have its registers out of order and will therefore appear ``backwards'' so you'll need to shuffle some subsystems to finish the derivation.&lt;/p&gt;&#xA;&lt;p&gt;Answering your question:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Yes, systems &lt;span class=&quot;math-container&quot;&gt;$A_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; are both &lt;span class=&quot;math-container&quot;&gt;$(M+1)$&lt;/span&gt;-dimensional, so you need &lt;span class=&quot;math-container&quot;&gt;$\lceil{\log_2 (M+1)}\rceil$&lt;/span&gt; qubits in those registers&lt;/li&gt;&#xA;&lt;li&gt;Correct, you're trying to evaluate &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | \phi \rangle $&lt;/span&gt;, which corresponds to &lt;span class=&quot;math-container&quot;&gt;$\langle \vec{u}, \vec{V}\rangle$&lt;/span&gt; where (&lt;span class=&quot;math-container&quot;&gt;$\vec{V} = \frac{1}{M} \sum_j \vec{v}_j$&lt;/span&gt;). However you will also need to estimate &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to find &lt;span class=&quot;math-container&quot;&gt;$|| \vec{u} - \vec{V} ||^2$&lt;/span&gt; as discussed in the paper.&lt;/li&gt;&#xA;&lt;li&gt;See diagram above&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-02-10T00:56:20.933" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15952" PostTypeId="2" ParentId="14357" CreationDate="2021-02-10T01:29:05.517" Score="3" Body="&lt;p&gt;Suppose we have two graphs, given by two different adjacency matrices &lt;span class=&quot;math-container&quot;&gt;$G_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;.  We wish to know whether the graphs are isomorphic.  It's been a folklore result for a long time that &lt;em&gt;if&lt;/em&gt; we can find a way permute the adjacency matrices by elements of &lt;span class=&quot;math-container&quot;&gt;$\pi\in S_n$&lt;/span&gt; (the symmetric group on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; elements) so as to prepare the state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{b\in\{0,1\},i\in S_n}\vert b\rangle\vert \pi_i(G_b)\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;then&lt;/em&gt; a simple &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; test on the first register will tell whether the graphs are isomorphic.  However, all the known ways to do this invariably leave garbage qubits around, without a clear way to clean up the garbage.&lt;/p&gt;&#xA;&lt;p&gt;This naturally leads to a solution to the Graph Isomorphism Problem given a solution to the Hidden Subgroup Problem for the symmetric group.  After many years I think the consensus is that there may not be an efficient quantum solution to the Hidden Subgroup Problem for such groups.&lt;/p&gt;&#xA;&lt;p&gt;Interestingly there are still other questions one can ask about the Graph Isomorphism problem related not so much to its solution (&amp;quot;are these two graphs isomorphic?&amp;quot;), but to its verifiability (&amp;quot;can you show me whether these two graphs are isomorphic?”)  For example, Graph Isomorphism is a standard problem admitting a statistical zero-knowledge proof; a famous result of &lt;a href=&quot;https://dl.acm.org/doi/10.1145/12130.12137&quot; rel=&quot;nofollow noreferrer&quot;&gt;Goldwasser and Sipser&lt;/a&gt; shows that the Graph Isomorphism problem is in the so-called &lt;span class=&quot;math-container&quot;&gt;$\mathsf{coAM}$&lt;/span&gt; complexity class.  We can ask similar questions in the quantum setting.&lt;/p&gt;&#xA;&lt;p&gt;For example Watrous &lt;a href=&quot;https://arxiv.org/abs/cs/0009002&quot; rel=&quot;nofollow noreferrer&quot;&gt;asked&lt;/a&gt; whether a quantum certificate (a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt; certificate) exists to prove that two graphs are not isomorphic.  That is, he asked whether Graph Non-isomorphism is in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt; - can Merlin provide Arthur a bunch of qubits as a witness to the non-isomorphism of two graphs?  We can ask about bounding Graph Non-isomorphism in other, potentially lower complexity classes like &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QCMA}$&lt;/span&gt; - Merlin provides a classical certificate to enable a quantum Arthur to verify that two graphs are not isomorphic.&lt;/p&gt;&#xA;&lt;p&gt;It is noteworthy, all of this conversation about &lt;em&gt;quantum&lt;/em&gt; approaches to graph isomorphism may be mooted by Babai's &lt;a href=&quot;https://arxiv.org/abs/1512.03547&quot; rel=&quot;nofollow noreferrer&quot;&gt;breakthrough&lt;/a&gt; of a classical quasipolynomial solution from a couple of years ago.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-02-10T02:14:36.377" LastActivityDate="2021-02-10T02:14:36.377" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15953" PostTypeId="1" AcceptedAnswerId="15954" CreationDate="2021-02-10T07:02:13.670" Score="-1" ViewCount="60" Body="&lt;p&gt;How can I calculate the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_{B}}$&lt;/span&gt; (PPT) of the following state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho =\frac{1}{2}|0\rangle\langle0|\otimes|+\rangle\langle+|+\frac{1}{2}|+\rangle\langle+|\otimes|1\rangle\langle1|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-09T18:48:29.213" LastActivityDate="2021-03-09T18:48:29.213" Title="How do I calculate the eigenvalues of the positive partial transpose of this two-qubit state?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;partial-transpose&gt;&lt;eigenvalue&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15954" PostTypeId="2" ParentId="15953" CreationDate="2021-02-10T07:32:15.923" Score="2" Body="&lt;p&gt;First note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho^{T_B} &amp;amp;= \frac{1}{2}|0\rangle\langle0|\otimes(|+\rangle\langle+|)^T+\frac{1}{2}|+\rangle\langle+|\otimes(|1\rangle\langle1|)^T \\&#xA;&amp;amp;= \frac{1}{2}|0\rangle\langle0|\otimes(|+\rangle\langle+|)^\dagger+\frac{1}{2}|+\rangle\langle+|\otimes(|1\rangle\langle1|)^\dagger \\&#xA;&amp;amp;= \frac{1}{2}|0\rangle\langle0|\otimes|+\rangle\langle+|+\frac{1}{2}|+\rangle\langle+|\otimes|1\rangle\langle1| \\&#xA;&amp;amp;= \rho.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we can obtain the eigenvalues using a result described in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14878/how-are-the-eigenvalues-of-rho-frac12a-rangle-langle-a-b-rangle-lang/15894&quot;&gt;this question&lt;/a&gt; which says that the eigenvalues of&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2}(|a\rangle\langle a| + |b\rangle\langle b|)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda_i =  \frac{1}{2} \pm \frac{|\langle a|b \rangle|}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In our case, &lt;span class=&quot;math-container&quot;&gt;$|a\rangle = |0\rangle|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle = |+\rangle|1\rangle$&lt;/span&gt;, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda_i = \frac{1}{2} \pm \frac{|\langle 0|+ \rangle\langle +|1\rangle|}{2} = \frac{1}{2} \pm \frac{1}{4}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 = \frac{1}{4}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2 = \frac{3}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-10T07:32:15.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15955" PostTypeId="2" ParentId="2098" CreationDate="2021-02-10T08:06:04.093" Score="1" Body="&lt;p&gt;The length of the loops determines the quantity called the &lt;em&gt;code distance&lt;/em&gt;. The key fact about its effect on the function of the code is the exponential suppression of errors.&lt;/p&gt;&#xA;&lt;p&gt;More precisely, if &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the code distance and &lt;span class=&quot;math-container&quot;&gt;$\epsilon_P$&lt;/span&gt; is the physical qubit error rate then the logical qubit error rate &lt;span class=&quot;math-container&quot;&gt;$\epsilon_L$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\epsilon_L \approx c_1 \left(c_2\frac{\epsilon_P}{\epsilon_T}\right)^{\left\lfloor\frac{d+1}{2}\right\rfloor}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(c.f. equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; on p.11 in &lt;a href=&quot;https://arxiv.org/abs/1010.5022&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;) where &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; are constants and &lt;span class=&quot;math-container&quot;&gt;$\epsilon_T$&lt;/span&gt; is the &lt;em&gt;threshold&lt;/em&gt; error rate which for the Toric code is in the range &lt;span class=&quot;math-container&quot;&gt;$0.75\%-15.5\%$&lt;/span&gt; and depends on factors such as decoder performance and the quality of syndrome extraction. See e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0703143&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/0905.0531&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-10T21:34:10.030" LastActivityDate="2021-02-10T21:34:10.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15956" PostTypeId="1" CreationDate="2021-02-10T09:29:29.580" Score="3" ViewCount="83" Body="&lt;p&gt;Does applying an operation to one half of an entangled pair affect the other?&#xA;As in the case of quantum teleportation when Alice applies CNOT to her half of the pair and the qubit she wants to send (&lt;span class=&quot;math-container&quot;&gt;$\alpha|1\rangle +\beta|1\rangle$&lt;/span&gt;). Does Bob's half also depend on &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;? How?&lt;/p&gt;&#xA;" OwnerUserId="14781" LastEditorUserId="55" LastEditDate="2021-02-11T11:02:03.743" LastActivityDate="2021-02-11T11:02:03.743" Title="In quantum teleportation, does Bob's qubit depend on Alice's $\alpha$ and $\beta$ coefficients?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15957" PostTypeId="1" CreationDate="2021-02-10T01:43:50.427" Score="3" ViewCount="48" Body="&lt;p&gt;I've been doing research on quantum computers and encryption. How is it possible for quantum computers to solve complex encryption algorithms while their qubit states are not even predictable? How is it even possible for them to implement vectoring? Quantum registers do not sound like they are even stable enough to perform any kind of predictable math alone. How are errors in state detected and/or discarded?&lt;/p&gt;&#xA;" OwnerUserId="14809" OwnerDisplayName="Daniel Jerome" LastEditorUserId="45" LastEditDate="2021-02-14T21:25:40.680" LastActivityDate="2021-02-14T21:25:40.680" Title="How is it possible for Quantum computers to handle encryption if their states are unstable?" Tags="&lt;cryptography&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15958" PostTypeId="1" CreationDate="2021-02-10T10:23:17.503" Score="2" ViewCount="59" Body="&lt;p&gt;Two assumptions behind Bell inequalities (Page 117 Nielsen Chuang)&lt;/p&gt;&#xA;&lt;p&gt;(1) The assumption that the physical properties &lt;span class=&quot;math-container&quot;&gt;$P_{Q}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_{R}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_{S}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_{T}$&lt;/span&gt; have definite values&#xA;&lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; which exist independent of observation. This is sometimes known as the&#xA;assumption of realism.&lt;/p&gt;&#xA;&lt;p&gt;(2) The assumption that Alice performing her measurement does not influence the&#xA;result of Bob’s measurement. This is sometimes known as the assumption of&#xA;locality.&lt;/p&gt;&#xA;&lt;p&gt;What is the meaning that this &lt;strong&gt;assumption-(1)&lt;/strong&gt; doesn't hold? Of course, an electron will have either spin up and spin down whether we measure it or not. I don't see how this can be wrong as well.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="13763" LastEditDate="2021-02-10T14:25:26.980" LastActivityDate="2021-02-10T14:59:59.427" Title="In Bell's inequalities, what is the meaning of assuming that the physical properties $P_Q,P_R,P_S,P_T$ have definite values?" Tags="&lt;nielsen-and-chuang&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15959" PostTypeId="2" ParentId="15957" CreationDate="2021-02-10T10:28:55.447" Score="3" Body="&lt;p&gt;Statea of quantum computer are not unstable or unpredictable. For now, put aside a noise and assume ideal quantum computer. Any state can be desribed by a vector in space &lt;span class=&quot;math-container&quot;&gt;$C^{2^n}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is number of qubits. Any operation (with exception to reset and measurement) is a unitrary matrix from space &lt;span class=&quot;math-container&quot;&gt;$C^{2^n,2^n}$&lt;/span&gt;. So far everything is perfectly predictable. Of course, when you measure a state, you get a random results but this is determined by the vector describing the state (or in other words by probability distribution or wave function). This all mean that a quantum computer behaves in predictable way even though its nature is probabilistic.&lt;/p&gt;&#xA;&lt;p&gt;Now on noise, yes it is true that the noise is unpredictable. However, to eliminate the noise is a matter of engineering and development. There is a so-called threshold theorem which states that with sufficiently large number of qubits you are able to reduce noise under certain level &lt;span class=&quot;math-container&quot;&gt;$\epsilon.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Morever, there is a lot of probabilistic algorithms used on classical computers. They are employed in optimization, determining if some number is prime and machine learning etc. But this does not render classical computer unpredictable.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-10T10:28:55.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15961" PostTypeId="2" ParentId="15958" CreationDate="2021-02-10T11:55:04.960" Score="3" Body="&lt;p&gt;This, in a nutshell, is the whole issue of quantum. You say &amp;quot;of course an electron will have either spin up or spin down&amp;quot;. It might seem like it should, but this is founded purely on your intuition about what the world around you is like. You have no a priori law of the universe that rules out other options. And hence, when an experiment shows you that assumption 1 does not hold in certain scenarios, you have to rip up your intuition and start from the beginning. You can no longer say that an electron is definitely either spin up or spin down.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-10T11:55:04.960" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15962" PostTypeId="2" ParentId="15958" CreationDate="2021-02-10T11:55:18.967" Score="1" Body="&lt;p&gt;Actually, an electron will only have spin up or spin down &lt;em&gt;when we decide to look at it&lt;/em&gt;.  Generally, quantum mechanics postulates that the state of the spin exists in superposition between up and down, only collapsing to a definite value--and becoming an element of reality--when we perform a measurement.  In the first assumption you cite, when the physical properties are assumed to have definite values, we mean that they really, actually, &lt;em&gt;objectively&lt;/em&gt; have those values in nature.  When we measure, we just obtain those values, which would have existed regardless of our decision to measure.&lt;/p&gt;&#xA;&lt;p&gt;The weirdness of quantum mechanics lies in the fact that our measurements do not simply obtain this information, but could actually affect reality itself.  Mathematically, we say that when we measure, the system will collapse to an eigenstate of the operator that we are measuring.  When two operators commute, they share an eigenbasis--unfortunately, position and momentum do not commute.  If we measure the position of a particle and obtain some value, &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt;, we can be certain that right after the measurement, the particle has been localized to &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt;.  The momentum &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;, however, is now indeterminate, and we can only describe it with a probability distribution (i.e. the norm-square of the wavefunction in the momentum basis) over the values it &lt;em&gt;could&lt;/em&gt; take if we were to measure the momentum.  Needing to talk about a probability distribution, as opposed to a definite value, &lt;em&gt;means&lt;/em&gt; that momentum cannot be an element of our reality anymore.  And of course, if we did measure it, the position of the particle would become indeterminate instead.&lt;/p&gt;&#xA;&lt;p&gt;Clearly, whether we choose to measure &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; affects the reality we observe, which is completely opposed to assumption (1) and the intuition of the authors of the EPR paradox, who took this indeterminacy as a sign that quantum mechanics was incomplete, that the wavefunction could not accurately predict all elements of reality simultaneously.  With experimental verifications of Bell's theorem, it is apparently the case that not all such physical properties (&lt;span class=&quot;math-container&quot;&gt;$Q,R,S,T,\dots$&lt;/span&gt;) can be elements of reality at the same time, so it's no wonder that quantum mechanics cannot definitely predict all their values.  You could instead reject assumption (2), but then you are assuming that information can travel faster than the speed of light.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2021-02-10T12:00:34.657" LastActivityDate="2021-02-10T12:00:34.657" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15963" PostTypeId="1" AcceptedAnswerId="15964" CreationDate="2021-02-10T12:31:55.037" Score="2" ViewCount="43" Body="&lt;p&gt;I have created an EPR pair. Let's suppose it's &lt;span class=&quot;math-container&quot;&gt;$(|00\rangle + |11\rangle)/\sqrt{2}$&lt;/span&gt;. We both of our halves and then we move into our places.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;If I ask you how does your half look like (mathematical expression of the state), what would be the answer? (How does my half look like?)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If I apply some operation to my half like maybe applying pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate which flips qubits, would it change anything in your half?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;What would the combined state look like after this operation?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-10T12:55:51.483" Title="EPR pair and individual operations" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;bell-basis&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="2" ClosedDate="2021-02-11T11:35:33.533" ContentLicense="CC BY-SA 4.0" />
  <row Id="15964" PostTypeId="2" ParentId="15963" CreationDate="2021-02-10T12:55:51.483" Score="2" Body="&lt;p&gt;(1) The best description that I can give is a mixed state, &lt;span class=&quot;math-container&quot;&gt;$\rho=I/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(2) If you apply a unitary operation on your half, it does not change my description of my state. If you apply a measurement on your half, my best description only updates if you tell me the measurement result.&lt;/p&gt;&#xA;&lt;p&gt;(3) The combined state looks like &lt;span class=&quot;math-container&quot;&gt;$(|01\rangle+|10\rangle)/\sqrt{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-10T12:55:51.483" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15965" PostTypeId="2" ParentId="15958" CreationDate="2021-02-10T13:52:05.533" Score="1" Body="&lt;p&gt;The &amp;quot;realism&amp;quot; assumption basically amounts to saying &amp;quot;the system's state can be described by a probability distribution, operations on the system can be represented by probabilistic transitions, and here are some specific distinguishable states that I know the system can be in&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;An example of a system that doesn't have this property is one where an operation like &amp;quot;transition to the state that currently has the highest probability assigned to it&amp;quot; is available. There is no stochastic matrix that corresponds to that operation, so it is not a probabilistic transition. Alternatively, the initial state could have an invalid combination of probabilities like &amp;quot;110% Off and 20% On&amp;quot;. Really the space of &amp;quot;things that don't behave like probabilities&amp;quot; is quite large.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-02-10T13:52:05.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15966" PostTypeId="1" AcceptedAnswerId="15968" CreationDate="2021-02-10T14:54:34.737" Score="2" ViewCount="174" Body="&lt;p&gt;I'm going through some older tutorials for my employer and everything seems to be working fine except the &amp;quot;iden&amp;quot; attribute. The error is listed below. I assume the name was changed but I don't know what it was changed to, and I don't know how to find out.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-10-fff169415f56&amp;gt; in &amp;lt;module&amp;gt;&#xA;      4 hello_qubit = QuantumCircuit(q)&#xA;      5 &#xA;----&amp;gt; 6 hello_qubit.iden(q[0])&#xA;      7 &#xA;      8 job = execute(hello_qubit, S_simulator)&#xA;&#xA;AttributeError: 'QuantumCircuit' object has no attribute 'iden' '''&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14807" LastEditorUserId="55" LastEditDate="2021-02-10T16:54:01.527" LastActivityDate="2021-02-10T16:54:01.527" Title="Was the Quantum Circuit Attribute &quot;iden&quot; renamed?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15967" PostTypeId="2" ParentId="15958" CreationDate="2021-02-10T14:59:59.427" Score="1" Body="&lt;p&gt;One way to think about this is to realise that the &amp;quot;physical properties&amp;quot; in QM (but also more generally in physics) are not just a function of the system under examination, but also of the measurement apparatus that you are using to probe said system.&lt;/p&gt;&#xA;&lt;p&gt;In the case of QM, you cannot observe the system without significantly perturbing it, as you do in classical physics. It therefore becomes tricky to even define what &amp;quot;the state itself&amp;quot; even means, as all we can do is characterise how it responds to the possible measurements we perform on it.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, there might be different ways of measuring a system which are incompatible with one another, meaning that the act itself of performing measurement &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; will affect the results of a future measurement &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. In such a case, what would it even mean to say that &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; have independent values independent of observation&amp;quot;? If measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; changes &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, clearly they cannot have simultaneous definite values.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-10T14:59:59.427" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15968" PostTypeId="2" ParentId="15966" CreationDate="2021-02-10T15:07:14.743" Score="3" Body="&lt;p&gt;Now it is called &lt;code&gt;id&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.id(0)&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐&#xA;q_0: ┤ I ├&#xA;     └───┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to implement a delay consider using &lt;code&gt;delay&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-10T15:07:14.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15969" PostTypeId="2" ParentId="15966" CreationDate="2021-02-10T15:08:01.360" Score="3" Body="&lt;p&gt;Yes, the &lt;code&gt;QuantumCircuit.iden()&lt;/code&gt; method was &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#release-notes-0-13-0-deprecation-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;deprecated&lt;/a&gt; in the qiskit-terra 0.13.0 release (qiskit 0.18.0) and removed in qiskit-terra 0.16.0 (qiskit 0.23.0): &lt;a href=&quot;https://qiskit.org/documentation/release_notes.html#release-notes-0-16-0-upgrade-notes&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/release_notes.html#release-notes-0-16-0-upgrade-notes&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It was replaced with the &lt;code&gt;i()&lt;/code&gt; or &lt;code&gt;id()&lt;/code&gt;. So you can just replace &lt;code&gt;iden()&lt;/code&gt; with either one of those.&lt;/p&gt;&#xA;" OwnerUserId="5529" LastActivityDate="2021-02-10T15:08:01.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15970" PostTypeId="1" CreationDate="2021-02-10T18:23:59.283" Score="0" ViewCount="40" Body="&lt;p&gt;Consider the following task: we are given a probability distribution &lt;span class=&quot;math-container&quot;&gt;$p_y:x\mapsto p_y(x)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$y\in\{0,1\}$&lt;/span&gt; (&lt;em&gt;e.g.&lt;/em&gt; we are given some black box that we can use to draw samples from either &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;), and we want to recover the value of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;.&#xA;Assume &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; for some finite register &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&#xA;We can assume we know what the possible distributions &lt;span class=&quot;math-container&quot;&gt;$p_y$&lt;/span&gt; are, and we also know the probability &lt;span class=&quot;math-container&quot;&gt;$\lambda_y$&lt;/span&gt; with which each &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; can occur: &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pr}(Y=y)=\lambda_y$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, suppose we got our box, used it, and obtained the result &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Knowing &lt;span class=&quot;math-container&quot;&gt;$\lambda,p_0,p_1$&lt;/span&gt;, what's our best guess for &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;? Well, we know that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pr}(X=x|Y=y)=p_y(x)$&lt;/span&gt;, and thus from Bayes that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Pr}(Y=y|X=x) = \frac{\lambda_y p_y(x)}{p(x)}, \quad \text{where}\quad p(x)\equiv \sum_y \lambda_y p_y(x).$$&lt;/span&gt;&#xA;It then stands to reason that, knowing &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, our best guess for &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is the one that maximises this probability:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$y_{\rm opt}(x)=\mathrm{argmax}_y\mathrm{Pr}(Y=y|X=x)=\mathrm{argmax}_y \lambda_y p_y(x).$$&lt;/span&gt;&#xA;Using such guess, the probability of guessing right (using the knowledge of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;) would then be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{\rm correct}(x) = \max_y \mathrm{Pr}(Y=y|X=x) = \frac{\max_y \lambda_y p_y(x)}{p(x)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We would now like to know what is the probability of correctly identifying &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; &lt;em&gt;without&lt;/em&gt; having sampled from &lt;span class=&quot;math-container&quot;&gt;$p_y$&lt;/span&gt;. Naively, I would compute this as the average of &lt;span class=&quot;math-container&quot;&gt;$p_{\rm correct}(x)$&lt;/span&gt; weighted over the probabilities &lt;span class=&quot;math-container&quot;&gt;$p(x)$&lt;/span&gt;, which would give&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{\rm correct} = \sum_x p(x)p_{\rm correct}(x) = \sum_x \max_y \lambda_y p_y(x).\tag A$$&lt;/span&gt;&#xA;However, &lt;em&gt;e.g.&lt;/em&gt; in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' book&lt;/a&gt; (around Eq. (3.2), pag 126, though I'm using a slightly different notation here), the author mentions that the probability of correctly identifying &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; oughts to be calculated by considering the probability that the guess is right minus the probability that it is not, and that this would result in the quantity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{x\in X}\left\lvert \lambda_0 p_0(x)- \lambda_1 p_1(x)\right\rvert&#xA;= \|\lambda_0 p_0 - \lambda_1 p_1\|_1,\tag B$$&lt;/span&gt;&#xA;from which we would recover the probability of being correct as &lt;span class=&quot;math-container&quot;&gt;$p_{\rm correct}=\frac12(1+\|\lambda_0 p_0-\lambda_1 p_1\|_1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Assuming the reasoning that led me to (A) is correct, why is my expression for &lt;span class=&quot;math-container&quot;&gt;$p_{\rm correct}$&lt;/span&gt; compatible with the one resulting from (B)?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-12T19:06:53.653" Title="In classical state discrimination, why does the trace distance quantify the probability of success?" Tags="&lt;textbook-and-exercises&gt;&lt;information-theory&gt;&lt;state-discrimination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15971" PostTypeId="2" ParentId="15970" CreationDate="2021-02-10T18:52:32.227" Score="0" Body="&lt;p&gt;Upon some additional reflection, I found a way to see that the expressions are equivalent. I'm not sure whether this is the way that was intended in the text though, there might be better/more direct ways to get to the expression with the trace norm.&lt;/p&gt;&#xA;&lt;p&gt;The basic idea is to observe that for any &lt;span class=&quot;math-container&quot;&gt;$a,b\in\mathbb R$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(a+b)+|a-b| = 2\max(a,b).$$&lt;/span&gt;&#xA;Using this result, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$2\max_y \lambda_y p_y(x) = \sum_y \lambda_y p_y(x) + \lvert\lambda_0 p_0(x)-\lambda_1 p_1(x)\rvert.$$&lt;/span&gt;&#xA;Summing over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; we thus get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$2p_{\rm correct} = 2\sum_x \max_y \lambda_y p_y(x)&#xA;= \underbrace{\sum_x \sum_y \lambda_y p_y(x)}_{=1} + \sum_x \lvert\lambda_0 p_0(x)-\lambda_1 p_1(x)\rvert,$$&lt;/span&gt;&#xA;and therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{\rm correct} = \frac12\left(1 + \|\lambda_0 p_0 - \lambda_1 p_1\|_1\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-10T18:52:32.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15972" PostTypeId="2" ParentId="15956" CreationDate="2021-02-10T19:43:32.270" Score="4" Body="&lt;p&gt;The answer is negative: Bob's half of the entangled pair is unaffected by operations performed by Alice on her half. However, there is a caveat. It is the hallmark of entanglement that the state of either half is an incomplete description of the pair. The complete description is given by the &lt;em&gt;joint&lt;/em&gt; state. The joint state is very much affected by what Alice does to her half of the pair. It is the effect on the joint state that enables teleportation.&lt;/p&gt;&#xA;&lt;h2&gt;Proof for unitary operations&lt;/h2&gt;&#xA;&lt;p&gt;Perhaps the easiest way to see this is in the case where the operation Alice performs on her half of the pair is unitary. Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{AB}$&lt;/span&gt; be the joint initial state of the composite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; denotes Alice's half of the pair and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; denotes Bob's half. Consider the &lt;a href=&quot;https://en.wikipedia.org/wiki/Schmidt_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Schmidt decomposition&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{AB} = \sum_i \lambda_i |i_A\rangle|i_B\rangle$&lt;/span&gt;. The state of Bob's subsystem is &lt;span class=&quot;math-container&quot;&gt;$\rho_B = \mathrm{tr}_A(|\psi\rangle_{AB}\langle\psi|) = \sum_i\lambda_i^2|i_B\rangle\langle i_B|$&lt;/span&gt;. Any unitary operation on Alice's half of the pair merely changes the states &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle \to |i_A'\rangle$&lt;/span&gt; and so we see that Bob's state remains unaffected.&lt;/p&gt;&#xA;&lt;h2&gt;Proof for CPTP maps&lt;/h2&gt;&#xA;&lt;p&gt;More generally, suppose that Alice applies a completely positive trace-preserving map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}_A$&lt;/span&gt; with Kraus operators &lt;span class=&quot;math-container&quot;&gt;$E_{i,A}$&lt;/span&gt; to her half of the pair and Bob does nothing to his. The resulting joint state is &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB} = (\mathcal{E}_A\otimes \mathcal{I}_B)(|\psi\rangle_{AB}\langle\psi|)$&lt;/span&gt;. The resulting state of Bob's half is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho'_B &amp;amp;= \mathrm{tr}_A\left((\mathcal{E}_A\otimes \mathcal{I}_B)(|\psi\rangle_{AB}\langle\psi|)\right) \\&#xA;&amp;amp;= \sum_i\mathrm{tr}_A\left((E_{i,A}\otimes I_B)|\psi\rangle_{AB}\langle\psi|(E_{i,A}^\dagger \otimes I_B)\right) \\&#xA;&amp;amp;= \mathrm{tr}_A\left(|\psi\rangle_{AB}\langle\psi|\sum_i E_{i,A}^\dagger E_{i,A}\right) \\&#xA;&amp;amp;= \mathrm{tr}_A(|\psi\rangle_{AB}\langle\psi|) \\&#xA;&amp;amp;= \rho_B&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we used the cyclic property of the partial trace for operators acting on the subsystem being traced over and the completeness relation for Kraus operators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_i E_{i,A}^\dagger E_{i,A} = I_A.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Example&lt;/h2&gt;&#xA;&lt;p&gt;Suppose Alice and Bob share an entangled pair in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{|00\rangle + |11\rangle}{\sqrt{2}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The initial state of Bob's half of the pair is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho_B &amp;amp;= \mathrm{tr}_A(|\psi\rangle\langle\psi|) \\&#xA;&amp;amp;= \frac{1}{2}\mathrm{tr}_A(|00\rangle\langle 00| + |00\rangle\langle 11| + |11\rangle\langle 00| + |11\rangle\langle 11|) \\&#xA;&amp;amp;= \frac{1}{2}(|0\rangle\langle 0| + |1\rangle \langle 1|).&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now suppose that Alice applies Hadamard gate to her half of the pair&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi'\rangle = (H \otimes I) \frac{|00\rangle + |11\rangle}{\sqrt{2}} = \frac{|+\rangle|0\rangle + |-\rangle|1\rangle}{\sqrt{2}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The new state of Bob's half of the pair is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho'_B &amp;amp;= \mathrm{tr}_A(|\psi'\rangle\langle\psi'|) \\&#xA;&amp;amp;= \frac{1}{2}\mathrm{tr}_A(|+\rangle|0\rangle\langle +|\langle 0| + |+\rangle|0\rangle\langle -|\langle 1| + |+\rangle|0\rangle\langle -|\langle 1| + |-\rangle|1\rangle\langle -|\langle 1|) \\&#xA;&amp;amp;= \frac{1}{2}(|0\rangle\langle 0| + |1\rangle \langle 1|)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;i.e. the same as before Alice applied Hadamard.&lt;/p&gt;&#xA;&lt;h2&gt;Relationship to teleportation&lt;/h2&gt;&#xA;&lt;p&gt;Teleportation entails the following steps&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Alice interacts the input qubit &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; with her half of an entangled pair.&lt;/li&gt;&#xA;&lt;li&gt;Alice performs a measurement on the input qubit and her half of the entangled pair.&lt;/li&gt;&#xA;&lt;li&gt;Alice transmits classical measurement outcome to Bob.&lt;/li&gt;&#xA;&lt;li&gt;Bob uses the classical information to recover &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Note that Bob is unable to recover &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; until he receives classical information about measurement outcomes from Alice. This reflects the fact that the state of his half of the pair is not affected by the operations that Alice performs in steps 1 and 2 and therefore is insufficient to recover &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. However, it is possible to recover &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; from the joint state of the three qubits. The measurement outcomes transmitted classically by Alice together with the state of Bob's half of the pair  together supply him with the necessary knowledge of the joint state and enable him to recover &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Consistency with special relativity&lt;/h2&gt;&#xA;&lt;p&gt;The fact that the state of Bob's half of the pair is unaffected by operations performed by Alice on her half denies the use of entanglement for faster-than-light communication. It is also reassuring because it means that quantum mechanics does not come into conflict with special relativity over the fact that if Alice's and Bob's actions are spacelike separated then different observers may disagree on the order in which the actions take place due to &lt;a href=&quot;https://en.wikipedia.org/wiki/Relativity_of_simultaneity&quot; rel=&quot;nofollow noreferrer&quot;&gt;relativity of simultaneity&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-10T21:31:48.763" LastActivityDate="2021-02-10T21:31:48.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15973" PostTypeId="1" AcceptedAnswerId="16077" CreationDate="2021-02-10T21:27:31.430" Score="6" ViewCount="175" Body="&lt;p&gt;While working on an error detection algorithm, I stumbled upon the problem of simplifying the following implementation&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oUrYW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oUrYW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here, the &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gate is defined by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S=\left(&#xA;\begin{array}{cc}&#xA; \frac{\sqrt{3}}{2} &amp;amp; -\frac{1}{2} e^{\frac{i \pi }{3}} \\&#xA; \frac{1}{2} e^{\frac{i \pi }{3}} &amp;amp; \frac{1}{2} \sqrt{3} e^{\frac{2 i \pi }{3}} \\&#xA;\end{array}&#xA;\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The issue with this implementation is that I am basically de-encoding the state (the &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt;s in the beginning), performing the required logical gates (the &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate in the middle), and then re-encoding the state afterwords (the &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;s at the end). Instead of this de-encoding re-encoding procedure, I would like to find some implementation that is equivalent to the above set of gates that uses less &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt;s and single-qubit gates overall. I would greatly appreciate if anyone knew of an efficient way to implement this type of gate or some papers I could research in order to further my understanding of said gate.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;EDIT: In response to @ryanhill1: It is an error detection algorithm that I am developing. The basic idea is to use two qubits (and therefore expanding the hilbert space) to represent a single qubit through the encoding&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle_L=-\frac{1}{4} \sqrt{3} e^{\frac{i \pi&#xA;   }{3}}|00\rangle+\frac{3}{4} e^{\frac{2 i \pi&#xA;   }{3}}|01\rangle-\frac{\sqrt{3}}{4}|10\rangle-\frac{1}{4}&#xA;   e^{\frac{2 i \pi }{3}}|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|1\rangle_L=-\frac{1}{4} \sqrt{3} e^{\frac{i \pi&#xA;   }{3}}|00\rangle-\frac{1}{4} e^{\frac{2 i \pi&#xA;   }{3}}|01\rangle-\frac{\sqrt{3}}{4}|10\rangle+\frac{3}{4}&#xA;   e^{\frac{2 i \pi }{3}}|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This encoding is actually achieved using a pair of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gates and a single &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt; gate. Hence the issue I have: I want to make a gate that acts on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_L$&lt;/span&gt; like a &lt;span class=&quot;math-container&quot;&gt;$C_{not}$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; without de-encoding and the re-encoding the entire state.&lt;/p&gt;&#xA;" OwnerUserId="9696" LastEditorUserId="9696" LastEditDate="2021-02-16T16:17:45.543" LastActivityDate="2021-02-17T08:46:08.717" Title="More efficient implementation of $4$-qubit gate" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="15974" PostTypeId="1" AcceptedAnswerId="15978" CreationDate="2021-02-10T22:46:04.890" Score="0" ViewCount="58" Body="&lt;p&gt;What is the Logarithmic Negativity of the Werner state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_w = p|\Psi^-\rangle\langle\Psi^-|+\frac{1-p}{4}I_4$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\Psi^-\rangle = \frac{1}{\sqrt{2}}(|10\rangle-|01\rangle)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-02-11T11:11:57.553" LastActivityDate="2021-02-11T11:11:57.553" Title="What is the logarithmic Negativity of the Werner state?" Tags="&lt;entanglement&gt;&lt;entanglement-negativity&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-02-11T16:01:10.543" ContentLicense="CC BY-SA 4.0" />
  <row Id="15975" PostTypeId="1" AcceptedAnswerId="15977" CreationDate="2021-02-10T23:12:16.120" Score="4" ViewCount="136" Body="&lt;p&gt;I'm trying to derive equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; on p.2 in &lt;a href=&quot;https://arxiv.org/abs/1307.0401&quot; rel=&quot;nofollow noreferrer&quot;&gt;Lloyd &lt;em&gt;et al&lt;/em&gt;, 2013&lt;/a&gt; which reads&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_A\left[\exp(-i\theta S_{AB}) (\rho_A \otimes \sigma_B) \exp(i\theta S_{AB}) \right] = (\cos^2 \theta) \sigma_B + (\sin^2 \theta) \rho_B - i \sin \theta [\rho_B, \sigma_B]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$S_{AB}$&lt;/span&gt; is a swap operator for the two systems. My approach so far is to write the operator as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp(i\theta S_{AB}) = \begin{pmatrix}&#xA;e^{i\theta} &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \cos \theta &amp;amp; i \sin\theta &amp;amp; 0 \\&#xA;0 &amp;amp; i \sin \theta &amp;amp; \cos \theta &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\theta}&#xA;\end{pmatrix}&#xA;\begin{matrix}&#xA;\leftarrow\rho_A \otimes \rho_B \\ \leftarrow\rho_A \otimes \sigma_B\\ \leftarrow\sigma_A \otimes \rho_B \\ \leftarrow\sigma_A\otimes \sigma_B&#xA;\end{matrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the labels describe how each input is affected by this operation if the possible state configurations are represented as a column vector, e.g. &lt;span class=&quot;math-container&quot;&gt;$\rho\otimes \sigma \sim \hat{e}_1$&lt;/span&gt; would become &lt;span class=&quot;math-container&quot;&gt;$\cos\theta (\rho\otimes \sigma) + \sin \theta (\sigma \otimes \rho) \sim \cos\theta \hat{e}_1 + \sin \theta \hat{e}_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, I haven't been able to carry out the calculation since I'm unsure how to apply the operator or partial trace on &lt;span class=&quot;math-container&quot;&gt;$(\rho\otimes \sigma)$&lt;/span&gt; when I set up operators like this. Is there anything pathological about this representation of a SWAP, and if so what is the right approach to deriving the above equation?&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="10480" LastEditDate="2021-02-11T02:04:23.237" LastActivityDate="2021-02-11T02:04:23.237" Title="Partial trace and SWAP in the basis of subsystems" Tags="&lt;quantum-gate&gt;&lt;partial-trace&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15976" PostTypeId="2" ParentId="15975" CreationDate="2021-02-11T00:33:15.093" Score="3" Body="&lt;p&gt;Using the fact &lt;span class=&quot;math-container&quot;&gt;$ e^{i\theta S} = \text{cos}(\theta) \cdot I + i \cdot \text{sin}(\theta) \cdot S $&lt;/span&gt;, we calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;e^{-i\theta S} (\rho \otimes \sigma) e^{i\theta S}&#xA;&amp;amp; =  &#xA;(\text{cos}(\theta) \cdot I - i \cdot \text{sin}(\theta) \cdot S) &#xA;\big(\rho \otimes \sigma \big) &#xA;(\text{cos}(\theta) \cdot I + i \cdot \text{sin}(\theta) \cdot S)  \\&#xA;&amp;amp; = \text{cos}^2(\theta) (\rho \otimes \sigma) &#xA;+ \text{sin}^2(\theta) (\sigma \otimes \rho)&#xA;- i \text{sin}(\theta) \text{cos}(\theta) \cdot \big( S(\rho \otimes \sigma) - (\rho \otimes \sigma)S \big)&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we need only to calculate &lt;span class=&quot;math-container&quot;&gt;$ \text{Tr}_A S(\rho \otimes \sigma) $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$ \rho = \sum_i p_i |x_i \rangle \langle x_i| $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ \sigma = \sum_i q_i |y_i \rangle \langle y_i| $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\text{Tr}_A S(\rho \otimes \sigma) &#xA;&amp;amp;= \sum_{i,j} p_i q_j \text{Tr}_A [S \big(|x_i y_j \rangle \langle x_i y_j| \big)]&#xA;\\ &#xA;&amp;amp;= \sum_{i,j} p_i q_j \text{Tr}_A [\big(|y_j x_i \rangle \langle x_i y_j| \big)]\\&#xA;&amp;amp;= \sum_{i,j} p_i q_j \langle x_i | y_j \rangle \cdot|x_i \rangle \langle y_j| = \rho\sigma&#xA;\end{align*}&lt;/span&gt;&#xA;A similar calculation shows that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_A (\rho \otimes \sigma)S = \sigma \rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_A e^{-i\theta S} (\rho \otimes \sigma) e^{i\theta S} = &#xA;\text{cos}^2(\theta) \sigma&#xA;+ \text{sin}^2(\theta) \rho&#xA;- i \frac{\text{sin}(2\theta)}{2} \cdot [\rho, \sigma]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2021-02-11T00:33:15.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15977" PostTypeId="2" ParentId="15975" CreationDate="2021-02-11T00:37:10.370" Score="3" Body="&lt;p&gt;For any &lt;span class=&quot;math-container&quot;&gt;$\theta\in\mathbb{R}$&lt;/span&gt; and any operator &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$T^2=I$&lt;/span&gt; we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp(i\theta T) = I\cos\theta + i T\sin\theta&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(c.f. exercise 4.2 on p.175 in Nielsen &amp;amp; Chuang). Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp(i\theta S_{AB}) = I \cos\theta + i S_{AB} \sin\theta&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp(-i\theta S_{AB}) (\rho_A \otimes \sigma_B) \exp(i\theta S_{AB}) = \\&#xA;\rho_A\otimes\sigma_B \cos^2\theta - i S_{AB} \rho_A\otimes\sigma_B \cos\theta\sin\theta + \\&#xA;+ i \rho_A\otimes\sigma_B S_{AB} \cos\theta\sin\theta  + \sigma_A\otimes\rho_B \sin^2\theta.\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By definition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_A(\rho_A\otimes\sigma_B) = \sigma_B \\&#xA;\mathrm{tr}_A(\sigma_A\otimes\rho_B) = \rho_B.\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The partial trace of &lt;span class=&quot;math-container&quot;&gt;$S_{AB}\rho_A\otimes\sigma_B$&lt;/span&gt; is represented by the tensor network&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TmocT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TmocT.png&quot; alt=&quot;tensor network for partial trace with swap&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which shows that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_A(S_{AB}\rho_A\otimes\sigma_B) = \rho_B\sigma_B.\tag{3a}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_A(\rho_A\otimes\sigma_BS_{AB}) = \sigma_B\rho_B.\tag{3b}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, tracing over &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and substituting &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$(3a)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(3b)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_A\left[\exp(-i\theta S_{AB}) (\rho_A \otimes \sigma_B) \exp(i\theta S_{AB})\right] = \\&#xA;\sigma_B\cos^2\theta + \rho_B\sin^2\theta - i\rho_B\sigma_B\cos\theta\sin\theta + i\sigma_B\rho_B\cos\theta\sin\theta = \\&#xA;\sigma_B\cos^2\theta + \rho_B\sin^2\theta - i[\rho_B, \sigma_B]\cos\theta\sin\theta.\tag4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This result differs from the paper. I think the formula in the paper contains a mistake. Set &lt;span class=&quot;math-container&quot;&gt;$\theta=\frac{\pi}{2}$&lt;/span&gt;. In this case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(-\frac{i\pi S_{AB}}{2}\right) (\rho_A \otimes \sigma_B) \exp\left(\frac{i\pi S_{AB}}{2}\right) = S_{AB} (\rho_A \otimes \sigma_B) S_{AB} = \sigma_A \otimes \rho_B&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the partial trace over &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;. This special case agrees with &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; and disagrees with the formula in the paper since the latter preserves the term with the commutator when &lt;span class=&quot;math-container&quot;&gt;$\theta=\frac{\pi}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-11T01:07:14.280" LastActivityDate="2021-02-11T01:07:14.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15978" PostTypeId="2" ParentId="15974" CreationDate="2021-02-11T02:18:23.393" Score="2" Body="&lt;p&gt;&lt;strong&gt;Hint 1&lt;/strong&gt;: Logarithmic negativity is easily computed once we know the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho_w^\Gamma$&lt;/span&gt; - where &lt;span class=&quot;math-container&quot;&gt;$^\Gamma$&lt;/span&gt; denotes the partial transpose -  since then it becomes a matter of substitution into the formulas in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Negativity_(quantum_mechanics)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Hint 2&lt;/strong&gt;: Finding the eigenvalues becomes easier once we observe that if &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho_w^\Gamma$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$(|\Psi^-\rangle\langle\Psi^-|)^\Gamma$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-11T02:18:23.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15979" PostTypeId="1" AcceptedAnswerId="15985" CreationDate="2021-02-11T04:04:16.090" Score="2" ViewCount="41" Body="&lt;p&gt;I want to simulate a 40-45 Qubit circuit that applies Grover + QPE.&lt;/p&gt;&#xA;&lt;p&gt;I've tried running a simulation on qiskit but can't really go past 18 qubits on my machine.  As an alternative, I've been reading Bravyi's work using a technique called Low-Rank Stabilizer decomposition, but I am confused as to where to start or how to translate everything into workable code.&lt;/p&gt;&#xA;&lt;p&gt;Could you recommend me any references which could help me understand Bravyi's work (or maybe some implemented code)?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="10480" LastEditDate="2021-02-11T05:18:18.343" LastActivityDate="2021-02-11T12:00:55.183" Title="Simulating QPE + Grover using Low-Rank Stabilizer Decomposition" Tags="&lt;grovers-algorithm&gt;&lt;resource-request&gt;&lt;simulation&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15980" PostTypeId="1" AcceptedAnswerId="15981" CreationDate="2021-02-11T05:23:45.120" Score="2" ViewCount="43" Body="&lt;p&gt;How can one argue that the partial transpose &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; of a general separable state is positive?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-09T18:46:55.310" LastActivityDate="2021-03-09T18:46:55.310" Title="How can one argue that the partial transpose $\rho^{T_B}$ of a general separable state is positive?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;&lt;linear-algebra&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15981" PostTypeId="2" ParentId="15980" CreationDate="2021-02-11T06:03:40.800" Score="2" Body="&lt;p&gt;First observe that if &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; are positive (aka positive semi-definite) operators and &lt;span class=&quot;math-container&quot;&gt;$q\in [0, +\infty)$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$R^T$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$qR$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R\otimes S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R+S$&lt;/span&gt; are all positive operators.&lt;/p&gt;&#xA;&lt;p&gt;By definition, if &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is separable then there exist positive operators &lt;span class=&quot;math-container&quot;&gt;$\rho_{i,A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{i,B}$&lt;/span&gt; with unit trace and &lt;span class=&quot;math-container&quot;&gt;$p_i\in[0, 1]$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB} = \sum_i p_i \rho_{i,A}\otimes\sigma_{i,B}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, the partial transpose&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}^{T_B} = \sum_i p_i \rho_{i,A}\otimes\sigma_{i,B}^T&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is a sum of tensor products of positive operators and therefore is itself positive.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-11T06:03:40.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15982" PostTypeId="1" AcceptedAnswerId="15986" CreationDate="2021-02-11T06:09:27.660" Score="0" ViewCount="72" Body="&lt;p&gt;I have found a question for finding the Unitary operator for the following transformation:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/wTEyG.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wTEyG.jpg&quot; alt=&quot;s&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I found the solution as well. But I didn't understand how they got the solution!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5m7VB.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5m7VB.jpg&quot; alt=&quot;s&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14814" LastEditorUserId="55" LastEditDate="2021-02-11T12:19:20.327" LastActivityDate="2021-02-11T12:19:20.327" Title="Find the unitary implementing the transformation $|0\rangle\to\frac1{\sqrt2}(|0\rangle+|1\rangle),|1\rangle\to\frac1{\sqrt2}(|0\rangle-|1\rangle)$" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;&lt;projection-operator&gt;" AnswerCount="2" CommentCount="6" ClosedDate="2021-02-13T17:27:10.133" ContentLicense="CC BY-SA 4.0" />
  <row Id="15983" PostTypeId="2" ParentId="15982" CreationDate="2021-02-11T07:26:32.767" Score="3" Body="&lt;p&gt;Another way to solution:&lt;/p&gt;&#xA;&lt;p&gt;Hadamard gate changes &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In vector notatation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} 1 \\ 0 \end{pmatrix}&#xA;\rightarrow&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix} 1 \\ 1 \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} 0 \\ 1 \end{pmatrix}&#xA;\rightarrow&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix} 1 \\ -1 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, put output vectors to matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=&#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Clearly &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = |+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle = |-\rangle$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is matrix representation of Hadamard gate.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-11T07:26:32.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15985" PostTypeId="2" ParentId="15979" CreationDate="2021-02-11T08:43:59.247" Score="4" Body="&lt;p&gt;I agree that the Bravyi et al. paper is not easy to understand and they should have made some reference implementation available.&lt;/p&gt;&#xA;&lt;p&gt;Without going into details, I don't think it is likely to get an improvement. For Grover alone, you need to do &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/2})$&lt;/span&gt; steps and in each step, you basically do a rotation. This rotation is very unlikely to be Clifford, thus you apply &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/2})$&lt;/span&gt; non-Clifford gates. Any stabiliser-based simulation method eventually scales exponentially with the number of non-Clifford gates. Thus, this should explode very fast.&lt;/p&gt;&#xA;&lt;p&gt;(Well, this should hold for any simulation method in this context).&lt;/p&gt;&#xA;&lt;p&gt;So as long as you don't find a smart recompilation which reduces the &amp;quot;magic&amp;quot; in the circuit (which is probably highly non-trivial), I would say that there is not much to gain.&lt;/p&gt;&#xA;&lt;p&gt;Perhaps, you could have a look at the very recent &lt;a href=&quot;https://arxiv.org/abs/2101.12223&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; by Hakop Pashayan et al.&#xA;There is also a QIP talk on &lt;a href=&quot;https://www.youtube.com/watch?v=jwpPyjKIgNA&quot; rel=&quot;nofollow noreferrer&quot;&gt;Youtube&lt;/a&gt; from last week.&lt;/p&gt;&#xA;&lt;p&gt;Their technique is quite unique and might get you somewhere. So far, I cannot really judge how far, because I don't understand it well enough. But, they provide  an implementation of their algorithm on &lt;a href=&quot;https://github.com/or1426/Clifford-T-estimator&quot; rel=&quot;nofollow noreferrer&quot;&gt;github&lt;/a&gt; (Ref. [35] in their paper).&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-02-11T12:00:55.183" LastActivityDate="2021-02-11T12:00:55.183" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15986" PostTypeId="2" ParentId="15982" CreationDate="2021-02-11T10:14:54.527" Score="4" Body="&lt;p&gt;Firstly, how rude of them to use the word 'obviously' in their solution! If it was obvious then we wouldn't be trying their exercises in the first place!&lt;/p&gt;&#xA;&lt;p&gt;But anyway, Adam Zalcman described the solution very elegantly and succinctly! But for those wanting a more in-depth explanation of his answer, here it is:&lt;/p&gt;&#xA;&lt;p&gt;To understand the textbook solution a bit more, let's define an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as &amp;quot;if I act &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on an input state &lt;span class=&quot;math-container&quot;&gt;$|i_k\rangle$&lt;/span&gt;, it produces the output state &lt;span class=&quot;math-container&quot;&gt;$|o_k\rangle$&lt;/span&gt;&amp;quot;, or equivalently&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U|i_k\rangle = |o_k\rangle.$$&lt;/span&gt;&#xA;Let's now consider as set of orthogonal input states &lt;span class=&quot;math-container&quot;&gt;$|i_1\rangle, |i_2\rangle,...,|i_n\rangle$&lt;/span&gt; with their corresponding output states &lt;span class=&quot;math-container&quot;&gt;$|o_1\rangle, |o_2\rangle,...,|o_n\rangle$&lt;/span&gt;. We can now define the operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; explicitly as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U=|o_1\rangle\langle i_1| + |o_2\rangle\langle i_2| + ... +  |o_n\rangle\langle i_n|.$$&lt;/span&gt;&#xA;To see this with an example, let us compute &lt;span class=&quot;math-container&quot;&gt;$U|i_1\rangle$&lt;/span&gt; which should give us &lt;span class=&quot;math-container&quot;&gt;$|o_1\rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;U|i_1\rangle &amp;amp;= \left(|o_1\rangle\langle i_1| + |o_2\rangle\langle i_2| + ... +  |o_n\rangle\langle i_n|\right)|i_1\rangle\\&#xA;&amp;amp;=|o_1\rangle\underbrace{\langle i_1|i_1\rangle}_{= 1} + |o_2\rangle\underbrace{\langle i_2|i_1\rangle}_{= 0} + ... +  |o_n\rangle\underbrace{\langle i_n|i_1\rangle}_{= 0} \\&#xA;&amp;amp;=|o_1\rangle.&#xA;\end{align}$$&lt;/span&gt;&#xA;Because &lt;span class=&quot;math-container&quot;&gt;$|i_1\rangle$&lt;/span&gt; is orthogonal to every term except the first one, all the terms except the first one go to 0 and we are conveniently left with the desired output state &lt;span class=&quot;math-container&quot;&gt;$|o_1\rangle$&lt;/span&gt;! This is not a coincidence since we have done this by construction. You can try this calculation with any input state &lt;span class=&quot;math-container&quot;&gt;$|i_k\rangle$&lt;/span&gt; and you will see it will give you the desired output state &lt;span class=&quot;math-container&quot;&gt;$|o_k\rangle$&lt;/span&gt;. So going back to the specific case we are looking at, we have defined &lt;span class=&quot;math-container&quot;&gt;$U_H$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_H|0\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right) \\&#xA;U_H|1\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle-|1\rangle\right)$$&lt;/span&gt;&#xA;So we can use the same formulation as above to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_H = \frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right)\langle 0| + \frac{1}{\sqrt{2}}\left(|0\rangle-|1\rangle\right)\langle 1|$$&lt;/span&gt;&#xA;which gives us the first line of their solution. The second line of their solution comes from taking the equivalent definiton of &lt;span class=&quot;math-container&quot;&gt;$U_H$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_H\frac{1}{\sqrt{2}}\left(|0\rangle+|1\rangle\right) = |0\rangle \\&#xA;U_H\frac{1}{\sqrt{2}}\left(|0\rangle-|1\rangle\right) = |1\rangle$$&lt;/span&gt;&#xA;and performing the same steps as above.&#xA;(Note the last equivalent definition is specific to &lt;span class=&quot;math-container&quot;&gt;$U_H$&lt;/span&gt; and doesn't apply to all operators &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; because it just so happens that &lt;span class=&quot;math-container&quot;&gt;$U_H^{\dagger}=U_H$&lt;/span&gt;)&lt;/p&gt;&#xA;" OwnerUserId="14597" LastEditorUserId="14597" LastEditDate="2021-02-11T10:29:51.890" LastActivityDate="2021-02-11T10:29:51.890" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15987" PostTypeId="1" AcceptedAnswerId="15989" CreationDate="2021-02-11T10:42:06.510" Score="1" ViewCount="64" Body="&lt;p&gt;I would like to use qiskit to verify for generalized CNOT gates that, e.g. for 4 qubits&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\text{cu(0,3)} = |0\rangle\langle 0|\otimes1\!\!1\otimes1\!\!1\otimes1\!\!1 + |1\rangle\langle 1|\otimes1\!\!1\otimes1\!\!1\otimes\sigma_x &#xA;\end{equation}&lt;/span&gt;&#xA;with control on qubit 0 and target on qubit 3, and in particular showing that the matrix representation is the same. While I know that a way to do that in a qiskit circuit is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;test_cu = QuantumCircuit(n*2, n)&#xA;&#xA;test_cu.cx(0,3)&#xA;&#xA;backend_un = Aer.get_backend('unitary_simulator')&#xA;unitary = execute(test_cu, backend_un).result().get_unitary()&#xA;array_to_latex(unitary, pretext=&amp;quot;\\text{Circuit = } &amp;quot;)&#xA;&#xA;test_cu.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I don't have any idea on how to make the same from basic operators and using tensor product. I've read that &lt;code&gt;Aqua&lt;/code&gt; provides methods for this purpose, but I have nit found anything satisfying on the topic, neither in the official documentation (section tutorial). Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="12731" LastEditorUserId="55" LastEditDate="2021-02-11T14:25:39.643" LastActivityDate="2021-02-11T14:25:39.643" Title="Generic CNOT gate in qiskit from tensor product" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15988" PostTypeId="1" CreationDate="2021-02-11T13:22:32.523" Score="1" ViewCount="47" Body="&lt;p&gt;Regarding real quantum computers of IBM, can one execute a circuit that contains measurements and afterwards get counts and then, based on the results of measurements (from counts), decide if to build circuit A or circuit B that will be executed on the same quantum register with &lt;code&gt;init_qubits=False&lt;/code&gt; and with use of &lt;code&gt;rep_delay&lt;/code&gt; parameter, so that the chosen circuit, A or B will run on the quantum register with output state of the first circuit?&lt;/p&gt;&#xA;" OwnerUserId="8031" LastEditorUserId="1859" LastEditDate="2021-02-21T08:28:32.843" LastActivityDate="2021-02-21T18:37:13.117" Title="processing between sequential executions" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15989" PostTypeId="2" ParentId="15987" CreationDate="2021-02-11T13:27:24.373" Score="4" Body="&lt;p&gt;I believe you are looking for &lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.aqua.operators.html?highlight=operators#operators&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Operator class in Aqua&lt;/a&gt;.&lt;br /&gt;&#xA;For example, in order to create the Operator &lt;code&gt;cu03&lt;/code&gt; from your question, you can use the Pauli gates from the &lt;code&gt;operator_globals&lt;/code&gt; part of Qiskit, and &lt;code&gt;^&lt;/code&gt; is used as the tensor product between the gates&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators.operator_globals import Zero, One, I, X, Z&#xA;from sympy import Matrix &#xA;&#xA;op_00 = (0.5*(I+Z)) #the |0x0| state in Pauli representation&#xA;op_11 = (0.5*(I-Z)) #the |1x1| state in Pauli representation&#xA;&#xA;cu_03 = (op_00^I^I^I)+(op_11^I^I^X)&#xA;Matrix(cu_03.to_matrix()) #prints nicely the matrix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is this what you are looking for? If not please tell me :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-02-11T13:27:24.373" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15990" PostTypeId="2" ParentId="15988" CreationDate="2021-02-11T13:29:47.230" Score="2" Body="&lt;p&gt;Currently (Feb 2021), no. The run/measure/condition/run loop needs to be handled on user-side and it is not possible to preserve the state of quantum register among runs.&lt;/p&gt;&#xA;&lt;p&gt;However checkout the IBM Quantum Development Roadmap:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?t=154&amp;amp;v=bp7UFdtwdTw&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?t=154&amp;amp;v=bp7UFdtwdTw&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Jay Gambetta explains that in 2021 IBM will launch the &lt;em&gt;Quantum Runtime&lt;/em&gt;. By bringing together classical and quantum computation on the server-side you should be able to run a &lt;em&gt;Quantum Program&lt;/em&gt; that contains a similar logic to the one you are describing. However, you are interested in continuing a computation without reseting the quantum registers.&lt;/p&gt;&#xA;&lt;p&gt;In 3:32 of the same video, Jay describes &lt;em&gt;Dynamic Circuits&lt;/em&gt;. That's much closer to what you are searching for. Circuit with branching in them. They are planned for 2022.&lt;/p&gt;&#xA;&lt;p&gt;If you prefer reading over a video, here is the roadmap as a blog post: &lt;a href=&quot;https://www.ibm.com/blogs/research/2021/02/quantum-development-roadmap/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/blogs/research/2021/02/quantum-development-roadmap/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you are curious about how a &lt;em&gt;Quantum Program&lt;/em&gt; might look like, check the OpenQASM3 specification draft: &lt;a href=&quot;https://qiskit.github.io/openqasm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.github.io/openqasm/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update (Feb 2021):&lt;/strong&gt; In the direction towards dynamic circuit (and a positive answer to your question), today &lt;a href=&quot;https://www.ibm.com/blogs/research/2021/02/quantum-mid-circuit-measurement/&quot; rel=&quot;nofollow noreferrer&quot;&gt;is possible to do mid-circuit measurements in the IBMQ backends&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here, an example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmqx2')&#xA;&#xA;circuit = QuantumCircuit(1,2)&#xA;circuit.h(0)&#xA;circuit.measure(0,0)&#xA;circuit.x(0)&#xA;circuit.measure(0,1)&#xA;&#xA;display(circuit.draw('mpl'))&#xA;&#xA;result = execute(circuit, backend).result()&#xA;visualization.plot_histogram(result.get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EHMgJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EHMgJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5bAiD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5bAiD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This allows you to continue the execution after measurement. Consider that the first measurement colapses the superposition to either 0 or 1. The X gate flips that first result and then it is saved in the second classical bit.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-21T18:37:13.117" LastActivityDate="2021-02-21T18:37:13.117" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="15992" PostTypeId="1" CreationDate="2021-02-11T14:25:37.343" Score="3" ViewCount="35" Body="&lt;p&gt;I have been using &lt;a href=&quot;https://github.com/cryptogoth/skc-python&quot; rel=&quot;nofollow noreferrer&quot;&gt;this code&lt;/a&gt; to implement the Solovay-Kitaev algorithm for approximating arbitrary single qubit gates. One measure of success it gives is the 'Fowler distance'. I cant find a definition for the Fowler distance anywhere, and am wondering how it relates to the approximation error 'epsilon' used in proofs of the SK theorem (such as in Appendix 3 of Nielsen&amp;amp;Chuang). Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2021-02-11T14:25:37.343" Title="Fowler Distance in Solovay-Kitaev Algorithm" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="15993" PostTypeId="2" ParentId="15651" CreationDate="2021-02-11T15:57:29.997" Score="1" Body="&lt;p&gt;Most quantum circuit building softwares, including ProjectQ, do not have any convenience features that explicitly serve this purpose due to the potential overhead of calculating and storing the unitary as the number of qubits increases. The best solution is to create your own function that recovers the unitary. The general idea (software non-specific) is to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create your quantum function&lt;/li&gt;&#xA;&lt;li&gt;Iterate through each operation and obtain the matrix representation&lt;/li&gt;&#xA;&lt;li&gt;Multiply each unitary to get the final unitary representation of the circuit&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-02-11T15:57:29.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="15998" PostTypeId="2" ParentId="5525" CreationDate="2021-02-11T20:09:03.317" Score="4" Body="&lt;p&gt;I am not an expert in the field but there are a few points that I am aware of:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are proofs that certain quantum machine learning algorithms cannot be efficiently simulated on a classical computer even if the classical computer has analagous sampling access to the data as the quantum algorithm does (i.e. they cannot be &lt;em&gt;dequantized&lt;/em&gt;) [1-3]. However there is no proof that these algorithms are better at learning to classify certain datasets than the best classical algorithms out there.&lt;/li&gt;&#xA;&lt;li&gt;There is one paper out there proving that a certain quantum machine learning algorithm cannot be simulated efficiently using a classical computer &lt;em&gt;and&lt;/em&gt; can learn a specific classification task exponentially faster than any classical algorithm [4]. &lt;em&gt;However&lt;/em&gt; it is important to state that the algorithm and specific classification task mentioned in the paper are very contrived and hence it is not a useful task. To summarize, they use an SVM with a very particular quantum kernel on a dataset generated by the discrete log problem. Nonetheless it's a really neat proof-of-concept result and gives us some hope that quantum computing can bring a meaningful advantage to machine learning.&lt;/li&gt;&#xA;&lt;li&gt;As of today there is no example where we know that a quantum machine learning algorithm could outperform a classical machine learning algorithm in any meaningful task, but a recent paper has suggested a methodology for assessing the potential for quantum advantage in prediction on learning tasks [5]. However the proofs in classical machine learning are also quite few and far in between, so given the above two points, people are hopeful that when quantum computers become powerful enough to try some QML algorithms out, we would've advanced in the field enough that we are likely to find some use cases where we find advantage.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;[1] &lt;a href=&quot;https://www.nature.com/articles/s41586-019-0980-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41586-019-0980-2&lt;/a&gt;&lt;br /&gt;&#xA;[2] &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.122.040504&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.122.040504&lt;/a&gt;&lt;br /&gt;&#xA;[3] &lt;a href=&quot;https://advances.sciencemag.org/content/4/12/eaat9004&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://advances.sciencemag.org/content/4/12/eaat9004&lt;/a&gt;&lt;br /&gt;&#xA;[4] &lt;a href=&quot;https://arxiv.org/abs/2010.02174&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2010.02174&lt;/a&gt;&lt;br /&gt;&#xA;[5] &lt;a href=&quot;https://arxiv.org/abs/2011.01938&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2011.01938&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-11T20:09:03.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="15999" PostTypeId="1" CreationDate="2021-02-11T22:43:37.137" Score="2" ViewCount="39" Body="&lt;p&gt;Up until now I assumed (in simple words) that a qubit collapses because of the heisenberg uncertainty principle, meaning that we can not measure a qubit without changing it state.&lt;br /&gt;&#xA;But now I've read about the concept of quantum decoherence that describes why a qubit collapses after measuring it.&lt;/p&gt;&#xA;&lt;p&gt;So my question is do the heisenberg uncertainty principle and quantum decoherence relate in some way?&#xA;If so, is my assumption about the heisenberg uncertainty principle right, or is it much more complex?&lt;/p&gt;&#xA;" OwnerUserId="14430" LastEditorUserId="55" LastEditDate="2021-02-14T18:48:02.307" LastActivityDate="2021-02-14T18:48:02.307" Title="Do the Heisenberg uncertainty principle and quantum decoherence relate in some way?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;decoherence&gt;&lt;interpretations&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16002" PostTypeId="2" ParentId="4870" CreationDate="2021-02-12T01:02:39.360" Score="-1" Body="&lt;p&gt;SFAIK, and still have seen nothing to contradict this, the main use of qubits is in simulations where actual quantum elements replace faux stochastic elements from traditional modeling. Thus it's a very useful but also pretty narrow thing that is in no way comparable to ubiquitous modern digital computing elements and has absolutely no path to replacing them. Somehow in all the blather, promotional, stock prospecti, etc. this gets lost.&lt;/p&gt;&#xA;&lt;p&gt;So at the end of the day when IBM or whoever has squeezed all they can get out of this and quantum computing is mature and has replaced the aformentioned psuedo random simulation elements, bits, outside those models, some crypto, etc., will still be the same ol ubiquitous bits and presumably by that time the information in this reply will be common knowledge to those capable of processing it.&lt;/p&gt;&#xA;" OwnerUserId="14822" LastActivityDate="2021-02-12T01:02:39.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16003" PostTypeId="1" AcceptedAnswerId="16004" CreationDate="2021-02-12T01:09:22.737" Score="4" ViewCount="75" Body="&lt;p&gt;I have a list of quantum circuits called &lt;code&gt;all_circuits&lt;/code&gt;. I tried to run those circuits on a quantum computer by submitting the jobs to the IBM job manager:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile, assemble&#xA;from qiskit.providers.ibmq.managed import IBMQJobManager&#xA;&#xA;for i in range(len(all_circuits)):    # Submit a single job, and transpile everything just once. &#xA;    all_circuits[i] = transpile(all_circuits[i],backend=backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm wondering after transpiling the whole list of circuit, is it still possible for me to modify  an element in the transpiled list, like adding a gate &lt;em&gt;&lt;strong&gt;at a particular place&lt;/strong&gt;&lt;/em&gt;?&lt;/p&gt;&#xA;&lt;p&gt;For instance, if each circuit in my list have the following elements (I'm not so sure if this is a good example haha):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3,3)&#xA;qc.H(0)&#xA;qc.crx(a,2,1) # Suppose a is some random parameter&#xA;***Here!***&#xA;qc.barrier()&#xA;qc.H([1,2])&#xA;qc.cx(1,3)&#xA;qc.measure(...)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I don't think that transpiling a circuit will mix the gates on the two sides of the barrier (the barrier will also be kept), so can I transpile all circuits first, then add a &lt;code&gt;CNOT&lt;/code&gt; gate &lt;code&gt;qc.cx(0,2)&lt;/code&gt; right before the barrier (marked as 'Here!') to &lt;em&gt;&lt;strong&gt;each transpiled circuit, not original one&lt;/strong&gt;&lt;/em&gt; ? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-02-12T01:30:44.207" LastActivityDate="2021-02-12T08:39:18.787" Title="Can I adjust the quantum circuit after transpiling it?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16004" PostTypeId="2" ParentId="16003" CreationDate="2021-02-12T01:43:13.860" Score="2" Body="&lt;p&gt;Yes. You can just add gates as usual.&lt;/p&gt;&#xA;&lt;p&gt;For example: Suppose that we have the following random circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.random import random_circuit&#xA;num_qubits = 2&#xA;circuit_depth = 3&#xA;max_operands = 1 #between 0 and 3&#xA;measurement_all_qubit = True&#xA;qc_random = random_circuit(num_qubits, circuit_depth, max_operands=max_operands, measure= None)&#xA;print(qc_random)&#xA;&#xA;             ┌────────────┐       ┌────────────┐┌────────────┐&#xA;q_0: ────────┤ RZ(5.6174) ├───────┤ U1(5.5484) ├┤ RX(6.0937) ├&#xA;     ┌───────┴────────────┴──────┐├────────────┤├────────────┤&#xA;q_1: ┤ U3(0.96086,4.3412,1.4989) ├┤ RZ(4.7727) ├┤ U1(3.1479) ├&#xA;     └───────────────────────────┘└────────────┘└────────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can transpiled it to &lt;code&gt;ibmq_athens&lt;/code&gt; to get:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;provider = IBMQ.load_account()&#xA;Circuit_Transpile = transpile(qc_random, provider.get_backend('ibmq_athens') , optimization_level=3)&#xA;print(Circuit_Transpile)&#xA;               ┌────────────┐┌────┐┌────────────┐                    &#xA;      q_0 -&amp;gt; 0 ┤ RZ(2.1427) ├┤ √X ├┤ RZ(3.8622) ├────────────────────&#xA;               ├────────────┤├────┤├────────────┤┌────┐┌────────────┐&#xA;      q_1 -&amp;gt; 1 ┤ RZ(-3.245) ├┤ √X ├┤ RZ(4.3157) ├┤ √X ├┤ RZ(1.2987) ├&#xA;               └────────────┘└────┘└────────────┘└────┘└────────────┘&#xA;ancilla_0 -&amp;gt; 2 ──────────────────────────────────────────────────────&#xA;                                                                     &#xA;ancilla_1 -&amp;gt; 3 ──────────────────────────────────────────────────────&#xA;                                                                     &#xA;ancilla_2 -&amp;gt; 4 ──────────────────────────────────────────────────────&#xA;                                                                     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, we can just add additional gates on top of this transpiled circuit called &amp;quot;Circuit_Transpile&amp;quot; as you would normally do before. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(5):&#xA;    Circuit_Transpile.h(i)&#xA;print(Circuit_Transpile)&#xA;&#xA;               ┌────────────┐┌────┐┌────────────┐┌───┐                    &#xA;      q_0 -&amp;gt; 0 ┤ RZ(2.1427) ├┤ √X ├┤ RZ(3.8622) ├┤ H ├────────────────────&#xA;               ├────────────┤├────┤├────────────┤├───┴┐┌────────────┐┌───┐&#xA;      q_1 -&amp;gt; 1 ┤ RZ(-3.245) ├┤ √X ├┤ RZ(4.3157) ├┤ √X ├┤ RZ(1.2987) ├┤ H ├&#xA;               └───┬───┬────┘└────┘└────────────┘└────┘└────────────┘└───┘&#xA;ancilla_0 -&amp;gt; 2 ────┤ H ├──────────────────────────────────────────────────&#xA;                   ├───┤                                                  &#xA;ancilla_1 -&amp;gt; 3 ────┤ H ├──────────────────────────────────────────────────&#xA;                   ├───┤                                                  &#xA;ancilla_2 -&amp;gt; 4 ────┤ H ├──────────────────────────────────────────────────&#xA;                   └───┘                                                  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hopefully this helps.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems like your circuit have two parts that is being divided by the circuit barrier, and you want to add gate into the middle of the circuit (after the barrier) after the transpilation process. If that is the case, then what you can do is to split the two parts of the circuit into two different circuits then compose them together after the transpilation process. For instance:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.random import random_circuit&#xA;num_qubits = 2&#xA;circuit_depth = 3&#xA;max_operands = 1 #between 0 and 3&#xA;measurement_all_qubit = True&#xA;qc_random1 = random_circuit(num_qubits, circuit_depth, max_operands=max_operands, measure= None)&#xA;qc_random1.barrier(range(2))&#xA;qc_random2 = random_circuit(num_qubits, circuit_depth, max_operands=max_operands, measure= None)&#xA;qc_random2.barrier(range(2))&#xA;print(qc_random1)&#xA;print(qc_random2)&#xA;&#xA;     ┌───┐ ┌────────────┐    ┌───┐      ░ &#xA;q_0: ┤ X ├─┤ U1(2.7235) ├────┤ X ├──────░─&#xA;     ├───┤┌┴────────────┤┌───┴───┴────┐ ░ &#xA;q_1: ┤ Z ├┤ RX(0.94815) ├┤ RX(2.0345) ├─░─&#xA;     └───┘└─────────────┘└────────────┘ ░ &#xA;     ┌────────────────────┐    ┌───┐     ┌────────────┐ ░ &#xA;q_0: ┤ U2(0.28027,1.7582) ├────┤ X ├─────┤ RZ(4.5689) ├─░─&#xA;     ├───────────────────┬┘┌───┴───┴────┐└───┬───┬────┘ ░ &#xA;q_1: ┤ U2(1.6123,1.6426) ├─┤ RZ(6.1746) ├────┤ S ├──────░─&#xA;     └───────────────────┘ └────────────┘    └───┘      ░ &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, do the transpilation as you would have normally do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;provider = IBMQ.load_account()&#xA;Circuit_Transpile1 = transpile(qc_random1, provider.get_backend('ibmq_athens') , optimization_level=3)&#xA;Circuit_Transpile2 = transpile(qc_random2, provider.get_backend('ibmq_athens') , optimization_level=3)&#xA;print(Circuit_Transpile1)&#xA;print(Circuit_Transpile2)&#xA;&#xA;               ┌────────────┐                                      ░ &#xA;      q_0 -&amp;gt; 0 ┤ RZ(3.5597) ├──────────────────────────────────────░─&#xA;               └┬──────────┬┘┌────┐┌────────────┐┌────┐┌─────────┐ ░ &#xA;      q_1 -&amp;gt; 1 ─┤ RZ(-π/2) ├─┤ √X ├┤ RZ(6.1242) ├┤ √X ├┤ RZ(π/2) ├─░─&#xA;                └──────────┘ └────┘└────────────┘└────┘└─────────┘ ░ &#xA;ancilla_0 -&amp;gt; 2 ──────────────────────────────────────────────────────&#xA;                                                                     &#xA;ancilla_1 -&amp;gt; 3 ──────────────────────────────────────────────────────&#xA;                                                                     &#xA;ancilla_2 -&amp;gt; 4 ──────────────────────────────────────────────────────&#xA;                                                                     &#xA;global phase: 0.29049&#xA;                ┌───────────┐  ┌────┐┌────────────┐ ░ &#xA;      q_0 -&amp;gt; 0 ─┤ RZ(3.329) ├──┤ √X ├┤ RZ(5.8595) ├─░─&#xA;               ┌┴───────────┴─┐├────┤├────────────┤ ░ &#xA;      q_1 -&amp;gt; 1 ┤ RZ(0.071774) ├┤ √X ├┤ RZ(4.6453) ├─░─&#xA;               └──────────────┘└────┘└────────────┘ ░ &#xA;ancilla_0 -&amp;gt; 2 ───────────────────────────────────────&#xA;                                                      &#xA;ancilla_1 -&amp;gt; 3 ───────────────────────────────────────&#xA;                                                      &#xA;ancilla_2 -&amp;gt; 4 ───────────────────────────────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Now&lt;/strong&gt;, add gates that you wanted to add to the first circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for i in range(2):&#xA;    Circuit_Transpile1.h(i)&#xA;print(Circuit_Transpile1)&#xA;&#xA;               ┌────────────┐                                      ░ ┌───┐&#xA;      q_0 -&amp;gt; 0 ┤ RZ(3.5597) ├──────────────────────────────────────░─┤ H ├&#xA;               └┬──────────┬┘┌────┐┌────────────┐┌────┐┌─────────┐ ░ ├───┤&#xA;      q_1 -&amp;gt; 1 ─┤ RZ(-π/2) ├─┤ √X ├┤ RZ(6.1242) ├┤ √X ├┤ RZ(π/2) ├─░─┤ H ├&#xA;                └──────────┘ └────┘└────────────┘└────┘└─────────┘ ░ └───┘&#xA;ancilla_0 -&amp;gt; 2 ───────────────────────────────────────────────────────────&#xA;                                                                          &#xA;ancilla_1 -&amp;gt; 3 ───────────────────────────────────────────────────────────&#xA;                                                                          &#xA;ancilla_2 -&amp;gt; 4 ───────────────────────────────────────────────────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then &lt;strong&gt;compose&lt;/strong&gt; them together to formed a full circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Circuit_Transpile1.compose(Circuit_Transpile2, inplace = True)&#xA;print(Circuit_Transpile1)&#xA;&#xA;               ┌────────────┐                                      ░ ┌───┐»&#xA;      q_0 -&amp;gt; 0 ┤ RZ(3.5597) ├──────────────────────────────────────░─┤ H ├»&#xA;               └┬──────────┬┘┌────┐┌────────────┐┌────┐┌─────────┐ ░ ├───┤»&#xA;      q_1 -&amp;gt; 1 ─┤ RZ(-π/2) ├─┤ √X ├┤ RZ(6.1242) ├┤ √X ├┤ RZ(π/2) ├─░─┤ H ├»&#xA;                └──────────┘ └────┘└────────────┘└────┘└─────────┘ ░ └───┘»&#xA;ancilla_0 -&amp;gt; 2 ───────────────────────────────────────────────────────────»&#xA;                                                                          »&#xA;ancilla_1 -&amp;gt; 3 ───────────────────────────────────────────────────────────»&#xA;                                                                          »&#xA;ancilla_2 -&amp;gt; 4 ───────────────────────────────────────────────────────────»&#xA;                                                                          »&#xA;«                ┌───────────┐  ┌────┐┌────────────┐ ░ &#xA;«      q_0 -&amp;gt; 0 ─┤ RZ(3.329) ├──┤ √X ├┤ RZ(5.8595) ├─░─&#xA;«               ┌┴───────────┴─┐├────┤├────────────┤ ░ &#xA;«      q_1 -&amp;gt; 1 ┤ RZ(0.071774) ├┤ √X ├┤ RZ(4.6453) ├─░─&#xA;«               └──────────────┘└────┘└────────────┘ ░ &#xA;«ancilla_0 -&amp;gt; 2 ───────────────────────────────────────&#xA;«                                                      &#xA;«ancilla_1 -&amp;gt; 3 ───────────────────────────────────────&#xA;«                                                      &#xA;«ancilla_2 -&amp;gt; 4 ───────────────────────────────────────&#xA;«                                                      &#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-12T08:39:18.787" LastActivityDate="2021-02-12T08:39:18.787" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16005" PostTypeId="1" CreationDate="2021-02-12T04:25:42.450" Score="1" ViewCount="73" Body="&lt;p&gt;I am new to QC and right now trying to understand Grover’s algorithm. In Qiskit documents, in the section about solving Sudoku using Grover’s, the first step is explained to be creating three register: &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$|c\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|out\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The next step is to initialize &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle$&lt;/span&gt;. I get up to here.&lt;/p&gt;&#xA;&lt;p&gt;Then we apply controlled Not gates to flip the &lt;span class=&quot;math-container&quot;&gt;$|c\rangle$&lt;/span&gt; (clause) registers. Here I am stuck because I thought doing a CNOT on &lt;span class=&quot;math-container&quot;&gt;$|0+\rangle$&lt;/span&gt; leads to entangled states.&lt;/p&gt;&#xA;&lt;p&gt;The Qiskit document is here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Do the states really get entangled and if so how can the rest of the circuit work whilst considering the individual qubits?&lt;/p&gt;&#xA;" OwnerUserId="14823" LastEditorUserId="14823" LastEditDate="2021-03-03T00:59:20.187" LastActivityDate="2021-04-02T01:06:55.787" Title="Do states get entangled in Grover’s algorithm?" Tags="&lt;entanglement&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16006" PostTypeId="1" AcceptedAnswerId="16007" CreationDate="2021-02-12T07:15:13.423" Score="4" ViewCount="99" Body="&lt;p&gt;I know the Solovay-Kitaev algorithm can achieve this. Is there an implementation of this or any other algorithm for the same task in Qiskit? Or perhaps some other library that interfaces well with Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="13497" LastEditorUserId="55" LastEditDate="2021-02-16T08:58:10.413" LastActivityDate="2021-02-16T08:58:10.413" Title="How can I find a Clifford+T approximation of an arbitrary one qubit gate in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16007" PostTypeId="2" ParentId="16006" CreationDate="2021-02-12T08:24:53.933" Score="4" Body="&lt;p&gt;On the Qiskit front, a Solovay-Kitaev algorithm implementation is on its way &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/5657&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/5657&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you want to use or have a look to this &lt;code&gt;LNoorl:feature/sk-pass&lt;/code&gt; branch (remember is a WIP), you can install it like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/LNoorl/qiskit-terra.git@feature/sk-pass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is a usage example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;from qiskit.circuit.library import TGate, HGate, TdgGate&#xA;from qiskit.transpiler.passes import SolovayKitaevDecomposition&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.rx(0.7, 0)&#xA;&#xA;print('Orginal circuit:')&#xA;print(circuit)&#xA;&#xA;basis_gates = [TGate(), TdgGate(), HGate()]&#xA;skd = SolovayKitaevDecomposition(recursion_degree=2, basis_gates=basis_gates, depth=5)&#xA;&#xA;discretized = skd(circuit)&#xA;&#xA;print('Discretized circuit:')&#xA;print(discretized)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;Orginal circuit:&#xA;     ┌─────────┐&#xA;q_0: ┤ RX(0.7) ├&#xA;     └─────────┘&#xA;Discretized circuit:&#xA;global phase: -π/8&#xA;     ┌───┐┌───┐┌───┐┌─────┐┌───┐┌───┐┌───┐┌───┐┌───┐┌─────┐┌───┐┌───┐┌───┐»&#xA;q_0: ┤ H ├┤ T ├┤ H ├┤ TDG ├┤ H ├┤ T ├┤ H ├┤ T ├┤ H ├┤ TDG ├┤ H ├┤ T ├┤ H ├»&#xA;     └───┘└───┘└───┘└─────┘└───┘└───┘└───┘└───┘└───┘└─────┘└───┘└───┘└───┘»&#xA;«     ┌─────┐┌───┐┌─────┐┌─────┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌─────┐»&#xA;«q_0: ┤ TDG ├┤ H ├┤ TDG ├┤ TDG ├┤ H ├┤ T ├┤ H ├┤ T ├┤ T ├┤ H ├┤ T ├┤ H ├┤ TDG ├»&#xA;«     └─────┘└───┘└─────┘└─────┘└───┘└───┘└───┘└───┘└───┘└───┘└───┘└───┘└─────┘»&#xA;«     ┌─────┐┌───┐┌─────┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌─────┐┌───┐┌─────┐»&#xA;«q_0: ┤ TDG ├┤ H ├┤ TDG ├┤ H ├┤ T ├┤ H ├┤ T ├┤ H ├┤ T ├┤ H ├┤ TDG ├┤ H ├┤ TDG ├»&#xA;«     └─────┘└───┘└─────┘└───┘└───┘└───┘└───┘└───┘└───┘└───┘└─────┘└───┘└─────┘»&#xA;«     ┌─────┐┌───┐┌─────┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌─────┐&#xA;«q_0: ┤ TDG ├┤ H ├┤ TDG ├┤ H ├┤ T ├┤ T ├┤ H ├┤ T ├┤ H ├┤ TDG ├&#xA;«     └─────┘└───┘└─────┘└───┘└───┘└───┘└───┘└───┘└───┘└─────┘&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-12T12:09:12.607" LastActivityDate="2021-02-12T12:09:12.607" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16008" PostTypeId="1" CreationDate="2021-02-12T08:43:30.407" Score="2" ViewCount="55" Body="&lt;p&gt;The definition of Qiskit &lt;code&gt;CircuitStateFn.eval()&lt;/code&gt; is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def eval(self,&#xA;         front: Union[str, dict, np.ndarray,&#xA;                      OperatorBase] = None) -&amp;gt; Union[OperatorBase, float, complex]:&#xA;    if not self.is_measurement and isinstance(front, OperatorBase):&#xA;        raise ValueError(&#xA;            'Cannot compute overlap with StateFn or Operator if not Measurement. Try taking '&#xA;            'sf.adjoint() first to convert to measurement.')&#xA;&#xA;    # pylint: disable=import-outside-toplevel&#xA;    from ..list_ops.list_op import ListOp&#xA;    from ..primitive_ops.pauli_op import PauliOp&#xA;    from ..primitive_ops.matrix_op import MatrixOp&#xA;    from ..primitive_ops.circuit_op import CircuitOp&#xA;&#xA;    if isinstance(front, ListOp) and front.distributive:&#xA;        return front.combo_fn([self.eval(front.coeff * front_elem)&#xA;                               for front_elem in front.oplist])&#xA;&#xA;    # Composable with circuit&#xA;    if isinstance(front, (PauliOp, CircuitOp, MatrixOp, CircuitStateFn)):&#xA;        new_front = self.compose(front)&#xA;        return new_front.eval()&#xA;&#xA;    return self.to_matrix_op().eval(front)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the last line &lt;code&gt;to_matrix_op()&lt;/code&gt; is called without any arguments. However, in order to work properly for more than 16 qubits, it has to be provided with an additional argument &lt;code&gt;massive = True&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def to_matrix(self, massive: bool = False) -&amp;gt; np.ndarray:&#xA;    if self.num_qubits &amp;gt; 16 and not massive:&#xA;        raise ValueError(&#xA;            'to_vector will return an exponentially large vector, in this case {0} elements.'&#xA;            ' Set massive=True if you want to proceed.'.format(2 ** self.num_qubits))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So how do I use &lt;code&gt;CircuitStateFn.eval()&lt;/code&gt; for more than 16 qubits??&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2021-02-16T08:58:18.603" LastActivityDate="2021-02-16T08:58:18.603" Title="Qiskit CircuitStateFn.eval() on more than 16 qubits" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16009" PostTypeId="1" CreationDate="2021-02-12T09:51:29.497" Score="5" ViewCount="56" Body="&lt;p&gt;First time poster and just started with quantum computing for my master thesis, so I'm sorry if the question seems obvious.&lt;/p&gt;&#xA;&lt;p&gt;I understand that the tomography is used to reconstruct the state and/or process of a quantum circuit, without directly measuring the used qubits but instead using many 'copies' of it. What we then get is the quantum state as a density matrix or the quantum process in e.g. choi matrix representation.&lt;/p&gt;&#xA;&lt;p&gt;But isn't this process of tomography way too costly to really make use of it?&#xA;If I understand it correctly, we could use this choi matrix representation to replace our circuit process, but does it improve something?&#xA;And can we use the state tomography for anything else than verification/error mitigation?&lt;/p&gt;&#xA;" OwnerUserId="14826" LastEditorUserId="55" LastEditDate="2021-02-16T08:58:39.720" LastActivityDate="2021-02-16T08:58:39.720" Title="What is quantum tomography useful for?" Tags="&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16010" PostTypeId="1" CreationDate="2021-02-12T10:46:08.133" Score="0" ViewCount="51" Body="&lt;p&gt;I am confused of all that different Quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;please correct me if I say something wrong.&lt;/p&gt;&#xA;&lt;p&gt;There are two main different types of quantum computing:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Quantum Gates based computing&lt;/li&gt;&#xA;&lt;li&gt;quantum annealing&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For quantum gate based computing, I know that there are different kind of architectures -- that's clear for me.&lt;/p&gt;&#xA;&lt;p&gt;But why I am so confused is, there is the Quantum Annealing, which is used by D-Wave Systems and that Q. annealer is using the adiabatic theorem , right ?&lt;/p&gt;&#xA;&lt;p&gt;So then we can say that Adiabatic Quantum Annealer = Quantum Annealer ?&lt;/p&gt;&#xA;&lt;p&gt;The next confusing term is Adiabatic Quantum Computer , is that Adiabatic Quantum Annealer?&lt;/p&gt;&#xA;&lt;p&gt;And the last is what is Quantum Simulator ? Where is that used ? which type of quantum computing are that simulated? And is there a difference between them and quantum annealing ?&lt;/p&gt;&#xA;&lt;p&gt;Too many questions :/&lt;/p&gt;&#xA;" OwnerUserId="12711" LastEditorUserId="12711" LastEditDate="2021-02-12T12:47:30.603" LastActivityDate="2021-02-12T12:47:30.603" Title="Types of Quantum Computer" Tags="&lt;quantum-gate&gt;&lt;simulation&gt;&lt;adiabatic-model&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2021-02-13T23:07:54.540" ContentLicense="CC BY-SA 4.0" />
  <row Id="16011" PostTypeId="2" ParentId="2154" CreationDate="2021-02-12T11:05:59.930" Score="1" Body="&lt;p&gt;As far as I know the distance record was obtained in the &lt;a href=&quot;https://arxiv.org/abs/0811.3129&quot; rel=&quot;nofollow noreferrer&quot;&gt;Canary islands experiment&lt;/a&gt;, where Alice and Bob were 144 km apart.&lt;/p&gt;&#xA;&lt;p&gt;There &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0007008&quot; rel=&quot;nofollow noreferrer&quot;&gt;exists a paper&lt;/a&gt; that directly does what you want, lowerbound the &amp;quot;speed of quantum information&amp;quot;. They obtain the bound &lt;span class=&quot;math-container&quot;&gt;$1.5 \times 10^4 c$&lt;/span&gt;. I read it as a work of comedy. Nobody thinks that quantum information is actually being transmitted faster-than-light in order to produce the experimental results. The collapse of the wavefunction is not physical.&lt;/p&gt;&#xA;&lt;p&gt;There's also &lt;a href=&quot;https://arxiv.org/abs/1110.3795&quot; rel=&quot;nofollow noreferrer&quot;&gt;a subtler argument&lt;/a&gt; that shows we can't get away with &lt;em&gt;any&lt;/em&gt; finite speed. If you think collapse is real it must happen literally instantaneously in the whole universe at once.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-02-12T11:05:59.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16012" PostTypeId="1" CreationDate="2021-02-12T13:48:17.517" Score="3" ViewCount="54" Body="&lt;p&gt;When decomposing an arbitrary SU(2) matrix into elements from a universal gate set (i.e. with the Solovay-Kitaev Theorem) we try to get the lowest error possible, which leads to 'chains' of these elementary gates becoming very long.&lt;/p&gt;&#xA;&lt;p&gt;E.g. some arbitrary SU(2) might be approximated with the decomposition THTSHTHTHT (this is just a random sequence from the {H,T,S} universal gate set that I have typed).&lt;/p&gt;&#xA;&lt;p&gt;But when we implement this chain in a physical quantum computer each gate will have a non-zero error associated with it. This means a longer chain length both reduces the total error (through higher precision estimation) and increases it (through each gate in the chain contributing to the total error).&lt;/p&gt;&#xA;&lt;p&gt;My question is: how can the error propagation of the chain length be calculated. For example if all gates have a fidelity of 99.99%, is the total error of a chain of length 10 just 0.9999^(10)? I have been told that the worst case scenario would be to add the errors of each gate linearly, but I am confused to how this works.&lt;/p&gt;&#xA;&lt;p&gt;I am trying to optimise the chain length to reduce the total error (balancing the longer chain length leading to a more precise approximation, and the longer chain length increasing error through imperfect gates in the chain).&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any help and sorry if the wording of the question is poor.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2021-02-12T14:57:01.880" Title="Error Propagation in quantum gates" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16013" PostTypeId="2" ParentId="16012" CreationDate="2021-02-12T14:57:01.880" Score="1" Body="&lt;p&gt;Usually, you use such a finite gate set in a fault tolerant scenario, acting on logical qubits. If you're working with physical qubits, you can often make the single-qubit gate directly. But in the fault-tolerant scenario, you would usually do a round of error correction between each elementary gate. It is the structure of the fault-tolerant error correction that prevents those errors from accumulating. So I don't think the sort of calculation that you're talking about is particularly relevant.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-12T14:57:01.880" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16014" PostTypeId="2" ParentId="15828" CreationDate="2021-02-12T19:03:40.417" Score="0" Body="&lt;p&gt;Metadata is accessed through execution result, not simulator configuration.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(result.results[0].metadata['fusion'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note: fusion optimization is enabled only if your circuit contains at least 14 qubits. To lower this value, use &lt;code&gt;fusion_threshold&lt;/code&gt; option.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-02-12T19:03:40.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16015" PostTypeId="1" AcceptedAnswerId="16016" CreationDate="2021-02-12T19:06:54.187" Score="0" ViewCount="32" Body="&lt;p&gt;I am continuing my work on the SAT katas, but I thing I am missing something on the way the tuple data type works. In this example code, I am trying to access the data in a tuple type :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let clause = [(0, false), (1, true)];&#xA;using (testRegister = qubit[2]) {&#xA;    for i in clause {&#xA;        if i[1] == false {&#xA;            X(testRegister[i[0]]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Executing this code will return the error : &lt;code&gt;error QS5004: The type (Int, Bool) does not provide item access. Items can only be accessed for values of array type.&lt;/code&gt; I have trouble understanding this error as it states that the tuple's different values cannot be accessed, or am I not doing it the correct way ? I am definitely not trying to modify these !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="55" LastEditDate="2021-02-16T08:58:55.763" LastActivityDate="2021-02-16T08:58:55.763" Title="Accessing tupple data in Q#" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16016" PostTypeId="2" ParentId="16015" CreationDate="2021-02-12T19:58:46.273" Score="1" Body="&lt;p&gt;The subscripting operator (&lt;code&gt;[]&lt;/code&gt;) in Q# only works on values of array types, such as &lt;code&gt;Int[]&lt;/code&gt;, &lt;code&gt;Qubit[]&lt;/code&gt; or &lt;code&gt;Double[][]&lt;/code&gt;. To unpack a tuple, you can &lt;em&gt;deconstruct&lt;/em&gt; when you assign the tuple in a &lt;code&gt;let&lt;/code&gt; statement or &lt;code&gt;for&lt;/code&gt; loop:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let clauses = [(0, false), (1, true)];&#xA;using (testRegister = qubit[2]) {&#xA;    for (idx, value) in clauses {&#xA;        if not value {&#xA;            X(testRegister[idx]);&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;// Alternatively:&#xA;let clauses = [(0, false), (1, true)];&#xA;using (testRegister = qubit[2]) {&#xA;    for clause in clauses {&#xA;        let (idx, value) = clause;&#xA;        if not value {&#xA;            X(testRegister[idx]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The Q# standard library also provides two convenience functions, &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.canon.fst&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Fst&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/qsharp/api/qsharp/microsoft.quantum.canon.snd&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;Snd&lt;/code&gt;&lt;/a&gt; for working with pairs (that is, tuples of two elements):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let clauses = [(0, false), (1, true)];&#xA;using (testRegister = qubit[2]) {&#xA;    for clause in clauses {&#xA;        if Snd(clause) {&#xA;            X(testRegister[Fst(idx)]);&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To see why this is needed, Q# arrays are always &lt;em&gt;homogeneous&lt;/em&gt; in type. For example, if &lt;code&gt;arr&lt;/code&gt; has type &lt;code&gt;'T[]&lt;/code&gt;, then &lt;code&gt;arr[idx]&lt;/code&gt; is always of type &lt;code&gt;'T&lt;/code&gt;, as long as &lt;code&gt;idx&lt;/code&gt; is within the range of valid indices for &lt;code&gt;arr&lt;/code&gt;. By contrast, tuples can be heterogeneous in type; in your example, &lt;code&gt;clauses&lt;/code&gt; has type &lt;code&gt;(Int, Bool)[]&lt;/code&gt;, such that the first and second parts of &lt;code&gt;clauses[0]&lt;/code&gt; have different types. If the subscripting operator were supported for tuples, &lt;code&gt;clauses[0][0]&lt;/code&gt; would thus have a different type from &lt;code&gt;clauses[0][1]&lt;/code&gt;; in particular, the type of an expression like &lt;code&gt;clauses[0][idx]&lt;/code&gt; could not be inferred at compile type, since the expression would have a different type depending on whether &lt;code&gt;idx&lt;/code&gt; is 0 or 1.&lt;/p&gt;&#xA;&lt;p&gt;This is a large part of why, to help make quantum programs that work reliably and predictably while allowing the flexiblity and power of tuples, Q# offers destructuring and functions like &lt;code&gt;Fst&lt;/code&gt; and &lt;code&gt;Snd&lt;/code&gt; to help work with tuples.&lt;/p&gt;&#xA;" OwnerUserId="1978" LastActivityDate="2021-02-12T19:58:46.273" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16017" PostTypeId="2" ParentId="14786" CreationDate="2021-02-12T22:05:34.820" Score="0" Body="&lt;p&gt;I would start by rewriting the same state in different bases:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; basis: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|++\rangle-|--\rangle\right)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$XZ$&lt;/span&gt; basis: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\left(|+1\rangle+|-1\rangle+|+0\rangle-|-0\rangle\right)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ZX$&lt;/span&gt; basis: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}\left(|0+\rangle-|0-\rangle+|1+\rangle+|1-\rangle\right)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; basis: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|01\rangle+|10\rangle\right)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Now we can look at all the possibilities where &lt;span class=&quot;math-container&quot;&gt;$M_1M_2$&lt;/span&gt; indicates first measuring the first qubit in the &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; basis and then measuring the second qubit in the &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; basis:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X_1X_2$&lt;/span&gt;:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(X_1=1) = \frac{1}{2}, P(X_2=1|X_1=1) = 1, P(X_2=-1|X_1=1) = 0$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(X_1=-1) = \frac{1}{2}, P(X_2=1|X_1=-1) = 0, P(X_2=-1|X_1=-1) = 1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X_1Z_2$&lt;/span&gt;:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(X_1=1) = \frac{1}{2}, P(Z_2=1|X_1=1) = \frac{1}{2}, P(Z_2=-1|X_1=1) = \frac{1}{2}$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(X_1=-1) = \frac{1}{2}, P(Z_2=1|X_1=-1) = \frac{1}{2}, P(Z_2=-1|X_1=-1) = \frac{1}{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z_1X_2$&lt;/span&gt;:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(Z_1=1) = \frac{1}{2}, P(X_2=1|Z_1=1) = \frac{1}{2}, P(X_2=-1|Z_1=1) = \frac{1}{2}$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(Z_1=-1) = \frac{1}{2}, P(X_2=1|Z_1=-1) = \frac{1}{2}, P(X_2=-1|Z_1=-1) = \frac{1}{2}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z_1Z_2$&lt;/span&gt;:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(Z_1=1) = \frac{1}{2}, P(Z_2=1|Z_1=1) = 0, P(Z_2=-1|Z_1=1) = 1$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$P(Z_1=-1) = \frac{1}{2}, P(Z_2=1|Z_1=-1) = 1, P(Z_2=-1|Z_1=-1) = 0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In summary&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;if you're measuring in &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt;, it's &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; for the first measurement and the second measurement is fully correlated to the first one,&lt;/li&gt;&#xA;&lt;li&gt;if you're measuring in &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;, it's also &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; for the first measurement but the second measurement is fully anti-correlated to the first one,&lt;/li&gt;&#xA;&lt;li&gt;For the other two combinations, it's all &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt; for both measurements regardless of the outcome of the first measurement (because the two measurements happen to be completely uncorrelated).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-12T22:05:34.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16018" PostTypeId="2" ParentId="16005" CreationDate="2021-02-12T22:19:05.340" Score="1" Body="&lt;p&gt;Indeed the qubits do get entangled! It's not immediately very intuitive as to why the qubits have to be entangled for the Grover algorithm to work. I would recommend this tutorial on Grover's algorithm to understand why. If you're very new, I would start from the beginning. If you know what gates are but are not comfortable with the concept of changing basis, I would start on the slide called &amp;quot;Changing the basis&amp;quot; (page 26 on the pdf). If you are already comfortable with that, then you can straight away start on the slide called &amp;quot;Reflections&amp;quot; (page 40 on the pdf). And then keep going until the end of section on Amplitude Amplification (page 119 on the pdf)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://drive.google.com/file/d/14G_0TwdxBFpI_Ylj5lb_imVtcnunrQcB/view?usp=sharing&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://drive.google.com/file/d/14G_0TwdxBFpI_Ylj5lb_imVtcnunrQcB/view?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-02-12T22:19:05.340" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16020" PostTypeId="1" CreationDate="2021-02-12T23:10:23.837" Score="4" ViewCount="105" Body="&lt;p&gt;I am aware that it's possible to use QAOA to solve QUBO problems. However, I've recently seen some sources mentioning the possibility of solving HOBO/HUBO problems using QAOA as well &lt;a href=&quot;https://arxiv.org/abs/2009.07309&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;&lt;a href=&quot;https://medium.com/@minatoyuichiro/variational-quantum-factoring-using-qaoa-and-vqe-on-blueqat-29c6f4f195f1&quot; rel=&quot;nofollow noreferrer&quot;&gt;[3]&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;While I understand that quadratization from HOBO/HUBO to QUBO could be done &lt;a href=&quot;https://arxiv.org/abs/2009.07309&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;&lt;a href=&quot;https://arxiv.org/abs/2001.00658&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2]&lt;/a&gt;, I'm trying to understand if it's actually possible to solve problems with higher-order polynomials using QAOA without quadratizing them. Unfortunately, I haven't been able to find too many sources discussing this subject.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2009.07309&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1] Adam Glos, Aleksandra Krawiec, Zoltán Zimborás, &amp;quot;Space-efficient binary optimization for variational computing&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2001.00658&quot; rel=&quot;nofollow noreferrer&quot;&gt;[2] Avradip Mandal, Arnab Roy, Sarvagya Upadhyay, Hayato Ushijima-Mwesigwa, &amp;quot;Compressed Quadratization of Higher Order Binary Optimization Problems&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/@minatoyuichiro/variational-quantum-factoring-using-qaoa-and-vqe-on-blueqat-29c6f4f195f1&quot; rel=&quot;nofollow noreferrer&quot;&gt;[3] Yuichiro Minato, &amp;quot;Variational Quantum Factoring using QAOA and VQE on Blueqat&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14832" LastEditorUserId="2293" LastEditDate="2021-02-16T15:13:47.073" LastActivityDate="2021-02-16T15:13:47.073" Title="Solving higher-order (unconstrained) binary optimization problems with QAOA without quadratization" Tags="&lt;programming&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16023" PostTypeId="1" CreationDate="2021-02-14T05:12:24.327" Score="0" ViewCount="33" Body="&lt;p&gt;I am trying implement MAXCUT using QAOA. I have a graph with edges defined by an edges set. My edges set looks a bit like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;edges_set = [Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 0), Edge(2, 0), Edge(1, 3), Edge(0, 4), Edge(1, 4), Edge(2, 4), Edge(3, 4), Edge(4, 5), Edge(5, 0), Edge(2, 6), Edge(6, 3)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The Edge object is already well defined as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class Edge:&#xA;&amp;quot;&amp;quot;&amp;quot;&#xA;This is a class defining the edges of the Graph that will be used by &#xA;Networkx for the purpose of implementation and demonstration of the &#xA;QAOA algorithm&#xA;&#xA;Attributes&#xA;----------&#xA;start_node           :   (int) This is a variable containing the starting node&#xA;                         of a connecting edge in the Graph&#xA;end_node             :   (int) This is a variable containing the ending node of&#xA;                         a connecting edge in the Graph&#xA;&amp;quot;&amp;quot;&amp;quot;&#xA;def __init__(self, start_node, end_node):&#xA;    self.start_node = start_node&#xA;    self.end_node = end_node&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now I'm trying to take this set of edges and turn them into GridQubits with assigned Qids. But I'm having trouble figuring out what would be the best way of going about this. I want to do this because, in the end, I want to visualize my MAXCUT coloring as they did in the Cirq QAOA tutorial as given &lt;a href=&quot;https://quantumai.google/cirq/tutorials/qaoa&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. But I cannot directly feed in my graph as that throws the error &lt;code&gt; Gate was called with type different than Qid. Type: &amp;lt;class 'str'&amp;gt;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any help would be absolutely fantastic. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="8989" LastEditorUserId="55" LastEditDate="2021-02-16T09:00:05.300" LastActivityDate="2021-02-16T09:00:05.300" Title="Interpret graph nodes as qubits" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16024" PostTypeId="2" ParentId="15386" CreationDate="2021-02-14T06:38:29.433" Score="2" Body="&lt;p&gt;Yes, many QML algorithms only yield polynomial (quadratic) speedups. Some, as seen in the table, do yield exponential speedups, and of those most rely on the quantum linear systems algorithm (QLSA, also known as the HHL) as a core subroutine.&lt;/p&gt;&#xA;&lt;p&gt;Are QML algorithms with a quadratic speedup (or any such quantum algorithm, for that matter) practical? It's &lt;em&gt;unclear&lt;/em&gt;. But, there have been a few papers published by Craig Gidney and collaborators that, through numerical simulations, indicate that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Things don't look so great for quadratic speedups, but &lt;a href=&quot;https://arxiv.org/abs/2011.04149&quot; rel=&quot;nofollow noreferrer&quot;&gt;they look much better for quartic speedups&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Even some exponential speedups may not be practical without some fundamental improvements to error correcting approaches and, in the  case of the log-time QML algorithms, I/O methods. See &lt;a href=&quot;https://arxiv.org/abs/1905.09749&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper by Gidney on factoring a 2048 bit RSA key&lt;/a&gt; and note his discussion of the constant factors of Shor's algorithm and the challenges they present. Also see Aaronson's classic paper about the limitations of HHL, &lt;a href=&quot;https://www.scottaaronson.com/papers/qml.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Read the Fine Print&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Notably, in the second paper referenced, Gidney discusses the overhead due to error correction by magic state distillation with a 3D surface code. This is what Google appears to be pursuing and is currently a favorite, but there are other approaches to error correction that may ultimately win out.&lt;/p&gt;&#xA;&lt;p&gt;Finally, I'd like to make the assertion that speedups under the quantum query model are not the only types of advantage that may be useful come fault tolerant quantum computing – other types of advantage are of interest, too. For example, see this recent paper by Abbas et al. on an apparent &lt;a href=&quot;https://arxiv.org/pdf/2011.00027v1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum advantage in certain quantum neural networks&lt;/a&gt; in terms of generalization error of the learned function and trainability.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastActivityDate="2021-02-14T06:38:29.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16025" PostTypeId="1" AcceptedAnswerId="16470" CreationDate="2021-02-14T06:41:50.237" Score="2" ViewCount="83" Body="&lt;p&gt;My problem is easy to understand, just how to calculate the matrix of phase operator(or phase gate) acts on multi-qubits so that i can perfrom it in quantum circuit on IBM Quantum Experience&lt;/p&gt;&#xA;&lt;p&gt;just like the controlled-U gate in phase estimation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wr235.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wr235.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;for example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U(y)|φ\rangle=\exp(2πiy)|φ\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|φ\rangle$&lt;/span&gt; is a two- or three-qubit register.&lt;/p&gt;&#xA;" OwnerUserId="14616" LastEditorUserId="55" LastEditDate="2021-02-16T09:00:54.467" LastActivityDate="2021-03-12T13:35:33.397" Title="How to perform a phase operator on register that contains two or more qubits？" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16027" PostTypeId="1" AcceptedAnswerId="16032" CreationDate="2021-02-14T11:37:24.307" Score="2" ViewCount="58" Body="&lt;p&gt;Book: Quantum computer science by David Mermin&#xA;Chapter:5&#xA;Page-118&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The 5-Qbit codewords are most clearly and usefully defined in terms of&#xA;the &lt;span class=&quot;math-container&quot;&gt;$M_{i}$&lt;/span&gt; (rather than writing out their lengthy explicit expansions in&#xA;computational-basis states):&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned}| \overline{0}\rangle =\dfrac{1}{4}\left( 1+M_{0}\right) \left( 1+M_{1}\right) &#xA;\left( 1+M_{2}\right) \left( 1+M_{3}\right) &#xA;| 00000\rangle \\&#xA;\end{aligned}&lt;/span&gt;&#xA;This is how the operators to project the state to the eigenspace with&#xA;Eigenvalues +1 or - 1.But then what is this denoting?.&lt;/p&gt;&#xA;&lt;p&gt;When I say that, what is this denoting, I mean to ask what exactly is happening in terms of error detection and then correction.&#xA;After asking this question, I have realized that whole point of denoting that 5 qubit codeword can be realized by this expression is too much.I think this equation just proves the point that the state all zeros can be thought as an eigenstate of this operator.&lt;/p&gt;&#xA;&lt;p&gt;Correct me if I am wrong. (if my understanding is wrong)&lt;/p&gt;&#xA;&lt;p&gt;But then what’s the point? Yes now all the error is having different eigen value based on the individual operator which gives us the error syndromes but how do we find this magical operators in the first place?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-14T16:58:39.697" LastActivityDate="2021-04-24T20:54:50.643" Title="5 qubit codewords definition in terms of operators: Mermin" Tags="&lt;error-correction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16028" PostTypeId="1" CreationDate="2021-02-14T13:00:55.773" Score="-1" ViewCount="53" Body="&lt;p&gt;I'm trying to build a simple web app for generating random numbers using IBMQ (Qiskit) and Streamlit. However, if there is no IBMQ saved account it should wait for the user to enter the API token and if the token is valid then proceed further and load IBMQ backends.&#xA;Below is the code which I have written:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;filename.py&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# -*- coding: utf-8 -*-&#xA;&amp;quot;&amp;quot;&amp;quot;&#xA;Created on Sun Jan 31 01:30:00 2021&#xA;&#xA;@author: ShadabHussain&#xA;&amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;import warnings &#xA;warnings.filterwarnings(&amp;quot;ignore&amp;quot;)&#xA;import requests&#xA;import streamlit as st&#xA;&#xA;# IBMQ&#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute, IBMQ&#xA;from qiskit.tools.monitor import job_monitor&#xA;&#xA;&#xA;st.set_page_config(page_title='QRNG', page_icon=None, layout='centered', initial_sidebar_state='auto')&#xA;&#xA;st.markdown(&amp;quot;&amp;lt;h1 style='text-align: center; color: black;'&amp;gt;Quantum Random Number Generator&amp;lt;/h1&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;&#xA;quantum_computer = st.sidebar.selectbox(&amp;quot;Select Quantum Computer Type&amp;quot;, ['IBMQ'])&#xA;&#xA;subheader = &amp;quot;using &amp;quot;+ quantum_computer&#xA;st.markdown(f&amp;quot;&amp;lt;h1 style='text-align: center; color: black;'&amp;gt;{subheader}&amp;lt;/h1&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;&#xA;&#xA;def about(quantum_computer):&#xA;    if quantum_computer == &amp;quot;IBMQ&amp;quot;:&#xA;        text = &amp;quot;Qiskit is an open source SDK for working with quantum computers at the level of pulses, circuits and application modules. It accelerates the development of quantum applications by providing the complete set of tools needed for interacting with quantum systems and simulators.&amp;quot;&#xA;        link = 'https://qiskit.org/'&#xA;        link_text = 'For Qiskit Documentation'&#xA;    st.markdown(f&amp;quot;&amp;lt;body style='text-align: center; color: black;'&amp;gt;{text}&amp;lt;/body&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;    st.markdown(f&amp;quot;&amp;lt;h4 align='center'&amp;gt; &amp;lt;a href={link}&amp;gt;{link_text}&amp;lt;/a&amp;gt; &amp;lt;/h4&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;        &#xA;    &#xA;about(quantum_computer)&#xA;&#xA;def ibmq_qrng(minimum, maximum):&#xA;        &#xA;    q = QuantumRegister(num_q, 'q')&#xA;    c = ClassicalRegister(num_q, 'c')&#xA;&#xA;    circuit = QuantumCircuit(q, c)&#xA;    circuit.h(q)  # Applies hadamard gate to all qubits&#xA;    circuit.measure(q, c)  # Measures all qubits&#xA;&#xA;    job = execute(circuit, backend, shots=1)&#xA;    counts = job.result().get_counts()&#xA;    result = int(counts.most_frequent(), 2)&#xA;    result1 = minimum + result % (maximum+1 - minimum)&#xA;    return result1&#xA;&#xA;&#xA;&#xA;if quantum_computer == &amp;quot;IBMQ&amp;quot;: &#xA;    api_key = None&#xA;    try:&#xA;        IBMQ.load_account()&#xA;    except Exception as e:&#xA;        api_key = st.sidebar.text_input(&amp;quot;Enter IBMQ API Key&amp;quot;)&#xA;        if api_key != None:&#xA;            IBMQ.save_account(api_key, overwrite=True)&#xA;            IBMQ.load_account()          &#xA;    provider = IBMQ.get_provider(hub='ibm-q')&#xA;    device = st.sidebar.selectbox(&amp;quot;Select Quantum Device&amp;quot;, [str(each) for each in provider.backends()])&#xA;    backend = provider.get_backend(device)&#xA;    if device == &amp;quot;ibmq_qasm_simulator&amp;quot;:&#xA;        num_q = 32&#xA;    else:&#xA;        num_q = 5&#xA;    minimum = st.sidebar.number_input(&amp;quot;Minimum Random Number&amp;quot;, value=0)&#xA;    maximum = st.sidebar.number_input(&amp;quot;Maximum Random Number&amp;quot;, min_value=minimum+1, value=minimum+1)&#xA;&#xA;&#xA;num_rand_numbers = st.sidebar.number_input(&amp;quot;Number of Random Numbers to be Generated&amp;quot;, min_value=1, value=1)&#xA;&#xA;            &#xA;def display_result(result1):&#xA;    if 'result1' in locals():&#xA;        st.markdown(f&amp;quot;&amp;lt;h2 style='text-align: center; color: black;'&amp;gt;Sampling {num_rand_numbers} random number between {minimum} and {maximum}: {result1}&amp;lt;/h2&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;    &#xA;&#xA;&#xA;if st.sidebar.button(&amp;quot;Generate Random Number&amp;quot;):&#xA;    if num_rand_numbers &amp;lt;1:&#xA;        st.markdown(f&amp;quot;&amp;lt;h3 style='text-align: center; color: black;'&amp;gt;Please enter number of random numbers to be generated 1 or greater then 1&amp;lt;/h3&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;    else:&#xA;        if quantum_computer == &amp;quot;IBMQ&amp;quot;:&#xA;            if num_rand_numbers==1:&#xA;                result1 = ibmq_qrng(minimum, maximum)&#xA;            else:&#xA;                result1 = []&#xA;                for i in range(num_rand_numbers):&#xA;                    result1.append(ibmq_qrng(minimum, maximum))&#xA;            display_result(result1)&#xA;else:&#xA;    st.markdown(f&amp;quot;&amp;lt;h3 style='text-align: center; color: black;'&amp;gt;Click on 'Generate Random Number' button&amp;lt;/h3&amp;gt;&amp;quot;, unsafe_allow_html=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For running the above code you should have IBMQ API token (&lt;a href=&quot;https://quantum-computing.ibm.com/account&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/account&lt;/a&gt;) and python installed on your system with the below dependencies:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install qiskit streamlit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Command to run the code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;streamlit run filename.py&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I'm running the app, I'm getting the following error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kxhjo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kxhjo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there any better way of exception handling for qiskit and streamlit?&lt;/p&gt;&#xA;" OwnerUserId="9365" LastActivityDate="2021-02-15T08:31:09.587" Title="Handle Qiskit Excpetion while Loading IBMQ Account using Streamlit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16029" PostTypeId="1" AcceptedAnswerId="16031" CreationDate="2021-02-14T13:30:27.267" Score="2" ViewCount="58" Body="&lt;p&gt;I am highly confused with this statement and spent a lot of time understanding it.&lt;/p&gt;&#xA;" OwnerUserId="14741" LastEditorUserId="10480" LastEditDate="2021-02-14T17:14:50.500" LastActivityDate="2021-02-14T18:08:25.087" Title="Parametric circuit to prepare the most general single-qubit state" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ClosedDate="2021-02-17T10:12:20.067" ContentLicense="CC BY-SA 4.0" />
  <row Id="16030" PostTypeId="1" CreationDate="2021-02-14T14:22:09.143" Score="0" ViewCount="13" Body="&lt;p&gt;I am studying a paper &amp;quot;Remote Preparation and Distribution of Bipartite Entangled States&amp;quot; and trying to implement it using a software. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0410016&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0410016&lt;/a&gt;&#xA;This paper talks about the relationship.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;If Alice, Bob, and Sapna perform general LOCC on the initial four-qubit state tensor(p12,p34) (density matrices rho(12) and rho(34)) then the concurrence between 1 and 4 is the given by&lt;/p&gt;&#xA;&lt;p&gt;C14 = C12 * C34.&lt;/p&gt;&#xA;&lt;p&gt;Is there any software which I can use to implement this paper? I tried using SimulaQron but this software doesn't support to check the relation between the concurrence between initial and final nodes to the concurrence between the intermediate nodes.&lt;/p&gt;&#xA;&lt;p&gt;I also tried using QuTip but I was not successful.&lt;/p&gt;&#xA;&lt;p&gt;Though the paper says that by measuring intermediate nodes the initial and final nodes are entangled, but is there any software which supports this paper.&lt;/p&gt;&#xA;&lt;p&gt;Any suggestion would be a great help for me to move forward and implement these results.&lt;/p&gt;&#xA;" OwnerUserId="13039" LastEditorUserId="55" LastEditDate="2021-02-16T09:02:07.560" LastActivityDate="2021-02-16T09:02:07.560" Title="Any suggestions on Software to implement Remote Entangled Distribution" Tags="&lt;programming&gt;&lt;entanglement&gt;&lt;quantum-networks&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16031" PostTypeId="2" ParentId="16029" CreationDate="2021-02-14T16:16:17.590" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be an arbitrary single-qubit state. Since &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is Hermitian it has real eigenvalues and an orthonormal eigenbasis in which it is diagonal&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \lambda_1 |\psi\rangle\langle\psi| + \lambda_2 |\psi^\perp\rangle\langle\psi^\perp|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and since it has unit trace &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 + \lambda_2 = 1$&lt;/span&gt;. Thus we can find an angle &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 = \cos^2\frac{\beta}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2 = \sin^2\frac{\beta}{2}$&lt;/span&gt;. The first eigenvector can be expanded in the computational basis as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \cos\frac{\theta}{2}|0\rangle + e^{i\phi}\sin\frac{\theta}{2}|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the other one is fixed up to global phase by orthonormality&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi^\perp\rangle = -\sin\frac{\theta}{2}|0\rangle + e^{i\phi}\cos\frac{\theta}{2}|1\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we see that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is completely described by three parameters: &lt;span class=&quot;math-container&quot;&gt;$\beta, \theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, recall that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_Y(\theta) = \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp;-\sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp;\cos\frac{\theta}{2}&#xA;\end{pmatrix} \\&#xA;R_Z(\phi) = \begin{pmatrix}&#xA;e^{-\frac{i\phi}{2}} &amp;amp; 0 \\&#xA;0 &amp;amp; e^{\frac{i\phi}{2}}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta, \phi) = R_Z(\phi) R_Y(\theta) \equiv\begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\&#xA;e^{i\phi}\sin\frac{\theta}{2} &amp;amp; e^{i\phi}\cos\frac{\theta}{2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\equiv$&lt;/span&gt; denotes equivalence up to unobservable global phase. We see that &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = |\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U|1\rangle = |\psi^\perp\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This means that we can prepare a qubit in the &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; state by first initializing a data qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, applying &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate with probability &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt;, applying &lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta)$&lt;/span&gt; and finally applying &lt;span class=&quot;math-container&quot;&gt;$R_Z(\phi)$&lt;/span&gt;. In practice, we can realize the probabilistic &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate using the CNOT gate targeting the data qubit and controlled by an auxiliary qubit prepared in the state &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\beta}{2}|0\rangle + \sin\frac{\beta}{2}|1\rangle$&lt;/span&gt;. The preparation can be performed using &lt;span class=&quot;math-container&quot;&gt;$R_Y(\beta)$&lt;/span&gt;. After the CNOT gate the state of the two qubits is &lt;span class=&quot;math-container&quot;&gt;$\cos\frac{\beta}{2}|0\rangle|\psi\rangle + \sin\frac{\beta}{2}|1\rangle|\psi^\perp\rangle$&lt;/span&gt;. Finally, we discard the auxiliary qubit leaving the data qubit in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_1\left[\left(\cos\frac{\beta}{2}|0\rangle|\psi\rangle + \sin\frac{\beta}{2}|1\rangle|\psi^\perp\rangle\right)\left(\cos\frac{\beta}{2}\langle 0|\langle\psi| + \sin\frac{\beta}{2}\langle 1|\langle\psi^\perp|\right)\right] =\\ \cos^2\frac{\beta}{2}|\psi\rangle\langle\psi| + \sin^2\frac{\beta}{2} |\psi^\perp\rangle\langle\psi^\perp| = \rho.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In summary, the circuit is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Prepare a data and auxiliary qubits in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; state.&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$R_Y(\beta)$&lt;/span&gt; to the auxiliary qubit.&lt;/li&gt;&#xA;&lt;li&gt;Apply CNOT with the auxiliary qubit as control and data qubit as target.&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta)$&lt;/span&gt; to the data qubit.&lt;/li&gt;&#xA;&lt;li&gt;Apply &lt;span class=&quot;math-container&quot;&gt;$R_Z(\phi)$&lt;/span&gt; to the data qubit.&lt;/li&gt;&#xA;&lt;li&gt;Discard the auxiliary qubit.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Alternatively, we can measure the auxiliary qubit after &lt;span class=&quot;math-container&quot;&gt;$R_Y(\beta)$&lt;/span&gt; and replace CNOT with a classically controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. We discard measurement result after using it to control the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-14T18:08:25.087" LastActivityDate="2021-02-14T18:08:25.087" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16032" PostTypeId="2" ParentId="16027" CreationDate="2021-02-14T16:23:42.050" Score="5" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;When I say that, what is this denoting, I mean to ask what exactly is happening in terms of error detection and then correction. After asking this question, I have realized that whole point of denoting that 5 qubit codeword can be realized by this expression is too much.I think this equation just proves the point that the state all zeros can be thought as an eigenstate of this operator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Okay, so I am not sure if I have properly understood everything that you are asking, but let me try to shed some light.&lt;/p&gt;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|\overline{0}\rangle$&lt;/span&gt; is some &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit state. We use the &lt;span class=&quot;math-container&quot;&gt;$\overline{0}$&lt;/span&gt; label to indicate two things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The bar/line over the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; indicates that this is a &lt;em&gt;logical&lt;/em&gt; qubit. It is a combination of multiple (&lt;em&gt;physical&lt;/em&gt;) qubits, were we restrict the 'valid' states to be only a subset of all different quantum states that the physical qubits can take together. In this case, there are &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; physical qubits, so there are &lt;span class=&quot;math-container&quot;&gt;$2^{5} = 32$&lt;/span&gt; different states*. We only pick two out of these &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt;, and say that they are the two states of our logical qubit, which of course has two states, because, well, it is a qubit.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; itself indicates that we have chosen this state to be the logical &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; - of course there should also be a logical &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, and together they make the logical qubit. The state being labelled &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; does not, in principle, have &lt;em&gt;anything&lt;/em&gt; to do with the physical-qubits-state &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt;, but in this case there is a weak correlation, as pointed out by your equation - a little more on that later.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So, the question is now, how do we choose this subset? It turns out, it is extremely useful to choose this subset implicitly, by saying that it is the set of states which are in the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspaces of a list of distinct operators on the physical qubits - we call this the &lt;em&gt;shared&lt;/em&gt; (&lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;) eigenspace of these operators.&lt;/p&gt;&#xA;&lt;p&gt;Any of these operators has a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and a &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace - which are equally large; and for the code's sake we only care about the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstates. Any time I add an extra operator, it hacks the space of valid states in half; I want &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; out of &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt; states to be valid, so I need to add &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; operators - for the &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit code, these operators are &lt;span class=&quot;math-container&quot;&gt;$M_{0},M_{1},M_{2},M_{3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If I want to work out what these states actually are, I can use a little trick - I take whatever state from my &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit space, and I project that state on all eigenspaces one after another. The projector upon the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace of an operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$P_{M} = \frac{1}{2}(I+M)$&lt;/span&gt;. So, if I make the - more or less arbitrary - choice of starting with &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt;, a valid state of my logical qubit is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{2^{4}}(I+M_{0})(I+M_{1})(I+M_{2})(I+M_{3})|00000\rangle,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which, for the &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit code, is &lt;strong&gt;not&lt;/strong&gt; the same as &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt;. That means that  &lt;span class=&quot;math-container&quot;&gt;$|00000\rangle$&lt;/span&gt; is &lt;strong&gt;not&lt;/strong&gt; an eigenstate of the above operator, and therefore that it is &lt;strong&gt;not&lt;/strong&gt; a valid state of the code.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;But then what’s the point? Yes now all the error is having different eigen value based on the individual operator which gives us the error syndromes&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The point, for many people, is that this framework allows us to understand everything that is happening with there errors only in terms of those operators, which together form the &lt;em&gt;stabilizer&lt;/em&gt; of this code. For any error's action we don't actually have to work out the code states and how they are affected, we can just infer everything interesting that there is to know from their relations with the stabilizer operators. A &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit code has codewords in a space of &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt;&#xA;elements, but this of course scales very quickly. If I have &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; physical qubits to make a logical qubit, the qubit states are in a space of &lt;span class=&quot;math-container&quot;&gt;$2^{20}$&lt;/span&gt; elements, so even writing down a single codeword takes a long time. But using this operator framework, I only need to keep track of &lt;span class=&quot;math-container&quot;&gt;$19$&lt;/span&gt; operators.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;but how do we find this magical operators in the first place?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Well, yeah, that is the million dollar question. Designing codes can be all about finding operators that have good properties. There are ways where you can, for instance, create quantum codes from classical linear codes, known as CSS codes, but that is definitely not the only way to come up with these things.&lt;/p&gt;&#xA;&lt;p&gt;*I'm implicitly only counting basis states here, where I do not actually choose the basis, but just know that there will be &lt;span class=&quot;math-container&quot;&gt;$32$&lt;/span&gt; elements in that basis. Of course there are many more superpostitions, but we don't care about that currently.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-04-24T20:54:50.643" LastActivityDate="2021-04-24T20:54:50.643" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16033" PostTypeId="2" ParentId="15929" CreationDate="2021-02-14T16:32:03.447" Score="1" Body="&lt;p&gt;Demanding that quantum computational supremacy be achieved only when we can prove that no classical algorithm can run with the same asymptotic speed is presently out of reach, not so much of the scientists and engineers, but of the complexity theorists.&lt;/p&gt;&#xA;&lt;p&gt;For example because Feynman proved that &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt; is contained in &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PP}$&lt;/span&gt;, and because we don't yet know how to unconditionally separate, e.g., &lt;span class=&quot;math-container&quot;&gt;$\mathsf{P}$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\mathsf{PP}$&lt;/span&gt;, almost all proposals/approaches to proving quantum computational supremacy in the asymptotic sense must rest on assumptions about the limitations of classical computational algorithms.  Often when speaking freely these hypotheses are unstated or unrepeated.  Indeed, the Farhi and Harrow paper states in the abstract that the results are conditioned &amp;quot;based on reasonable complexity theoretic assumptions&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;I would argue that running Shor's algorithm to factor, say, &lt;code&gt;RSA-2048&lt;/code&gt; &lt;em&gt;would&lt;/em&gt; be evidence of quantum computational supremacy, with the hidden assumption that there is no polynomial-time factoring algorithm.&lt;/p&gt;&#xA;&lt;p&gt;But the reason that Shor's algorithm is not seen as an ideal candidate in the near term for showing quantum computational supremacy is not because we don't know whether a classical algorithm exists; it's rather that the overhead required for factoring is too large now, absent fully scalable fault tolerant quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;That is, one of the motivations of Preskill starting the program of showing quantum computational supremacy was to provide a goal achievable with the &lt;em&gt;near-term&lt;/em&gt;, noisy, intermediate-scale quantum (NISQ) devices.  The QAOA approach in the Farhi-Harrow paper may be &lt;em&gt;achievable&lt;/em&gt; with such a NISQ device; however, it nonetheless has to rely on reasonable complexity-theoretic assumptions.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-02-14T16:32:03.447" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16035" PostTypeId="1" AcceptedAnswerId="16036" CreationDate="2021-02-14T18:10:14.250" Score="3" ViewCount="97" Body="&lt;p&gt;I am quite stumped by the fact that the roadmaps for quantum computers as given by &lt;a href=&quot;https://www.ibm.com/blogs/research/2020/09/ibm-quantum-roadmap/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM&lt;/a&gt;, &lt;a href=&quot;https://www.youtube.com/watch?v=TJ6vBNEQReU&amp;amp;feature=youtu.be&amp;amp;list=PLQY2H8rRoyvx4VttfJOPRslw8XWT7yaBJ&amp;amp;t=967&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google&lt;/a&gt;, &lt;a href=&quot;https://venturebeat.com/2020/12/09/ionq-roadmap-quantum-machine-learning-2023-broad-quantum-advantage-2025/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IonQ&lt;/a&gt;, etc. seem to imply a linear/exponential growth in the size of their quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;Naively, I would assume that bigger systems are much harder to engineer, especially if one wanted to be able to entangle all of their bits, because only the undisturbed outcome is correct. Given a fidelity where &lt;span class=&quot;math-container&quot;&gt;$P[0_i] = x$&lt;/span&gt; means no error occurs on bit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, it would seem to me that an entangled system of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; would have probability &lt;span class=&quot;math-container&quot;&gt;$P[0_1, ..., 0_n] = x^n$&lt;/span&gt;. The probability of error grows exponentially, if &lt;span class=&quot;math-container&quot;&gt;$x &amp;lt; 1.0$&lt;/span&gt;, which is of course true for all practical systems.&lt;/p&gt;&#xA;&lt;p&gt;ECCs mitigate this to some extent, but also just by a polynomial factor and require even more bits. It looks like building large systems of the same fidelity becomes exponentially harder, and just scaling an existing design will result in a system with exponentially lower fidelity. Most interesting algorithmic building blocks, like the QFT, require entanglement between all of the involved bits. More bits without the ability to produce larger entangled states seem to have a limited advantage, because it would be practically equivalent to using two computers or executing in sequences.&lt;/p&gt;&#xA;&lt;p&gt;Optimism about improvements in basic gate fidelity and error correction aside, is there anything I am missing about errors in entangled states that gives rise to these predictions? To state this more precisely, is there any theoretical effect or algorithm that can be exploited to  limit the error probability in entangled systems to be polynomial or at least subexponential in the size of the system?&lt;/p&gt;&#xA;" OwnerUserId="10225" LastEditorUserId="10225" LastEditDate="2021-02-18T18:17:31.777" LastActivityDate="2021-02-18T18:17:31.777" Title="How to limit the error probability in large scale quantum computers" Tags="&lt;entanglement&gt;&lt;error-correction&gt;&lt;fidelity&gt;&lt;scalability&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16036" PostTypeId="2" ParentId="16035" CreationDate="2021-02-14T18:31:20.713" Score="6" Body="&lt;p&gt;It is true that fidelity decays exponentially in the course of quantum computation. This is indeed a major limitation of NISQ computers that imposes a stringent &amp;quot;depth budget&amp;quot;. In order to overcome the decay, we need gates with fidelity so close to one that the decay is negligible over the course of quantum algorithms we intend to run. As you anticipated in your question, this is achieved using quantum error correction.&lt;/p&gt;&#xA;&lt;p&gt;However, quantum error correction gives rise to &lt;em&gt;exponential&lt;/em&gt; suppression of errors, not polynomial. Moreover, the asymptotic resource cost of the feat is polylogarithmic as a function of key variables. This enables the creation of logical gates with &lt;em&gt;arbitrarily high&lt;/em&gt; fidelity and thus allows us to overcome exponential decay of fidelity. In practice, a challenge in building a quantum computer is that while the asymptotic overhead of quantum error correction is modest, the constant factors are fairly high.&lt;/p&gt;&#xA;&lt;p&gt;Quantitatively, for a given quantum error correcting code there exist constants &lt;span class=&quot;math-container&quot;&gt;$c_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c_2$&lt;/span&gt; and a &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_threshold_theorem&quot; rel=&quot;noreferrer&quot;&gt;threshold&lt;/a&gt; error rate &lt;span class=&quot;math-container&quot;&gt;$\epsilon_T$&lt;/span&gt; such that the logical error rate &lt;span class=&quot;math-container&quot;&gt;$\epsilon_L$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\epsilon_L \approx c_1 \left(c_2\frac{\epsilon_P}{\epsilon_T}\right)^{\left\lfloor\frac{d+1}{2}\right\rfloor}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\epsilon_P$&lt;/span&gt; is the physical error rate and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is the code distance (c.f. equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; on p.11 in &lt;a href=&quot;https://arxiv.org/abs/1010.5022&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;). Importantly, the resources required to build and operate a quantum computer using a quantum error correcting code of distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; are polynomial in &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. For example, in case of the Surface Code the number of physical qubits required to encode one logical qubit scales as &lt;span class=&quot;math-container&quot;&gt;$O(d^2)$&lt;/span&gt;. Thus, theoretically, if the physical error rate &lt;span class=&quot;math-container&quot;&gt;$\epsilon_P$&lt;/span&gt; can be brought down below threshold then arbitrarily high logical fidelity should be achievable.&lt;/p&gt;&#xA;&lt;p&gt;For a concrete example, suppose we have a computer with &lt;span class=&quot;math-container&quot;&gt;$\epsilon_P &amp;lt; \epsilon_T$&lt;/span&gt; and we wish to run an algorithm that consists of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; gates on &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; logical qubits and are willing to accept overall failure probability no greater than &lt;span class=&quot;math-container&quot;&gt;$p_f&amp;gt;0$&lt;/span&gt;. In order to meet these requirements, we need &lt;span class=&quot;math-container&quot;&gt;$\epsilon_L$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;kq\epsilon_L \approx 1 - (1 - \epsilon_L)^{kq} &amp;lt; p_f.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Substituting from &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and carrying out the calculations, we find an upper bound on the necessary code distance&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\log kqc_1 + \left\lfloor\frac{d+1}{2}\right\rfloor \log \left(c_2\frac{\epsilon_P}{\epsilon_T}\right) \lt \log p_f \\&#xA;d \lt \frac{2\log \frac{kqc_1}{p_f}}{\log \frac{\epsilon_T}{c_2\epsilon_P}} = O\left(\log \frac{kq}{p_f}\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We see that the asymptotic overhead of quantum error correction is very modest. For example, using the Surface Code the number of physical qubits needed to run an algorithm with the above parameters is &lt;span class=&quot;math-container&quot;&gt;$O(q\log^2 \frac{kq}{p_f})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For an informative discussion of exponential suppression of errors in concatenated codes see section 10.6.1 in Nielsen &amp;amp; Chuang, especially the text around equation &lt;span class=&quot;math-container&quot;&gt;$(10.113)$&lt;/span&gt; on page 481. For a recent experimental demonstration of exponential suppression of errors, see &lt;a href=&quot;https://arxiv.org/abs/2102.06132&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; (disclosure: I'm a co-author).&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-14T23:48:56.820" LastActivityDate="2021-02-14T23:48:56.820" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16037" PostTypeId="2" ParentId="15385" CreationDate="2021-02-14T20:43:03.403" Score="3" Body="&lt;p&gt;It seems clear that any speedup for neural networks will be inherently polynomial in the traditional sense – they don't traditionally use Fourier transforms or any other subroutines that we often associate with exponential speedups. But if we look to things related to training time (e.g. sample complexity) and learnability, we may find useful advantages in practice. I shared a link at the end of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16024/1937&quot;&gt;my answer&lt;/a&gt; to a related question that may be of interest.&lt;/p&gt;&#xA;&lt;p&gt;Of course in terms of implementation and hardware, classical deep learning is getting pretty advanced. It may take a long while for any quantum advantages to be realized in practice.&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2021-02-14T20:49:45.930" LastActivityDate="2021-02-14T20:49:45.930" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16038" PostTypeId="1" AcceptedAnswerId="16039" CreationDate="2021-02-15T01:23:25.850" Score="3" ViewCount="166" Body="&lt;p&gt;If I have such a quantum circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;quanc = QuantumCircuit(5)&#xA;quanc.crz(np.pi,1,0)&#xA;quanc.cx(1,[i for i in range(2,5)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0MNQa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0MNQa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Can I 'shuffle' the quantum circuit, such that the qubits &lt;code&gt;[0,1,2,3,4]&lt;/code&gt; are mapped to &lt;code&gt;[4,2,3,0,1]&lt;/code&gt;? I know in principle I could directly define my circuit in that order, but I'm still wondering if I could first define it like the original code and then 'shuffle' the qubits with those mapping rules? Thanks a lot:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-02-15T01:32:57.410" LastActivityDate="2021-02-15T02:49:34.100" Title="Can I 'shuffle' the qubits in my circuit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16039" PostTypeId="2" ParentId="16038" CreationDate="2021-02-15T02:49:34.100" Score="2" Body="&lt;p&gt;On a simulator it doesn't matter since you would assume that all the qubits are connected. So I assuming you thinking of mapping this onto actual qubit on the hardware. If that is the case, then you can do it through the &lt;code&gt;transpile&lt;/code&gt; function. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;quanc = QuantumCircuit(5)&#xA;print(quanc)&#xA;&#xA;q_0: &#xA;     &#xA;q_1: &#xA;     &#xA;q_2: &#xA;     &#xA;q_3: &#xA;     &#xA;q_4: &#xA;     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, I can remap the qubit when I do my transpilation onto the qubit layout of Athens as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc_transpiled= transpile(quanc, backend = provider.get_backend('ibmq_athens') ,&#xA;                         optimization_level = 3, initial_layout = [4,2,3,0,1] )&#xA;qc_transpiled.draw( 'mpl',style={'name': 'bw'}, scale = 0.5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BvaqW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BvaqW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hopefully this is what you were thinking of...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-15T02:49:34.100" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16040" PostTypeId="1" CreationDate="2021-02-15T03:46:19.450" Score="4" ViewCount="72" Body="&lt;p&gt;If I have a designed circuit to solve a particular problem. Is there a systematic way how to generate the Hamiltonian from it?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="55" LastEditDate="2021-02-16T09:02:42.810" LastActivityDate="2021-02-16T09:02:42.810" Title="Is there a systematic way how to generate the Hamiltonian from a given circuit?" Tags="&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="0" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16041" PostTypeId="1" AcceptedAnswerId="16042" CreationDate="2021-02-15T07:23:53.690" Score="1" ViewCount="52" Body="&lt;p&gt;Consider the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=(\cos\theta_A|0\rangle+\sin\theta_A|1\rangle)\otimes(\cos\theta_B|0\rangle+e^{i\phi_B}\sin\theta_B|1\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To calculate the &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt; I first calculate the &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and the change it into a matrix form but It was very complicated to compute the eigenvalues for that matrix.&lt;/p&gt;&#xA;&lt;p&gt;Is there any easy way to calculate the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-09T18:48:47.200" LastActivityDate="2021-03-09T18:48:47.200" Title="Is there an easy way to calculate the eigenvalues of the partial transpose of a given matrix?" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-02-18T23:10:09.327" ContentLicense="CC BY-SA 4.0" />
  <row Id="16042" PostTypeId="2" ParentId="16041" CreationDate="2021-02-15T07:50:32.857" Score="3" Body="&lt;p&gt;In this specific case, absolutely! Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=|\phi_A\rangle|\phi_B\rangle,&#xA;$$&lt;/span&gt;&#xA;such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=|\phi_A\rangle\langle\phi_A|\otimes |\phi_B\rangle\langle\phi_B|.&#xA;$$&lt;/span&gt;&#xA;Now, it is the case that &lt;span class=&quot;math-container&quot;&gt;$|\phi_B\rangle\langle\phi_B|^T=|\phi_C\rangle\langle\phi_C|$&lt;/span&gt; for some state &lt;span class=&quot;math-container&quot;&gt;$|\phi_C\rangle=\cos\theta_B|0\rangle+e^{-i\phi_B}\sin\theta_B|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, you should now be able to simply observe that &lt;span class=&quot;math-container&quot;&gt;$\rho^{T_B}=|\phi_A\rangle\langle\phi_A|\otimes |\phi_C\rangle\langle\phi_C|$&lt;/span&gt; is a rank 1 projector (&lt;span class=&quot;math-container&quot;&gt;${\rho^{T_B}}^2=\rho^{T_B}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^{T_B})=1$&lt;/span&gt;), or that the only non-zero eigenvector is just &lt;span class=&quot;math-container&quot;&gt;$|\phi_A\rangle|\phi_C\rangle$&lt;/span&gt;, and that it has eigenvalue 1.&lt;/p&gt;&#xA;&lt;p&gt;Just as a side note, you might wonder how you're supposed to predict this, and therefore know it's a reasonable approach to take for the calculation. The point here is that this is the whole premise of the partial transpose - if you act it on a separable state, then this is just like doing the transpose on pure states, and the transpose of a pure state is always another pure state.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-15T07:50:32.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16043" PostTypeId="2" ParentId="16028" CreationDate="2021-02-15T08:31:09.587" Score="1" Body="&lt;p&gt;By looking at the code, it seems the problem is in &lt;code&gt;api_key != None&lt;/code&gt;. If &lt;code&gt;api_key&lt;/code&gt; is the empty string (which is the case, based on the error), you try to save it. Probably you can change the check for something like &lt;code&gt;not api_key&lt;/code&gt;. We talked about this in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15919/1859&quot;&gt;https://quantumcomputing.stackexchange.com/a/15919/1859&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-15T08:31:09.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16044" PostTypeId="1" AcceptedAnswerId="16047" CreationDate="2021-02-15T09:11:38.140" Score="3" ViewCount="116" Body="&lt;p&gt;I have been using the Qiskit aqua QuantumInstance for a while, and have recently discovered the IBMQJobManager class and the two seem to be quite similar. Are there differences between them? Will they be consolidated together in the future?&lt;/p&gt;&#xA;" OwnerUserId="12620" LastEditorUserId="55" LastEditDate="2021-02-16T09:05:59.873" LastActivityDate="2021-02-16T09:05:59.873" Title="What are the differences between IBMQJobManager and Qiskit aqua QuantumInstance?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16045" PostTypeId="1" CreationDate="2021-02-15T09:44:54.193" Score="4" ViewCount="51" Body="&lt;p&gt;In the literature, one comes across the following situation: Alice holds two registers &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and it is given that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is a classical register.&lt;/p&gt;&#xA;&lt;p&gt;What is the most general way to write down Alice's state? Is it just &lt;span class=&quot;math-container&quot;&gt;$\sigma_{XA} = \sum_i p_i \vert i\rangle\langle i\vert_X \otimes\rho^i_A$&lt;/span&gt;, with each &lt;span class=&quot;math-container&quot;&gt;$\rho^i_A$&lt;/span&gt; being a quantum state (positive semi-definite and trace one matrix)?&lt;/p&gt;&#xA;&lt;p&gt;Sorry that this is a yes/no question because if yes, then there is not much to add. But if not, what would be the most general way to write Alice's state?&lt;/p&gt;&#xA;" OwnerUserId="14853" LastEditorUserId="55" LastEditDate="2021-02-16T09:06:15.763" LastActivityDate="2021-02-16T10:26:37.447" Title="What is the general form of a classical-quantum state?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;classical-quantum&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16046" PostTypeId="1" CreationDate="2021-02-15T11:33:52.807" Score="2" ViewCount="46" Body="&lt;p&gt;In grover's algorithm the oracle gives the output 1 if the element we want is there, my question is, how does the function know what element is to be searched for or how do you put in the element you want to teach for specifically to the oracle?&lt;/p&gt;&#xA;&lt;p&gt;In simple words, we manually design the oracle for the input we want it to search right?&lt;/p&gt;&#xA;" OwnerUserId="14781" LastEditorUserId="55" LastEditDate="2021-02-17T22:40:26.777" LastActivityDate="2021-02-17T22:40:26.777" Title="In Grover's algorithm, how does the function know what element is to be searched for?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-02-15T20:10:55.940" ContentLicense="CC BY-SA 4.0" />
  <row Id="16047" PostTypeId="2" ParentId="16044" CreationDate="2021-02-15T11:46:31.347" Score="3" Body="&lt;p&gt;By looking at the documentation for the two, it actually seems the two have quite different objectives, here is a brief summary: the quantum instance is mostly used to control the transpilation and execution of a circuit via many different parameters, such as the backend, for simulation the noise model, basis gates, coupling map, etc., and is quite useful when wanting to run an Aqua algorithm on the particular instance.&lt;/p&gt;&#xA;&lt;p&gt;As for the IBMQJobManager, as said in the documentation, the main objective is to handle jobs and pulse schedules in order to be able to run them on backend and then rebuild them as fitted.&lt;/p&gt;&#xA;&lt;p&gt;See the documentation for both, maybe this will help you better understand their differences : &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.QuantumInstance.html#qiskit.aqua.QuantumInstance&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum instance&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html#qiskit.providers.ibmq.managed.IBMQJobManager&quot; rel=&quot;nofollow noreferrer&quot;&gt;the job manager&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Do you need a specific detail more explained? If so please tell me and I'll try to detail it more :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="12396" LastEditDate="2021-02-15T13:53:37.437" LastActivityDate="2021-02-15T13:53:37.437" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16048" PostTypeId="1" CreationDate="2021-02-15T14:11:49.453" Score="0" ViewCount="40" Body="&lt;p&gt;I'm trying to run some pulse schedules on &lt;code&gt;ibmq_bogota&lt;/code&gt; but I'm running into this error:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lNiCL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lNiCL.png&quot; alt=&quot;Screenshot of error&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are 99 &amp;quot;circuits&amp;quot;/pulse schedules in this job. When I try to queue just a subset of 98 schedules^ instead, I get&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Total samples exceeds the maximum number of samples for channel CR1_0. (413168 &amp;gt; 258144) [8002]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So it seems like this might be a problem with having too many circuits in one job.&lt;/p&gt;&#xA;&lt;p&gt;My questions are: what is a 'sample' in a channel, what is channel CR1_0, how can I calculate how many samples is in my job, and where can I find the maximum 258144 number for this backend.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;max_experiments&lt;/code&gt; of this backend is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; backend.configuration().max_experiments&#xA;900&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and &lt;code&gt;max_shots&lt;/code&gt; is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; backend.configuration().max_shots&#xA;8192&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Using &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;IBMQJobManager&lt;/code&gt;&lt;/a&gt; does not work either, but at least I can set &lt;code&gt;max_experiments_per_job&lt;/code&gt; to some very low bound so that all the jobs will execute.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;One of my pulse schedules:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8OkJZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8OkJZ.png&quot; alt=&quot;Diagram of pulse schedule&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The others are basically the same with different initial u1 pulse duration.&lt;/p&gt;&#xA;&lt;p&gt;^I've tried queuing a single pulse schedule with the longest u1 pulse duration and that was successful, so I guess it's not related to how long each individual pulse schedule is.&lt;/p&gt;&#xA;" OwnerUserId="13110" LastEditorUserId="13110" LastEditDate="2021-02-16T14:34:18.210" LastActivityDate="2021-02-16T14:34:18.210" Title="IBMQ - Total samples exceeds the maximum number of samples for channel [8002]" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;openpulse&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16049" PostTypeId="1" CreationDate="2021-02-15T16:05:10.123" Score="3" ViewCount="32" Body="&lt;p&gt;I would like to implement a Quantum Verification of Matrix Products, using Ambainis OR Burhman algorithm but I don't know how to start. There isn't much documentation about it, and no circuit in the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0409035&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If someone has any advice on how to start it would be pretty helpful.&lt;/p&gt;&#xA;" OwnerUserId="14856" LastEditorUserId="55" LastEditDate="2021-02-16T09:08:52.400" LastActivityDate="2021-02-16T09:08:52.400" Title="Implementation of the &quot;Quantum Verification of Matrix Products&quot; algorithm" Tags="&lt;programming&gt;&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16050" PostTypeId="1" CreationDate="2021-02-15T16:12:58.943" Score="2" ViewCount="57" Body="&lt;p&gt;In order to calculate the exact expectation value of a Pauli operator in some state using local &lt;code&gt;qasm_simulator&lt;/code&gt;, I do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;psi = qiskit.aqua.operators.state_fns.CircuitStateFn( circuit )&#xA;expect = psi.adjoint().compose( weighted_pauli.to_opflow() ).compose( psi ).eval().real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I would like to run this calculation using &lt;code&gt;ibmq_quantum_simulator&lt;/code&gt;. In all the examples I found online (see e.g. &lt;a href=&quot;https://quantumcomputinguk.org/cnot&quot; rel=&quot;nofollow noreferrer&quot;&gt;this one&lt;/a&gt;), &lt;code&gt;ibmq_quantum_simulator&lt;/code&gt; is used to simulate sampling with some number of shots. How do I use it with &lt;code&gt;shots = None&lt;/code&gt;, similarly to the code above?&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="55" LastEditDate="2021-02-16T09:09:01.417" LastActivityDate="2021-02-16T09:09:01.417" Title="Calculating exact expectation values on ibmq_qasm_simulator" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16051" PostTypeId="1" CreationDate="2021-02-15T17:11:38.183" Score="1" ViewCount="40" Body="&lt;p&gt;I am reading a paper &amp;quot;&lt;em&gt;A study of Teleportation and Super Dense Coding capacity in Remote Entangled Distribution&lt;/em&gt;&amp;quot; (&lt;a href=&quot;https://arxiv.org/abs/1210.1312&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1210.1312&lt;/a&gt;). In this paper Relations on two-qubit pure states are mentioned.&lt;/p&gt;&#xA;&lt;p&gt;Consider a resource entangled in 2 &lt;span class=&quot;math-container&quot;&gt;$\otimes $&lt;/span&gt; 2 dimensions. These states are given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$| {\psi_{12}} \rangle $&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\sum_{i, j}a_{ij} |ij \rangle $&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$| {\psi_{23}} \rangle $&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\sum_{p, q}b_{pq} |pq \rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\sum_{i, j}a_{ij}^2 = 1 $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sum_{p, q}b_{pq}^2 = 1 $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Alice and Bob share a pure entangled state &lt;span class=&quot;math-container&quot;&gt;$| {\psi_{12}} \rangle $&lt;/span&gt; between them, Bob and Charlie also share another entangled state &lt;span class=&quot;math-container&quot;&gt;$| {\psi_{23}} \rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In order to swap the entanglement, Bob carries out measurement on his qubits. Bob carries out measurement for his two qubits in a non-maximally Bell-type entangled basis given by the basis vectors&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$| \phi_{G}^{rh} \rangle $&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{B_{rh}}} (\sum_{t =0}^{1}e^{I\pi rtR_{t}^{rh}}|t\rangle|t\oplus h\rangle) $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now according to general measurements done by Bob on his qubits, we have four possible states between  Alice and Charlie’s locations respectively. These four possible states based on Bob’s measurement outcomes are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\chi^{rh} \rangle$&lt;/span&gt;  = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{M_{rh}}} \sum_{i, q=0}^1 (\sum_{j=0}^1 e^{-I\pi rj}R^{rh}_{j}a_{ij}b_{j\oplus h, q})|iq\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$M_{rh}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\sum_{i, q=0}^1 (\sum_{j=0}^1 e^{-I\pi rj}R^{rh}_{j}a_{ij}b_{j\oplus h, q})^2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was unable to understand how ℎ resolves to a value when I take (r, h) as (0, 0)?&lt;/p&gt;&#xA;" OwnerUserId="13039" LastEditorUserId="13039" LastEditDate="2021-02-16T15:21:19.900" LastActivityDate="2021-02-16T15:21:19.900" Title="Clarification of a theorem mentioned in a paper on RED" Tags="&lt;entanglement&gt;&lt;entanglement-swapping&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16052" PostTypeId="1" AcceptedAnswerId="16056" CreationDate="2021-02-16T00:51:14.640" Score="1" ViewCount="60" Body="&lt;p&gt;I was reading about measurements and got to some operator like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left| 0\rangle \langle 0\right|&#xA; $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there any form I can apply when I have to calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \left( \left| 0\rangle \langle 0\right| \right) ^{+} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I simplify these expressions?&lt;/p&gt;&#xA;&lt;p&gt;My work:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left( \left| 0\rangle \langle 0\right| \right) ^{+}=\langle 0\left| ^{+}\right| 0\rangle ^{+}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this the way?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-16T09:15:14.247" LastActivityDate="2021-02-16T09:22:44.607" Title="Is there a simplified formula for the adjoint of the outer product of ket and bra?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16053" PostTypeId="1" CreationDate="2021-02-16T01:03:45.880" Score="0" ViewCount="60" Body="&lt;p&gt;We know that POVMs are applied in the more general cases where the system is not necessarily closed. So mathematically, how does going from open to closed system change the scenario in case of POVM so that it becomes a projective measurement?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-16T09:25:12.700" LastActivityDate="2021-04-01T18:28:05.337" Title="What additional conditions are there to make POVM measurement same as projective measurement?" Tags="&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16054" PostTypeId="1" CreationDate="2021-02-16T01:05:43.470" Score="1" ViewCount="52" Body="&lt;p&gt;The textbook shows an example system of linear equations &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\begin{pmatrix}&#xA;-\frac{1}{3} &amp;amp; 1 \\&#xA;1 &amp;amp; -\frac{1}{3}&#xA;\end{pmatrix} \,\,\,\,&#xA;b=\begin{pmatrix}&#xA;0 \\&#xA;1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The program in the text shows a result in real numbers. When trying to run a larger &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; matrix and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; matrix, the output includes complex numbers even though the actual answer (calculated using numpy linear equation solver) shows no complex numbers. Where are these imaginary numbers coming from?&lt;/p&gt;&#xA;" OwnerUserId="14860" LastEditorUserId="10480" LastEditDate="2021-02-16T02:49:21.507" LastActivityDate="2021-02-17T09:14:14.597" Title="Why does solving linear systems of equations with HHL return imaginary numbers?" Tags="&lt;hhl-algorithm&gt;&lt;linear-algebra&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2021-03-02T19:39:45.780" ContentLicense="CC BY-SA 4.0" />
  <row Id="16055" PostTypeId="1" CreationDate="2021-02-16T01:12:55.060" Score="0" ViewCount="22" Body="&lt;p&gt;From one of the postulates we know we can represent any system with a state space. I am considering, that if I do this I will sensibly assign different vectors to different entities of my system. But now how do I find these measurement operators?&lt;span class=&quot;math-container&quot;&gt;$$M_{m}$$&lt;/span&gt; which are used to measure the system and the outcome is &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-16T01:12:55.060" Title="How do we find out the measurement operators $M_{m}$ which gives us the desired measurement results?" Tags="&lt;measurement&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16056" PostTypeId="2" ParentId="16052" CreationDate="2021-02-16T01:16:21.050" Score="1" Body="&lt;p&gt;Given that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$&lt;/span&gt; then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = |0\rangle \langle 0| = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, &lt;span class=&quot;math-container&quot;&gt;$\rho^\dagger = \big( |0\rangle \langle 0| \big)^\dagger = \rho $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In general, given &lt;span class=&quot;math-container&quot;&gt;$\rho = |a\rangle\langle b| $&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\rho^\dagger = \big( |a\rangle \langle b| \big)^\dagger = |b\rangle\langle a| $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-16T01:16:21.050" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16057" PostTypeId="1" CreationDate="2021-02-16T01:59:37.843" Score="1" ViewCount="31" Body="&lt;p&gt;When studying the surface code with phenomenological or circuit noise, the syndrome measurement is noisy, and therefore one has to repeat the syndrome measurement for several rounds before decoding. In all literature about surface code, people repeat the measurement for &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; rounds, where &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; is code distance. But why is that?&lt;/p&gt;&#xA;&lt;p&gt;There are several reasons for why &lt;span class=&quot;math-container&quot;&gt;$\Theta(d)$&lt;/span&gt; rounds are necessary and sufficient, and the one which baffles me is due to &amp;quot;temporal&amp;quot; or &amp;quot;timelike&amp;quot; logical error. Specifically, one can imagine a 3D space-time &amp;quot;syndrome graph&amp;quot; or &amp;quot;decoder graph&amp;quot;, where time goes upwards. A &amp;quot;temporal&amp;quot; or &amp;quot;timelike&amp;quot; logical error is a path that links the bottom boundary with the top boundary.&lt;/p&gt;&#xA;&lt;p&gt;I find it difficult to appreciate the consequence of such error, either in a lattice surgery circuit, or in an identity circuit without computation. I guess my issue is that I tend to project such bottom-to-top path onto the 2D spacelike plane, and then simply treat it as a spacelike error.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, I tend to focus on the post-correction residual data error &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and decompose it as &lt;span class=&quot;math-container&quot;&gt;$R=L\cdot E$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is an operator with the same syndrome as &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; and with minimum weight, and &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is a logical operator. I care about two probabilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;: the probability that &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is nontrivial,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt;: conditioned that &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; is trivial, the probability of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I understand that &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; both depend on the number of measurement rounds. But I don't see why &lt;span class=&quot;math-container&quot;&gt;$\Theta(d)$&lt;/span&gt; is necessary and sufficient for (a) &lt;span class=&quot;math-container&quot;&gt;$\lim_{d\rightarrow\infty}p=0$&lt;/span&gt;, or (b) &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; decays exponentially with &lt;span class=&quot;math-container&quot;&gt;$|E|$&lt;/span&gt;. (Assume iid circuit noise.)&lt;/p&gt;&#xA;&lt;p&gt;Can anyone elaborate why a bottom-to-top path is an issue, either in a lattice surgery circuit, or in an identity circuit without computation?&lt;/p&gt;&#xA;" OwnerUserId="14835" LastEditorUserId="14835" LastEditDate="2021-02-16T16:16:51.857" LastActivityDate="2021-02-16T16:16:51.857" Title="What is a &quot;temporal&quot; or &quot;timelike&quot; logical error in the surface code?" Tags="&lt;surface-code&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16058" PostTypeId="1" CreationDate="2021-02-16T02:53:59.663" Score="3" ViewCount="76" Body="&lt;p&gt;I'm transpiling a set of quantum circuits using &lt;code&gt;ibmq_5_yorktown&lt;/code&gt;. However, as the number of circuits gets larger, it shows me the following error message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;TranspilerError: 'Maximum iteration reached. max_iteration=1000'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can I fix this issue? Is it still possible for me to transpile more than 1,000 circuits? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-02-16T02:53:59.663" Title="Transpiler fails after 1000 iterations" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;transpile&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16060" PostTypeId="1" CreationDate="2021-02-16T07:09:08.193" Score="2" ViewCount="64" Body="&lt;p&gt;I was reading about quantum computers and qubits. While a classical bit can be either 0 or 1, a qubit can be 0 or 1 or both at the same time (can it be none too?). But how is this useful at all?&lt;/p&gt;&#xA;&lt;p&gt;If it is 0 and 1 at same time then this isn't helpful at all because I need exact value.&lt;/p&gt;&#xA;" OwnerUserId="14863" LastEditorUserId="55" LastEditDate="2021-02-17T09:42:47.377" LastActivityDate="2021-02-17T09:42:47.377" Title="How do qubits in quantum computers work?" Tags="&lt;quantum-state&gt;&lt;classical-computing&gt;&lt;quantum-parallelism&gt;" AnswerCount="2" CommentCount="1" ClosedDate="2021-02-18T23:09:41.150" ContentLicense="CC BY-SA 4.0" />
  <row Id="16061" PostTypeId="2" ParentId="16060" CreationDate="2021-02-16T08:53:39.287" Score="2" Body="&lt;p&gt;I feel you, I hate when the somebody explains a qubit using the &amp;quot;0 and 1 at the same time&amp;quot; phrase.&lt;/p&gt;&#xA;&lt;p&gt;I prefer the following analogy: A qubit is like a coin being tossed. It is not heads and tails at the same time. It's in a probabilistic position.&lt;/p&gt;&#xA;&lt;p&gt;While flying, the state of the coin is not determined yet and it can be described as a probability. In case of a fair coin, we can describe the state of a flying coin as 50%-heads/50%-tails. Once the coin is &amp;quot;observed&amp;quot; (lands on the ground) its state &amp;quot;collapses&amp;quot; on the heads or tails state.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-16T09:03:31.190" LastActivityDate="2021-02-16T09:03:31.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16062" PostTypeId="2" ParentId="16052" CreationDate="2021-02-16T09:22:44.607" Score="2" Body="&lt;p&gt;I think for these types of calculations it helps to use a more standard linear algebraic notation.&lt;/p&gt;&#xA;&lt;p&gt;Given some finite-dimensional vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$v,w\in V$&lt;/span&gt; be some vectors. Their &lt;em&gt;outer product&lt;/em&gt;, in this context, is the &lt;em&gt;linear operator&lt;/em&gt; denoted with &lt;span class=&quot;math-container&quot;&gt;$v w^\dagger$&lt;/span&gt;. It's worth noting that &lt;span class=&quot;math-container&quot;&gt;$w^\dagger$&lt;/span&gt; is in this context also often denoted with &lt;span class=&quot;math-container&quot;&gt;$w^*$&lt;/span&gt;. This is the linear operator &lt;em&gt;defined&lt;/em&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(vw^\dagger)(x)=\langle w,x\rangle v, \qquad\forall x\in V,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\langle u,v\rangle\in\mathbb C$&lt;/span&gt; denotes the inner product in the space.&lt;/p&gt;&#xA;&lt;p&gt;In bra-ket notation, you write &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$w^\dagger$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\langle w|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;adjoint&lt;/em&gt; (equivalently, the Hermitian conjugate) of &lt;span class=&quot;math-container&quot;&gt;$vw^\dagger\sim |v\rangle\!\langle w|$&lt;/span&gt; can then be computed as simply the Hermitian conjugate of the corresponding matrix (more precisely, of the matrix representing the corresponding linear operator).&#xA;The matrix elements of &lt;span class=&quot;math-container&quot;&gt;$vw^\dagger$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$(vw^\dagger)_{ij}=v_i \bar w_j$&lt;/span&gt;, thus&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(vw^\dagger)^\dagger_{ij} = \overline{(vw^\dagger)_{ji}} = \bar v_j w_i = (wv^\dagger)_{ij}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This shows that &lt;span class=&quot;math-container&quot;&gt;$(vw^\dagger)^\dagger=(wv^\dagger)$&lt;/span&gt;, &lt;em&gt;i.e.&lt;/em&gt; in bra-ket notation, that &lt;span class=&quot;math-container&quot;&gt;$(|v\rangle\!\langle w|)^\dagger = |w\rangle\!\langle v|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-16T09:22:44.607" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16063" PostTypeId="2" ParentId="16045" CreationDate="2021-02-16T10:10:29.450" Score="1" Body="&lt;p&gt;Your description has X as a mixed state (a quantum state with classical uncertainty) and not a classical state. For example you can apply quantum gates to X but that shouldn’t be allowed if X was a classical state. However we can think of that mixed state as a classical state (see comments) and even use it as such.&lt;/p&gt;&#xA;&lt;p&gt;I’m not sure if there is some notation for writing classical states rather than mixed quantum states.&lt;/p&gt;&#xA;" OwnerUserId="13497" LastEditorUserId="13497" LastEditDate="2021-02-16T10:26:37.447" LastActivityDate="2021-02-16T10:26:37.447" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16064" PostTypeId="1" CreationDate="2021-02-16T12:00:57.923" Score="3" ViewCount="69" Body="&lt;p&gt;I want to create an ADD gate like this: &lt;a href=&quot;https://i.stack.imgur.com/UQrff.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UQrff.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;in qiskit using elementary gates.&lt;/p&gt;&#xA;&lt;p&gt;Can it be done?&lt;/p&gt;&#xA;" OwnerUserId="12747" LastEditorUserId="2293" LastEditDate="2021-03-13T20:17:05.943" LastActivityDate="2021-03-13T20:17:05.943" Title="How can I create an ADD gate for two quantum states?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;circuit-construction&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="7" ClosedDate="2021-04-07T23:53:42.273" ContentLicense="CC BY-SA 4.0" />
  <row Id="16066" PostTypeId="2" ParentId="16060" CreationDate="2021-02-16T12:12:02.937" Score="1" Body="&lt;p&gt;Any quantum system can be in so-called superposition state. Imagine that the system's possible states are &lt;span class=&quot;math-container&quot;&gt;$s_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s_2$&lt;/span&gt;...&lt;span class=&quot;math-container&quot;&gt;$s_n$&lt;/span&gt;. There is also an amplitude for each state &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a_2$&lt;/span&gt;...&lt;span class=&quot;math-container&quot;&gt;$a_n$&lt;/span&gt; (a probability that the system is in state &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$p_i =|a_i|^2$&lt;/span&gt;). Then the system can be in superposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=1}^n s_i a_i.&#xA;$$&lt;/span&gt;&#xA;The system remains in this &amp;quot;uncertain&amp;quot; state until it is measured. At the moment of the measurement, one particular state is picked up with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; and the system collapses into this state .&lt;/p&gt;&#xA;&lt;p&gt;In case of qubit, you have only two states denoted &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Besides the superposition, there is a phenomenon called entanglement. In crude description it is a link between two or more quantum systems (e.g. two, three, four...qubits). In this arrangement, behavior of one system is dermined by behavior of other systems. For example, when you have two qubits, measure one qubit and get result 0, the other qubit is automatically in state 0. To get more comprehensive description of entanglement, please check for example &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_entanglement&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiki&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;These two phenomena, i.e. superposition and entanglement, are basic building blocks of quantum computation. By exploiting them, it is possible to construct algorithms which gave quantum computers advantage (speed-up) above classical computer for specific tasks, for example searching in database (Grover algorithm), factoring integers (Shor algorithm), solving linear equations (HHL algorithm) and many others in finance, chemistry and of course physics. It is difficult to explain how these algorithms work in few words and without math. If you are more interested in quantum computing, I recommend to take a course on QC, see for example this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2667/currently-what-are-the-best-structured-courses-available-online-on-quantum-comp&quot;&gt;thread&lt;/a&gt; for advice.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-16T12:12:02.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16067" PostTypeId="1" CreationDate="2021-02-16T12:48:51.383" Score="1" ViewCount="47" Body="&lt;p&gt;I am trying to boost the success propability of standart phase estimation by repeating the procedure enought times and taking a majority vote that will be encoded in a quantum register.&#xA;My problem is I don't know how to implement a majority vote. How could I implement it?&lt;/p&gt;&#xA;&lt;p&gt;(&lt;a href=&quot;https://imgur.com/FVQezhb&quot; rel=&quot;nofollow noreferrer&quot;&gt;My motivation is to implement this&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="14447" LastActivityDate="2021-02-16T12:48:51.383" Title="How to implement Majority Vote" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;error-correction&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16069" PostTypeId="1" AcceptedAnswerId="16187" CreationDate="2021-02-16T14:08:22.023" Score="2" ViewCount="187" Body="&lt;p&gt;I'm trying to solve the maximum independent set problem using Qiskit and the QAOA.&lt;/p&gt;&#xA;&lt;p&gt;I've a nice QUBO Matrix for this simple path graph:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IRxeL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IRxeL.png&quot; alt=&quot;Nice Graph&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;as so:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3oiiU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3oiiU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is, how do I convert this into a general DOCPLEX method which can be put into the &lt;code&gt;QuadracticProgram&lt;/code&gt; method of Qiskit? How can this be done for a general QUBO matrix?&lt;/p&gt;&#xA;&lt;p&gt;I realise that for this particular problem I've found the matrix &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; as described in this [guide].(&lt;a href=&quot;https://arxiv.org/ftp/arxiv/papers/1811/1811.11538.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/ftp/arxiv/papers/1811/1811.11538.pdf&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;So by doing the matrix multiplication:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$y=x^{t} Q x$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$$ x = \begin{pmatrix} x_{0} \\  x_{1} \\  x_{2} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;gives the expression:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ y = -x_{0}^{2} -x_{1}^{2}  -x_{2}^{2}  + 2x_{0}x_{1} + 2x_{1}x_{2} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which I want to minimise (EDIT: Changed from maximise - whoops !). As the nodes are either in the maximum set or not,  the variables are binary and so &lt;span class=&quot;math-container&quot;&gt;$  x_{0}= x_{0}^{2}$&lt;/span&gt; (NB am I correct in thinking for solving the Maximum weighted independent set problem, say where &lt;span class=&quot;math-container&quot;&gt;$ x_{0} $&lt;/span&gt; was twice as important, the weight would manifest as a different constant for the quadractic term?)&lt;/p&gt;&#xA;&lt;p&gt;Is a function that can take a general matrix into DOCPLEX form qiskit can recognise and operate on?&lt;/p&gt;&#xA;&lt;p&gt;EDIT 2:&lt;/p&gt;&#xA;&lt;p&gt;I don't think the &lt;code&gt;stable_set.get_operator()&lt;/code&gt; method works at all.&#xA;For the simplest example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;path = nx.to_numpy_array(nx.path_graph(3))&#xA;&#xA;&#xA;qubitOp, offset = stable_set.get_operator(path)&#xA;print('Offset:', offset)&#xA;print('Ising Hamiltonian:')&#xA;print(qubitOp.print_details())&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;gives:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/EEfCy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EEfCy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is not the correct function - the weights of the different nodes are not equal -  and so has no hope of finding the right result.&lt;/p&gt;&#xA;&lt;p&gt;EDIT 3: After a little bug hunt, the problem is nearly solved !&#xA;&lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/issues/1553&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/issues/1553&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14866" LastEditorUserId="14866" LastEditDate="2021-03-28T20:45:52.963" LastActivityDate="2021-03-28T20:45:52.963" Title="Qiskit: Taking a QUBO matrix into `qubit_op'" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;qaoa&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16070" PostTypeId="1" CreationDate="2021-02-16T14:20:21.250" Score="1" ViewCount="59" Body="&lt;p&gt;How would one go along to calculate the number of uses of an unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in Iterative Phase Estimation (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0610214.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;IPE&lt;/a&gt;) to compare it to the number of uses of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in standard Phase Estimation (&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit QPE&lt;/a&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="14447" LastEditorUserId="55" LastEditDate="2021-02-17T09:48:49.013" LastActivityDate="2021-02-17T09:48:49.013" Title="How do I calculate the number of uses of a unitary $U$ in iterative phase estimation?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16071" PostTypeId="1" CreationDate="2021-02-16T14:23:21.893" Score="1" ViewCount="47" Body="&lt;p&gt;I was working on max-cut problem. To do I have been given a graph of unweighted version, and I have to convert it into weighted version. I did it using qiskit. Now I was playing around the code, hence I have been assigning some arbitrary weight value to the edges. Then I found some confusing results. The more I am changing, the more I am unable to decode what is going on?&lt;/p&gt;&#xA;&lt;p&gt;Lets elaborate, imagine this is my unweighted version graph (it is taken from qiskit textbook), in this graph weight is 1. so whenever I am changing the value of weight from 1 to 3,4,5 etc. I am not getting the desired solution {11011} or {00100}.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ix0z3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ix0z3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13387" LastEditorUserId="4501" LastEditDate="2021-02-17T09:00:34.047" LastActivityDate="2021-02-17T09:00:34.047" Title="Will there be any difference in solution for a weighted and unweighted graph? I mean is there any relation between weight and solution?" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;mathematics&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16072" PostTypeId="2" ParentId="16069" CreationDate="2021-02-16T16:14:24.647" Score="5" Body="&lt;p&gt;There is actually a nice way in Qiskit to transform a matrix of an optimization problem into an qubit operator that can be translated into a quadratic program. I'll put here the example, note this is possible for many optimization problems, find every one &lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.optimization.applications.ising.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; in case you want to test something else! For example &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/6_examples_max_cut_and_tsp.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; it is done for MaxCut and TSP, it could show you with other examples how to do what I did here !&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;from qiskit import Aer&#xA;from qiskit.optimization.applications.ising import stable_set&#xA;from qiskit.aqua.algorithms import VQE, NumPyMinimumEigensolver, QAOA&#xA;from qiskit.aqua import aqua_globals&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.optimization.applications.ising.common import sample_most_likely&#xA;from qiskit.optimization.algorithms import MinimumEigenOptimizer&#xA;from qiskit.optimization.problems import QuadraticProgram&#xA;&#xA;&#xA;w = np.array([[-1., 2., 0.],&#xA; [0., -1., 2.],&#xA; [0., 0., -1.]])&#xA;&#xA;&#xA;qubitOp, offset = stable_set.get_operator(w)&#xA;print('Offset:', offset)&#xA;print('Ising Hamiltonian:')&#xA;print(qubitOp.print_details())&#xA;&#xA;# mapping Ising Hamiltonian to Quadratic Program&#xA;qp = QuadraticProgram()&#xA;qp.from_ising(qubitOp, offset)&#xA;qp.to_docplex().prettyprint()&#xA;&#xA;aqua_globals.random_seed = np.random.default_rng(123)&#xA;seed = 10598&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;quantum_instance = QuantumInstance(backend, seed_simulator=seed, seed_transpiler=seed)&#xA;&#xA;qaoa = QAOA(quantum_instance=quantum_instance, p = 3)&#xA;&#xA;# create minimum eigen optimizer based on qaoa&#xA;qaoa_optimizer = MinimumEigenOptimizer(qaoa)&#xA;&#xA;# solve quadratic program&#xA;result = qaoa_optimizer.solve(qp)&#xA;print(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And it will give you this result&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Offset: 0.5&#xA;Ising Hamiltonian:&#xA;IZZ (1+0j)&#xA;ZZI (1+0j)&#xA;IIZ (0.5+0j)&#xA;IZI (0.5+0j)&#xA;ZII (-1.5+0j)&#xA;&#xA;// This file has been generated by DOcplex&#xA;// model name is: AnonymousModel&#xA;// single vars section&#xA;dvar bool x_0;&#xA;dvar bool x_1;&#xA;dvar bool x_2;&#xA;&#xA;minimize&#xA; [ - 3 x_0^2 + 4 x_0*x_1 - 5 x_1^2 + 4 x_1*x_2 + x_2^2 ] + 2;&#xA; &#xA;subject to {&#xA;&#xA;}&#xA;optimal function value: -3.0&#xA;optimal value: [0. 1. 0.]&#xA;status: SUCCESS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope this helps, please tell me if something is not clear and I'll explain better! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-02-16T16:14:24.647" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="16073" PostTypeId="1" CreationDate="2021-02-16T16:17:57.617" Score="2" ViewCount="153" Body="&lt;p&gt;I have been given and expression for a probability distribution&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(x,y,z)= \sum_\lambda P(x|y,\lambda)P(y|\lambda,z)P(z)P(\lambda)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and I have been asked to show that the above expression can be written in the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(x,y,z)= Tr(\rho_{AB}(E_A^{x|y} \otimes E_B^{y|z}))P(z)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; a density matrix and &lt;span class=&quot;math-container&quot;&gt;$E_A^{x|y}, E_B^{y|z}$&lt;/span&gt; POVMs on system AB.&lt;/p&gt;&#xA;&lt;p&gt;I have no clue of even how the trace comes into picture. I have no clue as to how the first expression can be simplified to get a trace, let alone getting the whole expression correctly.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://math.stackexchange.com/q/4027981/173147&quot;&gt;Cross-posted on math.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The answer over there is also interesting to look at......&lt;/p&gt;&#xA;" OwnerUserId="14867" LastEditorUserId="14867" LastEditDate="2021-04-19T08:04:05.703" LastActivityDate="2021-04-19T08:04:05.703" Title="How to express a probability distribution $P(x,y,z)= \sum_\lambda P(x|y,\lambda)P(y|\lambda,z)P(z)P(\lambda)$ in terms of a trace of a density matrix?" Tags="&lt;density-matrix&gt;&lt;probability&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16074" PostTypeId="1" AcceptedAnswerId="16079" CreationDate="2021-02-16T17:28:47.417" Score="4" ViewCount="100" Body="&lt;p&gt;An answer to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15425/simulate-a-quantum-channel-with-a-certain-fidelity&quot;&gt;this question&lt;/a&gt; shows how to calculate the average fidelity of a depolarizing channel. How would one go about calculating this for an &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_damping_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;amplitude dampening channel&lt;/a&gt;? I tried working out the math myself but had no luck. The tricks used in the previous answer can't be applied in this new scenario it seems...&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="10480" LastEditDate="2021-02-17T09:18:23.677" LastActivityDate="2021-02-17T18:33:34.593" Title="How to calculate the average fidelity of an amplitude damping channel" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16075" PostTypeId="2" ParentId="16073" CreationDate="2021-02-16T20:35:43.503" Score="4" Body="&lt;p&gt;First, recall that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr} A = \sum_i \langle i|A|i \rangle$&lt;/span&gt;. Each equation is then a sum where all terms are products of &lt;span class=&quot;math-container&quot;&gt;$P(z)$&lt;/span&gt; and three other quantities. Further, the sum in the first equation ranges over a single index suggesting that all matrices under the trace are diagonal. In fact, since we are working with a composite system this also suggests that the basis in which the POVM elements are diagonal is the Schmidt basis of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. At this point we could check which way of mapping the factors between the two equations works, but we don't have to do that since the superscripts on the POVM elements helpfully tell us the mapping.&lt;/p&gt;&#xA;&lt;p&gt;Taking these observations into account we guess&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_A^{x|y} = \sum_\lambda P(x|y,\lambda) |\lambda\rangle\langle\lambda| \\&#xA;E_B^{y|z} = \sum_\lambda P(y|\lambda,z) |\lambda\rangle\langle\lambda| \\&#xA;|\psi_{AB}\rangle = \sum_\lambda \sqrt{P(\lambda)} |\lambda\rangle|\lambda\rangle \\&#xA;\rho_{AB} = |\psi_{AB}\rangle\langle\psi_{AB}|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle$&lt;/span&gt; is an orthonormal basis. Now, &lt;span class=&quot;math-container&quot;&gt;$E_A^{x|y}$&lt;/span&gt; is a valid POVM for fixed &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and similarly &lt;span class=&quot;math-container&quot;&gt;$E_B^{y|z}$&lt;/span&gt; for fixed &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;. It is not clear from the question that this is the desired POVM structure, but it is what is suggested by the conditional sign in the superscripts.&lt;/p&gt;&#xA;&lt;p&gt;Let's try our guess&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;P(x,y,z) &amp;amp;= P(z)\,\mathrm{tr}\left(\rho_{AB}(E_A^{x|y} \otimes E_B^{y|z})\right) \\&#xA;&amp;amp;= P(z) \sum_{\lambda_1,\lambda_2}\langle\lambda_1|\langle\lambda_2|\rho_{AB}\left(E_A^{x|y} \otimes E_B^{y|z}\right)|\lambda_1\rangle|\lambda_2\rangle \\&#xA;&amp;amp;= P(z) \sum_{\lambda_1,\lambda_2}\langle\lambda_1|\langle\lambda_2|\sum_{\lambda_3, \lambda_4} \sqrt{P(\lambda_3)P(\lambda_4)} |\lambda_3\rangle\langle\lambda_4| \otimes |\lambda_3\rangle\langle\lambda_4| \\ &amp;amp; \left(E_A^{x|y} \otimes E_B^{y|z}\right)|\lambda_1\rangle|\lambda_2\rangle \\&#xA;&amp;amp;= P(z) \sum_{\lambda_3,\lambda_4}\sqrt{P(\lambda_3)P(\lambda_4)}\langle\lambda_4|\langle\lambda_4|\left(E_A^{x|y} \otimes E_B^{y|z}\right)|\lambda_3\rangle|\lambda_3\rangle \\&#xA;&amp;amp;= P(z) \sum_{\lambda_3,\lambda_4}\sqrt{P(\lambda_3)P(\lambda_4)} \\ &amp;amp; \langle\lambda_4|\langle\lambda_4|\left(\sum_{\lambda_5} P(x|y,\lambda_5) |\lambda_5\rangle\langle\lambda_5| \otimes \sum_{\lambda_6} P(y|\lambda_6,z) |\lambda_6\rangle\langle\lambda_6|\right)|\lambda_3\rangle|\lambda_3\rangle \\&#xA;&amp;amp;= P(z) \sum_{\lambda}P(\lambda)P(x|y,\lambda) P(y|\lambda,z).&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-16T20:44:15.697" LastActivityDate="2021-02-16T20:44:15.697" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16077" PostTypeId="2" ParentId="15973" CreationDate="2021-02-17T08:46:08.717" Score="3" Body="&lt;p&gt;As I now understand the question, it is more a question of &amp;quot;can logical controlled-not be implemented without decoding the states first?&amp;quot; which is a thoroughly different question to simply &amp;quot;can this circuit be simplified?&amp;quot;. In fact, what that question &lt;em&gt;really&lt;/em&gt; means is that, throughout the whole circuit, a single-qubit error should never be able to create a logical error in the code.&lt;/p&gt;&#xA;&lt;p&gt;I don't believe that this can be done for this specific code. Usually, one has to build the facility into the code by design. This is one of the key things that the stabilizer formalism helps you with.&lt;/p&gt;&#xA;&lt;p&gt;Let me try to explain my thinking a bit (not that this is a rigorous proof of impossibility). First, we need to know the logical-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; for the code. This is reasonably straightforward: if we group terms&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle_L=-\frac{\sqrt{3}}{4}(e^{i\pi/3}|0\rangle+|1\rangle)|0\rangle+\frac{e^{i2\pi/3}}{4}(3|0\rangle-|1\rangle)|1\rangle&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|1\rangle_L=-\frac{\sqrt{3}}{4}(e^{i\pi/3}|0\rangle+|1\rangle)|0\rangle+\frac{e^{i2\pi/3}}{4}(3|1\rangle-|0\rangle)|1\rangle.&#xA;$$&lt;/span&gt;&#xA;To convert between the two, we need a controlled-not controlled off the second qubit targeting the first.&lt;/p&gt;&#xA;&lt;p&gt;Thus, to make logical controlled-not, you need to apply (physical) controlled-not on the second pair of qubits controlled off the state of the first pair of qubits. This already suggests that you need something of the complexity of at least Toffoli, so in terms of simple gate counts, it seems unlikely that your circuit could be bettered.&lt;/p&gt;&#xA;&lt;p&gt;But how might we implement that control? The most obvious is to decode the qubit first and control off that. That's what we're trying to avoid. The next most natural idea is a little trick: find local unitaries &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;U\otimes V|0\rangle_L&amp;amp;=\alpha|00\rangle+\beta|11\rangle \\&#xA;U\otimes V|1\rangle_L&amp;amp;=\gamma|01\rangle+\delta|10\rangle&#xA;\end{align*}&lt;/span&gt;&#xA;I haven't verified whether such a transformation exists, but chances are fair because we choose &lt;span class=&quot;math-container&quot;&gt;$U,V$&lt;/span&gt; to find the Schmidt decomposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_L$&lt;/span&gt;, guaranteeing the first line. Then, of course, &lt;span class=&quot;math-container&quot;&gt;$U\otimes V|1\rangle_L$&lt;/span&gt; must be orthogonal to &lt;span class=&quot;math-container&quot;&gt;$U\otimes V|0\rangle_L$&lt;/span&gt; so you're only worrying if it contains a component &lt;span class=&quot;math-container&quot;&gt;$\beta|00\rangle-\alpha|00\rangle$&lt;/span&gt;. So, let's assume such a transformation exists (if it doesn't, then I think you have very little hope). If so, then once we've applied &lt;span class=&quot;math-container&quot;&gt;$U\otimes V$&lt;/span&gt; to the first pair of qubits, the parity of the two qubits tells us the logical state. Hence, we'd be able to implement the logical controlled-not using a pair of Toffolis:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zZPft.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zZPft.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;This looks not too bad. However, even in this case, given that your logical states have the same Schmidt coefficients, that rather suggests that &lt;span class=&quot;math-container&quot;&gt;$\{\alpha,\beta\}=\{\gamma,\delta\}$&lt;/span&gt; (perhaps up to some phases). But if that's the case, then applying Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on just one of the qubits will inter-convert the logical states, i.e. you've got the same error susceptibility that you're trying to avoid. I think there's very little hope of avoiding this for a two-qubit code.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-17T08:46:08.717" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16079" PostTypeId="2" ParentId="16074" CreationDate="2021-02-17T09:14:55.307" Score="6" Body="&lt;p&gt;An elementary method is to simply carry out the integration&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\overline{F} &amp;amp;= \int\langle\psi|\mathcal{N_\gamma}(|\psi\rangle\langle\psi|)|\psi\rangle d\psi\\&#xA;&amp;amp;=\int\langle\psi|K_0|\psi\rangle\langle\psi|K_0^\dagger|\psi\rangle + \langle\psi|K_1|\psi\rangle\langle\psi|K_1^\dagger|\psi\rangle d\psi\\&#xA;&amp;amp; =\frac{1}{4\pi}\int_0^\pi\int_0^{2\pi}\left|\begin{pmatrix}\cos\frac{\theta}{2}&amp;amp;e^{-i\phi}\sin\frac{\theta}{2}\end{pmatrix}\begin{pmatrix}1 &amp;amp; 0 \\0 &amp;amp; \sqrt{1 - \gamma}\end{pmatrix}\begin{pmatrix}\cos\frac{\theta}{2}\\e^{i\phi}\sin\frac{\theta}{2}\end{pmatrix}\right|^2\sin\theta \\&#xA;&amp;amp; + \left|\begin{pmatrix}\cos\frac{\theta}{2}&amp;amp;e^{-i\phi}\sin\frac{\theta}{2}\end{pmatrix}\begin{pmatrix}0 &amp;amp; \sqrt{\gamma} \\0 &amp;amp; 0\end{pmatrix}\begin{pmatrix}\cos\frac{\theta}{2}\\e^{i\phi}\sin\frac{\theta}{2}\end{pmatrix}\right|^2\sin\theta d\phi d\theta \\&#xA;&amp;amp;=\frac{1}{4\pi}\int_0^\pi\int_0^{2\pi}\left|\cos^2\frac{\theta}{2}+\sqrt{1-\gamma}\sin^2\frac{\theta}{2}\right|^2\sin\theta + \left|\sqrt{\gamma}e^{i\phi}\sin\frac{\theta}{2}\cos\frac{\theta}{2}\right|^2\sin\theta d\phi d\theta \\&#xA;&amp;amp;=\frac{1}{2}\int_0^\pi\left(\cos^4\frac{\theta}{2}+(1-\gamma)\sin^4\frac{\theta}{2}+\frac{\sqrt{1-\gamma}}{2}\sin^2\theta + \frac{\gamma}{4}\sin^2\theta\right)\sin\theta d\theta \\&#xA;&amp;amp;=\frac{1}{2}\int_0^\pi\sin\theta\cos^4\frac{\theta}{2}+(1-\gamma)\sin\theta\sin^4\frac{\theta}{2}+\frac{\gamma+2\sqrt{1-\gamma}}{4}\sin^3\theta d\theta \\&#xA;&amp;amp;=\frac{1}{2}\left(\frac{2}{3} + (1-\gamma)\frac{2}{3} + \frac{\gamma+2\sqrt{1-\gamma}}{4}\frac{4}{3}\right) \\&#xA;&amp;amp;=\frac{1}{2}\left(\frac{4}{3} - \frac{\gamma}{3} + \frac{2\sqrt{1-\gamma}}{3}\right) \\&#xA;&amp;amp;=\frac{2}{3}-\frac{\gamma}{6} + \frac{\sqrt{1-\gamma}}{3}.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A computationally easier, but conceptually more sophisticated approach is based on the fact that the eigenstates of the Pauli operators, i.e. &lt;span class=&quot;math-container&quot;&gt;$S=\{|0\rangle, |1\rangle, |+\rangle, |-\rangle, |{+i}\rangle, |{-i}\rangle\}$&lt;/span&gt; form a spherical &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-design and thus averaging  any expression of the form &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|A|\psi\rangle\langle\psi|B|\psi\rangle$&lt;/span&gt; over the six states gives the same result as averaging it over the Haar measure (see e.g. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0310075&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;). Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\overline{F} &amp;amp;= \int\langle\psi|\mathcal{N_\gamma}(|\psi\rangle\langle\psi|)|\psi\rangle d\psi \\&#xA;&amp;amp;=\frac{1}{|S|}\sum_{\psi\in S}\langle\psi|\mathcal{N_\gamma}(|\psi\rangle\langle\psi|)|\psi\rangle \\&#xA;&amp;amp;=\frac{1}{6}\left[1 + 1 - \gamma + 4 \cdot \left(\frac{1}{2} + \frac{\sqrt{1-\gamma}}{2}\right)\right] \\&#xA;&amp;amp;= \frac{2}{3} - \frac{\gamma}{6} + \frac{\sqrt{1-\gamma}}{3}&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where individual fidelities&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\langle 0|\mathcal{N_\gamma}(|0\rangle\langle 0|)|0\rangle &amp;amp;= 1 \\&#xA;\langle 1|\mathcal{N_\gamma}(|1\rangle\langle 1|)|1\rangle &amp;amp;= 1 - \gamma \\&#xA;\langle +|\mathcal{N_\gamma}(|+\rangle\langle +|)|+\rangle &amp;amp;= \frac{1}{2} + \frac{\sqrt{1-\gamma}}{2} \\&#xA;\langle -|\mathcal{N_\gamma}(|-\rangle\langle -|)|-\rangle &amp;amp;= \frac{1}{2} + \frac{\sqrt{1-\gamma}}{2} \\&#xA;\langle {+i}|\mathcal{N_\gamma}(|{+i}\rangle\langle {+i}|)|{+i}\rangle &amp;amp;= \frac{1}{2} + \frac{\sqrt{1-\gamma}}{2} \\&#xA;\langle {-i}|\mathcal{N_\gamma}(|{-i}\rangle\langle {-i}|)|{-i}\rangle &amp;amp;= \frac{1}{2} + \frac{\sqrt{1-\gamma}}{2} \\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are easily computed using&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{N_\gamma}\left(\begin{pmatrix}a &amp;amp; b \\ c &amp;amp; d\end{pmatrix}\right) = \begin{pmatrix}&#xA;a+d\gamma &amp;amp; b\sqrt{1-\gamma} \\&#xA;c\sqrt{1-\gamma} &amp;amp; d(1-\gamma)&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-17T18:33:34.593" LastActivityDate="2021-02-17T18:33:34.593" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16081" PostTypeId="1" AcceptedAnswerId="16083" CreationDate="2021-02-17T12:02:13.497" Score="2" ViewCount="67" Body="&lt;p&gt;The number of the Grover's diffuser iterations is proportional to square root of the amount of input data, but how is this realized when building a real quantum circuit? Is it simply by concatenating the needed number of diffusers one after another (in which case I assume the circuit designer is required to know the needed number of iterations beforehand)?&lt;/p&gt;&#xA;" OwnerUserId="4204" LastEditorUserId="55" LastEditDate="2021-02-18T10:52:34.167" LastActivityDate="2021-02-18T10:52:34.167" Title="How is the Grover iteration realized in an actual quantum circuit?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;physical-realization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16082" PostTypeId="1" CreationDate="2021-02-17T13:26:46.093" Score="2" ViewCount="53" Body="&lt;p&gt;According to paper &lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising formulations of many NP problems&lt;/a&gt;, Vertex Cover problem has the following Ising formulation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\underset{x}{\text{min }} f(x) = a\sum_{(i,j) \in E}(1-x_i)(1-x_j) + b\sum_{i \in V} x_i.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'd like to share some doubts of mine.&lt;/p&gt;&#xA;&lt;p&gt;Ising formulation has spin variables &lt;span class=&quot;math-container&quot;&gt;$\{+1,-1\}$&lt;/span&gt;, not logical variable &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt;. Shouldn't it be considered a QUBO problem?&lt;/p&gt;&#xA;&lt;p&gt;By considering this formulation as a QUBO problem, then I should get the Ising formulation by mapping &lt;span class=&quot;math-container&quot;&gt;$x_i \rightarrow \frac{1 - \text{Z}_i}{2}$&lt;/span&gt; as follows:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H = \frac{a}{4}\sum_{(i,j) \in E}(\text{Z}_i + \text{Z}_j + \text{Z}_i\text{Z}_j) - \frac{b}{2}\sum_{i \in V}\text{Z}_i + |V|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, from &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/optimization/applications/ising/vertex_cover.html#get_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit library&lt;/a&gt; authors consider the following hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = a\sum_{(i,j) \in E}(1-\text{X}_i)(1-\text{X}_j) +b\sum_{i \in V}\text{Z}_i.$$&lt;/span&gt;&#xA;which seems different from both previous formulations. Are the two hamiltonians somehow equivalent?&lt;/p&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="8954" LastEditDate="2021-02-17T13:58:51.660" LastActivityDate="2021-02-18T10:20:14.647" Title="Vertex Cover mappings from QUBO to Ising and vice versa" Tags="&lt;qiskit&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16083" PostTypeId="2" ParentId="16081" CreationDate="2021-02-17T16:51:13.570" Score="5" Body="&lt;p&gt;A quantum logic circuit isn't a literal physical object, it's a plan for what operations to perform. It's like sheet music. The piano maker doesn't have to know how long the song is when making the piano, they instead provide reusable keys that the player will just keep hitting until the song is done.&lt;/p&gt;&#xA;&lt;p&gt;In a superconducting qubit device, the &amp;quot;keys&amp;quot; are microwave pulses bounced off the superconducting circuit. Each pulse performs some fixed operation. You would run Grover's algorithm by decomposing its operations into those pulses and playing them until the song is done.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-02-17T16:51:13.570" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16084" PostTypeId="1" CreationDate="2021-02-17T17:43:49.210" Score="2" ViewCount="66" Body="&lt;p&gt;I am trying to understand how QRAM will help improve algorithm performance. I am reading a paper on Q-means classification, but I have noticed that some other algorithms (Grovers) seem to have a dependence on QRAM as well&lt;/p&gt;&#xA;&lt;p&gt;For some algorithms, does then the speed-up only come from using QRAM - that it has some property where it allows lookup of data very fast? Is this the case?&lt;/p&gt;&#xA;" OwnerUserId="12955" LastEditorUserId="12955" LastEditDate="2021-02-18T11:37:09.393" LastActivityDate="2021-02-18T15:06:49.463" Title="Q-means, QRAM and how it helps algorithmic speedup" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;quantum-advantage&gt;&lt;quantum-memory&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16085" PostTypeId="2" ParentId="16084" CreationDate="2021-02-17T19:04:54.373" Score="2" Body="&lt;p&gt;&lt;em&gt;Partial answer (why qRAM is useful)&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Currently, quantum computers do not have an operational memory. Quantum processor is composed of qubits which can be considered to be an elementary memory. However, they are rather used for performing calculations. There is no way how to save intermediate results.&lt;/p&gt;&#xA;&lt;p&gt;Of course, you can measure an output of the quantum processor and based on this measurement to re-program the processor and run an algorithm with this new input. However, to get complete information, you need to perform so-called quantum tomography. This method is exponentially complex, hence it erase any speed up gained by the quantum algorithm. Moreover, you need many copies of measured qubits, i.e. to run the algorithm with original setting many times. But in case of qRAM, you can simply save a qubit in the memory (it is not as simple as it sounds, you need to establish entanglement between saved qubit and the memory, move the qubit to the memory and uncompute qubit in the processor - &lt;em&gt;sorry, this is rather crude description&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;To conclude, not to have a quantum RAM and use classical register and measurement instead, could completely destroy advantage brought by some quantum algorithms.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2021-02-18T15:06:49.463" LastActivityDate="2021-02-18T15:06:49.463" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16086" PostTypeId="1" CreationDate="2021-02-18T01:37:21.903" Score="3" ViewCount="45" Body="&lt;p&gt;Let a measurement be described by POVM elements &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; such that probability &lt;span class=&quot;math-container&quot;&gt;$p(i) = Tr[\rho M_i]$&lt;/span&gt; for some state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. I want to know whether there is some notion of work associated with such measurements.&lt;/p&gt;&#xA;" OwnerUserId="14671" LastEditorUserId="55" LastEditDate="2021-02-18T10:54:06.997" LastActivityDate="2021-02-18T10:54:06.997" Title="Is there some notion of work associated with performing a measurement?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16087" PostTypeId="1" AcceptedAnswerId="16088" CreationDate="2021-02-18T06:57:44.667" Score="1" ViewCount="94" Body="&lt;p&gt;It's easy to see that in computational basis, Pauli matrices could be represented in the outer product form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X=|0\rangle\langle1|+|1\rangle\langle0|\\&#xA;Y=-i|0\rangle\langle1|+i|1\rangle\langle0|\\&#xA;Z=|0\rangle\langle0|-|1\rangle\langle1|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we want to represent the outer products in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, one way I can think of is to use the identities&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle=\frac{1}{\sqrt{2}}(|+\rangle+|-\rangle)\\&#xA;|1\rangle=\frac{1}{\sqrt{2}}(|+\rangle-|-\rangle)&#xA;$$&lt;/span&gt;&#xA;and plug them in the first three equations. I'm wondering is there a simpler / more direct way we can do that? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-02-21T13:28:49.283" LastActivityDate="2021-02-21T13:28:49.283" Title="Is there a different way to represent Pauli gates in X basis?" Tags="&lt;textbook-and-exercises&gt;&lt;matrix-representation&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16088" PostTypeId="2" ParentId="16087" CreationDate="2021-02-18T07:49:31.287" Score="2" Body="&lt;p&gt;By far the most direct way is to realise that you'd be writing (for example)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y=a_{++}|+\rangle\langle +|+a_{+-}|+\rangle\langle -|+a_{-+}|-\rangle\langle +|+a_{--}|-\rangle\langle-|.&#xA;$$&lt;/span&gt;&#xA;You can then evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a_{+-}=\langle +|Y|-\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You might shave a little bit off your calculations by realising that (i) the representation will be a Hermitian matrix, so &lt;span class=&quot;math-container&quot;&gt;$a_{+-}=a_{-+}^\star$&lt;/span&gt;, (ii) all Pauli matrices have trace 0 so &lt;span class=&quot;math-container&quot;&gt;$a_{++}=-a_{--}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Perhaps the easier computation comes from first representing each of the Pauli matrices in the standard basis. For example,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y\equiv\left(\begin{array}{cc} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Then you realise that all you're trying to do is a basis transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=|0\rangle\langle+|+|1\rangle\langle -|\equiv\frac{1}{\sqrt{2}}\left(\begin{array}{cc}&#xA;1 &amp;amp; 1 \\&#xA;1 &amp;amp; -1&#xA;\end{array}\right),&#xA;$$&lt;/span&gt;&#xA;so to make the transformation you calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;UYU^\dagger\equiv\left(\begin{array}{cc} 0 &amp;amp; i \\ -i &amp;amp; 0 \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;Hence,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y=i|+\rangle\langle -|-i|-\rangle\langle +|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-18T07:49:31.287" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16089" PostTypeId="2" ParentId="16082" CreationDate="2021-02-18T10:20:14.647" Score="2" Body="&lt;p&gt;First, I agree with the fact that this is actually a QUBO form and not an Ising model, I think they allow themselves the shortcut from one to the other because of the mapping from bits to spins.&lt;/p&gt;&#xA;&lt;p&gt;Second, notice that in the Qiskit documentation you pointed, they use the mapping &lt;span class=&quot;math-container&quot;&gt;$X_i = \frac{Z_i+1}{2}$&lt;/span&gt;. Now, if I didn't make mistakes, by replacing &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; with this mapping in the QUBO form of the first paper, you end up with this :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{a}{4}\sum\limits_{ij \in E}(1-Z_i)(1-Z_j) +\frac{b}{2}\sum_iZ_i +\frac{b}{2}|V| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if you replace &lt;span class=&quot;math-container&quot;&gt;$X_I$&lt;/span&gt; in the hamiltonian form from Qiskit (I believe &lt;span class=&quot;math-container&quot;&gt;$A = 5$&lt;/span&gt; here):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{A}{4}\sum\limits_{ij \in E}(1-Z_i)(1-Z_j)+\sum_i Z_i $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, they have the same form, with a few different details but irrelevant in the resolution of the problem.&lt;/p&gt;&#xA;&lt;p&gt;Hope this clears your question, please tell me if you need something else ;)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-02-18T10:20:14.647" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16090" PostTypeId="1" AcceptedAnswerId="16094" CreationDate="2021-02-18T11:27:58.670" Score="4" ViewCount="73" Body="&lt;p&gt;I have found quite a bit of information on the UCC ansatz, but I cannot really find basic explanations for the Ry and RyRz ansatzs... Are they just applying these gates to a circuit? If anyone has good material on this I would greatly appreciate it!&lt;/p&gt;&#xA;" OwnerUserId="14621" LastActivityDate="2021-02-18T13:32:41.487" Title="Ansatz explanation for VQE" Tags="&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16092" PostTypeId="2" ParentId="16084" CreationDate="2021-02-18T12:20:48.407" Score="1" Body="&lt;p&gt;I think the point is that many quantum algorithms prove/are believed to be efficient to process data &lt;em&gt;when said data is encoded in a quantum state&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An easy example of this being Grover, which produces (with high probability yada yada yada) the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; corresponding to the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt; for some given &amp;quot;oracle function&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&#xA;But the catch is that, if you want to think of this as &amp;quot;&lt;em&gt;finding which element of &lt;span class=&quot;math-container&quot;&gt;$\{x_1,...,x_n\}\subset\mathbb R^n$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$f(x_i)=1$&lt;/span&gt;&lt;/em&gt;&amp;quot;, you need to include the process of preparing a quantum state of the form &lt;span class=&quot;math-container&quot;&gt;$\sum_i |x_i\rangle$&lt;/span&gt; into your complexity calculations. This is essentially what qRAM proposals strive to do.&lt;/p&gt;&#xA;&lt;p&gt;In other words, many of these &amp;quot;quantum machine learning algorithms&amp;quot; show/argue that you can efficiently obtain the wanted result by processing quantum states that encode a given set of classical data vectors. But this is quite different than saying that these algorithms allow you to process efficiently the classical datasets in the first place.&#xA;You can make the two things (sort of) equivalent if you can show that using a &amp;quot;qRAM&amp;quot; you can always load classical data efficiently into a quantum memory, but, as far as I know, whether this is indeed possible/practical remains a murky point that is still actively investigated.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-18T12:20:48.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16093" PostTypeId="2" ParentId="15110" CreationDate="2021-02-18T12:36:35.687" Score="1" Body="&lt;p&gt;To get the state of a single qubit in a system you can &lt;a href=&quot;https://physics.stackexchange.com/questions/179671/how-to-take-partial-trace&quot;&gt;trace out&lt;/a&gt; all other qubits. That means you only care about the amplitude of your single qubit and discard the information on the rest.&lt;/p&gt;&#xA;&lt;p&gt;In Qiskit you can use the &lt;code&gt;qiskit.quantum_info.partial_trace&lt;/code&gt; function. Here's the code to compare your two states:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.quantum_info import partial_trace, Statevector&#xA;&#xA;# define your two states as circuits&#xA;psi = QuantumCircuit(5)&#xA;psi.ry(np.pi/4.,0)&#xA;psi.x(0)&#xA;psi.x(1)&#xA;&#xA;psi2 = QuantumCircuit(5)&#xA;psi2.ry(np.pi/4.,0)&#xA;psi2.x(0)&#xA;&#xA;def first_qubit_state(circuit):&#xA;    &amp;quot;&amp;quot;&amp;quot;Get the statevector for the first qubit, discarding the rest.&amp;quot;&amp;quot;&amp;quot;&#xA;    # get the full statevector of all qubits&#xA;    full_statevector = Statevector(circuit)&#xA;&#xA;    # get the density matrix for the first qubit by taking the partial trace&#xA;    partial_density_matrix = partial_trace(full_statevector, [1, 2, 3, 4])&#xA;&#xA;    # extract the statevector out of the density matrix&#xA;    partial_statevector = np.diagonal(partial_density_matrix)&#xA;&#xA;    return partial_statevector&#xA;&#xA;def compare_first_qubits(circuit1, circuit2):&#xA;    &amp;quot;&amp;quot;&amp;quot;Return True if the statevector of the first qubits is the same.&amp;quot;&amp;quot;&amp;quot;&#xA;    state1 = first_qubit_state(circuit1)&#xA;    state2 = first_qubit_state(circuit2)&#xA;    return (state1 == state2).all()  # True if all are the same&#xA;&#xA;&#xA;print('State of first qubit in psi:\n', first_qubit_state(psi))&#xA;print('State of first qubit in psi2:\n', first_qubit_state(psi2))&#xA;print('Equal?', compare_first_qubits(psi, psi2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Running this script gives:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;State of first qubit in psi:&#xA; [0.14644661+0.j 0.85355339+0.j]&#xA;State of first qubit in psi2:&#xA; [0.14644661+0.j 0.85355339+0.j]&#xA;Equal? True&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-02-18T12:36:35.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16094" PostTypeId="2" ParentId="16090" CreationDate="2021-02-18T13:32:41.487" Score="5" Body="&lt;p&gt;In term of the &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; Ansatze, from my understanding, this is because many systems of interest, the Hamiltonian contains only real terms. And if we have real Hamiltonian, then the decomposition of the matrix representation of the Hamiltonian can be achieved with real eigenvectors.&lt;/p&gt;&#xA;&lt;p&gt;Now, a single-qubit &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation confined the qubit state remains real. That is, it is restricted to the &lt;span class=&quot;math-container&quot;&gt;$xz$&lt;/span&gt;-plane. You can see this through the Bloch-sphere visualization below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/740xL.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/740xL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, if we use CNOT as our entangling gate operation, then it has a real representation. Thus if we restrict our single-qubit operations to leave each qubit state in the real subspace then the state as a whole will be in real. This is why, people consider the &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; ansatze:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;┌──────────┐ ░                 ░ ┌──────────┐ ░                 ░ ┌──────────┐&#xA;┤ RY(θ[0]) ├─░───■────■────────░─┤ RY(θ[3]) ├─░───■────■────────░─┤ RY(θ[6]) ├&#xA;├──────────┤ ░ ┌─┴─┐  │        ░ ├──────────┤ ░ ┌─┴─┐  │        ░ ├──────────┤&#xA;┤ RY(θ[1]) ├─░─┤ X ├──┼────■───░─┤ RY(θ[4]) ├─░─┤ X ├──┼────■───░─┤ RY(θ[7]) ├&#xA;├──────────┤ ░ └───┘┌─┴─┐┌─┴─┐ ░ ├──────────┤ ░ └───┘┌─┴─┐┌─┴─┐ ░ ├──────────┤&#xA;┤ RY(θ[2]) ├─░──────┤ X ├┤ X ├─░─┤ RY(θ[5]) ├─░──────┤ X ├┤ X ├─░─┤ RY(θ[8]) ├&#xA;└──────────┘ ░      └───┘└───┘ ░ └──────────┘ ░      └───┘└───┘ ░ └──────────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also note that this Ansatze has the name &amp;quot;Real Amplitudes&amp;quot; in qiskit. This is because what I described above.&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation follow by &lt;span class=&quot;math-container&quot;&gt;$RZ$&lt;/span&gt; rotation will allows you to get more general quantum states, states with non-real amplitudes. Thus this Ansatze, &lt;span class=&quot;math-container&quot;&gt;$RYRZ$&lt;/span&gt; Ansatze, is aiming at a more general setting. But if you consider chemistry problem then most likely you should be able to get away with just using &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; Ansatze.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-18T13:32:41.487" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16095" PostTypeId="1" AcceptedAnswerId="16097" CreationDate="2021-02-18T16:38:03.143" Score="2" ViewCount="55" Body="&lt;p&gt;In quantum phase estimation we often see that approximating &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; ito an accuracy of &lt;span class=&quot;math-container&quot;&gt;$2^{-n}$&lt;/span&gt;. Can anybody explain what is the meaning of that?&lt;/p&gt;&#xA;&lt;p&gt;Does that mean after decimal we can only believe the n values? So if n=4, we can think of it as &lt;span class=&quot;math-container&quot;&gt;$0.1234567$&lt;/span&gt; only the 4 values are correct. So we should consider &lt;span class=&quot;math-container&quot;&gt;$0.1234$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I am asking this question because we face this situation when applying the phase estimation algorithm.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-18T20:24:46.960" Title="What is the meaning of approximating a phase to an accuracy of $2^{-n}$?" Tags="&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16096" PostTypeId="2" ParentId="6011" CreationDate="2021-02-18T16:46:18.177" Score="2" Body="&lt;p&gt;A bit late on this question, but for what it's worth, I recently put a paper on the arXiv which shows how to estimate &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|U|\psi\rangle$&lt;/span&gt; quadratically faster than the Hadamard test. &lt;a href=&quot;https://arxiv.org/abs/2102.04975&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2102.04975&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;A quick summary of the relevant part of the paper (without providing much intuition):&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The algorithm uses two registers, one containing a single ancilla qubit and the other is the main quantum system. Let's define the following operations on the two-register system:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\textbf{U} = |0\rangle\langle0| \otimes U + |1\rangle\langle1| \otimes U^\dagger$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\textbf{S} = 2|+,\psi\rangle\langle+,\psi| - \textbf{I}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\textbf{Q} = [X\otimes I] \textbf{S} \textbf{U}$$&lt;/span&gt;&#xA;The &lt;span class=&quot;math-container&quot;&gt;$\textbf{U}$&lt;/span&gt; operation acts &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on the system if the ancilla is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; if the ancilla is 1. The operation &lt;span class=&quot;math-container&quot;&gt;$\textbf{Q}$&lt;/span&gt; can be implemented using &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1)$&lt;/span&gt; calls to controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and the circuit that creates &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta) \equiv \mathrm{Re}[\langle\psi|U|\psi\rangle]$&lt;/span&gt;. The key idea is that running QPE with &lt;span class=&quot;math-container&quot;&gt;$\textbf{Q}$&lt;/span&gt; as the unitary and &lt;span class=&quot;math-container&quot;&gt;$|+,\psi\rangle$&lt;/span&gt; as the input state, will return either &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$2\pi-\theta$&lt;/span&gt;. SInce, &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta) = \cos(2\pi-\theta) = \mathrm{Re}[\langle\psi|U|\psi\rangle]$&lt;/span&gt;, this completes the estimation of the real part. One can also get the imaginary part using the same algorithm by noting that &lt;span class=&quot;math-container&quot;&gt;$Im[\langle\psi|U|\psi\rangle] = Re[\langle\psi|e^{-i\pi/2}U|\psi\rangle]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This algorithm inherits the quadratic speedup of QPE. The error in the estimate scales as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1/q)$&lt;/span&gt; in the number of calls &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; to the operation &lt;span class=&quot;math-container&quot;&gt;$\textbf{Q}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14886" LastEditorUserId="14886" LastEditDate="2021-02-19T04:00:24.810" LastActivityDate="2021-02-19T04:00:24.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16097" PostTypeId="2" ParentId="16095" CreationDate="2021-02-18T20:24:46.960" Score="2" Body="&lt;p&gt;As I said in the comments, the exponential showing the  accuracy is base 2. To get the number of &lt;strong&gt;deci&lt;/strong&gt;mals correct you need to convert it to base 10 :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ 2^n = 10^{n'} \Leftrightarrow n' = log_{10} (2^n) \Leftrightarrow n' = n * log_{10} (2) \approx n * 0.30102 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see we do not get a integer value, so we need to take the floor function (&lt;span class=&quot;math-container&quot;&gt;$\lfloor n' \rfloor$&lt;/span&gt;) of the result. This conversion is very current, please tell in the comments if you need clarifications on why we need base 10 or specific functions, tell me in the comments !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2021-02-18T20:24:46.960" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16098" PostTypeId="1" CreationDate="2021-02-19T04:03:46.283" Score="2" ViewCount="120" Body="&lt;p&gt;For example the following circuit is for &lt;span class=&quot;math-container&quot;&gt;$e^{-i(Z\otimes Z\otimes Z)\Delta t} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F2TrV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F2TrV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I know this can even be done without the ancilla qubit, having the CNOTs control the last qubit and applying an RZ on the last qubit. Also, if instead of only Zs, our Pauli matrix is any combination of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, we can still have it in this sort of format by swapping the &lt;span class=&quot;math-container&quot;&gt;$X-Z$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y-Z$&lt;/span&gt; bases before and after the circuit shown above.&lt;/p&gt;&#xA;&lt;p&gt;So if I have an operator like &lt;span class=&quot;math-container&quot;&gt;$e^{-i 0.022616399973028944  YYXX}$&lt;/span&gt;, in Qiskit, how I can make this into a circuit of this kind of form? I am looking for a function that does this for a general operator of this form. Is there such a function in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="13497" LastEditorUserId="55" LastEditDate="2021-02-20T16:22:46.550" LastActivityDate="2021-02-25T16:41:21.860" Title="How can I convert exponentials of pauli matrices to circuits of this form in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16099" PostTypeId="2" ParentId="16098" CreationDate="2021-02-19T05:19:47.703" Score="2" Body="&lt;p&gt;How about:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/R7CWf.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/R7CWf.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$X = HZH$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y= R_Z(-\pi/2) H Z H R_Z(\pi/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In term of is there a way to do this automatically in qiskit, I don't think there is a way to do this for general case in qiskit... but I might be wrong. My best bet is you will have to write your own function to do this automatically. It shouldn't be too much of a task.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you want to do it without the ancilla qubit case like you mentioned in your question, then you can use WeightedPauliOperator from qiskit.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pauli_dict = {'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0, &amp;quot;real&amp;quot;: 0.04523/2 }, &amp;quot;label&amp;quot;: &amp;quot;XXYY&amp;quot;}]}&#xA;operator = WeightedPauliOperator.from_dict(pauli_dict)&#xA;circuit = operator.evolve(evo_time= 1, num_time_slices=1).decompose()&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;will generate the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WwCtS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WwCtS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-19T05:46:32.167" LastActivityDate="2021-02-19T05:46:32.167" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16100" PostTypeId="1" AcceptedAnswerId="16101" CreationDate="2021-02-19T07:02:05.903" Score="0" ViewCount="51" Body="&lt;p&gt;Suppose I have a series of quantum circuits, each of them has 2 qubits:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2)&#xA;qc.h(0)&#xA;qc.crz(np.pi/2,0,1)&#xA;circ_list = [...say this is a list with 10 elements, each of them has the same structure above...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If I also have a larger quantum circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qcl = QuantumCircuit(8,8)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I want to compose each of the 10 'small circuits' onto the large circuit, I think a standard method would be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qcom = qcl.compose(circ_list[i],[2,3]) # [2,3] is a random choice&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, if I want to simultaneously compose 10 circuits, it looks like I need to repeat the argument 10 times. I'm wondering is there a simpler way I can do that? An analogy I can think of is the &lt;code&gt;reduce&lt;/code&gt; function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n = [4,3,2,1]&#xA;a = reduce(lambda x,y: x*y, n)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Can I do something similar to the reduce function to compose everything at once? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-02-19T07:26:40.937" Title="Can I keep composing a series of quantum circuits into a large quantum circuit?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16101" PostTypeId="2" ParentId="16100" CreationDate="2021-02-19T07:26:40.937" Score="2" Body="&lt;p&gt;Sure, you can do this with reduce but your list needs to also have the information about which registers you are composing onto.&lt;/p&gt;&#xA;&lt;p&gt;So if your circ_list was a list of tuples where the first component was the circuit object and the second component was a list indicating which registers this circuit will be composed onto like [2,3]&lt;/p&gt;&#xA;&lt;p&gt;Then you should be able to use reduce as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;reduce(lambda x,y: x.compose(y[0],y[1]),circ_list, qcl)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;See the docs on reduce for more description: &lt;a href=&quot;https://docs.python.org/3/library/functools.html#functools.reduce&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.python.org/3/library/functools.html#functools.reduce&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13497" LastActivityDate="2021-02-19T07:26:40.937" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16102" PostTypeId="1" CreationDate="2021-02-19T07:38:30.953" Score="4" ViewCount="63" Body="&lt;p&gt;Mapping second-quantized bosonic modes onto qubits can be done using various encodings. Each of those have their pro et contra. Fewer qubits — more gates, and vice versa. Encoding an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-level bosonic mode with unary mapping requires &lt;span class=&quot;math-container&quot;&gt;$(N+1)$&lt;/span&gt; qubits, with creation and annihilation operators being represented by &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; Pauli operators. Using binary/gray code results in using &lt;span class=&quot;math-container&quot;&gt;$\log_2N$&lt;/span&gt; qubits, with operators containing &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; Pauli terms. A good overview is given &lt;a href=&quot;https://www.nature.com/articles/s41534-020-0278-0&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, let us move to practical applications and do some trotterization. Unlike fermions, not only we are going to lose precision due to the finiteness of the Trotter number — an additional problem with bosons is that their operator commutation relations cannot be satisfied exactly. Unlike the former, the latter circumstance poses a serious problem even for variational methods, for it causes WF leakage out of qubit subspace representing physical states.&lt;/p&gt;&#xA;&lt;p&gt;Consider a Fock state with just two bosonic modes &lt;span class=&quot;math-container&quot;&gt;$|1;0\rangle$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$N=1,2$&lt;/span&gt; it is mapped onto qubits in the following ways:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|l|l|l|l|l|}&#xA;\hline&#xA; &amp;amp; N=1 &amp;amp; N=1 &amp;amp; N=2 &amp;amp; N=2 \\&#xA;\hline&#xA; &amp;amp; \text{Binary} &amp;amp; \text{Unary} &amp;amp; \text{Binary} &amp;amp; \text{Unary} \\&#xA;\hline&#xA;|0;1\rangle &amp;amp; |01\rangle &amp;amp; |0110\rangle &amp;amp; |0010\rangle &amp;amp; |001010\rangle \\&#xA;\hline&#xA;|1;0\rangle &amp;amp; |10\rangle &amp;amp; |1001\rangle &amp;amp; |0010\rangle &amp;amp; |010001\rangle \\&#xA;\hline&#xA;\end{array}&#xA;$$&lt;/span&gt;&#xA;For the unary mapping, I'm using the convention from (23) &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0304063&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let us start from a qubit version of the state &lt;span class=&quot;math-container&quot;&gt;$|0;1\rangle$&lt;/span&gt;, and try to create its superpostion with &lt;span class=&quot;math-container&quot;&gt;$|1;0\rangle$&lt;/span&gt;. We could do it using &lt;span class=&quot;math-container&quot;&gt;$U_1=\exp(i(a_1^\dagger a_2 + a_2^\dagger a_1))$&lt;/span&gt; (aka time evolution) or using &lt;span class=&quot;math-container&quot;&gt;$U_2=\exp(a_1^\dagger a_2 - a_2^\dagger a_1)$&lt;/span&gt; (aka UCC). For our purposes, it does not really matter. For definiteness, let us choose &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; (this would keep amplitudes real if not Qiskit...). For &lt;span class=&quot;math-container&quot;&gt;$N=1$&lt;/span&gt; both encodings give identical results:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2 |01\rangle = 0.54 |01\rangle&#xA; -0.84 |10\rangle&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2 |0110\rangle = 0.54 |0110\rangle&#xA; -0.84 |1001\rangle&#xA;$$&lt;/span&gt;&#xA;But take a look at what happens as we move to &lt;span class=&quot;math-container&quot;&gt;$N=2$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2 |0010\rangle = (0.01942407020071564-0.01942407020071514j) |0000\rangle &#xA; + (0.3018468699435287-0.30184686994353027j) |0010\rangle &#xA; + (-0.4175689014626733+0.4175689014626758j) |0101\rangle &#xA; + (-0.3664436305642885+0.36644363056428975j) |0111\rangle &#xA; + (-0.24189290092458382+0.2418929009245852j) |1000\rangle &#xA; + (-0.017433459057134393+0.017433459057134143j) |1010\rangle &#xA; + (0.026209883033085912-0.026209883033085773j) |1101\rangle &#xA; + (0.20090642541053194-0.2009064254105325j) |1111\rangle &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_2 |001010\rangle = (-0.399515044839777-0.39951504483977407j) |001010\rangle &#xA; + (-0.5803699021310753-0.5803699021310711j) |010001\rangle &#xA; + (-0.02732498912217729-0.027324989122177044j) |010100\rangle &#xA; + (0.0015213913160944605+0.0015213913160944115j) |100010\rangle &#xA; + (0.05259767375695154+0.05259767375695122j) |111001\rangle &#xA; + (-0.006559016720416016-0.00655901672041582j) |111100\rangle &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;See the difference? For the unary mapping, the dominant amplitudes are those from the table, corresponding to physical states. But for the binary mapping we are in a real trouble (same happens for the Gray code).&lt;/p&gt;&#xA;&lt;p&gt;BTW, an interesting difference between binary/gray and unary mappings is the following: in the former case, all the qubit states represent some physical states, while in the latter case this is not true. This, however, by itself does not imply that one would benefit from using binary/gray encoding.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;QUESTION&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;What are the known approaches to dealing with this problem? While for the unary mapping, we could probably tolerate the error, it seems that in the case of binary/Gray encodings the situation is pretty sad.&lt;/p&gt;&#xA;&lt;p&gt;One obvious suggestion would be to somehow project the outcome of trotterization onto the &amp;quot;physical&amp;quot; subspace using ancillas but I don't how practical this can be.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the situation with time evolution and VQE is quite different. For simulating time evolution, given enough gates, we could probably choose the time step to be small enough to make errors (arising due to the wave function leakage out of the physical subspace) arbitrary small. However, for VQE we want short circuits (of order of a single time evolution step), which implies having large parameters. Therefore, &lt;strong&gt;ONE CANNOT EFFICIENTLY SIMULATE BOSONS USING VQE AND UNITARY COUPLED CLUSTER&lt;/strong&gt;, where by &amp;quot;efficiently&amp;quot; I mean &amp;quot;in a way that may potentially lead to quantum advantage&amp;quot;. Therefore... we have to rely on &lt;a href=&quot;https://arxiv.org/abs/2012.07171&quot; rel=&quot;nofollow noreferrer&quot;&gt;sparse VQE&lt;/a&gt;!&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2021-02-28T02:57:52.380" LastActivityDate="2021-02-28T02:57:52.380" Title="Trotter error for bosons in various encodings" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;bosons&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16103" PostTypeId="2" ParentId="11477" CreationDate="2021-02-19T08:06:26.140" Score="1" Body="&lt;p&gt;For preparing an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state with real amplitudes, you can simply:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Take a circuit for preparing arbitrary states,&lt;/li&gt;&#xA;&lt;li&gt;Replace all single-qubits rotations with &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; rotations.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here is how I do it in Qiskit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def arbitrary_real_superposition_qiskit( amps: List[ float ], qc_arb = None ):&#xA;    _amps = np.array( amps )&#xA;    if not misc.is_power_of_two( _amps.shape[ 0 ] + 1 ):&#xA;        raise Exception( 'The number of parameters for arbitrary_real_superposition_qiskit() has to be 2^n-1.' )&#xA;&#xA;    nqubit = int( np.log2( _amps.shape[ 0 ] + 1 ) )&#xA;&#xA;    qc = qiskit.circuit.quantumcircuit.QuantumCircuit( nqubit )&#xA;&#xA;    if type( qc_arb ) != qiskit.circuit.quantumcircuit.QuantumCircuit:&#xA;        qc_arb = init_state_qiskit( [ random.random() for i in range( _amps.shape[ 0 ] ) ] )&#xA;&#xA;    i = 0&#xA;    for inst in qc_arb.data:&#xA;        if type( inst[ 0 ] ) == qiskit.circuit.library.standard_gates.u3.U3Gate \&#xA;                or type( inst[ 0 ] ) == qiskit.circuit.library.standard_gates.u2.U2Gate \&#xA;                or type( inst[ 0 ] ) == qiskit.circuit.library.standard_gates.u1.U1Gate:&#xA;            qc.ry( _amps[ i ], inst[ 1 ] )&#xA;            i = i + 1&#xA;        elif type( inst[ 0 ] ) == qiskit.circuit.library.standard_gates.x.CXGate:&#xA;            qc.cx( inst[ 1 ][ 0 ], inst[ 1 ][ 1 ] )&#xA;        else:&#xA;            raise Exception( 'A gate other than u1/u2/u3 and cx was encountered.' )&#xA;    return qc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def is_power_of_two( N ):&#xA;    &amp;quot;&amp;quot;&amp;quot;Returns True if n is a power of 2.&amp;quot;&amp;quot;&amp;quot;&#xA;    n = int(N)&#xA;    if n &amp;lt;= 0:&#xA;        return False&#xA;    else:&#xA;        return n &amp;amp; (n - 1) == 0 # How the hell is this even working??? :D&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def init_state_qiskit( amps: List[ complex ] ):&#xA; &#xA;    qubitn = int( np.log2( amps.shape[ 0 ] ) )&#xA;&#xA;    qc = qiskit.circuit.quantumcircuit.QuantumCircuit( qubitn )&#xA;    qc.isometry( amps, list( range( qubitn ) ), None )&#xA;    &#xA;    while True:&#xA;        qc = qc.decompose()&#xA;        if qc == qc.decompose():&#xA;            break&#xA;&#xA;    qc = qiskittranspile( qc, optimization_level = 3, basis_gates = [ 'u1', 'u2', 'u3', 'cx' ] )&#xA;&#xA;    return qc&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What happens here is that I initialize an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state from an arbitrary &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; vector (to make sure that all the &lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt; single-qubit rotations are present in the circuit), and replace those single-qubit rotations with &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;'s.&lt;/p&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2021-02-19T08:06:26.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16104" PostTypeId="1" CreationDate="2021-02-19T12:11:17.473" Score="0" ViewCount="39" Body="&lt;p&gt;I have seen this term appearing multiple times when discussing density matrices. For example here is an excerpt from the lecture notes:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We are now ready to introduce the idea of a reduced density matrix in&#xA;a more formal way. Given a bipartite system ρAB we define the reduced&#xA;density matrix of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$\rho_{A} = \mathrm{tr}_{B}(ρ_{AB})$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho_{B} = \mathrm{tr}_{A}(\rho_{AB})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This is from the lecture notes of Prof. Gabriel Teixeira Landi&#xA;IFUSP - Physics Institute, University of São Paulo&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-19T18:40:08.737" LastActivityDate="2021-02-19T18:40:08.737" Title="What does &quot;bipartite system&quot; mean?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;notation&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-02-19T18:56:45.740" ContentLicense="CC BY-SA 4.0" />
  <row Id="16105" PostTypeId="1" AcceptedAnswerId="16181" CreationDate="2021-02-19T14:27:50.663" Score="1" ViewCount="185" Body="&lt;p&gt;I saw answers such as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9983/no-schmidt-decomposition-for-tripartite-states&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;https://math.stackexchange.com/questions/2358043/counterexample-to-schmidt-decomposition-for-3-systems&quot;&gt;this&lt;/a&gt; which provide examples of tripartite system that don't take a Schmidt decomposition, but I wonder if there's an explicit condition that can tell whether a state is or is not Schmidt decomposable. Does anyone have an idea? I know a bipartite sytem always have one, so a tripartite's condition would be enough. If you can tell me about the multipartite system it'd be even better! Thank you!&lt;/p&gt;&#xA;&lt;p&gt;Edit: After reading the comment, I understand that tripartite system also always have Schmidt decomposition, but for each specific biparition with different Schmidt coefficients. I think my question is that what is the condition that the entire state can be written as i.e. &lt;span class=&quot;math-container&quot;&gt;$\alpha|000\rangle+\beta|111\rangle$&lt;/span&gt;? Is it neccesarily true that if those Schmidt coefficients of the 3 possible bipartitions are the same, then the general state will admit a Schmidt decomposition like that? Is there a proof?&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="8746" LastEditDate="2021-02-22T12:20:17.883" LastActivityDate="2021-02-23T08:21:53.287" Title="Condition that a tripartite/multipartite qubit state does/does not admit a Schmidt decomposition?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="9" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16106" PostTypeId="1" AcceptedAnswerId="16107" CreationDate="2021-02-19T16:40:23.437" Score="0" ViewCount="72" Body="&lt;p&gt;Equation \eqref{eq:sp1} represents the reduced state of the system after tracing over environment.(Page number 358)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho) = \mathrm{tr}_{env}(\lbrack U(\rho \otimes \rho_{env} )U^{\dagger}\rbrack). \tag{8.6} \label{eq:sp1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And then they say in page 359 that initially &lt;span class=&quot;math-container&quot;&gt;$\rho_{env} = |0\rangle\langle0|$&lt;/span&gt; and then we apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the combined state.(here &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is CNOT). The equation \eqref{eq:sp1} becomes (after plugging these values)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{E}(\rho) = P_{0}\rho P_{0} + P_{1}\rho P_{1} \tag{8.7} \label{eq:sp2}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P_{m}=|m\rangle\langle m|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How are they arriving at \eqref{eq:sp2}?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-19T18:25:04.007" LastActivityDate="2021-02-19T18:25:04.007" Title="Derivation of Equation $8.7$ in Nielsen Chuang" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-02-20T20:26:59.337" ContentLicense="CC BY-SA 4.0" />
  <row Id="16107" PostTypeId="2" ParentId="16106" CreationDate="2021-02-19T17:14:17.263" Score="3" Body="&lt;p&gt;Just plug in all of the relevant stuff you state in the question, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = |0\rangle \langle 0 | \otimes I + |1 \rangle \langle 1 | \otimes X&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{\mathrm{env}} = |0\rangle \langle 0 |.&#xA;$$&lt;/span&gt;&#xA;Then expand and simplify&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\mathcal{E}(\rho) &amp;amp;= \mathrm{Tr}_{\mathrm{env}}[(P_0 \otimes I + P_1 \otimes X)(\rho \otimes |0\rangle \langle 0 |) (P_0 \otimes I + P_1 \otimes X)] \\&#xA;&amp;amp;= \mathrm{Tr}_{\mathrm{env}}[(P_0 \otimes I + P_1 \otimes X)(\rho P_0 \otimes |0\rangle \langle 0| + \rho P_1 \otimes |1\rangle \langle 0|)] \\&#xA;&amp;amp;= \mathrm{Tr}_{\mathrm{env}}[(P_0\rho P_0 \otimes |0\rangle \langle 0| + P_0\rho P_1 \otimes |1\rangle \langle 0| + P_1\rho P_0 \otimes |1\rangle\langle 0| + P_1 \rho P_1 \otimes |1\rangle\langle1|] \\&#xA;&amp;amp;= P_0 \rho P_0 + P_1 \rho P_1. \end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-02-19T17:14:17.263" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16109" PostTypeId="2" ParentId="4981" CreationDate="2021-02-19T19:02:28.310" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\rmD}{\mathrm{D}}\newcommand{\rmU}{\mathrm{U}}\newcommand{\calU}{\mathcal{U}}\newcommand{\CC}{\mathbb{C}}\rho\in\rmD(\CC^n),\sigma\in\rmD(\CC^m)$&lt;/span&gt; be two arbitrary finite-dimensional quantum states, and let &lt;span class=&quot;math-container&quot;&gt;$\calU\in \rmU(\CC^n\otimes\CC^m)$&lt;/span&gt; be a unitary in the total space.&lt;/p&gt;&#xA;&lt;p&gt;We have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$[U(\rho\otimes\sigma)U^\dagger]_{ij,k\ell}&#xA;= \sum_{mnpq} U_{ij,mn} U^*_{k\ell,pq} \rho_{mp} \sigma_{nq}.\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\sigma=|0\rangle\!\langle0|$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;[U(\rho\otimes|0\rangle\!\langle0|)U^\dagger]_{ij,k\ell}&#xA;= \sum_{mp} U_{ij,m0} U^*_{k\ell,p0} \rho_{mp}.\tag2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Remember now the definition of partial trace. Let &lt;span class=&quot;math-container&quot;&gt;$X:\CC^n\otimes\CC^m\to\CC^{n'}\otimes\CC^{m}$&lt;/span&gt; be some linear operator. Its matrix elements can be written as &lt;span class=&quot;math-container&quot;&gt;$X_{ij,k\ell}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$i\in [n'], j\in[m], k\in[n], \ell\in[m]$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$n,n',m\in\mathbb N$&lt;/span&gt; positive integers, and &lt;span class=&quot;math-container&quot;&gt;$[n]\equiv\{1,...,n\}$&lt;/span&gt; etc. Its &lt;em&gt;partial trace&lt;/em&gt; with respect to the second space is the linear operator &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_2(X):\CC^n\to\CC^{n'}$&lt;/span&gt; with matrix elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[\mathrm{Tr}_2(X)]_{ik} = \sum_j X_{ij,kj}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, the partial trace of (2) wrt the second space reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Big[\mathrm{Tr}_2[U(\rho\otimes|0\rangle\!\langle0|)U^\dagger]\Big]_{ik}&#xA;= \sum_{jmp} U_{ij,m0} U^*_{kj,p0} \rho_{mp}.&#xA;$$&lt;/span&gt;&#xA;Define the operators &lt;span class=&quot;math-container&quot;&gt;$A_j:\CC^n\to\CC^{n'}$&lt;/span&gt; via their matrix elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$(A_j)_{im} = U_{ij,m0}$&lt;/span&gt;.&#xA;With these, we can rewrite the above equation as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{Tr}_2[U(\rho\otimes|0\rangle\!\langle0|)U^\dagger]&#xA;= \sum_j A_j \rho A_j^\dagger.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It's worth noting that &lt;span class=&quot;math-container&quot;&gt;$A_j$&lt;/span&gt; can be understood as sub-blocks of the matrix &lt;span class=&quot;math-container&quot;&gt;$\mathcal U$&lt;/span&gt; corresponding to the columns specified by &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. See also my answer &lt;a href=&quot;https://physics.stackexchange.com/a/408976/58382&quot;&gt;here&lt;/a&gt; about this.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-19T19:02:28.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16110" PostTypeId="2" ParentId="16098" CreationDate="2021-02-20T00:21:42.673" Score="0" Body="&lt;p&gt;You can try,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator&#xA;from qiskit.extensions import HamiltonianGate&#xA;&#xA;# create tensor of single-qubit operators. Recognized labels are&#xA;# I, X, Y, Z, H, S, T, 0, 1, +, -, r, l&#xA;op = Operator.from_label('ZZZ')&#xA;&#xA;# create gate which evolves according to exp(-i*op*0.02)&#xA;gate = HamiltonianGate(op, 0.02)&#xA;circuit = QuantumCircuit(3)&#xA;&#xA;# apply gate to qubits [0, 1, 2] in circuit&#xA;circuit.append(gate, [0, 1, 2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="8169" LastEditorUserId="8169" LastEditDate="2021-02-25T16:41:21.860" LastActivityDate="2021-02-25T16:41:21.860" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16111" PostTypeId="1" CreationDate="2021-02-20T07:23:57.370" Score="3" ViewCount="71" Body="&lt;p&gt;This is a follow-up question on composing the quantum circuits. Say if I have the following circuit element:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def qc1(a):                      &#xA;    quanc1 = QuantumCircuit(2)&#xA;    quanc1.x(0)&#xA;    quanc1.h(1)&#xA;    quanc1.crz(a,1,0)&#xA;    quanc1.barrier()&#xA;    return quanc1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and &lt;code&gt;circ&lt;/code&gt; is a list that contains multiple elements:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = []&#xA;for i in range (3):&#xA;    circ.append(qc1(np.pi+i))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then using the &lt;code&gt;reduce&lt;/code&gt; function, I could combine those 3 circuits and compose them into a larger quantum circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from functools import reduce&#xA;qc = QuantumCircuit(5,5)&#xA;qc = reduce(lambda x,y: x.compose(y,[2,4]),circ, qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The code works to compose the circuits in &lt;code&gt;circ&lt;/code&gt; onto qubit 2 and 4 of &lt;code&gt;qc&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/66NOI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/66NOI.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, if I have another set of coordinates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;c = [[2,1],[2,4],[2,3]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is it possible for me to compose the circuits in &lt;code&gt;circ&lt;/code&gt; onto those pairs of coordinates, separately (instead of the fixed pair &lt;code&gt;[2,4]&lt;/code&gt;)? Or is there a simpler method than using &lt;code&gt;reduce&lt;/code&gt;? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-02-21T16:24:42.910" LastActivityDate="2021-03-23T19:07:00.117" Title="How can I compose a list of quantum circuits onto different qubits in one command?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16112" PostTypeId="1" AcceptedAnswerId="16116" CreationDate="2021-02-20T15:27:52.117" Score="2" ViewCount="77" Body="&lt;p&gt;In section &lt;span class=&quot;math-container&quot;&gt;$5.2$&lt;/span&gt; of the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/qaoa.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QAOA chapter in Qiskit textbook&lt;/a&gt;, section &lt;span class=&quot;math-container&quot;&gt;$5.2$&lt;/span&gt;,&#xA;state preparation uses the gate &lt;span class=&quot;math-container&quot;&gt;$U_{k,l}(\gamma) = e^{\frac{i \gamma}{2} (1-Z_k Z_l)}$&lt;/span&gt;. Later, in section &lt;span class=&quot;math-container&quot;&gt;$5.3$&lt;/span&gt;, this gate is given in terms of basic gates as &lt;span class=&quot;math-container&quot;&gt;$U_{k,l}(\gamma)=C_{u1}(−2 \gamma)_{k,l}u_1(\gamma)_k u_1(\gamma)_l$&lt;/span&gt;. Why is this the correct implementation?&lt;/p&gt;&#xA;" OwnerUserId="14896" LastEditorUserId="10480" LastEditDate="2021-03-14T08:01:46.460" LastActivityDate="2021-03-14T08:01:46.460" Title="IBM Qiskit QAOA gate implementation question" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;gate-synthesis&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16113" PostTypeId="1" AcceptedAnswerId="16122" CreationDate="2021-02-20T16:16:53.787" Score="4" ViewCount="107" Body="&lt;p&gt;Given a general QUBO matrix &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; for a quadratic minimization problem, is there a Qiskit way to obtain the Pauli gate list or the Ising model for it? A related question is &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16069/qiskit-taking-a-qubo-matrix-into-qubit-op&quot;&gt;Qiskit: Taking a QUBO matrix into `qubit_op&amp;#39;&lt;/a&gt;, but it seems to be about a graph related model. The solution given there is also for a particular graph metric for the &lt;code&gt;stable_set&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14896" LastEditorUserId="9006" LastEditDate="2021-02-21T06:55:56.197" LastActivityDate="2021-02-21T06:55:56.197" Title="From QUBO matrix to Ising model in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16114" PostTypeId="2" ParentId="16113" CreationDate="2021-02-20T17:19:41.753" Score="2" Body="&lt;p&gt;Given a matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, you can decompose to &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; into Pauli operators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \sum_{i}  h_{i}H_i = \sum_{i_1,i_2,\cdots, i_n} a_{i_1,i_2,\cdots, i_n}(\sigma_{i_1} \otimes \sigma_{i_2} \otimes \cdots \otimes \sigma_{i_n})  $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_{i_j}\in {I,X,Y,Z}$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$a_{i_1,i_2,\cdots, i_n} = \dfrac{1}{2^n} Tr( (\sigma_{i_1} \otimes \sigma_{i_2} \otimes \cdots \otimes \sigma_{i_n}) \cdot H) = \dfrac{1}{2^n} Tr( H_i \cdot H)    $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't know whether qiskit has a converter that takes an arbitrary matrix to this Pauli strings decomposition or not. However, &lt;a href=&quot;https://pennylane.readthedocs.io/en/stable/code/api/pennylane.utils.decompose_hamiltonian.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pennylane does&lt;/a&gt; and it is pretty to use. You can import in pennylane to do this task and extract the output to do what you need in qiskit. Or maybe you will just end up write your own function to do it.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-20T17:19:41.753" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16115" PostTypeId="1" AcceptedAnswerId="16120" CreationDate="2021-02-20T17:58:59.080" Score="1" ViewCount="52" Body="&lt;p&gt;I have been trying to solve this puzzle of constructing this transformation from CNOT and Toffoli gates as mentioned in NC page 193 (Ex 4.27)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8CCUM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8CCUM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is what I have done:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First observation is it has 8 rows and columns, so it is showing the table for 3 qubits.&lt;/li&gt;&#xA;&lt;li&gt;Whenever it is not &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; it always add 1. &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|010\rangle$&lt;/span&gt; etc.&lt;/li&gt;&#xA;&lt;li&gt;I ignored the complicated part just tried to implement the easy always add 1 part.&lt;/li&gt;&#xA;&lt;li&gt;One observation for &lt;span class=&quot;math-container&quot;&gt;$|001\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; is the LSB qubit is always flipped.&lt;/li&gt;&#xA;&lt;li&gt;At this point I realized I would keep one line for &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and it would help me always flip a state. (let's call it qubit 4)&lt;/li&gt;&#xA;&lt;li&gt;Then I realize when would qubit 2 and qubit 1 change. Qubit 2 changes when qubit 3 and 4 both are 1. Qubit 1 change when qubit 2,3,4 are 1.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/g02DS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/g02DS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;7&quot;&gt;&#xA;&lt;li&gt;Then I ran the rest of the two cases and checked what output they generated and brute forced to correct it using Toffoli gates.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mPk1i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mPk1i.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to verify if this is how the puzzle is intended to be solved or did I miss something?&lt;/p&gt;&#xA;&lt;p&gt;(Also CCCNOT gate is a feasible gate right? or am I making things up?)&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-21T08:03:40.617" Title="Partial Cyclic Permuation with only Toffoli and CNOT gates?" Tags="&lt;circuit-construction&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16116" PostTypeId="2" ParentId="16112" CreationDate="2021-02-20T18:20:48.337" Score="0" Body="&lt;p&gt;Qiskit gates &lt;span class=&quot;math-container&quot;&gt;$u_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C_{u1}$&lt;/span&gt; are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;u_1(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\theta}&#xA;\end{pmatrix} \,\,\,&#xA;C_{u1}(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\theta}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;see &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U1Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CU1Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Exponential of a normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the matrix &lt;span class=&quot;math-container&quot;&gt;$e^A$&lt;/span&gt; with the same eigenbasis as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and eigenvalues that are exponentials of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Therefore, &lt;span class=&quot;math-container&quot;&gt;$u_1(\theta) = e^{\frac{i\theta}{2}(I-Z)}$&lt;/span&gt;. Also, note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I - Z_1 - Z_2 + Z_1Z_2 = \begin{pmatrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 4&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so &lt;span class=&quot;math-container&quot;&gt;$C_{u1}(\theta) = e^{\frac{i\theta}{4}(I - Z_1 - Z_2 + Z_1Z_2)}$&lt;/span&gt;. Finally, diagonal matrices commute, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{k,l}(\gamma) = e^{\frac{i \gamma}{2}(I-Z_k Z_l)}&#xA;= e^{-\frac{i\gamma}{2}(I-Z_k-Z_l+Z_k Z_l)}e^{\frac{i\gamma}{2}(I-Z_k)}e^{\frac{i\gamma}{2}(I-Z_l)} = C_{u1}(-2\gamma)_{k,l} u_1(\gamma)_k u_1(\gamma)_l.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-20T18:20:48.337" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16117" PostTypeId="1" AcceptedAnswerId="16118" CreationDate="2021-02-20T19:25:08.977" Score="1" ViewCount="61" Body="&lt;p&gt;I was reading this &lt;strong&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8945/density-matrix-of-a-product-of-bell-states/8946#8946&quot;&gt;question&lt;/a&gt;&lt;/strong&gt; from this site answered by DaftWullie. I would like to request you to read the question there. The answer says&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;However, in this particular case, the calculation is much simply. Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; be the Bell pair such that &lt;span class=&quot;math-container&quot;&gt;$$&#xA; |\psi\rangle=|\phi_{12}\rangle|\phi_{34}\rangle. $$&lt;/span&gt; Because there's a&#xA;separable partition between (1,2) and (3,4), this is not changed by&#xA;the partial trace. Thus &lt;span class=&quot;math-container&quot;&gt;$$&#xA; \text{Tr}_B|\psi\rangle\langle\psi|=\left(\text{Tr}_2|\phi\rangle\langle\phi|\right)\otimes&#xA;\left(\text{Tr}_3|\phi\rangle\langle\phi|\right). $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't understand where this expression comes from. There shouldn't be any &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; in there, right? Can anybody derive it step by step?&lt;/p&gt;&#xA;&lt;p&gt;Because trace is applied over &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\langle\psi|$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\phi_{12}\rangle|\phi_{34}\rangle\langle\phi_{34}|\langle\phi_{12}|$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$(|\phi_{12}\rangle \otimes |\phi_{34}\rangle)( \langle\phi_{34}|\otimes \langle\phi_{12}|)$&lt;/span&gt;. This is matrix multiplication of &lt;span class=&quot;math-container&quot;&gt;$(|\phi_{12}\rangle \otimes |\phi_{34}\rangle)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$( \langle\phi_{34}|\otimes \langle\phi_{12}|)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="10480" LastEditDate="2021-02-20T22:35:27.747" LastActivityDate="2021-02-20T22:35:27.747" Title="Does $\mathrm{tr}(A \otimes B) = \mathrm{tr} (A) \otimes \mathrm{tr}(B)$ hold for partial trace?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;tensor-product&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16118" PostTypeId="2" ParentId="16117" CreationDate="2021-02-20T22:29:27.877" Score="2" Body="&lt;p&gt;DaftWullie's answer is correct. The key identity they are using is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_B(\rho_A\otimes\sigma_{BC}) = \rho_A \otimes (\mathrm{tr}_B\sigma_{BC})\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which says that we can pull out tensor factors that do not act on the system being traced over. Using &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and the symbols defined in the linked question and answer, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\mathrm{tr}_B |\psi\rangle\langle\psi| &amp;amp;= \mathrm{tr}_2 \mathrm{tr}_3 |\psi\rangle\langle\psi| \\&#xA;&amp;amp;= \mathrm{tr}_2 \mathrm{tr}_3\left(|\phi_{12}\rangle\langle\phi_{12}| \otimes |\phi_{34}\rangle\langle\phi_{34}|\right) \\&#xA;&amp;amp;= \mathrm{tr}_2 \left(|\phi_{12}\rangle\langle\phi_{12}| \otimes \mathrm{tr}_3|\phi_{34}\rangle\langle\phi_{34}|\right) \\&#xA;&amp;amp;= (\mathrm{tr}_2 |\phi_{12}\rangle\langle\phi_{12}|) \otimes (\mathrm{tr}_3|\phi_{34}\rangle\langle\phi_{34}|)&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where in the first equality we use &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B = \mathrm{tr}_2 \circ \mathrm{tr}_3$&lt;/span&gt; since Bob has qubits &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt;, in the second equality we use the definition &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |\phi_{12}\rangle|\phi_{34}\rangle$&lt;/span&gt;, in the third we use &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$A=12$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B=3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C=4$&lt;/span&gt; and in the fourth we use &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; once again with &lt;span class=&quot;math-container&quot;&gt;$A=4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B=2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark on operator domains&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_2 |\phi_{12}\rangle\langle\phi_{12}|$&lt;/span&gt; is an operator acting on the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; of subsystem &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_3|\phi_{34}\rangle\langle\phi_{34}|$&lt;/span&gt; is an operator acting on the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_4$&lt;/span&gt; of subsystem &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;. Moreover, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B |\psi\rangle\langle\psi|$&lt;/span&gt; is supposed to be an operator acting on the Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1 \otimes \mathcal{H}_4$&lt;/span&gt; of the two qubits owned by Alice. This confirms that there should be &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt; between the factors in the formula from DaftWullie's answer.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Recall that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B\rho = \sum_i\langle i_B|\rho|i_B\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|i_B\rangle$&lt;/span&gt; is an orthonormal basis of the Hilbert space of the subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\mathrm{tr}_B(\rho_A\otimes\sigma_{BC}) &amp;amp;= \sum_i \langle i_B|\rho_A\otimes\sigma_{BC}|i_B\rangle \\&#xA;&amp;amp;= \sum_i \rho_A\otimes \langle i_B|\sigma_{BC}|i_B\rangle \\&#xA;&amp;amp;= \rho_A\otimes \sum_i \langle i_B|\sigma_{BC}|i_B\rangle \\&#xA;&amp;amp;= \rho_A \otimes (\mathrm{tr}_B\sigma_{BC}).&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-20T22:29:27.877" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16119" PostTypeId="1" CreationDate="2021-02-21T04:39:16.577" Score="2" ViewCount="44" Body="&lt;p&gt;I was curious about the implementation of &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/library/standard_gates/p.py#L216&quot; rel=&quot;nofollow noreferrer&quot;&gt;MCPhase&lt;/a&gt;/&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/library/standard_gates/u1.py#L233&quot; rel=&quot;nofollow noreferrer&quot;&gt;MCU1Gate&lt;/a&gt; and how it works without ancilla qubits. I ended up checking the code of the some auxiliary (?) function &lt;code&gt;_gray_code_chain()&lt;/code&gt; but I couldn't understand much of it.&lt;/p&gt;&#xA;&lt;p&gt;update: it seems that MCU1Gate is deprecated and MCPhase will substitute it - the code is the same anyway.&lt;/p&gt;&#xA;" OwnerUserId="14037" LastEditorUserId="14037" LastEditDate="2021-02-21T13:03:00.557" LastActivityDate="2021-02-24T09:45:13.343" Title="How does MCPhaseGate/MCU1Gate works internally in qiskit?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16120" PostTypeId="2" ParentId="16115" CreationDate="2021-02-21T05:09:31.277" Score="1" Body="&lt;p&gt;Looking at the book, I'm not sure whether the exercise allows to allocate extra qubits in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state to enable implementing the X gate using the CNOT gate (if the allocated qubits start in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, you'd need an X gate to flip them to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to use them as controls, which seems a chicken-and-egg problem). If not, the last gate in the circuit can be problematic, since it's controlled on zero state of the qubits, and requires X gates to implement it from the Toffoli gate.&lt;/p&gt;&#xA;&lt;p&gt;If X gates are fair game (on their own or using an extra &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; qubit), this would work.&lt;/p&gt;&#xA;&lt;p&gt;Here's a trick I used to validate this (applying the gates to 8 basis states separately by hand seems like a lot of work and can be error-prone): implement the circuit in Q# and use &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.diagnostics.dumpoperation&quot; rel=&quot;nofollow noreferrer&quot;&gt;DumpOperation&lt;/a&gt; to print its matrix.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;open Microsoft.Quantum.Arrays;&#xA;open Microsoft.Quantum.Diagnostics;&#xA;&#xA;operation PartialPermutation (qs : Qubit[]) : Unit is Adj+Ctl {&#xA;    // reverse the order of qubits to get matrix with big endian indices&#xA;    let qsBE = Reversed(qs);&#xA;    Controlled X(qsBE[1 .. 2], qsBE[0]);&#xA;    Controlled X([qsBE[2]], qsBE[1]);&#xA;    X(qsBE[2]);&#xA;    ControlledOnInt(0, X)(qsBE[0 .. 1], qsBE[2]);&#xA;}&#xA;&#xA;operation RunDumpOperation () : Unit {&#xA;    DumpOperation(3, PartialPermutation);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tSFk3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tSFk3.png&quot; alt=&quot;Permutation matrix screenshot&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Update: the circuit implemented by the operation (without qubit order reversal, so that it looks more like the circuit in the question):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F8nEH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F8nEH.png&quot; alt=&quot;Circuit implemented by the Q# code&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2879" LastEditorUserId="2879" LastEditDate="2021-02-21T08:03:40.617" LastActivityDate="2021-02-21T08:03:40.617" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16121" PostTypeId="2" ParentId="16111" CreationDate="2021-02-21T05:22:14.170" Score="3" Body="&lt;p&gt;We could use the &lt;code&gt;zip&lt;/code&gt; function twice:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;A = [...]&#xA;B = [...]&#xA;qc = reduce(lambda x,y: x.compose(y[0],[y[1][0],y[1][1]]),zip(circ,zip(A,B)), qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where A and B are two lists that contain the information about which qubits we want to compose:)&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jLLdc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jLLdc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-03-23T19:07:00.117" LastActivityDate="2021-03-23T19:07:00.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16122" PostTypeId="2" ParentId="16113" CreationDate="2021-02-21T06:54:37.293" Score="1" Body="&lt;p&gt;I prepared this code based on Qiskit tutorial. Firstly, lets prepare a QUBO task.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Importing standard Qiskit libraries and configuring account&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;#quadratic optimization&#xA;from qiskit.optimization import QuadraticProgram&#xA;from qiskit.optimization.converters import QuadraticProgramToQubo&#xA;&#xA;# Prepare QUBO task&#xA;&#xA;#prepare quadratic binary optimization task&#xA;task = QuadraticProgram(name = 'QUBO on QC')&#xA;task.binary_var(name = 'x')&#xA;task.binary_var(name = 'y')&#xA;task.binary_var(name = 'z')&#xA;task.minimize(linear = [1,-2,3], quadratic = [[0,0.5,-0.5],[0.5,0,1],[-0.5,1,0]])&#xA;qubo = QuadraticProgramToQubo().convert(task) #convert to QUBO&#xA;print(qubo.export_as_lp_string())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, we have a QUBO task and you can convert it to Ising Hamiltonian with this code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#converting QUBO task to Ising Hamiltonian for simulation on quantum computer&#xA;operator, offset = qubo.to_ising()&#xA;&#xA;#operator - unitary operator representing the simulated Hamiltonian&#xA;#offset - used after solution on QC to convert objective function value to the proper one&#xA;&#xA;print(operator)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This code converts Ising Hamiltonian to QUBO:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#conversion of Ising Hamiltonian to QUBO&#xA;qp = QuadraticProgram()&#xA;qp.from_ising(operator, offset, linear = True) #linear=True =&amp;gt; x^2 is shown as x since x^2=x for x in {0,1}&#xA;print(qp.export_as_lp_string())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-21T06:54:37.293" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16123" PostTypeId="1" AcceptedAnswerId="16152" CreationDate="2021-02-21T08:04:26.020" Score="0" ViewCount="54" Body="&lt;p&gt;I had a confusion about shallow depth Haar random quantum circuits. In &lt;a href=&quot;https://arxiv.org/abs/2011.12277&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper, in Section B (related works), it is mentioned that Haar random quantum circuits form approximate &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-designs only after &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\left(n^{1/D}\right)$&lt;/span&gt; depth, where &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is the spatial dimension (proved &lt;a href=&quot;https://arxiv.org/abs/1809.06957&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;What does this mean for the output distribution of Haar random quantum circuits that have constant and logarithmic depth? For every fixed string &lt;span class=&quot;math-container&quot;&gt;$z \in \{0, 1\}^{n}$&lt;/span&gt;, does every output probability &lt;span class=&quot;math-container&quot;&gt;$|\langle z| U |0^{n} \rangle|^{2}$&lt;/span&gt; approximately follow a Porter-Thomas distribution, even for a shallow depth Haar-random &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;If so, what extra mileage does the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-design property give us?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2021-02-22T08:04:27.347" LastActivityDate="2021-02-22T09:17:50.533" Title="Quantum supremacy: shallow depth Haar random circuits and unitary designs" Tags="&lt;quantum-state&gt;&lt;quantum-advantage&gt;&lt;random-quantum-circuit&gt;&lt;probability&gt;&lt;haar-distribution&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16125" PostTypeId="2" ParentId="16119" CreationDate="2021-02-21T09:54:49.100" Score="1" Body="&lt;p&gt;The function &lt;code&gt;_gray_code_chain&lt;/code&gt; is a reference to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gray_code&quot; rel=&quot;nofollow noreferrer&quot;&gt;bit-string ordering algorithm&lt;/a&gt;. The application of the algorithm in multi-controlled-gate decomposition is explained in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0404089v3&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Circuits for General Multiqubit Gates&lt;/em&gt;,&#xA;Mottonen, et. al&lt;/a&gt; and in &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum Computation and Quantum Information&lt;/em&gt;, Nielsen &amp;amp; Chuang&lt;/a&gt;, section 4.5.2 p191.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-02-24T09:45:13.343" LastActivityDate="2021-02-24T09:45:13.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16126" PostTypeId="1" AcceptedAnswerId="16127" CreationDate="2021-02-21T11:22:10.067" Score="0" ViewCount="24" Body="&lt;p&gt;(All of these coming from the topic of simulation of quantum systems) A density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; Which describe state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits will have &lt;span class=&quot;math-container&quot;&gt;$2^{n} \times 2^{n}$&lt;/span&gt; size. We have couple of conditions like&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho) = 1$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is positive.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Then in this case we only need to specify &lt;span class=&quot;math-container&quot;&gt;$\dfrac{2^{n}(2^{n}-1)}{2} $&lt;/span&gt; for off-diagonal elements and for the diagonal ones we need &lt;span class=&quot;math-container&quot;&gt;$2^{n}-1$&lt;/span&gt; Terms. So total terms required &lt;span class=&quot;math-container&quot;&gt;$\dfrac{2^{n}(2^{n}-1)}{2} +  2^{n}-1 $&lt;/span&gt;. Now each of these terms can be complex numbers. And for defining a complex number we need one real number (assuming &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta}$&lt;/span&gt; form and defining theta to a good enough approximation).&lt;/p&gt;&#xA;&lt;p&gt;Total number of independent real numbers - &lt;span class=&quot;math-container&quot;&gt;$\dfrac{2^{n}(2^{n}-1)}{2} +  2^{n}-1 = 4^{n}+\dfrac{2^{n}}{2}-1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But in Nielsen Chuang it was asked to proof&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Exercise 4.46: (Exponential complexity growth of quantum systems) Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a density matrix describing the state of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Show that&#xA;describing &lt;span class=&quot;math-container&quot;&gt;$ρ$&lt;/span&gt; requires &lt;span class=&quot;math-container&quot;&gt;$4^{n} − 1$&lt;/span&gt; independent real numbers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Who is correct here?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-21T11:44:29.630" Title="How many real numbers are required to describe density matrix for $n$ qubits?" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;space-complexity&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16127" PostTypeId="2" ParentId="16126" CreationDate="2021-02-21T11:44:29.630" Score="2" Body="&lt;p&gt;NC is correct. You are making two mistakes here,&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The diagonal terms of a density matrix are always real (it is a hermitian operator).&lt;/li&gt;&#xA;&lt;li&gt;You need two real numbers to specify a complex number. In polar form it is &lt;span class=&quot;math-container&quot;&gt;$r e^{i \theta}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$r&amp;gt; 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta \in (-\pi,\pi]$&lt;/span&gt;. Or in Cartesian form &lt;span class=&quot;math-container&quot;&gt;$x + i y$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x,y\in \mathbb{R}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;After taking into account these two points you should get &lt;span class=&quot;math-container&quot;&gt;$4^n - 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-02-21T11:44:29.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16128" PostTypeId="1" AcceptedAnswerId="16132" CreationDate="2021-02-21T12:24:20.643" Score="-2" ViewCount="41" Body="&lt;p&gt;I alredy save an account but when I want to laod it I get a error like this&#xA;how can I fix it ?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;HTTPError                                 Traceback (most recent call last)&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\api\session.py in request(self, method, url, bare, **kwargs)&#xA;    273             response = super().request(method, final_url, headers=headers, **kwargs)&#xA;--&amp;gt; 274             response.raise_for_status()&#xA;    275         except RequestException as ex:&#xA;&#xA;~\anaconda3\lib\site-packages\requests\models.py in raise_for_status(self)&#xA;    940         if http_error_msg:&#xA;--&amp;gt; 941             raise HTTPError(http_error_msg, response=self)&#xA;    942 &#xA;&#xA;HTTPError: 403 Client Error: Forbidden for url: https://auth.quantum-computing.ibm.com/api/version&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;RequestsApiError                          Traceback (most recent call last)&#xA;&amp;lt;ipython-input-61-beb09c0bf764&amp;gt; in &amp;lt;module&amp;gt;&#xA;----&amp;gt; 1 IBMQ.load_account()&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqfactory.py in load_account(self)&#xA;    182         # Explicitly check via a server call, to allow environment auth URLs&#xA;    183         # contain IBM Quantum Experience v2 URL (but not auth) slipping through.&#xA;--&amp;gt; 184         version_info = self._check_api_version(credentials)&#xA;    185 &#xA;    186         # Check the URL is a valid authentication URL.&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqfactory.py in _check_api_version(credentials)&#xA;    453         version_finder = VersionClient(credentials.base_url,&#xA;    454                                        **credentials.connection_parameters())&#xA;--&amp;gt; 455         return version_finder.version()&#xA;    456 &#xA;    457     def _initialize_providers(self, credentials: Credentials) -&amp;gt; None:&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\api\clients\version.py in version(self)&#xA;     49                 * ``api-*`` (str): The versions of each individual API component&#xA;     50         &amp;quot;&amp;quot;&amp;quot;&#xA;---&amp;gt; 51         return self.client_version_finder.version()&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\api\rest\root.py in version(self)&#xA;    102         &amp;quot;&amp;quot;&amp;quot;&#xA;    103         url = self.get_url('version')&#xA;--&amp;gt; 104         response = self.session.get(url)&#xA;    105 &#xA;    106         try:&#xA;&#xA;~\anaconda3\lib\site-packages\requests\sessions.py in get(self, url, **kwargs)&#xA;    541 &#xA;    542         kwargs.setdefault('allow_redirects', True)&#xA;--&amp;gt; 543         return self.request('GET', url, **kwargs)&#xA;    544 &#xA;    545     def options(self, url, **kwargs):&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\providers\ibmq\api\session.py in request(self, method, url, bare, **kwargs)&#xA;    294                 self._modify_chained_exception_messages(ex)&#xA;    295 &#xA;--&amp;gt; 296             raise RequestsApiError(message, status_code) from ex&#xA;    297 &#xA;    298         return response&#xA;&#xA;RequestsApiError: '403 Client Error: Forbidden for url: https://auth.quantum-computing.ibm.com/api/version. &amp;lt;!DOCTYPE html&amp;gt;\n&amp;lt;!--[if lt IE 7]&amp;gt; &amp;lt;html class=&amp;quot;no-js ie6 oldie&amp;quot; lang=&amp;quot;en-US&amp;quot;&amp;gt; &amp;lt;![endif]--&amp;gt;\n&amp;lt;!--[if IE 7]&amp;gt;    &amp;lt;html class=&amp;quot;no-js ie7 oldie&amp;quot; lang=&amp;quot;en-US&amp;quot;&amp;gt; &amp;lt;![endif]--&amp;gt;\n&amp;lt;!--[if IE 8]&amp;gt;    &amp;lt;html class=&amp;quot;no-js ie8 oldie&amp;quot; lang=&amp;quot;en-US&amp;quot;&amp;gt; &amp;lt;![endif]--&amp;gt;\n&amp;lt;!--[if gt IE 8]&amp;gt;&amp;lt;!--&amp;gt; &amp;lt;html class=&amp;quot;no-js&amp;quot; lang=&amp;quot;en-US&amp;quot;&amp;gt; &amp;lt;!--&amp;lt;![endif]--&amp;gt;\n&amp;lt;head&amp;gt;\n&amp;lt;title&amp;gt;Access denied | auth.quantum-computing.ibm.com used Cloudflare to restrict access&amp;lt;/title&amp;gt;\n&amp;lt;meta charset=&amp;quot;UTF-8&amp;quot; /&amp;gt;\n&amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=UTF-8&amp;quot; /&amp;gt;\n&amp;lt;meta http-equiv=&amp;quot;X-UA-Compatible&amp;quot; content=&amp;quot;IE=Edge,chrome=1&amp;quot; /&amp;gt;\n&amp;lt;meta name=&amp;quot;robots&amp;quot; content=&amp;quot;noindex, nofollow&amp;quot; /&amp;gt;\n&amp;lt;meta name=&amp;quot;viewport&amp;quot; content=&amp;quot;width=device-width,initial-scale=1&amp;quot; /&amp;gt;\n&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; id=&amp;quot;cf_styles-css&amp;quot; href=&amp;quot;/cdn-cgi/styles/main.css&amp;quot; type=&amp;quot;text/css&amp;quot; media=&amp;quot;screen,projection&amp;quot; /&amp;gt;\n\n\n&amp;lt;/head&amp;gt;\n&amp;lt;body&amp;gt;\n  &amp;lt;div id=&amp;quot;cf-wrapper&amp;quot;&amp;gt;\n    &amp;lt;div class=&amp;quot;cf-alert cf-alert-error cf-cookie-error hidden&amp;quot; id=&amp;quot;cookie-alert&amp;quot; data-translate=&amp;quot;enable_cookies&amp;quot;&amp;gt;Please enable cookies.&amp;lt;/div&amp;gt;\n    &amp;lt;div id=&amp;quot;cf-error-details&amp;quot; class=&amp;quot;p-0&amp;quot;&amp;gt;\n      &amp;lt;header class=&amp;quot;mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-15 antialiased&amp;quot;&amp;gt;\n         &amp;lt;h1 class=&amp;quot;inline-block md:block mr-2 md:mb-2 font-light text-60 md:text-3xl text-black-dark leading-tight&amp;quot;&amp;gt;\n           &amp;lt;span data-translate=&amp;quot;error&amp;quot;&amp;gt;Error&amp;lt;/span&amp;gt;\n           &amp;lt;span&amp;gt;1009&amp;lt;/span&amp;gt;\n         &amp;lt;/h1&amp;gt;\n         &amp;lt;span class=&amp;quot;inline-block md:block heading-ray-id font-mono text-15 lg:text-sm lg:leading-relaxed&amp;quot;&amp;gt;Ray ID: 6250695e3c814e6d &amp;amp;bull;&amp;lt;/span&amp;gt;\n         &amp;lt;span class=&amp;quot;inline-block md:block heading-ray-id font-mono text-15 lg:text-sm lg:leading-relaxed&amp;quot;&amp;gt;2021-02-21 12:18:43 UTC&amp;lt;/span&amp;gt;\n        &amp;lt;h2 class=&amp;quot;text-gray-600 leading-1.3 text-3xl lg:text-2xl font-light&amp;quot;&amp;gt;Access denied&amp;lt;/h2&amp;gt;\n      &amp;lt;/header&amp;gt;\n\n      &amp;lt;section class=&amp;quot;w-240 lg:w-full mx-auto mb-8 lg:px-8&amp;quot;&amp;gt;\n          &amp;lt;div id=&amp;quot;what-happened-section&amp;quot; class=&amp;quot;w-1/2 md:w-full&amp;quot;&amp;gt;\n            &amp;lt;h2 class=&amp;quot;text-3xl leading-tight font-normal mb-4 text-black-dark antialiased&amp;quot; data-translate=&amp;quot;what_happened&amp;quot;&amp;gt;What happened?&amp;lt;/h2&amp;gt;\n            &amp;lt;p&amp;gt;The owner of this website (auth.quantum-computing.ibm.com) has banned the country or region your IP address is in (IR) from accessing this website.&amp;lt;/p&amp;gt;\n            \n          &amp;lt;/div&amp;gt;\n\n          \n      &amp;lt;/section&amp;gt;\n\n      &amp;lt;div class=&amp;quot;cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300&amp;quot;&amp;gt;\n  &amp;lt;p class=&amp;quot;text-13&amp;quot;&amp;gt;\n    &amp;lt;span class=&amp;quot;cf-footer-item sm:block sm:mb-1&amp;quot;&amp;gt;Cloudflare Ray ID: &amp;lt;strong class=&amp;quot;font-semibold&amp;quot;&amp;gt;6250695e3c814e6d&amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;\n    &amp;lt;span class=&amp;quot;cf-footer-separator sm:hidden&amp;quot;&amp;gt;&amp;amp;bull;&amp;lt;/span&amp;gt;\n    &amp;lt;span class=&amp;quot;cf-footer-item sm:block sm:mb-1&amp;quot;&amp;gt;&amp;lt;span&amp;gt;Your IP&amp;lt;/span&amp;gt;: 2.183.208.51&amp;lt;/span&amp;gt;\n    &amp;lt;span class=&amp;quot;cf-footer-separator sm:hidden&amp;quot;&amp;gt;&amp;amp;bull;&amp;lt;/span&amp;gt;\n    &amp;lt;span class=&amp;quot;cf-footer-item sm:block sm:mb-1&amp;quot;&amp;gt;&amp;lt;span&amp;gt;Performance &amp;amp;amp; security by&amp;lt;/span&amp;gt; &amp;lt;a rel=&amp;quot;noopener noreferrer&amp;quot; href=&amp;quot;https://www.cloudflare.com/5xx-error-landing&amp;quot; id=&amp;quot;brand_link&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;Cloudflare&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;\n    \n  &amp;lt;/p&amp;gt;\n&amp;lt;/div&amp;gt;&amp;lt;!-- /.error-footer --&amp;gt;\n\n\n    &amp;lt;/div&amp;gt;&amp;lt;!-- /#cf-error-details --&amp;gt;\n  &amp;lt;/div&amp;gt;&amp;lt;!-- /#cf-wrapper --&amp;gt;\n\n  &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;\n  window._cf_translation = {};\n  \n  \n&amp;lt;/script&amp;gt;\n\n&amp;lt;/body&amp;gt;\n&amp;lt;/html&amp;gt;\n'&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14917" LastEditorUserId="1859" LastEditDate="2021-02-22T12:15:37.427" LastActivityDate="2021-02-22T12:15:37.427" Title="IBMQ.load_account() fails with &quot;403 Client Error&quot;" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-02-22T23:11:28.537" ContentLicense="CC BY-SA 4.0" />
  <row Id="16129" PostTypeId="2" ParentId="9089" CreationDate="2021-02-21T13:18:26.813" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt; be a finite-dimensional complex vector space.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Lin}(\mathcal X)$&lt;/span&gt; be the (complex) space of linear operators &lt;span class=&quot;math-container&quot;&gt;$\mathcal X\to\mathcal X$&lt;/span&gt;.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Herm}(\mathcal X)\subset\mathrm{Lin}(\mathcal X)$&lt;/span&gt; be the set of &lt;em&gt;Hermitian&lt;/em&gt; linear operators.&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pos}(\mathcal X)\subset\mathrm{Herm}(\mathcal X)$&lt;/span&gt; be the set of &lt;em&gt;positive semidefinite&lt;/em&gt; Hermitian operators.&#xA;Finally, let &lt;span class=&quot;math-container&quot;&gt;$\mathrm D(\mathcal X)\subset\mathrm{Pos}(\mathcal X)$&lt;/span&gt; be the set of positive semidefinite operators &lt;em&gt;with unit trace&lt;/em&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$\mathrm D(\mathcal X)$&lt;/span&gt; is the set of density matrices in the space &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Observe that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Herm}(\mathcal X)$&lt;/span&gt; is a &lt;em&gt;real vector space&lt;/em&gt; (see &lt;em&gt;e.g.&lt;/em&gt; &lt;a href=&quot;https://math.stackexchange.com/q/1630604/173147&quot;&gt;this question on math.SE&lt;/a&gt;). Its dimension is &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; (an explicit basis is given &lt;a href=&quot;https://math.stackexchange.com/a/4034168/173147&quot;&gt;here&lt;/a&gt;).&#xA;Moreover, the subset of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Herm}(\mathcal X)$&lt;/span&gt; made of Hermitian matrices with unit trace is also a real vector space, whose dimension is &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pos}(\mathcal X)$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; a vector space. &lt;em&gt;E.g.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\!\langle 1|\in\mathrm{Pos}(\mathbb C^2)$&lt;/span&gt;, but&#xA;&lt;span class=&quot;math-container&quot;&gt;$-|1\rangle\!\langle 1|\notin\mathrm{Pos}(\mathbb C^2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, &lt;span class=&quot;math-container&quot;&gt;$\mathrm D(\mathcal X)$&lt;/span&gt; is a (closed, convex) subset of a real &lt;span class=&quot;math-container&quot;&gt;$(d^2-1)$&lt;/span&gt;-dimensional vector space. This is what is meant when we say that &amp;quot;&lt;em&gt;the set of density matrices has dimension &lt;span class=&quot;math-container&quot;&gt;$d^2-1$&lt;/span&gt;&lt;/em&gt;&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-04-12T12:29:08.940" LastActivityDate="2021-04-12T12:29:08.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16130" PostTypeId="1" AcceptedAnswerId="16133" CreationDate="2021-02-21T13:42:15.150" Score="0" ViewCount="46" Body="&lt;p&gt;In the Qiskit textbook, I'm stuck on one of the exercises in section 2.2.  The question is:&lt;/p&gt;&#xA;&lt;p&gt;Write the state: &lt;a href=&quot;https://i.stack.imgur.com/a0UeW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a0UeW.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;as two separate qubits.&lt;/p&gt;&#xA;&lt;p&gt;The answer has already been covered in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15477/writing-state-psi-frac1-sqrt200-fraci-sqrt201-as-separa&quot;&gt;this question here&lt;/a&gt;, and is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TN4ZH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TN4ZH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This makes sense to me - we're basically factoring out the first qubit.&#xA;However, for my own benefit, I tried multiplying out the vectors and I get different results:&lt;/p&gt;&#xA;&lt;p&gt;Using the original form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nkWlk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nkWlk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using the answer supplied:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3cwmp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3cwmp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why don't these give the same values?&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;n.b. Apologies for the use of images - I only had MS Word at my disposal and couldn't find an easy way to export the equations bar screen-shotting.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="14827" LastActivityDate="2021-02-21T14:47:35.467" Title="Qiskit textbook - exercise 2.2 - why doesn't the correct answer give the same statevector?" Tags="&lt;qiskit&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16131" PostTypeId="1" AcceptedAnswerId="16134" CreationDate="2021-02-21T14:30:23.630" Score="1" ViewCount="52" Body="&lt;p&gt;I was reading this &lt;a href=&quot;http://groups.uni-paderborn.de/fg-qi/courses/UPB_QCOMPLEXITY/2019/notes/Lecture%201%20-%20Complexity%20theory%20review.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;lecture notes&lt;/a&gt; by Sevag Gharibian. He mentioned the following statement:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Large-scale universal quantum computer can be built.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I do understand what quantum computer is, but I don't know what is '&lt;strong&gt;Large-scale universal&lt;/strong&gt;' mean here. Can someone explains to me what does it mean?&lt;/p&gt;&#xA;&lt;p&gt;Note: I don't know which tag I should put, so let me know if you know a good tag for this question.&lt;/p&gt;&#xA;" OwnerUserId="9016" LastEditorUserId="55" LastEditDate="2021-02-22T22:48:59.287" LastActivityDate="2021-02-22T22:48:59.287" Title="What does &quot;large-scale universal quantum computation&quot; mean?" Tags="&lt;complexity-theory&gt;&lt;notation&gt;&lt;models&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16132" PostTypeId="2" ParentId="16128" CreationDate="2021-02-21T14:37:48.360" Score="0" Body="&lt;p&gt;The explanation is in the body of the message (after some scrolling):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;The owner of this website (auth.quantum-computing.ibm.com)&#xA;has banned the country or region your IP address is in (IR)&#xA;from accessing this website.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-21T14:37:48.360" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16133" PostTypeId="2" ParentId="16130" CreationDate="2021-02-21T14:47:35.467" Score="3" Body="&lt;p&gt;In your answer you are treating &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle$&lt;/span&gt; as a direct sum of vectors &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;. However, &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle = |x\rangle \otimes |y\rangle$&lt;/span&gt; is actually shorthand for the tensor (Kronecker) product of &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt; (see &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt;  for more details on the Kronecker product).&lt;/p&gt;&#xA;&lt;p&gt;In particular if &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = \begin{pmatrix} a \\ b\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = \begin{pmatrix} c \\ d \end{pmatrix}$&lt;/span&gt; then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|xy\rangle = |x\rangle\otimes |y\rangle = \begin{pmatrix} ac \\ ad \\ bc \\ bd \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-02-21T14:47:35.467" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16134" PostTypeId="2" ParentId="16131" CreationDate="2021-02-21T16:31:20.723" Score="4" Body="&lt;p&gt;&amp;quot;Large-scale&amp;quot; generally means that the quantum computer's ability scales to practical instances of problems. For the case of factoring, RSA keys are usually 1024/2048/4096 bit sized: if a quantum computer could reliably factor these, it would definitely be considered &amp;quot;large-scale&amp;quot; in today's context, but, as the field develops and depending on people's individual tastes, it might change. Note that this would not just be a matter of &amp;quot;qubit count&amp;quot; as is commonly said in articles, it would also be based on the reliability and scalability of the gates acting on them, among other factors: Shor's Algorithm in theoretical principle requires around twice the number of qubits as the number of bits of the number being factored, but as things look now you'd likely need way more for error corrections, and the gate count for the circuit would still be gigantic, but if you could get it all working it could run in a realistic human timeframe unlike all known classical algorithms.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Universal&amp;quot; means that it can run any quantum algorithm rather than being hard-coded for a limited set of situations. DWave's quantum computers are NOT this, which is why news stories like Google and IBM's bigger and bigger qubit records in the late two-digits are treated as significant despite DWave's claims in the thousands. DWave cannot run Shor's Algorithm or Grover's Algorithm.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastActivityDate="2021-02-21T16:31:20.723" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16139" PostTypeId="1" AcceptedAnswerId="16141" CreationDate="2021-02-22T00:35:11.793" Score="2" ViewCount="71" Body="&lt;p&gt;I want to implement the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{iSWAP}$&lt;/span&gt; operator using simple operations in Qiskit such as it is done for the &lt;span class=&quot;math-container&quot;&gt;$iSWAP$&lt;/span&gt; &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.iSwapGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;  or &lt;span class=&quot;math-container&quot;&gt;$\sqrt{SWAP}$&lt;/span&gt; gate &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2228/how-to-implement-the-square-root-of-swap-gate-on-the-ibm-q-composer&quot;&gt;here&lt;/a&gt;. How can I do this? If possible I would like to know what 'methods' do people use to find such decomposition.&lt;/p&gt;&#xA;" OwnerUserId="1754" LastActivityDate="2021-02-22T08:01:09.637" Title="How to implement $\sqrt{iSWAP}$ in Qiskit" Tags="&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16140" PostTypeId="1" CreationDate="2021-02-22T00:56:15.787" Score="1" ViewCount="74" Body="&lt;p&gt;I am starting to learn about Quantum Computers and Quantum Algorithms. I also started reading about Qiskit and Cirq. I really like learning about them and hopefully I can be a Software Engineer with Quantum Computers. First though I would like to keep practicing and studying about them. I have a couple of questions.&lt;/p&gt;&#xA;&lt;p&gt;What is a good program to practice using a quantum algorithm? Should I use Cirq or Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="14927" LastEditorUserId="55" LastEditDate="2021-02-22T12:24:13.747" LastActivityDate="2021-02-22T12:24:13.747" Title="What is a good program to practice using a quantum algorithm? Should I use Cirq or Qiskit?" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;resource-request&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16141" PostTypeId="2" ParentId="16139" CreationDate="2021-02-22T01:41:21.227" Score="3" Body="&lt;p&gt;Given that the&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sqrt{iSWAP} = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1/\sqrt{2} &amp;amp; i/\sqrt{2} &amp;amp; 0 \\ 0 &amp;amp; i/\sqrt{2} &amp;amp; 1/\sqrt{2} &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then we can use the &lt;code&gt;decompose&lt;/code&gt; method in qiskit to get the set of elementary gates that would be implement on IBM hardware, which comes out to be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zZ2g9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zZ2g9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can use &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;nofollow noreferrer&quot;&gt;quirk&lt;/a&gt; to do the something similar I believe. Now, recently IBM changes its native set of gates to &lt;span class=&quot;math-container&quot;&gt;$\{ CZ, ID, RZ, SX, X \}$&lt;/span&gt;. So to see how this being implement on the hardware you can use the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.compiler.transpile.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;transpilation&lt;/code&gt;&lt;/a&gt; method. Which will transpile the above circuit to the following circuit on 'ibmq_athens':&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RlynP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RlynP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you wish to do the decomposition within qiskit, you can use the following script:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info.operators import Operator&#xA;from qiskit import QuantumCircuit, QuantumRegister&#xA;import numpy as np&#xA;sqrt2 = np.sqrt(2)&#xA;controls = QuantumRegister(2)&#xA;circuit = QuantumCircuit(controls)&#xA;Matrix = Operator( [&#xA;    [1, 0, 0, 0],&#xA;    [0, 1/sqrt2, 1j/sqrt2, 0],&#xA;    [0, 1j/sqrt2, 1/sqrt2, 0],&#xA;    [0, 0, 0, 1] ])&#xA;circuit.unitary(Matrix, [0,1])&#xA;decomp = QuantumCircuit.decompose(circuit) &#xA;print(decomp)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And the transpilation process can be done as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;provider = IBMQ.load_account()&#xA;Circuit_Transpile = transpile(decomp, provider.get_backend('ibmq_athens') , optimization_level=3)&#xA;print(Circuit_Transpile)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-22T05:32:59.723" LastActivityDate="2021-02-22T05:32:59.723" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16142" PostTypeId="1" AcceptedAnswerId="16292" CreationDate="2021-02-22T03:26:20.607" Score="4" ViewCount="119" Body="&lt;p&gt;This is a follow-up to a previous question I asked: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12293/how-promising-is-the-possibility-of-carbon-based-qubits-to-make-a-qubit-that-s-s&quot;&gt;How promising is the possibility of carbon-based qubits to make a qubit that’s stable at room temperature?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am trying to assess the significance of electronic transport measurements being performed on a single qubit at room temperature, as claimed in &lt;a href=&quot;https://archerx.com.au/src/uploads/2021/02/20210222_Electronic-transport-in-a-single-qubit-achieved-ASX-Release.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this press release&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The company, Archer Materials, claims to be developing a room temperature quantum computing chip. How significant is this milestone to achieving that goal?&lt;/p&gt;&#xA;" OwnerUserId="12236" LastEditorUserId="2293" LastEditDate="2021-03-01T22:49:50.640" LastActivityDate="2021-03-01T22:49:50.640" Title="How significant is achieving electronic transport in a single qubit at room temperature?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16143" PostTypeId="1" AcceptedAnswerId="16148" CreationDate="2021-02-22T03:45:43.020" Score="6" ViewCount="500" Body="&lt;p&gt;How can one argue that &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;-gate is Clifford while &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-gate is not?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-02-24T10:51:12.823" LastActivityDate="2021-02-24T10:51:12.823" Title="How can one argue that the $S$-gate is Clifford while $T$-gate is not?" Tags="&lt;quantum-gate&gt;&lt;clifford-group&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16144" PostTypeId="1" CreationDate="2021-02-22T04:20:07.283" Score="1" ViewCount="50" Body="&lt;p&gt;I just want to do a whole adiabatic calculation on quantum circuit.&#xA;To prepare two Hamiltonian of &lt;span class=&quot;math-container&quot;&gt;$H_{initial}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_{classical}$&lt;/span&gt; and solve &lt;span class=&quot;math-container&quot;&gt;$H_{classical}$&lt;/span&gt; using adiabatic calc like quantum annealing.&lt;/p&gt;&#xA;&lt;p&gt;The schedule is &lt;span class=&quot;math-container&quot;&gt;$H_s = (1-s/T)*H_{initial} + s/T*H_{classial}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;the time evolution operator is &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is the &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;&amp;quot; on the schedule and the &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt;&amp;quot; in the operator related to each other?&lt;/p&gt;&#xA;" OwnerUserId="14929" LastEditorUserId="55" LastEditDate="2021-02-24T10:40:02.597" LastActivityDate="2021-02-25T07:39:35.207" Title="In quantum adiabatic simulation, is the $s$ in $(1-\frac{s}{T})H_{in}+\frac{s}{T} H_{cl}$ related to the $t$ in $e^{-iHt}$?" Tags="&lt;quantum-gate&gt;&lt;optimization&gt;&lt;annealing&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16145" PostTypeId="2" ParentId="16144" CreationDate="2021-02-22T05:16:43.413" Score="1" Body="&lt;p&gt;If you have a Hermitian matrix, Hamiltonian, of the form &lt;span class=&quot;math-container&quot;&gt;$H = \sum_i H_i$&lt;/span&gt;. Then we can approximate &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ e^{-iHt} \approx  \prod_{j=1}^n \prod_i e^{-iH_i t/n} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This approximation is a consequence of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Lie_product_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trotter product or also known as Lie product formula&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now in term quantum circuit, it will be something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kC24v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kC24v.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then you somehow need to decompose each of the operator &lt;span class=&quot;math-container&quot;&gt;$e^{itH_i}$&lt;/span&gt; into elementary gates. To do this step, look at this paper here: &lt;a href=&quot;https://arxiv.org/pdf/1001.3855.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Simulation of Electronic Structure Hamiltonians UsingQuantum Computers.&lt;/a&gt; This &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11373/9858&quot;&gt;answer&lt;/a&gt; by Davit is also really good reference to look at.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-22T05:16:43.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16146" PostTypeId="1" AcceptedAnswerId="16149" CreationDate="2021-02-22T05:51:54.103" Score="2" ViewCount="135" Body="&lt;p&gt;It's creating a real confusion for me especially the parameterized circuit which I have to create. Can anybody please solve this for me? I want to create this circuit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5zY1R.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5zY1R.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14741" LastEditorUserId="14741" LastEditDate="2021-02-22T06:20:19.777" LastActivityDate="2021-02-22T06:58:01.163" Title="How to implement the swap test with the help of qiskit?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16147" PostTypeId="2" ParentId="16140" CreationDate="2021-02-22T06:06:48.890" Score="1" Body="&lt;p&gt;You can start running basic algorithms like Grover's algorithm, Shor's algorithm, Quantum Teleportation Algorithm, and many more. That's how I started 3 months ago. Now, I am in a much better place. But, yes you need to ensure that you understand all these algorithms and don't just randomly perform these algorithms by copying from the Internet. If you don't understand the logic and working behind these algorithms, I would suggest the Quantum Computing and Quantum Information Book by Nielsen and Chuang. It is a really good book for a headstart in quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;Personally speaking, I use qiskit because I was taught by IBM instructors. But, what I think is as long as you know the logic it hardly matters whether you program in qiskit or cirq.&lt;/p&gt;&#xA;&lt;p&gt;So, in short, you can start with anything!&lt;/p&gt;&#xA;" OwnerUserId="14741" LastActivityDate="2021-02-22T06:06:48.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16148" PostTypeId="2" ParentId="16143" CreationDate="2021-02-22T06:10:23.723" Score="9" Body="&lt;p&gt;By definition, conjugation by a Clifford gate preserves the Pauli group &lt;span class=&quot;math-container&quot;&gt;$G = \langle X, Y, Z\rangle$&lt;/span&gt;. It is easy to check that &lt;span class=&quot;math-container&quot;&gt;$SXS^\dagger = Y, SYS^\dagger = -X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$SZS^\dagger = Z$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$G = \langle -X, Y, Z\rangle$&lt;/span&gt; we see that &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is Clifford. On the other hand, &lt;span class=&quot;math-container&quot;&gt;$TXT^\dagger = \begin{pmatrix} &amp;amp; e^{-i\pi/4}\\ e^{i\pi/4}&amp;amp;\end{pmatrix} \notin G$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is not.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-22T06:10:23.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16149" PostTypeId="2" ParentId="16146" CreationDate="2021-02-22T06:58:01.163" Score="3" Body="&lt;p&gt;Assuming that you are not trying to keep &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; for further computation after measuring the ancilla qubit then you can do it as follows:&lt;/p&gt;&#xA;&lt;p&gt;Let's suppose &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = |111\rangle$&lt;/span&gt; amd &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |000\rangle$&lt;/span&gt; , then you can execute it as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5Qe5G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5Qe5G.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity operator. It doesn't need to be there because the qubits start in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. I just put them there as a place holder.&lt;/p&gt;&#xA;&lt;p&gt;Now this can be done with qiskit as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;&#xA;num_qubits = 3&#xA;circuit1 = QuantumCircuit(num_qubits)&#xA;for i in range(num_qubits):&#xA;    circuit1.x(i)&#xA;&#xA;circuit2 = QuantumCircuit(num_qubits)&#xA;for i in range(num_qubits):&#xA;    circuit2.id(i)&#xA;    &#xA;swap_test_circuit = QuantumCircuit(2*num_qubits + 1,1)&#xA;swap_test_circuit.compose(circuit1, qubits=[1,2,3], inplace=True )&#xA;swap_test_circuit.compose(circuit2, qubits=[4,5,6], inplace=True )&#xA;swap_test_circuit.h(0)&#xA;for i in range(num_qubits):&#xA;    swap_test_circuit.cswap(0,i+1,i+4)&#xA;swap_test_circuit.h(0)&#xA;swap_test_circuit.measure([0],[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-22T06:58:01.163" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16150" PostTypeId="1" CreationDate="2021-02-22T07:06:11.767" Score="1" ViewCount="27" Body="&lt;p&gt;Consider a  CSS code, which is constructed from two binary codes &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt;, so its symplectic matrix is of the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix} M_1 &amp;amp; 0 \\ 0 &amp;amp; M_2 \end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose one knows the weight enumerators of the binary codes &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt;. Can one easily compute the weight enumerator of the CSS code above? What about the special case of &lt;span class=&quot;math-container&quot;&gt;$M_1=M_2$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14393" LastEditorUserId="55" LastEditDate="2021-02-24T09:49:59.747" LastActivityDate="2021-02-25T09:22:45.813" Title="Can one easily compute the weight enumerator of a CSS code constructed from two binary codes $M_1,M_2$?" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16151" PostTypeId="2" ParentId="16139" CreationDate="2021-02-22T08:01:09.637" Score="0" Body="&lt;p&gt;It is possible to create a &lt;span class=&quot;math-container&quot;&gt;$\sqrt{iSWAP}$&lt;/span&gt; gate like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import iSwapGate&#xA;sqrt_iSWAP = iSwapGate().power(1/2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The matrix representation is the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.visualization import array_to_latex&#xA;array_to_latex(sqrt_iSWAP.to_matrix())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; \tfrac{1}{\sqrt{2}} &amp;amp; \tfrac{1}{\sqrt{2}}i &amp;amp; 0  \\&#xA; 0 &amp;amp; \tfrac{1}{\sqrt{2}}i &amp;amp; \tfrac{1}{\sqrt{2}} &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1  \\&#xA; \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can add that gate to a circuit as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.append(sqrt_iSWAP, [0, 1])&#xA;&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zDKQU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zDKQU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Following, transpiled to the IBMQ Athena backend:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;from qiskit import IBMQ&#xA;&#xA;provider = IBMQ.load_account()&#xA;transpiled = transpile(circuit, provider.get_backend('ibmq_athens') , optimization_level=3)&#xA;transpiled.draw('mpl', idle_wires=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ws2Fm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ws2Fm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-22T08:01:09.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16152" PostTypeId="2" ParentId="16123" CreationDate="2021-02-22T09:17:50.533" Score="3" Body="&lt;p&gt;First of all, that does not imply anything for shorter (constant/logarithmic) depths. Moreover, the 2-design property does not imply that the outcome distribution is the same as for Haar-random unitaries, but only the first and second moment is.&lt;/p&gt;&#xA;&lt;p&gt;In the mentioned paper, they consider anti-concentration of the outcome distribution. To show this feature, a distribution does not need to be the one induced by Haar-random unitaries. In fact, any 2-design will result in anti-concentration, and even sufficiently strong approximations of 2-designs.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2021-02-22T09:17:50.533" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16153" PostTypeId="2" ParentId="16143" CreationDate="2021-02-22T09:25:05.720" Score="7" Body="&lt;p&gt;Geometrically: For a single qubit, we have the Bloch sphere and the stabiliser states span an octahedron inside it. Unitaries act in the adjoint representation as &lt;span class=&quot;math-container&quot;&gt;$SO(3)$&lt;/span&gt;, i.e. they induce rotations of the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;It is easy to see, that only rotations about the &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; axis with angles &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi/2,\pi,3\pi/2,2\pi$&lt;/span&gt; preserve the octahedron. This exactly correspond to unitaries of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; U = \exp(i \theta/2 P), \quad P=X,Y,Z&#xA;$$&lt;/span&gt;&#xA;Now, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\theta=\pi/2$&lt;/span&gt; rotation, while &lt;span class=&quot;math-container&quot;&gt;$T=\sqrt{S}$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt; rotation.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Of course, this makes use of the fact that Cliffords are exactly those unitaries which map stabiliser states to stabiliser states!&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-02-22T10:41:05.203" LastActivityDate="2021-02-22T10:41:05.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16154" PostTypeId="2" ParentId="16150" CreationDate="2021-02-22T09:46:57.487" Score="2" Body="&lt;p&gt;Let us define the &amp;quot;symplectic weight&amp;quot; aka Pauli weight of a codeword &lt;span class=&quot;math-container&quot;&gt;$m\in \mathbb F_2^{2n}$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{swt}(m):= | \{ i \in [n] \; | \; m_i \neq 0 \text{ or } m_{n+i} \neq 0 \}|.&#xA;$$&lt;/span&gt;&#xA;This is the Hamming weight when seeing &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; as an additive &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_4$&lt;/span&gt; code.&#xA;The weight &lt;span class=&quot;math-container&quot;&gt;$\mathrm{wt}(c)$&lt;/span&gt; of a classical code word &lt;span class=&quot;math-container&quot;&gt;$c\in\mathbb F_2^n$&lt;/span&gt; is simply the Hamming weight of &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, i.e. the number of non-zero entries.&lt;/p&gt;&#xA;&lt;p&gt;Any code word in &lt;span class=&quot;math-container&quot;&gt;$M:=\mathrm{CSS}(M_1,M_2)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$M_1\subset M_2^\perp$&lt;/span&gt; is of the form &lt;span class=&quot;math-container&quot;&gt;$m=(m_1,m_2)$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$m_1\in M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$m_2\in M_2$&lt;/span&gt;. By definition, we have &lt;span class=&quot;math-container&quot;&gt;$m_1\cdot m_2 = 0$&lt;/span&gt;, hence the following function takes even values on &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA; \mathrm{y}(m) := |\{ i \in [n] \; | \; m_i = 1 = m_{n+i} \}|.&#xA;$$&lt;/span&gt;&#xA;Thus, we have the relation for &lt;span class=&quot;math-container&quot;&gt;$m=(m_1,m_2)\in M$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{swt}(m)=\mathrm{wt}(m_1) + \mathrm{wt}(m_2) - \mathrm{y}(m)&#xA;$$&lt;/span&gt;&#xA;Due to this additional term, it seems that the classical weight enumerators of &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; are insufficient to capture the weight distribution of the CSS code &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-02-25T09:22:45.813" LastActivityDate="2021-02-25T09:22:45.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16156" PostTypeId="1" CreationDate="2021-02-22T11:10:59.287" Score="3" ViewCount="68" Body="&lt;p&gt;From this paper &lt;a href=&quot;https://www.researchgate.net/publication/51944125_Quantum_Circuit_Design_for_Solving_Linear_Systems_of_Equations&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Circuit Design for Solving Linear Systems of Equations&lt;/a&gt;, in figure 4&lt;br&gt;&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mZhte.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mZhte.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The paper shows what inside operator &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt; but didn't shows how to connect the control qubit (register term C) how can I connect them?&lt;/p&gt;&#xA;" OwnerUserId="13676" LastEditorUserId="2293" LastEditDate="2021-02-24T14:55:55.247" LastActivityDate="2021-02-25T09:54:13.487" Title="HHL algorithm, How to implement exp(iAt) gates?" Tags="&lt;algorithm&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16157" PostTypeId="1" CreationDate="2021-02-22T11:20:54.420" Score="0" ViewCount="40" Body="&lt;p&gt;What is the best book or resource to start Learning about Quantum Computing ?&lt;/p&gt;&#xA;" OwnerUserId="9872" LastEditorUserId="55" LastEditDate="2021-02-22T12:20:54.497" LastActivityDate="2021-02-22T12:20:54.497" Title="What is the best book or resource to start Learning about Quantum Computing?" Tags="&lt;entanglement&gt;&lt;resource-request&gt;" AnswerCount="0" CommentCount="5" ClosedDate="2021-02-23T03:33:04.187" ContentLicense="CC BY-SA 4.0" />
  <row Id="16158" PostTypeId="2" ParentId="13547" CreationDate="2021-02-22T14:50:39.430" Score="1" Body="&lt;p&gt;The question of how to order the terms when Trotterizing is an active area of research. It turns out to be beneficial to put commuting terms next to each other. It can also be beneficial to randomise the ordering of terms in each Trotter step (as this suppresses errors), or to even not include certain low value terms. A paper that gives many references to the work that has been done in this area is the following: &lt;a href=&quot;https://quantum-journal.org/papers/q-2020-02-27-235/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Compilation by stochastic Hamiltonian sparsification&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5998" LastActivityDate="2021-02-22T14:50:39.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16159" PostTypeId="1" CreationDate="2021-02-22T15:38:29.383" Score="1" ViewCount="20" Body="&lt;p&gt;I am reading the chapter on quantum error correction in Quantum Computer Science by David Mermim. Which says, for a single qubit in a random state &lt;span class=&quot;math-container&quot;&gt;$|\Phi\rangle$&lt;/span&gt; of the superposition of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the general form of this corrupted qubit, when interacting with the environment in state &lt;span class=&quot;math-container&quot;&gt;$|e\rangle$&lt;/span&gt; is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\tag{1}&#xA;|e\rangle|\Psi\rangle \to (|a\rangle\textbf{X}+|b\rangle\textbf{Y}+|c\rangle\textbf{Z}+|d\rangle\textbf{1})|\Psi\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|a\rangle,|b\rangle,|c\rangle,|d\rangle$&lt;/span&gt; are four random state of the environment, and &lt;span class=&quot;math-container&quot;&gt;$\textbf{X}, \textbf{Y}, \textbf{Z}$&lt;/span&gt; mean a flip error, a combined flip error and phase error, and a phase error, respectively. &lt;span class=&quot;math-container&quot;&gt;$\textbf{1}$&lt;/span&gt; is the identity operator representing no error.&lt;/p&gt;&#xA;&lt;p&gt;From this, the state of a corrupted n-qubit codeword is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\tag{2}&#xA;|e\rangle|\Psi\rangle \to \sum_{\mu_{1}=0}^{3}...\sum_{\mu_{n}=0}^{3}|e_{\mu_{1}...\mu_{n}}\rangle \textbf{X}^{\mu_1}\otimes...\otimes\textbf{X}^{\mu_n}|\Psi\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I can understand the above two equations. But when constructing the general form of the state of a corrupted n-qubit codeword with the assuming that at most one single qubit in the codeword suffers an error, the book says that 'the terms in (2) are dominated by those in which only a single one of the &lt;span class=&quot;math-container&quot;&gt;$X^{\mu_i}$&lt;/span&gt; differs from &lt;span class=&quot;math-container&quot;&gt;$\textbf{1}$&lt;/span&gt;, and the general form of (2) becomes a superposition of terms in which each individual Qbit sufferers an error.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\tag{3}&#xA;|e\rangle|\Psi\rangle \to [\sum_{i=0}^{n-1}(|a_i\rangle\textbf{X}_i+|b_i\rangle\textbf{Y}_i+|c_i\rangle\textbf{Z}_i)+|d\rangle\textbf{1}]|\Psi\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What I do not understand is that since we assume only one qubit has error, then only one of the &lt;span class=&quot;math-container&quot;&gt;$X^{\mu_i}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$X^{\mu_1}\otimes...\otimes X^{\mu_n}$&lt;/span&gt; in equation (5.16) looks like &lt;span class=&quot;math-container&quot;&gt;$|d\rangle\textbf{1} + |a\rangle\textbf{X} + |b\rangle\textbf{Y} + |c\rangle\textbf{Z}$&lt;/span&gt;. As a result, the state &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; should only suffer error in this ith qubit. How do the auther get from (2) to (3) where all the qubits seem to have an error?&lt;/p&gt;&#xA;" OwnerUserId="14923" LastActivityDate="2021-02-22T15:38:29.383" Title="How to write the general state of a corrupted n-qubit codeword in quantum error correction?" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16160" PostTypeId="1" AcceptedAnswerId="16161" CreationDate="2021-02-22T15:53:12.030" Score="3" ViewCount="67" Body="&lt;p&gt;Consider a single qubit state &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; and a hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = Z$&lt;/span&gt;. Evaluating &lt;span class=&quot;math-container&quot;&gt;$\langle \varphi | H | \varphi \rangle$&lt;/span&gt; corresponds to a measurement of &lt;span class=&quot;math-container&quot;&gt;$|\varphi\rangle$&lt;/span&gt; in the computational basis. This is easy to generalise to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits and any Hamiltonian expressed as a tensor product of Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$X, Z, Y$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is: what to do when the Hamiltonian is, for example, &lt;span class=&quot;math-container&quot;&gt;$H = I \otimes Z $&lt;/span&gt;.&#xA;What does &lt;span class=&quot;math-container&quot;&gt;$\langle \varphi | H | \varphi \rangle$&lt;/span&gt; mean in this case?&lt;/p&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="55" LastEditDate="2021-02-24T09:58:24.117" LastActivityDate="2021-02-24T09:58:24.117" Title="What does the identity operator represent when computing $\langle\varphi|I\otimes Z|\varphi\rangle$?" Tags="&lt;mathematics&gt;&lt;measurement&gt;&lt;hamiltonian-simulation&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16161" PostTypeId="2" ParentId="16160" CreationDate="2021-02-22T16:16:26.870" Score="4" Body="&lt;p&gt;When you have &lt;span class=&quot;math-container&quot;&gt;$\langle \varphi | I \otimes Z | \varphi \rangle $&lt;/span&gt; It means you are calculating the expectation of the operator &lt;span class=&quot;math-container&quot;&gt;$I \otimes Z$&lt;/span&gt; with respect to some state &lt;span class=&quot;math-container&quot;&gt;$|\varphi \rangle$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is on the first qubit, we would not need to do anything  there, no need to do any rotation or even measurement. The eigenspace is decomposed into two halves depending on the second qubit. That is, the states  &lt;span class=&quot;math-container&quot;&gt;$\{ |00\rangle, |10\rangle \} $&lt;/span&gt; belong to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, and the states &lt;span class=&quot;math-container&quot;&gt;$\{| 01\rangle, |11\rangle \}$&lt;/span&gt; belong to the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace.  Notice how only the second qubit value matter.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, if we have &lt;span class=&quot;math-container&quot;&gt;$\langle Z \otimes I \rangle$&lt;/span&gt; instead, then we would measure the first qubit and leave the second qubit alone. In this case, the states  &lt;span class=&quot;math-container&quot;&gt;$\{ |00\rangle, |01\rangle \} $&lt;/span&gt; belong to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, and the states &lt;span class=&quot;math-container&quot;&gt;$\{| 10\rangle, |11\rangle \}$&lt;/span&gt; belong to the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace.&lt;/p&gt;&#xA;&lt;p&gt;If we have &lt;span class=&quot;math-container&quot;&gt;$\langle I \otimes X \rangle$&lt;/span&gt; then we would do a Hadamard rotation before measuring the second qubit and leave the first qubit alone.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-22T16:16:26.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16162" PostTypeId="1" AcceptedAnswerId="16165" CreationDate="2021-02-22T16:45:01.527" Score="1" ViewCount="112" Body="&lt;p&gt;I was reading the &lt;a href=&quot;https://en.wikipedia.org/wiki/Superdense_coding#:%7E:text=Superdense%20coding%20is%20the%20underlying%20principle%20of%20secure%20quantum%20secret%20coding.&amp;amp;text=It%20can%20be%20thought%20of,a%20pre%2Dshared%20Bell%20pair.&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki page on superdense coding algorithm&lt;/a&gt;. I am not quite sure what happens in this algorithm. When the photon which is part of entangled pair is being sent to Bob from Alice's side, does that mean that photon is not there with Alice anymore?&lt;/p&gt;&#xA;&lt;p&gt;(I am asking this because if it is not there then to send some classical information again, we have to prepare another entangled pair or Bob has to send back that photon. Because upon projective measurement in bell basis the state won't be destroyed.)&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="2879" LastEditDate="2021-02-22T23:27:47.623" LastActivityDate="2021-02-22T23:27:47.623" Title="Does sending a qubit using a quantum network through some conventional physical medium mean it is not with sender anymore after sending?" Tags="&lt;superdense-coding&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16163" PostTypeId="2" ParentId="16156" CreationDate="2021-02-22T17:11:52.580" Score="1" Body="&lt;p&gt;&lt;em&gt;Edit: the question has been edited after I wrote my answer.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;A point by point answer:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The paper shows what inside operator &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt; but didn't shows how to connect the control qubit (register term C) how can I connect them?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The problem of controlling a full circuit (or sub-circuit here) has a trivial solution: control all the gates that compose the circuit.&lt;/p&gt;&#xA;&lt;p&gt;So the implementation of the &lt;strong&gt;controlled&lt;/strong&gt; exponential operator will be performed via this kind of circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HYA1k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HYA1k.png&quot; alt=&quot;exponential circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;All you have left to do is to decompose the non-primitive gates into primitive ones such as CCZ -&amp;gt; H(2) CCX H(2) -&amp;gt; H(2) [Toffoli gate implementation] H(2).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;How can I encode matrix A into the circuit? Is the circuit for operator &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt; in fig 4 can be use for any 4x4 matrix?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is already encoded in the circuit. In fact, the circuit implements the unitary matrix &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt; which is the only place in the HHL algorithm where we actually need &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As far as I know, this circuit &lt;em&gt;may&lt;/em&gt; be able to encode any &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; matrice. I do not think this is the case, but I do not have counter example to provide so the possibility is still there.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;What does the eigenvalues from matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is for? How is it related to the circuit?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In HHL and in linear system solving in general, the eigenvalues of the matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; are a particular interest. In this case, HHL works by estimating the eigenvalues of the matrix and &lt;em&gt;inverting them&lt;/em&gt; (as in &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\lambda}$&lt;/span&gt;). In this paper, the authors use this specific matrix with these specific eigenvalues because the eigenvalues are easy to encode on qubits and the inversion step is easy to implement.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Some quick notes about this paper and the implementation:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I studied quite a lot this paper and even implemented it. The code is available &lt;a href=&quot;https://github.com/nelimee/quantum-hhl-4x4&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The last &lt;code&gt;Z&lt;/code&gt; gate in the implementation actually seems to be an error. At least I was not able to make the code work with this &lt;code&gt;Z&lt;/code&gt; gate but I was able to get results when replacing it with a &lt;code&gt;CZ&lt;/code&gt; gate.&lt;/li&gt;&#xA;&lt;li&gt;It is important to realize that this implementation is &lt;strong&gt;highly&lt;/strong&gt; tailored to a specific matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Changing it to make it work with another matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; will require to re-write nearly everything from scratch.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1386" LastEditorUserId="1386" LastEditDate="2021-02-25T09:54:13.487" LastActivityDate="2021-02-25T09:54:13.487" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16164" PostTypeId="2" ParentId="15144" CreationDate="2021-02-22T17:33:23.930" Score="0" Body="&lt;p&gt;IBM usually disables an account if their is a violation of the Code of Conduct. It can be an error, but is mostly accurate. Read &lt;a href=&quot;https://www.ibm.com/legal&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I hope by now your account would have been recovered and every thing will be good.&lt;/p&gt;&#xA;" OwnerUserId="14956" LastActivityDate="2021-02-22T17:33:23.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16165" PostTypeId="2" ParentId="16162" CreationDate="2021-02-22T20:53:26.797" Score="3" Body="&lt;p&gt;Yes, your understanding is correct: when Alice sends her qubit to Bob, she doesn't have that qubit any longer. Entangled pairs of qubits distributed between the parties are a resource that is used up: sending 2 classical bits of information uses up one pair, and this pair cannot be reused to send another 2 bits without extra steps (like you suggested, Bob could send the qubit back).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-02-22T20:53:26.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16166" PostTypeId="1" CreationDate="2021-02-22T21:36:01.937" Score="2" ViewCount="39" Body="&lt;p&gt;I have taken the tensor product of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \otimes |-\rangle \otimes |+\rangle$&lt;/span&gt; which resulted in the matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}&#xA;1/2\\&#xA;1/2 \\&#xA;-1/2 \\&#xA;-1/2 \\&#xA;0 \\&#xA;0\\&#xA;0\\&#xA;0\\&#xA;\end{bmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How would I represent this in the computational basis basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14960" LastEditorUserId="55" LastEditDate="2021-02-22T22:48:40.353" LastActivityDate="2021-02-22T22:48:40.353" Title="How do I represent my 3-qubit state in the computational basis?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;tensor-product&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16167" PostTypeId="2" ParentId="16166" CreationDate="2021-02-22T21:47:13.070" Score="2" Body="&lt;p&gt;The elements of your vector are coefficients of the state in the computational basis&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{cc}&#xA;\begin{bmatrix}&#xA;1/2\\&#xA;1/2 \\&#xA;-1/2 \\&#xA;-1/2 \\&#xA;0 \\&#xA;0\\&#xA;0\\&#xA;0\\&#xA;\end{bmatrix}&#xA;&amp;amp;\begin{matrix}&#xA;|000\rangle \\&#xA;|001\rangle \\&#xA;|010\rangle \\&#xA;|011\rangle \\&#xA;|100\rangle \\&#xA;|101\rangle \\&#xA;|110\rangle \\&#xA;|111\rangle&#xA;\end{matrix}&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\otimes|-\rangle\otimes|+\rangle = \frac{|000\rangle + |001\rangle - |010\rangle - |011\rangle}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can confirm by direct calculation in Dirac notation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|0\rangle\otimes|-\rangle\otimes|+\rangle &amp;amp;= |0\rangle\otimes\frac{|0\rangle-|1\rangle}{\sqrt{2}} \otimes \frac{|0\rangle+|1\rangle}{\sqrt{2}} \\&#xA;&amp;amp;= \frac{|0\rangle\otimes (|00\rangle + |01\rangle - |10\rangle - |11\rangle)}{2} \\&#xA;&amp;amp;= \frac{|000\rangle + |001\rangle - |010\rangle - |011\rangle}{2}.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-22T21:47:13.070" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16168" PostTypeId="1" AcceptedAnswerId="16170" CreationDate="2021-02-22T23:06:45.050" Score="1" ViewCount="43" Body="&lt;p&gt;What ansatz would be best used for a maximally entangled n qubit H? I came across this question in the Qiskit textbook and I really don't know how I would answer it.&lt;/p&gt;&#xA;" OwnerUserId="14621" LastEditorUserId="55" LastEditDate="2021-02-24T09:59:44.363" LastActivityDate="2021-02-24T09:59:44.363" Title="In VQE, what ansatz would be best used for a maximally entangled $n$-qubit $H$?" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;entanglement&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16169" PostTypeId="1" CreationDate="2021-02-22T23:42:17.180" Score="2" ViewCount="46" Body="&lt;p&gt;I am currently reading Nielsen &amp;amp; Chuang, and one of the questions asks to calculate a density matrix with the following mixed states, how would I do this?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|00&amp;gt; \;with \;probability \; 2/4 \\&#xA;|01&amp;gt; \;with\; probability\; 0\\&#xA;|10&amp;gt; \;with \;probability\; 1/4 \\&#xA;|11&amp;gt;\; with\; probability \;1/4$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14960" LastEditorUserId="55" LastEditDate="2021-02-23T17:49:56.323" LastActivityDate="2021-02-23T17:49:56.323" Title="How would I compute a density matrix of a 2 qubit mixed state?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16170" PostTypeId="2" ParentId="16168" CreationDate="2021-02-22T23:47:09.013" Score="2" Body="&lt;p&gt;If we are given a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; that can be represents with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit, and promised that the ground state of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is close to a maximally entangled &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state, then we can use the fact that the maximal entangled &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be represent as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \dfrac{|0\rangle^{\otimes n} + |1\rangle^{\otimes n}  }{\sqrt{2}}$$&lt;/span&gt;&#xA;which can be created by using the circuit of the form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZN28v.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZN28v.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;here I created the state &lt;span class=&quot;math-container&quot;&gt;$|\psi^5 \rangle = \dfrac{|0\rangle^{\otimes 5} + |1\rangle^{\otimes 5}  }{\sqrt{2}} $&lt;/span&gt; but you get the idea of how to create such a state for arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit system.&lt;/p&gt;&#xA;&lt;p&gt;Since we are promised that our state is near this state, you can create your Ansatze (parametrized circuit) based of the circuit above, and you can add a few additional rotation gates if you wish. For instance, something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/y6xii.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/y6xii.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Or if you think the coefficients might be imaginary, then you can add another rotation to your Ansatze, says the &lt;span class=&quot;math-container&quot;&gt;$R_Z$&lt;/span&gt; rotation and have something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bmhtS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bmhtS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can create these circuit quite easily through the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.TwoLocal.html#qiskit.circuit.library.TwoLocal&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit's TwoLocal circuit library&lt;/a&gt;.  Within it, there is an option on selecting the type of &amp;quot;entanglement&amp;quot; you want to have for your Ansatze. There a few options, &amp;quot;Linear&amp;quot; or &amp;quot;Full&amp;quot; or &amp;quot;circular&amp;quot;... so you can use these pre-defined option as well. This way you don't have to worry about setting the CNOT gates by yourself.&lt;/p&gt;&#xA;&lt;p&gt;Note that if your state is indeed the maximal entangled state &lt;span class=&quot;math-container&quot;&gt;$|\psi^5 \rangle = \dfrac{|0\rangle^{\otimes 5} + |1\rangle^{\otimes 5}  }{\sqrt{2}}$&lt;/span&gt; then all the angles will be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or very close to it, except the first angle &lt;span class=&quot;math-container&quot;&gt;$a[0]$&lt;/span&gt;, which will be &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-23T00:08:08.827" LastActivityDate="2021-02-23T00:08:08.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16171" PostTypeId="2" ParentId="16169" CreationDate="2021-02-22T23:57:51.757" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = \dfrac{1}{2}|00\rangle \langle 00 | + 0|01\rangle \langle 01| + \dfrac{1}{4} |10\rangle \langle 10| + \dfrac{1}{4} |11\rangle \langle 11 | = \begin{pmatrix} 1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 1/4 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/4 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix} 1\\ 0 \end{pmatrix} \otimes \begin{pmatrix} 1\\ 0 \end{pmatrix} = \begin{pmatrix} 1 \cdot 1 \\ 1 \cdot 0 \\0 \cdot 1 \\ 0 \cdot 0 \end{pmatrix} = \begin{pmatrix} 1\\ 0 \\0 \\ 0 \end{pmatrix}$&lt;/span&gt; and similarly, you can calculate that &lt;span class=&quot;math-container&quot;&gt;$|01\rangle = \begin{pmatrix} 1\\ 0 \end{pmatrix} \otimes \begin{pmatrix} 0\\ 1 \end{pmatrix}= \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix} $&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|10 \rangle = \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix} $&lt;/span&gt;, and lastly &lt;span class=&quot;math-container&quot;&gt;$|11\rangle = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle \langle 00| $&lt;/span&gt; represents the &lt;a href=&quot;https://en.wikipedia.org/wiki/Outer_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;outer-product&lt;/a&gt; and hence&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle \langle 00| = \begin{pmatrix} 1\\ 0 \\0 \\ 0 \end{pmatrix} \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp;  0 \end{pmatrix}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;you can calculate the others and verify.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-23T00:46:47.887" LastActivityDate="2021-02-23T00:46:47.887" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16172" PostTypeId="1" CreationDate="2021-02-23T01:34:46.513" Score="2" ViewCount="40" Body="&lt;p&gt;I am currently reading Nielsen &amp;amp; Chuang, and one of the questions asks to calculate a density matrix with the following mixed state,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{9}\begin{bmatrix}&#xA;5 &amp;amp; 1 &amp;amp; −i \\&#xA;1 &amp;amp; 2 &amp;amp; -2i \\&#xA;i &amp;amp; 2i &amp;amp; 2 \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and retrieving the probability of measuring&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle = \begin{pmatrix} 1 \\&#xA;0\\&#xA;0\\&#xA;\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How would I do this?&lt;/p&gt;&#xA;" OwnerUserId="14960" LastEditorUserId="10480" LastEditDate="2021-02-23T02:21:47.113" LastActivityDate="2021-02-23T02:30:10.130" Title="How would I compute a density matrix of a complex qubit mixed state?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16173" PostTypeId="2" ParentId="16172" CreationDate="2021-02-23T02:30:10.130" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; denote the density matrix specified in the question. The probability of obtaining the result corresponding to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; when measuring &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in the computational basis is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(0|\rho) = \mathrm{tr}(P_0\rho) = \mathrm{tr}(|0\rangle\langle 0|\rho) = \langle 0|\rho|0 \rangle = \frac{5}{9}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_0=|0\rangle\langle 0|$&lt;/span&gt; is the projector onto the subspace spanned by &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. See equation &lt;span class=&quot;math-container&quot;&gt;$(2.159)$&lt;/span&gt; on page 102 in Nielsen &amp;amp; Chuang where &lt;span class=&quot;math-container&quot;&gt;$M_m = P_0$&lt;/span&gt; and note that &lt;span class=&quot;math-container&quot;&gt;$P_0=P_0^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_0^2 = P_0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-23T02:30:10.130" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16174" PostTypeId="1" AcceptedAnswerId="16175" CreationDate="2021-02-23T02:51:50.207" Score="2" ViewCount="52" Body="&lt;p&gt;Suppose that Alice applies a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with real entries to her qubit in an EPR pair &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle=\frac{1}{\sqrt 2}(|00\rangle+|11\rangle)$&lt;/span&gt;. Is this the same as having Bob apply &lt;span class=&quot;math-container&quot;&gt;$U^T$&lt;/span&gt; to his half?&lt;/p&gt;&#xA;&lt;p&gt;I can't quite show algebraically whether the identity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt 2}(U|0\rangle\otimes |0\rangle+U|1\rangle\otimes|1\rangle)=\frac{1}{\sqrt 2}(|0\rangle\otimes U^T|0\rangle+|1\rangle\otimes U^T|1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is true or not.&#xA;I see that I can get from the LHS to the RHS by applying &lt;span class=&quot;math-container&quot;&gt;$U^T\otimes U^T$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$U^T=U^\dagger=U^{-1}$&lt;/span&gt;, but I still haven't made progress.&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="55" LastEditDate="2021-02-24T09:55:15.293" LastActivityDate="2021-02-24T09:55:15.293" Title="Show algebraically that $U|0\rangle\otimes |0\rangle+U|1\rangle\otimes|1\rangle=|0\rangle\otimes U^T|0\rangle+|1\rangle\otimes U^T|1\rangle$" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16175" PostTypeId="2" ParentId="16174" CreationDate="2021-02-23T03:19:57.977" Score="3" Body="&lt;p&gt;Yes, application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to Alice's half of &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle=(|00\rangle+|11\rangle)/\sqrt{2}$&lt;/span&gt; and appliaction of &lt;span class=&quot;math-container&quot;&gt;$U^T$&lt;/span&gt; to Bob's half are equivalent. In fact the identity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(A \otimes I)|\beta\rangle = (I \otimes A^T) |\beta\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is true for any matrix (not necessarily unitary or real). Let&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \begin{pmatrix}&#xA;a_{00} &amp;amp; a_{01} \\&#xA;a_{10} &amp;amp; a_{11}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and compare&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(A \otimes I)|\beta\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;a_{00} &amp;amp; 0 &amp;amp; a_{01} &amp;amp; 0 \\&#xA;0 &amp;amp; a_{00} &amp;amp; 0 &amp;amp; a_{01} \\&#xA;a_{10} &amp;amp; 0 &amp;amp; a_{11} &amp;amp; 0 \\&#xA;0 &amp;amp; a_{10} &amp;amp; 0 &amp;amp; a_{11} \\&#xA;\end{pmatrix} \cdot \begin{pmatrix}&#xA;1 \\ 0 \\ 0 \\ 1&#xA;\end{pmatrix} =&#xA;\frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;a_{00} \\ a_{01} \\ a_{10} \\ a_{11}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I \otimes A^T) |\beta\rangle = \begin{pmatrix}&#xA;a_{00} &amp;amp; a_{10} &amp;amp; 0 &amp;amp; 0 \\&#xA;a_{01} &amp;amp; a_{11} &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; a_{00} &amp;amp; a_{10} \\&#xA;0 &amp;amp; 0 &amp;amp; a_{01} &amp;amp; a_{11}&#xA;\end{pmatrix} \cdot \begin{pmatrix}&#xA;1 \\ 0 \\ 0 \\ 1&#xA;\end{pmatrix} =&#xA;\frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;a_{00} \\ a_{01} \\ a_{10} \\ a_{11}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A more elegant way to prove the identity uses tensor networks, see example 9 and equation &lt;span class=&quot;math-container&quot;&gt;$(46)$&lt;/span&gt; on page 12 in &lt;a href=&quot;https://arxiv.org/abs/1708.00006&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-23T03:26:13.307" LastActivityDate="2021-02-23T03:26:13.307" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16176" PostTypeId="1" AcceptedAnswerId="16184" CreationDate="2021-02-23T03:46:51.283" Score="1" ViewCount="46" Body="&lt;p&gt;I am attempting to run parallel computations on two different backends from within the same Jupyter notebook, though it appears these two jobs are running sequentially. I understand the jobs will be asynchronous, but is there any way to submit two jobs to differing backends at the same time? I'm not seeing anything allowing for providing multiple backends. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="14019" LastActivityDate="2021-02-23T11:44:19.337" Title="Multiple Providers on IBMQ" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16177" PostTypeId="2" ParentId="16176" CreationDate="2021-02-23T06:53:53.507" Score="1" Body="&lt;p&gt;As I commented above, this can be done through python &lt;code&gt;multiprocessing&lt;/code&gt; tool. Here is an example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import multiprocessing&#xA;import numpy as np &#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, IBMQ, execute&#xA;provider = IBMQ.load_account()&#xA;&#xA;num_qubits = 2&#xA;qreg_q = QuantumRegister(num_qubits, 'q')&#xA;creg_c = ClassicalRegister(num_qubits, 'c')&#xA;circuit = QuantumCircuit(qreg_q,creg_c)&#xA;for i in range(num_qubits):&#xA;    circuit.h(qreg_q[i])&#xA;    circuit.measure(qreg_q[i], creg_c[i] )&#xA;print(circuit)&#xA;&#xA;def quantum_jobs(i, return_jobs, backend):&#xA;    print(backend)&#xA;    jobs = execute(circuit, backend, shots = 1000).result().get_counts()&#xA;    i = jobs['00'] # get 00 counts just as an example.... &#xA;    return_jobs[i] = i&#xA;&#xA;backends = [provider.get_backend('ibmq_athens'), provider.get_backend('ibmq_santiago') ]&#xA;&#xA;if __name__ == &amp;quot;__main__&amp;quot;:&#xA;    manager = multiprocessing.Manager()&#xA;    return_jobs = manager.dict()&#xA;    jobs = []&#xA;    for i in range(2):&#xA;        p = multiprocessing.Process(target=quantum_jobs, args=(i, return_jobs , backends[i]))&#xA;        jobs.append(p)&#xA;        p.start()&#xA;&#xA;    for proc in jobs:&#xA;        proc.join()&#xA;    print(return_jobs.values())&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐┌─┐   &#xA;q_0: ┤ H ├┤M├───&#xA;     ├───┤└╥┘┌─┐&#xA;q_1: ┤ H ├─╫─┤M├&#xA;     └───┘ ║ └╥┘&#xA;c: 2/══════╩══╩═&#xA;           0  1 &#xA;ibmq_athens&#xA;ibmq_santiago&#xA;&#xA;[277, 271]&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I think you do have a maximum of 5 jobs being submitted at a time so keep this in mind.&lt;/p&gt;&#xA;&lt;p&gt;All the best.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-23T06:53:53.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16178" PostTypeId="1" AcceptedAnswerId="16180" CreationDate="2021-02-23T07:16:32.580" Score="4" ViewCount="28" Body="&lt;p&gt;For some projector &lt;span class=&quot;math-container&quot;&gt;$\Pi_A$&lt;/span&gt; and state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, let&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_{AB} = \frac{\Pi_A\otimes I_B}{\text{Tr}((\Pi_A\otimes I_B)\rho_{AB})}\rho_{AB}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it the case that &lt;span class=&quot;math-container&quot;&gt;$\sigma_B = \rho_B$&lt;/span&gt;? It seems intuitively true since the projector is acting only on the &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; system but I'm not sure how to prove this.&lt;/p&gt;&#xA;" OwnerUserId="14966" LastEditorUserId="55" LastEditDate="2021-02-23T17:46:31.637" LastActivityDate="2021-02-23T17:46:31.637" Title="Does $\frac{\Pi_A\otimes I_B}{\text{Tr}((\Pi_A\otimes I_B)\rho_{AB})}\rho_{AB}=\rho_{AB}$ hold for a state $\rho_{AB}$ and projector $\Pi_A$?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;partial-trace&gt;&lt;projection-operator&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16180" PostTypeId="2" ParentId="16178" CreationDate="2021-02-23T07:38:07.160" Score="2" Body="&lt;p&gt;No, this is not the case. Consider the situation where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}=\frac12(|0\rangle\langle 0|\otimes |0\rangle\langle 0|+|1\rangle\langle 1|\otimes |1\rangle\langle 1|).&#xA;$$&lt;/span&gt;&#xA;So, we have that &lt;span class=&quot;math-container&quot;&gt;$\rho_B=\text{Tr}_A(\rho_{AB})=\frac12(|0\rangle\langle 0|+|1\rangle\langle 1|)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now let &lt;span class=&quot;math-container&quot;&gt;$\Pi_A=|0\rangle\langle 0|$&lt;/span&gt;, which means that &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}=|00\rangle\langle 00|$&lt;/span&gt; and hence &lt;span class=&quot;math-container&quot;&gt;$\sigma_B=|0\rangle\langle 0|$&lt;/span&gt;. Clearly, &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; are different.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-23T07:38:07.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16181" PostTypeId="2" ParentId="16105" CreationDate="2021-02-23T08:21:53.287" Score="4" Body="&lt;h2&gt;Generalization of Schmidt decomposition&lt;/h2&gt;&#xA;&lt;p&gt;The Schmidt decomposition &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle = \sum_i\lambda_i|i_A\rangle|i_B\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; positive real numbers and &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|i_B\rangle$&lt;/span&gt; (possibly incomplete) orthonormal bases, of a bipartite state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{AB}\rangle$&lt;/span&gt; can be thought of as a type of singular-value decomposition. Specifically, if the amplitudes &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij} = \langle i|\langle j|\psi_{AB}\rangle$&lt;/span&gt; are arranged into a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix rather than the usual &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;-vector, then &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are precisely the non-zero singular values of the matrix &lt;span class=&quot;math-container&quot;&gt;$\psi_{ij}$&lt;/span&gt;. This explains why &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are positive real numbers. See the proof of theorem 2.7 on page 109 in Nielsen &amp;amp; Chuang for more details.&lt;/p&gt;&#xA;&lt;p&gt;The decomposition can be generalized to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-partite state as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{A_1A_2 \dots A_n}\rangle = \sum_i \lambda_i |i_{A_1}\rangle |i_{A_2}\rangle\dots |i_{A_n}\rangle\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where as before &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are positive real numbers and &lt;span class=&quot;math-container&quot;&gt;$|i_{A_k}\rangle$&lt;/span&gt; are (possibly incomplete) orthonormal bases. If &lt;span class=&quot;math-container&quot;&gt;$n=2$&lt;/span&gt;, then decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; exists for every pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{A_1A_2}\rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;2$&lt;/span&gt;, then there are pure states without decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Physical characterization&lt;/h2&gt;&#xA;&lt;p&gt;Physically, the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-partite states that admit decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; can be characterized as the states that are free of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-partite entanglement for every &lt;span class=&quot;math-container&quot;&gt;$1&amp;lt;m&amp;lt;n$&lt;/span&gt;. More precisely, &lt;span class=&quot;math-container&quot;&gt;$|\psi_{A_1A_2 \dots A_n}\rangle$&lt;/span&gt; admits decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; if and only if for every &lt;span class=&quot;math-container&quot;&gt;$k = 1,\dots n-1$&lt;/span&gt; and subsystems &lt;span class=&quot;math-container&quot;&gt;$A_{i_1}\dots A_{i_k}$&lt;/span&gt;, the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{A_{i_1}\dots A_{i_k}} = \mathrm{tr}_{A_{i_1}\dots A_{i_k}}\left(|\psi_{A_1A_2 \dots A_n}\rangle\langle\psi_{A_1A_2 \dots A_n}|\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is separable. One way of thinking about these states is that all (if any) entanglement that they have lives between all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; subsystems. Conversely, states that do not admit &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; necessarily contain some entanglement between fewer than &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; subsystems.&lt;/p&gt;&#xA;&lt;p&gt;This characterization is not very useful to computationally check whether a given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-partite state admits decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. Nevertheless, it helps to intuitively understand the class of Schmidt-decomposable states. In particular, it explains why a generic &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-partite state for &lt;span class=&quot;math-container&quot;&gt;$n&amp;gt;2$&lt;/span&gt; does not admit &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. It also explains why all bipartite states admit &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; it is impossible to entangle fewer than &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; subsystems.&lt;/p&gt;&#xA;&lt;h2&gt;Necessary and sufficient conditions in the tripartite case&lt;/h2&gt;&#xA;&lt;p&gt;The necessary and sufficient conditions for a state to admit decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; are given in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9504006&quot; rel=&quot;nofollow noreferrer&quot;&gt;the paper&lt;/a&gt; cited in a comment above by @Rammus. We reproduce the results of the paper in the case when the Schmidt decomposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{ABC}\rangle = \sum_i \lambda_i |i_A\rangle|i_{BC}\rangle\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;of a tripartite state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ABC}\rangle$&lt;/span&gt; associated with the partitioning of &lt;span class=&quot;math-container&quot;&gt;$ABC$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$BC$&lt;/span&gt; has distinct coefficients, i.e. &lt;span class=&quot;math-container&quot;&gt;$\lambda_i \ne \lambda_j$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i \ne j$&lt;/span&gt;. Define the matrices &lt;span class=&quot;math-container&quot;&gt;$\Omega_i$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Omega_{i,jk} = \langle j_B|\langle k_C|i_{BC}\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$\Omega_i$&lt;/span&gt; is the matrix of amplitudes of the state &lt;span class=&quot;math-container&quot;&gt;$|i_{BC}\rangle$&lt;/span&gt;. The necessary conditions for &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ABC}\rangle$&lt;/span&gt; to admit decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; is for all &lt;span class=&quot;math-container&quot;&gt;$\Omega_i$&lt;/span&gt; to be rank one and &lt;span class=&quot;math-container&quot;&gt;$\Omega_i^\dagger\Omega_{i'} = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Omega_i\Omega_{i'}^\dagger = 0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\ne  i'$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are not all distinct, then the necessary and sufficient conditions become more complicated, because &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;$\Omega_i$&lt;/span&gt; are no longer unique. See &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9504006&quot; rel=&quot;nofollow noreferrer&quot;&gt;the paper&lt;/a&gt; for more details.&lt;/p&gt;&#xA;&lt;h2&gt;Example: &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; state&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|W\rangle = \frac{|001\rangle + |010\rangle + |100\rangle}{\sqrt{3}} = \frac{\sqrt{2}}{\sqrt{3}}|0\rangle\otimes\frac{|01\rangle + |10\rangle}{\sqrt{2}} + \frac{1}{\sqrt{3}}|1\rangle\otimes |00\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, &lt;span class=&quot;math-container&quot;&gt;$\lambda_0=\frac{\sqrt{2}}{\sqrt{3}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 = \frac{1}{\sqrt{3}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0_{BC}\rangle = (|01\rangle+|10\rangle)/\sqrt{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1_{BC}\rangle = |00\rangle$&lt;/span&gt; so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Omega_0 = \frac{1}{\sqrt{2}}\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix} \quad \Omega_1 = \begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that &lt;span class=&quot;math-container&quot;&gt;$\Omega_1$&lt;/span&gt; is rank one, but &lt;span class=&quot;math-container&quot;&gt;$\Omega_0$&lt;/span&gt; is not. Therefore, &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; does not admit decomposition &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-23T08:21:53.287" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16182" PostTypeId="1" AcceptedAnswerId="16185" CreationDate="2021-02-23T09:09:31.433" Score="4" ViewCount="64" Body="&lt;p&gt;IBM's quantum experience offers computing up to 15 qubits however through my search of current literature the largest implementation for the algorithm has been with 4 qubits. Is there an issue, preventing people from increasing the size of the algorithm?&lt;/p&gt;&#xA;" OwnerUserId="14967" LastEditorUserId="55" LastEditDate="2021-02-24T09:49:04.353" LastActivityDate="2021-02-24T09:49:04.353" Title="Is there an issue preventing people from scaling Grover's algorithm to larger numbers of qubits?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16183" PostTypeId="2" ParentId="2667" CreationDate="2021-02-23T09:15:32.317" Score="2" Body="&lt;p&gt;Im quite new to QC as well, as a side hobby. I've been using the &lt;a href=&quot;https://qiskit.org/textbook/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt;, its relatively simple to grasp and they've got some awesome exercises for you to do and practice your skills.&lt;/p&gt;&#xA;" OwnerUserId="14967" LastEditorUserId="1859" LastEditDate="2021-02-23T15:46:43.070" LastActivityDate="2021-02-23T15:46:43.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16184" PostTypeId="2" ParentId="16176" CreationDate="2021-02-23T11:44:19.337" Score="2" Body="&lt;p&gt;There is a (much simpler in my opinion) solution that does not require &lt;code&gt;multiprocessing&lt;/code&gt; at all: use &lt;code&gt;qiskit&lt;/code&gt; API.&lt;/p&gt;&#xA;&lt;p&gt;A code sample is worth a thousand words:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Load the packages&#xA;from qiskit import IBMQ, QuantumCircuit, execute&#xA;&#xA;# Log in to your IBMQ account&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')&#xA;# Get the backends you are interested in&#xA;backends = [provider.get_backend(b) for b in [&amp;quot;ibmq_athens&amp;quot;, &amp;quot;ibmq_quito&amp;quot;]]&#xA;# Build the quantum circuit&#xA;qc = QuantumCircuit(5)&#xA;qc.h(list(range(5)))&#xA;qc.cx(0, 1)&#xA;qc.cx(1, 2)&#xA;qc.cx(3, 4)&#xA;qc.cx(5, 2)&#xA;qc.measure_all()&#xA;# Asynchronously submit the circuit on all the backends.&#xA;# This will only submit the circuits, not wait for their completion.&#xA;jobs = [execute(qc, backend) for backend in backends]&#xA;&#xA;# Do some work...&#xA;&#xA;# When you need your job results:&#xA;# You can also query the results individually if needed.&#xA;# The call to &amp;quot;result()&amp;quot; blocks until the job is finished.&#xA;results = [j.result() for j in jobs]&#xA;&#xA;# Now you can use the results, for example to recover the counts&#xA;# This is a non-blocking operation as the counts are already in&#xA;# the results obtained in the previous step&#xA;counts = [result.get_counts() for result in results]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2021-02-23T11:44:19.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16185" PostTypeId="2" ParentId="16182" CreationDate="2021-02-23T13:16:24.720" Score="2" Body="&lt;p&gt;Welcome to the quantum computing stack exchange, Grover's algorithm is defined for an infinite number of qubits. You need &lt;span class=&quot;math-container&quot;&gt;$n \approx \log_2 (N)$&lt;/span&gt; qubits where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of items searched, so the number of qubits needed depends on the number of items changed. Pay attention you need to round up.&lt;/p&gt;&#xA;&lt;p&gt;The problem is, a physical quantum computer needs to have a property called &lt;strong&gt;connectivity&lt;/strong&gt;. Connectivity is the ability for qubits to have a link and therefor be in &lt;strong&gt;superposition&lt;/strong&gt; (comment if you need help with the terminology). Since all the qubits used for searching with Grover's Algorithm have to be in a superposition, you need &lt;strong&gt;the maximum connectivity to be able to perform the algorithm&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I am in no means an expert on the subject, but I think the higher the connectivity, the harder it is to keep the state &lt;strong&gt;coherent&lt;/strong&gt; (this means making sure that no noisy errors happen). Therefor, the algorithm may not be performed on larger quantum computers (with &lt;span class=&quot;math-container&quot;&gt;$\approx$&lt;/span&gt;30 qubits), since they do not have the &lt;strong&gt;required&lt;/strong&gt; connectivity.&lt;/p&gt;&#xA;&lt;p&gt;However, I know there exist quantum computers with 15 qubits and maximum connectivity, though maybe they have other technical restrictions. I am pretty sure that Grover's Algorithm was executed on a larger number of qubits, so I would consider doing a bit more research. In any case, you can always &lt;strong&gt;simulate&lt;/strong&gt; the program on your own computer like languages like &lt;a href=&quot;https://quantumai.google&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq&lt;/a&gt;, &lt;a href=&quot;https://qiskit.org&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit&lt;/a&gt; and &lt;a href=&quot;https://docs.microsoft.com/en-us/azure/quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Q#&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you have any other questions, please ask !&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2021-02-23T13:16:24.720" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16186" PostTypeId="1" CreationDate="2021-02-23T14:03:38.620" Score="2" ViewCount="129" Body="&lt;p&gt;So I know that in QAOA we have the two hamiltonians. Mixer and Cost Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;Lets start:&#xA;First we have our Qubits which get in the Superposition if we add the Hadamard Gate.&#xA;Then we have the both hamiltonians. Which are rotate one or all qubits. After that we are measure it and optimize the angles beta and gamma in the classical way and this process is going iterative.&lt;/p&gt;&#xA;&lt;p&gt;That is a little bit clear for me.&lt;/p&gt;&#xA;&lt;p&gt;BUT:&#xA;What exactly is happening in the superposition that we have a benchmark where we know that our qubit on the Bloch Sphere is finding the global minimum. Because in the classical optimization for example gradient descent that depends from the gradient if it is good.&lt;/p&gt;&#xA;&lt;p&gt;I hope that the question is clear &lt;/p&gt;&#xA;" OwnerUserId="12711" LastEditorUserId="55" LastEditDate="2021-02-24T10:34:02.660" LastActivityDate="2021-03-09T16:25:32.000" Title="What exactly happening in QAOA in a general way?" Tags="&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16187" PostTypeId="2" ParentId="16069" CreationDate="2021-02-23T16:06:34.810" Score="1" Body="&lt;p&gt;Lena's answer doesn't work as we've noted in the comments underneath: the &lt;code&gt;stable_set.get_operator()&lt;/code&gt; takes in a numpy adjacency matrix which is not what I'm inputting.&lt;/p&gt;&#xA;&lt;p&gt;Instead I've written a function which takes the &lt;code&gt;qubo_array&lt;/code&gt; I've got and creates a QuadracticProgram exactly.&lt;/p&gt;&#xA;&lt;p&gt;To do the particular program I was after manually is done as so:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;&#xA;&#xA;mdl = Model('docplex model')&#xA;&#xA;x_0 = mdl.binary_var('x_0')&#xA;x_1 = mdl.binary_var('x_1')&#xA;x_2= mdl.binary_var('x_2')&#xA;&#xA;mdl.minimize( -x_0 - x_1  - x_2 + 2*x_0*x_1 + 2*x_2*x_1)&#xA;&#xA;&#xA;print(mdl.export_as_lp_string())&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The way I figured to do this for larger matrices automatically was the use of this function.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def the_auto_doco_mod(qubo_array,model_name,constant):&#xA;&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    Function that takes the   QUBO array created for a graphing problem and converts it to a docplex model&#xA;    ready for qiskit&#xA;&#xA;    Directly consrtructs the quadractic program with reference to this page&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    number_of_variables = len(qubo_array[1]) # gets the number of variables from the length of the square qubo matrix&#xA;    #mdl = Model('model_name')&#xA;    mod = QuadraticProgram()&#xA;&#xA;    for variable in range(0,number_of_variables): # creates the binary variables from the size of the matrix &#xA;        var_name = &amp;quot;x_&amp;quot; +str(variable)&#xA;        mod.binary_var(name =var_name)&#xA;&#xA;    mod.minimize(constant = 2,quadratic =qubo_array)  # can put in all constraints as quadractic as the binary variables mean that x_0 ^ 2 = x_0 in both cases &#xA;                                                    #  not sure of the impact of this on performance however &#xA;&#xA;    print(mod.export_as_lp_string())&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Does anyone know whether constructing the QuadracticProgram this way will mean that the ising model taken in by qiskit will evaluate slower or  be affected in any other way?&lt;/p&gt;&#xA;" OwnerUserId="14866" LastActivityDate="2021-02-23T16:06:34.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16189" PostTypeId="1" AcceptedAnswerId="16191" CreationDate="2021-02-23T20:00:32.003" Score="0" ViewCount="48" Body="&lt;p&gt;In section 2.3 of the Qiskit textbook (Phase Kickback), there's an example where a controlled-T gate is applied to &lt;span class=&quot;math-container&quot;&gt;$|1+\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You're asked to attempt the same thing with &lt;span class=&quot;math-container&quot;&gt;$|0+\rangle$&lt;/span&gt;.  I've done this by means of statevectors and successfully got the correct answer (that it has no effect):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{Controlled-T}|0+\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{\frac{i\pi}{4}}&#xA;\end{pmatrix}\times\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}1\\1\\0\\0\\\end{pmatrix}&#xA;= \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\\0\\0\\\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The textbook's example (using &lt;span class=&quot;math-container&quot;&gt;$|1+\rangle$&lt;/span&gt;) performs the calculation in Dirac representation - i.e. by factoring out the individual qubits.  I decided to try the same thing with the above.  Here's what I got:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0+\rangle = |0\rangle \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Controlled-T}|0+\rangle =\frac{1}{\sqrt{2}}(|00\rangle + e^{\frac{i\pi}{4}}|01\rangle)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$=|0\rangle \otimes\frac{1}{\sqrt{2}}(|0\rangle + e^{\frac{i\pi}{4}}|1\rangle)$$&lt;/span&gt;&#xA;When I then multiply that out to get the statevector, I get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt(2)}\begin{pmatrix}1\\e^{\frac{i\pi}{4}}\\0\\0\\\end{pmatrix}$$&lt;/span&gt;&#xA;which is clearly different.&#xA;What am I doing wrong with the algebraic approach?&lt;/p&gt;&#xA;" OwnerUserId="14827" LastActivityDate="2021-02-23T20:49:59.510" Title="Phase Kickback - factoring Dirac representation" Tags="&lt;qiskit&gt;&lt;textbook-and-exercises&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16190" PostTypeId="2" ParentId="16189" CreationDate="2021-02-23T20:25:05.143" Score="2" Body="&lt;p&gt;Controlled-T gate has no effect on the &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; state (the control qubit is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state), rather than add a phase to it.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-02-23T20:25:05.143" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16191" PostTypeId="2" ParentId="16189" CreationDate="2021-02-23T20:49:59.510" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textrm{Controlled-T} = |0\rangle\langle 0| \otimes I + |1\rangle\langle1| \otimes T$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, if you apply this to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = |0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg)$&lt;/span&gt; you have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\textrm{Controlled-T} |\psi\rangle &amp;amp;= \bigg[|0\rangle\langle 0| \otimes I + |1\rangle\langle1| \otimes T \bigg] |0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg) \\&#xA;&amp;amp;= \bigg[ |0\rangle\langle 0| \otimes I \bigg]|0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg)  + \bigg[  |1\rangle\langle1| \otimes T \bigg]|0\rangle  \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg)  \\&#xA;&amp;amp;=   |0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg) + 0 = |\psi\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus nothing changed.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-23T20:49:59.510" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16192" PostTypeId="1" AcceptedAnswerId="16194" CreationDate="2021-02-24T02:45:38.417" Score="2" ViewCount="50" Body="&lt;p&gt;While I'm studying about Qubit allocation (mapping), I wonder what the differences between SWAP and Bridge gates are. I know that a SWAP gate and Bridge gate can be represented with 3 CNOT gates and 4 CNOT gates respectively. Changing the qubit location of the hardware topology using SWAP is visually visible. However, Bridge gate case, I couldn't.&lt;/p&gt;&#xA;&lt;p&gt;Here is my Questions&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;What is the difference between SWAP gate and Bridge gate&lt;/li&gt;&#xA;&lt;li&gt;Is there any gates that can change physical qubit location of hardware topology except SWAP and Bridge gates?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="55" LastEditDate="2021-02-24T09:50:39.343" LastActivityDate="2021-02-24T09:50:39.343" Title="What is the difference between SWAP &amp; Bridge gates?" Tags="&lt;quantum-gate&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16193" PostTypeId="1" CreationDate="2021-02-24T03:24:48.417" Score="1" ViewCount="70" Body="&lt;p&gt;I have some doubts on the calculations behind Bell's experiment, which goes as follows: a pair of entangled photons is shared between two scientists, Alice and Bob, who possess a bunch of polarizers at &lt;span class=&quot;math-container&quot;&gt;$0°, 22.5°$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$45^°$&lt;/span&gt; with respect to some fixed vertical direction. In particular let us assume that Alice and Bob set up the following combinations of polarizers before measuring their qubit &lt;strong&gt;simultaneously&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Alice uses the one at &lt;span class=&quot;math-container&quot;&gt;$0°$&lt;/span&gt;, Bob uses the one at &lt;span class=&quot;math-container&quot;&gt;$90°$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;Alice uses the one at &lt;span class=&quot;math-container&quot;&gt;$0°$&lt;/span&gt;, Bob uses the one at &lt;span class=&quot;math-container&quot;&gt;$45°$&lt;/span&gt;;&lt;/li&gt;&#xA;&lt;li&gt;Alice uses the one at &lt;span class=&quot;math-container&quot;&gt;$45^°$&lt;/span&gt;. Bob uses the one at &lt;span class=&quot;math-container&quot;&gt;$90^°$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;(I will be using the convention to halve the angles when performing an actual rotation, so, for example, &lt;span class=&quot;math-container&quot;&gt;$45^°$&lt;/span&gt; corresponds to a rotation by &lt;span class=&quot;math-container&quot;&gt;$22.5^°$&lt;/span&gt;). Assume the EPR state that describes the two photons is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;      |\psi\rangle=\frac{1}{\sqrt 2}(|\updownarrow\updownarrow\rangle+|\leftrightarrow\leftrightarrow\rangle)&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so that they both have the same polarization, though unknown a priori. In the first setup of the experiment, the global state before the measurement becomes (in the vertical/horizontal basis)&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(\mathbb{I}_A\otimes R_B(90^°))|\psi\rangle&amp;amp;=\frac{1}{\sqrt 2}\left(|\updownarrow\rangle\otimes \frac{1}{\sqrt 2}(|\updownarrow\rangle-|\leftrightarrow\rangle)+|\leftrightarrow\rangle\otimes\frac{1}{\sqrt 2}(|\updownarrow\rangle+|\leftrightarrow\rangle) \right) \\ &amp;amp;= \frac{1}{2}(|\updownarrow\updownarrow\rangle-|\updownarrow\leftrightarrow\rangle+|\leftrightarrow\updownarrow\rangle+|\leftrightarrow\leftrightarrow\rangle).&#xA;\end{align}&lt;/span&gt;&#xA;What is the probability for the photons to go through one and only one of the two polarizers? Only the first and the last term contribute, as since both photons are polarized vertically or horizontally, they either go through one or the other, for a total probability of &lt;span class=&quot;math-container&quot;&gt;$50\%$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A similar calculation shows&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;(\mathbb{I}_A\otimes R_B(45^°))|\psi\rangle= \frac{1}{\sqrt 2}(\cos 22.5^°|\updownarrow\updownarrow\rangle-\sin 22.5^°|\updownarrow\leftrightarrow\rangle+\sin 22.5^°|\leftrightarrow\updownarrow\rangle+\cos 22.5^°|\leftrightarrow\leftrightarrow\rangle).&#xA;\end{align}&lt;/span&gt;&#xA;Again, if the polarization are the same, then they go through either one or the other but not both: therefore &lt;span class=&quot;math-container&quot;&gt;$$ p=\frac{1}{2}\cos^2 22.5^°+\frac{1}{2}\cos^2 22.5^°\approx 85\%.$$&lt;/span&gt;&#xA;I fear that here my reasoning in not correct... in fact, I was expecting to get the complementary &lt;span class=&quot;math-container&quot;&gt;$15\%$&lt;/span&gt;! Where does it go wrong?&lt;/p&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="55" LastEditDate="2021-02-24T09:53:48.470" LastActivityDate="2021-03-03T20:28:59.893" Title="Bell's experiment: checking the probabilities" Tags="&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;&lt;bell-experiment&gt;&lt;non-locality&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16194" PostTypeId="2" ParentId="16192" CreationDate="2021-02-24T04:03:30.113" Score="4" Body="&lt;p&gt;&lt;em&gt;Regarding to your first question:&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you said, the &lt;strong&gt;SWAP&lt;/strong&gt; gate can be decomposed into 3 CNOTs  as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RYncJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RYncJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the &lt;strong&gt;Bridge&lt;/strong&gt; gate &lt;a href=&quot;https://arxiv.org/pdf/1907.02686.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;can be decomposed into 4  CNOTs&lt;/a&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/LvAWO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LvAWO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;From the circuits above, we can see that the SWAP gate only involve 2 qubits. It &lt;em&gt;Swap&lt;/em&gt; them. Whereas the Bridge gate is to perform a CNOT gate between two &lt;em&gt;non-adjacent&lt;/em&gt; qubits with one qubit between them.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;But also note that:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tI7SC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tI7SC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is important because suppose your device have the following architecture:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ci6XL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ci6XL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which doesn't have qubit-0, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, connected to qubit 2, &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;, but you need to apply a CNOT gate between them in the middle of the circuit you are executing. Then, instead of naively using the SWAP gate to swap qubit 1,&lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, with qubit 2, &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;, then do a CNOT on &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, then apply another SWAP gate to swap qubit 1 and qubit 2 back to their original spot, we can just use the Bridge gate.&lt;/p&gt;&#xA;&lt;p&gt;And you can combine both gate together too. For instance, you want to execute a CNOT between qubit 0, and qubit 4. For the above hardware architecture, you can SWAP qubit 3 and qubit 4, perform Bridge gate, then SWAP qubit 3 and qubit 4 back again. That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iOcqs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iOcqs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-24T04:58:14.597" LastActivityDate="2021-02-24T04:58:14.597" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16195" PostTypeId="1" AcceptedAnswerId="16196" CreationDate="2021-02-24T06:09:31.110" Score="3" ViewCount="159" Body="&lt;p&gt;Can anyone refer me to a good video resource for quantum computing? I found this post helpful &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2667/currently-what-are-the-best-structured-courses-available-online-on-quantum-comp&quot;&gt;Currently, what are the best structured courses available online on quantum computing?&lt;/a&gt;, but Vazirani's youtube course has many videos deleted.&lt;/p&gt;&#xA;" OwnerUserId="14931" LastEditorUserId="55" LastEditDate="2021-02-24T09:54:16.317" LastActivityDate="2021-02-27T20:33:32.810" Title="What is a good video resource for quantum computing?" Tags="&lt;resource-request&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16196" PostTypeId="2" ParentId="16195" CreationDate="2021-02-24T08:13:42.407" Score="2" Body="&lt;p&gt;Artur Ekert is in the process of posting video lectures from his course in Oxford....&#xA;&lt;a href=&quot;https://www.youtube.com/playlist?list=PLkespgaZN4gmu0nWNmfMflVRqw0VPkCGH&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/playlist?list=PLkespgaZN4gmu0nWNmfMflVRqw0VPkCGH&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-24T08:13:42.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16197" PostTypeId="1" CreationDate="2021-02-24T10:37:26.167" Score="2" ViewCount="45" Body="&lt;p&gt;I am trying to run a quantum circuit many times, each time using a different random state - a single qubit i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle= a|0\rangle + b|1\rangle$&lt;/span&gt; with different &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Once each qubit has gone through the circuit, I am saving the state vector of the final state, and converting this to spherical coordinates by calculating &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;. I append each &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; value to a list and then plot them on a histogram (omitted below).&lt;/p&gt;&#xA;&lt;p&gt;Whilst this works, for large &lt;code&gt;num_states&lt;/code&gt; it is very slow, so I am wondering if there is a way to use the 'shots' feature when executing the circuit, since you can write:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(qc, backend, shots=1000)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I tried playing around with this but found after the initial random state was generated, it repeated the circuit with the same state for the number of shots, rather than doing a different state each time. I'd like to use the shots feature as I believe this will be much quicker since OpenMP is built into Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas on how I might be able to implement a different state each time using shots would be much appreciated:)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import(&#xA;    QuantumCircuit,&#xA;    execute,&#xA;    Aer)&#xA;&#xA;from math import pi&#xA;&#xA;from qiskit.quantum_info import random_statevector&#xA;&#xA;&#xA;#----------------------------------------------------------------------#&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;&#xA;def simulate_states(num_states):&#xA;    qc = QuantumCircuit(1)&#xA;&#xA;    theta_vals = []&#xA;    phi_vals = []&#xA;    &#xA;    for i in range(num_states):&#xA;        &#xA;        random_state = random_statevector(2).data&#xA;        &#xA;        qc.initialize(random_state, 0)&#xA;        qc.z(0)&#xA;        job = execute(qc, backend)&#xA;        result = job.result()&#xA;        out_state = result.get_statevector()&#xA;    &#xA;        theta, phi, alpha_r, alpha_i, beta_r, beta_i = state_coords(out_state)&#xA;        theta += pi/2&#xA;        &#xA;        theta_vals.append(theta)&#xA;        phi_vals.append(phi)&#xA;        &#xA;    return theta_vals, phi_vals&#xA;&#xA;def state_coords(statevector):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    determines the spherical coordinates of a state on the Bloch sphere i.e. calculates \theta and \phi.&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    alpha = statevector[0]&#xA;    alpha_r = alpha.real&#xA;    alpha_i = alpha.imag&#xA;&#xA;    beta = statevector[1]&#xA;    beta_r = beta.real&#xA;    beta_i = beta.imag&#xA;&#xA;    theta = np.arcsin(2*((alpha_r*beta_r) - (alpha_i*beta_i)))&#xA;    phi = 2*np.arccos(2*((alpha_r**2)+(beta_r**2))-1)   &#xA;    &#xA;    return theta, phi, alpha_r, alpha_i, beta_r, beta_i&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14981" LastEditorUserId="9006" LastEditDate="2021-02-25T08:17:41.670" LastActivityDate="2021-02-25T08:17:41.670" Title="Qiskit: how can you use a different state for each shot in a quantum circuit?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-02-25T08:17:52.787" ContentLicense="CC BY-SA 4.0" />
  <row Id="16198" PostTypeId="2" ParentId="15890" CreationDate="2021-02-24T12:26:58.713" Score="5" Body="&lt;p&gt;I want to emphasize that you are wasting your time with this historical stuff. But since you insist I'll answer anyway.&lt;/p&gt;&#xA;&lt;p&gt;First of all, note that the inequality&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\left|\int d\lambda p(\lambda)(1-A(\vec a', \lambda)B(\vec b',\lambda))\right|+  \left|\int d\lambda p(\lambda)(1-A(\vec a', \lambda)B(\vec b,\lambda))\right| \\ \le 2-| E(\vec a',\vec b')+ E(\vec a',\vec b)|&#xA;\end{equation}&lt;/span&gt;&#xA;doesn't hold (even after correcting the extra prime on the left hand side). The left hand side can reach 4, but the right hand side is at most 2.&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, the inequality&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b')\le 2-| E(\vec a',\vec b')+ E(\vec a',\vec b)|&#xA;\end{equation}&lt;/span&gt;&#xA;does hold, so we can prove that instead.&lt;/p&gt;&#xA;&lt;p&gt;First we use the identity&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b')=\int d\lambda p(\lambda) A(\vec a,\lambda)B(\vec b,\lambda)\big[1-A(\vec a',\lambda)B(\vec b',\lambda)\big]-\int d\lambda p(\lambda) A(\vec a,\lambda)B(\vec b',\lambda)\big[1-A(\vec a',\lambda)B(\vec b,\lambda)\big]&#xA;\end{equation}&lt;/span&gt;&#xA;Now since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \big[1-A(\vec a',\lambda)B(\vec b',\lambda)\big] \ge 0 \quad\text{and}\quad A(\vec a,\lambda)B(\vec b,\lambda) \le 1 $$&lt;/span&gt;&#xA;we have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \int d\lambda p(\lambda) A(\vec a,\lambda)B(\vec b,\lambda)\big[1-A(\vec a',\lambda)B(\vec b',\lambda)\big] \le \int d\lambda p(\lambda) \big[1-A(\vec a',\lambda)B(\vec b',\lambda)\big].$$&lt;/span&gt;&#xA;For the second term, note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \big[1-A(\vec a',\lambda)B(\vec b,\lambda)\big] \ge 0 \quad\text{and}\quad -A(\vec a,\lambda)B(\vec b',\lambda) \le 1, $$&lt;/span&gt;&#xA;so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$-\int d\lambda p(\lambda) A(\vec a,\lambda)B(\vec b',\lambda)\big[1-A(\vec a',\lambda)B(\vec b,\lambda)\big] \le \int d\lambda p(\lambda) \big[1-A(\vec a',\lambda)B(\vec b,\lambda)\big].$$&lt;/span&gt;&#xA;Putting it all together, we get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b') &amp;amp;\le \int d\lambda p(\lambda)\big[1-A(\vec a',\lambda)B(\vec b',\lambda)\big] + \int d\lambda p(\lambda) \big[1-A(\vec a',\lambda)B(\vec b,\lambda)\big] \\&#xA;&amp;amp;= 2 - E(\vec a',\vec b') - E(\vec a',\vec b)&#xA;\end{align}&lt;/span&gt;&#xA;Now, repeat the same argument, but starting instead with the identity&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b')=\int d\lambda p(\lambda) A(\vec a,\lambda)B(\vec b,\lambda)\big[1+A(\vec a',\lambda)B(\vec b',\lambda)\big]-\int d\lambda p(\lambda) A(\vec a,\lambda)B(\vec b',\lambda)\big[1+A(\vec a',\lambda)B(\vec b,\lambda)\big].&#xA;\end{equation}&lt;/span&gt;&#xA;You'll see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ E(\vec a,\vec b)-E(\vec a, \vec b') \le 2 + E(\vec a',\vec b') + E(\vec a',\vec b). $$&lt;/span&gt;&#xA;Together with the previous inequality, it implies that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; E(\vec a,\vec b)-E(\vec a, \vec b')\le 2-| E(\vec a',\vec b')+ E(\vec a',\vec b)|.&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12541" LastEditorUserId="12541" LastEditDate="2021-02-24T15:57:50.640" LastActivityDate="2021-02-24T15:57:50.640" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16199" PostTypeId="2" ParentId="16197" CreationDate="2021-02-24T16:10:45.973" Score="0" Body="&lt;p&gt;The initial state in a quantum computer is fixed. It is usually taken to the the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n} $&lt;/span&gt;. To vary a single qubit state during the experiment, you must therefore vary the circuit during the experiment, and you &lt;strong&gt;can't&lt;/strong&gt; vary the circuit between each shot. However, if you wish to do what you proposed, you can create a list of circuits and each of them has vary quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, then append them together to a list and submit it as a single job.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import random_state&#xA;from qiskit.aqua.components.initial_states import Custom&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.tools.monitor import job_monitor&#xA;provider = IBMQ.load_account()&#xA;&#xA;num_qubits = 1&#xA;random_initial_state = random_state(2**num_qubits)  #create a random state psi&#xA;circuits = []&#xA;for i in range(100):&#xA;    circuit = QuantumCircuit(num_qubits,num_qubits)&#xA;    circuit.initialize(random_initial_state, 0)     &#xA;    for j in range(num_qubits):&#xA;        circuit.measure([j],[j])&#xA;    circuits.append(circuit) &#xA;&#xA;qjob = execute(circuits,shots= 1,backend= Aer.get_backend('qasm_simulator'))&#xA;job_monitor(qjob)&#xA;result = qjob.result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I believe that on the hardware, you can submit up to 900 circuits per job. So you can have up to 900 different states.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-24T16:24:56.760" LastActivityDate="2021-02-24T16:24:56.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16200" PostTypeId="1" CreationDate="2021-02-24T17:32:39.050" Score="1" ViewCount="58" Body="&lt;p&gt;I am trying to calculate the spherical coordinates of different qubit states (i.e. working out &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; from: &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = e^{-i\phi/2}\cos(\theta/2)|0\rangle + e^{i\phi/2}\sin(\theta/2)|1\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;At the moment I am using the below function although I don't think it's working properly since it breaks when theta is close to zero in this line:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;        phi = np.arccos((1/np.sin(theta/2))*((alpha_r*beta_r) + (alpha_i*beta_i)))&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is there a quick way to get the spherical coordinates for a state where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is 0 to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is 0 to &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;? I figure this must be built into Qiskit since when you do &lt;code&gt;plot_bloch_multivector()&lt;/code&gt; it converts a state to a vector on a Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas would be much appreciated:)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def state_coords(statevector):&#xA;&#xA;    alpha = statevector[0]&#xA;    alpha_r = alpha.real&#xA;    alpha_i = alpha.imag&#xA;&#xA;    beta = statevector[1]&#xA;    beta_r = beta.real&#xA;    beta_i = beta.imag&#xA;&#xA;    theta = np.arccos((alpha_r**2)-(alpha_i**2))&#xA;    &#xA;    if theta==0:&#xA;        phi=0&#xA;    else:&#xA;        phi = np.arccos((1/np.sin(theta/2))*((alpha_r*beta_r) + (alpha_i*beta_i)))&#xA;        &#xA;    if ((alpha_r*beta_i) - (alpha_i*beta_r)) &amp;lt; 0:&#xA;        phi += pi&#xA;    &#xA;    return theta, phi, alpha_r, alpha_i, beta_r, beta_i&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14981" LastEditorUserId="9006" LastEditDate="2021-02-25T08:22:50.020" LastActivityDate="2021-04-11T07:05:21.067" Title="Qiskit: is there a quick way to work out the spherical coordinates for a given qubit statevector?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16202" PostTypeId="1" AcceptedAnswerId="16213" CreationDate="2021-02-24T18:42:57.817" Score="2" ViewCount="73" Body="&lt;p&gt;Consider the standard quantum state discrimination setup: Alice sends Bob either &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;. She picks &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; with probabilities &lt;span class=&quot;math-container&quot;&gt;$\lambda_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt;, respectively. Bob performs some two-outcome measurement &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; on the state he receives and has to decide whether Alice sent &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt;.&#xA;We assume Bob knows the possible states &lt;span class=&quot;math-container&quot;&gt;$\rho_0,\rho_1$&lt;/span&gt;, as well as the probabilities &lt;span class=&quot;math-container&quot;&gt;$\lambda_0,\lambda_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Denote with &lt;span class=&quot;math-container&quot;&gt;$p_i(b)\equiv p_i^\mu(b)\equiv \langle \mu(b),\rho_i\rangle\equiv \mathrm{Tr}(\mu(b)\rho_i)$&lt;/span&gt; the probability of Bob observing the outcome &lt;span class=&quot;math-container&quot;&gt;$b\in\{0,1\}$&lt;/span&gt; when the state he received is &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt;.&#xA;If Bob measures the outcome &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, his best guess is that he received the &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; maximising &lt;span class=&quot;math-container&quot;&gt;$\lambda_i p_i(b)$&lt;/span&gt;.&#xA;This follows from simple Bayesian considerations, fully analogous to the classical state discrimination scenario discussed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/15970/55&quot;&gt;in this other question&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, when Bob finds the outcome &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, the probability of his guess being correct is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{\rm correct}(b) = \frac{\max_i \lambda_i p_i(b)}{p(b)} = \frac{\max_i \lambda_i p_i(b)}{\sum_i \lambda_i p_i(b)}.$$&lt;/span&gt;&#xA;The overall success probability, estimated before knowing the measurement outcome, is therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{\rm correct} = \sum_b p(b) p_{\rm correct}(b) = \sum_b \max_i \lambda_i p_i(b).\tag X$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is all nice and well. However, the success probability for this type of scenario is usually given (&lt;em&gt;e.g.&lt;/em&gt; in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' TQI&lt;/a&gt;, section &lt;em&gt;3.1&lt;/em&gt;) as the expression:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{\rm correct}'=\sum_{i\in\{0,1\}} \lambda_i p_i(i).\tag Y$$&lt;/span&gt;&#xA;This expression is intuitively clear: if Bob receives &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt;, which happens with probability &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt;, then he correctly guesses that the state was &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i(i)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Nonetheless, I wonder: are (X) and (Y) always equivalent?&#xA;I suppose that if we assume that the best guess changes with the observed outcome (&lt;em&gt;e.g.&lt;/em&gt; if Bob finds &lt;span class=&quot;math-container&quot;&gt;$b=0$&lt;/span&gt; then his best guess is &lt;span class=&quot;math-container&quot;&gt;$i=0$&lt;/span&gt;, and if he finds &lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt; his best guess is &lt;span class=&quot;math-container&quot;&gt;$i=1$&lt;/span&gt;), then (X) and (Y) are equivalent up to a relabeling of the POVM.&#xA;But can we always assume this? Isn't it possible that there are scenarios in which, regardless of the observed outcome, Bob's best guess should always be the same?&lt;/p&gt;&#xA;&lt;p&gt;Admittedly, this sounds like a weird scenario, but I can't tell whether it can be ruled out altogether (well except in the trivial case in which &lt;span class=&quot;math-container&quot;&gt;$\rho_0=\rho_1$&lt;/span&gt;). It amounts to asking whether&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\underbrace{\lambda_0 p_0(0)&amp;gt;\lambda_1 p_1(0)}_{\text{measuring $0$ best guess is $\rho_0$}} \Longrightarrow&#xA;\underbrace{\lambda_0 p_0(1) &amp;lt; \lambda_1 p_1(1)}_{\text{measuring $1$ best guess is $\rho_1$}}.$$&lt;/span&gt;&#xA;Because &lt;span class=&quot;math-container&quot;&gt;$p_i(0)+p_i(1)=0$&lt;/span&gt;, this is true for &lt;span class=&quot;math-container&quot;&gt;$\lambda_0=\lambda_1$&lt;/span&gt;, but I'm not sure it holds for the general case.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-25T11:36:18.137" Title="Is the quantum state discrimination success probability always $\lambda_0\langle\mu(0),\rho_0\rangle+\lambda_1\langle\mu(1),\rho_1\rangle$?" Tags="&lt;information-theory&gt;&lt;state-discrimination&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16203" PostTypeId="1" AcceptedAnswerId="16204" CreationDate="2021-02-24T22:38:17.297" Score="2" ViewCount="84" Body="&lt;p&gt;I am reading this book “Quantum Computing Explained” by David McMahon. I found the following statement on page 74&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Note that the order of the tensor product is not relevant, meaning&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle \otimes |\chi\rangle = |\chi\rangle \otimes&#xA; |\phi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/RDs4f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RDs4f.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I found it surprising to face this in a quantum computing book, because this is not true. Have any of you read the book or have any idea how it could be true? (Though as I said, I don’t think it is true).&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-25T09:42:27.617" LastActivityDate="2021-02-25T09:42:27.617" Title="Is the order of the tensor product in $|\phi\rangle\otimes|\chi\rangle=|\chi\rangle\otimes|\phi\rangle$ relevant?" Tags="&lt;textbook-and-exercises&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2021-02-25T16:07:19.553" ContentLicense="CC BY-SA 4.0" />
  <row Id="16204" PostTypeId="2" ParentId="16203" CreationDate="2021-02-24T23:33:44.400" Score="3" Body="&lt;p&gt;You are right. The statement is wrong. &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#The_definition_of_the_abstract_tensor_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Tensor product&lt;/a&gt; is &lt;em&gt;not&lt;/em&gt; commutative. In fact,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi\rangle\otimes|\chi\rangle \ne |\chi\rangle\otimes|\phi\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;unless &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = c|\chi\rangle$&lt;/span&gt; for some scalar &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and so the order of the factors certainly &lt;em&gt;is relevant&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, if the first and second systems are associated with different Hilbert spaces then one of the expressions may fail to denote a valid state. For example, if the first system is a qubit and the second system is a qutrit then &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\otimes|2\rangle$&lt;/span&gt; is a valid state, but &lt;span class=&quot;math-container&quot;&gt;$|2\rangle\otimes|1\rangle$&lt;/span&gt; is not.&lt;/p&gt;&#xA;&lt;p&gt;I suppose what the author might have in mind is that the order is &lt;em&gt;arbitrary&lt;/em&gt;. In other words, when describing two systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; we can &lt;em&gt;choose&lt;/em&gt; to write the state of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; first and the state of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; second or we can choose the opposite order. Once we have chosen the order we must stick to it. In particular, changing the order in the middle of calculations or in an expression such as &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\otimes|\chi\rangle =|\chi\rangle\otimes|\phi\rangle$&lt;/span&gt; is an error.&lt;/p&gt;&#xA;&lt;p&gt;Mathematically, the arbitrariness of the choice above reflects the fact that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes\mathcal{H}_B$&lt;/span&gt; is isomorphic to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B\otimes\mathcal{H}_A$&lt;/span&gt; for any two vector spaces &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that sometimes people use subscripts rather than position to indicate subsystems as in &lt;span class=&quot;math-container&quot;&gt;$|\phi_A\chi_B\rangle$&lt;/span&gt;. In this case, changing the order is not strictly speaking an error, but even then it can surprise and mislead the reader. In any case, the author is not using subscript labels.&lt;/p&gt;&#xA;&lt;p&gt;Another way this could be true is if the author was talking about the &lt;a href=&quot;https://en.wikipedia.org/wiki/Symmetric_tensor#Symmetric_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;symmetric tensor product&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\odot$&lt;/span&gt; which does have the property that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\phi\odot\chi = \chi\odot\phi&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all &lt;span class=&quot;math-container&quot;&gt;$\phi, \chi$&lt;/span&gt; in some vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;. Again, this does not appear to be the case since the author uses standard tensor product symbol &lt;span class=&quot;math-container&quot;&gt;$\otimes$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$\odot$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-25T03:58:52.567" LastActivityDate="2021-02-25T03:58:52.567" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16205" PostTypeId="1" AcceptedAnswerId="16206" CreationDate="2021-02-25T01:41:12.373" Score="3" ViewCount="108" Body="&lt;p&gt;When a gate is sandwiched (or conjugated) by two CNOT gates, what effect does it have on the gate being sandwiched? For example, in the figure below, it is clear what effect the controlled &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt; has. The question is how the CNOT gates modify the behaviour of the controlled &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pql0Q.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pql0Q.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13901" LastEditorUserId="55" LastEditDate="2021-02-25T09:50:31.043" LastActivityDate="2021-02-25T09:50:31.043" Title="What is the action of sandwiching an operator with two CNOT gates?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16206" PostTypeId="2" ParentId="16205" CreationDate="2021-02-25T01:57:28.900" Score="3" Body="&lt;p&gt;Controlled-&lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; with second qubit as control acts as identity on &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|00\rangle, |10\rangle)$&lt;/span&gt; and as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_y(\theta) = \begin{pmatrix}&#xA;\cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\&#xA;\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;on &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(|01\rangle, |11\rangle)$&lt;/span&gt;. Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CR_y(\theta) = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \cos\frac{\theta}{2} &amp;amp; 0 &amp;amp; -\sin\frac{\theta}{2} \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; \sin\frac{\theta}{2} &amp;amp; 0 &amp;amp; \cos\frac{\theta}{2}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;CNOT with the first qubit as control acts as the permutation matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT} = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which swaps &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;. Consequently, the circuit in the question acts as &lt;span class=&quot;math-container&quot;&gt;$CR_y(\theta)$&lt;/span&gt; with the last two rows swapped and the last two columns swapped&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; \cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} &amp;amp; 0  \\&#xA;0 &amp;amp; \sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2} &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The reasoning above applies to any single qubit gate in place of &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-25T01:57:28.900" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16207" PostTypeId="1" AcceptedAnswerId="16210" CreationDate="2021-02-25T01:58:51.997" Score="2" ViewCount="53" Body="&lt;p&gt;I was trying to derive the formula for &lt;span class=&quot;math-container&quot;&gt;$p(m)$&lt;/span&gt; in exercise 8.2 on page  357 in Nielsen &amp;amp; Chuang. But I am wondering what rule I can apply to simplify this&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}(\mathcal{E}_m(\rho) )= \sum_n \langle n | M_m \rho   M_m^{\dagger} | n\rangle = \sum_n \langle n | M_m | \psi\rangle &#xA;\langle \psi | M_m^{\dagger} | n\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|M_m^{\dagger}M_m|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Because after this I can’t find any idea to boil down to this.&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="55" LastEditDate="2021-02-25T09:47:29.210" LastActivityDate="2021-02-25T09:47:29.210" Title="Why does $\sum_n \langle n|M_m\rho M_m^\dagger|n\rangle$ simplify to $\langle \psi|M_m^\dagger M_m|\psi\rangle$?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16208" PostTypeId="1" AcceptedAnswerId="16209" CreationDate="2021-02-25T02:22:54.787" Score="3" ViewCount="184" Body="&lt;p&gt;Qiskit has a CRy gate, however I couldn't find a CCRy (double control Ry) gate implementation. How can we construct the CCRy circuit given below in Qiskit without any ancillary qubits?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nUDH2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nUDH2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt;&#xA;A quick note on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15478/13901&quot;&gt;another solution&lt;/a&gt;, when using the mcry gate to perform control-control y-rotation. I had been initializing quantum circuits via:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;&#xA;circ = QuantumCircuit(4, 4)&#xA;circ.mcry(q_controls=[0, 1], q_target=2, q_ancillae=None) # Gives error saying q_target needs to be a qubit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As shown in the linked solution, one needs to define quantum registers and pass those objects as parameters to the quantum circuit to avoid this issue. In general, this makes me wonder if the latter is a better practice than what I had been doing previously (shown above).&lt;/p&gt;&#xA;" OwnerUserId="13901" LastEditorUserId="13901" LastEditDate="2021-02-25T14:29:34.143" LastActivityDate="2021-02-25T14:29:34.143" Title="How can we construct a control-control y-rotation (CCRy) gate in Qiskit?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16209" PostTypeId="2" ParentId="16208" CreationDate="2021-02-25T02:40:56.017" Score="5" Body="&lt;p&gt;There is no CCRy gate in the library but there is the multi-controlled multi-target gate (MCMT) class that you can use. Or, you could also do it as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit,QuantumRegister&#xA;from qiskit.circuit.library.standard_gates import RYGate&#xA;from qiskit.circuit import Parameter&#xA;import matplotlib.pyplot as plt&#xA;qr=QuantumRegister(3)&#xA;circ=QuantumCircuit(qr)&#xA;a=Parameter('a') # You can replace a with your choice of angle here&#xA;CCRY=RYGate(a).control(2)&#xA;circ.append(CCRY,qr)&#xA;print(circ)&#xA;&#xA;               &#xA;q0:   ────■────&#xA;          │    &#xA;q1:   ────■────&#xA;      ┌───┴───┐&#xA;q2:   ┤ RY(a) ├&#xA;      └───────┘&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-25T03:11:19.353" LastActivityDate="2021-02-25T03:11:19.353" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16210" PostTypeId="2" ParentId="16207" CreationDate="2021-02-25T02:46:52.453" Score="2" Body="&lt;p&gt;This is because:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_n \langle n | M_m | \psi\rangle &#xA;\langle \psi | M_m^{\dagger} | n\rangle =  \sum_n  \langle \psi | M_m^{\dagger} | n\rangle \langle n | M_m | \psi\rangle = \langle \psi | M_m^{\dagger} I M_m | \psi\rangle = \langle \psi | M_m^{\dagger}  M_m | \psi\rangle&#xA;  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;note that &lt;span class=&quot;math-container&quot;&gt;$\sum_n|n\rangle\langle n| = I $&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-25T02:46:52.453" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16211" PostTypeId="2" ParentId="16144" CreationDate="2021-02-25T07:39:35.207" Score="2" Body="&lt;p&gt;Yes, it is related, although you want to be careful. Strictly, &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is a function of time. This gives you the possibility to vary &lt;span class=&quot;math-container&quot;&gt;$\frac{ds}{dt}$&lt;/span&gt; based on the gap &lt;span class=&quot;math-container&quot;&gt;$\delta_s$&lt;/span&gt; between the ground and first excited states of &lt;span class=&quot;math-container&quot;&gt;$H_s$&lt;/span&gt;, and therefore control the accuracy of your adiabatic approximation. It's up to you how you pick it, but IIRC, it's nice to have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{ds}{dt}\sim\frac{1}{\delta_s}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, yes, &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is function of time. However, you can no longer think of the evolution as &lt;span class=&quot;math-container&quot;&gt;$e^{-iHt}$&lt;/span&gt; because that formula only applies if &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is independent of time, which &lt;span class=&quot;math-container&quot;&gt;$H_s$&lt;/span&gt; now isn't. Instead, you have to go back to the Schrödinger equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{d|\psi\rangle}{dt}=-iH_s|\psi\rangle&#xA;$$&lt;/span&gt;&#xA;and solve it. A reasonable approximation can be arrived at by thinking that &lt;span class=&quot;math-container&quot;&gt;$H_s$&lt;/span&gt; is approximately constant over a set of intervals &lt;span class=&quot;math-container&quot;&gt;$\delta t_i$&lt;/span&gt; so that you get a product&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\approx e^{-iH_{s_N}\delta t_N}\ldots e^{-iH_{s_2}\delta t_2} e^{-iH_{s_1}\delta t_1}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-02-25T07:39:35.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16213" PostTypeId="2" ParentId="16202" CreationDate="2021-02-25T11:36:18.137" Score="3" Body="&lt;p&gt;Yes. Expression (X) is in principle more general, but it boils down to doing classical post-processing of the outcomes, and this can always be included in the POVM. So as long as you do optimize over the POVM, expression (Y) is completely general.&lt;/p&gt;&#xA;&lt;p&gt;There are four possibilities:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda_0 p_0(0)&amp;gt;\lambda_1 p_1(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 p_1(1)&amp;gt;\lambda_0 p_0(1)$&lt;/span&gt;. Boring case, where no post-processing is needed, expressions are equivalent.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda_0 p_0(0)&amp;lt;\lambda_1 p_1(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 p_1(1)&amp;lt;\lambda_0 p_0(1)$&lt;/span&gt;. In this case you should always guess the opposite of your outcome. Just relabel your POVM elements, &lt;span class=&quot;math-container&quot;&gt;$\mu(0)$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$\mu(1)$&lt;/span&gt; and vice-versa.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda_0 p_0(0)&amp;gt;\lambda_1 p_1(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 p_1(1)&amp;lt;\lambda_0 p_0(1)$&lt;/span&gt;. In this case you should always guess 0, regardless of your outcome, so you assign &lt;span class=&quot;math-container&quot;&gt;$\mu(0) = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu(1) = 0$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\lambda_0 p_0(0)&amp;lt;\lambda_1 p_1(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 p_1(1)&amp;gt;\lambda_0 p_0(1)$&lt;/span&gt;. In this case you should always guess 1, regardless of your outcome, so you assign &lt;span class=&quot;math-container&quot;&gt;$\mu(0) = 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu(1) = I$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Possibilities 3 and 4 can indeed occur, so the implication you wrote down is false. Take for example &lt;span class=&quot;math-container&quot;&gt;$p_0(0) = p_1(1) = 3/4$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_0 = 1-10^{-5}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lambda_1 = 10^{-5}$&lt;/span&gt;. In this case you should always guess 1, regardless of your outcome (of course in reality you would just use a better POVM so that your measurement outcomes actually matter).&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-02-25T11:36:18.137" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="16215" PostTypeId="1" CreationDate="2021-02-25T13:10:50.837" Score="0" ViewCount="28" Body="&lt;p&gt;Does it exist a schematic diagram of the quantum circuit implementing the symmetric UQCM N--&amp;gt; M for unknown states? If yes, does anyone know a Qiskit implementation of it?&lt;/p&gt;&#xA;" OwnerUserId="14007" LastActivityDate="2021-03-29T12:04:25.523" Title="Symmetric Universal Quantum Cloning Machine (UQCM) N --&gt; M for unknown states" Tags="&lt;qiskit&gt;&lt;quantum-circuit&gt;&lt;cloning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16216" PostTypeId="1" AcceptedAnswerId="16223" CreationDate="2021-02-25T16:00:57.770" Score="1" ViewCount="35" Body="&lt;p&gt;I am trying to calculate the distance between sets of vectors. To do this I can create a SwapTest circuit (described &lt;a href=&quot;https://arxiv.org/pdf/1804.10068.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; on page 34) and encode a feature vector with a U3 gate, then apply H and CSWAP gates to calculate the overlap. When your feature vectors are length 3 this seems fairly easy, as this can be encoded entirely by one U3. Each U3 parameter will represent a feature. I've done this with vectors of length 2, and have used the overlap as a measure to decide which 2 vectors are &amp;quot;closest&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;However, what if we add a 4th or 5th or 10th feature? I imagine we could then also use a second qubit, encode the 5 features over two U3 gates. However, I have trouble seeing how to construct the rest of the circuit.&lt;/p&gt;&#xA;&lt;p&gt;If we take two states, A and B, each with 6 features we could split this over 2 U3 gates each. Do we perform the &amp;quot;normal&amp;quot; SwapTest on each half of each state. Ie, find the overlap of the upper half of A and the upper half of B, then do the same for the lower half? This seems reasonable, but how would I be able to combine this into 1 value I can use to compare to another set of vectors?&lt;/p&gt;&#xA;" OwnerUserId="12955" LastActivityDate="2021-02-26T07:46:16.457" Title="Implementing a SwapTest for samples with large numbers of features" Tags="&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16217" PostTypeId="1" CreationDate="2021-02-25T16:28:41.720" Score="5" ViewCount="101" Body="&lt;h3&gt;Background&lt;/h3&gt;&#xA;&lt;p&gt;I have been doing research on quantum computing on my own for over a year now and I feel like I may have missed a fundamental step. I have no idea how to take a mathematical algorithm and create an equivalent gate sequence for an actual Quantum Computer to follow. I would like to be able to read articles on quantum algorithms and be able to create circuits from them, but unless I can find an example of how the gates are set up I am stuck. Even more frustrating is when gates are shown but are just representations of subroutines instead of the basic gates (&lt;a href=&quot;https://arxiv.org/pdf/1903.05608.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; on page 5).&lt;/p&gt;&#xA;&lt;h3&gt;Grover's Algorithm Example&lt;/h3&gt;&#xA;&lt;p&gt;For example, I am pretty familiar with Grovers algorithm. For Grover's algorithm you perform the following steps (I'm borrowing from &lt;a href=&quot;https://en.wikipedia.org/wiki/Grover%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; a bit):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/NXhSY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NXhSY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Initialize all qubits to a &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right&amp;gt;$&lt;/span&gt; except for a specified qubit (the oracle qubit according to Wikipedia) you initialize to &lt;span class=&quot;math-container&quot;&gt;$\left| 1 \right&amp;gt;$&lt;/span&gt;; this will be the target of the Orcale.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Put all qubits, &lt;em&gt;except for ancilla bits&lt;/em&gt;, into a superposition using Hadamard gates. The mathematical algorithm says that this is equivalent to the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;${\displaystyle |s\rangle ={\frac {1}{\sqrt {N}}}\sum _{x=0}^{N-1}|x\rangle .}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I can kind of see how this would translate to Hadamard gates because&#xA;we have the &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; on the denomonator.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Next comes the trickiest part in my opinion, the Orcale. The oracle, a black box function (in my experience) can be created by formulating the problem as a SAT problem and then creating an equivalent quantum circuit that ultimately flips the &amp;quot;target bit.&amp;quot; The mathemitacal algorithm says this is equivelent to &lt;span class=&quot;math-container&quot;&gt;${\displaystyle |x\rangle |q\rangle \,{\overset {U_{\omega }}{\longrightarrow }}\,|x\rangle |q\oplus f(x)\rangle ,}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U_w$&lt;/span&gt; is the oracle and &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; is that subroutine as an operatior.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Again, this seems a little intuitive to me because I know the&#xA;&lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt; should &lt;strong&gt;XOR&lt;/strong&gt; the oracle qubit.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;Grover's diffusion operator is pretty darn confusing. Wikipedia defines this operator to be&#xA;&lt;span class=&quot;math-container&quot;&gt;${\displaystyle 2|s\rangle \langle s|-I}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;From experience I know this can be achieved by sandwiching a large&#xA;controlled Z, with target on last logical qubit that isn't the oracle&#xA;qubit, by H and X gates like so:&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CTdOX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CTdOX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I have no earthly idea how I would have figured that out from the&#xA;instructions &amp;quot;&lt;span class=&quot;math-container&quot;&gt;${\displaystyle 2|s\rangle \langle s|-I}$&lt;/span&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;Repeat steps 3 and 4 &lt;span class=&quot;math-container&quot;&gt;$O \sqrt{N}$&lt;/span&gt; times and then measure.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3&gt;Question&lt;/h3&gt;&#xA;&lt;p&gt;What are some general methods or practices for creating gate sequences from mathematical algorithms? Seeing as there are many ways to create equivalent gate sequences, I am assuming that performing this process is an art that takes practice and experience. That being said, where should I start? What advice can you give me?&lt;/p&gt;&#xA;" OwnerUserId="14999" LastEditorUserId="14999" LastEditDate="2021-02-25T19:11:13.260" LastActivityDate="2021-02-28T18:19:10.260" Title="What is the general method for creating real gate sequences from mathematical algorithms?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16218" PostTypeId="1" AcceptedAnswerId="16220" CreationDate="2021-02-25T20:40:18.923" Score="2" ViewCount="52" Body="&lt;p&gt;From the perspective of building quantum computation software based on Qiskit, which approach to defining quantum circuits is more robust?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister&#xA;&#xA;qr1 = QuantumRegister(3, 'qr1')&#xA;qr2 = QuantumRegister(4, 'qr2')&#xA;cr  = ClassicalRegister(4, 'cr')&#xA;circ = QuantumCircuit(qr1, qr2, cr)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;OR,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(7, 5)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So far I've been using the latter approach, but it seems like I might run into trouble later as the software matures and I add more functionalities. Any opinion from an experienced Quantum Computation Software Developer would be greatly appreciated!&lt;/p&gt;&#xA;" OwnerUserId="13901" LastActivityDate="2021-02-26T06:10:31.557" Title="Is it better to initialize quantum circuits in Qiskit by passing QuantumRegister and ClassicalRegister objects?" Tags="&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16219" PostTypeId="2" ParentId="16186" CreationDate="2021-02-25T21:12:05.343" Score="3" Body="&lt;p&gt;A precursor to the canonical QAOA is the &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0001106.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Adiabatic Algorithm&lt;/a&gt; (QAA). Since we want to end up in the ground state of the Cost Hamiltonian (&lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;) but don't know how to construct it, we exploit adiabaticity by starting with the ground state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle^{\otimes n}$&lt;/span&gt; of the (mixing) Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_M = \sum_i \sigma_i^x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, if we slowly change a Hamiltonian, &lt;span class=&quot;math-container&quot;&gt;$H = (1 - s) H_M + s H_C$&lt;/span&gt; according to some parametrization &lt;span class=&quot;math-container&quot;&gt;$s \in [0, 1]$&lt;/span&gt;, the state would continue to remain in the instantaneous eigenstate and you would end up in the ground state of the Cost Hamiltonian when &lt;span class=&quot;math-container&quot;&gt;$s = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is a precursor to QAOA, since, the time evolution of the initial state can be written as a Trotterization of &lt;span class=&quot;math-container&quot;&gt;$H_M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; and instead of having the unitary time evolution depend on &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, new degrees of freedom are added and &lt;span class=&quot;math-container&quot;&gt;$H_M$&lt;/span&gt; is evolved by &lt;span class=&quot;math-container&quot;&gt;$\beta_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\gamma_i$&lt;/span&gt; for each Trotterization step, &lt;span class=&quot;math-container&quot;&gt;$i \in [0, p]$&lt;/span&gt; (which is what QAOA does). This connection with QAA is the closest thing I can think of to a guarantee that the QAOA should find the global optima.&lt;/p&gt;&#xA;&lt;p&gt;QAA fails when the instantaneous eigenvalues of H are too close, and the adiabaticity condition on the sweeping speed from &lt;span class=&quot;math-container&quot;&gt;$H_m \rightarrow H_C$&lt;/span&gt; is so slow that the algorithm is ultimately inefficient. QAOA, however, circumvents that problem by adding additional dimensions to the evolution and &amp;quot;sweeping&amp;quot; around the critical points/avoided crossings.&lt;/p&gt;&#xA;&lt;p&gt;In practise, when experimenting with QAOA, there's no guarantee that the algorithm has converged to a global optima for a given value of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. You could very well only have found a local minima. But, as &lt;span class=&quot;math-container&quot;&gt;$p \rightarrow \infty$&lt;/span&gt;, QAOA approaches the QAA and the final result should approach the global minimum.&lt;/p&gt;&#xA;" OwnerUserId="13901" LastEditorUserId="13901" LastEditDate="2021-02-25T21:24:32.937" LastActivityDate="2021-02-25T21:24:32.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16220" PostTypeId="2" ParentId="16218" CreationDate="2021-02-26T06:10:31.557" Score="3" Body="&lt;p&gt;Registers are mostly a user-land element for convenience and organization. They are mostly inherited from &lt;a href=&quot;https://arxiv.org/pdf/1707.03429v2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenQASM&lt;/a&gt;. Currently (qiskit-terra 0.17) &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/5486&quot; rel=&quot;nofollow noreferrer&quot;&gt;they are optional&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, there is a notable exception (at least for now). To implement a classical conditional, the condition is on a classical register. If your circuit has a classical conditional, it needs a classical register. Because circuits cannot be a with-register/registerless mix, then also the quantum register is required:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;&#xA;qreg = QuantumRegister(1)&#xA;creg = ClassicalRegister(4)&#xA;circuit = QuantumCircuit(qreg, creg)&#xA;circuit.h(0).c_if(creg, 3)&#xA;&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bsJaD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bsJaD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-26T06:10:31.557" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16221" PostTypeId="1" AcceptedAnswerId="16222" CreationDate="2021-02-26T07:12:52.933" Score="1" ViewCount="45" Body="&lt;p&gt;I read about this paper&#xA;&lt;a href=&quot;https://ieeexplore.ieee.org/document/9205650&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hardware-aware Heuristic for the Qubit Mapping problem in the NISQ Era&lt;/a&gt;.&#xA;I wonder there is the only SWAP gate that can change the quantum hardware topology.&#xA;Is there any gates that can change it except Bridge?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="2293" LastEditDate="2021-03-12T02:30:17.920" LastActivityDate="2021-03-12T02:30:17.920" Title="Is there any quantum gate that can change quantum hardware topology(architecture)?" Tags="&lt;quantum-gate&gt;&lt;physical-realization&gt;&lt;architecture&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16222" PostTypeId="2" ParentId="16221" CreationDate="2021-02-26T07:36:17.783" Score="2" Body="&lt;p&gt;I would not say that swap gate changes a topology of a quantum processor as this is given by physical properties of the processor, mainly conectivity among qubits.&lt;/p&gt;&#xA;&lt;p&gt;Swap gate simply switch content of two qubits to overcome non-full connectivity among qubits, hardware topology remains intact. I can imagine that it is possible to group physical qubits into logical ones and in the end you could have full connectivity among these logical qubits but at the hardware level, the topology is again given.&lt;/p&gt;&#xA;&lt;p&gt;To come back to the original question. As far as I know only swap and bridge gates are used for adapting a quantum circuit to the topology of the quantum processor.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-26T07:36:17.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16223" PostTypeId="2" ParentId="16216" CreationDate="2021-02-26T07:46:16.457" Score="1" Body="&lt;p&gt;You can employ a method described in paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0407010&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;. This allows you to prepare arbitrary quantum state. If you have &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; features, you can encode them into amplitudes of &lt;span class=&quot;math-container&quot;&gt;$\log_2 x$&lt;/span&gt; qubits state because &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits states are described by vectors of length &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Just note that in Qiskit the algorithm in the article above is implemented in function &lt;code&gt;initialize&lt;/code&gt;, for example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;quantumState = [&#xA;    1 / math.sqrt(2) * complex(1, 0),&#xA;    1 / 2 * complex(1, 1),]&#xA;&#xA;q = QuantumRegister(1, name = 'q')&#xA;c = ClassicalRegister(1, name = 'c')&#xA;&#xA;circuit = QuantumCircuit(q,c)&#xA;&#xA;circuit.initialize(quantumState, [q[0]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you have two such states (vector), you can use a swap test for multiqubit states are described by &lt;em&gt;KAJ226&lt;/em&gt; &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16146/how-to-implement-the-swap-test-with-the-help-of-qiskit/16149#16149&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-26T07:46:16.457" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16225" PostTypeId="2" ParentId="16217" CreationDate="2021-02-26T14:01:27.493" Score="4" Body="&lt;p&gt;This is a complicated question, which I am definitely not the most qualified to answer, but I encountered the same questioning during my learning path, and I had to find the answers by myself. Therefor, this is a partial answer, to contribute the the real answer which will be proposed (I hope) later.&lt;/p&gt;&#xA;&lt;p&gt;I think the example you give is a very good one and I will list some elements which helped me with this example :&lt;/p&gt;&#xA;&lt;h3&gt;Trying to understand what everything means&lt;/h3&gt;&#xA;&lt;p&gt;As with every formula, understanding the variables which compose it is essential. This will give you insight of what the input is. For example, Grover's Diffusion operator is composed out of 3 elements : &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|s\rangle\langle s|$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; are easy to understand but &lt;span class=&quot;math-container&quot;&gt;$|s\rangle\langle s|$&lt;/span&gt; is not. However, understanding this operator is key, as it is a matrix with the square of every amplitude in the diagonals starting from the top right.&lt;/p&gt;&#xA;&lt;h3&gt;Representing everything with a single matrix&lt;/h3&gt;&#xA;&lt;p&gt;This is something debatable, but it helped me a lot to visualize the entire thing in one image. This can make us able to see inversions using &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates or simplifications with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates. For example, by calculating the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates of Grover's Diffusion operator (see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13313/how-can-you-decompose-grovers-diffusion-operator-into-gates&quot;&gt;example&lt;/a&gt;), we can change the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; of sides, which transforms everything in a controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;h3&gt;Plugin in simple values&lt;/h3&gt;&#xA;&lt;p&gt;The representation of the state vector gets extremely complex after a couple of iterations in many algorithms and there is no way to visualize it simply. However, sometimes there are specific values that often simplify the problem. For example, when the first diffusion operator is applied : &lt;span class=&quot;math-container&quot;&gt;$|s\rangle \approx |+\rangle ^{\otimes n}$&lt;/span&gt; (there is only a negative phase, which is removed in the outer product). This state can easily be simplified using &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt;. Therefor, plugin in the simple values can easily help.&lt;/p&gt;&#xA;&lt;h3&gt;Conclusion&lt;/h3&gt;&#xA;&lt;p&gt;As you can see, this is not an &amp;quot;algorithmic&amp;quot; method to do what you want. It is similar to what you think like during a proof. But I hope these small tips can help you in your work. This is not meant to be a complete answer, so I hope someone can be more complete.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2021-02-26T14:01:27.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16228" PostTypeId="1" CreationDate="2021-02-26T17:24:14.200" Score="2" ViewCount="66" Body="&lt;p&gt;I am attempting to setup a PyCharm project to study and work through the QISKit textbook. However I seem to be running into a propblem seting it up.&lt;/p&gt;&#xA;&lt;p&gt;I have setup a python enviroment via anaconda (PyCharm does this automatically). I run &lt;code&gt;pip install qiskit&lt;/code&gt; which returns the &lt;code&gt;Failed buidling wheel for h5py&lt;/code&gt; error but I read online that this can be ignored.&lt;/p&gt;&#xA;&lt;p&gt;I tried to import from qiskit but got an error saying ther is no reference to qiskit.&lt;/p&gt;&#xA;&lt;p&gt;I tried the auto fix of installing the qiskit package again but it had an error displayed in the below screenshot.&lt;/p&gt;&#xA;&lt;p&gt;Help would be appreciated in setting up my PyCharm project.&lt;/p&gt;&#xA;&lt;p&gt;Many thanks.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/31MW4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/31MW4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/WaxUd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WaxUd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/o9F5I.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/o9F5I.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ZQQb7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZQQb7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15009" LastEditorUserId="2293" LastEditDate="2021-03-01T22:47:57.933" LastActivityDate="2021-03-01T22:47:57.933" Title="QISKit not installing in PyCharm" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16229" PostTypeId="1" CreationDate="2021-02-26T17:26:27.887" Score="1" ViewCount="49" Body="&lt;p&gt;Grover's algorithm works by iteration of the operator &lt;span class=&quot;math-container&quot;&gt;$$\tag{1}G:=U_S^\perp U_f=H^{\otimes n}U_0^\perp H^{\otimes n}.$$&lt;/span&gt;&#xA;I know how to write down the matrix for &lt;span class=&quot;math-container&quot;&gt;$U_S^\perp$&lt;/span&gt; (the inversion about the average value of the amplitudes), and also how it is implemented in a circuit (essentially, a CNOT gate between &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates).&lt;/p&gt;&#xA;&lt;p&gt;But what about &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;? In the theory, the oracle is defined by its action of the tensor product of the input and output registers as &lt;span class=&quot;math-container&quot;&gt;$$\tag{2}U_f|x\rangle |y\rangle=|x\rangle |y\oplus f(x)\rangle,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; returns &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; for all input states but for a specified &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt;, in which case it returns &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. But more concretely, I have the following questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;how is the matrix form of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; for a generic &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; derived (specifically for the first few qubits &lt;span class=&quot;math-container&quot;&gt;$n=1,2,3$&lt;/span&gt;), and&lt;/li&gt;&#xA;&lt;li&gt;what does its implementation in a circuit actually look like in terms of fundamental gates?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="14654" LastEditorUserId="2293" LastEditDate="2021-03-01T22:46:46.613" LastActivityDate="2021-03-01T22:46:46.613" Title="In Grover's oracle, how is the matrix $U_f$ derived for a generic $n$?" Tags="&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16230" PostTypeId="1" AcceptedAnswerId="16243" CreationDate="2021-02-26T17:43:06.740" Score="2" ViewCount="71" Body="&lt;p&gt;I'm curious how to find the probability measurement of a state when one qubit is measured. For example this state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\gamma\rangle = \frac{1}{\sqrt{2}}(| 010 \rangle + | 101 \rangle )$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Assuming these are qubits and if we measure the last qubit in the &lt;span class=&quot;math-container&quot;&gt;$| + \rangle  ,| - \rangle $&lt;/span&gt; basis, what is the probability measurement of the state after measuring the third qubit?&lt;/p&gt;&#xA;&lt;p&gt;A probability usually means something like &lt;span class=&quot;math-container&quot;&gt;$ |\langle\phi|\psi \rangle|^2 $&lt;/span&gt; but if we take the results from after measuring the last qubit in the &lt;span class=&quot;math-container&quot;&gt;$+,-$&lt;/span&gt; basis we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_+\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(| 01 \rangle + | 10 \rangle )$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi_-\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}(| 01 \rangle - | 10 \rangle )$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How would we calculate the corresponding measurement probabilities of these two states? Is it really just &lt;span class=&quot;math-container&quot;&gt;$ |\langle\psi_+|\psi_+ \rangle|^2 $&lt;/span&gt; Sounds too easy/doesn't make much sense.&lt;/p&gt;&#xA;" OwnerUserId="13030" LastEditorUserId="55" LastEditDate="2021-03-01T20:20:38.343" LastActivityDate="2021-03-01T20:20:38.343" Title="Measurement probability of a state from three hilbert spaces" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16231" PostTypeId="1" AcceptedAnswerId="16232" CreationDate="2021-02-26T18:29:22.523" Score="3" ViewCount="81" Body="&lt;p&gt;Let's assume we have a normalized data vector &lt;span class=&quot;math-container&quot;&gt;$\vec{x}= [x_1,x_2]$&lt;/span&gt;. How can I prepare a state &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = x_1|0\rangle+x_2|1\rangle$$&lt;/span&gt;&#xA;for any &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt;. I know that this state is in general not reachable through a single rotation, but is there a systematic way of finding a sequence of unitaries (let's call it &lt;span class=&quot;math-container&quot;&gt;$U_s$&lt;/span&gt; here), that performs a transformation, such that &lt;span class=&quot;math-container&quot;&gt;$U_s|0\rangle=|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14817" LastActivityDate="2021-02-26T19:56:55.737" Title="How to prepare a random 1-qubit superposition for data encoding" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;&lt;state-preparation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16232" PostTypeId="2" ParentId="16231" CreationDate="2021-02-26T19:49:09.350" Score="2" Body="&lt;p&gt;&lt;strong&gt;Theorem:&lt;/strong&gt; Suppose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary operation on a single qubit. Then there exist real numbers &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta, \gamma, \delta$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ U = e^{i\alpha} R_z(\beta) R_y(\gamma)R_z(\delta) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is on &lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;page 175 of this textbook.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Ignore the global phase, each of these gates can be &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.RYGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;implement directly&lt;/a&gt; on a quantum computer. So given a vector &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt;, you just work-out what &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; needs to be, then find the appropriate angles  &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta, \gamma, \delta$&lt;/span&gt; . To find &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that takes &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt;, note that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; must take the form &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} x_1 &amp;amp; u_{12} \\ x_2 &amp;amp; u_{22} \end{pmatrix}$&lt;/span&gt;. To get the second column, pick some arbitrary vector that is independent from &lt;span class=&quot;math-container&quot;&gt;$\vec{x}$&lt;/span&gt;, then perform the the &lt;a href=&quot;https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gram-Schmidt process&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you use Qiskit, you can initialize your state directly. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import random_state&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;provider = IBMQ.load_account()&#xA;&#xA;num_qubits = 1&#xA;random_initial_state = random_state(2**num_qubits) #you can place specific vector here&#xA;circuits = []&#xA;circuit = QuantumCircuit(num_qubits,num_qubits)&#xA;circuit.initialize(random_initial_state, 0)  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-26T19:56:55.737" LastActivityDate="2021-02-26T19:56:55.737" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16233" PostTypeId="1" AcceptedAnswerId="16234" CreationDate="2021-02-26T20:17:06.090" Score="1" ViewCount="39" Body="&lt;p&gt;Suppose a composite state is in &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_{A}|1\rangle_{B}$&lt;/span&gt;. Then their conjugate transpose would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$\langle 0|_{A}\langle 1|_{B}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Note: Why this question? Because I was checking MIT's &amp;quot;Quantum Information Science's 2010 class's homework solution of 3&amp;quot; (&lt;a href=&quot;http://web.mit.edu/2.111/www/2010/ps3_2010Sol2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;) Page 2&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dv6Hl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dv6Hl.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here is the corresponding problem set.(In case you feel curious) (&lt;a href=&quot;http://web.mit.edu/2.111/www/2010/ps3_2010d.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-26T23:02:01.093" Title="What is the conjugate transpose of $|0\rangle_{A}|1\rangle_{B}$?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16234" PostTypeId="2" ParentId="16233" CreationDate="2021-02-26T23:02:01.093" Score="2" Body="&lt;p&gt;Yes, the conjugate is &lt;span class=&quot;math-container&quot;&gt;$\langle 0|_A\langle 1|_B$&lt;/span&gt;. This is also other times written as &lt;span class=&quot;math-container&quot;&gt;$\langle 0_A|\langle 1_B|$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\langle 0_A|\otimes \langle 1_B|$&lt;/span&gt;, or just &lt;span class=&quot;math-container&quot;&gt;$\langle 01|$&lt;/span&gt;, or similar ways. These are all just notational differences. They are all equivalent as long as one knows what is being discussed.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-02-26T23:02:01.093" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16235" PostTypeId="1" AcceptedAnswerId="16236" CreationDate="2021-02-27T01:17:21.557" Score="2" ViewCount="207" Body="&lt;p&gt;I have found this question from MIT &lt;a href=&quot;http://web.mit.edu/2.111/www/2010/ps4_2010d.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;problemset&lt;/a&gt;.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Q62sZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Q62sZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I could only design the circuit for 3 qubits. But they have a general &lt;a href=&quot;http://web.mit.edu/2.111/www/2010/ps4solution.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;solution&lt;/a&gt; that shows this circuit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/XZppZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/XZppZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am trying to understand this circuit (from the application of &lt;span class=&quot;math-container&quot;&gt;$R_k$&lt;/span&gt; and then the &lt;span class=&quot;math-container&quot;&gt;$FT^\dagger$&lt;/span&gt;). Can anybody explain the idea so that I can design these kinds of circuits on my own next time?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="10480" LastEditDate="2021-03-09T18:34:34.617" LastActivityDate="2021-03-09T18:34:34.617" Title="Intuition behind the use of inverse FFT in Quantum Circuit for Hamming weight" Tags="&lt;algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16236" PostTypeId="2" ParentId="16235" CreationDate="2021-02-27T03:03:47.193" Score="3" Body="&lt;p&gt;A generic type of problem for which a fast quantum algorithm is known is the task of computing an eigenvalue of a unitary. Therefore, when looking for an algorithm to compute a quantity &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; it is reasonable to first try to define a unitary &lt;span class=&quot;math-container&quot;&gt;$U(x)$&lt;/span&gt; with an eigenvalue &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta(x)}$&lt;/span&gt; dependent on &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. If we can efficiently implement controlled powers of &lt;span class=&quot;math-container&quot;&gt;$U(x)$&lt;/span&gt; as quantum circuits, then we may be able to use &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Phase Estimation&lt;/a&gt; to find &lt;span class=&quot;math-container&quot;&gt;$\theta(x)$&lt;/span&gt;. We then recover &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\theta(x)$&lt;/span&gt;, often using classical computation.&lt;/p&gt;&#xA;&lt;p&gt;Let us apply this strategy to the problem of computing the Hamming weight &lt;span class=&quot;math-container&quot;&gt;$w(z)$&lt;/span&gt; of a binary string &lt;span class=&quot;math-container&quot;&gt;$z=z_1z_1\dots z_n$&lt;/span&gt;. We notice that each bit &lt;span class=&quot;math-container&quot;&gt;$z_k$&lt;/span&gt; contributes equally to &lt;span class=&quot;math-container&quot;&gt;$w(z)$&lt;/span&gt; irrespective of its position and independently of other bits. This suggests that the unitary we seek should be a simple application of the same single-qubit gate to each qubit. Indeed, if we define &lt;span class=&quot;math-container&quot;&gt;$W = R_n^{\otimes n}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$R_n = \mathrm{diag}\left(1, e^{2\pi i/2^n}\right)$&lt;/span&gt;, then we see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W|z\rangle = W|z_1z_2\dots z_n\rangle = \prod_{k=1}^n e^{2\pi i \frac{z_k}{2^n}} |z\rangle = e^{2\pi i \frac{w(z)}{2^n}}|z\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, we have found unitary &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; whose eigenvectors are the computational basis states and whose eigenvalue associated with &lt;span class=&quot;math-container&quot;&gt;$|z\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i w(z)/2^n}$&lt;/span&gt;. Moreover, the controlled powers of &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; are simple to implement since &lt;span class=&quot;math-container&quot;&gt;$W^{2^k} = R_{n-k}^{\otimes n}$&lt;/span&gt;. Therefore, we can use QPE to compute &lt;span class=&quot;math-container&quot;&gt;$w(z)$&lt;/span&gt;. Indeed, inserting &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt; into the machinery of QPE yields the circuit presented in the question.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-02-27T23:57:17.747" LastActivityDate="2021-02-27T23:57:17.747" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16237" PostTypeId="2" ParentId="16235" CreationDate="2021-02-27T03:22:54.560" Score="3" Body="&lt;p&gt;I am glad finally I demystified the mystery and now I would like to share my journey. I have applied it to 3 qubits and then tried to check if my understanding is correct.&lt;/p&gt;&#xA;&lt;p&gt;The realization is that it converts it from computational basis to Fourier basis. To explain simply,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hppsO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hppsO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So the rule is, to convert from computation basis we would just take the binary representation of the number that is given as input to the input register (in binary form, that means 8 would become 100 and 5 would be given as input as 101 and apply it to the each of the three arrows lying in the disk. To be more specific, &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt;). Now to get the Fourier basis representation we would move the arrow starting from the disk in the middle of the sphere, just like we move around a unit circle. So if we have 3 qubit in input then we will move around like this. The least significant position’s sphere would have an arrow which moves in &lt;span class=&quot;math-container&quot;&gt;$\frac{2\pi}{2^{3}}$&lt;/span&gt; and the next one in  &lt;span class=&quot;math-container&quot;&gt;$2 \times \frac{2\pi}{2^{3}} = \frac{\pi}{2}$&lt;/span&gt; and then the most significant one in &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Given this rule of moving things out we can represent anything in computational basis to Fourier basis (I say it, from up-down movement to disk based movement). Well this is what I understood to be the Fourier transform. So now if somebody gives me these 3 spheres, in Fourier basis (disk based representation) I can apply inverse FFT to get things in computational basis. :)&lt;/p&gt;&#xA;&lt;p&gt;Well now in this MIT problem, we were asked to find the number of 1’s. If we had to use non quantum circuit we would have to think of setting this bit 0 or 1 based on whether the previous bit is set or not. I was thinking along the same line and found the “not so fun” quantum circuit for 3 qubits.(Not sure maybe it internally does the same thing). But the process I used is same as we use in normal circuit design applying digital logic.&lt;/p&gt;&#xA;&lt;p&gt;Here things are now in much better done with the Fourier basis in our hand. We are saying, no matter what, whenever you find a 1, move all the three arrows in these 3 spheres once. (because you have encountered just a single 1).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ts5io.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ts5io.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So suppose we have 5 as input. Then we will say the arrows to move like this. But this is exactly the setup we will get after we apply QFT to &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; as per our rule. So that means once we do all this movement, which we have done via the rotation circuit component, we will have to apply opposite of QFT which is the inverse FFT. And that’s how we get to the answer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MhiuI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MhiuI.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13763" LastEditorUserId="13763" LastEditDate="2021-02-27T03:35:11.543" LastActivityDate="2021-02-27T03:35:11.543" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16238" PostTypeId="1" AcceptedAnswerId="16241" CreationDate="2021-02-27T06:06:12.760" Score="4" ViewCount="75" Body="&lt;p&gt;I am a beginner in quantum computing, and I understand the basics of quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;Can anyone suggest me a beginners material for quantum cryptography and post quantum cryptography? Book, Video or lecture notes, anything will do, given it is good for beginners.&lt;/p&gt;&#xA;" OwnerUserId="14931" LastEditorUserId="10480" LastEditDate="2021-02-27T06:52:52.063" LastActivityDate="2021-02-27T08:05:13.320" Title="Sources for quantum cryptography and post quantum cryptography" Tags="&lt;resource-request&gt;&lt;cryptography&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16239" PostTypeId="1" CreationDate="2021-02-27T07:26:03.030" Score="1" ViewCount="48" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ANe2E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ANe2E.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hi, I need help me with figuring out the 3-qubit phase shift circuit without any ancillas similar to the 2-qubit circuit shown in below attached picture....... Please do let me know! Thanks in advance! Also, I've written down the matrix/operator equivalent to 3-qubit phase-shift circuit in the picture itself... Restrictions would be to not use any Ancilla's and it would be better if we can implement using only CNOT &amp;amp; single qubit gates.&lt;/p&gt;&#xA;" OwnerUserId="13749" LastEditorUserId="2293" LastEditDate="2021-03-01T22:48:17.323" LastActivityDate="2021-03-01T22:48:17.323" Title="3-qubit phase shift gate/circuit implementation without any Ancilla qubits" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;unitarity&gt;&lt;phase-estimation&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16240" PostTypeId="2" ParentId="16238" CreationDate="2021-02-27T07:44:05.707" Score="2" Body="&lt;p&gt;I would recomend reading article &lt;a href=&quot;https://link.springer.com/article/10.1007/BF00191318&quot; rel=&quot;nofollow noreferrer&quot;&gt;Experimental Quantum Cryptography&lt;/a&gt; by, inter alia, Charles Bennett, one of inventor of BB84 protocol. Especially first chapter on history and second chapter on quantum key distribution are accessible even to beginer in QC.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-27T07:44:05.707" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16241" PostTypeId="2" ParentId="16238" CreationDate="2021-02-27T08:05:13.320" Score="3" Body="&lt;p&gt;There's an online video lecture course given by Stephanie Wehner and Thomas Vidick that gives a fairly nice overview of quantum cryptography. You can find the course &lt;a href=&quot;https://ocw.tudelft.nl/courses/quantum-cryptography/#1493321998511-d275a9fe-1528&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-02-27T08:05:13.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16243" PostTypeId="2" ParentId="16230" CreationDate="2021-02-27T10:07:29.583" Score="2" Body="&lt;p&gt;A measurement can be associated with a decomposition of the identity &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; into a sum of projectors. For example, the measurement of a qubit in the &lt;span class=&quot;math-container&quot;&gt;$| + \rangle  ,| - \rangle$&lt;/span&gt; basis is associated with the decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I = P_+ + P_- = |+\rangle\langle+| ~+~ |-\rangle\langle-|.&#xA;$$&lt;/span&gt;&#xA;Then the probabilities are &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(P_+|\phi\rangle\langle\phi|) = |\langle\phi|+ \rangle|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(P_-|\phi\rangle\langle\phi|) = |\langle\phi|- \rangle|^2$&lt;/span&gt; if we measure a qubit state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When we measure only one subsystem this is equivalent to a measurement of the whole system with a naturally extended decomposition. For example, in your case it will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I_{123} = I_{12} \otimes P_+ + I_{12} \otimes P_-,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I_{123}$&lt;/span&gt; is the identity operator on the whole system of three qubits, and &lt;span class=&quot;math-container&quot;&gt;$I_{12}$&lt;/span&gt; is identity on just first two qubits.&lt;/p&gt;&#xA;&lt;p&gt;Then the probabilities are &lt;span class=&quot;math-container&quot;&gt;$p_+ = \text{Tr}((I_{12} \otimes P_+)|\gamma\rangle\langle\gamma|)$&lt;/span&gt; with the post-measurement state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{p_+}  } (I_{12} \otimes P_+) |\gamma\rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_- = \text{Tr}((I_{12} \otimes P_-)|\gamma\rangle\langle\gamma|)$&lt;/span&gt; with the post-measurement state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{p_-}  } (I_{12} \otimes P_-) |\gamma\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you are not interested in post-measurement states then there is another approach of calculating probabilities &lt;span class=&quot;math-container&quot;&gt;$p_+,p_-$&lt;/span&gt;. You can calculate the density matrix of the third qubit&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_3 = \text{Tr}_{12} (|\gamma\rangle\langle\gamma|) = \text{Tr}_{12}\big(\frac{1}{2}(| 010 \rangle + | 101 \rangle ) (\langle 010 | + \langle 101 | )\big)&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \text{Tr}_{12}\big(\frac{1}{2}(|010\rangle\langle 010| + |010\rangle\langle 101| + |101\rangle\langle 010| + |101\rangle\langle 101| )\big) =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \frac{1}{2} (|0\rangle\langle 0| + |1\rangle\langle 1|) = \frac{1}{2} I.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then the probabilities are &lt;span class=&quot;math-container&quot;&gt;$p_+ = \text{Tr}(P_+ \rho_3) = \text{Tr}(P_+ \frac{1}{2} I) = \frac{1}{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_- = \text{Tr}(P_- \rho_3) = \text{Tr}(P_- \frac{1}{2} I) = \frac{1}{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The post-measurement states will actually be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{p_+}  } (I_{12} \otimes P_+) |\gamma\rangle = &#xA;(I_{12} \otimes |+\rangle\langle+|)(|010\rangle + |101\rangle) =&#xA;\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)|+\rangle&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{p_-}  } (I_{12} \otimes P_-) |\gamma\rangle = &#xA;(I_{12} \otimes |-\rangle\langle-|)(|010\rangle + |101\rangle) =&#xA;\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)|-\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-02-27T10:07:29.583" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="16244" PostTypeId="1" CreationDate="2021-02-27T10:42:09.393" Score="-4" ViewCount="54" Body="&lt;p&gt;Is it possible to have access to a quantum computer to break a BitLocker key (maybe with Shor's algorithm) and have access to my data?&lt;/p&gt;&#xA;&lt;p&gt;Here what happened to me: after I've changed my LENOVO X270 laptop faulty RAM and internal keyboard, now at boot there is a Bitlocker screen it is asking me for a BitLocker key! I don't have it in my Microsoft/OneDrive account, on a printout I saved, on a USB flash drive, in an Azure Active Directory, held by a system administrator or whatsoever! This is logical: despite BitLocker comes preinstalled in Windows but I never ran and less configured it! Please trust me, I am in IT for +30 years and even if I had Alzheimer's disease I will remember it!&lt;/p&gt;&#xA;&lt;p&gt;So, after googling and searching on Microsoft KB, I've found out that there are thousands (if not millions) of Windows users to whom it happened too. I believe it was triggered by a Windows system update and security measures which I never ever set!&lt;/p&gt;&#xA;&lt;p&gt;I've obviously contacted Microsoft Support, checked since the past sleepless 3 weeks a lot of KBs, forums tried many prompt commands, BIOS settings, watched hours of videos, contacted recovery software companies (like Elcomsoft, Passware, TheGrideon...) all of them said their product cannot help in my case because my drive was encrypted with a numeric password which is a recovery key.&lt;/p&gt;&#xA;&lt;p&gt;I didn't want to reinstall Windows or bring my laptop to a hardware recovery store as I don't want to take the risk to make my data unrecoverable and also if I cannot find a solution, I am definitely going to hire a lawyer and file a class-action lawsuit against Microsoft: to all Windows users to whom it happened, please contact me.&lt;/p&gt;&#xA;&lt;p&gt;(mayThanks.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/TLIrM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TLIrM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14995" LastEditorUserId="55" LastEditDate="2021-03-01T19:58:48.677" LastActivityDate="2021-03-01T19:58:48.677" Title="Can I have access to break my Windows BitLocker key" Tags="&lt;shors-algorithm&gt;&lt;cryptography&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2021-03-02T19:12:40.997" ContentLicense="CC BY-SA 4.0" />
  <row Id="16245" PostTypeId="2" ParentId="16244" CreationDate="2021-02-27T10:49:55.607" Score="3" Body="&lt;p&gt;Currently, there exist no quantum computer, let alone one that we 'as ordinary citizens' could have access to. It will likely take another &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; years (although the exact timeframe is heavily debated) before there will be a quantum computer that is powerful enough to run Shor's algorithm for a key that is actually interesting to break - and getting access to one for personal use might be a stretch for another &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; years.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, Shor's algorithm only 'works' for certain kind of &lt;em&gt;public&lt;/em&gt; key encryption standards, especially the widely used RSA. A quick search tells me that windows bitlocker uses AES (which is a &lt;em&gt;private/symmetric&lt;/em&gt; key encryption standard*) - a quantum computer is not gonna be able to have much speedup over classical computers in trying to crack this; this is a known fact.&lt;/p&gt;&#xA;&lt;p&gt;All in all, a quantum computer, even if it did exist - which it does not - will not be able to help you here. Best of luck with getting back your data; and your question might get more traction on the cryptography stack exchange - but AES is a very robust encryption standard and there's probably more fruitful approaches to getting your data back than trying to crack the key.&lt;/p&gt;&#xA;&lt;p&gt;*It makes way more sense to use symmetric key encryption here, of course.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-02-27T10:49:55.607" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16246" PostTypeId="2" ParentId="16215" CreationDate="2021-02-27T11:46:44.400" Score="0" Body="&lt;p&gt;I have just found a paper (&lt;a href=&quot;https://www.semanticscholar.org/paper/Flocks-of-Quantum-Clones%3A-Multiple-Copying-of-Bu%C5%BEek-Hillery/6f63c331c22179feaeefdbe88a599d365094acc7&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.semanticscholar.org/paper/Flocks-of-Quantum-Clones%3A-Multiple-Copying-of-Bu%C5%BEek-Hillery/6f63c331c22179feaeefdbe88a599d365094acc7&lt;/a&gt;) which answers to my problem.&lt;/p&gt;&#xA;" OwnerUserId="14007" LastActivityDate="2021-02-27T11:46:44.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16247" PostTypeId="2" ParentId="16235" CreationDate="2021-02-27T16:15:11.997" Score="3" Body="&lt;p&gt;They are using the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0008033&quot; rel=&quot;nofollow noreferrer&quot;&gt;Draper phase adder&lt;/a&gt; to count how many of the bits are set. This adder uses the well known fact in classical signal processing that phasing each state t by an amount proportional to t in frequency space is equivalent to shifting in sample space.&lt;/p&gt;&#xA;&lt;p&gt;This is actually a sub-optimal strategy for this problem, because it uses &lt;span class=&quot;math-container&quot;&gt;$O(n \lg n)$&lt;/span&gt; gates  (there are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; controlled increments of a &lt;span class=&quot;math-container&quot;&gt;$\lg n$&lt;/span&gt; sized register). You can get down to &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; by iteratively applying 3-to-2 full adders until the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; same-weight initial bits are represented by &lt;span class=&quot;math-container&quot;&gt;$\lg n$&lt;/span&gt; doubling-weight bits (&lt;a href=&quot;https://arxiv.org/abs/1709.06648&quot; rel=&quot;nofollow noreferrer&quot;&gt;page 4 here&lt;/a&gt;). This also has the advantage of avoiding rotations by small angles, which require decomposing into dozens of rotations in the context of a fault tolerant computation.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-02-27T16:15:11.997" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16248" PostTypeId="2" ParentId="16195" CreationDate="2021-02-27T17:24:11.823" Score="2" Body="&lt;p&gt;John Preskill posted his lectures from the first term of Quantum Computing course, &lt;a href=&quot;http://theory.caltech.edu/%7Epreskill/ph219/ph219_2020-21.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ph/CS 219A Quantum Computation&lt;/a&gt;, at CalTech here: &lt;a href=&quot;https://www.youtube.com/playlist?list=PL0ojjrEqIyPy-1RRD8cTD_lF1hflo89Iu&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/playlist?list=PL0ojjrEqIyPy-1RRD8cTD_lF1hflo89Iu&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-27T17:24:11.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16249" PostTypeId="1" AcceptedAnswerId="16252" CreationDate="2021-02-27T20:29:03.237" Score="5" ViewCount="101" Body="&lt;p&gt;I have been working on a question where I have to decompose this matrix in terms of Pauli Matrices:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{bmatrix}1&amp;amp;0&amp;amp;0&amp;amp;1\\0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\1&amp;amp;0&amp;amp;0&amp;amp;1\end{bmatrix}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I already have a solution but I don't understand the solution I've been given, this is the solution:&lt;/p&gt;&#xA;&lt;p&gt;First there is a truth table:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;+------+-----------+&#xA;|Input | Output    |&#xA;+------+-----------+&#xA;| |00&amp;gt; | |00&amp;gt;+|11&amp;gt; | = 1/2(|00&amp;gt;+|11&amp;gt;+|11&amp;gt;+|11&amp;gt;)&#xA;| |01&amp;gt; | 0         | = 1/2(|01&amp;gt;-|01&amp;gt;+|10&amp;gt;-|10&amp;gt;)&#xA;| |10&amp;gt; | 0         | = 1/2(|10&amp;gt;-|10&amp;gt;+|01&amp;gt;-|01&amp;gt;)&#xA;| |11&amp;gt; | |11&amp;gt;+|00&amp;gt; | = 1/2(|00&amp;gt;+|00&amp;gt;+|11&amp;gt;+|11&amp;gt;)&#xA;+------+-----------+&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I understand the truth table, but I don't understand the things after the &amp;quot;=&amp;quot; and I also don't understand how the final answer is achieved. This is the final answer:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \frac{1}2(I_1 \otimes I_2) + \frac{1}2(Z_1 \otimes Z_2) + \frac{1}2(X_1 \otimes X_2) - \frac{1}2(Y_1 \otimes Y_2) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any help in understanding the solution would be really appreciated. Thank you!&lt;/p&gt;&#xA;" OwnerUserId="15020" LastEditorUserId="55" LastEditDate="2021-03-01T19:59:28.230" LastActivityDate="2021-03-01T19:59:28.230" Title="How do I decompose the given $4\times 4$ matrix in terms of Pauli matrices?" Tags="&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ClosedDate="2021-03-10T11:49:05.993" ContentLicense="CC BY-SA 4.0" />
  <row Id="16250" PostTypeId="2" ParentId="16195" CreationDate="2021-02-27T20:33:32.810" Score="2" Body="&lt;p&gt;Ryan O'Donnell recorded a &lt;a href=&quot;https://www.pqi.org/tags/quantum-computation/?page=1&quot; rel=&quot;nofollow noreferrer&quot;&gt;semester&lt;/a&gt; of lectures (mostly on a chalkboard) at Carnegie Mellon.&lt;/p&gt;&#xA;&lt;p&gt;Sevag Gharibian has an introductory course as well as an intermediate course from the Paderborn University &lt;a href=&quot;https://www.youtube.com/channel/UC3WKNe_LK9JQkuinaLA_orQ&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;; these I believe were recorded on his webcam for uploading to Paderborn's students initially and then to YouTube later.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-02-27T20:33:32.810" CommentCount="0" CommunityOwnedDate="2021-02-27T20:33:32.810" ContentLicense="CC BY-SA 4.0" />
  <row Id="16251" PostTypeId="1" AcceptedAnswerId="16260" CreationDate="2021-02-27T20:55:04.587" Score="3" ViewCount="79" Body="&lt;p&gt;From eqn. &lt;span class=&quot;math-container&quot;&gt;$(4.8)$&lt;/span&gt; in Nielsen and Chuang, a general rotation by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; about the &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt; axis is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_\hat{n}(\theta)\equiv \exp(-i\theta\hat n\cdot\vec\sigma/2) = \cos(\theta/2)I-i\sin(\theta/2)(n_xX+n_yY+n_zZ).&#xA;$$&lt;/span&gt;&#xA;From the qiskit textbook, a generic single-qubit gate is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta, \phi, \lambda) = &#xA;\begin{pmatrix} &#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\&#xA;e^{i\phi} \sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right)&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;I tried to work out the matrix representation of &lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(\theta)$&lt;/span&gt; but it looks like the first entry of that should be &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)-i\sin(\theta/2)n_z$&lt;/span&gt;, which is different from that of &lt;span class=&quot;math-container&quot;&gt;$U(\theta,\phi,\lambda)$&lt;/span&gt;, i.e.  &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering how does &lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(\theta)$&lt;/span&gt; related to &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate? In other words, given a unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt; and a rotation angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, can we represent &lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(\theta)$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="10480" LastEditDate="2021-03-19T03:23:18.873" LastActivityDate="2021-03-19T03:23:18.873" Title="How does a general rotation $R_\hat{n}(\theta)$ related to $U_3$ gate?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;gate-synthesis&gt;&lt;matrix-representation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16252" PostTypeId="2" ParentId="16249" CreationDate="2021-02-27T20:59:24.667" Score="5" Body="&lt;p&gt;I'm really not sure what the truth table is trying to represent but let me present a solution that (at least I think) is fairly simple.&lt;/p&gt;&#xA;&lt;p&gt;First we note that the Pauli matrices together with the identity form an orthogonal basis on the vector space of &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; matrices &lt;span class=&quot;math-container&quot;&gt;$M_2(\mathbb{C})$&lt;/span&gt;. Where orthogonal is taken with respect to the inner product,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle M, N\rangle = \mathrm{Tr}[M^* N].&#xA;$$&lt;/span&gt;&#xA;Moreover, taking tensor products of two elements of our basis we get a basis for &lt;span class=&quot;math-container&quot;&gt;$M_4(\mathbb{C})$&lt;/span&gt;. Note the fact that these operators form a basis is exactly why we can decompose a matrix into a sum of tensor products of the Pauli operators together with the identity. Now it is slightly easier if we normalize our basis elements. For example &lt;span class=&quot;math-container&quot;&gt;$\|X\otimes Y\| = |\langle X\otimes Y,X\otimes Y\rangle|^{1/2} = \mathrm{Tr}[X^2 \otimes Y^2]^{1/2} =  \mathrm{Tr}[I \otimes I]^{1/2} = 2$&lt;/span&gt;. Note all of the elements in our basis have norm &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; as they all square to the identity. Thus multiplying each operator by &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt; we get an orthonormal basis.&lt;/p&gt;&#xA;&lt;p&gt;Now we have an orthonormal basis, it is straightforward to find the coefficients in the expansion, like how we would do this in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; we need only take the inner product of our matrix with each of the orthonormal basis elements. Formally, this is because we know&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = \frac{c_{00}}{2} I \otimes I + \frac{c_{01}}{2} I \otimes X + \frac{c_{02}}{2} I \otimes Y + \dots + \frac{c_{33}}{2} Z \otimes Z,&#xA;$$&lt;/span&gt;&#xA;then for example&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;c_{13} = \mathrm{Tr}[\frac{1}{2}(X \otimes Z) M] = \langle \frac12 (X\otimes Z), M\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Performing these computations for the matrix you specify, you should get out the correct coefficients.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-02-27T20:59:24.667" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16253" PostTypeId="1" CreationDate="2021-02-27T22:14:41.533" Score="2" ViewCount="40" Body="&lt;p&gt;I have come through an interesting paper by Don Coppersmith (&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0201067.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/0201067.pdf&lt;/a&gt;), and I was wondering what was your view on the &lt;span class=&quot;math-container&quot;&gt;$Q_{JK}$&lt;/span&gt; (&amp;quot;twiddle&amp;quot;) transformation, which is defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\omega^{2^{L-1-J+K}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can the matrices be obtained on the basis of this definition? Substituting the terms in the equation itself is trivial, but determining the position inside the matrix is something more challenging, at least for me. Which kind of operation allow to obtain the matrix &lt;span class=&quot;math-container&quot;&gt;$P_1Q_{12}$&lt;/span&gt; given the two initial matrices?&lt;/p&gt;&#xA;&lt;p&gt;Thank you in advance for your time.&lt;/p&gt;&#xA;" OwnerUserId="15021" LastActivityDate="2021-02-28T00:31:36.073" Title="Calculating the QFFT according to Coppersmith" Tags="&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16254" PostTypeId="1" CreationDate="2021-02-27T23:55:42.837" Score="1" ViewCount="51" Body="&lt;p&gt;How can we code in Qiskit, a ccz gate ?&lt;/p&gt;&#xA;&lt;p&gt;In python (in &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;), we see three instructions :&#xA;qc.h(nqubits-1)&#xA;qc.mct(list(range(nqubits-1)), nqubits-1)  # multi-controlled-toffoli&#xA;qc.h(nqubits-1)&lt;/p&gt;&#xA;&lt;p&gt;In qiskit , a Hadamard gate can be coded as : circuit.h(qreg[i]).&#xA;But what is it this &amp;quot;mct&amp;quot; gate ? i've not seen it in Qiskit documentation.&lt;/p&gt;&#xA;" OwnerUserId="11714" LastEditorUserId="55" LastEditDate="2021-03-01T20:04:07.197" LastActivityDate="2021-03-01T20:04:07.197" Title="How can we code a ccz (control control z, equivalent of Toffoli on Z and not on X) gate in Qiskit language?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16255" PostTypeId="2" ParentId="16253" CreationDate="2021-02-28T00:31:36.073" Score="2" Body="&lt;p&gt;I think (but have not carefully checked) that the construction being described in this paper is essentially the same as the one from &lt;a href=&quot;https://algassert.com/2016/06/14/qft-by-multiply.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this blog post&lt;/a&gt; which has clearer figures:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7BOBi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7BOBi.png&quot; alt=&quot;multiplication&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The structure of the recursion used above means that the phasing inside the recursive cases uses angles that are the square roots of angles used in the outer case (instead of angles that are merely twice as large). This allows truncating the phase gates to be done more aggressively.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3YGh2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3YGh2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I guess what I'm saying is that the operation they are describing is &amp;quot;phase by an amount proportional to the multiplication of two registers&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-02-28T00:31:36.073" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16256" PostTypeId="1" CreationDate="2021-02-28T00:36:16.973" Score="2" ViewCount="145" Body="&lt;p&gt;The title explains it all. Suppose one needs to find z-y decomposition of unitary matrix H or T. What is the step by step process to find it?&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-28T06:10:48.813" Title="What is the procedure of finding z-y decomposition of unitary matrices?" Tags="&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16257" PostTypeId="1" CreationDate="2021-02-28T00:45:04.600" Score="1" ViewCount="45" Body="&lt;p&gt;Where can we find example(s) of implementation code in a programming language of Quantum Error Correction, whether with the standard method of measurement or the automatic method without measurement (with control operators) ?&lt;/p&gt;&#xA;" OwnerUserId="11714" LastEditorUserId="55" LastEditDate="2021-03-01T20:05:00.037" LastActivityDate="2021-04-01T20:04:25.480" Title="Quantum Error Correction implementation in Qiskit, OpenQASM or other languages based on Python" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;error-correction&gt;&lt;resource-request&gt;&lt;qasm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16258" PostTypeId="2" ParentId="16254" CreationDate="2021-02-28T02:01:27.627" Score="1" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.MCMT.html#qiskit.circuit.library.MCMT&quot; rel=&quot;nofollow noreferrer&quot;&gt;MCMT&lt;/a&gt; (multi-controlled multi-target gate) class to do something like this. To execute CCZ gate, I can do it as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import MCMT&#xA;qr= QuantumRegister(3)&#xA;circ=QuantumCircuit(qr)&#xA;circ = MCMT('cz',2,1)&#xA;print(circ)&#xA;q_0: ─■─&#xA;      │ &#xA;q_1: ─■─&#xA;      │ &#xA;q_2: ─■─&#xA;        &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And if you want to see how the circuit would look using more elementary gates, you can decompose it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(circ.decompose().decompose())&#xA;&#xA;                                               ┌───┐    ┌─────────────┐     »&#xA;q_0: ──────────────────────────────────────────┤ X ├────┤ U(0,0,-π/4) ├──■──»&#xA;     ┌────────────┐                            └─┬─┘    └─────────────┘  │  »&#xA;q_1: ┤ U(0,0,π/4) ├──■───────────────────■───────■───────────────────────┼──»&#xA;     ├────────────┤┌─┴─┐┌─────────────┐┌─┴─┐┌──────────┐ ┌────────────┐┌─┴─┐»&#xA;q_2: ┤ U(0,0,π/4) ├┤ X ├┤ U(0,0,-π/4) ├┤ X ├┤ U(0,0,0) ├─┤ U(0,0,π/4) ├┤ X ├»&#xA;     └────────────┘└───┘└─────────────┘└───┘└──────────┘ └────────────┘└───┘»&#xA;«                             ┌───┐     ┌────────────┐                         »&#xA;«q_0: ────────────────■───────┤ X ├─────┤ U(0,0,π/4) ├──■───────────────────■──»&#xA;«                     │       └─┬─┘     └────────────┘  │                   │  »&#xA;«q_1: ────────────────┼─────────■───────────────────────┼───────────────────┼──»&#xA;«     ┌────────────┐┌─┴─┐┌─────────────┐┌────────────┐┌─┴─┐┌─────────────┐┌─┴─┐»&#xA;«q_2: ┤ U(0,0,π/4) ├┤ X ├┤ U(0,-π/2,0) ├┤ U(0,0,π/4) ├┤ X ├┤ U(0,0,-π/4) ├┤ X ├»&#xA;«     └────────────┘└───┘└─────────────┘└────────────┘└───┘└─────────────┘└───┘»&#xA;«                 &#xA;«q_0: ────────────&#xA;«                 &#xA;«q_1: ────────────&#xA;«     ┌──────────┐&#xA;«q_2: ┤ U(0,0,0) ├&#xA;«     └──────────┘&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-28T04:29:47.813" LastActivityDate="2021-02-28T04:29:47.813" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16259" PostTypeId="2" ParentId="16257" CreationDate="2021-02-28T02:09:41.343" Score="0" Body="&lt;p&gt;Maybe this is something you are looking for:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/2004.11037.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Benchmarking near-term devices with quantum error correction&lt;/a&gt; by James Wootton&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-28T05:56:04.940" LastActivityDate="2021-02-28T05:56:04.940" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16260" PostTypeId="2" ParentId="16251" CreationDate="2021-02-28T02:13:48.287" Score="3" Body="&lt;p&gt;Any single-qubit gate can be expressed as &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\alpha)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and similarly any single-qubit gate can be expressed as &lt;span class=&quot;math-container&quot;&gt;$U(\theta, \phi, \lambda)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;. In other words, the two generic gates provide different parametrizations for the group of single-qubit gates.&lt;/p&gt;&#xA;&lt;p&gt;The reason that elementwise matrix comparison fails is that the two parametrizations differ by the unobservable global phase. Thus, instead of trying to solve&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_\hat{n}(\alpha) = U_3(\theta, \phi, \lambda)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;you should solve&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_\hat{n}(\alpha) = e^{i\gamma}U_3(\theta, \phi, \lambda)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$e^{i\gamma}$&lt;/span&gt; is the unknown global phase. Optionally, you can first reduce the number of unknowns by guessing &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; from the properties of the two matrices.&lt;/p&gt;&#xA;&lt;blockquote class=&quot;spoiler&quot;&gt;&#xA;&lt;p&gt; For example, we observe that the two diagonal elements of &lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(\alpha)$&lt;/span&gt; are complex conjugates of each other and so its trace is real. This suggests the guess &lt;span class=&quot;math-container&quot;&gt;$\gamma = -\frac{\lambda + \phi}{2}$&lt;/span&gt; might work because it turns the trace of &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta, \phi, \lambda)$&lt;/span&gt; into a real number.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note that unlike the global phase the relative phase cannot be ignored. Consequently, the above does not apply to controlled-&lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(\alpha)$&lt;/span&gt; and controlled-&lt;span class=&quot;math-container&quot;&gt;$U_3(\theta, \phi, \lambda)$&lt;/span&gt; gates.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-02-28T02:13:48.287" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16261" PostTypeId="1" CreationDate="2021-02-28T03:55:35.723" Score="3" ViewCount="84" Body="&lt;p&gt;Let's say I have normalized values of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha =(0.27524094128159016+0.8257228238447705j)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\beta =(-0.22019275302527214+0.4403855060505443j)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How do I initialize my circuit starting from these values instead of qubit &lt;code&gt;q[0]&lt;/code&gt; to be in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-03-01T20:05:05.350" LastActivityDate="2021-03-01T20:05:05.350" Title="How do I Initiate with my own alpha and beta values instead of starting form qubit in state zero in IBM Q?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16262" PostTypeId="2" ParentId="16261" CreationDate="2021-02-28T04:38:46.837" Score="3" Body="&lt;p&gt;If you want to start at a specific initial state, you can use qiskit &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.extensions.Initialize.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;initialize&lt;/code&gt;&lt;/a&gt; function to help you. For example,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;provider = IBMQ.load_account()&#xA;num_qubits = 1&#xA;vector = [-0.22019275302527214, 0.4403855060505443j]&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;circuit = QuantumCircuit(num_qubits,num_qubits)&#xA;circuit.initialize(initial_state, 0)  &#xA;print(circuit)&#xA;&#xA;     ┌───────────────────────────────┐&#xA;q_0: ┤ initialize(-0.44721,0.89443j) ├&#xA;     └───────────────────────────────┘&#xA;c: 1/═════════════════════════════════&#xA;                                      &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once you do this, you can perform gate operations as normal... for example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.h(0)&#xA;circuit.ry(1.5,0)&#xA;print(circuit)&#xA;&#xA;     ┌───────────────────────────────┐┌───┐┌─────────┐&#xA;q_0: ┤ initialize(-0.44721,0.89443j) ├┤ H ├┤ RY(1.5) ├&#xA;     └───────────────────────────────┘└───┘└─────────┘&#xA;c: 1/═════════════════════════════════════════════════&#xA;                                                      &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you want the &lt;code&gt;QASM&lt;/code&gt; code as commented then you can do it as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qasm_circuit = circuit.decompose().decompose().decompose() &#xA;print(qasm_circuit)&#xA;print(qasm_circuit.qasm())&#xA;&#xA;          ┌────────────┐┌──────────┐┌────────────┐┌────────────┐&#xA;q_0: ─|0&amp;gt;─┤ RY(2.2143) ├┤ U1(-π/2) ├┤ U(π/2,0,π) ├┤ U(1.5,0,0) ├&#xA;          └────────────┘└──────────┘└────────────┘└────────────┘&#xA;c: 1/═══════════════════════════════════════════════════════════&#xA;                                                                &#xA;&#xA;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[1];&#xA;creg c[1];&#xA;reset q[0];&#xA;ry(2.2142974) q[0];&#xA;u1(-pi/2) q[0];&#xA;u(pi/2,0,pi) q[0];&#xA;u(1.5,0,0) q[0];&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-02-28T05:54:19.467" LastActivityDate="2021-02-28T05:54:19.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16263" PostTypeId="2" ParentId="16256" CreationDate="2021-02-28T05:22:55.450" Score="3" Body="&lt;p&gt;For a 2x2 unitary matrix given by four complex numbers &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} a &amp;amp; b\\ c &amp;amp; d \end{pmatrix}$&lt;/span&gt;, the aspects of the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; decomposition &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta)$&lt;/span&gt; can be worked out quickly as follows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is related to the magnitude between two elements on the same row. You can interpret it as &lt;span class=&quot;math-container&quot;&gt;$2 \arctan(\frac{|b|}{|a|})$&lt;/span&gt; giving a value between 0 to &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, with a value of &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is 0.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; together are related to the complex phases of the four matrix elements. Normally, &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; is the difference in phase between &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is the difference in phase between &lt;span class=&quot;math-container&quot;&gt;$-b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is 0, then instead &lt;span class=&quot;math-container&quot;&gt;$\beta + \delta$&lt;/span&gt; is equal to the difference in phase of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, and if &lt;span class=&quot;math-container&quot;&gt;$\gamma = \pi$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$-\beta + \delta$&lt;/span&gt; is the difference in phase of &lt;span class=&quot;math-container&quot;&gt;$-b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. In either of those cases, their individual values do not matter. The &lt;span class=&quot;math-container&quot;&gt;$\gamma = 0$&lt;/span&gt; case corresponds to entirely &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; rotations.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is the global phase after all this, not related to the relations between elements but a scalar multiple of the entire matrix. To get &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, take the phase of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in the matrix and add &lt;span class=&quot;math-container&quot;&gt;$\frac{\beta}{2} + \frac{\delta}{2}$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is 0 thanks to &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; being &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, you can add &lt;span class=&quot;math-container&quot;&gt;$-\frac{\beta}{2} + \frac{\delta}{2}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;'s phase instead.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So a decompositions of &lt;span class=&quot;math-container&quot;&gt;$H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1\\ 1 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$\{\alpha, \beta, \gamma, \delta\}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\{\frac{\pi}{2}, 0, \frac{\pi}{2}, \pi\}$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; have the same phase and the difference in phase of &lt;span class=&quot;math-container&quot;&gt;$-b = -1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a = 1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;, all elements are equal in magnitude so &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{2}$&lt;/span&gt;. The global phase &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; is then just &lt;span class=&quot;math-container&quot;&gt;$\frac{\delta}{2}$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; already has a phase of 0.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$T = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; e^{i \pi/4} \end{pmatrix}$&lt;/span&gt; can be decomposed into any decomposition where &lt;span class=&quot;math-container&quot;&gt;$\gamma = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{\pi}{8}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta + \delta = \frac{\pi}{4}$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; rotation around the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis, so, with &lt;span class=&quot;math-container&quot;&gt;$R_y(0)$&lt;/span&gt; being the identity, the two &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; transformations are just additive, with the &lt;span class=&quot;math-container&quot;&gt;$\alpha = \frac{\pi}{8}$&lt;/span&gt; being the global phase used to make the top-left element 1.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastEditorUserId="7680" LastEditDate="2021-02-28T06:10:48.813" LastActivityDate="2021-02-28T06:10:48.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16265" PostTypeId="1" AcceptedAnswerId="16289" CreationDate="2021-02-28T06:38:12.883" Score="0" ViewCount="40" Body="&lt;p&gt;How to prove that the transpose operation maps an arbitrary qubit to its complex conjugate, &lt;span class=&quot;math-container&quot;&gt;$|\psi^*\rangle \rightarrow |\psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-03-01T20:05:28.677" LastActivityDate="2021-03-01T20:05:28.677" Title="How to prove that the transpose operation maps an arbitrary qubit to its complex conjugate?" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16266" PostTypeId="2" ParentId="16249" CreationDate="2021-02-28T07:36:41.930" Score="3" Body="&lt;p&gt;I would like to add that this matrix is not unitary since an operator described by it retrurns same results for input combination &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt;, and for inputs &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is returned. Hence such operator cannot be implemented on a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;However, it can be decomposed in Pauli terms as Pauli matrices and their tensor products are basis of a matrix space (this is provided in answer above).&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-28T07:36:41.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16267" PostTypeId="2" ParentId="16265" CreationDate="2021-02-28T07:46:34.027" Score="0" Body="&lt;p&gt;&lt;em&gt;I hope I understoody your question correctly but I think that there is nothing to prove, it is simply a definition.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lets have a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; which is described by a column vector. Then quantum state &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|$&lt;/span&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$(|\psi\rangle^T)^*$&lt;/span&gt;, i.e. coefficients are complex conugate numbers and the column vector is transposed. In the end you, have row vector with complex conjugated coefficients.&lt;/p&gt;&#xA;&lt;p&gt;Maybe, a thread &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/91/how-does-bra-ket-notation-work&quot;&gt;How does bra-ket notation work?&lt;/a&gt; would be helful for getting deeper understanding.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-02-28T07:46:34.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16268" PostTypeId="1" CreationDate="2021-02-28T10:06:59.970" Score="2" ViewCount="69" Body="&lt;p&gt;Is it possible to see what are the values of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; (probability of being in state zero) and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; (probability of being in state one) while running on IBM Quantum simulator (we can call it state vector).&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-03-01T19:59:07.913" LastActivityDate="2021-03-01T19:59:07.913" Title="Is it possible to see the probabilities values of qubit ( alpha and beta) while measuring on IBM Quantum experience?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16269" PostTypeId="2" ParentId="16268" CreationDate="2021-02-28T10:22:02.337" Score="1" Body="&lt;p&gt;You can have access to the quantum state vector only if you're using the state_vector_simulator to run your circuit, that must be written without any measurements. Otherwise, using QASM_simulator and a circuit provided with measurements, you can access by repeating measurement (via the shots keyword) to an approximate evaluation of alpha (probability of zero outcome) and beta (probability of one outcome).&lt;/p&gt;&#xA;" OwnerUserId="12017" LastActivityDate="2021-02-28T10:22:02.337" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16270" PostTypeId="1" CreationDate="2021-02-28T11:17:01.317" Score="1" ViewCount="36" Body="&lt;p&gt;So I have a discreet functional &lt;span class=&quot;math-container&quot;&gt;$f(x_{1},x_{2},...,x_{k})$&lt;/span&gt; that I want to encode in a variational state: &lt;span class=&quot;math-container&quot;&gt;$|\psi(\lambda)&amp;gt;$&lt;/span&gt;. The number of variables in my functional takes values &lt;span class=&quot;math-container&quot;&gt;$k=9,18,30$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I want the parameters &lt;span class=&quot;math-container&quot;&gt;$x_{1},x_{2}...x_{k}$&lt;/span&gt; to be the amplitudes of my state. I can encode &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; parameters with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, however as for the number of variables given &lt;span class=&quot;math-container&quot;&gt;$k=9,18,30$&lt;/span&gt;, I can not write &lt;span class=&quot;math-container&quot;&gt;$k=2^{n}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is an integer for these values of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. I was wondering if there is any nice way around this.&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="10052" LastEditorUserId="55" LastEditDate="2021-03-01T20:07:22.197" LastActivityDate="2021-03-01T20:07:22.197" Title="Encoding a discrete functional in variational $n$-qubit states" Tags="&lt;vqe&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16271" PostTypeId="1" CreationDate="2021-02-28T12:01:38.853" Score="3" ViewCount="83" Body="&lt;p&gt;How to make a half adder for &lt;code&gt;N&lt;/code&gt; inputs and getting the output on another &lt;code&gt;x+1&lt;/code&gt; output. Where &lt;code&gt;x&lt;/code&gt; is numbers of qubit and &lt;code&gt;N=2^x&lt;/code&gt;. please take a example of a circuit(x must be greater then 4 or 5 for example purpose ) for more understanding . Here is the &lt;a href=&quot;https://qiskit.org/textbook/ch-states/atoms-computation.html#4.3-Adding-with-Qiskit-&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; for 2 qubit half adder.&lt;/p&gt;&#xA;" OwnerUserId="8527" LastEditorUserId="8527" LastEditDate="2021-03-04T03:35:26.010" LastActivityDate="2021-03-04T03:35:26.010" Title="How to make a half adder for x number of qubits with min. cost?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;ibm-q-experience&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16272" PostTypeId="1" AcceptedAnswerId="16274" CreationDate="2021-02-28T12:55:55.903" Score="0" ViewCount="40" Body="&lt;p&gt;I was checking this &lt;a href=&quot;https://physics.stackexchange.com/questions/276053/trouble-with-operator-sum-representation-of-a-quantum-operation/276158&quot;&gt;question answer&lt;/a&gt; but I still can't get what is the value and dimension of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}_A$&lt;/span&gt; in this question and on the answer. Is it an identity matrix or some vector?&lt;/p&gt;&#xA;&lt;p&gt;It also appears in the answer as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; multiple times.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/75C2h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/75C2h.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13763" LastActivityDate="2021-02-28T14:12:50.507" Title="Dimensionality and value of $\mathbb{I}_A$ in Quantum operations" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16273" PostTypeId="1" CreationDate="2021-02-28T13:14:19.583" Score="1" ViewCount="6" Body="&lt;p&gt;I am researching spin-oscillator hybrid devices (particularly those coupled to NV centers), and I have come across &lt;a href=&quot;https://arxiv.org/abs/1403.3405&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper investigating the strain field of a cantilever and its effect on the NV centre. I know the resolved sideband regime is that the resonance frequency has to be larger than the ESR spectra linewidth, but why is this necessary/important? I cannot seem to find even the smallest explanation on this.&lt;/p&gt;&#xA;" OwnerUserId="14621" LastActivityDate="2021-02-28T13:14:19.583" Title="Sidebands in spin-oscillator coupled devices" Tags="&lt;quantum-state&gt;&lt;resource-request&gt;&lt;research&gt;&lt;quantum-optics&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16274" PostTypeId="2" ParentId="16272" CreationDate="2021-02-28T13:16:43.847" Score="3" Body="&lt;p&gt;It is the identity operator on system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; so it has the same size as &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;. To convince yourself further of the solution it may be a good idea to do the calculation yourself with some small matrices. What may be confusing you is that whilst &lt;span class=&quot;math-container&quot;&gt;$I_A$&lt;/span&gt; will be a square matrix, &lt;span class=&quot;math-container&quot;&gt;$I_A \otimes |0\rangle$&lt;/span&gt; will not be. However, it will still have the correct dimensions in order to make the product &lt;span class=&quot;math-container&quot;&gt;$(I_A \otimes |0\rangle) \rho_A$&lt;/span&gt; well defined.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2021-02-28T14:12:50.507" LastActivityDate="2021-02-28T14:12:50.507" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16275" PostTypeId="1" AcceptedAnswerId="16736" CreationDate="2021-02-28T15:10:35.443" Score="3" ViewCount="97" Body="&lt;p&gt;My question is simple: does applying QAOA with a statevector simulation always result in a perfect solution?&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to calculate the best &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; that solve certain problems but my statevector simulation of problem always finds the exact solution with a single stage (&lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt;) of QAOA.&lt;/p&gt;&#xA;&lt;p&gt;I know that in a in a real quantum device, the entire statevector isn't calculated (the whole point of quantum computing!) but rather multiple 'shots' are processed to build up a statistical picture.&lt;/p&gt;&#xA;&lt;p&gt;Using these inputs, a typical solver like COBYLA won't work as well as they assume each function value they get is true. As such, getting the best possible &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; &amp;amp; &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; values is harder than when using the statevector simulation, which can get arbitarily close as &lt;a href=&quot;https://youtu.be/E0Sos_lR-kI?t=1212&quot; rel=&quot;nofollow noreferrer&quot;&gt;this guide says&lt;/a&gt;. Is this where the need for multiple stages of the QAOA comes from? We cannot get as high quality angles with shot based simulators and so we need more stages ?&lt;/p&gt;&#xA;&lt;p&gt;I first noticed this when trying to solve the MIS problem using the statevector simulator in qiskit and was getting perfect results each time up to &lt;span class=&quot;math-container&quot;&gt;$N=14$&lt;/span&gt; nodes, which seemed a little crazy. At first, I thought this was perhaps due to the QAOA being 'good' at this sort of problem and thought I would have to simulate at higher &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;'s before more stages were needed. I then tried the same setup on a MAXCUT (&lt;span class=&quot;math-container&quot;&gt;$N=12$&lt;/span&gt;) problem and got the same outcome: QAOA always finding an optimum solution with just one stage. I know from &lt;a href=&quot;https://arxiv.org/abs/1812.01041&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; that multiple stages were needed for MAXCUT at the same region of N's (and graph complexity) and so this is what leads me to think QAOA evaluates perfectly when the entire statevector is calculated. Am I correct ?&lt;/p&gt;&#xA;&lt;p&gt;EDIT: I've included the Qiskit Code I've used to generate this.&lt;/p&gt;&#xA;&lt;p&gt;For completion I've included all my code but the &lt;em&gt;relevant bit is outside of all the functions&lt;/em&gt;. Here is what these functions do:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;weighted_erdos_graph&lt;/code&gt; generates an Erdos-Renyi graph using the standard networkx implementation with randomly weighted nodes. &lt;code&gt;own_maximum_weighted_independent_set_qubo&lt;/code&gt; Is taken from D-Wave, and generates the QUBO for a given graph. This is in the form of a dictionary which &lt;code&gt;convert_to_array&lt;/code&gt; converts to a numpy array for ease of manipulation.  &lt;code&gt;the_auto_doco_mod&lt;/code&gt; (I had Wallace and Gromit on the mind...) takes this numpy array and converts this to a &lt;code&gt;QuadracticProgram&lt;/code&gt;, with the binary variables interpretted as quadractics (I know this is a bit hacky, but it works).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ, Aer, QuantumCircuit, ClassicalRegister, QuantumRegister, execute&#xA;from qiskit.aqua import aqua_globals, QuantumInstance&#xA;from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver&#xA;from qiskit.optimization.algorithms import MinimumEigenOptimizer, RecursiveMinimumEigenOptimizer&#xA;from qiskit.optimization import QuadraticProgram&#xA;from qiskit.optimization.applications.ising.docplex import get_operator&#xA;import numpy as np&#xA;from docplex.mp.model import Model&#xA;from docplex.cp.expression import binary_var_list&#xA;&#xA;######### Functions ####################&#xA;&#xA;def own_maximum_weighted_independent_set_qubo(G, weight=None, lagrange=2.0):&#xA;    &amp;quot;&amp;quot;&amp;quot;Return the QUBO with ground states corresponding to a maximum weighted independent set.&#xA;&#xA;    Parameters&#xA;    ----------&#xA;    G : NetworkX graph&#xA;&#xA;    weight : string, optional (default None)&#xA;        If None, every node has equal weight. If a string, use this node&#xA;        attribute as the node weight. A node without this attribute is&#xA;        assumed to have max weight.&#xA;&#xA;    lagrange : optional (default 2)&#xA;        Lagrange parameter to weight constraints (no edges within set)&#xA;        versus objective (largest set possible).&#xA;&#xA;    Returns&#xA;    -------&#xA;    QUBO : dict&#xA;       The QUBO with ground states corresponding to a maximum weighted independent set.&#xA;&#xA;    Examples&#xA;    --------&#xA;&#xA;    &amp;gt;&amp;gt;&amp;gt; from dwave_networkx.algorithms.independent_set import maximum_weighted_independent_set_qubo&#xA;    ...&#xA;    &amp;gt;&amp;gt;&amp;gt; G = nx.path_graph(3)&#xA;    &amp;gt;&amp;gt;&amp;gt; Q = maximum_weighted_independent_set_qubo(G, weight='weight', lagrange=2.0)&#xA;    &amp;gt;&amp;gt;&amp;gt; Q[(0, 0)]&#xA;    -1.0&#xA;    &amp;gt;&amp;gt;&amp;gt; Q[(1, 1)]&#xA;    -1.0&#xA;    &amp;gt;&amp;gt;&amp;gt; Q[(0, 1)]&#xA;    2.0&#xA;&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    # empty QUBO for an empty graph&#xA;    if not G:&#xA;        return {}&#xA;&#xA;    # We assume that the sampler can handle an unstructured QUBO problem, so let's set one up.&#xA;    # Let us define the largest independent set to be S.&#xA;    # For each node n in the graph, we assign a boolean variable v_n, where v_n = 1 when n&#xA;    # is in S and v_n = 0 otherwise.&#xA;    # We call the matrix defining our QUBO problem Q.&#xA;    # On the diagnonal, we assign the linear bias for each node to be the negative of its weight.&#xA;    # This means that each node is biased towards being in S. Weights are scaled to a maximum of 1.&#xA;    # Negative weights are considered 0.&#xA;    # On the off diagnonal, we assign the off-diagonal terms of Q to be 2. Thus, if both&#xA;    # nodes are in S, the overall energy is increased by 2.&#xA;    cost = dict(G.nodes(data='node_weight', default=1))&#xA;    scale = max(cost.values())&#xA;    Q = {(node, node): min(-cost[node] / scale, 0.0) for node in G}&#xA;    Q.update({edge: lagrange for edge in G.edges})&#xA;&#xA;    return Q&#xA;&#xA;def weighted_erdos_graph(nodes, prob, seed =None):&#xA;    &amp;quot;&amp;quot;&amp;quot;Generates an erdos graph with weighted nodes&#xA;    https://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93R%C3%A9nyi_model&#xA;    Node weights randomly assigned with the same seed as the erdos graph&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    graph = nx.erdos_renyi_graph(n=nodes, p =prob, seed=seed, directed=False)&#xA;    np.random.seed(seed)&#xA;    graph_weights = np.random.randint(10,size = nodes)&#xA;&#xA;    for i in range(0,nodes):&#xA;        graph.nodes[i][&amp;quot;node_weight&amp;quot;] = graph_weights[i]&#xA;    #print(list(graph.nodes(data=True)))&#xA;    return graph&#xA;&#xA;&#xA;def the_auto_doco_mod(qubo_array,model_name,constant):&#xA;&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    Function that takes the   QUBO array created for a graphing problem and converts it to a docplex model&#xA;    ready for qiskit&#xA;&#xA;    Directly constructs the quadractic program with reference to this page&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    number_of_variables = len(qubo_array[1]) # gets the number of variables from the length of the square qubo matrix&#xA;    #mdl = Model('model_name')&#xA;    mod = QuadraticProgram()&#xA;&#xA;    for variable in range(0,number_of_variables): # creates the binary variables from the size of the matrix&#xA;        var_name = &amp;quot;x_&amp;quot; +str(variable)&#xA;        mod.binary_var(name =var_name)&#xA;&#xA;    mod.minimize(quadratic =qubo_array)  # can put in all constraints as quadractic as the binary variables mean that x_0 ^ 2 = x_0 in both cases&#xA;                                                    #  not sure of the impact of this on performance however&#xA;&#xA;    print(mod.export_as_lp_string())&#xA;&#xA;    return mod&#xA;def convert_to_array(dictionary):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;    Function to convert qubo dictionary from dwave into a numpy array &#xA;&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;&#xA;   ####### Generate the matrix ##########&#xA;    key_list = dictionary.keys()&#xA;    matrix_size= np.max([element[0] for element in key_list])  # gets the matrix size by taking the biggest number from the list of keys: a bit hacky but hey, it's 3 am&#xA;    qubo = np.zeros((matrix_size +1, matrix_size +1))&#xA;&#xA;    ###### Adds diagonal values ######&#xA;&#xA;    for item in dictionary.items():&#xA;&#xA;        position = item[0]&#xA;        value = item[1]&#xA;&#xA;&#xA;        qubo[position] = value&#xA;&#xA;    return qubo&#xA;&#xA;################## Graph Generation, QUBO &amp;amp; QuadracticProgram Formulation #######&#xA;erdos_14_7_456 = gp.weighted_erdos_graph(12,0.7,456)&#xA;erdos_14_array=  convert_to_array(own_maximum_weighted_independent_set_qubo(erdos_14_7_456))&#xA;qp = the_auto_doco_mod(erdos_14_array,'Erdos 14',2)&#xA;&#xA;&#xA;######### Setting up the Statevector Simulator #######&#xA;&#xA;aqua_globals.random_seed = np.random.default_rng(123)&#xA;seed = 1456&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;&#xA;###### Generating the Circuit #####&#xA;quantum_instance = QuantumInstance(backend,seed_simulator=seed, seed_transpiler=seed)&#xA;&#xA;######## Algorithms ########&#xA;qaoa = QAOA(quantum_instance=quantum_instance, p = 1)&#xA;exact_mes = NumPyMinimumEigensolver()&#xA;&#xA;######### Applying the solvers ########&#xA;qaoa_optimizer = MinimumEigenOptimizer(qaoa)&#xA;exact = MinimumEigenOptimizer(exact_mes)&#xA;&#xA;########## Results ########&#xA;qaoa_result = qaoa_optimizer.solve(qp)&#xA;print(&amp;quot;Qaoa\n&amp;quot;,qaoa_result)&#xA;&#xA;&#xA;np_result = exact.solve(qp)&#xA;print(&amp;quot;Numpy\n&amp;quot;,np_result)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This gives the output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;Qaoa&#xA; optimal function value: -2.2222222222222223&#xA;optimal value: [0. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0. 0.]&#xA;status: SUCCESS&#xA;Numpy&#xA; optimal function value: -2.2222222222222223&#xA;optimal value: [0. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0. 0.]&#xA;status: SUCCESS&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14866" LastEditorUserId="14866" LastEditDate="2021-03-02T00:21:06.527" LastActivityDate="2021-03-28T17:54:17.673" Title="Statevector Simulation of QAOA always finds exact solution" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;&lt;qaoa&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16276" PostTypeId="1" CreationDate="2021-02-28T15:28:51.603" Score="4" ViewCount="112" Body="&lt;p&gt;The Stinespring dilation theorem states that any CPTP map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; on a system with Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; can be represented as &lt;span class=&quot;math-container&quot;&gt;$$\Lambda[\rho]=tr_\mathcal{A}(U^\dagger (\rho\otimes |\phi\rangle\langle \phi|)U)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt; is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Ancilla_bit&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancilla&lt;/a&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; is an arbitrary pure state, and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary on the joint system &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\otimes\mathcal{A}$&lt;/span&gt;. Importantly, this works for &lt;em&gt;any&lt;/em&gt; choice of the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; -- that is,  neither does &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; have to depend on &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;, nor is a specific choice of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; required.&lt;/p&gt;&#xA;&lt;p&gt;Would this representation still be valid if, instead of attaching an ancilla in the pure state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\langle\phi|$&lt;/span&gt;, we instead attached an ancilla in some arbitrary mixed state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;? That is, given  a state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt;, I would like to know whether&#xA;for every CPTP channel &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;,&#xA;there exists a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\otimes\mathcal{A}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Lambda[\rho]=tr_\mathcal{A}(U^\dagger (\rho\otimes \sigma)U).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15028" LastEditorUserId="491" LastEditDate="2021-03-03T13:12:46.943" LastActivityDate="2021-03-03T13:12:46.943" Title="In Stinespring dilation, can we always use a mixed state as the ancilla?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;tensor-product&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16277" PostTypeId="1" CreationDate="2021-02-28T16:57:17.180" Score="3" ViewCount="35" Body="&lt;p&gt;Lots of papers about quantum memories talk about the efficiency generally or the storage/retrieval efficiency as a figure of merit. What exactly does this term mean?&lt;/p&gt;&#xA;&lt;p&gt;My intuition would be that it would be related to the fidelity between the state that goes into the memory and the state that comes out, since I would have thought that was the most important figure of merit, but the same papers also talk about fidelity, so it can't be that. And why is it important that it is high?&lt;/p&gt;&#xA;&lt;p&gt;My understanding of quantum memory is that you want to store a state for a long time with little decoherence, but that seems to only depend on the fidelity.&lt;/p&gt;&#xA;" OwnerUserId="5277" LastEditorUserId="55" LastEditDate="2021-03-01T20:15:48.720" LastActivityDate="2021-03-01T20:15:48.720" Title="What does the term efficiency mean when talking about quantum memories?" Tags="&lt;notation&gt;&lt;quantum-memory&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16278" PostTypeId="1" AcceptedAnswerId="16285" CreationDate="2021-02-28T17:18:11.780" Score="2" ViewCount="24" Body="&lt;p&gt;I have the following operators acting on two qubits, denoted as &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$T_1=\displaystyle\exp\left(-i\frac{\pi}{4}Z\otimes Z\right)\cdot R_z^{(1)}\left(\frac{\pi}{2}\right)\cdot R_z^{(2)}\left(\frac{\pi}{2}\right),\quad T_2=R_y^{(2)}\left(-\frac{\pi}{2}\right)\cdot C_Z\cdot R_y^{(2)}\left(\frac{\pi}{2}\right).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I should prove that up to global phases &lt;span class=&quot;math-container&quot;&gt;$T_1=C_Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2=C_X$&lt;/span&gt; (the controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates).&lt;/p&gt;&#xA;&lt;p&gt;For convenience, I omit the labels for the qubits, which should be clear by the ordering. Using the usual expansion for rotations, I ended up finding&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$T_1=\frac{1}{2\sqrt 2}(\mathbb I\otimes\mathbb{I}-iZ\otimes Z)(\mathbb I\otimes \mathbb I-iZ\otimes\mathbb I)(\mathbb I\otimes \mathbb I-i\mathbb I \otimes Z)=\frac{1+i}{\sqrt 2}\begin{pmatrix} -Z \\ &amp;amp; \mathbb I\end{pmatrix},\\ T_2=\frac{1}{2}(\mathbb I\otimes \mathbb I+i\mathbb I\otimes Y)C_Z(\mathbb I\otimes \mathbb I-i\mathbb I\otimes Y)=\begin{pmatrix} \mathbb I  &amp;amp; \\ &amp;amp; X\end{pmatrix}.$$&lt;/span&gt;&#xA;So, I've checked the calculations a few times and it looks like there is something wrong with the first operator. Here's the catch: there was a mistake in the original &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; I was given that I had to change in order to find the correct sequence to obtain a &lt;span class=&quot;math-container&quot;&gt;$C_X$&lt;/span&gt;, and there might be a similar problem with &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; (unless I am of course making some mistake somewhere). Does anyone see what the issue may be?&lt;/p&gt;&#xA;&lt;p&gt;(As a reference, &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; comes from the interaction shift in NMR computing, while &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; from Wineland's experiment with trapped ions).&lt;/p&gt;&#xA;" OwnerUserId="14654" LastActivityDate="2021-03-01T07:54:31.410" Title="Expanding two rotation operators" Tags="&lt;pauli-gates&gt;&lt;trapped-ion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16279" PostTypeId="2" ParentId="16268" CreationDate="2021-02-28T18:09:42.017" Score="3" Body="&lt;p&gt;To extract the statevector with qiskit, you can do the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua import QuantumInstance&#xA;from qiskit.circuit import QuantumCircuit&#xA;from qiskit import Aer, execute&#xA;&#xA;qc= QuantumCircuit(2, 2)&#xA;qc.h(0)&#xA;qc.cx(0,1)&#xA;print(qc )&#xA;quantum_instance = QuantumInstance(backend = Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;), shots= 1)&#xA;Result = quantum_instance.execute(qc) &#xA;print('Statevector:', Result.get_statevector() )&#xA;&#xA;     ┌───┐     &#xA;q_0: ┤ H ├──■──&#xA;     └───┘┌─┴─┐&#xA;q_1: ─────┤ X ├&#xA;          └───┘&#xA;c: 2/══════════&#xA;               &#xA;Statevector: [0.70710678+0.j 0.        +0.j 0.        +0.j 0.70710678+0.j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-02-28T18:09:42.017" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16281" PostTypeId="1" CreationDate="2021-02-28T19:46:23.077" Score="3" ViewCount="79" Body="&lt;p&gt;This is a follow-up question to solve for parameters of a controlled &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate. Suppose I have the unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat{n} = (n_x,n_y,n_z)$&lt;/span&gt; and an angle &lt;span class=&quot;math-container&quot;&gt;$\xi$&lt;/span&gt; (assume we know both of them). Then, we could calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\begin{aligned}&#xA;R_{\hat{n}}(\xi) &amp;amp;= \cos(\frac{\xi}{2})I-i\sin(\frac{\xi}{2})(\hat{n}\cdot\vec\sigma)\\&#xA;&amp;amp;= \cos(\frac{\xi}{2})I-i\sin(\frac{\xi}{2})\begin{bmatrix}&#xA;n_z &amp;amp; n_x-in_y\\&#xA;n_x+in_y &amp;amp; -n_z&#xA;\end{bmatrix}\\&#xA;&amp;amp;=\begin{bmatrix}&#xA;\cos(\frac{\xi}{2})-i\sin(\frac{\xi}{2})n_z &amp;amp; -i\sin(\frac{\xi}{2})(n_x-in_y)\\&#xA;-i\sin(\frac{\xi}{2})(n_x+in_y) &amp;amp; \cos(\frac{\xi}{2})+i\sin(\frac{\xi}{2})n_z&#xA;\end{bmatrix}&#xA;\end{aligned}&#xA;\end{align}&#xA;$$&lt;/span&gt;&#xA;Then, an arbitrary single qubit rotation could be written as &lt;span class=&quot;math-container&quot;&gt;$U = e^{i\alpha}R_{\hat{n}}(\xi)$&lt;/span&gt;. Assume we also know the value of &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, how can we implement the controlled-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; in qiskit? I'm really confused with how can I utilize the (controlled) &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate, which is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U_3(\theta,\phi,\lambda)=&#xA;\begin{bmatrix} &#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\&#xA;e^{i\phi} \sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right)&#xA;\end{bmatrix}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;More specifically, if we want to implement the controlled version of &lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U = e^{i\alpha}R_{\hat{n}}(\xi)&#xA;\end{align}&lt;/span&gt;&#xA;Which should be treated as &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt;? &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$R_{\hat n}(\xi)$&lt;/span&gt;? Any suggestions for figuring out the arguments of &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt;? Do I need to worry about phase kickback?&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot for the help!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-03-02T01:59:09.597" LastActivityDate="2021-03-02T01:59:09.597" Title="Implementing controlled $U_3$ gate from $R_{\hat{n}}$ with given parameters" Tags="&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16282" PostTypeId="2" ParentId="16271" CreationDate="2021-02-28T20:56:29.163" Score="4" Body="&lt;p&gt;Qiskit includes &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.WeightedAdder.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;an adder in the circuit library&lt;/a&gt;. Here is a quick introduction to it.&lt;/p&gt;&#xA;&lt;p&gt;Let's say you wan to add two numbers, one of them is three-bit-long, the other one two-bit-long numbers. You will need a 5 qubit adder. That's the first parameter to &lt;code&gt;qiskit.circuit.library.WeightedAdder&lt;/code&gt;. The second parameter is the &lt;em&gt;weight&lt;/em&gt; of each of these qubits. Because the fist value is composed by &lt;span class=&quot;math-container&quot;&gt;$q_0 \times  2^0 + q_1 \times 2^1 + q_2 \times  2^2$&lt;/span&gt;, each of the weights is &lt;span class=&quot;math-container&quot;&gt;$2^0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2^1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$2^2$&lt;/span&gt;. The same applies to the second two-bit summand.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library.arithmetic import WeightedAdder&#xA;circuit = WeightedAdder(5, [1, 2, 4, 1, 2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This creates a circuit, partially printed here:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;  state_0: ──■────■────■──────────■────■──────────■────■─────────■────────»&#xA;             │    │    │          │    │          │    │         │        »&#xA;  state_1: ──┼────┼────┼──────────┼────┼──────────┼────┼─────────┼────────»&#xA;             │    │    │          │    │          │    │         │        »&#xA;  state_2: ──┼────┼────┼──────────┼────┼──────────┼────┼─────────┼────────»&#xA;             │    │    │          │    │          │    │         │        »&#xA;  state_3: ──┼────┼────┼──────────┼────┼──────────┼────┼─────────┼────────»&#xA;             │    │    │          │    │          │    │         │        »&#xA;  state_4: ──┼────┼────┼──────────┼────┼──────────┼────┼─────────┼────────»&#xA;             │  ┌─┴─┐  │   ┌───┐  │    │          │    │         │        »&#xA;    sum_0: ──■──┤ X ├──┼───┤ X ├──┼────┼──────────┼────┼─────────┼────────»&#xA;             │  └───┘  │   └───┘┌─┴─┐  │   ┌───┐  │    │         │        »&#xA;    sum_1: ──┼─────────■────────┤ X ├──┼───┤ X ├──┼────┼─────────┼────────»&#xA;             │         │        └─┬─┘  │   └───┘┌─┴─┐  │  ┌───┐  │   ┌───┐»&#xA;    sum_2: ──┼─────────┼──────────┼────■────────┤ X ├──┼──┤ X ├──■───┤ X ├»&#xA;             │         │          │    │        └─┬─┘┌─┴─┐└───┘  │   └───┘»&#xA;    sum_3: ──┼─────────┼──────────┼────┼──────────┼──┤ X ├───────┼────────»&#xA;           ┌─┴─┐       │          │    │          │  └─┬─┘       │        »&#xA;  carry_0: ┤ X ├───────■──────────■────┼──────────┼────┼─────────┼────────»&#xA;           └───┘     ┌─┴──┐            │          │    │         │        »&#xA;  carry_1: ──────────┤0   ├────────────■──────────■────┼─────────■────────»&#xA;                     │    │          ┌─┴──┐            │       ┌─┴──┐     »&#xA;  carry_2: ──────────┤  X ├──────────┤0   ├────────────■───────┤0   ├─────»&#xA;                     │    │          │  X │                    │  X │     »&#xA;control_0: ──────────┤1   ├──────────┤1   ├────────────────────┤1   ├─────»&#xA;                     └────┘          └────┘                    └────┘     »&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let's now measure the quantum registers &lt;code&gt;sum&lt;/code&gt; and &lt;code&gt;carry&lt;/code&gt; to extract the result of the computation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import ClassicalRegister&#xA;&#xA;sum_result = ClassicalRegister(4, name='sum_result')&#xA;carry_result = ClassicalRegister(3, name='carry_result')&#xA;circuit.add_register(sum_result)&#xA;circuit.add_register(carry_result)&#xA;q_sum = circuit.qregs[1]&#xA;q_carry = circuit.qregs[2]&#xA;&#xA;circuit.measure(q_sum, sum_result)&#xA;circuit.measure(q_carry, carry_result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And now, let's create value summands. For example, &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; (three-bit length) and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; (two-bit length)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;value1 = QuantumCircuit(3, name='value1')&#xA;value2 = QuantumCircuit(2, name='value2')&#xA;&#xA;# bin(4) == 0b100&#xA;value1.x(2)&#xA;&#xA;# bin(2) == 0b10&#xA;value2.x(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The inputs should be appended to the front of the adder circuit, like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.compose(value1.to_gate(), qubits=[0, 1 ,2], front=True, inplace=True)&#xA;circuit.compose(value2.to_gate(), qubits=[3, 4], front=True, inplace=True)&#xA;&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;                ┌─────────┐                                                    »&#xA;       state_0: ┤0        ├──■────■────■──────────■────■──────────■────■───────»&#xA;                │         │  │    │    │          │    │          │    │       »&#xA;       state_1: ┤1 value1 ├──┼────┼────┼──────────┼────┼──────────┼────┼───────»&#xA;                │         │  │    │    │          │    │          │    │       »&#xA;       state_2: ┤2        ├──┼────┼────┼──────────┼────┼──────────┼────┼───────»&#xA;                ├─────────┤  │    │    │          │    │          │    │       »&#xA;       state_3: ┤0        ├──┼────┼────┼──────────┼────┼──────────┼────┼───────»&#xA;                │  value2 │  │    │    │          │    │          │    │       »&#xA;       state_4: ┤1        ├──┼────┼────┼──────────┼────┼──────────┼────┼───────»&#xA;                └─────────┘  │  ┌─┴─┐  │   ┌───┐  │    │          │    │       »&#xA;         sum_0: ─────────────■──┤ X ├──┼───┤ X ├──┼────┼──────────┼────┼───────»&#xA;                             │  └───┘  │   └───┘┌─┴─┐  │   ┌───┐  │    │       »&#xA;         sum_1: ─────────────┼─────────■────────┤ X ├──┼───┤ X ├──┼────┼───────»&#xA;                             │         │        └─┬─┘  │   └───┘┌─┴─┐  │  ┌───┐»&#xA;         sum_2: ─────────────┼─────────┼──────────┼────■────────┤ X ├──┼──┤ X ├»&#xA;                             │         │          │    │        └─┬─┘┌─┴─┐└───┘»&#xA;         sum_3: ─────────────┼─────────┼──────────┼────┼──────────┼──┤ X ├─────»&#xA;                           ┌─┴─┐       │          │    │          │  └─┬─┘     »&#xA;       carry_0: ───────────┤ X ├───────■──────────■────┼──────────┼────┼───────»&#xA;                           └───┘     ┌─┴──┐            │          │    │       »&#xA;       carry_1: ─────────────────────┤0   ├────────────■──────────■────┼───────»&#xA;                                     │    │          ┌─┴──┐            │       »&#xA;       carry_2: ─────────────────────┤  X ├──────────┤0   ├────────────■───────»&#xA;                                     │    │          │  X │                    »&#xA;     control_0: ─────────────────────┤1   ├──────────┤1   ├────────────────────»&#xA;                                     └────┘          └────┘                    »&#xA;  sum_result: 4/═══════════════════════════════════════════════════════════════»&#xA;                                                                               »&#xA;carry_result: 3/═══════════════════════════════════════════════════════════════»&#xA;                                                                               »&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, it is time to run the circuit and see how it works:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import BasicAer, execute&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;&#xA;result = execute(circuit, backend).result()&#xA;&#xA;result.get_counts()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'000 0110': 1024}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result is &lt;span class=&quot;math-container&quot;&gt;$4+2 = 6$&lt;/span&gt; (&lt;code&gt;int('0110', base=2)&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-02-28T20:56:29.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16283" PostTypeId="2" ParentId="16257" CreationDate="2021-02-28T22:13:40.407" Score="0" Body="&lt;p&gt;A nice place to look is always the qiskit textbook!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14866" LastActivityDate="2021-02-28T22:13:40.407" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16285" PostTypeId="2" ParentId="16278" CreationDate="2021-03-01T07:54:31.410" Score="3" Body="&lt;p&gt;I agree with your calculation for &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; starting from your expansion of the operations (the second set of equations). Since there's a couple of possible different conventions for the definition of, for example &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt;, I cannot be certain that the expansion itself is correct. Indeed, it requires relatively minor modification to make things work. For example, if you replace both of the &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; rotation angles in the statement for &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt; rotation angles, it all works happily.&lt;/p&gt;&#xA;&lt;p&gt;It may assist you to know the way that I do this calculation. For &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;, you've got 3 matrix exponentials, all of which are using diagonal operators. This means they all commute and hence can be grouped together as a single exponential.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T_1=e^{-i\pi Z_1Z_2/4}e^{i\pi Z_1/4}e^{i\pi Z_2/4}=e^{i\pi(Z_1+Z_2-Z_1Z_2)/4}&#xA;$$&lt;/span&gt;&#xA;So I can just concentrate on the diagonal elements of these,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_1+Z_2-Z_1Z_2=\text{diag}(1,1,1,-3)&#xA;$$&lt;/span&gt;&#xA;I can add (or subtract) identity matrices as this only contributes a global phase&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_1+Z_2-Z_1Z_2-I=\text{diag}(0,0,0,-4).&#xA;$$&lt;/span&gt;&#xA;So when I multiply by &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;, I'll get a &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; for the final element which, exponentiated, gives the -1 I need.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-01T07:54:31.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16286" PostTypeId="2" ParentId="16268" CreationDate="2021-03-01T08:42:08.357" Score="2" Body="&lt;p&gt;Just note that &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are not probabilities but amplitudes. A qubit is in general described as superpositon &lt;span class=&quot;math-container&quot;&gt;$|q\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;. Probability of measuring &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and probability of measuring &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can see both probabilities and state vector in circuit composer on IBM Q. For example assume a simple circuit described by matrix &lt;span class=&quot;math-container&quot;&gt;$HX$&lt;/span&gt; which transforms &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$&lt;/span&gt;. Probability of measuring 0 and 1 is 50 % in both cases. State vector is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 1 \end{pmatrix}$&lt;/span&gt;. You can see this output in the figure below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/mH4v5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mH4v5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-01T08:42:08.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16287" PostTypeId="2" ParentId="16276" CreationDate="2021-03-01T11:09:25.660" Score="7" Body="&lt;p&gt;No, that doesn't work. It's fine to use an arbitrary pure state because the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can always be used to take it to any pure state you want. This argument doesn't work for a mixed state, as unitaries cannot take mixed states to pure states.&lt;/p&gt;&#xA;&lt;p&gt;As a concrete example, consider the CPTP map&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \Lambda(\rho) = |0\rangle\langle 0| \operatorname{tr}(\rho), $$&lt;/span&gt;&#xA;and let &lt;span class=&quot;math-container&quot;&gt;$\sigma = I/d_{\mathcal A}$&lt;/span&gt;, the maximally mixed state on &lt;span class=&quot;math-container&quot;&gt;$\mathcal A$&lt;/span&gt;. If you now apply this CPTP map to &lt;span class=&quot;math-container&quot;&gt;$I/d_{\mathcal H}$&lt;/span&gt;, the maximally mixed state on &lt;span class=&quot;math-container&quot;&gt;$\mathcal H$&lt;/span&gt;, you should get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \langle 0|$&lt;/span&gt;, but&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \operatorname{tr}_\mathcal{A}(U^\dagger (\rho\otimes \sigma)U) = \operatorname{tr}_\mathcal{A}(U^\dagger (I/d_{\mathcal H}\otimes I/d_{\mathcal A})U) = I/d_{\mathcal H}$$&lt;/span&gt;&#xA;for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastEditorUserId="491" LastEditDate="2021-03-02T11:05:36.390" LastActivityDate="2021-03-02T11:05:36.390" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16288" PostTypeId="2" ParentId="16265" CreationDate="2021-03-01T11:50:13.987" Score="2" Body="&lt;p&gt;This question makes more sense in density matrix notation. You can then ask how to prove that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (|\psi\rangle\langle \psi|)^T = |\psi^*\rangle\langle \psi^*|.$$&lt;/span&gt;&#xA;It's not difficult, just write the state in some basis, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_i \alpha_i |i\rangle$&lt;/span&gt;, and apply the operations.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-03-01T11:50:13.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16289" PostTypeId="2" ParentId="16265" CreationDate="2021-03-01T12:05:39.497" Score="4" Body="&lt;p&gt;Think about that projector&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho=|\psi\rangle\langle\psi|.&#xA;$$&lt;/span&gt;&#xA;Note that this is Hermitian, &lt;span class=&quot;math-container&quot;&gt;$\rho^\dagger=\rho$&lt;/span&gt;. Take the transpose,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;{\rho^\dagger}^T=\rho^T&#xA;$$&lt;/span&gt;&#xA;but since the hermitian conjugate is the complex conjugate transpose, &lt;span class=&quot;math-container&quot;&gt;${\rho^\dagger}^T=\rho^\star$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you want to see what pure state &lt;span class=&quot;math-container&quot;&gt;$\rho^\star=|\phi\rangle\langle\phi|$&lt;/span&gt; corresponds to, think of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as a matrix and find a non-zero column. That column is proportional to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. The same column of &lt;span class=&quot;math-container&quot;&gt;$\rho^\star$&lt;/span&gt; is proportional to &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. It should thus be clear that &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=|\psi^\star\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-01T12:05:39.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16290" PostTypeId="1" AcceptedAnswerId="16291" CreationDate="2021-03-01T17:30:23.417" Score="4" ViewCount="75" Body="&lt;p&gt;A quantum state preparation machine emits a state &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$2/3$&lt;/span&gt; and emits the state &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt;. We aim to make the best guess which one is it using a set of two POVM operators &lt;span class=&quot;math-container&quot;&gt;$\{E_0,E_1\}$&lt;/span&gt;. The probability of success is simply:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;p_{\text{succ}}=\frac{2}{3}\text{tr}(E_0\rho_0)+\frac{1}{3}\text{tr}(E_1\rho_1).&#xA;\end{equation}&lt;/span&gt;&#xA;How to find the POVMs such that &lt;span class=&quot;math-container&quot;&gt;$p_{\text{succ}}$&lt;/span&gt; is maximized? Note that the states need not be necessarily qubits, they can be general &lt;em&gt;qudits&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My guess is that we can take &lt;span class=&quot;math-container&quot;&gt;$E_0=\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E_1=I-\rho_0$&lt;/span&gt;, in which case, if the density matrices have a corresponding pure orthonormal states, we have &lt;span class=&quot;math-container&quot;&gt;$p_{\text{succ}}=1$&lt;/span&gt;, which should be the case. But how to check if that is optimal?&lt;/p&gt;&#xA;" OwnerUserId="4889" LastEditorUserId="55" LastEditDate="2021-05-23T18:22:12.477" LastActivityDate="2021-05-23T18:22:12.477" Title="How to find the POVM that optimally distinguishes between two given states?" Tags="&lt;measurement&gt;&lt;probability&gt;&lt;povm&gt;&lt;state-discrimination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16291" PostTypeId="2" ParentId="16290" CreationDate="2021-03-01T19:56:51.563" Score="3" Body="&lt;p&gt;The optimal probability of guessing correctly is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12 + \frac12 \Big\|\frac23 \rho_0 - \frac13 \rho_1 \Big\|_1&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\| X \|_1 = \mathrm{Tr}[\sqrt{X^* X}]$&lt;/span&gt; is the Schatten 1-norm. This success probability is achieved by the POVM with operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_0 = \Pi_{[\tfrac23 \rho_0 - \tfrac13 \rho_1]_+} \qquad E_1=I-E_0&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$[X]_+$&lt;/span&gt; denotes the positive part of the Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in the Hanh-Jordan decomposition and &lt;span class=&quot;math-container&quot;&gt;$\Pi_Y$&lt;/span&gt; denotes the projector onto the image of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. Recall the Hanh-Jordan decomposition says we can decompose any Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$X= X_+ - X_-$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$X_+,X_-$&lt;/span&gt; are both positive-semidefinite matrices. This optimal distinguishing is known as the Holevo-Helstrom Theorem, see &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' TQI&lt;/a&gt; for a proof for example.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2021-03-02T11:03:44.180" LastActivityDate="2021-03-02T11:03:44.180" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16292" PostTypeId="2" ParentId="16142" CreationDate="2021-03-01T22:34:25.703" Score="4" Body="&lt;p&gt;First of all, electron transport in nanotechnology is nothing new. For example, Nitzan and Ratner wrote a &lt;a href=&quot;https://science.sciencemag.org/content/300/5624/1384.abstract&quot; rel=&quot;nofollow noreferrer&quot;&gt;review paper&lt;/a&gt; on electronic transport  in molecular wires in 2003, and Google Scholar says that review paper has 2631 citations at the time of me writing this answer.&lt;/p&gt;&#xA;&lt;p&gt;Electron transport (even at room temperature!) is fundamental to the mechanism of photosynthesis and cellular respiration, as most people will know if they have taken high school biology classes. So most people working in the area of artificial photosynthesis, will have seen room-temperature demonstrations of electron transport, even in human-made and lab-controlled artificial systems. There was a &lt;a href=&quot;https://pubs.acs.org/doi/10.1021/ar400076j&quot; rel=&quot;nofollow noreferrer&quot;&gt;review paper written on this subject in 2013&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;So achieving electronic transport at room temperature in a human-made and lab-controlled device, is nothing that the company mentioned in your question, has invented.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The only difference is that they did it in a &amp;quot;single qubit&amp;quot;.&lt;br&gt;&#xA;But what do they mean by &amp;quot;single qubit&amp;quot;?&lt;/p&gt;&#xA;&lt;p&gt;I see nothing in the PDF that you gave us, that tells us even what type of qubits they are trying to make. Examples of &amp;quot;types&amp;quot; of qubits are superconducting qubits, nuclear spins (NMR quantum computing), qubits in ion traps, quantum dot excitons, electron spins (ESR or EPR quantum computing), photonic qubits, etc.&lt;/p&gt;&#xA;&lt;p&gt;Since they are talking about &amp;quot;room temperature&amp;quot;, we can rule out superconducting qubits. NMR-based quantum devices with many qubits, tend to operate at room temperature anyway, &lt;a href=&quot;https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.108.130501&quot; rel=&quot;nofollow noreferrer&quot;&gt;for example in this 4-qubit experiment that was done in 2012&#xA;&lt;/a&gt;, so a &amp;quot;single qubit&amp;quot; operating at room temperature and not having any quantum computing gates applied to it, is &lt;em&gt;&lt;strong&gt;not impressive&lt;/strong&gt;&lt;/em&gt; to me, if they're doing NMR-based quantum computing (here the challenge is in going beyond the &lt;a href=&quot;https://www.nature.com/articles/s41534-017-0045-z&quot; rel=&quot;nofollow noreferrer&quot;&gt;12 qubits&lt;/a&gt; which is the current maximum I've seen in an NMR-based quantum computer). ESR-based quantum computing is similar to NMR, and I don't see why &amp;quot;electron transport&amp;quot; is needed for any of the other types of qubits.&lt;/p&gt;&#xA;&lt;p&gt;More generally:&lt;br&gt;&#xA;&lt;strong&gt;Electron transport is &lt;em&gt;not&lt;/em&gt; a requirement for quantum computing.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, the &lt;a href=&quot;https://en.wikipedia.org/wiki/DiVincenzo%27s_criteria#Statement_of_the_criteria&quot; rel=&quot;nofollow noreferrer&quot;&gt;DiVincenzo criteria&lt;/a&gt; for making a quantum computer, do not say anything about needing electron transport.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;I am trying to assess the significance of electronic transport measurements being performed on a single qubit at room temperature, as claimed in the below press release: &lt;a href=&quot;https://archerx.com.au/src/uploads/2021/02/20210222_Electronic-transport-in-a-single-qubit-achieved-ASX-Release.pdf%22&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://archerx.com.au/src/uploads/2021/02/20210222_Electronic-transport-in-a-single-qubit-achieved-ASX-Release.pdf&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That PDF unfortunately does not show every much at all. Now to be fair to them, for-profit companies often don't show the public a lot of detail about what they're doing, especially while their technology is still under development. The academic job market is extremely competitive, and &lt;em&gt;sometimes&lt;/em&gt; is not fair, which means that a lot of very talented people with science training turn to starting a company and seeking venture capital funding to continue doing science, rather than getting funded through the university system, but the private investors providing the funds will want money to eventually return to them, and the chances of that happening are lowered if a competing company is able to know every detail about how the other company is building their technology since they can use that to put the same product on the market earlier. In universities, research grants are not expected to be &amp;quot;paid back&amp;quot; via future profits, and it's enough to publish a lot of papers that were made possible by the grant money, but more and more scientists are not getting the opportunity to access such research grants as long-term university jobs become less and less available.&lt;/p&gt;&#xA;&lt;p&gt;So I don't want to be unfair to the company you mentioned in your question. At the same time, &amp;quot;achieving room-temperature electron transport in a single qubit&amp;quot; is not relevant for the most popular type of quantum computing right now (which uses superconducting qubits), not impressive in the context of NMR-based or ESR-based quantum computing (where room-temperature quantum computations have been done with several qubits, since many years ago), and unnecessary in most other types of qubits.&lt;/p&gt;&#xA;&lt;p&gt;Near the end of the PDF in your question, they cite &lt;a href=&quot;https://www.nature.com/articles/ncomms12232?origin=ppub&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; on which the second author is the CEO of the company in question. This is the only paper by anyone related to the company, which is actually cited in the PDF, and it's from 5 years ago, and it has had an unfortunately low number of citations despite being published in Nature Communications. This indicates that the work has not managed to penetrate the interest of the broader scientific community. The end of the abstract says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;These results demonstrate the feasibility of operating electron spins in conducting carbon nanospheres as quantum bits at room-temperature.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Maybe 5 years later when the PDF in your question was written, they were referring to this &amp;quot;feasibility&amp;quot; now turning into &amp;quot;reality&amp;quot;, meaning that they managed to make &lt;em&gt;&lt;strong&gt;one&lt;/strong&gt;&lt;/em&gt; qubit using electron spins in conducting carbon nanospheres at room temperature.&lt;/p&gt;&#xA;&lt;p&gt;Considering that every single company &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_quantum_processors&quot; rel=&quot;nofollow noreferrer&quot;&gt;listed here&lt;/a&gt; has already made devices with at least a couple dozen qubits, the &lt;em&gt;&lt;strong&gt;single-qubit&lt;/strong&gt;&lt;/em&gt; result at room temperature seems to be years or decades away from turning into anything competitive with what already exists on the market.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Finally:&lt;/strong&gt; People often hear &amp;quot;milli-Kelvin&amp;quot; and think &amp;quot;wow quantum computers require extremely low temperatures, that's bad&amp;quot;. But the dilution fridge required for helium-based cooling of qubits in D-Wave, Google, IBM, Rigetti and most other companies that make quantum hardware, is not really very expensive (compared to everything else) nor &amp;quot;extreme&amp;quot; in this field. Not only do techniques like &amp;quot;laser cooling&amp;quot; and &amp;quot;evaporative cooling&amp;quot; help several labs around the world reach nano-Kelvin, pico-Kelvin, and even &lt;a href=&quot;https://en.wikipedia.org/wiki/Negative_temperature&quot; rel=&quot;nofollow noreferrer&quot;&gt;negative temperatures&lt;/a&gt; (so the milli-Kelvin temperatures of D-Wave's hardware, for example, are not actually &amp;quot;extreme&amp;quot;), working at low temperatures can be a &lt;strong&gt;good thing&lt;/strong&gt; in quantum computing. Decoherence rates will be much lower. Sure the company mentioned in your question might be able to (sometime in the future!) make a device with more than just one qubit, but if their goal is to work at room temperature, then &lt;strong&gt;I worry that decoherence could be a major problem.&lt;/strong&gt; If they show us the decoherence times for their qubit at room-temperature, and show us that it's possible to apply 2-qubit gates and connect together dozens of qubits, then it might be something worth looking at in more detail, but they seem to be years or decades away from that.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-01T22:43:36.287" LastActivityDate="2021-03-01T22:43:36.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16293" PostTypeId="1" CreationDate="2021-03-01T22:42:00.180" Score="1" ViewCount="41" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Let's say I have a qubit&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; = (\alpha_1 + i\alpha_2 ) \left|0\right&amp;gt; + (\beta_1 + i\beta_2 )\left|1\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;so when we measure it will calculate &lt;span class=&quot;math-container&quot;&gt;$|\alpha_1 + i\alpha_2|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta_1 + i\beta_2|^2$&lt;/span&gt; ,and it will give the state with highest probability.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;enter preformatted text here&#xA;&#xA;vector = [159+625j,3+71j]  &#xA;&#xA;print(vector)&#xA;norm = np.linalg.norm(vector)&#xA;print(norm)&#xA;qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;print('initial state is')&#xA;print(initial_state)&#xA;qc.initialize(initial_state, 0) &#xA;qc.x(0) ###### for not gate&#xA;qc.h(0) ####### for hadamard gate&#xA;a = qc.draw() &#xA;print(a)&#xA;&#xA;simulator = Aer.get_backend('statevector_simulator') &#xA;qobj = assemble(qc)     # Create a Qobj from the circuit for the simulator to run&#xA;result = simulator.run(qobj).result() # Do the simulation and return the result&#xA;out_state = result.get_statevector()&#xA;print(out_state)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now the code to run on Quantum computer is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;enter preformatted text here&#xA;IBMQ.load_account()&#xA;#provider = IBMQ.get_provider = ('ibm-q')&#xA;provider = IBMQ.load_account()&#xA;qcomp= provider.get_backend('ibmq_qasm_simulator')&#xA;job = execute(qc,backend=qcomp)&#xA;from qiskit.tools.monitor import  job_monitor&#xA;job_monitor(job)&#xA;result = job.result()&#xA;plot_histogram(result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;when we run this on Quantum computer we will get a graph with probabilities on it are those probabilities calculated using &lt;span class=&quot;math-container&quot;&gt;$|\alpha_1 + i\alpha_2|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta_1 + i\beta_2|^2$&lt;/span&gt; these formulas?&#xA;is it possible to extract in the form of a complex number like &lt;span class=&quot;math-container&quot;&gt;$a+ib$&lt;/span&gt; not just like 0.865 or something like that, can I see what are my &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;'s and  &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; 's after measuring?&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="2293" LastEditDate="2021-03-02T14:38:03.130" LastActivityDate="2021-03-02T14:38:03.130" Title="Can I see Probability in complex form after measuring the state of the qubit on quantum computer?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16294" PostTypeId="1" CreationDate="2021-03-01T23:28:05.193" Score="0" ViewCount="58" Body="&lt;p&gt;I was running this code on a quantum computer how can I generate a state vector for each shot while running on a quantum computer?&lt;/p&gt;&#xA;&lt;p&gt;qikit code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;## initiate alpha beta with own values&#xA;vector = [alpha,beta]&#xA;print('non normalised vector form a multi vector is')&#xA;print(vector)&#xA;norm = np.linalg.norm(vector)&#xA;print(norm)&#xA;&#xA;qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;print('initial state is')&#xA;print(initial_state)&#xA;qc.initialize(initial_state, 0) &#xA;qc.x(0) ###### for not gate&#xA;qc.h(0) ####### for hadamard gate&#xA;a = qc.draw() &#xA;print(a)&#xA;&#xA;simulator = Aer.get_backend('statevector_simulator') &#xA;qobj = assemble(qc)     # Create a Qobj from the circuit for the simulator to run&#xA;result = simulator.run(qobj).result() # Do the simulation and return the result&#xA;out_state = result.get_statevector()&#xA;print(out_state)&#xA;&#xA;&#xA;&#xA; from qiskit import IBMQ&#xA;&#xA; IBMQ.load_account()&#xA; #provider = IBMQ.get_provider = ('ibm-q')&#xA; provider = IBMQ.load_account()&#xA; qcomp= provider.get_backend('ibmq_qasm_simulator')&#xA; job = execute(qc,backend=qcomp)&#xA; from qiskit.tools.monitor import  job_monitor&#xA; job_monitor(job)&#xA; result = job.result()&#xA; plot_histogram(result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-03-02T09:05:20.383" LastActivityDate="2021-04-01T10:05:35.537" Title="How do I get sate vector for each shot running on a quantum computer?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16295" PostTypeId="2" ParentId="16294" CreationDate="2021-03-02T00:20:32.657" Score="0" Body="&lt;p&gt;You can use the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.extensions.Snapshot.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit Snapshot extension&lt;/a&gt;. Here is an example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer.extensions.snapshot import Snapshot&#xA;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit import QuantumCircuit, execute, Aer&#xA;&#xA;circuit = QuantumCircuit(1, 1)&#xA;circuit.h(0)&#xA;circuit.measure([0], [0])&#xA;circuit.snapshot('final', snapshot_type='statevector')&#xA;&#xA;print(circuit)&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;job = execute(circuit, backend, shots = 10)&#xA;result = job.result()&#xA;pprint(result.data(0)['snapshots'])&#xA;&#xA;     ┌───┐┌─┐┌───────┐&#xA;q_0: ┤ H ├┤M├┤ final ├&#xA;     └───┘└╥┘└───────┘&#xA;c: 1/══════╩══════════&#xA;           0          &#xA;{'statevector': {'final': [array([1.+0.j, 0.+0.j]),&#xA;                           array([1.+0.j, 0.+0.j]),&#xA;                           array([0.+0.j, 1.+0.j]),&#xA;                           array([0.+0.j, 1.+0.j]),&#xA;                           array([0.+0.j, 1.+0.j]),&#xA;                           array([1.+0.j, 0.+0.j]),&#xA;                           array([1.+0.j, 0.+0.j]),&#xA;                           array([0.+0.j, 1.+0.j]),&#xA;                           array([1.+0.j, 0.+0.j]),&#xA;                           array([0.+0.j, 1.+0.j])]}}&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-02T00:20:32.657" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16296" PostTypeId="2" ParentId="12916" CreationDate="2021-03-02T01:17:39.010" Score="6" Body="&lt;h1&gt;(1) Both filters and attenuators are used&lt;/h1&gt;&#xA;&lt;p&gt;Let me just start by saying that non-attenuating filters have not been completely ruled out by people working in the design of cold quantum computers. I will use quotes from three papers, all from 2018, to support this point.&lt;/p&gt;&#xA;&lt;h3&gt;Paper #1: &lt;a href=&quot;https://arxiv.org/abs/1801.00467&quot; rel=&quot;nofollow noreferrer&quot;&gt;Distinguishing coherent and thermal photon noise in a circuit QED system&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;These residual cavity photons arise from a variety of sources, e.g. thermal microwave photons from blackbody radiation that is&#xA;improperly attenuated &lt;em&gt;&lt;strong&gt;or filtered&lt;/strong&gt;&lt;/em&gt; in the cryogenic environment&#xA;[12].&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Note that the authors mention that the photons have to be attenuated &lt;em&gt;&lt;strong&gt;or filtered.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Further improvement may be possible with more careful choice of &lt;em&gt;&lt;strong&gt;attenuator/filter&lt;/strong&gt;&lt;/em&gt; configuration or active cooling techniques.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Notice that the authors mention both attenuators and filters together here.&lt;/p&gt;&#xA;&lt;h3&gt;Paper #2: &lt;a href=&quot;https://arxiv.org/abs/1806.07862&quot; rel=&quot;nofollow noreferrer&quot;&gt;Engineering cryogenic setups for 100-qubit scale superconducting circuit systems&lt;/a&gt;&lt;/h3&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;RF lines on the other hand are realized&#xA;as semi-rigid microwave cables and contain various microwave components&#xA;such as attenuators, &lt;em&gt;&lt;strong&gt;filters&lt;/strong&gt;&lt;/em&gt; or amplifiers.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Again the authors do not rule out the use of filters!&lt;/p&gt;&#xA;&lt;h3&gt;Paper #3: &lt;a href=&quot;https://arxiv.org/abs/1807.04849&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cavity Attenuators for Superconducting Qubits&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;This coupling opens a channel for auxiliary components in the&#xA;microwave wiring to affect the temperature of the cavity mode. Examples of such components are commercial cryogenic attenuators, &lt;em&gt;&lt;strong&gt;filters&lt;/strong&gt;&lt;/em&gt;, isolators, etc.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Again the authors do not rule out the use of filters, and later they even say that their cavity attenuator acts as a type of Purcell filter:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;the cavity attenuator filters out off-resonance radiation and thus further suppresses the radiative decay of the qubit [11, 12], acting as an effective Purcell filter [39].&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h1&gt;(2) Attenuators have been compared directly to filters and attenuators were better!&lt;/h1&gt;&#xA;&lt;p&gt;In &amp;quot;Paper #2&amp;quot; mentioned above, they did an experiment in which a &lt;em&gt;&lt;strong&gt;non-attenuating filter&lt;/strong&gt;&lt;/em&gt; was compared to various attenuators:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;&amp;quot;As a control experiment, we also measured an aluminum filter with identical dimensions to the copper attenuator that however&#xA;provides no attenuation on resonance.&amp;quot;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The results show that the non-attenuating (aluminum) filter had significantly faster &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; decoherence times than the brass cavity attenuator beyond about 70 mK, and had up to almost &lt;strong&gt;80 micro-seconds&lt;/strong&gt; faster &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; decoherence times than the brass cavity attenuator. Furthermore, up to at least 70 mK, the ratio of &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; was notably worse in the non-attenuating filter compared to both the brass and copper cavity attenuators:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ua2s9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ua2s9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1&gt;(3) It is not only the frequencies near the qubit frequency which are important&lt;/h1&gt;&#xA;&lt;p&gt;This is for many reasons.&lt;/p&gt;&#xA;&lt;p&gt;There may be many approximate theories of quantum dissipation, in which the frequencies of the spectral density that are closest to the qubit frequency are the only ones that have a profound effect, but in the formally exact Feynman-Vernon formalism, all frequencies can have an impact on the qubit's decoherence.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$J(\omega)$&lt;/span&gt; is the spectral density, then the bath response function involving the Bose-Einstein distribution function will be:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{1}&#xA;\alpha(t) = \frac{1}{\pi}\int_0^\infty J(\omega)\left(  \coth\left( \frac{\beta\omega\hbar}{2} \cos(\omega t) - \textrm{i}\sin(\omega t) \right) \right)\textrm{d}\omega.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that we have integrated over &lt;em&gt;&lt;strong&gt;all frequencies.&lt;/strong&gt;&lt;/em&gt; This then enters the Feynman-Vernon influence functional:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{2}&#xA;I = \exp\left( -\frac{1}{\hbar}\int_0^t \int_0^{t^\prime} \left( s^+(t^\prime) - s^-(t^\prime) \right)\left( \alpha(t^\prime - t^{\prime \prime})s^+(t^{\prime \prime}) - \alpha^*(t^\prime - t^{\prime \prime})s^-(t^{\prime\prime}) \right)  \right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This single functional, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, is 100% of what you need in order to calculate the dynamics of an open quantum system when given the system Hamiltonian, temperature, initial system density matrix, and assuming that &lt;span class=&quot;math-container&quot;&gt;$\rho(t=0)$&lt;/span&gt; of the system plus bath is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{3}&#xA;\rho(t=0) = \rho_{\textrm{system}}(t=0) \otimes \frac{e^{-\beta H}}{\textrm{tr}\left(e^{-\beta H}\right)},~~~~~~~~\beta\equiv \frac{1}{k_BT}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This means that the influence functional that tells you how the environment of a qubit affects it, involves a kernel &lt;span class=&quot;math-container&quot;&gt;$\alpha(t-t^\prime)$&lt;/span&gt; which does not only depend on the qubit frequency, but involves an &lt;em&gt;&lt;strong&gt;integral over all &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another reason is that when you build a quantum computer with 100s of qubits, there's more system frequencies involved than just the single frequency between the two energy levels of a qubit. There's frequencies associated with 2-qubit gates and such, so again the qubit frequency is not the only important frequency.&lt;/p&gt;&#xA;&lt;h1&gt;(4) Dissipation is not always bad.&lt;/h1&gt;&#xA;&lt;p&gt;Most of the papers I've seen talking about attenuation in superconducting qubits are by William Oliver's group at the MIT Lincoln Laboratory, which happens to be a group that is trying to make adiabatic quantum annealers that are like D-Wave's but with also &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; coupling (so that they have a better chance at doing universal quantum computation somewhat efficiently). The superconducting qubits at the MIT Lincoln Lab, plus the ones at D-Wave (both of them are aiming to do quantum &lt;em&gt;&lt;strong&gt;annealing&lt;/strong&gt;&lt;/em&gt; and not circuit-based quantum computation, constitute a large fraction of all superconducting qubits in the world, and remember that &lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://arxiv.org/abs/cond-mat/0609332&quot; rel=&quot;nofollow noreferrer&quot;&gt;noise can actually help in the annealing process&lt;/a&gt;.&lt;/strong&gt;&lt;/em&gt; If you're interested in how dissipation can help with quantum annealing, you might find it more intuitive to first look at:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://aip.scitation.org/doi/10.1063/1.3002335&quot; rel=&quot;nofollow noreferrer&quot;&gt;Environment-assisted quantum walks&lt;/a&gt;, and&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/10/11/113019/meta&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dephasing-assisted quantum transport&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Even for quantum computing that does not use quantum annealing at all, Paper #2 listed above, says:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;in most of the lines attenuation&#xA;and thus dissipation is anyway &lt;em&gt;&lt;strong&gt;desired&lt;/strong&gt;&lt;/em&gt; in order to thermalize the incoming&#xA;radiation fields, see Section 2.2.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;meaning that dissipation is sometimes desired, so you don't want to remove all of it.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-04T19:46:11.107" LastActivityDate="2021-03-04T19:46:11.107" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16297" PostTypeId="2" ParentId="16293" CreationDate="2021-03-02T08:44:48.220" Score="1" Body="&lt;p&gt;You can use state vector simulator on IBM Q to get amplitudes but this is simulation.&lt;/p&gt;&#xA;&lt;p&gt;In practise, you have to use quantum tomography to get the state vector. In short, the tomography allows you to look at a quantum state from &lt;em&gt;different angles&lt;/em&gt; which actually means to measure copies of the state in different basis. See more information &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To do so for one qubit, the link provided by &lt;em&gt;KAJ226&lt;/em&gt; is the most useful way how to do so easily.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-02T08:44:48.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16298" PostTypeId="1" AcceptedAnswerId="16300" CreationDate="2021-03-02T12:23:07.020" Score="0" ViewCount="36" Body="&lt;p&gt;In section 2.5 of the Qiskit textbook, it states that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; are examples of unitary Hermitian matrices.  As I understand it, this means that the following rule applies: &lt;span class=&quot;math-container&quot;&gt;$$UU^\dagger=U^\dagger U=1$$&lt;/span&gt;&#xA;I can't get the second part of this to work.  Taking &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; as an example: &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0 &amp;amp; 1\\1  &amp;amp; 0\end{bmatrix}.\begin{bmatrix}0 &amp;amp; 1\\1  &amp;amp; 0\end{bmatrix}$$&lt;/span&gt;&#xA;We can immediately see that &lt;span class=&quot;math-container&quot;&gt;$U U^ \dagger=U^\dagger U$&lt;/span&gt; (as they're the same), but when I do an inner product, I get: &lt;span class=&quot;math-container&quot;&gt;$$(0\times0)+(1\times1)+(1\times1)+(0\times0)=2$$&lt;/span&gt;&#xA;Am I doing my matrix multiplication wrong, or am I forgetting something?&lt;/p&gt;&#xA;" OwnerUserId="14827" LastEditorUserId="4889" LastEditDate="2021-03-02T12:47:26.273" LastActivityDate="2021-03-02T13:25:28.817" Title="Textbook 2.5 (Qiskit) - Unitary and Hermitian matrices" Tags="&lt;qiskit&gt;&lt;textbook-and-exercises&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16300" PostTypeId="2" ParentId="16298" CreationDate="2021-03-02T12:54:06.897" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$UU^{\dagger}=I$&lt;/span&gt; rather than &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&#xA;Simply multiply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0&#xA;\end{pmatrix} \times \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0&#xA;\end{pmatrix} = \begin{pmatrix} (0\times0) + (1\times1) &amp;amp; (0\times1)+(1\times0) \\ (1\times0) + (0\times1) &amp;amp; (1\times1) + (0\times0)\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It'll make more sense if you remember that appending &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}$&lt;/span&gt; one after the other in a circuit will make them equivalent to an identity gate, i.e. the net effect is cancelled out. For example, &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle=|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H|+\rangle=|0\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10376" LastEditorUserId="10376" LastEditDate="2021-03-02T13:25:28.817" LastActivityDate="2021-03-02T13:25:28.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16301" PostTypeId="1" AcceptedAnswerId="16311" CreationDate="2021-03-02T14:13:26.760" Score="0" ViewCount="57" Body="&lt;p&gt;Nowadays quantum learning is hiring. And we can see mainly two different area. One of them is variational algorithms part. And the other one is classical learning for quantum systems like NISQ. (Some of scientists call both areas as quantum learning wheras some scientists call the second one as a classical learning for quantum system)&#xA;Regarding variational part, there are many libraries like tensorflow quantum, qiskit ...&#xA;But for the second part, I would like to learn what is good. For instance we can simulate photonic chips with Simphony or gds helpers. But my aim is not to simulate photonic chips. My aim is to train integrated photonic chips for noises. So which libraries are good for that. For instance is cirq enough for that? or should I use another libraries? Or should I start to simulate my chip and after that I should use some additional libraries like tensorflow quantum or qiskit or cirq?&lt;/p&gt;&#xA;" OwnerUserId="13548" LastActivityDate="2021-03-03T13:51:21.223" Title="What are the libararies for Machine Learning on NISQ Chip? And What are the roadmaps?" Tags="&lt;qiskit&gt;&lt;cirq&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;nisq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16302" PostTypeId="1" AcceptedAnswerId="16303" CreationDate="2021-03-02T14:54:35.217" Score="6" ViewCount="154" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0010117&quot; rel=&quot;noreferrer&quot;&gt;A 2000 paper&lt;/a&gt; by Nayak and Vishwanath provides an analysis of the dynamics of quantum random walks. In this paper, they mention a &amp;quot;naive&amp;quot; approach to defining a walk. I include the quote as follows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In direct analogy, one may naively try to define quantum walk on the&#xA;line as follows: at every time step, the particle moves, in&#xA;superposition, both left and right with equal amplitudes (perhaps with&#xA;a relative phase difference). However, such a walk is physically&#xA;impossible, since the global process is non-unitary.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Intuitively, I imagine this is the case because, without further qualification, it seems that the various probability amplitudes would interfere constructively and lead to a wavefunction that was not normalized. Although it still seems like it might be possible to induce a relative phase difference such that normalization is achieved.&lt;/p&gt;&#xA;&lt;p&gt;How does one prove/verify the author's statement in a formal way that would be satisfying to theorists?&lt;/p&gt;&#xA;" OwnerUserId="14990" LastActivityDate="2021-03-02T15:10:20.117" Title="How to prove that a naive quantum random walk is non-unitary" Tags="&lt;quantum-walks&gt;&lt;dynamics&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16303" PostTypeId="2" ParentId="16302" CreationDate="2021-03-02T15:10:20.117" Score="6" Body="&lt;p&gt;I'm going to define &lt;span class=&quot;math-container&quot;&gt;$|n\rangle$&lt;/span&gt; to be &amp;quot;the walker is at site &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;&amp;quot;. Now imagine the walk as specified:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|n\rangle\rightarrow (|n-1\rangle+|n+1\rangle)/\sqrt{2}.&#xA;$$&lt;/span&gt;&#xA;You can put some phases in if you want to, it's not going to change my basic argument. Now, imagine this is implemented by a unitary operator. This means that we need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle n-1|U^\dagger U|n+1\rangle=0&#xA;$$&lt;/span&gt;&#xA;since &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary and the two walker positions &lt;span class=&quot;math-container&quot;&gt;$n\pm 1$&lt;/span&gt; are distinguishable.&lt;/p&gt;&#xA;&lt;p&gt;However, calculate what is given by the desired walk:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle n-1|U^\dagger U|n+1\rangle=\frac{1}{\sqrt{2}}(\langle n-2|+\langle n|)\frac{1}{\sqrt{2}}(|n\rangle+|n+2\rangle)=\frac12\neq 0.&#xA;$$&lt;/span&gt;&#xA;Hence, this desired operation is not unitary.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-02T15:10:20.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16304" PostTypeId="1" CreationDate="2021-02-28T16:42:16.843" Score="0" ViewCount="73" Body="&lt;p&gt;The Stinespring dilation theorem states that any CPTP map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; on a system with Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; can be represented as &lt;span class=&quot;math-container&quot;&gt;$$\Lambda[\rho]=tr_\mathcal{A}(U^\dagger (\rho\otimes |\phi\rangle\langle \phi|)U)$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt; is an &lt;a href=&quot;https://en.wikipedia.org/wiki/Ancilla_bit&quot; rel=&quot;nofollow noreferrer&quot;&gt;ancilla&lt;/a&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; is an arbitrary pure state, and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary on the joint system &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\otimes\mathcal{A}$&lt;/span&gt;. Importantly, this works for &lt;em&gt;any&lt;/em&gt; choice of the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; -- that is,  neither does &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; have to depend on &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;, nor is a specific choice of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\in\mathcal{A}$&lt;/span&gt; required.&lt;/p&gt;&#xA;&lt;p&gt;Would this representation still be valid if, instead of attaching an ancilla in the pure state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\langle\phi|$&lt;/span&gt;, we instead attached an ancilla in some arbitrary mixed state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;? That is, given  a state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt;, I would like to know whether&#xA;for every CPTP channel &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;,&#xA;there exists a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}\otimes\mathcal{A}$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Lambda[\rho]=tr_\mathcal{A}(U^\dagger (\rho\otimes \sigma)U).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15028" OwnerDisplayName="Jacob Drori" LastEditorUserId="23" LastEditDate="2021-04-11T12:08:05.307" LastActivityDate="2021-04-11T12:08:05.307" Title="Stinespring dilation using ancilla in mixed state?" Tags="&lt;density-matrix&gt;&lt;linear-algebra&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16305" PostTypeId="2" ParentId="16276" CreationDate="2021-03-01T12:16:33.003" Score="4" Body="&lt;p&gt;No. If you take &lt;span class=&quot;math-container&quot;&gt;$\sigma=\tfrac1{d_A}\mathbb I$&lt;/span&gt;, you will have that for &lt;span class=&quot;math-container&quot;&gt;$\rho=\tfrac1{d_S}\mathbb I$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_A(U^\dagger(\rho\otimes\sigma)U)=\tfrac1{d_S}\mathbb I\ ,&#xA;$$&lt;/span&gt;&#xA;and thus, it will not be possible to implement any channel for which&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda(\tfrac1{d_S}\mathbb I)\ne \tfrac1{d_S}\mathbb I\ ,&#xA;$$&lt;/span&gt;&#xA;such as any channel mapping all inputs to a constant output other than the identity.&lt;/p&gt;&#xA;" OwnerUserId="491" OwnerDisplayName="Norbert Schuch" LastActivityDate="2021-03-01T12:16:33.003" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16307" PostTypeId="1" CreationDate="2021-03-02T17:39:18.537" Score="1" ViewCount="86" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I have a qubit&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; = (\alpha_1 + i\alpha_2 ) \left|0\right&amp;gt; + (\beta_1 + i\beta_2 )\left|1\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;so if i give values  &lt;span class=&quot;math-container&quot;&gt;$\alpha_1 + i\alpha_2 = 1 + 4i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta_1 + i\beta_2 = 3 + 4i$&lt;/span&gt; i will nomralise these and give it to psi&lt;/p&gt;&#xA;&lt;p&gt;now when I measure using qiskit and plot it will be like 0.6 in state zero and 0.4 in state is there any way that I can make it an equal probability?&lt;/p&gt;&#xA;&lt;p&gt;I tried passing it through Hadamard gate but it does not give me equal probability.&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-03-03T03:24:59.540" LastActivityDate="2021-03-03T03:24:59.540" Title="How to get a qubit into superposition?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16308" PostTypeId="2" ParentId="16301" CreationDate="2021-03-02T17:42:21.223" Score="2" Body="&lt;p&gt;Here's some examples:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;IBM: Aqua&lt;/li&gt;&#xA;&lt;li&gt;Google: Tensor-Quantum&lt;/li&gt;&#xA;&lt;li&gt;Xanadu: PennyLane&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15082" LastEditorUserId="2293" LastEditDate="2021-03-03T13:51:21.223" LastActivityDate="2021-03-03T13:51:21.223" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16310" PostTypeId="2" ParentId="16257" CreationDate="2021-03-02T18:57:40.907" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/playlist?list=PLOFEBzvs-VvrXTMy5Y2IqmSaUjfnhvBHR&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/playlist?list=PLOFEBzvs-VvrXTMy5Y2IqmSaUjfnhvBHR&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Videos 13 14 and 15 are for QEC. But, you can watch the playlist for more reference&lt;/p&gt;&#xA;" OwnerUserId="14741" LastActivityDate="2021-03-02T18:57:40.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16311" PostTypeId="2" ParentId="16301" CreationDate="2021-03-02T19:38:40.183" Score="3" Body="&lt;p&gt;You will have very limited support simulating photonic circuits in Cirq (and therefore Tensorflow Quantum). Those libraries mainly deal with evolving systems of qubits where a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is expressed over a discrete basis like &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_i c_i |i\rangle$&lt;/span&gt;, as opposed to photonic systems containing continous variables (such as a wavefunction &lt;span class=&quot;math-container&quot;&gt;$\psi(x)$&lt;/span&gt; expressed in the basis of a continous operator &lt;span class=&quot;math-container&quot;&gt;$\hat{x}$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;One of the main uses for Tensorflow Quantum is when you have an algorithm that involves both a quantum simulation part and a classical processing part that interact. For example a parameterized quantum circuit and some kind of neural network layer that are both trained using gradient-based optimizers, then the library is able to efficiently simulate both the circuit and its derivatives which are then propagated through both of the layers to differentiate a given cost function. This does not sound like a good fit for your application since you would need to outsource the circuit simulation to a different program.&lt;/p&gt;&#xA;&lt;p&gt;Maybe check out &lt;a href=&quot;https://quantum-journal.org/papers/q-2019-03-11-129/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Strawberry Fields&lt;/a&gt; since this was designed for photonic simulation and &lt;a href=&quot;https://pennylane-sf.readthedocs.io/en/latest/&quot; rel=&quot;nofollow noreferrer&quot;&gt;interfaces with Xanadu's Pennylane&lt;/a&gt; and so should have similar capabilities as I described above, but for a photonic qc simulator. I'm not very familiar with the library so I don't know what kind of support it has for device noise.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-03-02T19:38:40.183" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16312" PostTypeId="2" ParentId="16307" CreationDate="2021-03-02T20:04:35.360" Score="1" Body="&lt;p&gt;The Hadamard gate put the states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; into uniform superposition but not for any arbitrary state.&lt;/p&gt;&#xA;&lt;p&gt;You can check that: &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1&amp;amp; 1\\ 1 &amp;amp; -1 \\ \end{pmatrix} \begin{pmatrix} 1 \\ 0\end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; and similarly, you can show that  &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}}$&lt;/span&gt;.  In each case, the probability to see a &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\big| 1/\sqrt{2}\big|^2 = 1/2. $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you have an arbitrary single qubit state, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle $&lt;/span&gt; then you can show that &lt;span class=&quot;math-container&quot;&gt;$H|\psi\rangle = (\alpha + \beta)|0\rangle + (\alpha - \beta)|1\rangle$&lt;/span&gt;, so the probability of seeing the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\big| \alpha + \beta|^2$&lt;/span&gt;, and the probability of seeing the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\big| \alpha - \beta \big|^2$&lt;/span&gt;, thus they are not the same. So applying the Hadamard gate to an arbitrary state does not bring it to a uniform superposition state.&lt;/p&gt;&#xA;&lt;p&gt;Of course, you can find a Unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that maps the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to the uniform superposition state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt;. But from all your previous questions, it seems like you are using Qiskit for the work that you are doing. What you can do is to reset the particular qubit you are interesting in to the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state through the &lt;code&gt;reset&lt;/code&gt; option, then apply the Hadamard gate. This is probably the easiest. Below is an example of how to do reset:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;qreg_q = QuantumRegister(1, 'q')&#xA;creg_c = ClassicalRegister(1, 'c')&#xA;circuit = QuantumCircuit(qreg_q, creg_c)&#xA;circuit.ry(1.213, qreg_q[0])  #A quantum state that is not in uniform superposition&#xA;circuit.reset(qreg_q[0]) # reset the qubit to |0&amp;gt;&#xA;circuit.h(qreg_q[0]) # Apply the Hadamard  gate &#xA;print(circuit)&#xA;&#xA;     ┌───────────┐     ┌───┐&#xA;q_0: ┤ RY(1.213) ├─|0&amp;gt;─┤ H ├&#xA;     └───────────┘     └───┘&#xA;c: 1/═══════════════════════&#xA;                            &#xA;&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-02T20:04:35.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16313" PostTypeId="1" AcceptedAnswerId="16319" CreationDate="2021-03-02T21:03:14.410" Score="2" ViewCount="87" Body="&lt;p&gt;We know that quantum computers use the wave-like nature of quantum mechanics to perform interference. Sometimes we can use this interference to perform specific algorithms that will cause enough interference to have speedup relative to a classical computer.&lt;/p&gt;&#xA;&lt;p&gt;But, generally speaking, are quantum speedups always due to parallelization of a given problem?&lt;/p&gt;&#xA;&lt;p&gt;The converse statement might be more clear: Is there an example of quantum speedup for an algorithm in which the classical equivalent is not parallelizable?&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&#xA;To try to make this even more clear, imagine that I have a classical problem that I will apply some &lt;em&gt;specific classical code&lt;/em&gt; to solve (such as searching for a certain element in a list by looping through each element and checking if it matches the described element).&lt;/p&gt;&#xA;&lt;p&gt;Practically speaking: If I were to optimize this code with a GPU, I would identify what parts of my code can be parallelized. (and I probably wouldn't be thinking of things like P=NP). For GPUs, I don't think I need to solve some general proof about P=NP or  NP = CP in order to get an intuitive sense that GPUs speed up code when things can be parallelized.&lt;/p&gt;&#xA;&lt;p&gt;Are quantum computers the same? Generally speaking (in the same way I am thinking about GPU speedup), are speedups always do to parallelization?&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="55" LastEditDate="2021-03-03T01:55:28.690" LastActivityDate="2021-03-03T10:05:27.940" Title="Generally speaking, are quantum speedups always due to parallelization of a given problem?" Tags="&lt;classical-computing&gt;&lt;speedup&gt;&lt;quantum-advantage&gt;" AnswerCount="2" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16314" PostTypeId="1" AcceptedAnswerId="16315" CreationDate="2021-03-02T21:07:08.007" Score="2" ViewCount="282" Body="&lt;p&gt;I am currently reading through &lt;a href=&quot;https://arxiv.org/abs/1805.11807&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; and read some of the wikipedia pages on &lt;a href=&quot;https://en.wikipedia.org/wiki/Weak_measurement#cite_note-Brun2002-1&quot; rel=&quot;nofollow noreferrer&quot;&gt;weak measurement&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum tomography&lt;/a&gt; and I am curious if weak measurement could be used to break BB84 quantum key distribution. In particular: couldn't an eavesdropper estimate the states going through the channel? Especially since there are only 4 possible states to estimate.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="55" LastEditDate="2021-03-03T03:23:55.750" LastActivityDate="2021-04-08T11:39:05.943" Title="Can quantum state tomography break bb84?" Tags="&lt;tomography&gt;&lt;bb84&gt;&lt;qkd&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16315" PostTypeId="2" ParentId="16314" CreationDate="2021-03-02T21:18:07.590" Score="5" Body="&lt;p&gt;No, weak measurement and quantum tomography don't break BB84.&lt;/p&gt;&#xA;&lt;p&gt;I recommend that you create an explicit quantum circuit that implements the weak measurement or the quantum tomography, and check for yourself that it actually fails. The basic problem comes down to the fact that there is a trade-off between how much information you get and how likely you are to get caught, and none of the trade-offs that are available are good enough.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="362" LastEditDate="2021-03-02T21:51:08.733" LastActivityDate="2021-03-02T21:51:08.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16316" PostTypeId="2" ParentId="16314" CreationDate="2021-03-02T21:19:06.413" Score="3" Body="&lt;p&gt;Tomography generally speaking uses a collection of measurements to reproduce an underlying state. So you experimentally reproduce the same situation over and over, collect statistics and find the most likely estimate for that state.&lt;/p&gt;&#xA;&lt;p&gt;In QKD, information is sent once and doesn't repeat. So for each unit of information, you're never ever able to collect enough data to infer the underlying state.&lt;/p&gt;&#xA;&lt;p&gt;I should add that Alice and Bob need to make sure that their system overall does not have losses above a certain level, because QKD only works in this circumstance. Too much loss between Alice and Bob means that it might have gone to Eve, and if Eve has too much of the state she can get information out of it.&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="2660" LastEditDate="2021-03-02T21:24:32.160" LastActivityDate="2021-03-02T21:24:32.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16317" PostTypeId="1" AcceptedAnswerId="16318" CreationDate="2021-03-02T21:26:30.403" Score="1" ViewCount="103" Body="&lt;p&gt;What is meant by the term &amp;quot;quantum interference&amp;quot; in the context of quantum computing and quantum algorithms?&lt;/p&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="2293" LastEditDate="2021-03-02T23:40:57.287" LastActivityDate="2021-03-02T23:40:57.287" Title="What is meant by the term &quot;quantum interference&quot;?" Tags="&lt;terminology&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16318" PostTypeId="2" ParentId="16317" CreationDate="2021-03-02T23:11:53.813" Score="1" Body="&lt;p&gt;The term is most often used in the context of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Double-slit_experiment#Interference_of_individual_particles&quot; rel=&quot;nofollow noreferrer&quot;&gt;two-slit experiment&lt;/a&gt;. The interference pattern that you see, which is not simply what you'd get if you added the wavefunction (&lt;span class=&quot;math-container&quot;&gt;$\Psi_A$&lt;/span&gt;) associated with going through slit A to the wavefunction (&lt;span class=&quot;math-container&quot;&gt;$\Psi_B$&lt;/span&gt;) going through slit B, but there is a &amp;quot;mixed&amp;quot; term as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{1}&#xA;|\psi|^2 = |\psi_A + \psi_B|^2 = |\psi_A|^2 +  |\psi_B|^2 + \psi_A^*\psi_B + \psi_A\psi_B^*.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This interference pattern occurs &lt;strong&gt;even when you reduce the number of photons until there's only one photon at a time!&lt;/strong&gt; When there's only one photon at a time, what could it possibly be interfering with to cause the patter on the screen to be different from &lt;span class=&quot;math-container&quot;&gt;$P_A + P_B$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;We say the photon interferes with itself.&lt;/strong&gt; This is a quantum mechanical phenomenon that doesn't exist in classical mechanics.&lt;/p&gt;&#xA;&lt;p&gt;The two-slit experiment was used by Feynman when he explained the Feynman integral, because the Feynman integral is a sum/integral over paths which each have an amplitude. These amplitudes &lt;em&gt;&lt;strong&gt;interfere&lt;/strong&gt;&lt;/em&gt; with each other, which again is a signature of quantum mechanical effects, since classically there would only be one path in the Feynman integral: the path with the smallest Lagrangian action.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-02T23:11:53.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16319" PostTypeId="2" ParentId="16313" CreationDate="2021-03-02T23:40:36.913" Score="2" Body="&lt;p&gt;I can see what you mean. For the Deutsch problem, we can formulate it (or think of it) in such a way that the goal is to evaluate &lt;span class=&quot;math-container&quot;&gt;$f(0)+f(1)$&lt;/span&gt; in base 2. Classically we have to evaluate &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; to get this sum, so we need to do two evaluations of the function to get the answer. A quantum computer only needs to input the superposition state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt; &lt;em&gt;&lt;strong&gt;once&lt;/strong&gt;&lt;/em&gt; and it gets enough information about what the black box function does to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; individually, in order to be able to evaluate the sum modulo two successfully.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;But a classical computer can parallelize the evaluation of &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Are there quantum algorithms that provide a speed-up without this type of parallel evaluation of a function for all possible binary-string inputs?&lt;/p&gt;&#xA;&lt;p&gt;Well there's an entirely different type of quantum computing called &amp;quot;adiabatic quantum computing&amp;quot; or AQC which does not involve gates or circuits. There's a mathematical proof that it is &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405098&quot; rel=&quot;nofollow noreferrer&quot;&gt;equivalent to circuit-based quantum computing&lt;/a&gt; in terms of computational power, from the perspective that AQC devices can simulate all circuit-based quantum computing algorithms with an overhead which is only polynomial scaling with respect to the size of the problem.&lt;/p&gt;&#xA;&lt;p&gt;In AQC, you are solving a problem by efficiently finding the ground state of a Hamiltonian which is &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; in size if there's &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. In the case where the Hamiltonian is diagonal in the computational basis, this problem can be parallelized by just checking each possible state in the computational basis, in parallel. However when the Hamiltonian is not diagonal, the only way to solve the problem (in general) on a classical computer is to find the eigenstate with the smallest eigenvalue, which means solving an eigenvalue problem. The solving of an eigenvalue problem &lt;strong&gt;can be parallelized&lt;/strong&gt; but not in the way that I think your question is considering. It is not the type of parallelization where we are checking &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; things at the same time, and the speed-up due to parallelization is nowhere near the quantum speed-up. Then since circuit-based quantum computers can also simulate adiabatic quantum computers with overhead that only scales polynomially with respect to the input size, we can argue that circuit-based quantum computers can also solve problems that can't be parallelized (in the sense discussed earlier) on a classical computer: in fact we've had circuit-based algorithms for Hamiltonian simulation since before we knew about the proof that AQC and CBQC were equivalent from a computational complexity perspective.&lt;/p&gt;&#xA;&lt;p&gt;Essentially, if you want to find the ground state of a molecule's Hamiltonian, or the ground state of some model condensed matter Hamiltonian (for example) like a  Hubbard Hamiltonian, quantum computers (or quantum &amp;quot;simulators&amp;quot;) can do the job more efficiently (from a computational complexity perspective) compared to classical computers, and while classical computers can attempt to solve the problem in parallel, that parallelization is only whatever small amount of parallelization is possible when solving eigenvalue problems.&lt;/p&gt;&#xA;&lt;p&gt;I don't know if there's any classical computation worth doing on a quantum computer that &lt;em&gt;&lt;strong&gt;cannot at all benefit from parallelization&lt;/strong&gt;&lt;/em&gt; because even the multiplication of two scalar numbers like 13.254621 and 17.169920 is parallelized at some level (for example multiple logic gates in hardware are working in parallel), but if we can interpret your question as parallelization in the Deutsch problem sense, then I would say that the answer is yes.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-02T23:40:36.913" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16320" PostTypeId="1" CreationDate="2021-03-03T02:20:47.113" Score="2" ViewCount="66" Body="&lt;p&gt;I was reading about teleportation I have some question about it. Can I keep normalized data (some customized data) on probability amplitudes (which are complex numbers) of a qubit (Alice's side)?  Then after teleporting this qubit can I retrieve  custom data on the receiving side (called as Bob's side)? Is this possible scenario or not? Is there any Qiskit code running on quantum computer available for this?&lt;/p&gt;&#xA;" OwnerUserId="15087" LastEditorUserId="9006" LastEditDate="2021-03-03T07:40:03.117" LastActivityDate="2021-03-03T07:40:03.117" Title="Can I keep data into qubit and teleport?" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16321" PostTypeId="1" AcceptedAnswerId="16326" CreationDate="2021-03-03T02:30:18.983" Score="3" ViewCount="46" Body="&lt;p&gt;I've referred to some programming language recommendation questions on here, so I thought I'd post a follow-up question here. I'm a total beginner to the field but want to seriously learn it. Is there a low-level, QC-equivalent of assembly language, and is it worth it to learn that at this stage? Do existing QC programming languages provide that low-level functionality?&lt;/p&gt;&#xA;&lt;p&gt;And a minor second clarification - if I commit to learning any particular framework like Qiskit or Q#/QDK - is there a risk of that framework going obsolete depending on which company wins out in this QC race in the future?&lt;/p&gt;&#xA;" OwnerUserId="15088" LastEditorUserId="9006" LastEditDate="2021-03-03T07:41:49.277" LastActivityDate="2021-03-03T07:54:48.717" Title="Should I learn a low-level QC programming language?" Tags="&lt;programming&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16322" PostTypeId="2" ParentId="4975" CreationDate="2021-03-03T04:03:27.093" Score="0" Body="&lt;p&gt;Cirq since 0.10 (you can install it using &lt;code&gt;pip install cirq --pre&lt;/code&gt;) has a function to decompose an arbitrary three qubit unitary &lt;a href=&quot;https://quantum.devsite.corp.google.com/reference/python/cirq/optimizers/three_qubit_matrix_to_operations&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cirq.three_qubit_matrix_to_operations&lt;/code&gt;&lt;/a&gt;. This, combined with &lt;code&gt;cirq.qasm&lt;/code&gt; can generate 1 and 2 qubit gates in OpenQASM 2.0. Note that this is a pretty verbose decomposition (but at most 20 CZs), as it is based on generic &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176&quot; rel=&quot;nofollow noreferrer&quot;&gt;linear algebra decompositions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np &#xA;&#xA;qs = cirq.LineQubit.range(3)&#xA;&#xA;print(cirq.qasm(cirq.Circuit(cirq.three_qubit_matrix_to_operations(qs[0], qs[1], qs[2], 1/2*np.array([&#xA;[1,0,0,1,1,0,0,1],&#xA;[0,1,1,0,0,1,1,0],&#xA;[1,0,0,-1,1,0,0,-1],&#xA;[0,1,-1,0,0,1,-1,0],&#xA;[0,1,1,0,0,-1,-1,0],&#xA;[1,0,0,1,-1,0,0,-1],&#xA;[0,-1,1,0,0,1,-1,0],&#xA;[-1,0,0,1,1,0,0,-1],&#xA;])))))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which will output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;// Generated from Cirq v0.10.0.dev&#xA;&#xA;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;&#xA;// Qubits: [0, 1, 2]&#xA;qreg q[3];&#xA;&#xA;&#xA;u2(pi*0.011229858, pi*-0.011229858) q[1];&#xA;u3(pi*-0.2503051573, pi*-0.4802949152, pi*0.4802949152) q[2];&#xA;rz(pi*-0.5) q[0];&#xA;cz q[1],q[2];&#xA;u3(pi*-0.4860708536, pi*0.511229858, pi*-0.511229858) q[1];&#xA;cz q[1],q[2];&#xA;u3(pi*-0.7496948427, pi*0.0057759385, pi*-0.0057759385) q[2];&#xA;u2(pi*0.011229858, pi*-0.011229858) q[1];&#xA;rz(pi*-0.5254810233) q[2];&#xA;rz(pi*0.9972453689) q[1];&#xA;cx q[1],q[0];&#xA;rz(pi*0.5) q[0];&#xA;cx q[2],q[0];&#xA;rz(pi*-0.5) q[0];&#xA;cx q[1],q[0];&#xA;rz(pi*-0.5) q[0];&#xA;u2(pi*-1.2086038449, pi*1.2086038449) q[1];&#xA;cx q[2],q[0];&#xA;u3(pi*-0.4803325646, pi*-0.0197050848, pi*0.0197050848) q[2];&#xA;ry(pi*0.5) q[0];&#xA;cz q[1],q[2];&#xA;rz(pi*-0.5) q[0];&#xA;u3(pi*-0.2506091478, pi*1.2913961551, pi*-1.2913961551) q[1];&#xA;cz q[1],q[2];&#xA;u3(pi*-0.5196674354, pi*-0.2703142327, pi*0.2703142327) q[2];&#xA;u2(pi*-1.2086038449, pi*1.2086038449) q[1];&#xA;rz(pi*-0.7099806825) q[2];&#xA;rz(pi*0.9369127746) q[1];&#xA;u2(0, 0) q[1];&#xA;u3(pi*-0.2870621217, pi*1.0, pi*-1.0) q[2];&#xA;cz q[1],q[2];&#xA;u3(pi*-0.2129378783, pi*1.0, pi*-1.0) q[2];&#xA;u2(pi*-1.0, pi*1.0) q[1];&#xA;cz q[1],q[2];&#xA;u2(pi*-1.0, pi*1.0) q[1];&#xA;u3(pi*-1.0, pi*1.25, pi*-1.25) q[2];&#xA;rz(pi*-0.5) q[1];&#xA;cx q[1],q[0];&#xA;cx q[2],q[0];&#xA;rz(pi*0.5) q[0];&#xA;cx q[1],q[0];&#xA;cx q[2],q[0];&#xA;u2(pi*0.25, pi*-0.25) q[1];&#xA;u2(pi*-0.75, pi*0.75) q[2];&#xA;cz q[1],q[2];&#xA;u3(pi*-0.2129378783, pi*1.25, pi*-1.25) q[2];&#xA;u3(pi*-0.2129378783, pi*1.25, pi*-1.25) q[1];&#xA;cz q[1],q[2];&#xA;u3(pi*-0.25, pi*-0.25, pi*0.25) q[2];&#xA;u2(pi*-0.75, pi*0.75) q[1];&#xA;rz(pi*-1.25) q[2];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4986" LastActivityDate="2021-03-03T04:03:27.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16323" PostTypeId="2" ParentId="16320" CreationDate="2021-03-03T04:50:51.497" Score="3" Body="&lt;p&gt;Yes, you can send normalized data across participants assuming you can convert them to probability amplitudes. To give a quick example, consider this single-qubit state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle= \alpha|0\rangle + \beta|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are normalized data (&lt;span class=&quot;math-container&quot;&gt;$\alpha^{2} + \beta^{2} = 1$&lt;/span&gt;) that Alice is trying to send to Bob.&lt;/p&gt;&#xA;&lt;p&gt;Then the following steps are to be followed by them:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice and Bob create an entangled pair of qubits and each holds one part of it. Usually, this is done via &lt;span class=&quot;math-container&quot;&gt;$|\phi^{+}\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$&lt;/span&gt; which is one of the four &lt;a href=&quot;https://www.quantiki.org/wiki/bell-state&quot; rel=&quot;nofollow noreferrer&quot;&gt;bell's state&lt;/a&gt;. The rest of the step assumes we use &lt;span class=&quot;math-container&quot;&gt;$|\phi^{+}\rangle$&lt;/span&gt; to pass &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; from Alice to Bob.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Alice applies &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CXGate.html#qiskit.circuit.library.CXGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Controlled-Not&lt;/a&gt; gate where the &lt;code&gt;target&lt;/code&gt; is the qubit from the Bell's state that Alice holds and &lt;code&gt;control&lt;/code&gt; is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.HGate.html#qiskit.circuit.library.HGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard&lt;/a&gt; gate is applied on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Then the two qubits that Alice holds are &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.Measure.html#qiskit.circuit.library.Measure&quot; rel=&quot;nofollow noreferrer&quot;&gt;measured&lt;/a&gt;. (Don't forget that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in our example is a single-qubit state)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The two states that Alice sees is then &lt;em&gt;classically&lt;/em&gt; communicated to Bob. (In our case it can either be &lt;code&gt;00&lt;/code&gt;, &lt;code&gt;01&lt;/code&gt;, &lt;code&gt;10&lt;/code&gt; or &lt;code&gt;11&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;And depending on the results that Alice communicates with him, Bob does the following on his part of the entangled state(which essentially is a single qubit):&lt;/p&gt;&#xA;&lt;p&gt;(a) If &lt;code&gt;00&lt;/code&gt;, Apply &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.IGate.html#qiskit.circuit.library.IGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Identity gate&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(b) If &lt;code&gt;01&lt;/code&gt;, Apply &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.XGate.html#qiskit.circuit.library.XGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;X gate&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(c) If &lt;code&gt;10&lt;/code&gt;, Apply &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.ZGate.html#qiskit.circuit.library.ZGate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Z gate&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(d) If &lt;code&gt;11&lt;/code&gt;, Apply &lt;code&gt;Z&lt;/code&gt; gate followed by &lt;code&gt;X&lt;/code&gt; gate.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The result of the above computations would be that Alice will lose her &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and Bob's entangled part will now be equal to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Note that they both cannot keep &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; because of the &lt;a href=&quot;https://www.quantiki.org/wiki/no-cloning-theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;No-Cloning Theorem&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;While the above example is for a single-qubit case, the same logic applies for multiple qubit cases, you could pack your normalized data into a unitary matrix and then &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.extensions.UnitaryGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;convert it to a gate&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, you would need to repeat the experiment more times in order to retrieve the data from the amplitude states (In the above example, you would get &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\alpha^2$&lt;/span&gt; probability). &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here's the qiskit implementation of it&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2021-03-03T04:50:51.497" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16324" PostTypeId="1" AcceptedAnswerId="16349" CreationDate="2021-03-03T07:33:40.233" Score="3" ViewCount="107" Body="&lt;p&gt;Starting with the qubit state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, which single-qubit states can be obtained by applying single-qubit Clifford gates, i.e. Pauli + Hadamard + &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gates?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-11T19:52:15.120" LastActivityDate="2021-03-11T19:52:15.120" Title="Which states can reached using single-qubit Clifford gates?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16325" PostTypeId="1" AcceptedAnswerId="16328" CreationDate="2021-03-03T07:46:39.673" Score="3" ViewCount="75" Body="&lt;p&gt;How can I construct, using Pauli, Hadamard and &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate, a universal transformation &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle$&lt;/span&gt; has a less than &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; complementary angle with &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-03-08T11:17:57.407" LastActivityDate="2021-03-08T11:17:57.407" Title="How can I construct a universal transformation using Clifford+T gates?" Tags="&lt;unitarity&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-03-05T22:22:52.217" ContentLicense="CC BY-SA 4.0" />
  <row Id="16326" PostTypeId="2" ParentId="16321" CreationDate="2021-03-03T07:54:48.717" Score="2" Body="&lt;p&gt;I will provide answer for IBM Q. There is a language callled QASM. As you can see from the name of the language, it is similar to assembly language known from classical computer.&lt;/p&gt;&#xA;&lt;p&gt;The language statements are very simple - they involve an operation (i.e. quantum gate) and affected qubits. For example to apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate on qubit no. 0, you have to put in &lt;code&gt;x q[0]&lt;/code&gt;, for CNOT gate with control qubit no. 0 and target qubit 1, the statement is &lt;code&gt;cnot q[0], q[1]&lt;/code&gt; etc. Also special stataments are used for measurement, setting number of qubits in qubit register and bits in classical register. You can also define subroutines which are called &lt;em&gt;custom gates&lt;/em&gt;. This all means that you operates on qubit and gate level although logical ones. It is also possible to write a program in QASM using only basic gates which are &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; and CNOT on IBM Q (although &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; is still not physical gate).&lt;/p&gt;&#xA;&lt;p&gt;IBM Q also enables you to program a quantum processor with microwave pulses directly (only processor Armonk offers this capability now) which is really physical level, something like programming classical computer by switching particular transistors.&lt;/p&gt;&#xA;&lt;p&gt;Concerning the possibility of a something going to be obsolete. There is always such risk in any segment of industry, particularly in IT which evolves rapidly.&lt;/p&gt;&#xA;&lt;p&gt;As I see it, it think to learn QASM/Qiskit is useful as it allows you to get insight how quantum computers work. Then, it would be easy to switch to another language.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-03T07:54:48.717" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16328" PostTypeId="2" ParentId="16325" CreationDate="2021-03-03T08:22:30.373" Score="3" Body="&lt;p&gt;One way that you might do it is as follows. Consider the unitary sequence &lt;span class=&quot;math-container&quot;&gt;$V=HTHT$&lt;/span&gt;. Because it's unitary, we can write it in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V=e^{i\gamma}e^{-i\theta\vec{n}\cdot\vec{\sigma}}=e^{i\gamma}(\cos\theta I-i\sin\theta \ \vec{n}\cdot\vec{\sigma})&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\vec{n}\cdot\vec{n}=1$&lt;/span&gt;. If you work through the details, you'll find that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\theta=\cos^2\frac{\pi}{8}&#xA;$$&lt;/span&gt;&#xA;if memory serves.&lt;/p&gt;&#xA;&lt;p&gt;This means that I can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V^k=e^{i\gamma k}(\cos(k\theta) I-i\sin(k\theta) \ \vec{n}\cdot\vec{\sigma}).&#xA;$$&lt;/span&gt;&#xA;So long as you pick a value of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\cos(k\theta)|$&lt;/span&gt; is close enough to 0, you're sorted (if you let &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; get large enough, you can get arbitrarily close to 0). I'd probably just do this numerically (although if you want to get sophisticated, you could use continued fractions on &lt;span class=&quot;math-container&quot;&gt;$\theta/(2\pi)$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I'm assuming that your condition is supposed to translate into a mathematical statement of&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle 0|U|0\rangle|\leq\cos\frac{\pi}{4}=\frac{1}{\sqrt{2}}.&#xA;$$&lt;/span&gt;&#xA;If this is indeed the case, then &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt; may be fine, although &lt;span class=&quot;math-container&quot;&gt;$k=3$&lt;/span&gt; is even safer as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos2\theta\approx 0.457107, \cos3\theta\approx-0.0732233.&#xA;$$&lt;/span&gt;&#xA;Note that I've skipped an important step here because I've only been looking at &lt;span class=&quot;math-container&quot;&gt;$\cos(k\theta)$&lt;/span&gt;, not at&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle 0|U|0\rangle|=\sqrt{\cos^2(k\theta)+n^2_z\sin^2(k\theta)}.&#xA;$$&lt;/span&gt;&#xA;Still, I claim that &lt;span class=&quot;math-container&quot;&gt;$n_z&amp;lt;1/\sqrt{2}$&lt;/span&gt; so that so long as I find a small enough value of &lt;span class=&quot;math-container&quot;&gt;$\cos(k\theta)$&lt;/span&gt; it will work out fine.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-03T08:22:30.373" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16329" PostTypeId="1" CreationDate="2021-03-03T09:51:03.223" Score="2" ViewCount="133" Body="&lt;p&gt;I am trying to find information/ help on Rényi entropies given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ S_n(\rho) = \frac{1}{1-n} \ln [Tr(\rho^n)] $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and how it acts under unitary time evolution? Is the entropy independent on the state of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; i.e it doesn't matter if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure or mixed? I am also unsure on how to apply Von Neumann's equation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho(t) = U(t, t_0) \rho(t_0) U^{\dagger} (t, t_0) $$&lt;/span&gt;&#xA;In order to see how it acts.&lt;/p&gt;&#xA;" OwnerUserId="15096" LastEditorUserId="55" LastEditDate="2021-03-03T18:23:42.137" LastActivityDate="2021-03-03T18:23:42.137" Title="How do Rényi entropies act under unitary time evolution?" Tags="&lt;unitarity&gt;&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16330" PostTypeId="2" ParentId="16313" CreationDate="2021-03-03T10:05:27.940" Score="4" Body="&lt;p&gt;I am going to answer your question as you phrased it in the comments:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;&amp;quot;I am asking if you can give me an example of classical code (that is not parallelizable) that can be sped up by a quantum computer&amp;quot;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;where, as I understand you, &amp;quot;not parallelizable&amp;quot; means that we have no idea how to parallelize it.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Specifically, it is known that quantum computers can approximate the so-called Jones polynomial at specific points. It is not known how this problem can be parallelized in a useful way.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Another example is the simulation of the time evolution of general quantum systems. It is not known how to parallelize this.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now I apologize for that, since I know that you don't like this theoretical approach, but I think if one can make a more general or stronger statement at no extra cost, one should make it:&lt;/p&gt;&#xA;&lt;p&gt;Any problem which is proven to be BQP-complete (like the above) will do: For none of these problems, we know of efficient ways to parallelize them. If there would be such ways, this would mean that the problem is in NP (in essence, you can think of NP as the class of problems which can be massively parallelized, by &amp;quot;searching all solutions at once&amp;quot;), and - as I mentioned in the comments - this would not only be a most major result, but there is also significant evidence that it does, in fact, not hold.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-03T10:05:27.940" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16331" PostTypeId="2" ParentId="16329" CreationDate="2021-03-03T10:25:20.607" Score="3" Body="&lt;p&gt;Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho(t)=U\rho U^\dagger,&#xA;$$&lt;/span&gt;&#xA;just to simplify notation a bit. Now notice that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho(t)^2=U\rho U^\dagger U\rho U^\dagger=U\rho^2 U^\dagger&#xA;$$&lt;/span&gt;&#xA;since &lt;span class=&quot;math-container&quot;&gt;$U^\dagger U=I$&lt;/span&gt;. Thus, similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho(t)^n=U\rho^n U^\dagger.&#xA;$$&lt;/span&gt;&#xA;So, take the trace of this, remembering that trace is invariant under permutations:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\rho(t)^n)=\text{Tr}(U\rho^n U^\dagger)=\text{Tr}(\rho^n U^\dagger U)=\text{Tr}(\rho^n).&#xA;$$&lt;/span&gt;&#xA;Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_n(\rho(t))=S_n(\rho).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-03T10:25:20.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16332" PostTypeId="2" ParentId="16329" CreationDate="2021-03-03T10:26:36.777" Score="3" Body="&lt;p&gt;They are invariant under conjugation of unitaries, i.e. under the mapping &lt;span class=&quot;math-container&quot;&gt;$\rho \to U \rho U^*$&lt;/span&gt;. To see this note that &lt;span class=&quot;math-container&quot;&gt;$(U \rho U^*)^{\alpha} = U \rho^\alpha U^*$&lt;/span&gt;. Then we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;S_\alpha(U \rho U^*) &amp;amp;= \frac{1}{1-\alpha} \log \mathrm{Tr}[(U \rho U^*)^{\alpha}] \\&#xA;&amp;amp;= \frac{1}{1-\alpha} \log \mathrm{Tr}[U \rho^\alpha U^*] \\ &#xA;&amp;amp;= \frac{1}{1-\alpha} \log \mathrm{Tr}[U^* U \rho^{\alpha}] \\&#xA;&amp;amp;= \frac{1}{1-\alpha} \log \mathrm{Tr}[\rho^\alpha] \\&#xA;&amp;amp;= S_\alpha(\rho).&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;On the second line we used the above identity, on the third line we used cyclicity of the trace and on the fourth line we used &lt;span class=&quot;math-container&quot;&gt;$U^* U = I$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-03T10:26:36.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16333" PostTypeId="1" CreationDate="2021-03-03T10:46:19.380" Score="1" ViewCount="156" Body="&lt;p&gt;After working through an exercise I got a confusion answer/solution that either may be because I've made a mistake or I'm not understanding von Neumann Entropy.&lt;/p&gt;&#xA;&lt;p&gt;I have the two qubit system&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ | \psi \rangle  = \cos(\theta) \rangle 1 \rangle | 0 \rangle + \sin(\theta) | 0 \rangle | 1 \rangle $$&lt;/span&gt;&#xA;And I want to calculate the von Neumann entropy&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ S = - Tr ( \rho_A \ln \rho_A ) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I got &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho_A = \begin{pmatrix}&#xA;    \cos^2 (\theta) &amp;amp; 0 \\ 0 &amp;amp; \sin^2 (\theta) &#xA;\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus the von Neumann entropy as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ S = - Tr ( \begin{pmatrix}&#xA;    \cos^2 (\theta) &amp;amp; 0 \\ 0 &amp;amp; \sin^2 (\theta) &#xA;\end{pmatrix} \ln \begin{pmatrix}&#xA;    \cos^2 (\theta) &amp;amp; 0 \\ 0 &amp;amp; \sin^2 (\theta) &#xA;\end{pmatrix} ) $$&lt;/span&gt;&#xA;The natural log of the matrix is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \ln \rho_A = PDP^{-1} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \begin{pmatrix}&#xA;    1 &amp;amp; 0 \\ 0 &amp;amp; 1&#xA;\end{pmatrix} \begin{pmatrix}&#xA;    \ln(\cos^2 (\theta)) &amp;amp; 0 \\ 0 &amp;amp; \ln(\sin^2 (\theta)) &#xA;\end{pmatrix} \begin{pmatrix}&#xA;    1 &amp;amp; 0 \\ 0 &amp;amp; 1&#xA;\end{pmatrix} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ = \begin{pmatrix}&#xA;    \ln(\cos^2 (\theta)) &amp;amp; 0 \\ 0 &amp;amp; \ln(\sin^2 (\theta)) &#xA;\end{pmatrix} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ S = - Tr ( \begin{pmatrix}&#xA;    \cos^2 (\theta) \cdot \ln(\cos^2 (\theta)) &amp;amp; 0 \\ 0 &amp;amp; \sin^2 (\theta) \cdot \ln(\sin^2 (\theta)) &#xA;\end{pmatrix} ) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Perhaps I am not understanding but this answer does not make any sense? The trace of that matrix cannot be simplified further and I don't get an actual answer that doesn't depend on &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. Also in this case the values of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; which make &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; a pure state is any &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and the same can be said for values of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; which make is a maximally mixed state?&lt;/p&gt;&#xA;" OwnerUserId="15096" LastEditorUserId="55" LastEditDate="2021-03-03T22:36:44.637" LastActivityDate="2021-03-03T22:36:44.637" Title="Calculate the von Neumann Entropy of a two-qubit entangled state" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16334" PostTypeId="1" CreationDate="2021-03-03T10:51:21.747" Score="2" ViewCount="57" Body="&lt;p&gt;For a project, I want to simulate a matrix multiplication on a simulated quantum circuit. Assuming that we have a matrix &lt;span class=&quot;math-container&quot;&gt;$A\in \mathbb{R}^{m\times n}$&lt;/span&gt; stored in a quantum superposition, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|A\rangle= \frac{1}{||A||_F}\sum_{i,j=0}^{n-1}{a_{ij}}|i,j\rangle$$&lt;/span&gt;&#xA;and a vector &lt;span class=&quot;math-container&quot;&gt;$b\in \mathbb{R}^{n\times 1}$&lt;/span&gt; stored in&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|b\rangle= \frac{1}{||b||}\sum_{i}^{n-1}{b_{i}}|i\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I find a unitary, such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|b\rangle\approx|Ab\rangle?$$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I'm right now looking at block-encodings (&lt;a href=&quot;https://arxiv.org/abs/1804.01973&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1804.01973&lt;/a&gt;, &lt;a href=&quot;https://arxiv.org/abs/1806.01838&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1806.01838&lt;/a&gt;), where they argue, that we can find a block encoding of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as a unitary of form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U=\left(\begin{array}{cc}&#xA;A / \alpha &amp;amp; . \\&#xA;. &amp;amp; .&#xA;\end{array}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;by decomposing it into two state-preparation unitaries &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_R$&lt;/span&gt;, s. t.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{l}&#xA;U_{L}:|i\rangle|0\rangle \rightarrow |i\rangle\left(\sum_{j=0}^{n-1}{\frac{A_{i,j}}{||A_{i,\cdot}||_F}|j\rangle} \right)=|i\rangle|A_{i,\cdot}\rangle\\&#xA;U_{R}:|0\rangle|j\rangle \rightarrow \left(\sum_{i=0}^{n-1}{\frac{||A_{i,\cdot}||}{||A||_F}|i\rangle} \right)|j\rangle=|\tilde{A}\rangle|j\rangle&#xA;\end{array}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|A_{i,\cdot}\rangle$&lt;/span&gt; represents the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th row of A and &lt;span class=&quot;math-container&quot;&gt;$|\tilde{A}\rangle$&lt;/span&gt; represents the vector of the row-norms of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, i.e &lt;span class=&quot;math-container&quot;&gt;$\tilde{A}\in \mathbb{R}^m$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\tilde{A}_i = ||A_{i,\cdot}||$&lt;/span&gt; (see Theorem 5.1 &lt;a href=&quot;https://arxiv.org/pdf/1603.08675.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1603.08675.pdf&lt;/a&gt;). Then they claim that &lt;span class=&quot;math-container&quot;&gt;$U=U_{L}^{\dagger} U_{R}$&lt;/span&gt; is a block-encoding of A (see &lt;a href=&quot;https://youtu.be/zUpHcpIq0Ww?t=1678&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://youtu.be/zUpHcpIq0Ww?t=1678&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;However, I struggle to find the circuits for &lt;span class=&quot;math-container&quot;&gt;$U_L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_R$&lt;/span&gt;, even for a simple &lt;span class=&quot;math-container&quot;&gt;$n=m=2$&lt;/span&gt; problem. Any hints?&lt;/p&gt;&#xA;" OwnerUserId="14817" LastEditorUserId="14817" LastEditDate="2021-03-03T14:13:21.113" LastActivityDate="2021-03-03T14:13:21.113" Title="Matrix multiplication through Block Encodings" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;unitarity&gt;&lt;linear-algebra&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16335" PostTypeId="2" ParentId="16333" CreationDate="2021-03-03T11:17:25.393" Score="6" Body="&lt;p&gt;You are calculating the entropy of one of the marginal states and so you would not expect the answer to be independent of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, except in the case that &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |\phi_A\rangle \otimes |\phi_B\rangle$&lt;/span&gt; -- this will be true whenever &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{k \pi}{2}$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$k \in \mathbb{Z}$&lt;/span&gt;. In this case the reduced state &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; is &lt;strong&gt;also&lt;/strong&gt; pure. However, just because &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = |\psi\rangle \langle \psi |$&lt;/span&gt; is a pure state, does not mean that &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \mathrm{Tr}_B[\rho_{AB}]$&lt;/span&gt; will also be pure.&lt;/p&gt;&#xA;&lt;p&gt;The calculations you performed are all correct.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-03T11:17:25.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16336" PostTypeId="1" CreationDate="2021-03-03T12:41:31.070" Score="1" ViewCount="81" Body="&lt;p&gt;I am confused how the sum of N operators will act on an N-level system of qubits. Here, lets say N=2 so the state is &lt;span class=&quot;math-container&quot;&gt;$|00⟩_{CD}$&lt;/span&gt;. Then how will this operator &lt;span class=&quot;math-container&quot;&gt;$ X_{C} + Z_{D} ⊗ I_{C}  + X_{D}$&lt;/span&gt; act on this state?&lt;/p&gt;&#xA;&lt;p&gt;Is it distributive like this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$ (I _{C} + X_{D}) |00⟩_{CD} = I_{C}|00⟩_{CD} + X_{D}|00⟩_{CD} = |00⟩_{CD} + |01⟩_{CD}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;And then &lt;span class=&quot;math-container&quot;&gt;$ X_{C} + Z_{D}$&lt;/span&gt; would act on each of the terms (&lt;span class=&quot;math-container&quot;&gt;$|00⟩_{CD}$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$|01⟩_{CD}$&lt;/span&gt;) above, giving 4 terms?&lt;/p&gt;&#xA;&lt;p&gt;Some intuition on how/why this happens would be appreciated. How can you construct the sum of the matrices of &lt;span class=&quot;math-container&quot;&gt;$I _{C}$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$X_{D}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15097" LastEditorUserId="2293" LastEditDate="2021-05-28T18:03:27.943" LastActivityDate="2021-05-28T18:03:27.943" Title="How does the sum of two operators act on a two-level system of qubits?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16338" PostTypeId="2" ParentId="16336" CreationDate="2021-03-03T13:44:37.780" Score="1" Body="&lt;p&gt;The sum of operators in your question:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA; X_{C} + Z_{D} ⊗ I_{C}  + X_{D},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is actually this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X_C \otimes I_D + I_C \otimes Z_D + I_C \otimes X_D.\tag{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To get how this behaves on the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; you just have matrix addition and multiplication: &lt;span class=&quot;math-container&quot;&gt;$(A + B + C)|00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You get 3 terms: &lt;span class=&quot;math-container&quot;&gt;$ |10\rangle , |00\rangle , |01\rangle $&lt;/span&gt;.&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't see how you could get the 4th term (&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;) when there's nothing flipping both qubits at the same time.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-03T18:34:58.243" LastActivityDate="2021-03-03T18:34:58.243" CommentCount="14" ContentLicense="CC BY-SA 4.0" />
  <row Id="16339" PostTypeId="1" CreationDate="2021-03-03T14:08:27.177" Score="2" ViewCount="23" Body="&lt;p&gt;We can use simultaneous randomized benchmarking (SRB) to quantify the crosstalk impact of simultaneous CNOTs. The crosstalk error is caused by many reasons, for example, the always-on ZZ interaction, the crosstalk between microwave lines.&lt;/p&gt;&#xA;&lt;p&gt;My question is, is the number given by SRB experiment an average of all these reasons? Which one is the most important reason to cause crosstalk error between simultaneous cnots? Why is the error rate of cnot increased a lot during simultaneous executions?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2021-03-03T14:08:27.177" Title="Crosstalk error of simultaneous cnots" Tags="&lt;quantum-state&gt;&lt;physical-realization&gt;&lt;error-mitigation&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16340" PostTypeId="2" ParentId="16193" CreationDate="2021-03-03T20:28:59.893" Score="1" Body="&lt;p&gt;Short answer: Yes, it is the complementary angle because you have grabbed the wrong probability amplitudes from &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{Pr}(A=\updownarrow, B=\searrow) &amp;amp;= \langle \psi | \left(|\updownarrow\rangle\langle\updownarrow| \otimes |\searrow\rangle\langle\searrow|\right) |\psi \rangle\\&#xA;&amp;amp;= \langle \psi | (\mathbb{I}_A \otimes R_B^\dagger(45^\circ) ) |\updownarrow\rangle\langle\updownarrow| \otimes |\leftrightarrow\rangle\langle\leftrightarrow| (\mathbb{I}_A \otimes R_B (45^\circ) ) |\psi \rangle \\&#xA;&amp;amp;= |\langle \updownarrow \leftrightarrow | (\mathbb{I}_A \otimes R_B (45^\circ) ) |\psi \rangle|^2 \\&#xA;&amp;amp;= \frac{1}{2} \sin^2 (22.5^\circ)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where I've used the notation &lt;span class=&quot;math-container&quot;&gt;$B=\searrow$&lt;/span&gt; to mean &amp;quot;The detector at &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; measured a photon perpendicular to the polarization of the detector in the rotated basis&amp;quot;, and I will use &lt;span class=&quot;math-container&quot;&gt;$B=\nearrow$&lt;/span&gt; for the event that the detector at &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; measured a photon parallel to the polarization of the rotated detector. Mathematically, &lt;span class=&quot;math-container&quot;&gt;$|\nearrow\rangle = R_B^\dagger (45^\circ) |\updownarrow\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\searrow\rangle = R_B^\dagger (45^\circ) |\leftrightarrow\rangle$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$^\dagger$&lt;/span&gt; reflects the fact that you were originally working in a system where you viewed the &lt;em&gt;state&lt;/em&gt; as having been rotated instead of the &lt;em&gt;measurement apparatus&lt;/em&gt; being rotated.&lt;/p&gt;&#xA;&lt;p&gt;And so the probability that a photon passes through exactly one polarizer is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\text{Pr}([A=\updownarrow, B=\searrow] \cup [A=\leftrightarrow, B=\nearrow]) &amp;amp;=  \text{Pr}(A=\updownarrow, B=\searrow) + \text{Pr}(A=\leftrightarrow, B=\nearrow)\\&#xA;&amp;amp;= \sin^2 (22.5^\circ)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;More generally, you can construct measurements to detect the events &lt;span class=&quot;math-container&quot;&gt;$[A=\nearrow, B=\searrow]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[A=\searrow, B=\nearrow]$&lt;/span&gt; that indicate that exactly one of the detectors measured a photon with polarization aligned with the detector. Let the system be rotated locally by &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; in system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and by &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; in system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. These angles correspond to the actual directions of polarizations so there's an additional factor of two. Keeping with the convention of rotating the state and not the measurement apparatus, the measurement for the event &lt;span class=&quot;math-container&quot;&gt;$[A=\nearrow, B=\searrow]$&lt;/span&gt; is given by:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;M_{A\nearrow, B\searrow} &amp;amp;= |\nearrow \rangle \langle \nearrow| \otimes |\searrow \rangle \langle \searrow |&#xA;\\&amp;amp;= R_A^\dagger (2\alpha) |\updownarrow \rangle \langle \updownarrow| R_A (2\alpha)\otimes R_B^\dagger (2\beta)|\leftrightarrow\rangle \langle \leftrightarrow| R_B (2\beta)&#xA;\\&amp;amp;\sim \begin{pmatrix} &#xA;\cos^2\alpha &amp;amp; \cos\alpha\sin\alpha\\ \cos\alpha\sin\alpha &amp;amp; \sin^2\alpha&#xA;\end{pmatrix} \otimes&#xA;\begin{pmatrix} &#xA;\sin^2\beta&amp;amp; -\cos\beta\sin\beta \\ -\cos\beta\sin\beta &amp;amp; \cos^2\beta&#xA;\end{pmatrix} &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can then compute the probability for the event &lt;span class=&quot;math-container&quot;&gt;$[A=\nearrow, B=\searrow]$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle \psi | M_{A\nearrow, B\searrow} | \psi \rangle &amp;amp;= \frac{1}{2} \left( &#xA;\cos^2\alpha \sin^2\beta- 2 \cos\alpha\sin\alpha \cos\beta\sin\beta +\sin^2\alpha \cos^2\beta\right) \\&#xA;&amp;amp;= \frac{1}{2}\left( \cos\alpha\sin\beta - \sin\alpha\cos\beta\right)^2 \\&#xA;&amp;amp;= \frac{1}{2} \sin^2 (\alpha - \beta)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And you can compute a similar outcome for &lt;span class=&quot;math-container&quot;&gt;$[A=\nearrow, B=\searrow]$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$[A=\searrow, B=\searrow]$&lt;/span&gt;, and so on to find the desired event probabilities.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-03-03T20:28:59.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16341" PostTypeId="1" AcceptedAnswerId="16343" CreationDate="2021-03-03T20:32:01.317" Score="2" ViewCount="145" Body="&lt;p&gt;I know that in order to make a two quit entangled state, this quantum circuit is used:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/L3gjc.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L3gjc.jpg&quot; alt=&quot;Hadamard + CNOT gate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I was wondering if there are any other gate combinations which also create entangled two quit states.&lt;/p&gt;&#xA;&lt;p&gt;If there are other quantum circuits which achieve this, I was wondering if they would also create any one of the four bell states. Thanks in advance.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/618411/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="15101" LastEditorUserId="55" LastEditDate="2021-03-04T12:15:00.870" LastActivityDate="2021-03-04T12:15:00.870" Title="What gate combinations create entangled two-qubit states?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;entanglement&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16342" PostTypeId="2" ParentId="16336" CreationDate="2021-03-03T20:34:33.237" Score="0" Body="&lt;p&gt;&lt;strong&gt;TL;DR: What you have written is more or less correct and your result will indeed give 4 terms, however it is not a valid quantum operator.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Firstly, I will add brackets to your operator to make it &lt;span class=&quot;math-container&quot;&gt;$(X_C + Z_D) \otimes (I_C + X_D)$&lt;/span&gt;. Given that, let us take just focus on just the &lt;span class=&quot;math-container&quot;&gt;$(I_C + X_D)$&lt;/span&gt; term and work it through. We will see that, as you mentioned, &lt;span class=&quot;math-container&quot;&gt;$(I_C + X_D)|00\rangle_{CD} = |00\rangle_{CD}+|01\rangle_{CD}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To begin we first have to take into account what was pointed out by @user1271772: &amp;quot;whenever you see an operator acting on only one qubit, please understand that there's an [implicit] identity operator acting on all other qubits&amp;quot;. Explicitly, all this means is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;I_C = I_C \otimes I_D \\&#xA;X_D = I_C \otimes X_D \\&#xA;$$&lt;/span&gt;&#xA;Now let us construct the matrices of the above two operators&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;I_C &amp;amp;= I_C \otimes I_D =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;\otimes&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;\end{align*}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;X_D &amp;amp;= I_C \otimes X_D =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;\otimes&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{bmatrix} =&#xA;\begin{bmatrix}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &#xA;\end{bmatrix}&#xA;\end{align*}&#xA;$$&lt;/span&gt;&#xA;If the above computations of tensor products of matrices are unfamiliar to you, have a quick read through the &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia page on Kronecker products&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, writing &lt;span class=&quot;math-container&quot;&gt;$|00\rangle_{CD}$&lt;/span&gt; in matrix form &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;1 \\&#xA;0\\&#xA;0 \\&#xA;0 &#xA;\end{bmatrix}$&lt;/span&gt;, we can perform the multiplication to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;(I_C + X_D)|00\rangle_{CD} &amp;amp;= \left[(I_C \otimes I_D) + (I_C \otimes X_D)\right]|00\rangle_{CD} \\&#xA;\\&#xA;&amp;amp;= (I_C \otimes I_D)|00\rangle_{CD} + (I_C \otimes X_D)|00\rangle_{CD} \\&#xA;\\&#xA;&amp;amp;= \begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;1 \\&#xA;0 \\&#xA;0 \\&#xA;0 &#xA;\end{bmatrix} + \begin{bmatrix}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &#xA;\end{bmatrix}\begin{bmatrix}&#xA;1 \\&#xA;0\\&#xA;0 \\&#xA;0 &#xA;\end{bmatrix} \\&#xA;\\&#xA;&amp;amp;= \begin{bmatrix}&#xA;1 \\&#xA;0 \\&#xA;0 \\&#xA;0 &#xA;\end{bmatrix} + \begin{bmatrix}&#xA;0 \\&#xA;1 \\&#xA;0 \\&#xA;0 &#xA;\end{bmatrix} = |00\rangle_{CD}+|01\rangle_{CD}&#xA;\end{align*}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;However&lt;/strong&gt; all that being said, the operator &lt;span class=&quot;math-container&quot;&gt;$(I_C + X_D)$&lt;/span&gt; is actually not a valid quantum operator. This is because it is non-unitary. This can be seen by taking the its determinant which is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align*}&#xA;|I_C + X_D| &amp;amp;= \left| \begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix} + \begin{bmatrix}&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&#xA;\end{bmatrix}\right| \\ &#xA;&amp;amp;= \begin{vmatrix}&#xA;1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1&#xA;\end{vmatrix} = 0&#xA;\end{align*}&#xA;$$&lt;/span&gt;&#xA;So in fact you cannot ever perform the operation &lt;span class=&quot;math-container&quot;&gt;$(I_C + X_D)$&lt;/span&gt; on a quantum computer.&lt;/p&gt;&#xA;&lt;p&gt;The exact same steps can be taken with the other term in your original question &lt;span class=&quot;math-container&quot;&gt;$(X_C + Z_D)$&lt;/span&gt; and you will find a similar situation - i.e. the math will work out but the operator will not be a unitary one.&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-03-03T20:34:33.237" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16343" PostTypeId="2" ParentId="16341" CreationDate="2021-03-03T21:28:04.427" Score="3" Body="&lt;p&gt;The circuit you gave certainly generated an entangled state. In particular, it generates the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt; . But this is just one particular entangled state, there are many more.&lt;/p&gt;&#xA;&lt;p&gt;For instance, the following circuit&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sfuum.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sfuum.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;prepares the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}} $&lt;/span&gt; which is another Bell state.&lt;/p&gt;&#xA;&lt;p&gt;Note that if instead of using the Hadamard gate, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, I have replaced it with a &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation then I would still generate an entangled state.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FEyoJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FEyoJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since the above circuit will generate a state in the form &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{ \alpha|01\rangle + \beta|10\rangle}{\sqrt{2}}  $&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2| = 1$&lt;/span&gt;. Also,  note that at  &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi/2$&lt;/span&gt;, you get back the first circuit.&lt;/p&gt;&#xA;&lt;p&gt;You can also use the &lt;span class=&quot;math-container&quot;&gt;$RXX$&lt;/span&gt; gate, for example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i84mS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i84mS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This will generate the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|00\rangle - i|11\rangle}{\sqrt{2}}$&lt;/span&gt; which is also an entangled state. This gate has the matrix representation in the computational basis as &lt;span class=&quot;math-container&quot;&gt;$RXX = \begin{pmatrix}&#xA;                \cos(\theta)   &amp;amp; 0           &amp;amp; 0           &amp;amp; -i\sin(\theta) \\&#xA;                0           &amp;amp; \cos(\theta)   &amp;amp; -i\sin(\theta) &amp;amp; 0 \\&#xA;                0           &amp;amp; -i\sin(\theta) &amp;amp; \cos(\theta)   &amp;amp; 0 \\&#xA;                -i\sin(\theta) &amp;amp; 0           &amp;amp; 0           &amp;amp; \cos(\theta)&#xA;            \end{pmatrix} $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-03T21:35:11.630" LastActivityDate="2021-03-03T21:35:11.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16344" PostTypeId="2" ParentId="16341" CreationDate="2021-03-03T21:54:07.420" Score="4" Body="&lt;p&gt;Yes, there are many other quantum circuits that prepare entangled states. In fact, in certain sense that can be made precise, almost all possible quantum circuits on two qubits produce entangled states. This corresponds to the fact that almost all pure two-qubit states are entangled. It is the product states that are rare (more precisely: they form a measure zero subset of all pure states).&lt;/p&gt;&#xA;&lt;p&gt;That said, there are circuits that do not produce any entanglement. For example, any cirucit that lacks two-qubit gates or any circuit that consists of single-qubit gates and SWAP gates has this property. Also, running any circuit in reverse destroys the entanglement created by running it forward.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark on comparing circuits:&lt;/strong&gt; Generally speaking, almost any question of the form &amp;quot;Circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; produces states with property &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;. Are there other circuits that do this?&amp;quot; will have an affirmative answer, because we can always make changes to a circuit by adding or moving around gates without affecting the unitary operation it applies to its input. This is analogous to how we can modify a computer program by adding or moving around instructions without affecting its output. For example, in the circuit in the question we can replace CNOT with CZ sandwiched between two Hadamards on the target qubit or we can add two consecutive X gates anywhere in the circuit.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Example circuit which prepares the Bell state &lt;span class=&quot;math-container&quot;&gt;$(|00\rangle + |11\rangle)/\sqrt{2}$&lt;/span&gt; without using the CNOT gate is the following&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(S \otimes X) \circ \sqrt{\text{SWAP}} \circ (S \otimes X)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the gates are as described in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article about quantum gates&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-03T21:54:07.420" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16345" PostTypeId="1" CreationDate="2021-03-03T23:30:32.540" Score="3" ViewCount="47" Body="&lt;p&gt;I can understand doing teleportation by using qubits, however, I am stuck there when it comes to qutrits and the operation Bob needs to perform. Suppose Alice and Bob are sharing the most entangled states in the beginning ie:&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt3}(|00\rangle+|11\rangle+|22\rangle)$&lt;/span&gt; and teleport a qutrit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=a|0\rangle+b|1\rangle+c|2\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Like how to get the 9 bell states? &lt;a href=&quot;https://i.stack.imgur.com/RrLiD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/RrLiD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if the outcome is |ψ10⟩ Then what should Bob do?&lt;/p&gt;&#xA;" OwnerUserId="15104" LastEditorUserId="15104" LastEditDate="2021-03-04T18:02:36.913" LastActivityDate="2021-03-04T18:02:36.913" Title="Can someone elaborate how to use Qutrits to do teleportation? And the unitary operation Bob needs to do?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;&lt;teleportation&gt;&lt;communication&gt;&lt;qutrit&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2021-03-04T19:53:11.783" ContentLicense="CC BY-SA 4.0" />
  <row Id="16347" PostTypeId="2" ParentId="11554" CreationDate="2021-03-04T13:11:19.163" Score="1" Body="&lt;p&gt;A copy of my answer to the cross-posted question:&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Such a circuit cannot exist. To see why, assume &lt;span class=&quot;math-container&quot;&gt;$|b\rangle = e^{i\phi}|a\rangle$&lt;/span&gt;. Then, the input &lt;span class=&quot;math-container&quot;&gt;$|a\rangle|b\rangle$&lt;/span&gt; is mapped to &lt;span class=&quot;math-container&quot;&gt;$|a\rangle + e^{i\phi}|b\rangle=(1+e^{i\phi})|a\rangle$&lt;/span&gt;, which (i) is not normalizable independent of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, (ii) is identically zero for &lt;span class=&quot;math-container&quot;&gt;$\phi=\pi$&lt;/span&gt;, and (iii) whose output &lt;em&gt;normalization&lt;/em&gt;, and whose &lt;em&gt;output state modulo a phase&lt;/em&gt; depends on the &lt;em&gt;unphysical&lt;/em&gt; state of the input.&lt;/p&gt;&#xA;&lt;p&gt;In brief, it is incompatible with linearity.&lt;/p&gt;&#xA;&lt;p&gt;After all, if the map - let's call it &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; - were linear, on input &lt;span class=&quot;math-container&quot;&gt;$|v\rangle$&lt;/span&gt;, it should produce the output &lt;span class=&quot;math-container&quot;&gt;$U|v\rangle$&lt;/span&gt;, and therefore due to linearity, on input &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}|v\rangle$&lt;/span&gt; the output &lt;span class=&quot;math-container&quot;&gt;$e^{i\phi}U|v\rangle$&lt;/span&gt;.  (As you can see: You don't even need linearity in this step, you just need homogeneity over the complex numbers!)  Clearly, the argument above shows that for the map you quote, this is not the case.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-04T13:11:19.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16348" PostTypeId="1" CreationDate="2021-03-04T15:41:52.187" Score="0" ViewCount="32" Body="&lt;p&gt;I am trying to improve an optimization method as describe in this paper:&#xA;&lt;a href=&quot;https://arxiv.org/pdf/2005.10811.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;enter link description here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For that I need to create many random equivalent circuits.&#xA;In my experiment I have 6 beam splitters and 4 phase shifters.&#xA;(In case of beam splitter is not perfect or because of other noises, I will need to chance the angle of my phase shifters for finding right unitary function. For instance in the ideal case I will have U(a1,a2,a3,a4) but because of the noises I may find different U for the same angles like U'(a1,a2,a3,a4) so for finding exact U, I need the change my angle like U(a1',a2',a3,a4) or U(a1,a2',a3',a4)....)SO I need to create random circuits with these 4 phase shifters.&#xA;Do we have a ready function for that in cirq? like random.circuit(parameters)&#xA;How can I create random circuits with Cirq? Since I will train a neural network, I need too many circuits?&#xA;Any recomandation for me?&lt;/p&gt;&#xA;" OwnerUserId="13548" LastActivityDate="2021-03-04T15:41:52.187" Title="Random Circuit Generation in Cirq" Tags="&lt;cirq&gt;&lt;machine-learning&gt;&lt;quantum-circuit&gt;&lt;random-quantum-circuit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16349" PostTypeId="2" ParentId="16324" CreationDate="2021-03-04T19:07:15.170" Score="2" Body="&lt;p&gt;The states reachable from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; using Clifford gates are precisely the six eigenstates of the single-qubit Pauli operators, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{S} = \{|0\rangle, |1\rangle, |+\rangle, |-\rangle, |{+i}\rangle,|{-i}\rangle\}\tag1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which are also known as the single-qubit stabilizer states.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark on generators&lt;/strong&gt; It is easy to express Pauli operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle H, S\rangle = \langle H, S, X, Y, Z\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we do not need to include Pauli operators among the generators of the Clifford group.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Elementary proof of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;&lt;/strong&gt; First note that all states in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; are reachable from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gates&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{ccc}&#xA;|0\rangle = I|0\rangle &amp;amp;&amp;amp; |1\rangle = HS^2H|0\rangle \\&#xA;|+\rangle = H|0\rangle &amp;amp;&amp;amp; |-\rangle = S^2H|0\rangle \\&#xA;|{+i}\rangle = SH|0\rangle &amp;amp;&amp;amp; |{-i}\rangle = S^3 H|0\rangle. \\&#xA;\end{array}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, compute the action of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; on all six states in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{ccc}&#xA;H|0\rangle = |+\rangle &amp;amp;&amp;amp;&#xA;S|0\rangle = |0\rangle \\&#xA;H|1\rangle = |-\rangle &amp;amp;&amp;amp;&#xA;S|1\rangle = i|1\rangle \equiv |1\rangle \\&#xA;H|+\rangle = |0\rangle &amp;amp;&amp;amp;&#xA;S|+\rangle = |{+i}\rangle \\&#xA;H|-\rangle = |1\rangle &amp;amp;&amp;amp;&#xA;S|-\rangle = |{-i}\rangle \\&#xA;H|{+i}\rangle = e^{i\pi/4}|{-i}\rangle \equiv |{-i}\rangle &amp;amp;&amp;amp;&#xA;S|{+i}\rangle = |-\rangle \\&#xA;H|{-i}\rangle = e^{-i\pi/4}|{+i}\rangle \equiv |{+i}\rangle &amp;amp;&amp;amp;&#xA;S|{-i}\rangle = |+\rangle \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and conclude that no combination of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; gates maps a state in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; to a state outside of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; using stabilizer formalism&lt;/strong&gt; Suppose &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Then for every unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, the state &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of &lt;span class=&quot;math-container&quot;&gt;$UAU^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, it is easy to check that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{ccc}&#xA;HXH^\dagger=Z &amp;amp;&amp;amp; SXS^\dagger=Y \\&#xA;HYH^\dagger=-Y &amp;amp;&amp;amp; SYS^\dagger=-X \\&#xA;HZH^\dagger=X &amp;amp;&amp;amp; SZS^\dagger = Z&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that conjugation by &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and conjugation by &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; permute the single-qubit Pauli group &lt;span class=&quot;math-container&quot;&gt;$G_1=\langle X, Y, Z\rangle$&lt;/span&gt;. Therefore, if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of a non-identity Pauli operator then  for every &lt;span class=&quot;math-container&quot;&gt;$V\in\langle H, S\rangle$&lt;/span&gt; the state &lt;span class=&quot;math-container&quot;&gt;$V|\psi\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of a non-identity Pauli operator.&lt;/p&gt;&#xA;&lt;p&gt;Finally, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of &lt;span class=&quot;math-container&quot;&gt;$Z \in G_1$&lt;/span&gt;. Therefore, every state reachable from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of a non-identity operator in &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;. There are fifteen non-identity operators in &lt;span class=&quot;math-container&quot;&gt;$G_1$&lt;/span&gt;, but only six of them have &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; as an eigenvalue. These are: &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$-X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$-Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-Z$&lt;/span&gt;. The corresponding &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstates are: &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|{+i}\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|{-i}\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&lt;p&gt;For the converse, see &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; above.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-05T00:33:15.190" LastActivityDate="2021-03-05T00:33:15.190" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16350" PostTypeId="1" AcceptedAnswerId="16357" CreationDate="2021-03-04T19:26:33.163" Score="3" ViewCount="210" Body="&lt;p&gt;For some reason, I'm having difficulty with a seemingly very basic component of Grover's. When reading most explanations, the problem is framed as &amp;quot;consider an unstructured database of N items. If we are looking for value &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;, then the oracle marks the item, the amplitude is increased,&amp;quot; and so on. However, my understanding is this, and please correct me:&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&amp;quot;Given an unstructured database of N items, a quantum database exists containing N items with indices &lt;span class=&quot;math-container&quot;&gt;$|0\rangle ... |N\rangle$&lt;/span&gt;. If we are looking for a value &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;, an oracle function finds &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; in the database, marks the index &lt;span class=&quot;math-container&quot;&gt;$|X\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;, and the algorithm proceeds to increase the amplitude of &lt;span class=&quot;math-container&quot;&gt;$|X\rangle$&lt;/span&gt;&amp;quot;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this understanding, the quantum states act as indices for &amp;quot;real&amp;quot; entries in some unstructured database, like names or phone numbers. I am getting confused in that most explanations seem to be&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Considering a specific quantum state to look for, i.e. &lt;span class=&quot;math-container&quot;&gt;$|1001\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Implementing an oracle specifically for the purpose of marking and amplifying this state, and&lt;/li&gt;&#xA;&lt;li&gt;Showing that the oracle did, in fact, amplify that state.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I would think that the point of the oracle would be to mark whichever state acted as the index for a desired value &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;, not the other way around. That being said, how could someone implement this in the context of having a string or other data type as input? I’m more focused on the concept in general, but the issue of data types arises for me necessarily.&lt;/p&gt;&#xA;&lt;p&gt;I.e., looking for value &amp;quot;1&amp;quot; as &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; in this table:&lt;/p&gt;&#xA;&lt;div class=&quot;s-table-container&quot;&gt;&#xA;&lt;table class=&quot;s-table&quot;&gt;&#xA;&lt;thead&gt;&#xA;&lt;tr&gt;&#xA;&lt;th style=&quot;text-align: left;&quot;&gt;Index&lt;/th&gt;&#xA;&lt;th style=&quot;text-align: left;&quot;&gt;Value&lt;/th&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/thead&gt;&#xA;&lt;tbody&gt;&#xA;&lt;tr&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;00&amp;gt;&lt;/td&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;2&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;01&amp;gt;&lt;/td&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;0&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;10&amp;gt;&lt;/td&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;3&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;11&amp;gt;&lt;/td&gt;&#xA;&lt;td style=&quot;text-align: left;&quot;&gt;1&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;should use the oracle to find 1, mark the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, and amplify &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; to act as a return value.&lt;/p&gt;&#xA;&lt;p&gt;Any advice would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="14019" LastEditorUserId="55" LastEditDate="2021-05-08T13:32:26.953" LastActivityDate="2021-05-08T13:32:26.953" Title="How can Grover's algorithm be implemented when having a string or other data type as input?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16351" PostTypeId="1" CreationDate="2021-03-04T19:52:28.363" Score="1" ViewCount="66" Body="&lt;p&gt;I am following this very nice &lt;a href=&quot;https://qiskit.org/textbook/ch-paper-implementations/vqls.html#3.-Qiskit-Implementation&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit tutorial&lt;/a&gt; on how to implement a simple variational quantum linear solver (VQLS). There are 3 examples implemented in the tutorial all of which are solving the &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt; problem, however I can only get the first one to work consistently. To be clear, for the discussion below, I am using the exact code given on their page.&lt;/p&gt;&#xA;&lt;p&gt;Looking at their second example where &lt;span class=&quot;math-container&quot;&gt;$A = 0.55I + 0.225Z_2 + 0.225Z_3$&lt;/span&gt; the solver fails to find an adequate solution. To show this, I use a metric defined on their page to measure the accuracy of the solution: &lt;span class=&quot;math-container&quot;&gt;$b(Ax)/|Ax|^2$&lt;/span&gt;. An accurate solution will be near &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, however, they report &lt;span class=&quot;math-container&quot;&gt;$0.2920$&lt;/span&gt; demonstrating that their method has failed. This is strange because they claim that it has succeeded. This can be easily checked by taking the optimized parameters they provide which are given as the following vector:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;x: array([2.38122341, 1.98992817, 4.69971104, 1.56178653, 3.12971691,1.56423666, 0.66469388, 4.26774393, 0.7439952 ])&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;These parameters can be directly input into their &lt;code&gt;apply_fixed_ansatz&lt;/code&gt; function to obtain the solution &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. Doing this, one finds that &lt;span class=&quot;math-container&quot;&gt;$Ax\neq b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is, is the tutorial wrong as I have stated? If so, how is it wrong and what can I do to fix it? Otherwise, am I misunderstanding the tutorial and if so, where am I going wrong?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastEditorUserId="5955" LastEditDate="2021-03-06T09:22:16.113" LastActivityDate="2021-03-12T19:06:50.347" Title="Why does the Qiskit tutorial for the Variational Quantum Linear Solver not work properly?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16352" PostTypeId="1" CreationDate="2021-03-04T20:25:05.480" Score="1" ViewCount="77" Body="&lt;p&gt;I have studied the example of the simulation of LiH molecule in Learning Quantum Computation using Qiskit. It is available on this link: &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#VQE-Implementation-in-Qiskit&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-applications/vqe-molecules.html#VQE-Implementation-in-Qiskit&lt;/a&gt; .&#xA;I don't understand the following cell:&lt;a href=&quot;https://i.stack.imgur.com/O2c9f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/O2c9f.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why &lt;code&gt;freeze_list&lt;/code&gt; and &lt;code&gt;remove_list&lt;/code&gt; are initialized in this way?&#xA;How does this procedure work?&lt;/p&gt;&#xA;" OwnerUserId="11654" LastEditorUserId="55" LastEditDate="2021-03-05T09:01:39.460" LastActivityDate="2021-04-04T10:02:25.217" Title="Need some help with simulating molecules with VQE" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16353" PostTypeId="1" AcceptedAnswerId="16355" CreationDate="2021-03-04T21:35:40.460" Score="3" ViewCount="61" Body="&lt;p&gt;If we have the following two states&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle_1 = \frac{1}{\sqrt{2}}|0\rangle_A|0\rangle_B + \frac{1}{\sqrt{2}} |1\rangle_A |1\rangle_B&#xA;\end{equation}&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle_2 = \frac{1}{\sqrt{2}}|0\rangle_A|0\rangle_B - \frac{1}{\sqrt{2}} |1\rangle_A |1\rangle_B&#xA;\end{equation}&lt;/span&gt;&#xA;How do you mix them with the same proportion to create a mixed state? What would be the resulting density operator?&lt;/p&gt;&#xA;" OwnerUserId="14697" LastEditorUserId="55" LastEditDate="2021-03-05T08:55:51.703" LastActivityDate="2021-03-10T22:20:28.683" Title="How do you mix two pure states to obtain a mixed state?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16354" PostTypeId="1" CreationDate="2021-03-04T22:33:34.330" Score="1" ViewCount="81" Body="&lt;p&gt;I was trying to run this code on a quantum computer but I was getting an error can anyone suggest how to resolve this error?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;enter preformatted text here&#xA;vector = [(159+625j), (3+71j)]&#xA;norm = np.linalg.norm(vector)&#xA;qc = QuantumCircuit(1)  # Create a quantum circuit with one qubit&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;print('initial state is')&#xA;print(initial_state)&#xA;qc.initialize(initial_state, 0) &#xA;qc.x(0) ###### for not gate&#xA;qc.h(0) ####### for hadamard gate&#xA;qc.snapshot('final', snapshot_type='statevector')&#xA;a = qc.draw() &#xA;print(a)&#xA;IBMQ.load_account()&#xA;#provider = IBMQ.get_provider = ('ibm-q')&#xA;provider = IBMQ.load_account()&#xA;qcomp= provider.get_backend('ibmq_belem')&#xA;job = execute(qc,backend=qcomp)&#xA;from qiskit.tools.monitor import  job_monitor&#xA;job_monitor(job)&#xA;result = job.result()&#xA;plot_histogram(result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I ran this through the quantum computer I am getting this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Cannot unroll the circuit to the given basis, ['id', 'rz', 'sx', 'x', 'cx', 'reset']. &#xA;No rule to expand instruction multiplex1_dg.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="1859" LastEditDate="2021-03-05T10:54:09.910" LastActivityDate="2021-03-05T16:54:08.280" Title="Error while running Qiskit code on real quantum computer" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16355" PostTypeId="2" ParentId="16353" CreationDate="2021-03-04T23:01:42.187" Score="3" Body="&lt;p&gt;You can prepare the mixed state as follows. Flip a perfect coin. If it comes up heads, prepare &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_1$&lt;/span&gt;, otherwise prepare &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_2$&lt;/span&gt;. Finally, forget the result of flipping the coin.&lt;/p&gt;&#xA;&lt;p&gt;The corresponding density operator is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{2} |\psi\rangle_1\langle\psi|_1 + \frac{1}{2} |\psi\rangle_2\langle\psi|_2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-04T23:01:42.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16356" PostTypeId="2" ParentId="16354" CreationDate="2021-03-04T23:20:07.860" Score="2" Body="&lt;p&gt;As commented by @Luciano and @Patrick, it probably has to do with the qiskit version that you are using. Patrick pointed out in the comment that if you are using qiskit version 0.20.0 or later then you wouldn't have the unroll error.&lt;/p&gt;&#xA;&lt;p&gt;However, there is also a problem with your circuit of not having measurement but then you tried to get the counts value of the experiment to plot the histogram... so I took what you did and fixed it. What you have should work now once you upgrade your qiskit to a later version.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, execute, QuantumRegister, ClassicalRegister, IBMQ&#xA;from qiskit.tools.monitor import  job_monitor&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;import numpy as np&#xA;provider = IBMQ.load_account()&#xA;&#xA;vector = [(159+625j), (3+71j)]&#xA;norm = np.linalg.norm(vector)&#xA;qc = QuantumCircuit(1,1)  # Create a quantum circuit with one qubit&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;print('initial state is')&#xA;print(initial_state)&#xA;qc.initialize(initial_state, 0) &#xA;qc.x(0) ###### for not gate&#xA;qc.h(0) ####### for hadamard gate&#xA;qc.measure([0],[0])&#xA;qc.snapshot('final', snapshot_type='statevector')&#xA;print(qc)&#xA;job = execute(qc,backend=provider.get_backend('ibmq_belem'))&#xA;job_monitor(job)&#xA;result = job.result()&#xA;plot_histogram(result.get_counts(qc))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output would be something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;initial state is&#xA;[0.24506358+0.96330023j 0.00462384+0.10943091j]&#xA;     ┌────────────────────────────────────────────────┐┌───┐┌───┐┌─┐ ░ &#xA;q_0: ┤ initialize(0.24506+0.9633j,0.0046238+0.10943j) ├┤ X ├┤ H ├┤M├─░─&#xA;     └────────────────────────────────────────────────┘└───┘└───┘└╥┘ ░ &#xA;c: 1/═════════════════════════════════════════════════════════════╩════&#xA;                                                                  0    &#xA;Job Status: job has successfully run&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xhuVi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xhuVi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-05T16:54:08.280" LastActivityDate="2021-03-05T16:54:08.280" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16357" PostTypeId="2" ParentId="16350" CreationDate="2021-03-04T23:28:41.470" Score="6" Body="&lt;p&gt;A lot of explanations of Grover's search suffer from the common issue of claiming it's a database search or, worse yet, looking for a hardcoded element. (You have examples of both in your question, so you've already noticed this!)&lt;/p&gt;&#xA;&lt;p&gt;In reality Grover's search is best thought of as a way of searching for an element that satisfies a certain condition, i.e., inverting a function. The oracle should encode not the answer itself (that would be really weird), but a way to recognize that the bit string presented to it is an answer. You can encode the database into the oracle, but that will be computationally expensive and defeat the purpose of using Grover's search.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/learn/modules/solve-graph-coloring-problems-grovers-search/2-problem-description&quot; rel=&quot;noreferrer&quot;&gt;Here&lt;/a&gt; is the way I usually describe the search problem (the problem solved by the Grover's search algorithm) to avoid the database search analogy.&lt;/p&gt;&#xA;&lt;p&gt;Here are several questions similar to yours with excellent answers that offer more insight:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5696/how-is-the-grover-algorithm-applied-to-a-database&quot;&gt;How is the Grover-Algorithm applied to a database?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/7138/in-grovers-algorithm-does-the-exact-solution-need-to-be-given-to-the-oracle&quot;&gt;In Grover&amp;#39;s Algorithm, does the exact solution need to be given to the oracle?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6325/grover-algorithm-for-a-database-search-where-is-the-quantum-advantage&quot;&gt;Grover algorithm for a database search: where is the quantum advantage?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-03-04T23:28:41.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16358" PostTypeId="2" ParentId="16352" CreationDate="2021-03-04T23:56:04.120" Score="0" Body="&lt;p&gt;The freeze list indicates frozen of the core orbital. If you execute: &lt;code&gt;molecule.core_orbitals&lt;/code&gt; you will get the output: &lt;code&gt;[0]&lt;/code&gt;. So that is why the freeze list initialize that way.&lt;/p&gt;&#xA;&lt;p&gt;As for the other two orbitals, &lt;code&gt;[-3,-2]&lt;/code&gt; in the &lt;code&gt;remove_list&lt;/code&gt;, this have to do with some chemistry intuition or calculation to determine that it has no effect to the overall problem. Thus they can be removed without any consequences to the answer. This will save us to have to use additional qubits.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-04T23:56:04.120" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16359" PostTypeId="2" ParentId="16275" CreationDate="2021-03-05T04:49:14.203" Score="1" Body="&lt;p&gt;No, solving QAOA with &lt;span class=&quot;math-container&quot;&gt;$p = 1$&lt;/span&gt; using pure-state simulation does not always result in a perfect solution. 'Perfect' is interpreted to imply preparation of a state that minimizes the expectation value, such that increasing &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; cannot yield a smaller value. Several analytic results show that increasing &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; will generally yield better solutions, eg, &lt;a href=&quot;https://arxiv.org/abs/2005.08747&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/abs/2010.11209&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, with results from pure-state simulations showing this to be true in practice, eg, &lt;a href=&quot;https://arxiv.org/abs/2102.06813&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Intuitively, the depth &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; needs to be sufficiently large to walk the cycles of the graph. For the above example of a line graph with &lt;span class=&quot;math-container&quot;&gt;$n=3$&lt;/span&gt;, the depth &lt;span class=&quot;math-container&quot;&gt;$p=1$&lt;/span&gt; suffices. But testing against larger graphs will confirm the expected behavior that increasing &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; improves the optimal solution quality.&lt;/p&gt;&#xA;" OwnerUserId="15092" LastActivityDate="2021-03-05T04:49:14.203" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16360" PostTypeId="1" CreationDate="2021-03-05T09:01:15.443" Score="4" ViewCount="42" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; be positive semidefinite operators with trace less than or equal to 1. Let &lt;span class=&quot;math-container&quot;&gt;$\rho\approx_{\varepsilon}\sigma$&lt;/span&gt; i.e. they are close in some distance, such as the trace distance.&lt;/p&gt;&#xA;&lt;p&gt;Assume that we have &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\rho)\not\subset\text{supp}(\sigma)$&lt;/span&gt; i.e. there exists some vector &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$v^\dagger\rho v &amp;gt; 0$&lt;/span&gt; but &lt;span class=&quot;math-container&quot;&gt;$v^\dagger\sigma v = 0$&lt;/span&gt;. It seems like I should be able to apply some projector to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to obtain &lt;span class=&quot;math-container&quot;&gt;$\rho' = \Pi\rho\Pi$&lt;/span&gt; where&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho'\approx_{\varepsilon}\rho$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\rho')\subset\text{supp}(\sigma)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The intuition is that there are only some at most &lt;span class=&quot;math-container&quot;&gt;$\varepsilon-$&lt;/span&gt;small eigenvalues that I need to remove from &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to get it into the support of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;. Can someone help with how to construct such a projector?&lt;/p&gt;&#xA;" OwnerUserId="15111" LastActivityDate="2021-03-05T09:01:15.443" Title="If $\rho \approx_{\varepsilon}\sigma$, how to find $\Pi\rho\Pi$ to ensure that $\text{supp}(\Pi\rho\Pi)\subset\text{supp}(\sigma)$?" Tags="&lt;quantum-state&gt;&lt;projection-operator&gt;&lt;trace-distance&gt;" AnswerCount="0" CommentCount="4" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16361" PostTypeId="1" AcceptedAnswerId="16390" CreationDate="2021-03-05T10:12:57.200" Score="2" ViewCount="118" Body="&lt;p&gt;Let's assume I have two qubits of state &lt;span class=&quot;math-container&quot;&gt;$|A_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|A_1\rangle$&lt;/span&gt; correspondingly stored in a quantum memory. How do I find a Unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that acts on another register of 2-qubits such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U:|i\rangle|0\rangle\rightarrow|i\rangle|A_i\rangle?$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is such a unitary even possible or is this forbidden due to the no-cloning theorem? However, I don't want to clone the states &lt;span class=&quot;math-container&quot;&gt;$|A_0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|A_1\rangle$&lt;/span&gt;, but rather do some kind of multiplexing with them.&lt;/p&gt;&#xA;&lt;p&gt;That's what my register looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AjqQb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AjqQb.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the end, I want to turn the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; qubit into &lt;span class=&quot;math-container&quot;&gt;$|A_i\rangle$&lt;/span&gt; depending on the state of the &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; qubit. Is something like this generally possible?&lt;/p&gt;&#xA;" OwnerUserId="14817" LastEditorUserId="55" LastEditDate="2021-03-05T11:23:43.950" LastActivityDate="2021-03-08T07:02:53.643" Title="Find unitary such that $U:|i\rangle|0\rangle\rightarrow|i\rangle|A_i\rangle$" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;gate-synthesis&gt;&lt;unitarity&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16362" PostTypeId="1" CreationDate="2021-03-05T10:51:19.747" Score="2" ViewCount="42" Body="&lt;p&gt;I am trying to design this circuits with strawberry fields. However I could not connect my first and second qubit mode:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JPR3E.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JPR3E.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;orange boxes are beam splitters, blue boxes are phase shifters. The green box is nothing. (There was a letter of brand so I wanted to close it)&#xA;First two lines corresponds to 2 modes of my first qubit: Let's say: 0_a and 1_a and the other two lines corresponds my second qubit modes Let's say 0_b and 1_b&lt;/p&gt;&#xA;&lt;p&gt;My code is here:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  prog = sf.Program(4)&#xA;&#xA;with prog.context as q:&#xA;    ops.BSgate() | (q[0], q[1])&#xA;    ops.BSgate() | (q[2], q[3])&#xA;    ops.Rgate(0.5719) | q[0]&#xA;    ops.BSgate() | (q[0], q[1])&#xA;    ops.Rgate(-1.9782) | q[1]&#xA;    ops.BSgate() | (q[0], q[1])&#xA;    ops.Rgate(-1.9782) | q[2]&#xA;    ops.BSgate() | (q[2], q[3])&#xA;    ops.Rgate(-1.9782) | q[2]&#xA;    ops.BSgate() | (q[2], q[3])&#xA;eng = sf.Engine(&amp;quot;fock&amp;quot;, backend_options={&amp;quot;cutoff_dim&amp;quot;: 5})&#xA;&#xA;prog.print()&#xA;#prog.draw_circuit(tex_dir='./circuit_tex', write_to_file=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My result is here&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cnoqH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cnoqH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and indeed I could not make this connection:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Zrx8V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zrx8V.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any help for me?&#xA;Am I writing to correct code?&lt;/p&gt;&#xA;" OwnerUserId="13548" LastEditorUserId="55" LastEditDate="2021-03-05T18:12:02.473" LastActivityDate="2021-04-05T21:02:25.247" Title="Design NISQ Circuit with StrawberryFields" Tags="&lt;programming&gt;&lt;quantum-circuit&gt;&lt;photonics&gt;&lt;nisq&gt;&lt;strawberryfields&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16363" PostTypeId="2" ParentId="16361" CreationDate="2021-03-05T12:35:34.790" Score="0" Body="&lt;p&gt;Yeah you can do it! Here's the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dBKrg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dBKrg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The reason that the no-cloning theorem does not apply here is because you are  requiring precise inputs (in particular you are choosing your input qubit to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;). A cloning would look like &lt;span class=&quot;math-container&quot;&gt;$|A_i\rangle|i\rangle|x\rangle \rightarrow |A_i\rangle|i\rangle|A_i\rangle$&lt;/span&gt; for some arbitrary &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; which would indeed be impossible.&lt;/p&gt;&#xA;&lt;p&gt;Also if you would like the gates to be even more 'elementary', you can check you &lt;a href=&quot;https://arxiv.org/abs/1210.0974&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; that describes how to construct CCNOT gates out of T gates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit: This only works if &lt;span class=&quot;math-container&quot;&gt;$A_i = \{0,1\}$&lt;/span&gt;, not for any arbitrary superposition (thank you Mateus Araújo for pointing that out)&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastEditorUserId="14597" LastEditDate="2021-03-05T13:04:02.233" LastActivityDate="2021-03-05T13:04:02.233" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16364" PostTypeId="1" CreationDate="2021-03-05T13:03:58.973" Score="4" ViewCount="82" Body="&lt;p&gt;Consider a quantum channel &lt;span class=&quot;math-container&quot;&gt;$\Phi : M_n \rightarrow M_m$&lt;/span&gt; and let &lt;span class=&quot;math-container&quot;&gt;$\frac{\mathbb{I}_n}{n}$&lt;/span&gt; be the maximally mixed input state. For all input states &lt;span class=&quot;math-container&quot;&gt;$\rho\in M_n$&lt;/span&gt;, is it true that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\quad \text{rank} \, \Phi (\rho) \leq \text{rank}\, \Phi \left(\mathbb{\frac{I_n}{n}}\right)?$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastActivityDate="2021-03-06T12:38:17.800" Title="Does a quantum channel map the maximally mixed input state into an output state with maximal rank?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16365" PostTypeId="1" CreationDate="2021-03-05T13:25:31.657" Score="4" ViewCount="87" Body="&lt;p&gt;I am reading a paper on Quantum Computing. What does it mean when authors says &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\log(m)$&lt;/span&gt;-qubits. I know what does &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit mean where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is positive integer, but &lt;span class=&quot;math-container&quot;&gt;$\log(m)$&lt;/span&gt; may not be an integer, in that case how would we define &lt;span class=&quot;math-container&quot;&gt;$\log(m)$&lt;/span&gt; qubit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.researchgate.net/publication/348796217_Quantum_Bloom_filter_and_its_applications&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.researchgate.net/publication/348796217_Quantum_Bloom_filter_and_its_applications&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/I2tz2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/I2tz2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15112" LastEditorUserId="2293" LastEditDate="2021-03-06T21:44:43.320" LastActivityDate="2021-03-06T21:44:43.320" Title="What is meant by $\log(m)$ qubits" Tags="&lt;algorithm&gt;&lt;notation&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16366" PostTypeId="2" ParentId="16364" CreationDate="2021-03-05T14:15:57.807" Score="2" Body="&lt;p&gt;Let's forget about normalization of the two sides of the inequality as if &lt;span class=&quot;math-container&quot;&gt;$\operatorname{rank}(A) \leq \mathrm{rank}(B)$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(c A) \leq \mathrm{rank}(d B)$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$c,d \neq 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now let's write &lt;span class=&quot;math-container&quot;&gt;$I_n = \rho + (I-\rho)$&lt;/span&gt;. As &lt;span class=&quot;math-container&quot;&gt;$\rho \leq I_n$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a quantum state, we have &lt;span class=&quot;math-container&quot;&gt;$(I-\rho) \geq 0$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\Phi(I_n) &amp;amp;= \Phi(\rho + (I_n-\rho)) \\&#xA;&amp;amp;= \Phi(\rho) + \Phi(I_n-\rho)&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Thus &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\Phi(I_n)) = \mathrm{rank}(\Phi(\rho) + \Phi(I_n-\rho))$&lt;/span&gt;. But as &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi(I_n - \rho)$&lt;/span&gt; are both positive-semidefinite we have &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(\Phi(\rho) + \Phi(I_n-\rho)) \geq \mathrm{rank}(\Phi(\rho))$&lt;/span&gt; (see &lt;a href=&quot;https://math.stackexchange.com/a/2153772/191112&quot;&gt;this answer&lt;/a&gt; for a proof of that).&lt;/p&gt;&#xA;&lt;p&gt;Putting it all together we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{rank}(\Phi(I_n)) \geq \mathrm{rank}(\Phi(\rho) )&#xA;$$&lt;/span&gt;&#xA;which implies the idenity in the question.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Regarding the title of the question&lt;/strong&gt;&#xA;You should not interpret this result as saying that the maximally mixed state is always mapped to a state of maximal rank in the output system. For example, you can take take a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho) = \mathrm{Tr}(\rho) |0\rangle \langle 0 |$&lt;/span&gt; whose output will always have rank &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; regardless of the dimension of the output sysytem.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-05T14:15:57.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16367" PostTypeId="2" ParentId="16364" CreationDate="2021-03-05T14:19:31.800" Score="1" Body="&lt;p&gt;Yes, since for an arbitrary state &lt;span class=&quot;math-container&quot;&gt;$\rho \in M_n$&lt;/span&gt;, there exists a &lt;span class=&quot;math-container&quot;&gt;$\delta &amp;gt; 0$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\delta \rho \leq \mathbb{I_n}/n$&lt;/span&gt;. The positivity of the channel then implies that &lt;span class=&quot;math-container&quot;&gt;$\Phi (\delta \rho) = \delta \Phi(\rho) \leq \Phi (\mathbb{I_n}/n)$&lt;/span&gt;, which clearly implies that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{rank}\, \Phi (\rho) \leq \text{rank}\, \Phi (\mathbb{I_n}/n).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastActivityDate="2021-03-05T14:19:31.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16368" PostTypeId="1" AcceptedAnswerId="16369" CreationDate="2021-03-05T15:43:02.740" Score="1" ViewCount="68" Body="&lt;p&gt;Consider quantum channels &lt;span class=&quot;math-container&quot;&gt;$\Phi : M_n \rightarrow M_{d_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi : M_n \rightarrow M_{d_2}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$d_1\leq d_2$&lt;/span&gt;. We say that &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is isometrically extended by &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; (denoted &lt;span class=&quot;math-container&quot;&gt;$\Phi \leq_{\text{iso}} \Psi$&lt;/span&gt;) if &lt;span class=&quot;math-container&quot;&gt;$\exists$&lt;/span&gt; an isometry &lt;span class=&quot;math-container&quot;&gt;$V: \mathbb{C}^{d_1} \rightarrow \mathbb{C}^{d_2}$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall \, \rho\in M_n: \qquad \Psi (\rho) = V\Phi (\rho) V^\dagger . $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, define the minimal output dimension of a channel &lt;span class=&quot;math-container&quot;&gt;$\Psi : M_n \rightarrow M_{m}$&lt;/span&gt; as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{min out }(\Psi) = \text{min} \{d \in \mathbb{N} : \exists \, \text{channel } \Phi : M_n \rightarrow M_d \text{ such that } \Phi \leq_{\text{iso}}\Psi \}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I claim that for any given channel &lt;span class=&quot;math-container&quot;&gt;$\Psi : M_n \rightarrow M_m$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$$\text{min out }(\Psi) = \text{rank}\,\Psi (\mathbb{I_n}),$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I_n}\in M_n$&lt;/span&gt; is the identity matrix. Can someone help me prove this?&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="12710" LastEditDate="2021-03-06T02:38:16.180" LastActivityDate="2021-03-06T02:38:16.180" Title="Minimal output dimension of a quantum channel" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16369" PostTypeId="2" ParentId="16368" CreationDate="2021-03-05T17:17:15.150" Score="2" Body="&lt;p&gt;The proof of the claim hinges on the fact that for a given channel &lt;span class=&quot;math-container&quot;&gt;$\Psi: M_n\rightarrow M_m$&lt;/span&gt;, the following inclusion holds for all positive semi-definite &lt;span class=&quot;math-container&quot;&gt;$\rho\in M_n$&lt;/span&gt; (see the answer provided &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16364/does-a-quantum-channel-map-the-maximally-mixed-input-state-into-an-output-state&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{range} \, \Psi(\rho) \subseteq \text{range}\, \Psi (\mathbb{I_n}).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once we know the above fact, it becomes clear that all the outputs of &lt;span class=&quot;math-container&quot;&gt;$\Psi$&lt;/span&gt; can be thought to operate on the smaller subspace &lt;span class=&quot;math-container&quot;&gt;$\text{range}\, \Psi(\mathbb{I}_n) \subseteq \mathbb{C}^m$&lt;/span&gt;, which can be isometrically embedded into &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^m$&lt;/span&gt;. It is then straightforward to construct a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi : M_n \rightarrow M_r \simeq \mathcal{B}(\text{range}\, \Psi(\mathbb{I_n}))$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\Phi\leq_{\text{iso}} \Psi$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$r=\text{rank} \, \Psi(\mathbb{I_n})$&lt;/span&gt;. Hence, we have established the following inequality: &lt;span class=&quot;math-container&quot;&gt;$$ \text{min out } (\Psi) \leq \text{rank} \, \Psi(\mathbb{I_n}).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the reverse inequality, observe that since ranks of matrices stay invariant under isometric conjugations, any channel &lt;span class=&quot;math-container&quot;&gt;$\Phi:M_n\rightarrow M_d$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\Phi\leq_{\text{iso}}\Psi$&lt;/span&gt; must be defined with an output dimension &lt;span class=&quot;math-container&quot;&gt;$d\geq \text{rank}\, \Psi(\mathbb{I_n})$&lt;/span&gt;. In other words, we obtain:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{min out }(\Psi) \geq \text{rank }\Psi(\mathbb{I_n}).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="12710" LastEditDate="2021-03-06T02:22:08.547" LastActivityDate="2021-03-06T02:22:08.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16370" PostTypeId="1" CreationDate="2021-03-05T17:20:51.170" Score="0" ViewCount="44" Body="&lt;p&gt;What could be the steps to implement a distance based classifier (eg Qknn) on our dataset using quantum computing?&lt;/p&gt;&#xA;&lt;p&gt;I read a paper on &amp;quot;Distance based classifier using Iris dataset&amp;quot;. I wanted to implement the same on my machine considering any random dataset taking 2 datapoints and 2 features as considered in the paper. SO do i need to make some changes in the gates or where do i need to put my data values?&lt;/p&gt;&#xA;" OwnerUserId="14924" LastEditorUserId="14924" LastEditDate="2021-03-08T14:18:33.307" LastActivityDate="2021-03-08T14:18:33.307" Title="How do we implement QKNN algorithm on our dataset" Tags="&lt;algorithm&gt;&lt;ibm-q-experience&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16371" PostTypeId="2" ParentId="16365" CreationDate="2021-03-05T18:25:56.163" Score="2" Body="&lt;p&gt;As DaftWullie said in a comment, &lt;span class=&quot;math-container&quot;&gt;$\log m$&lt;/span&gt; is most likely a shorthand for &lt;span class=&quot;math-container&quot;&gt;$\lceil\log_2 m\rceil$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Traditionally in computer science, one looks only at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Big_O_notation&quot; rel=&quot;nofollow noreferrer&quot;&gt;asymptotic complexity&lt;/a&gt; of algorithms. Logarithms to different (constant) bases are asymptotically equivalent, so the base is usually omitted, and floor and ceiling operations don't affect the complexity, so they're usually left out.&lt;/p&gt;&#xA;&lt;p&gt;Given the current state of quantum computing hardware, it would probably make sense to do a more careful analysis of the exact minimum qubit requirements of quantum algorithms, but old habits die hard.&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2021-03-05T18:25:56.163" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16372" PostTypeId="2" ParentId="16365" CreationDate="2021-03-05T22:24:01.523" Score="5" Body="&lt;p&gt;Unfortunately the first answer by benrg is not correct:  &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\log m$&lt;/span&gt; qubits&amp;quot; in that sentence does not have to do with &amp;quot;asymptotic complexity&amp;quot; and the reason why floor and ceiling functions are left out is not because of them being equivalent asymptotically (even though they &lt;em&gt;are&lt;/em&gt; equivalent asymptotically, it's not the reason why they left those symbols out here).&lt;/p&gt;&#xA;&lt;p&gt;What is being described is an algorithm, and in step 4 of the algorithm, exactly &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits are needed, not &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log_2 m)$&lt;/span&gt; qubits&amp;quot; which means &lt;span class=&quot;math-container&quot;&gt;$\le C\log_2 m$&lt;/span&gt; qubits for a positive constant &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and for sufficiently large &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can see later in the paper that the &amp;quot;first &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits&amp;quot; are treated one way, and the &amp;quot;last &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits&amp;quot; are treated another way:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Furthermore, from Eqs.32, we can see that the first logm&#xA;qubits are plain (i.e., the maximally mixed state), while the&#xA;last logm qubits are obscure due to the secret .&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;They also describe what happens to the &amp;quot;second &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits&amp;quot; elsewhere.&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;It's just describing a specific number of qubits on which you're doing, for example, a measurement. &lt;strong&gt;This indicates that &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; ought to be a power of 2 in the algorithm&lt;/strong&gt;. You can read the algorithm in more detail and try it &lt;em&gt;in full&lt;/em&gt; for small values of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; to get a feel for why that might be.&lt;/p&gt;&#xA;&lt;p&gt;At the end of the paper they talk about the algorithm needing &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log_2 m)$&lt;/span&gt; qubits, but that's the total number of qubits required, which includes the &amp;quot;first&amp;quot;  &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits, the &amp;quot;second&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits, and the &amp;quot;last&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; to which they referred. The authors did not forget a &amp;quot;big Oh&amp;quot; when they were talking about what to do to the &amp;quot;first&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\log_2 m$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-05T22:48:26.890" LastActivityDate="2021-03-05T22:48:26.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16373" PostTypeId="1" CreationDate="2021-03-05T23:20:12.797" Score="2" ViewCount="370" Body="&lt;p&gt;I found this link and I am wondering if anyone has used it to learn or develop applications?  I would like to know if people find it worth the time.    I am reading the material by the way.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.ibm.com/quantum-computing/developers/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.ibm.com/quantum-computing/developers/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12700" LastEditorUserId="55" LastEditDate="2021-03-07T10:51:33.707" LastActivityDate="2021-03-07T10:51:33.707" Title="Does IBM have a publicly available tutorial on applied quantum computing and how does one use it? Any Reviews of the Tutorial?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;resource-request&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16374" PostTypeId="2" ParentId="16373" CreationDate="2021-03-06T01:17:37.237" Score="7" Body="&lt;p&gt;You forgot to post the &amp;quot;link&amp;quot; that you mentioned.&lt;/p&gt;&#xA;&lt;p&gt;To answer your question, yes IBM offers some very educational tutorials through their textbook &lt;a href=&quot;https://qiskit.org/textbook/ch-states/introduction.html&quot; rel=&quot;noreferrer&quot;&gt;found here&lt;/a&gt;. I am new to quantum computing myself, but I have found these tutorials were sufficient to get my feet up off the ground and start doing some projects on their machines.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastActivityDate="2021-03-06T01:17:37.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16375" PostTypeId="1" CreationDate="2021-03-06T07:39:05.250" Score="2" ViewCount="39" Body="&lt;p&gt;For QAOA  it is known that in the large &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; limit, the algorithm finds the minimum/maximum (see article &lt;a href=&quot;https://arxiv.org/abs/1411.4028v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;A Quantum Approximate Optimization Algorithm&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Is there  in general a proof for VQE starting from, let's say, uniform superposition state? Is there  a standard construction of a  circuit (ansatz preparation? not sure about the terminology) that the algorithm converges in some limit?&lt;/p&gt;&#xA;" OwnerUserId="14896" LastEditorUserId="55" LastEditDate="2021-03-07T10:52:39.763" LastActivityDate="2021-03-07T10:52:39.763" Title="Is there a general proof of convergence of variational quantum eigensolvers (VQEs) to the minimum eigenvalue?" Tags="&lt;vqe&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16376" PostTypeId="1" CreationDate="2021-03-06T07:49:55.567" Score="0" ViewCount="35" Body="&lt;p&gt;How can I process a 3 MB csv file in IBMQ?&lt;/p&gt;&#xA;&lt;p&gt;The memory shows 433 MB. Is this the maximum file size that I can upload and process in IBMQ?&lt;/p&gt;&#xA;" OwnerUserId="13003" LastEditorUserId="2293" LastEditDate="2021-03-24T14:32:30.317" LastActivityDate="2021-03-24T14:32:30.317" Title="Process 3 MB of data in IBM" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16377" PostTypeId="2" ParentId="16373" CreationDate="2021-03-06T07:54:16.750" Score="1" Body="&lt;p&gt;You can try &lt;a href=&quot;https://qiskit.org/documentation/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/&lt;/a&gt;. Scroll down to the tutorial part. I guess this is what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="13003" LastActivityDate="2021-03-06T07:54:16.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16378" PostTypeId="2" ParentId="16361" CreationDate="2021-03-06T08:38:48.503" Score="0" Body="&lt;p&gt;I tried to run circuit proposed by &lt;em&gt;Rajiv&lt;/em&gt; on IBM Q. In my case &lt;span class=&quot;math-container&quot;&gt;$|A_0\rangle = |+\rangle$&lt;/span&gt;, so probabilities of measuring 0 and 1 are 50 %. Then I set &lt;span class=&quot;math-container&quot;&gt;$|A_1\rangle = Ry(\pi/4)|0\rangle$&lt;/span&gt; which means that probability of measuring 0 is 85 % and for 1 it is 15 %.&lt;/p&gt;&#xA;&lt;p&gt;For setting &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, state &lt;span class=&quot;math-container&quot;&gt;$|A_0\rangle$&lt;/span&gt; is returned to qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; and for setting &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, state &lt;span class=&quot;math-container&quot;&gt;$|A_1\rangle$&lt;/span&gt; is returned to qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt;. Or in other words, I measured above mentioned probabilities on qubit &lt;span class=&quot;math-container&quot;&gt;$q_3$&lt;/span&gt; for both settings of &lt;span class=&quot;math-container&quot;&gt;$|i\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is a code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[4];&#xA;creg c[1];&#xA;&#xA;h q[0];&#xA;ry(pi/4) q[1];&#xA;x q[2]; \\put x for i = 1, remove this line for i = 0&#xA;x q[2];&#xA;ccx q[0],q[2],q[3];&#xA;x q[2];&#xA;ccx q[1],q[2],q[3];&#xA;measure q[3] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Concerning the no-cloning theorem. There is no violation of the theorem as the circuit proposed by &lt;em&gt;Rajiv&lt;/em&gt; uses controled fan-outs which does not violate the theorem. See explanation &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9113/no-cloning-theorem-and-fan-out-gate&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Original state &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; and its &amp;quot;copy&amp;quot; are of course entangled and hence not independent as the &amp;quot;copy&amp;quot; is produced by fan-out.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2021-03-08T07:02:53.643" LastActivityDate="2021-03-08T07:02:53.643" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16379" PostTypeId="1" CreationDate="2021-03-06T10:26:29.303" Score="1" ViewCount="80" Body="&lt;p&gt;I'm using pi-pulse pulses on qubit Armonk for determining 0 and 1 by Machine Learning. But when I run the code from &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html&lt;/a&gt;. I get an incorrect distribution of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QeNAj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QeNAj.png&quot; alt=&quot;my problem&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example, in the Qiskit textbook, this image looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GdrxC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GdrxC.png&quot; alt=&quot;correct image&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;About 3 months ago, the image that I got by using this textbook was correct, but now it's not.&#xA;When I use Machine Learning for old states, I get excellent results, but now my algorithms have failed on this task.&lt;/p&gt;&#xA;&lt;p&gt;Please, help me with my problem. I don't know, how to fix it. Why did this happen? That is the problem?&lt;/p&gt;&#xA;" OwnerUserId="15116" LastEditorUserId="15116" LastEditDate="2021-03-14T09:08:43.850" LastActivityDate="2021-03-14T09:08:43.850" Title="Is qiskit documentation about determining $|0\rangle$ and $|1\rangle$ incorrect?" Tags="&lt;programming&gt;&lt;machine-learning&gt;&lt;openpulse&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16380" PostTypeId="1" CreationDate="2021-03-06T12:27:18.923" Score="3" ViewCount="72" Body="&lt;p&gt;All the currently known examples of quantum channels with zero quantum capacity are either &lt;em&gt;PPT&lt;/em&gt; or &lt;em&gt;anti-degradable&lt;/em&gt;. These notions can be conveniently defined in terms of the Choi matrix of the given channel:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A channel is said to be &lt;em&gt;PPT&lt;/em&gt; if its Choi matrix is positive under partial transposition. In other words, the partial action of such a channel on any bipartite state results in a state which stays positive under partial transposition. Maximally entangled states cannot be distilled from such states at any positive rate, which is why these states are also called &lt;em&gt;bound&lt;/em&gt; entangled. This fact can be used to show that quantum information cannot be reliably transmitted through these channels and hence these channels have zero quantum capacity.&lt;/li&gt;&#xA;&lt;li&gt;A channel is said to be &lt;em&gt;anti-degradable&lt;/em&gt; if its Choi matrix admits a two-copy symmetric extension. Such a channel operates on any input state to yield a combined output-environment state which is symmetric under exchange. One can use this fact to show that if these channels can be used to reliably transmit quantum information, it would lead to a violation of the no-cloning theorem. Hence, anti-degradable channels have zero quantum capacity.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The aforementioned classes of channels are really distinct in the sense that one class is not a subset of the other or vice versa. The two classes have a non-trivial intersection which is known to contain the well-know class of entanglement-breaking channels. Interested readers should refer to this wonderful &lt;a href=&quot;https://arxiv.org/abs/1108.1807&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; for a more thorough discussion on these concepts.&lt;/p&gt;&#xA;&lt;p&gt;I am interested in examples of such zero capacity channels &lt;span class=&quot;math-container&quot;&gt;$\Phi : M_d \rightarrow M_d$&lt;/span&gt; which have Choi ranks strictly less than &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;. Recall that the Choi rank of a channel is the rank of its Choi matrix which equals the minimal number of Kraus operators required in the channel's Kraus representation. For &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, the rank constraint forces us to look at only unitary conjugations of the form &lt;span class=&quot;math-container&quot;&gt;$\Phi (\rho) = U\rho U^\dagger$&lt;/span&gt;, which have strictly positive capacity. For the next dimension &lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt;, all examples of zero capacity channels that I know of have Choi ranks &lt;span class=&quot;math-container&quot;&gt;$\geq 3$&lt;/span&gt; (such as the PPT channels in the depolarizing/dephasing family or the anti-degradable amplitude damping channels). Hence the question: Are there known examples of zero capacity qutrit channels with Choi rank &lt;span class=&quot;math-container&quot;&gt;$=2$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/619062/zero-capacity-quantum-channels&quot;&gt;Cross posted on physics.SE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="10480" LastEditDate="2021-03-26T04:43:40.983" LastActivityDate="2021-03-26T04:43:40.983" Title="What are examples of zero capacity quantum channels with Choi rank less than $d$?" Tags="&lt;quantum-operation&gt;&lt;communication&gt;&lt;partial-transpose&gt;&lt;channel-capacity&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16381" PostTypeId="2" ParentId="16364" CreationDate="2021-03-06T12:38:17.800" Score="0" Body="&lt;p&gt;Consider the Kraus representation of the channel &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathrm{Lin}(\mathcal X)\to\mathrm{Lin}(\mathcal Y)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(X)=\sum_{a=1}^d A_a X A_a^\dagger,\tag1$$&lt;/span&gt;&#xA;for all &lt;span class=&quot;math-container&quot;&gt;$X\in\mathrm{Lin}(\mathcal X)$&lt;/span&gt;, for some positive integer &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and set of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; linear operators &lt;span class=&quot;math-container&quot;&gt;$A_a\in\mathrm{Lin}(\mathcal X,\mathcal Y)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_a A_a^\dagger A_a=I_{\mathcal X}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\Phi(I_{\mathcal X}) = \sum_{a=1}^d A_a A_a^\dagger$&lt;/span&gt;.&#xA;Therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{supp}(\Phi(I_{\mathcal X}))=\bigcup_a \operatorname{supp}(A_a),$$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{supp}(\Phi(X))\subseteq \operatorname{supp}(\Phi(I_{\mathcal X}))$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-06T12:38:17.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16382" PostTypeId="1" CreationDate="2021-03-06T16:17:18.437" Score="2" ViewCount="38" Body="&lt;p&gt;I'm new to IBM, so I'm still figuring things out. I want to make a POVM measurement of a quantum state for state discrimination purposes. In other words I want a measurement that has three outcomes:&lt;/p&gt;&#xA;&lt;p&gt;A: It's state A with 100 % certainty (or x %)&#xA;B: It's state B with 100 % certainty (or x %)&#xA;C: Can't determine if it's state A or B.&lt;/p&gt;&#xA;&lt;p&gt;Can anyone help with how to do this in IBM's Quantum Composer?&lt;/p&gt;&#xA;" OwnerUserId="15120" LastEditorUserId="55" LastEditDate="2021-03-08T11:14:00.797" LastActivityDate="2021-03-08T11:19:03.990" Title="How to do a POVM measurement of a quantum state in IBM's Quantum Composer?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16383" PostTypeId="2" ParentId="16362" CreationDate="2021-03-06T20:51:08.600" Score="0" Body="&lt;p&gt;Ok It is done and it is correct. I just forgat to give an initial state to the program  like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Ket(initial_state) | q &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And after that I also added a BSGate for 1 and 2 mode&lt;/p&gt;&#xA;" OwnerUserId="13548" LastActivityDate="2021-03-06T20:51:08.600" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16384" PostTypeId="2" ParentId="15691" CreationDate="2021-03-06T22:21:53.383" Score="2" Body="&lt;p&gt;Ok let's break this down. Firstly the success probability for QPE and QAE are defined slightly differently.&lt;/p&gt;&#xA;&lt;p&gt;With QPE there are two error bounds &lt;span class=&quot;math-container&quot;&gt;$|\hat{x} - x| &amp;lt; \epsilon$&lt;/span&gt; to consider&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;lt; \frac{1}{2^{n+1}}$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$ \geq \frac{4}{\pi}$&lt;/span&gt;, or&#xA;&lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;lt; \frac{1}{2^{n}}$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$ \geq \frac{8}{\pi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can use the results of the QAE to show that for the given error bounds in QPE is equivalent.&lt;/p&gt;&#xA;&lt;p&gt;The error expression for QPE can be given in the form of Theorem 11 in the QAE paper (see Kaye, LaFlamme and Mosca). For QPE:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(x) = \frac{1}{2^{2n}}\frac{\sin^2(\pi(2^n\omega - x))}{\sin^2(\pi(\omega - x/2^n))}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now Theorem 11 states that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(x) = \frac{1}{M^2}\frac{\sin^2(M\pi\Delta)}{\sin^2(M\pi\Delta)}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Comparing these two equations we can see that for QPE &lt;span class=&quot;math-container&quot;&gt;$M=2^n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Delta = \omega - x/2^n$&lt;/span&gt; . Finally Theorem 11 states that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$P(\Delta &amp;lt; 1/M) \geq \frac{8}{\pi^2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So therefore with &lt;span class=&quot;math-container&quot;&gt;$M=2^n$&lt;/span&gt; the two results are actually equivalent for the same degree of accuracy.&lt;/p&gt;&#xA;&lt;p&gt;However, the difference occurs that in QAE &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is a parameter (number of iterations) set by the algorithm whereas in QPE it is fixed as &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. So the QAE error result, Theorem 12, states it more generally with respect to this parameter &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. For Theorem 12 If you take the limiting case with &lt;span class=&quot;math-container&quot;&gt;$k=1$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$M=2^n$&lt;/span&gt; you can see that the error results are equivalent with  &lt;span class=&quot;math-container&quot;&gt;$\leq 2\pi\frac{1}{2^n} + O(1/M^2)$&lt;/span&gt;, the factor of &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; comes from the definition of &lt;span class=&quot;math-container&quot;&gt;$|\hat{x} - x |$&lt;/span&gt; which uses the arclength. So in QAE if we take &lt;span class=&quot;math-container&quot;&gt;$M &amp;gt; 2^{n + 1}$&lt;/span&gt; we can achieve higher success probability with QAE than QPE.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2021-03-06T23:13:54.440" LastActivityDate="2021-03-06T23:13:54.440" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16385" PostTypeId="2" ParentId="12538" CreationDate="2021-03-06T22:23:04.017" Score="1" Body="&lt;p&gt;Unless we ignore the unobservable global phase, it is not possible to express qiskit's &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.U1Gate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;span class=&quot;math-container&quot;&gt;$U_1(\lambda)$&lt;/span&gt; gate&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\lambda}\end{pmatrix}$$&lt;/span&gt; for arbitrary &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt;. Note that the three rotation gates have unit determinant&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\det R_x(\theta) = \det \begin{pmatrix} \cos\frac{\theta}{2} &amp;amp; -i\sin\frac{\theta}{2} \\ -i\sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}\end{pmatrix} = 1\\&#xA;\det R_y(\theta) = \det \begin{pmatrix} \cos\frac{\theta}{2} &amp;amp; -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} &amp;amp; \cos\frac{\theta}{2}\end{pmatrix} = 1\\&#xA;\det R_z(\theta) = \det \begin{pmatrix} e^{-i\theta/2} &amp;amp; 0 \\ 0 &amp;amp; e^{i\theta/2}\end{pmatrix} = 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. Since &lt;a href=&quot;https://en.wikipedia.org/wiki/Determinant#Multiplicativity_and_matrix_groups&quot; rel=&quot;nofollow noreferrer&quot;&gt;determinant of a product is a product of determinants&lt;/a&gt;, any product of &lt;span class=&quot;math-container&quot;&gt;$R_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; also has unit determinant. On the other hand, &lt;span class=&quot;math-container&quot;&gt;$\det U_1(\lambda) = e^{i\lambda}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In other words, &lt;span class=&quot;math-container&quot;&gt;$R_x(\theta), R_y(\theta), R_z(\theta)\in SU(2)$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$U_1(\lambda)\notin SU(2)$&lt;/span&gt; unless &lt;span class=&quot;math-container&quot;&gt;$\lambda = 2\pi k$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$k\in\mathbb{Z}$&lt;/span&gt; (in which case &lt;span class=&quot;math-container&quot;&gt;$U_1(2\pi k) = I$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;However, if we ignore the global phase then &lt;span class=&quot;math-container&quot;&gt;$U_1(\lambda) = e^{i\lambda/2} R_z(\lambda)$&lt;/span&gt; is equivalent to &lt;span class=&quot;math-container&quot;&gt;$R_z(\lambda)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-12T19:28:19.273" LastActivityDate="2021-03-12T19:28:19.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16386" PostTypeId="1" CreationDate="2021-03-06T23:45:53.033" Score="2" ViewCount="47" Body="&lt;p&gt;I've been struggling with this for a while now, and whilst I suspect the answer is unknown or very complicated, I thought I'd ask regardless.&lt;/p&gt;&#xA;&lt;p&gt;Suppose I have some states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle = \sum_{j=1}^n a_{ij} |j\rangle : i,n\in\mathbb{Z}^+$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_i|\psi_i\rangle=1$&lt;/span&gt; holds true (i.e., are normalsied). I also have some conditional statements about the measured values these states are allowed to take to be a valid solution to my problem, using only XOR (&lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt;) and AND (&lt;span class=&quot;math-container&quot;&gt;$\land$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;For instance, I might have three states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|\psi_3\rangle$&lt;/span&gt;, which, when measured, in order to satisfy my problem must also satisfy &lt;span class=&quot;math-container&quot;&gt;$(\psi_1\oplus \psi_2)\land(\psi_2\oplus\psi_3)\land(\psi_1\oplus \psi_3)$&lt;/span&gt;. Of course, when I talk about satisfying a condition after measurement, I mean to a high probability.&lt;/p&gt;&#xA;&lt;p&gt;How does one, or can one, go about implementing this kind of logic in a quantum circuit? I feel that since each operation would entangle the states, that this is not possible.&lt;/p&gt;&#xA;&lt;p&gt;I've thought about and tested a Swap test, but this has a number of issues.&lt;/p&gt;&#xA;&lt;p&gt;Any help or thoughts would be greatly appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15019" LastActivityDate="2021-03-07T07:34:27.967" Title="Conditional Statements on a Quantum Computer" Tags="&lt;circuit-construction&gt;&lt;state-discrimination&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16387" PostTypeId="1" CreationDate="2021-03-07T06:45:48.873" Score="0" ViewCount="70" Body="&lt;p&gt;Is there a way to represent measurements in other bases in Qiskit? The default measurement is in the Z (computational) basis. Can I also depict measurement in X, Y and general Pauli Measurements?&lt;/p&gt;&#xA;&lt;p&gt;I know that I can apply a suitable unitary and then measure in the Z basis, but I am looking for a way to add the measurements to the circuit almost like &amp;quot;gates&amp;quot;. I will be putting many such measurements in sequence in my circuits.&#xA;I will be happy to use any external/in-development tool that allows this and interfaces well with Qiskit.&lt;/p&gt;&#xA;" OwnerUserId="13497" LastEditorUserId="55" LastEditDate="2021-03-08T11:14:59.627" LastActivityDate="2021-03-08T11:14:59.627" Title="How can I represent Pauli Measurements in Qiskit's QuantumCircuit object?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="16388" PostTypeId="2" ParentId="16386" CreationDate="2021-03-07T07:34:27.967" Score="1" Body="&lt;p&gt;&lt;em&gt;Disclaimer: Just few ideas, this is not full answer.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;XOR function is implemented by CNOT gate since:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle \rightarrow |00\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle \rightarrow |01\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle \rightarrow |11\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle \rightarrow |10\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Assuming the result is on second qubit, you can see it is the XOR of &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_2$&lt;/span&gt;, the first qubit of the result is identity of the first qubit.&lt;/p&gt;&#xA;&lt;p&gt;AND function is implemented by Toffoli gate (assuming &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is put on target qubit).&lt;/p&gt;&#xA;&lt;p&gt;You can use CNOT also as fan-out gate and &amp;quot;copy&amp;quot; your states to ancilla qubits and then implement with CNOTs and Toffolis. After that, measure your states and also result of the logical function indicating whether the condition is met (or what is a probability of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;). &lt;em&gt;Maybe, some simplified solution minimizing number of ancillas is possible but I have not time to think about it.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another possibility is to firstly measure your states and then check the condition classicaly. If it is fullfiled, you accept the result or discard it otherwise.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-07T07:34:27.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16389" PostTypeId="2" ParentId="15945" CreationDate="2021-03-07T07:38:49.153" Score="1" Body="&lt;p&gt;Another option would be using CLASS &lt;em&gt;Grover&lt;/em&gt; from &lt;code&gt;qiskit.aqua.algorithms&lt;/code&gt;.&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see in this &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.Grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, the parameter &lt;code&gt;oracle&lt;/code&gt; of &lt;code&gt;Grover&lt;/code&gt; can take one of the following forms, a &lt;code&gt;QuantumCircuit&lt;/code&gt;, an &lt;code&gt;Oracle&lt;/code&gt;, or a &lt;code&gt;Statevector&lt;/code&gt;. Now as you've already found out by yourself, &lt;code&gt;Statevector.from_label('..')&lt;/code&gt; accepts a single label. &lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;For multiple states, you can simply prepare a list representing your chosen states and pass it to &lt;code&gt;Statevector()&lt;/code&gt; in this way: &lt;br&gt;&lt;/p&gt;&#xA; &lt;br&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.aqua.algorithms import Grover&#xA;&#xA;&#xA;good_state = ['110','101']&#xA;oracle = Statevector([0,0,0,0,0,1,1,0])&#xA;grover = Grover(oracle=oracle, good_state=good_state)&#xA;my_gate=grover.grover_operator.to_gate() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="9318" LastEditDate="2021-03-28T20:17:38.410" LastActivityDate="2021-03-28T20:17:38.410" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16390" PostTypeId="2" ParentId="16361" CreationDate="2021-03-07T11:08:46.823" Score="6" Body="&lt;p&gt;No, this is impossible, because it violates the no-cloning theorem. You want to implement the function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |A_0\rangle|A_1\rangle|i\rangle|0\rangle \mapsto |A_0\rangle|A_1\rangle|i\rangle|A_i\rangle, $$&lt;/span&gt;&#xA;but if you could do that you could also clone, e.g. by fixing &lt;span class=&quot;math-container&quot;&gt;$i=0$&lt;/span&gt;, which would make the function be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |A_0\rangle|A_1\rangle|i\rangle|0\rangle \mapsto |A_0\rangle|A_1\rangle|0\rangle|A_0\rangle, $$&lt;/span&gt;&#xA;which is cloning the state &lt;span class=&quot;math-container&quot;&gt;$|A_0\rangle$&lt;/span&gt; and ignoring the state &lt;span class=&quot;math-container&quot;&gt;$|A_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-03-07T11:08:46.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16391" PostTypeId="1" AcceptedAnswerId="16392" CreationDate="2021-03-08T00:18:44.887" Score="2" ViewCount="59" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0303063.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/0303063.pdf&lt;/a&gt; it a method shown for implementing a multi-qubit controlled phase shift gate thath scales exponentially with n.&lt;/p&gt;&#xA;&lt;p&gt;Are there new methods to implement these gates in polynomial time?&lt;/p&gt;&#xA;&lt;p&gt;And does anybody know if there is a paper descring the method for impelemnting a multi-qubit controlled gate that Qiskit uses for its MCMT gate?&#xA;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.MCMT.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.library.MCMT.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="11646" LastActivityDate="2021-03-08T05:57:07.147" Title="Are multi-qubit control RX gates scaling exponentially?" Tags="&lt;quantum-gate&gt;&lt;resource-request&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16392" PostTypeId="2" ParentId="16391" CreationDate="2021-03-08T05:47:19.827" Score="4" Body="&lt;p&gt;An &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit controlled phase gate with error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; takes &lt;span class=&quot;math-container&quot;&gt;$O(n + \lg \frac{1}{\epsilon})$&lt;/span&gt; gates to achieve.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; dependence is easiest to understand in the case where you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; ancillae:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MBIMV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MBIMV.png&quot; alt=&quot;construction&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$O(\lg \frac{1}{\epsilon})$&lt;/span&gt; dependence is from the need to decompose the single qubit phase rotation into the gateset that is actually supported, e.g. using &lt;a href=&quot;https://arxiv.org/abs/1311.1074&quot; rel=&quot;nofollow noreferrer&quot;&gt;repeat-until-success circuits&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Only a &lt;a href=&quot;https://algassert.com/circuits/2015/06/05/Constructing-Large-Controlled-Nots.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;single ancilla is actually required&lt;/a&gt;. And if you're willing to increase the cost to &lt;span class=&quot;math-container&quot;&gt;$O(n \cdot \lg \frac{1}{\epsilon})$&lt;/span&gt; and use &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; arbitrary single qubit phase rotations instead of one &lt;a href=&quot;https://algassert.com/circuits/2015/06/22/Using-Quantum-Gates-instead-of-Ancilla-Bits.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;then no ancillae are needed at all&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-08T05:57:07.147" LastActivityDate="2021-03-08T05:57:07.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16393" PostTypeId="1" AcceptedAnswerId="16397" CreationDate="2021-03-08T09:50:00.460" Score="1" ViewCount="45" Body="&lt;p&gt;I'm curious how to show how this matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c = \lambda |\phi^+\rangle \langle\phi^+| + (1-\lambda )|\phi^-\rangle \langle\phi^-|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is  the Choi–Jamiołkowski matrix of a quantum channel for any &lt;span class=&quot;math-container&quot;&gt;$\lambda \in [0,1]$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13030" LastEditorUserId="55" LastEditDate="2021-03-08T19:18:13.743" LastActivityDate="2021-03-08T19:18:13.743" Title="Show that $\lambda |\phi^+\rangle \langle\phi^+| + (1-\lambda )|\phi^-\rangle \langle\phi^-|$ is the Choi–Jamiołkowski matrix of a quantum channel" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16394" PostTypeId="1" CreationDate="2021-03-08T10:33:42.427" Score="5" ViewCount="135" Body="&lt;p&gt;Assuming that we have a matrix &lt;span class=&quot;math-container&quot;&gt;$A\in \mathbb{R}^{m\times n}$&lt;/span&gt; stored in a quantum superposition, i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|A\rangle= \frac{1}{\|A\|_F}\sum_{i,j=0}^{n-1}{a_{ij}}|i,j\rangle$$&lt;/span&gt;&#xA;and a vector &lt;span class=&quot;math-container&quot;&gt;$b\in \mathbb{R}^{n\times 1}$&lt;/span&gt; stored in&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|b\rangle= \frac{1}{\|b\|}\sum_{i=0}^{n-1}{b_{i}}|i\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I find a unitary, such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U|b\rangle\approx|Ab\rangle?$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14817" LastEditorUserId="10480" LastEditDate="2021-03-10T23:13:09.933" LastActivityDate="2021-03-11T07:23:01.873" Title="What's the state-of-the-art to calculate $|Ab\rangle$, given a matrix $|A\rangle$ and a vector $|b\rangle$ in QRAM encoding" Tags="&lt;simulation&gt;&lt;hamiltonian-simulation&gt;&lt;unitarity&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16395" PostTypeId="1" AcceptedAnswerId="16403" CreationDate="2021-03-08T10:56:02.083" Score="5" ViewCount="48" Body="&lt;p&gt;For any linear operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, the support of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the orthogonal complement of its kernel. Hence when we say, &lt;span class=&quot;math-container&quot;&gt;$supp(A)\subset supp(B)$&lt;/span&gt;, we have that for any vector &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; in the kernel of &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; i.e. &lt;span class=&quot;math-container&quot;&gt;$Bv = 0$&lt;/span&gt;, it also must be that &lt;span class=&quot;math-container&quot;&gt;$Av = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is if it is true (and if yes, how to show) that support containments for quantum states are preserved under partial trace. That is, if&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{supp}(\rho_{AB})\subset \text{supp}(\sigma_{AB})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is it true that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{supp}(\rho_{A})\subset \text{supp}(\sigma_{A})$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15127" LastActivityDate="2021-03-08T17:15:45.960" Title="If $\text{supp}(\rho_{AB})\subset \text{supp}(\sigma_{AB})$, is $\text{supp}(\rho_{A})\subset \text{supp}(\sigma_{A})$?" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16397" PostTypeId="2" ParentId="16393" CreationDate="2021-03-08T11:33:33.273" Score="2" Body="&lt;p&gt;I'll use notation inspired from &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Watrous' book&lt;/a&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathrm{Lin}(\mathcal X)\to\mathrm{Lin}(\mathcal Y)$&lt;/span&gt; be a quantum channel (&lt;em&gt;i.e.&lt;/em&gt; a CPTP map).&#xA;Define its &lt;em&gt;Choi representation&lt;/em&gt; as the operator &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\in\mathrm{Lin}(\mathcal Y\otimes\mathcal X)$&lt;/span&gt; defined by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi) = \sum_{ij} \Phi(E_{ij})\otimes E_{ij},\qquad E_{ij}\equiv |i\rangle\!\langle j|.$$&lt;/span&gt;&#xA;Then you can verify that &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\ge0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_{\mathcal Y}(J(\Phi))=I_{\mathcal X}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Vice versa&lt;/em&gt;, let &lt;span class=&quot;math-container&quot;&gt;$A\in\mathrm{Lin}(\mathcal Y\otimes\mathcal X)$&lt;/span&gt; be a positive semidefinite linear operator such that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}_{\mathcal Y}(A)=I_{\mathcal X}$&lt;/span&gt;, and define the linear map &lt;span class=&quot;math-container&quot;&gt;$\Phi_A\in\mathrm{Lin}(\mathrm{Lin}(\mathcal X),\mathrm{Lin}(\mathcal Y))$&lt;/span&gt; via&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi_A(E_{j\ell}) \equiv \sum_{ik} \langle i,j|A|k,\ell\rangle E_{ik},&#xA;\qquad \Phi_A(X) = \operatorname{Tr}_{\mathcal X}[A(I\otimes X^T)].$$&lt;/span&gt;&#xA;You can then verify that &lt;span class=&quot;math-container&quot;&gt;$\Phi_A$&lt;/span&gt; is CPTP.&#xA;Moreover, the two operations are one the inverse of the other: &lt;span class=&quot;math-container&quot;&gt;$\Phi_{J(\Phi)}=\Phi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In conclusion, a linear operator &lt;span class=&quot;math-container&quot;&gt;$A\in\mathrm{Lin}(\mathcal Y\otimes\mathcal X)$&lt;/span&gt; is the Choi of a CPTP map &lt;em&gt;iff&lt;/em&gt; it is positive semidefinite and satisfies the trace property.&lt;/p&gt;&#xA;&lt;p&gt;In this case, verifying the positivity is immediate. Moreover, assuming &lt;span class=&quot;math-container&quot;&gt;$|\phi^\pm\rangle$&lt;/span&gt; here denote maximally entangled states, the partial trace gives the identity for both terms, and thus the other condition is also trivially verified for all &lt;span class=&quot;math-container&quot;&gt;$\lambda\in[0,1]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;I should note that in the definition I'm using here of &amp;quot;Choi representation&amp;quot; isn't a &lt;em&gt;state&lt;/em&gt;, in that it's not normalised: &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}(J(\Phi))=\operatorname{dim}(\mathcal X)$&lt;/span&gt;. This is however trivially fixed by adding the appropriate normalisation factor in the definition.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-03-08T11:44:21.003" LastActivityDate="2021-03-08T11:44:21.003" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16398" PostTypeId="1" CreationDate="2021-03-08T12:27:30.397" Score="2" ViewCount="106" Body="&lt;p&gt;This matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c_{\lambda} = \lambda |\phi^+\rangle \langle\phi^+| + (1-\lambda )|\phi^-\rangle \langle\phi^-|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is  the Choi–Jamiołkowski matrix of a quantum channel for any &lt;span class=&quot;math-container&quot;&gt;$\lambda \in [0,1]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The questions I am trying to solve are:&lt;/p&gt;&#xA;&lt;p&gt;Provide a Kraus (operator-sum) representation of the quantum channel &lt;span class=&quot;math-container&quot;&gt;$T_{\lambda}$&lt;/span&gt; that is described by &lt;span class=&quot;math-container&quot;&gt;$c_{\lambda}$&lt;/span&gt; and show that &lt;span class=&quot;math-container&quot;&gt;$T_{1/2}$&lt;/span&gt; is an entanglement breaking quantum channel and describe its action on the bloch sphere.&lt;/p&gt;&#xA;" OwnerUserId="13030" LastEditorUserId="13030" LastEditDate="2021-03-08T19:34:51.800" LastActivityDate="2021-03-10T08:48:12.630" Title="What is the Kraus representation of the quantum channel with Choi $\lambda |\phi^+\rangle \langle\phi^+| + (1-\lambda )|\phi^-\rangle \langle\phi^-|$?" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16399" PostTypeId="1" AcceptedAnswerId="16400" CreationDate="2021-03-08T12:30:09.080" Score="3" ViewCount="107" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Peres%E2%80%93Horodecki_criterion&quot; rel=&quot;nofollow noreferrer&quot;&gt;partial transpose&lt;/a&gt; of an operator &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with respect to subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M^{T_A} := \left(\sum_{abcd} M^{ab}_{cd}  \underbrace{|a\rangle \langle b| }_{A}\otimes \underbrace{|c \rangle \langle d|}_B\right)= \left(\sum_{abcd} M^{ab}_{cd}  |b\rangle \langle a| \otimes |c \rangle \langle d|\right).&#xA;$$&lt;/span&gt;&#xA;&lt;strong&gt;Is there an identity for the partial transpose of the product of operators&lt;/strong&gt;,i.e.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(AB)^{T_A}= \quad ?&#xA;$$&lt;/span&gt;&#xA;I suspect that in general &lt;span class=&quot;math-container&quot;&gt;$(AB)^{T_A} \neq B^{T_A} A^{T_A} $&lt;/span&gt; or even &lt;span class=&quot;math-container&quot;&gt;$\neq A^{T_A}B^{T_A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What if &lt;span class=&quot;math-container&quot;&gt;$A=B$&lt;/span&gt;?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="14122" LastEditorUserId="10480" LastEditDate="2021-03-08T19:25:57.830" LastActivityDate="2021-03-08T19:25:57.830" Title="Is there an identity for the partial transpose of a product of operators?" Tags="&lt;entanglement&gt;&lt;information-theory&gt;&lt;linear-algebra&gt;&lt;entanglement-negativity&gt;&lt;partial-transpose&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16400" PostTypeId="2" ParentId="16399" CreationDate="2021-03-08T16:14:24.607" Score="5" Body="&lt;p&gt;Your suspicion is correct, even when &lt;span class=&quot;math-container&quot;&gt;$A=B$&lt;/span&gt;. Consider the Hilbert space of two qubits and let &lt;span class=&quot;math-container&quot;&gt;$^{T_A}$&lt;/span&gt; denote the partial transpose with respect to one of them.&#xA;Suppose that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=B=\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A^{T_A}=B^{T_A}=\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we see that &lt;span class=&quot;math-container&quot;&gt;$(AB)^{T_A} = I^{T_A} = I$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$A^{T_A}B^{T_A} = B^{T_A}A^{T_A} = 2 A^{T_A}$&lt;/span&gt; is a rank one matrix.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I am not aware of a simple identity connecting &lt;span class=&quot;math-container&quot;&gt;$(AB)^{T_A}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A^{T_A}B^{T_A}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$B^{T_A}A^{T_A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A useful computational aid is offered by tensor notation and in some cases &lt;a href=&quot;https://arxiv.org/abs/1708.00006&quot; rel=&quot;nofollow noreferrer&quot;&gt;tensor networks&lt;/a&gt;. Note that operators such as &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; that act on the Hilbert space of a bipartite system can be thought of as tensors with four indices &lt;span class=&quot;math-container&quot;&gt;$A_{ijkl}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_{ijkl}$&lt;/span&gt;. Their usual matrix representation is obtained by grouping pairs of indices for example &lt;span class=&quot;math-container&quot;&gt;$A_{(ij)(kl)}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B_{(ij)(kl)}$&lt;/span&gt; so that &lt;span class=&quot;math-container&quot;&gt;$(ij)$&lt;/span&gt; indexes the rows and &lt;span class=&quot;math-container&quot;&gt;$(kl)$&lt;/span&gt; indexes the columns. In this view partial transpose swaps the first indices from each pair &lt;span class=&quot;math-container&quot;&gt;$A_{(ij)(kl)}^{T_A} = A_{(kj)(il)}$&lt;/span&gt;. Thus&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(AB)_{(ij)(mn)} = \sum_{kl} A_{(ij)(kl)}B_{(kl)(mn)}\\&#xA;(AB)_{(ij)(mn)}^{T_A} = \left(\sum_{kl} A_{(ij)(kl)}B_{(kl)(mn)}\right)^{T_A} = \sum_{kl} A_{(mj)(kl)}B_{(kl)(in)}\\&#xA;(A^{T_A}B^{T_A})_{(ij)(mn)} = \sum_{kl} A^{T_A}_{(ij)(kl)}B^{T_A}_{(kl)(mn)} = \sum_{kl} A_{(kj)(il)}B_{(ml)(kn)}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which shows that changing the order of matrix multiplication and partial transpose affects which elements are multiplied together.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-08T17:55:46.593" LastActivityDate="2021-03-08T17:55:46.593" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16401" PostTypeId="1" CreationDate="2021-03-08T16:24:24.067" Score="7" ViewCount="1015" Body="&lt;p&gt;If we are working with qudits instead of qubits, how do the NOT and CNOT gates work? If the control state for a qubit system is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, what is it for a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-ary qudit system, and why?&lt;/p&gt;&#xA;&lt;p&gt;For instance, in a qutrit system with three basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle,|2\rangle$&lt;/span&gt;: if one had a CNOT gate, which state would trigger the NOT gate?&lt;/p&gt;&#xA;" OwnerUserId="15019" LastEditorUserId="10480" LastEditDate="2021-03-12T19:32:39.380" LastActivityDate="2021-03-12T19:32:39.380" Title="How does the NOT gate generalize beyond binary?" Tags="&lt;quantum-gate&gt;&lt;qudit&gt;" AnswerCount="4" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16402" PostTypeId="1" CreationDate="2021-03-08T17:14:55.600" Score="1" ViewCount="75" Body="&lt;p&gt;If I have a normalized &lt;span class=&quot;math-container&quot;&gt;$(\alpha,\beta)$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$(0.24506+0.9633i,0.0046238+0.10943i)$&lt;/span&gt; for a qubit &lt;span class=&quot;math-container&quot;&gt;$\left| \psi \right&amp;gt; = (\alpha_1 + i\alpha_2 ) \left|0\right&amp;gt; + (\beta_1 + i\beta_2 )\left|1\right&amp;gt;$&lt;/span&gt;, how can I generate angles for a unitary gate by using above data and can I run this on qiskit?&lt;/p&gt;&#xA;" OwnerUserId="15131" LastEditorUserId="2293" LastEditDate="2021-03-08T20:24:48.710" LastActivityDate="2021-04-07T22:02:20.217" Title="How to create a unitary gate using normalized complex numbers in qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16403" PostTypeId="2" ParentId="16395" CreationDate="2021-03-08T17:15:45.960" Score="4" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}, \sigma_{AB} \ge 0$&lt;/span&gt;, i.e. they are positive semi-definite then yes (otherwise no).&lt;/p&gt;&#xA;&lt;p&gt;To prove it observe that if &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\rho_{AB})\subset \text{supp}(\sigma_{AB})$&lt;/span&gt; then we can write that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_{AB} = \epsilon \cdot \rho_{AB} + \Delta,&#xA;$$&lt;/span&gt;&#xA;for some sufficiently small &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;gt; 0$&lt;/span&gt; and some operator &lt;span class=&quot;math-container&quot;&gt;$\Delta \ge 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Partial trace is linear, so we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_A = \epsilon \cdot \rho_{A} + \text{Tr}_B(\Delta).&#xA;$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_B(\Delta) \ge 0$&lt;/span&gt; we can deduce that &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\rho_{A})\subset \text{supp}(\sigma_{A})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-03-08T17:15:45.960" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16404" PostTypeId="2" ParentId="16398" CreationDate="2021-03-08T18:51:28.070" Score="2" Body="&lt;p&gt;Assuming &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle = |00\rangle+|11\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi^-\rangle = |00\rangle-|11\rangle$&lt;/span&gt; we compute&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;c = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 2\lambda-1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;2\lambda-1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}\tag1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A useful property of the &lt;span class=&quot;math-container&quot;&gt;$d^2\times d^2$&lt;/span&gt; Choi-Jamiołkowski matrix is that each of the &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; blocks represents the action of the channel on the matrices from the standard basis of the space of &lt;span class=&quot;math-container&quot;&gt;$d\times d$&lt;/span&gt; matrices. In our case &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;c = \begin{pmatrix}&#xA;T\begin{pmatrix}1&amp;amp;0\\0&amp;amp;0\end{pmatrix} &amp;amp; T\begin{pmatrix}0&amp;amp;1\\0&amp;amp;0\end{pmatrix}\\&#xA;T\begin{pmatrix}0&amp;amp;0\\1&amp;amp;0\end{pmatrix} &amp;amp; T\begin{pmatrix}0&amp;amp;0\\0&amp;amp;1\end{pmatrix}&#xA;\end{pmatrix}.\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, recall that the action of the phase damping channel&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{F}(\rho) = p\rho + (1-p)Z\rho Z\tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;on a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho = \begin{pmatrix}\rho_{00}&amp;amp;\rho_{01}\\\rho_{10}&amp;amp;\rho_{11}\end{pmatrix}$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{F}(\rho) = \begin{pmatrix}&#xA;\rho_{00} &amp;amp; (2p-1)\rho_{01} \\&#xA;(2p-1)\rho_{10} &amp;amp; \rho_{11}&#xA;\end{pmatrix}.\tag4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Substituting &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}1&amp;amp;0\\0&amp;amp;0\end{pmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0&amp;amp;1\\0&amp;amp;0\end{pmatrix}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0&amp;amp;0\\1&amp;amp;0\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}0&amp;amp;0\\0&amp;amp;1\end{pmatrix}$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$(4)$&lt;/span&gt; and comparing against &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;, we see that &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is the Choi-Jamiołkowski matrix of the phase damping channel with &lt;span class=&quot;math-container&quot;&gt;$p=\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; is the Kraus representation of the channel with Choi-Jamiołkowski matrix &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;. The channel shrinks the equator of the Bloch sphere, see e.g. figure 8.9 on page 377 in Nielsen &amp;amp; Chuang. Finally, when &lt;span class=&quot;math-container&quot;&gt;$\lambda=\frac{1}{2}$&lt;/span&gt; then the output of the channel is separable regardless of the input.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-08T19:58:15.277" LastActivityDate="2021-03-08T19:58:15.277" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="16405" PostTypeId="2" ParentId="16401" CreationDate="2021-03-08T20:11:06.990" Score="8" Body="&lt;p&gt;There is no universally accepted CNOT (or even NOT) gate for qutrits or qudits with d&amp;gt;2, and the NOT operator conventionally turns 0 to 1 and 1 to 0 when the input is 1 binary bit or qubit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Three-valued_logic&quot; rel=&quot;noreferrer&quot;&gt;Three-value logic&lt;/a&gt; is indeed a fairly well-studied topic, but there's many different conventions such as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/De_Morgan_algebra#Kleene_algebra&quot; rel=&quot;noreferrer&quot;&gt;Kleene algebra&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Graham_Priest&quot; rel=&quot;noreferrer&quot;&gt;Priest logic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/%C5%81ukasiewicz_logic&quot; rel=&quot;noreferrer&quot;&gt;Łukasiewicz logic&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Cohn Algebra&lt;/li&gt;&#xA;&lt;li&gt;Pradhan Algebra&lt;/li&gt;&#xA;&lt;li&gt;Dubrova Algebra&lt;/li&gt;&#xA;&lt;li&gt;Muzio Algebra&lt;/li&gt;&#xA;&lt;li&gt;Bochvar Logic&lt;/li&gt;&#xA;&lt;li&gt;Post logic&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In Kleene logic, we have the following NOT gate (in qubit notation, even though Kleene logic was developed for classical computing):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|T\rangle \rightarrow |F\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|U\rangle \rightarrow |U\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|F\rangle \rightarrow |T\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;So if the control qubit for a CNOT gate in Kleene logic is &lt;span class=&quot;math-container&quot;&gt;$|T\rangle$&lt;/span&gt; then the target qubit will undergo the above transformation gate. Here, T = true, F = false, U = unknown, and you can replace these letters by 0,1,2 or -1,0,1 instead if you wish.&lt;/p&gt;&#xA;&lt;p&gt;For qudits with d&amp;gt;3, as long as d is still &lt;em&gt;&lt;strong&gt;finite&lt;/strong&gt;&lt;/em&gt; there's even more options under the umbrella called &amp;quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Many-valued_logic#Bochvar%27s_internal_three-valued_logic_(also_known_as_Kleene%27s_weak_three-valued_logic)&quot; rel=&quot;noreferrer&quot;&gt;multi-valued logic&lt;/a&gt;&amp;quot;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Belnap logic (for d=4)&lt;/li&gt;&#xA;&lt;li&gt;Gödel logics&lt;/li&gt;&#xA;&lt;li&gt;Product logic&lt;/li&gt;&#xA;&lt;li&gt;Rose logics&lt;/li&gt;&#xA;&lt;li&gt;Post logics (again)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For infinite-valued logic (d = infinity), for example if the qudits were representing a &amp;quot;continuous variable&amp;quot; like the position &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; (where d is uncountably infinite), or if the qudits were representing a quantum harmonic oscillator where each energy level encodes some information (here d is countably infinite because while d is infinite it's still discrete), there's &lt;a href=&quot;https://en.wikipedia.org/wiki/Fuzzy_logic&quot; rel=&quot;noreferrer&quot;&gt;fuzzy logic&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Probabilistic_logic&quot; rel=&quot;noreferrer&quot;&gt;probabilistic logic&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-08T20:11:06.990" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16407" PostTypeId="2" ParentId="16402" CreationDate="2021-03-08T20:58:47.330" Score="0" Body="&lt;p&gt;Here is my attempt.&lt;/p&gt;&#xA;&lt;p&gt;First, let's create the statevector:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info.states import Statevector&#xA;alpha = complex(0.24506488, 0.9633)&#xA;beta = complex(0.0046248, 0.10943)&#xA;sv = Statevector([alpha,beta])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA;0.24506 + 0.9633i &amp;amp; 0.00462 + 0.10943i  \\&#xA; \end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, we can initialize a circuit in that state and transpile it to a rotation-only basis:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, transpile&#xA;&#xA;qc = QuantumCircuit(1)&#xA;qc.initialize(sv, [0])&#xA;transpile(qc, basis_gates=['rx', 'ry', 'rz']).draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JCzGY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JCzGY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-08T20:58:47.330" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16408" PostTypeId="1" AcceptedAnswerId="16411" CreationDate="2021-03-08T21:00:09.563" Score="2" ViewCount="75" Body="&lt;p&gt;From page 24 of the thesis &amp;quot;&lt;em&gt;Random Quantum States and Operators&lt;/em&gt;&amp;quot;, where &lt;span class=&quot;math-container&quot;&gt;$(A,B)$&lt;/span&gt; is the Hilbert-Schmidt inner product:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned}&#xA;\rho &amp;amp;=\left(\frac{1}{\sqrt{2}} I, \rho\right) \frac{1}{\sqrt{2}} I+\left(\frac{1}{\sqrt{2}} X, \rho\right) \frac{1}{\sqrt{2}} X+\left(\frac{1}{\sqrt{2}} Y, \rho\right) \frac{1}{\sqrt{2}} Y+\left(\frac{1}{\sqrt{2}} Z, \rho\right) \frac{1}{\sqrt{2}} Z \\&#xA;&amp;amp;=\frac{(I, \rho) I+(X, \rho) X+(Y, \rho) Y+(Z, \rho) Z}{2} \\&#xA;&amp;amp;=\frac{I+\operatorname{tr}(X \rho) X+\operatorname{tr}(Y \rho) Y+\operatorname{tr}(Z \rho) Z}{2}&#xA;\end{aligned}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is used for explaining quantum tomography. Can someone please explain each step clearly? I have pretty basic QC and linear algebra knowledge.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="2293" LastEditDate="2021-03-08T23:46:27.577" LastActivityDate="2021-03-09T16:53:03.800" Title="Why can any density operator be written this way? (quantum tomography)" Tags="&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;&lt;bloch-sphere&gt;&lt;linear-algebra&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16409" PostTypeId="1" AcceptedAnswerId="16410" CreationDate="2021-03-08T21:11:20.590" Score="1" ViewCount="61" Body="&lt;p&gt;Given:&#xA;Ry(theta) acting on one qubit&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to use existing Cirq Operators to build the conjugate transpose of the above gate. I need the operator to produce the exact unitary of the given gate for the given theta.&lt;/p&gt;&#xA;&lt;p&gt;I'v already used cirq.optimizers.single_qubit_matrix_to_gates. It gives YPowGates but the global phase changes with theta. I need either the exact unitary of the gate or another conversion that its global phase does not change with theta.&lt;/p&gt;&#xA;" OwnerUserId="12489" LastEditorUserId="55" LastEditDate="2021-03-09T09:49:41.620" LastActivityDate="2021-03-09T09:49:41.620" Title="Is there a way to present conjugate transpose of a Y Pauli rotation as a Cirq Operator?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16410" PostTypeId="2" ParentId="16409" CreationDate="2021-03-08T21:22:04.680" Score="4" Body="&lt;p&gt;&lt;code&gt;cirq.inverse(operation)&lt;/code&gt; will return the conjugate transpose of an operation.&lt;/p&gt;&#xA;&lt;p&gt;Equivalently, you can use &lt;code&gt;operation**-1&lt;/code&gt; (this is the first thing that &lt;code&gt;cirq.inverse&lt;/code&gt; tries).&lt;/p&gt;&#xA;&lt;p&gt;For the specific case of &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;, you can just negate the angle i.e. use &lt;code&gt;cirq.ry(-theta)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-08T21:48:02.783" LastActivityDate="2021-03-08T21:48:02.783" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16411" PostTypeId="2" ParentId="16408" CreationDate="2021-03-08T22:49:28.950" Score="5" Body="&lt;p&gt;From linear algebra, if &lt;span class=&quot;math-container&quot;&gt;$v_1, \dots, v_n$&lt;/span&gt; is a basis of the vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; then every vector &lt;span class=&quot;math-container&quot;&gt;$v\in V$&lt;/span&gt; can be written as a linear combination&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;v = a_1 v_1 + \dots + a_n v_n\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the coefficients &lt;span class=&quot;math-container&quot;&gt;$a_k$&lt;/span&gt; belong to the underlying scalar field. Moreover, if &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is an inner product space and &lt;span class=&quot;math-container&quot;&gt;$v_1, \dots, v_n$&lt;/span&gt; is an orthonormal basis then the coefficients &lt;span class=&quot;math-container&quot;&gt;$a_1, \dots, a_n$&lt;/span&gt; can be computed using the inner product as &lt;span class=&quot;math-container&quot;&gt;$a_k = \langle v, v_k\rangle$&lt;/span&gt;. This is easy to prove by acting with &lt;span class=&quot;math-container&quot;&gt;$\langle\,.,v_k\rangle$&lt;/span&gt; on both sides of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, it turns out that the set of Hermitian matrices with complex entries is a real vector space with inner product defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle A, B \rangle = \mathrm{tr} (A^\dagger B).\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, it is easy to check that &lt;span class=&quot;math-container&quot;&gt;$I, X, Y, Z$&lt;/span&gt; are orthogonal with respect to the inner product &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; and since the space of &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; Hermitian matrices is four-dimensional the matrices form a basis. By normalizing we can turn it into an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$I/\sqrt{2}, X/\sqrt{2}, Y/\sqrt{2}, Z/\sqrt{2}$&lt;/span&gt;. Then, every &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = a_I \frac{I}{\sqrt{2}} + a_X \frac{X}{\sqrt{2}} + a_Y \frac{Y}{\sqrt{2}} + a_Z \frac{Z}{\sqrt{2}}\tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a_I = \frac{1}{\sqrt{2}}\mathrm{tr}(\rho) \\&#xA;a_X = \frac{1}{\sqrt{2}}\mathrm{tr}(\rho X) \\&#xA;a_Y = \frac{1}{\sqrt{2}}\mathrm{tr}(\rho Y) \\&#xA;a_Z = \frac{1}{\sqrt{2}}\mathrm{tr}(\rho Z).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Assuming &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a state, then &lt;span class=&quot;math-container&quot;&gt;$a_I = \frac{1}{\sqrt{2}}$&lt;/span&gt; because the trace of the density matrix representing the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, denoted as &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho)$&lt;/span&gt;, always equals 1. Finally, substituting into &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{I + \mathrm{tr}(\rho X)X + \mathrm{tr}(\rho Y)Y + \mathrm{tr}(\rho Z)Z}{2}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="14239" LastEditDate="2021-03-09T16:53:03.800" LastActivityDate="2021-03-09T16:53:03.800" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16412" PostTypeId="2" ParentId="16401" CreationDate="2021-03-09T00:47:11.547" Score="6" Body="&lt;p&gt;As the previous answer mentions, how a controlled qudit gate is defined is up to a choice of convention. &lt;a href=&quot;https://link.springer.com/content/pdf/10.1007/s11433-014-5551-9.pdf&quot; rel=&quot;noreferrer&quot;&gt;This paper&lt;/a&gt; contains a few examples of intuitively appealing definitions for controlled qudit operations. The first example for &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional qudits is a block diagonal matrix where &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is applied to qudit 2 only if the state of qudit 1 is &lt;span class=&quot;math-container&quot;&gt;$|d-1\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;\text{Controlled-}U = \begin{pmatrix}&#xA;\mathbb{I}_{d^2 - d} &amp;amp; 0 \\&#xA;0 &amp;amp; U_d&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we consider qutrits (&lt;span class=&quot;math-container&quot;&gt;$d=3$&lt;/span&gt;) this looks like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;\begin{matrix} \tag{2}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;\end{matrix} &amp;amp; \begin{matrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{matrix} \\&#xA;\begin{matrix}&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;\end{matrix} &amp;amp; &#xA;\begin{pmatrix}&#xA;~ &amp;amp; ~ &amp;amp; ~ \\&#xA;~ &amp;amp; U &amp;amp; ~ \\&#xA;~ &amp;amp; ~ &amp;amp; ~&#xA;\end{pmatrix}&#xA;\end{pmatrix}&#xA;\begin{matrix}&#xA;\quad |00\rangle \\&#xA;\quad |01\rangle \\&#xA;\quad |02\rangle \\&#xA;\quad |10\rangle \\&#xA;\quad |11\rangle \\&#xA;\quad |12\rangle \\&#xA;\quad |20\rangle \\&#xA;\quad |21\rangle \\&#xA;\quad |22\rangle \\&#xA;\end{matrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From the basis state annotations you can see that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gets implemented on the second qutrit only if the first qutrit is in the state &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt;. If we return to arbitrary &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; and think of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as being generated by some &lt;span class=&quot;math-container&quot;&gt;$d \times d$&lt;/span&gt; hermitian &lt;span class=&quot;math-container&quot;&gt;$\theta H$&lt;/span&gt; then this matrix is equivalent to the operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;\exp\left( i\theta |d-1 \rangle\langle d-1 | \otimes H \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which reduces to the expression for &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}$&lt;/span&gt; on qubits (up to a local &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt;) for &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\theta H = \frac{\pi}{2} X$&lt;/span&gt;. You could also use another block diagonal definition like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{4}&#xA;\text{Controlled-}\{U\} = \begin{pmatrix}&#xA;U_0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; 0\\&#xA;0 &amp;amp; U_1 &amp;amp; \cdots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; \ddots &amp;amp; \vdots\\&#xA;0 &amp;amp; 0 &amp;amp; \cdots &amp;amp; U_{d-1}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which will apply &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; conditioned on the control qudit being in state &lt;span class=&quot;math-container&quot;&gt;$|k \rangle$&lt;/span&gt;  by the same reasoning above.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="2293" LastEditDate="2021-03-09T02:02:02.547" LastActivityDate="2021-03-09T02:02:02.547" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16413" PostTypeId="1" CreationDate="2021-03-09T04:34:46.620" Score="4" ViewCount="43" Body="&lt;p&gt;Weak Value Amplification is a procedure in which one consider a bipartite Hamiltonian of the form &lt;span class=&quot;math-container&quot;&gt;$H = g A \otimes B$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is called system, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is called meter and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is the extremely small parameter we are interested to measure by amplification.  The procedure goes as follows:&lt;/p&gt;&#xA;&lt;p&gt;(1) The system and meter is initialized by some initial state &lt;span class=&quot;math-container&quot;&gt;$\vert\Psi\rangle=\vert\psi_{i}\rangle \otimes \vert \phi\rangle$&lt;/span&gt;.  The evolution of the system &lt;span class=&quot;math-container&quot;&gt;$U = \exp(-igA \otimes B)$&lt;/span&gt; is approximated to &lt;span class=&quot;math-container&quot;&gt;$1_{A}\otimes 1_{B}-ig A\otimes B$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is extremely small. we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U\vert\Psi_{i}\rangle\approx(1_{A}\otimes 1_{B}-ig A\otimes B)\vert\psi_{i}\rangle \otimes \vert \phi\rangle,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(1_{A}\vert\psi_{i}\rangle\otimes 1_{B}\vert \phi\rangle-ig A\vert\psi_{i}\rangle\otimes B\vert\phi\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(2) After the evolution, the system is post selected onto some final state &lt;span class=&quot;math-container&quot;&gt;$\vert\psi_{f}\rangle$&lt;/span&gt; (which is nearly orthogonal to the initial state)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle\psi_{f}\vert U\vert\Psi_{i}\rangle\approx P_{s}(1_{B}\vert\phi\rangle - ig A_{w}B\vert\phi\rangle)$$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$P_s = \langle\psi_{f}\vert\psi_{i}\rangle$&lt;/span&gt; is the post-selection probability and &lt;span class=&quot;math-container&quot;&gt;$A_{w} = \langle\psi_{f}\vert A\vert\psi_{i}\rangle/P_{s}$&lt;/span&gt; is called the weak value.&lt;/p&gt;&#xA;&lt;p&gt;(3)  If i re-exponentiate the above term, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\langle\psi_{f}\vert U\vert\Psi_{i}\rangle}{P_{s}}=\exp(-igA_{w}B)\vert\phi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the exponential on the RHS is the Kraus operator acting on the meter intial state, using which one can estimate the small parameter &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My attempt at solving:&lt;/p&gt;&#xA;&lt;p&gt;(step 1) I prepare the initial state say &lt;code&gt;psi1&lt;/code&gt; and evolved the state according the Hamiltonian using &lt;code&gt;mesolve&lt;/code&gt; for a short time &lt;code&gt;t = np.linspace(0, 0.01, 50)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;result = mesolve(H, psi1, t, c_ops = [], e_ops =[])&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;(step 2) The evolved state is &lt;code&gt;result.states[49]&lt;/code&gt;, but the problem I am facing is how do I make post-measurement on this with the final state?&lt;/p&gt;&#xA;&lt;p&gt;One such dumb attempt, I did was taking the final state &lt;code&gt;psif&lt;/code&gt; and sandwiched directly with &lt;code&gt;result.states[49]&lt;/code&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt; eta = psif.dag()*result.states[49]&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;But my objective was to do the post-selection at a specific time, like say I weakly evolve the system for a short time say 0 to 0.1 seconds and do post-selection exactly at 0.05th second.  I am really lost what to do from my (step 1).  Is there a way to do post-selection in QuTiP at a specific time?&lt;/p&gt;&#xA;" OwnerUserId="8317" LastEditorUserId="55" LastEditDate="2021-03-09T09:49:20.093" LastActivityDate="2021-05-27T19:35:58.867" Title="Trying to simulate Weak Value Amplification using QuTiP" Tags="&lt;programming&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16414" PostTypeId="1" CreationDate="2021-03-09T08:56:01.617" Score="2" ViewCount="16" Body="&lt;p&gt;The trick of quantum computing is to take the advantage of wave mechanics (superposition) and entanglement. This allows to perform parallel computations/manipulations with &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; superposed waves for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits.&lt;/p&gt;&#xA;&lt;p&gt;This principle does not rely on quantum mechanics. Superposed waves do also exist in classical mechanics (although I am not sure we can make the number of tones also scale exponentially with the size, but there could be some profit).&lt;/p&gt;&#xA;&lt;p&gt;Are there examples of efforts to create classic analogues of quantum computers that use superposed waves and manipulate those, instead of using bits in silicon chips?&lt;/p&gt;&#xA;&lt;p&gt;(I do not mean efforts to create a virtual quantum computer)&lt;/p&gt;&#xA;&lt;p&gt;&lt;sup&gt;This question might be generalized. Are/were there any efforts to try to move away from binary computers?&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="15138" LastEditorUserId="55" LastEditDate="2021-03-09T09:47:26.700" LastActivityDate="2021-03-09T09:47:26.700" Title="Are classical analogues of quantum computers using superposed waves possible?" Tags="&lt;physical-realization&gt;&lt;classical-computing&gt;&lt;architecture&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-03-09T17:33:16.017" ContentLicense="CC BY-SA 4.0" />
  <row Id="16415" PostTypeId="2" ParentId="16398" CreationDate="2021-03-09T09:15:20.347" Score="3" Body="&lt;p&gt;There's even a more direct way than the one described by Adam. Note that every pure Choi state corresponds to a superoperator acting by conjugation. Since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbb{I} \otimes \mathbb{I} |\phi^+\rangle = |\phi^+\rangle, \qquad Z \otimes \mathbb{I} |\phi^+\rangle = |\phi^-\rangle,&#xA;$$&lt;/span&gt;&#xA;the inverse of &lt;span class=&quot;math-container&quot;&gt;$c_\lambda$&lt;/span&gt; under the Choi-Jamiołkowski isomorphism is simply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;T_\lambda = \lambda\, \mathrm{id} + (1-\lambda)\, Z \cdot Z^\dagger.&#xA;$$&lt;/span&gt;&#xA;This gives you the Kraus operators&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K_1 := \sqrt{\lambda}\,\mathbb{I}, \qquad K_2:= \sqrt{1-\lambda}\, Z.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark:&lt;/strong&gt; In general, you can find the Kraus operators by &amp;quot;reshaping&amp;quot; the pure Choi states, since&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{J}(K\cdot K^\dagger) = d^{-1}\, \mathrm{vec}(K)\mathrm{vec}(K)^\dagger,&#xA;$$&lt;/span&gt;&#xA;where the vectorisation isomorphism &lt;span class=&quot;math-container&quot;&gt;$\mathrm{vec}:\, L(\mathcal H)\simeq \mathcal H\otimes \mathcal H^* \rightarrow \mathcal H\otimes \mathcal H$&lt;/span&gt; acts as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{vec}(|x\rangle\langle y|) = |x\rangle \otimes | y\rangle&#xA;$$&lt;/span&gt;&#xA;i.e. it applies the Riesz isomorphism to the second factor.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Sorry, I used two different conventions for the Choi-Jamiołkowski isomorphism, one where the image of a CPTP map has trace one and the other where it has trace &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; (=dimension). Fixed the second part since OP uses first convention.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-03-10T08:48:12.630" LastActivityDate="2021-03-10T08:48:12.630" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16416" PostTypeId="2" ParentId="16398" CreationDate="2021-03-09T09:32:40.583" Score="4" Body="&lt;p&gt;Another way is to observe that Choi &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)\in\mathrm{Lin}(\mathcal Y\otimes\mathcal X)$&lt;/span&gt; and Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{A_a\}_a\subset\mathrm{Lin}(\mathcal X,\mathcal Y)$&lt;/span&gt; of a map &lt;span class=&quot;math-container&quot;&gt;$\Phi:\mathrm{Lin}(\mathcal X)\to\mathrm{Lin}(\mathcal Y)$&lt;/span&gt; are directly related via&#xA;&lt;span class=&quot;math-container&quot;&gt;$$J(\Phi) = \sum_a \operatorname{vec}(A_a)\operatorname{vec}(A_a)^\dagger,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(A_a)\in\mathcal Y\otimes\mathcal X$&lt;/span&gt; is the vector with components &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(A_a)_{ij}=(A_a)_{ij}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, if a Choi is a rank-one projection of the form &lt;span class=&quot;math-container&quot;&gt;$|u\rangle\!\langle u|$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\operatorname{vec}(A_a)=|u\rangle$&lt;/span&gt;, &lt;em&gt;i.e.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$A_a=\sum_{ij}\langle i,j|u\rangle |i\rangle\!\langle j|$&lt;/span&gt;, or equivalently &lt;span class=&quot;math-container&quot;&gt;$(A_a)_{ij}=u_{ij}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally, &lt;span class=&quot;math-container&quot;&gt;$\sqrt2\langle i,j|\phi^+\rangle = \delta_{ij}$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sqrt2\langle i,j|\phi^-\rangle = \delta_{ij}(-1)^i$&lt;/span&gt;, thus&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;2|\phi^+\rangle\!\langle\phi^+|&amp;amp;\to A_0 = I, \\&#xA;2|\phi^-\rangle\!\langle\phi^-|&amp;amp;\to A_1 = Z.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-03-09T21:57:25.073" LastActivityDate="2021-03-09T21:57:25.073" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16418" PostTypeId="1" AcceptedAnswerId="16420" CreationDate="2021-03-09T11:49:49.977" Score="3" ViewCount="33" Body="&lt;p&gt;Why can't we use space to maintain absolute zero temperature required by the qubit chips and connect it to a satellite to perform computations?&lt;/p&gt;&#xA;" OwnerUserId="15141" LastEditorUserId="55" LastEditDate="2021-03-09T13:46:05.417" LastActivityDate="2021-03-09T13:46:05.417" Title="Can we use space to achieve absolute zero for a quantum computer?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16419" PostTypeId="1" AcceptedAnswerId="16425" CreationDate="2021-03-09T12:02:58.750" Score="0" ViewCount="98" Body="&lt;p&gt;I'm trying to work out how much memory is used for simulations of different sizes using the Aer simulator.&lt;/p&gt;&#xA;&lt;p&gt;Here are my calculations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Number of Qubits} = n $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Number of Amplitudes} = 2^{n} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Array Size } = {2^n}^2 = 2^{2n} $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{ Memory in Bytes needed for double precision complex number } = 16 $$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{ Memory needed (Bytes)} = 16 *2^{2n}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/76LWx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/76LWx.png&quot; alt=&quot;Workbook&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(I'm a bit confused at the exact definition of a GB of ram whether it's in powers of ten or two)&lt;/p&gt;&#xA;&lt;p&gt;From this, simulations of circuits with over 18 qubits are rather difficult.&lt;/p&gt;&#xA;&lt;p&gt;My questions are these:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Are these calculations correct ?&lt;/li&gt;&#xA;&lt;li&gt;Does this stand true for both the shot based 'qasm-simulator' and 'statevector' simulator?&lt;/li&gt;&#xA;&lt;li&gt;AER is well coded: does it have simplifications like those described in the solution to this answer (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/50/how-much-memory-is-required-to-simulate-a-48-qubit-circuit&quot;&gt;How much memory is required to simulate a 48-qubit circuit?&lt;/a&gt;)?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I realise that my calculations are the worse case scenario. I think the statevector matrix would be upper triangular and so at least half of the amplitudes would be 0, meaning there would be at least some memory gained through sparse matrices !&#xA;Thank-You !&lt;/p&gt;&#xA;" OwnerUserId="14866" LastEditorUserId="5529" LastEditDate="2021-03-09T14:58:19.547" LastActivityDate="2021-03-09T18:39:53.640" Title="Memory Requirements for Qiskit Aer Simulator" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16420" PostTypeId="2" ParentId="16418" CreationDate="2021-03-09T13:44:15.697" Score="2" Body="&lt;p&gt;As mentioned by &lt;em&gt;Rammus&lt;/em&gt; average temperature in space is 2.7 K while quantum processor are cooled to 15 mK (e.g. IBM Q). There are objects with lower temperature than 2.7 K in the space - black holes. But as you can see this option is &lt;em&gt;very unpractical&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Moreover, I would add that it is not possible to reach absolute zero. This is forbidden by third law of thermodynamics. See details &lt;a href=&quot;https://en.wikipedia.org/wiki/Third_law_of_thermodynamics#Absolute_zero&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-09T13:44:15.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16421" PostTypeId="1" AcceptedAnswerId="16433" CreationDate="2021-03-09T13:59:57.303" Score="7" ViewCount="279" Body="&lt;p&gt;In the article &lt;a href=&quot;https://eprint.iacr.org/2021/232.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Fast Factoring Integers by SVP Algorithms&lt;/a&gt; the author claims that he discovered &lt;strong&gt;classical&lt;/strong&gt; algorithm for factoring integers in polynomial time. The Quantum Report mentioned &lt;a href=&quot;https://quantumcomputingreport.com/german-researcher-claims-to-have-found-a-fast-classical-algorithm-for-factoring-large-integers/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; that it has similar performance to Shor algorithm which is often considered to ignite interest in quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;Of course, the new classical algorithm has to be examined closely before it is confirmed that it is really so fast as claimed.&lt;/p&gt;&#xA;&lt;p&gt;However, I would like to know if there are other quantum algorithms besides Shor and quantum binary optimization based.&lt;/p&gt;&#xA;&lt;p&gt;Has it been proven that Shor algorithm is optimal or could there be another even faster quantum algorithms for integers factoring?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="2293" LastEditDate="2021-03-09T23:53:04.497" LastActivityDate="2021-03-09T23:53:04.497" Title="Classical algorithm with complexity similar to Shor's discovered: Are there more efficient quantum algorithms than Shor's?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;classical-computing&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="8" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16422" PostTypeId="1" AcceptedAnswerId="16445" CreationDate="2021-03-09T14:04:48.667" Score="3" ViewCount="57" Body="&lt;p&gt;I am learning the basics of quantum computing using Qiskit and I encountered a problem when I tried to solve some of our course exercises. I feel like I am missing an invisible step, the step from mathematical notation to the quantum circuit.&lt;/p&gt;&#xA;&lt;p&gt;I am familiar with the Dirac notation and the matrices of the quantum gates, and how they transform the inputs. I can understand for instance how to achieve the effect of a Toffoli gate while only using two-qubit gates. However the problem arises when I try to encode a mathematical transformation into quantum gates. Let's start simple:&lt;/p&gt;&#xA;&lt;p&gt;When I first learned about a CNOT gate I understood the effect, and therefore the conclusion that it was the quantum version of XOR did not surprise me that much. It just seemed a handy side-effect. Hence I can encode&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|y⟩_1|x⟩_0→|x⊕y⟩_1|x⟩_0$$&lt;/span&gt;&#xA;by a CNOT gate.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(q)&#xA;&#xA;qc.cx(0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then I got an exercise to build a half adder:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|z⟩_2|y⟩_1|x⟩_0→|z⊕xy⟩_2|x⊕y⟩_1|x⟩_0$$&lt;/span&gt;&#xA;This confused me a lot because I do not now how to encode the AND part. Hence even this&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|z⟩_2|y⟩_1|x⟩_0→|xy⟩_2|y⟩_1|x⟩_0$$&lt;/span&gt;&#xA;I would not know. Luckily the book walks over the 'adding' part of the half-adder, which is when I learned that a Toffoli gate would do the job.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3)&#xA;&#xA;qc.ccx(0, 1, 2)&#xA;qc.cx(0, 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I hope you can see the step I am missing: I know 'tricks' for some solutions, but I don't know how to encode a general mathematical transformation. Hence I was baffled when I was asked about unitary function encoding, and to encode the following,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$U:|y⟩|x⟩↦|f(x)+y \mod 2^m⟩|x⟩$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is an arbitrary boolean function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^n↦\{0,1\}^m$&lt;/span&gt;. I had NO clue how to approach this.&lt;/p&gt;&#xA;&lt;p&gt;Therefore my question is the following. How do I encode an arbitrary mathematical expression like I have given above to a quantum circuit? Most importantly: What are the general steps you take when you approach a problem like this? Right now this might seem like simple questions, but I need to understand this to be able to solve the (to me) much harder questions later in the book.&lt;/p&gt;&#xA;&lt;p&gt;If anything is unclear I am happy to clarify.&lt;/p&gt;&#xA;" OwnerUserId="15142" LastActivityDate="2021-03-10T15:08:54.360" Title="From mathematical notation to quantum circuit, in general" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;&lt;mathematics&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16423" PostTypeId="1" CreationDate="2021-03-09T14:46:06.407" Score="0" ViewCount="77" Body="&lt;p&gt;I have a Quantum Circuit launched but I want to convert it into a qobj to use the function .run from qiskit, I've tried to use the function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qobj = assemble(QuantumCircuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but it returns&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'QuantumCircuit' object has no attribute 'config'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and I've failed to find the &amp;quot;config&amp;quot; needed on the qiskit instructions.&#xA;Does anyone know's how do I convert it properly and fill's this configurations?&lt;/p&gt;&#xA;&lt;p&gt;Here is a print of the qobj after assemble:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QASM Qobj: 3d6e9e20-290e-4c7d-a2e7-c0b5a8e38f2e:&#xA;Config: {'init_qubits': True,&#xA; 'memory': False,&#xA; 'memory_slots': 3,&#xA; 'n_qubits': 3,&#xA; 'parameter_binds': [],&#xA; 'shots': 1024}&#xA;Header: {}&#xA;Experiments:&#xA;&#xA;QASM Experiment:&#xA;Header:&#xA;{'clbit_labels': [['c', 0], ['c', 1], ['c', 2]],&#xA; 'creg_sizes': [['c', 3]],&#xA; 'global_phase': 0.0,&#xA; 'memory_slots': 3,&#xA; 'n_qubits': 3,&#xA; 'name': 'circuit',&#xA; 'qreg_sizes': [['q', 3]],&#xA; 'qubit_labels': [['q', 0], ['q', 1], ['q', 2]]}&#xA;Config:&#xA;{'memory_slots': 3, 'n_qubits': 3}&#xA;&#xA;    Instruction: ry&#xA;        params: [1.0]&#xA;        qubits: [0]&#xA;&#xA;    Instruction: rz&#xA;        params: [2.0]&#xA;        qubits: [0]&#xA;&#xA;    Instruction: h&#xA;        qubits: [0]&#xA;&#xA;    Instruction: measure&#xA;        qubits: [0]&#xA;        memory: [0]&#xA;&#xA;    Instruction: ry&#xA;        params: [1.0]&#xA;        qubits: [2]&#xA;&#xA;    Instruction: rz&#xA;        params: [2.0]&#xA;        qubits: [2]&#xA;&#xA;    Instruction: measure&#xA;        qubits: [2]&#xA;        memory: [2]&#xA;&#xA;    Instruction: ry&#xA;        params: [1.0]&#xA;        qubits: [1]&#xA;&#xA;    Instruction: rz&#xA;        params: [2.0]&#xA;        qubits: [1]&#xA;&#xA;    Instruction: sdg&#xA;        qubits: [1]&#xA;&#xA;    Instruction: h&#xA;        qubits: [1]&#xA;&#xA;    Instruction: measure&#xA;        qubits: [1]&#xA;        memory: [1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;it still's return the same error.&lt;/p&gt;&#xA;" OwnerUserId="9461" LastEditorUserId="9461" LastEditDate="2021-03-09T15:46:28.850" LastActivityDate="2021-03-09T15:46:28.850" Title="How do I convert a Quantum Circuit into a qobj" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16424" PostTypeId="2" ParentId="16423" CreationDate="2021-03-09T14:57:29.737" Score="1" Body="&lt;p&gt;The function &lt;code&gt;assemble&lt;/code&gt; takes a &lt;code&gt;QuantumCircuit&lt;/code&gt; instance, not the type:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qobj = assemble(QuantumCircuit())&#xA;type(qobj)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;qiskit.qobj.qasm_qobj.QasmQobj&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(2)&#xA;circuit.h(0)&#xA;circuit.cx(0, 1)&#xA;&#xA;qobj = assemble(circuit)&#xA;print(qobj)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;QASM Qobj: 2a18a692-be49-452e-8631-72865c890d05:&#xA;Config: {'init_qubits': True,&#xA;...&#xA;...&#xA;    Instruction: h&#xA;        qubits: [0]&#xA;&#xA;    Instruction: cx&#xA;        qubits: [0, 1]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-03-09T15:04:07.323" LastActivityDate="2021-03-09T15:04:07.323" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16425" PostTypeId="2" ParentId="16419" CreationDate="2021-03-09T14:59:17.713" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;Your calculations section looks correct but I think your spreadsheet is incorrect. For example if you do 16 bytes * (2^21) that's 33554432 bytes or.0336 GB or 33.6 MB. Things go quickly though for a 32 qubit simulation 16 bytes * (2^32) is 68.72 GB. You can also look at the aer source code it's using this calculation for the required memory for a statevector: &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/blob/1a6d5df89a2e016afbb33a2d7088e6100348a7c4/src/simulators/statevector/qubitvector.hpp#L813-L819&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/blob/1a6d5df89a2e016afbb33a2d7088e6100348a7c4/src/simulators/statevector/qubitvector.hpp#L813-L819&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;The difference between the &lt;code&gt;qasm-simulator&lt;/code&gt; and &lt;code&gt;statevector-simulator&lt;/code&gt; are primarily in return type. The statevector simulator and the qasm simulator (when using the statevector simulation method) work in the same way the only difference is that the statevector simulator returns the statevector instead of computing the measurement counts. However, the qasm simulator offers multiple simulation methods  (see: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.QasmSimulator.html#qiskit.providers.aer.QasmSimulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.providers.aer.QasmSimulator.html#qiskit.providers.aer.QasmSimulator&lt;/a&gt; for a list) which will have different memory and resource requirements. For example, if your circuit is made up of cliffords you can use the stabilizer simulation method and the memory requirements are much lower.&lt;/li&gt;&#xA;&lt;li&gt;That specific method is not implemented in qiskit aer to my knowledge (since it's very application specific)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="5529" LastEditorUserId="5529" LastEditDate="2021-03-09T18:39:53.640" LastActivityDate="2021-03-09T18:39:53.640" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16426" PostTypeId="1" CreationDate="2021-03-09T15:46:17.050" Score="2" ViewCount="19" Body="&lt;p&gt;Consider an arbitrary ensemble &lt;span class=&quot;math-container&quot;&gt;$\{p_x\rho_x\}_{x\in X}$&lt;/span&gt; and define the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \rho = \sum_{x\in X} \vert x \rangle\langle x \vert \otimes p_x\rho_x. $$&lt;/span&gt;&#xA;I am interested in understanding the quantity&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \inf_{\xi, \hspace{2mm}\xi_x\perp\xi_{x'}} \Vert \rho - \xi \Vert_1, \quad\quad \text{with } \Vert\cdot\Vert_1 = \operatorname{Tr}\vert\cdot\vert, $$&lt;/span&gt;&#xA;where the infimum is taken over all orthogonal ensembles, that is for the ensemble &lt;span class=&quot;math-container&quot;&gt;$\{q_x\xi_x\}_{x\in X}$&lt;/span&gt; we define&#xA;&lt;span class=&quot;math-container&quot;&gt;$\xi = \sum_{x\in X}\vert x \rangle\langle x \vert \otimes q_x\xi_x$&lt;/span&gt; and we assume &lt;span class=&quot;math-container&quot;&gt;$\xi_x\perp \xi_{x'}$&lt;/span&gt; for all distinct &lt;span class=&quot;math-container&quot;&gt;$x,x'\in X$&lt;/span&gt; in the sense &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}\xi_x\xi_{x'} = 0$&lt;/span&gt;. In particular, my curiosity is directed at having some intuition as to what a good choice of &lt;span class=&quot;math-container&quot;&gt;$\xi$&lt;/span&gt;  depending on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is when trying to minimize the expression above. For instance, one could let &lt;span class=&quot;math-container&quot;&gt;$\{M_x\}_{x\in X}$&lt;/span&gt; denote a set of orthogonal projections and define &lt;span class=&quot;math-container&quot;&gt;$\xi_x = \frac{M_x\rho_x M_x}{\operatorname{Tr} M_x\rho_x M_x}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_x = p_x$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\Vert \rho - \xi\Vert_1 &amp;amp;= \sum_{x\in X} \Vert p_x\rho_x - p_x\xi_x\Vert_1 \\&#xA;   &amp;amp;= \sum_{x\in X} p_x\left\Vert \left(1 - \frac{1}{\operatorname{Tr} M_x\rho_xM_x}\right)M_x\rho_xM_x - (Id-M_x)\rho_x(Id-M_x)\right\Vert_1 \\&#xA;   &amp;amp;= \sum_{x\in X} p_x\left(\left(\frac{1}{\operatorname{Tr} M_x\rho_xM_x}-1\right)\operatorname{Tr} M_x\rho_xM_x + \operatorname{Tr} (Id-M_x)\rho_x(Id-M_x)\right) \\&#xA;   &amp;amp;= 1 - \sum_{x\in X}\operatorname{Tr}(2M_x-Id)p_x\rho_x \\&#xA;   &amp;amp;= 2\left(1 - \sum_{x\in X}\operatorname{Tr}M_xp_x\rho_x\right)&#xA;\end{align*}&lt;/span&gt;&#xA;So choosing &lt;span class=&quot;math-container&quot;&gt;$\{M_x\}_{x\in X}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_{x\in X}\operatorname{Tr}M_xp_x\rho_x$&lt;/span&gt; is maximized is a decent choice! However, is this optimal in general? Or are there any other natural constructions of &lt;span class=&quot;math-container&quot;&gt;$\xi$&lt;/span&gt;, which give a pretty good upper bound on the quantity in question?&lt;/p&gt;&#xA;&lt;p&gt;Any help is appreciated!&lt;/p&gt;&#xA;" OwnerUserId="12421" LastActivityDate="2021-03-09T15:46:17.050" Title="Approximating an ensemble with an orthogonal ensemble" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;trace-distance&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16427" PostTypeId="2" ParentId="16186" CreationDate="2021-03-09T16:25:32.000" Score="1" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\lvert + \rangle^{\otimes n}$&lt;/span&gt; state is the Eigenstate of the Mixer &lt;span class=&quot;math-container&quot;&gt;$H_M$&lt;/span&gt;. By keeping the adiabatic process you can satisfy,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H\lvert \psi \rangle = E_0 \lvert \psi \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And finally get the Eigenvalue and Eigenstate of the Cost &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9564" LastActivityDate="2021-03-09T16:25:32.000" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16428" PostTypeId="1" CreationDate="2021-03-09T16:47:51.773" Score="0" ViewCount="24" Body="&lt;p&gt;Among some documents I found to make a MPS state on quantum circuit, I can make it with stepped arrangement of unitary operators.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;|0&amp;gt;--U-----M&#xA;     |&#xA;|0&amp;gt;--U--U--M&#xA;        |&#xA;|0&amp;gt;-----U--M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And also Honeywell or IBM machine support Mid-circuit measurement and qubit reuse, which we can fold this quantum circuit like,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;|0&amp;gt;--U--M |0&amp;gt;--U--M&#xA;     |         |&#xA;|0&amp;gt;--U---------U--M&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can I think about bond dimension on this quantum circuit?&#xA;Do I have to use multiple qubits to make larger number of bond dimension on MPS state?&lt;/p&gt;&#xA;" OwnerUserId="9564" LastActivityDate="2021-03-09T16:47:51.773" Title="Folded MPS state with Mid-circuit measurement" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;tensor-networks&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16429" PostTypeId="1" AcceptedAnswerId="16430" CreationDate="2021-03-09T21:29:29.983" Score="1" ViewCount="65" Body="&lt;p&gt;See title. If this is not true, is there a counter example? If it is not true, does it hold true for certain combinations of unitaries and entangled states?&lt;/p&gt;&#xA;" OwnerUserId="14239" LastActivityDate="2021-03-11T19:46:58.903" Title="If you apply a unitary transformation to an entangled state, is it still entangled?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;unitarity&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16430" PostTypeId="2" ParentId="16429" CreationDate="2021-03-09T21:46:59.530" Score="4" Body="&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$&lt;/span&gt; is a maximal entangled state that can be created by applying the unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U_1 = CNOT \cdot (H \otimes I) $&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{init}\rangle = |00\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then now if we apply the unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U_2 = U_1^{-1} = (H \otimes I) \cdot CNOT $&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; then we will get back &lt;span class=&quot;math-container&quot;&gt;$|\psi_{init} \rangle = |00\rangle$&lt;/span&gt; which is a product state (non-entangled state) by definition.&lt;/p&gt;&#xA;&lt;p&gt;However, if you only applied unitaries that only acts on a single qubit, for instance &lt;span class=&quot;math-container&quot;&gt;$U_2 = X \otimes X$&lt;/span&gt;, then it would still have been an entangled state. This is because entanglement does not change under local unitary operations.&lt;/p&gt;&#xA;&lt;p&gt;A proof for why local unitary operations do not change entanglement is as follows:&lt;/p&gt;&#xA;&lt;p&gt;Say you are in some entangled state, &lt;span class=&quot;math-container&quot;&gt;$|\psi_e \rangle$&lt;/span&gt; by applying a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to some arbitrary starting state, and then apply local unitary operations, call them &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt;, to &lt;span class=&quot;math-container&quot;&gt;$|\psi_e \rangle$&lt;/span&gt; and get a state  &lt;span class=&quot;math-container&quot;&gt;$|\psi_n \rangle = U|\psi_e \rangle$&lt;/span&gt; that is not entangled, then you could express that state as a tensor product &lt;span class=&quot;math-container&quot;&gt;$|\psi_n \rangle = A(c_1|0 \rangle + c_2|1 \rangle) \otimes B(c_3|0 \rangle + c_4|1 \rangle)$&lt;/span&gt;. Applying the inverses of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; to the respective bits of &lt;span class=&quot;math-container&quot;&gt;$|\psi_n \rangle$&lt;/span&gt;, should then yield the original entangled state as a tensor product, however it shouldn't be possible to represent it as a tensor product since it is entangled.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="14239" LastEditDate="2021-03-11T19:46:58.903" LastActivityDate="2021-03-11T19:46:58.903" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16431" PostTypeId="5" CreationDate="2021-03-09T22:04:10.693" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-03-09T22:04:10.693" LastActivityDate="2021-03-09T22:04:10.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16432" PostTypeId="4" CreationDate="2021-03-09T22:04:10.693" Score="0" Body="For questions about the positive partial transpose (PPT) criterion, or more generally about PPT states." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-03-09T22:04:10.693" LastActivityDate="2021-03-09T22:04:10.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16433" PostTypeId="2" ParentId="16421" CreationDate="2021-03-09T23:52:26.437" Score="4" Body="&lt;p&gt;Shor's algorithm is often quoted as having a cost of  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log^3 n)$&lt;/span&gt; quantum operations, though it's actually a bit smaller than that: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\left((\log n)^{2} (\log \log n) (\log \log \log n) \right)$&lt;/span&gt;, but since &lt;span class=&quot;math-container&quot;&gt;$\log \log n &amp;lt; \log n$&lt;/span&gt; we know that the &amp;quot;verbose&amp;quot; cost is less than the often quoted cost of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log^3 n)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There's no proof that  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\left((\log n)^{2} (\log \log n) (\log \log \log n) \right)$&lt;/span&gt; is optimal, and I wouldn't be surprised if someone came up with a version that costs only &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}\left((\log n)^{2} (\log \log n) (\log \log \log n \log n) \right)$&lt;/span&gt; (there's one extra &lt;span class=&quot;math-container&quot;&gt;$\log n$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;However I find myself reminded right now of &lt;a href=&quot;https://cs.uwaterloo.ca/about/people/shalevb&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shalev Ben-David&lt;/a&gt;'s talk at the Aspen conference for which I was the session chair, in 2016 when he was still a PhD student of Scott Aaronson. He had a slide that said &amp;quot;&lt;em&gt;real&lt;/em&gt; computer scientists only care about exponential speed-ups&amp;quot; (with emphasis on &amp;quot;real&amp;quot; in the original version too). That might be a bit of an exaggeration, but a slightly less strong version of that statement will lead you to my main point here, which is that no one has yet been able to reduce the power from  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log^3 n)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log^{\color{red}{2}} n)$&lt;/span&gt;. In that sense, Shor's algorithm is still the most &amp;quot;efficient&amp;quot; in terms of the power of &lt;span class=&quot;math-container&quot;&gt;$\log n$&lt;/span&gt; appearing in the number of quantum gates required.&lt;/p&gt;&#xA;&lt;p&gt;There's plenty of work that's been done on reducing the &lt;em&gt;&lt;strong&gt;exact&lt;/strong&gt;&lt;/em&gt; number of gates (here the constant under the &amp;quot;Big Oh&amp;quot; now matters), and also plenty of work done on reducing the number of total qubits needed.&lt;/p&gt;&#xA;&lt;p&gt;One somewhat recent paper title that comes to my mind is Craig Gidney's &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1706.07884&quot; rel=&quot;nofollow noreferrer&quot;&gt;Factoring with &lt;span class=&quot;math-container&quot;&gt;$n+2$&lt;/span&gt; clean qubits and &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; dirty qubits&lt;/a&gt;&amp;quot; and &amp;quot;&lt;a href=&quot;https://arxiv.org/abs/1905.09749&quot; rel=&quot;nofollow noreferrer&quot;&gt;How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits&lt;/a&gt;&amp;quot; (also by &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/119/craig-gidney&quot;&gt;Craig Gidney&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-09T23:52:26.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16434" PostTypeId="1" CreationDate="2021-03-10T03:15:25.177" Score="6" ViewCount="121" Body="&lt;p&gt;In this plot:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bYkvJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bYkvJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;taken from &lt;a href=&quot;https://www.zdnet.com/article/ionq-to-go-public-via-spac-deal-becomes-quantum-computing-pure-play/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, IonQ is claiming to have a potential application in machine learning by 2023. What applications could they have in mind?&lt;/p&gt;&#xA;&lt;p&gt;From what I understand, modern error correction prevents obtaining speedup from any &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15419/list-of-practical-quantum-computing-algorithms-that-have-speed-up-higher-than-qu&quot;&gt;quadratic algorithms&lt;/a&gt;, so the only realistic speedup could be done with algorithms faster than polynomial. From this chart:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pu26h.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pu26h.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems like there aren't any ML applications that are faster than quadratic without &lt;a href=&quot;https://www.nature.com/articles/nphys3272.pdf?origin=ppub&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;the fine-print&amp;quot;&lt;/a&gt; that they might not be do-able in a real-life situation.&lt;/p&gt;&#xA;&lt;p&gt;Is there something I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="2660" LastEditorUserId="55" LastEditDate="2021-03-10T11:30:40.273" LastActivityDate="2021-03-12T03:50:03.603" Title="Claimed &quot;potential revenue&quot; from machine learning in 2023?" Tags="&lt;algorithm&gt;&lt;physical-realization&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;applications&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16435" PostTypeId="1" CreationDate="2021-03-10T07:41:24.350" Score="1" ViewCount="40" Body="&lt;p&gt;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 &amp;quot;minimum search&amp;quot; of Dürr and Hoyer. I am not getting how to code this algorithm. Can someone please share the coded program?&lt;/p&gt;&#xA;" OwnerUserId="15150" LastEditorUserId="10480" LastEditDate="2021-03-11T04:43:03.420" LastActivityDate="2021-03-11T04:43:03.420" Title="How to code the &quot;minimum search&quot; algoirithm of Dürr and Hoyer with Grover's search?" Tags="&lt;algorithm&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-03-25T11:35:02.780" ContentLicense="CC BY-SA 4.0" />
  <row Id="16436" PostTypeId="1" AcceptedAnswerId="16485" CreationDate="2021-03-10T07:54:12.660" Score="2" ViewCount="87" Body="&lt;p&gt;Suppose I have two states &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt; such that the marginals &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \sigma_A$&lt;/span&gt;. What is the most general operation that could have acted on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to output &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;For example, if there was no reduced state constraint, I think one can always find a unitary &lt;span class=&quot;math-container&quot;&gt;$U_{ABC}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is a purifying system such that &lt;span class=&quot;math-container&quot;&gt;$U_{ABC}\vert\rho_{ABC}\rangle = \vert\sigma_{ABC}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now enforcing &lt;span class=&quot;math-container&quot;&gt;$\rho_A=\sigma_A$&lt;/span&gt;, is it true that there exists some unitary &lt;span class=&quot;math-container&quot;&gt;$U_{BC}$&lt;/span&gt; that achieves &lt;span class=&quot;math-container&quot;&gt;$(I_A\otimes U_{BC})\vert\rho_{ABC}\rangle = \vert\sigma_{ABC}\rangle$&lt;/span&gt;? Or some other way to achieve such a transformation?&lt;/p&gt;&#xA;" OwnerUserId="14178" LastEditorUserId="55" LastEditDate="2021-03-10T11:35:42.347" LastActivityDate="2021-03-12T20:59:03.187" Title="What is the most general quantum operation that preserves the marginal?" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;&lt;unitarity&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16437" PostTypeId="2" ParentId="7189" CreationDate="2021-03-10T07:57:14.473" Score="-3" Body="&lt;p&gt;All quantum gates are unitary except measurement. quantum measurement isn't reversible.&lt;/p&gt;&#xA;" OwnerUserId="12484" LastActivityDate="2021-03-10T07:57:14.473" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16438" PostTypeId="1" CreationDate="2021-03-10T07:57:26.233" Score="0" ViewCount="62" Body="&lt;p&gt;I've already tried the instructions on the qiskit page and even from this other question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8702/what-is-the-location-of-the-qiskit-config-file&quot;&gt;What is the location of the Qiskit config file?&lt;/a&gt;&#xA;but it doesn´t work, the circuit keeps looking as text based, even i restarted jupyter notebook, and nothing. The settings.conf file wasn't in the directory so i created one but still no results.&lt;/p&gt;&#xA;" OwnerUserId="15151" LastEditorUserId="55" LastEditDate="2021-03-10T11:39:10.950" LastActivityDate="2021-03-10T11:39:10.950" Title="How to set matplolib as default circuit drawer?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16439" PostTypeId="2" ParentId="13673" CreationDate="2021-03-10T10:43:31.467" Score="2" Body="&lt;p&gt;The main benefit is quantum computing may enable the use of kernels which are hard to compute classically. In other words, it may be possible to separate the input data using quantum feature maps which are not available in classical calculations.&lt;/p&gt;&#xA;&lt;p&gt;You may find this &lt;a href=&quot;https://arxiv.org/abs/1804.11326&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; helpful - it discusses the issue in some detail.&lt;/p&gt;&#xA;" OwnerUserId="8282" LastActivityDate="2021-03-10T10:43:31.467" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16440" PostTypeId="2" ParentId="16438" CreationDate="2021-03-10T10:43:42.867" Score="2" Body="&lt;p&gt;To check that the content of the &lt;code&gt;setting.conf&lt;/code&gt; file is properly set you can run the following&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import user_config&#xA;user_config.get_config()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'circuit_drawer': 'mpl'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If this is not your output, then your &lt;code&gt;setting.conf&lt;/code&gt; is out of format or in the wrong location. You can fix the location by setting the env variable &lt;code&gt;QISKIT_SETTINGS&lt;/code&gt;. It is possible to do that in a Jupyter notebook with this magic:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;%env QISKIT_SETTINGS &amp;lt;path to your setting.conf&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-10T10:43:42.867" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16441" PostTypeId="1" CreationDate="2021-03-10T11:55:19.167" Score="3" ViewCount="74" Body="&lt;p&gt;I am writing some python code to be able to optimise the total error in two qubit gate decomposition.&lt;/p&gt;&#xA;&lt;p&gt;I am using the Qiskit module &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/quantum_info/synthesis/two_qubit_decompose.html#TwoQubitBasisDecomposer&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit.quantum_info.synthesis.two_qubit_decompose&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question relates to the difference between the two classes given in this code. One is &lt;code&gt;TwoQubitWeylDecomposition&lt;/code&gt; and seems to decompose using the &lt;code&gt;KAK1&lt;/code&gt; method detailed on page two &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0507171.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The other, &lt;code&gt;TwoQubitBasisDecomposer()&lt;/code&gt; allows you to input which specific two-qubit gate you want to use in the decomposition of an arbitrary &lt;code&gt;SU(4)&lt;/code&gt; (e.g. &lt;code&gt;CNOT&lt;/code&gt;, Molmer-Sorensen etc).&lt;/p&gt;&#xA;&lt;p&gt;One of the methods of this class allows you to find the fidelity of a target unitary, using &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; implementations of the basis gate of your choice (higher fidelity with more basis gate usage). However, you have to turn the target unitary into the &lt;code&gt;TwoQubitWeylDecomposition&lt;/code&gt; class, otherwise, you get errors (target doesn't have the attribute &lt;code&gt;.a&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I'm uncertain why the target unitary needs to be a &lt;code&gt;TwoQubitWeylDecomposition&lt;/code&gt; class. The &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/quantum_info/synthesis/two_qubit_decompose.html#TwoQubitBasisDecomposer&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt; isn't very helpful either.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any help.&lt;/p&gt;&#xA;" OwnerUserId="14819" LastEditorUserId="55" LastEditDate="2021-03-10T14:52:27.203" LastActivityDate="2021-03-10T14:52:27.203" Title="Two qubit gate decomposition in using Qiskit" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;compiling&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16442" PostTypeId="1" AcceptedAnswerId="16443" CreationDate="2021-03-10T12:22:29.697" Score="2" ViewCount="46" Body="&lt;p&gt;In Nielsen's book when proving &amp;quot;Unitary freedom in the ensemble for density matrices&amp;quot;(Theorem 2.6):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Suppose }|\widetilde{\psi_i}\rangle = \sum\limits_{j}u_{ij} |\widetilde{\phi_j}\rangle$$&lt;/span&gt;&#xA;Then in Equation 2.168:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_i |\widetilde{\psi_i}\rangle \langle\widetilde{\psi_i}| = \sum_{ijk} u_{ij} u_{ik}^{*}|\widetilde{\phi_j}\rangle \langle\widetilde{\phi_k}|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In equation 2.168 adjoint of the tilded psi has now the element in the unitary matrix u being ik conjugated(&lt;span class=&quot;math-container&quot;&gt;$u_{ik}^*$&lt;/span&gt;). Now I understand that the column index after the adjoint will not be the same due to the transpose(hence k instead of j), what I don't understand is why the row index (i) is unchanged. I know it's probably something simple that I am missing, but I would appreciate your help.&lt;/p&gt;&#xA;" OwnerUserId="15156" LastEditorUserId="55" LastEditDate="2021-03-10T20:38:04.563" LastActivityDate="2021-03-10T20:38:04.563" Title="Why is the subscript like this in the equation $\sum_i |\psi_i\rangle \langle\psi_i| = \sum_{ijk} u_{ij} u_{ik}^{*}|\phi_j\rangle \langle\phi_k|$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16443" PostTypeId="2" ParentId="16442" CreationDate="2021-03-10T12:42:51.033" Score="3" Body="&lt;p&gt;The proof begins with let &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle = \sum_j u_{ij} |\varphi_j\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U = (u_{ij})_{ij}$&lt;/span&gt; is some unitary matrix. But now,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;|\psi_i\rangle \langle \psi_i| &amp;amp;= \left(\sum_j u_{ij} |\varphi_j\rangle \right)\left(\sum_k u_{ik} |\varphi_k\rangle\right)^{\dagger} \\&#xA;&amp;amp;= \left(\sum_j u_{ij} |\varphi_j\rangle \right)\sum_k u_{ik}^* \langle\varphi_k| \\&#xA;&amp;amp;= \sum_{jk} u_{ij} u_{ik}^* |\varphi_j\rangle \langle\varphi_k|.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;On the first line &lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt; denotes the hermitian conjugate (adjoint operator); on the second line we used that &lt;span class=&quot;math-container&quot;&gt;$\dagger$&lt;/span&gt; is conjugate-linear (here &lt;span class=&quot;math-container&quot;&gt;$u_{ik}^*$&lt;/span&gt; is the complex conjugate of the complex number &lt;span class=&quot;math-container&quot;&gt;$u_{ik}$&lt;/span&gt;) and on the last line we just rearranged the sums and moved the complex numbers to the front.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-10T12:42:51.033" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16444" PostTypeId="1" AcceptedAnswerId="16532" CreationDate="2021-03-10T13:54:11.337" Score="5" ViewCount="121" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\renewcommand{\calH}{{\mathcal{H}}}\calH$&lt;/span&gt; be a finite-dimensional Hilbert space.&#xA;An &lt;em&gt;observable&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is here a Hermitian operator, &lt;span class=&quot;math-container&quot;&gt;$A\in\mathrm{Herm}(\calH)$&lt;/span&gt;.&#xA;A &lt;em&gt;POVM&lt;/em&gt; is here a collection of positive operators summing to the identity: &lt;span class=&quot;math-container&quot;&gt;$\{\mu(a): a\in\Sigma\}\subset\mathrm{Pos}(\calH)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_{a\in\Sigma} \mu(a)=I$&lt;/span&gt;, for some register &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;An observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is given physical meaning via the mapping &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto \operatorname{Tr}(A\rho)$&lt;/span&gt; for any state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, which gives us the &lt;em&gt;expectation value&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;On the other hand, a POVM &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; is given physical meaning interpreting &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; as the set of possible &lt;em&gt;outcomes&lt;/em&gt;, with the outcome &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; occurring with probability &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\mu(a)\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A POVM is always a collection of observables, but not all collections of observables are POVMs.&lt;/p&gt;&#xA;&lt;p&gt;Intuitively, I understand the process of &amp;quot;&lt;em&gt;measuring an observable &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&lt;/em&gt;&amp;quot; as tantamount to performing the (projective) POVM corresponding to the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, then attaching numbers (the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;) to the corresponding outcomes, and obtaining the corresponding expectation value in the limit of many measurements.&#xA;In this sense, I would be led to say that POVMs are more &amp;quot;fundamental&amp;quot; than observables, in the sense that observables amount to measuring a POVM and then doing post-processing on the corresponding measurement results.&lt;/p&gt;&#xA;&lt;p&gt;On the other other hand, in several contexts observables, rather than POVMs, are given the spotlight. To name one example, we discuss the uncertainty principle in terms of observables, not in terms of POVMs.&#xA;In this sense, it seems like observables are generally regarded as &amp;quot;more fundamental&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;In light of this, is there any general statement that can be made about the relations between observables and POVMs?&#xA;Should they be regarded as simply incomparable ideas, or is there merit in thinking of observables as equivalent to post-processing of measurement (POVM) results? Or are there reasons to instead use observables as the primitive idea, and think of POVMs as simply special sets of observables?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sup&gt;&lt;em&gt;While the title might one lead to believe this question is similar to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/15630/55&quot;&gt;this other one&lt;/a&gt; I asked previously, the questions are really completely different; the apparent similarity is due to the different possible meanings of the term &amp;quot;observable&amp;quot; in different contexts.&lt;/em&gt;&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-03-18T05:50:48.543" LastActivityDate="2021-03-18T05:50:48.543" Title="What is the relation between POVMs and observables (as Hermitian operators)?" Tags="&lt;measurement&gt;&lt;notation&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16445" PostTypeId="2" ParentId="16422" CreationDate="2021-03-10T15:08:54.360" Score="1" Body="&lt;p&gt;Encoding arbitrary mathematical expressions on a quantum computer is a difficult question! There's still ongoing research in this area, such as &lt;a href=&quot;https://export.arxiv.org/pdf/1805.12445&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://export.arxiv.org/pdf/1805.12445&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Classical computing is years ahead of quantum computing here; on a classical machine you can just open up your programming language of choice and you have access to all mathematical expressions you'd like to use. But keep in mind, that also in &amp;quot;classical programming languages&amp;quot; there are libraries to implement operations like sine and cosine. E.g. if you use Python, you most likely use &lt;code&gt;numpy.sin&lt;/code&gt;. For many quantum programming languages (like Qiskit) these general libraries simply &lt;em&gt;don't yet exist&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;(I think Q# has a library, but I never worked with it: &lt;a href=&quot;https://docs.microsoft.com/en-us/azure/quantum/user-guide/libraries/numerics/numerics&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://docs.microsoft.com/en-us/azure/quantum/user-guide/libraries/numerics/numerics&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;So currently, we mostly rely on &amp;quot;tricks&amp;quot; as you called them and exploit things like that the Toffoli acts like a AND gate and CNOT like an XOR. Here's a reference that might be useful that talks about elementary arithmetic operations and how to implement them using circuits: &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9511018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/quant-ph/9511018.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;That being said: If you care about boolean logical expressions, then Qiskit can build the circuits for these, see &lt;a href=&quot;https://qiskit.org/documentation/apidoc/classicalfunction.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/classicalfunction.html&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I hope this answers your question, though I don't think there's a general solution (yet).&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-03-10T15:08:54.360" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16446" PostTypeId="1" AcceptedAnswerId="16448" CreationDate="2021-03-10T15:37:36.647" Score="0" ViewCount="51" Body="&lt;p&gt;In Nielsen &amp;amp; Chuang's book equation 2.172 says&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\sum_{i}|\widetilde{\psi_i}\rangle \langle \widetilde{\psi_i}| = \sum_j |\widetilde{\phi_j}\rangle \langle \widetilde{\phi_j}|.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then it makes the assumption that A can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A=\sum_{k} \lambda_{k}|k\rangle\langle k|$$&lt;/span&gt;&#xA;where the kets are orthonormal vectors and lambdas are strictly positive. On what basis are these two assumptions made? Namely the positivity and orthonormality.&lt;/p&gt;&#xA;" OwnerUserId="15156" LastEditorUserId="55" LastEditDate="2021-03-11T11:44:22.900" LastActivityDate="2021-03-11T11:44:22.900" Title="On what basis can we write a positive operator as $A=\sum_k\lambda_k|k\rangle\langle k|$?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16447" PostTypeId="1" CreationDate="2021-03-10T15:56:26.453" Score="6" ViewCount="85" Body="&lt;p&gt;I am looking to implement a quantum version of the arcsinus function. Such a problem is motivated by the HHL algorithm where &lt;span class=&quot;math-container&quot;&gt;$x\mapsto 1/x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\arcsin$&lt;/span&gt; can be used to get &lt;span class=&quot;math-container&quot;&gt;$1/x$&lt;/span&gt; from the computational basis state into the amplitude.&lt;/p&gt;&#xA;&lt;p&gt;My questions are based on the paper Optimizing Quantum Circuits for Arithmetic (arxiv link :&lt;a href=&quot;https://arxiv.org/abs/1805.12445&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1805.12445&lt;/a&gt;).&#xA;Their idea is to use a polynomial approximation of the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and to partition the domain &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; of study of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\Omega = \bigcup_{i=1}^M \Omega_i \quad \Omega_i\cap \Omega_j = \emptyset \, \forall i \neq j&#xA;$$&lt;/span&gt;&#xA;and then perform a case distinction for each input, evaluating a different polynomial for &lt;span class=&quot;math-container&quot;&gt;$x\in \Omega_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y\in \Omega_j$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is chosen in order to achieve a certain precision and the degree of the polynomials are all bounded by a constant &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Evaluating a single polynomial &lt;span class=&quot;math-container&quot;&gt;$P(x) = \sum_{i=0}^d a_ix^i$&lt;/span&gt; can be done using the Horner scheme, where one iteratively performs a multiplication by &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and an addition by &lt;span class=&quot;math-container&quot;&gt;$a_i$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i\in \{d, d-1, \cdots 0\}$&lt;/span&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ a_d \mapsto a_dx+a_{d-1} \mapsto a_dx^2+a_{d-1}x + a_{d-2} \mapsto \cdots \mapsto P(x)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At iteration &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, the last iterate is added by &lt;span class=&quot;math-container&quot;&gt;${a_i}$&lt;/span&gt;, while this does not represent any difficulty in classical computing, a register has to hold the set of coefficients &lt;span class=&quot;math-container&quot;&gt;${a_i}$&lt;/span&gt;, and has to be changed at each iteration. In their paper, the authors assume that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NEXT}_a$&lt;/span&gt; implements such an operation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BE0P8.jpg&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BE0P8.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My question&lt;/strong&gt; : How can one implement efficiently the function &lt;span class=&quot;math-container&quot;&gt;$\mathrm{NEXT}_a$&lt;/span&gt; ?&lt;/p&gt;&#xA;" OwnerUserId="14113" LastActivityDate="2021-03-12T06:01:24.773" Title="Quantum implementation of arcsin" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16448" PostTypeId="2" ParentId="16446" CreationDate="2021-03-10T17:49:02.590" Score="2" Body="&lt;p&gt;A linear operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is said to be &lt;a href=&quot;https://en.wikipedia.org/wiki/Normal_operator&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;normal&lt;/em&gt;&lt;/a&gt; if &lt;span class=&quot;math-container&quot;&gt;$AA^\dagger = A^\dagger A$&lt;/span&gt;. The significance of the class of normal operators is that these are precisely the operators that &lt;a href=&quot;https://en.wikipedia.org/wiki/Spectral_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;have an orthonormal basis of eigenvectors&lt;/a&gt;. Consequently, if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is normal then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A = \sum_k \lambda_k |\psi_k\rangle\langle\psi_k|\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for some complex numbers &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; and orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt;. It is easy to see that &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;'s eigenvalues and &lt;span class=&quot;math-container&quot;&gt;$|\psi_k\rangle$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;'s eigenvectors associated with the respective eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt;. Nielsen &amp;amp; Chuang introduces normal operators on page 70 and proves the above theorem in box 2.2 on page 72.&lt;/p&gt;&#xA;&lt;p&gt;All Hermitian and unitary operators are normal. Moreover, it is easy to check that the eigenvalues of a Hermitian operator are real. If in addition the operator is positive (i.e. positive semi-definite) then its eigenvalues are non-negative real numbers.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, the operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; in equation &lt;span class=&quot;math-container&quot;&gt;$(2.172)$&lt;/span&gt; is easily seen to be positive (and therefore Hermitian by definition). Thus, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is normal and can be written as in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. Moreover, since &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is positive then &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; are non-negative real numbers.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-10T17:49:02.590" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16449" PostTypeId="1" AcceptedAnswerId="16453" CreationDate="2021-03-10T20:48:26.043" Score="3" ViewCount="77" Body="&lt;p&gt;I noticed there's a &lt;code&gt;Quaternion&lt;/code&gt; class in qiskit docs (&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Quaternion.html#qiskit.quantum_info.Quaternion&quot; rel=&quot;nofollow noreferrer&quot;&gt;Here&lt;/a&gt;). I've seen there're a couple of methods such as &lt;code&gt;norm&lt;/code&gt; and &lt;code&gt;normalize&lt;/code&gt;, but I'm not quite familiar with this class and wondering how can I generate a random quaternion and use those methods available in qiskit? Also, can we use quaternions to solve the practical problems in quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="9006" LastEditDate="2021-03-11T08:59:03.660" LastActivityDate="2021-03-11T08:59:03.660" Title="How can I generate a quaternion using Qiskit?" Tags="&lt;qiskit&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16450" PostTypeId="2" ParentId="16353" CreationDate="2021-03-10T22:20:28.683" Score="0" Body="&lt;p&gt;Another thing that you can do to prepare your state into a mixed state is to simply measure your pure state.&lt;/p&gt;&#xA;&lt;p&gt;Either it will be in &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_2$&lt;/span&gt; with 50/50 probability, which (after collapse) will not have any &amp;quot;special quantum weirdness&amp;quot; which would be observed via interference and can only be described with mixed states (classical probability).&lt;/p&gt;&#xA;" OwnerUserId="2660" LastActivityDate="2021-03-10T22:20:28.683" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16451" PostTypeId="2" ParentId="16394" CreationDate="2021-03-10T23:12:30.813" Score="4" Body="&lt;p&gt;I do not know what the state-of-the-art for this problem is, but here is my attempt at it.&lt;/p&gt;&#xA;&lt;p&gt;First, I doubt whether the required unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be found for every matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. The most glaring issue occurs when &lt;span class=&quot;math-container&quot;&gt;$b\in\ker A$&lt;/span&gt;. In this case, &lt;span class=&quot;math-container&quot;&gt;$|Ab\rangle$&lt;/span&gt; is ill-defined, so it is not clear what &lt;span class=&quot;math-container&quot;&gt;$U|b\rangle$&lt;/span&gt; should be approximately equal to. A slightly more subtle issue concerns the preservation of the inner product. Consider for example &lt;span class=&quot;math-container&quot;&gt;$A=\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 2\end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_1=(1, 0)^T$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_2=(1, 1)^T$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$|b_1\rangle = |0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|b_2\rangle = |+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|Ab_1\rangle = |0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|Ab_2\rangle = (|0\rangle + 2|1\rangle)/\sqrt{5}$&lt;/span&gt;. However, for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle b_1|U^\dagger U|b_2\rangle = \langle b_1|b_2\rangle = \frac{1}{\sqrt{2}}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is hard to regard as approximately equal to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle Ab_1|Ab_2\rangle = \frac{1}{\sqrt{5}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Such issues may be resolved by using the context in which the problem arises to place additional restrictions on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. Alternatively, we can widen the search for the required transformation beyond the unitary operations. The latter is what we do below.&lt;/p&gt;&#xA;&lt;h2&gt;Matrix multiplication by teleportation with post-selection&lt;/h2&gt;&#xA;&lt;p&gt;We prepare the state &lt;span class=&quot;math-container&quot;&gt;$|Ab\rangle$&lt;/span&gt; by teleporting the state &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; through the state &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt; and post-selecting on a measurement outcome.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we have three subsystems &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; each with Hilbert space of dimension &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. First, prepare the subsystem &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$|b\rangle=\frac{1}{\|b\|}\sum_{k=0}^{n-1}|k\rangle_K$&lt;/span&gt; and the subsystems &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; in the joint state &lt;span class=&quot;math-container&quot;&gt;$|A\rangle=\frac{1}{\|A\|_F}\sum_{m,l=0}^{n-1}a_{ml}|l\rangle_L|m\rangle_M$&lt;/span&gt;. Now, measure subsystems &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; in the Fourier basis&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi_{u,v}\rangle_{KL} = \frac{1}{\sqrt{n}} (X^u Z^v \otimes I) \sum_{j=0}^{n-1} |j\rangle_K|j\rangle_L\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; are the generalization of the Pauli operators to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-dimensional Hilbert space known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Construction:_The_clock_and_shift_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;shift and clock matrices&lt;/a&gt; and given by &lt;span class=&quot;math-container&quot;&gt;$X|j\rangle = |j + 1 \mod n\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z|j\rangle = e^{\frac{2\pi ij}{n}}|j\rangle$&lt;/span&gt;. See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/4993/10480&quot;&gt;this answer&lt;/a&gt; for a good description of qudit teleportation.&lt;/p&gt;&#xA;&lt;p&gt;Each possible measurement outcome is described by a pair of numbers &lt;span class=&quot;math-container&quot;&gt;$u, v \in \{0, 1, \dots, n-1\}$&lt;/span&gt;. Suppose that the measurement outcome is &lt;span class=&quot;math-container&quot;&gt;$u=0, v=0$&lt;/span&gt;. Then the subsystem &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is in the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;_{KL}\langle\Psi_{0,0}|b\rangle_K|A\rangle_{LM} &amp;amp;=\left(\frac{1}{\sqrt{n}}\sum_{k=0}^{n-1}{}_K\langle k| {}_L\langle k|\right) |b\rangle_K|A\rangle_{LM}\\&#xA;&amp;amp;=\frac{1}{\sqrt{n}}\sum_{k=0}^{n-1}{}_K\langle k|b\rangle_K\, {}_L\langle k|A\rangle_{LM} \\&#xA;&amp;amp;=\frac{1}{\sqrt{n}}\sum_{k=0}^{n-1}\frac{b_k}{\|b\|} \sum_{l=0}^{n-1} \frac{a_{lk}}{\|A\|_F}|l\rangle_M \\&#xA;&amp;amp;=\frac{1}{\sqrt{n}\|b\|\|A\|_F}\sum_{l=0}^{n-1} \sum_{k=0}^{n-1}a_{lk}b_k|l\rangle_M \\&#xA;&amp;amp;=\frac{1}{\sqrt{n}\|b\|\|A\|_F}\sum_{l=0}^{n-1} (Ab)_l|l\rangle_M \\&#xA;&amp;amp;=\frac{\|Ab\|}{\sqrt{n}\|b\|\|A\|_F}|Ab\rangle_M&#xA;\end{align}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which after normalization becomes &lt;span class=&quot;math-container&quot;&gt;$|Ab\rangle$&lt;/span&gt; as promised. For other measurement outcomes the subsystem &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is not in the state &lt;span class=&quot;math-container&quot;&gt;$|Ab\rangle$&lt;/span&gt; due to the operators &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;. In some applications it may be possible to boost success probability by applying a correction based on the measurement outcome &lt;span class=&quot;math-container&quot;&gt;$u, v$&lt;/span&gt; to obtain &lt;span class=&quot;math-container&quot;&gt;$|Ab\rangle$&lt;/span&gt;. However, this part of the protocol depends on properties of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;It is interesting to consider what happens in certain special cases. For example, consider the situation where &lt;span class=&quot;math-container&quot;&gt;$b \in \ker A$&lt;/span&gt;. In this case, the state &lt;span class=&quot;math-container&quot;&gt;$|Ab\rangle$&lt;/span&gt; is ill-defined and from &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; we see that the probability of obtaining the required &lt;span class=&quot;math-container&quot;&gt;$u=0,v=0$&lt;/span&gt; measurement outcome is zero.&lt;/p&gt;&#xA;&lt;p&gt;Another interesting case occurs when &lt;span class=&quot;math-container&quot;&gt;$A=aa^T$&lt;/span&gt; is a rank one matrix and &lt;span class=&quot;math-container&quot;&gt;$a^Tb\ne 0$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$|A\rangle_{LM}=|a\rangle_L|a\rangle_M$&lt;/span&gt; is a product state and nothing can be teleported through it. However in this case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|aa^Tb\rangle = \frac{1}{\|aa^Tb\|}\sum_{k=0}^{n-1} a_k a^Tb |k\rangle&#xA;= \frac{a^Tb}{|a^Tb|}|a\rangle \equiv |a\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the initial state is the appropriate output state up to the unobservable global phase.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-11T07:23:01.873" LastActivityDate="2021-03-11T07:23:01.873" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16452" PostTypeId="1" AcceptedAnswerId="16454" CreationDate="2021-03-11T01:13:41.710" Score="1" ViewCount="77" Body="&lt;p&gt;Can't find any info on Stinespring dilation so I thought I could post here. If I have a qubit complete positive map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;, that maps all inputs to the output &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Lambda(\rho)=|0\rangle\langle0|$&lt;/span&gt; how can I derive a Stinespring dilation for &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; and the corresponding Kraus operators?&lt;/p&gt;&#xA;" OwnerDisplayName="user14766" LastEditorUserId="55" LastEditDate="2021-03-11T11:55:58.027" LastActivityDate="2021-03-11T11:55:58.027" Title="How do I derive Stinespring and Kraus representations of a map such that $\Lambda(\rho)=|0\rangle\langle0|$ for all $\rho$?" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16453" PostTypeId="2" ParentId="16449" CreationDate="2021-03-11T01:42:27.590" Score="2" Body="&lt;p&gt;Quaternion algebra is at the heart of quantum computing, but it's almost never referred to by that name.  In quantum computing quaternions show up as two-dimensional unitary matrices, which are single-qubit operations.&lt;/p&gt;&#xA;&lt;p&gt;There's an isomorphism between unit quaternions &lt;span class=&quot;math-container&quot;&gt;$(\vert q \vert=1)$&lt;/span&gt; and elements of the Lie group &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;.  Similarly, there's an isomorphism between pure quaternions &lt;span class=&quot;math-container&quot;&gt;$(\text{Re}(q)=0)$&lt;/span&gt; and elements of the Lie algebra &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{su}(2)$&lt;/span&gt;.  (This is the well known isomorphism of Lie algebras &lt;span class=&quot;math-container&quot;&gt;$\mathfrak{sp}(1)\cong\mathfrak{su}(2)$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; consists of all &lt;span class=&quot;math-container&quot;&gt;$U(2)$&lt;/span&gt; operations that have trivial global phase (i.e. determinant equal to 1).  Since qubit operations differing by global phase are physically indistinguishable, &lt;span class=&quot;math-container&quot;&gt;$SU(2)\cong SP(1) = \lbrace \text{unit quaternions} \rbrace$&lt;/span&gt; contains a single copy of every possible single-qubit operation.&lt;/p&gt;&#xA;&lt;p&gt;The correspondence can be seen by comparing the conventional orthonormal basis in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{H}^1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lbrace 1,i,j,k \rbrace$&lt;/span&gt;, to the the Pauli matrices &lt;span class=&quot;math-container&quot;&gt;$\lbrace X,Y,Z \rbrace$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;1 \cong I_2=\begin{bmatrix} 1 &amp;amp;0 \\ 0 &amp;amp;1 \end{bmatrix} &amp;amp;&amp;amp; i\cong iX=\begin{bmatrix} 0 &amp;amp; i \\ i &amp;amp; 0  \end{bmatrix} \\ &#xA;j \cong -iY =\begin{bmatrix} 0 &amp;amp;-1 \\ 1 &amp;amp;0 \end{bmatrix} &amp;amp;&amp;amp; k \cong iZ=\begin{bmatrix} i &amp;amp;0 \\ 0 &amp;amp;-i \end{bmatrix}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It's easy to see that commutation (adjoint action), multiplication (group action), and exponential maps are identical whether one chooses the language of quaternions or Pauli matrices.  But the choice is always Pauli matrices in quantum computing references.  Presumably this is because physicists and computer scientists are generally more comfortable with matrices than non-commutative division algebras.&lt;/p&gt;&#xA;&lt;p&gt;In answer to the question, I would strongly recommend getting comfortable working with the matrix representation of quaternions (i.e. as elements of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;).  This will make it much easier for you to work with standard programs and references in the space where matrix algebra reigns supreme.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2021-03-11T01:59:23.463" LastActivityDate="2021-03-11T01:59:23.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16454" PostTypeId="2" ParentId="16452" CreationDate="2021-03-11T04:28:07.130" Score="6" Body="&lt;p&gt;Stinespring dilation can be thought of as a way of representing an arbitrary completely positive trace preserving map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; on a system &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; as a composition of two simpler maps: a unitary evolution &lt;span class=&quot;math-container&quot;&gt;$U_{AE}$&lt;/span&gt; in a Hilbert space obtained by adjoining an auxiliary system &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; followed the partial trace over &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Lambda(\rho_A) = \mathrm{tr}_E\left(U_{AE} (\rho_A \otimes |0\rangle_E\langle 0|) U_{AE}^\dagger\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the environment is initially in a pure state, for example &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Thus, in order for &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; to return &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_A\langle 0|$&lt;/span&gt; we need &lt;span class=&quot;math-container&quot;&gt;$U_{AE}$&lt;/span&gt; to swap the states of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{AE} = \text{SWAP}_{AE} = \sum_{ij} |i_A\rangle|j_E\rangle\langle j_A|\langle i_E|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us try it&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\Lambda(\rho_A) &amp;amp;= \mathrm{tr}_E\left(\sum_{iji'j'} |i_A\rangle|j_E\rangle\langle j_A|\langle i_E| \left(\rho_A \otimes |0_E\rangle\langle 0_E|\right)|i'_A\rangle|j'_E\rangle\langle j'_A|\langle i'_E|\right) \\&#xA;&amp;amp;= \mathrm{tr}_E\left(\sum_{iji'j'} |i_A\rangle\langle j_A|\rho_A|i'_A\rangle \langle j'_A| \otimes|j_E\rangle\langle i_E|0_E\rangle\langle 0_E|j'_E\rangle\langle i'_E|\right) \\&#xA;&amp;amp;= \mathrm{tr}_E\left(\sum_{ji'} |0_A\rangle\langle j_A|\rho_A|i'_A\rangle \langle 0_A| \otimes|j_E\rangle\langle i'_E|\right) \\&#xA;&amp;amp;= \sum_{ji'} |0_A\rangle\langle j_A|\rho_A|i'_A\rangle \langle 0_A| \, \langle i'_E|j_E\rangle \\&#xA;&amp;amp;= \sum_j |0_A\rangle\langle j_A|\rho_A|j_A\rangle \langle 0_A| \\&#xA;&amp;amp;= |0_A\rangle\langle 0_A| \, \mathrm{tr}\rho_A \\&#xA;&amp;amp;= |0_A\rangle\langle 0_A|.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Having found &lt;span class=&quot;math-container&quot;&gt;$U_{AE}$&lt;/span&gt;, we can compute Kraus operators from the relation &lt;span class=&quot;math-container&quot;&gt;$E_k = \langle k_E|U_{AE}|0_E\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;E_k &amp;amp;= \langle k_E|U_{AE}|0_E\rangle \\&#xA;&amp;amp;= \langle k_E| \left(\sum_{ij} |i_A\rangle|j_E\rangle\langle j_A|\langle i_E|\right)|0_E\rangle \\&#xA;&amp;amp;= \sum_{ij} |i_A\rangle|\langle j_A|\langle k_E|j_E\rangle\langle i_E|0\rangle \\&#xA;&amp;amp;= |0_A\rangle|\langle k_A|&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and since we are working with qubits&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;E_0 = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{pmatrix} \quad&#xA;E_1 = \begin{pmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Incidentally, the Kraus operators above look like those for the &lt;a href=&quot;https://en.wikipedia.org/wiki/Amplitude_damping_channel&quot; rel=&quot;noreferrer&quot;&gt;amplitude damping channel&lt;/a&gt; with decay probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; which with hindsight was to be expected.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-11T04:28:07.130" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16455" PostTypeId="1" AcceptedAnswerId="16457" CreationDate="2021-03-11T07:45:56.897" Score="3" ViewCount="29" Body="&lt;p&gt;Is there any formalism to perform quantum gates between two qubits (let's say in a superconducting quantum network) to perform a quantum gate between two qubits which are not directly coupled? I want to ask the same question for any known physical model of quantum computing. Another way of saying is that, if it is possible to indirectly couple two qubits via some unitary transformations on the Hamiltonian of a system?&#xA;One example could be to ask if in a linear chain of three qubits &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;, is it possible to do a &lt;strong&gt;SWAP&lt;/strong&gt; gate between &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; not directly involving &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, meaning &lt;em&gt;without&lt;/em&gt; first swapping with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. I am not asking in the sense of quantum circuit where the answer could be possibly a 'no'. I am asking more from a Hamiltonian point of view.&lt;/p&gt;&#xA;" OwnerUserId="4889" LastActivityDate="2021-03-11T10:04:30.827" Title="Distant quantum gates between uncoupled qubits" Tags="&lt;quantum-gate&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16456" PostTypeId="1" CreationDate="2021-03-11T09:11:00.990" Score="0" ViewCount="63" Body="&lt;p&gt;I need to understand the frontier and practical applications of quantum computing.&lt;br /&gt;&#xA;Is it possible to design a Quantum Computing Advantage to deploy an application on the web, such as a browser, modeling molecules, bot writing code, and other very specific applications?&#xA;can a quantum computer work with the internet/web of today ?&lt;/p&gt;&#xA;" OwnerUserId="15163" LastEditorUserId="55" LastEditDate="2021-03-11T11:42:54.310" LastActivityDate="2021-03-12T15:20:49.997" Title="Is it possible to design a Quantum Computing Advantage to deploy an application on the web?" Tags="&lt;physical-realization&gt;&lt;quantum-advantage&gt;&lt;applications&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16457" PostTypeId="2" ParentId="16455" CreationDate="2021-03-11T09:34:05.303" Score="2" Body="&lt;p&gt;This depends on exactly what your criteria are. Let me give the easiest solution to your 3-qubit case: apply the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=(X_1Y_2-X_1Y_2)+(X_2Y_3-X_2Y_3)&#xA;$$&lt;/span&gt;&#xA;for a time &lt;span class=&quot;math-container&quot;&gt;$\pi/(2\sqrt{2})$&lt;/span&gt;. Apart from an extra &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; phase on the &lt;span class=&quot;math-container&quot;&gt;$|010\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt; terms (in essence, a controlled-phase between each pair of qubits), this does exactly what you want. It might be possible, in this 3-qubit case, to avoid some of those phases with a slightly different Hamiltonian, I'd have to experiment a bit.&lt;/p&gt;&#xA;&lt;p&gt;This is essentially the content of a paper by &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0212041&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bose&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Of course, you impose in your question that B would not be involved, while in this, during the time evolution, the state of B does leave the B qubit even though it comes back later. This is always going to be a feature of such solutions, so I assume you're going to allow it.&lt;/p&gt;&#xA;&lt;p&gt;If you want to do the transfer over greater distances, this is basically the study of &amp;quot;perfect state transfer&amp;quot; (full disclosure: this is very much my area of research). The transfer over greater distances doesn't, as a general rule, leave the intermediate qubits unmoved (but you can easily think of doing two swap pulses: one for all N qubits on a line, and one for all &lt;span class=&quot;math-container&quot;&gt;$N-2$&lt;/span&gt; qubits in the middle to move them back to where they started). One advantage of this method compared to doing a whole bunch of swap gates in the gate model is that you can achieve the transformation in about half the time. A second advantage is that there's effectively a controlled-phase gate automatically built in to this sort of interaction. You may want to check out these papers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0309131&quot; rel=&quot;nofollow noreferrer&quot;&gt;perfect state transfer&lt;/a&gt; in single excitation subspace only, but long distance&lt;/li&gt;&#xA;&lt;li&gt;consideration of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405029v2&quot; rel=&quot;nofollow noreferrer&quot;&gt;higher excitation subspaces&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://arxiv.org/abs/0903.4274&quot; rel=&quot;nofollow noreferrer&quot;&gt;My review paper&lt;/a&gt; (shameless plug)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Note that you might get annoyed by all the many controlled-phase gates that go on during the swapping process. If you undo the swap, it undoes all of them, so it's not so bad in that sense. However, you also have the option of encoding. If you encode a qubit as &lt;span class=&quot;math-container&quot;&gt;$(\alpha|00\rangle+\beta|11\rangle)$&lt;/span&gt;, that defeats all those controlled-phase gates.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-03-11T10:04:30.827" LastActivityDate="2021-03-11T10:04:30.827" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16458" PostTypeId="1" AcceptedAnswerId="16459" CreationDate="2021-03-11T10:15:07.883" Score="4" ViewCount="79" Body="&lt;p&gt;From chapter 3.3 or the Qiskit Textbook, I'm trying to follow the worked example of the quantum solution for Bernstein-Vazirani.&lt;/p&gt;&#xA;&lt;p&gt;I'm having trouble with what I think should be a trivial bit of classical computation - specifically, the bitwise product &lt;span class=&quot;math-container&quot;&gt;$s\cdot x$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the problem description, the black-box function takes the form: &lt;span class=&quot;math-container&quot;&gt;$$f(x)=s \cdot x \mod2$$&lt;/span&gt;&#xA;Given the example and separate videos, I &lt;em&gt;think&lt;/em&gt; what this is doing is a logical AND between every bit in the string &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and the input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, then calculating &lt;span class=&quot;math-container&quot;&gt;$\mod2$&lt;/span&gt; of the result to populate the single output.  This would make sense as it would mean the classical solution would require you to run the function with each input bit set in turn to determine the value of &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Where I'm struggling is the subsequent worked example, where we have the string &lt;span class=&quot;math-container&quot;&gt;$s=11$&lt;/span&gt; and the quantum oracle output is being defined as:&lt;span class=&quot;math-container&quot;&gt;$$|\upsilon _{2} \rangle=\frac{1}{2}((-1)^{00\cdot11}|00\rangle+(-1)^{01\cdot11}|01\rangle+(-1)^{10\cdot11}|10\rangle+(-1)^{11\cdot11}|11\rangle)$$&lt;/span&gt;&#xA;I'm fine with, this, but then it simplifies to:&lt;span class=&quot;math-container&quot;&gt;$$|\upsilon_2\rangle=\frac{1}{2}(|00\rangle-|01|\rangle-|10\rangle+|11\rangle)$$&lt;/span&gt;&#xA;My problem with this is the signs preceding each state.  As &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; are negative and the rest are positive, that means that the exponents &lt;span class=&quot;math-container&quot;&gt;$(00\cdot11)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(11\cdot11)$&lt;/span&gt; are even values (or 0), while &lt;span class=&quot;math-container&quot;&gt;$(01\cdot11)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(10\cdot11)$&lt;/span&gt; are odd.&lt;/p&gt;&#xA;&lt;p&gt;I can't see any way that this happens.  If I apply the logical AND described above, I get: &lt;span class=&quot;math-container&quot;&gt;$$00\cdot11=00=0$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$01\cdot11=01=1$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\color{red}{10\cdot11=10=2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\color{red}{11\cdot11=11=3}$$&lt;/span&gt;&#xA;These last two would give me the wrong signs.  I've also tried multiplication of the equivalent decimal values, but that doesn't work either.&#xA;What's the correct mechanism for calculating &lt;span class=&quot;math-container&quot;&gt;$nn\cdot nn$&lt;/span&gt; in this equation?&lt;/p&gt;&#xA;" OwnerUserId="14827" LastActivityDate="2021-03-12T09:31:55.290" Title="Worked example of Bernstein-Vazirani - understanding bitwise product" Tags="&lt;textbook-and-exercises&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16459" PostTypeId="2" ParentId="16458" CreationDate="2021-03-11T11:19:55.497" Score="4" Body="&lt;p&gt;Usually, when you have two bitstrings &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; of size &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, the product &lt;span class=&quot;math-container&quot;&gt;$i.j$&lt;/span&gt; corresponds to &lt;span class=&quot;math-container&quot;&gt;$i.j = \sum\limits_{k = 1}^{n}i_kj_k$&lt;/span&gt;, so here you have the following results :&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*} &amp;amp; 00.11 = 0\times 1 + 0\times1 = 0 \\ &#xA;&amp;amp; 01.11 = 0\times 1 + 1\times1 = 1 \\ &#xA;&amp;amp; 10.11 = 1\times 1 + 0\times1 = 1 \\ &#xA;&amp;amp; 11.11 = 1\times 1 + 1\times1 = 2 = 0 \mod 2 \end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-03-11T11:19:55.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16461" PostTypeId="2" ParentId="16452" CreationDate="2021-03-11T11:55:43.233" Score="3" Body="&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Stinespring)&lt;/strong&gt;&lt;/em&gt; Given a basis &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}$&lt;/span&gt; for the input space, you want an isometry &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$V |u_k\rangle=|0\rangle\otimes |u_k\rangle$&lt;/span&gt; for some orthonormal set &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}$&lt;/span&gt;. Then you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}_2\Big(V|u_k\rangle\!\langle u_k|V^\dagger\Big) = |0\rangle\!\langle0|,$$&lt;/span&gt;&#xA;and thus the same hold for any pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (because you can decompose in terms of &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}_k$&lt;/span&gt;), and thus for any input state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;More generally, you don't need input and output bases to be the same, so any isometry of the form &lt;span class=&quot;math-container&quot;&gt;$V|u_k\rangle=|0\rangle\otimes|v_k\rangle$&lt;/span&gt; for arbitrary bases &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}_k,\{|v_k\rangle\}_k$&lt;/span&gt; for the respective bases will work the same. This is the most general form of such an isometry though. To see this you can notice that &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; must be such that &lt;span class=&quot;math-container&quot;&gt;$V|\psi\rangle$&lt;/span&gt; is a product state for all &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Kraus)&lt;/strong&gt;&lt;/em&gt; Denote with &lt;span class=&quot;math-container&quot;&gt;$A_a$&lt;/span&gt; the Kraus operators. These are related to the Stinespring isometry by &lt;span class=&quot;math-container&quot;&gt;$A_a=(I\otimes \langle a|)V$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$A_a=|0\rangle\!\langle a|$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-11T11:55:43.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16462" PostTypeId="2" ParentId="6176" CreationDate="2021-03-11T15:38:16.440" Score="0" Body="&lt;p&gt;Looking back at this, there was no need to pass through the spectral decomposition of &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; to conclude that &lt;span class=&quot;math-container&quot;&gt;$A|\psi\rangle$&lt;/span&gt; is a state. If &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is an isometry, then &lt;span class=&quot;math-container&quot;&gt;$A|\psi\rangle$&lt;/span&gt; is automatically a state for any &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Another way to put it is to observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|A|\psi\rangle\|^2= \sum_a \langle \psi|\sqrt{\mu(a)}\sqrt{\mu(a)}|\psi\rangle=\langle\psi|\psi\rangle=1.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-11T15:38:16.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16463" PostTypeId="1" AcceptedAnswerId="16465" CreationDate="2021-03-11T19:34:28.010" Score="3" ViewCount="96" Body="&lt;p&gt;How to express Fermionic occupation operator &lt;span class=&quot;math-container&quot;&gt;$(\hat{a}_j^\dagger\hat{a}_j)$&lt;/span&gt; and nearest neighbor Fermionic hopping interaction (&lt;span class=&quot;math-container&quot;&gt;$H_h= J\sum_{i=1}\hat{a}_i^\dagger \hat{a}_{i+1}+\hat{a}_{i+1}^\dagger \hat{a}_{i})$&lt;/span&gt; as a qubit operators.&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-03-11T22:46:54.253" LastActivityDate="2021-03-13T00:16:15.977" Title="Fermionic occupation operator and nearest neighbor Fermionic hopping interaction as a qubit operator" Tags="&lt;hamiltonian-simulation&gt;&lt;chemistry&gt;&lt;solid-state&gt;" AnswerCount="2" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16464" PostTypeId="2" ParentId="16434" CreationDate="2021-03-11T20:37:53.140" Score="5" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;IonQ is claiming to have a potential application in machine learning by 2023. What applications could they have in mind?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h1&gt;None.&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The plot you showed has no units on the y-axis. It doesn't even have numbers.&lt;/li&gt;&#xA;&lt;li&gt;The choice of 2023, 2025, and 2027 for &amp;quot;inflection points&amp;quot; (which they didn't define, and based on their graph has nothing to do with the standard calculus definition of the term) was &lt;em&gt;arbitrary.&lt;/em&gt;&lt;/li&gt;&#xA;&lt;li&gt;The choice of topics listed (Machine Learning, Materials, Chemistry) is arbitrary, and the order is even more arbitrary. In fact it would make more sense to switch chemistry and materials, since materials involve far more atoms than molecules, and are often significantly harder to model using the techniques for which quantum computers provide an advantage (QCs are very unlikely to speed up DFT, but could possibly speed up FCI, but FCI for materials is objectively orders of magnitude harder than molecules).&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;This last point is funny: they predicted &amp;quot;faster optimization&amp;quot; in 2025, but &amp;quot;better optimization&amp;quot; will have to wait until 2027 (just hilarious!).&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you are just wondering what applications of machine learning are &lt;em&gt;possible&lt;/em&gt; in the future, please see this question: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1208/2293&quot;&gt;Is there any potential application of quantum computers in machine learning or AI?&lt;/a&gt;. &lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you are wondering what applications IonQ has in mind for the year 2023, the answer is &lt;em&gt;&lt;strong&gt;most certainly zero.&lt;/strong&gt;&lt;/em&gt; I wish I could also underline &amp;quot;most certainly zero&amp;quot; to put more emphasis on it. Let me say it again: quantum computing will not be outperforming classical computers for any machine learning applications in 2023.&lt;/p&gt;&#xA;&lt;p&gt;You may also find useful &lt;a href=&quot;https://mattermodeling.stackexchange.com/a/425/5&quot;&gt;a similar answer about applications of quantum computes in drug design&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-12T03:50:03.603" LastActivityDate="2021-03-12T03:50:03.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16465" PostTypeId="2" ParentId="16463" CreationDate="2021-03-11T20:47:45.953" Score="3" Body="&lt;ul&gt;&#xA;&lt;li&gt;The oldest and most commonly known way is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Jordan%E2%80%93Wigner_transformation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jordan-Wigner transformation&lt;/a&gt;. The qubit operators will be &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(N)$&lt;/span&gt;-local for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; occupiable orbitals.&lt;/li&gt;&#xA;&lt;li&gt;A significantly more complicated way is the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403025&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bravyi-Kitaev transformation&lt;/a&gt; for which the qubit operators will be &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log N)$&lt;/span&gt;-local.&lt;/li&gt;&#xA;&lt;li&gt;There's many other ways, but the above two are by far the most important to know in the early stages of your project.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can simply transform creation and annihilation operators into &amp;quot;occupied&amp;quot; and &amp;quot;unoccupied&amp;quot; operators:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VHVrH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VHVrH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But you have to also make sure the wavefunction satisfies the anti-symmetric property for fermions, so you have to add &lt;em&gt;strings&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators to count the number -1's (this is the Jordan-Wigner transformation which is &lt;span class=&quot;math-container&quot;&gt;$n-local$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rDLdC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rDLdC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The occupation operator in the first part of your question is simply:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SyxKa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SyxKa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;To get the other operators in your question, you can just substitute the &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a^\dagger_j$&lt;/span&gt; expression from above.&lt;/p&gt;&#xA;&lt;p&gt;I used this &lt;a href=&quot;https://docs.microsoft.com/en-us/azure/quantum/user-guide/libraries/chemistry/concepts/jordan-wigner&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt; to get the equations.&lt;/p&gt;&#xA;&lt;p&gt;Note that if your Hamiltonian has only nearest-neighbor couplings, then the issue of the JW transformation being &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-local can be mitigated due to cancellation when multiplying (for example) &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$a_{j+1}^\dagger$&lt;/span&gt;, as noted in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16463/fermionic-occupation-operator-and-nearest-neighbor-fermionic-hopping-interaction/16465?noredirect=1#comment23090_16465&quot;&gt;Norbert Schuch's comment here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-13T00:16:15.977" LastActivityDate="2021-03-13T00:16:15.977" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="16468" PostTypeId="2" ParentId="16200" CreationDate="2021-03-12T07:03:33.893" Score="0" Body="&lt;p&gt;If you look at the &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/visualization/state_visualization.html#plot_bloch_multivector&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code for plot_bloch_multivector()&lt;/a&gt;, the reverse conversion (spherical to cartesian coordinates) appears to be coded but not as a separate function. Therefore (to the best of my knowledge) it apears that the kind of methods that you mention are not available in qiskit currently (or at least they are not well-documented). I believe you can go ahead and raise an issue (potentially an enhancement request) &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, as it could be a useful addition.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastActivityDate="2021-03-12T07:03:33.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16469" PostTypeId="2" ParentId="16064" CreationDate="2021-03-12T07:13:07.773" Score="1" Body="&lt;p&gt;The method of creating  a quantum adder circuit is similar to how a half or full adder circuit is designed in elementary digital electronics. These circuits add numbers in the binary representation.&lt;/p&gt;&#xA;&lt;p&gt;For example, for the half adder, there are 2 bits to be added (A and B). These are taken to be the inputs. The output has 2 bits - a sum bit (S)which is the least significant bit of the output and a carry bit (C) which is the MSB. For example, if the inputs to be added are 1 and 1, the result would be carry=1 and sum=0.&lt;/p&gt;&#xA;&lt;p&gt;To figure out the logic for the adder, write the truth table for the operation:&lt;/p&gt;&#xA;&lt;p&gt;A  B    C  S&lt;/p&gt;&#xA;&lt;p&gt;0  0     0  0&lt;/p&gt;&#xA;&lt;p&gt;0  1     0  1&lt;/p&gt;&#xA;&lt;p&gt;1  0     0  1&lt;/p&gt;&#xA;&lt;p&gt;1  1     1  0&lt;/p&gt;&#xA;&lt;p&gt;For the quantum half adder, take 1 qubit each to represent A,B,C and S respectively. A and B are initialized to the input bits that you wish to add. (For example if you want to add 1 and 0, initialize A = |1&amp;gt; and B=|0&amp;gt;).&lt;/p&gt;&#xA;&lt;p&gt;Now we need to determine the quantum gates which can take A and B as inputs and give C and S as the outputs - this is like boolean logic minimization. Look at bit C in the truth table - it is 1 only when both A and B are 1. So, C can be obtained by a CCNOT operation using A and B as inputs and C as target. Also, S is a classical XOR operation - this can be achieved by 2 successive CNOTs, both havong S as target and one with A as control and other with B as control.&lt;/p&gt;&#xA;&lt;p&gt;Keep in mind that the advantage of a quantum adder could be to add several possible input combinations in one go by creating superpostion states in A and B.&lt;/p&gt;&#xA;&lt;p&gt;You may refer to &lt;a href=&quot;https://www.quantum-inspire.com/kbase/full-adder/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this example present in the knowldege base of the Quantum Inspire platform by TU Delft &lt;/a&gt; for quantum circuits for adders. The qiskit textbook also has an example of how to implement a quantum adder &lt;a href=&quot;https://qiskit.org/textbook/ch-states/atoms-computation.html#adder&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. It explaines how to apply the appropriate quantum gates, and it should be possible to follow this approach to implement the circuit of your choice.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastEditorUserId="13461" LastEditDate="2021-03-12T13:29:53.120" LastActivityDate="2021-03-12T13:29:53.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16470" PostTypeId="2" ParentId="16025" CreationDate="2021-03-12T08:01:22.867" Score="1" Body="&lt;p&gt;I believe your question is about the phase estimation algorithm. The controlled U-gate in the case of phase estimation algorithm is formed from some unitary operator U. The phase estimation algorithm assumes that you know the unitary U beforehand, and you want to estimate the phase of a particular eigenvalue of U. Also, in this algorithm, you supply an eigenvector of U in |&lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;&amp;gt;,  and you select this eigenvector of U in a way that it corresponds to the eigenvalue of U whose phase you desire to estimate. So, in general, U in your equation results in a pure phase operation only when |&lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;&amp;gt; is an eigenvector of U. So, in general, U|&lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;&amp;gt; = &lt;span class=&quot;math-container&quot;&gt;$e^{2 \pi i y}$&lt;/span&gt;|&lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;&amp;gt; is  ot true for every |&lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;&amp;gt;.&lt;/p&gt;&#xA;&lt;p&gt;Regarding how to construct U - that may be motivated by a particular physical situation. For example, quantum algorithms for molecular simulation and energy level calculations use the phase estimation algorithm, so U would be derived from the molecule. See this &lt;a href=&quot;https://github.com/microsoft/Quantum/tree/main/samples/chemistry/MolecularHydrogen&quot; rel=&quot;nofollow noreferrer&quot;&gt;example in the quantum chemistry library of Q# for simulation of the hydrogen molecule using phase estimation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The qiskit textbook also gives a detailed example of how to implement the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;phase estimation algorithm in qiskit&lt;/a&gt;. You may find it helpful.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastEditorUserId="13461" LastEditDate="2021-03-12T13:35:33.397" LastActivityDate="2021-03-12T13:35:33.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16471" PostTypeId="1" CreationDate="2021-03-12T08:41:49.227" Score="0" ViewCount="20" Body="&lt;p&gt;RevLib is an online resource for benchmarks within the domain of reversible and quantum circuit design. It provides a database of functions with respective circuit realizations given in a appropriate format. Many paper uses RevLib to evaluate performance of the functions of RevLib. But I can't find how to use the quantum circuit in RevLib in python environment. I really want to know about this.&lt;/p&gt;&#xA;&lt;p&gt;Can you tell me how to use RevLib's quantum circuits in python environment(Especially I want to use it with pycharm)?&#xA;Is there a way that I can change the quantum circuit by changing only one line of python code?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastActivityDate="2021-03-12T08:41:49.227" Title="How to use 'RevLib' files in python?" Tags="&lt;programming&gt;&lt;quantum-circuit&gt;&lt;revlib&gt;&lt;python&gt;&lt;pycharm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16472" PostTypeId="1" AcceptedAnswerId="16474" CreationDate="2021-03-12T09:30:56.330" Score="3" ViewCount="32" Body="&lt;p&gt;The Renyi entropies are defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S_{\alpha}(\rho)=\frac{1}{1-\alpha} \log \operatorname{Tr}\left(\rho^{\alpha}\right), \alpha \in(0,1) \cup(1, \infty)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is claimed that this quantity is continuous i.e. for &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt; close in trace distance, &lt;span class=&quot;math-container&quot;&gt;$|S_{\alpha}(\rho) - S_{\alpha}(\sigma)|$&lt;/span&gt; can be bounded for &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;\alpha&amp;lt;1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\alpha &amp;gt;1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, it is also stated that the max and min entropies &lt;span class=&quot;math-container&quot;&gt;$\lim\limits_{\alpha\rightarrow 0}S_{\alpha}(\cdot) = S_{0}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lim\limits_{\alpha\rightarrow \infty}S_{\alpha}(\cdot) = S_{\infty}$&lt;/span&gt; are not continuous or not known to be continuous.&lt;/p&gt;&#xA;&lt;p&gt;The above statements are found in &lt;a href=&quot;http://www.scholarpedia.org/article/Quantum_entropies#Properties_of_quantum_entropy&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://www.scholarpedia.org/article/Quantum_entropies#Properties_of_quantum_entropy&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The proofs themselves are quite complicated but is there some intuition for why the proofs fail at the limits?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2021-03-12T16:15:33.850" LastActivityDate="2021-03-12T16:15:33.850" Title="Continuity of Renyi entropies - limiting cases" Tags="&lt;information-theory&gt;&lt;entropy&gt;&lt;max-entropy&gt;&lt;min-entropy&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16473" PostTypeId="2" ParentId="16458" CreationDate="2021-03-12T09:31:55.290" Score="3" Body="&lt;p&gt;I would add that function &lt;span class=&quot;math-container&quot;&gt;$f(x) = s \cdot x \mod 2$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; being &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bit strings can be rewriten as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x) = x_1 \times s_1 \oplus x_2 \times s_2 \oplus \dots \oplus x_n \times s_n,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\times$&lt;/span&gt; is logical AND between two bits &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is XOR function.&lt;/p&gt;&#xA;&lt;p&gt;So, for &lt;span class=&quot;math-container&quot;&gt;$s = 11$&lt;/span&gt; we have:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$11 \cdot 00 = 1 \times 0 \oplus 1 \times 0 = 0 \oplus 0 = 0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$11 \cdot 01 = 1 \times 0 \oplus 1 \times 1 = 0 \oplus 1 = 1$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$11 \cdot 10 = 1 \times 1 \oplus 1 \times 0 = 1 \oplus 0 = 1$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$11 \cdot 11 = 1 \times 1 \oplus 1 \times 1 = 1 \oplus 1 = 0$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-12T09:31:55.290" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16474" PostTypeId="2" ParentId="16472" CreationDate="2021-03-12T10:57:14.337" Score="3" Body="&lt;p&gt;Assuming everything is finite dimensional.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$S_0$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$S_0(\rho) = \log \mathrm{rank}(\rho).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It's pretty straightforward to see this is not continuous. Take &lt;span class=&quot;math-container&quot;&gt;$\rho_{\epsilon} = \epsilon |0\rangle \langle 0 | + (1-\epsilon) |1\rangle \langle 1 |$&lt;/span&gt;. Then for all &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; \epsilon &amp;lt; 1$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$S_0(\rho) = \log 2$&lt;/span&gt; but for &lt;span class=&quot;math-container&quot;&gt;$\epsilon \in \{0,1\}$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$S_0(\rho_\epsilon) = \log 1$&lt;/span&gt;. So for this family we see a discontinuity at &lt;span class=&quot;math-container&quot;&gt;$\epsilon \in \{0,1\}$&lt;/span&gt;. The lack of continuity here comes from the lack of continuity in the &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}$&lt;/span&gt; function.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$S_{\infty}$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S_{\infty}(\rho) = -\log\|\rho\|,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|$&lt;/span&gt; is the operator norm. But &lt;span class=&quot;math-container&quot;&gt;$\rho \to \|\rho\|$&lt;/span&gt; is a continuous function as norms are continuous. Hence, as &lt;span class=&quot;math-container&quot;&gt;$\log$&lt;/span&gt; is continuous on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}_+$&lt;/span&gt;, we also have &lt;span class=&quot;math-container&quot;&gt;$S_{\infty}$&lt;/span&gt; is continuous&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-12T10:57:14.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16475" PostTypeId="2" ParentId="16456" CreationDate="2021-03-12T15:20:49.997" Score="1" Body="&lt;p&gt;Quantum computing is not a tool to be used for general purpose computing. In general for most common computer programs quantum computing, even on a perfect machine, would provide little advantage over a CPU. In these programs there is no need to use quantum features such as entanglement. May be you could run programs more efficiently, but then it makes more sense to then just build custom circuits using an FPGA as an accelerator.&lt;/p&gt;&#xA;&lt;p&gt;The main advantages currently are in scientific modelling, more specifically for combinatorial optimisations, and simulations. This is because we can take advantage of quantum mechanical effects to help evaluate possibilities more efficiently than sampling on a CPU. However, as of today implementations are limited to noisy hardware, and the most reliable algorithms are usually hybrids, such as variational algorithms, where we use the QPU to encode the problem, whilst we still rely upon classical subroutines.&lt;/p&gt;&#xA;&lt;p&gt;So algorithms such as factoring or HHL, are still considering slightly out of reach of todays QPU, due to the current level of noise and limited qubits that makes it hard to produce reliable results for a purely quantum program.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastActivityDate="2021-03-12T15:20:49.997" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16476" PostTypeId="1" AcceptedAnswerId="16491" CreationDate="2021-03-12T15:26:24.163" Score="5" ViewCount="91" Body="&lt;p&gt;As far as I know, we can use barrier method in qiskit to split circuits into two sets to prevent the optimization. However, is there any physical meaning of the barrier? Like a delay operation or buffer gate? If we insert a barrier in the middle of the circuit, the second gate set will begin to be executed until the gates from the first set finishing their executions. What causes the waiting time for the second gate set?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastActivityDate="2021-03-13T21:49:35.810" Title="Is there a physical definition of barrier operation in qiskit?" Tags="&lt;quantum-gate&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16477" PostTypeId="1" AcceptedAnswerId="16479" CreationDate="2021-03-12T16:14:25.873" Score="1" ViewCount="74" Body="&lt;p&gt;In the thesis &amp;quot;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0512217.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient Simulation of Random Quantum States and Operators&lt;/a&gt;&amp;quot; on page 25 there is a portion of text explaining a method for quantum process tomography. It claims that states from an orthonormal basis for density matrices is easy to generate experimentally. This seems odd... since some of the matrices it includes in the basis are not hermitian...&lt;/p&gt;&#xA;&lt;p&gt;They define the basis as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B_{\sigma}=\{\sigma^{(i, j)}=|i\rangle\langle j|: 1 \leq i, j \leq d \}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but they probably actually meant&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B_{\sigma}=\{\sigma^{(i, j)}=|i\rangle\langle j|: 0 \leq i, j \leq d - 1 \}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;regardless, it generates matrices that aren't hermitian, and thus shouldn't be viable quantum states.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="14239" LastEditDate="2021-03-12T18:37:59.767" LastActivityDate="2021-03-12T19:34:43.673" Title="Can you perform quantum process tomography using an orthonormal basis the contains non Hermitian matrices?" Tags="&lt;quantum-operation&gt;&lt;quantum-process-tomography&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16478" PostTypeId="2" ParentId="16401" CreationDate="2021-03-12T16:25:30.217" Score="1" Body="&lt;p&gt;I'm not sure if that's ever used for controlled gates, but a non-controlled &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; can be generalized to qudits by a shift operator &lt;span class=&quot;math-container&quot;&gt;$X: |i\rangle \mapsto |(i+1)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2021-03-12T16:25:30.217" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16479" PostTypeId="2" ParentId="16477" CreationDate="2021-03-12T17:16:13.263" Score="2" Body="&lt;p&gt;Considering just the single qubit case, the four possible operators you list are&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|0\rangle\langle 0|,|0\rangle\langle 1|,|1\rangle\langle 0|,|1\rangle\langle 1|&#xA;\end{align}&lt;/span&gt;&#xA;and like you say, only the first and last are physical.  Note, however, that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;|0\rangle\langle 1| = \frac{1}{2}(X + iY)\\&#xA;|1\rangle\langle 0| = \frac{1}{2}(X - iY)&#xA;\end{align}&lt;/span&gt;&#xA;and also that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X &amp;amp;= |+\rangle\langle +| - |-\rangle\langle -|\\&#xA;Y &amp;amp;= |+i\rangle\langle +i| - |-i\rangle\langle -i|\\&#xA;\end{align}&lt;/span&gt;&#xA;so the two off-diagonal elements of the natural basis can be written entirely in terms of the states &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\pm i \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr/&gt;&#xA;I'll explain a bit more about state tomography, because process tomography follows readily from it.&#xA;&lt;p&gt;We wish to reconstruct an unknown &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; from some set of measurements.  We start from the Born rule that says the probability of getting outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; upon measurement&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_i = Tr(M_i \rho)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Mathematically, &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are both Hermitian, positive semidefinite matrices, and while we assume to know &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt;, we do not know &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.  If we choose to measure in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, then we have chosen the measurement set (&amp;quot;positive operator-valued measure&amp;quot;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\{ M_0 = |0\rangle\langle 0|, M_1 = |1\rangle\langle 1| \}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and in retrospect when we obtain outcome 0/1, we say we measured with &lt;span class=&quot;math-container&quot;&gt;$M_{0/1}$&lt;/span&gt;.  Consider what &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; actually is symbolically&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_0 &amp;amp;= Tr(M_0 \rho) \\&#xA;&amp;amp;= Tr(|0\rangle\langle 0| \rho)\\&#xA;&amp;amp;= Tr(\langle 0 | \rho | 0 \rangle)\\&#xA;&amp;amp;= \langle 0 | \rho | 0 \rangle\\&#xA;&amp;amp;= \begin{bmatrix} 1 &amp;amp; 0 \end{bmatrix}\begin{bmatrix} \rho_{00} &amp;amp; \rho_{01}\\\rho_{10} &amp;amp; \rho_{11}\end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix}\\&#xA;&amp;amp;= \rho_{00}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So if I measure in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis many times, I can estimate &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt;, which is actually element &lt;span class=&quot;math-container&quot;&gt;$(0,0)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.  Since 0 and 1 are mutually exclusive, whenever I don't get 0, I must get 1, and by similar logic can estimate &lt;span class=&quot;math-container&quot;&gt;$\rho_{11}$&lt;/span&gt;.  The diagonals are easily obtained in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, but we will need to measure in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; bases to get the off-diagonals, as shown above.  When measuring in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis, the POVM then is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\{ M_+ = |+\rangle\langle +|, M_- = |-\rangle\langle -| \}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'll just tabulate what quantities you can estimate given these new outcomes/bases&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_+ = \frac{1}{2}(\rho_{00}+\rho_{01}+\rho_{10}+\rho_{11})\\&#xA;p_i = \frac{1}{2}(\rho_{00}-\rho_{01}-\rho_{10}+\rho_{11})\\&#xA;p_{+i} = \frac{1}{2}(\rho_{00}+i\rho_{01}-i\rho_{10}+\rho_{11})\\&#xA;p_{-i} = \frac{1}{2}(\rho_{00}-i\rho_{01}+i\rho_{10}+\rho_{11})\\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With (complex) linear combinations of the above quantities, we can fix the off-diagonals.  Thus, measuring in the &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; bases is enough to constrain &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.  Process tomography for some process &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is the same thing, but the Born rule becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_{ij} = Tr(M_i \mathcal{E}(\rho_j))&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we can play the same game.  For example, preparing the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|$&lt;/span&gt; and obtaining outcome &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\langle 1|$&lt;/span&gt; fixes a particular element of the process matrix.  To keep this answer &amp;quot;short&amp;quot;, check out section II.B of this &lt;a href=&quot;https://arxiv.org/pdf/2009.07301.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; (which uses a convenient vectorized notation) for a concise summary of state, measurement, and process tomography.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2021-03-12T18:17:39.913" LastActivityDate="2021-03-12T18:17:39.913" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16480" PostTypeId="2" ParentId="16477" CreationDate="2021-03-12T17:36:11.373" Score="1" Body="&lt;p&gt;Yes, &lt;span class=&quot;math-container&quot;&gt;$|i\rangle\langle j|$&lt;/span&gt; is not a density matrix in general. But those matrices indeed form a basis of the space of all matrices. And if we know those &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; values &lt;span class=&quot;math-container&quot;&gt;$\mathcal E(|i\rangle\langle j|)$&lt;/span&gt; then we can fully reconstruct the action of &lt;span class=&quot;math-container&quot;&gt;$\mathcal E$&lt;/span&gt;. So, this is a sort of &amp;quot;mathematical&amp;quot; tomography.&lt;/p&gt;&#xA;&lt;p&gt;Note, however, that we can pick &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; density matrices that will form a basis of all matrices (it won't be orthogonal). For example, we can take traceless Hermitian &lt;a href=&quot;https://en.wikipedia.org/wiki/Generalizations_of_Pauli_matrices#Generalized_Gell-Mann_matrices_(Hermitian)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gell-Mann_matrices&lt;/a&gt;, add a multiple of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; to each of them and scale them, so they will become density matrices.&lt;/p&gt;&#xA;&lt;p&gt;Another example of such basis is a &lt;a href=&quot;https://en.wikipedia.org/wiki/SIC-POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;SIC-POVM&lt;/a&gt;, but it's not yet proved that it exists in every dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A simpler basis of density matrices is described &lt;a href=&quot;https://math.stackexchange.com/a/3524082&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2021-03-12T18:03:28.423" LastActivityDate="2021-03-12T18:03:28.423" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16481" PostTypeId="2" ParentId="16401" CreationDate="2021-03-12T18:32:31.530" Score="3" Body="&lt;p&gt;Many classical programming languages are equipped with a construct known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Conditional_(computer_programming)&quot; rel=&quot;nofollow noreferrer&quot;&gt;conditional statement&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if (condition) {&#xA;    u();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;where &lt;code&gt;condition&lt;/code&gt; is a boolean expression, i.e. an expression that evaluates to one of two values: &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; and where &lt;code&gt;u()&lt;/code&gt; is an operation to be executed  when &lt;code&gt;condition&lt;/code&gt; evaluates to &lt;code&gt;true&lt;/code&gt;. In quantum computing this construct corresponds to a controlled gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CU = \begin{pmatrix}&#xA;I &amp;amp; 0 \\&#xA;0 &amp;amp; U&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which applies &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to target qubit(s) when the control qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Both, the conditional statement and the controlled gate use an input that has two values: &lt;code&gt;true&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt; in the former case and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the latter, to decide between two branches: execute &lt;code&gt;u()&lt;/code&gt; or do nothing in the former case and apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; or identity in the latter case.&lt;/p&gt;&#xA;&lt;p&gt;One way to generalize a controlled gate to qudits is to mimic the way the conditional statement is generalized to expressions that evaluate to more than two values. In many programming languages this is achieved using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Switch_statement&quot; rel=&quot;nofollow noreferrer&quot;&gt;switch statement&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;switch (expression) {&#xA;case 1:&#xA;    u_1();&#xA;    break;&#xA;case 2:&#xA;    u_2();&#xA;    break;&#xA;...&#xA;case n:&#xA;    u_n();&#xA;    break;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which executes &lt;code&gt;u_k()&lt;/code&gt; when &lt;code&gt;expression&lt;/code&gt; evaluates to &lt;code&gt;k&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Quantum counterpart of the switch statement is the &lt;em&gt;quantum multiplexor&lt;/em&gt; (see e.g. section 3 in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406176&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; and the answer to this question by @forky40)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \begin{pmatrix}&#xA;U_1 &amp;amp; 0 &amp;amp; \dots &amp;amp; 0 \\&#xA;0 &amp;amp; U_2 &amp;amp; \dots &amp;amp; 0 \\&#xA;\vdots &amp;amp; \vdots &amp;amp; &amp;amp; \vdots \\&#xA;0 &amp;amp; 0 &amp;amp; \dots &amp;amp; U_n&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which applies unitary &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; to the target subsystem if the control qudit is in state &lt;span class=&quot;math-container&quot;&gt;$|k\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$k=1,\dots, n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Incidentally, this also suggests a quantum generalization of the conditional statement with the else branch:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if (condition) {&#xA;    u();&#xA;} else {&#xA;    v();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which is a two-part multiplexor&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;W = \begin{pmatrix}&#xA;V &amp;amp; 0 \\&#xA;0 &amp;amp; U&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;that applies &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to the target when the control is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and applies &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; when the control is in state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-12T18:53:20.953" LastActivityDate="2021-03-12T18:53:20.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16482" PostTypeId="2" ParentId="16351" CreationDate="2021-03-12T19:06:50.347" Score="1" Body="&lt;p&gt;I have just run the tutorial in IBM Quantum Lab.&lt;/p&gt;&#xA;&lt;p&gt;The output of the cell is in the end:&#xA;...&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;0.010566193641774357&#xA;0.010238918165696886&#xA;0.009971238578226349&#xA;     fun: 0.009971238578226349&#xA;   maxcv: 0.0&#xA; message: 'Maximum number of function evaluations has been exceeded.'&#xA;    nfev: 200&#xA;  status: 2&#xA; success: False&#xA;       x: array([3.21144819, 1.30553216, 3.11318068, 3.07952116, 1.43544259,&#xA;       1.73110611, 1.2182566 , 2.74153291, 4.13588463])&#xA;(0.9900287614218056-0j)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Therefore I think the code is okay but the output of the cell in the tutorial is maybe wrong?&lt;/p&gt;&#xA;&lt;p&gt;Have you tried the code for yourself?&lt;/p&gt;&#xA;" OwnerUserId="15162" LastActivityDate="2021-03-12T19:06:50.347" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16484" PostTypeId="1" CreationDate="2021-03-12T20:30:59.297" Score="5" ViewCount="70" Body="&lt;p&gt;I'm wondering what are the known/good/standard ways of exponentiating Pauli terms (i.e. constructing circuits, which implement &lt;span class=&quot;math-container&quot;&gt;$\exp(i\alpha XIIZYI...)$&lt;/span&gt;) using gates supported by trapped ion quantum computers — single-qubit rotations and &lt;span class=&quot;math-container&quot;&gt;$\{XX,YY,ZZ\}$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;p&gt;One naïve/brute force approach would be to&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Exponentiate using the single-qubit + &lt;span class=&quot;math-container&quot;&gt;$\rm{CNOT}$&lt;/span&gt; technique:&lt;/p&gt;&#xA;&lt;p&gt;a. Rotate to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis,&lt;/p&gt;&#xA;&lt;p&gt;b.  Exponentiate using &lt;span class=&quot;math-container&quot;&gt;$\rm CNOT$&lt;/span&gt;s:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/glKwC.gif&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/glKwC.gif&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Convert each &lt;span class=&quot;math-container&quot;&gt;$\rm CNOT$&lt;/span&gt; using eq. (9) from &lt;a href=&quot;https://arxiv.org/abs/1603.07678&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CrNx1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CrNx1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;Try to optimize the resulting circuit.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This approach is, quite obviously, very inefficient. Any suggestions what one could do instead?..&lt;/p&gt;&#xA;" OwnerUserId="6313" LastEditorUserId="6313" LastEditDate="2021-03-13T01:25:00.777" LastActivityDate="2021-05-11T03:03:28.910" Title="Exponentiating Pauli matrices using trapped ion native gates (single-qubit rotations + XX, YY, ZZ)" Tags="&lt;circuit-construction&gt;&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16485" PostTypeId="2" ParentId="16436" CreationDate="2021-03-12T20:53:17.090" Score="3" Body="&lt;p&gt;In the absence of the constraint on the marginal, it is true that there exists &lt;span class=&quot;math-container&quot;&gt;$U_{ABC}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$U_{ABC}|\rho_{ABC}\rangle = |\sigma_{ABC}\rangle$&lt;/span&gt;. Indeed, extend &lt;span class=&quot;math-container&quot;&gt;$|\rho_{ABC}\rangle = |\rho_{ABC}^{(1)}\rangle$&lt;/span&gt; to an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|\rho_{ABC}^{(k)}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\sigma_{ABC}\rangle = |\sigma_{ABC}^{(1)}\rangle$&lt;/span&gt; to an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$|\sigma_{ABC}^{(k)}\rangle$&lt;/span&gt; and define &lt;span class=&quot;math-container&quot;&gt;$U_{ABC}  =\sum_k |\sigma_{ABC}^{(k)}\rangle\langle\rho_{ABC}^{(k)}|$&lt;/span&gt;. This construction makes it clear that &lt;span class=&quot;math-container&quot;&gt;$U_{ABC}$&lt;/span&gt; is not unique.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, enforcing the constraint on the marginal, it is true that for any &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B(\rho_{AB}) = \mathrm{tr}_B(\sigma_{AB})$&lt;/span&gt; there exists &lt;span class=&quot;math-container&quot;&gt;$U_{BC}$&lt;/span&gt; that achieves &lt;span class=&quot;math-container&quot;&gt;$(I_A\otimes U_{BC})|\rho_{ABC}\rangle = |\sigma_{ABC}\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$|\rho_{ABC}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\sigma_{ABC}\rangle$&lt;/span&gt; denote the respective purifications.&lt;/p&gt;&#xA;&lt;p&gt;To see this, consider the Schmidt decompositions of the two pure states relative to the partitioning of &lt;span class=&quot;math-container&quot;&gt;$ABC$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$BC$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\rho_{ABC}\rangle = \sum_i \lambda_i |i_A\rangle|i_{BC}\rangle \\&#xA;|\sigma_{ABC}\rangle = \sum_i \mu_i |i_A'\rangle|i_{BC}'\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|i_A'\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|i_{BC}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|i_{BC}'\rangle$&lt;/span&gt; are orthonormal sets of states (not necessarily full bases) and &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu_i$&lt;/span&gt; are positive real numbers. Note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}_B(\rho_{AB}) = \mathrm{tr}_{BC}(|\rho_{ABC}\rangle\langle\rho_{ABC}|) = \sum_i\lambda_i^2|i_A\rangle\langle i_A| \\&#xA;\mathrm{tr}_B(\sigma_{AB}) = \mathrm{tr}_{BC}(|\sigma_{ABC}\rangle\langle\sigma_{ABC}|) = \sum_i\mu_i^2|i_A'\rangle\langle i_A'|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and hence &lt;span class=&quot;math-container&quot;&gt;$\lambda_i = \mu_i$&lt;/span&gt;. Moreover, if &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are distinct then the eigendecomposition above is unique and hence &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle = |i_A'\rangle$&lt;/span&gt;. If they are not, this is not guaranteed, but we can &lt;em&gt;choose&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|i_A\rangle = |i_A'\rangle$&lt;/span&gt;. In any case, we can write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\rho_{ABC}\rangle = \sum_i \lambda_i |i_A\rangle|i_{BC}\rangle \\&#xA;|\sigma_{ABC}\rangle = \sum_i \lambda_i |i_A\rangle|i_{BC}'\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, set &lt;span class=&quot;math-container&quot;&gt;$U_{BC} = \sum_i |i_{BC}'\rangle\langle i_{BC}|$&lt;/span&gt; and observe that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I_A\otimes U_{BC})|\rho_{ABC}\rangle = \sum_i \lambda_i |i_A\rangle U_{BC}|i_{BC}\rangle = \sum_i \lambda_i |i_A\rangle|i_{BC}'\rangle = |\sigma_{ABC}\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as desired.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;I don't know what the most general form of a marginal-preserving unitary is. It is certainly more general than &lt;span class=&quot;math-container&quot;&gt;$I\otimes U_{BC}$&lt;/span&gt; or even &lt;span class=&quot;math-container&quot;&gt;$U_A\otimes U_{BC}$&lt;/span&gt;, because there are examples of entangling unitaries that satisfy the constraint. For example, let &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; denote two qubits and &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB} = |00\rangle\langle 00|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB} = |01\rangle\langle 01|$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_B\rho_{AB} = \mathrm{tr}_B\sigma_{AB} = |0\rangle\langle 0|$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$\text{CNOT}\,\rho_{AB}\,\text{CNOT}^\dagger = \sigma_{AB}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-12T20:59:03.187" LastActivityDate="2021-03-12T20:59:03.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16486" PostTypeId="2" ParentId="5951" CreationDate="2021-03-12T21:55:54.177" Score="2" Body="&lt;p&gt;The vertices and edges are the number of qubits and connections in DWaves quantum processing unit topology. It is called Chimera Graph, &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/c_gs_4.html#chimera-graph&quot; rel=&quot;nofollow noreferrer&quot;&gt;see DWaves docs&lt;/a&gt; .&#xA;The graph is not fully connected.&#xA;Therefore an embedding of the qubo problem has to be done. It is done heuristically, &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/stable/docs_minorminer/source/sdk_index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;see minorminer docs&lt;/a&gt;.&#xA;As an example, if your problem is fully connected, the maximum number of variables in the qubo problem is currently 120 &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/stable/docs_system/reference/samplers.html#dwavecliquesampler&quot; rel=&quot;nofollow noreferrer&quot;&gt;DWaveCliqueSampler.largest_clique&lt;/a&gt;. If you try to submit something bigger you get:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;DWaveClique ValueError  :  Cannot embed given BQM (size 128), sampler can only handle problems of size 120&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For sparse problems an embedding can be found for more than 120 variables. So it really depends on the problem structure.&lt;/p&gt;&#xA;" OwnerUserId="15162" LastActivityDate="2021-03-12T21:55:54.177" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16487" PostTypeId="2" ParentId="16463" CreationDate="2021-03-12T23:21:30.443" Score="2" Body="&lt;p&gt;Use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Jordan%E2%80%93Wigner_transformation&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jordan-Wigner transformation&lt;/a&gt;. For a 1D chain with NN interaction it will yield a spin Hamiltonian with NN interaction (specifically, the hopping will map to a XX term and the on-site term to a Z term). (In fact, part of this mapping is even given on the German Wikipedia site on the topic.)&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, if you don't want to put this on a quantum computer but solve it, you should stay in the fermionic picture (or map the spin problem to a fermionic one). This is how one solves e.g. the 1D quantum transverse field Ising model.&lt;/p&gt;&#xA;&lt;p&gt;Finally, if you don't have 1D local Hamiltonians, considering other transformation which keep locality (or few-bodiness of the terms), such as the one mentioned in the other answer,&#xA;can make sense (in particular since local spin models are easier to simulate than those with non-local and in particular many-body interaction).&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-12T23:21:30.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16488" PostTypeId="2" ParentId="5951" CreationDate="2021-03-12T23:37:25.300" Score="1" Body="&lt;p&gt;Yes for QUBO problems, vertices of the graph are qubits, and edges of the graphs are &amp;quot;couplers&amp;quot; which couple two qubits together.&lt;/p&gt;&#xA;&lt;p&gt;For example for the QUBO problem:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;b_1b_2 - 3b_1b_3 + b_3,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;you need a machine with 3 qubits and 2 couplers (one between qubits 1 and 2, and one between qubits 1 and 3).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-12T23:37:25.300" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16489" PostTypeId="1" CreationDate="2021-03-13T05:23:53.693" Score="3" ViewCount="45" Body="&lt;p&gt;I am not sure why I haven't heard much chatter about &lt;a href=&quot;https://eprint.iacr.org/2021/232.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; by Dr. Claus Peter Schnorr where he claims to have come up with a classical algorithm to break the RSA protocol. The construction is based on a so called &lt;a href=&quot;https://en.wikipedia.org/wiki/Lattice_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Shortest Vector Problem Algorithm&amp;quot;&lt;/a&gt;. The actual technical content is far beyond my understanding but I have a few questions about the paper and its implications.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Has the correctness of the algorithm been already proven or disproven?&lt;/li&gt;&#xA;&lt;li&gt;What is the scaling of the algorithm? If efficient (meaning polynomial in the number of bits), would this undermine the field of quantum computation(QC) as &lt;a href=&quot;https://en.wikipedia.org/wiki/Shor%27s_algorithm&quot; rel=&quot;nofollow noreferrer&quot;&gt;Shor's algorithm&lt;/a&gt; is held up as the central example of the usefulness of QC?&lt;/li&gt;&#xA;&lt;li&gt;I know that one can use post quantum cryptographic protocols to avoid Shor's algorithm. Maybe something similar can be done here (by increasing the number of bits if the scaling is poor). However, if it can even break current RSA protocols, can't one just store all the current passwords to decrypt it later(If my memory doesn't betray me, this was the reason behind the NSA investing millions into QC)?  If so, what is your bank doing about it?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="13809" LastEditorUserId="55" LastEditDate="2021-03-20T12:25:56.310" LastActivityDate="2021-03-20T12:25:56.310" Title="Shor vs Schnorr: A classical algorithm for breaking RSA?" Tags="&lt;algorithm&gt;&lt;classical-computing&gt;&lt;shors-algorithm&gt;&lt;cryptography&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-03-13T12:43:38.710" ContentLicense="CC BY-SA 4.0" />
  <row Id="16490" PostTypeId="1" AcceptedAnswerId="16493" CreationDate="2021-03-13T14:42:26.687" Score="5" ViewCount="48" Body="&lt;p&gt;As you may know, one can use barriers in Qiskit to seperate gates on a circuit in a proper way. So, I was wondering is there a way to give a title to these &amp;quot;sections&amp;quot; seperated by barriers?&lt;/p&gt;&#xA;&lt;p&gt;I provide an example in Figure below. Titles does not need to be exactly same with the ones in the Figure. It is just an example.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K97uM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K97uM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14664" LastEditorUserId="55" LastEditDate="2021-03-13T16:45:05.080" LastActivityDate="2021-03-13T19:16:30.080" Title="Is there a way to use titles on circuit drawing?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16491" PostTypeId="2" ParentId="16476" CreationDate="2021-03-13T18:11:54.713" Score="2" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; There is no &amp;quot;physical&amp;quot; meaning for a barrier. It takes literally no time. The barrier is annotation for the transpiler and for the pulse scheduler. The scheduler waits the duration of the operations before the barrier and then executes the operations after the barrier. In this sense, it is similar to the &lt;code&gt;delay&lt;/code&gt; instruction, but &amp;quot;dynamic&amp;quot;. This is, you dont have to known how long the instructions before the barrier are but that is &amp;quot;dynamically&amp;quot; calculated for you.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Long explanation on the effects of barriers:&lt;/p&gt;&#xA;&lt;p&gt;Barries have two related but relatively independent effects in two different stages: &lt;strong&gt;transpilation&lt;/strong&gt; and &lt;strong&gt;scheduled execution&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Transpilation&lt;/h2&gt;&#xA;&lt;p&gt;As you mention, the transpiler does not optimize across barriers. Compare these two situations:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, transpile&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.h(0)&#xA;circuit.h(0)&#xA;display(circuit.draw())&#xA;display(transpile(circuit, optimization_level=2).draw())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/f0ceu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/f0ceu.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/t2Eip.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t2Eip.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If a barrier is set in the middle, the Hadamard gates wont be optimized:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(1)&#xA;circuit.h(0)&#xA;circuit.barrier(0)&#xA;circuit.h(0)&#xA;display(circuit.draw())&#xA;display(transpile(circuit, optimization_level=2).draw())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oxghF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oxghF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/oxghF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oxghF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Scheduled execution&lt;/h2&gt;&#xA;&lt;p&gt;The gates in the circuit are scheduled to being executed in the hardware, when possible, in parallel. In this stage, a barrier works like traditional synchronization barrier in the context of concurrent programming. The barrier is a 0-cycle instruction (ie no delay, instantaneous) that tells the scheduler to not start the operations on the right of the barrier until all the operations on the left are finished. The scheduler takes the duration time of the operations on the left and starts the operation on the right after that time.&lt;/p&gt;&#xA;&lt;p&gt;It is possible see how the circuit is scheduled with the &lt;code&gt;qiskit.schedule&lt;/code&gt; function and a backend that supports OpenPulse.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import schedule, QuantumCircuit&#xA;from qiskit.test.mock import FakeOpenPulse2Q&#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.u2(0.1, 0.2, 0)&#xA;circuit.u2(0.1, 0.2, 1)&#xA;schedule(circuit, FakeOpenPulse2Q()).draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L25yo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L25yo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0sNuy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0sNuy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(2)&#xA;circuit.u2(0.1, 0.2, 0)&#xA;circuit.barrier()&#xA;circuit.u2(0.1, 0.2, 1)&#xA;display(circuit.draw())&#xA;display(schedule(circuit, FakeOpenPulse2Q()).draw())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8w86A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8w86A.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/uXXzY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/uXXzY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="10480" LastEditDate="2021-03-13T21:49:35.810" LastActivityDate="2021-03-13T21:49:35.810" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16492" PostTypeId="1" CreationDate="2021-03-13T18:16:02.650" Score="2" ViewCount="26" Body="&lt;p&gt;Recently, a unified quantum software and hardware platform, &lt;a href=&quot;https://www.zapatacomputing.com/orquestra/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Orquestra&lt;/a&gt; was released. My question is, what could be a real-life (step by step) example of using this kind of workflow? As existing quantum software frameworks already offer algorithm development toolboxes, what additional features would such a workflow include? Thanks.&lt;/p&gt;&#xA;" OwnerUserId="13461" LastActivityDate="2021-03-13T18:16:02.650" Title="What would be a real-life example of using a quantum workflow oriented tool/environment, such as through Orquestra?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;orquestra&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16493" PostTypeId="2" ParentId="16490" CreationDate="2021-03-13T19:16:30.080" Score="3" Body="&lt;p&gt;The short answer is that the circuit drawer does not have a way to label &amp;quot;sections&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;However, you can pass an arbitrary &lt;code&gt;matplotlib.axes.Axes&lt;/code&gt; to the Matplotlib circuit drawer (only to that circuit drawer) where you can set and position your labels by hand. For your particular case, it looks something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from matplotlib.pyplot import figure&#xA;&#xA;fig = figure()&#xA;ax = fig.add_subplot()&#xA;height = 0.8&#xA;ax.text(-0.9, height, 'entanglement', size=14)&#xA;ax.text(2.5, height, 'init', size=14)&#xA;ax.text(4.5, height, 'transfer of\namplitudes', size=14)&#xA;ax.text(7, height, 'measurement', size=14)&#xA;&#xA;circuit.draw('mpl', ax=ax)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/HR7IG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HR7IG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You might have to adapt the &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; numbers (the first two parameters for &lt;code&gt;text&lt;/code&gt;) to readjust their position.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-13T19:16:30.080" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16494" PostTypeId="1" AcceptedAnswerId="16495" CreationDate="2021-03-13T22:05:46.293" Score="7" ViewCount="297" Body="&lt;p&gt;How can one show that &lt;span class=&quot;math-container&quot;&gt;$\hat{U}^\dagger\hat{a}\hat{U}$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$\hat{U} =e^{-i\hat{H}t}$&lt;/span&gt;) involves only linear orders of the ladder operator, when &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the general quadratic Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$(\hat{H} = \alpha (\hat{a}^\dagger)^2+ \beta \hat{a}^\dagger\hat{a}+\alpha^*\hat{a}^2)?$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have been trying to do it using the Baker-Campbell-Hausdorff formula.&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-18T03:59:47.437" LastActivityDate="2021-03-18T03:59:47.437" Title="If a Hamiltonian is quadratic in the ladder operator, why is its time evolution linear in the ladder operator?" Tags="&lt;hamiltonian-simulation&gt;&lt;unitarity&gt;&lt;chemistry&gt;&lt;solid-state&gt;&lt;dynamics&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16495" PostTypeId="2" ParentId="16494" CreationDate="2021-03-13T22:28:42.743" Score="7" Body="&lt;p&gt;Hint: Instead of using the BCH formula in the form usually presented, for example at the &lt;a href=&quot;https://en.wikipedia.org/wiki/Baker%E2%80%93Campbell%E2%80%93Hausdorff_formula&quot; rel=&quot;noreferrer&quot;&gt;top of this Wikipedia page&lt;/a&gt;, use &lt;a href=&quot;https://en.wikipedia.org/wiki/Commutator#Exponential_identities&quot; rel=&quot;noreferrer&quot;&gt;this consequence of Hadamard's Lemma&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;e^{iHt}\hat{a}e^{-iHt} = \hat{a} + [iHt,\hat{a}] + \frac{1}{2!}[iHt,[iHt,\hat{a}] + \cdots&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now substitute &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; into the right-hand side and evaluate the commutators between &lt;span class=&quot;math-container&quot;&gt;$\hat{a}$&lt;/span&gt; and each of the three terms in &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let's look at the following commutators that appear in the second term:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\tag{2}&#xA;[(\hat{a}^\dagger)^2,\hat{a}] &amp;amp;= -2\hat{a}^\dagger\\\tag{3}&#xA;[\hat{a}^\dagger \hat{a},\hat{a}] &amp;amp;= -\hat{a}\\\tag{4}&#xA;[\hat{a}^2,\hat{a}] &amp;amp;= 0.\\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;All commutators appearing in the third term will be commutators of the same form, or of the form &lt;span class=&quot;math-container&quot;&gt;$[(\hat{a}^\dagger)^2,\hat{a^\dagger}],[\hat{a}^\dagger \hat{a},\hat{a}^\dagger],[\hat{a}^2,\hat{a}^\dagger] $&lt;/span&gt;, which will again be linear.&lt;/p&gt;&#xA;&lt;p&gt;In the end, you'll only be left with terms linear in &lt;span class=&quot;math-container&quot;&gt;$\hat{a}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{a^\dagger}$&lt;/span&gt;, but no &amp;quot;quadratic&amp;quot; terms like &lt;span class=&quot;math-container&quot;&gt;$\hat{a}^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-13T23:00:44.210" LastActivityDate="2021-03-13T23:00:44.210" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16496" PostTypeId="2" ParentId="16494" CreationDate="2021-03-14T00:39:44.747" Score="5" Body="&lt;p&gt;Use the differential form of the time evolution,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$dO/dt=i[H, O]\ .$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-14T00:39:44.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16497" PostTypeId="1" AcceptedAnswerId="16498" CreationDate="2021-03-14T01:00:15.273" Score="3" ViewCount="46" Body="&lt;p&gt;This is probably a very obvious question, but I am going through &lt;a href=&quot;http://users.cms.caltech.edu/%7Evidick/teaching/120_qcrypto/HW1_solutions.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this problem set&lt;/a&gt; and I don't understand why in 1b) it says that it is obvious that &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi_1^\perp|\psi_2\rangle|=\sin\theta$&lt;/span&gt; given that &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi_1|\psi_2\rangle| = \cos\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15193" LastEditorUserId="55" LastEditDate="2021-03-14T20:45:52.750" LastActivityDate="2021-03-14T20:45:52.750" Title="How to calculate the overlap of the orthogonal state?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16498" PostTypeId="2" ParentId="16497" CreationDate="2021-03-14T01:24:22.313" Score="4" Body="&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; These inner products are equal to the amplitudes and therefore the squares of their magnitudes sum to one. By Pythagoras theorem &lt;span class=&quot;math-container&quot;&gt;$\sin^2\theta + \cos^2\theta = 1$&lt;/span&gt;, so if one of the amplitudes is &lt;span class=&quot;math-container&quot;&gt;$\cos\theta$&lt;/span&gt; then the magnitude of the other must be &lt;span class=&quot;math-container&quot;&gt;$|\sin\theta|$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_1\rangle, |\psi_1^\perp\rangle\}$&lt;/span&gt; is a basis, we can expand &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_2\rangle = \alpha |\psi_1\rangle + \beta |\psi_1^\perp\rangle\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2=1$&lt;/span&gt;. Moreover, since the basis is orthonormal, we can compute &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; in terms of inner products&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha = \langle \psi_1|\psi_2\rangle \\&#xA;\beta = \langle \psi_1^\perp|\psi_2\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as is easy to check by taking the inner product of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; with the elements of the  dual basis. Now, from &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2=1$&lt;/span&gt; we see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\langle \psi_1^\perp|\psi_2\rangle| = |\beta| = \sqrt{1 - |\alpha|^2} = \sqrt{1 - |\langle \psi_1|\psi_2\rangle|^2} = \sqrt{1 - \cos^2\theta} = |\sin\theta|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but &lt;span class=&quot;math-container&quot;&gt;$\theta \in (0, \pi)$&lt;/span&gt; so &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi_1^\perp|\psi_2\rangle|=\sin\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-14T01:57:59.657" LastActivityDate="2021-03-14T01:57:59.657" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16499" PostTypeId="1" AcceptedAnswerId="16502" CreationDate="2021-03-14T04:36:56.360" Score="4" ViewCount="97" Body="&lt;p&gt;How can one show that &lt;span class=&quot;math-container&quot;&gt;$\hat{U}|00\rangle=|00\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\hat{U}=e^{-igt(\hat{a}^\dagger_2\hat{a}_1+\hat{a}^\dagger_1\hat{a}_2)}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is the unique joint zero eigenstate of the annihilation operators &lt;span class=&quot;math-container&quot;&gt;$\hat{a}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{a}_2$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\hat{a}_1|00\rangle=\hat{a}_2|00\rangle = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-18T03:57:50.277" LastActivityDate="2021-03-18T03:57:50.277" Title="Why does joint ground state not change under action of beam splitting unitary operator?" Tags="&lt;hamiltonian-simulation&gt;&lt;chemistry&gt;&lt;solid-state&gt;&lt;dynamics&gt;&lt;quantum-optics&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16500" PostTypeId="2" ParentId="16499" CreationDate="2021-03-14T04:59:31.233" Score="4" Body="&lt;p&gt;There's more than one way, and I'll suggest two of them here:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Expand &lt;span class=&quot;math-container&quot;&gt;$\hat{U}$&lt;/span&gt; using the formula for the Taylor series of an exponential (&lt;span class=&quot;math-container&quot;&gt;$e^\hat{A}$&lt;/span&gt;) centered around &lt;span class=&quot;math-container&quot;&gt;$\hat{A}=\hat{0}$&lt;/span&gt;, and then you will have a sum of terms where each term no longer involves an exponential operator (i.e. you have just pure creation and annihilation operators and products/powers of them acting on &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. Just as in the answer to your last question (&lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16495/2293&quot;&gt;If a Hamiltonian is quadratic in the ladder operator, why is it's time evolution linear in the ladder operator?&lt;/a&gt;), you can often find a pattern quite quickly which applies to all of the infinitely many terms in the Taylor Series.&lt;/li&gt;&#xA;&lt;li&gt;Use the property that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$V^\dagger D V$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is the matrix built of eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\hat{a}_2^\dagger \hat{a}_1 + \hat{a}_1^\dagger \hat{a}_2$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is a diagonal matrix where the entries are just the scalar exponentials of the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\hat{a}_2^\dagger \hat{a}_1 + \hat{a}_1^\dagger \hat{a}_2$&lt;/span&gt; corresponding to those eigenvectors that were used to build &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-14T04:59:31.233" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16501" PostTypeId="1" AcceptedAnswerId="16503" CreationDate="2021-03-14T06:18:11.353" Score="3" ViewCount="276" Body="&lt;p&gt;I'm trying to initialize a qubit with a custom state in IBM's Qiskit Composer. I wrote the code in the Qiskit Lab and obtained the QASM code as shown below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q0[1];&#xA;creg c[1];&#xA;&#xA;initialize(0.5,0.8660254) q0[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is giving error stating &lt;code&gt;initialize&lt;/code&gt; is not defined. What's the way to initialize a qubit with a custom value in Qiskit Composer?&lt;/p&gt;&#xA;" OwnerUserId="12667" LastActivityDate="2021-03-14T07:46:14.820" Title="How to initialize a qubit with a custom state in Qiskit Composer" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16502" PostTypeId="2" ParentId="16499" CreationDate="2021-03-14T06:26:11.273" Score="5" Body="&lt;p&gt;Calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\hat{U}|00\rangle &amp;amp;= \exp\left(-igt(\hat{a}^\dagger_2\hat{a}_1+\hat{a}^\dagger_1\hat{a}_2)\right)|00\rangle \\&#xA;&amp;amp;= \sum_{k=0}^\infty \frac{(-igt)^k}{k!}(\hat{a}^\dagger_2\hat{a}_1+\hat{a}^\dagger_1\hat{a}_2)^k|00\rangle \\&#xA;&amp;amp;= |00\rangle + \sum_{k=1}^\infty \frac{(-igt)^k}{k!}(\hat{a}^\dagger_2\hat{a}_1+\hat{a}^\dagger_1\hat{a}_2)^k|00\rangle \\&#xA;&amp;amp;= |00\rangle + \sum_{k=1}^\infty 0 \\&#xA;&amp;amp;= |00\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where in the penultimate step we used the fact that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\hat{a}^\dagger_2\hat{a}_1+\hat{a}^\dagger_1\hat{a}_2)|00\rangle = \hat{a}^\dagger_2\hat{a}_1|00\rangle+\hat{a}^\dagger_1\hat{a}_2|00\rangle = 0.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This implements the first approach suggested by @user1271772.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-14T06:26:11.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16503" PostTypeId="2" ParentId="16501" CreationDate="2021-03-14T07:07:43.417" Score="3" Body="&lt;p&gt;What you can do is use qiskit to decompose the circuit with the initialize instruction to elementary gate, then print out the QASM code that you can paste into the Composer.&lt;/p&gt;&#xA;&lt;p&gt;For example: Using the vector you want to initialize, I can do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, IBMQ&#xA;import numpy as np&#xA;num_qubits = 1&#xA;vector = [0.5,0.8660254]&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;circuit = QuantumCircuit(num_qubits,num_qubits)&#xA;circuit.initialize(initial_state, 0)  &#xA;print(circuit)&#xA;qasm_circuit = circuit.decompose().decompose().decompose() &#xA;print(qasm_circuit)&#xA;&#xA;     ┌─────────────────────────┐&#xA;q_0: ┤ initialize(0.5,0.86603) ├&#xA;     └─────────────────────────┘&#xA;c: 1/═══════════════════════════&#xA;                                &#xA;          ┌──────────┐&#xA;q_0: ─|0&amp;gt;─┤ RY(2π/3) ├&#xA;          └──────────┘&#xA;c: 1/═════════════════&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then now, if I do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(qasm_circuit.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then I will get&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[1];&#xA;creg c[1];&#xA;reset q[0];&#xA;ry(2*pi/3) q[0];&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can now paste the QASM code to the Composer and continue on with your circuit construction.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-14T07:07:43.417" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16504" PostTypeId="2" ParentId="16501" CreationDate="2021-03-14T07:20:47.453" Score="3" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; The &lt;code&gt;initialize&lt;/code&gt; instruction is not supported by &lt;em&gt;IBM Quantum Circuit Composer&lt;/em&gt;. However, you can use the transpiler to reconvert it in terms of the supported basis:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = transpile(circuit, basis_gates=[&amp;quot;u3&amp;quot;,&amp;quot;u2&amp;quot;,&amp;quot;u1&amp;quot;,&amp;quot;cx&amp;quot;,&amp;quot;id&amp;quot;,&amp;quot;u0&amp;quot;,&amp;quot;u&amp;quot;,&amp;quot;p&amp;quot;,&amp;quot;x&amp;quot;,&amp;quot;y&amp;quot;,&amp;quot;z&amp;quot;,&amp;quot;h&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;sdg&amp;quot;,&amp;quot;t&amp;quot;,&amp;quot;tdg&amp;quot;,&amp;quot;rx&amp;quot;,&amp;quot;ry&amp;quot;,&amp;quot;rz&amp;quot;,&amp;quot;sx&amp;quot;,&amp;quot;sxdg&amp;quot;,&amp;quot;cz&amp;quot;,&amp;quot;cy&amp;quot;,&amp;quot;swap&amp;quot;,&amp;quot;ch&amp;quot;,&amp;quot;ccx&amp;quot;,&amp;quot;cswap&amp;quot;,&amp;quot;crx&amp;quot;,&amp;quot;cry&amp;quot;,&amp;quot;crz&amp;quot;,&amp;quot;cu1&amp;quot;,&amp;quot;cp&amp;quot;,&amp;quot;cu3&amp;quot;,&amp;quot;csx&amp;quot;,&amp;quot;cu&amp;quot;,&amp;quot;rxx&amp;quot;,&amp;quot;rzz&amp;quot;,&amp;quot;rccx&amp;quot;,&amp;quot;rc3x&amp;quot;,&amp;quot;c3x&amp;quot;,&amp;quot;c3sqrtx&amp;quot;,&amp;quot;c4x&amp;quot;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The long version:&lt;/p&gt;&#xA;&lt;p&gt;The IBM Quantum Circuit Composer does not allow gates outside of the &amp;quot;&lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/libs/qelib1.inc&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard library&lt;/a&gt;&amp;quot;. The &lt;em&gt;IBM Quantum Lab&lt;/em&gt; raises an error explaining the situation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from ibm_quantum_widgets import CircuitComposer&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.initialize([0, 1], 0)&#xA;&#xA;editor = CircuitComposer(circuit=circuit)&#xA;editor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/waPmv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/waPmv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can use &lt;code&gt;transpile&lt;/code&gt; to rewrite the circuit in terms of the supported gates in the standard library. Here is a generic way to do that:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, transpile&#xA;from ibm_quantum_widgets import CircuitComposer&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.initialize([0, 1], 0)&#xA;circuit = transpile(circuit, basis_gates=[&amp;quot;u3&amp;quot;,&amp;quot;u2&amp;quot;,&amp;quot;u1&amp;quot;,&amp;quot;cx&amp;quot;,&amp;quot;id&amp;quot;,&amp;quot;u0&amp;quot;,&amp;quot;u&amp;quot;,&amp;quot;p&amp;quot;,&amp;quot;x&amp;quot;,&amp;quot;y&amp;quot;,&amp;quot;z&amp;quot;,&amp;quot;h&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;sdg&amp;quot;,&amp;quot;t&amp;quot;,&amp;quot;tdg&amp;quot;,&amp;quot;rx&amp;quot;,&amp;quot;ry&amp;quot;,&amp;quot;rz&amp;quot;,&amp;quot;sx&amp;quot;,&amp;quot;sxdg&amp;quot;,&amp;quot;cz&amp;quot;,&amp;quot;cy&amp;quot;,&amp;quot;swap&amp;quot;,&amp;quot;ch&amp;quot;,&amp;quot;ccx&amp;quot;,&amp;quot;cswap&amp;quot;,&amp;quot;crx&amp;quot;,&amp;quot;cry&amp;quot;,&amp;quot;crz&amp;quot;,&amp;quot;cu1&amp;quot;,&amp;quot;cp&amp;quot;,&amp;quot;cu3&amp;quot;,&amp;quot;csx&amp;quot;,&amp;quot;cu&amp;quot;,&amp;quot;rxx&amp;quot;,&amp;quot;rzz&amp;quot;,&amp;quot;rccx&amp;quot;,&amp;quot;rc3x&amp;quot;,&amp;quot;c3x&amp;quot;,&amp;quot;c3sqrtx&amp;quot;,&amp;quot;c4x&amp;quot;])&#xA;editor = CircuitComposer(circuit=circuit)&#xA;editor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/glKX7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/glKX7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This transpiled circuit is dumplable as QASM too:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(circuit.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[1];&#xA;ry(pi) q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-03-14T07:46:14.820" LastActivityDate="2021-03-14T07:46:14.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16505" PostTypeId="1" CreationDate="2021-03-14T13:53:41.907" Score="2" ViewCount="51" Body="&lt;p&gt;To initialize a state in Cirq, I created a custom controlled rotation and a custom rotation gate. The effect of applying the custom controlled gates to the qubits doesn't seem to affect the state.&#xA;Here's the definition of the custom controlled rotation gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;a00 = 2/np.sqrt(30)&#xA;a01 = 4/np.sqrt(30)&#xA;a10 = 3/np.sqrt(30)&#xA;a11 = 1/np.sqrt(30)&#xA;&#xA;class Con0Gate(cirq.SingleQubitGate):&#xA;    def _unitary_(self):&#xA;        return np.array([&#xA;            [a00/(np.sqrt((np.abs(a00)**2)+(np.abs(a01)**2))), a01/(np.sqrt((np.abs(a00)**2)+(np.abs(a01)**2)))],&#xA;            [a01/(np.sqrt((np.abs(a00)**2)+(np.abs(a01)**2))), -a00/(np.sqrt((np.abs(a00)**2)+(np.abs(a01)**2)))]])&#xA;&#xA;    def _circuit_diagram_info_(self, args):&#xA;        return 'Con0Gate'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And here it is in the circuit (ignore the first &amp;quot;rotation&amp;quot; gate, which works fine)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = cirq.Circuit(&#xA;    RotationGate(theta).on(cirq.LineQubit(q1)),&#xA;    Con0Gate().on(cirq.LineQubit(q2)).controlled_by(cirq.LineQubit(q1)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After running this through a simulator, it looks like the gate isn't controlling on the target, and only applies a rotation to the controlled qubit.&lt;/p&gt;&#xA;" OwnerUserId="14860" LastEditorUserId="119" LastEditDate="2021-03-14T17:01:39.720" LastActivityDate="2021-03-14T17:01:39.720" Title="Why wont my custom controlled gates in Cirq work on a simulator?" Tags="&lt;cirq&gt;&lt;initialization&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16506" PostTypeId="1" CreationDate="2021-03-14T15:06:53.737" Score="2" ViewCount="280" Body="&lt;p&gt;As far as I know, quantum computers are able to solve only some of the NP-Problems in polynomial time, using the Grovers algorithm. I read that if one manages to create a reduction of Grovers algorithm on one of the NP-Complete algorithms, for example 3SAT, then it will be a huge milestone, since we could solve all other NP-Complete problems. I also read that current quantum computers lack error-correcting qubits to create a reduction of Grovers algorithm on 3SAT. What would be a sufficient amount of qubits to solve such problem and what amount do we currently have?&lt;/p&gt;&#xA;" OwnerUserId="15197" LastActivityDate="2021-03-14T17:47:51.413" Title="Can quantum computer solve NP-complete problems?" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-03-15T07:41:35.527" ContentLicense="CC BY-SA 4.0" />
  <row Id="16507" PostTypeId="1" CreationDate="2021-03-14T17:45:33.563" Score="3" ViewCount="91" Body="&lt;p&gt;I was wondering if I could use Qiskit locally on Jupyter Notebook and thus loaded my IBM-Q account via API token. I could construct circuits execute jobs but when I tried to use circuit composer, it returned nothing like the interactive circuit-composer as it does in IBM Quantum Lab. I ran the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, execute, Aer, IBMQ &#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from ibm_quantum_widgets import *&#xA;%matplotlib inline&#xA;from ibm_quantum_widgets import CircuitComposer&#xA;CircuitComposer()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It returned the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CircuitComposer(circuit=&amp;lt;qiskit.circuit.quantumcircuit.QuantumCircuit object at 0x15C528F8&amp;gt;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is there anything I am possibly missing out?&#xA;p.s qiskit has the latest version installed.&lt;/p&gt;&#xA;" OwnerUserId="14932" LastEditorUserId="55" LastEditDate="2021-03-15T09:38:42.003" LastActivityDate="2021-03-15T11:45:25.490" Title="Running Qiskit Circuit Composer locally on Jupyer Notebook" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16508" PostTypeId="2" ParentId="16506" CreationDate="2021-03-14T17:47:51.413" Score="5" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I also read that current quantum computers lack error-correcting qubits to create a reduction of Grovers algorithm on 3SAT. What would be a sufficient amount of qubits to solve such problem and what amount do we currently have?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;First and foremost, complexity-theory wise, it doesn't matter how many qubits a current or future system has - from a complexity classes point of view, a quantum computer 'is' a quantum computer, and a classical computer 'is' a classical computer. The complexity classes are just a distinction in how, for different problems, the total number of steps that you have to take to solve the problem &lt;em&gt;scales&lt;/em&gt; with the input of the problem. Any problem for which the (classical) algorithm scales polynomial with the input parameter is in P, any  problem for which the (quantum) algorithm scales polynomial with the input parameter is in BQP, etc.&lt;/p&gt;&#xA;&lt;p&gt;If you're actually going to run the algorithm/solve the problem on a physical machine, then roughly speaking the &lt;em&gt;speed&lt;/em&gt; of the machine is just how many steps (of the algorithm) it can take per second. In that sense, a quantum computer is tremendously slow (if, at all). A fancy modern (classical) desktop computer can have 8 cores, which all can take billions of rudimentary steps per &lt;em&gt;second&lt;/em&gt; - a quantum computer is not gonna top that for a long time (and I believe never). But that's not the point of the quantum computer - the point is that it &lt;strong&gt;can&lt;/strong&gt; be extremely &lt;em&gt;efficient&lt;/em&gt;. There are problems that, to solve them on a classical computer, scale very bad with the input parameter (namely, exponential), whereas we know about quantum algorithms that do it much better (scaling wise). And a quantum computer can run quantum algorithms! It should be noted that we only know about a handful of quantum algorithms that perform exponentially faster than their best-known classical counterparts - and Grover is not one of them.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;As far as I know, quantum computers are able to solve only some of the NP-Problems in polynomial time, using the Grovers algorithm.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;As explained above, there are some known problems that can be solved by quantum computers in polynomial time, while the best known method for classical computers scales exponentially (to some degree) ~ the quintessential example is Shor's algorithm to factor large coprime numbers.&lt;/p&gt;&#xA;&lt;p&gt;Grovers algorithm is an algorithm that sorts through an unsorted database in &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; steps, while the best known classical method takes &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; steps. That's a speedup, but its not as dramatic as such an 'exponential' speedup. Moreover, in terms of complexity classes it is, by some view, not even a speedup &lt;em&gt;at all&lt;/em&gt; - an NP(-complete) problem is solvable in exponentially many steps, and Grovers algorithm alone can only give a square-root speedup - but the square root of an exponential function is also an exponential function.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I read that if one manages to create a reduction of Grovers algorithm on one of the NP-Complete algorithms, for example 3SAT, then it will be a huge milestone, since we could solve all other NP-Complete problems.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;NP complete problems are problems such that, with some simple steps, any other NP problem can be converted into this problem. Thus, if you solve any NP-complete problem, all other NP problems come as a 'freebie' (not just the NP-complete ones). In that sense, it would be a huge milestone. It is &lt;strong&gt;widely&lt;/strong&gt; believed that quantum computers cannot solve NP-complete problems, but it has never been proven. As a matter of fact, it hasn't even been proven that &lt;span class=&quot;math-container&quot;&gt;$P \not = NP$&lt;/span&gt; - do that and you'll earn a million dollar (and everlasting fame, whatever seals the deal for you:))!&lt;/p&gt;&#xA;&lt;p&gt;Currently, we know that &lt;span class=&quot;math-container&quot;&gt;$P \subseteq BQP$&lt;/span&gt;(i.e. anything you can do with a classic computer you can do with a quantum computer). We don't know, strictly speaking, if that actually is a strict inequality! But many people will be very surprised if it turns out to not be one - not to mention the huge implications it would have.&#xA;People &lt;em&gt;think&lt;/em&gt; that &lt;span class=&quot;math-container&quot;&gt;$BQP \not = NP$&lt;/span&gt; but that neither &lt;span class=&quot;math-container&quot;&gt;$BQP \subset NP$&lt;/span&gt; nor &lt;span class=&quot;math-container&quot;&gt;$NP \subset BQP$&lt;/span&gt; - but proving this is very hard and has not been done either way.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-03-14T17:47:51.413" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16509" PostTypeId="1" AcceptedAnswerId="16513" CreationDate="2021-03-14T19:38:41.587" Score="3" ViewCount="75" Body="&lt;p&gt;I am planning to write a paper which compares Qiskit and Q# in the following circuits/algorithms&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Bell circuits&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Controlled swap to test similarity of two registers&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Phase kickback between two qubits&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Deutsch-Jozsa algorithm&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Grovers algorithm&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Simons algorithm&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Shors algorithm (slightly advanced for me)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What all parameters apart from time and space complexity can I take to compare these languages&lt;/p&gt;&#xA;" OwnerUserId="14675" LastActivityDate="2021-03-15T06:38:50.597" Title="What all parameters can we take into account when comparing different quantum programming languages" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16510" PostTypeId="2" ParentId="16507" CreationDate="2021-03-14T21:50:03.510" Score="3" Body="&lt;p&gt;Before running the local notebook, you need to enable the &lt;code&gt;ibm_quantum_widgets&lt;/code&gt; extension. You can check if it is enable with &lt;code&gt;jupyter nbextension list&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Otherwise, you can enable it, for example, like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;jupyter nbextension enable --py --user ibm_quantum_widgets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or by the &lt;a href=&quot;https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator&quot; rel=&quot;nofollow noreferrer&quot;&gt;jupyter_nbextensions_configurator server&lt;/a&gt;, typically in &lt;a href=&quot;http://127.0.0.1:8888/nbextensions&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://127.0.0.1:8888/nbextensions&lt;/a&gt; :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/iPC3J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iPC3J.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-03-15T11:45:25.490" LastActivityDate="2021-03-15T11:45:25.490" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16511" PostTypeId="1" AcceptedAnswerId="16512" CreationDate="2021-03-14T21:54:08.683" Score="2" ViewCount="71" Body="&lt;p&gt;How to show in detailed steps that Fermionic annihilation and creation operators under Jordan-Wigner transformation satisfy the Fermionic commutation relation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\{\hat{a}_i,\hat{a}_j\}=  \{\hat{a}_i^\dagger,\hat{a}_j^\dagger\} =0 , \{\hat{a}_i,\hat{a}_j^\dagger\} = \delta_{ij}.$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="10480" LastEditDate="2021-03-18T03:56:17.447" LastActivityDate="2021-03-18T03:56:17.447" Title="Fermionic commutation relation using Jordan-Wigner transformation" Tags="&lt;hamiltonian-simulation&gt;&lt;chemistry&gt;&lt;solid-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16512" PostTypeId="2" ParentId="16511" CreationDate="2021-03-14T23:43:12.497" Score="2" Body="&lt;p&gt;Based on my answer to this: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16465/2293&quot;&gt;Fermionic occupation operator and nearest neighbor Fermionic hopping interaction as a qubit operator&lt;/a&gt;, you can see that we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\hat{a}_i &amp;amp;= \frac{1}{2}  Z^{\otimes (i-1)} (X - iY),\\&#xA;\hat{a}_i^\dagger          &amp;amp;=\frac{1}{2}  Z^{\otimes (i-1)} (X + iY).\\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$i=j$&lt;/span&gt; we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\{\hat{a}_i,\hat{a}_i^\dagger\} &amp;amp;\propto \frac{1}{4}  ((X - iY)(X + iY) + (X + iY)(X - iY)),\\                         &amp;amp;= \frac{1}{4}  (X^2 + iXY + - iXY + Y^2 +  X^2 -iXY + iXY + Y^2) \\&#xA;&amp;amp;=\frac{1}{4}(2X^2 + 2Y^2)\\&#xA;&amp;amp; =\frac{1}{4}(4I) \\&#xA;&amp;amp; = I.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;All &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators are replaced by &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; operators since &lt;span class=&quot;math-container&quot;&gt;$Z \times Z = I$&lt;/span&gt;, and this is also what was done in the penultimate step, where &lt;span class=&quot;math-container&quot;&gt;$X^2 = I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y^2 = I$&lt;/span&gt; were used.&lt;/p&gt;&#xA;&lt;p&gt;For the other anti-commutators we have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\{\hat{a}_i,\hat{a}_j\} &amp;amp;= \frac{1}{4}  ((X - iY)(X - iY) + (X - iY)(X - iY)),\\                         \{\hat{a}^\dagger_i,\hat{a}^\dagger_j\} &amp;amp;= \frac{1}{4}  ((X + iY)(X + iY) + (X + iY)(X + iY)). &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can then do the same type of arithmetic that I went through in detail for the first anti-commutator.&lt;/p&gt;&#xA;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-14T23:43:12.497" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16513" PostTypeId="2" ParentId="16509" CreationDate="2021-03-15T00:00:09.067" Score="5" Body="&lt;p&gt;Just as with classical computing, we don't expect that in quantum computing the choice of a programming language will have a direct effect on the time and space complexity of most algorithms. That is, while C, Python, Rust, and Swift are all very different programming languages, quicksort is a &lt;span class=&quot;math-container&quot;&gt;$O(n \ln n)$&lt;/span&gt; algorithm in all of them. Rather, classical languages tend to be compared on the basis of whether they are low-level or high-level, how easy they are to work with, what safety they provide the programmer (e.g.: it's more difficult to segfault in Python or Rust than in C), and so forth.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you're interested in more resources comparing quantum languages, you may find &lt;a href=&quot;https://www.nature.com/articles/s42254-020-00245-7&quot; rel=&quot;noreferrer&quot;&gt;https://www.nature.com/articles/s42254-020-00245-7&lt;/a&gt; helpful. I also have a look together with Sarah Kaiser on Q# coming out soon that you may find interesting as well: &lt;a href=&quot;https://bit.ly/qsharp-book&quot; rel=&quot;noreferrer&quot;&gt;https://bit.ly/qsharp-book&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1978" LastEditorUserId="1859" LastEditDate="2021-03-15T06:38:50.597" LastActivityDate="2021-03-15T06:38:50.597" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16514" PostTypeId="1" AcceptedAnswerId="16515" CreationDate="2021-03-15T05:29:08.770" Score="4" ViewCount="80" Body="&lt;p&gt;In Dawson's and Nielsen's pedagogical review of the Solovay-Kitaev algorithm, they describe the decomposition of U into &lt;span class=&quot;math-container&quot;&gt;$U=VWV^\dagger W^\dagger$&lt;/span&gt;, with both &lt;span class=&quot;math-container&quot;&gt;$V, W$&lt;/span&gt; being unitary, being rotated by &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; around the x-axis and y-axis, and obeying the following relationship, where &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is the angle of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; about the Bloch sphere:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sin(\theta / 2) = 2 \sin^2(\phi/2)\sqrt{1 - \sin^4(\phi/2)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where does this relation come from?&lt;/p&gt;&#xA;" OwnerUserId="11582" LastEditorUserId="55" LastEditDate="2021-03-15T09:39:48.877" LastActivityDate="2021-03-18T07:46:28.797" Title="In Solovay-Kitaev's algorithm, where does the rotation relation $\sin(\theta / 2) = 2 \sin^2(\phi/2)\sqrt{1 - \sin^4(\phi/2)}$ come from?" Tags="&lt;solovay-kitaev-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16515" PostTypeId="2" ParentId="16514" CreationDate="2021-03-15T09:07:24.923" Score="4" Body="&lt;p&gt;This simply comes from equation an arbitrary rotation &lt;span class=&quot;math-container&quot;&gt;$R_{n}(\theta)$&lt;/span&gt; with the rotation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=R_X(\phi)R_Y(\phi)R_X(-\phi)R_Y(-\phi).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The way that I did this calculation, just to verify this claim, was to recognise that, for example&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_X(\phi)=\cos\frac{\phi}{2}I+i\sin\frac{\phi}{2}X.&#xA;$$&lt;/span&gt;&#xA;Now, if I evaluate &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(U)$&lt;/span&gt;, this picks out the identity terms in the product (because I certainly don't want to multiply the whole thing out!), and those terms occur whenever I have a pair of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or a pair of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; (or both or neither). Hence&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\cos\frac{\theta}{2}&amp;amp;=\cos^4\frac{\phi}{2}+2\cos^2\frac{\phi}{2}\sin^2\frac{\phi}{2}-\sin^4\frac{\phi}{2} \\&#xA;&amp;amp;=(\cos^2\frac{\phi}{2}+\sin^2\frac{\phi}{2})^2-2\sin^4\frac{\phi}{2} \\&#xA;&amp;amp;=1-2\sin^4\frac{\phi}{2}.&#xA;\end{align}&lt;/span&gt;&#xA;Now if you use this to express &lt;span class=&quot;math-container&quot;&gt;$\sin\frac{\theta}{2}$&lt;/span&gt;, you'll find the claimed result.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-03-18T07:46:28.797" LastActivityDate="2021-03-18T07:46:28.797" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16516" PostTypeId="2" ParentId="16494" CreationDate="2021-03-15T09:12:56.523" Score="2" Body="&lt;p&gt;Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[(a^\dagger)^n,a] = -n(a^{\dagger})^{n-1},&#xA;\qquad [(a^\dagger)^n a^m,a] = -n (a^\dagger)^{n-1}a^m,&#xA;\qquad [a^n,a]=0.$$&lt;/span&gt;&#xA;Consider an arbitrary function of the mode operators, that we assume be written in normal formal:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$f(a,a^\dagger) = \sum_{n,m=0}^\infty c_{n,m} (a^\dagger)^n a^m.$$&lt;/span&gt;&#xA;We know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{f(a,a^\dagger)}a e^{-f(a,a^\dagger)} = \sum_{k=0}^\infty \frac{1}{k!}\operatorname{ad}(f(a,a^\dagger))^k\cdot a,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\operatorname{ad}(A)^k\cdot B \equiv [\underbrace{A,...,[A}_k,B]\cdots]$&lt;/span&gt;&#xA;denotes the operation of taking the repeated commutator of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&#xA;For example, for &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\operatorname{ad}(A)^2\cdot B\equiv [A,[A,B]]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We know that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$[f(a,a^\dagger),a] = -\sum_{n,m\ge 0}c_{n,m} n (a^\dagger)^{n-1} a^m,$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{ad}(f(a,a^\dagger))^k\cdot a&#xA;= (-1)^k \sum_{n,m\ge0} c_{n,m} \frac{n!}{(n-k)!} (a^{\dagger})^{n-k}a^m.$$&lt;/span&gt;&#xA;Thus&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{f(a,a^\dagger)}a e^{-f(a,a^\dagger)}&#xA;= \sum_{n,m\ge0 } c_{n,m} (a^\dagger-1)^n a^m&#xA;= f(a, a^\dagger-1). $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This shows you explicitly that properties of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; such as its being quadratic permain in &lt;span class=&quot;math-container&quot;&gt;$e^f a e^{-f}$&lt;/span&gt;. Thus, in particular, you get your result by choosing &lt;span class=&quot;math-container&quot;&gt;$f=-iH t$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-15T09:12:56.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16517" PostTypeId="2" ParentId="16499" CreationDate="2021-03-15T09:37:26.640" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be an eigenstate of an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A|\psi\rangle=\lambda|\psi\rangle$&lt;/span&gt;.&#xA;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^A |\psi\rangle = \sum_{k=0}^\infty \frac{A^k}{k!}|\psi\rangle = \sum_{k=0}^\infty \frac{\lambda^k}{k!}|\psi\rangle = e^\lambda |\psi\rangle.$$&lt;/span&gt;&#xA;In this particular case, &lt;span class=&quot;math-container&quot;&gt;$A=-igt(a_2^\dagger a_1+a_1^\dagger a_2)$&lt;/span&gt;, of which &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is an eigenstate with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda=0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-15T09:37:26.640" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16518" PostTypeId="1" AcceptedAnswerId="16520" CreationDate="2021-03-15T10:21:43.770" Score="0" ViewCount="47" Body="&lt;p&gt;I am implementing RQAOA in Cirq.&#xA;After running regular QAOA to find an optimal state &lt;code&gt;a&lt;/code&gt; (This I have done successfully).&lt;/p&gt;&#xA;&lt;p&gt;I need to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle a|Z_iZ_j|a\rangle$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; in &lt;code&gt;MyGraph.edges()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How should I go about using state a found with the QAOA circuit, to calculate the expectation value of a different circuit with that state?&lt;/p&gt;&#xA;" OwnerUserId="15201" LastEditorUserId="55" LastEditDate="2021-03-15T11:30:33.213" LastActivityDate="2021-03-15T18:49:56.910" Title="Best way to compute $\langle a|B|a \rangle$ in Cirq, where a is a state obtained running circuit A. And B is a different Quantum Circuit" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16519" PostTypeId="1" CreationDate="2021-03-15T12:10:47.067" Score="0" ViewCount="68" Body="&lt;p&gt;I'm trying to use the CPLEX library alongside Qiskit but keep getting the error.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; File &amp;quot;C:\Users\charl\.conda\envs\quantum\lib\site-packages\qiskit\optimization\algorithms\cplex_optimizer.py&amp;quot;, line 58, in __init__&#xA;    raise MissingOptionalLibraryError(&#xA;qiskit.aqua.missing_optional_library_error.MissingOptionalLibraryError: &amp;quot;The 'CPLEX' library is required to use 'CplexOptimizer'. You can install it with 'pip install qiskit-aqua[cplex]'.&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now when of course run that command, I find that all these packages are already installed.&lt;/p&gt;&#xA;&lt;p&gt;When I tried manually updating docplex, I got a warning saying the latest version was incompatible with qiskit and so I downgraded using pip to docplex 2.15.194, yet I still get the error.&lt;/p&gt;&#xA;&lt;p&gt;What can I do to get docplex and Qiskit to talk to one another ?&lt;/p&gt;&#xA;&lt;p&gt;I am using a windows 10 installation of qiskit in a conda environment.&lt;/p&gt;&#xA;" OwnerUserId="14866" LastActivityDate="2021-04-15T14:20:00.323" Title="Qiskit not finding CPLEX" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16520" PostTypeId="2" ParentId="16518" CreationDate="2021-03-15T18:49:56.910" Score="1" Body="&lt;p&gt;If you've already simulated the final state &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt;, something like the following should work:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qubits = cirq.LineQubit.range(nqubits)&#xA;&#xA;# qubit order in the observables must match the qubit order in the circuit used to generate |a&amp;gt;&#xA;qubit_map = dict(zip(qubits, range(nqubits))) &#xA;&#xA;for (i, j) in MyGraph.edges():&#xA;  # make the Z_i*Z_j observable&#xA;  ZiZj = cirq.Z(qubits[i]) * cirq.Z(qubits[j]) &#xA;  # compute desired expectation&#xA;  expectation_ZiZj = ZiZj.expectation_from_state_vector(a, qubit_map=qubit_map)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also in the expression &lt;span class=&quot;math-container&quot;&gt;$\langle a | B | a \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is generally &lt;em&gt;not&lt;/em&gt; a quantum circuit, it needs to be an &amp;quot;observable&amp;quot; (Hermitian operator).&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-03-15T18:49:56.910" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16521" PostTypeId="1" CreationDate="2021-03-16T02:49:56.327" Score="1" ViewCount="64" Body="&lt;p&gt;This is a duplicate of a question that was asked on the &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/3885&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cirq issues page&lt;/a&gt;. I'm duplicating this question to increase it's visibility.&lt;/p&gt;&#xA;&lt;p&gt;The standard way to print circuits in Cirq is by calling &lt;code&gt;print(circuit)&lt;/code&gt;: which prints the text diagram representation of the circuit. A &amp;quot;prettier&amp;quot; representation can be displayed with &lt;code&gt;SVGCircuit&lt;/code&gt;. In a Jupyter notebook,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;from cirq.contrib.svg import SVGCircuit&#xA;&#xA;a, b = cirq.LineQubit.range(2)&#xA;SVGCircuit(cirq.Circuit(cirq.X(a), cirq.CNOT(a,b)))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;outputs:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Kzsu1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kzsu1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;SVGCircuit&lt;/code&gt; is a work-in-progress. Please add comments explaining what problems you run into on the &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/2313&quot; rel=&quot;nofollow noreferrer&quot;&gt;Circuit.&lt;em&gt;repr_svg&lt;/em&gt; with nice diagrams for ipython&lt;/a&gt; issue.&lt;/p&gt;&#xA;" OwnerUserId="362" LastEditorUserId="362" LastEditDate="2021-03-16T03:20:54.313" LastActivityDate="2021-03-16T03:20:54.313" Title="In Cirq, how do you display circuit diagrams that are &quot;prettier&quot; than the ones displayed by default?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;python&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16522" PostTypeId="1" AcceptedAnswerId="16531" CreationDate="2021-03-16T03:09:42.690" Score="3" ViewCount="96" Body="&lt;p&gt;I am currently attempting to solve a problem from Nielsen-Chuang, and I can't seem to figure out how I would do this;&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to implement Grover's algorithm to solve the problem of differentiating between the two functions with 99% probability in O(1),&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f_0:\{0,1\}^n → \{-1,1\} \; s.t. \; \hat{f}(00...0)=\sqrt{2/3}\\&#xA;f_1:\{0,1\}^n → \{-1,1\} \; s.t. \; \hat{f}(11...1)=\sqrt{2/3}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know how I would do this?&lt;/p&gt;&#xA;" OwnerUserId="14960" LastEditorUserId="14960" LastEditDate="2021-03-16T17:34:04.483" LastActivityDate="2021-03-17T01:07:01.980" Title="How would I theorise a quantum query algorithm in O(1)?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;&lt;complexity-theory&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16523" PostTypeId="1" AcceptedAnswerId="16525" CreationDate="2021-03-16T04:39:44.263" Score="3" ViewCount="98" Body="&lt;p&gt;For a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and some operators &lt;span class=&quot;math-container&quot;&gt;$A, B$&lt;/span&gt;, is there a way to express&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_A((A\otimes B)\rho_{AB})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;using the reduced states &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; and operators &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;? Note that when &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the identity operator, this is indeed possible and one has&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tr}_A((I_A\otimes B)\rho_{AB})= B\rho_{B}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;as shown &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/5066/14178&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14178" LastEditorUserId="10480" LastEditDate="2021-03-16T07:25:59.483" LastActivityDate="2021-03-16T20:00:25.593" Title="Can we express $\mathrm{tr}_A((A\otimes B)\rho_{AB})$ in terms of $A$, $B$, $\rho_A$ and $\rho_B$?" Tags="&lt;mathematics&gt;&lt;tensor-product&gt;&lt;partial-trace&gt;&lt;linear-algebra&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16525" PostTypeId="2" ParentId="16523" CreationDate="2021-03-16T07:21:19.130" Score="5" Body="&lt;p&gt;In general, the knowledge of the marginals &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; and the operators &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is insufficient to compute &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_A((A\otimes B)\rho_{AB})$&lt;/span&gt;. Indeed, we can find two different density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{AB}$&lt;/span&gt; with the same marginals for which&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}_A((A\otimes B)\rho_{AB}) \ne \mathrm{tr}_A((A\otimes B)\sigma_{AB}).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One such counterexample uses the elements of the Bell basis &lt;span class=&quot;math-container&quot;&gt;$|\beta_{ij}\rangle = X_A^iZ_A^j|\beta_{00}\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\beta_{00}\rangle=(|00\rangle+|11\rangle)/\sqrt{2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$i,j=0, 1$&lt;/span&gt;. In this case&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\mathrm{tr}_A((A_A\otimes B_B)|\beta_{ij}\rangle\langle\beta_{ij}|) &amp;amp;= \mathrm{tr}_A\left[(A_A\otimes B_B)X_A^iZ_A^j|\beta_{00}\rangle\langle\beta_{00}|Z_A^jX_A^i\right] \\&#xA;&amp;amp;= \mathrm{tr}_A\left[(A_A\otimes B_B)Z_B^jX_B^i|\beta_{00}\rangle\langle\beta_{00}|X_B^iZ_B^j\right] \\&#xA;&amp;amp;= \mathrm{tr}_A\left[(I_A\otimes B_B)Z_B^jX_B^iA_B^T|\beta_{00}\rangle\langle\beta_{00}|X_B^iZ_B^j\right] \\&#xA;&amp;amp;= BZ^jX^iA^T\,\mathrm{tr}_A\left[|\beta_{00}\rangle\langle\beta_{00}\right]\,X^iZ^j \\&#xA;&amp;amp;= \frac12BZ^jX^iA^TX^iZ^j&#xA;\end{align}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we exploited a useful and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16174/show-algebraically-that-u0-rangle-otimes-0-rangleu1-rangle-otimes1-rangle/16175#16175&quot;&gt;easy to check&lt;/a&gt; property that &lt;span class=&quot;math-container&quot;&gt;$(A\otimes I)|\beta_{00}\rangle = (I\otimes A^T)|\beta_{00}\rangle$&lt;/span&gt;. We see that if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are non-singular, then for the expression &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; to yield the same value for all &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; we need &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to commute with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. However, any operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$A=aI+bX+cZ+dXZ$&lt;/span&gt; and it is easy to see that if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$b=c=d=0$&lt;/span&gt;. Consequently, &lt;span class=&quot;math-container&quot;&gt;$A=aI$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We conclude that if &lt;span class=&quot;math-container&quot;&gt;$A\ne aI$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_A((A\otimes B)\rho_{AB})$&lt;/span&gt; is not uniquely defined on the set of density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; with given marginals &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;. Therefore, no general formula for &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_A((A\otimes B)\rho_{AB})$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and the marginals exists.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-16T07:27:57.037" LastActivityDate="2021-03-16T07:27:57.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16527" PostTypeId="1" AcceptedAnswerId="16529" CreationDate="2021-03-16T09:42:16.437" Score="0" ViewCount="51" Body="&lt;p&gt;I am trying to prove that when applying the inverse QFT to the following state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a1l0O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a1l0O.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;we get the following result:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/8wXsx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/8wXsx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, I get a wrong prefactor. Can anyone tell me where I went wrong? Here my calculations:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BYL4V.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BYL4V.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here, the last equality comes by realizing that y is an integer and thus all terms of the second bracket give 1. The first bracket can be evaluated as follows:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pXLFU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pXLFU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then we can plug in:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/GYHCs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GYHCs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Obviously I should get 1/sqrt(r) not sqrt(r), but I don't find my mistake...&lt;/p&gt;&#xA;" OwnerUserId="15208" LastActivityDate="2021-03-16T14:30:25.023" Title="Quantum Fourier Transform in the Period Finding Problem" Tags="&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16528" PostTypeId="2" ParentId="16519" CreationDate="2021-03-16T14:13:26.137" Score="0" Body="&lt;p&gt;I am also using Qiskit in conda environment and came over this issue some weeks ago.&#xA;I had to use pip install docplex and pip install cplex in my environment.&lt;/p&gt;&#xA;&lt;p&gt;Afterwards it worked. I should mention that I am using Linux but don`t think this matters here...&lt;/p&gt;&#xA;&lt;p&gt;Please always be cautious when using both pip and conda in an environment as this can cause problems. This is described on &lt;a href=&quot;https://www.anaconda.com/blog/using-pip-in-a-conda-environment&quot; rel=&quot;nofollow noreferrer&quot;&gt;anaconda website&lt;/a&gt;. I am using conda environment but only pip as installer.&lt;/p&gt;&#xA;" OwnerUserId="15162" LastActivityDate="2021-03-16T14:13:26.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16529" PostTypeId="2" ParentId="16527" CreationDate="2021-03-16T14:30:25.023" Score="2" Body="&lt;p&gt;The summation in the initial wave function should be&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \frac{1}{\sqrt{m}}\sum^{m-1}_0$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="6139" LastActivityDate="2021-03-16T14:30:25.023" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16530" PostTypeId="2" ParentId="16523" CreationDate="2021-03-16T20:00:25.593" Score="3" Body="&lt;p&gt;No - take &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; one of the four Bell states, which all have the same marginals. Then the trace you give will evaluate to &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[APBP]$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; one of the four Paulis (including &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;), which is not only a function of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (as it depends on the Pauli, which cannot be inferred from the reduced states).&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-16T20:00:25.593" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16531" PostTypeId="2" ParentId="16522" CreationDate="2021-03-17T01:07:01.980" Score="1" Body="&lt;p&gt;I hunted around for this for a little bit and couldn't find it in my copy of N&amp;amp;C, but nonetheless I think that the setup is more akin to the Deutsch-Jozsa algorithm than to Grover's algorithm.&lt;/p&gt;&#xA;&lt;p&gt;TL/DR, much as the Deutsch-Jozsa algorithm uses the Hadamard transform to distinguish a constant function from a balanced function with the promise that the function is constant or balanced, a quantum Fourier transform can distinguish an almost-constant function from a high frequency function with the promise that the function is almost-constant or is high-frequency.  Repeating a small number of times amplifies the success probability.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For example, the Deutsch-Jozsa algorithm uses the Hadamard transform to distinguish a constant function from a balanced function.  Similarly as described in the question it appears that we have oracle access to a Boolean function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f:\{0,1\}^n \mapsto \{0,1\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with a promise on the coefficients of the Fourier transform, that either:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{f}(00...0)=\sqrt{2/3},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;e.g. &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is nearly constant on its codomain, or&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{f}(11...1)=\sqrt{2/3},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;e.g. &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; has a high frequency.  There is no promise on other Fourier coefficients.  Our task is to determine whether &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant or is high frequency.&lt;/p&gt;&#xA;&lt;p&gt;Similar to the Deutsch-Jozsa where we prepare a uniform superposition on the input register, evaluate the oracle function, perform a Hadamard transform on the first register, and measure the first register, here we can prepare a uniform superposition on our input register, evaluate the oracle function, perform a quantum Fourier transform on the first register, and measure the first register.&lt;/p&gt;&#xA;&lt;p&gt;If our oracle is nearly constant, we measure the first register as &lt;span class=&quot;math-container&quot;&gt;$\vert 00\cdots0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2/3})^2=2/3$&lt;/span&gt;.  If our oracle is high-frequency, we measure the first register as &lt;span class=&quot;math-container&quot;&gt;$\vert 11\cdots 1\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$(\sqrt{2/3})^2=2/3$&lt;/span&gt;.  Either way with probability &lt;span class=&quot;math-container&quot;&gt;$1/3$&lt;/span&gt; we might get junk by measuring some other string (say &lt;span class=&quot;math-container&quot;&gt;$\vert101001\cdots0\rangle$&lt;/span&gt;) corresponding to another Fourier coefficient.&lt;/p&gt;&#xA;&lt;p&gt;Nonetheless we can repeat the procedure, say, &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; times, and quickly get a high probability, &lt;span class=&quot;math-container&quot;&gt;$\gt 99\%$&lt;/span&gt;, of faithfully determining whether &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is constant or high-frequency, simply based on taking the majority and relying on Chernoff's bound.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-03-17T01:07:01.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16532" PostTypeId="2" ParentId="16444" CreationDate="2021-03-17T04:10:51.363" Score="5" Body="&lt;p&gt;One way of looking at the relationship between POVMs and observables arises from identifying their counterparts in the theory of probability of which quantum mechanics &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0101012&quot; rel=&quot;nofollow noreferrer&quot;&gt;can be thought of&lt;/a&gt; as an extension. It is easier to identify the counterparts if we temporarily restrict our attention to a special type of POVMs known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Projection-valued_measure&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;projection-valued measures&lt;/em&gt;&lt;/a&gt; or PVMs.&lt;/p&gt;&#xA;&lt;p&gt;Below, we summarize four concepts: probability measure, random variable, PVM and observable in a way that highlights the high degree of similarity between probability measures and PVMs on one hand and random variables and observables on the other.&lt;/p&gt;&#xA;&lt;h2&gt;Probability measures and random variables&lt;/h2&gt;&#xA;&lt;p&gt;In elementary probability we construct random variables as tables that assign probabilities to possible outcomes, e.g. a random variable taking values &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=1,\dots,n$&lt;/span&gt; with respective probabilities &lt;span class=&quot;math-container&quot;&gt;$p_k$&lt;/span&gt; is described by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|cccccc}&#xA;X &amp;amp; \lambda_1 &amp;amp; \lambda_2 &amp;amp; \dots &amp;amp; \lambda_n \\&#xA;\hline&#xA;p(X) &amp;amp; p_1 &amp;amp; p_2 &amp;amp; \dots &amp;amp; p_n \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the more abstract approach based on measure theory the probabilistic structure is separated out by introducing the probability space &lt;span class=&quot;math-container&quot;&gt;$(\Omega, \mathcal{F}, P)$&lt;/span&gt; where the &lt;em&gt;sample space&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; is the set of all possible outcomes of a random experiment, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;-algebra of events on &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P: \mathcal{F} \to \mathbb{R}_{\ge0}$&lt;/span&gt; is a probability measure.&lt;/p&gt;&#xA;&lt;p&gt;A random variable &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is defined as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Measurable_function&quot; rel=&quot;nofollow noreferrer&quot;&gt;measurable function&lt;/a&gt; from &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; to a measurable space, e.g. &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}$&lt;/span&gt;. This splits the above table by inserting the sample space&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|cccccc}&#xA;X &amp;amp; \lambda_1 &amp;amp; \lambda_2 &amp;amp; \dots &amp;amp; \lambda_n \\&#xA;\hline&#xA;\Omega &amp;amp; \omega_1 &amp;amp; \omega_2 &amp;amp; \dots &amp;amp; \omega_n \\&#xA;\hline&#xA;P &amp;amp; p_1 &amp;amp; p_2 &amp;amp; \dots &amp;amp; p_n \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(Technically, &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is defined on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; but when &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; is finite and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}=\mathcal{P}(\Omega)$&lt;/span&gt; additivity implies that &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is uniquely defined by its values on the singleton subsets of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;In this view a random variable can be thought of as a random experiment which is represented by the probability measure &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and which yields an abstract outcome &lt;span class=&quot;math-container&quot;&gt;$\omega_k$&lt;/span&gt; followed by post-processing which is described by the measurable function &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and which finds the experiment result &lt;span class=&quot;math-container&quot;&gt;$\lambda_k := X(\omega_k)$&lt;/span&gt;. Moreover, if the range of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is finite, the random variable can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X = \sum_k\lambda_k\mathbb{1}_{A_k}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{1}_E$&lt;/span&gt; is the indicator function of a set &lt;span class=&quot;math-container&quot;&gt;$E\subset \Omega$&lt;/span&gt; and the sets &lt;span class=&quot;math-container&quot;&gt;$A_k$&lt;/span&gt; form a &lt;em&gt;partitioning&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;, i.e. they are disjoint subsets of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; whose union is &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;. Note that in terms of the indicator functions, the last condition can be stated as &lt;span class=&quot;math-container&quot;&gt;$\mathbb{1}_{A_i}\mathbb{1}_{A_j} = \delta_{ij}\mathbb{1}_{A_i}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_k\mathbb{1}_{A_k} = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Projection-valued measures and observables&lt;/h2&gt;&#xA;&lt;p&gt;In elementary quantum mechanics we construct observables by assigning projectors to possible outcomes and combining them to form a Hermitian operator, e.g. an observable &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; taking values &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$k=1,\dots,n$&lt;/span&gt; with respective projectors &lt;span class=&quot;math-container&quot;&gt;$|k\rangle\langle k|$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$X=\sum_k\lambda_k|k\rangle\langle k|$&lt;/span&gt; or in table format&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|cccccc}&#xA;X &amp;amp; \lambda_1 &amp;amp; \lambda_2 &amp;amp; \dots &amp;amp; \lambda_n \\&#xA;\hline&#xA;\pi &amp;amp; |1\rangle\langle 1| &amp;amp; |2\rangle\langle 2| &amp;amp; \dots &amp;amp; |n\rangle\langle n|\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As before, in the more abstract approach using measure theory we introduce a sample space &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; and a &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt;-algebra &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt;. In place of a probability measure &lt;span class=&quot;math-container&quot;&gt;$P: \mathcal{F} \to \mathbb{R}_{\ge0}$&lt;/span&gt;, we define a projection-valued measure &lt;span class=&quot;math-container&quot;&gt;$\pi: \mathcal{F} \to L_H(\mathcal{H})$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H})$&lt;/span&gt; is the space of Hermitian operators on a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi(E)$&lt;/span&gt; is a projector for every event &lt;span class=&quot;math-container&quot;&gt;$E\in\mathcal{F}$&lt;/span&gt;. Moreover, for any partitioning &lt;span class=&quot;math-container&quot;&gt;$A_k$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; we require that &lt;span class=&quot;math-container&quot;&gt;$\pi(A_i)\pi(A_j) = \delta_{ij}\pi(A_i)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_k\pi(A_k)=I$&lt;/span&gt;. For each state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, this gives us a probability measure &lt;span class=&quot;math-container&quot;&gt;$P_\psi: \mathcal{F} \to \mathbb{R}_{\ge0}$&lt;/span&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$P_\psi(E) = \langle\psi|\pi(E)|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Defining &lt;span class=&quot;math-container&quot;&gt;$\Omega = \{\omega_1, \dots, \omega_n\}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}=\mathcal{P}(\Omega)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\pi(A) = \sum_{\omega_k\in A}|k\rangle\langle k|$&lt;/span&gt; we can then write &lt;span class=&quot;math-container&quot;&gt;$X=\sum_k\lambda_k\pi(\{\omega_k\})$&lt;/span&gt; or in table format&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{c|cccccc}&#xA;X &amp;amp; \lambda_1 &amp;amp; \lambda_2 &amp;amp; \dots &amp;amp; \lambda_n \\&#xA;\hline&#xA;\Omega &amp;amp; \omega_1 &amp;amp; \omega_2 &amp;amp; \dots &amp;amp; \omega_n \\&#xA;\hline&#xA;\pi &amp;amp; |1\rangle\langle 1| &amp;amp; |2\rangle\langle 2| &amp;amp; \dots &amp;amp; |n\rangle\langle n| \\&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(As before, technically, &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; is defined on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt; but when &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; is finite and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}=\mathcal{P}(\Omega)$&lt;/span&gt; additivity implies that &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; is uniquely defined by its values on the singleton subsets of &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt;.)&lt;/p&gt;&#xA;&lt;p&gt;In this view an observable can be thought of as a projective measurement which is represented by the PVM &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; and which given a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; yields an abstract outcome &lt;span class=&quot;math-container&quot;&gt;$\omega_k$&lt;/span&gt; followed by post-processing which is described by the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and which finds the measurement result &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt;. Moreover, if the spectrum of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is finite, the observable can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X = \sum_k\lambda_k\Pi_k\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\Pi_k=\pi(\{\omega_k\})$&lt;/span&gt; is the projector on the eigenspace of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt;. Note that the projectors are orthogonal, i.e. &lt;span class=&quot;math-container&quot;&gt;$\Pi_i\Pi_j = \delta_{ij}\Pi_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sum_k\Pi_k = I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Observables vs POVMs&lt;/h2&gt;&#xA;&lt;p&gt;The correspondence above shows that there is indeed merit in thinking of an observable as equivalent to a special kind of POVM - namely a PVM - together with post-processing of measurement results. Moreover, the correspondence explains why POVMs are of independent interest outside of their role in specifying observables. Specifically, POVMs are more general than PVMs since they are not limited to describing projective measurements. This situation also finds its mirror image in measure theory: just as probability measures are not the only interesting type of scalar measures so the PVMs are not the only interesting type of POVMs. This situation may be represented graphically as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{array}{|c|c|}&#xA;\hline&#xA;\text{random variables} &amp;amp; \\&#xA;\hline&#xA;\text{probability measures} &amp;amp; \text{other scalar measures} \\&#xA;\hline&#xA;\end{array}&#xA;\begin{array}{|c|c|}&#xA;\hline&#xA;\text{observables} &amp;amp; \\&#xA;\hline&#xA;\text{PVMs} &amp;amp; \text{other POVMs} \\&#xA;\hline&#xA;\end{array}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where positioning of one cell above another is to be interpreted as &amp;quot;builds upon&amp;quot; and where empty cells highlight the fact that the type of construction used to form random variables on top of probability measures and observables on top of PVMs does not easily generalize to other scalar measures and POVMs.&lt;/p&gt;&#xA;&lt;p&gt;This relationship explains why both observables and POVMs are useful and encountered regularly. On one hand, observables like random variables provide a higher level language than measures which includes convenient shortcuts for computing quantities such as mean and standard deviation (useful to express results such as the Heisenberg uncertainty principle). On the other, they are less general since they only model projective measurements.&lt;/p&gt;&#xA;&lt;p&gt;Note that general measurement may be emulated by projective measurement together with auxiliary subsystem and unitary evolution. Therefore, in a physical sense observables and POVMs describe the same fundamental physical reality. The utility of POVMs lies in convenient description of information theoretic aspects of processes more complex than projective measurement.&lt;/p&gt;&#xA;&lt;h2&gt;Remark on shared limitations&lt;/h2&gt;&#xA;&lt;p&gt;Finally, note that general quantum measurements (as described e.g. in section 2.2.3 on page 84 in Nielsen &amp;amp; Chuang) capture a wider class of processes than both observables and POVMs. Specifically, the letter two model measurement statistics, but fail to provide the most general way to compute post-measurement state.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-18T02:12:04.183" LastActivityDate="2021-03-18T02:12:04.183" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16533" PostTypeId="1" AcceptedAnswerId="16538" CreationDate="2021-03-17T06:58:42.817" Score="5" ViewCount="114" Body="&lt;p&gt;Suppose I have an arbitrary qiskit &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate: &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta,\phi,\lambda)$&lt;/span&gt;. Is there a way I can find which axis the gate is rotating around? In other words, given any real numbers &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi,\lambda$&lt;/span&gt;, can I find the vector &lt;span class=&quot;math-container&quot;&gt;$\hat n = (n_x,n_y,n_z)$&lt;/span&gt; that the gate corresponds to, so that I can plot the axis of rotation on the Bloch sphere? I'm thinking about the y-z decomposition, but I'm still unable to find out the elements of &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt;. How can I figure that out? Thanks a lot for the help:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-05-13T17:27:43.950" LastActivityDate="2021-05-13T17:32:23.873" Title="Can I find the axis of rotation for any single-qubit gate?" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;bloch-sphere&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16534" PostTypeId="1" CreationDate="2021-03-17T07:20:52.677" Score="1" ViewCount="52" Body="&lt;p&gt;In HHL algorithm, after the quantum phase estimation, what is the angle of rotation i.e. what is the value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; in R&lt;span class=&quot;math-container&quot;&gt;$_y$&lt;/span&gt;(&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;) that is used in rotating ancilla qubit? How to find this angle of rotation without knowing the eigenvalues of matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;?&#xA;Is there any general method to find this angle of rotation for any &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;x&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pebR9.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pebR9.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15213" LastEditorUserId="15213" LastEditDate="2021-03-17T11:53:25.830" LastActivityDate="2021-03-17T11:53:25.830" Title="In HHL algorithm, how to find the angle of rotation of ancilla qubits?" Tags="&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16535" PostTypeId="1" CreationDate="2021-03-17T10:28:00.357" Score="2" ViewCount="170" Body="&lt;p&gt;&lt;strong&gt;Value&lt;/strong&gt; of a qubit and its &lt;strong&gt;state&lt;/strong&gt; - is there any difference between these two terms in sense of terminology?&lt;/p&gt;&#xA;&lt;p&gt;For example, can we name this state of a qubit also a value of a qubit:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle = \frac{1}{\sqrt{2}} |0\rangle + \frac{1}{\sqrt{2}} |1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(By &lt;em&gt;value&lt;/em&gt;, I don't mean &lt;em&gt;eigenvalue&lt;/em&gt;)&lt;/p&gt;&#xA;&lt;p&gt;UPD: By the way, I always use a word &amp;quot;state&amp;quot; for states like &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and never call it a &amp;quot;value&amp;quot;. The question is more about if someone use &amp;quot;value&amp;quot; for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, is it a complete mistake? For example, if you saw it on Wikipedia what would you say?&lt;/p&gt;&#xA;&lt;p&gt;UPD2: And what about states like &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;? They are without a doubt states but also frequently called value which doesn't look like a big mistake.&lt;/p&gt;&#xA;&lt;p&gt;UPD3: As for me, &amp;quot;value&amp;quot; more of a service word and by itself sounds not so clear as &amp;quot;result of a measurement&amp;quot;, which is more informative. For example, like in a statement: &amp;quot;the result of the measurement has a value 1&amp;quot;. What do you think?&lt;/p&gt;&#xA;" OwnerUserId="5787" LastEditorUserId="5787" LastEditDate="2021-04-02T20:04:53.990" LastActivityDate="2021-04-02T20:04:53.990" Title="Is there any difference between &quot;value of a qubit&quot; and its &quot;state&quot;?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;notation&gt;" AnswerCount="3" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16537" PostTypeId="2" ParentId="16535" CreationDate="2021-03-17T10:51:39.707" Score="2" Body="&lt;p&gt;Whenever you mention 'state' of a qubit, you are referring to the &amp;quot;Quantum State&amp;quot; defined in &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Mechanics&lt;/a&gt; as:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In quantum physics, a quantum state is a mathematical entity that provides a probability distribution for the outcomes of each possible measurement on a system.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a quantum 'state' via which we can access the probable 'values' that it can take, so for your example, the 'values' it can take is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and it's 'state' is &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$&lt;/span&gt;. Using which we can infer that the two values are equally probable.&lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2021-03-17T10:51:39.707" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16538" PostTypeId="2" ParentId="16533" CreationDate="2021-03-17T12:16:53.640" Score="3" Body="&lt;p&gt;You can derive an expression for the rotation axis by combining (1) the decomposition of your unitary &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; in the Pauli basis, and (2) by the representation of the general rotation operator &lt;span class=&quot;math-container&quot;&gt;$R_{\vec n}(\theta)$&lt;/span&gt; in terms of Paulis.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step (1)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_0, \sigma_x, \sigma_y, \sigma_z \}$&lt;/span&gt; describe the identity matrix (&lt;span class=&quot;math-container&quot;&gt;$\sigma_0 = \mathbb 1$&lt;/span&gt;) and Pauli matrices, which together form a basis of &lt;span class=&quot;math-container&quot;&gt;$U(2)$&lt;/span&gt;, which is the space of single-qubit gates. With the trace as dot-product you can write any matrix &lt;span class=&quot;math-container&quot;&gt;$O \in U(2)$&lt;/span&gt; in the basis of Pauli matrices as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;O &amp;amp;= \frac{1}{2} \left(\text{Tr}(O\sigma_0) \sigma_0 + \text{Tr}(O\sigma_x)\sigma_x + \text{Tr}(O\sigma_y)\sigma_y + \text{Tr}(O\sigma_z)\sigma_z \right) \\&#xA; &amp;amp;= \frac{1}{2} \left(\text{Tr}(O) \sigma_0 + \text{Tr}(O\sigma_x)\sigma_x + \text{Tr}(O\sigma_y)\sigma_y + \text{Tr}(O\sigma_z)\sigma_z \right) \\&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;This is looks like your typical decomposition of a vector into a basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O = \sum_{\omega \in \{0, x, y, z\}} b_\omega \sigma_\omega,&#xA;$$&lt;/span&gt;&#xA;where the basis coefficients are &lt;span class=&quot;math-container&quot;&gt;$b_\omega = \text{Tr}(O\sigma_\omega)/2)$&lt;/span&gt; and the basis &amp;quot;vector&amp;quot; (or here matrices) are &lt;span class=&quot;math-container&quot;&gt;$\sigma_\omega$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Step (2)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;We know that any single-qubit gate can be written as (see e.g. Nielsen &amp;amp; Chuang)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;O = e^{i\alpha} R_{\vec n}(\theta)&#xA;$$&lt;/span&gt;&#xA;where&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;R_{\vec n}(\theta) &amp;amp;= e^{i \theta/2 (n_x \sigma_x + n_y \sigma_y + n_z\sigma_z)} \\&#xA;&amp;amp;= \cos\frac{\theta}{2}\sigma_0 - i\sin\frac{\theta}{2}(n_x \sigma_x + n_y \sigma_y + n_z\sigma_z)&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The factor &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha}$&lt;/span&gt; is fixed by the determinant of &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; is a rotation the determinant is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; might not have a determinant of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. So we know that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;&amp;amp;\text{det}(O) = \text{det}(e^{i\alpha} R_{\vec n}) = e^{2i\alpha}\det(R_{\vec n}(\theta)) \\&#xA;&amp;amp;\Leftrightarrow e^{i\alpha} = \sqrt{\det(O)}&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Combining (1) and (2)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now that we know &lt;span class=&quot;math-container&quot;&gt;$e^{i\alpha}$&lt;/span&gt;  we can match the entries of the Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\vec n = (n_x, n_y, n_z)$&lt;/span&gt; with the basis coefficients above! I'll leave the math now out because this post is long enough but if you match&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;\frac{1}{2}\text{Tr}(O) &amp;amp;= e^{i\alpha}\cos\frac{\theta}{2}\text{ and } \\&#xA;\frac{1}{2}\text{Tr}(O\sigma_\omega) &amp;amp;= -i\sin\frac{\theta}{2} \text{ for } \omega = x, y, z&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You finally obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;\theta = 2\cos^{-1}\left(e^{-i\alpha}\frac{\text{Tr}(O)}{2}\right)&#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{aligned}&#xA;n_\omega = \frac{e^{-i\alpha}\text{Tr}(O\sigma_\omega)}{-2i \sin(\theta/2)} &#xA;\end{aligned}&#xA;\end{equation}&lt;/span&gt;&#xA;which you could possibly simplify further by plugging in the expression for &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, but, as many textbooks say, I'll leave that exercise for to the motivated reader. :)&lt;/p&gt;&#xA;&lt;p&gt;If you do this for e.g.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;S = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; i \end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;you obtain&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\alpha = \frac{\pi}{4}, \theta = \frac{\pi}{2}&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec n = (0, 0, 1).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-03-17T12:16:53.640" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16539" PostTypeId="1" CreationDate="2021-03-17T12:23:11.177" Score="1" ViewCount="47" Body="&lt;p&gt;I am working on an implementation of the RQAOA algorithm on the Maxcut problem in Cirq.&#xA;My graph G has n vertices. And after running a QAOA circuit with n qubits I obtain a state gammabeta (a vertical vector with 2^n entries).&lt;/p&gt;&#xA;&lt;p&gt;I want to calculate M(e) = &amp;lt;gammabeta|Z(e)|gammabeta&amp;gt; for all edges e of G.&lt;/p&gt;&#xA;&lt;p&gt;I want Z(e) to be an observable of the form &lt;span class=&quot;math-container&quot;&gt;$I\otimes \dots \otimes I \otimes Z_i \otimes I \otimes \dots \otimes I \otimes Z_j \otimes I \otimes \dots \otimes I$&lt;/span&gt; (two dimensional &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;'s),&#xA;with &lt;span class=&quot;math-container&quot;&gt;$i -1$&lt;/span&gt;  &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;'s in front if &lt;span class=&quot;math-container&quot;&gt;$Z_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$j -i -1$&lt;/span&gt; in the middle and &lt;span class=&quot;math-container&quot;&gt;$n - j - 1$&lt;/span&gt; behind &lt;span class=&quot;math-container&quot;&gt;$Z_j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That way I can use Z(e).expectation_from_state_vector(gammabeta, qubit_map=qubit_map)) to calculate M(e)&lt;/p&gt;&#xA;&lt;p&gt;The problem I ran into is that I do not know how to do &lt;span class=&quot;math-container&quot;&gt;$I \otimes Z$&lt;/span&gt; in cirq. If I write cirq.Z * cirq.Z I get &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt;, but if I do cirq.I * cirq.Z it does the regular product, and I get &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; back.&lt;/p&gt;&#xA;&lt;p&gt;Does any one know how to make observable Z(e)? Or altenatively how to compute the expectation value of a &lt;strong&gt;circuit&lt;/strong&gt; B with state vector a: &amp;lt;a|B|a&amp;gt;? Building the Z(e) circuit is easier, but I don't know how to calculate the expectation value if a state vector from one circuit, on another circuit.&lt;/p&gt;&#xA;" OwnerUserId="15201" LastEditorUserId="55" LastEditDate="2021-03-17T15:59:35.243" LastActivityDate="2021-03-17T16:24:27.537" Title="How to create an observable: 'Identity \tensor Pauli gate' in Cirq" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;tensor-product&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16540" PostTypeId="2" ParentId="16535" CreationDate="2021-03-17T15:30:41.667" Score="9" Body="&lt;p&gt;I'm not aware of any widespread technical distinction between the &amp;quot;value&amp;quot; and &amp;quot;state&amp;quot; of qubits. I'd expect any paper or textbook or presentation using such a distinction to define its terms before expecting them to be understood in different ways.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-17T16:13:17.243" LastActivityDate="2021-03-17T16:13:17.243" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16541" PostTypeId="2" ParentId="16539" CreationDate="2021-03-17T15:58:48.153" Score="3" Body="&lt;p&gt;You can use a &lt;code&gt;cirq.DensePauliString&lt;/code&gt; to represent a tensor product of Paulis:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gate = cirq.DensePauliString(&amp;quot;IIZZIZ&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;a, b, c, d, e, f = cirq.LineQubit.range(6)&#xA;op1 = gate(a, b, c, d, e, f)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It can be a bit tedious to specify all those identities, and to manage making sure you pass the right qubit into the right position, so I'd recommend directly using the sparse &lt;code&gt;cirq.PauliString&lt;/code&gt; instead (it's what you get anyways when you apply the dense gate to qubits):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;op2 = cirq.PauliString({c: &amp;quot;Z&amp;quot;, d: &amp;quot;Z&amp;quot;, f: &amp;quot;Z&amp;quot;})&#xA;assert op1 == op2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or, as a shorthand, you can create the sparse Pauli string by just multiplying Pauli terms together:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;op3 = cirq.Z(c) * cirq.Z(d) * cirq.Z(f)&#xA;assert op1 == op3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once you have a &lt;code&gt;cirq.PauliString&lt;/code&gt; you can do lots of useful stuff. Multiply it, raise it to a power, exponentiate it, create linear combinations, conjugate by Cliffords, etc, etc. And although I'm not sure what the latest greatest way to get expectation values is in cirq, I'd bet that method takes Pauli strings as an argument.&lt;/p&gt;&#xA;&lt;p&gt;Measuring a Pauli string can be done in a variety of ways. The easiest to program (and hardest to run on hardware) is with phase kickback onto a clean ancilla qubit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from typing import list&#xA;&#xA;def pauli_string_measurement(observable: cirq.PauliString, ancilla: cirq.Qid, key: str) -&amp;gt; List[cirq.Operation]:&#xA;    return [&#xA;        cirq.H(ancilla),&#xA;        observable.controlled_by(ancilla),&#xA;        cirq.H(ancilla),&#xA;        cirq.measure(ancilla, key=key),&#xA;    ]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(cirq.Circuit(pauli_string_measurement(&#xA;    observable=cirq.Z(c) * cirq.Z(d) * cirq.Z(f),&#xA;    ancilla=cirq.NamedQubit(&amp;quot;extra&amp;quot;),&#xA;    key=&amp;quot;out&amp;quot;,&#xA;)))&#xA;# 2: ───────────PauliString(+Z)──────────────────&#xA;#               │&#xA;# 3: ───────────Z────────────────────────────────&#xA;#               │&#xA;# 5: ───────────Z────────────────────────────────&#xA;#               │&#xA;# extra: ───H───@─────────────────H───M('out')───&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The easiest to run on hardware is to measure each qubit in the observable in the appropriate basis, and then xor them together:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;op = cirq.X(a) * cirq.Y(b) * cirq.Z(c)&#xA;print(cirq.Circuit(&#xA;    op.to_z_basis_ops(),&#xA;    cirq.measure(*op.qubits, key=&amp;quot;things_to_xor&amp;quot;),&#xA;))&#xA;# 0: ───Y^-0.5───M('things_to_xor')───&#xA;#                │&#xA;# 1: ───X^0.5────M────────────────────&#xA;#                │&#xA;# 2: ───I────────M────────────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-17T16:24:27.537" LastActivityDate="2021-03-17T16:24:27.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16543" PostTypeId="1" CreationDate="2021-03-17T16:16:25.627" Score="4" ViewCount="486" Body="&lt;p&gt;How do I get the names of all currently available IBMQ devices?&lt;/p&gt;&#xA;" OwnerUserId="5353" LastEditorUserId="55" LastEditDate="2021-03-18T10:57:23.640" LastActivityDate="2021-03-18T10:57:23.640" Title="How do I get the names of all currently available IBMQ devices?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16544" PostTypeId="1" AcceptedAnswerId="16548" CreationDate="2021-03-17T16:19:25.687" Score="5" ViewCount="62" Body="&lt;p&gt;I'm trying to plot 2 vectors on the same Bloch sphere. From the qiskit documentation &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.visualization.plot_bloch_vector.html&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, we can find &lt;code&gt;plot_bloch_vector(bloch, title='', ax=None, figsize=None, coord_type='cartesian')&lt;/code&gt;. So I'm not quite sure if we could plot 2 vectors (say &lt;code&gt;[0,0,1]&lt;/code&gt; and &lt;code&gt;[0,1,0]&lt;/code&gt;) on the same Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;Also, from the default visualization angle, some vectors might look like they're overlapping with the x-axis (e.g the figure below). Can I switch to another angle to visualize the sphere?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/z8Xz3.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/z8Xz3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks for the help:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-03-17T16:54:33.903" Title="Can I simultaneously plot 2 vectors on a single Bloch sphere and rotate the angle of visualization?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16545" PostTypeId="2" ParentId="16543" CreationDate="2021-03-17T16:22:52.347" Score="7" Body="&lt;p&gt;You can see the backends you can access directly on the &lt;a href=&quot;https://quantum-computing.ibm.com&quot; rel=&quot;noreferrer&quot;&gt;IBM Quantum tools&lt;/a&gt; by going on the top left corner of the page, click and then go to &lt;em&gt;Quantum Services&lt;/em&gt;, and click on &amp;quot;Yours&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Now, via Qiskit, you can do this, for example to access the open provider and get the backend &lt;code&gt;ibmq_athens&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')&#xA;print(provider.backends())&#xA;backend = provider.get_backend('ibmq_athens')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope this helps, tell me if you need more details on something! :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-03-17T16:22:52.347" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16548" PostTypeId="2" ParentId="16544" CreationDate="2021-03-17T16:54:33.903" Score="4" Body="&lt;p&gt;If you are on a Jupyter notebook, you can use kaleidoscope for that. It has a &lt;code&gt;block_sphere&lt;/code&gt; function that does exactly that. See &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.visualization.plot_bloch_vector.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the documentation for more info&lt;/a&gt;. To install it &lt;code&gt;pip install kaleidoscope&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can set several vectors in the sphere that can be rotated with the mouse.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from kaleidoscope import bloch_sphere&#xA;&#xA;bloch_sphere([[0,1,0], [0,0,1]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qCp4O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qCp4O.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-17T16:54:33.903" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16549" PostTypeId="2" ParentId="16543" CreationDate="2021-03-17T17:07:13.897" Score="4" Body="&lt;p&gt;If you have only one provider (which is the most common case) you can print all your backend names like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;IBMQ.load_account()&#xA;print([backend.name() for backend in IBMQ.providers()[0].backends()])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-17T17:07:13.897" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16550" PostTypeId="2" ParentId="6208" CreationDate="2021-03-17T17:28:04.783" Score="0" Body="&lt;p&gt;You are right. There is a slight typo. What the lemma is supposed to say is&#xA;&lt;span class=&quot;math-container&quot;&gt;$\omega=0.x_1 x_2 \ldots x_n x_{n+1} \ldots$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\omega=0.x_1 x_2 \ldots x_n + a$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$a \leq 2^{-(n+1)}$&lt;/span&gt;. In other words, &lt;span class=&quot;math-container&quot;&gt;$x=x_1, x_2, \ldots x_n$&lt;/span&gt; are the the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; digits of &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that as written, the lemma doesn't make much sense since the denominator of &lt;span class=&quot;math-container&quot;&gt;$p(x)$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$sin^2(\pi(\omega-x/2^n))=sin^2(0)=0$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt;. On the other hand, note that &lt;span class=&quot;math-container&quot;&gt;$$\lim_{a\rightarrow 0} p(x) = \lim_{b\rightarrow 0}\frac{1}{2^{2n}}\left(\frac{sin(2^n b)}{sin(b)}\right)^2=\lim_{b\rightarrow 0}\frac{1}{2^{2n}}\left(\frac{2^n b}{b}\right)^2 = 1$$&lt;/span&gt; since &lt;span class=&quot;math-container&quot;&gt;$sin(x) \approx x$&lt;/span&gt; for small &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. So if you extend &lt;span class=&quot;math-container&quot;&gt;$f(a)=p(0.x_1\ldots x_n + a)$&lt;/span&gt; continuously to &lt;span class=&quot;math-container&quot;&gt;$a=0$&lt;/span&gt;, then the lemma makes sense for the edge case as well.&lt;/p&gt;&#xA;" OwnerUserId="15221" LastEditorUserId="15221" LastEditDate="2021-03-17T18:00:58.453" LastActivityDate="2021-03-17T18:00:58.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16551" PostTypeId="1" CreationDate="2021-03-17T17:50:01.407" Score="2" ViewCount="40" Body="&lt;p&gt;Suppose I have two non-commuting operators, &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_{1,1}, \lambda_{1,2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_{2,1}, \lambda_{2,2}$&lt;/span&gt;, respectively. In order to determine how measuring one value for &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; (say &lt;span class=&quot;math-container&quot;&gt;$\lambda_{1,1}$&lt;/span&gt;) affects the probability of measuring a particular value for &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; I would want to write the particle in terms of a new basis given by the eigenvectors to get the probability of each outcome, right?&lt;/p&gt;&#xA;&lt;p&gt;I realize this question might not make perfect sense. I am self-teaching quantum computing from a linear algebra perspective.&lt;/p&gt;&#xA;" OwnerUserId="14964" LastActivityDate="2021-03-17T20:18:20.350" Title="How does measuring a value of one operator affect the probability of measuring a value for another operator?" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16552" PostTypeId="2" ParentId="16533" CreationDate="2021-03-17T19:49:57.103" Score="5" Body="&lt;p&gt;A generic &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; (special) unitary matrix decomposes in terms of Pauli matrices as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = a_0 I + i \sum_{j=1}^3 a_j \sigma_j,$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$a_j\in\mathbb R$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_{j=0}^3 a_j^2=1$&lt;/span&gt;.&#xA;One way to write this condition is to parametrise the coefficients as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$a_0 = \cos(\theta),&#xA;\qquad a_j = \sin(\theta) n_j$$&lt;/span&gt;&#xA;for any &lt;span class=&quot;math-container&quot;&gt;$\theta\in\mathbb R$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(n_1,n_2,n_3)\in\mathbb R^3$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\|\vec n\|=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The eigenvectors of such a matrix are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2\|\vec a\|(\|\vec a\|\mp a_3)}}\begin{pmatrix}a_3 \mp \|\vec a\| \\ a_1 + i a_2\end{pmatrix},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\|\vec a\|^2\equiv \sum_{j=1}^3 a_j^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Given an arbitrary complex vector &lt;span class=&quot;math-container&quot;&gt;$(\alpha,\beta)\in\mathbb C^2$&lt;/span&gt;, you can get the corresponding vector in the Bloch sphere via the mapping&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}\alpha\\\beta\end{pmatrix}&#xA;\longleftrightarrow&#xA;\begin{pmatrix}2\operatorname{Re}(\bar\alpha\beta) \\ 2\operatorname{Im}(\bar\alpha\beta) \\ |\alpha|^2-|\beta|^2\end{pmatrix}.$$&lt;/span&gt;&#xA;Putting these facts together you can get the Bloch representation of the eigenvectors of a generic &lt;span class=&quot;math-container&quot;&gt;$2\times2$&lt;/span&gt; special unitary matrix.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-13T17:32:23.873" LastActivityDate="2021-05-13T17:32:23.873" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16553" PostTypeId="2" ParentId="16551" CreationDate="2021-03-17T20:18:20.350" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;In order to determine how measuring one value for &lt;span class=&quot;math-container&quot;&gt;$U_1$&lt;/span&gt; (say &lt;span class=&quot;math-container&quot;&gt;$\lambda_{1,1}$&lt;/span&gt;) affects the probability of measuring a particular value for &lt;span class=&quot;math-container&quot;&gt;$U_2$&lt;/span&gt; I would want to write the particle in terms of a new basis given by the eigenvectors to get the probability of each outcome, right?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Pretty much, yes.&#xA;Given two observables (Hermitian operators) &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\calO}{{\mathcal O}}\calO_1,\calO_2$&lt;/span&gt;, &amp;quot;measuring &lt;span class=&quot;math-container&quot;&gt;$\calO_1$&lt;/span&gt;&amp;quot; results in collapsing the state you are measuring, call it &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, in one of the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\calO_1$&lt;/span&gt;, call this &lt;span class=&quot;math-container&quot;&gt;$|m_1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you then immediately afterwards measure &lt;span class=&quot;math-container&quot;&gt;$\calO_2$&lt;/span&gt;, to find the probabilities of finding each one of the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\calO_2$&lt;/span&gt; you compute the squared overlap between &lt;span class=&quot;math-container&quot;&gt;$|m_1\rangle$&lt;/span&gt; and said eigenvectors.&lt;/p&gt;&#xA;&lt;p&gt;About the general question of how measurements affect each other, it's hard to answer in full generality because it will depend a lot on the context and on what exactly you mean with &amp;quot;how&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;For example, if you are measuring a single-qubit state and the observables considered are two Pauli matrices, say &lt;span class=&quot;math-container&quot;&gt;$\calO_1=X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\calO_2=Y$&lt;/span&gt; (observe how they do not commute), then after the first measurement you will have maximal uncertainty about the results of the second measurement (in other words, the outcome probabilities for the second measurement are always &lt;span class=&quot;math-container&quot;&gt;$50/50$&lt;/span&gt;).&#xA;This happens because any pair of eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; have the same squared overlap (we say that the corresponding bases are &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Mutually_unbiased_bases&quot; rel=&quot;nofollow noreferrer&quot;&gt;mutually unbiased&lt;/a&gt;&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The canonical answer about why the commutator between the observables is relevant for their being compatible is the uncertainty principle. One can show that, given any pair of observables &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sigma_A \sigma_B \ge \lvert\langle AB\rangle - \langle A\rangle\langle B\rangle\rvert,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma_A^2\equiv \langle A^2\rangle-\langle A\rangle^2$&lt;/span&gt; are the variances. The right-hand side is lower bounded by the (expectation value of) the commutator &lt;span class=&quot;math-container&quot;&gt;$[A,B]$&lt;/span&gt;, which is the standard form of Heisenberg's uncertainty principle.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-17T20:18:20.350" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16554" PostTypeId="1" AcceptedAnswerId="16588" CreationDate="2021-03-17T20:40:03.880" Score="3" ViewCount="139" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a single-qubit state.&#xA;A standard way to characterise &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is to measure the expectation values of the Pauli matrices, that is, to perform projective measurements in the three mutually unbiased bases corresponding to the Pauli matrices, and collect the corresponding statistics.&lt;/p&gt;&#xA;&lt;p&gt;Each such measurement can be described by a projective measurement. Generally speaking, measuring in an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|u_1\rangle, |u_2\rangle\}$&lt;/span&gt; corresponds to the POVM&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{|u_1\rangle\!\langle u_1|, |u_2\rangle\!\langle u_2|\}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to describe the entire process of measuring the state in the various possible bases using a single POVM?&#xA;In other words, what does a POVM which is informationally complete for a single qubit look like?&#xA;Is there one that can be considered to directly correspond to the standard state tomography scheme?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="10480" LastEditDate="2021-03-19T23:41:49.503" LastActivityDate="2021-03-19T23:41:49.503" Title="What does the POVM corresponding to single-qubit state tomography look like?" Tags="&lt;measurement&gt;&lt;tomography&gt;&lt;povm&gt;" AnswerCount="2" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16555" PostTypeId="1" CreationDate="2021-03-18T03:10:11.587" Score="1" ViewCount="18" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\label{eqs.1}&#xA;\tilde{y}=\sum_{m=1}^{M}\alpha_{m}\kappa(x^{(m)},\tilde{x}) (1)&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\kappa(x^{(m)},\tilde{x})$&lt;/span&gt;defines the similarity between data and can be chosen beforehand.The weighting&lt;span class=&quot;math-container&quot;&gt;$\alpha=(\alpha_{1},...,\alpha_{M})^{T}$&lt;/span&gt;,for instance,can be determined by minimizing the least-square loss function&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\label{eqs.2}&#xA;L(\alpha)=\sum_{m=1}^{M}(\tilde{y}^{(m)}-y^{(m)})^{2}+\chi\sum_{m=1}^{M}\alpha_{m}^{2} (2)&#xA;\end{equation}&lt;/span&gt;&#xA;The combination of (1) and (2) is a kernel ridge regression. How to get the solution and prediction of nuclear ridge regression?&lt;/p&gt;&#xA;" OwnerUserId="15225" LastEditorUserId="15225" LastEditDate="2021-03-18T05:33:22.287" LastActivityDate="2021-03-18T05:33:22.287" Title="How to get the solution and prediction of nuclear ridge regression?" Tags="&lt;machine-learning&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-03-19T18:04:47.697" ContentLicense="CC BY-SA 4.0" />
  <row Id="16556" PostTypeId="2" ParentId="12336" CreationDate="2021-03-18T05:41:11.243" Score="1" Body="&lt;p&gt;The set &lt;span class=&quot;math-container&quot;&gt;$G_N$&lt;/span&gt; of all &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-fold tensor products of the identity and Pauli gates &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; is a basis of the real vector space &lt;span class=&quot;math-container&quot;&gt;$L_H$&lt;/span&gt; of Hermitian operators on &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits. Therefore, &lt;span class=&quot;math-container&quot;&gt;$K(t)\in L_H$&lt;/span&gt; can be written as a linear combination of elements in &lt;span class=&quot;math-container&quot;&gt;$G_N$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;K(t) = \sum_\alpha J_\alpha(t) P_\alpha\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$P_\alpha\in G_N$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$J_\alpha(t)\in\mathbb{R}$&lt;/span&gt;. The coefficients &lt;span class=&quot;math-container&quot;&gt;$J_\alpha$&lt;/span&gt; are time-dependent, because &lt;span class=&quot;math-container&quot;&gt;$P_\alpha$&lt;/span&gt; are not and &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; is. In other words, if coefficients &lt;span class=&quot;math-container&quot;&gt;$J_\alpha$&lt;/span&gt; were not time-dependent then the right-hand side of &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; would be constant, unlike the left-hand side.&lt;/p&gt;&#xA;&lt;p&gt;For terms with more than one non-identity Pauli operator, the coefficients can be interpreted as the strength of the corresponding type of interaction.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-18T05:55:05.957" LastActivityDate="2021-03-18T05:55:05.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16557" PostTypeId="1" AcceptedAnswerId="16558" CreationDate="2021-03-18T06:40:12.713" Score="2" ViewCount="53" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB} \approx_\varepsilon \rho_{AB}$&lt;/span&gt; in trace distance. Is there an explicit construction of some state &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}_{AB}$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB}, \rho'_A, \rho'_B, \rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; (but not &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;) such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tilde{\rho}_A = \rho_A, \tilde{\rho}_B = \rho_B$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;while ensuring that &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}_{AB}$&lt;/span&gt; is as close in trace distance to &lt;span class=&quot;math-container&quot;&gt;$\rho'_{AB}$&lt;/span&gt; as possible?&lt;/p&gt;&#xA;&lt;p&gt;To get some obvious answers out of the way, we have the trivial solution of &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho} = \rho_A\otimes\rho_B$&lt;/span&gt;. This satisfies the marginal condition but probably is not optimal in terms of the trace distance between &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A much cleverer attempt is shown in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15122/4831&quot;&gt;this answer&lt;/a&gt; to my previous question. Take&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tilde{\rho}_{AB} = \rho'_{AB} + (\rho_A - \rho'_A) \otimes \rho'_B + \rho'_A \otimes (\rho_B - \rho'_B) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but this construction is not guaranteed to be positive semidefinite for entangled pure states. Apart from that, it satisfies the requirement on the marginals and keeps &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}$&lt;/span&gt; close to &lt;span class=&quot;math-container&quot;&gt;$\rho'$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there anything else one can try?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2021-03-18T11:16:11.880" Title="Constructing a state with constraints on reduced states" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;&lt;trace-distance&gt;&lt;state-space-geometry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16558" PostTypeId="2" ParentId="16557" CreationDate="2021-03-18T11:16:11.880" Score="3" Body="&lt;p&gt;You could try solving this numerically using semidefinite programming.&lt;/p&gt;&#xA;&lt;p&gt;We know the trace norm of an operator &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; can be formulated as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\|X\|_1 &amp;amp;= \min_{Y,Z}\quad \frac12\mathrm{Tr}[Y+Z] \\&#xA;&amp;amp;\quad \mathrm{s.t.} \quad \begin{pmatrix} Y &amp;amp; X \\ X^* &amp;amp; Z \end{pmatrix} \geq 0.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Furthermore, we can write your problem as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;&amp;amp;\min_{\sigma}\quad \|\sigma_{AB} - \rho_{AB}'\|_1  \\&#xA;&amp;amp;\mathrm{s.t.}\quad \mathrm{Tr}_A[\sigma_{AB}] = \rho_B \\&#xA;&amp;amp;\qquad \mathrm{Tr}_B[\sigma_{AB}] = \rho_A \\&#xA;&amp;amp;\qquad \sigma_{AB} \geq 0.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;Combining the two problems we can solve for a given &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}'$&lt;/span&gt; the following SDP&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;&amp;amp;\min_{Y,Z,\sigma}\quad \frac12\mathrm{Tr}[Y+Z]  \\&#xA;&amp;amp;\mathrm{s.t.} \quad \begin{pmatrix} Y &amp;amp; \sigma_{AB} - \rho_{AB}' \\ \sigma_{AB} - \rho_{AB}' &amp;amp; Z \end{pmatrix} \geq 0 \\&#xA;&amp;amp;\qquad \mathrm{Tr}_A[\sigma_{AB}] = \rho_B \\&#xA;&amp;amp;\qquad \mathrm{Tr}_B[\sigma_{AB}] = \rho_A \\&#xA;&amp;amp;\qquad \sigma_{AB} \geq 0.&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;SDPs are fast to solve as long as the dimension of the system is not too large. Plus they should converge to the optima which you'll be able to read out from the solver.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-18T11:16:11.880" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16560" PostTypeId="1" AcceptedAnswerId="16561" CreationDate="2021-03-18T14:22:45.600" Score="1" ViewCount="34" Body="&lt;p&gt;I would like to know if it is possible to construct a set of quantum gates to do the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Start with a set of N qubits representing a number expressed in binary notation.&lt;/li&gt;&#xA;&lt;li&gt;The values in the various qubits are entangled in unknown ways with each other, and have unknown ratios of likelihood of being 1 or 0.&lt;/li&gt;&#xA;&lt;li&gt;calculate a new qubit whose probability of being 1 is the probability that the number represented by the N qubits exceeds &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is an externally provided (classical) parameter.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The objective is to create a quantum algorithm for general purpose optimization.&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="55" LastEditDate="2021-03-18T15:46:57.997" LastActivityDate="2021-03-18T15:46:57.997" Title="Threshold quantum gate" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16561" PostTypeId="2" ParentId="16560" CreationDate="2021-03-18T14:42:39.030" Score="2" Body="&lt;p&gt;You need to disambiguate what you mean by &amp;quot;calculate a qubits whose probability of being 1 is...&amp;quot;. Is the qubit allowed to be entangled with the others? What phase is it supposed to have?&lt;/p&gt;&#xA;&lt;p&gt;It sounds like you're just describing an arithmetic less-than comparison. A simple way to do it is to use an adder. Take your two n-qubit inputs and run them through an n+1 qubit subtractor, then run the bottom n qubits through an n bit adder. The extra qubit that came out of the subtractor is the carry overflow and contains the result of the comparison.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-03-18T14:42:39.030" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16563" PostTypeId="1" AcceptedAnswerId="16567" CreationDate="2021-03-18T18:47:34.687" Score="2" ViewCount="26" Body="&lt;p&gt;Say I have the two qubit system &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;           0 \\&#xA;           1 \\&#xA;           1 \\&#xA;           0&#xA;         \end{bmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I have two 2x2 unitary gates, one is a rotation by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; radians and the other is a rotation by &lt;span class=&quot;math-container&quot;&gt;$-\theta$&lt;/span&gt; radians. How would I apply one of these rotations to one qubit and the other to the other qubit? Can I do this with a single 4x4 gate?&lt;/p&gt;&#xA;" OwnerUserId="15233" LastActivityDate="2021-03-18T19:57:10.007" Title="How would I apply rotations to both qubits in a 2 qubit system?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;&lt;matrix-representation&gt;&lt;tensor-product&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16564" PostTypeId="1" CreationDate="2021-03-18T18:49:15.020" Score="4" ViewCount="106" Body="&lt;p&gt;I know that the two qubit gate generated by &lt;span class=&quot;math-container&quot;&gt;$H=X\otimes X$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\exp\{-\text{i}\theta X\otimes X\}=\cos{\theta} \mathbb1 \otimes \mathbb1 - \text{i} \sin{\theta} X \otimes X$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; Pauli matrix. Now, if we moved to the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H= X\otimes X + Y \otimes Y + Z \otimes Z$&lt;/span&gt;, how can we find the two qubit gate?&lt;/p&gt;&#xA;" OwnerUserId="15234" LastEditorUserId="10480" LastEditDate="2021-03-19T23:39:20.433" LastActivityDate="2021-03-19T23:39:20.433" Title="How to construct the two qubit gate generated by the Hamiltonian $H= X\otimes X + Y \otimes Y + Z \otimes Z $?" Tags="&lt;quantum-gate&gt;&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16565" PostTypeId="1" AcceptedAnswerId="16616" CreationDate="2021-03-18T19:13:51.937" Score="2" ViewCount="138" Body="&lt;p&gt;Define an &lt;em&gt;entanglement breaking channel&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; as a channel (CPTP map) of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(\rho) = \sum_a \operatorname{Tr}(\mu(a)\rho) \sigma_a\tag A$$&lt;/span&gt;&#xA;for some POVM &lt;span class=&quot;math-container&quot;&gt;$\{\mu(a)\}_a$&lt;/span&gt; and states &lt;span class=&quot;math-container&quot;&gt;$\sigma_a$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It is mentioned &lt;em&gt;e.g.&lt;/em&gt; in (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0302031&quot; rel=&quot;nofollow noreferrer&quot;&gt;Horodecki, Shor, Ruskai 2003&lt;/a&gt;) that &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is entanglement breaking &lt;em&gt;iff&lt;/em&gt; it &amp;quot;breaks entanglement&amp;quot;, that is, is such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\Phi\otimes I)\Gamma \quad\text{ is separable for every state } \Gamma.\tag B$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This equivalence is proved, I think, in pages 5 and 6 of the above reference, but I can't quite follow the exposition there. In particular, the proof that (A) implies (B) seems to rely on expressing the action of &lt;span class=&quot;math-container&quot;&gt;$\Phi\otimes I$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\Gamma$&lt;/span&gt; via a partial trace involving some operators &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; which however are not defined (there might be a typo somewhere in the text, I'm not sure).&lt;/p&gt;&#xA;&lt;p&gt;What are good ways to prove the equivalence between (A) and (B)?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-22T13:42:36.873" Title="Why are entanglement breaking channels, defined as $\Phi(\rho)=\sum_a \operatorname{Tr}(\mu(a)\rho)\sigma_a$, entanglement breaking?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;partial-trace&gt;&lt;povm&gt;&lt;entanglement-breaking-channels&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16566" PostTypeId="2" ParentId="16564" CreationDate="2021-03-18T19:52:10.327" Score="4" Body="&lt;p&gt;Perhaps not surprisingly, the gate is &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \theta (X \otimes X + Y \otimes Y + Z \otimes Z))$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;More usefully, the terms that are being summed happen to commute so you can decompose the problem into &lt;span class=&quot;math-container&quot;&gt;$\exp(-i \theta X \otimes X) \cdot \exp(-i \theta Y \otimes Y) \cdot \exp(-i \theta Z \otimes Z)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;from cirq import X, Y, Z&#xA;import math&#xA;&#xA;theta = math.pi / 6&#xA;a, b = cirq.LineQubit.range(2)&#xA;xx = math.e**(-1j * theta * X(a)*X(b))&#xA;yy = math.e**(-1j * theta * Y(a)*Y(b))&#xA;zz = math.e**(-1j * theta * Z(a)*Z(b))&#xA;print(cirq.unitary(cirq.Circuit(xx, yy, zz)).round(4))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[0.866-0.5j  0.   +0.j   0.   +0.j   0.   +0.j  ]&#xA; [0.   +0.j   0.433+0.25j 0.433-0.75j 0.   +0.j  ]&#xA; [0.   +0.j   0.433-0.75j 0.433+0.25j 0.   +0.j  ]&#xA; [0.   +0.j   0.   +0.j   0.   +0.j   0.866-0.5j ]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-03-18T19:52:10.327" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16567" PostTypeId="2" ParentId="16563" CreationDate="2021-03-18T19:57:10.007" Score="2" Body="&lt;p&gt;Suppose your &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; unitary gate is an &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation. Then you can create your &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; gate as follow:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U = RY(\theta)\otimes RY(-\theta)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, when apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to your state, you simply act &lt;span class=&quot;math-container&quot;&gt;$RY(\theta)$&lt;/span&gt; to the first qubit and &lt;span class=&quot;math-container&quot;&gt;$RY(-\theta)$&lt;/span&gt; to the second qubit.&lt;/p&gt;&#xA;&lt;p&gt;To see this more explicitly, first note that your state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}}$&lt;/span&gt; can be represented in a quantum circuit as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lWvdA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lWvdA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then now applying &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is equivalent to adding appropriate &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation to the appropriate qubit, which is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9U8oM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9U8oM.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-18T19:57:10.007" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16569" PostTypeId="2" ParentId="16565" CreationDate="2021-03-18T20:59:34.840" Score="2" Body="&lt;p&gt;That is indeed some weirdly written exposition with typos, but the result is correct.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi(\rho) = \sum_k R_k \text{Tr}(F_k\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_k(\rho)=R_k \text{Tr}(F_k\rho)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$\Gamma = \rho_1 \otimes \rho_2$&lt;/span&gt; we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I \otimes \Phi_k)(\Gamma) = \rho_1 \otimes \Phi_k(\rho_2) = \rho_1 \otimes R_k\text{Tr}(F_k\rho_2) = &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \rho_1\text{Tr}(F_k\rho_2) \otimes R_k = \text{Tr}_2(\rho_1\otimes F_k\rho_2) \otimes R_k =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \text{Tr}_2(I\otimes F_k \cdot \Gamma) \otimes R_k = \text{Tr}_2(I\otimes \sqrt{ F_k} \cdot \Gamma \cdot I\otimes \sqrt{F_k}) \otimes R_k.&#xA;$$&lt;/span&gt;&#xA;By linearity, it's true for every &lt;span class=&quot;math-container&quot;&gt;$\Gamma$&lt;/span&gt;, and also by linearity we can write that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I \otimes \Phi)(\Gamma) = \sum_k \text{Tr}_2(I\otimes\sqrt{ F_k} \cdot \Gamma \cdot I\otimes\sqrt{ F_k}) \otimes R_k&#xA;$$&lt;/span&gt;&#xA;This proves (A) =&amp;gt; (B) since for density matrix &lt;span class=&quot;math-container&quot;&gt;$\Gamma$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_2(I\otimes\sqrt{ F_k} \cdot \Gamma \cdot I\otimes \sqrt{ F_k}) =: \gamma_k Q_k$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\gamma_k&amp;gt;0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q_k$&lt;/span&gt; is a density matrix (they also have typo in the definition of &lt;span class=&quot;math-container&quot;&gt;$Q_k$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;To prove (B) =&amp;gt; (A) we take &lt;span class=&quot;math-container&quot;&gt;$\Gamma = |\beta\rangle\langle\beta|$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\beta\rangle = \frac{1}{\sqrt{d}}\sum_i |i\rangle|i\rangle$&lt;/span&gt; and use the separability of &lt;span class=&quot;math-container&quot;&gt;$(I \otimes \Phi )(\Gamma)$&lt;/span&gt;. That is, If&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(I \otimes \Phi )(|\beta\rangle\langle\beta|)=\sum_n p_n |v_n\rangle\langle v_n| \otimes |w_n\rangle\langle w_n|$$&lt;/span&gt;&#xA;then it can be showed that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi(\rho) = \Omega(\rho) := d\sum_n |w_n\rangle\langle w_n| \text{Tr}\big(\rho p_n \big(|v_n\rangle\langle v_n|\big)^T\big).$$&lt;/span&gt;&#xA;To prove &lt;span class=&quot;math-container&quot;&gt;$\Phi = \Omega$&lt;/span&gt; it's enough to show that &lt;span class=&quot;math-container&quot;&gt;$(I \otimes \Phi )(|\beta\rangle\langle\beta|) = (I \otimes \Omega )(|\beta\rangle\langle\beta|)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is the (C) =&amp;gt; (A) implication of Theorem 4 in the paper (that has a minor mistake).&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2021-03-22T13:42:36.873" LastActivityDate="2021-03-22T13:42:36.873" CommentCount="21" ContentLicense="CC BY-SA 4.0" />
  <row Id="16570" PostTypeId="2" ParentId="16533" CreationDate="2021-03-18T21:28:38.190" Score="2" Body="&lt;p&gt;Thanks all for reading and answering the question, just a correction for the mapping:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}\alpha\\\beta\end{pmatrix}&#xA;\longleftrightarrow&#xA;\begin{pmatrix}2\operatorname{Re}(\bar\alpha\beta) \\ 2\operatorname{Im}(\bar\alpha\beta)\\|\alpha|^2-|\beta|^2\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;This could be derived from the spherical-coordinate representation of &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt; (note that &lt;span class=&quot;math-container&quot;&gt;$n_z=\cos\theta$&lt;/span&gt;) and the single-qubit representation:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-03-18T21:28:38.190" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16571" PostTypeId="1" CreationDate="2021-03-18T22:00:15.690" Score="1" ViewCount="40" Body="&lt;p&gt;For&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \begin{bmatrix}x_{11} &amp;amp; x_{12} &amp;amp; x_{13} \\ x_{21} &amp;amp; x_{22} &amp;amp; x_{23} \\ x_{31} &amp;amp; x_{32} &amp;amp; x_{33}\end{bmatrix}, \qquad\rho \in \mathbb{C^3},$$&lt;/span&gt;&#xA;the Choi map is given as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\phi(\rho) \mapsto \begin{bmatrix}ax_{11}+bx_{22}+cx_{33} &amp;amp; -x_{12} &amp;amp; -x_{13} \\ -x_{21} &amp;amp; cx_{11}+ax_{22}+bx_{33} &amp;amp; -x_{23} \\ -x_{31} &amp;amp; -x_{32} &amp;amp; bx_{11}+cx_{22}+ax_{33}\end{bmatrix},$$&lt;/span&gt;&#xA;for real &lt;span class=&quot;math-container&quot;&gt;$a,b,c$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How do I find the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$(I \otimes \phi)(\rho')$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$\rho' \in \mathbb{C^3} \otimes \mathbb{C^3}$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Would it just be enough to take the CJ isomorphism of &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, let's call it &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;, and find &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(\rho W)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13539" LastEditorUserId="55" LastEditDate="2021-03-20T12:48:08.967" LastActivityDate="2021-03-20T12:48:08.967" Title="How do I tensor the choi map with identity?" Tags="&lt;entanglement&gt;&lt;entanglement-witness&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-03-21T21:52:41.493" ContentLicense="CC BY-SA 4.0" />
  <row Id="16572" PostTypeId="1" AcceptedAnswerId="16573" CreationDate="2021-03-18T22:03:10.013" Score="1" ViewCount="38" Body="&lt;p&gt;I have a 2 qubit circuit where I wish to measure the first qubit and the measurement outcome determines what operation to implement on qubit 2. The whole process can be simulated using the following operation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|0\rangle\langle0|\otimes H+|1\rangle\langle1|\otimes HS&#xA;\end{equation}&lt;/span&gt;&#xA;where H is a Hadamard gate and S is the phase gate, i.e. if the result is 0 I will measure in X basis and if it is 1 I will measure in Y basis. As a unitary this is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{pmatrix}&#xA;\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\&#xA;\frac{1}{\sqrt{2}}&amp;amp;-\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{i}{\sqrt{2}}\\&#xA;0&amp;amp;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{-i}{\sqrt{2}}\\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This can be implemented on IBM's simulator using &lt;code&gt;c_if&lt;/code&gt; but does anyone know how to implement this on the real IBM devices? I tried using transpile to see what gates it can be decomposed into. However this gave a very complicated matrix. Is there a simpler way to implement conditional operations on real IBM devices?&lt;/p&gt;&#xA;&lt;p&gt;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="9800" LastEditDate="2021-03-19T11:07:30.703" LastActivityDate="2021-03-19T11:07:30.703" Title="Operation conditioned on measurement result" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16573" PostTypeId="2" ParentId="16572" CreationDate="2021-03-18T23:38:45.677" Score="3" Body="&lt;p&gt;If you want to implement something like this, which can be visualized as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6utKU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6utKU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc= QuantumCircuit(q, c)&#xA;qc.measure(0,0)&#xA;qc.h(q[1]).c_if(c,0)&#xA;qc.sdg(q[1]).c_if(c,1)&#xA;qc.h(q[1]).c_if(c,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then  I don't think you will be able to run it as it on the hardware, since the  &lt;code&gt;c_if&lt;/code&gt; operation is &lt;strong&gt;not yet implementable&lt;/strong&gt; directly.&lt;/p&gt;&#xA;&lt;p&gt;So to side step this, you need to use deferred measurement principle, which is what you mentioned... as you have determined that the whole process can be simulated by the unitary matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;U = \begin{pmatrix}&#xA;\frac{1}{\sqrt{2}}&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\&#xA;\frac{1}{\sqrt{2}}&amp;amp;-\frac{1}{\sqrt{2}}&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{i}{\sqrt{2}}\\&#xA;0&amp;amp;0&amp;amp;\frac{1}{\sqrt{2}}&amp;amp;\frac{-i}{\sqrt{2}}\\&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which you can decomposed into:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2hOWH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2hOWH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't think this is too long of a circuit. Although the transpiled circuit (based on the &lt;strong&gt;new&lt;/strong&gt; native gates set of IBM's hardware &lt;span class=&quot;math-container&quot;&gt;$\{CX, ID, RZ, SX, X \}$&lt;/span&gt;),&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4J0d8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4J0d8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;looks quite long... however, I think it is still doable. I don't think there is any other way around in general if you want to perform conditional statement at the moment though so this is probably the only way.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-18T23:38:45.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16574" PostTypeId="2" ParentId="16564" CreationDate="2021-03-19T01:22:40.307" Score="4" Body="&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; The two-qubit gate corresponding to the Hamiltonian is the SWAP gate.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; that squares to identity &lt;span class=&quot;math-container&quot;&gt;$A^2=I$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta A} = I\cos\theta +iA\sin\theta$&lt;/span&gt;. In our case the Hamiltonian does not square to identity&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(X\otimes X + Y\otimes Y + Z\otimes Z)^2 \ne I\otimes I.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, we can tweak it by adding a constant term since this only affects the unobservable global phase. We note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{I\otimes I + X\otimes X + Y\otimes Y + Z\otimes Z}{2} = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix} = \text{SWAP}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;does square to identity. Thus, we can write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(-\frac{i\gamma}{2}(I\otimes I + X\otimes X + Y\otimes Y + Z\otimes Z)\right) = I\cos\gamma -\text{SWAP}\, i\sin\gamma&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which means that the Hamiltonian generates the fractional SWAP gate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(-\frac{i\gamma}{2}(X\otimes X + Y\otimes Y + Z\otimes Z)\right) = e^{\frac{i\gamma}{2}}(I\cos\gamma -\text{SWAP}\, i\sin\gamma).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$\theta=\frac{\gamma}{2}=k\frac{\pi}{4}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an odd integer then the evolution swaps the two qubits and when &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is an even integer then it acts as identity.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If SWAP is unavailable, the evolution generated by the Hamiltonian can also be implemented for example using two CNOTs and a controlled rotation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exp\left(-\frac{i\gamma}{2}(X\otimes X + Y\otimes Y + Z\otimes Z)\right) \\= C_2NOT_1 \circ C_1R_{2,x}(2\gamma) \circ (R_{1,z}(\gamma) \otimes I_2) \circ C_2NOT_1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we also use an &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; gate to correct the phase of the central &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block of the matrix.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-19T01:56:47.570" LastActivityDate="2021-03-19T01:56:47.570" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16575" PostTypeId="1" AcceptedAnswerId="16576" CreationDate="2021-03-19T04:24:56.807" Score="2" ViewCount="48" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eRBhG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eRBhG.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this image, the orange box refers to the operator &lt;span class=&quot;math-container&quot;&gt;$\exp(-i P \frac{\pi}{4})$&lt;/span&gt; and the blue box refers to the Pauli Measurement &lt;span class=&quot;math-container&quot;&gt;$P'$&lt;/span&gt;. The idea behind these rules is to show how all the Pauli Product &lt;span class=&quot;math-container&quot;&gt;$\frac{\pi}{4}$&lt;/span&gt; rotations at the end of the circuit can be absorbed into the measurements.&lt;/p&gt;&#xA;&lt;p&gt;How would you prove these equations? In particular, I am looking for a proof that will help me reason about what happens if I measure say just the first qubit after performing a multi qubit orange box. For example, how would I absorb the orange box into the measurements in the following?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7bNE5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7bNE5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13497" LastActivityDate="2021-03-25T15:52:09.677" Title="How to reason about absorbing Pauli Product rotations into measurements?" Tags="&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16576" PostTypeId="2" ParentId="16575" CreationDate="2021-03-19T10:01:08.930" Score="4" Body="&lt;p&gt;First of all, let us consider an arbitrary unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. If we first apply &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and then measure a POVM &lt;span class=&quot;math-container&quot;&gt;$\{E_a\}$&lt;/span&gt;, then this is equivalent to doing nothing and measuring the POVM &lt;span class=&quot;math-container&quot;&gt;$\{U^\dagger E_a U\}$&lt;/span&gt; instead since &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Pr}[a|\rho] = \mathrm{tr}\left( E_aU \rho U^\dagger \right) =  \mathrm{tr}\left(  U^\dagger E_a U \rho  \right)$&lt;/span&gt;.&#xA;In particular, a Pauli measurement is given by the projectors &lt;span class=&quot;math-container&quot;&gt;$\frac 1 2 \left( \mathbb{I} \pm  P \right)$&lt;/span&gt; and the altered measurement is described by the&#xA;Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$O = U^\dagger P U$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now note that &lt;span class=&quot;math-container&quot;&gt;$U=\exp(- i\frac \pi 4 P)$&lt;/span&gt; is a Clifford unitary if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a Pauli operator. Thus, absorbing the action of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; into the measurement of a Pauli operator &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; will result in another Pauli measurement of &lt;span class=&quot;math-container&quot;&gt;$\pm Q'=U^\dagger Q U$&lt;/span&gt;. Note that the possible sign simply relabels the outcomes.&#xA;Next, it is clear that &lt;span class=&quot;math-container&quot;&gt;$U^\dagger Q U=Q$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; commute, thus we can remove &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; from the circuit. If not, a straightforward calculation shows that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{i\frac \pi 4 P}Qe^{- i\frac \pi 4 P} = i PQ \equiv \pm Q'.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you measure the first qubit after a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit Clifford gate, than this effectively the same as doing nothing and performing a Pauli measurement on many (&lt;span class=&quot;math-container&quot;&gt;$\leq n$&lt;/span&gt;) qubits (since &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; will generally map a Pauli operator on the first qubit to a Pauli operator supported on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits).&lt;/p&gt;&#xA;&lt;p&gt;The measurement in your final example consists of measuring four commuting Pauli operators &lt;span class=&quot;math-container&quot;&gt;$P_1,\dots,P_4$&lt;/span&gt; (a syndrome measurement). The projectors of the joint measurement are given as products &lt;span class=&quot;math-container&quot;&gt;$P_x = \prod_{i=1}^4 \frac 1 2 (\mathbb I + (-1)^{x_i} P_i)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x\in \{0,1\}^4$&lt;/span&gt;. To compute &lt;span class=&quot;math-container&quot;&gt;$UP_x U^\dagger$&lt;/span&gt;, we can thus individually transform the involved projectors.&lt;/p&gt;&#xA;&lt;p&gt;Let us use the above reasoning sequentially:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$X\otimes\mathbb{I}\otimes\mathbb{I}\otimes Z$&lt;/span&gt; anti-commutes with &lt;span class=&quot;math-container&quot;&gt;$Y\otimes\mathbb{I}\otimes\mathbb{I}\otimes\mathbb{I}$&lt;/span&gt;, thus we can replace the measurement of &lt;span class=&quot;math-container&quot;&gt;$-Y$&lt;/span&gt; on the first qubit by the measurement of &lt;span class=&quot;math-container&quot;&gt;$-iXY\otimes\mathbb{I}\otimes\mathbb{I}\otimes Z=Z\otimes\mathbb{I}\otimes\mathbb{I}\otimes Z$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The Pauli operators on the second and third qubit obviously commute with the unitary, so the measurements are unchanged.&lt;/li&gt;&#xA;&lt;li&gt;The last Pauli operator again anti-commutes, so we can replace it by the measurement of &lt;span class=&quot;math-container&quot;&gt;$X\otimes\mathbb{I}\otimes\mathbb{I}\otimes i ZY=X\otimes\mathbb{I}\otimes\mathbb{I}\otimes X$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Note that we obtained an entangling measurement between the first and the fourth qubit. This is in fact a Bell measurement as the joint eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$X\otimes X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z\otimes Z$&lt;/span&gt; are the four Bell states &lt;span class=&quot;math-container&quot;&gt;$\{|00\rangle \pm |11\rangle, |01\rangle \pm |10\rangle\}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-03-25T15:32:52.373" LastActivityDate="2021-03-25T15:32:52.373" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16577" PostTypeId="1" CreationDate="2021-03-19T11:48:02.240" Score="1" ViewCount="53" Body="&lt;p&gt;We know that the CNOT gate together with arbitrary SU(2) gates can be used to perfectly implement arbitrary SU(4) gates with 3 applications of the CNOT.&lt;/p&gt;&#xA;&lt;p&gt;I am using the Qiskit library and testing how different basis gates compare to the CNOT for different number of applications, when trying to approximate arbitrary SU(4) gates.&lt;/p&gt;&#xA;&lt;p&gt;As expected, the CNOT gives fid=1.0 for 3 applications, around 0.99 for 2, 0.7 for 1, and 0.5 for 0 applications (the numbers change depending on the SU(4) you are trying to approximate, but the fidelity is always 1.0 when using 3 CNOTS).&lt;/p&gt;&#xA;&lt;p&gt;My issue is that I'm getting similar results when I put in &lt;em&gt;any&lt;/em&gt; SU(4) as my basis gate, even the identity (on two qubits). Its telling me that with 3 applications of the identity and arbitrary SU(2) gates, I can perfectly implement any SU(4) with no approximation error.&lt;/p&gt;&#xA;&lt;p&gt;Is this an issue with Qiskit, or am I missing something? I thought that the two-qubit gate you use needs to be a universal two-qubit gate, such as the matrix given at the bottom of page two &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9505018.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I have changed the '&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.TwoQubitBasisDecomposer.html#qiskit.quantum_info.TwoQubitBasisDecomposer.num_basis_gates&quot; rel=&quot;nofollow noreferrer&quot;&gt;num_basis_gates()&lt;/a&gt;' method from the 'TwoQubitBasisDecomposer()' class in order to output the total fidelity for &lt;em&gt;all&lt;/em&gt; applications of the basis gate (0,1,2 and 3), rather than just the maximum fidelity (I just removed the 'argmax[...] part from the return statement).&lt;/p&gt;&#xA;&lt;p&gt;Thanks for any help&lt;/p&gt;&#xA;" OwnerUserId="14819" LastActivityDate="2021-03-23T16:57:56.803" Title="Qiskit: 3 applications of identity with arbitrary SU(2) is universal?" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;ibm&gt;&lt;universal-gates&gt;&lt;compiling&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16578" PostTypeId="1" AcceptedAnswerId="16591" CreationDate="2021-03-19T12:45:34.603" Score="1" ViewCount="47" Body="&lt;p&gt;Does there exist a Hermitian matrix, &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; s.t &lt;span class=&quot;math-container&quot;&gt;$B^\prime = B + K$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$(B^\prime)^2 = c\cdot I$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$B = \sum_{i=1}^{n}\sigma_x^{(i)}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_x^{(i)}$&lt;/span&gt; is the Pauli X matrix acting on qubit &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix and &lt;span class=&quot;math-container&quot;&gt;$c \in \mathcal{R}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If so, what is &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; and what is the commutative relationship with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;? Can we have &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; that commutes with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$n=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$K=\sigma_x$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$c=4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$[K, B] = 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13901" LastEditorUserId="1939" LastEditDate="2021-03-20T18:43:57.447" LastActivityDate="2021-03-20T18:43:57.447" Title="Is there a matrix whose sum with the canonical Mixing Hamiltonian in Qaoa is proportional to the identity matrix?" Tags="&lt;pauli-gates&gt;&lt;qaoa&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16579" PostTypeId="2" ParentId="16565" CreationDate="2021-03-19T13:14:32.233" Score="2" Body="&lt;p&gt;That (A) implies (B) should be obvious from the physical intuition behind (A): A channel of the form (A) can be interpreted as performing a POVM measurement with elements &lt;span class=&quot;math-container&quot;&gt;$\mu_a$&lt;/span&gt;, and on obtaining outcome &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; preparing the state &lt;span class=&quot;math-container&quot;&gt;$\sigma_a$&lt;/span&gt;. It should be obvious that this breaks any entanglement, since it (destructively) measures the input.&lt;/p&gt;&#xA;&lt;p&gt;(Note that also proving this direction is a one-liner - the output will be &lt;span class=&quot;math-container&quot;&gt;$\mu_a$&lt;/span&gt; times the partial trace of the input with &lt;span class=&quot;math-container&quot;&gt;$\mu_a$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-19T13:14:32.233" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16580" PostTypeId="2" ParentId="16554" CreationDate="2021-03-19T13:49:09.630" Score="2" Body="&lt;h2&gt;POVM for standard QST in the Pauli bases&lt;/h2&gt;&#xA;&lt;p&gt;In standard single-qubit QST one measures in the Pauli bases, each with equal probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}$&lt;/span&gt;. As @Rammus has pointed out, this corresponds to the POVM&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{E_{m}\} = &#xA;\Big\{\tfrac{1}{3}|0\rangle\langle0|,\tfrac{1}{3}|1\rangle\langle1|,\tfrac{1}{3}|+\rangle\langle+|,\tfrac{1}{3}|-\rangle\langle-|,\tfrac{1}{3}|+i\rangle\langle+i|,\tfrac{1}{3}|-i\rangle\langle-i|\Big\}&#xA;$$&lt;/span&gt;&#xA;for the usual Pauli eigenstates.&lt;/p&gt;&#xA;&lt;p&gt;This is an informationally complete (IC-)POVM, as &lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}\{E_{m}\} = \mathcal{L}(\mathcal{H})$&lt;/span&gt; i.e. the POVM elements span the density operator space (of a single qubit) - and thus any valid quantum state can be reconstructed using the statistics of the outcomes of these POVMs.&lt;/p&gt;&#xA;&lt;h2&gt;Minimality&lt;/h2&gt;&#xA;&lt;p&gt;However, there is some degeneracy here, as there are &lt;span class=&quot;math-container&quot;&gt;$6$&lt;/span&gt; POVM elements, but a basis for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{L}(\mathcal{H})$&lt;/span&gt; needs only &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; elements. There are plenty of &lt;em&gt;minimal&lt;/em&gt; IC-POVMs, which just have four elements. They are often relatively impractical to actually implement, but can be interesting from a theoretical point of view.&lt;/p&gt;&#xA;&lt;p&gt;One could say that &lt;em&gt;any&lt;/em&gt; IC-POVM corresponds to a (state) tomography experiment, and any non IC-POVM &lt;em&gt;cannot&lt;/em&gt; correspond to a proper QST experiment, as only the IC-POVM's span the density operator space.&lt;/p&gt;&#xA;&lt;p&gt;Thus, any set of PSD operators &lt;span class=&quot;math-container&quot;&gt;$\{E_{m}\}$&lt;/span&gt; for which:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sum_{m}{E_{m}} = I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\mathrm{span}(\{E_{m}\}) = \mathcal{L}(\mathcal{M})$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;is a POVM that corresponds to a valid QST. Moreover, if &lt;span class=&quot;math-container&quot;&gt;$|\{E_{m}\}| = d^{2}$&lt;/span&gt;, the POVM is &lt;em&gt;minimal&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Bonus: SIC-POVMs&lt;/h2&gt;&#xA;&lt;p&gt;Finally, as a sidenode due to the comments, a &lt;em&gt;symmetric informationally complete POVM&lt;/em&gt; or SIC-POVM  is a minimal IC POVM &lt;span class=&quot;math-container&quot;&gt;$\{G_{m}\}$&lt;/span&gt; for which the elements are completely &lt;em&gt;symmetric&lt;/em&gt; under the HS-inner product:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle G_{m}, G_{m'}\rangle_{HS} = a \not = a(m,m') \,\,\,(\forall m,m'| m \not=m').&#xA;$$&lt;/span&gt;&#xA;In one-qubit systems, the canonical example is (the projectors of):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{|0\rangle, \frac{1}{\sqrt{3}}(|0\rangle + \sqrt{2}|1\rangle, \frac{1}{\sqrt{3}}(|0\rangle + \sqrt{2}e^{\frac{2\pi i}{3}}|1\rangle, \frac{1}{\sqrt{3}}(|0\rangle + \sqrt{2}e^{\frac{4\pi i}{3}}|1\rangle\}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In higher dimensions, it's slightly more complicated - but that's ' a story for another time' :)&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-03-19T15:56:23.803" LastActivityDate="2021-03-19T15:56:23.803" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16581" PostTypeId="1" CreationDate="2021-03-19T14:17:36.077" Score="1" ViewCount="59" Body="&lt;p&gt;While I'm simulating one Big quantum circuit in Qiskit, I wonder how we can divide one big quantum circuit into several sub-circuits. I looked in Qiskit API documents, but I couldn't find it.&lt;/p&gt;&#xA;&lt;p&gt;Is there anyway that I can do that?&lt;/p&gt;&#xA;" OwnerUserId="10028" LastEditorUserId="15213" LastEditDate="2021-03-22T22:03:15.970" LastActivityDate="2021-03-22T22:03:15.970" Title="How to divide one quantum circuit into multiple sub-circuits in qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16582" PostTypeId="1" CreationDate="2021-03-19T15:24:11.997" Score="2" ViewCount="97" Body="&lt;p&gt;since today in the morning I am always getting the following error while running a job on IBM Sydney&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;'Error submitting job: '400 Client Error: Bad Request for url: &lt;a href=&quot;https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q-afrl/Groups/air-force-lab/Projects/quantum-sim/Jobs&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://api-qcon.quantum-computing.ibm.com/api/Network/ibm-q-afrl/Groups/air-force-lab/Projects/quantum-sim/Jobs&lt;/a&gt;. Topology without kind established., {&amp;quot;topologyId&amp;quot;:&amp;quot;5f61b942174c232ece451d1f&amp;quot;}, Error code: 2614.''&lt;/p&gt;&#xA;&lt;p&gt;The job script ran fine until yesterday at night and has not been altered at all.&#xA;Can you please tell me what is going on ? This is also not the error that I have seen in previous slack questions&lt;/p&gt;&#xA;" OwnerUserId="15242" LastEditorUserId="55" LastEditDate="2021-03-20T12:37:53.080" LastActivityDate="2021-03-20T12:37:53.080" Title="Error 400 on submission request on job that ran before" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16583" PostTypeId="1" CreationDate="2021-03-19T15:44:05.930" Score="1" ViewCount="24" Body="&lt;p&gt;I am attempting to run a job on Amazon Braket via the integrated Jupyter Notebooks, but I'm receiving an &lt;code&gt;&amp;quot;ExpiredTokenException when calling GetQuantumTask operation&amp;quot;&lt;/code&gt; upon attempts to submit the job. Would anyone have any guidance on how to fix this?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://stackoverflow.com/q/66710490/4063051&quot;&gt;Cross-posted on SO&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="14019" LastEditorUserId="55" LastEditDate="2021-03-21T12:03:17.437" LastActivityDate="2021-03-21T12:03:17.437" Title="Amazon Braket Token Exception" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;python&gt;&lt;amazon-braket&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-03-22T07:20:03.607" ContentLicense="CC BY-SA 4.0" />
  <row Id="16584" PostTypeId="2" ParentId="16582" CreationDate="2021-03-19T15:56:21.227" Score="4" Body="&lt;p&gt;This was due to temporary issue on IBM side. If you try to resubmit your job it should work as before.&lt;/p&gt;&#xA;" OwnerUserId="7853" LastActivityDate="2021-03-19T15:56:21.227" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16585" PostTypeId="5" CreationDate="2021-03-19T16:06:23.847" Score="0" Body="&lt;p&gt;See &lt;a href=&quot;https://aws.amazon.com/braket/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt; for more information about Amazon Braket.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-19T16:06:23.847" LastActivityDate="2021-03-19T16:06:23.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16586" PostTypeId="4" CreationDate="2021-03-19T16:06:23.847" Score="0" Body="For questions related to Amazon's quantum computing service known as Braket." OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-19T16:06:23.847" LastActivityDate="2021-03-19T16:06:23.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16588" PostTypeId="2" ParentId="16554" CreationDate="2021-03-19T17:26:08.290" Score="3" Body="&lt;p&gt;Quantum state tomography owes its power and flexibility to the fact that it supports a wide class of measurements. Any informationally complete POVM, i.e. one whose elements span the space &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H})$&lt;/span&gt; of Hermitian operators on the target system's Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; qualifies for use in QST.&lt;/p&gt;&#xA;&lt;p&gt;One way to highlight the generality of QST with respect to the choice of POVM is to cast it as a vector reconstruction problem. Every orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}$&lt;/span&gt; of a vector space &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; has the reconstruction property that &lt;span class=&quot;math-container&quot;&gt;$u = \sum_k \langle u, v_k\rangle v_k$&lt;/span&gt; for any vector &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;. It turns out that certain sets of vectors other than bases, namely &lt;a href=&quot;https://en.wikipedia.org/wiki/Frame_(linear_algebra)&quot; rel=&quot;nofollow noreferrer&quot;&gt;frames&lt;/a&gt;, also have a variant of the property. More precisely, for any vector &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and a frame &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}$&lt;/span&gt; we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$u = \sum_k \langle u, v_k\rangle\tilde{v_k}\tag1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\{\tilde{v_k}\}$&lt;/span&gt; is a frame &lt;a href=&quot;https://en.wikipedia.org/wiki/Frame_(linear_algebra)#Dual_frames&quot; rel=&quot;nofollow noreferrer&quot;&gt;dual&lt;/a&gt; to &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}$&lt;/span&gt;. The dual frame can be computed as &lt;span class=&quot;math-container&quot;&gt;$\tilde{v_k} = S^{-1}v_k$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the &lt;em&gt;frame operator&lt;/em&gt; defined as &lt;span class=&quot;math-container&quot;&gt;$S: u \mapsto \sum_k\langle u, v_k\rangle v_k$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Quantum state tomography can be analyzed as an application of frame theory to the task of reconstructing an element of &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H})$&lt;/span&gt;. Suppose that positive operators &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; sum to identity and span &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathcal{H})$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\{E_k\}$&lt;/span&gt; is both a POVM and a frame. Let &lt;span class=&quot;math-container&quot;&gt;$\{F_k\}$&lt;/span&gt; denote the frame dual to &lt;span class=&quot;math-container&quot;&gt;$\{E_k\}$&lt;/span&gt;. Then by &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; for any operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_k \mathrm{tr}(\rho E_k)F_k.\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This enables complete characterization of a quantum state, because the coefficients &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(\rho E_k)$&lt;/span&gt; are accessible experimentally while operators &lt;span class=&quot;math-container&quot;&gt;$F_k$&lt;/span&gt; can be derived using frame theory summarized above.&lt;/p&gt;&#xA;&lt;p&gt;The key point about this construction is that any POVM that is also a frame qualifies for use in quantum state tomography, so we need to make additional choices to exhibit a specific POVM.&lt;/p&gt;&#xA;&lt;h2&gt;Example 1: Standard QST&lt;/h2&gt;&#xA;&lt;p&gt;Any orthonormal basis is a frame which is its own dual. A well-known example of an orthonormal basis in &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathbb{C}^2)$&lt;/span&gt; is the set &lt;span class=&quot;math-container&quot;&gt;$\{I/\sqrt{2}, X/\sqrt{2}, Y/\sqrt{2}, Z/\sqrt{2}\}$&lt;/span&gt;. In this case equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; takes the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac12\left(\mathrm{tr}(\rho)I + \mathrm{tr}(\rho X)X+ \mathrm{tr}(\rho Y)Y + \mathrm{tr}(\rho Z)Z\right).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, the Pauli operators are not positive and hence not a POVM. We can obtain a POVM by replacing each operator in the set with its two eigenprojectors and renormalizing&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left\{\frac{|0\rangle\langle 0|}{3}, \frac{|1\rangle\langle 1|}{3},&#xA;\frac{|+\rangle\langle +|}{3}, \frac{|-\rangle\langle -|}{3}, &#xA;\frac{|{+i}\rangle\langle {+i}|}{3}, \frac{|{-i}\rangle\langle {-i}|}{3}, \right\}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This set spans &lt;span class=&quot;math-container&quot;&gt;$L_H(\mathbb{C}^2)$&lt;/span&gt;, because the original orthonormal basis does and is therefore an informationally complete POVM. The advantage of this POVM is that it is often relatively simple to realize experimentally.&lt;/p&gt;&#xA;&lt;h2&gt;Example 2: Minimal POVM&lt;/h2&gt;&#xA;&lt;p&gt;A frame spans its vector space, so the smallest informationally complete POVM has at least &lt;span class=&quot;math-container&quot;&gt;$\dim L_H(\mathbb{C}^2) = 4$&lt;/span&gt; elements. There are many examples that attain this minimum. For instance, define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;|\psi_0\rangle &amp;amp;= |0\rangle \\&#xA;|\psi_1\rangle &amp;amp;= \frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac23}|1\rangle \\&#xA;|\psi_2\rangle &amp;amp;= \frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac23}e^{\frac{2\pi i}{3}}|1\rangle \\&#xA;|\psi_3\rangle &amp;amp;= \frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac23}e^{\frac{4\pi i}{3}}|1\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and set &lt;span class=&quot;math-container&quot;&gt;$E_k = \frac12|\psi_k\rangle\langle\psi_k|$&lt;/span&gt; (see also &lt;a href=&quot;https://en.wikipedia.org/wiki/SIC-POVM#/media/File:Regular_tetrahedron_inscribed_in_a_sphere.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;this picture&lt;/a&gt;). Following standard frame theory we calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;F_0 &amp;amp;= \begin{pmatrix}&#xA;2 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix} \\&#xA;F_1 &amp;amp;= \begin{pmatrix}&#xA;0 &amp;amp; \sqrt{2} \\&#xA;\sqrt{2} &amp;amp; 1&#xA;\end{pmatrix} \\&#xA;F_2 &amp;amp;= \begin{pmatrix}&#xA;0 &amp;amp; -\frac{1+i\sqrt{3}}{\sqrt{2}} \\&#xA;-\frac{1-i\sqrt{3}}{\sqrt{2}} &amp;amp; 1&#xA;\end{pmatrix} \\&#xA;F_3 &amp;amp;= F_2^T&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which together with &lt;span class=&quot;math-container&quot;&gt;$E_k$&lt;/span&gt; and equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; provides a complete description for single-qubit QST using a minimal POVM.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-19T17:26:08.290" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16589" PostTypeId="1" AcceptedAnswerId="16632" CreationDate="2021-03-19T21:10:20.423" Score="4" ViewCount="143" Body="&lt;p&gt;Kitaev's quantum equivalent of the Cook-Levin Theorem, provides a polynomial time classical reduction from a QMA verification circuit to a sum &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; of local hamiltonians, such that the least eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$\leq a$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\geq b$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$b-a$&lt;/span&gt; vanishing as an inverse polynomial in the size of the original problem. If the gap vanishes faster, the problem is not known to be in QMA, and if the gap is larger the problem is easier.&lt;/p&gt;&#xA;&lt;p&gt;I read often, for example in &lt;a href=&quot;https://en.wikipedia.org/wiki/PCP_theorem#Quantum_analog_of_the_PCP_theorem&quot; rel=&quot;noreferrer&quot;&gt;wikipedia&lt;/a&gt;, that for constant gap QMA-hardness is a &lt;em&gt;conjecture&lt;/em&gt; (equivalent to a quantum version of the PCP theorem). However, I sometimes read the opposite: for example &lt;a href=&quot;https://arxiv.org/pdf/1301.2632.pdf&quot; rel=&quot;noreferrer&quot;&gt;Gharibian's phd thesis&lt;/a&gt; problem 1.7, or &lt;a href=&quot;https://arxiv.org/pdf/1302.0290.pdf&quot; rel=&quot;noreferrer&quot;&gt;Gosset, Nagaj&lt;/a&gt; definition 4 for the qsat subcase.&lt;/p&gt;&#xA;&lt;p&gt;Effectively, I don't understand why I cannot repeat each term in &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; a polynomial number of times, and obtain an equivalent problem with constant gap. Is this reasoning naively wrong, or maybe I am not reading the PCP statement correctly. Maybe &amp;quot;constant gap&amp;quot; is just a fast way to say something more specific?&lt;/p&gt;&#xA;&lt;p&gt;PS. I have this question already posted on the theoretical &lt;a href=&quot;https://cstheory.stackexchange.com/questions/48623/the-complexity-of-lh-with-constant-gap&quot;&gt;cs board&lt;/a&gt;, because I didn't notice there is this probably more specific one. Let me know if I have to cancel it.&lt;/p&gt;&#xA;" OwnerUserId="12548" LastEditorUserId="55" LastEditDate="2021-03-20T12:32:17.187" LastActivityDate="2021-03-22T17:57:43.930" Title="The complexity of LH with constant gap" Tags="&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16590" PostTypeId="2" ParentId="16589" CreationDate="2021-03-19T22:40:38.797" Score="3" Body="&lt;p&gt;The reasoning is naively wrong: When talking about the Local Hamiltonian problem with a specific promise gap (or spectral gap), you need to fix the overall energy scale. Usually, this means that the Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum h_i&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local terms &lt;span class=&quot;math-container&quot;&gt;$h_i$&lt;/span&gt; is chosen such that &lt;span class=&quot;math-container&quot;&gt;$\|h_i\|\le1$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|$&lt;/span&gt; the operator norm). Otherwise, any statement about the difficulty of the problem would be vacuous, as you could just rescale the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H\to cH$&lt;/span&gt; with some constant &lt;span class=&quot;math-container&quot;&gt;$c&amp;gt;0$&lt;/span&gt;, just as your &amp;quot;repeat each term &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; times&amp;quot; argument does.&lt;/p&gt;&#xA;&lt;p&gt;(Overall, one has to be more careful since it depends where the terms act and you can re-group terms, but if &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is constant this will not matter  (or apply them several times as you suggest). Usually, a safe way is to bound the total norm of all terms which act non-trivially on any given site.)&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2021-03-19T23:40:12.993" LastActivityDate="2021-03-19T23:40:12.993" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="16591" PostTypeId="2" ParentId="16578" CreationDate="2021-03-19T22:58:19.060" Score="2" Body="&lt;p&gt;Yes. Just pick &lt;span class=&quot;math-container&quot;&gt;$K=I-B$&lt;/span&gt;. It is hermitian, &lt;span class=&quot;math-container&quot;&gt;$B'=B+K=I$&lt;/span&gt; and thus &lt;span class=&quot;math-container&quot;&gt;$(B')^2=I$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-19T22:58:19.060" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16592" PostTypeId="1" CreationDate="2021-03-20T03:27:57.277" Score="1" ViewCount="60" Body="&lt;p&gt;What is the &amp;quot;Quantum mean value problem&amp;quot;? A definition I found was that it is &amp;quot;estimating the expected value of the tensor product observable on the output state of a quantum circuit&amp;quot;. Does this mean that given some set of bits that we pass through some circuit, we try and guess what comes out of the other side?&lt;/p&gt;&#xA;&lt;p&gt;If anyone knows of any papers introducing this idea, that'd be awesome.&lt;/p&gt;&#xA;" OwnerUserId="15246" LastEditorUserId="55" LastEditDate="2021-03-20T12:33:47.007" LastActivityDate="2021-04-20T06:55:40.083" Title="What is the &quot;quantum mean value problem&quot;?" Tags="&lt;measurement&gt;&lt;tensor-product&gt;&lt;nisq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16593" PostTypeId="1" CreationDate="2021-03-20T06:24:32.400" Score="2" ViewCount="53" Body="&lt;p&gt;Given a Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, I can calculate the variance of the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$Var[H]$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ Var[H] = \langle H^2 \rangle -\langle H \rangle^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be decomposed as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \sum_i \alpha_i P_i \hspace{1 cm} P_i \in \{ I,X,Y,Z\}^{\otimes n} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence by linearity we have  &lt;span class=&quot;math-container&quot;&gt;$$\langle H \rangle = \sum_i \alpha_i \langle P_i \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the Variational Quantum Eigensolver (VQE), we want to minimize the above expression, that is, &lt;span class=&quot;math-container&quot;&gt;$\min \langle H \rangle_{|\psi (\theta) \rangle} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that if &lt;span class=&quot;math-container&quot;&gt;$|\psi (\theta)\rangle$&lt;/span&gt; is indeed an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$Var[H] = 0 $&lt;/span&gt;. And so one can verify whether they have indeed reached/found an eigenstate by performing such calculation.&lt;/p&gt;&#xA;&lt;h3&gt;&lt;strong&gt;The question is&lt;/strong&gt;  how do we calculate &lt;span class=&quot;math-container&quot;&gt;$\langle H^2 \rangle$&lt;/span&gt;?&lt;/h3&gt;&#xA;&lt;p&gt;Yes, I can decomposed &lt;span class=&quot;math-container&quot;&gt;$H^2$&lt;/span&gt; into sum of Pauli terms, that is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H^2 = \sum_k \beta_k P_k \hspace{1 cm} P_i \in \{ I,X,Y,Z\}^{\otimes n} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and then using the &lt;strong&gt;optimized&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|\psi (\theta) \rangle$&lt;/span&gt; I have found through VQE to perform &lt;span class=&quot;math-container&quot;&gt;$$\langle H^2 \rangle =  \langle \psi(\theta) | \sum_k \beta_k P_k | \psi(\theta) \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This would be the same process as I did to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle H \rangle$&lt;/span&gt;, applying the appropriate rotations to my circuit before measuring in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis...  Then once I have this, &lt;span class=&quot;math-container&quot;&gt;$\langle H^2 \rangle$&lt;/span&gt;, I can put it together with the expectation value I have found through VQE to calculate &lt;span class=&quot;math-container&quot;&gt;$Var[H]$&lt;/span&gt;. This is the naive way of doing it I guess...&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What is a better way to do this?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="55" LastEditDate="2021-03-20T12:22:59.113" LastActivityDate="2021-03-20T12:22:59.113" Title="How to calculate $\operatorname{Var}[H]$ in the context of VQEs?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16594" PostTypeId="2" ParentId="6572" CreationDate="2021-03-20T06:37:51.307" Score="1" Body="&lt;p&gt;Mathematically, if Alice measures her part of an entangled bipartite state (or does whatever she likes with her part), the local state of the Bob's part (described by density matrix) does not change. This means that no information is transferred from Alice to Bob by Alice manipulating her part of an entangled state, at all.&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2021-03-20T06:37:51.307" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16595" PostTypeId="1" AcceptedAnswerId="16601" CreationDate="2021-03-20T07:35:49.237" Score="1" ViewCount="57" Body="&lt;p&gt;I see the &lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.canon.qft&quot; rel=&quot;nofollow noreferrer&quot;&gt;QFT operation&lt;/a&gt; in the document given by Microsoft, but I don't know how to call it.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;operation QFT (qs : Microsoft.Quantum.Arithmetic.BigEndian) : Unit is Adj + Ctl&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Does this method need to be rewritten? How to set the parameters here? Can I have a brief example?&lt;/p&gt;&#xA;" OwnerUserId="15248" LastEditorUserId="10480" LastEditDate="2021-03-20T19:09:09.427" LastActivityDate="2021-03-20T19:09:09.427" Title="How to use QFT operation in Q#?" Tags="&lt;programming&gt;&lt;q#&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16596" PostTypeId="1" AcceptedAnswerId="16707" CreationDate="2021-03-20T08:03:11.060" Score="1" ViewCount="144" Body="&lt;p&gt;The Adiabatic Quantum Computer is implemented by slowly increasing the parameter s from 0 to 1 in the intermediate Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$[\hat{H}(s) = \hat{H}_{input} + (1-s)\hat{H}_{init} + s\hat{H}_{circuit}]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How to show that this process evolves the state within the manifold spanned by &lt;span class=&quot;math-container&quot;&gt;$\{ |\alpha(0)\rangle|0_c\rangle,|\alpha(1)\rangle|1_c\rangle...|\alpha(L)\rangle|L_c\rangle$&lt;/span&gt;. In other words I meant to say how to show that &lt;span class=&quot;math-container&quot;&gt;$\hat{H}(s)$&lt;/span&gt; does not map any state in this manifold to a state outside this manifold.&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\alpha(L)\rangle$&lt;/span&gt; is is the data qubit state after applying the &lt;span class=&quot;math-container&quot;&gt;$l_{th}$&lt;/span&gt; logic gate ,i.e &lt;span class=&quot;math-container&quot;&gt;$|\alpha(l)\rangle = \hat{U}_l...\hat{U}_1|0\rangle^{\otimes n}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{H}_{input} = \sum_{i=1}^n|1_i\rangle\langle1_i|\otimes|0_c\rangle\langle0_c|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{H}_{init} = \sum_{j=1}^L|j_c\rangle\langle j_c|$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{H}_{circuit} =  \sum_{l=1}^L \hat{I} \otimes |(l-1)_c\rangle\langle(l-1)_c| - \hat{U}_l \otimes |l_c\rangle\langle(l-1)_c| - \hat{U}_l^\dagger \otimes |(l-1)_c\rangle\langle l_c|+  \hat{I} \otimes |l_c\rangle\langle l_c|$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14787" LastActivityDate="2021-03-26T20:18:14.233" Title="Adiabatic Quantum Computer e intermediate Hamiltonian evolves the state within the manifold" Tags="&lt;mathematics&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16597" PostTypeId="1" AcceptedAnswerId="16598" CreationDate="2021-03-20T14:58:49.477" Score="6" ViewCount="132" Body="&lt;p&gt;In linear algebra one often concerns oneself with the &lt;em&gt;spectral gap&lt;/em&gt; of a given matrix, which may be defined as the difference between the smallest and second-smallest eigenvalue (or, depending on convention and context, between the largest and second-largest eigenvalue).  In computational complexity one often concerns oneself with a &lt;em&gt;promise gap&lt;/em&gt; of a given problem, which may be loosely defined as a difference of some variable between accepting and rejecting inputs.&lt;/p&gt;&#xA;&lt;p&gt;The different meanings of &amp;quot;gap&amp;quot; appear to overlap in certain problems of quantum computing.  For example a &lt;em&gt;promise gap&lt;/em&gt; is used in the &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt;-complete problem of determining the ground energy of a Hamiltonian - e.g. a promise that the ground energy of the given Hamiltonian is either less than a first value or greater than a second value, but we are also concerned with the &lt;em&gt;spectral gap&lt;/em&gt; of the considered Hamiltonian, which may affect the general dynamics of the Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;I'd like to know whether there is any relation between the two different meanings of &amp;quot;gap&amp;quot;.  For example:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In certain formulations of &lt;span class=&quot;math-container&quot;&gt;$\mathsf{QMA}$&lt;/span&gt;-complete or &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;-complete problems, can the spectral gap be smaller than the promised gap?  What would be the implications of the promise gap being larger than the spectral gap?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In general the larger the promise gap the easier the problem may be; similarly the larger the spectral gap the easier the problem may be.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-03-23T18:04:27.920" LastActivityDate="2021-03-23T18:04:27.920" Title="How is a promise gap related to a spectral gap?" Tags="&lt;complexity-theory&gt;&lt;terminology&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16598" PostTypeId="2" ParentId="16597" CreationDate="2021-03-20T15:52:35.737" Score="7" Body="&lt;p&gt;The spectral gap is pretty much independent of the promise gap.&lt;/p&gt;&#xA;&lt;p&gt;(First off, my feeling is that &amp;quot;promise gap&amp;quot; is a little bit misleading, though formally correct: What it really refers to, in essence, is the &lt;em&gt;accuracy&lt;/em&gt; you are aiming for in determining the energy of the Hamiltonian. One way is to guarantee that the problem does not have a ground state energy inside  the &amp;quot;promise gap&amp;quot;, but you can equivalently just as much allow your algorithm to fail for instances which have an energy inside the gap. But I will consider the &amp;quot;promise&amp;quot; version in the following.)&lt;/p&gt;&#xA;&lt;p&gt;To be concrete, take a problem in &lt;span class=&quot;math-container&quot;&gt;$\mathrm{QMA}_1$&lt;/span&gt;, that is, where a &amp;quot;yes&amp;quot; instance has a perfectly accepting verifier, and put it into the Kitaev QMA construction. In a &amp;quot;yes&amp;quot; instance, the resulting Hamiltonian will have ground state energy 0 and a 1/poly(N) spectral gap, and in the latter case, the Hamiltonian will have a 1/poly(N) ground state energy, and the spectrum can be pretty much anything, in particular, the spectral gap of the &amp;quot;no&amp;quot; Hamiltonian can be exponentially small, or even less.&lt;/p&gt;&#xA;&lt;p&gt;Whether this can be done for QMA problems as well seems to be linked to the problem whether proofs can be made unique -- see &lt;a href=&quot;https://arxiv.org/abs/0810.4840&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/0810.4840&lt;/a&gt;, which also discusses aspects related to the spectral gap.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-20T15:52:35.737" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16599" PostTypeId="1" AcceptedAnswerId="16623" CreationDate="2021-03-20T16:45:00.407" Score="1" ViewCount="77" Body="&lt;p&gt;I want to run this simple test on the IBM quantum computer &lt;em&gt;ibmq_lima&lt;/em&gt;, but it complains about the measurement. As you can see, there is one &amp;quot;measure&amp;quot;. The weird part is that it works if I change the &amp;quot;U&amp;quot; gate to &amp;quot;u3&amp;quot; gate. But, the &amp;quot;U&amp;quot; is a valid gate according to the OpenQASM 2.0 spec!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;h q[0];&#xA;U(1,2,3) q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="1859" LastEditDate="2021-03-21T21:35:32.627" LastActivityDate="2021-03-22T09:53:48.053" Title="IBM Quantum Experience complains &quot;Circuit needs at least one measure.&quot; But, the circuit does have one!" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16600" PostTypeId="2" ParentId="16599" CreationDate="2021-03-20T17:59:39.717" Score="1" Body="&lt;p&gt;It should have been a lower case &lt;code&gt;u&lt;/code&gt; instead. That is, something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;h q[0];&#xA;u(1,2,3) q[0];&#xA;measure q[0] -&amp;gt; c[0]; &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It should be noted that this is not just for the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate but other gates as well. They should be in lower case. For instance, the Hadamard gate usually denoted as &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;,but its implementation is &lt;code&gt;h&lt;/code&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$RX, RY, RZ, CX$&lt;/span&gt; have implementation as &lt;code&gt;rx,ry,rz,cx&lt;/code&gt;. &lt;span class=&quot;math-container&quot;&gt;$U_1, U_2, U_3$&lt;/span&gt; have implementation as &lt;code&gt;u1, u2, u3&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-20T21:25:00.080" LastActivityDate="2021-03-20T21:25:00.080" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16601" PostTypeId="2" ParentId="16595" CreationDate="2021-03-20T18:34:54.610" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.arithmetic.bigendian&quot; rel=&quot;nofollow noreferrer&quot;&gt;BigEndian&lt;/a&gt; is a data type that is effectively just a wrapper for an array of qubits. If you want to apply QFT to a qubit array &lt;code&gt;register&lt;/code&gt;, you need to convert it to &lt;code&gt;BigEndian&lt;/code&gt; first:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QFT(BigEndian(register));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-03-20T18:34:54.610" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16603" PostTypeId="1" AcceptedAnswerId="16617" CreationDate="2021-03-20T21:31:46.760" Score="1" ViewCount="61" Body="&lt;p&gt;It is a simple 5 bit circuit, but it has 20,000 lines of QASM code. I try to put it in the composer, but the &amp;quot;Saving...&amp;quot; beside the file name will stay there for hours. I never saw its completion.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Saving...&amp;quot; usually transition to &amp;quot;Saved&amp;quot; in a few seconds if the file has 100 lines of code.&lt;/p&gt;&#xA;&lt;p&gt;Has anybody succeeded in running a large file? How long do you have to wait to see the &amp;quot;Saved&amp;quot;?&lt;/p&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="55" LastEditDate="2021-03-21T12:08:05.757" LastActivityDate="2021-03-21T22:55:49.520" Title="Uploading 20,000 lines of code to IBM Quantum Composer stalls" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16604" PostTypeId="5" CreationDate="2021-03-20T23:21:53.660" Score="0" Body="&lt;p&gt;See &lt;a href=&quot;http://tph.tuwien.ac.at/%7Eoemer/doc/quprog.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Computation_Language&quot; rel=&quot;nofollow noreferrer&quot;&gt;wikipedia&lt;/a&gt; for more details.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-20T23:21:53.660" LastActivityDate="2021-03-20T23:21:53.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16605" PostTypeId="4" CreationDate="2021-03-20T23:21:53.660" Score="0" Body="For questions related to QCL, an early high-level quantum programming language with C-inspired syntax and standard library of quantum algorithms." OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-20T23:21:53.660" LastActivityDate="2021-03-20T23:21:53.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16606" PostTypeId="1" CreationDate="2021-03-21T01:00:24.553" Score="3" ViewCount="150" Body="&lt;p&gt;I am working with a tripartite system, but when I partially transpose the &lt;span class=&quot;math-container&quot;&gt;$8\times 8$&lt;/span&gt; density matrix I get two complex eigenvalues. I know the criteria for the positive and negative eigenvalues, but are they always real? If they don't, what do my complex eigenvalues physically mean? (I have already checked my matrix for any mistake.)&lt;/p&gt;&#xA;" OwnerUserId="15256" LastEditorUserId="10480" LastEditDate="2021-03-21T02:41:48.840" LastActivityDate="2021-03-21T07:24:20.387" Title="Does a partial transpose always have real eigenvalues?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;partial-transpose&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16607" PostTypeId="2" ParentId="16606" CreationDate="2021-03-21T02:36:26.127" Score="3" Body="&lt;p&gt;Yes, the partial transpose takes Hermitian matrices to Hermitian matrices and consequently the eigenvalues of the partial transpose of a Hermitian matrix are all real.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt; For concreteness, suppose that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a three-qubit state. Expanding &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in the Pauli basis we write&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_{P,Q,R\in\{I,X,Y,Z\}} a_{P,Q,R}P\otimes Q \otimes R.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is Hermitian if and only if the coefficients &lt;span class=&quot;math-container&quot;&gt;$a_{P,Q,R}$&lt;/span&gt; are real. Now, the partial transpose of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with respect to say the first subsystem is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\rho^{\Gamma_1} &amp;amp;= \sum_{P,Q,R\in\{I,X,Y,Z\}} a_{P,Q,R}P^T\otimes Q \otimes R \\&#xA;&amp;amp;= \sum_{P,Q,R\in\{I,X,Y,Z\}} b_{P,Q,R}P\otimes Q \otimes R.&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$I^T=I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X^T=X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y^T=-Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z^T=Z$&lt;/span&gt;. Therefore, &lt;span class=&quot;math-container&quot;&gt;$b_{P,Q,R} = -a_{P,Q,R}$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$P=Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b_{P,Q,R} = a_{P,Q,R}$&lt;/span&gt; otherwise. In any case, the coefficients &lt;span class=&quot;math-container&quot;&gt;$b_{P,Q,R}$&lt;/span&gt; are real and consequently &lt;span class=&quot;math-container&quot;&gt;$\rho^{\Gamma_1}$&lt;/span&gt; is Hermitian.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;We can also convince ourselves of the above in a less formal way by writing down a Hermitian matrix and checking where each matrix element is moved by the partial transpose. It is easy to see that the movements of the elements above and below the main diagonal are mirror images of each other. Therefore, the partial transpose preserves the Hermitian symmetry of the matrix.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-21T02:36:26.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16608" PostTypeId="1" AcceptedAnswerId="16610" CreationDate="2021-03-21T03:39:37.673" Score="3" ViewCount="92" Body="&lt;p&gt;In VQE, for a single-qubit Hamiltonian, I can use a standard ansatz to make a state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and use two products to &lt;em&gt;compute&lt;/em&gt; the expectation value &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|{\cal H}|\psi\rangle$&lt;/span&gt;. As I vary the parameters to the ansatz I get very close to the minimal eigenvalue. That's good.&lt;/p&gt;&#xA;&lt;p&gt;In a physical setting, I can't do the multiplication. I have to measure in the Pauli Bases, which yields expectation values, and then - somehow - I should find the eigenvalues from the expectation values. There is a big hole in my understanding. For example, for this Hamiltonian:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  {\cal H} = 2.0 X + 0.5 Z&#xA;$$&lt;/span&gt;&#xA;The precise eigenvalues are [-2.0615528  2.0615528]. I make an ansatz with &lt;span class=&quot;math-container&quot;&gt;$R_x(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_y(\phi)$&lt;/span&gt;. Now, just as an initial experiment, I set these angles to 0.3, 0.7 to produce &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and compute &lt;span class=&quot;math-container&quot;&gt;$\psi' = {\cal H}\psi$&lt;/span&gt;. I measure &lt;span class=&quot;math-container&quot;&gt;$\psi'$&lt;/span&gt; in the computational basis (z-basis, projecting onto &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) and get an expectation value of 1.74. &lt;span class=&quot;math-container&quot;&gt;$\cal H$&lt;/span&gt; is not unitary, hence this unnormalized result. I modify the ansatz and add a Hadamard gate to &amp;quot;rotate&amp;quot; the x-axis into the z-axis. I measure again and get an expectation value of 2.403.&lt;/p&gt;&#xA;&lt;p&gt;So now what. How do I get from here to an eigenvalue / minimal energy state?&lt;/p&gt;&#xA;&lt;p&gt;Iterating over all angles &lt;span class=&quot;math-container&quot;&gt;$\theta, \phi$&lt;/span&gt; does not seem to yield meaningful values.&lt;/p&gt;&#xA;" OwnerUserId="11582" LastActivityDate="2021-03-21T06:00:40.863" Title="VQE - How to get from expectation value to eigenvalue?" Tags="&lt;hamiltonian-simulation&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16609" PostTypeId="1" CreationDate="2021-03-21T04:15:21.100" Score="1" ViewCount="58" Body="&lt;p&gt;I am trying to work with parametrized circuits in QISKIT. I can simply create parameterized circuits, bind value(s) to parameter(s), and execute/run all instances (after binding values for parameters) on different backends like ibmq_manhattan, ibmq_paris, etc.&lt;/p&gt;&#xA;&lt;p&gt;To dump the resulting circuits to QASM files, I use the “qasm()” method of the QuantumCircuit objects, and I see no problem. Here is a simple (random) QASM file that I create:&lt;/p&gt;&#xA;&lt;p&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[3];&#xA;creg c[3];&#xA;h q[0];&#xA;h q[1];&#xA;h q[2];&#xA;barrier q[0],q[1],q[2];&#xA;rx(beta) q[0];&lt;/p&gt;&#xA;&lt;p&gt;As you can see, the last line of the QASM file specifies a parameterized RX rotation, on qubit q[0] and the angle is (beta). As far as I am working with QuantumCircuit objects, I can deal with these parameters. However, after writing the circuit to a QASM file, I lose the functionality.&lt;/p&gt;&#xA;&lt;p&gt;More specifically, when I try to load/read the QASM file and create a QuantumCircuit, I face the following error:&lt;/p&gt;&#xA;&lt;p&gt;Code: circ = QuantumCircuit.from_qasm_file(filepath)&#xA;Error: qiskit.qasm.exceptions.QasmError: &amp;quot;Argument 'beta' in expression cannot be found, line 9 file …&lt;/p&gt;&#xA;&lt;p&gt;I also tried the following alternative (just in case):&#xA;Code: circ = QuantumCircuit.from_qasm_str(qasm_str)&#xA;and faced the same error. Here the “filepath” specifies the path to the QASM file, and I obtain the “qasm_str” via reading the QASM file.&lt;/p&gt;&#xA;&lt;p&gt;I checked the source code of the “from_qasm_file()” module in QISKIT, as well as “Qasm” class; however, I did not find any additional input argument/parameter to specify these parameters to the parser.&lt;/p&gt;&#xA;&lt;p&gt;I just need to read the (abovementioned) QASM file and re-create a QuantumCircuit object.&lt;/p&gt;&#xA;&lt;p&gt;I would appreciate it a lot if someone can help me in this regard.&lt;/p&gt;&#xA;&lt;p&gt;Thanks,&#xA;Ramin&lt;/p&gt;&#xA;" OwnerUserId="15258" LastEditorUserId="55" LastEditDate="2021-03-22T08:29:59.110" LastActivityDate="2021-03-22T08:29:59.110" Title="How to read QASM files for parametrized circuits (in QISKIT)? both from_qasm_file() and from_qasm_str() fail" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-circuit&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16610" PostTypeId="2" ParentId="16608" CreationDate="2021-03-21T04:39:41.590" Score="4" Body="&lt;p&gt;First, note that we can only measure in the computational basis in quantum computing (at least at the moment). But this is not a problem since&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle \psi | H | \psi \rangle = \langle \psi | 2X + 0.5 Z | \psi \rangle &amp;amp;= 2\langle \psi | X |\psi \rangle  + 0.5\langle \psi|Z|\psi\rangle \\&#xA; &amp;amp;= 2\langle \psi|HZH|\psi\rangle + 0.5\langle\psi|Z|\psi\rangle \\&#xA;&amp;amp;= 2\langle\psi H|Z|H\psi\rangle  + 0.5\langle\psi|Z|\psi\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This means we need to create to different quantum circuits to the problem. One for each term below. Now &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = U |\psi\rangle_{ref} $&lt;/span&gt;  where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{ref}$&lt;/span&gt; can be taken as &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; if you wish. The unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be taken as what you see fit. For instance, if you believe that the eigenstate will have only real coefficients then you can use take &lt;span class=&quot;math-container&quot;&gt;$U = RY(\theta)$&lt;/span&gt;. If taken &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to be &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; then we would have the following two circuits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IvZ4K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IvZ4K.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;To compute the expectation, you would need to do sufficient enough shots to build a statistical distribution. Since we measure in the computational (Z) basis, &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; corresponds to the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenspace, and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; corresponds to the &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; eigenspace.&lt;/p&gt;&#xA;&lt;p&gt;To see this more clearly, let's suppose you run 1000 shots experiment on circuit 1, to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | X | \psi \rangle$&lt;/span&gt;, and you recorded/measured 700 times the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and 300 times the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; from your 1000 shots. This implies, that &lt;span class=&quot;math-container&quot;&gt;$$\langle \psi | X | \psi \rangle  \approx \dfrac{700 - 300}{1000} = 0.4$$&lt;/span&gt;&#xA;Then similarly, you do 1000 shots experiment on your second circuit to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle \psi |Z| \psi \rangle$&lt;/span&gt; and you measured 800 times the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and 200 times the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then this implies &lt;span class=&quot;math-container&quot;&gt;$$ \langle \psi | Z | \psi \rangle \approx \dfrac{800 - 200}{1000} = 0.8$$&lt;/span&gt;&#xA;Putting it altogether, we have that &lt;span class=&quot;math-container&quot;&gt;$$\langle \psi | H | \psi \rangle \approx 2\cdot 0.4 + 0.5\cdot0.8 = 1.2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that I used the approximation symbol, &lt;span class=&quot;math-container&quot;&gt;$\approx$&lt;/span&gt; because to get the exact value, you must do &lt;span class=&quot;math-container&quot;&gt;$\infty$&lt;/span&gt; number of shots.&lt;/p&gt;&#xA;&lt;p&gt;Now that you have found what &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H \psi \rangle$&lt;/span&gt; is for that specific &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; value, you can change it in such a way that it will minimize &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H \psi \rangle$&lt;/span&gt;. So that at the next iteration, you expect something smaller, in our case, smaller than 1.2. There are many ways you can change &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, depending on what optimizer you want to use. Gradient based or Gradient free. There are many classical optimizers and each has its pro and con. Here, take a look at some of the optimizer that you can use &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;directly from Scipy&lt;/a&gt;. There are more sophisticated optimizer that aim specifically at Variational Quantum algorithms like VQE but those are not always available publicly so you have to write the code yourself. And you can invent your own optimizer that you think work best as well.&lt;/p&gt;&#xA;&lt;p&gt;An important thing to note here is that our cost function, &lt;span class=&quot;math-container&quot;&gt;$C(\theta) = \langle \psi | H | \psi \rangle$&lt;/span&gt;  is bounded by the variational principle. that is, we know that &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H | \psi \rangle \geq E_0$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; is the minimum eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = U(\theta) |\psi \rangle_{ref}$&lt;/span&gt;. Thus, by keep minimizing the expectation we found during our experiment by changing &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; in the right direction, we will indeed approach this minimum value &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If your Hamiltonian has a Pauli &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; in it, then you need to calculate &lt;span class=&quot;math-container&quot;&gt;$$\langle \psi | Y | \psi \rangle = \langle \psi | HSZHS^\dagger |\psi \rangle = \langle \psi HS | Z | HS^\dagger \psi \rangle $$&lt;/span&gt;&#xA;This means you need to first apply &lt;span class=&quot;math-container&quot;&gt;$S^\dagger$&lt;/span&gt; follow by the Hadamard gate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to your circuit before measuring in the computational (Z) basis. This can be visualized by the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bkSG9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bkSG9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-21T06:00:40.863" LastActivityDate="2021-03-21T06:00:40.863" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16611" PostTypeId="2" ParentId="16592" CreationDate="2021-03-21T06:30:55.747" Score="0" Body="&lt;p&gt;The (additive) quantum mean value problem can be defined this way:&lt;/p&gt;&#xA;&lt;p&gt;Given any constant &lt;span class=&quot;math-container&quot;&gt;$\epsilon &amp;gt; 0$&lt;/span&gt;, Hermitian observables &lt;span class=&quot;math-container&quot;&gt;$O_1,...,O_n$&lt;/span&gt;, and constant depth quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, output any &lt;span class=&quot;math-container&quot;&gt;$\tilde{\mu}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$| \tilde{\mu} - \langle0^n|U^{\dagger} (O_1 \otimes ... \otimes O_n)U |0^n \rangle| &amp;lt; \epsilon$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is very different from &amp;quot;guess[ing] what comes out the other side&amp;quot; given some set of input bits because, for example, we can have &lt;span class=&quot;math-container&quot;&gt;$O_i = |0\rangle\langle0|$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, which would amount to estimating the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$0^n$&lt;/span&gt; when measuring in the computational basis at the end of the circuit. Notice how this is a different task than &amp;quot;guessing what comes out the other side.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;For a reference take a look at this paper: &lt;a href=&quot;https://arxiv.org/abs/1909.11485&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1909.11485&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5988" LastActivityDate="2021-03-21T06:30:55.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16612" PostTypeId="2" ParentId="16606" CreationDate="2021-03-21T07:24:20.387" Score="3" Body="&lt;p&gt;Any matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; in the tensor product of two spaces can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = \sum_{ijkl} a_{ij,kl} E_{ij} \otimes E_{kl}, &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$E_{ij}$&lt;/span&gt; are matrix units and &lt;span class=&quot;math-container&quot;&gt;$a_{ij,kl}$&lt;/span&gt; are entries of the matrix &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that &lt;span class=&quot;math-container&quot;&gt;$E_{ij}^\dagger = \overline{E}_{ij}^T = E_{ji}$&lt;/span&gt;, so the condition&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = M^\dagger = \sum_{ijkl} \overline{a_{ij,kl}} E_{ji} \otimes E_{lk}, &#xA;$$&lt;/span&gt;&#xA;means&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\overline{a_{ij,kl}} = a_{ji,lk}. &#xA;$$&lt;/span&gt;&#xA;Partial transpose of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; equals&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(I \otimes T) (M) = M^{T_2} = \sum_{ijkl} a_{ij,kl} E_{ij} \otimes E_{kl}^T =&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;=\sum_{ijkl} a_{ij,kl} E_{ij} \otimes E_{lk}.&#xA;$$&lt;/span&gt;&#xA;Now, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(M^{T_2})^\dagger = \sum_{ijkl} \overline{a_{ij,kl}} E_{ji} \otimes E_{kl}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\overline{a_{ij,kl}} = a_{ji,lk}$&lt;/span&gt; you can see that &lt;span class=&quot;math-container&quot;&gt;$(M^{T_2})^\dagger = M^{T_2}$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$M^{T_2}$&lt;/span&gt; is Hermitian, thus it has real eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-03-21T07:24:20.387" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16613" PostTypeId="2" ParentId="16609" CreationDate="2021-03-21T13:24:19.860" Score="1" Body="&lt;p&gt;Parameterized circuit is not supported by the OpenQASM2 specification &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1707.03429&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;.qasm&lt;/code&gt; output is a bit of notation abuse. There are experimental ideas to support a more comprehensive circuit serialization format &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/5578&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/5578&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-21T13:24:19.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16614" PostTypeId="1" CreationDate="2021-03-21T16:44:32.723" Score="6" ViewCount="585" Body="&lt;p&gt;I am a little confused whether the entangled state and Bell state are the same thing? If they have a bit of contrast, what is the difference between them?&lt;/p&gt;&#xA;" OwnerUserId="14870" LastEditorUserId="15213" LastEditDate="2021-03-22T17:16:36.600" LastActivityDate="2021-03-22T17:16:36.600" Title="Are entangled and Bell states the same thing?" Tags="&lt;entanglement&gt;&lt;bell-basis&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16615" PostTypeId="2" ParentId="16614" CreationDate="2021-03-21T17:22:29.497" Score="14" Body="&lt;p&gt;A bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; is called entangled if it &lt;strong&gt;cannot&lt;/strong&gt; be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB} = \sum_i \lambda_i \sigma_A^i \otimes \sigma_B^i,&#xA;$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\lambda_i\geq 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sum_i \lambda_i = 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_A^i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sigma_B^i$&lt;/span&gt; are states on systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; respectively, for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. In other words, a state is entangled if it cannot be written as a convex combination of product states.&lt;/p&gt;&#xA;&lt;p&gt;The four Bell-states are usually referring to the states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;| \Phi^{\pm}\rangle = \frac{1}{\sqrt{2}}(|00\rangle \pm |11\rangle) \qquad |\Psi^{\pm}\rangle = \frac{1}{\sqrt{2}}(|01\rangle \pm |10\rangle)&#xA;$$&lt;/span&gt;&#xA;The Bell states are all entangled in the sense above with for example &lt;span class=&quot;math-container&quot;&gt;$\rho = |\Phi^{\pm}\rangle \langle \Phi^{\pm}|$&lt;/span&gt; or similarly for the other states. However, not all entangled states are Bell-states. For example, the states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \cos(\theta) |00\rangle + \sin(\theta) |11\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\theta \in (0, \pi/4)$&lt;/span&gt; are all entangled but are not Bell-states.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-21T17:22:29.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16616" PostTypeId="2" ParentId="16565" CreationDate="2021-03-21T18:25:38.213" Score="3" Body="&lt;p&gt;Minimalist formal proof (I'll use &lt;span class=&quot;math-container&quot;&gt;$\mu_a\equiv \mu(a)$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textrm{(A)}\Rightarrow\textrm{(B)}:$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\Gamma\ge0$&lt;/span&gt;. Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(\Phi_A\otimes I_B)(\Gamma_{AB}) = \sum (\sigma_a)_A\otimes\mathrm{tr}_A[((\mu_a)_A\otimes I_B)\,\Gamma_{AB}]\ ,&#xA;$$&lt;/span&gt;&#xA;which is a separable decomposition, since &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}_A[((\mu_a)_A\otimes I_B)\,\Gamma_{AB}]\ge0$&lt;/span&gt; because it describes the action of the CP map &lt;span class=&quot;math-container&quot;&gt;$\rho\mapsto\mathrm{tr}(\mu_a\rho)$&lt;/span&gt; (measurement conditioned on outcome) on the &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; system.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textrm{(B)}\Rightarrow\textrm{(A)}:$&lt;/span&gt; Let &lt;span class=&quot;math-container&quot;&gt;$\chi_{AB}=(\Phi_A\otimes I_B)(\Omega_{AB})=\sum \tilde\sigma_a\otimes \tilde\mu_a$&lt;/span&gt; be the Choi state of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; (with &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; the maximally entangled state). Then, the map &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; can be obtained from &lt;span class=&quot;math-container&quot;&gt;$\chi_{AB}$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\Phi(\rho) &amp;amp;= \mathrm{tr}_B(\chi_{AB}(I\otimes\rho^T))\\&#xA;&amp;amp;=\sum  \mathrm{tr}_B((\tilde\sigma_a\otimes\tilde\mu_a)(I\otimes\rho^T))\\&#xA;&amp;amp;=\sum \tilde\sigma_A\,\mathrm{tr}(\tilde\mu_a\rho^T)\\&#xA;&amp;amp;=\sum \tilde\sigma_A\,\mathrm{tr}(\tilde\mu_a^T\rho)&#xA;\end{align*}&lt;/span&gt;&#xA;where the last equality follows from &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}(X)=\mathrm{tr}(X^T)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="491" LastEditorUserId="491" LastEditDate="2021-03-21T22:20:55.157" LastActivityDate="2021-03-21T22:20:55.157" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16617" PostTypeId="2" ParentId="16603" CreationDate="2021-03-21T21:30:30.903" Score="2" Body="&lt;p&gt;Indeed, the composer does not support such a deep circuit. While, the error is counterintuitive (I reported that to the the composer developers already) it kind of makes sense that you are unable to load a circuit with ~20K gates. The composer is useful for toy examples and to simulate the circuit &amp;quot;live&amp;quot; in the browser. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16603/uploading-20-000-lines-of-code-to-ibm-quantum-composer-stalls?noredirect=1#comment23304_16603&quot;&gt;As you noticed&lt;/a&gt;, simulating the situation you are describing is impractical.&lt;/p&gt;&#xA;&lt;p&gt;More generally, the situation you are describing is not practical on real hardware neither. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16603/uploading-20-000-lines-of-code-to-ibm-quantum-composer-stalls?noredirect=1#comment23286_16603&quot;&gt;As explained&lt;/a&gt;, 20K gates is a lot for the current state of the art of quantum hardware.&lt;/p&gt;&#xA;&lt;p&gt;In any case, I suggest you to use &lt;em&gt;IBM Quantum Lab&lt;/em&gt; for non-toy situations.&lt;/p&gt;&#xA;&lt;p&gt;Here is how to load a QASM file and run it in real hardware using the IBM Quantum Lab:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Go to &lt;a href=&quot;https://quantum-computing.ibm.com/lab/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/lab/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Upload your QASM file (&lt;code&gt;long.qasm&lt;/code&gt; in my case) to the environment:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Azker.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Azker.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the notebook (the default has many useful imports already), load the file:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit.from_qasm_file('long.qasm')  # Creates a circuit from the QASM file&#xA;sum(circuit.count_ops().values())  # Total amount of gates to be sure that's your big circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;4&quot;&gt;&#xA;&lt;li&gt;Get the least busy device that is not a simulator and have enough qubits to execute your circuit (5 in this case)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.ibmq import least_busy&#xA;least_busy_device = least_busy(provider.backends(&#xA;    simulator=False, filters=lambda b: b.configuration().n_qubits &amp;gt;= 5))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;Execute the circuit in the device:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = execute(circuit, least_busy_device)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;6&quot;&gt;&#xA;&lt;li&gt;Take a look to the results:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code&gt;counts = job.result().get_counts()  # This might take some time, since your job will be in the queue.&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&quot;7&quot;&gt;&#xA;&lt;li&gt;You will probably see a lot of noise, because of decoherence.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="10480" LastEditDate="2021-03-21T22:55:49.520" LastActivityDate="2021-03-21T22:55:49.520" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16618" PostTypeId="1" AcceptedAnswerId="16619" CreationDate="2021-03-22T00:16:18.517" Score="2" ViewCount="156" Body="&lt;p&gt;I'm plotting a vector on the Bloch sphere using kaleidoscope:&#xA;&lt;code&gt;from kaleidoscope import bloch_sphere&lt;/code&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/iOCnS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/iOCnS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;Is there a way I can make the plot bigger? (Instead of zooming in) I tried &lt;code&gt;bloch_sphere([0,0,1],figsize=(10, 10))&lt;/code&gt; but that doesn't work.&lt;/p&gt;&#xA;&lt;p&gt;Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-03-22T03:10:02.990" Title="Can I plot a bigger Bloch sphere using kaleidoscope?" Tags="&lt;programming&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16619" PostTypeId="2" ParentId="16618" CreationDate="2021-03-22T03:10:02.990" Score="3" Body="&lt;p&gt;As this &lt;a href=&quot;https://github.com/JanLahmann/kaleidoscope/blob/master/kaleidoscope/interactive/bloch/bloch3d.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation shown&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Kj6JF.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Kj6JF.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;by specifying something like &lt;code&gt;bloch_sphere([0,0,1],figsize=(700, 700))&lt;/code&gt; will do it for you.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-22T03:10:02.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16620" PostTypeId="2" ParentId="16614" CreationDate="2021-03-22T05:45:50.737" Score="7" Body="&lt;p&gt;Put in simply words you could say that &lt;span class=&quot;math-container&quot;&gt;$$bell \implies entangled$$&lt;/span&gt; but not the opposite. Namely the Bell state is a precise case of the entangled state.&lt;/p&gt;&#xA;&lt;p&gt;We have that an entangled state is such that it cannot be expressed as a tensor product, i.e. &lt;span class=&quot;math-container&quot;&gt;$$\nexists |x⟩ |y⟩: |\phi⟩ = |x⟩\otimes |y⟩$$&lt;/span&gt; in the two qbits case.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, the Bell State is a precise state obtained by a precise sequence of transformations resulting in:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi⟩ = \dfrac{1}{\sqrt{2}}|00⟩+\dfrac{1}{\sqrt{2}}|11⟩$$&lt;/span&gt;&#xA;Which is indeed entangled (you can prove it) but not the only case of entanglement.&lt;/p&gt;&#xA;" OwnerUserId="15261" LastActivityDate="2021-03-22T05:45:50.737" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16621" PostTypeId="1" CreationDate="2021-03-22T09:19:47.927" Score="3" ViewCount="130" Body="&lt;p&gt;In HHL algorithm, there is a step in Quantum Phase Estimation where we have to apply powers of &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt; to the register (see pic). I am not able to understand how to find the quantum circuit corresponding to this unitary transformation i.e. if I know &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, then how to find the decomposition of this operator in terms of quantum gates.&lt;/p&gt;&#xA;&lt;p&gt;As an exapmle, &lt;a href=&quot;https://arxiv.org/pdf/1110.2232v2.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cao et al. v2&lt;/a&gt; , &lt;a href=&quot;https://arxiv.org/pdf/1110.2232.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cao et al. v3&lt;/a&gt; -  in these papers the authors have decomposed the operator in terms of basic gates, but I am not able to understand, how they have done that. So, I am not able to understand how to decompose the operator &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;  in terms of basic gates for any Hermitian Matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/emlym.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/emlym.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15213" LastEditorUserId="2927" LastEditDate="2021-03-22T15:05:18.267" LastActivityDate="2021-03-23T15:24:51.047" Title="Quantum Circuit for $e^{iAt}$ Hamiltonian Simulation in HHL algorithm" Tags="&lt;hamiltonian-simulation&gt;&lt;hhl-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="1" CommentCount="7" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16622" PostTypeId="1" CreationDate="2021-03-22T09:22:07.627" Score="2" ViewCount="26" Body="&lt;p&gt;Is there a way to convert &lt;code&gt;QuadraticProgram&lt;/code&gt; (&lt;code&gt;qiskit.optimization.problems.QuadraticProgram&lt;/code&gt;) to BQM used in D'wave ocean (e.g. &lt;code&gt;dimod.AdjVectorBQM&lt;/code&gt;)?&lt;/p&gt;&#xA;&lt;p&gt;I'd like to use Qiskit to model my programming problem and use converters to deal with integer variables, inequations, etc., then sample this problem on d'wave QPU with annealing schedules. I've noticed d'wave has implemented a plugin that allows Qiskit to access QPU by the &lt;code&gt;DWaveMinimumEigensolver&lt;/code&gt;. It seems hardly deal with parameters as a native d'wave sampler.&lt;/p&gt;&#xA;" OwnerUserId="14111" LastEditorUserId="55" LastEditDate="2021-03-22T12:39:38.667" LastActivityDate="2021-05-10T07:25:51.523" Title="From Qiskit QuadraticProgram to problem model accepted by d'wave ocean" Tags="&lt;programming&gt;&lt;d-wave&gt;&lt;pqiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16623" PostTypeId="2" ParentId="16599" CreationDate="2021-03-22T09:53:48.053" Score="3" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; There is a bug in the composer (already reported to the composer developers) that do no aliases &lt;code&gt;U&lt;/code&gt; and &lt;code&gt;u&lt;/code&gt; (neither &lt;code&gt;CX&lt;/code&gt; and &lt;code&gt;cx&lt;/code&gt;). You can use Qiskit, either locally or in the &lt;em&gt;IBM Quantum Lab&lt;/em&gt; to read this totally valid QASM.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qasm = &amp;quot;&amp;quot;&amp;quot;&#xA;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;h q[0];&#xA;u(1,2,3) q[0];&#xA;measure q[0] -&amp;gt; c[0]; &#xA;&amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;circuit = QuantumCircuit.from_qasm_str(qasm)&#xA;circuit.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/McYnz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/McYnz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Qiskit does have the aliasing &lt;code&gt;U&lt;/code&gt;/&lt;code&gt;u&lt;/code&gt;  and &lt;code&gt;CX&lt;/code&gt;/&lt;code&gt;cx&lt;/code&gt;. For example, you can transpile and works as expected:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;transpile(circuit, basis_gates=['u', 'h'], optimization_level=0).draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/wGUA5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/wGUA5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Some background&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;code&gt;U&lt;/code&gt; gate is defined in the &lt;a href=&quot;https://arxiv.org/abs/1707.03429&quot; rel=&quot;nofollow noreferrer&quot;&gt;OpenQASM 2.0 specification&lt;/a&gt;, together with &lt;code&gt;CX&lt;/code&gt;, as an &lt;em&gt;abstract gate&lt;/em&gt;. &lt;code&gt;U&lt;/code&gt; and &lt;code&gt;CX&lt;/code&gt; are a universal basis and all the other gates can be defined as a combination of them.&lt;/p&gt;&#xA;&lt;p&gt;However, they are not meant to be used directly and the composer does not list them as available gates:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QMYRG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QMYRG.png&quot; alt=&quot;available gates&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;&lt;em&gt;But if it is right there! the last one is a clear &lt;code&gt;U&lt;/code&gt;&lt;/em&gt;&amp;quot; you are probably saying. And you are not wrong. As &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16600/1859&quot;&gt;explained by @KAJ226&lt;/a&gt;, gates are usually detonated with capital letters and non-abstract QASM gates use small-case. As a consequence, the confusion.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-22T09:53:48.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16624" PostTypeId="1" AcceptedAnswerId="16626" CreationDate="2021-03-22T10:57:54.550" Score="1" ViewCount="33" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho\in M_n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma\in M_m$&lt;/span&gt; be two quantum states. We denote the orthogonal projections onto &lt;span class=&quot;math-container&quot;&gt;$\text{range}(\rho)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{range}(\sigma)$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$P_\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_\sigma$&lt;/span&gt;, respectively. Now, if the two states are connected via the action of a quantum channel &lt;span class=&quot;math-container&quot;&gt;$\Psi:M_m\rightarrow M_n$&lt;/span&gt;, i.e., &lt;span class=&quot;math-container&quot;&gt;$\rho = \Psi(\sigma)$&lt;/span&gt;, is it true that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{range}[\Psi(P_\sigma)] \subseteq \text{range}(P_\rho) = \text{range}(\rho) \,?$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="12710" LastEditDate="2021-03-22T12:23:08.650" LastActivityDate="2021-03-22T12:23:08.650" Title="Ranges of quantum states that are related via a quantum channel" Tags="&lt;quantum-state&gt;&lt;quantum-operation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16626" PostTypeId="2" ParentId="16624" CreationDate="2021-03-22T11:55:05.697" Score="0" Body="&lt;p&gt;Yes. In fact, equality can be shown to hold. Let us spectrally decompose &lt;span class=&quot;math-container&quot;&gt;$\sigma = \sum_{i}\lambda_i P_i$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda_i &amp;gt; 0$&lt;/span&gt; are the non-zero eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are the orthogonal projectors onto the corresponding eigenspaces, so that &lt;span class=&quot;math-container&quot;&gt;$\rho=\Psi(\sigma)=\sum_i \lambda_i \Psi(P_i)$&lt;/span&gt;. Then it is clear that &lt;span class=&quot;math-container&quot;&gt;$P_\sigma = \sum_{i}P_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Psi(P_\sigma)=\sum_{i}\Psi(P_i)$&lt;/span&gt;. Now, it is easy to see that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{range}[\Psi(P_\sigma)]=\text{range}[\sum_{i}\Psi(P_i)]=\text{range}[\sum_i \lambda_i \Psi(P_i)]=\text{range}(\rho), $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;since for arbitrary positive semi-definite matrices &lt;span class=&quot;math-container&quot;&gt;$A,B$&lt;/span&gt; and arbitrary positive numbers &lt;span class=&quot;math-container&quot;&gt;$a,b&amp;gt;0$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$\text{range}(A+B) = \text{range}(aA+bB)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="12710" LastEditDate="2021-03-22T12:01:15.867" LastActivityDate="2021-03-22T12:01:15.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16628" PostTypeId="1" CreationDate="2021-03-22T13:11:03.737" Score="1" ViewCount="58" Body="&lt;p&gt;Is it possible to view the source code of one of the Qiskit's algorithm?&#xA;Actually, I am trying to find how Qiskit implements the HHL algorithm. I want to see the source code for this algorithm.&lt;/p&gt;&#xA;" OwnerUserId="15213" LastActivityDate="2021-03-23T09:32:11.240" Title="Source code of a Qiskit's algorithm - HHL Algorithm" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;hhl-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16629" PostTypeId="2" ParentId="16628" CreationDate="2021-03-22T13:28:02.047" Score="6" Body="&lt;p&gt;Qiskit is an open source. Specifically for HHL, see &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/algorithms/linear_solvers/hhl.py&quot; rel=&quot;noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/aqua/algorithms/linear_solvers/hhl.py&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="7659" LastActivityDate="2021-03-22T13:28:02.047" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16630" PostTypeId="2" ParentId="16614" CreationDate="2021-03-22T16:06:40.303" Score="3" Body="&lt;p&gt;&lt;strong&gt;A simpler answer with fewer mathematical symbols:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Bell states are examples of entangled states, but there's other examples of entangled states that are &lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; Bell states, for example the &lt;a href=&quot;https://en.wikipedia.org/wiki/W_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;W state&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{1}&#xA;\frac{1}{\sqrt{3}}\left(|001\rangle + |010\rangle  + | 100\rangle\right),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;the &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state&quot; rel=&quot;nofollow noreferrer&quot;&gt;GHZ states&lt;/a&gt; for example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tag{2}&#xA;\frac{1}{\sqrt{2}}\left(|000\rangle + |111\rangle\right),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and many more.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-03-22T17:15:53.547" LastActivityDate="2021-03-22T17:15:53.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16632" PostTypeId="2" ParentId="16589" CreationDate="2021-03-22T17:57:43.930" Score="1" Body="&lt;p&gt;In the &lt;a href=&quot;https://arxiv.org/pdf/1309.7495.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard survey&lt;/a&gt; LH is defined with normalization 1 on the single terms &lt;span class=&quot;math-container&quot;&gt;$h_{i}$&lt;/span&gt;. The actual promised gap &lt;span class=&quot;math-container&quot;&gt;$b-a$&lt;/span&gt; for the least eigenvalue of the total hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H=\sum_{i}^{m}h_{i}$&lt;/span&gt; is referred to as the &amp;quot;absolute promise gap&amp;quot;, and &lt;span class=&quot;math-container&quot;&gt;$(b-a)/m$&lt;/span&gt; is referred to as the &amp;quot;relative promise gap&amp;quot; or simply the promise gap. The &amp;quot;Quantum PCP by gap amplification&amp;quot; conjecture states that LH is QMA-hard with constant relative promise gap.&lt;br /&gt;&#xA;So the answer is the OP (myself) didn't read the quantum PCP statement correctly.&lt;/p&gt;&#xA;" OwnerUserId="12548" LastActivityDate="2021-03-22T17:57:43.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16633" PostTypeId="1" AcceptedAnswerId="16634" CreationDate="2021-03-22T18:49:16.163" Score="2" ViewCount="118" Body="&lt;p&gt;It says on wikipedia that &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_error_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum error correction&lt;/a&gt; can (at best) correct phase flips and bit flips. A popular form of representing a quantum channel is in its &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_channel&quot; rel=&quot;nofollow noreferrer&quot;&gt;Kraus representation&lt;/a&gt; (scroll down to section 'pure channel' or just CRTL+F 'Kraus'). This kind of representation can yield a whole plethora of different possible noise models.&lt;/p&gt;&#xA;&lt;p&gt;That being said, are there possible quantum channels that may exist (either right now or in the future) that induce noise that can not be corrected by current QEC methods? This question is somewhat related to this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9319/what-types-of-noise-are-there&quot;&gt;unanswered question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="10480" LastEditDate="2021-03-22T20:47:46.480" LastActivityDate="2021-03-22T20:47:46.480" Title="Can quantum error correction work on any type of channel?" Tags="&lt;error-correction&gt;&lt;quantum-operation&gt;&lt;noise&gt;&lt;fidelity&gt;&lt;decoherence&gt;" AnswerCount="1" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16634" PostTypeId="2" ParentId="16633" CreationDate="2021-03-22T20:34:59.440" Score="4" Body="&lt;p&gt;For any quantum error correcting code, it is possible to construct a channel which introduces errors that the code cannot correct. However, the key point is that such channels are highly adversarial and not at all representative of any physically reasonable error mechanism.&lt;/p&gt;&#xA;&lt;p&gt;An easy way to construct such adversarial noise is to build it from the logical operators. For example, denote the logical Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator by &lt;span class=&quot;math-container&quot;&gt;$\overline{X}$&lt;/span&gt;, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{B}(\rho) = (1-p)\rho + p\overline{X}\rho\overline{X}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is the logical bit-flip channel which changes logical state &lt;span class=&quot;math-container&quot;&gt;$|\overline{0}\rangle$&lt;/span&gt; into logical &lt;span class=&quot;math-container&quot;&gt;$|\overline{1}\rangle$&lt;/span&gt; and vice versa with probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;. Note that whenever the logical state is flipped the code is helpless to correct it because both &lt;span class=&quot;math-container&quot;&gt;$|\overline{0}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\overline{1}\rangle$&lt;/span&gt; belong to the code subspace and therefore their syndrome is trivial, i.e. indicative of no error.&lt;/p&gt;&#xA;&lt;p&gt;More generally, any error that keeps the code subspace invariant, but does not act as identity cannot be corrected. For stabilizer codes this means that any error operator in &lt;span class=&quot;math-container&quot;&gt;$N(S) - S$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is the stabilizer group of the code and &lt;span class=&quot;math-container&quot;&gt;$N(S)$&lt;/span&gt; is the normalizer of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; cannot be corrected. Note that this is by design.  If a quantum error correcting code treated logical operators as errors then they could not be used for quantum computation since error correction would interfere with logical gates.&lt;/p&gt;&#xA;&lt;p&gt;The objective of quantum error correction is then to find codes such that the logical operators are extremely unlikely to be applied spontaneously by the noise. Generally speaking, this is achieved by choosing logical operators that require a very coordinated change across a large number of physical qubits that is highly unlikely to occur by chance without programmed intervention from the qubit control stack. It is not hard to see that we can find such codes by observing for example that we can find a stabilizer &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$N(S)-S$&lt;/span&gt; contains operators of very high weight, i.e. high number of non-identity factors. The smallest weight &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; of operators in &lt;span class=&quot;math-container&quot;&gt;$N(S) - S$&lt;/span&gt; is called the code distance. A code with distance &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; can correct up to &lt;span class=&quot;math-container&quot;&gt;$\lfloor{\frac{d-1}{2}}\rfloor$&lt;/span&gt; single-qubit errors regardless of the specific single-qubit operators applied by the errors.&lt;/p&gt;&#xA;&lt;p&gt;For more details including the necessary and sufficient conditions for a given quantum error correcting code to recover from a given noise operation, see the so-collect &lt;em&gt;quantum error-correction conditions&lt;/em&gt; in theorem 10.1 on page 436 in Nielsen &amp;amp; Chuang and theorem 10.8 on page 466 for a version for stabilizer codes.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-22T20:34:59.440" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16635" PostTypeId="2" ParentId="16621" CreationDate="2021-03-22T21:05:48.983" Score="5" Body="&lt;p&gt;As requested through the comment by the OP.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Given a Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, we can always write it as linear combination of Pauli strings. That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H = \sum_i \alpha_i P_i \hspace{1 cm} P_i \in \{I,X,Y,Z\}^{\otimes n} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;note this linear combination can have up to &lt;span class=&quot;math-container&quot;&gt;$4^n$&lt;/span&gt; terms. Thus, for a general Hamiltonian splitting it into linear combination of Pauli terms can be hard and inefficient. However, many interesting Hamiltonian have very efficient decomposition (the linear combination scales polynomial). For instance, the electronic structure Hamiltonian for molecule.&lt;/p&gt;&#xA;&lt;p&gt;Now, the coefficients &lt;span class=&quot;math-container&quot;&gt;$\alpha_i$&lt;/span&gt; can be determined through the formula&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \alpha_i = \dfrac{1}{2^n}Tr(P_i H)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So here, we are given that &lt;span class=&quot;math-container&quot;&gt;$H = A =\dfrac{1}{4} \begin{pmatrix} 15 &amp;amp; 9 &amp;amp; 5 &amp;amp; -3\\ 9 &amp;amp; 15 &amp;amp; 3 &amp;amp; -5\\ 5 &amp;amp; 3 &amp;amp; 15 &amp;amp; -9 \\ -3 &amp;amp; -5 &amp;amp; -9 &amp;amp; 15 \end{pmatrix} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;so for instance,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \dfrac{1}{2^2}Tr(II \cdot H)=\dfrac{1}{2^2} Tr\bigg(\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \end{pmatrix} \dfrac{1}{4} \begin{pmatrix} 15 &amp;amp; 9 &amp;amp; 5 &amp;amp; -3\\ 9 &amp;amp; 15 &amp;amp; 3 &amp;amp; -5\\ 5 &amp;amp; 3 &amp;amp; 15 &amp;amp; -9 \\ -3 &amp;amp; -5 &amp;amp; -9 &amp;amp; 15 \end{pmatrix}  \bigg)= \dfrac{1}{2^2} Tr\bigg(\begin{pmatrix}  3.75 &amp;amp; 2.25 &amp;amp;  1.25 &amp;amp; -0.75\\  2.25 &amp;amp;  3.75 &amp;amp;  0.75 &amp;amp; -1.25\\ 1.25 &amp;amp;  0.75 &amp;amp;  3.75 &amp;amp; -2.25 \\ -0.75 &amp;amp; -1.25 &amp;amp; -2.25 &amp;amp;  3.75\end{pmatrix}  \bigg) =  3.75 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly, &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{4}Tr( XZ \cdot H) = 1.25$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{4}Tr( ZX \cdot H) = 2.25$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{4}Tr( YY \cdot H ) = 0.75$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The rest of the coefficients are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. For instance, &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{4}Tr( IX) = 0$&lt;/span&gt;, and   &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{4}Tr( YX) = 0$&lt;/span&gt;, etc.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Once you have the Pauli string decomposition, you can input this into quiskit to create a circuit that approximate (if the pauli terms don't commute with each other) the operation &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt; through &lt;a href=&quot;https://encyclopediaofmath.org/wiki/Trotter_product_formula&quot; rel=&quot;nofollow noreferrer&quot;&gt;Trotterization&lt;/a&gt; (&lt;a href=&quot;http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;look at page 207 here&lt;/a&gt; to know more about this technique) pretty quickly using their &lt;code&gt;WeightedPauliOperator&lt;/code&gt; as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import WeightedPauliOperator&#xA;pauli_dict = {'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0, &amp;quot;real&amp;quot;: 3.75 }, &amp;quot;label&amp;quot;: &amp;quot;II&amp;quot;},&#xA;                         {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0, &amp;quot;real&amp;quot;: 1.25 }, &amp;quot;label&amp;quot;: &amp;quot;XZ&amp;quot;},&#xA;                         {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0, &amp;quot;real&amp;quot;: 0.75 }, &amp;quot;label&amp;quot;: &amp;quot;YY&amp;quot;},&#xA;                         {&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0, &amp;quot;real&amp;quot;: 2.25 }, &amp;quot;label&amp;quot;: &amp;quot;ZX&amp;quot;},&#xA;                         ]}&#xA;operator = WeightedPauliOperator.from_dict(pauli_dict)&#xA;approx_circuit = operator.evolve(evo_time= 1, num_time_slices=1).decompose()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that you have option to change the evolution time and number of time slices in the &lt;code&gt;evolve&lt;/code&gt; method. But note that all the Pauli terms here &lt;strong&gt;commute&lt;/strong&gt; with each other so this is &lt;em&gt;not&lt;/em&gt; an approximation but exact representation of the circuit. The reason is if &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are two commuting matrix, &lt;span class=&quot;math-container&quot;&gt;$[A,B] = AB - BA = 0$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$e^{A+B} = e^Ae^B $&lt;/span&gt;. Here &lt;span class=&quot;math-container&quot;&gt;$II$&lt;/span&gt; commute with everything, and &lt;span class=&quot;math-container&quot;&gt;$[XZ,ZX] = 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$[ZX,YY] = 0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$[XZ,YY] = 0$&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;p&gt;Which would output something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/i2Fqv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/i2Fqv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;and if you want to transpiled to a specific gate set that you want to use, you can use the &lt;code&gt;transpile&lt;/code&gt; function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;transpiled_circuit = transpile(approx_circuit, basis_gates=['cx', 'u3'], optimization_level = 3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/a9dt5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/a9dt5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then now, if you want to create the controlled version of &lt;span class=&quot;math-container&quot;&gt;$Controlled-e^{iAt}$&lt;/span&gt; then you can create a controlled gate to all the gates you have in the circuit. But then you would still need to decompose those controlled operations to native gates that matches the device's native gate set. You can also do this automatically with qiskit too, actually. That is, you can just create a controlled version of the entire circuit above. Let's suppose the circuit to simulate &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt; is described as the &lt;code&gt;transpiled_circuit&lt;/code&gt; we have above, then what I can do is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, QuantumCircuit&#xA;xs_gate = transpiled_circuit.to_gate()&#xA;cxs_gate = xs_gate.control()&#xA;qreg_q = QuantumRegister(3, 'q')&#xA;circuit = QuantumCircuit(qreg_q)&#xA;circuit.append(cxs_gate, [0,1,2])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will create the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7HKcw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7HKcw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the &lt;code&gt;circuit231&lt;/code&gt; represents the entire &lt;code&gt;transpiled_circuit&lt;/code&gt; we had above. You can then again* decompose this circuit to see what it would look like in term of more elementary gates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;decomposed_circuit = circuit.decompose().decompose() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which can give you something ridiculously long:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kUkMg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kUkMg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;What I described is for a general case. For specific problem, you can use different tricks to make this neater. For instance, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16574/9858&quot;&gt;see this amazing answer by Adam&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-23T15:24:51.047" LastActivityDate="2021-03-23T15:24:51.047" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16636" PostTypeId="1" CreationDate="2021-03-22T23:58:19.017" Score="1" ViewCount="41" Body="&lt;p&gt;I am trying to use the DensityMatrixSimulator in Cirq. I want to append gates to the circuit conditional on measurements. In order to reduce computational resources, I am trying to run these conditional gates by initializing another circuit with these conditional gates using the final state of the first measurement as the initial state. However, I am not sure how I can get the simulate method to accept the initial state matrix (see code below).&lt;/p&gt;&#xA;&lt;p&gt;I get the ValueError of&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ValueError: `state_like` was convertible to a numpy array, but its shape was neither the shape of a list of computational basis values (`len(qid_shape)`) nor the shape of a list or tensor of state vector amplitudes (`qid_shape` or `(product(qid_shape),)`.&#xA;&#xA;qid_shape=(2, 2)&#xA;np.array(state_like).shape=(2, 2, 2, 2)&#xA;np.array(state_like)=[[[[ 0.+0.j  0.-0.j]&#xA;   [ 0.+0.j  0.-0.j]]&#xA;&#xA;  [[-0.+0.j  0.-0.j]&#xA;   [-0.+0.j  0.-0.j]]]&#xA;&#xA;&#xA; [[[ 0.+0.j  0.-0.j]&#xA;   [ 1.+0.j  0.-0.j]]&#xA;&#xA;  [[-0.+0.j  0.-0.j]&#xA;   [-0.+0.j  0.-0.j]]]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is the code I am trying to run to figure out how to initialize the initial state of the second circuit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;qubits = cirq.LineQubit.range(2)&#xA;&#xA;circuit = cirq.Circuit()&#xA;&#xA;circuit.append(cirq.X(qubits[0]))&#xA;circuit.append(cirq.Z(qubits[1]))&#xA;&#xA;s = cirq.DensityMatrixSimulator()&#xA;&#xA;results = s.simulate(circuit)&#xA;&#xA;r = cirq.DensityMatrixSimulator()&#xA;&#xA;circuit2 = cirq.Circuit()&#xA;&#xA;circuit2.append(cirq.X(qubits[0]))&#xA;&#xA;circuit2.append(cirq.Z(qubits[1]))&#xA;&#xA;results2 =r.simulate(circuit2, initial_state = results._final_simulator_state.density_matrix)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thank you in advance!&lt;/p&gt;&#xA;" OwnerUserId="15272" LastActivityDate="2021-03-23T06:44:33.157" Title="Setting the Initial State of Density Matrix Simulation in Cirq" Tags="&lt;simulation&gt;&lt;density-matrix&gt;&lt;cirq&gt;&lt;initialization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16637" PostTypeId="1" CreationDate="2021-03-23T00:32:54.240" Score="2" ViewCount="39" Body="&lt;p&gt;I am just wondering if I am interested in quantum computing, but not able to get into engineering. Will I be able to acquire knowledge of quantum computing by for example taking courses in physics and mathematics department?&lt;/p&gt;&#xA;&lt;p&gt;If so, in particular what physics courses or mathematics courses must I take in order to be capable of understanding the application and theory behind quantum computing?&lt;/p&gt;&#xA;" OwnerUserId="15273" LastEditorUserId="9006" LastEditDate="2021-03-23T09:27:59.540" LastActivityDate="2021-03-23T09:27:59.540" Title="Question about understanding quantum computing and its usage and theory behind" Tags="&lt;resource-request&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16638" PostTypeId="2" ParentId="16636" CreationDate="2021-03-23T01:50:31.630" Score="2" Body="&lt;p&gt;Instead of accessing &lt;code&gt;results._final_simulator_state.density_matrix&lt;/code&gt;, which has a leading underscore implying you shouldn't be using it or relying on it to stay stable, use &lt;code&gt;results.final_density_matrix&lt;/code&gt;. Making that substitution seems to result in the code working.&lt;/p&gt;&#xA;&lt;p&gt;Separately, I think the fact that what you did doesn't work is a bug. It seems that the method doesn't recognize the shape &lt;code&gt;(2,) * 2 * num_qubits&lt;/code&gt; as a valid shape for the density matrix as a tensor. I opened &lt;a href=&quot;https://github.com/quantumlib/Cirq/issues/3958&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Cirq/issues/3958&lt;/a&gt; to get it fixed.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-23T06:44:33.157" LastActivityDate="2021-03-23T06:44:33.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16639" PostTypeId="1" CreationDate="2021-03-23T03:02:02.253" Score="3" ViewCount="63" Body="&lt;p&gt;I'm trying to understand the Q-sphere representation of a 3-qubit system. I get that the 3-qubits are in a superposition of 2 different states. The first qubit (rightmost) is in a superposition of &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; with a phase difference of &lt;code&gt;pi&lt;/code&gt;. And the other two qubits are in ground states. I hope I got this right till here.&lt;/p&gt;&#xA;&lt;p&gt;What does the location of the point on the 1st ring represent? In the &lt;a href=&quot;https://quantum-computing.ibm.com/composer/docs/iqx/visualizations#q-sphere-view&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, it's mentioned that the latitude is the Hamming distance from zero state. What does that indicate?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/E9XbO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/E9XbO.png&quot; alt=&quot;Q-sphere 2 qubits&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12667" LastActivityDate="2021-03-23T10:44:52.273" Title="How to read a Q sphere representation?" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;bloch-sphere&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16640" PostTypeId="1" AcceptedAnswerId="16644" CreationDate="2021-03-23T04:04:39.367" Score="5" ViewCount="106" Body="&lt;p&gt;I want to confirm my understanding of a partial trace.&lt;/p&gt;&#xA;&lt;p&gt;Essentially, we have a system that &lt;span class=&quot;math-container&quot;&gt;$H_a \otimes H_b$&lt;/span&gt;. When we trace out system &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, what we are doing is basically reducing the system down to as if we had just measured system &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. Essentially, &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}$&lt;/span&gt; gives us the probability distribution for both &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; and when we do &lt;span class=&quot;math-container&quot;&gt;$\rho_{a} = Tr_b{[H_a \otimes H_b]}$&lt;/span&gt;, we are just getting the probability distribution for &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15193" LastEditorUserId="55" LastEditDate="2021-04-22T13:02:46.537" LastActivityDate="2021-04-22T13:02:46.537" Title="What is the physical intuition behind taking the partial trace of a state?" Tags="&lt;entanglement&gt;&lt;partial-trace&gt;&lt;trace&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16641" PostTypeId="2" ParentId="16637" CreationDate="2021-03-23T05:13:31.443" Score="1" Body="&lt;p&gt;It really depends on what you want to get into. Quantum computing could be approached from a linear algebra/CS side or a physics side. I can only speak for the former and it’s really interesting. To get started I strongly suggest to have a good knowledge of linear algebra. The applications are many, and mainly relate to the fact that the representation of states allows for a speed up of algorithms. In the course I am taking, we are using a book by Mermin called “Quantum Computer Science”, you could look into that to have an idea. For the physics side of the topic, I suggest to ask someone who can give a better overview.&lt;/p&gt;&#xA;" OwnerUserId="15261" LastActivityDate="2021-03-23T05:13:31.443" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16642" PostTypeId="1" AcceptedAnswerId="16650" CreationDate="2021-03-23T05:54:38.243" Score="4" ViewCount="50" Body="&lt;p&gt;I have the following complex vector in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^2$&lt;/span&gt;:&#xA;&lt;code&gt;Vec= [[ 0.89741876+0.j] [-0.33540402+0.28660724j]] &lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to implement a &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate to prepare this state. The general &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;U_3(\gamma,\beta,\delta) =&#xA;\begin{bmatrix} &#xA;\cos\left(\frac{\gamma}{2}\right) &amp;amp; -e^{i\delta} \sin\left(\frac{\gamma}{2}\right) \\&#xA;e^{i\beta} \sin\left(\frac{\gamma}{2}\right) &amp;amp; e^{i(\delta + \beta)} \cos\left(\frac{\gamma}{2}\right)&#xA;\end{bmatrix}\\&#xA;$$&lt;/span&gt;&#xA;To solve for the parameters, I have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\cos\left(\frac{\gamma'}{2}\right) = g_0\qquad e^{i\beta'}\sin\left(\frac{\gamma'}{2}\right) = g_1&#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$g_0$&lt;/span&gt; is the real entry of &lt;code&gt;Vec&lt;/code&gt; , and &lt;code&gt;g_1&lt;/code&gt; is the complex one. Then, I can get the solutions&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\gamma'=2\cos^{-1}(g_0),\qquad e^{i\beta'}=\pm\frac{g_1}{\sqrt{1-g_0^2}}\qquad\beta'=-i\log\frac{g_1}{\sqrt{1-g_0^2}}+k\pi,\ \text{where}\ k\in\mathbb{Z}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\delta'$&lt;/span&gt; could be any real value. With the values specified in &lt;code&gt;Vec&lt;/code&gt;, we can find that  &lt;span class=&quot;math-container&quot;&gt;$\gamma' = 0.913825694123124 , \beta_1'= 2.434484141132717 , \beta_2'=5.5760767947225105$&lt;/span&gt; (differ by &lt;span class=&quot;math-container&quot;&gt;$1*\pi$&lt;/span&gt;).&#xA;Therefore, they are two different vectors, as could be seen on the Bloch sphere: (the blue vector corresponds to &lt;span class=&quot;math-container&quot;&gt;$\beta_2'$&lt;/span&gt;, the purple one is &lt;span class=&quot;math-container&quot;&gt;$\beta_1'$&lt;/span&gt;)&lt;a href=&quot;https://i.stack.imgur.com/EYNsE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/EYNsE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;The second solution doesn't quite work as I checked the values using Mathematica, but it looks like the blue vector might also contribute to the rotation as I tried to simulate the time-evolution of some arbitrary vector. Should I keep the blue vector, or how can I get rid of it? Thanks a lot for the help!!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-03-23T06:32:18.360" LastActivityDate="2021-03-23T10:09:13.150" Title="Why did I get two solutions to solve for the parameters of this $U_3$ gate? (I only expected one of them)" Tags="&lt;mathematics&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16643" PostTypeId="2" ParentId="16640" CreationDate="2021-03-23T05:57:00.740" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;When we trace out system b, what we are doing is basically reducing the system down to as if we had just measured system a&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Its as if you had just &lt;strike&gt;measured or&lt;/strike&gt;  discarded &lt;em&gt;system &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Otherwise yes, the probability distribution over the computational basis states described by &lt;span class=&quot;math-container&quot;&gt;$\rho_a$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_a$&lt;/span&gt; is precisely the marginal of the distribution described by &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_a \otimes \mathcal{H}_b$&lt;/span&gt;. For example, if each system consists of a single qubit, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{ab} = \sum_{i,j,k,\ell=0}^1 \rho_{ij,k\ell}|ij\rangle \langle k\ell|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you were to measure this in the computational basis, you would end up with a joint probability distribution of both bit outcomes over &lt;span class=&quot;math-container&quot;&gt;$\{00, 01, 10, 11\}$&lt;/span&gt; given by &lt;span class=&quot;math-container&quot;&gt;$\text{diag}(\rho) = (\rho_{00,00}, \rho_{01,01}, \rho_{10, 10}, \rho_{11, 11})$&lt;/span&gt;. If we treat the measurement of the first system as a random variable &lt;span class=&quot;math-container&quot;&gt;$A\in\{0,1\}$&lt;/span&gt; with an associated distribution &lt;span class=&quot;math-container&quot;&gt;$p_A$&lt;/span&gt;, we can compute the marginal probability for measuring bit &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&amp;quot; in system &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_A(i) &amp;amp;= \sum_{b\in\{0,1\}} p(A=i, B=b) \\&#xA;&amp;amp;= \sum_{b\in\{0,1\}} \rho_{ib, ib}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And so the full distribution &lt;span class=&quot;math-container&quot;&gt;$p_A$&lt;/span&gt; is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_A(0) &amp;amp;= \rho_{00,00} + \rho_{01,01} \\&#xA;p_A(1) &amp;amp;= \rho_{10,10} + \rho_{11,11} \\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Compare this to a known formula for &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_B (\rho_{ab})$&lt;/span&gt; (for example, &lt;a href=&quot;https://physics.stackexchange.com/questions/435988/is-partial-trace-the-inverse-operation-of-kronecker-product&quot;&gt;this question&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}_B(\rho_{ab}) = \begin{pmatrix}&#xA; \rho_{00,00} + \rho_{01,01} &amp;amp; \rho_{00,01} + \rho_{01,11} \\&#xA;\rho_{10,00} + \rho_{11,01} &amp;amp; \rho_{10,10} + \rho_{11,11}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The diagonal elements match the marginal probabilities computed above. If you lift the restriction that systems &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are qubits and allow them to be &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-level systems you can repeat the same calculations to show that the computational measurement probability distribution for &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}_B (\rho_{ab})$&lt;/span&gt; is the marginal probability distribution of &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}$&lt;/span&gt; for a bipartite system with arbitrary dimensions.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2021-03-23T18:14:29.233" LastActivityDate="2021-03-23T18:14:29.233" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16644" PostTypeId="2" ParentId="16640" CreationDate="2021-03-23T06:03:21.647" Score="4" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; Tracing out a subsystem corresponds to &lt;strong&gt;discarding&lt;/strong&gt; it.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Suppose Alice has subsystem &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and Bob has subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; of the composite system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; in state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;. Tracing out subsystem &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; gives us&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_a=\mathrm{tr}_B\rho_{ab}=\sum_j \langle j_B|\rho_{ab}|j_B \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which represents the state of Alice's subsystem in the absence of any knowledge of Bob's subsystem.&lt;/p&gt;&#xA;&lt;p&gt;It is important to note that unitary gates, measurements or other operations performed locally by Bob on his subsystem &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/15956/in-quantum-teleportation-does-bobs-qubit-depend-on-alices-alpha-and-beta/15972#15972&quot;&gt;have no effect&lt;/a&gt; on &lt;span class=&quot;math-container&quot;&gt;$\rho_a$&lt;/span&gt;, even if &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}$&lt;/span&gt; is entangled. However, if Alice learns the result of a measurement performed by Bob on his half of &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}$&lt;/span&gt; then tracing out &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is no longer the appropriate way to represent the state of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Indeed, this scenario is an example of state teleportation.&lt;/p&gt;&#xA;&lt;p&gt;Thus, tracing out &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; does not corresponds to measuring &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Moreover, the state of Alice's subsystem after Bob's measurement on &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; depends on what happens to measurement result. If Bob measures &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; and keeps the result to himself then &lt;span class=&quot;math-container&quot;&gt;$\rho_a$&lt;/span&gt; is still the state of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; from Alice's point of view. If he shares the result with Alice, it is not.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The relationship between the joint state &lt;span class=&quot;math-container&quot;&gt;$\rho_{ab}$&lt;/span&gt; and the marginal states &lt;span class=&quot;math-container&quot;&gt;$\rho_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_b$&lt;/span&gt; of two quantum systems &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is analogous to the relationship between the joint probability distribution &lt;span class=&quot;math-container&quot;&gt;$P(X, Y)$&lt;/span&gt; of two random variables &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and the marginal probability distributions &lt;span class=&quot;math-container&quot;&gt;$P(X)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(Y)$&lt;/span&gt;. In this case, the marginal&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;P(X) = \sum_j P(X, Y=j)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;represents the distribution of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; averaged out, i.e. the distribution of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; in the absence of any knowledge of the outcome of the random experiment associated with &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. Notice that sharing the outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; of such experiment with someone about to draw from &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; changes the probability distribution from the marginal &lt;span class=&quot;math-container&quot;&gt;$P(X)$&lt;/span&gt; to the conditional &lt;span class=&quot;math-container&quot;&gt;$P(X|Y=j)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-23T06:10:31.807" LastActivityDate="2021-03-23T06:10:31.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16646" PostTypeId="1" CreationDate="2021-03-23T07:19:01.387" Score="6" ViewCount="213" Body="&lt;p&gt;The average value of an operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$\left.|\psi\right&amp;gt;$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\overline{O}=\left&amp;lt;\psi|O|\psi\right&amp;gt;$$&lt;/span&gt;&#xA;Now for simplicity let &lt;span class=&quot;math-container&quot;&gt;$\left.|\psi\right&amp;gt;=\left.|0\right&amp;gt;^n$&lt;/span&gt; and assume we have a circuit that prepares &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt;. How many times one has to run this circuit and measure &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; in the computational basis to get an accurate estimation of &lt;span class=&quot;math-container&quot;&gt;$\overline{O}$&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;I guess one needs to somehow describe what kind of operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; is. For example, if there is a very large eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; which appears with a very low probability &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$\left.|0\right&amp;gt;^n$&lt;/span&gt; I expect the required number of trials to depends strongly on &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Initially my question arose when reading this &lt;a href=&quot;https://arxiv.org/abs/1909.11485&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; which states on the first page that when &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; is a product of single-qubit observables its average can be computed efficiently by running the quantum circuit &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; many times and averaging the results. Then the authors go on to give efficient classical algorithms for the same task, but they do not explain what is the complexity of the quantum algorithm. It is not clear to me if it is not exponential in the number of qubits.&lt;/p&gt;&#xA;&lt;p&gt;Another motivation for my question. Say we use the VQE (variational quantum eigensolver) to find the ground state of some Hamiltonian. The procedure is to build an ansatz quantum circuit, measure its average energy and then optimize the ansatz parameters to go towards lower energy. My problem is with the second step &amp;quot;measure average energy&amp;quot;. How many times one is supposed to run the quantum circuit for to get the average energy estimation?&lt;/p&gt;&#xA;" OwnerUserId="15239" LastEditorUserId="55" LastEditDate="2021-04-15T11:05:44.533" LastActivityDate="2021-04-15T11:05:44.533" Title="What is the complexity of estimating the expectation value of an observable?" Tags="&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16647" PostTypeId="2" ParentId="16646" CreationDate="2021-03-23T07:47:24.640" Score="7" Body="&lt;p&gt;If you want to extract the exact value then would need &lt;strong&gt;infinite&lt;/strong&gt; number of samples.&lt;/p&gt;&#xA;&lt;p&gt;However, assume no hardware noise, based in the &lt;a href=&quot;https://en.wikipedia.org/wiki/Chebyshev%27s_inequality&quot; rel=&quot;noreferrer&quot;&gt;Chebyshev's inequality&lt;/a&gt; you would need to do &lt;span class=&quot;math-container&quot;&gt;$O(1/\epsilon^2)$&lt;/span&gt; to get within &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; accuracy for each circuit in your experiment. Here, each circuit correspond to a Pauli term that your operator &lt;span class=&quot;math-container&quot;&gt;$O$&lt;/span&gt; decomposed into. For instance, &lt;span class=&quot;math-container&quot;&gt;$O = 1.5Z + 2X - 3Y$&lt;/span&gt;. Then you would need to create 3 circuits to calculate each expectation &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | Z | \psi \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | X | \psi \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | Y | \psi \rangle$&lt;/span&gt;. See this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16610/9858&quot;&gt;answer&lt;/a&gt; here for more detail. Each of those circuit will require &lt;span class=&quot;math-container&quot;&gt;$O(1/\epsilon^2)$&lt;/span&gt; shots/runs to extract an expectation value within &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; from the true expectation value.&lt;/p&gt;&#xA;&lt;p&gt;Thus, you can see that it can be quite expensive.&lt;/p&gt;&#xA;&lt;p&gt;However, on current quantum devices, the noise is so large that you will never able to get within says &lt;span class=&quot;math-container&quot;&gt;$10^{-3}$&lt;/span&gt; accuracy anyway. So by doing a lot of shots/runs won't help much. If you running VQE or any type of variational quantum algorithms on current hardware, &lt;span class=&quot;math-container&quot;&gt;$\approx 10,000$&lt;/span&gt; shots should be enough. If you do too many shots, you will ended up picking up the noise landspace of the cost function...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-23T07:47:24.640" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16648" PostTypeId="2" ParentId="16637" CreationDate="2021-03-23T09:19:17.123" Score="1" Body="&lt;p&gt;I would say that even in case of classical computing, it is very helpful to understand both mathematical theory, e.g. Turing machines, complexity, Boolean functions etc. and egineering behind, e.g. construction of logical circuits. You do not need to deep dive very much, but basic understanding I consider necessary.&lt;/p&gt;&#xA;&lt;p&gt;The same is true for quatum computing. To start with mathematical theory behind and basics of quantum physics could be the best way. Then I would investigate programming techniques, firstly assembly languages (e.g. QASM) and then switch to something higher level like Qiskit. Once you know basics, you can easily use already rich libraries for solving practical problems on quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;You mentioned that you have mathematical and physical background, so understanding basics should be easy for you. I would recommend classical book Quantum computing and Quantum Information by Nielsen and Chuang to start with. It covers both mathematical and physical side of the quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;After that, try to learn some high level quantum programming language. For example Qiskit is very well documented. You can create for educational purposes free account at IBM Q platform and study yourself with examples provided here. It is necessary to know Python language but I think you can find many online courses about that language.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-23T09:19:17.123" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16649" PostTypeId="2" ParentId="16628" CreationDate="2021-03-23T09:32:11.240" Score="1" Body="&lt;p&gt;You can also use Qiskit documentation. There is a source code for any of implemented functions and algorithms. In particular for HHL it is available here: &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/linear_solvers/hhl.html#HHL&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/linear_solvers/hhl.html#HHL&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you get to a function/algorithm description it the &lt;a href=&quot;https://qiskit.org/documentation/install.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;documentation&lt;/a&gt;, simply click on link Code and you will se the source code.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-23T09:32:11.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16650" PostTypeId="2" ParentId="16642" CreationDate="2021-03-23T10:01:31.590" Score="3" Body="&lt;p&gt;When we want to use Bloch sphere formalism it's better to use its conventions. So, &lt;span class=&quot;math-container&quot;&gt;$\theta \in [0, \pi]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi \in [0, 2\pi)$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \cos{\left( \frac{\theta}{2} \right)} |0\rangle + e^{i\varphi}\sin{\left( \frac{\theta}{2} \right)} |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The chosen &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; will correspond to &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; if we chose them the same way: &lt;span class=&quot;math-container&quot;&gt;$\gamma \in [0, \pi]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta \in [0, 2\pi)$&lt;/span&gt;. If we don't choose them that way then we should do some extra steps to find the corresponding Bloch angles for the visualization.&lt;/p&gt;&#xA;&lt;p&gt;If we use the convention for the Bloch angles the  &lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt; sign is not nessasry (in the convention we always have &lt;span class=&quot;math-container&quot;&gt;$\sin{\left( \frac{\gamma}{2} \right)} &amp;gt; 0$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$e^{i \beta '} = \frac{e^{i \beta '} \sin{\left( \frac{\gamma}{2} \right)}}{\sin{\left( \frac{\gamma}{2} \right)}} = \frac{g_1}{\sqrt{ 1 - \cos^2{\left( \frac{\gamma}{2} \right)}}} = \frac{g_1}{\sqrt{1 - g_0^2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Without the &lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt; cases we will obtain only one solution. The &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; case assumes that &lt;span class=&quot;math-container&quot;&gt;$\sin{\left( \frac{\gamma}{2} \right)} &amp;lt; 0$&lt;/span&gt; and in that case the estimated &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; will not directly correspond to &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; (some extra steps are needed in order to find them).&lt;/p&gt;&#xA;&lt;p&gt;Also for the calculated &lt;span class=&quot;math-container&quot;&gt;$\gamma ' \approx 0.91$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\sin{\left( \frac{\gamma '}{2} \right)} &amp;gt; 0$&lt;/span&gt; and again &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; sign can be disregarded.&lt;/p&gt;&#xA;" OwnerUserId="9459" LastEditorUserId="9459" LastEditDate="2021-03-23T10:09:13.150" LastActivityDate="2021-03-23T10:09:13.150" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16651" PostTypeId="1" CreationDate="2021-03-23T10:13:58.943" Score="2" ViewCount="41" Body="&lt;p&gt;According to the formula &lt;span class=&quot;math-container&quot;&gt;$U=e^{i\delta}R_x(\alpha)R_y(\beta)R_z(\gamma)$&lt;/span&gt;, We know that a single quantum gate can be decomposed arbitrarily, But according to the book Quantum Computation. by Nielsen, I get &lt;span class=&quot;math-container&quot;&gt;$H=-iR_x(\pi)R_y(\pi/2)$&lt;/span&gt;, It makes me wonder how can I get rid of the phase &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13731" LastEditorUserId="13731" LastEditDate="2021-03-23T11:38:26.143" LastActivityDate="2021-03-23T11:38:26.143" Title="How can I factor Hadamard gates according to $U=e^{i\delta}R_x(\alpha)R_y(\beta)R_z(\gamma)$" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16652" PostTypeId="2" ParentId="16639" CreationDate="2021-03-23T10:44:52.273" Score="2" Body="&lt;p&gt;We first need to understand what do we mean by Hamming Distance, simply put, for two strings of &lt;strong&gt;equal length&lt;/strong&gt;, it is the number of different symbols in corresponding locations. For example: since we're exclusively dealing with binary strings, let's say we are calculating Hamming distance between &lt;code&gt;001&lt;/code&gt; and &lt;code&gt;000&lt;/code&gt;. Since only the right-most values differ, we get a hamming distance of &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Another example: &lt;code&gt;101&lt;/code&gt; and &lt;code&gt;010&lt;/code&gt; has a hamming distance of &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; since they are different at each position. Hamming distances are widely used in Coding Theory for &lt;a href=&quot;https://en.wikipedia.org/wiki/Error_detection_and_correction&quot; rel=&quot;nofollow noreferrer&quot;&gt;Error detection&lt;/a&gt; and can also be used in Machine Learning as an &lt;a href=&quot;https://www.analyticsvidhya.com/blog/2020/02/4-types-of-distance-metrics-in-machine-learning/#:%7E:text=Hamming%20Distance%20measures%20the%20similarity,the%20corresponding%20characters%20are%20different.&amp;amp;text=Since%20the%20length%20of%20these,can%20calculate%20the%20Hamming%20Distance.&quot; rel=&quot;nofollow noreferrer&quot;&gt;alternative&lt;/a&gt; measure to Euclidean distance. In both the applications it is used to objectively calculate how separate two values are, more the &lt;em&gt;hamming distance&lt;/em&gt; more &lt;em&gt;dissimilar&lt;/em&gt; they are considered to be.&lt;/p&gt;&#xA;&lt;p&gt;Here, hamming distance has the same purpose, to calculate how dissimilar the states are. As you move farther away from &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; (going towards &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt;) the bigger will be the difference between the states and hence the bigger will be the Hamming distance. Going with the same logic, &lt;span class=&quot;math-container&quot;&gt;$|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|111\rangle$&lt;/span&gt; have a hamming distance of 3 hence signifying that they are very different (or better said, completely opposite since &lt;code&gt;hamming distance&lt;/code&gt; = &lt;code&gt;string length&lt;/code&gt;).&lt;/p&gt;&#xA;" OwnerUserId="10376" LastActivityDate="2021-03-23T10:44:52.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16653" PostTypeId="2" ParentId="16651" CreationDate="2021-03-23T11:15:17.853" Score="3" Body="&lt;p&gt;There's a small error but important error in your decomposition of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;: you have three &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotations, but the middle rotation should be over a different angle. In principle this can be any angle, but let's focus on the often used middle-&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;-rotation, so that the decomposition becomes:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U \hat{=}\, e^{i\alpha}R_{Z}(\beta)R_{Y}(\gamma)R_{Z}(\delta).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that I've rearranged some of the parameters, because this is how they often show up in the literature.&lt;/p&gt;&#xA;&lt;p&gt;Then, if we take &lt;span class=&quot;math-container&quot;&gt;$\{\alpha = \frac{\pi}{2}, \beta = 0, \gamma = \frac{\pi}{2}, \delta = \pi\}$&lt;/span&gt;, we get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;&amp;amp;\, e^{\frac{i\pi}{2}}R_{Z}(0)R_{Y}(\frac{\pi}{2})R_{Z}(\pi) \\&#xA;=&amp;amp;\, e^{\frac{i\pi}{2}} \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix} \begin{bmatrix}\cos(\frac{\pi}{4}) &amp;amp; -\sin(\frac{\pi}{4}) \\ \sin(\frac{\pi}{4}) &amp;amp; \cos(\frac{\pi}{4})\end{bmatrix} \begin{bmatrix}e^{\frac{-i\pi}{2}} &amp;amp; 0 \\ 0 &amp;amp; e^{\frac{i\pi}{2}}\end{bmatrix} \\&#xA;=&amp;amp;\, (i)\frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; -1 \\ 1 &amp;amp; 1\end{bmatrix} \begin{bmatrix}-i &amp;amp; 0 \\ 0 &amp;amp; i\end{bmatrix} \\&#xA;=&amp;amp; \, \frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; -1 \\ 1 &amp;amp; 1\end{bmatrix} \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix} \\&#xA;=&amp;amp; \, \frac{1}{\sqrt{2}}\begin{bmatrix}1 &amp;amp; 1 \\ 1 &amp;amp; -1\end{bmatrix} = H.&#xA;\end{split}&#xA;$$&lt;/span&gt;&#xA;Alternatively, you could take &lt;span class=&quot;math-container&quot;&gt;$\{\alpha = \frac{3\pi}{2}, \beta = -\pi, \gamma = \frac{-\pi}{2}, \delta = 0\}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-03-23T11:15:17.853" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16654" PostTypeId="1" AcceptedAnswerId="16657" CreationDate="2021-03-23T11:32:24.990" Score="2" ViewCount="90" Body="&lt;p&gt;As I could found in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/13826&quot;&gt;here&lt;/a&gt; how the &lt;em&gt;transpile&lt;/em&gt; works in qiskit, I understood that transpile gets arbitrary Unitary gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and some set of basis gates as input, and produce some quantum circuit of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; implemented with those basis gates.&lt;/p&gt;&#xA;&lt;p&gt;So, I understood this transpile process as some sort of 'synthesis' problem that has been shown in some literature, but I can't find which synthesis method does Qiskit implemented for their transpile process. Will there be any references or docs that I can refer to?&lt;/p&gt;&#xA;" OwnerUserId="15277" LastEditorUserId="1859" LastEditDate="2021-03-29T09:47:55.977" LastActivityDate="2021-03-29T09:47:55.977" Title="What is Qiskit's Transpiler method for unitary synthesis?" Tags="&lt;qiskit&gt;&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16655" PostTypeId="1" AcceptedAnswerId="16656" CreationDate="2021-03-23T15:19:17.683" Score="2" ViewCount="59" Body="&lt;p&gt;Is there any way to view the quantum circuit of pre implemented quantum algorithm in Qiskit?&#xA;In the Qiskit textbook, there is an &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;example&lt;/a&gt; given for HHL algorithm. Is there any function in Qiskit which lets us see the quantum circuit that was used to compute the results(probabilities) for this example?&lt;/p&gt;&#xA;&lt;p&gt;The code for HHL example is given below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer, transpile, assemble&#xA;from qiskit.circuit.library import QFT&#xA;from qiskit.aqua import QuantumInstance, aqua_globals&#xA;from qiskit.quantum_info import state_fidelity&#xA;from qiskit.aqua.algorithms import HHL, NumPyLSsolver&#xA;from qiskit.aqua.components.eigs import EigsQPE&#xA;from qiskit.aqua.components.reciprocals import LookupRotation&#xA;from qiskit.aqua.operators import MatrixOperator&#xA;from qiskit.aqua.components.initial_states import Custom&#xA;import numpy as np&#xA;&#xA;def create_eigs(matrix, num_auxiliary, num_time_slices, negative_evals):&#xA;    ne_qfts = [None, None]&#xA;    if negative_evals:&#xA;        num_auxiliary += 1&#xA;        ne_qfts = [QFT(num_auxiliary - 1), QFT(num_auxiliary - 1).inverse()]&#xA;&#xA;    return EigsQPE(MatrixOperator(matrix=matrix),&#xA;                   QFT(num_auxiliary).inverse(),&#xA;                   num_time_slices=num_time_slices,&#xA;                   num_ancillae=num_auxiliary,&#xA;                   expansion_mode='suzuki',&#xA;                   expansion_order=2,&#xA;                   evo_time=None,  # This is t, can set to: np.pi*3/4&#xA;                   negative_evals=negative_evals,&#xA;                   ne_qfts=ne_qfts)&#xA;&#xA;def fidelity(hhl, ref):&#xA;    solution_hhl_normed = hhl / np.linalg.norm(hhl)&#xA;    solution_ref_normed = ref / np.linalg.norm(ref)&#xA;    fidelity = state_fidelity(solution_hhl_normed, solution_ref_normed)&#xA;    print(&amp;quot;Fidelity:\t\t %f&amp;quot; % fidelity)&#xA;&#xA;matrix = [[1, -1/3], [-1/3, 1]]&#xA;vector = [1, 0]&#xA;&#xA;orig_size = len(vector)&#xA;matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix, vector)&#xA;&#xA;# Initialize eigenvalue finding module&#xA;eigs = create_eigs(matrix, 3, 50, False)&#xA;num_q, num_a = eigs.get_register_sizes()&#xA;&#xA;# Initialize initial state module&#xA;init_state = Custom(num_q, state_vector=vector)&#xA;&#xA;# Initialize reciprocal rotation module&#xA;reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)&#xA;&#xA;algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,&#xA;           init_state, reci, num_q, num_a, orig_size)&#xA;&#xA;result = algo.run(QuantumInstance(Aer.get_backend('statevector_simulator')))&#xA;print(&amp;quot;Solution:\t\t&amp;quot;, np.round(result['solution'], 5))&#xA;&#xA;result_ref = NumPyLSsolver(matrix, vector).run()&#xA;print(&amp;quot;Classical Solution:\t&amp;quot;, np.round(result_ref['solution'], 5))&#xA;&#xA;print(&amp;quot;Probability:\t\t %f&amp;quot; % result['probability_result'])&#xA;fidelity(result['solution'], result_ref['solution'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Solution:            [1.13586-0.j 0.40896-0.j]&#xA;Classical Solution:  [1.125 0.375]&#xA;Probability:         0.056291&#xA;Fidelity:            0.999432&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15213" LastEditorUserId="15213" LastEditDate="2021-03-23T18:25:05.400" LastActivityDate="2021-03-23T18:25:05.400" Title="Function in Qiskit to get the quantum circuit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16656" PostTypeId="2" ParentId="16655" CreationDate="2021-03-23T15:31:50.550" Score="4" Body="&lt;p&gt;What you can do to see your circuit here is to use &lt;code&gt;construct_circuit&lt;/code&gt;, see &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.HHL.html?highlight=hhl#qiskit.aqua.algorithms.HHL.construct_circuit&quot; rel=&quot;nofollow noreferrer&quot;&gt;the documentation&lt;/a&gt;; notice it can take an optional parameter &lt;strong&gt;&lt;code&gt;measurement&lt;/code&gt;&lt;/strong&gt; (bool, indicate whether measurement on ancillary qubit should be performed).&lt;/p&gt;&#xA;&lt;p&gt;To use it here, what you do is just this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;my_hhl_circuit=algo.construct_circuit() #to stock it somewhere if you want&#xA;my_hhl_circuit.draw() #draw it&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Don't hesitate to tell me if you need something else!&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-03-23T15:31:50.550" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16657" PostTypeId="2" ParentId="16654" CreationDate="2021-03-23T16:18:57.223" Score="2" Body="&lt;p&gt;The function &lt;code&gt;transpile&lt;/code&gt; uses unitary synthesis methods. That's done by a transpiler pass called &lt;code&gt;UnitarySynthesis&lt;/code&gt; (source code &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/passes/synthesis/unitary_synthesis.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;). Depending on the size of the gate to synthesize it has different methods. For example, single-qubit gates are converted into Euler angle rotations by &lt;code&gt;qiskit.quantum_info.synthesis.OneQubitEulerDecomposer&lt;/code&gt; (source code &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/quantum_info/synthesis/one_qubit_decompose.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-23T16:18:57.223" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16658" PostTypeId="2" ParentId="16577" CreationDate="2021-03-23T16:52:46.330" Score="2" Body="&lt;p&gt;The implementation currently available in &lt;code&gt;TwoQubitBasisDecomposer&lt;/code&gt; assumes that the basis gate is supercontrolled (ie has Weyl coordinates &lt;span class=&quot;math-container&quot;&gt;$(\pi/4, \beta, 0)$&lt;/span&gt;) and it should have emitted a warning if you gave it a non-supercontrolled basis such as identity.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;In [4]: id_decomp = TwoQubitBasisDecomposer(np.eye(4))&#xA;&amp;lt;ipython-input-4-5b01dc936099&amp;gt;:1: UserWarning: Only know how to decompose properly for supercontrolled basis gate. This gate is ~Ud(0.0, 0.0, 0.0)&#xA;  id_decomp = TwoQubitBasisDecomposer(np.eye(4))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4322" LastEditorUserId="4322" LastEditDate="2021-03-23T16:57:56.803" LastActivityDate="2021-03-23T16:57:56.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16659" PostTypeId="1" AcceptedAnswerId="16672" CreationDate="2021-03-23T17:30:19.787" Score="2" ViewCount="81" Body="&lt;p&gt;I am trying to use the quantum phase estimation(EigsQPE) of qiskit to find the eigen values of a matrix.&#xA;As I am new to quantum computing so I am confused what to measure in the circuit to derive the eigen values of the input matrix.&lt;/p&gt;&#xA;&lt;p&gt;I know how to identify phase and derive eigen value using phase derived from the most probable bit string for a single eigen value. But deriving multiple eigen values from QPE circuit is confusing. Any help will be much appreciated.&lt;/p&gt;&#xA;&lt;p&gt;Code : &lt;a href=&quot;https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-QPEStandalone.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-QPEStandalone.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15279" LastEditorUserId="55" LastEditDate="2021-03-24T20:31:44.453" LastActivityDate="2021-03-25T17:03:12.937" Title="Finding Eigen Values from Quantum Phase Estimation - Using qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;phase-estimation&gt;&lt;eigenvalue&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16660" PostTypeId="1" AcceptedAnswerId="16661" CreationDate="2021-03-23T18:53:19.690" Score="1" ViewCount="61" Body="&lt;p&gt;Let's denote &lt;span class=&quot;math-container&quot;&gt;$kLP_{c}$&lt;/span&gt; the promise problem where the input, given in an explicit encoding with finite number of bits, is a set &lt;span class=&quot;math-container&quot;&gt;$\{p_{1},p_{2},\ldots p_{m}\}$&lt;/span&gt; of k-local projectors over a n-qbits register such that the least eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^{m}p_{i}$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}\leq\varepsilon\tag{y}\label{eq:LHy-1}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is a parameter given in input, or &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}(n)\geq\varepsilon+n^{-c}\tag{n}\label{eq:LHn-1}$&lt;/span&gt; and the answer is yes (no) in the \ref{eq:LHy-1} (\ref{eq:LHn-1}) case.&lt;/p&gt;&#xA;&lt;p&gt;That is, the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;LH promise problem with hamiltonians that are projectors. Is this restriction known/studied? A circuit-&amp;gt;projectors mapping of the type used to prove QMA1-hardness of QSAT should work in mapping to kLP the generic QMA problem. Or one could maybe reduce a kLH instance to an equivalent instance of kLP. However, how would the energy gap behave?&lt;/p&gt;&#xA;" OwnerUserId="12548" LastEditorUserId="491" LastEditDate="2021-03-24T12:36:42.093" LastActivityDate="2021-03-24T12:36:42.093" Title="The complexity of LH restricted to projectors" Tags="&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16661" PostTypeId="2" ParentId="16660" CreationDate="2021-03-23T19:59:35.323" Score="2" Body="&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0210077&quot; rel=&quot;nofollow noreferrer&quot;&gt;standard Kitaev construction&lt;/a&gt; yields a Hamiltonian where the individual terms are projectors (up to energy shift &amp;amp; rescaling), each of which constrains the system to a subspace. Thus, the problem is QMA-hard.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-23T19:59:35.323" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="16662" PostTypeId="1" CreationDate="2021-03-23T20:32:16.080" Score="7" ViewCount="191" Body="&lt;p&gt;I've been following UT QML course (http://localhost:8888/tree/UNI/PHD/UT-QML) and during their lecture on the Ising hamiltonian, they point out that the hamiltonian of an &lt;em&gt;Ising model without a transverse field commutes&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H=-\sum_{&amp;lt;i,j&amp;gt;} J_{ij} \sigma^Z_i \sigma^Z_{j} - \sum_i h_i \sigma^Z_i.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;em&gt;To make this a quantum Ising model, we need to add a term that does not commute with the rest of the terms. A transverse field is such, which is an on-site interaction just like the external field.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H=-\sum_{&amp;lt;i,j&amp;gt;} J_{ij} \sigma^Z_i \sigma^Z_{j} - \sum_i h_i \sigma^Z_i - \sum_i g_i \sigma^X_i.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am confused by the following. What do they actually mean by a commuting hamiltonian? and second, what is the relationship between a hamiltonian commuting and its 'quantumness'?&lt;/p&gt;&#xA;&lt;p&gt;In their written assignment, the difference between a quantum and non-quantum hamiltonian is just that one is a diagonal operator and the other is not.&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="10480" LastEditDate="2021-03-23T21:04:21.503" LastActivityDate="2021-03-25T18:32:49.553" Title="Why are diagonal Hamiltonians considered classical?" Tags="&lt;hamiltonian-simulation&gt;&lt;classical-quantum&gt;&lt;nonclassicality&gt;" AnswerCount="3" CommentCount="2" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16663" PostTypeId="2" ParentId="16662" CreationDate="2021-03-23T21:02:02.080" Score="7" Body="&lt;h2&gt;Classical Hamiltonians&lt;/h2&gt;&#xA;&lt;p&gt;By the spectral theorem, for every Hamiltonian there exists a basis in which it is diagonal. Thus, it is not correct to say that diagonal Hamiltonians are classical since this would apply to all Hamiltonians.&lt;/p&gt;&#xA;&lt;p&gt;A Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; which is diagonal in a &lt;em&gt;product basis&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; is sometimes described as classical, because the evolution of any initial state in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; driven by such &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; does not give rise to quantum effects such as superposition and entanglement. Moreover, a measurement in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{B}$&lt;/span&gt; at any point during the evolution yields a single, deterministic result and does not entail wavefunction collapse.&lt;/p&gt;&#xA;&lt;p&gt;Note that the designation of certain bases as product bases and of certain Hamiltonians as classical depends on the choice of partitioning of a composite system into subsystems.&lt;/p&gt;&#xA;&lt;h2&gt;Commuting tensor factors&lt;/h2&gt;&#xA;&lt;p&gt;The following characterization of classical Hamiltonians is useful.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Theorem&lt;/strong&gt; Let &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be a Hermitian operator on a two-body Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A\otimes\mathcal{H}_B$&lt;/span&gt;. Then &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is diagonal in a product basis if and only if it can be written as &lt;span class=&quot;math-container&quot;&gt;$H=\sum_{i=0}^{k-1}A_i\otimes B_i$&lt;/span&gt; for some integer &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; and Hermitian operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$A_j$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i,j=0,\dots,k-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$B_j$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i,j=0,\dots,k-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proof&lt;/strong&gt; Suppose &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is diagonal in the product basis &lt;span class=&quot;math-container&quot;&gt;$|\psi_\alpha\rangle\otimes|\phi_\beta\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\alpha=0,\dots,m-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta=0,\dots,n-1$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$m=\dim\mathcal{H}_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n=\dim\mathcal{H}_B$&lt;/span&gt;. The spectral theorem guarantees that &lt;span class=&quot;math-container&quot;&gt;$|\psi_\alpha\rangle\otimes|\phi_\beta\rangle$&lt;/span&gt; are orthogonal. Therefore, &lt;span class=&quot;math-container&quot;&gt;$|\psi_\alpha\rangle$&lt;/span&gt; are orthogonal and &lt;span class=&quot;math-container&quot;&gt;$|\phi_\beta\rangle$&lt;/span&gt; are orthogonal. Moreover, we can choose both bases to be orthonormal. Then, the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{\alpha=0}^{m-1}\sum_{\beta=0}^{n-1}\lambda_{\alpha\beta}|\psi_\alpha\rangle\langle\psi_\alpha|\otimes|\phi_\beta\rangle\langle\phi_\beta|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\alpha\beta}$&lt;/span&gt; is the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; associated with eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\psi_\alpha\rangle\otimes|\phi_\beta\rangle$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$k=mn$&lt;/span&gt;. Any &lt;span class=&quot;math-container&quot;&gt;$i=0,\dots,k-1$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$i=\alpha n + \beta$&lt;/span&gt; for unique &lt;span class=&quot;math-container&quot;&gt;$\alpha=0,\dots,m-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta=0,\dots,n-1$&lt;/span&gt;. Define &lt;span class=&quot;math-container&quot;&gt;$A_{\alpha n + \beta}=\lambda_{\alpha\beta}|\psi_\alpha\rangle\langle\psi_\alpha|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_{\alpha n + \beta}=|\phi_\beta\rangle\langle\phi_\beta|$&lt;/span&gt;. Then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;H &amp;amp;= \sum_{\alpha=0}^{m-1}\sum_{\beta=0}^{n-1}\lambda_{\alpha\beta}|\psi_\alpha\rangle\langle\psi_\alpha|\otimes|\phi_\beta\rangle\langle\phi_\beta| \\&#xA;&amp;amp;=\sum_{\alpha=0}^{m-1}\sum_{\beta=0}^{n-1}A_{\alpha n+\beta}\otimes B_{\alpha n+\beta} \\&#xA;&amp;amp;= \sum_{i=0}^{k-1}A_i\otimes B_i\tag1&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$A_j$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i,j=0,\dots,k-1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$B_j$&lt;/span&gt; for every &lt;span class=&quot;math-container&quot;&gt;$i,j=0,\dots,k-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Conversely, suppose that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; can be written as &lt;span class=&quot;math-container&quot;&gt;$H = \sum_{i=0}^{k-1}A_i\otimes B_i$&lt;/span&gt; with Hermitian operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A_j$&lt;/span&gt; commuting for every &lt;span class=&quot;math-container&quot;&gt;$i,j=0,\dots,k-1$&lt;/span&gt; and Hermitian operators &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_j$&lt;/span&gt; commuting for every &lt;span class=&quot;math-container&quot;&gt;$i,j=0,\dots,k-1$&lt;/span&gt;. The operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; &lt;a href=&quot;https://math.stackexchange.com/questions/3603855/simultaneous-diagonalizability-of-multiple-commuting-matrices&quot;&gt;share a common eigenbasis&lt;/a&gt;, as do operators &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|\psi_\alpha\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\alpha=0,\dots,m-1$&lt;/span&gt; denote the shared eigenbasis of operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi_\beta\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\beta=0,\dots,n-1$&lt;/span&gt; the shared eigenbasis of operators &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt;. We can write &lt;span class=&quot;math-container&quot;&gt;$A_i=\sum_{\alpha=0}^{m-1} \mu_{i,\alpha}|\psi_\alpha\rangle\langle\psi_\alpha|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_i=\sum_{\alpha=0}^{n-1}\nu_{i,\beta}|\phi_\beta\rangle\langle\phi_\beta|$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;H &amp;amp;= \sum_{i=0}^{k-1}A_i\otimes B_i \\&#xA;&amp;amp;= \sum_{i=0}^{k-1}\left( \sum_{\alpha=0}^{m-1} \mu_{i,\alpha}|\psi_\alpha\rangle\langle\psi_\alpha|\right)\otimes \left(\sum_{\beta=0}^{n-1}\nu_{i,\beta}|\phi_\beta\rangle\langle\phi_\beta|\right) \\&#xA;&amp;amp;= \sum_{\alpha=0}^{m-1} \sum_{\beta=0}^{n-1} \left(\sum_{i=0}^{k-1} \mu_{i,\alpha}\nu_{i,\beta}\right) |\psi_\alpha\rangle\langle\psi_\alpha|\otimes |\phi_\beta\rangle\langle\phi_\beta| \\&#xA;&amp;amp;= \sum_{\alpha=0}^{m-1} \sum_{\beta=0}^{n-1} \lambda_{\alpha\beta} |\psi_\alpha\rangle\langle\psi_\alpha|\otimes |\phi_\beta\rangle\langle\phi_\beta| \tag2&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we defined &lt;span class=&quot;math-container&quot;&gt;$\lambda_{\alpha\beta} = \sum_{i=0}^{k-1} \mu_{i,\alpha}\nu_{i,\beta}$&lt;/span&gt;. Equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; exhibits eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in the product basis &lt;span class=&quot;math-container&quot;&gt;$|\psi_\alpha\rangle\otimes|\phi_\beta\rangle$&lt;/span&gt; completing the proof. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark 1:&lt;/strong&gt; The theorem applies to many-body operators as well. This can be seen by suitable generalization of the proof above.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark 2:&lt;/strong&gt; Note that in the above characterization of classical Hamiltonians it is key that tensor factors &lt;em&gt;on each subsystem&lt;/em&gt; commute pairwise across all terms. It is insufficient for the whole terms on the &lt;em&gt;composite system&lt;/em&gt; to commute pairwise. An example of a non-classical Hamiltonian with commuting terms is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;H &amp;amp;= -\frac12\sigma_1^X \sigma_2^X - \frac12\sigma_1^Z \sigma_2^Z  \\&#xA;&amp;amp;= -|\phi^+\rangle\langle\phi^+| + |\psi^-\rangle\langle\psi^-| &#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;whose non-degenerate ground state is &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle=(|00\rangle+|11\rangle)/\sqrt{2}$&lt;/span&gt;. Another related example of a non-classical Hamiltonian with commuting terms is the Toric Code.&lt;/p&gt;&#xA;&lt;p&gt;(Thanks to @NorbertSchuch who pointed out an error in an earlier version of this section and provided the above counterexample.)&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The theorem has two consequences for the Hamiltonians in the question. Namely, it implies that the first Hamiltonian is classical and it justifies the addition of a &lt;em&gt;transversal&lt;/em&gt; field in the second one as a valid attempt to make it non-classical. Its non-classical character can be confirmed by diagonalization.&lt;/p&gt;&#xA;&lt;h2&gt;Terminology&lt;/h2&gt;&#xA;&lt;p&gt;Commutation is a relation between two operators, not a property of an operator. However, the expression &amp;quot;commuting Hamiltonian&amp;quot; is used sometimes as a shortcut for &amp;quot;Hamiltonian with pairwise commuting terms&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-25T06:07:16.273" LastActivityDate="2021-03-25T06:07:16.273" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="16664" PostTypeId="1" AcceptedAnswerId="16665" CreationDate="2021-03-23T21:26:55.737" Score="1" ViewCount="36" Body="&lt;p&gt;&lt;code&gt;qiskit&lt;/code&gt; has a &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/teleportation.html#simulating-qs&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum teleportation tutorial&lt;/a&gt; which winds up with this simulation code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qasm_sim = Aer.get_backend('qasm_simulator')&#xA;t_qc = transpile(qc, qasm_sim)&#xA;qobj = assemble(t_qc)&#xA;counts = qasm_sim.run(qobj).result().get_counts()&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;counts&lt;/code&gt; are for the 3 qbits in the circuit, which also has 2 cbits.  It would be most helpful to get the rightmost state of the wires in this picture for each shot:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Y67ak.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Y67ak.png&quot; alt=&quot;qt circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a function in &lt;code&gt;qiskit&lt;/code&gt; which will give me these wire (cbit and qbit) output states?  I looked everywhere on qiskit and with Google search and I didn't find anything.&lt;/p&gt;&#xA;" OwnerUserId="14909" LastEditorUserId="55" LastEditDate="2021-03-24T20:36:32.040" LastActivityDate="2021-03-24T20:36:32.040" Title="How do I export the rightmost state of circuit wires (qbits and cbits) in a qiskit simulation" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16665" PostTypeId="2" ParentId="16664" CreationDate="2021-03-23T22:27:14.327" Score="1" Body="&lt;p&gt;To extract the final state, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle_{final}$&lt;/span&gt;, before the measurement step, which can be represented by the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/icI47.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/icI47.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;from qiskit import IBMQ, Aer, execute&#xA;import numpy as np&#xA;&#xA;qreg_q = QuantumRegister(3, 'q')&#xA;circuit = QuantumCircuit(qreg_q)&#xA;vector = [0.603 + 0.625j,0.395 + 0.302j]&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;circuit.initialize(initial_state, 0)  &#xA;circuit.barrier(range(3))&#xA;circuit.h(qreg_q[1])&#xA;circuit.cx(qreg_q[1], qreg_q[2])&#xA;circuit.barrier(range(3))&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.h(qreg_q[0])&#xA;circuit.barrier(qreg_q[0], qreg_q[1], qreg_q[2])&#xA;backend = Aer.get_backend(&amp;quot;statevector_simulator&amp;quot;)&#xA;result = execute(circuit, backend=backend, shots=1).result()&#xA;print('Final State Vector:\n', result.get_statevector() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which will output the final state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{final}$&lt;/span&gt; as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Final State Vector:&#xA; [ 0.30127969+0.31227166j  0.30127969+0.31227166j  0.19735569+0.15088966j&#xA; -0.19735569-0.15088966j  0.19735569+0.15088966j -0.19735569-0.15088966j&#xA;  0.30127969+0.31227166j  0.30127969+0.31227166j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, if you want to extract each individual counts result from an experiment, then you first need to add in the &lt;code&gt;measure&lt;/code&gt; like you have on the circuit in your question, then change the &lt;code&gt;backend&lt;/code&gt; option to &lt;code&gt;qasm_simulator&lt;/code&gt; (shot based simulator instead of exact matrix manipulation). Then execute your circuit and extract the count &lt;strong&gt;at each shot&lt;/strong&gt; through specifying the &lt;code&gt;memory&lt;/code&gt; to be True.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qreg_q = QuantumRegister(3, 'q')&#xA;creg_result1 = ClassicalRegister(1, 'crz')&#xA;creg_result2 = ClassicalRegister(1, 'crx')&#xA;circuit = QuantumCircuit(qreg_q, creg_result1, creg_result2)&#xA;vector = [0.603 + 0.625j,0.395 + 0.302j]&#xA;initial_state = vector/np.linalg.norm(vector)&#xA;circuit.initialize(initial_state, 0)  &#xA;circuit.barrier(range(3))&#xA;&#xA;circuit.h(qreg_q[1])&#xA;circuit.cx(qreg_q[1], qreg_q[2])&#xA;circuit.barrier(range(3))&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.h(qreg_q[0])&#xA;circuit.barrier(qreg_q[0], qreg_q[1], qreg_q[2])&#xA;circuit.measure(qreg_q[0], creg_result1[0])&#xA;circuit.measure(qreg_q[1], creg_result2[0])&#xA;print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PuyaL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PuyaL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend(&amp;quot;qasm_simulator&amp;quot;)&#xA;job = execute(circuit, backend=backend, shots=10, memory=True)&#xA;print('result for each shot:', job.result().get_memory() )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;output is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result for each shot: ['1 0', '0 0', '1 0', '1 0', '0 1', '1 1', '1 1', '0 0', '0 1', '1 0']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-23T22:27:14.327" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16666" PostTypeId="1" AcceptedAnswerId="16671" CreationDate="2021-03-23T23:20:20.580" Score="6" ViewCount="73" Body="&lt;p&gt;Suppose I am using Shor's order finding algorithm to calculate the order &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$x\leq N$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. After some run of the QPE subroutine, I obtain a good, &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt;-bit approximation to &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$s\leq r$&lt;/span&gt;. According to, say, Nielsen and Chuang, because my estimation &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is sufficiently close, when I do the continued-fractions algorithm (CFA) on &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, one of the convergents will be exactly &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is, how will we know which convergent? It certainly isn't necessarily the last convergent, since this will be equal to the binary approximation &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$s/r$&lt;/span&gt;. Is there a guess-and-check stage that goes on here and if so, does efficiently of the algorithm depend on the number of convergents being small relative to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Edit: I should mention that I am also curious &lt;em&gt;why&lt;/em&gt; the answer is what it is. Namely, if we are able to make a specific choice of convergent, what mathematical argument allows us to do so?&lt;/p&gt;&#xA;" OwnerUserId="12988" LastEditorUserId="12988" LastEditDate="2021-03-24T15:43:41.053" LastActivityDate="2021-03-24T15:43:41.053" Title="Continued fractions with Shor's algorithm: which convergent?" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16667" PostTypeId="1" AcceptedAnswerId="16668" CreationDate="2021-03-24T01:06:46.780" Score="2" ViewCount="50" Body="&lt;p&gt;When we talk about superdense coding, we say that Alice and Bob share an entangled qubit and then after this, Alice transmits her qubit over to Bob after performing the necessary manipulation.&lt;/p&gt;&#xA;&lt;p&gt;What does this mean experimentally? How do you transmit a single qubit of an entangled qubit over?&lt;/p&gt;&#xA;&lt;p&gt;And, if I understand correctly, only when Bob has both the Alice's and his qubits of the entangled pair can he recover the Bell state that the entangled pair is in.&lt;/p&gt;&#xA;" OwnerUserId="15193" LastEditorUserId="55" LastEditDate="2021-03-24T20:37:13.647" LastActivityDate="2021-03-24T20:37:13.647" Title="How do you transmit a single qubit of an entangled qubit over?" Tags="&lt;entanglement&gt;&lt;superdense-coding&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16668" PostTypeId="2" ParentId="16667" CreationDate="2021-03-24T02:23:48.437" Score="3" Body="&lt;p&gt;It means moving the qubit from one place to another. The fact that the qubit happens to be entangled with some other qubit elsewhere is irrelevant. The technical details of transmission depend on the physical implementation of the qubit. It could be transmission of a photon through free space or fiber or physical transportation of a device with the qubit from one place to another.&lt;/p&gt;&#xA;&lt;p&gt;In principle, it could even be quantum state teleportation, although this is silly in the context of superdense coding because qubit teleportation itself requires transmission of two classical bits.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-03-24T02:23:48.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16669" PostTypeId="1" CreationDate="2021-03-24T05:23:07.943" Score="2" ViewCount="65" Body="&lt;p&gt;This is a follow-up question of the problem I posted earlier. The following diagram illustrates my question:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/fdkIC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/fdkIC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;I'm trying to perform the time evolution of a random Hamiltonian. The green vector represents the expected axis of rotation. I prepared two initial states and I was expecting that the two traces of time evolution (blue and purple curves) should be centered around the green vector. However, on the figure, it looks like there's another vector contributing to the rotation. I'm wondering why that would happen? It seems that the invisible vector corresponds to the solution we don't want in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/16642/12334&quot;&gt;this post&lt;/a&gt;. How can I fix the issue?&lt;/p&gt;&#xA;&lt;p&gt;PS: Each point on the trace corresponds to a result of &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta,\phi,\lambda)$&lt;/span&gt; obtained from the statevector simulator (the quantum circuit only has a &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate, or maybe an extra state-preparation gate in the front). From the given constraints, &lt;span class=&quot;math-container&quot;&gt;$0≤≤$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0≤&amp;lt;2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$0≤&amp;lt;2$&lt;/span&gt;. To make sure my &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; arguments are valid, I tried&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;lambd = float(remainder(lambdt,2*pi))&#xA;phi = float(remainder(phit,2*pi))&#xA;theta =float(remainder(thetat,2*pi))&#xA;lambd = (lambd + 2*np.pi) % (2*np.pi)&#xA;phi = (phi + 2*np.pi) % (2*np.pi)&#xA;if theta &amp;gt; pi:&#xA;   theta = 2*pi-gamma&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where &lt;code&gt;deltat&lt;/code&gt;, &lt;code&gt;betat&lt;/code&gt; and &lt;code&gt;gammat&lt;/code&gt; represent the original t-dependent values (they could take any value), I'm trying to convert them to the range we desire, but the traces obtained don't quite agree with that (due to the undesired 'rings').&lt;/p&gt;&#xA;&lt;p&gt;Thanks so much for the help:)&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="12334" LastEditDate="2021-03-24T21:55:06.537" LastActivityDate="2021-03-24T21:55:06.537" Title="Why there're two axis of rotation when I'm trying to visualize this time-evolution?" Tags="&lt;programming&gt;&lt;mathematics&gt;&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16670" PostTypeId="2" ParentId="16667" CreationDate="2021-03-24T07:34:47.770" Score="1" Body="&lt;p&gt;Your understanding is almost correct. As said in the previous answer it is irrelevant that they are entangled. However, it is crucial for bob to have both to be aware of the actual state. This is a somewhat complicated argument to make but instant communication is impossible because Alice is not aware of what she is communicating and Bob isn’t aware of what he is receiving from Alice. If Bob has both he can ideally measure.&lt;/p&gt;&#xA;" OwnerUserId="15261" LastActivityDate="2021-03-24T07:34:47.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16671" PostTypeId="2" ParentId="16666" CreationDate="2021-03-24T14:12:11.633" Score="1" Body="&lt;p&gt;You use the last one whose denominator is less than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, the number you're trying to factor. The value returned by &lt;code&gt;fraction.limit_denominator(N)&lt;/code&gt; in python.&lt;/p&gt;&#xA;&lt;p&gt;If you're still particularly worried about it, there's nothing really stopping you from trying all of them.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-03-24T14:12:11.633" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16672" PostTypeId="2" ParentId="16659" CreationDate="2021-03-24T18:28:38.730" Score="1" Body="&lt;p&gt;Two things to note:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;EigsQPE needs the eigenvalues to be scaled onto the range (0,1]. You can use &lt;code&gt;evo_time&lt;/code&gt; to set the scaling. If you don't pass this value, a scaling value will be set automatically. You can get this value using &lt;code&gt;eigs.get_scaling()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If the eigenvalue is &lt;span class=&quot;math-container&quot;&gt;$e^{2\pi i\theta}$&lt;/span&gt;, then the register contents will be &lt;span class=&quot;math-container&quot;&gt;$2^n\theta$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;That means if the register contains the value &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and &lt;code&gt;evo_time&lt;/code&gt; equals &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;, then your eigenvalue will be &lt;span class=&quot;math-container&quot;&gt;$2\pi x/(2^ns)$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-03-24T18:28:38.730" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16673" PostTypeId="1" AcceptedAnswerId="16674" CreationDate="2021-03-24T18:44:06.807" Score="0" ViewCount="39" Body="&lt;p&gt;Here is a minimal example for what I want to do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;qc1 = QuantumCircuit(1, name='qc1') &#xA;qc1.x(0)&#xA;&#xA;qc2 = QuantumCircuit(1, name='qc2') &#xA;qc2.h(0)&#xA;qc2.append(qc1, [0])&#xA;qc2.z(0)&#xA;&#xA;c_qc2 = qc2.to_gate().control(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This gives the following error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;qiskit.exceptions.QiskitError: 'One or more instructions cannot be converted to a gate. &amp;quot;qc1&amp;quot; is not a gate instruction'&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I'm aware that in this example I can get the desired controlled gate of &lt;code&gt;qc2&lt;/code&gt; by manually adding a control qubit to each gate in &lt;code&gt;qc2&lt;/code&gt;. However in practice &lt;code&gt;qc2&lt;/code&gt; would be complex and doing so would be tiresome.&lt;/p&gt;&#xA;&lt;p&gt;I also tried &lt;code&gt;qc2.append(qc1.to_instruction(), [0])&lt;/code&gt; which didn't solve the problem. Any help is appreciated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="13215" LastEditorUserId="13215" LastEditDate="2021-03-24T19:38:46.093" LastActivityDate="2021-03-24T21:35:01.003" Title="Make a controlled gate from a QuantumCircuit that uses append in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16674" PostTypeId="2" ParentId="16673" CreationDate="2021-03-24T18:56:16.167" Score="1" Body="&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Miss understood your question earlier. As commented by @Egrettal you can do the following.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit&#xA;&#xA;qc1 = QuantumCircuit(1, name='qc1') &#xA;qc1.x(0)&#xA;print(qc1)&#xA;&#xA;&#xA;qc2 = QuantumCircuit(1, name='qc2') &#xA;qc2.h(0)&#xA;qc2.append(qc1.to_gate(), [0])&#xA;qc2.z(0)&#xA;print(qc2)&#xA;&#xA;&#xA;xs_gate = qc2.to_gate()&#xA;cxs_gate = xs_gate.control()&#xA;circuit = QuantumCircuit(2)&#xA;circuit.append(cxs_gate, [0,1])&#xA;print('\n New circuit with controlled:\n',circuit)&#xA;print('\n Decomposed new circuit:\n', circuit.decompose())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which will output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌───┐&#xA;q_0: ┤ X ├&#xA;     └───┘&#xA;&#xA;&#xA;     ┌───┐┌─────┐┌───┐&#xA;q_0: ┤ H ├┤ qc1 ├┤ Z ├&#xA;     └───┘└─────┘└───┘&#xA;&#xA;&#xA;&#xA; New circuit with controlled:&#xA;             &#xA;q_0: ───■───&#xA;     ┌──┴──┐&#xA;q_1: ┤ qc2 ├&#xA;     └─────┘&#xA;&#xA; Decomposed new circuit:&#xA;     ┌────────┐                                                     »&#xA;q_0: ┤ P(π/2) ├──■───────────────────■───────────────────────────■──»&#xA;     ├────────┤┌─┴─┐┌─────────────┐┌─┴─┐┌──────────┐┌─────────┐┌─┴─┐»&#xA;q_1: ┤ P(π/2) ├┤ X ├┤ U(0,0,-π/2) ├┤ X ├┤ U(0,0,0) ├┤ RY(π/4) ├┤ X ├»&#xA;     └────────┘└───┘└─────────────┘└───┘└──────────┘└─────────┘└───┘»&#xA;«                      ┌──────┐                                       »&#xA;«q_0: ──────────────■──┤ P(0) ├──■────────────────■────────────────■──»&#xA;«     ┌──────────┐┌─┴─┐├──────┤┌─┴─┐┌──────────┐┌─┴─┐┌──────────┐┌─┴─┐»&#xA;«q_1: ┤ RY(-π/4) ├┤ X ├┤ P(0) ├┤ X ├┤ U(0,0,0) ├┤ X ├┤ U(0,0,0) ├┤ X ├»&#xA;«     └──────────┘└───┘└──────┘└───┘└──────────┘└───┘└──────────┘└───┘»&#xA;«     ┌────────┐                                     &#xA;«q_0: ┤ P(π/2) ├──■───────────────────■──────────────&#xA;«     ├────────┤┌─┴─┐┌─────────────┐┌─┴─┐┌──────────┐&#xA;«q_1: ┤ P(π/2) ├┤ X ├┤ U(0,0,-π/2) ├┤ X ├┤ U(0,0,0) ├&#xA;«     └────────┘└───┘└─────────────┘└───┘└──────────┘&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-24T21:35:01.003" LastActivityDate="2021-03-24T21:35:01.003" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16675" PostTypeId="1" CreationDate="2021-03-24T19:59:16.547" Score="1" ViewCount="64" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1804.03719&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Algorithm Implementations for Beginners&lt;/a&gt;, page 7 it is stated,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Suppose we have a three qubit state, &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle$&lt;/span&gt;, but we only measure the first qubit and leave the other two qubits undisturbed. What is the probability of observing a &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; in the first qubit? This probability will be given by,&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{(x_2,x_3)\in\{0,1\}^2}\vert\langle0x_2x_3\vert\phi\rangle\vert^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The state of the system after this measurement will be obtained by normalizing the state&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{(x_2,x_3)\in\{0,1\}^2}\langle0x_2x_3\vert\phi\rangle\vert0x_2x_3\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Applying this paradigm to the state in Eq. (5) we see that the probability of getting &lt;span class=&quot;math-container&quot;&gt;$\vert0\rangle$&lt;/span&gt; in the first qubit will be 0.5, and if this result is obtained, the final state of the system would change to &lt;span class=&quot;math-container&quot;&gt;$\vert 000\rangle$&lt;/span&gt;. On the other hand, if we were to measure &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt; in the first qubit we would end up with a state &lt;span class=&quot;math-container&quot;&gt;$\vert 111\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This feels wrong to me.  Why would measuring the first qubit determine the states of the other two qubits?  Is this an error in the paper?&lt;/p&gt;&#xA;" OwnerUserId="13320" LastEditorUserId="55" LastEditDate="2021-03-24T23:18:50.680" LastActivityDate="2021-03-25T02:21:29.157" Title="Why would measuring a qubit determine the states of the other qubits?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16676" PostTypeId="1" AcceptedAnswerId="16677" CreationDate="2021-03-24T23:11:27.937" Score="1" ViewCount="48" Body="&lt;p&gt;(Newbie here) Accessing IBM Q Experience on a Windows 7 operating system and using the Google Chorme browser. I can completely assemble my circuit, using the IBM Quantum Composer and when executing it goes to the area job, I hope to finish the whole process, but when I press to see the results, only what appears in the image appears, I can't go down the page for the histogram presentation, however when accessing the same Job tab via my cell phone, the histogram and the circuit that was shown appear.&lt;/p&gt;&#xA;&lt;p&gt;[Screenshot from IBM Q Experience]&#xA;&lt;a href=&quot;https://i.stack.imgur.com/hHjs1.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hHjs1.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15306" LastActivityDate="2021-03-24T23:35:47.430" Title="In the job tab, no histogram appears" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;experiment&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16677" PostTypeId="2" ParentId="16676" CreationDate="2021-03-24T23:35:47.430" Score="0" Body="&lt;p&gt;Strange.&lt;/p&gt;&#xA;&lt;p&gt;This offers a way for you to retrieve your histogram but not exactly the solution to your problem. So hopefully it will be useful somehow.&lt;/p&gt;&#xA;&lt;p&gt;First, note that each job you submitted has a &lt;code&gt;job_ID&lt;/code&gt;. You actually can see it on the top left of your screenshot. You can &amp;quot;copy and paste&amp;quot; this JobID into line 6 of the script below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_santiago')&#xA;job = backend.retrieve_job('ENTER JOB_ID HERE')&#xA;counts = job.result().get_counts()&#xA;plot_histogram(counts, color='black', title=&amp;quot;Result&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Executing this script through the Jupyter Notebook provided in Quantum Lab will print out your Histogram. For instance, using a JobID for one of my old job, I printed out the following.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hmU6w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hmU6w.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Again, not the exact solution to your question but at least this should provide you a way to retrieve your result, plot it, and not wasting your time having to rerun your experiment to get a new plot.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-24T23:35:47.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16678" PostTypeId="1" CreationDate="2021-03-25T00:42:24.050" Score="2" ViewCount="95" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;&lt;strong&gt;QSAT&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; &lt;em&gt;is the promise problem where the input, given in an explicit encoding with finite number of bits, is a set &lt;span class=&quot;math-container&quot;&gt;$\{p_{1},p_{2},\ldots p_{m}\}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local projectors over a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qbits register, such that the least eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^{m}p_{i}$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}=0\tag{y}\label{eq:QSATy-1}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}(n)\geq n^{-c}\tag{n}\label{eq:QSATn-1}$&lt;/span&gt; and the answer is yes (no) in the y (n) case.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;&lt;strong&gt;LH&lt;/strong&gt;&lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; &lt;em&gt;is the promise problem where the input, given in an explicit encoding with finite number of bits, is a set &lt;span class=&quot;math-container&quot;&gt;$\{h_{1},h_{2},\ldots h_{m}\}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-local hamiltonians, with eigenvalues in &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;, over a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qbits register, such that the least eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^{m}p_{i}$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}\leq\varepsilon\tag{y}\label{eq:LHy-1}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\varepsilon$&lt;/span&gt; is a parameter given in input, or &lt;span class=&quot;math-container&quot;&gt;$\varepsilon_{\min}(n)\geq\varepsilon+n^{-c}\tag{n}\label{eq:LHn-1}$&lt;/span&gt; and the answer is yes (no) in the y (n) case.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;With same constants, the QSAT problem restricts LH in two things. First, its promise gap is glued to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Second, its hamiltonian terms are projectors. So I can define two new problems.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;QSAT+&lt;/strong&gt; &lt;em&gt;Same as QSAT but with general local hamiltonians with eigenvalues in &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;LH-&lt;/strong&gt; &lt;em&gt;Same as LH but with local projectors.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;As pointed out in the answer of a previous question, the classical &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0210077.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;5local construction&lt;/a&gt; clearly works for projectors, so 5LH- is QMA-hard.  Then, since 5LH is in QMA, there is a polynomial reduction from 5LH to 5LH- via a quantum circuit verification for 5LH. Of course, I expect in this case way more natural reductions. However, for &lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;,  we know that &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0406180.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2LH is QMA-hard&lt;/a&gt;, and &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0602108.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;2QSAT is in P&lt;/a&gt;. So what is the complexity of 2LH- and of 2QSAT+?&lt;/p&gt;&#xA;" OwnerUserId="12548" LastEditorUserId="491" LastEditDate="2021-03-25T17:15:32.247" LastActivityDate="2021-03-25T17:21:42.307" Title="Complexity of Quantum Satisfiability vs Local Hamiltonians" Tags="&lt;complexity-theory&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16679" PostTypeId="2" ParentId="16675" CreationDate="2021-03-25T02:15:39.310" Score="3" Body="&lt;p&gt;Simplest example is the bell state: if you know that the bell state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\dfrac{1}{\sqrt{2}}|00\rangle+\dfrac{1}{\sqrt{2}}|11\rangle$$&lt;/span&gt;&#xA;Then you know that the possible read outs are &lt;span class=&quot;math-container&quot;&gt;$00,11$&lt;/span&gt;. This trivially implies that if the outcome of a measurement on the second qbit is 0, then the first one will be 0 as well. You cannot be unsure about the first qbit and say “it might be zero or one” once you’ve measured the second one.&lt;/p&gt;&#xA;" OwnerUserId="15261" LastEditorUserId="2927" LastEditDate="2021-03-25T02:21:29.157" LastActivityDate="2021-03-25T02:21:29.157" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16681" PostTypeId="1" AcceptedAnswerId="16682" CreationDate="2021-03-25T06:24:02.757" Score="2" ViewCount="94" Body="&lt;p&gt;Good day. I am interested in an IMPLEMENTED, not theoretical, example of code for solving the problem of finding the INDEX of an element in an uncorrected array using Grover's Algorithm. The task looks like this: there is an array [3,6,2,4,9,0,1,5] and it is necessary to determine the index of the element in this array, which is 9 (that is, the result should be 4). I fully understand the example of Grover's algorithm implementation here from qiskit &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/grover.html&lt;/a&gt;, but I cannot transform it to solve the real problem described above. It is desirable to present the solutions on qiskit in Python.&#xA;P.S. I have seen these links, but this all does not provide clarity for me and understanding of how to implement this task: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5696/how-is-the-grover-algorithm-applied-to-a-database&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8759/how-do-you-pass-input-to-a-circuit?r=SearchResults&quot;&gt;2&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11900/how-does-the-grovers-algorithm-work-with-a-real-example&quot;&gt;3&lt;/a&gt;, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2372/grovers-algorithm-a-real-life-example&quot;&gt;4&lt;/a&gt;.&#xA;I would be very grateful for a detailed explanation.!&lt;/p&gt;&#xA;&lt;p&gt;Ater first answer I have questions described in comments and this image.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dBmiP.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;enter image description here&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15310" LastEditorUserId="15310" LastEditDate="2021-03-25T19:26:09.147" LastActivityDate="2021-03-26T13:48:07.887" Title="Grover's algorithm for the real problem of finding the index of an array element" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;python&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16682" PostTypeId="2" ParentId="16681" CreationDate="2021-03-25T08:21:08.370" Score="4" Body="&lt;p&gt;In your case, the array would have to be inputed into the quantum circuit. Usually in Grover, this is let to the oracle who would have some access to it, or to a Quantum Random Access Memory (or QRAM) that would load it for you efficiently (but unfortunately it is not there yet).&lt;/p&gt;&#xA;&lt;p&gt;What you would need in your case is 3 qubits for encoding indices (as you have an array of length 8 -- let's call them register 1) and you would need an extra 4 qubits (where you can have as bitstrings all integers between 0 and 16, as your maximum is 9 -- let's call them register 2). Also probably extra qubits for other operations like phase shift and your oracle.&lt;/p&gt;&#xA;&lt;p&gt;So we can write as: &lt;span class=&quot;math-container&quot;&gt;$ | 0 \rangle_1 | 0 \rangle_2 | 0 \rangle_{extra} $&lt;/span&gt;.&#xA;Applying Hadamard transform on register 1 will then give you:&#xA;&lt;span class=&quot;math-container&quot;&gt;$ \sum_{i=0}^{7} | i \rangle_1 | 0 \rangle_2 | 0 \rangle_{extra} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Of course, you want first an operator to load your array (assuming no code does it for you at the moment). You want to end up with the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{i=0}^{7} | i \rangle_1 | array(i) \rangle_2 | 0 \rangle_{extra} $$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$array(i)$&lt;/span&gt; corresponds to the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th element.&lt;/p&gt;&#xA;&lt;p&gt;Unefficiently, you have to loop over each index (represented by a bitstring in register 1) and apply a control operation that will load &lt;span class=&quot;math-container&quot;&gt;$array(i)$&lt;/span&gt; represented by a bitstring in register 2. So a sequence of multi-controlled NOTs for bitstring loading. As an example, say you want to load the third element which is &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; (and its index in the array is 2) and in bitstring &lt;span class=&quot;math-container&quot;&gt;$010$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubits or &lt;span class=&quot;math-container&quot;&gt;$0100$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; (or &lt;span class=&quot;math-container&quot;&gt;$0010$&lt;/span&gt; in reverse order depending how you read). So your multi-control check in register 1 that the index is &lt;span class=&quot;math-container&quot;&gt;$010$&lt;/span&gt; and apply a NOT gate such that the value in register 2 corresponds to element &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; (the NOT will be on the second qubit of register 2 -- or the third in reverse order).&lt;/p&gt;&#xA;&lt;p&gt;Finally, in your case you need to implement for Grover iterations, the operation that identify the element &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt;. This is again a multi-controlled NOT where you control on register &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; that the bitstring you look at is &lt;span class=&quot;math-container&quot;&gt;$9$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$1001$&lt;/span&gt;) and the NOT will be on the phase shift qubit for Grover to mark that state.&lt;/p&gt;&#xA;&lt;p&gt;Then with these operations, you do your Grover iterations as usual. I won't have code to show but figuring this out is a good exercise.&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Sorry I draw and write really bad...&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tTALS.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tTALS.jpg&quot; alt=&quot;Drawing asked explaining a few steps&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4127" LastEditorUserId="4127" LastEditDate="2021-03-26T13:48:07.887" LastActivityDate="2021-03-26T13:48:07.887" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="16684" PostTypeId="1" CreationDate="2021-03-25T12:00:06.877" Score="3" ViewCount="67" Body="&lt;p&gt;I have essentially developed a Quantum Support Vector Machine to classify some data I have successfully. I wanted to know if it is possible to quantify the speed-up and time difference between this algorithm and a classical Support Vector Machine doing the exact same task. Also is it possible to somewhat estimate how this speed-up will be for larger datasets and scaling?&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot!&lt;/p&gt;&#xA;" OwnerUserId="13092" LastEditorUserId="55" LastEditDate="2021-03-26T11:01:33.303" LastActivityDate="2021-03-26T11:01:33.303" Title="How can I experimentally quantify the &quot;speed up&quot; of a quantum-enhanced machine learning?" Tags="&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16685" PostTypeId="1" AcceptedAnswerId="16686" CreationDate="2021-03-25T12:05:37.423" Score="4" ViewCount="61" Body="&lt;p&gt;There is something that bugs me concerning the use of density matrices. For instance, to argue that quantum teleportation does not spread an information faster than light, Nielsen and Chuang state the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Measuring in Alice's computational basis, the state of the system after the measurement is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle[\alpha|0\rangle+\beta|1\rangle]$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\frac14$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;[...]&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle[\alpha|1\rangle-\beta|0\rangle]$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\frac14$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;They then proceed to compute &lt;span class=&quot;math-container&quot;&gt;$\rho^{AB}$&lt;/span&gt; and trace out Alice's system to find &lt;span class=&quot;math-container&quot;&gt;$\rho^B=\frac12I$&lt;/span&gt;, indicating that Bob has no information whatsoever on the state until Alice gives him the results she got with her measurement.&lt;/p&gt;&#xA;&lt;p&gt;I struggle to understand how to compute the density matrix here, or more exactly why &amp;quot;the system is in state x with probability y&amp;quot; allows to compute it. Once Alice measures the state, she &lt;strong&gt;knows&lt;/strong&gt; the state Bob's system is in. I reckon that Bob doesn't, but what about the following scenario?&lt;/p&gt;&#xA;&lt;p&gt;Let us call the previous Alice and Bob Alice1 and Bob1 and the following ones Alice2 and Bob2.&lt;/p&gt;&#xA;&lt;p&gt;Alice2 prepares a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit basis state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. She sends this register to Bob2, who measures it (to learn &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; with probability 1 since &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is a basis state) creates a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit basis state &lt;span class=&quot;math-container&quot;&gt;$|h\rangle$&lt;/span&gt; chosen uniformly at random, CNOTs it with Alice2's register and sends back to Alice2 her register, without telling her what &lt;span class=&quot;math-container&quot;&gt;$|h\rangle$&lt;/span&gt; is. Hence, Bob2 &lt;strong&gt;knows&lt;/strong&gt; that the total system is in state &lt;span class=&quot;math-container&quot;&gt;$|x\oplus h\rangle|h\rangle$&lt;/span&gt;. In particular, these registers being not entangled, Bob2 &lt;strong&gt;knows&lt;/strong&gt; exactly the state Alice2's system is in, just like Alice1 knew Bob1's state. However, from the point of view of Alice2, the system can be in any basis state with uniform probability. Hence (this is where, I think, the error is), her density matrix is identical to the state of a uniform superposition of basis states, that is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^{A_2}=\sum_i|i\rangle\langle i|$$&lt;/span&gt;.&#xA;There are now two contradictory things that come to my mind:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Since Alice2's density matrix is the same as if she created the state &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}|0\rangle$&lt;/span&gt;, applying &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}$&lt;/span&gt; and measure should return &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability 1. However, Bob2 knows that it will give &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$2^{-n}$&lt;/span&gt;. Hence, it is high likely that Alice won't obtain what she expects, leading to an inconsistency.&lt;/li&gt;&#xA;&lt;li&gt;When carrying out the computation, here's what I got. We have (up to a normalisation constant):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{H}=\sum_{a,b}(-1)^{a\cdot b}|a\rangle\langle b|\,.$$&lt;/span&gt;&#xA;Hence, after having applied &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}$&lt;/span&gt;, the density matrix becomes:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{H}\rho^{A_2}\mathbf{H}^\dagger=\sum_{a,b,x,y,i}(-1)^{a\cdot b}(-1)^{x\cdot y}|a\rangle\langle b|i\rangle\langle i|x\rangle\langle y|$$&lt;/span&gt;&#xA;which can be reduced to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{H}\rho^{A_2}\mathbf{H}^\dagger=\sum_{a,y,i}(-1)^{(a\oplus y)\cdot i}|a\rangle\langle y|$$&lt;/span&gt;&#xA;which can be reduced to:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{H}\rho^{A_2}\mathbf{H}^\dagger=\sum_{a}|a\rangle\langle a|\,.$$&lt;/span&gt;&#xA;hence Alice, will measure &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$2^{-n}$&lt;/span&gt; which is consistent with Bob's point of view. However, this raises the inverse problem: why, if the density matrix is equal to the one of &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}|0\rangle$&lt;/span&gt;, don't we get &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}\rho^{A_2}\,\mathbf{H}^\dagger=|0\rangle\langle0|$&lt;/span&gt;? (This question also applies generally, since, I think, I started with the density matrix corresponding to &lt;span class=&quot;math-container&quot;&gt;$\mathbf{H}|0\rangle$&lt;/span&gt;, I expected the result to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle0|$&lt;/span&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I think these inconsistencies comes from a misunderstanding of mine at some point of the density matrix properties, but I can't see at which point is my reasoning flawed (though I have a guess, see in the text).&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="55" LastEditDate="2021-03-27T11:20:27.977" LastActivityDate="2021-03-27T11:20:27.977" Title="Quantum indistinguishability using density operators" Tags="&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;&lt;faster-than-light&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16686" PostTypeId="2" ParentId="16685" CreationDate="2021-03-25T13:50:27.733" Score="3" Body="&lt;p&gt;The mistake occurs when you compute the reduced state on Alice2's system. For simplicity we'll assume all systems are qubits and in addition &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = |0\rangle$&lt;/span&gt;. In this setting, Bob2 prepares the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11 \rangle)$&lt;/span&gt; and sends the first qubit to Alice. Tracing out the system of Bob2 we find&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{A_2} = \mathrm{Tr}_{B_2}[|\phi\rangle \langle \phi|] = I/2&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity matrix. Thus &lt;span class=&quot;math-container&quot;&gt;$\rho_{A_2} = I/2 \neq H|0\rangle$&lt;/span&gt;, Alice2's reduced state is a uniform mixture of the basis states &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle \langle 0 |, |1\rangle \langle 1 |\}$&lt;/span&gt; and not a uniform superposition of &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle , |1 \rangle \}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To give an example of the difference between uniform superpositions and uniform mixtures, a uniform superposition is by nature a pure state, e.g. for a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional system we have (up to phases) &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_i \frac{1}{\sqrt{d}} |i \rangle$&lt;/span&gt;. On the other hand a uniform mixture, which must be done in the density matrix formalism, is given by &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_i \frac{1}{d} |i \rangle \langle i|$&lt;/span&gt;. Operationally, you can think about a uniform mixture as resulting from choosing a basis state uniformly at random, preparing that state and then forgetting the outcome. Moreover, we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi \rangle \langle \psi | = \sum_{i,j} \frac{1}{d} |i \rangle \langle j| \neq \sum_i \frac{1}{d} |i \rangle \langle i | = \rho,&#xA;$$&lt;/span&gt;&#xA;(well unless &lt;span class=&quot;math-container&quot;&gt;$d=1$&lt;/span&gt;, but that's a bit boring).&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-03-25T13:50:27.733" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16687" PostTypeId="2" ParentId="16575" CreationDate="2021-03-25T15:52:09.677" Score="0" Body="&lt;p&gt;Here's a sort of simple way to do it, if you have a simulator you trust. Note that a Z-basis measurement is equivalent to a Z-controlled CNOT onto an ancilla qubit and then measuring that ancilla in the Z basis. And that a Y-basis measurement is equivalent to a Y-controlled CNOT onto an ancilla qubit and then measuring that ancilla in the Z basis.&lt;/p&gt;&#xA;&lt;p&gt;What you can do is assert that moving the rotation before the controlled operation changes the control basis of the controlled operation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import stim&#xA;&#xA;sim1 = stim.TableauSimulator()&#xA;sim1.do(stim.Circuit(&amp;quot;&amp;quot;&amp;quot;&#xA;    SQRT_X 0&#xA;    CNOT 0 99  # 99 is the ancilla where we're putting the measurement result&#xA;&amp;quot;&amp;quot;&amp;quot;))&#xA;&#xA;sim2 = stim.TableauSimulator()&#xA;sim2.do(stim.Circuit(&amp;quot;&amp;quot;&amp;quot;&#xA;    YCX 0 99  # Y-controlled X gate&#xA;    SQRT_X 0&#xA;&amp;quot;&amp;quot;&amp;quot;))&#xA;&#xA;assert sim1.current_inverse_tableau() == sim2.current_inverse_tableau()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To be safe, you likely want to use the state channel duality to ensure the simulation works for all states instead of just one state.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import stim&#xA;&#xA;sim1 = stim.TableauSimulator()&#xA;sim1.do(stim.Circuit(&amp;quot;&amp;quot;&amp;quot;&#xA;    H 0&#xA;    CNOT 0 98  # 98 is the state channel ancilla&#xA;&#xA;    SQRT_X 0&#xA;    CNOT 0 99  # 99 is the ancilla where we're putting the measurement result&#xA;&amp;quot;&amp;quot;&amp;quot;))&#xA;&#xA;sim2 = stim.TableauSimulator()&#xA;sim2.do(stim.Circuit(&amp;quot;&amp;quot;&amp;quot;&#xA;    H 0&#xA;    CNOT 0 98  # 98 is the state channel ancilla&#xA;&#xA;    YCX 0 99  # Y-controlled X gate&#xA;    SQRT_X 0&#xA;&amp;quot;&amp;quot;&amp;quot;))&#xA;&#xA;assert sim1.current_inverse_tableau() == sim2.current_inverse_tableau()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-03-25T15:52:09.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16688" PostTypeId="2" ParentId="16659" CreationDate="2021-03-25T17:03:12.937" Score="0" Body="&lt;p&gt;Thanks a lot with your two points I was able to proceed further.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-QPEStandalone.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-QPEStandalone.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was able to find the eigen values of the two matrices with greater precision-&#xA;A=[[1,-1/3],[-1/3,1]]&#xA;Expected Eigen Values: [1.33333333 0.66666667]&#xA;Counts: {'11111111': 0.499999999999994, '11111110': 0.499999999999994}&#xA;Actual Eigen Value from Circuit:&#xA;1.3333333333333333&#xA;0.6614173228346456&lt;/p&gt;&#xA;&lt;p&gt;A=[[1,-1/2],[-1/2,1]]&#xA;Expected Eigen Values: [1.5 0.5]&#xA;Counts: {'111': 0.500000000000001, '110': 0.500000000000001}&#xA;Actual Eigen Value from Circuit:&#xA;1.5&#xA;0.5&lt;/p&gt;&#xA;&lt;p&gt;However, when I try other matrix: A = [[1.5, 0.5], [0.5, 1.5]]&#xA;Expected Eigen Values: [2. 1.]&#xA;Counts: {'011': 0.213388347648319, '010': 0.213388347648319}&#xA;Actual Eigen Value from Circuit:&#xA;2.0&#xA;0.6666666666666666&lt;/p&gt;&#xA;&lt;p&gt;I do see there is so much difference in second eigen value.&#xA;If I use the same matrix in HHL to solve linear equation and match results with paper(&lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S037596012030462X?via%3Dihub&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.sciencedirect.com/science/article/pii/S037596012030462X?via%3Dihub&lt;/a&gt;) it works absolutely fine.&#xA;&lt;a href=&quot;https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-HHL.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Anand-GitH/HLL-QauntumComputing/blob/main/Qiskit-HHL.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I doubt now I am doing something wrong in reading out eigen values from QPE. Any suggestions on that part. I am just trying to read out all the eigen values of any matrix using qiskit EigsQPE.&lt;/p&gt;&#xA;" OwnerUserId="15279" LastActivityDate="2021-03-25T17:03:12.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16689" PostTypeId="2" ParentId="16662" CreationDate="2021-03-25T17:12:27.113" Score="2" Body="&lt;p&gt;While &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16663/2293&quot;&gt;Adam's very detailed answer&lt;/a&gt; is probably emaculate, it's a bit long so for people that want a shorter answer, I'll give a much more compact alternative. This is not at all to challenge or try to refute Adam's answer at all.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;What do they actually mean by a commuting hamiltonian?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In the specific case in your question, they are referring to whether or not the terms in the Hamilotnian commute with each other. Terms &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; commute if: &lt;span class=&quot;math-container&quot;&gt;$AB - BA = 0$&lt;/span&gt; where in this case &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; are Pauli matrices so &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; means matrix multiplication.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;what is the relationship between a hamiltonian commuting and its 'quantumness'?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If your Hamiltonian is entirely comprised of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; matrices, it only has diagonal elements (as you already noted) and those diagonal elements are the outputs of a classical function of classical variables: &lt;span class=&quot;math-container&quot;&gt;$f(z_1,z_2,z_3,...,z_n)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$z_i \in \{-1,1\}$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$f(b_1,b_2,b_3,...,b_n)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$b_i$&lt;/span&gt; are the classical &lt;strong&gt;binary variables&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\{0,1\}$&lt;/span&gt; if you make the completely reversible transformation &lt;span class=&quot;math-container&quot;&gt;$b_i = \frac{1}{2}(z_i+1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Many people also believe that a quantum annealer minimizing a diagonal Hamiltonian is &lt;em&gt;no more powerful than a classical comptuer&lt;/em&gt; because the &lt;a href=&quot;https://arxiv.org/abs/0704.1287&quot; rel=&quot;nofollow noreferrer&quot;&gt;simplest Hamiltonian that has been proven to provide as much power as other quantum computers&lt;/a&gt; involves both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; and the same time; although a Grover-type search over the &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; diagonal elements can be done in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{2^n})$&lt;/span&gt; time rather than &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(2^n)$&lt;/span&gt;, so there is indeed some potential for speed-up, but not as much as the full powerful of quantum computing would provide.&lt;/p&gt;&#xA;&lt;p&gt;As Adam has noted, all Hamiltonians can be diagonalized, but in general that's hard to do.&lt;/p&gt;&#xA;&lt;p&gt;I was confused the first time Tameem Albash put his hand up at the end of one of my talks in 2016 and said &amp;quot;but that Hamiltonian's classical&amp;quot; because I was talking about the interaction between electron spins, and spin is an inherently quantum property of a particle for which there is &lt;em&gt;no classical analogue&lt;/em&gt;. But from a computational perspective, there's certainly a difference between a Hamiltonian that's already been diagonalized vs one that's not been, and if you do quantum annealing on a Hamiltonian that's already diagonal, it won't likely be as powerful as a universal quantum computer unless perhaps the driving Hamiltonian has both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; terms in the same basis.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-25T17:12:27.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16690" PostTypeId="2" ParentId="16678" CreationDate="2021-03-25T17:21:42.307" Score="3" Body="&lt;p&gt;&amp;quot;2QSAT+&amp;quot; can be defined in two different ways:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;You can define it such that you allow for general Hamiltonians, but you demand that for a &amp;quot;yes&amp;quot;-instance, the ground state has the property that it minimizes the energy of each term individually. (This is really the spirit of QSAT.) Then, this does not change the complexity, because the energy you assign to all states above the ground space is irrelevant.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You define it such that you want to check if the ground state energy is &amp;lt;=0 or &amp;gt;= 1/poly(n). Then, the problem is QMA-hard, since you can use the Hamiltonian terms to incorporate the energy shift to general energy bounds.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;In the latter case, you could impose the promise that the energy is &lt;em&gt;exactly&lt;/em&gt; zero, or &lt;span class=&quot;math-container&quot;&gt;$\ge 1/\mathrm{poly}(N)$&lt;/span&gt;. It is not clear how much knowing that the energy would be &lt;em&gt;exactly&lt;/em&gt; zero in that case would help.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-03-25T17:21:42.307" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16691" PostTypeId="2" ParentId="16684" CreationDate="2021-03-25T17:24:44.623" Score="2" Body="&lt;p&gt;The paper published in Science: &lt;a href=&quot;https://science.sciencemag.org/content/345/6195/420&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Defining and Detecting Quantum Speed-up&amp;quot;&lt;/a&gt; tells you to measure quantum speed-up with the following formula (... ready for it?!):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;\textrm{speed-up} = \frac{Q}{C},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; is the runtime on a quantum computer, and &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is the runtime on a  classical computer. Believe it or not, this is Eq. 1 in that paper.&lt;/p&gt;&#xA;&lt;p&gt;In reality it's much more complicated than that that, because different classical hardware will have a different &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; value.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;Also is it possible to somewhat estimate how this speed-up will be for larger datasets and scaling?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Without knowing the specific details of your algorithm, which might provide some insight into how the scaling can be measured, you would have to do experiments on larger and larger inputs and empirically guess the asymptotic scaling based on that (which is hard to do properly right now because quantum devices are limited in the number of qubits they offer).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-25T17:24:44.623" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16692" PostTypeId="2" ParentId="16662" CreationDate="2021-03-25T18:21:07.103" Score="2" Body="&lt;p&gt;To pose a very simple answer to compete with all these complex (but also excellent) answers: the Ising model is a classical Hamiltonian because it is diagonal as it's written and therefore all of its eigenstates are classical states in the &lt;span class=&quot;math-container&quot;&gt;$S^z$&lt;/span&gt; basis (no superposition required).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Time evolution produces no mixing of the &lt;span class=&quot;math-container&quot;&gt;$S^z$&lt;/span&gt; basis.&lt;/li&gt;&#xA;&lt;li&gt;All observables (that you can write in the &lt;span class=&quot;math-container&quot;&gt;$S_z$&lt;/span&gt; basis) commute with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; (and all the interesting observables are in the &lt;span class=&quot;math-container&quot;&gt;$S^z$&lt;/span&gt; basis).&lt;/li&gt;&#xA;&lt;li&gt;You can use classical techniques to find the energy, understand phase transitions, etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;A classical limit of a quantum model&lt;/h2&gt;&#xA;&lt;p&gt;To elaborate a bit, the Ising model can be thought of as a &lt;em&gt;classical limit&lt;/em&gt; of a &lt;em&gt;quantum&lt;/em&gt; model. The whole idea that you would have some localized magnetic moment (spin) that has only two possible states is a very quantum idea. The quantum version of the Ising model is the &lt;em&gt;Heisenberg model&lt;/em&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H = -J \sum \limits_{&amp;lt;i,j&amp;gt;} \vec S_i \cdot \vec S_j \tag{1}$$&lt;/span&gt;&#xA;A better way of writing the Heisenberg model is this:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H = -J \sum \limits_{&amp;lt;i,j&amp;gt;} S^z_i S^z_j + \frac{\Delta}{2} \left( S^+_i S^-_j + S^-_i S^+_j \right) \tag{2}$$&lt;/span&gt;&#xA;Now you have an Ising-like term and the off-diagonal interactions in the XY plane are separated out explicitly. If &lt;span class=&quot;math-container&quot;&gt;$\Delta=1$&lt;/span&gt;, you have the full isotropic Heisenberg model, but if you start turning off the XY interactions &lt;span class=&quot;math-container&quot;&gt;$\Delta \to 0$&lt;/span&gt;, you will arrive at the Ising model.&lt;/p&gt;&#xA;&lt;p&gt;Here's the interesting part: the Heisenberg model has &lt;strong&gt;two&lt;/strong&gt; classical limits. One is the Ising model. The other is the &lt;em&gt;classical&lt;/em&gt; Heisenberg model, which is essentially the limit that the total spin &lt;span class=&quot;math-container&quot;&gt;$S\to\infty$&lt;/span&gt;. Then you just have the same Hamiltonian, but with &lt;em&gt;classical&lt;/em&gt; vectors of length S.&lt;/p&gt;&#xA;&lt;p&gt;In fact, the Heisenberg model for &lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$S=3/2$&lt;/span&gt; is less quantum-y than the &lt;span class=&quot;math-container&quot;&gt;$S=1/2$&lt;/span&gt; case&lt;/strong&gt;. The longer you make the quantum spin vector, the more it behaves like a classical vector.&lt;/p&gt;&#xA;&lt;h2&gt;Getting more philosophical&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Classical&lt;/strong&gt; doesn't mean &lt;strong&gt;trivial&lt;/strong&gt;. The vanilla Ising model is pretty interesting in its own right, but throw in a competing nearest neighbor interaction, or &lt;em&gt;randomized&lt;/em&gt; interactions, it can become &lt;em&gt;extremely difficult&lt;/em&gt; to find the ground state. See &lt;a href=&quot;https://en.wikipedia.org/wiki/Spin_glass&quot; rel=&quot;nofollow noreferrer&quot;&gt;spin glass&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;The Ising model has no intrinsic dynamics. Think about it, it just stays in whatever state it starts in. Despite this, there are &lt;a href=&quot;https://arxiv.org/abs/2001.09268&quot; rel=&quot;nofollow noreferrer&quot;&gt;tons of studies&lt;/a&gt; of &lt;a href=&quot;https://journals.aps.org/pre/abstract/10.1103/PhysRevE.80.040101&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising model dynamics.&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;This is a weird special case of a classical limit. For a quantum particle in a box, there is only one classical limit, and even in that case you still have dynamics. In some sense, as you take &lt;span class=&quot;math-container&quot;&gt;$\Delta\to0$&lt;/span&gt;, you are literally turning off the interactions that make it quantum-y! It's very similar to taking the hopping to zero in a tight-binding/Hubbard model.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="12169" LastEditorUserId="2293" LastEditDate="2021-03-25T18:32:49.553" LastActivityDate="2021-03-25T18:32:49.553" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16693" PostTypeId="2" ParentId="16535" CreationDate="2021-03-25T18:58:16.790" Score="2" Body="&lt;p&gt;For the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in your question, please call it a &amp;quot;state&amp;quot;, not &amp;quot;value&amp;quot;. The word &amp;quot;value&amp;quot; is not &amp;quot;mainstream&amp;quot; or popular in this context.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-03-25T18:58:16.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16694" PostTypeId="1" AcceptedAnswerId="16695" CreationDate="2021-03-25T19:43:34.927" Score="1" ViewCount="50" Body="&lt;p&gt;From the qiskit documentation (&lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html#Single-Qubit-Quantum-states&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), a general form of a single qubit unitary is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\theta, \phi, \lambda) = &#xA;\begin{pmatrix} &#xA;\cos\left(\frac{\theta}{2}\right) &amp;amp; -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\&#xA;e^{i\phi} \sin\left(\frac{\theta}{2}\right) &amp;amp; e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right)&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$0≤≤,  0≤&amp;lt;2, \text{and} \  0≤&amp;lt;2$&lt;/span&gt;. However, when I tried to put some arguments out of the range, the gate still operates. For example, if I set &lt;span class=&quot;math-container&quot;&gt;$\theta = -1,\phi=8,\lambda=7$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;simulator = Aer.get_backend('statevector_simulator')&#xA;quancir = QuantumCircuit(1)  &#xA;quancir.u3(-1,8,7,0)&#xA;results = execute(quancir, simulator).result()&#xA;resvec = results.get_statevector(quancir)&#xA;bloch_sphere([conv(resvec)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I can still visualize how the &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate operates on the initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and plot the final vector:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MP7V3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MP7V3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm wondering if my arguments aren't in the expected range, like in this case, what really happened to the &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate? Am I still getting the vector I want, or do I need to convert the arguments myself to make sure the output vector is correct? Thanks:)&lt;/p&gt;&#xA;&lt;p&gt;Update: I tried to take the mod of those parameters but it looks like the output vector is different (points toward the opposite direction):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;quancir = QuantumCircuit(1)  &#xA;T = float(-1%pi)&#xA;P = float(8%(2*pi))&#xA;L = float(7%(2*pi))&#xA;quancir.u3(T,P,L,0)&#xA;results = execute(quancir, simulator).result()&#xA;resvec = results.get_statevector(quancir)&#xA;bloch_sphere([conv(resvec)])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ontpa.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ontpa.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-04-08T21:33:57.613" LastActivityDate="2021-04-08T21:33:57.613" Title="How the arguments of $U_3$ gate are converted when they're not lying in the expected range?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;mathematics&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16695" PostTypeId="2" ParentId="16694" CreationDate="2021-03-25T20:16:47.510" Score="3" Body="&lt;p&gt;In this case all input parameters will be mod &lt;span class=&quot;math-container&quot;&gt;$4\pi$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; respectively. You will obtain the same vector that you would have received if you took the mod of these parameters yourself.&lt;/p&gt;&#xA;" OwnerUserId="9863" LastEditorUserId="9863" LastEditDate="2021-03-28T15:53:48.737" LastActivityDate="2021-03-28T15:53:48.737" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16696" PostTypeId="1" AcceptedAnswerId="16697" CreationDate="2021-03-25T20:19:02.493" Score="6" ViewCount="121" Body="&lt;p&gt;Does anyone know how to make a quantum circuit to compute exponentials where the exponent can be a fraction? To be more precise, I'm looking for a fixed point quantum arithmetic circuit that does the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\vec{x}\rangle|\vec{0}\rangle \rightarrow |\vec{x}\rangle|e^x\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\vec{x}\rangle = |x_2x_1x_0x_{-1}x_{-2}\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt; qubit register, &lt;span class=&quot;math-container&quot;&gt;$|\vec{0}\rangle$&lt;/span&gt; is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit register and where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; represents the binary number&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x = x_2\times 2^2 + x_1\times 2^1 + x_0\times 2^0+x_{-1}\times 2^{-1}+ x_{-2}\times 2^{-2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and where &lt;span class=&quot;math-container&quot;&gt;$|e^x\rangle$&lt;/span&gt; holds the fixed point representation of &lt;span class=&quot;math-container&quot;&gt;$e^x$&lt;/span&gt; to within an error of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; (therefore the value of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; will be chosen based on the value of the desired &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;)&lt;/p&gt;&#xA;" OwnerUserId="14597" LastEditorUserId="14597" LastEditDate="2021-03-25T20:40:00.950" LastActivityDate="2021-03-30T22:22:05.520" Title="Computing $e^x$ on a quantum computer" Tags="&lt;circuit-construction&gt;&lt;quantum-operation&gt;&lt;exponentiation&gt;&lt;arithmetic&gt;" AnswerCount="2" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16697" PostTypeId="2" ParentId="16696" CreationDate="2021-03-25T20:46:22.170" Score="2" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is only 5 bits long, your best bet is almost definitely to just encode all the possible answers into a QROM circuit and do a lookup.&lt;/p&gt;&#xA;&lt;p&gt;Here's a QROM circuit diagram from &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DkC5b.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DkC5b.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And here's Q# source code for constructing a lookup circuit, from ancillary files of &lt;a href=&quot;https://arxiv.org/abs/1905.07682&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1905.07682&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/// # Summary&#xA;/// Performs 'a ^^^= T[b]' where 'a' and 'b' are little-endian quantum registers&#xA;/// and 'T' is a classical table.&#xA;///&#xA;/// Bits in 'T[b]' beyond the range of 'a' are ignored.&#xA;/// It is assumed that the address will never store a value beyond the end of the table.&#xA;/// Invalid addresses cause undefined behavior.&#xA;///&#xA;/// # Input&#xA;/// ## lvalue&#xA;/// The target of the xor. The 'a' in 'a ^^^= T[b]'.&#xA;/// ## table&#xA;/// The classical table containing integers to choose between and xor into the target.&#xA;/// The 'T' in 'a ^^^= T[b]'.&#xA;/// ## address&#xA;/// Determines which integer from the table will be xored into the target.&#xA;/// The 'b' in 'a ^^^= T[b]'.&#xA;operation XorEqualLookup (lvalue: LittleEndian, table: BigInt[], address: LittleEndian) : Unit {&#xA;    body (...) {&#xA;        Controlled XorEqualLookup(new Qubit[0], (lvalue, table, address));&#xA;    }&#xA;    adjoint self;&#xA;    controlled (cs, ...) {&#xA;        if (Length(table) == 0) {&#xA;            fail &amp;quot;Can't lookup values in an empty table.&amp;quot;;&#xA;        }&#xA;&#xA;        // Drop high bits that would place us beyond the range of the table.&#xA;        let maxAddressLen = CeilLg2(Length(table));&#xA;        if (maxAddressLen &amp;lt; Length(address!)) {&#xA;            let kept = LittleEndian(address![0..maxAddressLen - 1]);&#xA;            return Controlled XorEqualLookup(cs, (lvalue, table, kept));&#xA;        }&#xA;&#xA;        // Drop inaccessible parts of table.&#xA;        let maxTableLen = 1 &amp;lt;&amp;lt;&amp;lt; Length(address!);&#xA;        if (maxTableLen &amp;lt; Length(table)) {&#xA;            let kept = table[0..maxTableLen-1];&#xA;            return Controlled XorEqualLookup(cs, (lvalue, kept, address));&#xA;        }&#xA;&#xA;        // Base case: singleton table.&#xA;        if (Length(table) == 1) {&#xA;            XorEqualConst(address, ToBigInt(-1));&#xA;            Controlled XorEqualConst(cs + address!, (lvalue, table[0]));&#xA;            XorEqualConst(address, ToBigInt(-1));&#xA;            return ();&#xA;        }&#xA;&#xA;        // Recursive case: divide and conquer.&#xA;        let highBit = address![Length(address!) - 1];&#xA;        let restAddress = LittleEndian(address![0..Length(address!) - 2]);&#xA;        let h = 1 &amp;lt;&amp;lt;&amp;lt; (Length(address!) - 1);&#xA;        let lowTable = table[0..h-1];&#xA;        let highTable = table[h..Length(table)-1];&#xA;        using (q = Qubit()) {&#xA;            // Store 'all(controls) and not highBit' in q.&#xA;            X(highBit);&#xA;            Controlled InitToggle(cs + [highBit], q);&#xA;            X(highBit);&#xA;&#xA;            // Do lookup for half of table where highBit is 0.&#xA;            Controlled XorEqualLookup([q], (lvalue, lowTable, restAddress));&#xA;&#xA;            // Flip q to storing 'all(controls) and highBit'.&#xA;            Controlled X(cs, q);&#xA;&#xA;            // Do lookup for half of table where highBit is 1.&#xA;            Controlled XorEqualLookup([q], (lvalue, highTable, restAddress));&#xA;&#xA;            // Eager uncompute 'q = all(controls) and highBit'.&#xA;            Controlled UncomputeToggle(cs + [highBit], q);&#xA;        }&#xA;    }&#xA;    controlled adjoint self;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sup&gt;1 Note: I'm an author&lt;/sup&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="23" LastEditDate="2021-03-29T10:23:17.037" LastActivityDate="2021-03-29T10:23:17.037" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16699" PostTypeId="1" AcceptedAnswerId="16725" CreationDate="2021-03-26T06:28:35.160" Score="3" ViewCount="75" Body="&lt;p&gt;I am new to the concept of HSP. Previously, I saw how to solve hidden subgroup problem over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2^n$&lt;/span&gt;, which was Simon's algorithm. Over there the first step was to apply &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}$&lt;/span&gt;, which was indeed the Fourier transform over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now for any general finite abelian group, the course notes I have been following and in many other materials, the starting step is given as to form equal superposition over all the basis vectors i.e.,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{|G|}}\sum_{g\in G} |&#xA;g,0\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; is the finite abelian group. The pair of register contains &lt;span class=&quot;math-container&quot;&gt;$|0,0\rangle$&lt;/span&gt; at the beginning where the first register &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; means log&lt;span class=&quot;math-container&quot;&gt;$(|G|)$&lt;/span&gt; qubits(Why?).&lt;/p&gt;&#xA;&lt;p&gt;In case of Hadamard in Simon's algorithm it was easy to see this step, but in this case can anyone show me how do we get here? We have to apply Fourier transform I know, but the whole steps I am not getting.&lt;/p&gt;&#xA;" OwnerUserId="14931" LastEditorUserId="55" LastEditDate="2021-03-27T11:25:55.533" LastActivityDate="2021-03-27T23:46:39.183" Title="In the hidden subgroup problem for finite Abelian groups, where does the state $\frac{1}{\sqrt{|G|}}\sum_{g\in G} |g,0\rangle$ come from?" Tags="&lt;quantum-fourier-transform&gt;&lt;tensor-product&gt;&lt;superposition&gt;&lt;simons-algorithm&gt;&lt;hidden-subgroup-problem&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16700" PostTypeId="1" CreationDate="2021-03-26T09:57:48.263" Score="3" ViewCount="74" Body="&lt;p&gt;For physical &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional qudits we can define&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X= \sum_{i=0}^{d-1} |i+1\rangle \langle i |$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Z = \sum_{i=0}^{d-1} \omega^i |i\rangle \langle i |,$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\omega=e^{2\pi i/d}$&lt;/span&gt;. The Fourier gate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$F=\frac{1}{\sqrt{d}} \sum_{i,j=0}^{d-1} \omega^{ij} |i\rangle \langle  j|$$&lt;/span&gt;&#xA;transforms one basis into the other, i.e. &lt;span class=&quot;math-container&quot;&gt;$F X F^\dagger = Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now consider a stabilizer error correction code. One can choose the logical &lt;span class=&quot;math-container&quot;&gt;$Z_L$&lt;/span&gt; operator such that it commutes with all stabilizer generators, and one can choose &lt;span class=&quot;math-container&quot;&gt;$X_L$&lt;/span&gt; such that it commutes with the stabilizer generators plus it fulfills &lt;span class=&quot;math-container&quot;&gt;$Z_L X_L = \omega X_L Z_L$&lt;/span&gt;. That should fix our logical qudit space. Now we can choose any operator that maps &lt;span class=&quot;math-container&quot;&gt;$X_L$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$Z_L$&lt;/span&gt; as our &lt;span class=&quot;math-container&quot;&gt;$F_L$&lt;/span&gt;, but is there any canonical way to construct it? I was hoping that there is some compact formula for &lt;span class=&quot;math-container&quot;&gt;$F_L$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$Z_L$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_L$&lt;/span&gt;, but I couldn't find it.&lt;/p&gt;&#xA;&lt;p&gt;To be clear, I am not asking for a decomposition of &lt;span class=&quot;math-container&quot;&gt;$F_L$&lt;/span&gt; in terms of a circuit (even though that is interesting as well), but I am &amp;quot;only&amp;quot; looking for a canonical way to construct the unitary operator itself.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="104" LastEditDate="2021-03-28T17:08:51.950" LastActivityDate="2021-03-28T19:44:35.823" Title="Canonical construction of Logical Fourier Gate" Tags="&lt;quantum-fourier-transform&gt;&lt;stabilizer-code&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="6" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16701" PostTypeId="2" ParentId="6019" CreationDate="2021-03-26T10:12:31.223" Score="1" Body="&lt;p&gt;One interesting property that you can measure with just 1 qubit is interference, and you can demonstrate that no classical (even probabilistic) computing can reproduce that effect. Specifically, you can demonstrate how interference occurs in a system with 1 qubit but not in a system of 1 probabilistic classical bit (or p-bit). This is because matrices that operate on qubits have to be unitary (i.e. &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U = I$&lt;/span&gt;), whereas all matrices that operate on p-bits have to be right stochastic (positive square matrices whose rows add up to 1).&lt;/p&gt;&#xA;&lt;p&gt;As an example of such a demonstration, we start with a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; state, which for both the qubit and p-bit can be represented as &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;1 \\&#xA;0&#xA;\end{pmatrix}$&lt;/span&gt;. We then put them into a &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; state. For the qubit, that means acting on it with an &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; matrix. For the p-bit, that means acting on it with the matrix &lt;span class=&quot;math-container&quot;&gt;$A = \begin{bmatrix}&#xA;0.5 &amp;amp; 0.5 \\&#xA;0.5 &amp;amp; 0.5&#xA;\end{bmatrix}$&lt;/span&gt;. You will see that in both cases, you will have a &lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$50$&lt;/span&gt; state (i.e. &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;\frac{1}{\sqrt{2}} \\&#xA;\frac{1}{\sqrt{2}}&#xA;\end{pmatrix}$&lt;/span&gt; for the qubit and &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix}&#xA;\frac{1}{2} \\&#xA;\frac{1}{2}&#xA;\end{pmatrix}$&lt;/span&gt; for the p-bit). But now try acting on these new states &lt;em&gt;again&lt;/em&gt; with their respective operators, and you'll notice that the final states will now give different probabilities. This is because the qubit will interfere with itself whereas the p-bit won't (which you can see by explicitly performing the matrix multiplication on those states).&lt;/p&gt;&#xA;&lt;p&gt;Maybe an interesting thing to play around with would be to find other examples where you can similary demonstrate the differences between the ways a single qubit and p-bit act due to interference (by e.g. using different starting states and operators) and seeing how the differences in each example compare to each other. You could certainly use IBMQ to model the qubit (and maybe your own code to model the p-bit).&lt;/p&gt;&#xA;" OwnerUserId="14597" LastEditorUserId="14597" LastEditDate="2021-03-26T10:25:53.107" LastActivityDate="2021-03-26T10:25:53.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16702" PostTypeId="1" AcceptedAnswerId="16705" CreationDate="2021-03-26T13:17:40.147" Score="1" ViewCount="153" Body="&lt;p&gt;Executing&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit = qiskit.QuantumCircuit(3, 3)&#xA;circuit.draw(output=&amp;quot;mpl&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;in ipython notebook gives the following image&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zeIER.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zeIER.png&quot; alt=&quot;circuit render&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which looks incomplete. It does not render two other classical registers and also appears to be incorrectly padded. Is my output image really incorrect? How can I fix that?&lt;/p&gt;&#xA;" OwnerUserId="15239" LastEditorUserId="55" LastEditDate="2021-03-26T16:27:41.263" LastActivityDate="2021-03-26T16:27:41.263" Title="Incorrect rendering of a circuit by draw method" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16703" PostTypeId="2" ParentId="16702" CreationDate="2021-03-26T14:15:03.917" Score="5" Body="&lt;p&gt;This looks alright to me, as you haven't added any gates to your circuit so there isn't anything else that should be displayed. As for the classical registers, they are all represent by the line at the bottom, the &lt;code&gt;3&lt;/code&gt; shows that there are 3 classical registers. Setting &lt;code&gt;cregbundle&lt;/code&gt; to false will draw them as independent lines, so &lt;code&gt;circuit.draw(output=&amp;quot;mpl&amp;quot;, cregbundle=True)&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5955" LastActivityDate="2021-03-26T14:15:03.917" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16704" PostTypeId="2" ParentId="16702" CreationDate="2021-03-26T14:39:59.760" Score="2" Body="&lt;p&gt;@met927 looks great. Here is an another example on how you can define different classical register name and having them show up on different wire on your circuit:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qreg_q = QuantumRegister(2, 'qregister')&#xA;creg_c1 = ClassicalRegister(1, 'cregister1')&#xA;creg_c2 = ClassicalRegister(1, 'cregister2')&#xA;&#xA;circuit = QuantumCircuit(qreg_q, creg_c1, creg_c2)&#xA;circuit.h(qreg_q[1])&#xA;circuit.cx(qreg_q[0], qreg_q[1])&#xA;circuit.measure(qreg_q[0], creg_c1[0])&#xA;circuit.measure(qreg_q[1], creg_c2[0])&#xA;&#xA;circuit.draw( 'mpl',style={'name': 'bw'}, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will give you something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JuYN9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JuYN9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-03-26T14:39:59.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16705" PostTypeId="2" ParentId="16702" CreationDate="2021-03-26T15:08:50.630" Score="6" Body="&lt;p&gt;This is a &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/5393&quot; rel=&quot;noreferrer&quot;&gt;known issue&lt;/a&gt; which was &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/5421&quot; rel=&quot;noreferrer&quot;&gt;already fixed&lt;/a&gt; and will be released in the coming qiskit-terra 0.17.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit = qiskit.QuantumCircuit(3, 3)&#xA;circuit.draw(output=&amp;quot;mpl&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ec3UX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ec3UX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-26T15:08:50.630" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16706" PostTypeId="2" ParentId="16700" CreationDate="2021-03-26T19:59:06.360" Score="2" Body="&lt;p&gt;There is no circuit for &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, because &lt;span class=&quot;math-container&quot;&gt;$\{X, Z\}$&lt;/span&gt; is not a universal set of gates and &lt;span class=&quot;math-container&quot;&gt;$F\notin\langle X,Z\rangle$&lt;/span&gt;. The first assertion follows from the fact that the action of any product of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on a state in the computational basis is in the computational basis. The second one follows from the observation that the action of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; on any computational basis state is a uniform superposition of computational basis states.&lt;/p&gt;&#xA;&lt;p&gt;That said, we can express &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; as a polynomial in &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. First note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac1d\sum_{k=0}^{d-1}Z^k = \frac1d\sum_{k=0}^{d-1}\left(\sum_{l=0}^{d-1}\omega^l|l\rangle\langle l|\right)^k = \frac1d\sum_{l=0}^{d-1}\left(\sum_{k=0}^{d-1}\omega^{kl}\right)|l\rangle\langle l| = |0\rangle\langle 0|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac1d\sum_{k=0}^{d-1}X^iZ^kX^{-j} = X^i|0\rangle\langle 0|X^{-j} = |i\rangle\langle j|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which provides a convenient means of expressing any matrix in terms of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;. Substituting into the formula for &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F = \frac{1}{\sqrt{d}}\sum_{i,j=0}^{d-1}\omega^{ij}|i\rangle\langle j| = \frac{1}{d\sqrt{d}}\sum_{i,j,k=0}^{d-1}\omega^{ij} X^iZ^kX^{-j}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If desired we can also eliminate the powers of &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$\omega = X^{-1}ZXZ^{-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-03-28T19:44:35.823" LastActivityDate="2021-03-28T19:44:35.823" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="16707" PostTypeId="2" ParentId="16596" CreationDate="2021-03-26T20:18:14.233" Score="6" Body="&lt;p&gt;This is a very particular application of Adiabatic Quantum Computing so I think it's worth briefly mentioning some context.&lt;/p&gt;&#xA;&lt;p&gt;Roughly speaking, one wants to show that given a quantum circuit defined as a sequence of unitary gates &lt;span class=&quot;math-container&quot;&gt;$U_1,U_2,\ldots,U_L$&lt;/span&gt; it is possible to define a version of the quantum adiabatic algorithm that reproduces (a state with a large overlap with) the output state of the circuit: &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha(L) \rangle = U_L \cdots U_1 \lvert 0 \rangle^{\otimes n}$&lt;/span&gt;. Here we are assuming the circuit is initialized in the state &lt;span class=&quot;math-container&quot;&gt;$\lvert 0 \rangle^{\otimes n}$&lt;/span&gt; at the beginning of the computation.&lt;/p&gt;&#xA;&lt;p&gt;The Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(s)$&lt;/span&gt; that does this is defined over a Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \mathcal{H}_{comp} \otimes \mathcal{H}_{clock}$&lt;/span&gt; that is the tensor product of a &amp;quot;computational&amp;quot; register (which is the same Hilbert space over which the quantum circuit acts) and an auxiliary &amp;quot;clock&amp;quot; register. The standard reference for these constructions is the article &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0405098&quot; rel=&quot;noreferrer&quot;&gt;Adiabatic Quantum Computation is Equivalent to Standard Quantum Computation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, in answering your question I will assume you've chosen your clock states &lt;span class=&quot;math-container&quot;&gt;$\lvert l_c \rangle$&lt;/span&gt; to be orthonormal (as you should have). Following the notation of the reference above, define&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \gamma_l \rangle \equiv \lvert \alpha(l) \rangle \lvert l_c \rangle &#xA;$$&lt;/span&gt;&#xA;Then your question &lt;span class=&quot;math-container&quot;&gt;$H(s)\lvert \gamma_l \rangle \in \mathcal{S}_0$&lt;/span&gt; where&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\mathcal{S}_0 \equiv \operatorname{span}\Big\{ \lvert \gamma_l \rangle \;\Big| \;l=0,1,\ldots,L \Big\}&#xA;\end{equation}&lt;/span&gt;&#xA;boils down to showing that for any choice of &lt;span class=&quot;math-container&quot;&gt;$0 \leq s \leq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$l=0,1,\ldots,L$&lt;/span&gt; the state &lt;span class=&quot;math-container&quot;&gt;$ H(s) \lvert \gamma_l \rangle $&lt;/span&gt; can be written as a linear combination of the states &lt;span class=&quot;math-container&quot;&gt;$\{\lvert \gamma_l \rangle \mid l=1,0\ldots,L\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$H(s)$&lt;/span&gt; is a sum of terms proportional to &lt;span class=&quot;math-container&quot;&gt;$H_{input}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$H_{init}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_{circuit}$&lt;/span&gt;, it is sufficient to show that the states&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_{input}\lvert \gamma_l \rangle, \qquad H_{init}\lvert \gamma_l \rangle, \qquad \text{and} \qquad H_{circuit}\lvert \gamma_l \rangle&#xA;\end{equation}&lt;/span&gt;&#xA;are all linear combinations of the &lt;span class=&quot;math-container&quot;&gt;$\lvert \gamma_l \rangle$&lt;/span&gt;s. This can be done by inspection:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_{input}\lvert \gamma_l \rangle = \sum_{i=1}^n \lvert 1_i \rangle \langle 1_i | \alpha(l) \rangle \otimes \lvert 0_c \rangle \langle 0_c | l_c \rangle = \mathbf{0}&#xA;$$&lt;/span&gt;&#xA;because if &lt;span class=&quot;math-container&quot;&gt;$l \neq 0$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\langle 0_c | l_c \rangle=0$&lt;/span&gt; while for &lt;span class=&quot;math-container&quot;&gt;$l=0$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha(0) \rangle = \lvert 0 \rangle^{\otimes n}$&lt;/span&gt; so all the single-qubit projectors &lt;span class=&quot;math-container&quot;&gt;$\lvert 1_i \rangle \langle 1_i \rvert$&lt;/span&gt; will annihilate the state &lt;span class=&quot;math-container&quot;&gt;$\lvert \alpha(0) \rangle$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_{init} \lvert \gamma_l \rangle = \lvert \alpha(l) \rangle \otimes \sum_{j=1}^L \lvert j_c \rangle \langle j_c | l_c \rangle = \lvert \alpha(l) \rangle  \lvert l_c \rangle&#xA;\end{equation}&lt;/span&gt;&#xA;since here the sum is over all clock states (which are orthonormal) and &lt;span class=&quot;math-container&quot;&gt;$\lvert l \rangle$&lt;/span&gt; is one of them. Finally for &lt;span class=&quot;math-container&quot;&gt;$H_{circuit}$&lt;/span&gt; you can split the terms&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sum_{k=1}^L \lvert \alpha(l) \rangle \otimes \lvert (k-1)_c \rangle \langle (k-1)_c | l_c \rangle &amp;amp;= \begin{cases} 0 &amp;amp; \text{if $l=L$}\\ \lvert \alpha(l) \rangle \lvert l_c \rangle &amp;amp; \text{otherwise}\\&#xA;\end{cases}\\&#xA;\sum_{k=1}^L U_l \lvert \alpha(l) \rangle \otimes \lvert k_c \rangle \langle (k-1)_c | l_c \rangle &amp;amp;= \begin{cases} 0 &amp;amp; \text{if $l=L$}\\&#xA;\lvert \alpha(l+1) \rangle \lvert (l+1)_c \rangle &amp;amp; \text{otherwise}&#xA;\end{cases}\\&#xA;\sum_{k=1}^L U^{\dagger}_l \lvert \alpha(l) \rangle \otimes \lvert (k-1)_c \rangle \langle k_c | l_c \rangle &amp;amp;= \begin{cases} 0 &amp;amp; \text{if $l=0$}\\&#xA;\lvert \alpha(l-1) \rangle \lvert (l-1)_c \rangle &amp;amp; \text{otherwise}&#xA;\end{cases}\\&#xA;\sum_{k=1}^L \lvert \alpha(l) \rangle \otimes \lvert k_c \rangle \langle k_c | l_c \rangle &amp;amp;= \begin{cases} 0 &amp;amp; \text{if $l=0$}\\ \lvert \alpha(l) \rangle \lvert l_c \rangle &amp;amp; \text{otherwise}\\&#xA;\end{cases}&#xA;\end{align}&lt;/span&gt;&#xA;so that you have&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H_{circuit} \lvert \gamma_l \rangle = \begin{cases}&#xA;\lvert \alpha(0) \rangle \lvert 0_c \rangle - \lvert \alpha(1) \rangle \lvert 1_c \rangle&amp;amp; \text{if $l=0$}\\&#xA;2\lvert \alpha(l) \rangle \lvert l_c \rangle - \lvert \alpha(l+1) \rangle \lvert (l+1)_c \rangle - \lvert \alpha(l-1) \rangle \lvert (l-1)_c \rangle &amp;amp; \text{if $0 &amp;lt; l &amp;lt; L$}\\&#xA;\lvert \alpha(L) \rangle \lvert L_c \rangle - \lvert \alpha(L-1) \rangle \lvert (L-1)_c \rangle &amp;amp; \text{if $l=L$}&#xA;\end{cases}&#xA;\end{equation}&lt;/span&gt;&#xA;so in all cases &lt;span class=&quot;math-container&quot;&gt;$H_{circuit} \lvert \gamma_l \rangle$&lt;/span&gt; is a linear combination of the &lt;span class=&quot;math-container&quot;&gt;$\lvert \gamma_l \rangle$&lt;/span&gt; states. Putting everything together observe that&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H(s)\lvert \gamma_l \rangle = (1-s)\lvert \gamma_l \rangle + sH_{circuit} \lvert \gamma_l \rangle&#xA;\end{equation}&lt;/span&gt;&#xA;so &lt;span class=&quot;math-container&quot;&gt;$H(s)\lvert \gamma_l \rangle \in \mathcal{S}_0$&lt;/span&gt; and this completes the proof.&lt;/p&gt;&#xA;" OwnerUserId="14213" LastActivityDate="2021-03-26T20:18:14.233" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16708" PostTypeId="1" CreationDate="2021-03-26T20:49:47.780" Score="1" ViewCount="80" Body="&lt;p&gt;I was reading about quantum teleportation using Qiskit. Alice wants to teleport some quantum state to Bob. My question is &lt;strong&gt;Is it possible for bob just to see the state vector after receiving it from Alice without measuring it?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-03-27T14:59:23.600" LastActivityDate="2021-03-27T14:59:23.600" Title="In quantum teleportation, Is it possible for bob to just see the state vector after receiving it from Alice without measuring it?" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;teleportation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16709" PostTypeId="2" ParentId="16708" CreationDate="2021-03-26T22:35:42.443" Score="2" Body="&lt;p&gt;No, this is not possible. The state vector describes a distribution of a possible outcomes after measurement the quantum state. So, to reconstruct the state vector, the measurement has to be performed.&lt;/p&gt;&#xA;&lt;p&gt;If you can assume that the amplitudes in the state vector are real numbers only, you can only repeat the measurement several times in the computational basis to get reasonable statistics.&lt;/p&gt;&#xA;&lt;p&gt;However, when a quantum phase is involved (i.e. the amplitudes are complex), you have to measure in other bases (e.g. Hadamard)as well or do complete &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_tomography&quot; rel=&quot;nofollow noreferrer&quot;&gt;tomography&lt;/a&gt; to reconstruct the state vector.&lt;/p&gt;&#xA;&lt;p&gt;Note that in Qiskit you can employ &lt;code&gt;statevector_simulator&lt;/code&gt; which reveals the state vector, however, as the name suggest, it only a simulation on a classical computer. In quatum world, the measurement (even repeated one) is necessary to get the state vector.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-26T22:35:42.443" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16710" PostTypeId="1" AcceptedAnswerId="16713" CreationDate="2021-03-26T23:18:24.743" Score="0" ViewCount="61" Body="&lt;p&gt;I have already run the circuit on the IBM Quantum simulators successfully. But, when I ran the same circuit on the real quantum device &lt;em&gt;&lt;strong&gt;ibmq_16_melbourne&lt;/strong&gt;&lt;/em&gt;, I got the error. The IBM website does have the &lt;code&gt;7001&lt;/code&gt; code definition, but it is not specific enough to indicate what the &lt;code&gt;bfunc&lt;/code&gt; means.&lt;/p&gt;&#xA;&lt;p&gt;Could you please help interpret the code? More important, how can I avoid that to have a successful run?&lt;/p&gt;&#xA;&lt;p&gt;Thanks.&lt;/p&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="55" LastEditDate="2021-03-27T14:59:48.343" LastActivityDate="2021-03-27T14:59:48.343" Title="Please help interpret the IBM Quantum error code: &quot;Instruction bfunc is not supported [7001]&quot;" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16712" PostTypeId="1" CreationDate="2021-03-27T03:48:24.437" Score="3" ViewCount="69" Body="&lt;p&gt;Let us consider two &lt;em&gt;quantum channels&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\Phi:M_d\rightarrow M_{d_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_c:M_d\rightarrow M_{d_2}$&lt;/span&gt; that are &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5794/what-is-a-complementary-map&quot;&gt;&lt;em&gt;complementary&lt;/em&gt;&lt;/a&gt; to each other, i.e., there exists an isometry &lt;span class=&quot;math-container&quot;&gt;$V:\mathbb{C}^d\rightarrow \mathbb{C}^{d_1}\otimes \mathbb{C}^{d_2}$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\forall X\in M_d: \quad \Phi(X) = \text{Tr}_2 (VXV^\dagger) \quad\text{and}\quad \Phi_c(X) = \text{Tr}_1 (VXV^\dagger).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We define the &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12917/what-does-the-adjoint-of-a-channel-represent-physically&quot;&gt;&lt;em&gt;adjoints&lt;/em&gt;&lt;/a&gt; &lt;span class=&quot;math-container&quot;&gt;$\Phi^*: M_{d_1}\rightarrow M_{d}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Phi_c^*:M_{d_2}\rightarrow M_d$&lt;/span&gt; of these channels uniquely by the following relations: &lt;span class=&quot;math-container&quot;&gt;$\forall X\in M_d,\, \forall Y\in M_{d_1},\, \forall Z\in M_{d_2}:$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \text{Tr}[\Phi(X)Y]=\text{Tr}[X\Phi^*(Y)] \quad\text{and}\quad \text{Tr}[\Phi_c(X)Z]=\text{Tr}[X\Phi_c^*(Z)].$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is well-known that the adjoints of quantum channels are &lt;em&gt;unital&lt;/em&gt; (i.e., they map the identity matrix to the identity matrix) and completely positive. I am interested in the following composed maps:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Phi^*\circ\Phi: M_d\rightarrow M_d \quad\text{and}\quad \Phi_c^*\circ\Phi_c: M_d\rightarrow M_d,$$&lt;/span&gt; which are again guaranteed to be completely positive (notice that these maps are neither trace-preserving nor unital in general). If people have looked at these kinds of compositions before, I would love to get hold of a reference.&lt;/p&gt;&#xA;&lt;p&gt;In particular, I want to study the &lt;em&gt;supports&lt;/em&gt; (or &lt;em&gt;ranges&lt;/em&gt;) of the images of quantum states under the above maps. If the channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is also &lt;em&gt;completely copositive&lt;/em&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\Phi\circ T$&lt;/span&gt; is again a quantum channel and hence &lt;span class=&quot;math-container&quot;&gt;$T\circ \Phi^*$&lt;/span&gt; is again unital and completely positive (where &lt;span class=&quot;math-container&quot;&gt;$T:M_d\rightarrow M_d$&lt;/span&gt; is the &lt;em&gt;transpose&lt;/em&gt; map), I claim that for all pure states &lt;span class=&quot;math-container&quot;&gt;$\psi\psi^*\in M_d$&lt;/span&gt;, the following inclusion holds&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \text{supp}\,\, [\Phi_c^* \circ \Phi_c](\psi\psi^*) \subseteq \text{supp}\,\, [\Phi^* \circ \Phi](\psi\psi^*).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any help in proving/disproving the above claim would be greatly appreciated. Thanks!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://math.stackexchange.com/questions/4081160/analyzing-compositions-of-cptp-maps-with-their-adjoints&quot;&gt;Cross posted on math.SE&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12710" LastEditorUserId="12710" LastEditDate="2021-03-29T02:12:07.160" LastActivityDate="2021-03-29T02:12:07.160" Title="Analyzing the composition of a channel with its adjoint in relation with an identical composition obtained for the channel's complement" Tags="&lt;quantum-operation&gt;&lt;density-matrix&gt;&lt;projection-operator&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16713" PostTypeId="2" ParentId="16710" CreationDate="2021-03-27T06:05:02.010" Score="1" Body="&lt;p&gt;A &lt;code&gt;bfunc&lt;/code&gt; is a &lt;em&gt;Boolean Function&lt;/em&gt;, as defined in the &lt;a href=&quot;https://arxiv.org/abs/1809.03452&quot; rel=&quot;nofollow noreferrer&quot;&gt;QObj Specification&lt;/a&gt; (page 20) and the error &lt;code&gt;7001&lt;/code&gt; &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/errors#id5&quot; rel=&quot;nofollow noreferrer&quot;&gt;refers to&lt;/a&gt; &lt;code&gt;Instruction {} is not supported&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In other words, &lt;em&gt;the backend &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; does not support boolean functions&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Your circuit has, most likely, a classical conditional, something like &lt;code&gt;if (c==0) h q[0];&lt;/code&gt; in QASM or a &lt;code&gt;circuit.h(qreg_q[0]).c_if(creg_c, 0)&lt;/code&gt; in Qiskit. Conditional are not currently (March 2021) supported by any of the IBM quantum hardware. Although, they supported in many simulators.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-03-27T06:05:02.010" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16714" PostTypeId="1" CreationDate="2021-03-27T08:03:47.937" Score="1" ViewCount="69" Body="&lt;p&gt;I have prepared a quantum circuit, which is using 13 qubits. Now, I am converting this circuit to gate but it is taking around avg. 35s for conversion. It would have have been fine, if I require only one such converison. But, I need to convert 30 such circuits. Why it is taking such amount of time? Is having 13 qubits have something to do with it? My code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&#xA;import networkx as nx&#xA;import math&#xA;i_zero=[1,0]&#xA;i_one=[0,1]&#xA;#-----------Initiating the Graph---------------#&#xA;G=nx.karate_club_graph()&#xA;a=nx.to_numpy_array(G)&#xA;c_nodes= len(list(G.nodes))&#xA;c_edges=len(G.edges())&#xA;#-----------Making the Edge List---------------#&#xA;edge_list_tmp=list(G.edges())&#xA;edge_list=[]&#xA;for i in range(0,c_edges):&#xA;  v_tmp=edge_list_tmp[i]&#xA;  li_tmp=[edge_list_tmp[i][0],edge_list_tmp[i][1],False,'coin_state']&#xA;  edge_list.append(li_tmp)&#xA;#-----------Calculating the Qubits Required---------------#&#xA;c_pq=math.ceil(math.log2(c_nodes))+1&#xA;c_aq=c_pq-1&#xA;li_temp=sorted(G.degree, key=lambda x: x[1], reverse=True)&#xA;h_deg=li_temp[0][1]&#xA;c_cq=math.ceil(math.log2(h_deg))&#xA;#----------Making position Transition circuit-------------#&#xA;qc_l3=[]&#xA;rep_string=&amp;quot;{0:0&amp;quot;+str(c_pq-1)+&amp;quot;b}&amp;quot;&#xA;for i in range(0,len(edge_list)):&#xA;  v1=rep_string.format(edge_list[i][0])&#xA;  v2=rep_string.format(edge_list[i][1])&#xA;  name=&amp;quot; Transition: &amp;quot;+str(edge_list[i][0])+'-&amp;gt;'+str(edge_list[i][1])&#xA;  qc_temp=QuantumCircuit(c_pq,name=name)&#xA;  for i in range(0,len(v1)):&#xA;    if(v1[i]!=v2[i]):&#xA;      qc_temp.x(c_pq-i-2)&#xA;  qc_temp.x(6)&#xA;  qc_l3.append(qc_temp)&#xA;#-----------Assigning coin states to each edge------------#&#xA;coin_edge={}&#xA;curr_v=edge_list[0][0]&#xA;rep_string=&amp;quot;{0:0&amp;quot;+str(c_cq)+&amp;quot;b}&amp;quot;&#xA;for i in range(0,len(edge_list)):&#xA;  for j in range(0,int(math.pow(2,c_cq))-1):&#xA;    if not(edge_list[i][2]):&#xA;      if (edge_list[i][0],rep_string.format(j)) not in coin_edge:&#xA;        edge_list[i][2]=True&#xA;        edge_list[i][3]=rep_string.format(j)&#xA;        coin_edge[(edge_list[i][0],rep_string.format(j))]=1&#xA;        coin_edge[(edge_list[i][1],rep_string.format(j))]=1&#xA;#------Assigning Transition circuit to position states-----#&#xA;coin_states={}&#xA;rep_string=&amp;quot;{0:0&amp;quot;+str(c_cq)+&amp;quot;b}&amp;quot;&#xA;for i in range(0,int(math.pow(2,c_cq))-1):&#xA;  coin_states[rep_string.format(i)]=[]&#xA;for i in range(0,len(edge_list)):&#xA;  coin_states[edge_list[i][3]].append(i)&#xA;rep_string=&amp;quot;{0:0&amp;quot;+str(c_pq-1)+&amp;quot;b}&amp;quot;&#xA;qc_l2=[]&#xA;gate_apply=[]&#xA;for i in range(c_pq,c_pq+c_aq):&#xA;  gate_apply.append(i)&#xA;for i in range(0,c_pq):&#xA;  gate_apply.append(i)&#xA;&#xA;for coin_value,circs in coin_states.items():&#xA;  if len(circs)==0:&#xA;    continue&#xA;  for i in circs:&#xA;    qc_temp=QuantumCircuit(c_pq+c_aq,name='Transition circuit: Coin state '+str(int(coin_value)))&#xA;    for j in range(0,c_pq-1):&#xA;      qc_temp.cx(j,c_pq+j)&#xA;    v1=rep_string.format(edge_list[i][0])&#xA;    v1=v1[::-1] #string reverse&#xA;    for i in range(0,len(v1)):&#xA;      if(v1[i]=='0'):&#xA;        qc_temp.x(c_pq+i)&#xA;    gate_tmp=qc_l3[i].to_gate().control(c_aq)&#xA;    qc_temp.append(gate_tmp,gate_apply)&#xA;    for i in range(0,len(v1)):&#xA;      if(v1[i]=='0'):&#xA;        qc_temp.x(c_pq+i)&#xA;    v2=rep_string.format(edge_list[i][1])&#xA;    v2=v2[::-1]&#xA;    for i in range(0,len(v2)):&#xA;      if(v2[i]=='0'):&#xA;        qc_temp.x(c_pq+i)&#xA;    qc_temp.cx(c_pq-1,c_pq)&#xA;    gate_tmp=qc_l3[i].to_gate().control(c_aq)&#xA;    qc_temp.append(gate_tmp,gate_apply)&#xA;    qc_l2.append([coin_value,qc_temp])&#xA;#-----------------Making Final Circuit with Coin assigned to each transition----------------&amp;gt;&#xA;qc_l3=QuantumCircuit(c_pq+c_aq+c_cq,c_pq-1)&#xA;gate_apply=[]&#xA;for i in range(c_pq+c_aq,c_pq+c_aq+c_cq):&#xA;  qc_l3.h(i)&#xA;  gate_apply.append(i)&#xA;for i in range(0,c_pq+c_aq):&#xA;  gate_apply.append(i)&#xA;for cc in qc_l2:      #cc=coin_circuit&#xA;  coin_value=cc[0]&#xA;  print('ok')&#xA;  coin_value=coin_value[::-1]&#xA;  circ=cc[1]&#xA;  gate_tmp=circ.to_gate().control(c_cq)&#xA;  for j in range(c_pq,c_pq+c_aq):&#xA;      qc_temp.initialize(i_zero,j)&#xA;  for i in range(0,len(coin_value)):&#xA;    if(coin_value[i]=='0'):&#xA;      qc_l3.x(c_pq+c_aq+i)&#xA;  qc_l3.append(gate_tmp,gate_apply)&#xA;  for i in range(0,len(coin_value)):&#xA;    if(coin_value[i]=='0'):&#xA;      qc_l3.x(c_pq+c_aq+i)&#xA;qc_l3.draw('mpl')&#xA;&#xA;&lt;span class=&quot;math-container&quot;&gt;```&lt;/span&gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="55" LastEditDate="2021-03-27T14:56:43.307" LastActivityDate="2021-04-26T15:01:50.173" Title="How fast is qiskit to_gate() method, which is used to convert circuit to gate?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16715" PostTypeId="1" CreationDate="2021-03-27T08:38:54.410" Score="1" ViewCount="12" Body="&lt;p&gt;I have a query that I am using qiskit.aqua.algorithms.QGAN library and using the qgan function and I am having difficulty in loading data of dimension 1000 rows x 10 columns. I am following qiskit's github tutorial for qgan learning and loading, however I did tested out that the tutorial was with 1000 rows and 1 column and is working fine. It did works till 2 columns but for more than 2 columns the function returns error.&#xA;I don't understand if the same dataset is of 1 or 2 column it works but as soon as the data is reshaped to 3 or more columns, it returns this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;AttributeError                            Traceback (most recent call last)&#xA;&amp;lt;ipython-input-36-1df19589f511&amp;gt; in &amp;lt;module&amp;gt;&#xA;      6 &#xA;      7  # Initialize qGAN&#xA;----&amp;gt; 8 qgan = QGAN(real_data, bounds, num_qubits, batch_size, num_epochs, snapshot_dir=None)&#xA;      9 qgan.seed = 1&#xA;D:\Users\Bro\anaconda3\lib\site-packages\qiskit\aqua\algorithms\distribution_learners\qgan.py in __init__(self, data, bounds, num_qubits, batch_size, num_epochs, seed, discriminator, generator, tol_rel_ent, snapshot_dir, quantum_instance)&#xA;    126                 self._num_qubits = np.array([3])&#xA;    127         self._data, self._data_grid, self._grid_elements, self._prob_data = \&#xA;--&amp;gt; 128             discretize_and_truncate(self._data, self._bounds, self._num_qubits,&#xA;    129                                     return_data_grid_elements=True,&#xA;    130                                     return_prob=True, prob_non_zero=True)&#xA;D:\Users\Bro\anaconda3\lib\site-packages\qiskit\aqua\utils\dataset_helper.py in discretize_and_truncate(data, bounds, num_qubits, return_data_grid_elements, return_prob, prob_non_zero)&#xA;    214             for grid_element in grid_elements:&#xA;    215                 for element_current in elements_current_dim:&#xA;--&amp;gt; 216                     temp.append(deepcopy(grid_element).append(element_current))&#xA;    217             grid_elements = deepcopy(temp)&#xA;    218             data_grid.append(elements_current_dim)&#xA;AttributeError: 'NoneType' object has no attribute 'append'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Any solution for the same?? PS:- I am trying to load even bigger dimensional dataset so please help in this.&lt;/p&gt;&#xA;" OwnerUserId="15332" LastEditorUserId="55" LastEditDate="2021-03-27T14:58:52.560" LastActivityDate="2021-03-27T14:58:52.560" Title="Need Help in QGAN function to load higher dimentional data" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16716" PostTypeId="2" ParentId="16714" CreationDate="2021-03-27T08:41:30.370" Score="0" Body="&lt;p&gt;13 qubits involves matrices 8192x8192 which is more than 67 million elements. If one element is 4B, you need 268 MB to save such matrix. Despite some optimization the IBM Q probably do, having 13 qubits is probably the issue.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-03-27T08:41:30.370" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16717" PostTypeId="1" CreationDate="2021-03-27T12:14:40.000" Score="3" ViewCount="112" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_A,\rho_B$&lt;/span&gt; be two states. Is there any way to characterise the set of bipartite states &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_B(\rho)=\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_A(\rho)=\rho_B$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;If I assume &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to be pure, then this is possible &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; have the same spectrum, and then &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi\rangle\!\langle\psi|$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \sum_k \sqrt{\lambda_k} (|\lambda_k^A\rangle\otimes|\lambda_k^B\rangle),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho_A|\lambda_k^A\rangle=\lambda_k|\lambda_k^A\rangle$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$\rho_B|\lambda_k^B\rangle=\lambda_k|\lambda_k^B\rangle$&lt;/span&gt;.&#xA;The freedom in choosing &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the same freedom we have in choosing the eigendecomposition of the marginals: in degenerate eigenspaces any orthonormal basis can be chosen.&lt;/p&gt;&#xA;&lt;p&gt;On the other extreme, if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has maximal entropy, then it is bound to be &lt;span class=&quot;math-container&quot;&gt;$\rho=I/d^2$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimension of each space, and the condition is satisfied if and only if &lt;span class=&quot;math-container&quot;&gt;$\rho_A=\rho_B=I/d$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there anything similar that can be said for the more general case? Either as a general statement without making any assumption on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, or as a way to classify the possible &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with fixed entropy and marginals.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Some related questions are &lt;em&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/16436/55&quot;&gt;What is the most general quantum operation that preserves the marginal?&lt;/a&gt;&lt;/em&gt; and &lt;em&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/16557/55&quot;&gt;Constructing a state with constraints on reduced states&lt;/a&gt;&lt;/em&gt;. The latter is very similar, although it approaches the problem from a different, more numerical, perspective, and it focuses on finding &lt;em&gt;some&lt;/em&gt; solution, rather than characterising the set of possible solutions.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-03-29T07:29:50.303" LastActivityDate="2021-04-13T08:51:20.417" Title="Is there a characterization for the set of states with given marginals?" Tags="&lt;quantum-state&gt;&lt;partial-trace&gt;" AnswerCount="1" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16718" PostTypeId="1" AcceptedAnswerId="16837" CreationDate="2021-03-27T14:08:29.183" Score="1" ViewCount="86" Body="&lt;p&gt;I'm trying to simulate stabilizer circuits using the Clifford tableau formalism that lets you scale up to hundreds of qubits. What I want to do is find the entanglement entropy on by splitting my quantum state (defined as a line of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits) at the end of my quantum circuit after applying gates and some measurements. From &lt;a href=&quot;https://arxiv.org/abs/1901.08092&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, the authors calculate the entanglement entropy for a state defined by its stabilizers. In particular, I'm looking at Equations 10 (this is their &amp;quot;clipped gauge&amp;quot;), A16 and A17. If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; is the set of stabilizers for the state, then the entropy is given by (Equation A16):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S = |A| - \log_2 |\mathcal{S}_A|,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|A|$&lt;/span&gt; is the size of the bipartition of the quantum state and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_A$&lt;/span&gt; is the part of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; which acts on &lt;span class=&quot;math-container&quot;&gt;$\bar{A}$&lt;/span&gt; with the identity.&lt;/p&gt;&#xA;&lt;p&gt;I want to simulate my quantum circuit and calculate the entanglement entropy like they do in their paper, but I'm not sure what's the easiest way to do so. A lot of the tools for simulating stabilizer circuits aren't the most transparent to use. In particular, I'm trying to understand how to go from the tableau representation a lot of simulators output and the set of generators I need to calculate the entropy.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is there a simple procedure to go from the tableau representation to the entropy?&lt;/strong&gt; I'm trying to think of how to implement this in code.&lt;/p&gt;&#xA;&lt;p&gt;For the actual simulator, I see there are a few options. I need measurements, so while Qiskit does offer &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Clifford.html?highlight=stabilizer#qiskit.quantum_info.Clifford.stabilizer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Clifford simulation&lt;/a&gt;, I can't seem to do measurements with it. The others that offer a Python interface are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/quantumlib/Stim&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stim&lt;/a&gt;, by Craig Gidney.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/Strilanc/python-chp-stabilizer-simulator&quot; rel=&quot;nofollow noreferrer&quot;&gt;Python CHP Stabilizer Simulator&lt;/a&gt;, also by Craig Gidney.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://github.com/qsharp-community/chp-sim&quot; rel=&quot;nofollow noreferrer&quot;&gt;CHP Sim&lt;/a&gt;, by the community for Q#.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If anyone has experience with these and can explain how to go from the tableau representation to the calculation of the entropy, that would be great, since these simulators usually seem to be for giving shots in the computational basis.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastEditorUserId="119" LastEditDate="2021-03-27T17:17:48.897" LastActivityDate="2021-04-11T13:41:45.140" Title="Measuring entanglement entropy using a stabilizer circuit simulator" Tags="&lt;simulation&gt;&lt;q#&gt;&lt;entropy&gt;&lt;stabilizer-state&gt;&lt;stim&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16719" PostTypeId="2" ParentId="16718" CreationDate="2021-03-27T15:23:22.910" Score="3" Body="&lt;p&gt;I think stim is the right tool for the job here, because it gives you access to the stabilizer generators and also it defines &lt;code&gt;stim.PauliString&lt;/code&gt; which you can use to represent the stabilizers and more easily implement the manipulations being described in the paper.&lt;/p&gt;&#xA;&lt;p&gt;Ultimately, it will be up to you to translate what the paper wants into a specific combination of methods that implements the logic they describe. Your question isn't really specific enough about which method you want to use from the paper (there's a lot of details hiding behind that equation). Feel free to ask other more specific questions about how to achieve each task in stim. In this answer I'll just be showing how you get the generators.&lt;/p&gt;&#xA;&lt;p&gt;In stim, when using &lt;code&gt;stim.TableauSimulator&lt;/code&gt;, you can get a current list of stabilizer generators like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;tableau = simulator.current_inverse_tableau() ** -1&#xA;return [tableau.z_output(k) for k in range(len(tableau))]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So, basically, you'll have some method sampling stabilizer generators by running a circuit and extracting the stabilizer generators similar to this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from typing import List, Collection&#xA;import stim&#xA;import numpy as np&#xA;&#xA;&#xA;def sample_stabilizers() -&amp;gt; List[stim.PauliString]:&#xA;    # Simulate some operations. Whatever you want.&#xA;    s = stim.TableauSimulator()&#xA;    s.h(0)&#xA;    s.cnot(0, 1)&#xA;    s.measure(0)&#xA;    s.do(stim.Circuit(&amp;quot;&amp;quot;&amp;quot;&#xA;        H 3&#xA;        CZ 1 3&#xA;    &amp;quot;&amp;quot;&amp;quot;))&#xA;    ...&#xA;&#xA;    # Get stabilizers.&#xA;    tableau: stim.Tableau = s.current_inverse_tableau() ** -1&#xA;    n = len(tableau)&#xA;    return [tableau.z_output(k) for k in range(n)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once you have the stabilizer generators, you can start manipulating them. For example, here's a method that tells you the index of the leftmost non-identity term that appears in a stabilizer:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def left(stabilizer: stim.PauliString):&#xA;    return min((i for i, p in enumerate(stabilizer) if p), default=0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-27T16:00:22.770" LastActivityDate="2021-03-27T16:00:22.770" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16720" PostTypeId="5" CreationDate="2021-03-27T15:48:14.907" Score="0" Body="&lt;p&gt;References:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Github repository: &lt;a href=&quot;https://github.com/quantumlib/Stim/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/quantumlib/Stim/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Paper: &lt;a href=&quot;https://arxiv.org/abs/2103.02202&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2103.02202&lt;/a&gt; &amp;quot;Stim: a fast stabilizer circuit simulator&amp;quot;&lt;/li&gt;&#xA;&lt;li&gt;Python package: &lt;a href=&quot;https://pypi.org/project/stim/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pypi.org/project/stim/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-27T15:55:13.673" LastActivityDate="2021-03-27T15:55:13.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16721" PostTypeId="4" CreationDate="2021-03-27T15:48:14.907" Score="0" Body="Stim is an open source tool for high performance simulation of quantum stabilizer circuits. Stim can be built and used from the command line, or installed as a python package." OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-27T15:55:13.673" LastActivityDate="2021-03-27T15:55:13.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16723" PostTypeId="1" CreationDate="2021-03-27T18:37:19.697" Score="1" ViewCount="34" Body="&lt;p&gt;Quantum advantage/supremacy was achieved by Google using a quantum computer and more recently by Pan Jianwei's group using photons. So I was wondering, has any analog quantum simulator showed quantum advantage yet?&#xA;If yes, which one? And if not, what are the biggest hurdles?&lt;/p&gt;&#xA;&lt;p&gt;If I'm not mistaken, current quantum simulators are in the range of hundreds of qubits, and thus they are already big enough to be difficult to simulate classically. Furthermore, even though they cannot perform universal computation, they are well suited to perform Hamiltonian simulation, at least for certain Hamiltonians.&lt;/p&gt;&#xA;&lt;p&gt;Are these devices capable of simulating classically intractable Hamiltonians? If not, are they expected to be capable soon?&lt;/p&gt;&#xA;" OwnerUserId="15338" LastEditorUserId="55" LastEditDate="2021-03-27T22:11:18.183" LastActivityDate="2021-03-27T22:11:18.183" Title="Has any analogue quantum simulator showed quantum advantage yet?" Tags="&lt;hamiltonian-simulation&gt;&lt;quantum-advantage&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16724" PostTypeId="1" CreationDate="2021-03-27T19:05:51.887" Score="0" ViewCount="38" Body="&lt;p&gt;qRNG is an open-source quantum random number generator written in python and Quantis RNG is a physical quantum random number generator. Both are capable of generating quantum random numbers, but how do they differ?&lt;/p&gt;&#xA;" OwnerUserId="15339" LastEditorUserId="55" LastEditDate="2021-03-27T22:06:57.650" LastActivityDate="2021-04-29T08:04:10.390" Title="What's the difference between open-source QRNG and Quantis Device?" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;classical-computing&gt;&lt;python&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16725" PostTypeId="2" ParentId="16699" CreationDate="2021-03-27T19:25:55.440" Score="2" Body="&lt;p&gt;With the Hidden Subgroup Problem, abelian or otherwise, we have a function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; from elements of &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt; to an arbitrary set &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, that is constant on cosets of &lt;span class=&quot;math-container&quot;&gt;$H\le G$&lt;/span&gt; and is distinct on different cosets of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Conventionally and at a high level of abstraction, this function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is described with an oracle that maps elements of &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt; to elements &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt;.  Elements &lt;span class=&quot;math-container&quot;&gt;$g\in G$&lt;/span&gt; are described just as elements of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; (while elements &lt;span class=&quot;math-container&quot;&gt;$x\in X$&lt;/span&gt; are often called colors as there may or may not be an ordering among elements of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;However it can be convenient to think of &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; as &lt;em&gt;integers&lt;/em&gt; or &lt;em&gt;bit-strings&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}^n_2$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$n=\log_2 \vert G\vert$&lt;/span&gt;.  But then we will need to envision a bijection mapping &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; (as abstract group elements) to/from integers/bit-strings in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}^n_2$&lt;/span&gt; (as more concrete states of qubits on which we work).&lt;/p&gt;&#xA;&lt;p&gt;One of the first steps in HSP algorithms is to prepare a first input register into the uniform superposition over all elements of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;; later we evaluate our oracle &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; on the second output register representing elements of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hence once we can conceptualize the inputs &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; as integers/bit-strings, this can be accomplished in a straightforward manner, by performing Hadamard transforms on the input qubits.&lt;/p&gt;&#xA;&lt;p&gt;This works for nonabelian groups too.  For example in the symmetric group &lt;span class=&quot;math-container&quot;&gt;$S_n$&lt;/span&gt;, elements &lt;span class=&quot;math-container&quot;&gt;$g\in S_n$&lt;/span&gt; may be permutations &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt;.  So a first step would be to find a good bijection between integers in &lt;span class=&quot;math-container&quot;&gt;$[n!]$&lt;/span&gt; and elements of &lt;span class=&quot;math-container&quot;&gt;$S_n$&lt;/span&gt;, that enables evaluation of an oracle &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; into the second register.  I believe (although I've not studied it too much) that there are many efficiently-evaluated bijections between integers in &lt;span class=&quot;math-container&quot;&gt;$[n!]$&lt;/span&gt; and permutations &lt;span class=&quot;math-container&quot;&gt;$\pi\in S_n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-03-27T23:46:39.183" LastActivityDate="2021-03-27T23:46:39.183" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16726" PostTypeId="1" CreationDate="2021-03-27T20:06:23.713" Score="0" ViewCount="46" Body="&lt;p&gt;I'm working through the Nielsen and Chuang book and am trying to understand the Deutsch-Jozsa algorithm. I think I understand it as it's presented, however I'm curious what would happen if we used &lt;span class=&quot;math-container&quot;&gt;$|1^n\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|0^n\rangle$&lt;/span&gt;. At the summation steps I've been told the innermost sum will go to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, but I'm having trouble figuring out why this would be the case.&lt;/p&gt;&#xA;" OwnerUserId="15233" LastEditorUserId="2927" LastEditDate="2021-03-27T21:32:34.123" LastActivityDate="2021-03-27T21:32:34.123" Title="Deutsch-Jozsa - Why $|0^n\rangle$ instead of $|1^n\rangle$?" Tags="&lt;nielsen-and-chuang&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16727" PostTypeId="1" CreationDate="2021-03-27T21:04:16.343" Score="1" ViewCount="29" Body="&lt;p&gt;I tried to edit the tags and saved them, but the &amp;quot;Jobs&amp;quot; page displays empty tags always. Is that a bug? Did I do it incorrectly?&#xA;&lt;a href=&quot;https://i.stack.imgur.com/MA38y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MA38y.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jfld1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jfld1.png&quot; alt=&quot;IBM Quantum Jobs&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="9768" LastEditDate="2021-03-29T23:43:40.977" LastActivityDate="2021-03-29T23:43:40.977" Title="IBM Quantum &quot;Jobs&quot; web page problem: &quot;Tags&quot; always missing" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16728" PostTypeId="1" AcceptedAnswerId="16733" CreationDate="2021-03-27T23:48:08.023" Score="2" ViewCount="44" Body="&lt;p&gt;Suppose I create the very simple circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[1];&#xA;x q[0];&#xA;barrier q[0];&#xA;x q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and submit it to an IBM backend. How do I find the buffer time between the end of the first &lt;code&gt;X&lt;/code&gt; and the beginning of the second &lt;code&gt;X&lt;/code&gt; for a given backend? I've seen the number &lt;code&gt;~10 ns&lt;/code&gt; thrown around in the literature (see &lt;a href=&quot;http://arxiv.org/abs/1807.08768&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; above Fig. 1), but this value is not displayed in the calibration data for a device.&lt;/p&gt;&#xA;&lt;p&gt;Just for clarify, I am NOT referring to the duration of &lt;code&gt;X&lt;/code&gt; but the duration of time between the &lt;code&gt;X&lt;/code&gt; pulses even &amp;quot;when it appears to be 0.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;If there's a way to obtain it via Qiskit on a per-calibration basis, that's even better, but just a reference which verifies that &lt;code&gt;10 ns&lt;/code&gt; is a reasonable value would suffice.&lt;/p&gt;&#xA;" OwnerUserId="2895" LastActivityDate="2021-03-28T12:07:37.087" Title="What is the minimal delay between gates on IBM devices?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16729" PostTypeId="1" CreationDate="2021-03-28T01:57:12.870" Score="5" ViewCount="106" Body="&lt;p&gt;In Daniel Greenbaum's &lt;a href=&quot;https://arxiv.org/abs/1509.02921&quot; rel=&quot;noreferrer&quot;&gt;paper&lt;/a&gt;, &amp;quot;Introduction to Gate Set Tomography&amp;quot;, in page 20, he claims the gate sets &lt;span class=&quot;math-container&quot;&gt;$G = \{\{\}, X_{\pi/2}, Y_{\pi/2}\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$G' = \{ \{\}, X_{\pi/2}, Y_{\pi/2}, X_{\pi}\}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$F_k \in G$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$F_k |\rho\rangle\rangle$&lt;/span&gt; are able to &amp;quot;span the bloch sphere&amp;quot;. He clarifies this with, measurements &lt;span class=&quot;math-container&quot;&gt;$\langle\langle E | F_k |\rho \rangle \rangle$&lt;/span&gt; spans the Bloch sphere. Certainly, &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;and &lt;span class=&quot;math-container&quot;&gt;$G'$&lt;/span&gt; cannot &amp;quot;hit&amp;quot; every element in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}^2$&lt;/span&gt;. Taking &lt;span class=&quot;math-container&quot;&gt;$\{\langle\langle E_k |\} = \{|x\rangle\langle x|, x \in \{0, 1\}^n\}$&lt;/span&gt;, does &amp;quot;span the bloch sphere&amp;quot;, just mean you are able to &amp;quot;hit&amp;quot; all states in &lt;span class=&quot;math-container&quot;&gt;$\{\langle\langle E_k |\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In general how do you determine if a gate set has this property? Are there other measurement bases that are ever used? What does a complete set of gates look like for 2 qubits? What are some other examples of &amp;quot;spanning&amp;quot; gate sets on 1 qubit? What happens with the CNOT gate? It doesn't seem to be addressed in any literature I've seen implementing GST.&lt;/p&gt;&#xA;" OwnerUserId="2800" LastActivityDate="2021-04-06T13:47:07.553" Title="How to know if your gate set is &quot;complete&quot;" Tags="&lt;universal-gates&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16731" PostTypeId="2" ParentId="16728" CreationDate="2021-03-28T10:37:42.337" Score="3" Body="&lt;p&gt;Not an expert here, but my impression is that the rotations are scheduled one after the other one, with no delay.&lt;/p&gt;&#xA;&lt;p&gt;Taking your example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import schedule, QuantumCircuit, transpile, IBMQ&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider()&#xA;&#xA;circuit = QuantumCircuit(1)&#xA;circuit.x(0)&#xA;circuit.barrier(0)&#xA;circuit.x(0)&#xA;circuit_t = transpile(circuit, backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If we schedule that one on &lt;code&gt;ibmq_lima&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmq_lima')&#xA;print('lima openpulse support:', backend.configuration().open_pulse)&#xA;&#xA;schedule(circuit_t, backend).draw(backend=backend, time_unit='ns')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qVgVr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qVgVr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems to me that the distance between pulses is not 10ns.&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-03-28T11:27:37.927" LastActivityDate="2021-03-28T11:27:37.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16732" PostTypeId="1" AcceptedAnswerId="16735" CreationDate="2021-03-28T11:21:45.097" Score="0" ViewCount="79" Body="&lt;p&gt;What is the main advantage of using the Variational Quantum Eigensolver (quantum computing) over a classical algorithm? I know a key fact is the speed-up, but how is this speed-up quantised.&lt;/p&gt;&#xA;" OwnerUserId="14697" LastEditorUserId="55" LastEditDate="2021-03-29T22:29:05.080" LastActivityDate="2021-03-30T18:36:09.503" Title="What is the main advantage of using the Variational Quantum Eigensolver over a classical algorithm?" Tags="&lt;algorithm&gt;&lt;vqe&gt;&lt;speedup&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16733" PostTypeId="2" ParentId="16728" CreationDate="2021-03-28T12:07:37.087" Score="2" Body="&lt;p&gt;Short answer: The minimal delay between gates on IBMQ chips is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; nano-seconds.&lt;/p&gt;&#xA;&lt;p&gt;Longer answer:&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;barrier&lt;/code&gt; operation is not a hardware operation, it just give instructions to the compiler to schedule the circuit correctly. As such, its duration is &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; nano-seconds as it is never executed on the hardware. You can check this on &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16731/1386&quot;&gt;luciano answer&lt;/a&gt;: the &lt;code&gt;barrier&lt;/code&gt; operation is not present in the generated schedule.&lt;/p&gt;&#xA;&lt;p&gt;If your question was rather &amp;quot;what it is the minimum non-zero delay between two gates on IBM chips&amp;quot;, the answer is &lt;code&gt;dt&lt;/code&gt; = &lt;span class=&quot;math-container&quot;&gt;$\frac{2}{9}$&lt;/span&gt; nano-seconds on the most recent backends. You can recover this value for each backend with&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import schedule, QuantumCircuit, transpile, IBMQ&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider()&#xA;backend = provider.get_backend(&amp;quot;ibmq_armonk&amp;quot;)&#xA;&#xA;dt = backend.configuration().dt&#xA;print(f&amp;quot;dt = {dt*1e9:.2f} ns&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Pulses duration should be a multiple of &lt;code&gt;16dt&lt;/code&gt; but delay duration can be any multiple of &lt;code&gt;dt&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2021-03-28T12:07:37.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16734" PostTypeId="1" AcceptedAnswerId="16739" CreationDate="2021-03-28T12:57:02.927" Score="3" ViewCount="102" Body="&lt;p&gt;Trying to plot the Bloch Sphere of the IBM Qiskit logo&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import execute, Aer, IBMQ, QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.visualization import plot_state_qsphere, plot_bloch_multivector&#xA;%matplotlib inline&#xA;&#xA;# no. of qubits&#xA;n = 4&#xA;&#xA;# create circuit&#xA;qc = QuantumCircuit(n)&#xA;&#xA;# apply hadamard&#xA;qc.h(0)&#xA;&#xA;# apply cnot&#xA;for i in range(n-1):&#xA;    qc.cx(0, i+1)&#xA;&#xA;# apply not on q1&#xA;qc.x(1)&#xA;&#xA;# get state vector&#xA;sv = Statevector.from_instruction(qc).data&#xA;&#xA;# plots&#xA;plot_state_qsphere(sv)&#xA;plot_bloch_multivector(sv)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Xixs2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Xixs2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why the Bloch Sphere does not have any state representations?&lt;/p&gt;&#xA;&lt;p&gt;Circuit &lt;a href=&quot;https://quantum-computing.ibm.com/composer/files/new?initial=N4IgdghgtgpiBcICKBLAzgaxQFwPoBsB7Ac0JABoQBHCNKBEAeQAUBRAOSQEEBlAWQAEAJgB0ABgDcAHTAowAY3wBXACYwBU6jHwoARgEYRc%2BZulgZVAE4xiAqgG0AzAF0z867fn2hrmTIAWdvZivgoAHkEh5A76ofIRDlEOPmYJ9rESFCBqaO4oAA7YKIRgDCAAvkA&quot; rel=&quot;nofollow noreferrer&quot;&gt;link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="12667" LastEditorUserId="55" LastEditDate="2021-03-28T16:34:22.353" LastActivityDate="2021-03-28T21:01:36.240" Title="Bloch Sphere of Qiskit logo" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16735" PostTypeId="2" ParentId="16732" CreationDate="2021-03-28T16:49:57.043" Score="2" Body="&lt;p&gt;Both VQE and classical methods rely on the variational principle. The variational principle for quantum mechanics says that if you have a physical system &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and a wavefunction &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; describing a state in that system, it's expectation value &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H | \psi \rangle$&lt;/span&gt; will be greater than the ground state energy, &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt;. In other words, you can't ever find a state in your system with less energy than the ground state.&lt;/p&gt;&#xA;&lt;p&gt;On a quantum computer, this is accomplished by positing a parameterized quantum circuit as a trial wavefunction, &lt;span class=&quot;math-container&quot;&gt;$|\psi(\theta)\rangle$&lt;/span&gt;. Then, the circuit is executed at a specific set of parameters and we compute the resultant expectation value. Based on the result, a classical optimization algorithm is employed to iteratively change parameters to reduce the expectation value. The goal is to find some parameter set &lt;span class=&quot;math-container&quot;&gt;$\theta'$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$|\langle\psi(\theta')|H|\psi(\theta')\rangle - E_0 |&amp;lt; \epsilon$&lt;/span&gt;. If the eigenvector for the ground state is in the parameter space of &lt;span class=&quot;math-container&quot;&gt;$|\psi(\theta)\rangle$&lt;/span&gt; (a &amp;quot;good&amp;quot; ansatz), a properly functioning quantum computer and a suitable classical optimization algorithm should be able to provide a good estimate for the ground state of that system.&lt;/p&gt;&#xA;&lt;p&gt;A similar thing happens on a classical computer. However, the trial wavefunction is implemented on a classical computer where the physics of the system are simulated. A trial wavefunction (ansatz) is suggested, and a classical computer then attempts to minimize the functional &lt;span class=&quot;math-container&quot;&gt;$F[\psi] = \frac{\psi^* H\psi}{\psi^*\psi}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For most practical applications, scientists will use a classical method to determine the ground state because quantum computers are still in their very early stages. However, for problems of greater complexity we hope algorithms such as VQE, and its variants, will be able to provide an advantage over purely classical approaches.&lt;/p&gt;&#xA;" OwnerUserId="2800" LastActivityDate="2021-03-28T16:49:57.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16736" PostTypeId="2" ParentId="16275" CreationDate="2021-03-28T17:54:17.673" Score="0" Body="&lt;p&gt;It turns it out it sure doesn't. I was using the QAOA qiskit method and I think this function takes out the solution bitstring that gives the lowest objective value. As I was trying only for small &lt;span class=&quot;math-container&quot;&gt;$ N $&lt;/span&gt;, there would be a decent probability attached to the solution even without the algorithm !&lt;/p&gt;&#xA;" OwnerUserId="14866" LastActivityDate="2021-03-28T17:54:17.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16738" PostTypeId="1" AcceptedAnswerId="16746" CreationDate="2021-03-28T19:18:13.353" Score="1" ViewCount="49" Body="&lt;p&gt;The question is simple: why do we seek to maximise  &lt;span class=&quot;math-container&quot;&gt;$F_{p}(\gamma, \boldsymbol{\beta})=\langle\gamma, \boldsymbol{\beta}|H_{C}| \gamma, \boldsymbol{\beta}\rangle$&lt;/span&gt;? How does maximising this value correspond to finding the groundstate  value of &lt;span class=&quot;math-container&quot;&gt;$H_{C}$&lt;/span&gt; ? Why does this optimum value of &lt;span class=&quot;math-container&quot;&gt;$H_{C}$&lt;/span&gt; correspond to a set of  &lt;span class=&quot;math-container&quot;&gt;$ \gamma, \boldsymbol{\beta} $&lt;/span&gt; that maximise our chances of getting the optimum solution?&lt;/p&gt;&#xA;&lt;p&gt;We try to minimise the value of &lt;span class=&quot;math-container&quot;&gt;$\langle \gamma,\beta|H_{C}| \gamma, \beta\rangle$&lt;/span&gt; as this gives us the groundstate, as pointed out in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14852/to-find-the-best-angles-in-qaoa-why-we-do-not-optimize-over-a-maximum-ofall-shot&quot;&gt;this answer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The Fahri paper says we seek to maximise this value. Other sources try to minimise it: are these just equivalent attempts with a minus sign stuck in front?&#xA;I know that when we encode the problem Hamiltonian, we do this in way that the groundstate corresponds to the optimum solution. Why then has it been found that the set of &lt;span class=&quot;math-container&quot;&gt;$ \gamma,\beta $&lt;/span&gt; that give the best probability of success don't always correspond to the max value of &lt;span class=&quot;math-container&quot;&gt;$H_{c}$&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YVu9J.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YVu9J.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The image is taken from &lt;a href=&quot;https://arxiv.org/abs/1907.02359&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1907.02359&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14866" LastActivityDate="2021-03-29T08:47:03.507" Title="Why do we seek to maximise $F_{p}(\gamma, \beta)=\langle\gamma, \beta|H_{C}| \gamma, \beta\rangle$?" Tags="&lt;algorithm&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16739" PostTypeId="2" ParentId="16734" CreationDate="2021-03-28T20:17:56.027" Score="4" Body="&lt;p&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16734/bloch-sphere-of-qiskit-logo/16739#comment24534_16734&quot;&gt;As @PaulNation explained&lt;/a&gt;, the bloch spheres represent maximally entangled qubits as zero-length vectors. Hence, no arrows.&lt;/p&gt;&#xA;&lt;p&gt;The Qiskit logo is a qsphere of a particular statevector. In particular, a 6-qubit state, &lt;a href=&quot;https://twitter.com/abe_asfaw/status/1252545138188079104&quot; rel=&quot;nofollow noreferrer&quot;&gt;according to Abe&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.visualization import plot_state_qsphere&#xA;state = [0]*2**6&#xA;state[2] = 1; state[61] = 1&#xA;plot_state_qsphere(state, show_state_labels=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/01vlD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/01vlD.png&quot; alt=&quot;qiskit logo qsphere&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So... you are actually really really close. Just change &lt;code&gt;n = 6&lt;/code&gt; I you will get it!&lt;/p&gt;&#xA;&lt;p&gt;Here is your fixed code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.visualization import plot_state_qsphere&#xA;&#xA;n = 6&#xA;qc = QuantumCircuit(n)&#xA;qc.h(0)&#xA;for i in range(n-1):&#xA;    qc.cx(0, i+1)&#xA;qc.x(1)&#xA;&#xA;sv = Statevector.from_instruction(qc)&#xA;plot_state_qsphere(sv, show_state_labels=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/01vlD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/01vlD.png&quot; alt=&quot;qiskit logo qsphere&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;To increase the similarity, delete the legend and modify the elevation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;fig = plot_state_qsphere(sv, show_state_labels=False)&#xA;fig.axes[0].view_init(elev=11, azim=275)&#xA;fig.axes[1].set_visible(False)&#xA;fig&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/2TND7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/2TND7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-03-28T21:01:36.240" LastActivityDate="2021-03-28T21:01:36.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16740" PostTypeId="1" AcceptedAnswerId="16747" CreationDate="2021-03-28T22:59:11.013" Score="1" ViewCount="50" Body="&lt;p&gt;I am trying to practice QSVM from the following tutorial&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://medium.com/@patrick.huembeli/introduction-into-quantum-support-vector-machines-727f3ccfa2b4&quot; rel=&quot;nofollow noreferrer&quot;&gt;Introduction into Quantum Support Vector Machines&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The author has used 2 feature_dimension with 2 component PCA&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;feature_dimension =2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now my question is, why?&lt;/p&gt;&#xA;&lt;p&gt;Is it because of the limitation of the number of qubits?&lt;/p&gt;&#xA;&lt;p&gt;When I tried to increase both to 3 the testing success ratio decreased to 0.45&lt;/p&gt;&#xA;&lt;p&gt;How can I use more feature sets&lt;/p&gt;&#xA;" OwnerUserId="15360" LastEditorUserId="55" LastEditDate="2021-03-29T07:31:30.223" LastActivityDate="2021-03-29T09:22:49.427" Title="Quantum SVM with large feature set" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16741" PostTypeId="1" CreationDate="2021-03-29T00:50:19.213" Score="1" ViewCount="24" Body="&lt;p&gt;Here's a diagram illustrates my question:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/w4Qv9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w4Qv9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;The pink and purple vectors are 'reflective' (just like a light ray hitting a surface, though the direction is not the same case). Two grey vectors are some initial states I prepared. My question is if the operator of time evolution around the pink vector is &lt;span class=&quot;math-container&quot;&gt;$U_3(\theta,\phi,\lambda)$&lt;/span&gt;, how can I represent the &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; which simulates the time evolution around the purple vector? To prepare general pair of 'reflective vectors', like in this case, the operators could be represented as &lt;span class=&quot;math-container&quot;&gt;$U_3'(a,b,c)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_3'(-a,b,c)$&lt;/span&gt; (starting from the initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;), however, I'm wondering how are the two &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gates related? Thanks!!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastActivityDate="2021-03-29T00:50:19.213" Title="time evolution around a 'reflective axis'" Tags="&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16743" PostTypeId="1" CreationDate="2021-03-29T03:41:05.933" Score="1" ViewCount="65" Body="&lt;p&gt;Though a lot of papers talk about the largest factored number by Shor's Algorithm, I want to know the largest one factored by the IBM Quantum, for example, the &lt;em&gt;simulator_mps&lt;/em&gt;. I am able to use it to factor 143, but fail at 323.&lt;/p&gt;&#xA;&lt;p&gt;The simulator does offer 100 qubits, and I use only 38 of them. The trouble is that the execution will time out always.&lt;/p&gt;&#xA;&lt;p&gt;My circuit has about 1 million gates, 600,000 of which are CNOT gates.&lt;/p&gt;&#xA;&lt;p&gt;Could you please set my expectation straight? What is the biggest circuit you have ever run successfully?&lt;/p&gt;&#xA;&lt;p&gt;I understand the classical computers may never be able to simulate 100 qubits. It is easy to understand why IBM focuses on increasing the qubits of the real quantum hardware. But, it is unclear to me why they would offer 100 simulated qubits without backing them up with massive classical parallel computing.&lt;/p&gt;&#xA;&lt;p&gt;According to the &lt;a href=&quot;https://www.ibm.com/blogs/research/2021/02/quantum-development-roadmap/&quot; rel=&quot;nofollow noreferrer&quot;&gt;roadmap&lt;/a&gt; of IBM and &lt;a href=&quot;https://fortune.com/2020/09/15/ibm-quantum-computer-1-million-qubits-by-2030/&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;, the year 2023 will be a critical year:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If IBM can meet the 1,121-qubit goal in the next three years, the&#xA;company says it is confident it will make its 2030 deadline for a 1&#xA;million-qubit machine.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;One million physical qubits could produce 1,000 logical qubits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Accelerating_change#:%7E:text=An%20analysis%20of%20the%20history,sense%20%27intuitive%20linear%27%20view.&amp;amp;text=The%20%27returns%2C%27%20such%20as,the%20rate%20of%20exponential%20growth.&quot; rel=&quot;nofollow noreferrer&quot;&gt;This study&lt;/a&gt; shows:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;... technological change is exponential, contrary to the common-sense&#xA;'intuitive linear' view.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;So, I'd like to know how well the state-of-the-art IBM quantum computers/simulators are doing. That may help understand the future trends.&lt;/p&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="9768" LastEditDate="2021-04-02T16:58:46.580" LastActivityDate="2021-04-02T16:59:34.813" Title="What is the largest number factored by the IBM Quantum simulators?" Tags="&lt;ibm-q-experience&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16744" PostTypeId="1" AcceptedAnswerId="16770" CreationDate="2021-03-29T04:41:04.127" Score="0" ViewCount="88" Body="&lt;p&gt;After reading some books I'm very confused about one question. For example in Nielsen and Chuang chapter 4.2 the universal gate U could be used to construct the Rz gate, which means a turn around the z-axis.&#xA;They also describe the special T-gate, which gives me the same question.&lt;/p&gt;&#xA;&lt;p&gt;I found this equation &lt;a href=&quot;https://www.quantum-inspire.com/kbase/rotation-operators/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} e^{i\frac{\theta}{2}} &amp;amp; 0 \\ 0 &amp;amp; e^{i\frac{\theta}{2}} \end{bmatrix}\begin{bmatrix} e^{-i\frac{\theta}{2}} &amp;amp; 0 \\ 0 &amp;amp; e^{i\frac{\theta}{2}} \end{bmatrix} = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i\theta} \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why is this equation is true? Why I need to do this math, if a Rz Operation is still a turn around z?&lt;/p&gt;&#xA;" OwnerUserId="13469" LastEditorUserId="2293" LastEditDate="2021-03-29T21:50:00.963" LastActivityDate="2021-03-30T18:32:13.190" Title="Math behind Rz Gate" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16746" PostTypeId="2" ParentId="16738" CreationDate="2021-03-29T08:47:03.507" Score="1" Body="&lt;p&gt;Whether it is minimize or maximize, it is the same up to a minus sign indeed.&lt;/p&gt;&#xA;&lt;p&gt;Why we optimize with this expression, is because the &lt;a href=&quot;https://arxiv.org/abs/1411.4028&quot; rel=&quot;nofollow noreferrer&quot;&gt;original theory&lt;/a&gt; tells you that, if you could have infinite depth (&lt;span class=&quot;math-container&quot;&gt;$p \rightarrow \infty$&lt;/span&gt;), this expression converges to the ground state. Think of it as a probability distribution over all possible bitstrings , that you drive with optimization, whose expectation value gets closer to the optimal value, while decreasing variance.&lt;/p&gt;&#xA;&lt;p&gt;But in practice, nothing prevents you from optimizing a different objective (for instance maximizing the expectation over a quantile of measurements giving you the best values). &lt;a href=&quot;https://arxiv.org/pdf/1907.04769&quot; rel=&quot;nofollow noreferrer&quot;&gt;Check this paper&lt;/a&gt; for instance. Then you will have different angles &lt;span class=&quot;math-container&quot;&gt;$\gamma, \beta$&lt;/span&gt; for this objective.&lt;/p&gt;&#xA;&lt;p&gt;In fact, optimizing &lt;span class=&quot;math-container&quot;&gt;$F_{p}(\gamma, \boldsymbol{\beta})$&lt;/span&gt; is optimizing the average value, which in the process means you want a good performance in average, and you may in the process privilege bitstrings with good values rather than the optimal one(s) cause it will give you a better average output.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2021-03-29T08:47:03.507" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16747" PostTypeId="2" ParentId="16740" CreationDate="2021-03-29T09:22:49.427" Score="4" Body="&lt;p&gt;Practically, it can be (quite often) a limitation of number of qubits/hardware, but also it is a hyperparameter to play with. So it may be that using more qubits gives you better results or worse.&lt;/p&gt;&#xA;&lt;p&gt;Also, in the QSVM, there is or may be a parameterized part you have to optimize over. So increasing the number of qubits results in more optimization (more parameters), that makes it harder. You may need to play on the depth of the variational part to improve results (so more parameters to optimize).&lt;/p&gt;&#xA;&lt;p&gt;But if you are limited in the number of qubits, you can change the data encoding. For instance, &lt;a href=&quot;https://arxiv.org/abs/2101.09581&quot; rel=&quot;nofollow noreferrer&quot;&gt;in this paper Fig.2&lt;/a&gt;, they use a quantum circuit with &lt;span class=&quot;math-container&quot;&gt;$17$&lt;/span&gt; qubits and loaded &lt;span class=&quot;math-container&quot;&gt;$67-$&lt;/span&gt;dimensional data without dimensionality reduction. This results in a deeper circuit.&lt;/p&gt;&#xA;" OwnerUserId="4127" LastActivityDate="2021-03-29T09:22:49.427" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16748" PostTypeId="1" CreationDate="2021-03-29T12:29:24.350" Score="1" ViewCount="69" Body="&lt;p&gt;Among the several universal gate sets, the Clifford&lt;span class=&quot;math-container&quot;&gt;$+T$&lt;/span&gt; set seems the most important one (since it should provide fault-tolerant computing).&lt;/p&gt;&#xA;&lt;p&gt;However, that set is logical and it differs from physical implementations, e.g. IBM processors use the gate set &lt;span class=&quot;math-container&quot;&gt;$\{CNOT, I, R_z, \sqrt{X}, X\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hence, my question is: how does the Qiskit framework handle the switch from a gate set, such as the Clifford&lt;span class=&quot;math-container&quot;&gt;$+T$&lt;/span&gt;, to the real one?&lt;/p&gt;&#xA;&lt;p&gt;At &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12419/do-all-physical-architectures-for-quantum-computers-use-the-same-universal-gate&quot;&gt;this link&lt;/a&gt; there's an interesting possible answer. But I'd like to get a deeper understanding of the criteria Qiskit applies.&lt;/p&gt;&#xA;&lt;p&gt;EDIT:&lt;/p&gt;&#xA;&lt;p&gt;I'd like to input to the Qiskit &lt;code&gt;transpile&lt;/code&gt; method a simple circuit performing a control S gate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2)&#xA;cs = SGate().control()&#xA;qc.append(cs, [0,1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;with basis gate set &lt;span class=&quot;math-container&quot;&gt;$\{H, S, T, CNOT\}$&lt;/span&gt;, i.e.:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;new_qc = transpile(qc, basis_gates=['h','s','t',cx'])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, the method cannot complete the task.&lt;/p&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="8954" LastEditDate="2021-04-19T19:44:54.903" LastActivityDate="2021-04-19T19:44:54.903" Title="From logical universal gate set to physical one, Qiskit" Tags="&lt;qiskit&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16749" PostTypeId="2" ParentId="16748" CreationDate="2021-03-29T12:53:13.173" Score="2" Body="&lt;p&gt;Qiskit has a component called &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;transpiler&lt;/em&gt;&lt;/a&gt;. One of the task of the transpiler is to convert the circuit gates into the backend basis gates. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;new_circuit = transpiler(circuit, backend=provider.get_backend('simulator_extended_stabilizer')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can set your own basis with the parameter &lt;code&gt;basis_gates&lt;/code&gt;. For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;new_circuit = transpiler(circuit, basis_gates=['h', 'x', ...]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-03-29T13:06:05.207" LastActivityDate="2021-03-29T13:06:05.207" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16750" PostTypeId="1" AcceptedAnswerId="16765" CreationDate="2021-03-29T13:40:18.470" Score="1" ViewCount="41" Body="&lt;p&gt;In &lt;a href=&quot;https://eprint.iacr.org/2018/276.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Zhandry's compressed oracle paper&lt;/a&gt;, one can read the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Next, we note that the oracle &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; being chosen at random is equivalent (from the adversary’s point of view) to &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; being in uniform superposition &lt;span class=&quot;math-container&quot;&gt;$\sum_h|h\rangle$&lt;/span&gt;. Indeed, the superposition can be reduced to a random &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; by measuring, and measuring the &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; registers (which is outside of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;’s view) is undetectable to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. To put another way, the superposition over &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is a purification of the adversary’s mixed state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Though it appears to be intuitive, I can't manage to prove this formally using density matrices.&lt;/p&gt;&#xA;&lt;p&gt;Let us first consider an oracle that samples at random a function &lt;span class=&quot;math-container&quot;&gt;$h:\{0\,;\,1\}^m\to\{0\,;\,1\}^n$&lt;/span&gt; and uses a register with &lt;span class=&quot;math-container&quot;&gt;$n\,2^m$&lt;/span&gt; qubits, which can be decomposed in &lt;span class=&quot;math-container&quot;&gt;$2^m$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit registers, where the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th register (indexing from 0) represents the value of &lt;span class=&quot;math-container&quot;&gt;$h(i)$&lt;/span&gt;. We consider three registers, namely the two adversary's registers &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and the oracle's register &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;. We define the unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}$&lt;/span&gt; to act on the basis states as follow:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{O}\left(|x,y\rangle\otimes|h\rangle\right)=|x,y\oplus h_x\rangle\otimes|h\rangle$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$h_x$&lt;/span&gt; being the value stored in &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt;'s &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;-th sub-register.&lt;/p&gt;&#xA;&lt;p&gt;The goal is to show that, from the adversary's point of view, initialising &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; with a uniformly sampled function &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; or with a uniform superposition &lt;span class=&quot;math-container&quot;&gt;$\sum_h|h\rangle$&lt;/span&gt; is equivalent.&lt;/p&gt;&#xA;&lt;p&gt;Carrying out the computations and tracing out the oracle's registers, in the first case (&lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is sampled once and for all) the system density matrix associated to the adversary's registers is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^A_1 = \sum_{i,j,k,l}\rho_{i,j,k,l}\,|i,j\oplus h_i\rangle\,\langle k,l\oplus h_k|$$&lt;/span&gt;&#xA;while in the second case (&lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; is initialised with &lt;span class=&quot;math-container&quot;&gt;$\sum_h|h\rangle$&lt;/span&gt;), we get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^A_2 = \frac{1}{2^{2\,n}}\,\sum_{i,j,k,l}\sum_{h_i, h_k}\rho_{i,j,k,l}\,|i,j\oplus h_i\rangle\,\langle k, l\oplus h_k|$$&lt;/span&gt;&#xA;which is very similar to &lt;span class=&quot;math-container&quot;&gt;$\rho^A_1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If we compute the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|x,y\rangle$&lt;/span&gt;, we get for the first case:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_{x,y\oplus h_x,x,y\oplus h_x}$$&lt;/span&gt;&#xA;which is the probability &lt;strong&gt;given&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt;. By summing over the &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt;, we find the same probability as the one in the second case, that is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{2^n}\,\sum_{h_x}\rho_{x,y\oplus h_x,x,y\oplus h_x}\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We are forced to use probability theory after having performed the measurement in the first case to find the same probability as in the second case. Since the density matrix contains all the statistical information about the system's state, shouldn't we be able to say these cases are indistinguishable just by looking at the density matrices? How can/should I bring the uncertainty over &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; into the density matrix?&lt;/li&gt;&#xA;&lt;li&gt;That's closely related to 1., but since the density matrices are different, are we sure that the adversary can't tell the difference by simply computing the probability once &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}$&lt;/span&gt; has been applied? Shouldn't we consider that the adversary may apply an arbitrary unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; on their state to help them distinguish between the cases? I guess it would work, but ocne again, can't we do it directly with the density matrices?&lt;/li&gt;&#xA;&lt;li&gt;How can Zhandry's justification can be translated into the density matrix formalism? Why is the fact that the state is now pure a reason to tell that the adversary can't tell the difference between both cases?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2021-03-30T14:39:43.110" Title="Purification applied to indistinguishability" Tags="&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16751" PostTypeId="1" CreationDate="2021-03-29T14:48:21.590" Score="1" ViewCount="42" Body="&lt;p&gt;On page 388 of N&amp;amp;C, you are asked to find the solution to a differential equation for a two-level atom coupled to a vacuum. However, I have no experience with differential equations, so I am having some difficulty seeing where they get their solutions from. After moving to the interaction picture, I get &lt;span class=&quot;math-container&quot;&gt;$$\frac{d\tilde{\rho}}{dt}=\gamma[2\sigma_{-}\tilde{\rho}\sigma_{+}-\sigma_{+}\sigma_{-}\tilde{\rho}-\tilde{\rho}\sigma_{+}\sigma_{-}]$$&lt;/span&gt;I get as far as the following after changing &lt;span class=&quot;math-container&quot;&gt;$\tilde{\rho}$&lt;/span&gt; to is bloch vector representation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{d\tilde{\rho}}{dt}=\gamma\begin{bmatrix}1-z &amp;amp; \frac{x-iy}{2}\\\frac{x+iy}{2} &amp;amp; -1+z\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It then asks you to solve the three differential equations associated with the bloch vectors.&lt;/p&gt;&#xA;&lt;p&gt;I get &lt;span class=&quot;math-container&quot;&gt;$$\frac{dx}{dt}=\gamma\lambda_{x}\sigma_{x}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\frac{dy}{dt}=\gamma\lambda_{y}\sigma_{y}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\frac{dz}{dt}=\gamma(2 -2\lambda_{z})\sigma_{z}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, the answers given are &lt;span class=&quot;math-container&quot;&gt;$$\lambda_{x}=\lambda_{x}(0)e^{-\gamma t}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\lambda_{y}=\lambda_{y}(0)e^{-\gamma t}$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$$\lambda_{z}=\lambda_{z}(0)e^{-2\gamma t}+1-e^{-2 \gamma t}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I know using &lt;span class=&quot;math-container&quot;&gt;$$\frac{dx}{dt}=Ax(t)\to x=x(0)e^{At}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, A disappears from there exponentials and I am unsure how they arrived at the answer they give for &lt;span class=&quot;math-container&quot;&gt;$\lambda_{z}$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="4991" LastEditDate="2021-03-30T11:59:25.137" LastActivityDate="2021-03-30T11:59:25.137" Title="Question regarding bloch vector solutions for master equation on page 388 of N&amp;C" Tags="&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16752" PostTypeId="2" ParentId="2342" CreationDate="2021-03-29T23:57:08.367" Score="1" Body="&lt;p&gt;Following up on and inspired by the comments from Rob, I sense that there's a bit of a similarity between, on the one hand, the boolean tree evaluation of Farhi and Gutmann (and of Ambainis et al.), and on the other hand, &lt;a href=&quot;https://en.wikipedia.org/wiki/Time-domain_reflectometer&quot; rel=&quot;nofollow noreferrer&quot;&gt;time-domain reflectometry&lt;/a&gt; (TDR) which is used to identify cracks/open circuits/short circuits/other faults on electrical cables.&lt;/p&gt;&#xA;&lt;p&gt;For example, in TDR one may send a wave packet down a copper wire; if the wire is properly terminated, a fault along the wire will cause the wave packet to be reflected while a defect-free line may enable transmission.  Similarly in the tree evaluation algorithms, one may partially flatten the tree.&lt;/p&gt;&#xA;&lt;p&gt;In the tree evaluation algorithms, one may partially flatten the tree.  One may also may add extra nodes to the root.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/3nOOs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3nOOs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;See, e.g., FIGS. 2 and 4 of Farhi and Gutmann, reproduced above.&lt;/p&gt;&#xA;&lt;p&gt;Much as in TDR, if the tree evaluates to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; then a quantum wave packet will reflect back out from whence it came, whereas if the tree evaluates to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; then the wave packet will transit through the line.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;If you didn't create your line by adding extra nodes to the root/flattening the tree, you would not have a way to send a wave-packet through the tree.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-03-29T23:57:08.367" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16753" PostTypeId="1" AcceptedAnswerId="16775" CreationDate="2021-03-30T06:25:49.047" Score="0" ViewCount="48" Body="&lt;p&gt;I'd like to build a multi qubit controlled gate in the following way.&lt;br&gt;&#xA;The circuit has &lt;span class=&quot;math-container&quot;&gt;$n+1$&lt;/span&gt; qubits, the first qubit is the control qubit, and the operation on the rest &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits is the tensor product of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; phase rotations &lt;span class=&quot;math-container&quot;&gt;$R^{\otimes n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.extensions import *&#xA;import qiskit.extensions.unitary&#xA;import cmath as cm&#xA;import numpy as np&#xA;import math as m&#xA;from qiskit.aqua.utils import tensorproduct&#xA;&#xA;&#xA;n=10&#xA;c = QuantumRegister(1, &amp;quot;c&amp;quot;)&#xA;q = QuantumRegister(n, &amp;quot;q&amp;quot;)&#xA;cl = ClassicalRegister(2, &amp;quot;cl&amp;quot;)&#xA;circ = QuantumCircuit( c, q, cl)&#xA;&#xA;&#xA;phase=cm.exp(cm.pi*complex(0,1)*(1/4))&#xA;matrixR=np.array([[phase,0],[0,1]])&#xA;matrixTe= matrixR&#xA;for _ in range(n-1):&#xA;    matrixTe=tensorproduct(matrixTe,matrixR)&#xA;matrixOp=matrixTe&#xA;&#xA;gateCR=UnitaryGate(matrixOp).control(num_ctrl_qubits=1)&#xA;&#xA;qubits=[m for m in reversed(q)]&#xA;circ.append(gateCR, qubits) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$n\geq10$&lt;/span&gt;, I get the following error message:&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Qdte2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Qdte2.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt; &lt;br&gt; &lt;a href=&quot;https://i.stack.imgur.com/JKp6k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JKp6k.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand the problem lies in the size of the matrix when it has phase in it. I tried to build a gate for &lt;span class=&quot;math-container&quot;&gt;$n=10$&lt;/span&gt; when the operation has no phase, and it worked without any problem!&lt;/p&gt;&#xA;&lt;p&gt;My question is, is there any workaround to fix this problem? What does the comment &lt;code&gt;hack to correct global phase; should fix to prevent need for correction here&lt;/code&gt; in the source code mean?&lt;/p&gt;&#xA;" OwnerUserId="9318" LastEditorUserId="55" LastEditDate="2021-03-30T10:07:20.073" LastActivityDate="2021-03-30T20:40:26.160" Title="Error &quot;too many subscripts in einsum&quot;, UnitaryGate()" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16754" PostTypeId="1" CreationDate="2021-03-30T06:27:06.007" Score="4" ViewCount="37" Body="&lt;p&gt;In Quantum Computing quantum measurements are described by a collection of measurement operators &lt;span class=&quot;math-container&quot;&gt;$\{M_n\}$&lt;/span&gt; such that the probability of the outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is given by &lt;span class=&quot;math-container&quot;&gt;$p(m)=\langle\psi|M_m^\dagger M_m|\psi\rangle$&lt;/span&gt; and the state of the system after measurement is &lt;span class=&quot;math-container&quot;&gt;$\frac{M_m|\psi\rangle}{\sqrt{\langle\psi|M_m^\dagger M_m|\psi\rangle}}$&lt;/span&gt;. In addition these measurement operators satisfy &lt;span class=&quot;math-container&quot;&gt;$\sum_m M_m^\dagger M_m$&lt;/span&gt;. Now let &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; be two hermitian matrices that commute and let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be a pure state in some Hilbert space. My question then is what does it mean to measure &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; &lt;em&gt;simultaneously&lt;/em&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15370" LastActivityDate="2021-03-30T06:49:49.807" Title="What does it mean to make a simultaneous measurement?" Tags="&lt;measurement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16755" PostTypeId="2" ParentId="16754" CreationDate="2021-03-30T06:49:49.807" Score="2" Body="&lt;p&gt;Firstly, it probably helps to switch over to specifying a measurement by &lt;em&gt;observables&lt;/em&gt;. An observable is a matrix, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, that defines the measurement. In effect, you take its spectral decomposition,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;A=\sum_i\lambda_iP_i&#xA;$$&lt;/span&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are the eigenvalues and &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; are projectors onto the corresponding eigenspaces. Then your measurement corresponds to using the projectors &lt;span class=&quot;math-container&quot;&gt;$\{P_i\}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now if you talk about measuring &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (two observables) simultaneously well, it kind of means what it says - that you can perform both measurements at the same time. There are some simple cases (e.g. for a pair of qubits) where it's obvious that you can do this. For instance, if &lt;span class=&quot;math-container&quot;&gt;$A=X\otimes I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B=I\otimes Z$&lt;/span&gt; then you can measure both qubits at the same time.&lt;/p&gt;&#xA;&lt;p&gt;However, the terminology tends to more get used in the sense &amp;quot;well, you &lt;em&gt;could&lt;/em&gt; measure them at the same time, but practically we don't&amp;quot;. Instead, you measure one after the other, but the act of measuring one observable does not affect the outcome of measuring the other observable&lt;span class=&quot;math-container&quot;&gt;$^*$&lt;/span&gt;. Mathematically, this is conveyed by the condition that the two observables commute, &lt;span class=&quot;math-container&quot;&gt;$AB-BA=0$&lt;/span&gt;. You can see that this is trivially true in my two-qubit example.&lt;/p&gt;&#xA;&lt;p&gt;That said, you could theoretically take this further. The fact that two observables commute mean that they are simultaneously diagonalizable. So if you took that common eigenbasis, that would define a single set of projectors that you could measure in one go.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^*$&lt;/span&gt; The ideal language for describing this fails me at this point, as it so often does when talking about quantum. The case of measuring each of the qubits in a two-qubit state is clear - I can do that in any order (including at the same time). But the outcome of one measurement does affect the outcome of the other, just think of perfectly correlated outcomes of measurements on a Bell state. So that wording is inadequate. Really, it's the &lt;em&gt;expected&lt;/em&gt; value of the outcomes which is unchanged by ordering of the two measurements.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-30T06:49:49.807" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16757" PostTypeId="2" ParentId="16724" CreationDate="2021-03-30T07:08:27.980" Score="0" Body="&lt;p&gt;qRNG python module and Quantis RNG both exploits quantum randomness, but they are based on different quantum properties. Quantis is based on photon polarization, whereas qRNG uses quantum computer based on superconducting qubits.&lt;/p&gt;&#xA;&lt;p&gt;Quantis RNG is a standalone hardware wich delivers random numbers, so you don't need third party system or internet connection, while qRNG needs to execute code on remote quantum computer, wich could take time and need an available service. Quantis RNG has certification, wich certify the randomness. I expect that the bit rate is higher with Quantis RNG.&lt;/p&gt;&#xA;" OwnerUserId="12910" LastActivityDate="2021-03-30T07:08:27.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16758" PostTypeId="1" AcceptedAnswerId="16763" CreationDate="2021-03-30T08:24:00.230" Score="2" ViewCount="72" Body="&lt;p&gt;I can't seem to understand how to show that the Bell states for a basis. Should I explain that through the circuit and what gates are used or by the basic proof behind proving a set as a basis?&lt;/p&gt;&#xA;" OwnerUserId="15372" LastEditorUserId="55" LastEditDate="2021-03-30T09:56:12.777" LastActivityDate="2021-03-31T09:44:46.337" Title="Show that the Bell states form a basis" Tags="&lt;textbook-and-exercises&gt;&lt;bell-basis&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16759" PostTypeId="1" AcceptedAnswerId="16761" CreationDate="2021-03-30T09:47:20.580" Score="4" ViewCount="50" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{A^n}$&lt;/span&gt; be a permutation invariant quantum state on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; registers i.e. &lt;span class=&quot;math-container&quot;&gt;$\pi(A^n)\rho_{A^n}\pi(A^n) = \rho_{A^n}$&lt;/span&gt; for any permutation &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; among the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; registers.&lt;/p&gt;&#xA;&lt;p&gt;If we trace out &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; registers (doesn't matter which due to permutation invariance), we obtain the reduced state &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt;. One &lt;a href=&quot;https://physics.stackexchange.com/questions/542523/if-langle-psi-ab-vert-rho-a-otimes-rho-b-vert-psi-ab-rangle-0-then-l&quot;&gt;knows&lt;/a&gt; that &lt;span class=&quot;math-container&quot;&gt;$\text{supp}(\rho_{A^n})\subseteq \text{supp}(\rho_{A}^{\otimes n})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What is the minimal &lt;span class=&quot;math-container&quot;&gt;$\lambda_n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\rho_{A^n} \leq \lambda_n \rho_{A}^{\otimes n}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A\leq B$&lt;/span&gt; denotes that &lt;span class=&quot;math-container&quot;&gt;$B-A$&lt;/span&gt; is positive semidefinite? In particular, is &lt;span class=&quot;math-container&quot;&gt;$\lambda_n$&lt;/span&gt; necessarily exponential in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="55" LastEditDate="2021-04-27T10:47:10.473" LastActivityDate="2021-04-27T10:47:10.473" Title="Upper bounding a permutation invariant state" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16760" PostTypeId="1" AcceptedAnswerId="16762" CreationDate="2021-03-30T10:16:53.360" Score="4" ViewCount="47" Body="&lt;p&gt;I am trying to understand the toffoli operation for the quantum adder below: (especially for the second toffoli gate) but I am stuck in understanding the calculation to get the correct outputs.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/kZRnz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/kZRnz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The carry bits and sum bits are defined as of below:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9dcVV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9dcVV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NHvCs.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NHvCs.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the 2nd Toffoli gate, I cant seem to understand how to get a2⊕c2.&#xA;I calculated their inputs up till the 2nd toffoli gate to be:&lt;/p&gt;&#xA;&lt;p&gt;Input:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$b_1 \oplus a_1$&lt;/span&gt;,&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$a_1 \oplus c_1$&lt;/span&gt;,&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$a_1 \oplus a_2$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By definition of the toffoli gate, my outputs should be:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$b_1 \oplus a_1$&lt;/span&gt;,&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$a_1 \oplus c_1$&lt;/span&gt;,&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$(a_2 \oplus a_1) \oplus [(b_1 \oplus a_1)(a_1 \oplus c_1)]$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But after expanding the result and summarizing it:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(a_2 \oplus a_1) \oplus [(b_1 \oplus a_1)(a_1 \oplus c_1)] = (a_2 \oplus a_1) \oplus (b_1a_1 \oplus b_1c_1 \oplus a_1a_1 \oplus a_1c_1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;i cant seem to equate it to &lt;span class=&quot;math-container&quot;&gt;$(a_2 \oplus c_2)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15373" LastEditorUserId="55" LastEditDate="2021-03-30T17:48:40.490" LastActivityDate="2021-03-30T17:48:40.490" Title="Understanding the quantum circuit for the quantum adder Toffoli gate" Tags="&lt;quantum-gate&gt;&lt;quantum-operation&gt;&lt;tensor-product&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16761" PostTypeId="2" ParentId="16759" CreationDate="2021-03-30T10:32:29.107" Score="3" Body="&lt;p&gt;Why not take the example of the GHZ state?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|GHZ\rangle=(|0\rangle^{\otimes n}+|1\rangle^{\otimes n})/\sqrt{2},&#xA;$$&lt;/span&gt;&#xA;such that &lt;span class=&quot;math-container&quot;&gt;$\rho_{A^n}=|GHZ\rangle\langle GHZ|$&lt;/span&gt;. The &lt;span class=&quot;math-container&quot;&gt;$\rho_A=I/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho^{\otimes n}_A=I/2^n$&lt;/span&gt;. Then for this specific case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lambda \rho^{\otimes n}_A-\rho_{A^n},&#xA;$$&lt;/span&gt;&#xA;the eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\lambda/2^n-1$&lt;/span&gt; (once) and &lt;span class=&quot;math-container&quot;&gt;$\lambda/2^n$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$2^n-1$&lt;/span&gt; times). Hence you get the inequality iff &lt;span class=&quot;math-container&quot;&gt;$\lambda\geq 2^n$&lt;/span&gt;. So yes, &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; must be exponential in &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-03-30T10:32:29.107" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16762" PostTypeId="2" ParentId="16760" CreationDate="2021-03-30T11:00:10.567" Score="2" Body="&lt;p&gt;You were on the right track and almost got it!&lt;/p&gt;&#xA;&lt;p&gt;First we use the definition of the carry bits that you have given to define:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$c_2 = a_1b_1 \oplus b_1c_1 \oplus a_1c_1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we can actually continue from where you left off! Imma take your last step as the LHS of the equation and continue from there:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}&#xA;(a_2 \oplus a_1) \oplus (b_1a_1 \oplus b_1c_1 \oplus a_1a_1 \oplus a_1c_1) &#xA;&amp;amp;= a_2 \oplus a_1 \oplus a_1a_1 \oplus \underbrace{(b_1a_1 \oplus b_1c_1  \oplus a_1c_1)}_{c_2} \\&#xA;&amp;amp; = a_2 \oplus c_2 \oplus (a_1 \oplus a_1a_1)&#xA;\end{align*}$$&lt;/span&gt;&#xA;where throughout I have freely changed the order of the terms thanks to the commutative property that &lt;span class=&quot;math-container&quot;&gt;$x \oplus y = y \oplus x$&lt;/span&gt;. So now we almost have what we want, but we have this extra pesky &lt;span class=&quot;math-container&quot;&gt;$(a_1 \oplus a_1a_1)$&lt;/span&gt; term. However we notice that if &lt;span class=&quot;math-container&quot;&gt;$a_1 = 0$&lt;/span&gt;, that term becomes zero in a fairly straightforward way. But also if &lt;span class=&quot;math-container&quot;&gt;$a_1 = 1$&lt;/span&gt; then we see that &lt;span class=&quot;math-container&quot;&gt;$a_1a_1 = 1$&lt;/span&gt; and therefore &lt;span class=&quot;math-container&quot;&gt;$a_1 \oplus a_1a_1 = 0$&lt;/span&gt;. And since &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt; can only equal either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, we have shown that &lt;span class=&quot;math-container&quot;&gt;$(a_1 \oplus a_1a_1)$&lt;/span&gt; is always &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. So coming back to our equation we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align*}&#xA;(a_2 \oplus a_1) \oplus (b_1a_1 \oplus b_1c_1 \oplus a_1a_1 \oplus a_1c_1)&#xA;&amp;amp; = a_2 \oplus c_2 \oplus \underbrace{(a_1 \oplus a_1a_1)}_{0} \\&#xA;&amp;amp;=  a_2 \oplus c_2&#xA;\end{align*}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14597" LastActivityDate="2021-03-30T11:00:10.567" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16763" PostTypeId="2" ParentId="16758" CreationDate="2021-03-30T14:13:39.687" Score="3" Body="&lt;p&gt;If you are taking the four Bell states&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^+ \rangle = \dfrac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle \big) $&lt;/span&gt;&lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Phi^- \rangle = \dfrac{1}{\sqrt{2}}\big(|00\rangle - |11\rangle \big) $&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^+ \rangle = \dfrac{1}{\sqrt{2}}\big(|01\rangle + |10 \rangle \big) $&lt;/span&gt; &lt;br&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\Psi^- \rangle = \dfrac{1}{\sqrt{2}}\big(|01\rangle - |10 \rangle \big) $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and place them as a column of a matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, for instance:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U &amp;amp;= \bigg[ \hspace{0.2 cm} |\Phi^+ \rangle \hspace{0.2 cm} \bigg| \hspace{0.2 cm}  |\Phi^- \rangle \hspace{0.2 cm} \bigg| \hspace{0.2 cm} |\Psi^+ \rangle  \hspace{0.2 cm} \bigg| \hspace{0.2 cm} |\Psi^- \rangle  \hspace{0.2 cm}\bigg]  \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 1 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; -1 &amp;amp; 0 \\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here you can see that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary matrix. That is, &lt;span class=&quot;math-container&quot;&gt;$U\cdot U^*= U^* \cdot U = I$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U^*$&lt;/span&gt; is the conjugate transpose of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. Since &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, its columns must form an &lt;strong&gt;orthonormal&lt;/strong&gt; &lt;em&gt;basis&lt;/em&gt;. These columns are the Bell states.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-03-30T17:24:43.153" LastActivityDate="2021-03-30T17:24:43.153" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16764" PostTypeId="1" CreationDate="2021-03-30T14:19:26.047" Score="2" ViewCount="41" Body="&lt;p&gt;I have an issue with the quantum phase estimation algorithm as explained Nielsen and Chuang. &lt;a href=&quot;https://i.stack.imgur.com/DSjsR.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DSjsR.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There was a question very similar to mine asked about this 2 years ago, but my question is different... Namely, I can understand the phase kickback operation if t was equals to 1. What is peculiar to me however is how the phase factor sort of &amp;quot;jumps over&amp;quot; the tensors and goes to the specific control bit. Is this just the standard operation of a controlled u within n qubits, and would need to be verified through examining the specific matrix?&#xA;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="15156" LastActivityDate="2021-03-30T15:55:33.070" Title="Question about the phase kickback in the phase estimation algorithm" Tags="&lt;nielsen-and-chuang&gt;&lt;phase-estimation&gt;&lt;phase-kickback&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16765" PostTypeId="2" ParentId="16750" CreationDate="2021-03-30T14:39:43.110" Score="0" Body="&lt;p&gt;I've been working a bit on this, and I think I can add at least some parts of an answer. To be fair, I'm not sure at all this reasoning is correct, so don't hesitate to tell me if you spot a mistake!&lt;/p&gt;&#xA;&lt;p&gt;First, we will use a Lemma which we introduce below.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Lemma&lt;/h2&gt;&#xA;&lt;p&gt;Let us consider two density matrices &lt;span class=&quot;math-container&quot;&gt;$\rho_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_2$&lt;/span&gt;. If, for any unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; the probability of measuring any basis state on the density matrix &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}\rho_1\mathbf{U}^\dagger$&lt;/span&gt; match with the one on &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}\rho_2\mathbf{U}^\dagger$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\rho_1=\rho_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Proof&lt;/h2&gt;&#xA;&lt;p&gt;Since the probabilities match, we have, for any unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; and any state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\rho_1\mathbf{U}^\dagger\right)=\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\rho_2\mathbf{U}^\dagger\right)$$&lt;/span&gt;&#xA;Using the linearity of the trace:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\left(\rho_1-\rho_2\right)\mathbf{U}^\dagger\right)=0$$&lt;/span&gt;&#xA;which can be rewritten as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle x|\mathbf{U}\,\left(\rho_1-\rho_2\right)\mathbf{U}^\dagger|x\rangle$$&lt;/span&gt;&#xA;Since this is true for any state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and any unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;, then for any unitary vector &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;, we have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$u^\dagger\,\left(\rho_1-\rho_2\right)u=0$$&lt;/span&gt;&#xA;Multiplying by an arbitrary complex &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; and its conjugate, this equation remains true for any vector &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;, not necessarily unitary. If we now consider an eigenvector &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho_1-\rho_2$&lt;/span&gt; with associated eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, we get that &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is necessarily nil. Hence, &lt;span class=&quot;math-container&quot;&gt;$\rho_1-\rho_2$&lt;/span&gt; is nil, and thus &lt;span class=&quot;math-container&quot;&gt;$\rho_1=\rho_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Answer to 1.&lt;/h2&gt;&#xA;&lt;p&gt;We can carry out the computations for &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}\rho^A_1\mathbf{U}^\dagger$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}\rho^A_2\mathbf{U}^\dagger$&lt;/span&gt; and compute their probabilites to measure a given state &lt;span class=&quot;math-container&quot;&gt;$|x,y\rangle$&lt;/span&gt; only to find that they are equal. The Lemma tells us that they should thus be equal, which does not seem to be the case.&lt;/p&gt;&#xA;&lt;p&gt;This is due to the fact that &lt;span class=&quot;math-container&quot;&gt;$\rho^A_1$&lt;/span&gt;, as defined in the question, is the density matrix &lt;strong&gt;from the oracle's point of view&lt;/strong&gt;. This explains why, to get the probability to measure a given state, we have to consider all possible cases from the adversary's point of view. So now the question is: what is the density matrix associated to the adversary in the first case? By the computations of the probabilities, we know that this matrix &lt;strong&gt;has to be&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho^A_2$&lt;/span&gt;. The more interesting question now is: could have we written this from the beginning?&lt;/p&gt;&#xA;&lt;p&gt;The most intuitive way I have found is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Compute &lt;span class=&quot;math-container&quot;&gt;$\rho^A$&lt;/span&gt; from the adversary's point of view, that is where &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is known, which we will denote &lt;span class=&quot;math-container&quot;&gt;$\left.\rho^A\middle|h\right.$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Introduce the adversary uncertainty by summing over all possible &lt;span class=&quot;math-container&quot;&gt;$\left.\rho^A\middle|h\right.$&lt;/span&gt;, which will give:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^A = \sum_h\mathbb{P}[h]\,\left.\rho^A\middle|h\right.$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The insight behind this is the following. We want to use the Lemma to show that these two matrices are equal. Note that though the lemma statement uses density matrices, the proof actually works with general matrices, so we don't have to show that &lt;span class=&quot;math-container&quot;&gt;$\sum_h\mathbb{P}[h]\,\left.\rho^A\middle|h\right.$&lt;/span&gt; is a density matrix in the first place.&lt;/p&gt;&#xA;&lt;p&gt;Thus, we want to show that, for any unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt;, the probability of measuring the basis state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; after having applied &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\sum_h\mathbb{P}[h]\left.\rho^A\middle|h\right.\mathbf{U}^\dagger\right)$$&lt;/span&gt;&#xA;Now, the linearity of the trace gives:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\sum_h\mathbb{P}[h]\left.\rho^A\middle|h\right.\mathbf{U}^\dagger\right)=\sum_h\mathbb{P}[h]\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\left.\rho^A\middle|h\right.\mathbf{U}^\dagger\right)\,.$$&lt;/span&gt;&#xA;By definition of &lt;span class=&quot;math-container&quot;&gt;$\left.\rho^A\middle|h\right.$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\left.\rho^A\middle|h\right.\mathbf{U}^\dagger\right)$&lt;/span&gt; is the probability of the adversary measuring &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; given &lt;em&gt;h&lt;/em&gt;. hence, this does give the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, which concludes the proof.&lt;/p&gt;&#xA;&lt;p&gt;In this case, we would thus have:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^A = \frac{1}{2^{n2^m}}\sum_h\sum_{i,j,k,l}\rho_{i,j,k,l}\,|i,j\oplus h_i\rangle\langle k,l\oplus h_k|$$&lt;/span&gt;&#xA;which can be rewritten as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^A = \frac{1}{2^{n2^m}}\sum_{i,j,k,l}\sum_{h_i,h_k}\rho_{i,j,k,l}\,|i,j\oplus h_i\rangle\langle k,l\oplus h_k|\sum_{\substack{h_j\\j\notin\{i, k\}}}1$$&lt;/span&gt;&#xA;which finally gives the expected result:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho^A = \sum_{i,j,k,l}\sum_{h_i, h_k}\rho_{i,j,k,l}\,|i,j\oplus h_i\rangle\langle k,l\oplus h_k|\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Answer to 2.&lt;/h2&gt;&#xA;&lt;p&gt;The Lemma by itself answers question 2 : you can't have two different density matrices whose probabilities of measuring basis states after having applied any unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; are the same.&lt;/p&gt;&#xA;&lt;h2&gt;Answering to 3.&lt;/h2&gt;&#xA;&lt;p&gt;I still don't the the answer to this one unfortunately. I understand neither why using a superposition gives a purification nor why this argument allows us to argue that both cases are equivalent, so I'm looking forward to hearing some insights about it.&lt;/p&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2021-03-30T14:39:43.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16766" PostTypeId="1" CreationDate="2021-03-30T15:11:25.337" Score="1" ViewCount="36" Body="&lt;p&gt;Lately I saw a pull request in the Cirq GiHub repo where some dev said a test should be defined, with these constraints: &lt;em&gt;You need to find a case where a &lt;code&gt;cirq.Operation&lt;/code&gt; that is not a &lt;code&gt;cirq.GateOperation&lt;/code&gt; is passed to&lt;/em&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Cirq/cirq/ops/pauli_string.py&#xA;&#xA;Line 943 in 4bb484a&#xA;&#xA; def _pass_operation_over(&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I follow the project, sadly I have no time to contribute, though. I have been using Cirq for a long time, and this &amp;quot;puzzle&amp;quot; got me puzzled, as I have never used anything similar. Could someone please give me an example of something like this? I ussually use &lt;code&gt;cirq.GateOperation&lt;/code&gt; in college, and not this stuff. Btw, idk how often those developers read silly questions like this, but maybe they'll find this helpful for their project, idk. &lt;a href=&quot;https://github.com/quantumlib/Cirq/pull/3973#issuecomment-808417217&quot; rel=&quot;nofollow noreferrer&quot;&gt;This&lt;/a&gt; is the comment I'm talking about. Waiting for a response... Thanks.&lt;/p&gt;&#xA;" OwnerUserId="15378" LastEditorUserId="2293" LastEditDate="2021-04-01T22:35:59.290" LastActivityDate="2021-04-01T22:35:59.290" Title="How to use pass_operation_over with cirq.Operation?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;python&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-04-23T19:19:06.427" ContentLicense="CC BY-SA 4.0" />
  <row Id="16767" PostTypeId="2" ParentId="16766" CreationDate="2021-03-30T15:38:44.107" Score="0" Body="&lt;p&gt;This is a pretty technical internal detail of how cirq works.&lt;/p&gt;&#xA;&lt;p&gt;Basically what's going on is that cirq's continuous integration system verifies test coverage. If you contribute to cirq and you touch a line of code, there's supposed to be at least one test that runs that line (or else an &lt;code&gt;# coverage: ignore&lt;/code&gt; annotation on the line). The &amp;quot;only touched lines matter&amp;quot; nature of this check makes it possible for uncovered lines to exist (e.g. by changes that delete tests without touching the lines that become uncovered, or by grandfathered lines that existed before the coverage check), so the coverage of the project is not 100%. The coverage check is more of a &amp;quot;give me evidence that you actually tried this&amp;quot; check when adding code.&lt;/p&gt;&#xA;&lt;p&gt;Anyways, in that particular PR the coverage check is complaining that a line is not being tested. This line is tricky to actually hit, because it's explicitly about a case &lt;em&gt;not&lt;/em&gt; being handled. (The line is &lt;code&gt;raise TypeError(f'Unsupported operation: {op!r}')&lt;/code&gt;). Often these lines aren't even reachable. They're just defensive programming ensuring that if this internal method is called incorrectly that it will stop instead of charging forward making things worse and more confusing. In normal situations the method is simply called correctly.&lt;/p&gt;&#xA;&lt;p&gt;The correct fix in this situation is not to cover the line (generally you don't want to assert for all time that a particular case must not work) but to annotate the line as not covered. Actually, one of the built-in escape valves for the coverage check is that any line throwing a &lt;code&gt;NotImplementedError&lt;/code&gt; doesn't need to be covered, so really only the type of exception being raised needs to change.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-03-30T15:58:53.203" LastActivityDate="2021-03-30T15:58:53.203" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16768" PostTypeId="2" ParentId="16764" CreationDate="2021-03-30T15:43:03.927" Score="2" Body="&lt;p&gt;The phase is applied to the overall wave function &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, therefore you can factor the phase to any individual qubit.&lt;/p&gt;&#xA;&lt;p&gt;For example if we have a wave function as a result of a controlled operation, with the first qubit as the control:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A|11\dots \rangle$&lt;/span&gt;, this can be factored as the tensor product &lt;span class=&quot;math-container&quot;&gt;$A|1\rangle \otimes |1\rangle \otimes |\dots\rangle$&lt;/span&gt;. Therefore we can say the phase has been 'kickbacked' to the control qubit.&lt;/p&gt;&#xA;&lt;p&gt;The 'jump' is because the controlled operation only occurs when the control qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, therefore the phase applied by the controlled operation is only applied to wavefunctions where this qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, so as described above you can factor the phase as 'kickbacked' to this qubit.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2021-03-30T15:55:33.070" LastActivityDate="2021-03-30T15:55:33.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16769" PostTypeId="1" AcceptedAnswerId="16774" CreationDate="2021-03-30T17:03:23.527" Score="4" ViewCount="104" Body="&lt;p&gt;I have a question about the direction of time evolution on a Bloch sphere: suppose I'm performing a unitary time-evolution &lt;span class=&quot;math-container&quot;&gt;$\exp(-iHt/\hbar)$&lt;/span&gt; for a single qubit, then on the Bloch sphere it corresponds to a rotation around an axis &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt;, which is an eigenvector of the Hamiltonian. My question is how do we determine if the time evolution corresponds to a clockwise or counterclockwise rotation of &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt;? Is the direction dependent on the sign of energy eigenvalue? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="55" LastEditDate="2021-05-13T17:33:18.150" LastActivityDate="2021-05-13T17:33:18.150" Title="How do we determine the direction of a time evolution $e^{-itH}$ on the Bloch sphere?" Tags="&lt;hamiltonian-simulation&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16770" PostTypeId="2" ParentId="16744" CreationDate="2021-03-30T18:32:13.190" Score="3" Body="&lt;p&gt;The equation you gave is showing an alternate expression of the &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; rotation gate that differs from the definition by a global phase. This can be made clear if we use a different symbol for the phase difference:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{bmatrix} e^{i \frac{\alpha}{2}} &amp;amp; 0 \\ 0 &amp;amp; e^{i \frac{\alpha}{2}} \end{bmatrix} \begin{bmatrix} e^{-i \frac{\theta}{2}} &amp;amp; 0 \\ 0 &amp;amp; e^{i \frac{\theta}{2}} \end{bmatrix} = \begin{bmatrix} e^{-i(\theta-\alpha)/2} &amp;amp; 0 \\ 0 &amp;amp; e^{i(\theta+\alpha)/2} \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where, for &lt;span class=&quot;math-container&quot;&gt;$\alpha = \theta$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{bmatrix} e^{-i(\theta-\theta)/2} &amp;amp; 0 \\ 0 &amp;amp; e^{i(\theta+\theta)/2} \end{bmatrix}  = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i \theta} \end{bmatrix}. $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we were to use &lt;span class=&quot;math-container&quot;&gt;$ \alpha = \theta = \pi / 4 $&lt;/span&gt; we would have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{bmatrix} e^{i \frac{\pi}{8}} &amp;amp; 0 \\ 0 &amp;amp; e^{i \frac{\pi}{8}} \end{bmatrix} \begin{bmatrix} e^{-i \frac{\pi}{8}} &amp;amp; 0 \\ 0 &amp;amp; e^{i \frac{\pi}{8}} \end{bmatrix} = \begin{bmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; e^{i \frac{\pi}{4}} \end{bmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which you will recognize as the definition of the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate. This type of phase/rotation decomposition is universal. In fact, &lt;em&gt;any&lt;/em&gt; arbitrary single-qubit unitary operator can be written in the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = e^{i\alpha} R_{\hat{n}}(\theta) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for some real numbers &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, and a real-three dimensional unit vector &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; (the same universal &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; gate that you mentioned). To convince yourself this is true you can work through Nielsen and Chuang Exercise 4.8.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-03-30T18:32:13.190" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16771" PostTypeId="2" ParentId="16053" CreationDate="2021-03-30T19:09:39.463" Score="1" Body="&lt;p&gt;An &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-outcome &lt;em&gt;positive-operator value measure&lt;/em&gt; or &lt;strong&gt;POVM&lt;/strong&gt; consists of &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; positive operators &lt;span class=&quot;math-container&quot;&gt;$A_1,\ldots,A_m$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$$\sum_{i=1}^m A_i=I.$$&lt;/span&gt; Each &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; is positive iff &lt;span class=&quot;math-container&quot;&gt;$A_i=B_i^*B_i$&lt;/span&gt; for some operator &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt;, thus each POVM is a &lt;em&gt;projection-valued measure&lt;/em&gt; or PVM iff each &lt;span class=&quot;math-container&quot;&gt;$B_i$&lt;/span&gt; is an &lt;em&gt;orthogonal projection&lt;/em&gt;, if so then  &lt;span class=&quot;math-container&quot;&gt;$B_i=B_i^*=B_i^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B_1,\ldots,B_m$&lt;/span&gt; is a PVM since &lt;span class=&quot;math-container&quot;&gt;$$\sum_{i=1}^n B_i=\sum_{i=1}^n B_i^2=\sum_{i=1}^n B_i^*B_i=\sum_{i=1}^n A_i=I.$$&lt;/span&gt; As mentioned in the comments, &lt;a href=&quot;https://en.wikipedia.org/wiki/Naimark%27s_dilation_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Naimarks dilation theorem&lt;/a&gt; shows that for any POVM on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt; there is an isometry &lt;span class=&quot;math-container&quot;&gt;$V:\mathbb{C}^n \rightarrow \mathbb{C}^{N}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N\geq n$&lt;/span&gt; and each &lt;em&gt;positive operator&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; gets mapped to an &lt;em&gt;orthogonal projection&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\widetilde{A_i}$&lt;/span&gt; in the larger space where the &amp;quot;completeness relation&amp;quot; of summing to the identity still holds, thus turning any POVM into a PVM on the larger space.&lt;/p&gt;&#xA;" OwnerUserId="11793" LastEditorUserId="11793" LastEditDate="2021-04-01T18:28:05.337" LastActivityDate="2021-04-01T18:28:05.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16772" PostTypeId="2" ParentId="16696" CreationDate="2021-03-30T19:30:11.620" Score="1" Body="&lt;p&gt;This might not be the most ideal implementation but an interesting way you could approximate this is using &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;s and &lt;span class=&quot;math-container&quot;&gt;$QFT^{-1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If we Taylor expand &lt;span class=&quot;math-container&quot;&gt;$e^x = 1 + x + \frac{x^2}{2!} ...$&lt;/span&gt; we can use the polynomial amplitude encoding in &lt;a href=&quot;https://static-content.springer.com/esm/art%3A10.1038%2Fs41534-019-0130-6/MediaObjects/41534_2019_130_MOESM1_ESM.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://static-content.springer.com/esm/art%3A10.1038%2Fs41534-019-0130-6/MediaObjects/41534_2019_130_MOESM1_ESM.pdf&lt;/a&gt;, Section D.&lt;/p&gt;&#xA;&lt;p&gt;Using the example from the paper for a polynomial &lt;span class=&quot;math-container&quot;&gt;$p(x) = ax^2 + bx + c$&lt;/span&gt;, where we substitute our coefficients from the Taylor expansion, we can apply the controlled &lt;span class=&quot;math-container&quot;&gt;$R_y$&lt;/span&gt;s to an ancilla:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ U_{e^x}|0\rangle = R_y(1.5)^{q_2}R_y(2)^{q_1,q_2}R_y(4)^{q_1}R_y(1)|0\rangle \rightarrow  \cos(e^x/2)|0\rangle + \sin(e^x/2)|1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can use take QFT of the ancilla to a register &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$QFT^{-1}U_{e^x}|0\rangle|R\rangle \rightarrow U_{e^x}|0\rangle|\sin(e^x/2)\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Finally we can use the approximation &lt;span class=&quot;math-container&quot;&gt;$\sin(x) \approx x$&lt;/span&gt; assuming &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is sufficiently small. We can control this by scaling the Taylor approximation polynomial.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$QFT^{-1}U_{e^x}|0\rangle|R\rangle \rightarrow U_{e^x}|0\rangle|\sin(e^x/2)\rangle \approx U_{e^x}|0\rangle|e^x/2\rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The main caveat is we need to ensure the correct scaling, with a constant &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt;, ideally we would like our scaling s.t. &lt;span class=&quot;math-container&quot;&gt;$\sup Ke^x &amp;lt; \frac{\pi}{4}$&lt;/span&gt; in our domain of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. As such we would obtain&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|Ke^x/2\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;and then we would need to have a circuit to descale. If we take &lt;span class=&quot;math-container&quot;&gt;$K$&lt;/span&gt; in the form of &lt;span class=&quot;math-container&quot;&gt;$2^{-n}$&lt;/span&gt;, then in fact we don't need to implement a descaling circuit and we can just rescale the values of the coefficients of our binary representation by &lt;span class=&quot;math-container&quot;&gt;$2^{n+1}$&lt;/span&gt; to recover our approximation to &lt;span class=&quot;math-container&quot;&gt;$e^x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note: Here was are assuming &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is a binary integer.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2021-03-30T22:22:05.520" LastActivityDate="2021-03-30T22:22:05.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16773" PostTypeId="2" ParentId="16729" CreationDate="2021-03-30T19:33:31.283" Score="1" Body="&lt;p&gt;Assuming we have the matrix representation of each gate in the set, determining if the set spans the Bloch sphere is mathematically equivalent to checking if the matrices are linearly independent and form a basis of &lt;span class=&quot;math-container&quot;&gt;$M_2(\rm I\!R)$&lt;/span&gt;. For a set of three &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; matrices &lt;span class=&quot;math-container&quot;&gt;$\{ A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$C \}$&lt;/span&gt;, we can just think of the matrices as being vectors of length 4:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \begin{pmatrix} a &amp;amp; b \\ c &amp;amp; d \end{pmatrix} \mapsto (a, b, c, d)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can then follow the usual procedure for checking the linear independence of vectors&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ c_1 A + c_2 B + c_3 C = 0 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and have to prove that &lt;span class=&quot;math-container&quot;&gt;$c_1 = c_2 = c_3 = 0$&lt;/span&gt; is the only solution.&lt;/p&gt;&#xA;&lt;p&gt;Let me know if that answers your question&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-06T13:47:07.553" LastActivityDate="2021-04-06T13:47:07.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16774" PostTypeId="2" ParentId="16769" CreationDate="2021-03-30T19:50:28.213" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; be a &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; Hermitian matrix.&lt;/p&gt;&#xA;&lt;p&gt;You can always choose a basis with respect to which &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is represented as a diagonal matrix, so let us fix this basis.&#xA;We can also assume, without loss of generality, that the first eigenvalue is zero (because changing the Hamiltonian by a constant factor doesn't affect the physics).&lt;/p&gt;&#xA;&lt;p&gt;Then, &lt;span class=&quot;math-container&quot;&gt;$H=\operatorname{diag}(0,\lambda)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$\lambda\in\mathbb R$&lt;/span&gt;, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-iHt} =&#xA;\begin{pmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{-i\lambda t}\end{pmatrix}.$$&lt;/span&gt;&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\cos(\theta/2)|0\rangle+\sin(\theta/2)e^{i\phi}|1\rangle$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\theta,\phi\in\mathbb R$&lt;/span&gt;, be an arbitrary pure state.&#xA;You can easily verify that, in the Bloch sphere, this (or more precisely, the corresponding projection) has coordinates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle\!\langle\psi| =&#xA;\frac12\left(I + \cos(\theta)Z + \sin(\theta)\cos(\phi) X + \sin(\theta)\sin(\phi) Y\right).$$&lt;/span&gt;&#xA;At the same time,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-iHt}|\psi\rangle =&#xA;\cos(\theta/2)|0\rangle +e^{i(\phi-\lambda t)}\sin(\theta/2)|1\rangle,$$&lt;/span&gt;&#xA;which in Bloch coordinates reads&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{-iHt}|\psi\rangle\!\langle \psi| e^{iH t} =&#xA;\frac12[I + \cos(\theta)Z + \sin(\theta)\cos(\phi-\lambda t)X + \sin(\theta)\sin(\phi-\lambda t) Y].$$&lt;/span&gt;&#xA;In other words, upon rotation, the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; coordinate of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; remains unchanged, whereas &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; coordinates transform as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x  \to x \cos(\lambda t) + y \sin(\lambda t), \\&#xA;y \to y \cos(\lambda t) - x \sin(\lambda t).$$&lt;/span&gt;&#xA;It follows that, if &lt;span class=&quot;math-container&quot;&gt;$\lambda&amp;gt;0$&lt;/span&gt;, then the rotation follows the right-hand rule (&lt;em&gt;i.e.&lt;/em&gt; it is counterclockwise around the axes corresponding to the Hamiltonian's eigenvector).&lt;/p&gt;&#xA;&lt;p&gt;To state this more precisely: given the standard conventions on how the Bloch representation is defined, the rotation is counterclockwise with respect to the direction going from the origin to the first eigenvector of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, assuming the phase difference between second and first eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is positive.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-03-30T19:50:28.213" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16775" PostTypeId="2" ParentId="16753" CreationDate="2021-03-30T20:40:26.160" Score="0" Body="&lt;p&gt;You can use Qiskit's &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.primitive_ops.MatrixOp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;MatrixOp&lt;/a&gt;, and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.operators.list_ops.TensoredOp.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;TensoredOp&lt;/a&gt; classes:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;_list = []&#xA;for _ in range(n):&#xA;    _list.append(MatrixOp(matrixR))&#xA;&#xA;tensored_op = TensoredOp(_list)&#xA;gateCR=tensored_op.to_circuit().to_gate().control(num_ctrl_qubits = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-03-30T20:40:26.160" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16776" PostTypeId="1" CreationDate="2021-03-31T00:39:36.270" Score="3" ViewCount="76" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I'd like to know if there's anything that can be said about whether and when we can efficiently prepare a state corresponding to the second-lowest eigenvalue of a given Hamiltonian, or in any other way learn what this energy is?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For example, in the case of a Hamiltonian of a doubly-stochastic Markov chain &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; acting on a space &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; of known dimension &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; that is promised to be ergodic, and wherein we have oracle access to adjacent nodes, we can prepare arbitrary states &lt;span class=&quot;math-container&quot;&gt;$\vert b\rangle$&lt;/span&gt; and perform quantum phase estimation to thereon, to do an eigenvalue sampling on the probability distribution supported on the spectrum of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My intuition, which I don't know how to formalize, is that given two vertices &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; that are far from each other in the state space &lt;span class=&quot;math-container&quot;&gt;$\Omega$&lt;/span&gt; of the Markov chain, the spectral decomposition of a superposition such as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vert\psi\rangle=\frac{1}{\sqrt{2}}(\vert i\rangle-\vert j\rangle)$$&lt;/span&gt;&#xA;likely has a large component corresponding to this second-lowest eigenstate.&lt;/p&gt;&#xA;&lt;p&gt;Thus eigenvalue sampling may well lead to such a second-lowest energy eigenstate.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-04-30T00:32:31.037" LastActivityDate="2021-04-30T00:32:31.037" Title="If we can prepare a ground state efficiently, when can we prepare the second-lowest energy eigenstate?" Tags="&lt;phase-estimation&gt;&lt;state-preparation&gt;&lt;stoquatic-matrices&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16777" PostTypeId="5" CreationDate="2021-03-31T00:43:06.843" Score="0" Body="" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-03-31T00:43:06.843" LastActivityDate="2021-03-31T00:43:06.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16778" PostTypeId="4" CreationDate="2021-03-31T00:43:06.843" Score="0" Body="For questions related to stoquastic matrices, also known as matrices having no sign problem.  These are Hermitian matrices having real, non-positive off-diagonal entries.  When viewed as Hamiltonians such matrices may be more efficiently computable than arbitrary Hamiltonians." OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-03-31T00:43:06.843" LastActivityDate="2021-03-31T00:43:06.843" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16779" PostTypeId="2" ParentId="16758" CreationDate="2021-03-31T09:44:46.337" Score="2" Body="&lt;p&gt;The Bell states form an orthonormal basis of 2-qubit Hilbert space. The way to show it is to come back to the definition of what an orthonormal basis is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;All vectors have length 1&lt;/li&gt;&#xA;&lt;li&gt;They are orthogonal to each other.&lt;/li&gt;&#xA;&lt;li&gt;The 2 qubit Hilbert space is 4 dimensional and you have 4 (orthonormal) vectors which implies linear independence.&#xA;So the only thing you need to be able to do is compute &amp;lt;b|b'&amp;gt; where |b&amp;gt; and |b'&amp;gt; are Bell states.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="9393" LastActivityDate="2021-03-31T09:44:46.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16780" PostTypeId="1" AcceptedAnswerId="16781" CreationDate="2021-03-31T13:56:45.063" Score="2" ViewCount="129" Body="&lt;p&gt;I want to show that if one measures &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; then measures &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; on the resulting state and then the associated probability space will be the same as the one for measuring the product &lt;span class=&quot;math-container&quot;&gt;$M_2 M_1$&lt;/span&gt; on that pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (also assuming that the &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; are Hermitian and commute). So in our first measurement procedure, we have two measurement operators, the first one yields,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(1)=\langle \psi|M_1^\dagger M_1|\psi\rangle\tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the resulting state is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{M_1|\psi\rangle}{\sqrt{\langle \psi|M_1^\dagger M_1|\psi\rangle}}.\tag{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we then measure it using &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; then we get,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(2)=\left\langle\frac{M_1|\psi\rangle}{\sqrt{\langle \psi|M_1^\dagger M_1|\psi\rangle}} \bigg| M_2^\dagger M_2 \bigg| \frac{M_1|\psi\rangle}{\sqrt{\langle \psi|M_1^\dagger M_1|\psi\rangle}}\right\rangle.\tag{3}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$M_2M_1$&lt;/span&gt; we get,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(1)=\langle\psi|(M_2M_1)^\dagger M_2M_1|\psi\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, we only have one measurement operator here being &lt;span class=&quot;math-container&quot;&gt;$M_2M_1$&lt;/span&gt;, so how can the probability spaces be the same?&lt;/p&gt;&#xA;" OwnerUserId="15388" LastEditorUserId="2293" LastEditDate="2021-04-01T22:38:26.093" LastActivityDate="2021-04-01T22:38:26.093" Title="Measuring the product is the same as first measuring with one matrix then with the other" Tags="&lt;measurement&gt;" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="16781" PostTypeId="2" ParentId="16780" CreationDate="2021-03-31T15:04:26.553" Score="2" Body="&lt;p&gt;For the case of &amp;quot;multiplying the outcomes&amp;quot; the probability spaces are not equivalent. However, looking simply at cascading measurements versus single measurements, the probability spaces &lt;em&gt;are&lt;/em&gt; the same because the resulting states are the same:&lt;/p&gt;&#xA;&lt;p&gt;The state of the system &lt;span class=&quot;math-container&quot;&gt;$| \psi_1 \rangle$&lt;/span&gt; after the measurement &lt;span class=&quot;math-container&quot;&gt;$M_1$&lt;/span&gt; is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \psi_1 \rangle = \frac{M_1 | \psi \rangle}{\sqrt{\langle \psi | M_1^\dagger M_1 | \psi \rangle}} .$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, the state of the system &lt;span class=&quot;math-container&quot;&gt;$| \psi_2 \rangle$&lt;/span&gt; after the measurement &lt;span class=&quot;math-container&quot;&gt;$M_2$&lt;/span&gt; is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \psi_2 \rangle = \frac{M_2 | \psi_1 \rangle}{\sqrt{\langle \psi_1 | M_2^\dagger M_2 | \psi_1 \rangle}} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hspace{55mm}= \frac{M_2 M_1 | \psi \rangle}{\sqrt{\langle \psi | M_1^\dagger M_1 | \psi \rangle}} \cdot \frac{\sqrt{\langle \psi | M_1^\dagger M_1 | \psi \rangle}}{\langle \psi | M_1^\dagger M_2^\dagger M_2 M_1 | \psi \rangle} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \hspace{22mm} = \frac{M_2 M_1 | \psi \rangle}{\sqrt{\langle \psi | M_1^\dagger M_2^\dagger M_2 M_1 | \psi \rangle}} .$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, the state of the system &lt;span class=&quot;math-container&quot;&gt;$| \psi_3 \rangle $&lt;/span&gt; after the measurement &lt;span class=&quot;math-container&quot;&gt;$ M_2 M_1 $&lt;/span&gt; is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ | \psi_3 \rangle = \frac{M_2 M_1 | \psi \rangle}{\sqrt{\langle \psi | M_1^\dagger M_2^\dagger M_2 M_1 | \psi \rangle}} = | \psi_2 \rangle .$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-03-31T15:52:59.247" LastActivityDate="2021-03-31T15:52:59.247" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16782" PostTypeId="2" ParentId="16780" CreationDate="2021-03-31T15:47:41.590" Score="-1" Body="&lt;p&gt;This isn't true. Here's a counterexample.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KGtq1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KGtq1.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note the density matrix after the product measurement is not the same as the density matrix after the two individual measurements.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-03-31T15:47:41.590" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16785" PostTypeId="1" AcceptedAnswerId="16796" CreationDate="2021-03-31T17:10:06.007" Score="4" ViewCount="138" Body="&lt;p&gt;I read a &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/9/6/199/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Paper&lt;/a&gt; about quantum error corrections. I don't know why this is a CNOT gate. How to calculate this kind of CNOT gate as a topology form?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FG9jL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FG9jL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14585" LastEditorUserId="119" LastEditDate="2021-04-01T20:18:37.937" LastActivityDate="2021-04-02T02:16:40.930" Title="Why is this topological gate mentioned in Raussendorf et al. 2007 a CNOT?" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;&lt;topological-quantum-computing&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16786" PostTypeId="1" AcceptedAnswerId="16803" CreationDate="2021-03-31T17:33:46.340" Score="1" ViewCount="75" Body="&lt;p&gt;I'm learning Qiskit for my QC lectures and I'm not able to run the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit, QuantumRegister, assemble, Aer&#xA;&#xA;def cnotnot(gate_label = 'CNOTNOT'):&#xA;    gate_circuit = QuantumCircuit(3, name = gate_label)&#xA;    gate_circuit.cnot(0, 1)&#xA;    gate_circuit.cnot(0, 2)&#xA;&#xA;    gate = gate_circuit.to_gate()&#xA;&#xA;    gate.label = gate_label&#xA;&#xA;    return gate&#xA;&#xA;q = QuantumRegister(3, name = 'q')&#xA;&#xA;circuit = QuantumCircuit(q)&#xA;&#xA;# Define initial state&#xA;initial_state = [1. / np.sqrt(2.), 1. / np.sqrt(2.)]&#xA;circuit.initialize(initial_state, 0)&#xA;&#xA;circuit.append(cnotnot(), [q[0], q[1], q[2]])&#xA;&#xA;circuit.draw(plot_barriers = False)&#xA;&#xA;# Let's simulate our circuit in order to get the final state vector!&#xA;svsim = Aer.get_backend('statevector_simulator')&#xA;&#xA;# Create a Qobj from the circuit for the simulator to run&#xA;qobj = assemble(circuit)&#xA;&#xA;# Do the simulation, return the result and get the state vector&#xA;result = svsim.run(qobj).result().get_statevector()&#xA;&#xA;# Get the state vector for the first qubit&#xA;final_state = [result[0], result[1]]&#xA;&#xA;print('a and b coefficients before simulation:', initial_state)&#xA;print('a and b coefficients after simulation:', final_state)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;without getting errors. In particular:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QiskitError: 'ERROR:  [Experiment 0] Circuit contains invalid instructions {&amp;quot;gates&amp;quot;: {CNOTNOT}} for &amp;quot;statevector&amp;quot; method.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I followed &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13289/defining-a-custom-parametric-gate-in-qiskit-in-terms-of-standard-gates&quot;&gt;this answer&lt;/a&gt; to define a CNOTNOT gate and append it to my circuit, but I can't get the Statevector after the simulation. If I don't use a defined gate (just use two separated CNOT), the code runs without problems.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for your time!&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="15391" LastEditDate="2021-04-01T08:58:24.340" LastActivityDate="2021-04-01T08:58:24.340" Title="How to get_statevector() with defined gates in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16787" PostTypeId="1" CreationDate="2021-03-31T17:36:00.890" Score="1" ViewCount="44" Body="&lt;p&gt;Can quantum tomography helps to reconstruct the state? How is this possible with arbitrary quantum state?&#xA;For example if I have a &lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle= (0.24506+0.9633i)|0\rangle + (0.0046238+0.10943i)|1\rangle$$&lt;/span&gt; if I measure it will give either 1 or 0, How can I reconstruct a state using tomography using Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="15087" LastActivityDate="2021-03-31T17:47:10.683" Title="how to implement Quantum tomography on an arbitrary state using Qiskit?" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16788" PostTypeId="2" ParentId="16787" CreationDate="2021-03-31T17:47:10.683" Score="2" Body="&lt;p&gt;If you have just one copy of the (unknown) state, you &lt;strong&gt;cannot&lt;/strong&gt; perform QST to reconstruct the state. For this, you will need many copies.&lt;/p&gt;&#xA;&lt;p&gt;As a matter of fact, there is &lt;a href=&quot;https://en.wikipedia.org/wiki/Holevo%27s_theorem&quot; rel=&quot;nofollow noreferrer&quot;&gt;Holevo's theorem&lt;/a&gt; which, loosely speaking, states that you cannot extract more than one bit of information out of a single qubit. To describe the state of a qubit you need considerably more bits, so that's impossible (unfortunately - this is one of the most restrictive theorems in the whole of quantum computing).&lt;/p&gt;&#xA;&lt;p&gt;If you are able to prepare many different copies of the state (not necessarily at the same time), &lt;strong&gt;then&lt;/strong&gt; you can perform state tomography. To learn how to do this with qiskit, check for instance their &lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/8_tomography.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;excellent tutorial on QST&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-03-31T17:47:10.683" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16789" PostTypeId="1" AcceptedAnswerId="16790" CreationDate="2021-03-31T18:45:59.220" Score="3" ViewCount="73" Body="&lt;p&gt;The logical basis states of the Shor’s 9-qubit code are given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|0_L\rangle = \frac{(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)}{2\sqrt{2}}, |1_L\rangle = \frac{(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)}{2\sqrt{2}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;What's the logical bit-flip &lt;span class=&quot;math-container&quot;&gt;$\hat{X}_L$&lt;/span&gt; and phase-flip operators &lt;span class=&quot;math-container&quot;&gt;$\hat{Z}_L$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14787" LastActivityDate="2021-04-02T13:40:30.530" Title="Logical bit-flip and Phase-flip operators of Shor’s 9-qubit code" Tags="&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16790" PostTypeId="2" ParentId="16789" CreationDate="2021-03-31T18:53:37.750" Score="4" Body="&lt;p&gt;The logical &lt;span class=&quot;math-container&quot;&gt;$Z_{L}$&lt;/span&gt; can be performed by flipping every bit in either of the three 'blocks':&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_{L} \hat{=} X_{1}X_{2}X_{3} \hat{=} X_{4}X_{5}X_{6} \hat{=} X_{7}X_{8}X_{9} &#xA;$$&lt;/span&gt;&#xA;or, for something more symmetric, just flip &lt;em&gt;all&lt;/em&gt; bits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_{L} \hat{=} X_{1}X_{2}X_{3}X_{4}X_{5}X_{6}X_{7}X_{8}X_{9} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here, the &lt;span class=&quot;math-container&quot;&gt;$\hat{=}$&lt;/span&gt; should be read as 'can be implemented as'. These operators are not necessarily the same operators, but they all have the same effect on the codespace (so for any logical state they are the 'same').&lt;/p&gt;&#xA;&lt;p&gt;The logical &lt;span class=&quot;math-container&quot;&gt;$X_{L}$&lt;/span&gt; can be performed by applying &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; different single-qubit &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operations, where the first of those three is on either of the first three qubits (i.e. &lt;span class=&quot;math-container&quot;&gt;$Z_{1}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_{2}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z_{3}$&lt;/span&gt;), the second of those three on either of the second three qubits (i.e. &lt;span class=&quot;math-container&quot;&gt;$Z_{4}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_{5}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z_{6}$&lt;/span&gt;), and the third of those three is on either of the last three qubits (i.e. &lt;span class=&quot;math-container&quot;&gt;$Z_{7}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z_{8}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Z_{9}$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Or, for something more symmetric again, just apply a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; flip to &lt;em&gt;all&lt;/em&gt; qubits:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X_{L} \hat{=} Z_{1}Z_{2}Z_{3}Z_{4}Z_{5}Z_{6}Z_{7}Z_{8}Z_{9} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-04-02T13:40:30.530" LastActivityDate="2021-04-02T13:40:30.530" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16791" PostTypeId="1" CreationDate="2021-03-31T20:33:30.183" Score="6" ViewCount="396" Body="&lt;p&gt;My Question based on this Paper &lt;a href=&quot;https://arxiv.org/pdf/2011.00027.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/2011.00027.pdf&lt;/a&gt; &amp;quot;Power of Quantum Neural Networks&amp;quot; - Section 2.&lt;/p&gt;&#xA;&lt;p&gt;So I know that there are different ways to implement Neural Networks into QNNs. In that paper, they used the QNN as a subclass from Variational Quantum Algorithm. So first we have a Feature-Map which is mapping our data by applying Hadamard gates and RZ gates.&lt;/p&gt;&#xA;&lt;p&gt;My first question is, &lt;strong&gt;why are all the states 0&lt;/strong&gt; (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;)?&lt;br&gt;&#xA;After the Feature Map they applying a variational model, where the parameters are chosen to minimize the loss function.&lt;/p&gt;&#xA;&#xA;" OwnerUserId="12711" LastEditorUserId="2293" LastEditDate="2021-04-01T22:39:26.323" LastActivityDate="2021-04-01T22:39:26.323" Title="Understanding the definition of quantum neural network of Abbas et al. 2020" Tags="&lt;algorithm&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;quantum-neural-network&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16793" PostTypeId="2" ParentId="16791" CreationDate="2021-03-31T21:13:43.477" Score="3" Body="&lt;p&gt;&lt;strong&gt;Why are all the states 0 ?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Oversimplified, there are three main components to any quantum circuit: the input, the quantum function, and the output. QML research will usually fall into two buckets. In the first, we take a fixed quantum function and feed it different inputs, and see how the output varies. In the second, we take a fixed input and play around with the quantum function and see how the output varies. So when you see the circuit initialized with all 0's, you can think of the input state as the 'controlled variable' and the quantum function as the 'independent variable.'&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What are we measuring?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;On each training iteration, we measure each qubit's spin state in the chosen computational basis (usually the Z basis). We then interpret the combined output of all qubits as a classical piece of information. Here, this output is the QNNs 'prediction' associated with the given (feature-mapped) input data.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What exactly are we optimizing?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The body of a QNN consists of a feature-map component and a variational component. The former is where we 'encode' the input data. The ladder is where we store our trained parameters. These often take the form of varying degrees of X, Y, and/or Z rotations. On each training iteration, we evaluate the circuit many times for each input data vector all using the same variational parameters. We then construct a distribution based on the outputs of the circuit, and can then determine how accurate the parameters we chose were to representing the input/output relationship for this circuit design according to a chosen cost function. At the end of the training iteration, the parameters are adjusted (trained) in the direction that minimizes this cost function. This can be done through gradient descent, as you mentioned, SPSA, or many other classical algorithms.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-03-31T21:13:43.477" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16794" PostTypeId="1" AcceptedAnswerId="16797" CreationDate="2021-03-31T21:29:53.360" Score="4" ViewCount="85" Body="&lt;p&gt;I'm confused about the relationship between kernel methods and SVM methods used in quantum machine learning. Sometimes the two seem to be used interchangeably, but often I'll see them both in the same sentence. I understand what an SVM is in the classical context. So is a kernel just the quantum equivalent? Or is there such thing as a 'classical' kernel and a 'quantum' SVM?&lt;/p&gt;&#xA;" OwnerUserId="15390" LastEditorUserId="13991" LastEditDate="2021-05-10T23:14:02.283" LastActivityDate="2021-05-10T23:14:02.283" Title="Is a &quot;kernel&quot; just the quantum equivalent of classical SVMs?" Tags="&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;kernel-methods&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16795" PostTypeId="1" AcceptedAnswerId="16831" CreationDate="2021-03-31T22:00:14.370" Score="0" ViewCount="43" Body="&lt;p&gt;I stumbled across a &lt;a href=&quot;https://arxiv.org/pdf/2009.07301.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;new paper&lt;/a&gt; on gate set tomography. Can gate set tomography be applied to a quantum channel or multiple quantum channels? Will the same advantages still apply of not having to 'rely on pre-calibrated state preparations and measurements'? Would GST be advantageous over QPT in some scenarios?&lt;/p&gt;&#xA;" OwnerUserId="14239" LastActivityDate="2021-04-04T12:02:14.743" Title="Can Gate Set Tomography work on Quantum Channels?" Tags="&lt;quantum-gate&gt;&lt;quantum-operation&gt;&lt;fidelity&gt;&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16796" PostTypeId="2" ParentId="16785" CreationDate="2021-03-31T22:37:45.043" Score="6" Body="&lt;p&gt;There are a variety ways of showing this, depending on your prior knowledge. The simplest is to know that you can convert a braiding diagram into a ZX calculus graph by changing each ring into a connected component of nodes of the same type and putting edges between components whose rings are of opposite type and linked:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/MR3Gd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/MR3Gd.png&quot; alt=&quot;topology&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aUVOj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aUVOj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is the same as (by contracting adjacent nodes of the same color and discarding self-edges, which doesn't change the operation of the graph):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9NOdX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9NOdX.png&quot; alt=&quot;graph&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is the same as (by discarding degree 2 nodes, which has no effect on the operation):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Gs8KK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Gs8KK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which, if you're familiar with the ZX calculus, is the standard CNOT graph. You can evaluate as a tensor network to see that it corresponds to the unitary matrix of the CNOT.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, what you can do is show that the topological construction supports parity sheets corresponding to the stabilizer tableau of a CNOT operation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\text{Tableau}(CNOT) = \begin{array}{r|cc|cc}&#xA;&amp;amp; X_c &amp;amp; Z_c &amp;amp; X_t &amp;amp; Z_t \\&#xA;\hline&#xA;c &amp;amp; X &amp;amp; Z &amp;amp; &amp;amp; Z \\&#xA;t &amp;amp; X &amp;amp;   &amp;amp; X &amp;amp; Z \\&#xA;\end{array}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For example here is the parity sheet of the &lt;span class=&quot;math-container&quot;&gt;$X_c \rightarrow X_c X_t$&lt;/span&gt; entry:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dm1DN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dm1DN.png&quot; alt=&quot;parity sheet&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The main rule you need to know, in order to find these sheets, is that they can be extended through space arbitrarily but can only terminate on boundaries of the same type. So in this quick sketch above the rule I was following is that the &amp;quot;red&amp;quot; sheet could only terminate on the dark boundary, and I found a way to link a top-left tube to a bottom-right and bottom-left tube while respecting that rule.&lt;/p&gt;&#xA;&lt;p&gt;I've given a talk going into this in more detail: &lt;a href=&quot;https://www.youtube.com/watch?v=1ojXEEm_JiI&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=1ojXEEm_JiI&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WuDkC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WuDkC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-04-02T02:16:40.930" LastActivityDate="2021-04-02T02:16:40.930" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16797" PostTypeId="2" ParentId="16794" CreationDate="2021-03-31T23:14:59.930" Score="6" Body="&lt;p&gt;Consider a simple implementation of a Support Vector Machine (SVM) that finds a hyperplane (defined by its normal vector &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;) that maximally separates vectors &lt;span class=&quot;math-container&quot;&gt;$\{v_1, \dots, v_m\}$&lt;/span&gt; according to their labels &lt;span class=&quot;math-container&quot;&gt;$\{y_1, \dots, y_m\}$&lt;/span&gt;, where each &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; is either &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. For simplicity we'll assume that such a &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; exists (i.e. the vectors &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}$&lt;/span&gt; are linearly seperable , or that the hard margin SVM is realizable). Training the SVM results in a linear prediction function, which assigns a label to some new vector &lt;span class=&quot;math-container&quot;&gt;$v_i$&lt;/span&gt; according to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;f(v_i) = \text{sign}(\langle w, v_i\rangle)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\langle w, v_i\rangle$&lt;/span&gt; comes out positive, it means that &lt;span class=&quot;math-container&quot;&gt;$v_i$&lt;/span&gt; lives on the half of the plane &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; where the set of positively-labeled vectors &lt;span class=&quot;math-container&quot;&gt;$\{v_k: y_k=+1\}$&lt;/span&gt; also live, and so the best inference we can make is that &lt;span class=&quot;math-container&quot;&gt;$v_i$&lt;/span&gt; should also be assigned a positive label.&lt;/p&gt;&#xA;&lt;p&gt;Up to this point I have not explicitly stated what space the vectors &lt;span class=&quot;math-container&quot;&gt;$v, w$&lt;/span&gt; live in, but that space should at least have an associated inner product. Without losing much generality we can enforce that &lt;span class=&quot;math-container&quot;&gt;$v, w$&lt;/span&gt; live in a Hilbert space to make the following comparison simpler. Then imagine two different applications of this algorithm:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Define our dataset &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}$&lt;/span&gt; to be a set of &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional real vectors &lt;span class=&quot;math-container&quot;&gt;$\{x_1, \dots, x_m\} = \mathcal{X}\subset \mathbb{R}^d$&lt;/span&gt;, so that we end up doing linear classification with hyperplane &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{X}$&lt;/span&gt; according to the label of each datapoint &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Define our dataset &lt;span class=&quot;math-container&quot;&gt;$\{v_k\}$&lt;/span&gt; to be a set of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-dimensional complex vectors &lt;span class=&quot;math-container&quot;&gt;$\{\phi_1, \dots, \phi_m\} = \mathcal{\Phi}\subset \mathbb{C}^p$&lt;/span&gt;, so that we end up doing linear classification with hyperplane &lt;span class=&quot;math-container&quot;&gt;$w'$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{\Phi}$&lt;/span&gt; according to the label of each &lt;span class=&quot;math-container&quot;&gt;$\phi_i$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These are still both linear classifiers. But now we make a connection between the two by defining&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{2}&#xA;\phi_i \equiv \phi(x_i)&#xA;$$&lt;/span&gt;&#xA;such that &lt;span class=&quot;math-container&quot;&gt;$\phi: \mathbb{R}^d \rightarrow \mathbb{C}^p$&lt;/span&gt; is a &lt;em&gt;feature map&lt;/em&gt; that sends each real datapoint &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; in my &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional space to some  other element &lt;span class=&quot;math-container&quot;&gt;$\phi(x_i)$&lt;/span&gt; in my (possibly much higher-dimensional) &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt;-dimensional space. The feature map &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; will generally be non-linear. This has the powerful side effect of making application #2 a &lt;em&gt;nonlinear&lt;/em&gt; version of application #1, that is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;f'(x_i) = \text{sign}(\langle w', \phi(x_i)\rangle)&#xA;$$&lt;/span&gt;&#xA;will result in a decision boundary that is more expressive in our input space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^d$&lt;/span&gt; than the corresponding linear decision boundary &lt;span class=&quot;math-container&quot;&gt;$f(x_i) = \text{sign}(\langle w, x_i\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;So to answer some of your questions&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Why do I see SVM and quantum kernel methods used interchangeably&lt;/em&gt; - they should generally not be. A quantum kernel method describes (a) constructing the feature map &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; to map input data &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; into a state &lt;span class=&quot;math-container&quot;&gt;$\phi(x_i)$&lt;/span&gt; that lives in quantum state space, typically (but not quite rigorously correct) of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{4}&#xA;\phi(x) \equiv U(x)|0\rangle&#xA;$$&lt;/span&gt;&#xA;for some unitary &lt;span class=&quot;math-container&quot;&gt;$U(x)$&lt;/span&gt; that you can run on a quantum circuit, and then (b) processing our input data &lt;span class=&quot;math-container&quot;&gt;$\{x_i\}$&lt;/span&gt; by evaluating inner products of the form &lt;span class=&quot;math-container&quot;&gt;$\langle \phi(x_i), \phi(x_j)\rangle \equiv k(x_i, x_j)$&lt;/span&gt;. This &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the kernel we define with respect to our data, hence quantum &lt;em&gt;kernel&lt;/em&gt; method. Running an SVM on our data using this quantum kernel is just the very specific choice of learning a function of the form of Equation (3). In general we can decompose &lt;span class=&quot;math-container&quot;&gt;$w'$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{5}&#xA;w' = \sum_{k=1}^m \alpha_k \phi(x_k)&#xA;$$&lt;/span&gt;&#xA;and so the classifier (3) can indeed be expressed strictly in terms of &lt;span class=&quot;math-container&quot;&gt;$k(x_i, x_j)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Is a kernel just the quantum equivalent [of a classical SVM]?&lt;/em&gt; No! The only thing special about a quantum kernel method is that &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is computed (or &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is constructed) using a quantum computer. There are plenty of classical kernels (Gaussian, polynomial, Laplace, etc.) you can efficiently compute on a classical machine to do nonlinear classification. Implementing an SVM using a quantum kernel just means making a choice &lt;em&gt;not&lt;/em&gt; to use one of those out-of-the-box classical kernel functions and instead use a feature map like Equation (4). Furthermore, not all kernel methods involve an SVM; consider Kernel Nearest Neighbors, Kernel Principal Component Analysis, Kernel Spectral Clustering, etc. One could choose to compute &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; on a quantum computer and then use it as input to one of the other algorithms instead of an SVM and still have something called a ``quantum kernel method''.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Is there such thing as a 'classical' kernel and a 'quantum' SVM?&lt;/em&gt; I'm not sure; its hard for me to imagine what that setup would look like but quantum kernels are an active area of research so maybe something like this will be proposed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2021-04-05T18:14:27.750" LastActivityDate="2021-04-05T18:14:27.750" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16798" PostTypeId="2" ParentId="16791" CreationDate="2021-03-31T23:57:01.943" Score="3" Body="&lt;p&gt;Typically when you use these kinds of variational circuits to do classification, your goal is to use the circuit to classify some input data &lt;span class=&quot;math-container&quot;&gt;$x\in\mathbb{R}^d$&lt;/span&gt; with a decision function of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;f(x;\theta) = \langle \psi_x | \mathcal{G}^\dagger (\theta) \hat{M} \mathcal{G}(\theta)|\psi_x\rangle = \langle \hat{M} \rangle&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\hat{M}$&lt;/span&gt; is some observable that you're computing the expectation value for at the output of the circuit. In their specific implementation it looks like they're using a parity observable like &lt;span class=&quot;math-container&quot;&gt;$\hat{M} = \bigotimes_{k=1}^n Z_k$&lt;/span&gt; that measures whether your observed bitstring had an even or odd number of zeros at each measurement. &lt;span class=&quot;math-container&quot;&gt;$f(x;\theta)$&lt;/span&gt; has two inputs: a datapoint &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that you're trying to classify and the current choice of parameters &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; that your classifier is parameterized by.&lt;/p&gt;&#xA;&lt;p&gt;Also they choose to define&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\tag{2}&#xA;|\psi_x \rangle = \mathcal{U}_x|0\rangle \\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which is some unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt; parameterized by a datapoint &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To answer your questions&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Why are the input states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;?&lt;/em&gt; Suppose the starting state was instead &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. If this is a valid quantum state then there must be some unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; whose first column is &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \mathcal{V}|0\rangle$&lt;/span&gt;. But since &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}_x$&lt;/span&gt; is a generic unitary and the product of two unitaries is also unitary, we're free just absorb the fixed &lt;span class=&quot;math-container&quot;&gt;$\mathcal{V}$&lt;/span&gt; into Equation (2) as follows&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{U}_x \rightarrow \mathcal{U}_x \mathcal{V} |0\rangle&#xA;$$&lt;/span&gt;&#xA;so then we've recovered the situation where the input state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. No matter what (pure) state you decide to start from you can rearrange the circuit like this so you might as well define the circuit as starting from &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;What are we measuring?&lt;/em&gt; As I said before they chose to measure the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit parity operator for their specific setup. But I would argue that you could also view this circuit as measuring a &lt;em&gt;parameterized version of &lt;span class=&quot;math-container&quot;&gt;$\hat{M}$&lt;/span&gt;&lt;/em&gt;, namely&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{M}(\theta) \equiv \mathcal{G}^\dagger (\theta) \hat{M} \mathcal{G}(\theta)&#xA;$$&lt;/span&gt;&#xA;From this perspective, the classifier is trying to optimize a function of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x;\theta) = \langle M(\theta, x)\rangle = \langle \psi_x |\hat{M}(\theta)|\psi_x\rangle&#xA;$$&lt;/span&gt;&#xA;by searching for an &lt;em&gt;optimal measurement&lt;/em&gt; described by &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; that classifies encoded states &lt;span class=&quot;math-container&quot;&gt;$|\psi_x\rangle$&lt;/span&gt;. I did not modify anything in the circuit - this is just a matter of perspective on the goal they're trying to acheive.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;What exactly are they optimizing?&lt;/em&gt; Without digging through the paper, typically you're trying to minimize some empirical loss function that looks like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;\min_\theta \sum_{i} L(\langle M(\theta, x_i)\rangle, y_i)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; describes how different the label prediction for &lt;span class=&quot;math-container&quot;&gt;$\hat{y} = f(x_i) = \langle M(\theta, x_i)$&lt;/span&gt; is from the actual label &lt;span class=&quot;math-container&quot;&gt;$y_i$&lt;/span&gt;, and the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; index all the points in the dataset. One good choice for loss function in binary classifiers is the ``hinge loss'' &lt;span class=&quot;math-container&quot;&gt;$L(f(x;\theta), y)) = 1 - f(x;\theta)y$&lt;/span&gt;, but again I did not check what specific loss function they are using. Either way, the goal is to find some &lt;span class=&quot;math-container&quot;&gt;$f(x; \theta)$&lt;/span&gt; that correctly predicts the label &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; as often as possible, and solving Equation (3) is usually seen as a good best guess for that choice of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-03-31T23:57:01.943" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16799" PostTypeId="1" CreationDate="2021-04-01T03:59:42.133" Score="0" ViewCount="30" Body="&lt;p&gt;A growing interest in Quantum Computing -particularly in its eventual applications on Machine Learning- has taken over me and I would like to follow that path. I have strong Maths (Calculus, Multivariate Calculus, Linear Algebra, Math. Analysis, etc) and Probability foundations but my knowledge in Physics is rather poor.&lt;/p&gt;&#xA;&lt;p&gt;I also have some knowledge in common Machine Learning.&lt;/p&gt;&#xA;&lt;p&gt;What subjects should I study and -if possible- what books per subject could I try?&lt;/p&gt;&#xA;&lt;p&gt;I will probably do this on my own but I don't mind taking rigourous books if it's needed.&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot, I know the answer to my question is a large one and I appreciate the effort it will take to approach it.&lt;/p&gt;&#xA;" OwnerUserId="15394" LastEditorUserId="55" LastEditDate="2021-04-01T13:05:54.130" LastActivityDate="2021-04-01T13:05:54.130" Title="Recommended resources for starter in quantum computing and its eventual applications on machine learning" Tags="&lt;resource-request&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2021-04-01T21:09:28.213" ContentLicense="CC BY-SA 4.0" />
  <row Id="16800" PostTypeId="1" CreationDate="2021-04-01T05:13:22.500" Score="0" ViewCount="47" Body="&lt;p&gt;I am trying to run this QSVM tutorial using qiskit from my Python environment using Jupyter Notebook&lt;/p&gt;&#xA;&lt;p&gt;Firstly it gives me an error that I have to install &lt;code&gt;qiskit-aqua[cvx]&lt;/code&gt; when I try to run this code -&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = BasicAer.get_backend('qasm_simulator')&#xA;quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=seed,seed_transpiler=seed)&#xA;result = qsvm.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then after I install the above package. I keep on getting the error - 'BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.'&lt;/p&gt;&#xA;&lt;p&gt;I also try using the following code at the beginning of the notebook as per here &lt;a href=&quot;https://github.com/Qiskit/qiskit-aer/issues/924&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aer/issues/924&lt;/a&gt;. But no luck.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import os &#xA;os.environ['MPMATH_NOSAGE'] = 'true'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Any help is highly appreciated.&lt;/p&gt;&#xA;&lt;p&gt;Regards,&#xA;Sourav&lt;/p&gt;&#xA;" OwnerUserId="15395" LastEditorUserId="55" LastEditDate="2021-04-01T13:06:23.763" LastActivityDate="2021-04-02T13:44:27.053" Title="Issue in running the qiskit tutorial for QSVM" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16801" PostTypeId="2" ParentId="16800" CreationDate="2021-04-01T05:54:08.070" Score="1" Body="&lt;p&gt;Please create a new conda env &amp;amp; install all reqd packages in there&lt;/p&gt;&#xA;&lt;p&gt;Conda create a new env -https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Conda activate your env &amp;amp; install these stuff &#xA;&#xA;conda install python=3.8.3&#xA;conda install -c anaconda pandas&#xA;conda install -c anaconda cmake&#xA;conda install -c anaconda libxml2&#xA;conda install scikit-learn&#xA;conda install cryptography&#xA;conda install -c anaconda libxslt&#xA;conda install -c anaconda pandas&#xA;conda install h5py &#xA;conda install pytest&#xA;conda install -c conda-forge cvxpy&#xA;conda install -c conda-forge pymetis&#xA;conda install -c conda-forge cvxopt&#xA;conda install -c conda-forge cvxpy&#xA;conda install ipywidgets&#xA;conda install lxml&#xA;conda install wheel&#xA;&#xA;pip install qiskit-ibmq-provider&#xA;pip install qiskit-terra&#xA;pip install qiskit-ignis &#xA;pip install qiskit-aqua==0.8.2&#xA;pip install qiskit-aer==0.7.3&#xA;Pip install qiskit  # this will update qiskit aqua &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After installation try to run this example &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/machine_learning/01_qsvm_classification.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/machine_learning/01_qsvm_classification.ipynb&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7344" LastActivityDate="2021-04-01T05:54:08.070" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16802" PostTypeId="1" AcceptedAnswerId="16807" CreationDate="2021-04-01T06:24:46.427" Score="1" ViewCount="59" Body="&lt;p&gt;The relative entropy between two quantum states is given by &lt;span class=&quot;math-container&quot;&gt;$D(\rho\|\sigma) = \operatorname{Tr}(\rho\log\rho -\rho\log\sigma)$&lt;/span&gt;. It is known that for any bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; with reduced states &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;, it holds that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho_{AB}\|\rho_A\otimes\rho_B)\leq D(\rho_{AB}\|\rho_A\otimes\omega_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all choices of &lt;span class=&quot;math-container&quot;&gt;$\omega_B$&lt;/span&gt;. This can be seen by expanding both sides and noting that the relative entropy is nonnegative. Now define the relative entropy variance (see &lt;a href=&quot;https://arxiv.org/pdf/1408.6894.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this reference&lt;/a&gt;, 2.16)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$V(\rho \| \sigma):=\operatorname{Tr} [\rho(\log \rho-\log \sigma-D(\rho \| \sigma))^{2}]$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does this also satisfy a similar property i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$V(\rho_{AB}\|\rho_A\otimes\rho_B) \leq V(\rho_{AB}\|\rho_A\otimes\sigma_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;EDIT: It seems like the last inequality is not true. But the name variance is suggestive so perhaps there is a non trivial lower bound for &lt;span class=&quot;math-container&quot;&gt;$V(\rho_{AB}\|\rho_A\otimes\sigma_B)$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$V(\rho_{AB}\|\rho_A\otimes\rho_B)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2021-04-02T05:02:23.880" LastActivityDate="2021-04-02T05:02:23.880" Title="Does the relative entropy variance $V(\rho_{AB}\|\rho_A\otimes\sigma_B)$ satisfy an ordering for different $\sigma_B$?" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16803" PostTypeId="2" ParentId="16786" CreationDate="2021-04-01T07:59:27.197" Score="1" Body="&lt;p&gt;You are missing an important part of the preparation process of the circuit for it to run on the simulator (any backend, actually) : &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler.html?highlight=transpile#module-qiskit.transpiler&quot; rel=&quot;nofollow noreferrer&quot;&gt;the transpilation&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In order to create the qobj, you first have to transpile your circuit into gates your backend &amp;quot;understands&amp;quot;, kind of like a translator between your custom gates and the basis gates of the backend. First you do the transpile of the circuit to transform it into gates the backends knows, then you assemble it into a obj to be able to run it.&lt;/p&gt;&#xA;&lt;p&gt;So for your code to run here, you would have to do something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Create a Qobj from the circuit for the simulator to run&#xA;test = transpile(circuit, svsim)&#xA;qobj = assemble(test)&#xA;&#xA;# Do the simulation, return the result and get the state vector&#xA;result = svsim.run(qobj).result().get_statevector()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can also use the &lt;code&gt;execute&lt;/code&gt; function that does it for you:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import execute&#xA;# Do the simulation, return the result and get the state vector&#xA;result = execute(circuit, svsim).result().get_statevector()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Hope this is clear enough, if you have any questions about this please let me know in the comments :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-04-01T07:59:27.197" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16804" PostTypeId="1" AcceptedAnswerId="16809" CreationDate="2021-04-01T10:23:16.730" Score="1" ViewCount="63" Body="&lt;p&gt;I am trying to upload my dataset(SWELL-KW) instead of MNIST in  &amp;quot;Hybrid quantum-classical Neural Networks with PyTorch and Qiskit&amp;quot; provided by IBM qiskit but it says &lt;code&gt;&amp;quot;AttributeError: module 'torchvision.datasets' has no attribute 'SWELL'&lt;/code&gt;. I could not find the dataset in torch vision. Is that the reason? If I try to give the path of dataset which is on my system, it indicates unicode error. Thank You.&lt;/p&gt;&#xA;" OwnerUserId="14924" LastEditorUserId="14924" LastEditDate="2021-04-01T12:58:24.763" LastActivityDate="2021-04-02T16:27:35.853" Title="How to upload our dataset using pytorch when it is not present in torchvision?" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;quantum-neural-network&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16805" PostTypeId="1" AcceptedAnswerId="16806" CreationDate="2021-04-01T10:40:40.310" Score="4" ViewCount="109" Body="&lt;p&gt;I'm studying an introduction course to quantum computation at my uni and we got homework to draw a certain circuit using qiskit. I managed to understand how to do what is asked from me, and this is the final answer:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/85fx2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/85fx2.png&quot; alt=&quot;Is there a way to force measurments at the end of the circuit?&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now I know that once the qubit is no longer used in a manipulation you can measure it without effecting the results, however I find this circuit rather confusing and messy. Since we can always postponed our measurement to the end, I'd prefer a more organised drawing where all CNOT gates are performed, and only then the measurements - preferably from the top one to the bottom one.&#xA;&lt;strong&gt;Is it possible to force such a thing?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;To try and force the code doing that I tried to first use a for loop to apply CNOTs on every qubit, then using a seperate loop I performed the measurements on every qubit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_three = QuantumCircuit(5, 5)&#xA;circuit_three.h(0)&#xA;for i in range(1, 5):&#xA;    circuit_three.cx(0, i)&#xA;for i in range(0, 5):&#xA;    circuit_three.measure(i, i)&#xA;circuit_three.draw(output='mpl', filename='3')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The desired result is this (done with paint):&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0Bqvg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0Bqvg.png&quot; alt=&quot;Desired Outcome of circuit drawing&quot; /&gt;&lt;/a&gt;&#xA;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="15398" LastEditorUserId="55" LastEditDate="2021-04-01T13:12:54.727" LastActivityDate="2021-04-01T13:12:54.727" Title="Qiskit - Circuit drawing esthatics - can i force the measurements in my circuit show at the end?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16806" PostTypeId="2" ParentId="16805" CreationDate="2021-04-01T10:56:59.530" Score="5" Body="&lt;p&gt;You can add a &lt;code&gt;barrier&lt;/code&gt; before the &lt;code&gt;measure&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit_three = QuantumCircuit(5, 5)&#xA;circuit_three.h(0)&#xA;for i in range(1, 5):&#xA;    circuit_three.cx(0, i)&#xA;circuit_three.barrier()  &amp;lt;--- add this line&#xA;for i in range(0, 5):    &amp;lt;--- side note: this can be replaced by circuit_three.measure_all()&#xA;    circuit_three.measure(i, i)&#xA;circuit_three.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rSAlD.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rSAlD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then, with the argument &lt;code&gt;plot_barriers&lt;/code&gt;, skip the plotting of the barrier:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit_three.draw(output='mpl', plot_barriers=False)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TdjmZ.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TdjmZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;An important caveat: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8369/what-is-a-barrier-in-qiskit-circuits&quot;&gt;the barrier have meaning for the transpiler&lt;/a&gt;. If you are planing to execute that circuit, remember to remove the added barrier.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-04-01T11:02:19.640" LastActivityDate="2021-04-01T11:02:19.640" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16807" PostTypeId="2" ParentId="16802" CreationDate="2021-04-01T11:51:09.610" Score="3" Body="&lt;p&gt;No, such an ordering does not exist. For example, take &lt;span class=&quot;math-container&quot;&gt;$\rho = |\phi\rangle \langle \phi|$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$| \phi \rangle = \cos(\theta) |00 \rangle + \sin(\theta) |11\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta \in (0,\pi/4)$&lt;/span&gt;. Then take &lt;span class=&quot;math-container&quot;&gt;$\sigma_B = I/2$&lt;/span&gt;, the maximally mixed qubit.&lt;/p&gt;&#xA;&lt;p&gt;A direct calculation gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V(\rho_{AB}\|\rho_A \otimes \rho_B) = 8 \big(\log[\tan(\theta)]  \sin(\theta) \cos(\theta)\big)^2 &#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;V(\rho_{AB}\|\rho_A \otimes \sigma_B) = 4 \big(\log[\tan(\theta)]  \sin(\theta) \cos(\theta)\big)^2 \,.&#xA;$$&lt;/span&gt;&#xA;So in this case we actually have &lt;span class=&quot;math-container&quot;&gt;$V(\rho_{AB}\|\rho_A \otimes \rho_B) = 2 V(\rho_{AB}\|\rho_A \otimes \sigma_B)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-04-01T11:51:09.610" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16809" PostTypeId="2" ParentId="16804" CreationDate="2021-04-01T14:41:02.227" Score="2" Body="&lt;p&gt;Yes, since the dataset does not exist in torchvision, trying to load it through torchvision will produce this error. Instead, save your SWELL-KW dataset as a .csv file, read it in, and convert the train/test data vectors, and labels each as their own PyTorch tensor.&lt;/p&gt;&#xA;&lt;p&gt;For example, let's say I have my own custom dataset that consists of coordinate pairs and associated labels. I save the data into a file &lt;code&gt;myData.csv&lt;/code&gt; such that the first column contains the x-coordinates, the second column contains the y-coordinates and the third column contains the labels. First, we load data row by row,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import csv&#xA;import torch&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;Xs = []&#xA;Ys = []&#xA;&#xA;with open('myData.csv', mode ='r') as data:&#xA;    csvFile = csv.reader(data)&#xA;    for row in csvFile:&#xA;        Xs.append([float(row[0]), float(row[1])])&#xA;        Ys.append(float(row[2]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and then we convert each of our lists to PyTorch tensors,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;X_tensor = torch.FloatTensor(Xs)&#xA;Y_tensor = torch.FloatTensor(Ys)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Your data is now ready to use. For more complex datasets or specific use cases you may need to &lt;a href=&quot;https://pytorch.org/tutorials/beginner/data_loading_tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;create a custom dataset class&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-02T16:27:35.853" LastActivityDate="2021-04-02T16:27:35.853" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16811" PostTypeId="2" ParentId="14450" CreationDate="2021-04-01T20:33:01.583" Score="0" Body="&lt;p&gt;First, check whether or not the output you are creating is phase sensitive or not. If it's not (e.g. you only use it to control operations and are going to uncompute it later), then you can prepare it much more efficiently by using classical sampling methods and making them reversible. For example, you can use a quantum variant of &lt;a href=&quot;https://en.wikipedia.org/wiki/Alias_method&quot; rel=&quot;nofollow noreferrer&quot;&gt;alias sampling&lt;/a&gt; (as explained in Section III of &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt;) which involves a QROM read circuit, a comparison, and a conditional swap. The rest of this answer assumes you can't do that.&lt;/p&gt;&#xA;&lt;p&gt;Basically what you want to do is iteratively prepare each qubit to have the right magnitude when conditioned on each possible value of the previous qubits. For example, suppose that when you look at the distribution you're trying to prepare, the total probability of all cases where qubit 0 is ON is 30%. That is to say, &lt;span class=&quot;math-container&quot;&gt;$P(b_0) = 0.3$&lt;/span&gt;. Then you want to start by rotating qubit 0 until it has a 30% chance of being ON if measured in the Z basis. Now further suppose that, when qubit 0 is OFF, qubit 1 has a 40% chance of being ON and when qubit 0 is ON then qubit 1 has a 70% chance of being on. That is to say, &lt;span class=&quot;math-container&quot;&gt;$P(b_1 | !b_0) = 0.4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P(b_1 | b_0) = 0.7$&lt;/span&gt;. Then you want to rotate qubit 1 by enough so it has a 40% of being ON, then rotate by an additional delta that increases this chance to 70% but conditioned on qubit 0 being ON.&lt;/p&gt;&#xA;&lt;p&gt;You continue on in this fashion, rotating each successive qubit by an amount that is conditioned on each possible value of the previous qubits and chosen to make its conditional probabilities match the distribution you're trying to prepare. The controlled rotations have to be decomposed into your gate set. If you correctly optimize the controlled rotations, so that they share controls as much as possible (read: use unary iteration as covered in &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt; to generate qubits for all the cases you want to condition on) you will find that this has a total non-Clifford gate count of &lt;span class=&quot;math-container&quot;&gt;$O(N \cdot \lg \frac{1}{\epsilon})$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of cases in the distribution. If you don't use unary iteration, don't share combined controls between cases, the cost will increase to &lt;span class=&quot;math-container&quot;&gt;$O(N \cdot \lg N \cdot \lg \frac{1}{\epsilon})$&lt;/span&gt;. For scale, if you were not phase sensitive you'd have only needed &lt;span class=&quot;math-container&quot;&gt;$O(N + \lg \frac{1}{\epsilon})$&lt;/span&gt; and the constant factors hiding behind the asymptotic notation would be better.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-04-02T00:03:07.553" LastActivityDate="2021-04-02T00:03:07.553" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16812" PostTypeId="1" CreationDate="2021-04-01T22:48:05.953" Score="0" ViewCount="50" Body="&lt;p&gt;I'm trying to figure out how to transform the SWAP state gate into the square root of SWAP gate using only CNOTs or single qubit gates.&lt;/p&gt;&#xA;&lt;p&gt;As you might guess, I'm new to this whole concept, but I'm having a hard time grasping how I can get a 1 or 0 (values in the SWAP gate matrix) to e^(i pi / 4) that are present in the square root of SWAP matrix.&lt;/p&gt;&#xA;&lt;p&gt;I tried Kronecker product of Pauli Y and Hadamard, but I'm only getting e^(i pi / 2) elements.&lt;/p&gt;&#xA;&lt;p&gt;Any ideas on a simple circuit? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="15403" LastActivityDate="2021-04-01T23:50:24.233" Title="Single qubit gates (or CNOT) sequence to transform SWAP to Sqrt of SWAP" Tags="&lt;quantum-state&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16813" PostTypeId="2" ParentId="16812" CreationDate="2021-04-01T23:50:24.233" Score="1" Body="&lt;p&gt;In cirq, you can get decompositions like this from &lt;code&gt;cirq.two_qubit_matrix_to_operations&lt;/code&gt;. It will use CZs instead of CNOTs, but a few Hadamards around the CZs fixes that.&lt;/p&gt;&#xA;&lt;p&gt;Anyways.&lt;/p&gt;&#xA;&lt;p&gt;This is a swap:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ezKTd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ezKTd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a square-root-of-swap:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eb6Se.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eb6Se.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There's a standard way to decompose a controlled phase rotation into two CNOTs and single qubit phase rotations by half the amount. To do a controlled X rotation you just use that construction but swap the target's X and Z roles:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CpNNm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CpNNm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now there's a CZ next to a CX. This can be fused into a CY with an S on the control (becayse XZ = -iY):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/SYH1P.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SYH1P.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now insert single qubit gates to make all the two qubit gates into CNOTs:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9uSSP.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9uSSP.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lastly you'd fuse some of the single qubit gates, but this depends on your gate set. At the very least you'd combine the T gate and the S^-1 gate into a T^-1 gate because they commute across the control. For a harder challenge, see if you can figure out how to merge the S^-1 in the top right with the X^(1/4) in the top left creating an X^(-1/4) without increasing the number of other gates.&lt;/p&gt;&#xA;&lt;p&gt;It's not possible to perform a square root of swap using fewer than three CNOTs, because the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0507171&quot; rel=&quot;nofollow noreferrer&quot;&gt;KAK decomposition&lt;/a&gt; of the square root of swap has three non-zero coupling coefficients.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-01T23:50:24.233" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16814" PostTypeId="1" AcceptedAnswerId="16847" CreationDate="2021-04-02T00:13:20.583" Score="1" ViewCount="146" Body="&lt;p&gt;The Shor’s 9-qubit code has the following stabilizers&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{S}_1= \hat{Z}_1\hat{Z}_2$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_2= \hat{Z}_2\hat{Z}_3$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_3= \hat{Z}_4\hat{Z}_5$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{S}_4= \hat{Z}_5\hat{Z}_6$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_5= \hat{Z}_7\hat{Z}_8$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_6= \hat{Z}_8\hat{Z}_9$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7= \hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6$&lt;/span&gt; , &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_8= \hat{X}_4\hat{X}_5\hat{X}_6\hat{X}_7\hat{X}_8\hat{X}_9$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it true that error syndrome for qubit 5 phase-flip is the same as that for qubit 6 phase-flip?&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="55" LastEditDate="2021-04-04T17:36:45.810" LastActivityDate="2021-04-04T17:36:45.810" Title="In Shor’s 9-qubit code, is the error syndrome for qubit 5 phase-flip the same as that for qubit 6 phase-flip?" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16815" PostTypeId="1" AcceptedAnswerId="16817" CreationDate="2021-04-02T02:21:37.810" Score="1" ViewCount="30" Body="&lt;p&gt;I have come across several papers that use Toffoli AND conjugate to minimize the T-depth. But since it contains a measurement, does it affect Shor's algorithm (in terms of interference, entanglement, or superposition), when used within the reversed modular multiplication circuit, such as in Vedral et al's implementation?&lt;/p&gt;&#xA;&lt;p&gt;Toffoli AND conjugate (d), &lt;a href=&quot;https://ieeexplore.ieee.org/abstract/document/9259978&quot; rel=&quot;nofollow noreferrer&quot;&gt;source&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/pnl3q.png&quot; alt=&quot;, source\]\[1\]&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Vedral et al's modular exponentiation circuit, source: Nakahara et al's book: &lt;em&gt;Quantum Computing - From Linear Algebra to Physical Realizations&lt;/em&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mld6w.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mld6w.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5911" LastEditorUserId="5911" LastEditDate="2021-04-02T02:27:29.390" LastActivityDate="2021-04-02T02:42:14.107" Title="Does Toffoli AND conjugate affect superposition if used in Shor's algorithm?" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;shors-algorithm&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16816" PostTypeId="2" ParentId="16743" CreationDate="2021-04-02T02:33:27.257" Score="-1" Body="&lt;p&gt;I think I can partially answer my own question. I am able to use &lt;em&gt;ibmq_qasm_simulator&lt;/em&gt; to factor 667 with 23 qubits of a pure QASM circuit under 6,055 seconds. If you can do better, please share your results. I use the simulator to do research on how effective the algorithm really is.&lt;/p&gt;&#xA;" OwnerUserId="9768" LastEditorUserId="9768" LastEditDate="2021-04-02T16:59:34.813" LastActivityDate="2021-04-02T16:59:34.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16817" PostTypeId="2" ParentId="16815" CreationDate="2021-04-02T02:42:14.107" Score="1" Body="&lt;p&gt;No, it doesn't cause problems. These implementations of the operations are exactly equivalent to implementations that don't use measurement. The measurements are carefully chosen to not measure anything affecting the surrounding algorithm, and the classically controlled operations are chosen to correctly repair any kickback effects from the measurement result varying.&lt;/p&gt;&#xA;&lt;p&gt;You can verify this in simulators. For example, &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%5D%2C%5B%22Density2%22%5D%2C%5B%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22Measure%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C%22%E2%80%A2%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%2C%5B%22Density2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;here is a circuit&lt;/a&gt; with state displays showing that the density matrix of two qubits is correctly restored by an uncomputation procedure involving a measurement:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%5D%2C%5B%22Density2%22%5D%2C%5B%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%2C%5B%22%E2%80%A2%22%2C%22%E2%80%A2%22%2C%22X%22%5D%2C%5B1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C%22Measure%22%5D%2C%5B%22%E2%80%A2%22%2C%22Z%22%2C%22%E2%80%A2%22%5D%2C%5B%22Bloch%22%2C%22Bloch%22%5D%2C%5B%22Density2%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hn8fL.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For contrast, here's an operation that's not correctly uncomputed:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tCYVd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tCYVd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-02T02:42:14.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16818" PostTypeId="1" CreationDate="2021-04-02T05:15:43.973" Score="1" ViewCount="93" Body="&lt;p&gt;Related question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16802/does-the-relative-entropy-variance-satisfy-v-rho-ab-rho-a-otimes-rho-b-l/16807?noredirect=1#comment24666_16807&quot;&gt;here&lt;/a&gt; - copying over the definitions.&lt;/p&gt;&#xA;&lt;p&gt;The relative entropy between two quantum states is given by &lt;span class=&quot;math-container&quot;&gt;$D(\rho\|\sigma) = \operatorname{Tr}(\rho\log\rho -\rho\log\sigma)$&lt;/span&gt;. It is known that for any bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; with reduced states &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt;, it holds that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho_{AB}\|\rho_A\otimes\rho_B)\leq D(\rho_{AB}\|\rho_A\otimes\sigma_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for all choices of &lt;span class=&quot;math-container&quot;&gt;$\sigma_B$&lt;/span&gt;. This can be seen by expanding both sides and noting that the relative entropy is nonnegative. Now define the relative entropy variance (see &lt;a href=&quot;https://arxiv.org/pdf/1408.6894.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this reference&lt;/a&gt;, 2.16)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$V(\rho \| \sigma):=\operatorname{Tr} [\rho(\log \rho-\log \sigma)^2]-D(\rho \| \sigma)^{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I would like to understand if this variance satisfies some type of continuity argument in the following sense. Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; be &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; dimensional. I am given that &lt;span class=&quot;math-container&quot;&gt;$\sigma_B\approx_\varepsilon\rho_B$&lt;/span&gt; although this property may not be very useful. Let&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\Delta = D(\rho_{AB}\|\rho_A\otimes\sigma_B) - D(\rho_{AB}\|\rho_A\otimes\rho_B)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is one able to then bound the difference in variances in the following way&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$V(\rho_{AB}\|\rho_A\otimes\rho_B) - V(\rho_{AB}\|\rho_A\otimes\sigma_B) \leq f(\Delta, d)?$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;EDIT: I ran following very simple MATLAB code (requires QETLAB and cvxquad for partial trace, random state generation and computing relative entropy) around 10000 times.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;d = 10; %Dimension of rhoAB&#xA;rhoAB = RandomDensityMatrix(d^2,d^2);&#xA;rhoA = PartialTrace(rhoAB, 2, [d, d]);&#xA;rhoB = PartialTrace(rhoAB, 1, [d, d]);&#xA;sigmaB = RandomDensityMatrix(d,d);&#xA;v1 = trace(rhoAB*(logm(rhoAB) - logm(kron(rhoA, rhoB)))^2) -  quantum_rel_entr(rhoAB, kron(rhoA, rhoB))^2;&#xA;v2 = trace(rhoAB*(logm(rhoAB) - logm(kron(rhoA, sigmaB)))^2) - quantum_rel_entr(rhoAB, kron(rhoA, sigmaB))^2 ;&#xA;conjecture  = 1/sqrt(log(d))*(v1 - v2) &amp;lt;=  quantum_rel_entr(rhoAB, kron(rhoA, sigmaB)) - quantum_rel_entr(rhoAB, kron(rhoA, rhoB));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This suggests that the conjecture&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$V(\rho_{AB}\|\rho_A\otimes\rho_B) - V(\rho_{AB}\|\rho_A\otimes\sigma_B) \leq \Delta\sqrt{\log d}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;holds for the randomly generated states I used without exception so far.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2021-04-06T03:50:54.560" LastActivityDate="2021-04-06T03:50:54.560" Title="Continuity of relative entropy variance" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16819" PostTypeId="1" CreationDate="2021-04-02T05:17:44.000" Score="0" ViewCount="27" Body="&lt;p&gt;I would like to ask if somebody could &lt;strong&gt;suggest me a pair of ligand-Protein&lt;/strong&gt; which had been validated and the corresponding resulting drug is already being used commercially.&lt;/p&gt;&#xA;&lt;p&gt;I am interested in experimenting with this ligand-Protein pair, to reverse engineer the molecular docking procedure using Quantum Computing.&lt;/p&gt;&#xA;" OwnerUserId="15405" LastEditorUserId="55" LastEditDate="2021-04-02T10:58:21.560" LastActivityDate="2021-04-02T10:58:21.560" Title="Molecular Docking using Quantum Computing" Tags="&lt;superconducting-quantum-computing&gt;&lt;chemistry&gt;&lt;openfermion&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16821" PostTypeId="2" ParentId="16800" CreationDate="2021-04-02T13:44:27.053" Score="1" Body="&lt;p&gt;I finally could make it work with&lt;/p&gt;&#xA;&lt;p&gt;qiskit-aqua[cvx]&#xA;qiskit-terra': '0.16.4',&#xA;qiskit-aer': '0.7.6',&#xA;qiskit-ignis': '0.5.2',&#xA;qiskit-ibmq-provider': '0.12.2',&#xA;qiskit-aqua': '0.8.2',&#xA;qiskit': '0.24.1'&lt;/p&gt;&#xA;&lt;p&gt;And by increasing the core and memory.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for all help.&lt;/p&gt;&#xA;&lt;p&gt;Regards,&#xA;Sourav&lt;/p&gt;&#xA;" OwnerUserId="15395" LastActivityDate="2021-04-02T13:44:27.053" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16822" PostTypeId="1" CreationDate="2021-04-02T14:14:53.783" Score="2" ViewCount="81" Body="&lt;p&gt;I am trying to implement the Iterative Phase Estimation algorithm on one of Qiskit's labs. I can do it for a 'nice' phase, such as 1/4 :&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/faJLt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/faJLt.png&quot; alt=&quot;IPE for phi = 1/4&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But if I want to implement the algo generally (as a subroutine for other algorithms, etc), the R_z gates will have to be conditioned on the values of the classical bits I measure (first gate conditioned on c_3 = 1, second gate conditioned on c_3 = 1, third gate conditioned on c_2 = 1).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I know that by the Deferred Measurement Principle, I can get a circuit with the same outcome by changing the conditioned R_z's in some way and measuring everything at the end. The question is how? Is there a general rule / set of principles on how to do this for a given circuit?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm asking for two reasons. First is that if I keep the c_if's, they have to be conditioned on individual bits, which isn't supported by Qiskit unless I go around it by saying that c3 = 1 if c = 4,5,6,7, etc.; and that's just not nice. Second is that I would like to execute the circuit on a real quantum computer and IBM computers don't support c_if.&lt;/p&gt;&#xA;" OwnerUserId="15411" LastActivityDate="2021-04-04T17:44:37.947" Title="Using principle of deferred measurement to replace gates conditional on classical bits (c_if)" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;classical-computing&gt;&lt;quantum-circuit&gt;&lt;deferred-measurement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16823" PostTypeId="1" CreationDate="2021-04-02T14:31:43.083" Score="1" ViewCount="53" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;I haven't seen this done before as tempting as it seems and was wondering if there was some way to disprove the below? In short &lt;strong&gt;can one think of the measurement as the &lt;a href=&quot;http://hitoshi.berkeley.edu/221a/timedependent.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;sudden approximation&lt;/a&gt; (Eq &lt;span class=&quot;math-container&quot;&gt;$84$&lt;/span&gt; onwards or see &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_theorem#Diabatic_passage&quot; rel=&quot;nofollow noreferrer&quot;&gt;wiki&lt;/a&gt;) applied twice&lt;/strong&gt;? I use the notation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(| A \rangle \to | B \rangle ) = \text{Probability of State $|A \rangle $ going to State $|B \rangle$}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And also:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(| A \rangle \to \sum | B \rangle ) = \text{Sum  of probabilities of State A going to one of the eigenstates of the observable of state $|B \rangle$}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Proof&lt;/h2&gt;&#xA;&lt;p&gt;I define the measurement as a short lived interaction &lt;span class=&quot;math-container&quot;&gt;$H_{int}$&lt;/span&gt; produced due to the measurement device.&lt;/p&gt;&#xA;&lt;p&gt;Let the system I am interested in have the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; obeying:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H | E_n \rangle = E_n |E_n \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Hamiltonian of the short lived system (during the measurement) be &lt;span class=&quot;math-container&quot;&gt;$H'= H + H_{int}$&lt;/span&gt; obeying:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H' |E'_n \rangle = E'_n |E'_n \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus we have the following sequence of Hamiltonians:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H \to H' \to H $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let the initial state be &lt;span class=&quot;math-container&quot;&gt;$| \psi \rangle $&lt;/span&gt; then after &lt;span class=&quot;math-container&quot;&gt;$H \to H'$&lt;/span&gt; to find it in say state &lt;span class=&quot;math-container&quot;&gt;$| E' \rangle$&lt;/span&gt; the probability is given by the sudden approximation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(|\psi \rangle \to | E_n' \rangle ) = |\langle E_n' | \psi \rangle|^2  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, again let us assume the final state is &lt;span class=&quot;math-container&quot;&gt;$| \psi' \rangle$&lt;/span&gt; after &lt;span class=&quot;math-container&quot;&gt;$H' \to H$&lt;/span&gt;. Then the probability of us arriving in that state is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(|E_n' \rangle \to |\psi') =  |\langle E_n' | \psi '\rangle|^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence, the probability of going from &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \to |E'_n \rangle \to |\psi' \rangle  $&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P(|\psi \rangle \to |E'_n \rangle \to |\psi' \rangle) =|\langle E_n' | \psi \rangle|^2 |\langle E_n' | \psi '\rangle|^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let's say I repeat the experiment many times and go through all &lt;span class=&quot;math-container&quot;&gt;$E_n'$&lt;/span&gt; and somehow know the outcome &lt;span class=&quot;math-container&quot;&gt;$|\psi' \rangle$&lt;/span&gt; but not the intermediate &lt;span class=&quot;math-container&quot;&gt;$E'_n$&lt;/span&gt;. Then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(|\psi \rangle \to \sum |E'_n \rangle \to |\psi' \rangle) = \sum_{n} | \langle \psi' |E'_n \rangle \langle E'_n | \psi \rangle|^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Using triangle inequality and &lt;span class=&quot;math-container&quot;&gt;$\sum_n |E'_n \rangle \langle E'_n | = \hat 1 $&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(|\psi \rangle \to \sum | E'_n \rangle \to |\psi' \rangle) = |\langle \psi | \psi' \rangle |^2 + c(\psi \to \psi') \geq | \sum_n \langle \psi | E'_n  \rangle \langle E'_n | \psi ' \rangle |^2  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is a constant:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ c(\psi  \to \psi') = \sum_{i \neq j} \langle \psi  | E_i \rangle \langle E_j | \psi ' \rangle \langle E_j | \psi \rangle \langle  \psi ' | E_i \rangle  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now let's say we do the experiment many times and include all possible final outcomes of &lt;span class=&quot;math-container&quot;&gt;$| \psi ' \rangle $&lt;/span&gt;. Then what happens to &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{\psi'} c(\psi  \to \psi') =  \sum_{i \neq j} \sum_{\psi'} \langle \psi  | E_i \rangle \langle E_j | \psi ' \rangle \langle E_j | \psi \rangle \langle  \psi ' | E_i \rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But since &lt;span class=&quot;math-container&quot;&gt;$\sum_{'} |\psi' \rangle \langle \psi' | = \hat 1$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \sum_{\psi'} c(\psi  \to \psi') =  \sum_{i \neq j} \langle \psi  | E_i \rangle  \langle E_j | \psi \rangle \delta_{ij} = 0$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hence,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P(|\psi \rangle \to \sum | E'_n \rangle \to \sum |\psi' \rangle) = | \langle \psi | \psi' \rangle |^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Edit&lt;/h2&gt;&#xA;&lt;p&gt;After going through the derivation of &lt;a href=&quot;https://en.wikipedia.org/wiki/Adiabatic_theorem#Diabatic_passage&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;. It seems indeed the Born Rule itself is used to derive the didactic/sudden approximation. Precisely when the wikipedia page where it defines the parameter &lt;span class=&quot;math-container&quot;&gt;$\zeta$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;To determine the validity of the adiabatic approximation for a given process, one can calculate the probability of finding the system in a state other than that in which it started.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \zeta = \underbrace{\langle 0 | U^\dagger (t_1 ,t_0) U (t_1 ,t_0) | 0\rangle}_{1} - \underbrace{\langle 0 | U^\dagger (t_1, t_0) | 0 \rangle  \langle 0 | U (t_1, t_0) | 0 \rangle}_{\text{Probability of finding state in $|0 \rangle$ after time evolution $t_1-t_0$}}   $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unless, there is some other way to get this result. In light of this I would like to ask if &lt;strong&gt;this is a valid way to model the measurement&lt;/strong&gt; (as a consequence of double sudden approximations).&lt;/p&gt;&#xA;" OwnerUserId="5045" LastEditorUserId="5045" LastEditDate="2021-04-02T18:36:35.113" LastActivityDate="2021-04-02T18:36:35.113" Title="Born rule as the sudden approximation applied twice?" Tags="&lt;measurement&gt;" AnswerCount="0" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="16825" PostTypeId="1" CreationDate="2021-04-02T14:59:01.903" Score="0" ViewCount="40" Body="&lt;p&gt;New user here. I tried to run a test circuit which I submitted to ibmq_santiago to run, but now I cannot see my results. No histogram, no circuit, only the status timeline. I believe the problem is that my antivirus recognizes this URL as blacklisted and cancels the connection, because that's the message I get every time I try to view my results, but I don't get why it would do that. Has anyone had this problem before?&lt;/p&gt;&#xA;" OwnerUserId="15412" LastEditorUserId="55" LastEditDate="2021-04-05T21:28:56.340" LastActivityDate="2021-04-05T21:28:56.340" Title="I can't see the results of my of my jobs" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16827" PostTypeId="2" ParentId="16825" CreationDate="2021-04-02T16:20:21.767" Score="1" Body="&lt;p&gt;As @Lena mentioned in the comment, you can use the alternative route that I proposed in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16677/9858&quot;&gt;this question&lt;/a&gt;. But since it seems you also wanted to extract the circuit(s), you can add the following line: (Note that you can have more than 1 circuit in your job, hence more than 1 histogram plot)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for circuit in job.circuits():&#xA;    print(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So the complete script would be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;from qiskit.visualization import plot_histogram&#xA;%matplotlib inline&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_santiago')&#xA;job = backend.retrieve_job('ENTER JOB_ID HERE')&#xA;for circuit in job.circuits(): #viewing all the circuit in your job submission. &#xA;    print(circuit)&#xA;&#xA;counts = [job.result().get_counts()[i] for i in range(4) ] &#xA;plot_histogram(counts[0], color='black', title=&amp;quot;Result&amp;quot;) #pick the histogram correspond to the circuit that you want to view&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-02T16:20:21.767" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16828" PostTypeId="1" AcceptedAnswerId="16830" CreationDate="2021-04-02T18:57:54.340" Score="0" ViewCount="23" Body="&lt;p&gt;I want to write the Jaynes-Cumming Hamiltonian in QuTip.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = \hbar \omega_{C} a^\dagger a + \frac12 \hbar \omega_{a} \sigma_{z} + \hbar \lambda (\sigma_{+} a + \sigma_{-} a^\dagger)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I assume &lt;span class=&quot;math-container&quot;&gt;$\hbar = 1$&lt;/span&gt;, and we know &lt;span class=&quot;math-container&quot;&gt;$a, a^\dagger$&lt;/span&gt; are the field (cavity) operators, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}, \sigma_{+}, \sigma_{-}$&lt;/span&gt; are the atomic operators; and they commute. &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; is the coupling constant.&lt;/p&gt;&#xA;&lt;p&gt;I assume that the # of Fock basis states that I choose is &lt;code&gt;N&lt;/code&gt;. Now, to write the Hamiltonian using qutip I would use the following statements,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;: &lt;code&gt;a = tensor(qeye(2), destroy(N))&lt;/code&gt; &lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$a^\dagger$&lt;/span&gt;: &lt;code&gt;a.dag()&lt;/code&gt; &lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$a^\dagger a$&lt;/span&gt;: &lt;code&gt;a.dag() * a&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma_{z}$&lt;/span&gt;: &lt;code&gt;sz = tensor(sigmaz(), qeye(N))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sigma_{+} a$&lt;/span&gt;: &lt;code&gt;sp = tensor(sigmap(), qeye(N)) * a&lt;/code&gt; &lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sigma_{-} a^\dagger$&lt;/span&gt;: &lt;code&gt;sp.dag()&lt;/code&gt; &lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sigma_{+} a + \sigma_{-} a^\dagger$&lt;/span&gt;: &lt;code&gt;sp + sp.dag()&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;But in the QuTip documentation the interaction term has been written as,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;sm = tensor(destroy(2), qeye(N)); Hint = a.dag() * sm + a * sm.dag()&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Could someone explain why they use the previous statement but not the one I would have assumed?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15415" LastEditorUserId="55" LastEditDate="2021-04-04T17:57:48.367" LastActivityDate="2021-04-04T17:57:48.367" Title="Writing the Jaynes-Cumming model in QuTip" Tags="&lt;programming&gt;&lt;qutip&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16830" PostTypeId="2" ParentId="16828" CreationDate="2021-04-02T19:36:16.063" Score="1" Body="&lt;p&gt;Usually we say &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is the ground state and is at the north pole, but sometimes people choose the convention that since the north pole is ``higher&amp;quot; than the south pole on the Bloch sphere, that &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; should be the excited state instead.  Thus, the qubit raising operator (with basis ordering &lt;span class=&quot;math-container&quot;&gt;$|0\rangle, |1\rangle$&lt;/span&gt;) is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sigma_+ = \begin{bmatrix} 0 &amp;amp; 1 \\ 0 &amp;amp; 0 \end{bmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;which actually looks like the lowering operator in the first convention.  QuTiP is treating the qubit as a two-level oscillator (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is ground), and you are using &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; as excited.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2021-04-02T20:00:27.887" LastActivityDate="2021-04-02T20:00:27.887" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16831" PostTypeId="2" ParentId="16795" CreationDate="2021-04-02T21:07:37.177" Score="2" Body="&lt;p&gt;&amp;quot;Can gate set tomography be applied to a quantum channel&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Yes, because gates are just unitary channels, if you wanted you could just let a qubit idle and undergo decay/dephasing processes instead of logic gates, and still perform whatever tomography you want.  In general, any ideal unitary is actually a channel because gates aren't perfect (see equation 1, page 5 of the paper you linked).&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;or multiple quantum channels&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;Gate set tomography by definition produces a self-consistent estimation of a set of gates, and since gates are physically just channels, then, yes, GST can estimate multiple channels.  And thus, the same advantages (i.e. the &amp;quot;only&amp;quot; advantages) still apply.&lt;/p&gt;&#xA;&lt;p&gt;&amp;quot;Would GST be advantageous over QPT in some scenarios?&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;The main advantage of GST over QPT is that GST is self-consistent, in the following sense.  Imagine that you want to characterize the bit-flip gate, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.  So you use QPT, and prepare a complete set of input states, and measurement in a complete output basis, to reconstruct the process map of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.  Mathematically, this is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;p_{ij} = Tr(M_i X(\rho_j))&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$X(\cdot)$&lt;/span&gt; denotes the real channel &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; that occurs when you try to run the ideal unitary gate &lt;span class=&quot;math-container&quot;&gt;$X_{ideal}$&lt;/span&gt;.  We estimate the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_{ij}$&lt;/span&gt; from our measurements, and must assume prior knowledge of &lt;span class=&quot;math-container&quot;&gt;$\rho_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; so that the only unknown is &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.  One of the states in your complete input set is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, which you can prepare from a fixed &amp;quot;fiducial&amp;quot; state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; by applying &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.  But wait, you assumed perfect knowledge of all input states, and thereby &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, but you were intending to characterize &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; from the beginning, which means that you don't actually know it... right?&lt;/p&gt;&#xA;&lt;p&gt;In reality, people usually assume known input states and measurement operators (and even assume that they are perfect) to constrain &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, even though it is logically inconsistent.  For example, if your state preparation is bad, and you can only prepare &lt;span class=&quot;math-container&quot;&gt;$\rho_0 = p|0\rangle\langle 0| + (1-p)\rho_{bad}$&lt;/span&gt;, then assuming your fiducial state is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; will cause your estimate of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to be bad, not because your gate itself is bad, but because other error in your system will be misattributed to &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.  GST estimates the fiducial initial state and final measurement (i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M_0$&lt;/span&gt;) along with a whole set of gates.  The pro is the self-consistency just described.  The con is that everything is sort of &amp;quot;set&amp;quot; dependent, in that if you tell me your &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate, you should also tell me the rest of the GST output, since they are all characterized together, and thus are only defined relative to each other.  Moreover, two different researchers comparing their gates is actually not well-defined since they have no way of knowing whether they are in the same gauge or not, as Eq. 26 page 10 explains.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2021-04-04T12:02:14.743" LastActivityDate="2021-04-04T12:02:14.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16832" PostTypeId="1" AcceptedAnswerId="16865" CreationDate="2021-04-03T06:36:39.407" Score="4" ViewCount="91" Body="&lt;p&gt;I have a question about the two equations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Any matrix in &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; could be parametrized as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_{\hat{n}}(\theta) = \cos\left(\frac{\theta}{2}\right)I-i\sin\left(\frac{\theta}{2}\right)(\hat{n}\cdot\vec\sigma)&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;And the &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; gate in qiskit is defined as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_3(\gamma,\beta,\delta) =&#xA;\begin{bmatrix} &#xA;\cos\left(\frac{\gamma}{2}\right) &amp;amp; -e^{i\delta} \sin\left(\frac{\gamma}{2}\right) \\&#xA;e^{i\beta} \sin\left(\frac{\gamma}{2}\right) &amp;amp; e^{i(\delta + \beta)} \cos\left(\frac{\gamma}{2}\right)&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For the first equation, I think the &lt;span class=&quot;math-container&quot;&gt;$\theta/2$&lt;/span&gt; term is kind of relevant to the Dirac belt trick:  the electron spin state will negate under a &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt; rotation, so &lt;span class=&quot;math-container&quot;&gt;$4\pi$&lt;/span&gt; will return to the original state. For the second equation, on the other hand, I think &lt;span class=&quot;math-container&quot;&gt;$\gamma/2$&lt;/span&gt; is because on the Bloch sphere it looks like &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; are on the same line pointing toward the opposite directions, but they're orthogonal states. I'm wondering if there're any connections between the two cases when we divide &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; by 2. Thanks!!&lt;/p&gt;&#xA;&lt;p&gt;PS: In my understanding, &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; refers to the angle of rotation along the axis &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt; following the right-hand rule, and &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; here is the included angle of &lt;span class=&quot;math-container&quot;&gt;$\hat n$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt;-axis in the spherical coordinate.&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="8623" LastEditDate="2021-04-05T14:19:45.797" LastActivityDate="2021-04-05T17:10:41.893" Title="Are these two 'divided by two' terms related?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16834" PostTypeId="2" ParentId="16822" CreationDate="2021-04-03T08:55:13.700" Score="2" Body="&lt;p&gt;If you use deferred measurement, you will end up with a circuit that has same depth and width as the original PE algorithm.&#xA;And you will lose one of the main adventages of IPE algorithm; its robustness in the presence of gate errors.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;First is that if I keep the c_if's, they have to be conditioned on individual bits, which isn't supported by Qiskit unless I go around it by saying that c3 = 1 if c = 4,5,6,7, etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You can use an array of classical registers:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cregs = []&#xA;for m in range(N):&#xA;    cregs.append(ClassicalRegister(1, 'b' + str(m)))&#xA;    qc.add_register(cregs[m])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This way the conditions will be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;c_if(cregs[k], 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And if you want to use it as a subroutine, you can load the content of these registers into a quantum register:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for m in range(N):&#xA;    qc.x(qr[m]).c_if(cregs[N - m - 1], 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Please note that, many algorithms which use PE as a subroutine (e.g., HHL) depend the fact that if the input to it is a superposition of eigenstates, its output will be a superposition of the eigenvalues.&#xA;This feature is not supported by IPE.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;According to the principle of deferred measurement, measuring commutes with conditioning. That means measuring a qubit then conditioning on the measurement result is equivalent to conditioning on the qubit value then measuring it.&lt;/p&gt;&#xA;&lt;p&gt;In our case, to apply the principle of deferred measurement, you need to copy the output to another qubit set to &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; using a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate.&#xA;This new qubit can be used to control the conditioned operations instead of using c_if.&#xA;At the end, measure this qubit to get its value.&#xA;In your case you need to introduce two qubits as the last measurement is done at the end already.&lt;/p&gt;&#xA;&lt;p&gt;Note that, reset operation is implemented in IBM Quantum systems as &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-gate conditioned on the measurement outcome of the qubit (&lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/systems/reset/backend_reset&quot; rel=&quot;nofollow noreferrer&quot;&gt;see here&lt;/a&gt;).&#xA;That means there is a measurement &amp;quot;hidden&amp;quot; in each reset operation and you have to replace it with a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; conditioned on the previously introduced qubit.&lt;/p&gt;&#xA;&lt;p&gt;The resulting circuit will be something like that except I used Phase gate instead of repeated T-gate.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/DfALy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/DfALy.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2021-04-04T17:44:37.947" LastActivityDate="2021-04-04T17:44:37.947" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16835" PostTypeId="2" ParentId="15710" CreationDate="2021-04-03T09:11:12.273" Score="1" Body="&lt;p&gt;tl;dr section II.E of &lt;a href=&quot;https://arxiv.org/pdf/cond-mat/0610433.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The way the gate electrode works is that a conducting metal layer is fabricated in proximity to the dot, with some dielectric separating the two so that charge cannot actually flow between them.  Applying a voltage to the electrode can load it with many electrons, creating an electric field through the dielectric and onto the dot, which adds a constant energy to the entire level structure of the dot.&lt;/p&gt;&#xA;&lt;p&gt;One particular use of this is explained in section II.E of the paper I linked, called the Coulomb blockade.  The chemical potential says how the energy of the dot changes if an electron is added to the dot.  In the image, each level &lt;span class=&quot;math-container&quot;&gt;$\mu(N)$&lt;/span&gt; is the ground-state energy of the dot when there are &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; electrons in the dot (you have discrete levels because the dot is so small that it behaves like a circular well from QM).  What we want to make is a single-electron transistor, where when I apply a certain voltage, current can flow from the source to the drain, one electron at a time.  For this to happen spontaneously, we would need &lt;span class=&quot;math-container&quot;&gt;$\mu_S &amp;gt; \mu_{dot} &amp;gt; \mu_{D}$&lt;/span&gt; so that we promote tunneling through the first and second barriers.  By biasing the dot just right, we create a situation where when one electron tunnels, the chemical potential &lt;span class=&quot;math-container&quot;&gt;$\mu(N)$&lt;/span&gt; lies between &lt;span class=&quot;math-container&quot;&gt;$\mu_S$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mu_D$&lt;/span&gt; as desired, but a second electron cannot tunnel because the next dot level is too high, so tunneling is suppressed.  Whenever the first electron tunnels out to the drain, the dot level drops so that another electron can replenish the dot.  Sweeping the gate voltage which periodically cause the dot level for a certain number of electrons to be &amp;quot;just right&amp;quot;, so that you get periodic spikes in the current, as shown.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/H5ERQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/H5ERQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-04-03T09:11:12.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16836" PostTypeId="2" ParentId="16832" CreationDate="2021-04-03T11:10:35.903" Score="2" Body="&lt;p&gt;With &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec\sigma = \begin{bmatrix}\begin{bmatrix}0 &amp;amp; -i\\ i &amp;amp;0 \end{bmatrix}\begin{bmatrix} 0 &amp;amp; -1 \\1 &amp;amp; 0\end{bmatrix}\begin{bmatrix}-1 &amp;amp; 0 \\ 0 &amp;amp; -1 \end{bmatrix} \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;For the first equation I like to think that defining the formula with &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}$&lt;/span&gt; is a nice way to have a direct understanding of the effect on the Bloch sphere.&lt;br /&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$\hat{n}=[1\space 0\space 0]$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\theta) =R_X(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_X(\theta)$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; rotation around the X axis of the Bloch Sphere.&lt;br /&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$\hat{n}=[0\space 1\space 0]$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\theta) =R_Y(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_Y(\theta)$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; rotation around the Y axis of the Bloch Sphere.&lt;br /&gt;&#xA;if &lt;span class=&quot;math-container&quot;&gt;$\hat{n}=[0\space 0\space 1]$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\theta) =R_Z(\theta)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$R_Z(\theta)$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; rotation around the Z axis of the Bloch Sphere.&lt;/p&gt;&#xA;&lt;p&gt;Essentially &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\theta)$&lt;/span&gt; is a generalization of the rotation matrix hence the need of &lt;span class=&quot;math-container&quot;&gt;$\frac{\theta}{2}$&lt;/span&gt;. Another nice consequence is that for the Pauli gates &lt;span class=&quot;math-container&quot;&gt;$X=R_X(\pi)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Y=R_Y(\pi)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z=R_Z(\pi)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the second equation the reasoning is essentially the same.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; is a generalization of the &lt;span class=&quot;math-container&quot;&gt;$R_\phi$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates and defining it with &lt;span class=&quot;math-container&quot;&gt;$\frac{\gamma}{2}$&lt;/span&gt; allows to have this nice identities that links to the axis rotation matrix.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_3(\gamma,0,\pi/2) = R_X(\gamma)$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_3(\gamma,0,0) = R_Y(\gamma)$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$U_3(0,0,\delta) = R_\phi(\delta)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Remark : There is no relation between &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-states/single-qubit-gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-states/single-qubit-gates.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="4947" LastEditorUserId="4947" LastEditDate="2021-04-03T11:16:46.300" LastActivityDate="2021-04-03T11:16:46.300" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16837" PostTypeId="2" ParentId="16718" CreationDate="2021-04-03T15:04:36.913" Score="1" Body="&lt;p&gt;With the help of Craig Gidney and some others, I was able to pin down the procedure to calculate the entropy. Here are the steps.&lt;/p&gt;&#xA;&lt;h1&gt;Create your circuit with a stabilizer simulator&lt;/h1&gt;&#xA;&lt;p&gt;This can be done with whatever simulator you want. As Craig mentioned in his answer, &lt;a href=&quot;https://github.com/quantumlib/Stim&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stim&lt;/a&gt; is a great tool for the job. The rest of the answer in this section will assume you're using Stim, but it's not required.&lt;/p&gt;&#xA;&lt;p&gt;Your code will look something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import stim&#xA;&#xA;# Define your circuit here&#xA;circuit = stim.TableauSimulator()&#xA;...&#xA;&#xA;# Create the tableau representation&#xA;tableau = circuit.current_inverse_tableau() ** -1&#xA;zs = [tableau.z_output(k) for k in range(len(tableau))]&#xA;zs = np.array(zs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What you get with &lt;code&gt;tableau&lt;/code&gt; is a set of &lt;code&gt;stim.PauliString&lt;/code&gt; objects, which are essentially your &amp;quot;stabilizers&amp;quot; and &amp;quot;destabilizers&amp;quot;, to use the language of &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406196v5&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson's paper&lt;/a&gt; on page 4. For the purposes of the entropy, we only care about the stabilizers, which are given by the &lt;code&gt;zs&lt;/code&gt; object that we define here.&lt;/p&gt;&#xA;&lt;p&gt;Essentially, a quantum circuit starts in the product state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle^{\otimes N}$&lt;/span&gt;, and then gates transform the state. The idea is that the stabilizer generators for this initial state is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;g_1 = Z_1 \equiv Z \otimes \mathbb{1} \otimes \mathbb{1} \otimes \ldots \otimes \mathbb{1}, \\&#xA;g_2 = Z_2 \equiv \mathbb{1} \otimes Z \otimes \mathbb{1} \otimes \ldots \otimes \mathbb{1},&#xA;\end{equation}&lt;/span&gt;&#xA;and so on until the end. If we have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits, there will be exactly &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt; stabilizers. However, it's super important to note that these are &lt;em&gt;not&lt;/em&gt; identified with certain qubits. For example, stabilizer &lt;span class=&quot;math-container&quot;&gt;$g_1$&lt;/span&gt; is not identified with the first qubit (this tripped me up for a bit, so I wanted to note it).&lt;/p&gt;&#xA;&lt;p&gt;The way Stim stores the stabilizers is the following: &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; means an identity, &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; means an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator, &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; means a &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; operator, and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; means a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operator. This is because of the binary notation.&lt;/p&gt;&#xA;&lt;p&gt;To get into the actual form of the tableau matrix, we need to make a &lt;span class=&quot;math-container&quot;&gt;$N \times 2N$&lt;/span&gt; matrix, with the left &lt;span class=&quot;math-container&quot;&gt;$N \times N$&lt;/span&gt; block being for the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operators and the right block for the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operators.&lt;/p&gt;&#xA;&lt;p&gt;So you can just write a little function like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def binaryMatrix(zStabilizers):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;        - Purpose: Construct the binary matrix representing the stabilizer states.&#xA;        - Inputs:&#xA;            - zStabilizers (array): The result of conjugating the Z generators on the initial state.&#xA;        Outputs:&#xA;            - binaryMatrix (array of size (N, 2N)): An array that describes the location of the stabilizers in the tableau representation.&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    N = len(zStabilizers)&#xA;    binaryMatrix = np.zeros((N,2*N))&#xA;    r = 0 # Row number&#xA;    for row in zStabilizers:&#xA;        c = 0 # Column number&#xA;        for i in row:&#xA;            if i == 3: # Pauli Z&#xA;                binaryMatrix[r,N + c] = 1&#xA;            if i == 2: # Pauli Y&#xA;                binaryMatrix[r,N + c] = 1&#xA;                binaryMatrix[r,c] = 1&#xA;            if i == 1: # Pauli X&#xA;                binaryMatrix[r,c] = 1&#xA;            c += 1&#xA;        r += 1&#xA;&#xA;    return binaryMatrix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, we're ready to calculate the entropy.&lt;/p&gt;&#xA;&lt;h1&gt;Calculating the entropy of a cut&lt;/h1&gt;&#xA;&lt;p&gt;Now that we have the matrix corresponding to the evolved quantum state through the circuit, we want to find the entanglement entropy. In &lt;a href=&quot;https://arxiv.org/abs/1901.08092&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, the key equation is Equation A19, but the real helpful comment I found on this was on Footnote 11 of &lt;a href=&quot;https://arxiv.org/abs/1608.06950&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (page 10), which says how to do this numerically. I also communicated with one of the authors (Xiao Chen) from the other paper here, and his comments were also quite helpful.&lt;/p&gt;&#xA;&lt;p&gt;Our system involves &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits, and now we want to find the entanglement entropy between two subsystems, which we will label &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Equation A19 of the paper I referenced above tells us:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\label{eq:Entropy}&#xA;S_A = \text{rank}\left( \text{projection}_A \mathcal{S} \right) - N_A. &#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this equation, &lt;span class=&quot;math-container&quot;&gt;$N_A$&lt;/span&gt; is the number of qubits in part &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; is the set of stabilizers (our binary matrix we got above), and the projection operator means we want to &amp;quot;truncate&amp;quot; the matrix so that it's only describing the parts on &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To do this, remember that our matrix starts off as &lt;span class=&quot;math-container&quot;&gt;$N \times 2N$&lt;/span&gt;. We now want to truncate it so that we don't care about the qubits in region &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;. Mathematically, this is what the projection operator does. It pretends everything in region &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is the identity, which in our matrix means the entries become zero.&lt;/p&gt;&#xA;&lt;p&gt;But a simpler way to deal with this is to just &lt;em&gt;delete&lt;/em&gt; the columns needed to describe region &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, since they won't play a role anyway. Numerically, the following function does the trick:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def getCutStabilizers(binaryMatrix, cut):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;        - Purpose: Return only the part of the binary matrix that corresponds to the qubits we want to consider for a bipartition.&#xA;        - Inputs:&#xA;            - binaryMatrix (array of size (N, 2N)): The binary matrix for the stabilizer generators.&#xA;            - cut (integer): Location for the cut.&#xA;        - Outputs:&#xA;            - cutMatrix (array of size (N, 2cut)): The binary matrix for the cut on the left.&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    N = len(binaryMatrix)&#xA;    cutMatrix = np.zeros((N,2*cut))&#xA;&#xA;    cutMatrix[:,:cut] = binaryMatrix[:,:cut]&#xA;    cutMatrix[:,cut:] = binaryMatrix[:,N:N+cut]&#xA;&#xA;    return cutMatrix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This truncates our original &lt;span class=&quot;math-container&quot;&gt;$N \times 2N$&lt;/span&gt; matrix into a &lt;span class=&quot;math-container&quot;&gt;$N \times 2N_A$&lt;/span&gt; matrix, with everything else deleted.&lt;/p&gt;&#xA;&lt;p&gt;Now, the equation for the entropy simply requires us to compute the rank of this matrix, and subtract off the number of qubits in region &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Numerically, you can do this using Gaussian elimination with Boolean variables (in others worlds, modulo 2 arithmetic), but you can also use just a plain old SVD over real variables to get the rank.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I made a mistake in saying that a regular SVD calculation will work. For reference, I was using the &lt;a href=&quot;https://numpy.org/doc/stable/reference/generated/numpy.linalg.matrix_rank.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix_rank&lt;/a&gt; function from NumPy. After comparing it with another approach, it seems like it &lt;em&gt;mostly&lt;/em&gt; works, but is sometimes off. As such, I'd recommend doing Gaussian elimination, with something like &lt;a href=&quot;https://stackoverflow.com/a/56858995/&quot;&gt;this&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;After that, you should be good to go. The entropy is essentially a matrix rank computation. Also note that you can use whatever stabilizer circuit simulator you like, as long as in the end you get out the stabilizer generators which you can then build your binary matrix from.&lt;/p&gt;&#xA;" OwnerUserId="1923" LastEditorUserId="1923" LastEditDate="2021-04-11T13:41:45.140" LastActivityDate="2021-04-11T13:41:45.140" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16838" PostTypeId="1" AcceptedAnswerId="16839" CreationDate="2021-04-03T15:31:44.130" Score="2" ViewCount="128" Body="&lt;p&gt;I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:By just using matrix manipulation, how do I get the unitary matrix of the circuit below by just using numpy and normal matrix properties?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7tYiE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7tYiE.png&quot; alt=&quot;Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The result should equal this:&lt;/p&gt;&#xA;&lt;p&gt;[[1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;/p&gt;&#xA;&lt;p&gt;[0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]]&lt;/p&gt;&#xA;&lt;h1&gt;I tried doing the following but it did not result in the correct Unitary matrix&lt;/h1&gt;&#xA;&lt;pre&gt;&lt;code&gt;swapcnot = np.array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]])&#xA;&#xA;layer1 = np.kron( swapcnot,np.eye(2) ) &#xA;&#xA;layer2 = np.kron( np.eye(2),swapcnot ) &#xA;&#xA;print( np.matmul(layer2,layer1) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1&gt;The result:&lt;/h1&gt;&#xA;&lt;p&gt;[[1. 0. 0. 0. 0. 0. 0. 0.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 0. 0. 0. 0. 0. 0. 1.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 0. 0. 0. 0. 0. 1. 0.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 1. 0. 0. 0. 0. 0. 0.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 0. 0. 0. 1. 0. 0. 0.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 0. 0. 1. 0. 0. 0. 0.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 0. 1. 0. 0. 0. 0. 0.]&lt;/p&gt;&#xA;&lt;p&gt;[0. 0. 0. 0. 0. 1. 0. 0.]]&lt;/p&gt;&#xA;" OwnerUserId="15422" LastEditorUserId="55" LastEditDate="2021-04-04T17:35:57.390" LastActivityDate="2021-04-04T17:35:57.390" Title="How do I get the Unitary matrix of a circuit without using the 'unitary_simulator'?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;unitarity&gt;&lt;python&gt;" AnswerCount="4" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16839" PostTypeId="2" ParentId="16838" CreationDate="2021-04-03T16:18:16.753" Score="1" Body="&lt;p&gt;For the first layer of your circuit, compute the tensor product between the unitary matrix of the (swapped) CNOT gate and the identity matrix (using numpy's kron()).&#xA;Do a similar operation for the second layer.&#xA;You will obtain two 8x8 matrices.&#xA;Then multiply them using numpy's matmul().&lt;/p&gt;&#xA;&lt;p&gt;Here you have the working code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;swapcnot = np.array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]])&#xA;&#xA;layer1 = np.kron(np.eye(2),swapcnot )&#xA;&#xA;layer2 = np.kron( swapcnot, np.eye(2) )&#xA;&#xA;print( np.matmul(layer2,layer1) )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[1. 0. 0. 0. 0. 0. 0. 0.]&#xA;[0. 0. 0. 1. 0. 0. 0. 0.]&#xA;[0. 0. 0. 0. 0. 0. 1. 0.]&#xA;[0. 0. 0. 0. 0. 1. 0. 0.]&#xA;[0. 0. 0. 0. 1. 0. 0. 0.]&#xA;[0. 0. 0. 0. 0. 0. 0. 1.]&#xA;[0. 0. 1. 0. 0. 0. 0. 0.]&#xA;[0. 1. 0. 0. 0. 0. 0. 0.]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="5551" LastEditorUserId="5551" LastEditDate="2021-04-04T06:46:16.730" LastActivityDate="2021-04-04T06:46:16.730" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="16840" PostTypeId="2" ParentId="16838" CreationDate="2021-04-03T16:41:14.947" Score="1" Body="&lt;p&gt;It seems you need the &lt;code&gt;Operator&lt;/code&gt; class, from the &lt;code&gt;quantum_info&lt;/code&gt; module:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;circuit.cx(0, 1)&#xA;circuit.cx(1, 2)&#xA;circuit.draw('latex')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gfjio.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gfjio.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Operator&#xA;from qiskit.visualization.array import array_to_latex&#xA;&#xA;array_to_latex(Operator(circuit))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1  \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; \end{bmatrix}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-04-03T16:41:14.947" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16841" PostTypeId="2" ParentId="5431" CreationDate="2021-04-03T17:29:52.107" Score="4" Body="&lt;p&gt;I did not thought much about that issue, so my answer may not be the best one, but it has the advantage of being quite simple to understand, it is exact even if you restrict yourself to Clifford+T, and can be generalized to more complicated relations. On the other side, this is not a unitary process because you need to repeat it a polynomial number of times until you get your expected states (see other answers if you want to have a unitary process).&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$k = \lceil\log N\rceil$&lt;/span&gt; be the smallest number of bits used to represent &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Then, you create the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{x =0}^{2^k-1} |x\rangle$$&lt;/span&gt;&#xA;by applying &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; Hadamard gates on &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; states initialized to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Then, if we define &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$x &amp;lt; N$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$f(x)=0$&lt;/span&gt; otherwise (here you can put any relation you like depending on the states you are interested in, you just want to have a constant fraction of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt; to ensure the algorithm is efficient, which is the case here because at least half of the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; have this property by definition of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;). Then, you add one auxiliary qubit, and you apply the unitary associated to &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; (which is &lt;span class=&quot;math-container&quot;&gt;$U_f |x\rangle|b\rangle =|x\rangle|b \oplus f(x)\rangle$&lt;/span&gt; and can be done with Clifford+T operations) in order to obtain the state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{x=0}^{2^k-1}|x\rangle |f(x)\rangle$$&lt;/span&gt;&#xA;Then, you measure this second register. If you obtain a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, the state you obtain is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{x \in \{x \mid f(x)=1\}} |x\rangle = \sum_{x = 0}^{N-1} |x\rangle$$&lt;/span&gt;&#xA;(so you have the expected state) Otherwise, you start again from scratch (the probability to obtain the expected state depends on the fraction of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;. In our case, this is lower bounded by &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; by definition of &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; so you need to repeat it only a few times before you succeed)&lt;/p&gt;&#xA;" OwnerUserId="5969" LastEditorUserId="5969" LastEditDate="2021-04-13T08:43:38.287" LastActivityDate="2021-04-13T08:43:38.287" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16842" PostTypeId="2" ParentId="16838" CreationDate="2021-04-03T17:34:19.327" Score="1" Body="&lt;p&gt;The following script does the work, but it is based on the &lt;strong&gt;statevector_simulator&lt;/strong&gt;. I do not know if it is part of what you want to avoid using.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;from qiskit import QuantumCircuit, Aer&#xA;import numpy as np&#xA;&#xA;#We need the statevector simulatro in this case&#xA;simulator = Aer.get_backend('statevector_simulator')&#xA;&#xA;#Any circuit you want to analyse&#xA;qc = QuantumCircuit(3)&#xA;qc.cx(0,1)&#xA;qc.cx(1,2)&#xA;&#xA;#Setting up unitary matrix&#xA;for reg in qc.qregs:&#xA;    nbits=len(reg)&#xA;H = np.zeros((2**nbits, 2**nbits), dtype=complex)&#xA;&#xA;#Control quantum circuit&#xA;qc_test = QuantumCircuit(nbits)&#xA;#testing all initialize vector and filling up H&#xA;for i in range(2**nbits):&#xA;    init=list(range(2**nbits))&#xA;    for j in range(2 ** nbits):&#xA;        init[j]=0&#xA;    init[i]=1&#xA;    qc_test.initialize(init, range(nbits))&#xA;    qc_last = qc_test + qc&#xA;    result = qiskit.execute(qc_last, simulator).result()&#xA;    statevector = result.get_statevector()&#xA;    for j in range(2 ** nbits):&#xA;        H[j,i]=statevector[j]&#xA;#Printing desired output&#xA;print(H)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In your case the output is :&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[[1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;br /&gt;&#xA;[0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;br /&gt;&#xA;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j]&lt;br /&gt;&#xA;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j]&lt;br /&gt;&#xA;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;br /&gt;&#xA;[0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j]&lt;br /&gt;&#xA;[0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&lt;br /&gt;&#xA;[0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you really need to &lt;strong&gt;avoid using any simulator&lt;/strong&gt; you can try using the following : (I have not coded the permutation part, which is the complex part I would say)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;from qiskit import QuantumCircuit, Aer&#xA;import numpy as np&#xA;&#xA;#Any circuit you want to analyse&#xA;qc = QuantumCircuit(3)&#xA;qc.cx(1,0)&#xA;qc.cx(1,2)&#xA;&#xA;for reg in qc.qregs:&#xA;    nbits=len(reg)&#xA;H = np.identity(2**nbits, dtype=complex)&#xA;Htmp = np.identity(2**nbits, dtype=complex)&#xA;#This part will loop through all operators and construct the corresponding matrix&#xA;for instr, qargs, cargs in qc._data:&#xA;    #This allows you to get the corresponding matrix of the local operator&#xA;    loc_mat = instr.to_matrix()&#xA;    comp = int(2**(np.log2(np.shape(H)[0]) - np.log2(np.shape(loc_mat)[0])))&#xA;    #construct a complementary identity operator to tensor product with the local operator&#xA;    Hkro=np.identity(comp, dtype=complex)&#xA;    Htmp = np.kron(Hkro, loc_mat)&#xA;    # should permut H first by rearranging the circuit by using the index of &#xA;    # the used qregister, this part I did not have the courage to do &#xA;    # (that's why people have coded it so well in unitary_simulator &#xA;    # so why bother if you understand what is happening behind the scene)&#xA;    for j in range(len(qargs)):&#xA;        i_pos=qargs[j].index&#xA;        for k in range(len(qargs)):&#xA;            j_pos=qargs[k].index&#xA;    &#xA;    H=np.matmul(H, Htmp)&#xA;    #should back permut&#xA;    print(qargs)&#xA;print(H)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="4947" LastEditorUserId="4947" LastEditDate="2021-04-03T20:04:20.910" LastActivityDate="2021-04-03T20:04:20.910" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16843" PostTypeId="2" ParentId="5431" CreationDate="2021-04-03T20:54:22.440" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I'm curious about how to form arbitrary-sized uniform superpositions [...] for &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; that is not a power of 2.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt; it's explained how to do this by using a single perfectly-tuned round of amplitude amplification from an easily-solved nearby &lt;span class=&quot;math-container&quot;&gt;$N^\prime$&lt;/span&gt; that is a power of 2.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yzCqL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yzCqL.png&quot; alt=&quot;uniform superposition&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A25%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B%22Chance7%22%5D%2C%5B%22Amps7%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;Example Quirk Circuit&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dDzFX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dDzFX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You only need a single round because the overlap between the desired state and the nearby easily prepared state is so large. Major advantages of this construction are that 1) it always succeeds (don't need to retry until success) and 2) it is reversible.&lt;/p&gt;&#xA;&lt;p&gt;You probably noticed the uniform prep circuit I gave contains an arbitrary rotation with a weird angle. Since your ultimate goal was to avoid synthesizing such a rotation, maybe it's not so satisfying to you as an answer!&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-04-06T19:15:13.433" LastActivityDate="2021-04-06T19:15:13.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16844" PostTypeId="1" CreationDate="2021-04-03T21:14:10.240" Score="2" ViewCount="69" Body="&lt;p&gt;In the paper &amp;quot;How to share quantum secret&amp;quot; by R.Cleve et al (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9901025&quot; rel=&quot;nofollow noreferrer&quot;&gt;arxiv&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;There is an example of secret sharing using qutrit in a (2,3) threshold scheme.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha\vert0\rangle+\beta\vert1\rangle+\gamma\vert2\rangle\mapsto$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\alpha(\vert000\rangle+\vert111\rangle+\vert222\rangle)+\beta(\vert012\rangle+\vert120\rangle+\vert201\rangle)+\gamma(\vert021\rangle+\vert102\rangle+\vert210\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the secret encoding maps the initial qutrit as shown above, and any combination of the two can be used to determine the secret qutrit back.&lt;/p&gt;&#xA;&lt;p&gt;Given the first two shares (for instance), add the value of the first share to the second (modulo three), and then add the value of the second share to the first, to obtain the state below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\alpha\vert0\rangle+\beta\vert1\rangle+\gamma\vert2\rangle)\vert00\rangle+\vert12\rangle+\vert21\rangle)$$&lt;/span&gt;&#xA;I am unable to understand what exactly is happening here, any help would be really appreciated.&lt;/p&gt;&#xA;" OwnerUserId="15428" LastEditorUserId="55" LastEditDate="2021-04-04T17:34:01.167" LastActivityDate="2021-05-22T06:42:45.060" Title="Understanding the (2,3) threshold quantum secret sharing scheme in Cleve et al. 1999" Tags="&lt;error-correction&gt;&lt;key-distribution&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16845" PostTypeId="2" ParentId="16838" CreationDate="2021-04-03T23:47:27.913" Score="1" Body="&lt;p&gt;I found that if you multiply layer1 by layer2 (not layer2 @ layer1), the answer is consistent with the Qiskit one. So I tested through IBM experience and found that the state is reverse in Qiskit, which is a bit weird for me (that is if you apply a not gate to q0 in q0=0, q1=0, q2=0, a typical |000&amp;gt; state, it will become |001&amp;gt; but not |100&amp;gt;). Follow this idea you would find that the kronecker product in your first layer should be  &lt;span class=&quot;math-container&quot;&gt;$\ \mathbb{I}\ \otimes\ $&lt;/span&gt;SWAP-CNOT, exactly the reverse of your numpy computation. I'm also noob in Quantum Computing but it probably is the answer. (See Qiskit document &lt;a href=&quot;https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html&lt;/a&gt; to get more sense on how it works)&lt;/p&gt;&#xA;" OwnerUserId="13500" LastEditorUserId="13500" LastEditDate="2021-04-04T00:38:24.747" LastActivityDate="2021-04-04T00:38:24.747" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16846" PostTypeId="1" CreationDate="2021-04-04T02:35:10.050" Score="1" ViewCount="43" Body="&lt;p&gt;It takes 20 minutes for the &lt;em&gt;ibmq_qasm_simulator&lt;/em&gt; to execute 1 shot of my circuit. Successful always.&lt;/p&gt;&#xA;&lt;p&gt;It always times out for 2 shots of the same circuit on the same simulator.&lt;/p&gt;&#xA;&lt;p&gt;One may assume the performance would be roughly linear, say, 40 minutes for 2 shots. No, that has never happened to me. For those who don't know the simulator, its default timeout is supposed to be 166 minutes (10,000 seconds).&lt;/p&gt;&#xA;&lt;p&gt;Is there a bug somewhere in the simulator?&lt;/p&gt;&#xA;" OwnerUserId="9768" LastActivityDate="2021-04-04T02:35:10.050" Title="IBM Quantum: 20 minutes for 1 shot, timeout for 2 shots. Why?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2021-04-07T23:52:32.753" ContentLicense="CC BY-SA 4.0" />
  <row Id="16847" PostTypeId="2" ParentId="16814" CreationDate="2021-04-04T07:21:36.127" Score="3" Body="&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; Yes, the two error syndromes are identical, because the two errors trip the same set of stabilizers.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; denote a state in the code subspace of the Shor's 9-qubit code. Every operator &lt;span class=&quot;math-container&quot;&gt;$\hat{S}$&lt;/span&gt; in the stabilizer group &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; of the code fixes &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\hat{S}|\psi\rangle = |\psi\rangle$&lt;/span&gt;. In particular, generators &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_1, \dots \hat{S}_8$&lt;/span&gt; fix &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$$\hat{S}_i|\psi\rangle = |\psi\rangle\tag1$$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1,\dots,8$&lt;/span&gt;. Let &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; denote the result of a phase-flip error on qubit 5, i.e. &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle = \hat{Z}_5|\psi\rangle$&lt;/span&gt; and similarly &lt;span class=&quot;math-container&quot;&gt;$|\psi_6\rangle = \hat{Z}_6|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We begin computing the errors syndrome for &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; with the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; type stabilizer generators, i.e. &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_j$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$j=1,\dots,6$&lt;/span&gt;. Note that &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_j=\hat{Z}_a\hat{Z}_b$&lt;/span&gt; for some qubits &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;. We calculate&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{S}_j|\psi_5\rangle = \hat{Z}_a\hat{Z}_b\hat{Z}_5|\psi\rangle = \hat{Z}_5\hat{Z}_a\hat{Z}_b|\psi\rangle = \hat{Z}_5\hat{S}_j|\psi\rangle = \hat{Z}_5|\psi\rangle = |\psi_5\rangle\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we first used the definitions of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt;, then the fact that &lt;span class=&quot;math-container&quot;&gt;$\hat{Z}_q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{Z}_r$&lt;/span&gt; commute for any qubits &lt;span class=&quot;math-container&quot;&gt;$q$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, then the definition of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_j$&lt;/span&gt; again, then &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$i=j$&lt;/span&gt; and finally the definition of &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt;. Thus, we see that &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_j$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$j=1,\dots,6$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and therefore a measurement of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_j$&lt;/span&gt; on this state yields &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Note that analogous calculation yields the same result on &lt;span class=&quot;math-container&quot;&gt;$|\psi_6\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{S}_j|\psi_6\rangle = \hat{Z}_a\hat{Z}_b\hat{Z}_6|\psi\rangle = \hat{Z}_6\hat{Z}_a\hat{Z}_b|\psi\rangle = \hat{Z}_6\hat{S}_j|\psi\rangle = \hat{Z}_6|\psi\rangle = |\psi_6\rangle\tag3&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$j=1,\dots,6$&lt;/span&gt; as before.&lt;/p&gt;&#xA;&lt;p&gt;Now, let us turn to the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; type stabilizer generators &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_8$&lt;/span&gt;. For the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt;, we find&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\hat{S}_7|\psi_5\rangle &amp;amp;= \hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6\hat{Z}_5|\psi\rangle \\&#xA;&amp;amp;= -\hat{Z}_5\hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5\hat{X}_6|\psi\rangle \\&#xA;&amp;amp;= -\hat{Z}_5\hat{S}_7|\psi\rangle \\ &amp;amp;= -\hat{Z}_5|\psi\rangle \\ &amp;amp;= -|\psi_5\rangle&#xA;\end{align}\tag4&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where first we used the definitions of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt;, then the facts that &lt;span class=&quot;math-container&quot;&gt;$\hat{X}_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{Z}_j$&lt;/span&gt; commute when &lt;span class=&quot;math-container&quot;&gt;$i\ne j$&lt;/span&gt; and anticommute when &lt;span class=&quot;math-container&quot;&gt;$i=j$&lt;/span&gt;, then once again the definition of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$i=7$&lt;/span&gt; and finally the definition of &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt;. Thus, we see that &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; and therefore a measurement of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; yields &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. Analogous calculation for &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_8$&lt;/span&gt; shows that &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_8$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. Finally, the same calculation with &lt;span class=&quot;math-container&quot;&gt;$|\psi_6\rangle$&lt;/span&gt; in place of &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; shows that &lt;span class=&quot;math-container&quot;&gt;$|\psi_6\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_7$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{S}_8$&lt;/span&gt; associated with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We conclude that measuring &lt;span class=&quot;math-container&quot;&gt;$(\hat{S}_1, \hat{S}_2, \hat{S}_3, \hat{S}_4, \hat{S}_5, \hat{S}_6, \hat{S}_7, \hat{S}_8)$&lt;/span&gt; on states &lt;span class=&quot;math-container&quot;&gt;$|\psi_5\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_6\rangle$&lt;/span&gt; yields the same syndrome &lt;span class=&quot;math-container&quot;&gt;$(+1, +1, +1, +1, +1, +1, -1, -1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Remark:&lt;/strong&gt; The calculation above shows a useful fact about CSS codes: phase flips are detected by the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; type stabilizers and leave the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; type stabilizers unaffected. Similarly, bit flips are detected by the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; type stabilizers and leave the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; type stabilizers unaffected.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-04T07:21:36.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16848" PostTypeId="1" AcceptedAnswerId="16854" CreationDate="2021-04-04T12:15:31.687" Score="3" ViewCount="331" Body="&lt;p&gt;I was just curious, why is the quantum gate Y-gate (Pauli-Y gate) written in terms of complex numbers? We can actually write Pauli-Y gate as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y = i * \begin{bmatrix} 0 &amp;amp; -1 \\ 1 &amp;amp; 0 \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and still we can get result &lt;span class=&quot;math-container&quot;&gt;$YY = I$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1409" LastEditorUserId="5955" LastEditDate="2021-04-04T21:49:40.320" LastActivityDate="2021-04-05T04:05:35.870" Title="Can we write Pauli-Y gate without even complex part?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;&lt;pauli-gates&gt;" AnswerCount="3" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16849" PostTypeId="1" AcceptedAnswerId="16850" CreationDate="2021-04-04T15:04:37.323" Score="3" ViewCount="76" Body="&lt;p&gt;I am reading &lt;a href=&quot;https://quantumai.google/cirq/simulation#expectation_values&quot; rel=&quot;nofollow noreferrer&quot;&gt;cirq guide about Simulation&lt;/a&gt; and there is an example in &amp;quot;Expectation values&amp;quot; paragraph that I don't understand.&lt;/p&gt;&#xA;&lt;p&gt;Everything boils down to the following snippet:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;&#xA;q0 = cirq.GridQubit(0, 0)&#xA;q1 = cirq.GridQubit(1, 0)&#xA;&#xA;def basic_circuit():&#xA;    sqrt_x = cirq.X**0.5&#xA;    yield sqrt_x(q0), sqrt_x(q1)&#xA;    yield cirq.CZ(q0, q1)&#xA;    yield sqrt_x(q0), sqrt_x(q1)&#xA;&#xA;circuit = cirq.Circuit(basic_circuit())&#xA;&#xA;XX_obs = cirq.X(q0) * cirq.X(q1)&#xA;ZZ_obs = cirq.Z(q0) * cirq.Z(q1)&#xA;&#xA;ev_list = cirq.Simulator().simulate_expectation_values(circuit, observables=[XX_obs])&#xA;print(ev_list)&#xA;# Output:&#xA;[(1+0j)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;First, I don't understand what &lt;code&gt;XX_obs&lt;/code&gt; and &lt;code&gt;ZZ_obs&lt;/code&gt; do. What does it mean to multiply two circuits by &lt;code&gt;*&lt;/code&gt; operator. Is it the tensor product of the operations or something else?&lt;/p&gt;&#xA;&lt;p&gt;Second, is simulating observable &lt;code&gt;XX_obs&lt;/code&gt; the same as adding &lt;code&gt;XX_obs&lt;/code&gt; at the end of circuit? If so, how to read the following printed output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.append(XX_obs)&#xA;print(circuit)&#xA;# Output:&#xA;(0, 0): ───X^0.5───@───X^0.5───PauliString(+X)───&#xA;                   │           │&#xA;(1, 0): ───X^0.5───@───X^0.5───X─────────────────&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Third, if I simulate the above circuit without measurement I get the following output which does not resemble &lt;code&gt;[(1+0j)]&lt;/code&gt; obtained previously:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result = cirq.Simulator().simulate(circuit)&#xA;print(result)&#xA;# output:&#xA;measurements: (no measurements)&#xA;output vector: 0.5|00⟩ + 0.5j|01⟩ + 0.5j|10⟩ + 0.5|11⟩&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Why is it so?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;PS. It is my very first question on this site so be forgiving about tags I used or about some conventions that you use and I don't know.&lt;/p&gt;&#xA;" OwnerUserId="15435" LastActivityDate="2021-04-04T15:46:43.547" Title="Multiplying quantum circuits in cirq using * and computing &quot;expectation values&quot;" Tags="&lt;programming&gt;&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16850" PostTypeId="2" ParentId="16849" CreationDate="2021-04-04T15:39:53.257" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$Z_{q0} Z_{q1}$&lt;/span&gt; is an &lt;em&gt;observable&lt;/em&gt;; a thing that you can measure.&lt;/p&gt;&#xA;&lt;p&gt;If I tell you to measure &lt;span class=&quot;math-container&quot;&gt;$Z_{q0}$&lt;/span&gt;, I am telling you to measure qubit &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; in the computational basis (i.e. in the usual way, i.e. whether the qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;If I tell you to measure &lt;span class=&quot;math-container&quot;&gt;$X_{q0}$&lt;/span&gt;, I am telling you to measure qubit &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; in the X basis (i.e. whether the qubit is &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;). Typically you would do this by applying a Hadamard operation to &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; before applying the usual measurement operation.&lt;/p&gt;&#xA;&lt;p&gt;If I tell you to measure &lt;span class=&quot;math-container&quot;&gt;$Z_{q0} Z_{q1}$&lt;/span&gt;, I am telling you to measure the &lt;em&gt;parity&lt;/em&gt; of qubit &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; and qubit &lt;span class=&quot;math-container&quot;&gt;$q1$&lt;/span&gt; in the computational basis (i.e. whether they are the same or different, i.e. whether you are in the &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; subspace or in the &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt; subspace). Typically you would do this by applying a CNOT operation from &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; to an ancilla, and then from &lt;span class=&quot;math-container&quot;&gt;$q1$&lt;/span&gt; to an ancilla, then measuring the ancilla. If you don't need to continue the circuit or measure other observables, you would instead just measure &lt;span class=&quot;math-container&quot;&gt;$Z_{q0}$&lt;/span&gt; and also measure &lt;span class=&quot;math-container&quot;&gt;$Z_{q1}$&lt;/span&gt; and check if they were the same using classical postprocessing.&lt;/p&gt;&#xA;&lt;p&gt;If I tell you to measure &lt;span class=&quot;math-container&quot;&gt;$X_{q0} X_{q1}$&lt;/span&gt;, I am telling you to measure the parity between qubit &lt;span class=&quot;math-container&quot;&gt;$q0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q1$&lt;/span&gt; in the X basis.&lt;/p&gt;&#xA;&lt;p&gt;If I ask for the &lt;em&gt;expectation value&lt;/em&gt; of an observable, then I want you to run the circuit many times, measuring that observable at the end of the circuit each time, and tell me the average of the results.&lt;/p&gt;&#xA;&lt;p&gt;So passing &lt;span class=&quot;math-container&quot;&gt;$X_{q0} X_{q1}$&lt;/span&gt; into the method you are talking about doesn't put &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operations at the end of the circuit... it actually puts Hadamard and measurement operations at the end of the circuit, runs the circuit many times, and reports how frequently those two measurements differ from each other.&lt;/p&gt;&#xA;&lt;p&gt;The reason we refer to observables in this product-of-operations way is because one way to measure an observable is to perform those operations, but controlled on an ancilla in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state. This flips the ancilla to the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state via phase kickback, if the system state is in the -1 eigenspace of the product-of-operations. There are also a lot of other nice things about thinking about measurements in this way, e.g. it is the basis of the stabilizer formalism which allows Clifford circuits to be simulated efficiently.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-04-04T15:46:43.547" LastActivityDate="2021-04-04T15:46:43.547" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16851" PostTypeId="2" ParentId="16848" CreationDate="2021-04-04T16:04:36.293" Score="6" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} 0 &amp;amp; -i \\ i &amp;amp; 0 \end{pmatrix} = i \begin{pmatrix} 0 &amp;amp; -1 \\ 1 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There is no reason to factor out the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, it just make thing more cumbersome.&lt;/p&gt;&#xA;&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; what you are trying to do or assuming is that you can &lt;strong&gt;ignore&lt;/strong&gt; the phase factor &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; since it is just an overall phase factor. That would be okay, as long as you don't do any controlled operation on it.&lt;/p&gt;&#xA;&lt;p&gt;That is, suppose &lt;span class=&quot;math-container&quot;&gt;$U = \begin{pmatrix} 0 &amp;amp; -1 \\ 1 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle $&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$U|\psi \rangle $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y|\psi \rangle$&lt;/span&gt; are indistinguishable from one another. However, &lt;span class=&quot;math-container&quot;&gt;$Controlled$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Controlled$&lt;/span&gt;-&lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are &lt;strong&gt;not&lt;/strong&gt; the same, and they will have different effect on a two qubit state &lt;span class=&quot;math-container&quot;&gt;$|\phi \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-04T16:04:36.293" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16852" PostTypeId="1" AcceptedAnswerId="16855" CreationDate="2021-04-04T16:23:15.213" Score="0" ViewCount="27" Body="&lt;p&gt;I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator.&#xA;i.e.: By just using matrix manipulation, how do I get the unitary matrix of the circuit below by just using numpy and normal matrix properties?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yHHpj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yHHpj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1&gt;This is the code I am using:&lt;/h1&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;swapcnot = np.array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]])&#xA;&#xA;cnot = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])&#xA;&#xA;layer1 = np.kron(np.eye(2),swapcnot)&#xA;&#xA;layer2 = np.kron(swapcnot, np.eye(2))&#xA;&#xA;layer3 = np.kron(np.eye(2), cnot )&#xA;&#xA;print(layer3@layer2@layer1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1&gt;The result I should be getting:&lt;/h1&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA; [0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA; [0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j]&#xA; [0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j]&#xA; [0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j]&#xA; [0.+0.j 0.+0.j 0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA; [0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]&#xA; [0.+0.j 0.+0.j 1.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j 0.+0.j]] &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1&gt;The actual result I am getting:&lt;/h1&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[1. 0. 0. 0. 0. 0. 0. 0.]&#xA; [0. 0. 0. 1. 0. 0. 0. 0.]&#xA; [0. 0. 0. 0. 0. 1. 0. 0.]&#xA; [0. 0. 0. 0. 0. 0. 1. 0.]&#xA; [0. 0. 0. 0. 1. 0. 0. 0.]&#xA; [0. 0. 0. 0. 0. 0. 0. 1.]&#xA; [0. 1. 0. 0. 0. 0. 0. 0.]&#xA; [0. 0. 1. 0. 0. 0. 0. 0.]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15422" LastEditorUserId="55" LastEditDate="2021-04-04T17:37:44.460" LastActivityDate="2021-04-04T17:37:44.460" Title="Why is my unitary matrix using linear algebra not matching the 'get_unitary' simulation?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;unitarity&gt;&lt;python&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16853" PostTypeId="1" CreationDate="2021-04-04T16:42:37.523" Score="4" ViewCount="74" Body="&lt;p&gt;I tried to implement the following circuit in the image below but with the red circled gates replaced with a unitary controlled &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/2}}$&lt;/span&gt; and controlled &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/4}}$&lt;/span&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/lISNk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lISNk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt; The image came from this paper &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S037596012030462X&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and someone already implemented this circuit &lt;a href=&quot;https://github.com/dreamingangela/ibmq_hhl/blob/master/hhl.qasm&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. &lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;The matrix A is :&lt;br&gt;&lt;a href=&quot;https://i.stack.imgur.com/Sw4e8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Sw4e8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;br&gt;&#xA;And t = 2π &lt;br&gt;&lt;br&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/2}}$&lt;/span&gt; I found that the matrix is equal to an X gate which is same as the paper.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/9VgXr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9VgXr.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/4}}$&lt;/span&gt; I got this matrix. &lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ys6Fh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ys6Fh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;br&gt;&#xA;But in the paper they use U3(-pi/2,-pi/2,pi/2) as target bit and U1(3π/4) afterwards at control bit.&lt;br&gt;&#xA;The unitary matrix from both qubit is something like this.(I use qiskit to find the unitary matrix)&lt;br&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/pmoHI.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pmoHI.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt; &lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;While my &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/4}}$&lt;/span&gt; connected with a control bit gives different unitary matrix.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Ew2ES.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ew2ES.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;br&gt;&#xA;Am I missing something or is there anything wrong with my &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/4}}$&lt;/span&gt; unitary?&lt;/p&gt;&#xA;" OwnerUserId="13676" LastEditorUserId="55" LastEditDate="2021-04-05T21:31:14.177" LastActivityDate="2021-04-05T21:31:14.177" Title="I don't understand unitary of ${e^{iAt}}$ from HHL algorithm" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16854" PostTypeId="2" ParentId="16848" CreationDate="2021-04-04T16:45:25.437" Score="6" Body="&lt;p&gt;As noted by @KAJ226 in another answer, the &lt;em&gt;global&lt;/em&gt; phase factor &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is unobservable and can be ignored, unless we are considering a controlled gate in which case the phase factor &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; becomes a &lt;em&gt;relative&lt;/em&gt; phase which may &lt;em&gt;not&lt;/em&gt; be ignored. Consequently, we can choose to represent the single-qubit gate known as &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; using the real matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Y=\begin{pmatrix}&#xA;0 &amp;amp; -1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In fact, you can occasionally see this definition in older papers (see e.g. equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; on page 3 in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9702029&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt;). This highlights an important point: quantum gates do not correspond one-to-one to matrices we use to represent them in calculations.&lt;/p&gt;&#xA;&lt;p&gt;In certain contexts, it is preferable to use the imaginary matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma_Y=iY$&lt;/span&gt; over the real matrix &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;, which is probably why the convention has settled on using the former. Here are some interesting properties that distinguish the two.&lt;/p&gt;&#xA;&lt;h2&gt;Pauli group&lt;/h2&gt;&#xA;&lt;p&gt;First, unlike the complex matrices&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_X=\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}\quad&#xA;\sigma_Y=\begin{pmatrix}&#xA;0 &amp;amp; -i \\&#xA;i &amp;amp; 0&#xA;\end{pmatrix}\quad&#xA;\sigma_Z=\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix}\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;the real matrices&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X=\begin{pmatrix}&#xA;0 &amp;amp; 1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}\quad&#xA;Y=\begin{pmatrix}&#xA;0 &amp;amp; -1 \\&#xA;1 &amp;amp; 0&#xA;\end{pmatrix}\quad&#xA;Z=\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; -1&#xA;\end{pmatrix}\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;do not generate the full one-qubit &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_group&quot; rel=&quot;noreferrer&quot;&gt;Pauli group&lt;/a&gt;. They do generate a useful subgroup (which contains real matrices only).&lt;/p&gt;&#xA;&lt;h2&gt;Observables&lt;/h2&gt;&#xA;&lt;p&gt;All three matrices in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; are Hermitian with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. On the other hand, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; is anti-Hermitian and has imaginary eigenvalues &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-i$&lt;/span&gt;. Consequently, matrices in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; can be used to represent both quantum gates and observables, but matrix &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; is not an observable.&lt;/p&gt;&#xA;&lt;p&gt;In fact, together with identity the matrices in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; form a basis of the real vector space of single-qubit Hermitian operators. Of course, similar statement is not true about &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Stabilizer formalism&lt;/h2&gt;&#xA;&lt;p&gt;Related to the above is the fact that &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; can never be a member of a stabilizer group (all stabilizers must have &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; among their eigenvalues).&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-04T16:45:25.437" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16855" PostTypeId="2" ParentId="16852" CreationDate="2021-04-04T17:02:42.930" Score="1" Body="&lt;p&gt;First, you need to realize that&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c8sxE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c8sxE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is also known as the Bridge gate.  This means that&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/j9Ow8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/j9Ow8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;From here, you can now write down the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;swapcnot = np.array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]])&#xA;&#xA;cnot = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])&#xA;&#xA;layer1 = np.kron(np.eye(2),swapcnot)&#xA;&#xA;layer2 = np.kron(swapcnot, np.eye(2))&#xA;&#xA;### Bridge Gate part of the circuit ####&#xA;&#xA;layer3 = np.kron(np.eye(2), cnot )&#xA;&#xA;layer4 = np.kron(cnot, np.eye(2) )&#xA;&#xA;layer5 = np.kron(np.eye(2), cnot )&#xA;&#xA;layer6 = np.kron(cnot, np.eye(2) )&#xA;&#xA;####################################&#xA;&#xA;print(layer6@layer5@layer4@layer3@layer2@layer1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[1. 0. 0. 0. 0. 0. 0. 0.]&#xA; [0. 0. 0. 1. 0. 0. 0. 0.]&#xA; [0. 0. 0. 0. 0. 0. 1. 0.]&#xA; [0. 0. 0. 0. 0. 1. 0. 0.]&#xA; [0. 0. 0. 0. 0. 0. 0. 1.]&#xA; [0. 0. 0. 0. 1. 0. 0. 0.]&#xA; [0. 1. 0. 0. 0. 0. 0. 0.]&#xA; [0. 0. 1. 0. 0. 0. 0. 0.]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which is what you expected.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-04T17:14:46.667" LastActivityDate="2021-04-04T17:14:46.667" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16856" PostTypeId="1" CreationDate="2021-04-04T17:55:48.237" Score="1" ViewCount="72" Body="&lt;p&gt;I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator.&#xA;i.e.: By just using matrix manipulation, how do I get the unitary matrix of the circuit below by just using numpy and normal matrix properties?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0EjHt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0EjHt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have figured out how to get the unitary matrix of the circuit below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/jpcx9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jpcx9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;By using this code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;&#xA;swapcnot = np.array([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]])&#xA;cnot = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])&#xA;&#xA;layer1 = np.kron(np.eye(2),swapcnot)&#xA;&#xA;layer2 = np.kron(swapcnot, np.eye(2))&#xA;&#xA;print(layer2@layer1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However when I try to add another qubit and another cnot gate, I do not get the correct result&lt;/p&gt;&#xA;&lt;h1&gt;The result I should be getting:&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BWieN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BWieN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15422" LastEditorUserId="55" LastEditDate="2021-04-05T21:31:29.837" LastActivityDate="2021-04-05T21:31:29.837" Title="How do I get the Unitary matrix of this circuit without using 'unitary_simulator'?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;unitarity&gt;&lt;python&gt;" AnswerCount="2" CommentCount="0" ClosedDate="2021-04-05T21:40:23.117" ContentLicense="CC BY-SA 4.0" />
  <row Id="16857" PostTypeId="2" ParentId="16856" CreationDate="2021-04-04T18:25:49.160" Score="1" Body="&lt;p&gt;The 4 qubit case goes as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;swapcnot = np.array([[1, 0, 0, 0],&#xA;                     [0, 0, 0, 1],&#xA;                     [0, 0, 1, 0],&#xA;                     [0, 1, 0, 0]])&#xA;id = np.eye(2)&#xA;op1 = np.kron(np.kron(swapcnot, id), id)&#xA;op2 = np.kron(np.kron(id, swapcnot), id)&#xA;op3 = np.kron(np.kron(id, id), swapcnot)&#xA;op1@op2@op3&#xA;# output:&#xA;array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],&#xA;       [0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I guess you will figure out the general case base on the above snippet. Just keep in mind that Kronecker product (or more generally tensor product) is associative, thus the place where you put &lt;code&gt;np.kron&lt;/code&gt; does not matter.&lt;/p&gt;&#xA;" OwnerUserId="15435" LastActivityDate="2021-04-04T18:25:49.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16858" PostTypeId="2" ParentId="16856" CreationDate="2021-04-04T18:48:51.787" Score="0" Body="&lt;p&gt;First, realized that your circuit can be divided into 3 stages as follow:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/x6XWH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/x6XWH.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first state, &lt;span class=&quot;math-container&quot;&gt;$U1$&lt;/span&gt;, can be written in term of tensor product as &lt;span class=&quot;math-container&quot;&gt;$U1 = CNOT \otimes I \otimes I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The second state, &lt;span class=&quot;math-container&quot;&gt;$U2$&lt;/span&gt;, can be written as &lt;span class=&quot;math-container&quot;&gt;$U2 = I \otimes CNOT \otimes I$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The third state, &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt;, can be written as &lt;span class=&quot;math-container&quot;&gt;$U3 = I \otimes I \otimes CNOT$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Your entire circuit then can be represented as a Unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$U = U3 \cdot U2 \cdot U1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-04T18:48:51.787" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16859" PostTypeId="2" ParentId="16853" CreationDate="2021-04-04T22:16:11.627" Score="3" Body="&lt;p&gt;The mistakes comes from the fact that you missed the controlled-part of the U3 gate.&lt;/p&gt;&#xA;&lt;p&gt;So your equivalent gate should really be:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qr = QuantumRegister(2, 'qubit')&#xA;qc = QuantumCircuit(qr, ClassicalRegister(2, name='classicabit'))&#xA;qc.cu3(-math.pi/2, -math.pi/2, math.pi/2, 0, 1)&#xA;qc.u1(3.0*math.pi/4,0)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The unitary result of :&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/HutFE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/HutFE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;is :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[ 1. +0.j   0. +0.j   0. +0.j   0. +0.j ]  &#xA; [ 0. +0.j  -0.5+0.5j  0. +0.j  -0.5-0.5j]  &#xA; [ 0. +0.j   0. +0.j   1. +0.j   0. +0.j ]  &#xA; [ 0. +0.j  -0.5-0.5j  0. +0.j  -0.5+0.5j]]  &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where you find your unitary matrix :&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[[ -0.5+0.5j  -0.5-0.5j]&lt;br /&gt;&#xA;[ -0.5-0.5j  -0.5+0.5j]]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;controlled by qubit 1.&lt;/p&gt;&#xA;&lt;p&gt;I did not understand how you implemented your &lt;span class=&quot;math-container&quot;&gt;${e^{iAt/4}}$&lt;/span&gt; controlled gate, at least the methods you use do not work with my qiskit version so you can check with this code :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;A = np.array([[1.5, 0.5],[0.5, 1.5]])&#xA;qc = QuantumCircuit(2)&#xA;gate=ex.UnitaryGate(expm(A*1.j*math.pi/2)).control(1)&#xA;qc.append(gate, [0,1])&#xA;&#xA;qasm_sim = BasicAer.get_backend('unitary_simulator')&#xA;result = execute(qc, qasm_sim).result()&#xA;print(result.get_unitary())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KsgKv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KsgKv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which produces&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[[ 1. -5.55111512e-17j  0. +0.00000000e+00j  0. +0.00000000e+00j 0.+0.00000000e+00j]&lt;br /&gt;&#xA;[ 0. +0.00000000e+00j -0.5+5.00000000e-01j  0. +0.00000000e+00j   -0.5-5.00000000e-01j]    [ 0. +0.00000000e+00j  0. +0.00000000e+00j  1. -7.21644966e-16j&#xA;0. +0.00000000e+00j]    [ 0. +0.00000000e+00j -0.5-5.00000000e-01j  0. +0.00000000e+00j   -0.5+5.00000000e-01j]]&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="4947" LastEditorUserId="4947" LastEditDate="2021-04-04T22:44:41.427" LastActivityDate="2021-04-04T22:44:41.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16860" PostTypeId="2" ParentId="16848" CreationDate="2021-04-05T04:05:35.870" Score="4" Body="&lt;p&gt;The reason for holding &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\sigma_2$&lt;/span&gt; is the relations between Pauli matrices. In particular, the  commutation relations. The general formula for the commutation relations is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;[\sigma_a\sigma_b]=2i\epsilon_{abc}\sigma_c&#xA;\end{equation}&lt;/span&gt;&#xA;for example&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;[\sigma_1\sigma_2]=2i\sigma_3&#xA;\end{equation}&lt;/span&gt;&#xA;The relations are broken if we remove &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$\sigma_2$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2021-04-05T04:05:35.870" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16862" PostTypeId="2" ParentId="15249" CreationDate="2021-04-05T12:45:11.470" Score="0" Body="&lt;p&gt;Update note: As of Qiskit 0.25.0, this seems to no longer be an issue. I am not entirely sure what the reason for this was. For a few weeks leading up to 0.25.0 this issue also went away if I followed Qiskit's instructions for building it from the source code on Github:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/getting_started.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/getting_started.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14247" LastActivityDate="2021-04-05T12:45:11.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16864" PostTypeId="2" ParentId="6135" CreationDate="2021-04-05T15:03:54.933" Score="1" Body="&lt;p&gt;I guess the easiest way to implement a conditional operator is to add a quantum register (&lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt;) that will contain the conditional parameter and then have a succession of control-gates, controlled by &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In your case lets's call A, &lt;span class=&quot;math-container&quot;&gt;$Op A$&lt;/span&gt; and B, &lt;span class=&quot;math-container&quot;&gt;$Op B$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$op_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$op_1$&lt;/span&gt; will be the registers involved in &lt;span class=&quot;math-container&quot;&gt;$Op A$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Op B$&lt;/span&gt;. Obviously the same reasoning works with operations on more than 2 qubits.&lt;/p&gt;&#xA;&lt;p&gt;The conditional quantum circuit is then :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;import numpy as np&#xA;import math&#xA;from scipy.linalg import expm&#xA;&#xA;&#xA;A = np.random.random((4,4))&#xA;A = expm(A*A.T*1.j*math.pi/2) #&amp;quot;whatever unitary defines operation A&amp;quot;&#xA;B = np.random.random((4,4))&#xA;B = expm(B*B.T*1.j*math.pi/2) #&amp;quot;whatever unitary defines operation B&amp;quot;&#xA;&#xA;#register acting as the conditional statement&#xA;qr1 = QuantumRegister(1, name='cond')&#xA;&#xA;#registers involved in the operation&#xA;qr2 = QuantumRegister(2, name='op')&#xA;&#xA;#Circuit&#xA;qc = QuantumCircuit(qr1, qr2)&#xA;gate=ex.UnitaryGate(A, label=&amp;quot;Op A&amp;quot;).control(1)&#xA;qc.append(gate, [0,1,2])&#xA;qc.x(0)&#xA;gate=ex.UnitaryGate(B, label=&amp;quot;Op B&amp;quot;).control(1)&#xA;qc.append(gate, [0,1,2])&#xA;qc.x(0)&#xA;&#xA;&#xA;print(qc.draw('text'))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The resulting circuit is:&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/jauD8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/jauD8.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see if &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt;=&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$Op A$&lt;/span&gt; &lt;strong&gt;is not applied&lt;/strong&gt; but &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt; is bit-flipped so &lt;span class=&quot;math-container&quot;&gt;$Op A$&lt;/span&gt; &lt;strong&gt;is applied&lt;/strong&gt;.&lt;br /&gt;&#xA;In the same way if &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt;=&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$Op A$&lt;/span&gt; &lt;strong&gt;is applied&lt;/strong&gt; but &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt; is bit-flipped so &lt;span class=&quot;math-container&quot;&gt;$Op A$&lt;/span&gt; &lt;strong&gt;is not applied&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The last bit-flip on &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt; is done to restore the value of &lt;span class=&quot;math-container&quot;&gt;$cond_0$&lt;/span&gt;. (Potentially unnecessary)&lt;/p&gt;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="4947" LastActivityDate="2021-04-05T15:03:54.933" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16865" PostTypeId="2" ParentId="16832" CreationDate="2021-04-05T16:28:07.063" Score="1" Body="&lt;p&gt;Yes, the referenced terms divided by two are directly related. First note that &lt;span class=&quot;math-container&quot;&gt;$R_{\hat n}(\theta) \in SU(2)$&lt;/span&gt; is isomorphic to &lt;span class=&quot;math-container&quot;&gt;$U_3 \in U(2)$&lt;/span&gt;.  You can see this by rewriting &lt;span class=&quot;math-container&quot;&gt;$U_3$&lt;/span&gt; as an arbitrary element of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; multiplied by the global phase &lt;span class=&quot;math-container&quot;&gt;$e^{i(\delta+\beta)/2} \in U(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In other words,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$SU(2) \ni U_3^\prime =U_3\times e^{-i(\delta+\beta)/2} =&#xA;\begin{bmatrix} &#xA;e^{-i(\delta+\beta)/2}\cos\left(\frac{\gamma}{2}\right) &amp;amp; -e^{i(\delta-\beta)/2} \sin\left(\frac{\gamma}{2}\right) \\&#xA;e^{-i(\delta-\beta)/2} \sin\left(\frac{\gamma}{2}\right) &amp;amp; e^{i(\delta + \beta)/2} \cos\left(\frac{\gamma}{2}\right)&#xA;\end{bmatrix},$$&lt;/span&gt;&#xA;such that &lt;span class=&quot;math-container&quot;&gt;$U_3^\prime$&lt;/span&gt; is simply an alternative parameterization of an arbitrary element of &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$U_3^\prime \cong U_3$&lt;/span&gt; up to global phase.&lt;/p&gt;&#xA;&lt;p&gt;In reference to your comments on the Bloch sphere, the Bloch sphere is a Riemann sphere (i.e. the complex projective line), not a Euclidean 2-sphere.  The former is a part of elliptic geometry, the latter of spherical geometry.  Elliptic geometry is essentially spherical geometry with antipodal points identified.  This is why orthogonal states appear as antipodal points in a Bloch sphere representation. As you suggested this is all related to spinors (&amp;quot;the Dirac trick&amp;quot;), but that rabbit hole goes very deep.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2021-04-05T17:10:41.893" LastActivityDate="2021-04-05T17:10:41.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16866" PostTypeId="1" CreationDate="2021-04-05T20:03:44.077" Score="4" ViewCount="40" Body="&lt;p&gt;I have an account and API token on IBM Quantum Experience (&lt;a href=&quot;https://quantum-computing.ibm.com/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://quantum-computing.ibm.com/&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;I would like to add team members to the account, so that everyone can use it without sharing login credentials.&lt;/p&gt;&#xA;&lt;p&gt;It doesn't look like IBMQ is integrated with IBM Cloud IAM (we have an IBM Cloud account). I asked their support team and they suggested I post the question here.&lt;/p&gt;&#xA;&lt;p&gt;Does anyone know if it is possible to add team members to an IBMQ account?&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="15442" LastActivityDate="2021-04-05T20:03:44.077" Title="Adding team to our IBM Quantum Experience account" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16867" PostTypeId="1" CreationDate="2021-04-05T22:27:55.597" Score="0" ViewCount="83" Body="&lt;p&gt;Following UT course on Quantum Machine Learning, they have a notebook on QAOA. As part of their lecture, they perform QAOA using Qiskit. Unfortunately, it seems the new versions of Qiskit have changed a lot since then and the code is not working anymore.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, the instructions on the optimization / evaluation procedure say the following:&lt;/p&gt;&#xA;&lt;p&gt;We now create a function &lt;code&gt;evaluate_circuit&lt;/code&gt; that takes a single vector &lt;code&gt;gamma_beta&lt;/code&gt; (the concatenation of &lt;code&gt;gamma&lt;/code&gt; and &lt;code&gt;beta&lt;/code&gt;) and returns &lt;span class=&quot;math-container&quot;&gt;$\langle H_c \rangle = \langle \psi | H_c | \psi \rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is defined by the circuit created with the function above.&lt;/p&gt;&#xA;&lt;p&gt;In their code, &lt;code&gt;evaluate_circuit&lt;/code&gt; looks like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def evaluate_circuit(beta_gamma):&#xA;    n = len(beta_gamma)//2&#xA;    circuit = create_circuit(beta_gamma[:n], beta_gamma[n:])&#xA;    return np.real(Hc.eval(&amp;quot;matrix&amp;quot;, circuit, get_aer_backend('statevector_simulator'))[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So basically they're calculating the expected value of &lt;span class=&quot;math-container&quot;&gt;$H_c$&lt;/span&gt; (the hamiltonian we expect to evolve to at the end) with respect to &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, which in this case is constructed using the function create_circuit (which simulates the evolution from a superposition state based on the applicacion of Hc and Hm operators with angles beta and gamma, respectively):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def create_circuit(beta, gamma):&#xA;    circuit_evolv = sum([evolve(Hc, beta[i], qr) + evolve(Hm, gamma[i], qr)&#xA;    for i in range(p)], evolve(identity, 0, qr))&#xA;        circuit = circuit_init + circuit_evolv&#xA;    return circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The problem here is that &lt;span class=&quot;math-container&quot;&gt;$H_c$&lt;/span&gt; in this case is an object of WeightedPauliOperator, and it doesn't seem to have the function eval anymore.&lt;/p&gt;&#xA;&lt;p&gt;What's the best way to calculate &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H_c | \psi \rangle$&lt;/span&gt;  using WeightedPauliOperator objects?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="15391" LastEditDate="2021-04-06T08:27:24.417" LastActivityDate="2021-04-06T13:01:15.620" Title="Calculating the expected value of a weighted Pauli Operator in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16868" PostTypeId="1" AcceptedAnswerId="16881" CreationDate="2021-04-06T04:24:47.170" Score="3" ViewCount="41" Body="&lt;p&gt;In OpenFermion you can create a Hamiltonian in terms of creation and annihilation pretty easily:&#xA;&lt;code&gt;ham = ((FermionOperator('1^ 1', .5)) + (FermionOperator('2^ 2', .25)))&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;And getting the eigenvalues of the Hamiltonian is pretty straightforward as well:&#xA;&lt;code&gt;vals = eigenspectrum(ham)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I don't understand how to get the eigenvectors of the Hamiltonian. FermionOperator doesn't return a numpy object so I can't use usual linear algebra libraries. What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="15445" LastEditorUserId="55" LastEditDate="2021-04-06T10:12:59.580" LastActivityDate="2021-04-06T18:21:47.893" Title="How to get eigenvectors of Hamiltonian in OpenFermion" Tags="&lt;programming&gt;&lt;hamiltonian-simulation&gt;&lt;openfermion&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16869" PostTypeId="1" AcceptedAnswerId="16876" CreationDate="2021-04-06T04:31:53.353" Score="2" ViewCount="34" Body="&lt;p&gt;The data processing inequality for relative entropy states that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$D(\rho\|\sigma) \geq D(N(\rho)\|N(\sigma))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for some CPTP map &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a quantum state and &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is a positive-semidefinite operator.&lt;/p&gt;&#xA;&lt;p&gt;What goes wrong if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is not normalized (either sub-normalized or has trace larger than 1)?&lt;/p&gt;&#xA;" OwnerUserId="14178" LastActivityDate="2021-04-08T07:24:49.123" Title="Is data processing for relative entropy true when states are not normalized?" Tags="&lt;information-theory&gt;&lt;entropy&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16870" PostTypeId="1" AcceptedAnswerId="16941" CreationDate="2021-04-06T05:21:07.770" Score="-1" ViewCount="125" Body="&lt;p&gt;The stabilizers and logical operators (for five qubit-codes) are given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{S}_1= \hat{X}_1\hat{Z}_2\hat{Z}_3\hat{X}_4 \\&#xA;\hat{S}_2= \hat{X}_2\hat{Z}_3\hat{Z}_4\hat{X}_5 \\&#xA;\hat{S}_3= \hat{X}_1\hat{X}_3\hat{Z}_4\hat{X}_5 \\&#xA;\hat{S}_4= \hat{Z}_1\hat{X}_2\hat{X}_4\hat{Z}_5 \\&#xA;\hat{X}_L= \hat{X}_1\hat{X}_2\hat{X}_3\hat{X}_4\hat{X}_5 \\&#xA;\hat{Z}_L= \hat{Z}_1\hat{Z}_2\hat{Z}_3\hat{Z}_4\hat{Z}_5&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How to find the error syndromes for single qubit &lt;span class=&quot;math-container&quot;&gt;$\hat{X},\hat{Y},\hat{Z}$&lt;/span&gt; errors on qubit 3.&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="1859" LastEditDate="2021-04-09T09:28:18.203" LastActivityDate="2021-04-10T16:33:55.643" Title="Error syndrome on logical operators" Tags="&lt;error-correction&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16871" PostTypeId="1" CreationDate="2021-04-06T05:31:43.487" Score="-1" ViewCount="74" Body="&lt;p&gt;Consider the entanglement-based protocol that in each round Alice prepares a Bell state &lt;span class=&quot;math-container&quot;&gt;$\Phi_+= \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)=\frac{1}{\sqrt{2}}(|++\rangle+|--\rangle)$&lt;/span&gt; and sends one qubit to Bob. Assume Alice and Bob store their qubit in perfect quantum memory. What&#xA;is the reduced density matrix of the ensemble of two-qubit state that is possessed by Alice and Bob&lt;/p&gt;&#xA;" OwnerUserId="14787" LastEditorUserId="2105" LastEditDate="2021-04-06T06:32:24.980" LastActivityDate="2021-04-09T11:57:59.570" Title="Reduced density matrix of the ensemble of two-qubit state that is possessed by Alice and Bob" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16872" PostTypeId="1" CreationDate="2021-04-06T06:18:32.833" Score="1" ViewCount="50" Body="&lt;p&gt;I had to try the example of qiskit’s Traveling Salesman Problem with 3 nodes and executing it at IBM backend called simulator_statevector.Can execute and get the result normally.&lt;/p&gt;&#xA;&lt;p&gt;But when trying to solve the TSP problem with more than 3 nodes,I changed n = 3 to n = 4.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Generating a graph of 3 nodes&#xA;n = 4&#xA;num_qubits = n ** 2&#xA;ins = tsp.random_tsp(n, seed=123)&#xA;print('distance\n', ins.w)&#xA;&#xA;# Draw the graph&#xA;G = nx.Graph()&#xA;G.add_nodes_from(np.arange(0, ins.dim, 1))&#xA;colors = ['r' for node in G.nodes()]&#xA;&#xA;for i in range(0, ins.dim):&#xA;    for j in range(i+1, ins.dim):&#xA;        G.add_edge(i, j, weight=ins.w[i,j])&#xA;&#xA;pos = {k: v for k, v in enumerate(ins.coord)}&#xA;&#xA;draw_graph(G, colors, pos)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And I changed backend from Aer.get_backend ('statevector_simulator') running on my device to provider.backend.simulator_statevector running on the IBM backend.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;aqua_globals.random_seed = np.random.default_rng(123)&#xA;seed = 10598&#xA;backend = provider.backend.simulator_statevector&#xA;#backend = Aer.get_backend('statevector_simulator')&#xA;&#xA;quantum_instance = QuantumInstance(backend, seed_simulator=seed, seed_transpiler=seed)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But the result that comes out with an error.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;energy: -1303102.65625&#xA;time: 5626.549758911133&#xA;feasible: False&#xA;solution: [1, 0, 2, []]&#xA;solution objective: []&#xA;Traceback (most recent call last):&#xA;  File &amp;quot;&amp;lt;ipython-input-10-bc5619b5292f&amp;gt;&amp;quot;, line 14, in &amp;lt;module&amp;gt;&#xA;    draw_tsp_solution(G, z, colors, pos)&#xA;  File &amp;quot;&amp;lt;ipython-input-4-999185567031&amp;gt;&amp;quot;, line 29, in draw_tsp_solution&#xA;    G2.add_edge(order[i], order[j], weight=G[order[i]][order[j]]['weight'])&#xA;  File &amp;quot;/opt/conda/lib/python3.8/site-packages/networkx/classes/coreviews.py&amp;quot;, line 51, in __getitem__&#xA;    return self._atlas[key]&#xA;TypeError: unhashable type: 'list'&#xA;&#xA;Use %tb to get the full traceback.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How should I fix it? Please give me some advice.&lt;/p&gt;&#xA;" OwnerUserId="15446" LastEditorUserId="55" LastEditDate="2021-04-06T21:54:59.790" LastActivityDate="2021-04-06T21:54:59.790" Title="How to solve TSP problem with more than 3 nodes in the tutorial of Max-Cut and Traveling Salesman Problem?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16874" PostTypeId="2" ParentId="16870" CreationDate="2021-04-06T08:30:11.420" Score="0" Body="&lt;p&gt;As JSdJ points out, you need to specify what stabilizers you are actually using before anyone can determine what the syndromes would be given those errors.  See my previous answer &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13365/whats-the-relation-between-the-sign-of-error-correction-code-and-commute-of-ope/13369#13369&quot;&gt;here&lt;/a&gt; for some info about how this works generally, if it helps.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastEditorUserId="4622" LastEditDate="2021-04-06T10:01:39.513" LastActivityDate="2021-04-06T10:01:39.513" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16875" PostTypeId="1" CreationDate="2021-04-06T08:55:05.747" Score="1" ViewCount="44" Body="&lt;p&gt;I am doing Qiskit Lab 4 about Iterative Phase Estimation. I created a circuit implementing IPE for theta = 1/3 (phase of 2pi/3). Here's the circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/6n5Gt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/6n5Gt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seems to do okay if I run it without noise in a QASM sim:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yKFmZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yKFmZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then the lab compares how IPE performs compared to QPE when you add noise - in this lab they use NoiseModel.from_backend() from the Athens IBM computer to simulate the noise.&lt;/p&gt;&#xA;&lt;p&gt;The lab guide says I'm supposed to get something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5UJa0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5UJa0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In reality I get this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/K8bRD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/K8bRD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have zero idea how to approach this problem because I tried inputing several values of theta to simulate in QASM without noise and everything seems to be fine there. Any ideas?&lt;/p&gt;&#xA;&lt;p&gt;For reference, the code implementing IPE is below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;theta = 2/3*math.pi&#xA;IPE = QuantumCircuit(2)&#xA;cregs = []&#xA;IPE.x(1)&#xA;for i in range(n):&#xA;    cregs.append(ClassicalRegister(1))&#xA;    IPE.add_register(cregs[i])&#xA;for i in range(n):&#xA;    IPE.reset(0)&#xA;    IPE.h(0)&#xA;    IPE.crz(theta*(2**(n-i)),0,1)&#xA;    if i &amp;gt; 0:&#xA;        for j in range(i):&#xA;            IPE.rz(-math.pi*2**(j-i),0).c_if(cregs[j],1)&#xA;    IPE.h(0)&#xA;    IPE.measure(0,cregs[i])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;UPDATE: Apparently specifying the initial_layout during transpiling is crucial as it seems to have worked!&lt;/p&gt;&#xA;" OwnerUserId="15411" LastEditorUserId="15411" LastEditDate="2021-04-06T18:11:16.640" LastActivityDate="2021-04-06T18:11:16.640" Title="Iterative Phase Estimation with noise vs standard Quantum Phase Estimation with noise" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;noise&gt;&lt;phase-estimation&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16876" PostTypeId="2" ParentId="16869" CreationDate="2021-04-06T09:31:54.790" Score="1" Body="&lt;p&gt;Nothing goes wrong. A data processing inequality for normalized operators implies a data processing inequality for any positive operators. To see this note that if &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma \geq 0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a,b &amp;gt; 0$&lt;/span&gt; then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D(a \rho \| b \sigma) = a D(\rho\|\sigma) + a \log \frac{a}{b}. &#xA;$$&lt;/span&gt;&#xA;Then define &lt;span class=&quot;math-container&quot;&gt;$a = \mathrm{tr}(\rho)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$b = \mathrm{tr}(\sigma)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat{\rho} = \rho/a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma} = \sigma/b$&lt;/span&gt;.&#xA;Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;D(\rho\|\sigma) = a D(\hat{\rho} \|\hat{\sigma}) + a \log(a/b).&#xA;$$&lt;/span&gt;&#xA;Now consider any CPTP map &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; and note that &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; are left unchanged by &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is trace preserving. Finally we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;D(N(\rho) \| N(\sigma)) &amp;amp;=  D(a N(\rho)/a\| b N(\sigma)/b) \\&#xA;&amp;amp;=  a D( N(\rho)/a\|  N(\sigma)/b) + a \log(a/b) \\&#xA;&amp;amp;= a D(N(\hat{\rho}) \| N(\hat{\sigma}) ) + a\log(a/b) \\&#xA;&amp;amp;\leq a D(\hat{\rho} \| \hat{\sigma}) + a \log(a/b) \\&#xA;&amp;amp;= D(\rho \|\sigma)&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2021-04-08T07:24:49.123" LastActivityDate="2021-04-08T07:24:49.123" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16877" PostTypeId="2" ParentId="16867" CreationDate="2021-04-06T13:01:15.620" Score="1" Body="&lt;p&gt;What you can do to compute &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H_c | \psi \rangle$&lt;/span&gt; with Qiskit, considering what you have, is first convert your circuit from &lt;code&gt;create_circuit&lt;/code&gt; into a state, using &lt;code&gt;CircuitStateFn&lt;/code&gt;. Careful for the importation though, since Qiskit got a recent big release, you will need a different importation whether you are using Qiskit 0.25 or Qiskit 0.24 (and older versions), uncomment the one that is good for your Qiskit version :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#0.24 and before&#xA;#from qiskit.aqua.operators import CircuitStateFn &#xA;#0.25&#xA;#from qiskit.opflow import CircuitStateFn&#xA;psi = CircuitStateFn(circuit)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next you can directly compute &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | H_c | \psi \rangle$&lt;/span&gt; :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;val = psi.adjoint().compose(Hc).compose(psi).eval().real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;A shorter and equivalent expression for &lt;code&gt;val&lt;/code&gt; is this :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;output = (~psi @ Hc @ psi )&#xA;val = output.eval().real&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also, just in case you need it later, you can also compute an approximation from a dict of &lt;code&gt;counts&lt;/code&gt; from measurement of the circuit you are looking at, and a diagonal &lt;code&gt;observable&lt;/code&gt; you study that can be described as a matrix (array), a list describing the diagonal of the matrix, or a dict describing the behaviour over basis states (for example, for &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt;, it would be &lt;span class=&quot;math-container&quot;&gt;$\{&quot;00&quot;: 1, &quot;11&quot;: 1, &quot;01&quot;: -1, &quot;10&quot;: -1\}$&lt;/span&gt; with the eigenvalue for each of the eigenstates). So here you would do something like :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info.analysis import average_data&#xA;mean = average_data(observable, counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-04-06T13:01:15.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16878" PostTypeId="1" CreationDate="2021-04-06T17:37:14.067" Score="2" ViewCount="154" Body="&lt;p&gt;Usually, the textbook starts with a few assumptions of what density operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has.&lt;/p&gt;&#xA;&lt;p&gt;One of them is &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why is that?&lt;/p&gt;&#xA;" OwnerUserId="15456" LastEditorUserId="55" LastEditDate="2021-04-06T21:55:25.197" LastActivityDate="2021-04-07T02:12:34.113" Title="Why does the trace of density operators need to be one?" Tags="&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;trace&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16879" PostTypeId="2" ParentId="16878" CreationDate="2021-04-06T18:05:14.977" Score="2" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a density operator and let &lt;span class=&quot;math-container&quot;&gt;$\{M_x\}_x$&lt;/span&gt; be a POVM. Then the probability we get outcome &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; for the state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is given by the Born rule as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(x) = \mathrm{Tr}[\rho M_x].&#xA;$$&lt;/span&gt;&#xA;But then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\sum_x p(x) &amp;amp;= \sum_x \mathrm{Tr}[\rho M_x] \\&#xA;&amp;amp;= \mathrm{Tr}[\rho \sum_x M_x] \\&#xA;&amp;amp;= \mathrm{Tr}[\rho I] \\&#xA;&amp;amp;= \mathrm{Tr}[\rho] \\&#xA;&amp;amp;= 1&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;where we used the fact that for a measurement &lt;span class=&quot;math-container&quot;&gt;$\sum_x M_x = I$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity operator (also crucial for the probabilities to sum to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;). Thus we see that in order for the probabilities of measurement outcomes to sum to one we require &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[\rho] = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-04-06T18:05:14.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16880" PostTypeId="2" ParentId="16878" CreationDate="2021-04-06T18:12:19.130" Score="2" Body="&lt;p&gt;The unit trace constraint on density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; ensures that the probabilities of measurement outcomes sum to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; for every possible measurement performed on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A measurement can be described by a collection of positive definite operators &lt;span class=&quot;math-container&quot;&gt;$E_m$&lt;/span&gt;, one for each measurement outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, that satisfy the &lt;em&gt;completness relation&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_m E_m = I\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the sum ranges over all measurement outcomes and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; stands for the identity operator. In this description of measurement, known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;POVM&lt;/a&gt;, the probability of outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is &lt;a href=&quot;https://en.wikipedia.org/wiki/Born_rule&quot; rel=&quot;nofollow noreferrer&quot;&gt;given by the formula&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(m|\rho) = \mathrm{tr}(\rho E_m)\tag2.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The unit trace constraint follows from the following simple calculation&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;1 = \sum_m p(m|\rho) = \sum_m \mathrm{tr}(\rho E_m) = \mathrm{tr}\left(\rho \sum_m E_m\right) = \mathrm{tr}(\rho I) = \mathrm{tr}(\rho)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where first we used the fact that the the sum of &lt;span class=&quot;math-container&quot;&gt;$p(m|\rho)$&lt;/span&gt; over all measurement outcomes &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, then we used the Born rule &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt;, then linearity of the trace and finally completeness relation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-06T18:12:19.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16881" PostTypeId="2" ParentId="16868" CreationDate="2021-04-06T18:21:47.893" Score="0" Body="&lt;p&gt;The following works:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sparse_mat = openfermion.get_sparse_operator(ham, n_qubits=n) # type: scipy.sparse.csr_matrix&#xA;mat = sparse_mat.toarray() # type: np.ndarray&#xA;w, v = numpy.linalg.eigh(mat)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then &lt;code&gt;w&lt;/code&gt; will contain the eigenvalues and the columns of &lt;code&gt;v&lt;/code&gt; will contain the eigenvectors. Setting the &lt;code&gt;n_qubits=n&lt;/code&gt; parameter will result in a matrix that gets padded up to &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; which is important if you're going to do further matrix manipulations or algebra involving the matrix representing your Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;And of course, for efficiency reasons you may choose not to cast the sparse operator to a numpy array but then you will end up using sparse matrix functions from scipy, for example &lt;code&gt;scipy.sparse.linalg.eigsh&lt;/code&gt; to find some subset of eigenvalues/eigenvectors of a sparse matrix.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-04-06T18:21:47.893" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16882" PostTypeId="1" CreationDate="2021-04-06T21:16:24.410" Score="-1" ViewCount="54" Body="&lt;p&gt;I’ve got a bit of an elongated plea for aid here!&lt;br /&gt;&#xA;I’ve got some code that finds the optimum angles for QAOA on the Maximum Independent Set Problem. It does however seem about ~10x slower than related code that solves the Maxcut Problem.&lt;br /&gt;&#xA;The issue I think arises from the fact I use &lt;code&gt;QAOAVarForm.construct_circuit()&lt;/code&gt; to generate my circuit whereas the Maxcut program ‘manually’ places in the RX, RZ gates, etc. I’ve made two notebooks that compare the two approaches side by side in-depth:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.dropbox.com/sh/xad0fcl49dbesqw/AABcNSBakS8r21Jh_3SOBaTNa?dl=0&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.dropbox.com/sh/xad0fcl49dbesqw/AABcNSBakS8r21Jh_3SOBaTNa?dl=0&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;(I’ve also included an image from &lt;code&gt;snakeviz&lt;/code&gt; which shows that the problem is coming from &lt;code&gt;pauli_trotter_evolution&lt;/code&gt; script. And for that matter the cProfile Data for this too, under the filename ‘Benchmarking_with_COBYLA’)&lt;/p&gt;&#xA;&lt;p&gt;Here is the engine of my poorly performing code (this is certainly not all the functions required to make it work, those can be found in the notebooks!). Am I doing something incredibly inefficient? Is there a way that speeds up my code? Or would the best be to just manually create the circuit?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def quantum_operator_for_graph(Graph,model_name):&#xA;    '''&#xA;    Generates the quanutm object to be passed to the optimal angles function&#xA;    '''&#xA;    qp = QuadraticProgram()&#xA;    qp.from_docplex(new_docplex_generator(Graph,model_name)) # Putting in Graph&#xA;    quantum_operator, offset = qp.to_ising()&#xA;    return quantum_operator&#xA;&#xA;&#xA;def get_qaoa_circuit_sv(var_form,p, theta):&#xA;    '''&#xA;    Supplies the circuit from var_form to be used in the optimisation stage of the program&#xA;    '''&#xA;    var_qc = var_form.construct_circuit(theta)  # cost operator put in first, then after p the mixer p angles&#xA;    return var_qc&#xA;&#xA;&#xA;def get_black_box_objective_sv(G,p,var_form,seed =10):&#xA;    backend = Aer.get_backend('statevector_simulator')&#xA;    def f(theta):&#xA;        quantum_circuit = get_qaoa_circuit_sv(var_form,p,theta)&#xA;        statevector = execute(quantum_circuit, backend, seed_simulator=seed).result().get_statevector()&#xA;        # return the energy&#xA;        return compute_mwis_energy_sv(get_adjusted_state(statevector), G)&#xA;    return f&#xA;&#xA;&#xA;def get_optimal_angles(Graph,p, quantum_operator, initial_starting_points,seed):&#xA;    '''&#xA;    This performs the classical-quantum interchange, improving the values of beta and gamma by reducing the value of&#xA;    &amp;lt; beta, gamma | -  C | beta, gamma &amp;gt; (Note Negative Sign). Returns the best angles found and the objective value this refers to.&#xA;    Starting points for the angles are randomly distributed across the interval specified.&#xA;    '''&#xA;    var_form = QAOAVarForm(quantum_operator, p)&#xA;    objective_function= get_black_box_objective_sv(Graph,p,var_form,seed)&#xA;    optimiser_function =  minimize(objective_function, initial_starting_points, method='COBYLA', options={'maxiter':500})&#xA;    best_angles = optimiser_function.x&#xA;    objective_value = optimiser_function.fun&#xA;    return best_angles,objective_value&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14866" LastEditorUserId="13471" LastEditDate="2021-04-11T13:52:47.147" LastActivityDate="2021-04-11T13:52:47.147" Title="Optimising Angle Code in Qiskit - Using the QAOAVarForm" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16883" PostTypeId="1" AcceptedAnswerId="16891" CreationDate="2021-04-06T22:23:56.030" Score="-2" ViewCount="38" Body="&lt;p&gt;I have task to calculate this quantum circuit&#xA;&lt;a href=&quot;https://i.stack.imgur.com/0Vw6k.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0Vw6k.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where psi is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;x1 = 5&#xA;x2 = 1&#xA;r = x1 * x1 + x2 * x2&#xA;a = np.sqrt(1 + 2*r)&#xA;psi = [0, 0, 0.5, 0, 0, -0.5, 0, 0, 1/(np.sqrt(2)*a), 0, x1/(np.sqrt(2)*a), x2/(np.sqrt(2)*a), x1/(np.sqrt(2)*a), x2/(np.sqrt(2)*a), 0, 0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I am doing this type of code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(4)&#xA;&#xA;circ.h(0)&#xA;&#xA;meas = QuantumCircuit(4, 4)&#xA;meas.barrier(range(4))&#xA;# map the quantum measurement to the classical bits&#xA;meas.measure(range(4), range(4))&#xA;&#xA;# The Qiskit circuit object supports composition using&#xA;# the addition operator.&#xA;qc = circ + meas&#xA;qc.initialize(psi, 4)&#xA;#drawing the circuit&#xA;backend_sim = Aer.get_backend('qasm_simulator')&#xA;&#xA;# Execute the circuit on the qasm simulator.&#xA;# We've set the number of repeats of the circuit&#xA;# to be 1024, which is the default.&#xA;qc.draw('mpl')&#xA;&#xA;job_sim = execute(qc, backend_sim, shots=1000)&#xA;&#xA;# Grab the results from the job.&#xA;result_sim = job_sim.result()&#xA;counts = result_sim.get_counts(qc)&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But getting this error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CircuitError: 'Index out of range.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If I change qc.initialize like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.initialize(psi, 3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QiskitError: 'Initialize parameter vector has 16 elements, therefore expects 4 qubits. However, 1 were provided.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15459" LastActivityDate="2021-04-07T07:18:14.543" Title="How to calculate quantum circuit with given quantum state?" Tags="&lt;qiskit&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16885" PostTypeId="1" CreationDate="2021-04-06T23:23:17.767" Score="2" ViewCount="70" Body="&lt;p&gt;I know that a one-qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta \in \mathbb C$&lt;/span&gt;, can be represented geometrically on a Bloch sphere as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \cos\theta |0\rangle +e^{\text{i}\phi}\sin \theta |1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, for a two-qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle= \alpha |00\rangle + \beta |11\rangle+\gamma|01\rangle+\delta|10\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\alpha, \beta, \gamma, \delta \in \mathbb C$&lt;/span&gt;, can we find a geometrical representation analog to that of the Bloch sphere?&lt;/p&gt;&#xA;" OwnerUserId="15234" LastEditorUserId="15408" LastEditDate="2021-04-09T09:21:16.150" LastActivityDate="2021-04-09T09:21:16.150" Title="How can one geometrically represent a 2-qubit state?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16886" PostTypeId="2" ParentId="16885" CreationDate="2021-04-07T00:16:21.623" Score="2" Body="&lt;p&gt;A two qubit pure state can be decomposed into 8 &amp;quot;geometric&amp;quot; real parameters:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(4) Latitudes and longitudes of the normalized bloch vectors for the two qubits.&lt;/li&gt;&#xA;&lt;li&gt;(3) Euler angles for a 3d rotation specifying how entanglement translates from one qubit to the other.&lt;/li&gt;&#xA;&lt;li&gt;(1) A &amp;quot;how entangled is it?&amp;quot; weighting value between 0 and 1.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;To compute these values you perform a Schmidt decomposition of the system. The &amp;quot;how entangled is it?&amp;quot; value is the minimum of the two Schmidt coefficients.&lt;/p&gt;&#xA;&lt;p&gt;To get the entanglement rotation's Euler angles: mutate both Schmidt coefficients to be 0.5, put the state vector back together using the mutated coefficients, then interpret it as a 2x2 unitary matrix (instead of a 1x4 vector) and map that unitary matrix from SU(2) to SO(3) in the usual way.&lt;/p&gt;&#xA;&lt;p&gt;To get the normalized bloch vectorss: compute bloch vectors in the usual way, normalize them, then convert to latitude and longitude.&lt;/p&gt;&#xA;&lt;p&gt;Resources: &lt;a href=&quot;https://algassert.com/quantum/2015/04/25/Entangled-States-are-like-Unitary-Matrices.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;entangled states are like unitary matrices&lt;/a&gt; and &lt;a href=&quot;https://algassert.com/post/1716&quot; rel=&quot;nofollow noreferrer&quot;&gt;visualizing 2 qubit entanglement&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-07T00:16:21.623" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16887" PostTypeId="2" ParentId="16878" CreationDate="2021-04-07T02:12:34.113" Score="2" Body="&lt;p&gt;Diagonal element of density matrix represents the probability that the system is in the correspondent basis state (in other words, population of the basis state). The sum of probabilities should be equal to 1, hence the normalization condition&lt;span class=&quot;math-container&quot;&gt;$$Tr(\rho)=1$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastActivityDate="2021-04-07T02:12:34.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16888" PostTypeId="1" AcceptedAnswerId="16889" CreationDate="2021-04-07T03:02:59.127" Score="0" ViewCount="31" Body="&lt;p&gt;Exercise 7 &amp;quot;Preparing an arbitrary state&amp;quot; from the Quantum Katas - Tutorials - SingleQubitGates asks to prepare a state &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + e^{i\theta}\beta|1\rangle$&lt;/span&gt;, using parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In brief, &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; is one of known-inputs, why we don't use &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; for the Ry gate directly ? Something like this..&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Ry(theta, q);&#xA;R1(theta, q); &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But alas, I got error: &lt;br&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Qubit in invalid state. Expecting: Zero &#xA;    Expected:   0 &#xA;    Actual: 0.061208719054813704 &#xA;Try again!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Any ideas would be highly appreciated!!&lt;/p&gt;&#xA;" OwnerUserId="14880" LastEditorUserId="5955" LastEditDate="2021-04-07T08:00:48.797" LastActivityDate="2021-04-07T08:00:48.797" Title="Quantum Katas - Tutorials - SingleQubitGates - Exercise 7 - Preparing an arbitrary state" Tags="&lt;programming&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16889" PostTypeId="2" ParentId="16888" CreationDate="2021-04-07T03:19:59.603" Score="1" Body="&lt;p&gt;The angle to use for Ry gate is not necessarily the same one as the given angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; to use for R1 gate. This means that you need to figure out the angle for Ry gate from the parameters &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;. If you're using &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; for both angles, you'll be preparing a state &lt;span class=&quot;math-container&quot;&gt;$\cos \frac{\theta}{2}|0\rangle + e^{i\theta}\sin \frac{\theta}{2}|1\rangle$&lt;/span&gt;, not &lt;span class=&quot;math-container&quot;&gt;$\alpha|0\rangle + e^{i\theta}\beta|1\rangle$&lt;/span&gt; the task asks for.&lt;/p&gt;&#xA;&lt;p&gt;I recommend checking out the workbook for that tutorial - it has a very detailed explanation of the steps you need to take to solve this task.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-04-07T03:19:59.603" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16890" PostTypeId="1" AcceptedAnswerId="16892" CreationDate="2021-04-07T05:21:36.053" Score="11" ViewCount="1425" Body="&lt;p&gt;It is well known that finding ground states for spin-glass systems (Ising, XY...) is NP-hard (at least as hard as the hardest NP-problems) so that they can be efficiently used to solve other NP problems like the Traveling Salesman Problem. &lt;/p&gt;&#xA;&lt;p&gt;My question is: is the problem NP-complete? This seems to be what is claimed &lt;a href=&quot;https://archive.siam.org/pdf/news/654.pdf&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;. To my understanding, this would mean that apart from NP-hard, the problem is NP itself. But I don't know an obvious algorithm to check if a given solution is the true ground state in polynomial time?&#xA;And actually, I think that a similar argument can be made for the traveling salesman problem.&lt;/p&gt;&#xA;" OwnerUserId="503" LastEditorUserId="2293" LastEditDate="2021-04-08T02:04:18.350" LastActivityDate="2021-04-08T18:27:43.377" Title="Are spin-glass problems NP (-complete)?" Tags="&lt;complexity-theory&gt;&lt;annealing&gt;&lt;spin-glasses&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16891" PostTypeId="2" ParentId="16883" CreationDate="2021-04-07T07:18:14.543" Score="0" Body="&lt;p&gt;As stated &lt;a href=&quot;https://render.githubusercontent.com/view/ipynb?color_mode=light&amp;amp;commit=daeac74ba3b5e021c89397cd8465585f0f49e121&amp;amp;enc_url=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f5169736b69742f7169736b69742d7475746f7269616c732f646165616337346261336235653032316338393339376364383436353538356630663439653132312f7475746f7269616c732f63697263756974732f335f73756d6d6172795f6f665f7175616e74756d5f6f7065726174696f6e732e6970796e62&amp;amp;nwo=Qiskit%2Fqiskit-tutorials&amp;amp;path=tutorials%2Fcircuits%2F3_summary_of_quantum_operations.ipynb&amp;amp;repository_id=99244384&amp;amp;repository_type=Repository#Arbitrary-initialization-&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, for initialization, you should make it as a list. Hence for your case, since it only uses 4 qubits, you could write&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.initialize(psi, [0,1,2,3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, your circuit seems to be a bit off: the resulting circuit of yours would be a Hadamard gate first, followed by a series of measurements, and &lt;strong&gt;then&lt;/strong&gt; the initialization at the end.&lt;/p&gt;&#xA;&lt;p&gt;To build the circuit as in your picture, this code will do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(4)&#xA;&#xA;qc.initialize(psi, [0,1,2,3])&#xA;&#xA;qc.h(0)&#xA;&#xA;qc.measure_all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The resulting circuit would be:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/JdKH7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JdKH7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5911" LastActivityDate="2021-04-07T07:18:14.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16892" PostTypeId="2" ParentId="16890" CreationDate="2021-04-07T07:29:15.740" Score="14" Body="&lt;h2&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;Computational problems come in a variety of types, for example:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;decision problem: given input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, output &amp;quot;YES&amp;quot; if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; belongs to a fixed set &lt;span class=&quot;math-container&quot;&gt;$L$&lt;/span&gt; and output &amp;quot;NO&amp;quot; otherwise,&lt;/li&gt;&#xA;&lt;li&gt;function problem: given input &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, output a &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$(x, y)$&lt;/span&gt; belongs to a fixed relation &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;optimization problem: given objective &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and constraints &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;, output &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; that maximizes &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; while satisfying &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;sampling problem: given a probability distribution &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt;, output a sample &lt;span class=&quot;math-container&quot;&gt;$x\sim P$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Together with the computational model and resource bounds, the type of relevant problems is a key ingredient in a definition of a computational complexity class.&lt;/p&gt;&#xA;&lt;h2&gt;Traveling Salesman Problem&lt;/h2&gt;&#xA;&lt;p&gt;The class NP is defined as a class of &lt;em&gt;decision&lt;/em&gt; problems. The Traveling Salesman Problem formulated as the task of finding the shortest loop traversing all nodes in a graph exactly once is a &lt;em&gt;function&lt;/em&gt; problem and thus - as you suspected in your question - does not belong to NP. However, TSP has a decision version which for a given graph and a threshold length &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; asks whether there is a loop traversing all nodes in the graph exactly once and whose total length is less than &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt;. This problem belongs to NP. The certificate is the path and it is easy to see that it can be checked in polynomial time on a deterministic Turing machine.&lt;/p&gt;&#xA;&lt;h2&gt;Spin glasses&lt;/h2&gt;&#xA;&lt;p&gt;Similarly, the problem of finding the ground state of a spin glass system is a function problem and hence not in NP. The problem has a decision variant which for a given spin glass system and an energy threshold &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; asks whether there is an energy eigenstate with energy below &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. Under certain assumptions about the Hamiltonian, this problem belongs to NP.&lt;/p&gt;&#xA;&lt;p&gt;For example, in the absence of a transversal field, the Ising model is diagonal in a product basis and thus has a product eigenstate for every eigenvalue. Each product state admits a description of size polynomial in the number of sites. We can use such a state as a certificate that can be checked in polynomial time to prove that the model has a state with energy below the threshold &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Terminology&lt;/h2&gt;&#xA;&lt;p&gt;The expression &amp;quot;TSP is NP-complete&amp;quot; is an imprecise shortcut for &amp;quot;the decision version of TSP is NP-complete&amp;quot;. Leaving &amp;quot;decision version&amp;quot; implicit is generally acceptable because only decision problems may be meaningfully declared to be NP-complete.&lt;/p&gt;&#xA;&lt;p&gt;That said, note that it does make sense to say that a computational problem &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; which is not a decision problem is NP-hard. See &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-hardness#Definition&quot; rel=&quot;noreferrer&quot;&gt;Wikipedia&lt;/a&gt; for an explanation.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-07T07:29:15.740" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16893" PostTypeId="1" AcceptedAnswerId="16894" CreationDate="2021-04-07T09:44:42.077" Score="4" ViewCount="63" Body="&lt;p&gt;Suppose there is any arbitrary ansatz producing variational energy for any arbitrary Hamiltonian. What is the physical unit corresponding to the energy? Since numerical algorithms only output a numeric value, the unit is missing. I know for quantum chemistry, it is usually taken to be Hartree. However, not all problem Hamiltonians are from chemistry.&lt;/p&gt;&#xA;" OwnerUserId="15467" LastEditorUserId="5955" LastEditDate="2021-04-07T10:09:03.170" LastActivityDate="2021-04-07T10:33:03.613" Title="What is the physical unit of the energy calculated using VQE on Qiskit?" Tags="&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16894" PostTypeId="2" ParentId="16893" CreationDate="2021-04-07T10:33:03.613" Score="4" Body="&lt;p&gt;&lt;strong&gt;Short answer:&lt;/strong&gt; The units of your result will be the same as the units of your input problem to VQE (units of your Hamiltonian coefficients).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Long answer:&lt;/strong&gt; In a VQE calculation, some problem Hamiltonian is mapped to a representation that is suitable for implementation in a quantum circuit. Often, this means mapping all Hamiltonian operators to strings of Pauli operators with appropriate coefficients.&#xA;Then there are two cases to distinguish.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Given your original problem Hamiltonian corresponds to a physical system, it will have coefficients with units of energy. Take the generic kinetic energy term of a Hamiltonian, &lt;span class=&quot;math-container&quot;&gt;$\hbar^2 \nabla^2 / 2m$&lt;/span&gt; has units of energy (&lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;). Sometimes energies may be expressed in alternative units (e.g. Hartree, eV, etc.) and it is your choice which unit system you use (see &lt;a href=&quot;https://qiskit.org/documentation/tutorials/chemistry/03_ground_state_solvers.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for an example of a ground state calculation of an electronic structure problem in Hartree, but also of a vibrational problem in &lt;span class=&quot;math-container&quot;&gt;$cm^{-1}$&lt;/span&gt;).&#xA;Now, if you do a VQE calculation, the coefficients of your Pauli operators in your qubit-mapped Hamiltonian will have the same units as the coefficients of your original problem Hamiltonian. Your results will then be expressed in the same units.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;VQE is essentially an optimization of a cost function. You can also use VQE to optimize an arbitrary cost function that you construct such that it describes an abstract problem (see for instance the &lt;a href=&quot;https://qiskit.org/documentation/tutorials/optimization/6_examples_max_cut_and_tsp.html?highlight=max%20cut&quot; rel=&quot;nofollow noreferrer&quot;&gt;Max-Cut problem&lt;/a&gt;).&#xA;In that case, your Hamiltonian coefficients will have arbitrary units and so will the VQE result.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15408" LastActivityDate="2021-04-07T10:33:03.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16895" PostTypeId="2" ParentId="3901" CreationDate="2021-04-07T10:49:56.603" Score="-1" Body="&lt;p&gt;You can count the number of single and two qubit gates of your quantum circuit. All you need to do after that is to multiply number of single qubit gates with T1 and number of two qubit gates with T2 and then find an average running time for the whole circuit. Transpiling and being in queue aren't part of running time.&lt;/p&gt;&#xA;" OwnerUserId="12484" LastActivityDate="2021-04-07T10:49:56.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16896" PostTypeId="2" ParentId="16882" CreationDate="2021-04-07T11:58:01.180" Score="1" Body="&lt;p&gt;Thanks for providing all your code. I have looked through it, run both notebooks, and can confirm the difference in the run times. Since you have pretty large amount of the code I have not studied everything till the last line, but I came up with a suspicion when I looked at the Ruslan's code. The profiler output just confirmed what I suspected. Yes, you are right, the problem is in &lt;code&gt;QAOAVarForm.construct_circuit()&lt;/code&gt; and the way how a QAOA circuit is constructed there. As I recall, the implementation relies on &lt;code&gt;PauliTrotterEvolution&lt;/code&gt; to support operators and it is slow. Since you construct a new var form on each iteration, the overall optimization procedure is slow also.&lt;/p&gt;&#xA;&lt;p&gt;If you could use &lt;code&gt;QAOA&lt;/code&gt; directly, as it is designed, then you could speed up your code significantly. In this case var form is created one time per run.&lt;/p&gt;&#xA;" OwnerUserId="15472" LastActivityDate="2021-04-07T11:58:01.180" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16897" PostTypeId="1" AcceptedAnswerId="16898" CreationDate="2021-04-07T12:44:24.037" Score="4" ViewCount="102" Body="&lt;p&gt;Let's say that we have a unitary matrix M such that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = e^{i\pi/8}\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{i\pi/12} \\&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;If we were to apply this unitary matrix to the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we would get:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M|1\rangle\ =\ e^{i\pi/8+i\pi/12}\begin{pmatrix}&#xA;0\\&#xA;1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the global phase is &lt;span class=&quot;math-container&quot;&gt;$ e^{i\pi/8+i\pi/12}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, when we want to convert this global phase into a controlled gate, we would use the following implementation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CM =  |0\rangle\langle0| \bigotimes I + |1\rangle\langle1| \bigotimes M&#xA;$$&lt;/span&gt;&#xA;But would this mean that the global phase does matter in such cases?&lt;/p&gt;&#xA;&lt;p&gt;The way I see it, there are two possibilities:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We do take the global phase into account in the resulting unitary matrix, as such: &lt;span class=&quot;math-container&quot;&gt;$$&#xA;CM = \begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\0 &amp;amp; 0 &amp;amp; e^{i\pi/8} &amp;amp; 0 \\0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{i\pi/8+i\pi/12} \\\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;This option would mean that multiplying with the state &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt;, gives us the state: &lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{|00\rangle + |01\rangle+e^{i\pi/8}|10\rangle+e^{i\pi/8+i\pi/12}|11\rangle}{2}&#xA;$$&lt;/span&gt;&#xA;In this case, M's global phase has changed into a relative phase when applied as a control on the state &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;There is a rule stating that we should not take the global phase into account when converting a gate into a controlled gate.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Could somebody please help me with getting this clear?&lt;/p&gt;&#xA;" OwnerUserId="15473" LastActivityDate="2021-04-07T13:07:44.260" Title="Do global phases matter when a gate is converted into a controlled gate?" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16898" PostTypeId="2" ParentId="16897" CreationDate="2021-04-07T13:07:44.260" Score="4" Body="&lt;p&gt;You are definitely right, for a controlled gate the global phase (of the gate) &lt;em&gt;does&lt;/em&gt; matter. That makes your first possibility the valid one. A rule that we should not take it into account would make things very ambiguous.&lt;/p&gt;&#xA;&lt;p&gt;There is, however, something extra you can say. Let's say we have your gate &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, and a gate &lt;span class=&quot;math-container&quot;&gt;$K = e^{i\phi}M$&lt;/span&gt;, e.g. it acts the same up to a global phase.&#xA;As you pointed out, we have for the controlled versions:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;CM &amp;amp;= |0\rangle\langle 0| \otimes  I + |1\rangle\langle 1| \otimes  M,\\&#xA;CK &amp;amp;= |0\rangle\langle 0| \otimes  I + |1\rangle\langle 1| \otimes  K = |0\rangle\langle 0| \otimes  I + |1\rangle\langle 1| \otimes  e^{i\phi}M \not = CM,\\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;so they are not the same, as there is an extra 'phase' part on only the 'controlled-part'.&lt;/p&gt;&#xA;&lt;p&gt;However, the 'controlled part' is, of course, the part for which the control qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; - and we can effectively change this (relative!) phase by applying a single-qubit operation.&lt;/p&gt;&#xA;&lt;p&gt;Thus, if we first apply &lt;span class=&quot;math-container&quot;&gt;$CK$&lt;/span&gt; and afterwards apply the gate &lt;span class=&quot;math-container&quot;&gt;$R_{z}(-\phi) = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; e^{-i\phi}\end{bmatrix}^{1}$&lt;/span&gt; on the &lt;strong&gt;control&lt;/strong&gt; qubit, we delete the relative phase. That is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;(R_{z}(-\phi) \otimes I) \bullet CK = (R_{z}(-\phi) \otimes I)\bullet (|0\rangle\langle 0| \otimes  I + |1\rangle\langle 1| \otimes  e^{i\phi}M) \hat{=} CM.&#xA;\end{equation}&lt;/span&gt;&#xA;(here, &lt;span class=&quot;math-container&quot;&gt;$\bullet$&lt;/span&gt; means a 'composition' of two maps/gates)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^{1}$&lt;/span&gt;up to your definition, I actually may have omitted a &lt;em&gt;global&lt;/em&gt; phase here - but this really is a global phase, so we can forget about it.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastActivityDate="2021-04-07T13:07:44.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16899" PostTypeId="1" CreationDate="2021-04-07T16:17:22.120" Score="0" ViewCount="37" Body="&lt;p&gt;This question follows the post &lt;a href=&quot;https://quantumcomputing.stackexchange.com/posts/15070/edit&quot;&gt;https://quantumcomputing.stackexchange.com/posts/15070/edit&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I am working on an implementation of HHL algorithm, to do so, I need to map &lt;span class=&quot;math-container&quot;&gt;$|\lambda\rangle\mapsto |\arcsin(\frac{C}{\lambda})\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|\arcsin(\frac{C}{\lambda})\rangle$&lt;/span&gt; is a binary representation &lt;span class=&quot;math-container&quot;&gt;$\arcsin(\frac{C}{\lambda})$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits.&lt;/p&gt;&#xA;&lt;p&gt;Recently, a circuit implementing a Piecewise Chebyshev approximation of a given function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; was implemented in Qiskit, documentation can be found here : &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.PiecewiseChebyshev.html#qiskit-circuit-library-piecewisechebyshev&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.library.PiecewiseChebyshev.html#qiskit-circuit-library-piecewisechebyshev&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I was working on the given example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit import QuantumCircuit&#xA;from qiskit.circuit.library.arithmetic.piecewise_chebyshev import PiecewiseChebyshev&#xA;&#xA;f_x, degree, breakpoints, num_state_qubits = lambda x: 0, 2, None, 2&#xA;pw_approximation = PiecewiseChebyshev(f_x, degree, breakpoints, num_state_qubits)&#xA;pw_approximation._build()&#xA;qc = QuantumCircuit(pw_approximation.num_qubits)&#xA;qc.h(list(range(num_state_qubits)))&#xA;qc.append(pw_approximation.to_instruction(), qc.qubits)&#xA;qc.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which should implement a piecewise approximation of the zero function on two qubits ...&#xA;We can take a look of what the circuit looks like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5eDJg.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5eDJg.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;the first and second qubits are state qubits and I guess that the three others are ancillary qubits.&lt;/p&gt;&#xA;&lt;p&gt;The initial state of the system is set to &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} (|00\rangle+|01\rangle+|10\rangle+|11\rangle)$&lt;/span&gt; so we may look at all possible results of the approximation.&lt;/p&gt;&#xA;&lt;p&gt;But while looking at measurements of the output qubits, I am facing weird results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Se77E.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Se77E.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The third qubit is set to one, while the two first are unchanged. I tried a lot of different functions to understand how one can interpret the resulting qubits, but I still cannot figure out what the circuit does. Does anyone have an idea ?&lt;/p&gt;&#xA;" OwnerUserId="14113" LastEditorUserId="55" LastEditDate="2021-04-08T07:19:05.520" LastActivityDate="2021-04-08T07:19:05.520" Title="Question on qiskit.circuit.library.PiecewiseChebyshev Qiskit circuit library" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16900" PostTypeId="5" CreationDate="2021-04-07T17:26:23.320" Score="0" Body="&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Spin_glass&quot; rel=&quot;nofollow noreferrer&quot;&gt;Spin glasses&lt;/a&gt; are materials with disordered interactions that admit a simple description, e.g. using an &lt;a href=&quot;https://en.wikipedia.org/wiki/Ising_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;Ising model&lt;/a&gt; with random coupling constants. These materials have numerous metastable states and have been studied extensively from the physics and computational complexity point of view.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-04-07T17:26:23.320" LastActivityDate="2021-04-07T17:26:23.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16901" PostTypeId="4" CreationDate="2021-04-07T17:26:23.320" Score="0" Body="For questions related to spin glasses which are disordered materials that admit particularly simple mathematical models such as the Ising model with random couplings." OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-04-07T17:26:23.320" LastActivityDate="2021-04-07T17:26:23.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16902" PostTypeId="2" ParentId="16890" CreationDate="2021-04-08T01:58:23.110" Score="2" Body="&lt;p&gt;I've found this Venn Diagram to be incredibly helpful in understanding the differences between P, NP, NP-Complete, and NP-Hard.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/43nwb.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/43nwb.png&quot; alt=&quot;Venn Diagram&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You're right that Traveling Salesman would not be considered NP-Complete. It's NP-Hard, but not in NP. The only way to verify a solution to Traveling Salesman (that we know of today) is to compare it to the optimal solution... and to get that optimal solution, you'd need to solve the problem. There are a whole bunch of NP-Hard problems that are too hard to be NP, including spin-glass.&lt;/p&gt;&#xA;" OwnerUserId="15478" LastActivityDate="2021-04-08T01:58:23.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16903" PostTypeId="2" ParentId="16890" CreationDate="2021-04-08T02:24:47.667" Score="3" Body="&lt;p&gt;Adam gave an &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16892/2293&quot;&gt;excellent answer&lt;/a&gt; explaining that the &amp;quot;decision version&amp;quot; of the Ising model could be considered NP-complete, but the term doesn't make sense without that extra context.&lt;/p&gt;&#xA;&lt;p&gt;I'll answer some of the other parts which I think were not yet addressed:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;But I don't know an obvious algorithm to check if a given solution is the true ground state in polynomial time?&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you are given a solution to an arbitrary Ising model, for example: 001100110...01101 where 0 means spin-up and 1 means spin-down, there is no way in general to know that it is the true ground state, without checking all &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; possible solutions, which means it can't be done in polynomial time with respect to the number of spins &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. If you have a very specific Ising model, for example the one where there's no linear terms and all couplings between the spins are negative in strength, then you can find the ground state in polynomial time, but there's no way to verify that a solution is the true ground state in polynomial time &lt;em&gt;&lt;strong&gt;in general&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, since you talked about spin-glass systems in general (not just the Ising model, as you specifically mentioned the XY model which unlike the Ising model is not diagonal), I'll mention that the &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0406180&quot; rel=&quot;nofollow noreferrer&quot;&gt;2-local Hamiltonian problem is QMA-complete&lt;/a&gt;, which is the analog of NP-completeness, for when you have access to a quantum computer. &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/11924/2293&quot;&gt;Any Hamiltonian can be decomposed into a sum of products of spin-matrices&lt;/a&gt;, which describes a k-local spin-glass. It was proven that finding the ground state energy of the k-local Hamiltonian accurately is QMA-complete long before the more strong result in that paper I linked earlier, which shows that 2-local Hamiltonians are enough (you don't even need k-local interactions).&lt;/p&gt;&#xA;&lt;p&gt;In fact, the 2D Ising model &lt;em&gt;&lt;strong&gt;with&lt;/strong&gt;&lt;/em&gt; transverse fields is universal, which was proved in &lt;a href=&quot;https://science.sciencemag.org/content/351/6278/1180&quot; rel=&quot;nofollow noreferrer&quot;&gt;this Science paper 5 years ago&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="10480" LastEditDate="2021-04-08T18:27:43.377" LastActivityDate="2021-04-08T18:27:43.377" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16905" PostTypeId="1" AcceptedAnswerId="16907" CreationDate="2021-04-08T12:32:04.213" Score="0" ViewCount="40" Body="&lt;p&gt;I am right now using variational quantum eigensolver (VQE) to calculate the ground state of some molecules, like H2, by qiskit. The quesiton is that how to get the current parameters of the varaional ansatz, like UCCSD for the following code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;import pylab&#xA;import copy&#xA;from qiskit import BasicAer&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE&#xA;from qiskit.aqua.components.optimizers import SLSQP&#xA;from qiskit.chemistry.components.initial_states import HartreeFock&#xA;from qiskit.chemistry.components.variational_forms import UCCSD&#xA;from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;from qiskit.chemistry.transformations import (FermionicTransformation,&#xA;                                              FermionicTransformationType,&#xA;                                              FermionicQubitMappingType)&#xA;from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory&#xA;&#xA;molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                              ['H', [0., 0., 0.735]]],&#xA;                     charge=0, multiplicity=1)&#xA;driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER)&#xA;&#xA;&#xA;vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')))&#xA;&#xA;calc = GroundStateEigensolver(transformation, vqe_solver)&#xA;res = calc.solve(driver)&#xA;&#xA;print(res)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also, I need to simulate the model in the presence of noise, so I need to extract the variational parameters to calculate other properties of the system.&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="55" LastEditDate="2021-04-08T21:32:19.383" LastActivityDate="2021-04-08T21:32:19.383" Title="Getting the current variational parameters in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16906" PostTypeId="2" ParentId="16717" CreationDate="2021-04-08T12:32:56.967" Score="1" Body="&lt;p&gt;The case in which the initial state is bipartite and pure has a geometric solution, please see the &lt;a href=&quot;https://www.researchgate.net/publication/234255507_Manifolds_of_Equal_Entanglement_for_Composite_Quantum_Systems&quot; rel=&quot;nofollow noreferrer&quot;&gt;original construction&lt;/a&gt; by Życzkowski and Kuś and the &lt;a href=&quot;https://arxiv.org/abs/1612.07747v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;review&lt;/a&gt;:  by Bengtsson and Życzkowski. It also appears in section 16.4 of the book:  &lt;a href=&quot;https://www.researchgate.net/profile/Karol-Zyczkowski/publication/325707595_Geometry_of_quantum_states_An_introduction_to_quantum_entanglement/links/5e6ab206299bf12e23c03ea7/Geometry-of-quantum-states-An-introduction-to-quantum-entanglement.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;GEOMETRY OF QUANTUM STATES An Introduction to Quantum Entanglement&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The characterization of the bipartite pure states having the same marginals is that they lie on the same fiber in the bundle structure of a space of equally entangled states over the space of unitary equivalent density matrices whose nonvanishing eigenvalues are the squares of the original state Schmidt coefficients. This characterization can be explained as follows:&lt;/p&gt;&#xA;&lt;p&gt;For a bipartite system, the non-vanishing eigenvalues of the reduced density matrix are the squares of the non-vanishing Schmidt coefficients of the initial pure states. The action of a local unitary transformation &lt;span class=&quot;math-container&quot;&gt;$U \otimes V$&lt;/span&gt; on the initial state produces a unitarily displaced reduced density matrix by &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2$&lt;/span&gt;. Thus, the space unitarily equivalent reduced density matrices  with a given set of non-vanishing eigenvalues is obtained by tracing the states belonging to the space of equally entangled bipartite pure states, whose nonvanishing Schmidt coefficients are the square roots of the eigenvalues. By equally entangled states, it is meant that they lie on a local unitary transformation orbit.&lt;/p&gt;&#xA;&lt;p&gt;Said differently, a space of equally entangled bipartite pure states is a fiber bundle over the unitary orbit  of the reduced density matrix whose non-vanishing eigenvalues is equal to the initial state Schmidt vector.&lt;/p&gt;&#xA;&lt;p&gt;The fibers are isomorphic to &lt;span class=&quot;math-container&quot;&gt;$U(N)/U(m_0)\times U(1)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the dimension of the Hilbert space which was traced on and &lt;span class=&quot;math-container&quot;&gt;$m_0$&lt;/span&gt; is the number of vanishing Schmidt coefficients. The fibers corresponds to spaces of states having the same reduced density matrix. Please see table 16.1 in the third reference for the various orbit structures in the case of 2 qubits and 2 qutrits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Update&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Given a pure state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; living in &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1\otimes\mathcal{H}_2=\mathbb{C}^n\otimes\mathbb{C}^n $&lt;/span&gt;, then its local unitary orbit is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{O} = \mathrm{Span} \left(U(n)\otimes U(n) \circ \Psi \right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is the total space of the bundle: &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}\rightarrow \mathcal{O}\rightarrow \mathcal{M}$&lt;/span&gt;.&#xA;Suppose that the Schmidt coefficients of this state are given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathbf{v_s} = \{\underbrace{0,…}_{m_0 \mathrm{times}}, \underbrace{\lambda_1,…}_{m_1\mathrm{times}}, \underbrace{\lambda_2,…}_{m_2\mathrm{times}}, …\}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then (after tracing on the second factor) base space of the bundle is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{M} = \mathrm{Span} \left(U(n) \circ \mathrm{tr}_2\left(|\Psi\rangle\langle|\Psi|\right) \right)= \mathrm{Ad}\left(U(n)\right) \mathrm{diag}(|\mathbf{v_s}|^2)= U(n)/U(m_0)\times U(m_1)\times U(m_2)…$$&lt;/span&gt;&#xA;The fiber of the bundle is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{F} = U(n)/U(m_0)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(The reason that &lt;span class=&quot;math-container&quot;&gt;$U(m_0)$&lt;/span&gt; appears in the isotropy group of both the base space and the fiber is that the isotropy group of a unit matrix &lt;span class=&quot;math-container&quot;&gt;$\mathbf{1}$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$U(m_1)$&lt;/span&gt;:  &lt;span class=&quot;math-container&quot;&gt;$\mathbf{1} = U \mathbf{1}U^{\dagger} $&lt;/span&gt;, while the isotropy group of a zero matrix is &lt;span class=&quot;math-container&quot;&gt;$U(m_0) \times U(m_0)$&lt;/span&gt;:  &lt;span class=&quot;math-container&quot;&gt;$\mathbf{0} = U \mathbf{0}V^{\dagger} $&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;The span in the base space is due to the first &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; factor of the local unitary group &lt;span class=&quot;math-container&quot;&gt;$ U(n)\otimes U(n)$&lt;/span&gt;, i.e., the factor acting on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt;, while the span in the fiber is the second &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; factor acting on &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2$&lt;/span&gt;. The base space &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is the unitary orbit of the reduced state, thus, if we wish to characterize states descending to the same reduced state, we have to fix the second &lt;span class=&quot;math-container&quot;&gt;$U(n)$&lt;/span&gt; factor, thus remain with a space isomorphic to the fiber &lt;span class=&quot;math-container&quot;&gt;$\mathcal{F}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="4263" LastEditorUserId="4263" LastEditDate="2021-04-13T08:51:20.417" LastActivityDate="2021-04-13T08:51:20.417" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16907" PostTypeId="2" ParentId="16905" CreationDate="2021-04-08T13:08:42.983" Score="2" Body="&lt;p&gt;What I would do here is get back the raw results of your &lt;code&gt;res&lt;/code&gt;, and there are stocked the parameters of the Ansatz you are looking for :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;my_res = res.raw_result&#xA;# The dict of each parameter and its associated value&#xA;my_param_dict = res.raw_result.optimal_parameters&#xA;# The array of all the values&#xA;my_param_list = res.raw_result.optimal_point&#xA;print(my_param_dict)&#xA;print(my_param_list)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And you get this :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{ParameterVectorElement(θ[0]): 2.0215741373141244e-08, ParameterVectorElement(θ[1]): 2.0215741373141244e-08, ParameterVectorElement(θ[2]): -0.11176259664828359}&#xA;&#xA;[ 2.02157414e-08  2.02157414e-08 -1.11762597e-01]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There is also an option with VQE that is to use a callback function storing all the intermediate parameters, see &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12066/vqe-restart-from-a-previous-computation/12524#12524&quot;&gt;the answer here&lt;/a&gt; that explains it very well.&lt;/p&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-04-08T13:08:42.983" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16908" PostTypeId="1" CreationDate="2021-04-08T14:33:09.140" Score="1" ViewCount="38" Body="&lt;p&gt;Numerous studies have investigated the simulation of an X-qubit circuit, demonstrating the 'classical simulation supremacy' on supercomputers. X is less than 50. However, useful VQE circuits are often long and require multiple iterations to converge. I would like to know the largest reported circuit, both in terms of qubit number and depth. My question does not concern VQE on a real device.&lt;/p&gt;&#xA;" OwnerUserId="15467" LastActivityDate="2021-04-08T15:47:50.990" Title="What is the largest reported number of qubits used in a VQE simulation?" Tags="&lt;simulation&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16909" PostTypeId="1" CreationDate="2021-04-08T15:36:29.157" Score="2" ViewCount="101" Body="&lt;p&gt;I have a quantum circuit of 40 qubits with mutliple gate operations being applied to many of the qubits. Currently I am using &lt;strong&gt;qasm simulator&lt;/strong&gt; which for &lt;strong&gt;shots=1&lt;/strong&gt; took 10 hour of time. Is there any other backend which can execute my circuit faster or is there any other process through which I can speed up my execution?&lt;/p&gt;&#xA;" OwnerUserId="13517" LastEditorUserId="2293" LastEditDate="2021-04-10T20:56:52.183" LastActivityDate="2021-04-10T20:56:52.183" Title="Which qiskit backend is faster in execution of the quantum circuit prepared?" Tags="&lt;qiskit&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16910" PostTypeId="2" ParentId="16908" CreationDate="2021-04-08T15:47:50.990" Score="1" Body="&lt;p&gt;There was a paper came out from the quantum group at Google last year titled &lt;a href=&quot;https://arxiv.org/pdf/2004.04174.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;&amp;quot;Hartree-Fock on a superconducting qubit quantum computer&amp;quot;&lt;/a&gt;. There they used &lt;strong&gt;12 qubits&lt;/strong&gt; which is probably one of the largest VQE demonstration on something that is physical realistic.&lt;/p&gt;&#xA;&lt;p&gt;You can always design some ad hoc Hamiltonian that is large but really simple with a relatively simple ground state representation as well (so your VQE circuit or Ansatze doesn't need to be long) and perform your VQE. This would allow you to demonstrate a large VQE experiment but it would be unrealistic. Furthermore, if your Hamiltonian is simple and you also know ahead of time that the ground state is relatively simple, you don't need a quantum computer... you can do it efficiently classically. The point of QC is to look at problems where the ground state is highly &lt;strong&gt;superposition&lt;/strong&gt;  and &lt;strong&gt;entangled&lt;/strong&gt;. This is where it would beat classical computer. This is why you keep seeing people talking about using quantum computer and performing VQE for those highly correlated systems...&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-08T15:47:50.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16911" PostTypeId="1" AcceptedAnswerId="16912" CreationDate="2021-04-08T16:15:13.977" Score="1" ViewCount="68" Body="&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16849/multiplying-quantum-circuits-in-cirq-using-and-computing-expectation-values&quot;&gt;my previous question&lt;/a&gt; I was struggling with the definition of expectation value of an observable for a circuit. Here is what I have derived after some support (I simplify the definition to 2-qubit system (+3rd ancilla)):&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My Definition.&lt;/strong&gt; Given a 2-qubit circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and a 2-qubit observable &lt;span class=&quot;math-container&quot;&gt;$Ob$&lt;/span&gt;, the expectation value of &lt;span class=&quot;math-container&quot;&gt;$Ob$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$$EV(C, Ob):=\sqrt{\sum_{ij}|\alpha_{ij0}|^2} - \sqrt{\sum_{ij}|\alpha_{ij1}|^2},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\alpha_{ijk}$&lt;/span&gt; are such that &lt;span class=&quot;math-container&quot;&gt;$$(Ob_X\circ(C\otimes I))|000⟩=\sum_{ijk}\alpha_{ijk}|ijk⟩,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$Ob_X$&lt;/span&gt; denotes X-Axis control, i.e. &lt;span class=&quot;math-container&quot;&gt;$Ob_X=(I\otimes H)\circ Ob_C\circ(I\otimes H)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$Ob_C$&lt;/span&gt; denotes &lt;span class=&quot;math-container&quot;&gt;$Ob$&lt;/span&gt; controlled by the ancilla qubit.&lt;/p&gt;&#xA;&lt;p&gt;          &#xA;          &#xA;          &#xA;          &#xA;          &#xA;&lt;a href=&quot;https://i.stack.imgur.com/t8Xpl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t8Xpl.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is whether this definition is correct. If so, why does &lt;code&gt;cirq&lt;/code&gt; constrain &lt;code&gt;simulate_expectation_values&lt;/code&gt; method only for observables being Pauli Strings (tensor product of Pauli Gates)?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;After @Craig Gidney answer I thought it would be easy to write (just using &lt;code&gt;cirq&lt;/code&gt; and &lt;code&gt;numpy&lt;/code&gt;) a code that computes expectation value with regard to arbitrary observable and I derived the following snippet:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import cirq&#xA;from copy import deepcopy&#xA;from cirq import X, CZ, H, Circuit, Simulator, GridQubit, InsertStrategy&#xA;import numpy as np&#xA;&#xA;def example_circuit(q0, q1):&#xA;    sqrt_x = X ** 0.5&#xA;    yield sqrt_x(q0), sqrt_x(q1)&#xA;    yield CZ(q0, q1)&#xA;    yield sqrt_x(q0), sqrt_x(q1)&#xA;&#xA;def extend_circ(C, Ob):&#xA;    circ = deepcopy(C)&#xA;    q2 = GridQubit(2, 0)&#xA;    ObC = Ob.controlled_by(q2)&#xA;    circ.append([H(q2), ObC, H(q2)], strategy=InsertStrategy.NEW_THEN_INLINE)&#xA;    return circ&#xA;&#xA;def main():&#xA;    q0 = GridQubit(0, 0)&#xA;    q1 = GridQubit(1, 0)&#xA;&#xA;    C = Circuit(example_circuit(q0, q1))&#xA;    Ob = cirq.X(q0) * cirq.X(q1)&#xA;    # Ob = cirq.X(q0)*cirq.X(q1) + 0.1 * cirq.Z(q0) * cirq.Z(q1)&#xA;&#xA;    ext_circ = extend_circ(C, Ob)&#xA;    print(ext_circ)&#xA;    result = Simulator().simulate(ext_circ)&#xA;    print(result)&#xA;    p0 = np.sqrt(np.sum(np.abs(result.final_state_vector[::2])**2))&#xA;    p1 = np.sqrt(np.sum(np.abs(result.final_state_vector[1::2])**2))&#xA;    expectation_value = p0 - p1&#xA;    print('Expectation Value: {}'.format(expectation_value))&#xA;&#xA;&#xA;if __name__ == '__main__':&#xA;    main()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which gives the following output obtained from prints:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;(0, 0): ───X^0.5───@───X^0.5───────PauliString(+X)───────&#xA;                   │               │&#xA;(1, 0): ───X^0.5───@───X^0.5───────X─────────────────────&#xA;                                   │&#xA;(2, 0): ───────────────────────H───@─────────────────H───&#xA;measurements: (no measurements)&#xA;output vector: 0.5|000⟩ + 0.5j|010⟩ + 0.5j|100⟩ + 0.5|110⟩&#xA;Expectation Value: 0.9999999403953552&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, if I uncomment &lt;code&gt;# Ob = cirq.X(q0)*cirq.X(q1) + 0.1 * cirq.Z(q0) * cirq.Z(q1)&lt;/code&gt; I obtain the error &lt;code&gt;AttributeError: 'PauliSum' object has no attribute 'controlled_by'&lt;/code&gt; which indicates that in order to apply my method an observable must be &amp;quot;controlable&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;My naive question.&lt;/strong&gt; Maybe it would be easier to make in &lt;code&gt;cirq&lt;/code&gt; all observables controlable by definition (i.e. extend &lt;code&gt;controlled_by&lt;/code&gt; method to all observables)?&lt;/p&gt;&#xA;" OwnerUserId="15435" LastEditorUserId="15435" LastEditDate="2021-04-09T15:27:11.307" LastActivityDate="2021-04-09T15:27:11.307" Title="Expectation value of an arbitrary observable. My own definition and `cirq` limitations" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;cirq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16912" PostTypeId="2" ParentId="16911" CreationDate="2021-04-08T16:49:41.280" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;why does cirq constrain simulate_expectation_values method only for observables being Pauli Strings&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It's certainly not a &lt;em&gt;necessary&lt;/em&gt; constraint. But a reason a library would do Pauli products &lt;em&gt;first&lt;/em&gt; is that they are simple, pretty flexible, and widely used. For example, they're easy to measure on hardware (only single qubit operations needed) and they're the basis of the stabilizer formalism.&lt;/p&gt;&#xA;&lt;p&gt;A good contribution to Cirq would be to generalize this method to work on &lt;code&gt;cirq.PauliSum&lt;/code&gt; observables like &lt;code&gt;cirq.X(q1)*cirq.X(q2) + 0.1 * cirq.Z(q1) * cirq.Z(q2)&lt;/code&gt;. Cirq doesn't really have a more general definition of observable than that at the moment IIRC.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-08T16:49:41.280" CommentCount="11" ContentLicense="CC BY-SA 4.0" />
  <row Id="16914" PostTypeId="1" AcceptedAnswerId="16920" CreationDate="2021-04-08T18:59:40.927" Score="0" ViewCount="28" Body="&lt;p&gt;I am a bit stuck in decomposing these gates in single qubit gates, in the Cirq documentation it is written, for example that XX is for example the tensor product of Rx gates. But when I calculate these, I get terms with sin*cos where they write a 0.&#xA;Is there any trick/explanation for this?&lt;/p&gt;&#xA;" OwnerUserId="13353" LastEditorUserId="55" LastEditDate="2021-04-08T21:31:04.100" LastActivityDate="2021-04-08T21:31:04.100" Title="How can I compose the Ising XXPOW,YYPOW and ZZPOW gate in single qubit gates and CNOT,...?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;pauli-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16915" PostTypeId="2" ParentId="16909" CreationDate="2021-04-08T19:17:44.187" Score="0" Body="&lt;p&gt;I am confident that you cannot simulate 40 qubits full-statevector on your 16GB RAM. For a 40 qubit simulation, you would require a RAM of 16TB, not GB. So I would strongly suggest checking your circuit.&lt;/p&gt;&#xA;&lt;p&gt;I cannot speak for how Qiskit works under the hood, but usually, all simulators sample from the underlying statevector, and there is no way to store the statevector of a 40 qubit circuit in 16GB RAM.&lt;/p&gt;&#xA;&lt;p&gt;IBM offers their qasm simulator through the cloud, which can do up to 32 qubits. You may want to try that if you are looking to speed things up.&lt;/p&gt;&#xA;" OwnerUserId="15467" LastEditorUserId="15467" LastEditDate="2021-04-09T17:39:34.987" LastActivityDate="2021-04-09T17:39:34.987" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16916" PostTypeId="1" AcceptedAnswerId="16921" CreationDate="2021-04-08T19:25:00.627" Score="2" ViewCount="56" Body="&lt;p&gt;I'm drawing with Qiskit a big circuit with some predefined and custom gates. I want to colour some of them in non-default colours for a better reading of it. Is it possible to do it for predefined gates? And for custom ones? Here is some code to play with:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;&#xA;def cnotnot(gate_label = 'CNOTNOT'):&#xA;&#xA;    gate_circuit = QuantumCircuit(3, name = gate_label)&#xA;    gate_circuit.cnot(0, 1)&#xA;    gate_circuit.cnot(0, 2)&#xA;&#xA;    gate = gate_circuit.to_gate()&#xA;&#xA;    return gate&#xA;&#xA;q = QuantumRegister(3, name = 'q')&#xA;&#xA;circuit = QuantumCircuit(q)&#xA;&#xA;circuit.append(cnotnot(), [q[0], q[1], q[2]])&#xA;circuit.h(q[0])&#xA;&#xA;circuit.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="15391" LastEditorUserId="1859" LastEditDate="2021-04-09T05:21:43.043" LastActivityDate="2021-04-09T09:20:55.207" Title="Is there any way to assign a colour for a single gate in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16917" PostTypeId="1" AcceptedAnswerId="16926" CreationDate="2021-04-08T19:59:46.120" Score="2" ViewCount="88" Body="&lt;p&gt;So recently I was building some circuit made of subcircuits. My subcircuits happen to use auxiliary qubits, that are always initialized in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and are not used after the calculation. Hence, I wanted to use the same set of auxiliary qubits for all the subcircuits by reinitializing them between subcircuits. As I code on Qiskit, I used reset gates to do so.&lt;/p&gt;&#xA;&lt;p&gt;But I have a problem : my circuit is correct on each possible input state that belongs to the basis &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}^{\otimes n}$&lt;/span&gt;, but the reset gates make it fail for any superposed state, henceforth losing all quantum advantage.&lt;/p&gt;&#xA;&lt;p&gt;I'll explain the problem with a simplified example : let's say that I have two subcircuits, C and C', that operate on 1 main qubit (that I want to change) and use 1 auxiliary qubit. When C takes as input &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; for the main qubit, it outputs the main qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and leaves the auxiliary qubits in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and when it takes as input &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; for the main qubit, it outputs the main qubit in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and gets the auxiliary qubits in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. My full circuit resets the auxiliary gate between C and C' (with the Qiskit reset gate) and then C' is applied to get the wanted output on the main qubit. Now, if I input the state &lt;span class=&quot;math-container&quot;&gt;$\frac{|0\rangle+|1\rangle}{\sqrt{2}}$&lt;/span&gt; on the main qubit, which is overall (taking into account the auxiliary qubit) the input state &lt;span class=&quot;math-container&quot;&gt;$\frac{|0\rangle+|1\rangle}{\sqrt{2}} \otimes |0\rangle$&lt;/span&gt;, after C we get :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|00\rangle+|11\rangle}{\sqrt{2}}$$&lt;/span&gt;&#xA;But then after the reset gate we don't get :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{|00\rangle+|10\rangle}{\sqrt{2}}$$&lt;/span&gt;&#xA;But &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; 50% of the time and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; 50% of the time. As superposition is broken, the main circuit gets flawed.&lt;/p&gt;&#xA;&lt;p&gt;This behavior can be reproduced with the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc=QuantumCircuit(2)&#xA;qc.h(0)&#xA;qc.cx(0,1)&#xA;qc.reset(1)&#xA;backend=Aer.get_backend('statevector_simulator')&#xA;plot_histogram(execute(qc,backend,shots=1024).result().get_counts())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And by the way, in my understanding, this is in disagreement with this &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/12823/14793&quot;&gt;answer&lt;/a&gt; - which motivated me to ask my question, even if it may seem redundant at first sight.&lt;/p&gt;&#xA;&lt;p&gt;Is there a way I could fix that ?&lt;/p&gt;&#xA;&lt;p&gt;I am pessimistic, as in my previous example, the operation I'd like to apply isn't unitary. But I know that I can find on this site people that are amazing at quantum computing, so I have hope that a solution can be found.&lt;/p&gt;&#xA;&lt;p&gt;Thanks a lot,&lt;/p&gt;&#xA;&lt;p&gt;Thomas&lt;/p&gt;&#xA;" OwnerUserId="14793" LastEditorUserId="14793" LastEditDate="2021-04-09T06:04:01.153" LastActivityDate="2021-04-10T07:42:54.303" Title="Re-initializing qubits in a circuit without losing superposition" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16918" PostTypeId="2" ParentId="14355" CreationDate="2021-04-08T20:12:04.960" Score="0" Body="&lt;p&gt;Short answer, 'no'.&lt;/p&gt;&#xA;&lt;p&gt;Long answer: I think a lot of mystery about quantum mechanics has the possibility to disappear when we do simulations, like the ones you are suggesting.&lt;/p&gt;&#xA;&lt;p&gt;For my answer, I will assume that whatever you are going to do with your 4 (or larger) qubit system, it will be at least 'entangled', in the sense that the final state is not a product state (not interesting, in simple words).&lt;/p&gt;&#xA;&lt;p&gt;The fundamental limitation of using a quantum mechanical description of reality is that one has to use all 2^4 complex numbers to represent the state.&lt;/p&gt;&#xA;&lt;p&gt;Now, there are multiple ways to answer your question. One would be to call for a no-go sort of argument like this. If what you suggest was possible, we would not require a 2^4 complex numbers representation, which implies that we have an equivalent description of reality that does not require quantum mechanics. But since quantum mechanics is the ultimate theory of the univer..., I would say no-go to this argument.&lt;/p&gt;&#xA;&lt;p&gt;The other way to answer your question is to ask: Can you represent (and scale it up) all the information stored in 2^N complex numbers, in &amp;lt;2^N complex numbers? I would guess, in general, 'no'.&lt;/p&gt;&#xA;" OwnerUserId="15467" LastEditorUserId="15467" LastEditDate="2021-04-09T17:43:44.823" LastActivityDate="2021-04-09T17:43:44.823" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16919" PostTypeId="1" AcceptedAnswerId="16956" CreationDate="2021-04-08T20:15:12.067" Score="2" ViewCount="94" Body="&lt;p&gt;Consider the XQUATH conjectures, as defined here (&lt;a href=&quot;https://arxiv.org/abs/1910.12085&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1910.12085&lt;/a&gt;, Definition 1).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;(XQUATH, or Linear Cross-Entropy Quantum Threshold Assumption). There&#xA;is no polynomial-time classical algorithm that takes as input a&#xA;quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C \leftarrow D$&lt;/span&gt; and produces an estimate &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; of&#xA;&lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; = Pr[C outputs &lt;span class=&quot;math-container&quot;&gt;$|0^{n}\rangle$&lt;/span&gt;] such that &lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA; E[(p_0 − p)^{2}] = E[(p_0 − 2^{−n})^{2}] − Ω(2^{−3n}) \end{equation}&lt;/span&gt;&#xA;where the expectations are taken over circuits &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; as well as the&#xA;algorithm’s internal randomness.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here, &lt;span class=&quot;math-container&quot;&gt;$D$&lt;/span&gt; is any distribution &amp;quot;over circuits on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits that is unaffected by appending NOT gates to any subset of the qubits at the end of the circuit.&amp;quot; For the purposes of our discussion, we can assume the circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; to be a particular Haar random unitary.&lt;/p&gt;&#xA;&lt;p&gt;So, we believe the task mentioned in XQUATH is hard for classical computers. But how hard is the task for quantum computers? If it is easy for quantum computers, what is the algorithm?&lt;/p&gt;&#xA;&lt;p&gt;A trivial algorithm I can think of just runs the quantum circuit many times, samples from the output distribution of the circuit each time, and then computes the frequency of observing &lt;span class=&quot;math-container&quot;&gt;$|0^{n}\rangle$&lt;/span&gt;. But what is the guarantee that this procedure will give us an additive error estimate robust enough to meet the condition of XQUATH?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2021-04-11T14:09:22.390" Title="Quantum hardness of XQUATH conjecture" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;quantum-advantage&gt;&lt;haar-distribution&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16920" PostTypeId="2" ParentId="16914" CreationDate="2021-04-08T20:53:24.763" Score="1" Body="&lt;p&gt;XXPow isn't a tensor product of Rx gates. It raises the matrix resulting from such a tensor product to a power, but the result is not expressible as a tensor product anymore.&lt;/p&gt;&#xA;&lt;p&gt;If you want to decompose into CNOT gates, the key thing you need to know is that you can change the observable being exponentiated by conjugating it with Clifford operations. For example, if you conjugate XX with CNOTs, the result is a single X on the control. Meaning you can decompose &lt;span class=&quot;math-container&quot;&gt;$(X \otimes X)^t$&lt;/span&gt; into this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hqvRk.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hqvRk.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can decompose the other ones similarly. Cirq can perform this decomposition for you, although it outputs CZ gates instead of CNOTs, via &lt;code&gt;cirq.two_qubit_matrix_to_operations&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-08T20:53:24.763" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16921" PostTypeId="2" ParentId="16916" CreationDate="2021-04-09T05:40:18.977" Score="4" Body="&lt;p&gt;I think it is something Qiskit used to have but got lost in a refactoring. I'm adding it back here &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/6184&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-terra/pull/6184&lt;/a&gt; (with a regression test so it does not happen again) and it will probably be released in the next qiskit-terra patch version (0.17.1).&lt;/p&gt;&#xA;&lt;p&gt;Here is your example (including &lt;code&gt;displaytext&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister&#xA;&#xA;def cnotnot(gate_label = 'CNOTNOT'):&#xA;&#xA;    gate_circuit = QuantumCircuit(3, name = gate_label)&#xA;    gate_circuit.cnot(0, 1)&#xA;    gate_circuit.cnot(0, 2)&#xA;&#xA;    gate = gate_circuit.to_gate()&#xA;&#xA;    return gate&#xA;&#xA;q = QuantumRegister(3, name = 'q')&#xA;&#xA;circuit = QuantumCircuit(q)&#xA;&#xA;circuit.append(cnotnot(), [q[0], q[1], q[2]])&#xA;circuit.append(cnotnot('CNOTNOT_PRIME'), [q[0], q[1], q[2]])&#xA;circuit.h(q[0])&#xA;&#xA;circuit.draw('mpl',&#xA;             style={'displaycolor': {'CNOTNOT': ('#000000', '#FFFFFF'),&#xA;                                           'h': ('#A1A1A1', '#043812')},&#xA;                    'displaytext': {'CNOTNOT_PRIME': &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\\mathrm{CNOTNOT}'$&lt;/span&gt;&amp;quot;}})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/NU15k.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/NU15k.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="15408" LastEditDate="2021-04-09T09:20:55.207" LastActivityDate="2021-04-09T09:20:55.207" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16922" PostTypeId="1" AcceptedAnswerId="16924" CreationDate="2021-04-09T05:45:09.910" Score="1" ViewCount="54" Body="&lt;p&gt;I would like to use a general entangler in the entanglement_block of the TwoLocal function. The function seems to work with 'cz', 'cx', 'swap' gates, but it fails for 'iswap' gate. Below is the error message. Any help would be appreciated&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import TwoLocal&#xA;ansatz = TwoLocal(num_spin_orbitals, ['ry', 'rz'], entanglement_blocks = 'iswap', entanglement='linear')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Gives the following error&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):&#xA;  File &amp;quot;&amp;lt;ipython-input-34-5d8e95fd9811&amp;gt;&amp;quot;, line 2, in &amp;lt;module&amp;gt;&#xA;    ansatz = TwoLocal(num_spin_orbitals, ['ry', 'rz'], entanglement_blocks = 'iswap', entanglement='linear')&#xA;  File &amp;quot;/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/two_local.py&amp;quot;, line 177, in __init__&#xA;    super().__init__(num_qubits=num_qubits,&#xA;  File &amp;quot;/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py&amp;quot;, line 140, in __init__&#xA;    self.entanglement_blocks = entanglement_blocks&#xA;  File &amp;quot;/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py&amp;quot;, line 248, in entanglement_blocks&#xA;    self._entanglement_blocks = [self._convert_to_block(block) for block in blocks]&#xA;  File &amp;quot;/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/n_local.py&amp;quot;, line 248, in &amp;lt;listcomp&amp;gt;&#xA;    self._entanglement_blocks = [self._convert_to_block(block) for block in blocks]&#xA;  File &amp;quot;/opt/conda/lib/python3.8/site-packages/qiskit/circuit/library/n_local/two_local.py&amp;quot;, line 248, in _convert_to_block&#xA;    raise ValueError(f'Unknown layer name `{layer}`.') from ex&#xA;ValueError: Unknown layer name `iswap`.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="11622" LastEditorUserId="55" LastEditDate="2021-04-09T09:01:57.473" LastActivityDate="2021-04-09T14:35:05.823" Title="Unable to use iSWAP in Qiskit TwoLocal entangling_block" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16923" PostTypeId="2" ParentId="16917" CreationDate="2021-04-09T07:15:38.580" Score="2" Body="&lt;p&gt;According to &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/systems/reset/backend_reset&quot; rel=&quot;nofollow noreferrer&quot;&gt;this link&lt;/a&gt;, IBM does not implement Reset instruction as a swap gate between the target qubit and a new ancilla qubit in the &lt;span class=&quot;math-container&quot;&gt;$|0⟩$&lt;/span&gt; state. It is implemented as a&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;not-gate conditioned on the&#xA;measurement outcome of the qubit&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Which means your circuit is equivalent to the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/hQjQi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/hQjQi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This should explain the results you have obtained.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-04-09T07:15:38.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16924" PostTypeId="2" ParentId="16922" CreationDate="2021-04-09T07:32:43.867" Score="3" Body="&lt;p&gt;Although the documentation says that the &lt;code&gt;entanglement_blocks&lt;/code&gt; parameter can be specified via the name of a gate or the gate type itself, not all gates can be used this way.&#xA;You can &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/circuit/library/n_local/two_local.html#TwoLocal&quot; rel=&quot;nofollow noreferrer&quot;&gt;check the code&lt;/a&gt; to get the list of supported gate names.&lt;/p&gt;&#xA;&lt;p&gt;Since &amp;quot;pass by name&amp;quot; is not supported for iSWAP, you can use the gate type:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;ansatz = TwoLocal(num_spin_orbitals, ['ry', 'rz'], entanglement_blocks = iSwapGate(), entanglement='linear')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="15408" LastEditDate="2021-04-09T14:35:05.823" LastActivityDate="2021-04-09T14:35:05.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16925" PostTypeId="2" ParentId="16909" CreationDate="2021-04-09T08:00:14.963" Score="4" Body="&lt;p&gt;I can think of several ways to work with that many qubits.&lt;/p&gt;&#xA;&lt;p&gt;First, via the simulators of Aer, by using the &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/7_matrix_product_state_method.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;matrix product state simulation method&lt;/a&gt; for example.&lt;br /&gt;&#xA;The main idea is to write the statevector so that, as written in the tutorial, &amp;quot;the size of the overall structure remains ‘small’ for circuits that do not have ‘many’ two-qubit gates. This allows much more efficient operations in circuits with relatively ‘low’ entanglement.&amp;quot;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import AerSimulator&#xA;# Select the AerSimulator from the Aer provider&#xA;simulator = AerSimulator(method='matrix_product_state') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There are other simulation methods possible, see all of them &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/1_aer_provider.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Another solution would be to explore all the recent simulators of the cloud, all explained &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/simulator/&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, I advisee you to read all of this, you might find your happiness. You can see that for &lt;code&gt;simulator_mps&lt;/code&gt;, &lt;code&gt;simulator_extended_stabilizer&lt;/code&gt; and &lt;code&gt;simulator_stabilizer&lt;/code&gt; you can use more qubits than the recurrent 32 of the &amp;quot;classical&amp;quot; qasm_simulator, with some conditions on each as you can see.&lt;br /&gt;&#xA;Just bear in mind that since they are simulators on the cloud, it might take a little more time that the local simulator, but I think it would still be gained time in comparison to what you actually have.&lt;/p&gt;&#xA;&lt;p&gt;Hope that with this, your circuit will run just fine! Good luck :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="12396" LastEditDate="2021-04-09T12:22:24.820" LastActivityDate="2021-04-09T12:22:24.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16926" PostTypeId="2" ParentId="16917" CreationDate="2021-04-09T09:45:40.767" Score="3" Body="&lt;p&gt;The important point to understand is that you lose the superposition and obtain a &lt;em&gt;classical mixture&lt;/em&gt; of states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on the first qubit.&#xA;If you look at the circuit diagram below:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Before applying the reset you're in a Bell state (green).&lt;/li&gt;&#xA;&lt;li&gt;As you apply the reset, you effectively remove the qubit from the system, you can think of it as tracing it out. If you trace out system B in the Bell state you obtain a maximally mixed state (blue).&lt;/li&gt;&#xA;&lt;li&gt;Finally, you add a new qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; that has no correlation whatsoever with qubit A, so you end up in a product state of a mixed state and the zero state (red).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4CQj9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4CQj9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This means your final state is &lt;strong&gt;not&lt;/strong&gt; a pure state where the first qubit is in state &lt;span class=&quot;math-container&quot;&gt;$\frac{|0\rangle + |1\rangle}{2}$&lt;/span&gt; and the second one, reset, in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Instead, it is a mix of &lt;strong&gt;classical probabilities&lt;/strong&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB} = (p_1 \rho_1 + p_2 \rho_2) \otimes |0\rangle\langle 0|&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$p_1 = p_2 = 1/2$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1 = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 0 \end{pmatrix}, &#xA;\rho_2 = \begin{pmatrix} 0 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you now perform a statevector simulation of this circuit, you have a 50% probability of measuring state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and 50% of measuring &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. Running this in Qiskit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;&#xA;circuit = QuantumCircuit(2)&#xA;circuit.h(0)&#xA;circuit.cx(0, 1)&#xA;circuit.reset(1)&#xA;&#xA;print(circuit.draw())&#xA;&#xA;backend = Aer.get_backend('statevector_simulator')&#xA;statevector = execute(circuit, backend).result().get_statevector()&#xA;print('Statevector')&#xA;print(statevector)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;will print &lt;code&gt;[1, 0, 0, 0]&lt;/code&gt; in half the cases and &lt;code&gt;[0, 1, 0, 0]&lt;/code&gt; in the other half. It is a classical combination of quantum states, not a superposition like &lt;code&gt;[0.707, 0.707, 0, 0]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What's a bit confusing now is that counting shots gives the same histogram for the classical mix of quantum states as for superposition. That's because the probability to measure either &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; is the same for both.&#xA;In Qiskit code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(2)&#xA;circuit.h(0)&#xA;circuit.cx(0, 1)&#xA;circuit.reset(1)&#xA;circuit.measure_all() &#xA;&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;counts = execute(circuit, backend).result().get_counts()&#xA;print('Counts')&#xA;print(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Will give on average &lt;code&gt;{'00': 512, '10': 512}&lt;/code&gt;.&#xA;But the pure state $|\phi\rangle = \frac{|0\rangle + |1\rangle}{2} \otimes |0\rangle$ will give the same histogram:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(2)&#xA;circuit.h(0)&#xA;circuit.measure_all() &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;A reset is a very &amp;quot;brutal&amp;quot; non-unitary operation and will destroy the pure state you have.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Note: you can derive the same result by computing the density matrices in the circuit from @Egretta.Thula, I just skipped it to make the diagram easier.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="15408" LastEditDate="2021-04-10T07:42:54.303" LastActivityDate="2021-04-10T07:42:54.303" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16927" PostTypeId="1" AcceptedAnswerId="16960" CreationDate="2021-04-09T10:14:06.907" Score="2" ViewCount="126" Body="&lt;p&gt;What are my options for &lt;em&gt;computing symbolic results for quantum circuits&lt;/em&gt;?&lt;/p&gt;&#xA;&lt;p&gt;I have identified some possibilities:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://docs.sympy.org/latest/modules/physics/quantum/index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;SymPy&lt;/a&gt; (Python library, see also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9984/symbolic-quantum-computing-using-sympy-how-to-use-arbitrary-gate&quot;&gt;this&lt;/a&gt;), unfortunately, the software forces you to encode the matrix of each gate explicitly instead of working with circuits;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/operators/01_operator_flow.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Qiskit v0.25 operator framework&lt;/a&gt; (Python library), which claims&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Qiskit operators fully support parameterization&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;even if it seems not completely true since the same error of &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/14867/creating-a-parameterized-operator-in-qiskit&quot;&gt;this older question&lt;/a&gt; holds and &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/issues/4751&quot; rel=&quot;nofollow noreferrer&quot;&gt;this issue&lt;/a&gt; is still open.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="1874" LastEditDate="2021-04-11T14:20:15.583" LastActivityDate="2021-04-13T18:55:43.797" Title="Symbolic computation with quantum circuits" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16928" PostTypeId="1" CreationDate="2021-04-09T10:41:54.350" Score="2" ViewCount="127" Body="&lt;p&gt;I wonder if we can utilize Grover's algorithm to solve the following search problem.&lt;/p&gt;&#xA;&lt;p&gt;Leetcode 33. &lt;a href=&quot;https://leetcode.com/problems/search-in-rotated-sorted-array/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Search in Rotated Sorted Array&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Example 1:&lt;/p&gt;&#xA;&lt;p&gt;Input: nums = [4,5,6,7,0,1,2], target = 0&lt;/p&gt;&#xA;&lt;p&gt;Output: true&lt;/p&gt;&#xA;&lt;p&gt;Example 2:&lt;/p&gt;&#xA;&lt;p&gt;Input: nums = [4,5,6,7,0,1,2], target = 3&lt;/p&gt;&#xA;&lt;p&gt;Output: false&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Let's ignore the fact that &amp;quot;the array &lt;code&gt;nums&lt;/code&gt; sorted in ascending order&amp;quot; initially and suppose this array is an unstructured list of integers, which satisfied with the problem setting about Grover's algorithm.&lt;/p&gt;&#xA;&lt;p&gt;So, can I use this Quantum algorithm to solve this problem with &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N})$&lt;/span&gt; complexity?&lt;/p&gt;&#xA;&lt;p&gt;How to make an initial uniform superposition with &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; states, which &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is not 2, 4, 8, 16 etc.? For example, I can use 2 qubits and 2 &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates to construct a superposition about &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, with uniform probabilities &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;. But what about a list containing only 3 integers, &lt;code&gt;[0, 2, 3]&lt;/code&gt;, corresponding &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{3}}(|00\rangle + |10\rangle + |11\rangle)$&lt;/span&gt;. How to use quantum circuit to express this superposition?&lt;/p&gt;&#xA;" OwnerUserId="15495" LastEditorUserId="9006" LastEditDate="2021-04-10T07:48:56.007" LastActivityDate="2021-04-12T17:11:46.570" Title="Is Grover's algorithm suitable for this search problem?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16929" PostTypeId="2" ParentId="16871" CreationDate="2021-04-09T11:57:59.570" Score="1" Body="&lt;p&gt;The reduced density matrix is &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}\frac{1}{2} &amp;amp; 0 \\ 0 &amp;amp; \frac{1}{2}\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This easily seen by taking the partial trace over the subsystem of A:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$Tr_{A}\begin{bmatrix}\frac{1}{2}&amp;amp;0&amp;amp;0&amp;amp;\frac{1}{2} \\ 0&amp;amp;0&amp;amp;0&amp;amp;0\\0&amp;amp;0&amp;amp;0&amp;amp;0\\\frac{1}{2}&amp;amp;0&amp;amp;0&amp;amp;\frac{1}{2}\end{bmatrix}=\frac{|0\rangle\langle0|\langle0|0\rangle}{2}+\frac{|1\rangle\langle1|\langle1|1\rangle}{2}+\frac{|1\rangle\langle0|Tr_{A}(|1\rangle\langle0|)}{2}+\frac{|0\rangle\langle1|Tr_{A}(|0\rangle\langle1|)}{2} =\frac{|0\rangle\langle0|}{2}+\frac{|1\rangle\langle1|}{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2021-04-09T11:57:59.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16930" PostTypeId="1" CreationDate="2021-04-09T16:27:06.260" Score="0" ViewCount="19" Body="&lt;p&gt;Hi thanks for taking a quick look!&lt;/p&gt;&#xA;&lt;p&gt;I’ve got a question of how weights are implemented in the angles for gates in the QAOA.&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to solve the Maximum Weighted Independent Set Problem&#xA;This is the problem as a binary optimisation:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \max    y\left(x_{1}, \ldots, x_{n}\right)=\sum_{i \in \mathrm{V}} c_{i} x_{i}-\sum_{(i,j) \in   \mathrm{E}} J_{i j} x_{i} x_{j},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where the first sum adds the weights the weight of the node &lt;span class=&quot;math-container&quot;&gt;$c_{i}$&lt;/span&gt; only if the binary variable &lt;span class=&quot;math-container&quot;&gt;$x_{i}$&lt;/span&gt; indicates it is in the set. The independence is assured by the sum over the edges, giving  the penalty &lt;span class=&quot;math-container&quot;&gt;$J_{ij}$&lt;/span&gt; if both nodes &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; are in the set. The necessary condition for the &lt;span class=&quot;math-container&quot;&gt;$J_{ij}$&lt;/span&gt; is that it has to be greater than the smallest of the two node weights &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To convert this to a quantum Hamiltonian, we substitute in the standard Pauli-Z transformation,&#xA;&lt;span class=&quot;math-container&quot;&gt;$ x_{i} = \frac{1}{2}(1-Z_{i})$&lt;/span&gt; giving:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_c=\sum_{i \in \mathrm{V}}^{n} \frac{c_{i}}{2}(I-Z_{i}) +\sum_{i, j\ \in {E}}^{m} \frac{J_{i j}}{4}\left(I-Z_{i}\right)\left(I-Z_{j}\right) = \sum_{i \in \mathrm{V}}^{n} \frac{c_{i}}{2}(I-Z_{i}) - \sum_{i, j\ \in {E}}^{m}\frac{J_{i j}}{4}(I-Z_{i}-Z_{j}+Z_{i}Z_{j}) &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ H_c=&#xA;\sum_{i \in \mathrm{V}}^{n} \frac{c_{i}}{2}(I-Z_{i}) - \sum_{i, j\ \in {E}}^{m}\frac{J_{i j}}{4}(I+Z_{i}Z_{j})  &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now we can cancel the constant terms to give:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ H_c=&#xA;-\sum_{i \in \mathrm{V}}^{n} \frac{c_{i}}{2}Z_{i} - \sum_{i, j\ \in {E}}^{m}\frac{J_{i j}}{4}Z_{i}Z_{j} + const.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For QAOA, we put this &lt;span class=&quot;math-container&quot;&gt;$H_c$&lt;/span&gt; into a unitary of form &lt;span class=&quot;math-container&quot;&gt;$e^{-i \gamma H_{c}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$Z_{i}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_{i}Z_{j}$&lt;/span&gt; terms commute, so  we can split the unitaries into the form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \exp{\{ -i \gamma ( - \sum_{i \in \mathrm{V}}^{n} \frac{c_{i}}{2}Z_{i}) \}} \exp{\{ -i\gamma ( - \sum_{i, j\ \in {E}}^{m}\frac{J_{i j}}{4}Z_{i}Z_{j} )\}}$$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now I think we put through the minus signs and simplify. This means our cost operator now has these two parts.&lt;/p&gt;&#xA;&lt;p&gt;The first for the node weight now looks like:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\exp{\{ \frac{i \gamma}{2} \sum_{i \in \mathrm{V}}^{n} c_{i} Z_{i} \}} ,$$&lt;/span&gt;&#xA;where the minus sign has cancelled.&lt;/p&gt;&#xA;&lt;p&gt;The second now looks like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\exp{\{ \frac{i \gamma}{4} \sum_{i, j\ \in {E}}^{m}J_{i j}Z_{i}Z_{j} \}}$$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;where the minus sign has again cancelled.&lt;/p&gt;&#xA;&lt;p&gt;We know that gates wise, the single &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; term goes into an &lt;span class=&quot;math-container&quot;&gt;$R_{z}$&lt;/span&gt; gate as so: &lt;span class=&quot;math-container&quot;&gt;$e^{-ia Z t}=R_{z}(2 at)$&lt;/span&gt;. Following through, this means that each qubit (representing the node &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; with weight &lt;span class=&quot;math-container&quot;&gt;$c_{i}$&lt;/span&gt;) gets a gate of &lt;span class=&quot;math-container&quot;&gt;$R_{z}(-\gamma c_{i})$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The double &lt;span class=&quot;math-container&quot;&gt;$ Z_{i}Z_{j}$&lt;/span&gt; are the same as MAXCUT and so are &lt;span class=&quot;math-container&quot;&gt;$R_{z}$&lt;/span&gt; gates surrounded by two CNOTS  controlled by the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit. The gate is paramterised as so: &lt;span class=&quot;math-container&quot;&gt;$R_{z}(-\gamma J_{ij}/2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The problem is that this approach doesn't seem to be working ! I've set &lt;span class=&quot;math-container&quot;&gt;$J_{ij}$&lt;/span&gt; to a constant figure that is greater than all of the node weights but I'm having no luck.&lt;br /&gt;&#xA;Are there some in my logic?&lt;/p&gt;&#xA;" OwnerUserId="14866" LastActivityDate="2021-04-09T16:27:06.260" Title="QAOA Circuit for MWIS" Tags="&lt;circuit-construction&gt;&lt;qaoa&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16931" PostTypeId="1" AcceptedAnswerId="16934" CreationDate="2021-04-09T19:01:35.960" Score="1" ViewCount="26" Body="&lt;p&gt;I am reading the &lt;a href=&quot;https://arxiv.org/abs/1909.05820&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQLS paper&lt;/a&gt; and equation C2 on page 10 they have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ \delta_{ll'}^j = \beta_{ll'} + \langle0|V^\dagger A_{l'}^\dagger U(Z_j \otimes I_\bar{j}) U^\dagger A_lV|0\rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here they define the &lt;span class=&quot;math-container&quot;&gt;$I_\bar{j}$&lt;/span&gt; as &amp;quot;the identity on all qubits except qubit &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;&amp;quot; (see the text below equation 7).&lt;/p&gt;&#xA;&lt;p&gt;They then go on to say that equation C2 can be calculated from the circuit in Fig.9c (reproduced below).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CRxcE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CRxcE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;I understand how the circuit is made except for the &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; gate. Is it the case that &lt;span class=&quot;math-container&quot;&gt;$(Z_j \otimes I_\bar{j}) = CZ$&lt;/span&gt; and if so, can you demonstrate how this is the case?&lt;/p&gt;&#xA;" OwnerUserId="13244" LastActivityDate="2021-04-09T21:21:41.050" Title="How does this expression from the VQLS paper result in a CZ-gate?" Tags="&lt;vqe&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16932" PostTypeId="1" AcceptedAnswerId="16933" CreationDate="2021-04-09T19:31:01.097" Score="4" ViewCount="143" Body="&lt;p&gt;I'm currently testing out an error-correction surface code circuit in &lt;a href=&quot;https://github.com/quantumlib/Stim&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stim&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I've tried a 19x19 surface code over 10k rounds of syndrome extraction sampled 256 times, and this takes about 165 seconds.  This comes out to roughly ~100s of nanoseconds per measurement, which is not as fast as I'd like.&lt;/p&gt;&#xA;&lt;p&gt;I was wondering if there are 'best practices' for making circuits as fast as possible in Stim?&lt;/p&gt;&#xA;" OwnerUserId="15504" LastEditorUserId="119" LastEditDate="2021-04-09T20:11:54.240" LastActivityDate="2021-04-09T21:00:03.073" Title="'Best practices' for making Stim run as fast as possible?" Tags="&lt;programming&gt;&lt;error-correction&gt;&lt;simulation&gt;&lt;stim&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16933" PostTypeId="2" ParentId="16932" CreationDate="2021-04-09T20:00:25.417" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Output format&lt;/strong&gt;: Use a bit packed output format that has 8 results per byte instead of 1. In the python bindings, this means calling &lt;code&gt;sample_bit_packed&lt;/code&gt; instead of &lt;code&gt;sample&lt;/code&gt;. From the command line, this means specifying &lt;code&gt;--out_format=b8&lt;/code&gt;. You're paying ~5x performance if you're using a non-bit packed output.&lt;/p&gt;&#xA;&lt;p&gt;From the command line, for detection events, you can also consider sparse output formats like &lt;code&gt;--out_format=r8&lt;/code&gt; where each byte tells you the number of 0 results until the next 1 (except 0xFF used for long runs of zeros). For error rates below 0.1% this can easily be 10x less data output.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sample size&lt;/strong&gt;: Take a number of samples that's a multiple of 256. Stim internally pads the number of samples up to a multiple of 256, because it operates simultaneously across batches using 256 bit wide AVX instructions. It does this even if you ask for 2 samples, and the other 254 are going to be discarded.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Command Line Tool&lt;/strong&gt;: Consider using the command line tool instead of the python bindings. The python bindings add overhead (extra data copying), and are currently less flexible than the command line tool. You're paying ~2x performance to use stim via python.&lt;/p&gt;&#xA;&lt;p&gt;Note that when you print a &lt;code&gt;stim.Circuit&lt;/code&gt; in python, the result is text that the command line tool can parse to get that exact same circuit, so it's quite easy to generate your circuit files from python by making the circuit as usual and printing it to a file.&lt;/p&gt;&#xA;&lt;p&gt;An example where the command line tool is currently &lt;em&gt;necessary&lt;/em&gt; is if your circuit is really big, with hundreds of billions of bits of data coming out. The command line tool will notice the size and automatically switch from buffering all results in memory to streaming results to disk. The python bindings are not currently capable of doing this, because they return the results as a numpy array; in memory. Speaking from personal experience, streaming the results from huge circuits can be the difference between things working and watching helplessly as your computer completely freezes due to madly swapping memory to and from disk.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;REPEAT block&lt;/strong&gt;: Use the &lt;code&gt;REPEAT&lt;/code&gt; block instead of explicitly repeating things. If you have a circuit with a hundred thousand rounds of the same operations, putting them inside a &lt;code&gt;REPEAT 100000 { ... }&lt;/code&gt; block instead of actually repeating them a hundred thousand times will reduce memory usage and hugely reduce parsing time.&lt;/p&gt;&#xA;&lt;p&gt;In the python bindings, you can create a repeat block by multiplying the circuit by an integer. So create a &lt;code&gt;stim.Circuit&lt;/code&gt; containing the body of the loop, then do &lt;code&gt;full_circuit += loop_body * 100000&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;strong&gt;Grouping operations&lt;/strong&gt;: Have your measurements come in groups and your resets come in groups, without other operations or noise in between. For example, this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; M 0&#xA; M 1&#xA; M 2&#xA; X_ERROR(0.01) 0&#xA; X_ERROR(0.01) 1&#xA; X_ERROR(0.01) 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;happens to be faster than this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; M 0&#xA; X_ERROR(0.01) 0&#xA; M 1&#xA; X_ERROR(0.01) 1&#xA; M 2&#xA; X_ERROR(0.01) 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is because (currently) stim temporarily transposes the entire stabilizer tableau when performing a measurement, but avoids re-transposing for adjacent measurements.&lt;/p&gt;&#xA;&lt;p&gt;It's certainly possible for stim to be made smarter here, to move measurements around so more can be fused or to partially transpose the tableau as required, but currently it's not that smart.&lt;/p&gt;&#xA;&lt;p&gt;Grouping measurements isn't relevant if you're sampling detection events or specify &lt;code&gt;--frame0&lt;/code&gt;, because those modes bypass the stabilizer tableau simulation step where the transposing occurs. But you never know when you'll later want raw measurements...&lt;/p&gt;&#xA;&lt;p&gt;Another, more minor, benefit of grouping operations of the same type is that a noisy operation with many targets can have their &amp;quot;did the error happen&amp;quot; bits generated together in an efficient way. But if you're asking for hundreds or thousands of samples then you're already getting most of that benefit.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-04-09T21:00:03.073" LastActivityDate="2021-04-09T21:00:03.073" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16934" PostTypeId="2" ParentId="16931" CreationDate="2021-04-09T21:21:41.050" Score="2" Body="&lt;p&gt;They perform a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation)&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hadamard Test&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CXZHG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CXZHG.png&quot; alt=&quot;Hadamard-Test circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;with&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vert \psi \rangle = V(\alpha)\vert 0 \rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M = A_{l'}^\dagger U (Z_j\otimes I_{\overline{j}}) U^\dagger A_l&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By replacing the expression of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; in the circuit, you end up with the circuit you provided &lt;strong&gt;except&lt;/strong&gt; that the two &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are controlled. &amp;quot;Removing&amp;quot; the controls here is a simplification that can be performed because &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; simplify to the identity. To convince yourself about this:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the control qubit is &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; then the &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is not applied. By removing the controls from the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt;, they are both applied (because they are no more controlled) but they &amp;quot;cancel&amp;quot; each other so the final operation is the identity, as expected.&lt;/li&gt;&#xA;&lt;li&gt;If the control qubit is &lt;span class=&quot;math-container&quot;&gt;$\vert 1 \rangle$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^\dagger$&lt;/span&gt; are supposed to be applied too, which is the case.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;So the controlled-&lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; comes from the fact that the whole &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; gate is controlled, which means that each of the gates that compose &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; will be controlled too, &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; being one of them.&lt;/p&gt;&#xA;" OwnerUserId="1386" LastActivityDate="2021-04-09T21:21:41.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16935" PostTypeId="1" AcceptedAnswerId="16937" CreationDate="2021-04-10T04:28:45.327" Score="2" ViewCount="49" Body="&lt;p&gt;There are at least two definitions of Graph State, two of them are shown in &lt;a href=&quot;https://en.wikipedia.org/wiki/Graph_state#Formal_definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt;. The first definition is via quantum states, while the second one is from the point of view of the stabilizer group. How are the two definitions mathematically equivalent?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-10T18:21:01.830" LastActivityDate="2021-04-10T18:21:01.830" Title="How are the two definitions of graph state mathematically equivalent?" Tags="&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16937" PostTypeId="2" ParentId="16935" CreationDate="2021-04-10T06:51:47.723" Score="3" Body="&lt;p&gt;The first definition says the nodes start in the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state and then you apply a CZ for each edge.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state's stabilizer is &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;. When you conjugate an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; observable by a CZ operation, you end up with &lt;span class=&quot;math-container&quot;&gt;$X \otimes Z$&lt;/span&gt;. When you conjugate a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; observable by a CZ you just get the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; unchanged. This means propagating the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; stabilizer forward through time, through the CZs, kicks out a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on the other side of each CZ. So you end up with a stabilizer that's &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on the node times &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on each neighbor. That's the second definition.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-10T06:51:47.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16938" PostTypeId="1" AcceptedAnswerId="16940" CreationDate="2021-04-10T08:55:30.923" Score="3" ViewCount="90" Body="&lt;p&gt;We can build a quantum state from a graph, which is a mathematical concept.&#xA;But, vice versa, how can one check whether or not a given quantum state is a graph state?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-10T18:23:06.260" LastActivityDate="2021-04-11T07:07:37.240" Title="How can one check whether a given quantum state is a graph state?" Tags="&lt;graph-states&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16940" PostTypeId="2" ParentId="16938" CreationDate="2021-04-10T10:19:50.840" Score="5" Body="&lt;p&gt;Remember that a graph state is simply the &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; state on every qubit together with a bunch of controlled phases enacted between them. So, assuming you have a list of the probability amplitudes of your state, you first check that, if there are &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, every amplitude is &lt;span class=&quot;math-container&quot;&gt;$\pm1/\sqrt{2^n}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Once you have done this, you need to determine the pattern of controlled phases. This is easy. Find the amplitude of a term &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; which is all 0s except for two 1s. The sign of that amplitude tells you whether &lt;span class=&quot;math-container&quot;&gt;$(-1)$&lt;/span&gt; or not &lt;span class=&quot;math-container&quot;&gt;$(+1)$&lt;/span&gt; a controlled phase gate was applied between that particular pair of qubits. So, go through every possible pair of qubits, determine the controlled-phase gates. Then you just have to verify whether all the other &lt;span class=&quot;math-container&quot;&gt;$\pm$&lt;/span&gt; signs on the amplitudes are compatible with that assignment.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="9800" LastEditDate="2021-04-10T12:56:16.607" LastActivityDate="2021-04-10T12:56:16.607" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="16941" PostTypeId="2" ParentId="16870" CreationDate="2021-04-10T12:31:10.037" Score="2" Body="&lt;p&gt;&lt;strong&gt;TL/DR:&lt;/strong&gt; The error syndrome of the errors are:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;X_{3} &amp;amp;= 1100, \\&#xA;Z_{3} &amp;amp;= 0010, \\&#xA;Y_{3} &amp;amp;= 1110, \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&#xA;because of the commutation relations with the generators, where the error syndrome bit is &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if it anti-commutes, and &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; if it commutes with the generator in question. There are four generators, so there are four error syndrome bits.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;As @AdamZalcman already explained in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16847/8141&quot;&gt;his answer&lt;/a&gt; to your previous question on Shor's code, what we care about in quantum error correction is the commutation relations of our error with a set of generators for the stabilizer. By only measuring these stabilizers, we can check for errors and correct them, while not affecting the code space itself - a wonderful feat that makes it possible to perform quantum computation with real-life machines - or at least, that is the hope. I won't go into much detail here, because the linked answer already gives an explanation, and there are many texts to be found online that explain it much better than I can.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, to the actual computations. They are relatively easy, after some considerations. Paulis either commute or anti-commute, which means that our error syndrome bits will be unambiguous. We have four generators &lt;span class=&quot;math-container&quot;&gt;$S_{i}$&lt;/span&gt;, so we will have four error syndrome bits &lt;span class=&quot;math-container&quot;&gt;$e_{i}$&lt;/span&gt;; these bits encode the information of the commutation relation of a generator &lt;span class=&quot;math-container&quot;&gt;$S_{i}$&lt;/span&gt; with the error &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt;. We assume that the error &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is a &lt;em&gt;Pauli&lt;/em&gt; operator. Then, we set&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{split}&#xA;e_{i} &amp;amp;= 0\,\,\,  \mathrm{ iff }\,\,\, [E, S_{i}] = ES_{i} - S_{i}E = 0 \\&#xA;e_{i} &amp;amp;= 1\,\,\, \mathrm{ iff }\,\,\, \{E, S_{i}\} = ES_{i} + S_{i}E = 0 \\&#xA;\end{split}&#xA;$$&lt;/span&gt;&#xA;and, since &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_{i}$&lt;/span&gt; are Paulis, these are the only two options.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;A note of warning: sometimes people don't use &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; as I did, but they use &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. To me, both are fine, but I find the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; slightly more intuitive, as I interpret it as the generator begin 'turned to its on/excited state' by the error if its a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; - its as if the generator tells us with a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; that everything is fine, and it 'raises a flag' (i.e. the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;) when it finds that something is out of the order. But, maybe the &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt; reasoning is more useful to you - use per your own discretion.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Every generator and every error operator that we have here is a &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit operator, which can be represented by a &lt;span class=&quot;math-container&quot;&gt;$32 \times 32$&lt;/span&gt; matrix - we could write out all matrices involved, and compute the error bits from actually multiplying them, subtracting them, and then checking the outcome of the computation. This is a lot of work, but luckily we can be smarter about it.&lt;/p&gt;&#xA;&lt;p&gt;Because we are working with (&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit) Paulis, we have extra structure in our operators: they are all tensor products of single qubit operators/ &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrices. The commutation relations of the tensor factors alone determine the commutation relation of the full tensor product: If I have an operator &lt;span class=&quot;math-container&quot;&gt;$X_{1}X_{2}$&lt;/span&gt; and an operator &lt;span class=&quot;math-container&quot;&gt;$Z_{1}Z_{2}$&lt;/span&gt;, its commutation relation is determined by the commutation relations of the pairs &lt;span class=&quot;math-container&quot;&gt;$X_{1}, Z_{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_{2},Z_{2}$&lt;/span&gt;. The total commutation relation is just the sum of all the bits of the relations of the single-qubit tensor factors - mod &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;. Thus, the pair &lt;span class=&quot;math-container&quot;&gt;$X_{1}, Z_{1}$&lt;/span&gt; doesn't commute (and thus anti-commutes), and the pair &lt;span class=&quot;math-container&quot;&gt;$X_{2}, Z_{2}$&lt;/span&gt; doesn't commute either, so their 'commutation relation bits' are both &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. That makes the 'commutation relation bit' of the pair &lt;span class=&quot;math-container&quot;&gt;$X_{1}X_{2}, Z_{1}Z_{2}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$1+1 = 2 \rightarrow 0$&lt;/span&gt;; i.e. they in fact &lt;em&gt;do&lt;/em&gt; commute. This works for &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;-qubit operators as well.&lt;/p&gt;&#xA;&lt;p&gt;The second thing we can realize is that our error operator is either &lt;span class=&quot;math-container&quot;&gt;$X_{3}, Z_{3}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y_{3}$&lt;/span&gt;. That's shorthand for &lt;span class=&quot;math-container&quot;&gt;$I_{1}I_{2}X_{3}I_{4}I_{5}$&lt;/span&gt; etc. - we thus see that for our commutation relations of the pairs &lt;span class=&quot;math-container&quot;&gt;$E,S_{i}$&lt;/span&gt; we only need to look at the commutation relations of the third qubit, because all other factors of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; are the identity, and &lt;em&gt;everything&lt;/em&gt; commutes with the identity, so those 'commutation relations bits' will &lt;em&gt;always&lt;/em&gt; be &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Our error syndrome bit &lt;span class=&quot;math-container&quot;&gt;$e_{i}$&lt;/span&gt; is thus solely determined by only the third factors of the generators. The third factor of the generators are, in order:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;&amp;amp;S_{1} \rightarrow Z_{3} \\&#xA;&amp;amp;S_{2} \rightarrow Z_{3} \\&#xA;&amp;amp;S_{3} \rightarrow X_{3} \\&#xA;&amp;amp;S_{4} \rightarrow I_{3} \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lastly, the commutation relations of single-qubit Paulis are fairly straightforward: &lt;em&gt;everything&lt;/em&gt; commutes with &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;, and the Paulis &lt;span class=&quot;math-container&quot;&gt;$X,Y,Z$&lt;/span&gt; in between each other &lt;em&gt;commute&lt;/em&gt; with themselves and &lt;em&gt;anti-commute&lt;/em&gt; with the other two.&lt;/p&gt;&#xA;&lt;p&gt;Thus, for the error &lt;span class=&quot;math-container&quot;&gt;$E = X_{3}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$E = Z_{3}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$E = Y_{3}$&lt;/span&gt;, we get error syndromes&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\begin{split}&#xA;E = X_{3} \rightarrow&amp;amp; \{e_{1},e_{2},e_{3},e_{4}\} = \{1,1,0,0\} \\&#xA;E = Z_{3} \rightarrow&amp;amp; \{e_{1},e_{2},e_{3},e_{4}\} = \{0,0,1,0\} \\&#xA;E = Y_{3} \rightarrow&amp;amp; \{e_{1},e_{2},e_{3},e_{4}\} = \{1,1,1,0\} \\&#xA;\end{split}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Some final notes on your inclusion of the logical operators &lt;span class=&quot;math-container&quot;&gt;$X_{L}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_{L}$&lt;/span&gt;:&#xA;The generators say something about (actually, they &lt;em&gt;make&lt;/em&gt;) the codespace. Errors (or rather, correctable errors), are maps that map the entire codespace to some other, orthogonal part of the Hilbert space of all qubits, while preserving the inner structure of the codespace. That is some fancy talk for the fact that errors don't care about what's going on &lt;em&gt;in&lt;/em&gt; the codespace - they can't even influence it, because then they can influence the information encoded into the logical state - a big nono because this is exactly what we're trying to preserve.&lt;/p&gt;&#xA;&lt;p&gt;The logical operators, on the other hand, are exactly those operators that &lt;em&gt;do&lt;/em&gt; something within the codespace: they map logical states to other logical states. It doesn't really matter what are the commutation relations of the error with the logical operators - they work on a different 'realm', and the generators are there to keep the errors out of the codespace itself. This &lt;em&gt;is&lt;/em&gt; a bit hand-wavy, and also not entirely precisely correct, but for me it is a very strong intuitive picture.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-04-10T16:33:55.643" LastActivityDate="2021-04-10T16:33:55.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16942" PostTypeId="1" CreationDate="2021-04-10T14:11:22.383" Score="7" ViewCount="177" Body="&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/questions/628269/final-hamiltonian-for-adiabatic-grover&quot;&gt;X-posted&lt;/a&gt; on physics.stackexchange&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;In quantum computation, there is a famous algorithm to search a marked item in an unstructured database called Grover's algorithm. It achieves a quadratic speedup over the best possible classical algorithm.&lt;/p&gt;&#xA;&lt;p&gt;On the gate model of quantum computing, a phase oracle is used in Grover's algorithm. The phase oracle can be implemented by simulating the classical circuit that defines the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; indicates if an element (of the database for example) is marked (&lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;) or not (&lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;There exists a &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0107015&quot; rel=&quot;nofollow noreferrer&quot;&gt;version&lt;/a&gt; of Grover's algorithm for the adiabatic quantum computer architecture as well.&lt;/p&gt;&#xA;&lt;p&gt;However here the final Hamiltonian has a very similar form to the phase oracle in the gate model.&lt;/p&gt;&#xA;&lt;p&gt;The phase oracle had to be constructed with a quantum circuit simulating the classical circuit, that defines &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;But in the adiabatic case, how can the final Hamiltonian be constructed?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The problem is, that the Hamiltonian contains a projector onto the unknown state/the marked element.&lt;/p&gt;&#xA;" OwnerUserId="15516" LastEditorUserId="55" LastEditDate="2021-05-03T10:30:56.823" LastActivityDate="2021-05-04T06:49:40.753" Title="In the adiabatic version of Grover's algorithm, how is the Hamiltonian constructed?" Tags="&lt;grovers-algorithm&gt;&lt;oracles&gt;&lt;adiabatic-model&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16944" PostTypeId="1" AcceptedAnswerId="16945" CreationDate="2021-04-10T20:11:34.123" Score="2" ViewCount="37" Body="&lt;p&gt;While attempting to prove the Cauchy Schwarz Inequality I came across this problem. First of all, if we are given a &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; density matrix and two matrix of obserables &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt;, after defining the Covariance as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$COV_{\rho}(X,Y) = \mathbb{E}_{\rho}[(X-\mu_XI)^{\dagger}(Y-\mu_YI)]$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{E}_{\rho}(X)= tr(\rho^{\dagger}X) = \sum_{ij}\rho_{ij}X_{ij}$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$\mu_X = \mathbb{E}_{\rho}(X)$&lt;/span&gt; and the same for Y.&lt;/p&gt;&#xA;&lt;p&gt;How can we formally prove that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$COV_{\rho}(X,Y)= COV_{\rho}(Y,X)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was considering that since &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt; are both observable then a meaningful conclusion can be taken by that, since &lt;span class=&quot;math-container&quot;&gt;$X^{\dagger} = X$&lt;/span&gt; but what if &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is not necessarily like this? Would it still hold?&lt;/p&gt;&#xA;" OwnerUserId="15261" LastEditorUserId="55" LastEditDate="2021-04-11T08:28:47.637" LastActivityDate="2021-04-11T08:28:47.637" Title="How can we prove that the covariance satisfies $\mathrm{Cov}_\rho(X,Y)=\mathrm{Cov}_\rho(Y,X)$?" Tags="&lt;density-matrix&gt;&lt;information-theory&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16945" PostTypeId="2" ParentId="16944" CreationDate="2021-04-10T20:53:54.890" Score="3" Body="&lt;p&gt;I don't believe this holds even for Hermitian matrices. The main reason being is that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[\rho X Y ] \neq \mathrm{tr}[\rho Y X]$&lt;/span&gt; in general. This is a problem because we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;COV_{\rho}(X,Y) = \mathrm{tr}[\rho X Y] - \mu_X \mathrm{tr}[\rho Y] - \mu_Y \mathrm{tr}[\rho X] + \mu_X \mu_Y&#xA;$$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;COV_{\rho}(Y,X) = \mathrm{tr}[\rho Y X] - \mu_X \mathrm{tr}[\rho Y] - \mu_Y \mathrm{tr}[\rho X] + \mu_X \mu_Y.&#xA;$$&lt;/span&gt;&#xA;And so &lt;span class=&quot;math-container&quot;&gt;$COV_{\rho}(X,Y) = COV_{\rho}(Y,X)$&lt;/span&gt; iff &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[\rho X Y] = \mathrm{tr}[\rho Y X]$&lt;/span&gt;. But this doesn't hold in general. For instance take &lt;span class=&quot;math-container&quot;&gt;$\rho = |0\rangle \langle 0 |$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X = \sigma_x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y = \sigma_Y$&lt;/span&gt;. Then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\rho X Y] =  \mathrm{tr}[\rho i \sigma_z] = i&#xA;$$&lt;/span&gt;&#xA;but&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\rho Y X] = \mathrm{tr}[\rho (-i \sigma_z)] = - i.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Result holds in absolute value&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;However we will always have &lt;span class=&quot;math-container&quot;&gt;$|COV_{\rho}(X,Y)| = |COV_{\rho}(Y,X) |$&lt;/span&gt; to see this note that all terms above apart from &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[\rho X Y]$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathrm{tr}[\rho  Y X]$&lt;/span&gt; will be real. But for these two terms we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\rho X Y] = \mathrm{tr}[X Y \rho] = \mathrm{tr}[(\rho Y X)^{\dagger}] = \overline{\mathrm{tr}[\rho Y X]}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\overline{z}$&lt;/span&gt; denotes complex conjugate. Thus &lt;span class=&quot;math-container&quot;&gt;$COV_{\rho}(X,Y) = \overline{COV_{\rho}(Y,X)}$&lt;/span&gt; and therefore &lt;span class=&quot;math-container&quot;&gt;$|COV_{\rho}(X,Y)| = |COV_{\rho}(Y,X) |$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Result holds in absolute value for general &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the same reasons as above the result will hold even when &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; are not Hermitian:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\rho X^\dagger Y] = \mathrm{tr}[X^\dagger Y \rho] = \mathrm{tr}[(\rho Y^\dagger X)^{\dagger}] = \overline{\mathrm{tr}[\rho Y^\dagger X]}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2021-04-10T22:14:01.870" LastActivityDate="2021-04-10T22:14:01.870" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="16946" PostTypeId="1" AcceptedAnswerId="16948" CreationDate="2021-04-11T02:40:27.803" Score="1" ViewCount="83" Body="&lt;p&gt;After executing the proceeding code blocks, when I try to copy the same code from &lt;a href=&quot;https://qiskit.org/textbook/ch-machine-learning/machine-learning-qiskit-pytorch.html#3.-Let%27s-code!-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt; on my jupyter notebook, I get the error as&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt; QiskitError: 'Data for experiment &amp;quot;circuit-109&amp;quot; could not be found.'&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;simulator = qiskit.Aer.get_backend('qasm_simulator')&#xA;&#xA;circuit = QuantumCircuit(1, simulator, 100)&#xA;print('Expected value for rotation pi {}'.format(circuit.run([np.pi])[0]))&#xA;circuit._circuit.draw(&#xA;)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Please suggest:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;ipython-input-23-06b09ff4dd69&amp;gt; in &amp;lt;module&amp;gt;&#xA;      2 &#xA;      3 circuit = QuantumCircuit(1, simulator, 100)&#xA;----&amp;gt; 4 print('Expected value for rotation pi {}'.format(circuit.run([np.pi])[0]))&#xA;      5 circuit._circuit.draw()&#xA;&#xA;&amp;lt;ipython-input-22-e6eb9c91d6f9&amp;gt; in run(self, thetas)&#xA;     28                         parameter_binds = [{self.theta: theta} for theta in thetas])&#xA;     29         job = self.backend.run(qobj)&#xA;---&amp;gt; 30         result = job.result().get_counts(self._circuit)&#xA;     31 &#xA;     32         counts = np.array(list(result.values()))&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\result\result.py in get_counts(self, experiment)&#xA;    261         dict_list = []&#xA;    262         for key in exp_keys:&#xA;--&amp;gt; 263             exp = self._get_experiment(key)&#xA;    264             try:&#xA;    265                 header = exp.header.to_dict()&#xA;&#xA;~\anaconda3\lib\site-packages\qiskit\result\result.py in _get_experiment(self, key)&#xA;    368 &#xA;    369             if len(exp) == 0:&#xA;--&amp;gt; 370                 raise QiskitError('Data for experiment &amp;quot;%s&amp;quot; could not be found.' %&#xA;    371                                   key)&#xA;    372             if len(exp) == 1:&#xA;&#xA;QiskitError: 'Data for experiment &amp;quot;circuit-109&amp;quot; could not be found.'```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14924" LastEditorUserId="2293" LastEditDate="2021-04-12T15:58:18.977" LastActivityDate="2021-04-15T08:42:44.147" Title="PyTorch and Qiskit example from the Qiskit textbook seems broken" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="16947" PostTypeId="1" AcceptedAnswerId="16963" CreationDate="2021-04-11T04:26:50.380" Score="2" ViewCount="37" Body="&lt;p&gt;The appendix to the paper &lt;a href=&quot;https://arxiv.org/abs/1908.05047&quot; rel=&quot;nofollow noreferrer&quot;&gt;Graph States as a Resource for Quantum Metrology&lt;/a&gt; states that when graph states subjected to finite erasures, &lt;span class=&quot;math-container&quot;&gt;$$G\Rightarrow Tr_\vec{y}G.$$&lt;/span&gt; While more explicitly he explains the formula as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$G_\vec{y} = \mathrm{const}\times\sum_{\vec{y}}Z_\vec{j}\lvert G\rangle\langle G\rvert Z_\vec{j}.$$&lt;/span&gt;&#xA;I was wondering, how can these two statements the same, i.e., why the erasure error can be stated as the operation of &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;? I know &lt;span class=&quot;math-container&quot;&gt;$I + Z$&lt;/span&gt; can be the erasure error, but how can &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; alone stand for the erasure error?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="8141" LastEditDate="2021-04-12T09:16:55.823" LastActivityDate="2021-04-13T06:52:17.897" Title="Graph States subjected to finite erasures" Tags="&lt;noise&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16948" PostTypeId="2" ParentId="16946" CreationDate="2021-04-11T06:55:33.933" Score="1" Body="&lt;p&gt;After checking, this issue was introduced in the last qiskit-terra release. The textbook should be fixed to adjust the &lt;code&gt;get_counts&lt;/code&gt;, as already reported &lt;a href=&quot;https://github.com/qiskit-community/qiskit-textbook/issues/1038&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In any case, the workaround for now is removing &lt;code&gt;self._circuit&lt;/code&gt; from &lt;code&gt;result = job.result().get_counts(self._circuit)&lt;/code&gt; (in &lt;code&gt;QuantumCircuit.run&lt;/code&gt; method).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class QuantumCircuit:&#xA;    ...&#xA;&#xA;    def run(self, thetas):&#xA;        ...&#xA;        job = self.backend.run(qobj)&#xA;        result = job.result().get_counts()  # &amp;lt;- here&#xA;        ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-04-15T08:42:44.147" LastActivityDate="2021-04-15T08:42:44.147" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16949" PostTypeId="2" ParentId="16938" CreationDate="2021-04-11T07:07:37.240" Score="0" Body="&lt;p&gt;If you want to find the answer experimentally, a possible (not necessarily optimal) way to do so is the following. Note that a graph state is stabilized by the generators &lt;span class=&quot;math-container&quot;&gt;$$g_v=X_v \prod_{w\in N(v)} Z_w,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; is a vertex of the graph and &lt;span class=&quot;math-container&quot;&gt;$N(v)$&lt;/span&gt; is its neighborhood. You can find the neighborhood of a vertex by measuring &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on qubit &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on all others. The outcomes of the neighborhood will be perfectly correlated with the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-outcome, because &lt;span class=&quot;math-container&quot;&gt;$\langle \psi | g_v |\psi \rangle = 1$&lt;/span&gt;. This can be repeated for each qubit. Probably this could be done more efficiently, but at least this should be better than full tomography.&lt;/p&gt;&#xA;" OwnerUserId="104" LastActivityDate="2021-04-11T07:07:37.240" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16951" PostTypeId="1" CreationDate="2021-04-11T08:46:48.673" Score="0" ViewCount="66" Body="&lt;p&gt;Is there a way to get certain measurement results by variational quantum eigensolver in qiskit? More specifically, I want to get measurement results for certain operators, like &lt;span class=&quot;math-container&quot;&gt;$\langle a^\dagger_ia_j\rangle$&lt;/span&gt; (which I assume that I later transform it into the qubit version using Jordan-Wigner transformation) for every &lt;span class=&quot;math-container&quot;&gt;$i,j$&lt;/span&gt; in the system. Therefore, I need to get the measurement results for the matrix for, say, &lt;span class=&quot;math-container&quot;&gt;$10^4$&lt;/span&gt; shots. I noticed that the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.VQE.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;VQE class&lt;/a&gt; provides the function to calculate the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.VQE.html#qiskit.aqua.algorithms.VQE.expectation&quot; rel=&quot;nofollow noreferrer&quot;&gt;expection&lt;/a&gt; value, can I use this function to get my job done, or there are any other ways to achieve this?&lt;/p&gt;&#xA;" OwnerUserId="8611" LastActivityDate="2021-05-12T02:02:30.240" Title="Compute measurement values of observables by Qiskit" Tags="&lt;qiskit&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16952" PostTypeId="1" CreationDate="2021-04-11T10:09:43.507" Score="1" ViewCount="35" Body="&lt;p&gt;For a bipartite quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt;, we have that the von Neumann entropy is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$S(\rho_{AB}) = -\text{Tr}(\rho_{AB}\log\rho_{AB})$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If instead, one took the partial trace above and obtained&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho'_A = -\text{Tr}_B((\rho_{AB}\log\rho_{AB}))$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is &lt;span class=&quot;math-container&quot;&gt;$\rho'_A$&lt;/span&gt; an object that has been studied? Its trace gives us the entropy of &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; and it is positive semidefinite so I'm wondering if (up to normalization) it is related &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; in some way?&lt;/p&gt;&#xA;" OwnerUserId="4831" LastActivityDate="2021-04-11T10:09:43.507" Title="Partial trace instead of trace in definition of entropy" Tags="&lt;quantum-state&gt;&lt;entropy&gt;&lt;partial-trace&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16954" PostTypeId="2" ParentId="6828" CreationDate="2021-04-11T11:13:54.923" Score="1" Body="&lt;p&gt;It's been a while since the question was posted but since I have a solution that differs from the one above, I would like to put it forth. It's mathematically gory but satisfactory in my opinion. We start by considering the state &lt;span class=&quot;math-container&quot;&gt;$|n, m\rangle$&lt;/span&gt; as some basis state in the combined excited state space of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; respectively.&lt;/p&gt;&#xA;&lt;p&gt;We realize that &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and consequently &lt;span class=&quot;math-container&quot;&gt;$\ e^{-iH\Delta t}$&lt;/span&gt; ultimately results in a combination of states that preserve &lt;span class=&quot;math-container&quot;&gt;$n+m$&lt;/span&gt;. Once we make this realization, we can say that the non zero terms of the inner product &lt;span class=&quot;math-container&quot;&gt;$\langle k_b|U|0_b\rangle$&lt;/span&gt; are the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{equation}&#xA;E_k = \langle k_b|U|0_b\rangle =\sum_{n}\langle n-k_a, k_b|U|n_a,0_b\rangle\space|n-k_a\rangle\langle n_a|&#xA;\end{equation} \tag{1}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Consider &lt;span class=&quot;math-container&quot;&gt;$\langle n-k_a, k_b|U|n_a,0_b\rangle\space$&lt;/span&gt;. Using the properties of the creation and annihilation operators, we get this to be&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}= \langle0_a, 0_b|\frac{a^{n-k}}{\sqrt{n-k!}}\frac{b^{k}}{\sqrt{k!}}U\frac{{a^{\dagger}}^n}{\sqrt{n!}}|0_a, 0_b\rangle\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary and &lt;span class=&quot;math-container&quot;&gt;$U^{\dagger}U = I$&lt;/span&gt;, the above expression becomes,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}=\frac{\sqrt{\binom{n}{k}}}{n!}\langle0_a, 0_b|a^{n-k}b^{k}U{a^{\dagger}}^nU^{\dagger}U|0_a, 0_b\rangle\tag{2}\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;$U|0_a, 0_b\rangle = |0_a, 0_b \rangle$&lt;/span&gt; since if no photon was at the input mode, none can be found at the output mode. This is not a claim we make out of thin air. It does make sense and in case one is curious, similar justifications also exist in section 7.4.2 of &lt;em&gt;Nielsen and Chuang&lt;/em&gt; and in chapter 6 of Introductory Quantum Optics by &lt;em&gt;Christopher C. Gerry and Peter L. Knight&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Moving on, consider &lt;span class=&quot;math-container&quot;&gt;$U a^{\dagger}U^{\dagger}$&lt;/span&gt;. We can simplify this using the following version of the Baker-Campbell-Hausdorff formula which states that,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}e^{\lambda G}Ae^{-\lambda G} = \sum_{n=0}^{n=\infty} \frac{\lambda ^n}{n!} C_n\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A, G$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$ C_n $&lt;/span&gt; are operators, and &lt;span class=&quot;math-container&quot;&gt;$C_0 = A, C_1 = [G, C_0], C_2 = [G, C_1], ...C_n = [G, C_{n-1}]$&lt;/span&gt;. Simplifying, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}U a^{\dagger}U^{\dagger}  = a^{\dagger}\cos(\chi\Delta t) - ib^{\dagger}\sin(\chi\Delta t)\tag{3}\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, &lt;span class=&quot;math-container&quot;&gt;${Ua^{\dagger}}^nU^{\dagger} = UaU^{\dagger} UaU^{\dagger} UaU^{\dagger}U...UaU^{\dagger} = ({UaU^{\dagger}})^n$&lt;/span&gt;. Substituting &lt;span class=&quot;math-container&quot;&gt;$(3)$&lt;/span&gt; back in &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; using this fact, we get&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned} &amp;amp;=\frac{\sqrt{\binom{n}{k}}}{n!}\langle0_a, 0_b|a^{n-k}b^{k}(a^{\dagger}\cos(\chi\Delta t) - ib^{\dagger}\sin(\chi\Delta t))^n|0_a, 0_b\rangle \\ &amp;amp;= \sum_{r=0}^{r=n}\frac{\sqrt{\binom{n}{k}}}{n!}\binom{n}{r}(-i\sin(\chi\Delta t))^r(\cos(\chi\Delta t))^{n-r} \langle 0_a, 0_b|a^{n-k}b^{k}(a^{\dagger})^{n-r}(b^{\dagger})^r|0_a, 0_b\rangle\end{aligned}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Only the term with &lt;em&gt;r&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$=$&lt;/span&gt; &lt;em&gt;k&lt;/em&gt; survives since the operators must add up to no net change in the number state for the inner product to be non-zero. This gives,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned} &amp;amp;= \frac{\sqrt{\binom{n}{k}}}{n!}\binom{n}{k}(-i\sin(\chi\Delta t))^k(\cos(\chi\Delta t))^{n-k} \langle 0_a, 0_b|a^{n-k}b^{k}(a^{\dagger})^{n-k}(b^{\dagger})^k|0_a, 0_b\rangle\\ &amp;amp;= \frac{\sqrt{\binom{n}{k}}}{n!}\binom{n}{k}(-i\sin(\chi\Delta t))^k(\cos(\chi\Delta t))^{n-k}\sqrt{(n-k)!(k!)(k!)(n-k!)} \langle 0_a, 0_b|0_a, 0_b\rangle \end{aligned}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Letting &lt;span class=&quot;math-container&quot;&gt;$\gamma = 1-\cos^{2}\chi\Delta t$&lt;/span&gt; and substituting this result back in equation &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;, we obtain,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{aligned}E_k = \langle k_b|U|0_b\rangle &amp;amp;= (-i)^{k}\sum_{n}\sqrt{\binom{n}{k}}\sqrt{(1-\gamma)^{n-k}\gamma^{k}}|n-k_a\rangle \langle k_a| \end{aligned}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is what is required. The phase of &lt;span class=&quot;math-container&quot;&gt;$(-i)^k$&lt;/span&gt; can be taken away and the new set of &lt;span class=&quot;math-container&quot;&gt;$E_k's$&lt;/span&gt; would be unitarily related to the initial &lt;span class=&quot;math-container&quot;&gt;$E_k's$&lt;/span&gt; and therefore would result in the same quantum operation by the unitary freedom in quantum operations.&lt;/p&gt;&#xA;" OwnerUserId="12084" LastEditorUserId="12084" LastEditDate="2021-04-11T14:34:08.027" LastActivityDate="2021-04-11T14:34:08.027" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16955" PostTypeId="1" CreationDate="2021-04-11T14:05:46.650" Score="0" ViewCount="66" Body="&lt;p&gt;I feel the answer to this question is just out of reach - I &amp;quot;understand&amp;quot; the implication that a quantum computer uses all combinations of bits simultaneously compared to a classic computer, and that clearly gives a huge boost to processing times, however I'm struggling to quite grasp how.&lt;/p&gt;&#xA;&lt;p&gt;I watched &lt;a href=&quot;https://www.youtube.com/watch?v=eVjMq7HlwCc&quot; rel=&quot;nofollow noreferrer&quot;&gt;a TED talk&lt;/a&gt; on quantum computing in which the gentleman said that a 300 qubit QC would be more powerful than a regular PC with one bit of memory for every atom in the universe. They also mentioned that Google have created a QC with 53 qubits.&lt;/p&gt;&#xA;&lt;p&gt;So to try and get my head around it, I decided to compare this to my PC.&lt;/p&gt;&#xA;&lt;p&gt;Forgetting memory needed for anything other than storing combinations, if I have 16GB of RAM available, that's 2&lt;sup&gt;17'179'869'184&lt;/sup&gt; possible combinations, or ~57 million lots of 53 bits (with each one in one specific combination).&lt;/p&gt;&#xA;&lt;p&gt;So for each cycle of combinations, my PC is able to hold ~57 million combinations of 53 bits, and if my PC is running at 4.1GHz, that's 7.0E+19, or in the region of 2&lt;sup&gt;66&lt;/sup&gt; combinations per second.&lt;/p&gt;&#xA;&lt;p&gt;Now I have a good PC, but it seems to be reasonably on a par with Google's quantum computer, which just seems wrong. I know that I've not used an exact science to calculate things but I can't follow where I've screwed up the maths?&lt;/p&gt;&#xA;&lt;p&gt;The claim for the 300 qubit QC I also can't follow with the above logic.&lt;/p&gt;&#xA;&lt;p&gt;As excel won't work with stupidly large numbers I tried to do this on paper, so bear with me:&lt;/p&gt;&#xA;&lt;p&gt;There are 10E+80 atoms in the universe, so this number of bits would give 2&lt;sup&gt;(10E+80)&lt;/sup&gt;, or 2&lt;sup&gt;800&lt;/sup&gt; combinations. An unholy number that no-one could possibly comprehend.&lt;/p&gt;&#xA;&lt;p&gt;For the QC there are 300 qubits or ~2&lt;sup&gt;8&lt;/sup&gt; therefore one could store 2&lt;sup&gt;792&lt;/sup&gt; combinations at any one time, which is already way above the 2&lt;sup&gt;300&lt;/sup&gt; combinations available to a 300 qubit QC..?&lt;/p&gt;&#xA;" OwnerUserId="15534" LastActivityDate="2021-04-11T17:57:13.613" Title="How are quantum computers more powerful than classical computers?" Tags="&lt;algorithm&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-04-12T12:18:56.443" ContentLicense="CC BY-SA 4.0" />
  <row Id="16956" PostTypeId="2" ParentId="16919" CreationDate="2021-04-11T14:09:22.390" Score="3" Body="&lt;p&gt;Maybe think of it this way - a quantum computer, executing a small enough random circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; acting on a state initially prepared as &lt;span class=&quot;math-container&quot;&gt;$\vert 0^n\rangle$&lt;/span&gt; and sampling therefrom, will get an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit string as output, say &lt;span class=&quot;math-container&quot;&gt;$0110\cdots10$&lt;/span&gt;.  We know, merely from the fact that this was sampled, that the squared amplitude of &lt;span class=&quot;math-container&quot;&gt;$\vert 0110\cdots10\rangle$&lt;/span&gt; is large and likely contributes more than &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt; to the linear cross-entropy score.&lt;/p&gt;&#xA;&lt;p&gt;I think the implications of the XQUATH conjecture are that a &lt;em&gt;classical&lt;/em&gt; computer likely cannot even determine the output probability of even the all-zeroes basis vector &lt;span class=&quot;math-container&quot;&gt;$\vert 0000\cdots 00\rangle$&lt;/span&gt;, &lt;em&gt;much less&lt;/em&gt; any particular vector such as &lt;span class=&quot;math-container&quot;&gt;$\vert 0110\cdots10\rangle$&lt;/span&gt;.  The all-zeroes vector was chosen as both the input vector (the initially prepared state) and the output vector (the state with which the squared amplitudes are calculated) only for convenience, and as you note you could always append &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; gates to the output circuit without changing the analysis.&lt;/p&gt;&#xA;&lt;p&gt;If we execute a circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; and output the string &lt;span class=&quot;math-container&quot;&gt;$0110\cdots10$&lt;/span&gt;, we can think of another circuit &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt; wherein we append a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOT}$&lt;/span&gt; gate onto the second, third, ..., second-to-last bit, and the conjecture goes through.&lt;/p&gt;&#xA;&lt;p&gt;That is, it appears that Aaronson and Gunn conjecture that it's classically hard to determine an output probability of any particular basis vector, which would be needed to spoof the cross-entropy score.  But quantumly all we need to do is execute the circuit and sample therefrom.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-04-11T14:09:22.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16957" PostTypeId="1" CreationDate="2021-04-11T15:22:50.900" Score="1" ViewCount="83" Body="&lt;p&gt;I am using qiskit to get some measurement results of observables similar to the Hamiltonian. Can someone provide the way how qiskit measures the Hamiltonian (Jordan-Wigner transformed) when using VQE? Or can they just provide the source code link.&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="8141" LastEditDate="2021-04-12T10:20:32.100" LastActivityDate="2021-04-12T10:20:32.100" Title="How to measure a qubit Hamiltonian in qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;vqe&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16958" PostTypeId="1" CreationDate="2021-04-11T17:44:28.357" Score="0" ViewCount="18" Body="&lt;p&gt;&lt;em&gt;&lt;strong&gt;(The CCNR criterion)&lt;/strong&gt;&lt;/em&gt; The &lt;em&gt;computable cross-norm or realignment (CCNR) entanglement criterion&lt;/em&gt;, as discussed in (&lt;a href=&quot;https://arxiv.org/abs/0811.2803&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gühne and Toth 2008&lt;/a&gt;), is based on the observation that any bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; can be decomposed as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_k \lambda_k G_k^A\otimes G_k^B,\tag1$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\lambda_k\ge0$&lt;/span&gt; and Hermitian operators such that &lt;span class=&quot;math-container&quot;&gt;$\operatorname{Tr}(G_k^A G_\ell^A)=\operatorname{Tr}(G_k^B G_\ell^B)=\delta_{k\ell}$&lt;/span&gt;.&#xA;Any separable &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; must correspond to coefficients such that &lt;span class=&quot;math-container&quot;&gt;$\sum_k \lambda_k\le1$&lt;/span&gt;, thus &lt;span class=&quot;math-container&quot;&gt;$\sum_k\lambda_k&amp;gt;1$&lt;/span&gt; certifies entanglement.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(CCNR as SVD)&lt;/strong&gt;&lt;/em&gt; This decomposition can be seen as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singular_value_decomposition&quot; rel=&quot;nofollow noreferrer&quot;&gt;SVD&lt;/a&gt; applied to the operator&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|i,j\rangle\mapsto \sum_{k,\ell}\langle k, j|\rho|\ell,i\rangle \,\,|k,\ell\rangle.$$&lt;/span&gt;&#xA;One way to show this is to write the SVD of such operator as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle k, j|\rho|\ell,i\rangle&#xA;= \sum_m p_m  u^{(m)}_{k\ell} \bar v^{(m)}_{ij},$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$p_m\ge0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\langle u^{(m)}, u^{(n)}\rangle=\langle v^{(m)},v^{(n)}\rangle=\delta_{mn}$&lt;/span&gt;. Rewriting this in operatorial form, we get back the decomposition in (1).&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(CCNR and Choi representation)&lt;/strong&gt;&lt;/em&gt; An alternative way to see this decomposition is to notice that it is the SVD of the (inverse?) &lt;em&gt;Choi representation&lt;/em&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&#xA;To be more precise, let &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; be the channel whose Choi is &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$J(\Phi)=\rho$&lt;/span&gt;. Then the decomposition in (1) amounts to the SVD of the &lt;em&gt;natural representation&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; (this is &amp;quot;vectorised&amp;quot; version of &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt;: the operator such that &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)\operatorname{vec}(X)=\operatorname{vec}(\Phi(X))$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(CCNR as a statement about entanglement breaking channels)&lt;/strong&gt;&lt;/em&gt; Now, we know that &lt;span class=&quot;math-container&quot;&gt;$\rho=J(\Phi)$&lt;/span&gt; is separable &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is entanglement breaking. This makes the CCNR criterion equivalent to the following statement about channels: &lt;em&gt;if a channel &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is such that &lt;span class=&quot;math-container&quot;&gt;$\|K(\Phi)\|_1&amp;gt;1$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; is &lt;strong&gt;not&lt;/strong&gt; entanglement breaking&lt;/em&gt;.&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|_1$&lt;/span&gt; denotes the trace norm, which equals the sum of the singular values of its argument.&lt;/p&gt;&#xA;&lt;p&gt;Is there any intuition behind this fact? Is there any general statement about what the trace norm of &lt;span class=&quot;math-container&quot;&gt;$K(\Phi)$&lt;/span&gt; tells us about &lt;span class=&quot;math-container&quot;&gt;$\Phi$&lt;/span&gt; that can be applied to this case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-04-11T17:44:28.357" Title="Can the CCNR entanglement criterion be seen as a &quot;natural&quot; statement about entanglement breaking channels?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;entanglement-breaking-channels&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16959" PostTypeId="2" ParentId="16955" CreationDate="2021-04-11T17:57:13.613" Score="0" Body="&lt;p&gt;We can not talk about how quantum computers are much powerful than classical computers without mentioning other quantum phenomena like entanglement and interference.&#xA;For a good comparison you can read &lt;a href=&quot;http://www.cs.virginia.edu/%7Erobins/The_Limits_of_Quantum_Computers.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Regarding you calculations, I think you did not get it right.&#xA;Two classical bit can be either 00, 01, 10, or 11. Two qubits can have all the four possibilities &lt;em&gt;simultaneously&lt;/em&gt;. Which means 2 qubits can carry 4 2-bits of information at the same time. That is 4 times what 2 bits can carry.&lt;/p&gt;&#xA;&lt;p&gt;In general, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits can carry &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; times what &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits can carry.&#xA;&lt;span class=&quot;math-container&quot;&gt;$300$&lt;/span&gt; qubits can carry &lt;span class=&quot;math-container&quot;&gt;$2^{300}$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$300$&lt;/span&gt;-bits binary strings. &lt;span class=&quot;math-container&quot;&gt;$2^{300}$&lt;/span&gt; ~ 2e+90. That is more than the atoms in the observable universe.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;There are 10E+80 atoms in the universe, so this number of bits would give 2(10E+80), or 2800 combinations. An unholy number that no-one could possibly comprehend.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Number of combinations does not matter, because at any moment a classical bit can be either one or zero. That means at any time 10E+80 atoms can carry 10E+80 bits.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-04-11T17:57:13.613" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="16960" PostTypeId="2" ParentId="16927" CreationDate="2021-04-11T21:27:45.957" Score="2" Body="&lt;h2&gt;No symbolic computation software with quantum circuits built in&lt;/h2&gt;&#xA;&lt;p&gt;The asker has clarified &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16927/symbolic-computation-with-quantum-circuits?noredirect=1#comment24953_16927&quot;&gt;in this comment&lt;/a&gt; that they want a symbolic computation software in which the user &lt;em&gt;&lt;strong&gt;does not&lt;/strong&gt;&lt;/em&gt; &amp;quot;have to manually define circuits in terms of matrix multiplications&amp;quot;, and the question says that the software cannot &amp;quot;force you to encode the matrix of each gate explicitly&amp;quot;. &lt;strong&gt;This unfortunately does not exist.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In all symbolic computation software, one will have to encode the matrix of each gate (X,Y,Z,CNOT,H,etc.) and use tensor products (i.e. Kronecker products) and matrix multiplications to get the effect of the unitary operation of a quantum circuit; or find some add-on where someone else did exactly that and made it available to others. &lt;strong&gt;Luckily, it is not hard to define the gates manually, and to do matrix multiplications, in any symbolic computation software.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Quantum add-ons for popular symbolic computation software&lt;/h2&gt;&#xA;&lt;p&gt;The most popular long-standing symbolic computation packages which are still actively being developed are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Mathematica,&lt;/li&gt;&#xA;&lt;li&gt;Sage,&lt;/li&gt;&#xA;&lt;li&gt;SymPy,&lt;/li&gt;&#xA;&lt;li&gt;Maple,&lt;/li&gt;&#xA;&lt;li&gt;MATLAB's Symbolic Computation Toolbox,&lt;/li&gt;&#xA;&lt;li&gt;Maxima,&lt;/li&gt;&#xA;&lt;li&gt;Magma, and&lt;/li&gt;&#xA;&lt;li&gt;Scilab&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There's others too, which people are welcome to suggest I add, but seriously anything other than the first five are not really &amp;quot;popular&amp;quot; in the circles that I know.&lt;/p&gt;&#xA;&lt;p&gt;Since none of the above symbolic computation software has quantum circuit functionality built in to the extent where the user does not have to define the gates or explicitly involve matrix multiplications commands *natively *without relying on a third-party add-on where someone else did exactly the same thing, the asker says again in the same comment as above:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;any software for symbolic computation having dedicated features/facilities for quantum computing is accepted.&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I will therefore point out that of that list of 8 major symbolic computation software packages, the one with the largest volume of quantum add-ons is Mathematica (also by far the most popular and highly developed package out of all of the above, &lt;em&gt;for symbolic computation&lt;/em&gt;):&lt;/p&gt;&#xA;&lt;h3&gt;Quantum add-ons for Mathematica&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://library.wolfram.com/infocenter/MathSource/7622/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Mathematica&lt;/a&gt;: includes the ability to do quantum circuits in 2D and 3D, some Adiabatic Quantum Computing functionality, and the Quantum Fourier Transform. Unfortunately this has not been revised since 2010, according to that link, and since 2011 &lt;a href=&quot;http://homepage.cem.itesm.mx/lgomez/quantum/&quot; rel=&quot;nofollow noreferrer&quot;&gt;according to this&lt;/a&gt;, though the authors wrote &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1742-6596/698/1/012019&quot; rel=&quot;nofollow noreferrer&quot;&gt;a paper about it&lt;/a&gt; in 2015.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.pitt.edu/%7Etabakin/QDENSITY/index.htm&quot; rel=&quot;nofollow noreferrer&quot;&gt;QDENSITY&lt;/a&gt;: Less well documented than Quantum Mathematica, but published more recently (August 2017).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1403.7050&quot; rel=&quot;nofollow noreferrer&quot;&gt;Using Mathematica for Quantum Mechanics&lt;/a&gt;: This is also published in a &lt;a href=&quot;https://www.springer.com/gp/book/9789811375873&quot; rel=&quot;nofollow noreferrer&quot;&gt;book&lt;/a&gt;, however it's more geared towards &amp;quot;quantum mechanics&amp;quot; than &amp;quot;quantum computing&amp;quot;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;There's also &lt;a href=&quot;https://demonstrations.wolfram.com/topic.html?topic=quantum%20mechanics&amp;amp;start=161&amp;amp;limit=20&amp;amp;sortmethod=recent&quot; rel=&quot;nofollow noreferrer&quot;&gt;378 quantum mechanics related Mathematica demonstrations&lt;/a&gt; on the Wolfram Demonstrations Project, but most if not all of them are geared towards quantum mechanics and not so much quantum computing.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Therefore &amp;quot;Quantum Mathematica&amp;quot; and &amp;quot;QDENSITY&amp;quot; are your best options with Mathematica, and unfortunately these will require a Mathematica license, which will be very expensive if you don't have a discount or free access through (for example) a university.&lt;/p&gt;&#xA;&lt;h3&gt;Quantum add-ons for Maple&lt;/h3&gt;&#xA;&lt;p&gt;Although Maple has declined in popularity in recent years, they also do support Dirac notation as seen &lt;a href=&quot;https://www.maplesoft.com/products/maple/new_features/maple2018/physics.aspx&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://www.mapleprimes.com/posts/208822-Quantum-Mechanics-Using-Maples-Physics-Package&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;, but there's nothing that can do entire quantum circuits as far as I know.&lt;/p&gt;&#xA;&lt;h3&gt;My recommendation if you don't have access to Mathematica:&lt;/h3&gt;&#xA;&lt;p&gt;Just use SymPy or Sage (both open-source and Python based) and define the gates (X,Y,Z,CNOT,H,etc.) manually and do the matrix multiplications, since this will just take a couple hours. &lt;strong&gt;You can also read the above papers on how it was done in Mathematica, to give you ideas on how to efficiently save time in doing it with SymPy or Sage&lt;/strong&gt; (i.e. how to make it so that you don't have to repeat the identity matrix so many times, for example).&lt;/p&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-04-13T18:55:43.797" LastActivityDate="2021-04-13T18:55:43.797" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16961" PostTypeId="2" ParentId="16957" CreationDate="2021-04-12T01:22:14.583" Score="0" Body="&lt;p&gt;I believe these links can help solve your problem:&#xA;&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.VQE.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.VQE.html&lt;/a&gt;&#xA;&lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.aqua.operators.expectations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/apidoc/qiskit.aqua.operators.expectations.html&lt;/a&gt;&#xA;&lt;a href=&quot;https://qiskit.org/documentation/tutorials/noise/1_hamiltonian_and_gate_characterization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/noise/1_hamiltonian_and_gate_characterization.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14994" LastActivityDate="2021-04-12T01:22:14.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16962" PostTypeId="2" ParentId="16951" CreationDate="2021-04-12T01:49:09.817" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\Ket}[1]{\left|#1\right&amp;gt;}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{|#1\rangle}$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bra}[1]{\left&amp;lt;#1\right|}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think you can find the answer to your question here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13657/circuit-for-vqe-expectation-value-finding&quot;&gt;Circuit for VQE Expectation Value Finding&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to get the expectation value (average value) of an operator corresponding to an observable on a quantum state you can follow this formula:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$E(M) = \braψM\ketψ $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here an example code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;import numpy as np&#xA;from qiskit.aqua.operators import StateFn&#xA;from qiskit.aqua.operators import Z&#xA;&#xA;qc = QuantumCircuit(2)&#xA;qc.rz(np.pi/3, [0])&#xA;qc.rx(np.pi/3, [0])&#xA;qc.cx(0, 1)&#xA;&#xA;operator = Z&#xA;psi = StateFn(qc)&#xA;expectation_value = (~psi @ operator @ psi).eval()&#xA;print(expectation_value.real)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14994" LastActivityDate="2021-04-12T01:49:09.817" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="16963" PostTypeId="2" ParentId="16947" CreationDate="2021-04-12T07:15:13.417" Score="3" Body="&lt;p&gt;The idea of erasure being projection onto &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is perhaps misleading in this context (my fault for mentioning it in a comment without having looked at the full details of what this specific paper did). This paper does not project the set of qubits &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; onto the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. Instead, they trace out those qubits. Perhaps the best way of writing this, to be more consistent with the notation is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G\rightarrow \text{Tr}_yG\otimes \frac{I_y}{2^{|y|}}.&#xA;$$&lt;/span&gt;&#xA;If you think of &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; as some sum of terms in the Pauli basis,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;G=\sum_{x\in\{0,1,2,3\}^n}\alpha_x\sigma_x,&#xA;$$&lt;/span&gt;&#xA;then what the partial trace is doing is selecting all the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; for which the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; components of &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt; are all &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, let us consider terms&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{z\in\{0,1\}^{n}}'Z_z\sigma_xZ_z.&#xA;$$&lt;/span&gt;&#xA;I'm using the notation &lt;span class=&quot;math-container&quot;&gt;$\sum'$&lt;/span&gt; to denote the fact that while &lt;span class=&quot;math-container&quot;&gt;$z\in\{0,1\}^n$&lt;/span&gt;, I'm only summing over terms where &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; is 0 on every site not specified by &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; or the neighbours of &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; (i.e. those not in the set &lt;span class=&quot;math-container&quot;&gt;$L_y$&lt;/span&gt; in the paper's notation).&#xA;There are two possibilities for the fixed &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and a particular &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; - either &lt;span class=&quot;math-container&quot;&gt;$Z_z$&lt;/span&gt; commutes or anti-commutes with &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_z\sigma_xZ_z=(-1)^{x'\cdot z}\sigma_x.&#xA;$$&lt;/span&gt;&#xA;Here I'm using &lt;span class=&quot;math-container&quot;&gt;$x'$&lt;/span&gt; to denote a binary string derived from &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; which is 1 for a given site if &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; yielded an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;.&#xA;Thus,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{z\in\{0,1\}^{n}}'Z_z\sigma_xZ_z=\sigma_x\sum_{z\in\{0,1\}^{n}}'(-1)^{x'\cdot z}.&#xA;$$&lt;/span&gt;&#xA;This is &lt;span class=&quot;math-container&quot;&gt;$2^{|L_y|}\sigma_x$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$x'$&lt;/span&gt; is 0 on all the sites &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; and its neighbours. It's 0 otherwise. This immediately excludes any stabilizer (product of generators) that contains a generator (of the form &lt;span class=&quot;math-container&quot;&gt;$XZZZ\ldots Z$&lt;/span&gt;) where the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; acts on one of the sites to be traced out, or one of its neighbours. Since all generators act on a single vertex and its neighbours, this means that the only terms remaining do not act at all on the sites being traced out, i.e. they are &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; on those sites. Exactly the set of stabilizers you were trying to select.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-04-13T06:52:17.897" LastActivityDate="2021-04-13T06:52:17.897" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16964" PostTypeId="2" ParentId="16957" CreationDate="2021-04-12T07:30:34.587" Score="1" Body="&lt;p&gt;Measurements in a VQE (also in Qiskit) are performed as projective measurements. Have a look &lt;a href=&quot;https://physics.stackexchange.com/questions/184524/what-is-the-difference-between-general-measurement-and-projective-measurement&quot;&gt;here&lt;/a&gt; for a related question in Physics SE.&#xA;Citing from Nielsen and Chuang's book &amp;quot;Quantum Computation and Quantum Information&amp;quot;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;A projective measurement is described by an observable, &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, a Hermitian operator on the state space of the system being observed. The observable has a spectral decomposition, &lt;span class=&quot;math-container&quot;&gt;$$M = \sum_{m} mP_{m}$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P_{m}$&lt;/span&gt; is the projector onto the eigenspace of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;. The possible outcomes of the measurement correspond to the eigenvalues, &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, of the observable. Upon measuring the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, the probability of getting result &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$$p(m) = \langle\psi|P_{m}|\psi\rangle$$&lt;/span&gt; Given that outcome &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; occurred, the state of the quantum system immediately after the measurement is &lt;span class=&quot;math-container&quot;&gt;$$\frac{P_{m}|\psi\rangle}{\sqrt{p(m)}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;If you have access, also have a look at &lt;a href=&quot;https://iopscience.iop.org/article/10.1088/1367-2630/18/2/023023/pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15408" LastActivityDate="2021-04-12T07:30:34.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16965" PostTypeId="1" CreationDate="2021-04-12T09:29:31.917" Score="0" ViewCount="31" Body="&lt;p&gt;In Quantum Mechanics, the phase can be divided into geometric phase and dynamical phase. In mach-zehnder interferometer, after the photon passes through the phase shifter, what kind of phase does it gain? The geometric one or the dynamical one?  Geometric phase is the phase like &lt;a href=&quot;https://en.wikipedia.org/wiki/Geometric_phase&quot; rel=&quot;nofollow noreferrer&quot;&gt;Berry Phase&lt;/a&gt;, and there are &lt;a href=&quot;https://physics.stackexchange.com/questions/369245/difference-between-dynamical-and-geometric-phase&quot;&gt;differences&lt;/a&gt; between them.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="13968" LastEditDate="2021-04-12T10:49:21.960" LastActivityDate="2021-04-12T10:49:21.960" Title="After a photon passes through the phase shifter, does it gain the geometric phase or dynamical phase?" Tags="&lt;quantum-gate&gt;&lt;quantum-optics&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="16966" PostTypeId="2" ParentId="6716" CreationDate="2021-04-12T12:36:43.983" Score="0" Body="&lt;p&gt;Have a look at &lt;a href=&quot;https://arxiv.org/pdf/1908.02163.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this recently published paper&lt;/a&gt; presenting a protein folding quantum algorithm. This work was done using Qiskit and the algorithm will soon be published as part of the new &lt;a href=&quot;https://medium.com/qiskit/introducing-qiskit-nature-cb9e588bb004&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Nature&lt;/a&gt; package.&lt;/p&gt;&#xA;" OwnerUserId="15408" LastActivityDate="2021-04-12T12:36:43.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16967" PostTypeId="1" AcceptedAnswerId="16974" CreationDate="2021-04-12T13:36:58.977" Score="2" ViewCount="75" Body="&lt;p&gt;Let &lt;code&gt;circ&lt;/code&gt; be a &lt;code&gt;QuantumCircuit&lt;/code&gt; object. Running &lt;code&gt;circ.decompose()&lt;/code&gt; returns a circuit that consists entirely of gates native to IBMQ computers (single-qubit operations + CNOT).&lt;/p&gt;&#xA;&lt;p&gt;I'm interested in decomposing &lt;code&gt;circ&lt;/code&gt; into a circuit consisting of gates native to ion-trap quantum computers (that is, single-qubit gates + Mølmer–Sørensen). Is there a way to do this in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2021-04-12T13:56:58.630" Title="Can Qiskit decompose circuits into non-IBMQ basis gate sets?" Tags="&lt;qiskit&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16968" PostTypeId="5" CreationDate="2021-04-12T13:37:01.057" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T13:37:01.057" LastActivityDate="2021-04-12T13:37:01.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16969" PostTypeId="4" CreationDate="2021-04-12T13:37:01.057" Score="0" Body="Python is a multi-paradigm, dynamically typed, multipurpose programming language. It is designed to be quick to learn, understand, and use, and enforce a clean and uniform syntax." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T14:49:11.143" LastActivityDate="2021-04-12T14:49:11.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16970" PostTypeId="5" CreationDate="2021-04-12T13:38:26.743" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T13:38:26.743" LastActivityDate="2021-04-12T13:38:26.743" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16971" PostTypeId="4" CreationDate="2021-04-12T13:38:26.743" Score="0" Body="PyCharm is an integrated development environment (IDE) for Python. It is developed by JetBrains for Windows, Mac OS X and Linux." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T15:53:57.647" LastActivityDate="2021-04-12T15:53:57.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16972" PostTypeId="5" CreationDate="2021-04-12T13:40:19.990" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T13:40:19.990" LastActivityDate="2021-04-12T13:40:19.990" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16973" PostTypeId="4" CreationDate="2021-04-12T13:40:19.990" Score="0" Body="Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T15:53:35.527" LastActivityDate="2021-04-12T15:53:35.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16974" PostTypeId="2" ParentId="16967" CreationDate="2021-04-12T13:56:58.630" Score="5" Body="&lt;p&gt;You can specify the target basis for instance using &lt;code&gt;transpile&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import transpile&#xA;&#xA;target_basis = ['rx', 'ry', 'rz', 'h', 'cx']&#xA;decomposed = transpile(circuit,&#xA;                       basis_gates=target_basis, &#xA;                       optimization_level=0)  # 0 for no optimization, 3 is max&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the target basis should be complete (e.g. &lt;code&gt;rz h cx&lt;/code&gt;). For high optimization levels (2 or 3) you might have to include &lt;code&gt;u&lt;/code&gt; and &lt;code&gt;cx&lt;/code&gt; so all optimization passes work correctly.&lt;/li&gt;&#xA;&lt;li&gt;I don't think the Molmer-Sorensen gate is currently supported as basis gate&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-04-12T13:56:58.630" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="16975" PostTypeId="5" CreationDate="2021-04-12T15:45:46.873" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T15:45:46.873" LastActivityDate="2021-04-12T15:45:46.873" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16976" PostTypeId="4" CreationDate="2021-04-12T15:45:46.873" Score="0" Body="a model in which a computation is a sequence of quantum gates, which are reversible transformations on an n-qubit register (the quantum-mechanical analog of an n-bit register)" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:01:03.097" LastActivityDate="2021-04-12T16:01:03.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16977" PostTypeId="5" CreationDate="2021-04-12T15:47:34.030" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T15:47:34.030" LastActivityDate="2021-04-12T15:47:34.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16978" PostTypeId="4" CreationDate="2021-04-12T15:47:34.030" Score="0" Body="For questions about vector spaces of all dimensions and linear transformations between them, including systems of linear equations, bases, dimensions, subspaces, matrices, determinants, traces, eigenvalues and eigenvectors, diagonalization, Jordan forms, etc." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:01:12.087" LastActivityDate="2021-04-12T16:01:12.087" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16979" PostTypeId="5" CreationDate="2021-04-12T15:50:01.790" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T15:50:01.790" LastActivityDate="2021-04-12T15:50:01.790" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16980" PostTypeId="4" CreationDate="2021-04-12T15:50:01.790" Score="0" Body="For questions associated with the calculation of probability, expected value, variance, standard deviation, or similar statistical quantities." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:00:50.653" LastActivityDate="2021-04-12T16:00:50.653" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16981" PostTypeId="5" CreationDate="2021-04-12T15:53:02.773" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T15:53:02.773" LastActivityDate="2021-04-12T15:53:02.773" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16982" PostTypeId="4" CreationDate="2021-04-12T15:53:02.773" Score="0" Body="Quantum key distribution (QKD) is a secure communication method that implements a cryptographic protocol using quantum mechanics. It enables two parties to produce a shared random secret key known only to them, which can then be used to encrypt and decrypt messages. " OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:11:03.633" LastActivityDate="2021-04-12T16:11:03.633" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16983" PostTypeId="5" CreationDate="2021-04-12T15:54:58.727" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T15:54:58.727" LastActivityDate="2021-04-12T15:54:58.727" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16984" PostTypeId="4" CreationDate="2021-04-12T15:54:58.727" Score="0" Body="A branch of atomic, molecular, and optical physics dealing with how individual quanta of light, known as photons, interact with atoms and molecules. It includes the study of the particle-like properties of photons." OwnerUserId="13991" LastEditorUserId="10480" LastEditDate="2021-04-12T16:39:30.263" LastActivityDate="2021-04-12T16:39:30.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16985" PostTypeId="5" CreationDate="2021-04-12T15:57:17.163" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T15:57:17.163" LastActivityDate="2021-04-12T15:57:17.163" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16986" PostTypeId="4" CreationDate="2021-04-12T15:57:17.163" Score="0" Body="a procedure that outputs repeated examples of the same quantum system - particle or multiparticle system - in the same quantum state" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:11:27.050" LastActivityDate="2021-04-12T16:11:27.050" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16987" PostTypeId="5" CreationDate="2021-04-12T16:02:55.437" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:02:55.437" LastActivityDate="2021-04-12T16:02:55.437" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16988" PostTypeId="4" CreationDate="2021-04-12T16:02:55.437" Score="0" Body="A machine learning model or algorithm that combines concepts from quantum computing and artificial neural networks encompassing a variety of ideas, ranging from quantum computers emulating the exact computations of neural nets, to general trainable quantum circuits that bear only little resemblence with the multi-layer perceptron structure.&#xD;&#xA;&#xD;&#xA;" OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-12T16:12:05.923" LastActivityDate="2021-04-12T16:12:05.923" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16989" PostTypeId="5" CreationDate="2021-04-12T16:05:07.013" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:05:07.013" LastActivityDate="2021-04-12T16:05:07.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16990" PostTypeId="4" CreationDate="2021-04-12T16:05:07.013" Score="0" Body="For questions about trace, the sum of elements on the main diagonal of a square matrix, which can concern matrices, operators, or functions." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:37:42.397" LastActivityDate="2021-04-12T16:37:42.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16991" PostTypeId="5" CreationDate="2021-04-12T16:07:51.813" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:07:51.813" LastActivityDate="2021-04-12T16:07:51.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16992" PostTypeId="4" CreationDate="2021-04-12T16:07:51.813" Score="0" Body="TensorFlow Quantum (TFQ) is a quantum machine learning library for rapid prototyping of hybrid quantum-classical ML models. It integrates quantum computing algorithms and logic designed in Cirq and provides quantum computing primitives compatible with existing TensorFlow APIs and quantum circuit simulators." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T17:13:00.577" LastActivityDate="2021-04-12T17:13:00.577" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16993" PostTypeId="5" CreationDate="2021-04-12T16:10:08.583" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:10:08.583" LastActivityDate="2021-04-12T16:10:08.583" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16994" PostTypeId="4" CreationDate="2021-04-12T16:10:08.583" Score="0" Body="Eigenvalues are numbers associated with a linear operator from a vector space  to itself:  is an eigenvalue of :→ if the map ↦− is not injective." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:32:02.513" LastActivityDate="2021-04-12T16:32:02.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16995" PostTypeId="5" CreationDate="2021-04-12T16:14:05.610" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:14:05.610" LastActivityDate="2021-04-12T16:14:05.610" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16996" PostTypeId="4" CreationDate="2021-04-12T16:14:05.610" Score="0" Body="For questions about inner products and inner product spaces, including questions about the dot product. An inner product space is a vector space equipped with an inner product. The dot product (seen in multivariable calculus and linear algebra) is a simple example of an inner product—other inner products may be seen as generalizations of the dot product." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T16:38:31.470" LastActivityDate="2021-04-12T16:38:31.470" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16997" PostTypeId="5" CreationDate="2021-04-12T16:15:44.137" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:15:44.137" LastActivityDate="2021-04-12T16:15:44.137" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16998" PostTypeId="4" CreationDate="2021-04-12T16:15:44.137" Score="0" Body="Qrack is a GPU-accelerated HPC quantum computer simulator framework. The core library is dependency-free C++11, with optional OpenCL and Boost headers. Qrack aims to optimize the performance of noiseless pure state simulations. To this end, it contains many “layers” of functionality and optimization techniques." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-13T10:37:37.540" LastActivityDate="2021-04-13T10:37:37.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="16999" PostTypeId="5" CreationDate="2021-04-12T16:16:56.480" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:16:56.480" LastActivityDate="2021-04-12T16:16:56.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17000" PostTypeId="4" CreationDate="2021-04-12T16:16:56.480" Score="0" Body="For questions on parametrization, the process of finding parametric equations of a curve, a surface, or, more generally, a manifold or a variety, defined by an implicit equation." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T17:12:39.613" LastActivityDate="2021-04-12T17:12:39.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17001" PostTypeId="5" CreationDate="2021-04-12T16:22:17.857" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:22:17.857" LastActivityDate="2021-04-12T16:22:17.857" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17002" PostTypeId="4" CreationDate="2021-04-12T16:22:17.857" Score="0" Body="Quantum dots (QDs) are man-made nanoscale crystals that that can transport electrons. When UV light hits these semiconducting nanoparticles, they can emit light of various colors. These artificial nanostructures can possess many varied properties depending on their size, shape, composition, and structure." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T17:12:06.777" LastActivityDate="2021-04-12T17:12:06.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17003" PostTypeId="2" ParentId="16928" CreationDate="2021-04-12T16:33:09.107" Score="3" Body="&lt;ol&gt;&#xA;&lt;li&gt;Getting arbitrary superpositions can be done without too much difficulty if you have arbitrary single-qubit rotation gates. See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5431/forming-states-of-the-form-sqrtp-vert-0-rangle-sqrt1-p-vert-1-rangle&quot;&gt;here&lt;/a&gt; for several answers on how. Though, it might be easier to take Martin Vesely's answer and just expand the array to a power of 2.&lt;/li&gt;&#xA;&lt;li&gt;Generally, to use Grover's algorithm, you have a diffusion operation (the circuit that produces the superposition, described above) and an oracle operation, which can recognize what you are searching for. Grover's algorithm works for a boolean oracle, meaning the result should a yes or no. In the problem you gave, you want to find an index from a target. But this can be done: The circuit you want will take an index as input, retrieve the element of the array at that index (in superposition!), and compare it to the target value, flipping the phase of the state if the result equals the target value.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In this way, Grover's algorithm will return an index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$A[i]$&lt;/span&gt; equals the target value. If no such index exists, it will return a random index. So you will need to do one last look-up of index &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; to check whether the target is there, or not in the array at all.&lt;/p&gt;&#xA;&lt;p&gt;However: I think Grover's algorithm is a bad choice for this problem. My reasoning is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The array is sorted, except for a pivot! So even though Grover's algorithm can find the target in &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N})$&lt;/span&gt; queries, a classical binary search should be able to find the pivot and the target in &lt;span class=&quot;math-container&quot;&gt;$O(\log N)$&lt;/span&gt; queries. Moreover, if it finds the pivot once, it can keep the pivot.&lt;/li&gt;&#xA;&lt;li&gt;I firmly believe that the actual &lt;em&gt;cost&lt;/em&gt; to access &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; bits of memory in superposition is &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; (more specifically, &lt;span class=&quot;math-container&quot;&gt;$\Theta(N)$&lt;/span&gt;). The reason is that the circuit has to have some effect on all &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; bits of memory, if it's performing an access in superposition, so it needs to apply some gate to every qubit. Given this cost, the total cost of Grover's algorithm is &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N})$&lt;/span&gt; queries, times &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; for each query, for &lt;span class=&quot;math-container&quot;&gt;$O(N^{3/2})$&lt;/span&gt; total cost. This is more than a classical linear search through the array (if classical memory access is less than &lt;span class=&quot;math-container&quot;&gt;$O(N^{1/2})$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Point #2 is partly personal opinion, though I think it's important to keep in mind that using Grover's algorithm for a search of classical data requires that each oracle call performs a superposition access to all of the memory, however much cost you give to such a procedure.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2021-04-12T16:33:09.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17004" PostTypeId="5" CreationDate="2021-04-12T16:35:01.953" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:35:01.953" LastActivityDate="2021-04-12T16:35:01.953" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17005" PostTypeId="4" CreationDate="2021-04-12T16:35:01.953" Score="0" Body="For questions about the &quot;extrinsic&quot; angular momentum carried by elementary particles." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T19:22:28.543" LastActivityDate="2021-04-12T19:22:28.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17006" PostTypeId="5" CreationDate="2021-04-12T16:35:52.187" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:35:52.187" LastActivityDate="2021-04-12T16:35:52.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17007" PostTypeId="4" CreationDate="2021-04-12T16:35:52.187" Score="0" Body="Bosons are integer-spin particles that obey Bose-Einstein statistics. Two bosons can occupy the same quantum state." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T19:19:40.310" LastActivityDate="2021-04-12T19:19:40.310" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17008" PostTypeId="5" CreationDate="2021-04-12T16:55:34.493" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:55:34.493" LastActivityDate="2021-04-12T16:55:34.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17009" PostTypeId="4" CreationDate="2021-04-12T16:55:34.493" Score="0" Body="We say that something is symmetric if there is some transformation we can perform on that object that leaves some property unchanged. The set of symmetry transformations of an object form a group, and the name of this group is used as the name of the symmetry of the object. In the context of quantum mechanics, symmetry gives rise to linear operators." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T19:26:26.227" LastActivityDate="2021-04-12T19:26:26.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17010" PostTypeId="5" CreationDate="2021-04-12T16:58:45.993" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T16:58:45.993" LastActivityDate="2021-04-12T16:58:45.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17011" PostTypeId="4" CreationDate="2021-04-12T16:58:45.993" Score="0" Body="A metric is a generalization of the concept of &quot;distance&quot; in the Euclidean sense. Metric spaces are sets on which a metric is defined, and arise as a special case of the more general notion of a topological space." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T18:33:35.590" LastActivityDate="2021-04-12T18:33:35.590" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17012" PostTypeId="5" CreationDate="2021-04-12T17:03:43.757" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T17:03:43.757" LastActivityDate="2021-04-12T17:03:43.757" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17013" PostTypeId="4" CreationDate="2021-04-12T17:03:43.757" Score="0" Body="For questions about exponentiation, the operation of raising one quantity to the power of another. &#xD;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-12T18:07:32.027" LastActivityDate="2021-04-12T18:07:32.027" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17014" PostTypeId="2" ParentId="16928" CreationDate="2021-04-12T17:11:46.570" Score="2" Body="&lt;p&gt;Any problem that involves searching over stored data is not suited for Grover's algorithm. You would always be better off using a parallel classical machine rather than a quantum computer to solve it.&lt;/p&gt;&#xA;&lt;p&gt;Sometimes people say there is an advantage, but they are talking about a context where you restrict the classical hardware to have a constant number of CPUs. This is particularly problematic if quantum memory requires error correction driven by classical CPUs, because then the assumptions are implicitly giving &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; CPUs to the quantum approach but not to the classical approach.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Serial classical: &lt;span class=&quot;math-container&quot;&gt;$O(n^2)$&lt;/span&gt; hardware time (&lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; queries to &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; bits of RAM handled by &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt; CPUs)&lt;/li&gt;&#xA;&lt;li&gt;Parallel classical: &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; hardware time (&lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt; queries to &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; CPUs)&lt;/li&gt;&#xA;&lt;li&gt;Serial quantum: &lt;span class=&quot;math-container&quot;&gt;$O(n^{1.5})$&lt;/span&gt; hardware time (&lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{n})$&lt;/span&gt; queries to &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; qubits of quantum ram handled by &lt;span class=&quot;math-container&quot;&gt;$O(1)$&lt;/span&gt; quantum processors)&lt;/li&gt;&#xA;&lt;li&gt;Parallel quantum: Grover's algorithm is inherently serial, so this just delegates to parallel classical or serial quantum.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-12T17:11:46.570" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17015" PostTypeId="5" CreationDate="2021-04-12T17:28:27.323" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-12T17:28:27.323" LastActivityDate="2021-04-12T17:28:27.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17016" PostTypeId="4" CreationDate="2021-04-12T17:28:27.323" Score="0" Body="For questions about the order-finding problem." OwnerUserId="13991" LastEditorUserId="55" LastEditDate="2021-04-27T10:57:57.977" LastActivityDate="2021-04-27T10:57:57.977" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17017" PostTypeId="2" ParentId="16942" CreationDate="2021-04-12T17:38:24.557" Score="4" Body="&lt;p&gt;For adiabatic Grover you want the ground state of the final Hamiltonian to be the marked item. The key idea with Grover is that the item is &lt;strong&gt;hard to find but easy to verify&lt;/strong&gt;. So the idea is you embed the 'easy to verify' into the Hamiltonian, which is the similar as marking the item via the phase oracle in the gate model.&lt;/p&gt;&#xA;&lt;p&gt;For example consider a simple case where the database is an unordered collection of integers &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D} = \{z: z &#xA;\in \mathbb{Z}\}$&lt;/span&gt; given in a binary representation &lt;span class=&quot;math-container&quot;&gt;$z = \{0,1\}^n$&lt;/span&gt;. We want to find the &lt;span class=&quot;math-container&quot;&gt;$x \in \mathbb{Z}$&lt;/span&gt; item, thus we want our Hamiltonian to have it ground state when &lt;span class=&quot;math-container&quot;&gt;$x = z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The easiest way to encode this, for a predetermined &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; value, the easy to verify part, is &lt;span class=&quot;math-container&quot;&gt;$\min (x - z)^2 \rightarrow z$&lt;/span&gt;. If we expand this out with the binary encoding for &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; variables we can can get a system of second order interactions which we can assign coupling strengths to. This gives us the final adiabatic Hamiltonian with a ground state for &lt;span class=&quot;math-container&quot;&gt;$x = z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Of course this is a trivial example, instead consider an item defined by &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; qubits, we could use the first &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits to encode a unique 'label' and then &lt;span class=&quot;math-container&quot;&gt;$M-n$&lt;/span&gt; qubits to encode the item data. Therefore we can use the above method to search for an item with label &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, where the Hamiltonian does not act on the &lt;span class=&quot;math-container&quot;&gt;$M-n$&lt;/span&gt; data qubits.&lt;/p&gt;&#xA;" OwnerUserId="6139" LastEditorUserId="6139" LastEditDate="2021-04-12T17:44:11.387" LastActivityDate="2021-04-12T17:44:11.387" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17018" PostTypeId="2" ParentId="6716" CreationDate="2021-04-12T18:01:21.553" Score="0" Body="&lt;p&gt;From a more fault-tolerant perspective, &lt;a href=&quot;https://arxiv.org/abs/2101.10279&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/2101.10279&lt;/a&gt; also tackles this problem.&lt;/p&gt;&#xA;&lt;p&gt;Disclaimer: I am one of the authors :)&lt;/p&gt;&#xA;" OwnerUserId="13404" LastEditorUserId="2927" LastEditDate="2021-04-12T18:17:47.273" LastActivityDate="2021-04-12T18:17:47.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17019" PostTypeId="1" CreationDate="2021-04-12T18:08:35.387" Score="4" ViewCount="85" Body="&lt;p&gt;I am experimenting with &lt;a href=&quot;https://journals.aps.org/prx/pdf/10.1103/PhysRevX.8.041015&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/prx/pdf/10.1103/PhysRevX.8.041015&lt;/a&gt; and in equation 36 I find that they use the norm of the Hamiltonian.&lt;/p&gt;&#xA;&lt;p&gt;Is there a clean way to compute it, or an upper bound lower than &lt;span class=&quot;math-container&quot;&gt;$\lambda = \sum_j |w_j|$&lt;/span&gt; for the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = \sum_j w_j H_j$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H_j$&lt;/span&gt; unitary, other than taking the Jordan-Wigner or Bravyi Kitaev, constructing the matrix and finding the norm of the matrix?&lt;/p&gt;&#xA;&lt;p&gt;I expect this way to be quite slow and would avoid it if possible, but do not see how. Extra points if can be done cleanly using OpenFermion (notice that OpenFermion helps with DiagonalCoulombOperator but not in any other case).&#xA;Thanks!&lt;/p&gt;&#xA;" OwnerUserId="13404" LastEditorUserId="13404" LastEditDate="2021-04-13T08:48:44.737" LastActivityDate="2021-04-26T19:40:13.603" Title="Finding the norm of a Hamiltonian" Tags="&lt;hamiltonian-simulation&gt;&lt;openfermion&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17020" PostTypeId="2" ParentId="6198" CreationDate="2021-04-12T18:10:44.213" Score="1" Body="&lt;p&gt;I think the key issue here is interference from the elements in the superposition. If you do not have interference, you do not get any speedup, just a probabilistic classical algorithm.&lt;/p&gt;&#xA;" OwnerUserId="13404" LastActivityDate="2021-04-12T18:10:44.213" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17021" PostTypeId="1" AcceptedAnswerId="17023" CreationDate="2021-04-12T19:30:47.590" Score="3" ViewCount="35" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\Phi_1,\Phi_2$&lt;/span&gt; be CPT maps with Kraus decomposition&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Phi_1=\sum_{k=1}^{d_1}M_k\rho M_k^\dagger, \quad \Phi_2=\sum_{k=1}^{d_2} N_k\rho N_k^\dagger, \quad \text{s.t.} \quad \sum_{k=1}^{d_1}M_k^\dagger M_k=\sum_{k=1}^{d_2} N_k^\dagger N_k=\mathbb I.&#xA;\end{equation}&lt;/span&gt;&#xA;and let &lt;span class=&quot;math-container&quot;&gt;$p\in[0,1]$&lt;/span&gt; . Consider the following (convex) combinations of the two maps:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\Phi=p\Phi_1+(1-p)\Phi_2.&#xA;\end{equation}&lt;/span&gt;&#xA;I'd like to find a Kraus decomposition for this map. Inserting the above gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi(\rho)=p\left(\sum_{k=1}^{d_1}M_k\rho M_k^\dagger\right)+(1-p)\left(\sum_{k=1}^{d_2} N_k\rho N_k^\dagger\right),&#xA;$$&lt;/span&gt;&#xA;The two representations, in general, have a different number of elements; I guess I can always fix this by taking &lt;span class=&quot;math-container&quot;&gt;$D:=\max(d_1,d_2)$&lt;/span&gt; and extend the smallest one with null operators. After doing this, one can rewrite the sum as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Phi=p\left(\sum_{k=1}^DM_k\rho M_k^\dagger-N_k\rho N_k^\dagger\right)+\sum_{k=1}^DN_k\rho N_k^\dagger&#xA;$$&lt;/span&gt;&#xA;which strikes me something we need to do to exploit the convexity property. To make progress, I've thought about inserting a few identities by the normalization conditions above. However, I can't quite make it work.&lt;/p&gt;&#xA;" OwnerUserId="15135" LastEditorUserId="55" LastEditDate="2021-04-12T20:16:03.763" LastActivityDate="2021-04-12T20:17:38.657" Title="Kraus representation of a convex combination of CPT maps" Tags="&lt;quantum-operation&gt;&lt;kraus-representation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17022" PostTypeId="1" CreationDate="2021-04-12T19:51:42.023" Score="7" ViewCount="50" Body="&lt;p&gt;&lt;strong&gt;How do we define whether a device is a noisy intermediate-scale quantum (NISQ) device with respect to number of qubits and their error rates? Does it make sense to do this?&lt;/strong&gt; I believe I once saw a definition of a NISQ device as one with on the order of &lt;span class=&quot;math-container&quot;&gt;$n \le 10^5$&lt;/span&gt; qubits and single qubit error rates on the order of &lt;span class=&quot;math-container&quot;&gt;$\epsilon \ge 10^{-4}$&lt;/span&gt; – &lt;strong&gt;are there any references that attempt to define the &lt;em&gt;'intermediate-scale'&lt;/em&gt; part of NISQ?&lt;/strong&gt; As far as I'm aware, John Preskill did not provide any explicit definitions (this seems to have been prudent at the time, perhaps it still is).&lt;/p&gt;&#xA;&lt;p&gt;Attempting to unpack things a bit, it seems that a NISQ device must be one that is designed to leverage &lt;em&gt;noisy&lt;/em&gt;, not logical (error-corrected), qubits. If we are to believe that, then the obvious question is how many logical qubits do we need to justify entering the fault tolerant quantum computing (FTQC) regime? Do we require a quantum supremacy experiment on a FTQC such as &lt;a href=&quot;https://www.nature.com/articles/s41586-019-1666-5&quot; rel=&quot;nofollow noreferrer&quot;&gt;the one demonstrated&lt;/a&gt; by the Google-led collaboration or does a more appropriate alternative exist?&lt;/p&gt;&#xA;&lt;p&gt;Let's say that the we answer the latter question in the affirmative and assume 53 qubits is sufficient to realize an equivalent quantum supremacy in the FTQC regime (i.e. 53 logical qubits), can we estimate the transition from NISQ to FTQC to meaningfully occur once a system capable of error correcting the &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; number of noisy qubits with single qubit&lt;sup&gt;1&lt;/sup&gt; error rate &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; to yield 53 logical qubits capable of completing a similar RCS task with XEB benchmarking? If so, what do we estimate the order of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; noisy qubits and &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; error rate(s) to be?&lt;/p&gt;&#xA;&lt;p&gt;Another way to think about this: What would an update to this 2018 graph from &lt;a href=&quot;https://ai.googleblog.com/2018/03/a-preview-of-bristlecone-googles-new.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Google AI Blog&lt;/a&gt; look like?&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&quot;https://i.stack.imgur.com/QB61N.png&quot; alt=&quot;2D conceptual chart showing the relationship between error rate and number of qubits. The intended research direction of the Quantum AI Lab is shown in red, where we hope to access near-term applications on the road to building an error corrected quantum computer.&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any answers which explain the current state of thinking with respect to the question would be fantastic.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;sub&gt;1. Setting aside that single qubit errors are far from the only errors we're concerned with.&lt;/sub&gt;&lt;/p&gt;&#xA;" OwnerUserId="1937" LastEditorUserId="1937" LastEditDate="2021-04-13T22:41:35.210" LastActivityDate="2021-04-13T22:41:35.210" Title="Definition of a NISQ device with respect to qubit counts and error rates" Tags="&lt;resource-request&gt;&lt;nisq&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17023" PostTypeId="2" ParentId="17021" CreationDate="2021-04-12T20:17:38.657" Score="3" Body="&lt;p&gt;Why not just concatenate the Kraus operators from each channel, i.e., take &lt;span class=&quot;math-container&quot;&gt;$\{Z_{k}\}_{1 \leq k \leq d_1 + d_1}$&lt;/span&gt; where&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z_k = \begin{cases} \sqrt{p} M_k \qquad \quad &amp;amp;\text{if } 1 \leq k \leq d_1 \\&#xA;\sqrt{1-p}N_{k - d_1} &amp;amp;\text{if } d_1 &amp;lt; k \leq d_1 + d_2 &#xA;\end{cases}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can check that these operators satisfy completeness property for Kraus operators and that they characterise the action of the convex combination channel &lt;span class=&quot;math-container&quot;&gt;$p \Phi_1 + (1-p) \Phi_2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-04-12T20:17:38.657" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17024" PostTypeId="2" ParentId="17019" CreationDate="2021-04-12T21:02:26.043" Score="5" Body="&lt;p&gt;The spectral norm &lt;span class=&quot;math-container&quot;&gt;$\|H\|$&lt;/span&gt; (sometimes denoted&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\|H\|_2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\|H\|_\infty$&lt;/span&gt;) in this case is the largest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. There's no meaningful bound for this number without having additional details about the system. On the other hand if you are indeed working in a basis where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is diagonal than the spectral norm is trivially the largest diagonal element.&lt;/p&gt;&#xA;&lt;p&gt;In Openfermion the largest eigenvalue is very easy to compute by defining an operator &lt;code&gt;H&lt;/code&gt; containing your Hamiltonian and then finding the largest number returned by&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openfermion.linalg.eigenspectrum(H)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However this is wasting a lot of resources since you only need the largest eigenvalue. A more efficient route would probably be to cast &lt;code&gt;H&lt;/code&gt; as a sparse matrix and then use scipy's sparse utilities to get &lt;em&gt;only the largest eigenvalue&lt;/em&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sparse_mat = openfermion.get_sparse_operator(H)&#xA;max_eigenvalue, _ = scipy.sparse.linalg.eigsh(sparse_mat, k=1, which=&amp;quot;LM&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Those keyword arguments tell scipy to find the &lt;strong&gt;one&lt;/strong&gt; eigenvalue with the &lt;strong&gt;L&lt;/strong&gt;argest &lt;strong&gt;M&lt;/strong&gt;agnitude. This runs faster than computing the entire spectrum of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and so it might be suitable for your needs. However, depending on the structure of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; it might be more prudent to use a dense eigensolver, in which case you can take a look at &lt;a href=&quot;https://stackoverflow.com/questions/12167654/fastest-way-to-compute-k-largest-eigenvalues-and-corresponding-eigenvectors-with&quot;&gt;this question&lt;/a&gt; for an alternative approach.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt;Also called &amp;quot;induced L2 norm&amp;quot; as &lt;span class=&quot;math-container&quot;&gt;$\|A\|_2 \equiv \max_{\|u\|_2=1} \|Au\|_2$&lt;/span&gt;, which is why I chose the subscript &amp;quot;2&amp;quot;. But be careful though as sometimes &lt;span class=&quot;math-container&quot;&gt;$\|\cdot\|_2$&lt;/span&gt; will sometimes denote &amp;quot;Frobenius norm&amp;quot; which is another name for the Schatten 2-norm. All of these are good reasons to always explicitly describe the norm you are talking about.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="10480" LastEditDate="2021-04-26T19:40:13.603" LastActivityDate="2021-04-26T19:40:13.603" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17025" PostTypeId="1" CreationDate="2021-04-13T06:23:12.957" Score="0" ViewCount="26" Body="&lt;p&gt;In variational quantum eigensolver, it is common to transform the Hamiltonian to a qubit form by Jordan-Wigner transformation, for example. After that, the algorithm needs to measure the qubit Hamiltonian, which consist of Pauli strings. I am wondering how qiskit get this done, can somebody provide me the source code that measures the qubit Hamiltonian (Pauli strings) in qiskit?&lt;/p&gt;&#xA;" OwnerUserId="8611" LastActivityDate="2021-04-13T06:23:12.957" Title="Source code for Hamiltonian measurement in qiskit" Tags="&lt;qiskit&gt;&lt;measurement&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2021-04-13T13:54:22.897" ContentLicense="CC BY-SA 4.0" />
  <row Id="17026" PostTypeId="1" AcceptedAnswerId="17028" CreationDate="2021-04-13T09:42:13.207" Score="0" ViewCount="72" Body="&lt;p&gt;Question 4.6: One reason why the&#xA;&lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(θ)$&lt;/span&gt; operators are referred to as rotation operators is the following fact, which&#xA;you are to prove. Suppose a single qubit has a state represented by the Bloch&#xA;vector &lt;span class=&quot;math-container&quot;&gt;$λ$&lt;/span&gt;. Then the effect of the rotation&lt;span class=&quot;math-container&quot;&gt;$ R_\hat{n}(θ)$&lt;/span&gt; on the state is to rotate it by an&#xA;angle &lt;span class=&quot;math-container&quot;&gt;$θ$&lt;/span&gt; about the &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; axis of the Bloch sphere. This fact explains the rather&#xA;mysterious looking factor of two in the definition of the rotation matrices.&lt;/p&gt;&#xA;&lt;p&gt;In this question &lt;span class=&quot;math-container&quot;&gt;$\hat{n} = (n_x, n_y, n_z)$&lt;/span&gt; is a unit vector in three dimension and we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$R_\hat{n}(θ) = cos(\theta/2) I - isin(\theta/2)(n_xX + n_yY + n_zZ)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't understand the idea of this question? I need some explanation of this question.&lt;/p&gt;&#xA;" OwnerUserId="14994" LastEditorUserId="55" LastEditDate="2021-04-13T12:18:34.710" LastActivityDate="2021-04-13T12:18:34.710" Title="Exercise 4.6 in Quantum Computing and Quantum Information Nielsen and Chuang" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17027" PostTypeId="1" CreationDate="2021-04-13T10:24:43.797" Score="1" ViewCount="46" Body="&lt;p&gt;I am trying to run &lt;a href=&quot;https://qiskit.org/documentation/nature/tutorials/02_vibrational_structure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; Qiskit Nature tutorial (Vibrational Structure) and it uses the GaussianForceDriver. Every time I run the Gaussian job from Qiskit I get this message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;QiskitNatureError: Could not locate Gaussian 16 executable 'g16'. Please check that it is installed correctly.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Do I have to install the commercial version of Gaussian, or should it work with just the Qiskit Nature module? If that's the case, what could be the reason for getting this error if I already installed all requirements for Qiskit Nature? Thank you!&lt;/p&gt;&#xA;" OwnerUserId="15556" LastEditorUserId="55" LastEditDate="2021-04-13T12:17:40.903" LastActivityDate="2021-04-13T12:17:40.903" Title="How do I work with Gaussian in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17028" PostTypeId="2" ParentId="17026" CreationDate="2021-04-13T10:42:28.223" Score="2" Body="&lt;p&gt;Imagine you have a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\vec{m}$&lt;/span&gt;. Now apply this rotation &lt;span class=&quot;math-container&quot;&gt;$R_n(\theta)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Can you show how the vector &lt;span class=&quot;math-container&quot;&gt;$\vec{m}$&lt;/span&gt; is changed by this unitary?&lt;/p&gt;&#xA;&lt;p&gt;Without wanting to do too much of the calculation for you, I find it instructive to write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\langle\psi|=\frac{1}{2}(I+\vec{m}\cdot\vec{\sigma})&#xA;$$&lt;/span&gt;&#xA;and, letting &lt;span class=&quot;math-container&quot;&gt;$\vec{n}^\perp$&lt;/span&gt; be perpendicular to &lt;span class=&quot;math-container&quot;&gt;$\vec{n}$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\langle\psi|=\frac{1}{2}(I+(\vec{n}\cdot\vec{m})\vec{n}\cdot\vec{\sigma}+(\vec{n}^\perp\cdot\vec{m})\vec{n}^\perp\cdot\vec{\sigma}).&#xA;$$&lt;/span&gt;&#xA;The unitary evolution is described by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_n(\theta)|\psi\rangle\langle\psi|R_n(-\theta).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-13T10:42:28.223" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17029" PostTypeId="2" ParentId="17026" CreationDate="2021-04-13T10:51:16.513" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;I don't understand the idea of this question? I need some explanation of this question.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You're supposed to show that the operation is the same in both representations. That applying a rotation matrix to the state vector gives the same result as converting the state to a bloch vector, rotating the bloch vector, then converting back.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-13T10:51:16.513" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17030" PostTypeId="2" ParentId="17027" CreationDate="2021-04-13T12:05:24.210" Score="1" Body="&lt;p&gt;To use the &lt;code&gt;GaussianForcesDirver&lt;/code&gt; in Qiskit, you either need an output file generated by Gaussian (such as &lt;a href=&quot;https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/chemistry/aux_files/CO2_freq_B3LYP_ccpVDZ.log&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; &lt;code&gt;.log&lt;/code&gt; file from the tutorial).&#xA;Or you need an installation (and hence also a license) of Gaussian, as stated in the Qiskit documentation &lt;a href=&quot;https://qiskit.org/documentation/apidoc/qiskit.chemistry.drivers.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The drivers in the chemistry module obtain their information from classical ab-initio programs or libraries. Several drivers, interfacing to common programs and libraries, are available. To use the driver its dependent program/library must be installed. See the relevant installation instructions below for your program/library that you intend to use.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15408" LastActivityDate="2021-04-13T12:05:24.210" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17031" PostTypeId="1" CreationDate="2021-04-13T12:55:38.890" Score="0" ViewCount="45" Body="&lt;p&gt;I am Newbie in Quantum Computing World.&lt;/p&gt;&#xA;&lt;p&gt;While studying on my own, I was curious about one thing, so I asked this question.&lt;/p&gt;&#xA;&lt;p&gt;My question is as follows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When I configure the superposition states of qubits through Hadamard gate and  input this to a certain function, for output superposition states of qubits, is there a way to mark only two cases that meet certain conditions through checker qubits?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For example, consider the superposition states with the number of &lt;span class=&quot;math-container&quot;&gt;$2^{128}$&lt;/span&gt; cases composed of 128 qubits (meaning after passing through the Hadamard gate).&lt;/p&gt;&#xA;&lt;p&gt;Let's say we input this to a certain function (running on the quantum circuit) and get the output as superposition states. At this time, I want to mark in checker qubit(or ancill qubit) only two inputs that satisfy a specific value by performing xor (exclusive or) among the outputs. Are there any algorithms that can do this?&lt;/p&gt;&#xA;&lt;p&gt;All the best!&lt;/p&gt;&#xA;" OwnerUserId="15559" LastEditorUserId="15559" LastEditDate="2021-04-13T15:58:24.247" LastActivityDate="2021-04-13T15:58:24.247" Title="Method to mark only when certain conditions are satisfied in the superposition states of qubits" Tags="&lt;circuit-construction&gt;&lt;grovers-algorithm&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17032" PostTypeId="1" AcceptedAnswerId="17105" CreationDate="2021-04-13T15:06:41.437" Score="3" ViewCount="168" Body="&lt;p&gt;The unitary evolution of a time-dependent hamiltonian is given by the time-ordered matrix exponential&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;U(t)&amp;amp;=\mathcal T\exp\left[-i\int_0^tH(\tau)d\tau\right]\\&#xA;&amp;amp;=I-i\int_0^td\tau\,H(\tau)-\frac12\int_0^td\tau\int_0^t d\tau'\,\mathcal T[H(\tau)H(\tau')]+\ldots\\&#xA;&amp;amp;=I-i\int_0^td\tau\,H(\tau)-\int_0^td\tau\int_0^\tau d\tau'\,H(\tau)H(\tau')+\ldots&#xA;\end{aligned}$$&lt;/span&gt;&#xA;To implement &lt;span class=&quot;math-container&quot;&gt;$U(t)$&lt;/span&gt; on a quantum computer, people often work with a trotterised form, where the integrals are discretized as Riemann sums. One typically encounters expressions such as (&lt;a href=&quot;https://arxiv.org/abs/1805.11568&quot; rel=&quot;nofollow noreferrer&quot;&gt;arXiv:1805.11568&lt;/a&gt;, eq. 1):&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{aligned}&#xA;U(t)%&amp;amp;\approx\exp[-i\sum_{a=0}^{k-1}H(a\Delta\tau)\Delta\tau]\\&#xA;&amp;amp;\approx\prod_{a=0}^{k-1}\exp[-iH(a\Delta\tau)\Delta\tau]~~~~(\Delta\tau=t/k)&#xA;\end{aligned}$$&lt;/span&gt;&#xA;However, in this expression, the time ordering symbol &lt;span class=&quot;math-container&quot;&gt;$\mathcal T$&lt;/span&gt; has somehow vanished.&lt;/p&gt;&#xA;&lt;p&gt;What's going on here?&lt;/p&gt;&#xA;" OwnerUserId="2687" LastEditorUserId="2687" LastEditDate="2021-04-14T08:55:27.200" LastActivityDate="2021-04-23T09:27:09.380" Title="Why is the time ordering omitted in the trotterised version of the time-dependent evolution operator?" Tags="&lt;hamiltonian-simulation&gt;&lt;adiabatic-model&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17033" PostTypeId="1" CreationDate="2021-04-13T15:07:29.390" Score="5" ViewCount="157" Body="&lt;p&gt;Recently, I have been working with quantum channel capacity for quantum-quantum channels and I was wondering if there exist some results for channel compositions.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, I have been looking for results on what happens to quantum channel capacity when a serial composition of quantum channels is considered, i.e. &lt;span class=&quot;math-container&quot;&gt;$C(\mathcal{N_1}\circ\mathcal{N_2}) = ?$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N_1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N_2}$&lt;/span&gt; are the quantum channels in consideration.&lt;/p&gt;&#xA;&lt;p&gt;The channels are described by their Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{E_k^1\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{E_j^2\}$&lt;/span&gt;. Note that the serial composition channel is a quantum channel that will be described by Kraus operators &lt;span class=&quot;math-container&quot;&gt;$\{E_k^1 \cdot E_j^2\}$&lt;/span&gt;, i.e. all the possible products of the Kraus operators of the individual channels.&lt;/p&gt;&#xA;&lt;p&gt;I have been looking around but have not found anything interesting yet. I would appreciate any information, partial results and especially literature on the topic.&lt;/p&gt;&#xA;" OwnerUserId="2371" LastEditorUserId="10480" LastEditDate="2021-04-28T02:41:14.907" LastActivityDate="2021-04-28T02:41:14.907" Title="Quantum capacity for serial composition of quantum channels" Tags="&lt;resource-request&gt;&lt;quantum-operation&gt;&lt;kraus-representation&gt;&lt;channel-capacity&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17034" PostTypeId="1" CreationDate="2021-04-13T15:58:59.727" Score="2" ViewCount="58" Body="&lt;p&gt;Recently in class, we learned about the EPR state. I know that no matter what basis the first qubit is measured in, the two outcomes have an equal probability. However, how does one prove this? I somewhat understand what is happening and why, but if you know where a through proof of this might be that would be amazing.&lt;/p&gt;&#xA;" OwnerUserId="15561" LastEditorUserId="10480" LastEditDate="2021-04-18T19:19:30.190" LastActivityDate="2021-04-18T19:19:30.190" Title="How to prove that EPR outcomes have equal probability no matter the basis?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;non-locality&gt;&lt;state-preparation&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17035" PostTypeId="2" ParentId="17034" CreationDate="2021-04-13T16:25:43.847" Score="3" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho_{AB}$&lt;/span&gt; be a quantum state shared between two parties, Alice and Bob. Suppose Alice performs a POVM measurement &lt;span class=&quot;math-container&quot;&gt;$\{M_i\}_i$&lt;/span&gt; on her half of the state. Then the probability that Alice obtains outcome &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is given by the Born rule as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(i) = \mathrm{Tr}[\rho_{AB}(M_i \otimes I)].&#xA;$$&lt;/span&gt;&#xA;But whenever we have the trace of a multipartite operator we can always perform a partial trace first, i.e., &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[X] = \mathrm{Tr}[\mathrm{Tr}_B[X]]$&lt;/span&gt;. So in this case&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(i) = \mathrm{Tr}[\mathrm{Tr}_B[\rho_{AB}(M_i \otimes I)]] = \mathrm{Tr}[\rho_{A} M_i]&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\rho_A = \mathrm{Tr}_B[\rho_{AB}]$&lt;/span&gt;. For the EPR states, if you calculate &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; (you should verify this) you'll find it is equal to &lt;span class=&quot;math-container&quot;&gt;$I/2$&lt;/span&gt; (the maximally mixed state). Thus for the EPR states&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p(i) = \mathrm{Tr}[I/2 M_i] = \frac12 \mathrm{Tr}[M_i].&#xA;$$&lt;/span&gt;&#xA;Now if &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; is a rank one qubit projector (which I'm assuming is what you meant by a measurement) then &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}[M_i] = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-04-13T16:25:43.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17036" PostTypeId="2" ParentId="17034" CreationDate="2021-04-13T17:24:44.400" Score="2" Body="&lt;p&gt;The local state (described by density matrix) of each qubit in EPR state is&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\rho=\frac{1}{2}\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix}&#xA;\end{equation}&lt;/span&gt;&#xA;It does not depend on basis, so both outcomes have 50% probabilities in every measurement basis.&lt;/p&gt;&#xA;&lt;p&gt;Proving directly the expression for qubit's local state is a little long.&lt;/p&gt;&#xA;&lt;p&gt;The EPR state is pure 2-qubit state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle_{EPR}= \frac{1}{\sqrt{2}}(|0\rangle|0\rangle+|1\rangle|1\rangle)&#xA;$$&lt;/span&gt;&#xA;or in the standard basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle_{EPR}= \frac{1}{\sqrt{2}}\begin{pmatrix}{1\\0\\0\\1}&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The 2-qubit density matrix is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{AB}=|\Psi\rangle_{EPR} \langle \Psi|_{EPR}= \frac{1}{\sqrt{2}}\begin{pmatrix}1\\0\\0\\1&#xA;\end{pmatrix}&#xA;\cdot&#xA;\frac{1}{\sqrt{2}}\begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{pmatrix}=\frac{1}{2}\begin{pmatrix}&#xA;1&amp;amp;0&amp;amp;0&amp;amp;1\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;0&amp;amp;0&amp;amp;0&amp;amp;0\\&#xA;1&amp;amp;0&amp;amp;0&amp;amp;1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;and the local state of say qubit &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is given by the partial trace over qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=tr_B[\rho_{AB}]=\frac{1}{2}\begin{pmatrix}&#xA;1&amp;amp;0\\&#xA;0&amp;amp;1&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;The same expression is obtained for qubit &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="10480" LastEditDate="2021-04-18T16:16:11.403" LastActivityDate="2021-04-18T16:16:11.403" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17038" PostTypeId="2" ParentId="17032" CreationDate="2021-04-13T20:08:22.087" Score="1" Body="&lt;p&gt;The point of time-ordering is to take into account that a Hamiltonian may not commute with itself at different times, &lt;span class=&quot;math-container&quot;&gt;$[ H(t), H(t') ] \neq 0$&lt;/span&gt;. But the time-ordering operator is really just a reminder to keep track of the correct ordering when expanding the exponential as a Taylor-series (see the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dyson_series&quot; rel=&quot;nofollow noreferrer&quot;&gt;Dyson-series&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;The whole point of the Trotter-Suzuki approximation, on the other hand, is to split an exponential of a sum of non-commuting operators into a product of exponentials, &lt;span class=&quot;math-container&quot;&gt;$e^{A+B} \approx (e^{A/n} e^{B/n})^n$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, if you approximate integration as a Riemann sum,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\int_0^t dt' H(t') \approx \sum_l H(l \Delta t) \Delta t \ ,$$&lt;/span&gt;&#xA;what you get is a series of non-commuting operators, &lt;span class=&quot;math-container&quot;&gt;$[H(l\Delta t), H((l+1)\Delta t)] \neq 0$&lt;/span&gt;.&#xA;This is now exactly what you can use your Trotter approximation for:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align} \mathcal{T}\exp\Bigl(-i \int_0^t dt' H(t') \Bigr)&#xA;\approx \exp\Bigl(-i \sum_l H(l \Delta t) \Delta t \Bigr) \\&#xA;\approx \Biggl[ \prod_l \exp\Bigl(-i H(l \Delta t) \frac{\Delta t}{n} \Bigr) \Biggr]^n \ . \end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I want to highlight that, generally, choosing the order in which you trotterize your exponential, i.e., whether you write &lt;span class=&quot;math-container&quot;&gt;$e^{A+B} \approx (e^{A/n} e^{B/n})^n$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$e^{A+B} \approx (e^{B/n} e^{A/n})^n$&lt;/span&gt;, is arbitrary. However, this does not mean that the order is irrelevant. In fact, the accuracy of the approximation might vary quite significantly depending on the chosen order of factors.&lt;/p&gt;&#xA;&lt;p&gt;That said, from a physical point of view, time-ordering should be implied in an expansion like the above and is well-motivated, as @Gianni Mossi pointed out in the comments with an intuitive example.&#xA;In the above case, ordering should be with times increasing from right to left (i.e., operator at the smallest time applied to the state first).&lt;/p&gt;&#xA;" OwnerUserId="15408" LastEditorUserId="15408" LastEditDate="2021-04-23T09:27:09.380" LastActivityDate="2021-04-23T09:27:09.380" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17040" PostTypeId="1" CreationDate="2021-04-14T09:10:33.420" Score="1" ViewCount="33" Body="&lt;p&gt;I encountered some problems when using the qiskit pakage to define the 2-electron reduced density matrix (2-RDM), which is a 4-index tensor, &lt;span class=&quot;math-container&quot;&gt;$\langle a_i^\dagger a_j^\dagger a_k a_l\rangle$&lt;/span&gt;. I need to first transform each term in the tensor (2-RDM) to the qubit form by Jordan-Wigner transformation. Then, I can measure each term using the expectation feature of the VQE function in qiskit. However, the &lt;code&gt;qiskit.chemistry.fermionic_operator&lt;/code&gt; class only support Hamiltonian to be transformed to the qubit form. Therefore, there are two questions here to finish the 2-RDM measurement job. The first is how to define general fermionic operators by qiskit, especially the one has the form of the 2-RDM. The second is that are there any build-in function in qiskit to tranform general fermionic operators to the qubit form.&lt;/p&gt;&#xA;" OwnerUserId="8611" LastEditorUserId="55" LastEditDate="2021-04-15T10:27:02.610" LastActivityDate="2021-04-15T10:27:02.610" Title="How to transform fermionic operators in qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17041" PostTypeId="1" AcceptedAnswerId="17042" CreationDate="2021-04-14T11:59:26.800" Score="1" ViewCount="61" Body="&lt;p&gt;Alice sends a 0 in computational basis&#xA;I understand that theres a &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt; probability that eve guesses the basis wrong, and can go with Hadamard. So it's &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt; chance Eve will pick computational and &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt; chance of Hadamard.&lt;/p&gt;&#xA;&lt;p&gt;Now if Eve measured wrong and went with Hadamard, and Bob computational, however Bob got it wrong and got a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, which is a &lt;span class=&quot;math-container&quot;&gt;$\frac12$&lt;/span&gt; probability,&lt;/p&gt;&#xA;&lt;p&gt;Theres a &lt;span class=&quot;math-container&quot;&gt;$\frac14$&lt;/span&gt; probability Alice and bob will detect Eve's intrusion if they verify that bit.&lt;/p&gt;&#xA;&lt;p&gt;This is all clear to me, however. Tampering is where I get confused. Detecting Eve tampered with a qubit is &lt;span class=&quot;math-container&quot;&gt;$\frac14$&lt;/span&gt;, and depending on the qubits &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, Eve will go undetected with the probability &lt;span class=&quot;math-container&quot;&gt;$\left(\frac34\right)^n$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The question is (keep in mind there is an intruder), say Alice sent &lt;span class=&quot;math-container&quot;&gt;$20$&lt;/span&gt; qubits to Bob, and only &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; qubits Bob chose the correct basis, the rest are discarded. Alice and Bob then compare the results between the two to detect Eve, is the probability of detecting Eve&#xA;&lt;span class=&quot;math-container&quot;&gt;$1-\left(\frac34\right)^{10}$&lt;/span&gt; or just &lt;span class=&quot;math-container&quot;&gt;$\left(\frac34\right)^{10}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15567" LastEditorUserId="55" LastEditDate="2021-04-15T10:27:47.473" LastActivityDate="2021-04-15T10:27:47.473" Title="What is the probability of detecting Eve's tampering, in BB84?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;bb84&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17042" PostTypeId="2" ParentId="17041" CreationDate="2021-04-14T12:58:34.820" Score="3" Body="&lt;p&gt;Firstly we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbb{P}[\text{Eve detected in round $i$}] = \mathbb{P}[\text{Eve chooses wrong basis and Bob chooses correct basis}].&#xA;$$&lt;/span&gt;&#xA;As we assume Alice, Bob and Eve choose their basis independently and uniformly at random we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathbb{P}[\text{Eve detected in round $i$}] = \frac12 \times \frac12 = \frac14.&#xA;$$&lt;/span&gt;&#xA;So we also have &lt;span class=&quot;math-container&quot;&gt;$\mathbb{P}[\text{Eve not detected in round $i$}] = 1-\mathbb{P}[\text{Eve detected in round $i$}]=\frac34$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now suppose we run the protocol for &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; rounds&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\mathbb{P}[\text{Eve detected}] &amp;amp;= 1-\mathbb{P}[\text{Eve not detected}] \\&#xA;&amp;amp;=1- \mathbb{P}[\text{Eve not detected in round $1$},\dots,\text{Eve not detected in round $n$}] \\&#xA;&amp;amp;=1-\prod_{i=1}^n \mathbb{P}[\text{Eve not detected in round $i$}] \\&#xA;&amp;amp;= 1 - \left(\frac34\right)^n&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;where on the second line we used the fact that the event &amp;quot;Eve not detected&amp;quot; is the same as the event &amp;quot;Eve is not detected in every round&amp;quot;, on the third line we used the assumption that each round is performed independently to take the joint probability to a product and on the final line we inserted our probability that Eve is not detected on round &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-04-14T12:58:34.820" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17043" PostTypeId="1" AcceptedAnswerId="17046" CreationDate="2021-04-14T13:12:22.113" Score="3" ViewCount="94" Body="&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html#3qubits&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Qiskit tutorial on Grover's Algorithm&lt;/a&gt; shows an example of finding two marked solutions out of 8 items, produced by 3 qubits. Using the general diffuser code it provides, however, I realize that the algorithm fails to properly find the solution if the oracle is set to mark single item.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, the oracle in the example marks two items:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3)&#xA;qc.cz(0, 2)&#xA;qc.cz(1, 2)&#xA;oracle_ex3 = qc.to_gate()&#xA;oracle_ex3.name = &amp;quot;U$_\omega$&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I've changed it to mark just one:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(3)&#xA;qc.cz(0, 2)&#xA;oracle_ex3 = qc.to_gate()&#xA;oracle_ex3.name = &amp;quot;U$_\omega$&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now that there is only one solution and 8 possibilities, we should iterate the Grover oracle + diffuser twice, for which I did:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;n = 3&#xA;grover_circuit = QuantumCircuit(n)&#xA;grover_circuit = initialize_s(grover_circuit, [0,1,2])&#xA;grover_circuit.append(oracle_ex3, [0,1,2])&#xA;grover_circuit.append(diffuser(n), [0,1,2])&#xA;grover_circuit.append(oracle_ex3, [0,1,2])&#xA;grover_circuit.append(diffuser(n), [0,1,2])&#xA;grover_circuit.measure_all()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And here is the measurement outcome plot:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tDlR6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tDlR6.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As far as I expect the plot should show the state &lt;span class=&quot;math-container&quot;&gt;$|101⟩$&lt;/span&gt; with nearly 100% probability. I tried iterating it 3 and 4 times, but the result is still messy. Is there something that I'm missing here?&lt;/p&gt;&#xA;" OwnerUserId="4204" LastEditorUserId="4204" LastEditDate="2021-04-14T13:19:59.160" LastActivityDate="2021-04-14T14:10:00.733" Title="Implementing 3-Qubit Grover Algorithm in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17044" PostTypeId="1" CreationDate="2021-04-14T13:46:41.277" Score="0" ViewCount="47" Body="&lt;p&gt;From the image below, if we focus on the first qubit, we know after Hadamard (state 1) &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; will become &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and the second qubit &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; will become &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What exactly would the result be after &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;? I understand that &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; performs a CNOT gate on the qubits. But how is this result shown? By this I mean the image below is it (the equation for state 2), &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; and why is it that specific one? For instance, I presume state 2 would be &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;? is it simply the process that if it was previously &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; then it just flips after going through CNOT gate to &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;? In which state 3 then results in it being &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; ?&lt;br /&gt;&#xA;state 2:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/zObuM.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zObuM.png&quot; alt=&quot;algorithm&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;By states I refer to the bottom numbered symbols within this image below.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/VSItz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VSItz.png&quot; alt=&quot;state2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15567" LastEditorUserId="55" LastEditDate="2021-04-14T21:56:39.390" LastActivityDate="2021-04-14T21:56:39.390" Title="Understanding Deutsch Algorithm" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;hadamard&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17045" PostTypeId="2" ParentId="17044" CreationDate="2021-04-14T13:58:55.457" Score="1" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is not necessarily a controlled-not (although that is one possible example). Instead, what &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; does is, for any 2-qubit input in a basis state &lt;span class=&quot;math-container&quot;&gt;$|xy\rangle$&lt;/span&gt;, if evaluates&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_f|xy\rangle=|x\rangle|y\oplus f(x)\rangle.&#xA;$$&lt;/span&gt;&#xA;The key trick here, of course, is that we're not supplying basis states, but superpositions. In particular, the second qubit is in the &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; state. Let's see the result of that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_f|x\rangle|-\rangle=|x\rangle(|0\oplus f(x)\rangle-|1\oplus f(x)\rangle.&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; could either be 0 or 1, in which case the two outputs couple be either&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;f(x)=0:&amp;amp;|0\oplus 0\rangle-|1\oplus 0\rangle=|-\rangle \\&#xA;f(x)=1:&amp;amp;|0\oplus 1\rangle-|1\oplus 1\rangle=-|-\rangle \\&#xA;\end{align*}&lt;/span&gt;&#xA;This can be summarised as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_f|x\rangle|-\rangle=(-1)^{f(x)}|x\rangle|-\rangle.&#xA;$$&lt;/span&gt;&#xA;Thus, your output at &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;((-1)^{f(0)}|0\rangle+(-1)^{f(1)}|1\rangle)|-\rangle/\sqrt{2}&#xA;$$&lt;/span&gt;&#xA;Now you can easily apply the Hadamard to the first qubit, and see that the answer depends on the value &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(0)+f(1)}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-14T13:58:55.457" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17046" PostTypeId="2" ParentId="17043" CreationDate="2021-04-14T14:10:00.733" Score="2" Body="&lt;p&gt;Number of states marked isn't a strict correspondence with number of CZ gates: your new oracle still marks two states, but, rather than &lt;span class=&quot;math-container&quot;&gt;$\left|101\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|110\right&amp;gt;$&lt;/span&gt;, it marks &lt;span class=&quot;math-container&quot;&gt;$\left|101\right&amp;gt;$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left|111\right&amp;gt;$&lt;/span&gt;. To see this, remember a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate flips the sign of a &lt;span class=&quot;math-container&quot;&gt;$\left|1\right&amp;gt;$&lt;/span&gt;: if the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate is applied to a 1 and the control is a 1, the sign is flipped, so, in your new circuit the first and last qubit have to be 1 but the other could be 0 or 1 and still be flipped, so either situation ends up marked. The original circuit doesn't have &lt;span class=&quot;math-container&quot;&gt;$\left|111\right&amp;gt;$&lt;/span&gt; as an option since it makes both &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gates flip the sign which cancels out, meaning that one but not both of the control qubits have to be 1. If you only apply the Grover Diffuser once in either the original circuit or your new one, it will be a superposition of the two marked states and will work correctly.&lt;/p&gt;&#xA;&lt;p&gt;If you want to implement a marking of one state in an intuitively simple fashion, use a CCZ gate and flank each qubit that needs to be a 0 with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates. If you do this, it will get the answer with high probability after 2 Grover Diffusions as expected.&lt;/p&gt;&#xA;" OwnerUserId="7680" LastActivityDate="2021-04-14T14:10:00.733" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17047" PostTypeId="5" CreationDate="2021-04-14T15:53:55.260" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-14T15:53:55.260" LastActivityDate="2021-04-14T15:53:55.260" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17048" PostTypeId="4" CreationDate="2021-04-14T15:53:55.260" Score="0" Body="Categories are structures containing objects and arrows between them. Many mathematical structures can be viewed as objects of a category, with structure-preserving morphisms as arrows. Reformulating properties of mathematical objects in the general language of category can help one see connections between seemingly different areas of mathematics." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-14T16:01:12.967" LastActivityDate="2021-04-14T16:01:12.967" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17049" PostTypeId="5" CreationDate="2021-04-14T15:58:03.360" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-14T15:58:03.360" LastActivityDate="2021-04-14T15:58:03.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17050" PostTypeId="4" CreationDate="2021-04-14T15:58:03.360" Score="0" Body="RevLib is an online resource for benchmarks within the domain of reversible and quantum circuit design. It provides a database of functions (including HDL descriptions) with respective circuit realizations given in an appropriate format. RevLib is the main file format for RevKit, a public domain toolkit for reversible circuit design." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-14T16:01:02.507" LastActivityDate="2021-04-14T16:01:02.507" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17051" PostTypeId="1" AcceptedAnswerId="17057" CreationDate="2021-04-15T00:17:29.303" Score="2" ViewCount="142" Body="&lt;p&gt;I'm a bit confused with the representation of mixed states in a Bloch sphere. Are they represented as points or vectors? For pure states, they're vectors on the surface of the Bloch sphere and have a norm of 1. If I have a mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_sp_s|\psi_s\rangle\langle\psi_s|$&lt;/span&gt;, is there a way I can see &lt;span class=&quot;math-container&quot;&gt;$\sum_sp_s=1$&lt;/span&gt; on the Bloch sphere?&lt;/p&gt;&#xA;" OwnerUserId="15562" LastEditorUserId="55" LastEditDate="2021-04-15T08:55:40.367" LastActivityDate="2021-04-15T16:35:18.883" Title="Can I understand mixed states using the Bloch sphere?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="2" CommentCount="10" ClosedDate="2021-04-15T19:36:54.070" ContentLicense="CC BY-SA 4.0" />
  <row Id="17052" PostTypeId="2" ParentId="5391" CreationDate="2021-04-15T00:57:01.110" Score="1" Body="&lt;p&gt;The QPE algorithm can estimate the phase within an additive error of &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$t = N + p$&lt;/span&gt; qubits with &lt;span class=&quot;math-container&quot;&gt;$p \propto \mathcal{O}(\text{log}(1/\epsilon))$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1/\epsilon)$&lt;/span&gt; controlled-U operations. See Nielson &amp;amp; Chuang section 5.2.1 for a full derivation and analysis.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-15T01:04:08.020" LastActivityDate="2021-04-15T01:04:08.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17053" PostTypeId="1" CreationDate="2021-04-15T02:33:17.790" Score="1" ViewCount="75" Body="&lt;p&gt;I think similar to &lt;span class=&quot;math-container&quot;&gt;$R_z\big(\frac{\pi}{4}\big)$&lt;/span&gt; gate named T gate, how to standardize the name &lt;span class=&quot;math-container&quot;&gt;$R_z\big(\frac{\pi}{8}\big)$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13731" LastEditorUserId="9006" LastEditDate="2021-04-16T13:58:46.863" LastActivityDate="2021-04-16T13:58:46.863" Title="What is the name for the gate rotating around $Z$ by $\pi/8$?" Tags="&lt;quantum-gate&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17054" PostTypeId="1" AcceptedAnswerId="17061" CreationDate="2021-04-15T02:38:58.663" Score="7" ViewCount="973" Body="&lt;p&gt;On the IBM Quantum Composer website, there are characteristics of qubit computers. For example, ibmq_16_melbourne.&#xA;But there is no description anywhere of what:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;T1(us)&lt;/code&gt;,&#xA;&lt;code&gt;T2(us)&lt;/code&gt;,&#xA;&lt;code&gt;Frequency (GHz)&lt;/code&gt;,&#xA;&lt;code&gt;Readout assignment error&lt;/code&gt;,&#xA;&lt;code&gt;Prob meas0 prep1&lt;/code&gt;,&#xA;&lt;code&gt;Prob meas1 prep0&lt;/code&gt;,&#xA;&lt;code&gt;Readout length (ns)&lt;/code&gt;,&#xA;&lt;code&gt;ID error&lt;/code&gt;,&#xA;&lt;code&gt;√x (sx) error&lt;/code&gt;,&#xA;&lt;code&gt;Single-qubit Pauli-X error&lt;/code&gt;,&#xA;&lt;code&gt;CNOT error&lt;/code&gt;,&#xA;&lt;code&gt;Gate time (ns)&lt;/code&gt; means.&lt;/p&gt;&#xA;&lt;p&gt;Could you write down what they mean?&lt;/p&gt;&#xA;&lt;p&gt;And why isn't there, for example, a &lt;code&gt;Pauli-Z error&lt;/code&gt;, even though there is a &lt;code&gt;Pauli-X error&lt;/code&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5liyN.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5liyN.png&quot; alt=&quot;Characteristics of the IBM quantum computer&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15573" LastActivityDate="2021-04-16T09:48:48.887" Title="Characteristics of the IBM quantum computer" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17055" PostTypeId="1" CreationDate="2021-04-15T03:38:35.010" Score="2" ViewCount="32" Body="&lt;p&gt;In general, quantum algorithms are said to be hybrid algorithms.&lt;/p&gt;&#xA;&lt;p&gt;Especially when storing data in qRAM, it seems to be done through classical calculations.&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to write this part directly to qRAM after passing through Hadamard Gate and performing a specific operation?&lt;/p&gt;&#xA;&lt;p&gt;In other words, can the data in the superposition states be stored directly in qRAM?&lt;/p&gt;&#xA;" OwnerUserId="15559" LastActivityDate="2021-04-15T03:38:35.010" Title="When writing data into qRAM, can I do it in a superposition state?" Tags="&lt;quantum-gate&gt;&lt;superposition&gt;&lt;quantum-memory&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17056" PostTypeId="2" ParentId="17053" CreationDate="2021-04-15T05:40:42.447" Score="6" Body="&lt;p&gt;There is no widely recognizable one-letter name for the gate. However,  &lt;span class=&quot;math-container&quot;&gt;$R\left(\frac{\pi}{8}\right)$&lt;/span&gt; and the more precise &lt;span class=&quot;math-container&quot;&gt;$R_z\left(\frac{\pi}{8}\right)$&lt;/span&gt; are clear and widely used.&lt;/p&gt;&#xA;&lt;p&gt;In a slight abuse of notation, the gate is also occasionally called &lt;span class=&quot;math-container&quot;&gt;$\sqrt{T}$&lt;/span&gt;. This is justified by the fact that for any normal matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; with eigendecomposition &lt;span class=&quot;math-container&quot;&gt;$A=\sum_k\lambda_k|k\rangle\langle k|$&lt;/span&gt; and any function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; analytic in a set containing all &lt;span class=&quot;math-container&quot;&gt;$\lambda_k$&lt;/span&gt;, we can compute &lt;span class=&quot;math-container&quot;&gt;$f(A)$&lt;/span&gt; by applying &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$f(A) = \sum_k f(\lambda_k)|k\rangle\langle k|$&lt;/span&gt; (see e.g. section 2.1.8 on page 75 in Nielsen &amp;amp; Chuang).&lt;/p&gt;&#xA;&lt;p&gt;The reason &lt;span class=&quot;math-container&quot;&gt;$\sqrt{T}$&lt;/span&gt; is an abuse of notation is that the square root in the complex domain is a multi-valued function. It is uniquely defined only for non-negative real numbers. Similarly, for matrices, the square root is uniquely defined only for positive semidefinite matrices, which &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is not. Consequently, the square root of &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is not unique and the notation relies on the expectation that the reader will guess that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{T}$&lt;/span&gt; is meant to denote&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{\pi i/8}&#xA;\end{pmatrix} \equiv R_z\left(\frac{\pi}{8}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and not&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; e^{9\pi i/8}&#xA;\end{pmatrix} \equiv R_z\left(\frac{9\pi}{8}\right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;despite the fact that the square of each matrix is &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that this abuse of notation is used fairly consistently in quantum computing to refer to other gates, e.g. &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\text{CNOT}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{\text{SWAP}}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; and indeed &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; which is &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate#Phase_shift_(%7F%27%22%60UNIQ--postMath-00000038-QINU%60%22%27%7F)_gates&quot; rel=&quot;noreferrer&quot;&gt;occasionally&lt;/a&gt; denoted as &lt;span class=&quot;math-container&quot;&gt;$\sqrt{S}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-15T05:40:42.447" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17057" PostTypeId="2" ParentId="17051" CreationDate="2021-04-15T07:31:43.667" Score="5" Body="&lt;p&gt;An arbitrary &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; &lt;em&gt;Hermitian&lt;/em&gt; matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be decomposed into&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = n_I I + n_X X + n_Y Y + n_Z Z $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;with &lt;span class=&quot;math-container&quot;&gt;$n_X, n_Y, n_Z \in \mathbb{R}$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$X, Y, Z$&lt;/span&gt; are &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;Pauli matrices&lt;/a&gt; and &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; Identiy matrix.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$I = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix},  X= \begin{bmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}, Y = \begin{bmatrix}0 &amp;amp; -i \\ i &amp;amp; 0\end{bmatrix}, Z = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;These matrices, &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}$&lt;/span&gt;, formed an orthorgonal basis for the &lt;em&gt;real vector space&lt;/em&gt; for all &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; Hermitian matrices.  But furthermore, they are an  orthorgonal basis &lt;em&gt;complex vector space&lt;/em&gt; for all &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; matrices.&lt;/p&gt;&#xA;&lt;p&gt;Now, suppose that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; represents a quantum state (either pure or mixed), then it must be a &lt;em&gt;Hermitian matrix with unit trace&lt;/em&gt;, &lt;span class=&quot;math-container&quot;&gt;$Tr(U) = 1$&lt;/span&gt;. This is to make sure we have preservation of probability. Now, if we calculate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; out explicitly, we have that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U &amp;amp;= n_I \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix} + n_X  \begin{bmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{bmatrix}+ n_Y \begin{bmatrix}0 &amp;amp; -i \\ i &amp;amp; 0\end{bmatrix} + n_Z \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; -1\end{bmatrix} \\&#xA;&amp;amp;= \begin{bmatrix}n_I + n_Z &amp;amp; n_X - in_Y \\ n_X + in_Y &amp;amp; n_I - n_Z\end{bmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and this implies that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Tr(U) = Tr\bigg( \begin{bmatrix}n_I + n_Z &amp;amp; n_X - in_Y \\ n_X + in_Y &amp;amp; n_I - n_Z\end{bmatrix} \bigg) = 2n_I = 1 \ \ \Rightarrow \ \ n_I = \dfrac{1}{2}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, given an arbitrary single qubit state (&lt;strong&gt;pure&lt;/strong&gt; or &lt;strong&gt;mixed&lt;/strong&gt;), we can write it as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = \dfrac{1}{2} I + n_X X + n_Y Y + n_Z Z = \dfrac{I + \vec{r}\cdot \vec{\sigma} }{2}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where we use &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt; to denote the vector &lt;span class=&quot;math-container&quot;&gt;$\langle2 n_X, 2 n_Y, 2 n_Z \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma} $&lt;/span&gt; to denote the vector &lt;span class=&quot;math-container&quot;&gt;$\langle X, Y, Z \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, we &lt;strong&gt;must&lt;/strong&gt; have that &lt;span class=&quot;math-container&quot;&gt;$|\vec{r}| \leq 1$&lt;/span&gt; because &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; must be &lt;strong&gt;Positive semi-definite&lt;/strong&gt; (Its &lt;em&gt;eigenvalues&lt;/em&gt; must be &lt;em&gt;non-negative&lt;/em&gt;). To see why  &lt;span class=&quot;math-container&quot;&gt;$|\vec{r}| \leq 1$&lt;/span&gt; will ensure the Positive semi-definite condition, you need to &lt;a href=&quot;https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors#Matrix_examples&quot; rel=&quot;nofollow noreferrer&quot;&gt;calculate the eigenvalues&lt;/a&gt; of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. We can do this in the usual way, by considering the equation:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;det(U - \lambda I) &amp;amp;= det\bigg( \begin{bmatrix}n_I + n_Z - \lambda &amp;amp; n_X - in_Y \\ n_X + in_Y &amp;amp; n_I - n_Z - \lambda \end{bmatrix} \bigg) \\&#xA;&amp;amp;= \lambda^2 - 2n_I \lambda  + n_I^2 - (n_X^2 + n_Y^2 + n_Z^2 ) = 0 \\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This implies that (use quadratic equation)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\lambda &amp;amp;= \dfrac{-(-2n_I)  \pm \sqrt{(-2N_I)^2 - 4(n_I^2  - (n_X^2 + n_Y^2 + n_Z^2 ) )  } }{2} \\&#xA;&amp;amp;= \dfrac{ 2n_I \pm \sqrt{4 (n_X^2 + n_Y^2 + n_Z^2 ) } }{2}\\&#xA;&amp;amp;= n_I \pm \dfrac{|\vec{r}|}{2} \\ &#xA;&amp;amp;= \dfrac{1}{2} \pm  \dfrac{|\vec{r}|}{2} \hspace{1 cm} \textrm{since we know that} \ \ n_I = \dfrac{1}{2} \ \ \textrm{because} \ \ Tr(U) = 1 &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To make sure that &lt;span class=&quot;math-container&quot;&gt;$\lambda \geq 0$&lt;/span&gt; we must have that &lt;span class=&quot;math-container&quot;&gt;$| \vec{r} | \leq 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, note that if &lt;span class=&quot;math-container&quot;&gt;$| \vec{r} |  = 1$&lt;/span&gt; then there is only one non-zero eigenvalue, this implies that we have a &lt;strong&gt;pure&lt;/strong&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$| \vec{r} |  &amp;lt; 1$&lt;/span&gt; then we will have two eigenvalues, says &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_2$&lt;/span&gt;. This implies that this is a mixed state. Furthermore, also note that here we have &lt;span class=&quot;math-container&quot;&gt;$0 &amp;lt; \lambda_1, \lambda_2 &amp;lt; 1$&lt;/span&gt;  and so&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Tr(U^2) = tr( V^{-1} \Sigma^2 V ) = tr(\Sigma^2) = \lambda_1^2 + \lambda_2^2 &amp;lt; 1 $$&lt;/span&gt;&#xA;here &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is composed of eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; is diagonal matrix with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$( \lambda_1, \lambda_2 )$&lt;/span&gt; of  &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;. If you look at the definition of &lt;a href=&quot;https://en.wikipedia.org/wiki/Density_matrix&quot; rel=&quot;nofollow noreferrer&quot;&gt;denisty matrix&lt;/a&gt; you can see that this is a condition to determine whether a state is pure or mixed. Only pure states &lt;span class=&quot;math-container&quot;&gt;$(\rho)$&lt;/span&gt; have the condition &lt;span class=&quot;math-container&quot;&gt;$Tr( \rho^2) = 1 $&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-15T16:35:18.883" LastActivityDate="2021-04-15T16:35:18.883" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17058" PostTypeId="2" ParentId="17051" CreationDate="2021-04-15T08:05:25.167" Score="2" Body="&lt;p&gt;Since density matrix is Hermitian and has unit trace, for a single qubit it always can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \rho = \frac{1}{2}(I+n_x\sigma_x+n_y\sigma_y+n_z\sigma_z)=&#xA;\frac{1}{2}&#xA;\begin{pmatrix}&#xA;1+n_z &amp;amp; n_x-in_y \\&#xA;n_x+in_y &amp;amp; 1-n_z&#xA;\end{pmatrix}&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$n_i$&lt;/span&gt; are some real numbers.&lt;/p&gt;&#xA;&lt;p&gt;Since density matrix is positive semidefinite, it should have non-negative eigenvalues and, consequently, non-negative determinant,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  det(\rho)=\frac{1}{2}(1-n_x^2-n_y^2-n_z^2)\geq 0&#xA;$$&lt;/span&gt;&#xA;or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  n_x^2+n_y^2+n_z^2 \leq 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This equation defines Bloch Sphere (actually ball, not sphere). The pure states have eigenvalues &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; which corresponds to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  n_x^2+n_y^2+n_z^2 = 1&#xA;$$&lt;/span&gt;&#xA;(points on actual sphere). The points inside the sphere,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  n_x^2+n_y^2+n_z^2 &amp;lt; 1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are mixed states&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2021-04-15T08:22:18.667" LastActivityDate="2021-04-15T08:22:18.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17060" PostTypeId="1" AcceptedAnswerId="17062" CreationDate="2021-04-15T08:36:48.117" Score="2" ViewCount="37" Body="&lt;p&gt;In every resource I find (like Nielsen and Chuang or online courses), the density operator is defined as follows: we consider a sequence of pure states &lt;span class=&quot;math-container&quot;&gt;$\left|\psi_i\right\rangle$&lt;/span&gt; with associated probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. If the system is in state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi_i\right\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, then its density operator is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_ip_i\left|\psi_i\right\rangle\left\langle\psi_i\right|.$$&lt;/span&gt;&#xA;However, I do not understand the necessity of &lt;span class=&quot;math-container&quot;&gt;$\left|\psi_i\right\rangle$&lt;/span&gt; being pure states for this. For instance, let us say that the system is in state (potentially mixed) &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; (that is, &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; is a density operator). Then we can prove that its density matrix is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\sum_ip_i\rho_i.$$&lt;/span&gt;&#xA;For this, I use the Lemma defined in &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/16765/10454&quot;&gt;this answer&lt;/a&gt;, assuming it is correct. We consider an arbitrary unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; and an arbitrary basis state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. Applying &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; on the system, we obtain, with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{U}\rho_i\mathbf{U}^\dagger.$$&lt;/span&gt;&#xA;The probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; in this situation is thus given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\rho_i\mathbf{U}^\dagger\right).$$&lt;/span&gt;&#xA;Since this situation happens with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;, the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is finally given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_ip_i\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\rho_i\mathbf{U}^\dagger\right).$$&lt;/span&gt;&#xA;On the other hand, applying &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; gives:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{U}\rho\mathbf{U}^\dagger=\sum_ip_i\mathbf{U}\rho_i\mathbf{U}^\dagger$$&lt;/span&gt;&#xA;which means that the probability of measuring &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is given by, using the linearity property of the trace:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_ip_i\mathrm{tr}\left(|x\rangle\langle x|\mathbf{U}\rho_i\mathbf{U}^\dagger\right).$$&lt;/span&gt;&#xA;Hence, for any unitary &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; and any basis state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, the probabilities of measuring &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; after having applied &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}$&lt;/span&gt; on those systems are equal, hence their density matrices are identical.&lt;/p&gt;&#xA;&lt;p&gt;I cannot see the error here, but on the other hand, I find it surprising that I did not find any mention to this (or I've missed it, which is also quite likely). Is this result correct? Otherwise, where's my mistake?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="55" LastEditDate="2021-04-15T09:11:05.537" LastActivityDate="2021-04-16T12:52:54.400" Title="Can we write the density operator as a sum of mixed states?" Tags="&lt;density-matrix&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="2" CommentCount="12" ContentLicense="CC BY-SA 4.0" />
  <row Id="17061" PostTypeId="2" ParentId="17054" CreationDate="2021-04-15T08:47:42.550" Score="9" Body="&lt;p&gt;A quick and dirty list:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt;&lt;/strong&gt; -  colloquially known as &lt;em&gt;decoherence times&lt;/em&gt;, but slightly more precisely also as the (qubit) &lt;em&gt;relaxation&lt;/em&gt; time (&lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt;) and the (qubit) &lt;em&gt;dephasing&lt;/em&gt; time (&lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$T_{1}$&lt;/span&gt; is a measure of how quickly a qubit in the excited (&lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) state spontaneously relaxes to the ground (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) state.&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt; is slightly more tricky: it is a measure of how fast a &lt;em&gt;coherent&lt;/em&gt; superposition (one with a well-defined relative phase between the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) loses this 'well-defined-ness'. Essentially, it's what makes a qubit a &lt;em&gt;quantum&lt;/em&gt; phenomenon; a (completely) dephased qubit is just a probabilistic classical bit.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Frequency&lt;/strong&gt; - the qubits from IBM are &lt;a href=&quot;https://en.wikipedia.org/wiki/Superconducting_quantum_computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;superconducting&lt;/a&gt; qubits. Interactions with these qubits are performed via microwave resonators; to address each different qubit separately each' qubits resonator has a different frequency. As @Lena has &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/17063/8141&quot;&gt;pointed out&lt;/a&gt;, the frequency is actually defined as the energy difference between the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; states.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Readout assignment error&lt;/strong&gt; - measure of how well the measurement performs - as &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/17059/8141&quot;&gt;luciano&lt;/a&gt; mentions in his answer, the probability of a measurement returning the wrong value.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Prob meas0 prep1&lt;/strong&gt; - The probability that a measurement returns &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; immediately after preparing the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. A combination of faulty preparation and faulty measurements; these are also often referred to as SPAM (&lt;em&gt;state-preparation-and-measurement&lt;/em&gt;) errors.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Prob meas1 prep0&lt;/strong&gt; - like the previous one&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Readout length (ns)&lt;/strong&gt; - time it takes to perform a measurement in (ns). One of the main limiting factors of current quantum hardware; as these times are often considerably longer than the &lt;span class=&quot;math-container&quot;&gt;$T_{2}$&lt;/span&gt;, which makes intermediate measurements (i.e. measurements that are not at the end of a circuit) practically unfeasible.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;ID error&lt;/strong&gt; - measure of the error induced by having the qubit idle (for a typical gate time). The measure used is, I believe, that 'returned' by &lt;a href=&quot;https://en.wikipedia.org/wiki/Randomized_benchmarking&quot; rel=&quot;nofollow noreferrer&quot;&gt;randomized benchmarking&lt;/a&gt;, which closely resembles the process fidelity.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; error&lt;/strong&gt; - measure of error induced by applying the gate in question. Average over all different qubits.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Single-qubit Pauli X error&lt;/strong&gt; - likewise&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CNOT error&lt;/strong&gt; - error of the only two-qubit gate natively implementable on the IBM devices. Average over all possible CNOT gates&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Gate time (ns)&lt;/strong&gt; - &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/17063/8141&quot;&gt;Lena to the rescue again&lt;/a&gt; - this is related to the time it takes to perform a CNOT, the two-qubit gate.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;And why isn't there, for example, a Pauli-Z error, even though there is a Pauli-X error?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The reason there is no error shown for the Pauli Z is because there is (virtually) none. This is because the IBM machines don't really implement &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotations - they keep track of the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; rotations through software, and update the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; (and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;) gates accordingly. Effectively, they rotate the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; axes of the Bloch sphere along the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis - the 'Pauli X' gate is thus actually any rotation along an axis in the &lt;span class=&quot;math-container&quot;&gt;$X-Y$&lt;/span&gt; plane of the Bloch sphere. By changing the phase of the induced wave on the resonator, one can pick the angle the axis makes with a predetermined reference point, and thus implement both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; gates.&lt;/p&gt;&#xA;&lt;p&gt;You might also find &lt;a href=&quot;https://quantum-computing.ibm.com/docs/manage/systems/properties&quot; rel=&quot;nofollow noreferrer&quot;&gt;this page on system properties&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this qiskit notebook on calibration&lt;/a&gt; useful.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-04-16T09:48:48.887" LastActivityDate="2021-04-16T09:48:48.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17062" PostTypeId="2" ParentId="17060" CreationDate="2021-04-15T09:04:41.463" Score="2" Body="&lt;p&gt;All your working is correct. Of course, if you want to &lt;em&gt;define&lt;/em&gt; a density operator/matrix, you cannot define it in terms of another density operator/matrix which is why you will not find an initial presentation of density matrices going in this way. That said, you may want to look up the definition of a mixed separable state. This is typically done in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_{\text{sep}}=\sum_ip_i\sigma^A_i\otimes \sigma^B_i&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\sigma^A_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma^B_i$&lt;/span&gt; are density matrices. You &lt;em&gt;could&lt;/em&gt; write them just as pure states but you will often see it in this form, consistent with the structure you're talking about.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-15T09:04:41.463" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17063" PostTypeId="2" ParentId="17054" CreationDate="2021-04-15T09:37:44.050" Score="6" Body="&lt;p&gt;Just adding some stuff to the already good answer :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The gate time actually is related to the connexion between qubits, so is related to the CNOT, not the single-qubit gates.&lt;/li&gt;&#xA;&lt;li&gt;The frequency is defined as the difference in energy between the ground and excited states, i.e. the |0⟩ and |1⟩ states, respectively.&lt;/li&gt;&#xA;&lt;li&gt;for more info about how to measure all this (T1, T2, frequency), you could check &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html&quot; rel=&quot;noreferrer&quot;&gt;this tutorial&lt;/a&gt; showing all this.&lt;/li&gt;&#xA;&lt;li&gt;about the errors of Z/X, the basis gates of all the different available backends are the cx, x, sx, and rz. So you won't have any error rate for Z but you will have for X because of this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-04-15T09:37:44.050" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17064" PostTypeId="1" CreationDate="2021-04-15T10:05:57.657" Score="1" ViewCount="61" Body="&lt;p&gt;I am new to the field and I am very confused about the status of things right now. Sorry, but this confusion also spills into the framing of my questions.&lt;/p&gt;&#xA;&lt;p&gt;First, a more CS-style question.&lt;/p&gt;&#xA;&lt;p&gt;As far as I understand historically since the invention of Shor's factoring algorithm or around that time the confidence that quantum computers will be able to outperform classical in some tasks has grown. However, there is still very little or no rigorous evidence for that. I've found this account in the &lt;a href=&quot;https://www.quantamagazine.org/finally-a-problem-that-only-quantum-computers-will-ever-be-able-to-solve-20180621/&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantaMagazine&lt;/a&gt; of the result on the oracle separation between BQP and BPP. The significance of this result is not clear to me, but the very fact that it's relatively new seems to be quite telling.&lt;/p&gt;&#xA;&lt;p&gt;At the same time I'm constantly bumping into different papers that claim to de-quantize some important class of problems, say &lt;a href=&quot;https://arxiv.org/abs/1910.06151&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for quantum machine learning and &lt;a href=&quot;https://arxiv.org/abs/2012.14523&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;  for quantum simulations. I do not know whether these results are universally accepted but at least there seems to be no apparent reason why they could not be true in principle. So my first concrete question is&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is there an accessible review somewhere that explains the current status of the affairs?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Next, a more sociological one.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;If my impression is correct, and the theoretical advantage of classical algorithms over quantum is not really established, how should I think about the large investments going into the quantum computing industry right now?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand that this is not a very scientific question, but perhaps there are scientifically motivated answers? For example although Grover's algorithm does not provide an exponential speed-up it still increases performance and maybe this is enough for some practical purposes? Or perhaps one expects that although some types of problems may formally be polynomial-time for both classical and quantum computers, the real-life performance may still be much more favorable in the quantum case?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Related to the last question, are there any applications that are expected to be possible on the near-term quantum computers, say 10 to 20 years? Is there a good review of such prospects?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15239" LastEditorUserId="5955" LastEditDate="2021-04-15T10:55:58.193" LastActivityDate="2021-04-15T10:55:58.193" Title="Is there any firm evidence that quantum computers can be more powerful than classical?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;research&gt;" AnswerCount="0" CommentCount="3" ClosedDate="2021-04-15T18:42:21.277" ContentLicense="CC BY-SA 4.0" />
  <row Id="17065" PostTypeId="1" CreationDate="2021-04-15T13:06:06.727" Score="0" ViewCount="39" Body="&lt;p&gt;I'm a newbie in Quantum Computing. So please be indulgent with me.&lt;/p&gt;&#xA;&lt;p&gt;I'm trying to adapt the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-counting.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit Quantum Counting Example&lt;/a&gt;, which defines its oracle in a programmed quantum circuit, to use a &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.components.oracles.TruthTableOracle.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;truthtable oracle&lt;/a&gt; instead.&#xA;I want to provide a bitstring (e.g. '01110000') and see as a result that there are 3 solutions (amount of ones in the bitstring).&lt;/p&gt;&#xA;&lt;p&gt;The idea is, to put a truthtable oracle in a &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.Grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Grover Search Algo&lt;/a&gt; extract the Grover Operator, make a controlled gate out of it and use this as Grover Iteration in Quantum Counting example. But it doesn't seem to work. The number of solutions calculated at the end doesn't correlate somehow with the provided bitstring.&lt;/p&gt;&#xA;&lt;p&gt;There are several differences between the oracle in the example and the truthtable oracle.&#xA;My truthtable oracle has an flipping qbit (output) which is feeded with state |-&amp;gt; and ancilla qbits.&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure how to handle these flipping and ancilla qubits. Can I reuse these qbits in the grover iterations ('hang in series') or do I have to seperate them per Grover Iteration?&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure, if I have an issue with bit-flipping oracles vs phase-flipping ones in the current scenario.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully someone has a hint for me. Thank you in advance.&lt;/p&gt;&#xA;&lt;p&gt;Here's my code so far (99% copied from the example):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, BasicAer, transpile, assemble&#xA;from qiskit.aqua import QuantumInstance&#xA;from qiskit.aqua.components.oracles import TruthTableOracle&#xA;from qiskit.aqua.algorithms import Grover&#xA;from qiskit.visualization import plot_histogram&#xA;import numpy as np&#xA;import math&#xA;&#xA;def calculateTruthTableString(**kid):&#xA;    &#xA;     &#xA;    return '00100000'&#xA;&#xA;&#xA;## Main&#xA;t = 4   # no. of counting qubits&#xA;n = 3   # no. of searching qubits&#xA;&#xA;# https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html&#xA;qc = QuantumCircuit(n+t+2, t) # Circuit with n+t qubits and t classical bits&#xA;&#xA;# https://qiskit.org/documentation/stubs/qiskit.aqua.components.oracles.TruthTableOracle.html&#xA;truthtable = calculateTruthTableString(amountSearchQbits = n)&#xA;oracle = TruthTableOracle(truthtable)&#xA;oracle.circuit.draw()&#xA;&#xA;# https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.Grover.html&#xA;grover = Grover(oracle)&#xA;&#xA;grover.grover_operator.draw()&#xA;&#xA;result = grover.run(QuantumInstance(BasicAer.get_backend('qasm_simulator'), shots=1024))&#xA;plot_histogram(result.measurement)&#xA;&#xA;grover_iteration = grover.grover_operator.to_gate()&#xA;ctl_grover_iteration = grover_iteration.control()&#xA;ctl_grover_iteration.label = &amp;quot;Ctl GrovIt&amp;quot;&#xA;&#xA;def qft(n):&#xA;    &amp;quot;&amp;quot;&amp;quot;Creates an n-qubit QFT circuit&amp;quot;&amp;quot;&amp;quot;&#xA;    circuit = QuantumCircuit(n)&#xA;    def swap_registers(circuit, n):&#xA;        for qubit in range(n//2):&#xA;            circuit.swap(qubit, n-qubit-1)&#xA;        return circuit&#xA;    def qft_rotations(circuit, n):&#xA;        &amp;quot;&amp;quot;&amp;quot;Performs qft on the first n qubits in circuit (without swaps)&amp;quot;&amp;quot;&amp;quot;&#xA;        if n == 0:&#xA;            return circuit&#xA;        n -= 1&#xA;        circuit.h(n)&#xA;        for qubit in range(n):&#xA;            circuit.cp(np.pi/2**(n-qubit), qubit, n)&#xA;        qft_rotations(circuit, n)&#xA;    &#xA;    qft_rotations(circuit, n)&#xA;    swap_registers(circuit, n)&#xA;    return circuit&#xA;&#xA;qft_dagger = qft(t).to_gate().inverse()&#xA;qft_dagger.label = &amp;quot;QFT†&amp;quot;&#xA;&#xA;# https://qiskit.org/textbook/ch-algorithms/quantum-counting.html#2.4-Putting-it-Together-&#xA;&#xA;# Initialise all qubits to |+&amp;gt;&#xA;for qubit in range(t+n):&#xA;    qc.h(qubit)&#xA;&#xA; # Begin controlled Grover iterations&#xA;iterations = 1&#xA;for qubit in range(t):&#xA;    for i in range(iterations):&#xA;        qc.append(ctl_grover_iteration, [qubit] + [*range(t, n+t+2)])&#xA;    iterations *= 2&#xA;&#xA;&#xA;# Do inverse QFT on counting qubits&#xA;qc.append(qft_dagger, range(t))&#xA;&#xA;qc.measure(range(t), range(t))&#xA;&#xA;# Display the circuit&#xA;qc.draw()&#xA;&#xA;qasm_sim = Aer.get_backend('qasm_simulator')&#xA;transpiled_qc = transpile(qc, qasm_sim)&#xA;qobj = assemble(transpiled_qc)&#xA;job = qasm_sim.run(qobj)&#xA;hist = job.result().get_counts()&#xA;plot_histogram(hist) &#xA;&#xA;measured_str = max(hist, key=hist.get)&#xA;measured_int = int(measured_str,2)&#xA;print(&amp;quot;Register Output = %i&amp;quot; % measured_int)&#xA;theta = (measured_int/(2**t))*math.pi*2&#xA;print(&amp;quot;Theta = %.5f&amp;quot; % theta)&#xA;&#xA;N = 2**(n-1)&#xA;M = N * (math.sin(theta/2)**2)&#xA;print(&amp;quot;No. of Solutions = %.1f&amp;quot; % (N-M)) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15577" LastEditorUserId="55" LastEditDate="2021-04-15T15:50:23.690" LastActivityDate="2021-04-15T15:50:23.690" Title="How to extend Qiskit Quantum Counting with a Truthtable Oracle?" Tags="&lt;programming&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17066" PostTypeId="1" CreationDate="2021-04-15T13:41:11.140" Score="1" ViewCount="51" Body="&lt;p&gt;I am trying to use operfermion to calculated the eigen values for different molecules.&#xA;Tried for Hydrogen, LithiumHydride, Water. It works fine.&#xA;When Itried to calculated the same thing for&#xA;Ozone, Oxygen, HCN etc., the program finally got killed after consuming all the memory.&lt;/p&gt;&#xA;&lt;p&gt;Any help is deeply appreciated.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h2&gt;Here is the sample code to reproduce the issue&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;from numpy import pi&#xA;&#xA;from openfermion.chem import MolecularData&#xA;geometry=[['O',[0,0,0]],['O',[0,1.0885,0.6697]],['O',[0,-1.0885,0.6697]]]&#xA;basis='sto-3g'&#xA;multiplicity=1 #singlet &#xA;charge=0 #neutral&#xA;ozone_molecule=MolecularData(geometry,basis,multiplicity,charge)&#xA;from openfermionpsi4 import run_psi4&#xA;ozone_molecule = run_psi4(ozone_molecule,&#xA;                       run_mp2=True,&#xA;                       run_cisd=True,&#xA;                       run_ccsd=True,&#xA;                       run_fci=True)&#xA;two_electron_integrals = ozone_molecule.two_body_integrals&#xA;orbitals = ozone_molecule.canonical_orbitals&#xA;ozone_filename = ozone_molecule.filename&#xA;ozone_molecule.save()&#xA;&#xA;one_body_integrals = ozone_molecule.one_body_integrals&#xA;&#xA;from openfermion.transforms import get_fermion_operator, jordan_wigner&#xA;&#xA;ozone_qubit_hamiltonian = jordan_wigner(get_fermion_operator(ozone_molecule.get_molecular_hamiltonian()))&#xA;&#xA;from openfermion.linalg import get_sparse_operator&#xA;from scipy.linalg import eigh&#xA;&#xA;ozone_matrix= get_sparse_operator(ozone_qubit_hamiltonian).todense()&#xA;eigenvalues, eigenvectors = eigh(ozone_matrix)&#xA;print(eigenvalues)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This consumes roughly 128 GB of RAM and finally gets killed.&lt;/p&gt;&#xA;" OwnerUserId="15579" LastEditorUserId="15579" LastEditDate="2021-04-17T04:17:11.113" LastActivityDate="2021-04-18T20:41:44.550" Title="Openfermion : `get_sparse_operator` issue" Tags="&lt;programming&gt;&lt;openfermion&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17067" PostTypeId="5" CreationDate="2021-04-15T14:02:05.907" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:02:05.907" LastActivityDate="2021-04-15T14:02:05.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17068" PostTypeId="4" CreationDate="2021-04-15T14:02:05.907" Score="0" Body="the procedure of entangling particles that do not share a common past, i.e. without any direct interaction " OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-15T15:48:22.910" LastActivityDate="2021-04-15T15:48:22.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17069" PostTypeId="5" CreationDate="2021-04-15T14:04:24.673" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:04:24.673" LastActivityDate="2021-04-15T14:04:24.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17070" PostTypeId="4" CreationDate="2021-04-15T14:04:24.673" Score="0" Body="the distinguishability of quantum systems in different states, and the general process of extracting classical information from quantum systems" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-15T17:37:44.173" LastActivityDate="2021-04-15T17:37:44.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17071" PostTypeId="5" CreationDate="2021-04-15T14:06:12.747" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:06:12.747" LastActivityDate="2021-04-15T14:06:12.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17072" PostTypeId="4" CreationDate="2021-04-15T14:06:12.747" Score="0" Body="For questions about the max entropy (also called Hartley entropy) or max-relative entropy functions." OwnerUserId="-1" LastEditorUserId="55" LastEditDate="2021-04-15T14:36:00.170" LastActivityDate="2021-04-15T14:36:00.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17073" PostTypeId="5" CreationDate="2021-04-15T14:16:21.117" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:16:21.117" LastActivityDate="2021-04-15T14:16:21.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17074" PostTypeId="4" CreationDate="2021-04-15T14:16:21.117" Score="0" Body="A quantification of quantum entanglement that also serves as a separability criterion. Concurrence equal to zero indicates an unentangled/separable state. A non-zero concurrence &quot;quantifies&quot; how far the states in question are from achieving separability.  " OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:56:10.400" LastActivityDate="2021-04-15T17:56:10.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17075" PostTypeId="5" CreationDate="2021-04-15T14:23:57.710" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:23:57.710" LastActivityDate="2021-04-15T14:23:57.710" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17076" PostTypeId="4" CreationDate="2021-04-15T14:23:57.710" Score="0" Body="The highest rate at which quantum information can be communicated over many independent uses of a noisy quantum channel (e.g. a qubit) from a sender to a receiver. " OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:50:34.803" LastActivityDate="2021-04-15T17:50:34.803" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17077" PostTypeId="5" CreationDate="2021-04-15T14:30:01.903" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:30:01.903" LastActivityDate="2021-04-15T14:30:01.903" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17078" PostTypeId="4" CreationDate="2021-04-15T14:30:01.903" Score="0" Body="A quasiprobability distribution function proposed to account for quantum corrections to classical statistical mechanics with a goal to link the wavefunction that appears in Schrödinger's equation to a probability distribution in phase space." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:55:53.170" LastActivityDate="2021-04-15T17:55:53.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17079" PostTypeId="2" ParentId="9737" CreationDate="2021-04-15T14:34:40.220" Score="1" Body="&lt;p&gt;Have a look at this article &lt;a href=&quot;https://qibo.readthedocs.io/en/stable/tutorials/hash-grover/README.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qibo.readthedocs.io/en/stable/tutorials/hash-grover/README.html&lt;/a&gt; - seems like it's exactly what you are looking for.&lt;/p&gt;&#xA;" OwnerUserId="8622" LastActivityDate="2021-04-15T14:34:40.220" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17080" PostTypeId="5" CreationDate="2021-04-15T14:37:22.143" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T14:37:22.143" LastActivityDate="2021-04-15T14:37:22.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17081" PostTypeId="4" CreationDate="2021-04-15T14:37:22.143" Score="0" Body="The quantum analog of the classical Fisher information, a way of measuring the amount of information that a random observable A carries about an unknown parameter θ of a distribution that models A. The quantum Fisher information constrains the achievable precision in the statistical estimation of θ via the quantum Cramér–Rao bound." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:50:20.567" LastActivityDate="2021-04-15T17:50:20.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17082" PostTypeId="1" AcceptedAnswerId="17083" CreationDate="2021-04-15T15:10:17.997" Score="1" ViewCount="29" Body="&lt;p&gt;I'm reading the details of &lt;code&gt;qiskit&lt;/code&gt; following &lt;a href=&quot;https://arxiv.org/pdf/1809.03452.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (I know it's a little bit dated, but some things shown there should be in principle still accessible). For concreteness I'm trying to see the characteristics of the backend&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = provider.get_backend('ibmq_quito')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now, according to the reference, the backend have to be equipped with the configuration files. However, if I do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend.configuration()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I only get&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;qiskit.providers.models.backendconfiguration.QasmBackendConfiguration object at 0x7f5f567af760&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How can I display the full information for this backend, e.g. backend_name, backend_version, etc. etc.?&lt;/p&gt;&#xA;" OwnerUserId="15220" LastEditorUserId="55" LastEditDate="2021-04-16T09:32:18.950" LastActivityDate="2021-04-16T09:32:18.950" Title="Recover backend information in working remotely with the IBM-QC" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17083" PostTypeId="2" ParentId="17082" CreationDate="2021-04-15T15:51:01.137" Score="2" Body="&lt;p&gt;If you want, everything is detailed &lt;a href=&quot;https://quantum-computing.ibm.com/lab/docs/manage/systems/configuration#system-configuration&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; about the system configuration, it will explain everything you can find in the configuration.&lt;/p&gt;&#xA;&lt;p&gt;Just a quick resume about how to see the info : personally, I sometimes use &lt;code&gt;backend.configuration().to_dict()&lt;/code&gt;, with this all of the information will be printed in a &lt;code&gt;dict&lt;/code&gt;, and it's pretty easy to use. Now, you can also do a &amp;quot;pretty&amp;quot; print of this by using the &lt;a href=&quot;https://qiskit.org/documentation/apidoc/tools_jupyter.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Jupiter tools&lt;/a&gt; (there's a lot of useful stuffs here other than printing backend config just in case), anyway by doing this :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import IBMQ&#xA;import qiskit.tools.jupyter&#xA;%matplotlib inline&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = provider.get_backend('ibmq_quito')&#xA;backend &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will give you a pretty print of the backend configuration :)&lt;/p&gt;&#xA;" OwnerUserId="12396" LastEditorUserId="12396" LastEditDate="2021-04-15T15:57:29.170" LastActivityDate="2021-04-15T15:57:29.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17084" PostTypeId="5" CreationDate="2021-04-15T15:51:51.527" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T15:51:51.527" LastActivityDate="2021-04-15T15:51:51.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17085" PostTypeId="4" CreationDate="2021-04-15T15:51:51.527" Score="0" Body="Two graphs  and  are isomorphic if they have a function  which provides an exact pairing of vertices in the two graphs such that for any adjacent vertices , ∈ {set of vertices of }, () and () are also adjacent in ." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-15T17:49:59.697" LastActivityDate="2021-04-15T17:49:59.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17086" PostTypeId="5" CreationDate="2021-04-15T15:53:11.107" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T15:53:11.107" LastActivityDate="2021-04-15T15:53:11.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17087" PostTypeId="4" CreationDate="2021-04-15T15:53:11.107" Score="0" Body="A hypothesis about the nature of computable functions. It states that a function on the natural numbers can be calculated by an effective method if and only if it is computable by a Turing machine." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:49:24.343" LastActivityDate="2021-04-15T17:49:24.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17088" PostTypeId="5" CreationDate="2021-04-15T15:55:55.850" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T15:55:55.850" LastActivityDate="2021-04-15T15:55:55.850" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17089" PostTypeId="4" CreationDate="2021-04-15T15:55:55.850" Score="0" Body="Exponentiation performed over a modulus. The operation of modular exponentiation calculates the remainder when an integer b (the base) raised to the eth power (the exponent), b^e, is divided by a positive integer m (the modulus)." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:50:07.117" LastActivityDate="2021-04-15T17:50:07.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17090" PostTypeId="5" CreationDate="2021-04-15T16:05:19.100" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T16:05:19.100" LastActivityDate="2021-04-15T16:05:19.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17091" PostTypeId="4" CreationDate="2021-04-15T16:05:19.100" Score="0" Body="The quantum analog of the classical Boltzmann machine, a neural network used for&#xD;&#xA;generative machine learning, based on the quantum Boltzmann distribution of a transverse-field Ising Hamiltonian. " OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-16T08:21:28.890" LastActivityDate="2021-04-16T08:21:28.890" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17092" PostTypeId="5" CreationDate="2021-04-15T16:10:14.630" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T16:10:14.630" LastActivityDate="2021-04-15T16:10:14.630" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17093" PostTypeId="4" CreationDate="2021-04-15T16:10:14.630" Score="0" Body="The study of solutions to the following problem: given an unknown D-dimensional quantum mixed state ρ, as well as known two-outcome measurements E1,...,EM, estimate the probability that Ei accepts ρ, to within additive error ε, for each of the M measurements. How many copies of ρ are needed to achieve this, with high probability?" OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:49:48.887" LastActivityDate="2021-04-15T17:49:48.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17094" PostTypeId="5" CreationDate="2021-04-15T16:11:46.200" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T16:11:46.200" LastActivityDate="2021-04-15T16:11:46.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17095" PostTypeId="4" CreationDate="2021-04-15T16:11:46.200" Score="0" Body="The process of rewriting a given input circuit to match the topology of a specific quantum device, and/or to optimize the circuit for execution on present-day noisy quantum systems." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:56:02.833" LastActivityDate="2021-04-15T17:56:02.833" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17096" PostTypeId="5" CreationDate="2021-04-15T16:16:14.253" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T16:16:14.253" LastActivityDate="2021-04-15T16:16:14.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17097" PostTypeId="4" CreationDate="2021-04-15T16:16:14.253" Score="0" Body="A piece of code (i.e. the address or reference of a function or method or a lambda expression) that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-15T17:50:14.130" LastActivityDate="2021-04-15T17:50:14.130" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17098" PostTypeId="5" CreationDate="2021-04-15T16:36:56.500" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-15T16:36:56.500" LastActivityDate="2021-04-15T16:36:56.500" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17099" PostTypeId="4" CreationDate="2021-04-15T16:36:56.500" Score="0" Body="Circuit quantum electrodynamics focuses on the interaction of small superconducting circuits, tailored to behave as two-level quantum systems, with a single mode of the electromagnetic field sustained by a superconducting resonator. It thus allows the study and control of fundamental light-matter interaction (quantum optics) and plays an essential role in all current approaches to quantum information processing with superconducting circuits." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-16T08:21:57.343" LastActivityDate="2021-04-16T08:21:57.343" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17100" PostTypeId="1" CreationDate="2021-04-15T16:58:13.153" Score="0" ViewCount="49" Body="&lt;p&gt;In the Variational Quantum Linear Solver &lt;a href=&quot;https://arxiv.org/abs/1909.05820&quot; rel=&quot;nofollow noreferrer&quot;&gt;(VQLS) paper&lt;/a&gt; they define four cost functions (2 global and 2 local) and state in Appendix B that &amp;quot;all four cost functions are non-negative.&amp;quot; However, in the &lt;a href=&quot;https://qiskit.org/textbook/ch-paper-implementations/vqls.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit VQLS tutorial&lt;/a&gt; where they implement one of the global cost functions you can see from their output that the cost function tends to negative numbers (~&lt;span class=&quot;math-container&quot;&gt;$-25$&lt;/span&gt;). Does this imply that they have an incorrect implementation of the cost function? What does it mean to have a negative cost function?&lt;/p&gt;&#xA;&lt;p&gt;For some context, I am working with the local cost function, and it sometimes goes negative but not always. The reason I ask these questions is because I am unsure about how to handle convergence for my optimizer for negative cost functions.&lt;/p&gt;&#xA;" OwnerUserId="13244" LastActivityDate="2021-04-15T16:58:13.153" Title="What does it mean to have a negative cost (aka loss) function?" Tags="&lt;qiskit&gt;&lt;algorithm&gt;&lt;vqe&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17101" PostTypeId="1" CreationDate="2021-04-15T17:24:27.083" Score="4" ViewCount="38" Body="&lt;p&gt;I am looking to prove that the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-bit Majority function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, which is 1 if its input &lt;span class=&quot;math-container&quot;&gt;$x \in \{0, 1\}^N$&lt;/span&gt;&#xA;has Hamming weight &lt;span class=&quot;math-container&quot;&gt;$&amp;gt; N/2$&lt;/span&gt;, and 0 if its input has Hamming weight &lt;span class=&quot;math-container&quot;&gt;$\leq N/2$&lt;/span&gt; has degree &lt;span class=&quot;math-container&quot;&gt;$\text{deg}f\geq N/2$&lt;/span&gt;. We assume that &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is even. Any hints or suggestions are most welcome.&lt;/p&gt;&#xA;&lt;p&gt;Note that an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-variate multilinear polynomial &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is a function &lt;span class=&quot;math-container&quot;&gt;$p: \mathbb{C}^{N} \rightarrow \mathbb{C}$&lt;/span&gt; we can write as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p\left(x_{0}, \ldots, x_{N-1}\right)=\sum_{S \subseteq\{0, \ldots, N-1\}} a_{S} \prod_{i \in S} x_{i}&#xA;$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$a_{S}\in \mathbb{C}$&lt;/span&gt;. The degree of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; is defined as &lt;span class=&quot;math-container&quot;&gt;$\operatorname{deg}(p)=\max \left\{|S|: a_{S} \neq 0\right\} .$&lt;/span&gt; Moreover, we may use that every function &lt;span class=&quot;math-container&quot;&gt;$f:\{0,1\}^{N} \rightarrow \mathbb{C}$&lt;/span&gt; has a unique representation as such a polynomial.&lt;/p&gt;&#xA;" OwnerUserId="14908" LastEditorUserId="14908" LastEditDate="2021-04-16T06:01:05.600" LastActivityDate="2021-04-16T06:40:58.057" Title="Degree of $N$-bit Majority function is larger or equal to $N/2$" Tags="&lt;complexity-theory&gt;" AnswerCount="1" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17102" PostTypeId="1" CreationDate="2021-04-15T21:55:56.763" Score="1" ViewCount="65" Body="&lt;p&gt;I'm currently learning quantum information and I seem to miss some important points on &lt;strong&gt;cluster states&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My question is this:&lt;/p&gt;&#xA;&lt;p&gt;If we want to get one qubit disentangled from the quantum cluster state we measure it in the&lt;span class=&quot;math-container&quot;&gt;$\vert\pm\rangle$&lt;/span&gt; computational basis because in this case we would get a classical outcome, right?&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, if we measure in some other computational basis defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\beta_j (\alpha)\rangle = \frac{1}{\sqrt2}(e^{i\alpha/2} \vert0\rangle \pm e^{-iα/2} \vert1\rangle)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;we’re actually performing a pure quantum computational task, so we’re not making a &lt;strong&gt;classical measurement&lt;/strong&gt; of it, right?&lt;/p&gt;&#xA;&lt;p&gt;Also, how do we experimentally implement the latter?&lt;/p&gt;&#xA;" OwnerUserId="15523" LastEditorUserId="8141" LastEditDate="2021-04-16T13:14:48.033" LastActivityDate="2021-04-21T15:27:08.777" Title="On Cluster States: Measuring in $|+\rangle$ and $|-\rangle$ basis vs. some other computational basis" Tags="&lt;cluster-states&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17103" PostTypeId="1" AcceptedAnswerId="17104" CreationDate="2021-04-15T23:22:00.140" Score="1" ViewCount="81" Body="&lt;p&gt;I just wanted to implement an algorithm for adding two 2-bit binary numbers. And it works, but only on an IBM 32-qubit simulator. And on a real 15-qubit computer, ibmq_16_melbourne, it produces very strange results.&#xA;I don't understand what I'm doing wrong. Or maybe the quantum computer is so noisy?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7mSXo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7mSXo.png&quot; alt=&quot;Result_1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I also tried to rewrite the algorithm for the structure of this computer, so that the qubits used in one operation are connected or are quite close.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rVAKT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rVAKT.png&quot; alt=&quot;ibm&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/gTyJH.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gTyJH.png&quot; alt=&quot;circuit_2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But it didn't help.&lt;/p&gt;&#xA;&lt;p&gt;About the algorithm:&#xA;qubits 0-2 are the result. Qubits 3-4 are the first number. Qubits 5-6 are the second number. The remaining qubits play the role of transfer flags.&#xA;I set qubits 3 and 5 to one using the NOT operation (I didn't understand how to apply units to them in another way). So at the output of the algorithm, I should get &amp;quot;010&amp;quot;. But I get basically a different result.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/SgovB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/SgovB.png&quot; alt=&quot;circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15573" LastActivityDate="2021-04-16T00:07:40.913" Title="Why is a 15-qubit IBM quantum computer not working correctly?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17104" PostTypeId="2" ParentId="17103" CreationDate="2021-04-16T00:07:40.913" Score="4" Body="&lt;p&gt;There will be a lot of swapping and additional gates during the execution of your circuit since CCX is not a native gate. The actual circuit that is being executed is something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Yeggo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Yeggo.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This circuit has 11 qubits and depth of 79  and close to 100 CNOT gates, this is way too much for current hardware. Below is the noise level for Melbourne.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Zf1X2.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Zf1X2.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-16T00:07:40.913" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17105" PostTypeId="2" ParentId="17032" CreationDate="2021-04-16T03:59:16.597" Score="4" Body="&lt;p&gt;Ok, here's my attempt: take a time-dependent Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt; and consider its evolution in the time interval &lt;span class=&quot;math-container&quot;&gt;$[0,t]$&lt;/span&gt;. Discretize this interval in &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; steps of length &lt;span class=&quot;math-container&quot;&gt;$\Delta \tau \equiv t/k$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tau_{n} \equiv n \Delta \tau, \qquad n = 0,1,\ldots,k-1.&#xA;$$&lt;/span&gt;&#xA;Now consider the piecewise-constant product of the propagators &lt;span class=&quot;math-container&quot;&gt;$\exp(-i H(\tau_n)\Delta \tau)$&lt;/span&gt; &lt;em&gt;taken in the (right-to-left) time-order&lt;/em&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\tag{1}\label{eq:ordered}&#xA;e^{-i H(\tau_{k-1}) \Delta \tau} e^{-i H(\tau_{k-2}) \Delta \tau} \cdots e^{-i H(\tau_{0}) \Delta \tau}&#xA;\end{equation}&lt;/span&gt;&#xA;then expand the exponentials in their power series and multiply the series together. You will get terms of the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X_{n_1,\ldots,n_{k}} = \frac{H(\tau_{k-1})^{n_1} H(\tau_{k-2})^{n_2} \cdots H(\tau_0)^{n_k}}{n_1! \, n_2! \cdots n_k!} (-i \Delta \tau)^{n_1+\ldots+n_k}&#xA;$$&lt;/span&gt;&#xA;for &lt;span class=&quot;math-container&quot;&gt;$n_1,\ldots,n_k \in \mathbb{N}$&lt;/span&gt;. Now collect together the terms of the same order &lt;span class=&quot;math-container&quot;&gt;$m = n_1 + \ldots + n_k$&lt;/span&gt;. The first few terms of this series &lt;span class=&quot;math-container&quot;&gt;$\sum_{m=0}^{\infty} X_m$&lt;/span&gt; are given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;X_0 &amp;amp;= I \\&#xA;X_1 &amp;amp;= -i \sum_{i=0}^{k-1} H(\tau_i) \Delta \tau \xrightarrow{k \rightarrow \infty} -i \int_0^t H(\tau) \mathrm{d}\tau \\&#xA;X_2 &amp;amp;= -\sum_{i&amp;gt;j} H(\tau_i) H(\tau_j) (\Delta \tau)^2 - \sum_i \frac{H(\tau_i)^2}{2!} (\Delta \tau)^2&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now consider the square &lt;span class=&quot;math-container&quot;&gt;$[0,t] \times [0,t] \subseteq \mathbb{R}^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/oQANL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/oQANL.png&quot; alt=&quot;square&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Observe that the first term of &lt;span class=&quot;math-container&quot;&gt;$X_2$&lt;/span&gt; above is a Riemann sum of the operator-valued function&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\tag{2}\label{eq:F1}&#xA;F(\tau_1, \tau_2) \equiv H(\tau_1) H(\tau_2)&#xA;\end{equation}&lt;/span&gt;&#xA;in the interior of the lower-right triangle where &lt;span class=&quot;math-container&quot;&gt;$\tau_1 &amp;gt; \tau_2$&lt;/span&gt;. You want to extend the definition of &lt;span class=&quot;math-container&quot;&gt;$F(\tau_1, \tau_2) $&lt;/span&gt; to the upper-left triangle in such a way that its integral over the upper-left triangle is the same as the integral in the lower triangle. This of course is done by using the time-ordering &amp;quot;operator&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}\tag{3}\label{eq:F2}&#xA;F(\tau_1, \tau_2) \equiv \mathcal{T} \Big[ H(\tau_1) H(\tau_2) \Big] = \begin{cases}&#xA;H(\tau_1) H(\tau_2) &amp;amp; \text{if $\tau_1 &amp;gt; \tau_2$}\\&#xA;H(\tau_2) H(\tau_1) &amp;amp; \text{otherwise}&#xA;\end{cases}&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt; does nothing in the lower-right triangle because there the order &lt;span class=&quot;math-container&quot;&gt;$\tau_1 &amp;gt; \tau_2$&lt;/span&gt; is respected (so Eq. \eqref{eq:F2} properly defines an extension of Eq. \eqref{eq:F1}), and &amp;quot;corrects&amp;quot; the order that applies in the other triangle (that is &lt;span class=&quot;math-container&quot;&gt;$\tau_2 &amp;gt; \tau_1$&lt;/span&gt;) so that the Riemann sums of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; over the two triangles are the same. Now you can use this fact&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;-\sum_{i \neq j} \mathcal{T}\Big[ H(\tau_i) H(\tau_j) \Big] (\Delta \tau)^2 = -2\sum_{i&amp;gt;j} \mathcal{T}\Big[ H(\tau_i) H(\tau_j) \Big] (\Delta \tau)^2&#xA;$$&lt;/span&gt;&#xA;and that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt; acts trivially if &lt;span class=&quot;math-container&quot;&gt;$\tau_i=\tau_j$&lt;/span&gt; to rewrite &lt;span class=&quot;math-container&quot;&gt;$X_2$&lt;/span&gt; above as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X_2 &amp;amp; = -\sum_{i \neq j} \frac{1}{2!}\mathcal{T}\Big[ H(\tau_i) H(\tau_j) \Big] (\Delta \tau)^2 - \sum_{i} \frac{1}{2!} \mathcal{T}\Big[ H(\tau_i) H(\tau_i) \Big] (\Delta \tau)^2\\&#xA;&amp;amp; = -\sum_{i, j=0}^{k-1} \frac{1}{2!}\mathcal{T}\Big[ H(\tau_i) H(\tau_j) \Big] (\Delta \tau)^2 \xrightarrow{k \rightarrow \infty} \frac{(-i)^2}{2!} \int_0^t \int_0^t \mathcal{T} \Big[ H(\tau_1)H(\tau_2) \Big] \,\mathrm{d}\tau_1 \, \mathrm{d}\tau_2&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At this point the generic case should be clear, at least in principle: at the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th order you will have an &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-dimensional cube &lt;span class=&quot;math-container&quot;&gt;$[0,t]^m \subseteq \mathbb{R}^m$&lt;/span&gt; split in &lt;span class=&quot;math-container&quot;&gt;$m!$&lt;/span&gt; simplices. Each simplex is defined by the specific ordering of the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; coordinates &lt;span class=&quot;math-container&quot;&gt;$\tau_1,\ldots,\tau_m$&lt;/span&gt; that holds inside of that simplex. The &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th term &lt;span class=&quot;math-container&quot;&gt;$X_m$&lt;/span&gt; in the series will contain a Riemann sum of &lt;span class=&quot;math-container&quot;&gt;$F(\tau_1,\ldots,\tau_m) \equiv H(\tau_1)\cdots H(\tau_m)$&lt;/span&gt; taken over one of these simplices (call it the &amp;quot;fundamental simplex&amp;quot;) where the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; coordinates &lt;span class=&quot;math-container&quot;&gt;$\tau_j$&lt;/span&gt; are ordered according to the order given in Eq. \eqref{eq:ordered}, as well as some boundary terms. Then one has to extend the definition of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; over the full hypercube, while using the time-ordering operator &lt;span class=&quot;math-container&quot;&gt;$\mathcal{T}$&lt;/span&gt; to &amp;quot;correct back&amp;quot; the order in each simplex to the order in the fundamental simplex. In this way the Riemann sum of the extension of &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; in each simplex will be the same. After taking care of the additional boundary terms between the simplices, then one will be able to write &lt;span class=&quot;math-container&quot;&gt;$X_m$&lt;/span&gt; as the full Riemann sum over &lt;span class=&quot;math-container&quot;&gt;$[0,t]^m$&lt;/span&gt; of the operator-valued function &lt;span class=&quot;math-container&quot;&gt;$F(\tau_1,\ldots,\tau_m) \equiv \mathcal{T}[ H(\tau_1) \cdots H(\tau_m)]$&lt;/span&gt;, modulo the combinatorial factor &lt;span class=&quot;math-container&quot;&gt;$1/m!$&lt;/span&gt; that corrects the overcounting obtained from integrating &lt;span class=&quot;math-container&quot;&gt;$F$&lt;/span&gt; over all simplices instead of just one. By taking the &lt;span class=&quot;math-container&quot;&gt;$k \rightarrow \infty$&lt;/span&gt; limit of the Riemann sum you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;X_m \xrightarrow{k \rightarrow \infty} \frac{(-i)^m}{m!} \int_{0}^t \cdots \int_{0}^t \mathcal{T}\Big[ H(\tau_1) \cdots H(\tau_m) \Big] \mathrm{d}\tau_1 \cdots \mathrm{d}\tau_m&#xA;$$&lt;/span&gt;&#xA;This is precisely the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th term of the Dyson series, whose sum defines the time-ordered exponential&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(t) = \mathcal{T} \exp\Big(-i\int_0^t H(\tau)\, \mathrm{d}\tau \Big)&#xA;$$&lt;/span&gt;&#xA;so in the limit of &lt;span class=&quot;math-container&quot;&gt;$k \rightarrow \infty$&lt;/span&gt; Eq. \eqref{eq:ordered} (in the right-to-left time ordering) correctly gives the unitary propagator generated by the time-dependent Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H(t)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;All in all this procedure is the same as the one used in deriving the Dyson series. The only difference is that here we have to handle Riemann sums instead of intergals, and so we have some pesky boundary terms (and their combinatorics) to take care of but nothing serious.&lt;/p&gt;&#xA;" OwnerUserId="14213" LastActivityDate="2021-04-16T03:59:16.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17106" PostTypeId="2" ParentId="17101" CreationDate="2021-04-16T06:40:58.057" Score="2" Body="&lt;p&gt;I suppose I would start as follows: let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;z=\sum_ix_i.&#xA;$$&lt;/span&gt;&#xA;This is simply a variable telling me how many 1s there are. Since this is the only information that I need to determine the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, I should be able to work just with this. There's also an ingredient of symmetry in there, but is maybe not quite of a sufficiently rigorous footing yet.&lt;/p&gt;&#xA;&lt;p&gt;Having done this, I simply want to find a function &lt;span class=&quot;math-container&quot;&gt;$f(z)$&lt;/span&gt; whose value is 0 of &lt;span class=&quot;math-container&quot;&gt;$z\leq N/2$&lt;/span&gt;. This means it has at least &lt;span class=&quot;math-container&quot;&gt;$N/2+1$&lt;/span&gt; zeros, and must have degree at least &lt;span class=&quot;math-container&quot;&gt;$N/2+1$&lt;/span&gt;. Explicitly, part of the function would be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;z(z-1)(z-2)\ldots(z-N/2)&#xA;$$&lt;/span&gt;&#xA;I could construct the whole function by letting&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;g(z,i)=\frac{\prod_{j=0}^{N}(z-j)}{z-i}&#xA;$$&lt;/span&gt;&#xA;and calculating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(z)=\sum_{i=N/2+1}^N\frac{g(z,i)}{g(i,i)},&#xA;$$&lt;/span&gt;&#xA;since each term in this sum evaluates to 0 for all values of &lt;span class=&quot;math-container&quot;&gt;$z=0,1,2,\ldots,N$&lt;/span&gt; except for the specific term &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, which evaluates to 1. This is a polynomial of degree no more than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, satisfying the values at &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; points, and hence must be the unique polynomial of no more than degree &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-16T06:40:58.057" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17107" PostTypeId="1" AcceptedAnswerId="17109" CreationDate="2021-04-16T07:51:09.067" Score="1" ViewCount="33" Body="&lt;p&gt;How to construct a Hamiltonian for an ensemble of atoms interacting with each other?&lt;/p&gt;&#xA;&lt;p&gt;For example if the one atom hamiltonian can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{H}=\left(\begin{matrix}0&amp;amp;\Omega_p(t)&amp;amp;0\\\Omega_p(t)&amp;amp;0&amp;amp;\Omega_r(t)\\0&amp;amp;\Omega_r(t)&amp;amp;0\end{matrix}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so the many atoms Hamiltonian can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{\mathcal{H}}=\hat{H}\otimes\hat{H}\otimes...\otimes\hat{H}+\sum_{j,k}^{N}V_{jk}\left|R\rangle_j\langle R\right|\otimes\left|R\rangle_k\langle R\right|$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\Omega_p(t)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Omega_r(t)$&lt;/span&gt; are arbitrary functions, &lt;span class=&quot;math-container&quot;&gt;$|R\rangle$&lt;/span&gt; is the Rydberg stat &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; is the interaction energy between Rydberg states, and &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of atoms.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I am using Wolfram Mathematica and every-time I do a simulation for 3 atom, it does not work properly.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15173" LastEditorUserId="55" LastEditDate="2021-04-16T09:33:11.680" LastActivityDate="2021-04-16T09:33:11.680" Title="How to construct a Hamiltonian for an ensemble of atoms interacting with each other?" Tags="&lt;hamiltonian-simulation&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17108" PostTypeId="1" AcceptedAnswerId="17125" CreationDate="2021-04-16T08:50:16.717" Score="3" ViewCount="97" Body="&lt;p&gt;How to prove the inequality&lt;span class=&quot;math-container&quot;&gt;$$\sum_{l=x,y,z}\langle J_l^2\rangle\le\frac{N(N+2)}{4}$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$J_l = \mathop{\Sigma}_{i=1}^N \frac{1}{2}\sigma_l^{i}$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_l^i$&lt;/span&gt; is &lt;a href=&quot;https://en.wikipedia.org/wiki/Pauli_matrices&quot; rel=&quot;nofollow noreferrer&quot;&gt;pauli matrix&lt;/a&gt; acting on the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;th qubit,&#xA;&lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; stands for the number of qubits, and &lt;span class=&quot;math-container&quot;&gt;$\langle\,.\rangle$&lt;/span&gt; denotes the average over &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits? The &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits may be entangled.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-19T13:25:08.220" LastActivityDate="2021-04-19T13:25:08.220" Title="How to prove the fundamental equation in the theory of angular momentum $\sum_{l=x,y,z}\langle J_l^2\rangle\le\frac{N(N+2)}{4}$?" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;&lt;angular-momentum&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17109" PostTypeId="2" ParentId="17107" CreationDate="2021-04-16T09:02:23.950" Score="1" Body="&lt;p&gt;I suspect that, for your single-atom Hamiltonians, you want to compose them as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{H}=H\otimes I\otimes I+I\otimes H\otimes I+I\otimes I\otimes H&#xA;$$&lt;/span&gt;&#xA;(example for the 3-qubit case).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-16T09:02:23.950" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17110" PostTypeId="2" ParentId="17102" CreationDate="2021-04-16T09:36:02.100" Score="4" Body="&lt;p&gt;Welcome to the stack exchange!&lt;/p&gt;&#xA;&lt;p&gt;Based on your question, it feels as you might have some small misunderstandings, so allow me to (hopefully) clear them up.&lt;/p&gt;&#xA;&lt;h2&gt;Quantum measurements?&lt;/h2&gt;&#xA;&lt;p&gt;In its most simple form, a quantum measurement on a qubit is a 'check': you pick a basis for the qubit (i.e. two orthogonal vectors, e.g. &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;). Then, the measurements 'checks' if the qubit's state is the one or the other basis vector. The measurement result is just a label that tells you which of the two it was: usually they're labelled with a &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, but this is arbitrary.&lt;/p&gt;&#xA;&lt;p&gt;So how is this check performed, what are the 'rules'? Let's say I measure in the basis &lt;span class=&quot;math-container&quot;&gt;$\{|\psi_{1}\rangle, |\psi_{2}\rangle\}$&lt;/span&gt;. Since these two vectors form a basis, I can write any state of the qubit as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|\psi_{1}\rangle + \beta |\psi_{2}\rangle$&lt;/span&gt;. The basic rule of measurements is known as the &lt;strong&gt;Born rule&lt;/strong&gt;: upon measurement of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in the aforementioned basis, the measurement returns 'it was &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt;' with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^{2}$&lt;/span&gt;, and the measurement returns 'it was &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt;' with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^{2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The measurement always returns a classical value as the measurement result (usually this is just one bit indicating which of the two options it was). I wouldn't say, though, that any of these measurements are &lt;em&gt;classical&lt;/em&gt;. There is not one basis which is more or less classical than any other.&lt;/p&gt;&#xA;&lt;h2&gt;Measurements in some specific bases&lt;/h2&gt;&#xA;&lt;p&gt;Now, some bases are more special than others.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;First and foremost, we have the &lt;em&gt;computational&lt;/em&gt; basis: &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle,|1\rangle\}$&lt;/span&gt;. &lt;strong&gt;There is just one&lt;/strong&gt; computational basis, and this is it. There are no other computational bases!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The basis &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt; is a &lt;strong&gt;different&lt;/strong&gt; basis. It is often called the &lt;em&gt;Hadamard&lt;/em&gt; basis, because if you perform a Hadamard gate on the computational basis states, you get these basis states.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The basis &lt;span class=&quot;math-container&quot;&gt;$|\pm\beta (\alpha)\rangle = e^{i\alpha/2}|0\rangle \pm e^{-i\alpha/2}|1\rangle$&lt;/span&gt; is yet another basis. It often turns up in measurement based quantum computation, but a measurement in this basis is not any more or less 'quantum' than a measurement in any other basis.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2&gt;How exactly do you dis-entangle a qubit?&lt;/h2&gt;&#xA;&lt;p&gt;Let's say I have two qubits, entangled, for instance in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|0\rangle + |1\rangle|1\rangle$&lt;/span&gt; (up to a normalization factor). If I measure the second qubit in &lt;em&gt;any&lt;/em&gt; basis, I force it to be a specific state (e.g. &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt;) of the basis I'm performing the measurement in. This means that I can now write the state as &lt;span class=&quot;math-container&quot;&gt;$|l\rangle |\psi_{1}\rangle$&lt;/span&gt;, for whatever state &lt;span class=&quot;math-container&quot;&gt;$|l\rangle$&lt;/span&gt; on the first qubit. &lt;strong&gt;The two qubits are not entangled anymore, as I can write the state of either one without taking into account the state of the other.&lt;/strong&gt; &lt;em&gt;Any measurement&lt;/em&gt; will always dis-entangle qubits, as I force the qubit I'm performing the measurement on to be a specific basis state - so after the measurement I can always write down the state of that one qubit without any regard for any other.&lt;/p&gt;&#xA;&lt;h2&gt;How do you perform a measurement in any basis?&lt;/h2&gt;&#xA;&lt;p&gt;This, strictly speaking, depends on the specific physical implementation that you are trying to implement the experiment. But, normally speaking, measurements are possible in only the computational basis. If I want to measure in the basis &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle, |\psi_{2}\rangle$&lt;/span&gt;, I just first have to rotate from that basis to the computational basis. That is, I perform the unitary &lt;span class=&quot;math-container&quot;&gt;$U_{basis}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{basis} = |0\rangle\langle \psi_{1}| + |1\rangle \langle \psi_{2}|&#xA;$$&lt;/span&gt;&#xA;which maps the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{1}\rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{2}\rangle$&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|1 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the specific case of a measurement in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\beta(\alpha)\rangle$&lt;/span&gt; basis, the unitary can be implemented as first a &lt;span class=&quot;math-container&quot;&gt;$R_{z}(-\alpha)$&lt;/span&gt; rotation (mapping &lt;span class=&quot;math-container&quot;&gt;$|\pm\beta(\alpha)\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt;), followed by a Hadamard operation (mapping &lt;span class=&quot;math-container&quot;&gt;$\{|+\rangle, |-\rangle\}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\{|0\rangle, |1\rangle\}$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-04-18T20:45:11.957" LastActivityDate="2021-04-18T20:45:11.957" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17111" PostTypeId="1" CreationDate="2021-04-16T09:46:57.940" Score="7" ViewCount="208" Body="&lt;p&gt;I was trying to revise my understanding of adiabatic quantum computation via a simple example. I'm familiar with the overall concept -- that you have an overall Hamiltonian&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(s)=(1-s)H_0+s H_f&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt; is a function of time, starting from &lt;span class=&quot;math-container&quot;&gt;$s=0$&lt;/span&gt; and finishing at &lt;span class=&quot;math-container&quot;&gt;$s=1$&lt;/span&gt;. You prepare your system in the ground state of &lt;span class=&quot;math-container&quot;&gt;$H_0$&lt;/span&gt; (known) and, provided the Hamiltonian changes slowly enough, your final state will be close to the ground state of &lt;span class=&quot;math-container&quot;&gt;$H_f$&lt;/span&gt;. The &amp;quot;slowly enough&amp;quot; condition is typically phrased in terms of the energy gap between the ground and first excited state, &lt;span class=&quot;math-container&quot;&gt;$\Delta$&lt;/span&gt;. A typical assumption is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{ds}{dt}=\epsilon\Delta^2&#xA;$$&lt;/span&gt;&#xA;for small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; (I haven't been back to pick through more detailed statements).&lt;/p&gt;&#xA;&lt;p&gt;So, my plan was to test&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H(\theta)=-\cos\theta X-\sin\theta Z,&#xA;$$&lt;/span&gt;&#xA;starting from &lt;span class=&quot;math-container&quot;&gt;$\theta=0$&lt;/span&gt; and the system in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;. For all values of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, the gap is a constant (2) so, in essence, I have the conversion &lt;span class=&quot;math-container&quot;&gt;$\theta=4\epsilon t$&lt;/span&gt; and the evolution time will be &lt;span class=&quot;math-container&quot;&gt;$\pi/(8\epsilon)$&lt;/span&gt; and &lt;em&gt;should&lt;/em&gt; leave the system in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. However, when I tried to do this calculation, I didn't get this answer. Am I screwing up, or is there some condition that tells me I shouldn't expect the adiabatic theorem to hold in this case?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Details of how I tried to do the calculation:&#xA;Let&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|y_{\pm}\rangle=(|0\rangle\pm i|1\rangle)/\sqrt{2}.&#xA;$$&lt;/span&gt;&#xA;We have that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H|y_{\pm}\rangle=\pm ie^{\mp i\theta}|y_{\mp}\rangle.&#xA;$$&lt;/span&gt;&#xA;We can decompose any state in this basis,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=a|y_+\rangle+b|y_-\rangle,&#xA;$$&lt;/span&gt;&#xA;so we can talk about the time evolution of the coefficients&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{d}{dt}\begin{bmatrix} a \\ b \end{bmatrix}=4\epsilon\frac{d}{d\theta}\begin{bmatrix} a \\ b \end{bmatrix}=\begin{bmatrix}&#xA;0 &amp;amp; e^{-i\theta} \\ -e^{i\theta} &amp;amp; 0&#xA;\end{bmatrix}\begin{bmatrix} a \\ b \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;I can perform a variable transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\tilde a=e^{i\theta/2}a,\quad \tilde b=e^{-i\theta/2}b&#xA;$$&lt;/span&gt;&#xA;which then satisfy&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;4\epsilon\frac{d}{d\theta}\begin{bmatrix} \tilde a \\ \tilde b \end{bmatrix}=i\begin{bmatrix}&#xA;2\epsilon &amp;amp; -i \\ i &amp;amp; -2\epsilon&#xA;\end{bmatrix}\begin{bmatrix} \tilde a \\ \tilde b \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;This is (finally!) something I can do something useful with! Taking the small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; limit, I essentially have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{d}{d\theta}\begin{bmatrix} \tilde a \\ \tilde b \end{bmatrix}=i\frac{1}{4\epsilon}Y\begin{bmatrix} \tilde a \\ \tilde b \end{bmatrix}&#xA;$$&lt;/span&gt;&#xA;I can put in my initial conditions and compare what I expected at the end. The problem is that I have an extra phase of the form &lt;span class=&quot;math-container&quot;&gt;$e^{i\pi/(8\epsilon)}$&lt;/span&gt; floating around, and the taking of the small &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; limit seems problematic as this varies rapidly between all possible values.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-04-21T15:45:00.457" LastActivityDate="2021-04-21T15:56:36.357" Title="Why do I get this extra factor when working out the dynamics of an adiabatic quantum computation?" Tags="&lt;adiabatic-model&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17112" PostTypeId="1" AcceptedAnswerId="17121" CreationDate="2021-04-16T10:29:18.663" Score="2" ViewCount="102" Body="&lt;p&gt;Let's fix a universal gate set comprising of a Hadamard gate and a Toffoli gate. Consider an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubit quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U_{x}$&lt;/span&gt;, made up of gates from that universal set, applied to initial state &lt;span class=&quot;math-container&quot;&gt;$|0^{n} \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The transition amplitude &lt;span class=&quot;math-container&quot;&gt;$\langle 0^{n}| U_x |0^{n} \rangle$&lt;/span&gt; can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;\langle 0^{n}| U_x |0^{n} \rangle = \frac{f - g}{\sqrt{2^{h}}},&#xA;\end{equation}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; is the number of Hadamard gates and &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; are two #P functions. This equivalence is proven in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0408129&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0408129&lt;/a&gt; (equation 6).&lt;/p&gt;&#xA;&lt;p&gt;Let's say that we are given an efficient classical description of &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt; and we want to estimate this transition amplitude classically, upto inverse polynomial additive error. We do not care whether our estimated value preserves the sign of the original output amplitude.&lt;/p&gt;&#xA;&lt;p&gt;A naive way to estimate the transition amplitude classically, given an efficient description of the circuit &lt;span class=&quot;math-container&quot;&gt;$U_{x}$&lt;/span&gt; as the input, would be to estimate &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; individually, upto inverse polynomial additive error. Something like this is hinted in Section V of the paper linked.&lt;/p&gt;&#xA;&lt;p&gt;But don't we need oracle access to the formulas corresponding to &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; (ie, two Boolean/3SAT formulas such that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is the number of solutions for one, and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; is the number of solutions for the other) to individually estimate &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; respectively (upto an inverse polynomial additive error)?&lt;/p&gt;&#xA;&lt;p&gt;Can we efficiently get a description of these two corresponding Boolean formulas just from the description of the quantum circuit &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt; given to us as input (and hence, not need oracle access to these formulas in the input)?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastEditorUserId="1351" LastEditDate="2021-04-17T09:40:09.330" LastActivityDate="2021-04-17T14:12:09.937" Title="Estimating output amplitudes of quantum circuits as GapP functions" Tags="&lt;quantum-gate&gt;&lt;complexity-theory&gt;&lt;probability&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17114" PostTypeId="2" ParentId="17060" CreationDate="2021-04-16T12:52:54.400" Score="0" Body="&lt;p&gt;Due to &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; being a positive and adjoint, you can always spectrally decompose it into a convex combination of pure states, it's eigenvectors. However, since the measurement statistics, or the action of a unitary operator, as you observed, will not change if you do not represent it diagonally, a lot of papers or books will choose not to represent them as this decomposition.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2021-04-16T12:52:54.400" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17115" PostTypeId="1" AcceptedAnswerId="17122" CreationDate="2021-04-16T13:44:30.710" Score="3" ViewCount="123" Body="&lt;p&gt;There are several basic gate sets allowing to construct any gate on a quantum gate-based computer, e.g.:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; (sometimes enriched to &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;),&lt;/li&gt;&#xA;&lt;li&gt;rotations &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CNOT,$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Toffoli gate + &lt;span class=&quot;math-container&quot;&gt;$H,$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Fredkin gate + &lt;span class=&quot;math-container&quot;&gt;$H.$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I am wondering whether there are any other universal sets usually used in quantum computation. What are advantages and drawbacks of these sets?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="9006" LastEditDate="2021-04-17T16:04:12.977" LastActivityDate="2021-04-18T06:29:24.637" Title="Basic gates sets" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="2" CommentCount="8" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17116" PostTypeId="2" ParentId="17112" CreationDate="2021-04-16T13:59:35.207" Score="2" Body="&lt;p&gt;I think there might be a confusion between a Boolean formula (which may be easy to evaluate) and the number of solutions or a difference in the number solutions of the Boolean formula (which may be very difficult to evaluate).  You're calling &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$g$&lt;/span&gt; #P-functions, but really you're interested in &lt;span class=&quot;math-container&quot;&gt;$\#(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\#(1)$&lt;/span&gt; which are &lt;em&gt;values&lt;/em&gt; that count the number of solutions to a given function.&lt;/p&gt;&#xA;&lt;p&gt;For example let &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt; be a quantum circuit; we can use this circuit to build a classical description of certain function, call it &lt;span class=&quot;math-container&quot;&gt;$\textbf B$&lt;/span&gt;.  We can let &lt;span class=&quot;math-container&quot;&gt;$\#(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\#(1)$&lt;/span&gt; count the number of positive and negative terms in the sum:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\langle \textbf b\vert U_x\vert \textbf a\rangle=\frac{1}{\sqrt{2^h}}\sum_{x:\textbf B(x)=\textbf b}(-1)^{\phi(x)}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;That is, I believe that your classical description of &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt; indeed gives you sufficient information to get an efficient classical description of the formulae &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; to which &lt;span class=&quot;math-container&quot;&gt;$\#(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\#(1)$&lt;/span&gt; count the number of &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;'s/&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;'s; however, that doesn't necessarily mean that you can efficiently evaluate &lt;span class=&quot;math-container&quot;&gt;$\#(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\#(1)$&lt;/span&gt; to a high-enough precision to calculate &lt;span class=&quot;math-container&quot;&gt;$\vert \#(0)-\#(1)\vert$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There are some tricks such as &lt;a href=&quot;https://rjlipton.wpcomstaging.com/2009/08/27/stockmeyers-approximate-counting-method/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Stockmeyer approximation&lt;/a&gt; that let you classically evaluate &lt;span class=&quot;math-container&quot;&gt;$\#(0)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\#(1)$&lt;/span&gt; &lt;em&gt;individually&lt;/em&gt; to &lt;em&gt;some&lt;/em&gt; precision, but these tricks are not efficient (being in Arthur-Merlin).  More importantly these tricks are nowhere near enough accuracy to efficiently evaluate the (absolute value of) the difference between &lt;span class=&quot;math-container&quot;&gt;$\#(0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\#(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-04-16T13:59:35.207" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="17117" PostTypeId="2" ParentId="2491" CreationDate="2021-04-16T16:05:33.037" Score="2" Body="&lt;p&gt;Bacon Shor code is still very hot today! Assume you have some familiarity with Shor's code, here I just highlight the difference between these two.&lt;/p&gt;&#xA;&lt;p&gt;The Shor's code has distance 3 for both X and Z type errors. The distance is a metric for error-correcting capability. It means some errors with such weight can be undetected but produce a logical failure. Distance 3 also means the code can correct any single error and detect any double error. Hence Shor's code is the first code to be able to correct any single Pauli errors (X, Y, or Z).&lt;/p&gt;&#xA;&lt;p&gt;The strange part is that Shor code has six Z-type measurements and two X-type measurements, even though X and Z distances are the same. Any sequence from that? Indeed! The distance only tells you the worst error configuration the code fails, but the code may be able to correct many errors with weight up to or even higher the distance. That is where the six measurements matter. The six Z-type measurements will be able to correct more X error configurations compares with the two X-type measurements for Z errors.&lt;/p&gt;&#xA;&lt;p&gt;The Bacon Shor code has six measurements for both X and Z-type. It is symmetric with respect to X and Z. Compared to Shor code, its advantages are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;preserve distance 3 for both X and Z&lt;/li&gt;&#xA;&lt;li&gt;preserve one logical qubit&lt;/li&gt;&#xA;&lt;li&gt;need only weight-2 measurements for neighboring qubits&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and disadvantages&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;has only two stabilizers with large weights for both X and Z-type. From the above argument, this weakens the error-correcting capability for X errors to be the same as that for Z errors.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The Bacon Shor code is optimal for small systems. But the few large-weight stabilizers lead to bad asymptotic performance for large systems. &lt;a href=&quot;https://arxiv.org/abs/2010.09626&quot; rel=&quot;nofollow noreferrer&quot;&gt;Some recent work&lt;/a&gt; in fact overcomes this drawback and suggests using measurement information from small-weight gauge measurements directly. This makes Bacon Shor code as well as general subsystem code promising again.&lt;/p&gt;&#xA;" OwnerUserId="15585" LastActivityDate="2021-04-16T16:05:33.037" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17120" PostTypeId="1" CreationDate="2021-04-16T23:27:56.533" Score="5" ViewCount="36" Body="&lt;p&gt;One of the main problems of superconducting quantum computers is that it is necessary to maintain a very low temperature (near absolute zero).&#xA;Such cooling is very expensive and complex.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YcnEK.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YcnEK.jpg&quot; alt=&quot;cool&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Why, then, are Intel, IBM, and many other corporations developing superconducting quantum computers? After all, it was possible to use a photon as a qubit.&lt;/p&gt;&#xA;&lt;p&gt;And what about electron-spin quantum computers?&#xA;Are there any corporations that have advanced in their development? Do they require cooling to absolute zero?&lt;/p&gt;&#xA;&lt;p&gt;In most of the materials that I came across, it was said about spin of the electron. But using it in the real world is somehow unpopular. Perhaps there are reasons for this?&lt;/p&gt;&#xA;&lt;p&gt;I would like to know the advantages and disadvantages of developing superconducting quantum computers, optical quantum computers and electron-spin quantum computers.&lt;/p&gt;&#xA;" OwnerUserId="15573" LastEditorUserId="1859" LastEditDate="2021-04-19T12:05:16.707" LastActivityDate="2021-04-19T12:05:16.707" Title="Optical quantum computers VS Superconducting quantum computers VS Electron-spin quantum computers" Tags="&lt;ibm&gt;&lt;superconducting-quantum-computing&gt;&lt;photonics&gt;&lt;spintronics&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17121" PostTypeId="2" ParentId="17112" CreationDate="2021-04-17T14:12:09.937" Score="3" Body="&lt;p&gt;Given a description of &lt;span class=&quot;math-container&quot;&gt;$ U_x $&lt;/span&gt; you can efficiently find a decription of &lt;span class=&quot;math-container&quot;&gt;$ \textbf{B} $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$ \phi $&lt;/span&gt; by iterating over the gates of &lt;span class=&quot;math-container&quot;&gt;$U_x$&lt;/span&gt; and adding one &amp;quot;free&amp;quot; variable every time you have a Hadamard gate and imposing the constraint of the Toffoli gate.&lt;/p&gt;&#xA;&lt;p&gt;Regarding the approximation, you can estime &lt;span class=&quot;math-container&quot;&gt;$f, g$&lt;/span&gt; to additive error &lt;span class=&quot;math-container&quot;&gt;$ \frac{2^h}{\text{poly}(h)} $&lt;/span&gt; (see &lt;a href=&quot;https://cstheory.stackexchange.com/questions/22387/approximating-p-hard-problems&quot;&gt;here&lt;/a&gt;) but this will give you &lt;span class=&quot;math-container&quot;&gt;$ \frac{2^{h/2 + 1}}{\text{poly}(h)} $&lt;/span&gt; error for &lt;span class=&quot;math-container&quot;&gt;$|\langle 0^n|U_x|0^n \rangle | $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In fact, you can't hope for a classical randomized poly-time algorithm to give an estimate of &lt;span class=&quot;math-container&quot;&gt;$|\langle 0^n|U_x|0^n \rangle | $&lt;/span&gt; with additive inverse polynomial error unless BQP = BPP, since  if &lt;span class=&quot;math-container&quot;&gt;$ L \in$&lt;/span&gt; BQP:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ x \in L \implies \text{Pr(aceptance)} &amp;gt; 1 - 2^{-n} \implies |\langle 0^n|U_x|0^n \rangle |^2 &amp;lt; 2^{-n} $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$ x \notin L \implies \text{Pr(aceptance)} &amp;lt; 2^{-n} \implies |\langle 0^n|U_x|0^n \rangle |^2 &amp;gt; 1- 2^{-n} $&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;and with an estimate of &lt;span class=&quot;math-container&quot;&gt;$|\langle 0^n|U_x|0^n \rangle | $&lt;/span&gt; with additive inverse polynomial error would allow us to distinguish between the two cases.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2021-04-17T14:12:09.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17122" PostTypeId="2" ParentId="17115" CreationDate="2021-04-17T16:49:21.207" Score="2" Body="&lt;p&gt;&lt;strong&gt;Community Wiki&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In Google's quantum computational supremacy experiment with their Sycamore transmon processor, they used single-qubit gates from &lt;span class=&quot;math-container&quot;&gt;$\{\sqrt{X},\sqrt{Y},\sqrt{W}\},$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$W=\frac{X+Y}{\sqrt{2}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Additionally for their two-qubit gates, they used something close to an &lt;span class=&quot;math-container&quot;&gt;$\mathsf{iSWAP}$&lt;/span&gt; gate - something like a &lt;span class=&quot;math-container&quot;&gt;$\mathsf{SWAP}$&lt;/span&gt; gate that adds a &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; phase only to the &lt;span class=&quot;math-container&quot;&gt;$\vert11\rangle$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;They say that supremacy experiments also like to use &lt;span class=&quot;math-container&quot;&gt;$\mathsf{CZ}$&lt;/span&gt; gates, but one of the reasons they hint at these specific gates, in addition to being implementable on their devices, was that these gates appeared to maximize entanglement in a manner that made classical simulation more difficult.&lt;/p&gt;&#xA;&lt;p&gt;(As an aside, classically we like to build most CMOS logic with &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NAND}$&lt;/span&gt; gates, although &lt;span class=&quot;math-container&quot;&gt;$\mathsf{NOR}$&lt;/span&gt; gates also generate the set of Boolean functions.  There are engineering reasons and also historical reasons why, as hinted at in &lt;a href=&quot;https://www.quora.com/NAND-and-NOR-are-both-universal-gates-Why-is-NAND-preferred-over-NOR-gate-in-most-applications#:%7E:text=In%20general%2C%20cells%20are%20designed,comparable%20rise%20and%20fall%20time.&amp;amp;text=NAND%20gate%20has%20better%20ratio,gate%20is%20preferred%20over%20NOR.&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; Quora question).&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-04-17T16:49:21.207" CommentCount="0" CommunityOwnedDate="2021-04-17T16:49:21.207" ContentLicense="CC BY-SA 4.0" />
  <row Id="17123" PostTypeId="1" CreationDate="2021-04-17T18:43:36.007" Score="4" ViewCount="103" Body="&lt;p&gt;I was reading about quantum compression in &lt;a href=&quot;https://scialert.net/fulltext/?doi=jas.2007.3567.3571&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; and have some doubts regarding an example mentioned. Specifically, I have two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;In example they represented &lt;span class=&quot;math-container&quot;&gt;$|a\rangle = \dfrac{1}{\sqrt{15}}|00\rangle + \dfrac{1}{\sqrt{15}}|10\rangle +\dfrac{2}{\sqrt{15}}|01\rangle + \dfrac{1}{\sqrt{15}}|11\rangle$&lt;/span&gt;. How can they call this a quantum state given that the sum of square magnitudes of the amplitudes is not equal to one?&lt;/li&gt;&#xA;&lt;li&gt;If they are compressing kets (&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle $&lt;/span&gt;) then what is  the point of the amplitudes &lt;span class=&quot;math-container&quot;&gt;$\dfrac{1}{\sqrt{15}}$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15087" LastEditorUserId="15087" LastEditDate="2021-04-19T15:36:15.500" LastActivityDate="2021-04-19T15:36:15.500" Title="States used in lossless quantum compression?" Tags="&lt;quantum-state&gt;&lt;information-theory&gt;&lt;communication&gt;" AnswerCount="0" CommentCount="11" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17125" PostTypeId="2" ParentId="17108" CreationDate="2021-04-18T02:26:46.237" Score="6" Body="&lt;p&gt;We can transform the left hand side as follows&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\sum_{l=x,y,z}\langle J_l^2\rangle &amp;amp;= \sum_{l=x,y,z}\langle\psi|J_l^2|\psi\rangle \\&#xA;&amp;amp;= \langle\psi|\left(\sum_{l=x,y,z}J_l^2\right)|\psi\rangle \\&#xA;&amp;amp;= \langle\psi|\left(\sum_{l=x,y,z}\left(\sum_{i=1}^N\frac12\sigma_l^i\right)^2\right)|\psi\rangle \\&#xA;&amp;amp;= \langle\psi|\left(\sum_{l=x,y,z}\sum_{i,j=1}^N\frac14\sigma_l^i\sigma_l^j\right)|\psi\rangle \\&#xA;&amp;amp;= \frac14\langle\psi|\left(\sum_{l=x,y,z}\left(N + 2\sum_{i&amp;lt;j}\sigma_l^i\sigma_l^j\right)\right)|\psi\rangle \\&#xA;&amp;amp;= \frac14\langle\psi|\left(3N + 2\sum_{i&amp;lt;j}\sum_{l=x,y,z}\sigma_l^i\sigma_l^j\right)|\psi\rangle \\&#xA;&amp;amp;= \frac{3N}4+\frac12\langle\psi|\left(\sum_{i&amp;lt;j}\sigma_x^i\sigma_x^j+\sigma_y^i\sigma_y^j+\sigma_z^i\sigma_z^j\right)|\psi\rangle \\&#xA;&amp;amp;= \frac{3N}4+\frac12\sum_{i&amp;lt;j}\langle\psi|\sigma_x^i\sigma_x^j+\sigma_y^i\sigma_y^j+\sigma_z^i\sigma_z^j|\psi\rangle&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is a possibly entangled state of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits. We can bound the sum in the last equation from above by exploiting the fact that for any Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; the real number &lt;span class=&quot;math-container&quot;&gt;$\langle\psi|A|\psi\rangle$&lt;/span&gt; is less than or equal to the largest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, see &lt;a href=&quot;https://en.wikipedia.org/wiki/Rayleigh_quotient&quot; rel=&quot;noreferrer&quot;&gt;Rayleigh quotient&lt;/a&gt;. Also, the eigenvalues of the operator &lt;span class=&quot;math-container&quot;&gt;$\sigma_x^i\sigma_x^j+\sigma_y^i\sigma_y^j+\sigma_z^i\sigma_z^j$&lt;/span&gt; are independent of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;. In the computational basis, the matrix of the operator restricted to qubits &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; takes the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sigma_x\otimes\sigma_x+\sigma_y\otimes\sigma_y+\sigma_z\otimes\sigma_z = \begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; -1 &amp;amp; 2 &amp;amp; 0 \\&#xA;0 &amp;amp; 2 &amp;amp; -1 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1&#xA;\end{bmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The characteristic polynomial of the center &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; block is &lt;span class=&quot;math-container&quot;&gt;$(x+1)^2-4=x^2+2x-3$&lt;/span&gt; so &lt;span class=&quot;math-container&quot;&gt;$\sigma_x^i\sigma_x^j+\sigma_y^i\sigma_y^j+\sigma_z^i\sigma_z^j$&lt;/span&gt; has eigenvalues &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-3$&lt;/span&gt;. Therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\sum_{l=x,y,z}\langle J_l^2\rangle &amp;amp;= \frac{3N}4+\frac12\sum_{i&amp;lt;j}\langle\psi|\sigma_x^i\sigma_x^j+\sigma_y^i\sigma_y^j+\sigma_z^i\sigma_z^j|\psi\rangle \\&#xA;&amp;amp;\le \frac{3N}4+\frac12\sum_{i&amp;lt;j}1 \\&#xA;&amp;amp;= \frac{3N}4+\frac12\frac{N(N-1)}2 \\&#xA;&amp;amp;= \frac{N(N+2)}4&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which completes the proof.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-18T02:26:46.237" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17126" PostTypeId="2" ParentId="17115" CreationDate="2021-04-18T06:29:24.637" Score="1" Body="&lt;p&gt;Here is a list of other basic gate sets based on comments to my question (&lt;em&gt;I included a name of a comment author to brackets&lt;/em&gt;):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The native gate set for IBM hardware is &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$ID$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt; (by &lt;em&gt;KAJ226&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Google Sycamore gates: &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{Y}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sqrt{W}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$W = (X + Y)/\sqrt{2}$&lt;/span&gt; and gate similar to &lt;span class=&quot;math-container&quot;&gt;$iSWAP$&lt;/span&gt; (described &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8337/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/8341/understanding-googles-quantum-supremacy-using-a-programmable-superconducting-p&quot;&gt;here&lt;/a&gt;) (by &lt;em&gt;Mark S&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Native gate set used by IonQ comprised of single qubit rotations &lt;span class=&quot;math-container&quot;&gt;$Rx$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; which is &lt;a href=&quot;https://en.wikipedia.org/wiki/M%C3%B8lmer%E2%80%93S%C3%B8rensen_gate&quot; rel=&quot;nofollow noreferrer&quot;&gt;Mølmer-Sørenson&lt;/a&gt; two qubit gate (by &lt;em&gt;Egretta.Thula&lt;/em&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-04-18T06:29:24.637" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17127" PostTypeId="1" CreationDate="2021-04-18T09:27:48.337" Score="1" ViewCount="47" Body="&lt;p&gt;Hello I am about to take the IBM Quantum Qiskit dev exam. I don't know if I can use the quantum lab (Qiskit) during the exam. Does anyone know?&lt;/p&gt;&#xA;" OwnerUserId="15595" LastEditorUserId="9006" LastEditDate="2021-04-18T12:56:07.843" LastActivityDate="2021-04-18T17:50:26.343" Title="Can I use Quantum lab during IBM Quantum certification exam?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-04-19T19:08:35.370" ContentLicense="CC BY-SA 4.0" />
  <row Id="17128" PostTypeId="1" CreationDate="2021-04-18T16:33:34.300" Score="0" ViewCount="100" Body="&lt;p&gt;As an example I have the density matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{3}(| \phi^+ \rangle\langle\phi^+| + | 00 \rangle\langle 00|+| 11 \rangle\langle11| )$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the two-qubit state is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{3}(| \phi^- \rangle\langle\phi^-| + | \psi^+ \rangle\langle \psi^+|+| \psi^- \rangle\langle \psi^-| )$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The trace of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;*state is greater than zero. Does that suffice to show that it is separable?&lt;/p&gt;&#xA;" OwnerUserId="13030" LastEditorUserId="55" LastEditDate="2021-04-18T17:13:22.190" LastActivityDate="2021-04-21T14:11:45.077" Title="Does $\mathrm{Tr}(\rho\sigma) &gt; 0$ prove that a state $\sigma$ is separable?" Tags="&lt;entanglement&gt;&lt;density-matrix&gt;&lt;trace&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17129" PostTypeId="2" ParentId="17127" CreationDate="2021-04-18T17:50:26.343" Score="-1" Body="&lt;p&gt;no you can't. you take the exam on an app that closes all other applications when launched.&lt;/p&gt;&#xA;" OwnerUserId="15595" LastActivityDate="2021-04-18T17:50:26.343" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17130" PostTypeId="2" ParentId="17128" CreationDate="2021-04-18T19:18:32.450" Score="2" Body="&lt;p&gt;No, take Bell state &lt;span class=&quot;math-container&quot;&gt;$\sigma = \frac{1}{2} (|00 \rangle+| 11 \rangle)( \langle 00| +\langle11|)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho = \frac{1}{4}I$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Also, if &lt;span class=&quot;math-container&quot;&gt;$\rho \ge 0$&lt;/span&gt; then it's always &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho \sigma) \ge 0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Though there is a notion of &lt;a href=&quot;https://en.wikipedia.org/wiki/Entanglement_witness&quot; rel=&quot;nofollow noreferrer&quot;&gt;entanglement witness&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We can deduce that state &lt;span class=&quot;math-container&quot;&gt;$\sigma$&lt;/span&gt; is separable if (and only if) for every Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, such that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho \cdot \sigma_1 \otimes \sigma_2) \ge 0$&lt;/span&gt; for any states &lt;span class=&quot;math-container&quot;&gt;$\sigma_1,\sigma_2$&lt;/span&gt;, we have that &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho \cdot \sigma) \ge 0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastEditorUserId="5870" LastEditDate="2021-04-18T19:24:15.390" LastActivityDate="2021-04-18T19:24:15.390" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17133" PostTypeId="2" ParentId="17066" CreationDate="2021-04-18T20:41:44.550" Score="1" Body="&lt;p&gt;This is normal! If you look at the molecular Hamiltonian &lt;code&gt;ozone_molecule.get_molecular_hamiltonian()&lt;/code&gt;, you will notice that it is a Hamiltonian that acts on &lt;em&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;/em&gt; spin orbitals, and so &lt;code&gt;ozone_qubit_hamiltonian&lt;/code&gt; is a 30 qubit Hamiltonian. This means it has &lt;span class=&quot;math-container&quot;&gt;$2^{30} \times 2^{30} = 2^{60} \approx 1.15 \times 10^{18}$&lt;/span&gt; matrix elements, which will surely consume all your computers memory.&lt;/p&gt;&#xA;&lt;p&gt;If you want to study these larger molecules, perhaps you should consider an active space approximation (see &lt;a href=&quot;https://quantumai.google/openfermion/tutorials/intro_to_openfermion&quot; rel=&quot;nofollow noreferrer&quot;&gt;the Openfermion tutorials some details on how to implement this&lt;/a&gt;). This will reduce the number of spin orbitals in your molecular Hamiltonian, giving you an exponential reduction in the dimension of the sparse/dense matrix.&lt;/p&gt;&#xA;" OwnerUserId="7729" LastActivityDate="2021-04-18T20:41:44.550" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17135" PostTypeId="1" CreationDate="2021-04-19T00:09:00.533" Score="2" ViewCount="78" Body="&lt;p&gt;Let's say I have n qbits each in a superposition &lt;span class=&quot;math-container&quot;&gt;$\begin{pmatrix} \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} \end{pmatrix}$&lt;/span&gt; so each possible outcome has a probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2^n}$&lt;/span&gt;. Is it possible for me to suppress the probability of one outcome?&lt;/p&gt;&#xA;&lt;p&gt;E.g. I have 3qbits, I want to remove the possibility of reading 101 when I measure the qbits. Possible outcomes:&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 000\\ 001\\010\\011\\100\\101\\110\\111 \end{bmatrix}$&lt;/span&gt; probabilities of outcomes: &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0.125\\ 0.125\\0.125\\0.125\\0.125\\0.125\\0.125\\0.125\end{bmatrix}$&lt;/span&gt; -&amp;gt; &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0.143\\ 0.143\\0.143\\0.143\\0.143\\0\\0.143\\0.143\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is this possible? How could I do that?&#xA;Furthermore, is it possible for me to remove the possibility of reading 2 outcomes: say 101 and 110.&lt;/p&gt;&#xA;&lt;p&gt;Possible outcomes:&lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 000\\ 001\\010\\011\\100\\101\\110\\111 \end{bmatrix}$&lt;/span&gt; probabilities of outcomes: &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0.125\\ 0.125\\0.125\\0.125\\0.125\\0.125\\0.125\\0.125\end{bmatrix}$&lt;/span&gt; -&amp;gt; &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix} 0.167\\ 0.167\\0.167\\0.167\\0.167\\0\\0\\0.167\end{bmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note: I don't actually care about the remaining probabilities of the outcomes, as long as they are nonzero.&lt;/p&gt;&#xA;" OwnerUserId="15600" LastEditorUserId="15600" LastEditDate="2021-04-19T13:13:22.007" LastActivityDate="2021-04-19T13:13:22.007" Title="is it possible to eliminate a certain possibility of an outcome of 3+ qbits" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;algorithm&gt;" AnswerCount="0" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17136" PostTypeId="1" CreationDate="2021-04-19T05:29:52.023" Score="2" ViewCount="34" Body="&lt;p&gt;The famous &lt;a href=&quot;https://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93Rao_bound&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cramer-Rao bound&lt;/a&gt; is &lt;span class=&quot;math-container&quot;&gt;$$\Delta\theta\ge\frac{1}{\sqrt {F[\rho,H]}}$$&lt;/span&gt;&#xA;But what happens if the denominator vanishes, i.e., &lt;span class=&quot;math-container&quot;&gt;$F[\rho,H]=0$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$F[\rho,H]$&lt;/span&gt; here stands for the quantum fisher information in the unitary process)? For example, &lt;span class=&quot;math-container&quot;&gt;$F[\rho,H]$&lt;/span&gt; can be zero in this &lt;a href=&quot;https://arxiv.org/abs/1006.4368&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt; below eq&lt;span class=&quot;math-container&quot;&gt;$(26)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-19T09:41:15.700" LastActivityDate="2021-04-19T09:41:15.700" Title="What happens in the Cramer-Rao bound if the quantum Fisher information is zero?" Tags="&lt;mathematics&gt;&lt;quantum-fisher-information&gt;&lt;quantum-metrology&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17137" PostTypeId="1" AcceptedAnswerId="17213" CreationDate="2021-04-19T12:18:02.150" Score="5" ViewCount="72" Body="&lt;p&gt;It seems that in a lot of papers in the field of quantum metrology, there are two terms &lt;em&gt;Shot-Noise-Limit&lt;/em&gt; and &lt;em&gt;Standard Quantum Limit&lt;/em&gt; which are frequently referred to. What's the difference between them, because it seems they all refer to the limit &lt;span class=&quot;math-container&quot;&gt;$\Delta \theta\ge\frac{1}{\sqrt{N}}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-19T13:25:59.670" LastActivityDate="2021-04-22T21:16:34.823" Title="What is the difference between &quot;Shot-Noise-Limit&quot; and &quot;Standard Quantum Limit&quot;?" Tags="&lt;terminology&gt;&lt;quantum-fisher-information&gt;&lt;quantum-metrology&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17138" PostTypeId="1" AcceptedAnswerId="17139" CreationDate="2021-04-19T14:37:34.683" Score="1" ViewCount="52" Body="&lt;p&gt;What does it mean to teleport a state through another state? According to most of the online sources, we use a bell state for teleportation. What would be the outcome if we use any other possible state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; to teleport &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;? Would that even make sense to do?&lt;/p&gt;&#xA;" OwnerUserId="14817" LastActivityDate="2021-04-20T07:59:40.520" Title="What do we mean by teleporting state $|\psi\rangle$ through state $|\phi\rangle$?" Tags="&lt;teleportation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17139" PostTypeId="2" ParentId="17138" CreationDate="2021-04-19T14:55:26.853" Score="2" Body="&lt;p&gt;As you say, it just means to replace the Bell state with the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. Of course you can do that in the protocol. Why would you want to? There are a couple of options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Maybe you don't have a Bell state (for example, &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is your best attempt at producing a Bell state, but it's not perfect).&lt;/li&gt;&#xA;&lt;li&gt;If you incorporate some additional unitaries into the state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, such as &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle=(|0+\rangle+|1-\rangle)/\sqrt{2}$&lt;/span&gt;, you can actually use the teleportation to also apply a unitary to your state. In this case, a Hadamard gate.&lt;/li&gt;&#xA;&lt;li&gt;Teleportation need not be a real operation. There's the whole study of CP-maps and the Choi-Jamiolkowski isomorphism which is kind of the above two items combined, but is not generally considered a real operation, but more of a mathematical tool.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-19T14:55:26.853" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17140" PostTypeId="5" CreationDate="2021-04-19T15:09:21.620" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:09:21.620" LastActivityDate="2021-04-19T15:09:21.620" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17141" PostTypeId="4" CreationDate="2021-04-19T15:09:21.620" Score="0" Body="Any model of restricted quantum information processing built upon two main system-dependent requirements for the resources and allowed operations; (i) the existence of a set of states that are free and those not in the set are expensive; and (ii) the allowed operations are those that map the set of free states to itself." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-20T07:41:36.173" LastActivityDate="2021-04-20T07:41:36.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17142" PostTypeId="5" CreationDate="2021-04-19T15:11:01.043" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:11:01.043" LastActivityDate="2021-04-19T15:11:01.043" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17143" PostTypeId="4" CreationDate="2021-04-19T15:11:01.043" Score="0" Body="a class of stochastic maps, or channels, whose action (when tensored with the identity) on an entangled state always yields a separable state." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-19T16:44:34.097" LastActivityDate="2021-04-19T16:44:34.097" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17144" PostTypeId="5" CreationDate="2021-04-19T15:12:19.187" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:12:19.187" LastActivityDate="2021-04-19T15:12:19.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17145" PostTypeId="4" CreationDate="2021-04-19T15:12:19.187" Score="0" Body="A special kind of nonlocal correlations, which is intermediate between Bell nonlocality and quantum entanglement. A state exhibiting Bell nonlocality must also exhibit quantum steering, a state exhibiting quantum steering must also exhibit quantum entanglement. But for mixed quantum states, there exist examples that lie between these different quantum correlation sets." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-19T21:45:11.363" LastActivityDate="2021-04-19T21:45:11.363" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17146" PostTypeId="1" CreationDate="2021-04-19T15:12:40.363" Score="3" ViewCount="41" Body="&lt;p&gt;In working with the IBM quantum computer, one can use for example the composer in order to build simple quantum algorithms. Essentially, one usually feeds a phase in order to affect one of the qubits. While for instance phases like &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt; can be applied &amp;quot;faithfully&amp;quot; into the real backends, one can add in the composer phases like &lt;code&gt;0.0983498491221321 &lt;/code&gt; (i.e. &lt;code&gt;Float64&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I would like to ask what is the actual &amp;quot;precision&amp;quot;, i.e. up to which significant figure does the real backends can achieve. I suppose it also depends on the backend that one chooses, so it should be a list of how much precision we can achieve in each one of the real machines.&lt;/p&gt;&#xA;" OwnerUserId="15220" LastActivityDate="2021-04-19T15:12:40.363" Title="What is the actual precision of the IBM quantum computer?" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17147" PostTypeId="5" CreationDate="2021-04-19T15:14:11.480" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:14:11.480" LastActivityDate="2021-04-19T15:14:11.480" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17148" PostTypeId="4" CreationDate="2021-04-19T15:14:11.480" Score="0" Body="The study of making high-resolution and highly sensitive measurements of physical parameters using quantum theory to describe the physical systems, particularly exploiting quantum entanglement and quantum squeezing." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-19T21:44:52.467" LastActivityDate="2021-04-19T21:44:52.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17149" PostTypeId="5" CreationDate="2021-04-19T15:18:50.567" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:18:50.567" LastActivityDate="2021-04-19T15:18:50.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17150" PostTypeId="4" CreationDate="2021-04-19T15:18:50.567" Score="0" Body="A positive semidefinite matrix is a Hermitian matrix all of whose eigenvalues are nonnegative." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-19T16:44:07.770" LastActivityDate="2021-04-19T16:44:07.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17151" PostTypeId="5" CreationDate="2021-04-19T15:20:43.980" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:20:43.980" LastActivityDate="2021-04-19T15:20:43.980" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17152" PostTypeId="4" CreationDate="2021-04-19T15:20:43.980" Score="0" Body="The smallest of the Rényi family of entropies, corresponding to the most conservative way of measuring the unpredictability of a set of outcomes, as the negative logarithm of the probability of the most likely outcome." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-04-19T21:45:04.410" LastActivityDate="2021-04-19T21:45:04.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17153" PostTypeId="5" CreationDate="2021-04-19T15:30:07.687" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:30:07.687" LastActivityDate="2021-04-19T15:30:07.687" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17154" PostTypeId="4" CreationDate="2021-04-19T15:30:07.687" Score="0" Body="A quantum workflow system that automates the management of the quantum stack. https://www.orquestra.io/" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-19T16:45:47.747" LastActivityDate="2021-04-19T16:45:47.747" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17155" PostTypeId="5" CreationDate="2021-04-19T15:31:23.617" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-19T15:31:23.617" LastActivityDate="2021-04-19T15:31:23.617" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17156" PostTypeId="4" CreationDate="2021-04-19T15:31:23.617" Score="0" Body="a MATLAB toolbox for exploring quantum entanglement theory. http://www.qetlab.com/Main_Page" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-19T16:45:55.317" LastActivityDate="2021-04-19T16:45:55.317" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17157" PostTypeId="1" CreationDate="2021-04-19T21:44:32.783" Score="2" ViewCount="35" Body="&lt;h1&gt;Very brief background&lt;/h1&gt;&#xA;&lt;p&gt;In quantum annealing, the discrete optimization problem we wish to solve (such as finding the minimum of &lt;span class=&quot;math-container&quot;&gt;$b_1b_2 - 3b_1 + 5b_3b_4$&lt;/span&gt; for binary variables &lt;span class=&quot;math-container&quot;&gt;$b_i$&lt;/span&gt;) may have a connectivity between the variables that doesn't match the connectivity between the qubits in the hardware. To deal with this, we may use more than one physical qubit to represent one logical qubit, so that at least one member of the &amp;quot;chain&amp;quot; of physical qubits, is connected in hardware to the other logical qubits that the original problem demands.&lt;/p&gt;&#xA;&lt;h1&gt;Literature that says &amp;quot;uniform&amp;quot; chains are preferred&lt;/h1&gt;&#xA;&lt;p&gt;If in the final embedding of the logical problem into the hardware graph, all &amp;quot;chains&amp;quot; span the same number of qubits, then the embedding is called &amp;quot;uniform&amp;quot;. This definition is given in the second paragraph of section 1.1 of &lt;a href=&quot;https://arxiv.org/abs/1507.04774&quot; rel=&quot;nofollow noreferrer&quot;&gt;this excellent paper&lt;/a&gt; by D-Wave, which strongly emphasizes the desire to have &amp;quot;uniform&amp;quot; chains, and prioritizes uniformity of the chain lengths over pretty much every other property that we would think is important for solving our problem most efficiently (i.e. having uniform chains is more important than minimizing the total number of qubits, total number of couplings between the qubits, total number of &amp;quot;chains&amp;quot;, longest length of &amp;quot;chains&amp;quot;, total number of qubits inside &amp;quot;chains&amp;quot;, etc.).&lt;/p&gt;&#xA;&lt;p&gt;The paper's only justification for desiring uniform chain lengths, is given in this sentence:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&amp;quot;One desirable feature of native clique embeddings&#xA;is uniform chain length, which results in uniform, predictable chain dynamics throughout the anneal [13].&amp;quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Reference [13] is &lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/410/davide-venturelli&quot;&gt;Davide Venturelli&lt;/a&gt;'s excellent &lt;a href=&quot;https://arxiv.org/abs/1406.7553&quot; rel=&quot;nofollow noreferrer&quot;&gt;2014 paper&lt;/a&gt;. While [13] does do quite a substantial amount of analysis about quantum annealing and embedding of graphs, &lt;strong&gt;where are they portraying the message that uniform chains are preferred over other aspects such as &amp;quot;total number of qubits used&amp;quot; and  &amp;quot;total number of qubit-qubit couplings&amp;quot;?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h1&gt;The reason why I ask&lt;/h1&gt;&#xA;&lt;p&gt;The team at D-Wave that designed the Pegasus architecture &lt;a href=&quot;https://arxiv.org/abs/2003.00133&quot; rel=&quot;nofollow noreferrer&quot;&gt;describes &amp;quot;optimal embeddings&amp;quot;&lt;/a&gt; based on the triangle embedding, which is an embedding that's sold based on being uniform (see the second paragraph of section 1.1 in the first paper referenced in this question). &lt;/p&gt;&#xA;&lt;p&gt;However, the triangle embedding for 12 logical qubits with all-to-all connectivity, requires &lt;strong&gt;48 physical qubits&lt;/strong&gt;, &lt;strong&gt;102 qubit-qubit couplings&lt;/strong&gt;, and &lt;strong&gt;12 chains of length 4&lt;/strong&gt; while the following embedding &lt;strong&gt;only requires 46 physical qubits&lt;/strong&gt;, &lt;strong&gt;100 qubit-qubit couplings&lt;/strong&gt; and some chains with a length of &lt;strong&gt;only 3&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{0: [42, 31, 39, 47], 1: [25, 61, 53, 49], 2: [56, 32, 8], 3: [40, 29, 37, 45], 4: [13, 10, 58, 34], 5: [28, 36, 44], 6: [12, 59, 35, 11], 7: [27, 63, 55, 51], 8: [60, 52, 26, 50], 9: [24, 48, 62, 54], 10: [14, 57, 9, 33], 11: [43, 30, 46, 38]}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The embedding here seems superior to the triangle embedding in every single way except that instead of having all chains contain 4 qubits, it has some chains with 4 qubits and some with 3 qubits. All along in this research area, people have always told me that shorter chains are more desirable, which completely makes sense since they require fewer qubits and couplings, but the above papers suggest that we'd rather have some chains longer than necessary in order to have uniformity: &lt;em&gt;&lt;strong&gt;why is uniformity so important&lt;/strong&gt;&lt;/em&gt; here, that we would rather use more qubits and qubit-qubit couplings than mathematically needed, even when there's embeddings that require fewer resources and have chain lengths that are only 1 or 2 qubits shorter than others in the same embedding?&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-04-19T21:44:32.783" Title="Why is it so important to have uniform chain lengths in a minor embedding?" Tags="&lt;mathematics&gt;&lt;d-wave&gt;&lt;annealing&gt;&lt;adiabatic-model&gt;&lt;embedding&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17158" PostTypeId="1" CreationDate="2021-04-19T22:30:07.480" Score="3" ViewCount="63" Body="&lt;p&gt;I was studying &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0105026&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt; by Boestrom and Felbinger.&lt;/p&gt;&#xA;&lt;p&gt;We define the significant length of the codewords in the preparation of the communication protocol :  &lt;span class=&quot;math-container&quot;&gt;$$L_c(w_i) = \lceil log_k(i) \rceil$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can also calculate the base length of the codewords :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \underline L _c(x)= \max_{i=1,...,d} \{L_c(w_i) | \ |\langle w_i|x\rangle|^2 &amp;gt; 0 \} \tag{101}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After explaining the protocol, they give an explicit example with a source message set :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \chi = \{|a\rangle,|b\rangle, |c\rangle, |d\rangle, |e\rangle, |f\rangle, |g\rangle, |h\rangle, |i\rangle, |j\rangle \}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Authors then calculate that :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\underline L _c (a) = 0 ; \underline L _c (b) = \underline L _c (c) = \underline L _c (d) = 1 \tag{136}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \underline L _c (e) = \underline L _c (f) = \underline L _c (g) = \underline L _c (h) = \underline L _c (i) = \underline L _c (j) =2 \tag{137}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have troubles understanding the equation 101 and how it calculates the length of the strings. Maybe explaining the examples in equations 136 and 137, will help too.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for reading, hope you can help !&lt;/p&gt;&#xA;" OwnerUserId="15087" LastEditorUserId="55" LastEditDate="2021-04-20T09:47:58.680" LastActivityDate="2021-04-23T19:20:19.667" Title="Calculating length of code words in quantum information(compression)" Tags="&lt;quantum-gate&gt;&lt;error-correction&gt;" AnswerCount="0" CommentCount="3" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17161" PostTypeId="1" CreationDate="2021-04-20T02:01:40.120" Score="2" ViewCount="67" Body="&lt;p&gt;I am trying to understand single qubit operations from Bloch sphere, but I was told that the limitation of Bloch sphere is that it can only visualize or simulate 1 qubit.&lt;/p&gt;&#xA;&lt;p&gt;What are some instances do I need to know or visualize multi-qubit interactions? How do Quantum computer scientist or students currently use to visualize or understand multi-qubit interactions?  And lastly, what are some information does one need to know from a multi-qubit interaction?&lt;/p&gt;&#xA;&lt;p&gt;I understand the question is a little broad as I am new to this field, just asking this out of curiosity and I'm also interested to explore ideas on how to visualize this as well!&lt;/p&gt;&#xA;" OwnerUserId="15609" LastEditorUserId="55" LastEditDate="2021-04-20T07:34:56.407" LastActivityDate="2021-05-20T15:02:55.287" Title="How do you visualize multi-qubit interactions?" Tags="&lt;quantum-state&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17162" PostTypeId="1" CreationDate="2021-04-20T07:49:05.597" Score="0" ViewCount="45" Body="&lt;p&gt;Suppose I want to apply an &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gate transformation to an arbitrary quantum state &lt;span class=&quot;math-container&quot;&gt;$|\sigma\rangle$&lt;/span&gt;, and then a &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-gate transformation to the arbitrary quantum state &lt;span class=&quot;math-container&quot;&gt;$|\sigma\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The quantum state is transformed into &lt;span class=&quot;math-container&quot;&gt;$TH|\sigma\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But I can't do &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;-gate first now, I only can use a &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;-gate first.  The quantum state transformation is &lt;span class=&quot;math-container&quot;&gt;$T|\sigma\rangle$&lt;/span&gt;, regardless of the global phase.&lt;/p&gt;&#xA;&lt;p&gt;How do I transform to get the quantum state &lt;span class=&quot;math-container&quot;&gt;$TH|\sigma\rangle$&lt;/span&gt; which is what I want at the beginning?&lt;/p&gt;&#xA;&lt;p&gt;To explain my question, an example is given below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$R_x(\theta)^aR_z(\theta)^b=(-1)^{ab}R_z(\theta)R_x(\theta).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="13731" LastEditorUserId="10480" LastEditDate="2021-04-21T04:59:20.833" LastActivityDate="2021-04-21T04:59:20.833" Title="Transformation of Operation Order for H,T Single Quantum Gate" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17163" PostTypeId="2" ParentId="17138" CreationDate="2021-04-20T07:59:40.520" Score="1" Body="&lt;p&gt;Answering the question in the title, the general idea is that if &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is some &lt;em&gt;bipartite&lt;/em&gt; (hopefully) entangled state, shared by two parties, call them Alice and Bob, that means that Alice and Bob's measurement results will be correlated, for many (possibly all) choice of measurements they can perform.&lt;/p&gt;&#xA;&lt;p&gt;One can exploit such correlations to &amp;quot;teleport&amp;quot; some (local) state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; from (say) Alice to Bob. To do this, Alice performs measurements after entangling her share of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Her measurement results thus contain some information about &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. But these are also correlated with Bob's measurement results. It is therefore possible, under suitable conditions, to perform some local measurement on Bob's side of the state that result in his state being identical to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-04-20T07:59:40.520" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17165" PostTypeId="2" ParentId="14833" CreationDate="2021-04-20T10:52:23.993" Score="2" Body="&lt;p&gt;A non-linear process involves a &lt;em&gt;measurement&lt;/em&gt;. The idea of a repeat until success sequence is that when you do the measurement, one of the results will be the one you want. If you get it, great! You've succeeded. If the measurement result is not that answer that you were after, you know that you've not got what you want, and you should know how it's wrong. So, you have two choices. Sometimes, you can try and compensate for the incorrect measurement outcome (e.g. teleportation), which might include further non-linear steps. Sometimes, that's not an effective strategy. Instead, you just start again and hope for better luck next time. Either way, you keep going until you get the outcome you wanted.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-20T10:52:23.993" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17166" PostTypeId="1" AcceptedAnswerId="17167" CreationDate="2021-04-20T13:03:57.847" Score="2" ViewCount="62" Body="&lt;p&gt;I'm trying to get used to the qiskit module and quantum circuits in general, before tackling a QML project. So I'm going through the tutorial on the documentation page regarding &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;gates&lt;/a&gt;. I've gotten as far as the controlled Hadamard gate. I can create the circuit and print it out, but once I try to run the job, I get an error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;q0_0: ──■──&#xA;      ┌─┴─┐&#xA;q0_1: ┤ H ├&#xA;      └───┘&#xA;Simulation failed and returned the following error message:&#xA;ERROR:  [Experiment 0] Circuit contains invalid instructions {&amp;quot;gates&amp;quot;: {ch}} for &amp;quot;unitary&amp;quot; method&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I had to modify the sample code a little because it threw a few deprecation errors and I couldn't get it to display the circuit or the matrix as it stood.&#xA;The example code (gathered into 1 from the tutorial):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;%matplotlib inline&#xA;import numpy as np&#xA;from math import pi&#xA;&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute&#xA;from qiskit.tools.visualization import circuit_drawer&#xA;from qiskit.quantum_info import state_fidelity&#xA;from qiskit import BasicAer&#xA;&#xA;backend = BasicAer.get_backend('unitary_simulator')&#xA;&#xA;q = QuantumRegister(2)&#xA;qc = QuantumCircuit(q)&#xA;qc.ch(q[0],q[1])&#xA;qc.draw()&#xA;&#xA;job = execute(qc, backend)&#xA;job.result().get_unitary(qc, decimals=3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The main change I had to make, was irt. the &lt;code&gt;.draw()&lt;/code&gt; and &lt;code&gt;execute()&lt;/code&gt; functions. I got some errors there when importing. Since I couldn't find a provider called &lt;code&gt;BasicAer&lt;/code&gt; I went with the &lt;code&gt;Aer&lt;/code&gt; provider. for all single-qubit states, this worked as well as for controlled X Y and Z gates.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import \&#xA;        QuantumCircuit,\&#xA;        QuantumRegister,\&#xA;        ClassicalRegister&#xA;from qiskit.providers.aer import UnitarySimulator&#xA;&#xA;import numpy as np&#xA;&#xA;backend = UnitarySimulator()&#xA;n = 2&#xA;q = QuantumRegister(n)&#xA;&#xA;qc = QuantumCircuit(q)&#xA;qc.ch(q[0], q[1]) # LSB first&#xA;print(qc)&#xA;job = backend.run(qc)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I tried to google the error message, but I couldn't find any previous issues regarding this, nor any particular error message like it.&lt;/p&gt;&#xA;&lt;p&gt;The error refers to a &amp;quot;Unitary&amp;quot; method. This could be the &lt;code&gt;unitary_simulator&lt;/code&gt;/&lt;code&gt;UnitarySimulator&lt;/code&gt; the tutorial used versus the one I imported. Testing it, the code seems to run, though I struggle to see the output. In addition, an error is then thrown at the &lt;code&gt;decimal&lt;/code&gt; bit in the tutorial. It seems like I could make it work if I changed the import method, but I don't quite understand why. There were also some deprecation warnings for the tutorial in earlier parts, which my previous methods avoided, in particular regarding the Unitary operator and the decomposition into u3, u2 and u1.&lt;/p&gt;&#xA;&lt;p&gt;Is the &lt;code&gt;BasicAer.get_backend('unitary_simulator')&lt;/code&gt;method in the process of phasing out, or is it an either or situation? is there a particular reason for the difference in the functionality between the 2?&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; qiskit.__qiskit_version__&#xA;{'qiskit-terra': '0.17.0', 'qiskit-aer': '0.8.0', 'qiskit-ignis': '0.6.0', 'qiskit-ibmq-provider': '0.12.2', 'qiskit-aqua': '0.9.0', 'qiskit': '0.25.0'}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Edit:&#xA;I got a tip from a TA regarding the use of &lt;code&gt;execute()&lt;/code&gt; which does let the program run. From a quick look at the documentation, it seems like there are few differences between the &lt;code&gt;execute()&lt;/code&gt; and &lt;code&gt;backend.run()&lt;/code&gt;, though according to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12757/what-is-the-difference-between-qiskit-execute-and-the-ibmqjobmanager&quot;&gt;this&lt;/a&gt; it could be that the &lt;code&gt;execute()&lt;/code&gt; transpiles the circuit first? but I don't quite see why that would allow for unitary operations.&lt;/p&gt;&#xA;&lt;p&gt;Another thing, I have tested the same type of imports on singular bit gates such as the U gate, and on 2-qubit gates such as the CX gate, which both work with the unitary operator from what I understand. And there are no new function calls for the CH gate.&#xA;I guess part of it is that I don't see why it fails for the CH and not for H, U  or CX or others.&lt;/p&gt;&#xA;" OwnerUserId="15584" LastEditorUserId="55" LastEditDate="2021-04-20T16:36:26.557" LastActivityDate="2021-04-20T16:36:26.557" Title="Error when attempting to visualize controlled hadamard gate state matrix with qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17167" PostTypeId="2" ParentId="17166" CreationDate="2021-04-20T13:45:06.770" Score="3" Body="&lt;p&gt;As it is written in the error message, it is here because the CH gate is not in the basis gates of &lt;code&gt;UnitarySimulator&lt;/code&gt;, therefore the backend doesn't understand it and can't do anything with it ; check this line of code :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'ch' in UnitarySimulator().configuration().basis_gates&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It returns &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now I believe it has the error with the &lt;code&gt;run&lt;/code&gt; method and not the &lt;code&gt;execute&lt;/code&gt; function because in the execute function, there is a step called the &lt;a href=&quot;https://qiskit.org/documentation/apidoc/transpiler.html?highlight=transpiler#module-qiskit.transpiler&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;transpiler&lt;/em&gt;&lt;/a&gt; that does this translation step into gates the backend knows. It is a vital step when you are running on actual devices that have basis gates equal to &lt;code&gt;['x', 'sx', 'rz', 'id', 'cx']&lt;/code&gt;. Nothing needs to change when you use the execute function, but with the run method you could do something like this :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(q)&#xA;qc.ch(q[0], q[1]) # LSB first&#xA;qc = transpile(qc, backend)&#xA;qobj = assemble(qc, backend)&#xA;print(qc)&#xA;job = backend.run(qobj)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-04-20T13:45:06.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17168" PostTypeId="1" CreationDate="2021-04-20T13:46:25.630" Score="1" ViewCount="38" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1811.12926&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper (or more pedagogically &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;) it is given a way to compute the Quantum Volume of a quantum computer (qc), specifically aimed at the IBM qcs.&lt;/p&gt;&#xA;&lt;p&gt;In all this process I found some dark spots that I would like to understand.  First of all we need the heavy outputs &lt;span class=&quot;math-container&quot;&gt;$H_U$&lt;/span&gt; which can be obtained from a &amp;quot;classical&amp;quot; computation. Obviously in the implementation the transpiler will do some optimizations so from an original &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits and depth &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;) we will get the transpiled &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt;. The probability of sampling a heavy output with this &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; is &lt;em&gt;strangely&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;h_U = \sum_{x\in H_U} q_U(x).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Ok I buy that this quantity works, but why to sum it over all possibles &lt;span class=&quot;math-container&quot;&gt;$x\in H_U$&lt;/span&gt; is still unclear to me.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The probability of observing a heavy output is then &lt;span class=&quot;math-container&quot;&gt;$h_d = \int h_UdU$&lt;/span&gt;. In the paper mentioned the &lt;strong&gt;Algorithm 1&lt;/strong&gt; computes &lt;span class=&quot;math-container&quot;&gt;$h_d$&lt;/span&gt;, right?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As far as I understand, this algorithm simply constructs the frequency plot between a realization of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; vs the number of heavy outputs found in a certain number of trial initial state &lt;span class=&quot;math-container&quot;&gt;$|00\dots 0\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-spins), right?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Then if 3 is correct, &lt;span class=&quot;math-container&quot;&gt;$h_d$&lt;/span&gt; can be computed from the (normalized) histogram just constructed. However the authors give  the formula&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{n_h-2\sqrt{n_h(n_s-n_h/n_c)}}{n_c n_s}&amp;gt;2/3,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to validate if &lt;span class=&quot;math-container&quot;&gt;$h_d$&lt;/span&gt; has been achieved. How is this formula found? Is it some numerical (e.g. Simpson) rule?&lt;/p&gt;&#xA;&lt;ol start=&quot;5&quot;&gt;&#xA;&lt;li&gt;On the other, one can measure how well the &lt;span class=&quot;math-container&quot;&gt;$U'$&lt;/span&gt; resembles &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; by computing the fidelity &lt;span class=&quot;math-container&quot;&gt;$F_{\mathrm{avg}}(U,U')$&lt;/span&gt;. Where does this quantity enters for computing &lt;span class=&quot;math-container&quot;&gt;$V_Q$&lt;/span&gt;? &lt;span class=&quot;math-container&quot;&gt;$\log_2 V_Q =\mathrm{argmax}_m \; \mathrm{min}(m,d(m))$&lt;/span&gt; doesn't tell much...&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15220" LastActivityDate="2021-04-20T13:46:25.630" Title="Understanding the heavy output problem" Tags="&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2021-04-22T11:37:30.683" ContentLicense="CC BY-SA 4.0" />
  <row Id="17169" PostTypeId="2" ParentId="17161" CreationDate="2021-04-20T14:07:51.047" Score="0" Body="&lt;p&gt;This is an answer from the Physics point of view. The Bloch sphere is a kind of &amp;quot;phase space&amp;quot; for the qubit. Now let's see what is a phase space. Phase space typically appears in Classical Mechanics in order to study the dynamics of a classical system. You can do lots of things there, for instance study chaotic systems.&lt;/p&gt;&#xA;&lt;p&gt;How do you do it in Quantum Mechanics? Historically much of the development has been aimed to study for instance light (technically is the harmonic oscillator but it doesn't matter much). You can have your master equation with dissipation and temperature and study the solutions of &lt;span class=&quot;math-container&quot;&gt;$\partial_t \rho = \mathcal{L}[\rho]$&lt;/span&gt;. Another view is to map this equation onto the phase space (most of the time it is tricky!) using e.g. the Wigner Function. There you can see how your system behaves as a function of time and what does it do because of the temperature, etc.&lt;/p&gt;&#xA;&lt;p&gt;This is all well because the harmonic oscillator can be described in principle in continous &lt;span class=&quot;math-container&quot;&gt;$(x,p)$&lt;/span&gt; variables. On the other hand, qubits are somehow &amp;quot;discrete&amp;quot;, so it is not at all trivial to define a mapping &lt;span class=&quot;math-container&quot;&gt;$\rho_{\rm qubits}\rightarrow W(\rho_{\rm qubits})$&lt;/span&gt; over the phase space because one has to fulfill several requierements (!)&lt;/p&gt;&#xA;&lt;p&gt;Many theoretical uses can be found in the literature, as well as recent developments on how to define a reasonable phase space function for qubits. I leave some references here:&lt;/p&gt;&#xA;&lt;p&gt;[1] W. P. Schleich. Quantum Optics in Phase Space. 1st ed. Wiley-VCH (2001). (Classical treament of Phase Space for Quantum Mechanics.)&lt;/p&gt;&#xA;&lt;p&gt;[2] A. Perelomov. Generalized Coherent States and Their Applications. 1986th ed. Springer-Verlag (1986). (You can find partial answers to your questions here!)&lt;/p&gt;&#xA;&lt;p&gt;[3] C. Muñoz, I. Sainz and A. B. Klimov. Macroscopic approach to N-qudit systems. J. Phys. A: Math. Theor. 53 245302(2020). (This is a recent example of how e.g. to see and use the &amp;quot;phase space&amp;quot; for qudits!)&lt;/p&gt;&#xA;" OwnerUserId="15220" LastActivityDate="2021-04-20T14:07:51.047" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17170" PostTypeId="2" ParentId="17166" CreationDate="2021-04-20T14:08:20.103" Score="2" Body="&lt;p&gt;The reason for your error is that you are running on a backend that does not support CH. The function &lt;code&gt;execute&lt;/code&gt; works because it runs &lt;code&gt;transpile&lt;/code&gt; before, adapting the basis.&lt;/p&gt;&#xA;&lt;p&gt;However, if I understand the spirit of your question, you can quickly get the unitary of any circuit using &lt;a href=&quot;https://nonhermitian.org/kaleido&quot; rel=&quot;nofollow noreferrer&quot;&gt;kaleidoscope&lt;/a&gt;, a very nice 3rd-party Qiskit extension. It can be installed with &lt;code&gt;pip install kaleidoscope&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then, you just do:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import kaleidoscope.qiskit&#xA;qc.unitary()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;Operator([[ 1.        +0.j,  0.        +0.j,  0.        +0.j,&#xA;            0.        +0.j],&#xA;          [ 0.        +0.j,  0.70710678+0.j,  0.        +0.j,&#xA;            0.70710678+0.j],&#xA;          [ 0.        +0.j,  0.        +0.j,  1.        +0.j,&#xA;            0.        +0.j],&#xA;          [ 0.        +0.j,  0.70710678+0.j,  0.        +0.j,&#xA;           -0.70710678+0.j]],&#xA;         input_dims=(2, 2), output_dims=(2, 2))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to display your matrix more nicely, you can get back to regular Qiskit and use &lt;code&gt;qiskit.visualization.array_to_latex&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import kaleidoscope.qiskit&#xA;from qiskit.visualization import array_to_latex&#xA;array_to_latex(qc.unitary())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0  \\&#xA; 0 &amp;amp; \tfrac{1}{\sqrt{2}} &amp;amp; 0 &amp;amp; \tfrac{1}{\sqrt{2}}  \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0  \\&#xA; 0 &amp;amp; \tfrac{1}{\sqrt{2}} &amp;amp; 0 &amp;amp; -\tfrac{1}{\sqrt{2}}  \\&#xA; \end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-04-20T14:08:20.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17171" PostTypeId="5" CreationDate="2021-04-20T16:16:09.820" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-04-20T16:16:09.820" LastActivityDate="2021-04-20T16:16:09.820" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17172" PostTypeId="4" CreationDate="2021-04-20T16:16:09.820" Score="0" Body="For questions relating to the Kraus decomposition of quantum channels." OwnerUserId="13991" LastEditorUserId="55" LastEditDate="2021-04-27T10:48:56.567" LastActivityDate="2021-04-27T10:48:56.567" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17173" PostTypeId="1" AcceptedAnswerId="17179" CreationDate="2021-04-20T17:33:47.133" Score="5" ViewCount="140" Body="&lt;p&gt;Does anyone know the list of all known universal sets of quantum gates? I know only two such sets: Cliffords + &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; and rotations + CNOT.&lt;/p&gt;&#xA;" OwnerUserId="8466" LastEditorUserId="10480" LastEditDate="2021-04-21T06:33:20.383" LastActivityDate="2021-04-24T06:14:56.760" Title="Does anyone know the list of all known universal sets of quantum gates?" Tags="&lt;quantum-gate&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17174" PostTypeId="1" CreationDate="2021-04-20T19:15:56.740" Score="4" ViewCount="56" Body="&lt;p&gt;I'm interested in learning about cases where a quantum computer could be used to perform tasks with only a constant (albeit large) factor of improvement in execution speed over classical computers. For example, in a talk about &lt;a href=&quot;https://arxiv.org/pdf/2004.11280.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; it was mentioned that a photonic quantum computer might be able to evaluate functions of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(x, y) = \exp \left(\frac{(x - y)^2}{\sigma^2} \right)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;at a rate on the order of terahertz frequency (&lt;span class=&quot;math-container&quot;&gt;$\sim 10^{-12}$&lt;/span&gt; seconds), which might give a significant procedural advantage compared to evaluating such a function classically on a PC at a rate that's presumably less than gigahertz (&lt;span class=&quot;math-container&quot;&gt;$\sim 10^{-9}$&lt;/span&gt; seconds). So while the quantum evaluation isn't asymptotically faster it might still be a useful as specialized hardware to compute a very specific, broadly useful function (similar to how GPU's and TPU's are employed).&lt;/p&gt;&#xA;&lt;p&gt;Are there any other interesting examples of the possibility to use a quantum computer to do an otherwise classically efficient task? Also I'm not so worried about QEC overhead and classical pre/post-processing overhead but the &amp;quot;clock rates&amp;quot; for executing gates and performing measurement on the quantum hardware are relevant.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2021-04-21T19:31:21.493" LastActivityDate="2021-04-21T19:31:21.493" Title="Quantum computer speedups for classically efficient applications" Tags="&lt;physical-realization&gt;&lt;classical-computing&gt;&lt;applications&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17175" PostTypeId="1" AcceptedAnswerId="17176" CreationDate="2021-04-21T02:20:45.327" Score="1" ViewCount="26" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; be an arbitrary state composed of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits and &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; be an integer such that &lt;span class=&quot;math-container&quot;&gt;$0\leq k \leq N.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The task is to ignore the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th bit and to flip the sign of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; if any of the remaining bits are equal to 1. In other words, flipping the sign of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is independent of the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th bit, but it is dependent on the existence of 1's lurking in &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The solution I came up with is the following, which, unfortunately, I cannot implement.&lt;/p&gt;&#xA;&lt;p&gt;Regardless of what &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is we flip its sign. There are two cases we should correct for, namely, the binary representations of 0 and &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;. Could not we take care of these two scenarios by using the ControlledOnInt function by setting &lt;span class=&quot;math-container&quot;&gt;$\textit{numberstate}$&lt;/span&gt; to 0 (first we have the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate act on &lt;span class=&quot;math-container&quot;&gt;$x[k]$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; flips &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\textit{oracle}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;, the &lt;span class=&quot;math-container&quot;&gt;$\textit{control register}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$[x]$&lt;/span&gt; and the &lt;span class=&quot;math-container&quot;&gt;$\textit{target register}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$x[k]$&lt;/span&gt;? Also, why can't the control and target registers be the same?&lt;/p&gt;&#xA;&lt;p&gt;How could we implement the above with an auxiliary qubit?&lt;/p&gt;&#xA;&lt;p&gt;In the second case where &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is the binary representation of &lt;span class=&quot;math-container&quot;&gt;$2^k$&lt;/span&gt;, we could use the task 3.2 from the same tutorial (flips the sign of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; if the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th qubit is 1), but I am also having trouble with that task. I have been able to implement the OR oracle (task 3.1 of the same tutorial), but it was done with a marking oracle, not a phase oracle.&lt;/p&gt;&#xA;" OwnerUserId="15605" LastEditorUserId="2879" LastEditDate="2021-04-21T02:43:54.690" LastActivityDate="2021-04-21T02:51:53.580" Title="Quantum Katas - Tutorials - Oracles - Task 3.3 (OR oracle of all bits except for a single bit)" Tags="&lt;q#&gt;&lt;oracles&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17176" PostTypeId="2" ParentId="17175" CreationDate="2021-04-21T02:51:53.580" Score="1" Body="&lt;p&gt;There is a much simpler way to approach this task. It requires only two observations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You can always convert a marking oracle to a phase oracle using the phase kickback trick (discussed earlier in the tutorial). Some tasks in this tutorial prohibit using extra qubits for this purpose to push you towards a solution that doesn't rely on that, but this task doesn't have this restrictions, so you can allocate that extra qubit, implement a marking oracle and use them to get your phase oracle.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;If you need to perform some computation on the whole register except one qubit, why not just define a qubit array that holds the rest of the qubits and use that array as the input for the marking oracle? (This is more of a programming trick than a quantum computing one, but it's a useful one!)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;With those two observations, the code is pretty straightforward:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;use minus = Qubit();&#xA;within {&#xA;    X(minus);&#xA;    H(minus);&#xA;} apply {&#xA;    Or_Oracle(x[...k-1] + x[k+1...], minus);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;x[...k-1] + x[k+1...]&lt;/code&gt; is a concatenation of two qubit arrays: all qubits before the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th one and all qubits after the &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;-th one.&lt;/p&gt;&#xA;&lt;p&gt;You can always check the file ReferenceImplementation.qs in the tutorial folder to see the author's solutions to the tasks.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-04-21T02:51:53.580" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17177" PostTypeId="2" ParentId="17162" CreationDate="2021-04-21T04:40:56.370" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; denote the desired unitary, i.e. &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is such that &lt;span class=&quot;math-container&quot;&gt;$UT|\sigma\rangle = TH|\sigma\rangle$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$|\sigma\rangle$&lt;/span&gt;. If two operators yield the same result on every input, then they are equal. Therefore, &lt;span class=&quot;math-container&quot;&gt;$UT=TH$&lt;/span&gt;. Finally, hit both sides with &lt;span class=&quot;math-container&quot;&gt;$T^\dagger$&lt;/span&gt; from the right to find &lt;span class=&quot;math-container&quot;&gt;$U=THT^\dagger$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-21T04:40:56.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17178" PostTypeId="1" AcceptedAnswerId="17180" CreationDate="2021-04-21T05:09:40.370" Score="1" ViewCount="49" Body="&lt;p&gt;I am vexed by a particular derivation. Given a state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; and corresponding density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi\rangle \langle \psi|$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$\rho = \begin{bmatrix} a &amp;amp; c \\ b &amp;amp; d \end{bmatrix}$&lt;/span&gt;, I can compute the Bloch sphere coordinates as the following (in Python):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  a = rho[0, 0]&#xA;  b = rho[1, 0]&#xA;  x = 2.0 * b.real&#xA;  y = 2.0 * b.imag&#xA;  z = 2.0 * a - 1.0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This code works, but - how? I fail to properly derive it. Any hints or pointers are appreciated.&lt;/p&gt;&#xA;" OwnerUserId="11582" LastEditorUserId="10480" LastEditDate="2021-04-21T14:57:48.490" LastActivityDate="2021-04-21T14:57:48.490" Title="How to get Bloch sphere Cartesian coordinates from density matrix" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17179" PostTypeId="2" ParentId="17173" CreationDate="2021-04-21T06:28:31.870" Score="7" Body="&lt;h2&gt;Too many to list&lt;/h2&gt;&#xA;&lt;p&gt;There exist uncountably many universal sets of gates. We will sketch a proof of this fact by outlining a construction of an uncountable, though by no means exhaustive, family of such sets.&lt;/p&gt;&#xA;&lt;p&gt;First, recall (e.g. from sections 4.5.2 and 4.5.3 of Nielsen &amp;amp; Chuang) that if &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt; is a set of single-qubit gates that is universal for &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, i.e. that generates a set dense in &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}\cup\{CNOT\}$&lt;/span&gt; is universal. Therefore, it suffices to exhibit an uncountable family of sets of single-qubit gates universal for &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For any irrational number &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in the interval &lt;span class=&quot;math-container&quot;&gt;$(-2, 2)$&lt;/span&gt; and any two distinct unit vectors &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{m}$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;, let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}(a,\hat{n},\hat{m})$&lt;/span&gt; consist of just two gates&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{A}(a,\hat{n},\hat{m}) = \{R_{\hat{n}}(a\pi), R_{\hat{m}}(a\pi)\}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that since &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is irrational, &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(a\pi)$&lt;/span&gt; generates a set dense in the set of all rotations around &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;. Similarly, &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{m}}(a\pi)$&lt;/span&gt; generates a set dense in the set of all rotations around &lt;span class=&quot;math-container&quot;&gt;$\hat{m}$&lt;/span&gt;. Now, &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt; is three dimensional and does not have any two dimensional subgroups, so rotations around &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat{m}$&lt;/span&gt; generate the entire &lt;span class=&quot;math-container&quot;&gt;$SU(2)$&lt;/span&gt;. In other words, any &lt;span class=&quot;math-container&quot;&gt;$U\in SU(2)$&lt;/span&gt; can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = R_{\hat{n}}(\theta_1)R_{\hat{m}}(\phi_2) R_{\hat{n}}(\theta_3) \dots R_{\hat{n}}(\phi_k)\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for some positive integer &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; (Caution: In exercise 4.11 on page 176 in Nielsen &amp;amp; Chuang it is incorrectly stated that &lt;span class=&quot;math-container&quot;&gt;$k=3$&lt;/span&gt; always). By approximating the factors in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; using elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}(a,\hat{n},\hat{m})$&lt;/span&gt; we can approximate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; arbitrarily well.&lt;/p&gt;&#xA;&lt;p&gt;Finally, there are uncountably many irrational numbers in the interval &lt;span class=&quot;math-container&quot;&gt;$(-2, 2)$&lt;/span&gt; and uncountably many different pairs of distinct unit vectors in &lt;span class=&quot;math-container&quot;&gt;$\mathbb{R}^3$&lt;/span&gt;. Therefore, there are uncountably many different universal sets &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}(a,\hat{n},\hat{m})\cup\{CNOT\}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\square$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Technically speaking, only countable collections can be put into a list, so by the arguments above a complete list of universal sets of gates does not exist.&lt;/p&gt;&#xA;&lt;h2&gt;Notable universal sets of gates&lt;/h2&gt;&#xA;&lt;p&gt;That said, there are a few notable examples of universal sets of gates:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;any set of generators of the Clifford group, such as &lt;span class=&quot;math-container&quot;&gt;$\{H, S, CNOT\}$&lt;/span&gt;, together with a non-Clifford gate, such as &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate or the Toffoli gate,&lt;/li&gt;&#xA;&lt;li&gt;Deutsch's gate, i.e. controlled-controlled-&lt;span class=&quot;math-container&quot;&gt;$iR_x(a\pi)$&lt;/span&gt;, is universal whenever &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is irrational, see exercise 4.44 on page 198 in Nielsen &amp;amp; Chuang,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt{X}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\sqrt{W}$&lt;/span&gt; and the two-qubit &lt;span class=&quot;math-container&quot;&gt;$\text{fSim}$&lt;/span&gt; gate, see sections VII E and VII F in &lt;a href=&quot;https://arxiv.org/abs/1910.11333&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; (disclosure: I'm a co-author).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;See also &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/17115/basic-gates-sets/17126&quot;&gt;this question&lt;/a&gt; for other interesting universal sets of gates.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-04-24T06:14:56.760" LastActivityDate="2021-04-24T06:14:56.760" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17180" PostTypeId="2" ParentId="17178" CreationDate="2021-04-21T06:44:17.340" Score="2" Body="&lt;p&gt;The point &lt;span class=&quot;math-container&quot;&gt;$(x, y, z)\in\mathbb{R}^3$&lt;/span&gt; corresponds to the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{I + xX + yY + zZ}2 = \frac12\begin{bmatrix}&#xA;1+z &amp;amp; x-iy \\&#xA;x+iy &amp;amp; 1-z&#xA;\end{bmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;see also &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere#Definition&quot; rel=&quot;nofollow noreferrer&quot;&gt;definition in Wikipedia&lt;/a&gt;. Therefore, if &lt;span class=&quot;math-container&quot;&gt;$\rho = \begin{bmatrix}a &amp;amp; c \\ b &amp;amp; d\end{bmatrix}$&lt;/span&gt;, then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;2a = 1 + z \\&#xA;2b = x + i y&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;x = 2\,\mathrm{Re}(b) \\&#xA;y = 2\,\mathrm{Im}(b) \\&#xA;z = 2a - 1.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-21T06:44:17.340" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17181" PostTypeId="1" AcceptedAnswerId="17182" CreationDate="2021-04-21T11:33:15.523" Score="2" ViewCount="58" Body="&lt;p&gt;For simplicity, let &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle|\psi\rangle\in\Bbb C^2\otimes\Bbb C^2$&lt;/span&gt;. I know how to compute the projective measurement &lt;span class=&quot;math-container&quot;&gt;$\{P_m\}_m$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle|\psi\rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2\otimes\Bbb C^2$&lt;/span&gt;, but I wonder how  to measure the first component of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle|\psi\rangle$&lt;/span&gt; with respect to a projective measurement &lt;span class=&quot;math-container&quot;&gt;$\{P_m\}_m$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\Bbb C^2$&lt;/span&gt;. And I also wonder will the second component collapses after the measurement? What will be the resulting state? PS. I haven't seen the explaination in N&amp;amp;C's book. A reference is also welcomed.&lt;/p&gt;&#xA;" OwnerUserId="15620" LastEditorUserId="55" LastEditDate="2021-04-21T13:23:23.250" LastActivityDate="2021-04-21T13:23:23.250" Title="How to perform a projective measurement on one component of a composite system?" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17182" PostTypeId="2" ParentId="17181" CreationDate="2021-04-21T12:08:19.383" Score="3" Body="&lt;p&gt;If you perform a local measurement &lt;span class=&quot;math-container&quot;&gt;$\{P_m\}$&lt;/span&gt; on the first system only, then the global measurement is given by the projectors &lt;span class=&quot;math-container&quot;&gt;$P_m \otimes \mathbb{I}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; is the identity matrix.&lt;/p&gt;&#xA;&lt;p&gt;Consequently, if you perform a local measurement on a &lt;em&gt;product state&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\otimes|\psi\rangle$&lt;/span&gt;, then the state of the second system is not disturbed as the post-measurement state is simply&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{(P_m \otimes \mathbb{I})( |\phi\rangle \otimes|\psi\rangle)}{\| (P_m \otimes \mathbb{I})(|\phi\rangle\otimes|\psi\rangle)\|_2} =\frac{P_m |\phi\rangle}{\|P_m |\phi\rangle\|_2} \otimes|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In constrast, if you measure an &lt;em&gt;entangled state&lt;/em&gt;, then this not true anymore. For instance, take the well-known 2-qubit Bell state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\phi^+\rangle = \frac{1}{\sqrt 2} \big( | 00 \rangle + | 11 \rangle \big).&#xA;$$&lt;/span&gt;&#xA;Measuring the first system in the computational basis will collapse this either into &lt;span class=&quot;math-container&quot;&gt;$| 00 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$| 11\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt; each. Thus, the (reduced) state of the second system depends on the outcome of the measurement on the first one.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastActivityDate="2021-04-21T12:08:19.383" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17183" PostTypeId="1" AcceptedAnswerId="17185" CreationDate="2021-04-21T12:12:11.543" Score="2" ViewCount="42" Body="&lt;p&gt;Let us consider a protocol between Alice and Bob. Alice works in a &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;-dimensional Hilbert space &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_A$&lt;/span&gt;, using &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits. Bob works in a &lt;span class=&quot;math-container&quot;&gt;$(1+2^n)$&lt;/span&gt;-dimensional Hilbert space using qdits. For instance, for &lt;span class=&quot;math-container&quot;&gt;$n=128$&lt;/span&gt;, Bob would work with two high-dimensional qdits, since &lt;span class=&quot;math-container&quot;&gt;$1+2^{128}$&lt;/span&gt; is the product of two large primes.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_B$&lt;/span&gt; is isomorphic to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n+1}$&lt;/span&gt;, it is possible to write any state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_{\mathcal{H}_B}\in\mathcal{H}_B$&lt;/span&gt; as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle_{\mathcal{H}_B}=\sum_{i=0}^{2^n}\psi_i|i\rangle_{\mathcal{H}_B}\,.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let us say that Alice prepares the following state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi\rangle_{\mathcal{H}_A} = \sum_{i=0}^{2^n-1}\varphi_i|i\rangle_{\mathcal{H}_A}$$&lt;/span&gt;&#xA;and sends it to Bob. Now, Bob wants to transform this state into:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\varphi\rangle_{\mathcal{H}_B} = \sum_{i=0}^{2^n-1}\varphi_i|i\rangle_{\mathcal{H}_B}+0\left|2^n\right\rangle_{\mathcal{H}_B}$$&lt;/span&gt;&#xA;and to apply an unitary matrix &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_{\mathcal{H}_B}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_{\mathcal{H}_B}\left|2^n\right\rangle_{\mathcal{H}_B}=\left|2^n\right\rangle_{\mathcal{H}_B}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_{\mathcal{H}_B}^\dagger\left|2^n\right\rangle_{\mathcal{H}_B}=\left|2^n\right\rangle_{\mathcal{H}_B}$&lt;/span&gt; (that is, &lt;span class=&quot;math-container&quot;&gt;$\mathbf{U}_{\mathcal{H}_B}$&lt;/span&gt; does not add the &lt;span class=&quot;math-container&quot;&gt;$\left|2^n\right\rangle_{\mathcal{H}_B}$&lt;/span&gt; state in the superposition for any other state and is defined as the identity for this state). This would transform the state in :&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{U}_{\mathcal{H}_B}|\varphi\rangle_{\mathcal{H}_B}=\sum_{i=0}^{2^n-1}\alpha_i|i\rangle_{\mathcal{H}_B}\,.$$&lt;/span&gt;&#xA;Finally, Bob transforms back this quantum state into a &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum state and sends it back to Alice.&lt;/p&gt;&#xA;&lt;p&gt;Does this make sense? Is it possible to consider such a protocol, where one converts a quantum state lying in an Hilbert space to one in another Hilbert space?&lt;/p&gt;&#xA;" OwnerUserId="10454" LastActivityDate="2021-04-21T13:25:35.990" Title="Is it possible to perform quantum computation between different Hilbert spaces?" Tags="&lt;quantum-state&gt;&lt;physical-realization&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17184" PostTypeId="1" AcceptedAnswerId="17190" CreationDate="2021-04-21T12:42:48.940" Score="4" ViewCount="44" Body="&lt;p&gt;When talks about &lt;a href=&quot;https://en.wikipedia.org/wiki/CHSH_inequality&quot; rel=&quot;nofollow noreferrer&quot;&gt;CHSH inequality&lt;/a&gt;, we always say that the states that violate the inequality are entangled, while some states that do not violate the inequality can also be entangled.&lt;/p&gt;&#xA;&lt;p&gt;For the latter case, &lt;em&gt;i.e.&lt;/em&gt; for those states which are entangled but do not violate the inequality, we can find a local hidden variable model to describe them.&lt;/p&gt;&#xA;&lt;p&gt;Is there some specific example to construct such a model and describe how the inequality is holding while the state is entangled?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-22T12:37:27.117" LastActivityDate="2021-04-22T12:37:27.117" Title="What is an example of an entangled state whose correlations are describable with a local hidden variable model?" Tags="&lt;entanglement&gt;&lt;non-locality&gt;&lt;bell-experiment&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17185" PostTypeId="2" ParentId="17183" CreationDate="2021-04-21T13:25:35.990" Score="3" Body="&lt;p&gt;An &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-level quantum system is an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-level quantum system, no matter if it's stored on &lt;span class=&quot;math-container&quot;&gt;$\lceil \log_2 n \rceil$&lt;/span&gt; qubits or on &lt;span class=&quot;math-container&quot;&gt;$\lceil \log_3 n \rceil$&lt;/span&gt; qutrits or other combinations of qudits.&lt;/p&gt;&#xA;&lt;p&gt;There would be costs to interoperating computers that use qudits with different numbers of levels, because you have to do work to convert between them (e.g. having to run iterated long division under superposition to convert from binary to ternary, or wasting space on one to make conversion unnecessary by avoiding using the higher qudit levels that are not available on the other), but there's no &lt;em&gt;fundamental&lt;/em&gt; barrier to interoperating them.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-21T13:25:35.990" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17186" PostTypeId="2" ParentId="17174" CreationDate="2021-04-21T13:51:02.503" Score="4" Body="&lt;p&gt;This is not possible. If you're not using a quantum algorithm, but just the quantum hardware, then the thing is hardly a quantum computer, you're just talking about a faster architecture for classical computing. Which is of course interesting, but not quantum. And furthermore classical computing architectures have been researched for decades to the tune of tens of billions of dollars. It is difficult to come up with something better.&lt;/p&gt;&#xA;&lt;p&gt;Also, keep in mind that existing quantum hardware is rather slow - the clock rate of Google and IBM's devices is on the order of MHz, whereas classical hardware routinely runs at GHz speed.&lt;/p&gt;&#xA;&lt;p&gt;Now, of course you could use dedicated hardware that is only good for some specific functions, and is not Turing-complete. That is known as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Analog_computer&quot; rel=&quot;nofollow noreferrer&quot;&gt;analog computer&lt;/a&gt;, and they are sometimes useful. But again, if that is not running a quantum algorithm it is hardly quantum hardware. Remember that &amp;quot;classical&amp;quot; chips are still made of atoms and have electrons going around them.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-04-21T13:51:02.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17187" PostTypeId="1" AcceptedAnswerId="17194" CreationDate="2021-04-21T14:27:26.590" Score="3" ViewCount="85" Body="&lt;p&gt;I have followed &lt;a href=&quot;https://juliaphysics.github.io/PhysicsTutorials.jl/tutorials/general/quantum_ising/quantum_ising.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; tutorial and based on it, I've written the following function in qiskit, which can explicitly calculate the ground states of a transverse-field Ising Hamiltonian.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;import numpy as np&#xA;&#xA;def Hamiltonian(n,h):&#xA;    pow_n=2**n&#xA;    qc = np.empty(2*n-1, dtype=object)&#xA;    #Creating the quantum circuits that are used in the calculation of the Hamiltonian based on the number of qubits&#xA;    for i in range(0, 2*n-1): #2n-1 is the number of factors on the n-site Hamiltonian&#xA;        qr = QuantumRegister(n) &#xA;        qc[i] = QuantumCircuit(qr) #create quantum circuits for each factor of the Hamiltonian&#xA;        #print(i)&#xA;        if (i&amp;lt;=n-2): #for the first sum of the Hamiltonian&#xA;            qc[i].z(i) #value of current spin&#xA;            qc[i].z(i+1) #and value of its neighboring spin&#xA;        else: #for the second sum of the Hamiltonian&#xA;            qc[i].x(2*n-2-i) #2*n-2 gives the proper index since counting starts at 0&#xA;    #Run each circuit in the simulator        &#xA;    simulator = Aer.get_backend('unitary_simulator')&#xA;    result = np.empty(2*n-1, dtype=object) &#xA;    unitary = np.empty(2*n-1, dtype=object) &#xA;    Hamiltonian_Matrix=0&#xA;    #Get the results for each circuit in unitary form&#xA;    for i in range(0, 2*n-1):&#xA;        result[i] = execute(qc[i], backend=simulator).result()&#xA;        unitary[i] = result[i].get_unitary()&#xA;        #print(unitary[i])&#xA;        #And calculate the Hamiltonian matrix according to the formula&#xA;        if (i&amp;lt;=n-2):&#xA;            Hamiltonian_Matrix=np.add(Hamiltonian_Matrix,-unitary[i])&#xA;        else:&#xA;            Hamiltonian_Matrix=np.add(Hamiltonian_Matrix,-h*unitary[i])&#xA;    print(&amp;quot;The&amp;quot;,pow_n,&amp;quot;x&amp;quot;,pow_n, &amp;quot;Hamiltonian Matrix is:&amp;quot;)&#xA;    print(Hamiltonian_Matrix)&#xA;    #Now that we have the Hamiltonian&#xA;    &#xA;    #find the eigenvalues and eigenvectors&#xA;    w, v = np.linalg.eig(Hamiltonian_Matrix)&#xA;    print(&amp;quot;Eigenvectors&amp;quot;)&#xA;    print(v)&#xA;    print(&amp;quot;Eigenvalues&amp;quot;)&#xA;    print(w)&#xA;    minimum=w[0]&#xA;    min_spot=0&#xA;    for i in range(1, pow_n):&#xA;        if w[i]&amp;lt;minimum:&#xA;            min_spot=i&#xA;            minimum=w[i]                   &#xA;    print(min_spot)&#xA;    groundstate = v[:,min_spot]&#xA;    #the probability to measure each basic state of n qubits&#xA;    probability = np.square(groundstate).real&#xA;    print(&amp;quot;The probability for each of the&amp;quot;,pow_n,&amp;quot;base states is:&amp;quot;)&#xA;    print(probability)&#xA;    print(&amp;quot;The probabilities for each of the&amp;quot;,pow_n,&amp;quot;base states add up to:&amp;quot;)&#xA;    print (&amp;quot;%.2f&amp;quot; % np.sum(probability))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My problem with this piece of code I've written is that it can only run on a unitary simulator. To my understanding (which may lack some of the underlying physics), the Hamiltonian itself is not a &amp;quot;purely&amp;quot; quantum calculation, since there are additions to be made which cannot be expressed with a quantum (unitary) gate, and this is why the resulting Hamiltonian matrix is also not unitary. For example, if you run Hamiltonian(3, 1), the Hamiltonian matrix is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[-2.+0.j -1.+0.j -1.+0.j  0.+0.j -1.+0.j  0.+0.j  0.+0.j  0.+0.j]&#xA; [-1.+0.j  0.+0.j  0.+0.j -1.+0.j  0.+0.j -1.+0.j  0.+0.j  0.+0.j]&#xA; [-1.+0.j  0.+0.j  2.+0.j -1.+0.j  0.+0.j  0.+0.j -1.+0.j  0.+0.j]&#xA; [ 0.+0.j -1.+0.j -1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j -1.+0.j]&#xA; [-1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j -1.+0.j -1.+0.j  0.+0.j]&#xA; [ 0.+0.j -1.+0.j  0.+0.j  0.+0.j -1.+0.j  2.+0.j  0.+0.j -1.+0.j]&#xA; [ 0.+0.j  0.+0.j -1.+0.j  0.+0.j -1.+0.j  0.+0.j  0.+0.j -1.+0.j]&#xA; [ 0.+0.j  0.+0.j  0.+0.j -1.+0.j  0.+0.j -1.+0.j -1.+0.j -2.+0.j]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Does this mean that there is no way for this approach to run on a real quantum computer where all you can do is measurements on the qubits? I've seen different approaches online such as &lt;a href=&quot;https://quantumai.google/cirq/tutorials/educators/qaoa_ising#exercise_transverse_field_ising_model&quot; rel=&quot;nofollow noreferrer&quot;&gt;QAOA&lt;/a&gt; or &lt;a href=&quot;https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/awards/teach_me_qiskit_2018/exact_ising_model_simulation/Ising_time_evolution.ipynb&quot; rel=&quot;nofollow noreferrer&quot;&gt;the use of transformations&lt;/a&gt;, but I thought if it's so easy to do it with unitaries and some additions, there should be a way to do it with measurements as well.&lt;/p&gt;&#xA;" OwnerUserId="15569" LastEditorUserId="55" LastEditDate="2021-04-22T16:22:06.530" LastActivityDate="2021-04-22T16:22:06.530" Title="Calculating the ground states of an Ising Hamiltonian on a real quantum computer" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;hamiltonian-simulation&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17190" PostTypeId="2" ParentId="17184" CreationDate="2021-04-21T15:43:37.920" Score="4" Body="&lt;p&gt;It's easy to generate such a model for specific cases. For example, take the maximally entangled state &lt;span class=&quot;math-container&quot;&gt;$|\phi^+\rangle = \frac1{\sqrt2} (|00\rangle + |11\rangle)$&lt;/span&gt;, and let the observables in the CHSH inequality be &lt;span class=&quot;math-container&quot;&gt;$A_0=B_1=Z$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$A_1=B_0=X$&lt;/span&gt;. Now if Alice and Bob measure in the same basis, they'll get results that are random but equal with probability 1, and if they measure in different bases they'll get completely random and uncorrelated results. This will give you a CHSH value equal to 2, so they don't violate it.&lt;/p&gt;&#xA;&lt;p&gt;These are all the features of the state you can get by measuring these observables, so this is all you need to reproduce with your local hidden variable model. A model that does it consists of sending two bits to Alice and two bits to Bob, correlated such that the only possible pairs are&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{gather*}&#xA;(0,0) \quad\text{and}\quad (0,0) \\&#xA;(0,1) \quad\text{and}\quad (0,1) \\&#xA;(1,0) \quad\text{and}\quad (1,0) \\&#xA;(1,1) \quad\text{and}\quad (1,1),&#xA;\end{gather*}&lt;/span&gt;&#xA;and each line is sent with probability &lt;span class=&quot;math-container&quot;&gt;$1/4$&lt;/span&gt;. In each line, the first pair is the one sent to Alice and the second one sent to Bob, and the first bit of the par encodes the result of a measurement in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, and the second in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; basis.&lt;/p&gt;&#xA;&lt;p&gt;In general, if some correlation satisfies all the Bell inequalities in a given scenario, then it has a local hidden variable model, and there's an algorithm to construct it. Conversely, if you can find a local hidden variable model for a correlation that proves that it satisfies all the Bell inequalities for the scenario.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-04-21T15:43:37.920" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17191" PostTypeId="2" ParentId="17111" CreationDate="2021-04-21T15:56:36.357" Score="1" Body="&lt;p&gt;The resolution is essentially down to just global phases. Let us note that the initial state is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix}&#xA;\tilde a \\ \tilde b&#xA;\end{bmatrix}=\frac{1}{2}\begin{bmatrix}&#xA;1+i \\ 1-i&#xA;\end{bmatrix}\equiv \frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ -i \end{bmatrix}.&#xA;$$&lt;/span&gt;&#xA;In other words, this is just an eigenstate of &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;. So, we we evolve under the Pauli &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; matrix, we only get a global phase (so who cares if it's rapidly oscillating?!)&lt;/p&gt;&#xA;&lt;p&gt;Thus, at any later time,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{bmatrix} a \\ b \end{bmatrix}=\begin{bmatrix} e^{-i2\epsilon t} \\ -i e^{i2\epsilon t} \end{bmatrix}.&#xA;$$&lt;/span&gt;&#xA;For the target time of &lt;span class=&quot;math-container&quot;&gt;$t=\pi/8\epsilon$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ 1 \end{bmatrix},&#xA;$$&lt;/span&gt;&#xA;which is exactly what we expected (this is the representation of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; in the &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; basis).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-21T15:56:36.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17192" PostTypeId="1" CreationDate="2021-04-21T16:20:39.830" Score="1" ViewCount="32" Body="&lt;p&gt;I am doing a VQE in Cirq, but sometimes I get this error while running steps of the classical optimization loop:&#xA;State_vector is not normalized instead had norm 1.0000000010132789&#xA;And therefore the program interrupts.&lt;/p&gt;&#xA;&lt;p&gt;Is there anything I can do to avoid this? Because my state should be normalized the way I constructed the circuit.&lt;/p&gt;&#xA;" OwnerUserId="13353" LastEditorUserId="55" LastEditDate="2021-04-22T16:25:38.140" LastActivityDate="2021-04-22T16:25:38.140" Title="How to avoid Cirq: State_vector is not normalized error for Feedback-loop in optimizer?" Tags="&lt;programming&gt;&lt;cirq&gt;" AnswerCount="0" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17193" PostTypeId="1" AcceptedAnswerId="17196" CreationDate="2021-04-21T17:13:50.467" Score="2" ViewCount="71" Body="&lt;p&gt;say I have some state in the combined space &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; ∈ &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\psi=U_A \otimes U_B|0,0\rangle$&lt;/span&gt; (operators from respective spaces), and &lt;span class=&quot;math-container&quot;&gt;$\rho_A, \rho_B$&lt;/span&gt; the respective density matrices.&lt;/p&gt;&#xA;&lt;p&gt;Is the following statement true:&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \langle\psi|$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\rho_A \otimes \rho_B$&lt;/span&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;If yes, how can I show it? Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="15621" LastEditorUserId="55" LastEditDate="2021-04-22T12:59:50.490" LastActivityDate="2021-04-22T12:59:50.490" Title="Given $|\psi\rangle=(U_A\otimes U_B)|0,0\rangle$, is $|\psi\rangle\!\langle\psi|$ always a product state?" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17194" PostTypeId="2" ParentId="17187" CreationDate="2021-04-21T17:36:49.910" Score="4" Body="&lt;p&gt;You can definitely run this on a real quantum computer! In your snippet above you mixed circuits and operators. A circuit is only used for the ansatz of your ground state, not for representing the operators.&lt;/p&gt;&#xA;&lt;p&gt;The website you provided talks about the Hamiltonian in terms of the Pauli X and Z matrices; &lt;span class=&quot;math-container&quot;&gt;$\hat\sigma^x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat\sigma^z$&lt;/span&gt;. If you want to compute the ground state of your Hamiltonian you need to use this Pauli representation and not convert them into a matrix.&lt;/p&gt;&#xA;&lt;p&gt;Here's a short example you can generalize to your above case. Say we the transverse field Ising chain, but to simplify things, we assume only two sites. Then we can write the Hamiltonian as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat H = -\hat\sigma^z_0 \otimes \hat\sigma^z_1 - h(\hat\sigma^x_0  + \hat\sigma^x_1).&#xA;$$&lt;/span&gt;&#xA;Now we associate each site with a qubit and then we can write the above matrix in a one-to-one correspondence in Qiskit (I'm using Qiskit 0.25.0):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# opflow is Qiskit's module for creating operators like yours&#xA;from qiskit.opflow import Z, X, I  # Pauli Z, X matrices and identity&#xA;&#xA;h = 0.25  # or whatever value you have for h&#xA;H = -(Z ^ Z) - h * ((X ^ I) + (I ^ X))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;^&lt;/code&gt; in Qiskit means we're using a tensor product. Also note that I've expanded the notation &lt;span class=&quot;math-container&quot;&gt;$\hat\sigma^x_0$&lt;/span&gt; to &lt;code&gt;X ^ I&lt;/code&gt; since we act on two qubits and by&#xA;&lt;span class=&quot;math-container&quot;&gt;$\hat\sigma^x_0$&lt;/span&gt; implicitly mean that nothing happens to the second qubit.&lt;/p&gt;&#xA;&lt;p&gt;Now you can go ahead and use this representation of the Hamiltonian to run on a real quantum computer. If you want to compute the ground state using Qiskit, you can use the &lt;code&gt;VQE&lt;/code&gt; class. To run that you also need to select an ansatz and an optimizer, but that's very easy in Qiskit. For instance&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import QasmSimulator  &#xA;from qiskit.algorithms import VQE&#xA;from qiskit.algorithms.optimizers import COBYLA &#xA;from qiskit.circuit.library import EfficientSU2&#xA;&#xA;# you can swap this for a real quantum device and keep the rest of the code the same!&#xA;backend = QasmSimulator() &#xA;&#xA;# COBYLA usually works well for small problems like this one&#xA;optimizer = COBYLA(maxiter=200)&#xA;&#xA;# EfficientSU2 is a standard heuristic chemistry ansatz from Qiskit's circuit library&#xA;ansatz = EfficientSU2(2, reps=3)&#xA;&#xA;# set the algorithm&#xA;vqe = VQE(ansatz, optimizer, quantum_instance=backend)&#xA;&#xA;# run it with the Hamiltonian we defined above&#xA;result = vqe.compute_minimum_eigenvalue(H)  &#xA;&#xA;# print the result (it contains lot's of information)&#xA;print(result) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will simulate the quantum computer but you can run exactly the same piece of code on real hardware by changing the &lt;code&gt;backend&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On a real device, each of the Hamiltonian summands, &lt;span class=&quot;math-container&quot;&gt;$\sigma^z_0 \otimes \hat\sigma^z_1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\hat\sigma^x_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\hat\sigma^x_1$&lt;/span&gt;, will in general be measured individually. That is because we can only measure the expectation value of an operator, that is diagonal in the computational basis (in the Z-basis). Thus, we need to apply basis transformations to the terms that are not already diagonal (in this case the Pauli-X terms).&lt;/p&gt;&#xA;&lt;p&gt;If you want to know more about this I would suggest you to have a look at the &lt;a href=&quot;https://qiskit.org/textbook/preface.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit textbook&lt;/a&gt; or &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/16608/vqe-how-to-get-from-expectation-value-to-eigenvalue&quot;&gt;this stackoverflow question&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="15569" LastEditDate="2021-04-22T11:32:59.640" LastActivityDate="2021-04-22T11:32:59.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17195" PostTypeId="1" AcceptedAnswerId="17379" CreationDate="2021-04-21T18:43:40.100" Score="1" ViewCount="122" Body="&lt;p&gt;I'm studying the HHL algorithm and I'm trying to do an his implementation but, there are some points that I don't understand how I can transform my hermitian Matrix into its unitary operator?&lt;/p&gt;&#xA;&lt;p&gt;In Qiskit textbook I found &lt;a href=&quot;https://i.stack.imgur.com/Zm5LJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; explanation about HHL algorithm.&#xA;It says that after load the input data, we have to do QPE, but for QPE I need to transform my matrix A into &lt;span class=&quot;math-container&quot;&gt;$e^{iAt}$&lt;/span&gt;, how can I do that? The textbook doesn't explain.&lt;/p&gt;&#xA;&lt;p&gt;Re-edit:I start with the first question and I use an example.&#xA;I know that every hermitian matrix could be written as &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}$&lt;/span&gt;, using Pauli Gates.&#xA;If I have the following matrix &lt;span class=&quot;math-container&quot;&gt;$ A=\begin{bmatrix} 1&amp;amp;-\frac{1}{3}\\  -\frac{1}{3}&amp;amp;1\\ \end{bmatrix}$&lt;/span&gt;, I can write it as &lt;span class=&quot;math-container&quot;&gt;$A=-\frac{1}{3}X+\mathbb{1} $&lt;/span&gt;, so the exponential matrix is  &lt;span class=&quot;math-container&quot;&gt;$e^{-iAt}=e^{-i(-\frac{1}{3}X+\mathbb{1})t}=e^{-i(-\frac{1}{3}X)t}e^{-i(\mathbb{1})t}$&lt;/span&gt;, I can write the last equality because the two operator commute. I want to write this in terms of gates, following the instruciton of previous posts I can write  the term &lt;span class=&quot;math-container&quot;&gt;$e^{-i(\mathbb{1})t}$&lt;/span&gt; as U1(-t) on control qubit. For &lt;span class=&quot;math-container&quot;&gt;$e^{-i(-\frac{1}{3}X)t}$&lt;/span&gt;, I know that &lt;span class=&quot;math-container&quot;&gt;$e^{-i(X)t}$&lt;/span&gt; is equal to &lt;span class=&quot;math-container&quot;&gt;$HR_z(2t)H$&lt;/span&gt;,so, in my case, I can write &lt;span class=&quot;math-container&quot;&gt;$e^{-i(-\frac{1}{3}X)t}=HR_z(-2\frac{t}{3})H$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I tried to implement in qiskit the circuit, I find 100% of probability to have |11&amp;gt;, but I expect to have 100% of probability to have |10&amp;gt;, what am I doing wrong?&lt;/p&gt;&#xA;&lt;p&gt;This is my code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;t=2*np.pi*3/8&#xA;qpe = QuantumCircuit(3, 2)&#xA;qpe.h(2) #inizializzo il vettore (1,1) con H gate&#xA;for qubit in range(2):&#xA;    qpe.h(qubit)     #applico H gate ai control bit&#xA;repetitions = 1&#xA;for counting_qubit in range(2):&#xA;    for i in range(repetitions):&#xA;        qpe.p(-t,counting_qubit)&#xA;        qpe.h(2)&#xA;        qpe.crz(-2/3*t,counting_qubit,2)&#xA;        qpe.h(2)&#xA;        repetitions *= 2&#xA;qpe.barrier();&#xA;qpe.draw()&#xA;&#xA;def qft_dagger(qc, n):&#xA;    &amp;quot;&amp;quot;&amp;quot;n-qubit QFTdagger the first n qubits in circ&amp;quot;&amp;quot;&amp;quot;&#xA;    # Don't forget the Swaps!&#xA;    for qubit in range(n//2):&#xA;        qc.swap(qubit, n-qubit-1)&#xA;    for j in range(n):&#xA;        for m in range(j):&#xA;            qc.cp(-math.pi/float(2**(j-m)), m, j)&#xA;        qc.h(j)&#xA;&#xA;# Apply inverse QFT&#xA;qft_dagger(qpe, 2)&#xA;#Measure&#xA;qpe.barrier()&#xA;for n in range(2):&#xA;    qpe.measure(n,n)&#xA;qpe.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My circuit&#xA;&lt;a href=&quot;https://i.stack.imgur.com/mbWpJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/mbWpJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;My result on simulator&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/lKI0x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/lKI0x.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Re-edit: I noticed that if I remove the minus sign to the gates, the result is correct, but I don't understand why&lt;/p&gt;&#xA;" OwnerUserId="15624" LastEditorUserId="15624" LastEditDate="2021-04-27T12:36:40.127" LastActivityDate="2021-05-06T23:28:15.487" Title="In the HHL alghoritm, how can I transform my hermitian matrix into a unitary operator?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17196" PostTypeId="2" ParentId="17193" CreationDate="2021-04-21T18:53:25.803" Score="4" Body="&lt;p&gt;Suppose that &lt;span class=&quot;math-container&quot;&gt;$U_A |0\rangle = |\psi_A \rangle = \begin{pmatrix}A_1 \\ A_2 \end{pmatrix}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U_B |0\rangle = |\psi_B\rangle = \begin{pmatrix} B_1 \\ B_2 \end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then we have &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = (U_A \otimes U_B) |00\rangle =(U_A \otimes U_B) (|0\rangle \otimes 0\rangle ) = U_A|0\rangle \otimes U_B|0\rangle = |\psi_A\rangle \otimes |\psi_B\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can also write &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \begin{pmatrix}A_1 \\ A_2 \end{pmatrix} \otimes \begin{pmatrix}B_1 \\ B_2 \end{pmatrix} = \begin{pmatrix}A_1B_1 \\ A_1B_2 \\ A_2B_1 \\ A_2B_2\end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and hence &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \langle \psi|$&lt;/span&gt; is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$  \begin{pmatrix}A_1B_1 \\ A_1B_2 \\ A_2B_1 \\ A_2B_2\end{pmatrix}  \begin{pmatrix} A_1^*B_1^* &amp;amp; A_1^*B_2^* &amp;amp; A_2^*B_1^* &amp;amp; A_2^*B_2^* \end{pmatrix} =  &#xA;\begin{pmatrix} &#xA;|A_1|^2 |B_1|^2 &amp;amp; |A_1|^2B_1B_2^* &amp;amp; A_1A_2^*|B_1|^2  &amp;amp; A_1A_2^*B_1B_2^* \\ &#xA;|A_1|^2 B_2B_1^* &amp;amp; |A_1|^2|B_2|^2 &amp;amp; A_1A_2^*B_2B_1^*  &amp;amp; |A_2|^2|B_2|^2 \\ &#xA;A_2A_1^* |B_1|^2 &amp;amp; A_2A_1^*B_1B_2^* &amp;amp; |A_2|^2|B_1|^2  &amp;amp; |A_2|^2B_1B_2^* \\ &#xA;A_1^*A_2 B_1^*B_2 &amp;amp; A_2A_1^* |B_2|^2 &amp;amp; |A_2|^2B_2B_1^*  &amp;amp; |A_2|^2 |B_2|^2 \\ \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, we also have that &lt;span class=&quot;math-container&quot;&gt;$\rho_A = |\psi_A \rangle \langle \psi_A | $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B = |\psi_B \rangle \langle \psi_B| $&lt;/span&gt; so therefore&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_A =  \begin{pmatrix} |A_1|^2  &amp;amp; A_1 A_2^*\\ A_2 A_1^* &amp;amp; |A_2|^2 \end{pmatrix} \hspace{1 cm} \rho_B =  \begin{pmatrix} |B_1|^2  &amp;amp; B_1 B_2^*\\ B_2 B_1^* &amp;amp; |B_2|^2 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and therefore,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho_A \otimes \rho_B =  \begin{pmatrix} |A_1|^2  &amp;amp; A_1 A_2^*\\ A_2 A_1^* &amp;amp; |A_2|^2 \end{pmatrix}   \otimes  \begin{pmatrix} |B_1|^2  &amp;amp; B_1 B_2^*\\ B_2 B_1^* &amp;amp; |B_2|^2 \end{pmatrix}  = \begin{pmatrix} &#xA;|A_1|^2 |B_1|^2 &amp;amp; |A_1|^2B_1B_2^* &amp;amp; A_1A_2^*|B_1|^2  &amp;amp; A_1A_2^*B_1B_2^* \\ &#xA;|A_1|^2 B_2B_1^* &amp;amp; |A_1|^2|B_2|^2 &amp;amp; A_1A_2^*B_2B_1^*  &amp;amp; |A_2|^2|B_2|^2 \\ &#xA;A_2A_1^* |B_1|^2 &amp;amp; A_2A_1^*B_1B_2^* &amp;amp; |A_2|^2|B_1|^2  &amp;amp; |A_2|^2B_1B_2^* \\ &#xA;A_1^*A_2 B_1^*B_2 &amp;amp; A_2A_1^* |B_2|^2 &amp;amp; |A_2|^2B_2B_1^*  &amp;amp; |A_2|^2 |B_2|^2 \\ \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And therefore, &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle \langle \psi |= \rho_A  \otimes  \rho_B$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-21T18:53:25.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17197" PostTypeId="2" ParentId="9697" CreationDate="2021-04-21T20:58:53.353" Score="1" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2011.09495&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gilyén and Vazirani&lt;/a&gt;, building on the recent breakthrough of &lt;a href=&quot;https://arxiv.org/abs/2005.03791&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hastings&lt;/a&gt;, give a (sub)-exponential separation for a quantum adiabatic algorithm  with no sign problem.  They design a graph that can be traversed easily with a quantum adiabatic algorithm but gets stuck in a bunch of dead ends classically, and further can't recognize when it's walking around in a loop.  That is, their graph was specifically designed to frustrate classical algorithms.&lt;/p&gt;&#xA;&lt;p&gt;They hint that the quantum improvement comes from (A) topological properties of the graph, (B) as well as &lt;span class=&quot;math-container&quot;&gt;$\ell_1$&lt;/span&gt; sampling classically vs. &lt;span class=&quot;math-container&quot;&gt;$\ell_2$&lt;/span&gt; sampling quantumly.  See &lt;a href=&quot;https://www.youtube.com/watch?v=-dcrX76zZ3M&amp;amp;list=WL&amp;amp;index=10&amp;amp;t=836s&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; for a nice video.&lt;/p&gt;&#xA;&lt;p&gt;To my naivety, neither the topological properties of the graph nor the difference in &lt;span class=&quot;math-container&quot;&gt;$\ell_2$&lt;/span&gt; vs. &lt;span class=&quot;math-container&quot;&gt;$\ell_1$&lt;/span&gt; sampling appear to have much to do with the kind of structure at play in Shor's algorithm.&lt;/p&gt;&#xA;&lt;p&gt;Some caveats/notes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;They base their construction heavily on the &amp;quot;welded-trees&amp;quot; random walk of &lt;a href=&quot;https://arxiv.org/abs/0810.0312&quot; rel=&quot;nofollow noreferrer&quot;&gt;Childs, et al.&lt;/a&gt;, which gives an exponential speedup of an oracle problem;&lt;/li&gt;&#xA;&lt;li&gt;They compare the &lt;em&gt;quantum adiabatic algorithm&lt;/em&gt; to a classical algorithm and count the number of queries performed by the classical algorithm, and so it's not quite a quantum-query vs. classical-query comparison; and&lt;/li&gt;&#xA;&lt;li&gt;There's a lot of implication that such adiabatic algorithms with no sign problem are &lt;em&gt;not&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\mathsf{BQP}$&lt;/span&gt;-complete, and hence are not a universal model of quantum computation.  So even a weakened model of quantum computation can still give (sub)-exponential speedups in a query model.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I really like how haphazard their FIG. 1 looks - there's no structure that jumps out!&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Dd4Rh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Dd4Rh.png&quot; alt=&quot;FIG. 1 of Gilyen Vazirani&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-04-21T20:58:53.353" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17198" PostTypeId="1" AcceptedAnswerId="17240" CreationDate="2021-04-22T03:01:08.883" Score="8" ViewCount="143" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/1006.4368.pdf&quot; rel=&quot;noreferrer&quot;&gt;This paper&lt;/a&gt; is a paper in 2012 and cited by a lot of papers. And there does not exist comment in arxiv or error statement in PRA. But when I reading this paper, I think the right part of the eq(23) should be &lt;span class=&quot;math-container&quot;&gt;$2M+(N-M)(N-M+2)$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$M+(N-M)(N-M+2)$&lt;/span&gt;. Is there someone who happens to read this paper, so he or she can tell me if this place is truly an error or just my misunderstanding?&lt;br /&gt;&#xA;My reasoning based on two methods, the first method is to get the contradiction, the second method is to show my proof.&lt;br /&gt;&#xA;&lt;strong&gt;Contradiction:&lt;/strong&gt; Right below the eq(24), he stated:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Any state that violates Eq.(23) has fewer than &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; unentangled particles.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;And the state below Eq.(29) shows that the state &lt;span class=&quot;math-container&quot;&gt;$\mid 1\rangle \bigotimes\mid D_{N-1}^{N/2-1}\rangle$&lt;/span&gt; has Quantum Fisher Information &lt;span class=&quot;math-container&quot;&gt;$(\frac{N^2}{2}+\frac{1}{2},\frac{N^2}{2}+\frac{1}{2},0)$&lt;/span&gt;,corresponding to three Quantum Firsher Information components, so the total Quantum Fisher Information is &lt;span class=&quot;math-container&quot;&gt;$N^2+1$&lt;/span&gt;, which violate the &lt;span class=&quot;math-container&quot;&gt;$M+(N-M)(N-M+2)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$M=1$&lt;/span&gt;. But we know &lt;span class=&quot;math-container&quot;&gt;$\mid 1\rangle \bigotimes\mid D_{N-1}^{N/2-1}\rangle$&lt;/span&gt; is not the state which has fewer than &lt;span class=&quot;math-container&quot;&gt;$M(M=1)$&lt;/span&gt; unentangled particles.&lt;br /&gt;&#xA;&lt;br&gt;&#xA;&lt;strong&gt;My Proof:&lt;/strong&gt; Just like the skill he used in the first equation in Eq.(20), i.e.,&lt;span class=&quot;math-container&quot;&gt;$$\sum_{l=x,y,z}(\Delta J_l)^2_{\mid\psi_{k-producible}\rangle}=\sum_m\sum_{l=x,y,z}(\Delta J_l)^2_{\mid\psi_{m}\rangle}.$$&lt;/span&gt; That is, change the total sum to the product part sum, &lt;span class=&quot;math-container&quot;&gt;$\mid\psi_{k-producible}\rangle=\mid\psi_1^{(N_1)}\rangle\bigotimes\mid\psi_2^{(N_2)}\rangle\bigotimes...$&lt;/span&gt;(his Eq.(18)) .&lt;br /&gt;&#xA;So what I do here, is combine the Observation 1, i.e., &lt;span class=&quot;math-container&quot;&gt;$\sum_{l=x,y,z}F_Q[\rho,J_l]\le 2N$&lt;/span&gt; and observation 2, i.e., &lt;span class=&quot;math-container&quot;&gt;$\sum_{l=x,y,z}F_Q[\rho,J_l]\le N(N+2)$&lt;/span&gt;, change the variable &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; in the first inequality(&lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt;) to &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, and the variable &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; in the second inequality(&lt;span class=&quot;math-container&quot;&gt;$N(N+2)$&lt;/span&gt;) to &lt;span class=&quot;math-container&quot;&gt;$N-M$&lt;/span&gt;, we get the inequality in Eq.(23), but just &lt;span class=&quot;math-container&quot;&gt;$2M$&lt;/span&gt;  instead of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="13968" LastEditDate="2021-05-27T15:32:37.920" LastActivityDate="2021-05-27T15:32:37.920" Title="Error in the Toth's 2012 paper: &quot;Multipartite entanglement and high-precision metrology&quot;?" Tags="&lt;entanglement&gt;&lt;entanglement-witness&gt;&lt;quantum-fisher-information&gt;&lt;quantum-metrology&gt;&lt;paper-error&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17199" PostTypeId="1" CreationDate="2021-04-22T03:01:33.887" Score="2" ViewCount="43" Body="&lt;p&gt;Consider  two qubits&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi_1 \right&amp;gt; = \alpha \left|0\right&amp;gt; + \beta \left|1\right&amp;gt;$$&lt;/span&gt;  and &lt;span class=&quot;math-container&quot;&gt;$$\left| \psi_2 \right&amp;gt; = \alpha_1 \left|0\right&amp;gt; + \beta_1 \left|1\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to convert these into a single mixed state &lt;span class=&quot;math-container&quot;&gt;$\left| \psi\right&amp;gt; $&lt;/span&gt; ? and can I able to extract back &lt;span class=&quot;math-container&quot;&gt;$\left| \psi_1 \right&amp;gt; $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$\left| \psi_2 \right&amp;gt; $&lt;/span&gt; form the  mixed state &lt;span class=&quot;math-container&quot;&gt;$\left| \psi\right&amp;gt; $&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15087" LastEditorUserId="55" LastEditDate="2021-04-22T08:34:49.253" LastActivityDate="2021-04-22T08:34:49.253" Title="Can we convert two single qubit states into single mixed state?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17201" PostTypeId="2" ParentId="17199" CreationDate="2021-04-22T06:34:00.937" Score="4" Body="&lt;p&gt;There are effectively two questions here. First:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If I have a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=p_1|\psi_1\rangle\langle\psi_1|+p_2|\psi_2\rangle\langle\psi_2|$&lt;/span&gt;, can I extract the states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;No. Certainly not without knowledge of what the states are (and if you know them, you can trivially produce them without the aid of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;). One easy way to see this is that if I give you a &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, there is not necessarily a unique way of writing it as &lt;span class=&quot;math-container&quot;&gt;$p_1|\psi_1\rangle\langle\psi_1|+p_2|\psi_2\rangle\langle\psi_2|$&lt;/span&gt;, so how should I know how to get the specific states you want?&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If I have two states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;, can I produce &lt;span class=&quot;math-container&quot;&gt;$\rho=p_1|\psi_1\rangle\langle\psi_1|+p_2|\psi_2\rangle\langle\psi_2|$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Kind of. Imagine, to start with, that the two states are unknown, but orthogonal. If you apply the operation &lt;span class=&quot;math-container&quot;&gt;$e^{i\theta \text{SWAP}}$&lt;/span&gt; and discard one of the two systems, the other will be left in the desired state where &lt;span class=&quot;math-container&quot;&gt;$p_1=\cos^2\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_2=\sin^2\theta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can create the same effect if the two states are not orthogonal by adding in an ancilla, so you create two states &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle|1\rangle$&lt;/span&gt;, thereby making them orthogonal, and allowing you to run the previous protocol.&lt;/p&gt;&#xA;&lt;p&gt;In reference to the first part of my answer, note that this protocol involves some discarding of information, which is what makes it non-reversible.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-22T06:34:00.937" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17202" PostTypeId="1" AcceptedAnswerId="17203" CreationDate="2021-04-22T07:36:40.517" Score="0" ViewCount="29" Body="&lt;p&gt;So when I run through risk, it displayed it had an equal 25% chance to get 00 01 10 11 respectively.&#xA;I know how the CNOT output looks like when you apply hadamard gate on control part before CNOT, but I'm not quite sure how the outcomes look like when you add a 2nd hadamard gate to it.&#xA;Here is what I mean:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/AUcy7.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AUcy7.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance&lt;/p&gt;&#xA;" OwnerUserId="15626" LastEditorUserId="15626" LastEditDate="2021-04-22T08:04:59.920" LastActivityDate="2021-04-22T08:04:59.920" Title="What is the outcome when you apply 2 hadamard gates on CNOT" Tags="&lt;quantum-gate&gt;&lt;hadamard&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17203" PostTypeId="2" ParentId="17202" CreationDate="2021-04-22T07:45:30.230" Score="1" Body="&lt;p&gt;You want to be able to work through a circuit like this step by step. However, in this particular case, there is a shortcut. Note that acting &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on the second qubit produces the state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; which is a &lt;span class=&quot;math-container&quot;&gt;$+1$&lt;/span&gt; eigenstate of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator. This actually means that the controlled-&lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator does absolutely nothing on this state! (Whether the control qubit is 0 or 1, the output of the second qubit is either &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$X|+\rangle=|+\rangle$&lt;/span&gt; respectively.) Hence, the overall output is just &lt;span class=&quot;math-container&quot;&gt;$|++\rangle$&lt;/span&gt;, as if the controlled-not weren't there.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-22T07:45:30.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17204" PostTypeId="1" AcceptedAnswerId="17208" CreationDate="2021-04-22T08:23:57.273" Score="1" ViewCount="81" Body="&lt;p&gt;Assume that you have a system of two qubits in the state &lt;span class=&quot;math-container&quot;&gt;$|11 \rangle$&lt;/span&gt;. Apply &lt;span class=&quot;math-container&quot;&gt;$H \otimes H$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is the Hadamard matrix. Is the state &lt;span class=&quot;math-container&quot;&gt;$(H \otimes H)|11\rangle$&lt;/span&gt; entangled?&#xA;I know if we take the tensor product of 2 Hadamard gate we get our initial state, but I'm not quite sure what I'm supposed to do here.&#xA;I'm more curious how can I represent &lt;span class=&quot;math-container&quot;&gt;$H |11\rangle $&lt;/span&gt;, I know &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle= \dfrac{|0\rangle - |1\rangle}{\sqrt(2)}$&lt;/span&gt; , so is &lt;span class=&quot;math-container&quot;&gt;$H|11 \rangle = \dfrac{1}{\sqrt(2) } \big( |00\rangle-|11 \rangle \big)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$H|11\rangle= \dfrac{1}{\sqrt(2) } \big(|00\rangle-|10\rangle-|01\rangle+|11\rangle \big) $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Any help would be great.&#xA;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="15626" LastEditorUserId="9858" LastEditDate="2021-04-22T15:12:41.420" LastActivityDate="2021-04-23T08:58:45.647" Title="Is the tensor product of 2 Hadamard gates entangled?" Tags="&lt;entanglement&gt;&lt;textbook-and-exercises&gt;&lt;hadamard&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17205" PostTypeId="2" ParentId="17204" CreationDate="2021-04-22T10:23:40.867" Score="2" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;You're correct in that &lt;span class=&quot;math-container&quot;&gt;$H |1 \rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1 \rangle)$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; being the Hadamerd gate.&#xA;However, acting on a product state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$H \otimes \mathbb{1}$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on the first qubit), you get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;H \otimes \mathbb{1} |11 \rangle  &amp;amp; = \frac{1}{\sqrt{2}}(|0\rangle - |1 \rangle) |1 \rangle \\&#xA;&amp;amp; = \frac{1}{\sqrt{2}}(|01\rangle - |11 \rangle)&#xA;\end{align}&lt;/span&gt;&#xA;and similarly,&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;H \otimes H |11\rangle &amp;amp; = H|1\rangle \otimes H|1\rangle \\&#xA;&amp;amp; = \frac{1}{\sqrt{2}}(|0\rangle - |1 \rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle - |1 \rangle) \\&#xA;&amp;amp; = \frac{1}{2} (|00\rangle - |01\rangle - |10\rangle + |11\rangle) \ .&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;As to your question of whether the state &lt;span class=&quot;math-container&quot;&gt;$H \otimes H |11\rangle$&lt;/span&gt; produces an entangled state, the answer is no. That is because, by definition, entangled states are non-separable. This means you cannot write an entangled state as a product of two separate states.&#xA;Take for instance a Bell state, &lt;span class=&quot;math-container&quot;&gt;$|\Phi \rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11 \rangle)$&lt;/span&gt;. You can NOT find two states &lt;span class=&quot;math-container&quot;&gt;$|\phi_1 \rangle,  |\phi_2 \rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$|\Phi \rangle$&lt;/span&gt; can be written as a product &lt;span class=&quot;math-container&quot;&gt;$|\phi_1 \rangle \otimes |\phi_2 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;You're statement that the tensor product of two Hadamards acted on an initial state results in the initial state is wrong as per the above argument. What you probably got confused with is that the square of the Hadamard gives the identity, &lt;span class=&quot;math-container&quot;&gt;$H^2 = \mathbb{1}$&lt;/span&gt;. This is because the Hadamard is unitary and Hermitian (or involutory), meaning the matrix is its own inverse.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15408" LastEditorUserId="15408" LastEditDate="2021-04-23T08:58:45.647" LastActivityDate="2021-04-23T08:58:45.647" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17206" PostTypeId="1" AcceptedAnswerId="17207" CreationDate="2021-04-22T13:22:18.807" Score="3" ViewCount="66" Body="&lt;p&gt;I know that an &lt;span class=&quot;math-container&quot;&gt;$R_z (\theta)$&lt;/span&gt; gate is equivalent to the unitary transformation &lt;span class=&quot;math-container&quot;&gt;$e^{-iZ * \theta/2}$&lt;/span&gt; but I'm not sure how we get there.&lt;/p&gt;&#xA;&lt;p&gt;I know that for every Hermitian matrix there is a corresponding Unitary matrix as &lt;span class=&quot;math-container&quot;&gt;$ U = e^{iH} $&lt;/span&gt;&#xA;where the eigenvalues are exponentiated and the eigenstates remain the same. But I don't see how in this case, it leads to the matrix &lt;span class=&quot;math-container&quot;&gt;$$\left(\begin{array}{cc}e^{-i \frac{\lambda}{2}} &amp;amp; 0 \\ 0 &amp;amp; e^{i \frac{\lambda}{2}}\end{array}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and not:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left(\begin{array}{cc}e^{i} &amp;amp; 0 \\ 0 &amp;amp; e^{-i}\end{array}\right)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I feel like I'm missing something really obvious&lt;/p&gt;&#xA;" OwnerDisplayName="user15140" LastEditorUserId="55" LastEditDate="2021-04-23T08:07:47.470" LastActivityDate="2021-04-23T09:08:52.793" Title="How do I show that $R_z(\theta)=e^{-iZ\theta/2}$?" Tags="&lt;quantum-gate&gt;&lt;mathematics&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17207" PostTypeId="2" ParentId="17206" CreationDate="2021-04-22T13:34:03.197" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$-iZ\frac{\theta}{2} = \begin{bmatrix}-i\frac{\theta}{2} &amp;amp;0\\0&amp;amp;i\frac{\theta}{2} \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is alread diagonal, so now you just take the exponenital operation on each of the eigenvalues.&lt;/p&gt;&#xA;&lt;p&gt;To get the matrix you thought you would get, you would need&#xA;&lt;span class=&quot;math-container&quot;&gt;$$iZ=\begin{bmatrix}i&amp;amp;0\\0&amp;amp;-i\end{bmatrix}$$&lt;/span&gt; which when exponeniated, would give you &lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}e^{i}&amp;amp;0\\0&amp;amp;e^{-i}\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am assuming you meant to write &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and not &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; in your first matrix.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="4991" LastEditDate="2021-04-23T09:08:52.793" LastActivityDate="2021-04-23T09:08:52.793" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17208" PostTypeId="2" ParentId="17204" CreationDate="2021-04-22T15:07:08.243" Score="2" Body="&lt;p&gt;As @Durd2nT pointed out, the answer is no. This is because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(H \otimes H) \big(|1\rangle \otimes | 1\rangle\big) = \dfrac{|00\rangle - |01\rangle = |10\rangle + |11\rangle}{2}  = \overbrace{\bigg( \dfrac{|0\rangle - |1\rangle }{\sqrt{2} } \bigg)}^{|\psi_A\rangle } \otimes \overbrace{\bigg( \dfrac{|0\rangle - |1\rangle }{\sqrt{2} } \bigg)}^{|\psi_B\rangle} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So &lt;span class=&quot;math-container&quot;&gt;$(H \otimes H) |1 1\rangle$&lt;/span&gt; produces a &lt;strong&gt;product state&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$|\psi_A \rangle \otimes |\psi_B \rangle$&lt;/span&gt; instead of an &lt;em&gt;entangled&lt;/em&gt; state. If a two qubit state is entangled, then you can't write it as a tensor product of two single qubit state like what we just did.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;You can also extend this to more general scenario too.&lt;/p&gt;&#xA;&lt;p&gt;Suppose you have a quantum state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{init} \rangle = |\psi_{init}^A \rangle \otimes |\psi_{init}^B \rangle $&lt;/span&gt; (a product state), then by applying the operator &lt;span class=&quot;math-container&quot;&gt;$U = U_A \otimes U_B $&lt;/span&gt; to the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{init} \rangle$&lt;/span&gt;, the state of the system &lt;strong&gt;will remain as a product state&lt;/strong&gt;. This is because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U |\psi_{init} \rangle = \big( U_A \otimes U_B \big) \big( |\psi_{init}^A \rangle \otimes |\psi_{init}^B \rangle  \big) = \overbrace{U_A |\psi_{init}^A \rangle}^{|\psi_A \rangle} \otimes \overbrace{U_B  |\psi_{init}^B \rangle}^{|\psi_B \rangle} = \overbrace{|\psi_A \rangle \otimes |\psi_B \rangle}^{\textrm{product state}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The question you asked, &lt;span class=&quot;math-container&quot;&gt;$U_A =H, U_B = H, |\psi_{init}^A \rangle = 1\rangle , |\psi_{init}^B \rangle = 1\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Also note that,  it doesn't make sense to write down the operation &lt;span class=&quot;math-container&quot;&gt;$H|11\rangle$&lt;/span&gt; as you did in your question. This is because &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$2 \times 2$&lt;/span&gt; unitary matrix, and &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; is a &lt;span class=&quot;math-container&quot;&gt;$4 \times 1$&lt;/span&gt; unit vector. Thus, you can't operate &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And you said &amp;quot;&lt;em&gt;I know if we take the tensor product of 2 Hadamard gate we get our initial state&lt;/em&gt;&amp;quot;, I think you are mistaken this with two consecutive Hadamard gate. Two consecutive Hadamard gate applying to a single qubit is different than the tensor product of two Hadamard gate applying to two qubits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/VMwg3.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/VMwg3.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The operation on the right of the figure is the representation of the tensor product of two Hadmard gate &lt;span class=&quot;math-container&quot;&gt;$H \otimes H$&lt;/span&gt;. It acts on a two qubit system. Whereas the operation on the left is a &lt;span class=&quot;math-container&quot;&gt;$H\cdot H$&lt;/span&gt;, and it only acts on a single qubit state.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-22T15:32:09.230" LastActivityDate="2021-04-22T15:32:09.230" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17209" PostTypeId="1" CreationDate="2021-04-22T15:12:45.087" Score="3" ViewCount="66" Body="&lt;p&gt;Considering the following two phenomena:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;Adiabatic quantum computing in general exhibits a quadratic speedup over classical simulated annealing, though for some Hamiltonians it may be faster (while for others slower). Typically, quantum tunneling is referred to as the reason for this speedup. (Mukherjee, S., Chakrabarti, B. Multivariable optimization: Quantum annealing and computation. Eur. Phys. J. Spec. Top. 224, 17–24 (2015). &lt;a href=&quot;https://doi.org/10.1140/epjst/e2015-02339-y&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1140/epjst/e2015-02339-y&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Quantum walks on graphs in general exhibit quadratic improved hit time over their classical counterparts, though for some nodes in some graphs this may be exponentially fast while for others it may be slower. In describing the reason behind this, authors usually refer not to tunneling but interference, pointing out that amplitudes on some graph nodes will constructively interfere while others will destructively interfere. (Kempe, J. Discrete Quantum Walks Hit Exponentially Faster. Probab. Theory Relat. Fields 133, 215–235 (2005). &lt;a href=&quot;https://doi.org/10.1007/s00440-004-0423-2&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1007/s00440-004-0423-2&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Are these separate phenomena, or are they two different statements of the same underlying result? I noticed (through my distinctly non-random sampling of a few papers on each) that quantum walk papers rarely mention adiabatic computation, and vice versa.&lt;/p&gt;&#xA;" OwnerUserId="5174" LastEditorUserId="5174" LastEditDate="2021-04-22T15:41:22.053" LastActivityDate="2021-05-04T19:22:07.723" Title="Relationship of Adiabatic Quantum Computing speedup to Quantum Random Walk hit time" Tags="&lt;annealing&gt;&lt;adiabatic-model&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17210" PostTypeId="1" AcceptedAnswerId="17211" CreationDate="2021-04-22T18:25:59.040" Score="2" ViewCount="55" Body="&lt;p&gt;As I know, we can decompose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; without ancilla if it's from special unitary group &lt;span class=&quot;math-container&quot;&gt;$SU(2^n)$&lt;/span&gt;. Do we need to use ancilla qubit on decomposing arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; using Clifford+T universal gates set?&lt;/p&gt;&#xA;" OwnerUserId="8466" LastEditorUserId="55" LastEditDate="2021-04-22T18:42:53.503" LastActivityDate="2021-04-22T19:07:39.330" Title="Do we need to use an ancillary qubit when decomposing arbitrary $U(2^n)$ gates using Clifford+T universal gate sets?" Tags="&lt;gate-synthesis&gt;&lt;universal-gates&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17211" PostTypeId="2" ParentId="17210" CreationDate="2021-04-22T19:07:39.330" Score="2" Body="&lt;p&gt;No, you don't need ancillae. Ancilla qubits can be extremely helpful, but they are not necessary. For example, in Nielsen and Chuang this is proven by giving an explicit construction.&lt;/p&gt;&#xA;&lt;p&gt;Also, there's no restriction that the unitary has to be from the special unitary group. Any unitary operation can be approximated to arbitrarily good accuracy using Clifford+T.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-22T19:07:39.330" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17212" PostTypeId="1" CreationDate="2021-04-22T20:44:33.283" Score="4" ViewCount="85" Body="&lt;p&gt;I'm new to Quantum Computing and I've been trying to understand single-qubit operations, quantum phases etc through Bloch's Sphere visualization. However, in IBM's Circuit Simulator, they seem to be using something called Q-sphere. Why are we using Q-sphere instead of Bloch's sphere? Wouldn't Bloch's sphere be a more accurate representation?&lt;/p&gt;&#xA;" OwnerUserId="15609" LastActivityDate="2021-04-23T22:28:40.540" Title="What is the difference between Bloch's sphere and IBM's Q-sphere?" Tags="&lt;quantum-state&gt;&lt;ibm-q-experience&gt;&lt;bloch-sphere&gt;" AnswerCount="3" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17213" PostTypeId="2" ParentId="17137" CreationDate="2021-04-22T21:05:19.007" Score="4" Body="&lt;p&gt;You are correct that both terms reference the central limit theorem (CLT), which states that&lt;sup&gt;[1]&lt;/sup&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;...the average of a large number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of independent measurements (each&#xA;having standard deviation &lt;span class=&quot;math-container&quot;&gt;$\Delta \sigma$&lt;/span&gt;) will converge to a Gaussian&#xA;distribution with standard deviation &lt;span class=&quot;math-container&quot;&gt;$\Delta \sigma / \sqrt{n}$&lt;/span&gt;, so that the error on average scales with &lt;span class=&quot;math-container&quot;&gt;$n^{-1/2}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The CLT on its own poses nothing more than a statistical relationship. Any physical implications of the CLT depend entirely on its application, i.e. the context in which it is invoked.&lt;/p&gt;&#xA;&lt;p&gt;Metrology and optics both leverage the CLT. In quantum metrology, the statistical scaling of errors with &lt;span class=&quot;math-container&quot;&gt;$n^{-1/2}$&lt;/span&gt; is referred to as the 'standard quantum limit'. In this more theoretical context, the exact definition of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is left ambiguous. In quantum (and classical) optics, the precision limit in optical phase sensing (i.e. the minimum uncertainty) is the shot-noise limit. In this more experimental context, &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is given an exact definition, e.g. the number of photons.&lt;/p&gt;&#xA;&lt;p&gt;However, despite these 'technical' distinctions, the subjects of quantum metrology and quantum optics have so much overlap that the two naming conventions are often used interchangeably in scientific literature.&lt;/p&gt;&#xA;&lt;p&gt;[1] &lt;em&gt;Advances in Quantum Metrology&lt;/em&gt;, V. Giovannetti, et al., 2011. &lt;a href=&quot;https://www.nature.com/articles/nphoton.2011.35&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/nphoton.2011.35&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-22T21:16:34.823" LastActivityDate="2021-04-22T21:16:34.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17214" PostTypeId="1" CreationDate="2021-04-22T21:59:16.233" Score="1" ViewCount="79" Body="&lt;p&gt;Qubit in polar form &lt;span class=&quot;math-container&quot;&gt;$$\left|\psi\right\rangle=\cos(\theta/2)\left|0\right\rangle+\sin(\theta/2)\left|1\right\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now lets say i want to keep &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2) = 50.400 $&lt;/span&gt; degrees angle and &lt;span class=&quot;math-container&quot;&gt;$\sin(\theta/2) = 35.80 $&lt;/span&gt; degrees angle into a qubit using qiskit? or how can i convert these angles into a gate so that state zero &lt;span class=&quot;math-container&quot;&gt;$\left|0\right\rangle$&lt;/span&gt;  which is default input in qiskit to get  to desired state &lt;span class=&quot;math-container&quot;&gt;$\left|\psi\right\rangle=50.400\left|0\right\rangle+35.80\left|1\right\rangle $&lt;/span&gt; using the angles&lt;/p&gt;&#xA;" OwnerUserId="15087" LastActivityDate="2021-04-23T19:44:01.997" Title="How to keep angles in degrees into quantum circuit using qiskit?" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17215" PostTypeId="2" ParentId="17212" CreationDate="2021-04-23T00:04:44.747" Score="1" Body="&lt;p&gt;A Bloch Sphere is the state space of all possible points to which a state vector can point to. A Bloch sphere can only demonstrate the state of one qubit while a Q-sphere can demonstrate multiple qubits. We use Q-sphere more often than not because quantum circuits are generally more than one qubit.&lt;/p&gt;&#xA;" OwnerUserId="15602" LastActivityDate="2021-04-23T00:04:44.747" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17216" PostTypeId="2" ParentId="17214" CreationDate="2021-04-23T01:06:17.860" Score="3" Body="&lt;p&gt;The first thing I will mention is that the target state you specified,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = 50.40|0\rangle + 35.80|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is not a valid quantum state, because the probabilities do not add up to one.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|50.40|^2 + |35.80|^2 = 3821.80 \neq 1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, we can normalize your equation,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{50.40}{\sqrt{3821.80}}|0\rangle + \frac{35.80}{\sqrt{3821.80}}|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which &lt;em&gt;is&lt;/em&gt; a valid quantum state. Now, starting over with the general state representation,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \cos{(\theta/2)}|0\rangle + \sin{(\theta/2)}|1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$0 \leq \theta \leq \pi$&lt;/span&gt;. To solve for &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; we do,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\cos{(\theta/2)}  = \frac{50.40}{\sqrt{3821.80}}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\theta = 2 * \cos^{-1}{\bigg(\frac{50.40}{\sqrt{3821.80}}\bigg)} = 1.23523 \text{ radians}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We know that action of a quantum gate is found by multiplying the matrix representing the gate with the vector which represents the quantum state.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi'\rangle = U|\psi\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;A general unitary must be able to take the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; to the above state. Such a unitary is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = \begin{pmatrix} \cos{(\theta/2)} &amp;amp; -e^{i \lambda}\sin{(\theta/2)} \\ e^{i \phi}\sin{(\theta/2)} &amp;amp; e^{i\lambda + i\phi}\cos{(\theta/2)} \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$0 \leq \phi &amp;lt; 2\pi$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$0 \leq \lambda &amp;lt; 2\pi$&lt;/span&gt;. In Qiskit you have access to this general unitary using the &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; gate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$u(\theta, \phi, \lambda) = U(\theta, \phi, \lambda)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To get our desired state, we will plug in &lt;span class=&quot;math-container&quot;&gt;$\phi = \lambda = 0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\theta = 1.23523$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, QuantumRegister, assemble, Aer&#xA;from qiskit.visualization import plot_histogram&#xA;&#xA;q = QuantumRegister(1)&#xA;qc = QuantumCircuit(q)&#xA;qc.u(1.23523,0,0,q)&#xA;&#xA;svsim = Aer.get_backend('statevector_simulator'). # Tell Qiskit how to simulate our circuit&#xA;qobj = assemble(qc) # Create a Qobj from the circuit for the simulator to run&#xA;result = svsim.run(qobj).result() # Do the simulation and return the result&#xA;out_state = result.get_statevector()&#xA;&#xA;&amp;gt;&amp;gt;&amp;gt; print(out_state) # Display the output state vector&#xA;[0.81526191+0.j 0.57909241+0.j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\cos{(\theta/2)} = \frac{50.40}{\sqrt{3821.80}} \simeq 0.815$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sin{(\theta/2)} = \frac{35.80}{\sqrt{3821.80}} \simeq 0.579$&lt;/span&gt;, which agrees with the results of the Qiskit Aer simulator. To visualize the probability distribution of your constructed state, you can run the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;counts = result.get_counts()&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-23T19:44:01.997" LastActivityDate="2021-04-23T19:44:01.997" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17217" PostTypeId="2" ParentId="17212" CreationDate="2021-04-23T07:34:47.800" Score="3" Body="&lt;p&gt;To follow up on hizqial's answer, these two spheres represent two different things.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Bloch_sphere&quot; rel=&quot;nofollow noreferrer&quot;&gt;Bloch sphere&lt;/a&gt; is a way to visualize the state of a single qubit in every way possible. On the image below you see that the North Pole of the sphere represents the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, whereas the South Pole represents the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. Every point between the two represents a superposition with relative phase &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; and amplitude angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. So every state can be represented as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = cos(\frac{\theta}{2})|0\rangle + e^{I\phi}sin(\frac{\theta}{2})|1\rangle$&lt;/span&gt;, as seen on the image below :&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Uh0yW.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Uh0yW.png&quot; alt=&quot;Bloch sphere&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Q-sphere is different. It is there to represent transformations between different multi-qubits states, until 5 qubits. The North Pole of the Q-sphere represents the &lt;span class=&quot;math-container&quot;&gt;$|0\cdots 0\rangle$&lt;/span&gt; state and the South Pole represents the &lt;span class=&quot;math-container&quot;&gt;$|1\cdots 1\rangle$&lt;/span&gt; state. Then the other states are put between them with the ones with more 1s are put closer to the South Pole. The latitudes is defined as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Hamming_distance&quot; rel=&quot;nofollow noreferrer&quot;&gt;Hamming Distance&lt;/a&gt;. The vector on the sphere represents the state vector of the system, the same way as the Bloch sphere. The phase is not represented physically as with the Bloch sphere, but with a color code. You can see that on the image below, which is an example for a 4-qubit system :&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dZDpu.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dZDpu.png&quot; alt=&quot;IBM Q-sphere&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Here, I hope this can help, these are both visualization tools, to gain intuition about quantum systems, but the Q-sphere is about visualizing transformation to up to 5 qubits, and the Bloch sphere is about visualizing a single qubit. The Q-sphere can be seen as a generalization of the Bloch sphere, but there is a less good visualization, the Bloch sphere on the other hand, only represents one qubit, but with better intuition.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastEditorUserId="8746" LastEditDate="2021-04-23T08:40:54.957" LastActivityDate="2021-04-23T08:40:54.957" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17218" PostTypeId="1" AcceptedAnswerId="17220" CreationDate="2021-04-23T12:04:30.670" Score="2" ViewCount="29" Body="&lt;p&gt;Consider the controlled phase gate &lt;span class=&quot;math-container&quot;&gt;$$U_{ab}(\varphi_{ab}) := e^{-i \varphi_{ab}H_{ab}}~~~~\text{where}~~~~H_{ab} := |1 \rangle^{a} \langle 1 | \otimes |1 \rangle^{b} \langle 1 |$$&lt;/span&gt; is the two-qubit interaction. We can show that &lt;span class=&quot;math-container&quot;&gt;$$H_{ab} = \frac{1}{4}( I_{ab}-\sigma_{z}^{a}-\sigma_{z}^{b}+H_{ab}^{I})$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H^{I}_{ab} = e^{-i \varphi_{ab} \sigma^a_z \sigma^b_z}$&lt;/span&gt; and therefore &lt;span class=&quot;math-container&quot;&gt;$$U_{ab}(\varphi_{ab}) = e^{-\frac{i\varphi_{ab}}{4}}e^{\frac{i\varphi_{ab}}{4} \sigma^a_z}e^{\frac{i\varphi_{ab}}{4}\sigma^b_z}e^{-i \varphi_{ab} \sigma^a_z \sigma^b_z}.$$&lt;/span&gt; Is it clear how it follows then that for &lt;span class=&quot;math-container&quot;&gt;$\varphi_{ab}= \pi$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$$U_{ab}(\pi) = |0\rangle^{a} \langle 0 | \otimes I^b + |1\rangle^{a} \langle 1 | \otimes \sigma^b_z,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is the identity, as stated in Eq. (22) on page 13 of the paper &amp;quot;&lt;em&gt;&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0602096&quot; rel=&quot;nofollow noreferrer&quot;&gt;Entanglement in Graph States and its Applications (2006)&lt;/a&gt;&lt;/em&gt;&amp;quot; by M.Hein. Thanks for any assistance.&lt;/p&gt;&#xA;" OwnerUserId="2032" LastEditorUserId="55" LastEditDate="2021-04-23T12:49:58.973" LastActivityDate="2021-04-23T12:52:14.053" Title="Unitary interaction term of two-qubit graph state" Tags="&lt;entanglement&gt;&lt;unitarity&gt;&lt;graph-states&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17219" PostTypeId="1" AcceptedAnswerId="17226" CreationDate="2021-04-23T12:13:35.100" Score="0" ViewCount="56" Body="&lt;p&gt;How can I transpile using universal &lt;span class=&quot;math-container&quot;&gt;$Clifford + T$&lt;/span&gt; gates set? I have only seen examples using rotations + &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is what I have tried&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.quantum_info import Operator&#xA;from qiskit.compiler import transpile&#xA;%matplotlib inline&#xA;&#xA;u = Operator([[0, 0, 1, 0, 0, 0, 0, 0],&#xA;              [1, 0, 0, 0, 0, 0, 0, 0],&#xA;              [0, 1, 0, 0, 0, 0, 0, 0],&#xA;              [0, 0, 0, 1, 0, 0, 0, 0],&#xA;              [0, 0, 0, 0, 0, 0, 0, 1],&#xA;              [0, 0, 0, 0, 0, 1, 0, 0],&#xA;              [0, 0, 0, 0, 0, 0, 1, 0],&#xA;              [0, 0, 0, 0, 1, 0, 0, 0]])&#xA;&#xA;qc = QuantumCircuit(3)&#xA;qc.unitary(u, [0,1,2], label='u')&#xA;&#xA;result = transpile(qc, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=3)&#xA;result.draw(output='mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And this example works fine. But when I was trying to set:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;basis_gates=['h', 's', 't', 'cx']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It doesn't work.&#xA;Could you help me, please?)&lt;/p&gt;&#xA;&lt;p&gt;UPDATE:&#xA;After comments I've tried this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install git+https://github.com/LNoorl/qiskit-terra.git@feature/sk-pass&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and then:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;from qiskit.circuit.library import TGate, HGate, TdgGate, SGate&#xA;from qiskit.transpiler.passes import SolovayKitaevDecomposition&#xA;from qiskit import *&#xA;from qiskit.quantum_info import Operator&#xA;from qiskit.compiler import transpile&#xA;%matplotlib inline&#xA;&#xA;u = Operator([[1, 0, 0, 0, 0, 0, 0, 0],&#xA;              [0, 1, 0, 0, 0, 0, 0, 0],&#xA;              [0, 0, -1, 0, 0, 0, 0, 0],&#xA;              [0, 0, 0, 1, 0, 0, 0, 0],&#xA;              [0, 0, 0, 0, 1, 0, 0, 0],&#xA;              [0, 0, 0, 0, 0, 1, 0, 0],&#xA;              [0, 0, 0, 0, 0, 0, 1, 0],&#xA;              [0, 0, 0, 0, 0, 0, 0, 1]])&#xA;&#xA;qc = QuantumCircuit(3)&#xA;qc.unitary(u, [0,1,2], label='u')&#xA;&#xA;print('Orginal circuit:')&#xA;print(qc)&#xA;&#xA;basis_gates = [TGate(), SGate(), HGate()]&#xA;skd = SolovayKitaevDecomposition(recursion_degree=2, basis_gates=basis_gates, depth=5)&#xA;&#xA;discretized = skd(qc)&#xA;&#xA;print('Discretized circuit:')&#xA;print(discretized)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;But it outputs only this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Orginal circuit:&#xA;     ┌────┐&#xA;q_0: ┤0   ├&#xA;     │    │&#xA;q_1: ┤1 u ├&#xA;     │    │&#xA;q_2: ┤2   ├&#xA;     └────┘&#xA;Discretized circuit:&#xA;     ┌────┐&#xA;q_0: ┤0   ├&#xA;     │    │&#xA;q_1: ┤1 u ├&#xA;     │    │&#xA;q_2: ┤2   ├&#xA;     └────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where is a problem?&lt;/p&gt;&#xA;" OwnerUserId="8466" LastEditorUserId="55" LastEditDate="2021-04-23T15:47:37.340" LastActivityDate="2021-04-23T18:56:34.603" Title="How to use qiskit transpile with Clifford + T basis?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2021-04-23T22:14:55.813" ContentLicense="CC BY-SA 4.0" />
  <row Id="17220" PostTypeId="2" ParentId="17218" CreationDate="2021-04-23T12:13:42.530" Score="2" Body="&lt;p&gt;Absolutely!&#xA;Think about the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$H_{ab}$&lt;/span&gt;: &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; has eigenvalue 1, while &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; have eigenvalue 0. This tells us that the time evolution must be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_{ab}(\varphi)=\begin{bmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; e^{-i\varphi}&#xA;\end{bmatrix}.&#xA;$$&lt;/span&gt;&#xA;When &lt;span class=&quot;math-container&quot;&gt;$\varphi=\pi$&lt;/span&gt;, you can easily check that this is what you want.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-04-23T12:52:14.053" LastActivityDate="2021-04-23T12:52:14.053" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17221" PostTypeId="1" AcceptedAnswerId="17223" CreationDate="2021-04-23T12:56:01.473" Score="0" ViewCount="49" Body="&lt;p&gt;I am a noob at quantum computing but I am certain the circuit is correct. I've tried increasing the number of shots, changing the quantum computer. I think it might be a problem with my ccccx gate? I am not sure I implemented it correctly. I've also been hearing something about connectivity, but my internet connection shouldn't be an issue?&lt;/p&gt;&#xA;&lt;p&gt;I live in Australia and I've been using mainly IBM Quito. That computer has a shockingly of low queue 100 compared to the 10k queueing for the one in my city Melbourne, is there a known problem with IBM Quito?&lt;/p&gt;&#xA;&lt;p&gt;For context my 2 qubit, 3 qubit circuit works perfectly. 2 qubit circuit works flawlessly 100% of the time finding the hidden variable. 3 qubit circuit has some hiccups but it still works maybe 70% of the time. 4 qubit one works maybe 10% of the time.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FxM7j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FxM7j.png&quot; alt=&quot;My 4Q Grover circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rcHBz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rcHBz.png&quot; alt=&quot;This was the only time after 20 attempts it got the result right&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14967" LastEditorUserId="55" LastEditDate="2021-04-23T12:56:37.393" LastActivityDate="2021-04-23T16:06:51.840" Title="4Q Grover circuit working in simulator, however producing nonsense in actual quantum computer" Tags="&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17223" PostTypeId="2" ParentId="17221" CreationDate="2021-04-23T15:21:20.630" Score="1" Body="&lt;p&gt;Here is the qubit layout and error map for `ibmq_quito':&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CvMBm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CvMBm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And when you try to execute your original circuit on 'ibmq_quito', what you are executing is &lt;em&gt;something like&lt;/em&gt; the circuit below given ibmq_quito's qubits connectivity* and its native gate set &lt;span class=&quot;math-container&quot;&gt;${CX, ID, RZ, SX, X}$&lt;/span&gt; . This circuit has 196 gates altogether with about 50 CNOT gates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/moRo4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/moRo4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can use the error rate from the top figure and sort of workout the probability of failure in your circuit. You will see that you will have a pretty high chance of failure. Also note the &lt;em&gt;Readout Error&lt;/em&gt; is pretty significant on qubit 0 and 1.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To get the the transpiled circuit and the error map, you can do the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.compiler import transpile&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_quito')&#xA;Circuit_Transpile = transpile(circuit, backend , initial_layout =None, optimization_level=3)&#xA;Circuit_Transpile.draw( 'mpl',style={'name': 'bw'}, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.visualization import plot_error_map&#xA;plot_error_map(backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can also access the error rate through the Dash Board in IBM Quantum Experience. If you login to your IBM Quantum Experience, on the top left, you will see the following menu:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/s0hRi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/s0hRi.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Click on that and you will see a list of devices. Click on any of those devices, you will be able to see its configuration.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-23T16:06:51.840" LastActivityDate="2021-04-23T16:06:51.840" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17224" PostTypeId="1" AcceptedAnswerId="17225" CreationDate="2021-04-23T16:01:41.363" Score="1" ViewCount="109" Body="&lt;p&gt;You have 2 qubits, the states of which are unknown to you. They are either in the state &lt;span class=&quot;math-container&quot;&gt;$\vert 0 \rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;. Which sequences of gates can be applied so as to put the system in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}$&lt;/span&gt;(&lt;span class=&quot;math-container&quot;&gt;$\vert 00 \rangle$&lt;/span&gt; + &lt;span class=&quot;math-container&quot;&gt;$\vert 11\rangle$&lt;/span&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="15630" LastActivityDate="2021-04-25T23:32:58.797" Title="Given 2 unknown qubits, which series of gates can put them in an equal superposition of $\vert 00 \rangle$ and $\vert 11 \rangle$?" Tags="&lt;quantum-gate&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17225" PostTypeId="2" ParentId="17224" CreationDate="2021-04-23T16:41:17.253" Score="9" Body="&lt;p&gt;Can you use measurement?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If you can, you measure the qubits and make the decision based on the measurement results.&lt;/li&gt;&#xA;&lt;li&gt;If not, and you're only allowed to use unitary gates, it's impossible. Unitary gates are reversible, so you cannot map several different states to the same &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00 \rangle + |11\rangle)$&lt;/span&gt; state. If there was such a transformation, applying its adjoint to the &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(|00 \rangle + |11\rangle)$&lt;/span&gt; state would lead to only one state, not both of your states.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-04-23T16:41:17.253" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17226" PostTypeId="2" ParentId="17219" CreationDate="2021-04-23T18:56:34.603" Score="2" Body="&lt;p&gt;The reason for your second result is because unitary synthesis is not part of the &lt;code&gt;SolovayKitaevDecomposition&lt;/code&gt; pass. Actually, you can combine your attempts to get the desired result.&lt;/p&gt;&#xA;&lt;p&gt;This is the first stage (you first snippet), it will synthesise your circuit in terms of &lt;code&gt;u*&lt;/code&gt; and &lt;code&gt;cx&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.quantum_info import Operator&#xA;from qiskit.compiler import transpile&#xA;&#xA;u = Operator([[0, 0, 1, 0, 0, 0, 0, 0],&#xA;              [1, 0, 0, 0, 0, 0, 0, 0],&#xA;              [0, 1, 0, 0, 0, 0, 0, 0],&#xA;              [0, 0, 0, 1, 0, 0, 0, 0],&#xA;              [0, 0, 0, 0, 0, 0, 0, 1],&#xA;              [0, 0, 0, 0, 0, 1, 0, 0],&#xA;              [0, 0, 0, 0, 0, 0, 1, 0],&#xA;              [0, 0, 0, 0, 1, 0, 0, 0]])&#xA;&#xA;qc = QuantumCircuit(3)&#xA;qc.unitary(u, [0,1,2], label='u')&#xA;&#xA;transpiled = transpile(qc, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=3)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then you can transform it to Cliffort+T using &lt;code&gt;SolovayKitaevDecomposition&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit.library import TGate, HGate, SGate&#xA;from qiskit.transpiler.passes import SolovayKitaevDecomposition&#xA;&#xA;basis_gates = [TGate(), SGate(), HGate()]&#xA;skd = SolovayKitaevDecomposition(recursion_degree=3, basis_gates=basis_gates, depth=5)&#xA;discretized = skd(transpiled)&#xA;print(discretized)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;global phase: -0.063526&#xA;     ┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐┌───┐                           »&#xA;q_0: ┤ X ├┤ T ├┤ X ├┤ S ├┤ X ├┤ X ├┤ S ├┤ S ├┤ H ├───────────────────────────»&#xA;     └─┬─┘└───┘└─┬─┘└───┘└─┬─┘└─┬─┘├───┤├───┤├───┤┌───┐┌───┐┌───┐┌───┐┌─────┐»&#xA;q_1: ──■─────────┼─────────■────┼──┤ X ├┤ S ├┤ S ├┤ S ├┤ X ├┤ S ├┤ H ├┤ TDG ├»&#xA;                 │              │  └─┬─┘└───┘└───┘└───┘└─┬─┘├───┤├───┤└┬───┬┘»&#xA;q_2: ────────────■──────────────■────■───────────────────■──┤ T ├┤ S ├─┤ S ├─»&#xA;                                                            └───┘└───┘ └───┘ »&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-04-23T18:56:34.603" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17227" PostTypeId="2" ParentId="17224" CreationDate="2021-04-23T22:11:50.673" Score="1" Body="&lt;p&gt;If you can use a reset, then applying this operation sets both qubits to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. Then apply Hadamard gate on the first qubit and CNOT gate on both qubits. In the end you have your desired Bell state.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-04-23T22:11:50.673" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17228" PostTypeId="2" ParentId="17212" CreationDate="2021-04-23T22:28:40.540" Score="2" Body="&lt;p&gt;A single qubit can be written down as &lt;span class=&quot;math-container&quot;&gt;$\cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi}\sin(\theta/2)|1\rangle$&lt;/span&gt;. So, the qubit is described by two angles (&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;). Hence, it can be mapped to a unit sphere (or with any other radius but then unit is used as a convention). &lt;strong&gt;This is a Bloch sphere, a visualization of a sigle qubit.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;A Q-spehere is a visualization of multi-qubit states introduced by IBM. Assuming our state is composed of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, state &lt;span class=&quot;math-container&quot;&gt;$|00\dots00\rangle$&lt;/span&gt; is shown on north pole, whereas &lt;span class=&quot;math-container&quot;&gt;$|11\dots11\rangle$&lt;/span&gt; is south pole. A parallel of latitude is used for a state with same number of zeros. Going from north to south, the number of 1 is increasing. As mentioned in other answers, a phase is expressed with colors. &lt;strong&gt;So, a Q sphere is a way how to show &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit states.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Overall, these visualizations are more or less complements, not substitutes.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-04-23T22:28:40.540" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17229" PostTypeId="1" AcceptedAnswerId="17235" CreationDate="2021-04-24T08:51:58.497" Score="5" ViewCount="133" Body="&lt;p&gt;I've been searching for a quantum algorithm to compute the the inner product between two &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit quantum states, namely &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\psi\rangle$&lt;/span&gt;, which is in general a complex number.&lt;/p&gt;&#xA;&lt;p&gt;One can get &lt;span class=&quot;math-container&quot;&gt;$|\langle\phi|\psi\rangle|^2$&lt;/span&gt; through thte SWAP test for multiple qubits, but this is not really the inner product as the information of the real and imaginary parts are lost.&lt;/p&gt;&#xA;&lt;p&gt;I came across this &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.InnerProduct.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit page&lt;/a&gt;, which claims that the task can be done by simply using CZ gates. I'm not sure if I am mistaken, but it seems to me that such a circuit works for computational basis states, but not for general quantum states. Could somebody help me confirm if this is actually the case?&lt;/p&gt;&#xA;&lt;p&gt;If the above algorithm doesn't work for general quantum states, what algorithm would you suggest?&lt;/p&gt;&#xA;" OwnerUserId="15641" LastEditorUserId="10480" LastEditDate="2021-04-25T19:05:45.670" LastActivityDate="2021-04-25T19:05:45.670" Title="Does the circuit with qubit-wise CZ gates compute the inner product of two states? If not, is there another circuit that does?" Tags="&lt;qiskit&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;inner-product&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17230" PostTypeId="1" AcceptedAnswerId="17241" CreationDate="2021-04-24T12:16:43.683" Score="5" ViewCount="80" Body="&lt;p&gt;I found that Qiskit uses Unroll3qOrMore in the transpiler class function to decompose an arbitrary &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; 2$&lt;/span&gt; unitary and represent it as a directed acyclic graph (DAG). But I can't find an algorithm (or paper for it). Could you help?&lt;/p&gt;&#xA;" OwnerUserId="8466" LastEditorUserId="13991" LastEditDate="2021-04-26T07:35:53.500" LastActivityDate="2021-04-26T07:35:53.500" Title="What algorithm does Qiskit use to decompose arbitrary n-qubit unitaries on Rotations + CNOT?" Tags="&lt;qiskit&gt;&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17231" PostTypeId="1" CreationDate="2021-04-24T12:35:09.033" Score="4" ViewCount="125" Body="&lt;p&gt;I've been reading a number of papers about approximate algorithms and they mention that when the standard Ising  Hamiltonian of the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;H_{c}=\sum_{} c_{i} Z_{i} +\sum_{} J_{i j} Z_{i} Z_{j}, $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;has integer eigenvalues, the value of &lt;span class=&quot;math-container&quot;&gt;$$&#xA;F_{p}(\boldsymbol{\gamma}, {\boldsymbol{\beta}})=  \left\langle\psi_{p}(\boldsymbol{\gamma}, {\boldsymbol{\beta}})\left|H_{C}\right| \psi_{p}(\boldsymbol{\gamma}, {\boldsymbol{\beta}})\right\rangle, &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where, &lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{p}(\boldsymbol{\gamma}, \boldsymbol{\beta})\rangle=U_{B}\left(\beta_{p}\right) U_{C}\left(\gamma_{p}\right) \cdots U_{B}\left(\beta_{1}\right) U_{C}\left(\gamma_{1}\right)|+\rangle^{\otimes N} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is periodic, but the value when &lt;span class=&quot;math-container&quot;&gt;$H_{c}$&lt;/span&gt; is not integer eigenvalued isn't: why is this ?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/631919/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user15140" LastEditorDisplayName="user15140" LastEditDate="2021-05-11T16:07:34.283" LastActivityDate="2021-05-11T16:07:34.283" Title="Integer Eigenvalues leading to periodicity" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17232" PostTypeId="1" CreationDate="2021-04-24T14:00:48.337" Score="6" ViewCount="74" Body="&lt;p&gt;I'm doing some reading into Variational Quantum Eigensolvers (VQEs), Quantum Approximate Optimization Algorithms (QAOAs), and other similar algorithms.&lt;/p&gt;&#xA;&lt;p&gt;I know that the point is to find the ground state of a Hamiltonian. I'm interested in making/finding a list of all the different problems that we know we can solve in this way.&lt;/p&gt;&#xA;&lt;p&gt;For example, I've seen references to applications in chemistry, material science, and even graph theory. Can you point me to an existing list of applications, or list some places I can go to find more? Google searches for &amp;quot;applications of finding ground state of Hamiltonian&amp;quot; are not giving me anything interesting.&lt;/p&gt;&#xA;&lt;p&gt;What I'm most interested in is how one can translate the problem into the specific Hamiltonian that they want to solve, and then specifically what they learn about the problem when they find the ground state energy.&lt;/p&gt;&#xA;" OwnerUserId="15640" LastEditorUserId="55" LastEditDate="2021-04-25T17:08:40.420" LastActivityDate="2021-04-25T17:08:40.420" Title="List of problems that can be reduced to finding the ground state of a Hamiltonian" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;vqe&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17234" PostTypeId="2" ParentId="17232" CreationDate="2021-04-24T15:01:45.137" Score="7" Body="&lt;p&gt;Welcome to Quantum Computing StackExchange.&lt;/p&gt;&#xA;&lt;p&gt;In general, finding the ground state energy of a k-local Hamiltonian is &lt;a href=&quot;https://en.wikipedia.org/wiki/QMA#The_local_Hamiltonian_problem&quot; rel=&quot;noreferrer&quot;&gt;QMA-hard&lt;/a&gt; for k ≥ 2.&#xA;That means, any problem in the complexity class QMA can be solved by reducing it to a k-local Hamiltonian and finding its ground state.&lt;/p&gt;&#xA;&lt;p&gt;And since NP is a subclass of QMA, any NP problem can be solved this way including &lt;a href=&quot;https://en.wikipedia.org/wiki/NP-completeness&quot; rel=&quot;noreferrer&quot;&gt;NP-complete&lt;/a&gt; problems.&lt;/p&gt;&#xA;&lt;p&gt;Thousands of problems are known to be NP-complete. The book &amp;quot;&lt;a href=&quot;https://en.wikipedia.org/wiki/Computers_and_Intractability&quot; rel=&quot;noreferrer&quot;&gt;Computers and Intractability&lt;/a&gt;&amp;quot; by Garey and Johnson includes over 300 of them.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1302.5843&quot; rel=&quot;noreferrer&quot;&gt;This paper&lt;/a&gt; provides formulations for some well known NP-complete problems as Hamiltonians of an Ising spin glass that can be used with QAOA.&lt;/p&gt;&#xA;&lt;p&gt;And &lt;a href=&quot;https://arxiv.org/abs/1804.09130&quot; rel=&quot;noreferrer&quot;&gt;this paper&lt;/a&gt; describes a systematic way to convert a problem into a Hamiltonian.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2021-04-24T17:13:14.373" LastActivityDate="2021-04-24T17:13:14.373" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17235" PostTypeId="2" ParentId="17229" CreationDate="2021-04-24T16:29:45.897" Score="5" Body="&lt;p&gt;Suppose &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\psi\rangle = re^{i\theta}$&lt;/span&gt;. As you have noticed, if we have access to multiple copies of the state, then we can measure &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; using the &lt;a href=&quot;https://en.wikipedia.org/wiki/Swap_test&quot; rel=&quot;noreferrer&quot;&gt;SWAP test&lt;/a&gt;. Now, consider the state &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle = e^{-i\theta}|\psi\rangle$&lt;/span&gt; and note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\phi|\psi'\rangle = e^{-i\theta}\langle\phi|\psi\rangle = e^{-i\theta}re^{i\theta} = r.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; differ only by the global phase, we see that a quantum circuit computing &lt;span class=&quot;math-container&quot;&gt;$re^{i\theta}$&lt;/span&gt; would let us observe the global phase difference between &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi'\rangle$&lt;/span&gt;  which is unobservable. We conclude that such a quantum circuit does not exist. All we have observational access to is the magnitude of the inner product &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For two &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit computational basis states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;, the CZ-based quantum circuit computes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(-1)^{x \cdot y}|x\rangle|y\rangle,\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$x\cdot y=\sum_{i=1}^n x_iy_i$&lt;/span&gt; is the inner product between binary vectors &lt;span class=&quot;math-container&quot;&gt;$x=(x_1,\dots,x_n)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y=(y_1,\dots,y_n)$&lt;/span&gt;. The inner product &lt;span class=&quot;math-container&quot;&gt;$\cdot$&lt;/span&gt; is defined in the vector space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2^n$&lt;/span&gt; of binary strings on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bits and is a different inner product than &lt;span class=&quot;math-container&quot;&gt;$\langle \,.|\,.\rangle$&lt;/span&gt; defined in the Hilbert space.&lt;/p&gt;&#xA;&lt;p&gt;Note that the circuit does work for states other than computational basis states by linear extension. In fact, its only action on a computational basis is to change the unobservable global phase, so it is only useful on states that are superpositions of computational basis states where its effect is to change the relative phases according to the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_2^n$&lt;/span&gt; inner product of the states.&lt;/p&gt;&#xA;&lt;p&gt;In any case, the circuit does not compute &lt;span class=&quot;math-container&quot;&gt;$\langle\phi|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-04-24T19:10:15.227" LastActivityDate="2021-04-24T19:10:15.227" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17236" PostTypeId="1" AcceptedAnswerId="17245" CreationDate="2021-04-24T16:47:07.633" Score="5" ViewCount="60" Body="&lt;p&gt;In discussions on many quantum algorithms especially related to quantum walks, I have seen the term &amp;quot;perfect state transfer&amp;quot; used to describe some property apparently related to the periodicities of the walk/algorithm, but I cannot quite grasp the significance of the term, or why it would be useful concept to consider.&lt;/p&gt;&#xA;&lt;p&gt;For example using Grover's algorithm to find a single marked state by applying iterations to a state initially prepared on the uniform superposition over all input vectors will not necessarily reach back to the uniform superposition, thus there may not be perfect state transfer with Grover's iteration.  (I think).&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Is there a succinct way to understand &amp;quot;perfect state transfer&amp;quot;, and why this is an interesting concept to study?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Continuous-time_quantum_walk#Perfect_state_transfer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia article&lt;/a&gt; is not bad, but I suspect there might be more to be said..&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-04-25T15:23:10.840" LastActivityDate="2021-04-26T06:53:58.633" Title="What is meant by &quot;perfect state transfer&quot;?" Tags="&lt;grovers-algorithm&gt;&lt;terminology&gt;&lt;quantum-walks&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17237" PostTypeId="1" AcceptedAnswerId="17238" CreationDate="2021-04-24T18:55:25.627" Score="2" ViewCount="104" Body="&lt;p&gt;I'm self-studying quantum computing and have gone through the Wikipedia article on the Berstein-Vazirani algorithm and believe that I understand it. I'm looking to verify my understanding and hope that someone could help me.&lt;/p&gt;&#xA;&lt;p&gt;If I have an 8 bit secret of all 0s, would the oracle just be nothing? Alternatively, if it was all 1s, would my oracle CNOT each input with the output qubit?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="55" LastEditDate="2021-05-08T13:29:15.707" LastActivityDate="2021-05-08T13:29:15.707" Title="In the Bernstein-Vazirani circuit, if the secret is all 0s, would the oracle just be nothing?" Tags="&lt;algorithm&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17238" PostTypeId="2" ParentId="17237" CreationDate="2021-04-24T20:06:22.817" Score="3" Body="&lt;p&gt;Yes, this is because the initial state will be starting as &lt;span class=&quot;math-container&quot;&gt;$|\psi_{init} \rangle = |000\cdots0\rangle = |0\rangle^{\otimes 8} $&lt;/span&gt;. Then you apply a layer of Hadamard gates, follow by the Oracle operation, then another layer of Hadamard gates, then finally the state of the 8 qubits of interest. Because the secret bitstring you have in mind are all &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;s, the Oracle would be nothing since this will allow the two layer of the Hadamard gates cancel each other out and keeping the state as &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle =  |0\rangle^{\otimes 8}$&lt;/span&gt;. Now, upon measurement, you will extract out this very state... which is the secret bitstring you are interested in finding.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/9mY5O.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/9mY5O.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If your secret bitstring is all 1's then you would want your final state to be &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = |1\rangle^{\otimes 8}$&lt;/span&gt;. To do this, we can use something called phase kickback. The idea is simple but clever. First notice the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yUxQh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yUxQh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This tells us, that if we want all &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;s then we will apply CNOT gates to each of the 8 qubits in your state to the ancilla qubit (which is in the state &lt;span class=&quot;math-container&quot;&gt;$\dfrac{|0\rangle - |1\rangle}{\sqrt{2}}$&lt;/span&gt;, which is created by apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate follow by Hadamard gate) between the two layers of the Hadamard gates.  Thus you will have something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PHtbg.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PHtbg.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Measuring this will return you the state of all 1's.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-24T20:06:22.817" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17239" PostTypeId="2" ParentId="8893" CreationDate="2021-04-24T23:52:10.193" Score="0" Body="&lt;p&gt;Analogy to &lt;strong&gt;numbers in binary&lt;/strong&gt; format:&lt;/p&gt;&#xA;&lt;p&gt;number 2 = b10 (2 bits)&lt;/p&gt;&#xA;&lt;p&gt;number 6 = b110 (added 1 bit , and it is the &lt;em&gt;highest&lt;/em&gt; bit)&lt;/p&gt;&#xA;&lt;p&gt;If 6 is represented as an array: arr=[0,1,1], that is what we would expect but it is the opposite order as binary representation.&lt;/p&gt;&#xA;&lt;p&gt;For qubits, the register is created the same way.&lt;/p&gt;&#xA;&lt;p&gt;Mathematicians could explain nomenclature better but in bra-ket notation, for a 2 qubits system, you have {|00&amp;gt;,|01&amp;gt;,|10&amp;gt;,|11&amp;gt; } = {|0&amp;gt;,|1&amp;gt;,|2&amp;gt;,|3&amp;gt;}, for bigger systems you can say that solution is |13&amp;gt;  instead of writing |00001101&amp;gt;. Since binary in computers are written the smallest bit in the 0 position, the output from the circuit has the same structure than the shorter, human-readable decimal version.&lt;/p&gt;&#xA;" OwnerUserId="15650" LastEditorUserId="15650" LastEditDate="2021-04-27T19:04:42.357" LastActivityDate="2021-04-27T19:04:42.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17240" PostTypeId="2" ParentId="17198" CreationDate="2021-04-25T11:10:05.070" Score="4" Body="&lt;p&gt;Your conclusion appears correct to me. It seems that Eq.(23), modified with your proposed change to the RHS, can be verified by combining Eq.(3), for the upper bound on the &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; unentangled particles, with Eq.(5), for the upper bound on the &lt;span class=&quot;math-container&quot;&gt;$N-M$&lt;/span&gt; entangled particles, using the convexity asserted in Section II.&lt;/p&gt;&#xA;&lt;p&gt;With respect to the &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; unentangled particles, the result in the paper would seem to require the use of Eq.(4), which relates to information associated with a single arbitrary component of &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;, instead of Eq.(3), which relates to the sum over components of &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;, to represent the information associated with the sum over the components of &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt;.  This appears to be a mistake.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastActivityDate="2021-04-25T11:10:05.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17241" PostTypeId="2" ParentId="17230" CreationDate="2021-04-25T22:42:44.860" Score="4" Body="&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$n &amp;gt; 2$&lt;/span&gt; qubit gates the Qiskit transpiler uses column-by-column decomposition (see: &lt;a href=&quot;https://arxiv.org/pdf/1501.06911.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1501.06911.pdf&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://www.youtube.com/watch?v=O2WcZS4yO1Q&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.youtube.com/watch?v=O2WcZS4yO1Q&lt;/a&gt; (comment section)&lt;/p&gt;&#xA;" OwnerUserId="13991" LastActivityDate="2021-04-25T22:42:44.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17243" PostTypeId="1" CreationDate="2021-04-26T01:17:44.897" Score="1" ViewCount="120" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/tMRRt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tMRRt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If the initial state of &lt;span class=&quot;math-container&quot;&gt;$|x_0\rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|x_1\rangle =|0\rangle$&lt;/span&gt;, and the final state at the barrier is &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; (in the form &lt;span class=&quot;math-container&quot;&gt;$|x_1x_0\rangle$&lt;/span&gt;), what would the state of this system be in the form &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |01\rangle + |10\rangle + |11\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; is the control qubit, it seems the CNOT gate only does something when &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state. Does this mean that &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; would effectively be &amp;quot;copied&amp;quot; onto &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt;? What would the state of this system be?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="55" LastEditDate="2021-04-27T09:45:05.540" LastActivityDate="2021-05-08T10:22:35.583" Title="Intuitions about probabilities relating to evolving a two-qubit state through a CNOT gate" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;probability&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17244" PostTypeId="2" ParentId="17243" CreationDate="2021-04-26T02:12:07.403" Score="2" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align} CNOT |01\rangle &amp;amp;= CNOT \big( |0\rangle \otimes |1\rangle \big) \\&#xA;&amp;amp;=  \big( |0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) \big( |0 \rangle \otimes 1\rangle \big) \\&#xA;&amp;amp;= \big( |0\rangle \langle 0| \otimes I \big)|0\rangle\otimes|1\rangle  + |1\rangle \langle 1| \otimes X \big) |0 \rangle \otimes |1\rangle \\&#xA;&amp;amp;= \big(|0\rangle \langle0|\big)|0\rangle \otimes I|1\rangle  + \big(  |1\rangle \langle 1|  \big)|0 \rangle \otimes X|1\rangle\\&#xA;&amp;amp;= |0\rangle\otimes|1\rangle + \vec{0} = |01\rangle&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So when the &lt;strong&gt;controlled&lt;/strong&gt; qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the CNOT gate have no effect on the state.&lt;/p&gt;&#xA;&lt;p&gt;Qiskit uses &lt;a href=&quot;https://en.wikipedia.org/wiki/Endianness&quot; rel=&quot;nofollow noreferrer&quot;&gt;little endian&lt;/a&gt; so &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; here is essentially the same as your &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; (reading it backward). So the CNOT gate doesn't do anything to the state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; since the &lt;strong&gt;controlled&lt;/strong&gt; qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;You end with the state &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; in the circuit above at the barrier because your control qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and your target qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; before the CNOT gate. Thus the state stays the same as &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;. Also note that the barrier has no physical meaning.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-26T04:46:26.917" LastActivityDate="2021-04-26T04:46:26.917" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17245" PostTypeId="2" ParentId="17236" CreationDate="2021-04-26T06:53:58.633" Score="2" Body="&lt;p&gt;Perfect state transfer is generally discussed in the context of continuous time evolution. For example, you might be evolving under the influence of a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. Particularly when one is considering some sort of underlying graph structure, you probably prepare an initial state corresponding to a single vertex (perhaps &lt;span class=&quot;math-container&quot;&gt;$|1000\ldots 0\rangle$&lt;/span&gt;) and you're aiming to reach another vertex (e.g. corresponding with a marked item). Let's call these vertices &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;. The perfect transfer condition in this context is then just&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\exists t:|e^{-iHt}_{v,u}|=1.&#xA;$$&lt;/span&gt;&#xA;In other words, if you start at vertex &lt;span class=&quot;math-container&quot;&gt;$u$&lt;/span&gt;, then after time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; you will arrive perfectly at vertex &lt;span class=&quot;math-container&quot;&gt;$v$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that if you're doing Grover's in this continuous time case, there aren't different iterations. It's generally just a single Hamiltonian that's switched on, and you can switch it off whenever you want. So, you can get an exact solution for Grover's.&lt;/p&gt;&#xA;&lt;p&gt;There's a sense in which you might argue that this &lt;em&gt;isn't&lt;/em&gt; an interesting thing to study: in real-world devices, there will always be errors. So it's irrelevant if there's a &amp;quot;perfect in theory&amp;quot; solution if, in practice, there are imperfect solutions that are less susceptible to errors (e.g. by being faster).&lt;/p&gt;&#xA;&lt;p&gt;But where it's useful is precisely for the theoretical studies as the perfectly transferring cases are mathematically much easier, help to shape ones intuition, and set you on the path of being able to deal with other cases.&lt;/p&gt;&#xA;&lt;p&gt;For my part, I've worked a lot on perfect state transfer in a slightly different context, where it essentially provides a long-range swap built out of nearest-neighbour interactions. (But you can also map the basic structure onto all sorts of other problems.) The motivation (roughly) is that this is the natural &amp;quot;language&amp;quot; to build circuits out of if your device interacts via a nearest-neighbour Hamiltonian, and should therefore give you a better way of doing things compared to the circuit model, for example. Compared to multiple consecutive swap gates, for instance, the perfect state transfer Hamiltonians in 1D can achieve the transfer of a quantum state over long range in half the time, which could make a major difference in real-world devices.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-04-26T06:53:58.633" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17246" PostTypeId="2" ParentId="17231" CreationDate="2021-04-26T07:26:47.590" Score="2" Body="&lt;p&gt;If you diagonalize &lt;span class=&quot;math-container&quot;&gt;$ H_c = \sum \lambda_i |u_i \rangle \langle u_i| $&lt;/span&gt; and the eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are integers, then:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;e^{- i (\gamma + 2\pi) H_c} = \sum e^{- i (\gamma + 2\pi) \lambda_i} |u_i \rangle \langle u_i| = \sum e^{- i \gamma \lambda_i} |u_i \rangle \langle u_i| = e^{- i \gamma H_c} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;since &lt;span class=&quot;math-container&quot;&gt;$ e^{- i 2\pi k} = 1,  \forall k \text{ integer}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This means &lt;span class=&quot;math-container&quot;&gt;$ |\psi_p(\gamma, \beta) \rangle = |\psi_p(\gamma + 2\pi, \beta) \rangle \implies F_p(\gamma, \beta) = (\gamma + 2\pi, \beta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A similar argument holds for &lt;span class=&quot;math-container&quot;&gt;$ \beta $&lt;/span&gt; if the mixer Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_B$&lt;/span&gt; has integer eigenvalues.&lt;/p&gt;&#xA;" OwnerUserId="13109" LastActivityDate="2021-04-26T07:26:47.590" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17247" PostTypeId="1" CreationDate="2021-04-26T09:29:31.517" Score="3" ViewCount="44" Body="&lt;p&gt;I am tying to measure the second excited state in a system that does not support Open Pulse. Instead I am using &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/05_pulse_gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;calibrations&lt;/a&gt;. The method detailed &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/accessing_higher_energy_states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; does not work. I get the error &lt;code&gt; &amp;quot;AttributeError: 'IBMQBackend' object has no attribute 'instruction_schedule_map'&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Using the method detailed &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.pulse.builder.measure.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; reproduces the same error &lt;code&gt;&amp;quot;AttributeError: 'NoneType' object has no attribute 'instruction_schedule_map'&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there a different way to access the measurement calibrations in a system which does not support pulse?&lt;/p&gt;&#xA;" OwnerUserId="15660" LastEditorUserId="55" LastEditDate="2021-04-26T11:11:08.787" LastActivityDate="2021-05-06T08:00:09.057" Title="Measuring second excited state |2&gt; using &quot;calibrations&quot; not Open Pulse" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;measurement&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17248" PostTypeId="1" AcceptedAnswerId="17256" CreationDate="2021-04-26T09:59:31.620" Score="4" ViewCount="49" Body="&lt;p&gt;Say I have a binary classification network, which takes in inputs and classifies them. I can put in different inputs and get the same output, right? So does that not make QML non reversible, since just by looking at the output, I will never know the input?&lt;/p&gt;&#xA;" OwnerUserId="15630" LastEditorUserId="55" LastEditDate="2021-04-26T11:12:36.693" LastActivityDate="2021-04-26T19:05:24.453" Title="How is quantum machine learning reversible?" Tags="&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17250" PostTypeId="1" CreationDate="2021-04-26T12:17:42.170" Score="3" ViewCount="19" Body="&lt;p&gt;Let me consider a (quantum) Harmonic oscillator of (bare) Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_0=\frac{p^2}{2m}+\frac{1}{2} m \omega^2 x^2$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;(I can add to it an anharmonicity &lt;span class=&quot;math-container&quot;&gt;$V=\alpha x^4$&lt;/span&gt; if necessary for the purpose of this question.)&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;The main purpose of my question is to know how we can properly approximate it to a two level system as often done in superconducting qubit.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Harmonic oscillator annihilation/creation operators are defined as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$a=\sqrt{\frac{\hbar}{2 m \omega}}(x+\frac{i}{m \omega}p)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$a^{\dagger}=\sqrt{\frac{\hbar}{2 m \omega}}(x-\frac{i}{m \omega}p)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I end up with &lt;span class=&quot;math-container&quot;&gt;$H_0=\hbar \omega a^{\dagger} a$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, let's assume that for any reason I know that the dynamic should be restricted to the two first levels only: &lt;em&gt;I want to approximate my system by a two level system.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;One way that I thought we could do is to take the energy gap &lt;span class=&quot;math-container&quot;&gt;$\hbar \omega_0$&lt;/span&gt; between the two first level, and to consider:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H_0=-\frac{\hbar \omega_0}{2} \sigma_z$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But let's assume that our oscillator is interacting with a driving field &lt;span class=&quot;math-container&quot;&gt;$F(t)$&lt;/span&gt; via:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H=H_0+H_d(t)$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_d=f(p)*F(t)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$f(p)$&lt;/span&gt; is a polynome in &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; for instance. &lt;strong&gt;How should I modify &lt;span class=&quot;math-container&quot;&gt;$f(p)$&lt;/span&gt; for the two level approximation&lt;/strong&gt; ?&lt;/p&gt;&#xA;&lt;p&gt;I initially believed that the mapping oscillator &lt;span class=&quot;math-container&quot;&gt;$\to$&lt;/span&gt; qubit would consist in &lt;span class=&quot;math-container&quot;&gt;$a \to \sigma_-$&lt;/span&gt;. But doing so we end up with &lt;span class=&quot;math-container&quot;&gt;$p^{2n}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x^{2n}$&lt;/span&gt; being proportional to identity (if &lt;span class=&quot;math-container&quot;&gt;$H_d(t)$&lt;/span&gt; involves even power of &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; the interaction then vanishes).&lt;/p&gt;&#xA;&lt;p&gt;Indeed,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p=i\sqrt{\frac{\hbar m \omega}{2}}(a^{\dagger}-a) \to \sqrt{\frac{\hbar m \omega}{2}} \sigma_y$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$x=\sqrt{\frac{\hbar}{2 m \omega}}(a^{\dagger}+a) \to \sqrt{\frac{\hbar}{2 m \omega}} \sigma_x$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;My question is thus:&lt;/p&gt;&#xA;&lt;p&gt;How, given an oscillator potentially interacting with &amp;quot;something else&amp;quot; with polynomial interaction in &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; should I define the associated two level description. For the &amp;quot;bare&amp;quot; Hamiltonian it is clear but as soon as interaction are involved it is not so clear for me. Is it normal that indeed terms of order &lt;span class=&quot;math-container&quot;&gt;$p^2$&lt;/span&gt; vanish in the interaction ?&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2021-04-26T12:17:42.170" Title="Clean way of approximating an oscillator by a qubit" Tags="&lt;physical-qubit&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17252" PostTypeId="1" CreationDate="2021-04-26T15:54:29.717" Score="2" ViewCount="28" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/0512217.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;This thesis&lt;/a&gt; shows an efficient way to estimate average channel fidelity (in chapter 4). However, it is somewhat old (from 2005). Are there any better methods out there? By &lt;em&gt;better&lt;/em&gt; I mean: are there other methods that can achieve the same accuracy of estimation but with fewer qubits? (or put another way, are there methods that can achieve higher accuracy with the same amount of qubits)&lt;/p&gt;&#xA;&lt;p&gt;I imagine some methods for fidelity estimation and/or quantum tomography of single qubits could be used to modify and improve the method from the thesis I cited. If so, does anyone specifically know which methods could be used, and how? Thanks!&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="55" LastEditDate="2021-04-27T09:52:33.947" LastActivityDate="2021-04-27T09:52:33.947" Title="What is the best method for estimating average channel fidelity?" Tags="&lt;quantum-operation&gt;&lt;fidelity&gt;&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17253" PostTypeId="1" CreationDate="2021-04-26T17:22:30.980" Score="5" ViewCount="28" Body="&lt;p&gt;This question is somewhat related to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/17252/what-is-the-best-method-for-estimating-average-channel-fidelity&quot;&gt;this question&lt;/a&gt;. What is currently the best method for quantum process tomography? By &lt;em&gt;best&lt;/em&gt; I mean, the one that can achieve the best accuracy of estimation per qubit used.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="55" LastEditDate="2021-04-27T09:52:27.700" LastActivityDate="2021-04-27T09:52:27.700" Title="What is the best quantum process tomography method?" Tags="&lt;quantum-operation&gt;&lt;fidelity&gt;&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="0" CommentCount="1" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17255" PostTypeId="1" CreationDate="2021-04-26T18:32:07.890" Score="3" ViewCount="212" Body="&lt;p&gt;Consider two quantum states&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi_1 \right&amp;gt; = \alpha  \left|0\right&amp;gt; + \beta\left|1\right&amp;gt;$$&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$$\left| \psi_2 \right&amp;gt; = \gamma  \left|0\right&amp;gt; + \delta\left|1\right&amp;gt;$$&lt;/span&gt;&#xA;Now tensor product of two states gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; =  \left|\psi_1\right&amp;gt; \otimes \left|\psi_2\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\left| \psi \right&amp;gt; = \alpha\gamma  \left|00\right&amp;gt; + \alpha\delta\left|01\right&amp;gt; + \beta\gamma  \left|10\right&amp;gt; + \beta\delta\left|11\right&amp;gt;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to factor the state &lt;span class=&quot;math-container&quot;&gt;$\left| \psi \right&amp;gt; $&lt;/span&gt; and get &lt;span class=&quot;math-container&quot;&gt;$\left| \psi_1 \right&amp;gt; $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left| \psi_2 \right&amp;gt;  $&lt;/span&gt; back?&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-04-27T09:46:37.137" LastActivityDate="2021-04-27T09:46:37.137" Title="Is it possible to retrieve $|\psi_1\rangle,|\psi_2\rangle$ from their tensor product $|\psi_1\rangle\otimes|\psi_2\rangle$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;tensor-product&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17256" PostTypeId="2" ParentId="17248" CreationDate="2021-04-26T19:05:24.453" Score="4" Body="&lt;p&gt;There are a couple of ways reversibility might be coming into play in this context. The first is that the measurement at the end of the circuit will be typically be an irreversible step. For example one scheme for training a quantum circuit to classify &lt;em&gt;classical&lt;/em&gt; data is by encoding each data point &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; (with a corresponding &lt;span class=&quot;math-container&quot;&gt;$0,1$&lt;/span&gt; label &lt;span class=&quot;math-container&quot;&gt;$y_i$&lt;/span&gt; for the binary classification task)  in your dataset into a state &lt;span class=&quot;math-container&quot;&gt;$\rho(x_i)$&lt;/span&gt; (probably using a unitary parameterized by &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$\rho(x_i) = U(x_i) |0 \rangle \langle 0| U^\dagger(x_i)$&lt;/span&gt;) and then learning some observable &lt;span class=&quot;math-container&quot;&gt;$M(\theta)$&lt;/span&gt; to classify these &lt;em&gt;quantum&lt;/em&gt; states according to a rule like&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;f(x_i) = \text{sign} \left[ \text{Tr} \left(\rho(x_i) M(\theta) \right)\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and then training the quantum circuit will consist of finding &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; such that that &lt;span class=&quot;math-container&quot;&gt;$\text{Pr}(f(x_i)=y_i)$&lt;/span&gt; is maximized over some training set. Evaluating (1) is usually an irreversible process because it requires setting up a circuit with measurements that estimate &lt;span class=&quot;math-container&quot;&gt;$\langle M(\theta) \rangle$&lt;/span&gt;, and each of these measurements will end up &amp;quot;collapsing&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\rho(x_i)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A very different take on this question is to think about reversing the learning task itself. If we think of each training pattern and label &lt;span class=&quot;math-container&quot;&gt;$(x_i, y_i)$&lt;/span&gt; as being a pair of random variables &lt;span class=&quot;math-container&quot;&gt;$(X, Y)$&lt;/span&gt; drawn from a distribution &lt;span class=&quot;math-container&quot;&gt;$\text{Pr}(X, Y)$&lt;/span&gt;, then the goal of the above algorithm was to learn the conditional distribution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{2}&#xA;\text{Pr}(Y=y_i | X=x_i)&#xA;$$&lt;/span&gt;&#xA;therefore answering the question, &amp;quot;given a pattern &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, what is the likelihood that the true label was &lt;span class=&quot;math-container&quot;&gt;$y_i$&lt;/span&gt;?&amp;quot;. But one may instead be interested in a &lt;em&gt;generative model&lt;/em&gt; where the goal is to learn a function approximating&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;\text{Pr}(X=x_i| Y=y_i)&#xA;$$&lt;/span&gt;&#xA;which answers the question, &amp;quot;if I am provided a label &lt;span class=&quot;math-container&quot;&gt;$y_i$&lt;/span&gt;, what is the corresponding distribution of patterns &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; with that label?&amp;quot;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; Of course (3) isn't a unique function sending &lt;span class=&quot;math-container&quot;&gt;$y_i \rightarrow x_i$&lt;/span&gt; so its not &amp;quot;reversible&amp;quot; in the sense of being invertible, but knowledge of this likelihood &lt;em&gt;does&lt;/em&gt; allow you to sample a reasonable set of datapoints &lt;span class=&quot;math-container&quot;&gt;$\{x_i\}$&lt;/span&gt; given a single label &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;. There has been some recent research into &amp;quot;quantum generative models&amp;quot; that propose using quantum computers to do just this, and so you might find some interesting topics in that area.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; This task is generally much harder; one way to understand this is that if you learn (3) then you will immediately have an optimal Bayes classifier that is at least as good at classifying input data as any other model.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-04-26T19:05:24.453" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17257" PostTypeId="2" ParentId="17255" CreationDate="2021-04-26T19:27:30.923" Score="4" Body="&lt;p&gt;Yes, it is possible. You have two expressions for the state &lt;span class=&quot;math-container&quot;&gt;$x_0|00\rangle + x_1|01\rangle + x_2|10\rangle + x_3|11\rangle = \alpha\gamma  \left|00\right&amp;gt; + \alpha\delta\left|01\right&amp;gt; + \beta\gamma  \left|10\right&amp;gt; + \beta\delta\left|11\right&amp;gt;$&lt;/span&gt;, you just need to solve the system of equations&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{cases}&#xA;\alpha\gamma = x_0 \\&#xA;\alpha\delta = x_1 \\&#xA;\beta \gamma = x_2 \\&#xA;\beta \delta = x_3 \\&#xA;\end{cases}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If the system of equations has a solution, you got your answer, and as a bonus you know that your quantum system is separable (i.e., the qubits are not entangled).&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-04-26T19:27:30.923" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17258" PostTypeId="2" ParentId="17255" CreationDate="2021-04-26T21:10:09.207" Score="2" Body="&lt;p&gt;Yes, you can factor it. For example, this is what &lt;a href=&quot;https://github.com/quantumlib/Cirq/blob/12530f1531e5da663a6b172b1967763e08819912/cirq-core/cirq/linalg/transformations.py#L387&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;cirq.sub_state_vector&lt;/code&gt;&lt;/a&gt; does and also how the amplitude displays work in Quirk.&lt;/p&gt;&#xA;&lt;p&gt;The basic idea is that to factor out &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; from &lt;span class=&quot;math-container&quot;&gt;$A \otimes B$&lt;/span&gt; you look at a non-zero part of the wavefunction where B is held constant. This tells you what &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has to be proportional to, and you can check that the other parts of the wavefunction are consistent with this. Then you use the ratios between those pieces to derive &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-26T21:10:09.207" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17259" PostTypeId="1" AcceptedAnswerId="17266" CreationDate="2021-04-26T21:18:44.653" Score="0" ViewCount="45" Body="&lt;p&gt;The unitary matrix associated with the &lt;code&gt;QFT&lt;/code&gt; circuit in Qiskit does not match the actual DFT matrix. In fact, all the imaginary components have their sign flipped (QFT and DFT matrices seems to be each other's complex conjugate). Is that the correct behavior?&lt;/p&gt;&#xA;&lt;p&gt;Note that the &lt;code&gt;QFT&lt;/code&gt; circuit already includes the swap gates at the end of the circuit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from scipy.linalg import dft&#xA;from qiskit import *&#xA;from qiskit.circuit.library import QFT&#xA;&#xA;n = 2&#xA;dft_matrix = (1/np.sqrt(2**n)) * dft(2**n)&#xA;qft_matrix = execute(QFT(n), Aer.get_backend('unitary_simulator')).result().get_unitary()&#xA;&#xA;# remove components almost zero for enhanced visualization&#xA;eps = 0.00001&#xA;dft_matrix.real[np.abs(dft_matrix.real) &amp;lt; eps] = 0&#xA;dft_matrix.imag[np.abs(dft_matrix.imag) &amp;lt; eps] = 0&#xA;qft_matrix.real[np.abs(qft_matrix.real) &amp;lt; eps] = 0&#xA;qft_matrix.imag[np.abs(qft_matrix.imag) &amp;lt; eps] = 0&#xA;&#xA;dft_matrix, qft_matrix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The matrices have values:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dft_matrix=&#xA;array([[  0.5+0.j ,  0.5+0.j ,  0.5+0.j ,  0.5+0.j ],&#xA;        [ 0.5+0.j ,  0. -0.5j, -0.5+0.j ,  0. +0.5j],&#xA;        [ 0.5+0.j , -0.5+0.j ,  0.5+0.j , -0.5+0.j ],&#xA;        [ 0.5+0.j ,  0. +0.5j, -0.5+0.j ,  0. -0.5j]]),&#xA;qft_matrix=&#xA;array([[  0.5+0.j ,  0.5+0.j ,  0.5+0.j ,  0.5+0.j ],&#xA;        [ 0.5+0.j ,  0. +0.5j, -0.5+0.j ,  0. -0.5j],&#xA;        [ 0.5+0.j , -0.5+0.j ,  0.5+0.j , -0.5+0.j ],&#xA;        [ 0.5+0.j ,  0. -0.5j, -0.5+0.j ,  0. +0.5j]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="55" LastEditDate="2021-04-27T09:47:08.410" LastActivityDate="2021-04-27T09:47:08.410" Title="Qiskit QFT matrix does not match with DFT matrix" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17260" PostTypeId="1" AcceptedAnswerId="17261" CreationDate="2021-04-26T22:30:23.293" Score="3" ViewCount="132" Body="&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha |0\rangle + \beta |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2 + |\beta|^2 = 1$&lt;/span&gt;, what would the quantum Fourier transform of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; be? I know it is of the form &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(x |0\rangle + y |1\rangle)$&lt;/span&gt;, but how would I determine &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Is it possible that &lt;span class=&quot;math-container&quot;&gt;$QFT(|\psi\rangle) = |\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="55" LastEditDate="2021-05-08T13:10:10.030" LastActivityDate="2021-05-08T13:10:10.030" Title="What is the quantum Fourier transform of $\alpha|0\rangle+\beta|1\rangle$?" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17261" PostTypeId="2" ParentId="17260" CreationDate="2021-04-26T22:38:41.717" Score="4" Body="&lt;p&gt;Quantum Fourier transform for a single-qubit case is just the Hadamard gate, so&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$QFT |\psi\rangle = \alpha H|0\rangle + \beta H|1\rangle = \frac{\alpha+\beta}{\sqrt2}|0\rangle + \frac{\alpha-\beta}{\sqrt2}|1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And &lt;span class=&quot;math-container&quot;&gt;$QFT(|\psi\rangle) = |\psi\rangle$&lt;/span&gt; is possible if &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-04-26T22:38:41.717" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17262" PostTypeId="1" AcceptedAnswerId="17265" CreationDate="2021-04-26T23:47:01.367" Score="4" ViewCount="235" Body="&lt;p&gt;Given the following system:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix}0 &amp;amp; 1 &amp;amp; 0\\1 &amp;amp; 1 &amp;amp; 1\\1 &amp;amp; 0 &amp;amp; 1\end{bmatrix} &#xA;  \begin{bmatrix}s_2\\ s_1\\ s_0\end{bmatrix} = \begin{bmatrix}0\\ 0\\ 0\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How could one implement a circuit such that the output is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; when &lt;span class=&quot;math-container&quot;&gt;$|s_0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|s_1\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|s_2\rangle$&lt;/span&gt; are solutions? Is this possible using Grover's algorithm and without hardcoding the solutions?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="55" LastEditDate="2021-04-27T09:56:24.273" LastActivityDate="2021-05-08T10:17:05.617" Title="How could one implement a circuit using Grover's algorithm to solve a linear system of equations?" Tags="&lt;grovers-algorithm&gt;&lt;quantum-circuit&gt;&lt;simons-algorithm&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17263" PostTypeId="1" CreationDate="2021-04-27T02:49:45.177" Score="2" ViewCount="57" Body="&lt;p&gt;&lt;strong&gt;Background:&lt;/strong&gt; I wrote a code that takes a Qiskit circuit C as an input and outputs a random circuit C’ such that C and C’ have the same unitaries. I tested my code using Qiskit’s Statevector simulator and Qiskit’s unitary simulator (using np.allclose). I tested over 20 circuits of various sizes, all passed the tests successfully, EXCEPT for one circuit, where sometimes I get the same unitaries and state vectors and sometimes I don’t. The circuit is quite large, with 10 qubits, 20 CNOT’s and a bunch of non-Clifford gates. The random output for this circuit can be incredibly large (e.g., more than 300 layers and a ridiculous number of CNOT’s). I’m pretty sure that there’s no error in my code, which leads me to ask:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question:&lt;/strong&gt; is there a certain size/complexity threshold of a circuit beyond which Qiskit’s unitary and Statevector simulators might return inaccurate results? In case that this never happens, is there any other explanation for the peculiar behavior that I described?&lt;/p&gt;&#xA;" OwnerUserId="15674" LastEditorUserId="55" LastEditDate="2021-04-27T09:56:04.817" LastActivityDate="2021-04-27T09:56:04.817" Title="How accurate are Qiskit’s unitary and Statevector simulators for very large circuits?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;simulation&gt;&lt;unitarity&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17264" PostTypeId="1" CreationDate="2021-04-27T06:09:06.870" Score="3" ViewCount="51" Body="&lt;p&gt;Quantum Measurement can be divided into General Measurements, Projective measurements and general POVMs. And there are also some special kinds of quantum measurements that have their own name, such as :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;adiabatic measurement (protective measurement)&lt;/li&gt;&#xA;&lt;li&gt;weak measurement&lt;/li&gt;&#xA;&lt;li&gt;quantum nondemolition measurement and so on.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Is there a list of those special kinds of measurements?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-04-27T10:05:48.907" LastActivityDate="2021-04-27T10:05:48.907" Title="Is there a list of known quantum measurements?" Tags="&lt;measurement&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17265" PostTypeId="2" ParentId="17262" CreationDate="2021-04-27T07:44:38.370" Score="7" Body="&lt;p&gt;You certainly &lt;em&gt;could&lt;/em&gt; use Grover's search. You would create 2 registers. This first, of 3 qubits, would effectively store the &lt;span class=&quot;math-container&quot;&gt;$\{s_0,s_1,s_2\}$&lt;/span&gt;. This is the standard register for Grovers on which you apply the Grover iterator. Then, you'd have a second register of at least 3 qubits. You construct the search oracle by evaluating the matrix multiplication on the second register (I say that you need at least 3 qubits, because I haven't checked what you need to implement the calculation reversibly). Then you do a multi-controlled-phase gate which introduces a -1 phase only if all the qubits in the second register were in the 0 state (matching your target on the right-hand side). Then you reverse the computation of the matrix multiplication.&lt;/p&gt;&#xA;&lt;p&gt;However, just because you &lt;em&gt;can&lt;/em&gt; do this, doesn't mean that you &lt;em&gt;should&lt;/em&gt;. Computing the solution to this classically is linear in the number of variables. You should not be solving it by testing all possible examples of the input variables. Grover is usually applied to cases where the classical computation requires exponentially many steps. I think it is extremely unlikely that Grover would give you a computational advantage in this case.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;the Grover oracle may be implemented as follows:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/szDkv.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/szDkv.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;To understand how this works, focus on the first 3 steps. Look at the pattern of the targets along a given ancilla and how it corresponds to a row in your target matrix.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-04-27T15:46:04.003" LastActivityDate="2021-04-27T15:46:04.003" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17266" PostTypeId="2" ParentId="17259" CreationDate="2021-04-27T08:27:38.063" Score="1" Body="&lt;p&gt;According to the docs of &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.dft.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;scipy&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/quantum-fourier-transform.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit&lt;/a&gt;, the first uses primitive root &lt;span class=&quot;math-container&quot;&gt;$\omega = e^{-\frac{2\pi i}{n}}$&lt;/span&gt; and the second uses &lt;span class=&quot;math-container&quot;&gt;$\omega = e^{\frac{2\pi i}{n}}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This implies that one matrix is complex conjugate of the other (which is the same as inverse).&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-04-27T08:27:38.063" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17267" PostTypeId="1" AcceptedAnswerId="17268" CreationDate="2021-04-27T11:21:59.603" Score="2" ViewCount="58" Body="&lt;p&gt;I am having difficulties with the calculations of qubits.&#xA;I think I can do them, but it feels so massivly inefficient!&lt;/p&gt;&#xA;&lt;p&gt;In this tutorial &lt;a href=&quot;https://www.quantum-inspire.com/kbase/grover-algorithm/&quot; rel=&quot;nofollow noreferrer&quot;&gt;grover's algorithm&lt;/a&gt; for example, there's a simple oracle given for the binary bitcombination '110':&#xA;(bit-order is as usual swapped, so most significant bit is q2 - at least I think so)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PPWwo.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PPWwo.png&quot; alt=&quot;grover oracle for 110&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;what I've tried so far:&lt;/p&gt;&#xA;&lt;p&gt;let &lt;span class=&quot;math-container&quot;&gt;$a = |110&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;the first step I thought would be to apply the x on the top bit and the Hadamard on the bottom bit so:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a' = |111&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a'' = \frac{1}{\sqrt{2}}(|011&amp;gt; - |111&amp;gt;)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;next I would think: only when the second and third bit are equal to 1 then the first bit swaps:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a''' = \frac{1}{\sqrt{2}}(|111&amp;gt; - |011&amp;gt;)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;next I negate the top (third) bit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$a^{4'} = \frac{1}{\sqrt{2}}(|110&amp;gt; - |010&amp;gt;)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and finally I use Hadamard on the bottom (first) bit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\displaystyle a^{5'} = \frac{1}{2} \Big(|010&amp;gt; - |110&amp;gt; -\big(|010&amp;gt; + |110&amp;gt;\big)\Big)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$= -|110&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and yes, thats exactly what I want. But is there a way to calculate this alternively with some matrices or tensors? where I can use the form of&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$ |110&amp;gt; = \begin{pmatrix} 0\\0\\0\\0\\0\\0\\1\\0 \end{pmatrix}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;How can I represent the layer with X() and H() mixed?&lt;/p&gt;&#xA;" OwnerUserId="15493" LastEditorUserId="55" LastEditDate="2021-04-28T09:17:27.660" LastActivityDate="2021-04-28T09:17:27.660" Title="How to calculate the evolution of ket states through a simple quantum circuit?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17268" PostTypeId="2" ParentId="17267" CreationDate="2021-04-27T11:43:55.120" Score="2" Body="&lt;p&gt;First of all: the bit-order that you use is not the conventional one in quantum computing. We usually use the convention that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|x_1 x_2 \dots x_n \rangle = |x_1\rangle \otimes |x_2\rangle \otimes \dots \otimes |x_n\rangle,&#xA;$$&lt;/span&gt;&#xA;i.e. the &amp;quot;first&amp;quot; bit &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; corresponds to the &amp;quot;first&amp;quot; qubit which is usually the top one in the circuit notation. I agree, this is completely arbitrary.&lt;/p&gt;&#xA;&lt;p&gt;Now to your actual question: There is nothing wrong with you calculation. You could have noticed that conjugating by &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; on the target qubit turns &lt;span class=&quot;math-container&quot;&gt;$CCX$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$CCZ$&lt;/span&gt;. This would have saved two steps in your calculation.&lt;/p&gt;&#xA;&lt;p&gt;Of course, you can instead express everything in terms of 3-qubit matrices (which are of size &lt;span class=&quot;math-container&quot;&gt;$2^3\times 2^3 = 8\times 8$&lt;/span&gt;). Then, the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; / &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; layer would be represented by the matrix &lt;span class=&quot;math-container&quot;&gt;$X\otimes \mathbb{I}\otimes H$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\mathbb{I}$&lt;/span&gt; is the identity matrix.&lt;/p&gt;&#xA;&lt;p&gt;But please don't do this. This is highly inefficient, especially if you deal with an arbitrary amount of qubits. The whole point of &lt;em&gt;local gates&lt;/em&gt; is that they can be applied &lt;em&gt;locally&lt;/em&gt;. This only requires to update the local states which can be done efficiently as long as the number of terms in you superposition is not too big. On the contrary, multiplying &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit matrices is always inefficient.&lt;/p&gt;&#xA;" OwnerUserId="2305" LastEditorUserId="2305" LastEditDate="2021-04-27T12:01:46.610" LastActivityDate="2021-04-27T12:01:46.610" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17269" PostTypeId="1" CreationDate="2021-04-27T11:48:23.273" Score="3" ViewCount="21" Body="&lt;p&gt;Assume you have some &lt;strong&gt;quantum process&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; (e.g. quantum state tomography) that intakes initialised states &lt;span class=&quot;math-container&quot;&gt;$\rho_{i}$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$i=1,\ldots,n$&lt;/span&gt; and gives some output &lt;span class=&quot;math-container&quot;&gt;$\rho'_i$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_1 \to Q \to \rho'_1 \\&#xA;\rho_3 \to Q \to \rho'_2 \\&#xA;\vdots \\&#xA;\rho_n \to Q \to \rho'_n&#xA;$$&lt;/span&gt;&#xA;Then, assume we can estimate these outputs using some method and we produce estimates &lt;span class=&quot;math-container&quot;&gt;$\hat \rho_i$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat \rho_1 \text{ estimates } \rho'_1 \\&#xA;\hat \rho_2 \text{ estimates } \rho'_2 \\&#xA;\vdots \\&#xA;\hat \rho_n \text{ estimates } \rho'_n \\&#xA;$$&lt;/span&gt;&#xA;How can I use the notion of the &lt;strong&gt;Quantum Fisher Information&lt;/strong&gt; for finding bounds on how well these output states &lt;span class=&quot;math-container&quot;&gt;$\rho'_i$&lt;/span&gt; can be estimated by my methods? E.g. if the density matrix formed by the initial states corresponds to that of a qubit (&lt;span class=&quot;math-container&quot;&gt;$n=4)$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_{i=1}^{4} \lambda_i |i\rangle \langle i | = \sum_{i=1}^{4} \lambda_i \rho_i.&#xA;$$&lt;/span&gt;&#xA;In this case, do I need to compute  &lt;span class=&quot;math-container&quot;&gt;$F_Q[\rho,\hat\rho]$&lt;/span&gt;? If so, how is this done? System can be closed for simplicity so that evolution is unitary.&lt;/p&gt;&#xA;" OwnerUserId="15676" LastEditorUserId="55" LastEditDate="2021-04-27T12:37:38.333" LastActivityDate="2021-04-27T12:37:38.333" Title="How does the quantum Fisher information provide bounds for the estimation of output states?" Tags="&lt;quantum-state&gt;&lt;tomography&gt;&lt;quantum-fisher-information&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17271" PostTypeId="2" ParentId="17209" CreationDate="2021-04-27T12:18:19.330" Score="2" Body="&lt;p&gt;In response to my own question, I'm thinking Aaronson stated somewhere (I can't find the reference) that the quadratic speedup of e.g. Grover search arises from the fact that probability is amplitude &lt;em&gt;squared&lt;/em&gt;, hence linear effort spent improving the amplitude of a correct answer equates to quadratic improvement in the probability of measuring it. This underlying mechanism is obviously shared by both quantum walks and quantum annealing.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, though this is an informal guess, quantum annealing can presumably itself be analysed as a quantum walk on a graph in which we define the reachability of each node from other nodes using a potential/kinetic-energy-based formulation. Such a graph would have nodes which themselves are unreachable (because too much energy is required) but which do not block access to nodes beyond them. Tunneling would therefore be a special case of a quantum walk on a particular definition of graph.&lt;/p&gt;&#xA;&lt;p&gt;Seen that way, both phenomena share the property that the likely hit time of certain nodes depends heavily on the structure of the graph, hence &amp;quot;some things happen faster, others happen slower&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="5174" LastEditorUserId="5174" LastEditDate="2021-05-04T19:22:07.723" LastActivityDate="2021-05-04T19:22:07.723" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17272" PostTypeId="1" AcceptedAnswerId="17279" CreationDate="2021-04-27T12:18:29.590" Score="6" ViewCount="83" Body="&lt;p&gt;In the Qiskit tutorial on Grover's algorithm it is stated that with a 2 qubit algorithm the chance of measuring the &amp;quot;right&amp;quot; state is already 100%.&lt;/p&gt;&#xA;&lt;p&gt;But I thought that the algorithm would amplify the 'right' amplitude around 9 times and respectively the probability around 3 times.&lt;/p&gt;&#xA;&lt;p&gt;Is this depending on the variation of grovers algorithm used? Where does the 100% suddenly came from, if other multi-qubit states do not get to 100%?&lt;/p&gt;&#xA;&lt;p&gt;Edit:&#xA;I want to work with the &lt;a href=&quot;http://arxiv-export-lb.library.cornell.edu/pdf/0810.3828&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Reinforcement Learning Paper of Dong et al.&lt;/a&gt;&#xA;There they propose to use some sort of grovers algorithm to make use of the probability amplification of a 2 qubit system. This would need a slower approach to 100% as far as I understand. There would be no point in their proposal, if it reaches 100% after just 1 iteration.&lt;/p&gt;&#xA;" OwnerUserId="15493" LastEditorUserId="5955" LastEditDate="2021-04-27T19:44:43.590" LastActivityDate="2021-04-28T02:41:16.127" Title="Does Grover's algorithm always give the correct answer with 100% certainty for two-qubit states?" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17273" PostTypeId="1" AcceptedAnswerId="17274" CreationDate="2021-04-27T15:15:22.197" Score="2" ViewCount="71" Body="&lt;p&gt;Say I have a secret of length &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$s = |x_{n-1}x_{n-2}...x_0 \rangle$&lt;/span&gt;. If I want to construct an oracle for this problem would I just insert a CNOT gate on every qubit where the secret's value is 1? And just do nothing to all of the 0 qubits?&lt;/p&gt;&#xA;&lt;p&gt;How would I determine the asymptotic complexity of this circuit in its worst-case situation?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="55" LastEditDate="2021-04-28T09:15:09.787" LastActivityDate="2021-04-28T09:15:09.787" Title="How do I construct the oracle for a general Bernstein-Vazirani circuit?" Tags="&lt;complexity-theory&gt;&lt;quantum-circuit&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17274" PostTypeId="2" ParentId="17273" CreationDate="2021-04-27T16:59:10.533" Score="3" Body="&lt;p&gt;Yes, that is right. If you think about it, &lt;span class=&quot;math-container&quot;&gt;$CNOT|x\rangle |s\rangle = |x\rangle|x \oplus s \rangle \ $&lt;/span&gt;. Thus, giving a secret bitstring &lt;span class=&quot;math-container&quot;&gt;$s = s_1 s_2 \cdots s_n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$s_i \in \{0,1\}$&lt;/span&gt;, then whenever &lt;span class=&quot;math-container&quot;&gt;$s_i$&lt;/span&gt; is non-zero (&lt;span class=&quot;math-container&quot;&gt;$s_i = 1$&lt;/span&gt;), performing a CNOT gate between the ancilla qubit and the &lt;span class=&quot;math-container&quot;&gt;$ith$&lt;/span&gt; qubit in your input qubits (note that you have &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; input qubits and one ancilla qubit in your circuit) is equivalent to performing &lt;span class=&quot;math-container&quot;&gt;$x_i \cdot s_i $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus, everywhere there is a non-zero element in your secret bitstring &lt;span class=&quot;math-container&quot;&gt;$s = s_1 s_2 \cdots s_n $&lt;/span&gt; you apply a CNOT gate between the ancilla qubit and the &lt;span class=&quot;math-container&quot;&gt;$ith$&lt;/span&gt; input qubit. And anywhere the secret bitstring is zero, you don't do anything.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For example: Suppose your secret bitstring is &lt;span class=&quot;math-container&quot;&gt;$s = 0110$&lt;/span&gt; then you would have the following circuit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/aZAyt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/aZAyt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;The worst case scenario is when your secret bitstring is non-zero every where. &lt;span class=&quot;math-container&quot;&gt;$s = 111\cdots 1$&lt;/span&gt;. In such case, you have to perform &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; CNOT gates. But note that, on a quantum computer, not all the qubits are connected. So you can't just perform CNOT gate between any pair of qubit you pleased, you need to do some &lt;strong&gt;swapping&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For instance, look at the qubit layout in &lt;code&gt;ibmq_16_melbourne&lt;/code&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/3k9Pw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/3k9Pw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;you can see that qubit 0 is not connected directly to qubit 13. Hence, to perform a CNOT between qubit 0 and 13, you would need to &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.SwapGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;SWAP&lt;/a&gt; qubit 13 and 14 first, perform the CNOT, then SWAP it back... so the actual circuit running on current hardware will be longer than what you see on paper.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-04-27T16:59:10.533" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17275" PostTypeId="1" CreationDate="2021-04-27T20:46:46.967" Score="2" ViewCount="131" Body="&lt;p&gt;For example, if an adversary were to get hold of one half of an entangled 2-qubit quantum state,  &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;, travelling along a channel, would they be able to entangle one of their own qubits with that state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;, and then re-insert &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; back into the channel unaffected? (even though they do not know the value of &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;To further elaborate:&#xA;A 'sender' &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, prepare two qubits (denoted as &lt;span class=&quot;math-container&quot;&gt;$|\psi_1 \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle$&lt;/span&gt;) entangled with each other as the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; sends one of the qubits, &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle$&lt;/span&gt;, to a 'receiver' &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; along some channel. While the qubit, with state &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle$&lt;/span&gt;, is travelling through the channel on its way to reach &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;, an 'adversary', call them &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, entangles one of their own qubits with the qubit &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; sent, without affecting its state &lt;span class=&quot;math-container&quot;&gt;$|\psi_2 \rangle$&lt;/span&gt;. Thus, resulting in &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; qubits all entangled with each other, and the &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; original qubit states &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; prepared are maintained. &lt;em&gt;Is this scenario possible??&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;edit&lt;/strong&gt;: I didn't frame my question in the way I meant to. It is obvious that the state will change if entangling a third qubit with it: it is now a new state of 3 qubits instead of 2. My question I was really trying to ask was: can an 'adversary' make a third qubit be entangled with an existing 2 qubit entangled pair, in a way such that the 'sender' and 'receiver' are unaware of it. My answer down below explains how this is possible.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="14239" LastEditDate="2021-05-06T16:04:35.170" LastActivityDate="2021-05-06T16:13:24.530" Title="Can a qubit be entangled with an arbitrary quantum state, without altering it?" Tags="&lt;entanglement&gt;&lt;quantum-operation&gt;&lt;cryptography&gt;" AnswerCount="4" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17276" PostTypeId="2" ParentId="17275" CreationDate="2021-04-27T21:33:08.720" Score="2" Body="&lt;p&gt;No. This is related to the no-cloning theorem. At least, I think it is.&lt;/p&gt;&#xA;&lt;p&gt;If this were possible, quantum key distribution wouldn't be secure.&lt;/p&gt;&#xA;&lt;p&gt;One definite issue with the possibility is that it violates monogamy of entanglement: if a qubit is perfectly entangled with another, then it cannot be entangled at all with anything else. So if the quantum state in question is half of a Bell pair, then it is not possible to entangle it with anything else without affecting it.&lt;/p&gt;&#xA;&lt;p&gt;Therefore it is impossible to do this in general.&lt;/p&gt;&#xA;" OwnerUserId="1949" LastEditorUserId="1949" LastEditDate="2021-04-28T22:42:21.170" LastActivityDate="2021-04-28T22:42:21.170" CommentCount="9" ContentLicense="CC BY-SA 4.0" />
  <row Id="17277" PostTypeId="2" ParentId="17033" CreationDate="2021-04-27T21:39:55.203" Score="3" Body="&lt;h2&gt;TL;DR&lt;/h2&gt;&#xA;&lt;p&gt;Quantum capacity of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_2\circ\mathcal{N}_1$&lt;/span&gt; can be anywhere between zero and the minimum of the quantum capacities of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;Quantum capacity of a quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; is defined as the greatest real number &lt;span class=&quot;math-container&quot;&gt;$Q(\mathcal{N})$&lt;/span&gt; such that for any &lt;span class=&quot;math-container&quot;&gt;$R &amp;lt; Q(\mathcal{N})$&lt;/span&gt; (representing a transmission rate) and any &lt;span class=&quot;math-container&quot;&gt;$\delta &amp;gt; 0$&lt;/span&gt; (representing an acceptable error rate), there exists a quantum error correcting code with encoding operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; that maps &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits into &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; inputs to the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; and decoding operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}$&lt;/span&gt; that maps &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; outputs from the channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; qubits which enables recovery of any &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-qubit input state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with fidelity &lt;span class=&quot;math-container&quot;&gt;$1-\delta$&lt;/span&gt; and such that &lt;span class=&quot;math-container&quot;&gt;$\frac{m}{n} &amp;gt; R$&lt;/span&gt;. See also discussion on page &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and figure &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; on page &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt; in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9701015&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_2\circ\mathcal{N}_1$&lt;/span&gt; denote the channel representing the application of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_1$&lt;/span&gt; followed by the application of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_2$&lt;/span&gt; and note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;0 \le Q(\mathcal{N}_2\circ\mathcal{N}_1) \le \min(Q(\mathcal{N}_1),Q(\mathcal{N}_2)).\tag1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first inequality follows from the fact &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; in the definition above are non-negative integers and therefore &lt;span class=&quot;math-container&quot;&gt;$Q(\mathcal{N})$&lt;/span&gt; is a non-negative real number for any channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt;. The second inequality follows from the fact that we can absorb &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_1$&lt;/span&gt; (respectively, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_2$&lt;/span&gt;) into the encoding operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; (respectively, the decoding operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{D}$&lt;/span&gt;) to improve &lt;span class=&quot;math-container&quot;&gt;$Q(\mathcal{N}_2)$&lt;/span&gt; (respectively, &lt;span class=&quot;math-container&quot;&gt;$Q(\mathcal{N}_1)$&lt;/span&gt;) to at least &lt;span class=&quot;math-container&quot;&gt;$Q(\mathcal{N}_2\circ\mathcal{N}_1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Two extreme cases&lt;/h2&gt;&#xA;&lt;p&gt;Can we tighten the bounds in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;? It turns out that without additional assumptions on the channels, we can't. To show this, we will use the quantum erasure channel&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathcal{R}_\epsilon(\rho) = (1 - \epsilon)\rho + \epsilon|2\rangle\langle 2|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;to construct two examples, one saturating the left inequality in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and one saturating the right inequality. We choose the erasure channel because its quantum capacity is known and is given by the formula&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Q(\mathcal{R}_\epsilon) = \max(0, 1 - 2\epsilon),\tag2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;see equation &lt;span class=&quot;math-container&quot;&gt;$(2)$&lt;/span&gt; on page &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; (and figure &lt;span class=&quot;math-container&quot;&gt;$2(a)$&lt;/span&gt; on page &lt;span class=&quot;math-container&quot;&gt;$4$&lt;/span&gt;) in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9701015&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;. Now, the effect of composing two instances of the erasure channel is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;\mathcal{R}_\epsilon(\mathcal{R}_\epsilon(\rho)) &amp;amp;= (1 - \epsilon)\mathcal{R}_\epsilon(\rho) + \epsilon\mathcal{R}_\epsilon(|2\rangle\langle 2|) \\&#xA;&amp;amp;= (1 - \epsilon)^2\rho + (2\epsilon - \epsilon^2)|2\rangle\langle 2| \\&#xA;&amp;amp;= \mathcal{R}_{2\epsilon-\epsilon^2}(\rho).&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;0 &amp;amp;\le Q(\mathcal{R}_{1/3} \circ \mathcal{R}_{1/3}) \le \min(Q(\mathcal{R}_{1/3}), Q(\mathcal{R}_{1/3})) \\&#xA;0 &amp;amp;\le Q(\mathcal{R}_{5/9}) \le \min\left(\frac13, \frac13\right) \\&#xA;0 &amp;amp;\le 0 \le \frac13 \\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;saturating the left inequality in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{align}&#xA;0 &amp;amp;\le Q(\mathcal{R}_0 \circ \mathcal{R}_0) \le \min(Q(\mathcal{R}_0), Q(\mathcal{R}_0)) \\&#xA;0 &amp;amp;\le Q(\mathcal{R}_0) \le \min\left(1, 1\right) \\&#xA;0 &amp;amp;\le 1 \le 1 \\&#xA;\end{align}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;saturating the right inequality in &lt;span class=&quot;math-container&quot;&gt;$(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-04-27T21:39:55.203" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17279" PostTypeId="2" ParentId="17272" CreationDate="2021-04-27T23:25:29.403" Score="5" Body="&lt;p&gt;Good question! Short answer: No. It is true for search problems with only one solution but does not hold for search problems with more than one solution. For the long answer, I will need to define some terms (I'll try to use most of the same notation as in the &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit tutorial&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Suppose we wish to search through &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; elements, and that the search problem has exactly &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; solutions, with &lt;span class=&quot;math-container&quot;&gt;$1 \leq M \leq N$&lt;/span&gt;. As you know, the Grover iteration can be regarded as a rotation in the two-dimensional space &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^N$&lt;/span&gt; spanned by the starting vector &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; and the state consisting of a uniform superposition of solutions to the search problem, &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;. Following Qiskit's naming convention, we will also introduce the state &lt;span class=&quot;math-container&quot;&gt;$|s'\rangle$&lt;/span&gt;, which is in the span of these two vectors, and perpendicular to &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;. We can define these normalized states as,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|s'\rangle \equiv \frac{1}{\sqrt{N-M}}\sum_{x\neq\omega}|x\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|w\rangle \equiv \frac{1}{\sqrt{M}} \sum_{x=\omega}|x\rangle,$$&lt;/span&gt;&#xA;and can therefore express the initial state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; as,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|s\rangle = \sqrt{\frac{N-M}{N}}|s'\rangle+\sqrt{\frac{M}{N}}|\omega\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\sin{\theta} = \sqrt{M/N}$&lt;/span&gt;, so that &lt;span class=&quot;math-container&quot;&gt;$|s\rangle = \cos{\theta}|s'\rangle + \sin{\theta}|\omega\rangle$&lt;/span&gt;. The action of a single Grover iteration, &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt;, is to rotate the state vector by &lt;span class=&quot;math-container&quot;&gt;$2\theta$&lt;/span&gt; towards &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;. Based on the initial state, &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;, taking the system to &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; requires rotating through &lt;span class=&quot;math-container&quot;&gt;$\arccos{\sqrt{M/N}}$&lt;/span&gt; radians.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/grover.html#2.-Example:-2-Qubits-&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit's two-qubit example&lt;/a&gt;, we set &lt;span class=&quot;math-container&quot;&gt;$N=4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M=1$&lt;/span&gt;. This tells us that &lt;span class=&quot;math-container&quot;&gt;$\sin{\theta} = 1/2$&lt;/span&gt;, so &lt;span class=&quot;math-container&quot;&gt;$\theta = \pi/6$&lt;/span&gt;, and,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|s\rangle = \cos{(\pi/6)}|s'\rangle + \sin{(\pi/6)}|\omega\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From above, we know a single Grover iteration will rotate the state vector by &lt;span class=&quot;math-container&quot;&gt;$2\theta = \pi/3$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$G|s\rangle = \cos{(\pi/2)}|s'\rangle + \sin{(\pi/2)}|\omega\rangle = |\omega\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So, in this special case, only &lt;em&gt;exactly one&lt;/em&gt; iteration is required to perfectly obtain &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt;. However, this is not the case for all values &lt;span class=&quot;math-container&quot;&gt;$M/N$&lt;/span&gt;. For example, when &lt;span class=&quot;math-container&quot;&gt;$M/N &amp;lt;&amp;lt; 1$&lt;/span&gt; we have &lt;span class=&quot;math-container&quot;&gt;$\theta \approx \sin{\theta} \approx \sqrt{M/N}$&lt;/span&gt;, and thus the angular error of the final state can be as high as (but no greater than) &lt;span class=&quot;math-container&quot;&gt;$\theta \approx \sqrt{M/N}$&lt;/span&gt;, giving a probability of error as high as (but no greater than) &lt;span class=&quot;math-container&quot;&gt;$M/N$&lt;/span&gt;. Depending on the value &lt;span class=&quot;math-container&quot;&gt;$M/N$&lt;/span&gt; and whether &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is known in advance, alternate approaches to and various adaptations of Grover's algorithm are also used. When &lt;span class=&quot;math-container&quot;&gt;$M/N \geq 1/2$&lt;/span&gt;, we see that the angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; gets smaller as &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; varies from &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. As a result, the number of iterations needed by the search algorithm &lt;em&gt;increases&lt;/em&gt; with &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;. When &lt;span class=&quot;math-container&quot;&gt;$M/N$&lt;/span&gt; is this large, error probability can be as high as (by no greater than) one-half. Here, quantum search offers little significant advantage over a classical one. When &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is not known in advance, there are a number of different approaches. One clever procedure exploits the fact that the Grover iteration is periodic, and combines Grover iterations with an application of the quantum Fourier transform to learn the value of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; with enough accuracy to still ensure a high probability of success. Nielson and Chuang Section 6.1 and Mermim Chapter 4 are great for more on this topic.&lt;/p&gt;&#xA;&lt;p&gt;Hope that helps!&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-28T02:41:16.127" LastActivityDate="2021-04-28T02:41:16.127" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17280" PostTypeId="1" CreationDate="2021-04-28T01:28:21.733" Score="1" ViewCount="116" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ZfVQ9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ZfVQ9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;What does it mean for a circuit to be a valid instance of the Bernstein-Vazirani problem? It's not clear to me in the above circuit what the X gate is doing on the &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; qubit. I guess it's just inverting the result? That would mean this encodes the secret 1111, correct?&lt;/p&gt;&#xA;&lt;p&gt;Is this a valid instance? What function would you say the oracle is implementing, just an inversion?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="15648" LastEditDate="2021-05-01T17:53:06.987" LastActivityDate="2021-05-08T10:42:20.980" Title="What does it mean for a circuit to be a valid instance of the Bernstein-Vazirani problem?" Tags="&lt;quantum-circuit&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17281" PostTypeId="1" AcceptedAnswerId="17282" CreationDate="2021-04-28T01:54:04.837" Score="2" ViewCount="29" Body="&lt;p&gt;I'm new to quantum computing and Qiskit, so please be patient with me. I'm going through the info on Bernstein Vazirani. Here is the link to the section: &lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/bernstein-vazirani.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/textbook/ch-algorithms/bernstein-vazirani.html&lt;/a&gt;.&#xA;About midway down the page, at the end of the example section, is a widget: bv_widget. I have attempted to run the widget and apply the steps mentioned in the section. I apply the hadamards, then the oracle and then the hadamards again. But there seems to be no way of performing a measurement to determine the result. I tried placing bv_widget.measure(2,2) as the last line in the code sample, but that didn't work. Neither did just using the word measure(2,2).&lt;/p&gt;&#xA;&lt;p&gt;What am I missing here? Is there a way to perform a measurement?&lt;/p&gt;&#xA;&lt;p&gt;PS A similar piece of code is at the end of the chapter, and I'm running into the same problem with it.&lt;/p&gt;&#xA;&lt;p&gt;Thanks for your help.&lt;/p&gt;&#xA;&lt;p&gt;Doug&lt;/p&gt;&#xA;" OwnerUserId="15680" LastEditorUserId="55" LastEditDate="2021-04-28T09:16:17.750" LastActivityDate="2021-04-28T09:16:17.750" Title="Bernstein Vazirani Algorithm widget (bv_widget) in the Qiskit documentation" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17282" PostTypeId="2" ParentId="17281" CreationDate="2021-04-28T04:24:19.633" Score="1" Body="&lt;p&gt;I think the widget is supposed to only show you the initialization and Oracle part of the circuit and not actually implement the measurement process into it. Thus, that is why you don't see the measurement step.&lt;/p&gt;&#xA;&lt;p&gt;However, it is quite simple to write a function for perform the Bernstein-Vazirani algorithm. You can just use the script below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.circuit import QuantumCircuit&#xA;from qiskit import IBMQ, Aer, execute &#xA;provider = IBMQ.load_account()&#xA;&#xA;def BV_circuit(secret_bitstring): &#xA;    num_qubits = len(secret_bitstring) + 1&#xA;    circuit = QuantumCircuit(num_qubits,num_qubits)&#xA;    for i in range(num_qubits):&#xA;        circuit.h(i)&#xA;    circuit.z(num_qubits-1)&#xA;    for i in range(num_qubits-1):&#xA;        if secret_bitstring[i] == '1':&#xA;            circuit.cx(i,num_qubits-1)&#xA;    circuit.barrier(range(num_qubits))&#xA;    for i in range(num_qubits):&#xA;        circuit.h(i)&#xA;    circuit.measure([i for i in range(num_qubits-1)], [i for i in range(num_qubits-1)])&#xA;    return circuit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt; If I pick a secret bitstring to be &lt;code&gt;1111&lt;/code&gt; then I have the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;secret_bitstring = '1111'    &#xA;QC = BV_circuit(secret_bitstring)&#xA;QC.draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, initial_state = True, scale = 1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Ms855.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Ms855.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can check that this this will generate the same circuit as the one you have using the qiskit's Widget. And if you want to run it on hardware, just use the following script:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.backends.ibmq_16_melbourne&#xA;job = execute(QC, backend, shots=8192)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-28T04:34:01.503" LastActivityDate="2021-04-28T04:34:01.503" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17283" PostTypeId="1" CreationDate="2021-04-28T05:25:00.893" Score="2" ViewCount="41" Body="&lt;p&gt;A &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.QuantumError.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuantumError class&lt;/a&gt; may have many terms, and we can use &lt;code&gt;.error_term(position)&lt;/code&gt; to have a look at each term. But it returns a list instead of another QuantumError class. What should I do if I want to find out how this single term works in the noise model?&lt;/p&gt;&#xA;" OwnerUserId="14751" LastEditorUserId="9858" LastEditDate="2021-04-28T15:19:12.743" LastActivityDate="2021-04-28T15:19:12.743" Title="How to turn a 'term' in a QuantumError into a QuantumError?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;noise&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17285" PostTypeId="1" AcceptedAnswerId="17288" CreationDate="2021-04-28T16:52:01.353" Score="4" ViewCount="182" Body="&lt;p&gt;Let's say we have a function &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$f(011) = 1$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$f(111) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can I still use Grover's algorithm with this function, and receive the result of either &lt;span class=&quot;math-container&quot;&gt;$011$&lt;/span&gt;, or &lt;span class=&quot;math-container&quot;&gt;$111$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15600" LastEditorUserId="10480" LastEditDate="2021-04-28T18:13:12.203" LastActivityDate="2021-04-28T18:29:02.877" Title="Can I use Grover's algorithm for a function that has multiple arguments which satisfy it?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17286" PostTypeId="2" ParentId="17285" CreationDate="2021-04-28T17:32:24.013" Score="3" Body="&lt;p&gt;Yes. Grover's algorithm is often described in terms of looking for a single solution, but it is easily generalized to functions with multiple solutions, and numbers of solutions unknown beforehand.&lt;/p&gt;&#xA;&lt;p&gt;Here is a couple of relevant SE questions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/13318/what-to-do-when-the-amount-of-solutions-is-not-known-before-applying-grovers-alg&quot;&gt;What to do when the amount of solutions is not known before applying Grovers Algorithm?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/5318/grover-algorithm-for-more-than-one-element&quot;&gt;Grover algorithm for more than one element&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9063/how-many-iterations-does-grover-s-search-need-to-find-one-out-of-m-marked-item&quot;&gt;How many iterations does Grover’s search need to find one out of $M$ marked items?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-04-28T17:32:24.013" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17287" PostTypeId="1" AcceptedAnswerId="17290" CreationDate="2021-04-28T17:45:45.840" Score="4" ViewCount="185" Body="&lt;p&gt;Is there a way to visualize the Bloch sphere using Cirq, ProjectQ, and/or PyQuil, as it is possible using &lt;code&gt;plot_bloch_vector&lt;/code&gt; in Qiskit?&lt;/p&gt;&#xA;" OwnerUserId="14089" LastEditorUserId="13991" LastEditDate="2021-04-28T19:01:10.753" LastActivityDate="2021-04-28T20:23:04.380" Title="Bloch sphere visualization using Cirq, ProjectQ, PyQuil" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;pyquil&gt;&lt;projectq&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17288" PostTypeId="2" ParentId="17285" CreationDate="2021-04-28T18:02:58.540" Score="5" Body="&lt;p&gt;Yes. In fact, Grover's algorithm generally requires fewer iterations if more than one bitstring satisfies the search condition.&lt;/p&gt;&#xA;&lt;p&gt;More precisely, suppose we wish to find one of &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit strings that fulfill a condition encoded by &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; and assume that &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;M \le \frac{N}{2}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$N=2^n$&lt;/span&gt; is the number of all &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit strings. The number &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; of Grover iterations required is bounded by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R \le \left\lceil\frac{\pi}4\sqrt\frac{N}{M}\right\rceil = O\left(\sqrt{\frac{N}{M}}\right),&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;see inequality &lt;span class=&quot;math-container&quot;&gt;$(6.17)$&lt;/span&gt; on page 254 in Nielsen &amp;amp; Chuang. (Note that the above only applies when &lt;span class=&quot;math-container&quot;&gt;$M \le \frac{N}{2}$&lt;/span&gt;, but we can extend the result to &lt;span class=&quot;math-container&quot;&gt;$M &amp;gt; \frac{N}{2}$&lt;/span&gt; at the expense of adding a qubit because then the new &lt;span class=&quot;math-container&quot;&gt;$N'=2^{n+1}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$M \le N = \frac{N'}{2}$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="10480" LastEditorUserId="10480" LastEditDate="2021-04-28T18:29:02.877" LastActivityDate="2021-04-28T18:29:02.877" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17290" PostTypeId="2" ParentId="17287" CreationDate="2021-04-28T19:47:39.053" Score="6" Body="&lt;p&gt;The answer &lt;em&gt;seems&lt;/em&gt; to be &amp;quot;no&amp;quot; for all three. From what I can find, Cirq and PyQuil default to QuTiP for Bloch sphere visualization, and ProjectQ does not have any examples to go off of, nor can I find the functionality in their GitHub.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;TensorFlow Quantum, which primarily uses Cirq (since they are both owned by Google), used &lt;code&gt;qutip.Bloch&lt;/code&gt; in &lt;a href=&quot;https://github.com/tensorflow/quantum/blob/research/binary_classifier/binary_classifier.ipynb&quot; rel=&quot;noreferrer&quot;&gt;this binary classification tutorial&lt;/a&gt; instead of any Cirq function, implying that Cirq does not have an equivalent.&lt;/li&gt;&#xA;&lt;li&gt;Rigetti, which owns PyQuil, used &lt;code&gt;qutip.Bloch&lt;/code&gt; in &lt;a href=&quot;https://github.com/markf94/rigetti_training_material/blob/master/session_2/tutorial_II_quantum_gates.ipynb&quot; rel=&quot;noreferrer&quot;&gt;this training material&lt;/a&gt; instead of any PyQuil function, and in &lt;a href=&quot;https://github.com/rigetti/pyquil/blob/v2.22.0/docs/source/intro.rst&quot; rel=&quot;noreferrer&quot;&gt;this intro tutorial&lt;/a&gt;, implying that PyQuil does not have an equivalent.&lt;/li&gt;&#xA;&lt;li&gt;ProjectQ does not have any publicly visible Bloch sphere visualization tools in &lt;a href=&quot;https://github.com/ProjectQ-Framework/ProjectQ&quot; rel=&quot;noreferrer&quot;&gt;their Github&lt;/a&gt;, either. But their software already uses the IBM quantum experience, so I believe they would default to &lt;code&gt;qiskit.plot_bloch_vector&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;These are my findings based on briefly poking around in each of these softwares’ open-source. If there are any Cirq/ProjectQ/PyQuil contributors out there, please correct me if I am wrong.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-04-28T20:23:04.380" LastActivityDate="2021-04-28T20:23:04.380" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17291" PostTypeId="2" ParentId="17275" CreationDate="2021-04-29T06:37:40.953" Score="5" Body="&lt;p&gt;No. The whole point of an entangled state is that it cannot be written in the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|\phi\rangle$&lt;/span&gt;. So, if you replace &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; with an entangled state, it is no longer in the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;In response to the updated question, the answer is still &amp;quot;no&amp;quot;. There will always be a test that the sender and receiver could perform that would detect the difference between the state they started from and the state that has become entangled with &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;. Most of the time, if the sender and receiver are performing local tests, the success of the test would only be probabilistic. The adversary might get away with it on a single occasion. But if the protocol is to be repeated many time, the probability of the adversary getting away with it is vanishingly small. For example, if the sender and receiver share a Bell pair&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(|00\rangle+|11\rangle)/\sqrt{2},&#xA;$$&lt;/span&gt;&#xA;there's a variety of things they can do to test it. For example, they could perform a CHSH test. Or, they could both perform a measurement &lt;span class=&quot;math-container&quot;&gt;$\cos\theta X+\sin\theta Z$&lt;/span&gt; (both parties should get identical outcomes, so long as they use the same value of &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-05-06T16:13:24.530" LastActivityDate="2021-05-06T16:13:24.530" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17292" PostTypeId="1" AcceptedAnswerId="17294" CreationDate="2021-04-29T13:42:47.370" Score="3" ViewCount="50" Body="&lt;p&gt;In the &lt;a href=&quot;https://www.tensorflow.org/quantum/tutorials/hello_many_worlds&quot; rel=&quot;nofollow noreferrer&quot;&gt;hello many worlds tensorflow tutorial&lt;/a&gt; and in &lt;a href=&quot;https://arxiv.org/pdf/2008.07524.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;the lockwood paper (2020)&lt;/a&gt; I have seen that often in QVC the following combination of gates is used:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_z(\theta), R_y(\theta), R_x(\theta)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am wondering if not just two of them would suffice for reach every measurable quantum state.&lt;/p&gt;&#xA;&lt;p&gt;I thought, that certain quantum states are only theoretically different, so for example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi&amp;gt; = \frac{1}{\sqrt2}\big(|0&amp;gt; + |1&amp;gt;\big)$&lt;/span&gt;&#xA;and&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi&amp;gt; = \frac{1}{\sqrt2}\big(i|0&amp;gt; + i|1&amp;gt;\big)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;are, when measured collapsing to 50% to &lt;span class=&quot;math-container&quot;&gt;$|1&amp;gt;$&lt;/span&gt; and to 50% to &lt;span class=&quot;math-container&quot;&gt;$|0&amp;gt;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So my question is, why would we need to add a third gate, if already 2 gates suffice, to gain every possible probability when measuring?&lt;/p&gt;&#xA;" OwnerUserId="15493" LastEditorUserId="55" LastEditDate="2021-04-30T08:20:39.713" LastActivityDate="2021-04-30T08:20:39.713" Title="Why are 3, rather than 2 gates used in quantum variational circuits?" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;&lt;quantum-circuit&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17293" PostTypeId="1" AcceptedAnswerId="17305" CreationDate="2021-04-29T14:21:38.160" Score="6" ViewCount="84" Body="&lt;p&gt;Take a quantum circuit on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, you have some sequence of gates.&lt;/p&gt;&#xA;&lt;p&gt;You can represent these gates as hermitian matrices, and then with some padding, you could take the product of these matrices, by closure would be a hermitian matrix, a quantum operation.&#xA;Then you have who knows how many gates into one single, but complicated &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-ary gate.&lt;/p&gt;&#xA;&lt;p&gt;On a perfect fidelity machine, this could be o(1) right. Does this logic make sense? I feel like it shouldn't be independent of the depth, or a lot of classical circuit problems become constant time on a QC.&lt;/p&gt;&#xA;" OwnerUserId="9149" LastEditorUserId="55" LastEditDate="2021-04-30T08:22:07.880" LastActivityDate="2021-04-30T08:22:07.880" Title="Is the complexity of a quantum circuit constant in the depth of the circuit?" Tags="&lt;complexity-theory&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17294" PostTypeId="2" ParentId="17292" CreationDate="2021-04-29T14:27:30.727" Score="5" Body="&lt;p&gt;At the start of the circuit you're right that you only need two parameters. This is actually easy to show if you decompose into a sequence of rotations starting with a Z rotation, because Z rotations have no effect on &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, so clearly that Z rotation angle would be irrelevant.&lt;/p&gt;&#xA;&lt;p&gt;But in the middle of a circuit, a gate is likely operating on a state that is entangled with other qubits. For these states, all three parameters are relevant. You can see this for yourself by preparing the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle + |11\rangle$&lt;/span&gt; and putting a gate on one of the qubits.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-04-29T14:27:30.727" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17295" PostTypeId="1" CreationDate="2021-04-29T14:40:13.397" Score="3" ViewCount="31" Body="&lt;p&gt;I'm studying the HHL algorithm from the &lt;a href=&quot;https://qiskit.org/textbook/ch-applications/hhl_tutorial.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;qiskit textbook&lt;/a&gt;, but I don't understand what &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; we have to use. If my matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; has eigenvalues that can be written in a binary representation, then, after QPE, in that register we just have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit representation of the eigenvalues. Otherwise, in that register, we have an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-bit approximation, &lt;span class=&quot;math-container&quot;&gt;$2^n \frac{\lambda t}{2\pi}$&lt;/span&gt;. When I do controlled rotation, I have to calculate &lt;span class=&quot;math-container&quot;&gt;$2\arcsin(C/\lambda_j)$&lt;/span&gt;. My question is, which &lt;span class=&quot;math-container&quot;&gt;$\lambda_j$&lt;/span&gt;'s are the real eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;: the values stored in the register or only &lt;span class=&quot;math-container&quot;&gt;$ \frac{\lambda t}{2\pi}$&lt;/span&gt;? My question arises because in &lt;a href=&quot;https://arxiv.org/abs/1703.06613v1&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; the authors use the exact eigenvalues, which can be written in a binary representation, but, the textbook uses &lt;span class=&quot;math-container&quot;&gt;$\frac{\lambda t}{2\pi}$&lt;/span&gt;, wherein this case, the eigenvalues cannot be written in a binary notation. Can't I always use the value inside the register &lt;span class=&quot;math-container&quot;&gt;$(2^n \frac{\lambda t}{2\pi})$&lt;/span&gt; regardless of the representation?&lt;/p&gt;&#xA;" OwnerUserId="15624" LastEditorUserId="13991" LastEditDate="2021-04-29T17:05:00.483" LastActivityDate="2021-04-29T17:05:00.483" Title="What are the correct eigenvalues to use in controlled rotation in HHL?" Tags="&lt;qiskit&gt;&lt;hhl-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17296" PostTypeId="2" ParentId="17275" CreationDate="2021-04-29T16:10:45.513" Score="2" Body="&lt;h2&gt;Some fundamentals of quantum mechanics&lt;/h2&gt;&#xA;&lt;p&gt;Consider a composite system &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, with subsystems &lt;span class=&quot;math-container&quot;&gt;$S_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$S_2$&lt;/span&gt;. Each subsystem has a description in terms of a &lt;strong&gt;Hilbert space&lt;/strong&gt;, which in quantum computing is just some &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional vector space. Denote the space associated with each subsystem as &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}_2$&lt;/span&gt;, respectively.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Each Hilbert space has a &lt;strong&gt;basis&lt;/strong&gt; that spans all possible system states. This can be represented by vectors in Dirac notation. For instance, a base for the Hilbert space for a qubit is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{|0\rangle,|1\rangle\} = \{\begin{bmatrix}1 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 1\end{bmatrix}\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The composite system has a Hilbert space which is spanned by the &lt;strong&gt;tensor product&lt;/strong&gt; of the basis of each of its subsystems. If &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; is the composite Hilbert space, then &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H} = \mathcal{H}_1 \otimes \mathcal{H}_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The Hilbert space for a composite system of 2 qubits, for instance, has a basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\{|0\rangle_2 \otimes |0\rangle_1, |0\rangle_2 \otimes |1\rangle_1, |1\rangle_2 \otimes |0\rangle_1, |1\rangle_2 \otimes |1\rangle_1\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is what you may have seen is denoted as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In vector representation, this is equivalent to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\{\begin{bmatrix}1 \\ 0 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 1 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 1 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 0 \\ 1\end{bmatrix}\}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Quick reminder:&lt;/strong&gt; Kroenecker or tensor product is defined between matrices &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; (size &lt;span class=&quot;math-container&quot;&gt;$m \times n$&lt;/span&gt;) and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; (size &lt;span class=&quot;math-container&quot;&gt;$p \times q$&lt;/span&gt;) by the operation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$A \otimes B = \begin{bmatrix} a_{11}B &amp;amp; \cdots &amp;amp; a_{1n}B \\ \vdots &amp;amp; \ddots &amp;amp; \vdots \\ a_{m1}B &amp;amp; \cdots &amp;amp; a_{mn}B\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;See &lt;a href=&quot;https://en.wikipedia.org/wiki/Kronecker_product&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wikipedia&lt;/a&gt; for more details. And make sure that you understand the relations between Dirac notation, vector spaces and tensor product of Hilbert spaces.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;States of a composite system are classified in two groups: &lt;strong&gt;separable&lt;/strong&gt; and &lt;strong&gt;entangled&lt;/strong&gt;. This discrimination is based upon the concept of tensor product.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3&gt;Measurement of subsystems&lt;/h3&gt;&#xA;&lt;p&gt;Before addressing this issue, imagine a projective measurement is performed on each subsystem. This measurement would be described by &lt;strong&gt;Projector operators&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$\{\hat{P}_m\}$&lt;/span&gt;. As their name suggest, they &amp;quot;collpase&amp;quot; a quantum state onto a subspace that has a definite outcome for the desired measurement. For instance, if the bit value of a qubit is measured, the projectors that model this process are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{P}_0 = \begin{bmatrix}1 &amp;amp; 0 \\ 0 &amp;amp; 0\end{bmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\hat{P}_1 = \begin{bmatrix}0 &amp;amp; 0 \\ 0 &amp;amp; 1\end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Each operator corresponds to the cases when a value &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; is observed, or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is observed, respectively. If, for example, the bit value of a two-qubit system is measured for both subsystems, then the corresponding projectors are&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\hat{P}_{ab} = \hat{P}_{a} \otimes \hat{P}_{b}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$a,b = 0,1$&lt;/span&gt;. It would be instructive for you to get the matrix representation of this projectors. After a measurement, if the &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th possible outcome is observed, the state of the composite system is simply&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi_{after}\rangle = \hat{P}_m |\Psi_{before}\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And the &lt;strong&gt;probability&lt;/strong&gt; that &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;-th outcome is measured (given that system is on state &lt;span class=&quot;math-container&quot;&gt;$|\Psi_{before}\rangle$&lt;/span&gt;) corresponds to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(m|\Psi_{before}) = \langle\Psi_{before}|P_m|\Psi_{before}\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h3&gt;Separable states and independence&lt;/h3&gt;&#xA;&lt;p&gt;Separable states are those that can be &lt;em&gt;factored&lt;/em&gt; as a Kroenecker product&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = |\psi\rangle_2 \otimes |\psi\rangle_1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the case of a system of two qubits, this generic state corresponds to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = (\alpha_2|0\rangle_2  + \beta_2|1\rangle_2) \otimes (\alpha_1|0\rangle_1  + \beta_1|1\rangle_1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I think it would be instructive for you to find the vector representation of this state as a column vector. Notice that if a measurement of bit value of this composite system is performed, the probabilities of obtaining values &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; for the second bit, and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; for the first bit is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(a,b) = \langle \Psi | P_{ab} |\Psi\rangle = \langle \Psi | P_a \otimes P_b |\Psi\rangle = (\langle \psi | P_{a} |\Psi\rangle) (\langle \psi | P_{a} |\Psi\rangle) = p(a|\psi_2)p(b|\psi_1)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;This means that measurements of the two subsystem are independent. There are no correlations between the measurements of each subsystem.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There is no posible measurement that can be performed in one subsystem that reveals correlations with the other. Another way to put it: you would need no information from subsystem &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_1$&lt;/span&gt; to completely describe subsystem &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_2$&lt;/span&gt; and viceversa.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Remember that two random variables are independent if their joint distribution is the product of each separate distribution.&lt;/p&gt;&#xA;&lt;h3&gt;Entangles states and measurement&lt;/h3&gt;&#xA;&lt;p&gt;Consider, for instance, that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}$&lt;/span&gt; is a two qubit system in a state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle = \alpha|00\rangle + \beta|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is easy to show that this cannot be factored as a Kroenecker product. As a result, it is said that it is entangled. The main feature is that, for states that have this property, it is so that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$p(a,b) \neq p(a)p(b)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Unlike before. Try, for instance, computing the probability that chain &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt; is measured, and the individual probabilities that each subsystem is measured on state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, to convince yourself that this is true.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;From probability theory, this means that there are &lt;strong&gt;fundamental correlations&lt;/strong&gt; between the measurements of each subsystems when the composite system is on an entangled state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Put in other words: you need to obtain some information about subsystem &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_2$&lt;/span&gt; to completely describe &lt;span class=&quot;math-container&quot;&gt;$\mathcal{S}_1$&lt;/span&gt;, and viceversa. You can describe each subsystem individually (with the tool of partial trace). However, individualization only yields partial information. If you have two entangled qubits, and measure one of them, yo can see that the correlations affect the other qubit's measurement distribution. As a result, the scenario you picture is impossible.&lt;/p&gt;&#xA;&lt;h3&gt;No cloning theorem&lt;/h3&gt;&#xA;&lt;p&gt;Consider a two-qubit system in a state &lt;span class=&quot;math-container&quot;&gt;$|Q\rangle \otimes (\alpha|0\rangle + \beta|1\rangle)$&lt;/span&gt;. Now, imagine a &lt;strong&gt;linear operation&lt;/strong&gt; that is able to perform transformations&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|Q\rangle \otimes |0\rangle \rightarrow |0\rangle \otimes |0\rangle$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|Q\rangle \otimes |1\rangle \rightarrow |1\rangle \otimes |1\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; denotes some auxiliar state that allows us to copy some basis states of a qubit. It is easy to see that this transformation maps our initial state &lt;span class=&quot;math-container&quot;&gt;$|Q\rangle \otimes (\alpha|0\rangle + \beta|1\rangle)$&lt;/span&gt; to&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\alpha|00\rangle + \beta|11\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As we saw before, this is an entangled state, and the qubits cannot be described independently.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The no cloning theorem states that a linear transformation that performs an operation of the type&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|Q\rangle \otimes |\psi\rangle \rightarrow |\psi\rangle \otimes |\psi\rangle$$&lt;/span&gt;&#xA;is just physically impossible.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3&gt;Summary&lt;/h3&gt;&#xA;&lt;p&gt;In conclusion, your idea is physically impossible, for a copy machine that would &amp;quot;capture&amp;quot; a qubit's state on a communication channel without disturbing the communicated information between two partners is prohibited by the no-cloning theorem. You can, howeve, device some &lt;em&gt;imperfect copying machine&lt;/em&gt;, that would create an entangled pair in which the individual description of each qubit is the same, but in which the copies share information. In this type of attacks, sender-receiver can detect that some information has been obtained by a third party, and eventually abort communication.&lt;/p&gt;&#xA;&lt;p&gt;It is important to notice that no communication Channel is perfect. There are correlations between the elements of the channel and the surrounding environment. This implies that some information is lost to the environment. This can be profited by a possible adversary. A copy machine can be designed so as to obtain enough information on the message ,but not so much that the two main parties think it is more than environmental noise.&lt;/p&gt;&#xA;&lt;p&gt;If you are interested on this type of attacks, you can check the BB84 quantum encryption protocol, and its possible vulnerabilities. The work on this area is quite technical, and it might be advisable that you study a bit of quantum information theory. Check Nielsen and Chuang's book, ver even Strini et. al.&lt;/p&gt;&#xA;" OwnerUserId="15697" LastActivityDate="2021-04-29T16:10:45.513" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17297" PostTypeId="2" ParentId="4568" CreationDate="2021-04-29T16:22:56.170" Score="2" Body="&lt;p&gt;Your strategy only works if Alice and Bob encode their message on the computational basis, for in that case CNOT copies the qubit's state with perfect fidelity. In general, however, the fidelity of the CNOT as a copy machine depends on the initial state. In particular, copying eigenstates of Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; produces the lowest fidelity possible: &lt;span class=&quot;math-container&quot;&gt;$50%$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When you individualize each qubit in a Bell pair, you find that they are described by an ensemble that has uniform distribution over all possible qubit states. In other words, you cannot possibly obtain any information about the qubits by just measuring one of them. A better attack would use a phase covariant copying machine.&lt;/p&gt;&#xA;" OwnerUserId="15697" LastActivityDate="2021-04-29T16:22:56.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17298" PostTypeId="1" AcceptedAnswerId="17299" CreationDate="2021-04-29T17:16:44.867" Score="3" ViewCount="69" Body="&lt;p&gt;I'm using &lt;code&gt;qiskit&lt;/code&gt; with the online &lt;a href=&quot;https://quantum-computing.ibm.com&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Quantum Lab&lt;/a&gt; and when I run the following code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, Aer, execute&#xA;from qiskit.visualization import plot_bloch_multivector&#xA;&#xA;qc = QuantumCircuit(1) &#xA;&#xA;qc.h(0)&#xA;qc.h(0)&#xA;qc.h(0)&#xA;&#xA;out = execute(qc,Aer.get_backend('statevector_simulator')).result().get_statevector()&#xA;print(out)&#xA;plot_bloch_multivector(out)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;... it results in the following state vector for the qubit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;[0.70710678+0.00000000e+00j 0.70710678+1.57009246e-16j]&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see there's a very small imaginary component in the |1&amp;gt; amplitude.&lt;/p&gt;&#xA;&lt;p&gt;These imaginary values pop up often with &lt;code&gt;qiskit&lt;/code&gt;, such as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(0)&#xA;qc.h(0)&#xA;--&amp;gt; [ 0.70710678+0.00000000e+00j -0.70710678+8.65956056e-17j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;or even very small non-imaginary numbers, such as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.x(0)&#xA;qc.h(0)&#xA;qc.h(0)&#xA;--&amp;gt; [6.123234e-17+0.00000000e+00j 1.000000e+00-2.22044605e-16j]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is this something unique to quantum mechanics/computing that actually has practical consequences when doing computation, or perhaps simply a quirk of Python's scientific notation implementation.&lt;/p&gt;&#xA;" OwnerUserId="8959" LastEditorUserId="10480" LastEditDate="2021-04-29T20:37:53.173" LastActivityDate="2021-04-29T20:37:53.173" Title="Why does applying a Hadamard gate three times to $|0\rangle$ result in a tiny imaginary component in the $|1\rangle$ amplitude?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;python&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17299" PostTypeId="2" ParentId="17298" CreationDate="2021-04-29T17:31:57.803" Score="3" Body="&lt;p&gt;This is just a quirk of how complex numbers are implemented in Python/Numpy, etc. At the end of the day, these are represented as floating-point numbers within the target simulator. These are then transformed via various mathematical operations to implement the simulation and this eventually leads to an accumulation of &lt;a href=&quot;https://en.wikipedia.org/wiki/Round-off_error&quot; rel=&quot;nofollow noreferrer&quot;&gt;round off error&lt;/a&gt;. For all intents and purposes, e-16 is zero, but a computer doesn't know that.&lt;/p&gt;&#xA;" OwnerUserId="9863" LastActivityDate="2021-04-29T17:31:57.803" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17300" PostTypeId="1" CreationDate="2021-04-29T19:26:13.870" Score="4" ViewCount="174" Body="&lt;p&gt;I was reading few questions regarding lossless quantum compression on stack exchange, then out of curiosity, I started reading &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0105026&quot; rel=&quot;nofollow noreferrer&quot;&gt;this article&lt;/a&gt;. After reading I end up being confused about what does quantum compression really means? For example take&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=(|00\rangle+|10\rangle)/\sqrt{2}$$&lt;/span&gt; article was saying compression means making &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, then storing the length and append zeros to decompress. Why can't they measure the quantum state and store the information, instead of compressing the quantum state? What was the use of the density matrix in this entire article is it just to measure the information?&lt;/p&gt;&#xA;" OwnerUserId="15024" LastEditorUserId="55" LastEditDate="2021-04-30T08:22:50.083" LastActivityDate="2021-05-17T01:18:07.747" Title="What was the meaning of Lossless Quantum compression?" Tags="&lt;quantum-state&gt;&lt;information-theory&gt;&lt;communication&gt;&lt;channel-capacity&gt;" AnswerCount="0" CommentCount="5" FavoriteCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17301" PostTypeId="1" AcceptedAnswerId="17304" CreationDate="2021-04-29T19:38:34.357" Score="2" ViewCount="65" Body="&lt;p&gt;I would like to know the number and type of all the gates on the wire/qubit with the largest operations in a quantum circuit with multiple qubits. Is there any inbuilt functionality, or what is the shortest way to do so?&lt;/p&gt;&#xA;" OwnerUserId="15467" LastEditorUserId="13991" LastEditDate="2021-04-29T19:45:36.807" LastActivityDate="2021-04-29T21:45:45.067" Title="Qiskit: count the type of gates on the qubit with the largest number of gates in a multi-qubit circuit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17302" PostTypeId="1" CreationDate="2021-04-29T20:07:33.143" Score="4" ViewCount="84" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/1811.12575&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cleve, et al.&lt;/a&gt;, the authors discuss &lt;em&gt;self-embezzlement&lt;/em&gt; of a catalyst state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt;, making the statement on page 2,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;[B]y local operations, state &lt;span class=&quot;math-container&quot;&gt;$\psi\otimes(\vert 0 \rangle \otimes \vert 0 \rangle)$&lt;/span&gt;&#xA;is mapped to &lt;span class=&quot;math-container&quot;&gt;$\psi \otimes \psi$&lt;/span&gt; within fidelity&#xA;&lt;span class=&quot;math-container&quot;&gt;$1-\epsilon$&lt;/span&gt;.... [W]e allow the catalyst to be any pure state that is&#xA;non-trivially entangled in the sense that it can be used to&#xA;approximately attain the maximal violation of the CHSH inequality....&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$\epsilon=0$&lt;/span&gt;, this is referred to as exact self-embezzlement.  Moreover, Theorem 1.3 in the paper states, &amp;quot;In the &lt;span class=&quot;math-container&quot;&gt;$C^\ast$&lt;/span&gt;-circuit model, exact self-embezzlement is possible.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is unknown, it seems clear that exact self-embezzlement would violate the no-cloning theorem.  However, I don't see anything in the paper that implies &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is known.  In particular the &lt;span class=&quot;math-container&quot;&gt;$\ast$&lt;/span&gt;‑automorphism, discussed at the top of page 11, does not seem to require that &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; be known.&lt;/p&gt;&#xA;&lt;p&gt;My question is,&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Does this paper imply that the no-cloning theorem is violated in &lt;span class=&quot;math-container&quot;&gt;$C^\ast$&lt;/span&gt;-circuit models?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;N.B. the authors show that self-embezzlement cannot be approximated to arbitrary precision in the conventional quantum circuit model, so thinking of the results in terms of some form of closure of the conventional circuit model is not helpful.&lt;/p&gt;&#xA;" OwnerUserId="8623" LastEditorUserId="8623" LastEditDate="2021-05-01T17:51:26.423" LastActivityDate="2021-05-01T17:51:26.423" Title="Is the No-Cloning Theorem Violated in $C^\ast$-Circuit Models?" Tags="&lt;circuit-construction&gt;&lt;mathematics&gt;&lt;non-locality&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17303" PostTypeId="2" ParentId="17301" CreationDate="2021-04-29T21:15:44.077" Score="0" Body="&lt;p&gt;Your description sounds like the notion of &lt;em&gt;depth&lt;/em&gt;. You can get the depth of a circuit in Qiskit with the &lt;code&gt;depth&lt;/code&gt; method: &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.depth&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.depth&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.depth()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-04-29T21:15:44.077" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17304" PostTypeId="2" ParentId="17301" CreationDate="2021-04-29T21:22:28.407" Score="4" Body="&lt;p&gt;You can do this as follow:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Specify your circuit then transpile it to the backend of interst.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;transpile_circuit = transpile(circuit, backend)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Convert this to DAG (Directed Acylic Graph)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;dag_circuit = circuit_to_dag(transpile_circuit)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;ol start=&quot;3&quot;&gt;&#xA;&lt;li&gt;count all the operation in the longest path:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;dag_circuit.count_ops_longest_path()&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Explicit example:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Says you have the circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(4,4)&#xA;for i in range(4):&#xA;    qc.h(i)&#xA;qc.cx(0,1)&#xA;qc.cx(2,3)&#xA;qc.ry(2,0)&#xA;qc.cx(1,0)&#xA;qc.measure([0,1,2,3],[0,1,2,3])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/poCw0.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/poCw0.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;you can transpile this onto &lt;code&gt;ibmq_16_melbourne&lt;/code&gt; and to get:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmq_16_melbourne')&#xA;transpile_circuit = transpile(qc, backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ll85g.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ll85g.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, convert to DAG and counts ops give you:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dag_circuit = circuit_to_dag(transpile_circuit)&#xA;dag_circuit.count_ops_longest_path()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Output: &lt;code&gt;{'rz': 4, 'sx': 3, 'cx': 2, 'measure': 1} &lt;/code&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;It seems to me you want to find out the runtime of the circuit by finding out the longest path, and the operations on that path, then using the device properties to calculate the theoretical runtime.&lt;/p&gt;&#xA;&lt;p&gt;If that is the case, then you need to extract the gate duration time for all the gate in that longest path, and work out the calculation.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Make sure to import:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.dagcircuit import DAGCircuit&#xA;from qiskit.converters import circuit_to_dag&#xA;from qiskit.compiler import transpile&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-04-29T21:45:45.067" LastActivityDate="2021-04-29T21:45:45.067" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17305" PostTypeId="2" ParentId="17293" CreationDate="2021-04-30T00:11:21.583" Score="7" Body="&lt;p&gt;The same could be said about any classically computable function.  We could use the Cook-Levin theorem to unroll any Turing machine into a single but complicated &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-input gate, and then claim it's &lt;span class=&quot;math-container&quot;&gt;$o(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Thus because we don't want this silly exception, usually when speaking of &lt;span class=&quot;math-container&quot;&gt;$\mathrm{BQP}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\mathrm{P}$&lt;/span&gt; in a circuit model, we have to limit our gate set (to, say, NAND gates classically and Hadamard/CCNOT gates quantumly).&lt;/p&gt;&#xA;&lt;p&gt;Further we should put in a uniformity condition: given &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; you'll need a Turing machine to provide the requisite quantum circuit (classical circuit) in polynomial time.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-04-30T00:11:21.583" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17306" PostTypeId="1" CreationDate="2021-04-30T09:40:04.387" Score="3" ViewCount="170" Body="&lt;p&gt;I struggle to find any information on Nielsen and Chuang or similar texts on the exact definition of the so-called &lt;strong&gt;IQ plane&lt;/strong&gt; (I think this is a notion closely related to solid state quantum computers such as transmon).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Can you provide a simple explanation of what the IQ plane or recommend some references that clearly explain it and its relation to the estimation of quantum states when one performs quantum state tomography?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15676" LastEditorUserId="55" LastEditDate="2021-05-02T10:50:11.317" LastActivityDate="2021-05-02T10:50:11.317" Title="What is the IQ plane?" Tags="&lt;quantum-state&gt;&lt;superconducting-quantum-computing&gt;&lt;tomography&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17307" PostTypeId="2" ParentId="17306" CreationDate="2021-04-30T10:27:21.103" Score="2" Body="&lt;p&gt;IQ is an abbreviation for In-phase and Quadrature phase components of the signal. Whenever a qubit state ie. Z observable is read using a system such as resonator, the phase and amplitude of the resonator at a given frequency of signal changes depending on the qubits state. This change hence creates a change in the IQ plane. Using this measurement technique, quantum tomographies are performed.&lt;/p&gt;&#xA;" OwnerUserId="15702" LastActivityDate="2021-04-30T10:27:21.103" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17309" PostTypeId="2" ParentId="17275" CreationDate="2021-04-30T18:42:11.983" Score="-1" Body="&lt;p&gt;Yes this is possible, in some sense (for bell-pairs at least, I am not sure about arbitrary states). Take any starting bell-pair&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array}{l}&#xA;\left|\Psi^{+}\right\rangle=\frac{\left|0 1\right\rangle+\left|1 0\right\rangle}{\sqrt{2}}, \\&#xA;\left|\Psi^{-}\right\rangle=\frac{\left|0 1\right\rangle-\left|1 0\right\rangle}{\sqrt{2}}, \\&#xA;\left|\Phi^{+}\right\rangle=\frac{\left|0 0\right\rangle+\left|1 1\right\rangle}{\sqrt{2}}, \\&#xA;\left|\Phi^{-}\right\rangle=\frac{\left|0 0\right\rangle-\left|1 1\right\rangle}{\sqrt{2}} .&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and apply the operation &lt;span class=&quot;math-container&quot;&gt;$I \otimes CNOT$&lt;/span&gt; to any one of:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array}{l}&#xA;\left|\Psi^{+}\right\rangle \otimes \left|0 \right \rangle, \\&#xA;\left|\Psi^{-}\right\rangle \otimes \left|0 \right \rangle, \\&#xA;\left|\Phi^{+}\right\rangle \otimes \left|0 \right \rangle, \\&#xA;\left|\Phi^{-}\right\rangle \otimes \left|0 \right \rangle.&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This results in a new entagled state between 3 qubits. This is a different state, yes, but from the perspective of the sender and receiver, the two halves of the bell-pair are unaffected. As an example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(I \otimes CNOT) (\left|\Phi^{+}\right\rangle \otimes \left|0 \right \rangle) = \frac{\left|0 0 0\right\rangle+\left|1 1 1\right\rangle}{\sqrt{2}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can see that when the sender (or receiver) measures their half of the bell-pair (it's not technically a pair, because now there is a third qubit), the same measurement results will arise between both halves of the pair.&lt;/p&gt;&#xA;" OwnerUserId="14239" LastEditorUserId="14239" LastEditDate="2021-05-06T15:59:04.837" LastActivityDate="2021-05-06T15:59:04.837" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17310" PostTypeId="2" ParentId="11715" CreationDate="2021-05-01T00:13:36.377" Score="1" Body="&lt;p&gt;Without the OpenQASM code to import this is hard 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 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.&lt;/p&gt;&#xA;" OwnerUserId="15709" LastActivityDate="2021-05-01T00:13:36.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17312" PostTypeId="1" AcceptedAnswerId="17313" CreationDate="2021-05-01T03:14:20.087" Score="4" ViewCount="89" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; be a Clifford circuit, is there necessarily a Clifford circuit &lt;span class=&quot;math-container&quot;&gt;$C'$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$CT=TC'$&lt;/span&gt; (where &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; is taken as applying the &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt; gate to the same qubit on both sides)?&lt;/p&gt;&#xA;" OwnerUserId="15711" LastEditorUserId="55" LastEditDate="2021-05-02T10:59:44.940" LastActivityDate="2021-05-02T10:59:44.940" Title="If $C$ is a Clifford circuit, is there necessarily a Clifford circuit $C'$ such that $CT=TC'$?" Tags="&lt;quantum-gate&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17313" PostTypeId="2" ParentId="17312" CreationDate="2021-05-01T06:03:52.040" Score="5" Body="&lt;p&gt;No.&lt;/p&gt;&#xA;&lt;p&gt;There always exists a unique unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$CT=TU$&lt;/span&gt;. Namely, &lt;span class=&quot;math-container&quot;&gt;$U = T^\dagger C T$&lt;/span&gt;. The question is whether &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is Clifford. It turns out that this is not guaranteed. For a simple counterexample take Hadamard for &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. Then&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U=T^\dagger H T = \frac{1}{\sqrt{2}}\begin{bmatrix}&#xA;1 &amp;amp; e^{i\pi/4} \\&#xA;e^{-i\pi/4} &amp;amp; -1&#xA;\end{bmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is not Clifford, because &lt;span class=&quot;math-container&quot;&gt;$U|0\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle+e^{-i\pi/4}|1\rangle\right)$&lt;/span&gt; is not one of the stabilizer states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|{+i}\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|{-i}\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-05-01T06:03:52.040" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="17314" PostTypeId="1" AcceptedAnswerId="17327" CreationDate="2021-05-01T06:08:56.270" Score="2" ViewCount="40" Body="&lt;p&gt;I have two laptops with different accounts of Jupyter Notebook. I'm wondering can I use the same qiskit account (with the same token) on both laptops? I'm worried that if I run the token on my new laptop, the original one will be terminated. Thanks!&lt;/p&gt;&#xA;" OwnerUserId="15562" LastActivityDate="2021-05-02T13:05:27.613" Title="Can I use the same qiskit account on two laptops?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17315" PostTypeId="1" CreationDate="2021-05-01T09:14:33.217" Score="2" ViewCount="19" Body="&lt;p&gt;The IBM Quantum services website lists calibration statistics for their devices, including the (sx) error rate per qubit, which is listed as a single number. One can also manually calibrate a device using the ampcal_1Q_circuits and anglecal_1Q_circuits functions in Ignis, but doing so results in two different numbers for the sx amplitude error and angle error. What is the relationship between these two errors and the number listed on the website?&lt;/p&gt;&#xA;" OwnerUserId="15713" LastEditorUserId="55" LastEditDate="2021-05-02T11:00:43.080" LastActivityDate="2021-05-02T11:00:43.080" Title="What is the relationship between the (sx) error rate listed in calibration and the angle/amplitude errors calculated using the fitter?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17316" PostTypeId="1" CreationDate="2021-05-01T09:41:17.283" Score="0" ViewCount="48" Body="&lt;p&gt;I'm trying to build a deep understanding of where the power of quantum computing comes from when compared to probabilistic computing. A naive observation might be that probabilistic computing would be just as powerful since both give you a single result from a set of possible results with a certain probability. I've come to understand that quantum computing is more powerful, because unlike with probabilistic computing, quantum computers can make the probabilities interfere with each other to suppress undesired results, and enhance desired results.&lt;/p&gt;&#xA;&lt;p&gt;Is there a simple quantum gate that shows this suppression and enhancements of results in action? I think that that would really help me tie the intuition behind quantum computers to the concrete mathematical description of quantum gates.&lt;/p&gt;&#xA;&lt;p&gt;And how does all this relate to entanglement? Is entanglement required to get useful results out of interference?&lt;/p&gt;&#xA;" OwnerUserId="15714" LastEditorUserId="15714" LastEditDate="2021-05-01T10:00:22.953" LastActivityDate="2021-05-01T10:00:22.953" Title="Is there a simple quantum gate that shows off the power of Quantum interference?" Tags="&lt;quantum-gate&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="17318" PostTypeId="1" AcceptedAnswerId="17319" CreationDate="2021-05-01T14:02:17.363" Score="0" ViewCount="70" Body="&lt;p&gt;I am a curious quantum computing learner. :)&lt;/p&gt;&#xA;&lt;p&gt;Once observe the CNOT gate:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/ClbzB.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ClbzB.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;as you can see there it converts a |+&amp;gt; to |-&amp;gt; in the top or to say in another way it clones the |-&amp;gt;&lt;/p&gt;&#xA;&lt;p&gt;state. So does this violate &amp;quot;No Cloning Theorem&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Say for example when you apply a CNOT gate to a qubit in superposition then that is indeed as the&lt;/p&gt;&#xA;&lt;p&gt;same as cloning the qubit in superposition.&lt;/p&gt;&#xA;" OwnerUserId="15715" LastActivityDate="2021-05-01T15:48:49.930" Title="Does a CNOT quantum gate violate no cloning theorem?" Tags="&lt;quantum-gate&gt;&lt;physical-qubit&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-05-02T05:59:09.477" ContentLicense="CC BY-SA 4.0" />
  <row Id="17319" PostTypeId="2" ParentId="17318" CreationDate="2021-05-01T15:48:49.930" Score="6" Body="&lt;p&gt;&lt;em&gt;Cloning&lt;/em&gt; means you have a unitary transforming &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that takes &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|0\rangle $&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle|\psi \rangle $&lt;/span&gt; for &lt;em&gt;&lt;strong&gt;all&lt;/strong&gt;&lt;/em&gt; &lt;em&gt;quantum states&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U\big(|\psi\rangle|0\rangle \big)  = |\psi\rangle|\psi \rangle \hspace{0.5 cm} \forall \ |\psi \rangle \in \mathcal{H} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{H}$&lt;/span&gt; is a Hilbert space. Thus, what you  shown is not a violation of the &lt;em&gt;no cloning theorem&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that the no-cloning theorem tells us that it is &lt;strong&gt;impossible&lt;/strong&gt; to clone a specific &lt;em&gt;unknown&lt;/em&gt; quantum state, but it &lt;strong&gt;does not preclude&lt;/strong&gt; the construction of a known quantum state from a known quantum state.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-01T15:48:49.930" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17320" PostTypeId="1" AcceptedAnswerId="17337" CreationDate="2021-05-01T15:51:12.837" Score="5" ViewCount="75" Body="&lt;p&gt;I'm trying to understand what the use case of a superop simulator would be. My understanding is that density matrix is generally more resource intensive than state vector, but it has additional capabilities to support noisy channels and such. And also my understanding is that every circuit &lt;em&gt;has&lt;/em&gt; a corresponding superop that can be extracted from it via QIS, but I believe that can be obtained via calculation rather than simulation. So I don't understand what a superop &lt;em&gt;simulator&lt;/em&gt; is for. I know it's even more resource intensive than density matrix, but what additional capabilities does it provide?&lt;/p&gt;&#xA;" OwnerUserId="15716" LastEditorUserId="9006" LastEditDate="2021-05-03T12:00:47.157" LastActivityDate="2021-05-03T23:23:19.663" Title="What is the superop simulator in Qiskit for?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;&lt;simulation&gt;&lt;density-matrix&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17321" PostTypeId="2" ParentId="17280" CreationDate="2021-05-01T18:18:56.313" Score="0" Body="&lt;p&gt;A circuit (or oracle) is an instance of the Bernstein-Vazirani problem if it is equivalent to a circuit that only contains Controlled-Not operations and Not operations where all of the Controlled-Nots use one common specified qubit (the &amp;quot;output&amp;quot; qubit) as their target.&lt;/p&gt;&#xA;&lt;p&gt;The goal of the problem is to figure out which qubits (other than the output qubit) are being used as the control of a Controlled-Not.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-01T18:18:56.313" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17323" PostTypeId="2" ParentId="13672" CreationDate="2021-05-01T19:29:31.627" Score="1" Body="&lt;p&gt;The answer to your questions is that you don't!&lt;/p&gt;&#xA;&lt;p&gt;The whole point of quantum computing is that your algorithm makes use of the fact that the total number of states after your computation has finished does not increase exponentially. Otherwise, there is no benefit from quantum computers. So, you should be totally fine using 8192 shots for even a 20 qubit circuit, if your algorithm can exploit the advantage offered by quantum computers.&lt;/p&gt;&#xA;&lt;p&gt;As other points out, you can repeat if you want more. But if you need practically too many, reconsider your algorithm.&lt;/p&gt;&#xA;" OwnerUserId="15467" LastActivityDate="2021-05-01T19:29:31.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17325" PostTypeId="2" ParentId="2667" CreationDate="2021-05-02T00:16:10.563" Score="2" Body="&lt;p&gt;Indeed there are various courses offered by Udemy, EdX and Coursera like mentioned above. I haven't tried them so cannot vouch for or against them but I'd like to add a bit more to the list.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/azure/quantum/tutorial-qdk-intro-to-katas&quot; rel=&quot;nofollow noreferrer&quot;&gt;Microsoft Quantum Katas&lt;/a&gt;: a very comprehensive and practical hands-on approach using their Q# language for quantum computing and Jupyter Notebooks. It starts off with the math (complex numbers and linear algebra) that you will need (I supplemented them with some videos from Khan Academy on YouTube), then it goes onto the fundamental concepts like qubits and quantum gates, then hands-on implementing some of the most common algorithms and then onto more advanced topics (including some &amp;quot;entanglement games&amp;quot;!). And it's completely free!&lt;/li&gt;&#xA;&lt;li&gt;MIT has two online courses: the intro to &lt;a href=&quot;https://learn-xpro.mit.edu/quantum-computing&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Fundamentals&lt;/a&gt; and then the more advanced &lt;a href=&quot;https://xpro.mit.edu/programs/program-v1:xPRO+QCR/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Computing Realities&lt;/a&gt;. These do cost a bit though. I haven't enrolled in these but I figure if you're wanting to not only expand your knowledge and understanding but get some certification to prove it, then these could be good.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;https://brilliant.org/courses/quantum-computing/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Brilliant&lt;/a&gt;: I left my favorite till last. This costs as well, but about $200 for an annual premium membership to all their courses that focus around science and technology. There are many good courses, including one on quantum mechanics and another on quantum computing. Included is also a lot on math and computer science/related topics like cryptocurrency and neural networks. The thing I like about Brilliant is the courses are backed and created by well-known, reputable institutions and are byte-sized and interactive which suits my learning style over reading long papers and/or watching long video presentations.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15720" LastActivityDate="2021-05-02T00:16:10.563" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17326" PostTypeId="2" ParentId="15691" CreationDate="2021-05-02T05:36:36.653" Score="0" Body="&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Let's say I have &lt;span class=&quot;math-container&quot;&gt;$U|ψ⟩=e^{2πi\frac{9}{16}}|ψ⟩$&lt;/span&gt; (so the angle is &lt;span class=&quot;math-container&quot;&gt;$0.1001$&lt;/span&gt; in binary). Now I use n=2 so &lt;span class=&quot;math-container&quot;&gt;$2^n=4$&lt;/span&gt; (i.e. I am using two ancilla qubits with &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U^2$&lt;/span&gt;). So now I can say that I will get &lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{2}, \frac{1}{2} \pm \frac{1}{8}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \pm \frac{1}{4}$&lt;/span&gt; with prob ≥&lt;span class=&quot;math-container&quot;&gt;$ \frac{8}{π^2}$&lt;/span&gt;, but I will get &lt;span class=&quot;math-container&quot;&gt;$ \frac{1}{2}$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2} \pm \frac{1}{8}$&lt;/span&gt; with prob ≥&lt;span class=&quot;math-container&quot;&gt;$ \frac{4}{π^2} $&lt;/span&gt; .&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Amplitude estimation is an application of phase estimation procedure to estimation the eigenvalue of the Grover iteration G, which in turn enable us to determine the amplitude of the initial state.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;QPE:&lt;/p&gt;&#xA;&lt;p&gt;Considering the phase &lt;span class=&quot;math-container&quot;&gt;$\varphi=\frac{9}{16}$&lt;/span&gt;, we use two bits to estimeate &lt;span class=&quot;math-container&quot;&gt;$\varphi=0.1001$&lt;/span&gt;. If the outcome of the final measurement is &lt;span class=&quot;math-container&quot;&gt;$ 10$&lt;/span&gt;, we obtain a pretty good estimate to &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;(i.e., &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; is expressed exactly in two bits).&lt;/p&gt;&#xA;&lt;p&gt;And supposing we wish to approximate &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; to an accuracy &lt;span class=&quot;math-container&quot;&gt;$2^{-1}$&lt;/span&gt;(i.e., &lt;span class=&quot;math-container&quot;&gt;$|\hat{\varphi} - \varphi| \le \epsilon =2^{-2}$&lt;/span&gt;), that is &lt;span class=&quot;math-container&quot;&gt;$\frac{-1}{4}\le \hat{\varphi} - \frac{1}{2} \le \frac{1}{4}$&lt;/span&gt;. The output of measurement is &lt;span class=&quot;math-container&quot;&gt;$\hat{\varphi}*2^2$&lt;/span&gt;, with the probability of success at least &lt;span class=&quot;math-container&quot;&gt;$P(|\hat{\varphi} - \varphi| \le 2^{-2}$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://quantum-computing.ibm.com/composer/files/new?initial=N4IgdghgtgpiBcIAuB3A9gAgA4CcYGMBLAZ0LTAFoBFABQFEQAaEARwmKgRAHl6A5KgEEAygFkMAJgB0ABgDcAHTCEw%2BADYBXACYwMC1jDWEARgEYpK-PsVglLPAHMMLANoBmALo38jjPndeSkoAFs4uMoFgoa6mkdEuEpE4AF4AFBRYhAD0EgCUYRHeOACeqQCcAFSZWQAs%2BTEejK6FSj6lldV5YYlN4XHdkT5pGdldrj0NNvGxNsQoEFhhsb2JNrDsGnhLHhgUAHx%2BLjNK68SbuuM7%2B4erTCA6xD6EWEhkYFwgAL5AA&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Q circuit&lt;/a&gt; use '&lt;em&gt;simulator_statevector&lt;/em&gt;'&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/P61d9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P61d9.png&quot; alt=&quot;use 'simulator_statevector'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13979" LastEditorUserId="13979" LastEditDate="2021-05-04T09:27:55.693" LastActivityDate="2021-05-04T09:27:55.693" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17327" PostTypeId="2" ParentId="17314" CreationDate="2021-05-02T13:05:27.613" Score="1" Body="&lt;p&gt;Yes, you can do that without a problem. They only control the total number of experiments or jobs that you have submitted simultaneously. As long as the total number of submitted jobs (currently 5) are met with your account, regardless of the specifications from where they are submitted, it is ok.&lt;/p&gt;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerUserId="15467" LastActivityDate="2021-05-02T13:05:27.613" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17328" PostTypeId="1" CreationDate="2021-05-02T21:23:10.293" Score="1" ViewCount="73" Body="&lt;p&gt;I'm struggling to get a program running where I have a circuit with a measurement and reset mid-execution and I want to use noise mitigation and state tomography together.&lt;/p&gt;&#xA;&lt;p&gt;The circuit is defined&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qreg_q = QuantumRegister(2, &amp;quot;q&amp;quot;)&#xA;creg_c = ClassicalRegister(1, &amp;quot;c&amp;quot;)&#xA;&#xA;qc = QuantumCircuit(qreg_q, creg_c)&#xA;&#xA;qc.u(1, 1, 1, qreg_q[0])&#xA;&#xA;qc.cu(1, 0, 0, 0, qreg_q[0], qreg_q[1])&#xA;qc.cx(qreg_q[1], qreg_q[0])&#xA;qc.measure(qreg_q[1], creg_c[0])&#xA;qc.reset(qreg_q[1])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;N.B I don't need the measurement result here.&lt;/p&gt;&#xA;&lt;p&gt;I then create my tomography circuits from this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.ignis.verification.tomography import state_tomography_circuits, StateTomographyFitter&#xA;qpt_circs = state_tomography_circuits(qc, qreg_q[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and the calibration circuits&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit.ignis.mitigation.measurement as mc&#xA;&#xA;cal_qr = QuantumRegister(2)&#xA;cal_cr = ClassicalRegister(2)&#xA;&#xA;meas_calibs, state_labels = mc.complete_meas_cal(qublit_list=[0])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Using a simulator with a noise-model&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = provider.get_backend('ibmqx2')&#xA;sim = AerSimulator.from_backend(backend)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I run the calibration circuit&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job_cal = sim.run(meas_calibs, shots=8192)&#xA;&#xA;meas_fitter = mc.CompleteMeasFitter(job_cal.result(), state_labels)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I then run the tomography circuits&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qpt_circs_compiled = transpile(qpt_circs, sim)&#xA;job_tomo = sim.run(qpt_circs_compiled, shots=8192)&#xA;&#xA;result = job_tomo.result()&#xA;&#xA;tomo_state = StateTomographyFitter(result, qpt_circs)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I'm able to obtain a state from the result with tomography&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;state = tomo_state.fit()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However the noise mitigation fails&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;meas_filter = meas_fitter.filter&#xA;mitigated_results = meas_filter.apply(result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;with &lt;code&gt;QiskitError: &amp;quot;Unexpected state label '0 0', verify the fitter's state labels correspond to the input data&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It seems to me that the tomography circuits add a second classical register that the noise mitigation circuits isn't configured to process properly. How can I get around this so I can mitigate the noise in my density matrix output?&lt;/p&gt;&#xA;" OwnerUserId="15727" LastActivityDate="2021-05-02T21:23:10.293" Title="Qiskit Tomography and Noise Mitigation with a Measurement Mid-Execution" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17329" PostTypeId="1" AcceptedAnswerId="17356" CreationDate="2021-05-03T04:00:59.230" Score="3" ViewCount="72" Body="&lt;p&gt;I'm working through Nielsen and Chuang and I'm pretty confused by the discussion of quantum process tomography. I'm trying to work through an example of 1-qubit state tomography given by N&amp;amp;C (box 8.5), which provides an algorithm for determining &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; in terms of block matrices and density matrices (determined by state tomography). The process seems pretty straight forward, but how does &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; characterize a quantum process?&lt;/p&gt;&#xA;" OwnerUserId="15445" LastEditorUserId="55" LastEditDate="2021-05-03T08:35:40.040" LastActivityDate="2021-05-06T09:05:45.200" Title="In quantum process tomography, how does $\chi$ characterize a quantum process?" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;quantum-process-tomography&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17333" PostTypeId="2" ParentId="2110" CreationDate="2021-05-03T11:57:50.777" Score="0" Body="&lt;p&gt;The point is: building a circuit for testing &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; for being 1 given &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, is way much simpler than building a circuit for finding &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5551" LastActivityDate="2021-05-03T11:57:50.777" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17334" PostTypeId="2" ParentId="16942" CreationDate="2021-05-03T15:52:56.610" Score="6" Body="&lt;h2&gt;Grover's algorithm&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;We are given&lt;/strong&gt;&lt;/em&gt; a function &lt;span class=&quot;math-container&quot;&gt;$f(a)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(a)=0$&lt;/span&gt; for all of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; possible values of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;, except when &lt;span class=&quot;math-container&quot;&gt;$a=\omega$&lt;/span&gt; in which case we have &lt;span class=&quot;math-container&quot;&gt;$f(\omega)=1$&lt;/span&gt;. Assuming that this &lt;span class=&quot;math-container&quot;&gt;$f(a)$&lt;/span&gt; can be calculated using a classical reversible code or hardware, we can find &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; steps using a quantum circuit as opposed to a classical computer which will on average require &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; evaluations of the function &lt;span class=&quot;math-container&quot;&gt;$f(a)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h2&gt;Adiabatic version (1996, Farhi &amp;amp; Gutman)&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;We are given&lt;/strong&gt;&lt;/em&gt; a Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and we are told that the eigenvalues corresponding to all of the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; possible eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; are 0, except when &lt;span class=&quot;math-container&quot;&gt;$|a\rangle= |\omega\rangle$&lt;/span&gt; in which case we have an eigenvalue of 1. Assuming this Hamiltonian can be calculated by a quantum computer, we can find &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; runtime on an adiabatic quantum computer as opposed to a classical computer which would require checking on average &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; eigenvectors for a diagonal Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Notice that the above two paragraphs are the same except &amp;quot;function&amp;quot; is now &amp;quot;Hamiltonian&amp;quot; and &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; is now &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; is now &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt;.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2&gt;Do we need to know the &amp;quot;answer&amp;quot; in advance?&lt;/h2&gt;&#xA;&lt;p&gt;Basically, in the circuit-based version you need some classical code/hardware (possibly black-box!) that can give you the function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; on demand.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It could be the case that the person that wrote that code or built that hardware, used an  unstructured database of &lt;span class=&quot;math-container&quot;&gt;$f(a)$&lt;/span&gt; values to make it, and while doing so they found the needle &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; in the haystack of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; values.&lt;/li&gt;&#xA;&lt;li&gt;Maybe they even used the fact that &lt;span class=&quot;math-container&quot;&gt;$f(\omega)=1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$f(a)=0$&lt;/span&gt; for all other &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; in order to build the classical circuit, so they knew the golden &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; value in advance.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The point is that &lt;em&gt;&lt;strong&gt;you&lt;/strong&gt;&lt;/em&gt; don't know the &lt;span class=&quot;math-container&quot;&gt;$\omega$&lt;/span&gt; value, and maybe the person who wrote the code doesn't either (they could have forgot, or they won't tell you, or they never knew in the first place). If you have a spreadsheet with a long column with every entry being 0 except for one that is a 1, sure the person who made the spreadsheet may know where the 1 is, as does the computer does, but &lt;em&gt;&lt;strong&gt;you&lt;/strong&gt;&lt;/em&gt; don't know it. &lt;strong&gt;The same is the case for the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; in the adiabatic version, which I'll explain in more detail below.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Detailed explanation of the 1996 adiabatic version:&lt;/h2&gt;&#xA;&lt;p&gt;We are given &lt;span class=&quot;math-container&quot;&gt;$H = |\omega\rangle \langle \omega |$&lt;/span&gt; which has an eigenvalue of 1 for the eigenvector &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; and an eigenvalue of 0 for all other eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. There is some quantum hardware (a packaged system of qubits with certain couplers and fields) embodies the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. This hardware might be a black-box, and the person who made it may or may not know &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; but the point is that you don't know &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; and you want to find it.&lt;/p&gt;&#xA;&lt;p&gt;Pick a random state &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; and add the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$|s\rangle \langle s |$&lt;/span&gt; to the Hamiltonian you were given earlier. You can easily do this physically, by simply adding the couplings and fields in &lt;span class=&quot;math-container&quot;&gt;$|s\rangle \langle s |$&lt;/span&gt; to whatever was present in the package you started with.&lt;/p&gt;&#xA;&lt;p&gt;Starting with &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; and calculating the state at time &lt;span class=&quot;math-container&quot;&gt;$t$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = e^{-\textrm{i}Ht} | s\rangle$&lt;/span&gt; results in the following state (in the 2D subspace with basis states &lt;span class=&quot;math-container&quot;&gt;$|\omega \rangle$&lt;/span&gt; followed by &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;|\psi \rangle = e^{-\textrm{i}t} \begin{pmatrix}&#xA;x \cos (xt) - \textrm{i} \sin (xt) \\&#xA;\sqrt{1-x^2} \cos(xt) &#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$x = \langle s | \omega \rangle$&lt;/span&gt;. The probability of finding your desired state &lt;span class=&quot;math-container&quot;&gt;$|\omega \rangle$&lt;/span&gt; is then:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{2}&#xA;|\langle w| \psi \rangle |^2 = \sin^2(xt) + x^2 \cos^2(xt).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The probability of finding the system in the desired state &lt;span class=&quot;math-container&quot;&gt;$|\omega \rangle$&lt;/span&gt; will be 1 when &lt;span class=&quot;math-container&quot;&gt;$t = \frac{\pi}{2x}$&lt;/span&gt; and since the expected values of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1/\sqrt{N})$&lt;/span&gt; if you pick a nomralized &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; randomly we will have &lt;span class=&quot;math-container&quot;&gt;$|\langle s | \omega \rangle |^2 = 1/N$&lt;/span&gt;, so the &lt;strong&gt;runtime &lt;span class=&quot;math-container&quot;&gt;$t = \mathcal{O}(\sqrt{N})$&lt;/span&gt;.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Adiabatic version (2001, van Dam, Mosca, Vazirani)&lt;/h2&gt;&#xA;&lt;p&gt;Here the eigenvalues in the final Hamiltonian are 1 for all states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; except for &lt;span class=&quot;math-container&quot;&gt;$|\omega \rangle$&lt;/span&gt; which has eigenvalue 0:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;H = \sum_{a\ne \omega} |a\rangle \langle a|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The initial Hamiltonian is defined similarly but in the Hadamard basis and with ground state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{4}&#xA;H_i = \sum_{a\ne 0} |\bar{a}\rangle \langle \bar{a}|.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The time-dependent gap between the two lowest eigenvalues of the time-dependent Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{5}&#xA;\left( 1 - s \right) H_0  + s H,&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$s\equiv t/T$&lt;/span&gt; is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{6}&#xA;g(s) = \sqrt{\frac{N  + 4(N  -1)(s^2 - s)}{N}}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At &lt;span class=&quot;math-container&quot;&gt;$t = T/2$&lt;/span&gt; we get &lt;span class=&quot;math-container&quot;&gt;$g(s) = \min_s g(s) = 1/\sqrt{N}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now to get the runtime, we calculate:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\int_{s=0}^1  \frac{1}{g(s)^2} \textrm{d}s &amp;amp;= \frac{N\arctan{\left(\sqrt{N-1} \right)}}{\sqrt{N-1}}\tag{7}\\&#xA;             &amp;amp;= \mathcal{O}(N/sqrt{N})\tag{8}\\&#xA;             &amp;amp;= \mathcal{O}(\sqrt{N})\tag{9}.&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;Some extra notes&lt;/h2&gt;&#xA;&lt;p&gt;I'll also give you some notes I made on the 1996 paper years ago. It took me so long to find the file on my computer, so it's probably a good thing anyway that I've now been convinced by you to share them more publicly:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The paper didn't mention that if you are unlucky enough to pick and &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; that is orthogonal to &lt;span class=&quot;math-container&quot;&gt;$|\omega \rangle$&lt;/span&gt;, your probability of getting &lt;span class=&quot;math-container&quot;&gt;$|\omega\rangle$&lt;/span&gt; becomes 0 (just plug &lt;span class=&quot;math-container&quot;&gt;$\langle s |\omega \rangle = x=0$&lt;/span&gt; into Eq. 2. Another way to think of this is to say that the runtime would be &lt;span class=&quot;math-container&quot;&gt;$t = +\infty$&lt;/span&gt; if you were unlucky enough to pick this state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The way I found around this was to bound the runtime by some maximum time &lt;span class=&quot;math-container&quot;&gt;$t_{\textrm{max}}$&lt;/span&gt; and if that time limit is reached, give up on the chosen &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; and try a different one.  How big does &lt;span class=&quot;math-container&quot;&gt;$t_{\textrm{max}}$&lt;/span&gt; have to be though? The paper doesn't say.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The algorithm involves picking a random vector &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt;. For some vectors, the time it takes for &lt;span class=&quot;math-container&quot;&gt;$P(t)$&lt;/span&gt; (ie. the probability of finding &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt;, defined in Eq. 2 to become 1 will be short (such as if &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; happens to be &lt;span class=&quot;math-container&quot;&gt;$|w\rangle$&lt;/span&gt;), and for some it will be long. On average the authors say the runtime will be  &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt;. Out of all possible random vectors &lt;span class=&quot;math-container&quot;&gt;$|s\rangle$&lt;/span&gt; that can be chosen, if it is possible that &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; of them require runtimes of &lt;span class=&quot;math-container&quot;&gt;$t_{\textrm{max}}$&lt;/span&gt; worse than &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt(N))$&lt;/span&gt;, then we would need to run the algorithm for worse than &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; each time (&lt;span class=&quot;math-container&quot;&gt;$t_{\textrm{max}}$&lt;/span&gt; would have to be worse than &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt;), or we might want to run the algorithm for a time &lt;span class=&quot;math-container&quot;&gt;$t_{\textrm{max}} = \mathcal{O}(\sqrt{N})$&lt;/span&gt;, but more than &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt; times, making the total runtime bigger than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. The classical runtime for the search is at worst &lt;span class=&quot;math-container&quot;&gt;$kN$&lt;/span&gt;  where &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is the time it takes to check whether or not one entry of the database (one input for the function) has the value (gives the output) we're seeking, so it's possible for a classical computer to get the answer faster than this quantum-based algorithm, but unless we are met with this type of bad luck, the quantum-based algorithm should give us the answer with a runtime of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\sqrt{N})$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="2293" LastEditorUserId="2293" LastEditDate="2021-05-03T16:23:51.397" LastActivityDate="2021-05-03T16:23:51.397" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17335" PostTypeId="2" ParentId="6639" CreationDate="2021-05-03T16:09:47.280" Score="1" Body="&lt;p&gt;Your background is more than sufficient.&lt;/p&gt;&#xA;&lt;p&gt;To me it looks like your main weak point is you don't have existing knowledge of how classical logic circuits are constructed, so you'll have to learn that as part of learning quantum circuit construction. A minor obstacle; very doable.&lt;/p&gt;&#xA;&lt;p&gt;You listed several calculus courses. Those would be important for learning quantum &lt;em&gt;physics&lt;/em&gt; (solving continuous wave equations), but it's essentially unnecessary for quantum &lt;em&gt;computing&lt;/em&gt;. The linear algebra courses are crucial, though.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-03T16:09:47.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17336" PostTypeId="1" AcceptedAnswerId="17353" CreationDate="2021-05-03T17:31:43.663" Score="2" ViewCount="75" Body="&lt;p&gt;Let's say I have 3 qubits: &lt;span class=&quot;math-container&quot;&gt;$q_1,q_2,q_3$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I want to apply Grover's algorithm on q1,q2, such that q1,q2 &lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt; 10 and do the same for q2,q3, so that q2,q3 &lt;span class=&quot;math-container&quot;&gt;$\neq$&lt;/span&gt;  11. The final possible combinations of the qubits q1,q2,q3 should then be:&lt;br /&gt;&#xA;000&lt;br /&gt;&#xA;001&lt;br /&gt;&#xA;010&lt;br /&gt;&#xA;110&lt;/p&gt;&#xA;&lt;p&gt;And they shouldn't be:&lt;br /&gt;&#xA;011&lt;br /&gt;&#xA;100&lt;br /&gt;&#xA;101&lt;br /&gt;&#xA;111&lt;/p&gt;&#xA;&lt;p&gt;If this is possible then couldn't I solve 3sat in polynomial time with a quantum computer? Couldn't I just remove the possibility of each clause being unsatisfied from a set of qbits representing the variables in the 3sat problem and then collapse the qbits to see if the final result is satisfiable?&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Example of how I think a quantum computer would solve an instance of a 3sat problem in polynomial time:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note: each computation should be on a set of 3 qbits at a time which should take &lt;span class=&quot;math-container&quot;&gt;$2^{3/2}$&lt;/span&gt; time with Grover's algorithm, or O(1) in big O notation)&lt;/p&gt;&#xA;&lt;p&gt;Variables = &lt;span class=&quot;math-container&quot;&gt;${a,b,c,d,e}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;clauses = &lt;span class=&quot;math-container&quot;&gt;${(\neg a \vee b \vee \neg c),(b \vee c \vee d),(\neg b \vee \neg c \vee d),(c \vee \neg d \vee e),(c \vee \neg d \vee \neg e)}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have qubits &lt;span class=&quot;math-container&quot;&gt;$q_a, q_b, q_c, q_d, q_e$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;for  &lt;span class=&quot;math-container&quot;&gt;$q_a, q_b, q_c$&lt;/span&gt; we remove the possibility of 101 (since this would not satisfy the 1st clause)&lt;/p&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$q_b, q_c, q_d$&lt;/span&gt; we remove the possibility of 000 and 110 (since those would not satisfy the 2nd and 3rd clause)&lt;/p&gt;&#xA;&lt;p&gt;for &lt;span class=&quot;math-container&quot;&gt;$q_c, q_d, q_e$&lt;/span&gt; we remove the possibility of 010 and 011 (since those would not satisfy the 4th and 5th clause)&lt;/p&gt;&#xA;&lt;p&gt;Now the possible outputs of the qbits are:&lt;/p&gt;&#xA;&lt;p&gt;00100&lt;br /&gt;&#xA;00101&lt;br /&gt;&#xA;00110&lt;br /&gt;&#xA;00111&lt;br /&gt;&#xA;01000&lt;br /&gt;&#xA;01001&lt;br /&gt;&#xA;01110&lt;br /&gt;&#xA;01111&lt;br /&gt;&#xA;11000&lt;br /&gt;&#xA;11001&lt;br /&gt;&#xA;11110&lt;br /&gt;&#xA;11111&lt;/p&gt;&#xA;&lt;p&gt;So if I collapse the qbits I should remain with one of these combinations which satisfies the problem. If there is no possible solution, the qbits will just collapse into something meaningless which will not satisfy the problem.&lt;/p&gt;&#xA;&lt;p&gt;If anyone can show me the flaw in my logic, please let me know, I highly doubt I solved 3sat. I'm just trying to learn.&lt;/p&gt;&#xA;" OwnerUserId="15600" LastEditorUserId="15600" LastEditDate="2021-05-04T14:13:01.560" LastActivityDate="2021-05-05T08:14:56.697" Title="Can I use Grover's algorithm on overlapping sets of qubits?" Tags="&lt;programming&gt;&lt;quantum-state&gt;&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;quantum-advantage&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17337" PostTypeId="2" ParentId="17320" CreationDate="2021-05-03T23:23:19.663" Score="5" Body="&lt;p&gt;If you have an &lt;strong&gt;ideal&lt;/strong&gt; quantum circuit, you can easily get its superoperator representation using &lt;code&gt;qiskit.quantum_info.SuperOp&lt;/code&gt; as follows,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1)&#xA;qc.x(0)&#xA;&#xA;super_op = SuperOp(qc)&#xA;array_to_latex(super_op)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left[\begin{matrix}&#xA;0 &amp;amp;  0  &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp;  0  &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp;  1  &amp;amp; 0 &amp;amp; 0\\&#xA;1 &amp;amp;  0  &amp;amp; 0 &amp;amp; 0\\&#xA;\end{matrix}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And to see how a quantum state is evolved by applying this operator:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;rho1 = DensityMatrix.from_label('0')&#xA;&#xA;rho2 = rho1.evolve(super_op)&#xA;rho2.draw('latex')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, you can not use this method to get the superoperator representation of the circuit &lt;strong&gt;in the presence of errors&lt;/strong&gt;. Instead, you can use superop simulator, which accepts a &lt;code&gt;NoiseModel&lt;/code&gt; as a parameter&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Add save_superop instruction to save the simulator state to the returned results:&#xA;qc.save_superop()&#xA;&#xA;# Get noise model:&#xA;provider = IBMQ.load_account()&#xA;backend = provider.get_backend('ibmq_16_melbourne')&#xA;noise_model = NoiseModel.from_backend(backend)&#xA;&#xA;# Get the superoperator:&#xA;noisy_simulator = AerSimulator(method = 'superop', noise_model = noise_model)&#xA;result = noisy_simulator.run(qc).result()&#xA;super_op_array = result.data()['superop']&#xA;array_to_latex(super_op_array)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And in this case the output will be somthing like that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\left[\begin{matrix}&#xA;0.00094 &amp;amp;  0  &amp;amp; 0 &amp;amp; 0.99979\\&#xA;0 &amp;amp;  0  &amp;amp; 0.99907 &amp;amp; 0\\&#xA;0 &amp;amp;  0.99907  &amp;amp; 0 &amp;amp; 0\\&#xA;0.99906 &amp;amp;  0  &amp;amp; 0 &amp;amp; 0.00021\\&#xA;\end{matrix}\right]&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-05-03T23:23:19.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17338" PostTypeId="1" CreationDate="2021-05-04T00:42:23.687" Score="2" ViewCount="77" Body="&lt;p&gt;I am using quantum labs in IBM Quantum Experience to my circuits. But from yesterday onwards (May-03-2021) this error message is being shown on my screen. Does anyone have any idea about this issue?&lt;a href=&quot;https://i.stack.imgur.com/k8iCl.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k8iCl.png&quot; alt=&quot;Screenshot of error I am getting&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15214" LastEditorUserId="55" LastEditDate="2021-05-04T09:01:49.480" LastActivityDate="2021-05-04T09:01:49.480" Title="Why I am gettting this error when I try to open the Quantum Lab in the IBM Quantum experience?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17339" PostTypeId="2" ParentId="17338" CreationDate="2021-05-04T03:05:33.357" Score="1" Body="&lt;p&gt;On the Qiskit slack there have been others who have the same issue connecting to Quantum Lab. A 503 Service Unavailable Error may be due to service maintenance or being overloaded. You may have to just wait for the server to return.&lt;/p&gt;&#xA;" OwnerUserId="15602" LastActivityDate="2021-05-04T03:05:33.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17340" PostTypeId="2" ParentId="16942" CreationDate="2021-05-04T06:49:40.753" Score="2" Body="&lt;p&gt;For me, Sam Palmer's answer starts to have the right sort of structure. But, for the sake of being more explicit:&lt;/p&gt;&#xA;&lt;p&gt;We're interested in solving problems that are in the class NP, i.e. they have a function that lets you recognise correct answers. It is sufficient for me to talk about one specific case: 3-SAT. That is because this case is NP-complete - every problem in NP can be solved by solving an instance of 3-SAT.&lt;/p&gt;&#xA;&lt;p&gt;Just to recall 3-SAT: you're given a bunch of clauses on triples of variables, all of which must hold true. So, you can construct positive semi-definite Hamiltonian terms &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; corresponding to each term such that &lt;span class=&quot;math-container&quot;&gt;$H_i|x\rangle=0$&lt;/span&gt; if and only if the binary string &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; satisfies clause &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. You'd typically want all other eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; to be well separated from &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. Indeed, you'd probably set &lt;span class=&quot;math-container&quot;&gt;$H_i=\Delta(I-P_i)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$P_i$&lt;/span&gt; is a projector onto all the terms satisfying clause &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So, each term &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; encodes your problem specification. Then,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_iH_i&#xA;$$&lt;/span&gt;&#xA;has a ground state energy of 0 if and only if there's a satisfying instance. You only use what you knew of the 3-sat problem specification, and definitely do not already know the answer. Of course, this says nothing about the energy of the first excited state. That's probably a bit messier...&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-04T06:49:40.753" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17341" PostTypeId="1" AcceptedAnswerId="17345" CreationDate="2021-05-04T16:16:39.810" Score="2" ViewCount="48" Body="&lt;p&gt;I am just wondering in what way &lt;code&gt;cirq.Qid&lt;/code&gt; class generalizes qudits. From &lt;code&gt;cirq.Qid&lt;/code&gt; documentation we read that it&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Identifies a quantum object such as a qubit, qudit, resonator, etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I am not sure what this resonator means and if it is somehow connected to other qudits in the system.&lt;/p&gt;&#xA;&lt;p&gt;Could anyone clarify it?&lt;/p&gt;&#xA;" OwnerUserId="15435" LastActivityDate="2021-05-04T19:40:49.093" Title="Why `cirq` needs `Qid` class instead of just `Qudit` class?" Tags="&lt;programming&gt;&lt;cirq&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17342" PostTypeId="1" CreationDate="2021-05-04T16:35:16.630" Score="3" ViewCount="47" Body="&lt;p&gt;If I would design library for quantum computation I would naively consider a sequences of entangled qudits with unit length as a building blocks. I.e., unit length elements from &lt;span class=&quot;math-container&quot;&gt;$$\mathbb{C}^{d_{1}}\otimes \mathbb{C}^{d_{2}}\otimes\cdots\otimes\mathbb{C}^{d_k}$$&lt;/span&gt;&#xA;and denote this space by &lt;span class=&quot;math-container&quot;&gt;$S^{d_1d_2\dots d_k}$&lt;/span&gt;, because it is in fact a unit sphere.&lt;/p&gt;&#xA;&lt;p&gt;Then any circuit would be just a unitary operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{d_{1}}\otimes \mathbb{C}^{d_{2}}\otimes\cdots\otimes\mathbb{C}^{d_k}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we would like to consider mixed states then that would be taking an arbitrary probability measure &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$S^{d_1d_2\dots d_k}.$&lt;/span&gt; It would be convenient because the probabilities on the output of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; would be modeled by pushforward measure &lt;span class=&quot;math-container&quot;&gt;$U_*(P)$&lt;/span&gt;, i.e. &lt;span class=&quot;math-container&quot;&gt;$P\circ U^{-1}.$&lt;/span&gt; Even more generally if we would have an arbitrary measurable function &lt;span class=&quot;math-container&quot;&gt;$f:S^{d_1d_2\dots d_k}\to\Omega$&lt;/span&gt; then the previous would still hold, thus we can define quantum measurement in this manner as well (and any quantum operation as well).&lt;/p&gt;&#xA;&lt;p&gt;If we have any quantum hardware then the question boils down whether we can set up any pure state and mixed states and whether an abstract unitary operation/function &lt;span class=&quot;math-container&quot;&gt;$(U/f)$&lt;/span&gt; have a realization  in hardware. To test if a hardware works we just gather statistics.&lt;/p&gt;&#xA;&lt;p&gt;Does the formalism that I describe constitutes of all possible operations that quantum computer can do? If so, is there any quantum computation library which is based on the formalism that I sketched above?&lt;/p&gt;&#xA;" OwnerUserId="15435" LastEditorUserId="15435" LastEditDate="2021-05-04T16:50:12.137" LastActivityDate="2021-05-04T16:50:12.137" Title="Modeling building blocks for quantum computation" Tags="&lt;entanglement&gt;&lt;mathematics&gt;&lt;density-matrix&gt;&lt;models&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17343" PostTypeId="1" AcceptedAnswerId="17346" CreationDate="2021-05-04T17:27:05.770" Score="4" ViewCount="311" Body="&lt;p&gt;Let's assume we have a register of qubits present in a mixed state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_i^n p_i|\psi_i\rangle \langle \psi_i|$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and we want to teleport &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; through a random pure state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;. What would be the result of this teleportation?&lt;/p&gt;&#xA;&lt;p&gt;Additionally, what would happen if &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is one of the pure states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is composed of?&lt;/p&gt;&#xA;&lt;p&gt;I do struggle a little with the density matrix formalism of QC, therefore, I could use some help here.&lt;/p&gt;&#xA;" OwnerUserId="14817" LastEditorUserId="1939" LastEditDate="2021-05-04T21:36:16.843" LastActivityDate="2021-05-04T21:39:39.527" Title="Quantum teleportation of a mixed state through a pure state?" Tags="&lt;density-matrix&gt;&lt;teleportation&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17344" PostTypeId="1" AcceptedAnswerId="17352" CreationDate="2021-05-04T18:20:43.863" Score="3" ViewCount="69" Body="&lt;p&gt;I am using Jupyter Notebook with Qiskit.&lt;/p&gt;&#xA;&lt;p&gt;I have created a program that can add two 3-bit numbers together. When I simulate this program on a qasm_simulator it works as expected and I can add any two 3-bit numbers together such as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$011 + 110 = 1000$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, when I try to get the result on real quantum hardware (IBMQ) it gets very unexpected results as seen below.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/c4LIz.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/c4LIz.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I know there will obviosly be noise when using the quantum hardware but the results arent even close to what they should be, does anyone know why?&lt;/p&gt;&#xA;&lt;h2&gt;My code:&lt;/h2&gt;&#xA;&lt;pre&gt;&lt;code&gt;%matplotlib inline&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumRegister&#xA;from qiskit import ClassicalRegister&#xA;from qiskit import QuantumCircuit, execute, Aer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from ibm_quantum_widgets import *&#xA;from qiskit.tools.monitor import job_monitor&#xA;from qiskit.providers.ibmq import least_busy&#xA;&#xA;# Loading IBM Q account(s)&#xA;provider = IBMQ.load_account()&#xA;&#xA;## Create COUT sub-routine&#xA;&#xA;q0 = QuantumRegister(1) # First number&#xA;q1 = QuantumRegister(1) # Second number, then sum&#xA;q2 = QuantumRegister(1) # Carry bit i&#xA;q3 = QuantumRegister(1) # Carry bits i+1&#xA;&#xA;# Build a COUT sub-circuit&#xA;COUT_qr = QuantumRegister(4)&#xA;COUT = QuantumCircuit(q0,q1,q2,q3,name='COUT')&#xA;&#xA;COUT.ccx(q1[0],q2[0],q3[0])&#xA;COUT.cx(q1[0],q2[0])&#xA;COUT.ccx(q0[0],q2[0],q3[0])&#xA;&#xA;# convert to a gate&#xA;COUT_inst = COUT.to_instruction()&#xA;&#xA;&#xA;## reverse COUT sub-routine&#xA;&#xA;q0 = QuantumRegister(1) # First number&#xA;q1 = QuantumRegister(1) # Second number, then sum&#xA;q2 = QuantumRegister(1) # Carry bit i&#xA;q3 = QuantumRegister(1) # Carry bits i+1&#xA;&#xA;# Build a COUT sub-circuit&#xA;reverseCOUT = QuantumCircuit(q0,q1,q2,q3,name='reverseCOUT')&#xA;&#xA;reverseCOUT.ccx(q0[0],q2[0],q3[0])&#xA;reverseCOUT.cx(q1[0],q2[0])&#xA;reverseCOUT.ccx(q1[0],q2[0],q3[0])&#xA;&#xA;# convert to a gate&#xA;reverseCOUT_inst = reverseCOUT.to_instruction()&#xA;&#xA;&#xA;## Create SUM sub-routine&#xA;&#xA;q0 = QuantumRegister(1) # First number&#xA;q1 = QuantumRegister(1) # Second number, then sum&#xA;q2 = QuantumRegister(1) # Carry bit i&#xA;&#xA;&#xA;# Build a COUT sub-circuit&#xA;SUM = QuantumCircuit(q0,q1,q2,name='SUM')&#xA;&#xA;SUM.cx(q0[0],q2[0])&#xA;SUM.cx(q1[0],q2[0])&#xA;&#xA;&#xA;# convert to a gate&#xA;SUM_inst = SUM.to_instruction()&#xA;&#xA;&#xA;# n is the length of the qubits you are adding together&#xA;n = 3&#xA;&#xA;a = QuantumRegister(n,'a') # First number&#xA;b = QuantumRegister(n+1,'b') # Second number, then sum&#xA;c = QuantumRegister(n,'c') # Carry bits&#xA;cl = ClassicalRegister(n+1) # Classical output&#xA;&#xA;# Combining all of them into one quantum circuit&#xA;qc = QuantumCircuit(a, b, c, cl)&#xA;&#xA;# initialise numbers:&#xA;qc.x(0)&#xA;qc.x(1) &#xA;#qc.x(2)&#xA;qc.x(3)&#xA;#qc.x(4) &#xA;qc.x(5)&#xA;&#xA;&#xA;## Create the circuit to add two 3-bit numbers&#xA;# COUT&#xA;qc.append(COUT,[c[0],a[0],b[0],c[1]])&#xA;qc.barrier()&#xA;&#xA;# COUT&#xA;qc.append(COUT,[c[1],a[1],b[1],c[2]])&#xA;qc.barrier()&#xA;&#xA;# COUT&#xA;qc.append(COUT,[c[2],a[2],b[2],b[3]])&#xA;qc.barrier()&#xA;&#xA;&#xA;qc.cx(c[2],b[2])&#xA;qc.barrier()&#xA;&#xA;&#xA;# reverse COUT&#xA;qc.append(reverseCOUT,[c[1],a[1],b[1],c[2]])&#xA;qc.barrier()&#xA;&#xA;&#xA;# SUM&#xA;qc.append(SUM,[c[1],a[1],b[1]])&#xA;qc.barrier()&#xA;&#xA;# reverse COUT&#xA;qc.append(reverseCOUT,[c[0],a[0],b[0],c[1]])&#xA;qc.barrier()&#xA;&#xA;# SUM&#xA;qc.append(SUM,[c[0],a[0],b[0]])&#xA;qc.barrier()&#xA;&#xA;&#xA;# Measure qubits and store results in classical register cl&#xA;for i in range(3+1):&#xA;    qc.measure(b[i], cl[i])&#xA;&#xA;&#xA;# Run the experimient 1024 times and get stats&#xA;counts = execute(qc,Aer.get_backend('qasm_simulator')).result().get_counts()&#xA;plot_histogram(counts)&#xA;&#xA;# Run on Quantum Hardware&#xA;provider = IBMQ.get_provider(hub='ibm-q')&#xA;backend = least_busy(provider.backends(filters=lambda x: x.configuration().n_qubits &amp;gt;= 10 &#xA;                                       and not x.configuration().simulator &#xA;                                       and x.status().operational==True))&#xA;print(&amp;quot;least busy backend: &amp;quot;, backend)&#xA;&#xA;# Run it&#xA;shots = 2048&#xA;transpiled_qc = transpile(qc, backend, optimization_level=3)&#xA;qobj = assemble(transpiled_qc, shots=shots)&#xA;job = backend.run(qobj)&#xA;job_monitor(job)&#xA;&#xA;# Plot results&#xA;counts = job.result().get_counts()&#xA;plot_histogram(counts)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15747" LastEditorUserId="55" LastEditDate="2021-05-04T23:25:04.160" LastActivityDate="2021-05-05T04:10:26.033" Title="Why does running my circuit on Quantum Hardware produce such unexpected resultss?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;simulation&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17345" PostTypeId="2" ParentId="17341" CreationDate="2021-05-04T19:40:49.093" Score="3" Body="&lt;p&gt;Well, originally the idea was that we didn't want to exclude things like continuous quantum systems, and ancillary systems being used as control surfaces, and concepts like &amp;quot;a place where an ion might be&amp;quot; as opposed to the ion itself. So we went with a very generic &amp;quot;identifier for quantum-associated thing&amp;quot; name (qid).&lt;/p&gt;&#xA;&lt;p&gt;At some point Qid gained a &lt;code&gt;dimension&lt;/code&gt; method that returns an integer telling you how many quantum levels there are... so it really basically is a qudit now.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-04T19:40:49.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17346" PostTypeId="2" ParentId="17343" CreationDate="2021-05-04T21:35:36.173" Score="4" Body="&lt;p&gt;The teleportation should behave just the same with a mixed state as it does with a pure state. I'm going to assume a bit of familiarity with how teleportation works for pure states, as you can find many resources addressing that problem.&lt;/p&gt;&#xA;&lt;p&gt;We can describe the task of teleportation as follows: systems &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, our goal is to prepare the state &lt;span class=&quot;math-container&quot;&gt;$\rho_M$&lt;/span&gt; (subscript denotes that its currently stored in &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt;) in system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, using only local operations over &lt;span class=&quot;math-container&quot;&gt;$MA$&lt;/span&gt; plus some preexisting entanglement between &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;. Its simplest to begin with a Bell state prepared over &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;|\Phi_0\rangle_{AB} = \frac{1}{\sqrt{2}}(|00\rangle_{AB} + |11\rangle_{AB})&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so the initial state defined over &lt;span class=&quot;math-container&quot;&gt;$MAB$&lt;/span&gt; is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{2}&#xA;\rho_M \otimes |\Phi_0\rangle\langle \Phi_0|_{AB}= \left(\sum_{i=1}^n p_n |\psi_i\rangle\langle \psi_i|_M \right)\otimes |\Phi_0\rangle\langle \Phi_0|_{AB}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When one works out teleportation for a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; its straightforward (but tedious) to show that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;|\psi_i\rangle_M\otimes |\Phi_0\rangle_{AB} = \sum_{\ell=0}^3 |\Phi_\ell\rangle_{MA}  \otimes \sigma_\ell|\psi_i\rangle_B &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\{\sigma_\ell\}$&lt;/span&gt; are the pauli operators &lt;span class=&quot;math-container&quot;&gt;$\{I,X,Y,Z\}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\{|\Phi_\ell\rangle \}$&lt;/span&gt; are the Bell basis states&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\ell=0,1,2,3$&lt;/span&gt;. But since the tensor product is linear we can just substitue (3) into (2) to rewrite the initial state before teleportation as:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\tag{4}&#xA;\rho_M \otimes |\Phi_0\rangle\langle \Phi_0|_{AB} &amp;amp;= \sum_{i=1}^n  p_n  \sum_{\ell=0}^3 |\Phi_\ell\rangle\langle \Phi_\ell|_{MA}  \otimes \sigma_\ell|\psi_i\rangle\langle \psi_i|_B \sigma_\ell \\&#xA;&amp;amp;=  \sum_{\ell=0}^3  |\Phi_\ell\rangle\langle \Phi_\ell|_{MA}  \otimes\left(\sum_{i=1}^n p_n\sigma_\ell|\psi_i\rangle\langle \psi_i|_B \sigma_\ell\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;So now the teleportation protocol can proceed just the same as with pure states: Perform the measurement &lt;span class=&quot;math-container&quot;&gt;$\{|\Phi_\ell\rangle\langle \Phi_\ell|\}$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$MA$&lt;/span&gt;, classically transmit the measured bit &lt;span class=&quot;math-container&quot;&gt;$\ell$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;, and then have &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; perform a recovery operation &lt;span class=&quot;math-container&quot;&gt;$\sigma_\ell$&lt;/span&gt; to get back the correct state.&lt;/p&gt;&#xA;&lt;p&gt;It might help to view how this works  using an ensemble description of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; where we can describe &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as a classical distribution over states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; that are drawn with probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{5}&#xA;\rho = \{(p_1, |\psi_1\rangle), \dots, (p_i, |\psi_i\rangle), \dots (p_n, |\psi_n\rangle)\}&#xA;$$&lt;/span&gt;&#xA;From this perspective, every time you run the teleportation protocol you can imagine that you are actually randomly drawing and teleporting a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. Then the the distribution of teleported states is still just &lt;span class=&quot;math-container&quot;&gt;$\{(|\psi_i\rangle, p_i)\}$&lt;/span&gt;. This makes it clear that the mixed state teleportation will work regardless of what entangled state over &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; you begin with.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Additionally, what would happen if &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; is one of the pure states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is composed of?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't think this make sense. To teleport an &lt;span class=&quot;math-container&quot;&gt;$s$&lt;/span&gt;-dimensional state you will generally require entanglement over a &lt;span class=&quot;math-container&quot;&gt;$2s$&lt;/span&gt;-dimensional system &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt;. For example, it would not make sense for us to include &lt;span class=&quot;math-container&quot;&gt;$|\Phi_0\rangle \langle \Phi_0|$&lt;/span&gt; in the ensemble &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; because the dimensionalities of systems &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; are off by a factor of two&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; There are many choices for Bell basis states; for concreteness you can consider the basis&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\{|\Phi_0\rangle, (\sigma_1\otimes I)|\Phi_0\rangle, (I\otimes \sigma_3)|\Phi_0\rangle, (\sigma_1\otimes \sigma_3)|\Phi_0\rangle \}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-05-04T21:35:36.173" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17347" PostTypeId="2" ParentId="17343" CreationDate="2021-05-04T21:39:39.527" Score="3" Body="&lt;p&gt;What do you mean by teleportation &amp;quot;through&amp;quot; some state?&lt;/p&gt;&#xA;&lt;p&gt;In essence, teleportation just swaps the states of stationary qubits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle_A | \Phi_{start} \rangle_{AB}  ~~\longrightarrow~~ |\Phi_{end}\rangle_{AA} |\psi\rangle_B&#xA;$$&lt;/span&gt;&#xA;Here &lt;span class=&quot;math-container&quot;&gt;$| \Phi_{start} \rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\Phi_{end}\rangle$&lt;/span&gt; are some Bell states.&lt;br /&gt;&#xA;Two of 3 particles belong to Alice and one to Bob.&lt;/p&gt;&#xA;&lt;p&gt;If you put some mixed state into the algorithm then the result will be the same:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho \otimes |\Phi_{start} \rangle \langle \Phi_{start} |  ~~\longrightarrow~~ |\Phi_{end}\rangle \langle \Phi_{end} | \otimes \rho.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To understand this intuitively you can think of a mixed state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as a classical probability distribution over states &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; (it doesn't matter that the choice of &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; is not unique in general). So, the initial state of teleportation will be a mixture of &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle_A | \Phi_{start} \rangle_{AB}$&lt;/span&gt; with the same weights as in &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. What we'll get after Alice's measurement? Measuring a mixed state is equivalent to measuring each component with the assumption that results will coincide. So, after Alice obtained one of 4 possible results we can think that the measurement of each component &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; gave the same result. The post-measurement state will be the mixture of post-measurement states for each component, e.g. a mixture of &lt;span class=&quot;math-container&quot;&gt;$|\Phi_{end}\rangle_{AA} |r_i\rangle_B$&lt;/span&gt;, again with weights from &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Since the results are the same for each component then Bob's final correction will also be the same. That is, the final state will be a mixture of &lt;span class=&quot;math-container&quot;&gt;$|\Phi_{end}\rangle_{AA} |\psi_i\rangle_B$&lt;/span&gt; – with the same weights as in &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="5870" LastActivityDate="2021-05-04T21:39:39.527" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17348" PostTypeId="1" CreationDate="2021-05-04T23:10:25.827" Score="1" ViewCount="46" Body="&lt;p&gt;How would one determine the worst-case asymptotic complexity (&lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;) of a Bernstein-Vazirani circuit encoding the secret 1111?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastActivityDate="2021-05-05T02:25:33.053" Title="Worst Case Asymptotic Complexity of Berstein-Vazirani" Tags="&lt;complexity-theory&gt;&lt;quantum-circuit&gt;&lt;bernstein-vazirani-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17349" PostTypeId="1" AcceptedAnswerId="17354" CreationDate="2021-05-05T00:13:23.400" Score="6" ViewCount="171" Body="&lt;p&gt;Fix some finite-dimensional space &lt;span class=&quot;math-container&quot;&gt;$\mathcal X$&lt;/span&gt;. Define a &lt;em&gt;POVM&lt;/em&gt; as a collection of positive operators summing to the identity: &lt;span class=&quot;math-container&quot;&gt;$\mu\equiv \{\mu(a):a\in\Sigma\}\subset{\rm Pos}(\mathcal X)$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\sum_{a\in\Sigma}\mu(a)=I_{\mathcal X}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\Sigma$&lt;/span&gt; denotes some finite register.&lt;/p&gt;&#xA;&lt;p&gt;A POVM &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; is said to be &lt;em&gt;extremal&lt;/em&gt; if it cannot be written as a (nontrivial) convex combination of other POVMs.&#xA;Moreover, we say that a POVM is &lt;em&gt;projective&lt;/em&gt; if each &lt;span class=&quot;math-container&quot;&gt;$\mu(a)$&lt;/span&gt; is a (not necessarily unit trace) projection.&lt;/p&gt;&#xA;&lt;p&gt;As discussed in &lt;a href=&quot;https://cs.uwaterloo.ca/%7Ewatrous/TQI/&quot; rel=&quot;noreferrer&quot;&gt;Watrous' book&lt;/a&gt;, one can prove that any projective POVM is extremal.&lt;/p&gt;&#xA;&lt;p&gt;Does the implication work in the other direction as well? If not, what are examples of extremal non-projective POVMs?&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Impossible for binary-outcome POVMs)&lt;/strong&gt;&lt;/em&gt;&#xA;At least in the case of two-element POVMs, this doesn't seem to be possible: if &lt;span class=&quot;math-container&quot;&gt;$\mu(1)+\mu(2)=I$&lt;/span&gt;, then they are mutually (unitarily) diagonalisable. In an appropriate choice of basis, we can write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mu(1)= \operatorname{diag}(s_1,...,s_n),&#xA;\qquad \mu(2)=\operatorname{diag}(1-s_1,...,1-s_n),$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$s_i\in[0,1]$&lt;/span&gt;. Such a POVM is projective &lt;em&gt;iff&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$s_i\in\{0,1\}$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i=1,...,n$&lt;/span&gt;.&#xA;Suppose that the POVM is &lt;em&gt;not&lt;/em&gt; projective, and thus there is some &lt;span class=&quot;math-container&quot;&gt;$s_i\in(0,1)$&lt;/span&gt;. Let us assume without loss of generality that &lt;span class=&quot;math-container&quot;&gt;$s_1\in(0,1)$&lt;/span&gt;.&#xA;Define the Hermitian operators&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\theta(1)\equiv \operatorname{diag}(\epsilon,0,...,0),&#xA;\qquad&#xA;\theta(2)\equiv \operatorname{diag}(-\epsilon,0,...,0),$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\epsilon&amp;lt; \min(s_1,1-s_1)$&lt;/span&gt;.&#xA;Then &lt;span class=&quot;math-container&quot;&gt;$\mu\pm\theta$&lt;/span&gt; are again two POVMs, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mu=\frac{1}{2}((\mu+\theta)+(\mu-\theta)),$$&lt;/span&gt;&#xA;and thus &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; extremal.&#xA;However, this argument relies on the POVM elements being mutually diagonalisable, which is only the case for two-outcome POVMs.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-05T11:12:53.397" Title="What are examples of extremal non-projective POVMs?" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17350" PostTypeId="1" CreationDate="2021-05-05T00:30:47.490" Score="0" ViewCount="51" Body="&lt;p&gt;In Simon's algorithm, is it possible to have two different oracles that return the same results on their own but cause Simon's algorithm to return different results from one another? In what sort of situation could this occur?&lt;/p&gt;&#xA;" OwnerUserId="15648" LastEditorUserId="15408" LastEditDate="2021-05-07T18:38:37.790" LastActivityDate="2021-05-07T18:38:37.790" Title="Simon's Algorithm - Equivalent Oracles Giving Different Results" Tags="&lt;quantum-circuit&gt;&lt;oracles&gt;&lt;simons-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17351" PostTypeId="2" ParentId="17348" CreationDate="2021-05-05T01:42:58.300" Score="1" Body="&lt;p&gt;Given a secret n-bit string &lt;span class=&quot;math-container&quot;&gt;$s = s_1 s_2 \cdots s_n$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$s_i \in \{0,1\}$&lt;/span&gt; the worst case scenario for the Oracle (when all your secret bits are non-zero)  is that you will have a circuit depth &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; layers of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gates. This is because at each &lt;span class=&quot;math-container&quot;&gt;$s_i \neq 0$&lt;/span&gt;, there will be a CNOT gate from the qubit &lt;span class=&quot;math-container&quot;&gt;$q_{s_i}$&lt;/span&gt; to the ancilla qubit.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-05T02:25:33.053" LastActivityDate="2021-05-05T02:25:33.053" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17352" PostTypeId="2" ParentId="17344" CreationDate="2021-05-05T01:54:23.483" Score="2" Body="&lt;h3&gt;I think you underestimated how long your circuit really is....&lt;/h3&gt;&#xA;&lt;p&gt;When running your circuit on the hardware, it has to be transpile into the set of gates that is known to the hardware. For IBM machines, these are &lt;span class=&quot;math-container&quot;&gt;$\{ CX, ID, RZ, SX, X \}$&lt;/span&gt; . Furthermore, there is a constraint on the qubit layout of the hardware as well. Not all qubits are connected. Thus there will be some overhead operation. At the end of it, your circuit is very long... and so &lt;strong&gt;all you read out is noise&lt;/strong&gt;...&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/vwAqE.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vwAqE.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-05T04:10:26.033" LastActivityDate="2021-05-05T04:10:26.033" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17353" PostTypeId="2" ParentId="17336" CreationDate="2021-05-05T08:14:56.697" Score="2" Body="&lt;p&gt;Grover's algorithm has two components, which alternate and repeat &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{N})$&lt;/span&gt; times: a diffusion operator and an oracle operator. The diffusion operator will cause problems with your idea.&lt;/p&gt;&#xA;&lt;p&gt;As I understand, what you want to do is start from a uniform superposition&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert \psi_0\rangle =\frac{1}{\sqrt{2^n}}\sum_{b_1,\dots,b_n\in\{0,1\}} \vert b_1\rangle \vert b_2\rangle\dots\vert b_n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and then solve for (e.g.) a clause &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$b_1,b_2,b_3$&lt;/span&gt;, to get something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\psi_1\rangle=\frac{1}{\sqrt{N}}\sum_{\substack{b_1,\dots,b_n\in\{0,1\}\\ C_1(b_1,b_2,b_3)=1}} \vert b_1\rangle \vert b_2\rangle\dots\vert b_n\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the number of remaining solutions. From this superposition, you want to solve for another clause &lt;span class=&quot;math-container&quot;&gt;$C_2$&lt;/span&gt; which involves (e.g.) &lt;span class=&quot;math-container&quot;&gt;$b_1, b_4, b_5$&lt;/span&gt; (if no other clause involves &lt;span class=&quot;math-container&quot;&gt;$b_1,b_2,b_3$&lt;/span&gt;, then it's easy to solve for these 3 variables first and then remove them from the problem).&lt;/p&gt;&#xA;&lt;p&gt;But now you're searching over the first qubit, &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt;, but &lt;span class=&quot;math-container&quot;&gt;$\vert\psi_1\rangle$&lt;/span&gt;, your superposition over &lt;span class=&quot;math-container&quot;&gt;$b_1$&lt;/span&gt;, is non-trivial. Grover's algorithm requires a way to flip the phase of the starting superposition. Normally, the way to do this is to apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates to every qubit and flip the all-zeros state, then apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; again to return to the previous state, but after solving the first clause, the superposition &lt;span class=&quot;math-container&quot;&gt;$\vert\psi_1\rangle$&lt;/span&gt; is &lt;em&gt;not&lt;/em&gt; just &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes n}\vert 0^n\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In fact, (as far as I am aware) the only way to construct a diffusion operator for the superposition &lt;span class=&quot;math-container&quot;&gt;$\vert\psi_1\rangle$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt; is solved is to &lt;em&gt;undo&lt;/em&gt; the solution for &lt;span class=&quot;math-container&quot;&gt;$C_1$&lt;/span&gt;, then apply &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gates, then flip over &lt;span class=&quot;math-container&quot;&gt;$\vert 0^n\rangle$&lt;/span&gt;, then &lt;em&gt;redo&lt;/em&gt; those same operations.&lt;/p&gt;&#xA;&lt;p&gt;If you do that, then you can run Grover's algorithm on a clause-by-clause basis and solve the 3-SAT problem. However, the cost is not polynomial: If there are &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; clauses, for the last clause, the diffusion operator must solve and unsolve an &lt;span class=&quot;math-container&quot;&gt;$m-1$&lt;/span&gt; clause 3-SAT problem. So if the cost of solving this problem is &lt;span class=&quot;math-container&quot;&gt;$c_{m-1}$&lt;/span&gt;, the total cost will be &lt;span class=&quot;math-container&quot;&gt;$\approx\sqrt{2^3}c_{m-1}$&lt;/span&gt;. But solving an &lt;span class=&quot;math-container&quot;&gt;$m-1$&lt;/span&gt; clause 3-SAT problem will require a diffusion operator that solves an &lt;span class=&quot;math-container&quot;&gt;$m-2$&lt;/span&gt; clause 3-SAT problem, so &lt;span class=&quot;math-container&quot;&gt;$c_{m-1}\approx \sqrt{2^3}c_{m-2}$&lt;/span&gt; (and so on). You end up &lt;em&gt;multiplying&lt;/em&gt; all of the factors of &lt;span class=&quot;math-container&quot;&gt;$\sqrt{2^3}$&lt;/span&gt; each time you go through, and the total cost ends up as something like &lt;span class=&quot;math-container&quot;&gt;$O(\sqrt{2^{3m}})$&lt;/span&gt; -- which is roughly the exponential cost you would expect from a naive Grover search.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastActivityDate="2021-05-05T08:14:56.697" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17354" PostTypeId="2" ParentId="17349" CreationDate="2021-05-05T10:34:05.070" Score="6" Body="&lt;p&gt;It is indeed possible to have extremal, non-projective POVMs. Examples can be drawn from &lt;a href=&quot;https://en.wikipedia.org/wiki/SIC-POVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;SIC-POVMs&lt;/a&gt;, as suggested &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/17349/what-are-examples-of-extremal-non-projective-povms?noredirect=1#comment25492_17349&quot;&gt;in a comment&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, as mentioned in the Wiki page, the only possible SIC-POVM in &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt; dimensions is &lt;span class=&quot;math-container&quot;&gt;$\{\tilde\Pi_i\}_{i=1}^4$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\tilde\Pi_i\equiv \frac12 \Pi_i$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\Pi_i\equiv \lvert\psi_i\rangle\!\langle\psi_i\rvert$&lt;/span&gt;, and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_1\rangle\equiv |0\rangle,&#xA;\qquad&#xA;|\psi_2\rangle\equiv \frac1{\sqrt3}(|0\rangle+\sqrt2 |1\rangle), \\&#xA;|\psi_3\rangle\equiv \frac1{\sqrt3}(|0\rangle+\sqrt2 \omega_3 |1\rangle),&#xA;\qquad&#xA;|\psi_4\rangle\equiv \frac1{\sqrt3}(|0\rangle+\sqrt2 \omega_3^2 |1\rangle),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$\omega_3 \equiv \exp(2\pi i/3)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To observe extremality, we can use the following characterisation, given &lt;em&gt;e.g.&lt;/em&gt; in Watrous' book:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;a POVM &lt;span class=&quot;math-container&quot;&gt;$\mu\equiv \{\mu(a):a\in\Sigma\}\subset\mathrm{Pos}(\mathcal X)$&lt;/span&gt; is extremal &lt;strong&gt;iff&lt;/strong&gt; there is a collection of Hermitian operators &lt;span class=&quot;math-container&quot;&gt;$\{\theta(a):a\in\Sigma\}\subset\mathrm{Herm}(\mathcal X)$&lt;/span&gt; such that (1) &lt;span class=&quot;math-container&quot;&gt;$\sum_a \theta(a)=0$&lt;/span&gt; and (2) &lt;span class=&quot;math-container&quot;&gt;$\mathrm{im}(\theta(a))\subseteq\mathrm{im}(\mu(a))$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$a\in\Sigma$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;In the case at hand, &lt;span class=&quot;math-container&quot;&gt;$\mathrm{im}(\tilde\Pi_i)=\mathbb C|\psi_i\rangle$&lt;/span&gt;, and thus any collection of Hermitians satisfying the above conditions must have the form &lt;span class=&quot;math-container&quot;&gt;$\theta_i= a_i \tilde\Pi_i$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$a_i\in\mathbb R$&lt;/span&gt;. But then, the condition &lt;span class=&quot;math-container&quot;&gt;$\sum_i \theta_i=0$&lt;/span&gt; amounts to &lt;span class=&quot;math-container&quot;&gt;$\sum_i a_i \tilde\Pi_i=0$&lt;/span&gt;. But &lt;span class=&quot;math-container&quot;&gt;$\{\tilde \Pi_i\}_{i=1}^4$&lt;/span&gt; is linearly independent, and thus &lt;span class=&quot;math-container&quot;&gt;$a_i=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_i=0$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&#xA;This means that the POVM &lt;span class=&quot;math-container&quot;&gt;$\{\tilde\Pi_i\}_{i=1}^4$&lt;/span&gt; is extremal.&lt;/p&gt;&#xA;&lt;p&gt;More generally, as again discussed in Watrous' book, a POVM whose components are all unit-rank is extremal &lt;em&gt;iff&lt;/em&gt; the components are linearly independent, and this is always the case for SIC-POVMs (they consist of &lt;span class=&quot;math-container&quot;&gt;$d^2$&lt;/span&gt; operators spanning &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Herm}(\mathcal X)$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\dim(\mathcal X)=d$&lt;/span&gt;, thus they are linearly independent, and they are rank-1 by definition).&lt;/p&gt;&#xA;&lt;p&gt;With the above considerations in mind, it is actually quite easy to also find examples that are &lt;em&gt;not&lt;/em&gt; SIC-POVMs. We just need to find POVMs made out of more than &lt;span class=&quot;math-container&quot;&gt;$\dim(\mathcal X)$&lt;/span&gt; rank-1 components. For example, such a four-element POVM for a single qubit is:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mu(1) \equiv \frac12\begin{pmatrix}1&amp;amp;0\\0&amp;amp;0\end{pmatrix},&#xA;\qquad&#xA;\mu(2) \equiv \frac12\begin{pmatrix}0&amp;amp;0\\0&amp;amp;1\end{pmatrix},&#xA;\\&#xA;\mu(3) \equiv \frac14\begin{pmatrix}1&amp;amp;1\\1&amp;amp;1\end{pmatrix},&#xA;\qquad&#xA;\mu(4) \equiv \frac14\begin{pmatrix}1&amp;amp;-1\\-1&amp;amp;1\end{pmatrix}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-05T11:12:53.397" LastActivityDate="2021-05-05T11:12:53.397" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17356" PostTypeId="2" ParentId="17329" CreationDate="2021-05-05T17:51:51.370" Score="1" Body="&lt;p&gt;The linear map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is what characterizes a quantum process,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho \rightarrow \mathcal{E}(\rho),$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; can be determined by &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;. Using the operator-sum representation,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho) = \sum_i A_i \rho A^\dagger_i = \sum_{i}\sum_{m}\sum_{n}a_{im}\tilde{A}_m \rho a^*_{in}\tilde{A}^\dagger_n,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where the &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt; are some set of complex numbers that allow a &lt;em&gt;fixed&lt;/em&gt; set of operators &lt;span class=&quot;math-container&quot;&gt;$\tilde{A}_{i}$&lt;/span&gt; to form a basis for the unknown set of operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; on the state space. Remember, if we can determine the operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt;, then we can completely describe &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;. Rearranging the above,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}(\rho) = \sum_m \sum_n \tilde{A}_m \rho \tilde{A}^\dagger_n \sum_i a_{im} a^*_{in} = \sum_{mn} \tilde{A}_m \rho \tilde{A}^\dagger_n \chi_{mn},$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\chi_{mn}$&lt;/span&gt; is a &amp;quot;classical&amp;quot; &lt;em&gt;error correlation matrix&lt;/em&gt;, which is positive Hermitian by definition. So, once the set of operators &lt;span class=&quot;math-container&quot;&gt;$\tilde{A}_i$&lt;/span&gt; has been fixed, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; can be determined completely by the complex number matrix &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;.&lt;span class=&quot;math-container&quot;&gt;$^{\text{[1]}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note: The adjective &amp;quot;fixed&amp;quot; does not apply to any of the operators themselves, rather, it applies to the set of operators. The point is that the operators &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; are unknown, so we are writing the &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; in terms of a basis of known operators &lt;span class=&quot;math-container&quot;&gt;$\tilde{A}_i$&lt;/span&gt; that we have chosen. The problem of determining the &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; thus reduces to the problem of determining the coefficients &lt;span class=&quot;math-container&quot;&gt;$a_{ij}$&lt;/span&gt; in this basis. This is not any different from determining an unknown vector by writing the vector as a linear combination of a fixed set of basis vectors, then finding the coefficients in this basis.&lt;/p&gt;&#xA;&lt;p&gt;[1] &lt;em&gt;Prescription for experimental determination of the dynamics of a quantum black box&lt;/em&gt;, Isaac L. Chuang, M. A. Nielson, 2008. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9610001&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9610001&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-05T20:19:46.147" LastActivityDate="2021-05-05T20:19:46.147" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17357" PostTypeId="1" CreationDate="2021-05-05T18:40:16.203" Score="4" ViewCount="54" Body="&lt;p&gt;For some background, a nonlocal game consists of questions &lt;span class=&quot;math-container&quot;&gt;$x,y\in X,Y$&lt;/span&gt; and answers &lt;span class=&quot;math-container&quot;&gt;$a,b \in A,B$&lt;/span&gt;; the pair of questions &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; is asked with probability &lt;span class=&quot;math-container&quot;&gt;$\mu(x,y)$&lt;/span&gt;, and a referee accepts the pair of answers &lt;span class=&quot;math-container&quot;&gt;$a,b$&lt;/span&gt; for the pair of questions &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$V(a,b,x,y)$&lt;/span&gt;. This function &lt;span class=&quot;math-container&quot;&gt;$V:A \times B \times X \times Y \to [0,1]$&lt;/span&gt; is the &lt;em&gt;predicate&lt;/em&gt; of the nonlocal game. The case I just defined is the most general one, of a probabilistic predicate. Usually, though, papers deal with only with the case of deterministic predicates, where &lt;span class=&quot;math-container&quot;&gt;$V(a,b,x,y)$&lt;/span&gt; is always either &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, so the referee simply accepts of rejects a given answer pair for a given question pair.&lt;/p&gt;&#xA;&lt;p&gt;What I want to know is who first studied nonlocal games with probabilistic predicate. &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0404076&quot; rel=&quot;nofollow noreferrer&quot;&gt;Cleve et al.&lt;/a&gt;, who pretty much started the are, only defines games with deterministic predicate. The earliest reference I know that talks about games with probabilistic predicate is &lt;a href=&quot;https://arxiv.org/abs/1012.5043&quot; rel=&quot;nofollow noreferrer&quot;&gt;Buhrman et al.&lt;/a&gt;. It doesn't seem to be the first one, though, they talk as if the concept is already known.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastEditorUserId="55" LastEditDate="2021-05-13T22:14:10.290" LastActivityDate="2021-05-13T22:14:10.290" Title="Who first studied nonlocal games with probabilistic predicate?" Tags="&lt;resource-request&gt;&lt;non-locality&gt;&lt;games&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17358" PostTypeId="1" AcceptedAnswerId="17359" CreationDate="2021-05-05T20:31:02.513" Score="4" ViewCount="142" Body="&lt;p&gt;Suppose we start with &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt;.&#xA;We want to build an equal superposition over &lt;span class=&quot;math-container&quot;&gt;$|0\rangle + ... + |n-1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$n=2^m$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt;, I know I can do this using &lt;span class=&quot;math-container&quot;&gt;$H^{\otimes m}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What is the general circuit for this (i.e. in case &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is not power of 2)?&lt;/p&gt;&#xA;" OwnerUserId="15502" LastEditorUserId="55" LastEditDate="2021-05-06T10:46:38.490" LastActivityDate="2021-05-06T10:46:38.490" Title="How do you build a circuit to make an equal superposition of $n$ outcomes?" Tags="&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17359" PostTypeId="2" ParentId="17358" CreationDate="2021-05-05T20:51:07.627" Score="6" Body="&lt;p&gt;You can use a single step of amplitude amplification, with a less-than-N oracle, to get to a uniform distribution.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22setB%22%2C%22arg%22%3A25%7D%5D%2C%5B%5D%2C%5B%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22inputA5%22%2C1%2C1%2C1%2C1%2C%22%5EA%3CB%22%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%7B%22id%22%3A%22Rzft%22%2C%22arg%22%3A%22acos(1-16%2F25)%22%7D%5D%2C%5B%5D%2C%5B%5D%2C%5B1%2C1%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22%E2%8A%95%22%2C%22X%22%5D%2C%5B%22Chance7%22%5D%2C%5B%22Amps7%22%5D%5D%7D&quot; rel=&quot;noreferrer&quot;&gt;Example Quirk Circuit&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/dDzFX.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dDzFX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Source: &lt;a href=&quot;https://arxiv.org/abs/1805.03662&quot; rel=&quot;noreferrer&quot;&gt;https://arxiv.org/abs/1805.03662&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-05T20:51:07.627" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17361" PostTypeId="1" AcceptedAnswerId="17362" CreationDate="2021-05-06T00:40:58.070" Score="4" ViewCount="85" Body="&lt;p&gt;I have a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Is there any way to find the (possibly not unique) trace distance to the nearest pure state:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\min_{|\psi\rangle} \,\,\lVert \rho - |\psi\rangle\langle \psi| \rVert_1&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lVert A\rVert_1 = \mathrm{tr}\,\sqrt{A^\dagger A}$&lt;/span&gt;. I am not concerned with actually identifying &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. An answer that finds the maximum fidelity with a pure state is equally good for my purposes.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;For instance, with &lt;span class=&quot;math-container&quot;&gt;$d=2$&lt;/span&gt; we can use the Bloch sphere picture to solve this problem: if we represent &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \langle \psi|$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\rho &amp;amp;= \frac{I + \vec{r}\cdot \vec{\sigma}}{2}\\&#xA;|\psi\rangle \langle \psi| &amp;amp;=  \frac{I + \vec{s}\cdot \vec{\sigma}}{2} \quad, \quad \lVert \vec{s}\rVert=1&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\vec{\sigma} = (\sigma_1, \sigma_2, \sigma_3)$&lt;/span&gt; is the vector of Pauli operators, then the closest point &lt;span class=&quot;math-container&quot;&gt;$\vec{s}$&lt;/span&gt; on the surface of the sphere (pure state) to a point internal to the sphere (mixed state) will lie along the ray formed by &lt;span class=&quot;math-container&quot;&gt;$(0,0,0)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\vec{r}$&lt;/span&gt;, so the desired pure state is just&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\vec{s}= \frac{1}{\lVert \vec{r} \rVert} \vec{r}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the corresponding distance is &lt;span class=&quot;math-container&quot;&gt;$d(\rho, |\psi\rangle\langle\psi|) = 1 - \lVert \vec{r} \rVert$&lt;/span&gt;. However I don't really know how to extend this kind of approach for &lt;span class=&quot;math-container&quot;&gt;$d&amp;gt;2$&lt;/span&gt; because I can't really wrap my head around the geometry of higher dimensional state spaces.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="10480" LastEditDate="2021-05-06T20:34:46.340" LastActivityDate="2021-05-07T10:03:18.307" Title="How to find the distance between a given $\rho$ and the nearest pure state(s)?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;fidelity&gt;&lt;trace-distance&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17362" PostTypeId="2" ParentId="17361" CreationDate="2021-05-06T02:21:04.017" Score="5" Body="&lt;p&gt;Recall that for any Hermitian operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; and any unit vector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; the real number &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|A|\psi\rangle$&lt;/span&gt;, known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Rayleigh_quotient&quot; rel=&quot;noreferrer&quot;&gt;Rayleigh quotient&lt;/a&gt;, is bounded by the largest eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_{max}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \psi|A|\psi\rangle \le \lambda_{max}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Moreover, the maximum is achieved when &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the unit norm eigenvector of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; associated with &lt;span class=&quot;math-container&quot;&gt;$\lambda_{max}$&lt;/span&gt;. When &lt;span class=&quot;math-container&quot;&gt;$A=\rho$&lt;/span&gt; is a density matrix and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; a pure state then the Rayleigh quotient equals the fidelity &lt;span class=&quot;math-container&quot;&gt;$$F(\rho, |\psi\rangle\langle\psi|) = \langle \psi|\rho|\psi\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Therefore, the maximum fidelity of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with a pure state is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\max_{|\psi\rangle} F(\rho, |\psi\rangle\langle\psi|) = \max_{|\psi\rangle}\, \langle\psi|\rho|\psi\rangle = \lambda_{max}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\lambda_{max}$&lt;/span&gt; is the largest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. (Moreover, &lt;span class=&quot;math-container&quot;&gt;$F(\rho, |\psi\rangle\langle\psi|)$&lt;/span&gt; is maximized when &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is the eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; associated with &lt;span class=&quot;math-container&quot;&gt;$\lambda_{max}$&lt;/span&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="10480" LastActivityDate="2021-05-06T02:21:04.017" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17363" PostTypeId="1" AcceptedAnswerId="17366" CreationDate="2021-05-06T06:57:00.157" Score="3" ViewCount="253" Body="&lt;p&gt;A quantum circuit can be visualized in Qiskit with &lt;code&gt;circuit.draw&lt;/code&gt;. A drawing style can be set with parameter &lt;code&gt;output&lt;/code&gt; which can have values &lt;code&gt;mpl&lt;/code&gt;, &lt;code&gt;text&lt;/code&gt; or &lt;code&gt;latex&lt;/code&gt; (e.g &lt;code&gt;circuit.draw(output='mpl')&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I am wondering if there is a way to use the same symbols and colors as in IBM Quantum composer since none of the above allow me to do so.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="15408" LastEditDate="2021-05-07T17:17:02.873" LastActivityDate="2021-05-07T17:17:02.873" Title="Drawing the circuit in Qiskit - how to set same style as in Composer?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17364" PostTypeId="2" ParentId="17363" CreationDate="2021-05-06T07:23:42.980" Score="6" Body="&lt;p&gt;That’s possible, just do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw('mpl', style='iqx')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="1859" LastEditDate="2021-05-06T21:18:46.770" LastActivityDate="2021-05-06T21:18:46.770" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17365" PostTypeId="2" ParentId="17247" CreationDate="2021-05-06T08:00:09.057" Score="1" Body="&lt;p&gt;I found the answer on my own. In case someone has a similar problem:&lt;/p&gt;&#xA;&lt;p&gt;You can use the standard measure() function in the quantum circuit. When you assemble you can specify meas_level=1 which returns the raw measured data without running it through a classifier. Then you can build your own classifier.&lt;/p&gt;&#xA;" OwnerUserId="15660" LastActivityDate="2021-05-06T08:00:09.057" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17366" PostTypeId="2" ParentId="17363" CreationDate="2021-05-06T08:06:55.567" Score="6" Body="&lt;p&gt;The &lt;em&gt;IBM circuit composer&lt;/em&gt; used to be also known as &lt;em&gt;IBM Quantum Experience&lt;/em&gt;, or IQX for short. For those historical reasons, the name of the style is &lt;code&gt;iqx&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;circuit = QuantumCircuit(2)&#xA;circuit.h(0)&#xA;circuit.cx(0, 1)&#xA;circuit.t(1)&#xA;circuit.draw('mpl', style='iqx')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sv3fy.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sv3fy.png&quot; alt=&quot;draw output&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Compare with the composer look:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Leh2x.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Leh2x.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-05-06T11:22:49.800" LastActivityDate="2021-05-06T11:22:49.800" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17367" PostTypeId="2" ParentId="17329" CreationDate="2021-05-06T09:00:21.830" Score="0" Body="&lt;h2&gt;TL;DR&lt;/h2&gt;&#xA;&lt;p&gt;Given a process matrix &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; expressed in a normalized, ordered Pauli basis &lt;span class=&quot;math-container&quot;&gt;$\{P^{n}_{k}\}$&lt;/span&gt;, find its eigendecomposition &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_{i},\mathbf{v_{i}}\}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$0 \leq \lambda_{i} \leq 1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\mathbf{v_{i}} = (v^{i}_{P^{n}_{k}})$&lt;/span&gt; is the eigenvector for eigenvalue &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i}$&lt;/span&gt; and contains 'coefficients' for every Pauli &lt;span class=&quot;math-container&quot;&gt;$P^{n}_{k}$&lt;/span&gt;. &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; is Hermitian, so the &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i}$&lt;/span&gt;'s are real and nonnegative, and the eigenvectors from different eigenvalues are orthogonal.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;If the map represented by the process matrix is unitary&lt;/strong&gt; there will be only one nonzero eigenvalue, let's call it &lt;span class=&quot;math-container&quot;&gt;$\lambda_{0}$&lt;/span&gt; (then &lt;span class=&quot;math-container&quot;&gt;$\lambda_{0} = 1$&lt;/span&gt;). The corresponding eigenvector is then just the unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; expressed in the Pauli basis. We can readily compute &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \sum_{k} v^{0}_{P^{n}_{k}}P^{n}_{k}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For a single qubit, the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; matrix is  &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt; matrix. If again it represents a unitary channel, we get a single nonzero eigenvalue equal to one, and its corresponding eigenvector &lt;span class=&quot;math-container&quot;&gt;$\mathbf{v} = (v_{I},v_{X},v_{Y},v_{Z})$&lt;/span&gt;. Then, the single-qubit unitary represented by the map is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U = \sum_{P} v_{P}P = v_{I}I + v_{X}X + v_{Y}Y + v_{Z}Z.&#xA;$$&lt;/span&gt;&#xA;Note that the &lt;span class=&quot;math-container&quot;&gt;$v_{P}$&lt;/span&gt; are in general complex numbers.&lt;/p&gt;&#xA;&lt;p&gt;If the map is supposed to be unitary, but it has a bit of noise in it, this will be reflected by one eigenvalue being close to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, corresponding to the unitary operation, and some (or all) other eigenvalues being small but nonzero - these correspond to the noise operators.&lt;/p&gt;&#xA;&lt;h2&gt;Density matrices and maps?&lt;/h2&gt;&#xA;&lt;p&gt;In its most general form, a quantum state is described not by a single ket state (e.g. &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$&lt;/span&gt;, but by a &lt;em&gt;statistical mixture&lt;/em&gt; of kets (e.g. &lt;span class=&quot;math-container&quot;&gt;$\{p_{i},|\psi_{i}\rangle\}$&lt;/span&gt; described the situation that we have state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{i}\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_{i}$&lt;/span&gt;). If there is just one nonzero &lt;span class=&quot;math-container&quot;&gt;$p_{i}$&lt;/span&gt;, we get a single ket state back, and we call this state a &lt;em&gt;pure&lt;/em&gt; state. Any other state is also referred to as a &lt;em&gt;mixed&lt;/em&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;It turns out that we can - and it is &lt;strong&gt;extremely&lt;/strong&gt; useful - to write this as a sum of outer products &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}p_{i} |\psi_{i}\rangle\langle \psi_{i}|$&lt;/span&gt;. We call this the &lt;em&gt;density matrix&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and, as mentioned before, this is the most general description that we can have of a quantum system. As a general rule of thumb, in quantum computing we always &lt;em&gt;want&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;For pure states, the operations that we perform on them are &lt;em&gt;gates&lt;/em&gt;, represented by &lt;em&gt;unitary matrices&lt;/em&gt;. We can also apply these to density matrices, but there are also different valid operations that we can apply to density matrices. Any such operation we call a &lt;em&gt;quantum operation&lt;/em&gt; or &lt;em&gt;quantum channel&lt;/em&gt;, which is a linear map &lt;span class=&quot;math-container&quot;&gt;$\rho_{in} \rightarrow \Lambda(\rho_{in}) = \rho_{out}$&lt;/span&gt; which is subject to some constraints to make sure that &lt;span class=&quot;math-container&quot;&gt;$\rho_{out}$&lt;/span&gt; is a valid density matrix - I won't go into them here.&lt;/p&gt;&#xA;&lt;p&gt;To fully characterize this &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt;, there are multiple different representations - one of which is the &lt;em&gt;process matrix&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt;. In QPT, it is the goal to characterize a unknown map &lt;span class=&quot;math-container&quot;&gt;$\Lambda$&lt;/span&gt; by finding one if its representations, where often the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; matrix is used. These can also represent unitary channels, but they can represent more.&lt;/p&gt;&#xA;" OwnerUserId="8141" LastEditorUserId="8141" LastEditDate="2021-05-06T09:05:45.200" LastActivityDate="2021-05-06T09:05:45.200" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17368" PostTypeId="2" ParentId="17361" CreationDate="2021-05-06T09:04:57.840" Score="3" Body="&lt;p&gt;The fidelity case was already worked in the other answer. Here is an idea for the trace distance one.&lt;/p&gt;&#xA;&lt;p&gt;The trace distance between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and some&#xA;&lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle\!\langle\psi|$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\|\rho - |\psi\rangle\!\langle\psi|\|_1&#xA;= \operatorname{Tr}\lvert \,\rho - |\psi\rangle\!\langle\psi|\,\rvert,&#xA;$$&lt;/span&gt;&#xA;which is equal to the sum of the singular values of &lt;span class=&quot;math-container&quot;&gt;$\rho-|\psi\rangle\!\langle\psi|$&lt;/span&gt;. Write the eigendecomposition of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_k p_k |u_k\rangle\!\langle u_k|,$$&lt;/span&gt;&#xA;for some orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|u_k\rangle\}_k$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_k\ge0$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$\sum_k p_k=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notice that if we choose &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|u_1\rangle$&lt;/span&gt; (I fix the first eigenvector here without loss of generality), then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho - |\psi\rangle\!\langle\psi| = (p_1-1)|u_1\rangle\!\langle u_1|&#xA;+ \sum_{k&amp;gt;1} p_k |u_k\rangle\!\langle u_k|.$$&lt;/span&gt;&#xA;Because the singular values of a Hermitian matrix are the moduli of the eigenvalues, we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\|\rho - |\psi\rangle\!\langle\psi| \|_1 =&#xA;|p_1-1| + \sum_{k&amp;gt;1} p_k = 2(1 - p_1).&#xA;$$&lt;/span&gt;&#xA;Minimising this expression with respect to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, restricting the possible choices to the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, thus leads to the minimum trace distance being &lt;span class=&quot;math-container&quot;&gt;$2(1- \max_k p_k)$&lt;/span&gt;, achieved with &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; the eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; which largest probability. This is the same conclusion obtained for the fidelity.&lt;/p&gt;&#xA;&lt;p&gt;I should stress that I didn't actually prove that there cannot be some &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; that is not an eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; for which we can get an even smaller trace distance. That's unlikely to be the case, but a bit more thought might be required to show it formally.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-06T09:04:57.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17369" PostTypeId="1" CreationDate="2021-05-06T09:34:28.473" Score="3" ViewCount="44" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\rho, \sigma$&lt;/span&gt; be states such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho,\sigma) = \delta &amp;gt;0,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$F(\rho,\sigma) = \|\sqrt{\rho}\sqrt{\sigma}\|_1$&lt;/span&gt;. Now consider all possible states &lt;span class=&quot;math-container&quot;&gt;$\bar{\rho}$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$F(\bar{\rho},\rho) \geq 1 - \varepsilon$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$0&amp;lt;\varepsilon&amp;lt;\delta$&lt;/span&gt;. Can one find an upper bound for&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\min\limits_{\bar{\rho}}F(\bar{\rho},\sigma)$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Obviously, &lt;span class=&quot;math-container&quot;&gt;$\delta$&lt;/span&gt; is the trivial upper bound found by choosing &lt;span class=&quot;math-container&quot;&gt;$\bar{\rho} = \rho$&lt;/span&gt; but it's not clear if one can always do better.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2021-05-07T08:55:12.360" LastActivityDate="2021-05-07T08:55:12.360" Title="Given $\rho,\sigma$, bound $\min F(\bar\rho,\sigma)$ over $\bar\rho$ such that $F(\bar\rho,\rho)\ge1-\epsilon$" Tags="&lt;fidelity&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17370" PostTypeId="1" CreationDate="2021-05-06T10:26:39.437" Score="3" ViewCount="21" Body="&lt;p&gt;The Hamiltonian of Heisenberg's XXY model is given by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H=\sum_{j=1}^{N}\left[S_{j}^{x} S_{j+1}^{x}+S_{j}^{y} S_{j+1}^{y}+\Delta S_{j}^{z} S_{j+1}^{z}\right]&#xA;,$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$S_{j}^{u}=\sigma_{j}^{u} / 2(u=x, y, z), \sigma_{j}^{u}$&lt;/span&gt; are the Pauli spin- &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;&#xA;operators on site &lt;span class=&quot;math-container&quot;&gt;$j, \Delta$&lt;/span&gt; is the anisotropy parameter, and &lt;span class=&quot;math-container&quot;&gt;$\sigma_{j+N}^{u}=\sigma_{j}^{u} .$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Hamiltonian has two symmetries: (i) a discrete parity &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{2}$&lt;/span&gt; symmetry over the plane &lt;span class=&quot;math-container&quot;&gt;$x y: \sigma^{z} \rightarrow-\sigma^{z}$&lt;/span&gt;, and (ii) a continuous U1 symmetry that rotates the spins in the &lt;span class=&quot;math-container&quot;&gt;$x z$&lt;/span&gt; plane by any angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;. But why does the &lt;span class=&quot;math-container&quot;&gt;$\mathbb{Z}_{2}$&lt;/span&gt; symmetry implies that &lt;span class=&quot;math-container&quot;&gt;$\left\langle\sigma_{i}^{z}\right\rangle=0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\left\langle\sigma_{i}^{x} \sigma_{j}^{z}\right\rangle=\left\langle\sigma_{i}^{y} \sigma_{j}^{z}\right\rangle=0$&lt;/span&gt;? This was described in this &lt;a href=&quot;https://arxiv.org/abs/1110.0787&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;, while I cannot see how can I only use the symmetry without knowing the specific form of the eigenvector to get such a result.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastActivityDate="2021-05-06T10:26:39.437" Title="How to calculate $\langle\sigma_i^z\rangle$ with the method of symmetry in Heisenberg XXZ model?" Tags="&lt;many-body-systems&gt;&lt;xxz-model&gt;&lt;quantum-phase-transition&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17371" PostTypeId="1" AcceptedAnswerId="17372" CreationDate="2021-05-06T10:57:07.007" Score="3" ViewCount="32" Body="&lt;p&gt;I use different qiskit backends to run my code. Since the maximum number of shots is &lt;span class=&quot;math-container&quot;&gt;$2^{13}$&lt;/span&gt;, sometimes I need to send the same code several times with a &amp;quot;different ticket&amp;quot;. I am wondering if there is an equivalent way to run in the background, similar to the command &lt;code&gt;nohup&lt;/code&gt;, to run qiskit code so that it runs all the instances one would like (or waiting in the queue as they are sent!)&lt;/p&gt;&#xA;" OwnerUserId="15220" LastEditorUserId="55" LastEditDate="2021-05-07T10:04:48.263" LastActivityDate="2021-05-07T10:04:48.263" Title="Is there a way to run &quot;in the background&quot; code sent to the IBM backends?" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17372" PostTypeId="2" ParentId="17371" CreationDate="2021-05-06T11:21:54.980" Score="4" Body="&lt;p&gt;All the jobs are sent in a non-blocking way. You can send all your jobs with &lt;code&gt;job = backend.run&lt;/code&gt; and recover their results in a fully different session.&lt;/p&gt;&#xA;&lt;p&gt;In order to fully recover your &lt;code&gt;Job&lt;/code&gt; object from a backend, you need the job id (given you are running Qiskit 0.24 or later. See &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/17371/is-there-a-way-to-run-in-the-backgound-code-sent-to-the-ibm-backends/17372?noredirect=1#comment25518_17372&quot;&gt;@jyu00's comment&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;You can save your job ids like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;jobs = []&#xA;for circuit in circuits:&#xA;  job = backend.run&#xA;  jobs.append(job.job_id())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Later, when the job is done, you can recover each &lt;code&gt;Job&lt;/code&gt; object like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;provider = IBMQ.load_account()&#xA;job = provider.get_backend(backend_name).retrieve_job(job_id)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-05-06T15:11:04.380" LastActivityDate="2021-05-06T15:11:04.380" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17373" PostTypeId="5" CreationDate="2021-05-06T12:40:46.720" Score="0" Body="" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-06T12:40:46.720" LastActivityDate="2021-05-06T12:40:46.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17374" PostTypeId="4" CreationDate="2021-05-06T12:40:46.720" Score="0" Body="For questions about the (quantum) relative entropy, the quantum version of the classical Kullback-Leibler divergence." OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-06T12:40:46.720" LastActivityDate="2021-05-06T12:40:46.720" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17375" PostTypeId="1" AcceptedAnswerId="17376" CreationDate="2021-05-06T14:44:24.760" Score="1" ViewCount="52" Body="&lt;p&gt;I'm testing out a program in different IBMQ mock backends, and I want the program to use the maximum number of qubits in each case. Is there any function/method to extract the number of qubits of a given backend, so that I don't have to manually look it up every time?&lt;/p&gt;&#xA;&lt;p&gt;Extra: Is there any way to automate the process of selecting each of these mock backends? My plan is to create an array&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;fake_servers = [FakeAlmaden(), FakeAthens(), FakeBelem(), FakeBoeblingen()]&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;etc, but if there's a more straightforward way, I'd like to know about it...&lt;/p&gt;&#xA;" OwnerUserId="14479" LastEditorUserId="55" LastEditDate="2021-05-06T22:41:18.137" LastActivityDate="2021-05-06T22:41:18.137" Title="Is there any way to obtain the number of qubits of a given backend in Qiskit?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17376" PostTypeId="2" ParentId="17375" CreationDate="2021-05-06T14:59:56.133" Score="4" Body="&lt;p&gt;The number of qubits is part of the backend configuration:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;FakeManhattan().configuration().n_qubits&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;65&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you need to filter the list of mocked backends based on the amount of qubits:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.test.mock import FakeProvider&#xA;provider = FakeProvider()&#xA;[ b.name() for b in provider.backends() if b.configuration().n_qubits &amp;gt; 20]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;['fake_cambridge',&#xA; 'fake_cambridge',&#xA; 'fake_manhattan',&#xA; 'fake_montreal',&#xA; 'fake_mumbai',&#xA; 'fake_paris',&#xA; 'fake_rochester',&#xA; 'fake_sydney',&#xA; 'fake_toronto']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-05-06T15:08:18.887" LastActivityDate="2021-05-06T15:08:18.887" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17377" PostTypeId="1" AcceptedAnswerId="17378" CreationDate="2021-05-06T17:56:04.800" Score="3" ViewCount="41" Body="&lt;p&gt;This question is about finding a matrix description of a specific circuit. I am learning quantum computing through edX's Quantum Information Science lecture series. The question below is the one I am stuck on&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KoXKS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KoXKS.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Could someone please explain a systematic way to go about finding the matrix representation of a 2-qubit circuit (so that I can apply it to this)&lt;/p&gt;&#xA;" OwnerUserId="15665" LastActivityDate="2021-05-07T06:45:17.973" Title="Method to derive Matrix description of a circuit" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="1" ClosedDate="2021-05-07T10:42:54.453" ContentLicense="CC BY-SA 4.0" />
  <row Id="17378" PostTypeId="2" ParentId="17377" CreationDate="2021-05-06T18:55:44.847" Score="1" Body="&lt;p&gt;You have to multiply the matrices associated with gates. When matrix is applied at only one qubit, you have to do tensor product with identity matrix n-1 times, where n is number of qubit of your circuit. In your case:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0&amp;amp;1\\ 1&amp;amp;0\\ \end{bmatrix} \otimes \begin{bmatrix} 1&amp;amp;0\\ 0&amp;amp;1\\ \end{bmatrix}=\begin{bmatrix} 0&amp;amp;0&amp;amp;1&amp;amp;0\\ 0&amp;amp;0&amp;amp;0&amp;amp;1\\ 1&amp;amp;0&amp;amp;0&amp;amp;0\\ 0&amp;amp;1&amp;amp;0&amp;amp;0\\ \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{bmatrix} 0&amp;amp;0&amp;amp;1&amp;amp;0\\ 0&amp;amp;0&amp;amp;0&amp;amp;1\\ 1&amp;amp;0&amp;amp;0&amp;amp;0\\ 0&amp;amp;1&amp;amp;0&amp;amp;0\\ \end{bmatrix} \begin{bmatrix} 1&amp;amp;0&amp;amp;0&amp;amp;0\\ 0&amp;amp;1&amp;amp;0&amp;amp;0\\ 0&amp;amp;0&amp;amp;0&amp;amp;1\\ 0&amp;amp;0&amp;amp;1&amp;amp;0\\ \end{bmatrix} \begin{bmatrix} 0&amp;amp;0&amp;amp;1&amp;amp;0\\ 0&amp;amp;0&amp;amp;0&amp;amp;1\\ 1&amp;amp;0&amp;amp;0&amp;amp;0\\ 0&amp;amp;1&amp;amp;0&amp;amp;0\\ \end{bmatrix}=\begin{bmatrix} 0&amp;amp;1&amp;amp;0&amp;amp;0\\ 1&amp;amp;0&amp;amp;0&amp;amp;0\\ 0&amp;amp;0&amp;amp;1&amp;amp;0\\ 0&amp;amp;0&amp;amp;0&amp;amp;1\\ \end{bmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15624" LastActivityDate="2021-05-06T18:55:44.847" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17379" PostTypeId="2" ParentId="17195" CreationDate="2021-05-06T23:28:15.487" Score="0" Body="&lt;p&gt;i did the hamiltonian simulation with minus sign, but in QPE, I don't have to consider it&lt;/p&gt;&#xA;" OwnerUserId="15624" LastActivityDate="2021-05-06T23:28:15.487" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17380" PostTypeId="1" CreationDate="2021-05-07T06:17:33.200" Score="3" ViewCount="73" Body="&lt;p&gt;What is the relationship between &lt;strong&gt;entanglement&lt;/strong&gt; and &lt;strong&gt;quantum correlation&lt;/strong&gt;? Are they synonym?&lt;/p&gt;&#xA;&lt;p&gt;Sometimes, these two words look like synonym; people use one word to explain another,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;These states are not a simple tensor product of the states of each qubit but rather a superposition that describes &lt;strong&gt;quantum correlations (entanglement)&lt;/strong&gt; between the qubits.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;On the other hand, it seemed we need to distinguish these two words,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If you read a randomly selected nontechnical account of &lt;strong&gt;quantum entanglement&lt;/strong&gt;, you will likely be told that measuring a particle in one place can instantly change another particle elsewhere, no matter the distance between the two. Surprisingly, this is something that Paul Halpern never claims in his new book, &lt;em&gt;Synchronicity&lt;/em&gt;. ...to connote an “acausal connecting principle.” &lt;strong&gt;Quantum correlations&lt;/strong&gt;, in Halpern’s view, are a special case of synchronicity.&lt;/p&gt;&#xA;&lt;p&gt;Excerpted from &lt;a href=&quot;https://blogs.sciencemag.org/books/2020/09/22/synchronicity/&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;em&gt;Quantum correlations at a distance needn’t necessarily be “spooky”&lt;/em&gt;&#xA;1st paragrah&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Moreover, is the following expression correct? (&lt;a href=&quot;http://memoirs.is.kochi-u.ac.jp/Vol26/MemoirsF26-6.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;http://memoirs.is.kochi-u.ac.jp/Vol26/MemoirsF26-6.pdf 2.3.2&lt;/a&gt;, I translated it into English)&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The &lt;strong&gt;quantum correlation&lt;/strong&gt; MUST exist in the entanglement state; however, even if there is a quantum correlation, it cannot be called &lt;strong&gt;entanglement&lt;/strong&gt;. For example, when the relationship between qubits A and B is &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\frac{1}{\sqrt{2}}(|0_A0_B\rangle+|1_A1_B\rangle)$&lt;/span&gt;, which cannot be separated by the tensor product. In other words, it is an &lt;strong&gt;entanglement&lt;/strong&gt; state, and there exists a &lt;strong&gt;quantum correlation&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;After measuring, this state changes to &lt;span class=&quot;math-container&quot;&gt;$|0_A0_B\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1_A1_B\rangle$&lt;/span&gt;. There is a quantum correlation in &lt;span class=&quot;math-container&quot;&gt;$|0_A0_B\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1_A1_B\rangle$&lt;/span&gt; state, but it is no longer an &lt;strong&gt;entanglement&lt;/strong&gt; state.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15495" LastEditorUserId="55" LastEditDate="2021-05-08T07:34:30.747" LastActivityDate="2021-05-08T07:34:30.747" Title="What is the relationship between entanglement and quantum correlation?" Tags="&lt;entanglement&gt;&lt;correlations&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17381" PostTypeId="2" ParentId="17377" CreationDate="2021-05-07T06:45:17.973" Score="0" Body="&lt;p&gt;An alternative method, as compared to the existing answer, is perhaps better suited to this specific case where you already know some of the structure of the output matrix.&lt;/p&gt;&#xA;&lt;p&gt;Label each of the columns in binary in numerical order: 00, 01, 10, 11. Label the rows the same. Now, columns correspond to inputs, and rows correspond to outputs.&lt;/p&gt;&#xA;&lt;p&gt;So, let's say you want to know the matrix element in the first row and second column. In effect, you are asking &amp;quot;what is the probability amplitude for a state that starts in &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; to end in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;?&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Thus, make the input &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;. You can run through the action of the circuit&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|01\rangle\rightarrow|11\rangle\rightarrow |10\rangle\rightarrow |00\rangle.&#xA;$$&lt;/span&gt;&#xA;So, the probability amplitude for arriving in state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; is 1. Hence, that matrix element is 1.&lt;/p&gt;&#xA;&lt;p&gt;There's an extra trick you can use here. You evolution is unitary (there's no measurement). Unitary matrices have rows and columns that have sum-mod-square of 1. Hence, if you know one element is 1, every other element in that row and column must be 0.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-07T06:45:17.973" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17382" PostTypeId="2" ParentId="17280" CreationDate="2021-05-07T08:19:11.020" Score="0" Body="&lt;p&gt;With this problem I found these two resources helpful:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-algorithms/bernstein-vazirani.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the quiskit explanation of the BV-problem&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-gates/phase-kickback.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;the quiskit explanation of phase kickback&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Especially in this picture&#xA;&lt;a href=&quot;https://i.stack.imgur.com/dWFco.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/dWFco.png&quot; alt=&quot;phase kickback&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;one can see the concept of what is happening in your posted circuit.&lt;/p&gt;&#xA;&lt;p&gt;The qubit b0 has the task to invert the other qubits, but it's just an auxiliary qubit, so it doesn't need to be measured.&lt;/p&gt;&#xA;&lt;p&gt;To your question if this is a valid BV-problem.&lt;/p&gt;&#xA;&lt;p&gt;My answer would be, that it is valid, but it's not minimized. the X(b0) in the middle section is as unnecessary as to measure b0 in the end. But as already answered by KAJ226 this is encoding &lt;code&gt;0000&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Hope this helps a little. I am quite new to this too, so I hope I didn't mess up anything.&lt;/p&gt;&#xA;" OwnerUserId="15493" LastActivityDate="2021-05-07T08:19:11.020" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17383" PostTypeId="1" AcceptedAnswerId="17395" CreationDate="2021-05-07T08:33:27.317" Score="4" ViewCount="63" Body="&lt;p&gt;It seems like it should be  a function of  N - O(log N), to minimise probability of getting a multiple of the period. However, Prof Preskill's lec notes mention:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Thus we solve Period Finding if the sampled values of &lt;em&gt;k&lt;/em&gt; have no common factor, which is true with high probability after a constant number of trials. Hence the quantum query complexity of Period Finding is constant (even better than for Simon's problem).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What am I missing?&lt;/p&gt;&#xA;" OwnerUserId="15769" LastEditorUserId="55" LastEditDate="2021-05-07T14:06:11.257" LastActivityDate="2021-05-08T21:31:10.190" Title="What is the quantum query complexity of the period finding routine of Shor's algorithm?" Tags="&lt;complexity-theory&gt;&lt;shors-algorithm&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17384" PostTypeId="2" ParentId="17361" CreationDate="2021-05-07T10:03:18.307" Score="2" Body="&lt;p&gt;The trace norm is unitarily invariant. For any unitarily invariant matrix norm, the norm-distance &lt;span class=&quot;math-container&quot;&gt;$\|A-B\|$&lt;/span&gt; of two matrices becomes extremal when they are diagonal in the same basis. (Specifically, for the minimal value, the eigenvalues need to be ordered the same way, and for the maximum, the opposite way.&#xA;This is a consequence of Lidskii's theorem, see e.g. Bhatia, Eq. (IV.62).)&lt;/p&gt;&#xA;&lt;p&gt;In your case, you have that &lt;span class=&quot;math-container&quot;&gt;$B=\vert\phi\rangle\langle\phi\vert$&lt;/span&gt; has only one eigenvalue &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. For a minimal norm distance, you want &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; is diagonal in the same basis as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with the same eigenvalue order.&lt;/p&gt;&#xA;&lt;p&gt;Thus, it follows that for the minimum trace distance, &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle$&lt;/span&gt; must be the leading eigenvector of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and consequently &lt;span class=&quot;math-container&quot;&gt;$\|\rho-\vert\phi\rangle\langle\phi\vert\|_1=1-\lambda_1$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\lambda_1$&lt;/span&gt; the eigenvalue.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-05-07T10:03:18.307" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17385" PostTypeId="1" AcceptedAnswerId="17396" CreationDate="2021-05-07T10:04:32.847" Score="3" ViewCount="41" Body="&lt;p&gt;HHL algorithm can be used for solving linear system &lt;span class=&quot;math-container&quot;&gt;$A|x\rangle=|b\rangle$&lt;/span&gt;. If we put &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; (to be precise its normalized version) into the algorithm and measuring ancilla to be &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; we are left with the state&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\sum_{i=1}^n \beta_i\frac{C}{\lambda_i}|x_i\rangle,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; is &lt;em&gt;i&lt;/em&gt;th eigenvector of matrix &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; is respecitve eigenvalue and  &lt;span class=&quot;math-container&quot;&gt;$\beta_i = \langle b|x_i\rangle$&lt;/span&gt; is &lt;em&gt;i&lt;/em&gt;th coordinate of &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; in basis composed of eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It is known that HHL brings exponential speed-up, however, to get whole state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; we need to do a tomography which cancels the speed-up completely.&lt;/p&gt;&#xA;&lt;p&gt;However, let us assume that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is real matrix and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt; is real vector. Since HHL assumes that &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is Hermitian, &lt;span class=&quot;math-container&quot;&gt;$\lambda_i$&lt;/span&gt; are real. Eigenvalues satisfy relation &lt;span class=&quot;math-container&quot;&gt;$A|x_i\rangle = \lambda_i|x_i\rangle$&lt;/span&gt; and since they are real and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is real, it follows that we can find &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; to be real (despite that fact that they are orthogonal basis of &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^n$&lt;/span&gt;). As a result, coeficients &lt;span class=&quot;math-container&quot;&gt;$\beta_i$&lt;/span&gt; are also real as they are inner product of two real vectors.&#xA;In the end we are left with real probability amplitudes &lt;span class=&quot;math-container&quot;&gt;$\beta_i\frac{C}{\lambda_i}$&lt;/span&gt; in the state above.&lt;/p&gt;&#xA;&lt;p&gt;This all means that in case of real matrix and real right side, we can simply measure probabilities of possible outcomes in an output register and do not have to employ tomography. Hence, for real systems &lt;span class=&quot;math-container&quot;&gt;$Ax=b$&lt;/span&gt;, we are able to get whole solution and at the same time  the exponential speed-up is preserved.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Is my reasoning right or am I missing something?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-05-08T10:04:02.433" Title="HHL algorithm for linear systems with a real matrix and a real right side" Tags="&lt;hhl-algorithm&gt;&lt;speedup&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17386" PostTypeId="1" AcceptedAnswerId="17387" CreationDate="2021-05-07T10:21:16.933" Score="2" ViewCount="48" Body="&lt;p&gt;We often see that the controlled-not gate is written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$CNOT |x y \rangle = |x\rangle |x \oplus y\rangle$&lt;/span&gt;.&#xA;Now, would it be possible to further expand this to get a general equation?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\alpha_0 |0\rangle + \beta_0 |1\rangle) \otimes \left((\alpha_0 |0\rangle + \beta_0 |1\rangle) \oplus (\alpha_1 |0\rangle + \beta_1 |1\rangle) \right) \ ,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is XOR or modulo-2 addition.&lt;/p&gt;&#xA;&lt;p&gt;However, expanding this to&#xA;&lt;span class=&quot;math-container&quot;&gt;$(\alpha_0 |0\rangle + \beta_0 |1\rangle) \otimes \left((\alpha_0 |0\rangle + \beta_0 |1\rangle) + (\alpha_1 |0\rangle + \beta_1 |1\rangle) \!\! \mod 2\right)$&lt;/span&gt;&#xA;does not seem right. Would this operator distribute? Does it behave the same way as in 'standard' algebra, i.e.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$(\alpha_0 |0\rangle + \beta_0 |1\rangle) \otimes ((\alpha_0 + \alpha_1\!\!\!\mod 2)|0\rangle) + (\beta_0 + \beta_1 \!\!\! \mod 2) |1\rangle) \ ?$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="14768" LastEditorUserId="15408" LastEditDate="2021-05-07T18:38:54.597" LastActivityDate="2021-05-07T18:38:54.597" Title="Formulate Controlled-Not as mapping (including modulo-2 addition)" Tags="&lt;quantum-gate&gt;&lt;arithmetic&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17387" PostTypeId="2" ParentId="17386" CreationDate="2021-05-07T11:02:42.317" Score="3" Body="&lt;p&gt;As you point out, you have an &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; of ket vectors, which isn't well-defined, so we will need to define this operation somehow.&lt;/p&gt;&#xA;&lt;p&gt;You definitely can't have &lt;span class=&quot;math-container&quot;&gt;$\beta_0+\beta_1\mod 2$&lt;/span&gt; in a coefficient, since a quantum operator must be &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt;-linear, and there is no non-zero homomorphism from &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Whatever your operator is, its action is completely defined by any 4 basis vectors, such as &lt;span class=&quot;math-container&quot;&gt;$\vert 00\rangle, \vert 01\rangle, \vert 10\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\vert 11\rangle$&lt;/span&gt;. Thus, we want to have some sort of map that sends:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\begin{align}&#xA;\vert 00\rangle \mapsto&amp;amp; \vert 0\rangle(\vert 0\rangle \oplus \vert 0\rangle)\\&#xA;\vert 01\rangle \mapsto&amp;amp; \vert 0\rangle(\vert 0\rangle \oplus \vert 1\rangle)\\&#xA;\vert 10\rangle \mapsto&amp;amp; \vert 1\rangle(\vert 1\rangle \oplus \vert 0\rangle)\\&#xA;\vert 11\rangle \mapsto&amp;amp; \vert 1\rangle(\vert 1\rangle \oplus \vert 1\rangle)\\&#xA;\end{align}$$&lt;/span&gt;&#xA;for whatever you define &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; to be.&lt;/p&gt;&#xA;&lt;p&gt;Since the operator must be unitary, and the original basis was orthogonal, we require &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle \oplus \vert 0\rangle$&lt;/span&gt; to be orthogonal to &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle \oplus \vert 1\rangle$&lt;/span&gt;. In my mind, the only sensible way to way to define &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle \oplus \vert 0\rangle$&lt;/span&gt; would be as &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt;. This forces &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle \oplus \vert 1\rangle=\vert 1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From there, we ought to have that &lt;span class=&quot;math-container&quot;&gt;$\oplus$&lt;/span&gt; is commutative, so &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle \oplus \vert 0\rangle = \vert 0\rangle \oplus \vert 1\rangle = \vert 1\rangle$&lt;/span&gt;. Orthogonality then forces &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle \oplus \vert 1\rangle= \vert 0 \rangle$&lt;/span&gt; as well.&lt;/p&gt;&#xA;&lt;p&gt;But, this means the operator &lt;em&gt;is&lt;/em&gt; the CNOT operator. Basically, the CNOT is the most general form of the CNOT.&lt;/p&gt;&#xA;&lt;p&gt;This reminds me of no-cloning: The no-cloning theorem states that you can't clone &lt;em&gt;arbitrary&lt;/em&gt; states, but you can clone any given basis. However, once the action is defined on this basis, it's action on all other states is fixed.&lt;/p&gt;&#xA;" OwnerUserId="4517" LastEditorUserId="4517" LastEditDate="2021-05-07T14:55:35.070" LastActivityDate="2021-05-07T14:55:35.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17388" PostTypeId="1" CreationDate="2021-05-07T13:57:23.187" Score="2" ViewCount="49" Body="&lt;p&gt;I'm trying to reproduce the Bell-state pulse display as shown in &lt;a href=&quot;https://www.youtube.com/watch?v=V_as5PufUiU&quot; rel=&quot;nofollow noreferrer&quot;&gt;this tutorial&lt;/a&gt;.&#xA;The code is very short:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;bell = QuantumCircuit(2, 2)&#xA;bell.h(0)&#xA;bell.cx(0,1)&#xA;qc = transpile(bell,backend)&#xA;sched_circ = schedule(qc,backend)&#xA;sched_circ.draw()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but if I use the backend &lt;code&gt;ibmq_armonk&lt;/code&gt; there are not enough qubits and, for &lt;code&gt;ibmq_qasm_simulator&lt;/code&gt;, Qiskit-pulse is not supported.&#xA;Is there a way to get it working? I do not need to run the waveforms on a device - I just want to analyze them.&lt;/p&gt;&#xA;&lt;p&gt;P.S. If anyone has a compact IO protocol writing/reading scheduler pulses for multi-qubit Qiskit circuits in HD5 format I'd be interested to collaborate.&lt;/p&gt;&#xA;&lt;p&gt;Follow up:&#xA;After I upgraded my qiskit to ver 0.25.3 the  backend=FakeOpenPulse2Q() works exactly as suggested below.&#xA;Thanks for the help.&#xA;Jan&lt;/p&gt;&#xA;" OwnerUserId="15773" LastEditorUserId="13991" LastEditDate="2021-05-09T21:22:01.887" LastActivityDate="2021-05-09T21:22:01.887" Title="Pulse waveform for 2-qubit circuit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17389" PostTypeId="1" CreationDate="2021-05-07T14:40:36.217" Score="0" ViewCount="17" Body="&lt;p&gt;Process Tomography can identify the quantum channel, while Blind Quantum Computation strives to hide the inputs using quantum gates.&lt;/p&gt;&#xA;&lt;p&gt;Given the user executes the same blind circuit multiple times (of the order of times required to do process tomography), why can't the server do process tomography to break the blindness?&lt;/p&gt;&#xA;" OwnerUserId="1153" LastActivityDate="2021-05-07T14:40:36.217" Title="Process Tomography for Blind Quantum Computation" Tags="&lt;quantum-process-tomography&gt;&lt;blind-quantum-computing&gt;" AnswerCount="0" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17390" PostTypeId="2" ParentId="17388" CreationDate="2021-05-07T14:47:23.410" Score="1" Body="&lt;p&gt;You can use &lt;em&gt;fake pulse backend&lt;/em&gt; to do this.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;import matplotlib.pyplot as plt&#xA;from qiskit.test.mock import FakeOpenPulse2Q&#xA;backend = FakeOpenPulse2Q()&#xA;from qiskit import transpile, schedule &#xA;bell = QuantumCircuit(2, 2)&#xA;bell.h(0)&#xA;bell.cx(0,1)&#xA;qc = transpile(bell,backend)&#xA;pulse_schedule = schedule(qc, backend)&#xA;&#xA;fig, ax = plt.subplots(figsize=(14, 10))&#xA;pulse_schedule.draw('IQXDebugging', axis = ax, show_waveform_info = True)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You will get something like below:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FKQIY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FKQIY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-07T17:02:12.460" LastActivityDate="2021-05-07T17:02:12.460" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17391" PostTypeId="1" CreationDate="2021-05-07T16:12:42.173" Score="2" ViewCount="62" Body="&lt;p&gt;I want to run a simulation using &lt;code&gt;qasm&lt;/code&gt; with a realistic noise model from a backend, specifying a &lt;code&gt;coupling_map&lt;/code&gt; as well as an &lt;code&gt;initial_layout&lt;/code&gt;. I do that via a &lt;code&gt;QuantumInstance&lt;/code&gt; which in turn is passed to an algorithm. Now, two questions regarding that qubit layout:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;I know that the transpiler may change the mapping of logical to physical qubits. Furthermore, I pass a circuit to the algorithm as an argument and the algorithm then adds an ancilla qubit to the circuit.&#xA;Is there a way for me to verify the final logical to physical qubit mapping after transpiling?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Could that automatic adding of an ancilla cause problems when using &lt;code&gt;QuantumInstance&lt;/code&gt; with a specific &lt;code&gt;initial_layout&lt;/code&gt;?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15408" LastEditorUserId="15408" LastEditDate="2021-05-07T17:02:10.167" LastActivityDate="2021-05-07T17:56:48.523" Title="Qiskit logical to physical qubit mapping" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;compiling&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17392" PostTypeId="2" ParentId="17391" CreationDate="2021-05-07T17:56:48.523" Score="1" Body="&lt;p&gt;If you want to get the final qubit layout (regarding to your first question), you can look at the circuit &lt;code&gt;data&lt;/code&gt;. Here is an example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(4, 4)&#xA;&#xA;for i in range(4):&#xA;    circuit.x(i)&#xA;circuit.measure([0,1,2,3], [0,1,2,3])&#xA;&#xA;    &#xA;Circuit_Transpile = transpile(circuit, provider.get_backend('ibmq_16_melbourne') , &#xA;                                initial_layout =None, optimization_level=3)&#xA;&#xA;for quantum_register in Circuit_Transpile.data[:circuit.num_qubits]:&#xA;    print(quantum_register[1])&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What you will see as output is something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[Qubit(QuantumRegister(15, 'q'), 0)],&#xA; [Qubit(QuantumRegister(15, 'q'), 9)],&#xA; [Qubit(QuantumRegister(15, 'q'), 13)],&#xA; [Qubit(QuantumRegister(15, 'q'), 14)]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The number on the right correspond to the qubit number on the device of your interest. There are other ways to do this as well.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-07T17:56:48.523" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17393" PostTypeId="1" CreationDate="2021-05-07T19:35:29.377" Score="2" ViewCount="45" Body="&lt;p&gt;Given a quantum circuit consisting of two qubits, how is the compiled unitary of the circuit computed when we have different input type gates? (X-gate, H-gate are single-input gates, CNOT is a 2-input gate).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(2)&#xA;qc.x(1)&#xA;qc.h(0)&#xA;qc.cnot(0,1)&#xA;usim = Aer.get_backend('unitary_simulator')&#xA;qobj = assemble(qc)&#xA;unitary = usim.run(qobj).result().get_unitary()&#xA;array_to_latex(unitary, pretext=&amp;quot;\\text{Circuit = } &amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://qiskit.org/textbook/ch-gates/multiple-qubits-entangled-states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Section 2.2 of Qiskit&lt;/a&gt; shows how the simultaneous operations of two single-input gates are represented by computing the tensor product of the two gates, and that when we apply a gate to one bit at a time, we represent the unitary as the tensor product with the identity matrix. For the circuit above, how do we compile the circuit's unitary for the &lt;span class=&quot;math-container&quot;&gt;$4\times 4$&lt;/span&gt; CNOT matrix,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT} = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and the &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; matrices?&lt;/p&gt;&#xA;" OwnerUserId="15651" LastEditorUserId="13991" LastEditDate="2021-05-07T20:32:56.983" LastActivityDate="2021-05-07T20:33:54.563" Title="How do you compute the compiled unitary of a quantum circuit comprised of different $n$-input gates?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;unitarity&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17394" PostTypeId="2" ParentId="17393" CreationDate="2021-05-07T20:03:32.167" Score="1" Body="&lt;p&gt;Your circuit is looking like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/W9qvO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/W9qvO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thus, your unitary matrix is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = CNOT \cdot \big( H \otimes X \big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;H \otimes X &amp;amp;=  \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} \otimes \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}   = \dfrac{1}{\sqrt{2}}&#xA;\begin{pmatrix} 1 \cdot \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}   &amp;amp; 1 \cdot \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}  \\ 1 \cdot \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}  &amp;amp; -1 \cdot \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix}  \end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}} \begin{pmatrix}&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 \\&#xA; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; -1\\&#xA; 1 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0 \\ \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and CNOT (textbook convention) is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ \end{pmatrix}&#xA; $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;If you us little endian (like qiskit does) then instead of &lt;span class=&quot;math-container&quot;&gt;$H \otimes X$&lt;/span&gt;, you have to do &lt;span class=&quot;math-container&quot;&gt;$X \otimes H$&lt;/span&gt;. You have to read the circuit in reverse.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = CNOT \cdot \big( X \otimes H \big) $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;so here you have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X \otimes H &amp;amp;=  \begin{pmatrix} 0 &amp;amp; 1 \\ 1 &amp;amp; 0 \end{pmatrix} \otimes \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} = \begin{pmatrix} 0 \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix}  &amp;amp; 1 \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} \\ 1 \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} &amp;amp; 0 \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 &amp;amp; 1 \\ 1 &amp;amp; -1 \end{pmatrix} \end{pmatrix} \\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 1 \\&#xA; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; -1 \\&#xA; 1 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA; 1 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\ \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and in this convention, we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT} = \begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-07T20:33:54.563" LastActivityDate="2021-05-07T20:33:54.563" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17395" PostTypeId="2" ParentId="17383" CreationDate="2021-05-08T02:57:50.987" Score="3" Body="&lt;p&gt;Given a periodic function &lt;span class=&quot;math-container&quot;&gt;$f(x+r) = f(x)$&lt;/span&gt;, the period-finding procedure of Shor's algorithm can find the period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; using &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1)$&lt;/span&gt; oracle calls and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(poly(\log N))$&lt;/span&gt; operations where a high probability of success is assured after repeating the procedure &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log \log r)$&lt;/span&gt; times [1]. The number of times the procedure must be repeated is thus a small, constant number (of order ten or so). So, the quantum query complexity across &lt;em&gt;all&lt;/em&gt; repetitions is &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log \log r)$&lt;/span&gt; * &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1)$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log \log r)$&lt;/span&gt; is constant time, so the result is still &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Derivation&lt;/h3&gt;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, we find a smooth &lt;span class=&quot;math-container&quot;&gt;$Q$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$N^2 \leq Q &amp;lt; 2N^2$&lt;/span&gt;, wich implies that &lt;span class=&quot;math-container&quot;&gt;$Q/r &amp;gt; N$&lt;/span&gt;. Next, we put our machine in the uniform superposition of states representing numbers &lt;span class=&quot;math-container&quot;&gt;$x \text{ (mod } Q)$&lt;/span&gt;, and compute &lt;span class=&quot;math-container&quot;&gt;$a^x \text{ (mod } N)$&lt;/span&gt; with a single application of &lt;span class=&quot;math-container&quot;&gt;$U:(x,y)\mapsto (x,y\oplus f(x))$&lt;/span&gt;, leaving the machine in state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{Q^{1/2}} \sum_{x=0}^{Q-1}|x, a^x \text{ (mod } N)\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We then apply the inverse quantum Fourier transform to the first register, producing the state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{Q}\sum_{x=0}^{Q-1}\exp{(2\pi i xc/Q)}|c, a^x \text{ (mod } N)\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Finally, we compute the probability that our machine ends in a particular state &lt;span class=&quot;math-container&quot;&gt;$|c, a^k \text{ (mod } N)\rangle$&lt;/span&gt;, where we may assume &lt;span class=&quot;math-container&quot;&gt;$0 \leq k &amp;lt; r$&lt;/span&gt;. Summing over all possible ways to reach this state, we find that the probability is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\bigg| \frac{1}{Q} \sum_{b=0}^{\lfloor (Q-k-1)/r \rfloor} \exp{(2\pi i brc/Q)} \bigg|^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The above probability is a simple explicit function of the integer &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt;, whose magnitude has maxima when &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is close to integral multiples of &lt;span class=&quot;math-container&quot;&gt;$Q/r$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$rc \text{ (mod } Q) \leq r/2$&lt;/span&gt;, this quantity can be shown to be asymptotically bounded below by &lt;span class=&quot;math-container&quot;&gt;$4/(\pi^2r^2)$&lt;/span&gt;, and thus at least &lt;span class=&quot;math-container&quot;&gt;$1/3r^2$&lt;/span&gt;. The probability of seeing a given state &lt;span class=&quot;math-container&quot;&gt;$|c, a^k \text{ (mod } N)\rangle$&lt;/span&gt; will thus be at least &lt;span class=&quot;math-container&quot;&gt;$1/3r^2$&lt;/span&gt; if there is a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; such that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\bigg|\frac{c}{Q} - \frac{d}{r} \bigg| \leq \frac{1}{2Q}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;span class=&quot;math-container&quot;&gt;$r &amp;lt; N$&lt;/span&gt;, and since any two distinct fractions with denominators less than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; must differ by at least &lt;span class=&quot;math-container&quot;&gt;$1/N^2$&lt;/span&gt;, a unique value of &lt;span class=&quot;math-container&quot;&gt;$d/r$&lt;/span&gt; can be efficiently extracted from the known value of &lt;span class=&quot;math-container&quot;&gt;$c/Q$&lt;/span&gt; by an application of the theory of continued fractions [2, Chapter X]. If we have the fraction &lt;span class=&quot;math-container&quot;&gt;$d/r$&lt;/span&gt; in lowest terms, and if &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; happens to be relatively prime to &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, this will give us &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There are &lt;span class=&quot;math-container&quot;&gt;$\phi(r)$&lt;/span&gt; possible values for &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; relatively prime to &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; is Euler's &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; function. There are also &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; possible values for &lt;span class=&quot;math-container&quot;&gt;$a^k$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is the order of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;. Thus, there are &lt;span class=&quot;math-container&quot;&gt;$r\phi(r)$&lt;/span&gt; states &lt;span class=&quot;math-container&quot;&gt;$|c, a^k \text{ (mod } N)\rangle$&lt;/span&gt; which would enable us to obtain &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt;. Since each of these states occurs with probability at least &lt;span class=&quot;math-container&quot;&gt;$1/3r^2$&lt;/span&gt;, we obtain &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; with probability at least &lt;span class=&quot;math-container&quot;&gt;$\phi(r)/3r$&lt;/span&gt;. Using the theorom that &lt;span class=&quot;math-container&quot;&gt;$\phi(r)/r &amp;gt; k/\log \log r$&lt;/span&gt; for some fixed &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; [2, Theorom 328], this shows that we find &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; at least &lt;span class=&quot;math-container&quot;&gt;$k/\log \log r$&lt;/span&gt; fraction of the time. &lt;em&gt;So, by repeating this procedure only &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(\log \log r)$&lt;/span&gt; times, we are assured of a high probability of success&lt;/em&gt; [1].&lt;/p&gt;&#xA;&lt;p&gt;When &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is the product of two primes, the period &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; is not only less than &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; but also less than &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}N$&lt;/span&gt;. As a result, a more extended analysis shows that the probability of learning a divisor &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; from the measured value of &lt;span class=&quot;math-container&quot;&gt;$c$&lt;/span&gt; is bounded from below not just by &lt;span class=&quot;math-container&quot;&gt;$4/\pi^2 \simeq 0.4$&lt;/span&gt;, but by more than 0.9. Furthermore, by adding a small number of additional qubits to the input register, the probability of learning a divisor &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; in a single run can be made quite close to 1 [3].&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;[1] P. W. Shor, &lt;em&gt;Algorithms for quantum computation: discrete logarithms and factoring&lt;/em&gt;, 1994. &lt;br&gt;&#xA;[2] G. H. Hardy and E. M. Wright, &lt;em&gt;An Introduction to the Theory of Numbers, Fifth Edition,&lt;/em&gt; Oxford University Press, 1979. &lt;br&gt;&#xA;[3] N. David Mermin, &lt;em&gt;Quantum Computer Science: an Introduction&lt;/em&gt;. Cambridge University Press, 2016.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-08T21:31:10.190" LastActivityDate="2021-05-08T21:31:10.190" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17396" PostTypeId="2" ParentId="17385" CreationDate="2021-05-08T10:04:02.433" Score="4" Body="&lt;p&gt;If you mean by this sentence:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;we are able to get whole solution&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;to know all the components of vector &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, then I'm afraid you are wrong.&lt;/p&gt;&#xA;&lt;p&gt;Given a sparse &lt;span class=&quot;math-container&quot;&gt;$N \times N$&lt;/span&gt; matrix with a condition number &lt;span class=&quot;math-container&quot;&gt;$\kappa$&lt;/span&gt;, HHL algorithm has a runtime &lt;span class=&quot;math-container&quot;&gt;$O(\log(N)\kappa ^{2})$&lt;/span&gt;. This offers an exponential speedup over the best known classical algorithm, which has a runtime &lt;span class=&quot;math-container&quot;&gt;$O(N\kappa )$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional vector, which means we need &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; measurements to get all its components. That would kill the exponential speedup.&lt;/p&gt;&#xA;&lt;p&gt;In his paper, &amp;quot;&lt;a href=&quot;https://www.nature.com/articles/nphys1473&quot; rel=&quot;nofollow noreferrer&quot;&gt;Equation solving by simulation&lt;/a&gt;&amp;quot;, Andrew Childs said:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Producing a quantum state proportional to &lt;span class=&quot;math-container&quot;&gt;$A^{−1}|b〉$&lt;/span&gt; does not, by itself, solve the task at hand. To extract information from a quantum state, we must perform a measurement. Learning all &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; amplitudes of an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional quantum state requires a number of measurements at least proportional to &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;. Thus, if our goal is to completely reconstruct a solution &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, there is no hope for a quantum algorithm to offer a significant advantage over classical methods.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-05-08T10:04:02.433" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17402" PostTypeId="1" AcceptedAnswerId="17415" CreationDate="2021-05-08T14:15:51.423" Score="2" ViewCount="55" Body="&lt;p&gt;I am using Qiskit's &lt;code&gt;opflow&lt;/code&gt; and its &lt;code&gt;CircuitSampler&lt;/code&gt; to evaluate matrix elements / expectation values. Now, going beyond &lt;code&gt;statevector&lt;/code&gt; and simple &lt;code&gt;qasm&lt;/code&gt; simulations, I want to introduce noise of a real device, specify qubit-connectivity (&lt;code&gt;coupling_map&lt;/code&gt;), and choose which physical qubits the logical qubits of my circuit are mapped to (&lt;code&gt;initial_layout&lt;/code&gt;). This is all specified in a &lt;code&gt;QuantumInstance&lt;/code&gt; which is then passed to the &lt;code&gt;CircuitSampler&lt;/code&gt;,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result = CircuitSampler(QuantumInstance).convert(operator).eval()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How do all these specifications for transpilation translate through the &lt;code&gt;CircuitSampler&lt;/code&gt; and into the final output? I.e., does &lt;code&gt;CircuitSampler&lt;/code&gt; transpile the circuits inside, e.g., &lt;code&gt;ListOp&lt;/code&gt; before sampling? And how can I check which &lt;em&gt;physical qubits&lt;/em&gt; the logical ones were mapped to during transpilation?&lt;/p&gt;&#xA;&lt;p&gt;I am confused by &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.opflow.converters.CircuitSampler.html?highlight=circuitsampler#qiskit.opflow.converters.CircuitSampler&quot; rel=&quot;nofollow noreferrer&quot;&gt;this sentence in the documentation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The CircuitSampler aggressively caches transpiled circuits to handle re-parameterization of the same circuit efficiently.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What does this mean?&lt;/p&gt;&#xA;" OwnerUserId="15408" LastEditorUserId="55" LastEditDate="2021-05-08T21:22:19.487" LastActivityDate="2021-05-09T19:53:50.867" Title="Qiskit: Transpilation and the CircuitSampler" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;transpile&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17403" PostTypeId="1" AcceptedAnswerId="17404" CreationDate="2021-05-08T14:40:14.017" Score="2" ViewCount="156" Body="&lt;p&gt;How can we draw a circuit that is based on the gates &lt;span class=&quot;math-container&quot;&gt;$H, CZ$&lt;/span&gt; that implements &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;.&lt;br /&gt;&#xA;I know that the &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; gate is like that:&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Vf8zv.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Vf8zv.png&quot; alt=&quot;H-Gate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And also the &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; gate is:&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/qpwPT.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qpwPT.png&quot; alt=&quot;CZ-Gate&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But I'm not sure how to draw this with the implementation of &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15785" LastActivityDate="2021-05-10T08:23:11.587" Title="Making a Controlled-Z from a CNOT" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17404" PostTypeId="2" ParentId="17403" CreationDate="2021-05-08T15:02:27.310" Score="4" Body="&lt;p&gt;You can check that the following is equal to a CNOT gate (the mid-part being the controlled &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-gate)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/Bv0Oq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Bv0Oq.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first Hadamard gate rotates &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-basis. In that basis, the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-gate acts like a bit flip (the same way the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-gate acts in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis). The second Hadamard rotates &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; back to &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-basis.&lt;/p&gt;&#xA;" OwnerUserId="15408" LastEditorUserId="15408" LastEditDate="2021-05-10T08:23:11.587" LastActivityDate="2021-05-10T08:23:11.587" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17405" PostTypeId="2" ParentId="17403" CreationDate="2021-05-08T15:48:16.693" Score="2" Body="&lt;p&gt;@Durd3nT answered the question nicely. But here is another way to see it, and hopefully it will be useful for future purposes...&lt;/p&gt;&#xA;&lt;p&gt;All you need to know is the identity &lt;span class=&quot;math-container&quot;&gt;$X = HZH$&lt;/span&gt;. Then now you can see that &lt;span class=&quot;math-container&quot;&gt;$CNOT (CX)$&lt;/span&gt; can be rewritten as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CX = \big( I \otimes H \big) CZ \big( I \otimes H \big)  $$&lt;/span&gt;&#xA;This is because when the controlled-qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, you are not doing anything, so the two Hadamard (&lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;) gates cancel each other out. And when the controlled-qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the combination &lt;span class=&quot;math-container&quot;&gt;$HZH$&lt;/span&gt; will acts as an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-08T15:48:16.693" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17406" PostTypeId="1" CreationDate="2021-05-08T20:32:23.273" Score="0" ViewCount="58" Body="&lt;p&gt;How can I construct a CNOT gate using a CZ and H gates?&lt;/p&gt;&#xA;&lt;p&gt;And I also need to prove it using these identities:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;H = (1/\sqrt{2})(X+Z)\\&#xA;XZ = -ZX\\&#xA;X^2 = Z^2 = H^2 = 1\\&#xA;HXH = Z\\&#xA;HZH = X\\&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thank you!&lt;/p&gt;&#xA;" OwnerUserId="15791" LastEditorUserId="2293" LastEditDate="2021-05-08T21:42:27.177" LastActivityDate="2021-05-09T04:22:02.457" Title="constructing a CNOT gate using a CZ and H gates" Tags="&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17407" PostTypeId="2" ParentId="17406" CreationDate="2021-05-09T04:22:02.457" Score="1" Body="&lt;p&gt;Remember that when you apply a CNOT (CX) gate to two qubits, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; (controlled) and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; (target), then when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, you apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate to the target quit &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;. And when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state, you simply do nothing. CZ is the same. when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; you apply &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;, and when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; you do nothing.&lt;/p&gt;&#xA;&lt;p&gt;Now, if you consider the circuit &lt;span class=&quot;math-container&quot;&gt;$\big( I \otimes H \big) CZ \big(I \otimes H \big)$&lt;/span&gt; which can be drawn as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7cvzK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7cvzK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;With the above circuit, note that when the controlled qubit, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, is in the state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; do nothing to &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; and so you will end up with just &lt;span class=&quot;math-container&quot;&gt;$H \cdot H = I$&lt;/span&gt;. Thus, when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, nothing happens, just as the case when we have &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now. ote that when the controlled qubit, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt;, is in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;,&lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; will apply the gate &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;. Thus, you have &lt;span class=&quot;math-container&quot;&gt;$H \cdot Z \cdot H = X$&lt;/span&gt;. Thus, when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we apply the  gate &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt;. This is exactly the case in &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, in both cases, when &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q_1$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we have the same result as &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;. This implies that the above circuit is indeed exactly the same as the circuit&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UixYh.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UixYh.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-09T04:22:02.457" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17408" PostTypeId="1" CreationDate="2021-05-09T09:44:15.257" Score="2" ViewCount="77" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7ECaq.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ECaq.png&quot; alt=&quot;There are RXX, RZZ but no RYY&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If so, why? How to create the RYY-gate in the composer?&lt;/p&gt;&#xA;" OwnerUserId="15798" LastEditorUserId="55" LastEditDate="2021-05-11T12:33:40.970" LastActivityDate="2021-05-11T12:33:40.970" Title="Is RYY gate not available in IBM Quantum Composer?" Tags="&lt;quantum-gate&gt;&lt;ibm-q-experience&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17409" PostTypeId="1" AcceptedAnswerId="17430" CreationDate="2021-05-09T12:07:01.970" Score="3" ViewCount="36" Body="&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_Cram%C3%A9r%E2%80%93Rao_bound&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quantum Cramer-Rao Bound&lt;/a&gt; states that the precision we can achieve is bounded below by:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$(\Delta \theta)^2\ge\frac{1}{mF_Q[\varrho,H]},$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the number of independent repetitions, and &lt;span class=&quot;math-container&quot;&gt;$F_{\mathrm{Q}}[\varrho, H]$&lt;/span&gt; is the quantum Fisher information.&lt;/p&gt;&#xA;&lt;p&gt;The question is, the left side of the bound is the variance of the parameter &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, so it might have a unit while the right side is Quantum Fisher Information which does not possess a unit.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="55" LastEditDate="2021-05-11T12:34:00.487" LastActivityDate="2021-05-11T12:34:00.487" Title="Unit vanishes in the Quantum Cramer-Rao Bound?" Tags="&lt;mathematics&gt;&lt;quantum-fisher-information&gt;&lt;quantum-metrology&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17410" PostTypeId="1" CreationDate="2021-05-09T12:39:03.010" Score="2" ViewCount="62" Body="&lt;p&gt;Can you help me to configure the &lt;code&gt;FakeOpenPulse2Q()&lt;/code&gt; to produce more realistic pulses?&#xA;The code below instantiates 2 circuits and generates the waveforms for each.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/rlMuO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/rlMuO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The top waveform frame is 1-qubit circuits with a single U3 gate using &lt;code&gt;backend='ibmq_armonk'&lt;/code&gt; works fine.&#xA;The bottom waveform frame is generated by &lt;code&gt;FakeOpenPulse2Q()&lt;/code&gt; for a 2-qubit circuit using the same  U3 gate on qubit 0 and the waveforms have the right structures but their shapes are simplified.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vCv7K.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vCv7K.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I'm guessing FakeOpenPulse2Q requires a definition of calibrated X90 and CNOT gates for each qubit. Can you help me to&lt;br /&gt;&#xA;a) transfer the X90 calibration of qubit 0 from &lt;code&gt;ibmq_armonk&lt;/code&gt; to  &lt;code&gt;FakeOpenPulse2Q()&lt;/code&gt; &lt;br&gt;&#xA;b) use the same X90 calibration for qubit 1, except shift the drive &amp;amp; read frequencies by 300 and 400 MHz, respectively &lt;br&gt;&#xA;c) define a realistic CNOT gate  in FakeOpenPulse2Q&#xA;&lt;br&gt;&#xA;Thanks&#xA;&lt;br&gt;&#xA;Jan&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import matplotlib.pyplot as plt&#xA;from qiskit import IBMQ&#xA;from qiskit import QuantumCircuit, transpile,schedule&#xA;from qiskit.test.mock import FakeOpenPulse2Q&#xA;&#xA;IBMQ.load_account()&#xA;provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')&#xA;backend1 = provider.get_backend('ibmq_armonk')&#xA;backend2 = FakeOpenPulse2Q()&#xA;&#xA;circ1 = QuantumCircuit(1,name='1Qcirc')&#xA;circ1.u(0.4,0.6,0.9,0)&#xA;qc1 = transpile(circ1, basis_gates=['u1','u2','u3'], optimization_level=1)&#xA;&#xA;circ2 = QuantumCircuit(2,name='2Qcirc')&#xA;circ2.u(0.4,0.6,0.9,0)&#xA;circ2.sx(1)&#xA;qc2 = transpile(circ2, basis_gates=['u1','u2','u3'], optimization_level=1)&#xA;&#xA;sched1=schedule(qc1,backend1)&#xA;sched2=schedule(qc2,backend2)&#xA;&#xA;fig=plt.figure(1,facecolor='white', figsize=(14, 8))&#xA;ax1=plt.subplot2grid((3,1), (0,0), rowspan=1)&#xA;ax2=plt.subplot2grid((3,1), (1,0), rowspan=2)&#xA;&#xA;sched1.draw('IQXDebugging', axis = ax1, show_waveform_info = True)&#xA;sched2.draw('IQXDebugging', axis = ax2, show_waveform_info = True)&#xA;&#xA;&#xA;print('circuit1:'); print(circ1)&#xA;print('circuit2:'); print(circ2)&#xA;plt.tight_layout()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15773" LastEditorUserId="15773" LastEditDate="2021-05-10T12:36:32.120" LastActivityDate="2021-05-12T14:24:18.913" Title="configuration of FakeOpenPulse2Q" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17411" PostTypeId="1" CreationDate="2021-05-09T14:57:38.987" Score="1" ViewCount="64" Body="&lt;p&gt;I agree that this may not be an easy question to answer.&lt;/p&gt;&#xA;&lt;p&gt;But lately, I increasingly come across the fact that many news materials and research papers in the field of quantum technologies say that at the moment there is &lt;strong&gt;no quantum computer&lt;/strong&gt; in the world. Instead, they argue that there are only &lt;strong&gt;prototypes of a quantum computer&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So what do Google, IBM, and other large companies produce?&#xA;Are these really just prototypes of a quantum computer?&lt;/p&gt;&#xA;&lt;p&gt;What about D-Wave computers (like a 2000 qubit quantum computer)?&lt;/p&gt;&#xA;&lt;p&gt;What characteristics distinguish a &lt;strong&gt;quantum computer&lt;/strong&gt; from a &lt;strong&gt;prototype quantum computer&lt;/strong&gt;?&#xA;And why then do some talk about a quantum computer, while others talk about a prototype of a quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="15573" LastEditorUserId="1859" LastEditDate="2021-05-09T20:13:27.213" LastActivityDate="2021-05-09T20:13:27.213" Title="Does a quantum computer exist today?" Tags="&lt;physical-realization&gt;&lt;physical-qubit&gt;&lt;ibm&gt;&lt;google-sycamore&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2021-05-09T21:16:40.467" ContentLicense="CC BY-SA 4.0" />
  <row Id="17412" PostTypeId="2" ParentId="17408" CreationDate="2021-05-09T16:35:01.743" Score="3" Body="&lt;p&gt;The &lt;span class=&quot;math-container&quot;&gt;$R_{YY}$&lt;/span&gt; gate is not available within the Qiskit composer. This is because you can build it from other available gates within the composer. For instance, there is a nice way to represent &lt;span class=&quot;math-container&quot;&gt;$R_{YY}$&lt;/span&gt; using the set &lt;span class=&quot;math-container&quot;&gt;$\{ R_{XX}, R_X, R_Y, P \}$&lt;/span&gt;. That is, suppose you want to implement &lt;span class=&quot;math-container&quot;&gt;$R_{YY}(\theta)$&lt;/span&gt; then you can do it as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/WOeVp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/WOeVp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, there is an option to add custom gate within the composer. Thus, you can embed this circuit in in as your &lt;span class=&quot;math-container&quot;&gt;$R_{YY}$&lt;/span&gt; gate. That is one way to do it.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-09T17:43:23.923" LastActivityDate="2021-05-09T17:43:23.923" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17413" PostTypeId="5" CreationDate="2021-05-09T17:37:21.763" Score="0" Body="&lt;p&gt;The generalized &lt;span class=&quot;math-container&quot;&gt;$XXZ$&lt;/span&gt; model is given by the Hamiltonian:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$H = \sum_{\langle i,j \rangle}S^x_iS^x_j+S^y_iS^y_j+\Delta S^z_iS^z_j,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\Delta = -1$&lt;/span&gt; represents the case of the ferromagnet and &lt;span class=&quot;math-container&quot;&gt;$\Delta = 1$&lt;/span&gt; characterizes that of the antiferromagnet.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="9006" LastEditDate="2021-05-10T07:17:11.547" LastActivityDate="2021-05-10T07:17:11.547" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17414" PostTypeId="4" CreationDate="2021-05-09T17:37:21.763" Score="0" Body="The XXZ instantiation of the Heisenberg model, a statistical mechanical model used in the study of critical points and phase transitions of magnetic systems in which the spins of the magnetic systems are treated quantum mechanically." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-10T10:08:41.080" LastActivityDate="2021-05-10T10:08:41.080" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17415" PostTypeId="2" ParentId="17402" CreationDate="2021-05-09T19:53:50.867" Score="3" Body="&lt;p&gt;This post contains a few questions,  so let's first recap the steps the circuit sampler goes through (you can also check out the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/77da2b5668637ad878d2773dadc79530f82b3459/qiskit/opflow/converters/circuit_sampler.py#L144&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code here&lt;/a&gt;), before answering your questions.&lt;/p&gt;&#xA;&lt;h3&gt;How the Circuit Sampler works&lt;/h3&gt;&#xA;&lt;p&gt;Provided with a backend/quantum instance and an operator expression, the job of the circuit sampler is to execute all circuits in the operator expression and replace them by the circuit result. Imagine you have an operator expression consisting of an operator measurement composed with a circuit-state:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit = QuantumCircuit(1)&#xA;circuit.h(0)&#xA;&#xA;hamiltonian = X + Z&#xA;&#xA;expr = StateFn(hamiltonian, is_measurement=True).compose(state)&#xA;print(expr)&#xA;# prints:&#xA;# ComposedOp([&#xA;#   OperatorMeasurement(1.0 * X&#xA;#   + 1.0 * Z),&#xA;#   CircuitStateFn(&#xA;#        ┌───┐&#xA;#   q_0: ┤ H ├&#xA;#        └───┘&#xA;#   )&#xA;# ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you then apply the circuit sampler (e.g. with a statevector simulator as backend)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;backend = Aer.get_backend('statevector_simulator')&#xA;sampler = CircuitSampler(backend) &#xA;sampled = sampler.convert(expr)&#xA;print(sampled)&#xA;# prints:&#xA;# ComposedOp([&#xA;#   OperatorMeasurement(1.0 * X&#xA;#   + 1.0 * Z),&#xA;#   VectorStateFn(Statevector([0.70710678+0.j, 0.70710678+0.j], dims=(2,)))&#xA;# ])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;then &lt;code&gt;sampled&lt;/code&gt; is the same as &lt;code&gt;expr&lt;/code&gt; but the circuit-state has been replaced with a vector-state.&lt;/p&gt;&#xA;&lt;p&gt;To do that, the circuit sampler goes through the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Extract all circuits from the operator expression (and cache them)&lt;/li&gt;&#xA;&lt;li&gt;Transpile all circuits (and cache them)&lt;/li&gt;&#xA;&lt;li&gt;Execute all circuits with the provided quantum instance&lt;/li&gt;&#xA;&lt;li&gt;Replace the original circuit-states with the results&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3&gt;Your questions&lt;/h3&gt;&#xA;&lt;p&gt;So to answer your questions above:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;How do all these specifications for transpilation translate through the CircuitSampler and into the final output?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes, the circuit sampler transpiles the circuits according to the specifications&#xA;in the quantum instance.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;And how can I check which physical qubits the logical ones were mapped to during transpilation?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;There is no nice way to check what the transpiled circuits look like. Ideally you would just transpile the circuits manually with the quantum instance since the circuit sampler's purpose is only the execution. However, you could access the cache (but that's not officially supported behavior):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;last_cache = list(sampler._cached_ops.values())[-1]&#xA;transpiled_circs = last_cache.transpiled_circ_cache&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I am confused by this sentence in the documentation:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The CircuitSampler aggressively caches transpiled circuits to handle re-parameterization of the same circuit efficiently.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;We often have the use case where we want to execute the same circuit many times but with different parameter values in the qubit gates. If we only change the parameter values, we can transpile a &amp;quot;template&amp;quot; and only assign the values afterwards. Since transpilation is expensive, this can save a lot of time.&lt;/p&gt;&#xA;&lt;p&gt;As pointed out above in the circuit sampler steps, the circuits sampler caches circuits at different points and tries to re-use already transpiled circuits to avoid the expensive transpilation.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-05-09T19:53:50.867" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17416" PostTypeId="1" AcceptedAnswerId="17417" CreationDate="2021-05-09T21:08:53.963" Score="3" ViewCount="26" Body="&lt;p&gt;I am trying to code finance portfolio optimisation problem into a quantum annealer, using the Hamiltonian Ising model. I am using the &lt;a href=&quot;https://sdk-docs.readthedocs.io/en/latest/docs_neal/reference/sampler.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;dwave&lt;/a&gt; module&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;neal.sampler.SimulatedAnnealingSampler.sample_ising&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;I was wondering how one gets to decide what the bias is?&lt;/strong&gt; I don't really get how that works. On the documentation of Dwave it says the following:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nAEAm.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nAEAm.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There also was this example code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import neal&#xA;&amp;gt;&amp;gt;&amp;gt; sampler = neal.SimulatedAnnealingSampler()&#xA;h = {'a': 0.0, 'b': 0.0, 'c': 0.0}&#xA;J = {('a', 'b'): 1.0, ('b', 'c'): 1.0, ('a', 'c'): 1.0}&#xA;sampleset = sampler.sample_ising(h, J, num_reads=10)&#xA;print(sampleset.first.energy)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15801" LastEditorUserId="9006" LastEditDate="2021-05-10T07:18:16.550" LastActivityDate="2021-05-10T07:18:16.550" Title="How to decide bias in Hamiltonian Ising model?" Tags="&lt;programming&gt;&lt;d-wave&gt;&lt;annealing&gt;&lt;quantum-computing-for-finance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17417" PostTypeId="2" ParentId="17416" CreationDate="2021-05-10T06:50:02.943" Score="2" Body="&lt;p&gt;Problem solving in Ocean framework goes by modeling the problem into a &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/stable/docs_dimod/intro/intro_bqm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;BinaryQuadraticModel&lt;/a&gt;. The pure quantum samplers natively only understand this model. For the hybrid samplers (Leap) one can model the problem into &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/stable/concepts/dqm.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;DiscreteQuadraticModel&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;em&gt;bias&lt;/em&gt; are the linear terms in those models objective functions.  They are derived with respect to the problem after the transformation into a BQM or DQM was done. Finance is a topic in D-Waves &lt;a href=&quot;https://docs.dwavesys.com/docs/latest/handbook_problems.html#cb-probs-finance&quot; rel=&quot;nofollow noreferrer&quot;&gt;problem solving handbook&lt;/a&gt;. There are some papers listed.&lt;/p&gt;&#xA;&lt;p&gt;So, to get the bias terms the problem first needs a formulation as a constrained optimization problem. Examples are given in the Ocean docs, e.g. for a map coloring problem. There are some tools to derive a BQM from constraint optimization problems (pyqubo or &lt;a href=&quot;https://docs.ocean.dwavesys.com/en/stable/docs_binarycsp/sdk_index.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;dwavebinarycsp&lt;/a&gt; ).&#xA;This needs to get transformed into an Ising problem to be used for &lt;code&gt;neal.sampler.SimulatedAnnealingSampler.sample_ising&lt;/code&gt;. The dimod package provides tools for this task.&#xA;The terms really depend on the problem structure.&lt;/p&gt;&#xA;" OwnerUserId="15162" LastActivityDate="2021-05-10T06:50:02.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17418" PostTypeId="1" AcceptedAnswerId="17420" CreationDate="2021-05-10T07:04:18.380" Score="3" ViewCount="49" Body="&lt;p&gt;It is known that an &amp;quot;upside-down&amp;quot; CNOT is equivalent to a &amp;quot;normal CNOT&amp;quot; surrounded by Hadamard gates as shown in this picture.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/k88Ux.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/k88Ux.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am wondering whether there is a similar circuit equivalent to Toffoli gates controlled by qubits below the target qubit or with the target qubit in the middle as shown here.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/JIyUG.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/JIyUG.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The only way I was able to find so far is to take a decomposition of the Toffoli gate (e.g.&lt;a href=&quot;https://en.wikipedia.org/wiki/Toffoli_gate#/media/File:Qcircuit_ToffolifromCNOT.svg&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), redraw the circuit in order to have it upside down, and replace upside-down CNOTs with the construction above.&lt;/p&gt;&#xA;&lt;p&gt;I am looking for a more elegant way similar to that of the CNOT.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="15408" LastEditDate="2021-05-10T10:30:57.880" LastActivityDate="2021-05-10T10:31:05.360" Title="Toffolli upside down - an equivalent circuit" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17419" PostTypeId="2" ParentId="16622" CreationDate="2021-05-10T07:25:51.523" Score="0" Body="&lt;h1&gt;Direct conversion&lt;/h1&gt;&#xA;&lt;p&gt;There is a way to convert a QuadraticProgram(QP) from Qiskit into a BinaryQuadraticModel(BQM).&#xA;First the QP has to be created with Qiskit. It can have linear constraints, integer variables and binary variables. The objective can have linear and quadratic terms. Quadratic constraints and float variables are not supported in the following workflow. The qiskit-optimization package has a special converter named &lt;a href=&quot;https://github.com/Qiskit/qiskit-optimization/blob/main/qiskit_optimization/converters/quadratic_program_to_qubo.py&quot; rel=&quot;nofollow noreferrer&quot;&gt;QuadraticProgramToQubo&lt;/a&gt;. This convenience converter wraps several conversions. By using the convert method one gets a QP back in QuadraticUnconstrainedBinaryOptimization (QUBO) problem form.&#xA;That is, constraints were transformed to be part of the objective function now. Integer variables are mapped to several binary variables.&lt;/p&gt;&#xA;&lt;p&gt;Now, to transform this into Ocean framework, create a BQM instance with the objective function parts of the QUBO:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;bqm_binary = dimod.as_bqm(qubo.objective.linear.to_array(), qubo.objective.quadratic.to_array(), dimod.BINARY)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This BQM can be submitted to a D-Wave QPU sampler, e.g. &lt;code&gt;result = sampler.sample(bqm_binary, label=&amp;quot;example_qp&amp;quot;, num_reads=1024)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h1&gt;D-Wave Qiskit Plugin&lt;/h1&gt;&#xA;&lt;p&gt;By using the &lt;a href=&quot;https://github.com/dwavesystems/dwave-qiskit-plugin&quot; rel=&quot;nofollow noreferrer&quot;&gt;Plugin&lt;/a&gt; one can avoid the transformation and especially interpreting of results part.&#xA;The use is pretty straightforward. One should be aware, that the plugin was not updated to the new package structure in Qiskit (Aqua to optimization).&lt;/p&gt;&#xA;&lt;p&gt;Imports:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.optimization import QuadraticProgram&#xA;from qiskit.optimization.algorithms import MinimumEigenOptimizer&#xA;from dwave.plugins.qiskit import DWaveMinimumEigensolver&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Model the QP in Qiskit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;model = QuadraticProgram(&amp;quot;Binary Test&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Add variables, constraints and set objective function with linear and quadratic terms.&#xA;Use D-Wave QPU as a minimum eigen solver&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dwave_solver = DWaveMinimumEigensolver()&#xA;optimizer = MinimumEigenOptimizer(dwave_solver)&#xA;result = optimizer.solve(model)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result is in agreement with the original QP problem. To view the native QPU results use&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result.min_eigen_solver_result.sampleset.to_pandas_dataframe()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For the parameter setting I have opened an issue on the plugins GitHub site, which has been solved: &lt;a href=&quot;https://github.com/dwavesystems/dwave-qiskit-plugin/issues/1&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/dwavesystems/dwave-qiskit-plugin/issues/1&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15162" LastActivityDate="2021-05-10T07:25:51.523" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17420" PostTypeId="2" ParentId="17418" CreationDate="2021-05-10T08:37:04.593" Score="1" Body="&lt;p&gt;Based on the advice by &lt;em&gt;DaftWullie&lt;/em&gt;, I added Hadamards on the target and one of the control qubits. The trick is that the Toffoli gate is in fact a controlled CNOT. So we can leave one of control qubit unchanged and consider the rest of the gate as a CNOT. Then, we can apply the same approach as in the case of an &amp;quot;upside-down&amp;quot; CNOT. Here are the equivalent circuits:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5W9z5.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5W9z5.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9006" LastEditorUserId="15408" LastEditDate="2021-05-10T10:31:05.360" LastActivityDate="2021-05-10T10:31:05.360" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17422" PostTypeId="1" CreationDate="2021-05-10T11:59:26.667" Score="3" ViewCount="35" Body="&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;I am given to understand that the steps of Quantum State Tomography (QST) are as follows for a single qubit:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The qubit is in the state &lt;span class=&quot;math-container&quot;&gt;$\psi=a_0|0\rangle+a_1|1\rangle$&lt;/span&gt; with density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho = |\psi\rangle\langle\psi|$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Decompose &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in terms of the Pauli basis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \frac{1}{2}\left( I_{2\times 2} + \sum_{A}\langle \sigma_A \rangle \sigma_A \right)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A=x,y,z$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\sigma_A = (\sigma_x,\sigma_y,\sigma_z)$&lt;/span&gt; the 3d vector of 2x2 Pauli matrices (generators of SU(2)).&lt;/li&gt;&#xA;&lt;li&gt;Then there are the &amp;quot;measurement equations&amp;quot;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}p_0\\p_1 \end{pmatrix} = \begin{pmatrix}\beta_I^{|0\rangle} &amp;amp; \beta_A^{|0\rangle}\\ \beta_I^{|1\rangle} &amp;amp; \beta_A^{|1\rangle} \end{pmatrix}\begin{pmatrix} \langle I_{2\times 2} \rangle\ \\ \langle \sigma_A \rangle \end{pmatrix} &#xA;$$&lt;/span&gt;&#xA;where the parameters &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; tell us about the bias of our system and allow us to convert probabilities of the system being in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state to (unphysical) measurement expectations.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I took this from &lt;a href=&quot;http://web.mit.edu/francisc/www/SuperUROP_Spring_Poster.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this source (click).&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p&gt;I understand steps 1 and 2.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;I am very unclear as to what step 3 entails. That is, how one obtains any of the info in the equation of step 3? I understand that&#xA;we want to somehow use the matrix of coefficients &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; together&#xA;with the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_0,p_1$&lt;/span&gt; in order to estimate the rightmost&#xA;vector with the expectations?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;In order to do so, if this is the case, one needs the &lt;span class=&quot;math-container&quot;&gt;$p_0,p_1$&lt;/span&gt;&#xA;values. They are read from the IQ plane (if transmon or xmon are&#xA;used). But what about the &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; matrix? Where do its values come in&#xA;order to obtain what we really want, the expectation values of the&#xA;measurement operators?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;&lt;em&gt;Finally, having these expectation values, how do we proceed to&#xA;estimate the state? I.e., to do tomography?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="15676" LastEditorUserId="15408" LastEditDate="2021-05-10T13:46:54.020" LastActivityDate="2021-05-11T15:48:19.113" Title="Quantum State Tomography from IQ plane data" Tags="&lt;quantum-state&gt;&lt;machine-learning&gt;&lt;tomography&gt;&lt;quantum-process-tomography&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17423" PostTypeId="1" CreationDate="2021-05-10T12:12:55.700" Score="3" ViewCount="47" Body="&lt;p&gt;In Qiskit I can construct a computational basis statevector in the following fashion&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import Statevector&#xA;sv = Statevector.from_label('10')&#xA;print(sv.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which gives &lt;code&gt;[0.+0.j 0.+0.j 1.+0.j 0.+0.j]&lt;/code&gt; . If I have the data for a statevector in the computation basis, is there a built-in way to return a corresponding string? For &lt;code&gt;[0.+0.j 0.+0.j 1.+0.j 0.+0.j]&lt;/code&gt; I should get back &lt;code&gt;'10'&lt;/code&gt;. More generally, if the state is not in the computational basis it would be nice to get a linear combination of the basis states.&lt;/p&gt;&#xA;" OwnerUserId="15239" LastEditorUserId="15239" LastEditDate="2021-05-11T07:15:16.013" LastActivityDate="2021-05-11T18:04:44.970" Title="Inverse of Statevector.from_label in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="2" CommentCount="7" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17424" PostTypeId="2" ParentId="17423" CreationDate="2021-05-10T12:34:59.060" Score="3" Body="&lt;p&gt;You can just use the constructor of the Statevector class.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sv1 = Statevector.from_label('1010')  # construct Statevector from string label&#xA;&#xA;sv2 = Statevector(sv1.data)   # construct Statevector from numpy array&#xA;&#xA;sv1 == sv2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;returns &lt;code&gt;True&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="2503" LastEditorUserId="5955" LastEditDate="2021-05-10T15:44:12.113" LastActivityDate="2021-05-10T15:44:12.113" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17425" PostTypeId="1" AcceptedAnswerId="17426" CreationDate="2021-05-10T13:38:32.673" Score="3" ViewCount="44" Body="&lt;p&gt;If we have this given circuit:&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/q4mrV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/q4mrV.png&quot; alt=&quot;circuit 1&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&#xA;So the output for &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; will be: &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)$&lt;/span&gt;&lt;br /&gt;&#xA;And we have this given circuit:&lt;br /&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/vNu18.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/vNu18.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&#xA;What will be the output for &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and why?&lt;/p&gt;&#xA;" OwnerUserId="15785" LastEditorUserId="55" LastEditDate="2021-05-10T22:07:16.403" LastActivityDate="2021-05-10T22:07:16.403" Title="How does $|00\rangle$ evolve through an Hadamard and a CNOT gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17426" PostTypeId="2" ParentId="17425" CreationDate="2021-05-10T13:48:16.187" Score="3" Body="&lt;p&gt;The Hadamard gate is its own inverse. Hence, the two Hadamards on the first qubit cancel, leaving the control qubit in state &lt;span class=&quot;math-container&quot;&gt;$|0 \rangle$&lt;/span&gt;.&#xA;The bottom Hadamard gate will put the target qubit in the state &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} (|0\rangle + |1\rangle)$&lt;/span&gt;.&#xA;Since the control qubit is still in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, the CNOT will do nothing to the target. Your output state is therefore&#xA;&lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}} (|00\rangle + |01\rangle)$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15408" LastActivityDate="2021-05-10T13:48:16.187" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17427" PostTypeId="1" CreationDate="2021-05-10T15:28:44.023" Score="2" ViewCount="28" Body="&lt;p&gt;Say you have something like a general-coefficient &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit W-state, i.e.,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\equiv\sum_{j=1}^n a_j X_{j}|0\rangle^{\otimes n} \ ,&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$a_j$&lt;/span&gt; are normalized complex coefficients. Using &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$SWAP$&lt;/span&gt;, Toffoli gates and the like, how many gates do we need to change the superposition basis from the set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; Hamming weight &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; states to an arbitrary set of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; length-&lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; bitstrings?&lt;/p&gt;&#xA;&lt;p&gt;I have a feeling it's going to be exponentially large but I'm not sure.&lt;/p&gt;&#xA;" OwnerUserId="11516" LastEditorUserId="15408" LastEditDate="2021-05-10T18:20:26.770" LastActivityDate="2021-05-10T19:12:08.860" Title="Gate Cost to Transform Superposition of Hamming weight 1 states to superposition of arbitrary basis states?" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;&lt;superposition&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17428" PostTypeId="2" ParentId="17427" CreationDate="2021-05-10T19:06:31.273" Score="1" Body="&lt;p&gt;Split the problem into two phases: expansion and erasure.&lt;/p&gt;&#xA;&lt;p&gt;During the expansion phase, each input position &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt; is used as a control to set some output qubits to &lt;span class=&quot;math-container&quot;&gt;$f(k)$&lt;/span&gt;. Prepare your output qubits into the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. Then, for each input position &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;, for each output position &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, perform &lt;span class=&quot;math-container&quot;&gt;$CNOT_{in(k) \rightarrow out(b)}$&lt;/span&gt; if the &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; bit in &lt;span class=&quot;math-container&quot;&gt;$f(k)$&lt;/span&gt; is set. The hamming-weight-1 property makes this step very convenient, since each individual case has its own dedicated control.&lt;/p&gt;&#xA;&lt;p&gt;During the erasure phase you have to clear the input qubits by conditioning on the output. The simplest thing to do is to perform &lt;span class=&quot;math-container&quot;&gt;$X_k$&lt;/span&gt; conditioned on the output containing &lt;span class=&quot;math-container&quot;&gt;$f(k)$&lt;/span&gt;, and do this for each possible &lt;span class=&quot;math-container&quot;&gt;$k$&lt;/span&gt;. Note that each &lt;span class=&quot;math-container&quot;&gt;$f(k)$&lt;/span&gt; must be unique or the operation you're describing wouldn't be unitary.&lt;/p&gt;&#xA;&lt;p&gt;Once you've finished erasing the inputs, use swap gates to put the outputs where they're supposed to be.&lt;/p&gt;&#xA;&lt;p&gt;You can often make the erasure phase more efficient by using knowledge about &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;. For example, there may be some bits that you don't have to condition on or certain multi-bit expressions that you can compute once and then reuse several times.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;I have a feeling it's going to be exponentially large but I'm not sure.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The gate count is at most &lt;span class=&quot;math-container&quot;&gt;$O(nm)$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of input qubits and &lt;span class=&quot;math-container&quot;&gt;$m$&lt;/span&gt; is the number of output qubits.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-05-10T19:12:08.860" LastActivityDate="2021-05-10T19:12:08.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17430" PostTypeId="2" ParentId="17409" CreationDate="2021-05-10T21:15:27.270" Score="4" Body="&lt;p&gt;You are correct: the units must indeed match. If we take a standard evolution with unitary &lt;span class=&quot;math-container&quot;&gt;$U=\exp(-i H \theta)$&lt;/span&gt;, then the units of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; must match such that &lt;span class=&quot;math-container&quot;&gt;$H\theta$&lt;/span&gt; is unitless. For a pure state &lt;span class=&quot;math-container&quot;&gt;$\rho_\theta=U|\psi\rangle\langle\psi|U^{\dagger}$&lt;/span&gt; with unitary evolution, the quantum Fisher information takes the form &lt;span class=&quot;math-container&quot;&gt;$$F_Q[\psi,H]=\langle\psi|H^2|\psi\rangle-\langle\psi|H|\psi\rangle^2.$$&lt;/span&gt; The quantum Fisher information has the same units as &lt;span class=&quot;math-container&quot;&gt;$H^2$&lt;/span&gt;. We already know that &lt;span class=&quot;math-container&quot;&gt;$H\theta$&lt;/span&gt; is unitless: this implies that &lt;span class=&quot;math-container&quot;&gt;$H^2\theta^2$&lt;/span&gt; is also unitless, so the units in the quantum Cram'er-Rao bound work out just fine.&lt;/p&gt;&#xA;&lt;p&gt;This can all be extended to mixed states and arbitrary generators without any problem.&lt;/p&gt;&#xA;&lt;p&gt;The crucial point is realizing the conventions for the units when we write things like &lt;span class=&quot;math-container&quot;&gt;$\exp(-i H\theta)$&lt;/span&gt;. Does &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; have dimensions of time? Have we set &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; to unity? Are we measuring energy in terms &lt;span class=&quot;math-container&quot;&gt;$\hbar\omega$&lt;/span&gt; for some energy level? These are all crucial considerations. For example, the &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; in the Heisenberg limit is really saying something about energy squared, and that is related with &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; to time squared, so things will work out, but one must be careful about all of these details.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-10T21:15:27.270" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17431" PostTypeId="1" AcceptedAnswerId="17443" CreationDate="2021-05-10T22:22:42.260" Score="3" ViewCount="61" Body="&lt;p&gt;It is suggested in various sources that a possible approach to representing classical data as a quantum state is simply to take the binary sequence &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; and turn it to &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; (i.e., &amp;quot;basis embedding&amp;quot;). However, all of the implementations of quantum machine learning algorithms that I found use more complicated feature maps. Furthermore, according to the popular SVM paper of Havlicek et al, &amp;quot;To obtain an advantage over classical approaches we need to implement a map based on circuits that are hard to simulate classically&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, my questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Since the map that turns &lt;span class=&quot;math-container&quot;&gt;$|0...0\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; (for &lt;span class=&quot;math-container&quot;&gt;$x\in \{0,1\}^n$&lt;/span&gt;) can be implemented by a Clifford circuit, which can be efficiently simulated classically, does the above quote imply that no quantum advantage will be obtained by using it as our feature map? If not, then where's my mistake?&lt;/li&gt;&#xA;&lt;li&gt;Are there any examples in the literature of quantum machine learning algorithms that actually use basis embeddings?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15711" LastEditorUserId="13968" LastEditDate="2021-05-11T11:59:40.177" LastActivityDate="2021-05-11T11:59:40.177" Title="When and how do we use basis embedding?" Tags="&lt;simulation&gt;&lt;machine-learning&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17432" PostTypeId="5" CreationDate="2021-05-10T23:08:14.537" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-05-10T23:08:14.537" LastActivityDate="2021-05-10T23:08:14.537" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17433" PostTypeId="4" CreationDate="2021-05-10T23:08:14.537" Score="0" Body="A phase transition between different quantum phases (phases of matter at zero temperature). Contrary to classical phase transitions, quantum phase transitions can only be accessed by varying a physical parameter—such as magnetic field or pressure—at absolute zero temperature. The transition describes an abrupt change in the ground state of a many-body system due to its quantum fluctuations." OwnerUserId="13991" LastEditorUserId="2293" LastEditDate="2021-05-11T04:37:44.120" LastActivityDate="2021-05-11T04:37:44.120" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17434" PostTypeId="5" CreationDate="2021-05-10T23:10:56.077" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-05-10T23:10:56.077" LastActivityDate="2021-05-10T23:10:56.077" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17435" PostTypeId="4" CreationDate="2021-05-10T23:10:56.077" Score="0" Body="This tag is for questions seeking external references (books, articles, etc.) about a particular subject. Please do not use this as the only tag for a question." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-11T10:23:25.763" LastActivityDate="2021-05-11T10:23:25.763" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17436" PostTypeId="5" CreationDate="2021-05-10T23:12:11.970" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-05-10T23:12:11.970" LastActivityDate="2021-05-10T23:12:11.970" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17437" PostTypeId="4" CreationDate="2021-05-10T23:12:11.970" Score="0" Body="Quantum mechanics describes the microscopic properties of nature in a regime where classical mechanics no longer applies. It explains phenomena such as the wave-particle duality, quantization of energy, and the uncertainty principle and is generally used in single body systems." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-11T08:17:40.070" LastActivityDate="2021-05-11T08:17:40.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17438" PostTypeId="1" AcceptedAnswerId="17439" CreationDate="2021-05-11T00:39:18.153" Score="2" ViewCount="27" Body="&lt;p&gt;I have a Pauli channel with disjoint probabilities &lt;span class=&quot;math-container&quot;&gt;$P_I$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_X$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_Y$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_Z$&lt;/span&gt; (meaning &lt;span class=&quot;math-container&quot;&gt;$P_I + P_X + P_Y  + P_Z = 1$&lt;/span&gt;) corresponding to Pauli errors I, X, Y, Z. Is there some way apply this Pauli channel in Stim?&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="55" LastEditDate="2021-05-11T09:56:50.470" LastActivityDate="2021-05-11T14:42:34.193" Title="Performing a generic single-qubit Pauli error channel in stim" Tags="&lt;programming&gt;&lt;stim&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17439" PostTypeId="2" ParentId="17438" CreationDate="2021-05-11T00:39:18.153" Score="2" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$P_x = P_y = P_z$&lt;/span&gt; then &lt;code&gt;DEPOLARIZE1&lt;/code&gt; is what you need. If &lt;span class=&quot;math-container&quot;&gt;$P_y = P_z = 0$&lt;/span&gt; then &lt;code&gt;X_ERROR&lt;/code&gt; is what you need (ditto &lt;code&gt;Y_ERROR&lt;/code&gt;, &lt;code&gt;Z_ERROR&lt;/code&gt;). Otherwise you can use &lt;code&gt;CORRELATED_ERROR&lt;/code&gt; and &lt;code&gt;ELSE_CORRELATED_ERROR&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, suppose &lt;span class=&quot;math-container&quot;&gt;$P_x = 0.1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_y = 0.2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$P_z = 0.3$&lt;/span&gt; and your target is qubit &lt;span class=&quot;math-container&quot;&gt;$5$&lt;/span&gt;. You can do this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;CORRELATED_ERROR(0.1) X5&#xA;ELSE_CORRELATED_ERROR(0.22222222222) Y5  # note: P(Y|not X) = 20%/(100% - 10%)&#xA;ELSE_CORRELATED_ERROR(0.42857142857) Z5  # note: P(Z|not X and not Y) = 30%/(100% - 10% - 20%)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The else-case probabilities are conditioned on the earlier cases not happening, which is why they are larger than the original probabilities.&lt;/p&gt;&#xA;&lt;p&gt;Here's the general case, implemented as python code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;def append_generic_single_qubit_error_channel_to_circuit(&#xA;        circuit: stim.Circuit,&#xA;        target: int,&#xA;        px: float,&#xA;        py: float,&#xA;        pz: float):&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    Args:&#xA;        circuit: The circuit to append the error channel to.&#xA;        target: The qubit to hit with the error channel.&#xA;        px: The disjoint probability of an X error.&#xA;        py: The disjoint probability of a Y error.&#xA;        pz: The disjoint probability of a Z error.&#xA;&#xA;    Requires:&#xA;        0 &amp;lt;= px &amp;lt;= 1&#xA;        0 &amp;lt;= py &amp;lt;= 1&#xA;        0 &amp;lt;= pz &amp;lt;= 1&#xA;        px+py+pz &amp;lt;= 1&#xA;    &amp;quot;&amp;quot;&amp;quot;&#xA;    circuit.append_operation(&amp;quot;CORRELATED_ERROR&amp;quot;, [stim.target_x(target)], px)&#xA;    circuit.append_operation(&amp;quot;ELSE_CORRELATED_ERROR&amp;quot;, [stim.target_y(target)], py / (1 - px))&#xA;    circuit.append_operation(&amp;quot;ELSE_CORRELATED_ERROR&amp;quot;, [stim.target_z(target)], pz / (1 - px - py))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that it agrees with the example case:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import stim&#xA;c = stim.Circuit()&#xA;append_generic_single_qubit_error_channel_to_circuit(&#xA;    circuit=c, target=5, px=0.1, py=0.2, pz=0.3)&#xA;print(c)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code&gt;E(0.1) X5&#xA;ELSE_CORRELATED_ERROR(0.222222) Y5&#xA;ELSE_CORRELATED_ERROR(0.428571) Z5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;(&lt;code&gt;E&lt;/code&gt; is an abbreviation for &lt;code&gt;CORRELATED_ERROR&lt;/code&gt;)&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-05-11T14:42:34.193" LastActivityDate="2021-05-11T14:42:34.193" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17440" PostTypeId="2" ParentId="16484" CreationDate="2021-05-11T03:03:28.910" Score="0" Body="&lt;p&gt;The following answer to this question was given by Dmitrii Maslov in a private conversation.&lt;/p&gt;&#xA;&lt;p&gt;An improvement to the approach described in the original post can be made by noticing that the middle block of the circuit, containing two &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;s and the &lt;span class=&quot;math-container&quot;&gt;$R_z$&lt;/span&gt; rotation, is equivalent to the following circuit (which, in turn, is equivalent, up to a phase, to &lt;span class=&quot;math-container&quot;&gt;$\{Z_0^\alpha;Z_1^\alpha;CZ_{0,1}^{-2\alpha}\}$&lt;/span&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; ──■─────────────■──       ┌───────┐┌─────────┐          ┌─────────┐┌────────┐┌──────────┐         &#xA; ┌─┴─┐┌───────┐┌─┴─┐   =   ┤ RZ(α) ├┤ RY(π/2) ├──────────┤0        ├┤ RX(-3) ├┤ RY(-π/2) ├─────────&#xA; ┤ X ├┤ RZ(α) ├┤ X ├       ├───────┤├─────────┴┐┌───────┐│  RXX(α) │├────────┤├──────────┤┌───────┐&#xA; └───┘└───────┘└───┘       ┤ RZ(α) ├┤ RY(-π/2) ├┤ RZ(π) ├┤1        ├┤ RX(-3) ├┤ RY(-π/2) ├┤ RZ(π) ├&#xA;                           └───────┘└──────────┘└───────┘└─────────┘└────────┘└──────────┘└───────┘&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The advantage of this method is not not only in that it reduces the number of &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; gates by one. While all the &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; gates on the side have to be applied with the phase corresponding to the maximum entanglement (in order to reproduce &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;s), the construction above only produces maximum entanglement in the worst case scenario.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;NOTE: IN THE CIRCUIT ABOVE, I USED &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.RXXGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;QISKIT CONVENTION&lt;/a&gt; FOR THE &lt;span class=&quot;math-container&quot;&gt;$XX$&lt;/span&gt; GATE, I.E. MAXIMUM ENTANGLEMENT AT &lt;span class=&quot;math-container&quot;&gt;$\pi/2$&lt;/span&gt;. A MORE COMMON NOTATION IS HAVING MAXIMUM ENTANGLEMENT AT &lt;span class=&quot;math-container&quot;&gt;$\pi/4$&lt;/span&gt;, WHICH WOULD RESULT IN HAVING &lt;code&gt;RXX(2α)&lt;/code&gt; IN THE MIDDLE.&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="6313" LastActivityDate="2021-05-11T03:03:28.910" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17441" PostTypeId="1" AcceptedAnswerId="17442" CreationDate="2021-05-11T03:17:53.797" Score="1" ViewCount="57" Body="&lt;p&gt;here's the code I'm using to generate 3 quantum circuits with the same structure (They're only differed by the first U3 gate on the qubit):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;quancs = QuantumCircuit(1)  # Circ 1&#xA;quancs.u3(gamma,beta,delta,0)&#xA;        &#xA;quancs1 = QuantumCircuit(1) # Circ 2&#xA;quancs1.u3(2,3,2,0)         &#xA;quancs1.u3(gamma,beta,delta,0)&#xA;        &#xA;quancs2 = QuantumCircuit(1) # Circuit 3. &#xA;quancs2.u3(-2.5,2,-2,0)&#xA;quancs2.u3(gamma,beta,delta,0)&#xA;        &#xA;results = execute(quancs, simulator).result()&#xA;results1 = execute(quancs1, simulator).result()&#xA;results2 = execute(quancs2, simulator).result()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I treated the circuits separately to obtain the results. I'm wondering is there a way I can simplify/shorten this code? Thanks for the help!&lt;/p&gt;&#xA;" OwnerUserId="12334" LastEditorUserId="1859" LastEditDate="2021-05-11T10:20:23.970" LastActivityDate="2021-05-11T10:20:23.970" Title="Is there a way I can reduce the code for generating simple circuits with the same structure?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17442" PostTypeId="2" ParentId="17441" CreationDate="2021-05-11T03:38:28.973" Score="2" Body="&lt;p&gt;How about something like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.circuit import QuantumCircuit&#xA;def my_circuit(initial_gate_params, params):&#xA;    circuit = QuantumCircuit(1)&#xA;    circuit.u3(initial_gate_params[0],initial_gate_params[1],initial_gate_params[2],0)         &#xA;    circuit.u3(params[0], params[1], params[2], 0)&#xA;    return circuit &#xA;&#xA;&#xA;initial_gate_params = [ [0,0,0], [2,3,2], [-2.5,2,-2] ] #the params for your initial u3 gate&#xA;params = [gamma, beta, zeta] #your defined gamma, beta, zeta&#xA;&#xA;circuits = [my_circuit(i, params) for i in initial_gate_params ]&#xA;&#xA;from qiskit import Aer, execute&#xA;backend = Aer.get_backend('qasm_simulator')&#xA;results = execute(circuits, backend) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-11T03:38:28.973" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17443" PostTypeId="2" ParentId="17431" CreationDate="2021-05-11T06:43:48.670" Score="1" Body="&lt;p&gt;I'll denote &lt;span class=&quot;math-container&quot;&gt;$x=x_1\dots x_n \in \{0,1\}^n$&lt;/span&gt; as a vector containing binary values. Certainly you can prepare &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = X^{x_1} \otimes \cdots \otimes X^{x_n} |0\dots 0\rangle$&lt;/span&gt; easily, and it turns out that a quantum circuit trying to classify &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is also generally classically simulable since its entirely linear in elements of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. For completeness I'll justify this claim below before answering your questions.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To see this, consider a fairly general model for how one would learn about &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; using a quantum computer in a supervised learning setting - so assume that our data is actually datum-label pairs &lt;span class=&quot;math-container&quot;&gt;$\{(|x_i\rangle, y_i)\}$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$i=1\dots m$&lt;/span&gt;.. First, we process &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt; in some way using a parameterized unitary &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt;. Next, we perform a measurement to compute the expectation value of some Hermitian &lt;span class=&quot;math-container&quot;&gt;$W$&lt;/span&gt;. Finally, we use the information in &lt;span class=&quot;math-container&quot;&gt;$\langle W\rangle$&lt;/span&gt; to make a prediction &lt;span class=&quot;math-container&quot;&gt;$f(x_i)$&lt;/span&gt; for what &lt;span class=&quot;math-container&quot;&gt;$y_i$&lt;/span&gt; should be, and then try to minimize the average error in &lt;span class=&quot;math-container&quot;&gt;$f(x_i)$&lt;/span&gt;. In summary, attempt the optimization&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{1}&#xA;\min_\theta \sum_{i=1}^m \ell(f(x_i), y_i)&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; being some function of &lt;span class=&quot;math-container&quot;&gt;$\langle W \rangle$&lt;/span&gt;, a popular choice being:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{2}&#xA;f(x_i) = \text{sign}(\langle x_i | U(\theta)^\dagger W U(\theta)| x_i \rangle )&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This process is called &amp;quot;Empirical Risk Minimization&amp;quot; (ERM). Now examine (2) in a slightly different way: Instead of using &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle$&lt;/span&gt;, lets represent our state as &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle\langle x_i |$&lt;/span&gt;. This is a choice of representation and doesn't change the power of the classifier in any way. Furthermore, denote &lt;span class=&quot;math-container&quot;&gt;$W(\theta) \equiv  U(\theta)^\dagger W U(\theta)$&lt;/span&gt;, which is still Hermitian under the action of a unitary transformation. Now since &lt;span class=&quot;math-container&quot;&gt;$|x_i\rangle\langle x_i |$&lt;/span&gt; is also &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; Hermitian matrix we can now view &lt;span class=&quot;math-container&quot;&gt;$f(x_i)$&lt;/span&gt; as arising from an inner product&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$\langle \cdot, \cdot \rangle$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$\mathbb{C}^{2^n \times 2^n}$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\tag{3}&#xA;f(x_i) &amp;amp;= \text{sign}(\text{Tr}[| x_i \rangle\langle x_i | W(\theta)] ) \\&#xA;&amp;amp;\equiv \text{sign}(\langle W, |x_i\rangle \langle x_i|\rangle) &#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The term &lt;span class=&quot;math-container&quot;&gt;$\langle W, |x_i\rangle \langle x_i|\rangle$&lt;/span&gt; depends only linearly on the elements of &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt;, and so this classification rule is strictly linear. A classical algorithm could be trained to find the &lt;em&gt;classical&lt;/em&gt; vector &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$\text{sign}(\langle w, x_i\rangle)$&lt;/span&gt; minimizes Equation (1). Note that &lt;span class=&quot;math-container&quot;&gt;$w$&lt;/span&gt; will not necessarily be binary.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;does the above quote imply that no quantum advantage will be obtained by using it as our feature map?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I don't think this reasoning follows directly from using a Clifford circuit for embedding your data. But I'm sure (&lt;a href=&quot;https://arxiv.org/abs/1804.11326&quot; rel=&quot;nofollow noreferrer&quot;&gt;Havlicek, 2019&lt;/a&gt;) had something like the above linearity argument in mind. The power of your classifier &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; will be limited by your choice of feature map, and since the map &lt;span class=&quot;math-container&quot;&gt;$x \rightarrow |x\rangle$&lt;/span&gt; is linear in elements of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; then the result is a fairly weak classifier.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Are there any examples in the literature of quantum machine learning algorithms that actually use basis embeddings?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Sure, here's one: (&lt;a href=&quot;https://arxiv.org/abs/1607.00932&quot; rel=&quot;nofollow noreferrer&quot;&gt;Arunachalam, 2016&lt;/a&gt;). They show that a quantum machine learning algorithm based on this kind of encoding can have only a constant factor of improvement over a classical learner in sample complexity (how many patterns &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; you need to observe to &amp;quot;train&amp;quot; your model to be sufficiently accurate) in the PAC&lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt; setting. Or roughly speaking, quantum computers can't be made more efficient (in the number of samples needed) at learning about this data than classical computers in a general setting. Combined with the above demonstration that the quantum computers are also no more efficient in computational complexity this is probably enough evidence to discourage people from using this kind of embedding.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^1$&lt;/span&gt; Be careful - while we're dealing with inner products defined with respect to Hermitian matrices, that subspace of complex matrices isn't linear since its generally not closed under multiplication by elements of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{C}$&lt;/span&gt;. e.g. for Hermitian &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;,  &lt;span class=&quot;math-container&quot;&gt;$iH$&lt;/span&gt; is generally not Hermitian.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$^2$&lt;/span&gt; &lt;strong&gt;P&lt;/strong&gt;robably &lt;strong&gt;A&lt;/strong&gt;pproximately &lt;strong&gt;C&lt;/strong&gt;orrect learning just means finding a classifier has at least &lt;span class=&quot;math-container&quot;&gt;$1-\delta$&lt;/span&gt; probability of classifying the data with less than &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; error, and the associated sample complexity is the number of training points needed for ERM to achieve these conditions. I'm omitting some other strict assumptions usually used in the PAC setting that you can find in standard texts on this subject.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-05-11T06:43:48.670" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17444" PostTypeId="1" CreationDate="2021-05-11T07:56:45.433" Score="1" ViewCount="30" Body="&lt;p&gt;I am in a study group learning about quantum computing using O'Reilly - Programming Quantum Computing. I'm a developer, not a physicist. :) I feel like my question is rudimentary but I can't seem to find an answer here or anywhere else.&lt;/p&gt;&#xA;&lt;p&gt;I'm confused on the Swap test; why it works and why doesn't it affect the qubits being swapped.  Not the physics behind why the measurements diverge or approach |1&amp;gt;, but rather why the condition qubit of the cswap operation is altered at all.&lt;/p&gt;&#xA;&lt;p&gt;I understand the cswap operation swaps two qubits based on a condition qubit.  You might say the condition qubit has an &lt;em&gt;influence&lt;/em&gt; on the swapped qubits.&lt;/p&gt;&#xA;&lt;p&gt;However, a Swap Test shows that the condition qubit itself will be changed based on how closely the target qubits are equal. How do the swapped qubits have any influence back on the condition qubit? And furthermore, during the swap test aren't we potentially swapping the qubits? Should we be swapping them back so that our test doesn't actually change the state of the target qubits?&lt;/p&gt;&#xA;" OwnerUserId="15823" LastEditorUserId="55" LastEditDate="2021-05-11T10:50:49.287" LastActivityDate="2021-05-11T10:50:49.287" Title="In a Swap Test why is the control qubit influenced and aren't the target qubits altered?" Tags="&lt;algorithm&gt;&lt;quantum-circuit&gt;&lt;swap-test&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17445" PostTypeId="2" ParentId="17444" CreationDate="2021-05-11T08:21:21.953" Score="1" Body="&lt;p&gt;Deciding which qubit is a source and which is a target and changes depends on a basis. In a basis-independent sense, the qubits get entangled, and it affects both sides. In a swap test you apply Hadamard gate to the control qubit which can be interpreted as a change of basis, and subsequent CSWAP gate changes the control qubit&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="2105" LastEditDate="2021-05-11T08:32:24.840" LastActivityDate="2021-05-11T08:32:24.840" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17446" PostTypeId="1" CreationDate="2021-05-11T12:50:36.390" Score="5" ViewCount="56" Body="&lt;p&gt;Consider a simple two-qubit gate such as the CNOT. The typical presentation of this gate is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{CNOT} = |0\rangle\!\langle0|\otimes I + |1\rangle\!\langle1|\otimes X,$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; the Pauli &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate. This gate can also be written reversing the role of control and target, as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\text{CNOT} = I\otimes |+\rangle\!\langle+| + Z\otimes |-\rangle\!\langle-|.$$&lt;/span&gt;&#xA;Is this sort of trick a general feature of unitary gates which have a &amp;quot;control-target structure&amp;quot; (that is, unitaries acting on a bipartite space which are block-diagonal in some basis)?&#xA;More precisely, consider a generic unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal U:\mathcal H_A\otimes\mathcal H_B\to\mathcal H_A\otimes\mathcal H_B$&lt;/span&gt; which has the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal U = \sum_i |u_i\rangle\!\langle u_i|\otimes U_i,$$&lt;/span&gt;&#xA;for some orthonormal set &lt;span class=&quot;math-container&quot;&gt;$\{|u_i\rangle\}_i\in\mathcal H_A$&lt;/span&gt; and collection of unitaries &lt;span class=&quot;math-container&quot;&gt;$\{U_i\}_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is there always a set of orthonormal vectors &lt;span class=&quot;math-container&quot;&gt;$\{|v_j\rangle\}_j\subset\mathcal H_B$&lt;/span&gt; and collection of unitaries &lt;span class=&quot;math-container&quot;&gt;$\{V_j\}_j$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal U = \sum_j V_j\otimes |v_j\rangle\!\langle v_j|$$&lt;/span&gt;&#xA;also holds?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;This question is closely related to &lt;em&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/10014/55&quot;&gt;General approach for switching control and target qubit&lt;/a&gt;&lt;/em&gt;, albeit here I'm focusing on a more general case.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-12T14:23:52.093" Title="Can any &quot;control-something unitary&quot; be written with control and target spaces flipped?" Tags="&lt;circuit-construction&gt;&lt;unitarity&gt;" AnswerCount="2" CommentCount="5" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17447" PostTypeId="2" ParentId="17446" CreationDate="2021-05-11T13:20:21.067" Score="2" Body="&lt;p&gt;Something I realised while writing the question:&lt;/p&gt;&#xA;&lt;p&gt;This is possible whenever the gates &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; are &lt;em&gt;simultaneously diagonalisable&lt;/em&gt;. Indeed, suppose this is the case, and we can thus write the eigendecompositions of the &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt; as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$U_i = \sum_j \lambda_{ij} |x_j\rangle\!\langle x_j|,$$&lt;/span&gt;&#xA;for some basis &lt;span class=&quot;math-container&quot;&gt;$\{|x_j\rangle\}_j$&lt;/span&gt; (that is equal for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;), and with &lt;span class=&quot;math-container&quot;&gt;$\{\lambda_{ij}\}_j$&lt;/span&gt; the eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$U_i$&lt;/span&gt;. These must therefore all be such that &lt;span class=&quot;math-container&quot;&gt;$|\lambda_{ij}|=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We then have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_i |u_i\rangle\!\langle u_i| \otimes U_i &#xA;= \sum_{ij} |u_i\rangle\!\langle u_i| \otimes \lambda_{ij} |x_j\rangle\!\langle x_j|&#xA;= \sum_j \left(\sum_i \lambda_{ij} |u_i\rangle\!\langle u_i|\right) \otimes |x_j\rangle\!\langle x_j|.$$&lt;/span&gt;&#xA;We can therefore define &lt;span class=&quot;math-container&quot;&gt;$V_j\equiv \sum_i \lambda_{ij} |u_i\rangle\!\langle u_i|$&lt;/span&gt;, and obtain a new set of unitaries which are &amp;quot;controlled&amp;quot;, with the (orthonormal) states &lt;span class=&quot;math-container&quot;&gt;$|x_j\rangle$&lt;/span&gt; acting as controls.&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure whether this condition is also necessary though.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-12T14:23:52.093" LastActivityDate="2021-05-12T14:23:52.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17448" PostTypeId="5" CreationDate="2021-05-11T15:25:02.607" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-05-11T15:25:02.607" LastActivityDate="2021-05-11T15:25:02.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17449" PostTypeId="4" CreationDate="2021-05-11T15:25:02.607" Score="0" Body="For questions related to the &quot;Swap test&quot;: a quantum algorithm whose purpose is to quantify the distance between two given quantum states." OwnerUserId="13991" LastEditorUserId="55" LastEditDate="2021-05-12T09:45:01.093" LastActivityDate="2021-05-12T09:45:01.093" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17450" PostTypeId="2" ParentId="17422" CreationDate="2021-05-11T15:48:19.113" Score="1" Body="&lt;p&gt;We know what a measurement of a particular operator should yield: measuring &lt;span class=&quot;math-container&quot;&gt;$\sigma_A$&lt;/span&gt; should yield the value &lt;span class=&quot;math-container&quot;&gt;$\langle\sigma_A\rangle$&lt;/span&gt;, and measuring &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; should yield 1. Now, I assume the quoted protocol actually measures overlaps with the various eigenstates of the operators, and that &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt; are the probabilities of being in the &lt;span class=&quot;math-container&quot;&gt;$+$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-$&lt;/span&gt; eigenstates of the various operators...&lt;/p&gt;&#xA;&lt;p&gt;Measuring in the &lt;span class=&quot;math-container&quot;&gt;$z$&lt;/span&gt; basis, with eigenstates &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, we expect the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_0=(1+\langle\sigma_z\rangle)/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$p_1=(1-\langle\sigma_z\rangle)/2$&lt;/span&gt;. Similar results will hold in the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$y$&lt;/span&gt; basis, if we consider overlaps with the eigenstates such as &lt;span class=&quot;math-container&quot;&gt;$|\pm x\rangle=(|0\rangle\pm|1\rangle)/\sqrt{2}$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{0}^{basis \,A}=\frac{1+\langle\sigma_A\rangle}{2}\quad \mathrm{and}\quad p_{1}^{basis \,A}=\frac{1-\langle\sigma_A\rangle}{2}.$$&lt;/span&gt; This is what we expect from tomography: do a few different measurements, get some probabilities that depend on the state in question. One we know all of these probabilities, we can immediately infer the values of &lt;span class=&quot;math-container&quot;&gt;$\langle\sigma_A\rangle$&lt;/span&gt;, which uniquely determine the values of &lt;span class=&quot;math-container&quot;&gt;$a_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$a_1$&lt;/span&gt; up to a global phase.&lt;/p&gt;&#xA;&lt;p&gt;Now, in a perfect world, the above description implies that, for all &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$$\begin{pmatrix}\beta_{I}^{|0\rangle}  &amp;amp; \beta_{A}^{|0\rangle} \\ \beta_{I}^{|1\rangle} &amp;amp; \beta_{A}^{|1\rangle}\end{pmatrix}=\frac{1}{2}\begin{pmatrix}1&amp;amp;1\\1&amp;amp;-1\end{pmatrix}.$$&lt;/span&gt; However, there may be biases in the measurement device, for example always adding a little bit to &lt;span class=&quot;math-container&quot;&gt;$p_0$&lt;/span&gt; and subtracting a little bit from &lt;span class=&quot;math-container&quot;&gt;$p_1$&lt;/span&gt;. This implies that the &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; matrix must change in order to properly relate the measured values to the actual parameters of the state. By measuring the probabilities &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; in the various bases, one can guess what the parameters of the state must be, and by finding biases in the measurements, one can define the true relation between the measurements and the state parameters.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-11T15:48:19.113" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17451" PostTypeId="1" AcceptedAnswerId="17468" CreationDate="2021-05-11T16:22:15.283" Score="1" ViewCount="26" Body="&lt;p&gt;We can say that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X (\cos \frac{\theta}{2} |0\rangle + e^{i \phi}\sin \frac{\theta}{2} |1\rangle) = \cos \frac{\pi-\theta}{2} |0\rangle + e^{-i \phi}\sin \frac{\pi-\theta}{2} |1\rangle$&lt;/span&gt;,&lt;/p&gt;&#xA;&lt;p&gt;a fact that can be derived by multiplying the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix and the state vector and using angle identities:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$X (\cos \frac{\theta}{2} |0\rangle + e^{i \phi}\sin \frac{\theta}{2} |1\rangle) = e^{i \phi}\sin \frac{\theta}{2} |0\rangle + \cos \frac{\theta}{2} |1\rangle = e^{i \phi}\cos \frac{\pi - \theta}{2} |0\rangle + \sin \frac{\pi - \theta}{2} |1\rangle = \cos \frac{\pi-\theta}{2} |0\rangle + e^{-i \phi}\sin \frac{\pi-\theta}{2} |1\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is there a writeup somewhere or a standard way to derive this identity for other gates, i.e. &lt;span class=&quot;math-container&quot;&gt;$Y, Z, H, \sqrt{Y}$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="14768" LastEditorUserId="13991" LastEditDate="2021-05-11T18:55:06.340" LastActivityDate="2021-05-12T07:13:26.273" Title="Quantum gates with respect to phase angles" Tags="&lt;quantum-gate&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-05-17T22:52:50.207" ContentLicense="CC BY-SA 4.0" />
  <row Id="17452" PostTypeId="2" ParentId="17423" CreationDate="2021-05-11T16:58:32.383" Score="1" Body="&lt;p&gt;The output is a bit ugly but I think basically does what you want:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.quantum_info import random_statevector&#xA;sv = random_statevector(4)&#xA;&#xA;&#xA;s = &amp;quot;&amp;quot;&#xA;for state, amp in enumerate(sv.data):&#xA;    if not np.isclose(amp, 0):&#xA;        s += f&amp;quot;+ ({amp:.2f})|{state:0{sv.num_qubits}b}⟩ &amp;quot;&#xA;print(s)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;+ (0.34-0.22j)|00⟩ + (-0.53-0.34j)|01⟩ + (0.43-0.24j)|10⟩ + (-0.12-0.42j)|11⟩ &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can make this smarter and neater if you need.&lt;/p&gt;&#xA;" OwnerUserId="10415" LastEditorUserId="10415" LastEditDate="2021-05-11T18:04:44.970" LastActivityDate="2021-05-11T18:04:44.970" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17453" PostTypeId="1" CreationDate="2021-05-11T17:21:29.077" Score="0" ViewCount="47" Body="&lt;p&gt;If I have a circuit with 3 qubits and repeated gates as follow:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circ = QuantumCircuit(3, 3)&#xA;for i in range(100):&#xA;    # some gates, details is not important &#xA;    circ.rx(0.1, 0)&#xA;    circ.ry(0.1, 1)&#xA;    circ.ccx(0,1,2)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Clearly the repeated gates will be transpiled (and uploaded to IBMQ via Internet) 100 times. How can I change the code so that the repeated part only need to be transpiled (and uploaded) one time?&lt;/p&gt;&#xA;" OwnerUserId="15836" LastEditorUserId="13991" LastEditDate="2021-05-11T18:53:47.390" LastActivityDate="2021-05-11T18:53:47.390" Title="How to simplify a circuit with repeated same parts?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17454" PostTypeId="1" CreationDate="2021-05-11T18:03:12.207" Score="2" ViewCount="90" Body="&lt;p&gt;This is a question desguised as a rant. There is a similar question here, &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2110/whats-the-point-of-grovers-algorithm-if-we-have-to-search-the-list-of-elements&quot;&gt;What's the point of Grover's algorithm if we have to search the list of elements to build the oracle?&lt;/a&gt;, but the answers have not helped me much.&lt;/p&gt;&#xA;&lt;p&gt;I have seen a few explanations of Grover's algorithm. I do not understand it, and the problem is not the mathematics. The story told by the sources is: given states &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;, there is an operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; such that you apply it so many times to &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and the result is &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Surely the point of the algorithm is not to turn &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;, is it?&lt;/p&gt;&#xA;&lt;p&gt;If it is, then it should be called Grover's transformation, not Grover's search. And for that I have a much simpler algorithm: just apply the operator &lt;span class=&quot;math-container&quot;&gt;$\frac{|x\rangle\langle x|}{\langle x|\psi\rangle}$&lt;/span&gt; (it requires a single run and works with 100% efficiency). Why is this not acceptable?&lt;/p&gt;&#xA;&lt;p&gt;I have seen an analogy with phones. Suppose you want to find out who owns a particular phone number. Classically you must search the entire phone book (this analogy is getting out of touch with reality, but never mind that for the moment). Fine. So in the quantum setting I suppose you might have the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; which is your phone book, written in terms of energy eigenstates as &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\frac{1}{\sqrt{N}}\sum_i|\phi_i\rangle$&lt;/span&gt;, and you might ask &amp;quot;who is the state in there with energy &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt;?&amp;quot;, and the answer should be &lt;span class=&quot;math-container&quot;&gt;$\phi_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But if I must know &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; in order to build the Grover operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then I see no point. Can I create &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; without knowing &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; beforehand?&lt;/p&gt;&#xA;" OwnerUserId="15837" LastEditorUserId="13991" LastEditDate="2021-05-11T18:52:36.713" LastActivityDate="2021-05-13T00:51:35.320" Title="What is the point of Grover's algorithm, really?" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17455" PostTypeId="2" ParentId="17454" CreationDate="2021-05-11T18:47:04.683" Score="3" Body="&lt;p&gt;The point is indeed to &amp;quot;turn &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;&amp;quot;. More precisely, the point is to transform a given &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into some (unknown) state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; which is defined as satisfying some properties (&lt;em&gt;i.e.&lt;/em&gt; it is &amp;quot;marked&amp;quot; by some oracle).&#xA;Even more precisely, the point is to transform &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; into some state which, when measured, gives you a string that with good probability is the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; which solves whatever problem you are facing.&lt;/p&gt;&#xA;&lt;p&gt;You can call it &amp;quot;Grover's transformation&amp;quot; if you wish. It is indeed a &amp;quot;transformation&amp;quot;; but then again, any algorithm is a transformation in the same sense.&#xA;It makes sense to call it a &amp;quot;search algorithm&amp;quot; when you think about the result it gives you. If you use it to, say, find the solution to some &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_satisfiability_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;SAT problem&lt;/a&gt;, it gives you as answer some string that satisfies specific properties. You can think of these questions as more complex versions of something like &amp;quot;&lt;em&gt;find the 3-bit string such that the sum of the first two bits is 0&lt;/em&gt;&amp;quot;. This looks very much like a &amp;quot;search&amp;quot; to me.&lt;/p&gt;&#xA;&lt;p&gt;Note that the solution to the &amp;quot;search&amp;quot; is obtained when you &lt;em&gt;measure&lt;/em&gt; the final state, and thus obtain a classical string out of it. In other words, the &amp;quot;state transformation&amp;quot; part of the algorithm is such that the state it gives you, when measured, encodes the solution to the search problem.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Why not just apply the operator &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\!\langle x|$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;That would be useless. &amp;quot;Applying the operator &lt;span class=&quot;math-container&quot;&gt;$|x\rangle\!\langle x|$&lt;/span&gt;&amp;quot; means to measure the state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; in some measurement basis containing &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt;. This amounts to asking the question &amp;quot;what is the probability that the initial state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is found in the state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; (assuming some suitable choice of measurement basis)?&amp;quot;. That's not what you want. The goal is to &lt;em&gt;find&lt;/em&gt; an &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x)=1$&lt;/span&gt; for some given function &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; (called the &amp;quot;oracle&amp;quot; in this context). You &lt;em&gt;do not&lt;/em&gt; know what this &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; is, otherwise you'd already know the solution to the problem.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;But if I must know &lt;span class=&quot;math-container&quot;&gt;$|ϕ_i⟩$&lt;/span&gt; in order to build the Grover operator &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, then I see no point. Can I create &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; without knowing &lt;span class=&quot;math-container&quot;&gt;$|ϕ_i⟩$&lt;/span&gt; beforehand?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes, that's the point. The oracle encodes the &lt;em&gt;constraints&lt;/em&gt; that you want the solution to satisfy, not the solution itself.&lt;/p&gt;&#xA;&lt;p&gt;If I tell you to find the needle in the haystack, do you know beforehand where the needle is? No, you know that you need to search through many locations until you find the location containing the needle. It's the same thing: in this analogy, each &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is a position potentially containing the needle, and the oracle is the function that checks whether a given position contains the needle.&lt;/p&gt;&#xA;&lt;p&gt;This has been discussed multiple times in the site, see &lt;em&gt;e.g.&lt;/em&gt; &lt;em&gt;&lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/1419/55&quot;&gt;Does the oracle in Grover&amp;#39;s algorithm need to contain information about the entirety of the database?&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-11T19:08:49.973" LastActivityDate="2021-05-11T19:08:49.973" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17456" PostTypeId="2" ParentId="17454" CreationDate="2021-05-11T19:50:09.923" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Can I create &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; without knowing &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; beforehand?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Yes. For example, you could write down a sudoko grid with a few random hints, define &lt;span class=&quot;math-container&quot;&gt;$|\phi_i\rangle$&lt;/span&gt; to be any solution (if one exists), and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; could check if a given filling of the grid is a solution matching the hints.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-11T19:50:09.923" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17457" PostTypeId="1" AcceptedAnswerId="17466" CreationDate="2021-05-11T21:45:36.003" Score="4" ViewCount="48" Body="&lt;p&gt;Based on my limited and poor understanding, a quantum circuit in the &amp;quot;one clean qubit&amp;quot; model of quantum computation generally acts on a single pure (clean) qubit tensored with &lt;span class=&quot;math-container&quot;&gt;$n-1$&lt;/span&gt; qubits in a maximally mixed state.  The clean qubit can serve as a control to apply an arbitrary unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; to the maximally mixed qubits, and measuring this clean qubit in the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis enables characterizations of some properties of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (such as its real and imaginary trace, which is likely classically difficult.)&lt;/p&gt;&#xA;&lt;p&gt;I was inspired to consider the one clean qubit model of computation by a recent (2021) video of &lt;a href=&quot;https://www.youtube.com/watch?v=4RTxJ_I9LtU&amp;amp;t=2s&quot; rel=&quot;nofollow noreferrer&quot;&gt;Yoganovan&lt;/a&gt; on her &amp;quot;Looking Glass Universe&amp;quot; channel, wherein she describes and summarizes the &lt;a href=&quot;https://arxiv.org/abs/1907.08224&quot; rel=&quot;nofollow noreferrer&quot;&gt;approach&lt;/a&gt; she and her colleagues took to answering an open problem on the power of such a model in the absence of entanglement.  The headline is that the one clean qubit model without entanglement is classically tractable.&lt;/p&gt;&#xA;&lt;p&gt;But as I begin to study their paper, it's not quite clear to me what's even meant by the one clean qubit model with and without entanglement.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What, in particular, is and is not entangled in the one clean qubit model?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The pure qubit would be entangled with mixed qubits after application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, right?  Or am I wrong, and even after the controlled application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; the clean qubit need not be entangled with/is separable from the mixed qubits?  If so, what is entangled in the simple circuit in the Wikipedia &lt;a href=&quot;https://en.wikipedia.org/wiki/One_Clean_Qubit&quot; rel=&quot;nofollow noreferrer&quot;&gt;article&lt;/a&gt;?&lt;/p&gt;&#xA;&lt;p&gt;EDIT: I am wrong!  While nonetheless carrying in its amplitude some properties of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; (the real/imaginary trace), the clean qubit is never entangled with the other qubits after application of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, no matter what &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is,&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-05-12T13:48:08.933" LastActivityDate="2021-05-12T13:48:08.933" Title="Where is entanglement present and absent in the one clean qubit model of computation?" Tags="&lt;entanglement&gt;&lt;models&gt;&lt;terminology&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17458" PostTypeId="1" CreationDate="2021-05-12T01:30:39.137" Score="1" ViewCount="86" Body="&lt;p&gt;I'm trying to answer the following question about the BB84 protocol from Nielsen and Chuang's Introduction to Quantum Information.&#xA;&lt;img src=&quot;https://i.imgur.com/2lQatOP.png&quot; alt=&quot;Notfound&quot; /&gt;&lt;/p&gt;&#xA;&lt;p&gt;As I understand it, the string &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; is determining whether we are measuring in the computational basis or the Hadamard basis. I decided to test the claim in the question with an example.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\vert\phi\rangle = \alpha \vert 0 \rangle + \beta \vert 1\rangle$&lt;/span&gt; and assume we are measuring in the &lt;span class=&quot;math-container&quot;&gt;$\{\vert - \rangle, \vert + \rangle\}$&lt;/span&gt; basis. That means our measurement is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\vert - \rangle \langle - \vert + \vert + \rangle \langle + \vert)\vert \phi \rangle = \frac{\alpha}{\sqrt{2}}\vert 0 \rangle + \frac{\beta}{\sqrt{2}}\vert 1 \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To me this is clearly wrong. Not only does it suggest we can figure something out about the state which &lt;span class=&quot;math-container&quot;&gt;$\vert \phi \rangle$&lt;/span&gt; was prepared in, but we don't even have that &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}(\alpha + \beta) = 1$&lt;/span&gt;. Could I have guidance as to what I am doing incorrectly, or pointers about how to go about this proof?&lt;/p&gt;&#xA;&lt;p&gt;EDIT: Applying these projections yields&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{\alpha + \beta}{\sqrt{2}}\vert + \rangle + \frac{\alpha - \beta}{\sqrt{2}}\vert - \rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can take probabilities like &lt;span class=&quot;math-container&quot;&gt;$|\langle + \vert \phi \rangle|^{2}$&lt;/span&gt;, and I am still unsure how to prove that they are uncorrelated.&lt;/p&gt;&#xA;&lt;p&gt;EDIT2: I have a solution and will update it soon.&lt;/p&gt;&#xA;" OwnerUserId="15839" LastEditorUserId="55" LastEditDate="2021-05-13T17:36:41.083" LastActivityDate="2021-05-17T18:58:46.070" Title="Show when $a_k$ and $b_k$ are correlated when measuring in different bases, in the BB84 protocol" Tags="&lt;measurement&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;cryptography&gt;&lt;bb84&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17459" PostTypeId="1" CreationDate="2021-05-12T01:33:34.173" Score="1" ViewCount="28" Body="&lt;p&gt;Im trying to put the QFT circuit in my qiskit circuit but im having trouble:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;# Importing standard Qiskit libraries&#xA;from qiskit import QuantumCircuit, transpile, Aer, IBMQ&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from ibm_quantum_widgets import *&#xA;from math import sqrt&#xA;from qiskit.quantum_info import DensityMatrix&#xA;from qiskit.circuit.library import QFT&#xA;&#xA;# Loading your IBM Q account(s)&#xA;provider = IBMQ.load_account()&#xA;&#xA;qc = QuantumCircuit(1,1)&#xA;&#xA;init = [sqrt(3/4),-sqrt(1/4)]&#xA;qc.initialize(init,0)&#xA;qc.h(0)&#xA;qc.x(0)&#xA;qc.h(0)&#xA;qc.QFT(0)&#xA;&#xA;display(qc.draw())&#xA;&#xA;&#xA;s0 = DensityMatrix(qc)&#xA;sim = Aer.get_backend('unitary_simulator')&#xA;job = transpile(qc,sim)&#xA;state = sim.run(job).result().get_unitary()&#xA;print(qc.qasm())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15595" LastEditorUserId="55" LastEditDate="2021-05-12T15:45:09.910" LastActivityDate="2021-05-12T15:45:09.910" Title="How to import circuit libraries into qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17460" PostTypeId="2" ParentId="17459" CreationDate="2021-05-12T02:14:12.170" Score="1" Body="&lt;p&gt;The way you imported the packages, including the &lt;code&gt;QFT&lt;/code&gt; circuit is correct. You just didn't execute it correctly.&lt;/p&gt;&#xA;&lt;p&gt;When you call &lt;code&gt;QFT&lt;/code&gt;, it creates a circuit that perform QFT on its own. To add this circuit to your original circuit, you can just use &lt;code&gt;+&lt;/code&gt;. Also the to perform a QFT on 1 qubit, you should use &lt;code&gt;QFT(1)&lt;/code&gt; instead of &lt;code&gt;QFT(0)&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So your circuit without QFT is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1,1)&#xA;&#xA;init = [sqrt(3/4),-sqrt(1/4)]&#xA;qc.initialize(init,0)&#xA;qc.h(0)&#xA;qc.x(0)&#xA;qc.h(0)&#xA;display(qc.draw())&#xA;     ┌──────────────────────────┐┌───┐┌───┐┌───┐&#xA;q_0: ┤ initialize(0.86603,-0.5) ├┤ H ├┤ X ├┤ H ├&#xA;     └──────────────────────────┘└───┘└───┘└───┘&#xA;c: 1/═══════════════════════════════════════════&#xA;                                                &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now to add on the 1-qubit &lt;em&gt;QFT&lt;/em&gt; operation which is just the &lt;strong&gt;Hadamard gate&lt;/strong&gt;, you can do it as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc = QuantumCircuit(1,1)&#xA;init = [sqrt(3/4),-sqrt(1/4)]&#xA;qc.initialize(init,0)&#xA;qc.h(0)&#xA;qc.x(0)&#xA;qc.h(0)&#xA;qc = qc + QFT(1)&#xA;display( qc.draw() )&#xA;&#xA;     ┌──────────────────────────┐┌───┐┌───┐┌───┐┌───┐&#xA;q_0: ┤ initialize(0.86603,-0.5) ├┤ H ├┤ X ├┤ H ├┤ H ├&#xA;     └──────────────────────────┘└───┘└───┘└───┘└───┘&#xA;c: 1/════════════════════════════════════════════════&#xA;                                                     &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As you can see, the Hadamard gate is now added to the circuit.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-12T02:14:12.170" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17461" PostTypeId="1" AcceptedAnswerId="17469" CreationDate="2021-05-12T02:54:26.527" Score="2" ViewCount="47" Body="&lt;p&gt;There are various options for error correction. For example, the Shore code or a whole class of surface codes.&lt;/p&gt;&#xA;&lt;p&gt;But I don't really understand at what level they should be implemented.&lt;/p&gt;&#xA;&lt;p&gt;For example, I have any circuit that implements an algorithm that requires 3 qubits. A quantum computer has at least 27 qubits.&#xA;Therefore, I can use the Shore code to correct errors, because the 9-qubit Shore code corrects any errors.&lt;/p&gt;&#xA;&lt;p&gt;To start correcting the errors, I need to allocate 3 logical qubits at the upper level (the level of creating the algorithm) and 27 physical qubits at the lower level.&lt;/p&gt;&#xA;&lt;p&gt;Thus, after each operation (for example, after operation H) on one logical qubit, I have to insert an implementation of the Shore code. Do I understand correctly? But won't it create a lot more errors (because every statement has an error)?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/t3ZP9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/t3ZP9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l7aFj.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l7aFj.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15573" LastActivityDate="2021-05-12T07:18:29.633" Title="Who is responsible for implementing quantum error correction?" Tags="&lt;ibm-q-experience&gt;&lt;error-correction&gt;&lt;shors-algorithm&gt;&lt;ibm&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17462" PostTypeId="2" ParentId="17446" CreationDate="2021-05-12T02:59:58.927" Score="1" Body="&lt;p&gt;Yes, you can always do this. E.g. see this blog post: &lt;a href=&quot;https://algassert.com/post/1706&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://algassert.com/post/1706&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose you have two simultaneously diagonalizable unitary operations &lt;span class=&quot;math-container&quot;&gt;$A = \sum_k a_k |\lambda_k\rangle\langle \lambda_k|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B = \sum_k b_k |\lambda_k\rangle\langle \lambda_k|$&lt;/span&gt;. For example, if they operate on different qubits then this property is met. Let the &amp;quot;control product&amp;quot; of the two operations be the result of multiplying them in log space (this corresponds to pairwise multiplying the angles of the two operations' eigenvalues, rescaled so that 180 degrees is the identity angle):&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{Control}(A, B) = \exp\left(\frac{\ln(A) \ln(B)}{i \pi}\right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you set &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to a Pauli &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; operation, this corresponds to controlling &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;'s target. E.g. note that &lt;span class=&quot;math-container&quot;&gt;$\text{Control}(Z_1, X_2) = \text{CNOT}_{1,2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{Control}(Z_1, Z_2) = \text{CZ}_{1,2}$&lt;/span&gt;. So the control product actually generalizes the notion of controlling to things beyond &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; controls, since you can set &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; to things besides &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Anyways, note that the definition is completely symmetric. &lt;span class=&quot;math-container&quot;&gt;$\text{Control}(A, B) = \text{Control}(B, A)$&lt;/span&gt;. Therefore there's no fundamental distinction between the control and the target. This is one of the ways to see why phase kickback occurs: the phase kickback from applying &lt;span class=&quot;math-container&quot;&gt;$\text{Control}(Z, U)$&lt;/span&gt; is due to the Z &amp;quot;being controlled by the U&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-05-12T03:06:55.647" LastActivityDate="2021-05-12T03:06:55.647" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="17463" PostTypeId="2" ParentId="17458" CreationDate="2021-05-12T03:08:00.040" Score="-1" Body="&lt;p&gt;If you measure a qubit &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$\{\vert - \rangle, \vert + \rangle\}$&lt;/span&gt; basis, you get either &lt;span class=&quot;math-container&quot;&gt;$\{|+ \rangle\}$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\langle+|\psi\rangle|^2$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$\{|- \rangle\}$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|\langle-|\psi\rangle|^2$&lt;/span&gt;. The projectors are indeed &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle+|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle\langle-|$&lt;/span&gt; but you should use them right.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;PS:&lt;/p&gt;&#xA;&lt;p&gt;About projectors on state:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Projector is a Hermitian operator having 2 eigenvalues, 1 and 0. For example, projector  &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle+|$&lt;/span&gt; have eigenstates &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; with eigenvalue 1 and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; with eigenvalue 0.&lt;/li&gt;&#xA;&lt;li&gt;We call &lt;span class=&quot;math-container&quot;&gt;$\hat{P}$&lt;/span&gt; projector on state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is eigenstate of &lt;span class=&quot;math-container&quot;&gt;$\hat{P}$&lt;/span&gt; with eigenvalue 1. For example, &lt;span class=&quot;math-container&quot;&gt;$|+\rangle\langle+|$&lt;/span&gt; is projector on state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;As a result of measurement in the projector basis we obtain one of the eigenstates of a projector.&lt;/li&gt;&#xA;&lt;li&gt;The expected value of a projector &lt;span class=&quot;math-container&quot;&gt;$\hat{P}$&lt;/span&gt; on state &lt;span class=&quot;math-container&quot;&gt;$\psi$&lt;/span&gt; is equal to probability of obtaining projector's eigenstate with eigenvalue 1 as a result of measurement in the projector basis, for example for projector &lt;span class=&quot;math-container&quot;&gt;$\hat{P}=|+\rangle\langle+|$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle\psi|\hat{P}|\psi\rangle=\langle\psi|+\rangle\langle+|\psi\rangle=|\langle+|\psi\rangle|^2&#xA;$$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;PPS: &lt;span class=&quot;math-container&quot;&gt;$\vert + \rangle \langle 0 \vert$&lt;/span&gt; is NOT a projector, for example because any projector &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; has property &lt;span class=&quot;math-container&quot;&gt;$P^2=P$&lt;/span&gt; and&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|+ \rangle \langle 0|^2 = |+ \rangle \langle 0|+ \rangle \langle 0|= \frac{1}{\sqrt{2}} |+ \rangle \langle 0| \neq |+ \rangle \langle 0|&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="2105" LastEditorUserId="23" LastEditDate="2021-05-17T18:58:46.070" LastActivityDate="2021-05-17T18:58:46.070" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17464" PostTypeId="1" AcceptedAnswerId="17467" CreationDate="2021-05-12T05:57:50.427" Score="2" ViewCount="41" Body="&lt;p&gt;I've used the function &lt;code&gt;result.time_taken&lt;/code&gt; to know the amount of time used to execute a task on the real chip, but I don't understand if the result is in seconds or in milliseconds, because if I run my circuit with 1 shot my result is 7.8, if I run my circuit with 1024 shots my result is 8.4. How is this possible? Does the time include only time to execute the algorithm, or other times (for instance the initialization of my input...)?&lt;/p&gt;&#xA;" OwnerUserId="15624" LastEditorUserId="55" LastEditDate="2021-05-13T17:25:54.727" LastActivityDate="2021-05-13T17:25:54.727" Title="Time result for my algorithm" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;algorithm&gt;&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17465" PostTypeId="2" ParentId="17461" CreationDate="2021-05-12T06:32:46.300" Score="2" Body="&lt;p&gt;If your operations are too noisy, then, yes, this circuit will be more noisy than just computing with single, unencoded, qubits. This is the point of the &amp;quot;fault-tolerant threshold&amp;quot;. It tells you that if your per-qubit error rate is lower than some threshold value, each level of error correction progressively reduces the noise. Current estimates for the fault-tolerant threshold are somewhere around 1%.&lt;/p&gt;&#xA;&lt;p&gt;That said, you shouldn't really be decoding if you can avoid it (you usually can). You should do everything on the encoded qubit.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-12T06:32:46.300" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17466" PostTypeId="2" ParentId="17457" CreationDate="2021-05-12T06:46:57.457" Score="2" Body="&lt;p&gt;This is a slightly messy topic which I often find to be misinterpreted.&lt;/p&gt;&#xA;&lt;p&gt;I'm not sure you can really point at a specific bit of the system as say &amp;quot;the entanglement is here&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;If you took the bipartition of (originally clean qubit) vs (everything else), which would seem like the obvious place to look, you will find that there is no entanglement according to that bipartition. Of course, that doesn't mean that there &lt;em&gt;isn't&lt;/em&gt; entanglement anywhere else (although this statement has certainly been read in that way. I certainly did the first time I came across it). If you consider basically any other bipartition of the system, you will detect some entanglement across it (depending on the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;). So, there can be some (relatively small amount of) entanglement everywhere throughout the system. I did a calculation of this at some point: &lt;a href=&quot;https://arxiv.org/abs/1508.06474&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1508.06474&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don't know if you could break the analysis down into finer grained details to localise what's going on a bit better. I suspect that would depend too heavily on the &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; that you're tracing. Equally, you might ask about multi-partite entanglement. Bipartite certainly isn't the only option, just the easiest to calculate!&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-12T06:46:57.457" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17467" PostTypeId="2" ParentId="17464" CreationDate="2021-05-12T07:06:56.030" Score="1" Body="&lt;p&gt;The device time consists of multiple step, such as loading the circuit to the device, then the actual processor time and finally the return of the results.&lt;/p&gt;&#xA;&lt;p&gt;Only the processor time scales with the number of shots, the device loading time, and result return are constant overhead. Thus it makes sense to see the behavior you saw; you have some constant time and then on top the time that scales linearly in the number of shots. You could find the time for the overhead if you do a linear fit to the total execution time, then the offset equals the overhead.&lt;/p&gt;&#xA;&lt;p&gt;As a more concrete example, on a recent job the device load and return result together took about 10s and the processor time for 1024 shots was ~4s, and for 8192 ~28s (so even a little bit faster than 8x the 1024 shots time). Of course these numbers depend on the device you're using!&lt;/p&gt;&#xA;" OwnerUserId="9800" LastEditorUserId="15408" LastEditDate="2021-05-12T10:32:47.323" LastActivityDate="2021-05-12T10:32:47.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17468" PostTypeId="2" ParentId="17451" CreationDate="2021-05-12T07:13:26.273" Score="1" Body="&lt;p&gt;As Quantum Mechanic said in the comments, the Bloch vector is the way to go. Any one-qubit pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\langle\psi|=\frac12(I+n_XX+n_YY+n_ZZ)&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$n_X^2+n_Y^2+n_Z^2=1$&lt;/span&gt;. Moreover, the vector &lt;span class=&quot;math-container&quot;&gt;$\vec{n}=(n_X,n_Y,n_Z)$&lt;/span&gt; can also be written as &lt;span class=&quot;math-container&quot;&gt;$(\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta)$&lt;/span&gt;. So, if we can tell what happens to the Bloch vector, you can easily map this through to the angles.&lt;/p&gt;&#xA;&lt;p&gt;So, consider the action of the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; matrix of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle\langle\psi|\mapsto X|\psi\rangle\langle\psi|X=\frac12(I+n_XX-n_YY-n_ZZ).&#xA;$$&lt;/span&gt;&#xA;You just need to use the commutation properties of the Pauli matrices. So, we see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;(n_X,n_Y,n_Z)\xrightarrow X (n_X,-n_Y,-n_Z)&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By the same token, you very quickly get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;(n_X,n_Y,n_Z)&amp;amp;\xrightarrow Z (-n_X,-n_Y,n_Z) \\&#xA;(n_X,n_Y,n_Z)&amp;amp;\xrightarrow H (n_Z,-n_Y,n_X)&#xA;\end{align*}&lt;/span&gt;&#xA;I've left the other couple for you to do.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-12T07:13:26.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17469" PostTypeId="2" ParentId="17461" CreationDate="2021-05-12T07:18:29.633" Score="2" Body="&lt;p&gt;A error correction mechanism (or error mitigation) is needed to lower the perceived noise. To do so, you apply the error correction procedure at a &amp;quot;lower&amp;quot; level than the level you use to perform the computation. Lower level means the qubits used to describe the code are closer to the physical implementation, while the qubits you use to perform the computation are the logical qubits that the code exposes.&lt;/p&gt;&#xA;&lt;p&gt;To perform error correction, you should not decode anything (by that I mean do the inverse of the encoding operation) as that would put you logicial (precious) information directly back onto the less protected physical qubits.&lt;/p&gt;&#xA;&lt;p&gt;Error correction is performed by making appropriate measurements to reveal the syndrome of the error. From this syndrome, you can then use several algorithms to recover the likely error that affected your physical qubits and correct its effect.&lt;/p&gt;&#xA;&lt;p&gt;As you mentionned, this whole procedure is not guaranteed to give good performance as manipulating the physical qubits (to perform the syndrome measurements and the correction) might just mess it up more. Yet, by doing this carefully -- that's the whole point of fault-tolerance -- you can pile up several level of such scheme and if the physical errors are low enough, each level reduces the overall error leaving you at the very top with logical qubits that are essentially error-free.&lt;/p&gt;&#xA;&lt;p&gt;One last thing: here you didn't implement any useful transformation on the logical qubits (ie computation). For the whole scheme to work, you also need to be able to manipulate the logical qubits without having to decode them as it would expose your precious quantum information again to the high error rate of physical qubits. This is also the focus of fault-tolerant quantum computing.&lt;/p&gt;&#xA;&lt;p&gt;Right now, experimental system are struggling to achieve the low error rates needed to perform a layer of FTQC encoding, not to mention the high number of physical qubits that are needed to perform several such layers.&lt;/p&gt;&#xA;&lt;p&gt;So, if you implement the 9-qubit Shor code, this will result in increased error rates while decreasing the number of available qubits to perform useful computation by a factor 9. So if you are doing it as an exercise to see what happens, that's great. If you try to mitigate errors for performing a useful QC, then you should look to some other technique taylored to your problem to mitigate the effect of noise.&lt;/p&gt;&#xA;&lt;p&gt;Cheers.&lt;/p&gt;&#xA;" OwnerUserId="9393" LastActivityDate="2021-05-12T07:18:29.633" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17470" PostTypeId="1" CreationDate="2021-05-12T10:05:15.330" Score="1" ViewCount="54" Body="&lt;p&gt;This is the first time I am using the IBM quantum computer. I tried to run a circuit (see below the first picture) but the results I got don't match the theoretical results shown (see below the second picture). I am honestly not sure what to do or why this happens. I also tried to run different circuits but they seem to have to same problem so I am probably misinterpreting something. I also tried to use a different quantum processor but they give the same problem.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/51EYw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/51EYw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15846" LastActivityDate="2021-05-12T10:44:35.500" Title="IBM quantum computer giving the wrong result?" Tags="&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17471" PostTypeId="2" ParentId="17470" CreationDate="2021-05-12T10:28:41.627" Score="0" Body="&lt;p&gt;This happens because the effect of measuring a qubit. Half of the time, the qubit &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; collapses to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, half of the time to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In your first example, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; collapsed to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, so your theoretical chances (from the second example) of &lt;span class=&quot;math-container&quot;&gt;$*0$&lt;/span&gt; are distributed among &lt;span class=&quot;math-container&quot;&gt;$01$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$11$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can see that if you change the &lt;code&gt;Visualisation seed&lt;/code&gt; on the top right corner. Here is an example with &lt;code&gt;seed = 1726&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nkfcX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nkfcX.png&quot; alt=&quot;same example with seed 1726&quot; /&gt;&lt;/a&gt;&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;In this case, &lt;span class=&quot;math-container&quot;&gt;$q_0$&lt;/span&gt; collapsed to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$*1$&lt;/span&gt; is not happening now. As a consequence, the only possible result is &lt;span class=&quot;math-container&quot;&gt;$00$&lt;/span&gt;, since &lt;span class=&quot;math-container&quot;&gt;$10$&lt;/span&gt; was never a possibility (even without the measurement).&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-05-12T10:44:35.500" LastActivityDate="2021-05-12T10:44:35.500" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17472" PostTypeId="1" CreationDate="2021-05-12T12:16:54.750" Score="2" ViewCount="64" Body="&lt;p&gt;This is an important result in Quantum Computing because it means that the Hamiltonian of a Quantum System can be encoded as a sequence of real numbers and their corresponding Pauli Operator.&lt;/p&gt;&#xA;&lt;p&gt;How do we prove this result?&lt;/p&gt;&#xA;&lt;p&gt;(Note I am assuming that the Hermitian is of size &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt;, and so by Pauli Operator I mean n-fold tensor products of the 2x2 Pauli Matrices)&lt;/p&gt;&#xA;" OwnerUserId="13497" LastEditorUserId="55" LastEditDate="2021-05-14T14:45:08.300" LastActivityDate="2021-05-14T14:45:08.300" Title="Prove that any Hermitian Matrix is a real linear combination of Pauli operators" Tags="&lt;hamiltonian-simulation&gt;&lt;pauli-gates&gt;&lt;linear-algebra&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-05-14T01:30:56.020" ContentLicense="CC BY-SA 4.0" />
  <row Id="17473" PostTypeId="2" ParentId="17472" CreationDate="2021-05-12T13:08:10.237" Score="2" Body="&lt;p&gt;Consider an arbitrary &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt; matrix:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\left(\begin{array}{cc}&#xA;a &amp;amp; b \\ c &amp;amp; d&#xA;\end{array}\right)&#xA;$$&lt;/span&gt;&#xA;What does it mean to impose that &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; is Hermitian, &lt;span class=&quot;math-container&quot;&gt;$M=M^\dagger$&lt;/span&gt;?&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a=a^\star, b=c^\star,d=d^\star&#xA;$$&lt;/span&gt;&#xA;By that token, &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; are real and, if we write &lt;span class=&quot;math-container&quot;&gt;$c=x+iy$&lt;/span&gt; for real &lt;span class=&quot;math-container&quot;&gt;$x,y$&lt;/span&gt;, then &lt;span class=&quot;math-container&quot;&gt;$b=x+iy$&lt;/span&gt;. Thus, we can write the matrix as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;M=\left(\begin{array}{cc} a &amp;amp; x-iy \\ x+iy &amp;amp; d \end{array}\right).&#xA;$$&lt;/span&gt;&#xA;You can readily verify that this is the same as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac{a+d}{2}I+xX+yY+\frac{a-d}{2}Z.&#xA;$$&lt;/span&gt;&#xA;All four coefficients are real.&lt;/p&gt;&#xA;&lt;p&gt;To think about the general case of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits, realise that we can use a basis of &lt;span class=&quot;math-container&quot;&gt;$x\in\{0,1\}^n$&lt;/span&gt;. There are diagonal terms like&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;a|x\rangle\langle x|&#xA;$$&lt;/span&gt;&#xA;which you can show how to construct from Paulis:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\bigotimes_{i=1}^n\frac{I+(-1)^{x_i}Z}{2}&#xA;$$&lt;/span&gt;&#xA;Then there are terms &lt;span class=&quot;math-container&quot;&gt;$(a+ib)|x\rangle\langle y|+(a-ib)|y\rangle\langle x|)$&lt;/span&gt;. For these, use the construction&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|0\rangle\langle 1|=\frac12(X+iY)&#xA;$$&lt;/span&gt;&#xA;for qubits &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$x_i\neq y_i$&lt;/span&gt;, and the same construction as for the diagonal case whenever &lt;span class=&quot;math-container&quot;&gt;$x_i=y_i$&lt;/span&gt;. It should quickly be clear that we can use just tensor products of Paulis. It might take a little more care to be clear that the imaginary components all vanish.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-05-12T15:28:52.597" LastActivityDate="2021-05-12T15:28:52.597" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17474" PostTypeId="2" ParentId="17410" CreationDate="2021-05-12T14:24:18.913" Score="1" Body="&lt;p&gt;As a first step, you can create realistic pulses on &lt;code&gt;FakeOpenPulse2Q()&lt;/code&gt; using the pulse builder.  The default pulses instructions can be retrieved from the instruction schedule map. Here below the example for retrieveing the instruction from armonk and recreate that set of pulses for &lt;code&gt;FakeOpenPulse2Q()&lt;/code&gt; using the pulse builder&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;1) Retrieve the pulse instructions for the gate (u3 in your case) &#xA;&#xA;backend1.defaults().instruction_schedule_map.get('u3',qubits=[0]).instructions &#xA;&#xA;this gives you the set of instructions below :&#xA;&#xA;    ((0, ShiftPhase(-1.0*P2, DriveChannel(0))),&#xA;     (0,&#xA;      Play(Drag(duration=320, amp=(0.370467155866812-0.0762912966131609j), sigma=80, beta=-1.095928909587139, name='X90p_d0'), DriveChannel(0), name='X90p_d0')),&#xA;     (320, ShiftPhase(-1.0*P0, DriveChannel(0))),&#xA;     (320,&#xA;      Play(Drag(duration=320, amp=(-0.370467155866812+0.07629129661316089j), sigma=80, beta=-1.095928909587139, name='X90m_d0'), DriveChannel(0), name='X90m_d0')),&#xA;     (640, ShiftPhase(-1.0*P1, DriveChannel(0))))&#xA;&#xA;2) Create your calibration pulse program using the pulse builder&#xA;&#xA;P2=0.90&#xA;P0=0.40&#xA;P1=0.60&#xA;&#xA;from qiskit.pulse import  play, build, shift_phase, ControlChannel, DriveChannel, GaussianSquare, Drag, Gaussian&#xA;&#xA;with build(backend2) as pulse_prog:&#xA;shift_phase(-1.0*P2, DriveChannel(0)),&#xA;play(Drag(duration=320, amp=(0.370467155866812-0.0762912966131609j), sigma=80, beta=-1.095928909587139, name='X90p_d0'), DriveChannel(0), name='X90p_d0'),&#xA;shift_phase(-1.0*P0, DriveChannel(0)),&#xA;play(Drag(duration=320, amp=(-0.370467155866812+0.07629129661316089j), sigma=80, beta=-1.095928909587139, name='X90m_d0'), DriveChannel(0), name='X90m_d0')&#xA;shift_phase(-1.0*P1, DriveChannel(0))&#xA;&#xA;pulse_prog.draw('IQXDebugging', axis = ax, show_waveform_info = True)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/gmntQ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gmntQ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;3 ) Then you must Link your calibration to your circuit &#xA;circ1.add_calibration(.......). &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can refer to the pulse gate tutorial for detailed information  --&amp;gt; &lt;a href=&quot;https://qiskit.org/documentation/tutorials/circuits_advanced/05_pulse_gates.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/tutorials/circuits_advanced/05_pulse_gates.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I hope this helps as a starting point.&lt;/p&gt;&#xA;" OwnerUserId="9934" LastActivityDate="2021-05-12T14:24:18.913" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17475" PostTypeId="5" CreationDate="2021-05-12T16:45:48.257" Score="0" Body="&lt;p&gt;Let us consider a quantum model of the form&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$f(x) = \langle \phi(x)|\mathcal{M}|\phi(x)\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$|\phi(x)\rangle$&lt;/span&gt; is prepared by a fixed embedding circuit that encodes data inputs &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}$&lt;/span&gt; is an arbitrary observable. This model includes variational quantum machine learning models since the observable can effectively be implemented by a simple measurement that is preceded by a variational circuit. For example, applying a circuit &lt;span class=&quot;math-container&quot;&gt;$G(\theta)$&lt;/span&gt; and then measuring the Pauli-Z observable &lt;span class=&quot;math-container&quot;&gt;$\sigma^0_z$&lt;/span&gt; of the first qubit implements the trainable measurement &lt;span class=&quot;math-container&quot;&gt;$\mathcal{M}(\theta) = G^\dagger(\theta) \sigma^0_z G(\theta)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The main practical consequence of approaching quantum machine learning with a kernel approach is that instead of training &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; variationally, we can often train an equivalent classical kernel method with a kernel executed on a quantum device. This quantum kernel is given by the mutual overlap of two data-encoding quantum states,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\kappa(x, x') = |\langle\phi(x')|\phi(x)\rangle|^2.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Kernel-based training, therefore, bypasses the processing and measurement parts of common variational circuits, and only depends on the data encoding. If the loss function is the hinge loss, the kernel method corresponds to a standard support vector machine (SVM) in the sense of a maximum-margin classifier. Other convex loss functions lead to more general variations of support vector machines &lt;a href=&quot;https://pennylane.ai/qml/demos/tutorial_kernel_based_training.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;[1]&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-14T12:43:52.813" LastActivityDate="2021-05-14T12:43:52.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17476" PostTypeId="4" CreationDate="2021-05-12T16:45:48.257" Score="0" Body="Kernel methods are a class of machine learning algorithms for pattern analysis (e.g. SVMs). Any linear model can be turned into a non-linear model by applying the kernel trick to the model, i.e. replacing its features with a kernel function. Quantum computers are expected to improve existing classical kernel-based ML methods through their ability to efficiently access and manipulate data in large quantum feature spaces, which is classically intractable." OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-12T18:59:12.650" LastActivityDate="2021-05-12T18:59:12.650" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17477" PostTypeId="1" CreationDate="2021-05-12T16:59:15.457" Score="1" ViewCount="41" Body="&lt;p&gt;The IBM Qiskit &lt;a href=&quot;https://qiskit.org/documentation/tutorials/finance/01_portfolio_optimization.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Portfolio Optimization&lt;/a&gt; sample finally provides an array similar to &lt;code&gt;[1,0,1,1]&lt;/code&gt; representing the 4 digits as the stocks. So does the &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; represent the corresponding stock and whether to invest it or not ?&lt;/p&gt;&#xA;&lt;p&gt;Is there any possibility to get in a weighted form such as invest 10% in stock #1 and 30% in stock #2 and so on.&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="5955" LastEditDate="2021-05-12T18:59:02.520" LastActivityDate="2021-05-14T22:26:40.497" Title="Qiskit Portfolio Optimization : Does the resulting matrix show the stock combination to select?" Tags="&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;vqe&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17478" PostTypeId="1" CreationDate="2021-05-12T17:20:41.800" Score="0" ViewCount="45" Body="&lt;p&gt;How do you build a circuit for a modified Toffoli gate using only local unitary operations and CNOT operations? The two-qubit unitary operation is given by: &lt;span class=&quot;math-container&quot;&gt;$\text{diag}\{1, 1, 1, e^{i\phi}\}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15104" LastEditorUserId="55" LastEditDate="2021-05-13T10:09:45.833" LastActivityDate="2021-05-13T10:09:45.833" Title="How do you build the modified Toffoli gate using only local unitary and CNOT operations?" Tags="&lt;programming&gt;&lt;quantum-gate&gt;&lt;circuit-construction&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17479" PostTypeId="1" CreationDate="2021-05-12T17:48:11.927" Score="1" ViewCount="84" Body="&lt;p&gt;Given    &lt;span class=&quot;math-container&quot;&gt;$\&#xA;\hat{W}=\mathbf{1}_{A B}+\sigma_{x}^{A} \otimes \sigma_{x}^{B}-\sigma_{y}^{A} \otimes \sigma_{y}^{B}-\sigma_{z}^{A} \otimes \sigma_{z}^{B}&#xA;$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;how can i show that for every separable state &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}_{A B},\&#xA;\langle\hat{W}\rangle_{\rho} \equiv \operatorname{Tr}\left[\hat{W} \hat{\sigma}_{A B}\right]\geq 0$&lt;/span&gt; ?&#xA;I have tried different things but the most promising seems to bee the following one. I know that if &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}_{AB}^{T{A}}$&lt;/span&gt; (partial transpose of &lt;span class=&quot;math-container&quot;&gt;$\hat{\sigma}_{AB}$&lt;/span&gt; with respect to &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;&#xA;) is positive semi definite. Moreover I know that &lt;span class=&quot;math-container&quot;&gt;$\hat{W}_{AB}^{T{A}}$&lt;/span&gt;&#xA;is positive semi definite (I compute explicitly the matrix and its eigenvalues). My idea now was do to the following&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}   Tr[\hat{W}_{AB}\hat{\sigma}_{AB}] = Tr[\hat{W}_{AB}(\hat{\sigma}_{AB}^{T{A}})^{T{A}}]    = Tr[\hat{W}_{AB}^{T{A}}\hat{\sigma}_{AB}^{T{A}}] = \ Tr[\sum_{k}\lambda_k{|\lambda}_k\rangle\langle{\lambda}_k|\hat{\sigma}_{AB}^{T{A}}] = \sum_{k}\lambda_k Tr[ \langle{\lambda}_k|\hat{\sigma}_{AB}^{T_{A}}|{\lambda}_k\rangle] \geq 0 \end{equation}&lt;/span&gt;&#xA;the problem here is that in the third inequality I use a technical lemma and i am not sure that I can apply it&lt;/p&gt;&#xA;" OwnerUserId="15850" LastEditorUserId="15850" LastEditDate="2021-05-13T13:47:02.097" LastActivityDate="2021-05-13T13:47:02.097" Title="Argue positivity of mean value of an entanglement witness matrix for all separable state" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-05-16T20:21:02.073" ContentLicense="CC BY-SA 4.0" />
  <row Id="17480" PostTypeId="1" AcceptedAnswerId="17483" CreationDate="2021-05-12T19:09:06.410" Score="2" ViewCount="76" Body="&lt;p&gt;&lt;code&gt;qiskit.chemistry.FermionicOperator&lt;/code&gt; &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.chemistry.FermionicOperator.html#qiskit.chemistry.FermionicOperator&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; is very useful for converting fermionic operators to qubits operators. &lt;code&gt;qiskit.chemistry&lt;/code&gt; has been deprecated. I went through the migration guide they have but I can't seem to find the replacement of &lt;code&gt;FermiOpetator&lt;/code&gt; in &lt;code&gt;qiskit_nature&lt;/code&gt;. Anyone know this? Thanks a lot.&lt;/p&gt;&#xA;" OwnerUserId="13215" LastEditorUserId="13991" LastEditDate="2021-05-12T21:30:43.847" LastActivityDate="2021-05-12T22:01:41.307" Title="Replacement of FermionicOperator from qiskit.chemistry in qiskit_nature" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17481" PostTypeId="1" AcceptedAnswerId="17484" CreationDate="2021-05-12T19:18:41.083" Score="5" ViewCount="87" Body="&lt;p&gt;The quantum volume is typically taken as a popular metric to determine the capability of a quantum computer to solve complex problems. Since the end goal is to develop quantum computers that can solve problems that classical computers cannot, I am wondering if one can calculate a quantum volume associated to a classical computer. If one did this for the largest supercomputers, then this could give, for example, a value of the quantum volume that must be surpassed for quantum computers to be advantageous over classical computers.&lt;/p&gt;&#xA;" OwnerUserId="7729" LastEditorUserId="55" LastEditDate="2021-05-13T10:13:21.003" LastActivityDate="2021-05-13T10:13:21.003" Title="Can we calculate the quantum volume of a classical computer?" Tags="&lt;architecture&gt;&lt;technical-standards&gt;&lt;quantum-volume&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17482" PostTypeId="1" AcceptedAnswerId="17493" CreationDate="2021-05-12T19:59:04.177" Score="2" ViewCount="43" Body="&lt;p&gt;I am currently studying a model of a quantum (atomic) clock. And in &lt;a href=&quot;https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=909252&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, I came across the term &amp;quot;&lt;strong&gt;Free evolution for a period T&lt;/strong&gt;&amp;quot;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Free evolution for a period T where a phase difference of Φ&#xA;accumulates between the oscillator and the qubits &lt;span class=&quot;math-container&quot;&gt;$\psi_{2} =\begin{pmatrix}1 &amp;amp; 0 \\0 &amp;amp; e^{-i\phi} \end{pmatrix}\psi_{1}$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I was able to find references to this term in some other scientific works, but they also do not explain what it means.&#xA;It would be great to see a simple explanation of this term.&lt;/p&gt;&#xA;" OwnerUserId="15573" LastEditorUserId="15573" LastEditDate="2021-05-13T19:36:10.280" LastActivityDate="2021-05-13T20:26:14.680" Title="What's free evolution for a period T?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;physical-qubit&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17483" PostTypeId="2" ParentId="17480" CreationDate="2021-05-12T22:01:41.307" Score="2" Body="&lt;p&gt;This is now under &lt;code&gt;QubitConverter&lt;/code&gt; within &lt;code&gt;qiskit_nature&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This &lt;a href=&quot;https://github.com/Qiskit/qiskit-nature/tree/main/docs/tutorials&quot; rel=&quot;nofollow noreferrer&quot;&gt;link here&lt;/a&gt; might be helpful. You might have to look into how to define the fermionic operators in this new released version, but the example below, which is really just taking from the above linked, might provide some guidance.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import Aer&#xA;from qiskit_nature.drivers import PySCFDriver, UnitsType, Molecule&#xA;from qiskit_nature.problems.second_quantization import ElectronicStructureProblem&#xA;from qiskit_nature.converters.second_quantization import QubitConverter&#xA;from qiskit_nature.mappers.second_quantization import JordanWignerMapper&#xA;&#xA;molecule = Molecule(geometry=[['H', [0., 0., 0.]],&#xA;                              ['H', [0., 0., 0.735]]],&#xA;                     charge=0, multiplicity=1)&#xA;driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The electronic Hamiltonian written in term of fermionic operators is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;es_problem = ElectronicStructureProblem(driver)&#xA;second_q_op = es_problem.second_q_ops()&#xA;print(second_q_op[0])&#xA;&#xA;+-+- * (0.18093119978423158+0j)&#xA;+ +--+ * (-0.18093119978423156+0j)&#xA;+ -++- * (-0.18093119978423156+0j)&#xA;+ -+-+ * (0.18093119978423156+0j)&#xA;+ IIIN * (-0.47189600728114073+0j)&#xA;+ IINI * (-1.2563390730032507+0j)&#xA;+ IINN * (0.48365053047106565+0j)&#xA;+ INII * (-0.47189600728114073+0j)&#xA;+ ININ * (0.6985737227320187+0j)&#xA;+ INNI * (0.6645817302552972+0j)&#xA;+ NIII * (-1.2563390730032507+0j)&#xA;+ NIIN * (0.6645817302552972+0j)&#xA;+ NINI * (0.675710154803517+0j)&#xA;+ NNII * (0.48365053047106565+0j)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which can be converted to qubitOp as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qubit_converter = QubitConverter(JordanWignerMapper())&#xA;qubit_op = qubit_converter.convert(second_q_op[0])&#xA;print(qubit_op)&#xA;&#xA;-0.8535040737275406 * IIII&#xA;- 0.03329093140262394 * ZIII&#xA;+ 0.09539931515219398 * IZII&#xA;+ 0.08254659792513139 * ZZII&#xA;- 0.03329093140262387 * IIZI&#xA;+ 0.1460749494329415 * ZIZI&#xA;+ 0.13998427822128043 * IZZI&#xA;+ 0.09539931515219396 * IIIZ&#xA;+ 0.13998427822128043 * ZIIZ&#xA;+ 0.1381506045026359 * IZIZ&#xA;+ 0.08254659792513139 * IIZZ&#xA;+ 0.05743768029614903 * XXXX&#xA;+ 0.05743768029614903 * YYXX&#xA;+ 0.05743768029614903 * XXYY&#xA;+ 0.05743768029614903 * YYYY&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-12T22:01:41.307" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17484" PostTypeId="2" ParentId="17481" CreationDate="2021-05-13T00:34:34.037" Score="5" Body="&lt;p&gt;The log quantum volume of Quirk ( &lt;a href=&quot;https://algassert.com/quirk&quot; rel=&quot;noreferrer&quot;&gt;https://algassert.com/quirk&lt;/a&gt; ) is 16, because it has a maximum of 16 qubits and can easily do the ~200 gates that are part of the test circuit. The slowest part will be drawing the result.&lt;/p&gt;&#xA;&lt;p&gt;For state vector simulators that don't impose maximum qubit counts, like qsim, the limit is basically available memory and the size of floating point numbers. So, for a desktop machine with 8 gigabytes of memory the log quantum volume will be somewhere around 30 and for a supercomputer with tens of petabytes of storage the log quantum volume will be somewhere around 50.&lt;/p&gt;&#xA;&lt;p&gt;According to the wikipedia page on quantum volume, IBM has reported a log quantum volume of 6 and Honeywell has reported a log quantum volume of 9. So qubit counts need to get between 5x and 10x better, and fidelities need to get between 25x and 100x better, before physical quantum machines start beating super computers at this metric.&lt;/p&gt;&#xA;&lt;p&gt;(If you're wondering why I keep saying log quantum volume instead of quantum volume, it's because measuring not-log quantum volume is like saying that adding 20 bits of storage to a terabyte hard drive makes it a million times better.)&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-13T00:34:34.037" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17485" PostTypeId="2" ParentId="17454" CreationDate="2021-05-13T00:51:35.320" Score="0" Body="&lt;p&gt;Grover's algorithm is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Circuit_satisfiability_problem&quot; rel=&quot;nofollow noreferrer&quot;&gt;CIRCUIT-SAT&lt;/a&gt; solver. Given a circuit with &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; boolean inputs, it finds a satisfying input in &lt;span class=&quot;math-container&quot;&gt;$O(2^{n/2})$&lt;/span&gt; evaluations of the circuit in the worst case, which is interesting because no classical algorithm is known that does better than &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt;, and it's conjectured that none exists.&lt;/p&gt;&#xA;&lt;p&gt;Lov Grover decided to call it a database search algorithm in his original paper, and there's a tendency for arbitrary terminological choices made in pioneering papers to become standards whether they make sense or not. So I suppose it will forever be taught as a database search algorithm, and students will forever be confused by it as they quite reasonably wonder how this &amp;quot;database&amp;quot; is encoded in the circuit and why you wouldn't just index it for &lt;span class=&quot;math-container&quot;&gt;$O(n)$&lt;/span&gt; lookup while you're at it.&lt;/p&gt;&#xA;&lt;p&gt;Don't try to understand the &amp;quot;database&amp;quot;. Just forget about it. Grover's algorithm is a CIRCUIT-SAT solver.&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2021-05-13T00:51:35.320" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17486" PostTypeId="2" ParentId="17479" CreationDate="2021-05-13T06:43:49.383" Score="0" Body="&lt;p&gt;I suggest that you evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Tr}(\hat W\sigma)=\text{Tr}((\hat W-2I)\sigma)+2.&#xA;$$&lt;/span&gt;&#xA;I've done this because &lt;span class=&quot;math-container&quot;&gt;$\hat W-2I$&lt;/span&gt; is closely related to a projector onto a particular two-qubit state, &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; (I'm being deliberately vague here. Your question sounds like a homework question, so I'm leaving calculations for you to do). You should be able to use that to evaluate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\max_{\phi_A,\phi_B}\langle\phi_A\phi_B|\psi\rangle.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-13T06:43:49.383" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17487" PostTypeId="2" ParentId="15741" CreationDate="2021-05-13T07:29:11.673" Score="0" Body="&lt;pre&gt;&lt;code&gt;pip list | grep &amp;quot;qiskit&amp;quot;&#xA;pip list | grep &amp;quot;IBMQuantumExperience&amp;quot;&#xA;pip list | grep &amp;quot;qiskit-aer&amp;quot;&#xA;pip list | grep &amp;quot;qiskit-terra&amp;quot;&#xA;python --version&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In notebook add &amp;quot;!&amp;quot; at the begining&lt;/p&gt;&#xA;" OwnerUserId="14028" LastEditorUserId="14028" LastEditDate="2021-05-13T07:34:55.983" LastActivityDate="2021-05-13T07:34:55.983" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17488" PostTypeId="2" ParentId="17458" CreationDate="2021-05-13T07:32:46.627" Score="1" Body="&lt;p&gt;To start with, remember that there are only 4 possible states you could be talking about:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi_{00}\rangle=|0\rangle,\qquad |\psi_{10}\rangle=|1\rangle,\qquad |\psi_{01}\rangle=|+\rangle,\qquad |\psi_{11}\rangle=|-\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It should be obvious that when &lt;span class=&quot;math-container&quot;&gt;$b'=b$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$a'=a$&lt;/span&gt;. This is because you're measuring the qubit in the same basis that it's prepared in (that's precisely the statement &lt;span class=&quot;math-container&quot;&gt;$b=b'$&lt;/span&gt;). For example, if the qubit is prepared in &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$a=1$&lt;/span&gt;) and you measure it in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis (projectors &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\langle 0|,|1\rangle\langle 1|$&lt;/span&gt;), you definitely get the answer &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$a'=1$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;So, the only thing you need to check is, let's say a qubit is prepared in &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; (&lt;span class=&quot;math-container&quot;&gt;$b=1$&lt;/span&gt;) but you measure it in the &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis (&lt;span class=&quot;math-container&quot;&gt;$b'=0$&lt;/span&gt;). You get the two possible outputs with &lt;span class=&quot;math-container&quot;&gt;$50:50$&lt;/span&gt; probability. Equally, had the state been in &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;, it's 50:50 with that measurement. So, that measurement tells us nothing about which of the two states it was. The outcomes (&lt;span class=&quot;math-container&quot;&gt;$a'$&lt;/span&gt;) are random, and uncorrelated with the value of &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-13T07:32:46.627" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17489" PostTypeId="2" ParentId="15741" CreationDate="2021-05-13T07:46:21.530" Score="1" Body="&lt;p&gt;If you installed qiskit using pip, you could run the following on the command line:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip show qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-13T07:46:21.530" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17490" PostTypeId="1" AcceptedAnswerId="17506" CreationDate="2021-05-13T13:21:55.017" Score="4" ViewCount="74" Body="&lt;p&gt;I have noticed that some CNOT gates (for instance, between qubits 1 and 2 in &lt;code&gt;ibmq_casablanca&lt;/code&gt;) display an error rate of 1 while typical error rates are of course much smaller. How is that even possible? What does it mean?&lt;/p&gt;&#xA;" OwnerUserId="15860" LastEditorUserId="1859" LastEditDate="2021-05-17T08:01:09.923" LastActivityDate="2021-05-17T08:01:09.923" Title="CNOT error rate of 1 in IBM backends" Tags="&lt;quantum-gate&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17491" PostTypeId="1" CreationDate="2021-05-13T17:37:15.230" Score="2" ViewCount="203" Body="&lt;p&gt;I want to freeze core orbitals of my molecule and I know ElectronicStructureProblem has the possibility (es_problem = ElectronicStructureProblem(driver=driver, q_molecule_transformers=FreezeCoreTransformer())). Then, when I run the code to calculate the ground state energy of my molecule (res = calc.solve(problem=es_problem)), it says that 'FreezeCoreTransformer' object is not iterable. Which is the way then to freeze core orbitals without using deprecated libraries of Qiskit?&#xA;Thank you very much in advance!&lt;/p&gt;&#xA;" OwnerUserId="15556" LastEditorUserId="55" LastEditDate="2021-05-14T09:01:07.977" LastActivityDate="2021-05-14T09:01:07.977" Title="Add FreezeCoreOrbitals on ElectronicStructureProblem" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;chemistry&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17492" PostTypeId="2" ParentId="17491" CreationDate="2021-05-13T18:32:45.103" Score="1" Body="&lt;p&gt;See &lt;a href=&quot;https://github.com/Qiskit/qiskit-nature/issues/163&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-nature/issues/163&lt;/a&gt; for info:&lt;/p&gt;&#xA;&lt;p&gt;Summary&lt;/p&gt;&#xA;&lt;p&gt;The ElectronicStructureProblem takes a driver and list of transformers, so you would do it like this&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;problem = ElectronicStructureProblem(driver, transformers=[FreezeCoreTransformer()])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2021-05-13T18:32:45.103" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17493" PostTypeId="2" ParentId="17482" CreationDate="2021-05-13T20:26:14.680" Score="2" Body="&lt;p&gt;The specific work you cite deals with Ramsey interferometry. In that case, there is a two-level atom with some states &lt;span class=&quot;math-container&quot;&gt;$|g\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|e\rangle$&lt;/span&gt;, which have different energies. Since it never matters where we set the &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; of energy, people typically say that the ground state &lt;span class=&quot;math-container&quot;&gt;$|g\rangle$&lt;/span&gt; has energy &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and the excited state has energy &lt;span class=&quot;math-container&quot;&gt;$\hbar \omega_a$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\hbar$&lt;/span&gt; is the reduced Planck's constant and &lt;span class=&quot;math-container&quot;&gt;$\omega_a$&lt;/span&gt; is a frequency (&lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; stands for atomic).&lt;/p&gt;&#xA;&lt;p&gt;In this case, we can write the atomic Hamiltonian as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$H_a=\hbar\omega_a|e\rangle\langle e|.$$&lt;/span&gt; This Hamiltonian has two energy eigenstates: &lt;span class=&quot;math-container&quot;&gt;$|g\rangle$&lt;/span&gt; is an eigenstate with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$E_g=0$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$|e\rangle$&lt;/span&gt; is an eigenstate with eigenvalue &lt;span class=&quot;math-container&quot;&gt;$E_e=\hbar\omega_a$&lt;/span&gt;, as might be anticipated. Thus, if the initial state of the system is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi(0)\rangle=c_g(0)|g\rangle+c_e(0)|e\rangle,$$&lt;/span&gt; it evolves under the standard rules of quantum mechanics (the Schrödinger equation) to&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi(t)\rangle=c_g(t)|g\rangle+c_e(t)|e\rangle,$$&lt;/span&gt; where, as usual,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$c_g(t)=e^{-i E_g t/\hbar}c_g(0)=c_g(0)\quad\mathrm{and}\quad c_e(t)=e^{-i E_e t/\hbar}c_e(0)=e^{-i\omega_a t}c_e(0).$$&lt;/span&gt; If this evolution happens for a period &lt;span class=&quot;math-container&quot;&gt;$t=T$&lt;/span&gt;, the coefficient &lt;span class=&quot;math-container&quot;&gt;$c_g(0)$&lt;/span&gt; does not change while the coefficient &lt;span class=&quot;math-container&quot;&gt;$c_e(0)$&lt;/span&gt; aquires a phase of &lt;span class=&quot;math-container&quot;&gt;$\omega_a T$&lt;/span&gt;.  If we represent our state in the &lt;span class=&quot;math-container&quot;&gt;$\{|g\rangle,|e\rangle\}$&lt;/span&gt;-basis, as &lt;span class=&quot;math-container&quot;&gt;$$|\psi(t)\rangle= \begin{pmatrix}c_g(t)\\c_e(t)\end{pmatrix}=\begin{pmatrix}c_g(0)\\e^{-i\omega_a t}c_e(0)\end{pmatrix}=\begin{pmatrix}1&amp;amp;0\\0&amp;amp;e^{-i\omega_a t}\end{pmatrix}\begin{pmatrix}c_g(0)\\c_e(0)\end{pmatrix}=\begin{pmatrix}1&amp;amp;0\\0&amp;amp;e^{-i\omega_a t}\end{pmatrix}|\psi(0)\rangle,$$&lt;/span&gt; the matrix you described is equivalent to the evolution of the state under the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_a$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-13T20:26:14.680" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17494" PostTypeId="1" AcceptedAnswerId="17495" CreationDate="2021-05-13T21:15:02.880" Score="6" ViewCount="1688" Body="&lt;p&gt;I have encountered different matrix of operator &amp;quot;the Square Root of NOT gate&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;For example, &lt;a href=&quot;https://en.wikipedia.org/wiki/Quantum_logic_gate&quot; rel=&quot;noreferrer&quot;&gt;the matrix is specified here&lt;/a&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sqrt {NOT}  = \frac{1}{2}\left( {\begin{array}{*{20}{c}}&#xA;{1 + i}&amp;amp;{1 - i}\\&#xA;{1 - i}&amp;amp;{1 + i}&#xA;\end{array}} \right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And &lt;a href=&quot;https://physics.stackexchange.com/questions/100658/rotation-about-the-z-axis-on-the-bloch-sphere&quot;&gt;here a completely different matrix&lt;/a&gt; is given:&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sqrt {NOT}  = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}}&#xA;1&amp;amp;{ - i}\\&#xA;{ - i}&amp;amp;1&#xA;\end{array}} \right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Applying them to the vector &lt;span class=&quot;math-container&quot;&gt;$\left| 0 \right\rangle  = \left( {\begin{array}{*{20}{c}}&#xA;1\\&#xA;0&#xA;\end{array}} \right)$&lt;/span&gt;, we get different results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt {NOT} \left| 0 \right\rangle  = \frac{1}{2}\left( {\begin{array}{*{20}{c}}&#xA;{1 + i}&amp;amp;{1 - i}\\&#xA;{1 - i}&amp;amp;{1 + i}&#xA;\end{array}} \right)\left( {\begin{array}{*{20}{c}}&#xA;1\\&#xA;0&#xA;\end{array}} \right) = \frac{1}{2}\left( {\begin{array}{*{20}{c}}&#xA;{1 + i}\\&#xA;{1 - i}&#xA;\end{array}} \right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\sqrt {NOT} \left| 0 \right\rangle  = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}}&#xA;1&amp;amp;{ - i}\\&#xA;{ - i}&amp;amp;1&#xA;\end{array}} \right)\left( {\begin{array}{*{20}{c}}&#xA;1\\&#xA;0&#xA;\end{array}} \right) = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}}&#xA;1\\&#xA;{ - i}&#xA;\end{array}} \right)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where is the correct matrix of the operator &lt;span class=&quot;math-container&quot;&gt;$\sqrt {NOT} $&lt;/span&gt; specified?&lt;/p&gt;&#xA;" OwnerUserId="15573" LastEditorUserId="55" LastEditDate="2021-05-13T22:10:21.010" LastActivityDate="2021-05-14T18:25:41.607" Title="What is the square root of the NOT gate?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="4" ClosedDate="2021-05-16T20:18:38.287" ContentLicense="CC BY-SA 4.0" />
  <row Id="17495" PostTypeId="2" ParentId="17494" CreationDate="2021-05-13T21:32:06.963" Score="8" Body="&lt;p&gt;They are the same up to a global phase.&lt;/p&gt;&#xA;&lt;p&gt;Note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$1 + i = \sqrt 2 e^{i\pi / 4}$&lt;/span&gt;.&#xA;That means&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align*}&#xA;\frac{1}{2}\left( {\begin{array}{*{20}{c}}&#xA;{1 + i}&amp;amp;{1 - i}\\&#xA;{1 - i}&amp;amp;{1 + i}&#xA;\end{array}} \right) &amp;amp;= \frac{1}{2}\left( {\begin{array}{*{20}{c}}&#xA;\sqrt 2 e^{i\pi / 4}&amp;amp;\sqrt 2 e^{-i\pi / 4}\\&#xA;\sqrt 2 e^{-i\pi / 4}&amp;amp;\sqrt 2 e^{i\pi / 4}&#xA;\end{array}} \right) \\&#xA;&amp;amp;= e^{i\pi / 4}.\frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}}&#xA;1 &amp;amp;e^{-i\pi / 2}\\&#xA;e^{-i\pi / 2}&amp;amp;1&#xA;\end{array}} \right) \\&#xA;&amp;amp;= e^{i\pi / 4}.\frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}}&#xA;1 &amp;amp;-i\\&#xA;-i&amp;amp;1&#xA;\end{array}} \right).&#xA;\end{align*}&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="-1" LastEditDate="2021-05-14T18:25:41.607" LastActivityDate="2021-05-14T18:25:41.607" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17496" PostTypeId="2" ParentId="17494" CreationDate="2021-05-13T22:06:25.537" Score="6" Body="&lt;p&gt;As mentioned already, both of those unitaries are the same up to a global phase. It might be useful to think about how you can actually arrive at one of these definitions in terms of the &amp;quot;Not gate&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;.&#xA;Recall that because &lt;span class=&quot;math-container&quot;&gt;$X^2=I$&lt;/span&gt; that you can express the exponential of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; using something very similar to Euler's formula:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\exp\left(-i\theta X\right) = \cos\theta I  -i \sin\theta X &#xA;\end{align}&lt;/span&gt;&#xA;So if we substitute &lt;span class=&quot;math-container&quot;&gt;$\theta = \frac{\pi}{2}$&lt;/span&gt; we compute &lt;span class=&quot;math-container&quot;&gt;$\exp\left(-i\frac{\pi}{2} X\right)$&lt;/span&gt; as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;X = i \exp\left(-i\frac{\pi}{2} X\right) &amp;amp;= \exp\left(i\frac{\pi}{2}\right)\exp\left(-i\frac{\pi}{2} X\right)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that the choice of a minus sign is actually important, since it describes which direction you rotate around the x-axis of the Bloch sphere to realize an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gate which becomes relevant once you want to compute the square root of that operation. This suggests a possible definition&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\sqrt{X} &amp;amp;= \sqrt{\exp\left(i\frac{\pi}{2}\right)\exp\left(-i\frac{\pi}{2} X\right)} \\&#xA;&amp;amp;= \exp\left(i\frac{\pi}{4}\right)\exp\left(-i\frac{\pi}{4} X\right)\\&#xA;&amp;amp;= \frac{(1 + i)}{\sqrt{2}} \left( \cos\frac{\pi}{4}I -i \sin\frac{\pi}{4} X \right) \\&#xA;&amp;amp;=  \frac{(1 + i)}{\sqrt{2}} \left( \frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1&#xA;\end{pmatrix} + &#xA;\frac{1}{\sqrt{2}}&#xA;\begin{pmatrix}&#xA;0 &amp;amp; -i \\&#xA;-i &amp;amp; 0&#xA;\end{pmatrix} \right) \\&#xA;&amp;amp;= \frac{1}{2}\begin{pmatrix}&#xA;1+i &amp;amp; 1-i \\&#xA;1-i &amp;amp; 1+i&#xA;\end{pmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and so you can at least see how the first definition might have been derived, even if both gates are practically equivalent and therefore &amp;quot;correct&amp;quot;.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-05-13T22:06:25.537" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17497" PostTypeId="1" CreationDate="2021-05-14T10:44:20.190" Score="2" ViewCount="35" Body="&lt;p&gt;Can you describe how to convert some QUBO problem &lt;span class=&quot;math-container&quot;&gt;$$f(x_1, ..., x_n) = \sum\limits_{1 \le i &amp;lt; j \le n} \alpha_{i,j} \, x_i \, x_j$$&lt;/span&gt; into its equivalent quantum circuits? Is it preferrable to start with the Ising formulation of the same problem (whose conversion from QUBO is explained &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/11663/how-to-convert-qubo-problem-to-ising-hamiltonian&quot;&gt;here&lt;/a&gt;)?&lt;/p&gt;&#xA;" OwnerUserId="1874" LastEditorUserId="1874" LastEditDate="2021-05-14T15:55:08.147" LastActivityDate="2021-05-14T15:55:08.147" Title="From QUBO problem to quantum circuit" Tags="&lt;hamiltonian-simulation&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="0" ClosedDate="2021-05-15T06:56:39.930" ContentLicense="CC BY-SA 4.0" />
  <row Id="17498" PostTypeId="2" ParentId="5799" CreationDate="2021-05-14T14:11:53.200" Score="1" Body="&lt;p&gt;&lt;strong&gt;CW from Self-Answer&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I asked this question a while ago, and I've learned I think a little bit about many of the outstanding open problems in the field, and more about science communication in general.&lt;/p&gt;&#xA;&lt;p&gt;Of course I suspect generally most in the QC community &lt;em&gt;want&lt;/em&gt; to have the problems that they work on be accessible to a broader audience.  And there are, from my perspective, fantastic science communicators who make that effort to translate problems into a more accessible manner.&lt;/p&gt;&#xA;&lt;p&gt;The audience of, for example, &lt;a href=&quot;https://www.quantamagazine.org/&quot; rel=&quot;nofollow noreferrer&quot;&gt;Quanta Magazine&lt;/a&gt;, may not be school children as in the question, but Quanta's done yeoman's work to explain many outstanding problems, and solutions to many of these problems, in the field.&lt;/p&gt;&#xA;&lt;p&gt;There are also some YouTube videos that target even school-children; see, &lt;a href=&quot;https://www.youtube.com/watch?v=OWJCfOvochA&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Aaronson's list of &amp;quot;Ten Semi-Grand Challenges&amp;quot; &lt;a href=&quot;https://www.scottaaronson.com/writings/qchallenge.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt; meets many desirables inherent in the question; although I doubt a school child could understand many of the questions as framed, they very well could be reframed to be accessible.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-05-14T14:11:53.200" CommentCount="0" CommunityOwnedDate="2021-05-14T14:11:53.200" ContentLicense="CC BY-SA 4.0" />
  <row Id="17499" PostTypeId="1" CreationDate="2021-05-14T14:30:14.810" Score="2" ViewCount="21" Body="&lt;p&gt;Let us consider a noise channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}(\rho)=\sum_i E_i \rho E_i^{\dagger}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\{E_i\}$&lt;/span&gt; are one choice of Kraus operators associated to it.&lt;/p&gt;&#xA;&lt;p&gt;I assume I will perform error correction and that this channel is correctable. I note the code space &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Starting from a pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \in H_C$&lt;/span&gt;, we can purify the state after this noise channel as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle |b_0 \rangle \to \sum_i E_i |\psi\rangle |b_i\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$|b_i\rangle$&lt;/span&gt; is an orthonormal basis of some ancillary system used to purify.&lt;/p&gt;&#xA;&lt;p&gt;I can also consider a basis of orthonormal unitary operator such that &lt;span class=&quot;math-container&quot;&gt;$E_i =\sum_{j} \alpha^i_j F_j$&lt;/span&gt;. Doing this, I find:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\sum_i E_i |\psi\rangle |b_i\rangle= \sum_j F_j |\psi\rangle |\widetilde{b}_j\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\widetilde{b}_j\rangle \equiv \sum_i \alpha^i_j |b_i\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The new family &lt;span class=&quot;math-container&quot;&gt;$|\widetilde{b}_j\rangle$&lt;/span&gt; is now no longer orthonormal in principle.&lt;/p&gt;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&lt;p&gt;How is precisely &lt;em&gt;defined&lt;/em&gt; an error in the context of quantum error correction. If it appears that &lt;span class=&quot;math-container&quot;&gt;$\forall i \neq j \ F_i H_C \perp F_j H_C$&lt;/span&gt; then by measuring in which subspace my system is after the noise channel I can detect and correct it. And in this context it would physically make sense to say that &lt;span class=&quot;math-container&quot;&gt;$\{F_i\}$&lt;/span&gt; are representing &lt;strong&gt;errors&lt;/strong&gt; that occured on my system.&lt;/p&gt;&#xA;&lt;p&gt;Indeed, if my measurement told me &amp;quot;it went in the space &lt;span class=&quot;math-container&quot;&gt;$F_k H_C$&lt;/span&gt;, I would have the following evolution: from preparation, to noise channel, to measurement outcome:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle |b_0\rangle \to \sum_j F_j |\psi\rangle |\widetilde{b}_j\rangle \to F_k |\psi\rangle |\widetilde{b}_k\rangle $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It would then make sense to say &amp;quot;the error &lt;span class=&quot;math-container&quot;&gt;$F_k$&lt;/span&gt; occured on my system, as one can see from the very last arrow in this equation. This is really what happened on my system (partially because I measured it).&lt;/p&gt;&#xA;&lt;p&gt;I am not forced to do the hypothesis about &lt;span class=&quot;math-container&quot;&gt;$F_j$&lt;/span&gt; being unitaries and leading the system to orthogonal subspaces to be able to do error correction as given from the Knill-Laflamme condition. But, then:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Would the operators still being called &amp;quot;errors&amp;quot; ?&lt;/li&gt;&#xA;&lt;li&gt;If so, can we interpret why they are representing errors ? Indeed in my previous explanation it was quite clear that with the hypothesis I made, &lt;span class=&quot;math-container&quot;&gt;$F_k$&lt;/span&gt; really represented a well defined error after I measured the system. But in a more general context it is more &amp;quot;abstract&amp;quot;. Is there a way to make sense of it ?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A related question on the topic (but different from what I am asking here): &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/6935/intuition-about-knill-laflamme-qec-conditions?noredirect=1&amp;amp;lq=1&quot;&gt;Intuition about Knill-Laflamme QEC conditions&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2021-05-14T14:30:14.810" Title="Clean definition and interpretation of &quot;error&quot; in quantum error correction" Tags="&lt;error-correction&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17502" PostTypeId="1" CreationDate="2021-05-14T16:25:44.603" Score="1" ViewCount="40" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/88pvn.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/88pvn.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Is it possible to translate the above circuit into an equivalent one where the number of interaction gates with the first qubit is 1?&lt;/p&gt;&#xA;" OwnerUserId="8954" LastEditorUserId="55" LastEditDate="2021-05-15T10:11:18.313" LastActivityDate="2021-05-15T10:11:18.313" Title="Transform circuit with 3 CNOTs in one with limited interactions on the first qubit" Tags="&lt;circuit-construction&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17503" PostTypeId="2" ParentId="17502" CreationDate="2021-05-14T16:54:41.920" Score="1" Body="&lt;p&gt;Yes, it is possible.&lt;/p&gt;&#xA;&lt;p&gt;First, let's recall the &lt;strong&gt;bridge-gate&lt;/strong&gt;, which is&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KoLei.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KoLei.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then now, using this fact, we have that&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/5n0ac.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/5n0ac.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;is &lt;strong&gt;equivalent&lt;/strong&gt; to&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7GVyK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7GVyK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;which can be &lt;strong&gt;simplified&lt;/strong&gt; to&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F2zSx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F2zSx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Therefore&lt;/strong&gt;,&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cnOH6.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cnOH6.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-14T17:10:46.487" LastActivityDate="2021-05-14T17:10:46.487" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17504" PostTypeId="1" AcceptedAnswerId="17513" CreationDate="2021-05-14T19:45:18.923" Score="3" ViewCount="43" Body="&lt;p&gt;I have some trouble to understand the proof in Nielsen&amp;amp;Chuang about Knill-Laflamme conditions.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The conditions:&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; be a quantum code and &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; the projector onto &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;. Suppose&#xA;&lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is a quantum operatiion with operation elements&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{E_i\}$&lt;/span&gt;. A necessary and sufficient condition for the existence of&#xA;an error-correction operation &lt;span class=&quot;math-container&quot;&gt;$\mathcal{R}$&lt;/span&gt; correcting &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;&#xA;on &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; is that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P E_i^{\dagger} E_j P = \alpha_{ij} P$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;For some Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; of complex numbers.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;To show the sufficient condition, he diagonalizes the matrix &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt;. Doing this, we end up with a simpler condition:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ P F_k^{\dagger} F_l P = d_{kl} P $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$d_{kl}$&lt;/span&gt; is the matrix element of a diagonal matrix.&lt;/p&gt;&#xA;&lt;p&gt;The polar decomposition tells us that there exist a unitary &lt;span class=&quot;math-container&quot;&gt;$U_k$&lt;/span&gt; such that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F_k P = U_k \sqrt{P F_k^{\dagger} F_k P} = \sqrt{d_{kk}} U_k \sqrt{P} = \sqrt{d_{kk}} U_k P \tag{1}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&lt;p&gt;At this point, he says that the effect of &lt;span class=&quot;math-container&quot;&gt;$F_k$&lt;/span&gt; is therefore to rotate the coding subspace into the subspace defined by the projector:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$P_k \equiv U_k P U_k^{\dagger}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am not sure to understand precisely this statement. I agree that &lt;span class=&quot;math-container&quot;&gt;$P_k F_k P = F_k P$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; stabilizes the space &lt;span class=&quot;math-container&quot;&gt;$F_k C$&lt;/span&gt;. But how to be sure that &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; is exactly a good projector. What I mean is that veryfing &lt;span class=&quot;math-container&quot;&gt;$P_k F_k P = F_k P$&lt;/span&gt; is for sure not enough as &lt;span class=&quot;math-container&quot;&gt;$P_k=I$&lt;/span&gt; would also do the job for instance.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="55" LastEditDate="2021-05-15T08:48:14.387" LastActivityDate="2021-05-15T17:17:55.643" Title="Knill-Laflamme condition derivation in Nielsen&amp;Chuang: issue to understand a part of the proof" Tags="&lt;textbook-and-exercises&gt;&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17505" PostTypeId="1" CreationDate="2021-05-14T19:56:02.987" Score="2" ViewCount="66" Body="&lt;p&gt;How can I make intervals for free parameters when I use VQE function? (&lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.algorithms.VQE.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://qiskit.org/documentation/stubs/qiskit.algorithms.VQE.html&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;I have built a parametrized (&lt;span class=&quot;math-container&quot;&gt;$\theta_1,...,\theta_n$&lt;/span&gt;) circuit without using ansatz in &lt;em&gt;Qiskit Circuit Library&lt;/em&gt; and I would like to set e.g. &lt;span class=&quot;math-container&quot;&gt;$\theta_i \in \left[0,\pi\right]$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14632" LastEditorUserId="14632" LastEditDate="2021-05-14T20:31:29.390" LastActivityDate="2021-05-17T13:46:40.943" Title="Set the bounds for ansatz parameters in VQE" Tags="&lt;qiskit&gt;&lt;vqe&gt;&lt;optimization&gt;&lt;parametrization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17506" PostTypeId="2" ParentId="17490" CreationDate="2021-05-14T20:13:10.940" Score="4" Body="&lt;p&gt;Great observation!&lt;/p&gt;&#xA;&lt;p&gt;The devices are calibrated daily(ish) and sometimes a bad calibration requires a &amp;quot;rerun&amp;quot;. The value 1 is some sort of flag that something went wrong with the calibration.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/UejOw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/UejOw.png&quot; alt=&quot;casablanca calibration values with connection 1_2 = 1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Noise-aware transpilation algorithms will try to avoid that gate as will be presented as particularly noisy.&lt;/p&gt;&#xA;&lt;p&gt;Thanks @paul-nation for the help answering this question!&lt;/p&gt;&#xA;" OwnerUserId="1859" LastActivityDate="2021-05-14T20:13:10.940" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17507" PostTypeId="2" ParentId="17477" CreationDate="2021-05-14T22:26:40.497" Score="1" Body="&lt;p&gt;Yes. The problem has been formulated as a &lt;em&gt;&lt;strong&gt;binary optimization&lt;/strong&gt;&lt;/em&gt; problem.&lt;/p&gt;&#xA;&lt;p&gt;As mentioned in the notebook, &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; denotes the vector of &lt;em&gt;&lt;strong&gt;binary&lt;/strong&gt;&lt;/em&gt; decision variables, which indicates which assets to pick &lt;span class=&quot;math-container&quot;&gt;$x[i]=1$&lt;/span&gt; and which not to pick &lt;span class=&quot;math-container&quot;&gt;$x[i]=0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="14903" LastActivityDate="2021-05-14T22:26:40.497" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17508" PostTypeId="1" CreationDate="2021-05-15T03:14:57.363" Score="1" ViewCount="34" Body="&lt;p&gt;I have a 32 qubit grover's algoritm however whenever I run it on the simulator that IBM offers it always ouputs a probability of 1 on every single result.&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to run circuits larger then 32 qubits without the &amp;quot;randomness&amp;quot; of a quantum computer? I tried but I got an error saying that the simulator only supports up to 16 qubits.&lt;/p&gt;&#xA;&lt;p&gt;I also found that whenever the number of quantum gates is larger then 2000 the simulator just comes back with an error, since the grover operator has to be repeated sqrt(n) number of times this is actually a pretty big issue. Anyone have any idea how to circumvent this?&lt;/p&gt;&#xA;" OwnerUserId="14967" LastActivityDate="2021-05-15T03:14:57.363" Title="issues running a 32 qubit grover's algorithm" Tags="&lt;ibm-q-experience&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17510" PostTypeId="1" AcceptedAnswerId="17514" CreationDate="2021-05-15T10:04:57.980" Score="0" ViewCount="76" Body="&lt;p&gt;If we have the following matrix:&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;1&amp;amp;0&amp;amp;0\\ 1&amp;amp;-1&amp;amp;0&amp;amp;0\\ 0&amp;amp;0&amp;amp;1&amp;amp;-1\\ 0&amp;amp;0&amp;amp;1&amp;amp;1\end{pmatrix}$$&lt;/span&gt;&lt;br /&gt;&#xA;How do we find the output for &lt;span class=&quot;math-container&quot;&gt;$|00\rangle $&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15785" LastEditorUserId="55" LastEditDate="2021-05-15T10:17:48.760" LastActivityDate="2021-05-16T16:07:06.410" Title="How do I apply a matrix to a ket state?" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;matrix-representation&gt;" AnswerCount="2" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17512" PostTypeId="1" AcceptedAnswerId="17515" CreationDate="2021-05-15T17:04:50.987" Score="0" ViewCount="46" Body="&lt;p&gt;In the period finding algorithm (see the picture), through the standard procedure in quantum computing algorithms, we have &lt;span class=&quot;math-container&quot;&gt;$$U_f|\Psi\rangle|0^n\rangle=\frac{1}{\sqrt{2^n}}\left(\sum_{x=0}^{2^n-1}|x\rangle\right)\otimes|f(x)\rangle.$$&lt;/span&gt;&#xA;Then the next key step, we apply the measurement. My question is, if we apply the measurement with computational basis &lt;span class=&quot;math-container&quot;&gt;$P_m$&lt;/span&gt; only in the second component (the space where &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt; lives), then this measurement with respect to the whole composite system is &lt;span class=&quot;math-container&quot;&gt;$I\otimes P_m$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Then follow this viewpoint, the &amp;quot;first&amp;quot; component should not be changed after the measurement right? (Since &lt;span class=&quot;math-container&quot;&gt;$\left(\sum_{x=0}^{2^n-1}|x\rangle\right)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt; are clearly not entangled, i.e. it can be written as the form &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle\otimes|\psi\rangle$&lt;/span&gt;). Therefore the resulting state should be something like &lt;span class=&quot;math-container&quot;&gt;$\underbrace{\left(\sum_{x=0}^{2^n-1}|x\rangle\right)}_{\text{unchanged}}\otimes|f_0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Where did I have the mistake?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/L7OWX.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/L7OWX.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15620" LastEditorUserId="55" LastEditDate="2021-05-15T19:39:30.687" LastActivityDate="2021-05-15T19:40:14.607" Title="Is the final state in the quantum period finding algorithm entangled?" Tags="&lt;algorithm&gt;&lt;shors-algorithm&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17513" PostTypeId="2" ParentId="17504" CreationDate="2021-05-15T17:17:55.643" Score="1" Body="&lt;p&gt;I found the answer. It is just a basic linear algebra property to show but I take the same notations as in the question for clarity.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; be a projector on &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As shown below in this post, a projector on the space &lt;span class=&quot;math-container&quot;&gt;$U_k C$&lt;/span&gt; can always be found as &lt;span class=&quot;math-container&quot;&gt;$P_k = U_k P U_k^{\dagger}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From this property, we see that as &lt;span class=&quot;math-container&quot;&gt;$F_k P \propto U_k P$&lt;/span&gt;, a projector onto &lt;span class=&quot;math-container&quot;&gt;$Im(F_k P)$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$P_k$&lt;/span&gt; which is what is claimed by the book.&lt;/p&gt;&#xA;&lt;h2&gt;Proof&lt;/h2&gt;&#xA;&lt;p&gt;We just need to show that &lt;span class=&quot;math-container&quot;&gt;$Im(P_k)=U_k C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;I first show &lt;span class=&quot;math-container&quot;&gt;$Im(P_k) \subset U_k C$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|y \rangle \in Im(P_k)$&lt;/span&gt;. We thus have: &lt;span class=&quot;math-container&quot;&gt;$|y\rangle=U_k P U_k^{\dagger} |x\rangle$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$|x \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And as &lt;span class=&quot;math-container&quot;&gt;$P U_k^{\dagger} |x\rangle \in C$&lt;/span&gt; (because &lt;span class=&quot;math-container&quot;&gt;$P$&lt;/span&gt; is a projector on &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;), we have &lt;span class=&quot;math-container&quot;&gt;$Im(P_k) \subset U_k C$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Now, I need to show &lt;span class=&quot;math-container&quot;&gt;$U_k C \subset Im(P_k)$&lt;/span&gt;:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|y \rangle \in U_k C$&lt;/span&gt;:&lt;/p&gt;&#xA;&lt;p&gt;For some &lt;span class=&quot;math-container&quot;&gt;$|x \rangle$&lt;/span&gt;, we have: &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = U_k P |x \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also, for some &lt;span class=&quot;math-container&quot;&gt;$|z \rangle$&lt;/span&gt;, we have &lt;span class=&quot;math-container&quot;&gt;$|x \rangle = U_k^{\dagger} |z \rangle$&lt;/span&gt;, thus in the end: &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = U_k P U_k^{\dagger} |z \rangle \in Im(P_k)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; &lt;span class=&quot;math-container&quot;&gt;$Im(P_k)=U_k C$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="5008" LastActivityDate="2021-05-15T17:17:55.643" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17514" PostTypeId="2" ParentId="17510" CreationDate="2021-05-15T18:48:25.030" Score="2" Body="&lt;p&gt;Welcome to quantum computing. When we apply a quantum gate (a unitary matrix) to a state, it is just matrix multiplication. It is good to note that:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \hspace{1 cm} |1\rangle = \begin{pmatrix} 0 \\ 1\end{pmatrix} $$&lt;/span&gt;&#xA;These are the computational basis states for a single qubit. For multi-qubit system, the basis states are built from the tensor product. That is, for a two-qubit system, you have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle \otimes |0\rangle = |00\rangle = \begin{pmatrix} 1 \\ 0 \\0 \\0 \end{pmatrix} \hspace{1 cm}&#xA;|0\rangle \otimes |1\rangle = |01\rangle = \begin{pmatrix} 0 \\ 1 \\0 \\0 \end{pmatrix}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|1\rangle \otimes |0\rangle = |10\rangle = \begin{pmatrix} 0 \\ 0 \\1 \\0 \end{pmatrix} \hspace{1 cm}&#xA;|1\rangle \otimes |1\rangle = |10\rangle = \begin{pmatrix} 0 \\ 0 \\0 \\1 \end{pmatrix}  $$&lt;/span&gt;&#xA;And so suppose you have a unitary matrix &lt;span class=&quot;math-container&quot;&gt;$ U = \begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp;0\\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix}  $&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts on the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;, then to know the output of that, you can simply do:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U|11\rangle = \begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp;0\\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix} \begin{pmatrix} 0 \\ 0 \\0 \\1 \end{pmatrix} = \overbrace{\begin{pmatrix} 0 \\ 0 \\1 \\0 \end{pmatrix}}^{\textrm{output state}}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;However, looking at the calculation this way is pretty cumbersome. What you can do is to recognize that the unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;U = I \otimes X = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; 1 \end{pmatrix} \otimes \begin{pmatrix} 0 &amp;amp; 1\\ 1 &amp;amp; 0 \end{pmatrix} =  \begin{pmatrix} 0 &amp;amp; 1 &amp;amp; 0 &amp;amp;0\\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix}&#xA;\end{align}&lt;/span&gt;&#xA;That is you can think of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; just as &lt;span class=&quot;math-container&quot;&gt;$I \otimes X$&lt;/span&gt;. This is better because you now recall that &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is a bit-flip gate. That is, &lt;span class=&quot;math-container&quot;&gt;$X|0\rangle = |1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X|1\rangle = |0\rangle$&lt;/span&gt;. You can verify this to yourself by take the matrix representation of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and multiply by the statevector representation of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;, and you will see the result is the state vector representation of &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;.&#xA;Furthermore, &lt;a href=&quot;https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps&quot; rel=&quot;nofollow noreferrer&quot;&gt;there is a property of tensor product&lt;/a&gt;, which essentially says that if you two operators, &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; and it acts on the tensor product state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle \otimes |\phi\rangle$&lt;/span&gt;, then it is equivalent to &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; tensor &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; acts on &lt;span class=&quot;math-container&quot;&gt;$|\phi$&lt;/span&gt;. That is,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ \big( U\otimes V \big) ( |\psi \rangle \otimes |\phi \rangle) = \big(U |\psi \rangle \big) \otimes \big(V |\phi \rangle \big) $$&lt;/span&gt;&#xA;This tells us that &lt;span class=&quot;math-container&quot;&gt;$U|11\rangle$&lt;/span&gt; is essentially just&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ (I \otimes X) |11\rangle = I |1\rangle \otimes X|1\rangle = |1\rangle \otimes |0\rangle = |10\rangle $$&lt;/span&gt;&#xA;And now, remember the statevector representation of &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; is the same as the output state we got when we did the matrix representation.&#xA;This way of doing the calculation is less cumbersome and easy to deal with when your system is larger.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Back to your original problem, you can follow the steps I have shown above, just note that your matrix can be written as the tensor product of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. I will let you figure this out as this is a good practice. Once you can write your matrix as the tensor product of &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;, remember that &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H|1\rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}}$&lt;/span&gt;. And of course, as before, &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; is just the identity operator so it doesn't do anything.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="8746" LastEditDate="2021-05-16T16:07:06.410" LastActivityDate="2021-05-16T16:07:06.410" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17515" PostTypeId="2" ParentId="17512" CreationDate="2021-05-15T19:40:14.607" Score="3" Body="&lt;p&gt;The state is indeed entangled. The parenthesis should include the &lt;span class=&quot;math-container&quot;&gt;$|f(x)\rangle$&lt;/span&gt; factor in the equation (otherwise, what would the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; mean?).&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-15T19:40:14.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17516" PostTypeId="1" CreationDate="2021-05-15T20:10:24.110" Score="3" ViewCount="44" Body="&lt;p&gt;Consider a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and let &lt;span class=&quot;math-container&quot;&gt;$\Pi^A\equiv \{\Pi^A_a\}_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Pi^A\equiv\{\Pi^B_b\}_b$&lt;/span&gt; be local projective measurements.&#xA;Suppose that measuring &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in these bases gives uncorrelated outcomes. More precisely, this means that the probability distribution&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(a,b)\equiv \operatorname{Tr}[(\Pi^A_a\otimes \Pi^B_b)\rho],\tag A$$&lt;/span&gt;&#xA;is uncorrelated: &lt;span class=&quot;math-container&quot;&gt;$p(a,b)=p_A(a)p_B(b)$&lt;/span&gt; for some &lt;span class=&quot;math-container&quot;&gt;$p_A,p_B$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I should stress that I'm considering this property for a fixed basis here, so this can easily hold regardless of the separability of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Given &lt;span class=&quot;math-container&quot;&gt;$\Pi^A,\Pi^B$&lt;/span&gt;, is there a way to characterise the set of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; producing uncorrelated measurement outcomes?&lt;/p&gt;&#xA;&lt;p&gt;For example, if the measurements are rank-1 and diagonal in the computational basis, &lt;span class=&quot;math-container&quot;&gt;$\Pi^A_a=\Pi^B_a=|a\rangle\!\langle a|$&lt;/span&gt;, then any state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{ab} \sqrt{p_A(a) p_B(b)} e^{i\varphi_{ab}}|a,b\rangle\tag B$$&lt;/span&gt;&#xA;will give uncorrelated outcomes (assuming of course &lt;span class=&quot;math-container&quot;&gt;$p_A,p_B$&lt;/span&gt; are probability distributions).&#xA;These are product states for &lt;span class=&quot;math-container&quot;&gt;$\varphi_{ij}=0$&lt;/span&gt;, but not in general.&lt;/p&gt;&#xA;&lt;p&gt;Nonpure examples include the maximally mixed state (for any measurement basis) and the completely dephased version of any pure state of the form (B).&lt;/p&gt;&#xA;&lt;p&gt;Is there a way to characterise these states more generally? Ideally, I'm looking for a way to write the general state satisfying the constraints. If this is not possible, some other way to characterise the class more or less directly.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-17T19:28:58.497" Title="What do states that are uncorrelated with respect to a given local measurement look like?" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17517" PostTypeId="1" AcceptedAnswerId="17522" CreationDate="2021-05-16T06:09:12.757" Score="3" ViewCount="45" Body="&lt;p&gt;In the case of the simple three-qubit repetition code, the encoding consists of the mappings &lt;span class=&quot;math-container&quot;&gt;$|0\rangle \rightarrow\left|0_{\mathrm{L}}\right\rangle \equiv|000\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle \rightarrow\left|1_{\mathrm{L}}\right\rangle \equiv|111\rangle$&lt;/span&gt;. For the bit flip channel there are four error syndromes, corresponding to the four projection operators:&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;P_{0} &amp;amp;=|000\rangle\langle 000|+| 111\rangle\langle 111|, \\&#xA;P_{1} &amp;amp;=|100\rangle\langle 100|+| 011\rangle\langle 011|, \\&#xA;P_{2} &amp;amp;=|010\rangle\langle 010|+| 101\rangle\langle 101|, \\&#xA;P_{3} &amp;amp;=|001\rangle\langle 001|+| 110\rangle\langle 110| .&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;In Nilsen and Chuang's book, they stated the syndrome analysis is a measurement, e.g. &lt;span class=&quot;math-container&quot;&gt;$\langle\psi\mid P_1\mid\psi\rangle.$&lt;/span&gt; But we only have one &lt;span class=&quot;math-container&quot;&gt;$\mid\psi\rangle$&lt;/span&gt; at the beginning while four projection operators. I think the measurement should be like:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/tmjdA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/tmjdA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;i.e., the way we would not disturb the original state. But it seems in the textbook, they didn't mention this kind of measurement. Did I understand right?&lt;br /&gt;&#xA;The reason I have this doubt is that I saw a picture in a paper:&lt;a href=&quot;https://i.stack.imgur.com/McS8G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/McS8G.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;where the &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt; in the picture stands for error recovery while there seems no measurement in &lt;span class=&quot;math-container&quot;&gt;$R$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="13968" LastEditDate="2021-05-17T06:23:48.290" LastActivityDate="2021-05-17T11:26:38.610" Title="What does measurement mean in quantum error correction(syndrome diagnosis)?" Tags="&lt;textbook-and-exercises&gt;&lt;error-correction&gt;&lt;nielsen-and-chuang&gt;" AnswerCount="1" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17518" PostTypeId="1" CreationDate="2021-05-16T06:23:44.793" Score="5" ViewCount="104" Body="&lt;p&gt;I was going through the seminal paper of Urmila Mahadev on &lt;a href=&quot;https://arxiv.org/abs/1804.01082&quot; rel=&quot;nofollow noreferrer&quot;&gt;Classical Verification of Quantum Computations&lt;/a&gt;(for an overview see &lt;a href=&quot;https://youtu.be/kql5dSywvy0?t=2269&quot; rel=&quot;nofollow noreferrer&quot;&gt;this excellent talk by her&lt;/a&gt;). As a physicist by training, I am not very familiar with cryptographic strategies. Thus, I am not sure how exactly an adversary prover can get away with cheating if he can break the computational assumption of hardness of LWE (learning with errors) and thereby find a claw for the Trapdoor claw-free function pair.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, the protocols starts out with the quantum prover creating an arbitrary state that he expects to pass the Local Hamiltonian test (so ideally the ground state of the Hamiltonian). For this state, the prover just looks at a single qubit part of his state (I am also very confused as to how the entanglement between the different qubits don't play any role here) and the author assumes this to be some pure state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=\alpha_0|0\rangle+\alpha_1|1\rangle. $&lt;/span&gt; To commit to this state, the prover entangles this state with the two pre-images &lt;span class=&quot;math-container&quot;&gt;$x_0,x_1$&lt;/span&gt; of the trapdoor clawfree function pair &lt;span class=&quot;math-container&quot;&gt;$f_0,f_1$&lt;/span&gt; using a quantum oracle and sends back the classical string &lt;span class=&quot;math-container&quot;&gt;$y=f(x_0)=f(x_1)$&lt;/span&gt;. At this point, the prover holds the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{ent}\rangle=\alpha_0|0\rangle|x_0\rangle+\alpha_1|1\rangle|x_1\rangle$&lt;/span&gt; which is a state that he himself doesn't know the full description of because it is hard to know &lt;span class=&quot;math-container&quot;&gt;$x_0 \; \text{and}\; x_1$&lt;/span&gt; (actually even one of bit of &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt;) simultaneously. The rest of the paper uses this ignorance to tie the hands of the prover and states that if the prover applies some arbitrary unitary to his state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{enc}\rangle$&lt;/span&gt; this U is computationally randomized both by the state encoding and the decoding of the verifier.&lt;/p&gt;&#xA;&lt;p&gt;But my question is a lot simpler (and naive). I don't understand how the prover can apply an arbitary unitary even if he knew the full description of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi_{enc}\rangle$&lt;/span&gt;. If the ground state of the Hamiltonian is unique, how can the prover apply a known unitary to his state and still expect to pass the Local Hamiltonian test? I am sure I am missing something trivial.&lt;/p&gt;&#xA;&lt;p&gt;Also, it would be nice if someone can explain why the entanglement between the different qubit of the ground state can be just ignored and why the mixed case treatment is identical to the analysis done assuming pure states for each qubit.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;" OwnerUserId="13809" LastEditorUserId="2927" LastEditDate="2021-05-18T15:48:18.793" LastActivityDate="2021-05-18T15:48:18.793" Title="How can one cheat in Mahadev's classical verification protocol if one can find a &quot;claw''?" Tags="&lt;entanglement&gt;&lt;complexity-theory&gt;&lt;unitarity&gt;&lt;cryptography&gt;&lt;qma&gt;" AnswerCount="1" CommentCount="4" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17519" PostTypeId="2" ParentId="17510" CreationDate="2021-05-16T09:08:19.927" Score="1" Body="&lt;p&gt;To add onto KAJ226's answer, you can see that &lt;span class=&quot;math-container&quot;&gt;$|00\rangle, |01\rangle, |10\rangle, |11\rangle$&lt;/span&gt; form the computational basis. You can also see that since there is a &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; in only one coefficient of the vector, it will only &amp;quot;consider&amp;quot; one column when you multiply it. For example :&#xA;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \\ \end{pmatrix}$&lt;/span&gt; where the &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; is the 4th coefficient, and all other coefficients are &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;. This means that when multiplying your matrix : &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{\sqrt{2}}\begin{pmatrix}1&amp;amp;1&amp;amp;0&amp;amp;0\\ 1&amp;amp;-1&amp;amp;0&amp;amp;0\\ 0&amp;amp;0&amp;amp;1&amp;amp;-1\\ 0&amp;amp;0&amp;amp;1&amp;amp;1\end{pmatrix}*\begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \\ \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 0 \\ -1 \\ 1 \\ \end{pmatrix}$&lt;/span&gt;, you can see, this gives us the 4th column of the matrix. This neat little trick can save a lot of time.&lt;/p&gt;&#xA;" OwnerUserId="8746" LastActivityDate="2021-05-16T09:08:19.927" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17520" PostTypeId="1" AcceptedAnswerId="17526" CreationDate="2021-05-16T10:45:00.423" Score="3" ViewCount="83" Body="&lt;p&gt;Consider a bipartite state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, and denote with &lt;span class=&quot;math-container&quot;&gt;$\Pi^A\equiv \{\Pi^A_a\}_a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\Pi^A\equiv\{\Pi^B_b\}_b$&lt;/span&gt; local projective measurements.&#xA;Let the associated joint probability distribution be &lt;span class=&quot;math-container&quot;&gt;$p_\Pi$&lt;/span&gt;, and denote with &lt;span class=&quot;math-container&quot;&gt;$p_{\Pi,A},p_{\Pi,B}$&lt;/span&gt; the marginal distributions:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_\Pi(a,b)\equiv \operatorname{Tr}[(\Pi^A_a\otimes \Pi^B_b)\rho],&#xA;\quad p_{\Pi,A}(a) \equiv \operatorname{Tr}[(\Pi^A_a\otimes I)\rho],&#xA;\quad p_{\Pi,B}(b) \equiv \operatorname{Tr}[(I\otimes \Pi^B_b)\rho]. \tag A$$&lt;/span&gt;&#xA;We say that the measurement outcomes are &lt;em&gt;uncorrelated&lt;/em&gt; if &lt;span class=&quot;math-container&quot;&gt;$p_\Pi(a,b)=p_{\Pi,A}(a)p_{\Pi,B}(b)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure and separable (&lt;em&gt;i.e.&lt;/em&gt; it is a product state), then regardless of the choice of &lt;span class=&quot;math-container&quot;&gt;$\Pi_A,\Pi_B$&lt;/span&gt; we always have uncorrelated outcomes.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is separable but not necessarily pure, this is no longer the case, intuitively because one can have &amp;quot;classical correlations&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;A pure, entangled state also always gives rise to correlations, if measured in the basis of its Schmidt decomposition.&lt;/p&gt;&#xA;&lt;p&gt;What about a generic entangled state? Given an arbitrary entangled &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, is there always a measurement basis with respect to which measurement outcomes are correlated? While this sounds like it must be the case, I'm failing to see a good way to show it at the moment.&lt;/p&gt;&#xA;&lt;p&gt;More formally, this is akin to asking whether there is an entangled state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; such that, for &lt;em&gt;any&lt;/em&gt; pair of projective measurements &lt;span class=&quot;math-container&quot;&gt;$\Pi^A,\Pi^B$&lt;/span&gt; (though I think one can more generally take any local POVM here), we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}[(\Pi^A_a\otimes\Pi^B_b)\rho]&#xA;= \operatorname{Tr}(\Pi^A_a\rho_A)&#xA;\operatorname{Tr}(\Pi^B_b\rho_B).$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-16T12:47:40.073" LastActivityDate="2021-05-17T09:33:00.687" Title="Do entangled states always result in some form of correlation?" Tags="&lt;entanglement&gt;&lt;correlations&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17521" PostTypeId="1" CreationDate="2021-05-16T15:08:51.620" Score="0" ViewCount="24" Body="&lt;p&gt;I have a density made up of 4 qubits. Say system A is made up of the first and second qubits while system B is made up of qubits 3 and 4. I want to trace out 2nd and 3rd qubits.&lt;/p&gt;&#xA;&lt;p&gt;Is there any reference available to trace out qubits from a multipartite density matrix?&lt;/p&gt;&#xA;" OwnerUserId="13039" LastEditorUserId="55" LastEditDate="2021-05-16T16:20:18.813" LastActivityDate="2021-05-16T16:20:18.813" Title="How to trace out qubits from a multipartite density matrix" Tags="&lt;textbook-and-exercises&gt;&lt;density-matrix&gt;&lt;partial-trace&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-05-17T03:01:53.270" ContentLicense="CC BY-SA 4.0" />
  <row Id="17522" PostTypeId="2" ParentId="17517" CreationDate="2021-05-16T16:59:35.570" Score="1" Body="&lt;p&gt;What you have is somewhat equivalent to the book in the following sense.&lt;/p&gt;&#xA;&lt;p&gt;Your ancillae are here measuring the parity between your qubits. If you measure the ancillae in the computational basis you will find:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;: all qubit have the same parity. The state of the data qubits is thus projected in &lt;span class=&quot;math-container&quot;&gt;$Im(P_0)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;: two first qubit have same parity but not the two last. The state of the data qubits is thus projected in &lt;span class=&quot;math-container&quot;&gt;$Im(P_3)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;: two first qubit don't have same parity, but two last do. The state of the data qubits is projected in &lt;span class=&quot;math-container&quot;&gt;$Im(P_1)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;: two first and two last qubits don't have the same parity. The state of the data qubits is in &lt;span class=&quot;math-container&quot;&gt;$Im(P_2)$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In conclusion:&lt;/p&gt;&#xA;&lt;p&gt;Performing the circuit you drawed, and measuring the ancillae qubit will project your system in the space associated to one of your projector depending on the outcome you find on those ancillae. Then you can apply the appropriate recovery to correct.&lt;/p&gt;&#xA;&lt;p&gt;[edit] To answer some of the issues about the projector.&lt;/p&gt;&#xA;&lt;p&gt;In Q.M postulate we do not &amp;quot;choose&amp;quot; a projector when we measure. A measurement can be defined by a collection of projectors &lt;span class=&quot;math-container&quot;&gt;$\{P_k\}$&lt;/span&gt; verifying &lt;span class=&quot;math-container&quot;&gt;$\sum_k P_k = I$&lt;/span&gt;. If you measure (and read the outcome), the density matrix will be transformed as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \rho \to P_k \rho P_k/ Tr(\rho P_k)$$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$p_k = Tr(\rho P_k)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In practice all the projectors play a role in the measurement. Indeed, as you see, you must compute a probability of outcome for each of the projector. In your example, in your comment you would find &lt;span class=&quot;math-container&quot;&gt;$Tr(\rho P_2)=0$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$\rho=|\psi_e \rangle \langle \psi_e |$&lt;/span&gt; that you defined.  Thus such projection has a probability &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; to occur.&lt;/p&gt;&#xA;&lt;p&gt;In the context of this question, in the non autonomous scenario, if ancillae are found in &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;, the density matrix of data qubits will become &lt;span class=&quot;math-container&quot;&gt;$P_0 \rho P_0/Tr(\rho P_0)$&lt;/span&gt;, if the ancillae are found in &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;, the density matrix of data qubits will becomes &lt;span class=&quot;math-container&quot;&gt;$P_3 \rho P_3/Tr(\rho P_3)$&lt;/span&gt; and so on.&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2021-05-17T11:26:38.610" LastActivityDate="2021-05-17T11:26:38.610" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17523" PostTypeId="1" AcceptedAnswerId="17533" CreationDate="2021-05-17T01:47:29.913" Score="1" ViewCount="72" Body="&lt;p&gt;We have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\left(t\right)\rangle=e^{-iH_{NL}t}|N\rangle_{a}|0\rangle_{b}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Also&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\left(t\right)\rangle=\sum_{n=0}^{N}c_{n}\left(t\right)|N_{1}\rangle_{a}|N_{2}\rangle_{b}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I would like to know whether&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$c_{n}\left(t\right)=\langle N_{2}|\langle N_{1}|e^{-iH_{NL}t}|N_{1}\rangle_{a}|N_{2}\rangle_{b}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;is the right way to express.&lt;/p&gt;&#xA;" OwnerUserId="14814" LastEditorUserId="55" LastEditDate="2021-05-18T07:57:48.343" LastActivityDate="2021-05-18T07:57:48.343" Title="Given $|\psi\left(t\right)\rangle=\sum_{n=0}^{N}c_{n}\left(t\right)|N_{1}\rangle_{a}|N_{2}\rangle_{b}$, what is the expression for $c_n(t)$?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17524" PostTypeId="2" ParentId="7099" CreationDate="2021-05-17T06:47:26.257" Score="2" Body="&lt;p&gt;Computationally, the easiest way to do this is probably as follows:&lt;/p&gt;&#xA;&lt;p&gt;Let your state be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\psi\rangle=\sum_{i,j,k,l}c_{ijkl}|ij\rangle_A|kl\rangle_B&#xA;$$&lt;/span&gt;&#xA;Rewrite this as a matrix&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;C=\sum_{i,j,k,l}c_{ijkl}|ij\rangle\langle kl|&#xA;$$&lt;/span&gt;&#xA;Effectively, you just have to reshape your numpy array.&lt;/p&gt;&#xA;&lt;p&gt;Then, you can calculate&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_A=CC^\dagger&#xA;$$&lt;/span&gt;&#xA;or&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho_B=C^\dagger C.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-17T06:47:26.257" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17525" PostTypeId="1" AcceptedAnswerId="17527" CreationDate="2021-05-17T09:24:44.693" Score="4" ViewCount="83" Body="&lt;p&gt;Let's say we have a list of stabilizers: {'YZY*', 'XYY*', 'YZYZ', 'Z*Z*', '*XZ*', 'XZX*', 'ZX*Z', 'XZXZ', 'YYX*', 'Z*ZZ'}. Is there any existed formula or function (eg. in qiskit) that can calculate its generators?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2021-05-17T10:22:13.260" LastActivityDate="2021-05-17T10:22:13.260" Title="How to calculate the generators of a list of stabilizer?" Tags="&lt;qiskit&gt;&lt;error-correction&gt;&lt;stabilizer-state&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17526" PostTypeId="2" ParentId="17520" CreationDate="2021-05-17T09:33:00.687" Score="3" Body="&lt;p&gt;Yes, they do. If it were true that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\operatorname{Tr}[(\Pi^A_a\otimes\Pi^B_b)\rho]&#xA;= \operatorname{Tr}(\Pi^A_a\rho_A)&#xA;\operatorname{Tr}(\Pi^B_b\rho_B)$$&lt;/span&gt;&#xA;for all POVMs (or projective measurements, it doesn't make a difference), then we would just have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \rho_A \otimes \rho_B,$$&lt;/span&gt;&#xA;because you'd be in particular doing tomography of your quantum state. Now such a state cannot be even classically correlated, much less entangled.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-05-17T09:33:00.687" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="17527" PostTypeId="2" ParentId="17525" CreationDate="2021-05-17T10:16:21.030" Score="3" Body="&lt;p&gt;The way that I'd do it is to write out the stabilizers in a &lt;span class=&quot;math-container&quot;&gt;$10\times 8$&lt;/span&gt; matrix in this case (number of rows= number of stabilizers, number of columns is double the number of qubits). For each row, take a stabilizer and write out, for the first 4 columns, if there's an &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on a given qubit, and in the last 4 columns, if there's a &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; on a given qubit (remember, &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; contains both &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Then, I'd simply run row reduction on my matrix (modulo 2). I don't know how to do this in qiskit, but Mathematica has the handy function RowReduce that can work modulo 2.&lt;/p&gt;&#xA;&lt;p&gt;In essence, you're running Gram-Schmidt asking if each stabilizer in turn can be created as a product of the stabilizers already in your set.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-17T10:16:21.030" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="17528" PostTypeId="1" CreationDate="2021-05-17T10:39:53.270" Score="1" ViewCount="19" Body="&lt;p&gt;Is this [1] type of error correction also usable for &lt;strong&gt;ion-trap&lt;/strong&gt; based quantum computers?&#xA;Is it quantum technology dependent?&lt;/p&gt;&#xA;&lt;p&gt;[1] P. Das et al., “A Scalable Decoder Micro-architecture for Fault-Tolerant Quantum Computing,” pp. 1–19, 2020. arXiv:2001.06598v1 &lt;a href=&quot;https://arxiv.org/abs/2001.06598&quot; rel=&quot;nofollow noreferrer&quot;&gt;online available&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15908" LastActivityDate="2021-05-17T10:39:53.270" Title="Is this QEC scheme technology dependant?" Tags="&lt;physical-realization&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-05-19T08:24:16.060" ContentLicense="CC BY-SA 4.0" />
  <row Id="17529" PostTypeId="2" ParentId="2513" CreationDate="2021-05-17T13:09:11.240" Score="2" Body="&lt;p&gt;IBM tutorial's representation of a general unitary matrix &lt;span class=&quot;math-container&quot;&gt;$U(\theta,\phi,\lambda)$&lt;/span&gt; can be derived as rotation of qubit on the Bloch sphere, in much the same way as the pdf reference has derived &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\alpha)$&lt;/span&gt;. But, these are two different ways of doing the same operation, requiring different user inputs. &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\alpha)$&lt;/span&gt; considers rotation of qubit &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; about an arbitrary axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;, whereas,  &lt;span class=&quot;math-container&quot;&gt;$U(\theta,\phi,\lambda)$&lt;/span&gt; is directly manipulating initial qubit state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|\psi '\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/CbHm0l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/CbHm0l.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The above figure shows qubit manipulation as rotation in a Bloch sphere representation in both ways. Either-&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The initial qubit state can be rotated about &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis by angle &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt;, then about &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; axis by angle &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt;, and finally about &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; axis by angle &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;, to achieve &lt;span class=&quot;math-container&quot;&gt;$|\psi '\rangle$&lt;/span&gt;. In matrix form, this can be written as:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array}&#xA;\ U(\theta , \phi , \lambda) &amp;amp;= R_{Z}(\phi)R_{Y}(\theta)R_{Z}(\lambda) \\&#xA;&amp;amp;= &#xA;\begin{bmatrix}&#xA;e^{-i\phi/2} &amp;amp; 0\\ &#xA;0 &amp;amp; e^{i\phi/2} \end{bmatrix}&#xA;\begin{bmatrix}&#xA;cos(\theta/2) &amp;amp; -sin(\theta/2)\\ &#xA;sin(\theta/2) &amp;amp; cos(\theta/2)\end{bmatrix}&#xA;\begin{bmatrix}&#xA;e^{-i\lambda/2} &amp;amp; 0\\ &#xA;0 &amp;amp; e^{i\lambda/2} \end{bmatrix}\\&#xA;&amp;amp;=&#xA;\begin{bmatrix}&#xA;cos(\theta/2)e^{-i\phi/2} &amp;amp; -sin(\theta/2)e^{-i\phi}\\&#xA;sin(\theta/2)e^{i\phi/2} &amp;amp; cos(\theta/2)e^{i\phi/2}&#xA;\end{bmatrix}&#xA;\begin{bmatrix}&#xA;e^{-i\lambda/2} &amp;amp; 0\\ &#xA;0 &amp;amp; e^{i\lambda/2} \end{bmatrix}\\&#xA;&amp;amp;=e^{-i(\phi+\lambda)/2}&#xA;\begin{bmatrix}&#xA;cos(\theta/2) &amp;amp; -sin(\theta/2)e^{-i\lambda}\\&#xA;sin(\theta/2)e^{-i\phi} &amp;amp; cos(\theta/2)e^{i\{\phi+\lambda\}}&#xA;\end{bmatrix}\\&#xA;&amp;amp;=&#xA;\begin{bmatrix}&#xA;cos(\theta/2) &amp;amp; -sin(\theta/2)e^{-i\lambda}\\&#xA;sin(\theta/2)e^{-i\phi} &amp;amp; cos(\theta/2)e^{i\{\phi+\lambda\}}&#xA;\end{bmatrix}\mbox{, equal upto the global phase factor}&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Or, the operation of single qubit unitary gate can be visualized as rotation about arbitrary axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;, i.e., first bringing &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; parallel to &lt;span class=&quot;math-container&quot;&gt;$|Z\rangle$&lt;/span&gt;, and then, rotating &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; by an angle &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; about &lt;span class=&quot;math-container&quot;&gt;$|Z\rangle$&lt;/span&gt; axis, followed by bringing &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt; back to its original position, as follows:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{array}&#xA;\ R_{\hat{n}}(\alpha) &amp;amp;= f(\alpha, n_{\theta}, n_{\phi}) \\&#xA;&amp;amp;= R_Z(n_{\phi})R_Y(n_{\theta})R_Z(\alpha)R_Y(-n_{\theta})R_Z(-n_{\phi}) \\&#xA;&amp;amp;= &#xA;\begin{bmatrix}&#xA;cos(\alpha/2)-isin(\alpha/2)cos(n_{\theta}) &amp;amp; -isin(\alpha/2)sin(n_{\theta})e^{-i\phi}\\ &#xA;-isin(\alpha/2)sin(n_{\theta})e^{i\phi} &amp;amp; cos(\alpha/2)+isin(\alpha/2)cos(n_{\theta}) \end{bmatrix}&#xA;\end{array}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I guess, the reason &lt;span class=&quot;math-container&quot;&gt;$U(\theta,\phi,\lambda)$&lt;/span&gt; is an easier choice over &lt;span class=&quot;math-container&quot;&gt;$R_{\hat{n}}(\alpha)$&lt;/span&gt; is because:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;For a given initial and final qubit states, there is a unique magnitude of &lt;span class=&quot;math-container&quot;&gt;$(\theta, \phi, \lambda)$&lt;/span&gt; representating unitary qubit gate, but, the same cannot be said about combination &lt;span class=&quot;math-container&quot;&gt;$(\alpha, \hat{n})$&lt;/span&gt;. This is because, any of the axis present on the perpendicular angle bisector plane, bisecting the angle between initial and final qubit Bloch vector, can represent that unitary gate. Off course,  &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; will be decided on the choice of rotation axis chosen. &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; can be found out  by noting the angle between projections of &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi '\rangle$&lt;/span&gt; on plane normal to axis &lt;span class=&quot;math-container&quot;&gt;$\hat{n}$&lt;/span&gt;. (not shown in the figure).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Given a 2x2 unitary matrix, its much easier to find &lt;span class=&quot;math-container&quot;&gt;$(\theta, \phi, \lambda)$&lt;/span&gt; than finding &lt;span class=&quot;math-container&quot;&gt;$(\alpha, n_{\theta}, n_{\phi})$&lt;/span&gt;. Though, one may argue that, finding &lt;span class=&quot;math-container&quot;&gt;$(\alpha, n_{x}, n_{y}, n_{z})$&lt;/span&gt; is much easier. But, that's besides the point, and&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Its far more initiative to think of directly rotating initial qubit to final state, then bringing a third vector into picture to do the job.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;One may try finding relation between the two matrices which, in this analysis, essentially boils down to finding the relations between &lt;span class=&quot;math-container&quot;&gt;$(\theta, \phi, \lambda)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$(\alpha, n_{\theta}, n_{\phi})$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="13414" LastActivityDate="2021-05-17T13:09:11.240" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17530" PostTypeId="2" ParentId="17505" CreationDate="2021-05-17T13:46:40.943" Score="3" Body="&lt;p&gt;You can set the attribute parameters_bounds of a circuit to the desired intervals like below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;from qiskit.circuit import Parameter&#xA;a=Parameter('a')&#xA;b=Parameter('b')&#xA;ansatz=QuantumCircuit(2)&#xA;ansatz.ry(a,0)&#xA;ansatz.ry(b,1)&#xA;ansatz.parameter_bounds=[[0,np.pi]]*2 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then you can run your vqe program.&lt;/p&gt;&#xA;" OwnerUserId="12386" LastActivityDate="2021-05-17T13:46:40.943" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17531" PostTypeId="1" AcceptedAnswerId="17532" CreationDate="2021-05-17T14:20:07.797" Score="3" ViewCount="51" Body="&lt;p&gt;Is there a quantum circuit that encodes the statevector so that the coefficients of the statevector &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; corresponds to a &lt;strong&gt;discrete&lt;/strong&gt; representation of &lt;span class=&quot;math-container&quot;&gt;$sin(kx)$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$[0,1]$&lt;/span&gt;?&#xA;In particular, I'd like to have a set of gates that scales and works for all qubit number &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;. I'd be happy with &lt;span class=&quot;math-container&quot;&gt;$sin(x)$&lt;/span&gt; but ideally, I'm looking for higher frequencies multiples as well.&lt;/p&gt;&#xA;&lt;p&gt;By statevector I am referring to the set of probabilities &lt;span class=&quot;math-container&quot;&gt;$(\psi_1,\psi_2,...,\psi_N)$&lt;/span&gt; associated with &lt;span class=&quot;math-container&quot;&gt;$|00...0\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|00...1\rangle$&lt;/span&gt;,...,&lt;span class=&quot;math-container&quot;&gt;$|11...1\rangle$&lt;/span&gt; that one gets when reading the output. Please note that I am thinking in the framework of variational algorithms. In these cases, given a qubit register &lt;span class=&quot;math-container&quot;&gt;$|\textbf{q}\rangle=|q_1\rangle \otimes ... \otimes |q_n\rangle$&lt;/span&gt;, we encode vectors as&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;|\psi\rangle=\sum_{k=0}^{N-1} \psi_k |\text{binary(k)}\rangle&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is this vector in particular whose entries &lt;span class=&quot;math-container&quot;&gt;$\psi_i$&lt;/span&gt; I want to encode to represent a sine. For example, for 3 qubits this vector will have &lt;span class=&quot;math-container&quot;&gt;$N=8$&lt;/span&gt; entries. If you divide [0,1] uniformly in &lt;span class=&quot;math-container&quot;&gt;$[x_0, ...,x_{N-1}]$&lt;/span&gt;, I am looking for an unitary such that &lt;span class=&quot;math-container&quot;&gt;$\psi_i=sin(x_i)$&lt;/span&gt;. (Or I guess would be more correct to say &lt;span class=&quot;math-container&quot;&gt;$sin(2\pi x_i)$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;If possible, I'm looking for both theoretical explanation and &lt;em&gt;practical&lt;/em&gt; circuit implementation that I could run and test (not just &amp;quot;theoretically there is an oracle...&amp;quot; etc.). Also, among the possible set of unitaries, clearly the shallower and less connected, the better.&lt;/p&gt;&#xA;&lt;p&gt;If the question isn't clear please ask for clarification in the comments - I'll be happy to improve it.&lt;/p&gt;&#xA;" OwnerUserId="11551" LastEditorUserId="11551" LastEditDate="2021-05-17T15:36:37.960" LastActivityDate="2021-05-17T15:36:37.960" Title="How to represent a sine function in the statevector $|\psi\rangle = sin(kx)$" Tags="&lt;quantum-gate&gt;&lt;unitarity&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17532" PostTypeId="2" ParentId="17531" CreationDate="2021-05-17T14:54:42.250" Score="2" Body="&lt;p&gt;It's worth noting that the Fourier transform implements&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|\Psi\rangle=U_{QFT}|0\rangle=\frac{1}{\sqrt{2^n}}\sum_{j=0}^{2^n-1}e^{2\pi i\frac{j}{2^n}}|j\rangle,&#xA;$$&lt;/span&gt;&#xA;so for some particular choice of frequency, what you're effectively asking for is, up to normalisation,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{Im}(|\Psi\rangle).&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, there's a neat way to do this. There's a standard proof that demonstrates that only-real-amplitude quantum computation is just as powerful as quantum computation (see definition 1 in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301040&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;) - you add a single ancilla qubit whose 0/1 value represents whether the amplitude is real or imaginary. So, if you implement the quantum Fourier transform using this circuit construction, and you measure that ancilla qubit, if you find it to be in the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state, you've created exactly the state you want. I believe this happens with probability &lt;span class=&quot;math-container&quot;&gt;$1/2$&lt;/span&gt;, so repeat until success is a very reasonable strategy. Alternatively, you could apply amplitude amplification, but that will make your circuit much more complicated.&lt;/p&gt;&#xA;&lt;p&gt;If you want different frequencies (within limits), just choose a different number of qubits to use! You can also vary which basis element the input state is.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-05-17T15:03:08.313" LastActivityDate="2021-05-17T15:03:08.313" CommentCount="13" ContentLicense="CC BY-SA 4.0" />
  <row Id="17533" PostTypeId="2" ParentId="17523" CreationDate="2021-05-17T15:47:57.527" Score="1" Body="&lt;p&gt;If we label the expansion coefficients as &lt;span class=&quot;math-container&quot;&gt;$c_{N_1,N_2}(t)$&lt;/span&gt; as suggested in the comments, the correct expression will be&#xA;&lt;span class=&quot;math-container&quot;&gt;$$c_{N_1,N_2}(t)= \vphantom{a}_a\langle N_1| \vphantom{a}_b\langle N_2|\psi(t)\rangle= \vphantom{a}_a\langle N_1| \vphantom{a}_b\langle N_2|e^{-i H_{NL}t}|N\rangle_a|0\rangle_b.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Responding to the comment: some people write their Hilbert spaces in opposite order when using bras, preferring to write this expression as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$c_{N_1,N_2}(t)=  \vphantom{a}_b\langle N_2|\vphantom{a}_a\langle N_1|\psi(t)\rangle=  \vphantom{a}_b\langle N_2|\vphantom{a}_a\langle N_1|e^{-i H_{NL}t}|N\rangle_a|0\rangle_b.$$&lt;/span&gt; This does not change the answer, so long as the appropriate subscripts are used to appropriately match the Hilbert spaces.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastEditorUserId="15820" LastEditDate="2021-05-18T01:10:32.713" LastActivityDate="2021-05-18T01:10:32.713" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17534" PostTypeId="1" AcceptedAnswerId="17535" CreationDate="2021-05-17T17:12:10.133" Score="2" ViewCount="27" Body="&lt;p&gt;From Quantum Information Theory by Mark Wilde, pg 243 asks to show that &lt;span class=&quot;math-container&quot;&gt;$F(\psi, \phi) = [\sum_{x}\sqrt{p(x)q(x)}]^{2}$&lt;/span&gt;, which is described as the Bhattacharyya overlap, or classical fidelity, between distributions &lt;span class=&quot;math-container&quot;&gt;$p(x)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$q(x)$&lt;/span&gt;. However, anywhere I look it up, said overlap is given as &lt;span class=&quot;math-container&quot;&gt;$\sum_{x}\sqrt{p(x)q(x)}$&lt;/span&gt;. No square is involved. Moreover, I am unsure if the means by which I arrive at this is correct?&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle = \sum_{x}\sqrt{p(x)}|x\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle = \sum_{x}\sqrt{q(x)}|x\rangle$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; is an orthonormal basis, if get:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\psi,\phi)=|\langle \psi|\phi\rangle|^{2}=\sqrt{\langle \psi|\phi\rangle\langle \phi|\psi\rangle}^{2}= \sqrt{\sum_{x}\sqrt{p(x)}\sqrt{q(x)}\sum_{x}\sqrt{q(x)}\sqrt{p(x)}}^{2}=$$&lt;/span&gt;&lt;br /&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;=\sqrt{\left(\sum_{x}\sqrt{p(x)q(x)}\right)^{2}}^{2}=\left(\sum_{x}\sqrt{p(x)q(x)}\right)^{2}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This looks right, but it's not equal to the overlap it is supposedly equivalent to, and I wonder if I have made an error somewhere?&lt;/p&gt;&#xA;" OwnerUserId="4991" LastEditorUserId="55" LastEditDate="2021-05-17T19:11:48.707" LastActivityDate="2021-05-17T19:11:48.707" Title="How does $F(\psi, \phi) = [\sum_{x}\sqrt{p(x)q(x)}]^{2}$" Tags="&lt;information-theory&gt;&lt;fidelity&gt;" AnswerCount="1" CommentCount="0" ClosedDate="2021-05-17T20:20:50.817" ContentLicense="CC BY-SA 4.0" />
  <row Id="17535" PostTypeId="2" ParentId="17534" CreationDate="2021-05-17T18:12:37.107" Score="2" Body="&lt;p&gt;This is just a difference in definition. For example the fidelity defined in Nielsen and Chuang is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;F(\rho, \sigma) = \text{tr}\sqrt{\rho^{1/2} \sigma \rho^{1/2}}&#xA;$$&lt;/span&gt;&#xA;which for pure states becomes&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;F(\psi, \phi) &amp;amp;= \text{tr}\sqrt{|\psi\rangle\langle\psi| \phi\rangle\langle\phi| \psi\rangle\langle\psi|} \\&#xA;&amp;amp;=\sqrt{\langle\psi| \phi\rangle\langle\phi| \psi\rangle}\cdot\text{tr}\sqrt{|\psi\rangle\langle\psi|} \\&#xA;&amp;amp;= |\langle \psi|\phi \rangle|&#xA;\end{align}&lt;/span&gt;&#xA;and this definition is consistent with the formula you recovered for Bhattacharyya distance between distributions, &lt;span class=&quot;math-container&quot;&gt;$BC(p, q) \equiv \sum_{x}\sqrt{p(x)q(x)}$&lt;/span&gt; (see Nielsen and Chuang, eqn 9.2).&lt;/p&gt;&#xA;&lt;p&gt;If you replace &lt;span class=&quot;math-container&quot;&gt;$F(\psi, \phi)= |\langle \psi|\phi \rangle|$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$F'(\psi, \phi)= |\langle \psi|\phi \rangle|^2 = F(\psi, \phi)^2$&lt;/span&gt; which appears to be definition that the author is using, then you will instead derive &lt;span class=&quot;math-container&quot;&gt;$F'(\psi, \phi) = BC(p, q)^2$&lt;/span&gt; as you have done.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-05-17T18:12:37.107" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17536" PostTypeId="2" ParentId="17516" CreationDate="2021-05-17T19:28:58.497" Score="0" Body="&lt;p&gt;Here's another example that works, essentially extending the rank-&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; argument to arbitrary rank. Suppose all of the projectors within a set are orthogonal to each other. We can write each projector as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\Pi^A_0=\sum_{i=0}^{n_0(A)} |i\rangle\langle i|,\quad \Pi^A_1=\sum_{i=n_0(A)+1}^{n_0(A)} |i\rangle\langle i|,\quad\cdots$$&lt;/span&gt; for some integers &lt;span class=&quot;math-container&quot;&gt;$n_0&amp;lt;n_1&amp;lt;\cdots$&lt;/span&gt; that depend on the fixed measurement basis and can differ between the two systems &lt;span class=&quot;math-container&quot;&gt;$n_i(A)\neq n_i(B)$&lt;/span&gt;.&#xA;We can define a general eigenstate of each projection operator as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi_a^A\rangle=\sum_{i=n_a(A)}^{n_{a+1}(A)}\phi_i|i\rangle$$&lt;/span&gt; for any amplitudes &lt;span class=&quot;math-container&quot;&gt;$\phi_i$&lt;/span&gt; that could depend on &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;, and similarly for system &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt;.&#xA;Then any state of the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\sum_k \rho_k|\Phi_k\rangle\langle\Phi_k|$$&lt;/span&gt; with each component pure state taking the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\Phi_k\rangle=\sum_{a,b}\Phi_{a,b} |\phi_a^A\rangle |\phi_b^B\rangle$$&lt;/span&gt; will generate the measurement results&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p(a,b)=\sum_k \rho_k \langle\phi_a^A|\Pi^A_a|\phi_a^A\rangle\langle\phi_b^B|\Pi^B_b|\phi_b^B\rangle.$$&lt;/span&gt; Each of &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$\langle\phi_a^A|\Pi^A_a|\phi_a^A\rangle$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$\langle\phi_b^B|\Pi^B_b|\phi_b^B\rangle$&lt;/span&gt; is positive, so I suspect &lt;span class=&quot;math-container&quot;&gt;$p(a,b)$&lt;/span&gt; to only be uncorrelated when there is a single nonzero &lt;span class=&quot;math-container&quot;&gt;$\rho_k$&lt;/span&gt;. This means that one could only consider pure states that satisfy some strange condition that looks reminiscient of mixed-state separability. Thoughts?&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-17T19:28:58.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17537" PostTypeId="1" CreationDate="2021-05-17T20:31:34.133" Score="5" ViewCount="74" Body="&lt;p&gt;In quantum information it is commonly said that a set of states &lt;span class=&quot;math-container&quot;&gt;$S=\{ \rho_i \}_i$&lt;/span&gt; is classical if &lt;span class=&quot;math-container&quot;&gt;$[\rho_m, \rho_n] = 0, \,\forall \rho_m,\rho_n \in S$&lt;/span&gt;. This is meant in the sense that all observed behaviors (results from quantum measurements on the states in &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;) could be reproduced by using only a classical variable. Additionally, if the support of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; has dimension &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, you would only need (classical) dits to do so.&lt;/p&gt;&#xA;&lt;p&gt;What is a good justification for this? Is this considered a definition or is it really a result?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; as asked, here is an example of the affirmation made in the first paragraph (taken from &lt;a href=&quot;https://arxiv.org/abs/1207.2574&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/1207.2574&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4H0AK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4H0AK.png&quot; alt=&quot;classical reproduction of behaviors&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The lemma in question is below. But as far as I understand, it only shows that &lt;em&gt;given&lt;/em&gt; the assumption that the probabilities are reproducible with classical (i.e. pair-wise commuting) states, then &amp;quot;classical measurements&amp;quot; (defined likewise) are also enough. Am I missing something here?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/PQwKi.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PQwKi.png&quot; alt=&quot;lemma&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9789" LastEditorUserId="9789" LastEditDate="2021-05-27T05:55:21.723" LastActivityDate="2021-05-27T11:02:57.267" Title="Why are commuting density operators said to be &quot;classical states&quot;?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;nonclassicality&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17538" PostTypeId="1" CreationDate="2021-05-17T21:08:46.137" Score="3" ViewCount="37" Body="&lt;p&gt;Trying to understand the paper; &lt;a href=&quot;https://arxiv.org/pdf/1702.02577.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1702.02577.pdf&lt;/a&gt;  and ran into &amp;quot;spin-coherent&amp;quot; states.&#xA;I wonder those are.&lt;/p&gt;&#xA;" OwnerUserId="15456" LastEditorUserId="55" LastEditDate="2021-05-18T07:53:35.523" LastActivityDate="2021-05-18T07:53:35.523" Title="What are spin-coherent states?" Tags="&lt;quantum-state&gt;&lt;quantum-optics&gt;&lt;angular-momentum&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17539" PostTypeId="1" CreationDate="2021-05-17T22:33:35.347" Score="0" ViewCount="28" Body="&lt;p&gt;I believe I have installed qiskit on my computer. Running pip list or pip3 list in terminal returns:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qiskit                   0.26.0&#xA;qiskit-aer               0.8.2&#xA;qiskit-aqua              0.9.1&#xA;qiskit-ibmq-provider     0.13.1&#xA;qiskit-ignis             0.6.0&#xA;qiskit-terra             0.17.3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However when I then open a jupyter notebook and try&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import qiskit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I get told that there is no module named qiskit available. Does anyone know what I am doing wrong?&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="13991" LastEditDate="2021-05-17T22:51:17.490" LastActivityDate="2021-05-17T22:51:17.490" Title="Qiskit package installed locally, but not running in jupyter notebook" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17540" PostTypeId="2" ParentId="17539" CreationDate="2021-05-17T22:40:36.807" Score="0" Body="&lt;p&gt;So I found the answer on the qiskit slack channel and thought I would post here in case someone else comes across the same issue. I did not have jupyter installed in the same environment where qiskit was installed. Just running pip install jupyter and restarting the terminal worked for me&lt;/p&gt;&#xA;" OwnerUserId="13261" LastActivityDate="2021-05-17T22:40:36.807" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17541" PostTypeId="2" ParentId="17538" CreationDate="2021-05-17T22:48:41.933" Score="2" Body="&lt;p&gt;These are also known as SU(2)-coherent states; one original reference is &lt;a href=&quot;https://doi.org/10.1103/PhysRevA.6.2211&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://doi.org/10.1103/PhysRevA.6.2211&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In a spin system, with states labeled by the eigenvalue of the total angular momentum operator &lt;span class=&quot;math-container&quot;&gt;$\mathbf{J}^2$&lt;/span&gt; and the z-projection of the angular momentum operator &lt;span class=&quot;math-container&quot;&gt;$J_z$&lt;/span&gt;,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathbf{J}^2||J,m\rangle=J(J+1)||J,m\rangle\quad J_z ||J,m\rangle=m||J,m\rangle,$$&lt;/span&gt; the spin-coherent states can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\theta,\phi\rangle=e^{i\theta J_z}e^{i\phi J_y}||J,J\rangle=\sum_{m=-J}^J \sqrt{\binom{2J}{J+m}}\sin^{S-m}\frac{\theta}{2}\cos^{S+m}\frac{\theta}{2}e^{-i\phi(S+m)}||J,m\rangle.$$&lt;/span&gt; There are many other equivalent ways to write these states, and one can define the angles differently by choosing to start from &lt;span class=&quot;math-container&quot;&gt;$||J,-J\rangle$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$||J,J\rangle$&lt;/span&gt; but this is a great place to start. The angles &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; correspond to angular coordinates on the surface of a sphere and so these spin-coherent states generalize pure single-qubit states on the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;We can also consider these states to be two-mode bosonic states using the Schwinger mapping. This lets us write the basis elements as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$||J,m\rangle=|n_1\rangle\otimes|n_2\rangle,$$&lt;/span&gt; where we have two bosonic modes&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|n_1\rangle\otimes |n_2\rangle=\frac{a^{\dagger\,n_1}}{\sqrt{n_1!}} \frac{b^{\dagger\,n_2}}{\sqrt{n_2!}}|\mathrm{vacuum}\rangle,$$&lt;/span&gt; &lt;span class=&quot;math-container&quot;&gt;$n_1=J+m$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$n_2=J-m$&lt;/span&gt;. This means that they can be physically generated from sending a state of the form &lt;span class=&quot;math-container&quot;&gt;$|N\rangle\otimes|0\rangle$&lt;/span&gt; through a beam splitter.&lt;/p&gt;&#xA;&lt;p&gt;Edit: you might also see these states in the context of symmetric superpositions of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubits. Then, the state &lt;span class=&quot;math-container&quot;&gt;$|n_1\rangle\otimes |n_2\rangle$&lt;/span&gt; implies that, for example, &lt;span class=&quot;math-container&quot;&gt;$n_1$&lt;/span&gt; of the qubits are in the spin-up state and the other &lt;span class=&quot;math-container&quot;&gt;$n_2=N-n_1$&lt;/span&gt; qubits are in the spin-down state. The symmetric superposition, in this Fock basis, implies that we cannot ascertain which of the qubits are actually in which state. For example, we could write the second-quantized state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\otimes|2\rangle$&lt;/span&gt; in the first-quantized form:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|1\rangle_{\uparrow}\otimes|2\rangle_\downarrow=\frac{|\uparrow\rangle\otimes|\downarrow\rangle\otimes|\downarrow\rangle+|\downarrow\rangle\otimes|\uparrow\rangle\otimes|\downarrow\rangle+|\downarrow\rangle\otimes|\downarrow\rangle\otimes|\uparrow\rangle}{\sqrt{3}}.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15820" LastEditorUserId="15820" LastEditDate="2021-05-18T01:18:19.393" LastActivityDate="2021-05-18T01:18:19.393" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17542" PostTypeId="2" ParentId="17518" CreationDate="2021-05-17T23:17:42.530" Score="0" Body="&lt;p&gt;I don't understand all of the details of the protocol, but to provide a tentative answer, in Mahadev's scheme the verifier (Vickey) is always purely classical, and only trades classical information back and forth with the prover (Peggy).  Vickey does not do any QMA verification alone, as she is not a QMA machine herself, and doesn't receive any qubits from Peggy but only receives classical information.&lt;/p&gt;&#xA;&lt;p&gt;Vickey has no power to do the local Hamiltonian evaluation with qubits.  Although it's true that Vickey can pick a term in the Hamiltonian for evaluation, she has to trade classical information with Peggy to evaluate the term of the Hamiltonian.  If Peggy has access to the claw - that is, if she knows &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$f(x_0)=f(x_1)=y$&lt;/span&gt;, then she has the same information that Vickey would use for the verification - she can play the role of Vickey herself.   She could send &lt;span class=&quot;math-container&quot;&gt;$x_0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$x_1$&lt;/span&gt; or a string &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt; orthogonal to &lt;span class=&quot;math-container&quot;&gt;$x_0\oplus x_1$&lt;/span&gt; as needed to Vickey.&lt;/p&gt;&#xA;&lt;p&gt;For example if Peggy has broken the claw then she doesn't need to apply any unitary, and indeed doesn't need to be quantum at all, but only needs to trade enough classical information with Vickey to trick Vickey into accepting.  If Vickey asks for an &lt;span class=&quot;math-container&quot;&gt;$x_b$&lt;/span&gt; and a &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, or if she asks for a &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;, then Peggy can provide either as needed.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastActivityDate="2021-05-17T23:17:42.530" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17543" PostTypeId="1" CreationDate="2021-05-17T23:55:15.837" Score="1" ViewCount="33" Body="&lt;p&gt;I have code which runs on the IBMQ website perfectly, however copying and pasting the same code (and including my API token) the same code does not run when I try and run it on a real quantum computer from Jupyter notebook. My code is :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import math&#xA;import certifi&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;from math import pi&#xA;&#xA;from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute, Aer,BasicAer, IBMQ&#xA;from qiskit.compiler import transpile, assemble&#xA;from qiskit.tools.jupyter import *&#xA;from qiskit.visualization import *&#xA;from qiskit.tools.visualization import circuit_drawer&#xA;from qiskit.quantum_info import state_fidelity&#xA;&#xA;backend = BasicAer.get_backend('unitary_simulator')&#xA;&#xA;IBMQ.save_account('My_token', overwrite=True)&#xA;&#xA;IBMQ.load_account() &#xA;provider = IBMQ.get_provider(hub='ibm-q-research')&#xA;#circuit I want to run&#xA;&#xA;def circtest(x1,x2,shotsin):&#xA;    maxShot=shotsin&#xA;    import random&#xA;    zz=[x1,x2]&#xA; &#xA;    qr=QuantumRegister(1)&#xA;&#xA;    my_layout={qr[0]:4}&#xA;    circuit2 = QuantumCircuit();&#xA;    circuit2.add_register(qr)&#xA;    cr=ClassicalRegister(1)&#xA;    circuit2.add_register(cr)&#xA;    circuit2.initialize(zz,0)&#xA;    circuit2.measure(0,0);&#xA;    device = provider.get_backend('ibmq_casablanca')&#xA;    Cfin=circuit2;&#xA;    result = execute(circuit2,backend=device,shots=maxShot).result()&#xA;    &#xA;    counts = result.get_counts(0)&#xA;    return counts&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However running the simple test&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#simple test&#xA;circtest(1,0,100)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;returns the following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;---------------------------------------------------------------------------&#xA;SSLCertVerificationError                  Traceback (most recent call last)&#xA;&amp;lt;ipython-input-3-8d451fe64647&amp;gt; in &amp;lt;module&amp;gt;&#xA;      1 #simple test&#xA;----&amp;gt; 2 totcirc1Qx(1,0,100)&#xA;&#xA;&amp;lt;ipython-input-2-5ff78fcf31bb&amp;gt; in totcirc1Qx(x1, x2, shotsin)&#xA;     23     device = provider.get_backend('ibmq_casablanca')&#xA;     24     Cfin=circuit2;&#xA;---&amp;gt; 25     result = execute(circuit2,backend=device,shots=maxShot).result()&#xA;     26 &#xA;     27     counts = result.get_counts(0)&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in result(self, timeout, wait, partial, refresh)&#xA;    274         &amp;quot;&amp;quot;&amp;quot;&#xA;    275         # pylint: disable=arguments-differ&#xA;--&amp;gt; 276         if not self._wait_for_completion(timeout=timeout, wait=wait,&#xA;    277                                          required_status=(JobStatus.DONE,)):&#xA;    278             if self._status is JobStatus.CANCELLED:&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in _wait_for_completion(self, timeout, wait, required_status, status_queue)&#xA;    909 &#xA;    910         try:&#xA;--&amp;gt; 911             status_response = self._api_client.job_final_status(&#xA;    912                 self.job_id(), timeout=timeout, wait=wait, status_queue=status_queue)&#xA;    913         except UserTimeoutExceededError:&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/api/clients/account.py in job_final_status(self, job_id, timeout, wait, status_queue)&#xA;    367             start_time = time.time()&#xA;    368             try:&#xA;--&amp;gt; 369                 status_response = self._job_final_status_websocket(&#xA;    370                     job_id=job_id, timeout=timeout, status_queue=status_queue)&#xA;    371             except WebsocketTimeoutError as ex:&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/api/clients/account.py in _job_final_status_websocket(self, job_id, timeout, status_queue)&#xA;    419             else:&#xA;    420                 raise&#xA;--&amp;gt; 421         return loop.run_until_complete(&#xA;    422             self.client_ws.get_job_status(job_id, timeout=timeout, status_queue=status_queue))&#xA;    423 &#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nest_asyncio.py in run_until_complete(self, future)&#xA;     68                 raise RuntimeError(&#xA;     69                     'Event loop stopped before Future completed.')&#xA;---&amp;gt; 70             return f.result()&#xA;     71 &#xA;     72     def _run_once(self):&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/futures.py in result(self)&#xA;    199         self.__log_traceback = False&#xA;    200         if self._exception is not None:&#xA;--&amp;gt; 201             raise self._exception&#xA;    202         return self._result&#xA;    203 &#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py in __step(***failed resolving arguments***)&#xA;    256                 result = coro.send(None)&#xA;    257             else:&#xA;--&amp;gt; 258                 result = coro.throw(exc)&#xA;    259         except StopIteration as exc:&#xA;    260             if self._must_cancel:&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/api/clients/websocket.py in get_job_status(self, job_id, timeout, retries, backoff_factor, status_queue)&#xA;    256         while current_retry_attempt &amp;lt;= retries:&#xA;    257             try:&#xA;--&amp;gt; 258                 websocket = await self._connect(url)&#xA;    259                 # Read messages from the server until the connection is closed or&#xA;    260                 # a timeout has been reached.&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/api/clients/websocket.py in _connect(self, url)&#xA;    165         # Isolate specific exceptions, so they are not retried in `get_job_status`.&#xA;    166         except (SSLError, InvalidURI) as ex:&#xA;--&amp;gt; 167             raise ex&#xA;    168 &#xA;    169         # pylint: disable=broad-except&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/qiskit/providers/ibmq/api/clients/websocket.py in _connect(self, url)&#xA;    161         try:&#xA;    162             logger.debug('Starting new websocket connection: %s', url)&#xA;--&amp;gt; 163             websocket = await connect(url)&#xA;    164 &#xA;    165         # Isolate specific exceptions, so they are not retried in `get_job_status`.&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/websockets/legacy/client.py in __await_impl__(self)&#xA;    620     async def __await_impl__(self) -&amp;gt; WebSocketClientProtocol:&#xA;    621         for redirects in range(self.MAX_REDIRECTS_ALLOWED):&#xA;--&amp;gt; 622             transport, protocol = await self._create_connection()&#xA;    623             # https://github.com/python/typeshed/pull/2756&#xA;    624             transport = cast(asyncio.Transport, transport)&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py in create_connection(self, protocol_factory, host, port, ssl, family, proto, flags, sock, local_addr, server_hostname, ssl_handshake_timeout, happy_eyeballs_delay, interleave)&#xA;   1079                     f'A Stream Socket was expected, got {sock!r}')&#xA;   1080 &#xA;-&amp;gt; 1081         transport, protocol = await self._create_connection_transport(&#xA;   1082             sock, protocol_factory, ssl, server_hostname,&#xA;   1083             ssl_handshake_timeout=ssl_handshake_timeout)&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py in _create_connection_transport(self, sock, protocol_factory, ssl, server_hostname, server_side, ssl_handshake_timeout)&#xA;   1109 &#xA;   1110         try:&#xA;-&amp;gt; 1111             await waiter&#xA;   1112         except:&#xA;   1113             transport.close()&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/futures.py in __await__(self)&#xA;    282         if not self.done():&#xA;    283             self._asyncio_future_blocking = True&#xA;--&amp;gt; 284             yield self  # This tells Task to wait for completion.&#xA;    285         if not self.done():&#xA;    286             raise RuntimeError(&amp;quot;await wasn't used with future&amp;quot;)&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py in __wakeup(self, future)&#xA;    326     def __wakeup(self, future):&#xA;    327         try:&#xA;--&amp;gt; 328             future.result()&#xA;    329         except BaseException as exc:&#xA;    330             # This may also be a cancellation.&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/futures.py in result(self)&#xA;    199         self.__log_traceback = False&#xA;    200         if self._exception is not None:&#xA;--&amp;gt; 201             raise self._exception&#xA;    202         return self._result&#xA;    203 &#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/sslproto.py in data_received(self, data)&#xA;    526 &#xA;    527         try:&#xA;--&amp;gt; 528             ssldata, appdata = self._sslpipe.feed_ssldata(data)&#xA;    529         except (SystemExit, KeyboardInterrupt):&#xA;    530             raise&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/sslproto.py in feed_ssldata(self, data, only_handshake)&#xA;    186             if self._state == _DO_HANDSHAKE:&#xA;    187                 # Call do_handshake() until it doesn't raise anymore.&#xA;--&amp;gt; 188                 self._sslobj.do_handshake()&#xA;    189                 self._state = _WRAPPED&#xA;    190                 if self._handshake_cb:&#xA;&#xA;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py in do_handshake(self)&#xA;    942     def do_handshake(self):&#xA;    943         &amp;quot;&amp;quot;&amp;quot;Start the SSL/TLS handshake.&amp;quot;&amp;quot;&amp;quot;&#xA;--&amp;gt; 944         self._sslobj.do_handshake()&#xA;    945 &#xA;    946     def unwrap(self):&#xA;&#xA;SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I assume I am just missing some way in which I can communicate with the actual devices but I am not sure what this is&lt;/p&gt;&#xA;" OwnerUserId="13261" LastEditorUserId="55" LastEditDate="2021-05-18T07:58:13.373" LastActivityDate="2021-05-18T08:20:32.660" Title="Running qiskit on jupyter notebook certverification error: unable to get local user certificate" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17544" PostTypeId="2" ParentId="17537" CreationDate="2021-05-18T07:51:47.823" Score="6" Body="&lt;p&gt;Usually, one defines classical states by first defining some &amp;quot;classical&amp;quot; orthonormal basis. Then a classical state is any state which is diagonal in this basis. Every classical state is then just some probability distribution written on the diagonal of some matrix. Note that all classical states expressed in this way commute.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, you have a set of states that all pairwise commute. A set of pairwise commuting matrices can be &lt;a href=&quot;https://math.stackexchange.com/questions/56307/simultaneous-diagonalization-of-commuting-linear-transformations&quot;&gt;simultaneously diagonalized&lt;/a&gt;. (You can show this by showing they must have the same eigenspaces). Therefore there exists some distinguished basis (orthonormal because we're working with Hermitian operators) in which all of these matrices are diagonal, recovering the above definition.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastEditorUserId="9854" LastEditDate="2021-05-18T10:14:18.957" LastActivityDate="2021-05-18T10:14:18.957" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17545" PostTypeId="2" ParentId="17543" CreationDate="2021-05-18T08:20:32.660" Score="0" Body="&lt;p&gt;You need to run&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; pip install --upgrade certifi&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The reason this did not work for me initially was that I was not running this command in the same environment where I run qiskit&lt;/p&gt;&#xA;" OwnerUserId="13261" LastActivityDate="2021-05-18T08:20:32.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17546" PostTypeId="1" AcceptedAnswerId="17548" CreationDate="2021-05-18T10:19:34.087" Score="3" ViewCount="120" Body="&lt;p&gt;I work with tensorflow-quantum and use &lt;code&gt;sympy&lt;/code&gt; for parameter updating.&lt;/p&gt;&#xA;&lt;p&gt;Suddenly, without (manually) updating or changing anything this error comes up:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;  File &amp;quot;/home/eli/anaconda3/lib/python3.8/site-packages/tensorflow_quantum/core/serialize/serializer.py&amp;quot;, line 93, in _symbol_extractor&#xA;    if isinstance(expr, sympy.mul.Mul):&#xA;&#xA;AttributeError: module 'sympy' has no attribute 'mul'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Has anyone had this before? Do you have any suggestions for what I can try to fix this?&lt;/p&gt;&#xA;&lt;p&gt;I am working on Ubuntu 20.04.2 LTS&#xA;TFQ version 0.4.0&#xA;Sympy version 1.8&lt;/p&gt;&#xA;&lt;p&gt;the error occurs when I build my PQC layer:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;model = tf.keras.Sequential([tf.keras.layers.Input(shape=(), dtype=tf.string), &#xA;                        tfq.layers.PQC(circuit, [cirq.Z(q) for q in builder.get_valid_outputs()]),&#xA;                        ], name = model_type)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;and it worked like this a long time.&lt;/p&gt;&#xA;" OwnerUserId="15493" LastEditorUserId="9006" LastEditDate="2021-05-19T15:01:41.580" LastActivityDate="2021-05-19T15:01:41.580" Title="Sympy suddently does not work together with TFQ" Tags="&lt;programming&gt;&lt;quantum-enhanced-machine-learning&gt;&lt;tfq&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17547" PostTypeId="2" ParentId="17546" CreationDate="2021-05-18T12:15:29.813" Score="0" Body="&lt;p&gt;I managed to get it working with a downgrade of sympy to version 1.6.1&#xA;It seems that tfq 0.4.0 needs that corresponding version to work properly&lt;/p&gt;&#xA;" OwnerUserId="15493" LastActivityDate="2021-05-18T12:15:29.813" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17548" PostTypeId="2" ParentId="17546" CreationDate="2021-05-18T14:25:16.427" Score="5" Body="&lt;p&gt;Just to add a little more context to your answer: TensorFlow-Quantum 0.4.0 has an explicit version dependency on &lt;code&gt;sympy==1.5.0&lt;/code&gt; in the &lt;code&gt;setup.py&lt;/code&gt; module &lt;a href=&quot;https://github.com/tensorflow/quantum/blob/v0.4.0/release/setup.py#L53&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt;, which should have been installed when you first installed TFQ. It's possible that other python pip packages may have overriden or upgraded the sympy version since then. Using something like &lt;code&gt;pip list | grep sympy&lt;/code&gt; will show which version of sympy you have installed in case you see breakages like this going forward with sympy (or other packages + dependencies) .&lt;/p&gt;&#xA;&lt;p&gt;Also one final note: TensorFlow Quantum 0.5.0 has been released and does also depend on sympy==1.5.0 which you can see &lt;a href=&quot;https://github.com/tensorflow/quantum/blob/master/release/setup.py#L54&quot; rel=&quot;noreferrer&quot;&gt;here&lt;/a&gt; .&lt;/p&gt;&#xA;" OwnerUserId="11700" LastActivityDate="2021-05-18T14:25:16.427" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17549" PostTypeId="1" CreationDate="2021-05-18T15:44:05.143" Score="2" ViewCount="32" Body="&lt;p&gt;As I understand Grover's algorithm, given the output of a black-box function, can be used to find the corresponding input (or set of inputs if the function is not one-to-one).  It is therefore potentially useful for solving inversion problems that are hard to solve/invert directly but are easy to verify.&lt;/p&gt;&#xA;&lt;p&gt;Two areas of math that fit that criteria are zero-finding and differential equation solving, i.e. solving a differential equation may be difficult, but checking whether a proposed solution is correct is relatively easy.  However, I am unable to find any discussion of whether Grover's algorithm is applicable to this type of problem, which leads me to believe that it's probably not.  If that's the case, why not? Is it a fundamental problem, or just that there are already classical algorithms that outperform Grover's?&lt;/p&gt;&#xA;" OwnerUserId="13347" LastEditorUserId="13991" LastEditDate="2021-05-18T17:03:20.273" LastActivityDate="2021-05-18T17:03:20.273" Title="Can Grover's algorithm be applied to differential equation solving?" Tags="&lt;algorithm&gt;&lt;mathematics&gt;&lt;grovers-algorithm&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17551" PostTypeId="1" CreationDate="2021-05-18T20:31:43.243" Score="2" ViewCount="33" Body="&lt;p&gt;Let's say I am running this code and I obtain picture below using Qiskit DensityMatrix class.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.quantum_info import DensityMatrix&#xA;from qiskit.visualization import plot_state_city&#xA;qc2 = QuantumCircuit(2,2)&#xA;qc2.h(0)&#xA;qc2.cx(0,1)&#xA;qc2.draw('mpl')&#xA;state2 = DensityMatrix.from_instruction(qc2)&#xA;plot_state_city(state2.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;How may I interpret this 'DensityMartix' chart? For what cases is it useful?&lt;/p&gt;&#xA;&lt;p&gt;I have searched in Qiskit Documentation but did not find something beginner could digest. Will be grateful for any hints and directions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bp8sQ.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bp8sQ.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15926" LastEditorUserId="13991" LastEditDate="2021-05-19T01:24:00.020" LastActivityDate="2021-05-19T01:24:00.020" Title="What may I read from DensityMatrix charts when running simple Qiskit code?" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17552" PostTypeId="1" CreationDate="2021-05-18T20:44:12.260" Score="0" ViewCount="58" Body="&lt;p&gt;how to do this in python using for loop &lt;span class=&quot;math-container&quot;&gt;$\rho = \sum_i p(x)|x\rangle\langle x|$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$X = {x1,x2,....}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$P = {p1,p2,p3...}$&lt;/span&gt; i have tried this loop but tis not working&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;for x,y in zip(prob,kets):&#xA;&#xA;  sum += x * np.outer(y,y) &#xA;  print(sum)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15087" LastEditorUserId="55" LastEditDate="2021-05-19T08:43:32.100" LastActivityDate="2021-05-19T08:43:32.100" Title="How to code density matrix in python?" Tags="&lt;programming&gt;&lt;python&gt;" AnswerCount="1" CommentCount="3" ClosedDate="2021-05-28T17:51:35.913" ContentLicense="CC BY-SA 4.0" />
  <row Id="17553" PostTypeId="2" ParentId="17552" CreationDate="2021-05-18T21:32:18.200" Score="1" Body="&lt;p&gt;Not sure if this question is &lt;em&gt;appropriate&lt;/em&gt; here in this community...&lt;/p&gt;&#xA;&lt;p&gt;Regarding to the question, it seems like what you have written should work... unless the way you define &lt;code&gt;x,y&lt;/code&gt; and &lt;code&gt;sum&lt;/code&gt; have issues. And as one of the comment pointed out, &lt;code&gt;sum&lt;/code&gt;, is a built-in function in python so avoid to use it. So here is an example that might help:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np &#xA;zero = np.matrix([1,0])&#xA;one = np.matrix([0,1])&#xA;kets = [zero, one]&#xA;probs = [1/3, 2/3 ]&#xA;matrix = np.zeros( (2,2))&#xA;for x,y in zip(kets, probs):&#xA;    matrix += y*np.outer(x, x.conj())&#xA;print(matrix)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;ouput&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[[0.33333333 0.        ]&#xA; [0.         0.66666667]]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;which is what you expected.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-18T22:07:51.010" LastActivityDate="2021-05-18T22:07:51.010" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17554" PostTypeId="2" ParentId="17551" CreationDate="2021-05-18T21:52:02.970" Score="1" Body="&lt;p&gt;The bars represent the amplitude of the elements in the desnity matrix, &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So for instance, this particular plot&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BfoSU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BfoSU.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;tell us that the element &lt;span class=&quot;math-container&quot;&gt;$\rho_{0,0} = \rho_{0,3} = \rho_{3,0} = \rho_{3,3} = 1/2$&lt;/span&gt; and the rest are zero. That is, it meant to represent this matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ &#xA;\rho = \begin{pmatrix} \rho_{0,0} &amp;amp; \rho_{0,1} &amp;amp; \rho_{0,2} &amp;amp; \rho_{0,3}\\ &#xA;\rho_{1,0} &amp;amp; \rho_{1,1} &amp;amp; \rho_{1,2} &amp;amp; \rho_{1,3}\\&#xA;\rho_{2,0} &amp;amp; \rho_{2,1} &amp;amp;\rho_{2,2} &amp;amp; \rho_{2,3}\\&#xA;\rho_{3,0} &amp;amp; \rho_{3,1} &amp;amp; \rho_{3,2} &amp;amp; \rho_{3,3}\end{pmatrix}= &#xA;\begin{pmatrix} \rho_{0} &amp;amp; \rho_{1} &amp;amp; \rho_{2} &amp;amp; \rho_{3}\\ &#xA;\rho_{4} &amp;amp; \rho_{5} &amp;amp; \rho_{6} &amp;amp; \rho_{7}\\&#xA;\rho_{8} &amp;amp; \rho_{9} &amp;amp;\rho_{10} &amp;amp; \rho_{11}\\&#xA;\rho_{12} &amp;amp; \rho_{13} &amp;amp; \rho_{14} &amp;amp; \rho_{15}\end{pmatrix}= &#xA; \begin{pmatrix} 1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2\\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Note that on the graph, the state &lt;span class=&quot;math-container&quot;&gt;$0000$&lt;/span&gt; corresponds to the element &lt;span class=&quot;math-container&quot;&gt;$\rho_{0,0}$&lt;/span&gt; which is the &lt;span class=&quot;math-container&quot;&gt;$0th$&lt;/span&gt; element of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The state &lt;span class=&quot;math-container&quot;&gt;$0011$&lt;/span&gt; corresponds to the &lt;span class=&quot;math-container&quot;&gt;$3rd$&lt;/span&gt; element of the density matrix which is the element &lt;span class=&quot;math-container&quot;&gt;$\rho_{0,3}$&lt;/span&gt;. You can see the binary value &lt;span class=&quot;math-container&quot;&gt;$0011$&lt;/span&gt; converts to &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; in decimal.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, &lt;span class=&quot;math-container&quot;&gt;$1100$&lt;/span&gt; converts to &lt;span class=&quot;math-container&quot;&gt;$12$&lt;/span&gt; which corresponds to the &lt;span class=&quot;math-container&quot;&gt;$12th$&lt;/span&gt; element of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; which is the element &lt;span class=&quot;math-container&quot;&gt;$\rho_{3,0}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And lastly, &lt;span class=&quot;math-container&quot;&gt;$1111$&lt;/span&gt; converts to &lt;span class=&quot;math-container&quot;&gt;$15$&lt;/span&gt; which is the last element of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;, which is also &lt;span class=&quot;math-container&quot;&gt;$\rho_{3,3}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7vUYJ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7vUYJ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;So in conclusion, the bars in the graph just to represent the amplitude of the density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. And the size of the grid indicate how big your system is. The examples you gave all have matrix of size &lt;span class=&quot;math-container&quot;&gt;$4 \times 4$&lt;/span&gt;, hence it is a two qubit system. But if you have a 3 qubit system then your grid would be &lt;span class=&quot;math-container&quot;&gt;$8 \times 8$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Another point to note is that the matrix&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \begin{pmatrix} 1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2\\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2 \end{pmatrix}&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;can be constructed from taking the outer product of the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = \dfrac{|00\rangle + |11 \rangle}{\sqrt{2}} = \begin{pmatrix} 1/\sqrt{2} \\ 0 \\ 0 \\ 1/\sqrt{2} \end{pmatrix}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That is,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\rho = |\psi \rangle \langle \psi | = \begin{pmatrix} 1/\sqrt{2} \\ 0 \\ 0 \\ 1/\sqrt{2} \end{pmatrix} \begin{pmatrix} 1/\sqrt{2} &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/\sqrt{2} \end{pmatrix} = \begin{pmatrix} 1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2\\ &#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;1/2 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1/2 \end{pmatrix}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;notice that the state &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle$&lt;/span&gt; is precisely the state you created with your circuit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc2 = QuantumCircuit(2,2)&#xA;qc2.h(0)&#xA;qc2.cx(0,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-18T22:36:12.813" LastActivityDate="2021-05-18T22:36:12.813" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17555" PostTypeId="1" CreationDate="2021-05-18T22:33:25.143" Score="2" ViewCount="83" Body="&lt;p&gt;In QAOA algorithm, two terms are being discussed; 1) clause or cost (C) Hamiltonian and 2) mixer consisting of pauli X gates.&lt;/p&gt;&#xA;&lt;p&gt;What is the role of this mixer?  Not clear why it comes after the C.  Doesn't it cause the state to flip after evaluating C?&lt;/p&gt;&#xA;" OwnerUserId="15456" LastActivityDate="2021-05-20T00:54:39.030" Title="What's the role of mixer in QAOA?" Tags="&lt;algorithm&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17556" PostTypeId="1" AcceptedAnswerId="17558" CreationDate="2021-05-19T01:41:18.167" Score="4" ViewCount="61" Body="&lt;p&gt;Since Quantum Annealing is extremely powerful for optimization it is limited in scope.&lt;/p&gt;&#xA;&lt;p&gt;However, when a universal Quantum Computer based on gates arrives, it will have a wider scope including optimization as well.&lt;/p&gt;&#xA;&lt;p&gt;In a such scenario will the annealing approach be obsolete?&lt;/p&gt;&#xA;" OwnerUserId="9759" LastEditorUserId="15408" LastEditDate="2021-05-19T08:44:25.730" LastActivityDate="2021-05-19T08:44:25.730" Title="Is Quantum Annealing threatened by the Quantum Gates approach?" Tags="&lt;quantum-gate&gt;&lt;annealing&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17557" PostTypeId="1" CreationDate="2021-05-19T06:19:10.943" Score="3" ViewCount="20" Body="&lt;p&gt;I understand that in addition to D-Wave's quantum annealer, there have been other unconventional (although non-quantum) Ising solvers like the one from Toshiba, Fujitsu, the Coherent Ising machine, etc.&lt;/p&gt;&#xA;&lt;p&gt;Which of these annealers perform best on, say, the travelling salesman problem ? Has there been any demonstrated advantage for any of these (including D-Wave's) over classical approaches ?&lt;/p&gt;&#xA;" OwnerUserId="15769" LastActivityDate="2021-05-19T06:19:10.943" Title="What is the state-of-the-art annealing device for solving Ising problems?" Tags="&lt;d-wave&gt;&lt;annealing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17558" PostTypeId="2" ParentId="17556" CreationDate="2021-05-19T07:41:37.280" Score="2" Body="&lt;p&gt;I'm not sure that anybody really &lt;em&gt;knows&lt;/em&gt; the answer to this. Ultimately, this comes down to error correction. Universal quantum computers will have built-in error correction (and, indeed, fault-tolerance) that allows them to perform arbitrarily large computations in an essentially noise-free way.&lt;/p&gt;&#xA;&lt;p&gt;To my knowledge (although I'm not an expert), while there has been some work towards error correction in the quantum annealing scenario (e.g. &lt;a href=&quot;https://www.nature.com/articles/npjqi201617&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;), there's no complete fault-tolerant theory. Without it, quantum annealing is likely to be limited to finite sized computations.&lt;/p&gt;&#xA;&lt;p&gt;So, does a fault-tolerant theory of quantum annealing exist, and can it be implemented? That's crystal ball gazing. My personal suspicion is that fault-tolerant theories exist, but they may well require connectivity of the qubits that is impractical.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-19T07:41:37.280" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17559" PostTypeId="1" CreationDate="2021-05-19T07:48:46.580" Score="4" ViewCount="48" Body="&lt;p&gt;I don't get how measuring in different bases works in experiments. From an experimental point of view, what do we do to measure in &lt;span class=&quot;math-container&quot;&gt;$|\pm \rangle$&lt;/span&gt; basis?&lt;/p&gt;&#xA;&lt;p&gt;If I'm getting it right measuring in the computational basis means just recording a click on the detector behind the PBS. Whereas when we want to measure in &lt;span class=&quot;math-container&quot;&gt;$|\pm \rangle$&lt;/span&gt; basis we put a half-wave plate between the PBS and the detector.&lt;/p&gt;&#xA;" OwnerUserId="15523" LastEditorUserId="55" LastEditDate="2021-05-19T08:43:08.340" LastActivityDate="2021-05-19T14:55:43.847" Title="How does measuring in the $|\pm\rangle$ basis works in experiments?" Tags="&lt;measurement&gt;&lt;physical-realization&gt;" AnswerCount="2" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17560" PostTypeId="2" ParentId="17559" CreationDate="2021-05-19T08:38:44.887" Score="2" Body="&lt;p&gt;This fully depends on the experimental implementation and the context.&lt;/p&gt;&#xA;&lt;p&gt;Generally speaking, &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; is a basis like any other, so asking &amp;quot;how does measuring in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis works&amp;quot; has the same answer as the question &amp;quot;how does measuring in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle,|1\rangle$&lt;/span&gt; basis works?&amp;quot;.&#xA;However, when asking this question you probably implicitly mean that you want to measure in a basis that is rotated with respect to the &amp;quot;computational basis&amp;quot; used to express the rest of the protocol.&lt;/p&gt;&#xA;&lt;p&gt;In other words, you probably mean to ask something along the lines of: assuming my experimental apparatus &amp;quot;naturally operates&amp;quot; in the computational basis, how do I measure in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; basis?&lt;/p&gt;&#xA;&lt;p&gt;At a formal level, this amounts to applying an Hadamard gate before the measurement: the Hadamard implements the operations &lt;span class=&quot;math-container&quot;&gt;$|0\rangle\mapsto|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle\mapsto|-\rangle$&lt;/span&gt;, and thus measuring in the computational basis after an Hadamard amounts to measuring in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; before it.&lt;/p&gt;&#xA;&lt;p&gt;For example, suppose you are encoding a qubit in the polarisation degree of freedom of a light beam. A way to measure the polarisation state is then to put a detector after a polarisation filter, or equivalently measuring the position after a PBS. Then, to measure in the &lt;span class=&quot;math-container&quot;&gt;$|\pm\rangle$&lt;/span&gt; simply means to rotate the polarisation before said measurement, &lt;em&gt;e.g.&lt;/em&gt; using a quarter waveplate.&lt;/p&gt;&#xA;&lt;p&gt;If instead you encode a qubit in the &lt;em&gt;position&lt;/em&gt; of, say, a photon, then applying the Hadamard amounts to evolving the state through a balanced beamsplitter and measuring after it.&lt;/p&gt;&#xA;&lt;p&gt;You can also imagine more complicated examples. For example, you can encode a qubit in the &lt;em&gt;Fock degree of freedom&lt;/em&gt; of a photon. In other words, you can consider the presence of a photon in a single mode as the &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; state and its absence as the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state. Then measuring on the rotated basis would become significantly more complicated as it would require a nonlinear operation.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-19T08:38:44.887" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17561" PostTypeId="1" CreationDate="2021-05-19T13:04:45.377" Score="1" ViewCount="35" Body="&lt;p&gt;I am confused about how to implement an oracle for the below algorithm. The algorithm is from &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0401091&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/epHo8.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/epHo8.png&quot; alt=&quot;Algorithm&quot; /&gt;&lt;/a&gt;&#xA;The algorithm shows how to build a DFS-based spanning tree by using Grover's algorithm. In my view, the oracle function is like&#xA;&lt;span class=&quot;math-container&quot;&gt;$\begin{equation}&#xA;f(x)=&#xA;\begin{cases}&#xA;0&amp;amp; \text{x in S}\\&#xA;1&amp;amp; \text{x not in S}&#xA;\end{cases}&#xA;\end{equation}$&lt;/span&gt;&#xA;However, it seems that the algorithm tries to visit a classical data structure from a quantum computer, which confused me a lot. I do not find any papers related to quantum set, which has both O(1) time complexity for checking and adding an element like Python set in a classical computer.&lt;/p&gt;&#xA;&lt;p&gt;One possible way to implement it is to define the oracle as &lt;span class=&quot;math-container&quot;&gt;$-\sum\left| x \right&amp;gt;\left&amp;lt; x \right|+\sum\left| y \right&amp;gt;\left&amp;lt; y \right|$&lt;/span&gt;, where x is the space of elements not in S, and y is the space of elements already in S. The corresponding matrix is a diagonal matrix, which has 1 or -1 in the diagonal (-1 means not in S, and 1 means already in S). Assume the input has 4 elements and the set S contains the element &lt;span class=&quot;math-container&quot;&gt;$\left| 00 \right&amp;gt;$&lt;/span&gt;, then the matrix is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;  \begin{matrix}&#xA;   1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; -1 &amp;amp; 0 &amp;amp; 0 \\&#xA;   0 &amp;amp; 0 &amp;amp; -1 &amp;amp; 0\\&#xA;   0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1&#xA;  \end{matrix} \tag{1}&#xA;$$&lt;/span&gt;&#xA;To implement this oracle, we can decompose the matrix into &lt;span class=&quot;math-container&quot;&gt;$CZ(I\otimes X)CZ(I\otimes X)(X\otimes I)CZ(X\otimes I)$&lt;/span&gt;. This decomposition makes the number of CZ gates related to the input size (&lt;span class=&quot;math-container&quot;&gt;$O(4)$&lt;/span&gt; in this 2 qubits example and &lt;span class=&quot;math-container&quot;&gt;$O(2^n)$&lt;/span&gt; when using n qubits. We also know the number of qubits &lt;span class=&quot;math-container&quot;&gt;$n = log N$&lt;/span&gt;, where N is the number of data). Although the number of Grover's iteration is still &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt;, the time complexity is something related to &lt;span class=&quot;math-container&quot;&gt;$O(N)$&lt;/span&gt; for this implementation I think.&lt;/p&gt;&#xA;&lt;p&gt;Another problem is that the oracle should be changed after a search. Using the above example, we have &lt;span class=&quot;math-container&quot;&gt;$S=\{\left| 00 \right&amp;gt;\}$&lt;/span&gt;, and assume we get &lt;span class=&quot;math-container&quot;&gt;$\left| 01 \right&amp;gt;$&lt;/span&gt; after the first measurement. Then the oracle should be changed to &lt;span class=&quot;math-container&quot;&gt;$CZ(I\otimes X)CZ(I\otimes X)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The above example is a 2-qubit example, and my oracle could be implemented on an n-qubit system by using &lt;span class=&quot;math-container&quot;&gt;$C^{n-1}Z$&lt;/span&gt; gate in general.&lt;/p&gt;&#xA;&lt;p&gt;I think my implementation of the oracle is incorrect. Compared to classical computing, my implementation is similar to use a Python list to store all elements, which has O(1) time on adding one element and O(size_of(List)) time on checking. However, I think the oracle for this algorithm should have O(1) or O(logN) cost. I am wondering how to implement such an oracle?&lt;/p&gt;&#xA;" OwnerUserId="15928" LastEditorUserId="15928" LastEditDate="2021-05-19T14:36:28.527" LastActivityDate="2021-05-19T14:36:28.527" Title="How to implement an oracle for this algorithm" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;complexity-theory&gt;" AnswerCount="0" CommentCount="1" ClosedDate="2021-05-20T12:27:40.657" ContentLicense="CC BY-SA 4.0" />
  <row Id="17562" PostTypeId="1" CreationDate="2021-05-19T13:59:28.983" Score="1" ViewCount="50" Body="&lt;p&gt;The expectation value of an operator &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is defined by this equation &lt;span class=&quot;math-container&quot;&gt;$\langle A \rangle_\psi = \sum_j a_j |\langle \psi | \phi_j \rangle|^2 $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My first question is does it mean that the expectation can be a negative value?&#xA;If we want to calculate the observable &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; in the state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;, the expectation value is -1, right?&lt;/p&gt;&#xA;&lt;p&gt;Suppose we have a four-qubit circuit, and we measure it using qiskit. As the measurement is done on &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; basis, it corresponds to calculate the expectation value of observable &lt;span class=&quot;math-container&quot;&gt;$ZZZZ$&lt;/span&gt;. Let's say the output state is &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle$&lt;/span&gt; using a simulator.&lt;/p&gt;&#xA;&lt;p&gt;Since the eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle$&lt;/span&gt; is -1, the expectation value, in this case, is -1. (Is it correct?)&lt;/p&gt;&#xA;&lt;p&gt;When I execute the circuit on a real quantum chip with shots 1170, I get the result like: &lt;span class=&quot;math-container&quot;&gt;$|0000\rangle : 100$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0001\rangle :900 $&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|1001\rangle : 50$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|0011\rangle : 120$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;How can I calculate the expectation value based on the results?&lt;/p&gt;&#xA;&lt;p&gt;Is it equal to the sum of each state times its probability (&lt;span class=&quot;math-container&quot;&gt;$0\times\frac{100}{1170} + 1\times\frac{900}{1170}+ 9\times\frac{50}{1170} + 3\times\frac{120}{1170}$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;or the sum of state probability times its eigenvalue &lt;span class=&quot;math-container&quot;&gt;$(1\times100 + (-1)\times900 + 1\times50 + 1\times120)/1170$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="9105" LastEditorUserId="55" LastEditDate="2021-05-19T15:57:18.410" LastActivityDate="2021-05-19T15:57:18.410" Title="Expectation value of a quantum circuit" Tags="&lt;quantum-state&gt;&lt;mathematics&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="2" ClosedDate="2021-05-20T12:28:03.097" ContentLicense="CC BY-SA 4.0" />
  <row Id="17563" PostTypeId="2" ParentId="17559" CreationDate="2021-05-19T14:55:43.847" Score="0" Body="&lt;p&gt;Lets assume that resuls of some calculation on a quantum computer is either state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;. If you measure these states in computational basis, in both cases you end up with probability of state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; to be 50 %. This means that you are not able to distinguish between &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, if you put Hadamard gate before the measurement, state &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; is transformed to &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;. So, after measurement in Hadamard basis (i.e. with &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; before the measurement in z-basis), you end up with state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; with 100 % probability if you measure &lt;span class=&quot;math-container&quot;&gt;$|+\rangle$&lt;/span&gt; or with state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; with 100 % probability if you measure &lt;span class=&quot;math-container&quot;&gt;$|-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-05-19T14:55:43.847" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17564" PostTypeId="1" AcceptedAnswerId="17570" CreationDate="2021-05-19T14:55:50.847" Score="2" ViewCount="46" Body="&lt;p&gt;There are many data structures in classical computers, like Tree, HashSet, etc. These data structures give convenience to the performance (time complexity) of algorithms. I am wondering how to create a similar data structure on a quantum computer. Specifically, I want to know if there is a quantum HashSet that supports &lt;span class=&quot;math-container&quot;&gt;$\mathcal{O}(1)$&lt;/span&gt; cost for adding and accessing elements. If not, how might one implement a hash function on a quantum computer?&lt;/p&gt;&#xA;&lt;p&gt;I think a quantum computer can do at least the same as a classical computer, but I could not find a solution on Google.&lt;/p&gt;&#xA;" OwnerUserId="15928" LastEditorUserId="13991" LastEditDate="2021-05-19T18:51:28.097" LastActivityDate="2021-05-20T02:31:37.070" Title="Is there a quantum implementation like HashSet?" Tags="&lt;quantum-gate&gt;&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17566" PostTypeId="1" AcceptedAnswerId="17568" CreationDate="2021-05-19T16:45:42.357" Score="1" ViewCount="52" Body="&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}E_{i}=I$&lt;/span&gt; is a set of POVM's and &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}M^{\dagger}M=I$&lt;/span&gt; is a set of general measurement operators, I have always been confused on how to move from one to the other, in regards to the expression of &lt;span class=&quot;math-container&quot;&gt;$M=\sqrt{E_{i}}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$E_{i}$&lt;/span&gt; is a projector, then &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi|E_{i}\Psi\rangle=\langle\Psi|\sqrt{E_{i}}\sqrt{E_{i}}\Psi\rangle=\langle\Psi|M^{\dagger}M\Psi\rangle=\langle\Psi|P^{\dagger}P\Psi\rangle=\langle\Psi|P\Psi\rangle$&lt;/span&gt;, due to the properties of the projector.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$E_{i}$&lt;/span&gt; is not a projector, then &lt;span class=&quot;math-container&quot;&gt;$\langle\Psi|E_{i}\Psi\rangle=\langle\Psi|\sqrt{E_{i}}\sqrt{E_{i}}\Psi\rangle=\langle\Psi|M^{\dagger}M\Psi\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But how can the second equality aboce hold if &lt;span class=&quot;math-container&quot;&gt;$M$&lt;/span&gt; isn't hermitian, such as &lt;span class=&quot;math-container&quot;&gt;$M_{0}=|0\rangle\langle0|, M_{1}=|0\rangle\langle1|$&lt;/span&gt;? In this case, &lt;span class=&quot;math-container&quot;&gt;$\sum_{i}M^{\dagger}M=I$&lt;/span&gt; still holds, and this is used as an example in N&amp;amp;C as a set of measurement operators. However, both N&amp;amp;C and other books frequently use the notation of &lt;span class=&quot;math-container&quot;&gt;$E_{i}=\sqrt{E_{i}}\sqrt{E_{i}}$&lt;/span&gt;. But it's clear from the above example that &lt;span class=&quot;math-container&quot;&gt;$M_{1} \neq M_{1}^{\dagger}$&lt;/span&gt;, as it's not hermitian.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$M_{1}=\sqrt{E_{i}}$&lt;/span&gt;, but it isn't hermitian, then &lt;span class=&quot;math-container&quot;&gt;$M_{1}^{\dagger} \neq \sqrt{E_{1}}$&lt;/span&gt; and so the product of them &lt;span class=&quot;math-container&quot;&gt;$\neq E_{1}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I feel like I am missing something obvious here, but apart from it being related to the non-uniqueness of sqaure roots for matrices, I am not sure what.&lt;/p&gt;&#xA;" OwnerUserId="4991" LastActivityDate="2021-05-19T21:51:36.153" Title="Moving between $\sum_{I}E_{i}=I$ and $\sum_{i}M^{\dagger}M=I$ for non-hermitian $M$" Tags="&lt;measurement&gt;&lt;povm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17567" PostTypeId="1" CreationDate="2021-05-19T18:53:51.833" Score="3" ViewCount="36" Body="&lt;p&gt;In quantum computing, quantum circuits are a common model for visualizing unitary evolution. If I want to represent a unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; acting on a &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt;-qubit state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; followed by a measurement in the computational basis then I can draw the following picture:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/bPPxE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/bPPxE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This representation is concise and unambiguous: &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is a unitary process, &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; are both defined over &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; qubits, both measurements are applied to single qubits in the computational basis, etc.&lt;/p&gt;&#xA;&lt;p&gt;Now suppose I want to represent an arbitrary quantum channel &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}: \mathbb{C}^{4 \times 4} \rightarrow \mathbb{C}^{4\times 4}$&lt;/span&gt; (completely positive, trace preserving). &lt;strong&gt;What are ways to &lt;em&gt;visualize&lt;/em&gt; this (non-unitary) process &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; acting on an input &lt;span class=&quot;math-container&quot;&gt;$U|\psi\rangle$&lt;/span&gt;?&lt;/strong&gt; I would appreciate suggestions that are used in publications or other main-stream references.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Possible approaches I have considered and their drawbacks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I could just add another &amp;quot;gate&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; to the diagram above, and comment that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is a CPTP map. But this seems dangerous because &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; is represented in the same way as other unitary operators even though it represents a more general quantum process. This violates readers' expectations and could cause confusion. For example:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FqrMd.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FqrMd.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I could define &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; to be an isometric extension of &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; and add an ambiguous number of ancillary qubits so that my operators are still unitary. However this seems like overkill, since I might choose to define &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; in terms of Kraus operators and don't to provide the formalism for an isometry for &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; for the sole purpose of providing a picture of my process:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qTrda.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qTrda.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I could introduce a different style of box to represent &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;, but this seems non-standard so it might defeat the purpose of providing a clear description of the process &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt;. And its not clear what style of box one should use if they do take this approach. For example:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/amE9z.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/amE9z.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1939" LastActivityDate="2021-05-19T18:53:51.833" Title="What are some standard ways to visualize non-unitary processes" Tags="&lt;resource-request&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17568" PostTypeId="2" ParentId="17566" CreationDate="2021-05-19T21:51:36.153" Score="2" Body="&lt;p&gt;Indeed, &lt;span class=&quot;math-container&quot;&gt;$M_i=\sqrt{E_{i}}$&lt;/span&gt; is wrong. The correct relationship is &lt;span class=&quot;math-container&quot;&gt;$E_i = M_i^\dagger M_i$&lt;/span&gt;. The possible &lt;span class=&quot;math-container&quot;&gt;$M_i$&lt;/span&gt; for a given &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; are &lt;span class=&quot;math-container&quot;&gt;$M_i = U\sqrt{E_i}$&lt;/span&gt; for any unitary &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, as &lt;span class=&quot;math-container&quot;&gt;$M_i^\dagger M_i = \sqrt{E_i}U^\dagger U \sqrt{E_i} = \sqrt{E_i}\sqrt{E_i} = E_i$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="12541" LastActivityDate="2021-05-19T21:51:36.153" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17569" PostTypeId="2" ParentId="17555" CreationDate="2021-05-20T00:54:39.030" Score="2" Body="&lt;p&gt;Probably the easiest way to understand this is to pretend that the mixer is NOT there and see what happens. So, let's assume you have some initial state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle = \sum_x \psi_x \lvert x \rangle$&lt;/span&gt; and you want to use QAOA to find the ground state of some cost Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;. I'm using the notation &lt;span class=&quot;math-container&quot;&gt;$\big\{\lvert x \rangle : x \in \{\pm  1\}^n \big\}$&lt;/span&gt; for the &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt;-basis (the computational basis). Note that the cost Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; will be diagonal in this basis.&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;H_C = \sum_x E_x \lvert x \rangle \langle x \rvert&#xA;$$&lt;/span&gt;&#xA;Applying the phase-shifter &lt;span class=&quot;math-container&quot;&gt;$U(\gamma) = \exp(-i \gamma H_C)$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; one obtains&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \psi(\gamma) \rangle \equiv U(\gamma) \lvert \psi \rangle = \sum_x e^{-i\gamma E_x} \psi_x \lvert x \rangle&#xA;$$&lt;/span&gt;&#xA;Let's stop here for now. If you measure the new state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi(\gamma) \rangle$&lt;/span&gt; with respect to the computational basis you get a configuration &lt;span class=&quot;math-container&quot;&gt;$x \in \{\pm  1\}^n$&lt;/span&gt; with probability&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;p_x = \lvert \langle x|\psi(\gamma) \rangle \rvert^2 = \lvert e^{-i\gamma E_x} \psi_x \rvert^2 = \lvert \psi_x \rvert^2&#xA;$$&lt;/span&gt;&#xA;which is exactly the probability you would have got if you had measured the state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi \rangle$&lt;/span&gt; to begin with. Evolution with respect to &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; has not changed this probability distribution so we haven't really gained anything.&lt;/p&gt;&#xA;&lt;p&gt;Note that this implies that for any observable that is diagonal in the &lt;span class=&quot;math-container&quot;&gt;$\sigma^z$&lt;/span&gt;-basis, &lt;em&gt;e.g.&lt;/em&gt; for the cost Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \psi(\gamma) \rvert  H_C  \lvert \psi(\gamma) \rangle = \langle \psi \rvert U^{\dagger}(\gamma) H_C U(\gamma) \lvert \psi \rangle = \langle \psi \rvert  H_C  \lvert \psi \rangle&#xA;$$&lt;/span&gt;&#xA;since &lt;span class=&quot;math-container&quot;&gt;$\langle x \rvert H_C \lvert y \rangle = E_x \delta_{xy}$&lt;/span&gt;. This is bad since the average energy functional (here I'm suppressing the dependence on the mixing time &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; since we're pretending we're not using a mixer)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(\gamma) = \langle \psi(\gamma) \rvert  H_C  \lvert \psi(\gamma) \rangle&#xA;$$&lt;/span&gt;&#xA;is used by the classical optimization part of the QAOA in order to optimize the state &lt;span class=&quot;math-container&quot;&gt;$ \lvert \psi(\gamma) \rangle$&lt;/span&gt;: you want to find a value &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; that minimizes &lt;span class=&quot;math-container&quot;&gt;$f(\gamma)$&lt;/span&gt;. But we just saw that &lt;span class=&quot;math-container&quot;&gt;$f(\gamma)$&lt;/span&gt; is a constant function of &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; so there's nothing to optimize here. &lt;em&gt;You can't go down in energy (that is, in &amp;quot;cost&amp;quot;) by choosing different values of &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;From a physical point of view this is perfectly obvious: the system is evolving under closed-system dynamics and the energy (represented here by &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;) is conserved.&lt;/p&gt;&#xA;&lt;p&gt;All of this changes if you then apply a mixer (where &lt;em&gt;e.g.&lt;/em&gt; &lt;span class=&quot;math-container&quot;&gt;$B= \sum_i \sigma_i^x$&lt;/span&gt;)&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U(\beta) \equiv \exp(-i\beta B)&#xA;$$&lt;/span&gt;&#xA;to your state &lt;span class=&quot;math-container&quot;&gt;$\lvert \psi(\gamma) \rangle$&lt;/span&gt; so that you get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\lvert \psi(\gamma,\beta) \rangle \equiv \exp(-i\beta B)\exp(-i\gamma H_C) \lvert \psi \rangle&#xA;$$&lt;/span&gt;&#xA;Since &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; do not commute, the dynamics generated by &lt;span class=&quot;math-container&quot;&gt;$B$&lt;/span&gt; will &lt;em&gt;not&lt;/em&gt; in general conserve the &amp;quot;energy&amp;quot; (&lt;em&gt;i.e.&lt;/em&gt; the cost) &lt;span class=&quot;math-container&quot;&gt;$H_C$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now the (correct) QAOA energy functional&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;f(\gamma,\beta) = \langle \psi(\gamma,\beta) \rvert  H_C  \lvert \psi(\gamma,\beta) \rangle&#xA;$$&lt;/span&gt;&#xA;is no longer a constant function of &lt;span class=&quot;math-container&quot;&gt;$\gamma,\beta$&lt;/span&gt; and you can use your favourite classical optimizer to minimize its value. That is, you will (in general) be able to find values &lt;span class=&quot;math-container&quot;&gt;$\gamma^*,\beta^*$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\langle \psi(\gamma^*,\beta^*) \rvert  H_C  \lvert \psi(\gamma^*,\beta^*) \rangle &amp;lt; \langle \psi \rvert  H_C  \lvert \psi \rangle.&#xA;$$&lt;/span&gt;&#xA;The exact same argument applies to any depth &lt;span class=&quot;math-container&quot;&gt;$p$&lt;/span&gt; of the QAOA variational Ansatz.&lt;/p&gt;&#xA;" OwnerUserId="14213" LastActivityDate="2021-05-20T00:54:39.030" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17570" PostTypeId="2" ParentId="17564" CreationDate="2021-05-20T02:31:37.070" Score="0" Body="&lt;p&gt;A major problem with implementing a hash set on a quantum computer is that, if you are inserting a superposed item, it can go into a superposition of buckets. But if you don't operate on a bucket, you can't possibly have inserted an item into it. Therefore to insert (or query) a superposed item correctly, which goes into a superposition of all the buckets, you have to apply at least one operation per bucket. Therefore the number of operations scales like O(n) instead of O(1).&lt;/p&gt;&#xA;&lt;p&gt;That being said, this is kind of unfair to the quantum computer. The classical logic circuit implementing a hash set also uses O(n) gates to perform a query, but in a CPU we hide almost all of that circuit behind an abstraction we call &amp;quot;querying memory&amp;quot;. We only pay attention to the time cost instead of the hardware time cost. The quantum circuit model tends to highlight the hardware time cost.&lt;/p&gt;&#xA;&lt;p&gt;So, in order for a quantum hash set to be efficient, you need quantum memory that's cheap enough compared to quantum computation that you think of querying across that memory as having constant cost instead of cost proportional to the size of the memory.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-20T02:31:37.070" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17571" PostTypeId="1" CreationDate="2021-05-20T04:06:58.283" Score="2" ViewCount="21" Body="&lt;p&gt;As stated in UT's QML course for a QPU that is interacting with the environment:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The environment is defined by a temperature &lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;, and if we let the&#xA;system equilibrate, the QPU will become thermalized at temperature&#xA;&lt;span class=&quot;math-container&quot;&gt;$T$&lt;/span&gt;. As we saw in the notebook on evolution in open and closed&#xA;systems, the energy of the states will follow a Boltzmann&#xA;distribution: &lt;span class=&quot;math-container&quot;&gt;$\rho_0=\frac{1}{Z} e^{-H/T}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$Z=tr (e^{-H/T})$&lt;/span&gt; is&#xA;a normalization factor (called the &lt;em&gt;partition function&lt;/em&gt;), ensuring&#xA;that &lt;span class=&quot;math-container&quot;&gt;$tr(\rho_0)=1$&lt;/span&gt;. The inverse temperature &lt;span class=&quot;math-container&quot;&gt;$1/T$&lt;/span&gt; is often denoted by&#xA;&lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;, so the state can also be written as &lt;span class=&quot;math-container&quot;&gt;$\rho_0=\frac{1}{Z}&#xA;&amp;gt; e^{-\beta H}$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; has a discrete basis of orthonormal eigenstates&#xA;&lt;span class=&quot;math-container&quot;&gt;$\{|n\rangle\}$&lt;/span&gt; with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\{E_n\}$&lt;/span&gt;, we can write &lt;span class=&quot;math-container&quot;&gt;$H=\sum_n E_n&#xA;&amp;gt; |n\rangle \langle n|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_0=\frac{1}{Z} \sum_n e^{-E_n/T}&#xA;&amp;gt; |n\rangle \langle n|$&lt;/span&gt; (since exponentiating a diagonal operator&#xA;consists in exponentiating the elements of the diagonal). Hence, the&#xA;thermal density matrix is a mixed state where each eigenstate of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;&#xA;with energy &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; has a classical probability &lt;span class=&quot;math-container&quot;&gt;$P(E)=\frac{1}{Z}&#xA;&amp;gt; e^{-E/T}$&lt;/span&gt;, a Boltzmann distribution. We can see that the minimum&#xA;energy eigenstate will have the highest probability. When &lt;span class=&quot;math-container&quot;&gt;$T&#xA;&amp;gt; \rightarrow 0$&lt;/span&gt;, the minimum energy eigenstate will have a probability&#xA;close to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;. When &lt;span class=&quot;math-container&quot;&gt;$T \rightarrow \infty$&lt;/span&gt;, all the eigenstates tend to&#xA;have equal probability&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Does this mean that after running an algorithm in a system interacting with the environment, instead of getting an output pure state, we get a mixed state described by &lt;span class=&quot;math-container&quot;&gt;$\rho_0$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="12302" LastActivityDate="2021-05-20T04:06:58.283" Title="understanding final state of a QPU interacting with the environment" Tags="&lt;noise&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17573" PostTypeId="1" AcceptedAnswerId="17574" CreationDate="2021-05-20T08:46:33.877" Score="3" ViewCount="76" Body="&lt;p&gt;Is there a way to save vectorized images in Qiskit? I am using&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw('latex', filename='./file.pdf')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;They type of the image is a pdf, but it looks like a png exported as a pdf. For reference I attach here a figure of the differences I point out.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/cQIpA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cQIpA.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hopefully some differences can be noticed. The top subfigure was made with &lt;code&gt;Quantikz&lt;/code&gt;, while the other directly with &lt;code&gt;Qiskit&lt;/code&gt;. The difference that the top is vectorized and the other looks like it isn't.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The problem is solved using what luciano pointed out. I just want to add that the resulting pdf circuit may still need some cleaning. Apparently the figure is not &amp;quot;tight framed&amp;quot;, I attach an example of what I mean&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/QucdY.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/QucdY.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The letters that appear at the bottom are part of the figure caption. One can see that there's a huge space between the image and the caption, along with a border that frames the image.&lt;/p&gt;&#xA;" OwnerUserId="15220" LastEditorUserId="5955" LastEditDate="2021-05-20T12:52:42.983" LastActivityDate="2021-05-20T12:52:42.983" Title="Saving vectorized circuits in Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17574" PostTypeId="2" ParentId="17573" CreationDate="2021-05-20T08:56:03.957" Score="3" Body="&lt;p&gt;With &lt;code&gt;'latex_source'&lt;/code&gt; you can save the LaTeX file and compile it later with pdflatex&lt;/p&gt;&#xA;&lt;p&gt;In an interactive console (such a Jupyter notebook), you can run the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;circuit.draw('latex_source', filename='./file.tex')&#xA;!pdflatex file.tex&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will create a file.pdf in actual PDF format.&lt;/p&gt;&#xA;&lt;p&gt;(I understand this is very unintuitive, &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/pull/6446&quot; rel=&quot;nofollow noreferrer&quot;&gt;I submitted a fix to it&lt;/a&gt;)&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-05-20T12:26:07.860" LastActivityDate="2021-05-20T12:26:07.860" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17575" PostTypeId="1" CreationDate="2021-05-20T09:25:14.863" Score="1" ViewCount="52" Body="&lt;p&gt;Suppose we are given that a quantum state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is close in trace distance to a pure state &lt;span class=&quot;math-container&quot;&gt;$\vert\psi\rangle\langle\psi\vert$&lt;/span&gt;. That is&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\|\rho - \vert\psi\rangle\langle\psi\vert\|_1 \leq \varepsilon,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;where &lt;span class=&quot;math-container&quot;&gt;$\|A\|_1 = \text{Tr}\sqrt{A^\dagger A}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Is it true that &lt;span class=&quot;math-container&quot;&gt;$\rho = (1 - \varepsilon)\vert\psi\rangle\langle\psi\vert + \varepsilon\vert\psi^\perp\rangle\langle\psi^\perp\vert$&lt;/span&gt;? This seems to ignore the possibility of off-diagonal terms so I think it's not the most general way to write &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. So what is the most general expression for &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;The motivation for this comes from the fact that the trace distance and fidelity satisfy the Fuchs van de Graaf inequality&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\|\rho - \vert\psi\rangle\langle\psi\vert\|_1 \leq \sqrt{1 - F(\rho, \vert\psi\rangle\langle\psi\vert)}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and equality holds if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is also pure. Here, we have a state that is almost pure and I am trying to show that the Fuchs van de Graaf inequality is also &amp;quot;almost&amp;quot; an equality.&lt;/p&gt;&#xA;" OwnerUserId="4831" LastEditorUserId="4831" LastEditDate="2021-05-20T12:35:25.880" LastActivityDate="2021-05-20T12:35:25.880" Title="General expression for a state that is close in trace distance to a pure state" Tags="&lt;quantum-state&gt;&lt;trace-distance&gt;" AnswerCount="0" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="17576" PostTypeId="1" CreationDate="2021-05-20T15:06:11.007" Score="3" ViewCount="57" Body="&lt;p&gt;How do you use the IBM quantum composer to encode some data &lt;span class=&quot;math-container&quot;&gt;$(a,b,c,d)$&lt;/span&gt; represented by a vector ket in which &lt;span class=&quot;math-container&quot;&gt;$a,b,c,d$&lt;/span&gt; have been normalized to one? &lt;span class=&quot;math-container&quot;&gt;$a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15798" LastEditorUserId="13991" LastEditDate="2021-05-20T18:26:01.753" LastActivityDate="2021-05-21T05:25:17.100" Title="Data embedding using IBM quantum composer" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;embedding&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17577" PostTypeId="2" ParentId="13056" CreationDate="2021-05-20T16:29:28.160" Score="0" Body="&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;e^{i \beta X} Z e^{-i \beta X} &amp;amp; = (I\cos(\beta)+iX\sin(\beta))Z(I\cos(\beta)-iX\sin(\beta)) \\&#xA;&amp;amp; = Z \cos(2\beta) + Y\sin(2\beta).&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Sorry, I am not quite following the last term&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;Y\sin(2\beta)&#xA;\end{align}&lt;/span&gt;&#xA;, how XZX leads to Y.  I must be wrong but&lt;/p&gt;&#xA;" OwnerUserId="15456" LastActivityDate="2021-05-20T16:29:28.160" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17578" PostTypeId="2" ParentId="17576" CreationDate="2021-05-20T17:16:02.807" Score="2" Body="&lt;p&gt;One way to do it is to use the initialize function then decomposed the circuit and print out the &lt;code&gt;qasm&lt;/code&gt; code and pull it over to the composer...&lt;/p&gt;&#xA;&lt;p&gt;There was a similar question to your question &lt;a href=&quot;https://quantumcomputing.stackexchange.com/q/16501/9858&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But here is an example that might help:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit, IBMQ&#xA;import numpy as np&#xA;num_qubits = 2&#xA;vector = [1,2,3,4] #[a,b,c,d] not normalize &#xA;initial_state = vector/np.linalg.norm(vector) #normalize the state &#xA;circuit = QuantumCircuit(num_qubits,num_qubits)&#xA;circuit.initialize(initial_state, [0,1])  &#xA;print(circuit)&#xA;&#xA;     ┌─────────────────────────────────────────────┐&#xA;q_0: ┤0                                            ├&#xA;     │  initialize(0.18257,0.36515,0.54772,0.7303) │&#xA;q_1: ┤1                                            ├&#xA;     └─────────────────────────────────────────────┘&#xA;c: 2/═══════════════════════════════════════════════&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And now you can use the &lt;code&gt;decomposed&lt;/code&gt; function to decomposed this circuit into the gates that is available within the composer:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/AdDiE.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/AdDiE.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;decomposed_circuit = transpile(circuit, basis_gates=['h', 'x', 'cx', 'ccx', 't', 'tdg', 's', 'sdg', 'p' , 'rz' , 'sx' ,'sxdg','rx', 'ry','rxx' , 'rzz',] )&#xA;&#xA;     ┌────────────┐┌───┐┌─────────────┐┌───┐&#xA;q_0: ┤ RY(2.0344) ├┤ X ├┤ RY(0.17985) ├┤ X ├&#xA;     ├────────────┤└─┬─┘└─────────────┘└─┬─┘&#xA;q_1: ┤ RY(2.3005) ├──■───────────────────■──&#xA;     └────────────┘                         &#xA;c: 2/═══════════════════════════════════════&#xA;                                           &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Extracting the 'qasm' code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;print(decomposed_circuit.qasm())&#xA;&#xA;print(decomposed_circuit.qasm())&#xA;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;qreg q[2];&#xA;creg c[2];&#xA;ry(2.0344439) q[0];&#xA;ry(2.300524) q[1];&#xA;cx q[1],q[0];&#xA;ry(0.1798535) q[0];&#xA;cx q[1],q[0];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now take that and paste it in the &lt;code&gt;QASM&lt;/code&gt; code block in the &lt;strong&gt;Circuit Composer&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pQW1f.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pQW1f.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now you have the initialize state that you wanted in the composer.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-20T17:36:22.263" LastActivityDate="2021-05-20T17:36:22.263" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17579" PostTypeId="1" CreationDate="2021-05-20T17:46:10.833" Score="2" ViewCount="56" Body="&lt;p&gt;Given a stabilizer code on &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits defined by a set of stabilizers &lt;span class=&quot;math-container&quot;&gt;$S_1,\cdots S_m$&lt;/span&gt;; The encoder &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is a matrix in &lt;span class=&quot;math-container&quot;&gt;$U(2^n)$&lt;/span&gt; (unitary group) such that &lt;span class=&quot;math-container&quot;&gt;$S_i E v = E v$&lt;/span&gt;. I'm pretty sure that &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; is always in the clifford group (a subgroup of &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;) and I think the proof shouldn't be too hard but I can't think of it. Does anyone know how to show this or a reference.&lt;/p&gt;&#xA;" OwnerUserId="12265" LastActivityDate="2021-05-20T18:39:29.363" Title="Proof that encoder for a stabilizer code is in the Clifford group" Tags="&lt;error-correction&gt;&lt;stabilizer-code&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17580" PostTypeId="1" AcceptedAnswerId="17584" CreationDate="2021-05-20T17:46:25.560" Score="1" ViewCount="78" Body="&lt;p&gt;I am an electrical engineer and am learning about quantum computing. I am writing a simulator in Python to help with the learning process.&lt;/p&gt;&#xA;&lt;p&gt;The code that I have can simulate up to 10 qubits. I have (so far) implemented the CNOT gate along with most of the single qubit gates.&lt;/p&gt;&#xA;&lt;p&gt;My computed final state vectors match with those from the IBM Quantum Composer, so I am encouraged that I'm on the right track.&lt;/p&gt;&#xA;&lt;p&gt;Quantum Composer shows the amount of entanglement for each qubit in a circuit, and this is the part that I'm having a lot of difficulty figuring out. IBM has given clues to how they do it, but it's very confusing to me due to my lack of education in this subject. See the first image below for their description.&lt;/p&gt;&#xA;&lt;p&gt;I am able to create the density matrix for my system, and from my reading it seems that partial traces of the density matrix are key to finding the per-qubit entanglement values.&lt;/p&gt;&#xA;&lt;p&gt;For the circuit show below, IBM shows that qubits 0,2 and 3 are &amp;quot;maximally entangled&amp;quot; with values of 0.5 (shown on the right with the three smaller black circles), while qubit 1 has no entanglement with its value of 1.0 (the larger circle).&lt;/p&gt;&#xA;&lt;p&gt;Could someone either describe the steps to find the per-qubit entanglement values or point me in the proper direction?&lt;/p&gt;&#xA;&lt;p&gt;Thank you very much.&lt;/p&gt;&#xA;&lt;p&gt;The four images below:&lt;/p&gt;&#xA;&lt;p&gt;IBM's definition of measure of entanglement.&lt;/p&gt;&#xA;&lt;p&gt;Circuit for three entangled qubits and one with no entanglement.&lt;/p&gt;&#xA;&lt;p&gt;State vector for this circuit.&lt;/p&gt;&#xA;&lt;p&gt;Probability amplitudes vs basis state (in a bar graph).&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/zYAin.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/zYAin.jpg&quot; alt=&quot;IBM's definition of measure of entanglement&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LP6Sl.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LP6Sl.jpg&quot; alt=&quot;Circuit for three entangled qubits and one with no entanglement&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/M6RXA.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/M6RXA.jpg&quot; alt=&quot;State vector for this circuit&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/GS3qV.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/GS3qV.jpg&quot; alt=&quot;Probability amplitudes vs basis state (in a bar graph)&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="8788" LastActivityDate="2021-05-20T21:00:06.673" Title="How to calculate the amount of entanglement for each qubit in a quantum computer" Tags="&lt;entanglement&gt;&lt;quantum-circuit&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17581" PostTypeId="1" CreationDate="2021-05-20T18:00:57.943" Score="1" ViewCount="44" Body="&lt;p&gt;I am a novice programmer with some skills in C++, C#, and Python.&lt;/p&gt;&#xA;&lt;p&gt;Would anybody have an idea about the average time needed to prepare for this certification?&#xA;(Fundamentals of Quantum Computation Using Qiskit v0.2X )&lt;/p&gt;&#xA;&lt;p&gt;If you can share your own experience, that would be of great value as well.&lt;/p&gt;&#xA;&lt;p&gt;Thanks in advance.&lt;/p&gt;&#xA;&lt;p&gt;Ruben&lt;/p&gt;&#xA;" OwnerUserId="15945" LastActivityDate="2021-05-20T18:00:57.943" Title="Time to prepare for Fundamentals of Quantum Computation Using Qiskit v0.2X?" Tags="&lt;qiskit&gt;" AnswerCount="0" CommentCount="7" ClosedDate="2021-05-21T20:22:21.557" ContentLicense="CC BY-SA 4.0" />
  <row Id="17582" PostTypeId="2" ParentId="17579" CreationDate="2021-05-20T18:22:06.543" Score="1" Body="&lt;p&gt;Assuming the encoder itself doesn't have to be fault tolerant, you can do the proof constructively.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Prepare the code space by projecting each of the stabilizers into the +1 eigenstate.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;For each stabilizer &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Measure &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If you're in the -1 eigenspace of &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, apply Pauli gates to flip the stabilizer (but not other stabilizers). E.g. stim can compute these Paulis for you via &lt;code&gt;stim.TableauSimulator.measure_kickback&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Perform an &lt;a href=&quot;https://algassert.com/post/1717&quot; rel=&quot;nofollow noreferrer&quot;&gt;observable swap&lt;/a&gt; between the physical qubit you want to encode and the logical observables.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Perform the Paulis making up a logical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; all controlled by the physical qubit.&lt;/li&gt;&#xA;&lt;li&gt;Apply a Hadamard to the physical qubit.&lt;/li&gt;&#xA;&lt;li&gt;Perform the Paulis making up a logical &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; all controlled by the physical qubit.&lt;/li&gt;&#xA;&lt;li&gt;Apply a Hadamard to the physical qubit.&lt;/li&gt;&#xA;&lt;li&gt;Perform the Paulis making up a logical &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; all controlled by the physical qubit.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Okay, so actually that strategy is not &lt;em&gt;quite&lt;/em&gt; Clifford, because it uses measurements. But you can replace each measurement with a controlled flipping of an ancilla (e.g. flip an ancilla conditioned on the stabilizer), and then the conditional Paulis can be controlled by the ancilla. Then just throw away the ancillae at the end.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the distance two surface code which has stabilizers &lt;span class=&quot;math-container&quot;&gt;$X_1 X_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_3 X_4$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2 Z_3 Z_4$&lt;/span&gt; and the logical observable pair &lt;span class=&quot;math-container&quot;&gt;$Z_1 Z_2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$X_1 X_3$&lt;/span&gt;. Here's an &lt;a href=&quot;https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B1%2C1%2C1%2C1%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22X%22%2C%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22X%22%2C%22X%22%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Z%22%2C%22Z%22%2C%22Z%22%2C%22Z%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22Z%22%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C%22Z%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C%22X%22%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Amps4%22%5D%2C%5B%5D%2C%5B%5D%2C%5B%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22Z%5E%C2%BC%22%5D%2C%5B%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%2C%22%E2%80%A6%22%5D%2C%5B%22X%22%2C1%2C%22X%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B%22Z%22%2C%22Z%22%2C1%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C%22H%22%5D%2C%5B%22X%22%2C1%2C%22X%22%2C1%2C1%2C1%2C1%2C%22%E2%80%A2%22%5D%2C%5B%22Amps4%22%5D%5D%7D&quot; rel=&quot;nofollow noreferrer&quot;&gt;encoding circuit&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/yRptD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/yRptD.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first half of the circuit is &amp;quot;measuring&amp;quot; the stabilizers onto ancillae and then applying Pauli kickbacks dependent on the results to get all of the stabilizers into the +1 eigenstate. The hardest part was finding the Pauli kickbacks; I just fiddled around with each one until the result become deterministic.&lt;/p&gt;&#xA;&lt;p&gt;The second half of the circuit is preparing a magic state to inject (this part isn't Clifford because I wanted to show that the state can be arbitrary) and then observable swapping it into the logical observables.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-05-20T18:39:29.363" LastActivityDate="2021-05-20T18:39:29.363" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17583" PostTypeId="2" ParentId="17580" CreationDate="2021-05-20T19:15:08.130" Score="1" Body="&lt;p&gt;You should use an entanglement measure. An overview of these are in &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504163&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In your case, you could try to use &lt;a href=&quot;http://www.hartmanhep.net/topics2015/18-entanglement-intro.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;entropy of entanglement&lt;/a&gt; which quantifies the amount of uncertainty in a quantum state (always between 0 and 1).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;If we know a state is classical then there's no uncertainty because we know the state of the system exactly i.e. entropy of entanglement is zero.&lt;/li&gt;&#xA;&lt;li&gt;If the state is maximally entangled then entropy of entanglement is one because it's the maximum amount of uncertainty one can have about the state.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Another measure that could be useful is &lt;a href=&quot;https://authors.library.caltech.edu/66493/2/chap10_15.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;quantum mutual information&lt;/a&gt;.It quantifies the amount of correlations present in the state.&lt;/p&gt;&#xA;" OwnerUserId="2598" LastActivityDate="2021-05-20T19:15:08.130" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17584" PostTypeId="2" ParentId="17580" CreationDate="2021-05-20T21:00:06.673" Score="3" Body="&lt;p&gt;The entanglement measure that you quote from IBM is equivalent to the &amp;quot;linear entropy&amp;quot; of the reduced system. The idea is that, if you have a pure quantum state and you trace out one of the subsystems, the resulting state will be pure if the original state had no entanglement. Conversely, if the resulting state is not pure, you know the original state was entangled. A drawback of this method is that it requires the overall original state to be pure.&lt;/p&gt;&#xA;&lt;p&gt;This can be seen from an example. If the state is of the form &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_0\otimes |\phi\rangle_1$&lt;/span&gt;, tracing out system &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; leaves the system in state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle_0$&lt;/span&gt;, which is pure. If the state is of the form &lt;span class=&quot;math-container&quot;&gt;$\left(|\uparrow\rangle_0\otimes|\downarrow\rangle_1+|\downarrow\rangle_0\otimes|\uparrow\rangle_1\right)/\sqrt{2}$&lt;/span&gt;, tracing out system &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; leaves the system in the mixed state &lt;span class=&quot;math-container&quot;&gt;$\left(|\uparrow\rangle_0 \langle\uparrow|+ |\downarrow\rangle_0 \langle\downarrow|\right)/2$&lt;/span&gt;, which is maximally mixed.&lt;/p&gt;&#xA;&lt;p&gt;So the requisite steps are: 1) tracing out extra degrees of freedom and 2) computing the purity of the resulting state.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&amp;quot;Tracing out&amp;quot; degrees of freedom: We begin with writing the overall state &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt; as a density matrix &lt;span class=&quot;math-container&quot;&gt;$\rho=|\Psi\rangle\langle\Psi|$&lt;/span&gt;. This is like making a rank-one matrix out of a unit vector. Then we choose which subsystem we are interested in keeping and which one we want to trace out - the example says keep subsystem &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; and trace out all subsystems with &lt;span class=&quot;math-container&quot;&gt;$i\neq j$&lt;/span&gt;, so let's keep system &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; and trace out all the subsystems with &lt;span class=&quot;math-container&quot;&gt;$i\neq 0$&lt;/span&gt;. Note: some people use the notation &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_i$&lt;/span&gt; to mean &amp;quot;trace out subsystem &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&amp;quot; and others use it to mean &amp;quot;trace out &lt;em&gt;all but&lt;/em&gt; subsystem &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;.&amp;quot; I am interpretting it as the former but I am not sure what IBM's convention is.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We need to know a set of orthonormal basis states for each subsystem. Since we are dealing with qubits, we know that subsystem &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; has basis states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_i$&lt;/span&gt;, or something like &lt;span class=&quot;math-container&quot;&gt;$|\uparrow\rangle_i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\downarrow\rangle_i$&lt;/span&gt; that I wrote before. The partial trace of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; with respect to system &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; (in my notation, &amp;quot;tracing out subsystem &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;&amp;quot;) is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}_i(\rho)=\vphantom{a}_i\langle 0|\rho|0\rangle_i+\vphantom{a}_i\langle 1|\rho|1\rangle_i .$$&lt;/span&gt; In general, for basis states labeled by &lt;span class=&quot;math-container&quot;&gt;$|n\rangle_i$&lt;/span&gt;, tracing out subsystem &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; is done by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}_i(\rho)=\sum_n \vphantom{a}_i\langle n|\rho|n\rangle_i.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This procedure can be repeated for tracing out all of the subsystems that are not of interest. In your case, I believe you want to trace out all of the other qubit degrees of freedom other than some &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;, then repeat the process for all &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;ol start=&quot;2&quot;&gt;&#xA;&lt;li&gt;Purity is rather straightforward: compute the trace of the square of the density matrix. So once you've gotten &lt;span class=&quot;math-container&quot;&gt;$\mathrm{Tr}_i(\rho)$&lt;/span&gt;, or maybe some cascaded thing like &lt;span class=&quot;math-container&quot;&gt;$$\mathrm{Tr}_1\{\mathrm{Tr}_2[\mathrm{Tr}_3(\rho)]\},$$&lt;/span&gt; you square the matrix, take the trace, and voila! If the initial pure state was separable, of the form &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle=|\psi_0\rangle_0\otimes |\psi_1\rangle_1\otimes\cdots |\psi_n\rangle_n$&lt;/span&gt;, then tracing out everything but subsystem &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt; leaves pure the density matrix &lt;span class=&quot;math-container&quot;&gt;$|\psi_j\rangle_j \langle \psi_j|_j$&lt;/span&gt;. If the initial pure state is entangled, the purity of the reduced state is less than unity.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Finding amounts of entanglement when the original state is itself mixed is much more nuanced, but does not seem to be the focus of your question.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-20T21:00:06.673" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17585" PostTypeId="1" CreationDate="2021-05-20T22:44:45.933" Score="4" ViewCount="110" Body="&lt;p&gt;Variational Quantum Eigensolver is used in quantum chemistry and combinatorial optimization (CO). I'm interested in the latter. In the CO setting a Hamiltonian is a diagonal matrix with real entries and it can be expressed as a linear combination of Puali Z matrices.&lt;/p&gt;&#xA;&lt;p&gt;From what I read a few ansatz' were proposed: hardware efficient ansatz, Hamiltonian variational ansatz and unitary coupled cluster ansatz.&lt;/p&gt;&#xA;&lt;p&gt;Regardless of the architecture of the ansatz, it seems the entanglement is a very desired property as it somehow improves classical optimization part.&lt;/p&gt;&#xA;&lt;p&gt;I don't understand why we need entanglement for solving CO problems? I could just use an RY gate on each qubit and that would allow me to span all states with real amplitudes.&lt;/p&gt;&#xA;&lt;p&gt;However, when I ran a small experiment with an ansatz containing only RY gates, the results were worse than the same ansatz with some extra CNOT gates. So it does seem that entanglement is important. But what does it do?&lt;/p&gt;&#xA;&lt;p&gt;My intuition (which is incorrect) tells me that entanglement could significantly reduce the space of solutions because some states become too correlated. Think about the following 2 qubit system which produces the EPR state. In this contrived case we only cover half of a solution space which might be really bad for some problems. I expect the same behaviour mildly manifest itself in systems with more qubits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ky0zp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ky0zp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Thank you.&lt;/p&gt;&#xA;" OwnerUserId="15947" LastActivityDate="2021-05-23T06:00:33.097" Title="Role of entanglement in a VQE ansatz for combinatorial problems" Tags="&lt;entanglement&gt;&lt;vqe&gt;&lt;optimization&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17586" PostTypeId="2" ParentId="17585" CreationDate="2021-05-20T23:34:57.143" Score="3" Body="&lt;p&gt;With just single qubit gate in your circuit, you can only generate a small subset of quantum states. In fact, the states that you can generate are called &lt;strong&gt;separable states&lt;/strong&gt;. These states have no entanglement in them.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example to see why you need to be able to generate entangle state to have successful VQE calculation, supposed you have the Hamiltonian &lt;span class=&quot;math-container&quot;&gt;$H = \begin{pmatrix} 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And you running VQE to find the lowest eigenvalue to this Hamiltonian. This means you need to be able to generate the &lt;strong&gt;eigenstate&lt;/strong&gt; that correspond to the lowest eigenvalue. Now, if you look at all the eigenstates of &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; and their correspondence eigenvalues:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_1 \rangle = \begin{pmatrix} 1/\sqrt{2} \\ 0 \\ 0 \\ 1/\sqrt{2} \end{pmatrix} \rightarrow 1, |\psi_2 \rangle = \begin{pmatrix} 1/\sqrt{2} \\ 0 \\ 0 \\ -1/\sqrt{2}\end{pmatrix} \rightarrow -1,  |\psi_3 \rangle = \begin{pmatrix} 0 \\ 1/\sqrt{2}\\ 1/\sqrt{2} \\ 0\end{pmatrix} \rightarrow 1,  |\psi_4 \rangle = \begin{pmatrix} 0 \\ -1/\sqrt{2} \\ 1/\sqrt{2} \\ 0\end{pmatrix} \rightarrow -1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here you should notice that these states are all entangled.&#xA;So if you want your VQE algorithm to find the lowest eigenvalue (-1) in this case, it must be able to generate an entangled state. That means if you design your Ansatze only made up from &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation, for example:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/7ez8j.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/7ez8j.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;then you can't never generate such entangled state, which means you can never reach the minimum eigenvalue. So the complexity of the Ansatz depends on the complexity of the Hamiltonian that you consider.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;But you are right about the fact that given a diagonal Hamiltonian, like those that you are interested in then the eigenstate will be one of the computational basis state! Thus, you do not need entanglement gate or any sort... in fact, you only need &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; gates to generate such states. But then this means you have to iterate through &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; states... which is not ideal.&lt;/p&gt;&#xA;&lt;p&gt;And since you know the solution you are looking for is in one of these states, it is quite easy to classically go through all the calculations of the expectation values (depending on how many terms in your cost function Hamiltonian). You do have to do &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; check, so it's not ideal either, but these checks are very easy... you just look at the parity of the Pauli string and this can be done very quickly....  So this makes me wonder, giving the sophistication of classical computer systems (like &lt;a href=&quot;https://www.alcf.anl.gov/aurora&quot; rel=&quot;nofollow noreferrer&quot;&gt;this cluster&lt;/a&gt;), how many qubits do we need for quantum computer to beat classical computer? Classical computers can go through this check so fast... but since the number of terms to check do scale as &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;... we will reach a bottle neck at some point. But how many qubits is that going to take before quantum computer wins out? 100 or few hundreds?&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-23T06:00:33.097" LastActivityDate="2021-05-23T06:00:33.097" CommentCount="8" ContentLicense="CC BY-SA 4.0" />
  <row Id="17587" PostTypeId="2" ParentId="17576" CreationDate="2021-05-21T05:25:17.100" Score="0" Body="&lt;p&gt;You can implement a method proposed in this article &lt;a href=&quot;http://cds.cern.ch/record/749895/files/0407010.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Transformation of quantum states using uniformly controlled rotations&lt;/a&gt;. The authors present a method for transforming any quantum state to any other one. Of course, this allow to change initial state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^n$&lt;/span&gt; in the composer to arbitrary &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit. The method works with &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$Ry$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$Rz$&lt;/span&gt; gates only. All these are available in the composer.&lt;/p&gt;&#xA;&lt;p&gt;According to my knowledge, this method is implemented in Qiskit &lt;code&gt;init&lt;/code&gt; function which proposed &lt;em&gt;KAJ226&lt;/em&gt; in the other answer.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-05-21T05:25:17.100" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17588" PostTypeId="2" ParentId="7098" CreationDate="2021-05-21T07:43:18.907" Score="0" Body="&lt;p&gt;Sign up an IBMid account by your original mail address will fix it.&lt;/p&gt;&#xA;" OwnerUserId="15950" LastActivityDate="2021-05-21T07:43:18.907" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17589" PostTypeId="2" ParentId="17585" CreationDate="2021-05-21T08:04:45.597" Score="2" Body="&lt;p&gt;For diagonal Hamiltonians, you might not need entanglement at all.&lt;/p&gt;&#xA;&lt;p&gt;The intuition for why a more complicated ansatz might be useful is that the optimization landscape is somehow better, in the sense that the minimum is easier to find. However, in &lt;a href=&quot;https://journals.aps.org/pre/abstract/10.1103/PhysRevE.99.013304&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt;, the author applies VQE to some combinatorial optimization problems and finds that variational forms with entanglement don't bring any advantage.&lt;/p&gt;&#xA;&lt;p&gt;One more thing: a complicated entagling ansatz may be useful if it is tailored to the problem at hand, like in QAOA.&lt;/p&gt;&#xA;" OwnerUserId="5103" LastActivityDate="2021-05-21T08:04:45.597" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17590" PostTypeId="1" AcceptedAnswerId="17606" CreationDate="2021-05-21T08:39:23.797" Score="2" ViewCount="65" Body="&lt;p&gt;From what I understand, MPS is just a simpler way to write out a state, compared to the density matrix. But how do I get those &lt;span class=&quot;math-container&quot;&gt;$A_i$&lt;/span&gt; matrices? From all the examples I read, people just somehow &amp;quot;have&amp;quot; the matrices in their pocket already. Is there a way to generate them from some random state, say &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle = \alpha|\uparrow\rangle^{\otimes N}+\beta|\downarrow\rangle^{\otimes N}$&lt;/span&gt;, or some random density matrix? Feel free to set &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to small numbers if it becomes too complicated, I just really want to see an example of how this works in general, not just a GHZ state! Thanks a lot!&lt;/p&gt;&#xA;&lt;p&gt;Crosspost with: &lt;a href=&quot;https://physics.stackexchange.com/questions/638206/how-to-translate-from-a-state-density-matrix-formalism-to-matrix-product-state-r&quot;&gt;https://physics.stackexchange.com/questions/638206/how-to-translate-from-a-state-density-matrix-formalism-to-matrix-product-state-r&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="7598" LastEditorUserId="7598" LastEditDate="2021-05-23T13:18:35.793" LastActivityDate="2021-05-23T13:18:35.793" Title="How to find the $A_i$ in the matrix product state representation?" Tags="&lt;quantum-state&gt;&lt;density-matrix&gt;&lt;tensor-networks&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17591" PostTypeId="1" CreationDate="2021-05-21T17:12:52.517" Score="5" ViewCount="53" Body="&lt;p&gt;I was reading about transmon qubits, and I know that they are not true two-level systems. Are there any math/papers which talk about how those extra energy levels affect the computation? I'm assuming it may have a small effect.&lt;/p&gt;&#xA;" OwnerUserId="15561" LastEditorUserId="55" LastEditDate="2021-05-22T12:08:36.483" LastActivityDate="2021-05-27T11:23:55.287" Title="How do the extra energy levels of a transmon qubit affect computation/fidelity?" Tags="&lt;error-correction&gt;&lt;resource-request&gt;&lt;physical-qubit&gt;&lt;fidelity&gt;&lt;superconducting-quantum-computing&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17592" PostTypeId="2" ParentId="14883" CreationDate="2021-05-21T20:02:17.900" Score="1" Body="&lt;p&gt;This is a late answer. But while going through some old questions, I found this and thought I should add an answer here in case someone run into this issue in the future.&lt;/p&gt;&#xA;&lt;p&gt;To calculate the estimated run time on your circuit, you can do this as follow:&lt;/p&gt;&#xA;&lt;p&gt;Transpile your circuit into the basis gate set &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt;. The reason for this is because all single qubit gates can be implemented very quickly on the quantum computer. We are just talking about implementing them on physical qubits here, not fault-tolerance implementation. Once your circuit is in this basis, you can use Directed Acylic Graph to find the longest path. Note that, the longest path here is the path with the most CNOT (CX) gates. This is because, when there are more than one single qubit gate next to each other, it can be condensed down to a single &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate. Once at this step, retreive the quantum hardware properties to extract the time do each of the CNOT in your longest path then add them up. For the single qubit &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate, you can take it to be maximum time of the single qubit gates listed... since the time of &lt;span class=&quot;math-container&quot;&gt;$U3$&lt;/span&gt; gate is so much less compare to &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt; gate, it shouldn't be a big deal.&lt;/p&gt;&#xA;&lt;p&gt;First make sure to import the following&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.dagcircuit import DAGCircuit&#xA;from qiskit.converters import circuit_to_dag&#xA;from qiskit.compiler import transpile&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Step 1:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;transpile_circuit = transpile(circuit, basis_gates=['u3', 'cx'] )&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Step2:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt;dag_circuit = circuit_to_dag(transpile_circuit)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Step 3:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;code&gt; dag_circuit.count_ops_longest_path()&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This will give you a dictionary, something like: &lt;code&gt;{'u3': 10, 'cx': 25, 'measure': 5}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now use Qiskit &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.providers.models.BackendProperties.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;BackendProperties&lt;/a&gt; to retrieve the gate time like what discussed above.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-21T20:02:17.900" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17593" PostTypeId="2" ParentId="16844" CreationDate="2021-05-21T23:33:04.513" Score="2" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;add the value of the first share to the second (modulo three), and then add the value of the second share to the first&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;means you first perform, on the 2 shares, the 2-qutrit unitary which maps&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle\to|00\rangle\\&#xA;|01\rangle\to|01\rangle\\&#xA;\ldots\\&#xA;|22\rangle\to|21\rangle$$&lt;/span&gt;&#xA;(i.e. adding the first share to the second modulo 3, so &lt;span class=&quot;math-container&quot;&gt;$2+2 = 1 \mod 3$&lt;/span&gt;, hence the mapping of 22 to 21)&lt;/p&gt;&#xA;&lt;p&gt;Then you perform the unitary which adds the second to the first &lt;span class=&quot;math-container&quot;&gt;$\mod 3$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|00\rangle\to|00\rangle\\&#xA;|01\rangle\to|11\rangle\\&#xA;\ldots\\&#xA;|22\rangle\to|12\rangle$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Apply both and, e.g., you map the term &lt;span class=&quot;math-container&quot;&gt;$\beta|120\rangle\to\beta|100\rangle\to\beta|100\rangle$&lt;/span&gt;.  The encoded state turns into the final state you show in your question, with the secret reproduced on the first qutrit.&lt;/p&gt;&#xA;" OwnerUserId="15956" LastEditorUserId="9006" LastEditDate="2021-05-22T06:42:45.060" LastActivityDate="2021-05-22T06:42:45.060" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17594" PostTypeId="1" CreationDate="2021-05-22T00:44:27.407" Score="2" ViewCount="56" Body="&lt;p&gt;Does anyone know much about quantum dot product:&lt;/p&gt;&#xA;&lt;p&gt;Lets say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \frac{|0\rangle_1|\overrightarrow{x_i}\rangle_2 + |1\rangle_1|\overrightarrow{x_j}\rangle_2}{\sqrt 2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi \rangle = \frac{\|\overrightarrow{x_i}\| |0\rangle_1 - \|\overrightarrow{x_j}\| |1\rangle_1}{\sqrt Z}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and assume Z is given&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ Z = \|\overrightarrow{x_i}\|^2 + \|\overrightarrow{x_j}\|^2 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now feeding &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle_1|\psi \rangle_2|\phi \rangle_3$&lt;/span&gt; into the following dot product gate and take a projective measurement in &amp;quot;0&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt; in the basis of {&lt;span class=&quot;math-container&quot;&gt;$| 0 \rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$| 1 \rangle$&lt;/span&gt;}&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/w7dli.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/w7dli.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Which is essentially &lt;span class=&quot;math-container&quot;&gt;$\frac {1}{2}(| 0 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 1 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 0 \rangle_1|\phi \rangle_2|\psi \rangle_3 - | 1 \rangle_1|\phi \rangle_2|\psi \rangle_3)$&lt;/span&gt; (1) before measurement.&lt;/p&gt;&#xA;&lt;p&gt;Now I was told that the Probability of &amp;quot;0&amp;quot; is &lt;span class=&quot;math-container&quot;&gt;$P(0) = \frac{1}{2}(1+\frac{\|\overrightarrow{x_i} - \overrightarrow{x_j}\|^2}{2Z})$&lt;/span&gt; (2)&lt;/p&gt;&#xA;&lt;p&gt;But I cannot derive the steps between (1) and (2), can someone perhaps show me the way?&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href=&quot;https://physics.stackexchange.com/q/638121/58382&quot;&gt;Cross-posted on physics.SE&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="15958" LastEditorUserId="55" LastEditDate="2021-05-22T12:00:06.413" LastActivityDate="2021-05-22T12:00:06.413" Title="In the swap test, how is the final probability $P(0)$ calculated?" Tags="&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;swap-test&gt;" AnswerCount="1" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17595" PostTypeId="2" ParentId="17594" CreationDate="2021-05-22T07:34:47.143" Score="2" Body="&lt;p&gt;Note that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}|\psi \rangle &amp;amp;= \frac {1}{2}(| 0 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 1 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 0 \rangle_1|\phi \rangle_2|\psi \rangle_3 - | 1 \rangle_1|\phi \rangle_2|\psi \rangle_3) \\&#xA;&amp;amp;= \dfrac{1}{2}  |0\rangle \bigg( |\psi\rangle_2 |\phi \rangle_3 + |\phi\rangle_2 |\psi\rangle_3 \bigg) + \dfrac{1}{2}|1\rangle \bigg( |\psi\rangle_2 |\phi\rangle_3 - |\phi\rangle_2|\psi\rangle_3 \bigg)\\&#xA;&amp;amp;= \dfrac{1}{2}  |0\rangle \bigg( |\psi\rangle |\phi \rangle + |\phi\rangle |\psi\rangle \bigg) + \dfrac{1}{2}|1\rangle \bigg( |\psi\rangle |\phi\rangle - |\phi\rangle|\psi\rangle \bigg)\\&#xA;\end{align}&lt;/span&gt;&#xA;I just removed the subscript in the last equation as it's not really needed.&lt;/p&gt;&#xA;&lt;p&gt;Then we have that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;P(0) &amp;amp;= P(|0\rangle) = \big| \langle 0| \psi \rangle \big|^2 \\&#xA;&amp;amp;=\bigg| \dfrac{1}{2} \langle 0 |0\rangle \bigg( |\psi\rangle |\phi \rangle + |\phi\rangle |\psi\rangle \bigg) + \dfrac{1}{2} \langle 0|1\rangle \bigg( |\psi\rangle |\phi\rangle - |\phi\rangle|\psi\rangle \bigg) \bigg|^2 \\&#xA;&amp;amp;= \bigg| \dfrac{1}{2} \cdot 1 \cdot \bigg( |\psi\rangle |\phi \rangle + |\phi\rangle |\psi\rangle \bigg) + 0  \bigg|^2 \\&#xA;&amp;amp;= \dfrac{1}{4} \bigg| |\psi\rangle |\phi \rangle + |\phi\rangle |\psi\rangle \bigg|^2\\&#xA;&amp;amp;= \dfrac{1}{4} \big(\langle\psi| \langle\phi| + \langle\phi|\langle\psi| \big) \big( |\psi\rangle |\phi \rangle + |\phi\rangle |\psi\rangle \big) \\&#xA;&amp;amp;= \dfrac{1}{4} \bigg( 2 + 2\langle\psi|\langle\phi| \psi\rangle |\phi \rangle \bigg)\\&#xA;&amp;amp;= \dfrac{1}{4}\bigg(2 + 2\big| \langle \psi |\phi \rangle \big|^2 \bigg) = \dfrac{1}{2}\bigg(1 + \big| \langle \psi |\phi \rangle \big|^2 \bigg)&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, note that since&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi \rangle = \frac{|0\rangle_1 |\overrightarrow{x_i}\rangle_2 + |1\rangle_1|\overrightarrow{x_j}\rangle_2}{\sqrt 2}$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi \rangle = \frac{\|\overrightarrow{x_i}\| |0\rangle_1 - \|\overrightarrow{x_j}\| |1\rangle_1}{\sqrt Z}.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;then we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\langle \psi| \phi \rangle &amp;amp;=  \dfrac{1}{\sqrt{2}\sqrt{Z}} \bigg( \langle 0 | 0 \rangle ||\overrightarrow{x_i}|| \  |\overrightarrow{x_i}\rangle_2 - 0 + 0 - \langle 1 | 1 \rangle ||\overrightarrow{x_j}|| \ |\overrightarrow{x_j}\rangle_2\bigg)\\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}\sqrt{Z}} \bigg(  ||\overrightarrow{x_i}|| \ |\overrightarrow{x_i}\rangle_2 -  ||\overrightarrow{x_j}|| \ |\overrightarrow{x_j}\rangle_2\bigg)\\&#xA;&amp;amp;= \dfrac{1}{\sqrt{2}\sqrt{Z}} \bigg(  \overrightarrow{x_i}  - \overrightarrow{x_j} \bigg)\\&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The last equality is the way  &lt;span class=&quot;math-container&quot;&gt;$|x_i \rangle$&lt;/span&gt; is encoded, even though you didn't mentioned it, it should be &lt;span class=&quot;math-container&quot;&gt;$|x_i \rangle  = \sum ||\overrightarrow{x_i}||^{-1} \ x_i |i\rangle $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And therefore,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ P(0)  = \dfrac{1}{2}\bigg(1 + \big| \langle \psi |\phi \rangle \big|^2 \bigg) =  \dfrac{1}{2}\bigg(1 + \bigg| \dfrac{1}{\sqrt{2}\sqrt{Z}} \big(  \overrightarrow{x_i}  - \overrightarrow{x_j} \big) \bigg|^2 \bigg)  = \dfrac{1}{2}\bigg(1 + \dfrac{ \big| \overrightarrow{x_i}  - \overrightarrow{x_j}  \big|^2  }{2Z} \bigg)$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-22T07:34:47.143" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17596" PostTypeId="1" AcceptedAnswerId="17597" CreationDate="2021-05-22T09:47:07.953" Score="1" ViewCount="54" Body="&lt;p&gt;To model a single qubit one would need enough memory for &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; complex numbers. If we have an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; qubit system, we would have to store &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; complex numbers.&lt;/p&gt;&#xA;&lt;p&gt;The general statement is that to store an &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-qubit system, one would require memory for &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; complex numbers. My understanding is that entanglement somehow transforms &lt;span class=&quot;math-container&quot;&gt;$2N$&lt;/span&gt; into &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; but I don't understand how.&lt;/p&gt;&#xA;&lt;p&gt;So why do entangled systems require more memory than non-entangled ones?&lt;/p&gt;&#xA;" OwnerUserId="14216" LastEditorUserId="55" LastEditDate="2021-05-22T11:54:32.597" LastActivityDate="2021-05-22T12:07:49.960" Title="Why does entanglement complicate quantum simulation?" Tags="&lt;entanglement&gt;&lt;simulation&gt;&lt;memory-space&gt;&lt;space-complexity&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17597" PostTypeId="2" ParentId="17596" CreationDate="2021-05-22T11:54:07.377" Score="5" Body="&lt;p&gt;Welcome to Quantum Computing StackExchange.&lt;/p&gt;&#xA;&lt;p&gt;To see why it would require &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; complex numbers instead of &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; to represent a general entangled &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state, let's assume we have a 3-qubit system,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\alpha_1, \beta_1), (\alpha_2, \beta_2), (\alpha_3, \beta_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Where &lt;span class=&quot;math-container&quot;&gt;$(\alpha_i, \beta_i)$&lt;/span&gt; denotes the representation of the &lt;span class=&quot;math-container&quot;&gt;$i^{th}$&lt;/span&gt; qubit in a classical computer memory.&lt;/p&gt;&#xA;&lt;p&gt;If we apply &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;-gate on the first qubit the state will become,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\beta_1, \alpha_1), (\alpha_2, \beta_2), (\alpha_3, \beta_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if we apply &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt;-gate on the second qubit we will have,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\beta_1, \alpha_1), (\alpha_2, -\beta_2), (\alpha_3, \beta_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see, only &lt;span class=&quot;math-container&quot;&gt;$2n$&lt;/span&gt; memory locations are sufficient.&lt;/p&gt;&#xA;&lt;p&gt;Now, let's introduce entanglement. If we apply a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;-gate to the first two qubits, then we will not be able to write the state of each qubit separately. You can easily check that the state will become,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\beta_1\alpha_2, -\beta_1\beta_2, -\alpha_1\beta_2, \alpha_1\alpha_2), (\alpha_3, \beta_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And if we then apply a &lt;span class=&quot;math-container&quot;&gt;$CNOT$&lt;/span&gt;-gate to the second two qubits the new state will be,&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$(\beta_1\alpha_2\alpha_3, \beta_1\alpha_2\beta_3, -\beta_1\beta_2\beta_3, -\beta_1\beta_2\alpha_3, -\alpha_1\beta_2\alpha_3, -\alpha_1\beta_2\beta_3, \alpha_1\alpha_2\beta_3, \alpha_1\alpha_2\alpha_3)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It is an &lt;span class=&quot;math-container&quot;&gt;$8$&lt;/span&gt;-dimensional vector which needs 8 (= &lt;span class=&quot;math-container&quot;&gt;$2^3$&lt;/span&gt;) complex numbers to represent it instead of 6 (= &lt;span class=&quot;math-container&quot;&gt;$2.3$&lt;/span&gt;) as it was before introducing any entanglement.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2021-05-22T12:07:49.960" LastActivityDate="2021-05-22T12:07:49.960" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17598" PostTypeId="1" CreationDate="2021-05-22T13:52:16.540" Score="0" ViewCount="48" Body="&lt;p&gt;I am planning to write an article which compares QDK and Qiskit&lt;/p&gt;&#xA;&lt;p&gt;Mainly talking about the different interfaces, and difference in running few algorithms&lt;/p&gt;&#xA;&lt;p&gt;What all parameters should I compare and take into account, Would love some suggestions&lt;/p&gt;&#xA;" OwnerUserId="14675" LastEditorUserId="14675" LastEditDate="2021-05-22T14:44:14.417" LastActivityDate="2021-05-25T02:16:05.297" Title="Things that I can compare between QDK and Qiskit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;q#&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17599" PostTypeId="1" AcceptedAnswerId="17601" CreationDate="2021-05-22T14:23:10.050" Score="0" ViewCount="53" Body="&lt;p&gt;I am wondering how to represent these kinds of circuits as a matrix. Is there any formula for doing this?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TKG6i.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TKG6i.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/P5JQV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/P5JQV.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15928" LastEditorUserId="55" LastEditDate="2021-05-22T16:16:17.363" LastActivityDate="2021-05-22T16:51:54.140" Title="How to represent a CNOT gate operating on three-qubit states as a matrix?" Tags="&lt;quantum-gate&gt;&lt;matrix-representation&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="1" ClosedDate="2021-05-24T16:01:03.850" ContentLicense="CC BY-SA 4.0" />
  <row Id="17600" PostTypeId="1" CreationDate="2021-05-22T14:27:52.920" Score="0" ViewCount="16" Body="&lt;p&gt;Are they different ways to solve the same problem of factoring?&lt;/p&gt;&#xA;" OwnerUserId="15769" LastActivityDate="2021-05-22T14:27:52.920" Title="Is there a connection between Kitaev's phase estimation algorithm and the period finding algorithm used for Shor's factoring?" Tags="&lt;shors-algorithm&gt;&lt;phase-estimation&gt;" AnswerCount="0" CommentCount="0" ClosedDate="2021-05-24T15:58:50.353" ContentLicense="CC BY-SA 4.0" />
  <row Id="17601" PostTypeId="2" ParentId="17599" CreationDate="2021-05-22T15:53:23.003" Score="2" Body="&lt;p&gt;Yes, all quantum circuits can be view as a &lt;span class=&quot;math-container&quot;&gt;$2^n \times 2^n$&lt;/span&gt; unitary matrix as &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is the number of of qubits.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Long way:&lt;/h3&gt;&#xA;&lt;p&gt;For your circuits, first note the circuit identity:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KRxxp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KRxxp.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, using the circuit on the right, you can see that it can be written as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = \big(CNOT \otimes I\big)\cdot\big(I \otimes CNOT\big)\cdot \big(CNOT \otimes I\big)\cdot\big(I \otimes CNOT\big)  $$&lt;/span&gt;&#xA;and recall that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT \otimes I = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix} = &#xA;\begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA; \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;and similarly&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ I\otimes CNOT = \begin{pmatrix} 1 &amp;amp; 0 \\ 0 &amp;amp; 1 \end{pmatrix} \otimes \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix}  = &#xA;\begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA; \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From here you can just do usual multiplication to find that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you should end up with something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ U = \begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA; \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you use &lt;strong&gt;qiskit&lt;/strong&gt; , you can extract this operator pretty easily, you can do it as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;import qiskit.quantum_info as qi&#xA;&#xA;circuit = QuantumCircuit(3)&#xA;circuit.cx(2,0)&#xA;op = qi.Operator(circuit)&#xA;print(np.real(op) ) #since the matrix has no complex coeff, this makes it easier to look at &#xA;&#xA;array([[1., 0., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 1., 0., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 1., 0., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 1., 0., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 1., 0., 0.],&#xA;       [0., 0., 0., 0., 1., 0., 0., 0.],&#xA;       [0., 0., 0., 0., 0., 0., 0., 1.],&#xA;       [0., 0., 0., 0., 0., 0., 1., 0.]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;note that in &lt;strong&gt;qiskit&lt;/strong&gt; I had to reversed the operation of CNOTS, using the bottom qubit as the control and the top qubit as the target. This is because qiskit uses &lt;strong&gt;little endian&lt;/strong&gt; convention so things go backward... &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.circuit.library.CXGate.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;look here&lt;/a&gt; for more info about how that effects the way we look at thing.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Alternative, shorter way:&lt;/h3&gt;&#xA;&lt;p&gt;@gls commented brought up a different way to do this, and it's easier than thinking than thinking of decompose the gate like we did above.&lt;/p&gt;&#xA;&lt;p&gt;First, note that CNOT gate can be written as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT_{12} = |0\rangle \langle 0| \otimes I +  |1 \rangle \langle 1| \otimes X $$&lt;/span&gt;&#xA;This is the definition of the CNOT gate. This is assuming that the control and  target qubit are next to each other. But if there is an intermediate qubit then we can do it as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT_{13} = |0\rangle \langle 0| \otimes I \otimes I + |1 \rangle \langle 1| \otimes I \otimes X $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here note that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |0\rangle \langle 0 | = \begin{pmatrix}1 \\ 0 \end{pmatrix}  \begin{pmatrix} 1 &amp;amp; 0 \end{pmatrix} =  \begin{pmatrix}1 &amp;amp; 0 \\ 0  &amp;amp; 0 \end{pmatrix} \hspace{1 cm} |1\rangle \langle 1 | = \begin{pmatrix}0 \\ 1\end{pmatrix}  \begin{pmatrix} 0 &amp;amp; 1 \end{pmatrix} =  \begin{pmatrix}0 &amp;amp; 0 \\ 0  &amp;amp; 1 \end{pmatrix}  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And so you can see that &lt;span class=&quot;math-container&quot;&gt;$CNOT_{13} $&lt;/span&gt; will give you the same result as &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; above.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Regarding to the second circuit:&lt;/h3&gt;&#xA;&lt;p&gt;Now, then for your second circuit, first note that when the CNOT is reversed, that is, instead of &lt;span class=&quot;math-container&quot;&gt;$CNOT_{12}$&lt;/span&gt; you are looking at &lt;span class=&quot;math-container&quot;&gt;$CNOT_{2,1}$&lt;/span&gt; you can write it as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT_{2,1} = I \otimes |0\rangle \langle 0 | + X \otimes |1\rangle \langle 1 | = \begin{pmatrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Then from here, we have that&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CNOT_{3,1} = I \otimes I \otimes |0\rangle \langle 0 | + X \otimes I \otimes |1\rangle \langle 1 |  $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Doing this leads you to the matrix:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$CNOT_{3,1} = \begin{pmatrix} &#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&#xA;\end{pmatrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Again, if you want to use qiskit to generate this matrix, make sure to remember to define your circuit as &lt;code&gt;circuit.cx(0,2)&lt;/code&gt; as it is doing the circuit in reverse.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-22T16:51:54.140" LastActivityDate="2021-05-22T16:51:54.140" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17602" PostTypeId="1" CreationDate="2021-05-22T17:43:55.683" Score="3" ViewCount="35" Body="&lt;p&gt;An algorithm implementing a model whose results are known, and from the known results, the benchmarking of the device could be done. What is the currently known shortest circuit depth algorithm that has been used on a real device? An additional criterion is that it should be scalable.&lt;/p&gt;&#xA;" OwnerUserId="15467" LastEditorUserId="55" LastEditDate="2021-05-27T07:33:08.447" LastActivityDate="2021-05-28T05:59:30.497" Title="What is the shortest-circuit-depth quantum-benchmarking algorithm?" Tags="&lt;algorithm&gt;&lt;quantum-circuit&gt;&lt;randomised-benchmarking&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17603" PostTypeId="1" CreationDate="2021-05-22T17:59:29.583" Score="2" ViewCount="38" Body="&lt;p&gt;In &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0504218&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; famous paper is derived the quantum accuracy threshold theorem for concatenated codes.&lt;/p&gt;&#xA;&lt;p&gt;I have questions for the case errors are assumed to be local and Markovian.&lt;/p&gt;&#xA;&lt;p&gt;In the so called level-1 simulation for concatenated codes, we basically put error correction inbetween each encoded gate.&lt;/p&gt;&#xA;&lt;p&gt;Some usefull concepts are the notions of Rec and exRec. A 1-Rec: is an encoded gate followed by quantum error correction. And a 1-exRec is an error correction step followed by an encoded gate, followed again by quantum error correction.&lt;/p&gt;&#xA;&lt;p&gt;It can be shown that because of quantum error correction, an algorithm will output a wrong answer if there are two fault within an exRec. A fault is defined as a physical gate that did not work as expected.&lt;/p&gt;&#xA;&lt;p&gt;The probability of such event is upper bounded by: &lt;span class=&quot;math-container&quot;&gt;$p=A \epsilon^2$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is the number of &lt;strong&gt;pair&lt;/strong&gt; of fault location and &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt; is the probability that the noisiest physical gate fails.&lt;/p&gt;&#xA;&lt;p&gt;From that it is possible after further calculation to show the accuracy threshold theorem (introducing the notion of concatenations).&lt;/p&gt;&#xA;&lt;h2&gt;My question&lt;/h2&gt;&#xA;&lt;p&gt;All the reasonning is based on the fact that it is possible to infer a probability that any given gate in the circuit fails. From a classical world I would totally understand the argument and the construction. But the quantum noise is more complicated than being purely probabilistic. And I would like to understand if it is a restricting assumption or if all Markovian quantum noise can be understood with this reasonning.&lt;/p&gt;&#xA;&lt;p&gt;In the case of &amp;quot;standard&amp;quot; error correction, if you have an initial quantum state, that you make it go through some noise channel, because of error discretization we can make sense of the notion of error probability. Basically, we will have some probability of bit-flip or phase-flip errors due to the noise channel after the syndrome measurement.&lt;/p&gt;&#xA;&lt;p&gt;In the fault tolerance scenario, if the error correction happened to be perfect (which is not), I could regroup all the set of gates before the error correction and define a &amp;quot;big&amp;quot; noise channel from it. In this scenario it would be like in the previous paragraph and it would make sense to define a probability of failure induced by this noise channel.&lt;/p&gt;&#xA;&lt;p&gt;However, if I want to relate the properties of this &amp;quot;big&amp;quot; noise channel to the properties of the noise channel of each individual gates. The task might not be easy. Indeed if I define the noise channel of a CPTP &lt;span class=&quot;math-container&quot;&gt;$\mathcal{E}$&lt;/span&gt; that tries to implement the ideal unitary &lt;span class=&quot;math-container&quot;&gt;$\mathcal{U}$&lt;/span&gt; as the map &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt; veryfing:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}=\mathcal{N} \circ \mathcal{U}$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If I have &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; gates before QEC, I would have:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\mathcal{E}_N \circ ... \mathcal{E}_1=\mathcal{N}_N \circ \mathcal{U}_N \circ ... \circ \mathcal{N}_1 \circ \mathcal{U}_1$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Ahd the noise channel &amp;quot;relevant&amp;quot; for QEC is defined as &lt;span class=&quot;math-container&quot;&gt;$ \mathcal{N}_{\text{tot}}$&lt;/span&gt; which verifies:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ \mathcal{E}_N \circ ... \mathcal{E}_1 = \mathcal{N}_{\text{tot}} \circ \mathcal{U}_N \circ ... \circ \mathcal{U}_1 $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Relating &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}_{\text{tot}}$&lt;/span&gt; to the &lt;span class=&quot;math-container&quot;&gt;$\{\mathcal{N}_{i}\}$&lt;/span&gt; is not an easy task because among other things of commutation issues.&lt;/p&gt;&#xA;&lt;p&gt;And this is basically my issue here. In the fault tolerance construction the reasonning consists in some kind of probabilistic reasonning. If one gate &amp;quot;fails&amp;quot; with a probability &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, then before QEC, I will have an error (which I can correct). But the quantum noise is non probabilistic, there are all the commutation issues that I just talked for instance. Thus I really don't understand the reasonning if I &amp;quot;think quantum&amp;quot; instead of with classical error probabilities. I could for instance expect some &amp;quot;quantum amplitudes&amp;quot; effects, or &amp;quot;crossed&amp;quot; contribution between all those gates which cannot be understood with classical probabilities.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Thus: how to understand why it is fine to assume that each gate fails with a given probability in FT construction ? How is this probability strictly defined ?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="5008" LastEditorUserId="5008" LastEditDate="2021-05-24T10:48:05.053" LastActivityDate="2021-05-24T14:47:58.230" Title="Accuracy threshold theorem: what is the physical probability of failure exactly" Tags="&lt;error-correction&gt;&lt;fault-tolerance&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17604" PostTypeId="1" CreationDate="2021-05-22T20:34:34.013" Score="2" ViewCount="48" Body="&lt;p&gt;As far as I know, IBM Quantum provides two types of APIs: one for Qiskit, and the other for third-party uses (&lt;strong&gt;API for developers&lt;/strong&gt;).&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/9428/ibm-quantum-experience-api-without-qiskit&quot;&gt;this question&lt;/a&gt;, there are several arguments about using the &lt;strong&gt;API for developers&lt;/strong&gt;, there are even useful links to some sources.&lt;/p&gt;&#xA;&lt;p&gt;But now IBM has changed the interface of its platform, and I can't figure out where to get the &lt;strong&gt;API token for developers&lt;/strong&gt; (while the API token for Qiskit is in the most prominent place).&lt;/p&gt;&#xA;&lt;p&gt;I would also like to see an &lt;strong&gt;example of using the API&lt;/strong&gt; in action &lt;strong&gt;in Java&lt;/strong&gt;. Example of a program that sends a schema to IBM Quantum and gets the result.&lt;/p&gt;&#xA;&lt;p&gt;In total, I have two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Where is the API token for developers?&lt;/li&gt;&#xA;&lt;li&gt;Example of using the API in Java.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="15573" LastEditorUserId="55" LastEditDate="2021-05-23T22:48:16.660" LastActivityDate="2021-05-23T22:48:16.660" Title="IBM Quantum API for Java Developers" Tags="&lt;programming&gt;&lt;ibm-q-experience&gt;&lt;ibm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17605" PostTypeId="1" CreationDate="2021-05-22T23:54:42.037" Score="3" ViewCount="33" Body="&lt;p&gt;Newbie in quantum computing (and stack overflow) here. I am confused regarding the relation between spin measurement in quantum mechanics and the quantum NOT gate.&lt;/p&gt;&#xA;&lt;p&gt;I have a Bloch sphere picture of a single qubit in mind:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/sQjOw.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/sQjOw.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;From the Stern-Gerlach experiment, we know that for spin oriented in the z-direction (&lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;) with a detector oriented in the z-direction (&lt;span class=&quot;math-container&quot;&gt;$S_z$&lt;/span&gt;) to leave the spin of the particle unchanged, whereas if our detector was tilted to be aligned with the x-axis (&lt;span class=&quot;math-container&quot;&gt;$S_x$&lt;/span&gt;), then there is a 50% probability of our detector outputting &lt;span class=&quot;math-container&quot;&gt;$\hbar/2$&lt;/span&gt; and orienting the particle in &lt;span class=&quot;math-container&quot;&gt;$|+X\rangle$&lt;/span&gt;, and there is a 50% probability of our detector outputting &lt;span class=&quot;math-container&quot;&gt;$-\hbar/2$&lt;/span&gt; and orienting the particle in &lt;span class=&quot;math-container&quot;&gt;$|-X\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/KxJwc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KxJwc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ $$&lt;/span&gt;&#xA;However, we also know that the quantum NOT (bit-flip) gate is simply applying Pauli matrix &lt;span class=&quot;math-container&quot;&gt;$\sigma_x$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sigma_x |0\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\sigma_x \begin{bmatrix}&#xA;           1 \\&#xA;           0&#xA;         \end{bmatrix}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$\begin{bmatrix}&#xA;           0 \\&#xA;           1&#xA;         \end{bmatrix}$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt;   and similarly &lt;span class=&quot;math-container&quot;&gt;$\sigma_x |1\rangle$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I guess I see how the matrix multiplication works out for the NOT gate, but this doesn't seem to fit with our SG-experiment picture! We know &lt;span class=&quot;math-container&quot;&gt;$S_x = \frac{\hbar}{2} \sigma_x$&lt;/span&gt;, it seems as if applying &lt;span class=&quot;math-container&quot;&gt;$S_x$&lt;/span&gt; on &lt;span class=&quot;math-container&quot;&gt;$|Z+\rangle$&lt;/span&gt; (aka &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;) doesn't orient the spin to &lt;span class=&quot;math-container&quot;&gt;$|X+\rangle$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|X-\rangle$&lt;/span&gt;, but instead simply flips the spin to &lt;span class=&quot;math-container&quot;&gt;$|Z-\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Where does my intuition go wrong? Is applying a NOT gate to a qubit   and   &amp;quot;measuring&amp;quot; a qubit with a perfectly oriented detector not the same thing? (If not, how do we physically apply a gate on a qubit?)&lt;/p&gt;&#xA;" OwnerUserId="15969" LastEditorUserId="9006" LastEditDate="2021-05-23T06:48:42.860" LastActivityDate="2021-05-23T06:48:42.860" Title="How does Spin Measurement correspond to quantum NOT gate?" Tags="&lt;quantum-gate&gt;&lt;pauli-gates&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17606" PostTypeId="2" ParentId="17590" CreationDate="2021-05-23T13:17:02.663" Score="2" Body="&lt;p&gt;Any state can be written as a matrix product state. There are systematic procedures to construct such a description, based on sequential SVDs, see e.g. Section 4.1.3 of &lt;a href=&quot;https://arxiv.org/abs/1008.3477&quot; rel=&quot;nofollow noreferrer&quot;&gt;this review&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, this description is usually of interest if the resulting MPS description has much less parameters than the &lt;span class=&quot;math-container&quot;&gt;$2^N$&lt;/span&gt; parameters needed to describe a general quantum state. This is, e.g., the case for the example you give.&lt;/p&gt;&#xA;" OwnerUserId="491" LastActivityDate="2021-05-23T13:17:02.663" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17607" PostTypeId="1" AcceptedAnswerId="17608" CreationDate="2021-05-23T13:21:01.853" Score="2" ViewCount="49" Body="&lt;p&gt;I was studying &lt;em&gt;Nielsen&amp;amp;Chuang&lt;/em&gt;'s textbook (about page 92), and come up with a question that I cannot solve it.&lt;/p&gt;&#xA;&lt;p&gt;Given one of the two state &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle=|0\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$&lt;/span&gt; (both initial state has equal prior probability &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{2}$&lt;/span&gt;). If I want to apply the umambiguous discrimination: Construct POVM &lt;span class=&quot;math-container&quot;&gt;$\{\Pi_i\}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$i\in\{1,2,\text{inconclusive}\}$&lt;/span&gt;, and outcome &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; when given &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; when given &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\text{inconclusive}$&lt;/span&gt; if it is unluckily to determine the case.&lt;/p&gt;&#xA;&lt;p&gt;How large can the success probability &lt;span class=&quot;math-container&quot;&gt;$\sum_{i=1}^2\frac{1}{2}P(\text{outcome}~  i\mid\text{given}~|\psi_i\rangle)$&lt;/span&gt; be? Is it possible to attan as large as &lt;span class=&quot;math-container&quot;&gt;$\frac{1}{4}$&lt;/span&gt;? How to concretely construct one?&lt;/p&gt;&#xA;" OwnerUserId="15974" LastEditorUserId="55" LastEditDate="2021-05-23T18:19:20.140" LastActivityDate="2021-05-23T18:19:20.140" Title="Umambiguous discrimination using POVM with highest discriminate probability" Tags="&lt;measurement&gt;&lt;quantum-operation&gt;&lt;nielsen-and-chuang&gt;&lt;povm&gt;&lt;state-discrimination&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17608" PostTypeId="2" ParentId="17607" CreationDate="2021-05-23T13:49:35.887" Score="2" Body="&lt;p&gt;I'll write &lt;span class=&quot;math-container&quot;&gt;$\rho_1 = |\psi_1\rangle \langle \psi_1|$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_2 = |\psi_2\rangle \langle \psi_2|$&lt;/span&gt;. We want the discrimination to be unambiguous so we want,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\rho_1 \Pi_2]  = 0 = \mathrm{tr}[\rho_2 \Pi_1].&#xA;$$&lt;/span&gt;&#xA;That is, when we get outcome &lt;span class=&quot;math-container&quot;&gt;$i\in \{1,2\}$&lt;/span&gt; we know that we received &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt; as the other state has a zero probability of obtaining that outcome.&lt;/p&gt;&#xA;&lt;p&gt;Well, we can just choose our POVM elements to be orthogonal to the other state, i.e. consider the projectors&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\hat{\Pi}_1 = |-\rangle \langle - | \qquad \text{and} \qquad \hat{\Pi}_2 = |1\rangle \langle 1|.&#xA;$$&lt;/span&gt;&#xA;The only issue we have now is that if we choose &lt;span class=&quot;math-container&quot;&gt;$\hat{\Pi}_3 = I - \hat{\Pi}_1 - \hat{\Pi}_2$&lt;/span&gt; then &lt;span class=&quot;math-container&quot;&gt;$\hat{\Pi}_3 \not\geq 0$&lt;/span&gt;. To fix this we can weight our projectors with &lt;span class=&quot;math-container&quot;&gt;$\alpha,\beta \in [0,1]$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\Pi_1 = \alpha \hat{\Pi}_1 \\ &#xA;\Pi_2 = \beta \hat{\Pi}_2 \\&#xA;\Pi_3 = I - \Pi_1 -\Pi_2&#xA;$$&lt;/span&gt;&#xA;which is a POVM if &lt;span class=&quot;math-container&quot;&gt;$\alpha + \beta + \sqrt{\alpha^2 + \beta^2} \leq 2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;With such a POVM we get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\mathrm{tr}[\rho_1 \Pi_1] = \frac{\alpha}{2} \qquad \text{and} \qquad \mathrm{tr}[\rho_2 \Pi_2] =  \frac{\beta}{2}.&#xA;$$&lt;/span&gt;&#xA;Putting it all together the maximum success probability is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;\max_{\alpha,\beta \in [0,1]}&amp;amp; \quad \frac{\alpha + \beta}{4} \\&#xA;\mathrm{s.t.}&amp;amp; \quad \alpha + \beta  + \sqrt{\alpha^2 + \beta^2} \leq 2&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;which should be maximized at &lt;span class=&quot;math-container&quot;&gt;$\alpha = \beta = 2-\sqrt{2}$&lt;/span&gt;. Giving a maximum success probability of &lt;span class=&quot;math-container&quot;&gt;$\frac{2-\sqrt{2}}{4}$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-05-23T13:49:35.887" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17609" PostTypeId="1" AcceptedAnswerId="17611" CreationDate="2021-05-23T14:43:40.577" Score="1" ViewCount="33" Body="&lt;p&gt;The definition of density operators is that (i) positive semidefinite; and (ii) unit trace. Given a Hermitian matrix &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; (say, the size is &lt;span class=&quot;math-container&quot;&gt;$2\times 2$&lt;/span&gt;) with unit trace, I know that such matrix may not be positive semidefinite. However, I find some lecture notes on the internet states that such &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a density operator iff the bloch vector &lt;span class=&quot;math-container&quot;&gt;$\textbf{r}$&lt;/span&gt; of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has &lt;span class=&quot;math-container&quot;&gt;$\ell_2$&lt;/span&gt; norm &lt;span class=&quot;math-container&quot;&gt;$\leq 1$&lt;/span&gt;. How to prove that?&lt;/p&gt;&#xA;&lt;p&gt;My attempt: &lt;span class=&quot;math-container&quot;&gt;$\text{Tr}(\rho^2)=\frac{1}{2^2}\left((I+\textbf{r}\cdot E)(I+\textbf{r}\cdot E)\right)=\frac{1}{2}(1+\|\textbf{r}\|^2)$&lt;/span&gt;. But I can't go further. (I'm quite unfamiliar with the trace properties in linear algebra)&lt;/p&gt;&#xA;" OwnerUserId="15974" LastActivityDate="2021-05-23T16:10:41.840" Title="When does Hermitian operator with unit trace become a density operator?" Tags="&lt;density-matrix&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17610" PostTypeId="2" ParentId="17604" CreationDate="2021-05-23T15:44:26.467" Score="1" Body="&lt;p&gt;For your first question,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Where is the API token for developers?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The API token can be copied from your &lt;a href=&quot;https://quantum-computing.ibm.com/account&quot; rel=&quot;nofollow noreferrer&quot;&gt;account details&lt;/a&gt; page:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/4V2mS.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/4V2mS.png&quot; alt=&quot;IBM Quantum API Token&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the second question,&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Example of using the API in Java.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://api.quantum-computing.ibm.com/v2/explorer/&quot; rel=&quot;nofollow noreferrer&quot;&gt;IBM Quantum API&lt;/a&gt; is a RESTful API. It can be consumed the same way as any RESTful API using a REST client. And when it comes to Java, there are many options to choose from to build a REST client. &lt;a href=&quot;https://stackoverflow.com/a/5024571&quot;&gt;This answer&lt;/a&gt; from StackOverflow contains some good options. However, if you are building your solution using a Java Framework, most probably you will find it supports consuming REST APIs. It should be your first option.&lt;/p&gt;&#xA;&lt;p&gt;Anyway, the following is a simple example using Spring's RestTemplate. The code does not follow the best practices (e.g., no error handling). It is for demonstration only:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;RestTemplate restTemplate = new RestTemplate();&#xA;&#xA;String baseUrl = &amp;quot;https://api.quantum-computing.ibm.com/v2&amp;quot;;&#xA;&#xA;// Login&#xA;URI loginUrl = UriComponentsBuilder.fromUriString(baseUrl)&#xA;    .path(&amp;quot;/users/loginWithToken&amp;quot;)&#xA;    .buildAndExpand()&#xA;    .toUri();&#xA;&#xA;LoginPayload payload = new LoginPayload();&#xA;payload.setApiToken(&amp;quot;*********&amp;quot;);&#xA;HttpEntity&amp;lt;LoginPayload&amp;gt; request = new HttpEntity&amp;lt;&amp;gt;(payload);&#xA;JsonNode loginResponse = restTemplate.postForObject(loginUrl, request, JsonNode.class);&#xA;String accessToken = loginResponse.get(&amp;quot;id&amp;quot;).asText();&#xA;&#xA;// Get Providers Information&#xA;URI providersInfoUrl = UriComponentsBuilder.fromUriString(baseUrl)&#xA;    .path(&amp;quot;/Network&amp;quot;)&#xA;    .queryParam(&amp;quot;access_token&amp;quot;, accessToken)&#xA;    .buildAndExpand()&#xA;    .toUri();&#xA;&#xA;// Parse the response to get list of devices&#xA;JsonNode response = restTemplate.getForObject(providersInfoUrl, JsonNode.class);&#xA;for(JsonNode node : response) {&#xA;    if(node.get(&amp;quot;name&amp;quot;).asText().equals(&amp;quot;ibm-q&amp;quot;)) {&#xA;        JsonNode devices = node.get(&amp;quot;groups&amp;quot;).get(&amp;quot;open&amp;quot;).get(&amp;quot;projects&amp;quot;).get(&amp;quot;main&amp;quot;).get(&amp;quot;devices&amp;quot;);&#xA;        for(JsonNode device : devices) {&#xA;            System.out.println(device.get(&amp;quot;name&amp;quot;));&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, if you plan to support checking the job status in your solution then you will need to support WebSocket also.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-05-23T15:44:26.467" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17611" PostTypeId="2" ParentId="17609" CreationDate="2021-05-23T16:10:41.840" Score="1" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$\mathbf{r} = (r_x,r_y,r_z)$&lt;/span&gt;. Then the eigenvalues of your state are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\frac12\left(1 \pm \sqrt{r_x^2 + r_y^2 + r_z^2}\right).&#xA;$$&lt;/span&gt;&#xA;For &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; to be PSD we need both eigenvalues to be nonnegative and this is satisfied iff &lt;span class=&quot;math-container&quot;&gt;$\|\textbf{r}\| = \sqrt{r_x^2 + r_y^2 + r_z^2} \leq 1$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-05-23T16:10:41.840" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17612" PostTypeId="1" CreationDate="2021-05-23T19:42:13.113" Score="1" ViewCount="17" Body="&lt;p&gt;I have been studying Brassard and Hoyer's paper, &lt;em&gt;An Exact Quantum Polynomial-Time Algorithm for Simon's Problem&lt;/em&gt; (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/9704027&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/9704027&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I have successfully implemented Section 4.1 Shrinking a Subgroup with a 3-qubit system in Qiskit. Now, I'm attempting to implement Section 4.2 Removing 0 from a subgroup and Section 4.3 Composing our new QP-Algorithm.&lt;/p&gt;&#xA;&lt;p&gt;Specifically, I'm examining the Proof of Theorem 4.&lt;/p&gt;&#xA;&lt;p&gt;I'm attempting to explicitly define one of the &lt;span class=&quot;math-container&quot;&gt;$\chi$&lt;/span&gt; functions and then apply Lemma 8 to better understand what's going on.&lt;/p&gt;&#xA;&lt;p&gt;Here's my attempt at defining &lt;span class=&quot;math-container&quot;&gt;$\chi_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\chi_0(g) = g_0$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now apply Lemma 8 to &lt;span class=&quot;math-container&quot;&gt;$\chi_0$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$A = \{ g \in G | g_0 = 1\}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$B = \{ g \in G | g_0 = 0\}$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now defining &lt;span class=&quot;math-container&quot;&gt;$S_A$&lt;/span&gt;. (The first &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; in the RHS denotes imaginary &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S_A|i\rangle|\psi_i\rangle = i|i\rangle|\psi_i\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i \in A$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S_A|i\rangle|\psi_i\rangle = |i\rangle|\psi_i\rangle$&lt;/span&gt; if &lt;span class=&quot;math-container&quot;&gt;$i \in B$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now if I actually write out the matrix for this operator it should look like this.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\begin{matrix} 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i &amp;amp; 0 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; i \\ \end{matrix} $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$S_{\{0\}}$&lt;/span&gt; is defined as the operator that changes the phase by &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt; if and only if the state is the zero state. Creating this matrix is trivial.&lt;/p&gt;&#xA;&lt;p&gt;The paper then defines the &lt;em&gt;Grover Iteration&lt;/em&gt; as &lt;span class=&quot;math-container&quot;&gt;$G = AS_{\{0\}}A^{-1}S_A$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; is some uniform superposition. I am able to obtain &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;My questions are first are there any errors in my above analysis? Second what does &lt;span class=&quot;math-container&quot;&gt;$A^{-1}$&lt;/span&gt; denote in this context and how could I obtain it? Lastly, how could I implement this in Qiskit? Any tips would be greatly appreciated. Thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="15977" LastActivityDate="2021-05-23T19:42:13.113" Title="Implementing EQP Simon's (removing trivial solution)" Tags="&lt;algorithm&gt;&lt;grovers-algorithm&gt;&lt;simons-algorithm&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17613" PostTypeId="1" CreationDate="2021-05-24T00:33:44.433" Score="2" ViewCount="37" Body="&lt;p&gt;I am following University's of toronto QML course and there's a section where QAOA is applied to cluster a set of vectors by mapping the clustering problem into a Maxcut problem. Unfortunately qiskit's QAOA is not returning the right solution (even within the course's notebook lecture), so I am a bit lost in the implementation.&lt;/p&gt;&#xA;&lt;p&gt;The (4) points are (top two are on the top left corner and bottom two on the bottom right corner)&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;data = array([[ 0.11 ,  0.143],&#xA;       [ 0.121,  0.109],&#xA;       [-1.515,  1.629],&#xA;       [-1.512,  1.678]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And the distance matrix (used as the 'weight' matrix of the maxcut graph) is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;w = array([[0.   , 0.   , 2.202, 2.234],&#xA;   [0.   , 0.   , 2.233, 2.265],&#xA;   [2.202, 2.233, 0.   , 0.   ],&#xA;   [2.234, 2.265, 0.   , 0.   ]])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;(distances &amp;lt; 0.5 were mapped to 0 as pre-processing).&lt;/p&gt;&#xA;&lt;p&gt;Using Qiskit's &lt;code&gt;max_cut class&lt;/code&gt;, we map &lt;code&gt;w&lt;/code&gt; into an Ising problem. We also verify the best solution&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qubit_operators, offset = max_cut.get_max_cut_qubitops(-w)&#xA;// checking for solutions (cleary 0011 and 1100 are the solutions)&#xA;(0, 0, 0, 0) 4.466870101471442&#xA;(0, 0, 0, 1) 0.031168254348417523&#xA;(0, 0, 1, 0) -0.031168254348417523&#xA;(0, 0, 1, 1) -4.466870101471442&#xA;(0, 1, 0, 0) 0.03160476231770515&#xA;(0, 1, 0, 1) 0.0001477223286934226&#xA;(0, 1, 1, 0) -0.0001477223286934226&#xA;(0, 1, 1, 1) -0.03160476231770515&#xA;(1, 0, 0, 0) -0.03160476231770515&#xA;(1, 0, 0, 1) -0.0001477223286934226&#xA;(1, 0, 1, 0) 0.0001477223286934226&#xA;(1, 0, 1, 1) 0.03160476231770515&#xA;(1, 1, 0, 0) -4.466870101471442&#xA;(1, 1, 0, 1) -0.031168254348417523&#xA;(1, 1, 1, 0) 0.031168254348417523&#xA;(1, 1, 1, 1) 4.466870101471442&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;after inputting the mapped operator and running it on Qiskit's QAOA&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua import get_aer_backend, QuantumInstance&#xA;from qiskit.aqua.algorithms import QAOA&#xA;from qiskit.aqua.components.optimizers import COBYLA&#xA;from qiskit.aqua.translators.ising import max_cut&#xA;&#xA;p = 1&#xA;&#xA;#w = -w&#xA;qubit_operators, offset = max_cut.get_max_cut_qubitops(-w)&#xA;p = 1&#xA;optimizer = COBYLA()&#xA;qaoa = QAOA(qubit_operators, optimizer, p)&#xA;backend = get_aer_backend('statevector_simulator')&#xA;quantum_instance = QuantumInstance(backend, shots=10)&#xA;result = qaoa.run(quantum_instance)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The output is the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;{'num_optimizer_evals': 13,&#xA; 'min_val': 0.0,&#xA; 'opt_params': array([0., 0.]),&#xA; 'eval_time': 0.32109689712524414,&#xA; 'eval_count': 13,&#xA; 'energy': 0.0,&#xA; 'eigvals': array([0.]),&#xA; 'min_vector': array([0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j,&#xA;        0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j,&#xA;        0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j]),&#xA; 'eigvecs': array([[0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j,&#xA;         0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j,&#xA;         0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j]])}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It seems as if the QAOA never evolves (optimal &lt;span class=&quot;math-container&quot;&gt;$\gamma$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; are 0) and stays in the mixer's ground state.&lt;/p&gt;&#xA;&lt;p&gt;Has anyone experienced the same problem?&lt;/p&gt;&#xA;&lt;p&gt;I'm using Qiskit's 0.9.0 (otherwise code is not compatible with the course).&lt;/p&gt;&#xA;" OwnerUserId="12302" LastEditorUserId="9006" LastEditDate="2021-05-24T07:38:56.073" LastActivityDate="2021-05-24T14:11:02.360" Title="QAOA not returning solution for simple clustering problem" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;optimization&gt;&lt;qaoa&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17614" PostTypeId="1" AcceptedAnswerId="17615" CreationDate="2021-05-24T05:14:42.923" Score="4" ViewCount="38" Body="&lt;p&gt;What's the biggest variance of &lt;span class=&quot;math-container&quot;&gt;$h=\sum_i H_i$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; is the hamiltonian act on the &lt;em&gt;i&lt;/em&gt;th qubit?&lt;/p&gt;&#xA;&lt;p&gt;If the n qubits state is separable, i.e., the state is &lt;span class=&quot;math-container&quot;&gt;$\mid\psi_1\rangle\otimes\mid\psi_2\rangle\otimes\cdots\mid\psi_n\rangle$&lt;/span&gt;. Obviously, the biggest variance, &lt;span class=&quot;math-container&quot;&gt;$\max\limits_{\mid\psi\rangle}(\Delta h)^2$&lt;/span&gt;, is &lt;span class=&quot;math-container&quot;&gt;$N(\lambda_M-\lambda_m)^2/4$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$\lambda_M \text{ and } \lambda_m$&lt;/span&gt; are biggest and smallest eigenvalue of &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; respectively. To see this, we can use the general formula for state &lt;span class=&quot;math-container&quot;&gt;$\mid\psi_i\rangle\equiv \cos(\theta)\mid0\rangle+\sin(\theta)e^{i\phi}\mid1\rangle$&lt;/span&gt;. We then calculate the variance of one part: &lt;span class=&quot;math-container&quot;&gt;$\mid\psi_i\rangle$&lt;/span&gt; and will get the biggest variance is when &lt;span class=&quot;math-container&quot;&gt;$\theta=\frac{\pi}{4}$&lt;/span&gt;, and the variance is &lt;span class=&quot;math-container&quot;&gt;$(\lambda_M-\lambda_m)^2/4$&lt;/span&gt;. At last the total variance of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; parts can be added as &lt;span class=&quot;math-container&quot;&gt;$N(\lambda_M-\lambda_m)^2/4$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But how to prove if the total state &lt;span class=&quot;math-container&quot;&gt;$\mid\psi\rangle$&lt;/span&gt; is not necessarily separable, the biggest variance of &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$(N\lambda_M-N\lambda_m)^2/4$&lt;/span&gt; instead of &lt;span class=&quot;math-container&quot;&gt;$N(\lambda_M-\lambda_m)^2/4$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastEditorUserId="13968" LastEditDate="2021-05-24T13:57:30.443" LastActivityDate="2021-05-24T18:09:04.693" Title="Biggest variance of $h=\sum_i H_i$?" Tags="&lt;entanglement&gt;&lt;foundations&gt;&lt;quantum-metrology&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17615" PostTypeId="2" ParentId="17614" CreationDate="2021-05-24T06:20:36.977" Score="2" Body="&lt;p&gt;Here is an approach that requires no specific knowledge about &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; whatsoever.&lt;/p&gt;&#xA;&lt;p&gt;In your description you implied that each &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; has the same maximum and minimum eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\lambda_m$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\lambda_M$&lt;/span&gt; respectively so I will assume this in the derivation. The process of measuring &lt;span class=&quot;math-container&quot;&gt;$\langle h \rangle$&lt;/span&gt; empirically can be thought of running a series of experiments with the &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;-th experiment returning an energy &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; in the range &lt;span class=&quot;math-container&quot;&gt;$[N\lambda_m, N\lambda_M]$&lt;/span&gt;. Then we can average all of the observed &lt;span class=&quot;math-container&quot;&gt;$E_i$&lt;/span&gt; values to compute &lt;span class=&quot;math-container&quot;&gt;$\langle h \rangle$&lt;/span&gt;, and we can think of &lt;span class=&quot;math-container&quot;&gt;$E$&lt;/span&gt; being a random variable whose probability density (or mass) function is completely determined by &lt;span class=&quot;math-container&quot;&gt;$h$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; be a random variable defined as &lt;span class=&quot;math-container&quot;&gt;$E- N\lambda_m$&lt;/span&gt; and therefore takes values in the range &lt;span class=&quot;math-container&quot;&gt;$[0, N(\lambda_M - \lambda_m)]$&lt;/span&gt;. The variance of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}\tag{1}&#xA;\text{Var}(X) &amp;amp;= \frac{1}{n}\sum_i X_i^2 - \bar{X}^2 \\&#xA;&amp;amp;\leq \frac{1}{n}\sum_i N(\lambda_M - \lambda_m)X_i - \bar{X}^2 \\&#xA;&amp;amp;= (N(\lambda_M - \lambda_m) - \bar{X})\bar{X}&#xA;\end{align}&lt;/span&gt;&#xA;where the inequality just substitutes one &lt;span class=&quot;math-container&quot;&gt;$X_i$&lt;/span&gt; for the maximum possible value of &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt;, and &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; is a number of samples that can be assumed to be taken to infinity. Then set the derivative of this expression to zero, &lt;span class=&quot;math-container&quot;&gt;$\partial_\bar{X}\text{Var}(X) = N(\lambda_M - \lambda_m) - 2\bar{X}=0$&lt;/span&gt; to get&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tag{2}&#xA;\text{argmax}_{\bar{X}} \text{Var}(X) = \frac{N(\lambda_M - \lambda_m)}{2}&#xA;$$&lt;/span&gt;&#xA;which results in&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\tag{3}&#xA;\max \text{Var}(X) = \left(\frac{N(\lambda_M - \lambda_m)}{2}\right)^2&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;which also gives &lt;span class=&quot;math-container&quot;&gt;$\text{Var}(E) = (\Delta h)^2$&lt;/span&gt; since variance is not affected by the constant shift of &lt;span class=&quot;math-container&quot;&gt;$N\lambda_m$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Note that you can apply this same technique to each &lt;span class=&quot;math-container&quot;&gt;$H_i$&lt;/span&gt; individually to recover the maximum variance for the case of a separable state; the factor of &lt;span class=&quot;math-container&quot;&gt;$N^2$&lt;/span&gt; disappears compared to the above derivation and only a factor of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; is reintroduced by summing up the variances of the separate systems.&lt;/p&gt;&#xA;" OwnerUserId="1939" LastEditorUserId="1939" LastEditDate="2021-05-24T18:09:04.693" LastActivityDate="2021-05-24T18:09:04.693" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17616" PostTypeId="1" CreationDate="2021-05-24T06:36:42.660" Score="5" ViewCount="128" Body="&lt;p&gt;I'm wrapping my head around how and why quantum computers can provide advantage over classical. A basic and naive argument is that the dimension of the Hilbert space of &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits grows as &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt;. However, without exponentially sized circuits of 1- and 2-qubit gates only a tiny fraction of all the Hilbert space can be reached. Another explanation I have encountered is that it is the entanglement (and not simply a dimension of the Hilbert space) that is the resource allowing for quantum speed-ups. Whether this is true or not I have the following question.&lt;/p&gt;&#xA;&lt;p&gt;Should one expect that an efficient quantum algorithm will produce a highly entangled state at some point? If the entanglement is not maximal, should it be possible in principle to run the algorithm on a fewer number of qubits (outsourcing some part of the computation to a classical computer)?&lt;/p&gt;&#xA;" OwnerUserId="15239" LastEditorUserId="15239" LastEditDate="2021-05-24T08:12:13.237" LastActivityDate="2021-05-29T19:17:25.390" Title="Is it true that for a quantum algorithm to be efficient it must feature a highly entangled state at some point?" Tags="&lt;quantum-state&gt;&lt;algorithm&gt;&lt;entanglement&gt;" AnswerCount="2" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17617" PostTypeId="1" CreationDate="2021-05-24T12:56:45.253" Score="2" ViewCount="76" Body="&lt;p&gt;Someone offhandedly mentioned to me that quantum computers are sometimes significantly (I guess they meant asymptotically) slower than classical computers.&#xA;Unfortunately, I didn't get any arguments nor examples for this statement, and I'm not able to figure the limitations out myself.&lt;/p&gt;&#xA;&lt;p&gt;I tried to look up articles on the web and questions on StackExchange, but everything is about the problems where quantum computers are faster.&#xA;None of them mention how solutions to the rest of the problems compare in speed, at least not what I could find.&lt;/p&gt;&#xA;&lt;p&gt;Question: &lt;strong&gt;What are examples where quantum computers are significantly/asymptotically slower than classical computers?&lt;/strong&gt;&lt;/p&gt;&#xA;" OwnerUserId="15985" LastEditorUserId="13991" LastEditDate="2021-05-24T14:08:43.723" LastActivityDate="2021-05-25T10:13:03.033" Title="When is a Quantum Computer Slower Than a Classical Computer?" Tags="&lt;complexity-theory&gt;&lt;classical-computing&gt;&lt;quantum-advantage&gt;&lt;performance&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17618" PostTypeId="1" CreationDate="2021-05-24T14:01:15.007" Score="4" ViewCount="86" Body="&lt;p&gt;One of the explanations I have encountered for why quantum computation can provide speed-up over the classical is a picture that in the Hilbert space much more paths are allowed quantum-mechanically than classically. Indeed, it seems that we are only allowed to travel along computational axes classically, but quantum-mechanically we can take shortcuts. Is this picture morally correct? Is it possible to present some very explicit illustration? Say for the Deutsch problem or for the Grover algorithm with minimum qubits?&lt;/p&gt;&#xA;" OwnerUserId="15239" LastActivityDate="2021-05-26T07:18:53.357" Title="Can the difference between quantum and classical circuits be attributed to different paths in the Hilbert space?" Tags="&lt;algorithm&gt;&lt;complexity-theory&gt;&lt;classical-computing&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17619" PostTypeId="2" ParentId="17613" CreationDate="2021-05-24T14:11:02.360" Score="2" Body="&lt;p&gt;There was an issue that was fixed with QAOA &lt;a href=&quot;https://github.com/Qiskit/qiskit-aqua/pull/1316&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://github.com/Qiskit/qiskit-aqua/pull/1316&lt;/a&gt; whereby using all zeros as an initial point was changed since the optimizer could easily get stuck there.&lt;/p&gt;&#xA;&lt;p&gt;Given the version you have the easiest way to change things would just be to pass an initial point that is non-zero. I.e. instead of [0,0] which it uses with the default of None set it to some other value e.g.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;qaoa = QAOA(qubit_operators, optimizer, p, initial_point=[1, 0.5])&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;or some other value where you will see it works and does no get stuck&lt;/p&gt;&#xA;" OwnerUserId="9831" LastActivityDate="2021-05-24T14:11:02.360" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17620" PostTypeId="2" ParentId="17603" CreationDate="2021-05-24T14:47:58.230" Score="0" Body="&lt;p&gt;The key idea you're missing is &lt;em&gt;error digitization&lt;/em&gt;. Any general error mechanism can be represented as a weighted sum of Pauli products, and if the error correction procedure corrects a Pauli product then it corrects that Pauli product term appearing in the weighted sum.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider rotating every qubit in an error correcting code by 1 degree around the Z axis. Note that &lt;span class=&quot;math-container&quot;&gt;$R_z(1°) = I \cos(1°) + i Z \sin(1°)$&lt;/span&gt;. Suppose the error correcting code corrects all Pauli product errors with up to 10 non-identity Pauli terms and there are 100 qubits in the system. Then after you apply the binomial theorem to &lt;span class=&quot;math-container&quot;&gt;$(I \cos(1°) + i Z \sin(1°))^{\otimes 100}$&lt;/span&gt;, the error correction process will fix all error terms with up to 10 Zs. The remaining error terms have a weight with a prefactor &lt;span class=&quot;math-container&quot;&gt;$\sin(1°)^{10} \approx 2.6 \cdot 10^{-18}$&lt;/span&gt;. Even after accounting for the fact that there's a lot of them, they're completely negligible. So even though we applied a simultaneous error to every qubit, the deviation from the true result is tiny because the decomposition of that error into Pauli products has negligible weights on the uncorrected Pauli products.&lt;/p&gt;&#xA;&lt;p&gt;It's also important that quantum mechanics is linear, so that errors with small weights can't become errors with big weights.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-24T14:47:58.230" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17621" PostTypeId="1" CreationDate="2021-05-24T17:04:02.190" Score="3" ViewCount="43" Body="&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle,|\psi_2\rangle$&lt;/span&gt; be two pure states. Assume &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_1|\psi_2\rangle\neq0$&lt;/span&gt;, and consider the convex combination&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho\equiv p_1 |\psi_1\rangle\!\langle\psi_1| + p_2 |\psi_2\rangle\!\langle\psi_2|,$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$p_1+p_2=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we are interested in the pure state corresponding to the largest (smallest) projection probability. In other words, we want a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; that maximises (minimises)&#xA;&lt;span class=&quot;math-container&quot;&gt;$p_1 |\langle\phi|\psi_1\rangle|^2 + p_2 |\langle\phi|\psi_2\rangle|^2.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Algebraically, this can be found by simply computing the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;. Doing so gives&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\phi_\pm\rangle = N_\pm\left(&#xA;(A\pm\sqrt{A^2+4z^2})|\psi_1\rangle +&#xA;2z |\psi_2\rangle&#xA;\right),$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$A\equiv p_1 + p_2(2F-1)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$F\equiv |\langle\psi_1|\psi_2\rangle|^2$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$z\equiv\langle\psi_1|\psi_2\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, because we are effectively operating on the span of two pure states, we can assume without loss of generality that these are qubits, and represent everything in the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;Is there a nice geometrical characterisation of where the eigenvectors &lt;span class=&quot;math-container&quot;&gt;$|\phi_\pm\rangle$&lt;/span&gt; end up being represented in the Bloch sphere in relation to &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt;? By &amp;quot;nice&amp;quot; I mean something like &amp;quot;&lt;em&gt;&lt;span class=&quot;math-container&quot;&gt;$|\phi_\pm\rangle$&lt;/span&gt; sit in the plane spanned by &lt;span class=&quot;math-container&quot;&gt;$|\psi_i\rangle$&lt;/span&gt; and at the angle so and so between them&lt;/em&gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;For &lt;span class=&quot;math-container&quot;&gt;$p_1=p_2$&lt;/span&gt; I find that &lt;span class=&quot;math-container&quot;&gt;$|\phi_+\rangle$&lt;/span&gt; sits exactly in between &lt;span class=&quot;math-container&quot;&gt;$|\psi_1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi_2\rangle$&lt;/span&gt;. More precisely, denoting with &lt;span class=&quot;math-container&quot;&gt;$\vec r_\phi$&lt;/span&gt; the Bloch vector of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\vec r_{\phi_\pm}=\pm N (\vec r_{\psi_1} + \vec r_{\psi_2}).$$&lt;/span&gt;&#xA;This stops being the case for &lt;span class=&quot;math-container&quot;&gt;$p_1\neq p_2$&lt;/span&gt;. Is there a similarly nice solution for the general case?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-24T18:17:55.257" LastActivityDate="2021-05-24T23:03:17.417" Title="Is there a nice geometric expression for the eigenvectors of a mixture of two pure states?" Tags="&lt;quantum-state&gt;&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17623" PostTypeId="2" ParentId="17621" CreationDate="2021-05-24T23:03:17.417" Score="0" Body="&lt;p&gt;The answer is trivial thinking directly in the Bloch representation of the states.&#xA;The TL;DR is that if &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\bs}[1]{{\boldsymbol{#1}}}\nu_{\rm op}(\bs r)$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\nu_{\rm v}(\bs r)$&lt;/span&gt; denote the operator and &lt;span class=&quot;math-container&quot;&gt;$\mathbb C^2$&lt;/span&gt; vector corresponding to the Bloch vector &lt;span class=&quot;math-container&quot;&gt;$\bs r$&lt;/span&gt;, respectively, then &lt;span class=&quot;math-container&quot;&gt;$\nu_{\rm v}(\pm\bs r)$&lt;/span&gt; are the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\nu_{\rm op}(\bs r)$&lt;/span&gt;, with eigenvalues &lt;span class=&quot;math-container&quot;&gt;$\frac12(1\pm \|\bs r\|)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If &lt;span class=&quot;math-container&quot;&gt;$\rho_{\bs r}$&lt;/span&gt; is the state with Bloch representation &lt;span class=&quot;math-container&quot;&gt;$\bs r$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p\rho_{\bs r}+(1-p)\rho_{\bs s} = \rho_{p\bs r+(1-p)\bs s}.$$&lt;/span&gt;&#xA;Therefore the question of what are the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$p|\psi_1\rangle\!\langle\psi_1| + (1-p)|\psi_2\rangle\!\langle\psi_2|$&lt;/span&gt; reduces to the question of what are the eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$p\rho_1+(1-p)\rho_2$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\rho_i\equiv |\psi_i\rangle\!\langle\psi_i|$&lt;/span&gt;.&#xA;And as follows from our above observation, the answer to this is simply that the eigenvectors are &lt;span class=&quot;math-container&quot;&gt;$\pm(p\bs r_1+(1-p)\bs r_2)$&lt;/span&gt;, with &lt;span class=&quot;math-container&quot;&gt;$\bs r_i$&lt;/span&gt; the Bloch vector corresponding to &lt;span class=&quot;math-container&quot;&gt;$\rho_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;(Eigenvalues and eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt;)&lt;/strong&gt;&lt;/em&gt; For completeness, I'll include the expressions for eigenvalues and eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; as a function of its matrix and Bloch representations.&lt;/p&gt;&#xA;&lt;p&gt;The relation between &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; and its Bloch representation &lt;span class=&quot;math-container&quot;&gt;$\bs r$&lt;/span&gt; is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \frac{I + \bs r\cdot\bs\sigma}{2} =&#xA;\frac12\begin{pmatrix}1+z &amp;amp; x-i y \\ x+iy &amp;amp; 1-z\end{pmatrix},$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\bs\sigma$&lt;/span&gt; the vector of Pauli matrices, and &lt;span class=&quot;math-container&quot;&gt;$\bs r\equiv(x,y,z)^T$&lt;/span&gt;.&#xA;The operator &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is a positive semidefinite for &lt;span class=&quot;math-container&quot;&gt;$\bs r\le1$&lt;/span&gt; and pure for &lt;span class=&quot;math-container&quot;&gt;$\|\bs r\|=1$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The eigenvalues of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\lambda_\pm = \frac{1}{2}\left( 1\pm \sqrt{(\rho_{11}-\rho_{22})^2 + 4\rho_{12}\rho_{21}}\right) =&#xA;\frac12\left(1 \pm \sqrt{z^2+x^2+y^2}\right)&#xA;= \frac12(1 \pm \|\bs r\|),$$&lt;/span&gt;&#xA;as can also be see directly from the expression of &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; in terms of &lt;span class=&quot;math-container&quot;&gt;$\bs r$&lt;/span&gt;.&#xA;The corresponding eigenvectors are&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\lambda_\pm\rangle = \frac{1}{\sqrt{2r(r\pm z)}}\begin{pmatrix}z\pm r \\ x+i y\end{pmatrix}, \qquad r\equiv\|\bs r\|.$$&lt;/span&gt;&#xA;The corresponding angles in the Bloch sphere thus read&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\tan(\theta/2) = \frac{\sqrt{x^2+y^2}}{z\pm r}&#xA;= \frac{\sin\theta}{\cos\theta\pm 1},$$&lt;/span&gt;&#xA;where in the last step I divided by &lt;span class=&quot;math-container&quot;&gt;$r$&lt;/span&gt; and used the geometric identities&#xA;&lt;span class=&quot;math-container&quot;&gt;$\sin\theta=\sqrt{x^2+y^2}/r$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\cos\theta=z/r$&lt;/span&gt;.&#xA;It follows that &lt;span class=&quot;math-container&quot;&gt;$\theta_+=\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\theta_-=\theta+\pi$&lt;/span&gt;.&#xA;In other words, the angles corresponding to &lt;span class=&quot;math-container&quot;&gt;$|\lambda_\pm\rangle$&lt;/span&gt; are those corresponding to the same direction of &lt;span class=&quot;math-container&quot;&gt;$\bs r$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-24T23:03:17.417" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17624" PostTypeId="2" ParentId="17598" CreationDate="2021-05-25T02:16:05.297" Score="1" Body="&lt;p&gt;I think you should take all these things into account:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How to create a circuit and measurement in both QDK and Qiskit?&lt;/li&gt;&#xA;&lt;li&gt;How to apply quantum algorithm in both QDK and Qiskit?&lt;/li&gt;&#xA;&lt;li&gt;What are the backends that can be linked to by QDK and Qiskit?&lt;/li&gt;&#xA;&lt;li&gt;Special features between those two (Qiskit pulse, Azure quantum, ...)&lt;/li&gt;&#xA;&lt;li&gt;Performance between these two&lt;/li&gt;&#xA;&lt;li&gt;Any restrictions?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="14994" LastActivityDate="2021-05-25T02:16:05.297" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17625" PostTypeId="2" ParentId="2200" CreationDate="2021-05-25T06:00:02.063" Score="0" Body="&lt;p&gt;Thanks to @&lt;a href=&quot;https://quantumcomputing.stackexchange.com/users/1837/daftwullie&quot;&gt;DaftWullie&lt;/a&gt;'s &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/2200/implementation-of-the-oracle-of-grovers-algorithm-on-ibm-q-using-three-qubits#comment2389_2205&quot;&gt;comment&lt;/a&gt;.&#xA;Here is my implementation of Grover's search for 110 on the IBM quantum platform&#xA;&lt;a href=&quot;https://i.stack.imgur.com/PUSy1.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/PUSy1.png&quot; alt=&quot;Grover's search for 110&quot; /&gt;&lt;/a&gt;&#xA;with outcome&#xA;&lt;a href=&quot;https://i.stack.imgur.com/109SV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/109SV.png&quot; alt=&quot;Outcome for Grover's search for 110&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;As DaftWullie said, the H gates around the decomposition of CCZ can be deleted for both ends, which brings us&#xA;&lt;a href=&quot;https://i.stack.imgur.com/BU8rD.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BU8rD.png&quot; alt=&quot;Grover's search for 110 With Less H Gates&quot; /&gt;&lt;/a&gt;&#xA;with outcome&#xA;&lt;a href=&quot;https://i.stack.imgur.com/B2VtA.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/B2VtA.png&quot; alt=&quot;Outcome for Grover's search for 110 With Less H Gates&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For the decomposition of H and Toffoli gates, you can always find a solution over the network.&lt;/p&gt;&#xA;&lt;p&gt;Happy Quantum! :)&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;WARNING: Anyone doing assignment 2 of MULT90063 should not use this&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="15989" LastEditorUserId="15989" LastEditDate="2021-05-25T06:05:45.377" LastActivityDate="2021-05-25T06:05:45.377" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17626" PostTypeId="1" CreationDate="2021-05-25T06:18:52.243" Score="1" ViewCount="66" Body="&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/nUvjc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/nUvjc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;When I downloaded the source code from Qiskit Notebook &lt;a href=&quot;https://qiskit.org/textbook/ch-quantum-hardware/accessing_higher_energy_states.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;Accessing Higher Energy States&lt;/a&gt; and tried to execute it, the output and graph seem wrong in the step finding the frequency step which leads to the failure of other parts. I have tried to update the library &amp;quot;Sample Pulse&amp;quot; to the new library &amp;quot;Waveform&amp;quot;. However, the output is still incorrect. I think the data given for IBM-Armonk is out of date. Does anyone know what is the problem?&lt;/p&gt;&#xA;&lt;p&gt;Basically, I can not find the correct output when executing the code to find Rabi Oscillations. Here the code&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;num_rabi_points = 50 # number of experiments (ie amplitudes to sweep out)&#xA;&#xA;    # Drive amplitude values to iterate over: 50 amplitudes evenly spaced from 0 to 0.75&#xA;drive_amp_min = 0&#xA;drive_amp_max = 0.75&#xA;drive_amps = np.linspace(drive_amp_min, drive_amp_max, num_rabi_points)&#xA;# Create schedule&#xA;rabi_01_schedules = []&#xA;# loop over all drive amplitudes&#xA;for ii, drive_amp in enumerate(drive_amps):&#xA;    # drive pulse&#xA;    rabi_01_pulse = pulse_lib.gaussian(duration=drive_samples, &#xA;                                       amp=drive_amp, &#xA;                                       sigma=drive_sigma, &#xA;                                       name='rabi_01_pulse_%d' % ii)&#xA;    &#xA;    # add commands to schedule&#xA;    schedule = pulse.Schedule(name='Rabi Experiment at drive amp = %s' % drive_amp)&#xA;    schedule |= pulse.Play(rabi_01_pulse, drive_chan)&#xA;    schedule |= measure &amp;lt;&amp;lt; schedule.duration # shift measurement to after drive pulse&#xA;    rabi_01_schedules.append(schedule)&#xA;# Assemble the schedules into a program&#xA;# Note: We drive at the calibrated frequency.&#xA;rabi_01_expt_program = assemble(rabi_01_schedules,&#xA;                                backend=backend,&#xA;                                meas_level=1,&#xA;                                meas_return='avg',&#xA;                                shots=NUM_SHOTS,&#xA;                                schedule_los=[{drive_chan: cal_qubit_freq}]&#xA;                                               * num_rabi_points)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14994" LastEditorUserId="14994" LastEditDate="2021-05-27T12:34:25.653" LastActivityDate="2021-05-27T21:54:41.817" Title="Qiskit Pulse Notebook" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;ibm-q-experience&gt;&lt;openpulse&gt;" AnswerCount="1" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="17627" PostTypeId="1" CreationDate="2021-05-25T06:50:45.537" Score="4" ViewCount="50" Body="&lt;p&gt;I could only find experimental work on Grover's algorithm upto 5 qubits &lt;a href=&quot;https://arxiv.org/pdf/2102.01783.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. Is there any more recent research for larger database sizes where Grover's algorithm is employed? Is there any known method that is optimal to construct &lt;span class=&quot;math-container&quot;&gt;$C^nZ$&lt;/span&gt; that is scalable for construction of Grover's algorithm with more than 5 qubits?&lt;/p&gt;&#xA;" OwnerUserId="15990" LastEditorUserId="55" LastEditDate="2021-05-26T09:02:47.980" LastActivityDate="2021-05-26T09:02:47.980" Title="Is there recent research on experimental implementations of Grover's algorithm with more than 5 qubits?" Tags="&lt;grovers-algorithm&gt;&lt;resource-request&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17628" PostTypeId="2" ParentId="17618" CreationDate="2021-05-25T09:33:03.980" Score="1" Body="&lt;p&gt;A few thoughts:&lt;/p&gt;&#xA;&lt;p&gt;If you identify a few of the axes of an &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt;-qubit state space, those corresponding to bit-strings &lt;span class=&quot;math-container&quot;&gt;$|s_1,...,s_n\rangle, s_i\in\{0,1\}$&lt;/span&gt;, with &amp;quot;classical states&amp;quot;, then it might seem natural to say that &amp;quot;&lt;em&gt;quantum algorithms are allowed to take shortcuts&lt;/em&gt;&amp;quot;. But I think this picture is actually faulty. When you say this, you are probably thinking about the quantum state moving in state space in directions that a classical state is not allowed to go. But what would a corresponding &amp;quot;classical evolution&amp;quot; look like?&lt;/p&gt;&#xA;&lt;p&gt;There is no nice way to picture the evolution of a classical state in the same way you picture a quantum state in Bloch-like representations. A classical state doesn't evolve smoothly between the &amp;quot;classical axes&amp;quot;. Rather, it jumps between them. But then what is such a picture telling you? It doesn't seem particularly useful to talk about &amp;quot;shortcuts&amp;quot; when the corresponding classical evolution would be pictured as a sequence of discrete jumps.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-25T10:52:35.993" LastActivityDate="2021-05-25T10:52:35.993" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17629" PostTypeId="1" AcceptedAnswerId="17630" CreationDate="2021-05-25T10:08:20.947" Score="7" ViewCount="601" Body="&lt;p&gt;I have tried to make a Toffoli gate using only CNOTs and some ancilla qubits but I do not get the unitary. It seems it is not possible without additional gates? What could I do to prove it?&lt;/p&gt;&#xA;&lt;p&gt;I have tried something like &lt;code&gt;CNOT(c0,a0)&lt;/code&gt;,&lt;code&gt;CNOT(c1,a0)&lt;/code&gt;,&lt;code&gt;X(a0)&lt;/code&gt;,&lt;code&gt;CNOT(a0,t)&lt;/code&gt; (and then reversing the whole operation for the ancilla) , where &lt;code&gt;c&lt;/code&gt; are the control qubits, &lt;code&gt;a&lt;/code&gt; are the ancilla qubits and &lt;code&gt;t&lt;/code&gt; is the target. This method does not work because when &lt;code&gt;c0&lt;/code&gt; and &lt;code&gt;c1&lt;/code&gt; are both 0 then it also changes the target qubit.&lt;/p&gt;&#xA;&lt;p&gt;I know that you can generalize Toffoli to &lt;span class=&quot;math-container&quot;&gt;$n$&lt;/span&gt; qubits using normal Toffolis and ancillas.&lt;/p&gt;&#xA;" OwnerUserId="15775" LastEditorUserId="13991" LastEditDate="2021-05-25T13:36:37.710" LastActivityDate="2021-05-26T15:08:11.123" Title="Is it possible to make a Toffoli gate using only CNOTS and ancillas?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="3" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17630" PostTypeId="2" ParentId="17629" CreationDate="2021-05-25T10:12:29.993" Score="8" Body="&lt;p&gt;No this is not possible. One argument is the following:&lt;/p&gt;&#xA;&lt;p&gt;Toffoli + Hadamard are universal for quantum computation, so if you can make Toffoli from controlled-not then controlled-not + Hadamard would be universal.&lt;/p&gt;&#xA;&lt;p&gt;However, we know (Gottesman-Knill theorem) that the effects of controlled-not + Hadamard can be classically simulated, and so if we believe that there are algorithms that have a (more than polynomial) quantum speedup, it must be that controlled-not + Hadamard is not universal.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Update: I like Markus Heinrich's comment because it does simplify this specific argument. It helps us to focus more on the key properties of my original statement. We know that Hadamard+Toffoli is universal for quantum computation. That means, at least within some big subspace, and, specifically, starting from the all-0 state, any unitary can be created. On the other hand, the Gottesman-Knill theorem tells us that the Clifford gates (including c-NOT and Hadamard) form a finite group when acting on the input of all-0s. As such, they cannot recreate the action of Toffoli.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastEditorUserId="1837" LastEditDate="2021-05-26T15:08:11.123" LastActivityDate="2021-05-26T15:08:11.123" CommentCount="10" ContentLicense="CC BY-SA 4.0" />
  <row Id="17632" PostTypeId="1" CreationDate="2021-05-25T10:27:27.277" Score="2" ViewCount="13" Body="&lt;p&gt;I am trying to understand a proof from &lt;a href=&quot;https://arxiv.org/abs/1701.01450&quot; rel=&quot;nofollow noreferrer&quot;&gt;Practical optimization for hybrid quantum-classical algorithms&lt;/a&gt;. In particular, I need clarifications on how do you perform the measurement on a different basis presented below and the last step of the proof.&lt;/p&gt;&#xA;&lt;p&gt;First, let's start with some notation: &lt;span class=&quot;math-container&quot;&gt;$V(\theta)$&lt;/span&gt; is an ansatz of the most general shape&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;V({\theta})=\prod_{l=1}^{L}V_l(\theta_l)W_l&#xA;\end{equation}&lt;/span&gt;&#xA;Where &lt;span class=&quot;math-container&quot;&gt;$V_l(\theta_l)=\exp(-i\theta_lU_l)$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$U_l$&lt;/span&gt; is an Hermitian operator, &lt;span class=&quot;math-container&quot;&gt;$W_l$&lt;/span&gt; is also an unitary (doesn't matter now). Moreveover, you can always decompose &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; as a linear combination of Paulis &lt;span class=&quot;math-container&quot;&gt;$U_l=\sum_{\mu}^{l_U}u_\mu \sigma_{\mu}^{(U)}$&lt;/span&gt;. Similarly, for any Hermitian &lt;span class=&quot;math-container&quot;&gt;$H=\sum_{\nu}^{l_G}h_\nu \sigma_{\nu}^{(H)}$&lt;/span&gt;. Finally, when &amp;quot;splitting&amp;quot; the gate sequence &lt;span class=&quot;math-container&quot;&gt;$V$&lt;/span&gt; we write in short &lt;span class=&quot;math-container&quot;&gt;$V_-=\prod_{l=1}^{k-1}V_l(\theta_l)W_l$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$V_+=\prod_{l=k}^{L}V_l(\theta_l)W_l$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/as3iN.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/as3iN.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Given this circuit, I am trying to understand the output presented by the author. The proof goes as follows:&lt;/p&gt;&#xA;&lt;p&gt;Applying &lt;span class=&quot;math-container&quot;&gt;$V_-$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt; to the initial state yields: &lt;span class=&quot;math-container&quot;&gt;$V_-|{\textbf{0}}\rangle(|{0}\rangle+|{1}\rangle)(1/\sqrt{2})$&lt;/span&gt;. Then, a controlled &lt;span class=&quot;math-container&quot;&gt;$\sigma_{\mu}^{(U)}$&lt;/span&gt; gate results in&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;    \frac{1}{\sqrt{2}}\left(V_-|{\textbf{0}}\rangle|{0}\rangle+\sigma_{\mu}^{(U)}V_-|{\textbf{0}}\rangle|{1}\rangle     \right)&#xA;\end{equation*}&lt;/span&gt;&#xA;then&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;\frac{1}{\sqrt{2}}\left(V_-|{\textbf{0}\rangle}|{0}\rangle+\sigma_{\mu}^{(U)}V_-|{\textbf{0}}\rangle|{1}\rangle     \right) \xrightarrow{S, V_+} \frac{1}{\sqrt{2}}\left(V|{\textbf{0}}\rangle|{0}\rangle+iV_+\sigma_{\mu}^{(U)}V_-|{\textbf{0}}\rangle|{1}\rangle     \right)&#xA;\end{equation*}&lt;/span&gt;&#xA;finally, an Hadamard on the ancilla and the circuit output is:&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation*}&#xA;    \begin{aligned}&#xA;&amp;amp;|{\psi_{\mu}}\rangle=\frac{1}{\sqrt{2}}\left(V|{\textbf{0}}\rangle|{+}\rangle+iV_+\sigma_{\mu}^{(U)}V_-|{\textbf{0}}\rangle|{-}\rangle\right)= \\&#xA;&amp;amp; = \frac{1}{2}[(V|{\textbf{0}}\rangle+iV_+\sigma_{\mu}^{(U)}V_-|{\textbf{0}}\rangle)|{0}\rangle        +(V|{\textbf{0}}\rangle-iV_+\sigma_{\mu}^{(U)}V_-|{\textbf{0}}\rangle)|{1}\rangle)]&#xA;    \end{aligned}&#xA;\end{equation*}&lt;/span&gt;&#xA;Now comes the difficult bit, which is measuring along a different basis on a set of qubits, and measuring on the canonical on the ancilla.&#xA;The author says: Recalling that &lt;span class=&quot;math-container&quot;&gt;$\langle i|\hat{\sigma}_{z}^{(a)}|j\rangle=\delta_{i j}(-1)^{j},$&lt;/span&gt; one can easily verify that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;        \left\langle\psi_{\mu}\left|\hat{\sigma}_{\nu}^{(H)} \otimes \hat{\sigma}_{z}^{(a)}\right| \psi_{\mu}\right\rangle=-\Im\left[\left\langle 0\left|V^{\dagger} V_{+} \hat{\sigma}_{\mu}^{(U)} \hat{V}_{+}^{\dagger} \hat{\sigma}_{\nu}^{(H)}V\right| 0\right\rangle\right]&#xA;\end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;How do you prove this very last step?&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;How do you &lt;em&gt;practically&lt;/em&gt; implement this measurement operator above if you were to implement it on a QC? (You can also use an example, like assume &lt;span class=&quot;math-container&quot;&gt;$\sigma_v$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; on some qubits or whatever you prefer).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Don't hesitate to ask for clarifications if necessary, I am open to suggestions to improve this question.&#xA;When answering, please do so in a simple and understandable format, without skipping too many steps so that a beginner can also understand&lt;/p&gt;&#xA;" OwnerUserId="11551" LastActivityDate="2021-05-25T10:27:27.277" Title="Measurement on a specific basis and proof of circuit output" Tags="&lt;quantum-gate&gt;&lt;measurement&gt;&lt;vqe&gt;&lt;pauli-gates&gt;&lt;optimization&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17633" PostTypeId="1" CreationDate="2021-05-25T12:52:26.910" Score="0" ViewCount="39" Body="&lt;p&gt;What are different classes of Mixed entangled states? Just like maximally mixed entangled state like Werner states, are there different classes of mixed entangled states?&lt;/p&gt;&#xA;" OwnerUserId="13039" LastEditorUserId="55" LastEditDate="2021-05-26T09:15:49.510" LastActivityDate="2021-05-26T09:15:49.510" Title="What are the different classes of mixed entangled states?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;" AnswerCount="0" CommentCount="4" ClosedDate="2021-05-28T18:35:10.080" ContentLicense="CC BY-SA 4.0" />
  <row Id="17634" PostTypeId="1" CreationDate="2021-05-25T13:32:36.540" Score="1" ViewCount="52" Body="&lt;p&gt;I've the following circuit which gives an output of &lt;code&gt;1&lt;/code&gt; with a phase angle of &lt;code&gt;3π/4&lt;/code&gt;. When we measure the circuit all we get is the state &lt;code&gt;1&lt;/code&gt; (On actual QC, it's 90% of the time &lt;code&gt;1&lt;/code&gt;). Is the information about the phase angle lost by measuring the state? Could the phase angle also be part of the output?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/BkirU.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/BkirU.png&quot; alt=&quot;Circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;OPENQASM 2.0;&#xA;include &amp;quot;qelib1.inc&amp;quot;;&#xA;&#xA;qreg q[1];&#xA;creg c[1];&#xA;&#xA;u(pi/2,pi/2,0) q[0];&#xA;h q[0];&#xA;u(pi/2,pi/2,pi/2) q[0];&#xA;measure q[0] -&amp;gt; c[0];&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12667" LastActivityDate="2021-05-25T13:32:36.540" Title="What is the significance of the phase angle?" Tags="&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;quantum-state&gt;&lt;phase-estimation&gt;&lt;quantum-circuit&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17635" PostTypeId="2" ParentId="17629" CreationDate="2021-05-25T13:41:08.523" Score="3" Body="&lt;p&gt;Inspired by the discussion in @DaftWullie's answer above, note that we can construct a lattice/Hasse diagram of all classes of Boolean functions realizable/synthesizable with various gate sets.  Such a lattice will indicate whether a given gate set is universal for the given class.&lt;/p&gt;&#xA;&lt;p&gt;For classical (not necessarily reversible) computation, Emil Post &lt;a href=&quot;https://en.wikipedia.org/wiki/Post%27s_lattice&quot; rel=&quot;nofollow noreferrer&quot;&gt;did&lt;/a&gt; this in the 40's.  Thus we have, for example, the well-known results that the [0, 1, ∧, ∨] are only able to synthesize &amp;quot;monotone&amp;quot; functions.&lt;/p&gt;&#xA;&lt;p&gt;Apparently the same question went mostly unasked throughout most of the history of reversible computation; nonetheless, not too long ago &lt;a href=&quot;https://arxiv.org/abs/1504.05155&quot; rel=&quot;nofollow noreferrer&quot;&gt;Aaronson, Grier, and Schaeffer&lt;/a&gt; were able to build such a lattice.  Their full classification allows for ancillas, and clocks in at 68 pages, but their Theorem 3 separates the class of functions realizable with CNOTs from those realizable with Toffoli gates.&lt;/p&gt;&#xA;&lt;p&gt;Briefly and from a quick perusal of the above paper, CNOT gates (even with extra ancillas) are affine over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_2$&lt;/span&gt;, while CCNOT gates (Toffoli gates) are not.  Thus CNOT gates alone cannot synthesize non-affine functions, while Toffoli gates can.&lt;/p&gt;&#xA;&lt;p&gt;Being affine means that, for a circuit &lt;span class=&quot;math-container&quot;&gt;$G$&lt;/span&gt; (including ancillas initialized arbitrarily to &lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; if necessary), then there exists an invertible matrix &lt;span class=&quot;math-container&quot;&gt;$A\in\mathbb{F}_2^{k\times k}$&lt;/span&gt; and a vector &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;$G(x)=Ax\otimes b$&lt;/span&gt; for all &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-05-25T14:45:04.607" LastActivityDate="2021-05-25T14:45:04.607" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17636" PostTypeId="2" ParentId="17616" CreationDate="2021-05-25T13:50:32.640" Score="1" Body="&lt;p&gt;Just few ideas, I do not pretend this to be the definitive answer.&lt;/p&gt;&#xA;&lt;p&gt;Firstly, to exploit quantum &lt;em&gt;advantage&lt;/em&gt;, you need to employ both superposition and entanglement. If these phenomena are not employed, a quantum computer can do anything a classical one can do but with no speed-up (I supposed that e.g. Toffoli gate is implemented in the computer, so you can implement any Boolean logical function).&lt;/p&gt;&#xA;&lt;p&gt;However, not only superposition and entanglement are needed. Take for example Shor's algorihtm which offers exponential speed-up. It employs both superposition and entanglement. On the other hand, Grover's algorithm also uses both phenomenas but it provides you with only quadratic speed-up. So, there is probably something more than just entanglement.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-05-25T13:50:32.640" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17637" PostTypeId="1" AcceptedAnswerId="17640" CreationDate="2021-05-25T15:44:48.507" Score="4" ViewCount="96" Body="&lt;p&gt;How can I create the Pennylane equivalent of:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import QuantumCircuit&#xA;&#xA;circ = QuantumCircuit(2, 2)&#xA;circ.rxx(theta=0.3, qubit1=0, qubit2=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13901" LastEditorUserId="55" LastEditDate="2021-05-26T18:50:16.103" LastActivityDate="2021-05-26T18:50:16.103" Title="How to create the equivalent of the Qiskit rxx gate in Pennylane?" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;&lt;pennylane&gt;" AnswerCount="2" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17638" PostTypeId="2" ParentId="17629" CreationDate="2021-05-25T16:16:41.780" Score="3" Body="&lt;p&gt;If your inputs are bits &lt;span class=&quot;math-container&quot;&gt;$b_1, ..., b_n$&lt;/span&gt; and you can only use NOT gates and CNOT gates, then your outputs are always parities. Your outputs are always of the form &lt;span class=&quot;math-container&quot;&gt;$c_0 + \sum_{k=1}^n c_k b_k$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$c_k \in \{0, 1\}$&lt;/span&gt; are bits you can pick and also all arithmetic is modulo 2. For example, you can output &lt;span class=&quot;math-container&quot;&gt;$\lnot b_1$&lt;/span&gt; and you can output &lt;span class=&quot;math-container&quot;&gt;$b_1 + b_3$&lt;/span&gt; but you can't output &lt;span class=&quot;math-container&quot;&gt;$b_1 \cdot b_3$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$b_1 \cdot b_3 + b_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;With a Toffoli gate, you can easily output a bit equal to &lt;span class=&quot;math-container&quot;&gt;$b_1 \cdot b_3 + b_2$&lt;/span&gt;. Just perform a Toffoli controlled by bits 1 and 3 targeting bit 2. Since the Toffoli gate enables you to do something you can't do with NOTs and CNOTs, you can't build a Toffoli out of NOTs and CNOTs.&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-25T16:16:41.780" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17639" PostTypeId="2" ParentId="17637" CreationDate="2021-05-25T16:17:48.860" Score="2" Body="&lt;p&gt;In this tutorial in PennyLane, they guide you to create a custom gate (Rxx gate)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://pennylane.ai/blog/2021/05/how-to-add-custom-gates-and-templates-to-pennylane/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://pennylane.ai/blog/2021/05/how-to-add-custom-gates-and-templates-to-pennylane/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;After creating it you can simply use these code to add it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;dev = qml.device('default.qubit', wires=3)&#xA;dev.operations.add(&amp;quot;RXX&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="14994" LastActivityDate="2021-05-25T16:17:48.860" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17640" PostTypeId="2" ParentId="17637" CreationDate="2021-05-25T16:20:22.323" Score="4" Body="&lt;p&gt;Here's a simple example if you're looking for a quick hack:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import pennylane as qml&#xA;import numpy as np&#xA;&#xA;def RXX(theta):&#xA;    rxx = np.array([&#xA;        [np.cos(theta/2), 0, 0, -1j*np.sin(theta/2)],&#xA;        [0, np.cos(theta/2), -1j*np.sin(theta/2), 0],&#xA;        [0, -1j*np.sin(theta/2), np.cos(theta/2), 0],&#xA;        [-1j*np.sin(theta/2), 0, 0, np.cos(theta/2)]&#xA;    ])&#xA;    return rxx&#xA;&#xA;dev = qml.device('default.qubit', wires=2)&#xA;@qml.qnode(dev)&#xA;def circuit(theta):&#xA;    qml.QubitUnitary(RXX(theta), wires=[0, 1])&#xA;    return qml.expval(qml.PauliZ(0))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Alternatively, you can create a new RXX class as they do in this &lt;a href=&quot;https://pennylane.ai/blog/2021/05/how-to-add-custom-gates-and-templates-to-pennylane/&quot; rel=&quot;nofollow noreferrer&quot;&gt;custom gate tutorial&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import pennylane as qml&#xA;from pennylane.operation import Operation&#xA;from pennylane import numpy as np&#xA;&#xA;class RXX(Operation):&#xA;    num_params = 1&#xA;    num_wires = 2&#xA;    par_domain = &amp;quot;R&amp;quot;&#xA;&#xA;    grad_method = &amp;quot;A&amp;quot;&#xA;    grad_recipe = None # This is the default but we write it down explicitly here.&#xA;&#xA;    generator = [(qml.PauliX(0) @ qml.PauliX(1)).matrix, -0.5]&#xA;&#xA;    @staticmethod&#xA;    def decomposition(theta, wires):&#xA;        return [qml.PauliRot(theta, 'XX', wires=wires)]&#xA;&#xA;    @staticmethod&#xA;    def _matrix(*params):&#xA;        theta = params[0]&#xA;        c = np.cos(0.5 * theta)&#xA;        s = np.sin(0.5 * theta)&#xA;        return np.array(&#xA;            [&#xA;                [c, 0, 0, -s],&#xA;                [0, c, -s, 0],&#xA;                [0, -s, c, 0],&#xA;                [-s, 0, 0, c]&#xA;            ]&#xA;        )&#xA;&#xA;    def adjoint(self):&#xA;        return RXX(-self.data[0], wires=self.wires)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="13991" LastEditorUserId="13991" LastEditDate="2021-05-25T16:26:14.110" LastActivityDate="2021-05-25T16:26:14.110" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17641" PostTypeId="1" AcceptedAnswerId="17643" CreationDate="2021-05-25T17:28:54.847" Score="3" ViewCount="44" Body="&lt;p&gt;Is it possible to use a simple laser to measure qubits in optical quantum computers, or is a single-photon emitter absolutely necessary? If you can do it with a simple laser, how would you go about measuring it since you wouldn't have to measure a single photon but rather a stream of them?&lt;/p&gt;&#xA;" OwnerUserId="15994" LastEditorUserId="55" LastEditDate="2021-05-28T06:20:53.880" LastActivityDate="2021-05-28T06:20:53.880" Title="How is measurement performed on a stream of polarized photons?" Tags="&lt;entanglement&gt;&lt;measurement&gt;&lt;photonics&gt;&lt;optical-quantum-computing&gt;&lt;quantum-optics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17642" PostTypeId="1" CreationDate="2021-05-25T17:45:29.857" Score="2" ViewCount="38" Body="&lt;p&gt;Hey any of you people know if it's possible to make a DIY single-photon emitter? I've been searching for an answer for quite some time now and all I've come across that's helpful is this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://www.nature.com/articles/s41467-019-10917-3&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.nature.com/articles/s41467-019-10917-3&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Anyone have an alternate solution?&#xA;Thank you&lt;/p&gt;&#xA;" OwnerUserId="15995" LastActivityDate="2021-05-25T17:45:29.857" Title="How to build a single-photon emitter at home" Tags="&lt;quantum-optics&gt;" AnswerCount="0" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17643" PostTypeId="2" ParentId="17641" CreationDate="2021-05-25T18:40:33.627" Score="3" Body="&lt;p&gt;One idea is to do polarimetry. By using a polarizing beam splitter, the polarization qubit can have each of its polarization components directed to a different detector for photon counting (ideally a single-photon detector, here).&lt;/p&gt;&#xA;&lt;p&gt;A polarizing beam splitter might send horizontally polarized photons in one direction and vertically polarized photons in another. If you want to measure in a different basis, you can first place a series of wave plates to rotate the qubit before the polarizing beam splitter, then interpret the measurement results in that new basis. For example, a quarter-wave plate allows one to switch between the linear and circular polarization bases.&lt;/p&gt;&#xA;&lt;p&gt;I think your question may be also asking whether the polarization qubit itself needs to be a single photon, or if the polarization qubit may be the polarization state of an entire stream of photons coming from a laser. Is this correct? If so, there are more complications. Classically, the state of polarization coming from a laser seems identical to that of a single photon, but there are many many more quantum degrees of freedom when you consider the photons involved. A laser won't always behave like a single polarization qubit when subject to arbitrary transformations and so it isn't actually a qubit (more generally, this is the realm of continuous-variable quantum computation).&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-25T18:40:33.627" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17644" PostTypeId="1" AcceptedAnswerId="17645" CreationDate="2021-05-26T03:17:00.830" Score="4" ViewCount="193" Body="&lt;p&gt;Recently, I have tried PennyLane and TensorFlow Quantum. These platforms are said to provide differentiable programming of quantum computers but I can't understand it clearly though.&lt;/p&gt;&#xA;&lt;p&gt;I have searched about differentiable programming and found out that it allows for gradient-based optimization of parameters in the program. Does differentiable programming of quantum computers supplied us with a faster way to do gradient descent such as parameter shift rules, natural gradient, ...&lt;/p&gt;&#xA;&lt;p&gt;Except for PennyLane and TensorFlow Quantum, Can we do differentiable programming of quantum computers on other platforms like Qiskit, Cirq, ...&lt;/p&gt;&#xA;" OwnerUserId="14994" LastActivityDate="2021-05-26T04:09:55.320" Title="Differentiable Programming of Quantum Computers" Tags="&lt;qiskit&gt;&lt;machine-learning&gt;&lt;pennylane&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17645" PostTypeId="2" ParentId="17644" CreationDate="2021-05-26T04:09:55.320" Score="3" Body="&lt;p&gt;Yes, it is possible to do this with Qiskit and Cirq. For Qiskit, you can read up this &lt;a href=&quot;https://qiskit.org/documentation/tutorials/operators/02_gradients_framework.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;tutorial page here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There was an answer by Josh Izaac from Pennylane here awhile back about parameter shift rule and finite difference to do gradient on quantum circuit here: &lt;a href=&quot;https://quantumcomputing.stackexchange.com/a/15445/9858&quot;&gt;https://quantumcomputing.stackexchange.com/a/15445/9858&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;For any quantum software platform, you can do this. The gradient frame-work might not be built-in like Pennylane or Qiskit but you can write your own program to evaluate the gradient. If you already know how to evaluate your cost function then tweaking it a bit to evaluate the gradient is not too hard. So if you have the cost function&#xA;&lt;span class=&quot;math-container&quot;&gt;$$C(\theta) = \langle\psi|U^\dagger(\theta) HU(\theta)|\psi\rangle $$&lt;/span&gt;&#xA;and if &lt;span class=&quot;math-container&quot;&gt;$U(\theta)$&lt;/span&gt; is generated from a gate that can be written as the exponential of&#xA;Pauli operator, for instance &lt;span class=&quot;math-container&quot;&gt;$U(\theta) = e^{-i\theta/2 X} = R_X(\theta)$&lt;/span&gt;, then to evaluate the derivative you can just evaluate the cost function with &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; shift by &lt;span class=&quot;math-container&quot;&gt;$+\pi/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$-\pi/2$&lt;/span&gt;, then take the difference. So in the case you &lt;span class=&quot;math-container&quot;&gt;$R_X(\theta)$&lt;/span&gt; you have to perform the two operations/circuits:&lt;/p&gt;&#xA;&lt;p&gt;Forward shift: &lt;span class=&quot;math-container&quot;&gt;$R_X(\theta + \pi/2) |\psi \rangle $&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Backward shift: &lt;span class=&quot;math-container&quot;&gt;$R_X(\theta - \pi/2) |\psi \rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Evaluate the cost for these two circuits, then take their difference to get the gradient. Note that here &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; is just some initial state, you can take it to be &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; if you want.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-26T04:09:55.320" CommentCount="5" ContentLicense="CC BY-SA 4.0" />
  <row Id="17646" PostTypeId="2" ParentId="17618" CreationDate="2021-05-26T07:18:53.357" Score="0" Body="&lt;p&gt;OK, my question has some suspicious implicit assumptions. Usually the point of the algorithm is not to prepare a given state &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; from an initial state &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt;. If &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; encodes the solution to a problem, and if we know &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; right from the start there no need to build an algorithm. Rather, the problem usually is to construct a state &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt; satisfying certain properties (say &lt;span class=&quot;math-container&quot;&gt;$U_{\text{oracle}}|B\rangle=- |B\rangle$&lt;/span&gt; ).&lt;/p&gt;&#xA;&lt;p&gt;So in general the question &amp;quot;find the shortes path between states &lt;span class=&quot;math-container&quot;&gt;$|A\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|B\rangle$&lt;/span&gt;&amp;quot; does not make much sense. I can think of one exception though -- Grovers algorithm. It should be possible to build a classical circuit that calls an oracle &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; times and returns the marked state with certainty. One can ask if one can build the same circuit (approximately) out of the quantum gates instead of classical. My imagination pictures something like cutting along the diagonal path in the &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;-dimensional Hilbert space (while classical paths can only travel along computational axes and turn right angles) and from Pythagoras theorem that should give about &lt;span class=&quot;math-container&quot;&gt;$\sqrt{N}$&lt;/span&gt; advantage. Of course this is no proof, but this does not seem too implausible to me.&lt;/p&gt;&#xA;&lt;p&gt;OK, the problem with this argument then seems to be that any quantum algorithm should be possible to approximate with a classical algorithm with no more than a quadratic slowdown. So, do we all agree that &lt;span class=&quot;math-container&quot;&gt;$BQP=BPP$&lt;/span&gt; is not settled in the affirmative?&lt;/p&gt;&#xA;" OwnerUserId="15239" LastActivityDate="2021-05-26T07:18:53.357" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17647" PostTypeId="1" AcceptedAnswerId="17653" CreationDate="2021-05-26T09:11:56.403" Score="2" ViewCount="33" Body="&lt;p&gt;In this &lt;a href=&quot;https://spie.org/etop/1999/193_1.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;material&lt;/a&gt;, it gives the definition of modes:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The modes are basically defined by the properties of coherence and orthogonality: modes are orthogonal solutions of the wave equation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Since the modes are eigenfunctions in this material, why do we need to use a new term 'mode' instead of the original one, i.e., eigenfunctions?&lt;/p&gt;&#xA;" OwnerUserId="13968" LastActivityDate="2021-05-26T15:12:20.180" Title="Why do we use 'modes' in quantum optics?" Tags="&lt;terminology&gt;&lt;foundations&gt;&lt;quantum-optics&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17648" PostTypeId="1" AcceptedAnswerId="17649" CreationDate="2021-05-26T09:16:08.700" Score="2" ViewCount="54" Body="&lt;p&gt;I am reading &lt;em&gt;Quantum Computing 1st Edition&lt;/em&gt; By Parag Lala, &lt;a href=&quot;https://www.mheducation.com/highered/product/quantum-computing-lala/9781260123111.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;this book&lt;/a&gt; says&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/YQ6Bt.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/YQ6Bt.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It seemed that the Z gate swapped the complex amplitudes &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Can Z gate implement that, or are there any errata? Because&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix} \alpha \\ -\beta \end{pmatrix} = \alpha\begin{pmatrix} 1 \\ 0 \end{pmatrix} - \beta\begin{pmatrix} 0 \\ 1 \end{pmatrix} \neq \alpha\begin{pmatrix} 0 \\ 1 \end{pmatrix} + \beta\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \alpha|1\rangle + \beta|0\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And, is it true that Z Gate merely add &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; to the relative phase &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; of a superposition &lt;span class=&quot;math-container&quot;&gt;$|q\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;|q\rangle = \alpha|0\rangle + e^{i\phi}\beta|1\rangle&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;Z|q\rangle = \alpha|0\rangle + e^{i(\phi+\pi)}\beta|1\rangle&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15495" LastEditorUserId="55" LastEditDate="2021-05-26T09:19:11.060" LastActivityDate="2021-05-26T10:40:05.987" Title="Does Z gate swap complex amplitudes of $|0\rangle$ and $|1\rangle$?" Tags="&lt;quantum-gate&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17649" PostTypeId="2" ParentId="17648" CreationDate="2021-05-26T10:22:04.603" Score="3" Body="&lt;p&gt;This is wrong for sure.&lt;/p&gt;&#xA;&lt;p&gt;And according to the book reviews on &lt;a href=&quot;https://rads.stackoverflow.com/amzn/click/com/B07M7Y6T7F&quot; rel=&quot;nofollow noreferrer&quot; rel=&quot;nofollow noreferrer&quot;&gt;Amazon&lt;/a&gt;, this book is &amp;quot;unreliable&amp;quot;,&#xA;&amp;quot;riddled with errors&amp;quot;, and &amp;quot;someone studying for the first time will get confused&amp;quot;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2021-05-26T10:40:05.987" LastActivityDate="2021-05-26T10:40:05.987" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17650" PostTypeId="1" CreationDate="2021-05-26T11:15:29.133" Score="2" ViewCount="37" Body="&lt;p&gt;Is there any tool to define a circuit and verify if it works as desired?&#xA;It would be interesting to find ways of performing interacting gates - e.g. CNOT gate - between non adjacent qubits.&lt;/p&gt;&#xA;&lt;p&gt;Hence I'd like an efficient way to define a circuit with any number of qubits, and verify whether it performs the CNOT between two of them (no matter what happens the other qubits).&lt;/p&gt;&#xA;" OwnerUserId="8954" LastActivityDate="2021-05-27T05:42:41.227" Title="Tool to verify $CNOT$ (or any interacting 2-qubit gate)" Tags="&lt;gate-synthesis&gt;" AnswerCount="1" CommentCount="6" ContentLicense="CC BY-SA 4.0" />
  <row Id="17651" PostTypeId="1" AcceptedAnswerId="17652" CreationDate="2021-05-26T12:55:39.677" Score="3" ViewCount="62" Body="&lt;p&gt;I'm getting started in IBM quantum lab for quantum computing. My task is to put quantum state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; on the 1st qubit and state &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; on second one. I tried using this method to initialize it as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.initialize(0,0)&#xA;qc.initialize(1,1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;but when I run in the unitary simulator, I get the following error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Simulation failed and returned the following error message:&#xA;ERROR: Failed to load qobj: Invalid qobj &amp;quot;initialize&amp;quot; instruction (&amp;quot;params&amp;quot; is incorrect length).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I also tried using reset method but it displayed error as well&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qc.reset(0)&#xA;qc.reset(1)&#xA;qc.x(1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If anyone knows how to set state to a specific qubit in Qiskit it would be great, thanks in advance&lt;/p&gt;&#xA;&lt;p&gt;The full code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#Creating a quantum circuit with two qubits&#xA;qc=QuantumCircuit(2)&#xA;&#xA;#Set the state of the first qubit to|0⟩ and set the state of the second qubit to|1⟩.&#xA;qc.initialize(0,0)&#xA;qc.initialize(0,0)&#xA;#or&#xA;#qc.reset(0)&#xA;#qc.reset(1)&#xA;#qc.x(1)&#xA;&#xA;#Applying Hadamard to both qubits&#xA;qc.h(0)&#xA;qc.h(1)&#xA;&#xA;&#xA;#Applying CNOT operator, where the controller qubit is the first qubit and the target qubit is the second qubit&#xA;qc.cx(0,1)&#xA;&#xA;#Applying Hadamard to both qubits&#xA;qc.h(0)&#xA;qc.h(1)&#xA;&#xA;display(qc.draw()) &#xA;usim = Aer.get_backend('unitary_simulator')&#xA;qobj = assemble(qc)&#xA;unitary = usim.run(qobj).result().get_unitary()&#xA;array_to_latex(unitary, pretext=&amp;quot;\\text{Circuit = }\n&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="15626" LastEditorUserId="1859" LastEditDate="2021-05-26T14:07:08.383" LastActivityDate="2021-05-26T14:07:08.383" Title="Setting initial state in Qiskit unitary simulator" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-state&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17652" PostTypeId="2" ParentId="17651" CreationDate="2021-05-26T13:17:56.003" Score="4" Body="&lt;p&gt;If I understand correctly, your circuit looks like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;qc = QuantumCircuit(2)&#xA;qc.initialize(0,0)&#xA;qc.initialize(1,1)&#xA;&#xA;qc.h(0)&#xA;qc.h(1)&#xA;qc.cx(0,1)&#xA;qc.h(0)&#xA;qc.h(1)&#xA;&#xA;qc.draw('mpl') &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/pLRHc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/pLRHc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And you want to run it in the Aer unitary simulator. However, the simulator does not support the instruction &lt;code&gt;initialize&lt;/code&gt;. So you need to &lt;em&gt;transpile&lt;/em&gt; your circuit to the instruction set of the selected backend.  You can do that with &lt;code&gt;transpile&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;usim = Aer.get_backend('unitary_simulator')&#xA;transpiled = transpile(qc, backend=usim)&#xA;transpiled.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/qRF4G.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/qRF4G.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Once transpiled, you can run it in the backend:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;qobj = assemble(transpiled)&#xA;unitary = usim.run(qobj).result().get_unitary()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is the resulting unitary:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.visualization import array_to_latex&#xA;array_to_latex(unitary, prefix=&amp;quot;\\text{Circuit = }\n&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/0S1sx.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/0S1sx.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="1859" LastEditorUserId="1859" LastEditDate="2021-05-26T13:42:37.010" LastActivityDate="2021-05-26T13:42:37.010" CommentCount="7" ContentLicense="CC BY-SA 4.0" />
  <row Id="17653" PostTypeId="2" ParentId="17647" CreationDate="2021-05-26T15:12:20.180" Score="1" Body="&lt;p&gt;Modes are governed by eigenfunctions, I agree. In quantum optics, we need more than just eigenfunctions to describe a state of light: we need to know how many photons have properties corresponding to each eigenfunction. This is somewhat beyond what an eigenfunction describes, so we need a new term.&lt;/p&gt;&#xA;&lt;p&gt;For example, we can have a two-photon state of light where each photon is in a different spatial mode. That means that the light does not correspond to a single eigenfunction, nor does it correspond to a superposition of two eigenfunctions. We need a new way to describe it; hence, modes.&lt;/p&gt;&#xA;&lt;p&gt;We could also have a two-photon state of light where both photons are in the same spatial mode. How could this be expressed if all we have are eigenfunctions? Specifically, how would we distinguish between this state and a single-photon state of light corresponding to the same eigenfunction? If you say we could describe states of light by their eigenfunction and by the average energy, that would not be sufficient, because there are multiple states with a single eigenfunction that all have the same average energy.&lt;/p&gt;&#xA;&lt;p&gt;In all, we could simply say that light is described by a bunch of orthogonal eigenfunctions and extend the definition of eigenfunctions to include a description of the Fock space associated with these eigenfunctions. Since eigenfunctions are very well defined in the rest of mathematics, it is eventually easier to define a new term, modes, that can incorporate both the properties of eigenfunctions and the properties of the Fock space describing the photon-number superpositions for all of the eigenfunctions.&lt;/p&gt;&#xA;&lt;p&gt;In math: label two eigenfunctions by &lt;span class=&quot;math-container&quot;&gt;$a$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$b$&lt;/span&gt;, a single photon with a single eigenfunction might be written as &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_a\otimes |0\rangle_b$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$|0\rangle_a\otimes |1\rangle_b$&lt;/span&gt;. The eigenfunction language can't really distinguish between, say, &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_a\otimes |0\rangle_b$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|2\rangle_a\otimes |0\rangle_b$&lt;/span&gt;. Moreover, it does not do well at describing &lt;span class=&quot;math-container&quot;&gt;$|1\rangle_a\otimes |1\rangle_b$&lt;/span&gt;. So we either add to the definition of eigenfunctions, or we define a new term that lets us write&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle=\sum_{i,j}\psi_{i,j}|i\rangle_a\otimes |j\rangle_b.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-26T15:12:20.180" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17654" PostTypeId="1" CreationDate="2021-05-26T16:38:13.183" Score="4" ViewCount="44" Body="&lt;p&gt;I know how to perform Rz rotations with the least amount of T gates, eg by using &lt;a href=&quot;https://arxiv.org/pdf/1212.6253.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;Efficient Clifford+T approximation of single-qubit operators&lt;/a&gt; by Peter Selinger. Similarly, one could use H Rz H to perform an Rx rotation. This seems to me like a simple question, what gate should one use to perform Ry using a single Rz + Clifford gates?&lt;/p&gt;&#xA;" OwnerUserId="13404" LastEditorUserId="55" LastEditDate="2021-05-26T20:59:26.847" LastActivityDate="2021-05-27T15:04:00.273" Title="What gate should one use to perform $R_y$ using a single $R_z$ + Clifford gates?" Tags="&lt;quantum-gate&gt;&lt;gate-synthesis&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17656" PostTypeId="1" CreationDate="2021-05-26T17:40:03.227" Score="3" ViewCount="37" Body="&lt;p&gt;I am working on the classical simulation of quantum circuits. I know how to efficiently implement the following entangling gate, which -- in the following paper: &lt;a href=&quot;https://arxiv.org/pdf/1803.02118&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/pdf/1803.02118&lt;/a&gt; -- was declared to be an entangling gate that is sufficient to realize arbitrary quantum circuits together with 1-qubit gates. The gate is given by&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;U_\text{entangle}=\frac{1}{2}\begin{pmatrix}&#xA;ie^{i\pi/4} &amp;amp; e^{i\pi/4} &amp;amp; e^{i\pi/4} &amp;amp; -ie^{i\pi/4} \\&#xA;e^{-i\pi/4} &amp;amp; ie^{-i\pi/4} &amp;amp; -ie^{-i\pi/4} &amp;amp; e^{-i\pi/4} \\&#xA;e^{-i\pi/4} &amp;amp; -ie^{-i\pi/4} &amp;amp; ie^{-i\pi/4} &amp;amp; e^{-i\pi/4} \\&#xA;-ie^{i\pi/4} &amp;amp; e^{i\pi/4} &amp;amp; e^{i\pi/4} &amp;amp; ie^{i\pi/4}&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;I want to implement the CNOT gate, which is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT}=\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&#xA;I am looking for an expression of CNOT in terms of &lt;span class=&quot;math-container&quot;&gt;$U_\text{entangle}$&lt;/span&gt;. In the most general form, this is given by&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\text{CNOT} = A\: U_\text{entangle}\: B \:U_\text{entangle}\: C U_\text{entangle}\: D \dots U_\text{entangle} \: Z &#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$A,B,C,\dots,Z$&lt;/span&gt; are arbitrary combinations of 1-qubit gates. Hence even &lt;span class=&quot;math-container&quot;&gt;$A$&lt;/span&gt; for instance can be composed of several 1-qubit gates.&lt;/p&gt;&#xA;&lt;p&gt;I now want to find such matrices &lt;span class=&quot;math-container&quot;&gt;$A,\dots$&lt;/span&gt; that give me a representation of &lt;span class=&quot;math-container&quot;&gt;$U_\text{entangle}$&lt;/span&gt; in terms of CNOT and 1-qubit gates.&lt;/p&gt;&#xA;&lt;p&gt;Is there an algorithm / a procedure to follow in order to determine the circuit that realizes CNOT? Is &lt;span class=&quot;math-container&quot;&gt;$U_\text{entangle}$&lt;/span&gt; maybe a famous gate that has already been shown to produce CNOT with single-qubit unitaries? If the ''decomposing'' procedure doesn't follow a strict rule, are there at least any tips / rules of thumb you can give in order to find such a decomposition?&lt;/p&gt;&#xA;&lt;p&gt;Any help is really appreciated! Many thanks in advance!&lt;/p&gt;&#xA;" OwnerUserId="15134" LastActivityDate="2021-05-26T20:08:11.433" Title="How to create CNOT from an entangling gate and arbitrary single-qubit gates?" Tags="&lt;quantum-gate&gt;&lt;circuit-construction&gt;&lt;simulation&gt;&lt;gate-synthesis&gt;&lt;universal-gates&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17657" PostTypeId="2" ParentId="17656" CreationDate="2021-05-26T18:36:33.790" Score="0" Body="&lt;p&gt;You can use the KAK decomposition method described &lt;a href=&quot;https://arxiv.org/abs/0806.4015&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And if you are using Qiskit, this method is implemented in &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.TwoQubitBasisDecomposer.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;TwoQubitBasisDecomposer&lt;/a&gt; class.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;z = cmath.rect(1, np.pi / 4) # e^(iπ/4)&#xA;&#xA;# Your two-qubit entangling gate as numpy array:&#xA;basis_unitary = 0.5 * np.array([&#xA;    [1j*z, z, z, -1j*z],&#xA;    [1/z, 1j/z, -1j/z, 1/z],&#xA;    [1/z, -1j/z, 1j/z, 1/z],&#xA;    [-1j*z, z, z, 1j*z]&#xA;])&#xA;&#xA;decomposer = TwoQubitBasisDecomposer(UnitaryGate(basis_unitary))&#xA;circ = decomposer(CXGate().to_matrix())&#xA;circ.draw('mpl')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The resulting circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/F4Fl4.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/F4Fl4.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2021-05-26T20:08:11.433" LastActivityDate="2021-05-26T20:08:11.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17658" PostTypeId="2" ParentId="17654" CreationDate="2021-05-26T20:18:10.587" Score="3" Body="&lt;p&gt;The phase gate &lt;span class=&quot;math-container&quot;&gt;$$S=\begin{pmatrix}1&amp;amp;0\\0&amp;amp;i\end{pmatrix}=\sqrt{\sigma_z}$$&lt;/span&gt; satisfies &lt;span class=&quot;math-container&quot;&gt;$$S\sigma_x S^\dagger=\sigma_y,$$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\sigma_i$&lt;/span&gt; are the Pauli matrices. So, once you know that &lt;span class=&quot;math-container&quot;&gt;$R_x=H R_z H$&lt;/span&gt;, you can immediately find &lt;span class=&quot;math-container&quot;&gt;$$R_y=SH R_z HS^\dagger.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also do &lt;span class=&quot;math-container&quot;&gt;$$R_y=-S^\dagger H R_z HS.$$&lt;/span&gt;&lt;/p&gt;&#xA;" OwnerUserId="15820" LastEditorUserId="15820" LastEditDate="2021-05-27T14:00:48.160" LastActivityDate="2021-05-27T14:00:48.160" CommentCount="3" ContentLicense="CC BY-SA 4.0" />
  <row Id="17659" PostTypeId="1" CreationDate="2021-05-26T20:28:32.973" Score="2" ViewCount="36" Body="&lt;p&gt;Consider the following statement of Stockmeyer counting theorem.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Given as input a function &lt;span class=&quot;math-container&quot;&gt;$f:\{0, 1\}^{n} \rightarrow \{0, 1\}^{m}$&lt;/span&gt;&#xA;and &lt;span class=&quot;math-container&quot;&gt;$y \in \{0, 1\}^{m}$&lt;/span&gt;, there is a procedure that runs in randomized&#xA;polynomial time, with access to an &lt;span class=&quot;math-container&quot;&gt;$\text{NP}^{f}$&lt;/span&gt; oracle (that is, in &lt;span class=&quot;math-container&quot;&gt;$\text{FBPP}^{\text{NP}^{f}})$&lt;/span&gt;, and output&#xA;an estimate &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; such that &lt;span class=&quot;math-container&quot;&gt;\begin{equation} (1 - \epsilon)p \leq&#xA; \alpha \leq (1 + \epsilon)p, \end{equation}&lt;/span&gt; for  &lt;span class=&quot;math-container&quot;&gt;\begin{equation} p=&#xA; \frac{1}{2^{n}}\sum_{x \in \{0, 1\}^{n}}f(x). \end{equation}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This version can be found in Theorem 21&#xA;&lt;a href=&quot;https://arxiv.org/abs/1803.04402&quot; rel=&quot;nofollow noreferrer&quot;&gt;this&lt;/a&gt; paper.&lt;/p&gt;&#xA;&lt;p&gt;Here are my two questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;p&gt;Consider a quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; run on the all &lt;span class=&quot;math-container&quot;&gt;$|0^{n}\rangle$&lt;/span&gt;. For &lt;span class=&quot;math-container&quot;&gt;$x \in \{0, 1\}^{n}$&lt;/span&gt;, consider an output probability&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{equation}&#xA;p_x = |\langle x|C|0^{n}\rangle|^{2}.&#xA;\end{equation}&lt;/span&gt; Because of Stockmeyer's theorem, for any quantum circuit &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt; can we multiplicatively estimate &lt;span class=&quot;math-container&quot;&gt;$p_x$&lt;/span&gt; to error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, for any &lt;span class=&quot;math-container&quot;&gt;$x \in \{0, 1\}^{n}$&lt;/span&gt;, in &lt;span class=&quot;math-container&quot;&gt;$\text{FBQP}^{\text{NP}^{S}}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt; is an exact sampler from the output distribution of &lt;span class=&quot;math-container&quot;&gt;$C$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;Note that it is trivial to sample from the output distribution of a&#xA;quantum circuit in    quantum randomized polynomial time, so, if the&#xA;answer to this question is yes, does it mean we can compute this&#xA;estimate in &lt;span class=&quot;math-container&quot;&gt;$\text{FBQP}$&lt;/span&gt; itself and not need the oracle?&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Can we multiplicatively estimate &lt;span class=&quot;math-container&quot;&gt;$p_x$&lt;/span&gt;, to error &lt;span class=&quot;math-container&quot;&gt;$\epsilon$&lt;/span&gt;, for a &lt;em&gt;uniformly randomly&lt;/em&gt; chosen &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;, in &lt;span class=&quot;math-container&quot;&gt;$\text{FBQP}^{\text{NP}^{S}}$&lt;/span&gt;? The paper I linked seems to indicate that we can, in Lemma 23, but I do not see how.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Basically, I do not understand what &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; of Stockmeyer's counting theorem is in either of these cases. How does the existence of a sampler &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;, for the output distribution of a quantum circuit, relate to the &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; in Stockmeyer's theorem --- can we construct an explicit &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; using the circuit and the sampler &lt;span class=&quot;math-container&quot;&gt;$S$&lt;/span&gt;? Does sampling imply approximate counting by Stockmeyer's argument?&lt;/p&gt;&#xA;" OwnerUserId="1351" LastActivityDate="2021-05-26T20:28:32.973" Title="Relation between approximate counting and sampling" Tags="&lt;quantum-state&gt;&lt;complexity-theory&gt;&lt;quantum-advantage&gt;&lt;probability&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17660" PostTypeId="1" AcceptedAnswerId="17661" CreationDate="2021-05-27T01:26:22.250" Score="5" ViewCount="88" Body="&lt;p&gt;Suppose I have the entangled state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |110\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If i want to factor the non-entangled parts of this state out, I can easily write that down as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle) \otimes |0\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose now, however, that I have a state&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$|\phi\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |101\rangle).$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$3$&lt;/span&gt; are entangled as opposed to qubits &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; in &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;. Is there a notation for factoring out qubit &lt;span class=&quot;math-container&quot;&gt;$2$&lt;/span&gt; in this state that is elegant like for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt;?&lt;/p&gt;&#xA;" OwnerUserId="7729" LastActivityDate="2021-05-27T13:57:13.117" Title="What is the notation for factoring a state when non-adjacent qubits are entangled?" Tags="&lt;entanglement&gt;&lt;notation&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17661" PostTypeId="2" ParentId="17660" CreationDate="2021-05-27T02:53:28.160" Score="5" Body="&lt;p&gt;I might say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\phi\rangle=\frac{1}{\sqrt 2}(\vert 0_A0_B0_C\rangle +\vert 1_A0_B1_C\rangle)= \frac{1}{\sqrt 2}(\vert 0_A0_C\rangle +\vert 1_A1_C\rangle)\otimes \vert 0_B\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;because I think that might be intuitively understandable without much parsing. It also might help to label each qubit if I have to give the qubits to Alice, Bob, and Charlie later on.&lt;/p&gt;&#xA;&lt;p&gt;Another option might be to consider adding wildcards.  For example I might say:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$\vert\phi\rangle=\frac{1}{\sqrt 2}(\vert 000\rangle +\vert 101\rangle)= \frac{1}{\sqrt 2}(\vert 0.0\rangle +\vert 1.1\rangle)\otimes \vert .0.\rangle,$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;but there I’d have to define my convention appropriately.&lt;/p&gt;&#xA;" OwnerUserId="2927" LastEditorUserId="2927" LastEditDate="2021-05-27T13:57:13.117" LastActivityDate="2021-05-27T13:57:13.117" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17662" PostTypeId="1" AcceptedAnswerId="17667" CreationDate="2021-05-27T04:40:16.233" Score="2" ViewCount="60" Body="&lt;p&gt;From &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.Grover.html?highlight=grover#qiskit.aqua.algorithms.Grover&quot; rel=&quot;nofollow noreferrer&quot;&gt;Qiskit document&lt;/a&gt;, the &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Statevector.html?highlight=statevector#qiskit.quantum_info.Statevector&quot; rel=&quot;nofollow noreferrer&quot;&gt;Statevector&lt;/a&gt; can be used to specify the oracle of Grover Search. After seeing the &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/quantum_info/states/statevector.html#Statevector&quot; rel=&quot;nofollow noreferrer&quot;&gt;source code&lt;/a&gt; of the operators, it seems a statevector is converted to a rank-1 projector operator. In this case, the operator may not be unitary.&lt;/p&gt;&#xA;&lt;p&gt;The code below can be run on a real IBMQ machine.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit import *&#xA;from qiskit.quantum_info import Statevector&#xA;from qiskit.aqua.algorithms import Grover&#xA;from qiskit import QuantumCircuit&#xA;&#xA;oracle = Statevector([0,0,0,0,0,1,1,0])&#xA;good_state = ['110','101']&#xA;grover = Grover(oracle=oracle, good_state=good_state)&#xA;# backend = provider.get_backend('ibmq_lima')&#xA;backend = BasicAer.get_backend('qasm_simulator')&#xA;result = grover.run(quantum_instance=backend)&#xA;print('Result type:', type(result))&#xA;print()&#xA;print('Success!' if result.oracle_evaluation else 'Failure!')&#xA;print('Top measurement:', result)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;However, it does not make sense to me because the operator here is not unitary.&#xA;&lt;a href=&quot;https://i.stack.imgur.com/cmnNO.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cmnNO.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am wondering if Statevector of Qiskit has actual speed up or it is just for illustration of Grover Search. Besides, how does it realize when the operator is not unitary?&lt;/p&gt;&#xA;" OwnerUserId="15928" LastEditorUserId="15928" LastEditDate="2021-05-27T12:56:55.193" LastActivityDate="2021-05-27T12:56:55.193" Title="Does Qiskit Statevector has actual speed up for Grover Search?" Tags="&lt;qiskit&gt;&lt;grovers-algorithm&gt;&lt;quantum-circuit&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17663" PostTypeId="1" AcceptedAnswerId="17665" CreationDate="2021-05-27T05:12:34.213" Score="3" ViewCount="75" Body="&lt;p&gt;I am trying to implement VQE from the Qiskit to obtain the ground state of a very specific Hamiltonian that has been generated via a &lt;code&gt;docplex&lt;/code&gt; minimized quadratic model. The model has been converted to an Ising Hamiltonian using Qiskit's Optimization module. The resultant Hamiltonian denoted by &lt;code&gt;H&lt;/code&gt; is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.providers.aer import AerSimulator, QasmSimulator&#xA;from qiskit.algorithms import VQE&#xA;from qiskit.algorithms.optimizers import COBYLA &#xA;from qiskit.circuit.library import TwoLocal&#xA;from qiskit import *&#xA;from qiskit.opflow import OperatorBase&#xA;from qiskit.opflow import Z, X, I  # Pauli Z, X matrices and identity&#xA;import pylab&#xA;import matplotlib.pyplot as plt&#xA;import numpy as np&#xA;&#xA;H =   504.0 * I^I^I^I^I^I^I^Z+1008.0 * I^I^I^I^I^I^Z^I+2016.0 * I^I^I^I^I^Z^I^I+504.0 * I^I^I^I^Z^I^I^I+1143.7999999999997 * I^I^I^Z^I^I^I^I+2287.6 * I^I^Z^I^I^I^I^I+4575.200000000001 * I^Z^I^I^I^I^I^I+1143.7999999999997 * Z^I^I^I^I^I^I^I+98.0 * I^I^I^I^I^I^Z^Z+196.0 * I^I^I^I^I^Z^I^Z+392.0 * I^I^I^I^I^Z^Z^I+49.0 * I^I^I^I^Z^I^I^Z+98.0 * I^I^I^I^Z^I^Z^I+196.0 * I^I^I^I^Z^Z^I^I+93.1 * I^I^Z^Z^I^I^I^I+186.2 * I^Z^I^Z^I^I^I^I+372.4 * I^Z^Z^I^I^I^I^I+46.55 * Z^I^I^Z^I^I^I^I+93.1 * Z^I^Z^I^I^I^I^I+186.2 * Z^Z^I^I^I^I^I^I&#xA;&#xA;backend = QasmSimulator()&#xA;optimizer = COBYLA(maxiter=2000)&#xA;ansatz = TwoLocal(num_qubits=8, rotation_blocks='ry', entanglement_blocks=None, entanglement='full', reps=1, skip_unentangled_qubits=False, skip_final_rotation_layer=False)&#xA;# set the algorithm&#xA;vqe = VQE(ansatz, optimizer, quantum_instance=backend)&#xA;&#xA;#run it with the Hamiltonian we defined above&#xA;result = vqe.compute_minimum_eigenvalue(H) &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This however yields the error:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;'Circuit execution failed: ERROR:  [Experiment 0] QasmSimulator: Insufficient memory for 141-qubit circuit using &amp;quot;statevector&amp;quot; method. You could try using the &amp;quot;matrix_product_state&amp;quot; or &amp;quot;extended_stabilizer&amp;quot; method instead.'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My questions are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;How and why does my circuit yield &lt;strong&gt;141 qubits&lt;/strong&gt; when there are only &lt;strong&gt;8 Pauli Operators&lt;/strong&gt; in each term of my Hamiltonian? What am I missing conceptually?&lt;/li&gt;&#xA;&lt;li&gt;How do we calculate the number of qubits required when solving this sort of problem?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="8989" LastEditorUserId="9006" LastEditDate="2021-05-27T05:16:42.033" LastActivityDate="2021-05-27T06:45:37.443" Title="What explains my anomalously scaled up VQE?" Tags="&lt;qiskit&gt;&lt;vqe&gt;&lt;optimization&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17664" PostTypeId="2" ParentId="17650" CreationDate="2021-05-27T05:42:41.227" Score="0" Body="&lt;p&gt;Assume that you have a control qubit with index 0, then &lt;span class=&quot;math-container&quot;&gt;$l$&lt;/span&gt; qubits does not interact with a gate and &lt;span class=&quot;math-container&quot;&gt;$l+1$&lt;/span&gt;th qubit is a target qubit (e.g. having three qubits, 0 is the control, 1 is &lt;em&gt;idle&lt;/em&gt; and 2 is the target). Let's denote &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; a single qubit gate acting on the target qubit if the control is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N=2^{l+2}$&lt;/span&gt;. Then a matrix description of such gate is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;I_{N/2} &amp;amp; O_{N/2} \\&#xA;O_{N/2} &amp;amp; I_{N/4} \otimes U&#xA;\end{pmatrix},&#xA;$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I_{N/2}$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$I_{N/4}$&lt;/span&gt; are identity matrices of order &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$N/4$&lt;/span&gt; respectively and &lt;span class=&quot;math-container&quot;&gt;$O_{N/2}$&lt;/span&gt; is zero matrix of order &lt;span class=&quot;math-container&quot;&gt;$N/2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Based on the matrix above, you can infer, how your controlled gate with non-adjacent qubits works.&lt;/p&gt;&#xA;&lt;p&gt;For example, lets take CNOT gate with control qubit 0, idle (or non-used) qubit 1 and target qubit 2. In this case &lt;span class=&quot;math-container&quot;&gt;$l=1$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$N=8$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$U=X=\begin{pmatrix}0 &amp;amp; 1 \\ 1 &amp;amp; 0\end{pmatrix}$&lt;/span&gt;, hence the matrix describing such gate is&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{pmatrix}&#xA;1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 \\&#xA;0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \\&#xA;\end{pmatrix}.&#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Based on the matrix, you can see that states &lt;span class=&quot;math-container&quot;&gt;$|0xy\rangle$&lt;/span&gt; are left unchanged as the control qubit is in state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;. If the control qubit is &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; then the gate works followingly:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|100\rangle \rightarrow |101\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|101\rangle \rightarrow |100\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|110\rangle \rightarrow |111\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|111\rangle \rightarrow |110\rangle$&lt;/span&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As you can see the middle qubit remains unchanged. This means that the gate works only with qubits 0 and 2.&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-05-27T05:42:41.227" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17665" PostTypeId="2" ParentId="17663" CreationDate="2021-05-27T06:27:04.123" Score="3" Body="&lt;h3&gt;Easy Fix:&lt;/h3&gt;&#xA;&lt;p&gt;It seems like it is because of the way you define &lt;span class=&quot;math-container&quot;&gt;$H$&lt;/span&gt;. You &lt;strong&gt;need the parenthesis&lt;/strong&gt; around each of the term!&lt;/p&gt;&#xA;&lt;p&gt;So something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;H =    (504.0 * I^I^I^I^I^I^I^Z) + (1008.0 * I^I^I^I^I^I^Z^I) + ( 2016.0 *  I^I^I^I^I^Z^I^I)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Just replace this in your code then it will work!&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;h3&gt;Alternative (longer) way:&lt;/h3&gt;&#xA;&lt;p&gt;Here I will offer another way to define the Hamiltonian in case you are curious. Instead of doing the above, if you replace it with something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;from qiskit.aqua.operators import *&#xA;pauli_terms = ['IIIIIIIZ', 'IIIIIIZI', 'IIIIIZII' ]&#xA;pauli_weights = [504.0, 1008.0, 2016.0]&#xA;pauli_dict = {'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0., &amp;quot;real&amp;quot;: pauli_weights[i] }, &amp;quot;label&amp;quot;: pauli_terms[i]} \&#xA;                         for i in range(len(pauli_terms))]}&#xA;H = WeightedPauliOperator.from_dict(pauli_dict)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This should work. I just grabbed the first 3 entries of your Hamiltonian. Here is the full script for you to reproduce the result:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.providers.aer import AerSimulator, QasmSimulator&#xA;from qiskit.algorithms.optimizers import COBYLA &#xA;from qiskit.circuit.library import TwoLocal&#xA;from qiskit.aqua.operators import *&#xA;from qiskit.aqua import set_qiskit_aqua_logging, QuantumInstance&#xA;from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE, NumPyEigensolver&#xA;from qiskit.circuit import QuantumCircuit, ParameterVector&#xA;&#xA;pauli_terms = ['IIIIIIIZ', 'IIIIIIZI', 'IIIIIZII' ]&#xA;pauli_weights = [504.0, 1008.0, 2016.0]&#xA;pauli_dict = {'paulis': [{&amp;quot;coeff&amp;quot;: {&amp;quot;imag&amp;quot;: 0., &amp;quot;real&amp;quot;: pauli_weights[i] }, &amp;quot;label&amp;quot;: pauli_terms[i]} \&#xA;                         for i in range(len(pauli_terms))]}&#xA;Hamiltonian = WeightedPauliOperator.from_dict(pauli_dict)&#xA;ansatz = TwoLocal(num_qubits=8, rotation_blocks='ry', entanglement_blocks=None, entanglement='full', reps=1, skip_unentangled_qubits=False, skip_final_rotation_layer=False)&#xA;print(ansatz)&#xA;backend = QasmSimulator()&#xA;quantum_instance = QuantumInstance(backend,&#xA;                                   shots = 8192,&#xA;                                   initial_layout = None,&#xA;                                   optimization_level = 3)  &#xA;&#xA;optimizer = COBYLA(maxiter= 100, tol=0.000000001)   &#xA;vqe = VQE(Hamiltonian, ansatz, optimizer, initial_point= None , include_custom = False)&#xA;print('We are using:', quantum_instance.backend)&#xA;vqe_result = vqe.run(quantum_instance)&#xA;vqe_result['eigenvalue']&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;     ┌──────────┐ ┌──────────┐&#xA;q_0: ┤ RY(θ[0]) ├─┤ RY(θ[8]) ├&#xA;     ├──────────┤ ├──────────┤&#xA;q_1: ┤ RY(θ[1]) ├─┤ RY(θ[9]) ├&#xA;     ├──────────┤┌┴──────────┤&#xA;q_2: ┤ RY(θ[2]) ├┤ RY(θ[10]) ├&#xA;     ├──────────┤├───────────┤&#xA;q_3: ┤ RY(θ[3]) ├┤ RY(θ[11]) ├&#xA;     ├──────────┤├───────────┤&#xA;q_4: ┤ RY(θ[4]) ├┤ RY(θ[12]) ├&#xA;     ├──────────┤├───────────┤&#xA;q_5: ┤ RY(θ[5]) ├┤ RY(θ[13]) ├&#xA;     ├──────────┤├───────────┤&#xA;q_6: ┤ RY(θ[6]) ├┤ RY(θ[14]) ├&#xA;     ├──────────┤├───────────┤&#xA;q_7: ┤ RY(θ[7]) ├┤ RY(θ[15]) ├&#xA;     └──────────┘└───────────┘&#xA;We are using: qasm_simulator&#xA;&#xA;(-3528+0j)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Although I am not sure why you would have two consecutive layers of &lt;span class=&quot;math-container&quot;&gt;$RY$&lt;/span&gt; rotation though.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastEditorUserId="9858" LastEditDate="2021-05-27T06:45:37.443" LastActivityDate="2021-05-27T06:45:37.443" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17666" PostTypeId="1" CreationDate="2021-05-27T06:30:34.517" Score="1" ViewCount="48" Body="&lt;p&gt;How do you implement any &lt;span class=&quot;math-container&quot;&gt;$d$&lt;/span&gt;-dimensional qudit circuit in qiskit using qubits to simulate on an actual quantum computer?&lt;/p&gt;&#xA;" OwnerUserId="16036" LastEditorUserId="16036" LastEditDate="2021-05-28T14:28:14.783" LastActivityDate="2021-05-28T14:28:14.783" Title="Implementing quDit algorithms in Qiskit using quBit" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;qudit&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17667" PostTypeId="2" ParentId="17662" CreationDate="2021-05-27T08:06:40.690" Score="3" Body="&lt;p&gt;The reason for this is that the actual oracle used in the algorithm is not obtained from &lt;code&gt;oracle.to_operator()&lt;/code&gt;. If you look up &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/amplitude_amplifiers/grover.html#Grover&quot; rel=&quot;nofollow noreferrer&quot;&gt;the code&lt;/a&gt; for Grover's algorithm, you can see the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;grover_operator = GroverOperator(oracle=oracle,&#xA;                                 state_preparation=state_preparation,&#xA;                                 reflection_qubits=reflection_qubits,&#xA;                                 mcx_mode=mct_mode)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then, you can take a look at the &lt;a href=&quot;https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/library/grover_operator.py#L183&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;code&gt;GroverOperator&lt;/code&gt; source code&lt;/a&gt; to find the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if isinstance(oracle, Statevector):&#xA;    from qiskit.circuit.library import Diagonal  # pylint: disable=cyclic-import&#xA;    oracle = Diagonal((-1) ** oracle.data)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What this does is explained in the documentation: it builds a diagonal matrix whose entries on the diagonal are all equal to &lt;span class=&quot;math-container&quot;&gt;$(-1)^{x_i}$&lt;/span&gt;, where the &lt;span class=&quot;math-container&quot;&gt;$x_i$&lt;/span&gt; are the entries of your &lt;code&gt;Statevector&lt;/code&gt;. In your case, those entries on the diagonal will all be equal to &lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt; except for the ones corresponding to the states &lt;span class=&quot;math-container&quot;&gt;$|101\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|110\rangle$&lt;/span&gt; which will be equal to &lt;span class=&quot;math-container&quot;&gt;$-1$&lt;/span&gt;. You can easily see that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;This operator is unitary&lt;/li&gt;&#xA;&lt;li&gt;This operator flips the good states as it is supposed to&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Since it is used for initialiazing the Grover's algorithm, I don't think it has any kind of speedup when compared to more &amp;quot;traditional&amp;quot; initialisation methods.&lt;/p&gt;&#xA;" OwnerUserId="10454" LastEditorUserId="10454" LastEditDate="2021-05-27T11:26:16.523" LastActivityDate="2021-05-27T11:26:16.523" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17668" PostTypeId="1" CreationDate="2021-05-27T10:14:01.273" Score="3" ViewCount="131" Body="&lt;p&gt;In Aaronson's paper about the efficient simulation of a stabilizer circuit&#xA;(&lt;a href=&quot;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.70.052328&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://journals.aps.org/pra/pdf/10.1103/PhysRevA.70.052328&lt;/a&gt;),&#xA;I have a problem with finding the reason why the following statement holds.&#xA;Restating the statement in the end of the 4th page of the paper,&#xA;Let &lt;span class=&quot;math-container&quot;&gt;$\{R_{h+n}\}$&lt;/span&gt; with &lt;span class=&quot;math-container&quot;&gt;$h=1...n$&lt;/span&gt; are the Pauli stabilizer of a state &lt;span class=&quot;math-container&quot;&gt;$|{\psi}\rangle$&lt;/span&gt;.&#xA;If &lt;span class=&quot;math-container&quot;&gt;$Z_a$&lt;/span&gt; commutes with all of &lt;span class=&quot;math-container&quot;&gt;$\{R_{h+n}\}$&lt;/span&gt;, then&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\sum_{h=1}^n c_hR_{n+h} = \pm Z_a$$&lt;/span&gt;&#xA;for a unique choice of &lt;span class=&quot;math-container&quot;&gt;$c_1 \dots c_n \in {0,1}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;But for &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle=|11\rangle$&lt;/span&gt;, we have stabilizers of &lt;span class=&quot;math-container&quot;&gt;${II, ZZ}$&lt;/span&gt; only, and its combination can make neither of single-qubit &lt;span class=&quot;math-container&quot;&gt;$Z$&lt;/span&gt; gate.&lt;/p&gt;&#xA;&lt;p&gt;If I have misunderstood, I will be very appreciative if you can correct it.&#xA;Thank you in advance.&lt;/p&gt;&#xA;" OwnerUserId="16040" LastActivityDate="2021-05-27T10:34:16.337" Title="A question from Aaronson 2004 paper" Tags="&lt;mathematics&gt;&lt;pauli-gates&gt;&lt;stabilizer-code&gt;&lt;clifford-group&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17669" PostTypeId="2" ParentId="17668" CreationDate="2021-05-27T10:34:16.337" Score="5" Body="&lt;p&gt;The terms &lt;span class=&quot;math-container&quot;&gt;$II$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$ZZ$&lt;/span&gt; do not uniquely specify the state &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; because you could equally have the state &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;. Indeed, you should not include the identity term in your stabilizer. Thus, you need to add a second term, which could be either &lt;span class=&quot;math-container&quot;&gt;$-ZI$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$-IZ$&lt;/span&gt;. Either way, you can easily see how to make a product &lt;span class=&quot;math-container&quot;&gt;$-ZI$&lt;/span&gt; out of your stabilizers.&lt;/p&gt;&#xA;" OwnerUserId="1837" LastActivityDate="2021-05-27T10:34:16.337" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17670" PostTypeId="2" ParentId="17537" CreationDate="2021-05-27T11:02:57.267" Score="2" Body="&lt;h4&gt;Nonclassicality in general&lt;/h4&gt;&#xA;&lt;p&gt;I should start by pointing out that there is no univocal notion of &amp;quot;(non)classicality&amp;quot;. To name a few examples, in the context of quantum optics one might call a state &amp;quot;nonclassical&amp;quot; if it cannot be written as a convex combination of coherent states. Or when entanglement is involved you might call &amp;quot;nonclassical&amp;quot; an entangled state. In the context of nonlocality, you might call &amp;quot;nonclassical&amp;quot; a probability distribution that cannot be reproduced by local hidden variable theories.&lt;/p&gt;&#xA;&lt;p&gt;The type of (non)classicality discussed in this paper is thus a specific one that is suited for the context at hand. While certainly in the spirit of nonclassicality as discussed in the context of Bell nonlocality, it is not exactly the same idea I think. The point seems here to rule out the possibility that the observed correlations cannot be explained by Alice simply sending a classical message to Bob. More details below.&lt;/p&gt;&#xA;&lt;h4&gt;Very rough summary of the context&lt;/h4&gt;&#xA;&lt;p&gt;The setup consists of Alice preparing a state and Bob measuring it.&#xA;Alice chooses the value of some index &lt;span class=&quot;math-container&quot;&gt;$i\in[1,M]$&lt;/span&gt;, and sends a state &lt;span class=&quot;math-container&quot;&gt;$\rho_{i,\lambda}$&lt;/span&gt; accordingly. Here &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; denotes a hidden variable; this is added to take into account the possibility of Alice and Bob being classically correlated beforehand.&#xA;Bob then performs some measurement corresponding to a POVM &lt;span class=&quot;math-container&quot;&gt;$\Pi_{k,\lambda}$&lt;/span&gt;, for some &lt;span class=&quot;math-container&quot;&gt;$k\in[1,K]$&lt;/span&gt; he decides, and gets an outcome &lt;span class=&quot;math-container&quot;&gt;$j\in[1,N]$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Repeating the above procedure a number of times, they collect the associated statistics, in the form of the conditional probabilities &lt;span class=&quot;math-container&quot;&gt;$p_{j|i,k}$&lt;/span&gt;. These conditional probabilities are the main subject of the discussion.&lt;/p&gt;&#xA;&lt;p&gt;They call these correlations &amp;quot;classical&amp;quot; if, roughly speaking, they can be written as &lt;span class=&quot;math-container&quot;&gt;$p_{j|i,k}=\operatorname{Tr}[\rho_i\Pi^j_k]$&lt;/span&gt; for some &amp;quot;classical set of states&amp;quot; &lt;span class=&quot;math-container&quot;&gt;$\{\rho_i\}_i$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;h4&gt;So... why commuting states?&lt;/h4&gt;&#xA;&lt;p&gt;I think the point of this definition is that if the states commute then there is no need for Alice to actually send &lt;em&gt;quantum states&lt;/em&gt; to Bob. She might as well just send a classical message. Indeed, the authors point out after Lemma 1 that&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;em&gt;Lemma 1 thus proves that every set of probabilities obtained with commuting states can be performed with classical states and classical POVMs. This clearly implies that commuting states may be equally regarded as classical variables, and commuting-element measurements as read-out of classical variables.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;A possible argument to see why this is the case, loosely inspired by the proof of Lemma 1 (though in fairness I haven't really read the paper or the lemma in depth), is the following.&#xA;If the states are pairwise commuting, &lt;span class=&quot;math-container&quot;&gt;$[\rho_i,\rho_j]=0$&lt;/span&gt;, then they can be simultaneously diagonalised:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho_i = \sum_\ell \lambda_{i\ell}|\ell\rangle\!\langle \ell|,$$&lt;/span&gt;&#xA;for some &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i\ell}\ge0$&lt;/span&gt; and an orthonormal basis &lt;span class=&quot;math-container&quot;&gt;$\{|\ell\rangle\}_\ell$&lt;/span&gt;. We then have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$p_{j|i,k}=\operatorname{Tr}[\rho_i \Pi^j_k]&#xA;= \sum_\ell \lambda_{i\ell} \langle \ell|\Pi^j_k|\ell\rangle.$$&lt;/span&gt;&#xA;What this is telling you is that, to reproduce the correlation, it is enough for Alice to send a classical message, and more specifically the value of &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;, to Bob's device. Bob's device will then sample one of the (fixed beforehand) states &lt;span class=&quot;math-container&quot;&gt;$|\ell\rangle$&lt;/span&gt;, with probabilities &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i\ell}$&lt;/span&gt;, and measure it with the POVM &lt;span class=&quot;math-container&quot;&gt;$\{\Pi^j_k\}_j$&lt;/span&gt;, obtaining an outcome &lt;span class=&quot;math-container&quot;&gt;$j$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, Alice presses the button &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$i=1$&lt;/span&gt;&amp;quot;. Her box sends a classical message saying &amp;quot;1&amp;quot; to Bob's box. Bob's box is then programmed to pick one of the states &lt;span class=&quot;math-container&quot;&gt;$|\ell\rangle$&lt;/span&gt;. More specifically, it will pick the state &lt;span class=&quot;math-container&quot;&gt;$|\ell\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$\lambda_{i\ell}$&lt;/span&gt; (again, these probabilities will have been chosen beforehand, when the boxes were calibrated). Say the box picks the value &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$\ell=3$&lt;/span&gt;&amp;quot;. Now, if Bob presses the button &amp;quot;&lt;span class=&quot;math-container&quot;&gt;$k=2$&lt;/span&gt;&amp;quot;, his Box will perform the measurement corresponding to the POVM &lt;span class=&quot;math-container&quot;&gt;$\{\Pi_2^j\}_j$&lt;/span&gt; on the state &lt;span class=&quot;math-container&quot;&gt;$|3\rangle$&lt;/span&gt;. The result will be some value of &lt;span class=&quot;math-container&quot;&gt;$j\in[1,N]$&lt;/span&gt;. Say &lt;span class=&quot;math-container&quot;&gt;$j=36\le N$&lt;/span&gt;.&#xA;Repeating this circus an &amp;quot;infinite&amp;quot; number of times, Alice and Bob will collect the results and find the correct values of the conditional probabilities &lt;span class=&quot;math-container&quot;&gt;$p_{j|i,k}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;When this type of thing is possible, then we say that the correlations &lt;span class=&quot;math-container&quot;&gt;$p_{j|i,k}$&lt;/span&gt; are &amp;quot;classical&amp;quot;, in the sense that no actual quantum states needed to be exchanged to get it.&lt;/p&gt;&#xA;" OwnerUserId="55" LastActivityDate="2021-05-27T11:02:57.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17671" PostTypeId="2" ParentId="17591" CreationDate="2021-05-27T11:23:55.287" Score="3" Body="&lt;p&gt;When non-computational states are unintentionally populated, this is called leakage, and it is one of the leading sources of error in transmon qubits.  Originally, the transmon emerged from an earlier design called the Cooper-pair box, which suffered from charge noise.  By adding a large shunt capacitor, the sensitivity of the device to charge noise was greatly reduced, at the expense of lowering the anharmonicity.  The anharmonicity is the difference between the 1-2 energy level spacing to the 0-1 energy level spacing.  A perfect two-level system has infinite anharmonicity (the next accessible level is infinitely far away from the computational space, so there is no chance of leakage), and the worst possible &amp;quot;two&amp;quot;-level system has 0 anharmonicity (one example is a harmonic oscillator).  Transmon qubit frequencies are usually a couple GHz, while their anharmonicities are a couple hundred MHz (and negative, which means &lt;span class=&quot;math-container&quot;&gt;$|2\rangle$&lt;/span&gt; is closer to &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; than &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Leakage errors might arise from making single-qubit drive pulses too fast, leading to wide spectral signatures that overlap with the 1-2 energy spacing (one way to combat this is with &lt;a href=&quot;https://arxiv.org/pdf/0901.0534.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;DRAG pulses&lt;/a&gt;, or with &lt;a href=&quot;https://arxiv.org/pdf/2003.05952.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;direct optimization&lt;/a&gt; of the pulse waveform).  They could also occur from diabatic errors during ideally adiabatic 2-qubit gates (see Section IV.F.I of &lt;a href=&quot;https://arxiv.org/pdf/1904.06560.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for a summary, and &lt;a href=&quot;https://arxiv.org/abs/1402.5467&quot; rel=&quot;nofollow noreferrer&quot;&gt;this paper&lt;/a&gt; for a solution using Slepian pulses).  Leakage errors also are problematic in quantum error-correction, because they are not correctable within the standard framework of the theory.  Thus, there has also been work on &lt;a href=&quot;https://arxiv.org/pdf/1412.4126.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;characterizing&lt;/a&gt; and &lt;a href=&quot;https://arxiv.org/pdf/2102.08336.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;mitigating&lt;/a&gt; their effects within that context.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-05-27T11:23:55.287" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17672" PostTypeId="1" CreationDate="2021-05-27T11:26:19.953" Score="1" ViewCount="74" Body="&lt;p&gt;I'm currently reading this paper &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0403062&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0403062&lt;/a&gt; but I fail to understand how the input of the control qubit affects the output of the target qubit. I do understand that when the logical value of the control qubit channel is &lt;span class=&quot;math-container&quot;&gt;$\vert 0\rangle$&lt;/span&gt; the qubit in the channel of the target qubit is not affected. But I don't see how does the gate work when the control and target qubit have a logical value of &lt;span class=&quot;math-container&quot;&gt;$\vert 1\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="16041" LastEditorUserId="2927" LastEditDate="2021-05-27T20:36:23.957" LastActivityDate="2021-05-27T20:36:23.957" Title="In (O'Brien et al. 2004), why is the target qubit not affected when the control is $\vert 0\rangle$?" Tags="&lt;quantum-gate&gt;&lt;quantum-optics&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17673" PostTypeId="2" ParentId="17666" CreationDate="2021-05-27T13:08:35.043" Score="1" Body="&lt;p&gt;It seems this is available via the classes &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.Statevector.html?highlight=qudit&quot; rel=&quot;nofollow noreferrer&quot;&gt;Statevector&lt;/a&gt; and &lt;a href=&quot;https://qiskit.org/documentation/stubs/qiskit.quantum_info.DensityMatrix.html?highlight=qudit&quot; rel=&quot;nofollow noreferrer&quot;&gt;DensityMatrix&lt;/a&gt;. For StateVector, the example from the documentation :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.quantum_info import Statevector&#xA;&#xA;vec = np.zeros(2 * 10)&#xA;vec[0] = 1 / np.sqrt(2)&#xA;vec[-1] = 1 / np.sqrt(2)&#xA;psi = Statevector(vec, dims=(2, 10))&#xA;print(psi.to_dict())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And for DensityMatrix :&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import numpy as np&#xA;from qiskit.quantum_info import DensityMatrix&#xA;&#xA;mat = np.zeros((2 * 10, 2 * 10))&#xA;mat[0, 0] = 0.5&#xA;mat[-1, -1] = 0.5&#xA;rho = DensityMatrix(mat, dims=(2, 10))&#xA;print(rho.to_dict())&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="12396" LastActivityDate="2021-05-27T13:08:35.043" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17674" PostTypeId="2" ParentId="17654" CreationDate="2021-05-27T14:19:55.917" Score="0" Body="&lt;p&gt;There's a bunch of single Clifford gate &lt;em&gt;types&lt;/em&gt; that you can use.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_y(\theta) = \sqrt{X} \sqrt{X} \sqrt{X} R_z(\theta) \sqrt{X}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\sqrt{X} = HSH$&lt;/span&gt; is a 90 degree rotation around X.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_y(\theta) = C_{XYZ} R_z(\theta) C_{XYZ} C_{XYZ}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$C_{XYZ} = (iI + X + Y + Z)/2$&lt;/span&gt; is a 120 degree rotation around X+Y+Z.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_y(\theta) = H_{YZ} R_z(\theta) H_{YZ}$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$H_{YZ} = (Y + Z)/\sqrt{2}$&lt;/span&gt; is a 180 degree rotation around Y+Z.&lt;/p&gt;&#xA;&lt;p&gt;There's no Clifford gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; with the property that &lt;span class=&quot;math-container&quot;&gt;$U R_z(\theta)$&lt;/span&gt; = &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt;. This is obvious because &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; basis interactions should commute with &lt;span class=&quot;math-container&quot;&gt;$R_y(\theta)$&lt;/span&gt; but when crossing &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt; over &lt;span class=&quot;math-container&quot;&gt;$U R_z(\theta)$&lt;/span&gt; the &lt;span class=&quot;math-container&quot;&gt;$R_z(\theta)$&lt;/span&gt; moves the &lt;span class=&quot;math-container&quot;&gt;$Y$&lt;/span&gt;'s rotation axis to something arbitrary (not a Clifford operation anymore) and a Clifford &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; can't get it back to where it should be.&lt;/p&gt;&#xA;&lt;p&gt;You can also do it with two qubit gates. E.g. if you have an ancilla in the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; state:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$R_{Y_{target}}(\theta) = \text{Control}(Y_{target}, X_{ancilla}) R_{Z_{ancilla}}(\theta) \text{Control}(Y_{target}, X_{ancilla})$&lt;/span&gt; where &lt;span class=&quot;math-container&quot;&gt;$\text{Control}(Y, X)$&lt;/span&gt; applies an X to the target when the control is in the &lt;span class=&quot;math-container&quot;&gt;$|-i\rangle$&lt;/span&gt; state.&lt;/p&gt;&#xA;" OwnerUserId="119" LastEditorUserId="119" LastEditDate="2021-05-27T15:04:00.273" LastActivityDate="2021-05-27T15:04:00.273" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17675" PostTypeId="5" CreationDate="2021-05-27T15:33:36.267" Score="0" Body="" OwnerUserId="-1" LastEditorUserId="-1" LastEditDate="2021-05-27T15:33:36.267" LastActivityDate="2021-05-27T15:33:36.267" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17676" PostTypeId="4" CreationDate="2021-05-27T15:33:36.267" Score="0" Body="Errors in different papers." OwnerUserId="13968" LastEditorUserId="13968" LastEditDate="2021-05-28T10:43:44.827" LastActivityDate="2021-05-28T10:43:44.827" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17677" PostTypeId="1" CreationDate="2021-05-27T17:30:51.110" Score="6" ViewCount="178" Body="&lt;p&gt;IBM Quantum Experience and other Algorithm Creators generally draw the CZ gates like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l5D1E.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l5D1E.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Does it not matter which qubit is the control and which is the target? If so why?&lt;/p&gt;&#xA;" OwnerUserId="14999" LastActivityDate="2021-05-27T18:20:28.030" Title="Does control and target matter in the CZ (Controlled-Z) Gate?" Tags="&lt;quantum-gate&gt;&lt;quantum-control&gt;" AnswerCount="1" CommentCount="4" ClosedDate="2021-05-28T23:55:31.830" ContentLicense="CC BY-SA 4.0" />
  <row Id="17678" PostTypeId="1" CreationDate="2021-05-27T18:09:00.383" Score="4" ViewCount="22" Body="&lt;p&gt;Stabilizer codes can be treated as symplectic codes over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_2$&lt;/span&gt; (or over &lt;span class=&quot;math-container&quot;&gt;$\mathbb{F}_p$&lt;/span&gt; when taking about q-dits). While treating error class, symplectic dual of the code plays a crucial part (Normlizer of the stabilizer if we wish to talk in group theoretic terms).&#xA;For classical hamming codes, given a code in either parity check form or generator matrix form, it is quiet easy to calculate corresponding forms for the dual.&#xA;Is there an efficient (preferably classical) algorithm to compute this for symplectic code?&lt;/p&gt;&#xA;" OwnerUserId="8132" LastActivityDate="2021-05-27T18:09:00.383" Title="Calculating symplectic dual of a code" Tags="&lt;algorithm&gt;&lt;error-correction&gt;&lt;clifford-group&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17679" PostTypeId="2" ParentId="17677" CreationDate="2021-05-27T18:20:28.030" Score="9" Body="&lt;p&gt;First, note that the Controlled-X gate can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CX = |0\rangle \langle 0| \otimes I +  |1 \rangle \langle 1| \otimes X $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;This tells us that the &lt;strong&gt;first qubit is the controlled&lt;/strong&gt;, and the &lt;strong&gt;second qubit is the target&lt;/strong&gt;. And when the controlled qubit is &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; we do nothing hence the Idenity operator. When the controlled-qubit is a &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; we apply the &lt;span class=&quot;math-container&quot;&gt;$X$&lt;/span&gt; operator. So when you look at &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; gate you see something like:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/TKm0f.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/TKm0f.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;to indicate that the first qubit is the controlled and the second is the target since it matters. Also note that &lt;span class=&quot;math-container&quot;&gt;$CX$&lt;/span&gt; has the matrix representation in the compuational basis as:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CX= \begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 \end{pmatrix} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;Now, if you look at the the controlled-Z (&lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt;) gate matrix representation in the computational basis, you will see:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;CZ = \begin{pmatrix}1 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\ 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; -1 \end{pmatrix} &#xA;$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;But note that this can be written as:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$ CZ = |0\rangle \langle0| \otimes I + |1\rangle\langle1|\otimes Z = I \otimes |0\rangle\langle0| + Z \otimes |1\rangle\langle1| $$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;what this tells us is that it's symmetric... it doesn't matter which qubit is the controlled or target. So why not just create a controlled gate with both being the controlled qubits... that is why you see &lt;span class=&quot;math-container&quot;&gt;$CZ$&lt;/span&gt; usually shown as;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/xazop.png&quot; rel=&quot;noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xazop.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-27T18:20:28.030" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17680" PostTypeId="1" CreationDate="2021-05-27T18:25:17.593" Score="2" ViewCount="20" Body="&lt;p&gt;I am trying to create a portfolio optimization with the DWave Quantum Computer. I wrote some code trying to somehow reconstruct the following Ising model &lt;a href=&quot;https://www.osti.gov/servlets/purl/1423041&quot; rel=&quot;nofollow noreferrer&quot;&gt;paper&lt;/a&gt;:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/LRYMK.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/LRYMK.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/Nni1A.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/Nni1A.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/V0bKC.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/V0bKC.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&#xA;&lt;a href=&quot;https://i.stack.imgur.com/xzYas.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/xzYas.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;Ai&lt;/code&gt; is the maximum amount of money that can be invested in the i-th asset.&#xA;&lt;code&gt;B&lt;/code&gt; is the total budget.&#xA;&lt;code&gt;Ri&lt;/code&gt; denote the random variable representing the return from asset i.&lt;/p&gt;&#xA;&lt;p&gt;This is how I tried to code it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    import datetime&#xA;    import pandas as pd&#xA;    import fix_yahoo_finance as yf&#xA;    import pandas_datareader.data as web&#xA;    import numpy as np&#xA;    import neal&#xA;    import dimod&#xA;    from dwave.system import DWaveSampler&#xA;    import random&#xA;    import hybrid&#xA;    &#xA;    def cov(a,b):&#xA;        return a.cov(b)&#xA;    &#xA;    def hi(price, returns, cov):&#xA;        #mean price&#xA;        Ai = np.mean(price)&#xA;    &#xA;        #mean expected return&#xA;        E = np.mean(returns)&#xA;    &#xA;        # hi = -(1/2)((1/3)*cov(Ri,Rj) + (1/3)Ai^2 - (1/3)E(Ri) - 2B(1/3)*Ai)&#xA;        h = (-(1/2)*((1/3)*cov + (1/3)* (Ai ** 2) - (1/3)* E - 2*100*(1/3)*Ai))&#xA;        return h&#xA;    &#xA;    yf.pdr_override()&#xA;    &#xA;    start = datetime.datetime(2018,1,3)       &#xA;    end = datetime.datetime(2021,1,1)&#xA;    all_data = {ticker: web.get_data_yahoo(ticker,start,end)&#xA;              for ticker in ['AAPL','IBM','MSFT','GOOGL']}    #Note: GOOG has become GOOGL&#xA;    price = pd.DataFrame({ticker:data['Adj Close']&#xA;                        for ticker,data in all_data.items()})&#xA;    volume = pd.DataFrame({ticker:data['Volume']&#xA;                         for ticker,data in all_data.items()})&#xA;    returns = price.pct_change()      #calculate the percentage of the price&#xA;    &#xA;    returns = returns.dropna()&#xA;    &#xA;    print(returns.tail())&#xA;        &#xA;    a = cov(returns['AAPL'], returns['IBM'])&#xA;    b = cov(returns['IBM'], returns['MSFT'])&#xA;    c = cov(returns['MSFT'], returns['GOOGL'])&#xA;    d = cov(returns['GOOGL'], returns['AAPL'])&#xA;    &#xA;    apple = hi(price['AAPL'],returns['AAPL'], a)&#xA;    ibm = hi(price['IBM'],returns['IBM'], b)&#xA;    microsoft = hi(price['MSFT'],returns['MSFT'], c)&#xA;    google = hi(price['GOOGL'],returns['GOOGL'], d)&#xA;    &#xA;    &#xA;    sampler = neal.SimulatedAnnealingSampler()&#xA;    &#xA;    #qpu = DWaveSampler()&#xA;    &#xA;    h = {apple: 0.0, ibm: 0.0, microsoft: 0.0, google: 0.0}&#xA;    #energy changes when bias value changes&#xA;    J = {(apple, ibm): 0.0, (ibm, microsoft): 0.0, (google, apple): 0.0, (apple, microsoft): 0.0, (ibm, google): 0.0}&#xA;    sampleset = sampler.sample_ising(h, J, num_reads=10, annealing_time=2000)&#xA;    print(sampleset)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And this is the output sampleset:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/IDV4l.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/IDV4l.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I was wondering what the numbers on top meant, so the &lt;code&gt;-224463.77916595488 1414.5773363996423&lt;/code&gt; etc. and if this is correct&lt;/p&gt;&#xA;" OwnerUserId="15801" LastActivityDate="2021-05-27T18:25:17.593" Title="What do the numbers in the Ising sampleset mean?" Tags="&lt;hamiltonian-simulation&gt;&lt;d-wave&gt;&lt;annealing&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17681" PostTypeId="2" ParentId="16413" CreationDate="2021-05-27T19:35:58.867" Score="0" Body="&lt;p&gt;The state evolved at all of the time points in &lt;code&gt;t[i]&lt;/code&gt; are stored in &lt;code&gt;results.states[i]&lt;/code&gt;. You can use this to find the exact post-selected state and the exact post-selection probability by looking directly at the &amp;quot;sandwiches&amp;quot; &lt;code&gt;psif.dag()*result.states[i]&lt;/code&gt; that you mention.&lt;/p&gt;&#xA;&lt;p&gt;But QuTiP gives an error about incompatible object sizes if you do this operation, which seems mathematically fine! That is because it prefers that you operate on states in the composite Hilbert space with things defined on the composite Hilbert space. Thus, instead of the shorthand definition of &lt;span class=&quot;math-container&quot;&gt;$\langle\psi_f|U|\Psi_i\rangle$&lt;/span&gt;, we are really using &lt;span class=&quot;math-container&quot;&gt;$$\left(\langle\psi_f|\otimes \mathbb{I}\right)U|\Psi_i\rangle.$$&lt;/span&gt; If we define my &lt;code&gt;psif&lt;/code&gt; as your &lt;code&gt;psif&lt;/code&gt; tensored with the identity on the second Hilbert space, everything will work nicely.&lt;/p&gt;&#xA;&lt;p&gt;So: the unnormalized post-selected state at time point &lt;code&gt;t[i]&lt;/code&gt; can be found through&#xA;&lt;code&gt;tensor(psif,qeye(N)).dag()*result.states[i]&lt;/code&gt;, where &lt;code&gt;N&lt;/code&gt; is the dimension of the Hilbert space on of the meter. You can verify that this gives &lt;code&gt;psi1&lt;/code&gt; when you &lt;span class=&quot;math-container&quot;&gt;$i=0$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-27T19:35:58.867" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17682" PostTypeId="2" ParentId="17626" CreationDate="2021-05-27T21:54:41.817" Score="0" Body="&lt;p&gt;The chart you posted above looks like a nice peak for the 0-1 transition. Looking at the link that you posted it seems like you are trying to find the 1-2 transition. You can find the frequency of this transition with schedules of the form&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# ground state reference point&#xA;with pulse.build(backend=backend) as gs:&#xA;    with pulse.align_sequential():&#xA;        pulse.measure(0)&#xA;&#xA;# excited state reference point&#xA;with pulse.build(backend=backend) as es:&#xA;    with pulse.align_sequential():&#xA;        pulse.play(Drag(160, 0.2068, 80, -0.24), DriveChannel(0))&#xA;        pulse.measure(0)&#xA;&#xA;schedules = [gs, es]&#xA;frequencies = np.linspace(-0.36e9, -0.32e9, 51)&#xA;&#xA;for freq in frequencies:&#xA;    with pulse.build(backend=backend) as spec:&#xA;        with pulse.align_sequential():&#xA;            pulse.play(Drag(320, 0.8078, 80, -0.65), DriveChannel(0))&#xA;            pulse.shift_frequency(freq, DriveChannel(0))&#xA;            pulse.play(Drag(320, 0.8078, 80, -0.65), DriveChannel(0))&#xA;            pulse.measure(0)&#xA;        &#xA;    schedules.append(spec)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;the first two schedules are intended as calibration points for the ground state and first excited state. You should run this using level 1 measurement data to obtain the best results e.g.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;job = backend.run(schedules, meas_level=1)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next, you can plot this data in the IQ plane to see which frequency resulted in the most population in the 2nd excited state:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;result = job.result()&#xA;&#xA;signal = []&#xA;for idx in range(len(frequencies)+2):&#xA;    signal.append(result.get_memory(idx)[0])&#xA;    &#xA;plt.scatter(np.real(signal[0]), np.imag(signal[0]), label='Ground state')&#xA;plt.scatter(np.real(signal[1]), np.imag(signal[1]), label='1st excited state')&#xA;plt.scatter(np.real(signal[2:]), np.imag(signal[2:]), label='spectroscopy')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can roughly find a peak by doing the following&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;plt.plot(frequencies, np.imag(signal[2:]))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can fit this and I would expect the peak for IBM Quantum Armonk to be 347 MHz below the frequency of the 0-1 transition. Note that a better approach would be to train a 0-1-2 state discriminator in the IQ plane. Once you have the frequency of the 1-2 transition the following should be a good schedule to measure Rabi oscillations between 1-2&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;anharmonicity = -347e6&#xA;schedules = []&#xA;for amp in np.linspace(0, 0.95, 51):&#xA;    with pulse.build(backend=backend) as rabi_12:&#xA;        with pulse.align_sequential():&#xA;            pulse.play(Drag(320, 0.8078, 80, -0.65), DriveChannel(0))&#xA;            pulse.shift_frequency(anharmonicity, DriveChannel(0))&#xA;            pulse.play(Drag(320, amp, 80, -0.65), DriveChannel(0))&#xA;            pulse.measure(0)&#xA;            &#xA;    schedules.append(rabi_12)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="16047" LastActivityDate="2021-05-27T21:54:41.817" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17683" PostTypeId="2" ParentId="13573" CreationDate="2021-05-28T01:35:53.543" Score="0" Body="&lt;p&gt;Given that &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}$&lt;/span&gt; is a unitary matrix, &lt;span class=&quot;math-container&quot;&gt;$\mathcal{A}^{-1} = \mathcal{A}^*$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\begin{aligned}&#xA;     \mathcal{A}S_{0}^{\phi}\mathcal{A}^{-1}|Y\rangle = &amp;amp; \mathcal{A}(I - (1-\phi)|0\rangle\langle0|)\mathcal{A}^{-1}|Y\rangle \\&#xA;=&amp;amp; |Y\rangle - (1-\phi)\mathcal{A}|0\rangle\langle0|\mathcal{A}^{-1}|Y\rangle\\&#xA;=&amp;amp; |Y\rangle - (1-\phi)\mathcal{A}|0\rangle\langle0|\mathcal{A}^{*}|Y\rangle \\&#xA;=&amp;amp; |Y\rangle - (1-\phi)\mathcal{A}|0\rangle\langle Y|\mathcal{A}|0\rangle^*&#xA;\end{aligned}&#xA;$$&lt;/span&gt;&#xA;That leads to the result.&lt;/p&gt;&#xA;" OwnerUserId="15575" LastActivityDate="2021-05-28T01:35:53.543" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17684" PostTypeId="1" CreationDate="2021-05-28T05:19:44.877" Score="2" ViewCount="35" Body="&lt;p&gt;I understand that the Schrodinger picture changes the quantum states, while the Heisenberg picture changes the operators. In this paper &lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9807006.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;The Heisenberg Representation of Quantum Computers&lt;/a&gt;, in equations 1,2, what does it mean that &amp;quot;&lt;em&gt;so after the operation, the operator &lt;span class=&quot;math-container&quot;&gt;$UNU^\dagger$&lt;/span&gt; acts on states in just the way the operator &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; did before the operation&lt;/em&gt;&amp;quot;?&lt;/p&gt;&#xA;" OwnerUserId="8950" LastEditorUserId="8950" LastEditDate="2021-05-29T19:22:21.283" LastActivityDate="2021-05-29T19:22:21.283" Title="In quantum circuits, why does $UNU^\dagger$ act on states in the same way $N$ acts before the operation?" Tags="&lt;quantum-circuit&gt;&lt;gottesman-knill&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17685" PostTypeId="1" CreationDate="2021-05-28T05:54:28.237" Score="0" ViewCount="31" Body="&lt;p&gt;I have been studying this paper (&lt;a href=&quot;https://arxiv.org/abs/quant-ph/0607185&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://arxiv.org/abs/quant-ph/0607185&lt;/a&gt;). And I am unable to understand the part of the circuit highlighted below:&lt;a href=&quot;https://i.stack.imgur.com/gbOcV.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/gbOcV.png&quot; alt=&quot;Implementation of CNOT&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="15994" LastActivityDate="2021-05-28T05:54:28.237" Title="Question about an implementation of CNOT" Tags="&lt;quantum-gate&gt;&lt;quantum-circuit&gt;&lt;photonics&gt;" AnswerCount="0" CommentCount="2" ClosedDate="2021-05-28T17:59:58.050" ContentLicense="CC BY-SA 4.0" />
  <row Id="17686" PostTypeId="2" ParentId="17602" CreationDate="2021-05-28T05:59:30.497" Score="0" Body="&lt;p&gt;As far as I know there isn't a &amp;quot;once size fits all&amp;quot; algorithm, rather random bench-marking is performed to have a statistical accuracy of the gates your computer has. There wouldn't be much point to make it just as short as possible since you would ideally try as many times as you can your gates to get an accuracy for your computer.&lt;/p&gt;&#xA;" OwnerUserId="15994" LastActivityDate="2021-05-28T05:59:30.497" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17687" PostTypeId="1" AcceptedAnswerId="17688" CreationDate="2021-05-28T07:51:38.390" Score="3" ViewCount="34" Body="&lt;p&gt;Preferably using the gates found in QASM/Qiskit and the qubit stays in the superposition and no measurement is made, i.e. the output of if it is in a superposition or not is a binary answer in another qubit.&lt;/p&gt;&#xA;" OwnerUserId="16051" LastEditorUserId="16051" LastEditDate="2021-05-28T08:18:53.617" LastActivityDate="2021-05-28T09:23:41.370" Title="Is there a way to within a quantum circuit work out if a qubit is in a superposition or not?" Tags="&lt;qiskit&gt;&lt;quantum-circuit&gt;&lt;qasm&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17688" PostTypeId="2" ParentId="17687" CreationDate="2021-05-28T08:08:35.937" Score="1" Body="&lt;p&gt;The easiest thing to do would be to check the circuit or just run several qubits through the circuit and measure these qubits. If checking the circuit or running several qubits through the circuit is not possible, then I think applying a CNOT gate to said qubit and a predetermined qubit should allow us to know. Set said qubit to be the control qubit and the predetermined qubit as the target. If the control qubit is in superposition, the final state of these qubit will be in a Bell state.&lt;/p&gt;&#xA;&lt;p&gt;Edit:&lt;/p&gt;&#xA;&lt;p&gt;After the edit to the question, assuming there is no measurement at all, then the answer would be no. However, if what you mean is that we cannot measure or alter only said qubit, then I think we can try the following circuit:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/FYsKL.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/FYsKL.png&quot; alt=&quot;![the circuit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let the first qubit be the qubit in question. The last qubit will be measured later to determine whether the first qubit is in superposition or not. If the last qubit is always |1⟩ or |0⟩, then the first qubit is not in superposition.&#xA;This is because the final state of the circuit is:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$|\psi⟩ = \frac{\alpha}{\sqrt{2}}|0⟩(|00⟩+|10⟩) + \frac{\beta}{\sqrt{2}}|1⟩(|11⟩+|01⟩)$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please let me know if I make any mistake as I am also new to this.&lt;/p&gt;&#xA;" OwnerUserId="15856" LastEditorUserId="15856" LastEditDate="2021-05-28T09:23:41.370" LastActivityDate="2021-05-28T09:23:41.370" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17689" PostTypeId="2" ParentId="17684" CreationDate="2021-05-28T08:37:22.107" Score="1" Body="&lt;p&gt;Suppose you have some state &lt;span class=&quot;math-container&quot;&gt;$\newcommand{\ket}[1]{\lvert#1\rangle}\ket\psi$&lt;/span&gt; (though note that you could make the identical argument using an arbitrary vector rather than a state), and you consider the action of some operator &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; on it. Here, &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; could be another gate, an operator representing some measurement, or just an arbitrary abstract operation that you are interested in for whatever reason. You thus get the state (or vector) &lt;span class=&quot;math-container&quot;&gt;$N\ket\psi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you now ask how this state evolves through some gate &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt;, you get &lt;span class=&quot;math-container&quot;&gt;$UN\ket\psi$&lt;/span&gt;. There is, however, a different (but equivalent) way of thinking about this: because &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; is unitary, you can write &lt;span class=&quot;math-container&quot;&gt;$UNU^\dagger U\ket\psi$&lt;/span&gt;. This means that rather than thinking about &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; evolving through the two operations, you can interpret this as applying the operation &lt;span class=&quot;math-container&quot;&gt;$UNU^\dagger$&lt;/span&gt; to the evolved vector &lt;span class=&quot;math-container&quot;&gt;$U\ket\psi$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In some cases, this might make for an easier analysis of how states evolve through a circuit. Case in point, you might find that if &lt;span class=&quot;math-container&quot;&gt;$N\in\mathcal P$&lt;/span&gt; for some group &lt;span class=&quot;math-container&quot;&gt;$\mathcal P$&lt;/span&gt;, then the map &lt;span class=&quot;math-container&quot;&gt;$N\mapsto UNU^\dagger$&lt;/span&gt; is a group homomorphism, provided &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; has specific properties (namely, in general, provided that &lt;span class=&quot;math-container&quot;&gt;$U$&lt;/span&gt; belongs to the normaliser of &lt;span class=&quot;math-container&quot;&gt;$\mathcal P$&lt;/span&gt; in the relevant group of unitaries).&lt;/p&gt;&#xA;&lt;p&gt;If you then consider such &amp;quot;effective evolution&amp;quot; for sufficiently many &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, you end up effectively offloading the task of calculating the evolution of &lt;span class=&quot;math-container&quot;&gt;$\ket\psi$&lt;/span&gt; into that of calculating the evolution of a set of &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt;, which might be easier if you can show that you need a relatively small number of operations &lt;span class=&quot;math-container&quot;&gt;$N$&lt;/span&gt; to do this, and  that such set of operations is invariant under the action of some subgroup of unitaries.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-28T08:43:59.657" LastActivityDate="2021-05-28T08:43:59.657" CommentCount="4" ContentLicense="CC BY-SA 4.0" />
  <row Id="17690" PostTypeId="1" CreationDate="2021-05-28T10:22:43.133" Score="1" ViewCount="14" Body="&lt;p&gt;The built in noise models in Qiskit have an example of &lt;span class=&quot;math-container&quot;&gt;$T_1/2T_2$&lt;/span&gt; relaxation &lt;a href=&quot;https://qiskit.org/documentation/tutorials/simulators/3_building_noise_models.html&quot; rel=&quot;nofollow noreferrer&quot;&gt;here&lt;/a&gt;. I have a couple of doubts; the notebook is not very clear in some of the steps.&lt;/p&gt;&#xA;&lt;p&gt;Why does one need &lt;span class=&quot;math-container&quot;&gt;$T_2\leq 2T_1$&lt;/span&gt;? There's no reference on this, is it too obvious why it should be so? It is also defined &lt;code&gt;time_u3 = 100 # (two X90 pulses)&lt;/code&gt;, does this referes to the &lt;code&gt;gate_length&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="15220" LastActivityDate="2021-05-28T11:22:22.430" Title="$T_1/T_2$ thermal relaxation example" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17691" PostTypeId="1" AcceptedAnswerId="17699" CreationDate="2021-05-28T11:07:27.320" Score="3" ViewCount="74" Body="&lt;p&gt;In connection to &lt;a href=&quot;https://quantumcomputing.stackexchange.com/questions/12797/quantum-circuit-to-compute-any-inner-product&quot;&gt;this&lt;/a&gt; question, I am wondering how to calculate value &lt;span class=&quot;math-container&quot;&gt;$\langle \psi|\phi \rangle$&lt;/span&gt; for arbitrary quantum states &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A swap test is able to return only &lt;span class=&quot;math-container&quot;&gt;$|\langle \psi|\phi \rangle|^2$&lt;/span&gt; which means that sign of the product is forgotten in case the inner product is real. Moreover, information about real and imaginary parts is lost in case of complex result.&lt;/p&gt;&#xA;&lt;p&gt;Do you know about any more general method how to calculate the inner product than swap test?&lt;/p&gt;&#xA;" OwnerUserId="9006" LastActivityDate="2021-05-28T15:35:04.823" Title="How to calculate inner product of quantum states with other method than swap test?" Tags="&lt;quantum-state&gt;&lt;swap-test&gt;&lt;inner-product&gt;" AnswerCount="1" CommentCount="6" ClosedDate="2021-05-28T22:34:05.413" ContentLicense="CC BY-SA 4.0" />
  <row Id="17692" PostTypeId="2" ParentId="17690" CreationDate="2021-05-28T11:22:22.430" Score="1" Body="&lt;p&gt;Answering your second question first, yes the &lt;code&gt;time_u3 = 100 # (two X90 pulses)&lt;/code&gt; refers to the gate time.  The function &lt;code&gt;thermal_relaxation_error(t1, t2, time, excited_state_population=0)&lt;/code&gt; needs to know the timescale of the noise (&lt;code&gt;t1&lt;/code&gt;, &lt;code&gt;t2&lt;/code&gt;) relative to the total time for the gate to determine how &amp;quot;much&amp;quot; error occurs.  This is ultimately due to how the noise is modeled phenomenologically, which naturally leads to your first question.&lt;/p&gt;&#xA;&lt;p&gt;It is not really obvious to see why &lt;span class=&quot;math-container&quot;&gt;$T_2 \leq 2T_1$&lt;/span&gt;, because it follows from how the Kraus form for the noise channel is defined.  The amplitude damping channel has the (non-unique) Kraus form&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathcal{E}(\rho) &amp;amp;= E_0 \rho E_0^\dagger + E_1 \rho E_1^\dagger \\&#xA;E_0 &amp;amp;= |0\rangle\langle 0| + \sqrt{1-\lambda}|1\rangle\langle 1|\\&#xA;E_1 &amp;amp;= \sqrt{\lambda}|0\rangle\langle 1|&#xA;\end{align}&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$E_1$&lt;/span&gt; is a decay event, and &lt;span class=&quot;math-container&quot;&gt;$E_0$&lt;/span&gt; is the absence of a decay event.&lt;/p&gt;&#xA;&lt;p&gt;If you expand this out on an arbitrary density matrix, you get&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\mathcal{E}\Big(\begin{bmatrix} a &amp;amp; b\\ b^* &amp;amp; 1-a \end{bmatrix} \Big) = \begin{bmatrix} 1-(1-a)(1-\lambda) &amp;amp; b\sqrt{1-\lambda}\\ b^*\sqrt{1-\lambda} &amp;amp; (1-a)(1-\lambda) \end{bmatrix}&#xA;\end{align}&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notice that if &lt;span class=&quot;math-container&quot;&gt;$\lambda = 0$&lt;/span&gt; nothing happens, and if &lt;span class=&quot;math-container&quot;&gt;$\lambda = 1$&lt;/span&gt; then the output of the channel is just the ground state &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt;.&#xA;What makes this physical/phenomenological is that we just assume that &lt;span class=&quot;math-container&quot;&gt;$\lambda = 1 - e^{-t/T_1}$&lt;/span&gt;, meaning we interpret &lt;span class=&quot;math-container&quot;&gt;$\lambda$&lt;/span&gt; as the probability that the qubit relaxes--the longer we wait, the more likely it should be that the qubit has relaxed (relaxation events are discrete, but we are averaging over many trials when working with density matrices).  Notice that the off-diagonal matrix elements decay with a rate &lt;span class=&quot;math-container&quot;&gt;$2T_1$&lt;/span&gt; whereas the excited population &lt;span class=&quot;math-container&quot;&gt;$|1\rangle$&lt;/span&gt; decays with &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt;.  It turns out that if you add a second decay channel--dephasing noise--then the off-diagonals will decay with a rate that also depends on &lt;span class=&quot;math-container&quot;&gt;$T_{\phi}$&lt;/span&gt;, where &lt;span class=&quot;math-container&quot;&gt;$T_{\phi}$&lt;/span&gt; refers to the decay caused by pure dephasing. &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt; is the decay rate that effectively combines both of these effects, and is derived by solving&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;e^{-t/T_2} = e^{-t/2T_1}e^{-t/T_{\phi}}&#xA;\end{align}&lt;/span&gt;&#xA;leading to&#xA;&lt;span class=&quot;math-container&quot;&gt;\begin{align}&#xA;\frac{1}{T_2} = \frac{1}{2T_1} + \frac{1}{T_{\phi}}&#xA;\end{align}&lt;/span&gt;&#xA;Thus, in the absence of any pure dephasing (so &lt;span class=&quot;math-container&quot;&gt;$T_{\phi} = \infty$&lt;/span&gt;), &lt;span class=&quot;math-container&quot;&gt;$T_2 = 2T_1$&lt;/span&gt;, and the process of relaxation &lt;em&gt;alone&lt;/em&gt; will upper bound the phase coherence of the qubit.  If you want to control these effects independently, you should set &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_{\phi}$&lt;/span&gt;, instead of &lt;span class=&quot;math-container&quot;&gt;$T_1$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$T_2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;PS: The reason an exponential is chosen is because it agrees well with experiment, and because makes it possible to obtain a master equation for the time evolution in Lindblad form, which is very nice to work with theoretically.&lt;/p&gt;&#xA;" OwnerUserId="4622" LastActivityDate="2021-05-28T11:22:22.430" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17693" PostTypeId="1" AcceptedAnswerId="17694" CreationDate="2021-05-28T11:29:17.337" Score="2" ViewCount="22" Body="&lt;p&gt;A pretty lame question but, the backends relaxation times &lt;span class=&quot;math-container&quot;&gt;$T_1,T_2$&lt;/span&gt; are given in &lt;strong&gt;us&lt;/strong&gt; units. What are those? (Frequencies are given in GHz... Is it really &lt;span class=&quot;math-container&quot;&gt;$\mu s$&lt;/span&gt; but IBM can't display the &lt;span class=&quot;math-container&quot;&gt;$\mu$&lt;/span&gt; in the information chart?)&lt;/p&gt;&#xA;" OwnerUserId="15220" LastActivityDate="2021-05-28T12:09:23.323" Title="&quot;us&quot; units on relaxation times $T_j$ in the IBM backends" Tags="&lt;ibm-q-experience&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17694" PostTypeId="2" ParentId="17693" CreationDate="2021-05-28T12:09:23.323" Score="2" Body="&lt;p&gt;Yes they mean microseconds.&lt;/p&gt;&#xA;&lt;p&gt;It's very common to write &lt;span class=&quot;math-container&quot;&gt;$\mu s$&lt;/span&gt; as &lt;span class=&quot;math-container&quot;&gt;$us$&lt;/span&gt;, e.g. because it can be typed more easily. Sometimes it's forced by some software constraint (e.g. fixed width fonts often become not-fixed-width if you stray outside ASCII).&lt;/p&gt;&#xA;" OwnerUserId="119" LastActivityDate="2021-05-28T12:09:23.323" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17695" PostTypeId="1" CreationDate="2021-05-28T12:10:41.297" Score="1" ViewCount="21" Body="&lt;p&gt;On an abstract level one draws a circuit diagram with wires and gates. Different software frameworks like &lt;code&gt;qiskit&lt;/code&gt;, &lt;code&gt;circ&lt;/code&gt; etc. probably have different ways to represent these circuits.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;My first question is if there is now a single standard (or highly compatible with others) format for representing &amp;quot;textbook&amp;quot; quantum circuits?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;If we are to run the circuit on an actual hardware we need to get much more specific about the abstract circuit representation. We need to tailor it to the native gates of the hardware, qubit connectivity, physical properties (time to perform gates, error rates etc.). This is called transpilation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;The second question is if there is any standard extended format for quantum circuits that would take into account the hardware data. Or perhaps there is a clever way to separate device specification from the abstract description of a circuit?&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="15239" LastActivityDate="2021-05-29T08:11:42.067" Title="What are standard/most popular data formats to represent quantum circuits including hardware specifications?" Tags="&lt;programming&gt;&lt;algorithm&gt;&lt;circuit-construction&gt;&lt;quantum-circuit&gt;&lt;transpile&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17696" PostTypeId="1" CreationDate="2021-05-28T12:19:41.227" Score="1" ViewCount="22" Body="&lt;p&gt;&lt;a href=&quot;https://arxiv.org/pdf/quant-ph/9805082.pdf&quot; rel=&quot;nofollow noreferrer&quot;&gt;In this paper&lt;/a&gt;, when proving theorem 5, the authors let &lt;span class=&quot;math-container&quot;&gt;$f = \frac{P\theta}{\pi}$&lt;/span&gt; and claim they &amp;quot;apply the Fourier transform on a sine (cosine) of period &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;&amp;quot;. However, I just could not find where the sine of cosine is. It seems that the previously mentioned &lt;span class=&quot;math-container&quot;&gt;$\sin((2m+1)\theta)$&lt;/span&gt; does not have a period &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, they later claim that when &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is an integer and &lt;span class=&quot;math-container&quot;&gt;$f &amp;gt; 0$&lt;/span&gt;, &lt;span class=&quot;math-container&quot;&gt;$|\Psi_3\rangle$&lt;/span&gt; could be expressed as some &lt;span class=&quot;math-container&quot;&gt;$a|f\rangle + b|P-f\rangle$&lt;/span&gt;. Where does this come from? I just could not derive it according to the formula of Fourier transform. Any help would be really appreciated!&lt;/p&gt;&#xA;" OwnerUserId="15575" LastEditorUserId="55" LastEditDate="2021-05-28T13:31:27.523" LastActivityDate="2021-05-28T14:26:39.433" Title="Question about theorem 5 of the Quantum Counting, Brassard et al. paper" Tags="&lt;algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17698" PostTypeId="2" ParentId="17696" CreationDate="2021-05-28T14:26:39.433" Score="1" Body="&lt;p&gt;The state on which the Fourier transform is being performed is defined in the paper as &lt;span class=&quot;math-container&quot;&gt;$$|\Psi_2\rangle\propto \sum_{m=0}^{P-1}\sin[(2m+1)\theta]|m\rangle=\sum_{m=0}^{P-1}\sin\left[2\pi f\frac{m}{P}+\pi\frac{f}{P}\right]|m\rangle\equiv\sum_{m=0}^{P-1}x_m|m\rangle.$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;We can compare this to the definition of a discrete Fourier transform with period &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;:&#xA;&lt;span class=&quot;math-container&quot;&gt;$$X_f=\sum_{m=0}^{P-1}x_m e^{-2\pi i f\frac{m}{P}}=\sum_{m=0}^{P-1}x_m \left[\cos \left(2\pi f\frac{m}{P}\right)-i\sin \left(2\pi f\frac{m}{P}\right)\right].$$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;By comparing these two expressions, we see that &lt;span class=&quot;math-container&quot;&gt;$\pi f/P$&lt;/span&gt; adds a constant phase shift to the transformation, and that otherwise the imaginary part of the variable &lt;span class=&quot;math-container&quot;&gt;$X_f$&lt;/span&gt; transformed with period &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; is exactly the result of a Fourier transform.&lt;/p&gt;&#xA;&lt;p&gt;The main message is that the Fourier transform is being done using the period &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; &lt;em&gt;by construction&lt;/em&gt; in order to obtain information from &lt;span class=&quot;math-container&quot;&gt;$|\Psi_2\rangle$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-28T14:26:39.433" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17699" PostTypeId="2" ParentId="17691" CreationDate="2021-05-28T15:35:04.823" Score="3" Body="&lt;p&gt;I doubt that this is possible. Given a state &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt;, we have no method for distinguishing it from &lt;span class=&quot;math-container&quot;&gt;$e^{i\varphi}|\phi\rangle$&lt;/span&gt; for any phase &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt;. This means that we have no way of distinguishing between&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\langle\psi|\phi\rangle\qquad \mathrm{vs.}\qquad e^{i\varphi}\langle\psi|\phi\rangle.$$&lt;/span&gt; Specifically, we can choose &lt;span class=&quot;math-container&quot;&gt;$\varphi$&lt;/span&gt; such that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$e^{i\varphi}\langle\psi|\phi\rangle=|\langle\psi|\phi\rangle|.$$&lt;/span&gt; We thus should be precluded from measuring anything other than this absolute value.&lt;/p&gt;&#xA;&lt;hr /&gt;&#xA;&lt;p&gt;To get around this constraint, we would need to set up a superposition of &lt;span class=&quot;math-container&quot;&gt;$|\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle$&lt;/span&gt; like &lt;span class=&quot;math-container&quot;&gt;$$|\Psi\rangle\propto |\psi\rangle+|\phi\rangle.$$&lt;/span&gt; Only then could we get around the global phase problem. I would be interested in seeing a circuit that can take &lt;span class=&quot;math-container&quot;&gt;$$|0\rangle|\psi\rangle|\phi\rangle\to|\Psi\rangle|a\rangle|b\rangle$$&lt;/span&gt; for any generalized ancilla &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; and final states &lt;span class=&quot;math-container&quot;&gt;$|a\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|b\rangle$&lt;/span&gt;. If I had to guess, I would say that it is impossible to perform this transformation with a fixed relative phase in &lt;span class=&quot;math-container&quot;&gt;$|\Psi\rangle$&lt;/span&gt;. We might be happy saying that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle|\psi\rangle|\phi\rangle\to\frac{|\psi\rangle+|\phi\rangle}{\mathcal{N}}|a\rangle|b\rangle$$&lt;/span&gt; for some normalization constant &lt;span class=&quot;math-container&quot;&gt;$\mathcal{N}$&lt;/span&gt;, but then we would need to also be happy with the transformation&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|0\rangle|\psi\rangle e^{i\varphi}|\phi\rangle\to\frac{|\psi\rangle+e^{i\varphi}|\phi\rangle}{\mathcal{N}}|a\rangle|b\rangle,$$&lt;/span&gt; but that is nonsensical for the same deterministic transformation, because the initial states &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|\psi\rangle |\phi\rangle$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|0\rangle|\psi\rangle e^{i\varphi}|\phi\rangle$&lt;/span&gt; are indistinguishable.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-28T15:35:04.823" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17700" PostTypeId="1" CreationDate="2021-05-29T01:18:03.167" Score="1" ViewCount="32" Body="&lt;p&gt;I'm trying to understand quantum parallelism ideas leading the Deutsch's algorithm. The circuit in question is&#xA;&lt;a href=&quot;https://i.stack.imgur.com/30TQ9.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/30TQ9.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand that we end up with&#xA;&lt;span class=&quot;math-container&quot;&gt;$$|\psi_3 \rangle = \pm | f(0) \oplus f(1) \rangle \left[ \frac{|0 \rangle - |1 \rangle }{\sqrt{2} } \right].$$&lt;/span&gt;&#xA;Then by measuring the first qubit we can determine &lt;span class=&quot;math-container&quot;&gt;$f(0) \oplus f(1),$&lt;/span&gt; and the claim is that we have thus determined a global property of &lt;span class=&quot;math-container&quot;&gt;$f(x),$&lt;/span&gt; namely &lt;span class=&quot;math-container&quot;&gt;$f(0) \oplus f(1),$&lt;/span&gt; using only one evaluation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I have three questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Where does that single evaluation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; actually occur? Is it in the construction of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;li&gt;What is &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; in this case? I realize it depends on &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, but how can we build it using at most one evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;li&gt;In the circuit above, the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; input to &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle + |1 \rangle)/\sqrt{2})$&lt;/span&gt;. What does it mean to apply (classical) &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to this &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I realize all 3 of these questions are probably tied up somehow.&lt;/p&gt;&#xA;" OwnerUserId="16063" LastActivityDate="2021-05-29T03:20:19.937" Title="Quantum parallelism and Deutsch's algorithm - what is $U_f$ really?" Tags="&lt;quantum-gate&gt;&lt;nielsen-and-chuang&gt;&lt;quantum-circuit&gt;&lt;deutsch-jozsa-algorithm&gt;&lt;quantum-parallelism&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17701" PostTypeId="2" ParentId="17700" CreationDate="2021-05-29T03:20:19.937" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Where does that single evaluation of &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; actually occur? Is it in the construction of &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is an implementation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; in quantum gates. The evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; occurs in the course of applying the gates making up &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to the qubits.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;What is &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; in this case? I realize it depends on &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;, but how can we build it using at most one evaluation of &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;You don't evaluate &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; when building &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;, if by building it you mean determining what primitive gates make it up.&lt;/p&gt;&#xA;&lt;p&gt;You could imagine that &lt;span class=&quot;math-container&quot;&gt;$f(x)$&lt;/span&gt; is the first bit of the SHA-256 hash of &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;. In that case, &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; would be a reversible circuit computing a SHA-256 hash. This might require, say, 100,000 primitive gates. Ultimately, there are only 4 functions that &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; could be, but determining which of those four functions it is would require around 200,000 primitive operations. Determining &lt;span class=&quot;math-container&quot;&gt;$f(0)$&lt;/span&gt; or &lt;span class=&quot;math-container&quot;&gt;$f(1)$&lt;/span&gt; alone would require around 100,000 operations. Classically, determining &lt;span class=&quot;math-container&quot;&gt;$f(0)\oplus f(1)$&lt;/span&gt; would require around 200,000 operations, but with Deutsch's algorithm you can find it in 100,000.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In the circuit above, the &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; input to &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$(|0\rangle + |1 \rangle)/\sqrt{2})$&lt;/span&gt;. What does it mean to apply (classical) &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to this &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It doesn't mean anything to apply &lt;span class=&quot;math-container&quot;&gt;$f$&lt;/span&gt; to it, but it means something to apply &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; to it. By definition &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; takes &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\rangle$&lt;/span&gt; to &lt;span class=&quot;math-container&quot;&gt;$|x\rangle|y\oplus f(x)\rangle$&lt;/span&gt; for &lt;span class=&quot;math-container&quot;&gt;$x,y\in\{0,1\}$&lt;/span&gt;. This definition only covers four inputs, but adding the requirement that &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt; be linear completely fixes &lt;span class=&quot;math-container&quot;&gt;$U_f$&lt;/span&gt;. For example, you must have &lt;span class=&quot;math-container&quot;&gt;$$U_f\,(|0\rangle{+}|1\rangle)\,|0\rangle = U_f|0\rangle|0\rangle+U_f|1\rangle|0\rangle = |0\rangle|f(0)\rangle+|1\rangle|f(1)\rangle$$&lt;/span&gt; (times &lt;span class=&quot;math-container&quot;&gt;$1/\sqrt2$&lt;/span&gt;).&lt;/p&gt;&#xA;" OwnerUserId="3030" LastActivityDate="2021-05-29T03:20:19.937" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17702" PostTypeId="2" ParentId="17695" CreationDate="2021-05-29T08:11:42.067" Score="0" Body="&lt;p&gt;The short answer to your first question is no, there is no &amp;quot;single standard&amp;quot; of representing circuits in terms of text/language. The closest to a &amp;quot;single standard&amp;quot; of representing circuits visually is the qiskit and cirq draw functions which produce very similar results that are basically standard in format .&lt;/p&gt;&#xA;&lt;p&gt;Due to the fact that no quantum hardware description language is in common usage (to my knowledge) there is no way to simply and especially not universally take into account hardware information.&lt;/p&gt;&#xA;&lt;p&gt;For your problem try using qasm? It is the only language (again, to my knowledge) designed for quantum hardware representation.&lt;/p&gt;&#xA;" OwnerUserId="16051" LastActivityDate="2021-05-29T08:11:42.067" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17703" PostTypeId="1" AcceptedAnswerId="17710" CreationDate="2021-05-29T08:46:48.170" Score="1" ViewCount="24" Body="&lt;p&gt;I have read two opposite explanations about QFT and IQFT from 2 books for beginners of Quantum Computing. Which one is correct?&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://www.amazon.co.jp/-/en/%E5%AE%87%E6%B4%A5%E6%9C%A8-%E5%81%A5/dp/4798157465/&quot; rel=&quot;nofollow noreferrer&quot;&gt;first book&lt;/a&gt; said, if we input an &lt;em&gt;n&lt;/em&gt;-qubit non-superposition state into QFT, the QFT will output an &lt;em&gt;n&lt;/em&gt;-qubit superposition state with periodical phases. On the other hand, IQFT swaps the input and output of QFT; we can apply IQFT to find the period hidden in an input state because the amplitude of the state, which matches the period(or frequency),  will be amplified.&lt;/p&gt;&#xA;&lt;p&gt;e.g., If we input |010〉into QFT, QFT will output a uniformly distributed superposition whose phases shifted two rotations(periods), the 1st rotation is from |000〉 to |011〉, and the 2nd one is from |100〉to |111〉. And if we input the output into IQFT, it will output |010〉.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/ouwZ2.jpg&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/ouwZ2.jpg&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&quot;https://learning.oreilly.com/library/view/programming-quantum-computers/9781492039679/&quot; rel=&quot;nofollow noreferrer&quot;&gt;second book&lt;/a&gt; told me an opposite fact, that QFT allows us to determine how many rotations the relative phase makes per register, and we can use the IQFT to prepare periodically varying register superpositions easily.&lt;/p&gt;&#xA;&lt;p&gt;e.g. &lt;a href=&quot;https://i.stack.imgur.com/cWH8y.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/cWH8y.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;QFT allows us to determine that the frequency of repetition it contained was 2 (i.e., the relative phase makes two rotations per register)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/l1gVc.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/l1gVc.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We can use the invQFT to easily prepare periodically varying register superpositions&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="15495" LastActivityDate="2021-05-29T12:55:37.573" Title="What are the input and output of QFT and IQFT, respectively?" Tags="&lt;textbook-and-exercises&gt;&lt;quantum-fourier-transform&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17704" PostTypeId="1" AcceptedAnswerId="17706" CreationDate="2021-05-29T08:57:52.823" Score="3" ViewCount="12" Body="&lt;p&gt;How can I decompose gate &lt;span class=&quot;math-container&quot;&gt;$R_{y}(\theta)$&lt;/span&gt; into gate &lt;span class=&quot;math-container&quot;&gt;$R_{x}(\alpha)$&lt;/span&gt; and gate &lt;span class=&quot;math-container&quot;&gt;$R_{z}(\beta)$&lt;/span&gt;. And how to perform it on Qiskit, is there any function to do it.&lt;/p&gt;&#xA;" OwnerUserId="14994" LastEditorUserId="9800" LastEditDate="2021-05-29T09:26:57.177" LastActivityDate="2021-05-29T09:26:57.177" Title="Decomposition of gate $R_{y}$ into specific basis" Tags="&lt;programming&gt;&lt;qiskit&gt;&lt;quantum-gate&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17705" PostTypeId="1" CreationDate="2021-05-29T09:16:52.253" Score="2" ViewCount="34" Body="&lt;p&gt;In measurement in the computational basis, I was being told that it is a way to extract information from a qubit, and it outputs a classical bit.&lt;/p&gt;&#xA;&lt;p&gt;For the quantum state &lt;span class=&quot;math-container&quot;&gt;$\alpha |0\rangle + \beta |1\rangle$&lt;/span&gt;, the possible outputs are:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$0$&lt;/span&gt;, with probability &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$1$&lt;/span&gt;, with probability &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why are the probabilities &lt;span class=&quot;math-container&quot;&gt;$|\alpha|^2$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$|\beta|^2$&lt;/span&gt;? I assume this is related to the figure below? (where &lt;span class=&quot;math-container&quot;&gt;$\alpha$&lt;/span&gt; being the possibilities for it to fall in the x-axis and &lt;span class=&quot;math-container&quot;&gt;$\beta$&lt;/span&gt; for the y-axis?)&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/1IUOr.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/1IUOr.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="16064" LastEditorUserId="55" LastEditDate="2021-05-29T10:25:11.133" LastActivityDate="2021-05-29T16:45:59.883" Title="Why are the probabilities $|\alpha|^2$ and $|\beta|^2$ when measuring in the computational basis?" Tags="&lt;quantum-state&gt;&lt;measurement&gt;&lt;textbook-and-exercises&gt;" AnswerCount="1" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17706" PostTypeId="2" ParentId="17704" CreationDate="2021-05-29T09:26:29.493" Score="3" Body="&lt;p&gt;Qiskit supports translating to different continuous basis sets by specifying the &lt;code&gt;basis_gates&lt;/code&gt; in the &lt;code&gt;transpile&lt;/code&gt; method. So in your case you could just do&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; from qiskit import QuantumCircuit, transpile&#xA;&amp;gt;&amp;gt;&amp;gt; from qiskit.circuit import Parameter&#xA;&amp;gt;&amp;gt;&amp;gt; circuit = QuantumCircuit(1)&#xA;&amp;gt;&amp;gt;&amp;gt; circuit.ry(Parameter('theta'), 0)&#xA;&amp;gt;&amp;gt;&amp;gt; rxrz_basis = transpile(circuit, basis_gates=['rx', 'rz'])&#xA;&amp;gt;&amp;gt;&amp;gt; rxrz_basis.draw()&#xA;     ┌─────────┐┌───────────────┐┌─────────┐┌────────┐&#xA;q_0: ┤ RX(π/2) ├┤ RZ(theta + π) ├┤ RX(π/2) ├┤ RZ(3π) ├&#xA;     └─────────┘└───────────────┘└─────────┘└────────┘&#xA;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So you see that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;R_Y(\theta) = R_X\left(\frac{\pi}{2}\right) R_Z(\theta + \pi) R_X\left(\frac{\pi}{2}\right) R_Z(\pi)&#xA;$$&lt;/span&gt;&#xA;where I replaced the &lt;span class=&quot;math-container&quot;&gt;$3\pi$&lt;/span&gt; by &lt;span class=&quot;math-container&quot;&gt;$\pi$&lt;/span&gt; in the last RZ rotation since the operation is mod &lt;span class=&quot;math-container&quot;&gt;$2\pi$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9800" LastActivityDate="2021-05-29T09:26:29.493" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17707" PostTypeId="1" CreationDate="2021-05-29T10:36:32.677" Score="2" ViewCount="20" Body="&lt;p&gt;Could you please help me in finding some research paper references on the impact of Quantum algorithms on symmetric and asymmetric cryptography ?&lt;/p&gt;&#xA;&lt;p&gt;Also, I request if I can get some references or notes demonstrating the impact on cryptography with particular algorithms as shown below:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Bernstein–Vazirani algorithm&lt;/li&gt;&#xA;&lt;li&gt;Simon's algorithm&lt;/li&gt;&#xA;&lt;li&gt;Quantum phase estimation algorithm&lt;/li&gt;&#xA;&lt;li&gt;Shor's algorithm Hidden subgroup problem&lt;/li&gt;&#xA;&lt;li&gt;Grover's algorithm Quantum counting&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="16066" LastEditorUserId="9006" LastEditDate="2021-05-29T12:30:32.930" LastActivityDate="2021-05-29T12:30:32.930" Title="Impacts of Quantum algorithms on cryptography?" Tags="&lt;algorithm&gt;&lt;resource-request&gt;&lt;cryptography&gt;" AnswerCount="0" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17708" PostTypeId="1" CreationDate="2021-05-29T10:38:36.050" Score="-4" ViewCount="20" Body="&lt;p&gt;My university class wants me to do this in code. We just started studying quantum computing a few weeks ago and we use qiskit.  We need to do this over 100 iterations. Question might sound a little vague but that's how it's given in the assignment.&lt;/p&gt;&#xA;" OwnerUserId="16067" LastActivityDate="2021-05-29T10:38:36.050" Title="Prove 10 equality of gates with atleast majority of 2 qubits. Over a 100 iterations" Tags="&lt;quantum-gate&gt;" AnswerCount="0" CommentCount="2" FavoriteCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17709" PostTypeId="1" CreationDate="2021-05-29T12:21:20.473" Score="2" ViewCount="19" Body="&lt;p&gt;Does the definition of separability of pure states require the components of the summands to be pure? More precisely, let &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; be a pure state (i.e., &lt;span class=&quot;math-container&quot;&gt;$\rho=|\phi\rangle\langle\phi|$&lt;/span&gt;) on the space &lt;span class=&quot;math-container&quot;&gt;$H_A\otimes H_B$&lt;/span&gt;. If it is possible to write &lt;span class=&quot;math-container&quot;&gt;$\rho=\sum_{i}p_i(\rho_A^{i}\otimes\rho_B^{i})$&lt;/span&gt;, then we say that &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is separable. I want to ask whether here we require that all &lt;span class=&quot;math-container&quot;&gt;$\rho_A^{i}$&lt;/span&gt;'s and &lt;span class=&quot;math-container&quot;&gt;$\rho_B^{i}$&lt;/span&gt;'s are themselves being pure. (Or maybe we can prove that whether they are pure or mixed does not matter?)&lt;/p&gt;&#xA;" OwnerUserId="15620" LastEditorUserId="15620" LastEditDate="2021-05-29T12:30:01.087" LastActivityDate="2021-05-29T17:44:23.677" Title="Does the definition of separability of pure states require the components of the summands to be pure?" Tags="&lt;quantum-state&gt;&lt;entanglement&gt;&lt;density-matrix&gt;" AnswerCount="2" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17710" PostTypeId="2" ParentId="17703" CreationDate="2021-05-29T12:55:37.573" Score="1" Body="&lt;p&gt;The classical Fourier transform acts on a vector &lt;span class=&quot;math-container&quot;&gt;$(x_{0}, x_{1}, \ldots, x_{N-1}) \in {C} ^{N}$&lt;/span&gt;&#xA;and maps it to the vector &lt;span class=&quot;math-container&quot;&gt;$(y_{0}, y_{1}, \ldots, y_{N-1}) \in {C} ^{N}$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;According to the formula:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$y_{k}={\frac {1}{\sqrt {N}}}\sum _{n=0}^{N-1}x_{n}\omega _{N}^{-kn},\quad k=0,1,2,\ldots ,N-1$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Similarly, the quantum Fourier transform acts on a quantum state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle = \sum _{i=0}^{N-1}x_{i}|i\rangle$&lt;/span&gt; and maps it to a quantum state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle = \sum _{i=0}^{N-1}y_{i}|i\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, different authors use different conventions for the formula which maps the input state &lt;span class=&quot;math-container&quot;&gt;$|x\rangle$&lt;/span&gt; to the output state &lt;span class=&quot;math-container&quot;&gt;$|y\rangle$&lt;/span&gt;. Some authors use the convention that QFT has the same effect as the inverse DFT, and vice versa. In this case, QFT is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{QFT}:|x\rangle \mapsto {\frac {1}{\sqrt {N}}}\sum _{k=0}^{N-1}\omega _{N}^{xk}|k\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;And inverse quantum Fourier transform is defined as&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\text{QFT}^\dagger:|y\rangle \mapsto {\frac {1}{\sqrt {N}}}\sum _{k=0}^{N-1}\omega _{N}^{-yk}|k\rangle$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Other authors use the convention that QFT has the same effect as the DFT. That is, switch the sign of the phase factor exponent.&lt;/p&gt;&#xA;&lt;p&gt;The difference between these two books because the authors follow different conventions.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastActivityDate="2021-05-29T12:55:37.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17711" PostTypeId="1" CreationDate="2021-05-29T14:11:03.210" Score="1" ViewCount="8" Body="&lt;p&gt;I want to redefine the QSVM code for a different kernel. But what is the kernel actually used in the IBM Qiskit's source code? And where is it defined, exactly. &lt;a href=&quot;https://qiskit.org/documentation/_modules/qiskit/aqua/algorithms/classifiers/qsvm/qsvm.html#QSVM&quot; rel=&quot;nofollow noreferrer&quot;&gt;QSVM on Qiskit&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="15507" LastActivityDate="2021-05-29T14:11:03.210" Title="Redefining Qiskit's QSVM" Tags="&lt;qiskit&gt;&lt;quantum-enhanced-machine-learning&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17712" PostTypeId="1" CreationDate="2021-05-29T14:14:02.807" Score="2" ViewCount="20" Body="&lt;p&gt;I am currently learning from Nielsen and Chuang and I am currently learning about Deutsch-Josza algorithm. However, I am stumped with the mathematics of the algorithm at the following section:&#xA;&lt;a href=&quot;https://i.stack.imgur.com/KMwAp.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/KMwAp.png&quot; alt=&quot;The section&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I understand intuitively that it works very similarly with Deutsch algorithm where we could measure a global state of the function with only 1 measurement, but I couldn't do it mathematically. Why is the amplitude simply so without including the &lt;span class=&quot;math-container&quot;&gt;$x \dot z$&lt;/span&gt; factor? I am also having a hard time on the summation over &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt; on the amplitudes. Why is the resulting amplitude for the constant case is &lt;span class=&quot;math-container&quot;&gt;$\pm 1$&lt;/span&gt; and 0 for the balanced case?&lt;/p&gt;&#xA;" OwnerUserId="15856" LastEditorUserId="2879" LastEditDate="2021-05-29T18:01:15.233" LastActivityDate="2021-05-29T18:01:15.233" Title="Mathematics Behind Deutsch-Josza Algorithm" Tags="&lt;mathematics&gt;&lt;textbook-and-exercises&gt;&lt;nielsen-and-chuang&gt;&lt;deutsch-jozsa-algorithm&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17713" PostTypeId="2" ParentId="17709" CreationDate="2021-05-29T16:12:16.197" Score="1" Body="&lt;p&gt;No, we do not require &lt;span class=&quot;math-container&quot;&gt;$\rho_A^i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B^i$&lt;/span&gt; to be pure. The state is separable any time it can be written in this form with positive weights &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt;. As a basic example, we can choose a single &lt;span class=&quot;math-container&quot;&gt;$p_i$&lt;/span&gt; to be nonzero; this is equivalent to saying that&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho=\rho_A^i\otimes \rho_B^i$$&lt;/span&gt; is separable. This is true regardless of the purities of &lt;span class=&quot;math-container&quot;&gt;$\rho_A^i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B^i$&lt;/span&gt;, by definition.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-29T16:12:16.197" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17714" PostTypeId="2" ParentId="17705" CreationDate="2021-05-29T16:45:59.883" Score="0" Body="&lt;p&gt;It is &lt;strong&gt;postulate&lt;/strong&gt; or axiom of quantum mechanics that if a state &lt;span class=&quot;math-container&quot;&gt;$|\psi\rangle $&lt;/span&gt; that is a linear superposition of eigenstates &lt;span class=&quot;math-container&quot;&gt;$\{ |e_i\rangle\}$&lt;/span&gt; of some observable,&#xA;&lt;span class=&quot;math-container&quot;&gt;$$ |\psi \rangle = \sum_i \alpha_i |e_i\rangle $$&lt;/span&gt;&#xA;then upon making measurement &lt;em&gt;with respect to this observable&lt;/em&gt;, the state is observed in the state &lt;span class=&quot;math-container&quot;&gt;$|e_i\rangle$&lt;/span&gt; with probability &lt;span class=&quot;math-container&quot;&gt;$|a_i|^2$&lt;/span&gt;. That is, &lt;span class=&quot;math-container&quot;&gt;$P(|e_i\rangle) = |a_i|^2$&lt;/span&gt;. Also note that &lt;span class=&quot;math-container&quot;&gt;$\sum |\alpha_i|^2 = 1$&lt;/span&gt; is a necessary condition.&lt;/p&gt;&#xA;&lt;p&gt;In quantum computing, when we talk about measurement, it usually correspond to measuring in the computational or Z basis. So for a single qubit system, your observable would be the single Pauli Z matrix, &lt;span class=&quot;math-container&quot;&gt;$Z = \begin{pmatrix} 1 &amp;amp; 0\\ 0 &amp;amp; -1 \end{pmatrix}$&lt;/span&gt;, which has eigenvectors of &lt;span class=&quot;math-container&quot;&gt;$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} $&lt;/span&gt; and  &lt;span class=&quot;math-container&quot;&gt;$|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} $&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Now, your state is &lt;span class=&quot;math-container&quot;&gt;$|\psi \rangle = 0.6|0\rangle + 0.8|1\rangle $&lt;/span&gt; is already written as the linear combination of the eigenstates of the Pauli Z matrix. And thus, the probability to observe &lt;span class=&quot;math-container&quot;&gt;$|0\rangle$&lt;/span&gt; is &lt;span class=&quot;math-container&quot;&gt;$|0.6|^2$&lt;/span&gt;, that is, &lt;span class=&quot;math-container&quot;&gt;$P(|0\rangle ) = |0.6|^2$&lt;/span&gt;.  Similarly, &lt;span class=&quot;math-container&quot;&gt;$P(|1\rangle) = |0.8|^2$&lt;/span&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9858" LastActivityDate="2021-05-29T16:45:59.883" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17715" PostTypeId="2" ParentId="17709" CreationDate="2021-05-29T17:44:23.677" Score="0" Body="&lt;p&gt;The definition of separability does not require any restrictions on the purity of the state. However, if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure then it is separable on some bipartition &lt;span class=&quot;math-container&quot;&gt;$AB$&lt;/span&gt; iff it can be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \rho_A \otimes \rho_B&#xA;$$&lt;/span&gt;&#xA;where both &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; are pure states.&lt;/p&gt;&#xA;&lt;p&gt;Here's a sketch of why that's true. Note that if &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is separable we have&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_i p_i \rho_A^i \otimes \rho_B^i.&#xA;$$&lt;/span&gt;&#xA;Now as &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; is pure the RHS must be rank one. Now for positive semidefinite matrices &lt;span class=&quot;math-container&quot;&gt;$X,Y$&lt;/span&gt; we have that &lt;span class=&quot;math-container&quot;&gt;$\mathrm{rank}(X+Y) \geq \max\{\mathrm{rank}(X), \mathrm{rank}(Y)\}$&lt;/span&gt; and so the RHS is rank one only if &lt;span class=&quot;math-container&quot;&gt;$\rho_A^i \otimes \rho_B^i$&lt;/span&gt; is rank one for all &lt;span class=&quot;math-container&quot;&gt;$i$&lt;/span&gt;. In fact, that sum can only be rank one if each of the terms are scalar multiples of each other. Thus we end up with &lt;span class=&quot;math-container&quot;&gt;$\rho=\rho_A \otimes \rho_B$&lt;/span&gt; which is rank one iff &lt;span class=&quot;math-container&quot;&gt;$\rho_A$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B$&lt;/span&gt; both have rank one.&lt;/p&gt;&#xA;&lt;p&gt;Note also that any separable state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; (not necessarily pure) can always be written as&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;\rho = \sum_i p_i \rho_A^i \otimes \rho_B^i&#xA;$$&lt;/span&gt;&#xA;with &lt;span class=&quot;math-container&quot;&gt;$\rho_A^i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B^i$&lt;/span&gt; pure. This can be shown by taking any separable decomposition and using the spectral decomposition of the &lt;span class=&quot;math-container&quot;&gt;$\rho_A^i$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\rho_B^i$&lt;/span&gt; to write them as a sum of pure states.&lt;/p&gt;&#xA;" OwnerUserId="9854" LastActivityDate="2021-05-29T17:44:23.677" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17716" PostTypeId="2" ParentId="17712" CreationDate="2021-05-29T18:00:45.253" Score="1" Body="&lt;blockquote&gt;&#xA;&lt;p&gt;Why is the amplitude simply so without including the &lt;span class=&quot;math-container&quot;&gt;$x \dot z$&lt;/span&gt; factor?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;When you calculate the amplitude of the &lt;span class=&quot;math-container&quot;&gt;$|0\rangle^{\otimes n}$&lt;/span&gt; state, you have &lt;span class=&quot;math-container&quot;&gt;$z = 0$&lt;/span&gt; (the integer representation of the state you're looking at), so &lt;span class=&quot;math-container&quot;&gt;$x \dot z = 0$&lt;/span&gt; for any &lt;span class=&quot;math-container&quot;&gt;$x$&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Why is the resulting amplitude for the constant case is ±1 and 0 for the balanced case?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For the constant case, if &lt;span class=&quot;math-container&quot;&gt;$f(x) = 0$&lt;/span&gt;, each of the terms &lt;span class=&quot;math-container&quot;&gt;$(-1)^{f(x)}/2^n = 1/2^n$&lt;/span&gt;, and there are &lt;span class=&quot;math-container&quot;&gt;$2^n$&lt;/span&gt; of them, so they add up to 1. If &lt;span class=&quot;math-container&quot;&gt;$f(x) = 1$&lt;/span&gt;, each of the terms is &lt;span class=&quot;math-container&quot;&gt;$-1/2^n$&lt;/span&gt;, and they add up to -1, with the phase difference habitually discarded.&lt;/p&gt;&#xA;&lt;p&gt;For the balanced cases, exactly half of the terms evaluate to &lt;span class=&quot;math-container&quot;&gt;$1/2^n$&lt;/span&gt;, and the other half to &lt;span class=&quot;math-container&quot;&gt;$-1/2^n$&lt;/span&gt;, so they cancel each other out, and the resulting sum is 0.&lt;/p&gt;&#xA;" OwnerUserId="2879" LastActivityDate="2021-05-29T18:00:45.253" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17717" PostTypeId="2" ParentId="17616" CreationDate="2021-05-29T18:02:20.550" Score="2" Body="&lt;p&gt;Vidal &lt;a href=&quot;https://arxiv.org/abs/quant-ph/0301063&quot; rel=&quot;nofollow noreferrer&quot;&gt;proved that&lt;/a&gt;, pure-state quantum computation is efficiently simulable classically if the quantum computer’s state at every time step has amount of entanglement (measured by Schmidt rank) polynomially-bounded (theorem 1 in the linked paper)&#xA;And if the amount of entanglement grows subexponentially,&#xA;then it can be classically simulated with sub-exponential resources (theorem 2).&lt;/p&gt;&#xA;&lt;p&gt;Which means that a pure-state quantum computation can only yield an exponential speed-up over classical computations if it has amount of entanglement increases exponentially with the size n of the computation.&lt;/p&gt;&#xA;&lt;p&gt;However, this is &lt;strong&gt;not sufficient&lt;/strong&gt; because the stabilizer circuits which produce highly entangled states are simulable efficiently on a classical computer, according to &lt;a href=&quot;https://arxiv.org/abs/quant-ph/9807006&quot; rel=&quot;nofollow noreferrer&quot;&gt;Gottesman–Knill theorem&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="9474" LastEditorUserId="9474" LastEditDate="2021-05-29T19:17:25.390" LastActivityDate="2021-05-29T19:17:25.390" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17718" PostTypeId="1" CreationDate="2021-05-29T19:06:43.443" Score="1" ViewCount="11" Body="&lt;p&gt;In (&lt;a href=&quot;https://arxiv.org/abs/1208.4964&quot; rel=&quot;nofollow noreferrer&quot;&gt;Wiseman 2012&lt;/a&gt;), the author mentions (equation (4), page 6), that a state &lt;span class=&quot;math-container&quot;&gt;$\rho$&lt;/span&gt; has zero quantum discord (more precisely, zero &lt;em&gt;Alice-discord&lt;/em&gt;) &lt;em&gt;if and only if&lt;/em&gt; it can be written in the form&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\rho = \sum_j p_j \pi_j\otimes \rho_j,$$&lt;/span&gt;&#xA;for some probability distribution &lt;span class=&quot;math-container&quot;&gt;$p_j$&lt;/span&gt;, some collection of orthogonal projections &lt;span class=&quot;math-container&quot;&gt;$\{\pi_j\}_j$&lt;/span&gt; on Alice's system, and some collection of states &lt;span class=&quot;math-container&quot;&gt;$\rho_j$&lt;/span&gt; on Bob's system.&lt;/p&gt;&#xA;&lt;p&gt;By &amp;quot;Alice-discord&amp;quot; I mean here the discord with respect to measurements performed by Alice (the first system). More precisely, the discord is defined here&#xA;&lt;span class=&quot;math-container&quot;&gt;$$\delta_A(\rho) =I(\rho) - \max_{\{\Pi^A_j\}} J_{\{\Pi^A_j\}}(\rho)&#xA;= S(\rho_A) - S(\rho) + \min_{\{\Pi^A_j\}} S(\rho_{B|\{\Pi^A_j\}}),$$&lt;/span&gt;&#xA;where &lt;span class=&quot;math-container&quot;&gt;$I$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$J$&lt;/span&gt; are the two classically equivalent forms of the mutual information, and the maximisation and minimisations are performed with respect to possible measurements performed by Alice.&lt;/p&gt;&#xA;&lt;p&gt;The author mentions this as &amp;quot;&lt;em&gt;well known&lt;/em&gt;&amp;quot; and does not provide a reference. Is there an easy way to see why this is the case? Alternatively, what is a reference discussing this fact?&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="55" LastEditDate="2021-05-29T22:50:10.463" LastActivityDate="2021-05-29T22:50:10.463" Title="Why is the quantum discord of $\rho$ zero iff $\rho=\sum_j p_j \pi_j\otimes \rho_j$ for mutually orthogonal projections $\pi_j$?" Tags="&lt;non-locality&gt;&lt;nonclassicality&gt;&lt;quantum-discord&gt;" AnswerCount="0" CommentCount="2" ContentLicense="CC BY-SA 4.0" />
  <row Id="17719" PostTypeId="1" CreationDate="2021-05-29T20:49:23.080" Score="1" ViewCount="16" Body="&lt;p&gt;I see that in Bloch spheres, there is an angle for x axis and y axis but not for z axis. Why?&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&quot;https://i.stack.imgur.com/eEeMZ.png&quot; rel=&quot;nofollow noreferrer&quot;&gt;&lt;img src=&quot;https://i.stack.imgur.com/eEeMZ.png&quot; alt=&quot;enter image description here&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="14554" LastActivityDate="2021-05-29T22:56:49.660" Title="Why there is no angle for z axis in Bloch sphere" Tags="&lt;bloch-sphere&gt;" AnswerCount="1" CommentCount="1" ContentLicense="CC BY-SA 4.0" />
  <row Id="17720" PostTypeId="1" CreationDate="2021-05-29T22:23:33.460" Score="1" ViewCount="17" Body="&lt;p&gt;I think I understand circuit based QC (CBQC) well enough; I know very little about MBQC. From what I read it seems that they are somehow &amp;quot;equivalent&amp;quot;. I'd like to check this with a concrete example from QECC. I can find circuits to encode/decode a stabilizer code; we can take the perfect &lt;span class=&quot;math-container&quot;&gt;$[[5,1,3]]$&lt;/span&gt; code as an example &lt;a href=&quot;https://www.cgranade.com/python-quaec/&quot; rel=&quot;nofollow noreferrer&quot;&gt;https://www.cgranade.com/python-quaec/&lt;/a&gt;. How would I translate these circuits to MBQC counterparts?&lt;/p&gt;&#xA;" OwnerUserId="12265" LastActivityDate="2021-05-29T22:23:33.460" Title="translating between measurement based and circuit based quantum computation" Tags="&lt;measurement&gt;&lt;error-correction&gt;&lt;quantum-circuit&gt;&lt;stabilizer-code&gt;" AnswerCount="0" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17721" PostTypeId="2" ParentId="17719" CreationDate="2021-05-29T22:56:49.660" Score="0" Body="&lt;p&gt;This is because we are using a spherical coordinate system. You can think of this coordinate system as specifying a radius, then two angular coordinates &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt;.&#xA;Pure single-qubit states have a Bloch vector with radius equal to unity, so they only need two more coordinates to fully specify the direction in which the vector points.&lt;/p&gt;&#xA;&lt;p&gt;When you look at a map of the Earth, everyone moves around at approximately the same radius, but our two angular coordinates can change. You might be familiar with latitude and longitude - these are two coordinates describing where we are on the surface of the Earth, just like the two coordinates &lt;span class=&quot;math-container&quot;&gt;$\theta$&lt;/span&gt; and &lt;span class=&quot;math-container&quot;&gt;$\phi$&lt;/span&gt; describe where a vector is on the surface of the Bloch sphere.&lt;/p&gt;&#xA;&lt;p&gt;Another way of approaching the problem: three-dimensional vectors have three free parameters. Once we specify a radius, we only need two more parameters to fully specify the vector.&lt;/p&gt;&#xA;" OwnerUserId="15820" LastActivityDate="2021-05-29T22:56:49.660" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17722" PostTypeId="2" ParentId="6443" CreationDate="2021-05-29T23:11:04.667" Score="0" Body="&lt;p&gt;The proof from Jozsa, Richard (1994). Fidelity for Mixed Quantum States. Journal of Modern Optics, 41(12), 2315–2323. doi:10.1080/09500349414552171&lt;/p&gt;&#xA;&lt;p&gt;Let &lt;span class=&quot;math-container&quot;&gt;$M = \sqrt \rho \sigma \sqrt\rho$&lt;/span&gt;. It's a hermitian 2x2 matrix, so its eigenvalues are &lt;span class=&quot;math-container&quot;&gt;$\lambda_1, \lambda_2 \geq 0$&lt;/span&gt;. Then we have&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$$F(\rho,\sigma) = (tr\sqrt M) ^2= (\sqrt\lambda_1 + \sqrt\lambda_2)^2 &#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= \lambda_1 + \lambda_2 + 2\sqrt{\lambda_1 \lambda_2} = tr(M) + 2\sqrt{\det M}&#xA;$$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$$&#xA;= tr(\rho\sigma) + 2\sqrt{\det{\rho}\det{\sigma}}&#xA;$$&lt;/span&gt;&#xA;where the last step uses cyclicity of trace and multiplication of determinants.&lt;/p&gt;&#xA;" OwnerUserId="16072" LastActivityDate="2021-05-29T23:11:04.667" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17723" PostTypeId="1" CreationDate="2021-05-30T00:51:13.363" Score="2" ViewCount="9" Body="&lt;p&gt;Introductions to Quantum Computing treat the Control qubit of a CNOT as unchanged, and this is true for some Control values, eg |0⟩, |1⟩, and (at least when used with a Hadamard-transformed |1⟩ Target) a Hadamard-transformed |1⟩.&lt;/p&gt;&#xA;&lt;p&gt;But some other Control values, including a Hadamard-transformed |0⟩, apparently lead to entangled final states, by definition changing the Control.&lt;/p&gt;&#xA;&lt;p&gt;Where can I find a more complete explanation of CNOT final qubit states (unchanged/changed/entangled) and the related initial states ?&lt;/p&gt;&#xA;" OwnerUserId="15999" LastActivityDate="2021-05-30T02:20:31.573" Title="Looking for a complete CNOT gate description" Tags="&lt;entanglement&gt;" AnswerCount="1" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
  <row Id="17724" PostTypeId="2" ParentId="17723" CreationDate="2021-05-30T02:20:31.573" Score="0" Body="&lt;p&gt;The CNOT matrix is the same regardless of the input (i.e. regardless of which vector is involved in the matrix-vector multiplication).&lt;/p&gt;&#xA;&lt;p&gt;Your question indicates some discomfort with how CNOT works when the control qubit is in the state: &lt;span class=&quot;math-container&quot;&gt;$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$&lt;/span&gt;, but it works just the same as CNOT does with any other control qubit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&quot;math-container&quot;&gt;$\textrm{CNOT}\left(\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)|0\rangle\right) = \textrm{CNOT}\left(\frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)\right) = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)\tag{1},$&lt;/span&gt;&#xA;&lt;span class=&quot;math-container&quot;&gt;$\textrm{CNOT}\left(\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)|1\rangle\right) = \textrm{CNOT}\left(\frac{1}{\sqrt{2}}(|01\rangle + |11\rangle)\right) = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)\tag{2}.$&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In all cases CNOT does the same thing:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|00\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|01\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt;,&lt;/li&gt;&#xA;&lt;li&gt;&lt;span class=&quot;math-container&quot;&gt;$|11\rangle$&lt;/span&gt; becomes &lt;span class=&quot;math-container&quot;&gt;$|10\rangle$&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;At the beginning, this can all seem a bit confusing to a beginning that's still getting used to Dirac notation, and quantum information language in general, but I assure you that if you read through the Nielsen and Chuang book patiently and work through the exercises, in time this will all become second nature to you.&lt;/p&gt;&#xA;" OwnerUserId="2293" LastActivityDate="2021-05-30T02:20:31.573" CommentCount="0" ContentLicense="CC BY-SA 4.0" />
</posts>